From: support Date: Sat, 9 Jul 2022 07:19:22 +0000 (+0000) Subject: Built motion from commit eddce310.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=29a49f2bf55af5510507e01a9bed31ab214170f7;p=motion2.git Built motion from commit eddce310.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b229436..f02b1cc 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.11", + "version": "2.6.12", "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": "2022-07-01T07:37:39.445Z", + "time": "2022-07-09T07:11:47.240Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 035e744..58ee70d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.11", + "version": "2.6.12", "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": "2022-07-01T07:37:39.445Z", + "time": "2022-07-09T07:11:47.240Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 224f778..cdc4ad1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.11", + "version": "2.6.12", "dependencies": { "@swc/helpers": { "version": "0.3.17", diff --git a/package.json b/package.json index 2465c10..14ecdfd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.11", + "version": "2.6.12", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 689f102..9fd2dc1 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 _0x87de=['urlForward[body]','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0xa2a7e7,_0x250825){var _0xabef5b=function(_0x2aa826){while(--_0x2aa826){_0xa2a7e7['push'](_0xa2a7e7['shift']());}};_0xabef5b(++_0x250825);}(_0x87de,0x67));var _0xe87d=function(_0x5c7e52,_0x573688){_0x5c7e52=_0x5c7e52-0x0;var _0x20bf7d=_0x87de[_0x5c7e52];return _0x20bf7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe87d('0x0')],'get':function(_0x3e21fe){return this[_0xe87d('0x1')](_0xe87d('0x2'));}},'action':{'type':Sequelize[_0xe87d('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe87d('0x4'),_0xe87d('0x5'),_0xe87d('0x6'),_0xe87d('0x7'),_0xe87d('0x8'),_0xe87d('0x9'),'bot',_0xe87d('0xa')]],'msg':_0xe87d('0xb')}},'comment':_0xe87d('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xe87d('0xc')},'data2':{'type':Sequelize[_0xe87d('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xe87d('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xe87d('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xe87d('0x3')](0x1000),'comments':_0xe87d('0xd')},'data6':{'type':Sequelize[_0xe87d('0x3')],'comments':_0xe87d('0xe')},'data7':{'type':Sequelize[_0xe87d('0xf')],'comments':_0xe87d('0x10')}}; \ No newline at end of file +var _0xb4dd=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot'];(function(_0x886a7f,_0x37462d){var _0x58f295=function(_0xbf7d36){while(--_0xbf7d36){_0x886a7f['push'](_0x886a7f['shift']());}};_0x58f295(++_0x37462d);}(_0xb4dd,0x1a6));var _0xdb4d=function(_0x330fb6,_0x2a9194){_0x330fb6=_0x330fb6-0x0;var _0x5b8e60=_0xb4dd[_0x330fb6];return _0x5b8e60;};'use strict';var Sequelize=require(_0xdb4d('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x43cab9){return this[_0xdb4d('0x1')](_0xdb4d('0x2'));}},'action':{'type':Sequelize[_0xdb4d('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xdb4d('0x4'),_0xdb4d('0x5'),_0xdb4d('0x6'),_0xdb4d('0x7'),_0xdb4d('0x8'),_0xdb4d('0x9'),_0xdb4d('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdb4d('0xb')},'data1':{'type':Sequelize[_0xdb4d('0x3')](0x1000),'comment':_0xdb4d('0xc')},'data2':{'type':Sequelize[_0xdb4d('0x3')](0x1000),'comment':_0xdb4d('0xd')},'data3':{'type':Sequelize[_0xdb4d('0x3')](0x1000),'comment':_0xdb4d('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xdb4d('0xf')},'data5':{'type':Sequelize[_0xdb4d('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xdb4d('0x3')],'comments':_0xdb4d('0x10')},'data7':{'type':Sequelize[_0xdb4d('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3141156..430daef 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 _0x8714=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','Action','params','catch','destroy','find','eml-format'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x8714,0x103));var _0x4871=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x8714[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0x4871('0x0'));var rimraf=require(_0x4871('0x1'));var zipdir=require(_0x4871('0x2'));var jsonpatch=require(_0x4871('0x3'));var rp=require(_0x4871('0x4'));var moment=require(_0x4871('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4871('0x6'));var path=require(_0x4871('0x7'));var sox=require(_0x4871('0x8'));var csv=require(_0x4871('0x9'));var ejs=require(_0x4871('0xa'));var fs=require('fs');var fs_extra=require(_0x4871('0xb'));var _=require(_0x4871('0xc'));var squel=require(_0x4871('0xd'));var crypto=require(_0x4871('0xe'));var jsforce=require(_0x4871('0xf'));var deskjs=require(_0x4871('0x10'));var toCsv=require(_0x4871('0x9'));var querystring=require('querystring');var Papa=require(_0x4871('0x11'));var Redis=require(_0x4871('0x12'));var authService=require(_0x4871('0x13'));var qs=require(_0x4871('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4871('0x15'));var logger=require('../../config/logger')(_0x4871('0x16'));var utils=require(_0x4871('0x17'));var config=require(_0x4871('0x18'));var licenseUtil=require(_0x4871('0x19'));var db=require(_0x4871('0x1a'))['db'];function respondWithStatusCode(_0x100e12,_0x5ce01f){_0x5ce01f=_0x5ce01f||0xcc;return function(_0x468767){if(_0x468767){return _0x100e12[_0x4871('0x1b')](_0x5ce01f);}return _0x100e12['status'](_0x5ce01f)[_0x4871('0x1c')]();};}function respondWithResult(_0x66b75b,_0xb3b3cc){_0xb3b3cc=_0xb3b3cc||0xc8;return function(_0x505514){if(_0x505514){return _0x66b75b[_0x4871('0x1d')](_0xb3b3cc)[_0x4871('0x1e')](_0x505514);}};}function respondWithFilteredResult(_0xb15159,_0x15e246){return function(_0x19071a){if(_0x19071a){var _0x2c18d9=typeof _0x15e246['offset']===_0x4871('0x1f')&&typeof _0x15e246[_0x4871('0x20')]===_0x4871('0x1f');var _0x3cf44a=_0x19071a[_0x4871('0x21')];var _0x5441a1=_0x2c18d9?0x0:_0x15e246['offset'];var _0x5b8c10=_0x2c18d9?_0x19071a['count']:_0x15e246[_0x4871('0x22')]+_0x15e246['limit'];var _0xbbd80a;if(_0x5b8c10>=_0x3cf44a){_0x5b8c10=_0x3cf44a;_0xbbd80a=0xc8;}else{_0xbbd80a=0xce;}_0xb15159[_0x4871('0x1d')](_0xbbd80a);return _0xb15159[_0x4871('0x23')](_0x4871('0x24'),_0x5441a1+'-'+_0x5b8c10+'/'+_0x3cf44a)['json'](_0x19071a);}return null;};}function patchUpdates(_0x2298f6){return function(_0x363a78){try{jsonpatch[_0x4871('0x25')](_0x363a78,_0x2298f6,!![]);}catch(_0x323db4){return BPromise[_0x4871('0x26')](_0x323db4);}return _0x363a78[_0x4871('0x27')]();};}function saveUpdates(_0x4fad1d,_0x21593c){return function(_0x16d4ca){if(_0x16d4ca){return _0x16d4ca[_0x4871('0x28')](_0x4fad1d)[_0x4871('0x29')](function(_0x64048a){return _0x64048a;});}return null;};}function removeEntity(_0x3ba4e7,_0x2166cb){return function(_0x29114f){if(_0x29114f){return _0x29114f['destroy']()[_0x4871('0x29')](function(){_0x3ba4e7[_0x4871('0x1d')](0xcc)[_0x4871('0x1c')]();});}};}function handleEntityNotFound(_0x1a2327,_0x13af0c){return function(_0x371a0f){if(!_0x371a0f){_0x1a2327[_0x4871('0x1b')](0x194);}return _0x371a0f;};}function handleError(_0x38e6b3,_0x415af7){_0x415af7=_0x415af7||0x1f4;return function(_0x982170){logger[_0x4871('0x2a')](_0x982170[_0x4871('0x2b')]);if(_0x982170[_0x4871('0x2c')]){delete _0x982170[_0x4871('0x2c')];}_0x38e6b3[_0x4871('0x1d')](_0x415af7)[_0x4871('0x2d')](_0x982170);};}exports[_0x4871('0x28')]=function(_0x54c585,_0x2b9d9b){if(_0x54c585[_0x4871('0x2e')]['id']){delete _0x54c585[_0x4871('0x2e')]['id'];}return db[_0x4871('0x2f')]['find']({'where':{'id':_0x54c585[_0x4871('0x30')]['id']}})[_0x4871('0x29')](handleEntityNotFound(_0x2b9d9b,null))['then'](saveUpdates(_0x54c585[_0x4871('0x2e')],null))['then'](respondWithResult(_0x2b9d9b,null))[_0x4871('0x31')](handleError(_0x2b9d9b,null));};exports[_0x4871('0x32')]=function(_0x148eb7,_0x490aa0){return db[_0x4871('0x2f')][_0x4871('0x33')]({'where':{'id':_0x148eb7[_0x4871('0x30')]['id']}})['then'](handleEntityNotFound(_0x490aa0,null))[_0x4871('0x29')](removeEntity(_0x490aa0,null))['catch'](handleError(_0x490aa0,null));}; \ No newline at end of file +var _0x7055=['fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','body','Action','find','params','catch','eml-format','rimraf','zip-dir'];(function(_0x599ec8,_0x3941e2){var _0x2b3c9b=function(_0x3fdf2d){while(--_0x3fdf2d){_0x599ec8['push'](_0x599ec8['shift']());}};_0x2b3c9b(++_0x3941e2);}(_0x7055,0x165));var _0x5705=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x7055[_0x361d3f];return _0x320229;};'use strict';var emlformat=require(_0x5705('0x0'));var rimraf=require(_0x5705('0x1'));var zipdir=require(_0x5705('0x2'));var jsonpatch=require(_0x5705('0x3'));var rp=require('request-promise');var moment=require(_0x5705('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5705('0x5'));var util=require(_0x5705('0x6'));var path=require(_0x5705('0x7'));var sox=require(_0x5705('0x8'));var csv=require(_0x5705('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5705('0xa'));var squel=require('squel');var crypto=require(_0x5705('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5705('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5705('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5705('0xd'));var as=require(_0x5705('0xe'));var hardwareService=require(_0x5705('0xf'));var logger=require(_0x5705('0x10'))('api');var utils=require(_0x5705('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5797ae,_0x46481b){_0x46481b=_0x46481b||0xcc;return function(_0x41fc54){if(_0x41fc54){return _0x5797ae[_0x5705('0x12')](_0x46481b);}return _0x5797ae[_0x5705('0x13')](_0x46481b)['end']();};}function respondWithResult(_0x1f36fa,_0x68274d){_0x68274d=_0x68274d||0xc8;return function(_0xc8c5b4){if(_0xc8c5b4){return _0x1f36fa[_0x5705('0x13')](_0x68274d)['json'](_0xc8c5b4);}};}function respondWithFilteredResult(_0x41c5a3,_0x37eb82){return function(_0xe57eaf){if(_0xe57eaf){var _0x3f7ee6=typeof _0x37eb82[_0x5705('0x14')]===_0x5705('0x15')&&typeof _0x37eb82[_0x5705('0x16')]==='undefined';var _0x44f3ae=_0xe57eaf['count'];var _0x4deeda=_0x3f7ee6?0x0:_0x37eb82[_0x5705('0x14')];var _0x146d0a=_0x3f7ee6?_0xe57eaf[_0x5705('0x17')]:_0x37eb82['offset']+_0x37eb82[_0x5705('0x16')];var _0x224647;if(_0x146d0a>=_0x44f3ae){_0x146d0a=_0x44f3ae;_0x224647=0xc8;}else{_0x224647=0xce;}_0x41c5a3[_0x5705('0x13')](_0x224647);return _0x41c5a3['set'](_0x5705('0x18'),_0x4deeda+'-'+_0x146d0a+'/'+_0x44f3ae)[_0x5705('0x19')](_0xe57eaf);}return null;};}function patchUpdates(_0x5c3cbb){return function(_0x342aff){try{jsonpatch[_0x5705('0x1a')](_0x342aff,_0x5c3cbb,!![]);}catch(_0x45b086){return BPromise[_0x5705('0x1b')](_0x45b086);}return _0x342aff['save']();};}function saveUpdates(_0x1beab5,_0x5d9f1b){return function(_0x52a641){if(_0x52a641){return _0x52a641[_0x5705('0x1c')](_0x1beab5)[_0x5705('0x1d')](function(_0x3d8da5){return _0x3d8da5;});}return null;};}function removeEntity(_0x234599,_0x3e6d51){return function(_0x408e84){if(_0x408e84){return _0x408e84[_0x5705('0x1e')]()['then'](function(){_0x234599[_0x5705('0x13')](0xcc)[_0x5705('0x1f')]();});}};}function handleEntityNotFound(_0xa1b5a5,_0xb97760){return function(_0x179024){if(!_0x179024){_0xa1b5a5[_0x5705('0x12')](0x194);}return _0x179024;};}function handleError(_0xceb7ea,_0x28f7ac){_0x28f7ac=_0x28f7ac||0x1f4;return function(_0x4872ff){logger[_0x5705('0x20')](_0x4872ff[_0x5705('0x21')]);if(_0x4872ff['name']){delete _0x4872ff[_0x5705('0x22')];}_0xceb7ea['status'](_0x28f7ac)['send'](_0x4872ff);};}exports[_0x5705('0x1c')]=function(_0x4ca1a9,_0x48e6bd){if(_0x4ca1a9[_0x5705('0x23')]['id']){delete _0x4ca1a9[_0x5705('0x23')]['id'];}return db[_0x5705('0x24')][_0x5705('0x25')]({'where':{'id':_0x4ca1a9['params']['id']}})[_0x5705('0x1d')](handleEntityNotFound(_0x48e6bd,null))[_0x5705('0x1d')](saveUpdates(_0x4ca1a9[_0x5705('0x23')],null))['then'](respondWithResult(_0x48e6bd,null))['catch'](handleError(_0x48e6bd,null));};exports['destroy']=function(_0x13e584,_0x1e3765){return db[_0x5705('0x24')][_0x5705('0x25')]({'where':{'id':_0x13e584[_0x5705('0x26')]['id']}})[_0x5705('0x1d')](handleEntityNotFound(_0x1e3765,null))[_0x5705('0x1d')](removeEntity(_0x1e3765,null))[_0x5705('0x27')](handleError(_0x1e3765,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 03ee18c..88f8f9a 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 _0x8d09=['Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path','rimraf','./action.attributes','exports','define'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0x8d09,0x12e));var _0x98d0=function(_0x48ff5f,_0x134535){_0x48ff5f=_0x48ff5f-0x0;var _0x3c0cd7=_0x8d09[_0x48ff5f];return _0x3c0cd7;};'use strict';var _=require(_0x98d0('0x0'));var util=require(_0x98d0('0x1'));var logger=require(_0x98d0('0x2'))(_0x98d0('0x3'));var moment=require('moment');var BPromise=require(_0x98d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98d0('0x5'));var rimraf=require(_0x98d0('0x6'));var config=require('../../config/environment');var attributes=require(_0x98d0('0x7'));module[_0x98d0('0x8')]=function(_0x2cbc8d,_0x51f7a7){return _0x2cbc8d[_0x98d0('0x9')](_0x98d0('0xa'),attributes,{'tableName':_0x98d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64d9=['api','moment','bluebird','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x390c1c,_0x3b4352){var _0x191b4b=function(_0x1aca5f){while(--_0x1aca5f){_0x390c1c['push'](_0x390c1c['shift']());}};_0x191b4b(++_0x3b4352);}(_0x64d9,0xb2));var _0x964d=function(_0x25763d,_0x554ab3){_0x25763d=_0x25763d-0x0;var _0xf5f23c=_0x64d9[_0x25763d];return _0xf5f23c;};'use strict';var _=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var logger=require('../../config/logger')(_0x964d('0x2'));var moment=require(_0x964d('0x3'));var BPromise=require(_0x964d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x964d('0x5'));var rimraf=require('rimraf');var config=require(_0x964d('0x6'));var attributes=require(_0x964d('0x7'));module[_0x964d('0x8')]=function(_0x17bbb7,_0x2f6f38){return _0x17bbb7[_0x964d('0x9')](_0x964d('0xa'),attributes,{'tableName':_0x964d('0xb'),'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 a9b81cf..21f7b1a 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa54582,_0x2e2927){var _0x319ef3=function(_0x571304){while(--_0x571304){_0xa54582['push'](_0xa54582['shift']());}};_0x319ef3(++_0x2e2927);}(_0x326f,0xd1));var _0xf326=function(_0x4bbc75,_0xc2fc7e){_0x4bbc75=_0x4bbc75-0x0;var _0x5d6624=_0x326f[_0x4bbc75];return _0x5d6624;};'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')]('Action,\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')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x33cf23,_0x1e2beb){_0x33cf23=_0x33cf23-0x0;var _0x271bb2=_0x7a54[_0x33cf23];return _0x271bb2;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8bc250a..30a5b88 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 _0xc95e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc95e,0x1c2));var _0xec95=function(_0x410be1,_0x3085c2){_0x410be1=_0x410be1-0x0;var _0x52835b=_0xc95e[_0x410be1];return _0x52835b;};'use strict';var multer=require(_0xec95('0x0'));var util=require(_0xec95('0x1'));var path=require(_0xec95('0x2'));var timeout=require(_0xec95('0x3'));var express=require(_0xec95('0x4'));var router=express[_0xec95('0x5')]();var fs_extra=require(_0xec95('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec95('0x7'));var controller=require(_0xec95('0x8'));router[_0xec95('0x9')](_0xec95('0xa'),auth[_0xec95('0xb')](),controller['update']);router[_0xec95('0xc')]('/:id',auth[_0xec95('0xb')](),controller[_0xec95('0xd')]);module[_0xec95('0xe')]=router; \ No newline at end of file +var _0xee52=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x2cd179,_0x454cca){var _0x19bd56=function(_0x63cbd9){while(--_0x63cbd9){_0x2cd179['push'](_0x2cd179['shift']());}};_0x19bd56(++_0x454cca);}(_0xee52,0x197));var _0x2ee5=function(_0x5c9863,_0x1b0092){_0x5c9863=_0x5c9863-0x0;var _0x48214c=_0xee52[_0x5c9863];return _0x48214c;};'use strict';var multer=require(_0x2ee5('0x0'));var util=require(_0x2ee5('0x1'));var path=require('path');var timeout=require(_0x2ee5('0x2'));var express=require(_0x2ee5('0x3'));var router=express[_0x2ee5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ee5('0x5'));var interaction=require(_0x2ee5('0x6'));var config=require('../../config/environment');var controller=require(_0x2ee5('0x7'));router[_0x2ee5('0x8')](_0x2ee5('0x9'),auth[_0x2ee5('0xa')](),controller[_0x2ee5('0xb')]);router[_0x2ee5('0xc')](_0x2ee5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2ee5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0a157ec..deea37e 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 _0x326f=['STRING','TEXT','sequelize'];(function(_0x3e38a8,_0x4efe99){var _0x55e0da=function(_0x3e715e){while(--_0x3e715e){_0x3e38a8['push'](_0x3e38a8['shift']());}};_0x55e0da(++_0x4efe99);}(_0x326f,0xd1));var _0xf326=function(_0xeb44b1,_0x257def){_0xeb44b1=_0xeb44b1-0x0;var _0x507cac=_0x326f[_0xeb44b1];return _0x507cac;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x144460,_0x4c9552){var _0x673ece=function(_0x31542b){while(--_0x31542b){_0x144460['push'](_0x144460['shift']());}};_0x673ece(++_0x4c9552);}(_0xd8fb,0x99));var _0xbd8f=function(_0x20aa5a,_0x2a6c26){_0x20aa5a=_0x20aa5a-0x0;var _0x1822c6=_0xd8fb[_0x20aa5a];return _0x1822c6;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 727b8d2..a85d9e5 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 _0x42e2=['SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','HOUR(%s)','groupBy','output','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','UNIX_TIMESTAMP(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x42e2,0xee));var _0x242e=function(_0xf641bd,_0x4e6c3a){_0xf641bd=_0xf641bd-0x0;var _0x59567b=_0x42e2[_0xf641bd];return _0x59567b;};'use strict';var emlformat=require(_0x242e('0x0'));var rimraf=require(_0x242e('0x1'));var zipdir=require(_0x242e('0x2'));var jsonpatch=require(_0x242e('0x3'));var rp=require(_0x242e('0x4'));var moment=require(_0x242e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x242e('0x6'));var util=require(_0x242e('0x7'));var path=require(_0x242e('0x8'));var sox=require(_0x242e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x242e('0xa'));var squel=require(_0x242e('0xb'));var crypto=require(_0x242e('0xc'));var jsforce=require(_0x242e('0xd'));var deskjs=require(_0x242e('0xe'));var toCsv=require(_0x242e('0xf'));var querystring=require(_0x242e('0x10'));var Papa=require('papaparse');var Redis=require(_0x242e('0x11'));var authService=require(_0x242e('0x12'));var qs=require(_0x242e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x242e('0x14'));var logger=require('../../config/logger')(_0x242e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x242e('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0x242e('0x17'))[_0x242e('0x18')];function respondWithStatusCode(_0x4462aa,_0x4eaa7c){_0x4eaa7c=_0x4eaa7c||0xcc;return function(_0x321ea7){if(_0x321ea7){return _0x4462aa[_0x242e('0x19')](_0x4eaa7c);}return _0x4462aa['status'](_0x4eaa7c)[_0x242e('0x1a')]();};}function respondWithResult(_0x1765bc,_0x4945f0){_0x4945f0=_0x4945f0||0xc8;return function(_0x3e98cf){if(_0x3e98cf){return _0x1765bc['status'](_0x4945f0)[_0x242e('0x1b')](_0x3e98cf);}};}function respondWithFilteredResult(_0x2ab357,_0x345af7){return function(_0x82c722){if(_0x82c722){var _0x5d93c5=typeof _0x345af7[_0x242e('0x1c')]==='undefined'&&typeof _0x345af7[_0x242e('0x1d')]===_0x242e('0x1e');var _0x3b6aa7=_0x82c722[_0x242e('0x1f')];var _0x21bae4=_0x5d93c5?0x0:_0x345af7[_0x242e('0x1c')];var _0xb23e3=_0x5d93c5?_0x82c722[_0x242e('0x1f')]:_0x345af7[_0x242e('0x1c')]+_0x345af7[_0x242e('0x1d')];var _0x106149;if(_0xb23e3>=_0x3b6aa7){_0xb23e3=_0x3b6aa7;_0x106149=0xc8;}else{_0x106149=0xce;}_0x2ab357[_0x242e('0x20')](_0x106149);return _0x2ab357[_0x242e('0x21')](_0x242e('0x22'),_0x21bae4+'-'+_0xb23e3+'/'+_0x3b6aa7)[_0x242e('0x1b')](_0x82c722);}return null;};}function patchUpdates(_0x33ecc0){return function(_0x2eb472){try{jsonpatch['apply'](_0x2eb472,_0x33ecc0,!![]);}catch(_0x2a634b){return BPromise[_0x242e('0x23')](_0x2a634b);}return _0x2eb472[_0x242e('0x24')]();};}function saveUpdates(_0x4aee75,_0x3e226d){return function(_0x57d0dd){if(_0x57d0dd){return _0x57d0dd[_0x242e('0x25')](_0x4aee75)['then'](function(_0x3578fa){return _0x3578fa;});}return null;};}function removeEntity(_0x5961c8,_0xe9562b){return function(_0x184bab){if(_0x184bab){return _0x184bab['destroy']()[_0x242e('0x26')](function(){var _0x5e60d5=_0x184bab[_0x242e('0x27')]({'plain':!![]});var _0x533449='CustomReports';return db[_0x242e('0x28')][_0x242e('0x29')]({'where':{'type':_0x533449,'resourceId':_0x5e60d5['id']}})['then'](function(){return _0x184bab;});})[_0x242e('0x26')](function(){_0x5961c8[_0x242e('0x20')](0xcc)[_0x242e('0x1a')]();});}};}function handleEntityNotFound(_0x1b1417,_0x60186b){return function(_0x196ee8){if(!_0x196ee8){_0x1b1417[_0x242e('0x19')](0x194);}return _0x196ee8;};}function handleError(_0x5daeb1,_0x34cd90){_0x34cd90=_0x34cd90||0x1f4;return function(_0x17caa5){logger[_0x242e('0x2a')](_0x17caa5['stack']);if(_0x17caa5[_0x242e('0x2b')]){delete _0x17caa5[_0x242e('0x2b')];}_0x5daeb1[_0x242e('0x20')](_0x34cd90)[_0x242e('0x2c')](_0x17caa5);};}exports[_0x242e('0x2d')]=function(_0x42388c,_0x2ba1cd){var _0x423f98={},_0x1dba68={},_0x59f5ba={'count':0x0,'rows':[]};var _0x148574=_[_0x242e('0x2e')](db[_0x242e('0x2f')][_0x242e('0x30')],function(_0x599e84){return{'name':_0x599e84[_0x242e('0x31')],'type':_0x599e84['type']['key']};});_0x1dba68[_0x242e('0x32')]=_[_0x242e('0x2e')](_0x148574,'name');_0x1dba68[_0x242e('0x33')]=_[_0x242e('0x34')](_0x42388c[_0x242e('0x33')]);_0x1dba68[_0x242e('0x35')]=_[_0x242e('0x36')](_0x1dba68[_0x242e('0x32')],_0x1dba68[_0x242e('0x33')]);_0x423f98[_0x242e('0x37')]=_['intersection'](_0x1dba68[_0x242e('0x32')],qs[_0x242e('0x38')](_0x42388c[_0x242e('0x33')][_0x242e('0x38')]));_0x423f98[_0x242e('0x37')]=_0x423f98['attributes'][_0x242e('0x39')]?_0x423f98[_0x242e('0x37')]:_0x1dba68[_0x242e('0x32')];if(!_0x42388c[_0x242e('0x33')][_0x242e('0x3a')](_0x242e('0x3b'))){_0x423f98[_0x242e('0x1d')]=qs[_0x242e('0x1d')](_0x42388c['query']['limit']);_0x423f98['offset']=qs['offset'](_0x42388c['query'][_0x242e('0x1c')]);}_0x423f98[_0x242e('0x3c')]=qs[_0x242e('0x3d')](_0x42388c[_0x242e('0x33')][_0x242e('0x3d')]);_0x423f98[_0x242e('0x3e')]=qs[_0x242e('0x35')](_['pick'](_0x42388c[_0x242e('0x33')],_0x1dba68['filters']),_0x148574);if(_0x42388c['query'][_0x242e('0x3f')]){_0x423f98[_0x242e('0x3e')]=_['merge'](_0x423f98[_0x242e('0x3e')],{'$or':_[_0x242e('0x2e')](_0x148574,function(_0x42268e){if(_0x42268e[_0x242e('0x40')]!=='VIRTUAL'){var _0x13ff36={};_0x13ff36[_0x42268e[_0x242e('0x2b')]]={'$like':'%'+_0x42388c['query'][_0x242e('0x3f')]+'%'};return _0x13ff36;}})});}_0x423f98=_[_0x242e('0x41')]({},_0x423f98,_0x42388c['options']);var _0x471f2={'where':_0x423f98['where']};return db[_0x242e('0x2f')]['count'](_0x471f2)[_0x242e('0x26')](function(_0x8e269b){_0x59f5ba['count']=_0x8e269b;if(_0x42388c[_0x242e('0x33')][_0x242e('0x42')]){_0x423f98[_0x242e('0x43')]=[{'all':!![]}];}return db[_0x242e('0x2f')][_0x242e('0x44')](_0x423f98);})[_0x242e('0x26')](function(_0x2b20dd){_0x59f5ba['rows']=_0x2b20dd;return _0x59f5ba;})[_0x242e('0x26')](respondWithFilteredResult(_0x2ba1cd,_0x423f98))[_0x242e('0x45')](handleError(_0x2ba1cd,null));};exports[_0x242e('0x46')]=function(_0x354fe4,_0x3c47fb){var _0x28936b={'raw':![],'where':{'id':_0x354fe4[_0x242e('0x47')]['id']}},_0x13b3f4={};_0x13b3f4[_0x242e('0x32')]=_['keys'](db[_0x242e('0x2f')][_0x242e('0x30')]);_0x13b3f4['query']=_[_0x242e('0x34')](_0x354fe4[_0x242e('0x33')]);_0x13b3f4[_0x242e('0x35')]=_[_0x242e('0x36')](_0x13b3f4[_0x242e('0x32')],_0x13b3f4[_0x242e('0x33')]);_0x28936b[_0x242e('0x37')]=_[_0x242e('0x36')](_0x13b3f4['model'],qs[_0x242e('0x38')](_0x354fe4['query'][_0x242e('0x38')]));_0x28936b['attributes']=_0x28936b[_0x242e('0x37')][_0x242e('0x39')]?_0x28936b[_0x242e('0x37')]:_0x13b3f4[_0x242e('0x32')];if(_0x354fe4['query'][_0x242e('0x42')]){_0x28936b['include']=[{'all':!![]}];}_0x28936b=_[_0x242e('0x41')]({},_0x28936b,_0x354fe4['options']);return db[_0x242e('0x2f')][_0x242e('0x48')](_0x28936b)[_0x242e('0x26')](handleEntityNotFound(_0x3c47fb,null))[_0x242e('0x26')](respondWithResult(_0x3c47fb,null))['catch'](handleError(_0x3c47fb,null));};exports[_0x242e('0x49')]=function(_0x1f1461,_0xecfe07){return db[_0x242e('0x2f')][_0x242e('0x49')](_0x1f1461[_0x242e('0x4a')],{})['then'](function(_0x19503c){var _0x22791a=_0x1f1461[_0x242e('0x4b')][_0x242e('0x27')]({'plain':!![]});if(!_0x22791a)throw new Error(_0x242e('0x4c'));if(_0x22791a['role']===_0x242e('0x4b')){var _0x4e77dc=_0x19503c[_0x242e('0x27')]({'plain':!![]});var _0x557c81=_0x242e('0x4d');return db['UserProfileSection'][_0x242e('0x48')]({'where':{'name':_0x557c81,'userProfileId':_0x22791a[_0x242e('0x4e')]},'raw':!![]})[_0x242e('0x26')](function(_0x245d3c){if(_0x245d3c&&_0x245d3c[_0x242e('0x4f')]===0x0){return db[_0x242e('0x28')][_0x242e('0x49')]({'name':_0x4e77dc[_0x242e('0x2b')],'resourceId':_0x4e77dc['id'],'type':'CustomReports','sectionId':_0x245d3c['id']},{})[_0x242e('0x26')](function(){return _0x19503c;});}else{return _0x19503c;}})[_0x242e('0x45')](function(_0x339943){logger['error'](_0x242e('0x50'),_0x339943);throw _0x339943;});}return _0x19503c;})[_0x242e('0x26')](respondWithResult(_0xecfe07,0xc9))[_0x242e('0x45')](handleError(_0xecfe07,null));};exports[_0x242e('0x25')]=function(_0x288b47,_0x421816){if(_0x288b47['body']['id']){delete _0x288b47['body']['id'];}return db['AnalyticCustomReport'][_0x242e('0x48')]({'where':{'id':_0x288b47['params']['id']}})[_0x242e('0x26')](handleEntityNotFound(_0x421816,null))[_0x242e('0x26')](saveUpdates(_0x288b47[_0x242e('0x4a')],null))[_0x242e('0x26')](respondWithResult(_0x421816,null))['catch'](handleError(_0x421816,null));};exports[_0x242e('0x29')]=function(_0x3c85ca,_0x4d4fdc){return db[_0x242e('0x2f')][_0x242e('0x48')]({'where':{'id':_0x3c85ca[_0x242e('0x47')]['id']}})[_0x242e('0x26')](handleEntityNotFound(_0x4d4fdc,null))[_0x242e('0x26')](removeEntity(_0x4d4fdc,null))[_0x242e('0x45')](handleError(_0x4d4fdc,null));};exports['preview']=function(_0xc678ac,_0x2025e0){var _0x1b1a6d=0xa;var _0x52bf6e=[_0x242e('0x51'),_0x242e('0x52'),_0x242e('0x53'),'cross_join'];var _0x3927a1={'SUM':_0x242e('0x54'),'COUNT':_0x242e('0x55'),'COUNT DISTINCT':_0x242e('0x56'),'MAX':_0x242e('0x57'),'MIN':_0x242e('0x58'),'AVG':_0x242e('0x59'),'GROUP_CONCAT':_0x242e('0x5a'),'GROUP_CONCAT ASC':_0x242e('0x5b'),'GROUP_CONCAT DESC':_0x242e('0x5c')};var _0x101a21={'SEC_TO_TIME':_0x242e('0x5d'),'DATE':_0x242e('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x242e('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24ed1d=function(_0x7d13c3){return!_[_0x242e('0x60')]([_0x242e('0x61'),_0x242e('0x62'),_0x242e('0x63'),_0x242e('0x64')],_0x7d13c3);};var _0x4125ad=function(_0x75e901){if(!_0x75e901||!_0x75e901[_0x242e('0x65')][_0x242e('0x39')]){return'';}for(var _0x3fefc8='(',_0xefceb0=0x0;_0xefceb0<_0x75e901['rules'][_0x242e('0x39')];_0xefceb0+=0x1){_0xefceb0>0x0&&(_0x3fefc8+='\x20'+_0x75e901[_0x242e('0x66')]+'\x20');_0x3fefc8+=_0x75e901[_0x242e('0x65')][_0xefceb0][_0x242e('0x67')]?_0x4125ad(_0x75e901[_0x242e('0x65')][_0xefceb0][_0x242e('0x67')]):_0x75e901[_0x242e('0x65')][_0xefceb0][_0x242e('0x68')]+'\x20'+_0x75e901['rules'][_0xefceb0][_0x242e('0x69')]+(_0x24ed1d(_0x75e901[_0x242e('0x65')][_0xefceb0][_0x242e('0x69')])?'\x20'+_0x75e901[_0x242e('0x65')][_0xefceb0][_0x242e('0x6a')]:'');}return _0x3fefc8+')';};var _0x579b79={'where':{'id':_0xc678ac['params']['id']}},_0x5dee50,_0x3cbd55,_0x52c16e,_0x51c2b2,_0x48cc01;_0x579b79=_[_0x242e('0x41')]({},_0x579b79,_0xc678ac[_0x242e('0x6b')]);return db[_0x242e('0x2f')][_0x242e('0x48')](_0x579b79)[_0x242e('0x26')](function(_0x3b0f41){if(_0x3b0f41){_0x5dee50=_0x3b0f41;return _0x3b0f41[_0x242e('0x6c')]();}return null;})[_0x242e('0x26')](function(_0x2efabf){if(_0x2efabf){if(!_0x2efabf['length']){throw new db[(_0x242e('0x6d'))][(_0x242e('0x6e'))](_0x242e('0x6f'),0x193);}_0x3cbd55=_0x2efabf;return db[_0x242e('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x417484){if(_0x417484){_0x52c16e=_[_0x242e('0x71')](_0x417484,'id');var _0x465bd7;var _0x15608a=squel[_0x242e('0x72')]();_0x15608a[_0x242e('0x73')](_0x5dee50[_0x242e('0x74')]);for(var _0x2393a3=0x0;_0x2393a3<_0x3cbd55[_0x242e('0x39')];_0x2393a3+=0x1){_0x465bd7=_0x3cbd55[_0x2393a3][_0x242e('0x75')]?_0x52c16e[_0x3cbd55[_0x2393a3][_0x242e('0x75')]][_0x242e('0x76')]:_0x3cbd55[_0x2393a3][_0x242e('0x68')];_0x465bd7=_0x3cbd55[_0x2393a3]['function']?_[_0x242e('0x77')](_0x3927a1[_0x3cbd55[_0x2393a3][_0x242e('0x78')]],'%s',_0x465bd7):_0x465bd7;_0x465bd7=_0x3cbd55[_0x2393a3]['format']?_[_0x242e('0x77')](_0x101a21[_0x3cbd55[_0x2393a3][_0x242e('0x79')]],'%s',_0x465bd7):_0x465bd7;if(_0x3cbd55[_0x2393a3]['groupBy']){_0x15608a[_0x242e('0x67')](_0x465bd7);}_0x3cbd55[_0x2393a3]['orderBy']&&_0x15608a['order'](_0x465bd7,_0x3cbd55[_0x2393a3][_0x242e('0x7a')]===_0x242e('0x7b')?![]:!![]);_0x15608a[_0x242e('0x68')](_0x465bd7,_0x3cbd55[_0x2393a3][_0x242e('0x7c')]||_0x465bd7);}if(_0x5dee50['joins']){_0x5dee50[_0x242e('0x7d')]=JSON['parse'](_0x5dee50[_0x242e('0x7d')]);for(var _0xe03edb=0x0;_0xe03edb<_0x5dee50['joins'][_0x242e('0x39')];_0xe03edb+=0x1){if(_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x40')]&&_['includes'](_0x52bf6e,_0x5dee50['joins'][_0xe03edb]['type'])&&_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x7e')]&&_0x5dee50['joins'][_0xe03edb][_0x242e('0x7f')]&&_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x80')]){_0x15608a[_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x40')]](_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x7f')],null,util[_0x242e('0x79')](_0x242e('0x81'),_0x5dee50[_0x242e('0x74')],_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x7e')],_0x5dee50[_0x242e('0x7d')][_0xe03edb][_0x242e('0x7f')],_0x5dee50['joins'][_0xe03edb]['foreignKey']));}}}if(_0x5dee50['conditions']){_0x5dee50[_0x242e('0x82')]=JSON[_0x242e('0x83')](_0x5dee50[_0x242e('0x82')]);_0x15608a[_0x242e('0x3e')](_0x4125ad(_0x5dee50['conditions']['group']));}_0x48cc01=_0x15608a[_0x242e('0x84')]();_0x15608a[_0x242e('0x1d')](_0x1b1a6d);_0x15608a[_0x242e('0x1c')](0x0);logger[_0x242e('0x85')](_0x242e('0x86'),_0x15608a[_0x242e('0x87')]());return dbH[_0x242e('0x88')][_0x242e('0x33')](_0x15608a[_0x242e('0x87')](),{'type':dbH['sequelize'][_0x242e('0x89')][_0x242e('0x8a')]});}})[_0x242e('0x26')](respondWithResult(_0x2025e0,null))[_0x242e('0x45')](handleError(_0x2025e0,null));};function runReport(_0x48cbe8,_0x165d67,_0x2dbccd){var _0x5a511c=_0x165d67[_0x242e('0x2b')];var _0xc53088=0xa;var _0x125c75=[_0x242e('0x51'),_0x242e('0x52'),'right_join',_0x242e('0x8b')];var _0x36f95c={'SUM':_0x242e('0x54'),'COUNT':_0x242e('0x55'),'COUNT DISTINCT':_0x242e('0x56'),'MAX':_0x242e('0x57'),'MIN':_0x242e('0x58'),'AVG':_0x242e('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x242e('0x5b'),'GROUP_CONCAT DESC':_0x242e('0x5c')};var _0x3f62f9={'SEC_TO_TIME':_0x242e('0x5d'),'DATE':_0x242e('0x5e'),'HOUR':_0x242e('0x8c'),'ROUND':_0x242e('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2903b0=function(_0x20b1f0){return!_[_0x242e('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x242e('0x64')],_0x20b1f0);};var _0x31d24e=function(_0x1c010c){if(!_0x1c010c||!_0x1c010c[_0x242e('0x65')][_0x242e('0x39')]){return'';}for(var _0x5142a2='(',_0x44f582=0x0;_0x44f582<_0x1c010c[_0x242e('0x65')][_0x242e('0x39')];_0x44f582+=0x1){_0x44f582>0x0&&(_0x5142a2+='\x20'+_0x1c010c['operator']+'\x20');_0x5142a2+=_0x1c010c[_0x242e('0x65')][_0x44f582][_0x242e('0x67')]?_0x31d24e(_0x1c010c[_0x242e('0x65')][_0x44f582][_0x242e('0x67')]):_0x1c010c[_0x242e('0x65')][_0x44f582]['field']+'\x20'+_0x1c010c[_0x242e('0x65')][_0x44f582][_0x242e('0x69')]+(_0x2903b0(_0x1c010c[_0x242e('0x65')][_0x44f582]['condition'])?'\x20'+_0x1c010c[_0x242e('0x65')][_0x44f582][_0x242e('0x6a')]:'');}return _0x5142a2+')';};var _0x584063={'where':{'id':_0x48cbe8['id']}},_0x5a8959,_0x2a9495,_0x269af7,_0xb190f1,_0x27ff6c;_0x584063=_[_0x242e('0x41')]({},_0x584063,_0x2dbccd);return db['AnalyticCustomReport'][_0x242e('0x48')](_0x584063)[_0x242e('0x26')](function(_0x449b45){if(_0x449b45){_0x5a8959=_0x449b45;return _0x449b45['getFields']();}return null;})[_0x242e('0x26')](function(_0x118e09){if(_0x118e09){if(!_0x118e09[_0x242e('0x39')]){throw new db['Sequelize'][(_0x242e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a9495=_0x118e09;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x242e('0x26')](function(_0x4ac1d5){if(_0x4ac1d5){_0x269af7=_[_0x242e('0x71')](_0x4ac1d5,'id');var _0x2ec81a;var _0x3cb535=squel['select']();_0x3cb535[_0x242e('0x73')](_0x5a8959[_0x242e('0x74')]);for(var _0x40c277=0x0;_0x40c277<_0x2a9495[_0x242e('0x39')];_0x40c277+=0x1){_0x2ec81a=_0x2a9495[_0x40c277]['MetricId']?_0x269af7[_0x2a9495[_0x40c277][_0x242e('0x75')]][_0x242e('0x76')]:_0x2a9495[_0x40c277][_0x242e('0x68')];_0x2ec81a=_0x2a9495[_0x40c277][_0x242e('0x78')]?_['replace'](_0x36f95c[_0x2a9495[_0x40c277][_0x242e('0x78')]],'%s',_0x2ec81a):_0x2ec81a;_0x2ec81a=_0x2a9495[_0x40c277][_0x242e('0x79')]?_['replace'](_0x3f62f9[_0x2a9495[_0x40c277]['format']],'%s',_0x2ec81a):_0x2ec81a;if(_0x2a9495[_0x40c277][_0x242e('0x8d')]){_0x3cb535[_0x242e('0x67')](_0x2ec81a);}_0x2a9495[_0x40c277]['orderBy']&&_0x3cb535[_0x242e('0x3c')](_0x2ec81a,_0x2a9495[_0x40c277]['orderBy']==='DESC'?![]:!![]);_0x3cb535['field'](_0x2ec81a,_0x2a9495[_0x40c277][_0x242e('0x7c')]||_0x2ec81a);}if(_0x5a8959['joins']){_0x5a8959['joins']=JSON[_0x242e('0x83')](_0x5a8959[_0x242e('0x7d')]);for(var _0x57900=0x0;_0x57900<_0x5a8959[_0x242e('0x7d')][_0x242e('0x39')];_0x57900+=0x1){if(_0x5a8959['joins'][_0x57900][_0x242e('0x40')]&&_['includes'](_0x125c75,_0x5a8959[_0x242e('0x7d')][_0x57900][_0x242e('0x40')])&&_0x5a8959['joins'][_0x57900]['parentKey']&&_0x5a8959[_0x242e('0x7d')][_0x57900]['foreignTable']&&_0x5a8959['joins'][_0x57900]['foreignKey']){_0x3cb535[_0x5a8959[_0x242e('0x7d')][_0x57900][_0x242e('0x40')]](_0x5a8959['joins'][_0x57900]['foreignTable'],null,util[_0x242e('0x79')](_0x242e('0x81'),_0x5a8959[_0x242e('0x74')],_0x5a8959['joins'][_0x57900][_0x242e('0x7e')],_0x5a8959[_0x242e('0x7d')][_0x57900][_0x242e('0x7f')],_0x5a8959[_0x242e('0x7d')][_0x57900]['foreignKey']));}}}if(_0x5a8959['conditions']){_0x5a8959[_0x242e('0x82')]=JSON[_0x242e('0x83')](_0x5a8959[_0x242e('0x82')]);_0x3cb535[_0x242e('0x3e')](_0x31d24e(_0x5a8959[_0x242e('0x82')][_0x242e('0x67')]));}_0x27ff6c=_0x3cb535['clone']();_0x3cb535['limit'](_0xc53088);_0x3cb535[_0x242e('0x1c')](0x0);return;}})['then'](function(){if(_0x165d67[_0x242e('0x8e')]==='web'){return null;}var _0x3ead28=_[_0x242e('0x41')](_0x165d67,{'name':_0x165d67[_0x242e('0x8f')]||_0x165d67[_0x242e('0x2b')]||_0x5a8959['name'],'basename':_0x5a511c,'savename':util['format'](_0x242e('0x90'),_0x165d67['name']||_0x5a8959[_0x242e('0x2b')],require(_0x242e('0x91'))[_0x242e('0x92')](0x4),_0x165d67['output']||'csv'),'reportId':_0x5a8959['id'],'reportType':'custom'});return db[_0x242e('0x93')][_0x242e('0x49')](_0x3ead28,{'raw':!![]});})[_0x242e('0x26')](function(_0x2af2fb){if(_0x5a8959[_0x242e('0x74')]===_0x242e('0x94')){_0x27ff6c['where'](_0x5a8959['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x165d67[_0x242e('0x95')],_0x165d67[_0x242e('0x96')]);}else{_0x27ff6c[_0x242e('0x3e')](_0x5a8959[_0x242e('0x74')]+_0x242e('0x97'),_0x165d67[_0x242e('0x95')],_0x165d67[_0x242e('0x96')]);}if(_0x2af2fb){logger['info'](_0x242e('0x98'),_0x27ff6c['toString']());require(_0x242e('0x99'))[_0x242e('0x9a')](path[_0x242e('0x51')](__dirname,_0x242e('0x9b'),_0x2af2fb[_0x242e('0x8e')]),[_0x2af2fb['id'],_0x27ff6c['toString'](),path[_0x242e('0x51')](__dirname,_0x242e('0x9c'),_0x2af2fb[_0x242e('0x9d')]),_0x5a511c]);return _0x2af2fb;}else{var _0x5c95a1=squel[_0x242e('0x72')]();_0x5c95a1[_0x242e('0x73')]('('+_0x27ff6c['toString']()+')','countTable');_0x5c95a1[_0x242e('0x68')](_0x242e('0x9e'),'count');_0x27ff6c[_0x242e('0x1d')](_0x165d67[_0x242e('0x1d')]||_0xc53088);_0x27ff6c[_0x242e('0x1c')](_0x165d67[_0x242e('0x1c')]||0x0);return dbH['sequelize']['query'](_0x5c95a1[_0x242e('0x87')](),{'type':dbH[_0x242e('0x88')]['QueryTypes'][_0x242e('0x8a')]})['then'](function(_0x1a6a15){if(!_0x1a6a15[_0x242e('0x39')]){_0xb190f1=0x0;}else{_0xb190f1=_0x1a6a15[0x0]['count']||0x0;}return dbH[_0x242e('0x88')][_0x242e('0x33')](_0x27ff6c[_0x242e('0x87')](),{'type':dbH[_0x242e('0x88')][_0x242e('0x89')][_0x242e('0x8a')]});})[_0x242e('0x26')](function(_0x3edd75){return{'rows':_0x3edd75||[],'count':_0xb190f1};});}});}exports[_0x242e('0x9f')]=function(_0x4dbe79,_0x296bbe){return runReport(_0x4dbe79[_0x242e('0x47')],_0x4dbe79[_0x242e('0x33')],_0x4dbe79['options'])[_0x242e('0x26')](respondWithResult(_0x296bbe,null))[_0x242e('0x45')](handleError(_0x296bbe,null));};exports['runReport']=runReport;exports['query']=function(_0x5e8068,_0x42414b){var _0xe4e77b=0xa;var _0x3eecb3=[_0x242e('0x51'),'left_join',_0x242e('0x53'),_0x242e('0x8b')];var _0x377f9c={'SUM':_0x242e('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x242e('0x56'),'MAX':_0x242e('0x57'),'MIN':'MIN(%s)','AVG':_0x242e('0x59'),'GROUP_CONCAT':_0x242e('0x5a'),'GROUP_CONCAT ASC':_0x242e('0x5b'),'GROUP_CONCAT DESC':_0x242e('0x5c')};var _0x1600eb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x242e('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x242e('0x5f'),'UNIX_TIMESTAMP':_0x242e('0xa0')};var _0x2cc735=function(_0xfdcac8){return!_[_0x242e('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x242e('0x63'),'IS\x20NOT\x20EMPTY'],_0xfdcac8);};var _0x51f658=function(_0x55566d){if(!_0x55566d||!_0x55566d['rules'][_0x242e('0x39')]){return'';}for(var _0x1f6bc7='(',_0x4c3c70=0x0;_0x4c3c70<_0x55566d[_0x242e('0x65')][_0x242e('0x39')];_0x4c3c70+=0x1){_0x4c3c70>0x0&&(_0x1f6bc7+='\x20'+_0x55566d[_0x242e('0x66')]+'\x20');_0x1f6bc7+=_0x55566d[_0x242e('0x65')][_0x4c3c70][_0x242e('0x67')]?_0x51f658(_0x55566d['rules'][_0x4c3c70][_0x242e('0x67')]):_0x55566d[_0x242e('0x65')][_0x4c3c70]['field']+'\x20'+_0x55566d[_0x242e('0x65')][_0x4c3c70][_0x242e('0x69')]+(_0x2cc735(_0x55566d['rules'][_0x4c3c70][_0x242e('0x69')])?'\x20'+_0x55566d[_0x242e('0x65')][_0x4c3c70][_0x242e('0x6a')]:'');}return _0x1f6bc7+')';};var _0x3783b6={'where':{'id':_0x5e8068[_0x242e('0x47')]['id']}},_0x39d8f5,_0x41cdb5,_0x40a84e,_0x178e84,_0xd2a8bd;_0x3783b6=_['merge']({},_0x3783b6,_0x5e8068[_0x242e('0x6b')]);return db['AnalyticCustomReport'][_0x242e('0x48')](_0x3783b6)['then'](function(_0x3f03a9){if(_0x3f03a9){_0x39d8f5=_0x3f03a9;return _0x3f03a9['getFields']();}return null;})[_0x242e('0x26')](function(_0x1ff078){if(_0x1ff078){if(!_0x1ff078[_0x242e('0x39')]){throw new db[(_0x242e('0x6d'))][(_0x242e('0x6e'))](_0x242e('0x6f'),0x193);}_0x41cdb5=_0x1ff078;return db['AnalyticMetric'][_0x242e('0x44')]({'raw':!![]});}return null;})[_0x242e('0x26')](function(_0x41d8b1){if(_0x41d8b1){_0x40a84e=_[_0x242e('0x71')](_0x41d8b1,'id');var _0x1f57ea;var _0x54b35d=squel[_0x242e('0x72')]();_0x54b35d['from'](_0x39d8f5[_0x242e('0x74')]);for(var _0x14e986=0x0;_0x14e986<_0x41cdb5['length'];_0x14e986+=0x1){_0x1f57ea=_0x41cdb5[_0x14e986][_0x242e('0x75')]?_0x40a84e[_0x41cdb5[_0x14e986]['MetricId']][_0x242e('0x76')]:_0x41cdb5[_0x14e986][_0x242e('0x68')];_0x1f57ea=_0x41cdb5[_0x14e986]['function']?_['replace'](_0x377f9c[_0x41cdb5[_0x14e986][_0x242e('0x78')]],'%s',_0x1f57ea):_0x1f57ea;_0x1f57ea=_0x41cdb5[_0x14e986][_0x242e('0x79')]?_['replace'](_0x1600eb[_0x41cdb5[_0x14e986][_0x242e('0x79')]],'%s',_0x1f57ea):_0x1f57ea;if(_0x41cdb5[_0x14e986][_0x242e('0x8d')]){_0x54b35d[_0x242e('0x67')](_0x1f57ea);}_0x41cdb5[_0x14e986][_0x242e('0x7a')]&&_0x54b35d[_0x242e('0x3c')](_0x1f57ea,_0x41cdb5[_0x14e986][_0x242e('0x7a')]===_0x242e('0x7b')?![]:!![]);_0x54b35d[_0x242e('0x68')](_0x1f57ea,_0x41cdb5[_0x14e986][_0x242e('0x7c')]||_0x1f57ea);}if(_0x39d8f5[_0x242e('0x7d')]){_0x39d8f5[_0x242e('0x7d')]=JSON[_0x242e('0x83')](_0x39d8f5[_0x242e('0x7d')]);for(var _0x4bcd44=0x0;_0x4bcd44<_0x39d8f5[_0x242e('0x7d')][_0x242e('0x39')];_0x4bcd44+=0x1){if(_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x40')]&&_[_0x242e('0x60')](_0x3eecb3,_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x40')])&&_0x39d8f5[_0x242e('0x7d')][_0x4bcd44]['parentKey']&&_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x7f')]&&_0x39d8f5['joins'][_0x4bcd44][_0x242e('0x80')]){_0x54b35d[_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x40')]](_0x39d8f5[_0x242e('0x7d')][_0x4bcd44]['foreignTable'],null,util[_0x242e('0x79')](_0x242e('0x81'),_0x39d8f5[_0x242e('0x74')],_0x39d8f5[_0x242e('0x7d')][_0x4bcd44]['parentKey'],_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x7f')],_0x39d8f5[_0x242e('0x7d')][_0x4bcd44][_0x242e('0x80')]));}}}if(_0x39d8f5[_0x242e('0x82')]){_0x39d8f5[_0x242e('0x82')]=JSON[_0x242e('0x83')](_0x39d8f5['conditions']);_0x54b35d[_0x242e('0x3e')](_0x51f658(_0x39d8f5[_0x242e('0x82')][_0x242e('0x67')]));}_0xd2a8bd=_0x54b35d[_0x242e('0x84')]();_0x54b35d[_0x242e('0x1d')](_0xe4e77b);_0x54b35d[_0x242e('0x1c')](0x0);logger[_0x242e('0x85')]('Limited\x20Query:',_0x54b35d['toString']());return dbH['sequelize'][_0x242e('0x33')](_0x54b35d[_0x242e('0x87')](),{'type':dbH[_0x242e('0x88')]['QueryTypes'][_0x242e('0x8a')]});}})[_0x242e('0x26')](function(){return{'sql':_0xd2a8bd[_0x242e('0x87')]()};})[_0x242e('0x26')](respondWithResult(_0x42414b,null))[_0x242e('0x45')](handleError(_0x42414b,null));}; \ No newline at end of file +var _0x68a1=['limit','set','Content-Range','apply','save','update','then','get','CustomReports','UserProfileResource','destroy','end','sendStatus','error','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MAX(%s)','AVG(%s)','ROUND(%s)','operator','value','select','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','count'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x68a1,0x89));var _0x168a=function(_0x783593,_0x369369){_0x783593=_0x783593-0x0;var _0x54dcf5=_0x68a1[_0x783593];return _0x54dcf5;};'use strict';var emlformat=require(_0x168a('0x0'));var rimraf=require(_0x168a('0x1'));var zipdir=require(_0x168a('0x2'));var jsonpatch=require(_0x168a('0x3'));var rp=require('request-promise');var moment=require(_0x168a('0x4'));var BPromise=require(_0x168a('0x5'));var Mustache=require(_0x168a('0x6'));var util=require('util');var path=require(_0x168a('0x7'));var sox=require(_0x168a('0x8'));var csv=require(_0x168a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x168a('0xa'));var _=require(_0x168a('0xb'));var squel=require(_0x168a('0xc'));var crypto=require('crypto');var jsforce=require(_0x168a('0xd'));var deskjs=require(_0x168a('0xe'));var toCsv=require(_0x168a('0x9'));var querystring=require(_0x168a('0xf'));var Papa=require(_0x168a('0x10'));var Redis=require(_0x168a('0x11'));var authService=require(_0x168a('0x12'));var qs=require(_0x168a('0x13'));var as=require(_0x168a('0x14'));var hardwareService=require(_0x168a('0x15'));var logger=require(_0x168a('0x16'))(_0x168a('0x17'));var utils=require(_0x168a('0x18'));var config=require(_0x168a('0x19'));var licenseUtil=require(_0x168a('0x1a'));var db=require(_0x168a('0x1b'))['db'];var dbH=require(_0x168a('0x1b'))[_0x168a('0x1c')];function respondWithStatusCode(_0x19d74b,_0x47b7f6){_0x47b7f6=_0x47b7f6||0xcc;return function(_0x38fd84){if(_0x38fd84){return _0x19d74b['sendStatus'](_0x47b7f6);}return _0x19d74b[_0x168a('0x1d')](_0x47b7f6)['end']();};}function respondWithResult(_0x2c4f1c,_0x1e1b41){_0x1e1b41=_0x1e1b41||0xc8;return function(_0x12612e){if(_0x12612e){return _0x2c4f1c['status'](_0x1e1b41)[_0x168a('0x1e')](_0x12612e);}};}function respondWithFilteredResult(_0x555c0a,_0x55659b){return function(_0x3be49f){if(_0x3be49f){var _0x533d12=typeof _0x55659b[_0x168a('0x1f')]===_0x168a('0x20')&&typeof _0x55659b['limit']==='undefined';var _0x647cc6=_0x3be49f[_0x168a('0x21')];var _0x2ddcbf=_0x533d12?0x0:_0x55659b['offset'];var _0x44ec56=_0x533d12?_0x3be49f[_0x168a('0x21')]:_0x55659b[_0x168a('0x1f')]+_0x55659b[_0x168a('0x22')];var _0x2a18d1;if(_0x44ec56>=_0x647cc6){_0x44ec56=_0x647cc6;_0x2a18d1=0xc8;}else{_0x2a18d1=0xce;}_0x555c0a[_0x168a('0x1d')](_0x2a18d1);return _0x555c0a[_0x168a('0x23')](_0x168a('0x24'),_0x2ddcbf+'-'+_0x44ec56+'/'+_0x647cc6)['json'](_0x3be49f);}return null;};}function patchUpdates(_0x66f427){return function(_0x3c59d3){try{jsonpatch[_0x168a('0x25')](_0x3c59d3,_0x66f427,!![]);}catch(_0x517be4){return BPromise['reject'](_0x517be4);}return _0x3c59d3[_0x168a('0x26')]();};}function saveUpdates(_0x1fab6a,_0x2ad047){return function(_0x449a22){if(_0x449a22){return _0x449a22[_0x168a('0x27')](_0x1fab6a)[_0x168a('0x28')](function(_0x460ccd){return _0x460ccd;});}return null;};}function removeEntity(_0x329ac9,_0x3bef83){return function(_0x1b6287){if(_0x1b6287){return _0x1b6287['destroy']()[_0x168a('0x28')](function(){var _0x577a43=_0x1b6287[_0x168a('0x29')]({'plain':!![]});var _0x207e1b=_0x168a('0x2a');return db[_0x168a('0x2b')][_0x168a('0x2c')]({'where':{'type':_0x207e1b,'resourceId':_0x577a43['id']}})[_0x168a('0x28')](function(){return _0x1b6287;});})[_0x168a('0x28')](function(){_0x329ac9[_0x168a('0x1d')](0xcc)[_0x168a('0x2d')]();});}};}function handleEntityNotFound(_0x34bcc8,_0x26bb28){return function(_0x544906){if(!_0x544906){_0x34bcc8[_0x168a('0x2e')](0x194);}return _0x544906;};}function handleError(_0x2cabb4,_0x383f3b){_0x383f3b=_0x383f3b||0x1f4;return function(_0x2e5426){logger[_0x168a('0x2f')](_0x2e5426['stack']);if(_0x2e5426[_0x168a('0x30')]){delete _0x2e5426[_0x168a('0x30')];}_0x2cabb4[_0x168a('0x1d')](_0x383f3b)['send'](_0x2e5426);};}exports[_0x168a('0x31')]=function(_0x425ff8,_0x4257a9){var _0x5d4414={},_0x2b0fcc={},_0x47e2e6={'count':0x0,'rows':[]};var _0xc4774=_[_0x168a('0x32')](db[_0x168a('0x33')]['rawAttributes'],function(_0x74112c){return{'name':_0x74112c[_0x168a('0x34')],'type':_0x74112c[_0x168a('0x35')][_0x168a('0x36')]};});_0x2b0fcc[_0x168a('0x37')]=_[_0x168a('0x32')](_0xc4774,_0x168a('0x30'));_0x2b0fcc[_0x168a('0x38')]=_[_0x168a('0x39')](_0x425ff8['query']);_0x2b0fcc['filters']=_[_0x168a('0x3a')](_0x2b0fcc['model'],_0x2b0fcc[_0x168a('0x38')]);_0x5d4414[_0x168a('0x3b')]=_[_0x168a('0x3a')](_0x2b0fcc[_0x168a('0x37')],qs[_0x168a('0x3c')](_0x425ff8[_0x168a('0x38')][_0x168a('0x3c')]));_0x5d4414[_0x168a('0x3b')]=_0x5d4414[_0x168a('0x3b')][_0x168a('0x3d')]?_0x5d4414[_0x168a('0x3b')]:_0x2b0fcc[_0x168a('0x37')];if(!_0x425ff8[_0x168a('0x38')][_0x168a('0x3e')](_0x168a('0x3f'))){_0x5d4414[_0x168a('0x22')]=qs[_0x168a('0x22')](_0x425ff8[_0x168a('0x38')]['limit']);_0x5d4414[_0x168a('0x1f')]=qs[_0x168a('0x1f')](_0x425ff8[_0x168a('0x38')][_0x168a('0x1f')]);}_0x5d4414[_0x168a('0x40')]=qs[_0x168a('0x41')](_0x425ff8['query']['sort']);_0x5d4414[_0x168a('0x42')]=qs[_0x168a('0x43')](_['pick'](_0x425ff8[_0x168a('0x38')],_0x2b0fcc[_0x168a('0x43')]),_0xc4774);if(_0x425ff8[_0x168a('0x38')]['filter']){_0x5d4414[_0x168a('0x42')]=_[_0x168a('0x44')](_0x5d4414['where'],{'$or':_[_0x168a('0x32')](_0xc4774,function(_0x443712){if(_0x443712[_0x168a('0x35')]!==_0x168a('0x45')){var _0x348d9b={};_0x348d9b[_0x443712[_0x168a('0x30')]]={'$like':'%'+_0x425ff8[_0x168a('0x38')][_0x168a('0x46')]+'%'};return _0x348d9b;}})});}_0x5d4414=_['merge']({},_0x5d4414,_0x425ff8[_0x168a('0x47')]);var _0x6ee52b={'where':_0x5d4414['where']};return db[_0x168a('0x33')][_0x168a('0x21')](_0x6ee52b)['then'](function(_0x2c607b){_0x47e2e6[_0x168a('0x21')]=_0x2c607b;if(_0x425ff8[_0x168a('0x38')][_0x168a('0x48')]){_0x5d4414[_0x168a('0x49')]=[{'all':!![]}];}return db[_0x168a('0x33')][_0x168a('0x4a')](_0x5d4414);})[_0x168a('0x28')](function(_0x4fa749){_0x47e2e6[_0x168a('0x4b')]=_0x4fa749;return _0x47e2e6;})[_0x168a('0x28')](respondWithFilteredResult(_0x4257a9,_0x5d4414))[_0x168a('0x4c')](handleError(_0x4257a9,null));};exports[_0x168a('0x4d')]=function(_0x20380d,_0x81dada){var _0x215fdd={'raw':![],'where':{'id':_0x20380d['params']['id']}},_0x48b631={};_0x48b631[_0x168a('0x37')]=_[_0x168a('0x39')](db['AnalyticCustomReport'][_0x168a('0x4e')]);_0x48b631[_0x168a('0x38')]=_[_0x168a('0x39')](_0x20380d['query']);_0x48b631['filters']=_[_0x168a('0x3a')](_0x48b631['model'],_0x48b631['query']);_0x215fdd[_0x168a('0x3b')]=_[_0x168a('0x3a')](_0x48b631[_0x168a('0x37')],qs[_0x168a('0x3c')](_0x20380d[_0x168a('0x38')][_0x168a('0x3c')]));_0x215fdd['attributes']=_0x215fdd[_0x168a('0x3b')]['length']?_0x215fdd['attributes']:_0x48b631[_0x168a('0x37')];if(_0x20380d['query'][_0x168a('0x48')]){_0x215fdd[_0x168a('0x49')]=[{'all':!![]}];}_0x215fdd=_[_0x168a('0x44')]({},_0x215fdd,_0x20380d[_0x168a('0x47')]);return db[_0x168a('0x33')][_0x168a('0x4f')](_0x215fdd)[_0x168a('0x28')](handleEntityNotFound(_0x81dada,null))['then'](respondWithResult(_0x81dada,null))[_0x168a('0x4c')](handleError(_0x81dada,null));};exports[_0x168a('0x50')]=function(_0x47be46,_0x5b52b6){return db[_0x168a('0x33')][_0x168a('0x50')](_0x47be46[_0x168a('0x51')],{})[_0x168a('0x28')](function(_0x3d1955){var _0x434446=_0x47be46[_0x168a('0x52')][_0x168a('0x29')]({'plain':!![]});if(!_0x434446)throw new Error(_0x168a('0x53'));if(_0x434446[_0x168a('0x54')]===_0x168a('0x52')){var _0x334643=_0x3d1955[_0x168a('0x29')]({'plain':!![]});var _0x9ddb6d=_0x168a('0x55');return db[_0x168a('0x56')][_0x168a('0x4f')]({'where':{'name':_0x9ddb6d,'userProfileId':_0x434446[_0x168a('0x57')]},'raw':!![]})['then'](function(_0x5eb472){if(_0x5eb472&&_0x5eb472['autoAssociation']===0x0){return db['UserProfileResource'][_0x168a('0x50')]({'name':_0x334643[_0x168a('0x30')],'resourceId':_0x334643['id'],'type':_0x168a('0x2a'),'sectionId':_0x5eb472['id']},{})[_0x168a('0x28')](function(){return _0x3d1955;});}else{return _0x3d1955;}})['catch'](function(_0x1d59c9){logger[_0x168a('0x2f')](_0x168a('0x58'),_0x1d59c9);throw _0x1d59c9;});}return _0x3d1955;})['then'](respondWithResult(_0x5b52b6,0xc9))['catch'](handleError(_0x5b52b6,null));};exports[_0x168a('0x27')]=function(_0x596c65,_0x29b4ee){if(_0x596c65['body']['id']){delete _0x596c65[_0x168a('0x51')]['id'];}return db[_0x168a('0x33')]['find']({'where':{'id':_0x596c65['params']['id']}})[_0x168a('0x28')](handleEntityNotFound(_0x29b4ee,null))['then'](saveUpdates(_0x596c65['body'],null))['then'](respondWithResult(_0x29b4ee,null))[_0x168a('0x4c')](handleError(_0x29b4ee,null));};exports[_0x168a('0x2c')]=function(_0x4c8a15,_0x2e3e0e){return db['AnalyticCustomReport'][_0x168a('0x4f')]({'where':{'id':_0x4c8a15[_0x168a('0x59')]['id']}})[_0x168a('0x28')](handleEntityNotFound(_0x2e3e0e,null))[_0x168a('0x28')](removeEntity(_0x2e3e0e,null))[_0x168a('0x4c')](handleError(_0x2e3e0e,null));};exports[_0x168a('0x5a')]=function(_0x191aac,_0x52c7e6){var _0x178289=0xa;var _0x541d16=[_0x168a('0x5b'),_0x168a('0x5c'),_0x168a('0x5d'),_0x168a('0x5e')];var _0x5dc35d={'SUM':'SUM(%s)','COUNT':_0x168a('0x5f'),'COUNT DISTINCT':_0x168a('0x60'),'MAX':'MAX(%s)','MIN':_0x168a('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x168a('0x62'),'GROUP_CONCAT ASC':_0x168a('0x63'),'GROUP_CONCAT DESC':_0x168a('0x64')};var _0x5b4c7b={'SEC_TO_TIME':_0x168a('0x65'),'DATE':_0x168a('0x66'),'HOUR':_0x168a('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x168a('0x68')};var _0x20e4a=function(_0x4ddb20){return!_['includes']([_0x168a('0x69'),_0x168a('0x6a'),_0x168a('0x6b'),_0x168a('0x6c')],_0x4ddb20);};var _0x1fd29a=function(_0x1e800c){if(!_0x1e800c||!_0x1e800c[_0x168a('0x6d')][_0x168a('0x3d')]){return'';}for(var _0x43c0a7='(',_0x4a348b=0x0;_0x4a348b<_0x1e800c[_0x168a('0x6d')][_0x168a('0x3d')];_0x4a348b+=0x1){_0x4a348b>0x0&&(_0x43c0a7+='\x20'+_0x1e800c['operator']+'\x20');_0x43c0a7+=_0x1e800c[_0x168a('0x6d')][_0x4a348b][_0x168a('0x6e')]?_0x1fd29a(_0x1e800c[_0x168a('0x6d')][_0x4a348b][_0x168a('0x6e')]):_0x1e800c[_0x168a('0x6d')][_0x4a348b][_0x168a('0x6f')]+'\x20'+_0x1e800c[_0x168a('0x6d')][_0x4a348b][_0x168a('0x70')]+(_0x20e4a(_0x1e800c[_0x168a('0x6d')][_0x4a348b][_0x168a('0x70')])?'\x20'+_0x1e800c[_0x168a('0x6d')][_0x4a348b]['value']:'');}return _0x43c0a7+')';};var _0x40fd63={'where':{'id':_0x191aac[_0x168a('0x59')]['id']}},_0x3bb9e0,_0x455ff7,_0x2322f1,_0x42eb00,_0x24d5fb;_0x40fd63=_[_0x168a('0x44')]({},_0x40fd63,_0x191aac[_0x168a('0x47')]);return db[_0x168a('0x33')][_0x168a('0x4f')](_0x40fd63)['then'](function(_0x1f8355){if(_0x1f8355){_0x3bb9e0=_0x1f8355;return _0x1f8355[_0x168a('0x71')]();}return null;})[_0x168a('0x28')](function(_0x2995cf){if(_0x2995cf){if(!_0x2995cf[_0x168a('0x3d')]){throw new db[(_0x168a('0x72'))][(_0x168a('0x73'))](_0x168a('0x74'),0x193);}_0x455ff7=_0x2995cf;return db[_0x168a('0x75')][_0x168a('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x44f64e){if(_0x44f64e){_0x2322f1=_[_0x168a('0x76')](_0x44f64e,'id');var _0x2bc64e;var _0x3aa8e6=squel['select']();_0x3aa8e6[_0x168a('0x77')](_0x3bb9e0[_0x168a('0x78')]);for(var _0xcd2116=0x0;_0xcd2116<_0x455ff7[_0x168a('0x3d')];_0xcd2116+=0x1){_0x2bc64e=_0x455ff7[_0xcd2116][_0x168a('0x79')]?_0x2322f1[_0x455ff7[_0xcd2116][_0x168a('0x79')]][_0x168a('0x7a')]:_0x455ff7[_0xcd2116]['field'];_0x2bc64e=_0x455ff7[_0xcd2116]['function']?_['replace'](_0x5dc35d[_0x455ff7[_0xcd2116][_0x168a('0x7b')]],'%s',_0x2bc64e):_0x2bc64e;_0x2bc64e=_0x455ff7[_0xcd2116][_0x168a('0x7c')]?_[_0x168a('0x7d')](_0x5b4c7b[_0x455ff7[_0xcd2116][_0x168a('0x7c')]],'%s',_0x2bc64e):_0x2bc64e;if(_0x455ff7[_0xcd2116][_0x168a('0x7e')]){_0x3aa8e6[_0x168a('0x6e')](_0x2bc64e);}_0x455ff7[_0xcd2116][_0x168a('0x7f')]&&_0x3aa8e6[_0x168a('0x40')](_0x2bc64e,_0x455ff7[_0xcd2116][_0x168a('0x7f')]===_0x168a('0x80')?![]:!![]);_0x3aa8e6['field'](_0x2bc64e,_0x455ff7[_0xcd2116][_0x168a('0x81')]||_0x2bc64e);}if(_0x3bb9e0[_0x168a('0x82')]){_0x3bb9e0[_0x168a('0x82')]=JSON[_0x168a('0x83')](_0x3bb9e0['joins']);for(var _0x195840=0x0;_0x195840<_0x3bb9e0[_0x168a('0x82')][_0x168a('0x3d')];_0x195840+=0x1){if(_0x3bb9e0[_0x168a('0x82')][_0x195840]['type']&&_[_0x168a('0x84')](_0x541d16,_0x3bb9e0['joins'][_0x195840][_0x168a('0x35')])&&_0x3bb9e0[_0x168a('0x82')][_0x195840][_0x168a('0x85')]&&_0x3bb9e0[_0x168a('0x82')][_0x195840][_0x168a('0x86')]&&_0x3bb9e0['joins'][_0x195840][_0x168a('0x87')]){_0x3aa8e6[_0x3bb9e0[_0x168a('0x82')][_0x195840][_0x168a('0x35')]](_0x3bb9e0['joins'][_0x195840][_0x168a('0x86')],null,util[_0x168a('0x7c')]('%s.%s\x20=\x20%s.%s',_0x3bb9e0['table'],_0x3bb9e0[_0x168a('0x82')][_0x195840][_0x168a('0x85')],_0x3bb9e0['joins'][_0x195840][_0x168a('0x86')],_0x3bb9e0[_0x168a('0x82')][_0x195840]['foreignKey']));}}}if(_0x3bb9e0['conditions']){_0x3bb9e0['conditions']=JSON[_0x168a('0x83')](_0x3bb9e0[_0x168a('0x88')]);_0x3aa8e6[_0x168a('0x42')](_0x1fd29a(_0x3bb9e0[_0x168a('0x88')][_0x168a('0x6e')]));}_0x24d5fb=_0x3aa8e6[_0x168a('0x89')]();_0x3aa8e6[_0x168a('0x22')](_0x178289);_0x3aa8e6[_0x168a('0x1f')](0x0);logger[_0x168a('0x8a')](_0x168a('0x8b'),_0x3aa8e6['toString']());return dbH[_0x168a('0x8c')]['query'](_0x3aa8e6[_0x168a('0x8d')](),{'type':dbH[_0x168a('0x8c')][_0x168a('0x8e')][_0x168a('0x8f')]});}})['then'](respondWithResult(_0x52c7e6,null))[_0x168a('0x4c')](handleError(_0x52c7e6,null));};function runReport(_0x3800c2,_0x275627,_0xe328e8){var _0x3af9ce=_0x275627[_0x168a('0x30')];var _0x5b9ac5=0xa;var _0x243b3c=[_0x168a('0x5b'),'left_join',_0x168a('0x5d'),_0x168a('0x5e')];var _0x2045be={'SUM':'SUM(%s)','COUNT':_0x168a('0x5f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x168a('0x90'),'MIN':'MIN(%s)','AVG':_0x168a('0x91'),'GROUP_CONCAT':_0x168a('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x168a('0x64')};var _0x2f5c46={'SEC_TO_TIME':_0x168a('0x65'),'DATE':'DATE(%s)','HOUR':_0x168a('0x67'),'ROUND':_0x168a('0x92'),'UNIX_TIMESTAMP':_0x168a('0x68')};var _0x476547=function(_0x3235ed){return!_['includes'](['IS\x20NULL',_0x168a('0x6a'),_0x168a('0x6b'),'IS\x20NOT\x20EMPTY'],_0x3235ed);};var _0x387d86=function(_0x2cbcc5){if(!_0x2cbcc5||!_0x2cbcc5[_0x168a('0x6d')]['length']){return'';}for(var _0x197d1d='(',_0x2c1809=0x0;_0x2c1809<_0x2cbcc5[_0x168a('0x6d')][_0x168a('0x3d')];_0x2c1809+=0x1){_0x2c1809>0x0&&(_0x197d1d+='\x20'+_0x2cbcc5[_0x168a('0x93')]+'\x20');_0x197d1d+=_0x2cbcc5[_0x168a('0x6d')][_0x2c1809][_0x168a('0x6e')]?_0x387d86(_0x2cbcc5[_0x168a('0x6d')][_0x2c1809][_0x168a('0x6e')]):_0x2cbcc5['rules'][_0x2c1809]['field']+'\x20'+_0x2cbcc5[_0x168a('0x6d')][_0x2c1809][_0x168a('0x70')]+(_0x476547(_0x2cbcc5['rules'][_0x2c1809][_0x168a('0x70')])?'\x20'+_0x2cbcc5[_0x168a('0x6d')][_0x2c1809][_0x168a('0x94')]:'');}return _0x197d1d+')';};var _0x1d5816={'where':{'id':_0x3800c2['id']}},_0x4597dd,_0x8b0054,_0x19e067,_0x255e9c,_0x1648ec;_0x1d5816=_[_0x168a('0x44')]({},_0x1d5816,_0xe328e8);return db['AnalyticCustomReport']['find'](_0x1d5816)['then'](function(_0x2144dd){if(_0x2144dd){_0x4597dd=_0x2144dd;return _0x2144dd[_0x168a('0x71')]();}return null;})['then'](function(_0x1a24a4){if(_0x1a24a4){if(!_0x1a24a4[_0x168a('0x3d')]){throw new db['Sequelize'][(_0x168a('0x73'))](_0x168a('0x74'),0x193);}_0x8b0054=_0x1a24a4;return db[_0x168a('0x75')]['findAll']({'raw':!![]});}return null;})[_0x168a('0x28')](function(_0x493ff9){if(_0x493ff9){_0x19e067=_[_0x168a('0x76')](_0x493ff9,'id');var _0x57ee99;var _0x19b9b5=squel[_0x168a('0x95')]();_0x19b9b5[_0x168a('0x77')](_0x4597dd[_0x168a('0x78')]);for(var _0x400d0e=0x0;_0x400d0e<_0x8b0054[_0x168a('0x3d')];_0x400d0e+=0x1){_0x57ee99=_0x8b0054[_0x400d0e][_0x168a('0x79')]?_0x19e067[_0x8b0054[_0x400d0e][_0x168a('0x79')]][_0x168a('0x7a')]:_0x8b0054[_0x400d0e][_0x168a('0x6f')];_0x57ee99=_0x8b0054[_0x400d0e][_0x168a('0x7b')]?_[_0x168a('0x7d')](_0x2045be[_0x8b0054[_0x400d0e][_0x168a('0x7b')]],'%s',_0x57ee99):_0x57ee99;_0x57ee99=_0x8b0054[_0x400d0e][_0x168a('0x7c')]?_[_0x168a('0x7d')](_0x2f5c46[_0x8b0054[_0x400d0e]['format']],'%s',_0x57ee99):_0x57ee99;if(_0x8b0054[_0x400d0e][_0x168a('0x7e')]){_0x19b9b5[_0x168a('0x6e')](_0x57ee99);}_0x8b0054[_0x400d0e][_0x168a('0x7f')]&&_0x19b9b5['order'](_0x57ee99,_0x8b0054[_0x400d0e][_0x168a('0x7f')]===_0x168a('0x80')?![]:!![]);_0x19b9b5[_0x168a('0x6f')](_0x57ee99,_0x8b0054[_0x400d0e][_0x168a('0x81')]||_0x57ee99);}if(_0x4597dd[_0x168a('0x82')]){_0x4597dd[_0x168a('0x82')]=JSON[_0x168a('0x83')](_0x4597dd[_0x168a('0x82')]);for(var _0x1030fc=0x0;_0x1030fc<_0x4597dd[_0x168a('0x82')][_0x168a('0x3d')];_0x1030fc+=0x1){if(_0x4597dd[_0x168a('0x82')][_0x1030fc]['type']&&_[_0x168a('0x84')](_0x243b3c,_0x4597dd['joins'][_0x1030fc][_0x168a('0x35')])&&_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x85')]&&_0x4597dd['joins'][_0x1030fc][_0x168a('0x86')]&&_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x87')]){_0x19b9b5[_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x35')]](_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x86')],null,util['format'](_0x168a('0x96'),_0x4597dd[_0x168a('0x78')],_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x85')],_0x4597dd[_0x168a('0x82')][_0x1030fc][_0x168a('0x86')],_0x4597dd[_0x168a('0x82')][_0x1030fc]['foreignKey']));}}}if(_0x4597dd[_0x168a('0x88')]){_0x4597dd[_0x168a('0x88')]=JSON[_0x168a('0x83')](_0x4597dd[_0x168a('0x88')]);_0x19b9b5['where'](_0x387d86(_0x4597dd[_0x168a('0x88')][_0x168a('0x6e')]));}_0x1648ec=_0x19b9b5['clone']();_0x19b9b5[_0x168a('0x22')](_0x5b9ac5);_0x19b9b5[_0x168a('0x1f')](0x0);return;}})[_0x168a('0x28')](function(){if(_0x275627[_0x168a('0x97')]===_0x168a('0x98')){return null;}var _0x557855=_[_0x168a('0x44')](_0x275627,{'name':_0x275627[_0x168a('0x99')]||_0x275627['name']||_0x4597dd[_0x168a('0x30')],'basename':_0x3af9ce,'savename':util[_0x168a('0x7c')](_0x168a('0x9a'),_0x275627[_0x168a('0x30')]||_0x4597dd['name'],require('randomstring')['generate'](0x4),_0x275627[_0x168a('0x97')]||_0x168a('0x9b')),'reportId':_0x4597dd['id'],'reportType':_0x168a('0x9c')});return db[_0x168a('0x9d')]['create'](_0x557855,{'raw':!![]});})[_0x168a('0x28')](function(_0x31caa3){if(_0x4597dd['table']===_0x168a('0x9e')){_0x1648ec[_0x168a('0x42')](_0x4597dd[_0x168a('0x78')]+_0x168a('0x9f'),_0x275627[_0x168a('0xa0')],_0x275627['endDate']);}else{_0x1648ec['where'](_0x4597dd[_0x168a('0x78')]+_0x168a('0xa1'),_0x275627[_0x168a('0xa0')],_0x275627[_0x168a('0xa2')]);}if(_0x31caa3){logger[_0x168a('0xa3')](_0x168a('0xa4'),_0x1648ec['toString']());require(_0x168a('0xa5'))[_0x168a('0xa6')](path[_0x168a('0x5b')](__dirname,_0x168a('0xa7'),_0x31caa3[_0x168a('0x97')]),[_0x31caa3['id'],_0x1648ec[_0x168a('0x8d')](),path['join'](__dirname,_0x168a('0xa8'),_0x31caa3['savename']),_0x3af9ce]);return _0x31caa3;}else{var _0x9cbca8=squel[_0x168a('0x95')]();_0x9cbca8[_0x168a('0x77')]('('+_0x1648ec[_0x168a('0x8d')]()+')','countTable');_0x9cbca8[_0x168a('0x6f')]('COUNT(*)',_0x168a('0x21'));_0x1648ec[_0x168a('0x22')](_0x275627['limit']||_0x5b9ac5);_0x1648ec['offset'](_0x275627[_0x168a('0x1f')]||0x0);return dbH[_0x168a('0x8c')][_0x168a('0x38')](_0x9cbca8[_0x168a('0x8d')](),{'type':dbH[_0x168a('0x8c')][_0x168a('0x8e')][_0x168a('0x8f')]})['then'](function(_0x722ef3){if(!_0x722ef3['length']){_0x255e9c=0x0;}else{_0x255e9c=_0x722ef3[0x0][_0x168a('0x21')]||0x0;}return dbH[_0x168a('0x8c')][_0x168a('0x38')](_0x1648ec[_0x168a('0x8d')](),{'type':dbH[_0x168a('0x8c')][_0x168a('0x8e')][_0x168a('0x8f')]});})['then'](function(_0x2130d4){return{'rows':_0x2130d4||[],'count':_0x255e9c};});}});}exports[_0x168a('0xa9')]=function(_0x212199,_0xfbf4eb){return runReport(_0x212199['params'],_0x212199['query'],_0x212199[_0x168a('0x47')])[_0x168a('0x28')](respondWithResult(_0xfbf4eb,null))[_0x168a('0x4c')](handleError(_0xfbf4eb,null));};exports[_0x168a('0xaa')]=runReport;exports['query']=function(_0x2d8661,_0x4fff4a){var _0x596627=0xa;var _0x3fe8e9=['join','left_join',_0x168a('0x5d'),'cross_join'];var _0x3d11fd={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x168a('0x60'),'MAX':_0x168a('0x90'),'MIN':_0x168a('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x168a('0x62'),'GROUP_CONCAT ASC':_0x168a('0x63'),'GROUP_CONCAT DESC':_0x168a('0x64')};var _0x345dc4={'SEC_TO_TIME':_0x168a('0x65'),'DATE':'DATE(%s)','HOUR':_0x168a('0x67'),'ROUND':_0x168a('0x92'),'UNIX_TIMESTAMP':_0x168a('0x68')};var _0x1ce4d3=function(_0x23e072){return!_[_0x168a('0x84')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x168a('0x6b'),_0x168a('0x6c')],_0x23e072);};var _0x3afc57=function(_0x1bafe1){if(!_0x1bafe1||!_0x1bafe1[_0x168a('0x6d')]['length']){return'';}for(var _0xecb3c8='(',_0x3ecd41=0x0;_0x3ecd41<_0x1bafe1[_0x168a('0x6d')][_0x168a('0x3d')];_0x3ecd41+=0x1){_0x3ecd41>0x0&&(_0xecb3c8+='\x20'+_0x1bafe1[_0x168a('0x93')]+'\x20');_0xecb3c8+=_0x1bafe1[_0x168a('0x6d')][_0x3ecd41][_0x168a('0x6e')]?_0x3afc57(_0x1bafe1[_0x168a('0x6d')][_0x3ecd41]['group']):_0x1bafe1[_0x168a('0x6d')][_0x3ecd41][_0x168a('0x6f')]+'\x20'+_0x1bafe1['rules'][_0x3ecd41]['condition']+(_0x1ce4d3(_0x1bafe1['rules'][_0x3ecd41][_0x168a('0x70')])?'\x20'+_0x1bafe1['rules'][_0x3ecd41][_0x168a('0x94')]:'');}return _0xecb3c8+')';};var _0x3d2f19={'where':{'id':_0x2d8661[_0x168a('0x59')]['id']}},_0x84a1c7,_0x576f4f,_0x29b637,_0x1ad82d,_0x5c26ab;_0x3d2f19=_[_0x168a('0x44')]({},_0x3d2f19,_0x2d8661[_0x168a('0x47')]);return db[_0x168a('0x33')][_0x168a('0x4f')](_0x3d2f19)[_0x168a('0x28')](function(_0x49ee48){if(_0x49ee48){_0x84a1c7=_0x49ee48;return _0x49ee48['getFields']();}return null;})[_0x168a('0x28')](function(_0x8bc955){if(_0x8bc955){if(!_0x8bc955[_0x168a('0x3d')]){throw new db[(_0x168a('0x72'))][(_0x168a('0x73'))](_0x168a('0x74'),0x193);}_0x576f4f=_0x8bc955;return db[_0x168a('0x75')][_0x168a('0x4a')]({'raw':!![]});}return null;})[_0x168a('0x28')](function(_0x30cf5e){if(_0x30cf5e){_0x29b637=_[_0x168a('0x76')](_0x30cf5e,'id');var _0x35cab4;var _0x49a041=squel['select']();_0x49a041[_0x168a('0x77')](_0x84a1c7[_0x168a('0x78')]);for(var _0x50330b=0x0;_0x50330b<_0x576f4f['length'];_0x50330b+=0x1){_0x35cab4=_0x576f4f[_0x50330b][_0x168a('0x79')]?_0x29b637[_0x576f4f[_0x50330b][_0x168a('0x79')]][_0x168a('0x7a')]:_0x576f4f[_0x50330b][_0x168a('0x6f')];_0x35cab4=_0x576f4f[_0x50330b][_0x168a('0x7b')]?_['replace'](_0x3d11fd[_0x576f4f[_0x50330b]['function']],'%s',_0x35cab4):_0x35cab4;_0x35cab4=_0x576f4f[_0x50330b][_0x168a('0x7c')]?_[_0x168a('0x7d')](_0x345dc4[_0x576f4f[_0x50330b]['format']],'%s',_0x35cab4):_0x35cab4;if(_0x576f4f[_0x50330b][_0x168a('0x7e')]){_0x49a041['group'](_0x35cab4);}_0x576f4f[_0x50330b][_0x168a('0x7f')]&&_0x49a041[_0x168a('0x40')](_0x35cab4,_0x576f4f[_0x50330b]['orderBy']===_0x168a('0x80')?![]:!![]);_0x49a041[_0x168a('0x6f')](_0x35cab4,_0x576f4f[_0x50330b][_0x168a('0x81')]||_0x35cab4);}if(_0x84a1c7[_0x168a('0x82')]){_0x84a1c7['joins']=JSON[_0x168a('0x83')](_0x84a1c7[_0x168a('0x82')]);for(var _0x303a3f=0x0;_0x303a3f<_0x84a1c7[_0x168a('0x82')][_0x168a('0x3d')];_0x303a3f+=0x1){if(_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x35')]&&_['includes'](_0x3fe8e9,_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x35')])&&_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x85')]&&_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x86')]&&_0x84a1c7['joins'][_0x303a3f][_0x168a('0x87')]){_0x49a041[_0x84a1c7['joins'][_0x303a3f][_0x168a('0x35')]](_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x86')],null,util[_0x168a('0x7c')](_0x168a('0x96'),_0x84a1c7[_0x168a('0x78')],_0x84a1c7[_0x168a('0x82')][_0x303a3f]['parentKey'],_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x86')],_0x84a1c7[_0x168a('0x82')][_0x303a3f][_0x168a('0x87')]));}}}if(_0x84a1c7[_0x168a('0x88')]){_0x84a1c7[_0x168a('0x88')]=JSON[_0x168a('0x83')](_0x84a1c7[_0x168a('0x88')]);_0x49a041[_0x168a('0x42')](_0x3afc57(_0x84a1c7[_0x168a('0x88')]['group']));}_0x5c26ab=_0x49a041['clone']();_0x49a041[_0x168a('0x22')](_0x596627);_0x49a041['offset'](0x0);logger[_0x168a('0x8a')](_0x168a('0x8b'),_0x49a041[_0x168a('0x8d')]());return dbH[_0x168a('0x8c')][_0x168a('0x38')](_0x49a041[_0x168a('0x8d')](),{'type':dbH[_0x168a('0x8c')][_0x168a('0x8e')][_0x168a('0x8f')]});}})[_0x168a('0x28')](function(){return{'sql':_0x5c26ab['toString']()};})[_0x168a('0x28')](respondWithResult(_0x4fff4a,null))[_0x168a('0x4c')](handleError(_0x4fff4a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 50ad364..7385265 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 _0xf891=['../../config/environment','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2772f1,_0x4ae0c2){var _0x577fdb=function(_0x291b20){while(--_0x291b20){_0x2772f1['push'](_0x2772f1['shift']());}};_0x577fdb(++_0x4ae0c2);}(_0xf891,0x8f));var _0x1f89=function(_0x448c80,_0xfebfda){_0x448c80=_0x448c80-0x0;var _0xe32c27=_0xf891[_0x448c80];return _0xe32c27;};'use strict';var _=require(_0x1f89('0x0'));var util=require('util');var logger=require(_0x1f89('0x1'))(_0x1f89('0x2'));var moment=require(_0x1f89('0x3'));var BPromise=require(_0x1f89('0x4'));var rp=require(_0x1f89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f89('0x6'));var config=require(_0x1f89('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x399d8f,_0x1c4a3f){return _0x399d8f['define'](_0x1f89('0x8'),attributes,{'tableName':_0x1f89('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd22f=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticCustomReport.attributes'];(function(_0x373dd0,_0x3c6a83){var _0x4102a8=function(_0x24e4c3){while(--_0x24e4c3){_0x373dd0['push'](_0x373dd0['shift']());}};_0x4102a8(++_0x3c6a83);}(_0xd22f,0x184));var _0xfd22=function(_0x375923,_0x3bf77f){_0x375923=_0x375923-0x0;var _0x3f15ab=_0xd22f[_0x375923];return _0x3f15ab;};'use strict';var _=require(_0xfd22('0x0'));var util=require('util');var logger=require(_0xfd22('0x1'))(_0xfd22('0x2'));var moment=require(_0xfd22('0x3'));var BPromise=require(_0xfd22('0x4'));var rp=require(_0xfd22('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd22('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd22('0x7'));module[_0xfd22('0x8')]=function(_0x14dd26,_0x2fbf8b){return _0x14dd26[_0xfd22('0x9')](_0xfd22('0xa'),attributes,{'tableName':_0xfd22('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 35817d1..836f0a7 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 _0x72e1=['rpc','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d342b,_0x2c60c1){var _0x77a5cc=function(_0x3d82b7){while(--_0x3d82b7){_0x1d342b['push'](_0x1d342b['shift']());}};_0x77a5cc(++_0x2c60c1);}(_0x72e1,0x126));var _0x172e=function(_0x42a4a9,_0x5d6cb0){_0x42a4a9=_0x42a4a9-0x0;var _0x60ec88=_0x72e1[_0x42a4a9];return _0x60ec88;};'use strict';var _=require('lodash');var util=require(_0x172e('0x0'));var moment=require(_0x172e('0x1'));var BPromise=require('bluebird');var rs=require(_0x172e('0x2'));var fs=require('fs');var Redis=require(_0x172e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x172e('0x4'));var logger=require(_0x172e('0x5'))(_0x172e('0x6'));var config=require(_0x172e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x172e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x196095,_0xf6d3aa,_0x1a8e32){return new BPromise(function(_0xc853d8,_0x440563){return client[_0x172e('0x9')](_0x196095,_0x1a8e32)[_0x172e('0xa')](function(_0x1786dc){logger[_0x172e('0xb')](_0x172e('0xc'),_0xf6d3aa,_0x172e('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xf6d3aa,_0x172e('0xd'),JSON[_0x172e('0xe')](_0x1786dc));if(_0x1786dc[_0x172e('0xf')]){if(_0x1786dc[_0x172e('0xf')][_0x172e('0x10')]===0x1f4){logger[_0x172e('0xf')](_0x172e('0xc'),_0xf6d3aa,_0x1786dc[_0x172e('0xf')][_0x172e('0x11')]);return _0x440563(_0x1786dc['error'][_0x172e('0x11')]);}logger[_0x172e('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0xf6d3aa,_0x1786dc[_0x172e('0xf')][_0x172e('0x11')]);return _0xc853d8(_0x1786dc[_0x172e('0xf')][_0x172e('0x11')]);}else{logger[_0x172e('0xb')](_0x172e('0xc'),_0xf6d3aa,_0x172e('0xd'));_0xc853d8(_0x1786dc[_0x172e('0x12')][_0x172e('0x11')]);}})[_0x172e('0x13')](function(_0x10a2c8){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xf6d3aa,_0x10a2c8);_0x440563(_0x10a2c8);});});} \ No newline at end of file +var _0xc2e5=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0xc2e5,0x87));var _0x5c2e=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xc2e5[_0x4db46b];return _0x565be8;};'use strict';var _=require(_0x5c2e('0x0'));var util=require(_0x5c2e('0x1'));var moment=require(_0x5c2e('0x2'));var BPromise=require(_0x5c2e('0x3'));var rs=require(_0x5c2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c2e('0x5'))['db'];var utils=require(_0x5c2e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c2e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65371e,_0x1046a3,_0x22781f){return new BPromise(function(_0x1a3d16,_0x2d8cb6){return client[_0x5c2e('0x9')](_0x65371e,_0x22781f)[_0x5c2e('0xa')](function(_0x13a949){logger[_0x5c2e('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1046a3,_0x5c2e('0xc'));logger[_0x5c2e('0xd')](_0x5c2e('0xe'),_0x1046a3,_0x5c2e('0xc'),JSON[_0x5c2e('0xf')](_0x13a949));if(_0x13a949[_0x5c2e('0x10')]){if(_0x13a949[_0x5c2e('0x10')]['code']===0x1f4){logger[_0x5c2e('0x10')](_0x5c2e('0x11'),_0x1046a3,_0x13a949['error']['message']);return _0x2d8cb6(_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);}logger[_0x5c2e('0x10')](_0x5c2e('0x11'),_0x1046a3,_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);return _0x1a3d16(_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);}else{logger[_0x5c2e('0xb')](_0x5c2e('0x11'),_0x1046a3,'request\x20sent');_0x1a3d16(_0x13a949[_0x5c2e('0x13')][_0x5c2e('0x12')]);}})['catch'](function(_0x54925b){logger[_0x5c2e('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1046a3,_0x54925b);_0x2d8cb6(_0x54925b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 535746b..53cc80d 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 _0x5d2c=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','/:id','isAuthenticated','show','get','/:id/preview','preview','/:id/run','/:id/query','query','post'];(function(_0x3b6a79,_0x12da4b){var _0x433d5d=function(_0x473854){while(--_0x473854){_0x3b6a79['push'](_0x3b6a79['shift']());}};_0x433d5d(++_0x12da4b);}(_0x5d2c,0x13c));var _0xc5d2=function(_0x232109,_0x21597c){_0x232109=_0x232109-0x0;var _0x341a29=_0x5d2c[_0x232109];return _0x341a29;};'use strict';var multer=require(_0xc5d2('0x0'));var util=require(_0xc5d2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc5d2('0x2'));var router=express[_0xc5d2('0x3')]();var fs_extra=require(_0xc5d2('0x4'));var auth=require(_0xc5d2('0x5'));var interaction=require(_0xc5d2('0x6'));var config=require(_0xc5d2('0x7'));var controller=require(_0xc5d2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc5d2('0x9')]);router['get'](_0xc5d2('0xa'),auth[_0xc5d2('0xb')](),controller[_0xc5d2('0xc')]);router[_0xc5d2('0xd')](_0xc5d2('0xe'),auth[_0xc5d2('0xb')](),controller[_0xc5d2('0xf')]);router['get'](_0xc5d2('0x10'),auth[_0xc5d2('0xb')](),controller['run']);router['get'](_0xc5d2('0x11'),auth[_0xc5d2('0xb')](),controller[_0xc5d2('0x12')]);router[_0xc5d2('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc5d2('0xa'),auth[_0xc5d2('0xb')](),controller[_0xc5d2('0x14')]);router[_0xc5d2('0x15')](_0xc5d2('0xa'),auth['isAuthenticated'](),controller[_0xc5d2('0x16')]);module[_0xc5d2('0x17')]=router; \ No newline at end of file +var _0x6e71=['../../components/auth/service','get','isAuthenticated','index','/:id','show','preview','/:id/run','query','create','update','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xbf4657,_0x1f99f5){var _0x52e47a=function(_0xa0d1db){while(--_0xa0d1db){_0xbf4657['push'](_0xbf4657['shift']());}};_0x52e47a(++_0x1f99f5);}(_0x6e71,0x9c));var _0x16e7=function(_0x1a8ff5,_0x596777){_0x1a8ff5=_0x1a8ff5-0x0;var _0x1ee220=_0x6e71[_0x1a8ff5];return _0x1ee220;};'use strict';var multer=require(_0x16e7('0x0'));var util=require(_0x16e7('0x1'));var path=require(_0x16e7('0x2'));var timeout=require(_0x16e7('0x3'));var express=require('express');var router=express[_0x16e7('0x4')]();var fs_extra=require(_0x16e7('0x5'));var auth=require(_0x16e7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x16e7('0x7')]('/',auth[_0x16e7('0x8')](),controller[_0x16e7('0x9')]);router[_0x16e7('0x7')](_0x16e7('0xa'),auth[_0x16e7('0x8')](),controller[_0x16e7('0xb')]);router[_0x16e7('0x7')]('/:id/preview',auth[_0x16e7('0x8')](),controller[_0x16e7('0xc')]);router[_0x16e7('0x7')](_0x16e7('0xd'),auth[_0x16e7('0x8')](),controller['run']);router[_0x16e7('0x7')]('/:id/query',auth['isAuthenticated'](),controller[_0x16e7('0xe')]);router['post']('/',auth[_0x16e7('0x8')](),controller[_0x16e7('0xf')]);router['put']('/:id',auth[_0x16e7('0x8')](),controller[_0x16e7('0x10')]);router['delete'](_0x16e7('0xa'),auth['isAuthenticated'](),controller[_0x16e7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b3867b2..c3a2575 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 _0x5d58=['TEXT','STRING'];(function(_0xafb347,_0x3a5314){var _0x3ded8d=function(_0x199c32){while(--_0x199c32){_0xafb347['push'](_0xafb347['shift']());}};_0x3ded8d(++_0x3a5314);}(_0x5d58,0x187));var _0x85d5=function(_0x41935b,_0x527dd0){_0x41935b=_0x41935b-0x0;var _0x28fe5f=_0x5d58[_0x41935b];return _0x28fe5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x3bc971,_0x16882d){var _0x42bb0a=function(_0x284e81){while(--_0x284e81){_0x3bc971['push'](_0x3bc971['shift']());}};_0x42bb0a(++_0x16882d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3d41b0,_0x334b7a){_0x3d41b0=_0x3d41b0-0x0;var _0x19d68f=_0x3eea[_0x3d41b0];return _0x19d68f;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 82334d6..7b57b85 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 _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1416fc,_0x72e155){var _0x3a4b34=function(_0x455ac8){while(--_0x455ac8){_0x1416fc['push'](_0x1416fc['shift']());}};_0x3a4b34(++_0x72e155);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','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)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x300464,_0x4bdf5c){var _0x100b81=function(_0x5ae8c7){while(--_0x5ae8c7){_0x300464['push'](_0x300464['shift']());}};_0x100b81(++_0x4bdf5c);}(_0x7a54,0x106));var _0x47a5=function(_0x5c01da,_0x9d0c91){_0x5c01da=_0x5c01da-0x0;var _0x5b2877=_0x7a54[_0x5c01da];return _0x5b2877;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2ab566a..4feafd5 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 _0xdf5c=['exports','define','AnalyticDefaultReport','util','../../config/logger','api','bluebird','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x891fb6,_0x3da471){var _0x453a89=function(_0x1172f4){while(--_0x1172f4){_0x891fb6['push'](_0x891fb6['shift']());}};_0x453a89(++_0x3da471);}(_0xdf5c,0x18f));var _0xcdf5=function(_0x4955b2,_0x406842){_0x4955b2=_0x4955b2-0x0;var _0x4a7eb4=_0xdf5c[_0x4955b2];return _0x4a7eb4;};'use strict';var _=require('lodash');var util=require(_0xcdf5('0x0'));var logger=require(_0xcdf5('0x1'))(_0xcdf5('0x2'));var moment=require('moment');var BPromise=require(_0xcdf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcdf5('0x4'));var attributes=require(_0xcdf5('0x5'));module[_0xcdf5('0x6')]=function(_0x3e6896,_0x24343c){return _0x3e6896[_0xcdf5('0x7')](_0xcdf5('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b59=['moment','bluebird','path','rimraf','./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash','util','../../config/logger'];(function(_0x10780b,_0x34a71a){var _0x1ed45c=function(_0x48df79){while(--_0x48df79){_0x10780b['push'](_0x10780b['shift']());}};_0x1ed45c(++_0x34a71a);}(_0x3b59,0x9f));var _0x93b5=function(_0x15b2a8,_0x25b5e8){_0x15b2a8=_0x15b2a8-0x0;var _0xa6503d=_0x3b59[_0x15b2a8];return _0xa6503d;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var logger=require(_0x93b5('0x2'))('api');var moment=require(_0x93b5('0x3'));var BPromise=require(_0x93b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93b5('0x5'));var rimraf=require(_0x93b5('0x6'));var config=require('../../config/environment');var attributes=require(_0x93b5('0x7'));module['exports']=function(_0x2def3c,_0x594ec8){return _0x2def3c['define'](_0x93b5('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6e18b5f..22cdade 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 _0x6b8f=['rpc','../../config/environment','client','http','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x240282,_0x158890){var _0x49d28f=function(_0x1fcfaf){while(--_0x1fcfaf){_0x240282['push'](_0x240282['shift']());}};_0x49d28f(++_0x158890);}(_0x6b8f,0x149));var _0xf6b8=function(_0x1e2ca4,_0x5af33b){_0x1e2ca4=_0x1e2ca4-0x0;var _0x49f3cd=_0x6b8f[_0x1e2ca4];return _0x49f3cd;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6b8('0x4'));var db=require(_0xf6b8('0x5'))['db'];var utils=require(_0xf6b8('0x6'));var logger=require('../../config/logger')(_0xf6b8('0x7'));var config=require(_0xf6b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf6b8('0x9')][_0xf6b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe287b3,_0x3de72e,_0x19e085){return new BPromise(function(_0x3651a0,_0x1e5992){return client['request'](_0xe287b3,_0x19e085)[_0xf6b8('0xb')](function(_0x7be23a){logger[_0xf6b8('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3de72e,_0xf6b8('0xd'));logger[_0xf6b8('0xe')](_0xf6b8('0xf'),_0x3de72e,_0xf6b8('0xd'),JSON['stringify'](_0x7be23a));if(_0x7be23a[_0xf6b8('0x10')]){if(_0x7be23a[_0xf6b8('0x10')][_0xf6b8('0x11')]===0x1f4){logger[_0xf6b8('0x10')](_0xf6b8('0x12'),_0x3de72e,_0x7be23a[_0xf6b8('0x10')][_0xf6b8('0x13')]);return _0x1e5992(_0x7be23a[_0xf6b8('0x10')][_0xf6b8('0x13')]);}logger[_0xf6b8('0x10')](_0xf6b8('0x12'),_0x3de72e,_0x7be23a['error'][_0xf6b8('0x13')]);return _0x3651a0(_0x7be23a[_0xf6b8('0x10')]['message']);}else{logger[_0xf6b8('0xc')](_0xf6b8('0x12'),_0x3de72e,_0xf6b8('0xd'));_0x3651a0(_0x7be23a['result'][_0xf6b8('0x13')]);}})[_0xf6b8('0x14')](function(_0xad3d2c){logger[_0xf6b8('0x10')](_0xf6b8('0x12'),_0x3de72e,_0xad3d2c);_0x1e5992(_0xad3d2c);});});} \ No newline at end of file +var _0x89e3=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x441dd4,_0x582db9){var _0x54ea8b=function(_0x308f42){while(--_0x308f42){_0x441dd4['push'](_0x441dd4['shift']());}};_0x54ea8b(++_0x582db9);}(_0x89e3,0x10e));var _0x389e=function(_0x2e129f,_0x3fa4c6){_0x2e129f=_0x2e129f-0x0;var _0x449569=_0x89e3[_0x2e129f];return _0x449569;};'use strict';var _=require(_0x389e('0x0'));var util=require('util');var moment=require(_0x389e('0x1'));var BPromise=require(_0x389e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x389e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x389e('0x4'));var logger=require(_0x389e('0x5'))(_0x389e('0x6'));var config=require(_0x389e('0x7'));var jayson=require(_0x389e('0x8'));var client=jayson[_0x389e('0x9')][_0x389e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465cd3,_0x2f7d8e,_0x1cd5af){return new BPromise(function(_0x5c5ed2,_0x3e05dd){return client[_0x389e('0xb')](_0x465cd3,_0x1cd5af)['then'](function(_0xa6da2a){logger[_0x389e('0xc')](_0x389e('0xd'),_0x2f7d8e,_0x389e('0xe'));logger[_0x389e('0xf')](_0x389e('0x10'),_0x2f7d8e,_0x389e('0xe'),JSON['stringify'](_0xa6da2a));if(_0xa6da2a[_0x389e('0x11')]){if(_0xa6da2a[_0x389e('0x11')][_0x389e('0x12')]===0x1f4){logger[_0x389e('0x11')](_0x389e('0xd'),_0x2f7d8e,_0xa6da2a[_0x389e('0x11')][_0x389e('0x13')]);return _0x3e05dd(_0xa6da2a[_0x389e('0x11')]['message']);}logger['error'](_0x389e('0xd'),_0x2f7d8e,_0xa6da2a['error'][_0x389e('0x13')]);return _0x5c5ed2(_0xa6da2a['error'][_0x389e('0x13')]);}else{logger['info'](_0x389e('0xd'),_0x2f7d8e,_0x389e('0xe'));_0x5c5ed2(_0xa6da2a[_0x389e('0x14')]['message']);}})[_0x389e('0x15')](function(_0x315e89){logger[_0x389e('0x11')](_0x389e('0xd'),_0x2f7d8e,_0x315e89);_0x3e05dd(_0x315e89);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 20818bf..788bba2 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 _0xaf90=['../../components/interaction/service','get','index','/:id','/:id/preview','/:id/run','run','/:id/query','query','post','put','isAuthenticated','update','delete','multer','util','path','connect-timeout','express'];(function(_0x2865ec,_0x2cb9bb){var _0x480cf7=function(_0x3cb1fb){while(--_0x3cb1fb){_0x2865ec['push'](_0x2865ec['shift']());}};_0x480cf7(++_0x2cb9bb);}(_0xaf90,0x93));var _0x0af9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xaf90[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0af9('0x0'));var util=require(_0x0af9('0x1'));var path=require(_0x0af9('0x2'));var timeout=require(_0x0af9('0x3'));var express=require(_0x0af9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0af9('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x0af9('0x6')]('/',auth['isAuthenticated'](),controller[_0x0af9('0x7')]);router[_0x0af9('0x6')](_0x0af9('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0af9('0x6')](_0x0af9('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0x0af9('0x6')](_0x0af9('0xa'),auth['isAuthenticated'](),controller[_0x0af9('0xb')]);router[_0x0af9('0x6')](_0x0af9('0xc'),auth['isAuthenticated'](),controller[_0x0af9('0xd')]);router[_0x0af9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0af9('0xf')]('/:id',auth[_0x0af9('0x10')](),controller[_0x0af9('0x11')]);router[_0x0af9('0x12')](_0x0af9('0x8'),auth[_0x0af9('0x10')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2839=['/:id/query','query','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x2839,0xe3));var _0x9283=function(_0x52a858,_0x3f26de){_0x52a858=_0x52a858-0x0;var _0x1c092a=_0x2839[_0x52a858];return _0x1c092a;};'use strict';var multer=require('multer');var util=require(_0x9283('0x0'));var path=require(_0x9283('0x1'));var timeout=require(_0x9283('0x2'));var express=require(_0x9283('0x3'));var router=express[_0x9283('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9283('0x5'));var config=require(_0x9283('0x6'));var controller=require(_0x9283('0x7'));router[_0x9283('0x8')]('/',auth[_0x9283('0x9')](),controller['index']);router[_0x9283('0x8')](_0x9283('0xa'),auth[_0x9283('0x9')](),controller[_0x9283('0xb')]);router[_0x9283('0x8')](_0x9283('0xc'),auth[_0x9283('0x9')](),controller[_0x9283('0xd')]);router[_0x9283('0x8')](_0x9283('0xe'),auth[_0x9283('0x9')](),controller['run']);router[_0x9283('0x8')](_0x9283('0xf'),auth[_0x9283('0x9')](),controller[_0x9283('0x10')]);router[_0x9283('0x11')]('/',auth[_0x9283('0x9')](),controller[_0x9283('0x12')]);router[_0x9283('0x13')](_0x9283('0xa'),auth['isAuthenticated'](),controller[_0x9283('0x14')]);router['delete']('/:id',auth[_0x9283('0x9')](),controller['destroy']);module[_0x9283('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1390342..6ebee73 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 _0x4146=['moment','STRING','xlsx','csv','DATE','Loading','ENUM','manual','scheduled','INTEGER','sequelize'];(function(_0x332f36,_0x2c2e32){var _0x20f639=function(_0xe47b56){while(--_0xe47b56){_0x332f36['push'](_0x332f36['shift']());}};_0x20f639(++_0x2c2e32);}(_0x4146,0x11d));var _0x6414=function(_0x1a08b9,_0x52fbaa){_0x1a08b9=_0x1a08b9-0x0;var _0x38bc99=_0x4146[_0x1a08b9];return _0x38bc99;};'use strict';var Sequelize=require(_0x6414('0x0'));var moment=require(_0x6414('0x1'));module['exports']={'name':{'type':Sequelize[_0x6414('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6414('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0x6414('0x3')),'allowNull':![],'defaultValue':_0x6414('0x4')},'savename':{'type':Sequelize[_0x6414('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6414('0x5')]},'endDate':{'type':Sequelize[_0x6414('0x5')]},'status':{'type':Sequelize[_0x6414('0x2')],'defaultValue':_0x6414('0x6')},'type':{'type':Sequelize[_0x6414('0x7')](_0x6414('0x8'),_0x6414('0x9')),'allowNull':![],'defaultValue':_0x6414('0x8')},'reportId':{'type':Sequelize[_0x6414('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x6414('0x2')]}}; \ No newline at end of file +var _0xc04c=['moment','STRING','ENUM','xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize'];(function(_0x53c7a8,_0x177259){var _0x588777=function(_0x52d947){while(--_0x52d947){_0x53c7a8['push'](_0x53c7a8['shift']());}};_0x588777(++_0x177259);}(_0xc04c,0x153));var _0xcc04=function(_0xe37b36,_0x46e12e){_0xe37b36=_0xe37b36-0x0;var _0x1f0442=_0xc04c[_0xe37b36];return _0x1f0442;};'use strict';var Sequelize=require(_0xcc04('0x0'));var moment=require(_0xcc04('0x1'));module['exports']={'name':{'type':Sequelize[_0xcc04('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xcc04('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xcc04('0x3')]('csv','pdf',_0xcc04('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xcc04('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xcc04('0x5')]},'endDate':{'type':Sequelize[_0xcc04('0x5')]},'status':{'type':Sequelize[_0xcc04('0x2')],'defaultValue':_0xcc04('0x6')},'type':{'type':Sequelize['ENUM'](_0xcc04('0x7'),_0xcc04('0x8')),'allowNull':![],'defaultValue':_0xcc04('0x7')},'reportId':{'type':Sequelize[_0xcc04('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xcc04('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 92383be..5aa5d31 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 _0x1146=['format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','index','AnalyticExtractedReport','fieldName','type','map','name','query','filters','intersection','model','attributes','fields','order','sort','pick','filter','merge','where','VIRTUAL','findAll','rows','show','keys','length','includeAll','include','find','catch','create','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','existsSync','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','join','server/files/reports'];(function(_0x14345e,_0x46ed26){var _0x3bf5d2=function(_0x3eb6cb){while(--_0x3eb6cb){_0x14345e['push'](_0x14345e['shift']());}};_0x3bf5d2(++_0x46ed26);}(_0x1146,0x187));var _0x6114=function(_0x54c646,_0x3a8739){_0x54c646=_0x54c646-0x0;var _0x2ab3b7=_0x1146[_0x54c646];return _0x2ab3b7;};'use strict';var emlformat=require(_0x6114('0x0'));var rimraf=require(_0x6114('0x1'));var zipdir=require(_0x6114('0x2'));var jsonpatch=require(_0x6114('0x3'));var rp=require(_0x6114('0x4'));var moment=require(_0x6114('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6114('0x6'));var path=require(_0x6114('0x7'));var sox=require(_0x6114('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6114('0x9'));var _=require(_0x6114('0xa'));var squel=require(_0x6114('0xb'));var crypto=require(_0x6114('0xc'));var jsforce=require(_0x6114('0xd'));var deskjs=require(_0x6114('0xe'));var toCsv=require(_0x6114('0xf'));var querystring=require(_0x6114('0x10'));var Papa=require(_0x6114('0x11'));var Redis=require(_0x6114('0x12'));var authService=require(_0x6114('0x13'));var qs=require(_0x6114('0x14'));var as=require(_0x6114('0x15'));var hardwareService=require(_0x6114('0x16'));var logger=require(_0x6114('0x17'))(_0x6114('0x18'));var utils=require(_0x6114('0x19'));var config=require(_0x6114('0x1a'));var licenseUtil=require(_0x6114('0x1b'));var db=require(_0x6114('0x1c'))['db'];function respondWithStatusCode(_0x26952e,_0xf88ec3){_0xf88ec3=_0xf88ec3||0xcc;return function(_0x380525){if(_0x380525){return _0x26952e[_0x6114('0x1d')](_0xf88ec3);}return _0x26952e[_0x6114('0x1e')](_0xf88ec3)[_0x6114('0x1f')]();};}function respondWithResult(_0x3990fa,_0xc9b26b){_0xc9b26b=_0xc9b26b||0xc8;return function(_0x263b0b){if(_0x263b0b){return _0x3990fa['status'](_0xc9b26b)[_0x6114('0x20')](_0x263b0b);}};}function respondWithFilteredResult(_0x52fe58,_0x431660){return function(_0xcacac){if(_0xcacac){var _0x4125cb=typeof _0x431660[_0x6114('0x21')]===_0x6114('0x22')&&typeof _0x431660[_0x6114('0x23')]===_0x6114('0x22');var _0x433b7e=_0xcacac['count'];var _0x396cda=_0x4125cb?0x0:_0x431660[_0x6114('0x21')];var _0x2e4dc9=_0x4125cb?_0xcacac[_0x6114('0x24')]:_0x431660[_0x6114('0x21')]+_0x431660['limit'];var _0x3a5dcb;if(_0x2e4dc9>=_0x433b7e){_0x2e4dc9=_0x433b7e;_0x3a5dcb=0xc8;}else{_0x3a5dcb=0xce;}_0x52fe58[_0x6114('0x1e')](_0x3a5dcb);return _0x52fe58[_0x6114('0x25')](_0x6114('0x26'),_0x396cda+'-'+_0x2e4dc9+'/'+_0x433b7e)[_0x6114('0x20')](_0xcacac);}return null;};}function patchUpdates(_0x3bd8a4){return function(_0x2ed861){try{jsonpatch[_0x6114('0x27')](_0x2ed861,_0x3bd8a4,!![]);}catch(_0x5a7c69){return BPromise[_0x6114('0x28')](_0x5a7c69);}return _0x2ed861[_0x6114('0x29')]();};}function saveUpdates(_0x8a6c0d,_0x581783){return function(_0x180b95){if(_0x180b95){return _0x180b95[_0x6114('0x2a')](_0x8a6c0d)[_0x6114('0x2b')](function(_0x52e134){return _0x52e134;});}return null;};}function removeEntity(_0x152df9,_0x360965){return function(_0x4b0f07){if(_0x4b0f07){return _0x4b0f07[_0x6114('0x2c')]()[_0x6114('0x2b')](function(){var _0x55c179=_0x4b0f07[_0x6114('0x2d')]({'plain':!![]});var _0x3ce2cb=_0x6114('0x2e');return db[_0x6114('0x2f')][_0x6114('0x2c')]({'where':{'type':_0x3ce2cb,'resourceId':_0x55c179['id']}})['then'](function(){return _0x4b0f07;});})[_0x6114('0x2b')](function(){_0x152df9[_0x6114('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f08f,_0x2c4ac7){return function(_0x2f3b82){if(!_0x2f3b82){_0x46f08f[_0x6114('0x1d')](0x194);}return _0x2f3b82;};}function handleError(_0xd300a8,_0x71e5aa){_0x71e5aa=_0x71e5aa||0x1f4;return function(_0x362ce7){logger[_0x6114('0x30')](_0x362ce7[_0x6114('0x31')]);if(_0x362ce7['name']){delete _0x362ce7['name'];}_0xd300a8[_0x6114('0x1e')](_0x71e5aa)['send'](_0x362ce7);};}exports[_0x6114('0x32')]=function(_0x1882c4,_0x160983){var _0x1f4cf6={},_0x39590a={},_0x507e5b={'count':0x0,'rows':[]};var _0x50465b=_['map'](db[_0x6114('0x33')]['rawAttributes'],function(_0xc38848){return{'name':_0xc38848[_0x6114('0x34')],'type':_0xc38848[_0x6114('0x35')]['key']};});_0x39590a['model']=_[_0x6114('0x36')](_0x50465b,_0x6114('0x37'));_0x39590a[_0x6114('0x38')]=_['keys'](_0x1882c4['query']);_0x39590a[_0x6114('0x39')]=_[_0x6114('0x3a')](_0x39590a[_0x6114('0x3b')],_0x39590a[_0x6114('0x38')]);_0x1f4cf6[_0x6114('0x3c')]=_['intersection'](_0x39590a[_0x6114('0x3b')],qs[_0x6114('0x3d')](_0x1882c4['query'][_0x6114('0x3d')]));_0x1f4cf6[_0x6114('0x3c')]=_0x1f4cf6[_0x6114('0x3c')]['length']?_0x1f4cf6[_0x6114('0x3c')]:_0x39590a[_0x6114('0x3b')];if(!_0x1882c4[_0x6114('0x38')]['hasOwnProperty']('nolimit')){_0x1f4cf6[_0x6114('0x23')]=qs[_0x6114('0x23')](_0x1882c4[_0x6114('0x38')][_0x6114('0x23')]);_0x1f4cf6['offset']=qs[_0x6114('0x21')](_0x1882c4[_0x6114('0x38')][_0x6114('0x21')]);}_0x1f4cf6[_0x6114('0x3e')]=qs['sort'](_0x1882c4[_0x6114('0x38')][_0x6114('0x3f')]);_0x1f4cf6['where']=qs['filters'](_[_0x6114('0x40')](_0x1882c4[_0x6114('0x38')],_0x39590a[_0x6114('0x39')]),_0x50465b);if(_0x1882c4['query'][_0x6114('0x41')]){_0x1f4cf6['where']=_[_0x6114('0x42')](_0x1f4cf6[_0x6114('0x43')],{'$or':_[_0x6114('0x36')](_0x50465b,function(_0x4b76a1){if(_0x4b76a1[_0x6114('0x35')]!==_0x6114('0x44')){var _0x7d3eb7={};_0x7d3eb7[_0x4b76a1[_0x6114('0x37')]]={'$like':'%'+_0x1882c4[_0x6114('0x38')][_0x6114('0x41')]+'%'};return _0x7d3eb7;}})});}_0x1f4cf6=_[_0x6114('0x42')]({},_0x1f4cf6,_0x1882c4['options']);var _0x321364={'where':_0x1f4cf6[_0x6114('0x43')]};return db[_0x6114('0x33')][_0x6114('0x24')](_0x321364)['then'](function(_0x68571e){_0x507e5b[_0x6114('0x24')]=_0x68571e;if(_0x1882c4[_0x6114('0x38')]['includeAll']){_0x1f4cf6['include']=[{'all':!![]}];}return db[_0x6114('0x33')][_0x6114('0x45')](_0x1f4cf6);})[_0x6114('0x2b')](function(_0x2dc96f){_0x507e5b[_0x6114('0x46')]=_0x2dc96f;return _0x507e5b;})[_0x6114('0x2b')](respondWithFilteredResult(_0x160983,_0x1f4cf6))['catch'](handleError(_0x160983,null));};exports[_0x6114('0x47')]=function(_0x9dce15,_0x4a975b){var _0xae3102={'raw':!![],'where':{'id':_0x9dce15['params']['id']}},_0x450d76={};_0x450d76[_0x6114('0x3b')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x450d76[_0x6114('0x38')]=_[_0x6114('0x48')](_0x9dce15[_0x6114('0x38')]);_0x450d76[_0x6114('0x39')]=_[_0x6114('0x3a')](_0x450d76[_0x6114('0x3b')],_0x450d76[_0x6114('0x38')]);_0xae3102[_0x6114('0x3c')]=_['intersection'](_0x450d76[_0x6114('0x3b')],qs[_0x6114('0x3d')](_0x9dce15[_0x6114('0x38')]['fields']));_0xae3102[_0x6114('0x3c')]=_0xae3102[_0x6114('0x3c')][_0x6114('0x49')]?_0xae3102[_0x6114('0x3c')]:_0x450d76[_0x6114('0x3b')];if(_0x9dce15[_0x6114('0x38')][_0x6114('0x4a')]){_0xae3102[_0x6114('0x4b')]=[{'all':!![]}];}_0xae3102=_[_0x6114('0x42')]({},_0xae3102,_0x9dce15['options']);return db['AnalyticExtractedReport'][_0x6114('0x4c')](_0xae3102)['then'](handleEntityNotFound(_0x4a975b,null))[_0x6114('0x2b')](respondWithResult(_0x4a975b,null))[_0x6114('0x4d')](handleError(_0x4a975b,null));};exports['create']=function(_0x597876,_0x118171){return db[_0x6114('0x33')][_0x6114('0x4e')](_0x597876[_0x6114('0x4f')],{})[_0x6114('0x2b')](function(_0x4a5c89){var _0x18035d=_0x597876[_0x6114('0x50')][_0x6114('0x2d')]({'plain':!![]});if(!_0x18035d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18035d['role']===_0x6114('0x50')){var _0xbc9d2e=_0x4a5c89[_0x6114('0x2d')]({'plain':!![]});var _0x1720cd=_0x6114('0x2e');return db['UserProfileSection'][_0x6114('0x4c')]({'where':{'name':_0x1720cd,'userProfileId':_0x18035d['userProfileId']},'raw':!![]})['then'](function(_0x45563d){if(_0x45563d&&_0x45563d[_0x6114('0x51')]===0x0){return db['UserProfileResource'][_0x6114('0x4e')]({'name':_0xbc9d2e['name'],'resourceId':_0xbc9d2e['id'],'type':_0x45563d[_0x6114('0x37')],'sectionId':_0x45563d['id']},{})['then'](function(){return _0x4a5c89;});}else{return _0x4a5c89;}})[_0x6114('0x4d')](function(_0x509df0){logger[_0x6114('0x30')](_0x6114('0x52'),_0x509df0);throw _0x509df0;});}return _0x4a5c89;})[_0x6114('0x2b')](respondWithResult(_0x118171,0xc9))['catch'](handleError(_0x118171,null));};exports[_0x6114('0x2a')]=function(_0x38867d,_0x3d3d5e){if(_0x38867d[_0x6114('0x4f')]['id']){delete _0x38867d[_0x6114('0x4f')]['id'];}return db[_0x6114('0x33')][_0x6114('0x4c')]({'where':{'id':_0x38867d[_0x6114('0x53')]['id']}})[_0x6114('0x2b')](handleEntityNotFound(_0x3d3d5e,null))[_0x6114('0x2b')](saveUpdates(_0x38867d[_0x6114('0x4f')],null))['then'](respondWithResult(_0x3d3d5e,null))[_0x6114('0x4d')](handleError(_0x3d3d5e,null));};exports[_0x6114('0x2c')]=function(_0x26ac6b,_0xee5b8c){return db[_0x6114('0x33')][_0x6114('0x4c')]({'where':{'id':_0x26ac6b['params']['id']}})[_0x6114('0x2b')](handleEntityNotFound(_0xee5b8c,null))[_0x6114('0x2b')](removeEntity(_0xee5b8c,null))['catch'](handleError(_0xee5b8c,null));};exports[_0x6114('0x54')]=function(_0x529677,_0x1c49be,_0x29a4c4){return db[_0x6114('0x33')][_0x6114('0x4c')]({'where':{'id':_0x529677[_0x6114('0x53')]['id']},'attributes':[_0x6114('0x37'),'basename',_0x6114('0x55'),_0x6114('0x56')],'raw':!![]})[_0x6114('0x2b')](handleEntityNotFound(_0x1c49be,null))[_0x6114('0x2b')](function(_0x5d13b5){if(_0x5d13b5){if(!fs[_0x6114('0x57')](path['join'](config[_0x6114('0x58')],'server/files/reports',_0x5d13b5['savename']))){throw new db[(_0x6114('0x59'))]['ValidationError'](_0x6114('0x5a'));}if(_0x529677[_0x6114('0x38')][_0x6114('0x5b')]){return _0x1c49be[_0x6114('0x1d')](0xc8);}return _0x1c49be[_0x6114('0x54')](path[_0x6114('0x5c')](config[_0x6114('0x58')],_0x6114('0x5d'),_0x5d13b5[_0x6114('0x55')]),util[_0x6114('0x5e')](_0x6114('0x5f'),_0x5d13b5['basename']||_0x5d13b5[_0x6114('0x37')],_0x5d13b5[_0x6114('0x56')][_0x6114('0x60')]()));}})[_0x6114('0x4d')](handleError(_0x1c49be,null));}; \ No newline at end of file +var _0x3a5b=['save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0x3a5b,0x165));var _0xb3a5=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0x3a5b[_0x255227];return _0x43a3e4;};'use strict';var emlformat=require(_0xb3a5('0x0'));var rimraf=require(_0xb3a5('0x1'));var zipdir=require(_0xb3a5('0x2'));var jsonpatch=require(_0xb3a5('0x3'));var rp=require(_0xb3a5('0x4'));var moment=require(_0xb3a5('0x5'));var BPromise=require(_0xb3a5('0x6'));var Mustache=require('mustache');var util=require(_0xb3a5('0x7'));var path=require(_0xb3a5('0x8'));var sox=require(_0xb3a5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3a5('0xa'));var _=require('lodash');var squel=require(_0xb3a5('0xb'));var crypto=require(_0xb3a5('0xc'));var jsforce=require(_0xb3a5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb3a5('0xe'));var querystring=require(_0xb3a5('0xf'));var Papa=require(_0xb3a5('0x10'));var Redis=require(_0xb3a5('0x11'));var authService=require(_0xb3a5('0x12'));var qs=require(_0xb3a5('0x13'));var as=require(_0xb3a5('0x14'));var hardwareService=require(_0xb3a5('0x15'));var logger=require('../../config/logger')(_0xb3a5('0x16'));var utils=require(_0xb3a5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb3a5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1822bb,_0x7b2d1a){_0x7b2d1a=_0x7b2d1a||0xcc;return function(_0x272d0b){if(_0x272d0b){return _0x1822bb[_0xb3a5('0x19')](_0x7b2d1a);}return _0x1822bb[_0xb3a5('0x1a')](_0x7b2d1a)[_0xb3a5('0x1b')]();};}function respondWithResult(_0xb1441f,_0x57dab6){_0x57dab6=_0x57dab6||0xc8;return function(_0x1812d8){if(_0x1812d8){return _0xb1441f[_0xb3a5('0x1a')](_0x57dab6)['json'](_0x1812d8);}};}function respondWithFilteredResult(_0xfdc2d0,_0x1dfb05){return function(_0x22da8a){if(_0x22da8a){var _0x157971=typeof _0x1dfb05[_0xb3a5('0x1c')]===_0xb3a5('0x1d')&&typeof _0x1dfb05[_0xb3a5('0x1e')]===_0xb3a5('0x1d');var _0x137f47=_0x22da8a[_0xb3a5('0x1f')];var _0x4c2cbd=_0x157971?0x0:_0x1dfb05['offset'];var _0x5d91df=_0x157971?_0x22da8a[_0xb3a5('0x1f')]:_0x1dfb05[_0xb3a5('0x1c')]+_0x1dfb05[_0xb3a5('0x1e')];var _0x541798;if(_0x5d91df>=_0x137f47){_0x5d91df=_0x137f47;_0x541798=0xc8;}else{_0x541798=0xce;}_0xfdc2d0[_0xb3a5('0x1a')](_0x541798);return _0xfdc2d0['set'](_0xb3a5('0x20'),_0x4c2cbd+'-'+_0x5d91df+'/'+_0x137f47)[_0xb3a5('0x21')](_0x22da8a);}return null;};}function patchUpdates(_0x109637){return function(_0x59762e){try{jsonpatch[_0xb3a5('0x22')](_0x59762e,_0x109637,!![]);}catch(_0x3589cd){return BPromise['reject'](_0x3589cd);}return _0x59762e[_0xb3a5('0x23')]();};}function saveUpdates(_0x58811d,_0xaf21aa){return function(_0x5ddb37){if(_0x5ddb37){return _0x5ddb37[_0xb3a5('0x24')](_0x58811d)[_0xb3a5('0x25')](function(_0x26396b){return _0x26396b;});}return null;};}function removeEntity(_0x46f36e,_0x496055){return function(_0x459902){if(_0x459902){return _0x459902[_0xb3a5('0x26')]()[_0xb3a5('0x25')](function(){var _0x51d7f8=_0x459902['get']({'plain':!![]});var _0x8327ff=_0xb3a5('0x27');return db[_0xb3a5('0x28')][_0xb3a5('0x26')]({'where':{'type':_0x8327ff,'resourceId':_0x51d7f8['id']}})[_0xb3a5('0x25')](function(){return _0x459902;});})[_0xb3a5('0x25')](function(){_0x46f36e['status'](0xcc)[_0xb3a5('0x1b')]();});}};}function handleEntityNotFound(_0x38f214,_0x12390c){return function(_0x3305ae){if(!_0x3305ae){_0x38f214[_0xb3a5('0x19')](0x194);}return _0x3305ae;};}function handleError(_0xd8a87e,_0x4511f7){_0x4511f7=_0x4511f7||0x1f4;return function(_0x41390e){logger[_0xb3a5('0x29')](_0x41390e[_0xb3a5('0x2a')]);if(_0x41390e['name']){delete _0x41390e['name'];}_0xd8a87e[_0xb3a5('0x1a')](_0x4511f7)[_0xb3a5('0x2b')](_0x41390e);};}exports[_0xb3a5('0x2c')]=function(_0x34f7a3,_0x21454e){var _0x67573b={},_0xc9b9a7={},_0x3e63b2={'count':0x0,'rows':[]};var _0x503176=_[_0xb3a5('0x2d')](db[_0xb3a5('0x2e')][_0xb3a5('0x2f')],function(_0x3dc041){return{'name':_0x3dc041[_0xb3a5('0x30')],'type':_0x3dc041['type']['key']};});_0xc9b9a7[_0xb3a5('0x31')]=_[_0xb3a5('0x2d')](_0x503176,_0xb3a5('0x32'));_0xc9b9a7[_0xb3a5('0x33')]=_[_0xb3a5('0x34')](_0x34f7a3[_0xb3a5('0x33')]);_0xc9b9a7[_0xb3a5('0x35')]=_[_0xb3a5('0x36')](_0xc9b9a7[_0xb3a5('0x31')],_0xc9b9a7[_0xb3a5('0x33')]);_0x67573b[_0xb3a5('0x37')]=_['intersection'](_0xc9b9a7['model'],qs[_0xb3a5('0x38')](_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x38')]));_0x67573b[_0xb3a5('0x37')]=_0x67573b[_0xb3a5('0x37')]['length']?_0x67573b[_0xb3a5('0x37')]:_0xc9b9a7[_0xb3a5('0x31')];if(!_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x39')](_0xb3a5('0x3a'))){_0x67573b['limit']=qs[_0xb3a5('0x1e')](_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x1e')]);_0x67573b[_0xb3a5('0x1c')]=qs[_0xb3a5('0x1c')](_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x1c')]);}_0x67573b[_0xb3a5('0x3b')]=qs[_0xb3a5('0x3c')](_0x34f7a3['query'][_0xb3a5('0x3c')]);_0x67573b[_0xb3a5('0x3d')]=qs['filters'](_[_0xb3a5('0x3e')](_0x34f7a3[_0xb3a5('0x33')],_0xc9b9a7['filters']),_0x503176);if(_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x3f')]){_0x67573b[_0xb3a5('0x3d')]=_['merge'](_0x67573b[_0xb3a5('0x3d')],{'$or':_[_0xb3a5('0x2d')](_0x503176,function(_0x59c1ec){if(_0x59c1ec['type']!==_0xb3a5('0x40')){var _0x4f681b={};_0x4f681b[_0x59c1ec[_0xb3a5('0x32')]]={'$like':'%'+_0x34f7a3[_0xb3a5('0x33')][_0xb3a5('0x3f')]+'%'};return _0x4f681b;}})});}_0x67573b=_[_0xb3a5('0x41')]({},_0x67573b,_0x34f7a3[_0xb3a5('0x42')]);var _0x46ff3d={'where':_0x67573b[_0xb3a5('0x3d')]};return db[_0xb3a5('0x2e')][_0xb3a5('0x1f')](_0x46ff3d)['then'](function(_0x5145ca){_0x3e63b2[_0xb3a5('0x1f')]=_0x5145ca;if(_0x34f7a3['query'][_0xb3a5('0x43')]){_0x67573b[_0xb3a5('0x44')]=[{'all':!![]}];}return db[_0xb3a5('0x2e')][_0xb3a5('0x45')](_0x67573b);})[_0xb3a5('0x25')](function(_0x2f5b2a){_0x3e63b2[_0xb3a5('0x46')]=_0x2f5b2a;return _0x3e63b2;})[_0xb3a5('0x25')](respondWithFilteredResult(_0x21454e,_0x67573b))[_0xb3a5('0x47')](handleError(_0x21454e,null));};exports[_0xb3a5('0x48')]=function(_0x1bb335,_0x53792a){var _0x4abd4b={'raw':!![],'where':{'id':_0x1bb335[_0xb3a5('0x49')]['id']}},_0xf6ff97={};_0xf6ff97['model']=_[_0xb3a5('0x34')](db[_0xb3a5('0x2e')][_0xb3a5('0x2f')]);_0xf6ff97[_0xb3a5('0x33')]=_[_0xb3a5('0x34')](_0x1bb335['query']);_0xf6ff97[_0xb3a5('0x35')]=_[_0xb3a5('0x36')](_0xf6ff97[_0xb3a5('0x31')],_0xf6ff97[_0xb3a5('0x33')]);_0x4abd4b[_0xb3a5('0x37')]=_[_0xb3a5('0x36')](_0xf6ff97[_0xb3a5('0x31')],qs[_0xb3a5('0x38')](_0x1bb335[_0xb3a5('0x33')][_0xb3a5('0x38')]));_0x4abd4b[_0xb3a5('0x37')]=_0x4abd4b[_0xb3a5('0x37')][_0xb3a5('0x4a')]?_0x4abd4b[_0xb3a5('0x37')]:_0xf6ff97[_0xb3a5('0x31')];if(_0x1bb335[_0xb3a5('0x33')][_0xb3a5('0x43')]){_0x4abd4b[_0xb3a5('0x44')]=[{'all':!![]}];}_0x4abd4b=_[_0xb3a5('0x41')]({},_0x4abd4b,_0x1bb335[_0xb3a5('0x42')]);return db[_0xb3a5('0x2e')][_0xb3a5('0x4b')](_0x4abd4b)[_0xb3a5('0x25')](handleEntityNotFound(_0x53792a,null))[_0xb3a5('0x25')](respondWithResult(_0x53792a,null))[_0xb3a5('0x47')](handleError(_0x53792a,null));};exports['create']=function(_0x2c5d35,_0x39e109){return db[_0xb3a5('0x2e')][_0xb3a5('0x4c')](_0x2c5d35[_0xb3a5('0x4d')],{})[_0xb3a5('0x25')](function(_0x2e980e){var _0x34fee9=_0x2c5d35['user'][_0xb3a5('0x4e')]({'plain':!![]});if(!_0x34fee9)throw new Error(_0xb3a5('0x4f'));if(_0x34fee9[_0xb3a5('0x50')]===_0xb3a5('0x51')){var _0x37b2a0=_0x2e980e[_0xb3a5('0x4e')]({'plain':!![]});var _0x283a82=_0xb3a5('0x27');return db[_0xb3a5('0x52')][_0xb3a5('0x4b')]({'where':{'name':_0x283a82,'userProfileId':_0x34fee9[_0xb3a5('0x53')]},'raw':!![]})['then'](function(_0x1115ac){if(_0x1115ac&&_0x1115ac[_0xb3a5('0x54')]===0x0){return db['UserProfileResource'][_0xb3a5('0x4c')]({'name':_0x37b2a0[_0xb3a5('0x32')],'resourceId':_0x37b2a0['id'],'type':_0x1115ac['name'],'sectionId':_0x1115ac['id']},{})['then'](function(){return _0x2e980e;});}else{return _0x2e980e;}})[_0xb3a5('0x47')](function(_0x222ef0){logger[_0xb3a5('0x29')](_0xb3a5('0x55'),_0x222ef0);throw _0x222ef0;});}return _0x2e980e;})[_0xb3a5('0x25')](respondWithResult(_0x39e109,0xc9))[_0xb3a5('0x47')](handleError(_0x39e109,null));};exports['update']=function(_0x29aa44,_0x42e2f4){if(_0x29aa44[_0xb3a5('0x4d')]['id']){delete _0x29aa44[_0xb3a5('0x4d')]['id'];}return db[_0xb3a5('0x2e')][_0xb3a5('0x4b')]({'where':{'id':_0x29aa44['params']['id']}})[_0xb3a5('0x25')](handleEntityNotFound(_0x42e2f4,null))[_0xb3a5('0x25')](saveUpdates(_0x29aa44[_0xb3a5('0x4d')],null))[_0xb3a5('0x25')](respondWithResult(_0x42e2f4,null))[_0xb3a5('0x47')](handleError(_0x42e2f4,null));};exports['destroy']=function(_0x48cfd0,_0x1e1e26){return db[_0xb3a5('0x2e')][_0xb3a5('0x4b')]({'where':{'id':_0x48cfd0[_0xb3a5('0x49')]['id']}})[_0xb3a5('0x25')](handleEntityNotFound(_0x1e1e26,null))[_0xb3a5('0x25')](removeEntity(_0x1e1e26,null))[_0xb3a5('0x47')](handleError(_0x1e1e26,null));};exports[_0xb3a5('0x56')]=function(_0x4991df,_0x3fe028,_0x551ad6){return db[_0xb3a5('0x2e')][_0xb3a5('0x4b')]({'where':{'id':_0x4991df[_0xb3a5('0x49')]['id']},'attributes':['name',_0xb3a5('0x57'),_0xb3a5('0x58'),_0xb3a5('0x59')],'raw':!![]})[_0xb3a5('0x25')](handleEntityNotFound(_0x3fe028,null))['then'](function(_0x3a5701){if(_0x3a5701){if(!fs[_0xb3a5('0x5a')](path[_0xb3a5('0x5b')](config[_0xb3a5('0x5c')],_0xb3a5('0x5d'),_0x3a5701[_0xb3a5('0x58')]))){throw new db[(_0xb3a5('0x5e'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x4991df[_0xb3a5('0x33')][_0xb3a5('0x5f')]){return _0x3fe028[_0xb3a5('0x19')](0xc8);}return _0x3fe028[_0xb3a5('0x56')](path[_0xb3a5('0x5b')](config['root'],_0xb3a5('0x5d'),_0x3a5701[_0xb3a5('0x58')]),util['format'](_0xb3a5('0x60'),_0x3a5701['basename']||_0x3a5701['name'],_0x3a5701[_0xb3a5('0x59')][_0xb3a5('0x61')]()));}})[_0xb3a5('0x47')](handleError(_0x3fe028,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9390c50..2d82380 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 _0x092b=['../../config/logger','api','moment','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util'];(function(_0x2c5c9d,_0x40f1ce){var _0x5f179b=function(_0x2a2806){while(--_0x2a2806){_0x2c5c9d['push'](_0x2c5c9d['shift']());}};_0x5f179b(++_0x40f1ce);}(_0x092b,0x198));var _0xb092=function(_0x27ea13,_0x14225e){_0x27ea13=_0x27ea13-0x0;var _0x52e376=_0x092b[_0x27ea13];return _0x52e376;};'use strict';var _=require(_0xb092('0x0'));var util=require(_0xb092('0x1'));var logger=require(_0xb092('0x2'))(_0xb092('0x3'));var moment=require(_0xb092('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb092('0x5'));var config=require('../../config/environment');var attributes=require(_0xb092('0x6'));module[_0xb092('0x7')]=function(_0x4a3385,_0x4502d8){return _0x4a3385[_0xb092('0x8')](_0xb092('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50c5=['rimraf','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x50c5,0x176));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x550c('0x0'));var util=require('util');var logger=require(_0x550c('0x1'))(_0x550c('0x2'));var moment=require(_0x550c('0x3'));var BPromise=require('bluebird');var rp=require(_0x550c('0x4'));var fs=require('fs');var path=require(_0x550c('0x5'));var rimraf=require(_0x550c('0x6'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x1543a0,_0x56feff){return _0x1543a0[_0x550c('0x7')](_0x550c('0x8'),attributes,{'tableName':_0x550c('0x9'),'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 7dd108e..5c41b17 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 _0xa643=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x2feed7,_0x5b6973){var _0x428095=function(_0x4ff82c){while(--_0x4ff82c){_0x2feed7['push'](_0x2feed7['shift']());}};_0x428095(++_0x5b6973);}(_0xa643,0x11c));var _0x3a64=function(_0x597dcb,_0x11e6b1){_0x597dcb=_0x597dcb-0x0;var _0x38ea90=_0xa643[_0x597dcb];return _0x38ea90;};'use strict';var _=require(_0x3a64('0x0'));var util=require(_0x3a64('0x1'));var moment=require('moment');var BPromise=require(_0x3a64('0x2'));var rs=require(_0x3a64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a64('0x4'))['db'];var utils=require(_0x3a64('0x5'));var logger=require(_0x3a64('0x6'))(_0x3a64('0x7'));var config=require('../../config/environment');var jayson=require(_0x3a64('0x8'));var client=jayson[_0x3a64('0x9')][_0x3a64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389fda,_0x5d7b40,_0x313eda){return new BPromise(function(_0x49dd47,_0x360988){return client[_0x3a64('0xb')](_0x389fda,_0x313eda)[_0x3a64('0xc')](function(_0x14352a){logger[_0x3a64('0xd')](_0x3a64('0xe'),_0x5d7b40,_0x3a64('0xf'));logger[_0x3a64('0x10')](_0x3a64('0x11'),_0x5d7b40,_0x3a64('0xf'),JSON[_0x3a64('0x12')](_0x14352a));if(_0x14352a[_0x3a64('0x13')]){if(_0x14352a[_0x3a64('0x13')][_0x3a64('0x14')]===0x1f4){logger[_0x3a64('0x13')](_0x3a64('0xe'),_0x5d7b40,_0x14352a[_0x3a64('0x13')][_0x3a64('0x15')]);return _0x360988(_0x14352a[_0x3a64('0x13')][_0x3a64('0x15')]);}logger[_0x3a64('0x13')](_0x3a64('0xe'),_0x5d7b40,_0x14352a[_0x3a64('0x13')][_0x3a64('0x15')]);return _0x49dd47(_0x14352a[_0x3a64('0x13')][_0x3a64('0x15')]);}else{logger[_0x3a64('0xd')](_0x3a64('0xe'),_0x5d7b40,_0x3a64('0xf'));_0x49dd47(_0x14352a[_0x3a64('0x16')][_0x3a64('0x15')]);}})['catch'](function(_0x2f7133){logger[_0x3a64('0x13')](_0x3a64('0xe'),_0x5d7b40,_0x2f7133);_0x360988(_0x2f7133);});});} \ No newline at end of file +var _0x6af2=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x41078f,_0x3da3c8){var _0x472fe1=function(_0x38fb89){while(--_0x38fb89){_0x41078f['push'](_0x41078f['shift']());}};_0x472fe1(++_0x3da3c8);}(_0x6af2,0x17d));var _0x26af=function(_0x11ea6f,_0x46bb13){_0x11ea6f=_0x11ea6f-0x0;var _0x47eb3f=_0x6af2[_0x11ea6f];return _0x47eb3f;};'use strict';var _=require(_0x26af('0x0'));var util=require(_0x26af('0x1'));var moment=require(_0x26af('0x2'));var BPromise=require(_0x26af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26af('0x4'))['db'];var utils=require(_0x26af('0x5'));var logger=require(_0x26af('0x6'))(_0x26af('0x7'));var config=require(_0x26af('0x8'));var jayson=require(_0x26af('0x9'));var client=jayson['client'][_0x26af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41b1d3,_0x5ddd1c,_0x218611){return new BPromise(function(_0x39680f,_0x462f40){return client[_0x26af('0xb')](_0x41b1d3,_0x218611)['then'](function(_0x11f913){logger['info'](_0x26af('0xc'),_0x5ddd1c,_0x26af('0xd'));logger['debug'](_0x26af('0xe'),_0x5ddd1c,_0x26af('0xd'),JSON[_0x26af('0xf')](_0x11f913));if(_0x11f913[_0x26af('0x10')]){if(_0x11f913[_0x26af('0x10')][_0x26af('0x11')]===0x1f4){logger[_0x26af('0x10')](_0x26af('0xc'),_0x5ddd1c,_0x11f913[_0x26af('0x10')]['message']);return _0x462f40(_0x11f913['error'][_0x26af('0x12')]);}logger[_0x26af('0x10')](_0x26af('0xc'),_0x5ddd1c,_0x11f913['error'][_0x26af('0x12')]);return _0x39680f(_0x11f913[_0x26af('0x10')][_0x26af('0x12')]);}else{logger[_0x26af('0x13')](_0x26af('0xc'),_0x5ddd1c,_0x26af('0xd'));_0x39680f(_0x11f913[_0x26af('0x14')][_0x26af('0x12')]);}})[_0x26af('0x15')](function(_0x5742ea){logger[_0x26af('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5ddd1c,_0x5742ea);_0x462f40(_0x5742ea);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 871f64d..5a9ec2a 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 _0xa864=['./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x291830,_0x386bb0){var _0x4713e2=function(_0x301237){while(--_0x301237){_0x291830['push'](_0x291830['shift']());}};_0x4713e2(++_0x386bb0);}(_0xa864,0xa8));var _0x4a86=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xa864[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x4a86('0x0'));var util=require(_0x4a86('0x1'));var path=require(_0x4a86('0x2'));var timeout=require(_0x4a86('0x3'));var express=require(_0x4a86('0x4'));var router=express['Router']();var fs_extra=require(_0x4a86('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4a86('0x6'));var config=require(_0x4a86('0x7'));var controller=require(_0x4a86('0x8'));router[_0x4a86('0x9')]('/',auth['isAuthenticated'](),controller[_0x4a86('0xa')]);router['get'](_0x4a86('0xb'),auth[_0x4a86('0xc')](),controller[_0x4a86('0xd')]);router[_0x4a86('0x9')](_0x4a86('0xe'),auth['isAuthenticated'](),controller[_0x4a86('0xf')]);router[_0x4a86('0x10')]('/',auth['isAuthenticated'](),controller[_0x4a86('0x11')]);router[_0x4a86('0x12')](_0x4a86('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4a86('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4a86('0x14')]);module[_0x4a86('0x15')]=router; \ No newline at end of file +var _0xe2ed=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','download','post','put','/:id','update','delete','destroy','exports'];(function(_0x584d50,_0x5d9952){var _0x4c662d=function(_0xa2a691){while(--_0xa2a691){_0x584d50['push'](_0x584d50['shift']());}};_0x4c662d(++_0x5d9952);}(_0xe2ed,0xe4));var _0xde2e=function(_0x19ae7f,_0x25368e){_0x19ae7f=_0x19ae7f-0x0;var _0x47c210=_0xe2ed[_0x19ae7f];return _0x47c210;};'use strict';var multer=require('multer');var util=require(_0xde2e('0x0'));var path=require(_0xde2e('0x1'));var timeout=require(_0xde2e('0x2'));var express=require(_0xde2e('0x3'));var router=express[_0xde2e('0x4')]();var fs_extra=require(_0xde2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde2e('0x6'));var config=require(_0xde2e('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xde2e('0x8')]('/',auth[_0xde2e('0x9')](),controller['index']);router[_0xde2e('0x8')]('/:id',auth[_0xde2e('0x9')](),controller[_0xde2e('0xa')]);router[_0xde2e('0x8')]('/:id/download',auth[_0xde2e('0x9')](),controller[_0xde2e('0xb')]);router[_0xde2e('0xc')]('/',auth[_0xde2e('0x9')](),controller['create']);router[_0xde2e('0xd')](_0xde2e('0xe'),auth['isAuthenticated'](),controller[_0xde2e('0xf')]);router[_0xde2e('0x10')](_0xde2e('0xe'),auth['isAuthenticated'](),controller[_0xde2e('0x11')]);module[_0xde2e('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a21c154..872fcd5 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 _0xc637=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0xc637,0x142));var _0x7c63=function(_0x42d0f7,_0x3c1444){_0x42d0f7=_0x42d0f7-0x0;var _0x59ab98=_0xc637[_0x42d0f7];return _0x59ab98;};'use strict';var Sequelize=require(_0x7c63('0x0'));module[_0x7c63('0x1')]={'field':{'type':Sequelize[_0x7c63('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7c63('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x7c63('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7c63('0x3')]},'custom':{'type':Sequelize[_0x7c63('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdba4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4fdd17,_0x1458ab){var _0x2c1b74=function(_0x25a07b){while(--_0x25a07b){_0x4fdd17['push'](_0x4fdd17['shift']());}};_0x2c1b74(++_0x1458ab);}(_0xdba4,0x86));var _0x4dba=function(_0x3e78f4,_0x58f583){_0x3e78f4=_0x3e78f4-0x0;var _0x658828=_0xdba4[_0x3e78f4];return _0x658828;};'use strict';var Sequelize=require(_0x4dba('0x0'));module[_0x4dba('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x4dba('0x2')]},'function':{'type':Sequelize[_0x4dba('0x2')]},'format':{'type':Sequelize[_0x4dba('0x2')]},'groupBy':{'type':Sequelize[_0x4dba('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4dba('0x2')]},'custom':{'type':Sequelize[_0x4dba('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 1e24b22..ab2e02c 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 _0xe6ca=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticFieldReport','includeAll','include','rows','catch','show','params','length','create','body','bulkCreate','find','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch'];(function(_0x5c8297,_0x30283a){var _0x64abb5=function(_0x121621){while(--_0x121621){_0x5c8297['push'](_0x5c8297['shift']());}};_0x64abb5(++_0x30283a);}(_0xe6ca,0xf6));var _0xae6c=function(_0x3d4b25,_0x266b4e){_0x3d4b25=_0x3d4b25-0x0;var _0x479fe6=_0xe6ca[_0x3d4b25];return _0x479fe6;};'use strict';var emlformat=require(_0xae6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae6c('0x1'));var jsonpatch=require(_0xae6c('0x2'));var rp=require('request-promise');var moment=require(_0xae6c('0x3'));var BPromise=require(_0xae6c('0x4'));var Mustache=require(_0xae6c('0x5'));var util=require('util');var path=require(_0xae6c('0x6'));var sox=require(_0xae6c('0x7'));var csv=require(_0xae6c('0x8'));var ejs=require(_0xae6c('0x9'));var fs=require('fs');var fs_extra=require(_0xae6c('0xa'));var _=require('lodash');var squel=require(_0xae6c('0xb'));var crypto=require(_0xae6c('0xc'));var jsforce=require(_0xae6c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xae6c('0xe'));var authService=require(_0xae6c('0xf'));var qs=require(_0xae6c('0x10'));var as=require(_0xae6c('0x11'));var hardwareService=require(_0xae6c('0x12'));var logger=require(_0xae6c('0x13'))(_0xae6c('0x14'));var utils=require(_0xae6c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xae6c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a4fc2,_0x180905){_0x180905=_0x180905||0xcc;return function(_0xe8ffec){if(_0xe8ffec){return _0x1a4fc2[_0xae6c('0x17')](_0x180905);}return _0x1a4fc2[_0xae6c('0x18')](_0x180905)['end']();};}function respondWithResult(_0x3a0d1e,_0xa53e2f){_0xa53e2f=_0xa53e2f||0xc8;return function(_0xfdad00){if(_0xfdad00){return _0x3a0d1e[_0xae6c('0x18')](_0xa53e2f)[_0xae6c('0x19')](_0xfdad00);}};}function respondWithFilteredResult(_0x1b7ace,_0x253b05){return function(_0x48ba6b){if(_0x48ba6b){var _0x5381e4=typeof _0x253b05[_0xae6c('0x1a')]===_0xae6c('0x1b')&&typeof _0x253b05[_0xae6c('0x1c')]===_0xae6c('0x1b');var _0x497f6a=_0x48ba6b['count'];var _0x156f7e=_0x5381e4?0x0:_0x253b05['offset'];var _0x58a7c4=_0x5381e4?_0x48ba6b[_0xae6c('0x1d')]:_0x253b05[_0xae6c('0x1a')]+_0x253b05[_0xae6c('0x1c')];var _0x5607a2;if(_0x58a7c4>=_0x497f6a){_0x58a7c4=_0x497f6a;_0x5607a2=0xc8;}else{_0x5607a2=0xce;}_0x1b7ace['status'](_0x5607a2);return _0x1b7ace[_0xae6c('0x1e')](_0xae6c('0x1f'),_0x156f7e+'-'+_0x58a7c4+'/'+_0x497f6a)[_0xae6c('0x19')](_0x48ba6b);}return null;};}function patchUpdates(_0x24b5ff){return function(_0x4fe9b7){try{jsonpatch[_0xae6c('0x20')](_0x4fe9b7,_0x24b5ff,!![]);}catch(_0x2e0434){return BPromise[_0xae6c('0x21')](_0x2e0434);}return _0x4fe9b7[_0xae6c('0x22')]();};}function saveUpdates(_0x440f4c,_0x1bbcc0){return function(_0x504ef2){if(_0x504ef2){return _0x504ef2[_0xae6c('0x23')](_0x440f4c)['then'](function(_0x3458c1){return _0x3458c1;});}return null;};}function removeEntity(_0xbcecad,_0x2c2123){return function(_0x34f862){if(_0x34f862){return _0x34f862[_0xae6c('0x24')]()[_0xae6c('0x25')](function(){_0xbcecad[_0xae6c('0x18')](0xcc)[_0xae6c('0x26')]();});}};}function handleEntityNotFound(_0x399c5c,_0x1d487c){return function(_0x38004e){if(!_0x38004e){_0x399c5c['sendStatus'](0x194);}return _0x38004e;};}function handleError(_0x37904e,_0x3102c0){_0x3102c0=_0x3102c0||0x1f4;return function(_0x3347e2){logger[_0xae6c('0x27')](_0x3347e2[_0xae6c('0x28')]);if(_0x3347e2[_0xae6c('0x29')]){delete _0x3347e2[_0xae6c('0x29')];}_0x37904e[_0xae6c('0x18')](_0x3102c0)[_0xae6c('0x2a')](_0x3347e2);};}exports[_0xae6c('0x2b')]=function(_0x29dc72,_0x4073cd){var _0x16d929={},_0x2bdf8e={},_0x35f6eb={'count':0x0,'rows':[]};var _0x1aacd7=_['map'](db['AnalyticFieldReport'][_0xae6c('0x2c')],function(_0x590007){return{'name':_0x590007[_0xae6c('0x2d')],'type':_0x590007['type'][_0xae6c('0x2e')]};});_0x2bdf8e[_0xae6c('0x2f')]=_[_0xae6c('0x30')](_0x1aacd7,_0xae6c('0x29'));_0x2bdf8e['query']=_[_0xae6c('0x31')](_0x29dc72['query']);_0x2bdf8e[_0xae6c('0x32')]=_['intersection'](_0x2bdf8e[_0xae6c('0x2f')],_0x2bdf8e[_0xae6c('0x33')]);_0x16d929[_0xae6c('0x34')]=_[_0xae6c('0x35')](_0x2bdf8e[_0xae6c('0x2f')],qs[_0xae6c('0x36')](_0x29dc72[_0xae6c('0x33')]['fields']));_0x16d929[_0xae6c('0x34')]=_0x16d929[_0xae6c('0x34')]['length']?_0x16d929[_0xae6c('0x34')]:_0x2bdf8e[_0xae6c('0x2f')];if(!_0x29dc72[_0xae6c('0x33')]['hasOwnProperty'](_0xae6c('0x37'))){_0x16d929['limit']=qs[_0xae6c('0x1c')](_0x29dc72[_0xae6c('0x33')]['limit']);_0x16d929[_0xae6c('0x1a')]=qs[_0xae6c('0x1a')](_0x29dc72[_0xae6c('0x33')][_0xae6c('0x1a')]);}_0x16d929[_0xae6c('0x38')]=qs[_0xae6c('0x39')](_0x29dc72['query'][_0xae6c('0x39')]);_0x16d929[_0xae6c('0x3a')]=qs['filters'](_[_0xae6c('0x3b')](_0x29dc72['query'],_0x2bdf8e['filters']),_0x1aacd7);if(_0x29dc72[_0xae6c('0x33')][_0xae6c('0x3c')]){_0x16d929[_0xae6c('0x3a')]=_[_0xae6c('0x3d')](_0x16d929[_0xae6c('0x3a')],{'$or':_[_0xae6c('0x30')](_0x1aacd7,function(_0x7fcaa){if(_0x7fcaa[_0xae6c('0x3e')]!==_0xae6c('0x3f')){var _0x24d69a={};_0x24d69a[_0x7fcaa[_0xae6c('0x29')]]={'$like':'%'+_0x29dc72[_0xae6c('0x33')][_0xae6c('0x3c')]+'%'};return _0x24d69a;}})});}_0x16d929=_[_0xae6c('0x3d')]({},_0x16d929,_0x29dc72[_0xae6c('0x40')]);var _0x5a1770={'where':_0x16d929['where']};return db[_0xae6c('0x41')][_0xae6c('0x1d')](_0x5a1770)['then'](function(_0x552a32){_0x35f6eb['count']=_0x552a32;if(_0x29dc72[_0xae6c('0x33')][_0xae6c('0x42')]){_0x16d929[_0xae6c('0x43')]=[{'all':!![]}];}return db[_0xae6c('0x41')]['findAll'](_0x16d929);})[_0xae6c('0x25')](function(_0x384eeb){_0x35f6eb[_0xae6c('0x44')]=_0x384eeb;return _0x35f6eb;})[_0xae6c('0x25')](respondWithFilteredResult(_0x4073cd,_0x16d929))[_0xae6c('0x45')](handleError(_0x4073cd,null));};exports[_0xae6c('0x46')]=function(_0x17b617,_0x29fd9f){var _0x2b1aca={'raw':![],'where':{'id':_0x17b617[_0xae6c('0x47')]['id']}},_0x29b444={};_0x29b444[_0xae6c('0x2f')]=_[_0xae6c('0x31')](db[_0xae6c('0x41')][_0xae6c('0x2c')]);_0x29b444[_0xae6c('0x33')]=_[_0xae6c('0x31')](_0x17b617[_0xae6c('0x33')]);_0x29b444[_0xae6c('0x32')]=_[_0xae6c('0x35')](_0x29b444['model'],_0x29b444['query']);_0x2b1aca[_0xae6c('0x34')]=_[_0xae6c('0x35')](_0x29b444[_0xae6c('0x2f')],qs[_0xae6c('0x36')](_0x17b617[_0xae6c('0x33')]['fields']));_0x2b1aca[_0xae6c('0x34')]=_0x2b1aca[_0xae6c('0x34')][_0xae6c('0x48')]?_0x2b1aca[_0xae6c('0x34')]:_0x29b444['model'];if(_0x17b617[_0xae6c('0x33')]['includeAll']){_0x2b1aca['include']=[{'all':!![]}];}_0x2b1aca=_[_0xae6c('0x3d')]({},_0x2b1aca,_0x17b617['options']);return db[_0xae6c('0x41')]['find'](_0x2b1aca)[_0xae6c('0x25')](handleEntityNotFound(_0x29fd9f,null))['then'](respondWithResult(_0x29fd9f,null))[_0xae6c('0x45')](handleError(_0x29fd9f,null));};exports[_0xae6c('0x49')]=function(_0x4055a7,_0x4d0c87){return db['AnalyticFieldReport'][_0xae6c('0x49')](_0x4055a7[_0xae6c('0x4a')],{})[_0xae6c('0x25')](respondWithResult(_0x4d0c87,0xc9))['catch'](handleError(_0x4d0c87,null));};exports['bulkCreate']=function(_0xdd7e98,_0x3ea60d){return db[_0xae6c('0x41')][_0xae6c('0x4b')](_0xdd7e98[_0xae6c('0x4a')],{'raw':![],'individualHooks':!![]})[_0xae6c('0x25')](respondWithResult(_0x3ea60d,0xc9))['catch'](handleError(_0x3ea60d,null));};exports[_0xae6c('0x23')]=function(_0x3ab1ce,_0x3cb8f3){if(_0x3ab1ce[_0xae6c('0x4a')]['id']){delete _0x3ab1ce[_0xae6c('0x4a')]['id'];}return db[_0xae6c('0x41')][_0xae6c('0x4c')]({'where':{'id':_0x3ab1ce['params']['id']}})['then'](handleEntityNotFound(_0x3cb8f3,null))[_0xae6c('0x25')](saveUpdates(_0x3ab1ce[_0xae6c('0x4a')],null))['then'](respondWithResult(_0x3cb8f3,null))[_0xae6c('0x45')](handleError(_0x3cb8f3,null));};exports['destroy']=function(_0x47f001,_0x195bf0){return db['AnalyticFieldReport'][_0xae6c('0x4c')]({'where':{'id':_0x47f001['params']['id']}})[_0xae6c('0x25')](handleEntityNotFound(_0x195bf0,null))[_0xae6c('0x25')](removeEntity(_0x195bf0,null))[_0xae6c('0x45')](handleError(_0x195bf0,null));};exports['bulkDestroy']=function(_0x3b0ca9,_0x13a97b){return db[_0xae6c('0x41')]['destroy']({'where':{'id':_0x3b0ca9['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xae6c('0x25')](respondWithResult(_0x13a97b,0xcc))[_0xae6c('0x45')](handleError(_0x13a97b,null));};exports[_0xae6c('0x4d')]=function(_0x3ec066,_0x49cc14,_0x332263){return db[_0xae6c('0x4e')]['findOne']({'where':{'id':_0x3ec066[_0xae6c('0x47')]['id']}})[_0xae6c('0x25')](handleEntityNotFound(_0x49cc14,null))[_0xae6c('0x25')](function(_0x57b2c6){if(_0x57b2c6){return db[_0xae6c('0x4f')][_0xae6c('0x50')](function(_0x8e3e33){return db[_0xae6c('0x41')][_0xae6c('0x24')]({'where':{'CustomReportId':_0x3ec066[_0xae6c('0x47')]['id']},'transaction':_0x8e3e33})['then'](function(_0xff55d){var _0x50d2f1=_[_0xae6c('0x30')](_0x3ec066[_0xae6c('0x4a')],function(_0x270ba0){delete _0x270ba0['id'];_0x270ba0[_0xae6c('0x51')]=_0x3ec066[_0xae6c('0x47')]['id'];return _0x270ba0;});return db['AnalyticFieldReport']['bulkCreate'](_0x50d2f1,{'transaction':_0x8e3e33});});})[_0xae6c('0x25')](function(){return db[_0xae6c('0x41')][_0xae6c('0x52')]({'where':{'CustomReportId':_0x3ec066[_0xae6c('0x47')]['id']}});});}})[_0xae6c('0x25')](respondWithResult(_0x49cc14,null))[_0xae6c('0x45')](handleError(_0x49cc14,null));}; \ No newline at end of file +var _0x55fd=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','type','model','query','keys','intersection','attributes','fields'];(function(_0x265f12,_0x1ea58e){var _0x5edadb=function(_0x1532c7){while(--_0x1532c7){_0x265f12['push'](_0x265f12['shift']());}};_0x5edadb(++_0x1ea58e);}(_0x55fd,0xbf));var _0xd55f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x55fd[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd55f('0x0'));var rimraf=require(_0xd55f('0x1'));var zipdir=require(_0xd55f('0x2'));var jsonpatch=require(_0xd55f('0x3'));var rp=require('request-promise');var moment=require(_0xd55f('0x4'));var BPromise=require(_0xd55f('0x5'));var Mustache=require('mustache');var util=require(_0xd55f('0x6'));var path=require('path');var sox=require(_0xd55f('0x7'));var csv=require(_0xd55f('0x8'));var ejs=require(_0xd55f('0x9'));var fs=require('fs');var fs_extra=require(_0xd55f('0xa'));var _=require(_0xd55f('0xb'));var squel=require('squel');var crypto=require(_0xd55f('0xc'));var jsforce=require(_0xd55f('0xd'));var deskjs=require(_0xd55f('0xe'));var toCsv=require(_0xd55f('0x8'));var querystring=require(_0xd55f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd55f('0x10'));var authService=require(_0xd55f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd55f('0x12'));var hardwareService=require(_0xd55f('0x13'));var logger=require(_0xd55f('0x14'))(_0xd55f('0x15'));var utils=require('../../config/utils');var config=require(_0xd55f('0x16'));var licenseUtil=require(_0xd55f('0x17'));var db=require(_0xd55f('0x18'))['db'];function respondWithStatusCode(_0xe89eee,_0x19fd36){_0x19fd36=_0x19fd36||0xcc;return function(_0x5b1a76){if(_0x5b1a76){return _0xe89eee[_0xd55f('0x19')](_0x19fd36);}return _0xe89eee[_0xd55f('0x1a')](_0x19fd36)[_0xd55f('0x1b')]();};}function respondWithResult(_0x5eacba,_0x5d2970){_0x5d2970=_0x5d2970||0xc8;return function(_0x20cc63){if(_0x20cc63){return _0x5eacba['status'](_0x5d2970)['json'](_0x20cc63);}};}function respondWithFilteredResult(_0x3435f4,_0x4e4981){return function(_0x42a5af){if(_0x42a5af){var _0x11862e=typeof _0x4e4981[_0xd55f('0x1c')]==='undefined'&&typeof _0x4e4981[_0xd55f('0x1d')]==='undefined';var _0x24d103=_0x42a5af[_0xd55f('0x1e')];var _0x13ca08=_0x11862e?0x0:_0x4e4981[_0xd55f('0x1c')];var _0x2b0ee5=_0x11862e?_0x42a5af['count']:_0x4e4981[_0xd55f('0x1c')]+_0x4e4981[_0xd55f('0x1d')];var _0x223184;if(_0x2b0ee5>=_0x24d103){_0x2b0ee5=_0x24d103;_0x223184=0xc8;}else{_0x223184=0xce;}_0x3435f4[_0xd55f('0x1a')](_0x223184);return _0x3435f4[_0xd55f('0x1f')]('Content-Range',_0x13ca08+'-'+_0x2b0ee5+'/'+_0x24d103)[_0xd55f('0x20')](_0x42a5af);}return null;};}function patchUpdates(_0x46a929){return function(_0x379527){try{jsonpatch[_0xd55f('0x21')](_0x379527,_0x46a929,!![]);}catch(_0x324a3b){return BPromise[_0xd55f('0x22')](_0x324a3b);}return _0x379527[_0xd55f('0x23')]();};}function saveUpdates(_0x55469e,_0x568ab6){return function(_0x27ee9d){if(_0x27ee9d){return _0x27ee9d[_0xd55f('0x24')](_0x55469e)[_0xd55f('0x25')](function(_0x224de8){return _0x224de8;});}return null;};}function removeEntity(_0x44f496,_0x3807b1){return function(_0x1940e6){if(_0x1940e6){return _0x1940e6[_0xd55f('0x26')]()[_0xd55f('0x25')](function(){_0x44f496[_0xd55f('0x1a')](0xcc)[_0xd55f('0x1b')]();});}};}function handleEntityNotFound(_0x569e8c,_0xa906b){return function(_0x2f68bf){if(!_0x2f68bf){_0x569e8c[_0xd55f('0x19')](0x194);}return _0x2f68bf;};}function handleError(_0x3ffc06,_0x15f4bc){_0x15f4bc=_0x15f4bc||0x1f4;return function(_0x22c1a7){logger[_0xd55f('0x27')](_0x22c1a7[_0xd55f('0x28')]);if(_0x22c1a7['name']){delete _0x22c1a7[_0xd55f('0x29')];}_0x3ffc06[_0xd55f('0x1a')](_0x15f4bc)[_0xd55f('0x2a')](_0x22c1a7);};}exports['index']=function(_0x33b400,_0x16d42f){var _0x41c9b6={},_0x35d7d4={},_0x438397={'count':0x0,'rows':[]};var _0x29b74a=_[_0xd55f('0x2b')](db[_0xd55f('0x2c')]['rawAttributes'],function(_0x5b6451){return{'name':_0x5b6451['fieldName'],'type':_0x5b6451[_0xd55f('0x2d')]['key']};});_0x35d7d4[_0xd55f('0x2e')]=_[_0xd55f('0x2b')](_0x29b74a,_0xd55f('0x29'));_0x35d7d4[_0xd55f('0x2f')]=_[_0xd55f('0x30')](_0x33b400['query']);_0x35d7d4['filters']=_[_0xd55f('0x31')](_0x35d7d4[_0xd55f('0x2e')],_0x35d7d4[_0xd55f('0x2f')]);_0x41c9b6[_0xd55f('0x32')]=_[_0xd55f('0x31')](_0x35d7d4[_0xd55f('0x2e')],qs[_0xd55f('0x33')](_0x33b400[_0xd55f('0x2f')][_0xd55f('0x33')]));_0x41c9b6[_0xd55f('0x32')]=_0x41c9b6[_0xd55f('0x32')]['length']?_0x41c9b6[_0xd55f('0x32')]:_0x35d7d4['model'];if(!_0x33b400[_0xd55f('0x2f')][_0xd55f('0x34')](_0xd55f('0x35'))){_0x41c9b6[_0xd55f('0x1d')]=qs['limit'](_0x33b400[_0xd55f('0x2f')][_0xd55f('0x1d')]);_0x41c9b6[_0xd55f('0x1c')]=qs[_0xd55f('0x1c')](_0x33b400['query'][_0xd55f('0x1c')]);}_0x41c9b6['order']=qs[_0xd55f('0x36')](_0x33b400[_0xd55f('0x2f')][_0xd55f('0x36')]);_0x41c9b6[_0xd55f('0x37')]=qs[_0xd55f('0x38')](_[_0xd55f('0x39')](_0x33b400['query'],_0x35d7d4[_0xd55f('0x38')]),_0x29b74a);if(_0x33b400[_0xd55f('0x2f')][_0xd55f('0x3a')]){_0x41c9b6[_0xd55f('0x37')]=_['merge'](_0x41c9b6['where'],{'$or':_[_0xd55f('0x2b')](_0x29b74a,function(_0x5ba8a1){if(_0x5ba8a1[_0xd55f('0x2d')]!==_0xd55f('0x3b')){var _0x4d244a={};_0x4d244a[_0x5ba8a1[_0xd55f('0x29')]]={'$like':'%'+_0x33b400[_0xd55f('0x2f')][_0xd55f('0x3a')]+'%'};return _0x4d244a;}})});}_0x41c9b6=_[_0xd55f('0x3c')]({},_0x41c9b6,_0x33b400['options']);var _0x4c461c={'where':_0x41c9b6[_0xd55f('0x37')]};return db[_0xd55f('0x2c')][_0xd55f('0x1e')](_0x4c461c)[_0xd55f('0x25')](function(_0x24d5d3){_0x438397[_0xd55f('0x1e')]=_0x24d5d3;if(_0x33b400[_0xd55f('0x2f')][_0xd55f('0x3d')]){_0x41c9b6[_0xd55f('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xd55f('0x3f')](_0x41c9b6);})['then'](function(_0x14d803){_0x438397[_0xd55f('0x40')]=_0x14d803;return _0x438397;})[_0xd55f('0x25')](respondWithFilteredResult(_0x16d42f,_0x41c9b6))[_0xd55f('0x41')](handleError(_0x16d42f,null));};exports[_0xd55f('0x42')]=function(_0x31d57d,_0x16277d){var _0x1105c6={'raw':![],'where':{'id':_0x31d57d[_0xd55f('0x43')]['id']}},_0x9775b9={};_0x9775b9['model']=_[_0xd55f('0x30')](db[_0xd55f('0x2c')]['rawAttributes']);_0x9775b9[_0xd55f('0x2f')]=_['keys'](_0x31d57d[_0xd55f('0x2f')]);_0x9775b9[_0xd55f('0x38')]=_['intersection'](_0x9775b9['model'],_0x9775b9['query']);_0x1105c6[_0xd55f('0x32')]=_[_0xd55f('0x31')](_0x9775b9[_0xd55f('0x2e')],qs[_0xd55f('0x33')](_0x31d57d[_0xd55f('0x2f')][_0xd55f('0x33')]));_0x1105c6['attributes']=_0x1105c6[_0xd55f('0x32')][_0xd55f('0x44')]?_0x1105c6[_0xd55f('0x32')]:_0x9775b9['model'];if(_0x31d57d[_0xd55f('0x2f')][_0xd55f('0x3d')]){_0x1105c6[_0xd55f('0x3e')]=[{'all':!![]}];}_0x1105c6=_[_0xd55f('0x3c')]({},_0x1105c6,_0x31d57d['options']);return db[_0xd55f('0x2c')][_0xd55f('0x45')](_0x1105c6)[_0xd55f('0x25')](handleEntityNotFound(_0x16277d,null))[_0xd55f('0x25')](respondWithResult(_0x16277d,null))[_0xd55f('0x41')](handleError(_0x16277d,null));};exports[_0xd55f('0x46')]=function(_0x42be90,_0x38de65){return db[_0xd55f('0x2c')][_0xd55f('0x46')](_0x42be90[_0xd55f('0x47')],{})[_0xd55f('0x25')](respondWithResult(_0x38de65,0xc9))[_0xd55f('0x41')](handleError(_0x38de65,null));};exports[_0xd55f('0x48')]=function(_0x371f58,_0x8365d1){return db[_0xd55f('0x2c')]['bulkCreate'](_0x371f58[_0xd55f('0x47')],{'raw':![],'individualHooks':!![]})[_0xd55f('0x25')](respondWithResult(_0x8365d1,0xc9))[_0xd55f('0x41')](handleError(_0x8365d1,null));};exports['update']=function(_0x3afc4b,_0x221997){if(_0x3afc4b[_0xd55f('0x47')]['id']){delete _0x3afc4b[_0xd55f('0x47')]['id'];}return db[_0xd55f('0x2c')][_0xd55f('0x45')]({'where':{'id':_0x3afc4b[_0xd55f('0x43')]['id']}})[_0xd55f('0x25')](handleEntityNotFound(_0x221997,null))[_0xd55f('0x25')](saveUpdates(_0x3afc4b['body'],null))['then'](respondWithResult(_0x221997,null))[_0xd55f('0x41')](handleError(_0x221997,null));};exports['destroy']=function(_0x12be97,_0x243f80){return db['AnalyticFieldReport']['find']({'where':{'id':_0x12be97[_0xd55f('0x43')]['id']}})[_0xd55f('0x25')](handleEntityNotFound(_0x243f80,null))['then'](removeEntity(_0x243f80,null))['catch'](handleError(_0x243f80,null));};exports[_0xd55f('0x49')]=function(_0x2c580b,_0x23bf86){return db[_0xd55f('0x2c')][_0xd55f('0x26')]({'where':{'id':_0x2c580b[_0xd55f('0x2f')][_0xd55f('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x23bf86,0xcc))[_0xd55f('0x41')](handleError(_0x23bf86,null));};exports[_0xd55f('0x4b')]=function(_0x584cbd,_0x5a5028,_0x45ea16){return db[_0xd55f('0x4c')][_0xd55f('0x4d')]({'where':{'id':_0x584cbd[_0xd55f('0x43')]['id']}})[_0xd55f('0x25')](handleEntityNotFound(_0x5a5028,null))['then'](function(_0x4553e3){if(_0x4553e3){return db[_0xd55f('0x4e')][_0xd55f('0x4f')](function(_0x37ee32){return db[_0xd55f('0x2c')]['destroy']({'where':{'CustomReportId':_0x584cbd[_0xd55f('0x43')]['id']},'transaction':_0x37ee32})[_0xd55f('0x25')](function(_0x21ff71){var _0x483d15=_[_0xd55f('0x2b')](_0x584cbd[_0xd55f('0x47')],function(_0x1baafb){delete _0x1baafb['id'];_0x1baafb[_0xd55f('0x50')]=_0x584cbd[_0xd55f('0x43')]['id'];return _0x1baafb;});return db['AnalyticFieldReport'][_0xd55f('0x48')](_0x483d15,{'transaction':_0x37ee32});});})[_0xd55f('0x25')](function(){return db[_0xd55f('0x2c')][_0xd55f('0x3f')]({'where':{'CustomReportId':_0x584cbd[_0xd55f('0x43')]['id']}});});}})[_0xd55f('0x25')](respondWithResult(_0x5a5028,null))['catch'](handleError(_0x5a5028,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index dcd0344..04a988e 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 _0xe4f8=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5eee1c,_0x3817d8){var _0x5f2ea1=function(_0x19173b){while(--_0x19173b){_0x5eee1c['push'](_0x5eee1c['shift']());}};_0x5f2ea1(++_0x3817d8);}(_0xe4f8,0x13e));var _0x8e4f=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xe4f8[_0x543242];return _0x4c99b6;};'use strict';var _=require(_0x8e4f('0x0'));var util=require(_0x8e4f('0x1'));var logger=require(_0x8e4f('0x2'))('api');var moment=require(_0x8e4f('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e4f('0x4'));var fs=require('fs');var path=require(_0x8e4f('0x5'));var rimraf=require(_0x8e4f('0x6'));var config=require(_0x8e4f('0x7'));var attributes=require(_0x8e4f('0x8'));module[_0x8e4f('0x9')]=function(_0x10460b,_0x19f128){return _0x10460b[_0x8e4f('0xa')](_0x8e4f('0xb'),attributes,{'tableName':_0x8e4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d38=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','path'];(function(_0x3cb285,_0x345117){var _0x54aedd=function(_0x40acff){while(--_0x40acff){_0x3cb285['push'](_0x3cb285['shift']());}};_0x54aedd(++_0x345117);}(_0x0d38,0x14b));var _0x80d3=function(_0x2c001b,_0x1a06c8){_0x2c001b=_0x2c001b-0x0;var _0x12cb82=_0x0d38[_0x2c001b];return _0x12cb82;};'use strict';var _=require(_0x80d3('0x0'));var util=require('util');var logger=require(_0x80d3('0x1'))('api');var moment=require(_0x80d3('0x2'));var BPromise=require(_0x80d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d3('0x4'));var rimraf=require(_0x80d3('0x5'));var config=require(_0x80d3('0x6'));var attributes=require(_0x80d3('0x7'));module[_0x80d3('0x8')]=function(_0x1f7a78,_0x37d9ab){return _0x1f7a78[_0x80d3('0x9')](_0x80d3('0xa'),attributes,{'tableName':_0x80d3('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 2fc7477..4c745b4 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 _0x7218=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xd9b96b,_0x48ed74){var _0x32dd74=function(_0x1cc53e){while(--_0x1cc53e){_0xd9b96b['push'](_0xd9b96b['shift']());}};_0x32dd74(++_0x48ed74);}(_0x7218,0x196));var _0x8721=function(_0x3a4adc,_0x5bad4a){_0x3a4adc=_0x3a4adc-0x0;var _0x2a6e5f=_0x7218[_0x3a4adc];return _0x2a6e5f;};'use strict';var _=require(_0x8721('0x0'));var util=require('util');var moment=require(_0x8721('0x1'));var BPromise=require(_0x8721('0x2'));var rs=require(_0x8721('0x3'));var fs=require('fs');var Redis=require(_0x8721('0x4'));var db=require(_0x8721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8721('0x6'));var config=require('../../config/environment');var jayson=require(_0x8721('0x7'));var client=jayson['client'][_0x8721('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dcb50,_0x1d7b62,_0x1c9d2d){return new BPromise(function(_0x26782d,_0x58c362){return client[_0x8721('0x9')](_0x2dcb50,_0x1c9d2d)['then'](function(_0x50e3b2){logger[_0x8721('0xa')](_0x8721('0xb'),_0x1d7b62,_0x8721('0xc'));logger[_0x8721('0xd')](_0x8721('0xe'),_0x1d7b62,_0x8721('0xc'),JSON[_0x8721('0xf')](_0x50e3b2));if(_0x50e3b2[_0x8721('0x10')]){if(_0x50e3b2['error'][_0x8721('0x11')]===0x1f4){logger[_0x8721('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d7b62,_0x50e3b2[_0x8721('0x10')][_0x8721('0x12')]);return _0x58c362(_0x50e3b2[_0x8721('0x10')]['message']);}logger[_0x8721('0x10')](_0x8721('0xb'),_0x1d7b62,_0x50e3b2['error'][_0x8721('0x12')]);return _0x26782d(_0x50e3b2[_0x8721('0x10')]['message']);}else{logger['info'](_0x8721('0xb'),_0x1d7b62,'request\x20sent');_0x26782d(_0x50e3b2[_0x8721('0x13')][_0x8721('0x12')]);}})['catch'](function(_0x4de134){logger[_0x8721('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d7b62,_0x4de134);_0x58c362(_0x4de134);});});} \ No newline at end of file +var _0xac79=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment'];(function(_0x3035d8,_0x36cfa5){var _0x4b3653=function(_0x244885){while(--_0x244885){_0x3035d8['push'](_0x3035d8['shift']());}};_0x4b3653(++_0x36cfa5);}(_0xac79,0x1cc));var _0x9ac7=function(_0x74858e,_0x2ce595){_0x74858e=_0x74858e-0x0;var _0x5d66e5=_0xac79[_0x74858e];return _0x5d66e5;};'use strict';var _=require(_0x9ac7('0x0'));var util=require('util');var moment=require(_0x9ac7('0x1'));var BPromise=require(_0x9ac7('0x2'));var rs=require(_0x9ac7('0x3'));var fs=require('fs');var Redis=require(_0x9ac7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ac7('0x5'));var logger=require(_0x9ac7('0x6'))(_0x9ac7('0x7'));var config=require(_0x9ac7('0x8'));var jayson=require(_0x9ac7('0x9'));var client=jayson['client'][_0x9ac7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20ec08,_0x444a34,_0x3db482){return new BPromise(function(_0x244b33,_0x263914){return client['request'](_0x20ec08,_0x3db482)['then'](function(_0x28c3d9){logger[_0x9ac7('0xb')](_0x9ac7('0xc'),_0x444a34,_0x9ac7('0xd'));logger[_0x9ac7('0xe')](_0x9ac7('0xf'),_0x444a34,_0x9ac7('0xd'),JSON[_0x9ac7('0x10')](_0x28c3d9));if(_0x28c3d9[_0x9ac7('0x11')]){if(_0x28c3d9[_0x9ac7('0x11')][_0x9ac7('0x12')]===0x1f4){logger['error'](_0x9ac7('0xc'),_0x444a34,_0x28c3d9[_0x9ac7('0x11')][_0x9ac7('0x13')]);return _0x263914(_0x28c3d9[_0x9ac7('0x11')][_0x9ac7('0x13')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x444a34,_0x28c3d9[_0x9ac7('0x11')][_0x9ac7('0x13')]);return _0x244b33(_0x28c3d9[_0x9ac7('0x11')][_0x9ac7('0x13')]);}else{logger[_0x9ac7('0xb')](_0x9ac7('0xc'),_0x444a34,_0x9ac7('0xd'));_0x244b33(_0x28c3d9[_0x9ac7('0x14')][_0x9ac7('0x13')]);}})['catch'](function(_0x105fa8){logger[_0x9ac7('0x11')](_0x9ac7('0xc'),_0x444a34,_0x105fa8);_0x263914(_0x105fa8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3cd14fd..bea9472 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(_0x48cc28,_0x2d85b3){var _0x5785b1=function(_0x4da4ca){while(--_0x4da4ca){_0x48cc28['push'](_0x48cc28['shift']());}};_0x5785b1(++_0x2d85b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x25339e,_0x41b75e){var _0x40781b=function(_0x5cb6c0){while(--_0x5cb6c0){_0x25339e['push'](_0x25339e['shift']());}};_0x40781b(++_0x41b75e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 dc46995..dbcffdd 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 _0x2fee=['sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2fee,0x11a));var _0xe2fe=function(_0x596f3f,_0x53c5bf){_0x596f3f=_0x596f3f-0x0;var _0x2c1225=_0x2fee[_0x596f3f];return _0x2c1225;};'use strict';var Sequelize=require(_0xe2fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2fe('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe2fe('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xe2fe('0x1')]}}; \ No newline at end of file +var _0x9b00=['sequelize','exports','STRING','TEXT'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x9b00,0xcc));var _0x09b0=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9b00[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x09b0('0x0'));module[_0x09b0('0x1')]={'name':{'type':Sequelize[_0x09b0('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x09b0('0x2')]},'metric':{'type':Sequelize[_0x09b0('0x3')]},'description':{'type':Sequelize[_0x09b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a2dca46..dfe79ca 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2b4f9b,_0x385325){var _0x3edd75=function(_0x5641df){while(--_0x5641df){_0x2b4f9b['push'](_0x2b4f9b['shift']());}};_0x3edd75(++_0x385325);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x00bb[_0xbb091];return _0x467a04;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x277d61,_0xab8c96){var _0x34f6e1=function(_0x2d19b7){while(--_0x2d19b7){_0x277d61['push'](_0x277d61['shift']());}};_0x34f6e1(++_0xab8c96);}(_0x4b84,0x1cc));var _0x44b8=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x4b84[_0xd2d54];return _0x78b113;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4bd5425..9a32424 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 _0xbccd=['lodash','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x29a322,_0x9cbb33){var _0x3c9c66=function(_0x1e6b70){while(--_0x1e6b70){_0x29a322['push'](_0x29a322['shift']());}};_0x3c9c66(++_0x9cbb33);}(_0xbccd,0x1b0));var _0xdbcc=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xbccd[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xdbcc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbcc('0x1'));var moment=require(_0xdbcc('0x2'));var BPromise=require(_0xdbcc('0x3'));var rp=require(_0xdbcc('0x4'));var fs=require('fs');var path=require(_0xdbcc('0x5'));var rimraf=require(_0xdbcc('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbcc('0x7'));module[_0xdbcc('0x8')]=function(_0x9cca7a,_0x2997fd){return _0x9cca7a[_0xdbcc('0x9')](_0xdbcc('0xa'),attributes,{'tableName':_0xdbcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe0=['request-promise','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','util','../../config/logger','api','moment','bluebird'];(function(_0x53abb2,_0x22c789){var _0x3e125d=function(_0x5cc191){while(--_0x5cc191){_0x53abb2['push'](_0x53abb2['shift']());}};_0x3e125d(++_0x22c789);}(_0x4fe0,0x195));var _0x04fe=function(_0x1ef393,_0x2f116a){_0x1ef393=_0x1ef393-0x0;var _0x184806=_0x4fe0[_0x1ef393];return _0x184806;};'use strict';var _=require('lodash');var util=require(_0x04fe('0x0'));var logger=require(_0x04fe('0x1'))(_0x04fe('0x2'));var moment=require(_0x04fe('0x3'));var BPromise=require(_0x04fe('0x4'));var rp=require(_0x04fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04fe('0x6'));var config=require('../../config/environment');var attributes=require(_0x04fe('0x7'));module[_0x04fe('0x8')]=function(_0x1f74fb,_0x33bdfa){return _0x1f74fb['define'](_0x04fe('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index ed0f213..dd13f4e 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 _0x25d4=['client','request','then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30906f,_0x3452df){var _0x59d3db=function(_0x3bb1ff){while(--_0x3bb1ff){_0x30906f['push'](_0x30906f['shift']());}};_0x59d3db(++_0x3452df);}(_0x25d4,0x1af));var _0x425d=function(_0x2b83f7,_0x4a1dc9){_0x2b83f7=_0x2b83f7-0x0;var _0x594ffe=_0x25d4[_0x2b83f7];return _0x594ffe;};'use strict';var _=require('lodash');var util=require(_0x425d('0x0'));var moment=require('moment');var BPromise=require(_0x425d('0x1'));var rs=require(_0x425d('0x2'));var fs=require('fs');var Redis=require(_0x425d('0x3'));var db=require(_0x425d('0x4'))['db'];var utils=require(_0x425d('0x5'));var logger=require(_0x425d('0x6'))(_0x425d('0x7'));var config=require(_0x425d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x425d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158c82,_0x2a9c68,_0x31a27c){return new BPromise(function(_0x4ece84,_0x3271bb){return client[_0x425d('0xa')](_0x158c82,_0x31a27c)[_0x425d('0xb')](function(_0x904156){logger[_0x425d('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x2a9c68,'request\x20sent');logger['debug'](_0x425d('0xd'),_0x2a9c68,_0x425d('0xe'),JSON['stringify'](_0x904156));if(_0x904156[_0x425d('0xf')]){if(_0x904156[_0x425d('0xf')]['code']===0x1f4){logger['error'](_0x425d('0x10'),_0x2a9c68,_0x904156[_0x425d('0xf')][_0x425d('0x11')]);return _0x3271bb(_0x904156[_0x425d('0xf')][_0x425d('0x11')]);}logger[_0x425d('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2a9c68,_0x904156[_0x425d('0xf')][_0x425d('0x11')]);return _0x4ece84(_0x904156[_0x425d('0xf')][_0x425d('0x11')]);}else{logger['info'](_0x425d('0x10'),_0x2a9c68,_0x425d('0xe'));_0x4ece84(_0x904156[_0x425d('0x12')][_0x425d('0x11')]);}})[_0x425d('0x13')](function(_0x462b86){logger[_0x425d('0xf')](_0x425d('0x10'),_0x2a9c68,_0x462b86);_0x3271bb(_0x462b86);});});} \ No newline at end of file +var _0x0d31=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x2158c1,_0x55a29e){var _0x9f3ba3=function(_0x4b4782){while(--_0x4b4782){_0x2158c1['push'](_0x2158c1['shift']());}};_0x9f3ba3(++_0x55a29e);}(_0x0d31,0x123));var _0x10d3=function(_0x540178,_0x1feb3d){_0x540178=_0x540178-0x0;var _0x58a85c=_0x0d31[_0x540178];return _0x58a85c;};'use strict';var _=require(_0x10d3('0x0'));var util=require(_0x10d3('0x1'));var moment=require(_0x10d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x10d3('0x3'));var fs=require('fs');var Redis=require(_0x10d3('0x4'));var db=require(_0x10d3('0x5'))['db'];var utils=require(_0x10d3('0x6'));var logger=require(_0x10d3('0x7'))('rpc');var config=require(_0x10d3('0x8'));var jayson=require(_0x10d3('0x9'));var client=jayson[_0x10d3('0xa')][_0x10d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x462ff1,_0x32ca7b,_0x277929){return new BPromise(function(_0x3b9d6c,_0x4ddc54){return client[_0x10d3('0xc')](_0x462ff1,_0x277929)[_0x10d3('0xd')](function(_0x436f1f){logger[_0x10d3('0xe')](_0x10d3('0xf'),_0x32ca7b,'request\x20sent');logger[_0x10d3('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x32ca7b,_0x10d3('0x11'),JSON[_0x10d3('0x12')](_0x436f1f));if(_0x436f1f['error']){if(_0x436f1f[_0x10d3('0x13')][_0x10d3('0x14')]===0x1f4){logger[_0x10d3('0x13')](_0x10d3('0xf'),_0x32ca7b,_0x436f1f['error'][_0x10d3('0x15')]);return _0x4ddc54(_0x436f1f[_0x10d3('0x13')][_0x10d3('0x15')]);}logger[_0x10d3('0x13')](_0x10d3('0xf'),_0x32ca7b,_0x436f1f[_0x10d3('0x13')][_0x10d3('0x15')]);return _0x3b9d6c(_0x436f1f[_0x10d3('0x13')][_0x10d3('0x15')]);}else{logger[_0x10d3('0xe')](_0x10d3('0xf'),_0x32ca7b,'request\x20sent');_0x3b9d6c(_0x436f1f[_0x10d3('0x16')][_0x10d3('0x15')]);}})[_0x10d3('0x17')](function(_0x4d3103){logger[_0x10d3('0x13')](_0x10d3('0xf'),_0x32ca7b,_0x4d3103);_0x4ddc54(_0x4d3103);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a4a5ce0..a4cc885 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 _0x10af=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','multer','path','connect-timeout'];(function(_0x183c0c,_0x196789){var _0x4ef30d=function(_0x4619a9){while(--_0x4619a9){_0x183c0c['push'](_0x183c0c['shift']());}};_0x4ef30d(++_0x196789);}(_0x10af,0xfc));var _0xf10a=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x10af[_0x576170];return _0x397c70;};'use strict';var multer=require(_0xf10a('0x0'));var util=require('util');var path=require(_0xf10a('0x1'));var timeout=require(_0xf10a('0x2'));var express=require(_0xf10a('0x3'));var router=express[_0xf10a('0x4')]();var fs_extra=require(_0xf10a('0x5'));var auth=require(_0xf10a('0x6'));var interaction=require(_0xf10a('0x7'));var config=require(_0xf10a('0x8'));var controller=require('./analyticMetric.controller');router[_0xf10a('0x9')]('/',auth[_0xf10a('0xa')](),controller['index']);router['get'](_0xf10a('0xb'),auth[_0xf10a('0xa')](),controller[_0xf10a('0xc')]);router[_0xf10a('0xd')]('/',auth['isAuthenticated'](),controller[_0xf10a('0xe')]);router['put'](_0xf10a('0xb'),auth['isAuthenticated'](),controller[_0xf10a('0xf')]);router['delete']('/:id',auth[_0xf10a('0xa')](),controller['destroy']);module[_0xf10a('0x10')]=router; \ No newline at end of file +var _0xf8b2=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get'];(function(_0x2db094,_0x5d54e4){var _0x54b028=function(_0x36417e){while(--_0x36417e){_0x2db094['push'](_0x2db094['shift']());}};_0x54b028(++_0x5d54e4);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x57357b,_0x22d830){_0x57357b=_0x57357b-0x0;var _0x12b8c1=_0xf8b2[_0x57357b];return _0x12b8c1;};'use strict';var multer=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var path=require(_0x2f8b('0x2'));var timeout=require(_0x2f8b('0x3'));var express=require(_0x2f8b('0x4'));var router=express[_0x2f8b('0x5')]();var fs_extra=require(_0x2f8b('0x6'));var auth=require(_0x2f8b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f8b('0x8'));router[_0x2f8b('0x9')]('/',auth[_0x2f8b('0xa')](),controller[_0x2f8b('0xb')]);router[_0x2f8b('0x9')](_0x2f8b('0xc'),auth[_0x2f8b('0xa')](),controller[_0x2f8b('0xd')]);router[_0x2f8b('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f8b('0xf')]);router[_0x2f8b('0x10')](_0x2f8b('0xc'),auth['isAuthenticated'](),controller[_0x2f8b('0x11')]);router[_0x2f8b('0x12')](_0x2f8b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2f8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ab96396..fd9f419 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 _0xa80d=['TEXT','sequelize'];(function(_0x1871fc,_0x20b0bf){var _0x3bee0d=function(_0x58d264){while(--_0x58d264){_0x1871fc['push'](_0x1871fc['shift']());}};_0x3bee0d(++_0x20b0bf);}(_0xa80d,0x125));var _0xda80=function(_0xf783ad,_0x3ceb1a){_0xf783ad=_0xf783ad-0x0;var _0x2c8f48=_0xa80d[_0xf783ad];return _0x2c8f48;};'use strict';var Sequelize=require(_0xda80('0x0'));module['exports']={'tree':{'type':Sequelize[_0xda80('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe04d=['exports','TEXT'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xe04d,0x110));var _0xde04=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0xe04d[_0x589248];return _0x486750;};'use strict';var Sequelize=require('sequelize');module[_0xde04('0x0')]={'tree':{'type':Sequelize[_0xde04('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 0811a38..4a0e05a 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 _0xf358=['catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','end','error','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','then','include','rows'];(function(_0x142085,_0x498be5){var _0x59e983=function(_0x290a38){while(--_0x290a38){_0x142085['push'](_0x142085['shift']());}};_0x59e983(++_0x498be5);}(_0xf358,0xf2));var _0x8f35=function(_0x5cb499,_0x3853ae){_0x5cb499=_0x5cb499-0x0;var _0x43eb5d=_0xf358[_0x5cb499];return _0x43eb5d;};'use strict';var emlformat=require(_0x8f35('0x0'));var rimraf=require(_0x8f35('0x1'));var zipdir=require(_0x8f35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f35('0x3'));var moment=require(_0x8f35('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f35('0x5'));var util=require(_0x8f35('0x6'));var path=require(_0x8f35('0x7'));var sox=require(_0x8f35('0x8'));var csv=require(_0x8f35('0x9'));var ejs=require(_0x8f35('0xa'));var fs=require('fs');var fs_extra=require(_0x8f35('0xb'));var _=require(_0x8f35('0xc'));var squel=require(_0x8f35('0xd'));var crypto=require(_0x8f35('0xe'));var jsforce=require(_0x8f35('0xf'));var deskjs=require(_0x8f35('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f35('0x11'));var Redis=require(_0x8f35('0x12'));var authService=require(_0x8f35('0x13'));var qs=require(_0x8f35('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f35('0x15'));var logger=require(_0x8f35('0x16'))(_0x8f35('0x17'));var utils=require(_0x8f35('0x18'));var config=require(_0x8f35('0x19'));var licenseUtil=require(_0x8f35('0x1a'));var db=require(_0x8f35('0x1b'))['db'];function respondWithStatusCode(_0x2810fb,_0x55e6da){_0x55e6da=_0x55e6da||0xcc;return function(_0x13cdb0){if(_0x13cdb0){return _0x2810fb[_0x8f35('0x1c')](_0x55e6da);}return _0x2810fb[_0x8f35('0x1d')](_0x55e6da)['end']();};}function respondWithResult(_0x2d7e3d,_0x36d5d0){_0x36d5d0=_0x36d5d0||0xc8;return function(_0x219b15){if(_0x219b15){return _0x2d7e3d[_0x8f35('0x1d')](_0x36d5d0)['json'](_0x219b15);}};}function respondWithFilteredResult(_0x3e4d5f,_0x1cf814){return function(_0x15daec){if(_0x15daec){var _0x1746e5=typeof _0x1cf814[_0x8f35('0x1e')]==='undefined'&&typeof _0x1cf814['limit']===_0x8f35('0x1f');var _0xd14107=_0x15daec[_0x8f35('0x20')];var _0x53f3b1=_0x1746e5?0x0:_0x1cf814[_0x8f35('0x1e')];var _0x2007f1=_0x1746e5?_0x15daec['count']:_0x1cf814[_0x8f35('0x1e')]+_0x1cf814['limit'];var _0x5e36a4;if(_0x2007f1>=_0xd14107){_0x2007f1=_0xd14107;_0x5e36a4=0xc8;}else{_0x5e36a4=0xce;}_0x3e4d5f['status'](_0x5e36a4);return _0x3e4d5f[_0x8f35('0x21')](_0x8f35('0x22'),_0x53f3b1+'-'+_0x2007f1+'/'+_0xd14107)[_0x8f35('0x23')](_0x15daec);}return null;};}function patchUpdates(_0x4449c1){return function(_0x2fca6d){try{jsonpatch[_0x8f35('0x24')](_0x2fca6d,_0x4449c1,!![]);}catch(_0x7c7d4){return BPromise[_0x8f35('0x25')](_0x7c7d4);}return _0x2fca6d[_0x8f35('0x26')]();};}function saveUpdates(_0x3502b7,_0x25a78d){return function(_0x37b0e2){if(_0x37b0e2){return _0x37b0e2[_0x8f35('0x27')](_0x3502b7)['then'](function(_0x3c2294){return _0x3c2294;});}return null;};}function removeEntity(_0x1c4bad,_0x462154){return function(_0x537c8d){if(_0x537c8d){return _0x537c8d[_0x8f35('0x28')]()['then'](function(){_0x1c4bad[_0x8f35('0x1d')](0xcc)[_0x8f35('0x29')]();});}};}function handleEntityNotFound(_0xcb54b,_0x30495d){return function(_0x2d47a9){if(!_0x2d47a9){_0xcb54b[_0x8f35('0x1c')](0x194);}return _0x2d47a9;};}function handleError(_0x4b3909,_0x15ba57){_0x15ba57=_0x15ba57||0x1f4;return function(_0x2360df){logger[_0x8f35('0x2a')](_0x2360df['stack']);if(_0x2360df[_0x8f35('0x2b')]){delete _0x2360df[_0x8f35('0x2b')];}_0x4b3909[_0x8f35('0x1d')](_0x15ba57)[_0x8f35('0x2c')](_0x2360df);};}exports[_0x8f35('0x2d')]=function(_0x390376,_0x4a444a){var _0x1b91dc={},_0x2180c1={},_0x4be843={'count':0x0,'rows':[]};var _0x2ab279=_[_0x8f35('0x2e')](db[_0x8f35('0x2f')]['rawAttributes'],function(_0x338f57){return{'name':_0x338f57[_0x8f35('0x30')],'type':_0x338f57[_0x8f35('0x31')][_0x8f35('0x32')]};});_0x2180c1[_0x8f35('0x33')]=_[_0x8f35('0x2e')](_0x2ab279,_0x8f35('0x2b'));_0x2180c1['query']=_[_0x8f35('0x34')](_0x390376[_0x8f35('0x35')]);_0x2180c1['filters']=_[_0x8f35('0x36')](_0x2180c1['model'],_0x2180c1[_0x8f35('0x35')]);_0x1b91dc[_0x8f35('0x37')]=_['intersection'](_0x2180c1[_0x8f35('0x33')],qs[_0x8f35('0x38')](_0x390376[_0x8f35('0x35')]['fields']));_0x1b91dc[_0x8f35('0x37')]=_0x1b91dc[_0x8f35('0x37')][_0x8f35('0x39')]?_0x1b91dc['attributes']:_0x2180c1[_0x8f35('0x33')];if(!_0x390376[_0x8f35('0x35')]['hasOwnProperty']('nolimit')){_0x1b91dc[_0x8f35('0x3a')]=qs[_0x8f35('0x3a')](_0x390376[_0x8f35('0x35')][_0x8f35('0x3a')]);_0x1b91dc[_0x8f35('0x1e')]=qs['offset'](_0x390376[_0x8f35('0x35')]['offset']);}_0x1b91dc[_0x8f35('0x3b')]=qs[_0x8f35('0x3c')](_0x390376[_0x8f35('0x35')][_0x8f35('0x3c')]);_0x1b91dc[_0x8f35('0x3d')]=qs['filters'](_[_0x8f35('0x3e')](_0x390376[_0x8f35('0x35')],_0x2180c1[_0x8f35('0x3f')]),_0x2ab279);if(_0x390376['query'][_0x8f35('0x40')]){_0x1b91dc[_0x8f35('0x3d')]=_[_0x8f35('0x41')](_0x1b91dc['where'],{'$or':_[_0x8f35('0x2e')](_0x2ab279,function(_0x36e732){if(_0x36e732[_0x8f35('0x31')]!==_0x8f35('0x42')){var _0x4673b8={};_0x4673b8[_0x36e732[_0x8f35('0x2b')]]={'$like':'%'+_0x390376[_0x8f35('0x35')][_0x8f35('0x40')]+'%'};return _0x4673b8;}})});}_0x1b91dc=_[_0x8f35('0x41')]({},_0x1b91dc,_0x390376['options']);var _0x3d60d6={'where':_0x1b91dc[_0x8f35('0x3d')]};return db['AnalyticTreeReport']['count'](_0x3d60d6)[_0x8f35('0x43')](function(_0x22bb24){_0x4be843['count']=_0x22bb24;if(_0x390376[_0x8f35('0x35')]['includeAll']){_0x1b91dc[_0x8f35('0x44')]=[{'all':!![]}];}return db[_0x8f35('0x2f')]['findAll'](_0x1b91dc);})[_0x8f35('0x43')](function(_0x123fa5){_0x4be843[_0x8f35('0x45')]=_0x123fa5;return _0x4be843;})['then'](respondWithFilteredResult(_0x4a444a,_0x1b91dc))[_0x8f35('0x46')](handleError(_0x4a444a,null));};exports[_0x8f35('0x47')]=function(_0x498e79,_0x5b6650){var _0xe78fc9={'raw':!![],'where':{'id':_0x498e79[_0x8f35('0x48')]['id']}},_0xd55827={};_0xd55827['model']=_[_0x8f35('0x34')](db[_0x8f35('0x2f')][_0x8f35('0x49')]);_0xd55827[_0x8f35('0x35')]=_[_0x8f35('0x34')](_0x498e79[_0x8f35('0x35')]);_0xd55827[_0x8f35('0x3f')]=_[_0x8f35('0x36')](_0xd55827[_0x8f35('0x33')],_0xd55827['query']);_0xe78fc9[_0x8f35('0x37')]=_['intersection'](_0xd55827[_0x8f35('0x33')],qs[_0x8f35('0x38')](_0x498e79['query'][_0x8f35('0x38')]));_0xe78fc9[_0x8f35('0x37')]=_0xe78fc9['attributes'][_0x8f35('0x39')]?_0xe78fc9[_0x8f35('0x37')]:_0xd55827[_0x8f35('0x33')];if(_0x498e79[_0x8f35('0x35')]['includeAll']){_0xe78fc9[_0x8f35('0x44')]=[{'all':!![]}];}_0xe78fc9=_[_0x8f35('0x41')]({},_0xe78fc9,_0x498e79[_0x8f35('0x4a')]);return db['AnalyticTreeReport'][_0x8f35('0x4b')](_0xe78fc9)[_0x8f35('0x43')](handleEntityNotFound(_0x5b6650,null))[_0x8f35('0x43')](respondWithResult(_0x5b6650,null))['catch'](handleError(_0x5b6650,null));};exports['create']=function(_0x3c73aa,_0x3c3e60){return db[_0x8f35('0x2f')][_0x8f35('0x4c')](_0x3c73aa[_0x8f35('0x4d')],{})[_0x8f35('0x43')](respondWithResult(_0x3c3e60,0xc9))[_0x8f35('0x46')](handleError(_0x3c3e60,null));};exports[_0x8f35('0x27')]=function(_0xfa761b,_0x5c3894){if(_0xfa761b['body']['id']){delete _0xfa761b[_0x8f35('0x4d')]['id'];}return db[_0x8f35('0x2f')][_0x8f35('0x4b')]({'where':{'id':_0xfa761b['params']['id']}})[_0x8f35('0x43')](handleEntityNotFound(_0x5c3894,null))[_0x8f35('0x43')](saveUpdates(_0xfa761b['body'],null))['then'](respondWithResult(_0x5c3894,null))['catch'](handleError(_0x5c3894,null));};exports[_0x8f35('0x28')]=function(_0x3f52d1,_0x257dd8){return db[_0x8f35('0x2f')][_0x8f35('0x4b')]({'where':{'id':_0x3f52d1['params']['id']}})[_0x8f35('0x43')](handleEntityNotFound(_0x257dd8,null))[_0x8f35('0x43')](removeEntity(_0x257dd8,null))[_0x8f35('0x46')](handleError(_0x257dd8,null));}; \ No newline at end of file +var _0x89fb=['filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','AnalyticTreeReport','includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','create','body','update','find','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','reject','then','destroy','stack','name','send','index','map','fieldName','model','query'];(function(_0x1fdec0,_0x22079e){var _0x128a8e=function(_0x4689b4){while(--_0x4689b4){_0x1fdec0['push'](_0x1fdec0['shift']());}};_0x128a8e(++_0x22079e);}(_0x89fb,0x67));var _0xb89f=function(_0x5f5104,_0x439f8a){_0x5f5104=_0x5f5104-0x0;var _0x354601=_0x89fb[_0x5f5104];return _0x354601;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb89f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb89f('0x1'));var rp=require(_0xb89f('0x2'));var moment=require('moment');var BPromise=require(_0xb89f('0x3'));var Mustache=require(_0xb89f('0x4'));var util=require(_0xb89f('0x5'));var path=require(_0xb89f('0x6'));var sox=require(_0xb89f('0x7'));var csv=require(_0xb89f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb89f('0x9'));var _=require(_0xb89f('0xa'));var squel=require(_0xb89f('0xb'));var crypto=require(_0xb89f('0xc'));var jsforce=require(_0xb89f('0xd'));var deskjs=require(_0xb89f('0xe'));var toCsv=require(_0xb89f('0x8'));var querystring=require(_0xb89f('0xf'));var Papa=require(_0xb89f('0x10'));var Redis=require(_0xb89f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb89f('0x12'));var hardwareService=require(_0xb89f('0x13'));var logger=require(_0xb89f('0x14'))(_0xb89f('0x15'));var utils=require(_0xb89f('0x16'));var config=require(_0xb89f('0x17'));var licenseUtil=require(_0xb89f('0x18'));var db=require(_0xb89f('0x19'))['db'];function respondWithStatusCode(_0x1669cb,_0x4c12a4){_0x4c12a4=_0x4c12a4||0xcc;return function(_0xe7296c){if(_0xe7296c){return _0x1669cb[_0xb89f('0x1a')](_0x4c12a4);}return _0x1669cb['status'](_0x4c12a4)[_0xb89f('0x1b')]();};}function respondWithResult(_0x35440a,_0x19f474){_0x19f474=_0x19f474||0xc8;return function(_0x3bac76){if(_0x3bac76){return _0x35440a[_0xb89f('0x1c')](_0x19f474)[_0xb89f('0x1d')](_0x3bac76);}};}function respondWithFilteredResult(_0x971c8d,_0x5e9998){return function(_0x55ec3a){if(_0x55ec3a){var _0x494971=typeof _0x5e9998['offset']===_0xb89f('0x1e')&&typeof _0x5e9998['limit']===_0xb89f('0x1e');var _0x1ef580=_0x55ec3a['count'];var _0x4041e2=_0x494971?0x0:_0x5e9998[_0xb89f('0x1f')];var _0x11aaec=_0x494971?_0x55ec3a[_0xb89f('0x20')]:_0x5e9998[_0xb89f('0x1f')]+_0x5e9998[_0xb89f('0x21')];var _0x37f230;if(_0x11aaec>=_0x1ef580){_0x11aaec=_0x1ef580;_0x37f230=0xc8;}else{_0x37f230=0xce;}_0x971c8d[_0xb89f('0x1c')](_0x37f230);return _0x971c8d[_0xb89f('0x22')](_0xb89f('0x23'),_0x4041e2+'-'+_0x11aaec+'/'+_0x1ef580)[_0xb89f('0x1d')](_0x55ec3a);}return null;};}function patchUpdates(_0x4382b4){return function(_0x4cea6f){try{jsonpatch['apply'](_0x4cea6f,_0x4382b4,!![]);}catch(_0x532b42){return BPromise[_0xb89f('0x24')](_0x532b42);}return _0x4cea6f['save']();};}function saveUpdates(_0x241595,_0x5a313f){return function(_0x528921){if(_0x528921){return _0x528921['update'](_0x241595)[_0xb89f('0x25')](function(_0x4ededb){return _0x4ededb;});}return null;};}function removeEntity(_0x3417bb,_0x13bc78){return function(_0x34aeea){if(_0x34aeea){return _0x34aeea[_0xb89f('0x26')]()[_0xb89f('0x25')](function(){_0x3417bb[_0xb89f('0x1c')](0xcc)[_0xb89f('0x1b')]();});}};}function handleEntityNotFound(_0x4b5c34,_0x1261b1){return function(_0x387fb4){if(!_0x387fb4){_0x4b5c34['sendStatus'](0x194);}return _0x387fb4;};}function handleError(_0x3b6b84,_0x12a2f6){_0x12a2f6=_0x12a2f6||0x1f4;return function(_0x7df877){logger['error'](_0x7df877[_0xb89f('0x27')]);if(_0x7df877[_0xb89f('0x28')]){delete _0x7df877[_0xb89f('0x28')];}_0x3b6b84['status'](_0x12a2f6)[_0xb89f('0x29')](_0x7df877);};}exports[_0xb89f('0x2a')]=function(_0x40e759,_0x34b1d6){var _0x3523ef={},_0x1bf4cf={},_0x378c67={'count':0x0,'rows':[]};var _0x49e952=_[_0xb89f('0x2b')](db['AnalyticTreeReport']['rawAttributes'],function(_0x4ff1a1){return{'name':_0x4ff1a1[_0xb89f('0x2c')],'type':_0x4ff1a1['type']['key']};});_0x1bf4cf[_0xb89f('0x2d')]=_[_0xb89f('0x2b')](_0x49e952,_0xb89f('0x28'));_0x1bf4cf[_0xb89f('0x2e')]=_['keys'](_0x40e759[_0xb89f('0x2e')]);_0x1bf4cf[_0xb89f('0x2f')]=_[_0xb89f('0x30')](_0x1bf4cf[_0xb89f('0x2d')],_0x1bf4cf[_0xb89f('0x2e')]);_0x3523ef['attributes']=_['intersection'](_0x1bf4cf[_0xb89f('0x2d')],qs[_0xb89f('0x31')](_0x40e759['query'][_0xb89f('0x31')]));_0x3523ef[_0xb89f('0x32')]=_0x3523ef[_0xb89f('0x32')][_0xb89f('0x33')]?_0x3523ef[_0xb89f('0x32')]:_0x1bf4cf['model'];if(!_0x40e759['query'][_0xb89f('0x34')]('nolimit')){_0x3523ef['limit']=qs[_0xb89f('0x21')](_0x40e759[_0xb89f('0x2e')][_0xb89f('0x21')]);_0x3523ef[_0xb89f('0x1f')]=qs['offset'](_0x40e759['query'][_0xb89f('0x1f')]);}_0x3523ef[_0xb89f('0x35')]=qs[_0xb89f('0x36')](_0x40e759[_0xb89f('0x2e')][_0xb89f('0x36')]);_0x3523ef['where']=qs[_0xb89f('0x2f')](_[_0xb89f('0x37')](_0x40e759[_0xb89f('0x2e')],_0x1bf4cf[_0xb89f('0x2f')]),_0x49e952);if(_0x40e759[_0xb89f('0x2e')]['filter']){_0x3523ef[_0xb89f('0x38')]=_[_0xb89f('0x39')](_0x3523ef[_0xb89f('0x38')],{'$or':_[_0xb89f('0x2b')](_0x49e952,function(_0x2f23a2){if(_0x2f23a2[_0xb89f('0x3a')]!==_0xb89f('0x3b')){var _0x3b3071={};_0x3b3071[_0x2f23a2[_0xb89f('0x28')]]={'$like':'%'+_0x40e759[_0xb89f('0x2e')][_0xb89f('0x3c')]+'%'};return _0x3b3071;}})});}_0x3523ef=_[_0xb89f('0x39')]({},_0x3523ef,_0x40e759['options']);var _0xb70117={'where':_0x3523ef[_0xb89f('0x38')]};return db[_0xb89f('0x3d')]['count'](_0xb70117)['then'](function(_0x9848cb){_0x378c67[_0xb89f('0x20')]=_0x9848cb;if(_0x40e759[_0xb89f('0x2e')][_0xb89f('0x3e')]){_0x3523ef['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb89f('0x3f')](_0x3523ef);})[_0xb89f('0x25')](function(_0x5a2f0c){_0x378c67['rows']=_0x5a2f0c;return _0x378c67;})['then'](respondWithFilteredResult(_0x34b1d6,_0x3523ef))[_0xb89f('0x40')](handleError(_0x34b1d6,null));};exports[_0xb89f('0x41')]=function(_0x4a65bc,_0x25240e){var _0x55c843={'raw':!![],'where':{'id':_0x4a65bc[_0xb89f('0x42')]['id']}},_0x5849d7={};_0x5849d7[_0xb89f('0x2d')]=_[_0xb89f('0x43')](db[_0xb89f('0x3d')][_0xb89f('0x44')]);_0x5849d7[_0xb89f('0x2e')]=_['keys'](_0x4a65bc[_0xb89f('0x2e')]);_0x5849d7[_0xb89f('0x2f')]=_[_0xb89f('0x30')](_0x5849d7[_0xb89f('0x2d')],_0x5849d7[_0xb89f('0x2e')]);_0x55c843[_0xb89f('0x32')]=_['intersection'](_0x5849d7['model'],qs[_0xb89f('0x31')](_0x4a65bc['query'][_0xb89f('0x31')]));_0x55c843[_0xb89f('0x32')]=_0x55c843[_0xb89f('0x32')][_0xb89f('0x33')]?_0x55c843[_0xb89f('0x32')]:_0x5849d7['model'];if(_0x4a65bc[_0xb89f('0x2e')][_0xb89f('0x3e')]){_0x55c843[_0xb89f('0x45')]=[{'all':!![]}];}_0x55c843=_[_0xb89f('0x39')]({},_0x55c843,_0x4a65bc[_0xb89f('0x46')]);return db[_0xb89f('0x3d')]['find'](_0x55c843)[_0xb89f('0x25')](handleEntityNotFound(_0x25240e,null))[_0xb89f('0x25')](respondWithResult(_0x25240e,null))[_0xb89f('0x40')](handleError(_0x25240e,null));};exports[_0xb89f('0x47')]=function(_0x5716bf,_0x31f8dd){return db[_0xb89f('0x3d')][_0xb89f('0x47')](_0x5716bf[_0xb89f('0x48')],{})['then'](respondWithResult(_0x31f8dd,0xc9))['catch'](handleError(_0x31f8dd,null));};exports[_0xb89f('0x49')]=function(_0x2d143a,_0x1e01c3){if(_0x2d143a[_0xb89f('0x48')]['id']){delete _0x2d143a['body']['id'];}return db[_0xb89f('0x3d')][_0xb89f('0x4a')]({'where':{'id':_0x2d143a[_0xb89f('0x42')]['id']}})[_0xb89f('0x25')](handleEntityNotFound(_0x1e01c3,null))[_0xb89f('0x25')](saveUpdates(_0x2d143a[_0xb89f('0x48')],null))[_0xb89f('0x25')](respondWithResult(_0x1e01c3,null))[_0xb89f('0x40')](handleError(_0x1e01c3,null));};exports[_0xb89f('0x26')]=function(_0x1b3b32,_0x286ca9){return db[_0xb89f('0x3d')][_0xb89f('0x4a')]({'where':{'id':_0x1b3b32[_0xb89f('0x42')]['id']}})[_0xb89f('0x25')](handleEntityNotFound(_0x286ca9,null))[_0xb89f('0x25')](removeEntity(_0x286ca9,null))[_0xb89f('0x40')](handleError(_0x286ca9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4d90df5..04ae37e 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 _0x4ff1=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api'];(function(_0x2f6c0e,_0x36542d){var _0x2c25cf=function(_0x985728){while(--_0x985728){_0x2f6c0e['push'](_0x2f6c0e['shift']());}};_0x2c25cf(++_0x36542d);}(_0x4ff1,0xc0));var _0x14ff=function(_0x50c154,_0x4e08a2){_0x50c154=_0x50c154-0x0;var _0x23aad4=_0x4ff1[_0x50c154];return _0x23aad4;};'use strict';var _=require(_0x14ff('0x0'));var util=require('util');var logger=require(_0x14ff('0x1'))(_0x14ff('0x2'));var moment=require('moment');var BPromise=require(_0x14ff('0x3'));var rp=require(_0x14ff('0x4'));var fs=require('fs');var path=require(_0x14ff('0x5'));var rimraf=require(_0x14ff('0x6'));var config=require(_0x14ff('0x7'));var attributes=require(_0x14ff('0x8'));module[_0x14ff('0x9')]=function(_0x585247,_0x527106){return _0x585247[_0x14ff('0xa')](_0x14ff('0xb'),attributes,{'tableName':_0x14ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc10=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','util','api','moment','bluebird','path'];(function(_0xfbdbd1,_0x2dc9d9){var _0x3e55b7=function(_0x1c569b){while(--_0x1c569b){_0xfbdbd1['push'](_0xfbdbd1['shift']());}};_0x3e55b7(++_0x2dc9d9);}(_0xdc10,0x1a2));var _0x0dc1=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xdc10[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0x0dc1('0x0'));var logger=require('../../config/logger')(_0x0dc1('0x1'));var moment=require(_0x0dc1('0x2'));var BPromise=require(_0x0dc1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dc1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0dc1('0x5'));module[_0x0dc1('0x6')]=function(_0x5313e5,_0x3f5593){return _0x5313e5[_0x0dc1('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0x0dc1('0x8'),'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 57e644c..778ca6b 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(_0x2a960f,_0x5aab73){var _0x5027df=function(_0x13bf75){while(--_0x13bf75){_0x2a960f['push'](_0x2a960f['shift']());}};_0x5027df(++_0x5aab73);}(_0xadb5,0xad));var _0x5adb=function(_0x36cdc4,_0x33d02f){_0x36cdc4=_0x36cdc4-0x0;var _0x576644=_0xadb5[_0x36cdc4];return _0x576644;};'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 _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(_0x5d289a,_0x352880){var _0x14bd5f=function(_0x268766){while(--_0x268766){_0x5d289a['push'](_0x5d289a['shift']());}};_0x14bd5f(++_0x352880);}(_0xadb5,0xad));var _0x5adb=function(_0x418d52,_0x39d811){_0x418d52=_0x418d52-0x0;var _0x807c3f=_0xadb5[_0x418d52];return _0x807c3f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ae16ce4..e151cfa 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 _0x0f33=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x518039,_0x30a583){var _0x2356d9=function(_0x5d177c){while(--_0x5d177c){_0x518039['push'](_0x518039['shift']());}};_0x2356d9(++_0x30a583);}(_0x0f33,0x165));var _0x30f3=function(_0x4fc7a0,_0x461e2b){_0x4fc7a0=_0x4fc7a0-0x0;var _0x43f817=_0x0f33[_0x4fc7a0];return _0x43f817;};'use strict';var multer=require(_0x30f3('0x0'));var util=require(_0x30f3('0x1'));var path=require(_0x30f3('0x2'));var timeout=require(_0x30f3('0x3'));var express=require(_0x30f3('0x4'));var router=express[_0x30f3('0x5')]();var fs_extra=require(_0x30f3('0x6'));var auth=require(_0x30f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x30f3('0x8'));var controller=require(_0x30f3('0x9'));router[_0x30f3('0xa')]('/',auth[_0x30f3('0xb')](),controller[_0x30f3('0xc')]);router[_0x30f3('0xa')](_0x30f3('0xd'),auth['isAuthenticated'](),controller[_0x30f3('0xe')]);router[_0x30f3('0xf')]('/',auth['isAuthenticated'](),controller[_0x30f3('0x10')]);router[_0x30f3('0x11')]('/:id',auth[_0x30f3('0xb')](),controller[_0x30f3('0x12')]);router['delete'](_0x30f3('0xd'),auth[_0x30f3('0xb')](),controller[_0x30f3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1462=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x39539b,_0x4098cf){var _0x46b1c0=function(_0x5bd383){while(--_0x5bd383){_0x39539b['push'](_0x39539b['shift']());}};_0x46b1c0(++_0x4098cf);}(_0x1462,0x89));var _0x2146=function(_0xf715bb,_0x4460b6){_0xf715bb=_0xf715bb-0x0;var _0x5efc3a=_0x1462[_0xf715bb];return _0x5efc3a;};'use strict';var multer=require(_0x2146('0x0'));var util=require(_0x2146('0x1'));var path=require(_0x2146('0x2'));var timeout=require('connect-timeout');var express=require(_0x2146('0x3'));var router=express[_0x2146('0x4')]();var fs_extra=require(_0x2146('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2146('0x6'));var config=require(_0x2146('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x2146('0x8')]('/',auth[_0x2146('0x9')](),controller[_0x2146('0xa')]);router['get'](_0x2146('0xb'),auth[_0x2146('0x9')](),controller[_0x2146('0xc')]);router[_0x2146('0xd')]('/',auth[_0x2146('0x9')](),controller[_0x2146('0xe')]);router[_0x2146('0xf')](_0x2146('0xb'),auth[_0x2146('0x9')](),controller[_0x2146('0x10')]);router[_0x2146('0x11')](_0x2146('0xb'),auth['isAuthenticated'](),controller[_0x2146('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 728ed34..259cd2c 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 _0x9224=['STRING','exports'];(function(_0xe713dd,_0x227171){var _0x5b11fd=function(_0x427e2f){while(--_0x427e2f){_0xe713dd['push'](_0xe713dd['shift']());}};_0x5b11fd(++_0x227171);}(_0x9224,0xa3));var _0x4922=function(_0x276a56,_0x19b880){_0x276a56=_0x276a56-0x0;var _0x39a019=_0x9224[_0x276a56];return _0x39a019;};'use strict';var Sequelize=require('sequelize');module[_0x4922('0x0')]={'name':{'type':Sequelize[_0x4922('0x1')]},'basename':{'type':Sequelize[_0x4922('0x1')]},'type':{'type':Sequelize[_0x4922('0x1')]}}; \ No newline at end of file +var _0xe79a=['STRING'];(function(_0xd6250,_0x215c14){var _0x5dd5f6=function(_0x21383e){while(--_0x21383e){_0xd6250['push'](_0xd6250['shift']());}};_0x5dd5f6(++_0x215c14);}(_0xe79a,0x70));var _0xae79=function(_0xa34fa6,_0x43bff6){_0xa34fa6=_0xa34fa6-0x0;var _0xc3250c=_0xe79a[_0xa34fa6];return _0xc3250c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae79('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xae79('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8eb1ebd..f812539 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 _0x2565=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','Attachment','findAll','rows','catch','show','params','includeAll','include','find','clone','get','omit','createdAt','updatedAt','body','file','originalname','filename','mimetype','create','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2565,0xfb));var _0x5256=function(_0x1034bf,_0x41c314){_0x1034bf=_0x1034bf-0x0;var _0x119b33=_0x2565[_0x1034bf];return _0x119b33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5256('0x0'));var zipdir=require(_0x5256('0x1'));var jsonpatch=require(_0x5256('0x2'));var rp=require(_0x5256('0x3'));var moment=require(_0x5256('0x4'));var BPromise=require(_0x5256('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5256('0x6'));var csv=require('to-csv');var ejs=require(_0x5256('0x7'));var fs=require('fs');var fs_extra=require(_0x5256('0x8'));var _=require('lodash');var squel=require(_0x5256('0x9'));var crypto=require(_0x5256('0xa'));var jsforce=require(_0x5256('0xb'));var deskjs=require(_0x5256('0xc'));var toCsv=require(_0x5256('0xd'));var querystring=require(_0x5256('0xe'));var Papa=require(_0x5256('0xf'));var Redis=require('ioredis');var authService=require(_0x5256('0x10'));var qs=require(_0x5256('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5256('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5256('0x13'));var config=require(_0x5256('0x14'));var licenseUtil=require(_0x5256('0x15'));var db=require(_0x5256('0x16'))['db'];function respondWithStatusCode(_0x14bdf1,_0xa81528){_0xa81528=_0xa81528||0xcc;return function(_0x159a2a){if(_0x159a2a){return _0x14bdf1[_0x5256('0x17')](_0xa81528);}return _0x14bdf1[_0x5256('0x18')](_0xa81528)[_0x5256('0x19')]();};}function respondWithResult(_0x2af4b7,_0x5b6aa7){_0x5b6aa7=_0x5b6aa7||0xc8;return function(_0x564207){if(_0x564207){return _0x2af4b7[_0x5256('0x18')](_0x5b6aa7)[_0x5256('0x1a')](_0x564207);}};}function respondWithFilteredResult(_0x5cbe05,_0x280fe4){return function(_0x57698f){if(_0x57698f){var _0x1d132d=typeof _0x280fe4[_0x5256('0x1b')]===_0x5256('0x1c')&&typeof _0x280fe4[_0x5256('0x1d')]===_0x5256('0x1c');var _0x4fde6c=_0x57698f[_0x5256('0x1e')];var _0x22b795=_0x1d132d?0x0:_0x280fe4[_0x5256('0x1b')];var _0x4e35c8=_0x1d132d?_0x57698f[_0x5256('0x1e')]:_0x280fe4[_0x5256('0x1b')]+_0x280fe4[_0x5256('0x1d')];var _0x206810;if(_0x4e35c8>=_0x4fde6c){_0x4e35c8=_0x4fde6c;_0x206810=0xc8;}else{_0x206810=0xce;}_0x5cbe05['status'](_0x206810);return _0x5cbe05[_0x5256('0x1f')](_0x5256('0x20'),_0x22b795+'-'+_0x4e35c8+'/'+_0x4fde6c)[_0x5256('0x1a')](_0x57698f);}return null;};}function patchUpdates(_0x56b224){return function(_0x1d5ff6){try{jsonpatch[_0x5256('0x21')](_0x1d5ff6,_0x56b224,!![]);}catch(_0x28bdff){return BPromise[_0x5256('0x22')](_0x28bdff);}return _0x1d5ff6[_0x5256('0x23')]();};}function saveUpdates(_0x60e200,_0x4c0e52){return function(_0xaaa0b7){if(_0xaaa0b7){return _0xaaa0b7[_0x5256('0x24')](_0x60e200)['then'](function(_0x5a4144){return _0x5a4144;});}return null;};}function removeEntity(_0x5997e7,_0x12414a){return function(_0x5c280b){if(_0x5c280b){return _0x5c280b[_0x5256('0x25')]()[_0x5256('0x26')](function(){_0x5997e7[_0x5256('0x18')](0xcc)[_0x5256('0x19')]();});}};}function handleEntityNotFound(_0x2a991c,_0xb7eddf){return function(_0x51bd7e){if(!_0x51bd7e){_0x2a991c[_0x5256('0x17')](0x194);}return _0x51bd7e;};}function handleError(_0x58b226,_0x17fdb3){_0x17fdb3=_0x17fdb3||0x1f4;return function(_0xd9790){logger[_0x5256('0x27')](_0xd9790[_0x5256('0x28')]);if(_0xd9790[_0x5256('0x29')]){delete _0xd9790[_0x5256('0x29')];}_0x58b226[_0x5256('0x18')](_0x17fdb3)[_0x5256('0x2a')](_0xd9790);};}exports[_0x5256('0x2b')]=function(_0x145f8c,_0x40e4f4){var _0x143494={},_0x135f5c={},_0x5e7def={'count':0x0,'rows':[]};var _0x48586e=_[_0x5256('0x2c')](db['Attachment'][_0x5256('0x2d')],function(_0xa41bd7){return{'name':_0xa41bd7['fieldName'],'type':_0xa41bd7[_0x5256('0x2e')]['key']};});_0x135f5c[_0x5256('0x2f')]=_[_0x5256('0x2c')](_0x48586e,_0x5256('0x29'));_0x135f5c[_0x5256('0x30')]=_[_0x5256('0x31')](_0x145f8c[_0x5256('0x30')]);_0x135f5c[_0x5256('0x32')]=_[_0x5256('0x33')](_0x135f5c[_0x5256('0x2f')],_0x135f5c['query']);_0x143494['attributes']=_['intersection'](_0x135f5c[_0x5256('0x2f')],qs[_0x5256('0x34')](_0x145f8c[_0x5256('0x30')][_0x5256('0x34')]));_0x143494[_0x5256('0x35')]=_0x143494['attributes'][_0x5256('0x36')]?_0x143494['attributes']:_0x135f5c['model'];if(!_0x145f8c['query'][_0x5256('0x37')](_0x5256('0x38'))){_0x143494[_0x5256('0x1d')]=qs['limit'](_0x145f8c[_0x5256('0x30')][_0x5256('0x1d')]);_0x143494['offset']=qs[_0x5256('0x1b')](_0x145f8c[_0x5256('0x30')]['offset']);}_0x143494['order']=qs['sort'](_0x145f8c[_0x5256('0x30')]['sort']);_0x143494[_0x5256('0x39')]=qs[_0x5256('0x32')](_[_0x5256('0x3a')](_0x145f8c[_0x5256('0x30')],_0x135f5c['filters']),_0x48586e);if(_0x145f8c[_0x5256('0x30')][_0x5256('0x3b')]){_0x143494['where']=_[_0x5256('0x3c')](_0x143494['where'],{'$or':_[_0x5256('0x2c')](_0x48586e,function(_0x547d84){if(_0x547d84[_0x5256('0x2e')]!=='VIRTUAL'){var _0x377360={};_0x377360[_0x547d84[_0x5256('0x29')]]={'$like':'%'+_0x145f8c['query'][_0x5256('0x3b')]+'%'};return _0x377360;}})});}_0x143494=_[_0x5256('0x3c')]({},_0x143494,_0x145f8c[_0x5256('0x3d')]);var _0x25b6fa={'where':_0x143494[_0x5256('0x39')]};return db[_0x5256('0x3e')][_0x5256('0x1e')](_0x25b6fa)[_0x5256('0x26')](function(_0x3749e4){_0x5e7def[_0x5256('0x1e')]=_0x3749e4;if(_0x145f8c[_0x5256('0x30')]['includeAll']){_0x143494['include']=[{'all':!![]}];}return db[_0x5256('0x3e')][_0x5256('0x3f')](_0x143494);})['then'](function(_0x445ca6){_0x5e7def[_0x5256('0x40')]=_0x445ca6;return _0x5e7def;})[_0x5256('0x26')](respondWithFilteredResult(_0x40e4f4,_0x143494))[_0x5256('0x41')](handleError(_0x40e4f4,null));};exports[_0x5256('0x42')]=function(_0x89fe14,_0x16d391){var _0x28a31b={'raw':!![],'where':{'id':_0x89fe14[_0x5256('0x43')]['id']}},_0x2ff681={};_0x2ff681[_0x5256('0x2f')]=_[_0x5256('0x31')](db['Attachment']['rawAttributes']);_0x2ff681['query']=_[_0x5256('0x31')](_0x89fe14[_0x5256('0x30')]);_0x2ff681['filters']=_[_0x5256('0x33')](_0x2ff681['model'],_0x2ff681['query']);_0x28a31b['attributes']=_[_0x5256('0x33')](_0x2ff681[_0x5256('0x2f')],qs[_0x5256('0x34')](_0x89fe14[_0x5256('0x30')][_0x5256('0x34')]));_0x28a31b[_0x5256('0x35')]=_0x28a31b[_0x5256('0x35')][_0x5256('0x36')]?_0x28a31b[_0x5256('0x35')]:_0x2ff681[_0x5256('0x2f')];if(_0x89fe14[_0x5256('0x30')][_0x5256('0x44')]){_0x28a31b[_0x5256('0x45')]=[{'all':!![]}];}_0x28a31b=_[_0x5256('0x3c')]({},_0x28a31b,_0x89fe14['options']);return db['Attachment'][_0x5256('0x46')](_0x28a31b)['then'](handleEntityNotFound(_0x16d391,null))[_0x5256('0x26')](respondWithResult(_0x16d391,null))[_0x5256('0x41')](handleError(_0x16d391,null));};exports[_0x5256('0x47')]=function(_0x14a370,_0x3e2d64){var _0x1edfed={'where':{'id':_0x14a370[_0x5256('0x43')]['id']}},_0x58dee1={};_0x58dee1[_0x5256('0x2f')]=_[_0x5256('0x31')](db[_0x5256('0x3e')][_0x5256('0x2d')]);_0x1edfed[_0x5256('0x35')]=_[_0x5256('0x33')](_0x58dee1[_0x5256('0x2f')],qs['fields'](_0x14a370[_0x5256('0x30')][_0x5256('0x34')]));_0x1edfed['attributes']=_0x1edfed['attributes'][_0x5256('0x36')]?_0x1edfed['attributes']:_0x58dee1[_0x5256('0x2f')];if(_0x14a370['query']['includeAll']){_0x1edfed['include']=[{'all':!![]}];}_0x1edfed=_[_0x5256('0x3c')]({},_0x1edfed,_0x14a370['options']);return db[_0x5256('0x3e')][_0x5256('0x46')](_0x1edfed)[_0x5256('0x26')](handleEntityNotFound(_0x3e2d64,null))['then'](function(_0x368217){if(_0x368217){var _0x55b7fc=_0x368217[_0x5256('0x48')]({'plain':!![]});_0x55b7fc=qs[_0x5256('0x49')](_0x55b7fc,['id',_0x5256('0x4a'),_0x5256('0x4b')]);_0x14a370[_0x5256('0x4c')]=_[_0x5256('0x49')](_0x14a370['body'],['id',_0x5256('0x4a'),'updatedAt']);return db[_0x5256('0x3e')]['create'](_[_0x5256('0x3c')](_0x55b7fc,_0x14a370['body']),{'include':_0x14a370[_0x5256('0x30')][_0x5256('0x44')]?[{'all':!![]}]:undefined});}})[_0x5256('0x26')](respondWithResult(_0x3e2d64,0xc9))['catch'](handleError(_0x3e2d64,null));};exports[_0x5256('0x24')]=function(_0x517e09,_0x401eb0){if(_0x517e09[_0x5256('0x4c')]['id']){delete _0x517e09[_0x5256('0x4c')]['id'];}return db[_0x5256('0x3e')][_0x5256('0x46')]({'where':{'id':_0x517e09[_0x5256('0x43')]['id']}})['then'](handleEntityNotFound(_0x401eb0,null))[_0x5256('0x26')](saveUpdates(_0x517e09[_0x5256('0x4c')],null))[_0x5256('0x26')](respondWithResult(_0x401eb0,null))[_0x5256('0x41')](handleError(_0x401eb0,null));};exports[_0x5256('0x25')]=function(_0x21a181,_0x533e30){return db[_0x5256('0x3e')]['find']({'where':{'id':_0x21a181[_0x5256('0x43')]['id']}})['then'](handleEntityNotFound(_0x533e30,null))[_0x5256('0x26')](removeEntity(_0x533e30,null))[_0x5256('0x41')](handleError(_0x533e30,null));};exports['create']=function(_0x428db3,_0x32a5ee,_0x5e3813){_0x428db3[_0x5256('0x4c')][_0x5256('0x29')]=_0x428db3[_0x5256('0x4d')][_0x5256('0x4e')];_0x428db3[_0x5256('0x4c')]['basename']=_0x428db3[_0x5256('0x4d')][_0x5256('0x4f')];_0x428db3[_0x5256('0x4c')]['type']=_0x428db3[_0x5256('0x4d')][_0x5256('0x50')];return db[_0x5256('0x3e')][_0x5256('0x51')](_0x428db3[_0x5256('0x4c')])[_0x5256('0x26')](respondWithResult(_0x32a5ee,0xc9))['catch'](handleError(_0x32a5ee,null));};exports[_0x5256('0x52')]=function(_0x28e257,_0x585e00,_0x24c3aa){return db['Attachment'][_0x5256('0x53')]({'where':{'id':_0x28e257[_0x5256('0x43')]['id']},'raw':!![]})[_0x5256('0x26')](handleEntityNotFound(_0x585e00,null))[_0x5256('0x26')](function(_0x15fd12){if(_0x15fd12){var _0x321e5e=_0x15fd12[_0x5256('0x54')]!==null;var _0x59300a=path[_0x5256('0x55')](config[_0x5256('0x56')],_0x5256('0x57'));if(_0x321e5e){_0x59300a=path[_0x5256('0x55')](_0x59300a,_0x5256('0x58'));}var _0x9ef2d1=path['join'](_0x59300a,_0x15fd12[_0x5256('0x59')]);return _0x585e00['download'](_0x9ef2d1);}})[_0x5256('0x41')](handleError(_0x585e00,null));}; \ No newline at end of file +var _0x33b0=['limit','count','set','json','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','catch','show','params','find','get','createdAt','updatedAt','body','omit','create','file','originalname','filename','mimetype','download','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x33b0,0xd3));var _0x033b=function(_0x29268c,_0x337d9d){_0x29268c=_0x29268c-0x0;var _0x21929d=_0x33b0[_0x29268c];return _0x21929d;};'use strict';var emlformat=require(_0x033b('0x0'));var rimraf=require(_0x033b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x033b('0x2'));var rp=require('request-promise');var moment=require(_0x033b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x033b('0x4'));var path=require(_0x033b('0x5'));var sox=require(_0x033b('0x6'));var csv=require(_0x033b('0x7'));var ejs=require(_0x033b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x033b('0x9'));var squel=require(_0x033b('0xa'));var crypto=require(_0x033b('0xb'));var jsforce=require(_0x033b('0xc'));var deskjs=require(_0x033b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x033b('0xe'));var Papa=require(_0x033b('0xf'));var Redis=require(_0x033b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x033b('0x11'))(_0x033b('0x12'));var utils=require(_0x033b('0x13'));var config=require(_0x033b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x033b('0x15'))['db'];function respondWithStatusCode(_0x5513f1,_0x4b7014){_0x4b7014=_0x4b7014||0xcc;return function(_0x4dcfa8){if(_0x4dcfa8){return _0x5513f1[_0x033b('0x16')](_0x4b7014);}return _0x5513f1[_0x033b('0x17')](_0x4b7014)['end']();};}function respondWithResult(_0x2d196f,_0x5028de){_0x5028de=_0x5028de||0xc8;return function(_0x2c2a0f){if(_0x2c2a0f){return _0x2d196f[_0x033b('0x17')](_0x5028de)['json'](_0x2c2a0f);}};}function respondWithFilteredResult(_0xf250fa,_0x4e7f9e){return function(_0x4fb084){if(_0x4fb084){var _0x3d9950=typeof _0x4e7f9e[_0x033b('0x18')]===_0x033b('0x19')&&typeof _0x4e7f9e[_0x033b('0x1a')]==='undefined';var _0x3d1d77=_0x4fb084['count'];var _0x1768d9=_0x3d9950?0x0:_0x4e7f9e['offset'];var _0xb0b140=_0x3d9950?_0x4fb084[_0x033b('0x1b')]:_0x4e7f9e['offset']+_0x4e7f9e[_0x033b('0x1a')];var _0x2e0c6a;if(_0xb0b140>=_0x3d1d77){_0xb0b140=_0x3d1d77;_0x2e0c6a=0xc8;}else{_0x2e0c6a=0xce;}_0xf250fa[_0x033b('0x17')](_0x2e0c6a);return _0xf250fa[_0x033b('0x1c')]('Content-Range',_0x1768d9+'-'+_0xb0b140+'/'+_0x3d1d77)[_0x033b('0x1d')](_0x4fb084);}return null;};}function patchUpdates(_0x35bf01){return function(_0x4c5f09){try{jsonpatch['apply'](_0x4c5f09,_0x35bf01,!![]);}catch(_0x2bf783){return BPromise['reject'](_0x2bf783);}return _0x4c5f09['save']();};}function saveUpdates(_0x3aeef3,_0x5b0996){return function(_0x211606){if(_0x211606){return _0x211606[_0x033b('0x1e')](_0x3aeef3)[_0x033b('0x1f')](function(_0x536f16){return _0x536f16;});}return null;};}function removeEntity(_0x425d7a,_0x1caf48){return function(_0x3ae0b9){if(_0x3ae0b9){return _0x3ae0b9[_0x033b('0x20')]()[_0x033b('0x1f')](function(){_0x425d7a[_0x033b('0x17')](0xcc)[_0x033b('0x21')]();});}};}function handleEntityNotFound(_0x517fbe,_0x48ac73){return function(_0x74834){if(!_0x74834){_0x517fbe[_0x033b('0x16')](0x194);}return _0x74834;};}function handleError(_0x4ee836,_0x102460){_0x102460=_0x102460||0x1f4;return function(_0x39cc0a){logger['error'](_0x39cc0a[_0x033b('0x22')]);if(_0x39cc0a[_0x033b('0x23')]){delete _0x39cc0a[_0x033b('0x23')];}_0x4ee836[_0x033b('0x17')](_0x102460)[_0x033b('0x24')](_0x39cc0a);};}exports['index']=function(_0x45b175,_0x202500){var _0x29dcb3={},_0x4c89b7={},_0x2d2fe2={'count':0x0,'rows':[]};var _0x37d4b4=_['map'](db['Attachment'][_0x033b('0x25')],function(_0x8c1388){return{'name':_0x8c1388[_0x033b('0x26')],'type':_0x8c1388[_0x033b('0x27')]['key']};});_0x4c89b7[_0x033b('0x28')]=_[_0x033b('0x29')](_0x37d4b4,'name');_0x4c89b7[_0x033b('0x2a')]=_[_0x033b('0x2b')](_0x45b175[_0x033b('0x2a')]);_0x4c89b7['filters']=_['intersection'](_0x4c89b7[_0x033b('0x28')],_0x4c89b7[_0x033b('0x2a')]);_0x29dcb3['attributes']=_[_0x033b('0x2c')](_0x4c89b7[_0x033b('0x28')],qs[_0x033b('0x2d')](_0x45b175[_0x033b('0x2a')]['fields']));_0x29dcb3[_0x033b('0x2e')]=_0x29dcb3['attributes'][_0x033b('0x2f')]?_0x29dcb3[_0x033b('0x2e')]:_0x4c89b7['model'];if(!_0x45b175['query'][_0x033b('0x30')]('nolimit')){_0x29dcb3[_0x033b('0x1a')]=qs[_0x033b('0x1a')](_0x45b175[_0x033b('0x2a')][_0x033b('0x1a')]);_0x29dcb3['offset']=qs[_0x033b('0x18')](_0x45b175[_0x033b('0x2a')]['offset']);}_0x29dcb3['order']=qs[_0x033b('0x31')](_0x45b175[_0x033b('0x2a')][_0x033b('0x31')]);_0x29dcb3[_0x033b('0x32')]=qs[_0x033b('0x33')](_[_0x033b('0x34')](_0x45b175['query'],_0x4c89b7['filters']),_0x37d4b4);if(_0x45b175[_0x033b('0x2a')][_0x033b('0x35')]){_0x29dcb3['where']=_[_0x033b('0x36')](_0x29dcb3[_0x033b('0x32')],{'$or':_[_0x033b('0x29')](_0x37d4b4,function(_0x49a541){if(_0x49a541[_0x033b('0x27')]!==_0x033b('0x37')){var _0xaaa018={};_0xaaa018[_0x49a541['name']]={'$like':'%'+_0x45b175['query'][_0x033b('0x35')]+'%'};return _0xaaa018;}})});}_0x29dcb3=_[_0x033b('0x36')]({},_0x29dcb3,_0x45b175[_0x033b('0x38')]);var _0x4d92a4={'where':_0x29dcb3[_0x033b('0x32')]};return db[_0x033b('0x39')]['count'](_0x4d92a4)[_0x033b('0x1f')](function(_0x41d294){_0x2d2fe2['count']=_0x41d294;if(_0x45b175[_0x033b('0x2a')][_0x033b('0x3a')]){_0x29dcb3[_0x033b('0x3b')]=[{'all':!![]}];}return db[_0x033b('0x39')]['findAll'](_0x29dcb3);})[_0x033b('0x1f')](function(_0x1f62ae){_0x2d2fe2['rows']=_0x1f62ae;return _0x2d2fe2;})[_0x033b('0x1f')](respondWithFilteredResult(_0x202500,_0x29dcb3))[_0x033b('0x3c')](handleError(_0x202500,null));};exports[_0x033b('0x3d')]=function(_0x2e3928,_0x15f91a){var _0x336afa={'raw':!![],'where':{'id':_0x2e3928[_0x033b('0x3e')]['id']}},_0x19ce03={};_0x19ce03[_0x033b('0x28')]=_['keys'](db[_0x033b('0x39')][_0x033b('0x25')]);_0x19ce03['query']=_[_0x033b('0x2b')](_0x2e3928[_0x033b('0x2a')]);_0x19ce03[_0x033b('0x33')]=_[_0x033b('0x2c')](_0x19ce03[_0x033b('0x28')],_0x19ce03[_0x033b('0x2a')]);_0x336afa['attributes']=_[_0x033b('0x2c')](_0x19ce03['model'],qs[_0x033b('0x2d')](_0x2e3928[_0x033b('0x2a')][_0x033b('0x2d')]));_0x336afa['attributes']=_0x336afa[_0x033b('0x2e')][_0x033b('0x2f')]?_0x336afa[_0x033b('0x2e')]:_0x19ce03['model'];if(_0x2e3928[_0x033b('0x2a')][_0x033b('0x3a')]){_0x336afa[_0x033b('0x3b')]=[{'all':!![]}];}_0x336afa=_[_0x033b('0x36')]({},_0x336afa,_0x2e3928[_0x033b('0x38')]);return db[_0x033b('0x39')]['find'](_0x336afa)[_0x033b('0x1f')](handleEntityNotFound(_0x15f91a,null))[_0x033b('0x1f')](respondWithResult(_0x15f91a,null))[_0x033b('0x3c')](handleError(_0x15f91a,null));};exports['clone']=function(_0x5aa72c,_0x24fdf0){var _0x15b45a={'where':{'id':_0x5aa72c['params']['id']}},_0x28f48a={};_0x28f48a[_0x033b('0x28')]=_['keys'](db[_0x033b('0x39')][_0x033b('0x25')]);_0x15b45a[_0x033b('0x2e')]=_['intersection'](_0x28f48a[_0x033b('0x28')],qs[_0x033b('0x2d')](_0x5aa72c[_0x033b('0x2a')]['fields']));_0x15b45a['attributes']=_0x15b45a['attributes'][_0x033b('0x2f')]?_0x15b45a[_0x033b('0x2e')]:_0x28f48a[_0x033b('0x28')];if(_0x5aa72c[_0x033b('0x2a')][_0x033b('0x3a')]){_0x15b45a[_0x033b('0x3b')]=[{'all':!![]}];}_0x15b45a=_[_0x033b('0x36')]({},_0x15b45a,_0x5aa72c['options']);return db[_0x033b('0x39')][_0x033b('0x3f')](_0x15b45a)[_0x033b('0x1f')](handleEntityNotFound(_0x24fdf0,null))[_0x033b('0x1f')](function(_0x26aa05){if(_0x26aa05){var _0x5f2aee=_0x26aa05[_0x033b('0x40')]({'plain':!![]});_0x5f2aee=qs['omit'](_0x5f2aee,['id',_0x033b('0x41'),_0x033b('0x42')]);_0x5aa72c[_0x033b('0x43')]=_[_0x033b('0x44')](_0x5aa72c[_0x033b('0x43')],['id',_0x033b('0x41'),_0x033b('0x42')]);return db['Attachment'][_0x033b('0x45')](_[_0x033b('0x36')](_0x5f2aee,_0x5aa72c[_0x033b('0x43')]),{'include':_0x5aa72c[_0x033b('0x2a')][_0x033b('0x3a')]?[{'all':!![]}]:undefined});}})[_0x033b('0x1f')](respondWithResult(_0x24fdf0,0xc9))[_0x033b('0x3c')](handleError(_0x24fdf0,null));};exports[_0x033b('0x1e')]=function(_0x2f7c39,_0x4e6927){if(_0x2f7c39[_0x033b('0x43')]['id']){delete _0x2f7c39[_0x033b('0x43')]['id'];}return db[_0x033b('0x39')][_0x033b('0x3f')]({'where':{'id':_0x2f7c39['params']['id']}})[_0x033b('0x1f')](handleEntityNotFound(_0x4e6927,null))[_0x033b('0x1f')](saveUpdates(_0x2f7c39[_0x033b('0x43')],null))['then'](respondWithResult(_0x4e6927,null))[_0x033b('0x3c')](handleError(_0x4e6927,null));};exports[_0x033b('0x20')]=function(_0x4232b0,_0x411590){return db[_0x033b('0x39')][_0x033b('0x3f')]({'where':{'id':_0x4232b0[_0x033b('0x3e')]['id']}})[_0x033b('0x1f')](handleEntityNotFound(_0x411590,null))['then'](removeEntity(_0x411590,null))['catch'](handleError(_0x411590,null));};exports[_0x033b('0x45')]=function(_0x2cc2f5,_0x464439,_0xcdfd4a){_0x2cc2f5['body'][_0x033b('0x23')]=_0x2cc2f5[_0x033b('0x46')][_0x033b('0x47')];_0x2cc2f5[_0x033b('0x43')]['basename']=_0x2cc2f5[_0x033b('0x46')][_0x033b('0x48')];_0x2cc2f5['body']['type']=_0x2cc2f5[_0x033b('0x46')][_0x033b('0x49')];return db[_0x033b('0x39')][_0x033b('0x45')](_0x2cc2f5[_0x033b('0x43')])[_0x033b('0x1f')](respondWithResult(_0x464439,0xc9))['catch'](handleError(_0x464439,null));};exports[_0x033b('0x4a')]=function(_0x5ba316,_0x18c429,_0x29ff9e){return db['Attachment']['findOne']({'where':{'id':_0x5ba316[_0x033b('0x3e')]['id']},'raw':!![]})[_0x033b('0x1f')](handleEntityNotFound(_0x18c429,null))[_0x033b('0x1f')](function(_0x11aba8){if(_0x11aba8){var _0x55011f=_0x11aba8['ChatOfflineMessageId']!==null;var _0x5b0332=path['join'](config[_0x033b('0x4b')],_0x033b('0x4c'));if(_0x55011f){_0x5b0332=path['join'](_0x5b0332,_0x033b('0x4d'));}var _0x238974=path[_0x033b('0x4e')](_0x5b0332,_0x11aba8['basename']);return _0x18c429[_0x033b('0x4a')](_0x238974);}})[_0x033b('0x3c')](handleError(_0x18c429,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 97adc9f..6fe1520 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 _0xb70e=['define','Attachment','attachments','util','moment','request-promise','path','../../config/environment'];(function(_0x5a8a31,_0x14f4ff){var _0x19784c=function(_0x56c34b){while(--_0x56c34b){_0x5a8a31['push'](_0x5a8a31['shift']());}};_0x19784c(++_0x14f4ff);}(_0xb70e,0xe3));var _0xeb70=function(_0x50641e,_0x3bc2fe){_0x50641e=_0x50641e-0x0;var _0x426fa1=_0xb70e[_0x50641e];return _0x426fa1;};'use strict';var _=require('lodash');var util=require(_0xeb70('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xeb70('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb70('0x2'));var fs=require('fs');var path=require(_0xeb70('0x3'));var rimraf=require('rimraf');var config=require(_0xeb70('0x4'));var attributes=require('./attachment.attributes');module['exports']=function(_0x176cc6,_0x24f5d5){return _0x176cc6[_0xeb70('0x5')](_0xeb70('0x6'),attributes,{'tableName':_0xeb70('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5666=['path','rimraf','../../config/environment','./attachment.attributes','Attachment','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x5666,0xec));var _0x6566=function(_0x3698ca,_0x890929){_0x3698ca=_0x3698ca-0x0;var _0x54d0c5=_0x5666[_0x3698ca];return _0x54d0c5;};'use strict';var _=require('lodash');var util=require(_0x6566('0x0'));var logger=require(_0x6566('0x1'))(_0x6566('0x2'));var moment=require(_0x6566('0x3'));var BPromise=require(_0x6566('0x4'));var rp=require(_0x6566('0x5'));var fs=require('fs');var path=require(_0x6566('0x6'));var rimraf=require(_0x6566('0x7'));var config=require(_0x6566('0x8'));var attributes=require(_0x6566('0x9'));module['exports']=function(_0x537c54,_0x5d0519){return _0x537c54['define'](_0x6566('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 63068f1..99dbb5c 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 _0xbb95=['CreateAttachment','stringify','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','body','options','raw'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0xbb95,0x7f));var _0x5bb9=function(_0x2ae8ad,_0x21cbbe){_0x2ae8ad=_0x2ae8ad-0x0;var _0x390b70=_0xbb95[_0x2ae8ad];return _0x390b70;};'use strict';var _=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bb9('0x2'));var fs=require('fs');var Redis=require(_0x5bb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5bb9('0x5'));var client=jayson[_0x5bb9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180e69,_0x123a6a,_0x39f347){return new BPromise(function(_0x5e8b1c,_0x95777c){return client[_0x5bb9('0x7')](_0x180e69,_0x39f347)[_0x5bb9('0x8')](function(_0x267319){logger[_0x5bb9('0x9')](_0x5bb9('0xa'),_0x123a6a,_0x5bb9('0xb'));logger[_0x5bb9('0xc')](_0x5bb9('0xd'),_0x123a6a,_0x5bb9('0xb'),JSON['stringify'](_0x267319));if(_0x267319['error']){if(_0x267319[_0x5bb9('0xe')][_0x5bb9('0xf')]===0x1f4){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x95777c(_0x267319[_0x5bb9('0xe')]['message']);}logger['error'](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x5e8b1c(_0x267319['error'][_0x5bb9('0x10')]);}else{logger[_0x5bb9('0x9')]('Attachment,\x20%s,\x20%s',_0x123a6a,_0x5bb9('0xb'));_0x5e8b1c(_0x267319[_0x5bb9('0x11')][_0x5bb9('0x10')]);}})[_0x5bb9('0x12')](function(_0x119092){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x119092);_0x95777c(_0x119092);});});}exports['CreateAttachment']=function(_0x16b7ab){var _0x56c337=this;return new Promise(function(_0xecb76c,_0x54dcd4){return db[_0x5bb9('0x13')]['create'](_0x16b7ab[_0x5bb9('0x14')],{'raw':_0x16b7ab[_0x5bb9('0x15')]?_0x16b7ab[_0x5bb9('0x15')][_0x5bb9('0x16')]===undefined?!![]:![]:!![]})[_0x5bb9('0x8')](function(_0x2c9b5e){logger[_0x5bb9('0x9')](_0x5bb9('0x17'),_0x16b7ab);logger[_0x5bb9('0xc')]('CreateAttachment',_0x16b7ab,JSON[_0x5bb9('0x18')](_0x2c9b5e));_0xecb76c(_0x2c9b5e);})['catch'](function(_0x1949c1){logger[_0x5bb9('0xe')]('CreateAttachment',_0x1949c1[_0x5bb9('0x10')],_0x16b7ab);_0x54dcd4(_0x56c337[_0x5bb9('0xe')](0x1f4,_0x1949c1['message']));});});}; \ No newline at end of file +var _0x8868=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8868,0x1ca));var _0x8886=function(_0x5415de,_0x53c998){_0x5415de=_0x5415de-0x0;var _0x18f614=_0x8868[_0x5415de];return _0x18f614;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rs=require(_0x8886('0x4'));var fs=require('fs');var Redis=require(_0x8886('0x5'));var db=require(_0x8886('0x6'))['db'];var utils=require(_0x8886('0x7'));var logger=require(_0x8886('0x8'))(_0x8886('0x9'));var config=require(_0x8886('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b94d,_0x5e2a73,_0x1a85e1){return new BPromise(function(_0x56b9fa,_0x147fc9){return client[_0x8886('0xc')](_0x26b94d,_0x1a85e1)[_0x8886('0xd')](function(_0x39036d){logger[_0x8886('0xe')](_0x8886('0xf'),_0x5e2a73,'request\x20sent');logger[_0x8886('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5e2a73,'request\x20sent',JSON[_0x8886('0x11')](_0x39036d));if(_0x39036d['error']){if(_0x39036d[_0x8886('0x12')][_0x8886('0x13')]===0x1f4){logger[_0x8886('0x12')](_0x8886('0xf'),_0x5e2a73,_0x39036d['error'][_0x8886('0x14')]);return _0x147fc9(_0x39036d[_0x8886('0x12')]['message']);}logger[_0x8886('0x12')]('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);return _0x56b9fa(_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x8886('0x15'));_0x56b9fa(_0x39036d[_0x8886('0x16')]['message']);}})['catch'](function(_0x563a82){logger['error'](_0x8886('0xf'),_0x5e2a73,_0x563a82);_0x147fc9(_0x563a82);});});}exports[_0x8886('0x17')]=function(_0x1d47a6){var _0x5504ab=this;return new Promise(function(_0xb13c62,_0x20072e){return db[_0x8886('0x18')][_0x8886('0x19')](_0x1d47a6[_0x8886('0x1a')],{'raw':_0x1d47a6[_0x8886('0x1b')]?_0x1d47a6[_0x8886('0x1b')][_0x8886('0x1c')]===undefined?!![]:![]:!![]})[_0x8886('0xd')](function(_0x19f0ef){logger['info'](_0x8886('0x17'),_0x1d47a6);logger['debug'](_0x8886('0x17'),_0x1d47a6,JSON[_0x8886('0x11')](_0x19f0ef));_0xb13c62(_0x19f0ef);})['catch'](function(_0x3894a0){logger[_0x8886('0x12')](_0x8886('0x17'),_0x3894a0[_0x8886('0x14')],_0x1d47a6);_0x20072e(_0x5504ab[_0x8886('0x12')](0x1f4,_0x3894a0[_0x8886('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4937dd9..33720be 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x390604,_0x37c2a9){_0x390604=_0x390604-0x0;var _0x5315b9=_0xdb28[_0x390604];return _0x5315b9;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x2fa8c4,_0x17f68b){var _0x55a9c6=function(_0x115a06){while(--_0x115a06){_0x2fa8c4['push'](_0x2fa8c4['shift']());}};_0x55a9c6(++_0x17f68b);}(_0x757a,0xde));var _0xa757=function(_0xf2d72d,_0x53c9be){_0xf2d72d=_0xf2d72d-0x0;var _0x48edc5=_0x757a[_0xf2d72d];return _0x48edc5;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5500833..6e5461e 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 _0xd1bb=['adSsoEnabled','name','password','role','blocked','online','admin','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','then','status','message','login','json','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xd1bb,0x141));var _0xbd1b=function(_0x2c73de,_0x5ed4a9){_0x2c73de=_0x2c73de-0x0;var _0x4a6aef=_0xd1bb[_0x2c73de];return _0x4a6aef;};'use strict';var passport=require(_0xbd1b('0x0'));var LocalStrategy=require(_0xbd1b('0x1'))[_0xbd1b('0x2')];var moment=require(_0xbd1b('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xbd1b('0x4'));var util=require(_0xbd1b('0x5'));var db=require(_0xbd1b('0x6'))['db'];var authService=require(_0xbd1b('0x7'));var utils=require(_0xbd1b('0x8'));var config=require(_0xbd1b('0x9'));var logger=require(_0xbd1b('0xa'))(_0xbd1b('0xb'));function isActiveDirectoryConfigured(_0x3ac295){var _0x172117=![];if(typeof _0x3ac295[_0xbd1b('0xc')]!==_0xbd1b('0xd')){_0x172117=_0x3ac295[_0xbd1b('0xc')]['baseDN']&&_0x3ac295['activedirectory'][_0xbd1b('0xe')]&&_0x3ac295[_0xbd1b('0xc')][_0xbd1b('0xf')];}return _0x172117;}function adAuthenticate(_0x164415,_0x4583b5,_0x3c0332){return new BPromise(function(_0x1a855c,_0x194bd8){try{var _0x3bd445=new ActiveDirectory(_0x164415);_0x3bd445[_0xbd1b('0x10')](_0x4583b5,_0x3c0332,function(_0x173d3d,_0x425924){if(_0x173d3d){logger[_0xbd1b('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x4583b5,util['inspect'](_0x173d3d,{'showHidden':![],'depth':null}));_0x194bd8(_0xbd1b('0x12'));}else if(!_0x425924){logger[_0xbd1b('0x11')](_0xbd1b('0x13'),_0x4583b5);_0x194bd8(_0xbd1b('0x12'));}else{_0x1a855c(_0x425924);}});}catch(_0x1b39c4){_0x194bd8(_0x1b39c4);}});}function ActiveDirectoryAuthenticate(_0x3c7ff4,_0x3d5087,_0x43f0e4,_0x122ef1){var _0x2de427,_0x95fe10;if(!isActiveDirectoryConfigured(config)){logger[_0xbd1b('0x11')](_0xbd1b('0x14'),_0x3d5087);return _0x122ef1(null,![],{'message':_0xbd1b('0x12')});}return db[_0xbd1b('0x15')][_0xbd1b('0x16')]({'where':{'id':0x1},'attributes':[_0xbd1b('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x47ad5b){_0x2de427=_0x47ad5b;if(!_0x2de427[_0xbd1b('0x17')]){logger[_0xbd1b('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3d5087);throw new Error(_0xbd1b('0x12'));}return _0x3c7ff4[_0xbd1b('0x16')]({'attributes':['id',_0xbd1b('0x18'),_0xbd1b('0x19'),'salt',_0xbd1b('0x1a'),'disabled',_0xbd1b('0x1b'),'blockedAt',_0xbd1b('0x1c')],'where':{'name':_0x3d5087,'role':{'$or':[_0xbd1b('0x1d'),'user','agent']},'adSsoEnabled':!![]}});})['then'](function(_0x4a098b){if(!_0x4a098b||_0x4a098b&&_0x4a098b[_0xbd1b('0x18')]!==_0x3d5087){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x95fe10=_0x4a098b;var _0xaccea6=_0x95fe10[_0xbd1b('0x18')]+'@'+config['activedirectory'][_0xbd1b('0xf')];return adAuthenticate(config['activedirectory'],_0xaccea6,_0x43f0e4);})['then'](function(_0x49e76e){if(_0x95fe10['disabled']){throw new Error(_0xbd1b('0x12'));}if(_0x2de427[_0xbd1b('0x1e')]>0x0){if(_0x95fe10[_0xbd1b('0x1b')]){if(moment(_0x95fe10[_0xbd1b('0x1f')])[_0xbd1b('0x20')](_0x2de427[_0xbd1b('0x1e')],_0xbd1b('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xbd1b('0x22')](_0x95fe10,0x0,![],null)['then'](function(){return utils[_0xbd1b('0x23')](_0x95fe10);})[_0xbd1b('0x24')](function(){return _0x122ef1(null,_0x95fe10);});}else{return utils[_0xbd1b('0x23')](_0x95fe10)[_0xbd1b('0x24')](function(){return _0x122ef1(null,_0x95fe10);});}}else{return utils[_0xbd1b('0x23')](_0x95fe10)[_0xbd1b('0x24')](function(){return _0x122ef1(null,_0x95fe10);});}})['catch'](function(_0x502d57){return _0x122ef1(null,![],_0x502d57);});}function handleError(_0x4ee083,_0x593ecf,_0x2f1fbf){return _0x4ee083[_0xbd1b('0x25')](_0x593ecf||0x1f4)['send']({'message':_0x2f1fbf?_0x2f1fbf[_0xbd1b('0x26')]||_0x2f1fbf:''});}exports[_0xbd1b('0x27')]=function(_0xf5e8be,_0x1b77d7,_0x15e710){passport[_0xbd1b('0x10')]('ad-login',function(_0x43b5a7,_0x3e493b,_0x35b11c){var _0x439bb7=_0x43b5a7||_0x35b11c;if(_0x439bb7){return handleError(_0x1b77d7,0x191,_0x439bb7);}if(!_0x3e493b){return handleError(_0x1b77d7,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xcdfda={'payload':{'id':_0x3e493b['id'],'role':_0x3e493b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xcdfda)['then'](function(_0x1686eb){_0x1b77d7[_0xbd1b('0x28')]({'id':_0x3e493b['id'],'token':_0x1686eb,'statusCall':'','isAlreadyLogged':_0x3e493b[_0xbd1b('0x1c')]});});}})(_0xf5e8be,_0x1b77d7,_0x15e710);};passport[_0xbd1b('0x29')]('ad-login',new LocalStrategy({'usernameField':_0xbd1b('0x18'),'passwordField':_0xbd1b('0x19')},function(_0x4359ed,_0x46ecaa,_0x490d96){return ActiveDirectoryAuthenticate(db[_0xbd1b('0x2a')],_0x4359ed,_0x46ecaa,_0x490d96);})); \ No newline at end of file +var _0x2ec9=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','domain','add','clearBlockUser','getLicense','catch','status','message','login','ad-login','use','User','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/logger','activedirectory','undefined','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials'];(function(_0x162461,_0x31a46a){var _0x38afbf=function(_0x24a525){while(--_0x24a525){_0x162461['push'](_0x162461['shift']());}};_0x38afbf(++_0x31a46a);}(_0x2ec9,0x9f));var _0x92ec=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2ec9[_0xb0f7c3];return _0x28ea68;};'use strict';var passport=require(_0x92ec('0x0'));var LocalStrategy=require('passport-local')[_0x92ec('0x1')];var moment=require(_0x92ec('0x2'));var ActiveDirectory=require(_0x92ec('0x3'));var BPromise=require(_0x92ec('0x4'));var util=require(_0x92ec('0x5'));var db=require(_0x92ec('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x92ec('0x7'));var config=require('../../config/environment');var logger=require(_0x92ec('0x8'))('api');function isActiveDirectoryConfigured(_0x23dd3b){var _0x4332fa=![];if(typeof _0x23dd3b[_0x92ec('0x9')]!==_0x92ec('0xa')){_0x4332fa=_0x23dd3b[_0x92ec('0x9')]['baseDN']&&_0x23dd3b['activedirectory'][_0x92ec('0xb')]&&_0x23dd3b[_0x92ec('0x9')]['domain'];}return _0x4332fa;}function adAuthenticate(_0x5d9470,_0x3b36ce,_0x37abe7){return new BPromise(function(_0x5095c4,_0x357aa7){try{var _0x3a9090=new ActiveDirectory(_0x5d9470);_0x3a9090[_0x92ec('0xc')](_0x3b36ce,_0x37abe7,function(_0x3701fc,_0x2db8da){if(_0x3701fc){logger[_0x92ec('0xd')](_0x92ec('0xe'),_0x3b36ce,util['inspect'](_0x3701fc,{'showHidden':![],'depth':null}));_0x357aa7(_0x92ec('0xf'));}else if(!_0x2db8da){logger[_0x92ec('0xd')](_0x92ec('0x10'),_0x3b36ce);_0x357aa7(_0x92ec('0xf'));}else{_0x5095c4(_0x2db8da);}});}catch(_0x53d85a){_0x357aa7(_0x53d85a);}});}function ActiveDirectoryAuthenticate(_0x415abe,_0x1713a4,_0x4dd772,_0x5600a6){var _0x208e30,_0x16f95a;if(!isActiveDirectoryConfigured(config)){logger[_0x92ec('0xd')](_0x92ec('0x11'),_0x1713a4);return _0x5600a6(null,![],{'message':_0x92ec('0xf')});}return db['Setting'][_0x92ec('0x12')]({'where':{'id':0x1},'attributes':[_0x92ec('0x13'),_0x92ec('0x14')],'raw':!![]})[_0x92ec('0x15')](function(_0x476ec8){_0x208e30=_0x476ec8;if(!_0x208e30[_0x92ec('0x13')]){logger[_0x92ec('0xd')](_0x92ec('0x16'),_0x1713a4);throw new Error(_0x92ec('0xf'));}return _0x415abe[_0x92ec('0x12')]({'attributes':['id',_0x92ec('0x17'),_0x92ec('0x18'),_0x92ec('0x19'),_0x92ec('0x1a'),_0x92ec('0x1b'),_0x92ec('0x1c'),_0x92ec('0x1d'),_0x92ec('0x1e')],'where':{'name':_0x1713a4,'role':{'$or':['admin',_0x92ec('0x1f'),_0x92ec('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x20eb0c){if(!_0x20eb0c||_0x20eb0c&&_0x20eb0c[_0x92ec('0x17')]!==_0x1713a4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x16f95a=_0x20eb0c;var _0x147001=_0x16f95a[_0x92ec('0x17')]+'@'+config['activedirectory'][_0x92ec('0x21')];return adAuthenticate(config['activedirectory'],_0x147001,_0x4dd772);})[_0x92ec('0x15')](function(_0xd7c7db){if(_0x16f95a['disabled']){throw new Error(_0x92ec('0xf'));}if(_0x208e30[_0x92ec('0x14')]>0x0){if(_0x16f95a[_0x92ec('0x1c')]){if(moment(_0x16f95a['blockedAt'])[_0x92ec('0x22')](_0x208e30[_0x92ec('0x14')],'minutes')>moment()){throw new Error(_0x92ec('0xf'));}return utils[_0x92ec('0x23')](_0x16f95a,0x0,![],null)['then'](function(){return utils[_0x92ec('0x24')](_0x16f95a);})[_0x92ec('0x15')](function(){return _0x5600a6(null,_0x16f95a);});}else{return utils['getLicense'](_0x16f95a)['then'](function(){return _0x5600a6(null,_0x16f95a);});}}else{return utils['getLicense'](_0x16f95a)['then'](function(){return _0x5600a6(null,_0x16f95a);});}})[_0x92ec('0x25')](function(_0x37fb6d){return _0x5600a6(null,![],_0x37fb6d);});}function handleError(_0x476ee3,_0x14f356,_0x2f2a16){return _0x476ee3[_0x92ec('0x26')](_0x14f356||0x1f4)['send']({'message':_0x2f2a16?_0x2f2a16[_0x92ec('0x27')]||_0x2f2a16:''});}exports[_0x92ec('0x28')]=function(_0x2a8147,_0x50f55c,_0x31196c){passport[_0x92ec('0xc')](_0x92ec('0x29'),function(_0x111fe1,_0x3b0741,_0x468e68){var _0x1d2507=_0x111fe1||_0x468e68;if(_0x1d2507){return handleError(_0x50f55c,0x191,_0x1d2507);}if(!_0x3b0741){return handleError(_0x50f55c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1d9f6a={'payload':{'id':_0x3b0741['id'],'role':_0x3b0741[_0x92ec('0x1a')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1d9f6a)[_0x92ec('0x15')](function(_0xf6afd7){_0x50f55c['json']({'id':_0x3b0741['id'],'token':_0xf6afd7,'statusCall':'','isAlreadyLogged':_0x3b0741['online']});});}})(_0x2a8147,_0x50f55c,_0x31196c);};passport[_0x92ec('0x2a')](_0x92ec('0x29'),new LocalStrategy({'usernameField':_0x92ec('0x17'),'passwordField':_0x92ec('0x18')},function(_0x517726,_0x3242f2,_0x12b99b){return ActiveDirectoryAuthenticate(db[_0x92ec('0x2b')],_0x517726,_0x3242f2,_0x12b99b);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 06ac3b0..95b2d5e 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 _0xedc3=['login','exports','express','Router'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xedc3,0xa2));var _0x3edc=function(_0x296d34,_0x425387){_0x296d34=_0x296d34-0x0;var _0x1494a7=_0xedc3[_0x296d34];return _0x1494a7;};'use strict';var express=require(_0x3edc('0x0'));var router=express[_0x3edc('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x3edc('0x2')]);module[_0x3edc('0x3')]=router; \ No newline at end of file +var _0x10d9=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x725d81,_0x993fa6){var _0x46d044=function(_0x37dc1b){while(--_0x37dc1b){_0x725d81['push'](_0x725d81['shift']());}};_0x46d044(++_0x993fa6);}(_0x10d9,0x100));var _0x910d=function(_0x347490,_0x2792e4){_0x347490=_0x347490-0x0;var _0x2cb6cc=_0x10d9[_0x347490];return _0x2cb6cc;};'use strict';var express=require(_0x910d('0x0'));var router=express[_0x910d('0x1')]();var controller=require(_0x910d('0x2'));router[_0x910d('0x3')]('/',controller[_0x910d('0x4')]);module[_0x910d('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 8216b83..65a8f65 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x4fc171,_0x11c113){_0x4fc171=_0x4fc171-0x0;var _0x2be3f9=_0x7a54[_0x4fc171];return _0x2be3f9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x391f64,_0x5bf30a){var _0x19d491=function(_0x1a36a9){while(--_0x1a36a9){_0x391f64['push'](_0x391f64['shift']());}};_0x19d491(++_0x5bf30a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index dfd3dbe..154fddb 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 _0x45c9=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x405af2,_0xc07da0){var _0x2a7706=function(_0x795002){while(--_0x795002){_0x405af2['push'](_0x405af2['shift']());}};_0x2a7706(++_0xc07da0);}(_0x45c9,0x96));var _0x945c=function(_0x237c55,_0x442cf5){_0x237c55=_0x237c55-0x0;var _0x40230e=_0x45c9[_0x237c55];return _0x40230e;};'use strict';var express=require('express');var passport=require(_0x945c('0x0'));var router=express['Router']();var controller=require(_0x945c('0x1'));var userController=require(_0x945c('0x2'));var authService=require(_0x945c('0x3'));router[_0x945c('0x4')]('/',controller[_0x945c('0x5')]);router['get'](_0x945c('0x6'),controller['callback'],authService[_0x945c('0x7')],userController[_0x945c('0x5')],authService[_0x945c('0x8')]);module[_0x945c('0x9')]=router; \ No newline at end of file +var _0xf0ab=['get','login','/callback','setTokenCookie','exports','express','passport','../user/user.controller.js','../../components/auth/service'];(function(_0x1d6f1a,_0xe6c4d9){var _0xdd2fe7=function(_0x3a9150){while(--_0x3a9150){_0x1d6f1a['push'](_0x1d6f1a['shift']());}};_0xdd2fe7(++_0xe6c4d9);}(_0xf0ab,0xb9));var _0xbf0a=function(_0x13f2d2,_0x319d75){_0x13f2d2=_0x13f2d2-0x0;var _0x582c5a=_0xf0ab[_0x13f2d2];return _0x582c5a;};'use strict';var express=require(_0xbf0a('0x0'));var passport=require(_0xbf0a('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xbf0a('0x2'));var authService=require(_0xbf0a('0x3'));router[_0xbf0a('0x4')]('/',controller[_0xbf0a('0x5')]);router['get'](_0xbf0a('0x6'),controller['callback'],authService['isMiddleware'],userController[_0xbf0a('0x5')],authService[_0xbf0a('0x7')]);module[_0xbf0a('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1c568f1..f2a9f14 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 _0xc8e0=['resetPasswordExpires','now','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','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','securePassword','previousPasswords','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','request','SendMail','error','format','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','findOne','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc8e0,0x190));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x0c8e('0x0'));var passport=require(_0x0c8e('0x1'));var LocalStrategy=require(_0x0c8e('0x2'))[_0x0c8e('0x3')];var jayson=require(_0x0c8e('0x4'));var _=require(_0x0c8e('0x5'));var rs=require(_0x0c8e('0x6'));var moment=require(_0x0c8e('0x7'));var db=require(_0x0c8e('0x8'))['db'];var authService=require(_0x0c8e('0x9'));var utils=require('../../config/utils');var client=jayson['client'][_0x0c8e('0xa')]({'port':0x232b});function localAuthenticate(_0x3217be,_0xc7ce9,_0x2e737b,_0x143fea){var _0x29fc86,_0xab4cda;return db[_0x0c8e('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x0c8e('0xc'),_0x0c8e('0xd')],'raw':!![]})[_0x0c8e('0xe')](function(_0x46cd5e){_0x29fc86=_0x46cd5e;return _0x3217be['findOne']({'attributes':['id',_0x0c8e('0xf'),_0x0c8e('0x10'),_0x0c8e('0x11'),'role',_0x0c8e('0x12'),_0x0c8e('0x13'),_0x0c8e('0x14'),_0x0c8e('0x15')],'where':{'name':_0xc7ce9,'role':{'$or':[_0x0c8e('0x16'),_0x0c8e('0x17'),'agent']}}});})[_0x0c8e('0xe')](function(_0xba1d80){if(!_0xba1d80||_0xba1d80&&_0xba1d80[_0x0c8e('0xf')]!==_0xc7ce9){throw new Error(_0x0c8e('0x18'));}else{_0xab4cda=_0xba1d80;return _0xab4cda;}})[_0x0c8e('0xe')](function(){_0xab4cda[_0x0c8e('0x19')](_0x2e737b,function(_0x146cbb,_0x263ec6){var _0x536fb1=_0xab4cda[_0x0c8e('0x15')]+0x1;if(_0x146cbb){return _0x143fea(_0x146cbb);}else if(!_0x263ec6){if(_0xab4cda[_0x0c8e('0x12')]){return _0x143fea(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x29fc86[_0x0c8e('0xc')]>0x0){if(_0xab4cda[_0x0c8e('0x13')]){if(_0x29fc86[_0x0c8e('0xd')]>0x0){if(moment(_0xab4cda['blockedAt'])[_0x0c8e('0x1a')](_0x29fc86[_0x0c8e('0xd')],_0x0c8e('0x1b'))>moment()){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}else{return utils[_0x0c8e('0x1c')](_0xab4cda,_0x536fb1,![],null)[_0x0c8e('0xe')](function(){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});});}}else{return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}}else{if(_0x536fb1>=_0x29fc86[_0x0c8e('0xc')]){return utils[_0x0c8e('0x1c')](_0xab4cda,0x0,!![],moment())[_0x0c8e('0xe')](function(){return _0x143fea(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0xab4cda,_0x536fb1,![],null)['then'](function(){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});});}}}else{return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}}else{if(_0xab4cda[_0x0c8e('0x12')]){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}else if(_0x29fc86[_0x0c8e('0xc')]>0x0){if(_0xab4cda[_0x0c8e('0x13')]){if(_0x29fc86[_0x0c8e('0xd')]>0x0){if(moment(_0xab4cda[_0x0c8e('0x14')])[_0x0c8e('0x1a')](_0x29fc86[_0x0c8e('0xd')],'minutes')>moment()){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}else{return utils['clearBlockUser'](_0xab4cda,0x0,![],null)[_0x0c8e('0xe')](function(){return utils['getLicense'](_0xab4cda);})[_0x0c8e('0xe')](function(){return _0x143fea(null,_0xab4cda);});}}else{return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}}else{return utils['clearBlockUser'](_0xab4cda,0x0,![],null)[_0x0c8e('0xe')](function(){return utils[_0x0c8e('0x1d')](_0xab4cda);})[_0x0c8e('0xe')](function(){return _0x143fea(null,_0xab4cda);})[_0x0c8e('0x1e')](function(_0x57e817){return _0x143fea(null,![],_0x57e817);});}}else{if(_0xab4cda[_0x0c8e('0x13')]){return _0x143fea(null,![],{'message':_0x0c8e('0x18')});}else{return utils[_0x0c8e('0x1d')](_0xab4cda)[_0x0c8e('0xe')](function(){return _0x143fea(null,_0xab4cda);});}}}});})[_0x0c8e('0x1e')](function(_0x3af606){return _0x143fea(null,![],_0x3af606);});}function sendServiceMail(_0x246098){return db[_0x0c8e('0x1f')][_0x0c8e('0x20')]({'where':{'service':!![]},'attributes':['id',_0x0c8e('0xf'),_0x0c8e('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x0c8e('0x22'),'include':[{'model':db[_0x0c8e('0x23')],'as':_0x0c8e('0x23')}]}]})['then'](function(_0x40ce37){if(!_0x40ce37){throw new Error(_0x0c8e('0x24'));}var _0x4da0b9=_0x40ce37[_0x0c8e('0x25')]();var _0x29fca0={'account':_0x4da0b9,'message':_[_0x0c8e('0x26')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x40ce37[_0x0c8e('0xf')],_0x40ce37[_0x0c8e('0x21')]||_0x40ce37[_0x0c8e('0x22')][_0x0c8e('0x17')])},_0x246098)};return client[_0x0c8e('0x27')](_0x0c8e('0x28'),_0x29fca0);})[_0x0c8e('0xe')](function(_0x34ac9d){if(_0x34ac9d[_0x0c8e('0x29')]){throw new Error(util[_0x0c8e('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x34ac9d[_0x0c8e('0x29')]['message']||JSON[_0x0c8e('0x2b')](_0x34ac9d[_0x0c8e('0x29')])));}return!![];});}function handleError(_0x22a9b3,_0x5349bd,_0x2fc559){return _0x22a9b3[_0x0c8e('0x2c')](_0x5349bd||0x1f4)[_0x0c8e('0x2d')]({'message':_0x2fc559?_0x2fc559[_0x0c8e('0x2e')]||_0x2fc559:''});}exports[_0x0c8e('0x2f')]=function(_0x34e6d9,_0x3cad07,_0xe5b7bd){passport[_0x0c8e('0x19')](_0x0c8e('0x30'),function(_0x2ecce6,_0x405988,_0x4fcf74){var _0x18df3f=_0x2ecce6||_0x4fcf74;if(_0x18df3f){return handleError(_0x3cad07,0x191,_0x18df3f);}if(!_0x405988){return handleError(_0x3cad07,0x194,{'message':_0x0c8e('0x31')});}else{var _0xab817b={'payload':{'id':_0x405988['id'],'role':_0x405988['role']},'options':{'expiresIn':0x15180}};return authService[_0x0c8e('0x32')](_0xab817b)['then'](function(_0xba828d){_0x3cad07['json']({'id':_0x405988['id'],'token':_0xba828d,'statusCall':'','isAlreadyLogged':_0x405988[_0x0c8e('0x33')]});});}})(_0x34e6d9,_0x3cad07,_0xe5b7bd);};exports['forgot']=function(_0x535460,_0x486725){if(!_0x535460[_0x0c8e('0x34')][_0x0c8e('0x21')]){return handleError(_0x486725,0x1f4,{'message':_0x0c8e('0x35')});}var _0x16f7ea=rs[_0x0c8e('0x36')]();_0x535460[_0x0c8e('0x34')]['email']=_0x535460[_0x0c8e('0x34')][_0x0c8e('0x21')][_0x0c8e('0x37')]()[_0x0c8e('0x38')]();var _0x7d85b6;return db['Setting'][_0x0c8e('0x39')]({'where':{'id':0x1},'attributes':[_0x0c8e('0xc'),_0x0c8e('0xd')],'raw':!![]})[_0x0c8e('0xe')](function(_0x249e63){_0x7d85b6=_0x249e63;return db[_0x0c8e('0x3a')][_0x0c8e('0x20')]({'where':{'email':_0x535460[_0x0c8e('0x34')]['email']}});})[_0x0c8e('0xe')](function(_0xa172a4){if(!_0xa172a4){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xa172a4[_0x0c8e('0x12')]){throw new Error(_0x0c8e('0x3b'));}if(_0xa172a4['blocked']){if(moment(_0xa172a4[_0x0c8e('0x14')])[_0x0c8e('0x1a')](_0x7d85b6[_0x0c8e('0xd')],_0x0c8e('0x1b'))>moment()){throw new Error(_0x0c8e('0x3c'));}else{_0xa172a4[_0x0c8e('0x13')]=![];_0xa172a4[_0x0c8e('0x14')]=null;}}_0xa172a4[_0x0c8e('0x3d')]=_0x16f7ea;_0xa172a4[_0x0c8e('0x3e')]=Date[_0x0c8e('0x3f')]()+0x36ee80;return _0xa172a4[_0x0c8e('0x40')]();})[_0x0c8e('0xe')](function(){return sendServiceMail({'to':_0x535460[_0x0c8e('0x34')][_0x0c8e('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0c8e('0x41')+_0x0c8e('0x42')+'https://'+_0x535460['headers'][_0x0c8e('0x43')]+_0x0c8e('0x44')+_0x16f7ea+'\x0a\x0a'+_0x0c8e('0x45')});})['then'](function(){_0x486725[_0x0c8e('0x2c')](0xc8)[_0x0c8e('0x2d')]({'message':_0x0c8e('0x46')});})[_0x0c8e('0x1e')](function(_0x2d83f){return handleError(_0x486725,0x1f4,_0x2d83f);});};exports[_0x0c8e('0x47')]=function(_0x3e6d54,_0x41f0ee){return db[_0x0c8e('0x3a')]['find']({'where':{'resetPasswordToken':_0x3e6d54[_0x0c8e('0x48')][_0x0c8e('0x49')],'resetPasswordExpires':{'$gt':Date[_0x0c8e('0x3f')]()}}})[_0x0c8e('0xe')](function(_0x489ee3){if(!_0x489ee3){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0c8e('0xb')][_0x0c8e('0x39')]({'attributes':['id',_0x0c8e('0x4a'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x0c8e('0xe')](function(_0x1f5e86){if(_0x1f5e86[_0x0c8e('0x4a')])authService['validatePasswordPattern'](_0x3e6d54[_0x0c8e('0x34')][_0x0c8e('0x10')]);if(!_0x1f5e86['enforcePasswordHistory']||!_0x489ee3[_0x0c8e('0x4b')])return _0x489ee3;authService['validatePasswordHistory'](_0x3e6d54['body'][_0x0c8e('0x10')],_0x489ee3[_0x0c8e('0x4b')],_0x1f5e86['passwordHistoryLimit']);return _0x489ee3;})['then'](function(){_0x489ee3['password']=_0x3e6d54['body'][_0x0c8e('0x10')];_0x489ee3['resetPasswordToken']=null;_0x489ee3[_0x0c8e('0x3e')]=null;return _0x489ee3[_0x0c8e('0x40')]();});})['then'](function(){_0x41f0ee[_0x0c8e('0x2c')](0xc8)['send']({'message':_0x0c8e('0x4c')});})['catch'](function(_0x5a907e){return handleError(_0x41f0ee,0x1f4,_0x5a907e);});};passport['use'](_0x0c8e('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0x0c8e('0x10')},function(_0x28aeaf,_0x4496fd,_0x593785){return localAuthenticate(db[_0x0c8e('0x3a')],_0x28aeaf,_0x4496fd,_0x593785);})); \ No newline at end of file +var _0x01fa=['minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','send','Reset\x20Email\x20sent!','reset','User','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add'];(function(_0x1bd7d6,_0x2deca3){var _0x1e1c0d=function(_0x274d05){while(--_0x274d05){_0x1bd7d6['push'](_0x1bd7d6['shift']());}};_0x1e1c0d(++_0x2deca3);}(_0x01fa,0x86));var _0xa01f=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x01fa[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0xa01f('0x0'));var passport=require('passport');var LocalStrategy=require(_0xa01f('0x1'))[_0xa01f('0x2')];var jayson=require(_0xa01f('0x3'));var _=require(_0xa01f('0x4'));var rs=require(_0xa01f('0x5'));var moment=require(_0xa01f('0x6'));var db=require(_0xa01f('0x7'))['db'];var authService=require(_0xa01f('0x8'));var utils=require(_0xa01f('0x9'));var client=jayson[_0xa01f('0xa')][_0xa01f('0xb')]({'port':0x232b});function localAuthenticate(_0x2cadff,_0x30be66,_0x26c38b,_0x40fdba){var _0x84d4c7,_0x17f667;return db[_0xa01f('0xc')][_0xa01f('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa01f('0xe')],'raw':!![]})[_0xa01f('0xf')](function(_0x9404f1){_0x84d4c7=_0x9404f1;return _0x2cadff[_0xa01f('0xd')]({'attributes':['id',_0xa01f('0x10'),_0xa01f('0x11'),_0xa01f('0x12'),_0xa01f('0x13'),'disabled',_0xa01f('0x14'),_0xa01f('0x15'),_0xa01f('0x16')],'where':{'name':_0x30be66,'role':{'$or':[_0xa01f('0x17'),_0xa01f('0x18'),'agent']}}});})[_0xa01f('0xf')](function(_0x267b66){if(!_0x267b66||_0x267b66&&_0x267b66[_0xa01f('0x10')]!==_0x30be66){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x17f667=_0x267b66;return _0x17f667;}})[_0xa01f('0xf')](function(){_0x17f667[_0xa01f('0x19')](_0x26c38b,function(_0x23522e,_0x1fd1bd){var _0x2ed7ce=_0x17f667[_0xa01f('0x16')]+0x1;if(_0x23522e){return _0x40fdba(_0x23522e);}else if(!_0x1fd1bd){if(_0x17f667[_0xa01f('0x1a')]){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}else if(_0x84d4c7[_0xa01f('0x1c')]>0x0){if(_0x17f667[_0xa01f('0x14')]){if(_0x84d4c7['blockDuration']>0x0){if(moment(_0x17f667[_0xa01f('0x15')])[_0xa01f('0x1d')](_0x84d4c7[_0xa01f('0xe')],_0xa01f('0x1e'))>moment()){return _0x40fdba(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa01f('0x1f')](_0x17f667,_0x2ed7ce,![],null)[_0xa01f('0xf')](function(){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});});}}else{return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}}else{if(_0x2ed7ce>=_0x84d4c7[_0xa01f('0x1c')]){return utils['clearBlockUser'](_0x17f667,0x0,!![],moment())[_0xa01f('0xf')](function(){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});});}else{return utils[_0xa01f('0x1f')](_0x17f667,_0x2ed7ce,![],null)[_0xa01f('0xf')](function(){return _0x40fdba(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}}else{if(_0x17f667['disabled']){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}else if(_0x84d4c7[_0xa01f('0x1c')]>0x0){if(_0x17f667[_0xa01f('0x14')]){if(_0x84d4c7['blockDuration']>0x0){if(moment(_0x17f667['blockedAt'])[_0xa01f('0x1d')](_0x84d4c7[_0xa01f('0xe')],'minutes')>moment()){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}else{return utils['clearBlockUser'](_0x17f667,0x0,![],null)[_0xa01f('0xf')](function(){return utils[_0xa01f('0x20')](_0x17f667);})[_0xa01f('0xf')](function(){return _0x40fdba(null,_0x17f667);});}}else{return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}}else{return utils[_0xa01f('0x1f')](_0x17f667,0x0,![],null)[_0xa01f('0xf')](function(){return utils[_0xa01f('0x20')](_0x17f667);})['then'](function(){return _0x40fdba(null,_0x17f667);})[_0xa01f('0x21')](function(_0x8be14e){return _0x40fdba(null,![],_0x8be14e);});}}else{if(_0x17f667['blocked']){return _0x40fdba(null,![],{'message':_0xa01f('0x1b')});}else{return utils['getLicense'](_0x17f667)[_0xa01f('0xf')](function(){return _0x40fdba(null,_0x17f667);});}}}});})['catch'](function(_0x3180ae){return _0x40fdba(null,![],_0x3180ae);});}function sendServiceMail(_0x2e88a9){return db['MailAccount'][_0xa01f('0x22')]({'where':{'service':!![]},'attributes':['id',_0xa01f('0x10'),_0xa01f('0x23')],'include':[{'model':db[_0xa01f('0x24')],'as':_0xa01f('0x25'),'include':[{'model':db[_0xa01f('0x26')],'as':_0xa01f('0x26')}]}]})[_0xa01f('0xf')](function(_0x409dc6){if(!_0x409dc6){throw new Error(_0xa01f('0x27'));}var _0x40143f=_0x409dc6[_0xa01f('0x28')]();var _0x2d7e73={'account':_0x40143f,'message':_['merge']({'from':util['format'](_0xa01f('0x29'),_0x409dc6['name'],_0x409dc6['email']||_0x409dc6[_0xa01f('0x25')][_0xa01f('0x18')])},_0x2e88a9)};return client[_0xa01f('0x2a')](_0xa01f('0x2b'),_0x2d7e73);})['then'](function(_0x162042){if(_0x162042[_0xa01f('0x2c')]){throw new Error(util[_0xa01f('0x2d')](_0xa01f('0x2e'),_0x162042[_0xa01f('0x2c')][_0xa01f('0x2f')]||JSON['stringify'](_0x162042[_0xa01f('0x2c')])));}return!![];});}function handleError(_0x53d2cf,_0x5d4f08,_0x2725c0){return _0x53d2cf[_0xa01f('0x30')](_0x5d4f08||0x1f4)['send']({'message':_0x2725c0?_0x2725c0['message']||_0x2725c0:''});}exports[_0xa01f('0x31')]=function(_0x341afc,_0x53590c,_0x5b2576){passport['authenticate'](_0xa01f('0x32'),function(_0x319c78,_0xf6b802,_0x106c91){var _0x432b3d=_0x319c78||_0x106c91;if(_0x432b3d){return handleError(_0x53590c,0x191,_0x432b3d);}if(!_0xf6b802){return handleError(_0x53590c,0x194,{'message':_0xa01f('0x33')});}else{var _0x2cd94c={'payload':{'id':_0xf6b802['id'],'role':_0xf6b802['role']},'options':{'expiresIn':0x15180}};return authService[_0xa01f('0x34')](_0x2cd94c)[_0xa01f('0xf')](function(_0x3e7588){_0x53590c[_0xa01f('0x35')]({'id':_0xf6b802['id'],'token':_0x3e7588,'statusCall':'','isAlreadyLogged':_0xf6b802[_0xa01f('0x36')]});});}})(_0x341afc,_0x53590c,_0x5b2576);};exports[_0xa01f('0x37')]=function(_0x39d36c,_0x2b3061){if(!_0x39d36c[_0xa01f('0x38')][_0xa01f('0x23')]){return handleError(_0x2b3061,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4c1196=rs[_0xa01f('0x39')]();_0x39d36c['body'][_0xa01f('0x23')]=_0x39d36c[_0xa01f('0x38')][_0xa01f('0x23')][_0xa01f('0x3a')]()[_0xa01f('0x3b')]();var _0x4ccfa4;return db[_0xa01f('0xc')][_0xa01f('0xd')]({'where':{'id':0x1},'attributes':[_0xa01f('0x1c'),_0xa01f('0xe')],'raw':!![]})[_0xa01f('0xf')](function(_0xdfd4e6){_0x4ccfa4=_0xdfd4e6;return db['User'][_0xa01f('0x22')]({'where':{'email':_0x39d36c[_0xa01f('0x38')]['email']}});})['then'](function(_0x101684){if(!_0x101684){throw new Error(_0xa01f('0x3c'));}if(_0x101684[_0xa01f('0x1a')]){throw new Error(_0xa01f('0x3d'));}if(_0x101684[_0xa01f('0x14')]){if(moment(_0x101684[_0xa01f('0x15')])[_0xa01f('0x1d')](_0x4ccfa4[_0xa01f('0xe')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x101684[_0xa01f('0x14')]=![];_0x101684['blockedAt']=null;}}_0x101684[_0xa01f('0x3e')]=_0x4c1196;_0x101684[_0xa01f('0x3f')]=Date[_0xa01f('0x40')]()+0x36ee80;return _0x101684[_0xa01f('0x41')]();})[_0xa01f('0xf')](function(){return sendServiceMail({'to':_0x39d36c[_0xa01f('0x38')]['email'],'subject':_0xa01f('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xa01f('0x43')+'https://'+_0x39d36c['headers']['host']+_0xa01f('0x44')+_0x4c1196+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x2b3061[_0xa01f('0x30')](0xc8)[_0xa01f('0x45')]({'message':_0xa01f('0x46')});})[_0xa01f('0x21')](function(_0x1768a8){return handleError(_0x2b3061,0x1f4,_0x1768a8);});};exports[_0xa01f('0x47')]=function(_0x3df474,_0x35e4d6){return db[_0xa01f('0x48')][_0xa01f('0x22')]({'where':{'resetPasswordToken':_0x3df474['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xa01f('0xf')](function(_0x2d6827){if(!_0x2d6827){throw new Error(_0xa01f('0x49'));}return db['Setting']['findOne']({'attributes':['id',_0xa01f('0x4a'),'enforcePasswordHistory',_0xa01f('0x4b')]})[_0xa01f('0xf')](function(_0x54f2b8){if(_0x54f2b8['securePassword'])authService[_0xa01f('0x4c')](_0x3df474[_0xa01f('0x38')][_0xa01f('0x11')]);if(!_0x54f2b8[_0xa01f('0x4d')]||!_0x2d6827[_0xa01f('0x4e')])return _0x2d6827;authService[_0xa01f('0x4f')](_0x3df474[_0xa01f('0x38')][_0xa01f('0x11')],_0x2d6827[_0xa01f('0x4e')],_0x54f2b8['passwordHistoryLimit']);return _0x2d6827;})[_0xa01f('0xf')](function(){_0x2d6827[_0xa01f('0x11')]=_0x3df474[_0xa01f('0x38')]['password'];_0x2d6827[_0xa01f('0x3e')]=null;_0x2d6827[_0xa01f('0x3f')]=null;return _0x2d6827[_0xa01f('0x41')]();});})['then'](function(){_0x35e4d6[_0xa01f('0x30')](0xc8)[_0xa01f('0x45')]({'message':_0xa01f('0x50')});})[_0xa01f('0x21')](function(_0x4cfbd5){return handleError(_0x35e4d6,0x1f4,_0x4cfbd5);});};passport[_0xa01f('0x51')](_0xa01f('0x32'),new LocalStrategy({'usernameField':_0xa01f('0x10'),'passwordField':'password'},function(_0x9b46d,_0x266aa6,_0x389ae0){return localAuthenticate(db[_0xa01f('0x48')],_0x9b46d,_0x266aa6,_0x389ae0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4fce9cb..898f194 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 _0xcd8c=['express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports'];(function(_0x556959,_0x5b06c8){var _0x158742=function(_0x5d84f3){while(--_0x5d84f3){_0x556959['push'](_0x556959['shift']());}};_0x158742(++_0x5b06c8);}(_0xcd8c,0xf3));var _0xccd8=function(_0x1892f9,_0x2cb4ab){_0x1892f9=_0x1892f9-0x0;var _0x5a765f=_0xcd8c[_0x1892f9];return _0x5a765f;};'use strict';var express=require(_0xccd8('0x0'));var router=express[_0xccd8('0x1')]();var controller=require(_0xccd8('0x2'));router[_0xccd8('0x3')]('/',controller[_0xccd8('0x4')]);router[_0xccd8('0x3')](_0xccd8('0x5'),controller[_0xccd8('0x6')]);router['post'](_0xccd8('0x7'),controller['reset']);module[_0xccd8('0x8')]=router; \ No newline at end of file +var _0xe2c0=['exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x157991,_0x81cb66){var _0x8fe4c2=function(_0x142c53){while(--_0x142c53){_0x157991['push'](_0x157991['shift']());}};_0x8fe4c2(++_0x81cb66);}(_0xe2c0,0x141));var _0x0e2c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2c0[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x0e2c('0x0'));var router=express[_0x0e2c('0x1')]();var controller=require(_0x0e2c('0x2'));router[_0x0e2c('0x3')]('/',controller[_0x0e2c('0x4')]);router[_0x0e2c('0x3')](_0x0e2c('0x5'),controller[_0x0e2c('0x6')]);router[_0x0e2c('0x3')](_0x0e2c('0x7'),controller[_0x0e2c('0x8')]);module[_0x0e2c('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 15417ea..fc60b76 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 _0xa2fc=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x2f9bb5,_0x524d29){var _0x559114=function(_0x3e2a9e){while(--_0x3e2a9e){_0x2f9bb5['push'](_0x2f9bb5['shift']());}};_0x559114(++_0x524d29);}(_0xa2fc,0x16c));var _0xca2f=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa2fc[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xca2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xca2f('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xca2f('0x1')]},'description':{'type':Sequelize[_0xca2f('0x1')]},'status':{'type':Sequelize[_0xca2f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0b71=['sequelize','exports','STRING','INTEGER'];(function(_0x15be23,_0x59cae0){var _0x5ec50b=function(_0x396b8b){while(--_0x396b8b){_0x15be23['push'](_0x15be23['shift']());}};_0x5ec50b(++_0x59cae0);}(_0x0b71,0x120));var _0x10b7=function(_0x1f7dfa,_0x415b27){_0x1f7dfa=_0x1f7dfa-0x0;var _0x13bb78=_0x0b71[_0x1f7dfa];return _0x13bb78;};'use strict';var Sequelize=require(_0x10b7('0x0'));module[_0x10b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x10b7('0x2')]},'description':{'type':Sequelize[_0x10b7('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x10b7('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0d38d67..2ae6a7a 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 _0x0e2f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Automation','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','addActions','Action','getActions','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5c536d,_0x55af68){var _0x3b201a=function(_0x7943c5){while(--_0x7943c5){_0x5c536d['push'](_0x5c536d['shift']());}};_0x3b201a(++_0x55af68);}(_0x0e2f,0x9e));var _0xf0e2=function(_0x3dbaa7,_0x438f7d){_0x3dbaa7=_0x3dbaa7-0x0;var _0x38f4c5=_0x0e2f[_0x3dbaa7];return _0x38f4c5;};'use strict';var emlformat=require(_0xf0e2('0x0'));var rimraf=require(_0xf0e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e2('0x2'));var rp=require(_0xf0e2('0x3'));var moment=require(_0xf0e2('0x4'));var BPromise=require(_0xf0e2('0x5'));var Mustache=require(_0xf0e2('0x6'));var util=require(_0xf0e2('0x7'));var path=require(_0xf0e2('0x8'));var sox=require('sox');var csv=require(_0xf0e2('0x9'));var ejs=require(_0xf0e2('0xa'));var fs=require('fs');var fs_extra=require(_0xf0e2('0xb'));var _=require(_0xf0e2('0xc'));var squel=require(_0xf0e2('0xd'));var crypto=require(_0xf0e2('0xe'));var jsforce=require(_0xf0e2('0xf'));var deskjs=require(_0xf0e2('0x10'));var toCsv=require(_0xf0e2('0x9'));var querystring=require(_0xf0e2('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0e2('0x12'));var authService=require(_0xf0e2('0x13'));var qs=require(_0xf0e2('0x14'));var as=require(_0xf0e2('0x15'));var hardwareService=require(_0xf0e2('0x16'));var logger=require(_0xf0e2('0x17'))(_0xf0e2('0x18'));var utils=require(_0xf0e2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf0e2('0x1a'));var db=require(_0xf0e2('0x1b'))['db'];function respondWithStatusCode(_0x26b196,_0x3bfc9e){_0x3bfc9e=_0x3bfc9e||0xcc;return function(_0x4d330d){if(_0x4d330d){return _0x26b196[_0xf0e2('0x1c')](_0x3bfc9e);}return _0x26b196['status'](_0x3bfc9e)[_0xf0e2('0x1d')]();};}function respondWithResult(_0x4380e9,_0x55c28a){_0x55c28a=_0x55c28a||0xc8;return function(_0x15a15a){if(_0x15a15a){return _0x4380e9[_0xf0e2('0x1e')](_0x55c28a)[_0xf0e2('0x1f')](_0x15a15a);}};}function respondWithFilteredResult(_0x212328,_0x1aab09){return function(_0x278b84){if(_0x278b84){var _0x186eef=typeof _0x1aab09[_0xf0e2('0x20')]===_0xf0e2('0x21')&&typeof _0x1aab09[_0xf0e2('0x22')]===_0xf0e2('0x21');var _0xe775b8=_0x278b84[_0xf0e2('0x23')];var _0xb57b0b=_0x186eef?0x0:_0x1aab09[_0xf0e2('0x20')];var _0x94691b=_0x186eef?_0x278b84[_0xf0e2('0x23')]:_0x1aab09[_0xf0e2('0x20')]+_0x1aab09[_0xf0e2('0x22')];var _0x9965f1;if(_0x94691b>=_0xe775b8){_0x94691b=_0xe775b8;_0x9965f1=0xc8;}else{_0x9965f1=0xce;}_0x212328[_0xf0e2('0x1e')](_0x9965f1);return _0x212328[_0xf0e2('0x24')](_0xf0e2('0x25'),_0xb57b0b+'-'+_0x94691b+'/'+_0xe775b8)[_0xf0e2('0x1f')](_0x278b84);}return null;};}function patchUpdates(_0x1cd0d7){return function(_0x522986){try{jsonpatch[_0xf0e2('0x26')](_0x522986,_0x1cd0d7,!![]);}catch(_0x225e36){return BPromise[_0xf0e2('0x27')](_0x225e36);}return _0x522986['save']();};}function saveUpdates(_0x2e28e9,_0x443673){return function(_0x7be259){if(_0x7be259){return _0x7be259[_0xf0e2('0x28')](_0x2e28e9)[_0xf0e2('0x29')](function(_0x33d7c7){return _0x33d7c7;});}return null;};}function removeEntity(_0x297e35,_0x38f467){return function(_0x16ce16){if(_0x16ce16){return _0x16ce16[_0xf0e2('0x2a')]()[_0xf0e2('0x29')](function(){_0x297e35[_0xf0e2('0x1e')](0xcc)[_0xf0e2('0x1d')]();});}};}function handleEntityNotFound(_0x40b997,_0x296cbd){return function(_0x555c7c){if(!_0x555c7c){_0x40b997[_0xf0e2('0x1c')](0x194);}return _0x555c7c;};}function handleError(_0x2c8488,_0x69efb0){_0x69efb0=_0x69efb0||0x1f4;return function(_0x8c6a3f){logger[_0xf0e2('0x2b')](_0x8c6a3f[_0xf0e2('0x2c')]);if(_0x8c6a3f[_0xf0e2('0x2d')]){delete _0x8c6a3f[_0xf0e2('0x2d')];}_0x2c8488['status'](_0x69efb0)[_0xf0e2('0x2e')](_0x8c6a3f);};}exports['index']=function(_0x4d4a5f,_0x35c2a1){var _0x5782ca={},_0x4e8df4={},_0x5f2ebc={'count':0x0,'rows':[]};var _0x42311d=_['map'](db[_0xf0e2('0x2f')][_0xf0e2('0x30')],function(_0x4aeffa){return{'name':_0x4aeffa['fieldName'],'type':_0x4aeffa[_0xf0e2('0x31')]['key']};});_0x4e8df4[_0xf0e2('0x32')]=_[_0xf0e2('0x33')](_0x42311d,_0xf0e2('0x2d'));_0x4e8df4[_0xf0e2('0x34')]=_[_0xf0e2('0x35')](_0x4d4a5f[_0xf0e2('0x34')]);_0x4e8df4['filters']=_[_0xf0e2('0x36')](_0x4e8df4['model'],_0x4e8df4['query']);_0x5782ca['attributes']=_[_0xf0e2('0x36')](_0x4e8df4[_0xf0e2('0x32')],qs[_0xf0e2('0x37')](_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x37')]));_0x5782ca[_0xf0e2('0x38')]=_0x5782ca[_0xf0e2('0x38')]['length']?_0x5782ca[_0xf0e2('0x38')]:_0x4e8df4[_0xf0e2('0x32')];if(!_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x39')](_0xf0e2('0x3a'))){_0x5782ca[_0xf0e2('0x22')]=qs[_0xf0e2('0x22')](_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x22')]);_0x5782ca[_0xf0e2('0x20')]=qs[_0xf0e2('0x20')](_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x20')]);}_0x5782ca[_0xf0e2('0x3b')]=qs[_0xf0e2('0x3c')](_0x4d4a5f['query']['sort']);_0x5782ca['where']=qs['filters'](_['pick'](_0x4d4a5f['query'],_0x4e8df4[_0xf0e2('0x3d')]),_0x42311d);if(_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x3e')]){_0x5782ca['where']=_['merge'](_0x5782ca[_0xf0e2('0x3f')],{'$or':_[_0xf0e2('0x33')](_0x42311d,function(_0x56c84e){if(_0x56c84e[_0xf0e2('0x31')]!==_0xf0e2('0x40')){var _0x5116e2={};_0x5116e2[_0x56c84e[_0xf0e2('0x2d')]]={'$like':'%'+_0x4d4a5f[_0xf0e2('0x34')][_0xf0e2('0x3e')]+'%'};return _0x5116e2;}})});}_0x5782ca=_[_0xf0e2('0x41')]({},_0x5782ca,_0x4d4a5f['options']);var _0x43e288={'where':_0x5782ca[_0xf0e2('0x3f')]};return db[_0xf0e2('0x2f')]['count'](_0x43e288)[_0xf0e2('0x29')](function(_0x35313e){_0x5f2ebc[_0xf0e2('0x23')]=_0x35313e;if(_0x4d4a5f['query']['includeAll']){_0x5782ca[_0xf0e2('0x42')]=[{'all':!![]}];}return db[_0xf0e2('0x2f')][_0xf0e2('0x43')](_0x5782ca);})[_0xf0e2('0x29')](function(_0x21cff3){_0x5f2ebc[_0xf0e2('0x44')]=_0x21cff3;return _0x5f2ebc;})[_0xf0e2('0x29')](respondWithFilteredResult(_0x35c2a1,_0x5782ca))[_0xf0e2('0x45')](handleError(_0x35c2a1,null));};exports[_0xf0e2('0x46')]=function(_0x4b552c,_0x2f153a){var _0xe92177={'raw':![],'where':{'id':_0x4b552c[_0xf0e2('0x47')]['id']}},_0x4417db={};_0x4417db[_0xf0e2('0x32')]=_[_0xf0e2('0x35')](db[_0xf0e2('0x2f')]['rawAttributes']);_0x4417db[_0xf0e2('0x34')]=_[_0xf0e2('0x35')](_0x4b552c[_0xf0e2('0x34')]);_0x4417db[_0xf0e2('0x3d')]=_[_0xf0e2('0x36')](_0x4417db['model'],_0x4417db['query']);_0xe92177[_0xf0e2('0x38')]=_['intersection'](_0x4417db[_0xf0e2('0x32')],qs[_0xf0e2('0x37')](_0x4b552c[_0xf0e2('0x34')][_0xf0e2('0x37')]));_0xe92177[_0xf0e2('0x38')]=_0xe92177[_0xf0e2('0x38')][_0xf0e2('0x48')]?_0xe92177[_0xf0e2('0x38')]:_0x4417db[_0xf0e2('0x32')];if(_0x4b552c[_0xf0e2('0x34')][_0xf0e2('0x49')]){_0xe92177[_0xf0e2('0x42')]=[{'all':!![]}];}_0xe92177=_[_0xf0e2('0x41')]({},_0xe92177,_0x4b552c['options']);return db['Automation'][_0xf0e2('0x4a')](_0xe92177)[_0xf0e2('0x29')](handleEntityNotFound(_0x2f153a,null))[_0xf0e2('0x29')](respondWithResult(_0x2f153a,null))[_0xf0e2('0x45')](handleError(_0x2f153a,null));};exports[_0xf0e2('0x4b')]=function(_0x19df74,_0x51cbbb){return db[_0xf0e2('0x2f')][_0xf0e2('0x4b')](_0x19df74[_0xf0e2('0x4c')],{})[_0xf0e2('0x29')](respondWithResult(_0x51cbbb,0xc9))[_0xf0e2('0x45')](handleError(_0x51cbbb,null));};exports[_0xf0e2('0x28')]=function(_0x44014a,_0x811e8a){if(_0x44014a[_0xf0e2('0x4c')]['id']){delete _0x44014a[_0xf0e2('0x4c')]['id'];}return db[_0xf0e2('0x2f')][_0xf0e2('0x4a')]({'where':{'id':_0x44014a['params']['id']}})['then'](handleEntityNotFound(_0x811e8a,null))[_0xf0e2('0x29')](saveUpdates(_0x44014a['body'],null))[_0xf0e2('0x29')](respondWithResult(_0x811e8a,null))['catch'](handleError(_0x811e8a,null));};exports[_0xf0e2('0x2a')]=function(_0x1ea8a1,_0x5c16b0){return db[_0xf0e2('0x2f')]['find']({'where':{'id':_0x1ea8a1[_0xf0e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c16b0,null))[_0xf0e2('0x29')](removeEntity(_0x5c16b0,null))['catch'](handleError(_0x5c16b0,null));};exports[_0xf0e2('0x4d')]=function(_0x50cc90,_0x3bc81e,_0x14fce1){return db[_0xf0e2('0x4e')]['find']({'where':{'id':_0x50cc90[_0xf0e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bc81e,null))['then'](function(_0x567b3a){if(_0x567b3a){return _0x567b3a[_0xf0e2('0x4d')](_0x50cc90[_0xf0e2('0x4c')][_0xf0e2('0x4f')],_[_0xf0e2('0x50')](_0x50cc90[_0xf0e2('0x4c')],[_0xf0e2('0x4f'),'id'])||{});}})[_0xf0e2('0x29')](respondWithResult(_0x3bc81e,null))[_0xf0e2('0x45')](handleError(_0x3bc81e,null));};exports[_0xf0e2('0x51')]=function(_0x5f421a,_0x92fdbb,_0x37d64b){var _0x1d0620={};var _0x5f4279={};var _0x3dcc41;var _0x520793;return db[_0xf0e2('0x2f')][_0xf0e2('0x52')]({'where':{'id':_0x5f421a[_0xf0e2('0x47')]['id']}})[_0xf0e2('0x29')](handleEntityNotFound(_0x92fdbb,null))[_0xf0e2('0x29')](function(_0x559095){if(_0x559095){_0x3dcc41=_0x559095;_0x5f4279['model']=_[_0xf0e2('0x35')](db[_0xf0e2('0x4e')][_0xf0e2('0x30')]);_0x5f4279[_0xf0e2('0x34')]=_[_0xf0e2('0x35')](_0x5f421a['query']);_0x5f4279['filters']=_[_0xf0e2('0x36')](_0x5f4279[_0xf0e2('0x32')],_0x5f4279[_0xf0e2('0x34')]);_0x1d0620[_0xf0e2('0x38')]=_[_0xf0e2('0x36')](_0x5f4279[_0xf0e2('0x32')],qs[_0xf0e2('0x37')](_0x5f421a[_0xf0e2('0x34')][_0xf0e2('0x37')]));_0x1d0620[_0xf0e2('0x38')]=_0x1d0620[_0xf0e2('0x38')][_0xf0e2('0x48')]?_0x1d0620[_0xf0e2('0x38')]:_0x5f4279[_0xf0e2('0x32')];_0x1d0620[_0xf0e2('0x3b')]=qs[_0xf0e2('0x3c')](_0x5f421a['query'][_0xf0e2('0x3c')]);_0x1d0620[_0xf0e2('0x3f')]=qs[_0xf0e2('0x3d')](_[_0xf0e2('0x53')](_0x5f421a[_0xf0e2('0x34')],_0x5f4279[_0xf0e2('0x3d')]));if(_0x5f421a['query'][_0xf0e2('0x3e')]){_0x1d0620[_0xf0e2('0x3f')]=_[_0xf0e2('0x41')](_0x1d0620[_0xf0e2('0x3f')],{'$or':_[_0xf0e2('0x33')](_0x1d0620[_0xf0e2('0x38')],function(_0x5efd67){var _0x12c190={};_0x12c190[_0x5efd67]={'$like':'%'+_0x5f421a[_0xf0e2('0x34')][_0xf0e2('0x3e')]+'%'};return _0x12c190;})});}_0x1d0620=_[_0xf0e2('0x41')]({},_0x1d0620,_0x5f421a['options']);return _0x3dcc41['getConditions'](_0x1d0620);}})[_0xf0e2('0x29')](function(_0x4c5aff){if(_0x4c5aff){_0x520793=_0x4c5aff['length'];if(!_0x5f421a[_0xf0e2('0x34')]['hasOwnProperty'](_0xf0e2('0x3a'))){_0x1d0620[_0xf0e2('0x22')]=qs[_0xf0e2('0x22')](_0x5f421a[_0xf0e2('0x34')][_0xf0e2('0x22')]);_0x1d0620[_0xf0e2('0x20')]=qs['offset'](_0x5f421a[_0xf0e2('0x34')][_0xf0e2('0x20')]);}return _0x3dcc41[_0xf0e2('0x51')](_0x1d0620);}})[_0xf0e2('0x29')](function(_0xf4ea9){if(_0xf4ea9){return _0xf4ea9?{'count':_0x520793,'rows':_0xf4ea9}:null;}})[_0xf0e2('0x29')](respondWithResult(_0x92fdbb,null))[_0xf0e2('0x45')](handleError(_0x92fdbb,null));};exports[_0xf0e2('0x54')]=function(_0x2e4999,_0x311d4d,_0x263a6b){return db[_0xf0e2('0x55')]['find']({'where':{'id':_0x2e4999[_0xf0e2('0x47')]['id']}})[_0xf0e2('0x29')](handleEntityNotFound(_0x311d4d,null))[_0xf0e2('0x29')](function(_0x59c651){if(_0x59c651){return _0x59c651[_0xf0e2('0x54')](_0x2e4999[_0xf0e2('0x4c')][_0xf0e2('0x4f')],_[_0xf0e2('0x50')](_0x2e4999[_0xf0e2('0x4c')],[_0xf0e2('0x4f'),'id'])||{});}})[_0xf0e2('0x29')](respondWithResult(_0x311d4d,null))['catch'](handleError(_0x311d4d,null));};exports[_0xf0e2('0x56')]=function(_0x5c91c4,_0x495e6c,_0x4a3596){var _0x3e57e8={};var _0x9c880f={};var _0x34f828;var _0x22440c;return db['Automation'][_0xf0e2('0x52')]({'where':{'id':_0x5c91c4[_0xf0e2('0x47')]['id']}})[_0xf0e2('0x29')](handleEntityNotFound(_0x495e6c,null))['then'](function(_0x545a23){if(_0x545a23){_0x34f828=_0x545a23;_0x9c880f[_0xf0e2('0x32')]=_[_0xf0e2('0x35')](db[_0xf0e2('0x55')]['rawAttributes']);_0x9c880f[_0xf0e2('0x34')]=_[_0xf0e2('0x35')](_0x5c91c4[_0xf0e2('0x34')]);_0x9c880f[_0xf0e2('0x3d')]=_[_0xf0e2('0x36')](_0x9c880f[_0xf0e2('0x32')],_0x9c880f[_0xf0e2('0x34')]);_0x3e57e8[_0xf0e2('0x38')]=_[_0xf0e2('0x36')](_0x9c880f[_0xf0e2('0x32')],qs[_0xf0e2('0x37')](_0x5c91c4[_0xf0e2('0x34')][_0xf0e2('0x37')]));_0x3e57e8['attributes']=_0x3e57e8['attributes'][_0xf0e2('0x48')]?_0x3e57e8[_0xf0e2('0x38')]:_0x9c880f[_0xf0e2('0x32')];_0x3e57e8['order']=qs[_0xf0e2('0x3c')](_0x5c91c4['query']['sort']);_0x3e57e8['where']=qs[_0xf0e2('0x3d')](_[_0xf0e2('0x53')](_0x5c91c4[_0xf0e2('0x34')],_0x9c880f[_0xf0e2('0x3d')]));if(_0x5c91c4[_0xf0e2('0x34')]['filter']){_0x3e57e8['where']=_[_0xf0e2('0x41')](_0x3e57e8[_0xf0e2('0x3f')],{'$or':_[_0xf0e2('0x33')](_0x3e57e8[_0xf0e2('0x38')],function(_0x4307f7){var _0x325342={};_0x325342[_0x4307f7]={'$like':'%'+_0x5c91c4[_0xf0e2('0x34')][_0xf0e2('0x3e')]+'%'};return _0x325342;})});}_0x3e57e8=_[_0xf0e2('0x41')]({},_0x3e57e8,_0x5c91c4[_0xf0e2('0x57')]);return _0x34f828[_0xf0e2('0x56')](_0x3e57e8);}})['then'](function(_0x5b26c9){if(_0x5b26c9){_0x22440c=_0x5b26c9['length'];if(!_0x5c91c4['query'][_0xf0e2('0x39')]('nolimit')){_0x3e57e8['limit']=qs[_0xf0e2('0x22')](_0x5c91c4[_0xf0e2('0x34')][_0xf0e2('0x22')]);_0x3e57e8['offset']=qs[_0xf0e2('0x20')](_0x5c91c4['query'][_0xf0e2('0x20')]);}return _0x34f828['getActions'](_0x3e57e8);}})['then'](function(_0x593d87){if(_0x593d87){return _0x593d87?{'count':_0x22440c,'rows':_0x593d87}:null;}})[_0xf0e2('0x29')](respondWithResult(_0x495e6c,null))[_0xf0e2('0x45')](handleError(_0x495e6c,null));}; \ No newline at end of file +var _0x039c=['fast-json-patch','request-promise','moment','bluebird','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','create','body','update','find','Condition','ids','getConditions','findOne','addActions','omit','getActions','Action','eml-format','rimraf'];(function(_0x22224a,_0x1cdffd){var _0x10bd46=function(_0x4ab17e){while(--_0x4ab17e){_0x22224a['push'](_0x22224a['shift']());}};_0x10bd46(++_0x1cdffd);}(_0x039c,0x156));var _0xc039=function(_0x534879,_0x168540){_0x534879=_0x534879-0x0;var _0x4a50bb=_0x039c[_0x534879];return _0x4a50bb;};'use strict';var emlformat=require(_0xc039('0x0'));var rimraf=require(_0xc039('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc039('0x2'));var rp=require(_0xc039('0x3'));var moment=require(_0xc039('0x4'));var BPromise=require(_0xc039('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc039('0x6'));var sox=require('sox');var csv=require(_0xc039('0x7'));var ejs=require(_0xc039('0x8'));var fs=require('fs');var fs_extra=require(_0xc039('0x9'));var _=require(_0xc039('0xa'));var squel=require(_0xc039('0xb'));var crypto=require(_0xc039('0xc'));var jsforce=require(_0xc039('0xd'));var deskjs=require(_0xc039('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc039('0xf'));var Papa=require('papaparse');var Redis=require(_0xc039('0x10'));var authService=require(_0xc039('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc039('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc039('0x13'))(_0xc039('0x14'));var utils=require(_0xc039('0x15'));var config=require(_0xc039('0x16'));var licenseUtil=require(_0xc039('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x197410,_0x36ccd4){_0x36ccd4=_0x36ccd4||0xcc;return function(_0x5f22c8){if(_0x5f22c8){return _0x197410[_0xc039('0x18')](_0x36ccd4);}return _0x197410['status'](_0x36ccd4)[_0xc039('0x19')]();};}function respondWithResult(_0x4ab22d,_0x28ee80){_0x28ee80=_0x28ee80||0xc8;return function(_0x3f167e){if(_0x3f167e){return _0x4ab22d[_0xc039('0x1a')](_0x28ee80)[_0xc039('0x1b')](_0x3f167e);}};}function respondWithFilteredResult(_0x2eeeed,_0x40429f){return function(_0x1801f5){if(_0x1801f5){var _0x3f0c0a=typeof _0x40429f[_0xc039('0x1c')]===_0xc039('0x1d')&&typeof _0x40429f[_0xc039('0x1e')]===_0xc039('0x1d');var _0x40498c=_0x1801f5[_0xc039('0x1f')];var _0x22c3c6=_0x3f0c0a?0x0:_0x40429f[_0xc039('0x1c')];var _0x1b0f99=_0x3f0c0a?_0x1801f5[_0xc039('0x1f')]:_0x40429f[_0xc039('0x1c')]+_0x40429f[_0xc039('0x1e')];var _0xaa6cf2;if(_0x1b0f99>=_0x40498c){_0x1b0f99=_0x40498c;_0xaa6cf2=0xc8;}else{_0xaa6cf2=0xce;}_0x2eeeed['status'](_0xaa6cf2);return _0x2eeeed[_0xc039('0x20')](_0xc039('0x21'),_0x22c3c6+'-'+_0x1b0f99+'/'+_0x40498c)[_0xc039('0x1b')](_0x1801f5);}return null;};}function patchUpdates(_0x50905a){return function(_0x183dd8){try{jsonpatch[_0xc039('0x22')](_0x183dd8,_0x50905a,!![]);}catch(_0x2270bd){return BPromise[_0xc039('0x23')](_0x2270bd);}return _0x183dd8[_0xc039('0x24')]();};}function saveUpdates(_0x59e7f9,_0x1c4e5c){return function(_0x51f022){if(_0x51f022){return _0x51f022['update'](_0x59e7f9)[_0xc039('0x25')](function(_0x580163){return _0x580163;});}return null;};}function removeEntity(_0x54efbc,_0x1b17c7){return function(_0x779c3d){if(_0x779c3d){return _0x779c3d[_0xc039('0x26')]()[_0xc039('0x25')](function(){_0x54efbc[_0xc039('0x1a')](0xcc)[_0xc039('0x19')]();});}};}function handleEntityNotFound(_0x18143c,_0x62d501){return function(_0x428737){if(!_0x428737){_0x18143c[_0xc039('0x18')](0x194);}return _0x428737;};}function handleError(_0x22df9b,_0x10abc9){_0x10abc9=_0x10abc9||0x1f4;return function(_0x3d8e6b){logger[_0xc039('0x27')](_0x3d8e6b[_0xc039('0x28')]);if(_0x3d8e6b[_0xc039('0x29')]){delete _0x3d8e6b[_0xc039('0x29')];}_0x22df9b[_0xc039('0x1a')](_0x10abc9)[_0xc039('0x2a')](_0x3d8e6b);};}exports[_0xc039('0x2b')]=function(_0x1c91c2,_0x520f96){var _0x341543={},_0x1b2bef={},_0x495412={'count':0x0,'rows':[]};var _0x428149=_[_0xc039('0x2c')](db[_0xc039('0x2d')][_0xc039('0x2e')],function(_0x5a19a8){return{'name':_0x5a19a8[_0xc039('0x2f')],'type':_0x5a19a8[_0xc039('0x30')][_0xc039('0x31')]};});_0x1b2bef[_0xc039('0x32')]=_[_0xc039('0x2c')](_0x428149,_0xc039('0x29'));_0x1b2bef[_0xc039('0x33')]=_['keys'](_0x1c91c2[_0xc039('0x33')]);_0x1b2bef[_0xc039('0x34')]=_['intersection'](_0x1b2bef[_0xc039('0x32')],_0x1b2bef[_0xc039('0x33')]);_0x341543['attributes']=_[_0xc039('0x35')](_0x1b2bef[_0xc039('0x32')],qs[_0xc039('0x36')](_0x1c91c2[_0xc039('0x33')][_0xc039('0x36')]));_0x341543[_0xc039('0x37')]=_0x341543[_0xc039('0x37')][_0xc039('0x38')]?_0x341543[_0xc039('0x37')]:_0x1b2bef['model'];if(!_0x1c91c2[_0xc039('0x33')][_0xc039('0x39')](_0xc039('0x3a'))){_0x341543['limit']=qs[_0xc039('0x1e')](_0x1c91c2['query'][_0xc039('0x1e')]);_0x341543[_0xc039('0x1c')]=qs[_0xc039('0x1c')](_0x1c91c2['query'][_0xc039('0x1c')]);}_0x341543[_0xc039('0x3b')]=qs[_0xc039('0x3c')](_0x1c91c2[_0xc039('0x33')][_0xc039('0x3c')]);_0x341543[_0xc039('0x3d')]=qs[_0xc039('0x34')](_[_0xc039('0x3e')](_0x1c91c2[_0xc039('0x33')],_0x1b2bef[_0xc039('0x34')]),_0x428149);if(_0x1c91c2[_0xc039('0x33')]['filter']){_0x341543[_0xc039('0x3d')]=_[_0xc039('0x3f')](_0x341543[_0xc039('0x3d')],{'$or':_[_0xc039('0x2c')](_0x428149,function(_0x5e7e10){if(_0x5e7e10['type']!==_0xc039('0x40')){var _0x37145d={};_0x37145d[_0x5e7e10[_0xc039('0x29')]]={'$like':'%'+_0x1c91c2[_0xc039('0x33')][_0xc039('0x41')]+'%'};return _0x37145d;}})});}_0x341543=_[_0xc039('0x3f')]({},_0x341543,_0x1c91c2[_0xc039('0x42')]);var _0x113c89={'where':_0x341543[_0xc039('0x3d')]};return db[_0xc039('0x2d')]['count'](_0x113c89)[_0xc039('0x25')](function(_0x3eb2d8){_0x495412['count']=_0x3eb2d8;if(_0x1c91c2['query'][_0xc039('0x43')]){_0x341543[_0xc039('0x44')]=[{'all':!![]}];}return db['Automation'][_0xc039('0x45')](_0x341543);})[_0xc039('0x25')](function(_0x5f19cf){_0x495412[_0xc039('0x46')]=_0x5f19cf;return _0x495412;})[_0xc039('0x25')](respondWithFilteredResult(_0x520f96,_0x341543))[_0xc039('0x47')](handleError(_0x520f96,null));};exports['show']=function(_0x2a403f,_0x4dd281){var _0x8189e6={'raw':![],'where':{'id':_0x2a403f[_0xc039('0x48')]['id']}},_0x1ee41a={};_0x1ee41a[_0xc039('0x32')]=_[_0xc039('0x49')](db[_0xc039('0x2d')]['rawAttributes']);_0x1ee41a[_0xc039('0x33')]=_[_0xc039('0x49')](_0x2a403f['query']);_0x1ee41a[_0xc039('0x34')]=_[_0xc039('0x35')](_0x1ee41a[_0xc039('0x32')],_0x1ee41a['query']);_0x8189e6[_0xc039('0x37')]=_[_0xc039('0x35')](_0x1ee41a[_0xc039('0x32')],qs[_0xc039('0x36')](_0x2a403f[_0xc039('0x33')][_0xc039('0x36')]));_0x8189e6['attributes']=_0x8189e6['attributes'][_0xc039('0x38')]?_0x8189e6[_0xc039('0x37')]:_0x1ee41a[_0xc039('0x32')];if(_0x2a403f[_0xc039('0x33')][_0xc039('0x43')]){_0x8189e6['include']=[{'all':!![]}];}_0x8189e6=_['merge']({},_0x8189e6,_0x2a403f[_0xc039('0x42')]);return db[_0xc039('0x2d')]['find'](_0x8189e6)[_0xc039('0x25')](handleEntityNotFound(_0x4dd281,null))['then'](respondWithResult(_0x4dd281,null))[_0xc039('0x47')](handleError(_0x4dd281,null));};exports[_0xc039('0x4a')]=function(_0x2a7efd,_0x23da39){return db['Automation'][_0xc039('0x4a')](_0x2a7efd[_0xc039('0x4b')],{})[_0xc039('0x25')](respondWithResult(_0x23da39,0xc9))['catch'](handleError(_0x23da39,null));};exports[_0xc039('0x4c')]=function(_0x5e2beb,_0xe026d4){if(_0x5e2beb[_0xc039('0x4b')]['id']){delete _0x5e2beb[_0xc039('0x4b')]['id'];}return db[_0xc039('0x2d')][_0xc039('0x4d')]({'where':{'id':_0x5e2beb['params']['id']}})[_0xc039('0x25')](handleEntityNotFound(_0xe026d4,null))[_0xc039('0x25')](saveUpdates(_0x5e2beb['body'],null))[_0xc039('0x25')](respondWithResult(_0xe026d4,null))[_0xc039('0x47')](handleError(_0xe026d4,null));};exports[_0xc039('0x26')]=function(_0x34a0b6,_0x56cd6f){return db['Automation'][_0xc039('0x4d')]({'where':{'id':_0x34a0b6['params']['id']}})[_0xc039('0x25')](handleEntityNotFound(_0x56cd6f,null))[_0xc039('0x25')](removeEntity(_0x56cd6f,null))[_0xc039('0x47')](handleError(_0x56cd6f,null));};exports['addConditions']=function(_0x2597af,_0x26f29a,_0x4eb157){return db[_0xc039('0x4e')]['find']({'where':{'id':_0x2597af['params']['id']}})[_0xc039('0x25')](handleEntityNotFound(_0x26f29a,null))[_0xc039('0x25')](function(_0x3f3413){if(_0x3f3413){return _0x3f3413['addConditions'](_0x2597af[_0xc039('0x4b')][_0xc039('0x4f')],_['omit'](_0x2597af[_0xc039('0x4b')],[_0xc039('0x4f'),'id'])||{});}})[_0xc039('0x25')](respondWithResult(_0x26f29a,null))['catch'](handleError(_0x26f29a,null));};exports[_0xc039('0x50')]=function(_0x303e55,_0x5bdcc1,_0x4cd788){var _0x4c5b21={};var _0x51462a={};var _0x2be8bd;var _0x3f3bd2;return db[_0xc039('0x2d')][_0xc039('0x51')]({'where':{'id':_0x303e55['params']['id']}})[_0xc039('0x25')](handleEntityNotFound(_0x5bdcc1,null))[_0xc039('0x25')](function(_0x4f734f){if(_0x4f734f){_0x2be8bd=_0x4f734f;_0x51462a[_0xc039('0x32')]=_[_0xc039('0x49')](db[_0xc039('0x4e')][_0xc039('0x2e')]);_0x51462a['query']=_[_0xc039('0x49')](_0x303e55[_0xc039('0x33')]);_0x51462a['filters']=_[_0xc039('0x35')](_0x51462a['model'],_0x51462a[_0xc039('0x33')]);_0x4c5b21[_0xc039('0x37')]=_[_0xc039('0x35')](_0x51462a[_0xc039('0x32')],qs[_0xc039('0x36')](_0x303e55['query'][_0xc039('0x36')]));_0x4c5b21[_0xc039('0x37')]=_0x4c5b21[_0xc039('0x37')][_0xc039('0x38')]?_0x4c5b21[_0xc039('0x37')]:_0x51462a[_0xc039('0x32')];_0x4c5b21['order']=qs['sort'](_0x303e55[_0xc039('0x33')][_0xc039('0x3c')]);_0x4c5b21['where']=qs[_0xc039('0x34')](_[_0xc039('0x3e')](_0x303e55[_0xc039('0x33')],_0x51462a[_0xc039('0x34')]));if(_0x303e55[_0xc039('0x33')][_0xc039('0x41')]){_0x4c5b21[_0xc039('0x3d')]=_[_0xc039('0x3f')](_0x4c5b21[_0xc039('0x3d')],{'$or':_[_0xc039('0x2c')](_0x4c5b21[_0xc039('0x37')],function(_0x404c34){var _0x1b8dad={};_0x1b8dad[_0x404c34]={'$like':'%'+_0x303e55[_0xc039('0x33')][_0xc039('0x41')]+'%'};return _0x1b8dad;})});}_0x4c5b21=_['merge']({},_0x4c5b21,_0x303e55[_0xc039('0x42')]);return _0x2be8bd['getConditions'](_0x4c5b21);}})[_0xc039('0x25')](function(_0xfd6317){if(_0xfd6317){_0x3f3bd2=_0xfd6317[_0xc039('0x38')];if(!_0x303e55[_0xc039('0x33')]['hasOwnProperty'](_0xc039('0x3a'))){_0x4c5b21['limit']=qs[_0xc039('0x1e')](_0x303e55[_0xc039('0x33')][_0xc039('0x1e')]);_0x4c5b21[_0xc039('0x1c')]=qs[_0xc039('0x1c')](_0x303e55[_0xc039('0x33')][_0xc039('0x1c')]);}return _0x2be8bd[_0xc039('0x50')](_0x4c5b21);}})['then'](function(_0x429fd6){if(_0x429fd6){return _0x429fd6?{'count':_0x3f3bd2,'rows':_0x429fd6}:null;}})[_0xc039('0x25')](respondWithResult(_0x5bdcc1,null))[_0xc039('0x47')](handleError(_0x5bdcc1,null));};exports[_0xc039('0x52')]=function(_0x35d365,_0x54178e,_0xfd3ad9){return db['Action'][_0xc039('0x4d')]({'where':{'id':_0x35d365[_0xc039('0x48')]['id']}})[_0xc039('0x25')](handleEntityNotFound(_0x54178e,null))['then'](function(_0x1243fc){if(_0x1243fc){return _0x1243fc['addActions'](_0x35d365['body'][_0xc039('0x4f')],_[_0xc039('0x53')](_0x35d365[_0xc039('0x4b')],['ids','id'])||{});}})[_0xc039('0x25')](respondWithResult(_0x54178e,null))[_0xc039('0x47')](handleError(_0x54178e,null));};exports[_0xc039('0x54')]=function(_0x5ac962,_0x32fc4e,_0x157bfc){var _0x26248f={};var _0x425de4={};var _0x20b39e;var _0x20e120;return db[_0xc039('0x2d')][_0xc039('0x51')]({'where':{'id':_0x5ac962[_0xc039('0x48')]['id']}})[_0xc039('0x25')](handleEntityNotFound(_0x32fc4e,null))[_0xc039('0x25')](function(_0x34dcb4){if(_0x34dcb4){_0x20b39e=_0x34dcb4;_0x425de4['model']=_['keys'](db[_0xc039('0x55')][_0xc039('0x2e')]);_0x425de4[_0xc039('0x33')]=_[_0xc039('0x49')](_0x5ac962[_0xc039('0x33')]);_0x425de4['filters']=_['intersection'](_0x425de4[_0xc039('0x32')],_0x425de4[_0xc039('0x33')]);_0x26248f['attributes']=_[_0xc039('0x35')](_0x425de4[_0xc039('0x32')],qs[_0xc039('0x36')](_0x5ac962[_0xc039('0x33')][_0xc039('0x36')]));_0x26248f[_0xc039('0x37')]=_0x26248f[_0xc039('0x37')][_0xc039('0x38')]?_0x26248f[_0xc039('0x37')]:_0x425de4['model'];_0x26248f['order']=qs[_0xc039('0x3c')](_0x5ac962[_0xc039('0x33')][_0xc039('0x3c')]);_0x26248f['where']=qs['filters'](_['pick'](_0x5ac962[_0xc039('0x33')],_0x425de4[_0xc039('0x34')]));if(_0x5ac962['query'][_0xc039('0x41')]){_0x26248f['where']=_[_0xc039('0x3f')](_0x26248f[_0xc039('0x3d')],{'$or':_[_0xc039('0x2c')](_0x26248f[_0xc039('0x37')],function(_0x221e1b){var _0x5b397e={};_0x5b397e[_0x221e1b]={'$like':'%'+_0x5ac962[_0xc039('0x33')]['filter']+'%'};return _0x5b397e;})});}_0x26248f=_[_0xc039('0x3f')]({},_0x26248f,_0x5ac962[_0xc039('0x42')]);return _0x20b39e[_0xc039('0x54')](_0x26248f);}})['then'](function(_0x3610fb){if(_0x3610fb){_0x20e120=_0x3610fb[_0xc039('0x38')];if(!_0x5ac962[_0xc039('0x33')][_0xc039('0x39')](_0xc039('0x3a'))){_0x26248f['limit']=qs['limit'](_0x5ac962[_0xc039('0x33')]['limit']);_0x26248f[_0xc039('0x1c')]=qs['offset'](_0x5ac962[_0xc039('0x33')]['offset']);}return _0x20b39e[_0xc039('0x54')](_0x26248f);}})[_0xc039('0x25')](function(_0x168963){if(_0x168963){return _0x168963?{'count':_0x20e120,'rows':_0x168963}:null;}})[_0xc039('0x25')](respondWithResult(_0x32fc4e,null))[_0xc039('0x47')](handleError(_0x32fc4e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ea11fa7..a4c0d61 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 _0x15c7=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x498948,_0x559545){var _0x1dbf08=function(_0x4eca38){while(--_0x4eca38){_0x498948['push'](_0x498948['shift']());}};_0x1dbf08(++_0x559545);}(_0x15c7,0x1f4));var _0x715c=function(_0x2aa475,_0x21ec6b){_0x2aa475=_0x2aa475-0x0;var _0x4c0d06=_0x15c7[_0x2aa475];return _0x4c0d06;};'use strict';var _=require(_0x715c('0x0'));var util=require(_0x715c('0x1'));var logger=require(_0x715c('0x2'))(_0x715c('0x3'));var moment=require(_0x715c('0x4'));var BPromise=require('bluebird');var rp=require(_0x715c('0x5'));var fs=require('fs');var path=require(_0x715c('0x6'));var rimraf=require('rimraf');var config=require(_0x715c('0x7'));var attributes=require(_0x715c('0x8'));module[_0x715c('0x9')]=function(_0x467cf2,_0x28cd0e){return _0x467cf2[_0x715c('0xa')](_0x715c('0xb'),attributes,{'tableName':_0x715c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd76=['api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0xc7e25c,_0x27d0eb){var _0x45c9b2=function(_0x4f2651){while(--_0x4f2651){_0xc7e25c['push'](_0xc7e25c['shift']());}};_0x45c9b2(++_0x27d0eb);}(_0xdd76,0x169));var _0x6dd7=function(_0x3e3be4,_0x4f36aa){_0x3e3be4=_0x3e3be4-0x0;var _0xdfecee=_0xdd76[_0x3e3be4];return _0xdfecee;};'use strict';var _=require(_0x6dd7('0x0'));var util=require(_0x6dd7('0x1'));var logger=require(_0x6dd7('0x2'))(_0x6dd7('0x3'));var moment=require(_0x6dd7('0x4'));var BPromise=require(_0x6dd7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6dd7('0x6'));var rimraf=require(_0x6dd7('0x7'));var config=require(_0x6dd7('0x8'));var attributes=require(_0x6dd7('0x9'));module[_0x6dd7('0xa')]=function(_0x5ce212,_0x403a2d){return _0x5ce212[_0x6dd7('0xb')](_0x6dd7('0xc'),attributes,{'tableName':_0x6dd7('0xd'),'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 490bef7..19cec16 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 _0x36ee=['jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x39049e,_0x5018ec){var _0x46072a=function(_0x481a4c){while(--_0x481a4c){_0x39049e['push'](_0x39049e['shift']());}};_0x46072a(++_0x5018ec);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('Automation,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('Automation,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});} \ No newline at end of file +var _0xe61c=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0x5b3e0d,_0x3438e7){var _0x12b31d=function(_0x20a6ab){while(--_0x20a6ab){_0x5b3e0d['push'](_0x5b3e0d['shift']());}};_0x12b31d(++_0x3438e7);}(_0xe61c,0xee));var _0xce61=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xe61c[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var moment=require(_0xce61('0x1'));var BPromise=require(_0xce61('0x2'));var rs=require(_0xce61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce61('0x4'));var logger=require('../../config/logger')(_0xce61('0x5'));var config=require(_0xce61('0x6'));var jayson=require(_0xce61('0x7'));var client=jayson[_0xce61('0x8')][_0xce61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310203,_0x24528e,_0x5f1d02){return new BPromise(function(_0x2fad37,_0x4b52c3){return client[_0xce61('0xa')](_0x310203,_0x5f1d02)[_0xce61('0xb')](function(_0xa1a028){logger[_0xce61('0xc')](_0xce61('0xd'),_0x24528e,'request\x20sent');logger[_0xce61('0xe')](_0xce61('0xf'),_0x24528e,'request\x20sent',JSON[_0xce61('0x10')](_0xa1a028));if(_0xa1a028[_0xce61('0x11')]){if(_0xa1a028['error'][_0xce61('0x12')]===0x1f4){logger['error'](_0xce61('0xd'),_0x24528e,_0xa1a028[_0xce61('0x11')]['message']);return _0x4b52c3(_0xa1a028[_0xce61('0x11')]['message']);}logger[_0xce61('0x11')]('Automation,\x20%s,\x20%s',_0x24528e,_0xa1a028[_0xce61('0x11')][_0xce61('0x13')]);return _0x2fad37(_0xa1a028[_0xce61('0x11')][_0xce61('0x13')]);}else{logger[_0xce61('0xc')]('Automation,\x20%s,\x20%s',_0x24528e,'request\x20sent');_0x2fad37(_0xa1a028[_0xce61('0x14')]['message']);}})['catch'](function(_0x1977f6){logger[_0xce61('0x11')](_0xce61('0xd'),_0x24528e,_0x1977f6);_0x4b52c3(_0x1977f6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index fd25b4c..16e1a83 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 _0xabc7=['addConditions','addActions','put','update','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./automation.controller','get','index','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','create','post'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xabc7,0xc7));var _0x7abc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xabc7[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var path=require(_0x7abc('0x2'));var timeout=require('connect-timeout');var express=require(_0x7abc('0x3'));var router=express[_0x7abc('0x4')]();var fs_extra=require(_0x7abc('0x5'));var auth=require(_0x7abc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7abc('0x7'));router[_0x7abc('0x8')]('/',auth['isAuthenticated'](),controller[_0x7abc('0x9')]);router['get']('/:id',auth[_0x7abc('0xa')](),controller[_0x7abc('0xb')]);router[_0x7abc('0x8')](_0x7abc('0xc'),auth[_0x7abc('0xa')](),controller[_0x7abc('0xd')]);router[_0x7abc('0x8')](_0x7abc('0xe'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x7abc('0xa')](),controller[_0x7abc('0xf')]);router[_0x7abc('0x10')](_0x7abc('0xc'),auth[_0x7abc('0xa')](),controller[_0x7abc('0x11')]);router[_0x7abc('0x10')](_0x7abc('0xe'),auth['isAuthenticated'](),controller[_0x7abc('0x12')]);router[_0x7abc('0x13')]('/:id',auth[_0x7abc('0xa')](),controller[_0x7abc('0x14')]);router[_0x7abc('0x15')](_0x7abc('0x16'),auth[_0x7abc('0xa')](),controller[_0x7abc('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd04b=['update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions'];(function(_0x5f3016,_0x56e1a9){var _0x4207bd=function(_0x537beb){while(--_0x537beb){_0x5f3016['push'](_0x5f3016['shift']());}};_0x4207bd(++_0x56e1a9);}(_0xd04b,0x145));var _0xbd04=function(_0x3ce233,_0x4024f5){_0x3ce233=_0x3ce233-0x0;var _0xa0ed38=_0xd04b[_0x3ce233];return _0xa0ed38;};'use strict';var multer=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var path=require(_0xbd04('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd04('0x3'));var router=express['Router']();var fs_extra=require(_0xbd04('0x4'));var auth=require(_0xbd04('0x5'));var interaction=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var controller=require(_0xbd04('0x8'));router[_0xbd04('0x9')]('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0xb')]);router[_0xbd04('0x9')](_0xbd04('0xc'),auth[_0xbd04('0xa')](),controller['show']);router[_0xbd04('0x9')](_0xbd04('0xd'),auth[_0xbd04('0xa')](),controller[_0xbd04('0xe')]);router[_0xbd04('0x9')](_0xbd04('0xf'),auth[_0xbd04('0xa')](),controller[_0xbd04('0x10')]);router['post']('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0x11')]);router[_0xbd04('0x12')](_0xbd04('0xd'),auth['isAuthenticated'](),controller[_0xbd04('0x13')]);router[_0xbd04('0x12')](_0xbd04('0xf'),auth['isAuthenticated'](),controller['addActions']);router['put']('/:id',auth[_0xbd04('0xa')](),controller[_0xbd04('0x14')]);router[_0xbd04('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbd04('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 27a01e4..65aa386 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 _0x4255=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4255,0x1bb));var _0x5425=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x4255[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x5425('0x0'));module['exports']={'name':{'type':Sequelize[_0x5425('0x1')],'unique':_0x5425('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5425('0x3')](_0x5425('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5425('0x1')]},'active':{'type':Sequelize[_0x5425('0x5')],'defaultValue':0x0,'comment':_0x5425('0x6')},'limitCalls':{'type':Sequelize[_0x5425('0x7')](0x4)[_0x5425('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5425('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5425('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5425('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5425('0x7')](0x3)[_0x5425('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5425('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5425('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5425('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5425('0x7')](0x5)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5425('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5425('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5425('0x3')](_0x5425('0x11'),_0x5425('0x12'),_0x5425('0x13')),'defaultValue':_0x5425('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5425('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5425('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5425('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x5425('0x7')](0x9)[_0x5425('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5425('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5425('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5425('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5425('0x7')](0x9)[_0x5425('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5425('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5425('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5425('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5425('0x7')](0x9)[_0x5425('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5425('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5425('0x7')](0x5)[_0x5425('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5425('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5425('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5425('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5425('0x3')](_0x5425('0x1c'),_0x5425('0x1d')),'defaultValue':_0x5425('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5425('0x7')](0x3)[_0x5425('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5425('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5425('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5425('0x7')](0x3)[_0x5425('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5425('0x7')](0x5)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5425('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5425('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5425('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5425('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x5425('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5425('0x7')](0x3)[_0x5425('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5425('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5425('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5425('0x26')}}; \ No newline at end of file +var _0xa778=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x3b63c1,_0x2a4938){var _0x2771c0=function(_0x3a4b9){while(--_0x3a4b9){_0x3b63c1['push'](_0x3b63c1['shift']());}};_0x2771c0(++_0x2a4938);}(_0xa778,0x112));var _0x8a77=function(_0x7eda3a,_0x14bfdc){_0x7eda3a=_0x7eda3a-0x0;var _0x5015f8=_0xa778[_0x7eda3a];return _0x5015f8;};'use strict';var Sequelize=require(_0x8a77('0x0'));module[_0x8a77('0x1')]={'name':{'type':Sequelize[_0x8a77('0x2')],'unique':_0x8a77('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8a77('0x4')](_0x8a77('0x5')),'allowNull':![],'defaultValue':_0x8a77('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8a77('0x6')],'defaultValue':0x0,'comment':_0x8a77('0x7')},'limitCalls':{'type':Sequelize[_0x8a77('0x8')](0x4)[_0x8a77('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8a77('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8a77('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)[_0x8a77('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)[_0x8a77('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'comment':_0x8a77('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8a77('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x8a77('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x8a77('0x4')](_0x8a77('0x13'),_0x8a77('0x14'),'onlyIfOpen'),'defaultValue':_0x8a77('0x13')},'dialAMDActive':{'type':Sequelize[_0x8a77('0x6')],'defaultValue':0x0,'comment':_0x8a77('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8a77('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8a77('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8a77('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8a77('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8a77('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8a77('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8a77('0x8')](0x5)[_0x8a77('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8a77('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8a77('0x8')](0x9)[_0x8a77('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8a77('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8a77('0x4')](_0x8a77('0x1e'),_0x8a77('0x1f')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8a77('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8a77('0x20')},'dialCutDigit':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8a77('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8a77('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)[_0x8a77('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0x28')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8a77('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a77('0x29')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8a77('0x8')](0x3)[_0x8a77('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a77('0x2a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 80ddf64..107f6c0 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 _0x6351=['h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','role','userProfileId','getHoppers','findOne','CampaignId','CmHopper','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','scheduledAt','ListId','select','field','phone','NOW()','ContactId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','join','h.ContactId\x20=\x20ci.CmContactId'];(function(_0x27da73,_0x20c41f){var _0x45efca=function(_0x3fbabf){while(--_0x3fbabf){_0x27da73['push'](_0x27da73['shift']());}};_0x45efca(++_0x20c41f);}(_0x6351,0x12f));var _0x1635=function(_0x5a039f,_0x2c6ee6){_0x5a039f=_0x5a039f-0x0;var _0x304d1d=_0x6351[_0x5a039f];return _0x304d1d;};'use strict';var emlformat=require(_0x1635('0x0'));var rimraf=require(_0x1635('0x1'));var zipdir=require(_0x1635('0x2'));var jsonpatch=require(_0x1635('0x3'));var rp=require(_0x1635('0x4'));var moment=require(_0x1635('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1635('0x6'));var util=require(_0x1635('0x7'));var path=require(_0x1635('0x8'));var sox=require(_0x1635('0x9'));var csv=require(_0x1635('0xa'));var ejs=require(_0x1635('0xb'));var fs=require('fs');var fs_extra=require(_0x1635('0xc'));var _=require(_0x1635('0xd'));var squel=require('squel');var crypto=require(_0x1635('0xe'));var jsforce=require(_0x1635('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1635('0x10'));var Papa=require('papaparse');var Redis=require(_0x1635('0x11'));var authService=require(_0x1635('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1635('0x13'));var hardwareService=require(_0x1635('0x14'));var logger=require(_0x1635('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1635('0x16'));var db=require(_0x1635('0x17'))['db'];function respondWithStatusCode(_0xb8422d,_0x5b1e51){_0x5b1e51=_0x5b1e51||0xcc;return function(_0x4e6ba8){if(_0x4e6ba8){return _0xb8422d[_0x1635('0x18')](_0x5b1e51);}return _0xb8422d['status'](_0x5b1e51)[_0x1635('0x19')]();};}function respondWithResult(_0x3219b0,_0x322a32){_0x322a32=_0x322a32||0xc8;return function(_0x2784d2){if(_0x2784d2){return _0x3219b0[_0x1635('0x1a')](_0x322a32)['json'](_0x2784d2);}};}function respondWithFilteredResult(_0x5ba0b6,_0x1b8b9a){return function(_0x1f0b70){if(_0x1f0b70){var _0x4fd4f7=typeof _0x1b8b9a['offset']===_0x1635('0x1b')&&typeof _0x1b8b9a[_0x1635('0x1c')]===_0x1635('0x1b');var _0x3c17be=_0x1f0b70[_0x1635('0x1d')];var _0x255e49=_0x4fd4f7?0x0:_0x1b8b9a[_0x1635('0x1e')];var _0x4025d3=_0x4fd4f7?_0x1f0b70[_0x1635('0x1d')]:_0x1b8b9a['offset']+_0x1b8b9a[_0x1635('0x1c')];var _0x212a20;if(_0x4025d3>=_0x3c17be){_0x4025d3=_0x3c17be;_0x212a20=0xc8;}else{_0x212a20=0xce;}_0x5ba0b6[_0x1635('0x1a')](_0x212a20);return _0x5ba0b6['set'](_0x1635('0x1f'),_0x255e49+'-'+_0x4025d3+'/'+_0x3c17be)['json'](_0x1f0b70);}return null;};}function patchUpdates(_0x29fbbc){return function(_0x1e0f35){try{jsonpatch['apply'](_0x1e0f35,_0x29fbbc,!![]);}catch(_0x4e6232){return BPromise[_0x1635('0x20')](_0x4e6232);}return _0x1e0f35['save']();};}function saveUpdates(_0x5ca092,_0x4f363c){return function(_0x1dc850){if(_0x1dc850){return _0x1dc850[_0x1635('0x21')](_0x5ca092)[_0x1635('0x22')](function(_0x264b28){return _0x264b28;});}return null;};}function removeEntity(_0x15c07f,_0x4e147c){return function(_0x373f5d){if(_0x373f5d){return _0x373f5d[_0x1635('0x23')]()[_0x1635('0x22')](function(){var _0x2f35ac=_0x373f5d[_0x1635('0x24')]({'plain':!![]});var _0x23e393='IvrCampaigns';return db[_0x1635('0x25')]['destroy']({'where':{'type':_0x23e393,'resourceId':_0x2f35ac['id']}})[_0x1635('0x22')](function(){return _0x373f5d;});})[_0x1635('0x22')](function(){_0x15c07f[_0x1635('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aec56,_0x23f0c6){return function(_0x589303){if(!_0x589303){_0x4aec56[_0x1635('0x18')](0x194);}return _0x589303;};}function handleError(_0x44c8f3,_0xd9d7c4){_0xd9d7c4=_0xd9d7c4||0x1f4;return function(_0x3bff45){logger[_0x1635('0x26')](_0x3bff45[_0x1635('0x27')]);if(_0x3bff45[_0x1635('0x28')]){delete _0x3bff45['name'];}_0x44c8f3[_0x1635('0x1a')](_0xd9d7c4)['send'](_0x3bff45);};}exports['index']=function(_0x721482,_0x3d3981){var _0x49c06b={},_0x2c5420={},_0x3a0f54={'count':0x0,'rows':[]};var _0x42e909=_[_0x1635('0x29')](db[_0x1635('0x2a')][_0x1635('0x2b')],function(_0x26eddf){return{'name':_0x26eddf[_0x1635('0x2c')],'type':_0x26eddf[_0x1635('0x2d')][_0x1635('0x2e')]};});_0x2c5420[_0x1635('0x2f')]=_[_0x1635('0x29')](_0x42e909,_0x1635('0x28'));_0x2c5420[_0x1635('0x30')]=_[_0x1635('0x31')](_0x721482[_0x1635('0x30')]);_0x2c5420['filters']=_[_0x1635('0x32')](_0x2c5420[_0x1635('0x2f')],_0x2c5420['query']);_0x49c06b[_0x1635('0x33')]=_[_0x1635('0x32')](_0x2c5420[_0x1635('0x2f')],qs[_0x1635('0x34')](_0x721482[_0x1635('0x30')][_0x1635('0x34')]));_0x49c06b[_0x1635('0x33')]=_0x49c06b[_0x1635('0x33')][_0x1635('0x35')]?_0x49c06b['attributes']:_0x2c5420[_0x1635('0x2f')];if(!_0x721482[_0x1635('0x30')][_0x1635('0x36')](_0x1635('0x37'))){_0x49c06b[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x721482[_0x1635('0x30')][_0x1635('0x1c')]);_0x49c06b['offset']=qs[_0x1635('0x1e')](_0x721482['query'][_0x1635('0x1e')]);}_0x49c06b[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x721482['query'][_0x1635('0x39')]);_0x49c06b[_0x1635('0x3a')]=qs['filters'](_[_0x1635('0x3b')](_0x721482[_0x1635('0x30')],_0x2c5420[_0x1635('0x3c')]),_0x42e909);if(_0x721482['query'][_0x1635('0x3d')]){_0x49c06b['where']=_[_0x1635('0x3e')](_0x49c06b[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x42e909,function(_0x34e669){if(_0x34e669[_0x1635('0x2d')]!==_0x1635('0x3f')){var _0x1a2712={};_0x1a2712[_0x34e669[_0x1635('0x28')]]={'$like':'%'+_0x721482[_0x1635('0x30')][_0x1635('0x3d')]+'%'};return _0x1a2712;}})});}_0x49c06b=_[_0x1635('0x3e')]({},_0x49c06b,_0x721482['options']);var _0x56b3b6={'where':_0x49c06b['where']};return db[_0x1635('0x2a')][_0x1635('0x1d')](_0x56b3b6)[_0x1635('0x22')](function(_0x57215b){_0x3a0f54[_0x1635('0x1d')]=_0x57215b;if(_0x721482[_0x1635('0x30')][_0x1635('0x40')]){_0x49c06b[_0x1635('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x1635('0x42')](_0x49c06b);})['then'](function(_0x44db7b){_0x3a0f54['rows']=_0x44db7b;return _0x3a0f54;})['then'](respondWithFilteredResult(_0x3d3981,_0x49c06b))[_0x1635('0x43')](handleError(_0x3d3981,null));};exports[_0x1635('0x44')]=function(_0x574693,_0x183850){var _0x12b278={'raw':![],'where':{'id':_0x574693[_0x1635('0x45')]['id']}},_0x198922={};_0x198922[_0x1635('0x2f')]=_[_0x1635('0x31')](db[_0x1635('0x2a')][_0x1635('0x2b')]);_0x198922[_0x1635('0x30')]=_[_0x1635('0x31')](_0x574693['query']);_0x198922['filters']=_[_0x1635('0x32')](_0x198922[_0x1635('0x2f')],_0x198922['query']);_0x12b278[_0x1635('0x33')]=_['intersection'](_0x198922['model'],qs[_0x1635('0x34')](_0x574693[_0x1635('0x30')][_0x1635('0x34')]));_0x12b278[_0x1635('0x33')]=_0x12b278[_0x1635('0x33')]['length']?_0x12b278['attributes']:_0x198922[_0x1635('0x2f')];if(_0x574693[_0x1635('0x30')]['includeAll']){_0x12b278[_0x1635('0x41')]=[{'all':!![]}];}_0x12b278=_[_0x1635('0x3e')]({},_0x12b278,_0x574693['options']);return db[_0x1635('0x2a')][_0x1635('0x46')](_0x12b278)[_0x1635('0x22')](handleEntityNotFound(_0x183850,null))['then'](respondWithResult(_0x183850,null))[_0x1635('0x43')](handleError(_0x183850,null));};exports[_0x1635('0x47')]=function(_0x2e095d,_0x54a2f2){return db[_0x1635('0x2a')][_0x1635('0x47')](_0x2e095d[_0x1635('0x48')],{})[_0x1635('0x22')](function(_0x455e66){var _0x37c368=_0x2e095d[_0x1635('0x49')][_0x1635('0x24')]({'plain':!![]});if(!_0x37c368)throw new Error(_0x1635('0x4a'));if(_0x37c368['role']===_0x1635('0x49')){var _0x2d54e7=_0x455e66[_0x1635('0x24')]({'plain':!![]});var _0x389f4d=_0x1635('0x4b');return db[_0x1635('0x4c')]['find']({'where':{'name':_0x389f4d,'userProfileId':_0x37c368['userProfileId']},'raw':!![]})[_0x1635('0x22')](function(_0x1c364f){if(_0x1c364f&&_0x1c364f[_0x1635('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d54e7['name'],'resourceId':_0x2d54e7['id'],'type':_0x1c364f['name'],'sectionId':_0x1c364f['id']},{})['then'](function(){return _0x455e66;});}else{return _0x455e66;}})['catch'](function(_0x1fa994){logger['error'](_0x1635('0x4e'),_0x1fa994);throw _0x1fa994;});}return _0x455e66;})[_0x1635('0x22')](respondWithResult(_0x54a2f2,0xc9))[_0x1635('0x43')](handleError(_0x54a2f2,null));};exports[_0x1635('0x4f')]=function(_0x1a4f57,_0x3d4542){var _0x20570d={'where':{'id':_0x1a4f57[_0x1635('0x45')]['id']}},_0x50d866={};_0x50d866['model']=_['keys'](db[_0x1635('0x2a')]['rawAttributes']);_0x20570d[_0x1635('0x33')]=_[_0x1635('0x32')](_0x50d866[_0x1635('0x2f')],qs[_0x1635('0x34')](_0x1a4f57['query'][_0x1635('0x34')]));_0x20570d[_0x1635('0x33')]=_0x20570d[_0x1635('0x33')]['length']?_0x20570d[_0x1635('0x33')]:_0x50d866[_0x1635('0x2f')];if(_0x1a4f57[_0x1635('0x30')][_0x1635('0x40')]){_0x20570d[_0x1635('0x41')]=[{'all':!![]}];}_0x20570d=_[_0x1635('0x3e')]({},_0x20570d,_0x1a4f57[_0x1635('0x50')]);return db['Campaign']['find'](_0x20570d)[_0x1635('0x22')](handleEntityNotFound(_0x3d4542,null))[_0x1635('0x22')](function(_0x5c240b){if(_0x5c240b){var _0xfef8cf=_0x5c240b[_0x1635('0x24')]({'plain':!![]});_0xfef8cf=qs[_0x1635('0x51')](_0xfef8cf,['id',_0x1635('0x52'),_0x1635('0x53')]);_0x1a4f57[_0x1635('0x48')]=_['omit'](_0x1a4f57[_0x1635('0x48')],['id','createdAt',_0x1635('0x53')]);return db[_0x1635('0x2a')]['create'](_[_0x1635('0x3e')](_0xfef8cf,_0x1a4f57[_0x1635('0x48')]),{'include':_0x1a4f57[_0x1635('0x30')][_0x1635('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x52106b){var _0x10bdc4=_0x1a4f57[_0x1635('0x49')][_0x1635('0x24')]({'plain':!![]});if(!_0x10bdc4)throw new Error(_0x1635('0x4a'));if(_0x10bdc4[_0x1635('0x54')]==='user'){var _0x427919=_0x52106b[_0x1635('0x24')]({'plain':!![]});var _0xe82a14=_0x1635('0x4b');return db[_0x1635('0x4c')][_0x1635('0x46')]({'where':{'name':_0xe82a14,'userProfileId':_0x10bdc4[_0x1635('0x55')]},'raw':!![]})[_0x1635('0x22')](function(_0x1d8232){if(_0x1d8232&&_0x1d8232[_0x1635('0x4d')]===0x0){return db[_0x1635('0x25')][_0x1635('0x47')]({'name':_0x427919['name'],'resourceId':_0x427919['id'],'type':_0x1d8232[_0x1635('0x28')],'sectionId':_0x1d8232['id']},{})[_0x1635('0x22')](function(){return _0x52106b;});}else{return _0x52106b;}})['catch'](function(_0x3b9a9b){logger[_0x1635('0x26')](_0x1635('0x4e'),_0x3b9a9b);throw _0x3b9a9b;});}return _0x52106b;});}})[_0x1635('0x22')](respondWithResult(_0x3d4542,0xc9))['catch'](handleError(_0x3d4542,null));};exports['update']=function(_0x340e67,_0x37458a){if(_0x340e67[_0x1635('0x48')]['id']){delete _0x340e67[_0x1635('0x48')]['id'];}return db[_0x1635('0x2a')][_0x1635('0x46')]({'where':{'id':_0x340e67[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x37458a,null))[_0x1635('0x22')](saveUpdates(_0x340e67[_0x1635('0x48')],null))['then'](respondWithResult(_0x37458a,null))[_0x1635('0x43')](handleError(_0x37458a,null));};exports[_0x1635('0x23')]=function(_0x2c636c,_0x135e81){return db['Campaign'][_0x1635('0x46')]({'where':{'id':_0x2c636c['params']['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x135e81,null))[_0x1635('0x22')](removeEntity(_0x135e81,null))[_0x1635('0x43')](handleError(_0x135e81,null));};exports[_0x1635('0x56')]=function(_0x3ec5b9,_0x8143cf,_0x4a8e7a){var _0x48913f={'raw':!![],'where':{}};var _0x27b3e7={};var _0x22a501={'count':0x0,'rows':[]};return db[_0x1635('0x2a')][_0x1635('0x57')]({'where':{'id':_0x3ec5b9[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x8143cf,null))[_0x1635('0x22')](function(_0x38b75e){if(_0x38b75e){_0x27b3e7[_0x1635('0x2f')]=_[_0x1635('0x31')](db['CmHopper'][_0x1635('0x2b')]);_0x27b3e7[_0x1635('0x30')]=_[_0x1635('0x31')](_0x3ec5b9['query']);_0x27b3e7['filters']=_[_0x1635('0x32')](_0x27b3e7['model'],_0x27b3e7[_0x1635('0x30')]);_0x48913f[_0x1635('0x33')]=_[_0x1635('0x32')](_0x27b3e7[_0x1635('0x2f')],qs[_0x1635('0x34')](_0x3ec5b9[_0x1635('0x30')][_0x1635('0x34')]));_0x48913f[_0x1635('0x33')]=_0x48913f['attributes'][_0x1635('0x35')]?_0x48913f[_0x1635('0x33')]:_0x27b3e7[_0x1635('0x2f')];if(!_0x3ec5b9[_0x1635('0x30')][_0x1635('0x36')]('nolimit')){_0x48913f[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x3ec5b9[_0x1635('0x30')][_0x1635('0x1c')]);_0x48913f[_0x1635('0x1e')]=qs[_0x1635('0x1e')](_0x3ec5b9[_0x1635('0x30')][_0x1635('0x1e')]);}_0x48913f[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x3ec5b9[_0x1635('0x30')]['sort']);_0x48913f[_0x1635('0x3a')]=qs[_0x1635('0x3c')](_['pick'](_0x3ec5b9[_0x1635('0x30')],_0x27b3e7[_0x1635('0x3c')]));_0x48913f[_0x1635('0x3a')][_0x1635('0x58')]=_0x38b75e['id'];if(_0x3ec5b9['query']['filter']){_0x48913f['where']=_['merge'](_0x48913f[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x48913f[_0x1635('0x33')],function(_0x33b67e){var _0x547799={};_0x547799[_0x33b67e]={'$like':'%'+_0x3ec5b9[_0x1635('0x30')]['filter']+'%'};return _0x547799;})});}_0x48913f=_[_0x1635('0x3e')]({},_0x48913f,_0x3ec5b9['options']);return db[_0x1635('0x59')][_0x1635('0x1d')]({'where':_0x48913f['where']})[_0x1635('0x22')](function(_0x4ac58a){_0x22a501[_0x1635('0x1d')]=_0x4ac58a;if(_0x3ec5b9[_0x1635('0x30')]['includeAll']){_0x48913f[_0x1635('0x41')]=[{'all':!![]}];}return db[_0x1635('0x59')][_0x1635('0x42')](_0x48913f);})[_0x1635('0x22')](function(_0x505ae4){_0x22a501[_0x1635('0x5a')]=_0x505ae4;return _0x22a501;});}})[_0x1635('0x22')](respondWithFilteredResult(_0x8143cf,_0x48913f))[_0x1635('0x43')](handleError(_0x8143cf,null));};exports['getHopperHistories']=function(_0x21c30a,_0x35c127,_0x3bef5f){var _0x278790={'raw':!![],'where':{}};var _0x1594d5={};var _0x2ee4d0={'count':0x0,'rows':[]};return db['Campaign'][_0x1635('0x57')]({'where':{'id':_0x21c30a[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x35c127,null))[_0x1635('0x22')](function(_0x988b3f){if(_0x988b3f){_0x1594d5['model']=_['keys'](db[_0x1635('0x5b')]['rawAttributes']);_0x1594d5['query']=_[_0x1635('0x31')](_0x21c30a[_0x1635('0x30')]);_0x1594d5[_0x1635('0x3c')]=_['intersection'](_0x1594d5[_0x1635('0x2f')],_0x1594d5[_0x1635('0x30')]);_0x278790[_0x1635('0x33')]=_[_0x1635('0x32')](_0x1594d5['model'],qs[_0x1635('0x34')](_0x21c30a[_0x1635('0x30')][_0x1635('0x34')]));_0x278790[_0x1635('0x33')]=_0x278790[_0x1635('0x33')]['length']?_0x278790[_0x1635('0x33')]:_0x1594d5[_0x1635('0x2f')];if(!_0x21c30a['query'][_0x1635('0x36')](_0x1635('0x37'))){_0x278790[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x21c30a[_0x1635('0x30')][_0x1635('0x1c')]);_0x278790[_0x1635('0x1e')]=qs['offset'](_0x21c30a[_0x1635('0x30')][_0x1635('0x1e')]);}_0x278790['order']=qs[_0x1635('0x39')](_0x21c30a[_0x1635('0x30')][_0x1635('0x39')]);_0x278790[_0x1635('0x3a')]=qs[_0x1635('0x3c')](_[_0x1635('0x3b')](_0x21c30a[_0x1635('0x30')],_0x1594d5[_0x1635('0x3c')]));_0x278790[_0x1635('0x3a')][_0x1635('0x58')]=_0x988b3f['id'];if(_0x21c30a[_0x1635('0x30')][_0x1635('0x3d')]){_0x278790['where']=_['merge'](_0x278790[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x278790[_0x1635('0x33')],function(_0x415e34){var _0x122a67={};_0x122a67[_0x415e34]={'$like':'%'+_0x21c30a['query'][_0x1635('0x3d')]+'%'};return _0x122a67;})});}_0x278790=_[_0x1635('0x3e')]({},_0x278790,_0x21c30a[_0x1635('0x50')]);return db[_0x1635('0x5b')][_0x1635('0x1d')]({'where':_0x278790[_0x1635('0x3a')]})['then'](function(_0x1f4cb1){_0x2ee4d0[_0x1635('0x1d')]=_0x1f4cb1;if(_0x21c30a['query']['includeAll']){_0x278790[_0x1635('0x41')]=[{'all':!![]}];}return db[_0x1635('0x5b')][_0x1635('0x42')](_0x278790);})['then'](function(_0x803231){_0x2ee4d0[_0x1635('0x5a')]=_0x803231;return _0x2ee4d0;});}})['then'](respondWithFilteredResult(_0x35c127,_0x278790))['catch'](handleError(_0x35c127,null));};exports[_0x1635('0x5c')]=function(_0x4f7d8a,_0x556a5c,_0xcfc7ae){var _0x290224={'raw':!![],'where':{}};var _0xff5d38={};var _0x15ac98={'count':0x0,'rows':[]};return db[_0x1635('0x2a')]['findOne']({'where':{'id':_0x4f7d8a[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x556a5c,null))['then'](function(_0x5cf2db){if(_0x5cf2db){_0xff5d38[_0x1635('0x2f')]=_[_0x1635('0x31')](db[_0x1635('0x5d')][_0x1635('0x2b')]);_0xff5d38[_0x1635('0x30')]=_[_0x1635('0x31')](_0x4f7d8a[_0x1635('0x30')]);_0xff5d38[_0x1635('0x3c')]=_['intersection'](_0xff5d38[_0x1635('0x2f')],_0xff5d38['query']);_0x290224[_0x1635('0x33')]=_[_0x1635('0x32')](_0xff5d38[_0x1635('0x2f')],qs['fields'](_0x4f7d8a[_0x1635('0x30')][_0x1635('0x34')]));_0x290224['attributes']=_0x290224[_0x1635('0x33')][_0x1635('0x35')]?_0x290224['attributes']:_0xff5d38[_0x1635('0x2f')];if(!_0x4f7d8a[_0x1635('0x30')][_0x1635('0x36')]('nolimit')){_0x290224[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x4f7d8a[_0x1635('0x30')][_0x1635('0x1c')]);_0x290224[_0x1635('0x1e')]=qs[_0x1635('0x1e')](_0x4f7d8a[_0x1635('0x30')][_0x1635('0x1e')]);}_0x290224[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x4f7d8a[_0x1635('0x30')]['sort']);_0x290224[_0x1635('0x3a')]=qs[_0x1635('0x3c')](_[_0x1635('0x3b')](_0x4f7d8a[_0x1635('0x30')],_0xff5d38[_0x1635('0x3c')]));_0x290224['where']['CampaignId']=_0x5cf2db['id'];if(_0x4f7d8a[_0x1635('0x30')][_0x1635('0x3d')]){_0x290224[_0x1635('0x3a')]=_['merge'](_0x290224[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x290224[_0x1635('0x33')],function(_0x4195cb){var _0x2e13b1={};_0x2e13b1[_0x4195cb]={'$like':'%'+_0x4f7d8a['query'][_0x1635('0x3d')]+'%'};return _0x2e13b1;})});}_0x290224=_['merge']({},_0x290224,_0x4f7d8a['options']);return db[_0x1635('0x5d')][_0x1635('0x1d')]({'where':_0x290224[_0x1635('0x3a')]})['then'](function(_0x4d6e33){_0x15ac98[_0x1635('0x1d')]=_0x4d6e33;if(_0x4f7d8a[_0x1635('0x30')][_0x1635('0x40')]){_0x290224[_0x1635('0x41')]=[{'all':!![]}];}return db[_0x1635('0x5d')][_0x1635('0x42')](_0x290224);})[_0x1635('0x22')](function(_0x54e00c){_0x15ac98['rows']=_0x54e00c;return _0x15ac98;});}})['then'](respondWithFilteredResult(_0x556a5c,_0x290224))[_0x1635('0x43')](handleError(_0x556a5c,null));};exports[_0x1635('0x5e')]=function(_0x28701f,_0x2d624b,_0x4ac835){var _0x5ae668={'raw':!![],'where':{}};var _0x31ee8c={};var _0x551e71={'count':0x0,'rows':[]};return db[_0x1635('0x2a')][_0x1635('0x57')]({'where':{'id':_0x28701f[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x2d624b,null))['then'](function(_0x207dda){if(_0x207dda){_0x31ee8c['model']=_[_0x1635('0x31')](db['CmHopperBlack'][_0x1635('0x2b')]);_0x31ee8c[_0x1635('0x30')]=_[_0x1635('0x31')](_0x28701f[_0x1635('0x30')]);_0x31ee8c[_0x1635('0x3c')]=_[_0x1635('0x32')](_0x31ee8c['model'],_0x31ee8c[_0x1635('0x30')]);_0x5ae668[_0x1635('0x33')]=_['intersection'](_0x31ee8c[_0x1635('0x2f')],qs[_0x1635('0x34')](_0x28701f['query'][_0x1635('0x34')]));_0x5ae668[_0x1635('0x33')]=_0x5ae668['attributes'][_0x1635('0x35')]?_0x5ae668[_0x1635('0x33')]:_0x31ee8c['model'];if(!_0x28701f[_0x1635('0x30')][_0x1635('0x36')](_0x1635('0x37'))){_0x5ae668['limit']=qs[_0x1635('0x1c')](_0x28701f[_0x1635('0x30')][_0x1635('0x1c')]);_0x5ae668['offset']=qs['offset'](_0x28701f[_0x1635('0x30')][_0x1635('0x1e')]);}_0x5ae668[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x28701f['query'][_0x1635('0x39')]);_0x5ae668[_0x1635('0x3a')]=qs[_0x1635('0x3c')](_['pick'](_0x28701f[_0x1635('0x30')],_0x31ee8c[_0x1635('0x3c')]));_0x5ae668[_0x1635('0x3a')][_0x1635('0x58')]=_0x207dda['id'];if(_0x28701f[_0x1635('0x30')]['filter']){_0x5ae668['where']=_[_0x1635('0x3e')](_0x5ae668[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x5ae668[_0x1635('0x33')],function(_0x2a9389){var _0x386563={};_0x386563[_0x2a9389]={'$like':'%'+_0x28701f['query'][_0x1635('0x3d')]+'%'};return _0x386563;})});}_0x5ae668=_[_0x1635('0x3e')]({},_0x5ae668,_0x28701f[_0x1635('0x50')]);return db[_0x1635('0x5f')]['count']({'where':_0x5ae668[_0x1635('0x3a')]})[_0x1635('0x22')](function(_0x428426){_0x551e71[_0x1635('0x1d')]=_0x428426;if(_0x28701f['query']['includeAll']){_0x5ae668[_0x1635('0x41')]=[{'all':!![]}];}return db[_0x1635('0x5f')][_0x1635('0x42')](_0x5ae668);})[_0x1635('0x22')](function(_0x1dfda8){_0x551e71['rows']=_0x1dfda8;return _0x551e71;});}})['then'](respondWithFilteredResult(_0x2d624b,_0x5ae668))[_0x1635('0x43')](handleError(_0x2d624b,null));};exports[_0x1635('0x60')]=function(_0x4b0661,_0x5c6751,_0xcc19a2){var _0x39a8ce={};var _0x93b3f3={};var _0x564bad;var _0x2a0b66;return db[_0x1635('0x2a')][_0x1635('0x57')]({'where':{'id':_0x4b0661[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x5c6751,null))[_0x1635('0x22')](function(_0x22798e){if(_0x22798e){_0x564bad=_0x22798e;_0x93b3f3[_0x1635('0x2f')]=_[_0x1635('0x31')](db[_0x1635('0x61')]['rawAttributes']);_0x93b3f3[_0x1635('0x30')]=_['keys'](_0x4b0661[_0x1635('0x30')]);_0x93b3f3['filters']=_[_0x1635('0x32')](_0x93b3f3[_0x1635('0x2f')],_0x93b3f3[_0x1635('0x30')]);_0x39a8ce['attributes']=_[_0x1635('0x32')](_0x93b3f3['model'],qs['fields'](_0x4b0661[_0x1635('0x30')]['fields']));_0x39a8ce[_0x1635('0x33')]=_0x39a8ce['attributes']['length']?_0x39a8ce[_0x1635('0x33')]:_0x93b3f3[_0x1635('0x2f')];_0x39a8ce[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x4b0661[_0x1635('0x30')][_0x1635('0x39')]);_0x39a8ce[_0x1635('0x3a')]=qs[_0x1635('0x3c')](_['pick'](_0x4b0661[_0x1635('0x30')],_0x93b3f3['filters']));if(_0x4b0661['query'][_0x1635('0x3d')]){_0x39a8ce[_0x1635('0x3a')]=_[_0x1635('0x3e')](_0x39a8ce[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x39a8ce['attributes'],function(_0x48a807){var _0x2ef1cb={};_0x2ef1cb[_0x48a807]={'$like':'%'+_0x4b0661[_0x1635('0x30')][_0x1635('0x3d')]+'%'};return _0x2ef1cb;})});}_0x39a8ce=_[_0x1635('0x3e')]({},_0x39a8ce,_0x4b0661[_0x1635('0x50')]);return _0x564bad[_0x1635('0x60')](_0x39a8ce);}})['then'](function(_0x18d487){if(_0x18d487){_0x2a0b66=_0x18d487['length'];if(!_0x4b0661[_0x1635('0x30')][_0x1635('0x36')]('nolimit')){_0x39a8ce[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x4b0661[_0x1635('0x30')][_0x1635('0x1c')]);_0x39a8ce[_0x1635('0x1e')]=qs[_0x1635('0x1e')](_0x4b0661[_0x1635('0x30')]['offset']);}return _0x564bad['getLists'](_0x39a8ce);}})[_0x1635('0x22')](function(_0x5bcc34){if(_0x5bcc34){return _0x5bcc34?{'count':_0x2a0b66,'rows':_0x5bcc34}:null;}})[_0x1635('0x22')](respondWithResult(_0x5c6751,null))[_0x1635('0x43')](handleError(_0x5c6751,null));};exports[_0x1635('0x62')]=function(_0x41abaf,_0x3344fc,_0x1a648f){var _0x2ba67f,_0x270319;var _0x54c267=[];var _0x4d9bff=moment()['format'](_0x1635('0x63'));return db[_0x1635('0x2a')][_0x1635('0x46')]({'where':{'id':_0x41abaf[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x3344fc,null))[_0x1635('0x22')](function(_0x8b2bc8){if(_0x8b2bc8){_0x270319=_0x8b2bc8;return _0x8b2bc8[_0x1635('0x62')](_0x41abaf[_0x1635('0x48')]['ids'],_[_0x1635('0x51')](_0x41abaf[_0x1635('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x23190b){var _0x5515a9;var _0x2aadd4;_0x2ba67f=_0x23190b||[];var _0x1f0f79=[];if(_0x23190b){for(var _0x53e245=0x0;_0x53e245<_0x23190b[_0x1635('0x35')];_0x53e245+=0x1){var _0x314122=_0x23190b[_0x53e245][_0x1635('0x24')]({'plain':!![]});_0x270319['dialCheckDuplicateType']=_0x41abaf[_0x1635('0x48')][_0x1635('0x64')]?_0x41abaf[_0x1635('0x48')]['dialCheckDuplicateType']:_0x270319[_0x1635('0x64')];switch(_0x270319[_0x1635('0x64')]){case _0x1635('0x65'):_0x5515a9=squel[_0x1635('0x66')]()['into'](_0x1635('0x67'))['fromQuery'](['phone',_0x1635('0x68'),'ContactId',_0x1635('0x69'),_0x1635('0x58'),'createdAt','updatedAt'],squel[_0x1635('0x6a')]()[_0x1635('0x6b')]('phone',_0x1635('0x6c'))[_0x1635('0x6b')](_0x1635('0x6d'),_0x1635('0x68'))[_0x1635('0x6b')]('id',_0x1635('0x6e'))[_0x1635('0x6b')](_0x314122['CmListId']['toString'](),_0x1635('0x69'))[_0x1635('0x6b')](_0x41abaf[_0x1635('0x45')]['id'][_0x1635('0x6f')](),_0x1635('0x58'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x52'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x53'))[_0x1635('0x70')]('cm_contacts')['where'](_0x1635('0x71'))[_0x1635('0x3a')](_0x1635('0x72'),_0x314122[_0x1635('0x73')]['toString']())[_0x1635('0x3a')](_0x1635('0x74'))[_0x1635('0x3a')](_0x1635('0x75'),squel[_0x1635('0x6a')]()[_0x1635('0x6b')](_0x1635('0x76'))['from']('cm_hopper_final')[_0x1635('0x3a')](_0x1635('0x77'),_0x41abaf[_0x1635('0x45')]['id']['toString']()))['where'](_0x1635('0x75'),squel[_0x1635('0x6a')]()[_0x1635('0x6b')](_0x1635('0x78'))['from'](_0x1635('0x67'))[_0x1635('0x3a')](_0x1635('0x77'),_0x41abaf['params']['id']['toString']())))[_0x1635('0x6f')]();break;case _0x1635('0x79'):_0x5515a9=squel[_0x1635('0x66')]()['into'](_0x1635('0x67'))[_0x1635('0x7a')]([_0x1635('0x6c'),_0x1635('0x68'),_0x1635('0x6e'),'ListId',_0x1635('0x58'),'createdAt',_0x1635('0x53')],squel[_0x1635('0x6a')]()[_0x1635('0x6b')]('phone',_0x1635('0x6c'))[_0x1635('0x6b')](_0x1635('0x6d'),_0x1635('0x68'))[_0x1635('0x6b')]('id',_0x1635('0x6e'))[_0x1635('0x6b')](_0x314122[_0x1635('0x73')][_0x1635('0x6f')](),_0x1635('0x69'))[_0x1635('0x6b')](_0x41abaf[_0x1635('0x45')]['id'][_0x1635('0x6f')](),_0x1635('0x58'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x52'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x53'))[_0x1635('0x70')](_0x1635('0x7b'))[_0x1635('0x3a')](_0x1635('0x71'))[_0x1635('0x3a')]('ListId\x20=\x20?',_0x314122['CmListId'][_0x1635('0x6f')]())['where'](_0x1635('0x74'))['where'](_0x1635('0x75'),squel[_0x1635('0x6a')]()[_0x1635('0x6b')](_0x1635('0x78'))[_0x1635('0x70')](_0x1635('0x67'))[_0x1635('0x3a')](_0x1635('0x77'),_0x41abaf[_0x1635('0x45')]['id'][_0x1635('0x6f')]())))[_0x1635('0x6f')]();break;default:_0x5515a9=squel[_0x1635('0x66')]()[_0x1635('0x7c')](_0x1635('0x67'))[_0x1635('0x7a')]([_0x1635('0x6c'),_0x1635('0x68'),_0x1635('0x6e'),_0x1635('0x69'),_0x1635('0x58'),_0x1635('0x52'),'updatedAt'],squel[_0x1635('0x6a')]()[_0x1635('0x6b')](_0x1635('0x6c'),_0x1635('0x6c'))[_0x1635('0x6b')](_0x1635('0x6d'),_0x1635('0x68'))[_0x1635('0x6b')]('id','ContactId')[_0x1635('0x6b')](_0x314122[_0x1635('0x73')][_0x1635('0x6f')](),_0x1635('0x69'))[_0x1635('0x6b')](_0x41abaf['params']['id'][_0x1635('0x6f')](),_0x1635('0x58'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x52'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27','updatedAt')[_0x1635('0x70')](_0x1635('0x7b'))[_0x1635('0x3a')](_0x1635('0x71'))[_0x1635('0x3a')](_0x1635('0x72'),_0x314122[_0x1635('0x73')][_0x1635('0x6f')]())[_0x1635('0x3a')](_0x1635('0x74')))['toString']();}_0x2aadd4=squel['insert']()['into'](_0x1635('0x7d'))['fromQuery']([_0x1635('0x7e'),_0x1635('0x68'),_0x1635('0x6c'),_0x1635('0x7f'),_0x1635('0x52'),'updatedAt'],squel[_0x1635('0x6a')]()[_0x1635('0x6b')](_0x1635('0x80'),'id')[_0x1635('0x6b')](_0x1635('0x6d'),_0x1635('0x68'))[_0x1635('0x6b')](_0x1635('0x81'),_0x1635('0x6c'))[_0x1635('0x6b')]('ci.OrderBY',_0x1635('0x7f'))[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27','createdAt')[_0x1635('0x6b')]('\x27'+_0x4d9bff+'\x27',_0x1635('0x53'))[_0x1635('0x70')]('cm_contact_has_items','ci')[_0x1635('0x82')]('cm_hopper','h',_0x1635('0x83'))[_0x1635('0x3a')](_0x1635('0x84'),_0x314122[_0x1635('0x73')]['toString']())[_0x1635('0x3a')](_0x1635('0x85'),_0x41abaf[_0x1635('0x45')]['id'][_0x1635('0x6f')]())[_0x1635('0x3a')](_0x1635('0x86'),_0x4d9bff))[_0x1635('0x6f')]();_0x1f0f79[_0x1635('0x87')](db[_0x1635('0x88')]['query'](_0x5515a9));_0x54c267[_0x1635('0x87')](db['sequelize'][_0x1635('0x30')](_0x2aadd4));}return BPromise[_0x1635('0x89')](_0x1f0f79);}})['then'](function(){return BPromise['all'](_0x54c267);})[_0x1635('0x22')](function(){return _0x2ba67f;})[_0x1635('0x22')](respondWithResult(_0x3344fc,null))['catch'](handleError(_0x3344fc,null));};exports[_0x1635('0x8a')]=function(_0x59bebd,_0xeb7a47,_0x46faf3){return db[_0x1635('0x2a')][_0x1635('0x46')]({'where':{'id':_0x59bebd[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0xeb7a47,null))[_0x1635('0x22')](function(_0x6b3611){if(_0x6b3611){return _0x6b3611[_0x1635('0x8a')](_0x59bebd['query'][_0x1635('0x8b')]);}})[_0x1635('0x22')](function(_0x11e95d){if(_0x11e95d){return db[_0x1635('0x59')][_0x1635('0x23')]({'where':{'ListId':_0x59bebd[_0x1635('0x30')][_0x1635('0x8b')],'CampaignId':_0x59bebd[_0x1635('0x45')]['id']}})[_0x1635('0x22')](function(){return _0x11e95d;});}})[_0x1635('0x22')](respondWithStatusCode(_0xeb7a47,null))[_0x1635('0x43')](handleError(_0xeb7a47,null));};exports[_0x1635('0x8c')]=function(_0x3dda37,_0x243703,_0x13d85d){var _0x426ec1={};var _0x29991e={};var _0x12c63b;var _0x2cc3ed;return db[_0x1635('0x2a')][_0x1635('0x57')]({'where':{'id':_0x3dda37['params']['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x243703,null))[_0x1635('0x22')](function(_0x3cc4f1){if(_0x3cc4f1){_0x12c63b=_0x3cc4f1;_0x29991e[_0x1635('0x2f')]=_[_0x1635('0x31')](db[_0x1635('0x61')][_0x1635('0x2b')]);_0x29991e[_0x1635('0x30')]=_[_0x1635('0x31')](_0x3dda37[_0x1635('0x30')]);_0x29991e['filters']=_[_0x1635('0x32')](_0x29991e[_0x1635('0x2f')],_0x29991e[_0x1635('0x30')]);_0x426ec1['attributes']=_[_0x1635('0x32')](_0x29991e[_0x1635('0x2f')],qs[_0x1635('0x34')](_0x3dda37[_0x1635('0x30')]['fields']));_0x426ec1[_0x1635('0x33')]=_0x426ec1[_0x1635('0x33')][_0x1635('0x35')]?_0x426ec1[_0x1635('0x33')]:_0x29991e[_0x1635('0x2f')];_0x426ec1[_0x1635('0x38')]=qs[_0x1635('0x39')](_0x3dda37[_0x1635('0x30')]['sort']);_0x426ec1['where']=qs['filters'](_[_0x1635('0x3b')](_0x3dda37[_0x1635('0x30')],_0x29991e[_0x1635('0x3c')]));if(_0x3dda37['query'][_0x1635('0x3d')]){_0x426ec1['where']=_[_0x1635('0x3e')](_0x426ec1[_0x1635('0x3a')],{'$or':_[_0x1635('0x29')](_0x426ec1[_0x1635('0x33')],function(_0x302373){var _0x3749a5={};_0x3749a5[_0x302373]={'$like':'%'+_0x3dda37['query'][_0x1635('0x3d')]+'%'};return _0x3749a5;})});}_0x426ec1=_[_0x1635('0x3e')]({},_0x426ec1,_0x3dda37[_0x1635('0x50')]);return _0x12c63b['getBlackLists'](_0x426ec1);}})['then'](function(_0x2c69b1){if(_0x2c69b1){_0x2cc3ed=_0x2c69b1[_0x1635('0x35')];if(!_0x3dda37[_0x1635('0x30')][_0x1635('0x36')](_0x1635('0x37'))){_0x426ec1[_0x1635('0x1c')]=qs[_0x1635('0x1c')](_0x3dda37[_0x1635('0x30')][_0x1635('0x1c')]);_0x426ec1[_0x1635('0x1e')]=qs[_0x1635('0x1e')](_0x3dda37[_0x1635('0x30')]['offset']);}return _0x12c63b[_0x1635('0x8c')](_0x426ec1);}})['then'](function(_0x4c558a){if(_0x4c558a){return _0x4c558a?{'count':_0x2cc3ed,'rows':_0x4c558a}:null;}})[_0x1635('0x22')](respondWithResult(_0x243703,null))[_0x1635('0x43')](handleError(_0x243703,null));};exports[_0x1635('0x8d')]=function(_0x32ea66,_0x3a0296,_0xb99c17){var _0x1f9b1c,_0x351368;var _0xba2a71=[];var _0x1f723f=moment()['format'](_0x1635('0x63'));return db['Campaign'][_0x1635('0x46')]({'where':{'id':_0x32ea66[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x3a0296,null))[_0x1635('0x22')](function(_0x1bf575){if(_0x1bf575){_0x351368=_0x1bf575;return _0x1bf575[_0x1635('0x8d')](_0x32ea66[_0x1635('0x48')][_0x1635('0x8b')],_[_0x1635('0x51')](_0x32ea66[_0x1635('0x48')],[_0x1635('0x8b'),'id'])||{});}return null;})[_0x1635('0x8e')](function(_0x5e373d){var _0x3c5202;var _0x3e6ad7;_0x1f9b1c=_0x5e373d||[];var _0x27dfc9=[];if(_0x5e373d){for(var _0x174165=0x0;_0x174165<_0x5e373d[_0x1635('0x35')];_0x174165+=0x1){var _0xe50c28=_0x5e373d[_0x174165][_0x1635('0x24')]({'plain':!![]});_0x3c5202=squel[_0x1635('0x66')]()[_0x1635('0x7c')](_0x1635('0x8f'))[_0x1635('0x7a')]([_0x1635('0x6c'),_0x1635('0x6e'),_0x1635('0x69'),_0x1635('0x58'),_0x1635('0x52'),_0x1635('0x53')],squel[_0x1635('0x6a')]()['field'](_0x1635('0x6c'),_0x1635('0x6c'))[_0x1635('0x6b')]('id',_0x1635('0x6e'))[_0x1635('0x6b')](_0xe50c28[_0x1635('0x73')][_0x1635('0x6f')](),'ListId')[_0x1635('0x6b')](_0x32ea66[_0x1635('0x45')]['id'][_0x1635('0x6f')](),_0x1635('0x58'))[_0x1635('0x6b')](_0x1635('0x6d'),_0x1635('0x52'))[_0x1635('0x6b')]('NOW()','updatedAt')[_0x1635('0x70')](_0x1635('0x7b'))[_0x1635('0x3a')](_0x1635('0x71'))[_0x1635('0x3a')]('ListId\x20=\x20?',_0xe50c28[_0x1635('0x73')][_0x1635('0x6f')]())[_0x1635('0x3a')](_0x1635('0x74')))['toString']();_0x27dfc9[_0x1635('0x87')](db[_0x1635('0x88')][_0x1635('0x30')](_0x3c5202));}return BPromise[_0x1635('0x89')](_0x27dfc9);}})['then'](function(){return _0x1f9b1c;})[_0x1635('0x22')](respondWithResult(_0x3a0296,null))[_0x1635('0x43')](handleError(_0x3a0296,null));};exports[_0x1635('0x90')]=function(_0x2ce4c8,_0x2ca2d0,_0x2df28e){return db[_0x1635('0x2a')][_0x1635('0x46')]({'where':{'id':_0x2ce4c8[_0x1635('0x45')]['id']}})[_0x1635('0x22')](handleEntityNotFound(_0x2ca2d0,null))['then'](function(_0x5ad5e8){if(_0x5ad5e8){return _0x5ad5e8[_0x1635('0x90')](_0x2ce4c8[_0x1635('0x30')][_0x1635('0x8b')]);}})[_0x1635('0x22')](function(_0x3ce346){if(_0x3ce346){return db['CmHopperBlack'][_0x1635('0x23')]({'where':{'ListId':_0x2ce4c8[_0x1635('0x30')][_0x1635('0x8b')],'CampaignId':_0x2ce4c8[_0x1635('0x45')]['id']}})[_0x1635('0x22')](function(){return _0x3ce346;});}})[_0x1635('0x22')](respondWithStatusCode(_0x2ca2d0,null))['catch'](handleError(_0x2ca2d0,null));}; \ No newline at end of file +var _0xba5a=['ListId','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','fromQuery','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','omit','createdAt','updatedAt','autoAssociation','getHoppers','findOne','hasOwnProperty','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString'];(function(_0x32f5b1,_0xc8186f){var _0xac1ee7=function(_0x150137){while(--_0x150137){_0x32f5b1['push'](_0x32f5b1['shift']());}};_0xac1ee7(++_0xc8186f);}(_0xba5a,0x1d0));var _0xaba5=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xba5a[_0x10d0f0];return _0x93e308;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaba5('0x0'));var zipdir=require(_0xaba5('0x1'));var jsonpatch=require(_0xaba5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaba5('0x3'));var Mustache=require(_0xaba5('0x4'));var util=require(_0xaba5('0x5'));var path=require(_0xaba5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaba5('0x7'));var _=require('lodash');var squel=require(_0xaba5('0x8'));var crypto=require(_0xaba5('0x9'));var jsforce=require(_0xaba5('0xa'));var deskjs=require(_0xaba5('0xb'));var toCsv=require(_0xaba5('0xc'));var querystring=require('querystring');var Papa=require(_0xaba5('0xd'));var Redis=require(_0xaba5('0xe'));var authService=require(_0xaba5('0xf'));var qs=require(_0xaba5('0x10'));var as=require(_0xaba5('0x11'));var hardwareService=require(_0xaba5('0x12'));var logger=require(_0xaba5('0x13'))(_0xaba5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaba5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bf340,_0x5264c7){_0x5264c7=_0x5264c7||0xcc;return function(_0x51909b){if(_0x51909b){return _0x2bf340[_0xaba5('0x16')](_0x5264c7);}return _0x2bf340[_0xaba5('0x17')](_0x5264c7)[_0xaba5('0x18')]();};}function respondWithResult(_0x11f615,_0x4be6a6){_0x4be6a6=_0x4be6a6||0xc8;return function(_0x306ebd){if(_0x306ebd){return _0x11f615[_0xaba5('0x17')](_0x4be6a6)['json'](_0x306ebd);}};}function respondWithFilteredResult(_0x5b8481,_0x354104){return function(_0x33a63e){if(_0x33a63e){var _0x176dff=typeof _0x354104[_0xaba5('0x19')]===_0xaba5('0x1a')&&typeof _0x354104['limit']===_0xaba5('0x1a');var _0x49e9b2=_0x33a63e[_0xaba5('0x1b')];var _0x55289e=_0x176dff?0x0:_0x354104[_0xaba5('0x19')];var _0x442cac=_0x176dff?_0x33a63e['count']:_0x354104['offset']+_0x354104[_0xaba5('0x1c')];var _0x32089d;if(_0x442cac>=_0x49e9b2){_0x442cac=_0x49e9b2;_0x32089d=0xc8;}else{_0x32089d=0xce;}_0x5b8481['status'](_0x32089d);return _0x5b8481[_0xaba5('0x1d')]('Content-Range',_0x55289e+'-'+_0x442cac+'/'+_0x49e9b2)['json'](_0x33a63e);}return null;};}function patchUpdates(_0x12ff97){return function(_0xe03ffb){try{jsonpatch[_0xaba5('0x1e')](_0xe03ffb,_0x12ff97,!![]);}catch(_0x5c6b6a){return BPromise[_0xaba5('0x1f')](_0x5c6b6a);}return _0xe03ffb['save']();};}function saveUpdates(_0x42dcd0,_0x3f0282){return function(_0x34f0ef){if(_0x34f0ef){return _0x34f0ef[_0xaba5('0x20')](_0x42dcd0)[_0xaba5('0x21')](function(_0x3dfe3b){return _0x3dfe3b;});}return null;};}function removeEntity(_0x59a185,_0x2b337e){return function(_0x4d4120){if(_0x4d4120){return _0x4d4120[_0xaba5('0x22')]()[_0xaba5('0x21')](function(){var _0x2d2c61=_0x4d4120[_0xaba5('0x23')]({'plain':!![]});var _0xf5e400=_0xaba5('0x24');return db[_0xaba5('0x25')][_0xaba5('0x22')]({'where':{'type':_0xf5e400,'resourceId':_0x2d2c61['id']}})[_0xaba5('0x21')](function(){return _0x4d4120;});})[_0xaba5('0x21')](function(){_0x59a185[_0xaba5('0x17')](0xcc)[_0xaba5('0x18')]();});}};}function handleEntityNotFound(_0x5ec815,_0x5509b2){return function(_0x54f7fb){if(!_0x54f7fb){_0x5ec815['sendStatus'](0x194);}return _0x54f7fb;};}function handleError(_0x348c92,_0x5257ac){_0x5257ac=_0x5257ac||0x1f4;return function(_0x97a7d){logger[_0xaba5('0x26')](_0x97a7d['stack']);if(_0x97a7d['name']){delete _0x97a7d[_0xaba5('0x27')];}_0x348c92[_0xaba5('0x17')](_0x5257ac)[_0xaba5('0x28')](_0x97a7d);};}exports[_0xaba5('0x29')]=function(_0xadb64c,_0xcb1960){var _0x45d54f={},_0x5798d3={},_0x9c7210={'count':0x0,'rows':[]};var _0x28e95c=_[_0xaba5('0x2a')](db[_0xaba5('0x2b')][_0xaba5('0x2c')],function(_0x5510f0){return{'name':_0x5510f0[_0xaba5('0x2d')],'type':_0x5510f0[_0xaba5('0x2e')][_0xaba5('0x2f')]};});_0x5798d3[_0xaba5('0x30')]=_[_0xaba5('0x2a')](_0x28e95c,_0xaba5('0x27'));_0x5798d3[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0xadb64c['query']);_0x5798d3[_0xaba5('0x33')]=_['intersection'](_0x5798d3[_0xaba5('0x30')],_0x5798d3[_0xaba5('0x31')]);_0x45d54f[_0xaba5('0x34')]=_[_0xaba5('0x35')](_0x5798d3['model'],qs[_0xaba5('0x36')](_0xadb64c[_0xaba5('0x31')]['fields']));_0x45d54f[_0xaba5('0x34')]=_0x45d54f['attributes'][_0xaba5('0x37')]?_0x45d54f[_0xaba5('0x34')]:_0x5798d3['model'];if(!_0xadb64c[_0xaba5('0x31')]['hasOwnProperty'](_0xaba5('0x38'))){_0x45d54f[_0xaba5('0x1c')]=qs[_0xaba5('0x1c')](_0xadb64c[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x45d54f[_0xaba5('0x19')]=qs['offset'](_0xadb64c[_0xaba5('0x31')][_0xaba5('0x19')]);}_0x45d54f[_0xaba5('0x39')]=qs[_0xaba5('0x3a')](_0xadb64c['query'][_0xaba5('0x3a')]);_0x45d54f['where']=qs[_0xaba5('0x33')](_[_0xaba5('0x3b')](_0xadb64c['query'],_0x5798d3[_0xaba5('0x33')]),_0x28e95c);if(_0xadb64c['query'][_0xaba5('0x3c')]){_0x45d54f[_0xaba5('0x3d')]=_['merge'](_0x45d54f[_0xaba5('0x3d')],{'$or':_[_0xaba5('0x2a')](_0x28e95c,function(_0x570a09){if(_0x570a09[_0xaba5('0x2e')]!==_0xaba5('0x3e')){var _0x4eefbd={};_0x4eefbd[_0x570a09[_0xaba5('0x27')]]={'$like':'%'+_0xadb64c[_0xaba5('0x31')][_0xaba5('0x3c')]+'%'};return _0x4eefbd;}})});}_0x45d54f=_[_0xaba5('0x3f')]({},_0x45d54f,_0xadb64c[_0xaba5('0x40')]);var _0xee530a={'where':_0x45d54f['where']};return db['Campaign'][_0xaba5('0x1b')](_0xee530a)[_0xaba5('0x21')](function(_0x2bc44e){_0x9c7210[_0xaba5('0x1b')]=_0x2bc44e;if(_0xadb64c[_0xaba5('0x31')][_0xaba5('0x41')]){_0x45d54f[_0xaba5('0x42')]=[{'all':!![]}];}return db['Campaign'][_0xaba5('0x43')](_0x45d54f);})[_0xaba5('0x21')](function(_0x2dd164){_0x9c7210[_0xaba5('0x44')]=_0x2dd164;return _0x9c7210;})[_0xaba5('0x21')](respondWithFilteredResult(_0xcb1960,_0x45d54f))[_0xaba5('0x45')](handleError(_0xcb1960,null));};exports[_0xaba5('0x46')]=function(_0x18e10c,_0x438824){var _0x1ebf28={'raw':![],'where':{'id':_0x18e10c[_0xaba5('0x47')]['id']}},_0x11c8c8={};_0x11c8c8[_0xaba5('0x30')]=_[_0xaba5('0x32')](db['Campaign'][_0xaba5('0x2c')]);_0x11c8c8[_0xaba5('0x31')]=_['keys'](_0x18e10c[_0xaba5('0x31')]);_0x11c8c8[_0xaba5('0x33')]=_[_0xaba5('0x35')](_0x11c8c8[_0xaba5('0x30')],_0x11c8c8[_0xaba5('0x31')]);_0x1ebf28[_0xaba5('0x34')]=_[_0xaba5('0x35')](_0x11c8c8[_0xaba5('0x30')],qs[_0xaba5('0x36')](_0x18e10c[_0xaba5('0x31')][_0xaba5('0x36')]));_0x1ebf28[_0xaba5('0x34')]=_0x1ebf28[_0xaba5('0x34')]['length']?_0x1ebf28[_0xaba5('0x34')]:_0x11c8c8[_0xaba5('0x30')];if(_0x18e10c[_0xaba5('0x31')][_0xaba5('0x41')]){_0x1ebf28['include']=[{'all':!![]}];}_0x1ebf28=_[_0xaba5('0x3f')]({},_0x1ebf28,_0x18e10c[_0xaba5('0x40')]);return db[_0xaba5('0x2b')][_0xaba5('0x48')](_0x1ebf28)['then'](handleEntityNotFound(_0x438824,null))[_0xaba5('0x21')](respondWithResult(_0x438824,null))[_0xaba5('0x45')](handleError(_0x438824,null));};exports[_0xaba5('0x49')]=function(_0x61ff25,_0x3c9f09){return db[_0xaba5('0x2b')][_0xaba5('0x49')](_0x61ff25[_0xaba5('0x4a')],{})[_0xaba5('0x21')](function(_0x23164a){var _0x5c181e=_0x61ff25[_0xaba5('0x4b')][_0xaba5('0x23')]({'plain':!![]});if(!_0x5c181e)throw new Error(_0xaba5('0x4c'));if(_0x5c181e[_0xaba5('0x4d')]===_0xaba5('0x4b')){var _0x173d82=_0x23164a['get']({'plain':!![]});var _0x574c39='IvrCampaigns';return db[_0xaba5('0x4e')]['find']({'where':{'name':_0x574c39,'userProfileId':_0x5c181e['userProfileId']},'raw':!![]})['then'](function(_0xc8b2d9){if(_0xc8b2d9&&_0xc8b2d9['autoAssociation']===0x0){return db[_0xaba5('0x25')]['create']({'name':_0x173d82[_0xaba5('0x27')],'resourceId':_0x173d82['id'],'type':_0xc8b2d9[_0xaba5('0x27')],'sectionId':_0xc8b2d9['id']},{})[_0xaba5('0x21')](function(){return _0x23164a;});}else{return _0x23164a;}})[_0xaba5('0x45')](function(_0x2e9261){logger[_0xaba5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e9261);throw _0x2e9261;});}return _0x23164a;})[_0xaba5('0x21')](respondWithResult(_0x3c9f09,0xc9))[_0xaba5('0x45')](handleError(_0x3c9f09,null));};exports['clone']=function(_0x50cc97,_0x4c0e35){var _0x3c9f91={'where':{'id':_0x50cc97[_0xaba5('0x47')]['id']}},_0x228e98={};_0x228e98[_0xaba5('0x30')]=_['keys'](db['Campaign'][_0xaba5('0x2c')]);_0x3c9f91[_0xaba5('0x34')]=_[_0xaba5('0x35')](_0x228e98['model'],qs['fields'](_0x50cc97[_0xaba5('0x31')][_0xaba5('0x36')]));_0x3c9f91[_0xaba5('0x34')]=_0x3c9f91[_0xaba5('0x34')][_0xaba5('0x37')]?_0x3c9f91[_0xaba5('0x34')]:_0x228e98[_0xaba5('0x30')];if(_0x50cc97[_0xaba5('0x31')]['includeAll']){_0x3c9f91[_0xaba5('0x42')]=[{'all':!![]}];}_0x3c9f91=_[_0xaba5('0x3f')]({},_0x3c9f91,_0x50cc97[_0xaba5('0x40')]);return db[_0xaba5('0x2b')][_0xaba5('0x48')](_0x3c9f91)['then'](handleEntityNotFound(_0x4c0e35,null))['then'](function(_0xfa4a3){if(_0xfa4a3){var _0x268b7d=_0xfa4a3[_0xaba5('0x23')]({'plain':!![]});_0x268b7d=qs[_0xaba5('0x4f')](_0x268b7d,['id',_0xaba5('0x50'),_0xaba5('0x51')]);_0x50cc97[_0xaba5('0x4a')]=_['omit'](_0x50cc97[_0xaba5('0x4a')],['id',_0xaba5('0x50'),_0xaba5('0x51')]);return db[_0xaba5('0x2b')][_0xaba5('0x49')](_[_0xaba5('0x3f')](_0x268b7d,_0x50cc97[_0xaba5('0x4a')]),{'include':_0x50cc97[_0xaba5('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0xaba5('0x21')](function(_0x1162b0){var _0x5b1aaa=_0x50cc97[_0xaba5('0x4b')][_0xaba5('0x23')]({'plain':!![]});if(!_0x5b1aaa)throw new Error(_0xaba5('0x4c'));if(_0x5b1aaa[_0xaba5('0x4d')]===_0xaba5('0x4b')){var _0x3d9326=_0x1162b0[_0xaba5('0x23')]({'plain':!![]});var _0x107f07=_0xaba5('0x24');return db[_0xaba5('0x4e')]['find']({'where':{'name':_0x107f07,'userProfileId':_0x5b1aaa['userProfileId']},'raw':!![]})[_0xaba5('0x21')](function(_0x54395f){if(_0x54395f&&_0x54395f[_0xaba5('0x52')]===0x0){return db[_0xaba5('0x25')]['create']({'name':_0x3d9326['name'],'resourceId':_0x3d9326['id'],'type':_0x54395f[_0xaba5('0x27')],'sectionId':_0x54395f['id']},{})['then'](function(){return _0x1162b0;});}else{return _0x1162b0;}})[_0xaba5('0x45')](function(_0x2aae4b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aae4b);throw _0x2aae4b;});}return _0x1162b0;});}})['then'](respondWithResult(_0x4c0e35,0xc9))[_0xaba5('0x45')](handleError(_0x4c0e35,null));};exports['update']=function(_0x16efb8,_0x3a2458){if(_0x16efb8[_0xaba5('0x4a')]['id']){delete _0x16efb8[_0xaba5('0x4a')]['id'];}return db[_0xaba5('0x2b')]['find']({'where':{'id':_0x16efb8[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x3a2458,null))[_0xaba5('0x21')](saveUpdates(_0x16efb8[_0xaba5('0x4a')],null))['then'](respondWithResult(_0x3a2458,null))[_0xaba5('0x45')](handleError(_0x3a2458,null));};exports[_0xaba5('0x22')]=function(_0x8c57b8,_0x21cd45){return db[_0xaba5('0x2b')][_0xaba5('0x48')]({'where':{'id':_0x8c57b8[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x21cd45,null))[_0xaba5('0x21')](removeEntity(_0x21cd45,null))[_0xaba5('0x45')](handleError(_0x21cd45,null));};exports[_0xaba5('0x53')]=function(_0x150eb0,_0x50837b,_0x2466f7){var _0x2e0a3a={'raw':!![],'where':{}};var _0x4e9a11={};var _0x549a5b={'count':0x0,'rows':[]};return db['Campaign'][_0xaba5('0x54')]({'where':{'id':_0x150eb0['params']['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x50837b,null))['then'](function(_0x21a1cd){if(_0x21a1cd){_0x4e9a11[_0xaba5('0x30')]=_[_0xaba5('0x32')](db['CmHopper']['rawAttributes']);_0x4e9a11[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0x150eb0[_0xaba5('0x31')]);_0x4e9a11['filters']=_[_0xaba5('0x35')](_0x4e9a11[_0xaba5('0x30')],_0x4e9a11[_0xaba5('0x31')]);_0x2e0a3a['attributes']=_[_0xaba5('0x35')](_0x4e9a11[_0xaba5('0x30')],qs[_0xaba5('0x36')](_0x150eb0[_0xaba5('0x31')][_0xaba5('0x36')]));_0x2e0a3a[_0xaba5('0x34')]=_0x2e0a3a[_0xaba5('0x34')][_0xaba5('0x37')]?_0x2e0a3a[_0xaba5('0x34')]:_0x4e9a11[_0xaba5('0x30')];if(!_0x150eb0[_0xaba5('0x31')][_0xaba5('0x55')](_0xaba5('0x38'))){_0x2e0a3a['limit']=qs[_0xaba5('0x1c')](_0x150eb0[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x2e0a3a[_0xaba5('0x19')]=qs[_0xaba5('0x19')](_0x150eb0[_0xaba5('0x31')][_0xaba5('0x19')]);}_0x2e0a3a[_0xaba5('0x39')]=qs[_0xaba5('0x3a')](_0x150eb0[_0xaba5('0x31')][_0xaba5('0x3a')]);_0x2e0a3a[_0xaba5('0x3d')]=qs[_0xaba5('0x33')](_[_0xaba5('0x3b')](_0x150eb0[_0xaba5('0x31')],_0x4e9a11['filters']));_0x2e0a3a['where']['CampaignId']=_0x21a1cd['id'];if(_0x150eb0[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x2e0a3a[_0xaba5('0x3d')]=_['merge'](_0x2e0a3a[_0xaba5('0x3d')],{'$or':_[_0xaba5('0x2a')](_0x2e0a3a['attributes'],function(_0x178f30){var _0xdd50ed={};_0xdd50ed[_0x178f30]={'$like':'%'+_0x150eb0[_0xaba5('0x31')][_0xaba5('0x3c')]+'%'};return _0xdd50ed;})});}_0x2e0a3a=_[_0xaba5('0x3f')]({},_0x2e0a3a,_0x150eb0[_0xaba5('0x40')]);return db['CmHopper'][_0xaba5('0x1b')]({'where':_0x2e0a3a[_0xaba5('0x3d')]})[_0xaba5('0x21')](function(_0x1ee34f){_0x549a5b['count']=_0x1ee34f;if(_0x150eb0['query'][_0xaba5('0x41')]){_0x2e0a3a[_0xaba5('0x42')]=[{'all':!![]}];}return db[_0xaba5('0x56')]['findAll'](_0x2e0a3a);})[_0xaba5('0x21')](function(_0x44dfa3){_0x549a5b[_0xaba5('0x44')]=_0x44dfa3;return _0x549a5b;});}})[_0xaba5('0x21')](respondWithFilteredResult(_0x50837b,_0x2e0a3a))['catch'](handleError(_0x50837b,null));};exports[_0xaba5('0x57')]=function(_0x27d552,_0x3b4cf9,_0x46624d){var _0x117b78={'raw':!![],'where':{}};var _0x5777d5={};var _0x8e9309={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x27d552[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x3b4cf9,null))[_0xaba5('0x21')](function(_0x50b1a1){if(_0x50b1a1){_0x5777d5[_0xaba5('0x30')]=_[_0xaba5('0x32')](db[_0xaba5('0x58')][_0xaba5('0x2c')]);_0x5777d5[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0x27d552[_0xaba5('0x31')]);_0x5777d5[_0xaba5('0x33')]=_[_0xaba5('0x35')](_0x5777d5[_0xaba5('0x30')],_0x5777d5[_0xaba5('0x31')]);_0x117b78['attributes']=_['intersection'](_0x5777d5[_0xaba5('0x30')],qs[_0xaba5('0x36')](_0x27d552[_0xaba5('0x31')][_0xaba5('0x36')]));_0x117b78[_0xaba5('0x34')]=_0x117b78[_0xaba5('0x34')][_0xaba5('0x37')]?_0x117b78[_0xaba5('0x34')]:_0x5777d5['model'];if(!_0x27d552[_0xaba5('0x31')][_0xaba5('0x55')]('nolimit')){_0x117b78[_0xaba5('0x1c')]=qs[_0xaba5('0x1c')](_0x27d552[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x117b78[_0xaba5('0x19')]=qs[_0xaba5('0x19')](_0x27d552[_0xaba5('0x31')][_0xaba5('0x19')]);}_0x117b78['order']=qs['sort'](_0x27d552[_0xaba5('0x31')][_0xaba5('0x3a')]);_0x117b78['where']=qs['filters'](_[_0xaba5('0x3b')](_0x27d552[_0xaba5('0x31')],_0x5777d5['filters']));_0x117b78['where'][_0xaba5('0x59')]=_0x50b1a1['id'];if(_0x27d552[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x117b78['where']=_[_0xaba5('0x3f')](_0x117b78[_0xaba5('0x3d')],{'$or':_['map'](_0x117b78[_0xaba5('0x34')],function(_0x2bef16){var _0x34335c={};_0x34335c[_0x2bef16]={'$like':'%'+_0x27d552[_0xaba5('0x31')][_0xaba5('0x3c')]+'%'};return _0x34335c;})});}_0x117b78=_['merge']({},_0x117b78,_0x27d552[_0xaba5('0x40')]);return db[_0xaba5('0x58')][_0xaba5('0x1b')]({'where':_0x117b78[_0xaba5('0x3d')]})[_0xaba5('0x21')](function(_0x3efd71){_0x8e9309[_0xaba5('0x1b')]=_0x3efd71;if(_0x27d552[_0xaba5('0x31')][_0xaba5('0x41')]){_0x117b78[_0xaba5('0x42')]=[{'all':!![]}];}return db[_0xaba5('0x58')][_0xaba5('0x43')](_0x117b78);})['then'](function(_0x3ca66d){_0x8e9309[_0xaba5('0x44')]=_0x3ca66d;return _0x8e9309;});}})[_0xaba5('0x21')](respondWithFilteredResult(_0x3b4cf9,_0x117b78))['catch'](handleError(_0x3b4cf9,null));};exports[_0xaba5('0x5a')]=function(_0x1a5f5e,_0x2cc972,_0x5b5863){var _0x3e2f21={'raw':!![],'where':{}};var _0x2248e2={};var _0x24e7da={'count':0x0,'rows':[]};return db['Campaign'][_0xaba5('0x54')]({'where':{'id':_0x1a5f5e[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x2cc972,null))['then'](function(_0x4002c6){if(_0x4002c6){_0x2248e2[_0xaba5('0x30')]=_[_0xaba5('0x32')](db['CmHopperFinal']['rawAttributes']);_0x2248e2[_0xaba5('0x31')]=_['keys'](_0x1a5f5e[_0xaba5('0x31')]);_0x2248e2[_0xaba5('0x33')]=_[_0xaba5('0x35')](_0x2248e2['model'],_0x2248e2[_0xaba5('0x31')]);_0x3e2f21[_0xaba5('0x34')]=_[_0xaba5('0x35')](_0x2248e2[_0xaba5('0x30')],qs['fields'](_0x1a5f5e[_0xaba5('0x31')]['fields']));_0x3e2f21[_0xaba5('0x34')]=_0x3e2f21[_0xaba5('0x34')][_0xaba5('0x37')]?_0x3e2f21['attributes']:_0x2248e2[_0xaba5('0x30')];if(!_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x55')]('nolimit')){_0x3e2f21['limit']=qs['limit'](_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x3e2f21[_0xaba5('0x19')]=qs[_0xaba5('0x19')](_0x1a5f5e['query'][_0xaba5('0x19')]);}_0x3e2f21[_0xaba5('0x39')]=qs[_0xaba5('0x3a')](_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x3a')]);_0x3e2f21[_0xaba5('0x3d')]=qs['filters'](_['pick'](_0x1a5f5e['query'],_0x2248e2[_0xaba5('0x33')]));_0x3e2f21[_0xaba5('0x3d')][_0xaba5('0x59')]=_0x4002c6['id'];if(_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x3e2f21[_0xaba5('0x3d')]=_[_0xaba5('0x3f')](_0x3e2f21['where'],{'$or':_[_0xaba5('0x2a')](_0x3e2f21[_0xaba5('0x34')],function(_0x57cd11){var _0x52fcf9={};_0x52fcf9[_0x57cd11]={'$like':'%'+_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x3c')]+'%'};return _0x52fcf9;})});}_0x3e2f21=_[_0xaba5('0x3f')]({},_0x3e2f21,_0x1a5f5e[_0xaba5('0x40')]);return db[_0xaba5('0x5b')]['count']({'where':_0x3e2f21[_0xaba5('0x3d')]})[_0xaba5('0x21')](function(_0xe066a0){_0x24e7da[_0xaba5('0x1b')]=_0xe066a0;if(_0x1a5f5e[_0xaba5('0x31')][_0xaba5('0x41')]){_0x3e2f21['include']=[{'all':!![]}];}return db[_0xaba5('0x5b')][_0xaba5('0x43')](_0x3e2f21);})[_0xaba5('0x21')](function(_0x178c98){_0x24e7da['rows']=_0x178c98;return _0x24e7da;});}})[_0xaba5('0x21')](respondWithFilteredResult(_0x2cc972,_0x3e2f21))[_0xaba5('0x45')](handleError(_0x2cc972,null));};exports[_0xaba5('0x5c')]=function(_0x198c3b,_0x20e708,_0x1e7648){var _0x37e5a4={'raw':!![],'where':{}};var _0x5024e1={};var _0x31cc74={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x198c3b[_0xaba5('0x47')]['id']}})['then'](handleEntityNotFound(_0x20e708,null))['then'](function(_0x1dc3e5){if(_0x1dc3e5){_0x5024e1['model']=_['keys'](db[_0xaba5('0x5d')][_0xaba5('0x2c')]);_0x5024e1[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0x198c3b[_0xaba5('0x31')]);_0x5024e1[_0xaba5('0x33')]=_['intersection'](_0x5024e1['model'],_0x5024e1[_0xaba5('0x31')]);_0x37e5a4['attributes']=_[_0xaba5('0x35')](_0x5024e1[_0xaba5('0x30')],qs[_0xaba5('0x36')](_0x198c3b['query'][_0xaba5('0x36')]));_0x37e5a4['attributes']=_0x37e5a4[_0xaba5('0x34')][_0xaba5('0x37')]?_0x37e5a4[_0xaba5('0x34')]:_0x5024e1[_0xaba5('0x30')];if(!_0x198c3b[_0xaba5('0x31')][_0xaba5('0x55')](_0xaba5('0x38'))){_0x37e5a4[_0xaba5('0x1c')]=qs[_0xaba5('0x1c')](_0x198c3b[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x37e5a4['offset']=qs[_0xaba5('0x19')](_0x198c3b[_0xaba5('0x31')][_0xaba5('0x19')]);}_0x37e5a4[_0xaba5('0x39')]=qs['sort'](_0x198c3b[_0xaba5('0x31')][_0xaba5('0x3a')]);_0x37e5a4[_0xaba5('0x3d')]=qs['filters'](_[_0xaba5('0x3b')](_0x198c3b['query'],_0x5024e1[_0xaba5('0x33')]));_0x37e5a4[_0xaba5('0x3d')]['CampaignId']=_0x1dc3e5['id'];if(_0x198c3b[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x37e5a4['where']=_[_0xaba5('0x3f')](_0x37e5a4[_0xaba5('0x3d')],{'$or':_['map'](_0x37e5a4['attributes'],function(_0x580c2c){var _0x373e85={};_0x373e85[_0x580c2c]={'$like':'%'+_0x198c3b['query'][_0xaba5('0x3c')]+'%'};return _0x373e85;})});}_0x37e5a4=_[_0xaba5('0x3f')]({},_0x37e5a4,_0x198c3b[_0xaba5('0x40')]);return db[_0xaba5('0x5d')][_0xaba5('0x1b')]({'where':_0x37e5a4['where']})['then'](function(_0x1101ca){_0x31cc74[_0xaba5('0x1b')]=_0x1101ca;if(_0x198c3b['query']['includeAll']){_0x37e5a4[_0xaba5('0x42')]=[{'all':!![]}];}return db[_0xaba5('0x5d')][_0xaba5('0x43')](_0x37e5a4);})[_0xaba5('0x21')](function(_0xe06a5d){_0x31cc74[_0xaba5('0x44')]=_0xe06a5d;return _0x31cc74;});}})['then'](respondWithFilteredResult(_0x20e708,_0x37e5a4))[_0xaba5('0x45')](handleError(_0x20e708,null));};exports[_0xaba5('0x5e')]=function(_0x989666,_0x14667b,_0x548c81){var _0x55571c={};var _0x2cc57b={};var _0x260675;var _0x4aa9de;return db[_0xaba5('0x2b')][_0xaba5('0x54')]({'where':{'id':_0x989666[_0xaba5('0x47')]['id']}})['then'](handleEntityNotFound(_0x14667b,null))['then'](function(_0x28c6c3){if(_0x28c6c3){_0x260675=_0x28c6c3;_0x2cc57b[_0xaba5('0x30')]=_[_0xaba5('0x32')](db[_0xaba5('0x5f')]['rawAttributes']);_0x2cc57b[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0x989666[_0xaba5('0x31')]);_0x2cc57b[_0xaba5('0x33')]=_[_0xaba5('0x35')](_0x2cc57b[_0xaba5('0x30')],_0x2cc57b[_0xaba5('0x31')]);_0x55571c['attributes']=_['intersection'](_0x2cc57b[_0xaba5('0x30')],qs['fields'](_0x989666['query'][_0xaba5('0x36')]));_0x55571c[_0xaba5('0x34')]=_0x55571c['attributes'][_0xaba5('0x37')]?_0x55571c['attributes']:_0x2cc57b[_0xaba5('0x30')];_0x55571c['order']=qs[_0xaba5('0x3a')](_0x989666[_0xaba5('0x31')]['sort']);_0x55571c[_0xaba5('0x3d')]=qs[_0xaba5('0x33')](_[_0xaba5('0x3b')](_0x989666[_0xaba5('0x31')],_0x2cc57b[_0xaba5('0x33')]));if(_0x989666[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x55571c['where']=_[_0xaba5('0x3f')](_0x55571c[_0xaba5('0x3d')],{'$or':_['map'](_0x55571c[_0xaba5('0x34')],function(_0x1c0055){var _0x1ecdfb={};_0x1ecdfb[_0x1c0055]={'$like':'%'+_0x989666[_0xaba5('0x31')]['filter']+'%'};return _0x1ecdfb;})});}_0x55571c=_[_0xaba5('0x3f')]({},_0x55571c,_0x989666['options']);return _0x260675[_0xaba5('0x5e')](_0x55571c);}})[_0xaba5('0x21')](function(_0x4304c2){if(_0x4304c2){_0x4aa9de=_0x4304c2[_0xaba5('0x37')];if(!_0x989666['query']['hasOwnProperty'](_0xaba5('0x38'))){_0x55571c[_0xaba5('0x1c')]=qs[_0xaba5('0x1c')](_0x989666['query'][_0xaba5('0x1c')]);_0x55571c[_0xaba5('0x19')]=qs[_0xaba5('0x19')](_0x989666[_0xaba5('0x31')][_0xaba5('0x19')]);}return _0x260675[_0xaba5('0x5e')](_0x55571c);}})[_0xaba5('0x21')](function(_0x4d1649){if(_0x4d1649){return _0x4d1649?{'count':_0x4aa9de,'rows':_0x4d1649}:null;}})[_0xaba5('0x21')](respondWithResult(_0x14667b,null))[_0xaba5('0x45')](handleError(_0x14667b,null));};exports[_0xaba5('0x60')]=function(_0x6499d5,_0x5f391d,_0x21a217){var _0x528110,_0x2dd3e3;var _0x1bec12=[];var _0x323992=moment()[_0xaba5('0x61')](_0xaba5('0x62'));return db[_0xaba5('0x2b')][_0xaba5('0x48')]({'where':{'id':_0x6499d5['params']['id']}})['then'](handleEntityNotFound(_0x5f391d,null))[_0xaba5('0x21')](function(_0x213c01){if(_0x213c01){_0x2dd3e3=_0x213c01;return _0x213c01[_0xaba5('0x60')](_0x6499d5[_0xaba5('0x4a')][_0xaba5('0x63')],_[_0xaba5('0x4f')](_0x6499d5[_0xaba5('0x4a')],[_0xaba5('0x63'),'id'])||{});}return null;})[_0xaba5('0x64')](function(_0x29e285){var _0xc3fa49;var _0x313a92;_0x528110=_0x29e285||[];var _0x427c0e=[];if(_0x29e285){for(var _0x28af45=0x0;_0x28af45<_0x29e285[_0xaba5('0x37')];_0x28af45+=0x1){var _0x308cc9=_0x29e285[_0x28af45]['get']({'plain':!![]});_0x2dd3e3[_0xaba5('0x65')]=_0x6499d5[_0xaba5('0x4a')][_0xaba5('0x65')]?_0x6499d5[_0xaba5('0x4a')][_0xaba5('0x65')]:_0x2dd3e3[_0xaba5('0x65')];switch(_0x2dd3e3[_0xaba5('0x65')]){case'always':_0xc3fa49=squel['insert']()[_0xaba5('0x66')](_0xaba5('0x67'))['fromQuery']([_0xaba5('0x68'),_0xaba5('0x69'),_0xaba5('0x6a'),'ListId',_0xaba5('0x59'),_0xaba5('0x50'),_0xaba5('0x51')],squel[_0xaba5('0x6b')]()[_0xaba5('0x6c')](_0xaba5('0x68'),_0xaba5('0x68'))[_0xaba5('0x6c')](_0xaba5('0x6d'),_0xaba5('0x69'))['field']('id',_0xaba5('0x6a'))[_0xaba5('0x6c')](_0x308cc9[_0xaba5('0x6e')][_0xaba5('0x6f')](),_0xaba5('0x70'))[_0xaba5('0x6c')](_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')](),_0xaba5('0x59'))['field']('\x27'+_0x323992+'\x27',_0xaba5('0x50'))[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27',_0xaba5('0x51'))[_0xaba5('0x71')](_0xaba5('0x72'))[_0xaba5('0x3d')]('deletedAt\x20IS\x20NULL')[_0xaba5('0x3d')]('ListId\x20=\x20?',_0x308cc9['CmListId']['toString']())[_0xaba5('0x3d')](_0xaba5('0x73'))['where'](_0xaba5('0x74'),squel[_0xaba5('0x6b')]()[_0xaba5('0x6c')](_0xaba5('0x75'))[_0xaba5('0x71')](_0xaba5('0x76'))[_0xaba5('0x3d')]('CampaignId\x20=\x20?',_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')]()))[_0xaba5('0x3d')](_0xaba5('0x74'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xaba5('0x71')]('cm_hopper')[_0xaba5('0x3d')](_0xaba5('0x77'),_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')]())))[_0xaba5('0x6f')]();break;case _0xaba5('0x78'):_0xc3fa49=squel[_0xaba5('0x79')]()[_0xaba5('0x66')](_0xaba5('0x67'))[_0xaba5('0x7a')]([_0xaba5('0x68'),'scheduledAt',_0xaba5('0x6a'),_0xaba5('0x70'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0xaba5('0x6c')](_0xaba5('0x68'),_0xaba5('0x68'))[_0xaba5('0x6c')](_0xaba5('0x6d'),_0xaba5('0x69'))[_0xaba5('0x6c')]('id','ContactId')[_0xaba5('0x6c')](_0x308cc9['CmListId'][_0xaba5('0x6f')](),'ListId')['field'](_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')](),_0xaba5('0x59'))[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27',_0xaba5('0x50'))[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27','updatedAt')[_0xaba5('0x71')](_0xaba5('0x72'))[_0xaba5('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0xaba5('0x7b'),_0x308cc9['CmListId'][_0xaba5('0x6f')]())[_0xaba5('0x3d')](_0xaba5('0x73'))[_0xaba5('0x3d')](_0xaba5('0x74'),squel[_0xaba5('0x6b')]()['field'](_0xaba5('0x7c'))['from'](_0xaba5('0x67'))[_0xaba5('0x3d')](_0xaba5('0x77'),_0x6499d5[_0xaba5('0x47')]['id']['toString']())))[_0xaba5('0x6f')]();break;default:_0xc3fa49=squel['insert']()['into'](_0xaba5('0x67'))[_0xaba5('0x7a')]([_0xaba5('0x68'),_0xaba5('0x69'),'ContactId','ListId',_0xaba5('0x59'),_0xaba5('0x50'),_0xaba5('0x51')],squel[_0xaba5('0x6b')]()[_0xaba5('0x6c')]('phone',_0xaba5('0x68'))[_0xaba5('0x6c')](_0xaba5('0x6d'),_0xaba5('0x69'))['field']('id',_0xaba5('0x6a'))[_0xaba5('0x6c')](_0x308cc9['CmListId'][_0xaba5('0x6f')](),_0xaba5('0x70'))[_0xaba5('0x6c')](_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')](),_0xaba5('0x59'))[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27',_0xaba5('0x50'))[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27',_0xaba5('0x51'))[_0xaba5('0x71')](_0xaba5('0x72'))[_0xaba5('0x3d')](_0xaba5('0x7d'))['where']('ListId\x20=\x20?',_0x308cc9['CmListId'][_0xaba5('0x6f')]())['where'](_0xaba5('0x73')))['toString']();}_0x313a92=squel[_0xaba5('0x79')]()[_0xaba5('0x66')]('cm_hopper_additional_phones')['fromQuery']([_0xaba5('0x7e'),_0xaba5('0x69'),_0xaba5('0x68'),'OrderBy','createdAt',_0xaba5('0x51')],squel[_0xaba5('0x6b')]()['field'](_0xaba5('0x7f'),'id')[_0xaba5('0x6c')]('NOW()','scheduledAt')[_0xaba5('0x6c')](_0xaba5('0x80'),_0xaba5('0x68'))[_0xaba5('0x6c')](_0xaba5('0x81'),_0xaba5('0x82'))['field']('\x27'+_0x323992+'\x27','createdAt')[_0xaba5('0x6c')]('\x27'+_0x323992+'\x27',_0xaba5('0x51'))[_0xaba5('0x71')](_0xaba5('0x83'),'ci')[_0xaba5('0x84')](_0xaba5('0x67'),'h',_0xaba5('0x85'))['where'](_0xaba5('0x86'),_0x308cc9['CmListId'][_0xaba5('0x6f')]())[_0xaba5('0x3d')](_0xaba5('0x87'),_0x6499d5[_0xaba5('0x47')]['id'][_0xaba5('0x6f')]())[_0xaba5('0x3d')]('h.createdAt\x20=\x20?',_0x323992))[_0xaba5('0x6f')]();_0x427c0e[_0xaba5('0x88')](db['sequelize']['query'](_0xc3fa49));_0x1bec12[_0xaba5('0x88')](db[_0xaba5('0x89')]['query'](_0x313a92));}return BPromise[_0xaba5('0x8a')](_0x427c0e);}})[_0xaba5('0x21')](function(){return BPromise[_0xaba5('0x8a')](_0x1bec12);})[_0xaba5('0x21')](function(){return _0x528110;})['then'](respondWithResult(_0x5f391d,null))['catch'](handleError(_0x5f391d,null));};exports[_0xaba5('0x8b')]=function(_0x4c20cc,_0x2ac10e,_0x34b32b){return db['Campaign'][_0xaba5('0x48')]({'where':{'id':_0x4c20cc['params']['id']}})['then'](handleEntityNotFound(_0x2ac10e,null))[_0xaba5('0x21')](function(_0x1badf3){if(_0x1badf3){return _0x1badf3[_0xaba5('0x8b')](_0x4c20cc[_0xaba5('0x31')][_0xaba5('0x63')]);}})[_0xaba5('0x21')](function(_0xd4c634){if(_0xd4c634){return db['CmHopper'][_0xaba5('0x22')]({'where':{'ListId':_0x4c20cc[_0xaba5('0x31')]['ids'],'CampaignId':_0x4c20cc['params']['id']}})[_0xaba5('0x21')](function(){return _0xd4c634;});}})[_0xaba5('0x21')](respondWithStatusCode(_0x2ac10e,null))[_0xaba5('0x45')](handleError(_0x2ac10e,null));};exports[_0xaba5('0x8c')]=function(_0x200a2c,_0x2378cc,_0x3e0cfd){var _0x2858a0={};var _0x48b441={};var _0x1d519f;var _0x52634f;return db[_0xaba5('0x2b')][_0xaba5('0x54')]({'where':{'id':_0x200a2c[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x2378cc,null))[_0xaba5('0x21')](function(_0x22b37b){if(_0x22b37b){_0x1d519f=_0x22b37b;_0x48b441[_0xaba5('0x30')]=_[_0xaba5('0x32')](db['CmList']['rawAttributes']);_0x48b441[_0xaba5('0x31')]=_[_0xaba5('0x32')](_0x200a2c[_0xaba5('0x31')]);_0x48b441[_0xaba5('0x33')]=_['intersection'](_0x48b441[_0xaba5('0x30')],_0x48b441[_0xaba5('0x31')]);_0x2858a0[_0xaba5('0x34')]=_[_0xaba5('0x35')](_0x48b441[_0xaba5('0x30')],qs[_0xaba5('0x36')](_0x200a2c['query']['fields']));_0x2858a0[_0xaba5('0x34')]=_0x2858a0[_0xaba5('0x34')][_0xaba5('0x37')]?_0x2858a0['attributes']:_0x48b441[_0xaba5('0x30')];_0x2858a0[_0xaba5('0x39')]=qs['sort'](_0x200a2c[_0xaba5('0x31')][_0xaba5('0x3a')]);_0x2858a0[_0xaba5('0x3d')]=qs[_0xaba5('0x33')](_['pick'](_0x200a2c['query'],_0x48b441[_0xaba5('0x33')]));if(_0x200a2c[_0xaba5('0x31')][_0xaba5('0x3c')]){_0x2858a0[_0xaba5('0x3d')]=_['merge'](_0x2858a0['where'],{'$or':_[_0xaba5('0x2a')](_0x2858a0['attributes'],function(_0x1fe1fb){var _0x323800={};_0x323800[_0x1fe1fb]={'$like':'%'+_0x200a2c[_0xaba5('0x31')]['filter']+'%'};return _0x323800;})});}_0x2858a0=_[_0xaba5('0x3f')]({},_0x2858a0,_0x200a2c[_0xaba5('0x40')]);return _0x1d519f['getBlackLists'](_0x2858a0);}})[_0xaba5('0x21')](function(_0x2185e5){if(_0x2185e5){_0x52634f=_0x2185e5['length'];if(!_0x200a2c[_0xaba5('0x31')][_0xaba5('0x55')](_0xaba5('0x38'))){_0x2858a0['limit']=qs['limit'](_0x200a2c[_0xaba5('0x31')][_0xaba5('0x1c')]);_0x2858a0[_0xaba5('0x19')]=qs['offset'](_0x200a2c[_0xaba5('0x31')][_0xaba5('0x19')]);}return _0x1d519f['getBlackLists'](_0x2858a0);}})[_0xaba5('0x21')](function(_0x5cf890){if(_0x5cf890){return _0x5cf890?{'count':_0x52634f,'rows':_0x5cf890}:null;}})[_0xaba5('0x21')](respondWithResult(_0x2378cc,null))[_0xaba5('0x45')](handleError(_0x2378cc,null));};exports[_0xaba5('0x8d')]=function(_0x125ab3,_0x28c3fb,_0x10ee13){var _0x209bce,_0x39b8e1;var _0x18240e=[];var _0x570188=moment()[_0xaba5('0x61')](_0xaba5('0x62'));return db[_0xaba5('0x2b')][_0xaba5('0x48')]({'where':{'id':_0x125ab3[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x28c3fb,null))[_0xaba5('0x21')](function(_0x1d01ee){if(_0x1d01ee){_0x39b8e1=_0x1d01ee;return _0x1d01ee['addBlackLists'](_0x125ab3[_0xaba5('0x4a')]['ids'],_[_0xaba5('0x4f')](_0x125ab3['body'],['ids','id'])||{});}return null;})[_0xaba5('0x64')](function(_0x2b395e){var _0x297aa5;var _0x4cad79;_0x209bce=_0x2b395e||[];var _0x2f1ca8=[];if(_0x2b395e){for(var _0x1273f8=0x0;_0x1273f8<_0x2b395e[_0xaba5('0x37')];_0x1273f8+=0x1){var _0x3f0a10=_0x2b395e[_0x1273f8][_0xaba5('0x23')]({'plain':!![]});_0x297aa5=squel['insert']()['into'](_0xaba5('0x8e'))['fromQuery']([_0xaba5('0x68'),'ContactId',_0xaba5('0x70'),_0xaba5('0x59'),_0xaba5('0x50'),'updatedAt'],squel['select']()[_0xaba5('0x6c')](_0xaba5('0x68'),_0xaba5('0x68'))[_0xaba5('0x6c')]('id','ContactId')[_0xaba5('0x6c')](_0x3f0a10[_0xaba5('0x6e')][_0xaba5('0x6f')](),_0xaba5('0x70'))['field'](_0x125ab3[_0xaba5('0x47')]['id']['toString'](),_0xaba5('0x59'))[_0xaba5('0x6c')](_0xaba5('0x6d'),'createdAt')[_0xaba5('0x6c')](_0xaba5('0x6d'),_0xaba5('0x51'))[_0xaba5('0x71')](_0xaba5('0x72'))['where'](_0xaba5('0x7d'))[_0xaba5('0x3d')]('ListId\x20=\x20?',_0x3f0a10[_0xaba5('0x6e')]['toString']())[_0xaba5('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xaba5('0x6f')]();_0x2f1ca8[_0xaba5('0x88')](db[_0xaba5('0x89')][_0xaba5('0x31')](_0x297aa5));}return BPromise[_0xaba5('0x8a')](_0x2f1ca8);}})['then'](function(){return _0x209bce;})['then'](respondWithResult(_0x28c3fb,null))[_0xaba5('0x45')](handleError(_0x28c3fb,null));};exports['removeBlackLists']=function(_0x2b8c38,_0x38c4fc,_0x18f69a){return db[_0xaba5('0x2b')][_0xaba5('0x48')]({'where':{'id':_0x2b8c38['params']['id']}})[_0xaba5('0x21')](handleEntityNotFound(_0x38c4fc,null))[_0xaba5('0x21')](function(_0xefa699){if(_0xefa699){return _0xefa699[_0xaba5('0x8f')](_0x2b8c38[_0xaba5('0x31')][_0xaba5('0x63')]);}})['then'](function(_0x21e12e){if(_0x21e12e){return db[_0xaba5('0x5d')][_0xaba5('0x22')]({'where':{'ListId':_0x2b8c38[_0xaba5('0x31')][_0xaba5('0x63')],'CampaignId':_0x2b8c38[_0xaba5('0x47')]['id']}})[_0xaba5('0x21')](function(){return _0x21e12e;});}})[_0xaba5('0x21')](respondWithStatusCode(_0x38c4fc,null))[_0xaba5('0x45')](handleError(_0x38c4fc,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 060c3e9..3cca475 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_0x7a54,0x106));var _0x47a5=function(_0x13c490,_0x99284c){_0x13c490=_0x13c490-0x0;var _0xbbda20=_0x7a54[_0x13c490];return _0xbbda20;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d986b47..3e64387 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 _0xf197=['rpc','client','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','limit','map','include','model','attributes','lodash','util','moment','ioredis'];(function(_0x3e55c9,_0x53781c){var _0x433cec=function(_0x180b21){while(--_0x180b21){_0x3e55c9['push'](_0x3e55c9['shift']());}};_0x433cec(++_0x53781c);}(_0xf197,0x130));var _0x7f19=function(_0x28b208,_0x2ec462){_0x28b208=_0x28b208-0x0;var _0x2420ff=_0xf197[_0x28b208];return _0x2420ff;};'use strict';var _=require(_0x7f19('0x0'));var util=require(_0x7f19('0x1'));var moment=require(_0x7f19('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f19('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f19('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f19('0x5')][_0x7f19('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39b5b1,_0x1851e3,_0x39c494){return new BPromise(function(_0x2ebbfb,_0x3c349c){return client['request'](_0x39b5b1,_0x39c494)[_0x7f19('0x7')](function(_0x116b95){logger[_0x7f19('0x8')]('Campaign,\x20%s,\x20%s',_0x1851e3,_0x7f19('0x9'));logger[_0x7f19('0xa')](_0x7f19('0xb'),_0x1851e3,_0x7f19('0x9'),JSON['stringify'](_0x116b95));if(_0x116b95[_0x7f19('0xc')]){if(_0x116b95['error'][_0x7f19('0xd')]===0x1f4){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x116b95['error']['message']);return _0x3c349c(_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);}logger[_0x7f19('0xc')]('Campaign,\x20%s,\x20%s',_0x1851e3,_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);return _0x2ebbfb(_0x116b95['error'][_0x7f19('0xf')]);}else{logger[_0x7f19('0x8')](_0x7f19('0xe'),_0x1851e3,'request\x20sent');_0x2ebbfb(_0x116b95[_0x7f19('0x10')]['message']);}})[_0x7f19('0x11')](function(_0x2cc098){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x2cc098);_0x3c349c(_0x2cc098);});});}exports[_0x7f19('0x12')]=function(_0x5c56a1){var _0x27634b=this;return new Promise(function(_0x3b38d7,_0x122a9f){return db['Campaign'][_0x7f19('0x13')]({'raw':_0x5c56a1[_0x7f19('0x14')]?_0x5c56a1[_0x7f19('0x14')][_0x7f19('0x15')]===undefined?!![]:![]:!![],'where':_0x5c56a1['options']?_0x5c56a1[_0x7f19('0x14')][_0x7f19('0x16')]||null:null,'attributes':_0x5c56a1[_0x7f19('0x14')]?_0x5c56a1[_0x7f19('0x14')]['attributes']||null:null,'limit':_0x5c56a1[_0x7f19('0x14')]?_0x5c56a1[_0x7f19('0x14')][_0x7f19('0x17')]||null:null,'include':_0x5c56a1[_0x7f19('0x14')]?_0x5c56a1[_0x7f19('0x14')]['include']?_[_0x7f19('0x18')](_0x5c56a1[_0x7f19('0x14')][_0x7f19('0x19')],function(_0x34c4fb){return{'model':db[_0x34c4fb[_0x7f19('0x1a')]],'as':_0x34c4fb['as'],'attributes':_0x34c4fb['attributes'],'include':_0x34c4fb['include']?_[_0x7f19('0x18')](_0x34c4fb[_0x7f19('0x19')],function(_0x4b3649){return{'model':db[_0x4b3649[_0x7f19('0x1a')]],'as':_0x4b3649['as'],'attributes':_0x4b3649[_0x7f19('0x1b')],'include':_0x4b3649[_0x7f19('0x19')]?_[_0x7f19('0x18')](_0x4b3649[_0x7f19('0x19')],function(_0x7858fa){return{'model':db[_0x7858fa[_0x7f19('0x1a')]],'as':_0x7858fa['as'],'attributes':_0x7858fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f19('0x7')](function(_0xb8b519){logger['info'](_0x7f19('0x12'),_0x5c56a1);logger['debug'](_0x7f19('0x12'),_0x5c56a1,JSON['stringify'](_0xb8b519));_0x3b38d7(_0xb8b519);})['catch'](function(_0x1c66cc){logger['error'](_0x7f19('0x12'),_0x1c66cc[_0x7f19('0xf')],_0x5c56a1);_0x122a9f(_0x27634b[_0x7f19('0xc')](0x1f4,_0x1c66cc['message']));});});}; \ No newline at end of file +var _0x330c=['attributes','include','map','model','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','findAll','options','raw','where'];(function(_0x1d5dc5,_0x238990){var _0x2db555=function(_0x528901){while(--_0x528901){_0x1d5dc5['push'](_0x1d5dc5['shift']());}};_0x2db555(++_0x238990);}(_0x330c,0x186));var _0xc330=function(_0x2c8335,_0x5de293){_0x2c8335=_0x2c8335-0x0;var _0x14a860=_0x330c[_0x2c8335];return _0x14a860;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var moment=require(_0xc330('0x2'));var BPromise=require(_0xc330('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc330('0x4'));var db=require(_0xc330('0x5'))['db'];var utils=require(_0xc330('0x6'));var logger=require(_0xc330('0x7'))(_0xc330('0x8'));var config=require(_0xc330('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6a2e,_0x97255c,_0x253c40){return new BPromise(function(_0x114bf0,_0x2c6b74){return client[_0xc330('0xa')](_0x1a6a2e,_0x253c40)[_0xc330('0xb')](function(_0x48480e){logger[_0xc330('0xc')](_0xc330('0xd'),_0x97255c,_0xc330('0xe'));logger['debug'](_0xc330('0xf'),_0x97255c,_0xc330('0xe'),JSON[_0xc330('0x10')](_0x48480e));if(_0x48480e[_0xc330('0x11')]){if(_0x48480e[_0xc330('0x11')][_0xc330('0x12')]===0x1f4){logger[_0xc330('0x11')](_0xc330('0xd'),_0x97255c,_0x48480e[_0xc330('0x11')]['message']);return _0x2c6b74(_0x48480e['error'][_0xc330('0x13')]);}logger[_0xc330('0x11')]('Campaign,\x20%s,\x20%s',_0x97255c,_0x48480e[_0xc330('0x11')][_0xc330('0x13')]);return _0x114bf0(_0x48480e[_0xc330('0x11')][_0xc330('0x13')]);}else{logger[_0xc330('0xc')](_0xc330('0xd'),_0x97255c,_0xc330('0xe'));_0x114bf0(_0x48480e[_0xc330('0x14')][_0xc330('0x13')]);}})['catch'](function(_0x1dae13){logger[_0xc330('0x11')]('Campaign,\x20%s,\x20%s',_0x97255c,_0x1dae13);_0x2c6b74(_0x1dae13);});});}exports[_0xc330('0x15')]=function(_0x3f3d74){var _0x46f47c=this;return new Promise(function(_0x259adc,_0xd51374){return db['Campaign'][_0xc330('0x16')]({'raw':_0x3f3d74['options']?_0x3f3d74[_0xc330('0x17')][_0xc330('0x18')]===undefined?!![]:![]:!![],'where':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')][_0xc330('0x19')]||null:null,'attributes':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')][_0xc330('0x1a')]||null:null,'limit':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')]['limit']||null:null,'include':_0x3f3d74['options']?_0x3f3d74[_0xc330('0x17')][_0xc330('0x1b')]?_[_0xc330('0x1c')](_0x3f3d74[_0xc330('0x17')][_0xc330('0x1b')],function(_0x46caae){return{'model':db[_0x46caae[_0xc330('0x1d')]],'as':_0x46caae['as'],'attributes':_0x46caae[_0xc330('0x1a')],'include':_0x46caae[_0xc330('0x1b')]?_[_0xc330('0x1c')](_0x46caae[_0xc330('0x1b')],function(_0x248132){return{'model':db[_0x248132[_0xc330('0x1d')]],'as':_0x248132['as'],'attributes':_0x248132['attributes'],'include':_0x248132[_0xc330('0x1b')]?_['map'](_0x248132[_0xc330('0x1b')],function(_0x2aaf78){return{'model':db[_0x2aaf78[_0xc330('0x1d')]],'as':_0x2aaf78['as'],'attributes':_0x2aaf78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f50df){logger['info']('GetCampaign',_0x3f3d74);logger[_0xc330('0x1e')](_0xc330('0x15'),_0x3f3d74,JSON[_0xc330('0x10')](_0x5f50df));_0x259adc(_0x5f50df);})[_0xc330('0x1f')](function(_0x381fe5){logger[_0xc330('0x11')]('GetCampaign',_0x381fe5[_0xc330('0x13')],_0x3f3d74);_0xd51374(_0x46f47c['error'](0x1f4,_0x381fe5[_0xc330('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6624649..63b196f 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 _0xd846=['multer','util','path','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','delete','destroy','exports'];(function(_0xe0e203,_0x2fb435){var _0x1eac88=function(_0x4ea644){while(--_0x4ea644){_0xe0e203['push'](_0xe0e203['shift']());}};_0x1eac88(++_0x2fb435);}(_0xd846,0x195));var _0x6d84=function(_0x532aaa,_0x5a5eb4){_0x532aaa=_0x532aaa-0x0;var _0x55d337=_0xd846[_0x532aaa];return _0x55d337;};'use strict';var multer=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var path=require(_0x6d84('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d84('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d84('0x4'));var config=require(_0x6d84('0x5'));var controller=require('./campaign.controller');router[_0x6d84('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d84('0x6')](_0x6d84('0x7'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x9')]);router[_0x6d84('0x6')](_0x6d84('0xa'),auth[_0x6d84('0x8')](),controller[_0x6d84('0xb')]);router[_0x6d84('0x6')](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller['getHopperHistories']);router[_0x6d84('0x6')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x6d84('0xd')]);router[_0x6d84('0x6')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x6d84('0xe')]);router[_0x6d84('0x6')](_0x6d84('0xf'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x10')]);router[_0x6d84('0x6')](_0x6d84('0x11'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x12')]);router[_0x6d84('0x13')]('/',auth[_0x6d84('0x8')](),controller[_0x6d84('0x14')]);router[_0x6d84('0x13')]('/:id/clone',auth[_0x6d84('0x8')](),controller[_0x6d84('0x15')]);router['post'](_0x6d84('0xf'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x16')]);router[_0x6d84('0x13')](_0x6d84('0x11'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6d84('0x18')](_0x6d84('0x7'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x19')]);router[_0x6d84('0x18')](_0x6d84('0xf'),auth[_0x6d84('0x8')](),controller['removeLists']);router[_0x6d84('0x18')]('/:id/blacklists',auth[_0x6d84('0x8')](),controller['removeBlackLists']);module[_0x6d84('0x1a')]=router; \ No newline at end of file +var _0xd044=['delete','/:id/lists','removeLists','exports','multer','util','express','Router','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','destroy'];(function(_0x29adfa,_0x100ea2){var _0x2710e8=function(_0x448e6b){while(--_0x448e6b){_0x29adfa['push'](_0x29adfa['shift']());}};_0x2710e8(++_0x100ea2);}(_0xd044,0x136));var _0x4d04=function(_0x321730,_0x1fb230){_0x321730=_0x321730-0x0;var _0x4344eb=_0xd044[_0x321730];return _0x4344eb;};'use strict';var multer=require(_0x4d04('0x0'));var util=require(_0x4d04('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d04('0x2'));var router=express[_0x4d04('0x3')]();var fs_extra=require(_0x4d04('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d04('0x5'));var controller=require(_0x4d04('0x6'));router[_0x4d04('0x7')]('/',auth[_0x4d04('0x8')](),controller[_0x4d04('0x9')]);router[_0x4d04('0x7')](_0x4d04('0xa'),auth[_0x4d04('0x8')](),controller[_0x4d04('0xb')]);router['get'](_0x4d04('0xc'),auth[_0x4d04('0x8')](),controller[_0x4d04('0xd')]);router[_0x4d04('0x7')](_0x4d04('0xe'),auth['isAuthenticated'](),controller[_0x4d04('0xf')]);router[_0x4d04('0x7')](_0x4d04('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x4d04('0x7')](_0x4d04('0x11'),auth['isAuthenticated'](),controller[_0x4d04('0x12')]);router[_0x4d04('0x7')]('/:id/lists',auth[_0x4d04('0x8')](),controller['getLists']);router[_0x4d04('0x7')](_0x4d04('0x13'),auth[_0x4d04('0x8')](),controller[_0x4d04('0x14')]);router[_0x4d04('0x15')]('/',auth[_0x4d04('0x8')](),controller[_0x4d04('0x16')]);router[_0x4d04('0x15')](_0x4d04('0x17'),auth[_0x4d04('0x8')](),controller[_0x4d04('0x18')]);router[_0x4d04('0x15')]('/:id/lists',auth['isAuthenticated'](),controller[_0x4d04('0x19')]);router[_0x4d04('0x15')](_0x4d04('0x13'),auth['isAuthenticated'](),controller[_0x4d04('0x1a')]);router[_0x4d04('0x1b')](_0x4d04('0xa'),auth[_0x4d04('0x8')](),controller[_0x4d04('0x1c')]);router['delete']('/:id',auth[_0x4d04('0x8')](),controller[_0x4d04('0x1d')]);router[_0x4d04('0x1e')](_0x4d04('0x1f'),auth[_0x4d04('0x8')](),controller[_0x4d04('0x20')]);router[_0x4d04('0x1e')](_0x4d04('0x13'),auth[_0x4d04('0x8')](),controller['removeBlackLists']);module[_0x4d04('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2a72295..6e1d905 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 _0x10a6=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x3888b5,_0x549a42){var _0x77f63e=function(_0x124173){while(--_0x124173){_0x3888b5['push'](_0x3888b5['shift']());}};_0x77f63e(++_0x549a42);}(_0x10a6,0x7e));var _0x610a=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x10a6[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x610a('0x0'));module[_0x610a('0x1')]={'key':{'type':Sequelize[_0x610a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x610a('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x610a('0x2')]},'name':{'type':Sequelize[_0x610a('0x4')],'get':function(){return this[_0x610a('0x5')]('key');}}}; \ No newline at end of file +var _0x3473=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x3edce7,_0x2bc938){var _0x503696=function(_0x2d63ad){while(--_0x2d63ad){_0x3edce7['push'](_0x3edce7['shift']());}};_0x503696(++_0x2bc938);}(_0x3473,0x82));var _0x3347=function(_0x1874e5,_0xabe75a){_0x1874e5=_0x1874e5-0x0;var _0x5541f9=_0x3473[_0x1874e5];return _0x5541f9;};'use strict';var Sequelize=require(_0x3347('0x0'));module[_0x3347('0x1')]={'key':{'type':Sequelize[_0x3347('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x3347('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x3347('0x2')]},'name':{'type':Sequelize[_0x3347('0x4')],'get':function(){return this[_0x3347('0x5')](_0x3347('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 42bd228..43be65a 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 _0xa028=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','intersection','catch','body','find','params','create','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xa028,0x1a0));var _0x8a02=function(_0x519506,_0x49baf9){_0x519506=_0x519506-0x0;var _0x4a9da9=_0xa028[_0x519506];return _0x4a9da9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a02('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a02('0x1'));var rp=require(_0x8a02('0x2'));var moment=require(_0x8a02('0x3'));var BPromise=require(_0x8a02('0x4'));var Mustache=require(_0x8a02('0x5'));var util=require(_0x8a02('0x6'));var path=require(_0x8a02('0x7'));var sox=require(_0x8a02('0x8'));var csv=require('to-csv');var ejs=require(_0x8a02('0x9'));var fs=require('fs');var fs_extra=require(_0x8a02('0xa'));var _=require(_0x8a02('0xb'));var squel=require(_0x8a02('0xc'));var crypto=require('crypto');var jsforce=require(_0x8a02('0xd'));var deskjs=require(_0x8a02('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8a02('0xf'));var Papa=require(_0x8a02('0x10'));var Redis=require(_0x8a02('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8a02('0x12'));var as=require(_0x8a02('0x13'));var hardwareService=require(_0x8a02('0x14'));var logger=require(_0x8a02('0x15'))(_0x8a02('0x16'));var utils=require(_0x8a02('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a02('0x18'))['db'];function respondWithStatusCode(_0x45d764,_0xf7c68a){_0xf7c68a=_0xf7c68a||0xcc;return function(_0x154231){if(_0x154231){return _0x45d764[_0x8a02('0x19')](_0xf7c68a);}return _0x45d764[_0x8a02('0x1a')](_0xf7c68a)[_0x8a02('0x1b')]();};}function respondWithResult(_0x201704,_0x16ba8c){_0x16ba8c=_0x16ba8c||0xc8;return function(_0x5c2e97){if(_0x5c2e97){return _0x201704[_0x8a02('0x1a')](_0x16ba8c)[_0x8a02('0x1c')](_0x5c2e97);}};}function respondWithFilteredResult(_0x4175fc,_0xcd1f20){return function(_0x446c1d){if(_0x446c1d){var _0x16b496=typeof _0xcd1f20[_0x8a02('0x1d')]===_0x8a02('0x1e')&&typeof _0xcd1f20['limit']===_0x8a02('0x1e');var _0x487f40=_0x446c1d[_0x8a02('0x1f')];var _0x6e342e=_0x16b496?0x0:_0xcd1f20[_0x8a02('0x1d')];var _0x2307d2=_0x16b496?_0x446c1d[_0x8a02('0x1f')]:_0xcd1f20['offset']+_0xcd1f20[_0x8a02('0x20')];var _0x26cd9f;if(_0x2307d2>=_0x487f40){_0x2307d2=_0x487f40;_0x26cd9f=0xc8;}else{_0x26cd9f=0xce;}_0x4175fc[_0x8a02('0x1a')](_0x26cd9f);return _0x4175fc['set'](_0x8a02('0x21'),_0x6e342e+'-'+_0x2307d2+'/'+_0x487f40)[_0x8a02('0x1c')](_0x446c1d);}return null;};}function patchUpdates(_0x4d6eb1){return function(_0x3ec362){try{jsonpatch[_0x8a02('0x22')](_0x3ec362,_0x4d6eb1,!![]);}catch(_0x7bf702){return BPromise['reject'](_0x7bf702);}return _0x3ec362['save']();};}function saveUpdates(_0x316110,_0x1686e6){return function(_0x3b1d60){if(_0x3b1d60){return _0x3b1d60[_0x8a02('0x23')](_0x316110)[_0x8a02('0x24')](function(_0x49be5e){return _0x49be5e;});}return null;};}function removeEntity(_0x2e598d,_0x6f1281){return function(_0x2f7620){if(_0x2f7620){return _0x2f7620['destroy']()[_0x8a02('0x24')](function(){var _0x4eaa8a=_0x2f7620[_0x8a02('0x25')]({'plain':!![]});var _0x574b63='CannedAnswers';return db[_0x8a02('0x26')][_0x8a02('0x27')]({'where':{'type':_0x574b63,'resourceId':_0x4eaa8a['id']}})[_0x8a02('0x24')](function(){return _0x2f7620;});})['then'](function(){_0x2e598d['status'](0xcc)[_0x8a02('0x1b')]();});}};}function handleEntityNotFound(_0x36e703,_0x5541f2){return function(_0x1e134a){if(!_0x1e134a){_0x36e703['sendStatus'](0x194);}return _0x1e134a;};}function handleError(_0x1dcef8,_0xf2014a){_0xf2014a=_0xf2014a||0x1f4;return function(_0x48dc50){logger[_0x8a02('0x28')](_0x48dc50[_0x8a02('0x29')]);if(_0x48dc50['name']){delete _0x48dc50[_0x8a02('0x2a')];}_0x1dcef8[_0x8a02('0x1a')](_0xf2014a)[_0x8a02('0x2b')](_0x48dc50);};}exports[_0x8a02('0x2c')]=function(_0x5ddcb9,_0x329575){var _0x3a5ab8={},_0x3d5ed4={},_0x141ee3={'count':0x0,'rows':[]};var _0x23b62b=_['map'](db[_0x8a02('0x2d')][_0x8a02('0x2e')],function(_0xa0a7dd){return{'name':_0xa0a7dd[_0x8a02('0x2f')],'type':_0xa0a7dd[_0x8a02('0x30')][_0x8a02('0x31')]};});_0x3d5ed4[_0x8a02('0x32')]=_[_0x8a02('0x33')](_0x23b62b,_0x8a02('0x2a'));_0x3d5ed4[_0x8a02('0x34')]=_[_0x8a02('0x35')](_0x5ddcb9['query']);_0x3d5ed4[_0x8a02('0x36')]=_['intersection'](_0x3d5ed4[_0x8a02('0x32')],_0x3d5ed4['query']);_0x3a5ab8[_0x8a02('0x37')]=_['intersection'](_0x3d5ed4[_0x8a02('0x32')],qs[_0x8a02('0x38')](_0x5ddcb9[_0x8a02('0x34')]['fields']));_0x3a5ab8[_0x8a02('0x37')]=_0x3a5ab8[_0x8a02('0x37')][_0x8a02('0x39')]?_0x3a5ab8[_0x8a02('0x37')]:_0x3d5ed4[_0x8a02('0x32')];if(!_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x3a')](_0x8a02('0x3b'))){_0x3a5ab8[_0x8a02('0x20')]=qs[_0x8a02('0x20')](_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x20')]);_0x3a5ab8[_0x8a02('0x1d')]=qs['offset'](_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x1d')]);}_0x3a5ab8[_0x8a02('0x3c')]=qs['sort'](_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x3d')]);_0x3a5ab8[_0x8a02('0x3e')]=qs[_0x8a02('0x36')](_[_0x8a02('0x3f')](_0x5ddcb9[_0x8a02('0x34')],_0x3d5ed4[_0x8a02('0x36')]),_0x23b62b);if(_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x40')]){_0x3a5ab8[_0x8a02('0x3e')]=_['merge'](_0x3a5ab8[_0x8a02('0x3e')],{'$or':[{'key':{'$like':'%'+_0x5ddcb9['query']['filter']+'%'}},{'value':{'$like':'%'+_0x5ddcb9['query'][_0x8a02('0x40')]+'%'}}]});}_0x3a5ab8=_[_0x8a02('0x41')]({},_0x3a5ab8,_0x5ddcb9[_0x8a02('0x42')]);var _0x5e56da={'where':_0x3a5ab8['where']};return db[_0x8a02('0x2d')][_0x8a02('0x1f')](_0x5e56da)['then'](function(_0x3ab40b){_0x141ee3[_0x8a02('0x1f')]=_0x3ab40b;if(_0x5ddcb9[_0x8a02('0x34')][_0x8a02('0x43')]){_0x3a5ab8[_0x8a02('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8a02('0x45')](_0x3a5ab8);})[_0x8a02('0x24')](function(_0x12e71f){_0x141ee3['rows']=_0x12e71f;return _0x141ee3;})[_0x8a02('0x24')](respondWithFilteredResult(_0x329575,_0x3a5ab8))['catch'](handleError(_0x329575,null));};exports[_0x8a02('0x46')]=function(_0x556372,_0x4ca406){var _0x588f35={'raw':!![],'where':{'id':_0x556372['params']['id']}},_0x4d77ec={};_0x4d77ec[_0x8a02('0x32')]=_[_0x8a02('0x35')](db[_0x8a02('0x2d')][_0x8a02('0x2e')]);_0x4d77ec['query']=_[_0x8a02('0x35')](_0x556372['query']);_0x4d77ec['filters']=_[_0x8a02('0x47')](_0x4d77ec[_0x8a02('0x32')],_0x4d77ec[_0x8a02('0x34')]);_0x588f35[_0x8a02('0x37')]=_[_0x8a02('0x47')](_0x4d77ec[_0x8a02('0x32')],qs['fields'](_0x556372[_0x8a02('0x34')]['fields']));_0x588f35[_0x8a02('0x37')]=_0x588f35[_0x8a02('0x37')][_0x8a02('0x39')]?_0x588f35[_0x8a02('0x37')]:_0x4d77ec[_0x8a02('0x32')];if(_0x556372['query']['includeAll']){_0x588f35['include']=[{'all':!![]}];}_0x588f35=_[_0x8a02('0x41')]({},_0x588f35,_0x556372[_0x8a02('0x42')]);return db[_0x8a02('0x2d')]['find'](_0x588f35)[_0x8a02('0x24')](handleEntityNotFound(_0x4ca406,null))['then'](respondWithResult(_0x4ca406,null))[_0x8a02('0x48')](handleError(_0x4ca406,null));};exports[_0x8a02('0x23')]=function(_0x1d130a,_0x496acc){if(_0x1d130a[_0x8a02('0x49')]['id']){delete _0x1d130a[_0x8a02('0x49')]['id'];}return db[_0x8a02('0x2d')][_0x8a02('0x4a')]({'where':{'id':_0x1d130a[_0x8a02('0x4b')]['id']}})[_0x8a02('0x24')](handleEntityNotFound(_0x496acc,null))[_0x8a02('0x24')](saveUpdates(_0x1d130a[_0x8a02('0x49')],null))[_0x8a02('0x24')](respondWithResult(_0x496acc,null))[_0x8a02('0x48')](handleError(_0x496acc,null));};exports[_0x8a02('0x27')]=function(_0x5aa846,_0x185e4f){return db[_0x8a02('0x2d')][_0x8a02('0x4a')]({'where':{'id':_0x5aa846[_0x8a02('0x4b')]['id']}})['then'](handleEntityNotFound(_0x185e4f,null))[_0x8a02('0x24')](removeEntity(_0x185e4f,null))[_0x8a02('0x48')](handleError(_0x185e4f,null));};exports[_0x8a02('0x4c')]=function(_0x34a006,_0x1b4ac9){var _0x24e012={'key':_0x34a006[_0x8a02('0x49')][_0x8a02('0x31')]};if(_0x34a006[_0x8a02('0x49')][_0x8a02('0x4d')]){_0x24e012[_0x8a02('0x4d')]=_0x34a006[_0x8a02('0x49')][_0x8a02('0x4d')];}else if(_0x34a006[_0x8a02('0x49')]['SmsAccountId']){_0x24e012['SmsAccountId']=_0x34a006[_0x8a02('0x49')][_0x8a02('0x4e')];}else if(_0x34a006['body']['OpenchannelAccountId']){_0x24e012['OpenchannelAccountId']=_0x34a006[_0x8a02('0x49')]['OpenchannelAccountId'];}else if(_0x34a006[_0x8a02('0x49')][_0x8a02('0x4f')]){_0x24e012[_0x8a02('0x4f')]=_0x34a006[_0x8a02('0x49')][_0x8a02('0x4f')];}return db[_0x8a02('0x2d')][_0x8a02('0x4a')]({'where':_0x24e012})[_0x8a02('0x24')](function(_0x148058){if(_0x148058){throw new db[(_0x8a02('0x50'))][(_0x8a02('0x51'))](_0x8a02('0x52'));}return db[_0x8a02('0x2d')][_0x8a02('0x4c')](_0x34a006[_0x8a02('0x49')]);})[_0x8a02('0x24')](function(_0x2e02cb){var _0x34c6c7=_0x34a006[_0x8a02('0x53')][_0x8a02('0x25')]({'plain':!![]});if(!_0x34c6c7)throw new Error(_0x8a02('0x54'));if(_0x34c6c7['role']===_0x8a02('0x53')){var _0x7a023c=_0x2e02cb['get']({'plain':!![]});return db['UserProfileSection'][_0x8a02('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x34c6c7[_0x8a02('0x55')]},'raw':!![]})[_0x8a02('0x24')](function(_0x19c7ec){if(_0x19c7ec&&_0x19c7ec['autoAssociation']===0x0){return db[_0x8a02('0x26')][_0x8a02('0x4c')]({'name':_0x7a023c[_0x8a02('0x2a')],'resourceId':_0x7a023c['id'],'type':_0x19c7ec['name'],'sectionId':_0x19c7ec['id']},{})['then'](function(){return _0x2e02cb;});}else{return _0x2e02cb;}})[_0x8a02('0x48')](function(_0x3a2e94){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a2e94);throw _0x3a2e94;});}return _0x2e02cb;})[_0x8a02('0x24')](respondWithResult(_0x1b4ac9,0xc9))[_0x8a02('0x48')](handleError(_0x1b4ac9,null));}; \ No newline at end of file +var _0xe51c=['merge','options','includeAll','include','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','jsforce','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','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','CannedAnswers','error','name','send','index','CannedAnswer','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x46bfb0,_0x5ace78){var _0x4da742=function(_0x55149e){while(--_0x55149e){_0x46bfb0['push'](_0x46bfb0['shift']());}};_0x4da742(++_0x5ace78);}(_0xe51c,0x6f));var _0xce51=function(_0x19826f,_0x273748){_0x19826f=_0x19826f-0x0;var _0xa1cce4=_0xe51c[_0x19826f];return _0xa1cce4;};'use strict';var emlformat=require(_0xce51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce51('0x1'));var jsonpatch=require(_0xce51('0x2'));var rp=require(_0xce51('0x3'));var moment=require(_0xce51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce51('0x5'));var util=require(_0xce51('0x6'));var path=require(_0xce51('0x7'));var sox=require('sox');var csv=require(_0xce51('0x8'));var ejs=require(_0xce51('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce51('0xa'));var crypto=require('crypto');var jsforce=require(_0xce51('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xce51('0x8'));var querystring=require('querystring');var Papa=require(_0xce51('0xc'));var Redis=require(_0xce51('0xd'));var authService=require(_0xce51('0xe'));var qs=require(_0xce51('0xf'));var as=require(_0xce51('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce51('0x11'))('api');var utils=require(_0xce51('0x12'));var config=require(_0xce51('0x13'));var licenseUtil=require(_0xce51('0x14'));var db=require(_0xce51('0x15'))['db'];function respondWithStatusCode(_0x557951,_0xb2738b){_0xb2738b=_0xb2738b||0xcc;return function(_0x15229f){if(_0x15229f){return _0x557951[_0xce51('0x16')](_0xb2738b);}return _0x557951[_0xce51('0x17')](_0xb2738b)[_0xce51('0x18')]();};}function respondWithResult(_0xf8bde9,_0x17409c){_0x17409c=_0x17409c||0xc8;return function(_0x40bd80){if(_0x40bd80){return _0xf8bde9[_0xce51('0x17')](_0x17409c)[_0xce51('0x19')](_0x40bd80);}};}function respondWithFilteredResult(_0x1b7ff7,_0x29c7c4){return function(_0x5925b1){if(_0x5925b1){var _0x37bfbc=typeof _0x29c7c4['offset']===_0xce51('0x1a')&&typeof _0x29c7c4[_0xce51('0x1b')]===_0xce51('0x1a');var _0x46f8e3=_0x5925b1[_0xce51('0x1c')];var _0x289d43=_0x37bfbc?0x0:_0x29c7c4['offset'];var _0x461aed=_0x37bfbc?_0x5925b1[_0xce51('0x1c')]:_0x29c7c4[_0xce51('0x1d')]+_0x29c7c4[_0xce51('0x1b')];var _0x29635f;if(_0x461aed>=_0x46f8e3){_0x461aed=_0x46f8e3;_0x29635f=0xc8;}else{_0x29635f=0xce;}_0x1b7ff7[_0xce51('0x17')](_0x29635f);return _0x1b7ff7['set']('Content-Range',_0x289d43+'-'+_0x461aed+'/'+_0x46f8e3)['json'](_0x5925b1);}return null;};}function patchUpdates(_0x3b0eb5){return function(_0x5e52f5){try{jsonpatch[_0xce51('0x1e')](_0x5e52f5,_0x3b0eb5,!![]);}catch(_0x2bac59){return BPromise[_0xce51('0x1f')](_0x2bac59);}return _0x5e52f5[_0xce51('0x20')]();};}function saveUpdates(_0x32bf53,_0x54bd99){return function(_0x1b0ff4){if(_0x1b0ff4){return _0x1b0ff4[_0xce51('0x21')](_0x32bf53)[_0xce51('0x22')](function(_0x1234ed){return _0x1234ed;});}return null;};}function removeEntity(_0x2fefe8,_0x53c23d){return function(_0x4ba370){if(_0x4ba370){return _0x4ba370[_0xce51('0x23')]()[_0xce51('0x22')](function(){var _0x178c74=_0x4ba370[_0xce51('0x24')]({'plain':!![]});var _0x4102eb=_0xce51('0x25');return db['UserProfileResource'][_0xce51('0x23')]({'where':{'type':_0x4102eb,'resourceId':_0x178c74['id']}})['then'](function(){return _0x4ba370;});})[_0xce51('0x22')](function(){_0x2fefe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x341936,_0x26a47c){return function(_0x3f713a){if(!_0x3f713a){_0x341936[_0xce51('0x16')](0x194);}return _0x3f713a;};}function handleError(_0x2cd373,_0x3c27ad){_0x3c27ad=_0x3c27ad||0x1f4;return function(_0xe9bb13){logger[_0xce51('0x26')](_0xe9bb13['stack']);if(_0xe9bb13[_0xce51('0x27')]){delete _0xe9bb13[_0xce51('0x27')];}_0x2cd373[_0xce51('0x17')](_0x3c27ad)[_0xce51('0x28')](_0xe9bb13);};}exports[_0xce51('0x29')]=function(_0x95c04c,_0x419441){var _0x59a9aa={},_0xfd5e5a={},_0x105cac={'count':0x0,'rows':[]};var _0x563753=_['map'](db[_0xce51('0x2a')][_0xce51('0x2b')],function(_0x5d6510){return{'name':_0x5d6510[_0xce51('0x2c')],'type':_0x5d6510['type'][_0xce51('0x2d')]};});_0xfd5e5a[_0xce51('0x2e')]=_[_0xce51('0x2f')](_0x563753,_0xce51('0x27'));_0xfd5e5a[_0xce51('0x30')]=_['keys'](_0x95c04c[_0xce51('0x30')]);_0xfd5e5a[_0xce51('0x31')]=_['intersection'](_0xfd5e5a[_0xce51('0x2e')],_0xfd5e5a[_0xce51('0x30')]);_0x59a9aa['attributes']=_[_0xce51('0x32')](_0xfd5e5a['model'],qs[_0xce51('0x33')](_0x95c04c[_0xce51('0x30')]['fields']));_0x59a9aa[_0xce51('0x34')]=_0x59a9aa['attributes'][_0xce51('0x35')]?_0x59a9aa[_0xce51('0x34')]:_0xfd5e5a[_0xce51('0x2e')];if(!_0x95c04c[_0xce51('0x30')][_0xce51('0x36')](_0xce51('0x37'))){_0x59a9aa[_0xce51('0x1b')]=qs[_0xce51('0x1b')](_0x95c04c[_0xce51('0x30')]['limit']);_0x59a9aa[_0xce51('0x1d')]=qs[_0xce51('0x1d')](_0x95c04c['query'][_0xce51('0x1d')]);}_0x59a9aa[_0xce51('0x38')]=qs['sort'](_0x95c04c['query'][_0xce51('0x39')]);_0x59a9aa[_0xce51('0x3a')]=qs[_0xce51('0x31')](_[_0xce51('0x3b')](_0x95c04c[_0xce51('0x30')],_0xfd5e5a[_0xce51('0x31')]),_0x563753);if(_0x95c04c['query'][_0xce51('0x3c')]){_0x59a9aa['where']=_[_0xce51('0x3d')](_0x59a9aa['where'],{'$or':[{'key':{'$like':'%'+_0x95c04c[_0xce51('0x30')][_0xce51('0x3c')]+'%'}},{'value':{'$like':'%'+_0x95c04c[_0xce51('0x30')]['filter']+'%'}}]});}_0x59a9aa=_[_0xce51('0x3d')]({},_0x59a9aa,_0x95c04c[_0xce51('0x3e')]);var _0x44402f={'where':_0x59a9aa[_0xce51('0x3a')]};return db[_0xce51('0x2a')]['count'](_0x44402f)[_0xce51('0x22')](function(_0x33876d){_0x105cac[_0xce51('0x1c')]=_0x33876d;if(_0x95c04c[_0xce51('0x30')][_0xce51('0x3f')]){_0x59a9aa[_0xce51('0x40')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x59a9aa);})['then'](function(_0x5b85c0){_0x105cac[_0xce51('0x41')]=_0x5b85c0;return _0x105cac;})[_0xce51('0x22')](respondWithFilteredResult(_0x419441,_0x59a9aa))[_0xce51('0x42')](handleError(_0x419441,null));};exports[_0xce51('0x43')]=function(_0x5a233a,_0x3e95d5){var _0x4e8140={'raw':!![],'where':{'id':_0x5a233a[_0xce51('0x44')]['id']}},_0x4b9dcc={};_0x4b9dcc[_0xce51('0x2e')]=_['keys'](db['CannedAnswer'][_0xce51('0x2b')]);_0x4b9dcc[_0xce51('0x30')]=_[_0xce51('0x45')](_0x5a233a[_0xce51('0x30')]);_0x4b9dcc[_0xce51('0x31')]=_[_0xce51('0x32')](_0x4b9dcc[_0xce51('0x2e')],_0x4b9dcc[_0xce51('0x30')]);_0x4e8140[_0xce51('0x34')]=_['intersection'](_0x4b9dcc[_0xce51('0x2e')],qs[_0xce51('0x33')](_0x5a233a[_0xce51('0x30')]['fields']));_0x4e8140[_0xce51('0x34')]=_0x4e8140[_0xce51('0x34')][_0xce51('0x35')]?_0x4e8140[_0xce51('0x34')]:_0x4b9dcc['model'];if(_0x5a233a['query'][_0xce51('0x3f')]){_0x4e8140[_0xce51('0x40')]=[{'all':!![]}];}_0x4e8140=_[_0xce51('0x3d')]({},_0x4e8140,_0x5a233a[_0xce51('0x3e')]);return db[_0xce51('0x2a')][_0xce51('0x46')](_0x4e8140)[_0xce51('0x22')](handleEntityNotFound(_0x3e95d5,null))[_0xce51('0x22')](respondWithResult(_0x3e95d5,null))[_0xce51('0x42')](handleError(_0x3e95d5,null));};exports['update']=function(_0x36b121,_0x1d7643){if(_0x36b121[_0xce51('0x47')]['id']){delete _0x36b121['body']['id'];}return db[_0xce51('0x2a')]['find']({'where':{'id':_0x36b121[_0xce51('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d7643,null))[_0xce51('0x22')](saveUpdates(_0x36b121[_0xce51('0x47')],null))['then'](respondWithResult(_0x1d7643,null))[_0xce51('0x42')](handleError(_0x1d7643,null));};exports['destroy']=function(_0x3de777,_0x4f8d56){return db['CannedAnswer'][_0xce51('0x46')]({'where':{'id':_0x3de777['params']['id']}})['then'](handleEntityNotFound(_0x4f8d56,null))[_0xce51('0x22')](removeEntity(_0x4f8d56,null))[_0xce51('0x42')](handleError(_0x4f8d56,null));};exports[_0xce51('0x48')]=function(_0x3dadd0,_0xc91b08){var _0x1c85af={'key':_0x3dadd0[_0xce51('0x47')][_0xce51('0x2d')]};if(_0x3dadd0['body'][_0xce51('0x49')]){_0x1c85af[_0xce51('0x49')]=_0x3dadd0[_0xce51('0x47')]['MailAccountId'];}else if(_0x3dadd0[_0xce51('0x47')][_0xce51('0x4a')]){_0x1c85af['SmsAccountId']=_0x3dadd0[_0xce51('0x47')][_0xce51('0x4a')];}else if(_0x3dadd0[_0xce51('0x47')][_0xce51('0x4b')]){_0x1c85af[_0xce51('0x4b')]=_0x3dadd0[_0xce51('0x47')]['OpenchannelAccountId'];}else if(_0x3dadd0[_0xce51('0x47')][_0xce51('0x4c')]){_0x1c85af[_0xce51('0x4c')]=_0x3dadd0[_0xce51('0x47')][_0xce51('0x4c')];}return db[_0xce51('0x2a')]['find']({'where':_0x1c85af})[_0xce51('0x22')](function(_0x198117){if(_0x198117){throw new db[(_0xce51('0x4d'))][(_0xce51('0x4e'))](_0xce51('0x4f'));}return db['CannedAnswer'][_0xce51('0x48')](_0x3dadd0[_0xce51('0x47')]);})[_0xce51('0x22')](function(_0x240436){var _0x57646e=_0x3dadd0['user'][_0xce51('0x24')]({'plain':!![]});if(!_0x57646e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57646e[_0xce51('0x50')]===_0xce51('0x51')){var _0x5d3945=_0x240436[_0xce51('0x24')]({'plain':!![]});return db[_0xce51('0x52')][_0xce51('0x46')]({'where':{'name':_0xce51('0x25'),'userProfileId':_0x57646e['userProfileId']},'raw':!![]})[_0xce51('0x22')](function(_0x2bc9fc){if(_0x2bc9fc&&_0x2bc9fc[_0xce51('0x53')]===0x0){return db[_0xce51('0x54')]['create']({'name':_0x5d3945[_0xce51('0x27')],'resourceId':_0x5d3945['id'],'type':_0x2bc9fc[_0xce51('0x27')],'sectionId':_0x2bc9fc['id']},{})['then'](function(){return _0x240436;});}else{return _0x240436;}})[_0xce51('0x42')](function(_0xae370b){logger['error'](_0xce51('0x55'),_0xae370b);throw _0xae370b;});}return _0x240436;})[_0xce51('0x22')](respondWithResult(_0xc91b08,0xc9))[_0xce51('0x42')](handleError(_0xc91b08,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 44f8de8..8b08079 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 _0x7c6b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x57828d,_0x131ac9){var _0x532632=function(_0x7b49f5){while(--_0x7b49f5){_0x57828d['push'](_0x57828d['shift']());}};_0x532632(++_0x131ac9);}(_0x7c6b,0x14f));var _0xb7c6=function(_0x16f59a,_0x1f0c24){_0x16f59a=_0x16f59a-0x0;var _0x5c4268=_0x7c6b[_0x16f59a];return _0x5c4268;};'use strict';var _=require(_0xb7c6('0x0'));var util=require(_0xb7c6('0x1'));var logger=require(_0xb7c6('0x2'))(_0xb7c6('0x3'));var moment=require(_0xb7c6('0x4'));var BPromise=require(_0xb7c6('0x5'));var rp=require(_0xb7c6('0x6'));var fs=require('fs');var path=require(_0xb7c6('0x7'));var rimraf=require(_0xb7c6('0x8'));var config=require(_0xb7c6('0x9'));var attributes=require(_0xb7c6('0xa'));module[_0xb7c6('0xb')]=function(_0x31d1ca,_0x25ed0d){return _0x31d1ca['define'](_0xb7c6('0xc'),attributes,{'tableName':_0xb7c6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7c6('0xe'),'collate':_0xb7c6('0xf')});}; \ No newline at end of file +var _0x771a=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers'];(function(_0x17170e,_0x57dd3c){var _0x4eed30=function(_0x247a75){while(--_0x247a75){_0x17170e['push'](_0x17170e['shift']());}};_0x4eed30(++_0x57dd3c);}(_0x771a,0x10a));var _0xa771=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x771a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0xa771('0x0'));var logger=require(_0xa771('0x1'))(_0xa771('0x2'));var moment=require('moment');var BPromise=require(_0xa771('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa771('0x4'));var config=require(_0xa771('0x5'));var attributes=require(_0xa771('0x6'));module[_0xa771('0x7')]=function(_0x585b21,_0x3baf64){return _0x585b21['define'](_0xa771('0x8'),attributes,{'tableName':_0xa771('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa771('0xa'),'collate':_0xa771('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f16d780..3b8cf1c 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(_0x4c8fc3,_0x15fed8){var _0x511be7=function(_0xa154b6){while(--_0xa154b6){_0x4c8fc3['push'](_0x4c8fc3['shift']());}};_0x511be7(++_0x15fed8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x3a6f9f,_0x444e39){var _0x1aa922=function(_0x285ca1){while(--_0x285ca1){_0x3a6f9f['push'](_0x3a6f9f['shift']());}};_0x1aa922(++_0x444e39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 dbeab76..f02ab6d 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 _0x4091=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','update','destroy','multer','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4091,0x98));var _0x1409=function(_0xb22c6d,_0x14c89d){_0xb22c6d=_0xb22c6d-0x0;var _0x562ce7=_0x4091[_0xb22c6d];return _0x562ce7;};'use strict';var multer=require(_0x1409('0x0'));var util=require('util');var path=require(_0x1409('0x1'));var timeout=require(_0x1409('0x2'));var express=require(_0x1409('0x3'));var router=express[_0x1409('0x4')]();var fs_extra=require(_0x1409('0x5'));var auth=require(_0x1409('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1409('0x7'));var controller=require('./cannedAnswer.controller');router[_0x1409('0x8')]('/',auth['isAuthenticated'](),controller[_0x1409('0x9')]);router[_0x1409('0x8')](_0x1409('0xa'),auth[_0x1409('0xb')](),controller['show']);router['post']('/',auth[_0x1409('0xb')](),controller['create']);router['put']('/:id',auth[_0x1409('0xb')](),controller[_0x1409('0xc')]);router['delete'](_0x1409('0xa'),auth['isAuthenticated'](),controller[_0x1409('0xd')]);module['exports']=router; \ No newline at end of file +var _0xd378=['destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x513789,_0x3d7067){var _0xbdc2f3=function(_0x4610ac){while(--_0x4610ac){_0x513789['push'](_0x513789['shift']());}};_0xbdc2f3(++_0x3d7067);}(_0xd378,0x1b2));var _0x8d37=function(_0x269c76,_0x12a084){_0x269c76=_0x269c76-0x0;var _0x50aeef=_0xd378[_0x269c76];return _0x50aeef;};'use strict';var multer=require(_0x8d37('0x0'));var util=require(_0x8d37('0x1'));var path=require('path');var timeout=require(_0x8d37('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d37('0x3'));var interaction=require(_0x8d37('0x4'));var config=require(_0x8d37('0x5'));var controller=require(_0x8d37('0x6'));router['get']('/',auth[_0x8d37('0x7')](),controller[_0x8d37('0x8')]);router['get'](_0x8d37('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8d37('0xa')]('/',auth[_0x8d37('0x7')](),controller[_0x8d37('0xb')]);router[_0x8d37('0xc')](_0x8d37('0x9'),auth['isAuthenticated'](),controller[_0x8d37('0xd')]);router['delete']('/:id',auth[_0x8d37('0x7')](),controller[_0x8d37('0xe')]);module[_0x8d37('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9bff9e3..7fef7af 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 _0x4522=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x453301,_0x5d1884){var _0x9de8b6=function(_0x481b74){while(--_0x481b74){_0x453301['push'](_0x453301['shift']());}};_0x9de8b6(++_0x5d1884);}(_0x4522,0x1a0));var _0x2452=function(_0x3a3b2c,_0x5b4df9){_0x3a3b2c=_0x3a3b2c-0x0;var _0x5237b2=_0x4522[_0x3a3b2c];return _0x5237b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x2452('0x0')],'allowNull':![],'defaultValue':_0x2452('0x1')},'clid':{'type':Sequelize[_0x2452('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x2452('0x2')]},'dcontext':{'type':Sequelize[_0x2452('0x2')]},'channel':{'type':Sequelize[_0x2452('0x2')]},'dstchannel':{'type':Sequelize[_0x2452('0x2')]},'lastapp':{'type':Sequelize[_0x2452('0x2')]},'lastdata':{'type':Sequelize[_0x2452('0x2')]},'duration':{'type':Sequelize[_0x2452('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2452('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2452('0x2')]},'amaflags':{'type':Sequelize[_0x2452('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2452('0x2')]},'userfield':{'type':Sequelize[_0x2452('0x2')]},'uniqueid':{'type':Sequelize[_0x2452('0x2')]},'linkedid':{'type':Sequelize[_0x2452('0x2')]},'sequence':{'type':Sequelize[_0x2452('0x2')]},'peeraccount':{'type':Sequelize[_0x2452('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2f3=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x34f34c,_0x4bae58){var _0x5fd6d3=function(_0x18f7d1){while(--_0x18f7d1){_0x34f34c['push'](_0x34f34c['shift']());}};_0x5fd6d3(++_0x4bae58);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x399c95,_0x587c71){_0x399c95=_0x399c95-0x0;var _0x270406=_0xf2f3[_0x399c95];return _0x270406;};'use strict';var Sequelize=require('sequelize');module[_0x3f2f('0x0')]={'calldate':{'type':Sequelize[_0x3f2f('0x1')],'allowNull':![],'defaultValue':_0x3f2f('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x3f2f('0x3')]},'dst':{'type':Sequelize[_0x3f2f('0x3')]},'dcontext':{'type':Sequelize[_0x3f2f('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x3f2f('0x3')]},'lastdata':{'type':Sequelize[_0x3f2f('0x3')]},'duration':{'type':Sequelize[_0x3f2f('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3f2f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3f2f('0x3')]},'amaflags':{'type':Sequelize[_0x3f2f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3f2f('0x3')]},'userfield':{'type':Sequelize[_0x3f2f('0x3')]},'uniqueid':{'type':Sequelize[_0x3f2f('0x3')]},'linkedid':{'type':Sequelize[_0x3f2f('0x3')]},'sequence':{'type':Sequelize[_0x3f2f('0x3')]},'peeraccount':{'type':Sequelize[_0x3f2f('0x3')]},'type':{'type':Sequelize[_0x3f2f('0x3')]},'tag':{'type':Sequelize[_0x3f2f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9bbb2fc..74eb30c 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 _0x6c32=['name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','error'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require(_0x26c3('0x1'));var zipdir=require(_0x26c3('0x2'));var jsonpatch=require(_0x26c3('0x3'));var rp=require(_0x26c3('0x4'));var moment=require(_0x26c3('0x5'));var BPromise=require(_0x26c3('0x6'));var Mustache=require(_0x26c3('0x7'));var util=require(_0x26c3('0x8'));var path=require('path');var sox=require(_0x26c3('0x9'));var csv=require(_0x26c3('0xa'));var ejs=require(_0x26c3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c3('0xc'));var squel=require('squel');var crypto=require(_0x26c3('0xd'));var jsforce=require(_0x26c3('0xe'));var deskjs=require(_0x26c3('0xf'));var toCsv=require(_0x26c3('0xa'));var querystring=require(_0x26c3('0x10'));var Papa=require(_0x26c3('0x11'));var Redis=require(_0x26c3('0x12'));var authService=require(_0x26c3('0x13'));var qs=require(_0x26c3('0x14'));var as=require(_0x26c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26c3('0x16'));var licenseUtil=require(_0x26c3('0x17'));var db=require(_0x26c3('0x18'))['db'];function respondWithStatusCode(_0x457fc9,_0x4b8d92){_0x4b8d92=_0x4b8d92||0xcc;return function(_0x4c7b94){if(_0x4c7b94){return _0x457fc9[_0x26c3('0x19')](_0x4b8d92);}return _0x457fc9[_0x26c3('0x1a')](_0x4b8d92)[_0x26c3('0x1b')]();};}function respondWithResult(_0x3cd3c7,_0x17c399){_0x17c399=_0x17c399||0xc8;return function(_0x568d0b){if(_0x568d0b){return _0x3cd3c7['status'](_0x17c399)[_0x26c3('0x1c')](_0x568d0b);}};}function respondWithFilteredResult(_0xc14c69,_0x4f4256){return function(_0x4ed7c1){if(_0x4ed7c1){var _0x124cb3=typeof _0x4f4256['offset']===_0x26c3('0x1d')&&typeof _0x4f4256['limit']==='undefined';var _0x3931d5=_0x4ed7c1['count'];var _0x38fe17=_0x124cb3?0x0:_0x4f4256['offset'];var _0x170039=_0x124cb3?_0x4ed7c1[_0x26c3('0x1e')]:_0x4f4256[_0x26c3('0x1f')]+_0x4f4256[_0x26c3('0x20')];var _0x20317d;if(_0x170039>=_0x3931d5){_0x170039=_0x3931d5;_0x20317d=0xc8;}else{_0x20317d=0xce;}_0xc14c69['status'](_0x20317d);return _0xc14c69['set'](_0x26c3('0x21'),_0x38fe17+'-'+_0x170039+'/'+_0x3931d5)[_0x26c3('0x1c')](_0x4ed7c1);}return null;};}function patchUpdates(_0x480b76){return function(_0x5344e7){try{jsonpatch[_0x26c3('0x22')](_0x5344e7,_0x480b76,!![]);}catch(_0x5c2f7d){return BPromise['reject'](_0x5c2f7d);}return _0x5344e7[_0x26c3('0x23')]();};}function saveUpdates(_0x4eb863,_0x21034d){return function(_0x4a76b5){if(_0x4a76b5){return _0x4a76b5[_0x26c3('0x24')](_0x4eb863)['then'](function(_0x449548){return _0x449548;});}return null;};}function removeEntity(_0x146b69,_0x2f1648){return function(_0xdc0f2c){if(_0xdc0f2c){return _0xdc0f2c[_0x26c3('0x25')]()[_0x26c3('0x26')](function(){_0x146b69[_0x26c3('0x1a')](0xcc)[_0x26c3('0x1b')]();});}};}function handleEntityNotFound(_0x85a057,_0x3f6a18){return function(_0x52dae1){if(!_0x52dae1){_0x85a057[_0x26c3('0x19')](0x194);}return _0x52dae1;};}function handleError(_0x4c7696,_0x50d85e){_0x50d85e=_0x50d85e||0x1f4;return function(_0x44b4f8){logger[_0x26c3('0x27')](_0x44b4f8['stack']);if(_0x44b4f8[_0x26c3('0x28')]){delete _0x44b4f8['name'];}_0x4c7696[_0x26c3('0x1a')](_0x50d85e)[_0x26c3('0x29')](_0x44b4f8);};}exports[_0x26c3('0x2a')]=function(_0x130fcc,_0x3dbda5){var _0x50cd11={},_0x1d3331={},_0x27f556={'count':0x0,'rows':[]};var _0xebb766=_[_0x26c3('0x2b')](db[_0x26c3('0x2c')][_0x26c3('0x2d')],function(_0x5557b8){return{'name':_0x5557b8[_0x26c3('0x2e')],'type':_0x5557b8[_0x26c3('0x2f')][_0x26c3('0x30')]};});_0x1d3331['model']=_[_0x26c3('0x2b')](_0xebb766,_0x26c3('0x28'));_0x1d3331[_0x26c3('0x31')]=_[_0x26c3('0x32')](_0x130fcc[_0x26c3('0x31')]);_0x1d3331[_0x26c3('0x33')]=_['intersection'](_0x1d3331[_0x26c3('0x34')],_0x1d3331[_0x26c3('0x31')]);_0x50cd11['attributes']=_['intersection'](_0x1d3331['model'],qs['fields'](_0x130fcc['query'][_0x26c3('0x35')]));_0x50cd11[_0x26c3('0x36')]=_0x50cd11['attributes'][_0x26c3('0x37')]?_0x50cd11[_0x26c3('0x36')]:_0x1d3331['model'];if(!_0x130fcc['query'][_0x26c3('0x38')]('nolimit')){_0x50cd11[_0x26c3('0x20')]=qs['limit'](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x20')]);_0x50cd11[_0x26c3('0x1f')]=qs[_0x26c3('0x1f')](_0x130fcc[_0x26c3('0x31')]['offset']);}_0x50cd11[_0x26c3('0x39')]=qs[_0x26c3('0x3a')](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3a')]);_0x50cd11[_0x26c3('0x3b')]=qs[_0x26c3('0x33')](_['pick'](_0x130fcc['query'],_0x1d3331[_0x26c3('0x33')]),_0xebb766);if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3c')]){_0x50cd11[_0x26c3('0x3b')]=_[_0x26c3('0x3d')](_0x50cd11['where'],{'$or':_['map'](_0xebb766,function(_0x4c2df1){if(_0x4c2df1[_0x26c3('0x2f')]!==_0x26c3('0x3e')){var _0x832ef2={};_0x832ef2[_0x4c2df1[_0x26c3('0x28')]]={'$like':'%'+_0x130fcc[_0x26c3('0x31')]['filter']+'%'};return _0x832ef2;}})});}_0x50cd11=_['merge']({},_0x50cd11,_0x130fcc[_0x26c3('0x3f')]);var _0x16e680={'where':_0x50cd11[_0x26c3('0x3b')]};return db[_0x26c3('0x2c')]['count'](_0x16e680)[_0x26c3('0x26')](function(_0x2b4bdf){_0x27f556[_0x26c3('0x1e')]=_0x2b4bdf;if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x40')]){_0x50cd11[_0x26c3('0x41')]=[{'all':!![]}];}return db[_0x26c3('0x2c')][_0x26c3('0x42')](_0x50cd11);})[_0x26c3('0x26')](function(_0x1c0d6c){_0x27f556[_0x26c3('0x43')]=_0x1c0d6c;return _0x27f556;})[_0x26c3('0x26')](respondWithFilteredResult(_0x3dbda5,_0x50cd11))[_0x26c3('0x44')](handleError(_0x3dbda5,null));};exports['show']=function(_0x2f775b,_0x2ecb43){var _0xfb596a={'raw':!![],'where':{'id':_0x2f775b[_0x26c3('0x45')]['id']}},_0x46ebfb={};_0x46ebfb[_0x26c3('0x34')]=_['keys'](db[_0x26c3('0x2c')]['rawAttributes']);_0x46ebfb[_0x26c3('0x31')]=_['keys'](_0x2f775b[_0x26c3('0x31')]);_0x46ebfb[_0x26c3('0x33')]=_['intersection'](_0x46ebfb[_0x26c3('0x34')],_0x46ebfb[_0x26c3('0x31')]);_0xfb596a[_0x26c3('0x36')]=_[_0x26c3('0x46')](_0x46ebfb[_0x26c3('0x34')],qs['fields'](_0x2f775b[_0x26c3('0x31')]['fields']));_0xfb596a[_0x26c3('0x36')]=_0xfb596a['attributes']['length']?_0xfb596a[_0x26c3('0x36')]:_0x46ebfb[_0x26c3('0x34')];if(_0x2f775b[_0x26c3('0x31')]['includeAll']){_0xfb596a[_0x26c3('0x41')]=[{'all':!![]}];}_0xfb596a=_[_0x26c3('0x3d')]({},_0xfb596a,_0x2f775b[_0x26c3('0x3f')]);return db[_0x26c3('0x2c')][_0x26c3('0x47')](_0xfb596a)[_0x26c3('0x26')](handleEntityNotFound(_0x2ecb43,null))['then'](respondWithResult(_0x2ecb43,null))[_0x26c3('0x44')](handleError(_0x2ecb43,null));};exports[_0x26c3('0x48')]=function(_0x378982,_0x133cf7){return db['Cdr'][_0x26c3('0x48')](_0x378982[_0x26c3('0x49')],{})['then'](respondWithResult(_0x133cf7,0xc9))[_0x26c3('0x44')](handleError(_0x133cf7,null));};exports[_0x26c3('0x24')]=function(_0x522fe2,_0x4566ab){if(_0x522fe2['body']['id']){delete _0x522fe2[_0x26c3('0x49')]['id'];}return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x522fe2[_0x26c3('0x45')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x4566ab,null))[_0x26c3('0x26')](saveUpdates(_0x522fe2[_0x26c3('0x49')],null))['then'](respondWithResult(_0x4566ab,null))[_0x26c3('0x44')](handleError(_0x4566ab,null));};exports['destroy']=function(_0x4ada42,_0x3b3e31){return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x4ada42['params']['id']}})['then'](handleEntityNotFound(_0x3b3e31,null))[_0x26c3('0x26')](removeEntity(_0x3b3e31,null))[_0x26c3('0x44')](handleError(_0x3b3e31,null));};exports[_0x26c3('0x4a')]=function(_0x4d1ec7,_0x446453){return db[_0x26c3('0x2c')][_0x26c3('0x4a')]()['then'](respondWithResult(_0x446453,null))[_0x26c3('0x44')](handleError(_0x446453,null));}; \ No newline at end of file +var _0x5577=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','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/license/hardware','../../config/utils','../../config/environment'];(function(_0x34da09,_0x406d1d){var _0x87d9ac=function(_0x1a5f4f){while(--_0x1a5f4f){_0x34da09['push'](_0x34da09['shift']());}};_0x87d9ac(++_0x406d1d);}(_0x5577,0x1b4));var _0x7557=function(_0x2df285,_0x15d2fe){_0x2df285=_0x2df285-0x0;var _0x1c6eb6=_0x5577[_0x2df285];return _0x1c6eb6;};'use strict';var emlformat=require(_0x7557('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7557('0x1'));var jsonpatch=require(_0x7557('0x2'));var rp=require('request-promise');var moment=require(_0x7557('0x3'));var BPromise=require(_0x7557('0x4'));var Mustache=require(_0x7557('0x5'));var util=require(_0x7557('0x6'));var path=require(_0x7557('0x7'));var sox=require(_0x7557('0x8'));var csv=require('to-csv');var ejs=require(_0x7557('0x9'));var fs=require('fs');var fs_extra=require(_0x7557('0xa'));var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x10'));var querystring=require(_0x7557('0x11'));var Papa=require(_0x7557('0x12'));var Redis=require(_0x7557('0x13'));var authService=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var as=require(_0x7557('0x16'));var hardwareService=require(_0x7557('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x7557('0x18'));var config=require(_0x7557('0x19'));var licenseUtil=require(_0x7557('0x1a'));var db=require(_0x7557('0x1b'))['db'];function respondWithStatusCode(_0xb6ed30,_0x467ac5){_0x467ac5=_0x467ac5||0xcc;return function(_0x156ac1){if(_0x156ac1){return _0xb6ed30[_0x7557('0x1c')](_0x467ac5);}return _0xb6ed30[_0x7557('0x1d')](_0x467ac5)[_0x7557('0x1e')]();};}function respondWithResult(_0x5468df,_0x276031){_0x276031=_0x276031||0xc8;return function(_0x3fb7a6){if(_0x3fb7a6){return _0x5468df[_0x7557('0x1d')](_0x276031)['json'](_0x3fb7a6);}};}function respondWithFilteredResult(_0x3ad3a1,_0x3c3953){return function(_0x33098f){if(_0x33098f){var _0x325849=typeof _0x3c3953['offset']===_0x7557('0x1f')&&typeof _0x3c3953[_0x7557('0x20')]==='undefined';var _0x4a9cae=_0x33098f[_0x7557('0x21')];var _0x11f186=_0x325849?0x0:_0x3c3953[_0x7557('0x22')];var _0x40a81b=_0x325849?_0x33098f['count']:_0x3c3953[_0x7557('0x22')]+_0x3c3953['limit'];var _0x3e2972;if(_0x40a81b>=_0x4a9cae){_0x40a81b=_0x4a9cae;_0x3e2972=0xc8;}else{_0x3e2972=0xce;}_0x3ad3a1[_0x7557('0x1d')](_0x3e2972);return _0x3ad3a1[_0x7557('0x23')](_0x7557('0x24'),_0x11f186+'-'+_0x40a81b+'/'+_0x4a9cae)['json'](_0x33098f);}return null;};}function patchUpdates(_0x1b60a9){return function(_0x3180cd){try{jsonpatch[_0x7557('0x25')](_0x3180cd,_0x1b60a9,!![]);}catch(_0x34bed5){return BPromise[_0x7557('0x26')](_0x34bed5);}return _0x3180cd['save']();};}function saveUpdates(_0x502e49,_0x4eb212){return function(_0x211fbe){if(_0x211fbe){return _0x211fbe['update'](_0x502e49)[_0x7557('0x27')](function(_0x352b63){return _0x352b63;});}return null;};}function removeEntity(_0x1e97d3,_0x9bbcf6){return function(_0x1533b2){if(_0x1533b2){return _0x1533b2[_0x7557('0x28')]()[_0x7557('0x27')](function(){_0x1e97d3['status'](0xcc)[_0x7557('0x1e')]();});}};}function handleEntityNotFound(_0x5bc953,_0x3daeac){return function(_0x5b2c6a){if(!_0x5b2c6a){_0x5bc953[_0x7557('0x1c')](0x194);}return _0x5b2c6a;};}function handleError(_0x3aa642,_0x4758b9){_0x4758b9=_0x4758b9||0x1f4;return function(_0x42ae94){logger['error'](_0x42ae94[_0x7557('0x29')]);if(_0x42ae94['name']){delete _0x42ae94[_0x7557('0x2a')];}_0x3aa642[_0x7557('0x1d')](_0x4758b9)[_0x7557('0x2b')](_0x42ae94);};}exports['index']=function(_0x3b36eb,_0x2b4ca8){var _0x1c6df9={},_0x1c4649={},_0x19095d={'count':0x0,'rows':[]};var _0x414eec=_['map'](db[_0x7557('0x2c')][_0x7557('0x2d')],function(_0x9080c6){return{'name':_0x9080c6[_0x7557('0x2e')],'type':_0x9080c6['type'][_0x7557('0x2f')]};});_0x1c4649[_0x7557('0x30')]=_[_0x7557('0x31')](_0x414eec,_0x7557('0x2a'));_0x1c4649[_0x7557('0x32')]=_[_0x7557('0x33')](_0x3b36eb[_0x7557('0x32')]);_0x1c4649[_0x7557('0x34')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],_0x1c4649[_0x7557('0x32')]);_0x1c6df9[_0x7557('0x36')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],qs[_0x7557('0x37')](_0x3b36eb[_0x7557('0x32')][_0x7557('0x37')]));_0x1c6df9[_0x7557('0x36')]=_0x1c6df9[_0x7557('0x36')][_0x7557('0x38')]?_0x1c6df9[_0x7557('0x36')]:_0x1c4649[_0x7557('0x30')];if(!_0x3b36eb['query'][_0x7557('0x39')]('nolimit')){_0x1c6df9['limit']=qs[_0x7557('0x20')](_0x3b36eb['query'][_0x7557('0x20')]);_0x1c6df9['offset']=qs['offset'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x22')]);}_0x1c6df9[_0x7557('0x3a')]=qs['sort'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x3b')]);_0x1c6df9[_0x7557('0x3c')]=qs[_0x7557('0x34')](_[_0x7557('0x3d')](_0x3b36eb[_0x7557('0x32')],_0x1c4649[_0x7557('0x34')]),_0x414eec);if(_0x3b36eb[_0x7557('0x32')]['filter']){_0x1c6df9['where']=_['merge'](_0x1c6df9['where'],{'$or':_['map'](_0x414eec,function(_0x4f3c68){if(_0x4f3c68[_0x7557('0x3e')]!==_0x7557('0x3f')){var _0x3a7c60={};_0x3a7c60[_0x4f3c68[_0x7557('0x2a')]]={'$like':'%'+_0x3b36eb['query']['filter']+'%'};return _0x3a7c60;}})});}_0x1c6df9=_[_0x7557('0x40')]({},_0x1c6df9,_0x3b36eb[_0x7557('0x41')]);var _0x962488={'where':_0x1c6df9[_0x7557('0x3c')]};return db[_0x7557('0x2c')]['count'](_0x962488)[_0x7557('0x27')](function(_0x5149c9){_0x19095d[_0x7557('0x21')]=_0x5149c9;if(_0x3b36eb[_0x7557('0x32')][_0x7557('0x42')]){_0x1c6df9[_0x7557('0x43')]=[{'all':!![]}];}return db[_0x7557('0x2c')]['findAll'](_0x1c6df9);})[_0x7557('0x27')](function(_0x3023e5){_0x19095d[_0x7557('0x44')]=_0x3023e5;return _0x19095d;})[_0x7557('0x27')](respondWithFilteredResult(_0x2b4ca8,_0x1c6df9))['catch'](handleError(_0x2b4ca8,null));};exports[_0x7557('0x45')]=function(_0x59a75a,_0x156f3b){var _0x576461={'raw':!![],'where':{'id':_0x59a75a['params']['id']}},_0x16e40f={};_0x16e40f[_0x7557('0x30')]=_['keys'](db[_0x7557('0x2c')]['rawAttributes']);_0x16e40f[_0x7557('0x32')]=_[_0x7557('0x33')](_0x59a75a[_0x7557('0x32')]);_0x16e40f[_0x7557('0x34')]=_[_0x7557('0x35')](_0x16e40f[_0x7557('0x30')],_0x16e40f['query']);_0x576461['attributes']=_['intersection'](_0x16e40f[_0x7557('0x30')],qs[_0x7557('0x37')](_0x59a75a[_0x7557('0x32')][_0x7557('0x37')]));_0x576461[_0x7557('0x36')]=_0x576461['attributes'][_0x7557('0x38')]?_0x576461['attributes']:_0x16e40f[_0x7557('0x30')];if(_0x59a75a[_0x7557('0x32')][_0x7557('0x42')]){_0x576461[_0x7557('0x43')]=[{'all':!![]}];}_0x576461=_[_0x7557('0x40')]({},_0x576461,_0x59a75a[_0x7557('0x41')]);return db[_0x7557('0x2c')][_0x7557('0x46')](_0x576461)['then'](handleEntityNotFound(_0x156f3b,null))[_0x7557('0x27')](respondWithResult(_0x156f3b,null))[_0x7557('0x47')](handleError(_0x156f3b,null));};exports[_0x7557('0x48')]=function(_0x59904c,_0xb25031){return db['Cdr']['create'](_0x59904c[_0x7557('0x49')],{})[_0x7557('0x27')](respondWithResult(_0xb25031,0xc9))[_0x7557('0x47')](handleError(_0xb25031,null));};exports[_0x7557('0x4a')]=function(_0x3683c9,_0x4d9b43){if(_0x3683c9[_0x7557('0x49')]['id']){delete _0x3683c9[_0x7557('0x49')]['id'];}return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x3683c9[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x4d9b43,null))[_0x7557('0x27')](saveUpdates(_0x3683c9['body'],null))['then'](respondWithResult(_0x4d9b43,null))['catch'](handleError(_0x4d9b43,null));};exports['destroy']=function(_0x2b85c5,_0x36a2a1){return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x2b85c5[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x36a2a1,null))[_0x7557('0x27')](removeEntity(_0x36a2a1,null))[_0x7557('0x47')](handleError(_0x36a2a1,null));};exports['describe']=function(_0x46b871,_0x445e17){return db['Cdr'][_0x7557('0x4c')]()['then'](respondWithResult(_0x445e17,null))[_0x7557('0x47')](handleError(_0x445e17,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7931af8..dc0d194 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(_0x4bb4a3,_0xb74f9f){var _0x1e39a3=function(_0x5e75cd){while(--_0x5e75cd){_0x4bb4a3['push'](_0x4bb4a3['shift']());}};_0x1e39a3(++_0xb74f9f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2ec8ce,_0xbbe7b8){var _0x533e6f=function(_0x4a9aa2){while(--_0x4a9aa2){_0x2ec8ce['push'](_0x2ec8ce['shift']());}};_0x533e6f(++_0xbbe7b8);}(_0x7a54,0x106));var _0x47a5=function(_0xa4989b,_0x1eea59){_0xa4989b=_0xa4989b-0x0;var _0x4b262d=_0x7a54[_0xa4989b];return _0x4b262d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a859832..231e256 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 _0x00c9=['rpc','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0x00c9,0x19d));var _0x900c=function(_0x39f7e2,_0x210ee2){_0x39f7e2=_0x39f7e2-0x0;var _0x4b5d6d=_0x00c9[_0x39f7e2];return _0x4b5d6d;};'use strict';var _=require(_0x900c('0x0'));var util=require(_0x900c('0x1'));var moment=require(_0x900c('0x2'));var BPromise=require('bluebird');var rs=require(_0x900c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x900c('0x4'))['db'];var utils=require(_0x900c('0x5'));var logger=require(_0x900c('0x6'))(_0x900c('0x7'));var config=require('../../config/environment');var jayson=require(_0x900c('0x8'));var client=jayson[_0x900c('0x9')][_0x900c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35c124,_0x201a55,_0x1f06c3){return new BPromise(function(_0x560561,_0x10fe05){return client[_0x900c('0xb')](_0x35c124,_0x1f06c3)['then'](function(_0x5282f9){logger['info'](_0x900c('0xc'),_0x201a55,'request\x20sent');logger[_0x900c('0xd')](_0x900c('0xe'),_0x201a55,_0x900c('0xf'),JSON[_0x900c('0x10')](_0x5282f9));if(_0x5282f9[_0x900c('0x11')]){if(_0x5282f9[_0x900c('0x11')]['code']===0x1f4){logger[_0x900c('0x11')](_0x900c('0xc'),_0x201a55,_0x5282f9[_0x900c('0x11')]['message']);return _0x10fe05(_0x5282f9[_0x900c('0x11')][_0x900c('0x12')]);}logger[_0x900c('0x11')]('Cdr,\x20%s,\x20%s',_0x201a55,_0x5282f9[_0x900c('0x11')][_0x900c('0x12')]);return _0x560561(_0x5282f9[_0x900c('0x11')][_0x900c('0x12')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x201a55,_0x900c('0xf'));_0x560561(_0x5282f9[_0x900c('0x13')][_0x900c('0x12')]);}})[_0x900c('0x14')](function(_0xdc7fe0){logger[_0x900c('0x11')]('Cdr,\x20%s,\x20%s',_0x201a55,_0xdc7fe0);_0x10fe05(_0xdc7fe0);});});} \ No newline at end of file +var _0xa5ac=['lodash','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x82a1a8,_0x5cf751){var _0x5502e4=function(_0x4bdfe4){while(--_0x4bdfe4){_0x82a1a8['push'](_0x82a1a8['shift']());}};_0x5502e4(++_0x5cf751);}(_0xa5ac,0x130));var _0xca5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xca5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xca5a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xca5a('0x2'));var logger=require(_0xca5a('0x3'))('rpc');var config=require(_0xca5a('0x4'));var jayson=require(_0xca5a('0x5'));var client=jayson[_0xca5a('0x6')][_0xca5a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x437df3,_0x25014a,_0x47d17d){return new BPromise(function(_0x49de12,_0x3ec891){return client[_0xca5a('0x8')](_0x437df3,_0x47d17d)[_0xca5a('0x9')](function(_0xb4512a){logger[_0xca5a('0xa')](_0xca5a('0xb'),_0x25014a,_0xca5a('0xc'));logger['debug'](_0xca5a('0xd'),_0x25014a,_0xca5a('0xc'),JSON[_0xca5a('0xe')](_0xb4512a));if(_0xb4512a[_0xca5a('0xf')]){if(_0xb4512a[_0xca5a('0xf')][_0xca5a('0x10')]===0x1f4){logger[_0xca5a('0xf')](_0xca5a('0xb'),_0x25014a,_0xb4512a[_0xca5a('0xf')][_0xca5a('0x11')]);return _0x3ec891(_0xb4512a[_0xca5a('0xf')][_0xca5a('0x11')]);}logger[_0xca5a('0xf')](_0xca5a('0xb'),_0x25014a,_0xb4512a['error']['message']);return _0x49de12(_0xb4512a[_0xca5a('0xf')]['message']);}else{logger[_0xca5a('0xa')](_0xca5a('0xb'),_0x25014a,_0xca5a('0xc'));_0x49de12(_0xb4512a[_0xca5a('0x12')]['message']);}})['catch'](function(_0x359d23){logger[_0xca5a('0xf')]('Cdr,\x20%s,\x20%s',_0x25014a,_0x359d23);_0x3ec891(_0x359d23);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e6a3c01..0cf5b97 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(_0x535bcd,_0x1575af){var _0x42f269=function(_0x1463da){while(--_0x1463da){_0x535bcd['push'](_0x535bcd['shift']());}};_0x42f269(++_0x1575af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4f0fdd,_0xff3e68){var _0x2cdd84=function(_0x1507d2){while(--_0x1507d2){_0x4f0fdd['push'](_0x4f0fdd['shift']());}};_0x2cdd84(++_0xff3e68);}(_0xb10b,0x12a));var _0xbb10=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xb10b[_0x1064bc];return _0x5edc45;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ad360e8..2ddfd36 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 _0x7b3b=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x7b3b,0x112));var _0xb7b3=function(_0x578568,_0x1a70d1){_0x578568=_0x578568-0x0;var _0x4b3851=_0x7b3b[_0x578568];return _0x4b3851;};'use strict';var Sequelize=require(_0xb7b3('0x0'));module[_0xb7b3('0x1')]={'priority':{'type':Sequelize[_0xb7b3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb7b3('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb7b3('0x4')]()},'description':{'type':Sequelize[_0xb7b3('0x3')]},'interval':{'type':Sequelize[_0xb7b3('0x3')],'defaultValue':_0xb7b3('0x5')}}; \ No newline at end of file +var _0xcc7b=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0xcc7b,0xbd));var _0xbcc7=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcc7b[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xbcc7('0x0'));module[_0xbcc7('0x1')]={'priority':{'type':Sequelize[_0xbcc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbcc7('0x3')],'allowNull':![],'defaultValue':_0xbcc7('0x4')},'appdata':{'type':Sequelize[_0xbcc7('0x5')]()},'description':{'type':Sequelize[_0xbcc7('0x3')]},'interval':{'type':Sequelize[_0xbcc7('0x3')],'defaultValue':_0xbcc7('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 03df527..d67a10e 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 _0x2697=['fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','rawAttributes','query','intersection','fields','attributes','includeAll','merge','options','ChatApplication','find','catch','body','rimraf','zip-dir'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2697,0x120));var _0x7269=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0x2697[_0x460fd7];return _0x44d1c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7269('0x0'));var zipdir=require(_0x7269('0x1'));var jsonpatch=require(_0x7269('0x2'));var rp=require(_0x7269('0x3'));var moment=require(_0x7269('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7269('0x5'));var util=require('util');var path=require(_0x7269('0x6'));var sox=require(_0x7269('0x7'));var csv=require(_0x7269('0x8'));var ejs=require(_0x7269('0x9'));var fs=require('fs');var fs_extra=require(_0x7269('0xa'));var _=require(_0x7269('0xb'));var squel=require(_0x7269('0xc'));var crypto=require(_0x7269('0xd'));var jsforce=require(_0x7269('0xe'));var deskjs=require(_0x7269('0xf'));var toCsv=require(_0x7269('0x8'));var querystring=require('querystring');var Papa=require(_0x7269('0x10'));var Redis=require(_0x7269('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7269('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7269('0x13'));var logger=require('../../config/logger')(_0x7269('0x14'));var utils=require('../../config/utils');var config=require(_0x7269('0x15'));var licenseUtil=require(_0x7269('0x16'));var db=require(_0x7269('0x17'))['db'];function respondWithStatusCode(_0x4c115b,_0x29a0ca){_0x29a0ca=_0x29a0ca||0xcc;return function(_0x2c5957){if(_0x2c5957){return _0x4c115b['sendStatus'](_0x29a0ca);}return _0x4c115b[_0x7269('0x18')](_0x29a0ca)[_0x7269('0x19')]();};}function respondWithResult(_0x43c239,_0x4a0355){_0x4a0355=_0x4a0355||0xc8;return function(_0x2ba8ec){if(_0x2ba8ec){return _0x43c239[_0x7269('0x18')](_0x4a0355)[_0x7269('0x1a')](_0x2ba8ec);}};}function respondWithFilteredResult(_0x2c28f8,_0x26547f){return function(_0x44e266){if(_0x44e266){var _0x880b51=typeof _0x26547f[_0x7269('0x1b')]==='undefined'&&typeof _0x26547f[_0x7269('0x1c')]===_0x7269('0x1d');var _0x188eae=_0x44e266[_0x7269('0x1e')];var _0x5812c4=_0x880b51?0x0:_0x26547f['offset'];var _0x4db022=_0x880b51?_0x44e266[_0x7269('0x1e')]:_0x26547f[_0x7269('0x1b')]+_0x26547f[_0x7269('0x1c')];var _0x466750;if(_0x4db022>=_0x188eae){_0x4db022=_0x188eae;_0x466750=0xc8;}else{_0x466750=0xce;}_0x2c28f8[_0x7269('0x18')](_0x466750);return _0x2c28f8[_0x7269('0x1f')](_0x7269('0x20'),_0x5812c4+'-'+_0x4db022+'/'+_0x188eae)['json'](_0x44e266);}return null;};}function patchUpdates(_0x4f0d05){return function(_0x534f81){try{jsonpatch[_0x7269('0x21')](_0x534f81,_0x4f0d05,!![]);}catch(_0x5cca84){return BPromise[_0x7269('0x22')](_0x5cca84);}return _0x534f81['save']();};}function saveUpdates(_0x2a5a5c,_0x8ce025){return function(_0x55e40d){if(_0x55e40d){return _0x55e40d[_0x7269('0x23')](_0x2a5a5c)[_0x7269('0x24')](function(_0x51dbd1){return _0x51dbd1;});}return null;};}function removeEntity(_0x509e9,_0x293af6){return function(_0xbb82d0){if(_0xbb82d0){return _0xbb82d0[_0x7269('0x25')]()['then'](function(){_0x509e9[_0x7269('0x18')](0xcc)[_0x7269('0x19')]();});}};}function handleEntityNotFound(_0x3e0221,_0x2e6c02){return function(_0x3392ec){if(!_0x3392ec){_0x3e0221[_0x7269('0x26')](0x194);}return _0x3392ec;};}function handleError(_0x4c6810,_0x198b59){_0x198b59=_0x198b59||0x1f4;return function(_0x3afb72){logger[_0x7269('0x27')](_0x3afb72[_0x7269('0x28')]);if(_0x3afb72[_0x7269('0x29')]){delete _0x3afb72['name'];}_0x4c6810[_0x7269('0x18')](_0x198b59)[_0x7269('0x2a')](_0x3afb72);};}exports['show']=function(_0x1ad87c,_0x492e73){var _0x124c07={'raw':!![],'where':{'id':_0x1ad87c[_0x7269('0x2b')]['id']}},_0x3988c8={};_0x3988c8[_0x7269('0x2c')]=_[_0x7269('0x2d')](db['ChatApplication'][_0x7269('0x2e')]);_0x3988c8[_0x7269('0x2f')]=_[_0x7269('0x2d')](_0x1ad87c[_0x7269('0x2f')]);_0x3988c8['filters']=_[_0x7269('0x30')](_0x3988c8[_0x7269('0x2c')],_0x3988c8['query']);_0x124c07['attributes']=_[_0x7269('0x30')](_0x3988c8[_0x7269('0x2c')],qs[_0x7269('0x31')](_0x1ad87c[_0x7269('0x2f')][_0x7269('0x31')]));_0x124c07[_0x7269('0x32')]=_0x124c07['attributes']['length']?_0x124c07[_0x7269('0x32')]:_0x3988c8[_0x7269('0x2c')];if(_0x1ad87c['query'][_0x7269('0x33')]){_0x124c07['include']=[{'all':!![]}];}_0x124c07=_[_0x7269('0x34')]({},_0x124c07,_0x1ad87c[_0x7269('0x35')]);return db[_0x7269('0x36')][_0x7269('0x37')](_0x124c07)[_0x7269('0x24')](handleEntityNotFound(_0x492e73,null))[_0x7269('0x24')](respondWithResult(_0x492e73,null))[_0x7269('0x38')](handleError(_0x492e73,null));};exports['update']=function(_0x1eef52,_0xb433a0){if(_0x1eef52['body']['id']){delete _0x1eef52[_0x7269('0x39')]['id'];}return db[_0x7269('0x36')][_0x7269('0x37')]({'where':{'id':_0x1eef52['params']['id']}})[_0x7269('0x24')](handleEntityNotFound(_0xb433a0,null))[_0x7269('0x24')](saveUpdates(_0x1eef52[_0x7269('0x39')],null))[_0x7269('0x24')](respondWithResult(_0xb433a0,null))['catch'](handleError(_0xb433a0,null));};exports[_0x7269('0x25')]=function(_0xe5d1b9,_0x757c1c){return db[_0x7269('0x36')][_0x7269('0x37')]({'where':{'id':_0xe5d1b9['params']['id']}})[_0x7269('0x24')](handleEntityNotFound(_0x757c1c,null))[_0x7269('0x24')](removeEntity(_0x757c1c,null))[_0x7269('0x38')](handleError(_0x757c1c,null));}; \ No newline at end of file +var _0x5fc7=['offset','undefined','count','limit','set','apply','reject','save','then','destroy','end','sendStatus','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x4de934,_0x460088){var _0x28110b=function(_0x5a6b81){while(--_0x5a6b81){_0x4de934['push'](_0x4de934['shift']());}};_0x28110b(++_0x460088);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x5fc7[_0x3de7e0];return _0x11d0b3;};'use strict';var emlformat=require(_0x75fc('0x0'));var rimraf=require(_0x75fc('0x1'));var zipdir=require(_0x75fc('0x2'));var jsonpatch=require(_0x75fc('0x3'));var rp=require(_0x75fc('0x4'));var moment=require(_0x75fc('0x5'));var BPromise=require(_0x75fc('0x6'));var Mustache=require(_0x75fc('0x7'));var util=require(_0x75fc('0x8'));var path=require(_0x75fc('0x9'));var sox=require(_0x75fc('0xa'));var csv=require(_0x75fc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75fc('0xc'));var _=require(_0x75fc('0xd'));var squel=require(_0x75fc('0xe'));var crypto=require(_0x75fc('0xf'));var jsforce=require(_0x75fc('0x10'));var deskjs=require(_0x75fc('0x11'));var toCsv=require(_0x75fc('0xb'));var querystring=require(_0x75fc('0x12'));var Papa=require(_0x75fc('0x13'));var Redis=require(_0x75fc('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x75fc('0x15'));var as=require(_0x75fc('0x16'));var hardwareService=require(_0x75fc('0x17'));var logger=require(_0x75fc('0x18'))('api');var utils=require(_0x75fc('0x19'));var config=require(_0x75fc('0x1a'));var licenseUtil=require(_0x75fc('0x1b'));var db=require(_0x75fc('0x1c'))['db'];function respondWithStatusCode(_0xf703a7,_0x22bdb0){_0x22bdb0=_0x22bdb0||0xcc;return function(_0x22b73d){if(_0x22b73d){return _0xf703a7['sendStatus'](_0x22bdb0);}return _0xf703a7['status'](_0x22bdb0)['end']();};}function respondWithResult(_0x195606,_0x2e0e83){_0x2e0e83=_0x2e0e83||0xc8;return function(_0x2e073b){if(_0x2e073b){return _0x195606[_0x75fc('0x1d')](_0x2e0e83)[_0x75fc('0x1e')](_0x2e073b);}};}function respondWithFilteredResult(_0x2cd131,_0x3b64b2){return function(_0x3053b6){if(_0x3053b6){var _0x53f23d=typeof _0x3b64b2[_0x75fc('0x1f')]===_0x75fc('0x20')&&typeof _0x3b64b2['limit']===_0x75fc('0x20');var _0x9a1359=_0x3053b6['count'];var _0x5cdf1e=_0x53f23d?0x0:_0x3b64b2[_0x75fc('0x1f')];var _0x2608bf=_0x53f23d?_0x3053b6[_0x75fc('0x21')]:_0x3b64b2[_0x75fc('0x1f')]+_0x3b64b2[_0x75fc('0x22')];var _0x47123f;if(_0x2608bf>=_0x9a1359){_0x2608bf=_0x9a1359;_0x47123f=0xc8;}else{_0x47123f=0xce;}_0x2cd131['status'](_0x47123f);return _0x2cd131[_0x75fc('0x23')]('Content-Range',_0x5cdf1e+'-'+_0x2608bf+'/'+_0x9a1359)[_0x75fc('0x1e')](_0x3053b6);}return null;};}function patchUpdates(_0x2373b0){return function(_0x2780e3){try{jsonpatch[_0x75fc('0x24')](_0x2780e3,_0x2373b0,!![]);}catch(_0x518945){return BPromise[_0x75fc('0x25')](_0x518945);}return _0x2780e3[_0x75fc('0x26')]();};}function saveUpdates(_0x48f586,_0x458cc4){return function(_0x3ed9d5){if(_0x3ed9d5){return _0x3ed9d5['update'](_0x48f586)[_0x75fc('0x27')](function(_0x5a79e0){return _0x5a79e0;});}return null;};}function removeEntity(_0x14745f,_0x924c53){return function(_0x54b684){if(_0x54b684){return _0x54b684[_0x75fc('0x28')]()[_0x75fc('0x27')](function(){_0x14745f['status'](0xcc)[_0x75fc('0x29')]();});}};}function handleEntityNotFound(_0x2418be,_0x53fcd2){return function(_0x5774bb){if(!_0x5774bb){_0x2418be[_0x75fc('0x2a')](0x194);}return _0x5774bb;};}function handleError(_0x5a75b2,_0x19a59e){_0x19a59e=_0x19a59e||0x1f4;return function(_0x4268ed){logger['error'](_0x4268ed['stack']);if(_0x4268ed['name']){delete _0x4268ed[_0x75fc('0x2b')];}_0x5a75b2[_0x75fc('0x1d')](_0x19a59e)[_0x75fc('0x2c')](_0x4268ed);};}exports[_0x75fc('0x2d')]=function(_0xe13951,_0xc7025){var _0x337058={'raw':!![],'where':{'id':_0xe13951[_0x75fc('0x2e')]['id']}},_0x54bcd5={};_0x54bcd5[_0x75fc('0x2f')]=_[_0x75fc('0x30')](db[_0x75fc('0x31')]['rawAttributes']);_0x54bcd5[_0x75fc('0x32')]=_['keys'](_0xe13951[_0x75fc('0x32')]);_0x54bcd5[_0x75fc('0x33')]=_[_0x75fc('0x34')](_0x54bcd5[_0x75fc('0x2f')],_0x54bcd5['query']);_0x337058[_0x75fc('0x35')]=_['intersection'](_0x54bcd5[_0x75fc('0x2f')],qs[_0x75fc('0x36')](_0xe13951['query'][_0x75fc('0x36')]));_0x337058[_0x75fc('0x35')]=_0x337058['attributes'][_0x75fc('0x37')]?_0x337058[_0x75fc('0x35')]:_0x54bcd5[_0x75fc('0x2f')];if(_0xe13951[_0x75fc('0x32')][_0x75fc('0x38')]){_0x337058[_0x75fc('0x39')]=[{'all':!![]}];}_0x337058=_[_0x75fc('0x3a')]({},_0x337058,_0xe13951[_0x75fc('0x3b')]);return db['ChatApplication'][_0x75fc('0x3c')](_0x337058)[_0x75fc('0x27')](handleEntityNotFound(_0xc7025,null))[_0x75fc('0x27')](respondWithResult(_0xc7025,null))[_0x75fc('0x3d')](handleError(_0xc7025,null));};exports[_0x75fc('0x3e')]=function(_0x3a629c,_0x998936){if(_0x3a629c[_0x75fc('0x3f')]['id']){delete _0x3a629c[_0x75fc('0x3f')]['id'];}return db[_0x75fc('0x31')][_0x75fc('0x3c')]({'where':{'id':_0x3a629c[_0x75fc('0x2e')]['id']}})[_0x75fc('0x27')](handleEntityNotFound(_0x998936,null))['then'](saveUpdates(_0x3a629c[_0x75fc('0x3f')],null))[_0x75fc('0x27')](respondWithResult(_0x998936,null))[_0x75fc('0x3d')](handleError(_0x998936,null));};exports[_0x75fc('0x28')]=function(_0x51b9fa,_0x458bdf){return db[_0x75fc('0x31')][_0x75fc('0x3c')]({'where':{'id':_0x51b9fa[_0x75fc('0x2e')]['id']}})[_0x75fc('0x27')](handleEntityNotFound(_0x458bdf,null))[_0x75fc('0x27')](removeEntity(_0x458bdf,null))[_0x75fc('0x3d')](handleError(_0x458bdf,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e5b9bc4..519bc3a 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 _0x17aa=['api','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x1c5b29,_0x34023f){var _0x236647=function(_0xf5201e){while(--_0xf5201e){_0x1c5b29['push'](_0x1c5b29['shift']());}};_0x236647(++_0x34023f);}(_0x17aa,0x1b9));var _0xa17a=function(_0x2d3cd7,_0x4558d7){_0x2d3cd7=_0x2d3cd7-0x0;var _0x15029a=_0x17aa[_0x2d3cd7];return _0x15029a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa17a('0x0'))(_0xa17a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa17a('0x2'));var fs=require('fs');var path=require(_0xa17a('0x3'));var rimraf=require(_0xa17a('0x4'));var config=require(_0xa17a('0x5'));var attributes=require(_0xa17a('0x6'));module[_0xa17a('0x7')]=function(_0x56d1a7,_0x118006){return _0x56d1a7[_0xa17a('0x8')](_0xa17a('0x9'),attributes,{'tableName':_0xa17a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa17a('0xb'),'collate':_0xa17a('0xc')});}; \ No newline at end of file +var _0xd887=['request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x3f1e22,_0xdc68a0){var _0x216fb9=function(_0x17d339){while(--_0x17d339){_0x3f1e22['push'](_0x3f1e22['shift']());}};_0x216fb9(++_0xdc68a0);}(_0xd887,0x141));var _0x7d88=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xd887[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0x7d88('0x0'));var util=require(_0x7d88('0x1'));var logger=require('../../config/logger')(_0x7d88('0x2'));var moment=require(_0x7d88('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d88('0x5'));var config=require(_0x7d88('0x6'));var attributes=require(_0x7d88('0x7'));module[_0x7d88('0x8')]=function(_0x5a0706,_0x2f64e2){return _0x5a0706[_0x7d88('0x9')](_0x7d88('0xa'),attributes,{'tableName':_0x7d88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d88('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index eb11f3c..911b0c9 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 _0xbb69=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbb69,0x1bb));var _0x9bb6=function(_0x1e06a4,_0x3eeaee){_0x1e06a4=_0x1e06a4-0x0;var _0x4bc488=_0xbb69[_0x1e06a4];return _0x4bc488;};'use strict';var _=require(_0x9bb6('0x0'));var util=require(_0x9bb6('0x1'));var moment=require(_0x9bb6('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bb6('0x3'));var fs=require('fs');var Redis=require(_0x9bb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bb6('0x5'));var logger=require(_0x9bb6('0x6'))('rpc');var config=require(_0x9bb6('0x7'));var jayson=require(_0x9bb6('0x8'));var client=jayson['client'][_0x9bb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c470,_0x5ac6dd,_0x7da5f){return new BPromise(function(_0x37a2dd,_0x149c1d){return client[_0x9bb6('0xa')](_0x30c470,_0x7da5f)['then'](function(_0x353bb1){logger['info'](_0x9bb6('0xb'),_0x5ac6dd,'request\x20sent');logger['debug'](_0x9bb6('0xc'),_0x5ac6dd,_0x9bb6('0xd'),JSON['stringify'](_0x353bb1));if(_0x353bb1[_0x9bb6('0xe')]){if(_0x353bb1[_0x9bb6('0xe')][_0x9bb6('0xf')]===0x1f4){logger[_0x9bb6('0xe')](_0x9bb6('0xb'),_0x5ac6dd,_0x353bb1[_0x9bb6('0xe')][_0x9bb6('0x10')]);return _0x149c1d(_0x353bb1[_0x9bb6('0xe')]['message']);}logger[_0x9bb6('0xe')](_0x9bb6('0xb'),_0x5ac6dd,_0x353bb1['error'][_0x9bb6('0x10')]);return _0x37a2dd(_0x353bb1[_0x9bb6('0xe')][_0x9bb6('0x10')]);}else{logger[_0x9bb6('0x11')](_0x9bb6('0xb'),_0x5ac6dd,_0x9bb6('0xd'));_0x37a2dd(_0x353bb1[_0x9bb6('0x12')][_0x9bb6('0x10')]);}})[_0x9bb6('0x13')](function(_0x152401){logger[_0x9bb6('0xe')](_0x9bb6('0xb'),_0x5ac6dd,_0x152401);_0x149c1d(_0x152401);});});} \ No newline at end of file +var _0x4d14=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4d14,0xbe));var _0x44d1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4d14[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x44d1('0x0'));var util=require(_0x44d1('0x1'));var moment=require(_0x44d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x44d1('0x3'));var fs=require('fs');var Redis=require(_0x44d1('0x4'));var db=require(_0x44d1('0x5'))['db'];var utils=require(_0x44d1('0x6'));var logger=require(_0x44d1('0x7'))(_0x44d1('0x8'));var config=require('../../config/environment');var jayson=require(_0x44d1('0x9'));var client=jayson[_0x44d1('0xa')][_0x44d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1970db,_0x21a183,_0x47f7f8){return new BPromise(function(_0xd0e579,_0x268084){return client[_0x44d1('0xc')](_0x1970db,_0x47f7f8)[_0x44d1('0xd')](function(_0x37940e){logger[_0x44d1('0xe')](_0x44d1('0xf'),_0x21a183,_0x44d1('0x10'));logger[_0x44d1('0x11')](_0x44d1('0x12'),_0x21a183,_0x44d1('0x10'),JSON[_0x44d1('0x13')](_0x37940e));if(_0x37940e['error']){if(_0x37940e[_0x44d1('0x14')]['code']===0x1f4){logger[_0x44d1('0x14')](_0x44d1('0xf'),_0x21a183,_0x37940e[_0x44d1('0x14')][_0x44d1('0x15')]);return _0x268084(_0x37940e[_0x44d1('0x14')][_0x44d1('0x15')]);}logger['error'](_0x44d1('0xf'),_0x21a183,_0x37940e[_0x44d1('0x14')][_0x44d1('0x15')]);return _0xd0e579(_0x37940e['error'][_0x44d1('0x15')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x21a183,'request\x20sent');_0xd0e579(_0x37940e[_0x44d1('0x16')][_0x44d1('0x15')]);}})[_0x44d1('0x17')](function(_0x56d098){logger['error'](_0x44d1('0xf'),_0x21a183,_0x56d098);_0x268084(_0x56d098);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c594a05..82852d8 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 _0xcd85=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x9ca1f,_0xdd994){var _0x15c2ea=function(_0xd540c9){while(--_0xd540c9){_0x9ca1f['push'](_0x9ca1f['shift']());}};_0x15c2ea(++_0xdd994);}(_0xcd85,0xda));var _0x5cd8=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0xcd85[_0x35c97a];return _0x388917;};'use strict';var multer=require(_0x5cd8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5cd8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5cd8('0x2'));var interaction=require(_0x5cd8('0x3'));var config=require('../../config/environment');var controller=require(_0x5cd8('0x4'));router[_0x5cd8('0x5')](_0x5cd8('0x6'),auth[_0x5cd8('0x7')](),controller[_0x5cd8('0x8')]);router[_0x5cd8('0x9')](_0x5cd8('0x6'),auth[_0x5cd8('0x7')](),controller[_0x5cd8('0xa')]);router[_0x5cd8('0xb')](_0x5cd8('0x6'),auth['isAuthenticated'](),controller[_0x5cd8('0xc')]);module[_0x5cd8('0xd')]=router; \ No newline at end of file +var _0x5c75=['exports','multer','util','path','express','fs-extra','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0x1cab83,_0x1e2b80){var _0x1a52fe=function(_0x23cf1d){while(--_0x23cf1d){_0x1cab83['push'](_0x1cab83['shift']());}};_0x1a52fe(++_0x1e2b80);}(_0x5c75,0x151));var _0x55c7=function(_0x537281,_0x3e2849){_0x537281=_0x537281-0x0;var _0x58a6b3=_0x5c75[_0x537281];return _0x58a6b3;};'use strict';var multer=require(_0x55c7('0x0'));var util=require(_0x55c7('0x1'));var path=require(_0x55c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x55c7('0x3'));var router=express['Router']();var fs_extra=require(_0x55c7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x55c7('0x5'));var controller=require(_0x55c7('0x6'));router[_0x55c7('0x7')](_0x55c7('0x8'),auth[_0x55c7('0x9')](),controller['show']);router[_0x55c7('0xa')](_0x55c7('0x8'),auth[_0x55c7('0x9')](),controller[_0x55c7('0xb')]);router[_0x55c7('0xc')](_0x55c7('0x8'),auth[_0x55c7('0x9')](),controller['destroy']);module[_0x55c7('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 8df97e3..da29fa7 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 _0x0295=['sequelize','STRING'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x0295,0x1f0));var _0x5029=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x0295[_0x45862f];return _0x35b20b;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5029('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6636=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6636,0x119));var _0x6663=function(_0x3b712e,_0x22015e){_0x3b712e=_0x3b712e-0x0;var _0xf52120=_0x6636[_0x3b712e];return _0xf52120;};'use strict';var Sequelize=require(_0x6663('0x0'));module[_0x6663('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6663('0x2')]},'write':{'type':Sequelize[_0x6663('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 530f83a..6ffab76 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 _0x5303=['addMessage','ChatGroupId','$gte','split','format','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','body','find','describe','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','pick','getMembers','removeMembers'];(function(_0x1707ff,_0x3ab455){var _0x5a68fc=function(_0x253977){while(--_0x253977){_0x1707ff['push'](_0x1707ff['shift']());}};_0x5a68fc(++_0x3ab455);}(_0x5303,0xc0));var _0x3530=function(_0x18458a,_0x3a07ea){_0x18458a=_0x18458a-0x0;var _0x553229=_0x5303[_0x18458a];return _0x553229;};'use strict';var emlformat=require(_0x3530('0x0'));var rimraf=require(_0x3530('0x1'));var zipdir=require(_0x3530('0x2'));var jsonpatch=require(_0x3530('0x3'));var rp=require('request-promise');var moment=require(_0x3530('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3530('0x5'));var util=require(_0x3530('0x6'));var path=require(_0x3530('0x7'));var sox=require('sox');var csv=require(_0x3530('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3530('0x9'));var squel=require(_0x3530('0xa'));var crypto=require(_0x3530('0xb'));var jsforce=require(_0x3530('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3530('0x8'));var querystring=require(_0x3530('0xd'));var Papa=require(_0x3530('0xe'));var Redis=require('ioredis');var authService=require(_0x3530('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3530('0x10'));var hardwareService=require(_0x3530('0x11'));var logger=require(_0x3530('0x12'))(_0x3530('0x13'));var utils=require(_0x3530('0x14'));var config=require(_0x3530('0x15'));var licenseUtil=require(_0x3530('0x16'));var db=require('../../mysqldb')['db'];config[_0x3530('0x17')]=_[_0x3530('0x18')](config[_0x3530('0x17')],{'host':_0x3530('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3530('0x17')]));require('./chatGroup.socket')[_0x3530('0x1a')](socket);function respondWithStatusCode(_0xd29e3d,_0x50ef58){_0x50ef58=_0x50ef58||0xcc;return function(_0x18245e){if(_0x18245e){return _0xd29e3d[_0x3530('0x1b')](_0x50ef58);}return _0xd29e3d['status'](_0x50ef58)[_0x3530('0x1c')]();};}function respondWithResult(_0x2b096b,_0x53561e){_0x53561e=_0x53561e||0xc8;return function(_0x2ea980){if(_0x2ea980){return _0x2b096b[_0x3530('0x1d')](_0x53561e)[_0x3530('0x1e')](_0x2ea980);}};}function respondWithFilteredResult(_0x569cc3,_0x4b7adb){return function(_0x3ebd6d){if(_0x3ebd6d){var _0x193ea3=typeof _0x4b7adb[_0x3530('0x1f')]===_0x3530('0x20')&&typeof _0x4b7adb['limit']==='undefined';var _0x40cac8=_0x3ebd6d['count'];var _0x4e759f=_0x193ea3?0x0:_0x4b7adb[_0x3530('0x1f')];var _0x1f6b37=_0x193ea3?_0x3ebd6d[_0x3530('0x21')]:_0x4b7adb[_0x3530('0x1f')]+_0x4b7adb[_0x3530('0x22')];var _0x5ad2ac;if(_0x1f6b37>=_0x40cac8){_0x1f6b37=_0x40cac8;_0x5ad2ac=0xc8;}else{_0x5ad2ac=0xce;}_0x569cc3[_0x3530('0x1d')](_0x5ad2ac);return _0x569cc3['set'](_0x3530('0x23'),_0x4e759f+'-'+_0x1f6b37+'/'+_0x40cac8)['json'](_0x3ebd6d);}return null;};}function patchUpdates(_0x24153e){return function(_0xd2f2ea){try{jsonpatch[_0x3530('0x24')](_0xd2f2ea,_0x24153e,!![]);}catch(_0x54e041){return BPromise[_0x3530('0x25')](_0x54e041);}return _0xd2f2ea[_0x3530('0x26')]();};}function saveUpdates(_0x40f04d,_0x12afcc){return function(_0x11538d){if(_0x11538d){return _0x11538d[_0x3530('0x27')](_0x40f04d)[_0x3530('0x28')](function(_0x4eaa11){return _0x4eaa11;});}return null;};}function removeEntity(_0x41c066,_0x241ffa){return function(_0x42f5f3){if(_0x42f5f3){return _0x42f5f3[_0x3530('0x29')]()[_0x3530('0x28')](function(){_0x41c066[_0x3530('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a46c,_0x3bca42){return function(_0x2e50aa){if(!_0x2e50aa){_0x25a46c[_0x3530('0x1b')](0x194);}return _0x2e50aa;};}function handleError(_0x328f01,_0x2b5938){_0x2b5938=_0x2b5938||0x1f4;return function(_0x44eb92){logger[_0x3530('0x2a')](_0x44eb92[_0x3530('0x2b')]);if(_0x44eb92[_0x3530('0x2c')]){delete _0x44eb92['name'];}_0x328f01[_0x3530('0x1d')](_0x2b5938)[_0x3530('0x2d')](_0x44eb92);};}exports['index']=function(_0x10f581,_0x18eff7){var _0x314241={},_0x100e46={},_0x5e0c6f={'count':0x0,'rows':[]};var _0x69fe6=_[_0x3530('0x2e')](db[_0x3530('0x2f')][_0x3530('0x30')],function(_0x5e98b9){return{'name':_0x5e98b9['fieldName'],'type':_0x5e98b9[_0x3530('0x31')]['key']};});_0x100e46[_0x3530('0x32')]=_[_0x3530('0x2e')](_0x69fe6,'name');_0x100e46[_0x3530('0x33')]=_[_0x3530('0x34')](_0x10f581['query']);_0x100e46[_0x3530('0x35')]=_[_0x3530('0x36')](_0x100e46[_0x3530('0x32')],_0x100e46['query']);_0x314241['attributes']=_[_0x3530('0x36')](_0x100e46[_0x3530('0x32')],qs['fields'](_0x10f581[_0x3530('0x33')][_0x3530('0x37')]));_0x314241[_0x3530('0x38')]=_0x314241[_0x3530('0x38')][_0x3530('0x39')]?_0x314241[_0x3530('0x38')]:_0x100e46['model'];if(!_0x10f581[_0x3530('0x33')][_0x3530('0x3a')](_0x3530('0x3b'))){_0x314241[_0x3530('0x22')]=qs[_0x3530('0x22')](_0x10f581[_0x3530('0x33')][_0x3530('0x22')]);_0x314241['offset']=qs[_0x3530('0x1f')](_0x10f581['query']['offset']);}_0x314241[_0x3530('0x3c')]=qs[_0x3530('0x3d')](_0x10f581[_0x3530('0x33')][_0x3530('0x3d')]);_0x314241['where']=qs['filters'](_['pick'](_0x10f581[_0x3530('0x33')],_0x100e46['filters']),_0x69fe6);if(_0x10f581[_0x3530('0x33')][_0x3530('0x3e')]){_0x314241[_0x3530('0x3f')]=_[_0x3530('0x40')](_0x314241[_0x3530('0x3f')],{'$or':_[_0x3530('0x2e')](_0x69fe6,function(_0x47395d){if(_0x47395d[_0x3530('0x31')]!==_0x3530('0x41')){var _0x74b66e={};_0x74b66e[_0x47395d[_0x3530('0x2c')]]={'$like':'%'+_0x10f581[_0x3530('0x33')][_0x3530('0x3e')]+'%'};return _0x74b66e;}})});}_0x314241=_[_0x3530('0x40')]({},_0x314241,_0x10f581[_0x3530('0x42')]);var _0x1f141e={'where':_0x314241[_0x3530('0x3f')]};return db[_0x3530('0x2f')]['count'](_0x1f141e)[_0x3530('0x28')](function(_0x1e4598){_0x5e0c6f[_0x3530('0x21')]=_0x1e4598;if(_0x10f581[_0x3530('0x33')]['includeAll']){_0x314241['include']=[{'all':!![]}];}return db[_0x3530('0x2f')][_0x3530('0x43')](_0x314241);})[_0x3530('0x28')](function(_0x209b65){_0x5e0c6f[_0x3530('0x44')]=_0x209b65;return _0x5e0c6f;})[_0x3530('0x28')](respondWithFilteredResult(_0x18eff7,_0x314241))[_0x3530('0x45')](handleError(_0x18eff7,null));};exports[_0x3530('0x46')]=function(_0x41eb9c,_0x44c3d2){var _0x3128fd={'raw':!![],'where':{'id':_0x41eb9c[_0x3530('0x47')]['id']}},_0x5dc06e={};_0x5dc06e[_0x3530('0x32')]=_['keys'](db[_0x3530('0x2f')][_0x3530('0x30')]);_0x5dc06e[_0x3530('0x33')]=_[_0x3530('0x34')](_0x41eb9c['query']);_0x5dc06e[_0x3530('0x35')]=_[_0x3530('0x36')](_0x5dc06e[_0x3530('0x32')],_0x5dc06e['query']);_0x3128fd[_0x3530('0x38')]=_[_0x3530('0x36')](_0x5dc06e[_0x3530('0x32')],qs[_0x3530('0x37')](_0x41eb9c[_0x3530('0x33')][_0x3530('0x37')]));_0x3128fd['attributes']=_0x3128fd[_0x3530('0x38')][_0x3530('0x39')]?_0x3128fd[_0x3530('0x38')]:_0x5dc06e[_0x3530('0x32')];if(_0x41eb9c['query'][_0x3530('0x48')]){_0x3128fd['include']=[{'all':!![]}];}_0x3128fd=_['merge']({},_0x3128fd,_0x41eb9c['options']);return db['ChatGroup']['find'](_0x3128fd)[_0x3530('0x28')](handleEntityNotFound(_0x44c3d2,null))['then'](respondWithResult(_0x44c3d2,null))['catch'](handleError(_0x44c3d2,null));};exports[_0x3530('0x49')]=function(_0x5b05d0,_0x5c1efd){return db[_0x3530('0x2f')][_0x3530('0x49')](_0x5b05d0[_0x3530('0x4a')],{})[_0x3530('0x28')](respondWithResult(_0x5c1efd,0xc9))[_0x3530('0x45')](handleError(_0x5c1efd,null));};exports[_0x3530('0x27')]=function(_0x2231fe,_0x1aae63){if(_0x2231fe[_0x3530('0x4a')]['id']){delete _0x2231fe['body']['id'];}return db[_0x3530('0x2f')][_0x3530('0x4b')]({'where':{'id':_0x2231fe[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x1aae63,null))['then'](saveUpdates(_0x2231fe[_0x3530('0x4a')],null))[_0x3530('0x28')](respondWithResult(_0x1aae63,null))['catch'](handleError(_0x1aae63,null));};exports['destroy']=function(_0x48aaa4,_0x332c6c){return db[_0x3530('0x2f')]['find']({'where':{'id':_0x48aaa4[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x332c6c,null))[_0x3530('0x28')](removeEntity(_0x332c6c,null))[_0x3530('0x45')](handleError(_0x332c6c,null));};exports[_0x3530('0x4c')]=function(_0x5dad97,_0x5373da){return db[_0x3530('0x2f')][_0x3530('0x4c')]()[_0x3530('0x28')](respondWithResult(_0x5373da,null))[_0x3530('0x45')](handleError(_0x5373da,null));};exports['getUnread']=function(_0x309ea2,_0x33c906,_0x268f81){return db[_0x3530('0x4d')][_0x3530('0x21')]({'where':{'ChatGroupId':_0x309ea2[_0x3530('0x47')]['id'],'ToId':_0x309ea2[_0x3530('0x4e')]['id'],'read':![]}})[_0x3530('0x28')](function(_0x548d68){return{'id':_['toInteger'](_0x309ea2[_0x3530('0x47')]['id']),'count':_0x548d68};})[_0x3530('0x28')](respondWithResult(_0x33c906,null))['catch'](handleError(_0x33c906,null));};exports[_0x3530('0x4f')]=function(_0x26441b,_0x12bda1,_0xc31fbb){return db['ChatGroup'][_0x3530('0x4b')]({'where':{'id':_0x26441b['params']['id']}})['then'](handleEntityNotFound(_0x12bda1,null))[_0x3530('0x28')](function(_0x146ba4){if(_0x146ba4){return _0x146ba4[_0x3530('0x4f')](_0x26441b['body'][_0x3530('0x50')],_[_0x3530('0x51')](_0x26441b[_0x3530('0x4a')],[_0x3530('0x50'),'id'])||{});}})[_0x3530('0x28')](respondWithResult(_0x12bda1,null))[_0x3530('0x45')](handleError(_0x12bda1,null));};exports['getMembers']=function(_0x3c2ab9,_0x461af6,_0xefaa03){var _0x1293e9={};var _0x109edc={};var _0x142f9c;var _0x4b78f3;return db[_0x3530('0x2f')][_0x3530('0x52')]({'where':{'id':_0x3c2ab9[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x461af6,null))[_0x3530('0x28')](function(_0x1181f3){if(_0x1181f3){_0x142f9c=_0x1181f3;_0x109edc[_0x3530('0x32')]=_[_0x3530('0x34')](db[_0x3530('0x53')][_0x3530('0x30')]);_0x109edc[_0x3530('0x33')]=_['keys'](_0x3c2ab9[_0x3530('0x33')]);_0x109edc[_0x3530('0x35')]=_[_0x3530('0x36')](_0x109edc[_0x3530('0x32')],_0x109edc['query']);_0x1293e9['attributes']=_[_0x3530('0x36')](_0x109edc['model'],qs[_0x3530('0x37')](_0x3c2ab9[_0x3530('0x33')][_0x3530('0x37')]));_0x1293e9[_0x3530('0x38')]=_0x1293e9[_0x3530('0x38')][_0x3530('0x39')]?_0x1293e9['attributes']:_0x109edc[_0x3530('0x32')];_0x1293e9[_0x3530('0x3c')]=qs[_0x3530('0x3d')](_0x3c2ab9[_0x3530('0x33')]['sort']);_0x1293e9['where']=qs[_0x3530('0x35')](_[_0x3530('0x54')](_0x3c2ab9[_0x3530('0x33')],_0x109edc[_0x3530('0x35')]));if(_0x3c2ab9[_0x3530('0x33')][_0x3530('0x3e')]){_0x1293e9[_0x3530('0x3f')]=_[_0x3530('0x40')](_0x1293e9[_0x3530('0x3f')],{'$or':_[_0x3530('0x2e')](_0x1293e9[_0x3530('0x38')],function(_0x58fcf2){var _0x1741ed={};_0x1741ed[_0x58fcf2]={'$like':'%'+_0x3c2ab9[_0x3530('0x33')]['filter']+'%'};return _0x1741ed;})});}_0x1293e9=_[_0x3530('0x40')]({},_0x1293e9,_0x3c2ab9[_0x3530('0x42')]);return _0x142f9c[_0x3530('0x55')](_0x1293e9);}})[_0x3530('0x28')](function(_0x3b7a17){if(_0x3b7a17){_0x4b78f3=_0x3b7a17[_0x3530('0x39')];if(!_0x3c2ab9[_0x3530('0x33')][_0x3530('0x3a')](_0x3530('0x3b'))){_0x1293e9[_0x3530('0x22')]=qs[_0x3530('0x22')](_0x3c2ab9[_0x3530('0x33')]['limit']);_0x1293e9[_0x3530('0x1f')]=qs[_0x3530('0x1f')](_0x3c2ab9[_0x3530('0x33')][_0x3530('0x1f')]);}return _0x142f9c[_0x3530('0x55')](_0x1293e9);}})[_0x3530('0x28')](function(_0x3762d6){if(_0x3762d6){return _0x3762d6?{'count':_0x4b78f3,'rows':_0x3762d6}:null;}})[_0x3530('0x28')](respondWithResult(_0x461af6,null))[_0x3530('0x45')](handleError(_0x461af6,null));};exports[_0x3530('0x56')]=function(_0x459094,_0x5b862b,_0x29f85a){return db[_0x3530('0x2f')][_0x3530('0x4b')]({'where':{'id':_0x459094[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x5b862b,null))[_0x3530('0x28')](function(_0xaf82f0){if(_0xaf82f0){return _0xaf82f0[_0x3530('0x56')](_0x459094[_0x3530('0x33')][_0x3530('0x50')]);}})['then'](respondWithStatusCode(_0x5b862b,null))[_0x3530('0x45')](handleError(_0x5b862b,null));};exports[_0x3530('0x57')]=function(_0x1a8019,_0x28344c,_0x236a38){if(_0x1a8019['body']['id']){delete _0x1a8019[_0x3530('0x4a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1a8019[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x28344c,null))['then'](function(_0x3f514c){if(_0x3f514c){_0x1a8019['body'][_0x3530('0x58')]=_0x3f514c['id'];return db[_0x3530('0x4d')][_0x3530('0x49')](_0x1a8019[_0x3530('0x4a')]);}})[_0x3530('0x28')](respondWithResult(_0x28344c,null))[_0x3530('0x45')](handleError(_0x28344c,null));};exports['getMessages']=function(_0x1208e9,_0x25184d,_0x591982){var _0xaa1ae9={};var _0x42faaf={};var _0x4ee9b3;var _0x15c1d5;return db['ChatGroup'][_0x3530('0x52')]({'where':{'id':_0x1208e9[_0x3530('0x47')]['id']}})[_0x3530('0x28')](handleEntityNotFound(_0x25184d,null))[_0x3530('0x28')](function(_0x167b8e){if(_0x167b8e){_0x4ee9b3=_0x167b8e;_0x42faaf['model']=_['keys'](db['ChatInternalMessage'][_0x3530('0x30')]);_0x42faaf[_0x3530('0x33')]=_[_0x3530('0x34')](_0x1208e9[_0x3530('0x33')]);_0x42faaf['filters']=_['intersection'](_0x42faaf[_0x3530('0x32')],_0x42faaf[_0x3530('0x33')]);_0xaa1ae9['attributes']=_[_0x3530('0x36')](_0x42faaf[_0x3530('0x32')],qs[_0x3530('0x37')](_0x1208e9[_0x3530('0x33')][_0x3530('0x37')]));_0xaa1ae9[_0x3530('0x38')]=_0xaa1ae9[_0x3530('0x38')]['length']?_0xaa1ae9[_0x3530('0x38')]:_0x42faaf[_0x3530('0x32')];_0xaa1ae9[_0x3530('0x3c')]=qs[_0x3530('0x3d')](_0x1208e9['query']['sort']);_0xaa1ae9[_0x3530('0x3f')]=qs['filters'](_[_0x3530('0x54')](_0x1208e9['query'],_0x42faaf[_0x3530('0x35')]));if(_0x1208e9[_0x3530('0x33')][_0x3530('0x3e')]){_0xaa1ae9['where']=_[_0x3530('0x40')](_0xaa1ae9[_0x3530('0x3f')],{'$or':_[_0x3530('0x2e')](_0xaa1ae9[_0x3530('0x38')],function(_0x209937){var _0x33031c={};_0x33031c[_0x209937]={'$like':'%'+_0x1208e9[_0x3530('0x33')][_0x3530('0x3e')]+'%'};return _0x33031c;})});}if(_0x1208e9[_0x3530('0x33')][_0x3530('0x59')]){var _0x5c6099=_0x1208e9[_0x3530('0x33')]['$gte'][_0x3530('0x5a')](',');var _0x5623a3={};_0x5623a3[_0x5c6099[0x0]]={'$gte':moment(_0x5c6099[0x1])[_0x3530('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0xaa1ae9[_0x3530('0x3f')]=_['merge'](_0xaa1ae9['where'],_0x5623a3);}_0xaa1ae9=_[_0x3530('0x40')]({},_0xaa1ae9,_0x1208e9[_0x3530('0x42')]);return _0x4ee9b3[_0x3530('0x5c')](_0xaa1ae9);}})[_0x3530('0x28')](function(_0x1a8217){if(_0x1a8217){_0x15c1d5=_0x1a8217[_0x3530('0x39')];if(!_0x1208e9[_0x3530('0x33')][_0x3530('0x3a')](_0x3530('0x3b'))){_0xaa1ae9[_0x3530('0x22')]=qs['limit'](_0x1208e9[_0x3530('0x33')][_0x3530('0x22')]);_0xaa1ae9[_0x3530('0x1f')]=qs['offset'](_0x1208e9[_0x3530('0x33')]['offset']);}return _0x4ee9b3[_0x3530('0x5c')](_0xaa1ae9);}})[_0x3530('0x28')](function(_0x24c559){if(_0x24c559){return _0x24c559?{'count':_0x15c1d5,'rows':_0x24c559}:null;}})[_0x3530('0x28')](respondWithResult(_0x25184d,null))[_0x3530('0x45')](handleError(_0x25184d,null));}; \ No newline at end of file +var _0xca4c=['register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','include','options','create','body','find','destroy','params','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','rawAttributes','removeMembers','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca4c,0xa4));var _0xcca4=function(_0x5116f5,_0x5b95d2){_0x5116f5=_0x5116f5-0x0;var _0x36da70=_0xca4c[_0x5116f5];return _0x36da70;};'use strict';var emlformat=require(_0xcca4('0x0'));var rimraf=require(_0xcca4('0x1'));var zipdir=require(_0xcca4('0x2'));var jsonpatch=require(_0xcca4('0x3'));var rp=require(_0xcca4('0x4'));var moment=require(_0xcca4('0x5'));var BPromise=require(_0xcca4('0x6'));var Mustache=require('mustache');var util=require(_0xcca4('0x7'));var path=require(_0xcca4('0x8'));var sox=require(_0xcca4('0x9'));var csv=require(_0xcca4('0xa'));var ejs=require(_0xcca4('0xb'));var fs=require('fs');var fs_extra=require(_0xcca4('0xc'));var _=require(_0xcca4('0xd'));var squel=require(_0xcca4('0xe'));var crypto=require('crypto');var jsforce=require(_0xcca4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcca4('0xa'));var querystring=require('querystring');var Papa=require(_0xcca4('0x10'));var Redis=require(_0xcca4('0x11'));var authService=require(_0xcca4('0x12'));var qs=require(_0xcca4('0x13'));var as=require(_0xcca4('0x14'));var hardwareService=require(_0xcca4('0x15'));var logger=require('../../config/logger')(_0xcca4('0x16'));var utils=require(_0xcca4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcca4('0x18'));var db=require(_0xcca4('0x19'))['db'];config[_0xcca4('0x1a')]=_[_0xcca4('0x1b')](config[_0xcca4('0x1a')],{'host':_0xcca4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca4('0x1a')]));require(_0xcca4('0x1d'))[_0xcca4('0x1e')](socket);function respondWithStatusCode(_0x33cd87,_0x4cd4ae){_0x4cd4ae=_0x4cd4ae||0xcc;return function(_0x5c8a0c){if(_0x5c8a0c){return _0x33cd87[_0xcca4('0x1f')](_0x4cd4ae);}return _0x33cd87['status'](_0x4cd4ae)[_0xcca4('0x20')]();};}function respondWithResult(_0x8f8e73,_0xa25056){_0xa25056=_0xa25056||0xc8;return function(_0x3bfd28){if(_0x3bfd28){return _0x8f8e73[_0xcca4('0x21')](_0xa25056)[_0xcca4('0x22')](_0x3bfd28);}};}function respondWithFilteredResult(_0x2a6590,_0x26bd77){return function(_0xceb6fb){if(_0xceb6fb){var _0x2358b3=typeof _0x26bd77[_0xcca4('0x23')]===_0xcca4('0x24')&&typeof _0x26bd77[_0xcca4('0x25')]===_0xcca4('0x24');var _0x193d7b=_0xceb6fb[_0xcca4('0x26')];var _0xc7fa1e=_0x2358b3?0x0:_0x26bd77[_0xcca4('0x23')];var _0x21fa92=_0x2358b3?_0xceb6fb['count']:_0x26bd77['offset']+_0x26bd77[_0xcca4('0x25')];var _0x10acc2;if(_0x21fa92>=_0x193d7b){_0x21fa92=_0x193d7b;_0x10acc2=0xc8;}else{_0x10acc2=0xce;}_0x2a6590[_0xcca4('0x21')](_0x10acc2);return _0x2a6590[_0xcca4('0x27')](_0xcca4('0x28'),_0xc7fa1e+'-'+_0x21fa92+'/'+_0x193d7b)[_0xcca4('0x22')](_0xceb6fb);}return null;};}function patchUpdates(_0x65385d){return function(_0x3a4eb8){try{jsonpatch[_0xcca4('0x29')](_0x3a4eb8,_0x65385d,!![]);}catch(_0x28b585){return BPromise[_0xcca4('0x2a')](_0x28b585);}return _0x3a4eb8[_0xcca4('0x2b')]();};}function saveUpdates(_0x2e1a64,_0x8172b0){return function(_0x1d3c13){if(_0x1d3c13){return _0x1d3c13[_0xcca4('0x2c')](_0x2e1a64)[_0xcca4('0x2d')](function(_0x255548){return _0x255548;});}return null;};}function removeEntity(_0x77677,_0x46d730){return function(_0x36051f){if(_0x36051f){return _0x36051f['destroy']()[_0xcca4('0x2d')](function(){_0x77677[_0xcca4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2778f5,_0x3da014){return function(_0x402f50){if(!_0x402f50){_0x2778f5[_0xcca4('0x1f')](0x194);}return _0x402f50;};}function handleError(_0x5769ec,_0x2a0532){_0x2a0532=_0x2a0532||0x1f4;return function(_0xa35c97){logger[_0xcca4('0x2e')](_0xa35c97[_0xcca4('0x2f')]);if(_0xa35c97[_0xcca4('0x30')]){delete _0xa35c97[_0xcca4('0x30')];}_0x5769ec[_0xcca4('0x21')](_0x2a0532)[_0xcca4('0x31')](_0xa35c97);};}exports[_0xcca4('0x32')]=function(_0x3c010b,_0x54cfef){var _0x40eb13={},_0x57c427={},_0x3d57a2={'count':0x0,'rows':[]};var _0x551429=_[_0xcca4('0x33')](db[_0xcca4('0x34')]['rawAttributes'],function(_0x54a3d6){return{'name':_0x54a3d6[_0xcca4('0x35')],'type':_0x54a3d6[_0xcca4('0x36')][_0xcca4('0x37')]};});_0x57c427[_0xcca4('0x38')]=_[_0xcca4('0x33')](_0x551429,_0xcca4('0x30'));_0x57c427[_0xcca4('0x39')]=_[_0xcca4('0x3a')](_0x3c010b[_0xcca4('0x39')]);_0x57c427[_0xcca4('0x3b')]=_[_0xcca4('0x3c')](_0x57c427[_0xcca4('0x38')],_0x57c427[_0xcca4('0x39')]);_0x40eb13['attributes']=_[_0xcca4('0x3c')](_0x57c427[_0xcca4('0x38')],qs[_0xcca4('0x3d')](_0x3c010b[_0xcca4('0x39')][_0xcca4('0x3d')]));_0x40eb13['attributes']=_0x40eb13[_0xcca4('0x3e')][_0xcca4('0x3f')]?_0x40eb13[_0xcca4('0x3e')]:_0x57c427[_0xcca4('0x38')];if(!_0x3c010b[_0xcca4('0x39')][_0xcca4('0x40')](_0xcca4('0x41'))){_0x40eb13[_0xcca4('0x25')]=qs[_0xcca4('0x25')](_0x3c010b[_0xcca4('0x39')][_0xcca4('0x25')]);_0x40eb13[_0xcca4('0x23')]=qs[_0xcca4('0x23')](_0x3c010b['query']['offset']);}_0x40eb13[_0xcca4('0x42')]=qs[_0xcca4('0x43')](_0x3c010b['query']['sort']);_0x40eb13[_0xcca4('0x44')]=qs[_0xcca4('0x3b')](_[_0xcca4('0x45')](_0x3c010b[_0xcca4('0x39')],_0x57c427[_0xcca4('0x3b')]),_0x551429);if(_0x3c010b[_0xcca4('0x39')][_0xcca4('0x46')]){_0x40eb13[_0xcca4('0x44')]=_['merge'](_0x40eb13[_0xcca4('0x44')],{'$or':_[_0xcca4('0x33')](_0x551429,function(_0x4f00fb){if(_0x4f00fb[_0xcca4('0x36')]!=='VIRTUAL'){var _0x2a3bb3={};_0x2a3bb3[_0x4f00fb[_0xcca4('0x30')]]={'$like':'%'+_0x3c010b[_0xcca4('0x39')][_0xcca4('0x46')]+'%'};return _0x2a3bb3;}})});}_0x40eb13=_[_0xcca4('0x47')]({},_0x40eb13,_0x3c010b['options']);var _0x56c7ce={'where':_0x40eb13[_0xcca4('0x44')]};return db[_0xcca4('0x34')][_0xcca4('0x26')](_0x56c7ce)[_0xcca4('0x2d')](function(_0x2a0ee6){_0x3d57a2[_0xcca4('0x26')]=_0x2a0ee6;if(_0x3c010b[_0xcca4('0x39')][_0xcca4('0x48')]){_0x40eb13['include']=[{'all':!![]}];}return db[_0xcca4('0x34')][_0xcca4('0x49')](_0x40eb13);})[_0xcca4('0x2d')](function(_0x4af2c0){_0x3d57a2[_0xcca4('0x4a')]=_0x4af2c0;return _0x3d57a2;})[_0xcca4('0x2d')](respondWithFilteredResult(_0x54cfef,_0x40eb13))[_0xcca4('0x4b')](handleError(_0x54cfef,null));};exports[_0xcca4('0x4c')]=function(_0x3d0026,_0x355295){var _0x1ca0c5={'raw':!![],'where':{'id':_0x3d0026['params']['id']}},_0x5519b4={};_0x5519b4[_0xcca4('0x38')]=_[_0xcca4('0x3a')](db[_0xcca4('0x34')]['rawAttributes']);_0x5519b4['query']=_[_0xcca4('0x3a')](_0x3d0026[_0xcca4('0x39')]);_0x5519b4[_0xcca4('0x3b')]=_['intersection'](_0x5519b4[_0xcca4('0x38')],_0x5519b4[_0xcca4('0x39')]);_0x1ca0c5[_0xcca4('0x3e')]=_[_0xcca4('0x3c')](_0x5519b4['model'],qs[_0xcca4('0x3d')](_0x3d0026[_0xcca4('0x39')][_0xcca4('0x3d')]));_0x1ca0c5[_0xcca4('0x3e')]=_0x1ca0c5[_0xcca4('0x3e')][_0xcca4('0x3f')]?_0x1ca0c5[_0xcca4('0x3e')]:_0x5519b4['model'];if(_0x3d0026[_0xcca4('0x39')][_0xcca4('0x48')]){_0x1ca0c5[_0xcca4('0x4d')]=[{'all':!![]}];}_0x1ca0c5=_[_0xcca4('0x47')]({},_0x1ca0c5,_0x3d0026[_0xcca4('0x4e')]);return db[_0xcca4('0x34')]['find'](_0x1ca0c5)['then'](handleEntityNotFound(_0x355295,null))[_0xcca4('0x2d')](respondWithResult(_0x355295,null))[_0xcca4('0x4b')](handleError(_0x355295,null));};exports['create']=function(_0x2b32bf,_0x5a37b1){return db['ChatGroup'][_0xcca4('0x4f')](_0x2b32bf['body'],{})[_0xcca4('0x2d')](respondWithResult(_0x5a37b1,0xc9))[_0xcca4('0x4b')](handleError(_0x5a37b1,null));};exports['update']=function(_0x46cc3b,_0x973b2){if(_0x46cc3b[_0xcca4('0x50')]['id']){delete _0x46cc3b[_0xcca4('0x50')]['id'];}return db[_0xcca4('0x34')][_0xcca4('0x51')]({'where':{'id':_0x46cc3b['params']['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x973b2,null))[_0xcca4('0x2d')](saveUpdates(_0x46cc3b[_0xcca4('0x50')],null))[_0xcca4('0x2d')](respondWithResult(_0x973b2,null))[_0xcca4('0x4b')](handleError(_0x973b2,null));};exports[_0xcca4('0x52')]=function(_0x4ad63f,_0x418ad6){return db[_0xcca4('0x34')][_0xcca4('0x51')]({'where':{'id':_0x4ad63f[_0xcca4('0x53')]['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x418ad6,null))['then'](removeEntity(_0x418ad6,null))[_0xcca4('0x4b')](handleError(_0x418ad6,null));};exports['describe']=function(_0x3e016d,_0x268a18){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x268a18,null))[_0xcca4('0x4b')](handleError(_0x268a18,null));};exports['getUnread']=function(_0x190841,_0x1d2b0b,_0xa96be5){return db[_0xcca4('0x54')]['count']({'where':{'ChatGroupId':_0x190841[_0xcca4('0x53')]['id'],'ToId':_0x190841[_0xcca4('0x55')]['id'],'read':![]}})[_0xcca4('0x2d')](function(_0x2bebc2){return{'id':_['toInteger'](_0x190841['params']['id']),'count':_0x2bebc2};})[_0xcca4('0x2d')](respondWithResult(_0x1d2b0b,null))['catch'](handleError(_0x1d2b0b,null));};exports['addMembers']=function(_0x413072,_0x15018a,_0x28330d){return db['ChatGroup'][_0xcca4('0x51')]({'where':{'id':_0x413072[_0xcca4('0x53')]['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x15018a,null))['then'](function(_0x37e4ed){if(_0x37e4ed){return _0x37e4ed[_0xcca4('0x56')](_0x413072['body'][_0xcca4('0x57')],_[_0xcca4('0x58')](_0x413072[_0xcca4('0x50')],[_0xcca4('0x57'),'id'])||{});}})[_0xcca4('0x2d')](respondWithResult(_0x15018a,null))[_0xcca4('0x4b')](handleError(_0x15018a,null));};exports[_0xcca4('0x59')]=function(_0xe71db1,_0x5e9987,_0x379c23){var _0x4e1e02={};var _0x252637={};var _0x24ee7d;var _0x1ce274;return db[_0xcca4('0x34')][_0xcca4('0x5a')]({'where':{'id':_0xe71db1[_0xcca4('0x53')]['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x5e9987,null))[_0xcca4('0x2d')](function(_0x59654b){if(_0x59654b){_0x24ee7d=_0x59654b;_0x252637['model']=_[_0xcca4('0x3a')](db['User'][_0xcca4('0x5b')]);_0x252637[_0xcca4('0x39')]=_['keys'](_0xe71db1[_0xcca4('0x39')]);_0x252637[_0xcca4('0x3b')]=_['intersection'](_0x252637[_0xcca4('0x38')],_0x252637[_0xcca4('0x39')]);_0x4e1e02[_0xcca4('0x3e')]=_[_0xcca4('0x3c')](_0x252637[_0xcca4('0x38')],qs[_0xcca4('0x3d')](_0xe71db1['query']['fields']));_0x4e1e02[_0xcca4('0x3e')]=_0x4e1e02['attributes'][_0xcca4('0x3f')]?_0x4e1e02[_0xcca4('0x3e')]:_0x252637[_0xcca4('0x38')];_0x4e1e02[_0xcca4('0x42')]=qs[_0xcca4('0x43')](_0xe71db1['query'][_0xcca4('0x43')]);_0x4e1e02[_0xcca4('0x44')]=qs['filters'](_[_0xcca4('0x45')](_0xe71db1[_0xcca4('0x39')],_0x252637[_0xcca4('0x3b')]));if(_0xe71db1[_0xcca4('0x39')][_0xcca4('0x46')]){_0x4e1e02[_0xcca4('0x44')]=_[_0xcca4('0x47')](_0x4e1e02['where'],{'$or':_[_0xcca4('0x33')](_0x4e1e02[_0xcca4('0x3e')],function(_0x1ba7d1){var _0x302928={};_0x302928[_0x1ba7d1]={'$like':'%'+_0xe71db1['query'][_0xcca4('0x46')]+'%'};return _0x302928;})});}_0x4e1e02=_[_0xcca4('0x47')]({},_0x4e1e02,_0xe71db1[_0xcca4('0x4e')]);return _0x24ee7d['getMembers'](_0x4e1e02);}})['then'](function(_0x3af0d6){if(_0x3af0d6){_0x1ce274=_0x3af0d6['length'];if(!_0xe71db1[_0xcca4('0x39')][_0xcca4('0x40')]('nolimit')){_0x4e1e02['limit']=qs[_0xcca4('0x25')](_0xe71db1['query'][_0xcca4('0x25')]);_0x4e1e02['offset']=qs['offset'](_0xe71db1[_0xcca4('0x39')][_0xcca4('0x23')]);}return _0x24ee7d[_0xcca4('0x59')](_0x4e1e02);}})[_0xcca4('0x2d')](function(_0x3fdc97){if(_0x3fdc97){return _0x3fdc97?{'count':_0x1ce274,'rows':_0x3fdc97}:null;}})[_0xcca4('0x2d')](respondWithResult(_0x5e9987,null))['catch'](handleError(_0x5e9987,null));};exports['removeMembers']=function(_0x5d00de,_0x38d82a,_0x539f14){return db[_0xcca4('0x34')][_0xcca4('0x51')]({'where':{'id':_0x5d00de['params']['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x38d82a,null))[_0xcca4('0x2d')](function(_0x24331a){if(_0x24331a){return _0x24331a[_0xcca4('0x5c')](_0x5d00de[_0xcca4('0x39')][_0xcca4('0x57')]);}})[_0xcca4('0x2d')](respondWithStatusCode(_0x38d82a,null))['catch'](handleError(_0x38d82a,null));};exports['addMessage']=function(_0x4eda69,_0x5a86ee,_0x2c09e9){if(_0x4eda69['body']['id']){delete _0x4eda69[_0xcca4('0x50')]['id'];}return db[_0xcca4('0x34')][_0xcca4('0x51')]({'where':{'id':_0x4eda69[_0xcca4('0x53')]['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x5a86ee,null))[_0xcca4('0x2d')](function(_0x4bb88d){if(_0x4bb88d){_0x4eda69[_0xcca4('0x50')][_0xcca4('0x5d')]=_0x4bb88d['id'];return db[_0xcca4('0x54')][_0xcca4('0x4f')](_0x4eda69['body']);}})[_0xcca4('0x2d')](respondWithResult(_0x5a86ee,null))[_0xcca4('0x4b')](handleError(_0x5a86ee,null));};exports[_0xcca4('0x5e')]=function(_0x3317dd,_0x325d79,_0x55aa17){var _0x531596={};var _0x562980={};var _0x355c1c;var _0x59f7cc;return db[_0xcca4('0x34')][_0xcca4('0x5a')]({'where':{'id':_0x3317dd[_0xcca4('0x53')]['id']}})[_0xcca4('0x2d')](handleEntityNotFound(_0x325d79,null))[_0xcca4('0x2d')](function(_0x22e9f6){if(_0x22e9f6){_0x355c1c=_0x22e9f6;_0x562980['model']=_['keys'](db['ChatInternalMessage'][_0xcca4('0x5b')]);_0x562980[_0xcca4('0x39')]=_[_0xcca4('0x3a')](_0x3317dd[_0xcca4('0x39')]);_0x562980[_0xcca4('0x3b')]=_[_0xcca4('0x3c')](_0x562980[_0xcca4('0x38')],_0x562980['query']);_0x531596[_0xcca4('0x3e')]=_[_0xcca4('0x3c')](_0x562980[_0xcca4('0x38')],qs['fields'](_0x3317dd['query']['fields']));_0x531596[_0xcca4('0x3e')]=_0x531596[_0xcca4('0x3e')]['length']?_0x531596[_0xcca4('0x3e')]:_0x562980[_0xcca4('0x38')];_0x531596['order']=qs['sort'](_0x3317dd[_0xcca4('0x39')][_0xcca4('0x43')]);_0x531596[_0xcca4('0x44')]=qs[_0xcca4('0x3b')](_[_0xcca4('0x45')](_0x3317dd[_0xcca4('0x39')],_0x562980[_0xcca4('0x3b')]));if(_0x3317dd[_0xcca4('0x39')]['filter']){_0x531596[_0xcca4('0x44')]=_[_0xcca4('0x47')](_0x531596[_0xcca4('0x44')],{'$or':_['map'](_0x531596[_0xcca4('0x3e')],function(_0x449cd1){var _0x4728a0={};_0x4728a0[_0x449cd1]={'$like':'%'+_0x3317dd[_0xcca4('0x39')][_0xcca4('0x46')]+'%'};return _0x4728a0;})});}if(_0x3317dd[_0xcca4('0x39')][_0xcca4('0x5f')]){var _0x76d380=_0x3317dd[_0xcca4('0x39')][_0xcca4('0x5f')]['split'](',');var _0x810400={};_0x810400[_0x76d380[0x0]]={'$gte':moment(_0x76d380[0x1])['format'](_0xcca4('0x60'))};_0x531596[_0xcca4('0x44')]=_['merge'](_0x531596[_0xcca4('0x44')],_0x810400);}_0x531596=_['merge']({},_0x531596,_0x3317dd[_0xcca4('0x4e')]);return _0x355c1c[_0xcca4('0x5e')](_0x531596);}})[_0xcca4('0x2d')](function(_0x19211f){if(_0x19211f){_0x59f7cc=_0x19211f[_0xcca4('0x3f')];if(!_0x3317dd['query'][_0xcca4('0x40')]('nolimit')){_0x531596['limit']=qs[_0xcca4('0x25')](_0x3317dd[_0xcca4('0x39')]['limit']);_0x531596[_0xcca4('0x23')]=qs[_0xcca4('0x23')](_0x3317dd[_0xcca4('0x39')][_0xcca4('0x23')]);}return _0x355c1c[_0xcca4('0x5e')](_0x531596);}})[_0xcca4('0x2d')](function(_0x3566a9){if(_0x3566a9){return _0x3566a9?{'count':_0x59f7cc,'rows':_0x3566a9}:null;}})[_0xcca4('0x2d')](respondWithResult(_0x325d79,null))['catch'](handleError(_0x325d79,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d0174b3..b1850f1 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 _0xf4c9=['events','../../mysqldb','ChatGroup','save','remove','emit'];(function(_0x134d41,_0x1d3de3){var _0x32d5e9=function(_0x5b5eda){while(--_0x5b5eda){_0x134d41['push'](_0x134d41['shift']());}};_0x32d5e9(++_0x1d3de3);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf4c9[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x9f4c('0x0'));var ChatGroup=require(_0x9f4c('0x1'))['db'][_0x9f4c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f4c('0x3'),'afterUpdate':'update','afterDestroy':_0x9f4c('0x4')};function emitEvent(_0x34a063){return function(_0xc227b9,_0x54ad85,_0x50c76e){ChatGroupEvents['emit'](_0x34a063+':'+_0xc227b9['id'],_0xc227b9);ChatGroupEvents[_0x9f4c('0x5')](_0x34a063,_0xc227b9);_0x50c76e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xee8f=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x45c076,_0x227b19){var _0x258b71=function(_0x49cb67){while(--_0x49cb67){_0x45c076['push'](_0x45c076['shift']());}};_0x258b71(++_0x227b19);}(_0xee8f,0x1ed));var _0xfee8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xee8f[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xfee8('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfee8('0x1')](0x0);var events={'afterCreate':_0xfee8('0x2'),'afterUpdate':_0xfee8('0x3'),'afterDestroy':_0xfee8('0x4')};function emitEvent(_0x5856a8){return function(_0x4b542f,_0x55be8b,_0x1652fc){ChatGroupEvents[_0xfee8('0x5')](_0x5856a8+':'+_0x4b542f['id'],_0x4b542f);ChatGroupEvents[_0xfee8('0x5')](_0x5856a8,_0x4b542f);_0x1652fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xfee8('0x6')](e,emitEvent(event));}}module[_0xfee8('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c8a0245..641635e 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 _0xbf1f=['../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','moment','path','rimraf'];(function(_0x3420c7,_0x607275){var _0x4b67fe=function(_0x19d5dc){while(--_0x19d5dc){_0x3420c7['push'](_0x3420c7['shift']());}};_0x4b67fe(++_0x607275);}(_0xbf1f,0x1c6));var _0xfbf1=function(_0x3a8027,_0x33c4a9){_0x3a8027=_0x3a8027-0x0;var _0x1fdef5=_0xbf1f[_0x3a8027];return _0x1fdef5;};'use strict';var _=require(_0xfbf1('0x0'));var util=require(_0xfbf1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfbf1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbf1('0x3'));var rimraf=require(_0xfbf1('0x4'));var config=require(_0xfbf1('0x5'));var attributes=require(_0xfbf1('0x6'));module['exports']=function(_0x410c6c,_0x448db2){return _0x410c6c['define'](_0xfbf1('0x7'),attributes,{'tableName':_0xfbf1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7c5=['request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x53de80,_0x401fb6){var _0x54d332=function(_0x53bb6e){while(--_0x53bb6e){_0x53de80['push'](_0x53de80['shift']());}};_0x54d332(++_0x401fb6);}(_0xa7c5,0x15a));var _0x5a7c=function(_0x366e00,_0x46150a){_0x366e00=_0x366e00-0x0;var _0x232a64=_0xa7c5[_0x366e00];return _0x232a64;};'use strict';var _=require(_0x5a7c('0x0'));var util=require(_0x5a7c('0x1'));var logger=require(_0x5a7c('0x2'))(_0x5a7c('0x3'));var moment=require(_0x5a7c('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a7c('0x5'));var fs=require('fs');var path=require(_0x5a7c('0x6'));var rimraf=require(_0x5a7c('0x7'));var config=require(_0x5a7c('0x8'));var attributes=require(_0x5a7c('0x9'));module[_0x5a7c('0xa')]=function(_0xf36e45,_0x3e6c54){return _0xf36e45[_0x5a7c('0xb')]('ChatGroup',attributes,{'tableName':_0x5a7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3fb605c..d2ba284 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 _0x544f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x4bca5b,_0xb810b2){var _0x8db3ec=function(_0x349a90){while(--_0x349a90){_0x4bca5b['push'](_0x4bca5b['shift']());}};_0x8db3ec(++_0xb810b2);}(_0x544f,0x14c));var _0xf544=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x544f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf544('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require(_0xf544('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});config[_0xf544('0x9')]=_[_0xf544('0xa')](config[_0xf544('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf544('0xb'))(new Redis(config['redis']));require(_0xf544('0xc'))['register'](socket);function respondWithRpcPromise(_0x29fb0a,_0x4a042d,_0x445fbe){return new BPromise(function(_0x47e00a,_0x1ebefc){return client[_0xf544('0xd')](_0x29fb0a,_0x445fbe)[_0xf544('0xe')](function(_0x3c23d6){logger[_0xf544('0xf')](_0xf544('0x10'),_0x4a042d,_0xf544('0x11'));logger[_0xf544('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4a042d,_0xf544('0x11'),JSON[_0xf544('0x13')](_0x3c23d6));if(_0x3c23d6['error']){if(_0x3c23d6['error']['code']===0x1f4){logger[_0xf544('0x14')]('ChatGroup,\x20%s,\x20%s',_0x4a042d,_0x3c23d6[_0xf544('0x14')]['message']);return _0x1ebefc(_0x3c23d6[_0xf544('0x14')]['message']);}logger[_0xf544('0x14')](_0xf544('0x10'),_0x4a042d,_0x3c23d6[_0xf544('0x14')]['message']);return _0x47e00a(_0x3c23d6[_0xf544('0x14')][_0xf544('0x15')]);}else{logger[_0xf544('0xf')](_0xf544('0x10'),_0x4a042d,_0xf544('0x11'));_0x47e00a(_0x3c23d6[_0xf544('0x16')][_0xf544('0x15')]);}})[_0xf544('0x17')](function(_0x46c02f){logger[_0xf544('0x14')](_0xf544('0x10'),_0x4a042d,_0x46c02f);_0x1ebefc(_0x46c02f);});});} \ No newline at end of file +var _0x746f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16b516,_0x64e57c){var _0x479d68=function(_0x21f2ed){while(--_0x21f2ed){_0x16b516['push'](_0x16b516['shift']());}};_0x479d68(++_0x64e57c);}(_0x746f,0x9c));var _0xf746=function(_0x26d401,_0x4c762e){_0x26d401=_0x26d401-0x0;var _0x2d7bed=_0x746f[_0x26d401];return _0x2d7bed;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var moment=require(_0xf746('0x2'));var BPromise=require(_0xf746('0x3'));var rs=require(_0xf746('0x4'));var fs=require('fs');var Redis=require(_0xf746('0x5'));var db=require(_0xf746('0x6'))['db'];var utils=require(_0xf746('0x7'));var logger=require(_0xf746('0x8'))(_0xf746('0x9'));var config=require(_0xf746('0xa'));var jayson=require(_0xf746('0xb'));var client=jayson[_0xf746('0xc')][_0xf746('0xd')]({'port':0x232a});config[_0xf746('0xe')]=_[_0xf746('0xf')](config[_0xf746('0xe')],{'host':_0xf746('0x10'),'port':0x18eb});var socket=require(_0xf746('0x11'))(new Redis(config[_0xf746('0xe')]));require(_0xf746('0x12'))[_0xf746('0x13')](socket);function respondWithRpcPromise(_0xfe206a,_0xb5d59f,_0xf72dfd){return new BPromise(function(_0x5dc740,_0x3a0fa8){return client[_0xf746('0x14')](_0xfe206a,_0xf72dfd)[_0xf746('0x15')](function(_0x47ce05){logger[_0xf746('0x16')]('ChatGroup,\x20%s,\x20%s',_0xb5d59f,_0xf746('0x17'));logger[_0xf746('0x18')](_0xf746('0x19'),_0xb5d59f,_0xf746('0x17'),JSON[_0xf746('0x1a')](_0x47ce05));if(_0x47ce05[_0xf746('0x1b')]){if(_0x47ce05['error'][_0xf746('0x1c')]===0x1f4){logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x47ce05['error'][_0xf746('0x1e')]);return _0x3a0fa8(_0x47ce05[_0xf746('0x1b')][_0xf746('0x1e')]);}logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x47ce05[_0xf746('0x1b')]['message']);return _0x5dc740(_0x47ce05[_0xf746('0x1b')]['message']);}else{logger[_0xf746('0x16')](_0xf746('0x1d'),_0xb5d59f,'request\x20sent');_0x5dc740(_0x47ce05[_0xf746('0x1f')][_0xf746('0x1e')]);}})[_0xf746('0x20')](function(_0x11d8db){logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x11d8db);_0x3a0fa8(_0x11d8db);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 38b0842..b503395 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 _0x5d7d=['./chatGroup.events','save','update','emit','removeListener','register','length'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x5d7d,0xd9));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0xd5d7('0x0'));var events=[_0xd5d7('0x1'),'remove',_0xd5d7('0x2')];function createListener(_0x5260d7,_0x4ff8a2){return function(_0x33e032){_0x4ff8a2[_0xd5d7('0x3')](_0x5260d7,_0x33e032);};}function removeListener(_0x3a84ca,_0x316489){return function(){ChatGroupEvents[_0xd5d7('0x4')](_0x3a84ca,_0x316489);};}exports[_0xd5d7('0x5')]=function(_0x53f0eb){for(var _0x4ce8fc=0x0,_0x4569a4=events[_0xd5d7('0x6')];_0x4ce8fc<_0x4569a4;_0x4ce8fc++){var _0x5889c1=events[_0x4ce8fc];var _0x221cd0=createListener('chatGroup:'+_0x5889c1,_0x53f0eb);ChatGroupEvents['on'](_0x5889c1,_0x221cd0);}}; \ No newline at end of file +var _0x270f=['emit','removeListener','register','save','remove','update'];(function(_0x1aeeeb,_0xf01382){var _0x2836d2=function(_0x41d90e){while(--_0x41d90e){_0x1aeeeb['push'](_0x1aeeeb['shift']());}};_0x2836d2(++_0xf01382);}(_0x270f,0x111));var _0xf270=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x270f[_0x453e2b];return _0x50f306;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xf270('0x0'),_0xf270('0x1'),_0xf270('0x2')];function createListener(_0x126ebf,_0x17b2ed){return function(_0x24cd56){_0x17b2ed[_0xf270('0x3')](_0x126ebf,_0x24cd56);};}function removeListener(_0x2e8cb4,_0x56061b){return function(){ChatGroupEvents[_0xf270('0x4')](_0x2e8cb4,_0x56061b);};}exports[_0xf270('0x5')]=function(_0x5777df){for(var _0x5e4a61=0x0,_0x4a24a3=events['length'];_0x5e4a61<_0x4a24a3;_0x5e4a61++){var _0x22ad52=events[_0x5e4a61];var _0x1c39d2=createListener('chatGroup:'+_0x22ad52,_0x5777df);ChatGroupEvents['on'](_0x22ad52,_0x1c39d2);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e089a56..74bdae0 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 _0x1279=['describe','/:id','/:id/members','/:id/messages','getMessages','post','addMessage','put','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1279,0x109));var _0x9127=function(_0x3ebb86,_0x2a43bb){_0x3ebb86=_0x3ebb86-0x0;var _0x4aa035=_0x1279[_0x3ebb86];return _0x4aa035;};'use strict';var multer=require(_0x9127('0x0'));var util=require('util');var path=require(_0x9127('0x1'));var timeout=require(_0x9127('0x2'));var express=require(_0x9127('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9127('0x4'));var interaction=require(_0x9127('0x5'));var config=require(_0x9127('0x6'));var controller=require(_0x9127('0x7'));router[_0x9127('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9127('0x8')](_0x9127('0x9'),auth[_0x9127('0xa')](),controller[_0x9127('0xb')]);router[_0x9127('0x8')](_0x9127('0xc'),auth[_0x9127('0xa')](),controller['show']);router[_0x9127('0x8')]('/:id/unread',auth[_0x9127('0xa')](),controller['getUnread']);router[_0x9127('0x8')](_0x9127('0xd'),auth[_0x9127('0xa')](),controller['getMembers']);router[_0x9127('0x8')](_0x9127('0xe'),auth[_0x9127('0xa')](),controller[_0x9127('0xf')]);router[_0x9127('0x10')]('/',auth[_0x9127('0xa')](),controller['create']);router[_0x9127('0x10')](_0x9127('0xd'),auth['isAuthenticated'](),controller['addMembers']);router['post']('/:id/messages',auth[_0x9127('0xa')](),controller[_0x9127('0x11')]);router[_0x9127('0x12')](_0x9127('0xc'),auth[_0x9127('0xa')](),controller['update']);router[_0x9127('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9127('0x14')]);router[_0x9127('0x13')](_0x9127('0xd'),auth[_0x9127('0xa')](),controller[_0x9127('0x15')]);module[_0x9127('0x16')]=router; \ No newline at end of file +var _0xf7e0=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','delete','removeMembers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller'];(function(_0x34bb44,_0x347cf6){var _0x5edef3=function(_0x2005cd){while(--_0x2005cd){_0x34bb44['push'](_0x34bb44['shift']());}};_0x5edef3(++_0x347cf6);}(_0xf7e0,0x156));var _0x0f7e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf7e0[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x0f7e('0x0'));var util=require(_0x0f7e('0x1'));var path=require(_0x0f7e('0x2'));var timeout=require(_0x0f7e('0x3'));var express=require(_0x0f7e('0x4'));var router=express['Router']();var fs_extra=require(_0x0f7e('0x5'));var auth=require(_0x0f7e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0f7e('0x7'));var controller=require(_0x0f7e('0x8'));router[_0x0f7e('0x9')]('/',auth[_0x0f7e('0xa')](),controller[_0x0f7e('0xb')]);router[_0x0f7e('0x9')](_0x0f7e('0xc'),auth[_0x0f7e('0xa')](),controller[_0x0f7e('0xd')]);router['get'](_0x0f7e('0xe'),auth[_0x0f7e('0xa')](),controller[_0x0f7e('0xf')]);router[_0x0f7e('0x9')](_0x0f7e('0x10'),auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x11')]);router['get'](_0x0f7e('0x12'),auth[_0x0f7e('0xa')](),controller['getMembers']);router['get'](_0x0f7e('0x13'),auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x14')]);router[_0x0f7e('0x15')]('/',auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x16')]);router[_0x0f7e('0x15')]('/:id/members',auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x17')]);router[_0x0f7e('0x15')]('/:id/messages',auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x18')]);router['put'](_0x0f7e('0xe'),auth[_0x0f7e('0xa')](),controller['update']);router[_0x0f7e('0x19')](_0x0f7e('0xe'),auth[_0x0f7e('0xa')](),controller['destroy']);router[_0x0f7e('0x19')](_0x0f7e('0x12'),auth[_0x0f7e('0xa')](),controller[_0x0f7e('0x1a')]);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 4495afc..0f3127a 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 _0xc04a=['long','out','sequelize','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3d335f,_0x3eaa9b){var _0x37ca99=function(_0x2b9c30){while(--_0x2b9c30){_0x3d335f['push'](_0x3d335f['shift']());}};_0x37ca99(++_0x3eaa9b);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'closed':{'type':Sequelize[_0xac04('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xac04('0x2')](_0xac04('0x3'),_0xac04('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xac04('0x5')]},'pathTranscript':{'type':Sequelize[_0xac04('0x5')]},'mailTranscript':{'type':Sequelize[_0xac04('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xac04('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xac04('0x6')]},'browserVersion':{'type':Sequelize[_0xac04('0x6')]},'osName':{'type':Sequelize[_0xac04('0x6')]},'osVersion':{'type':Sequelize[_0xac04('0x6')]},'deviceModel':{'type':Sequelize[_0xac04('0x6')]},'deviceVendor':{'type':Sequelize[_0xac04('0x6')]},'deviceType':{'type':Sequelize[_0xac04('0x6')]},'referer':{'type':Sequelize[_0xac04('0x5')]},'customerIp':{'type':Sequelize[_0xac04('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xac04('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xac04('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xac04('0x2')]('in',_0xac04('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6f2f=['star','TEXT','STRING','long','DATE','BOOLEAN','sequelize','exports'];(function(_0xaf38cd,_0x5ac81c){var _0x582c91=function(_0x5bdb17){while(--_0x5bdb17){_0xaf38cd['push'](_0xaf38cd['shift']());}};_0x582c91(++_0x5ac81c);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6f2f[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xf6f2('0x2'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf6f2('0x3')]},'pathTranscript':{'type':Sequelize[_0xf6f2('0x3')]},'mailTranscript':{'type':Sequelize[_0xf6f2('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf6f2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf6f2('0x4')]},'note':{'type':Sequelize[_0xf6f2('0x4')]},'browserName':{'type':Sequelize[_0xf6f2('0x4')]},'browserVersion':{'type':Sequelize[_0xf6f2('0x4')]},'osName':{'type':Sequelize[_0xf6f2('0x4')]},'osVersion':{'type':Sequelize[_0xf6f2('0x4')]},'deviceModel':{'type':Sequelize[_0xf6f2('0x4')]},'deviceVendor':{'type':Sequelize[_0xf6f2('0x4')]},'deviceType':{'type':Sequelize[_0xf6f2('0x4')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf6f2('0x4')]},'formData':{'type':Sequelize[_0xf6f2('0x3')](_0xf6f2('0x5'))},'read1stAt':{'type':Sequelize[_0xf6f2('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf6f2('0x4')]},'customerPort':{'type':Sequelize[_0xf6f2('0x4')]},'vidaooSessionId':{'type':Sequelize[_0xf6f2('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xf6f2('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 467d650..1bff8f8 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 _0x28b8=['metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','User','ChatWebsiteId','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','intersection','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','rawAttributes','push','findAll','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','Account','Owner','mkdirSync','Chat','N.A.','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','firstName','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','fieldName','type','key','chat','query','user','catch','show','params','ChatInteraction','filters','model','fields','attributes','length','includeAll','include','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','parse'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x28b8,0x7b));var _0x828b=function(_0x4b26b8,_0x58ba76){_0x4b26b8=_0x4b26b8-0x0;var _0x53e56e=_0x28b8[_0x4b26b8];return _0x53e56e;};'use strict';var rimraf=require(_0x828b('0x0'));var zipdir=require('zip-dir');var rp=require(_0x828b('0x1'));var moment=require(_0x828b('0x2'));var BPromise=require(_0x828b('0x3'));var Mustache=require(_0x828b('0x4'));var util=require(_0x828b('0x5'));var path=require('path');var ejs=require(_0x828b('0x6'));var fs=require('fs');var _=require(_0x828b('0x7'));var Redis=require(_0x828b('0x8'));var interaction=require(_0x828b('0x9'));var qs=require(_0x828b('0xa'));var pdf=require(_0x828b('0xb'));var logger=require(_0x828b('0xc'))(_0x828b('0xd'));var config=require(_0x828b('0xe'));var db=require(_0x828b('0xf'))['db'];config[_0x828b('0x10')]=_[_0x828b('0x11')](config[_0x828b('0x10')],{'host':_0x828b('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x828b('0x10')]));require(_0x828b('0x13'))[_0x828b('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0x828b('0x15')][_0x828b('0x16')]({'port':0x232b});var client9004=jayson[_0x828b('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x447837,_0x21cbba,_0x522efa,_0xbbafed){return new BPromise(function(_0x15b577,_0xaca5b1){var _0x5d2d05=_0xbbafed||client;return _0x5d2d05[_0x828b('0x17')](_0x447837,_0x522efa)[_0x828b('0x18')](function(_0x333715){logger[_0x828b('0x19')](_0x828b('0x1a'),_0x21cbba,'request\x20sent');logger[_0x828b('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21cbba,_0x828b('0x1c'),JSON[_0x828b('0x1d')](_0x333715));if(_0x333715[_0x828b('0x1e')]){if(_0x333715[_0x828b('0x1e')][_0x828b('0x1f')]===0x1f4){logger['error'](_0x828b('0x1a'),_0x21cbba,_0x333715[_0x828b('0x1e')]['message']);return _0xaca5b1(_0x333715[_0x828b('0x1e')][_0x828b('0x20')]);}logger[_0x828b('0x1e')](_0x828b('0x1a'),_0x21cbba,_0x333715[_0x828b('0x1e')][_0x828b('0x20')]);return _0x15b577(_0x333715[_0x828b('0x1e')]['message']);}else{logger[_0x828b('0x19')](_0x828b('0x1a'),_0x21cbba,_0x828b('0x1c'));_0x15b577(_0x333715['result']['message']);}})['catch'](function(_0x15a66f){logger['error'](_0x828b('0x1a'),_0x21cbba,_0x15a66f);_0xaca5b1(_0x15a66f);});});}function respondWithStatusCode(_0x1ff8f7,_0x1a6f7b){_0x1a6f7b=_0x1a6f7b||0xcc;return function(_0x3820ee){if(_0x3820ee){return _0x1ff8f7[_0x828b('0x21')](_0x1a6f7b);}return _0x1ff8f7[_0x828b('0x22')](_0x1a6f7b)[_0x828b('0x23')]();};}function respondWithResult(_0x4d728e,_0x3a18c7){_0x3a18c7=_0x3a18c7||0xc8;return function(_0x3b1a1f){if(_0x3b1a1f){return _0x4d728e[_0x828b('0x22')](_0x3a18c7)[_0x828b('0x24')](_0x3b1a1f);}};}function respondWithFilteredResult(_0x115802,_0x377a12){return function(_0x38fc8b){if(_0x38fc8b){var _0x58a40d=typeof _0x377a12[_0x828b('0x25')]==='undefined'&&typeof _0x377a12['limit']===_0x828b('0x26');var _0x3ea9e9=_0x38fc8b[_0x828b('0x27')];var _0x59d00f=_0x58a40d?0x0:_0x377a12[_0x828b('0x25')];var _0x16201c=_0x58a40d?_0x38fc8b[_0x828b('0x27')]:_0x377a12[_0x828b('0x25')]+_0x377a12[_0x828b('0x28')];var _0x303178;if(_0x16201c>=_0x3ea9e9){_0x16201c=_0x3ea9e9;_0x303178=0xc8;}else{_0x303178=0xce;}_0x115802[_0x828b('0x22')](_0x303178);return _0x115802[_0x828b('0x29')](_0x828b('0x2a'),_0x59d00f+'-'+_0x16201c+'/'+_0x3ea9e9)[_0x828b('0x24')](_0x38fc8b);}return null;};}function saveUpdates(_0x242ef7){return function(_0x285a9e){if(_0x285a9e){return _0x285a9e[_0x828b('0x2b')](_0x242ef7)[_0x828b('0x18')](function(_0x155f5c){return _0x155f5c;});}return null;};}function removeEntity(_0x211eb5){return function(_0x55df65){if(_0x55df65){return _0x55df65[_0x828b('0x2c')]()['then'](function(){_0x211eb5[_0x828b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7030){return function(_0x2985a6){if(!_0x2985a6){_0x4a7030[_0x828b('0x21')](0x194);}return _0x2985a6;};}function handleError(_0xb92005,_0x4d93a7){_0x4d93a7=_0x4d93a7||0x1f4;return function(_0x24f749){logger[_0x828b('0x1e')](_0x24f749[_0x828b('0x2d')]);if(_0x24f749[_0x828b('0x2e')]){delete _0x24f749[_0x828b('0x2e')];}_0xb92005[_0x828b('0x22')](_0x4d93a7)[_0x828b('0x2f')](_0x24f749);};}function getMustacheRender(_0x2f41ef,_0x107ea7){return Mustache[_0x828b('0x30')](_0x2f41ef,_[_0x828b('0x31')](_0x107ea7['body'],{'contact':_0x107ea7[_0x828b('0x32')],'message':_0x107ea7[_0x828b('0x20')],'agent':_0x107ea7[_0x828b('0x33')],'interaction':_0x107ea7[_0x828b('0x34')],'account':_0x107ea7[_0x828b('0x35')]}))||'';}exports[_0x828b('0x36')]=function(_0x58ad43,_0x549df3){var _0x215261={};var _0x1c10fb=_[_0x828b('0x37')](db['ChatInteraction']['rawAttributes'],function(_0x3b13ee){return{'name':_0x3b13ee[_0x828b('0x38')],'type':_0x3b13ee[_0x828b('0x39')][_0x828b('0x3a')]};});_0x215261=qs['getOptions'](_0x1c10fb,_0x58ad43);return interaction['findAll'](_0x828b('0x3b'),_0x58ad43[_0x828b('0x3c')],_0x58ad43[_0x828b('0x3d')],_0x215261,_0x1c10fb)['then'](respondWithFilteredResult(_0x549df3,_0x215261))[_0x828b('0x3e')](handleError(_0x549df3,null));};exports[_0x828b('0x3f')]=function(_0x26ea43,_0x233943){var _0x163f14={'raw':![],'where':{'id':_0x26ea43[_0x828b('0x40')]['id']}},_0x174174={};_0x174174['model']=_['keys'](db[_0x828b('0x41')]['rawAttributes']);_0x174174[_0x828b('0x3c')]=_['keys'](_0x26ea43['query']);_0x174174[_0x828b('0x42')]=_['intersection'](_0x174174[_0x828b('0x43')],_0x174174['query']);_0x163f14['attributes']=_['intersection'](_0x174174[_0x828b('0x43')],qs['fields'](_0x26ea43['query'][_0x828b('0x44')]));_0x163f14[_0x828b('0x45')]=_0x163f14[_0x828b('0x45')][_0x828b('0x46')]?_0x163f14[_0x828b('0x45')]:_0x174174[_0x828b('0x43')];if(_0x26ea43['query'][_0x828b('0x47')]){_0x163f14[_0x828b('0x48')]=[{'all':!![]}];}_0x163f14=_[_0x828b('0x31')]({},_0x163f14,_0x26ea43['options']);return db[_0x828b('0x41')][_0x828b('0x49')](_0x163f14)['then'](handleEntityNotFound(_0x233943,null))[_0x828b('0x18')](respondWithResult(_0x233943,null))['catch'](handleError(_0x233943,null));};exports['create']=function(_0x8f5805,_0x38e236){return db[_0x828b('0x41')][_0x828b('0x4a')](_0x8f5805['body'],{})[_0x828b('0x18')](respondWithResult(_0x38e236,0xc9))['catch'](handleError(_0x38e236,null));};exports[_0x828b('0x2b')]=function(_0x2b5de6,_0x446097){if(_0x2b5de6[_0x828b('0x4b')]['id']){delete _0x2b5de6[_0x828b('0x4b')]['id'];}return db[_0x828b('0x41')][_0x828b('0x49')]({'where':{'id':_0x2b5de6[_0x828b('0x40')]['id']}})[_0x828b('0x18')](handleEntityNotFound(_0x446097,null))[_0x828b('0x18')](saveUpdates(_0x2b5de6[_0x828b('0x4b')],null))[_0x828b('0x18')](respondWithResult(_0x446097,null))[_0x828b('0x3e')](handleError(_0x446097,null));};exports['destroy']=function(_0x4005cd,_0x396f80){return db[_0x828b('0x41')][_0x828b('0x49')]({'where':{'id':_0x4005cd[_0x828b('0x40')]['id']}})[_0x828b('0x18')](handleEntityNotFound(_0x396f80,null))['then'](removeEntity(_0x396f80,null))[_0x828b('0x3e')](handleError(_0x396f80,null));};exports[_0x828b('0x4c')]=function(_0x396b47,_0x51026e){return db[_0x828b('0x41')][_0x828b('0x4c')]()['then'](respondWithResult(_0x51026e,null))['catch'](handleError(_0x51026e,null));};exports[_0x828b('0x4d')]=function(_0x1e694e,_0x433570){var _0x291afe=_0x1e694e[_0x828b('0x40')]['id'];var _0x1f7309;var _0x5b5031;var _0x217096;return db[_0x828b('0x41')][_0x828b('0x4e')]({'where':{'id':_0x291afe}})[_0x828b('0x18')](function(_0x30374c){_0x1f7309=_0x30374c;return db[_0x828b('0x4f')][_0x828b('0x4e')]({'where':{'id':_0x30374c['ChatWebsiteId']},'attributes':['id',_0x828b('0x50'),_0x828b('0x51'),'vidaooTopic',_0x828b('0x52'),_0x828b('0x53')],'raw':!![]});})[_0x828b('0x18')](function(_0x3fb086){if(_0x3fb086&&_0x3fb086[_0x828b('0x50')]&&_0x3fb086[_0x828b('0x51')]){_0x5b5031=_0x3fb086;var _0x18609a={'interaction':{'id':_0x291afe},'agent':{'id':_0x1e694e[_0x828b('0x3d')]['id'],'name':_0x1e694e[_0x828b('0x3d')]['name'],'fullname':_0x1e694e[_0x828b('0x3d')][_0x828b('0x54')],'email':_0x1e694e['user'][_0x828b('0x55')]},'contact':_0x1e694e[_0x828b('0x4b')][_0x828b('0x32')],'account':_0x1e694e[_0x828b('0x4b')][_0x828b('0x35')]};var _0x209c90={'rejectUnauthorized':![],'method':_0x828b('0x56'),'url':_0x828b('0x57'),'headers':{'X-APIKEY':_0x3fb086[_0x828b('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1e694e['user'][_0x828b('0x55')]],'buttons':null,'topic':_0x5b5031[_0x828b('0x58')],'note':_['isNull'](_0x5b5031[_0x828b('0x52')])?null:getMustacheRender(_0x5b5031[_0x828b('0x52')],_0x18609a),'metadata':null},'redirect':_0x828b('0x59'),'json':!![]};try{if(!_[_0x828b('0x5a')](_0x5b5031[_0x828b('0x53')])){var _0x5d9b02=getMustacheRender(_0x5b5031[_0x828b('0x53')],_0x18609a);var _0x1ee328=JSON[_0x828b('0x5b')](_0x5d9b02);_0x209c90[_0x828b('0x4b')][_0x828b('0x5c')]=_0x1ee328;}}catch(_0xc821cb){throw new db[(_0x828b('0x5d'))][(_0x828b('0x5e'))](_0x828b('0x5f'));}return rp(_0x209c90);}else{throw new db[(_0x828b('0x5d'))][(_0x828b('0x5e'))](_0x828b('0x60'));}})[_0x828b('0x18')](function(_0x1f9a1e){_0x217096=_0x1f9a1e;if(_0x217096['id']){var _0x2fe400={'body':_0x217096[_0x828b('0x61')],'ChatWebsiteId':_0x5b5031['id'],'ChatInteractionId':_0x1f7309['id'],'direction':'out','UserId':_0x1e694e['user']['id']};return db[_0x828b('0x62')][_0x828b('0x4a')](_0x2fe400,{});}else{throw new db['Sequelize']['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1f7309[_0x828b('0x63')]({'vidaooSessionId':_0x217096['id']});})[_0x828b('0x18')](respondWithResult(_0x433570,null))[_0x828b('0x3e')](handleError(_0x433570,null));};exports[_0x828b('0x64')]=function(_0x1dc31c,_0x4f4487){if(_0x1dc31c[_0x828b('0x4b')]['id']){delete _0x1dc31c[_0x828b('0x4b')]['id'];}return db[_0x828b('0x41')][_0x828b('0x49')]({'where':{'id':_0x1dc31c[_0x828b('0x40')]['id']},'include':[{'model':db['CmContact'],'as':_0x828b('0x65')}]})['then'](handleEntityNotFound(_0x4f4487,null))[_0x828b('0x18')](saveUpdates(_0x1dc31c[_0x828b('0x4b')],null))['then'](respondWithResult(_0x4f4487,null))[_0x828b('0x3e')](handleError(_0x4f4487,null));};exports['abandon']=function(_0x147799,_0xe8a7c1){if(_0x147799[_0x828b('0x4b')]['id']){delete _0x147799[_0x828b('0x4b')]['id'];}return db[_0x828b('0x41')]['find']({'where':{'id':_0x147799['params']['id']}})[_0x828b('0x18')](function(_0x4e8eb0){if(!_0x4e8eb0){logger['error'](_0x828b('0x66'),'abandon',0x194,_0x828b('0x67'));_0xe8a7c1[_0x828b('0x21')](0x194);}else{if(_0x4e8eb0[_0x828b('0x68')]){throw new db[(_0x828b('0x5d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x4e8eb0;})[_0x828b('0x18')](function(_0x214dfa){if(_0x214dfa){return _0x214dfa['update']({'closed':_0x147799[_0x828b('0x4b')][_0x828b('0x69')],'disposition':_0x147799[_0x828b('0x4b')][_0x828b('0x6a')]})['then'](function(_0x138426){return _0x138426;});}})[_0x828b('0x18')](function(){return respondWithRpcPromise(_0x828b('0x6b'),_0x828b('0x6c'),_0x147799[_0x828b('0x4b')],client9004);})[_0x828b('0x18')](respondWithResult(_0xe8a7c1,null))[_0x828b('0x3e')](handleError(_0xe8a7c1,null));};exports[_0x828b('0x6d')]=function(_0xa71a95,_0x56836d){_0xa71a95['body'][_0x828b('0x2e')]=_0xa71a95[_0x828b('0x6e')][_0x828b('0x6f')];_0xa71a95['body']['basename']=_0xa71a95[_0x828b('0x6e')][_0x828b('0x70')];_0xa71a95[_0x828b('0x4b')]['type']=_0xa71a95[_0x828b('0x6e')][_0x828b('0x71')];return db[_0x828b('0x72')][_0x828b('0x4a')](_0xa71a95[_0x828b('0x4b')])['then'](respondWithResult(_0x56836d,0xc9))['catch'](handleError(_0x56836d,null));};exports[_0x828b('0x73')]=function(_0x5b1488,_0x50c2f4){return db[_0x828b('0x41')][_0x828b('0x4e')]({'where':{'id':_0x5b1488[_0x828b('0x40')]['id']},'raw':!![]})[_0x828b('0x18')](handleEntityNotFound(_0x50c2f4,null))['then'](function(_0x3308f7){if(_0x3308f7){if(_0x3308f7['closed']){return _0x50c2f4['status'](0x193)[_0x828b('0x24')]({'status':0x193,'message':_0x828b('0x74')});}return db[_0x828b('0x72')][_0x828b('0x4e')]({'where':{'id':_0x5b1488[_0x828b('0x3c')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x50c2f4,null));}})[_0x828b('0x18')](function(_0x30e1d6){if(_0x30e1d6){var _0x541e5f=_0x30e1d6[_0x828b('0x75')]!==null;var _0x39a950=path[_0x828b('0x76')](config[_0x828b('0x77')],_0x828b('0x78'));if(_0x541e5f){_0x39a950=path[_0x828b('0x76')](_0x39a950,_0x828b('0x79'));}var _0x7f5967=path[_0x828b('0x76')](_0x39a950,_0x30e1d6[_0x828b('0x7a')]);return _0x50c2f4[_0x828b('0x7b')](_0x7f5967);}})[_0x828b('0x3e')](handleError(_0x50c2f4,null));};exports['close']=function(_0x883bd5,_0x55388d){var _0x43fe79=null;var _0x3899d9=null;var _0x261e89=null;if(_0x883bd5[_0x828b('0x4b')]['id']){delete _0x883bd5[_0x828b('0x4b')]['id'];}if(_0x883bd5[_0x828b('0x4b')][_0x828b('0x7c')]){_0x261e89=path['join'](config[_0x828b('0x77')],_0x828b('0x7d'),util[_0x828b('0x7e')](_0x828b('0x7f'),Date[_0x828b('0x80')]()));_0x883bd5[_0x828b('0x4b')]['pathTranscript']=_0x261e89;}return db['ChatInteraction'][_0x828b('0x49')]({'where':{'id':_0x883bd5[_0x828b('0x40')]['id']},'include':[{'model':db[_0x828b('0x62')],'as':'Messages','include':[{'model':db[_0x828b('0x81')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x55388d,null))[_0x828b('0x18')](saveUpdates(_0x883bd5[_0x828b('0x4b')],null))[_0x828b('0x18')](function(_0x4ab6a2){if(_0x4ab6a2){_0x43fe79=_0x4ab6a2;return db[_0x828b('0x4f')][_0x828b('0x49')]({'where':{'id':_0x43fe79[_0x828b('0x82')]}});}})['then'](function(_0x6f2729){if(_0x6f2729){_0x3899d9=_0x6f2729;return db['CmContact'][_0x828b('0x49')]({'where':{'id':_0x43fe79[_0x828b('0x83')]}});}})['then'](function(_0x35da8f){if(_0x35da8f){if(_0x261e89){var _0x15abcf=null;for(var _0x439c67=0x1;_0x439c67<_0x43fe79[_0x828b('0x84')][_0x828b('0x46')];++_0x439c67){_0x15abcf=_0x43fe79[_0x828b('0x84')][_0x439c67];var _0x1ce91b=_0x15abcf[_0x828b('0x68')]?util['format'](_0x828b('0x85'),_0x3899d9[_0x828b('0x86')],_0x15abcf[_0x828b('0x68')]):_0x828b('0x87');var _0x3a4337=_0x883bd5['body'][_0x828b('0x88')]||util['format']('%s%d',_0x828b('0x89'),_0x15abcf[_0x828b('0x83')]);switch(_0x3899d9[_0x828b('0x8a')]){case'website_alias':_0x1ce91b=_0x15abcf[_0x828b('0x68')]?util[_0x828b('0x7e')]('%s%d',_0x3899d9[_0x828b('0x86')],_0x15abcf[_0x828b('0x68')]):_0x828b('0x87');break;case _0x828b('0x8b'):_0x1ce91b=_0x15abcf[_0x828b('0x68')]?_0x15abcf['User'][_0x828b('0x8c')]||_0x15abcf[_0x828b('0x81')]['fullname']:_0x828b('0x87');break;case _0x828b('0x8d'):_0x1ce91b=_0x15abcf['UserId']?_0x15abcf[_0x828b('0x81')]['fullname']:_0x828b('0x87');break;default:_0x1ce91b=_0x15abcf['UserId']?util['format'](_0x828b('0x85'),_0x3899d9['agentAlias'],_0x15abcf[_0x828b('0x68')]):_0x828b('0x87');}var _0x2bbce9=util['format'](_0x828b('0x8e'),moment(_0x15abcf[_0x828b('0x8f')])[_0x828b('0x7e')]('MM/DD/YYYY\x20HH:mm:ss'),_0x15abcf[_0x828b('0x90')]==='in'?_0x3a4337:_0x1ce91b,_0x15abcf[_0x828b('0x4b')]);if(!_0x15abcf[_0x828b('0x91')]){fs['appendFileSync'](_0x261e89,_0x2bbce9);}}return db[_0x828b('0x92')][_0x828b('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0x828b('0x93')],'as':_0x828b('0x94'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x828b('0x95'),'raw':!![]}]}]});}}})[_0x828b('0x18')](function(_0x5565cd){if(!_0x5565cd||!_0x5565cd[_0x828b('0x94')]||!_0x883bd5[_0x828b('0x4b')])return _0x43fe79;var _0x2dd3ea=_0x5565cd['getSmtpOptions']();return respondWithRpcPromise(_0x828b('0x96'),_0x828b('0x97'),{'account':_0x2dd3ea,'message':{'from':util[_0x828b('0x7e')](_0x828b('0x98'),_0x5565cd[_0x828b('0x2e')],_0x5565cd[_0x828b('0x55')]||_0x5565cd[_0x828b('0x94')][_0x828b('0x3d')]),'to':_0x883bd5['body']['mailTranscript'],'subject':_0x828b('0x99'),'text':util['format'](_0x828b('0x9a'),_0x883bd5['body'][_0x828b('0x7c')]),'attachments':[{'path':_0x261e89}]}})[_0x828b('0x18')](function(){return _0x43fe79;})[_0x828b('0x3e')](function(_0x3ebf74){logger[_0x828b('0x1e')](_0x3ebf74);});})['then'](respondWithStatusCode(_0x55388d,0xc8))['catch'](handleError(_0x55388d,null));};exports[_0x828b('0x9b')]=function(_0x5ecc2a,_0x291398){return db[_0x828b('0x62')][_0x828b('0x49')]({'where':{'id':_0x5ecc2a['params']['id']}})['then'](handleEntityNotFound(_0x291398,null))[_0x828b('0x18')](function(_0x2d9f98){if(_0x2d9f98){return _0x2d9f98['addMessage'](_0x5ecc2a[_0x828b('0x4b')][_0x828b('0x9c')],_[_0x828b('0x9d')](_0x5ecc2a[_0x828b('0x4b')],[_0x828b('0x9c'),'id'])||{});}})[_0x828b('0x18')](respondWithResult(_0x291398,null))['catch'](handleError(_0x291398,null));};exports[_0x828b('0x9e')]=function(_0x48b50a,_0x75c05d){var _0x46324b={'raw':![],'where':{}};var _0x515183={};var _0x3bd944={'count':0x0,'rows':[]};return db[_0x828b('0x41')][_0x828b('0x4e')]({'where':{'id':_0x48b50a['params']['id']}})[_0x828b('0x18')](handleEntityNotFound(_0x75c05d,null))[_0x828b('0x18')](function(_0x48528f){if(_0x48528f){_0x515183[_0x828b('0x43')]=_[_0x828b('0x9f')](db['ChatMessage']['rawAttributes']);_0x515183[_0x828b('0x3c')]=_['keys'](_0x48b50a['query']);_0x515183['filters']=_[_0x828b('0xa0')](_0x515183['model'],_0x515183[_0x828b('0x3c')]);_0x46324b['attributes']=_['intersection'](_0x515183[_0x828b('0x43')],qs[_0x828b('0x44')](_0x48b50a[_0x828b('0x3c')][_0x828b('0x44')]));_0x46324b[_0x828b('0x45')]=_0x46324b['attributes']['length']?_0x46324b['attributes']:_0x515183[_0x828b('0x43')];if(!_0x48b50a['query'][_0x828b('0xa1')](_0x828b('0xa2'))){_0x46324b[_0x828b('0x28')]=qs[_0x828b('0x28')](_0x48b50a[_0x828b('0x3c')][_0x828b('0x28')]);_0x46324b[_0x828b('0x25')]=qs[_0x828b('0x25')](_0x48b50a['query']['offset']);}_0x46324b[_0x828b('0xa3')]=qs['sort'](_0x48b50a['query'][_0x828b('0xa4')]);_0x46324b['where']=qs[_0x828b('0x42')](_[_0x828b('0xa5')](_0x48b50a[_0x828b('0x3c')],_0x515183[_0x828b('0x42')]));_0x46324b[_0x828b('0xa6')][_0x828b('0xa7')]=_0x48528f['id'];if(_0x48b50a[_0x828b('0x3c')]['filter']){_0x46324b[_0x828b('0xa6')]=_['merge'](_0x46324b[_0x828b('0xa6')],{'$or':_[_0x828b('0x37')](_0x46324b['attributes'],function(_0x2dcc9a){var _0x45fc96={};_0x45fc96[_0x2dcc9a]={'$like':'%'+_0x48b50a[_0x828b('0x3c')][_0x828b('0xa8')]+'%'};return _0x45fc96;})});}if(_0x48b50a['query']['$gte']){var _0x13d300=_0x48b50a[_0x828b('0x3c')][_0x828b('0xa9')][_0x828b('0xaa')](',');var _0x46a015={};_0x46a015[_0x13d300[0x0]]={'$gte':moment(_0x13d300[0x1])['format'](_0x828b('0xab'))};_0x46324b[_0x828b('0xa6')]=_['merge'](_0x46324b[_0x828b('0xa6')],_0x46a015);}_0x46324b=_[_0x828b('0x31')]({},_0x46324b,_0x48b50a[_0x828b('0xac')]);return db[_0x828b('0x62')][_0x828b('0x27')]({'where':_0x46324b['where']})[_0x828b('0x18')](function(_0x37fb16){_0x3bd944['count']=_0x37fb16;if(_0x48b50a[_0x828b('0x3c')][_0x828b('0x47')]){_0x46324b[_0x828b('0x48')]=[{'all':!![]}];}return db[_0x828b('0x62')]['findAll'](_0x46324b);})['then'](function(_0x2ebcef){_0x3bd944[_0x828b('0xad')]=_0x2ebcef;return _0x3bd944;});}})[_0x828b('0x18')](respondWithFilteredResult(_0x75c05d,_0x46324b))['catch'](handleError(_0x75c05d,null));};exports['getMyMessages']=function(_0x434d62,_0x17bb2b){var _0x24136d={'where':{}},_0x2d8d13={},_0x463d4c={'count':0x0,'rows':[]};return db[_0x828b('0x41')][_0x828b('0x4e')]({'where':{'id':_0x434d62[_0x828b('0x40')]['id']}})['then'](handleEntityNotFound(_0x17bb2b,null))['then'](function(_0x1913e6){if(_0x1913e6){_0x2d8d13[_0x828b('0x43')]=_[_0x828b('0x9f')](db['ChatMessage'][_0x828b('0xae')]);_0x2d8d13[_0x828b('0x3c')]=_[_0x828b('0x9f')](_0x434d62[_0x828b('0x3c')]);_0x2d8d13['filters']=_[_0x828b('0xa0')](_0x2d8d13['model'],_0x2d8d13[_0x828b('0x3c')]);_0x24136d[_0x828b('0x45')]=_[_0x828b('0xa0')](_0x2d8d13[_0x828b('0x43')],qs['fields'](_0x434d62[_0x828b('0x3c')][_0x828b('0x44')]));_0x24136d['attributes']=_0x24136d[_0x828b('0x45')][_0x828b('0x46')]?_0x24136d['attributes']:_0x2d8d13[_0x828b('0x43')];if(!_0x434d62[_0x828b('0x3c')][_0x828b('0xa1')]('nolimit')){_0x24136d[_0x828b('0x28')]=qs[_0x828b('0x28')](_0x434d62['query'][_0x828b('0x28')]);_0x24136d[_0x828b('0x25')]=qs['offset'](_0x434d62['query'][_0x828b('0x25')]);}_0x24136d[_0x828b('0xa3')]=qs[_0x828b('0xa4')](_0x434d62['query'][_0x828b('0xa4')]);_0x24136d[_0x828b('0xa6')]=qs[_0x828b('0x42')](_['pick'](_0x434d62[_0x828b('0x3c')],_0x2d8d13[_0x828b('0x42')]));_0x24136d[_0x828b('0xa6')][_0x828b('0xa7')]=_0x1913e6['id'];if(_0x434d62[_0x828b('0x3c')][_0x828b('0xa8')]){_0x24136d['where']=_[_0x828b('0x31')](_0x24136d[_0x828b('0xa6')],{'$or':_['map'](_0x24136d[_0x828b('0x45')],function(_0xaaf17b){var _0x56f3bc={};_0x56f3bc[_0xaaf17b]={'$like':'%'+_0x434d62['query'][_0x828b('0xa8')]+'%'};return _0x56f3bc;})});}_0x24136d[_0x828b('0xa6')]['secret']=![];if(_0x434d62[_0x828b('0x3c')]['id']){_0x24136d['where']['id']={'$gt':_0x434d62['query']['id']};}_0x24136d=_[_0x828b('0x31')]({},_0x24136d,_0x434d62[_0x828b('0xac')]);return db[_0x828b('0x62')][_0x828b('0x27')]({'where':_0x24136d[_0x828b('0xa6')]})[_0x828b('0x18')](function(_0x1d049c){_0x463d4c[_0x828b('0x27')]=_0x1d049c;_0x24136d['include']=[];if(_0x434d62[_0x828b('0x3c')]['includeAgent']){_0x24136d[_0x828b('0x48')][_0x828b('0xaf')]({'model':db[_0x828b('0x81')],'as':'User','attributes':['id',_0x828b('0x54'),_0x828b('0x8c')]});}if(_0x434d62['query']['includeAll']){_0x24136d[_0x828b('0x48')]=[{'all':!![]}];}return db[_0x828b('0x62')][_0x828b('0xb0')](_0x24136d);})[_0x828b('0x18')](function(_0x49c011){_0x463d4c['rows']=_0x49c011;return _0x463d4c;});}})[_0x828b('0x18')](respondWithFilteredResult(_0x17bb2b,_0x24136d))[_0x828b('0x3e')](handleError(_0x17bb2b,null));};exports[_0x828b('0xb1')]=function(_0x254601,_0x29143f){return db['ChatInteraction'][_0x828b('0x49')]({'where':{'id':_0x254601[_0x828b('0x40')]['id']}})[_0x828b('0x18')](handleEntityNotFound(_0x29143f,null))[_0x828b('0x18')](function(_0x40f098){if(_0x40f098){return _0x40f098[_0x828b('0xb2')](_0x254601[_0x828b('0x4b')]['ids'],_['omit'](_0x254601[_0x828b('0x4b')],[_0x828b('0x9c'),'id'])||{})[_0x828b('0xb3')](function(){return db['Tag'][_0x828b('0xb0')]({'attributes':['id',_0x828b('0x2e'),_0x828b('0xb4')],'where':{'id':_0x254601[_0x828b('0x4b')][_0x828b('0x9c')]}});})[_0x828b('0x18')](function(_0x20e825){socket['emit'](_0x828b('0xb5'),{'id':Number(_0x254601[_0x828b('0x40')]['id']),'tags':_0x20e825||[]});return{'id':Number(_0x254601['params']['id']),'tags':_0x20e825||[]};});}})[_0x828b('0x18')](respondWithResult(_0x29143f,null))[_0x828b('0x3e')](handleError(_0x29143f,null));};exports[_0x828b('0xb6')]=function(_0x55fd59,_0x1b1378){return db['ChatInteraction'][_0x828b('0x49')]({'where':{'id':_0x55fd59[_0x828b('0x40')]['id']}})[_0x828b('0x18')](handleEntityNotFound(_0x1b1378,null))['then'](function(_0x32136){if(_0x32136){return _0x32136['removeTags'](_0x55fd59[_0x828b('0x3c')][_0x828b('0x9c')]);}})[_0x828b('0x18')](respondWithStatusCode(_0x1b1378,null))[_0x828b('0x3e')](handleError(_0x1b1378,null));};exports[_0x828b('0x7b')]=function(_0xd398e1,_0x24e353){var _0x3136df=moment()[_0x828b('0xb7')]()[_0x828b('0xb8')]();var _0x156b4e=path[_0x828b('0x76')](config[_0x828b('0x77')],_0x828b('0xb9'),'files',_0x828b('0xba'));var _0x86afb1=path['join'](config[_0x828b('0x77')],'server',_0x828b('0xbb'),_0x828b('0xbc'));var _0x56bdc6=path[_0x828b('0x76')](_0x156b4e,_0x3136df);var _0x42d255=util[_0x828b('0x7e')]('transcript-%d-%s.zip',_0xd398e1[_0x828b('0x40')]['id'],_0x3136df);var _0x45563d=path[_0x828b('0x76')](_0x156b4e,_0x42d255);var _0x2bd183=[];_0x2bd183[_0x828b('0xaf')]({'model':db[_0x828b('0x81')],'as':'User','attributes':['id',_0x828b('0x54')],'raw':!![]});_0x2bd183[_0x828b('0xaf')]({'model':db['CmContact'],'as':_0x828b('0x65'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0xd398e1['query'][_0x828b('0xbc')]){_0x2bd183['push']({'model':db[_0x828b('0x72')],'as':_0x828b('0x72'),'raw':!![]});}var _0x5365b0=[{'model':db[_0x828b('0x62')],'as':_0x828b('0x84'),'attributes':['id',_0x828b('0x4b'),_0x828b('0x8f'),_0x828b('0x90'),'secret','read'],'include':_0x2bd183}];_0x5365b0[_0x828b('0xaf')]({'model':db[_0x828b('0x4f')],'as':_0x828b('0xbd'),'attributes':['id',_0x828b('0x2e')]});_0x5365b0[_0x828b('0xaf')]({'model':db[_0x828b('0x81')],'as':_0x828b('0xbe'),'attributes':['id',_0x828b('0x54')]});return db['ChatInteraction']['find']({'where':{'id':_0xd398e1[_0x828b('0x40')]['id']},'include':_0x5365b0})[_0x828b('0x18')](handleEntityNotFound(_0x24e353,null))[_0x828b('0x18')](function(_0x4f7e63){if(_0x4f7e63){var _0x4bd302=_0x4f7e63['get']({'plain':!![]});fs[_0x828b('0xbf')](_0x56bdc6);var _0x3dd84d={'channel':_0x828b('0xc0'),'account':_0x4bd302['Account'][_0x828b('0x2e')],'agent':_0x4bd302[_0x828b('0xbe')]?_0x4bd302[_0x828b('0xbe')][_0x828b('0x54')]:_0x828b('0xc1'),'createdAt':moment(_0x4bd302['createdAt'])['format'](_0x828b('0xab'))[_0x828b('0xb8')](),'closedAt':_0x4bd302[_0x828b('0x69')]?moment(_0x4bd302['closedAt'])[_0x828b('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x828b('0xb8')]():'','disposition':_0x4bd302[_0x828b('0x6a')],'chatInfo':{'browser':_0x4bd302[_0x828b('0xc2')],'os':_0x4bd302[_0x828b('0xc3')],'referer':_0x4bd302[_0x828b('0xc4')],'customerIp':_0x4bd302['customerIp'],'customerPort':_0x4bd302[_0x828b('0xc5')]?_0x4bd302[_0x828b('0xc5')]:_0x828b('0xc1')},'messages':_(_0x4bd302[_0x828b('0x84')])[_0x828b('0xc6')]()[_0x828b('0xa8')]({'secret':![]})[_0x828b('0x37')](function(_0x1cb1d4){if(_0x1cb1d4[_0x828b('0x72')]){var _0x4cafb9=path[_0x828b('0x76')](_0x86afb1,_0x1cb1d4[_0x828b('0x72')][_0x828b('0x7a')]);if(fs[_0x828b('0xc7')](_0x4cafb9)){fs[_0x828b('0xc8')](_0x4cafb9)[_0x828b('0xc9')](fs[_0x828b('0xca')](path['join'](_0x56bdc6,_0x1cb1d4[_0x828b('0x72')][_0x828b('0x7a')])));}}return{'date':moment(_0x1cb1d4[_0x828b('0x8f')])[_0x828b('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1cb1d4[_0x828b('0x90')]===_0x828b('0xcb')?_0x1cb1d4[_0x828b('0x81')]?_0x1cb1d4[_0x828b('0x81')][_0x828b('0x54')]:_0x828b('0x87'):_0x1cb1d4[_0x828b('0x65')][_0x828b('0xcc')]+(_0x1cb1d4['Contact'][_0x828b('0xcd')]?'\x20'+_0x1cb1d4[_0x828b('0x65')][_0x828b('0xcd')]:''),'body':_0x1cb1d4['Attachment']?_0x1cb1d4[_0x828b('0x72')]['basename']:_0x1cb1d4[_0x828b('0x4b')],'direction':_0x1cb1d4['direction']===_0x828b('0xcb')?'A':'C','secret':_0x1cb1d4[_0x828b('0x91')],'read':_0x1cb1d4[_0x828b('0xce')],'attachment':_0x1cb1d4[_0x828b('0x72')]};})[_0x828b('0xcf')]()};return ejs[_0x828b('0xd0')](path[_0x828b('0x76')](config[_0x828b('0x77')],_0x828b('0xb9'),_0x828b('0xd1'),_0x828b('0xd2')),{'interaction':_0x3dd84d})[_0x828b('0x18')](function(_0x1f7d75){var _0x202e4a=path[_0x828b('0x76')](_0x56bdc6,_0x828b('0xd3')+_0x4bd302['id']+'-'+_0x3136df+_0x828b('0xd4'));var _0x427242={'path':_0x202e4a,'channel':_0x828b('0xc0'),'interactionId':_0x4bd302['id']};return pdf['createPdfFromHTML'](_0x1f7d75,_0x427242);})[_0x828b('0x18')](function(){return new Promise(function(_0x2a8e9c,_0x33827c){zipdir(_0x56bdc6,{'saveTo':_0x45563d},function(_0x3c754b,_0x2e5139){if(_0x3c754b)return _0x33827c(_0x3c754b);return _0x2a8e9c(_0x2e5139);});})[_0x828b('0x18')](function(){return new BPromise(function(_0x5161b3,_0xdea26f){rimraf(_0x56bdc6,function(_0x54f9a9){if(_0x54f9a9)_0xdea26f(_0x54f9a9);return _0x5161b3();});});})[_0x828b('0x18')](function(){return _0x24e353[_0x828b('0x7b')](_0x45563d,_0x42d255,function(_0x1e6629){if(_0x1e6629){logger['error'](_0x828b('0xd5'),_0x1e6629);}else{fs[_0x828b('0xd6')](_0x45563d);}});});});}else{return _0x24e353[_0x828b('0x21')](0xc8);}})[_0x828b('0x3e')](handleError(_0x24e353,null));}; \ No newline at end of file +var _0xbd5d=['undefined','offset','count','Content-Range','json','update','destroy','end','sendStatus','stack','send','render','merge','contact','interaction','index','ChatInteraction','type','key','getOptions','query','user','catch','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','name','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsite','ContactId','Messages','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','filters','hasOwnProperty','nolimit','limit','order','sort','where','pick','ChatInteractionId','map','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','push','findAll','rows','addTags','setTags','omit','Tag','color','emit','removeTags','unix','toString','server','tmp','files','transcript-%d-%s.zip','firstName','lastName','attachments','direction','read','Account','get','mkdirSync','Chat','Owner','N.A.','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','err','unlinkSync','rimraf','request-promise','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xbd5d,0x17c));var _0xdbd5=function(_0xf78444,_0x26d828){_0xf78444=_0xf78444-0x0;var _0x41e1b1=_0xbd5d[_0xf78444];return _0x41e1b1;};'use strict';var rimraf=require(_0xdbd5('0x0'));var zipdir=require('zip-dir');var rp=require(_0xdbd5('0x1'));var moment=require('moment');var BPromise=require(_0xdbd5('0x2'));var Mustache=require(_0xdbd5('0x3'));var util=require(_0xdbd5('0x4'));var path=require(_0xdbd5('0x5'));var ejs=require(_0xdbd5('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xdbd5('0x7'));var interaction=require(_0xdbd5('0x8'));var qs=require(_0xdbd5('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xdbd5('0xa'))('api');var config=require('../../config/environment');var db=require(_0xdbd5('0xb'))['db'];config[_0xdbd5('0xc')]=_[_0xdbd5('0xd')](config[_0xdbd5('0xc')],{'host':_0xdbd5('0xe'),'port':0x18eb});var socket=require(_0xdbd5('0xf'))(new Redis(config[_0xdbd5('0xc')]));require('./chatInteraction.socket')[_0xdbd5('0x10')](socket);var jayson=require(_0xdbd5('0x11'));var client=jayson[_0xdbd5('0x12')]['http']({'port':0x232b});var client9004=jayson['client'][_0xdbd5('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x21b8da,_0x19d130,_0x2d00f8,_0x2561c7){return new BPromise(function(_0x9ef9aa,_0x6f4b56){var _0x5bb360=_0x2561c7||client;return _0x5bb360[_0xdbd5('0x14')](_0x21b8da,_0x2d00f8)[_0xdbd5('0x15')](function(_0x258b46){logger[_0xdbd5('0x16')](_0xdbd5('0x17'),_0x19d130,'request\x20sent');logger[_0xdbd5('0x18')](_0xdbd5('0x19'),_0x19d130,_0xdbd5('0x1a'),JSON[_0xdbd5('0x1b')](_0x258b46));if(_0x258b46[_0xdbd5('0x1c')]){if(_0x258b46[_0xdbd5('0x1c')][_0xdbd5('0x1d')]===0x1f4){logger[_0xdbd5('0x1c')](_0xdbd5('0x17'),_0x19d130,_0x258b46[_0xdbd5('0x1c')]['message']);return _0x6f4b56(_0x258b46[_0xdbd5('0x1c')][_0xdbd5('0x1e')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x19d130,_0x258b46[_0xdbd5('0x1c')][_0xdbd5('0x1e')]);return _0x9ef9aa(_0x258b46[_0xdbd5('0x1c')][_0xdbd5('0x1e')]);}else{logger[_0xdbd5('0x16')](_0xdbd5('0x17'),_0x19d130,_0xdbd5('0x1a'));_0x9ef9aa(_0x258b46['result']['message']);}})['catch'](function(_0x318585){logger[_0xdbd5('0x1c')](_0xdbd5('0x17'),_0x19d130,_0x318585);_0x6f4b56(_0x318585);});});}function respondWithStatusCode(_0x54ed01,_0x3261a8){_0x3261a8=_0x3261a8||0xcc;return function(_0x247c48){if(_0x247c48){return _0x54ed01['sendStatus'](_0x3261a8);}return _0x54ed01[_0xdbd5('0x1f')](_0x3261a8)['end']();};}function respondWithResult(_0x498fed,_0x4b2ba0){_0x4b2ba0=_0x4b2ba0||0xc8;return function(_0x253980){if(_0x253980){return _0x498fed[_0xdbd5('0x1f')](_0x4b2ba0)['json'](_0x253980);}};}function respondWithFilteredResult(_0x354af2,_0x48ae8b){return function(_0x57dfa4){if(_0x57dfa4){var _0x3f6edb=typeof _0x48ae8b['offset']===_0xdbd5('0x20')&&typeof _0x48ae8b['limit']===_0xdbd5('0x20');var _0x57b013=_0x57dfa4['count'];var _0xcd38e4=_0x3f6edb?0x0:_0x48ae8b[_0xdbd5('0x21')];var _0x237453=_0x3f6edb?_0x57dfa4[_0xdbd5('0x22')]:_0x48ae8b[_0xdbd5('0x21')]+_0x48ae8b['limit'];var _0x6ecfa4;if(_0x237453>=_0x57b013){_0x237453=_0x57b013;_0x6ecfa4=0xc8;}else{_0x6ecfa4=0xce;}_0x354af2['status'](_0x6ecfa4);return _0x354af2['set'](_0xdbd5('0x23'),_0xcd38e4+'-'+_0x237453+'/'+_0x57b013)[_0xdbd5('0x24')](_0x57dfa4);}return null;};}function saveUpdates(_0x4e7c92){return function(_0x357d82){if(_0x357d82){return _0x357d82[_0xdbd5('0x25')](_0x4e7c92)['then'](function(_0x4603c7){return _0x4603c7;});}return null;};}function removeEntity(_0x57993c){return function(_0x1dc14d){if(_0x1dc14d){return _0x1dc14d[_0xdbd5('0x26')]()[_0xdbd5('0x15')](function(){_0x57993c['status'](0xcc)[_0xdbd5('0x27')]();});}};}function handleEntityNotFound(_0x3302dc){return function(_0x4299ca){if(!_0x4299ca){_0x3302dc[_0xdbd5('0x28')](0x194);}return _0x4299ca;};}function handleError(_0xbf28ed,_0x2ffee6){_0x2ffee6=_0x2ffee6||0x1f4;return function(_0x3961ae){logger['error'](_0x3961ae[_0xdbd5('0x29')]);if(_0x3961ae['name']){delete _0x3961ae['name'];}_0xbf28ed[_0xdbd5('0x1f')](_0x2ffee6)[_0xdbd5('0x2a')](_0x3961ae);};}function getMustacheRender(_0x32519e,_0x808526){return Mustache[_0xdbd5('0x2b')](_0x32519e,_[_0xdbd5('0x2c')](_0x808526['body'],{'contact':_0x808526[_0xdbd5('0x2d')],'message':_0x808526['message'],'agent':_0x808526['agent'],'interaction':_0x808526[_0xdbd5('0x2e')],'account':_0x808526['account']}))||'';}exports[_0xdbd5('0x2f')]=function(_0x3681c2,_0x32611f){var _0xc07d68={};var _0xa3911c=_['map'](db[_0xdbd5('0x30')]['rawAttributes'],function(_0x4d3491){return{'name':_0x4d3491['fieldName'],'type':_0x4d3491[_0xdbd5('0x31')][_0xdbd5('0x32')]};});_0xc07d68=qs[_0xdbd5('0x33')](_0xa3911c,_0x3681c2);return interaction['findAll']('chat',_0x3681c2[_0xdbd5('0x34')],_0x3681c2[_0xdbd5('0x35')],_0xc07d68,_0xa3911c)[_0xdbd5('0x15')](respondWithFilteredResult(_0x32611f,_0xc07d68))[_0xdbd5('0x36')](handleError(_0x32611f,null));};exports['show']=function(_0x20e7e0,_0x4c6a26){var _0x749908={'raw':![],'where':{'id':_0x20e7e0[_0xdbd5('0x37')]['id']}},_0x8eb79f={};_0x8eb79f[_0xdbd5('0x38')]=_[_0xdbd5('0x39')](db[_0xdbd5('0x30')][_0xdbd5('0x3a')]);_0x8eb79f[_0xdbd5('0x34')]=_[_0xdbd5('0x39')](_0x20e7e0['query']);_0x8eb79f['filters']=_[_0xdbd5('0x3b')](_0x8eb79f[_0xdbd5('0x38')],_0x8eb79f[_0xdbd5('0x34')]);_0x749908[_0xdbd5('0x3c')]=_[_0xdbd5('0x3b')](_0x8eb79f[_0xdbd5('0x38')],qs[_0xdbd5('0x3d')](_0x20e7e0[_0xdbd5('0x34')][_0xdbd5('0x3d')]));_0x749908[_0xdbd5('0x3c')]=_0x749908[_0xdbd5('0x3c')][_0xdbd5('0x3e')]?_0x749908[_0xdbd5('0x3c')]:_0x8eb79f[_0xdbd5('0x38')];if(_0x20e7e0[_0xdbd5('0x34')][_0xdbd5('0x3f')]){_0x749908[_0xdbd5('0x40')]=[{'all':!![]}];}_0x749908=_[_0xdbd5('0x2c')]({},_0x749908,_0x20e7e0[_0xdbd5('0x41')]);return db[_0xdbd5('0x30')][_0xdbd5('0x42')](_0x749908)['then'](handleEntityNotFound(_0x4c6a26,null))[_0xdbd5('0x15')](respondWithResult(_0x4c6a26,null))['catch'](handleError(_0x4c6a26,null));};exports[_0xdbd5('0x43')]=function(_0x329705,_0x5d8769){return db[_0xdbd5('0x30')][_0xdbd5('0x43')](_0x329705[_0xdbd5('0x44')],{})['then'](respondWithResult(_0x5d8769,0xc9))['catch'](handleError(_0x5d8769,null));};exports[_0xdbd5('0x25')]=function(_0x3e2248,_0xdc9982){if(_0x3e2248[_0xdbd5('0x44')]['id']){delete _0x3e2248[_0xdbd5('0x44')]['id'];}return db[_0xdbd5('0x30')][_0xdbd5('0x42')]({'where':{'id':_0x3e2248[_0xdbd5('0x37')]['id']}})[_0xdbd5('0x15')](handleEntityNotFound(_0xdc9982,null))[_0xdbd5('0x15')](saveUpdates(_0x3e2248[_0xdbd5('0x44')],null))[_0xdbd5('0x15')](respondWithResult(_0xdc9982,null))[_0xdbd5('0x36')](handleError(_0xdc9982,null));};exports['destroy']=function(_0x597491,_0x260e28){return db[_0xdbd5('0x30')][_0xdbd5('0x42')]({'where':{'id':_0x597491[_0xdbd5('0x37')]['id']}})['then'](handleEntityNotFound(_0x260e28,null))[_0xdbd5('0x15')](removeEntity(_0x260e28,null))[_0xdbd5('0x36')](handleError(_0x260e28,null));};exports['describe']=function(_0x1c36f8,_0x35fa3c){return db[_0xdbd5('0x30')][_0xdbd5('0x45')]()[_0xdbd5('0x15')](respondWithResult(_0x35fa3c,null))[_0xdbd5('0x36')](handleError(_0x35fa3c,null));};exports['createVidaooSession']=function(_0x17b619,_0x50c4cb){var _0x3e20d0=_0x17b619[_0xdbd5('0x37')]['id'];var _0x17f5ab;var _0x3c14ce;var _0x6369f2;return db[_0xdbd5('0x30')]['findOne']({'where':{'id':_0x3e20d0}})['then'](function(_0x1b576a){_0x17f5ab=_0x1b576a;return db['ChatWebsite'][_0xdbd5('0x46')]({'where':{'id':_0x1b576a['ChatWebsiteId']},'attributes':['id',_0xdbd5('0x47'),'vidaooEscalation',_0xdbd5('0x48'),_0xdbd5('0x49'),'vidaooMetadata'],'raw':!![]});})[_0xdbd5('0x15')](function(_0x26d18a){if(_0x26d18a&&_0x26d18a[_0xdbd5('0x47')]&&_0x26d18a[_0xdbd5('0x4a')]){_0x3c14ce=_0x26d18a;var _0x1e71a4={'interaction':{'id':_0x3e20d0},'agent':{'id':_0x17b619[_0xdbd5('0x35')]['id'],'name':_0x17b619[_0xdbd5('0x35')][_0xdbd5('0x4b')],'fullname':_0x17b619[_0xdbd5('0x35')][_0xdbd5('0x4c')],'email':_0x17b619[_0xdbd5('0x35')][_0xdbd5('0x4d')]},'contact':_0x17b619[_0xdbd5('0x44')][_0xdbd5('0x2d')],'account':_0x17b619[_0xdbd5('0x44')][_0xdbd5('0x4e')]};var _0x1b7828={'rejectUnauthorized':![],'method':_0xdbd5('0x4f'),'url':_0xdbd5('0x50'),'headers':{'X-APIKEY':_0x26d18a[_0xdbd5('0x47')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x17b619[_0xdbd5('0x35')][_0xdbd5('0x4d')]],'buttons':null,'topic':_0x3c14ce[_0xdbd5('0x48')],'note':_[_0xdbd5('0x51')](_0x3c14ce[_0xdbd5('0x49')])?null:getMustacheRender(_0x3c14ce[_0xdbd5('0x49')],_0x1e71a4),'metadata':null},'redirect':_0xdbd5('0x52'),'json':!![]};try{if(!_[_0xdbd5('0x51')](_0x3c14ce[_0xdbd5('0x53')])){var _0x439e51=getMustacheRender(_0x3c14ce[_0xdbd5('0x53')],_0x1e71a4);var _0x229d00=JSON[_0xdbd5('0x54')](_0x439e51);_0x1b7828['body'][_0xdbd5('0x55')]=_0x229d00;}}catch(_0x9ea0bd){throw new db[(_0xdbd5('0x56'))][(_0xdbd5('0x57'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x1b7828);}else{throw new db[(_0xdbd5('0x56'))][(_0xdbd5('0x57'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x398d99){_0x6369f2=_0x398d99;if(_0x6369f2['id']){var _0x3fbfb9={'body':_0x6369f2[_0xdbd5('0x58')],'ChatWebsiteId':_0x3c14ce['id'],'ChatInteractionId':_0x17f5ab['id'],'direction':'out','UserId':_0x17b619[_0xdbd5('0x35')]['id']};return db[_0xdbd5('0x59')]['create'](_0x3fbfb9,{});}else{throw new db[(_0xdbd5('0x56'))][(_0xdbd5('0x57'))](_0xdbd5('0x5a'));}})[_0xdbd5('0x15')](function(){return _0x17f5ab['updateAttributes']({'vidaooSessionId':_0x6369f2['id']});})[_0xdbd5('0x15')](respondWithResult(_0x50c4cb,null))['catch'](handleError(_0x50c4cb,null));};exports[_0xdbd5('0x5b')]=function(_0x579618,_0x1e6914){if(_0x579618[_0xdbd5('0x44')]['id']){delete _0x579618[_0xdbd5('0x44')]['id'];}return db[_0xdbd5('0x30')][_0xdbd5('0x42')]({'where':{'id':_0x579618['params']['id']},'include':[{'model':db['CmContact'],'as':_0xdbd5('0x5c')}]})[_0xdbd5('0x15')](handleEntityNotFound(_0x1e6914,null))['then'](saveUpdates(_0x579618[_0xdbd5('0x44')],null))[_0xdbd5('0x15')](respondWithResult(_0x1e6914,null))['catch'](handleError(_0x1e6914,null));};exports[_0xdbd5('0x5d')]=function(_0x4411c4,_0x45dae4){if(_0x4411c4[_0xdbd5('0x44')]['id']){delete _0x4411c4['body']['id'];}return db['ChatInteraction'][_0xdbd5('0x42')]({'where':{'id':_0x4411c4[_0xdbd5('0x37')]['id']}})[_0xdbd5('0x15')](function(_0x5ee0bf){if(!_0x5ee0bf){logger[_0xdbd5('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xdbd5('0x5d'),0x194,_0xdbd5('0x5e'));_0x45dae4[_0xdbd5('0x28')](0x194);}else{if(_0x5ee0bf[_0xdbd5('0x5f')]){throw new db[(_0xdbd5('0x56'))][(_0xdbd5('0x57'))](_0xdbd5('0x60'));}}return _0x5ee0bf;})[_0xdbd5('0x15')](function(_0xf5f480){if(_0xf5f480){return _0xf5f480[_0xdbd5('0x25')]({'closed':_0x4411c4[_0xdbd5('0x44')][_0xdbd5('0x61')],'disposition':_0x4411c4['body']['disposition']})[_0xdbd5('0x15')](function(_0x1a3e5b){return _0x1a3e5b;});}})['then'](function(){return respondWithRpcPromise(_0xdbd5('0x62'),'abandon',_0x4411c4[_0xdbd5('0x44')],client9004);})['then'](respondWithResult(_0x45dae4,null))[_0xdbd5('0x36')](handleError(_0x45dae4,null));};exports[_0xdbd5('0x63')]=function(_0x154433,_0x509d5e){_0x154433[_0xdbd5('0x44')]['name']=_0x154433[_0xdbd5('0x64')][_0xdbd5('0x65')];_0x154433[_0xdbd5('0x44')]['basename']=_0x154433[_0xdbd5('0x64')][_0xdbd5('0x66')];_0x154433[_0xdbd5('0x44')][_0xdbd5('0x31')]=_0x154433[_0xdbd5('0x64')][_0xdbd5('0x67')];return db[_0xdbd5('0x68')][_0xdbd5('0x43')](_0x154433[_0xdbd5('0x44')])[_0xdbd5('0x15')](respondWithResult(_0x509d5e,0xc9))[_0xdbd5('0x36')](handleError(_0x509d5e,null));};exports['attachmentDownload']=function(_0x27692a,_0x447647){return db['ChatInteraction'][_0xdbd5('0x46')]({'where':{'id':_0x27692a[_0xdbd5('0x37')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x447647,null))[_0xdbd5('0x15')](function(_0x3d0358){if(_0x3d0358){if(_0x3d0358[_0xdbd5('0x61')]){return _0x447647[_0xdbd5('0x1f')](0x193)[_0xdbd5('0x24')]({'status':0x193,'message':_0xdbd5('0x69')});}return db[_0xdbd5('0x68')][_0xdbd5('0x46')]({'where':{'id':_0x27692a['query'][_0xdbd5('0x6a')]},'raw':!![]})[_0xdbd5('0x15')](handleEntityNotFound(_0x447647,null));}})[_0xdbd5('0x15')](function(_0x43d810){if(_0x43d810){var _0x4f01b1=_0x43d810[_0xdbd5('0x6b')]!==null;var _0x1c2e07=path[_0xdbd5('0x6c')](config[_0xdbd5('0x6d')],_0xdbd5('0x6e'));if(_0x4f01b1){_0x1c2e07=path[_0xdbd5('0x6c')](_0x1c2e07,_0xdbd5('0x6f'));}var _0x11e7fc=path['join'](_0x1c2e07,_0x43d810[_0xdbd5('0x70')]);return _0x447647[_0xdbd5('0x71')](_0x11e7fc);}})[_0xdbd5('0x36')](handleError(_0x447647,null));};exports[_0xdbd5('0x72')]=function(_0x59aec7,_0xf29bf8){var _0x37eaca=null;var _0x1d32d2=null;var _0x1c15a0=null;if(_0x59aec7[_0xdbd5('0x44')]['id']){delete _0x59aec7[_0xdbd5('0x44')]['id'];}if(_0x59aec7['body']['mailTranscript']){_0x1c15a0=path[_0xdbd5('0x6c')](config[_0xdbd5('0x6d')],'server/files/chat/upload/',util[_0xdbd5('0x73')](_0xdbd5('0x74'),Date[_0xdbd5('0x75')]()));_0x59aec7[_0xdbd5('0x44')][_0xdbd5('0x76')]=_0x1c15a0;}return db['ChatInteraction'][_0xdbd5('0x42')]({'where':{'id':_0x59aec7[_0xdbd5('0x37')]['id']},'include':[{'model':db[_0xdbd5('0x59')],'as':'Messages','include':[{'model':db[_0xdbd5('0x77')],'as':_0xdbd5('0x77')}]}]})[_0xdbd5('0x15')](handleEntityNotFound(_0xf29bf8,null))[_0xdbd5('0x15')](saveUpdates(_0x59aec7[_0xdbd5('0x44')],null))[_0xdbd5('0x15')](function(_0xa243e7){if(_0xa243e7){_0x37eaca=_0xa243e7;return db[_0xdbd5('0x78')]['find']({'where':{'id':_0x37eaca['ChatWebsiteId']}});}})[_0xdbd5('0x15')](function(_0x3337d4){if(_0x3337d4){_0x1d32d2=_0x3337d4;return db['CmContact'][_0xdbd5('0x42')]({'where':{'id':_0x37eaca[_0xdbd5('0x79')]}});}})[_0xdbd5('0x15')](function(_0x7c4b0b){if(_0x7c4b0b){if(_0x1c15a0){var _0x520da7=null;for(var _0xa66013=0x1;_0xa66013<_0x37eaca[_0xdbd5('0x7a')][_0xdbd5('0x3e')];++_0xa66013){_0x520da7=_0x37eaca[_0xdbd5('0x7a')][_0xa66013];var _0x219646=_0x520da7[_0xdbd5('0x5f')]?util[_0xdbd5('0x73')](_0xdbd5('0x7b'),_0x1d32d2[_0xdbd5('0x7c')],_0x520da7[_0xdbd5('0x5f')]):'System';var _0x2d1036=_0x59aec7[_0xdbd5('0x44')]['customer']||util['format']('%s%d',_0xdbd5('0x7d'),_0x520da7['ContactId']);switch(_0x1d32d2[_0xdbd5('0x7e')]){case _0xdbd5('0x7f'):_0x219646=_0x520da7[_0xdbd5('0x5f')]?util[_0xdbd5('0x73')](_0xdbd5('0x7b'),_0x1d32d2[_0xdbd5('0x7c')],_0x520da7[_0xdbd5('0x5f')]):_0xdbd5('0x80');break;case _0xdbd5('0x81'):_0x219646=_0x520da7['UserId']?_0x520da7[_0xdbd5('0x77')][_0xdbd5('0x82')]||_0x520da7[_0xdbd5('0x77')][_0xdbd5('0x4c')]:_0xdbd5('0x80');break;case _0xdbd5('0x83'):_0x219646=_0x520da7[_0xdbd5('0x5f')]?_0x520da7[_0xdbd5('0x77')]['fullname']:_0xdbd5('0x80');break;default:_0x219646=_0x520da7[_0xdbd5('0x5f')]?util[_0xdbd5('0x73')](_0xdbd5('0x7b'),_0x1d32d2[_0xdbd5('0x7c')],_0x520da7['UserId']):_0xdbd5('0x80');}var _0x3de27d=util[_0xdbd5('0x73')](_0xdbd5('0x84'),moment(_0x520da7[_0xdbd5('0x85')])[_0xdbd5('0x73')](_0xdbd5('0x86')),_0x520da7['direction']==='in'?_0x2d1036:_0x219646,_0x520da7[_0xdbd5('0x44')]);if(!_0x520da7[_0xdbd5('0x87')]){fs[_0xdbd5('0x88')](_0x1c15a0,_0x3de27d);}}return db[_0xdbd5('0x89')][_0xdbd5('0x46')]({'where':{'service':!![]},'include':[{'model':db[_0xdbd5('0x8a')],'as':_0xdbd5('0x8b'),'raw':!![],'include':[{'model':db[_0xdbd5('0x8c')],'as':_0xdbd5('0x8c'),'raw':!![]}]}]});}}})[_0xdbd5('0x15')](function(_0x81fc29){if(!_0x81fc29||!_0x81fc29[_0xdbd5('0x8b')]||!_0x59aec7[_0xdbd5('0x44')])return _0x37eaca;var _0x58b0c4=_0x81fc29[_0xdbd5('0x8d')]();return respondWithRpcPromise(_0xdbd5('0x8e'),_0xdbd5('0x8f'),{'account':_0x58b0c4,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x81fc29['name'],_0x81fc29['email']||_0x81fc29[_0xdbd5('0x8b')][_0xdbd5('0x35')]),'to':_0x59aec7['body'][_0xdbd5('0x90')],'subject':'Mail\x20Transcript','text':util[_0xdbd5('0x73')](_0xdbd5('0x91'),_0x59aec7[_0xdbd5('0x44')][_0xdbd5('0x90')]),'attachments':[{'path':_0x1c15a0}]}})[_0xdbd5('0x15')](function(){return _0x37eaca;})[_0xdbd5('0x36')](function(_0x3d1c7b){logger[_0xdbd5('0x1c')](_0x3d1c7b);});})[_0xdbd5('0x15')](respondWithStatusCode(_0xf29bf8,0xc8))[_0xdbd5('0x36')](handleError(_0xf29bf8,null));};exports['addMessage']=function(_0x47f5bd,_0x25bd4f){return db[_0xdbd5('0x59')][_0xdbd5('0x42')]({'where':{'id':_0x47f5bd[_0xdbd5('0x37')]['id']}})[_0xdbd5('0x15')](handleEntityNotFound(_0x25bd4f,null))['then'](function(_0x2c1d6e){if(_0x2c1d6e){return _0x2c1d6e[_0xdbd5('0x92')](_0x47f5bd[_0xdbd5('0x44')]['ids'],_['omit'](_0x47f5bd[_0xdbd5('0x44')],[_0xdbd5('0x93'),'id'])||{});}})[_0xdbd5('0x15')](respondWithResult(_0x25bd4f,null))['catch'](handleError(_0x25bd4f,null));};exports[_0xdbd5('0x94')]=function(_0x238cd3,_0x2832b2){var _0x241348={'raw':![],'where':{}};var _0x455f1d={};var _0x7caa23={'count':0x0,'rows':[]};return db[_0xdbd5('0x30')]['findOne']({'where':{'id':_0x238cd3[_0xdbd5('0x37')]['id']}})['then'](handleEntityNotFound(_0x2832b2,null))[_0xdbd5('0x15')](function(_0x584276){if(_0x584276){_0x455f1d[_0xdbd5('0x38')]=_['keys'](db[_0xdbd5('0x59')]['rawAttributes']);_0x455f1d['query']=_[_0xdbd5('0x39')](_0x238cd3[_0xdbd5('0x34')]);_0x455f1d[_0xdbd5('0x95')]=_[_0xdbd5('0x3b')](_0x455f1d[_0xdbd5('0x38')],_0x455f1d[_0xdbd5('0x34')]);_0x241348[_0xdbd5('0x3c')]=_[_0xdbd5('0x3b')](_0x455f1d[_0xdbd5('0x38')],qs['fields'](_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0x3d')]));_0x241348[_0xdbd5('0x3c')]=_0x241348['attributes'][_0xdbd5('0x3e')]?_0x241348['attributes']:_0x455f1d[_0xdbd5('0x38')];if(!_0x238cd3['query'][_0xdbd5('0x96')](_0xdbd5('0x97'))){_0x241348[_0xdbd5('0x98')]=qs[_0xdbd5('0x98')](_0x238cd3[_0xdbd5('0x34')]['limit']);_0x241348['offset']=qs[_0xdbd5('0x21')](_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0x21')]);}_0x241348[_0xdbd5('0x99')]=qs['sort'](_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0x9a')]);_0x241348[_0xdbd5('0x9b')]=qs[_0xdbd5('0x95')](_[_0xdbd5('0x9c')](_0x238cd3[_0xdbd5('0x34')],_0x455f1d[_0xdbd5('0x95')]));_0x241348[_0xdbd5('0x9b')][_0xdbd5('0x9d')]=_0x584276['id'];if(_0x238cd3['query']['filter']){_0x241348[_0xdbd5('0x9b')]=_['merge'](_0x241348[_0xdbd5('0x9b')],{'$or':_[_0xdbd5('0x9e')](_0x241348['attributes'],function(_0x19bf9b){var _0x343065={};_0x343065[_0x19bf9b]={'$like':'%'+_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0x9f')]+'%'};return _0x343065;})});}if(_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0xa0')]){var _0x1edb08=_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0xa0')]['split'](',');var _0xbe206b={};_0xbe206b[_0x1edb08[0x0]]={'$gte':moment(_0x1edb08[0x1])[_0xdbd5('0x73')](_0xdbd5('0xa1'))};_0x241348[_0xdbd5('0x9b')]=_['merge'](_0x241348['where'],_0xbe206b);}_0x241348=_[_0xdbd5('0x2c')]({},_0x241348,_0x238cd3[_0xdbd5('0x41')]);return db['ChatMessage'][_0xdbd5('0x22')]({'where':_0x241348[_0xdbd5('0x9b')]})[_0xdbd5('0x15')](function(_0x397301){_0x7caa23[_0xdbd5('0x22')]=_0x397301;if(_0x238cd3[_0xdbd5('0x34')][_0xdbd5('0x3f')]){_0x241348['include']=[{'all':!![]}];}return db[_0xdbd5('0x59')]['findAll'](_0x241348);})['then'](function(_0x3245ae){_0x7caa23['rows']=_0x3245ae;return _0x7caa23;});}})[_0xdbd5('0x15')](respondWithFilteredResult(_0x2832b2,_0x241348))[_0xdbd5('0x36')](handleError(_0x2832b2,null));};exports[_0xdbd5('0xa2')]=function(_0xefd99a,_0xf9bc4c){var _0x1a9bbf={'where':{}},_0x45ffb9={},_0x33a2f1={'count':0x0,'rows':[]};return db[_0xdbd5('0x30')][_0xdbd5('0x46')]({'where':{'id':_0xefd99a[_0xdbd5('0x37')]['id']}})[_0xdbd5('0x15')](handleEntityNotFound(_0xf9bc4c,null))['then'](function(_0xc42bd3){if(_0xc42bd3){_0x45ffb9[_0xdbd5('0x38')]=_[_0xdbd5('0x39')](db[_0xdbd5('0x59')]['rawAttributes']);_0x45ffb9[_0xdbd5('0x34')]=_[_0xdbd5('0x39')](_0xefd99a[_0xdbd5('0x34')]);_0x45ffb9['filters']=_[_0xdbd5('0x3b')](_0x45ffb9['model'],_0x45ffb9[_0xdbd5('0x34')]);_0x1a9bbf[_0xdbd5('0x3c')]=_[_0xdbd5('0x3b')](_0x45ffb9['model'],qs[_0xdbd5('0x3d')](_0xefd99a[_0xdbd5('0x34')]['fields']));_0x1a9bbf[_0xdbd5('0x3c')]=_0x1a9bbf[_0xdbd5('0x3c')]['length']?_0x1a9bbf[_0xdbd5('0x3c')]:_0x45ffb9['model'];if(!_0xefd99a['query']['hasOwnProperty'](_0xdbd5('0x97'))){_0x1a9bbf[_0xdbd5('0x98')]=qs['limit'](_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0x98')]);_0x1a9bbf[_0xdbd5('0x21')]=qs[_0xdbd5('0x21')](_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0x21')]);}_0x1a9bbf[_0xdbd5('0x99')]=qs['sort'](_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0x9a')]);_0x1a9bbf[_0xdbd5('0x9b')]=qs[_0xdbd5('0x95')](_[_0xdbd5('0x9c')](_0xefd99a[_0xdbd5('0x34')],_0x45ffb9[_0xdbd5('0x95')]));_0x1a9bbf['where'][_0xdbd5('0x9d')]=_0xc42bd3['id'];if(_0xefd99a[_0xdbd5('0x34')]['filter']){_0x1a9bbf[_0xdbd5('0x9b')]=_[_0xdbd5('0x2c')](_0x1a9bbf[_0xdbd5('0x9b')],{'$or':_[_0xdbd5('0x9e')](_0x1a9bbf[_0xdbd5('0x3c')],function(_0x4da5e7){var _0x479c0a={};_0x479c0a[_0x4da5e7]={'$like':'%'+_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0x9f')]+'%'};return _0x479c0a;})});}_0x1a9bbf[_0xdbd5('0x9b')][_0xdbd5('0x87')]=![];if(_0xefd99a['query']['id']){_0x1a9bbf['where']['id']={'$gt':_0xefd99a[_0xdbd5('0x34')]['id']};}_0x1a9bbf=_[_0xdbd5('0x2c')]({},_0x1a9bbf,_0xefd99a[_0xdbd5('0x41')]);return db[_0xdbd5('0x59')]['count']({'where':_0x1a9bbf[_0xdbd5('0x9b')]})['then'](function(_0xef9e2){_0x33a2f1[_0xdbd5('0x22')]=_0xef9e2;_0x1a9bbf['include']=[];if(_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0xa3')]){_0x1a9bbf[_0xdbd5('0x40')][_0xdbd5('0xa4')]({'model':db[_0xdbd5('0x77')],'as':_0xdbd5('0x77'),'attributes':['id',_0xdbd5('0x4c'),_0xdbd5('0x82')]});}if(_0xefd99a[_0xdbd5('0x34')][_0xdbd5('0x3f')]){_0x1a9bbf['include']=[{'all':!![]}];}return db[_0xdbd5('0x59')][_0xdbd5('0xa5')](_0x1a9bbf);})[_0xdbd5('0x15')](function(_0x124da3){_0x33a2f1[_0xdbd5('0xa6')]=_0x124da3;return _0x33a2f1;});}})[_0xdbd5('0x15')](respondWithFilteredResult(_0xf9bc4c,_0x1a9bbf))[_0xdbd5('0x36')](handleError(_0xf9bc4c,null));};exports[_0xdbd5('0xa7')]=function(_0x4499a9,_0x3282f8){return db[_0xdbd5('0x30')][_0xdbd5('0x42')]({'where':{'id':_0x4499a9['params']['id']}})['then'](handleEntityNotFound(_0x3282f8,null))[_0xdbd5('0x15')](function(_0x499af7){if(_0x499af7){return _0x499af7[_0xdbd5('0xa8')](_0x4499a9[_0xdbd5('0x44')]['ids'],_[_0xdbd5('0xa9')](_0x4499a9['body'],[_0xdbd5('0x93'),'id'])||{})['spread'](function(){return db[_0xdbd5('0xaa')][_0xdbd5('0xa5')]({'attributes':['id',_0xdbd5('0x4b'),_0xdbd5('0xab')],'where':{'id':_0x4499a9[_0xdbd5('0x44')]['ids']}});})[_0xdbd5('0x15')](function(_0x3194f0){socket[_0xdbd5('0xac')]('chatInteractionTags:save',{'id':Number(_0x4499a9[_0xdbd5('0x37')]['id']),'tags':_0x3194f0||[]});return{'id':Number(_0x4499a9['params']['id']),'tags':_0x3194f0||[]};});}})['then'](respondWithResult(_0x3282f8,null))['catch'](handleError(_0x3282f8,null));};exports['removeTags']=function(_0x546f90,_0x1d0399){return db['ChatInteraction'][_0xdbd5('0x42')]({'where':{'id':_0x546f90[_0xdbd5('0x37')]['id']}})[_0xdbd5('0x15')](handleEntityNotFound(_0x1d0399,null))[_0xdbd5('0x15')](function(_0x36dd6e){if(_0x36dd6e){return _0x36dd6e[_0xdbd5('0xad')](_0x546f90[_0xdbd5('0x34')][_0xdbd5('0x93')]);}})[_0xdbd5('0x15')](respondWithStatusCode(_0x1d0399,null))[_0xdbd5('0x36')](handleError(_0x1d0399,null));};exports[_0xdbd5('0x71')]=function(_0x3ce89d,_0x3fe7d5){var _0x34378d=moment()[_0xdbd5('0xae')]()[_0xdbd5('0xaf')]();var _0x681e37=path['join'](config[_0xdbd5('0x6d')],_0xdbd5('0xb0'),'files',_0xdbd5('0xb1'));var _0x4ba8b3=path[_0xdbd5('0x6c')](config['root'],'server',_0xdbd5('0xb2'),'attachments');var _0xf3eb02=path[_0xdbd5('0x6c')](_0x681e37,_0x34378d);var _0x5d4529=util[_0xdbd5('0x73')](_0xdbd5('0xb3'),_0x3ce89d[_0xdbd5('0x37')]['id'],_0x34378d);var _0x1dc943=path[_0xdbd5('0x6c')](_0x681e37,_0x5d4529);var _0x22dee0=[];_0x22dee0[_0xdbd5('0xa4')]({'model':db[_0xdbd5('0x77')],'as':_0xdbd5('0x77'),'attributes':['id',_0xdbd5('0x4c')],'raw':!![]});_0x22dee0[_0xdbd5('0xa4')]({'model':db['CmContact'],'as':_0xdbd5('0x5c'),'attributes':['id',_0xdbd5('0xb4'),_0xdbd5('0xb5')],'raw':!![]});if(_0x3ce89d[_0xdbd5('0x34')][_0xdbd5('0xb6')]){_0x22dee0[_0xdbd5('0xa4')]({'model':db[_0xdbd5('0x68')],'as':_0xdbd5('0x68'),'raw':!![]});}var _0x1b2139=[{'model':db['ChatMessage'],'as':_0xdbd5('0x7a'),'attributes':['id',_0xdbd5('0x44'),_0xdbd5('0x85'),_0xdbd5('0xb7'),'secret',_0xdbd5('0xb8')],'include':_0x22dee0}];_0x1b2139[_0xdbd5('0xa4')]({'model':db[_0xdbd5('0x78')],'as':_0xdbd5('0xb9'),'attributes':['id',_0xdbd5('0x4b')]});_0x1b2139[_0xdbd5('0xa4')]({'model':db[_0xdbd5('0x77')],'as':'Owner','attributes':['id',_0xdbd5('0x4c')]});return db['ChatInteraction'][_0xdbd5('0x42')]({'where':{'id':_0x3ce89d['params']['id']},'include':_0x1b2139})['then'](handleEntityNotFound(_0x3fe7d5,null))['then'](function(_0x5919ce){if(_0x5919ce){var _0x54791e=_0x5919ce[_0xdbd5('0xba')]({'plain':!![]});fs[_0xdbd5('0xbb')](_0xf3eb02);var _0x1d931b={'channel':_0xdbd5('0xbc'),'account':_0x54791e['Account'][_0xdbd5('0x4b')],'agent':_0x54791e['Owner']?_0x54791e[_0xdbd5('0xbd')][_0xdbd5('0x4c')]:_0xdbd5('0xbe'),'createdAt':moment(_0x54791e[_0xdbd5('0x85')])['format'](_0xdbd5('0xa1'))[_0xdbd5('0xaf')](),'closedAt':_0x54791e[_0xdbd5('0x61')]?moment(_0x54791e['closedAt'])[_0xdbd5('0x73')](_0xdbd5('0xa1'))[_0xdbd5('0xaf')]():'','disposition':_0x54791e['disposition'],'chatInfo':{'browser':_0x54791e['browserName'],'os':_0x54791e['osName'],'referer':_0x54791e[_0xdbd5('0xbf')],'customerIp':_0x54791e[_0xdbd5('0xc0')],'customerPort':_0x54791e[_0xdbd5('0xc1')]?_0x54791e[_0xdbd5('0xc1')]:'N.A.'},'messages':_(_0x54791e[_0xdbd5('0x7a')])[_0xdbd5('0xc2')]()[_0xdbd5('0x9f')]({'secret':![]})[_0xdbd5('0x9e')](function(_0x409f95){if(_0x409f95['Attachment']){var _0x59223c=path[_0xdbd5('0x6c')](_0x4ba8b3,_0x409f95[_0xdbd5('0x68')][_0xdbd5('0x70')]);if(fs[_0xdbd5('0xc3')](_0x59223c)){fs[_0xdbd5('0xc4')](_0x59223c)[_0xdbd5('0xc5')](fs[_0xdbd5('0xc6')](path[_0xdbd5('0x6c')](_0xf3eb02,_0x409f95[_0xdbd5('0x68')][_0xdbd5('0x70')])));}}return{'date':moment(_0x409f95[_0xdbd5('0x85')])[_0xdbd5('0x73')](_0xdbd5('0xa1'))[_0xdbd5('0xaf')](),'sender':_0x409f95[_0xdbd5('0xb7')]===_0xdbd5('0xc7')?_0x409f95[_0xdbd5('0x77')]?_0x409f95[_0xdbd5('0x77')][_0xdbd5('0x4c')]:_0xdbd5('0x80'):_0x409f95[_0xdbd5('0x5c')]['firstName']+(_0x409f95[_0xdbd5('0x5c')][_0xdbd5('0xb5')]?'\x20'+_0x409f95[_0xdbd5('0x5c')][_0xdbd5('0xb5')]:''),'body':_0x409f95[_0xdbd5('0x68')]?_0x409f95[_0xdbd5('0x68')][_0xdbd5('0x70')]:_0x409f95[_0xdbd5('0x44')],'direction':_0x409f95[_0xdbd5('0xb7')]==='out'?'A':'C','secret':_0x409f95[_0xdbd5('0x87')],'read':_0x409f95['read'],'attachment':_0x409f95['Attachment']};})[_0xdbd5('0xc8')]()};return ejs[_0xdbd5('0xc9')](path[_0xdbd5('0x6c')](config[_0xdbd5('0x6d')],'server',_0xdbd5('0xca'),_0xdbd5('0xcb')),{'interaction':_0x1d931b})[_0xdbd5('0x15')](function(_0x423a24){var _0x59be78=path[_0xdbd5('0x6c')](_0xf3eb02,'transcript-'+_0x54791e['id']+'-'+_0x34378d+'.pdf');var _0x2444de={'path':_0x59be78,'channel':_0xdbd5('0xbc'),'interactionId':_0x54791e['id']};return pdf['createPdfFromHTML'](_0x423a24,_0x2444de);})[_0xdbd5('0x15')](function(){return new Promise(function(_0x4c1aae,_0x3881a6){zipdir(_0xf3eb02,{'saveTo':_0x1dc943},function(_0x1f2fa3,_0x3d1cb1){if(_0x1f2fa3)return _0x3881a6(_0x1f2fa3);return _0x4c1aae(_0x3d1cb1);});})[_0xdbd5('0x15')](function(){return new BPromise(function(_0x2b0755,_0x25fe43){rimraf(_0xf3eb02,function(_0x36c45d){if(_0x36c45d)_0x25fe43(_0x36c45d);return _0x2b0755();});});})[_0xdbd5('0x15')](function(){return _0x3fe7d5[_0xdbd5('0x71')](_0x1dc943,_0x5d4529,function(_0x23d0ab){if(_0x23d0ab){logger[_0xdbd5('0x1c')](_0xdbd5('0xcc'),_0x23d0ab);}else{fs[_0xdbd5('0xcd')](_0x1dc943);}});});});}else{return _0x3fe7d5[_0xdbd5('0x28')](0xc8);}})[_0xdbd5('0x36')](handleError(_0x3fe7d5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d3d4472..3c7ea6a 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 _0x42c2=['map','findAll','then','length','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x3b9516,_0x31a90e){var _0x24e070=function(_0x498056){while(--_0x498056){_0x3b9516['push'](_0x3b9516['shift']());}};_0x24e070(++_0x31a90e);}(_0x42c2,0x16f));var _0x242c=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x42c2[_0x511bd1];return _0x4c48ec;};'use strict';var EventEmitter=require(_0x242c('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x242c('0x1')];var ChatMessage=require(_0x242c('0x2'))['db'][_0x242c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x242c('0x4')](0x0);var events={'afterCreate':_0x242c('0x5'),'afterUpdate':_0x242c('0x6'),'afterDestroy':_0x242c('0x7')};function emitEvent(_0x2f5ac5){return function(_0x51f298,_0x301729,_0x344b18){_0x51f298[_0x242c('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc09e3e){_0x51f298[_0x242c('0x9')](_0x242c('0xa'),_0xc09e3e[_0x242c('0xb')](function(_0x108078){return{'id':_0x108078['id']};}));return ChatMessage[_0x242c('0xc')]({'where':{'ChatInteractionId':_0x51f298['id'],'direction':'in','read':![]},'raw':!![]});})[_0x242c('0xd')](function(_0x1f4b59){_0x51f298[_0x242c('0x9')]('unreadMessages',_0x1f4b59[_0x242c('0xe')]);ChatInteractionEvents['emit'](_0x2f5ac5+':'+_0x51f298['id'],_0x51f298);ChatInteractionEvents['emit'](_0x2f5ac5,_0x51f298);_0x344b18(null);})[_0x242c('0xf')](_0x344b18(null));};}for(var e in events){if(events[_0x242c('0x10')](e)){var event=events[e];ChatInteraction[_0x242c('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xca0f=['../../mysqldb','ChatMessage','save','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','ChatInteraction'];(function(_0x17c54a,_0x3a2293){var _0x3e8a67=function(_0x41e7c9){while(--_0x41e7c9){_0x17c54a['push'](_0x17c54a['shift']());}};_0x3e8a67(++_0x3a2293);}(_0xca0f,0x64));var _0xfca0=function(_0x41cf63,_0x46c756){_0x41cf63=_0x41cf63-0x0;var _0x414c8f=_0xca0f[_0x41cf63];return _0x414c8f;};'use strict';var EventEmitter=require(_0xfca0('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xfca0('0x1')];var ChatMessage=require(_0xfca0('0x2'))['db'][_0xfca0('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfca0('0x4'),'afterUpdate':'update','afterDestroy':_0xfca0('0x5')};function emitEvent(_0xd96b38){return function(_0x4fc860,_0x3f9e69,_0x45fcb6){_0x4fc860['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x122069){_0x4fc860[_0xfca0('0x6')](_0xfca0('0x7'),_0x122069[_0xfca0('0x8')](function(_0x145b25){return{'id':_0x145b25['id']};}));return ChatMessage[_0xfca0('0x9')]({'where':{'ChatInteractionId':_0x4fc860['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfca0('0xa')](function(_0x4f99c4){_0x4fc860[_0xfca0('0x6')](_0xfca0('0xb'),_0x4f99c4[_0xfca0('0xc')]);ChatInteractionEvents['emit'](_0xd96b38+':'+_0x4fc860['id'],_0x4fc860);ChatInteractionEvents[_0xfca0('0xd')](_0xd96b38,_0x4fc860);_0x45fcb6(null);})['catch'](_0x45fcb6(null));};}for(var e in events){if(events[_0xfca0('0xe')](e)){var event=events[e];ChatInteraction[_0xfca0('0xf')](e,emitEvent(event));}}module[_0xfca0('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fd16f38..e80808b 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 _0x3763=['api','bluebird','request-promise','path','../../config/environment','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util'];(function(_0x4f617a,_0x2475f7){var _0x9d2059=function(_0x498fa6){while(--_0x498fa6){_0x4f617a['push'](_0x4f617a['shift']());}};_0x9d2059(++_0x2475f7);}(_0x3763,0x186));var _0x3376=function(_0xf90bad,_0x2b272a){_0xf90bad=_0xf90bad-0x0;var _0x2deef0=_0x3763[_0xf90bad];return _0x2deef0;};'use strict';var _=require(_0x3376('0x0'));var util=require(_0x3376('0x1'));var logger=require('../../config/logger')(_0x3376('0x2'));var moment=require('moment');var BPromise=require(_0x3376('0x3'));var rp=require(_0x3376('0x4'));var fs=require('fs');var path=require(_0x3376('0x5'));var rimraf=require('rimraf');var config=require(_0x3376('0x6'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0xe0cc5b,_0x49afd2){return _0xe0cc5b[_0x3376('0x7')](_0x3376('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x559045,_0x4bfe86,_0x5b701c){if(_0x559045[_0x3376('0x9')]('closed')){_0x559045[_0x3376('0xa')]=moment()[_0x3376('0xb')](_0x3376('0xc'));}_0x5b701c(null,_0x559045);}},'charset':_0x3376('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x27e1=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0x27e1,0x16a));var _0x127e=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x27e1[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x127e('0x0'));var util=require('util');var logger=require(_0x127e('0x1'))('api');var moment=require(_0x127e('0x2'));var BPromise=require(_0x127e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x127e('0x4'));var rimraf=require(_0x127e('0x5'));var config=require(_0x127e('0x6'));var attributes=require(_0x127e('0x7'));module[_0x127e('0x8')]=function(_0x52eed0,_0x37357f){return _0x52eed0[_0x127e('0x9')](_0x127e('0xa'),attributes,{'tableName':_0x127e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ed8b2,_0x3fc0b2,_0x2be611){if(_0x1ed8b2['changed'](_0x127e('0xc'))){_0x1ed8b2['closedAt']=moment()[_0x127e('0xd')](_0x127e('0xe'));}_0x2be611(null,_0x1ed8b2);}},'charset':'utf8mb4','collate':_0x127e('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4a36d62..c6edac0 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 _0xa13b=['ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateChatInteraction'];(function(_0x40dc22,_0x21aa75){var _0x413c19=function(_0x49c02c){while(--_0x49c02c){_0x40dc22['push'](_0x40dc22['shift']());}};_0x413c19(++_0x21aa75);}(_0xa13b,0xdc));var _0xba13=function(_0x20561a,_0x19bfc0){_0x20561a=_0x20561a-0x0;var _0x40e249=_0xa13b[_0x20561a];return _0x40e249;};'use strict';var _=require(_0xba13('0x0'));var util=require(_0xba13('0x1'));var moment=require(_0xba13('0x2'));var BPromise=require('bluebird');var rs=require(_0xba13('0x3'));var fs=require('fs');var Redis=require(_0xba13('0x4'));var db=require(_0xba13('0x5'))['db'];var utils=require(_0xba13('0x6'));var logger=require(_0xba13('0x7'))(_0xba13('0x8'));var config=require('../../config/environment');var jayson=require(_0xba13('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xba13('0xa')]=_[_0xba13('0xb')](config[_0xba13('0xa')],{'host':_0xba13('0xc'),'port':0x18eb});var socket=require(_0xba13('0xd'))(new Redis(config[_0xba13('0xa')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x57a7dd,_0x558b97,_0x3df9b2){return new BPromise(function(_0x48b991,_0x1dea5c){return client[_0xba13('0xe')](_0x57a7dd,_0x3df9b2)[_0xba13('0xf')](function(_0x9a0c0e){logger[_0xba13('0x10')](_0xba13('0x11'),_0x558b97,_0xba13('0x12'));logger[_0xba13('0x13')](_0xba13('0x14'),_0x558b97,_0xba13('0x12'),JSON['stringify'](_0x9a0c0e));if(_0x9a0c0e[_0xba13('0x15')]){if(_0x9a0c0e['error']['code']===0x1f4){logger[_0xba13('0x15')](_0xba13('0x11'),_0x558b97,_0x9a0c0e[_0xba13('0x15')]['message']);return _0x1dea5c(_0x9a0c0e['error'][_0xba13('0x16')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x558b97,_0x9a0c0e[_0xba13('0x15')][_0xba13('0x16')]);return _0x48b991(_0x9a0c0e[_0xba13('0x15')][_0xba13('0x16')]);}else{logger[_0xba13('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x558b97,'request\x20sent');_0x48b991(_0x9a0c0e[_0xba13('0x17')][_0xba13('0x16')]);}})[_0xba13('0x18')](function(_0x270825){logger[_0xba13('0x15')](_0xba13('0x11'),_0x558b97,_0x270825);_0x1dea5c(_0x270825);});});}exports[_0xba13('0x19')]=function(_0x4b6ab1){var _0x3c1207=this;return new Promise(function(_0x40ac4c,_0x507eb1){return db[_0xba13('0x1a')][_0xba13('0x1b')](_0x4b6ab1[_0xba13('0x1c')],{'raw':_0x4b6ab1[_0xba13('0x1d')]?_0x4b6ab1['options'][_0xba13('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6ab1[_0xba13('0x1d')]?_0x4b6ab1[_0xba13('0x1d')][_0xba13('0x1f')]||null:null,'attributes':_0x4b6ab1[_0xba13('0x1d')]?_0x4b6ab1[_0xba13('0x1d')][_0xba13('0x20')]||null:null,'limit':_0x4b6ab1[_0xba13('0x1d')]?_0x4b6ab1[_0xba13('0x1d')][_0xba13('0x21')]||null:null})[_0xba13('0xf')](function(_0x3f77a5){logger[_0xba13('0x10')](_0xba13('0x19'),_0x4b6ab1);logger['debug']('UpdateChatInteraction',_0x4b6ab1,JSON[_0xba13('0x22')](_0x3f77a5));_0x40ac4c(_0x3f77a5);})['catch'](function(_0x20d094){logger[_0xba13('0x15')](_0xba13('0x19'),_0x20d094['message'],_0x4b6ab1);_0x507eb1(_0x3c1207[_0xba13('0x15')](0x1f4,_0x20d094[_0xba13('0x16')]));});});};exports[_0xba13('0x23')]=function(_0xc58ad3){return new Promise(function(_0x107b53,_0x24b3c3){return db[_0xba13('0x1a')][_0xba13('0x24')]({'where':_0xc58ad3[_0xba13('0x1d')]?_0xc58ad3[_0xba13('0x1d')][_0xba13('0x1f')]||null:null})['then'](function(_0x53509b){if(_0x53509b){return _0x53509b[_0xba13('0x25')](_0xc58ad3['body'][_0xba13('0x26')],_[_0xba13('0x27')](_0xc58ad3[_0xba13('0x1c')],['ids','id'])||{});}})['spread'](function(_0x47fb83){logger[_0xba13('0x10')](_0xba13('0x28'),_0xc58ad3);logger[_0xba13('0x13')](_0xba13('0x28'),_0xc58ad3,JSON['stringify'](_0x47fb83));_0x107b53(_0x47fb83);})[_0xba13('0x18')](function(_0x325255){logger[_0xba13('0x15')](_0xba13('0x28'),_0x325255['message'],_0xc58ad3);_0x24b3c3(_this[_0xba13('0x15')](0x1f4,_0x325255[_0xba13('0x16')]));});});}; \ No newline at end of file +var _0x04dd=['defaults','socket.io-emitter','redis','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','then','catch','AddTagsToChatInteraction','find','ids','body','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x04dd,0x166));var _0xd04d=function(_0x4b634f,_0x4c0372){_0x4b634f=_0x4b634f-0x0;var _0x302e3c=_0x04dd[_0x4b634f];return _0x302e3c;};'use strict';var _=require(_0xd04d('0x0'));var util=require(_0xd04d('0x1'));var moment=require(_0xd04d('0x2'));var BPromise=require(_0xd04d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd04d('0x4'));var db=require(_0xd04d('0x5'))['db'];var utils=require(_0xd04d('0x6'));var logger=require('../../config/logger')(_0xd04d('0x7'));var config=require(_0xd04d('0x8'));var jayson=require(_0xd04d('0x9'));var client=jayson['client'][_0xd04d('0xa')]({'port':0x232a});config['redis']=_[_0xd04d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd04d('0xc'))(new Redis(config[_0xd04d('0xd')]));require(_0xd04d('0xe'))[_0xd04d('0xf')](socket);function respondWithRpcPromise(_0x50f97f,_0x15569a,_0x982910){return new BPromise(function(_0x4fa506,_0x3c0fc4){return client[_0xd04d('0x10')](_0x50f97f,_0x982910)['then'](function(_0xc4646e){logger['info'](_0xd04d('0x11'),_0x15569a,'request\x20sent');logger[_0xd04d('0x12')](_0xd04d('0x13'),_0x15569a,_0xd04d('0x14'),JSON[_0xd04d('0x15')](_0xc4646e));if(_0xc4646e[_0xd04d('0x16')]){if(_0xc4646e[_0xd04d('0x16')]['code']===0x1f4){logger[_0xd04d('0x16')](_0xd04d('0x11'),_0x15569a,_0xc4646e[_0xd04d('0x16')]['message']);return _0x3c0fc4(_0xc4646e[_0xd04d('0x16')][_0xd04d('0x17')]);}logger[_0xd04d('0x16')](_0xd04d('0x11'),_0x15569a,_0xc4646e['error'][_0xd04d('0x17')]);return _0x4fa506(_0xc4646e['error'][_0xd04d('0x17')]);}else{logger[_0xd04d('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x15569a,'request\x20sent');_0x4fa506(_0xc4646e[_0xd04d('0x19')][_0xd04d('0x17')]);}})['catch'](function(_0x3c4e60){logger['error'](_0xd04d('0x11'),_0x15569a,_0x3c4e60);_0x3c0fc4(_0x3c4e60);});});}exports[_0xd04d('0x1a')]=function(_0x46f546){var _0x58fa55=this;return new Promise(function(_0x1e6131,_0x3c2b46){return db[_0xd04d('0x1b')][_0xd04d('0x1c')](_0x46f546['body'],{'raw':_0x46f546[_0xd04d('0x1d')]?_0x46f546['options'][_0xd04d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46f546[_0xd04d('0x1d')]?_0x46f546[_0xd04d('0x1d')][_0xd04d('0x1f')]||null:null,'attributes':_0x46f546[_0xd04d('0x1d')]?_0x46f546[_0xd04d('0x1d')][_0xd04d('0x20')]||null:null,'limit':_0x46f546[_0xd04d('0x1d')]?_0x46f546['options'][_0xd04d('0x21')]||null:null})[_0xd04d('0x22')](function(_0x247ee9){logger[_0xd04d('0x18')]('UpdateChatInteraction',_0x46f546);logger['debug']('UpdateChatInteraction',_0x46f546,JSON[_0xd04d('0x15')](_0x247ee9));_0x1e6131(_0x247ee9);})[_0xd04d('0x23')](function(_0x35e3f1){logger['error'](_0xd04d('0x1a'),_0x35e3f1[_0xd04d('0x17')],_0x46f546);_0x3c2b46(_0x58fa55[_0xd04d('0x16')](0x1f4,_0x35e3f1[_0xd04d('0x17')]));});});};exports[_0xd04d('0x24')]=function(_0x2c13fe){return new Promise(function(_0x4adba5,_0x499740){return db[_0xd04d('0x1b')][_0xd04d('0x25')]({'where':_0x2c13fe[_0xd04d('0x1d')]?_0x2c13fe[_0xd04d('0x1d')][_0xd04d('0x1f')]||null:null})['then'](function(_0x439a10){if(_0x439a10){return _0x439a10['addTags'](_0x2c13fe['body'][_0xd04d('0x26')],_['omit'](_0x2c13fe[_0xd04d('0x27')],[_0xd04d('0x26'),'id'])||{});}})['spread'](function(_0x243390){logger['info'](_0xd04d('0x28'),_0x2c13fe);logger['debug'](_0xd04d('0x28'),_0x2c13fe,JSON[_0xd04d('0x15')](_0x243390));_0x4adba5(_0x243390);})[_0xd04d('0x23')](function(_0x590504){logger[_0xd04d('0x16')](_0xd04d('0x28'),_0x590504[_0xd04d('0x17')],_0x2c13fe);_0x499740(_this['error'](0x1f4,_0x590504[_0xd04d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8192874..1941198 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 _0xefbd=['removeListener','length','chatInteraction:','./chatInteraction.events','save','update','emit'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xefbd,0x15a));var _0xdefb=function(_0x284f88,_0x11c365){_0x284f88=_0x284f88-0x0;var _0x9e89a7=_0xefbd[_0x284f88];return _0x9e89a7;};'use strict';var ChatInteractionEvents=require(_0xdefb('0x0'));var events=[_0xdefb('0x1'),'remove',_0xdefb('0x2')];function createListener(_0x5c489c,_0x402325){return function(_0x4780de){_0x402325[_0xdefb('0x3')](_0x5c489c,_0x4780de);};}function removeListener(_0x7c5dbd,_0x163ca1){return function(){ChatInteractionEvents[_0xdefb('0x4')](_0x7c5dbd,_0x163ca1);};}exports['register']=function(_0x1e3d1c){for(var _0x2adbc3=0x0,_0x4e932d=events[_0xdefb('0x5')];_0x2adbc3<_0x4e932d;_0x2adbc3++){var _0xe3dd5d=events[_0x2adbc3];var _0x486434=createListener(_0xdefb('0x6')+_0xe3dd5d,_0x1e3d1c);ChatInteractionEvents['on'](_0xe3dd5d,_0x486434);}}; \ No newline at end of file +var _0xe083=['chatInteraction:','./chatInteraction.events','save','update','emit','removeListener'];(function(_0xd183b4,_0x41e0c2){var _0x350756=function(_0x29ca59){while(--_0x29ca59){_0xd183b4['push'](_0xd183b4['shift']());}};_0x350756(++_0x41e0c2);}(_0xe083,0x151));var _0x3e08=function(_0x2213e4,_0x1f3877){_0x2213e4=_0x2213e4-0x0;var _0x16fe95=_0xe083[_0x2213e4];return _0x16fe95;};'use strict';var ChatInteractionEvents=require(_0x3e08('0x0'));var events=[_0x3e08('0x1'),'remove',_0x3e08('0x2')];function createListener(_0x267dac,_0x34e0e9){return function(_0xec7761){_0x34e0e9[_0x3e08('0x3')](_0x267dac,_0xec7761);};}function removeListener(_0x571ea9,_0x1d2f68){return function(){ChatInteractionEvents[_0x3e08('0x4')](_0x571ea9,_0x1d2f68);};}exports['register']=function(_0x559933){for(var _0x1e558b=0x0,_0xc7fc01=events['length'];_0x1e558b<_0xc7fc01;_0x1e558b++){var _0xbbc64d=events[_0x1e558b];var _0x1bea7e=createListener(_0x3e08('0x5')+_0xbbc64d,_0x559933);ChatInteractionEvents['on'](_0xbbc64d,_0x1bea7e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1408a8f..19d8497 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 _0xbaaa=['/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','attachmentUpload','/:id/messages','addMessage'];(function(_0x1ea439,_0x13bac7){var _0x8943d9=function(_0x524f72){while(--_0x524f72){_0x1ea439['push'](_0x1ea439['shift']());}};_0x8943d9(++_0x13bac7);}(_0xbaaa,0x1e3));var _0xabaa=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xbaaa[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0xabaa('0x0'));var util=require('util');var path=require(_0xabaa('0x1'));var timeout=require(_0xabaa('0x2'));var express=require(_0xabaa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xabaa('0x4'));var interaction=require(_0xabaa('0x5'));var config=require(_0xabaa('0x6'));var controller=require(_0xabaa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xabaa('0x8')]);router[_0xabaa('0x9')](_0xabaa('0xa'),auth['isAuthenticated'](),controller[_0xabaa('0xb')]);router[_0xabaa('0x9')](_0xabaa('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xabaa('0xd')]);router['get'](_0xabaa('0xe'),auth[_0xabaa('0xf')](),controller[_0xabaa('0x10')]);router['get']('/:id/messages',auth[_0xabaa('0x11')](),controller[_0xabaa('0x12')]);router['get'](_0xabaa('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xabaa('0x14')]);router[_0xabaa('0x9')](_0xabaa('0x15'),auth[_0xabaa('0x11')](),controller['download']);router['post']('/',auth[_0xabaa('0x11')](),controller[_0xabaa('0x16')]);router[_0xabaa('0x17')](_0xabaa('0x18'),auth[_0xabaa('0x11')](),controller[_0xabaa('0x19')]);var upload=multer({'storage':multer[_0xabaa('0x1a')]({'destination':function(_0xd62d43,_0x3cbf4d,_0x45dae8){_0x45dae8(null,path[_0xabaa('0x1b')](config['root'],_0xabaa('0x1c')));},'filename':function(_0x558dee,_0x1eb278,_0x5177ee){_0x5177ee(null,util[_0xabaa('0x1d')](_0xabaa('0x1e'),Date[_0xabaa('0x1f')](),_0x1eb278[_0xabaa('0x20')][_0xabaa('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single']('file'),controller[_0xabaa('0x22')]);router[_0xabaa('0x17')](_0xabaa('0x23'),auth['isChatInteractionAuthorized'](),controller[_0xabaa('0x24')]);router['post'](_0xabaa('0x25'),auth['isAuthenticated'](),interaction[_0xabaa('0x26')](_0xabaa('0x27'),_0xabaa('0x28')),controller['addTags']);router[_0xabaa('0x29')]('/:id',auth['isAuthenticated'](),interaction[_0xabaa('0x26')](_0xabaa('0x27'),_0xabaa('0x2a')),controller['update']);router[_0xabaa('0x29')](_0xabaa('0x2b'),controller['customUpdate']);router['put'](_0xabaa('0x2c'),auth[_0xabaa('0xf')](),controller[_0xabaa('0x2d')]);router[_0xabaa('0x29')](_0xabaa('0x2e'),controller[_0xabaa('0x2f')]);router['delete'](_0xabaa('0xc'),auth[_0xabaa('0x11')](),interaction[_0xabaa('0x26')](_0xabaa('0x27'),_0xabaa('0x30')),controller[_0xabaa('0x31')]);router['delete'](_0xabaa('0x25'),auth[_0xabaa('0x11')](),controller[_0xabaa('0x32')]);module[_0xabaa('0x33')]=router; \ No newline at end of file +var _0x7215=['root','server/files/attachments/','format','%s-%s','originalname','replace','single','addMessage','chat','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join'];(function(_0x8a3c0a,_0x48ce0d){var _0x34700b=function(_0x4616be){while(--_0x4616be){_0x8a3c0a['push'](_0x8a3c0a['shift']());}};_0x34700b(++_0x48ce0d);}(_0x7215,0x1a1));var _0x5721=function(_0x16a428,_0xf7c68f){_0x16a428=_0x16a428-0x0;var _0x4702d1=_0x7215[_0x16a428];return _0x4702d1;};'use strict';var multer=require(_0x5721('0x0'));var util=require(_0x5721('0x1'));var path=require('path');var timeout=require(_0x5721('0x2'));var express=require(_0x5721('0x3'));var router=express[_0x5721('0x4')]();var fs_extra=require(_0x5721('0x5'));var auth=require(_0x5721('0x6'));var interaction=require(_0x5721('0x7'));var config=require(_0x5721('0x8'));var controller=require(_0x5721('0x9'));router[_0x5721('0xa')]('/',auth[_0x5721('0xb')](),controller[_0x5721('0xc')]);router['get'](_0x5721('0xd'),auth[_0x5721('0xb')](),controller[_0x5721('0xe')]);router['get'](_0x5721('0xf'),auth[_0x5721('0x10')](),controller[_0x5721('0x11')]);router[_0x5721('0xa')]('/:id/attachment_download',auth[_0x5721('0x10')](),controller[_0x5721('0x12')]);router[_0x5721('0xa')](_0x5721('0x13'),auth[_0x5721('0xb')](),controller[_0x5721('0x14')]);router['get'](_0x5721('0x15'),auth[_0x5721('0x10')](),controller[_0x5721('0x16')]);router[_0x5721('0xa')](_0x5721('0x17'),auth['isAuthenticated'](),controller[_0x5721('0x18')]);router[_0x5721('0x19')]('/',auth[_0x5721('0xb')](),controller[_0x5721('0x1a')]);router[_0x5721('0x19')](_0x5721('0x1b'),auth[_0x5721('0xb')](),controller[_0x5721('0x1c')]);var upload=multer({'storage':multer[_0x5721('0x1d')]({'destination':function(_0x2ef6f5,_0x4f6394,_0x50e3e7){_0x50e3e7(null,path[_0x5721('0x1e')](config[_0x5721('0x1f')],_0x5721('0x20')));},'filename':function(_0x467b51,_0x3fef95,_0x3ec622){_0x3ec622(null,util[_0x5721('0x21')](_0x5721('0x22'),Date['now'](),_0x3fef95[_0x5721('0x23')][_0x5721('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5721('0x19')]('/:id/attachment_upload',upload[_0x5721('0x25')]('file'),controller['attachmentUpload']);router[_0x5721('0x19')](_0x5721('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x5721('0x26')]);router[_0x5721('0x19')]('/:id/tags',auth[_0x5721('0xb')](),interaction['tracked'](_0x5721('0x27'),'chatinteraction:addtags'),controller[_0x5721('0x28')]);router[_0x5721('0x29')](_0x5721('0xf'),auth['isAuthenticated'](),interaction[_0x5721('0x2a')]('chat',_0x5721('0x2b')),controller[_0x5721('0x2c')]);router[_0x5721('0x29')](_0x5721('0x2d'),controller[_0x5721('0x2e')]);router['put'](_0x5721('0x2f'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x5721('0x29')](_0x5721('0x30'),controller[_0x5721('0x31')]);router[_0x5721('0x32')](_0x5721('0xf'),auth[_0x5721('0xb')](),interaction[_0x5721('0x2a')]('chat',_0x5721('0x33')),controller[_0x5721('0x34')]);router[_0x5721('0x32')](_0x5721('0x35'),auth[_0x5721('0xb')](),controller[_0x5721('0x36')]);module[_0x5721('0x37')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 39b7938..1b87c31 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 _0xb94a=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2c9dd9,_0x50afde){var _0x79bc3d=function(_0x15ed5f){while(--_0x15ed5f){_0x2c9dd9['push'](_0x2c9dd9['shift']());}};_0x79bc3d(++_0x50afde);}(_0xb94a,0x1b4));var _0xab94=function(_0x418dd4,_0xbf647d){_0x418dd4=_0x418dd4-0x0;var _0x599cf1=_0xb94a[_0x418dd4];return _0x599cf1;};'use strict';var Sequelize=require(_0xab94('0x0'));module[_0xab94('0x1')]={'body':{'type':Sequelize[_0xab94('0x2')](_0xab94('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xab94('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xab94('0x5')]}}; \ No newline at end of file +var _0xf331=['TEXT','medium','BOOLEAN','sequelize'];(function(_0x508911,_0x231622){var _0x3ce3c0=function(_0x473dd9){while(--_0x473dd9){_0x508911['push'](_0x508911['shift']());}};_0x3ce3c0(++_0x231622);}(_0xf331,0x193));var _0x1f33=function(_0xa83647,_0x37ca7c){_0xa83647=_0xa83647-0x0;var _0x4cc92e=_0xf331[_0xa83647];return _0x4cc92e;};'use strict';var Sequelize=require(_0x1f33('0x0'));module['exports']={'body':{'type':Sequelize[_0x1f33('0x1')](_0x1f33('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f33('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fa25637..a1da8da 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 _0x41a9=['createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','userpic','online','lastLoginAt','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','intersection','attributes','fields','length','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','messages','lastMessageAt'];(function(_0x283fa4,_0x25f773){var _0x5eb53c=function(_0x2612ea){while(--_0x2612ea){_0x283fa4['push'](_0x283fa4['shift']());}};_0x5eb53c(++_0x25f773);}(_0x41a9,0x82));var _0x941a=function(_0x1d1227,_0x5bfecf){_0x1d1227=_0x1d1227-0x0;var _0x3d2ee8=_0x41a9[_0x1d1227];return _0x3d2ee8;};'use strict';var emlformat=require(_0x941a('0x0'));var rimraf=require(_0x941a('0x1'));var zipdir=require(_0x941a('0x2'));var jsonpatch=require(_0x941a('0x3'));var rp=require(_0x941a('0x4'));var moment=require(_0x941a('0x5'));var BPromise=require(_0x941a('0x6'));var Mustache=require(_0x941a('0x7'));var util=require(_0x941a('0x8'));var path=require(_0x941a('0x9'));var sox=require(_0x941a('0xa'));var csv=require(_0x941a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x941a('0xc'));var _=require('lodash');var squel=require(_0x941a('0xd'));var crypto=require(_0x941a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x941a('0xf'));var Redis=require(_0x941a('0x10'));var authService=require(_0x941a('0x11'));var qs=require(_0x941a('0x12'));var as=require(_0x941a('0x13'));var hardwareService=require(_0x941a('0x14'));var logger=require(_0x941a('0x15'))(_0x941a('0x16'));var utils=require(_0x941a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x941a('0x18')]=_[_0x941a('0x19')](config['redis'],{'host':_0x941a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x941a('0x1b'))[_0x941a('0x1c')](socket);function respondWithStatusCode(_0x49dc2d,_0x397a90){_0x397a90=_0x397a90||0xcc;return function(_0x36ff04){if(_0x36ff04){return _0x49dc2d['sendStatus'](_0x397a90);}return _0x49dc2d[_0x941a('0x1d')](_0x397a90)[_0x941a('0x1e')]();};}function respondWithResult(_0x1c278e,_0x5b5b3b){_0x5b5b3b=_0x5b5b3b||0xc8;return function(_0xbd37d2){if(_0xbd37d2){return _0x1c278e[_0x941a('0x1d')](_0x5b5b3b)[_0x941a('0x1f')](_0xbd37d2);}};}function respondWithFilteredResult(_0x4bcaa2,_0x3fb6fc){return function(_0x575eec){if(_0x575eec){var _0x17592d=typeof _0x3fb6fc['offset']===_0x941a('0x20')&&typeof _0x3fb6fc[_0x941a('0x21')]===_0x941a('0x20');var _0x11783e=_0x575eec[_0x941a('0x22')];var _0x490c18=_0x17592d?0x0:_0x3fb6fc[_0x941a('0x23')];var _0x51ae4d=_0x17592d?_0x575eec['count']:_0x3fb6fc[_0x941a('0x23')]+_0x3fb6fc['limit'];var _0x1f13e5;if(_0x51ae4d>=_0x11783e){_0x51ae4d=_0x11783e;_0x1f13e5=0xc8;}else{_0x1f13e5=0xce;}_0x4bcaa2[_0x941a('0x1d')](_0x1f13e5);return _0x4bcaa2[_0x941a('0x24')](_0x941a('0x25'),_0x490c18+'-'+_0x51ae4d+'/'+_0x11783e)[_0x941a('0x1f')](_0x575eec);}return null;};}function patchUpdates(_0xdc9146){return function(_0x11e6ff){try{jsonpatch['apply'](_0x11e6ff,_0xdc9146,!![]);}catch(_0x178463){return BPromise[_0x941a('0x26')](_0x178463);}return _0x11e6ff[_0x941a('0x27')]();};}function saveUpdates(_0x37ac8c,_0x333037){return function(_0x1ef149){if(_0x1ef149){return _0x1ef149[_0x941a('0x28')](_0x37ac8c)[_0x941a('0x29')](function(_0xbed7c8){return _0xbed7c8;});}return null;};}function removeEntity(_0x219c4c,_0xf9dd70){return function(_0x18741e){if(_0x18741e){return _0x18741e[_0x941a('0x2a')]()['then'](function(){_0x219c4c[_0x941a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c485,_0x31caf5){return function(_0x12c253){if(!_0x12c253){_0x31c485[_0x941a('0x2b')](0x194);}return _0x12c253;};}function handleError(_0x335a87,_0x489f11){_0x489f11=_0x489f11||0x1f4;return function(_0x109196){logger[_0x941a('0x2c')](_0x109196[_0x941a('0x2d')]);if(_0x109196['name']){delete _0x109196[_0x941a('0x2e')];}_0x335a87[_0x941a('0x1d')](_0x489f11)[_0x941a('0x2f')](_0x109196);};}exports[_0x941a('0x30')]=function(_0x7e8b58,_0x162571){var _0x24d354={},_0x49452b={},_0x15b7ff={'count':0x0,'rows':[]};var _0x32c3c1=_[_0x941a('0x31')](db[_0x941a('0x32')][_0x941a('0x33')],function(_0x4c57ae){return{'name':_0x4c57ae['fieldName'],'type':_0x4c57ae[_0x941a('0x34')][_0x941a('0x35')]};});_0x49452b[_0x941a('0x36')]=_[_0x941a('0x31')](_0x32c3c1,_0x941a('0x2e'));_0x49452b[_0x941a('0x37')]=_['keys'](_0x7e8b58[_0x941a('0x37')]);_0x49452b['filters']=_[_0x941a('0x38')](_0x49452b['model'],_0x49452b[_0x941a('0x37')]);_0x24d354[_0x941a('0x39')]=_[_0x941a('0x38')](_0x49452b[_0x941a('0x36')],qs[_0x941a('0x3a')](_0x7e8b58[_0x941a('0x37')][_0x941a('0x3a')]));_0x24d354[_0x941a('0x39')]=_0x24d354[_0x941a('0x39')][_0x941a('0x3b')]?_0x24d354[_0x941a('0x39')]:_0x49452b['model'];if(!_0x7e8b58[_0x941a('0x37')]['hasOwnProperty']('nolimit')){_0x24d354[_0x941a('0x21')]=qs[_0x941a('0x21')](_0x7e8b58[_0x941a('0x37')][_0x941a('0x21')]);_0x24d354[_0x941a('0x23')]=qs['offset'](_0x7e8b58['query']['offset']);}_0x24d354['order']=qs['sort'](_0x7e8b58[_0x941a('0x37')][_0x941a('0x3c')]);_0x24d354[_0x941a('0x3d')]=qs['filters'](_[_0x941a('0x3e')](_0x7e8b58[_0x941a('0x37')],_0x49452b[_0x941a('0x3f')]),_0x32c3c1);if(_0x7e8b58[_0x941a('0x37')][_0x941a('0x40')]){_0x24d354[_0x941a('0x3d')]=_[_0x941a('0x41')](_0x24d354[_0x941a('0x3d')],{'$or':_[_0x941a('0x31')](_0x32c3c1,function(_0x2f0d39){if(_0x2f0d39[_0x941a('0x34')]!==_0x941a('0x42')){var _0x37ed12={};_0x37ed12[_0x2f0d39[_0x941a('0x2e')]]={'$like':'%'+_0x7e8b58[_0x941a('0x37')]['filter']+'%'};return _0x37ed12;}})});}_0x24d354=_[_0x941a('0x41')]({},_0x24d354,_0x7e8b58['options']);var _0x3aaf63={'where':_0x24d354[_0x941a('0x3d')]};return db[_0x941a('0x32')][_0x941a('0x22')](_0x3aaf63)[_0x941a('0x29')](function(_0x1c2daf){_0x15b7ff[_0x941a('0x22')]=_0x1c2daf;if(_0x7e8b58[_0x941a('0x37')]['includeAll']){_0x24d354[_0x941a('0x43')]=[{'all':!![]}];}return db[_0x941a('0x32')][_0x941a('0x44')](_0x24d354);})[_0x941a('0x29')](function(_0x2d0ffc){_0x15b7ff[_0x941a('0x45')]=_0x2d0ffc;return _0x15b7ff;})[_0x941a('0x29')](respondWithFilteredResult(_0x162571,_0x24d354))[_0x941a('0x46')](handleError(_0x162571,null));};exports[_0x941a('0x47')]=function(_0x2074f0,_0x42aeae){var _0x2beb3a={'raw':!![],'where':{'id':_0x2074f0[_0x941a('0x48')]['id']}},_0x16c6f3={};_0x16c6f3[_0x941a('0x36')]=_[_0x941a('0x49')](db[_0x941a('0x32')]['rawAttributes']);_0x16c6f3['query']=_[_0x941a('0x49')](_0x2074f0[_0x941a('0x37')]);_0x16c6f3[_0x941a('0x3f')]=_[_0x941a('0x38')](_0x16c6f3[_0x941a('0x36')],_0x16c6f3[_0x941a('0x37')]);_0x2beb3a['attributes']=_['intersection'](_0x16c6f3[_0x941a('0x36')],qs[_0x941a('0x3a')](_0x2074f0[_0x941a('0x37')][_0x941a('0x3a')]));_0x2beb3a[_0x941a('0x39')]=_0x2beb3a[_0x941a('0x39')]['length']?_0x2beb3a[_0x941a('0x39')]:_0x16c6f3[_0x941a('0x36')];if(_0x2074f0['query'][_0x941a('0x4a')]){_0x2beb3a[_0x941a('0x43')]=[{'all':!![]}];}_0x2beb3a=_[_0x941a('0x41')]({},_0x2beb3a,_0x2074f0[_0x941a('0x4b')]);return db[_0x941a('0x32')][_0x941a('0x4c')](_0x2beb3a)[_0x941a('0x29')](handleEntityNotFound(_0x42aeae,null))[_0x941a('0x29')](respondWithResult(_0x42aeae,null))[_0x941a('0x46')](handleError(_0x42aeae,null));};exports[_0x941a('0x4d')]=function(_0x30a8fe,_0x3b0388){return db[_0x941a('0x32')][_0x941a('0x4d')](_0x30a8fe[_0x941a('0x4e')],{})[_0x941a('0x29')](respondWithResult(_0x3b0388,0xc9))[_0x941a('0x46')](handleError(_0x3b0388,null));};exports['update']=function(_0x26dd1a,_0xb16e1e){if(_0x26dd1a[_0x941a('0x4e')]['id']){delete _0x26dd1a['body']['id'];}return db[_0x941a('0x32')][_0x941a('0x4c')]({'where':{'id':_0x26dd1a[_0x941a('0x48')]['id']}})[_0x941a('0x29')](handleEntityNotFound(_0xb16e1e,null))[_0x941a('0x29')](saveUpdates(_0x26dd1a[_0x941a('0x4e')],null))[_0x941a('0x29')](respondWithResult(_0xb16e1e,null))[_0x941a('0x46')](handleError(_0xb16e1e,null));};exports[_0x941a('0x2a')]=function(_0x4ed452,_0x3524e6){return db['ChatInternalMessage'][_0x941a('0x4c')]({'where':{'id':_0x4ed452['params']['id']}})[_0x941a('0x29')](handleEntityNotFound(_0x3524e6,null))['then'](removeEntity(_0x3524e6,null))['catch'](handleError(_0x3524e6,null));};exports[_0x941a('0x4f')]=function(_0x4da4cb,_0x229ae7){return db[_0x941a('0x32')][_0x941a('0x4f')]()[_0x941a('0x29')](respondWithResult(_0x229ae7,null))[_0x941a('0x46')](handleError(_0x229ae7,null));};function wrapUser(_0x183025){return function(_0x4e464e){var _0x41b721=_0x183025['get']({'plain':!![]});_0x41b721[_0x941a('0x50')]=[];if(_0x4e464e){_0x41b721[_0x941a('0x51')]=_0x4e464e[_0x941a('0x52')];_0x41b721[_0x941a('0x53')]=_0x4e464e;}else{_0x41b721[_0x941a('0x51')]=moment(0x0)['format'](_0x941a('0x54'));_0x41b721[_0x941a('0x53')]={};}return _0x41b721;};}exports[_0x941a('0x55')]=function(_0x456b25,_0x30f1b9,_0x14d4c8){var _0x264d99=[];return db['User'][_0x941a('0x44')]({'where':{'role':[_0x941a('0x56'),'admin',_0x941a('0x57')]},'attributes':['id','fullname',_0x941a('0x2e'),'role',_0x941a('0x58'),'internal',_0x941a('0x59'),_0x941a('0x5a'),'allowmessenger',_0x941a('0x5b')],'order':qs[_0x941a('0x3c')](_0x941a('0x5c')),'include':[{'model':db[_0x941a('0x5d')],'as':'VoiceQueues','attributes':['id',_0x941a('0x2e'),_0x941a('0x34')],'through':{'attributes':[]}}]})[_0x941a('0x29')](function(_0x1fb60a){if(_0x1fb60a){var _0xce0d64=_0x456b25['user']['get']({'plain':!![]});if(!_0xce0d64)throw new Error(_0x941a('0x5e'));if(_0xce0d64[_0x941a('0x5f')]===_0x941a('0x57')){return db[_0x941a('0x60')]['find']({'where':{'name':_0x941a('0x61'),'userProfileId':_0xce0d64[_0x941a('0x62')]},'raw':!![]})[_0x941a('0x29')](function(_0xed2b04){if(_0xed2b04){if(_0xed2b04['autoAssociation']===0x0){return db[_0x941a('0x63')][_0x941a('0x44')]({'where':{'sectionId':_0xed2b04['id']},'raw':!![]})[_0x941a('0x29')](function(_0x4f407b){var _0x1920ee=[];if(_[_0x941a('0x64')](_0x4f407b)){_0x1920ee=_[_0x941a('0x40')](_0x1fb60a,function(_0x2c6a65){if(_0x2c6a65[_0x941a('0x5f')]!==_0x941a('0x56')){return _0x2c6a65;}});return _0x1920ee;}else{for(var _0x11190b=0x0;_0x11190b<_0x1fb60a[_0x941a('0x3b')];_0x11190b++){var _0xf280a0=_0x1fb60a[_0x11190b];if(_0xf280a0[_0x941a('0x5f')]===_0x941a('0x56')){var _0x2f1025=_['find'](_0x4f407b,function(_0xe42742){return _0xe42742['resourceId']===_0xf280a0['id'];});if(_0x2f1025)_0x1920ee['push'](_0xf280a0);}else{_0x1920ee[_0x941a('0x65')](_0xf280a0);}}return _0x1920ee;}});}else{return _0x1fb60a;}}else{var _0x25c49c=_[_0x941a('0x40')](_0x1fb60a,function(_0x586f72){if(_0x586f72['role']!==_0x941a('0x56')){return _0x586f72;}});return _0x25c49c;}});}else{return _0x1fb60a;}}})['then'](function(_0x1a621d){var _0x29c128=[];if(_0x1a621d){_0x264d99=_0x1a621d;for(var _0x35c5ae=0x0;_0x35c5ae<_0x1a621d[_0x941a('0x3b')];_0x35c5ae+=0x1){_0x264d99[_0x35c5ae][_0x941a('0x50')]=[];_0x29c128[_0x941a('0x65')](db[_0x941a('0x32')][_0x941a('0x4c')]({'where':{'FromId':[_0x456b25['user']['id'],_0x1a621d[_0x35c5ae]['id']],'ToId':[_0x456b25['user']['id'],_0x1a621d[_0x35c5ae]['id']],'ChatGroupId':null},'attributes':['id',_0x941a('0x52'),_0x941a('0x66'),_0x941a('0x67'),_0x941a('0x68'),_0x941a('0x4e')],'order':qs[_0x941a('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x941a('0x29')](wrapUser(_0x1a621d[_0x35c5ae])));}return BPromise[_0x941a('0x69')](_0x29c128);}return[];})[_0x941a('0x29')](function(_0x5b2863){return{'rows':_0x5b2863,'count':_0x5b2863[_0x941a('0x3b')]};})[_0x941a('0x29')](respondWithResult(_0x30f1b9,null))[_0x941a('0x46')](handleError(_0x30f1b9,null));}; \ No newline at end of file +var _0xef67=['User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','ToId','read','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','ChatInternalMessage','rawAttributes','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','show','params','options','find','create','body','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a4e0f,_0x32f7df){var _0x217ae0=function(_0x1c5633){while(--_0x1c5633){_0x2a4e0f['push'](_0x2a4e0f['shift']());}};_0x217ae0(++_0x32f7df);}(_0xef67,0x1d1));var _0x7ef6=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0xef67[_0x3cd451];return _0x571ce6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ef6('0x0'));var zipdir=require(_0x7ef6('0x1'));var jsonpatch=require(_0x7ef6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ef6('0x3'));var Mustache=require(_0x7ef6('0x4'));var util=require(_0x7ef6('0x5'));var path=require('path');var sox=require(_0x7ef6('0x6'));var csv=require(_0x7ef6('0x7'));var ejs=require(_0x7ef6('0x8'));var fs=require('fs');var fs_extra=require(_0x7ef6('0x9'));var _=require(_0x7ef6('0xa'));var squel=require(_0x7ef6('0xb'));var crypto=require('crypto');var jsforce=require(_0x7ef6('0xc'));var deskjs=require(_0x7ef6('0xd'));var toCsv=require(_0x7ef6('0x7'));var querystring=require('querystring');var Papa=require(_0x7ef6('0xe'));var Redis=require(_0x7ef6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7ef6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ef6('0x11'));var logger=require(_0x7ef6('0x12'))(_0x7ef6('0x13'));var utils=require(_0x7ef6('0x14'));var config=require(_0x7ef6('0x15'));var licenseUtil=require(_0x7ef6('0x16'));var db=require(_0x7ef6('0x17'))['db'];config[_0x7ef6('0x18')]=_['defaults'](config[_0x7ef6('0x18')],{'host':_0x7ef6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ef6('0x18')]));require('./chatInternalMessage.socket')[_0x7ef6('0x1a')](socket);function respondWithStatusCode(_0x12db36,_0xa140cf){_0xa140cf=_0xa140cf||0xcc;return function(_0x29fd48){if(_0x29fd48){return _0x12db36[_0x7ef6('0x1b')](_0xa140cf);}return _0x12db36[_0x7ef6('0x1c')](_0xa140cf)['end']();};}function respondWithResult(_0x3821b9,_0x5dbf8b){_0x5dbf8b=_0x5dbf8b||0xc8;return function(_0x2f5869){if(_0x2f5869){return _0x3821b9[_0x7ef6('0x1c')](_0x5dbf8b)[_0x7ef6('0x1d')](_0x2f5869);}};}function respondWithFilteredResult(_0x24f72c,_0x526940){return function(_0x6e1066){if(_0x6e1066){var _0x4d546e=typeof _0x526940[_0x7ef6('0x1e')]===_0x7ef6('0x1f')&&typeof _0x526940[_0x7ef6('0x20')]===_0x7ef6('0x1f');var _0x41fc71=_0x6e1066[_0x7ef6('0x21')];var _0x45c72f=_0x4d546e?0x0:_0x526940[_0x7ef6('0x1e')];var _0x4a7e0b=_0x4d546e?_0x6e1066[_0x7ef6('0x21')]:_0x526940[_0x7ef6('0x1e')]+_0x526940[_0x7ef6('0x20')];var _0x44a6e4;if(_0x4a7e0b>=_0x41fc71){_0x4a7e0b=_0x41fc71;_0x44a6e4=0xc8;}else{_0x44a6e4=0xce;}_0x24f72c['status'](_0x44a6e4);return _0x24f72c['set'](_0x7ef6('0x22'),_0x45c72f+'-'+_0x4a7e0b+'/'+_0x41fc71)[_0x7ef6('0x1d')](_0x6e1066);}return null;};}function patchUpdates(_0x60da7c){return function(_0x573872){try{jsonpatch[_0x7ef6('0x23')](_0x573872,_0x60da7c,!![]);}catch(_0x443c57){return BPromise[_0x7ef6('0x24')](_0x443c57);}return _0x573872['save']();};}function saveUpdates(_0x3d8f43,_0x4fce35){return function(_0xcd6082){if(_0xcd6082){return _0xcd6082[_0x7ef6('0x25')](_0x3d8f43)['then'](function(_0xd7b670){return _0xd7b670;});}return null;};}function removeEntity(_0x44f427,_0x18bbaa){return function(_0x41c352){if(_0x41c352){return _0x41c352[_0x7ef6('0x26')]()[_0x7ef6('0x27')](function(){_0x44f427[_0x7ef6('0x1c')](0xcc)[_0x7ef6('0x28')]();});}};}function handleEntityNotFound(_0x24a298,_0x5e20f5){return function(_0x43b52e){if(!_0x43b52e){_0x24a298[_0x7ef6('0x1b')](0x194);}return _0x43b52e;};}function handleError(_0x5ee266,_0x353178){_0x353178=_0x353178||0x1f4;return function(_0x3b8671){logger[_0x7ef6('0x29')](_0x3b8671[_0x7ef6('0x2a')]);if(_0x3b8671[_0x7ef6('0x2b')]){delete _0x3b8671[_0x7ef6('0x2b')];}_0x5ee266[_0x7ef6('0x1c')](_0x353178)[_0x7ef6('0x2c')](_0x3b8671);};}exports['index']=function(_0x12f786,_0x39dd40){var _0x21e7f9={},_0xf20612={},_0x3b20e9={'count':0x0,'rows':[]};var _0x579c7f=_[_0x7ef6('0x2d')](db[_0x7ef6('0x2e')][_0x7ef6('0x2f')],function(_0x1bf088){return{'name':_0x1bf088[_0x7ef6('0x30')],'type':_0x1bf088[_0x7ef6('0x31')][_0x7ef6('0x32')]};});_0xf20612[_0x7ef6('0x33')]=_[_0x7ef6('0x2d')](_0x579c7f,'name');_0xf20612[_0x7ef6('0x34')]=_[_0x7ef6('0x35')](_0x12f786['query']);_0xf20612[_0x7ef6('0x36')]=_[_0x7ef6('0x37')](_0xf20612['model'],_0xf20612[_0x7ef6('0x34')]);_0x21e7f9[_0x7ef6('0x38')]=_[_0x7ef6('0x37')](_0xf20612[_0x7ef6('0x33')],qs[_0x7ef6('0x39')](_0x12f786['query'][_0x7ef6('0x39')]));_0x21e7f9[_0x7ef6('0x38')]=_0x21e7f9[_0x7ef6('0x38')][_0x7ef6('0x3a')]?_0x21e7f9[_0x7ef6('0x38')]:_0xf20612['model'];if(!_0x12f786['query'][_0x7ef6('0x3b')](_0x7ef6('0x3c'))){_0x21e7f9[_0x7ef6('0x20')]=qs[_0x7ef6('0x20')](_0x12f786[_0x7ef6('0x34')]['limit']);_0x21e7f9['offset']=qs[_0x7ef6('0x1e')](_0x12f786[_0x7ef6('0x34')][_0x7ef6('0x1e')]);}_0x21e7f9[_0x7ef6('0x3d')]=qs[_0x7ef6('0x3e')](_0x12f786[_0x7ef6('0x34')][_0x7ef6('0x3e')]);_0x21e7f9['where']=qs[_0x7ef6('0x36')](_[_0x7ef6('0x3f')](_0x12f786[_0x7ef6('0x34')],_0xf20612[_0x7ef6('0x36')]),_0x579c7f);if(_0x12f786['query'][_0x7ef6('0x40')]){_0x21e7f9[_0x7ef6('0x41')]=_[_0x7ef6('0x42')](_0x21e7f9[_0x7ef6('0x41')],{'$or':_[_0x7ef6('0x2d')](_0x579c7f,function(_0x1ec8f2){if(_0x1ec8f2[_0x7ef6('0x31')]!==_0x7ef6('0x43')){var _0x3cab4e={};_0x3cab4e[_0x1ec8f2['name']]={'$like':'%'+_0x12f786[_0x7ef6('0x34')]['filter']+'%'};return _0x3cab4e;}})});}_0x21e7f9=_[_0x7ef6('0x42')]({},_0x21e7f9,_0x12f786['options']);var _0x16c280={'where':_0x21e7f9[_0x7ef6('0x41')]};return db[_0x7ef6('0x2e')][_0x7ef6('0x21')](_0x16c280)[_0x7ef6('0x27')](function(_0x1268ff){_0x3b20e9['count']=_0x1268ff;if(_0x12f786[_0x7ef6('0x34')][_0x7ef6('0x44')]){_0x21e7f9[_0x7ef6('0x45')]=[{'all':!![]}];}return db[_0x7ef6('0x2e')][_0x7ef6('0x46')](_0x21e7f9);})[_0x7ef6('0x27')](function(_0x114252){_0x3b20e9[_0x7ef6('0x47')]=_0x114252;return _0x3b20e9;})[_0x7ef6('0x27')](respondWithFilteredResult(_0x39dd40,_0x21e7f9))[_0x7ef6('0x48')](handleError(_0x39dd40,null));};exports[_0x7ef6('0x49')]=function(_0x3098e2,_0x41198c){var _0x503e42={'raw':!![],'where':{'id':_0x3098e2[_0x7ef6('0x4a')]['id']}},_0x29796f={};_0x29796f['model']=_[_0x7ef6('0x35')](db['ChatInternalMessage'][_0x7ef6('0x2f')]);_0x29796f['query']=_[_0x7ef6('0x35')](_0x3098e2[_0x7ef6('0x34')]);_0x29796f['filters']=_[_0x7ef6('0x37')](_0x29796f[_0x7ef6('0x33')],_0x29796f[_0x7ef6('0x34')]);_0x503e42[_0x7ef6('0x38')]=_[_0x7ef6('0x37')](_0x29796f[_0x7ef6('0x33')],qs['fields'](_0x3098e2[_0x7ef6('0x34')][_0x7ef6('0x39')]));_0x503e42[_0x7ef6('0x38')]=_0x503e42[_0x7ef6('0x38')][_0x7ef6('0x3a')]?_0x503e42[_0x7ef6('0x38')]:_0x29796f[_0x7ef6('0x33')];if(_0x3098e2[_0x7ef6('0x34')][_0x7ef6('0x44')]){_0x503e42['include']=[{'all':!![]}];}_0x503e42=_[_0x7ef6('0x42')]({},_0x503e42,_0x3098e2[_0x7ef6('0x4b')]);return db[_0x7ef6('0x2e')][_0x7ef6('0x4c')](_0x503e42)[_0x7ef6('0x27')](handleEntityNotFound(_0x41198c,null))['then'](respondWithResult(_0x41198c,null))[_0x7ef6('0x48')](handleError(_0x41198c,null));};exports[_0x7ef6('0x4d')]=function(_0x3b1c11,_0x22248d){return db[_0x7ef6('0x2e')]['create'](_0x3b1c11[_0x7ef6('0x4e')],{})[_0x7ef6('0x27')](respondWithResult(_0x22248d,0xc9))['catch'](handleError(_0x22248d,null));};exports[_0x7ef6('0x25')]=function(_0x33e41c,_0x4d99a5){if(_0x33e41c[_0x7ef6('0x4e')]['id']){delete _0x33e41c['body']['id'];}return db[_0x7ef6('0x2e')][_0x7ef6('0x4c')]({'where':{'id':_0x33e41c[_0x7ef6('0x4a')]['id']}})[_0x7ef6('0x27')](handleEntityNotFound(_0x4d99a5,null))[_0x7ef6('0x27')](saveUpdates(_0x33e41c[_0x7ef6('0x4e')],null))['then'](respondWithResult(_0x4d99a5,null))[_0x7ef6('0x48')](handleError(_0x4d99a5,null));};exports[_0x7ef6('0x26')]=function(_0x2b7367,_0x5176bc){return db[_0x7ef6('0x2e')]['find']({'where':{'id':_0x2b7367[_0x7ef6('0x4a')]['id']}})[_0x7ef6('0x27')](handleEntityNotFound(_0x5176bc,null))[_0x7ef6('0x27')](removeEntity(_0x5176bc,null))[_0x7ef6('0x48')](handleError(_0x5176bc,null));};exports['describe']=function(_0xcbdd49,_0x3d280b){return db[_0x7ef6('0x2e')][_0x7ef6('0x4f')]()[_0x7ef6('0x27')](respondWithResult(_0x3d280b,null))['catch'](handleError(_0x3d280b,null));};function wrapUser(_0x34ad15){return function(_0x323a52){var _0x439de1=_0x34ad15[_0x7ef6('0x50')]({'plain':!![]});_0x439de1[_0x7ef6('0x51')]=[];if(_0x323a52){_0x439de1[_0x7ef6('0x52')]=_0x323a52['createdAt'];_0x439de1[_0x7ef6('0x53')]=_0x323a52;}else{_0x439de1[_0x7ef6('0x52')]=moment(0x0)['format'](_0x7ef6('0x54'));_0x439de1[_0x7ef6('0x53')]={};}return _0x439de1;};}exports['getUsers']=function(_0x2a57ce,_0x581ce6,_0x59e1cd){var _0x518d6f=[];return db[_0x7ef6('0x55')]['findAll']({'where':{'role':[_0x7ef6('0x56'),_0x7ef6('0x57'),_0x7ef6('0x58')]},'attributes':['id',_0x7ef6('0x59'),_0x7ef6('0x2b'),_0x7ef6('0x5a'),_0x7ef6('0x5b'),'internal',_0x7ef6('0x5c'),_0x7ef6('0x5d'),_0x7ef6('0x5e'),_0x7ef6('0x5f')],'order':qs[_0x7ef6('0x3e')](_0x7ef6('0x60')),'include':[{'model':db[_0x7ef6('0x61')],'as':'VoiceQueues','attributes':['id',_0x7ef6('0x2b'),_0x7ef6('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x3ab891){if(_0x3ab891){var _0x135153=_0x2a57ce[_0x7ef6('0x58')][_0x7ef6('0x50')]({'plain':!![]});if(!_0x135153)throw new Error(_0x7ef6('0x62'));if(_0x135153[_0x7ef6('0x5a')]===_0x7ef6('0x58')){return db[_0x7ef6('0x63')]['find']({'where':{'name':_0x7ef6('0x64'),'userProfileId':_0x135153[_0x7ef6('0x65')]},'raw':!![]})['then'](function(_0x15d99c){if(_0x15d99c){if(_0x15d99c[_0x7ef6('0x66')]===0x0){return db[_0x7ef6('0x67')][_0x7ef6('0x46')]({'where':{'sectionId':_0x15d99c['id']},'raw':!![]})['then'](function(_0x3a078c){var _0x583455=[];if(_[_0x7ef6('0x68')](_0x3a078c)){_0x583455=_['filter'](_0x3ab891,function(_0x20bc7c){if(_0x20bc7c[_0x7ef6('0x5a')]!==_0x7ef6('0x56')){return _0x20bc7c;}});return _0x583455;}else{for(var _0x5613cf=0x0;_0x5613cf<_0x3ab891['length'];_0x5613cf++){var _0xd136f0=_0x3ab891[_0x5613cf];if(_0xd136f0[_0x7ef6('0x5a')]===_0x7ef6('0x56')){var _0x3a5e52=_[_0x7ef6('0x4c')](_0x3a078c,function(_0x2e837c){return _0x2e837c[_0x7ef6('0x69')]===_0xd136f0['id'];});if(_0x3a5e52)_0x583455[_0x7ef6('0x6a')](_0xd136f0);}else{_0x583455[_0x7ef6('0x6a')](_0xd136f0);}}return _0x583455;}});}else{return _0x3ab891;}}else{var _0x24604a=_[_0x7ef6('0x40')](_0x3ab891,function(_0x94747f){if(_0x94747f[_0x7ef6('0x5a')]!==_0x7ef6('0x56')){return _0x94747f;}});return _0x24604a;}});}else{return _0x3ab891;}}})[_0x7ef6('0x27')](function(_0x36239b){var _0x18e4c2=[];if(_0x36239b){_0x518d6f=_0x36239b;for(var _0x5ba415=0x0;_0x5ba415<_0x36239b[_0x7ef6('0x3a')];_0x5ba415+=0x1){_0x518d6f[_0x5ba415][_0x7ef6('0x51')]=[];_0x18e4c2['push'](db[_0x7ef6('0x2e')][_0x7ef6('0x4c')]({'where':{'FromId':[_0x2a57ce[_0x7ef6('0x58')]['id'],_0x36239b[_0x5ba415]['id']],'ToId':[_0x2a57ce[_0x7ef6('0x58')]['id'],_0x36239b[_0x5ba415]['id']],'ChatGroupId':null},'attributes':['id',_0x7ef6('0x6b'),'FromId',_0x7ef6('0x6c'),_0x7ef6('0x6d'),_0x7ef6('0x4e')],'order':qs[_0x7ef6('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x36239b[_0x5ba415])));}return BPromise['all'](_0x18e4c2);}return[];})[_0x7ef6('0x27')](function(_0x260878){return{'rows':_0x260878,'count':_0x260878[_0x7ef6('0x3a')]};})[_0x7ef6('0x27')](respondWithResult(_0x581ce6,null))[_0x7ef6('0x48')](handleError(_0x581ce6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b2e61f1..0ad2be8 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 _0x3609=['save','update','remove','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x4195dc,_0x3ec874){var _0x13281d=function(_0x18547f){while(--_0x18547f){_0x4195dc['push'](_0x4195dc['shift']());}};_0x13281d(++_0x3ec874);}(_0x3609,0x101));var _0x9360=function(_0x4a76df,_0x3a1e54){_0x4a76df=_0x4a76df-0x0;var _0x1b5da8=_0x3609[_0x4a76df];return _0x1b5da8;};'use strict';var EventEmitter=require(_0x9360('0x0'));var ChatInternalMessage=require(_0x9360('0x1'))['db'][_0x9360('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9360('0x3')](0x0);var events={'afterCreate':_0x9360('0x4'),'afterUpdate':_0x9360('0x5'),'afterDestroy':_0x9360('0x6')};function emitEvent(_0x577c1d){return function(_0x28376e,_0x24c531,_0x22133a){ChatInternalMessageEvents['emit'](_0x577c1d+':'+_0x28376e['id'],_0x28376e);ChatInternalMessageEvents['emit'](_0x577c1d,_0x28376e);_0x22133a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x9360('0x7')](e,emitEvent(event));}}module[_0x9360('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x5525=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4c6c46,_0x4d5b50){var _0x4eca5e=function(_0x2478b3){while(--_0x2478b3){_0x4c6c46['push'](_0x4c6c46['shift']());}};_0x4eca5e(++_0x4d5b50);}(_0x5525,0xda));var _0x5552=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5525[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x5552('0x0'));var ChatInternalMessage=require(_0x5552('0x1'))['db'][_0x5552('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5552('0x3')](0x0);var events={'afterCreate':_0x5552('0x4'),'afterUpdate':_0x5552('0x5'),'afterDestroy':_0x5552('0x6')};function emitEvent(_0x1b0321){return function(_0x1af1f0,_0x3f471a,_0xfe105){ChatInternalMessageEvents[_0x5552('0x7')](_0x1b0321+':'+_0x1af1f0['id'],_0x1af1f0);ChatInternalMessageEvents[_0x5552('0x7')](_0x1b0321,_0x1af1f0);_0xfe105(null);};}for(var e in events){if(events[_0x5552('0x8')](e)){var event=events[e];ChatInternalMessage[_0x5552('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ab0b33a..21ae58a 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 _0x7226=['bluebird','rimraf','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2b38a6,_0x4fbc47){var _0x118544=function(_0x530952){while(--_0x530952){_0x2b38a6['push'](_0x2b38a6['shift']());}};_0x118544(++_0x4fbc47);}(_0x7226,0xcc));var _0x6722=function(_0x4283b4,_0x1310d4){_0x4283b4=_0x4283b4-0x0;var _0x5388a3=_0x7226[_0x4283b4];return _0x5388a3;};'use strict';var _=require(_0x6722('0x0'));var util=require(_0x6722('0x1'));var logger=require(_0x6722('0x2'))(_0x6722('0x3'));var moment=require(_0x6722('0x4'));var BPromise=require(_0x6722('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6722('0x6'));var config=require('../../config/environment');var attributes=require(_0x6722('0x7'));module['exports']=function(_0x1c9015,_0x5bff8b){return _0x1c9015['define'](_0x6722('0x8'),attributes,{'tableName':_0x6722('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6722('0xa')});}; \ No newline at end of file +var _0xe274=['moment','bluebird','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x521e8f,_0x599ad3){var _0x3100d9=function(_0x3b053b){while(--_0x3b053b){_0x521e8f['push'](_0x521e8f['shift']());}};_0x3100d9(++_0x599ad3);}(_0xe274,0xbf));var _0x4e27=function(_0x4960a4,_0x1ce0ca){_0x4960a4=_0x4960a4-0x0;var _0x57e474=_0xe274[_0x4960a4];return _0x57e474;};'use strict';var _=require(_0x4e27('0x0'));var util=require(_0x4e27('0x1'));var logger=require(_0x4e27('0x2'))(_0x4e27('0x3'));var moment=require(_0x4e27('0x4'));var BPromise=require(_0x4e27('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e27('0x6'));var rimraf=require(_0x4e27('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e27('0x8'));module[_0x4e27('0x9')]=function(_0x597a4e,_0x341ad4){return _0x597a4e[_0x4e27('0xa')](_0x4e27('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4e27('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2712b69..304e461 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 _0x3ccc=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x174961,_0x45ad0f){var _0x948066=function(_0x485a84){while(--_0x485a84){_0x174961['push'](_0x174961['shift']());}};_0x948066(++_0x45ad0f);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x4217e5,_0x4b69e6){_0x4217e5=_0x4217e5-0x0;var _0xb02bc5=_0x3ccc[_0x4217e5];return _0xb02bc5;};'use strict';var _=require(_0xc3cc('0x0'));var util=require('util');var moment=require(_0xc3cc('0x1'));var BPromise=require(_0xc3cc('0x2'));var rs=require(_0xc3cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3cc('0x4'))['db'];var utils=require(_0xc3cc('0x5'));var logger=require(_0xc3cc('0x6'))(_0xc3cc('0x7'));var config=require(_0xc3cc('0x8'));var jayson=require(_0xc3cc('0x9'));var client=jayson[_0xc3cc('0xa')][_0xc3cc('0xb')]({'port':0x232a});config[_0xc3cc('0xc')]=_[_0xc3cc('0xd')](config[_0xc3cc('0xc')],{'host':_0xc3cc('0xe'),'port':0x18eb});var socket=require(_0xc3cc('0xf'))(new Redis(config['redis']));require(_0xc3cc('0x10'))[_0xc3cc('0x11')](socket);function respondWithRpcPromise(_0x1bc80e,_0x57f072,_0x3b4135){return new BPromise(function(_0x42cd4d,_0x172bd2){return client[_0xc3cc('0x12')](_0x1bc80e,_0x3b4135)[_0xc3cc('0x13')](function(_0x57feda){logger[_0xc3cc('0x14')](_0xc3cc('0x15'),_0x57f072,_0xc3cc('0x16'));logger[_0xc3cc('0x17')](_0xc3cc('0x18'),_0x57f072,_0xc3cc('0x16'),JSON[_0xc3cc('0x19')](_0x57feda));if(_0x57feda['error']){if(_0x57feda['error'][_0xc3cc('0x1a')]===0x1f4){logger[_0xc3cc('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x57f072,_0x57feda[_0xc3cc('0x1b')][_0xc3cc('0x1c')]);return _0x172bd2(_0x57feda[_0xc3cc('0x1b')][_0xc3cc('0x1c')]);}logger['error'](_0xc3cc('0x15'),_0x57f072,_0x57feda['error'][_0xc3cc('0x1c')]);return _0x42cd4d(_0x57feda['error'][_0xc3cc('0x1c')]);}else{logger['info'](_0xc3cc('0x15'),_0x57f072,_0xc3cc('0x16'));_0x42cd4d(_0x57feda[_0xc3cc('0x1d')][_0xc3cc('0x1c')]);}})[_0xc3cc('0x1e')](function(_0x2107a0){logger[_0xc3cc('0x1b')](_0xc3cc('0x15'),_0x57f072,_0x2107a0);_0x172bd2(_0x2107a0);});});} \ No newline at end of file +var _0xca0e=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x26e1ad,_0x46ca5e){var _0x2f2be5=function(_0x2e6425){while(--_0x2e6425){_0x26e1ad['push'](_0x26e1ad['shift']());}};_0x2f2be5(++_0x46ca5e);}(_0xca0e,0x1d5));var _0xeca0=function(_0x361fe8,_0x50c713){_0x361fe8=_0x361fe8-0x0;var _0x3d19d2=_0xca0e[_0x361fe8];return _0x3d19d2;};'use strict';var _=require('lodash');var util=require(_0xeca0('0x0'));var moment=require(_0xeca0('0x1'));var BPromise=require(_0xeca0('0x2'));var rs=require(_0xeca0('0x3'));var fs=require('fs');var Redis=require(_0xeca0('0x4'));var db=require(_0xeca0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeca0('0x6'));var config=require(_0xeca0('0x7'));var jayson=require(_0xeca0('0x8'));var client=jayson[_0xeca0('0x9')][_0xeca0('0xa')]({'port':0x232a});config[_0xeca0('0xb')]=_['defaults'](config['redis'],{'host':_0xeca0('0xc'),'port':0x18eb});var socket=require(_0xeca0('0xd'))(new Redis(config[_0xeca0('0xb')]));require(_0xeca0('0xe'))[_0xeca0('0xf')](socket);function respondWithRpcPromise(_0x119207,_0x5f0470,_0x13337a){return new BPromise(function(_0x46ba6a,_0x2e7a64){return client[_0xeca0('0x10')](_0x119207,_0x13337a)['then'](function(_0x506e2f){logger[_0xeca0('0x11')](_0xeca0('0x12'),_0x5f0470,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5f0470,_0xeca0('0x13'),JSON[_0xeca0('0x14')](_0x506e2f));if(_0x506e2f[_0xeca0('0x15')]){if(_0x506e2f[_0xeca0('0x15')][_0xeca0('0x16')]===0x1f4){logger[_0xeca0('0x15')](_0xeca0('0x12'),_0x5f0470,_0x506e2f[_0xeca0('0x15')]['message']);return _0x2e7a64(_0x506e2f[_0xeca0('0x15')]['message']);}logger['error'](_0xeca0('0x12'),_0x5f0470,_0x506e2f[_0xeca0('0x15')][_0xeca0('0x17')]);return _0x46ba6a(_0x506e2f[_0xeca0('0x15')][_0xeca0('0x17')]);}else{logger[_0xeca0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f0470,'request\x20sent');_0x46ba6a(_0x506e2f['result'][_0xeca0('0x17')]);}})[_0xeca0('0x18')](function(_0x4b156d){logger[_0xeca0('0x15')](_0xeca0('0x12'),_0x5f0470,_0x4b156d);_0x2e7a64(_0x4b156d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 42586ab..9910734 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 _0x713c=['emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x55587d,_0x2e13b7){var _0x440f69=function(_0x23abbd){while(--_0x23abbd){_0x55587d['push'](_0x55587d['shift']());}};_0x440f69(++_0x2e13b7);}(_0x713c,0x17e));var _0xc713=function(_0x392d3f,_0x1b5b38){_0x392d3f=_0x392d3f-0x0;var _0x1a1b7d=_0x713c[_0x392d3f];return _0x1a1b7d;};'use strict';var ChatInternalMessageEvents=require(_0xc713('0x0'));var events=[_0xc713('0x1'),'remove',_0xc713('0x2')];function createListener(_0x5cfd27,_0x2bda8){return function(_0x3db675){_0x2bda8[_0xc713('0x3')](_0x5cfd27,_0x3db675);};}function removeListener(_0x7fb8ae,_0x25f964){return function(){ChatInternalMessageEvents[_0xc713('0x4')](_0x7fb8ae,_0x25f964);};}exports[_0xc713('0x5')]=function(_0xcf86c){for(var _0x43cddc=0x0,_0x3df847=events['length'];_0x43cddc<_0x3df847;_0x43cddc++){var _0x450641=events[_0x43cddc];var _0x9ae80=createListener(_0xc713('0x6')+_0x450641,_0xcf86c);ChatInternalMessageEvents['on'](_0x450641,_0x9ae80);}}; \ No newline at end of file +var _0x2676=['remove','removeListener','register','length','chatInternalMessage:','save'];(function(_0x4caebb,_0x1c5803){var _0x4fb491=function(_0x5ca1e7){while(--_0x5ca1e7){_0x4caebb['push'](_0x4caebb['shift']());}};_0x4fb491(++_0x1c5803);}(_0x2676,0x1bb));var _0x6267=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x2676[_0x173441];return _0x2423a8;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x6267('0x0'),_0x6267('0x1'),'update'];function createListener(_0x5434de,_0x1b49ca){return function(_0x7f9ce0){_0x1b49ca['emit'](_0x5434de,_0x7f9ce0);};}function removeListener(_0x552f2e,_0x16b63d){return function(){ChatInternalMessageEvents[_0x6267('0x2')](_0x552f2e,_0x16b63d);};}exports[_0x6267('0x3')]=function(_0xf1d2){for(var _0x298fa6=0x0,_0x459077=events[_0x6267('0x4')];_0x298fa6<_0x459077;_0x298fa6++){var _0x384b7d=events[_0x298fa6];var _0x2a8831=createListener(_0x6267('0x5')+_0x384b7d,_0xf1d2);ChatInternalMessageEvents['on'](_0x384b7d,_0x2a8831);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c09b8a5..3d9337b 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 _0x40b6=['isAuthenticated','index','/describe','describe','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x40b6,0x1f1));var _0x640b=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x40b6[_0x2fd69d];return _0x5d5ef3;};'use strict';var multer=require(_0x640b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x640b('0x1'));var express=require(_0x640b('0x2'));var router=express[_0x640b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x640b('0x4'));var interaction=require(_0x640b('0x5'));var config=require(_0x640b('0x6'));var controller=require(_0x640b('0x7'));router[_0x640b('0x8')]('/',auth[_0x640b('0x9')](),controller[_0x640b('0xa')]);router[_0x640b('0x8')](_0x640b('0xb'),auth[_0x640b('0x9')](),controller[_0x640b('0xc')]);router[_0x640b('0x8')]('/users',auth[_0x640b('0x9')](),controller[_0x640b('0xd')]);router['get'](_0x640b('0xe'),auth[_0x640b('0x9')](),controller[_0x640b('0xf')]);router[_0x640b('0x10')]('/',auth[_0x640b('0x9')](),controller[_0x640b('0x11')]);router[_0x640b('0x12')](_0x640b('0xe'),controller[_0x640b('0x13')]);router[_0x640b('0x14')]('/:id',auth[_0x640b('0x9')](),controller[_0x640b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1c9d=['index','get','/describe','/users','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated'];(function(_0x521b9b,_0x2d0006){var _0x37f9ca=function(_0x4246c1){while(--_0x4246c1){_0x521b9b['push'](_0x521b9b['shift']());}};_0x37f9ca(++_0x2d0006);}(_0x1c9d,0xc9));var _0xd1c9=function(_0x8591d0,_0x1bf0eb){_0x8591d0=_0x8591d0-0x0;var _0x10d880=_0x1c9d[_0x8591d0];return _0x10d880;};'use strict';var multer=require('multer');var util=require(_0xd1c9('0x0'));var path=require(_0xd1c9('0x1'));var timeout=require(_0xd1c9('0x2'));var express=require(_0xd1c9('0x3'));var router=express['Router']();var fs_extra=require(_0xd1c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd1c9('0x5'));var config=require('../../config/environment');var controller=require(_0xd1c9('0x6'));router['get']('/',auth[_0xd1c9('0x7')](),controller[_0xd1c9('0x8')]);router[_0xd1c9('0x9')](_0xd1c9('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd1c9('0xb'),auth[_0xd1c9('0x7')](),controller['getUsers']);router[_0xd1c9('0x9')](_0xd1c9('0xc'),auth[_0xd1c9('0x7')](),controller[_0xd1c9('0xd')]);router[_0xd1c9('0xe')]('/',auth[_0xd1c9('0x7')](),controller[_0xd1c9('0xf')]);router[_0xd1c9('0x10')](_0xd1c9('0xc'),controller['update']);router['delete'](_0xd1c9('0xc'),auth['isAuthenticated'](),controller[_0xd1c9('0x11')]);module[_0xd1c9('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3161e21..ed7e2b9 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c71=['medium','BOOLEAN','out','STRING','TEXT','exports'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x0c71,0xfb));var _0x10c7=function(_0x2731e5,_0x2d4830){_0x2731e5=_0x2731e5-0x0;var _0x1f8762=_0x0c71[_0x2731e5];return _0x1f8762;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'body':{'type':Sequelize['TEXT'](_0x10c7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x10c7('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x10c7('0x4')]},'providerResponse':{'type':Sequelize[_0x10c7('0x5')]}}; \ No newline at end of file +var _0x9d5b=['BOOLEAN','out','DATE','STRING','exports','TEXT','medium'];(function(_0x41ede3,_0x596ca1){var _0x36fd02=function(_0x58df28){while(--_0x58df28){_0x41ede3['push'](_0x41ede3['shift']());}};_0x36fd02(++_0x596ca1);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x19bec0,_0x32f29e){_0x19bec0=_0x19bec0-0x0;var _0x485d31=_0x9d5b[_0x19bec0];return _0x485d31;};'use strict';var Sequelize=require('sequelize');module[_0xb9d5('0x0')]={'body':{'type':Sequelize[_0xb9d5('0x1')](_0xb9d5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb9d5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb9d5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb9d5('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb9d5('0x5')]},'providerName':{'type':Sequelize[_0xb9d5('0x6')]},'providerResponse':{'type':Sequelize[_0xb9d5('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3981adc..f206171 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 _0xc691=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','show','params','include','find','create','body','describe','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat','ChatInteraction','null','rejectMessage','sequelize','interface','motionChannel','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json'];(function(_0x367dd3,_0x59746a){var _0x3b6359=function(_0x51288e){while(--_0x51288e){_0x367dd3['push'](_0x367dd3['shift']());}};_0x3b6359(++_0x59746a);}(_0xc691,0x1d5));var _0x1c69=function(_0x3f0c9a,_0x1bfca7){_0x3f0c9a=_0x3f0c9a-0x0;var _0x58f8d2=_0xc691[_0x3f0c9a];return _0x58f8d2;};'use strict';var emlformat=require(_0x1c69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c69('0x1'));var jsonpatch=require(_0x1c69('0x2'));var rp=require(_0x1c69('0x3'));var moment=require('moment');var BPromise=require(_0x1c69('0x4'));var Mustache=require(_0x1c69('0x5'));var util=require(_0x1c69('0x6'));var path=require(_0x1c69('0x7'));var sox=require('sox');var csv=require(_0x1c69('0x8'));var ejs=require(_0x1c69('0x9'));var fs=require('fs');var fs_extra=require(_0x1c69('0xa'));var _=require(_0x1c69('0xb'));var squel=require(_0x1c69('0xc'));var crypto=require(_0x1c69('0xd'));var jsforce=require(_0x1c69('0xe'));var deskjs=require(_0x1c69('0xf'));var toCsv=require(_0x1c69('0x8'));var querystring=require(_0x1c69('0x10'));var Papa=require('papaparse');var Redis=require(_0x1c69('0x11'));var authService=require(_0x1c69('0x12'));var qs=require(_0x1c69('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c69('0x14'))(_0x1c69('0x15'));var utils=require('../../config/utils');var config=require(_0x1c69('0x16'));var licenseUtil=require(_0x1c69('0x17'));var db=require(_0x1c69('0x18'))['db'];config[_0x1c69('0x19')]=_['defaults'](config[_0x1c69('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c69('0x1a'))(new Redis(config[_0x1c69('0x19')]));require(_0x1c69('0x1b'))[_0x1c69('0x1c')](socket);var jayson=require(_0x1c69('0x1d'));var client=jayson[_0x1c69('0x1e')][_0x1c69('0x1f')]({'port':0x232c});var client9002=jayson[_0x1c69('0x1e')][_0x1c69('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x233add,_0x5637d6,_0x4c6233,_0x4def26){return new BPromise(function(_0x1237a3,_0x13f4bd){var _0xc02ad5=_0x4def26||client;return _0xc02ad5['request'](_0x233add,_0x4c6233)[_0x1c69('0x20')](function(_0x2cfb16){logger['info'](_0x1c69('0x21'),_0x5637d6,_0x1c69('0x22'));logger['debug'](_0x1c69('0x23'),_0x5637d6,_0x1c69('0x22'),JSON[_0x1c69('0x24')](_0x2cfb16));if(_0x2cfb16[_0x1c69('0x25')]){if(_0x2cfb16[_0x1c69('0x25')][_0x1c69('0x26')]===0x1f4){logger[_0x1c69('0x25')](_0x1c69('0x21'),_0x5637d6,_0x2cfb16[_0x1c69('0x25')][_0x1c69('0x27')]);return _0x13f4bd(_0x2cfb16[_0x1c69('0x25')][_0x1c69('0x27')]);}logger[_0x1c69('0x25')](_0x1c69('0x21'),_0x5637d6,_0x2cfb16['error']['message']);return _0x1237a3(_0x2cfb16[_0x1c69('0x25')][_0x1c69('0x27')]);}else{logger[_0x1c69('0x28')]('ChatMessage,\x20%s,\x20%s',_0x5637d6,'request\x20sent');_0x1237a3(_0x2cfb16[_0x1c69('0x29')][_0x1c69('0x27')]);}})[_0x1c69('0x2a')](function(_0x4aed76){logger[_0x1c69('0x25')](_0x1c69('0x21'),_0x5637d6,_0x4aed76);_0x13f4bd(_0x4aed76);});});}function respondWithStatusCode(_0x180a88,_0x507b92){_0x507b92=_0x507b92||0xcc;return function(_0x5d6020){if(_0x5d6020){return _0x180a88[_0x1c69('0x2b')](_0x507b92);}return _0x180a88[_0x1c69('0x2c')](_0x507b92)[_0x1c69('0x2d')]();};}function respondWithResult(_0x166c71,_0x55410f){_0x55410f=_0x55410f||0xc8;return function(_0x3992f3){if(_0x3992f3){return _0x166c71[_0x1c69('0x2c')](_0x55410f)[_0x1c69('0x2e')](_0x3992f3);}};}function respondWithFilteredResult(_0xad0dd0,_0x54f93f){return function(_0x9d5d6e){if(_0x9d5d6e){var _0x2cb810=typeof _0x54f93f[_0x1c69('0x2f')]===_0x1c69('0x30')&&typeof _0x54f93f['limit']===_0x1c69('0x30');var _0x3f91fe=_0x9d5d6e[_0x1c69('0x31')];var _0x3f38fb=_0x2cb810?0x0:_0x54f93f[_0x1c69('0x2f')];var _0x4ed40e=_0x2cb810?_0x9d5d6e[_0x1c69('0x31')]:_0x54f93f[_0x1c69('0x2f')]+_0x54f93f[_0x1c69('0x32')];var _0x150974;if(_0x4ed40e>=_0x3f91fe){_0x4ed40e=_0x3f91fe;_0x150974=0xc8;}else{_0x150974=0xce;}_0xad0dd0[_0x1c69('0x2c')](_0x150974);return _0xad0dd0[_0x1c69('0x33')](_0x1c69('0x34'),_0x3f38fb+'-'+_0x4ed40e+'/'+_0x3f91fe)[_0x1c69('0x2e')](_0x9d5d6e);}return null;};}function patchUpdates(_0x522fd5){return function(_0x194526){try{jsonpatch[_0x1c69('0x35')](_0x194526,_0x522fd5,!![]);}catch(_0x1b2b28){return BPromise[_0x1c69('0x36')](_0x1b2b28);}return _0x194526['save']();};}function saveUpdates(_0x1a7037,_0x53dea3){return function(_0x1e2af9){if(_0x1e2af9){return _0x1e2af9[_0x1c69('0x37')](_0x1a7037)[_0x1c69('0x20')](function(_0x451e13){return _0x451e13;});}return null;};}function removeEntity(_0xc16a3a,_0x14d00c){return function(_0x20fc82){if(_0x20fc82){return _0x20fc82[_0x1c69('0x38')]()['then'](function(){_0xc16a3a['status'](0xcc)[_0x1c69('0x2d')]();});}};}function handleEntityNotFound(_0x34d31c,_0x283aa1){return function(_0x35c9d5){if(!_0x35c9d5){_0x34d31c['sendStatus'](0x194);}return _0x35c9d5;};}function handleError(_0x2911ff,_0x343b5b){_0x343b5b=_0x343b5b||0x1f4;return function(_0x4f80b3){logger['error'](_0x4f80b3[_0x1c69('0x39')]);if(_0x4f80b3[_0x1c69('0x3a')]){delete _0x4f80b3[_0x1c69('0x3a')];}_0x2911ff[_0x1c69('0x2c')](_0x343b5b)[_0x1c69('0x3b')](_0x4f80b3);};}exports['index']=function(_0x55d99d,_0x16c673){var _0x29be61={},_0x3192d6={},_0xf72b7f={'count':0x0,'rows':[]};var _0xe7f7f2=_[_0x1c69('0x3c')](db[_0x1c69('0x3d')][_0x1c69('0x3e')],function(_0x18ad6c){return{'name':_0x18ad6c[_0x1c69('0x3f')],'type':_0x18ad6c['type'][_0x1c69('0x40')]};});_0x3192d6[_0x1c69('0x41')]=_[_0x1c69('0x3c')](_0xe7f7f2,_0x1c69('0x3a'));_0x3192d6[_0x1c69('0x42')]=_[_0x1c69('0x43')](_0x55d99d[_0x1c69('0x42')]);_0x3192d6[_0x1c69('0x44')]=_[_0x1c69('0x45')](_0x3192d6[_0x1c69('0x41')],_0x3192d6[_0x1c69('0x42')]);_0x29be61[_0x1c69('0x46')]=_['intersection'](_0x3192d6[_0x1c69('0x41')],qs[_0x1c69('0x47')](_0x55d99d[_0x1c69('0x42')][_0x1c69('0x47')]));_0x29be61[_0x1c69('0x46')]=_0x29be61[_0x1c69('0x46')][_0x1c69('0x48')]?_0x29be61[_0x1c69('0x46')]:_0x3192d6[_0x1c69('0x41')];if(!_0x55d99d[_0x1c69('0x42')][_0x1c69('0x49')](_0x1c69('0x4a'))){_0x29be61[_0x1c69('0x32')]=qs[_0x1c69('0x32')](_0x55d99d[_0x1c69('0x42')][_0x1c69('0x32')]);_0x29be61[_0x1c69('0x2f')]=qs[_0x1c69('0x2f')](_0x55d99d[_0x1c69('0x42')][_0x1c69('0x2f')]);}_0x29be61[_0x1c69('0x4b')]=qs[_0x1c69('0x4c')](_0x55d99d[_0x1c69('0x42')][_0x1c69('0x4c')]);_0x29be61[_0x1c69('0x4d')]=qs[_0x1c69('0x44')](_['pick'](_0x55d99d[_0x1c69('0x42')],_0x3192d6[_0x1c69('0x44')]),_0xe7f7f2);if(_0x55d99d[_0x1c69('0x42')][_0x1c69('0x4e')]){_0x29be61[_0x1c69('0x4d')]=_[_0x1c69('0x4f')](_0x29be61[_0x1c69('0x4d')],{'$or':_[_0x1c69('0x3c')](_0xe7f7f2,function(_0xd4793e){if(_0xd4793e['type']!==_0x1c69('0x50')){var _0x3f897c={};_0x3f897c[_0xd4793e[_0x1c69('0x3a')]]={'$like':'%'+_0x55d99d['query'][_0x1c69('0x4e')]+'%'};return _0x3f897c;}})});}_0x29be61=_[_0x1c69('0x4f')]({},_0x29be61,_0x55d99d[_0x1c69('0x51')]);var _0x583b11={'where':_0x29be61[_0x1c69('0x4d')]};return db['ChatMessage'][_0x1c69('0x31')](_0x583b11)[_0x1c69('0x20')](function(_0x264a4b){_0xf72b7f[_0x1c69('0x31')]=_0x264a4b;if(_0x55d99d['query'][_0x1c69('0x52')]){_0x29be61['include']=[{'all':!![]}];}return db[_0x1c69('0x3d')]['findAll'](_0x29be61);})['then'](function(_0x3e3b4e){_0xf72b7f['rows']=_0x3e3b4e;return _0xf72b7f;})[_0x1c69('0x20')](respondWithFilteredResult(_0x16c673,_0x29be61))[_0x1c69('0x2a')](handleError(_0x16c673,null));};exports[_0x1c69('0x53')]=function(_0x303628,_0x372a23){var _0x19d74f={'raw':!![],'where':{'id':_0x303628[_0x1c69('0x54')]['id']}},_0x1ca280={};_0x1ca280[_0x1c69('0x41')]=_[_0x1c69('0x43')](db['ChatMessage'][_0x1c69('0x3e')]);_0x1ca280[_0x1c69('0x42')]=_['keys'](_0x303628['query']);_0x1ca280[_0x1c69('0x44')]=_[_0x1c69('0x45')](_0x1ca280[_0x1c69('0x41')],_0x1ca280[_0x1c69('0x42')]);_0x19d74f['attributes']=_[_0x1c69('0x45')](_0x1ca280[_0x1c69('0x41')],qs[_0x1c69('0x47')](_0x303628['query'][_0x1c69('0x47')]));_0x19d74f['attributes']=_0x19d74f[_0x1c69('0x46')][_0x1c69('0x48')]?_0x19d74f['attributes']:_0x1ca280[_0x1c69('0x41')];if(_0x303628['query'][_0x1c69('0x52')]){_0x19d74f[_0x1c69('0x55')]=[{'all':!![]}];}_0x19d74f=_['merge']({},_0x19d74f,_0x303628[_0x1c69('0x51')]);return db[_0x1c69('0x3d')][_0x1c69('0x56')](_0x19d74f)[_0x1c69('0x20')](handleEntityNotFound(_0x372a23,null))[_0x1c69('0x20')](respondWithResult(_0x372a23,null))[_0x1c69('0x2a')](handleError(_0x372a23,null));};exports['create']=function(_0x3e2ce6,_0x2225b7){return db[_0x1c69('0x3d')][_0x1c69('0x57')](_0x3e2ce6['body'],{})[_0x1c69('0x20')](respondWithResult(_0x2225b7,0xc9))[_0x1c69('0x2a')](handleError(_0x2225b7,null));};exports[_0x1c69('0x37')]=function(_0x339fd0,_0x4535bb){if(_0x339fd0[_0x1c69('0x58')]['id']){delete _0x339fd0[_0x1c69('0x58')]['id'];}return db['ChatMessage'][_0x1c69('0x56')]({'where':{'id':_0x339fd0['params']['id']}})[_0x1c69('0x20')](handleEntityNotFound(_0x4535bb,null))[_0x1c69('0x20')](saveUpdates(_0x339fd0['body'],null))[_0x1c69('0x20')](respondWithResult(_0x4535bb,null))[_0x1c69('0x2a')](handleError(_0x4535bb,null));};exports['destroy']=function(_0x1d9e73,_0x320b4e){return db[_0x1c69('0x3d')][_0x1c69('0x56')]({'where':{'id':_0x1d9e73['params']['id']}})[_0x1c69('0x20')](handleEntityNotFound(_0x320b4e,null))[_0x1c69('0x20')](removeEntity(_0x320b4e,null))[_0x1c69('0x2a')](handleError(_0x320b4e,null));};exports[_0x1c69('0x59')]=function(_0x397931,_0x8f8369){return db[_0x1c69('0x3d')]['describe']()[_0x1c69('0x20')](respondWithResult(_0x8f8369,null))[_0x1c69('0x2a')](handleError(_0x8f8369,null));};var interaction_log=require(_0x1c69('0x14'))(_0x1c69('0x5a'));exports['accept']=function(_0x2f61b9,_0x115530,_0x4d5e74){var _0x45a819={'agent':{},'channel':'chat'};if(_0x2f61b9['body']['id']){delete _0x2f61b9['body']['id'];}_0x2f61b9['body'][_0x1c69('0x5b')]=!![];_0x2f61b9['body'][_0x1c69('0x5c')]=moment()[_0x1c69('0x5d')](_0x1c69('0x5e'));_0x2f61b9[_0x1c69('0x58')][_0x1c69('0x5f')]=_0x2f61b9[_0x1c69('0x58')][_0x1c69('0x5f')]||_0x2f61b9[_0x1c69('0x60')]['id'];_0x45a819[_0x1c69('0x61')]['id']=_0x2f61b9[_0x1c69('0x58')][_0x1c69('0x5f')];return db[_0x1c69('0x3d')][_0x1c69('0x56')]({'where':{'id':_0x2f61b9['params']['id'],'UserId':null}})[_0x1c69('0x20')](handleEntityNotFound(_0x115530,null))['then'](saveUpdates(_0x2f61b9[_0x1c69('0x58')],null))[_0x1c69('0x20')](function(_0x3453ff){if(_0x3453ff){_0x45a819[_0x1c69('0x27')]=_0x3453ff[_0x1c69('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x1c69('0x56')]({'where':{'id':_0x3453ff['ChatInteractionId']}});}return null;})[_0x1c69('0x20')](handleEntityNotFound(_0x115530,null))[_0x1c69('0x20')](function(_0x3ca5a8){if(_0x3ca5a8){return _0x3ca5a8['update']({'UserId':_0x2f61b9['body'][_0x1c69('0x5f')],'read1stAt':_['isNil'](_0x3ca5a8[_0x1c69('0x63')])?moment()[_0x1c69('0x5d')](_0x1c69('0x5e')):undefined});}return null;})[_0x1c69('0x20')](function(_0x4b384c){if(_0x4b384c){_0x45a819[_0x1c69('0x64')]=_0x4b384c[_0x1c69('0x62')]({'plain':!![]});interaction_log['info'](_0x1c69('0x65'),_0x2f61b9[_0x1c69('0x60')]['id'],_0x2f61b9['user']['name'],_0x2f61b9[_0x1c69('0x60')][_0x1c69('0x66')],_0x45a819['interaction']['id'],_0x2f61b9[_0x1c69('0x58')]?JSON[_0x1c69('0x24')](_0x2f61b9[_0x1c69('0x58')]):'null');return respondWithRpcPromise(_0x1c69('0x67'),'acceptMessage',_0x45a819);}return null;})[_0x1c69('0x20')](function(_0x298ab){var _0x225e2b=_0x1c69('0x68')+_0x298ab[_0x1c69('0x27')][_0x1c69('0x69')];return db['sequelize']['query'](_0x225e2b,{'type':db[_0x1c69('0x6a')][_0x1c69('0x6b')][_0x1c69('0x6c')],'raw':!![]})['then'](function(_0x4129da){return _0x4129da;});})[_0x1c69('0x20')](function(_0x2f6768){if(_0x2f6768){_0x45a819[_0x1c69('0x27')][_0x1c69('0x6d')]=_0x2f6768[0x0];if(!_0x2f61b9['body'][_0x1c69('0x5f')])return;return db[_0x1c69('0x6e')][_0x1c69('0x56')]({'where':{'id':_0x2f61b9[_0x1c69('0x58')][_0x1c69('0x5f')],'role':_0x1c69('0x61')},'attributes':['id',_0x1c69('0x3a'),_0x1c69('0x6f'),_0x1c69('0x70'),_0x1c69('0x71')],'raw':!![]});}return null;})[_0x1c69('0x20')](function(_0x1b5417){if(!_0x1b5417)return null;_0x45a819['message']['agent']=_0x1b5417;return _0x45a819;})['then'](function(_0xe0123d){if(_0xe0123d){if(_0x2f61b9[_0x1c69('0x58')]['manual']){_0x45a819['message']['interface']=util[_0x1c69('0x5d')](_0x1c69('0x72'),_0x2f61b9[_0x1c69('0x60')][_0x1c69('0x3a')]);_0x45a819[_0x1c69('0x27')][_0x1c69('0x73')]=_0x45a819[_0x1c69('0x73')];_0x45a819['message']['motionChannel']=_0x45a819[_0x1c69('0x73')];_0x45a819[_0x1c69('0x27')]['event']='accept';return respondWithRpcPromise(_0x1c69('0x74'),_0x1c69('0x74'),{'event':_0x1c69('0x75'),'message':_[_0x1c69('0x4f')](_0x45a819[_0x1c69('0x27')],JSON[_0x1c69('0x76')](_0x45a819['interaction'][_0x1c69('0x77')]))},client9002)[_0x1c69('0x20')](function(){return _0x45a819;});}return _0x45a819;}return null;})[_0x1c69('0x20')](respondWithResult(_0x115530,null))['catch'](handleError(_0x115530,null));};var interaction_log=require(_0x1c69('0x14'))(_0x1c69('0x5a'));exports[_0x1c69('0x36')]=function(_0x1fedc2,_0x458090,_0x182faf){var _0x47f9eb={'agent':{},'channel':_0x1c69('0x78')};if(_0x1fedc2[_0x1c69('0x58')]['id']){delete _0x1fedc2['body']['id'];}_0x1fedc2['body'][_0x1c69('0x5f')]=_0x1fedc2[_0x1c69('0x58')][_0x1c69('0x5f')]||_0x1fedc2[_0x1c69('0x60')]['id'];_0x47f9eb[_0x1c69('0x61')]['id']=_0x1fedc2[_0x1c69('0x58')][_0x1c69('0x5f')];return db['ChatMessage'][_0x1c69('0x56')]({'where':{'id':_0x1fedc2[_0x1c69('0x54')]['id'],'UserId':null}})[_0x1c69('0x20')](handleEntityNotFound(_0x458090,null))[_0x1c69('0x20')](function(_0x19f310){if(_0x19f310){_0x47f9eb[_0x1c69('0x27')]=_0x19f310[_0x1c69('0x62')]({'plain':!![]});return db[_0x1c69('0x79')]['find']({'where':{'id':_0x19f310['ChatInteractionId']}});}return null;})[_0x1c69('0x20')](handleEntityNotFound(_0x458090,null))['then'](function(_0x2f4d1d){if(_0x2f4d1d){_0x47f9eb[_0x1c69('0x64')]=_0x2f4d1d['get']({'plain':!![]});interaction_log[_0x1c69('0x28')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fedc2[_0x1c69('0x60')]['id'],_0x1fedc2[_0x1c69('0x60')]['name'],_0x1fedc2['user'][_0x1c69('0x66')],_0x47f9eb['interaction']['id'],_0x1fedc2[_0x1c69('0x58')]?JSON[_0x1c69('0x24')](_0x1fedc2['body']):_0x1c69('0x7a'));return respondWithRpcPromise('RejectMessage',_0x1c69('0x7b'),_0x47f9eb);}return null;})['then'](function(_0x4c7d6f){var _0x2e3fc3=_0x1c69('0x68')+_0x4c7d6f[_0x1c69('0x27')][_0x1c69('0x69')];return db[_0x1c69('0x7c')][_0x1c69('0x42')](_0x2e3fc3,{'type':db[_0x1c69('0x6a')][_0x1c69('0x6b')][_0x1c69('0x6c')],'raw':!![]})[_0x1c69('0x20')](function(_0x22b451){return _0x22b451;});})[_0x1c69('0x20')](function(_0x1701d4){if(_0x1701d4){_0x47f9eb['message']['contact']=_0x1701d4[0x0];if(!_0x1fedc2['body'][_0x1c69('0x5f')])return;return db[_0x1c69('0x6e')][_0x1c69('0x56')]({'where':{'id':_0x1fedc2['body'][_0x1c69('0x5f')],'role':_0x1c69('0x61')},'attributes':['id',_0x1c69('0x3a'),_0x1c69('0x6f'),_0x1c69('0x70'),_0x1c69('0x71')],'raw':!![]});}return null;})[_0x1c69('0x20')](function(_0x1b267f){if(!_0x1b267f)return null;_0x47f9eb[_0x1c69('0x27')]['agent']=_0x1b267f;return _0x47f9eb;})[_0x1c69('0x20')](function(_0x6d2bff){if(_0x6d2bff){_0x6d2bff[_0x1c69('0x27')][_0x1c69('0x7d')]=util[_0x1c69('0x5d')](_0x1c69('0x72'),_0x1fedc2[_0x1c69('0x60')][_0x1c69('0x3a')]);_0x6d2bff[_0x1c69('0x27')][_0x1c69('0x73')]=_0x47f9eb[_0x1c69('0x73')];_0x6d2bff[_0x1c69('0x27')][_0x1c69('0x7e')]=_0x47f9eb[_0x1c69('0x73')];_0x6d2bff[_0x1c69('0x27')][_0x1c69('0x7f')]=_0x1c69('0x36');respondWithRpcPromise(_0x1c69('0x74'),'EventManager',{'event':_0x1c69('0x80'),'message':_[_0x1c69('0x4f')](_0x47f9eb['message'],JSON['parse'](_0x47f9eb[_0x1c69('0x64')][_0x1c69('0x77')]))},client9002);return _0x47f9eb;}return null;})[_0x1c69('0x20')](respondWithResult(_0x458090,null))[_0x1c69('0x2a')](handleError(_0x458090,null));}; \ No newline at end of file +var _0x2191=['pick','filter','merge','options','includeAll','include','find','create','body','update','params','catch','destroy','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','ChatInteractionId','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','reject','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','sendStatus','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2191,0x142));var _0x1219=function(_0x3eccef,_0x5ed944){_0x3eccef=_0x3eccef-0x0;var _0x106be6=_0x2191[_0x3eccef];return _0x106be6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1219('0x0'));var zipdir=require(_0x1219('0x1'));var jsonpatch=require(_0x1219('0x2'));var rp=require('request-promise');var moment=require(_0x1219('0x3'));var BPromise=require(_0x1219('0x4'));var Mustache=require(_0x1219('0x5'));var util=require('util');var path=require(_0x1219('0x6'));var sox=require(_0x1219('0x7'));var csv=require('to-csv');var ejs=require(_0x1219('0x8'));var fs=require('fs');var fs_extra=require(_0x1219('0x9'));var _=require(_0x1219('0xa'));var squel=require(_0x1219('0xb'));var crypto=require(_0x1219('0xc'));var jsforce=require(_0x1219('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1219('0xe'));var Papa=require(_0x1219('0xf'));var Redis=require('ioredis');var authService=require(_0x1219('0x10'));var qs=require(_0x1219('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1219('0x12'));var logger=require(_0x1219('0x13'))(_0x1219('0x14'));var utils=require(_0x1219('0x15'));var config=require(_0x1219('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1219('0x17'))['db'];config[_0x1219('0x18')]=_[_0x1219('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1219('0x1a'))(new Redis(config[_0x1219('0x18')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x1219('0x1b'));var client=jayson[_0x1219('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22c182,_0x38ab17,_0x4da083,_0x1a1826){return new BPromise(function(_0x561f89,_0x3bfb1b){var _0xe588a1=_0x1a1826||client;return _0xe588a1[_0x1219('0x1d')](_0x22c182,_0x4da083)[_0x1219('0x1e')](function(_0x14e05d){logger[_0x1219('0x1f')](_0x1219('0x20'),_0x38ab17,_0x1219('0x21'));logger['debug'](_0x1219('0x22'),_0x38ab17,_0x1219('0x21'),JSON[_0x1219('0x23')](_0x14e05d));if(_0x14e05d[_0x1219('0x24')]){if(_0x14e05d[_0x1219('0x24')][_0x1219('0x25')]===0x1f4){logger[_0x1219('0x24')]('ChatMessage,\x20%s,\x20%s',_0x38ab17,_0x14e05d['error'][_0x1219('0x26')]);return _0x3bfb1b(_0x14e05d['error']['message']);}logger[_0x1219('0x24')](_0x1219('0x20'),_0x38ab17,_0x14e05d[_0x1219('0x24')]['message']);return _0x561f89(_0x14e05d[_0x1219('0x24')][_0x1219('0x26')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x38ab17,_0x1219('0x21'));_0x561f89(_0x14e05d[_0x1219('0x27')][_0x1219('0x26')]);}})['catch'](function(_0x242c7e){logger[_0x1219('0x24')](_0x1219('0x20'),_0x38ab17,_0x242c7e);_0x3bfb1b(_0x242c7e);});});}function respondWithStatusCode(_0x204b35,_0xc5b80c){_0xc5b80c=_0xc5b80c||0xcc;return function(_0x21ba7b){if(_0x21ba7b){return _0x204b35['sendStatus'](_0xc5b80c);}return _0x204b35[_0x1219('0x28')](_0xc5b80c)[_0x1219('0x29')]();};}function respondWithResult(_0x140bff,_0x58f1c2){_0x58f1c2=_0x58f1c2||0xc8;return function(_0x36e021){if(_0x36e021){return _0x140bff['status'](_0x58f1c2)['json'](_0x36e021);}};}function respondWithFilteredResult(_0x476592,_0x2dcebc){return function(_0x39bce8){if(_0x39bce8){var _0x12847f=typeof _0x2dcebc[_0x1219('0x2a')]==='undefined'&&typeof _0x2dcebc[_0x1219('0x2b')]===_0x1219('0x2c');var _0x37152b=_0x39bce8[_0x1219('0x2d')];var _0x5ce5a5=_0x12847f?0x0:_0x2dcebc[_0x1219('0x2a')];var _0x31d34f=_0x12847f?_0x39bce8['count']:_0x2dcebc['offset']+_0x2dcebc['limit'];var _0x1c995c;if(_0x31d34f>=_0x37152b){_0x31d34f=_0x37152b;_0x1c995c=0xc8;}else{_0x1c995c=0xce;}_0x476592[_0x1219('0x28')](_0x1c995c);return _0x476592[_0x1219('0x2e')](_0x1219('0x2f'),_0x5ce5a5+'-'+_0x31d34f+'/'+_0x37152b)[_0x1219('0x30')](_0x39bce8);}return null;};}function patchUpdates(_0x1e97bb){return function(_0x563f4c){try{jsonpatch[_0x1219('0x31')](_0x563f4c,_0x1e97bb,!![]);}catch(_0x4fe501){return BPromise['reject'](_0x4fe501);}return _0x563f4c[_0x1219('0x32')]();};}function saveUpdates(_0x52b10d,_0x26e2fe){return function(_0x28559c){if(_0x28559c){return _0x28559c['update'](_0x52b10d)[_0x1219('0x1e')](function(_0xfa46e){return _0xfa46e;});}return null;};}function removeEntity(_0x1be527,_0x5e3cee){return function(_0x1dbcf7){if(_0x1dbcf7){return _0x1dbcf7['destroy']()[_0x1219('0x1e')](function(){_0x1be527[_0x1219('0x28')](0xcc)[_0x1219('0x29')]();});}};}function handleEntityNotFound(_0x302b5e,_0x4b4214){return function(_0x3a634b){if(!_0x3a634b){_0x302b5e[_0x1219('0x33')](0x194);}return _0x3a634b;};}function handleError(_0x31eb18,_0x30eecc){_0x30eecc=_0x30eecc||0x1f4;return function(_0x57d8ba){logger['error'](_0x57d8ba[_0x1219('0x34')]);if(_0x57d8ba[_0x1219('0x35')]){delete _0x57d8ba['name'];}_0x31eb18[_0x1219('0x28')](_0x30eecc)['send'](_0x57d8ba);};}exports[_0x1219('0x36')]=function(_0x3c3198,_0xdad36d){var _0x33f29b={},_0x364ed7={},_0x4b9ac5={'count':0x0,'rows':[]};var _0x4789b0=_[_0x1219('0x37')](db[_0x1219('0x38')][_0x1219('0x39')],function(_0x2d5eb7){return{'name':_0x2d5eb7[_0x1219('0x3a')],'type':_0x2d5eb7[_0x1219('0x3b')][_0x1219('0x3c')]};});_0x364ed7[_0x1219('0x3d')]=_[_0x1219('0x37')](_0x4789b0,_0x1219('0x35'));_0x364ed7[_0x1219('0x3e')]=_[_0x1219('0x3f')](_0x3c3198[_0x1219('0x3e')]);_0x364ed7[_0x1219('0x40')]=_[_0x1219('0x41')](_0x364ed7[_0x1219('0x3d')],_0x364ed7[_0x1219('0x3e')]);_0x33f29b[_0x1219('0x42')]=_['intersection'](_0x364ed7[_0x1219('0x3d')],qs[_0x1219('0x43')](_0x3c3198['query'][_0x1219('0x43')]));_0x33f29b[_0x1219('0x42')]=_0x33f29b[_0x1219('0x42')][_0x1219('0x44')]?_0x33f29b[_0x1219('0x42')]:_0x364ed7[_0x1219('0x3d')];if(!_0x3c3198[_0x1219('0x3e')][_0x1219('0x45')](_0x1219('0x46'))){_0x33f29b['limit']=qs[_0x1219('0x2b')](_0x3c3198[_0x1219('0x3e')][_0x1219('0x2b')]);_0x33f29b['offset']=qs[_0x1219('0x2a')](_0x3c3198[_0x1219('0x3e')]['offset']);}_0x33f29b[_0x1219('0x47')]=qs['sort'](_0x3c3198['query'][_0x1219('0x48')]);_0x33f29b[_0x1219('0x49')]=qs[_0x1219('0x40')](_[_0x1219('0x4a')](_0x3c3198[_0x1219('0x3e')],_0x364ed7[_0x1219('0x40')]),_0x4789b0);if(_0x3c3198[_0x1219('0x3e')][_0x1219('0x4b')]){_0x33f29b['where']=_[_0x1219('0x4c')](_0x33f29b['where'],{'$or':_['map'](_0x4789b0,function(_0x3c35f7){if(_0x3c35f7['type']!=='VIRTUAL'){var _0x14afb3={};_0x14afb3[_0x3c35f7[_0x1219('0x35')]]={'$like':'%'+_0x3c3198[_0x1219('0x3e')]['filter']+'%'};return _0x14afb3;}})});}_0x33f29b=_[_0x1219('0x4c')]({},_0x33f29b,_0x3c3198[_0x1219('0x4d')]);var _0x284f8d={'where':_0x33f29b[_0x1219('0x49')]};return db[_0x1219('0x38')][_0x1219('0x2d')](_0x284f8d)[_0x1219('0x1e')](function(_0x442097){_0x4b9ac5[_0x1219('0x2d')]=_0x442097;if(_0x3c3198['query'][_0x1219('0x4e')]){_0x33f29b[_0x1219('0x4f')]=[{'all':!![]}];}return db[_0x1219('0x38')]['findAll'](_0x33f29b);})[_0x1219('0x1e')](function(_0x462a03){_0x4b9ac5['rows']=_0x462a03;return _0x4b9ac5;})[_0x1219('0x1e')](respondWithFilteredResult(_0xdad36d,_0x33f29b))['catch'](handleError(_0xdad36d,null));};exports['show']=function(_0x33269b,_0x1be559){var _0xa7ffbb={'raw':!![],'where':{'id':_0x33269b['params']['id']}},_0x26b8c4={};_0x26b8c4[_0x1219('0x3d')]=_[_0x1219('0x3f')](db[_0x1219('0x38')][_0x1219('0x39')]);_0x26b8c4[_0x1219('0x3e')]=_[_0x1219('0x3f')](_0x33269b[_0x1219('0x3e')]);_0x26b8c4[_0x1219('0x40')]=_[_0x1219('0x41')](_0x26b8c4[_0x1219('0x3d')],_0x26b8c4[_0x1219('0x3e')]);_0xa7ffbb[_0x1219('0x42')]=_['intersection'](_0x26b8c4[_0x1219('0x3d')],qs['fields'](_0x33269b[_0x1219('0x3e')][_0x1219('0x43')]));_0xa7ffbb[_0x1219('0x42')]=_0xa7ffbb['attributes'][_0x1219('0x44')]?_0xa7ffbb['attributes']:_0x26b8c4[_0x1219('0x3d')];if(_0x33269b[_0x1219('0x3e')][_0x1219('0x4e')]){_0xa7ffbb[_0x1219('0x4f')]=[{'all':!![]}];}_0xa7ffbb=_['merge']({},_0xa7ffbb,_0x33269b[_0x1219('0x4d')]);return db['ChatMessage'][_0x1219('0x50')](_0xa7ffbb)[_0x1219('0x1e')](handleEntityNotFound(_0x1be559,null))[_0x1219('0x1e')](respondWithResult(_0x1be559,null))['catch'](handleError(_0x1be559,null));};exports[_0x1219('0x51')]=function(_0x2cf315,_0x36995d){return db['ChatMessage'][_0x1219('0x51')](_0x2cf315[_0x1219('0x52')],{})[_0x1219('0x1e')](respondWithResult(_0x36995d,0xc9))['catch'](handleError(_0x36995d,null));};exports[_0x1219('0x53')]=function(_0xc8254d,_0x4082b7){if(_0xc8254d[_0x1219('0x52')]['id']){delete _0xc8254d[_0x1219('0x52')]['id'];}return db[_0x1219('0x38')]['find']({'where':{'id':_0xc8254d[_0x1219('0x54')]['id']}})[_0x1219('0x1e')](handleEntityNotFound(_0x4082b7,null))[_0x1219('0x1e')](saveUpdates(_0xc8254d['body'],null))[_0x1219('0x1e')](respondWithResult(_0x4082b7,null))[_0x1219('0x55')](handleError(_0x4082b7,null));};exports[_0x1219('0x56')]=function(_0xe92855,_0x30ea6a){return db[_0x1219('0x38')][_0x1219('0x50')]({'where':{'id':_0xe92855[_0x1219('0x54')]['id']}})['then'](handleEntityNotFound(_0x30ea6a,null))[_0x1219('0x1e')](removeEntity(_0x30ea6a,null))['catch'](handleError(_0x30ea6a,null));};exports[_0x1219('0x57')]=function(_0x54aa10,_0x2926a8){return db[_0x1219('0x38')][_0x1219('0x57')]()[_0x1219('0x1e')](respondWithResult(_0x2926a8,null))['catch'](handleError(_0x2926a8,null));};var interaction_log=require(_0x1219('0x13'))(_0x1219('0x58'));exports[_0x1219('0x59')]=function(_0x5c1d88,_0x4c23d4,_0x6b687c){var _0x4c6949={'agent':{},'channel':_0x1219('0x5a')};if(_0x5c1d88[_0x1219('0x52')]['id']){delete _0x5c1d88[_0x1219('0x52')]['id'];}_0x5c1d88['body'][_0x1219('0x5b')]=!![];_0x5c1d88[_0x1219('0x52')][_0x1219('0x5c')]=moment()['format'](_0x1219('0x5d'));_0x5c1d88[_0x1219('0x52')]['UserId']=_0x5c1d88[_0x1219('0x52')]['UserId']||_0x5c1d88['user']['id'];_0x4c6949[_0x1219('0x5e')]['id']=_0x5c1d88[_0x1219('0x52')][_0x1219('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x5c1d88[_0x1219('0x54')]['id'],'UserId':null}})[_0x1219('0x1e')](handleEntityNotFound(_0x4c23d4,null))[_0x1219('0x1e')](saveUpdates(_0x5c1d88['body'],null))[_0x1219('0x1e')](function(_0x50c3bf){if(_0x50c3bf){_0x4c6949['message']=_0x50c3bf[_0x1219('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x1219('0x50')]({'where':{'id':_0x50c3bf[_0x1219('0x61')]}});}return null;})[_0x1219('0x1e')](handleEntityNotFound(_0x4c23d4,null))[_0x1219('0x1e')](function(_0x2f171b){if(_0x2f171b){return _0x2f171b[_0x1219('0x53')]({'UserId':_0x5c1d88['body'][_0x1219('0x5f')],'read1stAt':_['isNil'](_0x2f171b[_0x1219('0x62')])?moment()[_0x1219('0x63')](_0x1219('0x5d')):undefined});}return null;})[_0x1219('0x1e')](function(_0x3ded46){if(_0x3ded46){_0x4c6949[_0x1219('0x64')]=_0x3ded46[_0x1219('0x60')]({'plain':!![]});interaction_log['info'](_0x1219('0x65'),_0x5c1d88[_0x1219('0x66')]['id'],_0x5c1d88['user']['name'],_0x5c1d88[_0x1219('0x66')][_0x1219('0x67')],_0x4c6949['interaction']['id'],_0x5c1d88[_0x1219('0x52')]?JSON[_0x1219('0x23')](_0x5c1d88[_0x1219('0x52')]):'null');return respondWithRpcPromise(_0x1219('0x68'),_0x1219('0x69'),_0x4c6949);}return null;})[_0x1219('0x1e')](function(_0x36eca8){var _0x5bea0c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x36eca8[_0x1219('0x26')]['ContactId'];return db['sequelize'][_0x1219('0x3e')](_0x5bea0c,{'type':db['Sequelize'][_0x1219('0x6a')][_0x1219('0x6b')],'raw':!![]})[_0x1219('0x1e')](function(_0x57c2b2){return _0x57c2b2;});})[_0x1219('0x1e')](function(_0x396bbf){if(_0x396bbf){_0x4c6949[_0x1219('0x26')]['contact']=_0x396bbf[0x0];if(!_0x5c1d88['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x5c1d88[_0x1219('0x52')][_0x1219('0x5f')],'role':'agent'},'attributes':['id','name',_0x1219('0x6c'),_0x1219('0x6d'),_0x1219('0x6e')],'raw':!![]});}return null;})[_0x1219('0x1e')](function(_0x404ca1){if(!_0x404ca1)return null;_0x4c6949[_0x1219('0x26')][_0x1219('0x5e')]=_0x404ca1;return _0x4c6949;})[_0x1219('0x1e')](function(_0x1e71f3){if(_0x1e71f3){if(_0x5c1d88['body'][_0x1219('0x6f')]){_0x4c6949[_0x1219('0x26')][_0x1219('0x70')]=util['format'](_0x1219('0x71'),_0x5c1d88[_0x1219('0x66')][_0x1219('0x35')]);_0x4c6949[_0x1219('0x26')][_0x1219('0x72')]=_0x4c6949[_0x1219('0x72')];_0x4c6949['message'][_0x1219('0x73')]=_0x4c6949[_0x1219('0x72')];_0x4c6949[_0x1219('0x26')][_0x1219('0x74')]=_0x1219('0x59');return respondWithRpcPromise(_0x1219('0x75'),_0x1219('0x75'),{'event':_0x1219('0x76'),'message':_[_0x1219('0x4c')](_0x4c6949[_0x1219('0x26')],JSON[_0x1219('0x77')](_0x4c6949[_0x1219('0x64')][_0x1219('0x78')]))},client9002)['then'](function(){return _0x4c6949;});}return _0x4c6949;}return null;})[_0x1219('0x1e')](respondWithResult(_0x4c23d4,null))[_0x1219('0x55')](handleError(_0x4c23d4,null));};var interaction_log=require(_0x1219('0x13'))(_0x1219('0x58'));exports['reject']=function(_0x1f602e,_0x935b15,_0x18da6c){var _0x402476={'agent':{},'channel':_0x1219('0x5a')};if(_0x1f602e[_0x1219('0x52')]['id']){delete _0x1f602e['body']['id'];}_0x1f602e[_0x1219('0x52')][_0x1219('0x5f')]=_0x1f602e[_0x1219('0x52')][_0x1219('0x5f')]||_0x1f602e['user']['id'];_0x402476[_0x1219('0x5e')]['id']=_0x1f602e[_0x1219('0x52')][_0x1219('0x5f')];return db[_0x1219('0x38')]['find']({'where':{'id':_0x1f602e[_0x1219('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x935b15,null))['then'](function(_0x302bdf){if(_0x302bdf){_0x402476['message']=_0x302bdf[_0x1219('0x60')]({'plain':!![]});return db[_0x1219('0x79')][_0x1219('0x50')]({'where':{'id':_0x302bdf[_0x1219('0x61')]}});}return null;})[_0x1219('0x1e')](handleEntityNotFound(_0x935b15,null))[_0x1219('0x1e')](function(_0x514f0f){if(_0x514f0f){_0x402476[_0x1219('0x64')]=_0x514f0f[_0x1219('0x60')]({'plain':!![]});interaction_log[_0x1219('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f602e['user']['id'],_0x1f602e[_0x1219('0x66')][_0x1219('0x35')],_0x1f602e['user'][_0x1219('0x67')],_0x402476[_0x1219('0x64')]['id'],_0x1f602e[_0x1219('0x52')]?JSON[_0x1219('0x23')](_0x1f602e['body']):_0x1219('0x7a'));return respondWithRpcPromise(_0x1219('0x7b'),'rejectMessage',_0x402476);}return null;})[_0x1219('0x1e')](function(_0x41a422){var _0x5aa6af=_0x1219('0x7c')+_0x41a422[_0x1219('0x26')][_0x1219('0x7d')];return db[_0x1219('0x7e')][_0x1219('0x3e')](_0x5aa6af,{'type':db[_0x1219('0x7f')]['QueryTypes'][_0x1219('0x6b')],'raw':!![]})[_0x1219('0x1e')](function(_0x372e32){return _0x372e32;});})[_0x1219('0x1e')](function(_0x55d56b){if(_0x55d56b){_0x402476[_0x1219('0x26')][_0x1219('0x80')]=_0x55d56b[0x0];if(!_0x1f602e['body'][_0x1219('0x5f')])return;return db[_0x1219('0x81')][_0x1219('0x50')]({'where':{'id':_0x1f602e[_0x1219('0x52')][_0x1219('0x5f')],'role':_0x1219('0x5e')},'attributes':['id',_0x1219('0x35'),_0x1219('0x6c'),'email',_0x1219('0x6e')],'raw':!![]});}return null;})[_0x1219('0x1e')](function(_0xeb67e2){if(!_0xeb67e2)return null;_0x402476[_0x1219('0x26')]['agent']=_0xeb67e2;return _0x402476;})[_0x1219('0x1e')](function(_0x15bc09){if(_0x15bc09){_0x15bc09[_0x1219('0x26')][_0x1219('0x70')]=util[_0x1219('0x63')]('SIP/%s',_0x1f602e[_0x1219('0x66')][_0x1219('0x35')]);_0x15bc09[_0x1219('0x26')][_0x1219('0x72')]=_0x402476['channel'];_0x15bc09[_0x1219('0x26')][_0x1219('0x73')]=_0x402476['channel'];_0x15bc09['message'][_0x1219('0x74')]=_0x1219('0x82');respondWithRpcPromise(_0x1219('0x75'),'EventManager',{'event':_0x1219('0x83'),'message':_['merge'](_0x402476[_0x1219('0x26')],JSON[_0x1219('0x77')](_0x402476[_0x1219('0x64')][_0x1219('0x78')]))},client9002);return _0x402476;}return null;})[_0x1219('0x1e')](respondWithResult(_0x935b15,null))[_0x1219('0x55')](handleError(_0x935b15,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cf52d66..958f340 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 _0xcd26=['hook','events','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x29c844,_0x3d30ff){var _0x1f1f10=function(_0x4b6e19){while(--_0x4b6e19){_0x29c844['push'](_0x29c844['shift']());}};_0x1f1f10(++_0x3d30ff);}(_0xcd26,0x76));var _0x6cd2=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xcd26[_0x294b6];return _0x38bb97;};'use strict';var EventEmitter=require(_0x6cd2('0x0'));var ChatMessage=require(_0x6cd2('0x1'))['db'][_0x6cd2('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cd2('0x3'),'afterUpdate':_0x6cd2('0x4'),'afterDestroy':_0x6cd2('0x5')};function emitEvent(_0x27fa87){return function(_0xc526b5,_0x28d9c2,_0x489cfa){ChatMessageEvents[_0x6cd2('0x6')](_0x27fa87+':'+_0xc526b5['id'],_0xc526b5);ChatMessageEvents[_0x6cd2('0x6')](_0x27fa87,_0xc526b5);_0x489cfa(null);};}for(var e in events){if(events[_0x6cd2('0x7')](e)){var event=events[e];ChatMessage[_0x6cd2('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x9755=['save','update','remove','emit','hasOwnProperty','events','ChatMessage','setMaxListeners'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x9755,0xbd));var _0x5975=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x9755[_0x1dac7a];return _0x4cb363;};'use strict';var EventEmitter=require(_0x5975('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x5975('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5975('0x2')](0x0);var events={'afterCreate':_0x5975('0x3'),'afterUpdate':_0x5975('0x4'),'afterDestroy':_0x5975('0x5')};function emitEvent(_0x4569af){return function(_0x580ca3,_0x40330f,_0x447fb6){ChatMessageEvents['emit'](_0x4569af+':'+_0x580ca3['id'],_0x580ca3);ChatMessageEvents[_0x5975('0x6')](_0x4569af,_0x580ca3);_0x447fb6(null);};}for(var e in events){if(events[_0x5975('0x7')](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 ac4a7ca..e915fb6 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 _0x93fb=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x93fb,0x1d4));var _0xb93f=function(_0x434669,_0x4b36d3){_0x434669=_0x434669-0x0;var _0x11a825=_0x93fb[_0x434669];return _0x11a825;};'use strict';var _=require(_0xb93f('0x0'));var util=require(_0xb93f('0x1'));var logger=require(_0xb93f('0x2'))(_0xb93f('0x3'));var moment=require(_0xb93f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb93f('0x5'));var fs=require('fs');var path=require(_0xb93f('0x6'));var rimraf=require('rimraf');var config=require(_0xb93f('0x7'));var attributes=require(_0xb93f('0x8'));module[_0xb93f('0x9')]=function(_0x1e41c1,_0x24be01){return _0x1e41c1[_0xb93f('0xa')](_0xb93f('0xb'),attributes,{'tableName':_0xb93f('0xc'),'paranoid':![],'indexes':[{'name':_0xb93f('0xd'),'fields':[_0xb93f('0xe')],'type':_0xb93f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19cdb2,_0x1b5ce8,_0x1c2a42){var _0x53158f=_0x1e41c1[_0xb93f('0x10')];var _0x35c9d5=_0x19cdb2[_0xb93f('0x11')]({'plain':!![]});if(_0x35c9d5['direction'][_0xb93f('0x12')]()==='in'||_0x35c9d5[_0xb93f('0x13')]['toLowerCase']()===_0xb93f('0x14')&&!_0x35c9d5[_0xb93f('0x15')]&&!_[_0xb93f('0x16')](_0x35c9d5['UserId'])){_0x53158f[_0xb93f('0x17')][_0xb93f('0x18')]({'where':{'id':_0x35c9d5['ChatInteractionId']}})[_0xb93f('0x19')](function(_0x2342bd){if(_0x2342bd){_0x2342bd[_0xb93f('0x1a')]({'lastMsgAt':_0x35c9d5[_0xb93f('0x1b')],'lastMsgDirection':_0x35c9d5[_0xb93f('0x13')][_0xb93f('0x12')]()});}})[_0xb93f('0x1c')](function(_0x2eccae){console['error'](_0x2eccae);});}_0x1c2a42();}},'charset':_0xb93f('0x1d'),'collate':_0xb93f('0x1e')});}; \ No newline at end of file +var _0xf770=['get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','update','catch','error','utf8mb4','util','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf770,0x165));var _0x0f77=function(_0x6b70af,_0x40d74f){_0x6b70af=_0x6b70af-0x0;var _0x2d3086=_0xf770[_0x6b70af];return _0x2d3086;};'use strict';var _=require('lodash');var util=require(_0x0f77('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0f77('0x1'));var BPromise=require(_0x0f77('0x2'));var rp=require(_0x0f77('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f77('0x4'));var attributes=require(_0x0f77('0x5'));module['exports']=function(_0x47976e,_0x31721b){return _0x47976e['define'](_0x0f77('0x6'),attributes,{'tableName':_0x0f77('0x7'),'paranoid':![],'indexes':[{'name':_0x0f77('0x8'),'fields':['body'],'type':_0x0f77('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5adde9,_0x587da0,_0x359bfa){var _0x1be3ef=_0x47976e[_0x0f77('0xa')];var _0x7fab82=_0x5adde9[_0x0f77('0xb')]({'plain':!![]});if(_0x7fab82[_0x0f77('0xc')][_0x0f77('0xd')]()==='in'||_0x7fab82[_0x0f77('0xc')][_0x0f77('0xd')]()===_0x0f77('0xe')&&!_0x7fab82[_0x0f77('0xf')]&&!_['isNil'](_0x7fab82[_0x0f77('0x10')])){_0x1be3ef[_0x0f77('0x11')][_0x0f77('0x12')]({'where':{'id':_0x7fab82['ChatInteractionId']}})['then'](function(_0x41863a){if(_0x41863a){_0x41863a[_0x0f77('0x13')]({'lastMsgAt':_0x7fab82['createdAt'],'lastMsgDirection':_0x7fab82[_0x0f77('0xc')][_0x0f77('0xd')]()});}})[_0x0f77('0x14')](function(_0x4827d5){console[_0x0f77('0x15')](_0x4827d5);});}_0x359bfa();}},'charset':_0x0f77('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c9d27c4..fc137c4 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 _0x3a2c=['ChatMessage','create','body','options','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','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'];(function(_0x308777,_0x5b0742){var _0x20aa38=function(_0x2c1989){while(--_0x2c1989){_0x308777['push'](_0x308777['shift']());}};_0x20aa38(++_0x5b0742);}(_0x3a2c,0xa5));var _0xc3a2=function(_0x1271dd,_0x241ff5){_0x1271dd=_0x1271dd-0x0;var _0x25a7fc=_0x3a2c[_0x1271dd];return _0x25a7fc;};'use strict';var _=require('lodash');var util=require(_0xc3a2('0x0'));var moment=require(_0xc3a2('0x1'));var BPromise=require(_0xc3a2('0x2'));var rs=require(_0xc3a2('0x3'));var fs=require('fs');var Redis=require(_0xc3a2('0x4'));var db=require(_0xc3a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3a2('0x6'))('rpc');var config=require(_0xc3a2('0x7'));var jayson=require(_0xc3a2('0x8'));var client=jayson[_0xc3a2('0x9')][_0xc3a2('0xa')]({'port':0x232a});config[_0xc3a2('0xb')]=_[_0xc3a2('0xc')](config[_0xc3a2('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3a2('0xb')]));require('./chatMessage.socket')[_0xc3a2('0xd')](socket);function respondWithRpcPromise(_0x59531d,_0x3d5b49,_0x175842){return new BPromise(function(_0x56d73c,_0x42e389){return client[_0xc3a2('0xe')](_0x59531d,_0x175842)['then'](function(_0x14df9b){logger[_0xc3a2('0xf')]('ChatMessage,\x20%s,\x20%s',_0x3d5b49,_0xc3a2('0x10'));logger[_0xc3a2('0x11')](_0xc3a2('0x12'),_0x3d5b49,_0xc3a2('0x10'),JSON[_0xc3a2('0x13')](_0x14df9b));if(_0x14df9b[_0xc3a2('0x14')]){if(_0x14df9b[_0xc3a2('0x14')][_0xc3a2('0x15')]===0x1f4){logger[_0xc3a2('0x14')](_0xc3a2('0x16'),_0x3d5b49,_0x14df9b['error'][_0xc3a2('0x17')]);return _0x42e389(_0x14df9b['error'][_0xc3a2('0x17')]);}logger[_0xc3a2('0x14')](_0xc3a2('0x16'),_0x3d5b49,_0x14df9b[_0xc3a2('0x14')][_0xc3a2('0x17')]);return _0x56d73c(_0x14df9b[_0xc3a2('0x14')][_0xc3a2('0x17')]);}else{logger['info'](_0xc3a2('0x16'),_0x3d5b49,_0xc3a2('0x10'));_0x56d73c(_0x14df9b[_0xc3a2('0x18')]['message']);}})[_0xc3a2('0x19')](function(_0x12a4a3){logger[_0xc3a2('0x14')](_0xc3a2('0x16'),_0x3d5b49,_0x12a4a3);_0x42e389(_0x12a4a3);});});}exports[_0xc3a2('0x1a')]=function(_0xe35b6c){var _0x377945=this;return new Promise(function(_0x4c62b4,_0xe81f47){return db[_0xc3a2('0x1b')][_0xc3a2('0x1c')](_0xe35b6c[_0xc3a2('0x1d')],{'raw':_0xe35b6c[_0xc3a2('0x1e')]?_0xe35b6c['options']['raw']===undefined?!![]:![]:!![]})[_0xc3a2('0x1f')](function(_0x8cf459){logger[_0xc3a2('0xf')](_0xc3a2('0x1a'),_0xe35b6c);logger[_0xc3a2('0x11')](_0xc3a2('0x1a'),_0xe35b6c,JSON[_0xc3a2('0x13')](_0x8cf459));_0x4c62b4(_0x8cf459);})[_0xc3a2('0x19')](function(_0xf974b0){logger[_0xc3a2('0x14')](_0xc3a2('0x1a'),_0xf974b0['message'],_0xe35b6c);_0xe81f47(_0x377945[_0xc3a2('0x14')](0x1f4,_0xf974b0[_0xc3a2('0x17')]));});});}; \ No newline at end of file +var _0xf0d2=['error','code','message','info','catch','CreateChatMessage','create','body','options','raw','stringify','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xf0d2,0x1cb));var _0x2f0d=function(_0x232e93,_0x58ae43){_0x232e93=_0x232e93-0x0;var _0x1a34eb=_0xf0d2[_0x232e93];return _0x1a34eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f0d('0x0'));var fs=require('fs');var Redis=require(_0x2f0d('0x1'));var db=require(_0x2f0d('0x2'))['db'];var utils=require(_0x2f0d('0x3'));var logger=require(_0x2f0d('0x4'))(_0x2f0d('0x5'));var config=require(_0x2f0d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2f0d('0x7')][_0x2f0d('0x8')]({'port':0x232a});config[_0x2f0d('0x9')]=_[_0x2f0d('0xa')](config['redis'],{'host':_0x2f0d('0xb'),'port':0x18eb});var socket=require(_0x2f0d('0xc'))(new Redis(config['redis']));require(_0x2f0d('0xd'))[_0x2f0d('0xe')](socket);function respondWithRpcPromise(_0x3a34bb,_0x457e2b,_0x7ce7c3){return new BPromise(function(_0x267b1f,_0x56ccd4){return client[_0x2f0d('0xf')](_0x3a34bb,_0x7ce7c3)[_0x2f0d('0x10')](function(_0x595bb1){logger['info'](_0x2f0d('0x11'),_0x457e2b,_0x2f0d('0x12'));logger[_0x2f0d('0x13')](_0x2f0d('0x14'),_0x457e2b,_0x2f0d('0x12'),JSON['stringify'](_0x595bb1));if(_0x595bb1[_0x2f0d('0x15')]){if(_0x595bb1[_0x2f0d('0x15')][_0x2f0d('0x16')]===0x1f4){logger['error'](_0x2f0d('0x11'),_0x457e2b,_0x595bb1[_0x2f0d('0x15')][_0x2f0d('0x17')]);return _0x56ccd4(_0x595bb1['error'][_0x2f0d('0x17')]);}logger[_0x2f0d('0x15')](_0x2f0d('0x11'),_0x457e2b,_0x595bb1[_0x2f0d('0x15')][_0x2f0d('0x17')]);return _0x267b1f(_0x595bb1['error'][_0x2f0d('0x17')]);}else{logger[_0x2f0d('0x18')](_0x2f0d('0x11'),_0x457e2b,_0x2f0d('0x12'));_0x267b1f(_0x595bb1['result'][_0x2f0d('0x17')]);}})[_0x2f0d('0x19')](function(_0x2b712f){logger[_0x2f0d('0x15')](_0x2f0d('0x11'),_0x457e2b,_0x2b712f);_0x56ccd4(_0x2b712f);});});}exports[_0x2f0d('0x1a')]=function(_0x97907c){var _0x1b0022=this;return new Promise(function(_0x29d68f,_0x49e446){return db['ChatMessage'][_0x2f0d('0x1b')](_0x97907c[_0x2f0d('0x1c')],{'raw':_0x97907c[_0x2f0d('0x1d')]?_0x97907c[_0x2f0d('0x1d')][_0x2f0d('0x1e')]===undefined?!![]:![]:!![]})[_0x2f0d('0x10')](function(_0x346fd1){logger[_0x2f0d('0x18')](_0x2f0d('0x1a'),_0x97907c);logger[_0x2f0d('0x13')](_0x2f0d('0x1a'),_0x97907c,JSON[_0x2f0d('0x1f')](_0x346fd1));_0x29d68f(_0x346fd1);})[_0x2f0d('0x19')](function(_0x152419){logger['error'](_0x2f0d('0x1a'),_0x152419[_0x2f0d('0x17')],_0x97907c);_0x49e446(_0x1b0022[_0x2f0d('0x15')](0x1f4,_0x152419['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 243b17d..08f89b1 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 _0x37c5=['remove','update','emit','removeListener','chatMessage:','save'];(function(_0x3e93af,_0x11407a){var _0x12a7eb=function(_0x4a8cdb){while(--_0x4a8cdb){_0x3e93af['push'](_0x3e93af['shift']());}};_0x12a7eb(++_0x11407a);}(_0x37c5,0xa7));var _0x537c=function(_0x54734a,_0x2d98a3){_0x54734a=_0x54734a-0x0;var _0x377d97=_0x37c5[_0x54734a];return _0x377d97;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x537c('0x0'),_0x537c('0x1'),_0x537c('0x2')];function createListener(_0x11f076,_0x1c5b5f){return function(_0x183b59){_0x1c5b5f[_0x537c('0x3')](_0x11f076,_0x183b59);};}function removeListener(_0x42bd15,_0x2c0854){return function(){ChatMessageEvents[_0x537c('0x4')](_0x42bd15,_0x2c0854);};}exports['register']=function(_0x42c86a){for(var _0x1156f4=0x0,_0x336920=events['length'];_0x1156f4<_0x336920;_0x1156f4++){var _0x36bf4a=events[_0x1156f4];var _0x67f986=createListener(_0x537c('0x5')+_0x36bf4a,_0x42c86a);ChatMessageEvents['on'](_0x36bf4a,_0x67f986);}}; \ No newline at end of file +var _0x7da7=['save','remove','register','chatMessage:','./chatMessage.events'];(function(_0xb8ccde,_0x1fb4bc){var _0x3a4281=function(_0x35b99f){while(--_0x35b99f){_0xb8ccde['push'](_0xb8ccde['shift']());}};_0x3a4281(++_0x1fb4bc);}(_0x7da7,0x10d));var _0x77da=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x7da7[_0x3ef2d5];return _0x2fefb2;};'use strict';var ChatMessageEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){ChatMessageEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);ChatMessageEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 560946a..0c33320 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 _0xf1f3=['put','/:id','update','/:id/accept','accept','/:id/reject','destroy','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','tracked','chatmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf1f3,0xb7));var _0x3f1f=function(_0x49c000,_0x2dd609){_0x49c000=_0x49c000-0x0;var _0x158ac3=_0xf1f3[_0x49c000];return _0x158ac3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f1f('0x0'));var timeout=require('connect-timeout');var express=require(_0x3f1f('0x1'));var router=express[_0x3f1f('0x2')]();var fs_extra=require(_0x3f1f('0x3'));var auth=require(_0x3f1f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f1f('0x5'));var controller=require('./chatMessage.controller');router[_0x3f1f('0x6')]('/',auth['isAuthenticated'](),controller[_0x3f1f('0x7')]);router[_0x3f1f('0x6')](_0x3f1f('0x8'),auth[_0x3f1f('0x9')](),controller[_0x3f1f('0xa')]);router[_0x3f1f('0x6')]('/:id',auth[_0x3f1f('0x9')](),controller[_0x3f1f('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3f1f('0xc')]('chat',_0x3f1f('0xd')),controller[_0x3f1f('0xe')]);router[_0x3f1f('0xf')](_0x3f1f('0x10'),controller[_0x3f1f('0x11')]);router[_0x3f1f('0xf')](_0x3f1f('0x12'),auth[_0x3f1f('0x9')](),controller[_0x3f1f('0x13')]);router['put'](_0x3f1f('0x14'),auth[_0x3f1f('0x9')](),controller['reject']);router['delete'](_0x3f1f('0x10'),auth[_0x3f1f('0x9')](),controller[_0x3f1f('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd7ea=['/:id/accept','put','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','chat','update'];(function(_0x55cf90,_0x296681){var _0x39f6f8=function(_0x4faea3){while(--_0x4faea3){_0x55cf90['push'](_0x55cf90['shift']());}};_0x39f6f8(++_0x296681);}(_0xd7ea,0x83));var _0xad7e=function(_0x10df4c,_0x2799a2){_0x10df4c=_0x10df4c-0x0;var _0x1736d4=_0xd7ea[_0x10df4c];return _0x1736d4;};'use strict';var multer=require(_0xad7e('0x0'));var util=require('util');var path=require(_0xad7e('0x1'));var timeout=require(_0xad7e('0x2'));var express=require(_0xad7e('0x3'));var router=express[_0xad7e('0x4')]();var fs_extra=require(_0xad7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xad7e('0x6'));var config=require(_0xad7e('0x7'));var controller=require(_0xad7e('0x8'));router[_0xad7e('0x9')]('/',auth[_0xad7e('0xa')](),controller[_0xad7e('0xb')]);router['get'](_0xad7e('0xc'),auth[_0xad7e('0xa')](),controller['describe']);router[_0xad7e('0x9')](_0xad7e('0xd'),auth[_0xad7e('0xa')](),controller[_0xad7e('0xe')]);router[_0xad7e('0xf')]('/',auth[_0xad7e('0xa')](),interaction[_0xad7e('0x10')](_0xad7e('0x11'),'chatmessage:create'),controller['create']);router['put'](_0xad7e('0xd'),controller[_0xad7e('0x12')]);router['put'](_0xad7e('0x13'),auth[_0xad7e('0xa')](),controller['accept']);router[_0xad7e('0x14')]('/:id/reject',auth[_0xad7e('0xa')](),controller[_0xad7e('0x15')]);router[_0xad7e('0x16')](_0xad7e('0xd'),auth[_0xad7e('0xa')](),controller[_0xad7e('0x17')]);module[_0xad7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index aa429ca..bcc80e1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x588e90,_0x5eee6e){var _0x340d52=function(_0x1f8972){while(--_0x1f8972){_0x588e90['push'](_0x588e90['shift']());}};_0x340d52(++_0x5eee6e);}(_0xadb5,0xad));var _0x5adb=function(_0x3f8cea,_0x5bdd08){_0x3f8cea=_0x3f8cea-0x0;var _0x10c838=_0xadb5[_0x3f8cea];return _0x10c838;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x139883,_0x1a1a27){var _0xe2c58c=function(_0x530de8){while(--_0x530de8){_0x139883['push'](_0x139883['shift']());}};_0xe2c58c(++_0x1a1a27);}(_0xdb28,0x106));var _0x8db2=function(_0x29cd6b,_0x4a4878){_0x29cd6b=_0x29cd6b-0x0;var _0x1635fe=_0xdb28[_0x29cd6b];return _0x1635fe;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a146b73..c0267bc 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(_0x4a1138,_0x33b96a){var _0x44835b=function(_0x5702fb){while(--_0x5702fb){_0x4a1138['push'](_0x4a1138['shift']());}};_0x44835b(++_0x33b96a);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7a54,0x106));var _0x47a5=function(_0x457855,_0x528300){_0x457855=_0x457855-0x0;var _0xa0b76f=_0x7a54[_0x457855];return _0xa0b76f;};'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 35a4e7b..7130d55 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 _0xee20=['update','remove','emit','events','../../mysqldb','setMaxListeners','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xee20,0x1c3));var _0x0ee2=function(_0x17a7ca,_0x2a0841){_0x17a7ca=_0x17a7ca-0x0;var _0x28fdd5=_0xee20[_0x17a7ca];return _0x28fdd5;};'use strict';var EventEmitter=require(_0x0ee2('0x0'));var ChatOfflineMessage=require(_0x0ee2('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0ee2('0x2')](0x0);var events={'afterCreate':_0x0ee2('0x3'),'afterUpdate':_0x0ee2('0x4'),'afterDestroy':_0x0ee2('0x5')};function emitEvent(_0x4cf4f5){return function(_0x104fba,_0x5bb8d8,_0x543963){ChatOfflineMessageEvents['emit'](_0x4cf4f5+':'+_0x104fba['id'],_0x104fba);ChatOfflineMessageEvents[_0x0ee2('0x6')](_0x4cf4f5,_0x104fba);_0x543963(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb875=['save','update','remove','emit','../../mysqldb','ChatOfflineMessage'];(function(_0x3d292f,_0x3c56dc){var _0xbafb5c=function(_0x34e99f){while(--_0x34e99f){_0x3d292f['push'](_0x3d292f['shift']());}};_0xbafb5c(++_0x3c56dc);}(_0xb875,0x1c6));var _0x5b87=function(_0x4e2d3e,_0x59578a){_0x4e2d3e=_0x4e2d3e-0x0;var _0x3596bc=_0xb875[_0x4e2d3e];return _0x3596bc;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x5b87('0x0'))['db'][_0x5b87('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b87('0x2'),'afterUpdate':_0x5b87('0x3'),'afterDestroy':_0x5b87('0x4')};function emitEvent(_0x3c0a5b){return function(_0x27bcdf,_0x9b4732,_0x4dd4d8){ChatOfflineMessageEvents[_0x5b87('0x5')](_0x3c0a5b+':'+_0x27bcdf['id'],_0x27bcdf);ChatOfflineMessageEvents[_0x5b87('0x5')](_0x3c0a5b,_0x27bcdf);_0x4dd4d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index de9699c..291731a 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 _0x1a9f=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x17b5fd,_0x5574c9){var _0x58a2b4=function(_0x5e08ae){while(--_0x5e08ae){_0x17b5fd['push'](_0x17b5fd['shift']());}};_0x58a2b4(++_0x5574c9);}(_0x1a9f,0x1a5));var _0xf1a9=function(_0xa970d1,_0x8e9f98){_0xa970d1=_0xa970d1-0x0;var _0x4c5a31=_0x1a9f[_0xa970d1];return _0x4c5a31;};'use strict';var attributes=require(_0xf1a9('0x0'));module[_0xf1a9('0x1')]=function(_0x5439ae){return _0x5439ae[_0xf1a9('0x2')](_0xf1a9('0x3'),attributes,{'tableName':_0xf1a9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1a9('0x5'),'collate':_0xf1a9('0x6')});}; \ No newline at end of file +var _0x4866=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x4866,0x1a0));var _0x6486=function(_0x14a79a,_0x281ce9){_0x14a79a=_0x14a79a-0x0;var _0x55d55b=_0x4866[_0x14a79a];return _0x55d55b;};'use strict';var attributes=require(_0x6486('0x0'));module['exports']=function(_0x4523f6){return _0x4523f6[_0x6486('0x1')](_0x6486('0x2'),attributes,{'tableName':_0x6486('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6486('0x4'),'collate':_0x6486('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 86e19f3..e15082c 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 _0x7a6d=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x52e6c5,_0xc724a8){var _0x4de369=function(_0x2e8d39){while(--_0x2e8d39){_0x52e6c5['push'](_0x52e6c5['shift']());}};_0x4de369(++_0xc724a8);}(_0x7a6d,0x99));var _0xd7a6=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x7a6d[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0xd7a6('0x0'));var util=require(_0xd7a6('0x1'));var moment=require('moment');var BPromise=require(_0xd7a6('0x2'));var rs=require(_0xd7a6('0x3'));var fs=require('fs');var Redis=require(_0xd7a6('0x4'));var db=require(_0xd7a6('0x5'))['db'];var utils=require(_0xd7a6('0x6'));var logger=require('../../config/logger')(_0xd7a6('0x7'));var config=require(_0xd7a6('0x8'));var jayson=require(_0xd7a6('0x9'));var client=jayson[_0xd7a6('0xa')][_0xd7a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ad8e8,_0x6925d6,_0x20ecc5){return new BPromise(function(_0x18b032,_0x1dec54){return client['request'](_0x3ad8e8,_0x20ecc5)[_0xd7a6('0xc')](function(_0x23ecf8){logger[_0xd7a6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x6925d6,_0xd7a6('0xe'));logger[_0xd7a6('0xf')](_0xd7a6('0x10'),_0x6925d6,_0xd7a6('0xe'),JSON['stringify'](_0x23ecf8));if(_0x23ecf8[_0xd7a6('0x11')]){if(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x12')]===0x1f4){logger['error'](_0xd7a6('0x13'),_0x6925d6,_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);return _0x1dec54(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);}logger[_0xd7a6('0x11')](_0xd7a6('0x13'),_0x6925d6,_0x23ecf8[_0xd7a6('0x11')]['message']);return _0x18b032(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);}else{logger['info'](_0xd7a6('0x13'),_0x6925d6,_0xd7a6('0xe'));_0x18b032(_0x23ecf8[_0xd7a6('0x15')][_0xd7a6('0x14')]);}})[_0xd7a6('0x16')](function(_0x89ddec){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x6925d6,_0x89ddec);_0x1dec54(_0x89ddec);});});} \ No newline at end of file +var _0xc5dc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0x40d7ce,_0x599b4c){var _0x2ea43d=function(_0x300773){while(--_0x300773){_0x40d7ce['push'](_0x40d7ce['shift']());}};_0x2ea43d(++_0x599b4c);}(_0xc5dc,0x128));var _0xcc5d=function(_0x5cd102,_0x4345db){_0x5cd102=_0x5cd102-0x0;var _0x153275=_0xc5dc[_0x5cd102];return _0x153275;};'use strict';var _=require(_0xcc5d('0x0'));var util=require(_0xcc5d('0x1'));var moment=require(_0xcc5d('0x2'));var BPromise=require(_0xcc5d('0x3'));var rs=require(_0xcc5d('0x4'));var fs=require('fs');var Redis=require(_0xcc5d('0x5'));var db=require(_0xcc5d('0x6'))['db'];var utils=require(_0xcc5d('0x7'));var logger=require(_0xcc5d('0x8'))(_0xcc5d('0x9'));var config=require(_0xcc5d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcc5d('0xb')][_0xcc5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44026e,_0x4ddb65,_0x58c833){return new BPromise(function(_0x4a3e1f,_0xa76606){return client[_0xcc5d('0xd')](_0x44026e,_0x58c833)[_0xcc5d('0xe')](function(_0x4c8b1a){logger[_0xcc5d('0xf')](_0xcc5d('0x10'),_0x4ddb65,_0xcc5d('0x11'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4ddb65,'request\x20sent',JSON[_0xcc5d('0x12')](_0x4c8b1a));if(_0x4c8b1a[_0xcc5d('0x13')]){if(_0x4c8b1a[_0xcc5d('0x13')][_0xcc5d('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4ddb65,_0x4c8b1a['error']['message']);return _0xa76606(_0x4c8b1a[_0xcc5d('0x13')][_0xcc5d('0x15')]);}logger['error'](_0xcc5d('0x10'),_0x4ddb65,_0x4c8b1a[_0xcc5d('0x13')][_0xcc5d('0x15')]);return _0x4a3e1f(_0x4c8b1a['error'][_0xcc5d('0x15')]);}else{logger[_0xcc5d('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ddb65,_0xcc5d('0x11'));_0x4a3e1f(_0x4c8b1a[_0xcc5d('0x16')][_0xcc5d('0x15')]);}})['catch'](function(_0x4cfc3f){logger[_0xcc5d('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ddb65,_0x4cfc3f);_0xa76606(_0x4cfc3f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 35cb7da..f319db7 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 _0x9e1c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2739ad,_0x7a64c9){var _0x52bb2c=function(_0x2b8b4c){while(--_0x2b8b4c){_0x2739ad['push'](_0x2739ad['shift']());}};_0x52bb2c(++_0x7a64c9);}(_0x9e1c,0x189));var _0xc9e1=function(_0x3e1bf1,_0x6ec196){_0x3e1bf1=_0x3e1bf1-0x0;var _0x473072=_0x9e1c[_0x3e1bf1];return _0x473072;};'use strict';var multer=require(_0xc9e1('0x0'));var util=require('util');var path=require(_0xc9e1('0x1'));var timeout=require(_0xc9e1('0x2'));var express=require(_0xc9e1('0x3'));var router=express[_0xc9e1('0x4')]();var fs_extra=require(_0xc9e1('0x5'));var auth=require(_0xc9e1('0x6'));var interaction=require(_0xc9e1('0x7'));var config=require(_0xc9e1('0x8'));var controller=require(_0xc9e1('0x9'));router[_0xc9e1('0xa')]('/',auth[_0xc9e1('0xb')](),controller[_0xc9e1('0xc')]);router[_0xc9e1('0xa')](_0xc9e1('0xd'),auth[_0xc9e1('0xb')](),controller['describe']);router[_0xc9e1('0xa')](_0xc9e1('0xe'),auth[_0xc9e1('0xb')](),controller[_0xc9e1('0xf')]);router['post']('/',auth[_0xc9e1('0xb')](),controller[_0xc9e1('0x10')]);router[_0xc9e1('0x11')](_0xc9e1('0xe'),auth[_0xc9e1('0xb')](),controller[_0xc9e1('0x12')]);router[_0xc9e1('0x13')](_0xc9e1('0xe'),auth[_0xc9e1('0xb')](),controller[_0xc9e1('0x14')]);module[_0xc9e1('0x15')]=router; \ No newline at end of file +var _0x2ffd=['get','isAuthenticated','/:id','put','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index'];(function(_0x2a1c03,_0x2b372e){var _0x20642b=function(_0x51709e){while(--_0x51709e){_0x2a1c03['push'](_0x2a1c03['shift']());}};_0x20642b(++_0x2b372e);}(_0x2ffd,0x15f));var _0xd2ff=function(_0x10a2d3,_0x47c606){_0x10a2d3=_0x10a2d3-0x0;var _0x206a62=_0x2ffd[_0x10a2d3];return _0x206a62;};'use strict';var multer=require('multer');var util=require(_0xd2ff('0x0'));var path=require(_0xd2ff('0x1'));var timeout=require(_0xd2ff('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd2ff('0x3'));var auth=require(_0xd2ff('0x4'));var interaction=require(_0xd2ff('0x5'));var config=require(_0xd2ff('0x6'));var controller=require(_0xd2ff('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2ff('0x8')]);router[_0xd2ff('0x9')]('/describe',auth[_0xd2ff('0xa')](),controller['describe']);router[_0xd2ff('0x9')](_0xd2ff('0xb'),auth[_0xd2ff('0xa')](),controller['show']);router['post']('/',auth[_0xd2ff('0xa')](),controller['create']);router[_0xd2ff('0xc')]('/:id',auth[_0xd2ff('0xa')](),controller['update']);router[_0xd2ff('0xd')](_0xd2ff('0xb'),auth[_0xd2ff('0xa')](),controller['destroy']);module[_0xd2ff('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b8d807f..6df0a3c 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 _0xce3e=['timeout','STRING','INTEGER','sequelize','exports','mouseOver'];(function(_0x51f973,_0x50d12c){var _0x32a985=function(_0x280d10){while(--_0x280d10){_0x51f973['push'](_0x51f973['shift']());}};_0x32a985(++_0x50d12c);}(_0xce3e,0x16b));var _0xece3=function(_0x542705,_0x58731d){_0x542705=_0x542705-0x0;var _0x164fa1=_0xce3e[_0x542705];return _0x164fa1;};'use strict';var Sequelize=require(_0xece3('0x0'));module[_0xece3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xece3('0x2'),_0xece3('0x3')),'defaultValue':_0xece3('0x2')},'selector':{'type':Sequelize[_0xece3('0x4')]},'timeout':{'type':Sequelize[_0xece3('0x5')]}}; \ No newline at end of file +var _0xabba=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM','timeout'];(function(_0x373c6d,_0x2d8918){var _0x439db5=function(_0x523f3f){while(--_0x523f3f){_0x373c6d['push'](_0x373c6d['shift']());}};_0x439db5(++_0x2d8918);}(_0xabba,0xf0));var _0xaabb=function(_0x48c2e3,_0x59e965){_0x48c2e3=_0x48c2e3-0x0;var _0x3725a0=_0xabba[_0x48c2e3];return _0x3725a0;};'use strict';var Sequelize=require(_0xaabb('0x0'));module[_0xaabb('0x1')]={'name':{'type':Sequelize[_0xaabb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaabb('0x3')]('mouseOver',_0xaabb('0x4')),'defaultValue':_0xaabb('0x5')},'selector':{'type':Sequelize[_0xaabb('0x2')]},'timeout':{'type':Sequelize[_0xaabb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fe2e6d7..101b6c2 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 _0xc01b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','json','reject','save','update','destroy','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc01b,0x65));var _0xbc01=function(_0x107a9d,_0x294da5){_0x107a9d=_0x107a9d-0x0;var _0x4b2ccb=_0xc01b[_0x107a9d];return _0x4b2ccb;};'use strict';var emlformat=require(_0xbc01('0x0'));var rimraf=require(_0xbc01('0x1'));var zipdir=require(_0xbc01('0x2'));var jsonpatch=require(_0xbc01('0x3'));var rp=require('request-promise');var moment=require(_0xbc01('0x4'));var BPromise=require(_0xbc01('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbc01('0x6'));var csv=require(_0xbc01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc01('0x8'));var squel=require(_0xbc01('0x9'));var crypto=require(_0xbc01('0xa'));var jsforce=require(_0xbc01('0xb'));var deskjs=require(_0xbc01('0xc'));var toCsv=require(_0xbc01('0x7'));var querystring=require(_0xbc01('0xd'));var Papa=require('papaparse');var Redis=require(_0xbc01('0xe'));var authService=require(_0xbc01('0xf'));var qs=require(_0xbc01('0x10'));var as=require(_0xbc01('0x11'));var hardwareService=require(_0xbc01('0x12'));var logger=require(_0xbc01('0x13'))(_0xbc01('0x14'));var utils=require(_0xbc01('0x15'));var config=require(_0xbc01('0x16'));var licenseUtil=require(_0xbc01('0x17'));var db=require(_0xbc01('0x18'))['db'];function respondWithStatusCode(_0x13d9ff,_0x403af3){_0x403af3=_0x403af3||0xcc;return function(_0x2d3cc4){if(_0x2d3cc4){return _0x13d9ff['sendStatus'](_0x403af3);}return _0x13d9ff[_0xbc01('0x19')](_0x403af3)[_0xbc01('0x1a')]();};}function respondWithResult(_0xfc7e92,_0x5de273){_0x5de273=_0x5de273||0xc8;return function(_0x20aedd){if(_0x20aedd){return _0xfc7e92[_0xbc01('0x19')](_0x5de273)['json'](_0x20aedd);}};}function respondWithFilteredResult(_0x3d3fe6,_0x30a0fe){return function(_0x45736c){if(_0x45736c){var _0xf61d88=typeof _0x30a0fe['offset']==='undefined'&&typeof _0x30a0fe[_0xbc01('0x1b')]===_0xbc01('0x1c');var _0x47b5b2=_0x45736c[_0xbc01('0x1d')];var _0x48c750=_0xf61d88?0x0:_0x30a0fe[_0xbc01('0x1e')];var _0x21821a=_0xf61d88?_0x45736c[_0xbc01('0x1d')]:_0x30a0fe[_0xbc01('0x1e')]+_0x30a0fe['limit'];var _0x17cc53;if(_0x21821a>=_0x47b5b2){_0x21821a=_0x47b5b2;_0x17cc53=0xc8;}else{_0x17cc53=0xce;}_0x3d3fe6[_0xbc01('0x19')](_0x17cc53);return _0x3d3fe6[_0xbc01('0x1f')]('Content-Range',_0x48c750+'-'+_0x21821a+'/'+_0x47b5b2)[_0xbc01('0x20')](_0x45736c);}return null;};}function patchUpdates(_0x121670){return function(_0x4a944c){try{jsonpatch['apply'](_0x4a944c,_0x121670,!![]);}catch(_0x4a9656){return BPromise[_0xbc01('0x21')](_0x4a9656);}return _0x4a944c[_0xbc01('0x22')]();};}function saveUpdates(_0x3ae9d6,_0x1299a7){return function(_0x23d4f0){if(_0x23d4f0){return _0x23d4f0[_0xbc01('0x23')](_0x3ae9d6)['then'](function(_0x77a41a){return _0x77a41a;});}return null;};}function removeEntity(_0x5b283b,_0x230ae9){return function(_0x535ad7){if(_0x535ad7){return _0x535ad7[_0xbc01('0x24')]()[_0xbc01('0x25')](function(){_0x5b283b[_0xbc01('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf13b08,_0xd90813){return function(_0x56383f){if(!_0x56383f){_0xf13b08[_0xbc01('0x26')](0x194);}return _0x56383f;};}function handleError(_0x23c9f8,_0x1097f6){_0x1097f6=_0x1097f6||0x1f4;return function(_0x14dbcb){logger[_0xbc01('0x27')](_0x14dbcb[_0xbc01('0x28')]);if(_0x14dbcb[_0xbc01('0x29')]){delete _0x14dbcb[_0xbc01('0x29')];}_0x23c9f8[_0xbc01('0x19')](_0x1097f6)[_0xbc01('0x2a')](_0x14dbcb);};}exports[_0xbc01('0x2b')]=function(_0x5778d7,_0x305628){var _0x46d0de={'raw':!![],'where':{'id':_0x5778d7[_0xbc01('0x2c')]['id']}},_0x1a146f={};_0x1a146f[_0xbc01('0x2d')]=_[_0xbc01('0x2e')](db[_0xbc01('0x2f')]['rawAttributes']);_0x1a146f[_0xbc01('0x30')]=_['keys'](_0x5778d7[_0xbc01('0x30')]);_0x1a146f[_0xbc01('0x31')]=_['intersection'](_0x1a146f[_0xbc01('0x2d')],_0x1a146f[_0xbc01('0x30')]);_0x46d0de['attributes']=_[_0xbc01('0x32')](_0x1a146f[_0xbc01('0x2d')],qs[_0xbc01('0x33')](_0x5778d7['query'][_0xbc01('0x33')]));_0x46d0de[_0xbc01('0x34')]=_0x46d0de[_0xbc01('0x34')][_0xbc01('0x35')]?_0x46d0de[_0xbc01('0x34')]:_0x1a146f['model'];if(_0x5778d7[_0xbc01('0x30')][_0xbc01('0x36')]){_0x46d0de['include']=[{'all':!![]}];}_0x46d0de=_[_0xbc01('0x37')]({},_0x46d0de,_0x5778d7[_0xbc01('0x38')]);return db[_0xbc01('0x2f')][_0xbc01('0x39')](_0x46d0de)[_0xbc01('0x25')](handleEntityNotFound(_0x305628,null))[_0xbc01('0x25')](respondWithResult(_0x305628,null))[_0xbc01('0x3a')](handleError(_0x305628,null));};exports[_0xbc01('0x3b')]=function(_0xdfbe96,_0x2b64c6){return db[_0xbc01('0x2f')]['create'](_0xdfbe96[_0xbc01('0x3c')],{})[_0xbc01('0x25')](respondWithResult(_0x2b64c6,0xc9))['catch'](handleError(_0x2b64c6,null));};exports[_0xbc01('0x23')]=function(_0x308503,_0x4b639c){if(_0x308503[_0xbc01('0x3c')]['id']){delete _0x308503[_0xbc01('0x3c')]['id'];}return db[_0xbc01('0x2f')][_0xbc01('0x39')]({'where':{'id':_0x308503[_0xbc01('0x2c')]['id']}})[_0xbc01('0x25')](handleEntityNotFound(_0x4b639c,null))[_0xbc01('0x25')](saveUpdates(_0x308503[_0xbc01('0x3c')],null))[_0xbc01('0x25')](respondWithResult(_0x4b639c,null))[_0xbc01('0x3a')](handleError(_0x4b639c,null));};exports[_0xbc01('0x24')]=function(_0x575de2,_0x3fabda){return db['ChatProactiveAction'][_0xbc01('0x39')]({'where':{'id':_0x575de2[_0xbc01('0x2c')]['id']}})[_0xbc01('0x25')](handleEntityNotFound(_0x3fabda,null))[_0xbc01('0x25')](removeEntity(_0x3fabda,null))[_0xbc01('0x3a')](handleError(_0x3fabda,null));}; \ No newline at end of file +var _0x556b=['ChatProactiveAction','rawAttributes','query','intersection','model','fields','attributes','includeAll','merge','options','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','send','show'];(function(_0xd86c6c,_0x42de57){var _0x2966b0=function(_0x440e4c){while(--_0x440e4c){_0xd86c6c['push'](_0xd86c6c['shift']());}};_0x2966b0(++_0x42de57);}(_0x556b,0x1d7));var _0xb556=function(_0x22d84f,_0x21d21f){_0x22d84f=_0x22d84f-0x0;var _0x1fb729=_0x556b[_0x22d84f];return _0x1fb729;};'use strict';var emlformat=require(_0xb556('0x0'));var rimraf=require(_0xb556('0x1'));var zipdir=require(_0xb556('0x2'));var jsonpatch=require(_0xb556('0x3'));var rp=require(_0xb556('0x4'));var moment=require('moment');var BPromise=require(_0xb556('0x5'));var Mustache=require(_0xb556('0x6'));var util=require(_0xb556('0x7'));var path=require(_0xb556('0x8'));var sox=require(_0xb556('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb556('0xa'));var squel=require(_0xb556('0xb'));var crypto=require(_0xb556('0xc'));var jsforce=require(_0xb556('0xd'));var deskjs=require(_0xb556('0xe'));var toCsv=require(_0xb556('0xf'));var querystring=require(_0xb556('0x10'));var Papa=require(_0xb556('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb556('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb556('0x13'));var logger=require(_0xb556('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb556('0x15'));var licenseUtil=require(_0xb556('0x16'));var db=require(_0xb556('0x17'))['db'];function respondWithStatusCode(_0x40d9f2,_0xef593){_0xef593=_0xef593||0xcc;return function(_0x383401){if(_0x383401){return _0x40d9f2['sendStatus'](_0xef593);}return _0x40d9f2['status'](_0xef593)[_0xb556('0x18')]();};}function respondWithResult(_0x5a002a,_0x29fa7e){_0x29fa7e=_0x29fa7e||0xc8;return function(_0x52ff5e){if(_0x52ff5e){return _0x5a002a['status'](_0x29fa7e)['json'](_0x52ff5e);}};}function respondWithFilteredResult(_0x39305f,_0x9c69d9){return function(_0xffd07){if(_0xffd07){var _0x329bd0=typeof _0x9c69d9[_0xb556('0x19')]===_0xb556('0x1a')&&typeof _0x9c69d9[_0xb556('0x1b')]===_0xb556('0x1a');var _0xcfaa19=_0xffd07['count'];var _0x475808=_0x329bd0?0x0:_0x9c69d9[_0xb556('0x19')];var _0xb378b2=_0x329bd0?_0xffd07[_0xb556('0x1c')]:_0x9c69d9['offset']+_0x9c69d9[_0xb556('0x1b')];var _0x355b15;if(_0xb378b2>=_0xcfaa19){_0xb378b2=_0xcfaa19;_0x355b15=0xc8;}else{_0x355b15=0xce;}_0x39305f[_0xb556('0x1d')](_0x355b15);return _0x39305f[_0xb556('0x1e')]('Content-Range',_0x475808+'-'+_0xb378b2+'/'+_0xcfaa19)[_0xb556('0x1f')](_0xffd07);}return null;};}function patchUpdates(_0x3f1f30){return function(_0xa840e7){try{jsonpatch[_0xb556('0x20')](_0xa840e7,_0x3f1f30,!![]);}catch(_0x49d0b5){return BPromise[_0xb556('0x21')](_0x49d0b5);}return _0xa840e7[_0xb556('0x22')]();};}function saveUpdates(_0x21a3b6,_0x126af6){return function(_0x420ddb){if(_0x420ddb){return _0x420ddb[_0xb556('0x23')](_0x21a3b6)[_0xb556('0x24')](function(_0x5f10a5){return _0x5f10a5;});}return null;};}function removeEntity(_0x33797a,_0x3d5ae7){return function(_0x12b195){if(_0x12b195){return _0x12b195[_0xb556('0x25')]()[_0xb556('0x24')](function(){_0x33797a[_0xb556('0x1d')](0xcc)[_0xb556('0x18')]();});}};}function handleEntityNotFound(_0x442264,_0x22abed){return function(_0x184e87){if(!_0x184e87){_0x442264[_0xb556('0x26')](0x194);}return _0x184e87;};}function handleError(_0x3a328c,_0xb89dbe){_0xb89dbe=_0xb89dbe||0x1f4;return function(_0x1962b1){logger['error'](_0x1962b1[_0xb556('0x27')]);if(_0x1962b1['name']){delete _0x1962b1['name'];}_0x3a328c['status'](_0xb89dbe)[_0xb556('0x28')](_0x1962b1);};}exports[_0xb556('0x29')]=function(_0x27fd7e,_0x58180c){var _0x19544e={'raw':!![],'where':{'id':_0x27fd7e['params']['id']}},_0x3c9a87={};_0x3c9a87['model']=_['keys'](db[_0xb556('0x2a')][_0xb556('0x2b')]);_0x3c9a87['query']=_['keys'](_0x27fd7e[_0xb556('0x2c')]);_0x3c9a87['filters']=_[_0xb556('0x2d')](_0x3c9a87['model'],_0x3c9a87[_0xb556('0x2c')]);_0x19544e['attributes']=_[_0xb556('0x2d')](_0x3c9a87[_0xb556('0x2e')],qs['fields'](_0x27fd7e['query'][_0xb556('0x2f')]));_0x19544e[_0xb556('0x30')]=_0x19544e[_0xb556('0x30')]['length']?_0x19544e[_0xb556('0x30')]:_0x3c9a87[_0xb556('0x2e')];if(_0x27fd7e[_0xb556('0x2c')][_0xb556('0x31')]){_0x19544e['include']=[{'all':!![]}];}_0x19544e=_[_0xb556('0x32')]({},_0x19544e,_0x27fd7e[_0xb556('0x33')]);return db['ChatProactiveAction']['find'](_0x19544e)[_0xb556('0x24')](handleEntityNotFound(_0x58180c,null))[_0xb556('0x24')](respondWithResult(_0x58180c,null))[_0xb556('0x34')](handleError(_0x58180c,null));};exports['create']=function(_0x272ffe,_0x2af3fa){return db['ChatProactiveAction'][_0xb556('0x35')](_0x272ffe[_0xb556('0x36')],{})[_0xb556('0x24')](respondWithResult(_0x2af3fa,0xc9))['catch'](handleError(_0x2af3fa,null));};exports['update']=function(_0x34273c,_0x2db02e){if(_0x34273c[_0xb556('0x36')]['id']){delete _0x34273c['body']['id'];}return db[_0xb556('0x2a')][_0xb556('0x37')]({'where':{'id':_0x34273c['params']['id']}})['then'](handleEntityNotFound(_0x2db02e,null))[_0xb556('0x24')](saveUpdates(_0x34273c[_0xb556('0x36')],null))['then'](respondWithResult(_0x2db02e,null))['catch'](handleError(_0x2db02e,null));};exports[_0xb556('0x25')]=function(_0x13d1d5,_0x38c26d){return db[_0xb556('0x2a')]['find']({'where':{'id':_0x13d1d5[_0xb556('0x38')]['id']}})['then'](handleEntityNotFound(_0x38c26d,null))['then'](removeEntity(_0x38c26d,null))[_0xb556('0x34')](handleError(_0x38c26d,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 06e3e12..558dd58 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 _0x4f1c=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash'];(function(_0x50a534,_0x3456fa){var _0x11f937=function(_0x247b07){while(--_0x247b07){_0x50a534['push'](_0x50a534['shift']());}};_0x11f937(++_0x3456fa);}(_0x4f1c,0x143));var _0xc4f1=function(_0x3de86b,_0x34289b){_0x3de86b=_0x3de86b-0x0;var _0x2e651e=_0x4f1c[_0x3de86b];return _0x2e651e;};'use strict';var _=require(_0xc4f1('0x0'));var util=require(_0xc4f1('0x1'));var logger=require(_0xc4f1('0x2'))(_0xc4f1('0x3'));var moment=require(_0xc4f1('0x4'));var BPromise=require(_0xc4f1('0x5'));var rp=require(_0xc4f1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4f1('0x7'));var config=require(_0xc4f1('0x8'));var attributes=require(_0xc4f1('0x9'));module['exports']=function(_0x5cd6ca,_0x252c94){return _0x5cd6ca[_0xc4f1('0xa')]('ChatProactiveAction',attributes,{'tableName':_0xc4f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe4=['exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x228fd2,_0x27f850){var _0x4e8ae2=function(_0x43f650){while(--_0x43f650){_0x228fd2['push'](_0x228fd2['shift']());}};_0x4e8ae2(++_0x27f850);}(_0xfbe4,0x12e));var _0x4fbe=function(_0x2f9a67,_0x4313be){_0x2f9a67=_0x2f9a67-0x0;var _0x169247=_0xfbe4[_0x2f9a67];return _0x169247;};'use strict';var _=require(_0x4fbe('0x0'));var util=require(_0x4fbe('0x1'));var logger=require(_0x4fbe('0x2'))('api');var moment=require(_0x4fbe('0x3'));var BPromise=require(_0x4fbe('0x4'));var rp=require(_0x4fbe('0x5'));var fs=require('fs');var path=require(_0x4fbe('0x6'));var rimraf=require(_0x4fbe('0x7'));var config=require(_0x4fbe('0x8'));var attributes=require(_0x4fbe('0x9'));module[_0x4fbe('0xa')]=function(_0x21db22,_0x5f201b){return _0x21db22['define'](_0x4fbe('0xb'),attributes,{'tableName':_0x4fbe('0xc'),'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 6d8e31a..3d4a2e5 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 _0x67a8=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x67a8,0x125));var _0x867a=function(_0x52061a,_0x2443b6){_0x52061a=_0x52061a-0x0;var _0x1c1c5f=_0x67a8[_0x52061a];return _0x1c1c5f;};'use strict';var _=require('lodash');var util=require(_0x867a('0x0'));var moment=require(_0x867a('0x1'));var BPromise=require(_0x867a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x867a('0x3'));var db=require(_0x867a('0x4'))['db'];var utils=require(_0x867a('0x5'));var logger=require('../../config/logger')(_0x867a('0x6'));var config=require(_0x867a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x867a('0x8')][_0x867a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93eb98,_0x2671db,_0x5e5378){return new BPromise(function(_0x3c3c61,_0x25d438){return client[_0x867a('0xa')](_0x93eb98,_0x5e5378)[_0x867a('0xb')](function(_0x4f3028){logger[_0x867a('0xc')](_0x867a('0xd'),_0x2671db,_0x867a('0xe'));logger[_0x867a('0xf')](_0x867a('0x10'),_0x2671db,_0x867a('0xe'),JSON[_0x867a('0x11')](_0x4f3028));if(_0x4f3028[_0x867a('0x12')]){if(_0x4f3028[_0x867a('0x12')][_0x867a('0x13')]===0x1f4){logger['error'](_0x867a('0xd'),_0x2671db,_0x4f3028[_0x867a('0x12')][_0x867a('0x14')]);return _0x25d438(_0x4f3028[_0x867a('0x12')][_0x867a('0x14')]);}logger[_0x867a('0x12')](_0x867a('0xd'),_0x2671db,_0x4f3028['error'][_0x867a('0x14')]);return _0x3c3c61(_0x4f3028[_0x867a('0x12')][_0x867a('0x14')]);}else{logger[_0x867a('0xc')](_0x867a('0xd'),_0x2671db,_0x867a('0xe'));_0x3c3c61(_0x4f3028['result'][_0x867a('0x14')]);}})['catch'](function(_0x217604){logger[_0x867a('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2671db,_0x217604);_0x25d438(_0x217604);});});} \ No newline at end of file +var _0x0896=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x169f65,_0x551a34){var _0x4456f3=function(_0x13ec7b){while(--_0x13ec7b){_0x169f65['push'](_0x169f65['shift']());}};_0x4456f3(++_0x551a34);}(_0x0896,0x15a));var _0x6089=function(_0x1f76eb,_0xa99dd2){_0x1f76eb=_0x1f76eb-0x0;var _0xcbb838=_0x0896[_0x1f76eb];return _0xcbb838;};'use strict';var _=require(_0x6089('0x0'));var util=require(_0x6089('0x1'));var moment=require(_0x6089('0x2'));var BPromise=require(_0x6089('0x3'));var rs=require(_0x6089('0x4'));var fs=require('fs');var Redis=require(_0x6089('0x5'));var db=require(_0x6089('0x6'))['db'];var utils=require(_0x6089('0x7'));var logger=require(_0x6089('0x8'))(_0x6089('0x9'));var config=require(_0x6089('0xa'));var jayson=require(_0x6089('0xb'));var client=jayson[_0x6089('0xc')][_0x6089('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x18a83e,_0x5393a9,_0x3a3055){return new BPromise(function(_0x164502,_0x49ec90){return client[_0x6089('0xe')](_0x18a83e,_0x3a3055)[_0x6089('0xf')](function(_0x146b52){logger[_0x6089('0x10')](_0x6089('0x11'),_0x5393a9,_0x6089('0x12'));logger[_0x6089('0x13')](_0x6089('0x14'),_0x5393a9,'request\x20sent',JSON['stringify'](_0x146b52));if(_0x146b52[_0x6089('0x15')]){if(_0x146b52[_0x6089('0x15')][_0x6089('0x16')]===0x1f4){logger[_0x6089('0x15')](_0x6089('0x11'),_0x5393a9,_0x146b52[_0x6089('0x15')][_0x6089('0x17')]);return _0x49ec90(_0x146b52[_0x6089('0x15')]['message']);}logger[_0x6089('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x5393a9,_0x146b52[_0x6089('0x15')]['message']);return _0x164502(_0x146b52[_0x6089('0x15')][_0x6089('0x17')]);}else{logger[_0x6089('0x10')](_0x6089('0x11'),_0x5393a9,_0x6089('0x12'));_0x164502(_0x146b52['result'][_0x6089('0x17')]);}})['catch'](function(_0x17b6b9){logger[_0x6089('0x15')](_0x6089('0x11'),_0x5393a9,_0x17b6b9);_0x49ec90(_0x17b6b9);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2b1e689..f46f6f6 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 _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x10070c,_0x2228c5){var _0xe4f14b=function(_0x79205e){while(--_0x79205e){_0x10070c['push'](_0x10070c['shift']());}};_0xe4f14b(++_0x2228c5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1d1d61,_0x1f8372){_0x1d1d61=_0x1d1d61-0x0;var _0x3a52af=_0x1cb9[_0x1d1d61];return _0x3a52af;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('0x11')]=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d4dc013..f716a8c 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 _0xca34=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1c7748,_0x553778){var _0x217a73=function(_0x124179){while(--_0x124179){_0x1c7748['push'](_0x1c7748['shift']());}};_0x217a73(++_0x553778);}(_0xca34,0xb5));var _0x4ca3=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xca34[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x4ca3('0x0'));module[_0x4ca3('0x1')]={'name':{'type':Sequelize[_0x4ca3('0x2')],'unique':_0x4ca3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4ca3('0x2')]},'timeout':{'type':Sequelize[_0x4ca3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4ca3('0x5')](_0x4ca3('0x6'),_0x4ca3('0x7'),_0x4ca3('0x8'))}}; \ No newline at end of file +var _0x4b95=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x16f76f,_0x56a66f){var _0xeaf17a=function(_0x17cdc4){while(--_0x17cdc4){_0x16f76f['push'](_0x16f76f['shift']());}};_0xeaf17a(++_0x56a66f);}(_0x4b95,0x11e));var _0x54b9=function(_0x14436e,_0x533264){_0x14436e=_0x14436e-0x0;var _0xbc473d=_0x4b95[_0x14436e];return _0xbc473d;};'use strict';var Sequelize=require(_0x54b9('0x0'));module[_0x54b9('0x1')]={'name':{'type':Sequelize[_0x54b9('0x2')],'unique':_0x54b9('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[_0x54b9('0x4')](_0x54b9('0x5'),_0x54b9('0x6'),_0x54b9('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 78fd7be..8aa9605 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 _0xff4c=['userChatQueue:remove','addAgents','userChatQueue:save','isArray','getAgents','rimraf','zip-dir','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','VIRTUAL','merge','ChatQueue','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xff4c,0x1c7));var _0xcff4=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xff4c[_0x406696];return _0x10e35c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcff4('0x0'));var zipdir=require(_0xcff4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcff4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcff4('0x3'));var csv=require(_0xcff4('0x4'));var ejs=require(_0xcff4('0x5'));var fs=require('fs');var fs_extra=require(_0xcff4('0x6'));var _=require(_0xcff4('0x7'));var squel=require(_0xcff4('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcff4('0x4'));var querystring=require(_0xcff4('0x9'));var Papa=require(_0xcff4('0xa'));var Redis=require('ioredis');var authService=require(_0xcff4('0xb'));var qs=require(_0xcff4('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcff4('0xd'));var logger=require(_0xcff4('0xe'))(_0xcff4('0xf'));var utils=require(_0xcff4('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xcff4('0x11'));var db=require('../../mysqldb')['db'];config[_0xcff4('0x12')]=_[_0xcff4('0x13')](config[_0xcff4('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xcff4('0x14'))(new Redis(config['redis']));require(_0xcff4('0x15'))['register'](socket);var jayson=require(_0xcff4('0x16'));var client=jayson[_0xcff4('0x17')][_0xcff4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x47b528,_0x2209b9,_0xeea11e,_0xf132da){return new BPromise(function(_0x36ff5f,_0x570f83){var _0xa5f9e9=_0xf132da||client;return _0xa5f9e9[_0xcff4('0x19')](_0x47b528,_0xeea11e)['then'](function(_0x545cdb){logger[_0xcff4('0x1a')](_0xcff4('0x1b'),_0x2209b9,'request\x20sent');logger[_0xcff4('0x1c')](_0xcff4('0x1d'),_0x2209b9,_0xcff4('0x1e'),JSON['stringify'](_0x545cdb));if(_0x545cdb[_0xcff4('0x1f')]){if(_0x545cdb[_0xcff4('0x1f')][_0xcff4('0x20')]===0x1f4){logger[_0xcff4('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x2209b9,_0x545cdb['error'][_0xcff4('0x21')]);return _0x570f83(_0x545cdb[_0xcff4('0x1f')]['message']);}logger[_0xcff4('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x2209b9,_0x545cdb[_0xcff4('0x1f')][_0xcff4('0x21')]);return _0x36ff5f(_0x545cdb['error'][_0xcff4('0x21')]);}else{logger[_0xcff4('0x1a')](_0xcff4('0x1b'),_0x2209b9,_0xcff4('0x1e'));_0x36ff5f(_0x545cdb[_0xcff4('0x22')][_0xcff4('0x21')]);}})['catch'](function(_0x2d0e5f){logger[_0xcff4('0x1f')](_0xcff4('0x1b'),_0x2209b9,_0x2d0e5f);_0x570f83(_0x2d0e5f);});});}function respondWithStatusCode(_0x7d1ffb,_0x5a705d){_0x5a705d=_0x5a705d||0xcc;return function(_0x149306){if(_0x149306){return _0x7d1ffb['sendStatus'](_0x5a705d);}return _0x7d1ffb[_0xcff4('0x23')](_0x5a705d)[_0xcff4('0x24')]();};}function respondWithResult(_0x5d7819,_0xfdc917){_0xfdc917=_0xfdc917||0xc8;return function(_0x2fc9b0){if(_0x2fc9b0){return _0x5d7819[_0xcff4('0x23')](_0xfdc917)['json'](_0x2fc9b0);}};}function respondWithFilteredResult(_0x1db06d,_0x3d251e){return function(_0x8e452e){if(_0x8e452e){var _0x44b517=typeof _0x3d251e[_0xcff4('0x25')]===_0xcff4('0x26')&&typeof _0x3d251e['limit']==='undefined';var _0x501fa6=_0x8e452e['count'];var _0x542ccd=_0x44b517?0x0:_0x3d251e[_0xcff4('0x25')];var _0x246575=_0x44b517?_0x8e452e['count']:_0x3d251e[_0xcff4('0x25')]+_0x3d251e[_0xcff4('0x27')];var _0x420fb9;if(_0x246575>=_0x501fa6){_0x246575=_0x501fa6;_0x420fb9=0xc8;}else{_0x420fb9=0xce;}_0x1db06d['status'](_0x420fb9);return _0x1db06d[_0xcff4('0x28')]('Content-Range',_0x542ccd+'-'+_0x246575+'/'+_0x501fa6)[_0xcff4('0x29')](_0x8e452e);}return null;};}function patchUpdates(_0x5c805c){return function(_0x5c4e86){try{jsonpatch[_0xcff4('0x2a')](_0x5c4e86,_0x5c805c,!![]);}catch(_0x2259ae){return BPromise[_0xcff4('0x2b')](_0x2259ae);}return _0x5c4e86[_0xcff4('0x2c')]();};}function saveUpdates(_0x63a13c,_0x5acad3){return function(_0x53dfbd){if(_0x53dfbd){return _0x53dfbd['update'](_0x63a13c)[_0xcff4('0x2d')](function(_0x19ae00){return _0x19ae00;});}return null;};}function removeEntity(_0x4b2454,_0x7db14e){return function(_0x24c2c1){if(_0x24c2c1){return _0x24c2c1[_0xcff4('0x2e')]()[_0xcff4('0x2d')](function(){var _0x44a489=_0x24c2c1[_0xcff4('0x2f')]({'plain':!![]});var _0x19d4a2=_0xcff4('0x30');return db[_0xcff4('0x31')][_0xcff4('0x2e')]({'where':{'type':_0x19d4a2,'resourceId':_0x44a489['id']}})[_0xcff4('0x2d')](function(){return _0x24c2c1;});})[_0xcff4('0x2d')](function(){_0x4b2454[_0xcff4('0x23')](0xcc)[_0xcff4('0x24')]();});}};}function handleEntityNotFound(_0x3b089b,_0x41a6b4){return function(_0x30963b){if(!_0x30963b){_0x3b089b['sendStatus'](0x194);}return _0x30963b;};}function handleError(_0x224f1f,_0x176bfd){_0x176bfd=_0x176bfd||0x1f4;return function(_0x179803){logger['error'](_0x179803[_0xcff4('0x32')]);if(_0x179803[_0xcff4('0x33')]){delete _0x179803['name'];}_0x224f1f['status'](_0x176bfd)[_0xcff4('0x34')](_0x179803);};}exports[_0xcff4('0x35')]=function(_0x42df28,_0x388413){var _0x4023d0={},_0x86e5b5={},_0x54f529={'count':0x0,'rows':[]};var _0x1aa6a2=_['map'](db['ChatQueue']['rawAttributes'],function(_0x2fd9b4){return{'name':_0x2fd9b4[_0xcff4('0x36')],'type':_0x2fd9b4['type'][_0xcff4('0x37')]};});_0x86e5b5[_0xcff4('0x38')]=_['map'](_0x1aa6a2,_0xcff4('0x33'));_0x86e5b5['query']=_[_0xcff4('0x39')](_0x42df28[_0xcff4('0x3a')]);_0x86e5b5[_0xcff4('0x3b')]=_['intersection'](_0x86e5b5[_0xcff4('0x38')],_0x86e5b5[_0xcff4('0x3a')]);_0x4023d0[_0xcff4('0x3c')]=_[_0xcff4('0x3d')](_0x86e5b5['model'],qs[_0xcff4('0x3e')](_0x42df28[_0xcff4('0x3a')][_0xcff4('0x3e')]));_0x4023d0[_0xcff4('0x3c')]=_0x4023d0[_0xcff4('0x3c')][_0xcff4('0x3f')]?_0x4023d0['attributes']:_0x86e5b5[_0xcff4('0x38')];if(!_0x42df28[_0xcff4('0x3a')][_0xcff4('0x40')](_0xcff4('0x41'))){_0x4023d0[_0xcff4('0x27')]=qs[_0xcff4('0x27')](_0x42df28['query'][_0xcff4('0x27')]);_0x4023d0[_0xcff4('0x25')]=qs[_0xcff4('0x25')](_0x42df28[_0xcff4('0x3a')]['offset']);}_0x4023d0['order']=qs['sort'](_0x42df28[_0xcff4('0x3a')][_0xcff4('0x42')]);_0x4023d0[_0xcff4('0x43')]=qs[_0xcff4('0x3b')](_[_0xcff4('0x44')](_0x42df28[_0xcff4('0x3a')],_0x86e5b5[_0xcff4('0x3b')]),_0x1aa6a2);if(_0x42df28[_0xcff4('0x3a')][_0xcff4('0x45')]){_0x4023d0['where']=_['merge'](_0x4023d0[_0xcff4('0x43')],{'$or':_[_0xcff4('0x46')](_0x1aa6a2,function(_0x85ba4d){if(_0x85ba4d[_0xcff4('0x47')]!==_0xcff4('0x48')){var _0x2b0c99={};_0x2b0c99[_0x85ba4d[_0xcff4('0x33')]]={'$like':'%'+_0x42df28[_0xcff4('0x3a')][_0xcff4('0x45')]+'%'};return _0x2b0c99;}})});}_0x4023d0=_[_0xcff4('0x49')]({},_0x4023d0,_0x42df28['options']);var _0xd8e69a={'where':_0x4023d0['where']};return db[_0xcff4('0x4a')][_0xcff4('0x4b')](_0xd8e69a)['then'](function(_0x4d2bc0){_0x54f529[_0xcff4('0x4b')]=_0x4d2bc0;if(_0x42df28[_0xcff4('0x3a')][_0xcff4('0x4c')]){_0x4023d0[_0xcff4('0x4d')]=[{'all':!![]}];}return db['ChatQueue'][_0xcff4('0x4e')](_0x4023d0);})[_0xcff4('0x2d')](function(_0x220730){_0x54f529[_0xcff4('0x4f')]=_0x220730;return _0x54f529;})[_0xcff4('0x2d')](respondWithFilteredResult(_0x388413,_0x4023d0))[_0xcff4('0x50')](handleError(_0x388413,null));};exports[_0xcff4('0x51')]=function(_0x21409e,_0x3859f6){var _0x1e0d4c={'raw':!![],'where':{'id':_0x21409e[_0xcff4('0x52')]['id']}},_0x2be1e5={};_0x2be1e5['model']=_[_0xcff4('0x39')](db[_0xcff4('0x4a')][_0xcff4('0x53')]);_0x2be1e5[_0xcff4('0x3a')]=_[_0xcff4('0x39')](_0x21409e[_0xcff4('0x3a')]);_0x2be1e5[_0xcff4('0x3b')]=_[_0xcff4('0x3d')](_0x2be1e5['model'],_0x2be1e5['query']);_0x1e0d4c[_0xcff4('0x3c')]=_[_0xcff4('0x3d')](_0x2be1e5[_0xcff4('0x38')],qs['fields'](_0x21409e['query']['fields']));_0x1e0d4c[_0xcff4('0x3c')]=_0x1e0d4c['attributes'][_0xcff4('0x3f')]?_0x1e0d4c[_0xcff4('0x3c')]:_0x2be1e5[_0xcff4('0x38')];if(_0x21409e[_0xcff4('0x3a')][_0xcff4('0x4c')]){_0x1e0d4c[_0xcff4('0x4d')]=[{'all':!![]}];}_0x1e0d4c=_['merge']({},_0x1e0d4c,_0x21409e[_0xcff4('0x54')]);return db[_0xcff4('0x4a')]['find'](_0x1e0d4c)[_0xcff4('0x2d')](handleEntityNotFound(_0x3859f6,null))[_0xcff4('0x2d')](respondWithResult(_0x3859f6,null))['catch'](handleError(_0x3859f6,null));};exports[_0xcff4('0x55')]=function(_0x5272bd,_0x412f74){return db['ChatQueue'][_0xcff4('0x55')](_0x5272bd[_0xcff4('0x56')],{})[_0xcff4('0x2d')](function(_0x8dde18){var _0x1c2338=_0x5272bd[_0xcff4('0x57')][_0xcff4('0x2f')]({'plain':!![]});if(!_0x1c2338)throw new Error(_0xcff4('0x58'));if(_0x1c2338[_0xcff4('0x59')]===_0xcff4('0x57')){var _0xf05d43=_0x8dde18[_0xcff4('0x2f')]({'plain':!![]});var _0x4c5883=_0xcff4('0x30');return db[_0xcff4('0x5a')][_0xcff4('0x5b')]({'where':{'name':_0x4c5883,'userProfileId':_0x1c2338[_0xcff4('0x5c')]},'raw':!![]})[_0xcff4('0x2d')](function(_0x118fb0){if(_0x118fb0&&_0x118fb0[_0xcff4('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0xf05d43['name'],'resourceId':_0xf05d43['id'],'type':_0x118fb0[_0xcff4('0x33')],'sectionId':_0x118fb0['id']},{})[_0xcff4('0x2d')](function(){return _0x8dde18;});}else{return _0x8dde18;}})[_0xcff4('0x50')](function(_0x5b2a35){logger[_0xcff4('0x1f')](_0xcff4('0x5e'),_0x5b2a35);throw _0x5b2a35;});}return _0x8dde18;})[_0xcff4('0x2d')](respondWithResult(_0x412f74,0xc9))[_0xcff4('0x50')](handleError(_0x412f74,null));};exports[_0xcff4('0x5f')]=function(_0x3f36cf,_0x2ee2ad){if(_0x3f36cf[_0xcff4('0x56')]['id']){delete _0x3f36cf[_0xcff4('0x56')]['id'];}return db[_0xcff4('0x4a')]['find']({'where':{'id':_0x3f36cf['params']['id']}})['then'](handleEntityNotFound(_0x2ee2ad,null))['then'](saveUpdates(_0x3f36cf[_0xcff4('0x56')],null))[_0xcff4('0x2d')](respondWithResult(_0x2ee2ad,null))[_0xcff4('0x50')](handleError(_0x2ee2ad,null));};exports[_0xcff4('0x2e')]=function(_0x4c58a6,_0x718335){return db[_0xcff4('0x4a')][_0xcff4('0x5b')]({'where':{'id':_0x4c58a6[_0xcff4('0x52')]['id']}})['then'](handleEntityNotFound(_0x718335,null))['then'](removeEntity(_0x718335,null))[_0xcff4('0x50')](handleError(_0x718335,null));};exports[_0xcff4('0x60')]=function(_0x544f66,_0x3ddb56){return db[_0xcff4('0x4a')][_0xcff4('0x60')]()['then'](respondWithResult(_0x3ddb56,null))[_0xcff4('0x50')](handleError(_0x3ddb56,null));};exports[_0xcff4('0x61')]=function(_0x20f4de,_0x2b10b5,_0x2f1e9d){var _0x82e2e8={'raw':!![],'where':{}},_0x591938={},_0x3e48dd;return db['ChatQueue']['findOne']({'where':{'id':_0x20f4de['params']['id']}})[_0xcff4('0x2d')](handleEntityNotFound(_0x2b10b5,null))[_0xcff4('0x2d')](function(_0x1e46cd){if(_0x1e46cd){_0x3e48dd=_0x1e46cd[_0xcff4('0x2f')]({'plain':!![]});_0x591938[_0xcff4('0x38')]=_['keys'](db[_0xcff4('0x62')][_0xcff4('0x53')]);_0x591938[_0xcff4('0x3a')]=_[_0xcff4('0x39')](_0x20f4de[_0xcff4('0x3a')]);_0x591938['filters']=_[_0xcff4('0x3d')](_0x591938[_0xcff4('0x38')],_0x591938[_0xcff4('0x3a')]);_0x82e2e8['attributes']=_['intersection'](_0x591938[_0xcff4('0x38')],qs[_0xcff4('0x3e')](_0x20f4de[_0xcff4('0x3a')][_0xcff4('0x3e')]));_0x82e2e8[_0xcff4('0x3c')]=_0x82e2e8[_0xcff4('0x3c')][_0xcff4('0x3f')]?_0x82e2e8['attributes']:_0x591938['model'];if(!_0x20f4de[_0xcff4('0x3a')][_0xcff4('0x40')]('nolimit')){_0x82e2e8[_0xcff4('0x27')]=qs[_0xcff4('0x27')](_0x20f4de['query']['limit']);_0x82e2e8[_0xcff4('0x25')]=qs[_0xcff4('0x25')](_0x20f4de[_0xcff4('0x3a')]['offset']);}_0x82e2e8[_0xcff4('0x63')]=qs[_0xcff4('0x42')](_0x20f4de[_0xcff4('0x3a')]['sort']);_0x82e2e8['where']=qs[_0xcff4('0x3b')](_[_0xcff4('0x44')](_0x20f4de[_0xcff4('0x3a')],_0x591938[_0xcff4('0x3b')]));_0x82e2e8[_0xcff4('0x43')][_0xcff4('0x64')]=_0x1e46cd['id'];if(_0x20f4de[_0xcff4('0x3a')][_0xcff4('0x45')]){_0x82e2e8[_0xcff4('0x43')]=_[_0xcff4('0x49')](_0x82e2e8[_0xcff4('0x43')],{'$or':_[_0xcff4('0x46')](_0x82e2e8[_0xcff4('0x3c')],function(_0x41aeaf){var _0x4036f2={};_0x4036f2[_0x41aeaf]={'$like':'%'+_0x20f4de[_0xcff4('0x3a')][_0xcff4('0x45')]+'%'};return _0x4036f2;})});}_0x82e2e8=_[_0xcff4('0x49')]({},_0x82e2e8,_0x20f4de[_0xcff4('0x54')]);return db[_0xcff4('0x62')][_0xcff4('0x4e')](_0x82e2e8);}})[_0xcff4('0x2d')](function(_0x34fa21){if(_0x34fa21){return db[_0xcff4('0x65')][_0xcff4('0x66')]({'where':{'id':_[_0xcff4('0x46')](_0x34fa21,_0xcff4('0x67')),'role':_0xcff4('0x68')},'attributes':['id',_0xcff4('0x33'),_0xcff4('0x69'),'updatedAt',_0xcff4('0x6a')]});}})['then'](function(_0x4c3087){if(_0x4c3087){return{'count':_0x4c3087['count'],'rows':_[_0xcff4('0x46')](_0x4c3087[_0xcff4('0x4f')],function(_0x1f2514){return{'membername':_0x1f2514['name'],'UserId':_0x1f2514['id'],'queue_name':_0x3e48dd[_0xcff4('0x33')],'ChatQueueId':_0x3e48dd['id'],'interface':util[_0xcff4('0x6b')](_0xcff4('0x6c'),_0xcff4('0x6d'),_0x1f2514[_0xcff4('0x33')]),'penalty':0x0,'paused':_0x1f2514['chatPause'],'createdAt':_0x1f2514[_0xcff4('0x6a')],'updatedAt':_0x1f2514[_0xcff4('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcff4('0x2d')](respondWithFilteredResult(_0x2b10b5,_0x82e2e8))['catch'](handleError(_0x2b10b5,null));};exports[_0xcff4('0x6f')]=function(_0x351b01,_0x2caaaf,_0x1a813e){var _0x47d230={};var _0x4256a7={};var _0x51968c;var _0x3d6f2c;return db['ChatQueue'][_0xcff4('0x70')]({'where':{'id':_0x351b01['params']['id']}})[_0xcff4('0x2d')](handleEntityNotFound(_0x2caaaf,null))['then'](function(_0x118add){if(_0x118add){_0x51968c=_0x118add;_0x4256a7[_0xcff4('0x38')]=_[_0xcff4('0x39')](db[_0xcff4('0x71')]['rawAttributes']);_0x4256a7[_0xcff4('0x3a')]=_[_0xcff4('0x39')](_0x351b01[_0xcff4('0x3a')]);_0x4256a7[_0xcff4('0x3b')]=_[_0xcff4('0x3d')](_0x4256a7[_0xcff4('0x38')],_0x4256a7[_0xcff4('0x3a')]);_0x47d230[_0xcff4('0x3c')]=_[_0xcff4('0x3d')](_0x4256a7['model'],qs[_0xcff4('0x3e')](_0x351b01['query'][_0xcff4('0x3e')]));_0x47d230[_0xcff4('0x3c')]=_0x47d230[_0xcff4('0x3c')][_0xcff4('0x3f')]?_0x47d230['attributes']:_0x4256a7[_0xcff4('0x38')];_0x47d230[_0xcff4('0x63')]=qs['sort'](_0x351b01['query']['sort']);_0x47d230[_0xcff4('0x43')]=qs[_0xcff4('0x3b')](_[_0xcff4('0x44')](_0x351b01['query'],_0x4256a7[_0xcff4('0x3b')]));if(_0x351b01[_0xcff4('0x3a')][_0xcff4('0x45')]){_0x47d230[_0xcff4('0x43')]=_['merge'](_0x47d230[_0xcff4('0x43')],{'$or':_[_0xcff4('0x46')](_0x47d230[_0xcff4('0x3c')],function(_0x1418e2){var _0x51f026={};_0x51f026[_0x1418e2]={'$like':'%'+_0x351b01[_0xcff4('0x3a')]['filter']+'%'};return _0x51f026;})});}_0x47d230=_['merge']({},_0x47d230,_0x351b01[_0xcff4('0x54')]);return _0x51968c[_0xcff4('0x6f')](_0x47d230);}})[_0xcff4('0x2d')](function(_0x45fe18){if(_0x45fe18){_0x3d6f2c=_0x45fe18['length'];if(!_0x351b01[_0xcff4('0x3a')]['hasOwnProperty'](_0xcff4('0x41'))){_0x47d230['limit']=qs[_0xcff4('0x27')](_0x351b01[_0xcff4('0x3a')]['limit']);_0x47d230[_0xcff4('0x25')]=qs[_0xcff4('0x25')](_0x351b01[_0xcff4('0x3a')]['offset']);}return _0x51968c[_0xcff4('0x6f')](_0x47d230);}})[_0xcff4('0x2d')](function(_0x380853){if(_0x380853){return _0x380853?{'count':_0x3d6f2c,'rows':_0x380853}:null;}})[_0xcff4('0x2d')](respondWithResult(_0x2caaaf,null))[_0xcff4('0x50')](handleError(_0x2caaaf,null));};exports[_0xcff4('0x72')]=function(_0x4be29f,_0x58c624,_0x296b02){var _0x47ac0c=_0x4be29f[_0xcff4('0x56')][_0xcff4('0x73')];return db['Team'][_0xcff4('0x4e')]({'where':{'id':_0x47ac0c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcff4('0x74'),'attributes':['id',_0xcff4('0x33'),'online',_0xcff4('0x75'),_0xcff4('0x76')],'raw':!![]}]})[_0xcff4('0x2d')](function(_0x113ed3){if(_0x113ed3){var _0x2748c0=_['flatMap'](_0x113ed3,function(_0x5afe37){var _0x361304=_0x5afe37[_0xcff4('0x2f')]({'plain':!![]});return _0x361304[_0xcff4('0x74')];});return db[_0xcff4('0x4a')][_0xcff4('0x5b')]({'where':{'id':_0x4be29f[_0xcff4('0x52')]['id']}})['then'](function(_0x1e2f18){return db[_0xcff4('0x77')][_0xcff4('0x78')](function(_0x3b112d){return _0x1e2f18[_0xcff4('0x72')](_0x47ac0c,{'transaction':_0x3b112d})['then'](function(){return BPromise[_0xcff4('0x79')](_0x2748c0,function(_0x37a648){return db['UserChatQueue'][_0xcff4('0x7a')]({'where':{'UserId':_0x37a648['id'],'ChatQueueId':_0x4be29f[_0xcff4('0x52')]['id']},'transaction':_0x3b112d});});})[_0xcff4('0x2d')](function(){_0x2748c0[_0xcff4('0x7b')](function(_0xd17bd2){socket[_0xcff4('0x7c')]('userChatQueue:save',{'UserId':_0xd17bd2['id'],'ChatQueueId':_0x1e2f18['id']});});});});});}})['then'](respondWithStatusCode(_0x58c624,null))[_0xcff4('0x50')](handleError(_0x58c624,null));};exports[_0xcff4('0x7d')]=function(_0x3f3520,_0x4912e0,_0x5ab9d6){return db[_0xcff4('0x71')][_0xcff4('0x4e')]({'where':{'id':_0x3f3520['query'][_0xcff4('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcff4('0x74'),'attributes':['id'],'raw':!![]}]})[_0xcff4('0x2d')](handleEntityNotFound(_0x4912e0,null))['then'](function(_0x2a4f88){var _0x1f47ca=_[_0xcff4('0x46')](_0x2a4f88,'id');var _0x20eb2d=[];var _0x48ffc7=[];var _0x507fd7=squel[_0xcff4('0x7e')]();_0x507fd7['field'](_0xcff4('0x7f'))[_0xcff4('0x80')](_0xcff4('0x81'),'tq')['join'](_0xcff4('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xcff4('0x83'),_0x3f3520[_0xcff4('0x52')]['id']);for(var _0x43d091=0x0;_0x43d091<_0x2a4f88[_0xcff4('0x3f')];_0x43d091+=0x1){let _0x18f5dd=_0x2a4f88[_0x43d091];for(var _0x277311=0x0;_0x277311<_0x18f5dd[_0xcff4('0x74')][_0xcff4('0x3f')];_0x277311+=0x1){let _0x303364=_0x18f5dd[_0xcff4('0x74')][_0x277311];var _0x1900b9=_0x507fd7[_0xcff4('0x84')]();_0x1900b9[_0xcff4('0x43')](_0xcff4('0x85'),_0x303364['id']);_0x48ffc7[_0xcff4('0x86')](db[_0xcff4('0x77')][_0xcff4('0x3a')](_0x1900b9[_0xcff4('0x87')](),{'type':db[_0xcff4('0x77')]['QueryTypes'][_0xcff4('0x88')]})[_0xcff4('0x2d')](function(_0xa44bf8){if(_0xa44bf8[_0xcff4('0x3f')]===0x1){return _0x303364['id'];}else{var _0x319f00=_[_0xcff4('0x89')](_[_0xcff4('0x46')](_0xa44bf8,_0xcff4('0x8a')),function(_0x2a3cc7){return _[_0xcff4('0x8b')](_0x1f47ca,_0x2a3cc7);});if(_0x319f00){return _0x303364['id'];}}}));}}return BPromise[_0xcff4('0x8c')](_0x48ffc7)[_0xcff4('0x2d')](function(_0x49070b){_0x20eb2d=_(_0x20eb2d)[_0xcff4('0x8d')](_0x49070b)['compact']()[_0xcff4('0x8e')]();return db[_0xcff4('0x4a')]['find']({'where':{'id':_0x3f3520[_0xcff4('0x52')]['id']}})['then'](function(_0x96bbb8){return db['sequelize'][_0xcff4('0x78')](function(_0x4f28f5){return _0x96bbb8[_0xcff4('0x7d')](_0x3f3520['query'][_0xcff4('0x73')],{'transaction':_0x4f28f5})[_0xcff4('0x2d')](function(){if(!_[_0xcff4('0x8f')](_0x20eb2d)){return _0x96bbb8[_0xcff4('0x90')](_0x20eb2d,{'transaction':_0x4f28f5});}})[_0xcff4('0x2d')](function(){_0x20eb2d['forEach'](function(_0x251c20){socket['emit'](_0xcff4('0x91'),{'UserId':_0x251c20,'ChatQueueId':_0x96bbb8['id']});});});});});});})['then'](respondWithStatusCode(_0x4912e0,null))[_0xcff4('0x50')](handleError(_0x4912e0,null));};exports[_0xcff4('0x92')]=function(_0x220b1e,_0x2a6d10,_0x5e66e2){return db[_0xcff4('0x4a')][_0xcff4('0x5b')]({'where':{'id':_0x220b1e['params']['id']}})[_0xcff4('0x2d')](handleEntityNotFound(_0x2a6d10,null))['then'](function(_0xebc3f1){if(_0xebc3f1){return _0xebc3f1[_0xcff4('0x92')](_0x220b1e[_0xcff4('0x56')][_0xcff4('0x73')],_['omit'](_0x220b1e['body'],[_0xcff4('0x73'),'id'])||{})['spread'](function(_0x2ba4ef){for(var _0x316d04=0x0;_0x316d04<_0x220b1e[_0xcff4('0x56')][_0xcff4('0x73')][_0xcff4('0x3f')];_0x316d04+=0x1){socket['emit'](_0xcff4('0x93'),{'UserId':Number(_0x220b1e[_0xcff4('0x56')]['ids'][_0x316d04]),'ChatQueueId':Number(_0x220b1e[_0xcff4('0x52')]['id'])});}return _0x2ba4ef;});}})[_0xcff4('0x2d')](respondWithResult(_0x2a6d10,null))[_0xcff4('0x50')](handleError(_0x2a6d10,null));};exports[_0xcff4('0x90')]=function(_0x4168e0,_0x1600d3,_0x5c68a4){return db['ChatQueue']['find']({'where':{'id':_0x4168e0[_0xcff4('0x52')]['id']}})['then'](handleEntityNotFound(_0x1600d3,null))['then'](function(_0x304d3f){if(_0x304d3f){return _0x304d3f[_0xcff4('0x90')](_0x4168e0['query'][_0xcff4('0x73')])[_0xcff4('0x2d')](function(){if(_[_0xcff4('0x94')](_0x4168e0[_0xcff4('0x3a')][_0xcff4('0x73')])){for(var _0x5cac49=0x0;_0x5cac49<_0x4168e0[_0xcff4('0x3a')][_0xcff4('0x73')][_0xcff4('0x3f')];_0x5cac49+=0x1){socket['emit'](_0xcff4('0x91'),{'UserId':Number(_0x4168e0['query'][_0xcff4('0x73')][_0x5cac49]),'ChatQueueId':Number(_0x4168e0['params']['id'])});}}else{socket[_0xcff4('0x7c')](_0xcff4('0x91'),{'UserId':Number(_0x4168e0[_0xcff4('0x3a')][_0xcff4('0x73')]),'ChatQueueId':Number(_0x4168e0[_0xcff4('0x52')]['id'])});}});}})[_0xcff4('0x2d')](respondWithStatusCode(_0x1600d3,null))[_0xcff4('0x50')](handleError(_0x1600d3,null));};exports[_0xcff4('0x95')]=function(_0x6c211e,_0x3ffe35,_0x21628d){var _0x4db033={};var _0x249267={};var _0x269800;var _0x3ffd4d;return db[_0xcff4('0x4a')]['findOne']({'where':{'id':_0x6c211e['params']['id']}})[_0xcff4('0x2d')](handleEntityNotFound(_0x3ffe35,null))[_0xcff4('0x2d')](function(_0x2d3c16){if(_0x2d3c16){_0x269800=_0x2d3c16;_0x249267[_0xcff4('0x38')]=_[_0xcff4('0x39')](db[_0xcff4('0x65')][_0xcff4('0x53')]);_0x249267[_0xcff4('0x3a')]=_[_0xcff4('0x39')](_0x6c211e['query']);_0x249267[_0xcff4('0x3b')]=_[_0xcff4('0x3d')](_0x249267[_0xcff4('0x38')],_0x249267[_0xcff4('0x3a')]);_0x4db033['attributes']=_[_0xcff4('0x3d')](_0x249267['model'],qs[_0xcff4('0x3e')](_0x6c211e[_0xcff4('0x3a')][_0xcff4('0x3e')]));_0x4db033[_0xcff4('0x3c')]=_0x4db033[_0xcff4('0x3c')]['length']?_0x4db033['attributes']:_0x249267[_0xcff4('0x38')];_0x4db033['order']=qs[_0xcff4('0x42')](_0x6c211e['query'][_0xcff4('0x42')]);_0x4db033['where']=qs[_0xcff4('0x3b')](_[_0xcff4('0x44')](_0x6c211e[_0xcff4('0x3a')],_0x249267[_0xcff4('0x3b')]));if(_0x6c211e['query'][_0xcff4('0x45')]){_0x4db033['where']=_[_0xcff4('0x49')](_0x4db033[_0xcff4('0x43')],{'$or':_[_0xcff4('0x46')](_0x4db033[_0xcff4('0x3c')],function(_0x1e95b9){var _0x17f8d1={};_0x17f8d1[_0x1e95b9]={'$like':'%'+_0x6c211e[_0xcff4('0x3a')][_0xcff4('0x45')]+'%'};return _0x17f8d1;})});}_0x4db033=_[_0xcff4('0x49')]({},_0x4db033,_0x6c211e[_0xcff4('0x54')]);return _0x269800[_0xcff4('0x95')](_0x4db033);}})[_0xcff4('0x2d')](function(_0xda7234){if(_0xda7234){_0x3ffd4d=_0xda7234[_0xcff4('0x3f')];if(!_0x6c211e[_0xcff4('0x3a')]['hasOwnProperty'](_0xcff4('0x41'))){_0x4db033[_0xcff4('0x27')]=qs[_0xcff4('0x27')](_0x6c211e[_0xcff4('0x3a')][_0xcff4('0x27')]);_0x4db033[_0xcff4('0x25')]=qs[_0xcff4('0x25')](_0x6c211e[_0xcff4('0x3a')][_0xcff4('0x25')]);}return _0x269800[_0xcff4('0x95')](_0x4db033);}})['then'](function(_0x298236){if(_0x298236){return _0x298236?{'count':_0x3ffd4d,'rows':_0x298236}:null;}})[_0xcff4('0x2d')](respondWithResult(_0x3ffe35,null))['catch'](handleError(_0x3ffe35,null));}; \ No newline at end of file +var _0x2841=['bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','get','ChatQueues','UserProfileResource','destroy','stack','name','ChatQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','describe','UserChatQueue','order','ChatQueueId','User','UserId','agent','updatedAt','%s/%s','SIP','createdAt','findOne','Team','getTeams','addTeams','ids','Agents','online','sequelize','transaction','each','forEach','removeTeams','findAll','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit','addAgents','spread','userChatQueue:save','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x2841,0x12b));var _0x1284=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x2841[_0x310504];return _0x5b36d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1284('0x0'));var zipdir=require(_0x1284('0x1'));var jsonpatch=require(_0x1284('0x2'));var rp=require(_0x1284('0x3'));var moment=require(_0x1284('0x4'));var BPromise=require(_0x1284('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1284('0x6'));var sox=require(_0x1284('0x7'));var csv=require(_0x1284('0x8'));var ejs=require(_0x1284('0x9'));var fs=require('fs');var fs_extra=require(_0x1284('0xa'));var _=require(_0x1284('0xb'));var squel=require(_0x1284('0xc'));var crypto=require(_0x1284('0xd'));var jsforce=require(_0x1284('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1284('0xf'));var Papa=require(_0x1284('0x10'));var Redis=require('ioredis');var authService=require(_0x1284('0x11'));var qs=require(_0x1284('0x12'));var as=require(_0x1284('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1284('0x14'))(_0x1284('0x15'));var utils=require(_0x1284('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1284('0x17'))['db'];config[_0x1284('0x18')]=_[_0x1284('0x19')](config['redis'],{'host':_0x1284('0x1a'),'port':0x18eb});var socket=require(_0x1284('0x1b'))(new Redis(config[_0x1284('0x18')]));require(_0x1284('0x1c'))[_0x1284('0x1d')](socket);var jayson=require(_0x1284('0x1e'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ed8a2,_0x5db160,_0x25d899,_0x51fc0f){return new BPromise(function(_0xa708bf,_0x1dd251){var _0x3e7118=_0x51fc0f||client;return _0x3e7118[_0x1284('0x1f')](_0x9ed8a2,_0x25d899)[_0x1284('0x20')](function(_0x3ced9a){logger['info'](_0x1284('0x21'),_0x5db160,_0x1284('0x22'));logger[_0x1284('0x23')](_0x1284('0x24'),_0x5db160,_0x1284('0x22'),JSON[_0x1284('0x25')](_0x3ced9a));if(_0x3ced9a[_0x1284('0x26')]){if(_0x3ced9a[_0x1284('0x26')][_0x1284('0x27')]===0x1f4){logger[_0x1284('0x26')]('ChatQueue,\x20%s,\x20%s',_0x5db160,_0x3ced9a[_0x1284('0x26')][_0x1284('0x28')]);return _0x1dd251(_0x3ced9a[_0x1284('0x26')]['message']);}logger[_0x1284('0x26')](_0x1284('0x21'),_0x5db160,_0x3ced9a[_0x1284('0x26')][_0x1284('0x28')]);return _0xa708bf(_0x3ced9a[_0x1284('0x26')][_0x1284('0x28')]);}else{logger[_0x1284('0x29')](_0x1284('0x21'),_0x5db160,_0x1284('0x22'));_0xa708bf(_0x3ced9a[_0x1284('0x2a')][_0x1284('0x28')]);}})[_0x1284('0x2b')](function(_0x4f43ba){logger[_0x1284('0x26')](_0x1284('0x21'),_0x5db160,_0x4f43ba);_0x1dd251(_0x4f43ba);});});}function respondWithStatusCode(_0x3ef450,_0x4432e0){_0x4432e0=_0x4432e0||0xcc;return function(_0x3caec0){if(_0x3caec0){return _0x3ef450[_0x1284('0x2c')](_0x4432e0);}return _0x3ef450[_0x1284('0x2d')](_0x4432e0)[_0x1284('0x2e')]();};}function respondWithResult(_0x2bb52a,_0x2d011e){_0x2d011e=_0x2d011e||0xc8;return function(_0x480a64){if(_0x480a64){return _0x2bb52a['status'](_0x2d011e)[_0x1284('0x2f')](_0x480a64);}};}function respondWithFilteredResult(_0x32bda7,_0x52f170){return function(_0x1806fd){if(_0x1806fd){var _0x143c16=typeof _0x52f170[_0x1284('0x30')]==='undefined'&&typeof _0x52f170['limit']===_0x1284('0x31');var _0x413963=_0x1806fd[_0x1284('0x32')];var _0x246d35=_0x143c16?0x0:_0x52f170[_0x1284('0x30')];var _0x1b3bc7=_0x143c16?_0x1806fd['count']:_0x52f170[_0x1284('0x30')]+_0x52f170[_0x1284('0x33')];var _0x2bd620;if(_0x1b3bc7>=_0x413963){_0x1b3bc7=_0x413963;_0x2bd620=0xc8;}else{_0x2bd620=0xce;}_0x32bda7[_0x1284('0x2d')](_0x2bd620);return _0x32bda7[_0x1284('0x34')](_0x1284('0x35'),_0x246d35+'-'+_0x1b3bc7+'/'+_0x413963)['json'](_0x1806fd);}return null;};}function patchUpdates(_0x5691ce){return function(_0x413ea5){try{jsonpatch[_0x1284('0x36')](_0x413ea5,_0x5691ce,!![]);}catch(_0x563ba9){return BPromise['reject'](_0x563ba9);}return _0x413ea5[_0x1284('0x37')]();};}function saveUpdates(_0x3b8879,_0x3b388c){return function(_0x32ef2d){if(_0x32ef2d){return _0x32ef2d[_0x1284('0x38')](_0x3b8879)[_0x1284('0x20')](function(_0x5d8d8b){return _0x5d8d8b;});}return null;};}function removeEntity(_0x50d6a5,_0x1cb07f){return function(_0x42c2ba){if(_0x42c2ba){return _0x42c2ba['destroy']()[_0x1284('0x20')](function(){var _0x62b496=_0x42c2ba[_0x1284('0x39')]({'plain':!![]});var _0x48a336=_0x1284('0x3a');return db[_0x1284('0x3b')][_0x1284('0x3c')]({'where':{'type':_0x48a336,'resourceId':_0x62b496['id']}})[_0x1284('0x20')](function(){return _0x42c2ba;});})[_0x1284('0x20')](function(){_0x50d6a5[_0x1284('0x2d')](0xcc)[_0x1284('0x2e')]();});}};}function handleEntityNotFound(_0x3dd001,_0x40e387){return function(_0x24b0f9){if(!_0x24b0f9){_0x3dd001[_0x1284('0x2c')](0x194);}return _0x24b0f9;};}function handleError(_0x6178ed,_0x175fab){_0x175fab=_0x175fab||0x1f4;return function(_0x44b1e1){logger[_0x1284('0x26')](_0x44b1e1[_0x1284('0x3d')]);if(_0x44b1e1[_0x1284('0x3e')]){delete _0x44b1e1[_0x1284('0x3e')];}_0x6178ed[_0x1284('0x2d')](_0x175fab)['send'](_0x44b1e1);};}exports['index']=function(_0x48d157,_0x53266f){var _0x26af53={},_0x4f3eaa={},_0x280ff2={'count':0x0,'rows':[]};var _0x20b1ba=_['map'](db[_0x1284('0x3f')][_0x1284('0x40')],function(_0x4ec75f){return{'name':_0x4ec75f[_0x1284('0x41')],'type':_0x4ec75f[_0x1284('0x42')][_0x1284('0x43')]};});_0x4f3eaa['model']=_[_0x1284('0x44')](_0x20b1ba,_0x1284('0x3e'));_0x4f3eaa[_0x1284('0x45')]=_[_0x1284('0x46')](_0x48d157['query']);_0x4f3eaa[_0x1284('0x47')]=_[_0x1284('0x48')](_0x4f3eaa[_0x1284('0x49')],_0x4f3eaa[_0x1284('0x45')]);_0x26af53['attributes']=_[_0x1284('0x48')](_0x4f3eaa['model'],qs[_0x1284('0x4a')](_0x48d157['query'][_0x1284('0x4a')]));_0x26af53[_0x1284('0x4b')]=_0x26af53[_0x1284('0x4b')]['length']?_0x26af53['attributes']:_0x4f3eaa[_0x1284('0x49')];if(!_0x48d157[_0x1284('0x45')][_0x1284('0x4c')](_0x1284('0x4d'))){_0x26af53['limit']=qs[_0x1284('0x33')](_0x48d157[_0x1284('0x45')][_0x1284('0x33')]);_0x26af53['offset']=qs[_0x1284('0x30')](_0x48d157[_0x1284('0x45')][_0x1284('0x30')]);}_0x26af53['order']=qs['sort'](_0x48d157[_0x1284('0x45')][_0x1284('0x4e')]);_0x26af53[_0x1284('0x4f')]=qs[_0x1284('0x47')](_[_0x1284('0x50')](_0x48d157[_0x1284('0x45')],_0x4f3eaa[_0x1284('0x47')]),_0x20b1ba);if(_0x48d157[_0x1284('0x45')][_0x1284('0x51')]){_0x26af53[_0x1284('0x4f')]=_[_0x1284('0x52')](_0x26af53['where'],{'$or':_[_0x1284('0x44')](_0x20b1ba,function(_0x544303){if(_0x544303[_0x1284('0x42')]!=='VIRTUAL'){var _0xc443f={};_0xc443f[_0x544303[_0x1284('0x3e')]]={'$like':'%'+_0x48d157[_0x1284('0x45')][_0x1284('0x51')]+'%'};return _0xc443f;}})});}_0x26af53=_[_0x1284('0x52')]({},_0x26af53,_0x48d157[_0x1284('0x53')]);var _0x38c916={'where':_0x26af53[_0x1284('0x4f')]};return db[_0x1284('0x3f')][_0x1284('0x32')](_0x38c916)['then'](function(_0x245e70){_0x280ff2[_0x1284('0x32')]=_0x245e70;if(_0x48d157[_0x1284('0x45')]['includeAll']){_0x26af53[_0x1284('0x54')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x26af53);})[_0x1284('0x20')](function(_0x50ec4d){_0x280ff2[_0x1284('0x55')]=_0x50ec4d;return _0x280ff2;})[_0x1284('0x20')](respondWithFilteredResult(_0x53266f,_0x26af53))['catch'](handleError(_0x53266f,null));};exports[_0x1284('0x56')]=function(_0x1b6d9c,_0x536d4c){var _0x259d4c={'raw':!![],'where':{'id':_0x1b6d9c[_0x1284('0x57')]['id']}},_0x569614={};_0x569614['model']=_[_0x1284('0x46')](db['ChatQueue'][_0x1284('0x40')]);_0x569614['query']=_[_0x1284('0x46')](_0x1b6d9c[_0x1284('0x45')]);_0x569614[_0x1284('0x47')]=_['intersection'](_0x569614[_0x1284('0x49')],_0x569614[_0x1284('0x45')]);_0x259d4c[_0x1284('0x4b')]=_[_0x1284('0x48')](_0x569614[_0x1284('0x49')],qs[_0x1284('0x4a')](_0x1b6d9c['query'][_0x1284('0x4a')]));_0x259d4c[_0x1284('0x4b')]=_0x259d4c['attributes'][_0x1284('0x58')]?_0x259d4c[_0x1284('0x4b')]:_0x569614['model'];if(_0x1b6d9c[_0x1284('0x45')][_0x1284('0x59')]){_0x259d4c[_0x1284('0x54')]=[{'all':!![]}];}_0x259d4c=_[_0x1284('0x52')]({},_0x259d4c,_0x1b6d9c[_0x1284('0x53')]);return db[_0x1284('0x3f')]['find'](_0x259d4c)[_0x1284('0x20')](handleEntityNotFound(_0x536d4c,null))[_0x1284('0x20')](respondWithResult(_0x536d4c,null))['catch'](handleError(_0x536d4c,null));};exports[_0x1284('0x5a')]=function(_0x52fa13,_0x3ddbcb){return db['ChatQueue']['create'](_0x52fa13[_0x1284('0x5b')],{})[_0x1284('0x20')](function(_0x428e39){var _0x3bae34=_0x52fa13['user'][_0x1284('0x39')]({'plain':!![]});if(!_0x3bae34)throw new Error(_0x1284('0x5c'));if(_0x3bae34['role']===_0x1284('0x5d')){var _0x4d45d9=_0x428e39[_0x1284('0x39')]({'plain':!![]});var _0x2e431d=_0x1284('0x3a');return db[_0x1284('0x5e')][_0x1284('0x5f')]({'where':{'name':_0x2e431d,'userProfileId':_0x3bae34[_0x1284('0x60')]},'raw':!![]})[_0x1284('0x20')](function(_0x23e22a){if(_0x23e22a&&_0x23e22a[_0x1284('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x4d45d9[_0x1284('0x3e')],'resourceId':_0x4d45d9['id'],'type':_0x23e22a[_0x1284('0x3e')],'sectionId':_0x23e22a['id']},{})[_0x1284('0x20')](function(){return _0x428e39;});}else{return _0x428e39;}})['catch'](function(_0x47420c){logger[_0x1284('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47420c);throw _0x47420c;});}return _0x428e39;})[_0x1284('0x20')](respondWithResult(_0x3ddbcb,0xc9))[_0x1284('0x2b')](handleError(_0x3ddbcb,null));};exports['update']=function(_0x3bc14f,_0x2637d){if(_0x3bc14f[_0x1284('0x5b')]['id']){delete _0x3bc14f[_0x1284('0x5b')]['id'];}return db[_0x1284('0x3f')]['find']({'where':{'id':_0x3bc14f[_0x1284('0x57')]['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x2637d,null))[_0x1284('0x20')](saveUpdates(_0x3bc14f[_0x1284('0x5b')],null))[_0x1284('0x20')](respondWithResult(_0x2637d,null))['catch'](handleError(_0x2637d,null));};exports['destroy']=function(_0xef120c,_0xb512a2){return db[_0x1284('0x3f')][_0x1284('0x5f')]({'where':{'id':_0xef120c['params']['id']}})['then'](handleEntityNotFound(_0xb512a2,null))['then'](removeEntity(_0xb512a2,null))[_0x1284('0x2b')](handleError(_0xb512a2,null));};exports['describe']=function(_0x91775,_0x642265){return db[_0x1284('0x3f')][_0x1284('0x62')]()[_0x1284('0x20')](respondWithResult(_0x642265,null))[_0x1284('0x2b')](handleError(_0x642265,null));};exports['getMembers']=function(_0x125249,_0x1e56a0,_0x409754){var _0x1620ed={'raw':!![],'where':{}},_0x163c80={},_0x5aad50;return db[_0x1284('0x3f')]['findOne']({'where':{'id':_0x125249[_0x1284('0x57')]['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x1e56a0,null))[_0x1284('0x20')](function(_0x58034d){if(_0x58034d){_0x5aad50=_0x58034d['get']({'plain':!![]});_0x163c80[_0x1284('0x49')]=_[_0x1284('0x46')](db[_0x1284('0x63')]['rawAttributes']);_0x163c80[_0x1284('0x45')]=_[_0x1284('0x46')](_0x125249[_0x1284('0x45')]);_0x163c80['filters']=_['intersection'](_0x163c80[_0x1284('0x49')],_0x163c80[_0x1284('0x45')]);_0x1620ed[_0x1284('0x4b')]=_[_0x1284('0x48')](_0x163c80['model'],qs['fields'](_0x125249[_0x1284('0x45')]['fields']));_0x1620ed[_0x1284('0x4b')]=_0x1620ed['attributes']['length']?_0x1620ed['attributes']:_0x163c80[_0x1284('0x49')];if(!_0x125249['query'][_0x1284('0x4c')](_0x1284('0x4d'))){_0x1620ed[_0x1284('0x33')]=qs[_0x1284('0x33')](_0x125249[_0x1284('0x45')][_0x1284('0x33')]);_0x1620ed[_0x1284('0x30')]=qs[_0x1284('0x30')](_0x125249[_0x1284('0x45')][_0x1284('0x30')]);}_0x1620ed[_0x1284('0x64')]=qs['sort'](_0x125249[_0x1284('0x45')][_0x1284('0x4e')]);_0x1620ed[_0x1284('0x4f')]=qs['filters'](_[_0x1284('0x50')](_0x125249[_0x1284('0x45')],_0x163c80[_0x1284('0x47')]));_0x1620ed[_0x1284('0x4f')][_0x1284('0x65')]=_0x58034d['id'];if(_0x125249['query'][_0x1284('0x51')]){_0x1620ed[_0x1284('0x4f')]=_['merge'](_0x1620ed[_0x1284('0x4f')],{'$or':_[_0x1284('0x44')](_0x1620ed[_0x1284('0x4b')],function(_0x4df6ac){var _0x253ef7={};_0x253ef7[_0x4df6ac]={'$like':'%'+_0x125249['query'][_0x1284('0x51')]+'%'};return _0x253ef7;})});}_0x1620ed=_[_0x1284('0x52')]({},_0x1620ed,_0x125249['options']);return db[_0x1284('0x63')]['findAll'](_0x1620ed);}})[_0x1284('0x20')](function(_0x4ca99a){if(_0x4ca99a){return db[_0x1284('0x66')]['findAndCountAll']({'where':{'id':_['map'](_0x4ca99a,_0x1284('0x67')),'role':_0x1284('0x68')},'attributes':['id','name','chatPause',_0x1284('0x69'),'createdAt']});}})[_0x1284('0x20')](function(_0x4db9c6){if(_0x4db9c6){return{'count':_0x4db9c6['count'],'rows':_['map'](_0x4db9c6[_0x1284('0x55')],function(_0x459ab9){return{'membername':_0x459ab9['name'],'UserId':_0x459ab9['id'],'queue_name':_0x5aad50[_0x1284('0x3e')],'ChatQueueId':_0x5aad50['id'],'interface':util['format'](_0x1284('0x6a'),_0x1284('0x6b'),_0x459ab9[_0x1284('0x3e')]),'penalty':0x0,'paused':_0x459ab9['chatPause'],'createdAt':_0x459ab9[_0x1284('0x6c')],'updatedAt':_0x459ab9[_0x1284('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1284('0x20')](respondWithFilteredResult(_0x1e56a0,_0x1620ed))[_0x1284('0x2b')](handleError(_0x1e56a0,null));};exports['getTeams']=function(_0x414466,_0x4cf1e7,_0x54ed29){var _0x2a6437={};var _0x5b61a2={};var _0x453196;var _0x8e22a0;return db[_0x1284('0x3f')][_0x1284('0x6d')]({'where':{'id':_0x414466[_0x1284('0x57')]['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x4cf1e7,null))['then'](function(_0x6fdd54){if(_0x6fdd54){_0x453196=_0x6fdd54;_0x5b61a2[_0x1284('0x49')]=_['keys'](db[_0x1284('0x6e')][_0x1284('0x40')]);_0x5b61a2['query']=_[_0x1284('0x46')](_0x414466[_0x1284('0x45')]);_0x5b61a2[_0x1284('0x47')]=_[_0x1284('0x48')](_0x5b61a2['model'],_0x5b61a2['query']);_0x2a6437['attributes']=_[_0x1284('0x48')](_0x5b61a2[_0x1284('0x49')],qs[_0x1284('0x4a')](_0x414466[_0x1284('0x45')][_0x1284('0x4a')]));_0x2a6437[_0x1284('0x4b')]=_0x2a6437[_0x1284('0x4b')][_0x1284('0x58')]?_0x2a6437[_0x1284('0x4b')]:_0x5b61a2['model'];_0x2a6437[_0x1284('0x64')]=qs[_0x1284('0x4e')](_0x414466[_0x1284('0x45')]['sort']);_0x2a6437[_0x1284('0x4f')]=qs['filters'](_[_0x1284('0x50')](_0x414466['query'],_0x5b61a2[_0x1284('0x47')]));if(_0x414466[_0x1284('0x45')][_0x1284('0x51')]){_0x2a6437[_0x1284('0x4f')]=_[_0x1284('0x52')](_0x2a6437[_0x1284('0x4f')],{'$or':_[_0x1284('0x44')](_0x2a6437[_0x1284('0x4b')],function(_0x4c3d2a){var _0x338cea={};_0x338cea[_0x4c3d2a]={'$like':'%'+_0x414466[_0x1284('0x45')][_0x1284('0x51')]+'%'};return _0x338cea;})});}_0x2a6437=_[_0x1284('0x52')]({},_0x2a6437,_0x414466[_0x1284('0x53')]);return _0x453196[_0x1284('0x6f')](_0x2a6437);}})[_0x1284('0x20')](function(_0x4492a1){if(_0x4492a1){_0x8e22a0=_0x4492a1[_0x1284('0x58')];if(!_0x414466[_0x1284('0x45')][_0x1284('0x4c')](_0x1284('0x4d'))){_0x2a6437[_0x1284('0x33')]=qs[_0x1284('0x33')](_0x414466[_0x1284('0x45')][_0x1284('0x33')]);_0x2a6437[_0x1284('0x30')]=qs[_0x1284('0x30')](_0x414466[_0x1284('0x45')][_0x1284('0x30')]);}return _0x453196[_0x1284('0x6f')](_0x2a6437);}})[_0x1284('0x20')](function(_0xf86282){if(_0xf86282){return _0xf86282?{'count':_0x8e22a0,'rows':_0xf86282}:null;}})[_0x1284('0x20')](respondWithResult(_0x4cf1e7,null))[_0x1284('0x2b')](handleError(_0x4cf1e7,null));};exports[_0x1284('0x70')]=function(_0x1b53e4,_0x8f3c48,_0x595085){var _0x3ecce0=_0x1b53e4[_0x1284('0x5b')][_0x1284('0x71')];return db['Team']['findAll']({'where':{'id':_0x3ecce0},'attributes':['id'],'include':[{'model':db[_0x1284('0x66')],'as':_0x1284('0x72'),'attributes':['id',_0x1284('0x3e'),_0x1284('0x73'),'voicePause','interface'],'raw':!![]}]})[_0x1284('0x20')](function(_0x2d852f){if(_0x2d852f){var _0xb509e=_['flatMap'](_0x2d852f,function(_0x45e594){var _0x4108c7=_0x45e594[_0x1284('0x39')]({'plain':!![]});return _0x4108c7[_0x1284('0x72')];});return db[_0x1284('0x3f')][_0x1284('0x5f')]({'where':{'id':_0x1b53e4[_0x1284('0x57')]['id']}})[_0x1284('0x20')](function(_0x2f130b){return db[_0x1284('0x74')][_0x1284('0x75')](function(_0x32df97){return _0x2f130b[_0x1284('0x70')](_0x3ecce0,{'transaction':_0x32df97})['then'](function(){return BPromise[_0x1284('0x76')](_0xb509e,function(_0x124d49){return db[_0x1284('0x63')]['findOrCreate']({'where':{'UserId':_0x124d49['id'],'ChatQueueId':_0x1b53e4['params']['id']},'transaction':_0x32df97});});})[_0x1284('0x20')](function(){_0xb509e[_0x1284('0x77')](function(_0x3b2b9f){socket['emit']('userChatQueue:save',{'UserId':_0x3b2b9f['id'],'ChatQueueId':_0x2f130b['id']});});});});});}})['then'](respondWithStatusCode(_0x8f3c48,null))[_0x1284('0x2b')](handleError(_0x8f3c48,null));};exports[_0x1284('0x78')]=function(_0x1f976b,_0x2ecbba,_0x18ec9f){return db[_0x1284('0x6e')][_0x1284('0x79')]({'where':{'id':_0x1f976b[_0x1284('0x45')][_0x1284('0x71')]},'attributes':['id'],'include':[{'model':db[_0x1284('0x66')],'as':_0x1284('0x72'),'attributes':['id'],'raw':!![]}]})[_0x1284('0x20')](handleEntityNotFound(_0x2ecbba,null))[_0x1284('0x20')](function(_0x2cc9b3){var _0x52a25f=_[_0x1284('0x44')](_0x2cc9b3,'id');var _0x5247ea=[];var _0x321659=[];var _0x4ecb6=squel[_0x1284('0x7a')]();_0x4ecb6[_0x1284('0x7b')](_0x1284('0x7c'))[_0x1284('0x7d')](_0x1284('0x7e'),'tq')[_0x1284('0x7f')](_0x1284('0x80'),'ut',_0x1284('0x81'))['where'](_0x1284('0x82'),_0x1f976b['params']['id']);for(var _0x597060=0x0;_0x597060<_0x2cc9b3[_0x1284('0x58')];_0x597060+=0x1){let _0x49d82e=_0x2cc9b3[_0x597060];for(var _0x30b299=0x0;_0x30b299<_0x49d82e[_0x1284('0x72')][_0x1284('0x58')];_0x30b299+=0x1){let _0x288e3c=_0x49d82e[_0x1284('0x72')][_0x30b299];var _0x2cd5b6=_0x4ecb6[_0x1284('0x83')]();_0x2cd5b6['where'](_0x1284('0x84'),_0x288e3c['id']);_0x321659[_0x1284('0x85')](db['sequelize'][_0x1284('0x45')](_0x2cd5b6[_0x1284('0x86')](),{'type':db[_0x1284('0x74')][_0x1284('0x87')][_0x1284('0x88')]})[_0x1284('0x20')](function(_0x1f8657){if(_0x1f8657[_0x1284('0x58')]===0x1){return _0x288e3c['id'];}else{var _0x4e5f56=_[_0x1284('0x89')](_[_0x1284('0x44')](_0x1f8657,_0x1284('0x8a')),function(_0x38e361){return _[_0x1284('0x8b')](_0x52a25f,_0x38e361);});if(_0x4e5f56){return _0x288e3c['id'];}}}));}}return BPromise[_0x1284('0x8c')](_0x321659)[_0x1284('0x20')](function(_0x281092){_0x5247ea=_(_0x5247ea)[_0x1284('0x8d')](_0x281092)[_0x1284('0x8e')]()[_0x1284('0x8f')]();return db[_0x1284('0x3f')][_0x1284('0x5f')]({'where':{'id':_0x1f976b[_0x1284('0x57')]['id']}})[_0x1284('0x20')](function(_0x352f50){return db[_0x1284('0x74')][_0x1284('0x75')](function(_0x48eb94){return _0x352f50[_0x1284('0x78')](_0x1f976b[_0x1284('0x45')][_0x1284('0x71')],{'transaction':_0x48eb94})[_0x1284('0x20')](function(){if(!_['isEmpty'](_0x5247ea)){return _0x352f50[_0x1284('0x90')](_0x5247ea,{'transaction':_0x48eb94});}})['then'](function(){_0x5247ea[_0x1284('0x77')](function(_0x1787d2){socket[_0x1284('0x91')]('userChatQueue:remove',{'UserId':_0x1787d2,'ChatQueueId':_0x352f50['id']});});});});});});})[_0x1284('0x20')](respondWithStatusCode(_0x2ecbba,null))[_0x1284('0x2b')](handleError(_0x2ecbba,null));};exports[_0x1284('0x92')]=function(_0x245ffe,_0x5e3900,_0x3fe3ca){return db['ChatQueue']['find']({'where':{'id':_0x245ffe[_0x1284('0x57')]['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x5e3900,null))['then'](function(_0x5cedd6){if(_0x5cedd6){return _0x5cedd6['addAgents'](_0x245ffe[_0x1284('0x5b')]['ids'],_['omit'](_0x245ffe[_0x1284('0x5b')],[_0x1284('0x71'),'id'])||{})[_0x1284('0x93')](function(_0x399af9){for(var _0x3d5e4a=0x0;_0x3d5e4a<_0x245ffe[_0x1284('0x5b')][_0x1284('0x71')][_0x1284('0x58')];_0x3d5e4a+=0x1){socket[_0x1284('0x91')](_0x1284('0x94'),{'UserId':Number(_0x245ffe[_0x1284('0x5b')][_0x1284('0x71')][_0x3d5e4a]),'ChatQueueId':Number(_0x245ffe[_0x1284('0x57')]['id'])});}return _0x399af9;});}})['then'](respondWithResult(_0x5e3900,null))['catch'](handleError(_0x5e3900,null));};exports[_0x1284('0x90')]=function(_0x207170,_0x3eb298,_0x4361aa){return db[_0x1284('0x3f')][_0x1284('0x5f')]({'where':{'id':_0x207170['params']['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x3eb298,null))[_0x1284('0x20')](function(_0x14d1c9){if(_0x14d1c9){return _0x14d1c9[_0x1284('0x90')](_0x207170[_0x1284('0x45')][_0x1284('0x71')])[_0x1284('0x20')](function(){if(_[_0x1284('0x95')](_0x207170[_0x1284('0x45')][_0x1284('0x71')])){for(var _0x4cc3e5=0x0;_0x4cc3e5<_0x207170[_0x1284('0x45')][_0x1284('0x71')]['length'];_0x4cc3e5+=0x1){socket[_0x1284('0x91')](_0x1284('0x96'),{'UserId':Number(_0x207170['query'][_0x1284('0x71')][_0x4cc3e5]),'ChatQueueId':Number(_0x207170[_0x1284('0x57')]['id'])});}}else{socket[_0x1284('0x91')](_0x1284('0x96'),{'UserId':Number(_0x207170[_0x1284('0x45')][_0x1284('0x71')]),'ChatQueueId':Number(_0x207170[_0x1284('0x57')]['id'])});}});}})[_0x1284('0x20')](respondWithStatusCode(_0x3eb298,null))[_0x1284('0x2b')](handleError(_0x3eb298,null));};exports[_0x1284('0x97')]=function(_0x49ccb1,_0x3f3689,_0x48ea9a){var _0x3a7222={};var _0x4a4e30={};var _0x441f51;var _0x7d3a75;return db[_0x1284('0x3f')]['findOne']({'where':{'id':_0x49ccb1[_0x1284('0x57')]['id']}})[_0x1284('0x20')](handleEntityNotFound(_0x3f3689,null))[_0x1284('0x20')](function(_0x11076e){if(_0x11076e){_0x441f51=_0x11076e;_0x4a4e30[_0x1284('0x49')]=_[_0x1284('0x46')](db[_0x1284('0x66')][_0x1284('0x40')]);_0x4a4e30[_0x1284('0x45')]=_[_0x1284('0x46')](_0x49ccb1[_0x1284('0x45')]);_0x4a4e30[_0x1284('0x47')]=_[_0x1284('0x48')](_0x4a4e30['model'],_0x4a4e30[_0x1284('0x45')]);_0x3a7222['attributes']=_[_0x1284('0x48')](_0x4a4e30[_0x1284('0x49')],qs['fields'](_0x49ccb1['query']['fields']));_0x3a7222[_0x1284('0x4b')]=_0x3a7222[_0x1284('0x4b')]['length']?_0x3a7222[_0x1284('0x4b')]:_0x4a4e30[_0x1284('0x49')];_0x3a7222['order']=qs[_0x1284('0x4e')](_0x49ccb1[_0x1284('0x45')][_0x1284('0x4e')]);_0x3a7222[_0x1284('0x4f')]=qs[_0x1284('0x47')](_[_0x1284('0x50')](_0x49ccb1[_0x1284('0x45')],_0x4a4e30['filters']));if(_0x49ccb1[_0x1284('0x45')][_0x1284('0x51')]){_0x3a7222[_0x1284('0x4f')]=_[_0x1284('0x52')](_0x3a7222[_0x1284('0x4f')],{'$or':_[_0x1284('0x44')](_0x3a7222['attributes'],function(_0x14216b){var _0x470c26={};_0x470c26[_0x14216b]={'$like':'%'+_0x49ccb1[_0x1284('0x45')]['filter']+'%'};return _0x470c26;})});}_0x3a7222=_['merge']({},_0x3a7222,_0x49ccb1[_0x1284('0x53')]);return _0x441f51[_0x1284('0x97')](_0x3a7222);}})[_0x1284('0x20')](function(_0x4a1fc3){if(_0x4a1fc3){_0x7d3a75=_0x4a1fc3[_0x1284('0x58')];if(!_0x49ccb1['query'][_0x1284('0x4c')]('nolimit')){_0x3a7222[_0x1284('0x33')]=qs[_0x1284('0x33')](_0x49ccb1[_0x1284('0x45')][_0x1284('0x33')]);_0x3a7222['offset']=qs['offset'](_0x49ccb1[_0x1284('0x45')][_0x1284('0x30')]);}return _0x441f51['getAgents'](_0x3a7222);}})['then'](function(_0x36d760){if(_0x36d760){return _0x36d760?{'count':_0x7d3a75,'rows':_0x36d760}:null;}})['then'](respondWithResult(_0x3f3689,null))[_0x1284('0x2b')](handleError(_0x3f3689,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d3c10f9..fb9a7c3 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 _0x6986=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x265bd0,_0x5f2d31){var _0x5f09d0=function(_0x2fd8d2){while(--_0x2fd8d2){_0x265bd0['push'](_0x265bd0['shift']());}};_0x5f09d0(++_0x5f2d31);}(_0x6986,0x148));var _0x6698=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x6986[_0x340756];return _0x2ef745;};'use strict';var EventEmitter=require(_0x6698('0x0'));var ChatQueue=require(_0x6698('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6698('0x2')](0x0);var events={'afterCreate':_0x6698('0x3'),'afterUpdate':_0x6698('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3cafb4){return function(_0x318cbd,_0x2bfe20,_0x2b870c){ChatQueueEvents[_0x6698('0x5')](_0x3cafb4+':'+_0x318cbd['id'],_0x318cbd);ChatQueueEvents[_0x6698('0x5')](_0x3cafb4,_0x318cbd);_0x2b870c(null);};}for(var e in events){if(events[_0x6698('0x6')](e)){var event=events[e];ChatQueue[_0x6698('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x9003=['update','remove','emit','hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save'];(function(_0x312954,_0x4d6994){var _0x23a597=function(_0x368cae){while(--_0x368cae){_0x312954['push'](_0x312954['shift']());}};_0x23a597(++_0x4d6994);}(_0x9003,0x1c7));var _0x3900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9003[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x3900('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x3900('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3900('0x2')](0x0);var events={'afterCreate':_0x3900('0x3'),'afterUpdate':_0x3900('0x4'),'afterDestroy':_0x3900('0x5')};function emitEvent(_0x3962ad){return function(_0x2fee4c,_0x257240,_0x2a2fca){ChatQueueEvents[_0x3900('0x6')](_0x3962ad+':'+_0x2fee4c['id'],_0x2fee4c);ChatQueueEvents[_0x3900('0x6')](_0x3962ad,_0x2fee4c);_0x2a2fca(null);};}for(var e in events){if(events[_0x3900('0x7')](e)){var event=events[e];ChatQueue[_0x3900('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8e2717b..384cadf 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 _0xa991=['exports','define','ChatQueue','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatQueue.attributes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xa991,0x1bb));var _0x1a99=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa991[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x1a99('0x0'));var logger=require(_0x1a99('0x1'))(_0x1a99('0x2'));var moment=require('moment');var BPromise=require(_0x1a99('0x3'));var rp=require(_0x1a99('0x4'));var fs=require('fs');var path=require(_0x1a99('0x5'));var rimraf=require(_0x1a99('0x6'));var config=require('../../config/environment');var attributes=require(_0x1a99('0x7'));module[_0x1a99('0x8')]=function(_0x2c80b2,_0x3da13f){return _0x2c80b2[_0x1a99('0x9')](_0x1a99('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x856b=['rimraf','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x593987,_0xb4c0d7){var _0x489bf9=function(_0xdaeb7a){while(--_0xdaeb7a){_0x593987['push'](_0x593987['shift']());}};_0x489bf9(++_0xb4c0d7);}(_0x856b,0x179));var _0xb856=function(_0x2d595f,_0xdfdb46){_0x2d595f=_0x2d595f-0x0;var _0x1e26a2=_0x856b[_0x2d595f];return _0x1e26a2;};'use strict';var _=require(_0xb856('0x0'));var util=require(_0xb856('0x1'));var logger=require(_0xb856('0x2'))(_0xb856('0x3'));var moment=require(_0xb856('0x4'));var BPromise=require('bluebird');var rp=require(_0xb856('0x5'));var fs=require('fs');var path=require(_0xb856('0x6'));var rimraf=require(_0xb856('0x7'));var config=require('../../config/environment');var attributes=require(_0xb856('0x8'));module[_0xb856('0x9')]=function(_0x21bc0e,_0x10abb8){return _0x21bc0e[_0xb856('0xa')]('ChatQueue',attributes,{'tableName':_0xb856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 720ab80..367ed69 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 _0x32d3=['lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','map','include','model','then','stringify','ShowChatQueue'];(function(_0x49915d,_0x2447c4){var _0x386000=function(_0x59aeb9){while(--_0x59aeb9){_0x49915d['push'](_0x49915d['shift']());}};_0x386000(++_0x2447c4);}(_0x32d3,0xee));var _0x332d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x32d3[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x332d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x332d('0x1'));var db=require(_0x332d('0x2'))['db'];var utils=require(_0x332d('0x3'));var logger=require(_0x332d('0x4'))('rpc');var config=require(_0x332d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x332d('0x6')][_0x332d('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x332d('0x8')],{'host':_0x332d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x332d('0x8')]));require('./chatQueue.socket')[_0x332d('0xa')](socket);function respondWithRpcPromise(_0x7907e0,_0x1b805a,_0x111323){return new BPromise(function(_0x4755c5,_0x10dd59){return client['request'](_0x7907e0,_0x111323)['then'](function(_0x23d9e3){logger[_0x332d('0xb')](_0x332d('0xc'),_0x1b805a,_0x332d('0xd'));logger[_0x332d('0xe')](_0x332d('0xf'),_0x1b805a,_0x332d('0xd'),JSON['stringify'](_0x23d9e3));if(_0x23d9e3[_0x332d('0x10')]){if(_0x23d9e3[_0x332d('0x10')][_0x332d('0x11')]===0x1f4){logger['error'](_0x332d('0xc'),_0x1b805a,_0x23d9e3[_0x332d('0x10')][_0x332d('0x12')]);return _0x10dd59(_0x23d9e3[_0x332d('0x10')][_0x332d('0x12')]);}logger[_0x332d('0x10')]('ChatQueue,\x20%s,\x20%s',_0x1b805a,_0x23d9e3[_0x332d('0x10')]['message']);return _0x4755c5(_0x23d9e3['error'][_0x332d('0x12')]);}else{logger[_0x332d('0xb')](_0x332d('0xc'),_0x1b805a,_0x332d('0xd'));_0x4755c5(_0x23d9e3[_0x332d('0x13')][_0x332d('0x12')]);}})[_0x332d('0x14')](function(_0x16a855){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1b805a,_0x16a855);_0x10dd59(_0x16a855);});});}exports[_0x332d('0x15')]=function(_0x3871da){var _0x4832df=this;return new Promise(function(_0x1d42d2,_0x46b208){return db[_0x332d('0x16')][_0x332d('0x17')]({'raw':_0x3871da[_0x332d('0x18')]?_0x3871da['options']['raw']===undefined?!![]:![]:!![],'where':_0x3871da['options']?_0x3871da[_0x332d('0x18')][_0x332d('0x19')]||null:null,'attributes':_0x3871da[_0x332d('0x18')]?_0x3871da[_0x332d('0x18')][_0x332d('0x1a')]||null:null,'limit':_0x3871da[_0x332d('0x18')]?_0x3871da[_0x332d('0x18')][_0x332d('0x1b')]||null:null,'include':_0x3871da[_0x332d('0x18')]?_0x3871da[_0x332d('0x18')]['include']?_[_0x332d('0x1c')](_0x3871da[_0x332d('0x18')][_0x332d('0x1d')],function(_0x261625){return{'model':db[_0x261625[_0x332d('0x1e')]],'as':_0x261625['as'],'attributes':_0x261625[_0x332d('0x1a')],'include':_0x261625[_0x332d('0x1d')]?_[_0x332d('0x1c')](_0x261625[_0x332d('0x1d')],function(_0x46b5ab){return{'model':db[_0x46b5ab[_0x332d('0x1e')]],'as':_0x46b5ab['as'],'attributes':_0x46b5ab['attributes'],'include':_0x46b5ab['include']?_[_0x332d('0x1c')](_0x46b5ab[_0x332d('0x1d')],function(_0x2cd43e){return{'model':db[_0x2cd43e['model']],'as':_0x2cd43e['as'],'attributes':_0x2cd43e[_0x332d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x332d('0x1f')](function(_0x38c15c){logger[_0x332d('0xb')](_0x332d('0x15'),_0x3871da);logger['debug'](_0x332d('0x15'),_0x3871da,JSON[_0x332d('0x20')](_0x38c15c));_0x1d42d2(_0x38c15c);})[_0x332d('0x14')](function(_0x233362){logger[_0x332d('0x10')]('GetChatQueue',_0x233362[_0x332d('0x12')],_0x3871da);_0x46b208(_0x4832df['error'](0x1f4,_0x233362[_0x332d('0x12')]));});});};exports[_0x332d('0x21')]=function(_0x457a80){var _0x2ae917=this;return new Promise(function(_0x2296fa,_0x394a6a){return db[_0x332d('0x16')]['find']({'raw':_0x457a80[_0x332d('0x18')]?_0x457a80[_0x332d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x457a80['options']?_0x457a80[_0x332d('0x18')]['where']||null:null,'attributes':_0x457a80['options']?_0x457a80[_0x332d('0x18')][_0x332d('0x1a')]||null:null,'include':_0x457a80[_0x332d('0x18')]?_0x457a80['options'][_0x332d('0x1d')]?_[_0x332d('0x1c')](_0x457a80[_0x332d('0x18')][_0x332d('0x1d')],function(_0x4ce9e7){return{'model':db[_0x4ce9e7[_0x332d('0x1e')]],'as':_0x4ce9e7['as'],'attributes':_0x4ce9e7[_0x332d('0x1a')],'include':_0x4ce9e7[_0x332d('0x1d')]?_[_0x332d('0x1c')](_0x4ce9e7[_0x332d('0x1d')],function(_0x4ad197){return{'model':db[_0x4ad197[_0x332d('0x1e')]],'as':_0x4ad197['as'],'attributes':_0x4ad197['attributes'],'include':_0x4ad197[_0x332d('0x1d')]?_[_0x332d('0x1c')](_0x4ad197[_0x332d('0x1d')],function(_0x2402a6){return{'model':db[_0x2402a6['model']],'as':_0x2402a6['as'],'attributes':_0x2402a6[_0x332d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x332d('0x1f')](function(_0x3f5619){logger[_0x332d('0xb')](_0x332d('0x21'),_0x457a80);logger[_0x332d('0xe')](_0x332d('0x21'),_0x457a80,JSON['stringify'](_0x3f5619));_0x2296fa(_0x3f5619);})[_0x332d('0x14')](function(_0x33c9cf){logger[_0x332d('0x10')]('ShowChatQueue',_0x33c9cf[_0x332d('0x12')],_0x457a80);_0x394a6a(_0x2ae917['error'](0x1f4,_0x33c9cf[_0x332d('0x12')]));});});}; \ No newline at end of file +var _0x707b=['../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','include','model','attributes','map','find','ShowChatQueue','lodash','util','moment','randomstring','../../config/utils'];(function(_0x26f20b,_0x65fc89){var _0xb37af9=function(_0x3cbddd){while(--_0x3cbddd){_0x26f20b['push'](_0x26f20b['shift']());}};_0xb37af9(++_0x65fc89);}(_0x707b,0xdf));var _0xb707=function(_0x2ccf59,_0x196b84){_0x2ccf59=_0x2ccf59-0x0;var _0x3c4cb2=_0x707b[_0x2ccf59];return _0x3c4cb2;};'use strict';var _=require(_0xb707('0x0'));var util=require(_0xb707('0x1'));var moment=require(_0xb707('0x2'));var BPromise=require('bluebird');var rs=require(_0xb707('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb707('0x4'));var logger=require(_0xb707('0x5'))(_0xb707('0x6'));var config=require(_0xb707('0x7'));var jayson=require(_0xb707('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb707('0x9')](config[_0xb707('0xa')],{'host':_0xb707('0xb'),'port':0x18eb});var socket=require(_0xb707('0xc'))(new Redis(config['redis']));require(_0xb707('0xd'))[_0xb707('0xe')](socket);function respondWithRpcPromise(_0x4ee772,_0x51edf1,_0x4ab9aa){return new BPromise(function(_0x2bc886,_0x5b152b){return client[_0xb707('0xf')](_0x4ee772,_0x4ab9aa)[_0xb707('0x10')](function(_0x1ad477){logger[_0xb707('0x11')](_0xb707('0x12'),_0x51edf1,_0xb707('0x13'));logger[_0xb707('0x14')](_0xb707('0x15'),_0x51edf1,'request\x20sent',JSON[_0xb707('0x16')](_0x1ad477));if(_0x1ad477[_0xb707('0x17')]){if(_0x1ad477[_0xb707('0x17')]['code']===0x1f4){logger[_0xb707('0x17')]('ChatQueue,\x20%s,\x20%s',_0x51edf1,_0x1ad477[_0xb707('0x17')][_0xb707('0x18')]);return _0x5b152b(_0x1ad477[_0xb707('0x17')][_0xb707('0x18')]);}logger[_0xb707('0x17')]('ChatQueue,\x20%s,\x20%s',_0x51edf1,_0x1ad477[_0xb707('0x17')][_0xb707('0x18')]);return _0x2bc886(_0x1ad477['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x51edf1,'request\x20sent');_0x2bc886(_0x1ad477[_0xb707('0x19')][_0xb707('0x18')]);}})[_0xb707('0x1a')](function(_0x48c4a1){logger[_0xb707('0x17')](_0xb707('0x12'),_0x51edf1,_0x48c4a1);_0x5b152b(_0x48c4a1);});});}exports[_0xb707('0x1b')]=function(_0x2d7e92){var _0x202b24=this;return new Promise(function(_0x398fb6,_0x2e3c04){return db[_0xb707('0x1c')]['findAll']({'raw':_0x2d7e92[_0xb707('0x1d')]?_0x2d7e92['options'][_0xb707('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d7e92[_0xb707('0x1d')]?_0x2d7e92[_0xb707('0x1d')][_0xb707('0x1f')]||null:null,'attributes':_0x2d7e92[_0xb707('0x1d')]?_0x2d7e92[_0xb707('0x1d')]['attributes']||null:null,'limit':_0x2d7e92[_0xb707('0x1d')]?_0x2d7e92[_0xb707('0x1d')]['limit']||null:null,'include':_0x2d7e92[_0xb707('0x1d')]?_0x2d7e92[_0xb707('0x1d')][_0xb707('0x20')]?_['map'](_0x2d7e92[_0xb707('0x1d')][_0xb707('0x20')],function(_0x28cfb5){return{'model':db[_0x28cfb5[_0xb707('0x21')]],'as':_0x28cfb5['as'],'attributes':_0x28cfb5[_0xb707('0x22')],'include':_0x28cfb5['include']?_[_0xb707('0x23')](_0x28cfb5[_0xb707('0x20')],function(_0x5890b1){return{'model':db[_0x5890b1[_0xb707('0x21')]],'as':_0x5890b1['as'],'attributes':_0x5890b1[_0xb707('0x22')],'include':_0x5890b1[_0xb707('0x20')]?_[_0xb707('0x23')](_0x5890b1[_0xb707('0x20')],function(_0x5dade7){return{'model':db[_0x5dade7[_0xb707('0x21')]],'as':_0x5dade7['as'],'attributes':_0x5dade7[_0xb707('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb707('0x10')](function(_0x5ef1f7){logger['info'](_0xb707('0x1b'),_0x2d7e92);logger[_0xb707('0x14')](_0xb707('0x1b'),_0x2d7e92,JSON['stringify'](_0x5ef1f7));_0x398fb6(_0x5ef1f7);})['catch'](function(_0x4a7cfb){logger[_0xb707('0x17')]('GetChatQueue',_0x4a7cfb[_0xb707('0x18')],_0x2d7e92);_0x2e3c04(_0x202b24[_0xb707('0x17')](0x1f4,_0x4a7cfb[_0xb707('0x18')]));});});};exports['ShowChatQueue']=function(_0x164906){var _0x4eccc8=this;return new Promise(function(_0x4ccb7b,_0x35f327){return db[_0xb707('0x1c')][_0xb707('0x24')]({'raw':_0x164906[_0xb707('0x1d')]?_0x164906[_0xb707('0x1d')][_0xb707('0x1e')]===undefined?!![]:![]:!![],'where':_0x164906['options']?_0x164906['options']['where']||null:null,'attributes':_0x164906[_0xb707('0x1d')]?_0x164906[_0xb707('0x1d')]['attributes']||null:null,'include':_0x164906[_0xb707('0x1d')]?_0x164906[_0xb707('0x1d')][_0xb707('0x20')]?_['map'](_0x164906['options'][_0xb707('0x20')],function(_0x10f15d){return{'model':db[_0x10f15d[_0xb707('0x21')]],'as':_0x10f15d['as'],'attributes':_0x10f15d[_0xb707('0x22')],'include':_0x10f15d[_0xb707('0x20')]?_[_0xb707('0x23')](_0x10f15d['include'],function(_0x4b12eb){return{'model':db[_0x4b12eb[_0xb707('0x21')]],'as':_0x4b12eb['as'],'attributes':_0x4b12eb[_0xb707('0x22')],'include':_0x4b12eb['include']?_[_0xb707('0x23')](_0x4b12eb[_0xb707('0x20')],function(_0x3a8723){return{'model':db[_0x3a8723[_0xb707('0x21')]],'as':_0x3a8723['as'],'attributes':_0x3a8723[_0xb707('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb707('0x10')](function(_0x34dcf7){logger[_0xb707('0x11')](_0xb707('0x25'),_0x164906);logger[_0xb707('0x14')]('ShowChatQueue',_0x164906,JSON['stringify'](_0x34dcf7));_0x4ccb7b(_0x34dcf7);})[_0xb707('0x1a')](function(_0x3a0443){logger[_0xb707('0x17')](_0xb707('0x25'),_0x3a0443[_0xb707('0x18')],_0x164906);_0x35f327(_0x4eccc8[_0xb707('0x17')](0x1f4,_0x3a0443[_0xb707('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4d83adf..75ee393 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 _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x427d31,_0x2fa0b1){var _0x186b08=function(_0x50738d){while(--_0x50738d){_0x427d31['push'](_0x427d31['shift']());}};_0x186b08(++_0x2fa0b1);}(_0x6334,0x119));var _0x4633=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x6334[_0x334599];return _0x4cdff2;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0x222f=['./chatQueue.events','save','remove','update','emit','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x222f,0x1a4));var _0xf222=function(_0x1e24f8,_0x52070f){_0x1e24f8=_0x1e24f8-0x0;var _0x5c4446=_0x222f[_0x1e24f8];return _0x5c4446;};'use strict';var ChatQueueEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatQueueEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatQueue:'+_0xf5a105,_0x54a758);ChatQueueEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b548d23..814e427 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x30a6b3,_0xd7d096){_0x30a6b3=_0x30a6b3-0x0;var _0x3a69b1=_0x3e74[_0x30a6b3];return _0x3a69b1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xd97434,_0x13fa7c){var _0x89c895=function(_0x7f5b1e){while(--_0x7f5b1e){_0xd97434['push'](_0xd97434['shift']());}};_0x89c895(++_0x13fa7c);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3a1bc1e..1c9146d 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 _0x3937=['exports','STRING','DATE','moment'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x3937,0xbf));var _0x7393=function(_0xa8f070,_0x7cf879){_0xa8f070=_0xa8f070-0x0;var _0x268739=_0x3937[_0xa8f070];return _0x268739;};'use strict';var moment=require(_0x7393('0x0'));var Sequelize=require('sequelize');module[_0x7393('0x1')]={'uniqueid':{'type':Sequelize[_0x7393('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7393('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7393('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7393('0x2')]}}; \ No newline at end of file +var _0xd429=['exports','STRING','DATE','moment','sequelize'];(function(_0xa48cd5,_0x4c11ee){var _0x49272e=function(_0x30e9a8){while(--_0x30e9a8){_0xa48cd5['push'](_0xa48cd5['shift']());}};_0x49272e(++_0x4c11ee);}(_0xd429,0xfd));var _0x9d42=function(_0x1188cd,_0xce4557){_0x1188cd=_0x1188cd-0x0;var _0x557b8e=_0xd429[_0x1188cd];return _0x557b8e;};'use strict';var moment=require(_0x9d42('0x0'));var Sequelize=require(_0x9d42('0x1'));module[_0x9d42('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9d42('0x3')]},'joinAt':{'type':Sequelize[_0x9d42('0x4')]},'leaveAt':{'type':Sequelize[_0x9d42('0x4')]},'acceptAt':{'type':Sequelize[_0x9d42('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9d42('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index eaf01fa..432e264 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 _0x8c8b=['fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','ChatQueueReport','rawAttributes'];(function(_0x3b2834,_0x248fa0){var _0x23c25b=function(_0x832ada){while(--_0x832ada){_0x3b2834['push'](_0x3b2834['shift']());}};_0x23c25b(++_0x248fa0);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xb8c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8c8('0x1'));var rp=require(_0xb8c8('0x2'));var moment=require(_0xb8c8('0x3'));var BPromise=require(_0xb8c8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb8c8('0x5'));var sox=require(_0xb8c8('0x6'));var csv=require(_0xb8c8('0x7'));var ejs=require(_0xb8c8('0x8'));var fs=require('fs');var fs_extra=require(_0xb8c8('0x9'));var _=require(_0xb8c8('0xa'));var squel=require(_0xb8c8('0xb'));var crypto=require(_0xb8c8('0xc'));var jsforce=require(_0xb8c8('0xd'));var deskjs=require(_0xb8c8('0xe'));var toCsv=require(_0xb8c8('0x7'));var querystring=require('querystring');var Papa=require(_0xb8c8('0xf'));var Redis=require(_0xb8c8('0x10'));var authService=require(_0xb8c8('0x11'));var qs=require(_0xb8c8('0x12'));var as=require(_0xb8c8('0x13'));var hardwareService=require(_0xb8c8('0x14'));var logger=require(_0xb8c8('0x15'))(_0xb8c8('0x16'));var utils=require(_0xb8c8('0x17'));var config=require(_0xb8c8('0x18'));var licenseUtil=require(_0xb8c8('0x19'));var db=require(_0xb8c8('0x1a'))['db'];function respondWithStatusCode(_0x509477,_0x26af89){_0x26af89=_0x26af89||0xcc;return function(_0x506fb4){if(_0x506fb4){return _0x509477[_0xb8c8('0x1b')](_0x26af89);}return _0x509477[_0xb8c8('0x1c')](_0x26af89)['end']();};}function respondWithResult(_0x3df583,_0x2efe06){_0x2efe06=_0x2efe06||0xc8;return function(_0x306a92){if(_0x306a92){return _0x3df583['status'](_0x2efe06)[_0xb8c8('0x1d')](_0x306a92);}};}function respondWithFilteredResult(_0x3f7396,_0x1c12c2){return function(_0x1feec2){if(_0x1feec2){var _0x50429e=typeof _0x1c12c2[_0xb8c8('0x1e')]===_0xb8c8('0x1f')&&typeof _0x1c12c2[_0xb8c8('0x20')]===_0xb8c8('0x1f');var _0x4d6129=_0x1feec2[_0xb8c8('0x21')];var _0x25c387=_0x50429e?0x0:_0x1c12c2[_0xb8c8('0x1e')];var _0x3510ee=_0x50429e?_0x1feec2[_0xb8c8('0x21')]:_0x1c12c2[_0xb8c8('0x1e')]+_0x1c12c2[_0xb8c8('0x20')];var _0x1d6bba;if(_0x3510ee>=_0x4d6129){_0x3510ee=_0x4d6129;_0x1d6bba=0xc8;}else{_0x1d6bba=0xce;}_0x3f7396[_0xb8c8('0x1c')](_0x1d6bba);return _0x3f7396[_0xb8c8('0x22')](_0xb8c8('0x23'),_0x25c387+'-'+_0x3510ee+'/'+_0x4d6129)[_0xb8c8('0x1d')](_0x1feec2);}return null;};}function patchUpdates(_0x2e42c1){return function(_0x103b7f){try{jsonpatch[_0xb8c8('0x24')](_0x103b7f,_0x2e42c1,!![]);}catch(_0x4ebb45){return BPromise[_0xb8c8('0x25')](_0x4ebb45);}return _0x103b7f[_0xb8c8('0x26')]();};}function saveUpdates(_0x44eaea,_0x37ec4a){return function(_0x10adaa){if(_0x10adaa){return _0x10adaa['update'](_0x44eaea)[_0xb8c8('0x27')](function(_0x49ad09){return _0x49ad09;});}return null;};}function removeEntity(_0x58d7c0,_0x2b3629){return function(_0x38c13a){if(_0x38c13a){return _0x38c13a[_0xb8c8('0x28')]()[_0xb8c8('0x27')](function(){_0x58d7c0[_0xb8c8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1682ba,_0x200f06){return function(_0x2bf36f){if(!_0x2bf36f){_0x1682ba[_0xb8c8('0x1b')](0x194);}return _0x2bf36f;};}function handleError(_0x4d8418,_0x3c4b44){_0x3c4b44=_0x3c4b44||0x1f4;return function(_0x1b3007){logger['error'](_0x1b3007[_0xb8c8('0x29')]);if(_0x1b3007[_0xb8c8('0x2a')]){delete _0x1b3007[_0xb8c8('0x2a')];}_0x4d8418['status'](_0x3c4b44)['send'](_0x1b3007);};}exports[_0xb8c8('0x2b')]=function(_0x8af579,_0x481171){var _0x90eca8={},_0x3599f5={},_0x5899a7={'count':0x0,'rows':[]};var _0x3211c3=_['map'](db[_0xb8c8('0x2c')][_0xb8c8('0x2d')],function(_0x169c9f){return{'name':_0x169c9f[_0xb8c8('0x2e')],'type':_0x169c9f[_0xb8c8('0x2f')][_0xb8c8('0x30')]};});_0x3599f5[_0xb8c8('0x31')]=_[_0xb8c8('0x32')](_0x3211c3,_0xb8c8('0x2a'));_0x3599f5['query']=_[_0xb8c8('0x33')](_0x8af579['query']);_0x3599f5[_0xb8c8('0x34')]=_[_0xb8c8('0x35')](_0x3599f5[_0xb8c8('0x31')],_0x3599f5['query']);_0x90eca8[_0xb8c8('0x36')]=_[_0xb8c8('0x35')](_0x3599f5[_0xb8c8('0x31')],qs[_0xb8c8('0x37')](_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x37')]));_0x90eca8[_0xb8c8('0x36')]=_0x90eca8[_0xb8c8('0x36')][_0xb8c8('0x39')]?_0x90eca8[_0xb8c8('0x36')]:_0x3599f5['model'];if(!_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x3a')](_0xb8c8('0x3b'))){_0x90eca8[_0xb8c8('0x20')]=qs[_0xb8c8('0x20')](_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x20')]);_0x90eca8[_0xb8c8('0x1e')]=qs['offset'](_0x8af579[_0xb8c8('0x38')]['offset']);}_0x90eca8[_0xb8c8('0x3c')]=qs[_0xb8c8('0x3d')](_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x3d')]);_0x90eca8[_0xb8c8('0x3e')]=qs[_0xb8c8('0x34')](_['pick'](_0x8af579[_0xb8c8('0x38')],_0x3599f5[_0xb8c8('0x34')]),_0x3211c3);if(_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x3f')]){_0x90eca8[_0xb8c8('0x3e')]=_['merge'](_0x90eca8['where'],{'$or':_[_0xb8c8('0x32')](_0x3211c3,function(_0xcf573c){if(_0xcf573c[_0xb8c8('0x2f')]!==_0xb8c8('0x40')){var _0x243cd6={};_0x243cd6[_0xcf573c[_0xb8c8('0x2a')]]={'$like':'%'+_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x3f')]+'%'};return _0x243cd6;}})});}_0x90eca8=_[_0xb8c8('0x41')]({},_0x90eca8,_0x8af579['options']);var _0x25b542={'where':_0x90eca8['where']};return db[_0xb8c8('0x2c')][_0xb8c8('0x21')](_0x25b542)[_0xb8c8('0x27')](function(_0x466222){_0x5899a7[_0xb8c8('0x21')]=_0x466222;if(_0x8af579[_0xb8c8('0x38')][_0xb8c8('0x42')]){_0x90eca8[_0xb8c8('0x43')]=[{'all':!![]}];}return db[_0xb8c8('0x2c')]['findAll'](_0x90eca8);})[_0xb8c8('0x27')](function(_0x1d5d94){_0x5899a7[_0xb8c8('0x44')]=_0x1d5d94;return _0x5899a7;})[_0xb8c8('0x27')](respondWithFilteredResult(_0x481171,_0x90eca8))[_0xb8c8('0x45')](handleError(_0x481171,null));};exports[_0xb8c8('0x46')]=function(_0x166c1d,_0x23b5cc){var _0x3405b0={'raw':!![],'where':{'id':_0x166c1d[_0xb8c8('0x47')]['id']}},_0x64ecee={};_0x64ecee[_0xb8c8('0x31')]=_[_0xb8c8('0x33')](db[_0xb8c8('0x2c')][_0xb8c8('0x2d')]);_0x64ecee[_0xb8c8('0x38')]=_[_0xb8c8('0x33')](_0x166c1d['query']);_0x64ecee['filters']=_[_0xb8c8('0x35')](_0x64ecee[_0xb8c8('0x31')],_0x64ecee[_0xb8c8('0x38')]);_0x3405b0[_0xb8c8('0x36')]=_[_0xb8c8('0x35')](_0x64ecee[_0xb8c8('0x31')],qs[_0xb8c8('0x37')](_0x166c1d['query'][_0xb8c8('0x37')]));_0x3405b0['attributes']=_0x3405b0['attributes'][_0xb8c8('0x39')]?_0x3405b0[_0xb8c8('0x36')]:_0x64ecee[_0xb8c8('0x31')];if(_0x166c1d[_0xb8c8('0x38')]['includeAll']){_0x3405b0[_0xb8c8('0x43')]=[{'all':!![]}];}_0x3405b0=_[_0xb8c8('0x41')]({},_0x3405b0,_0x166c1d['options']);return db[_0xb8c8('0x2c')]['find'](_0x3405b0)['then'](handleEntityNotFound(_0x23b5cc,null))['then'](respondWithResult(_0x23b5cc,null))[_0xb8c8('0x45')](handleError(_0x23b5cc,null));};exports[_0xb8c8('0x48')]=function(_0x47f219,_0x15e51c){return db['ChatQueueReport'][_0xb8c8('0x48')](_0x47f219[_0xb8c8('0x49')],{})[_0xb8c8('0x27')](respondWithResult(_0x15e51c,0xc9))['catch'](handleError(_0x15e51c,null));};exports[_0xb8c8('0x4a')]=function(_0x23bb5f,_0x55c55d){if(_0x23bb5f[_0xb8c8('0x49')]['id']){delete _0x23bb5f[_0xb8c8('0x49')]['id'];}return db[_0xb8c8('0x2c')][_0xb8c8('0x4b')]({'where':{'id':_0x23bb5f[_0xb8c8('0x47')]['id']}})[_0xb8c8('0x27')](handleEntityNotFound(_0x55c55d,null))['then'](saveUpdates(_0x23bb5f[_0xb8c8('0x49')],null))['then'](respondWithResult(_0x55c55d,null))[_0xb8c8('0x45')](handleError(_0x55c55d,null));};exports['destroy']=function(_0x206ddf,_0x277c84){return db[_0xb8c8('0x2c')]['find']({'where':{'id':_0x206ddf['params']['id']}})[_0xb8c8('0x27')](handleEntityNotFound(_0x277c84,null))['then'](removeEntity(_0x277c84,null))[_0xb8c8('0x45')](handleError(_0x277c84,null));};exports['describe']=function(_0x324978,_0x3ad5f4){return db['ChatQueueReport'][_0xb8c8('0x4c')]()[_0xb8c8('0x27')](respondWithResult(_0x3ad5f4,null))[_0xb8c8('0x45')](handleError(_0x3ad5f4,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','ChatQueueReport','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1d5deb,_0x47f7f8){var _0x2bf0d6=function(_0x3eea16){while(--_0x3eea16){_0x1d5deb['push'](_0x1d5deb['shift']());}};_0x2bf0d6(++_0x47f7f8);}(_0xd117,0x182));var _0x7d11=function(_0x3bbd2d,_0xf8ba3c){_0x3bbd2d=_0x3bbd2d-0x0;var _0x241bd4=_0xd117[_0x3bbd2d];return _0x241bd4;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['ChatQueueReport'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 98ce049..58edd3c 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xb10b,0x12a));var _0xbb10=function(_0x2eb828,_0x5b4396){_0x2eb828=_0x2eb828-0x0;var _0xdb47b7=_0xb10b[_0x2eb828];return _0xdb47b7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x38165a,_0x402492){var _0x3ae715=function(_0x952a93){while(--_0x952a93){_0x38165a['push'](_0x38165a['shift']());}};_0x3ae715(++_0x402492);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'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 4554149..93ee5d4 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 _0x0472=['body','raw','where','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','options','debug','stringify','UpdateChatQueueReport','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0472,0x197));var _0x2047=function(_0x478e67,_0x5bae9d){_0x478e67=_0x478e67-0x0;var _0x6add67=_0x0472[_0x478e67];return _0x6add67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2047('0x0'));var BPromise=require('bluebird');var rs=require(_0x2047('0x1'));var fs=require('fs');var Redis=require(_0x2047('0x2'));var db=require(_0x2047('0x3'))['db'];var utils=require(_0x2047('0x4'));var logger=require('../../config/logger')(_0x2047('0x5'));var config=require('../../config/environment');var jayson=require(_0x2047('0x6'));var client=jayson[_0x2047('0x7')][_0x2047('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14bf92,_0x487d16,_0x8561de){return new BPromise(function(_0x29f752,_0x236708){return client[_0x2047('0x9')](_0x14bf92,_0x8561de)[_0x2047('0xa')](function(_0xfaf294){logger[_0x2047('0xb')](_0x2047('0xc'),_0x487d16,_0x2047('0xd'));logger['debug'](_0x2047('0xe'),_0x487d16,_0x2047('0xd'),JSON['stringify'](_0xfaf294));if(_0xfaf294[_0x2047('0xf')]){if(_0xfaf294[_0x2047('0xf')][_0x2047('0x10')]===0x1f4){logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);return _0x236708(_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);}logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0xfaf294[_0x2047('0xf')]['message']);return _0x29f752(_0xfaf294[_0x2047('0xf')][_0x2047('0x11')]);}else{logger[_0x2047('0xb')](_0x2047('0xc'),_0x487d16,_0x2047('0xd'));_0x29f752(_0xfaf294['result'][_0x2047('0x11')]);}})[_0x2047('0x12')](function(_0x354cb1){logger[_0x2047('0xf')](_0x2047('0xc'),_0x487d16,_0x354cb1);_0x236708(_0x354cb1);});});}exports[_0x2047('0x13')]=function(_0x30c8e8){var _0x5f3be9=this;return new Promise(function(_0x4b0090,_0x11a3b2){return db[_0x2047('0x14')][_0x2047('0x15')](_0x30c8e8['body'],{'raw':_0x30c8e8[_0x2047('0x16')]?_0x30c8e8[_0x2047('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x42dcb0){logger[_0x2047('0xb')]('CreateChatQueueReport',_0x30c8e8);logger[_0x2047('0x17')](_0x2047('0x13'),_0x30c8e8,JSON[_0x2047('0x18')](_0x42dcb0));_0x4b0090(_0x42dcb0);})['catch'](function(_0x522491){logger[_0x2047('0xf')]('CreateChatQueueReport',_0x522491['message'],_0x30c8e8);_0x11a3b2(_0x5f3be9[_0x2047('0xf')](0x1f4,_0x522491[_0x2047('0x11')]));});});};exports[_0x2047('0x19')]=function(_0x170a73){var _0x580057=this;return new Promise(function(_0x55f9ec,_0xa3b9a9){return db[_0x2047('0x14')][_0x2047('0x1a')](_0x170a73[_0x2047('0x1b')],{'raw':_0x170a73[_0x2047('0x16')]?_0x170a73[_0x2047('0x16')][_0x2047('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170a73['options']?_0x170a73[_0x2047('0x16')][_0x2047('0x1d')]||null:null,'attributes':_0x170a73[_0x2047('0x16')]?_0x170a73['options']['attributes']||null:null,'limit':_0x170a73['options']?_0x170a73[_0x2047('0x16')][_0x2047('0x1e')]||null:null})[_0x2047('0xa')](function(_0x2d369c){logger['info'](_0x2047('0x19'),_0x170a73);logger[_0x2047('0x17')](_0x2047('0x19'),_0x170a73,JSON[_0x2047('0x18')](_0x2d369c));_0x55f9ec(_0x2d369c);})[_0x2047('0x12')](function(_0x2c732d){logger[_0x2047('0xf')](_0x2047('0x19'),_0x2c732d[_0x2047('0x11')],_0x170a73);_0xa3b9a9(_0x580057['error'](0x1f4,_0x2c732d[_0x2047('0x11')]));});});}; \ No newline at end of file +var _0xf0ef=['debug','UpdateChatQueueReport','update','body','raw','where','limit','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','options'];(function(_0x4b02dc,_0x5c9ac5){var _0x47df2f=function(_0x1cd3f3){while(--_0x1cd3f3){_0x4b02dc['push'](_0x4b02dc['shift']());}};_0x47df2f(++_0x5c9ac5);}(_0xf0ef,0x173));var _0xff0e=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0xf0ef[_0x4d0df6];return _0x4e2615;};'use strict';var _=require(_0xff0e('0x0'));var util=require(_0xff0e('0x1'));var moment=require(_0xff0e('0x2'));var BPromise=require('bluebird');var rs=require(_0xff0e('0x3'));var fs=require('fs');var Redis=require(_0xff0e('0x4'));var db=require(_0xff0e('0x5'))['db'];var utils=require(_0xff0e('0x6'));var logger=require(_0xff0e('0x7'))('rpc');var config=require(_0xff0e('0x8'));var jayson=require(_0xff0e('0x9'));var client=jayson[_0xff0e('0xa')][_0xff0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x227010,_0x15dffc,_0x1f6a2d){return new BPromise(function(_0x2e91b0,_0x4a28a4){return client['request'](_0x227010,_0x1f6a2d)['then'](function(_0x4a28fd){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x15dffc,_0xff0e('0xc'));logger['debug'](_0xff0e('0xd'),_0x15dffc,_0xff0e('0xc'),JSON[_0xff0e('0xe')](_0x4a28fd));if(_0x4a28fd['error']){if(_0x4a28fd[_0xff0e('0xf')]['code']===0x1f4){logger[_0xff0e('0xf')](_0xff0e('0x10'),_0x15dffc,_0x4a28fd[_0xff0e('0xf')][_0xff0e('0x11')]);return _0x4a28a4(_0x4a28fd[_0xff0e('0xf')][_0xff0e('0x11')]);}logger[_0xff0e('0xf')](_0xff0e('0x10'),_0x15dffc,_0x4a28fd[_0xff0e('0xf')][_0xff0e('0x11')]);return _0x2e91b0(_0x4a28fd['error'][_0xff0e('0x11')]);}else{logger[_0xff0e('0x12')](_0xff0e('0x10'),_0x15dffc,'request\x20sent');_0x2e91b0(_0x4a28fd[_0xff0e('0x13')][_0xff0e('0x11')]);}})[_0xff0e('0x14')](function(_0x5be688){logger[_0xff0e('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x15dffc,_0x5be688);_0x4a28a4(_0x5be688);});});}exports[_0xff0e('0x15')]=function(_0x2f4d76){var _0x3417cd=this;return new Promise(function(_0x7a71ca,_0x4f05c1){return db[_0xff0e('0x16')][_0xff0e('0x17')](_0x2f4d76['body'],{'raw':_0x2f4d76[_0xff0e('0x18')]?_0x2f4d76[_0xff0e('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x48e6ae){logger['info'](_0xff0e('0x15'),_0x2f4d76);logger[_0xff0e('0x19')](_0xff0e('0x15'),_0x2f4d76,JSON[_0xff0e('0xe')](_0x48e6ae));_0x7a71ca(_0x48e6ae);})[_0xff0e('0x14')](function(_0x2e21ae){logger[_0xff0e('0xf')]('CreateChatQueueReport',_0x2e21ae[_0xff0e('0x11')],_0x2f4d76);_0x4f05c1(_0x3417cd[_0xff0e('0xf')](0x1f4,_0x2e21ae[_0xff0e('0x11')]));});});};exports[_0xff0e('0x1a')]=function(_0x5f564f){var _0x4b6631=this;return new Promise(function(_0x38f403,_0x10332a){return db[_0xff0e('0x16')][_0xff0e('0x1b')](_0x5f564f[_0xff0e('0x1c')],{'raw':_0x5f564f[_0xff0e('0x18')]?_0x5f564f[_0xff0e('0x18')][_0xff0e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f564f[_0xff0e('0x18')]?_0x5f564f['options'][_0xff0e('0x1e')]||null:null,'attributes':_0x5f564f['options']?_0x5f564f[_0xff0e('0x18')]['attributes']||null:null,'limit':_0x5f564f[_0xff0e('0x18')]?_0x5f564f[_0xff0e('0x18')][_0xff0e('0x1f')]||null:null})[_0xff0e('0x20')](function(_0x1b2f36){logger['info']('UpdateChatQueueReport',_0x5f564f);logger['debug'](_0xff0e('0x1a'),_0x5f564f,JSON['stringify'](_0x1b2f36));_0x38f403(_0x1b2f36);})[_0xff0e('0x14')](function(_0x504967){logger[_0xff0e('0xf')](_0xff0e('0x1a'),_0x504967[_0xff0e('0x11')],_0x5f564f);_0x10332a(_0x4b6631[_0xff0e('0xf')](0x1f4,_0x504967[_0xff0e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c07499c..c4f9868 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 _0x880d=['get','/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','isAuthenticated','index'];(function(_0x1698c3,_0x5d9d53){var _0x24f589=function(_0x2362f9){while(--_0x2362f9){_0x1698c3['push'](_0x1698c3['shift']());}};_0x24f589(++_0x5d9d53);}(_0x880d,0x1b9));var _0xd880=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x880d[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xd880('0x0'));var util=require('util');var path=require(_0xd880('0x1'));var timeout=require('connect-timeout');var express=require(_0xd880('0x2'));var router=express[_0xd880('0x3')]();var fs_extra=require(_0xd880('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd880('0x5'));var controller=require(_0xd880('0x6'));router['get']('/',auth[_0xd880('0x7')](),controller[_0xd880('0x8')]);router[_0xd880('0x9')]('/describe',auth[_0xd880('0x7')](),controller['describe']);router[_0xd880('0x9')](_0xd880('0xa'),auth['isAuthenticated'](),controller[_0xd880('0xb')]);router[_0xd880('0xc')]('/',auth['isAuthenticated'](),controller[_0xd880('0xd')]);router[_0xd880('0xe')](_0xd880('0xa'),auth[_0xd880('0x7')](),controller[_0xd880('0xf')]);router[_0xd880('0x10')](_0xd880('0xa'),auth[_0xd880('0x7')](),controller['destroy']);module[_0xd880('0x11')]=router; \ No newline at end of file +var _0x3b9b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','delete','destroy','exports','multer','util'];(function(_0x5148c8,_0x53d706){var _0xf84ef7=function(_0x26736e){while(--_0x26736e){_0x5148c8['push'](_0x5148c8['shift']());}};_0xf84ef7(++_0x53d706);}(_0x3b9b,0x167));var _0xb3b9=function(_0x872f82,_0x5482e2){_0x872f82=_0x872f82-0x0;var _0x13bf0a=_0x3b9b[_0x872f82];return _0x13bf0a;};'use strict';var multer=require(_0xb3b9('0x0'));var util=require(_0xb3b9('0x1'));var path=require('path');var timeout=require(_0xb3b9('0x2'));var express=require(_0xb3b9('0x3'));var router=express[_0xb3b9('0x4')]();var fs_extra=require(_0xb3b9('0x5'));var auth=require(_0xb3b9('0x6'));var interaction=require(_0xb3b9('0x7'));var config=require('../../config/environment');var controller=require(_0xb3b9('0x8'));router[_0xb3b9('0x9')]('/',auth[_0xb3b9('0xa')](),controller[_0xb3b9('0xb')]);router[_0xb3b9('0x9')](_0xb3b9('0xc'),auth[_0xb3b9('0xa')](),controller['describe']);router[_0xb3b9('0x9')](_0xb3b9('0xd'),auth[_0xb3b9('0xa')](),controller['show']);router[_0xb3b9('0xe')]('/',auth[_0xb3b9('0xa')](),controller['create']);router['put']('/:id',auth[_0xb3b9('0xa')](),controller[_0xb3b9('0xf')]);router[_0xb3b9('0x10')](_0xb3b9('0xd'),auth[_0xb3b9('0xa')](),controller[_0xb3b9('0x11')]);module[_0xb3b9('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 fc0aba4..ce3dd41 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xe25ee9,_0x1f6d98){var _0x56c669=function(_0x32e81a){while(--_0x32e81a){_0xe25ee9['push'](_0xe25ee9['shift']());}};_0x56c669(++_0x1f6d98);}(_0x54ef,0x112));var _0xf54e=function(_0x5c9c64,_0xed9cfa){_0x5c9c64=_0x5c9c64-0x0;var _0x1f0660=_0x54ef[_0x5c9c64];return _0x1f0660;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4d9f63,_0x115c88){var _0xa6dcfe=function(_0x5ac493){while(--_0x5ac493){_0x4d9f63['push'](_0x4d9f63['shift']());}};_0xa6dcfe(++_0x115c88);}(_0x34e8,0x12c));var _0x834e=function(_0xba82bd,_0x12b6d5){_0xba82bd=_0xba82bd-0x0;var _0x4ce51d=_0x34e8[_0xba82bd];return _0x4ce51d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index bf38350..a7d8948 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 _0x5dba=['where','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter'];(function(_0x4210e1,_0x4a38f9){var _0x52065d=function(_0x54541e){while(--_0x54541e){_0x4210e1['push'](_0x4210e1['shift']());}};_0x52065d(++_0x4a38f9);}(_0x5dba,0xa7));var _0xa5db=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0x5dba[_0xffd1b5];return _0x3176d6;};'use strict';var emlformat=require(_0xa5db('0x0'));var rimraf=require(_0xa5db('0x1'));var zipdir=require(_0xa5db('0x2'));var jsonpatch=require(_0xa5db('0x3'));var rp=require(_0xa5db('0x4'));var moment=require(_0xa5db('0x5'));var BPromise=require(_0xa5db('0x6'));var Mustache=require('mustache');var util=require(_0xa5db('0x7'));var path=require(_0xa5db('0x8'));var sox=require(_0xa5db('0x9'));var csv=require(_0xa5db('0xa'));var ejs=require(_0xa5db('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5db('0xc'));var squel=require(_0xa5db('0xd'));var crypto=require(_0xa5db('0xe'));var jsforce=require(_0xa5db('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa5db('0xa'));var querystring=require('querystring');var Papa=require(_0xa5db('0x10'));var Redis=require(_0xa5db('0x11'));var authService=require(_0xa5db('0x12'));var qs=require(_0xa5db('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5db('0x14'));var logger=require('../../config/logger')(_0xa5db('0x15'));var utils=require('../../config/utils');var config=require(_0xa5db('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c4885,_0xd9b499){_0xd9b499=_0xd9b499||0xcc;return function(_0x5ef8aa){if(_0x5ef8aa){return _0x5c4885[_0xa5db('0x17')](_0xd9b499);}return _0x5c4885[_0xa5db('0x18')](_0xd9b499)['end']();};}function respondWithResult(_0x3bce09,_0x355cbf){_0x355cbf=_0x355cbf||0xc8;return function(_0x2e10c6){if(_0x2e10c6){return _0x3bce09['status'](_0x355cbf)[_0xa5db('0x19')](_0x2e10c6);}};}function respondWithFilteredResult(_0x535432,_0x4cfa83){return function(_0xe0bf50){if(_0xe0bf50){var _0x49db8e=typeof _0x4cfa83['offset']===_0xa5db('0x1a')&&typeof _0x4cfa83['limit']==='undefined';var _0x523ed9=_0xe0bf50[_0xa5db('0x1b')];var _0xf86c63=_0x49db8e?0x0:_0x4cfa83[_0xa5db('0x1c')];var _0x12e4d2=_0x49db8e?_0xe0bf50[_0xa5db('0x1b')]:_0x4cfa83[_0xa5db('0x1c')]+_0x4cfa83[_0xa5db('0x1d')];var _0x59c363;if(_0x12e4d2>=_0x523ed9){_0x12e4d2=_0x523ed9;_0x59c363=0xc8;}else{_0x59c363=0xce;}_0x535432[_0xa5db('0x18')](_0x59c363);return _0x535432[_0xa5db('0x1e')](_0xa5db('0x1f'),_0xf86c63+'-'+_0x12e4d2+'/'+_0x523ed9)[_0xa5db('0x19')](_0xe0bf50);}return null;};}function patchUpdates(_0x745958){return function(_0x1abef3){try{jsonpatch[_0xa5db('0x20')](_0x1abef3,_0x745958,!![]);}catch(_0x8204){return BPromise[_0xa5db('0x21')](_0x8204);}return _0x1abef3[_0xa5db('0x22')]();};}function saveUpdates(_0x3f4e41,_0x742acb){return function(_0x4efdf6){if(_0x4efdf6){return _0x4efdf6[_0xa5db('0x23')](_0x3f4e41)[_0xa5db('0x24')](function(_0xc0b485){return _0xc0b485;});}return null;};}function removeEntity(_0x2ecb3b,_0x4ed68b){return function(_0x1d2522){if(_0x1d2522){return _0x1d2522[_0xa5db('0x25')]()[_0xa5db('0x24')](function(){_0x2ecb3b[_0xa5db('0x18')](0xcc)[_0xa5db('0x26')]();});}};}function handleEntityNotFound(_0x534e3b,_0x455baf){return function(_0x16a207){if(!_0x16a207){_0x534e3b['sendStatus'](0x194);}return _0x16a207;};}function handleError(_0x325253,_0x121934){_0x121934=_0x121934||0x1f4;return function(_0x25bbb2){logger['error'](_0x25bbb2[_0xa5db('0x27')]);if(_0x25bbb2[_0xa5db('0x28')]){delete _0x25bbb2[_0xa5db('0x28')];}_0x325253[_0xa5db('0x18')](_0x121934)[_0xa5db('0x29')](_0x25bbb2);};}exports[_0xa5db('0x2a')]=function(_0x7365ea,_0x1896a1){var _0x4b3e69={},_0x23a414={},_0x54746a={'count':0x0,'rows':[]};var _0x43f9b1=_[_0xa5db('0x2b')](db[_0xa5db('0x2c')][_0xa5db('0x2d')],function(_0x5d20bf){return{'name':_0x5d20bf[_0xa5db('0x2e')],'type':_0x5d20bf[_0xa5db('0x2f')][_0xa5db('0x30')]};});_0x23a414[_0xa5db('0x31')]=_[_0xa5db('0x2b')](_0x43f9b1,'name');_0x23a414['query']=_['keys'](_0x7365ea['query']);_0x23a414[_0xa5db('0x32')]=_[_0xa5db('0x33')](_0x23a414[_0xa5db('0x31')],_0x23a414[_0xa5db('0x34')]);_0x4b3e69[_0xa5db('0x35')]=_[_0xa5db('0x33')](_0x23a414[_0xa5db('0x31')],qs[_0xa5db('0x36')](_0x7365ea[_0xa5db('0x34')]['fields']));_0x4b3e69[_0xa5db('0x35')]=_0x4b3e69[_0xa5db('0x35')][_0xa5db('0x37')]?_0x4b3e69[_0xa5db('0x35')]:_0x23a414[_0xa5db('0x31')];if(!_0x7365ea[_0xa5db('0x34')][_0xa5db('0x38')](_0xa5db('0x39'))){_0x4b3e69[_0xa5db('0x1d')]=qs[_0xa5db('0x1d')](_0x7365ea[_0xa5db('0x34')]['limit']);_0x4b3e69[_0xa5db('0x1c')]=qs[_0xa5db('0x1c')](_0x7365ea['query'][_0xa5db('0x1c')]);}_0x4b3e69[_0xa5db('0x3a')]=qs['sort'](_0x7365ea['query']['sort']);_0x4b3e69['where']=qs[_0xa5db('0x32')](_[_0xa5db('0x3b')](_0x7365ea['query'],_0x23a414[_0xa5db('0x32')]),_0x43f9b1);if(_0x7365ea['query'][_0xa5db('0x3c')]){_0x4b3e69[_0xa5db('0x3d')]=_[_0xa5db('0x3e')](_0x4b3e69[_0xa5db('0x3d')],{'$or':_[_0xa5db('0x2b')](_0x43f9b1,function(_0x5bf8a4){if(_0x5bf8a4[_0xa5db('0x2f')]!=='VIRTUAL'){var _0x1ee0a1={};_0x1ee0a1[_0x5bf8a4[_0xa5db('0x28')]]={'$like':'%'+_0x7365ea[_0xa5db('0x34')][_0xa5db('0x3c')]+'%'};return _0x1ee0a1;}})});}_0x4b3e69=_['merge']({},_0x4b3e69,_0x7365ea[_0xa5db('0x3f')]);var _0xd91e4e={'where':_0x4b3e69['where']};return db['ChatTransferReport'][_0xa5db('0x1b')](_0xd91e4e)[_0xa5db('0x24')](function(_0x3dc999){_0x54746a[_0xa5db('0x1b')]=_0x3dc999;if(_0x7365ea[_0xa5db('0x34')][_0xa5db('0x40')]){_0x4b3e69[_0xa5db('0x41')]=[{'all':!![]}];}return db[_0xa5db('0x2c')][_0xa5db('0x42')](_0x4b3e69);})[_0xa5db('0x24')](function(_0x234f21){_0x54746a[_0xa5db('0x43')]=_0x234f21;return _0x54746a;})['then'](respondWithFilteredResult(_0x1896a1,_0x4b3e69))['catch'](handleError(_0x1896a1,null));};exports[_0xa5db('0x44')]=function(_0x35f2f9,_0x366d85){var _0x4d623d={'raw':!![],'where':{'id':_0x35f2f9[_0xa5db('0x45')]['id']}},_0x243e3e={};_0x243e3e[_0xa5db('0x31')]=_[_0xa5db('0x46')](db[_0xa5db('0x2c')][_0xa5db('0x2d')]);_0x243e3e['query']=_[_0xa5db('0x46')](_0x35f2f9[_0xa5db('0x34')]);_0x243e3e[_0xa5db('0x32')]=_['intersection'](_0x243e3e['model'],_0x243e3e[_0xa5db('0x34')]);_0x4d623d['attributes']=_[_0xa5db('0x33')](_0x243e3e[_0xa5db('0x31')],qs[_0xa5db('0x36')](_0x35f2f9[_0xa5db('0x34')][_0xa5db('0x36')]));_0x4d623d['attributes']=_0x4d623d[_0xa5db('0x35')][_0xa5db('0x37')]?_0x4d623d[_0xa5db('0x35')]:_0x243e3e['model'];if(_0x35f2f9[_0xa5db('0x34')][_0xa5db('0x40')]){_0x4d623d[_0xa5db('0x41')]=[{'all':!![]}];}_0x4d623d=_[_0xa5db('0x3e')]({},_0x4d623d,_0x35f2f9[_0xa5db('0x3f')]);return db[_0xa5db('0x2c')][_0xa5db('0x47')](_0x4d623d)[_0xa5db('0x24')](handleEntityNotFound(_0x366d85,null))['then'](respondWithResult(_0x366d85,null))['catch'](handleError(_0x366d85,null));};exports[_0xa5db('0x48')]=function(_0xf2b9a6,_0x246fe7){return db[_0xa5db('0x2c')][_0xa5db('0x48')](_0xf2b9a6[_0xa5db('0x49')],{})[_0xa5db('0x24')](respondWithResult(_0x246fe7,0xc9))[_0xa5db('0x4a')](handleError(_0x246fe7,null));};exports[_0xa5db('0x23')]=function(_0x34f6d8,_0x3b83c2){if(_0x34f6d8['body']['id']){delete _0x34f6d8['body']['id'];}return db[_0xa5db('0x2c')][_0xa5db('0x47')]({'where':{'id':_0x34f6d8[_0xa5db('0x45')]['id']}})[_0xa5db('0x24')](handleEntityNotFound(_0x3b83c2,null))[_0xa5db('0x24')](saveUpdates(_0x34f6d8['body'],null))[_0xa5db('0x24')](respondWithResult(_0x3b83c2,null))[_0xa5db('0x4a')](handleError(_0x3b83c2,null));};exports['destroy']=function(_0x59496f,_0xbe3074){return db[_0xa5db('0x2c')][_0xa5db('0x47')]({'where':{'id':_0x59496f[_0xa5db('0x45')]['id']}})[_0xa5db('0x24')](handleEntityNotFound(_0xbe3074,null))[_0xa5db('0x24')](removeEntity(_0xbe3074,null))[_0xa5db('0x4a')](handleError(_0xbe3074,null));};exports[_0xa5db('0x4b')]=function(_0x1fb0f9,_0x27fddf){return db[_0xa5db('0x2c')][_0xa5db('0x4b')]()[_0xa5db('0x24')](respondWithResult(_0x27fddf,null))[_0xa5db('0x4a')](handleError(_0x27fddf,null));}; \ No newline at end of file +var _0x2172=['reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x54763e,_0x4072b1){var _0x4365b1=function(_0x3e8fcb){while(--_0x3e8fcb){_0x54763e['push'](_0x54763e['shift']());}};_0x4365b1(++_0x4072b1);}(_0x2172,0x15b));var _0x2217=function(_0x424b61,_0x9a4d8e){_0x424b61=_0x424b61-0x0;var _0x304759=_0x2172[_0x424b61];return _0x304759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2217('0x0'));var zipdir=require(_0x2217('0x1'));var jsonpatch=require(_0x2217('0x2'));var rp=require(_0x2217('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2217('0x4'));var util=require(_0x2217('0x5'));var path=require(_0x2217('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2217('0x7'));var _=require(_0x2217('0x8'));var squel=require(_0x2217('0x9'));var crypto=require('crypto');var jsforce=require(_0x2217('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2217('0xb'));var querystring=require(_0x2217('0xc'));var Papa=require('papaparse');var Redis=require(_0x2217('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2217('0xe'));var as=require(_0x2217('0xf'));var hardwareService=require(_0x2217('0x10'));var logger=require(_0x2217('0x11'))(_0x2217('0x12'));var utils=require(_0x2217('0x13'));var config=require(_0x2217('0x14'));var licenseUtil=require(_0x2217('0x15'));var db=require(_0x2217('0x16'))['db'];function respondWithStatusCode(_0x3a04d5,_0xfab77e){_0xfab77e=_0xfab77e||0xcc;return function(_0x140882){if(_0x140882){return _0x3a04d5['sendStatus'](_0xfab77e);}return _0x3a04d5['status'](_0xfab77e)[_0x2217('0x17')]();};}function respondWithResult(_0x5d52a5,_0x5d4a43){_0x5d4a43=_0x5d4a43||0xc8;return function(_0x50be3f){if(_0x50be3f){return _0x5d52a5[_0x2217('0x18')](_0x5d4a43)['json'](_0x50be3f);}};}function respondWithFilteredResult(_0x33a1ec,_0x47bb4e){return function(_0x39d24f){if(_0x39d24f){var _0x3706df=typeof _0x47bb4e['offset']===_0x2217('0x19')&&typeof _0x47bb4e[_0x2217('0x1a')]===_0x2217('0x19');var _0x1542f6=_0x39d24f[_0x2217('0x1b')];var _0x5aed61=_0x3706df?0x0:_0x47bb4e[_0x2217('0x1c')];var _0x53b968=_0x3706df?_0x39d24f['count']:_0x47bb4e['offset']+_0x47bb4e[_0x2217('0x1a')];var _0x3ce831;if(_0x53b968>=_0x1542f6){_0x53b968=_0x1542f6;_0x3ce831=0xc8;}else{_0x3ce831=0xce;}_0x33a1ec['status'](_0x3ce831);return _0x33a1ec[_0x2217('0x1d')](_0x2217('0x1e'),_0x5aed61+'-'+_0x53b968+'/'+_0x1542f6)[_0x2217('0x1f')](_0x39d24f);}return null;};}function patchUpdates(_0x38fa68){return function(_0x400fca){try{jsonpatch[_0x2217('0x20')](_0x400fca,_0x38fa68,!![]);}catch(_0x4211c5){return BPromise[_0x2217('0x21')](_0x4211c5);}return _0x400fca[_0x2217('0x22')]();};}function saveUpdates(_0x3ed90d,_0x38dfd1){return function(_0x44ce6c){if(_0x44ce6c){return _0x44ce6c['update'](_0x3ed90d)[_0x2217('0x23')](function(_0x5e597a){return _0x5e597a;});}return null;};}function removeEntity(_0x45f7f1,_0x440c50){return function(_0x53e334){if(_0x53e334){return _0x53e334[_0x2217('0x24')]()[_0x2217('0x23')](function(){_0x45f7f1[_0x2217('0x18')](0xcc)[_0x2217('0x17')]();});}};}function handleEntityNotFound(_0x5ce69b,_0x137c74){return function(_0x1d4f20){if(!_0x1d4f20){_0x5ce69b[_0x2217('0x25')](0x194);}return _0x1d4f20;};}function handleError(_0x38c13b,_0x28f91b){_0x28f91b=_0x28f91b||0x1f4;return function(_0x1fc3d0){logger[_0x2217('0x26')](_0x1fc3d0[_0x2217('0x27')]);if(_0x1fc3d0[_0x2217('0x28')]){delete _0x1fc3d0['name'];}_0x38c13b['status'](_0x28f91b)[_0x2217('0x29')](_0x1fc3d0);};}exports[_0x2217('0x2a')]=function(_0x2c3330,_0xf3fd95){var _0x13ea7b={},_0x1d8ddf={},_0x9083d5={'count':0x0,'rows':[]};var _0x40ab3f=_[_0x2217('0x2b')](db[_0x2217('0x2c')][_0x2217('0x2d')],function(_0x2244d4){return{'name':_0x2244d4[_0x2217('0x2e')],'type':_0x2244d4['type'][_0x2217('0x2f')]};});_0x1d8ddf[_0x2217('0x30')]=_[_0x2217('0x2b')](_0x40ab3f,_0x2217('0x28'));_0x1d8ddf[_0x2217('0x31')]=_[_0x2217('0x32')](_0x2c3330[_0x2217('0x31')]);_0x1d8ddf[_0x2217('0x33')]=_[_0x2217('0x34')](_0x1d8ddf['model'],_0x1d8ddf[_0x2217('0x31')]);_0x13ea7b['attributes']=_['intersection'](_0x1d8ddf[_0x2217('0x30')],qs['fields'](_0x2c3330[_0x2217('0x31')][_0x2217('0x35')]));_0x13ea7b[_0x2217('0x36')]=_0x13ea7b['attributes']['length']?_0x13ea7b[_0x2217('0x36')]:_0x1d8ddf[_0x2217('0x30')];if(!_0x2c3330[_0x2217('0x31')][_0x2217('0x37')](_0x2217('0x38'))){_0x13ea7b[_0x2217('0x1a')]=qs['limit'](_0x2c3330[_0x2217('0x31')][_0x2217('0x1a')]);_0x13ea7b[_0x2217('0x1c')]=qs[_0x2217('0x1c')](_0x2c3330[_0x2217('0x31')][_0x2217('0x1c')]);}_0x13ea7b['order']=qs[_0x2217('0x39')](_0x2c3330['query']['sort']);_0x13ea7b[_0x2217('0x3a')]=qs[_0x2217('0x33')](_['pick'](_0x2c3330['query'],_0x1d8ddf[_0x2217('0x33')]),_0x40ab3f);if(_0x2c3330[_0x2217('0x31')][_0x2217('0x3b')]){_0x13ea7b['where']=_[_0x2217('0x3c')](_0x13ea7b[_0x2217('0x3a')],{'$or':_['map'](_0x40ab3f,function(_0x3a6c47){if(_0x3a6c47[_0x2217('0x3d')]!=='VIRTUAL'){var _0x48d837={};_0x48d837[_0x3a6c47['name']]={'$like':'%'+_0x2c3330['query']['filter']+'%'};return _0x48d837;}})});}_0x13ea7b=_[_0x2217('0x3c')]({},_0x13ea7b,_0x2c3330['options']);var _0xb6c01e={'where':_0x13ea7b[_0x2217('0x3a')]};return db['ChatTransferReport'][_0x2217('0x1b')](_0xb6c01e)['then'](function(_0x4f30fc){_0x9083d5[_0x2217('0x1b')]=_0x4f30fc;if(_0x2c3330['query'][_0x2217('0x3e')]){_0x13ea7b[_0x2217('0x3f')]=[{'all':!![]}];}return db[_0x2217('0x2c')][_0x2217('0x40')](_0x13ea7b);})[_0x2217('0x23')](function(_0x31fc72){_0x9083d5[_0x2217('0x41')]=_0x31fc72;return _0x9083d5;})['then'](respondWithFilteredResult(_0xf3fd95,_0x13ea7b))[_0x2217('0x42')](handleError(_0xf3fd95,null));};exports[_0x2217('0x43')]=function(_0x20f6e2,_0x376c61){var _0x16ec7c={'raw':!![],'where':{'id':_0x20f6e2['params']['id']}},_0x22f81f={};_0x22f81f[_0x2217('0x30')]=_[_0x2217('0x32')](db['ChatTransferReport']['rawAttributes']);_0x22f81f[_0x2217('0x31')]=_[_0x2217('0x32')](_0x20f6e2[_0x2217('0x31')]);_0x22f81f['filters']=_[_0x2217('0x34')](_0x22f81f[_0x2217('0x30')],_0x22f81f['query']);_0x16ec7c[_0x2217('0x36')]=_[_0x2217('0x34')](_0x22f81f['model'],qs[_0x2217('0x35')](_0x20f6e2[_0x2217('0x31')][_0x2217('0x35')]));_0x16ec7c[_0x2217('0x36')]=_0x16ec7c['attributes'][_0x2217('0x44')]?_0x16ec7c[_0x2217('0x36')]:_0x22f81f['model'];if(_0x20f6e2[_0x2217('0x31')][_0x2217('0x3e')]){_0x16ec7c['include']=[{'all':!![]}];}_0x16ec7c=_[_0x2217('0x3c')]({},_0x16ec7c,_0x20f6e2[_0x2217('0x45')]);return db[_0x2217('0x2c')][_0x2217('0x46')](_0x16ec7c)['then'](handleEntityNotFound(_0x376c61,null))[_0x2217('0x23')](respondWithResult(_0x376c61,null))[_0x2217('0x42')](handleError(_0x376c61,null));};exports[_0x2217('0x47')]=function(_0x415e62,_0x1e326d){return db[_0x2217('0x2c')][_0x2217('0x47')](_0x415e62[_0x2217('0x48')],{})[_0x2217('0x23')](respondWithResult(_0x1e326d,0xc9))['catch'](handleError(_0x1e326d,null));};exports[_0x2217('0x49')]=function(_0x4c1f39,_0x15ba5a){if(_0x4c1f39[_0x2217('0x48')]['id']){delete _0x4c1f39[_0x2217('0x48')]['id'];}return db[_0x2217('0x2c')][_0x2217('0x46')]({'where':{'id':_0x4c1f39[_0x2217('0x4a')]['id']}})[_0x2217('0x23')](handleEntityNotFound(_0x15ba5a,null))[_0x2217('0x23')](saveUpdates(_0x4c1f39[_0x2217('0x48')],null))['then'](respondWithResult(_0x15ba5a,null))['catch'](handleError(_0x15ba5a,null));};exports[_0x2217('0x24')]=function(_0x433a63,_0x9800bb){return db[_0x2217('0x2c')][_0x2217('0x46')]({'where':{'id':_0x433a63[_0x2217('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9800bb,null))[_0x2217('0x23')](removeEntity(_0x9800bb,null))[_0x2217('0x42')](handleError(_0x9800bb,null));};exports[_0x2217('0x4b')]=function(_0x197a31,_0x1ebb19){return db[_0x2217('0x2c')]['describe']()['then'](respondWithResult(_0x1ebb19,null))[_0x2217('0x42')](handleError(_0x1ebb19,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index fe48c49..d3f10c0 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 _0x0c4d=['moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','api'];(function(_0x5393a6,_0x3c972d){var _0x477463=function(_0x5d6f37){while(--_0x5d6f37){_0x5393a6['push'](_0x5393a6['shift']());}};_0x477463(++_0x3c972d);}(_0x0c4d,0x1eb));var _0xd0c4=function(_0x3f05e0,_0x5121ef){_0x3f05e0=_0x3f05e0-0x0;var _0x31c6b0=_0x0c4d[_0x3f05e0];return _0x31c6b0;};'use strict';var _=require(_0xd0c4('0x0'));var util=require(_0xd0c4('0x1'));var logger=require('../../config/logger')(_0xd0c4('0x2'));var moment=require(_0xd0c4('0x3'));var BPromise=require(_0xd0c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0c4('0x5'));var rimraf=require(_0xd0c4('0x6'));var config=require(_0xd0c4('0x7'));var attributes=require(_0xd0c4('0x8'));module[_0xd0c4('0x9')]=function(_0x4badaa,_0x13b498){return _0x4badaa[_0xd0c4('0xa')](_0xd0c4('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd0c4('0xc'),'fields':[_0xd0c4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfeb=['api','moment','request-promise','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x251628,_0x1a75e1){var _0x2ed8a0=function(_0x43247b){while(--_0x43247b){_0x251628['push'](_0x251628['shift']());}};_0x2ed8a0(++_0x1a75e1);}(_0xdfeb,0xbb));var _0xbdfe=function(_0x31a67e,_0x585f61){_0x31a67e=_0x31a67e-0x0;var _0x5a55ff=_0xdfeb[_0x31a67e];return _0x5a55ff;};'use strict';var _=require(_0xbdfe('0x0'));var util=require(_0xbdfe('0x1'));var logger=require(_0xbdfe('0x2'))(_0xbdfe('0x3'));var moment=require(_0xbdfe('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdfe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbdfe('0x6'));module[_0xbdfe('0x7')]=function(_0x2bd6ef,_0x4f82cb){return _0x2bd6ef['define']('ChatTransferReport',attributes,{'tableName':_0xbdfe('0x8'),'paranoid':![],'indexes':[{'name':_0xbdfe('0x9'),'fields':[_0xbdfe('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 927a361..ec06258 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 _0xb277=['client','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb277,0xe8));var _0x7b27=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xb277[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x7b27('0x0'));var util=require(_0x7b27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b27('0x2'));var fs=require('fs');var Redis=require(_0x7b27('0x3'));var db=require(_0x7b27('0x4'))['db'];var utils=require(_0x7b27('0x5'));var logger=require(_0x7b27('0x6'))(_0x7b27('0x7'));var config=require(_0x7b27('0x8'));var jayson=require(_0x7b27('0x9'));var client=jayson[_0x7b27('0xa')][_0x7b27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f132,_0x2de693,_0x198c31){return new BPromise(function(_0x4cc485,_0x237088){return client['request'](_0x35f132,_0x198c31)[_0x7b27('0xc')](function(_0x453205){logger[_0x7b27('0xd')](_0x7b27('0xe'),_0x2de693,'request\x20sent');logger[_0x7b27('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2de693,_0x7b27('0x10'),JSON[_0x7b27('0x11')](_0x453205));if(_0x453205[_0x7b27('0x12')]){if(_0x453205[_0x7b27('0x12')][_0x7b27('0x13')]===0x1f4){logger['error'](_0x7b27('0xe'),_0x2de693,_0x453205['error'][_0x7b27('0x14')]);return _0x237088(_0x453205[_0x7b27('0x12')][_0x7b27('0x14')]);}logger[_0x7b27('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2de693,_0x453205['error'][_0x7b27('0x14')]);return _0x4cc485(_0x453205['error'][_0x7b27('0x14')]);}else{logger[_0x7b27('0xd')](_0x7b27('0xe'),_0x2de693,_0x7b27('0x10'));_0x4cc485(_0x453205['result'][_0x7b27('0x14')]);}})[_0x7b27('0x15')](function(_0x50f4a4){logger[_0x7b27('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2de693,_0x50f4a4);_0x237088(_0x50f4a4);});});} \ No newline at end of file +var _0xee7d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4c9024,_0x32d1c4){var _0x378664=function(_0x56dfa9){while(--_0x56dfa9){_0x4c9024['push'](_0x4c9024['shift']());}};_0x378664(++_0x32d1c4);}(_0xee7d,0x71));var _0xdee7=function(_0x2c50a3,_0x3fca34){_0x2c50a3=_0x2c50a3-0x0;var _0xe3209f=_0xee7d[_0x2c50a3];return _0xe3209f;};'use strict';var _=require(_0xdee7('0x0'));var util=require(_0xdee7('0x1'));var moment=require(_0xdee7('0x2'));var BPromise=require(_0xdee7('0x3'));var rs=require(_0xdee7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdee7('0x5'))['db'];var utils=require(_0xdee7('0x6'));var logger=require(_0xdee7('0x7'))(_0xdee7('0x8'));var config=require(_0xdee7('0x9'));var jayson=require(_0xdee7('0xa'));var client=jayson[_0xdee7('0xb')][_0xdee7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57959e,_0x2c1f68,_0x1e02ae){return new BPromise(function(_0x57e597,_0x5daa55){return client[_0xdee7('0xd')](_0x57959e,_0x1e02ae)['then'](function(_0x547e0f){logger[_0xdee7('0xe')](_0xdee7('0xf'),_0x2c1f68,_0xdee7('0x10'));logger['debug'](_0xdee7('0x11'),_0x2c1f68,_0xdee7('0x10'),JSON[_0xdee7('0x12')](_0x547e0f));if(_0x547e0f[_0xdee7('0x13')]){if(_0x547e0f[_0xdee7('0x13')][_0xdee7('0x14')]===0x1f4){logger[_0xdee7('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2c1f68,_0x547e0f[_0xdee7('0x13')][_0xdee7('0x15')]);return _0x5daa55(_0x547e0f['error'][_0xdee7('0x15')]);}logger[_0xdee7('0x13')](_0xdee7('0xf'),_0x2c1f68,_0x547e0f['error'][_0xdee7('0x15')]);return _0x57e597(_0x547e0f['error'][_0xdee7('0x15')]);}else{logger[_0xdee7('0xe')](_0xdee7('0xf'),_0x2c1f68,_0xdee7('0x10'));_0x57e597(_0x547e0f[_0xdee7('0x16')][_0xdee7('0x15')]);}})[_0xdee7('0x17')](function(_0x1b260b){logger['error'](_0xdee7('0xf'),_0x2c1f68,_0x1b260b);_0x5daa55(_0x1b260b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 84f09bf..13590f4 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 _0xf56d=['/describe','describe','/:id','post','isAuthenticated','create','put','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index'];(function(_0x36fe04,_0x45ca45){var _0x20557d=function(_0x3a8837){while(--_0x3a8837){_0x36fe04['push'](_0x36fe04['shift']());}};_0x20557d(++_0x45ca45);}(_0xf56d,0x105));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdf56('0x0'));var util=require('util');var path=require(_0xdf56('0x1'));var timeout=require(_0xdf56('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdf56('0x3'));var auth=require(_0xdf56('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdf56('0x5'));var controller=require(_0xdf56('0x6'));router[_0xdf56('0x7')]('/',auth['isAuthenticated'](),controller[_0xdf56('0x8')]);router[_0xdf56('0x7')](_0xdf56('0x9'),auth['isAuthenticated'](),controller[_0xdf56('0xa')]);router['get'](_0xdf56('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdf56('0xc')]('/',auth[_0xdf56('0xd')](),controller[_0xdf56('0xe')]);router[_0xdf56('0xf')]('/:id',auth[_0xdf56('0xd')](),controller['update']);router['delete'](_0xdf56('0xb'),auth[_0xdf56('0xd')](),controller[_0xdf56('0x10')]);module[_0xdf56('0x11')]=router; \ No newline at end of file +var _0x1646=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','describe','/:id','show','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3d7d54,_0xa79219){var _0x3482de=function(_0x31dd69){while(--_0x31dd69){_0x3d7d54['push'](_0x3d7d54['shift']());}};_0x3482de(++_0xa79219);}(_0x1646,0x16c));var _0x6164=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x1646[_0x2eb3db];return _0x358f33;};'use strict';var multer=require(_0x6164('0x0'));var util=require(_0x6164('0x1'));var path=require(_0x6164('0x2'));var timeout=require(_0x6164('0x3'));var express=require(_0x6164('0x4'));var router=express[_0x6164('0x5')]();var fs_extra=require(_0x6164('0x6'));var auth=require(_0x6164('0x7'));var interaction=require(_0x6164('0x8'));var config=require(_0x6164('0x9'));var controller=require(_0x6164('0xa'));router[_0x6164('0xb')]('/',auth['isAuthenticated'](),controller[_0x6164('0xc')]);router[_0x6164('0xb')](_0x6164('0xd'),auth['isAuthenticated'](),controller[_0x6164('0xe')]);router[_0x6164('0xb')](_0x6164('0xf'),auth['isAuthenticated'](),controller[_0x6164('0x10')]);router['post']('/',auth[_0x6164('0x11')](),controller[_0x6164('0x12')]);router[_0x6164('0x13')](_0x6164('0xf'),auth[_0x6164('0x11')](),controller[_0x6164('0x14')]);router[_0x6164('0x15')](_0x6164('0xf'),auth[_0x6164('0x11')](),controller[_0x6164('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8f4a236..15792ff 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 _0xee5b=['rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','setDataValue','onlineForm','TEXT','textarea','Comments','getDataValue','offlineForm','parse','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x1efadd,_0x2bc68d){var _0x3a4597=function(_0x166f8a){while(--_0x166f8a){_0x1efadd['push'](_0x1efadd['shift']());}};_0x3a4597(++_0x2bc68d);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2e1d1b,_0x1b4583){_0x2e1d1b=_0x2e1d1b-0x0;var _0x2d4a37=_0xee5b[_0x2e1d1b];return _0x2d4a37;};'use strict';var Sequelize=require(_0xbee5('0x0'));var rs=require('randomstring');module[_0xbee5('0x1')]={'name':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbee5('0x3')},'description':{'type':Sequelize[_0xbee5('0x2')]},'mapKey':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x5')},'customerAlias':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbee5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbee5('0x9')](_0xbee5('0xa'),_0xbee5('0xb')),'defaultValue':_0xbee5('0xa')},'header_online':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xc')},'start_chat_button':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0xf')},'download_transcript':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x12')},'closingMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x13')},'closingMessageButton':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xe')},'skipMessageButton':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x14')},'conditionAgreement':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x15')},'ratingType':{'type':Sequelize[_0xbee5('0x9')](_0xbee5('0x16'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xbee5('0x17')]({'items':[{'type':_0xbee5('0x18'),'variable':null,'config':{'placeholder':_0xbee5('0x19'),'type':_0xbee5('0x1a'),'required':!![]},'props':{'title':_0xbee5('0x19'),'helpText':''}},{'type':_0xbee5('0x18'),'props':{'title':_0xbee5('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbee5('0x4'),'type':_0xbee5('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x1af3de){return this[_0xbee5('0x1b')](_0xbee5('0x1c'),JSON[_0xbee5('0x17')](_0x1af3de));}},'offlineForm':{'type':Sequelize[_0xbee5('0x1d')],'defaultValue':function(){return JSON[_0xbee5('0x17')]({'items':[{'type':_0xbee5('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbee5('0x4'),'type':_0xbee5('0x4')},'variable':null},{'type':_0xbee5('0x1e'),'config':{'placeholder':_0xbee5('0x1f')},'props':{'title':_0xbee5('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xbee5('0x20')](_0xbee5('0x21'))?JSON[_0xbee5('0x22')](this[_0xbee5('0x20')](_0xbee5('0x21'))):{};},'set':function(_0x26abe3){return this[_0xbee5('0x1b')](_0xbee5('0x21'),JSON[_0xbee5('0x17')](_0x26abe3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbee5('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbee5('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbee5('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x24')},'waitingMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x14')},'sendUnmanaged':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'showAgentAvatar':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbee5('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbee5('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xbee5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x28')},'verticalAlignment':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x29')},'messagesAlignment':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x2c')},'systemAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbee5('0x7')],'comment':_0xbee5('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbee5('0x2e'),'set':function(_0x2819e2){if(!_0x2819e2)this[_0xbee5('0x1b')](_0xbee5('0x2f'),null);this[_0xbee5('0x1b')](_0xbee5('0x30'),_0x2819e2);}},'vidaooEscalation':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbee5('0x2')]},'vidaooTopic':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xbee5('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xbee5('0x1d')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbee5('0x1d')]}}; \ No newline at end of file +var _0x750a=['System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','ENUM','thumb','TEXT','input','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa'];(function(_0x3dabd4,_0x158db0){var _0x5509ee=function(_0x5e25d6){while(--_0x5e25d6){_0x3dabd4['push'](_0x3dabd4['shift']());}};_0x5509ee(++_0x158db0);}(_0x750a,0x140));var _0xa750=function(_0x12cef2,_0x1ddf88){_0x12cef2=_0x12cef2-0x0;var _0x452c39=_0x750a[_0x12cef2];return _0x452c39;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa750('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'unique':_0xa750('0x2')},'description':{'type':Sequelize[_0xa750('0x1')]},'mapKey':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x3')},'mapKeyOffline':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x3')},'key':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x4')},'customerAlias':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa750('0x1')]},'animation':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xa750('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x9')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xa')},'offline_chat_button':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xc')},'download_transcript':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xa750('0x12')]('star',_0xa750('0x13')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa750('0x14')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa750('0x15'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xa750('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xa750('0x3'),'type':_0xa750('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa750('0x16')](_0xa750('0x17'))?JSON[_0xa750('0x18')](this[_0xa750('0x16')](_0xa750('0x17'))):{};},'set':function(_0x3d52b3){return this[_0xa750('0x19')](_0xa750('0x17'),JSON[_0xa750('0x1a')](_0x3d52b3));}},'offlineForm':{'type':Sequelize[_0xa750('0x14')],'defaultValue':function(){return JSON[_0xa750('0x1a')]({'items':[{'type':_0xa750('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa750('0x3'),'type':_0xa750('0x3')},'variable':null},{'type':_0xa750('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0xa750('0x1c'),'helpText':_0xa750('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0xa750('0x16')](_0xa750('0x1e'))?JSON['parse'](this[_0xa750('0x16')](_0xa750('0x1e'))):{};},'set':function(_0x449bb7){return this[_0xa750('0x19')](_0xa750('0x1e'),JSON['stringify'](_0x449bb7));}},'token':{'type':Sequelize[_0xa750('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa750('0x1')]},'forwardOffline':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa750('0x1')]},'waitingTitle':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x1f')},'waitingMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa750('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x21')},'skipUnmanaged':{'type':Sequelize[_0xa750('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa750('0x14')]},'showAgentAvatar':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa750('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa750('0x22');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x23')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x24')},'verticalAlignment':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0x25')},'messagesAlignment':{'type':Sequelize[_0xa750('0x1')],'defaultValue':_0xa750('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xa750('0x14')]},'showCustomerAvatar':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa750('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa750('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa750('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa750('0x28')},'systemAvatar':{'type':Sequelize[_0xa750('0x14')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa750('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![],'comment':_0xa750('0x2a'),'set':function(_0x1166ff){if(!_0x1166ff)this[_0xa750('0x19')]('mandatoryDispositionPauseId',null);this[_0xa750('0x19')](_0xa750('0x2b'),_0x1166ff);}},'vidaooEscalation':{'type':Sequelize[_0xa750('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa750('0x1')]},'vidaooTopic':{'type':Sequelize[_0xa750('0x1')],'allowNull':![],'defaultValue':_0xa750('0x2c')},'vidaooNote':{'type':Sequelize[_0xa750('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xa750('0x14')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa750('0x14')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 02a7182..496c059 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 _0x6e8b=['getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','get','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','Pause','length','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','findOne','Disposition','findAll','removeDispositions','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','unknown','device','vendor','format','%s\x20%s\x20%s','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','Start','startRouting','EventManager','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','subjectOffline','firstName','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','Owner','fullname','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','custom','increment','chatLicenseExceeded','all','some','URL','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','color','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','finally'];(function(_0x583b0b,_0x4a9b2e){var _0x8eec1b=function(_0x1ed7cb){while(--_0x1ed7cb){_0x583b0b['push'](_0x583b0b['shift']());}};_0x8eec1b(++_0x4a9b2e);}(_0x6e8b,0x142));var _0xb6e8=function(_0x489618,_0x233987){_0x489618=_0x489618-0x0;var _0x3d34b8=_0x6e8b[_0x489618];return _0x3d34b8;};'use strict';var BPromise=require(_0xb6e8('0x0'));var Mustache=require(_0xb6e8('0x1'));var util=require(_0xb6e8('0x2'));var path=require(_0xb6e8('0x3'));var ejs=require(_0xb6e8('0x4'));var fs=require('fs');var fs_extra=require(_0xb6e8('0x5'));var _=require(_0xb6e8('0x6'));var querystring=require(_0xb6e8('0x7'));var Redis=require(_0xb6e8('0x8'));var qs=require(_0xb6e8('0x9'));var logger=require(_0xb6e8('0xa'))('api');var config=require(_0xb6e8('0xb'));var url=require(_0xb6e8('0xc'));var db=require(_0xb6e8('0xd'))['db'];config['redis']=_[_0xb6e8('0xe')](config[_0xb6e8('0xf')],{'host':_0xb6e8('0x10'),'port':0x18eb});var socket=require(_0xb6e8('0x11'))(new Redis(config[_0xb6e8('0xf')]));require(_0xb6e8('0x12'))[_0xb6e8('0x13')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xb6e8('0x14'));var client=jayson[_0xb6e8('0x15')][_0xb6e8('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xb6e8('0x16')]({'port':0x232a});var client9003=jayson[_0xb6e8('0x15')][_0xb6e8('0x16')]({'port':0x232b});var client9001=jayson['client'][_0xb6e8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x22f82b,_0x4cde89,_0x36942a,_0x63c66d){return new BPromise(function(_0x35fed7,_0x325d78){var _0x3c4c4c=_0x63c66d||client;return _0x3c4c4c[_0xb6e8('0x17')](_0x22f82b,_0x36942a)[_0xb6e8('0x18')](function(_0x84cf16){logger[_0xb6e8('0x19')](_0xb6e8('0x1a'),_0x4cde89,_0xb6e8('0x1b'));logger[_0xb6e8('0x1c')](_0xb6e8('0x1d'),_0x4cde89,_0xb6e8('0x1b'),JSON[_0xb6e8('0x1e')](_0x84cf16));if(_0x84cf16[_0xb6e8('0x1f')]){if(_0x84cf16['error'][_0xb6e8('0x20')]===0x1f4){logger[_0xb6e8('0x1f')](_0xb6e8('0x1a'),_0x4cde89,_0x84cf16[_0xb6e8('0x1f')]['message']);return _0x325d78(_0x84cf16[_0xb6e8('0x1f')][_0xb6e8('0x21')]);}logger[_0xb6e8('0x1f')](_0xb6e8('0x1a'),_0x4cde89,_0x84cf16[_0xb6e8('0x1f')][_0xb6e8('0x21')]);return _0x35fed7(_0x84cf16[_0xb6e8('0x1f')][_0xb6e8('0x21')]);}else{logger['info'](_0xb6e8('0x1a'),_0x4cde89,'request\x20sent');_0x35fed7(_0x84cf16[_0xb6e8('0x22')][_0xb6e8('0x21')]);}})[_0xb6e8('0x23')](function(_0x3239ec){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4cde89,_0x3239ec);_0x325d78(_0x3239ec);});});}function respondWithStatusCode(_0x2db0d2,_0x25e700){_0x25e700=_0x25e700||0xcc;return function(_0x243394){if(_0x243394){return _0x2db0d2[_0xb6e8('0x24')](_0x25e700);}return _0x2db0d2[_0xb6e8('0x25')](_0x25e700)[_0xb6e8('0x26')]();};}function respondWithResult(_0x10d3d1,_0x41335a){_0x41335a=_0x41335a||0xc8;return function(_0x538972){if(_0x538972){return _0x10d3d1[_0xb6e8('0x25')](_0x41335a)[_0xb6e8('0x27')](_0x538972);}};}function respondWithFilteredResult(_0x7a5b36,_0x78f921){return function(_0x5abc65){if(_0x5abc65){var _0x56dabe=typeof _0x78f921['offset']===_0xb6e8('0x28')&&typeof _0x78f921[_0xb6e8('0x29')]===_0xb6e8('0x28');var _0x5a92b7=_0x5abc65[_0xb6e8('0x2a')];var _0x320611=_0x56dabe?0x0:_0x78f921['offset'];var _0x15ec09=_0x56dabe?_0x5abc65[_0xb6e8('0x2a')]:_0x78f921[_0xb6e8('0x2b')]+_0x78f921[_0xb6e8('0x29')];var _0x1b4b48;if(_0x15ec09>=_0x5a92b7){_0x15ec09=_0x5a92b7;_0x1b4b48=0xc8;}else{_0x1b4b48=0xce;}_0x7a5b36[_0xb6e8('0x25')](_0x1b4b48);return _0x7a5b36[_0xb6e8('0x2c')](_0xb6e8('0x2d'),_0x320611+'-'+_0x15ec09+'/'+_0x5a92b7)[_0xb6e8('0x27')](_0x5abc65);}return null;};}function saveUpdates(_0x1c3bfe){return function(_0x5c1233){if(_0x5c1233){return _0x5c1233[_0xb6e8('0x2e')](_0x1c3bfe)['then'](function(_0x5c3042){return _0x5c3042;});}return null;};}function removeEntity(_0x1fa8db){return function(_0x88fd11){if(_0x88fd11){return _0x88fd11['destroy']()[_0xb6e8('0x18')](function(){var _0x3db450=_0x88fd11[_0xb6e8('0x2f')]({'plain':!![]});var _0x43a64e=_0xb6e8('0x30');return db[_0xb6e8('0x31')]['destroy']({'where':{'type':_0x43a64e,'resourceId':_0x3db450['id']}})[_0xb6e8('0x18')](function(){return _0x88fd11;});})['then'](function(){_0x1fa8db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4febea){return function(_0x2a61c4){if(!_0x2a61c4){_0x4febea[_0xb6e8('0x24')](0x194);}return _0x2a61c4;};}function handleError(_0x1703c9,_0x35e36e){_0x35e36e=_0x35e36e||0x1f4;return function(_0x42f421){logger[_0xb6e8('0x1f')](_0x42f421[_0xb6e8('0x32')]);if(_0x42f421[_0xb6e8('0x33')]){delete _0x42f421['name'];}_0x1703c9['status'](_0x35e36e)[_0xb6e8('0x34')](_0x42f421);};}exports[_0xb6e8('0x35')]=function(_0x29928e,_0x4c3dc3){var _0x3377c5={'include':[{'model':db['Pause'],'as':_0xb6e8('0x36')}]},_0x1a6288={},_0x4cd715={'count':0x0,'rows':[]};var _0x1013f7=_[_0xb6e8('0x37')](db[_0xb6e8('0x38')][_0xb6e8('0x39')],function(_0xe04866){return{'name':_0xe04866['fieldName'],'type':_0xe04866[_0xb6e8('0x3a')][_0xb6e8('0x3b')]};});_0x1a6288['model']=_[_0xb6e8('0x37')](_0x1013f7,_0xb6e8('0x33'));_0x1a6288[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x29928e['query']);_0x1a6288[_0xb6e8('0x3e')]=_[_0xb6e8('0x3f')](_0x1a6288[_0xb6e8('0x40')],_0x1a6288[_0xb6e8('0x3c')]);_0x3377c5[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x1a6288[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x29928e['query'][_0xb6e8('0x42')]));_0x3377c5[_0xb6e8('0x41')]=_0x3377c5[_0xb6e8('0x41')]['length']?_0x3377c5[_0xb6e8('0x41')]:_0x1a6288[_0xb6e8('0x40')];if(!_0x29928e[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x3377c5[_0xb6e8('0x29')]=qs[_0xb6e8('0x29')](_0x29928e[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x3377c5['offset']=qs[_0xb6e8('0x2b')](_0x29928e[_0xb6e8('0x3c')]['offset']);}_0x3377c5[_0xb6e8('0x45')]=qs[_0xb6e8('0x46')](_0x29928e[_0xb6e8('0x3c')]['sort']);_0x3377c5[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x29928e['query'],_0x1a6288[_0xb6e8('0x3e')]),_0x1013f7);if(_0x29928e[_0xb6e8('0x3c')][_0xb6e8('0x49')]){_0x3377c5['where']=_['merge'](_0x3377c5['where'],{'$or':_[_0xb6e8('0x37')](_0x1013f7,function(_0x12eb58){if(_0x12eb58[_0xb6e8('0x3a')]!=='VIRTUAL'){var _0x252fd8={};_0x252fd8[_0x12eb58[_0xb6e8('0x33')]]={'$like':'%'+_0x29928e[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x252fd8;}})});}_0x3377c5=_[_0xb6e8('0x4a')]({},_0x3377c5,_0x29928e[_0xb6e8('0x4b')]);var _0x1e8bb9={'where':_0x3377c5['where']};return db[_0xb6e8('0x38')][_0xb6e8('0x2a')](_0x1e8bb9)[_0xb6e8('0x18')](function(_0xe6b4b3){_0x4cd715[_0xb6e8('0x2a')]=_0xe6b4b3;if(_0x29928e[_0xb6e8('0x3c')][_0xb6e8('0x4c')]){_0x3377c5[_0xb6e8('0x4d')]=[{'all':!![]}];}return db[_0xb6e8('0x38')]['findAll'](_0x3377c5);})[_0xb6e8('0x18')](function(_0x2775cc){_0x4cd715[_0xb6e8('0x4e')]=_0x2775cc;return _0x4cd715;})['then'](respondWithFilteredResult(_0x4c3dc3,_0x3377c5))[_0xb6e8('0x23')](handleError(_0x4c3dc3,null));};exports[_0xb6e8('0x4f')]=function(_0x45f194,_0x2ecb16){var _0x10673b={'raw':![],'where':{'id':_0x45f194[_0xb6e8('0x50')]['id']},'include':[{'model':db[_0xb6e8('0x51')],'as':_0xb6e8('0x36')}]},_0x333940={};_0x333940[_0xb6e8('0x40')]=_[_0xb6e8('0x3d')](db[_0xb6e8('0x38')]['rawAttributes']);_0x333940[_0xb6e8('0x3c')]=_['keys'](_0x45f194['query']);_0x333940[_0xb6e8('0x3e')]=_[_0xb6e8('0x3f')](_0x333940[_0xb6e8('0x40')],_0x333940[_0xb6e8('0x3c')]);_0x10673b[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x333940[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x45f194[_0xb6e8('0x3c')]['fields']));_0x10673b[_0xb6e8('0x41')]=_0x10673b[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x10673b['attributes']:_0x333940['model'];if(_0x45f194[_0xb6e8('0x3c')][_0xb6e8('0x4c')]){_0x10673b[_0xb6e8('0x4d')]=[{'all':!![]}];}_0x10673b=_[_0xb6e8('0x4a')]({},_0x10673b,_0x45f194[_0xb6e8('0x4b')]);return db['ChatWebsite']['find'](_0x10673b)[_0xb6e8('0x18')](handleEntityNotFound(_0x2ecb16,null))[_0xb6e8('0x18')](respondWithResult(_0x2ecb16,null))[_0xb6e8('0x23')](handleError(_0x2ecb16,null));};exports[_0xb6e8('0x53')]=function(_0x110462,_0x1f9e10){return db[_0xb6e8('0x38')]['create'](_0x110462[_0xb6e8('0x54')],{})[_0xb6e8('0x18')](function(_0x28a408){var _0x6c313f=_0x110462['user'][_0xb6e8('0x2f')]({'plain':!![]});if(!_0x6c313f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6c313f[_0xb6e8('0x55')]===_0xb6e8('0x56')){var _0x250150=_0x28a408[_0xb6e8('0x2f')]({'plain':!![]});var _0x2a9ca0=_0xb6e8('0x30');return db[_0xb6e8('0x57')][_0xb6e8('0x58')]({'where':{'name':_0x2a9ca0,'userProfileId':_0x6c313f[_0xb6e8('0x59')]},'raw':!![]})['then'](function(_0x5bc51a){if(_0x5bc51a&&_0x5bc51a[_0xb6e8('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x250150[_0xb6e8('0x33')],'resourceId':_0x250150['id'],'type':_0x5bc51a['name'],'sectionId':_0x5bc51a['id']},{})[_0xb6e8('0x18')](function(){return _0x28a408;});}else{return _0x28a408;}})[_0xb6e8('0x23')](function(_0x3f8ad9){logger[_0xb6e8('0x1f')](_0xb6e8('0x5b'),_0x3f8ad9);throw _0x3f8ad9;});}return _0x28a408;})['then'](respondWithResult(_0x1f9e10,0xc9))['catch'](handleError(_0x1f9e10,null));};exports[_0xb6e8('0x2e')]=function(_0x1ffa15,_0x510ba0){if(_0x1ffa15[_0xb6e8('0x54')]['id']){delete _0x1ffa15[_0xb6e8('0x54')]['id'];}return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x1ffa15['params']['id']},'include':[{'model':db[_0xb6e8('0x51')],'as':_0xb6e8('0x36')}]})['then'](handleEntityNotFound(_0x510ba0,null))['then'](saveUpdates(_0x1ffa15['body'],null))[_0xb6e8('0x18')](respondWithResult(_0x510ba0,null))[_0xb6e8('0x23')](handleError(_0x510ba0,null));};exports['destroy']=function(_0x20686a,_0x42244b){return db[_0xb6e8('0x38')]['find']({'where':{'id':_0x20686a['params']['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x42244b,null))['then'](removeEntity(_0x42244b,null))[_0xb6e8('0x23')](handleError(_0x42244b,null));};exports[_0xb6e8('0x5c')]=function(_0x347e81,_0x306e59){return db[_0xb6e8('0x38')]['describe']()[_0xb6e8('0x18')](respondWithResult(_0x306e59,null))[_0xb6e8('0x23')](handleError(_0x306e59,null));};exports['addDisposition']=function(_0x653f1e,_0xaec303){if(_0x653f1e['body']['id']){delete _0x653f1e[_0xb6e8('0x54')]['id'];}return db['ChatWebsite'][_0xb6e8('0x58')]({'where':{'id':_0x653f1e[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0xaec303,null))[_0xb6e8('0x18')](function(_0x4abeb4){if(_0x4abeb4){_0x653f1e[_0xb6e8('0x54')][_0xb6e8('0x5d')]=_0x4abeb4['id'];return db['Disposition'][_0xb6e8('0x53')](_0x653f1e[_0xb6e8('0x54')]);}})[_0xb6e8('0x18')](respondWithResult(_0xaec303,null))['catch'](handleError(_0xaec303,null));};exports['getDispositions']=function(_0x19d8ac,_0x19d36b){var _0x4cea1d={'raw':![],'where':{}};var _0x286e15={};var _0x44ddc5={'count':0x0,'rows':[]};return db[_0xb6e8('0x38')][_0xb6e8('0x5e')]({'where':{'id':_0x19d8ac[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x19d36b,null))[_0xb6e8('0x18')](function(_0x457e58){if(_0x457e58){_0x286e15[_0xb6e8('0x40')]=_['keys'](db[_0xb6e8('0x5f')][_0xb6e8('0x39')]);_0x286e15[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x19d8ac[_0xb6e8('0x3c')]);_0x286e15[_0xb6e8('0x3e')]=_['intersection'](_0x286e15[_0xb6e8('0x40')],_0x286e15['query']);_0x4cea1d[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x286e15[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x42')]));_0x4cea1d[_0xb6e8('0x41')]=_0x4cea1d[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x4cea1d[_0xb6e8('0x41')]:_0x286e15[_0xb6e8('0x40')];if(!_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x43')]('nolimit')){_0x4cea1d[_0xb6e8('0x29')]=qs[_0xb6e8('0x29')](_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x4cea1d['offset']=qs[_0xb6e8('0x2b')](_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x2b')]);}_0x4cea1d['order']=qs[_0xb6e8('0x46')](_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x46')]);_0x4cea1d[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x19d8ac['query'],_0x286e15[_0xb6e8('0x3e')]));_0x4cea1d[_0xb6e8('0x47')]['ChatWebsiteId']=_0x457e58['id'];if(_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x49')]){_0x4cea1d[_0xb6e8('0x47')]=_[_0xb6e8('0x4a')](_0x4cea1d['where'],{'$or':_[_0xb6e8('0x37')](_0x4cea1d[_0xb6e8('0x41')],function(_0x29c705){var _0x1626fd={};_0x1626fd[_0x29c705]={'$like':'%'+_0x19d8ac[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x1626fd;})});}_0x4cea1d=_[_0xb6e8('0x4a')]({},_0x4cea1d,_0x19d8ac[_0xb6e8('0x4b')]);return db[_0xb6e8('0x5f')][_0xb6e8('0x2a')]({'where':_0x4cea1d[_0xb6e8('0x47')]})['then'](function(_0x568712){_0x44ddc5[_0xb6e8('0x2a')]=_0x568712;if(_0x19d8ac[_0xb6e8('0x3c')]['includeAll']){_0x4cea1d[_0xb6e8('0x4d')]=[{'all':!![]}];}return db[_0xb6e8('0x5f')][_0xb6e8('0x60')](_0x4cea1d);})[_0xb6e8('0x18')](function(_0x4e2e24){_0x44ddc5[_0xb6e8('0x4e')]=_0x4e2e24;return _0x44ddc5;});}})[_0xb6e8('0x18')](respondWithFilteredResult(_0x19d36b,_0x4cea1d))[_0xb6e8('0x23')](handleError(_0x19d36b,null));};exports[_0xb6e8('0x61')]=function(_0x25108a,_0x42efc6){return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x25108a[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x42efc6,null))[_0xb6e8('0x18')](function(_0x488e9c){if(_0x488e9c){return _0x488e9c[_0xb6e8('0x61')](_0x25108a[_0xb6e8('0x3c')]['ids']);}})[_0xb6e8('0x18')](respondWithStatusCode(_0x42efc6,null))[_0xb6e8('0x23')](handleError(_0x42efc6,null));};exports['addAnswer']=function(_0x1f7c27,_0x2bbe7c){if(_0x1f7c27[_0xb6e8('0x54')]['id']){delete _0x1f7c27[_0xb6e8('0x54')]['id'];}return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x1f7c27[_0xb6e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bbe7c,null))[_0xb6e8('0x18')](function(_0x17c92f){if(_0x17c92f){_0x1f7c27[_0xb6e8('0x54')][_0xb6e8('0x5d')]=_0x17c92f['id'];return db[_0xb6e8('0x62')][_0xb6e8('0x53')](_0x1f7c27[_0xb6e8('0x54')]);}})['then'](respondWithResult(_0x2bbe7c,null))['catch'](handleError(_0x2bbe7c,null));};exports['getAnswers']=function(_0x5b890c,_0x4373f0){var _0x410c23={'raw':![],'where':{}};var _0x29a8bd={};var _0x45609f={'count':0x0,'rows':[]};return db[_0xb6e8('0x38')][_0xb6e8('0x5e')]({'where':{'id':_0x5b890c[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x4373f0,null))[_0xb6e8('0x18')](function(_0x4b2710){if(_0x4b2710){_0x29a8bd['model']=_[_0xb6e8('0x3d')](db[_0xb6e8('0x62')]['rawAttributes']);_0x29a8bd[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x5b890c[_0xb6e8('0x3c')]);_0x29a8bd[_0xb6e8('0x3e')]=_['intersection'](_0x29a8bd[_0xb6e8('0x40')],_0x29a8bd['query']);_0x410c23[_0xb6e8('0x41')]=_['intersection'](_0x29a8bd[_0xb6e8('0x40')],qs['fields'](_0x5b890c[_0xb6e8('0x3c')]['fields']));_0x410c23['attributes']=_0x410c23['attributes']['length']?_0x410c23[_0xb6e8('0x41')]:_0x29a8bd[_0xb6e8('0x40')];if(!_0x5b890c[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x410c23[_0xb6e8('0x29')]=qs[_0xb6e8('0x29')](_0x5b890c['query'][_0xb6e8('0x29')]);_0x410c23[_0xb6e8('0x2b')]=qs['offset'](_0x5b890c['query']['offset']);}_0x410c23['order']=qs[_0xb6e8('0x46')](_0x5b890c[_0xb6e8('0x3c')]['sort']);_0x410c23[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x5b890c[_0xb6e8('0x3c')],_0x29a8bd['filters']));_0x410c23[_0xb6e8('0x47')][_0xb6e8('0x5d')]=_0x4b2710['id'];if(_0x5b890c[_0xb6e8('0x3c')][_0xb6e8('0x49')]){_0x410c23[_0xb6e8('0x47')]=_[_0xb6e8('0x4a')](_0x410c23[_0xb6e8('0x47')],{'$or':_['map'](_0x410c23[_0xb6e8('0x41')],function(_0x14920f){var _0x1ad073={};_0x1ad073[_0x14920f]={'$like':'%'+_0x5b890c[_0xb6e8('0x3c')]['filter']+'%'};return _0x1ad073;})});}_0x410c23=_[_0xb6e8('0x4a')]({},_0x410c23,_0x5b890c['options']);return db[_0xb6e8('0x62')][_0xb6e8('0x2a')]({'where':_0x410c23[_0xb6e8('0x47')]})[_0xb6e8('0x18')](function(_0x303359){_0x45609f[_0xb6e8('0x2a')]=_0x303359;if(_0x5b890c[_0xb6e8('0x3c')][_0xb6e8('0x4c')]){_0x410c23[_0xb6e8('0x4d')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x410c23);})[_0xb6e8('0x18')](function(_0x44bea8){_0x45609f[_0xb6e8('0x4e')]=_0x44bea8;return _0x45609f;});}})[_0xb6e8('0x18')](respondWithFilteredResult(_0x4373f0,_0x410c23))['catch'](handleError(_0x4373f0,null));};exports[_0xb6e8('0x63')]=function(_0x2e8e39,_0x4da64b){return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x2e8e39['params']['id']}})['then'](handleEntityNotFound(_0x4da64b,null))[_0xb6e8('0x18')](function(_0x5e24aa){if(_0x5e24aa){return _0x5e24aa['removeAnswers'](_0x2e8e39[_0xb6e8('0x3c')]['ids']);}})[_0xb6e8('0x18')](respondWithStatusCode(_0x4da64b,null))['catch'](handleError(_0x4da64b,null));};exports['addLogo']=function(_0x2cee7e,_0x5bd8c0){_0x2cee7e[_0xb6e8('0x54')][_0xb6e8('0x64')]=_0x2cee7e[_0xb6e8('0x65')][_0xb6e8('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x2cee7e[_0xb6e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x5bd8c0,null))[_0xb6e8('0x18')](saveUpdates(_0x2cee7e[_0xb6e8('0x54')],null))['then'](respondWithResult(_0x5bd8c0,null))['catch'](handleError(_0x5bd8c0,null));};exports[_0xb6e8('0x67')]=function(_0x148ffa,_0x4bbe30){_0x148ffa[_0xb6e8('0x54')][_0xb6e8('0x68')]=_0x148ffa[_0xb6e8('0x65')][_0xb6e8('0x66')];return db['ChatWebsite'][_0xb6e8('0x58')]({'where':{'id':_0x148ffa[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x4bbe30,null))[_0xb6e8('0x18')](saveUpdates(_0x148ffa[_0xb6e8('0x54')],null))[_0xb6e8('0x18')](respondWithResult(_0x4bbe30,null))[_0xb6e8('0x23')](handleError(_0x4bbe30,null));};exports[_0xb6e8('0x69')]=function(_0x429c8f,_0x35e0d5){_0x429c8f[_0xb6e8('0x54')][_0xb6e8('0x6a')]=_0x429c8f['file'][_0xb6e8('0x66')];return db['ChatWebsite'][_0xb6e8('0x58')]({'where':{'id':_0x429c8f[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x35e0d5,null))['then'](saveUpdates(_0x429c8f[_0xb6e8('0x54')],null))[_0xb6e8('0x18')](respondWithResult(_0x35e0d5,null))[_0xb6e8('0x23')](handleError(_0x35e0d5,null));};exports['addSystemAvatar']=function(_0x164f1d,_0x4f131e){_0x164f1d[_0xb6e8('0x54')][_0xb6e8('0x6b')]=_0x164f1d[_0xb6e8('0x65')][_0xb6e8('0x66')];return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x164f1d[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x4f131e,null))[_0xb6e8('0x18')](saveUpdates(_0x164f1d[_0xb6e8('0x54')],null))[_0xb6e8('0x18')](respondWithResult(_0x4f131e,null))['catch'](handleError(_0x4f131e,null));};exports[_0xb6e8('0x6c')]=function(_0x53f369,_0x564c86){var _0x2b19a5=path['join'](config[_0xb6e8('0x6d')],_0xb6e8('0x6e'));var _0x163a02={'where':{'id':_0x53f369[_0xb6e8('0x50')]['id']},'attributes':['id',_0xb6e8('0x64')],'raw':!![]};var _0x883aa3=![];return require('../../config/license/util')[_0xb6e8('0x6f')]()[_0xb6e8('0x18')](function(_0x29c343){if(_0x29c343){_0x883aa3=_0x29c343['custom'];}})[_0xb6e8('0x18')](function(){return db[_0xb6e8('0x38')]['find'](_0x163a02);})[_0xb6e8('0x18')](handleEntityNotFound(_0x564c86,null))[_0xb6e8('0x18')](function(_0xecec03){if(_0xecec03){if(!_['isNil'](_0xecec03[_0xb6e8('0x64')])){if(fs[_0xb6e8('0x70')](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x72'),_0xecec03['sitepic']))&&_0x883aa3){_0x2b19a5=path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x72'),_0xecec03['sitepic']);}}return _0x564c86[_0xb6e8('0x73')](_0x2b19a5);}})[_0xb6e8('0x23')](handleError(_0x564c86,null));};exports[_0xb6e8('0x74')]=function(_0x556114,_0x5c1302){var _0x5ef424=path['join'](config[_0xb6e8('0x6d')],_0xb6e8('0x75'));var _0x3efaf8={'where':{'id':_0x556114[_0xb6e8('0x50')]['id']},'attributes':['id',_0xb6e8('0x68')],'raw':!![]};return db[_0xb6e8('0x38')][_0xb6e8('0x58')](_0x3efaf8)[_0xb6e8('0x18')](handleEntityNotFound(_0x5c1302,null))[_0xb6e8('0x18')](function(_0x4e7f5b){if(_0x4e7f5b){if(!_[_0xb6e8('0x76')](_0x4e7f5b[_0xb6e8('0x68')])){if(fs[_0xb6e8('0x70')](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],'server/files/images/avatars/',_0x4e7f5b[_0xb6e8('0x68')]))){_0x5ef424=path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x77'),_0x4e7f5b['agentAvatar']);}}return _0x5c1302[_0xb6e8('0x73')](_0x5ef424);}})[_0xb6e8('0x23')](handleError(_0x5c1302,null));};exports[_0xb6e8('0x78')]=function(_0x200ea8,_0x4a005e){var _0x1b25af=path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x79'));var _0x134f42={'where':{'id':_0x200ea8[_0xb6e8('0x50')]['id']},'attributes':['id',_0xb6e8('0x6a'),'showCustomerAvatar'],'raw':!![]};return db[_0xb6e8('0x38')][_0xb6e8('0x58')](_0x134f42)['then'](handleEntityNotFound(_0x4a005e,null))[_0xb6e8('0x18')](function(_0x489943){if(_0x489943){if(!_[_0xb6e8('0x76')](_0x489943[_0xb6e8('0x6a')])){if(fs[_0xb6e8('0x70')](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x77'),_0x489943[_0xb6e8('0x6a')]))&&_0x489943[_0xb6e8('0x7a')]){_0x1b25af=path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x77'),_0x489943[_0xb6e8('0x6a')]);}}return _0x4a005e['download'](_0x1b25af);}})[_0xb6e8('0x23')](handleError(_0x4a005e,null));};exports[_0xb6e8('0x7b')]=function(_0x702594,_0x5b90b9){var _0x310f7e=path['join'](config[_0xb6e8('0x6d')],_0xb6e8('0x7c'));var _0x200720={'where':{'id':_0x702594[_0xb6e8('0x50')]['id']},'attributes':['id',_0xb6e8('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xb6e8('0x58')](_0x200720)[_0xb6e8('0x18')](handleEntityNotFound(_0x5b90b9,null))[_0xb6e8('0x18')](function(_0x595d12){if(_0x595d12){if(!_[_0xb6e8('0x76')](_0x595d12[_0xb6e8('0x6b')])){if(fs['existsSync'](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0x77'),_0x595d12['systemAvatar']))){_0x310f7e=path['join'](config[_0xb6e8('0x6d')],_0xb6e8('0x77'),_0x595d12[_0xb6e8('0x6b')]);}}return _0x5b90b9[_0xb6e8('0x73')](_0x310f7e);}})[_0xb6e8('0x23')](handleError(_0x5b90b9,null));};exports[_0xb6e8('0x7d')]=function(_0x2ed0fa,_0x4b68da){var _0x367968=require(_0xb6e8('0x7e'));var _0x144747=new _0x367968();var _0x21e804=_0x144747[_0xb6e8('0x7f')](_0x2ed0fa[_0xb6e8('0x80')][_0xb6e8('0x81')])[_0xb6e8('0x82')]();var _0x40ddd1={'body':_0x2ed0fa[_0xb6e8('0x54')],'channel':_0xb6e8('0x83')};var _0x45fdd3=[];var _0x49c5f0=[];var _0x20d4fb={};var _0x4da0dd=![];return db[_0xb6e8('0x84')]['describe']()[_0xb6e8('0x18')](function(_0x51ca3f){if(!_0x51ca3f){throw new db[(_0xb6e8('0x85'))][(_0xb6e8('0x86'))](_0xb6e8('0x87'));}_0x45fdd3=_['difference'](_['keys'](_0x51ca3f),[_0xb6e8('0x88'),'updatedAt']);_0x49c5f0=_[_0xb6e8('0x89')](_[_0xb6e8('0x3d')](_0x51ca3f),['createdAt',_0xb6e8('0x8a'),'CompanyId',_0xb6e8('0x8b')]);if(_0x2ed0fa['body']['id']){delete _0x2ed0fa[_0xb6e8('0x54')]['id'];}if(_[_0xb6e8('0x76')](_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x8c')])){throw new db[(_0xb6e8('0x85'))][(_0xb6e8('0x86'))]('from\x20is\x20mandatory');}if(_[_0xb6e8('0x76')](_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x54')])||_0x2ed0fa['body'][_0xb6e8('0x54')]===''){throw new db['Sequelize'][(_0xb6e8('0x86'))](_0xb6e8('0x8d'));}if(_['isNil'](_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x8e')])){throw new db[(_0xb6e8('0x85'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49c5f0);}if(!_[_0xb6e8('0x8f')](_0x49c5f0,_0x2ed0fa[_0xb6e8('0x54')]['mapKey'])){throw new db['Sequelize'][(_0xb6e8('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49c5f0);}_0x20d4fb[_0x2ed0fa['body']['mapKey']]=_0x2ed0fa['body'][_0xb6e8('0x8c')];})[_0xb6e8('0x18')](function(){return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x2ed0fa[_0xb6e8('0x50')]['id']},'include':[{'model':db[_0xb6e8('0x90')],'as':_0xb6e8('0x91'),'include':[{'model':db[_0xb6e8('0x84')],'as':_0xb6e8('0x92'),'where':_0x20d4fb,'limit':0x1,'order':[[_0xb6e8('0x8a'),_0xb6e8('0x93')]]}]},{'model':db[_0xb6e8('0x94')],'as':_0xb6e8('0x95')}]});})[_0xb6e8('0x18')](handleEntityNotFound(_0x4b68da,null))[_0xb6e8('0x18')](function(_0x44a01f){if(_0x44a01f&&_0x44a01f[_0xb6e8('0x91')]){_0x40ddd1[_0xb6e8('0x96')]=_0x44a01f;_0x40ddd1[_0xb6e8('0x97')]=_0x44a01f[_0xb6e8('0x95')];_0x40ddd1[_0xb6e8('0x98')]=_0x44a01f['List'];_0x40ddd1[_0xb6e8('0x97')]=_['orderBy'](_0x40ddd1[_0xb6e8('0x97')],[_0xb6e8('0x99')],[_0xb6e8('0x9a')]);if(_0x40ddd1[_0xb6e8('0x96')]['Applications']){delete _0x40ddd1[_0xb6e8('0x96')]['Applications'];}if(_0x40ddd1[_0xb6e8('0x96')]['List']&&_0x40ddd1[_0xb6e8('0x96')][_0xb6e8('0x91')][_0xb6e8('0x92')][_0xb6e8('0x52')]){return _0x40ddd1[_0xb6e8('0x96')][_0xb6e8('0x91')]['Contacts'][0x0];}var _0x3da5dc=_[_0xb6e8('0xe')](_0x2ed0fa[_0xb6e8('0x54')],{'firstName':_0x2ed0fa[_0xb6e8('0x54')]['from'],'ListId':_0x44a01f[_0xb6e8('0x8b')]});_0x3da5dc[_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x8e')]]=_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x8c')];return db[_0xb6e8('0x84')][_0xb6e8('0x53')](_0x3da5dc,{'fields':_0x45fdd3,'raw':!![]});}})[_0xb6e8('0x18')](handleEntityNotFound(_0x4b68da,null))[_0xb6e8('0x18')](function(_0xf5401f){_0x40ddd1[_0xb6e8('0x9b')]=_0xf5401f;var _0x21be4d=_0x2ed0fa['body'][_0xb6e8('0x9c')];if(_0x2ed0fa['headers'][_0xb6e8('0x9d')]){_0x21be4d=_0x2ed0fa[_0xb6e8('0x80')]['cf-connecting-ip'];}else if(_0x2ed0fa[_0xb6e8('0x80')][_0xb6e8('0x9e')]){_0x21be4d=_['first'](_0x2ed0fa[_0xb6e8('0x80')]['x-forwarded-for'][_0xb6e8('0x9f')](','));}if(_0xf5401f){var _0x3356c7={'ContactId':_0xf5401f['id'],'ChatWebsiteId':_0x2ed0fa['params']['id'],'from':(_0xf5401f['firstName']||'')+'\x20'+(_0xf5401f[_0xb6e8('0xa0')]||''),'customerIp':_0x21be4d,'customerPort':_0x2ed0fa[_0xb6e8('0x80')][_0xb6e8('0xa1')]?_0x2ed0fa[_0xb6e8('0x80')][_0xb6e8('0xa1')]:null,'referer':_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xa2')],'browserName':_0x21e804[_0xb6e8('0xa3')][_0xb6e8('0x33')]&&_0x21e804[_0xb6e8('0xa3')][_0xb6e8('0xa4')]?util['format']('%s\x20%s',_0x21e804['browser']['name'],_0x21e804[_0xb6e8('0xa3')][_0xb6e8('0xa4')]):_0xb6e8('0xa5'),'browserVersion':_0x21e804['browser'][_0xb6e8('0xa4')]||'unknown','osName':util['format']('%s\x20%s',_0x21e804['os'][_0xb6e8('0x33')],_0x21e804['os'][_0xb6e8('0xa4')]),'osVersion':_0x21e804['os'][_0xb6e8('0xa4')],'deviceModel':_0x21e804[_0xb6e8('0xa6')]['model']&&_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0xa7')]?util[_0xb6e8('0xa8')](_0xb6e8('0xa9'),_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0x40')],_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0xa7')],_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0x3a')]):null,'deviceVendor':_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0xa7')],'deviceType':_0x21e804[_0xb6e8('0xa6')][_0xb6e8('0x3a')],'formData':JSON[_0xb6e8('0x1e')](_0x2ed0fa['body'])};var _0x1939fc={'ChatWebsiteId':_0x2ed0fa[_0xb6e8('0x50')]['id'],'closed':![]};if(_0x2ed0fa[_0xb6e8('0x54')]['threadId']){_0x1939fc[_0xb6e8('0xaa')]=_0x2ed0fa['body'][_0xb6e8('0xaa')];return db['ChatInteraction'][_0xb6e8('0x58')]({'where':_0x1939fc})[_0xb6e8('0x18')](function(_0x28d985){if(_0x28d985){return[_0x28d985,![]];}_0x3356c7[_0xb6e8('0xaa')]=_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xaa')];_0x3356c7[_0xb6e8('0xab')]=_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xab')];return db['ChatInteraction'][_0xb6e8('0x53')](_0x3356c7)[_0xb6e8('0x18')](function(_0x1ca469){return[_0x1ca469,!![]];});});}_0x1939fc[_0xb6e8('0xac')]=_0xf5401f['id'];if(_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xad')]&&_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xad')]['id']){_0x1939fc['id']=_0x2ed0fa[_0xb6e8('0x54')]['interaction']['id'];return db[_0xb6e8('0xae')][_0xb6e8('0x58')]({'where':_0x1939fc})[_0xb6e8('0x18')](function(_0x1c553f){if(_0x1c553f){return[_0x1c553f,![]];}return db[_0xb6e8('0xae')][_0xb6e8('0x53')](_0x3356c7)['then'](function(_0x37c8d8){return[_0x37c8d8,!![]];});});}return db[_0xb6e8('0xae')][_0xb6e8('0x53')](_0x3356c7)['then'](function(_0x29e8b8){return[_0x29e8b8,!![]];});}})[_0xb6e8('0xaf')](function(_0x2091b5,_0x2ea7a4){if(_0x2091b5){_0x4da0dd=_0x2ea7a4;if(!_0x2ea7a4){var _0x5a6349={'from':(_0x40ddd1[_0xb6e8('0x9b')]['firstName']||'')+'\x20'+(_0x40ddd1[_0xb6e8('0x9b')][_0xb6e8('0xa0')]||'')};if(_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xaa')]&&_0x2ed0fa[_0xb6e8('0x54')]['messageId']&&_0x2ed0fa[_0xb6e8('0x54')]['threadId']!=_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0xb0')]){_0x5a6349[_0xb6e8('0xaa')]=_0x2ed0fa['body']['messageId'];}return _0x2091b5[_0xb6e8('0x2e')](_0x5a6349);}else{return _0x2091b5;}}})[_0xb6e8('0x18')](function(_0x2d3040){_0x40ddd1[_0xb6e8('0xad')]=_0x2d3040[_0xb6e8('0x2f')]({'plain':!![]});_0x40ddd1[_0xb6e8('0xad')][_0xb6e8('0xb1')]=_0x4da0dd;if(_0x40ddd1[_0xb6e8('0xad')]['created']){if(_0x40ddd1[_0xb6e8('0x96')]['autoclose']){_0x40ddd1[_0xb6e8('0x97')][_0xb6e8('0xb2')]({'id':0x0,'priority':_0x40ddd1['applications'][_0xb6e8('0x52')]+0x1,'app':_0xb6e8('0xb3'),'appdata':_0xb6e8('0xb4'),'interval':_0xb6e8('0xb5')});}}return db[_0xb6e8('0xb6')][_0xb6e8('0x53')]({'body':_0x2ed0fa[_0xb6e8('0x54')][_0xb6e8('0x54')],'ChatWebsiteId':_0x2ed0fa[_0xb6e8('0x50')]['id'],'ChatInteractionId':_0x2d3040['id'],'direction':'in','ContactId':_0x40ddd1[_0xb6e8('0x9b')]['id'],'AttachmentId':_0x2ed0fa['body'][_0xb6e8('0xb7')]});})['then'](function(_0x2d12f0){_0x40ddd1['message']=_0x2d12f0;if(_0x40ddd1[_0xb6e8('0xad')]['UserId']){return db[_0xb6e8('0xb8')][_0xb6e8('0x58')]({'attributes':['id',_0xb6e8('0x33')],'where':{'id':_0x40ddd1[_0xb6e8('0xad')][_0xb6e8('0xb9')]}})['then'](function(_0x21e457){if(_0x21e457){_0x40ddd1[_0xb6e8('0x97')][_0xb6e8('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x21e457[_0xb6e8('0x33')]+','+(_0x40ddd1[_0xb6e8('0x96')]['waitForTheAssignedAgent']||0xa),'interval':_0xb6e8('0xb5')});_0x40ddd1['forcedOwnership']=!![];}return respondWithRpcPromise(_0xb6e8('0xbb'),_0xb6e8('0xbc'),_0x40ddd1);});}return respondWithRpcPromise(_0xb6e8('0xbb'),_0xb6e8('0xbc'),_0x40ddd1);})[_0xb6e8('0x18')](function(_0x3dee2d){respondWithRpcPromise(_0xb6e8('0xbd'),_0xb6e8('0xbd'),{'event':'notify','message':_0x3dee2d},client9002);return _0x3dee2d;})['then'](respondWithResult(_0x4b68da,null))[_0xb6e8('0x23')](handleError(_0x4b68da,null));};exports['offline']=function(_0x123f1d,_0x5bdadb){var _0x4e8dff,_0x39d6c8,_0x527ab3;var _0x3624a9=[];var _0x4cbbf7={};var _0x4ab09d=_0x123f1d[_0xb6e8('0xbe')]||[];var _0x7d3917=[];var _0x166563;return db[_0xb6e8('0x84')][_0xb6e8('0x5c')]()['then'](function(_0x13f083){if(!_0x13f083){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x3624a9=_['difference'](_[_0xb6e8('0x3d')](_0x13f083),[_0xb6e8('0x88'),_0xb6e8('0x8a'),_0xb6e8('0xbf'),_0xb6e8('0x8b')]);if(_0x123f1d[_0xb6e8('0x54')]['id']){delete _0x123f1d['body']['id'];}if(_[_0xb6e8('0x76')](_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0x8c')])){throw _0x5bdadb[_0xb6e8('0x25')](0x1f4)[_0xb6e8('0x34')](new db['Sequelize']['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xb6e8('0x76')](_0x123f1d['body']['body'])||_0x123f1d[_0xb6e8('0x54')]['body']===''){throw _0x5bdadb[_0xb6e8('0x25')](0x1f4)[_0xb6e8('0x34')](new db[(_0xb6e8('0x85'))][(_0xb6e8('0x86'))](_0xb6e8('0x8d')));}if(_[_0xb6e8('0x76')](_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0xc0')])){throw _0x5bdadb[_0xb6e8('0x25')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xb6e8('0xc1')+_0x3624a9));}if(!_[_0xb6e8('0x8f')](_0x3624a9,_0x123f1d[_0xb6e8('0x54')]['mapKeyOffline'])){throw _0x5bdadb[_0xb6e8('0x25')](0x1f4)[_0xb6e8('0x34')](new db[(_0xb6e8('0x85'))][(_0xb6e8('0x86'))](_0xb6e8('0xc2')+_0x3624a9));}_0x4cbbf7[_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0xc0')]]=_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0x8c')];})[_0xb6e8('0x18')](function(){return db[_0xb6e8('0x38')]['find']({'where':{'id':_0x123f1d[_0xb6e8('0x50')]['id']},'include':[{'model':db[_0xb6e8('0x90')],'as':_0xb6e8('0x91')},{'model':db[_0xb6e8('0xc3')],'as':_0xb6e8('0xc3')}]});})[_0xb6e8('0x18')](handleEntityNotFound(_0x5bdadb,null))['then'](function(_0x42981b){if(_0x42981b&&_0x42981b['List']){_0x39d6c8=_0x42981b;var _0x250243=_[_0xb6e8('0xe')](_0x123f1d[_0xb6e8('0x54')],{'firstName':_0x123f1d['body'][_0xb6e8('0x8c')],'phone':_0x123f1d['body']['from'],'ListId':_0x42981b['ListId']});_0x250243[_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0xc0')]]=_0x123f1d[_0xb6e8('0x54')][_0xb6e8('0x8c')];return db['CmContact']['findOrCreate']({'where':_0x4cbbf7,'defaults':_0x250243});}})['spread'](function(_0xd8fee9){if(_0xd8fee9){_0x527ab3=_0xd8fee9;var _0x564d30=fs[_0xb6e8('0xc4')](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0xc5')),_0xb6e8('0xc6'));var _0x5f4aa1=ejs[_0xb6e8('0xc7')](_0x564d30,{'body':_['toPairs'](_0x123f1d['body']['body']),'bodyTitle':_0x39d6c8['offlineMessageBody']});return db['ChatOfflineMessage'][_0xb6e8('0x53')]({'body':_0x5f4aa1,'plainBody':htmlToText[_0xb6e8('0xc8')](_0x5f4aa1),'ContactId':_0xd8fee9['id'],'ChatWebsiteId':_0x39d6c8['id']});}})['then'](function(_0x7e8de4){_0x166563=_0x7e8de4;if(_0x4ab09d[_0xb6e8('0x52')]){var _0x329cd6=_0x4ab09d['map'](function(_0x2044b5){return{'name':_0x2044b5[_0xb6e8('0xc9')],'basename':_0x2044b5[_0xb6e8('0x66')],'type':_0x2044b5[_0xb6e8('0xca')],'ChatOfflineMessageId':_0x7e8de4['id']};});_0x7d3917=_0x329cd6[_0xb6e8('0x37')](_0x481a76=>{var _0x51c3f9={'filename':_0x481a76['name'],'path':path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0xcb'),_0xb6e8('0xbe'),_0xb6e8('0xcc'),'offline-chat',_0x481a76[_0xb6e8('0xcd')])};return _0x51c3f9;});if(!_0x39d6c8[_0xb6e8('0xce')]){return db[_0xb6e8('0xcf')][_0xb6e8('0xd0')](function(_0x2f3466){return db[_0xb6e8('0xd1')][_0xb6e8('0xd2')](_0x329cd6,{'transaction':_0x2f3466});});}}})['then'](function(){if(_0x166563){_0x4e8dff=_0x166563;return db[_0xb6e8('0xc3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xb6e8('0xd3')],'as':_0xb6e8('0xd4'),'raw':!![],'include':[{'model':db[_0xb6e8('0xd5')],'as':_0xb6e8('0xd5'),'raw':!![]}]}]});}})[_0xb6e8('0x18')](function(_0x330862){if(_0x330862&&_0x330862[_0xb6e8('0xd4')]&&_0x39d6c8[_0xb6e8('0xd6')]&&_0x39d6c8[_0xb6e8('0xd7')]){var _0x916c28=_0x330862['getSmtpOptions']();return respondWithRpcPromise(_0xb6e8('0xd8'),'sendMail',{'account':_0x916c28,'message':{'from':util[_0xb6e8('0xa8')](_0xb6e8('0xd9'),_0x330862[_0xb6e8('0x33')],_0x330862[_0xb6e8('0xda')]||_0x330862['Smtp'][_0xb6e8('0x56')]),'to':_0x39d6c8['forwardOfflineAddress'],'subject':_0x39d6c8[_0xb6e8('0xdb')],'html':_0x4e8dff[_0xb6e8('0x54')],'attachments':_0x7d3917}},client9003)[_0xb6e8('0x18')](function(){return _0x4e8dff;})[_0xb6e8('0x23')](function(_0x529cb9){logger['error'](_0x529cb9);});}})[_0xb6e8('0x18')](function(){if(_0x39d6c8&&_0x39d6c8[_0xb6e8('0xce')]&&_0x39d6c8[_0xb6e8('0xdc')]){var _0x35926a=[];if(_0x4ab09d['length']){_0x35926a=_0x4ab09d['map'](function(_0x7fa0db){return{'name':_0x7fa0db[_0xb6e8('0xc9')],'basename':_0x7fa0db['filename'],'type':_0x7fa0db[_0xb6e8('0xca')],'ChatOfflineMessageId':_0x166563['id']};});}var _0x1bf6fb;if(!_[_0xb6e8('0x76')](_0x39d6c8['subjectOffline'])){var _0x1a9ab2=_['map'](_0x123f1d[_0xb6e8('0x54')],function(_0x3fed93){return _0x3fed93;});var _0x2d5df5=_[_0xb6e8('0xdd')](_0x1a9ab2)[0x0];var _0x412e79=_['mapValues'](_0x2d5df5,function(_0x19f1bd){return _0x19f1bd;});_0x1bf6fb=_0x412e79[0x1][_0x39d6c8[_0xb6e8('0xde')]];}var _0x1a8624={'from':_0x527ab3[_0xb6e8('0xda')],'firstName':_0x527ab3[_0xb6e8('0xdf')],'lastName':_0x527ab3[_0xb6e8('0xa0')],'mapKey':_0xb6e8('0xda'),'message':{'from':_0x527ab3[_0xb6e8('0xda')],'to':_0x39d6c8[_0xb6e8('0xc3')]['email'],'cc':'','subject':_[_0xb6e8('0x76')](_0x1bf6fb)?_0x39d6c8[_0xb6e8('0xdb')]:_0x1bf6fb,'messageId':'','sentAt':new Date(),'attach':_0x35926a[_0xb6e8('0x52')],'attachments':_0x35926a,'originChannel':_0xb6e8('0xe0'),'ChatWebsiteId':_0x39d6c8['id'],'ChatOfflineMessageId':_0x4e8dff['id'],'originTo':_0x39d6c8[_0xb6e8('0xc3')]['email']},'body':_0x4e8dff[_0xb6e8('0x54')]};var _0xd74351={'account':{'id':_0x39d6c8['MailAccountId']},'body':_0x1a8624,'log':_0xb6e8('0xe1')};return respondWithRpcPromise(_0xb6e8('0xe1'),_0xb6e8('0xe2'),_0xd74351,client9001)[_0xb6e8('0x18')](function(){return _0x4e8dff;})[_0xb6e8('0x23')](function(_0xc09e23){logger[_0xb6e8('0x1f')](_0xc09e23);});}return;})[_0xb6e8('0x18')](function(){if(_0x4e8dff){return _0x4e8dff;}})[_0xb6e8('0x18')](respondWithResult(_0x5bdadb,null))[_0xb6e8('0x23')](function(_0x40f937){logger[_0xb6e8('0x1f')](_0xb6e8('0x23'),_0x40f937);for(var _0x1bdb2f of _0x4ab09d){var _0x4cc65d=path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],_0xb6e8('0xcb'),_0xb6e8('0xbe'),_0xb6e8('0xcc'),_0xb6e8('0xe3'),_0x1bdb2f[_0xb6e8('0x66')]);fs_extra[_0xb6e8('0xe4')](_0x4cc65d)['catch'](function(_0x300220){logger['error'](_0xb6e8('0xe5'),_0x4cc65d,_0x300220);});}});};exports[_0xb6e8('0xe6')]=function(_0x205d8b,_0x49216d){return db[_0xb6e8('0xae')][_0xb6e8('0x58')]({'where':{'id':_0x205d8b[_0xb6e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x49216d,null))[_0xb6e8('0x18')](function(_0x5e7ce0){if(_0x5e7ce0){return _0x5e7ce0[_0xb6e8('0xe6')](_0x205d8b[_0xb6e8('0x54')]['ids'],_['omit'](_0x205d8b[_0xb6e8('0x54')],[_0xb6e8('0xe7'),'id'])||{});}})[_0xb6e8('0x18')](respondWithResult(_0x49216d,null))[_0xb6e8('0x23')](handleError(_0x49216d,null));};exports['getInteractions']=function(_0x319ddc,_0x4ad1d0){var _0x4b9e9b={'raw':![],'where':{}};var _0x10f14e={};var _0x8e432e={'count':0x0,'rows':[]};return db[_0xb6e8('0x38')][_0xb6e8('0x5e')]({'where':{'id':_0x319ddc[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x4ad1d0,null))['then'](function(_0xb596b5){if(_0xb596b5){_0x10f14e[_0xb6e8('0x40')]=_[_0xb6e8('0x3d')](db['ChatInteraction']['rawAttributes']);_0x10f14e[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x319ddc[_0xb6e8('0x3c')]);_0x10f14e[_0xb6e8('0x3e')]=_['intersection'](_0x10f14e[_0xb6e8('0x40')],_0x10f14e[_0xb6e8('0x3c')]);_0x4b9e9b[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x10f14e[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x319ddc['query'][_0xb6e8('0x42')]));_0x4b9e9b[_0xb6e8('0x41')]=_0x4b9e9b[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x4b9e9b[_0xb6e8('0x41')]:_0x10f14e['model'];if(!_0x319ddc[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x4b9e9b[_0xb6e8('0x29')]=qs[_0xb6e8('0x29')](_0x319ddc[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x4b9e9b[_0xb6e8('0x2b')]=qs[_0xb6e8('0x2b')](_0x319ddc[_0xb6e8('0x3c')]['offset']);}_0x4b9e9b[_0xb6e8('0x45')]=qs[_0xb6e8('0x46')](_0x319ddc['query'][_0xb6e8('0x46')]);_0x4b9e9b['where']=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x319ddc[_0xb6e8('0x3c')],_0x10f14e[_0xb6e8('0x3e')]));_0x4b9e9b['where'][_0xb6e8('0x5d')]=_0xb596b5['id'];if(_0x319ddc[_0xb6e8('0x3c')][_0xb6e8('0x49')]){_0x4b9e9b['where']=_[_0xb6e8('0x4a')](_0x4b9e9b['where'],{'$or':_[_0xb6e8('0x37')](_0x4b9e9b['attributes'],function(_0x155661){var _0x18904b={};_0x18904b[_0x155661]={'$like':'%'+_0x319ddc[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x18904b;})});}_0x4b9e9b=_[_0xb6e8('0x4a')]({},_0x4b9e9b,_0x319ddc['options']);return db['ChatInteraction'][_0xb6e8('0x2a')]({'where':_0x4b9e9b['where']})[_0xb6e8('0x18')](function(_0x4fe792){_0x8e432e[_0xb6e8('0x2a')]=_0x4fe792;if(_0x319ddc[_0xb6e8('0x3c')]['includeAll']){_0x4b9e9b['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xb6e8('0xb8')],'as':_0xb6e8('0xe8'),'attributes':['name',_0xb6e8('0xe9'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb6e8('0xea'),'attributes':['id',_0xb6e8('0x33'),'color'],'where':_0x319ddc[_0xb6e8('0x3c')][_0xb6e8('0xeb')]?{'id':_0x319ddc[_0xb6e8('0x3c')]['tag']}:undefined,'required':_0x319ddc['query'][_0xb6e8('0xeb')]?!![]:![]}];}return db[_0xb6e8('0xae')][_0xb6e8('0x60')](_0x4b9e9b);})[_0xb6e8('0x18')](function(_0x4e60b5){_0x8e432e['rows']=_0x4e60b5;return _0x8e432e;});}})['then'](respondWithFilteredResult(_0x4ad1d0,_0x4b9e9b))[_0xb6e8('0x23')](handleError(_0x4ad1d0,null));};function iftimePromise(_0x26e56b,_0x5b381c){return respondWithRpcPromise(_0xb6e8('0xec'),_0xb6e8('0xed'),{'command':_0x5b381c[_0xb6e8('0xee')]?util['format'](_0xb6e8('0xef'),_0x26e56b[_0xb6e8('0xf0')],_0x5b381c[_0xb6e8('0xee')]):util['format'](_0xb6e8('0xf1'),_0x26e56b['interval'])},client9002)['then'](function(_0x47d154){var _0x1d0e9a=_0x47d154&&_0x47d154[_0xb6e8('0xf2')](_0xb6e8('0xf3'))>=0x0?!![]:![];logger[_0xb6e8('0x19')](_0xb6e8('0xf4'),_0x5b381c['id'],_0x26e56b['id'],_0x26e56b['interval'],_0x1d0e9a?'ONLINE':_0xb6e8('0xf5'),_0x5b381c['timezone']?_0x5b381c[_0xb6e8('0xee')]:_0xb6e8('0xf6'));return _0x1d0e9a;})[_0xb6e8('0x23')](function(_0x373c7e){logger[_0xb6e8('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5b381c['id'],_0x26e56b['id'],_0x26e56b['interval'],util[_0xb6e8('0xf7')](_0x373c7e,{'showHidden':![],'depth':null}),_0x5b381c[_0xb6e8('0xee')]?_0x5b381c[_0xb6e8('0xee')]:_0xb6e8('0xf6'));return![];});}exports['getSnippet']=function(_0x3a8389,_0x4dc403){var _0x47d178=0x0;var _0x240661=0x0;var _0x39b3ac=![];var _0x57b125;var _0x5609fe;return db[_0xb6e8('0x38')]['find']({'where':{'id':_0x3a8389[_0xb6e8('0x50')]['id']},'include':[{'model':db[_0xb6e8('0xf8')],'as':_0xb6e8('0xf8'),'include':[{'model':db[_0xb6e8('0xf8')],'as':_0xb6e8('0xf9'),'attributes':['id',_0xb6e8('0xf0')],'raw':!![]}]}]})[_0xb6e8('0x18')](handleEntityNotFound(_0x4dc403,null))[_0xb6e8('0x18')](function(_0x4e4d2b){if(_0x4e4d2b){_0x57b125=_0x4e4d2b;return _0x4e4d2b[_0xb6e8('0xfa')]({'raw':!![]});}})[_0xb6e8('0x18')](function(_0x23d038){if(_0x57b125){if(_0x23d038){_0x5609fe=_0x23d038;}}return require('../../config/license/util')[_0xb6e8('0x6f')]();})['then'](function(_0x2aa6db){if(_0x2aa6db){_0x240661=_0x2aa6db[_0xb6e8('0xfb')];_0x39b3ac=_0x2aa6db[_0xb6e8('0xfc')];}})[_0xb6e8('0x18')](function(){return db['ChatInteraction'][_0xb6e8('0x2a')]({'where':{'closed':![]}});})['then'](function(_0x5c00fd){_0x47d178=_0x5c00fd;if(_0x240661&&_0x5c00fd>_0x240661){return db['License']['findOne']({'where':{'id':0x1}})['then'](function(_0x3a2bb6){if(_0x3a2bb6){_0x3a2bb6[_0xb6e8('0xfd')](_0xb6e8('0xfe'));}});}})[_0xb6e8('0x18')](function(){if(_0x57b125[_0xb6e8('0xf8')]&&_0x57b125[_0xb6e8('0xf8')][_0xb6e8('0xf9')]){var _0x26af41=[];for(var _0x311197=0x0;_0x311197<_0x57b125['Interval'][_0xb6e8('0xf9')][_0xb6e8('0x52')];_0x311197++){var _0x531c52=_0x57b125[_0xb6e8('0xf8')][_0xb6e8('0xf9')][_0x311197][_0xb6e8('0x2f')]({'plain':!![]});_0x26af41[_0xb6e8('0xb2')](iftimePromise(_0x531c52,_0x57b125));}return BPromise[_0xb6e8('0xff')](_0x26af41)['then'](function(_0x3a9aa7){return _[_0xb6e8('0x100')](_0x3a9aa7);});}else{return!![];}})[_0xb6e8('0x18')](function(_0x38d577){var _0x1b5ca7=fs['readFileSync'](path[_0xb6e8('0x71')](config[_0xb6e8('0x6d')],'server/files/chat/iframe.ejs'),_0xb6e8('0xc6'));var _0x2273ff=new url[(_0xb6e8('0x101'))](_0x57b125[_0xb6e8('0x102')])[_0xb6e8('0x103')];var _0x154972=_0xb6e8('0x104');var _0x4bc135=![];var _0x52087d={'chatVersion':_0x154972,'chatWebsiteAddressOrigin':_0x2273ff,'remote':_0x57b125[_0xb6e8('0x105')],'query':querystring['stringify'](_['merge'](_0x57b125['get']({'plain':!![]}),{'customerIp':_0x3a8389['headers'][_0xb6e8('0x9e')]||_0x3a8389['headers'][_0xb6e8('0x106')]||_0x3a8389[_0xb6e8('0x107')][_0xb6e8('0x108')]||_0x3a8389['ip'],'referer':_0x3a8389[_0xb6e8('0x80')]['referer'],'openedInteractions':_0x47d178,'maxInteractions':_0x240661,'virtual':_0x39b3ac['virtual'],'online':_0x38d577,'custom':_0x39b3ac}))[_0xb6e8('0x109')](/'/g,'\x5c\x27')};_0x4dc403[_0xb6e8('0x34')](ejs[_0xb6e8('0xc7')](Mustache[_0xb6e8('0xc7')](_0x1b5ca7,_0x52087d),{'proactiveActions':_0x5609fe,'alignment':_0x57b125[_0xb6e8('0x10a')],'verticalAlignment':_0x57b125['verticalAlignment'],'div_color':_0x57b125[_0xb6e8('0x10b')],'labelText':_0x57b125[_0xb6e8('0x10c')],'text_color':_0x57b125[_0xb6e8('0x10d')],'text_button_color':_0x57b125[_0xb6e8('0x10e')],'button_color':_0x57b125['color_button'],'background_color':_0x57b125[_0xb6e8('0x10f')],'hideWhenOffline':_0x57b125[_0xb6e8('0x110')],'intervalId':_0x57b125[_0xb6e8('0x111')],'isDevelopment':_0x4bc135,'chatVersion':_0x154972}));})[_0xb6e8('0x23')](handleError(_0x4dc403,null));};exports[_0xb6e8('0x112')]=function(_0x30593f,_0x515e3d){var _0x164b38=_0x30593f[_0xb6e8('0x50')]['id'];var _0x15bcf2=_0x30593f['body'];var _0x378a19=0xc8;var _0x52b7f5=null;return db[_0xb6e8('0xcf')][_0xb6e8('0xd0')]({'isolationLevel':db[_0xb6e8('0xcf')][_0xb6e8('0x113')][_0xb6e8('0x114')][_0xb6e8('0x115')]},function(_0xdcd245){return db['ChatWebsite'][_0xb6e8('0x5e')]({'where':{'id':_0x164b38},'transaction':_0xdcd245})[_0xb6e8('0x18')](function(_0x71d3df){if(_0x71d3df){return db[_0xb6e8('0x94')][_0xb6e8('0x116')]({'where':{'ChatWebsiteId':_0x164b38},'transaction':_0xdcd245})[_0xb6e8('0x18')](function(){var _0x1e01ef=_[_0xb6e8('0x37')](_0x15bcf2,function(_0x351da7){_0x351da7['ChatWebsiteId']=_0x164b38;return _0x351da7;});return db['ChatApplication'][_0xb6e8('0xd2')](_0x1e01ef,{'transaction':_0xdcd245});});}else{_0x378a19=0x194;_0x52b7f5=[];}});})[_0xb6e8('0x18')](function(){if(_0x378a19!==0x194){return db[_0xb6e8('0x94')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x164b38},'order':'priority'})[_0xb6e8('0x18')](function(_0x345f92){_0x52b7f5=_0x345f92;});}})[_0xb6e8('0x23')](function(_0x11b6d0){_0x378a19=0x1f4;logger['error'](_0x11b6d0[_0xb6e8('0x32')]);if(_0x11b6d0[_0xb6e8('0x33')]){delete _0x11b6d0[_0xb6e8('0x33')];}_0x52b7f5=_0x11b6d0;})[_0xb6e8('0x117')](function(){if(_0x52b7f5===null){_0x515e3d['sendStatus'](_0x378a19);}else{if(_0x378a19===0x1f4){_0x515e3d[_0xb6e8('0x25')](_0x378a19)[_0xb6e8('0x34')](_0x52b7f5);}else{_0x515e3d[_0xb6e8('0x25')](_0x378a19)[_0xb6e8('0x27')](_0x52b7f5);}}});};exports[_0xb6e8('0x118')]=function(_0x35cf53,_0x345fdc){var _0x5cbda5={};var _0x29ec78={};var _0x577a26;var _0x3ee1c4;return db['ChatWebsite']['findOne']({'where':{'id':_0x35cf53['params']['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x345fdc,null))[_0xb6e8('0x18')](function(_0x197996){if(_0x197996){_0x577a26=_0x197996;_0x29ec78[_0xb6e8('0x40')]=_['keys'](db[_0xb6e8('0x94')][_0xb6e8('0x39')]);_0x29ec78[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x35cf53['query']);_0x29ec78['filters']=_[_0xb6e8('0x3f')](_0x29ec78[_0xb6e8('0x40')],_0x29ec78['query']);_0x5cbda5[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x29ec78[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x35cf53['query'][_0xb6e8('0x42')]));_0x5cbda5[_0xb6e8('0x41')]=_0x5cbda5[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x5cbda5[_0xb6e8('0x41')]:_0x29ec78[_0xb6e8('0x40')];_0x5cbda5[_0xb6e8('0x45')]=qs[_0xb6e8('0x46')](_0x35cf53[_0xb6e8('0x3c')][_0xb6e8('0x46')]);_0x5cbda5[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x35cf53[_0xb6e8('0x3c')],_0x29ec78[_0xb6e8('0x3e')]));if(_0x35cf53['query'][_0xb6e8('0x49')]){_0x5cbda5[_0xb6e8('0x47')]=_['merge'](_0x5cbda5[_0xb6e8('0x47')],{'$or':_[_0xb6e8('0x37')](_0x5cbda5[_0xb6e8('0x41')],function(_0x4cf856){var _0x8f0e90={};_0x8f0e90[_0x4cf856]={'$like':'%'+_0x35cf53[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x8f0e90;})});}_0x5cbda5=_[_0xb6e8('0x4a')]({},_0x5cbda5,_0x35cf53[_0xb6e8('0x4b')]);return _0x577a26[_0xb6e8('0x118')](_0x5cbda5);}})[_0xb6e8('0x18')](function(_0x195ba9){if(_0x195ba9){_0x3ee1c4=_0x195ba9[_0xb6e8('0x52')];if(!_0x35cf53[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x5cbda5[_0xb6e8('0x29')]=qs['limit'](_0x35cf53[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x5cbda5[_0xb6e8('0x2b')]=qs['offset'](_0x35cf53[_0xb6e8('0x3c')][_0xb6e8('0x2b')]);}return _0x577a26[_0xb6e8('0x118')](_0x5cbda5);}})[_0xb6e8('0x18')](function(_0x426c19){if(_0x426c19){return _0x426c19?{'count':_0x3ee1c4,'rows':_0x426c19}:null;}})[_0xb6e8('0x18')](respondWithResult(_0x345fdc,null))[_0xb6e8('0x23')](handleError(_0x345fdc,null));};exports[_0xb6e8('0x119')]=function(_0xae9f8d,_0x255b37){return db[_0xb6e8('0x11a')][_0xb6e8('0x58')]({'where':{'id':_0xae9f8d[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x255b37,null))[_0xb6e8('0x18')](function(_0x31fb1b){if(_0x31fb1b){return _0x31fb1b[_0xb6e8('0x119')](_0xae9f8d[_0xb6e8('0x54')][_0xb6e8('0xe7')],_[_0xb6e8('0x11b')](_0xae9f8d[_0xb6e8('0x54')],[_0xb6e8('0xe7'),'id'])||{});}})[_0xb6e8('0x18')](respondWithResult(_0x255b37,null))[_0xb6e8('0x23')](handleError(_0x255b37,null));};exports[_0xb6e8('0xfa')]=function(_0x4c6a42,_0x3d8ba2){var _0x1d0287={};var _0x1956fe={};var _0x13d3e3;var _0xf8b1f6;return db[_0xb6e8('0x38')]['findOne']({'where':{'id':_0x4c6a42[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x3d8ba2,null))['then'](function(_0xa36d4a){if(_0xa36d4a){_0x13d3e3=_0xa36d4a;_0x1956fe[_0xb6e8('0x40')]=_[_0xb6e8('0x3d')](db[_0xb6e8('0x11c')][_0xb6e8('0x39')]);_0x1956fe[_0xb6e8('0x3c')]=_['keys'](_0x4c6a42[_0xb6e8('0x3c')]);_0x1956fe['filters']=_[_0xb6e8('0x3f')](_0x1956fe[_0xb6e8('0x40')],_0x1956fe['query']);_0x1d0287['attributes']=_[_0xb6e8('0x3f')](_0x1956fe['model'],qs[_0xb6e8('0x42')](_0x4c6a42[_0xb6e8('0x3c')][_0xb6e8('0x42')]));_0x1d0287[_0xb6e8('0x41')]=_0x1d0287[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x1d0287['attributes']:_0x1956fe[_0xb6e8('0x40')];_0x1d0287[_0xb6e8('0x45')]=qs['sort'](_0x4c6a42['query']['sort']);_0x1d0287[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x4c6a42[_0xb6e8('0x3c')],_0x1956fe[_0xb6e8('0x3e')]));if(_0x4c6a42[_0xb6e8('0x3c')][_0xb6e8('0x49')]){_0x1d0287[_0xb6e8('0x47')]=_[_0xb6e8('0x4a')](_0x1d0287[_0xb6e8('0x47')],{'$or':_['map'](_0x1d0287['attributes'],function(_0x1adf33){var _0x385990={};_0x385990[_0x1adf33]={'$like':'%'+_0x4c6a42[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x385990;})});}_0x1d0287=_['merge']({},_0x1d0287,_0x4c6a42[_0xb6e8('0x4b')]);return _0x13d3e3['getProactiveActions'](_0x1d0287);}})['then'](function(_0x36ee7e){if(_0x36ee7e){_0xf8b1f6=_0x36ee7e[_0xb6e8('0x52')];if(!_0x4c6a42['query'][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x1d0287['limit']=qs[_0xb6e8('0x29')](_0x4c6a42[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x1d0287[_0xb6e8('0x2b')]=qs[_0xb6e8('0x2b')](_0x4c6a42[_0xb6e8('0x3c')]['offset']);}return _0x13d3e3[_0xb6e8('0xfa')](_0x1d0287);}})['then'](function(_0x5bc1f3){if(_0x5bc1f3){return _0x5bc1f3?{'count':_0xf8b1f6,'rows':_0x5bc1f3}:null;}})['then'](respondWithResult(_0x3d8ba2,null))['catch'](handleError(_0x3d8ba2,null));};exports[_0xb6e8('0x11d')]=function(_0x20c915,_0x5ab843){var _0x52c99d=_0x20c915[_0xb6e8('0x3c')][_0xb6e8('0x11e')]===_0xb6e8('0x11f')?_0xb6e8('0x120'):_0xb6e8('0x121');return db[_0xb6e8('0x38')]['find']({'attributes':['id',_0x52c99d],'where':{'id':_0x20c915[_0xb6e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ab843,null))['then'](function(_0x119f35){if(_0x119f35){var _0x312791=_0x119f35[_0x52c99d];var _0x4f9635=_0x312791&&_0x312791[_0xb6e8('0x122')]?_0x312791[_0xb6e8('0x122')]:[];_0x5ab843['send']({'fromKey':_[_0xb6e8('0x76')](_0x312791[_0xb6e8('0x123')])?undefined:_0x312791[_0xb6e8('0x123')],'count':_0x4f9635[_0xb6e8('0x52')],'rows':_0x4f9635});}})[_0xb6e8('0x23')](handleError(_0x5ab843,null));};exports['getOfflineMessages']=function(_0x3224c,_0x458840){var _0x5b0266={'raw':![],'where':{}};var _0x4a2a6f={};var _0x6c6e24={'count':0x0,'rows':[]};return db[_0xb6e8('0x38')]['findOne']({'where':{'id':_0x3224c[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x458840,null))[_0xb6e8('0x18')](function(_0x42ab97){if(_0x42ab97){_0x4a2a6f[_0xb6e8('0x40')]=_[_0xb6e8('0x3d')](db['ChatOfflineMessage'][_0xb6e8('0x39')]);_0x4a2a6f[_0xb6e8('0x3c')]=_[_0xb6e8('0x3d')](_0x3224c[_0xb6e8('0x3c')]);_0x4a2a6f[_0xb6e8('0x3e')]=_['intersection'](_0x4a2a6f['model'],_0x4a2a6f['query']);_0x5b0266[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x4a2a6f[_0xb6e8('0x40')],qs['fields'](_0x3224c['query'][_0xb6e8('0x42')]));_0x5b0266[_0xb6e8('0x41')]=_0x5b0266[_0xb6e8('0x41')]['length']?_0x5b0266[_0xb6e8('0x41')]:_0x4a2a6f[_0xb6e8('0x40')];if(!_0x3224c[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x5b0266['limit']=qs[_0xb6e8('0x29')](_0x3224c[_0xb6e8('0x3c')][_0xb6e8('0x29')]);_0x5b0266['offset']=qs['offset'](_0x3224c[_0xb6e8('0x3c')][_0xb6e8('0x2b')]);}_0x5b0266[_0xb6e8('0x45')]=qs[_0xb6e8('0x46')](_0x3224c['query'][_0xb6e8('0x46')]);_0x5b0266[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x3224c[_0xb6e8('0x3c')],_0x4a2a6f[_0xb6e8('0x3e')]));_0x5b0266[_0xb6e8('0x47')][_0xb6e8('0x5d')]=_0x42ab97['id'];if(_0x3224c[_0xb6e8('0x3c')]['filter']){_0x5b0266[_0xb6e8('0x47')]=_['merge'](_0x5b0266['where'],{'$or':_[_0xb6e8('0x37')](_0x5b0266[_0xb6e8('0x41')],function(_0x10fff1){var _0x1b8393={};_0x1b8393[_0x10fff1]={'$like':'%'+_0x3224c[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x1b8393;})});}_0x5b0266=_[_0xb6e8('0x4a')]({},_0x5b0266,_0x3224c['options']);return db[_0xb6e8('0x124')]['count']({'where':_0x5b0266[_0xb6e8('0x47')]})['then'](function(_0x59a3d5){_0x6c6e24[_0xb6e8('0x2a')]=_0x59a3d5;if(_0x3224c['query'][_0xb6e8('0x4c')]){_0x5b0266[_0xb6e8('0x4d')]=[{'all':!![]}];}else{_0x5b0266[_0xb6e8('0x4d')]=[{'model':db[_0xb6e8('0x84')],'as':_0xb6e8('0x125'),'required':![]},{'model':db[_0xb6e8('0xd1')],'as':_0xb6e8('0x126'),'required':![]}];}return db[_0xb6e8('0x124')][_0xb6e8('0x60')](_0x5b0266);})[_0xb6e8('0x18')](function(_0x23a429){_0x6c6e24[_0xb6e8('0x4e')]=_0x23a429;return _0x6c6e24;});}})[_0xb6e8('0x18')](respondWithFilteredResult(_0x458840,_0x5b0266))[_0xb6e8('0x23')](handleError(_0x458840,null));};exports[_0xb6e8('0x127')]=function(_0x3cd318,_0x5258a5){return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x3cd318['params']['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x5258a5,null))['then'](function(_0x29c76c){if(_0x29c76c){return _0x29c76c['addAgents'](_0x3cd318[_0xb6e8('0x54')]['ids'],_[_0xb6e8('0x11b')](_0x3cd318[_0xb6e8('0x54')],[_0xb6e8('0xe7'),'id'])||{})[_0xb6e8('0xaf')](function(_0x26ae45){for(var _0x528e9e=0x0;_0x528e9e<_0x3cd318[_0xb6e8('0x54')][_0xb6e8('0xe7')][_0xb6e8('0x52')];_0x528e9e+=0x1){socket[_0xb6e8('0x128')](_0xb6e8('0x129'),{'UserId':Number(_0x3cd318[_0xb6e8('0x54')][_0xb6e8('0xe7')][_0x528e9e]),'ChatWebsiteId':Number(_0x3cd318['params']['id'])});}return _0x26ae45;});}})[_0xb6e8('0x18')](respondWithResult(_0x5258a5,null))[_0xb6e8('0x23')](handleError(_0x5258a5,null));};exports['removeAgents']=function(_0x50510d,_0x46167a){return db[_0xb6e8('0x38')][_0xb6e8('0x58')]({'where':{'id':_0x50510d[_0xb6e8('0x50')]['id']}})[_0xb6e8('0x18')](handleEntityNotFound(_0x46167a,null))['then'](function(_0x35f988){if(_0x35f988){return _0x35f988[_0xb6e8('0x12a')](_0x50510d[_0xb6e8('0x3c')][_0xb6e8('0xe7')])[_0xb6e8('0x18')](function(){if(_['isArray'](_0x50510d[_0xb6e8('0x3c')][_0xb6e8('0xe7')])){for(var _0x420014=0x0;_0x420014<_0x50510d['query']['ids'][_0xb6e8('0x52')];_0x420014+=0x1){socket[_0xb6e8('0x128')](_0xb6e8('0x12b'),{'UserId':Number(_0x50510d[_0xb6e8('0x3c')][_0xb6e8('0xe7')][_0x420014]),'ChatWebsiteId':Number(_0x50510d['params']['id'])});}}else{socket[_0xb6e8('0x128')](_0xb6e8('0x12b'),{'UserId':Number(_0x50510d[_0xb6e8('0x3c')]['ids']),'ChatWebsiteId':Number(_0x50510d[_0xb6e8('0x50')]['id'])});}});}})[_0xb6e8('0x18')](respondWithStatusCode(_0x46167a,null))[_0xb6e8('0x23')](handleError(_0x46167a,null));};exports[_0xb6e8('0x12c')]=function(_0x336f98,_0x51237a){var _0x2c5166={};var _0x3f070c={};var _0x488073;var _0x114250;return db['ChatWebsite'][_0xb6e8('0x5e')]({'where':{'id':_0x336f98['params']['id']}})['then'](handleEntityNotFound(_0x51237a,null))[_0xb6e8('0x18')](function(_0x5a3ed4){if(_0x5a3ed4){_0x488073=_0x5a3ed4;_0x3f070c[_0xb6e8('0x40')]=_[_0xb6e8('0x3d')](db[_0xb6e8('0xb8')][_0xb6e8('0x39')]);_0x3f070c[_0xb6e8('0x3c')]=_['keys'](_0x336f98[_0xb6e8('0x3c')]);_0x3f070c['filters']=_[_0xb6e8('0x3f')](_0x3f070c[_0xb6e8('0x40')],_0x3f070c[_0xb6e8('0x3c')]);_0x2c5166[_0xb6e8('0x41')]=_[_0xb6e8('0x3f')](_0x3f070c[_0xb6e8('0x40')],qs[_0xb6e8('0x42')](_0x336f98[_0xb6e8('0x3c')][_0xb6e8('0x42')]));_0x2c5166[_0xb6e8('0x41')]=_0x2c5166[_0xb6e8('0x41')][_0xb6e8('0x52')]?_0x2c5166[_0xb6e8('0x41')]:_0x3f070c['model'];_0x2c5166[_0xb6e8('0x45')]=qs[_0xb6e8('0x46')](_0x336f98[_0xb6e8('0x3c')][_0xb6e8('0x46')]);_0x2c5166[_0xb6e8('0x47')]=qs[_0xb6e8('0x3e')](_[_0xb6e8('0x48')](_0x336f98[_0xb6e8('0x3c')],_0x3f070c[_0xb6e8('0x3e')]));if(_0x336f98[_0xb6e8('0x3c')]['filter']){_0x2c5166[_0xb6e8('0x47')]=_[_0xb6e8('0x4a')](_0x2c5166[_0xb6e8('0x47')],{'$or':_[_0xb6e8('0x37')](_0x2c5166[_0xb6e8('0x41')],function(_0x885e7d){var _0x3c885e={};_0x3c885e[_0x885e7d]={'$like':'%'+_0x336f98[_0xb6e8('0x3c')][_0xb6e8('0x49')]+'%'};return _0x3c885e;})});}_0x2c5166=_['merge']({},_0x2c5166,_0x336f98[_0xb6e8('0x4b')]);return _0x488073[_0xb6e8('0x12c')](_0x2c5166);}})[_0xb6e8('0x18')](function(_0x2551a2){if(_0x2551a2){_0x114250=_0x2551a2['length'];if(!_0x336f98[_0xb6e8('0x3c')][_0xb6e8('0x43')](_0xb6e8('0x44'))){_0x2c5166[_0xb6e8('0x29')]=qs['limit'](_0x336f98['query']['limit']);_0x2c5166[_0xb6e8('0x2b')]=qs[_0xb6e8('0x2b')](_0x336f98['query']['offset']);}return _0x488073['getAgents'](_0x2c5166);}})[_0xb6e8('0x18')](function(_0x29a014){if(_0x29a014){return _0x29a014?{'count':_0x114250,'rows':_0x29a014}:null;}})[_0xb6e8('0x18')](respondWithResult(_0x51237a,null))[_0xb6e8('0x23')](handleError(_0x51237a,null));}; \ No newline at end of file +var _0x89cd=['List','Contacts','ChatApplication','Applications','account','list','applications','orderBy','asc','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','offline-chat','basename','openNewInteraction','transaction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','sendMail','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','Contact','fullname','internal','Tag','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getLicense','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','origin','remote','x-real-ip','connection','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','getApplications','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','then','info','ChatWebsite,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','get','UserProfileResource','stack','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','includeAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','existsSync','user-agent-parser','setUA','headers','getResult','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x380252,_0x3133e2){var _0x5d1330=function(_0x33433e){while(--_0x33433e){_0x380252['push'](_0x380252['shift']());}};_0x5d1330(++_0x3133e2);}(_0x89cd,0x99));var _0xd89c=function(_0x12914e,_0x5ef4d0){_0x12914e=_0x12914e-0x0;var _0x5001d4=_0x89cd[_0x12914e];return _0x5001d4;};'use strict';var BPromise=require(_0xd89c('0x0'));var Mustache=require(_0xd89c('0x1'));var util=require(_0xd89c('0x2'));var path=require(_0xd89c('0x3'));var ejs=require(_0xd89c('0x4'));var fs=require('fs');var fs_extra=require(_0xd89c('0x5'));var _=require(_0xd89c('0x6'));var querystring=require(_0xd89c('0x7'));var Redis=require(_0xd89c('0x8'));var qs=require(_0xd89c('0x9'));var logger=require(_0xd89c('0xa'))('api');var config=require(_0xd89c('0xb'));var url=require(_0xd89c('0xc'));var db=require('../../mysqldb')['db'];config[_0xd89c('0xd')]=_[_0xd89c('0xe')](config[_0xd89c('0xd')],{'host':_0xd89c('0xf'),'port':0x18eb});var socket=require(_0xd89c('0x10'))(new Redis(config[_0xd89c('0xd')]));require('./chatWebsite.socket')[_0xd89c('0x11')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xd89c('0x12'));var client=jayson['client'][_0xd89c('0x13')]({'port':0x232c});var client9002=jayson[_0xd89c('0x14')][_0xd89c('0x13')]({'port':0x232a});var client9003=jayson[_0xd89c('0x14')]['http']({'port':0x232b});var client9001=jayson[_0xd89c('0x14')][_0xd89c('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x50f6ed,_0xcbc284,_0x2850,_0x1c6ec8){return new BPromise(function(_0x5b630b,_0x24bbe7){var _0x5b834d=_0x1c6ec8||client;return _0x5b834d['request'](_0x50f6ed,_0x2850)[_0xd89c('0x15')](function(_0x4a2013){logger[_0xd89c('0x16')](_0xd89c('0x17'),_0xcbc284,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xcbc284,'request\x20sent',JSON[_0xd89c('0x18')](_0x4a2013));if(_0x4a2013[_0xd89c('0x19')]){if(_0x4a2013[_0xd89c('0x19')][_0xd89c('0x1a')]===0x1f4){logger[_0xd89c('0x19')]('ChatWebsite,\x20%s,\x20%s',_0xcbc284,_0x4a2013[_0xd89c('0x19')][_0xd89c('0x1b')]);return _0x24bbe7(_0x4a2013[_0xd89c('0x19')][_0xd89c('0x1b')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xcbc284,_0x4a2013[_0xd89c('0x19')][_0xd89c('0x1b')]);return _0x5b630b(_0x4a2013[_0xd89c('0x19')][_0xd89c('0x1b')]);}else{logger[_0xd89c('0x16')](_0xd89c('0x17'),_0xcbc284,'request\x20sent');_0x5b630b(_0x4a2013[_0xd89c('0x1c')]['message']);}})['catch'](function(_0x421626){logger[_0xd89c('0x19')]('ChatWebsite,\x20%s,\x20%s',_0xcbc284,_0x421626);_0x24bbe7(_0x421626);});});}function respondWithStatusCode(_0xad8807,_0x85ebbd){_0x85ebbd=_0x85ebbd||0xcc;return function(_0x2da5d9){if(_0x2da5d9){return _0xad8807[_0xd89c('0x1d')](_0x85ebbd);}return _0xad8807[_0xd89c('0x1e')](_0x85ebbd)[_0xd89c('0x1f')]();};}function respondWithResult(_0x448aa4,_0x444812){_0x444812=_0x444812||0xc8;return function(_0x16e6ab){if(_0x16e6ab){return _0x448aa4[_0xd89c('0x1e')](_0x444812)[_0xd89c('0x20')](_0x16e6ab);}};}function respondWithFilteredResult(_0x800be3,_0x2e4c94){return function(_0x202dbc){if(_0x202dbc){var _0x1b9609=typeof _0x2e4c94['offset']===_0xd89c('0x21')&&typeof _0x2e4c94[_0xd89c('0x22')]===_0xd89c('0x21');var _0x11f544=_0x202dbc[_0xd89c('0x23')];var _0x2003ed=_0x1b9609?0x0:_0x2e4c94[_0xd89c('0x24')];var _0x724128=_0x1b9609?_0x202dbc[_0xd89c('0x23')]:_0x2e4c94['offset']+_0x2e4c94[_0xd89c('0x22')];var _0x445d54;if(_0x724128>=_0x11f544){_0x724128=_0x11f544;_0x445d54=0xc8;}else{_0x445d54=0xce;}_0x800be3[_0xd89c('0x1e')](_0x445d54);return _0x800be3['set'](_0xd89c('0x25'),_0x2003ed+'-'+_0x724128+'/'+_0x11f544)[_0xd89c('0x20')](_0x202dbc);}return null;};}function saveUpdates(_0x161c43){return function(_0x4de443){if(_0x4de443){return _0x4de443[_0xd89c('0x26')](_0x161c43)[_0xd89c('0x15')](function(_0xc85c33){return _0xc85c33;});}return null;};}function removeEntity(_0x250695){return function(_0x14a73c){if(_0x14a73c){return _0x14a73c[_0xd89c('0x27')]()[_0xd89c('0x15')](function(){var _0x178255=_0x14a73c[_0xd89c('0x28')]({'plain':!![]});var _0x41762d='ChatWebsites';return db[_0xd89c('0x29')][_0xd89c('0x27')]({'where':{'type':_0x41762d,'resourceId':_0x178255['id']}})[_0xd89c('0x15')](function(){return _0x14a73c;});})[_0xd89c('0x15')](function(){_0x250695[_0xd89c('0x1e')](0xcc)[_0xd89c('0x1f')]();});}};}function handleEntityNotFound(_0x3a1089){return function(_0xe411b3){if(!_0xe411b3){_0x3a1089[_0xd89c('0x1d')](0x194);}return _0xe411b3;};}function handleError(_0x26c329,_0x4a7ec3){_0x4a7ec3=_0x4a7ec3||0x1f4;return function(_0x495218){logger['error'](_0x495218[_0xd89c('0x2a')]);if(_0x495218['name']){delete _0x495218['name'];}_0x26c329[_0xd89c('0x1e')](_0x4a7ec3)['send'](_0x495218);};}exports['index']=function(_0x40276b,_0x17aefd){var _0x5e78e6={'include':[{'model':db[_0xd89c('0x2b')],'as':_0xd89c('0x2c')}]},_0x1b49da={},_0x441a05={'count':0x0,'rows':[]};var _0x4a3503=_['map'](db[_0xd89c('0x2d')][_0xd89c('0x2e')],function(_0xac3ccf){return{'name':_0xac3ccf[_0xd89c('0x2f')],'type':_0xac3ccf[_0xd89c('0x30')][_0xd89c('0x31')]};});_0x1b49da[_0xd89c('0x32')]=_[_0xd89c('0x33')](_0x4a3503,_0xd89c('0x34'));_0x1b49da['query']=_[_0xd89c('0x35')](_0x40276b[_0xd89c('0x36')]);_0x1b49da[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x1b49da[_0xd89c('0x32')],_0x1b49da[_0xd89c('0x36')]);_0x5e78e6[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x1b49da[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x40276b[_0xd89c('0x36')]['fields']));_0x5e78e6[_0xd89c('0x39')]=_0x5e78e6[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x5e78e6[_0xd89c('0x39')]:_0x1b49da[_0xd89c('0x32')];if(!_0x40276b[_0xd89c('0x36')]['hasOwnProperty'](_0xd89c('0x3c'))){_0x5e78e6['limit']=qs[_0xd89c('0x22')](_0x40276b[_0xd89c('0x36')]['limit']);_0x5e78e6[_0xd89c('0x24')]=qs['offset'](_0x40276b[_0xd89c('0x36')][_0xd89c('0x24')]);}_0x5e78e6[_0xd89c('0x3d')]=qs[_0xd89c('0x3e')](_0x40276b[_0xd89c('0x36')][_0xd89c('0x3e')]);_0x5e78e6[_0xd89c('0x3f')]=qs['filters'](_[_0xd89c('0x40')](_0x40276b[_0xd89c('0x36')],_0x1b49da[_0xd89c('0x37')]),_0x4a3503);if(_0x40276b['query'][_0xd89c('0x41')]){_0x5e78e6[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x5e78e6['where'],{'$or':_[_0xd89c('0x33')](_0x4a3503,function(_0x7688df){if(_0x7688df[_0xd89c('0x30')]!==_0xd89c('0x43')){var _0x2bd331={};_0x2bd331[_0x7688df[_0xd89c('0x34')]]={'$like':'%'+_0x40276b[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x2bd331;}})});}_0x5e78e6=_['merge']({},_0x5e78e6,_0x40276b[_0xd89c('0x44')]);var _0x1e6fcf={'where':_0x5e78e6['where']};return db[_0xd89c('0x2d')][_0xd89c('0x23')](_0x1e6fcf)[_0xd89c('0x15')](function(_0x42eaf0){_0x441a05[_0xd89c('0x23')]=_0x42eaf0;if(_0x40276b['query']['includeAll']){_0x5e78e6['include']=[{'all':!![]}];}return db[_0xd89c('0x2d')][_0xd89c('0x45')](_0x5e78e6);})['then'](function(_0x15e208){_0x441a05['rows']=_0x15e208;return _0x441a05;})[_0xd89c('0x15')](respondWithFilteredResult(_0x17aefd,_0x5e78e6))[_0xd89c('0x46')](handleError(_0x17aefd,null));};exports[_0xd89c('0x47')]=function(_0x4c5e48,_0xb3fb28){var _0x5631c5={'raw':![],'where':{'id':_0x4c5e48[_0xd89c('0x48')]['id']},'include':[{'model':db[_0xd89c('0x2b')],'as':_0xd89c('0x2c')}]},_0x31b094={};_0x31b094[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0x2d')][_0xd89c('0x2e')]);_0x31b094[_0xd89c('0x36')]=_['keys'](_0x4c5e48[_0xd89c('0x36')]);_0x31b094[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x31b094[_0xd89c('0x32')],_0x31b094[_0xd89c('0x36')]);_0x5631c5[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x31b094[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x4c5e48[_0xd89c('0x36')][_0xd89c('0x3a')]));_0x5631c5[_0xd89c('0x39')]=_0x5631c5[_0xd89c('0x39')]['length']?_0x5631c5['attributes']:_0x31b094[_0xd89c('0x32')];if(_0x4c5e48[_0xd89c('0x36')]['includeAll']){_0x5631c5[_0xd89c('0x49')]=[{'all':!![]}];}_0x5631c5=_[_0xd89c('0x42')]({},_0x5631c5,_0x4c5e48[_0xd89c('0x44')]);return db[_0xd89c('0x2d')][_0xd89c('0x4a')](_0x5631c5)['then'](handleEntityNotFound(_0xb3fb28,null))[_0xd89c('0x15')](respondWithResult(_0xb3fb28,null))[_0xd89c('0x46')](handleError(_0xb3fb28,null));};exports['create']=function(_0x4b9bed,_0x928c4d){return db['ChatWebsite'][_0xd89c('0x4b')](_0x4b9bed['body'],{})[_0xd89c('0x15')](function(_0x3019c9){var _0x17bd66=_0x4b9bed[_0xd89c('0x4c')]['get']({'plain':!![]});if(!_0x17bd66)throw new Error(_0xd89c('0x4d'));if(_0x17bd66['role']===_0xd89c('0x4c')){var _0x3243cf=_0x3019c9[_0xd89c('0x28')]({'plain':!![]});var _0xe24893='ChatWebsites';return db[_0xd89c('0x4e')][_0xd89c('0x4a')]({'where':{'name':_0xe24893,'userProfileId':_0x17bd66[_0xd89c('0x4f')]},'raw':!![]})[_0xd89c('0x15')](function(_0x3dc81b){if(_0x3dc81b&&_0x3dc81b[_0xd89c('0x50')]===0x0){return db[_0xd89c('0x29')]['create']({'name':_0x3243cf[_0xd89c('0x34')],'resourceId':_0x3243cf['id'],'type':_0x3dc81b[_0xd89c('0x34')],'sectionId':_0x3dc81b['id']},{})[_0xd89c('0x15')](function(){return _0x3019c9;});}else{return _0x3019c9;}})['catch'](function(_0x28a625){logger[_0xd89c('0x19')](_0xd89c('0x51'),_0x28a625);throw _0x28a625;});}return _0x3019c9;})['then'](respondWithResult(_0x928c4d,0xc9))[_0xd89c('0x46')](handleError(_0x928c4d,null));};exports[_0xd89c('0x26')]=function(_0xcf672c,_0x10d2f4){if(_0xcf672c[_0xd89c('0x52')]['id']){delete _0xcf672c['body']['id'];}return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0xcf672c['params']['id']},'include':[{'model':db[_0xd89c('0x2b')],'as':_0xd89c('0x2c')}]})[_0xd89c('0x15')](handleEntityNotFound(_0x10d2f4,null))[_0xd89c('0x15')](saveUpdates(_0xcf672c[_0xd89c('0x52')],null))[_0xd89c('0x15')](respondWithResult(_0x10d2f4,null))[_0xd89c('0x46')](handleError(_0x10d2f4,null));};exports[_0xd89c('0x27')]=function(_0x1e24d8,_0x365a7f){return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x1e24d8[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x365a7f,null))['then'](removeEntity(_0x365a7f,null))['catch'](handleError(_0x365a7f,null));};exports[_0xd89c('0x53')]=function(_0xf7d2b1,_0x1c1d1f){return db[_0xd89c('0x2d')][_0xd89c('0x53')]()[_0xd89c('0x15')](respondWithResult(_0x1c1d1f,null))[_0xd89c('0x46')](handleError(_0x1c1d1f,null));};exports[_0xd89c('0x54')]=function(_0x20b56a,_0x2b68f2){if(_0x20b56a['body']['id']){delete _0x20b56a[_0xd89c('0x52')]['id'];}return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x20b56a[_0xd89c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b68f2,null))[_0xd89c('0x15')](function(_0xfccdea){if(_0xfccdea){_0x20b56a[_0xd89c('0x52')][_0xd89c('0x55')]=_0xfccdea['id'];return db['Disposition']['create'](_0x20b56a[_0xd89c('0x52')]);}})[_0xd89c('0x15')](respondWithResult(_0x2b68f2,null))[_0xd89c('0x46')](handleError(_0x2b68f2,null));};exports['getDispositions']=function(_0x366139,_0x3929a9){var _0x5c158b={'raw':![],'where':{}};var _0x6a14c8={};var _0x3bdf3e={'count':0x0,'rows':[]};return db[_0xd89c('0x2d')]['findOne']({'where':{'id':_0x366139[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x3929a9,null))[_0xd89c('0x15')](function(_0x25779a){if(_0x25779a){_0x6a14c8[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0x56')][_0xd89c('0x2e')]);_0x6a14c8['query']=_[_0xd89c('0x35')](_0x366139[_0xd89c('0x36')]);_0x6a14c8[_0xd89c('0x37')]=_['intersection'](_0x6a14c8['model'],_0x6a14c8[_0xd89c('0x36')]);_0x5c158b[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x6a14c8[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x366139[_0xd89c('0x36')][_0xd89c('0x3a')]));_0x5c158b[_0xd89c('0x39')]=_0x5c158b[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x5c158b['attributes']:_0x6a14c8[_0xd89c('0x32')];if(!_0x366139[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x5c158b[_0xd89c('0x22')]=qs[_0xd89c('0x22')](_0x366139[_0xd89c('0x36')][_0xd89c('0x22')]);_0x5c158b['offset']=qs[_0xd89c('0x24')](_0x366139[_0xd89c('0x36')][_0xd89c('0x24')]);}_0x5c158b[_0xd89c('0x3d')]=qs[_0xd89c('0x3e')](_0x366139[_0xd89c('0x36')][_0xd89c('0x3e')]);_0x5c158b[_0xd89c('0x3f')]=qs[_0xd89c('0x37')](_[_0xd89c('0x40')](_0x366139[_0xd89c('0x36')],_0x6a14c8[_0xd89c('0x37')]));_0x5c158b[_0xd89c('0x3f')]['ChatWebsiteId']=_0x25779a['id'];if(_0x366139[_0xd89c('0x36')][_0xd89c('0x41')]){_0x5c158b[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x5c158b[_0xd89c('0x3f')],{'$or':_['map'](_0x5c158b['attributes'],function(_0x133c5e){var _0x3d23b5={};_0x3d23b5[_0x133c5e]={'$like':'%'+_0x366139[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x3d23b5;})});}_0x5c158b=_[_0xd89c('0x42')]({},_0x5c158b,_0x366139[_0xd89c('0x44')]);return db['Disposition'][_0xd89c('0x23')]({'where':_0x5c158b['where']})[_0xd89c('0x15')](function(_0x222fa1){_0x3bdf3e[_0xd89c('0x23')]=_0x222fa1;if(_0x366139['query'][_0xd89c('0x58')]){_0x5c158b['include']=[{'all':!![]}];}return db[_0xd89c('0x56')][_0xd89c('0x45')](_0x5c158b);})['then'](function(_0x968238){_0x3bdf3e[_0xd89c('0x59')]=_0x968238;return _0x3bdf3e;});}})[_0xd89c('0x15')](respondWithFilteredResult(_0x3929a9,_0x5c158b))['catch'](handleError(_0x3929a9,null));};exports[_0xd89c('0x5a')]=function(_0x20e9b0,_0x6fceb){return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x20e9b0['params']['id']}})['then'](handleEntityNotFound(_0x6fceb,null))[_0xd89c('0x15')](function(_0x4bf94a){if(_0x4bf94a){return _0x4bf94a[_0xd89c('0x5a')](_0x20e9b0[_0xd89c('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x6fceb,null))[_0xd89c('0x46')](handleError(_0x6fceb,null));};exports[_0xd89c('0x5b')]=function(_0x2683bc,_0x2e8015){if(_0x2683bc[_0xd89c('0x52')]['id']){delete _0x2683bc[_0xd89c('0x52')]['id'];}return db['ChatWebsite'][_0xd89c('0x4a')]({'where':{'id':_0x2683bc['params']['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x2e8015,null))[_0xd89c('0x15')](function(_0x4ad2ac){if(_0x4ad2ac){_0x2683bc[_0xd89c('0x52')]['ChatWebsiteId']=_0x4ad2ac['id'];return db[_0xd89c('0x5c')]['create'](_0x2683bc[_0xd89c('0x52')]);}})[_0xd89c('0x15')](respondWithResult(_0x2e8015,null))[_0xd89c('0x46')](handleError(_0x2e8015,null));};exports[_0xd89c('0x5d')]=function(_0x27495f,_0x3a4437){var _0x563284={'raw':![],'where':{}};var _0x1b3c76={};var _0x29750c={'count':0x0,'rows':[]};return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0x27495f['params']['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x3a4437,null))['then'](function(_0x12857f){if(_0x12857f){_0x1b3c76[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0x5c')][_0xd89c('0x2e')]);_0x1b3c76[_0xd89c('0x36')]=_['keys'](_0x27495f[_0xd89c('0x36')]);_0x1b3c76[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x1b3c76['model'],_0x1b3c76['query']);_0x563284[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x1b3c76[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x27495f['query'][_0xd89c('0x3a')]));_0x563284['attributes']=_0x563284[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x563284[_0xd89c('0x39')]:_0x1b3c76[_0xd89c('0x32')];if(!_0x27495f[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x563284['limit']=qs['limit'](_0x27495f[_0xd89c('0x36')][_0xd89c('0x22')]);_0x563284[_0xd89c('0x24')]=qs[_0xd89c('0x24')](_0x27495f[_0xd89c('0x36')][_0xd89c('0x24')]);}_0x563284[_0xd89c('0x3d')]=qs[_0xd89c('0x3e')](_0x27495f['query'][_0xd89c('0x3e')]);_0x563284[_0xd89c('0x3f')]=qs[_0xd89c('0x37')](_[_0xd89c('0x40')](_0x27495f['query'],_0x1b3c76['filters']));_0x563284['where'][_0xd89c('0x55')]=_0x12857f['id'];if(_0x27495f['query'][_0xd89c('0x41')]){_0x563284[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x563284[_0xd89c('0x3f')],{'$or':_[_0xd89c('0x33')](_0x563284[_0xd89c('0x39')],function(_0x3ae0a2){var _0x4f3980={};_0x4f3980[_0x3ae0a2]={'$like':'%'+_0x27495f[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x4f3980;})});}_0x563284=_[_0xd89c('0x42')]({},_0x563284,_0x27495f[_0xd89c('0x44')]);return db[_0xd89c('0x5c')][_0xd89c('0x23')]({'where':_0x563284[_0xd89c('0x3f')]})[_0xd89c('0x15')](function(_0x3d3dda){_0x29750c['count']=_0x3d3dda;if(_0x27495f['query'][_0xd89c('0x58')]){_0x563284[_0xd89c('0x49')]=[{'all':!![]}];}return db[_0xd89c('0x5c')]['findAll'](_0x563284);})[_0xd89c('0x15')](function(_0x20dc80){_0x29750c[_0xd89c('0x59')]=_0x20dc80;return _0x29750c;});}})[_0xd89c('0x15')](respondWithFilteredResult(_0x3a4437,_0x563284))['catch'](handleError(_0x3a4437,null));};exports[_0xd89c('0x5f')]=function(_0x309514,_0x99d411){return db[_0xd89c('0x2d')]['find']({'where':{'id':_0x309514['params']['id']}})['then'](handleEntityNotFound(_0x99d411,null))[_0xd89c('0x15')](function(_0x2a4edb){if(_0x2a4edb){return _0x2a4edb[_0xd89c('0x5f')](_0x309514[_0xd89c('0x36')]['ids']);}})[_0xd89c('0x15')](respondWithStatusCode(_0x99d411,null))[_0xd89c('0x46')](handleError(_0x99d411,null));};exports[_0xd89c('0x60')]=function(_0x5e7098,_0x36e039){_0x5e7098[_0xd89c('0x52')][_0xd89c('0x61')]=_0x5e7098[_0xd89c('0x62')][_0xd89c('0x63')];return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x5e7098['params']['id']}})['then'](handleEntityNotFound(_0x36e039,null))[_0xd89c('0x15')](saveUpdates(_0x5e7098['body'],null))['then'](respondWithResult(_0x36e039,null))[_0xd89c('0x46')](handleError(_0x36e039,null));};exports[_0xd89c('0x64')]=function(_0x1ccd8a,_0x192a63){_0x1ccd8a[_0xd89c('0x52')][_0xd89c('0x65')]=_0x1ccd8a[_0xd89c('0x62')][_0xd89c('0x63')];return db['ChatWebsite'][_0xd89c('0x4a')]({'where':{'id':_0x1ccd8a[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x192a63,null))[_0xd89c('0x15')](saveUpdates(_0x1ccd8a[_0xd89c('0x52')],null))['then'](respondWithResult(_0x192a63,null))['catch'](handleError(_0x192a63,null));};exports[_0xd89c('0x66')]=function(_0x456857,_0x1cde0b){_0x456857[_0xd89c('0x52')]['customerAvatar']=_0x456857['file'][_0xd89c('0x63')];return db['ChatWebsite'][_0xd89c('0x4a')]({'where':{'id':_0x456857[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x1cde0b,null))[_0xd89c('0x15')](saveUpdates(_0x456857[_0xd89c('0x52')],null))[_0xd89c('0x15')](respondWithResult(_0x1cde0b,null))[_0xd89c('0x46')](handleError(_0x1cde0b,null));};exports[_0xd89c('0x67')]=function(_0x940d0,_0x24aaca){_0x940d0[_0xd89c('0x52')][_0xd89c('0x68')]=_0x940d0[_0xd89c('0x62')][_0xd89c('0x63')];return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x940d0['params']['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x24aaca,null))[_0xd89c('0x15')](saveUpdates(_0x940d0[_0xd89c('0x52')],null))[_0xd89c('0x15')](respondWithResult(_0x24aaca,null))[_0xd89c('0x46')](handleError(_0x24aaca,null));};exports[_0xd89c('0x69')]=function(_0x5a5954,_0x3f19a2){var _0x54e048=path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],_0xd89c('0x6c'));var _0x129416={'where':{'id':_0x5a5954[_0xd89c('0x48')]['id']},'attributes':['id',_0xd89c('0x61')],'raw':!![]};var _0x348da5=![];return require(_0xd89c('0x6d'))['getLicense']()[_0xd89c('0x15')](function(_0x1be461){if(_0x1be461){_0x348da5=_0x1be461[_0xd89c('0x6e')];}})[_0xd89c('0x15')](function(){return db[_0xd89c('0x2d')]['find'](_0x129416);})[_0xd89c('0x15')](handleEntityNotFound(_0x3f19a2,null))[_0xd89c('0x15')](function(_0x31b059){if(_0x31b059){if(!_[_0xd89c('0x6f')](_0x31b059[_0xd89c('0x61')])){if(fs['existsSync'](path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],_0xd89c('0x70'),_0x31b059[_0xd89c('0x61')]))&&_0x348da5){_0x54e048=path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],_0xd89c('0x70'),_0x31b059[_0xd89c('0x61')]);}}return _0x3f19a2[_0xd89c('0x71')](_0x54e048);}})[_0xd89c('0x46')](handleError(_0x3f19a2,null));};exports[_0xd89c('0x72')]=function(_0x57c385,_0x53e2f9){var _0x38dff5=path[_0xd89c('0x6a')](config['root'],_0xd89c('0x73'));var _0x1b9d94={'where':{'id':_0x57c385[_0xd89c('0x48')]['id']},'attributes':['id',_0xd89c('0x65')],'raw':!![]};return db[_0xd89c('0x2d')]['find'](_0x1b9d94)['then'](handleEntityNotFound(_0x53e2f9,null))[_0xd89c('0x15')](function(_0x1a0e34){if(_0x1a0e34){if(!_[_0xd89c('0x6f')](_0x1a0e34['agentAvatar'])){if(fs['existsSync'](path[_0xd89c('0x6a')](config['root'],_0xd89c('0x74'),_0x1a0e34[_0xd89c('0x65')]))){_0x38dff5=path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],_0xd89c('0x74'),_0x1a0e34[_0xd89c('0x65')]);}}return _0x53e2f9['download'](_0x38dff5);}})[_0xd89c('0x46')](handleError(_0x53e2f9,null));};exports[_0xd89c('0x75')]=function(_0xb38f60,_0x4559fb){var _0x35f3c9=path['join'](config[_0xd89c('0x6b')],_0xd89c('0x76'));var _0x12876a={'where':{'id':_0xb38f60['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xd89c('0x2d')][_0xd89c('0x4a')](_0x12876a)['then'](handleEntityNotFound(_0x4559fb,null))[_0xd89c('0x15')](function(_0x2bfad7){if(_0x2bfad7){if(!_[_0xd89c('0x6f')](_0x2bfad7[_0xd89c('0x77')])){if(fs['existsSync'](path['join'](config[_0xd89c('0x6b')],_0xd89c('0x74'),_0x2bfad7['customerAvatar']))&&_0x2bfad7[_0xd89c('0x78')]){_0x35f3c9=path['join'](config[_0xd89c('0x6b')],'server/files/images/avatars/',_0x2bfad7[_0xd89c('0x77')]);}}return _0x4559fb[_0xd89c('0x71')](_0x35f3c9);}})[_0xd89c('0x46')](handleError(_0x4559fb,null));};exports['getSystemAvatar']=function(_0x14876a,_0x424bbd){var _0x4e8d77=path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x521732={'where':{'id':_0x14876a[_0xd89c('0x48')]['id']},'attributes':['id',_0xd89c('0x68')],'raw':!![]};return db['ChatWebsite'][_0xd89c('0x4a')](_0x521732)[_0xd89c('0x15')](handleEntityNotFound(_0x424bbd,null))[_0xd89c('0x15')](function(_0x754d47){if(_0x754d47){if(!_['isNil'](_0x754d47[_0xd89c('0x68')])){if(fs[_0xd89c('0x79')](path[_0xd89c('0x6a')](config[_0xd89c('0x6b')],_0xd89c('0x74'),_0x754d47[_0xd89c('0x68')]))){_0x4e8d77=path['join'](config[_0xd89c('0x6b')],_0xd89c('0x74'),_0x754d47['systemAvatar']);}}return _0x424bbd[_0xd89c('0x71')](_0x4e8d77);}})['catch'](handleError(_0x424bbd,null));};exports['notify']=function(_0x2447d2,_0x1f867d){var _0x1785b5=require(_0xd89c('0x7a'));var _0x563756=new _0x1785b5();var _0x516740=_0x563756[_0xd89c('0x7b')](_0x2447d2[_0xd89c('0x7c')]['user-agent'])[_0xd89c('0x7d')]();var _0x521adc={'body':_0x2447d2[_0xd89c('0x52')],'channel':'chat'};var _0x243cc9=[];var _0x8fc05d=[];var _0x20b593={};var _0x2768c4=![];return db[_0xd89c('0x7e')][_0xd89c('0x53')]()[_0xd89c('0x15')](function(_0x3834c1){if(!_0x3834c1){throw new db[(_0xd89c('0x7f'))][(_0xd89c('0x80'))]('no\x20available\x20attributes');}_0x243cc9=_[_0xd89c('0x81')](_[_0xd89c('0x35')](_0x3834c1),['createdAt',_0xd89c('0x82')]);_0x8fc05d=_[_0xd89c('0x81')](_[_0xd89c('0x35')](_0x3834c1),[_0xd89c('0x83'),'updatedAt',_0xd89c('0x84'),_0xd89c('0x85')]);if(_0x2447d2['body']['id']){delete _0x2447d2[_0xd89c('0x52')]['id'];}if(_[_0xd89c('0x6f')](_0x2447d2[_0xd89c('0x52')][_0xd89c('0x86')])){throw new db[(_0xd89c('0x7f'))][(_0xd89c('0x80'))](_0xd89c('0x87'));}if(_['isNil'](_0x2447d2[_0xd89c('0x52')][_0xd89c('0x52')])||_0x2447d2['body'][_0xd89c('0x52')]===''){throw new db[(_0xd89c('0x7f'))]['ValidationError'](_0xd89c('0x88'));}if(_['isNil'](_0x2447d2[_0xd89c('0x52')][_0xd89c('0x89')])){throw new db[(_0xd89c('0x7f'))][(_0xd89c('0x80'))](_0xd89c('0x8a')+_0x8fc05d);}if(!_[_0xd89c('0x8b')](_0x8fc05d,_0x2447d2[_0xd89c('0x52')][_0xd89c('0x89')])){throw new db[(_0xd89c('0x7f'))][(_0xd89c('0x80'))](_0xd89c('0x8c')+_0x8fc05d);}_0x20b593[_0x2447d2[_0xd89c('0x52')][_0xd89c('0x89')]]=_0x2447d2[_0xd89c('0x52')][_0xd89c('0x86')];})[_0xd89c('0x15')](function(){return db[_0xd89c('0x2d')]['find']({'where':{'id':_0x2447d2[_0xd89c('0x48')]['id']},'include':[{'model':db[_0xd89c('0x8d')],'as':_0xd89c('0x8e'),'include':[{'model':db[_0xd89c('0x7e')],'as':_0xd89c('0x8f'),'where':_0x20b593,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xd89c('0x90')],'as':_0xd89c('0x91')}]});})[_0xd89c('0x15')](handleEntityNotFound(_0x1f867d,null))[_0xd89c('0x15')](function(_0x207399){if(_0x207399&&_0x207399[_0xd89c('0x8e')]){_0x521adc[_0xd89c('0x92')]=_0x207399;_0x521adc['applications']=_0x207399[_0xd89c('0x91')];_0x521adc[_0xd89c('0x93')]=_0x207399[_0xd89c('0x8e')];_0x521adc[_0xd89c('0x94')]=_[_0xd89c('0x95')](_0x521adc[_0xd89c('0x94')],['priority'],[_0xd89c('0x96')]);if(_0x521adc['account'][_0xd89c('0x91')]){delete _0x521adc[_0xd89c('0x92')][_0xd89c('0x91')];}if(_0x521adc[_0xd89c('0x92')][_0xd89c('0x8e')]&&_0x521adc[_0xd89c('0x92')]['List'][_0xd89c('0x8f')][_0xd89c('0x3b')]){return _0x521adc[_0xd89c('0x92')][_0xd89c('0x8e')]['Contacts'][0x0];}var _0x4c8c22=_[_0xd89c('0xe')](_0x2447d2['body'],{'firstName':_0x2447d2[_0xd89c('0x52')][_0xd89c('0x86')],'ListId':_0x207399[_0xd89c('0x85')]});_0x4c8c22[_0x2447d2[_0xd89c('0x52')][_0xd89c('0x89')]]=_0x2447d2[_0xd89c('0x52')]['from'];return db[_0xd89c('0x7e')][_0xd89c('0x4b')](_0x4c8c22,{'fields':_0x243cc9,'raw':!![]});}})[_0xd89c('0x15')](handleEntityNotFound(_0x1f867d,null))[_0xd89c('0x15')](function(_0x3121c0){_0x521adc[_0xd89c('0x97')]=_0x3121c0;var _0x8270e7=_0x2447d2[_0xd89c('0x52')]['customerIp'];if(_0x2447d2[_0xd89c('0x7c')][_0xd89c('0x98')]){_0x8270e7=_0x2447d2[_0xd89c('0x7c')][_0xd89c('0x98')];}else if(_0x2447d2[_0xd89c('0x7c')][_0xd89c('0x99')]){_0x8270e7=_['first'](_0x2447d2[_0xd89c('0x7c')][_0xd89c('0x99')][_0xd89c('0x9a')](','));}if(_0x3121c0){var _0x1a1b00={'ContactId':_0x3121c0['id'],'ChatWebsiteId':_0x2447d2[_0xd89c('0x48')]['id'],'from':(_0x3121c0[_0xd89c('0x9b')]||'')+'\x20'+(_0x3121c0[_0xd89c('0x9c')]||''),'customerIp':_0x8270e7,'customerPort':_0x2447d2[_0xd89c('0x7c')][_0xd89c('0x9d')]?_0x2447d2['headers'][_0xd89c('0x9d')]:null,'referer':_0x2447d2[_0xd89c('0x52')][_0xd89c('0x9e')],'browserName':_0x516740[_0xd89c('0x9f')][_0xd89c('0x34')]&&_0x516740[_0xd89c('0x9f')][_0xd89c('0xa0')]?util[_0xd89c('0xa1')]('%s\x20%s',_0x516740[_0xd89c('0x9f')]['name'],_0x516740['browser'][_0xd89c('0xa0')]):_0xd89c('0xa2'),'browserVersion':_0x516740[_0xd89c('0x9f')][_0xd89c('0xa0')]||'unknown','osName':util[_0xd89c('0xa1')](_0xd89c('0xa3'),_0x516740['os'][_0xd89c('0x34')],_0x516740['os'][_0xd89c('0xa0')]),'osVersion':_0x516740['os'][_0xd89c('0xa0')],'deviceModel':_0x516740[_0xd89c('0xa4')][_0xd89c('0x32')]&&_0x516740[_0xd89c('0xa4')][_0xd89c('0xa5')]?util['format'](_0xd89c('0xa6'),_0x516740[_0xd89c('0xa4')][_0xd89c('0x32')],_0x516740[_0xd89c('0xa4')][_0xd89c('0xa5')],_0x516740[_0xd89c('0xa4')][_0xd89c('0x30')]):null,'deviceVendor':_0x516740[_0xd89c('0xa4')][_0xd89c('0xa5')],'deviceType':_0x516740['device'][_0xd89c('0x30')],'formData':JSON[_0xd89c('0x18')](_0x2447d2[_0xd89c('0x52')])};var _0x5ab676={'ChatWebsiteId':_0x2447d2[_0xd89c('0x48')]['id'],'closed':![]};if(_0x2447d2[_0xd89c('0x52')][_0xd89c('0xa7')]){_0x5ab676[_0xd89c('0xa7')]=_0x2447d2['body']['threadId'];return db[_0xd89c('0xa8')][_0xd89c('0x4a')]({'where':_0x5ab676})[_0xd89c('0x15')](function(_0x280026){if(_0x280026){return[_0x280026,![]];}_0x1a1b00[_0xd89c('0xa7')]=_0x2447d2[_0xd89c('0x52')][_0xd89c('0xa7')];_0x1a1b00[_0xd89c('0xa9')]=_0x2447d2[_0xd89c('0x52')][_0xd89c('0xa9')];return db[_0xd89c('0xa8')][_0xd89c('0x4b')](_0x1a1b00)['then'](function(_0x50feb6){return[_0x50feb6,!![]];});});}_0x5ab676[_0xd89c('0xaa')]=_0x3121c0['id'];if(_0x2447d2[_0xd89c('0x52')][_0xd89c('0xab')]&&_0x2447d2[_0xd89c('0x52')]['interaction']['id']){_0x5ab676['id']=_0x2447d2[_0xd89c('0x52')]['interaction']['id'];return db[_0xd89c('0xa8')][_0xd89c('0x4a')]({'where':_0x5ab676})['then'](function(_0x3062bd){if(_0x3062bd){return[_0x3062bd,![]];}return db[_0xd89c('0xa8')][_0xd89c('0x4b')](_0x1a1b00)['then'](function(_0x18ac99){return[_0x18ac99,!![]];});});}return db[_0xd89c('0xa8')][_0xd89c('0x4b')](_0x1a1b00)['then'](function(_0x3e1e9d){return[_0x3e1e9d,!![]];});}})[_0xd89c('0xac')](function(_0x4de3fd,_0x5817e7){if(_0x4de3fd){_0x2768c4=_0x5817e7;if(!_0x5817e7){var _0x5570a5={'from':(_0x521adc['contact'][_0xd89c('0x9b')]||'')+'\x20'+(_0x521adc[_0xd89c('0x97')]['lastName']||'')};if(_0x2447d2[_0xd89c('0x52')]['threadId']&&_0x2447d2['body'][_0xd89c('0xad')]&&_0x2447d2[_0xd89c('0x52')][_0xd89c('0xa7')]!=_0x2447d2[_0xd89c('0x52')][_0xd89c('0xad')]){_0x5570a5[_0xd89c('0xa7')]=_0x2447d2[_0xd89c('0x52')][_0xd89c('0xad')];}return _0x4de3fd[_0xd89c('0x26')](_0x5570a5);}else{return _0x4de3fd;}}})[_0xd89c('0x15')](function(_0x29b5bf){_0x521adc[_0xd89c('0xab')]=_0x29b5bf[_0xd89c('0x28')]({'plain':!![]});_0x521adc[_0xd89c('0xab')][_0xd89c('0xae')]=_0x2768c4;if(_0x521adc[_0xd89c('0xab')][_0xd89c('0xae')]){if(_0x521adc[_0xd89c('0x92')][_0xd89c('0xaf')]){_0x521adc['applications'][_0xd89c('0xb0')]({'id':0x0,'priority':_0x521adc[_0xd89c('0x94')][_0xd89c('0x3b')]+0x1,'app':_0xd89c('0xb1'),'appdata':_0xd89c('0xb2'),'interval':_0xd89c('0xb3')});}}return db[_0xd89c('0xb4')]['create']({'body':_0x2447d2[_0xd89c('0x52')]['body'],'ChatWebsiteId':_0x2447d2['params']['id'],'ChatInteractionId':_0x29b5bf['id'],'direction':'in','ContactId':_0x521adc[_0xd89c('0x97')]['id'],'AttachmentId':_0x2447d2[_0xd89c('0x52')][_0xd89c('0xb5')]});})[_0xd89c('0x15')](function(_0xbf38b8){_0x521adc[_0xd89c('0x1b')]=_0xbf38b8;if(_0x521adc[_0xd89c('0xab')][_0xd89c('0xb6')]){return db[_0xd89c('0xb7')][_0xd89c('0x4a')]({'attributes':['id',_0xd89c('0x34')],'where':{'id':_0x521adc[_0xd89c('0xab')][_0xd89c('0xb6')]}})['then'](function(_0x503b82){if(_0x503b82){_0x521adc[_0xd89c('0x94')][_0xd89c('0xb8')]({'id':0x0,'priority':0x0,'app':_0xd89c('0xb9'),'appdata':_0x503b82['name']+','+(_0x521adc[_0xd89c('0x92')][_0xd89c('0xba')]||0xa),'interval':_0xd89c('0xb3')});_0x521adc[_0xd89c('0xbb')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x521adc);});}return respondWithRpcPromise(_0xd89c('0xbc'),_0xd89c('0xbd'),_0x521adc);})[_0xd89c('0x15')](function(_0x5985ae){respondWithRpcPromise(_0xd89c('0xbe'),'EventManager',{'event':_0xd89c('0xbf'),'message':_0x5985ae},client9002);return _0x5985ae;})[_0xd89c('0x15')](respondWithResult(_0x1f867d,null))[_0xd89c('0x46')](handleError(_0x1f867d,null));};exports['offline']=function(_0x146d41,_0x534b08){var _0x3ac069,_0x2fc4cf,_0x56a2a5;var _0x22ee1b=[];var _0x44d817={};var _0x1b6044=_0x146d41[_0xd89c('0xc0')]||[];var _0x1b5cb0=[];var _0x316585;return db['CmContact'][_0xd89c('0x53')]()[_0xd89c('0x15')](function(_0x178d14){if(!_0x178d14){throw new db[(_0xd89c('0x7f'))][(_0xd89c('0x80'))]('no\x20available\x20attributes');}_0x22ee1b=_['difference'](_[_0xd89c('0x35')](_0x178d14),[_0xd89c('0x83'),'updatedAt',_0xd89c('0x84'),_0xd89c('0x85')]);if(_0x146d41[_0xd89c('0x52')]['id']){delete _0x146d41[_0xd89c('0x52')]['id'];}if(_[_0xd89c('0x6f')](_0x146d41[_0xd89c('0x52')][_0xd89c('0x86')])){throw _0x534b08[_0xd89c('0x1e')](0x1f4)[_0xd89c('0xc1')](new db['Sequelize'][(_0xd89c('0x80'))](_0xd89c('0x87')));}if(_[_0xd89c('0x6f')](_0x146d41['body'][_0xd89c('0x52')])||_0x146d41[_0xd89c('0x52')]['body']===''){throw _0x534b08[_0xd89c('0x1e')](0x1f4)[_0xd89c('0xc1')](new db['Sequelize'][(_0xd89c('0x80'))](_0xd89c('0x88')));}if(_[_0xd89c('0x6f')](_0x146d41[_0xd89c('0x52')][_0xd89c('0xc2')])){throw _0x534b08['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xd89c('0xc3')+_0x22ee1b));}if(!_['includes'](_0x22ee1b,_0x146d41[_0xd89c('0x52')][_0xd89c('0xc2')])){throw _0x534b08['status'](0x1f4)[_0xd89c('0xc1')](new db[(_0xd89c('0x7f'))]['ValidationError'](_0xd89c('0xc4')+_0x22ee1b));}_0x44d817[_0x146d41[_0xd89c('0x52')]['mapKeyOffline']]=_0x146d41[_0xd89c('0x52')][_0xd89c('0x86')];})[_0xd89c('0x15')](function(){return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x146d41[_0xd89c('0x48')]['id']},'include':[{'model':db['CmList'],'as':_0xd89c('0x8e')},{'model':db[_0xd89c('0xc5')],'as':'MailAccount'}]});})[_0xd89c('0x15')](handleEntityNotFound(_0x534b08,null))[_0xd89c('0x15')](function(_0x342c36){if(_0x342c36&&_0x342c36[_0xd89c('0x8e')]){_0x2fc4cf=_0x342c36;var _0x2ade8e=_['defaults'](_0x146d41[_0xd89c('0x52')],{'firstName':_0x146d41[_0xd89c('0x52')]['from'],'phone':_0x146d41[_0xd89c('0x52')][_0xd89c('0x86')],'ListId':_0x342c36[_0xd89c('0x85')]});_0x2ade8e[_0x146d41[_0xd89c('0x52')]['mapKeyOffline']]=_0x146d41[_0xd89c('0x52')][_0xd89c('0x86')];return db['CmContact']['findOrCreate']({'where':_0x44d817,'defaults':_0x2ade8e});}})[_0xd89c('0xac')](function(_0x1a29e0){if(_0x1a29e0){_0x56a2a5=_0x1a29e0;var _0x5ab24d=fs[_0xd89c('0xc6')](path[_0xd89c('0x6a')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2b7255=ejs[_0xd89c('0xc7')](_0x5ab24d,{'body':_[_0xd89c('0xc8')](_0x146d41[_0xd89c('0x52')][_0xd89c('0x52')]),'bodyTitle':_0x2fc4cf['offlineMessageBody']});return db[_0xd89c('0xc9')][_0xd89c('0x4b')]({'body':_0x2b7255,'plainBody':htmlToText['fromString'](_0x2b7255),'ContactId':_0x1a29e0['id'],'ChatWebsiteId':_0x2fc4cf['id']});}})[_0xd89c('0x15')](function(_0x23036b){_0x316585=_0x23036b;if(_0x1b6044[_0xd89c('0x3b')]){var _0x96cb86=_0x1b6044['map'](function(_0x5d3ee0){return{'name':_0x5d3ee0[_0xd89c('0xca')],'basename':_0x5d3ee0['filename'],'type':_0x5d3ee0[_0xd89c('0xcb')],'ChatOfflineMessageId':_0x23036b['id']};});_0x1b5cb0=_0x96cb86['map'](_0x2e8746=>{var _0xccd345={'filename':_0x2e8746[_0xd89c('0x34')],'path':path[_0xd89c('0x6a')](config['root'],_0xd89c('0xcc'),'files','attachments',_0xd89c('0xcd'),_0x2e8746[_0xd89c('0xce')])};return _0xccd345;});if(!_0x2fc4cf[_0xd89c('0xcf')]){return db['sequelize'][_0xd89c('0xd0')](function(_0x6a6ac3){return db['Attachment'][_0xd89c('0xd1')](_0x96cb86,{'transaction':_0x6a6ac3});});}}})[_0xd89c('0x15')](function(){if(_0x316585){_0x3ac069=_0x316585;return db[_0xd89c('0xc5')][_0xd89c('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0xd89c('0xd2')],'as':_0xd89c('0xd3'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xd89c('0x15')](function(_0x18e532){if(_0x18e532&&_0x18e532[_0xd89c('0xd3')]&&_0x2fc4cf[_0xd89c('0xd4')]&&_0x2fc4cf[_0xd89c('0xd5')]){var _0x2d39d4=_0x18e532['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xd89c('0xd6'),{'account':_0x2d39d4,'message':{'from':util[_0xd89c('0xa1')]('\x22%s\x22\x20<%s>',_0x18e532[_0xd89c('0x34')],_0x18e532[_0xd89c('0xd7')]||_0x18e532['Smtp'][_0xd89c('0x4c')]),'to':_0x2fc4cf['forwardOfflineAddress'],'subject':_0x2fc4cf[_0xd89c('0xd8')],'html':_0x3ac069[_0xd89c('0x52')],'attachments':_0x1b5cb0}},client9003)[_0xd89c('0x15')](function(){return _0x3ac069;})[_0xd89c('0x46')](function(_0x4e154d){logger[_0xd89c('0x19')](_0x4e154d);});}})[_0xd89c('0x15')](function(){if(_0x2fc4cf&&_0x2fc4cf[_0xd89c('0xcf')]&&_0x2fc4cf['MailAccountId']){var _0x36c14a=[];if(_0x1b6044[_0xd89c('0x3b')]){_0x36c14a=_0x1b6044[_0xd89c('0x33')](function(_0x5770f1){return{'name':_0x5770f1[_0xd89c('0xca')],'basename':_0x5770f1[_0xd89c('0x63')],'type':_0x5770f1[_0xd89c('0xcb')],'ChatOfflineMessageId':_0x316585['id']};});}var _0xea35a8;if(!_[_0xd89c('0x6f')](_0x2fc4cf[_0xd89c('0xd9')])){var _0x488e54=_[_0xd89c('0x33')](_0x146d41['body'],function(_0x551677){return _0x551677;});var _0x2f7390=_[_0xd89c('0xda')](_0x488e54)[0x0];var _0x2673b0=_[_0xd89c('0xdb')](_0x2f7390,function(_0x16eb23){return _0x16eb23;});_0xea35a8=_0x2673b0[0x1][_0x2fc4cf[_0xd89c('0xd9')]];}var _0x4637b2={'from':_0x56a2a5['email'],'firstName':_0x56a2a5[_0xd89c('0x9b')],'lastName':_0x56a2a5[_0xd89c('0x9c')],'mapKey':'email','message':{'from':_0x56a2a5[_0xd89c('0xd7')],'to':_0x2fc4cf['MailAccount']['email'],'cc':'','subject':_[_0xd89c('0x6f')](_0xea35a8)?_0x2fc4cf[_0xd89c('0xd8')]:_0xea35a8,'messageId':'','sentAt':new Date(),'attach':_0x36c14a[_0xd89c('0x3b')],'attachments':_0x36c14a,'originChannel':_0xd89c('0xdc'),'ChatWebsiteId':_0x2fc4cf['id'],'ChatOfflineMessageId':_0x3ac069['id'],'originTo':_0x2fc4cf[_0xd89c('0xc5')][_0xd89c('0xd7')]},'body':_0x3ac069['body']};var _0xcf0deb={'account':{'id':_0x2fc4cf[_0xd89c('0xdd')]},'body':_0x4637b2,'log':_0xd89c('0xde')};return respondWithRpcPromise('NotifyMailAccount',_0xd89c('0xdf'),_0xcf0deb,client9001)['then'](function(){return _0x3ac069;})[_0xd89c('0x46')](function(_0x1ef77d){logger['error'](_0x1ef77d);});}return;})['then'](function(){if(_0x3ac069){return _0x3ac069;}})[_0xd89c('0x15')](respondWithResult(_0x534b08,null))[_0xd89c('0x46')](function(_0x4972b6){logger['error'](_0xd89c('0x46'),_0x4972b6);for(var _0x25031c of _0x1b6044){var _0x147450=path[_0xd89c('0x6a')](config['root'],_0xd89c('0xcc'),'files','attachments',_0xd89c('0xcd'),_0x25031c[_0xd89c('0x63')]);fs_extra[_0xd89c('0xe0')](_0x147450)['catch'](function(_0x4ba548){logger['error'](_0xd89c('0xe1'),_0x147450,_0x4ba548);});}});};exports['addInteraction']=function(_0xc69865,_0xf147c8){return db[_0xd89c('0xa8')][_0xd89c('0x4a')]({'where':{'id':_0xc69865[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0xf147c8,null))['then'](function(_0x58e047){if(_0x58e047){return _0x58e047[_0xd89c('0xe2')](_0xc69865[_0xd89c('0x52')][_0xd89c('0xe3')],_[_0xd89c('0xe4')](_0xc69865[_0xd89c('0x52')],['ids','id'])||{});}})[_0xd89c('0x15')](respondWithResult(_0xf147c8,null))[_0xd89c('0x46')](handleError(_0xf147c8,null));};exports['getInteractions']=function(_0x2aaede,_0x1d149e){var _0x33768c={'raw':![],'where':{}};var _0x2c969e={};var _0x3058ae={'count':0x0,'rows':[]};return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0x2aaede[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x1d149e,null))[_0xd89c('0x15')](function(_0x1e27c7){if(_0x1e27c7){_0x2c969e[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0xa8')]['rawAttributes']);_0x2c969e[_0xd89c('0x36')]=_['keys'](_0x2aaede[_0xd89c('0x36')]);_0x2c969e[_0xd89c('0x37')]=_['intersection'](_0x2c969e[_0xd89c('0x32')],_0x2c969e[_0xd89c('0x36')]);_0x33768c[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x2c969e['model'],qs[_0xd89c('0x3a')](_0x2aaede['query'][_0xd89c('0x3a')]));_0x33768c[_0xd89c('0x39')]=_0x33768c[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x33768c[_0xd89c('0x39')]:_0x2c969e[_0xd89c('0x32')];if(!_0x2aaede[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x33768c[_0xd89c('0x22')]=qs[_0xd89c('0x22')](_0x2aaede[_0xd89c('0x36')][_0xd89c('0x22')]);_0x33768c[_0xd89c('0x24')]=qs[_0xd89c('0x24')](_0x2aaede['query']['offset']);}_0x33768c[_0xd89c('0x3d')]=qs['sort'](_0x2aaede[_0xd89c('0x36')]['sort']);_0x33768c['where']=qs[_0xd89c('0x37')](_[_0xd89c('0x40')](_0x2aaede[_0xd89c('0x36')],_0x2c969e[_0xd89c('0x37')]));_0x33768c[_0xd89c('0x3f')]['ChatWebsiteId']=_0x1e27c7['id'];if(_0x2aaede[_0xd89c('0x36')]['filter']){_0x33768c[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x33768c['where'],{'$or':_[_0xd89c('0x33')](_0x33768c[_0xd89c('0x39')],function(_0x1266c8){var _0x483d61={};_0x483d61[_0x1266c8]={'$like':'%'+_0x2aaede['query'][_0xd89c('0x41')]+'%'};return _0x483d61;})});}_0x33768c=_[_0xd89c('0x42')]({},_0x33768c,_0x2aaede[_0xd89c('0x44')]);return db[_0xd89c('0xa8')][_0xd89c('0x23')]({'where':_0x33768c[_0xd89c('0x3f')]})[_0xd89c('0x15')](function(_0x41897b){_0x3058ae['count']=_0x41897b;if(_0x2aaede[_0xd89c('0x36')][_0xd89c('0x58')]){_0x33768c[_0xd89c('0x49')]=[{'model':db[_0xd89c('0x7e')],'as':_0xd89c('0xe5'),'required':![]},{'model':db[_0xd89c('0xb7')],'as':'Owner','attributes':[_0xd89c('0x34'),_0xd89c('0xe6'),_0xd89c('0xe7')],'required':![]},{'model':db[_0xd89c('0xe8')],'as':'Tags','attributes':['id',_0xd89c('0x34'),_0xd89c('0xe9')],'where':_0x2aaede[_0xd89c('0x36')][_0xd89c('0xea')]?{'id':_0x2aaede[_0xd89c('0x36')]['tag']}:undefined,'required':_0x2aaede[_0xd89c('0x36')]['tag']?!![]:![]}];}return db[_0xd89c('0xa8')][_0xd89c('0x45')](_0x33768c);})[_0xd89c('0x15')](function(_0x172df7){_0x3058ae[_0xd89c('0x59')]=_0x172df7;return _0x3058ae;});}})['then'](respondWithFilteredResult(_0x1d149e,_0x33768c))['catch'](handleError(_0x1d149e,null));};function iftimePromise(_0x364e66,_0x241174){return respondWithRpcPromise(_0xd89c('0xeb'),'getSnippet',{'command':_0x241174[_0xd89c('0xec')]?util[_0xd89c('0xa1')](_0xd89c('0xed'),_0x364e66[_0xd89c('0xee')],_0x241174['timezone']):util[_0xd89c('0xa1')](_0xd89c('0xef'),_0x364e66[_0xd89c('0xee')])},client9002)[_0xd89c('0x15')](function(_0x134058){var _0x35b4bd=_0x134058&&_0x134058[_0xd89c('0xf0')](_0xd89c('0xf1'))>=0x0?!![]:![];logger[_0xd89c('0x16')](_0xd89c('0xf2'),_0x241174['id'],_0x364e66['id'],_0x364e66[_0xd89c('0xee')],_0x35b4bd?'ONLINE':_0xd89c('0xf3'),_0x241174[_0xd89c('0xec')]?_0x241174['timezone']:_0xd89c('0xf4'));return _0x35b4bd;})['catch'](function(_0x4eef41){logger[_0xd89c('0x19')](_0xd89c('0xf2'),_0x241174['id'],_0x364e66['id'],_0x364e66['interval'],util[_0xd89c('0xf5')](_0x4eef41,{'showHidden':![],'depth':null}),_0x241174[_0xd89c('0xec')]?_0x241174[_0xd89c('0xec')]:_0xd89c('0xf4'));return![];});}exports[_0xd89c('0xf6')]=function(_0x19d64c,_0x2194a4){var _0x3578d7=0x0;var _0x7ab61c=0x0;var _0x50ae14=![];var _0x40bd02;var _0x4dd8f5;return db['ChatWebsite'][_0xd89c('0x4a')]({'where':{'id':_0x19d64c['params']['id']},'include':[{'model':db[_0xd89c('0xf7')],'as':_0xd89c('0xf7'),'include':[{'model':db[_0xd89c('0xf7')],'as':_0xd89c('0xf8'),'attributes':['id',_0xd89c('0xee')],'raw':!![]}]}]})[_0xd89c('0x15')](handleEntityNotFound(_0x2194a4,null))[_0xd89c('0x15')](function(_0x4c37a2){if(_0x4c37a2){_0x40bd02=_0x4c37a2;return _0x4c37a2['getProactiveActions']({'raw':!![]});}})[_0xd89c('0x15')](function(_0x5fac83){if(_0x40bd02){if(_0x5fac83){_0x4dd8f5=_0x5fac83;}}return require('../../config/license/util')[_0xd89c('0xf9')]();})['then'](function(_0x9e5d47){if(_0x9e5d47){_0x7ab61c=_0x9e5d47[_0xd89c('0xfa')];_0x50ae14=_0x9e5d47[_0xd89c('0x6e')];}})['then'](function(){return db['ChatInteraction'][_0xd89c('0x23')]({'where':{'closed':![]}});})[_0xd89c('0x15')](function(_0x54c986){_0x3578d7=_0x54c986;if(_0x7ab61c&&_0x54c986>_0x7ab61c){return db[_0xd89c('0xfb')][_0xd89c('0x5e')]({'where':{'id':0x1}})[_0xd89c('0x15')](function(_0x5f09c0){if(_0x5f09c0){_0x5f09c0[_0xd89c('0xfc')](_0xd89c('0xfd'));}});}})[_0xd89c('0x15')](function(){if(_0x40bd02[_0xd89c('0xf7')]&&_0x40bd02[_0xd89c('0xf7')]['Intervals']){var _0x5015e1=[];for(var _0x1ba940=0x0;_0x1ba940<_0x40bd02[_0xd89c('0xf7')][_0xd89c('0xf8')][_0xd89c('0x3b')];_0x1ba940++){var _0x55f780=_0x40bd02[_0xd89c('0xf7')][_0xd89c('0xf8')][_0x1ba940][_0xd89c('0x28')]({'plain':!![]});_0x5015e1[_0xd89c('0xb0')](iftimePromise(_0x55f780,_0x40bd02));}return BPromise['all'](_0x5015e1)['then'](function(_0x368b22){return _['some'](_0x368b22);});}else{return!![];}})['then'](function(_0x2f74be){var _0x45b68a=fs['readFileSync'](path[_0xd89c('0x6a')](config['root'],_0xd89c('0xfe')),_0xd89c('0xff'));var _0x264f0e=new url[(_0xd89c('0x100'))](_0x40bd02['address'])[_0xd89c('0x101')];var _0x487a6d='3.1.0';var _0x15f2cf=![];var _0x2da88c={'chatVersion':_0x487a6d,'chatWebsiteAddressOrigin':_0x264f0e,'remote':_0x40bd02[_0xd89c('0x102')],'query':querystring[_0xd89c('0x18')](_[_0xd89c('0x42')](_0x40bd02['get']({'plain':!![]}),{'customerIp':_0x19d64c[_0xd89c('0x7c')][_0xd89c('0x99')]||_0x19d64c[_0xd89c('0x7c')][_0xd89c('0x103')]||_0x19d64c[_0xd89c('0x104')]['remoteAddress']||_0x19d64c['ip'],'referer':_0x19d64c[_0xd89c('0x7c')]['referer'],'openedInteractions':_0x3578d7,'maxInteractions':_0x7ab61c,'virtual':_0x50ae14[_0xd89c('0xfa')],'online':_0x2f74be,'custom':_0x50ae14}))[_0xd89c('0x105')](/'/g,'\x5c\x27')};_0x2194a4[_0xd89c('0xc1')](ejs[_0xd89c('0xc7')](Mustache[_0xd89c('0xc7')](_0x45b68a,_0x2da88c),{'proactiveActions':_0x4dd8f5,'alignment':_0x40bd02['alignment'],'verticalAlignment':_0x40bd02[_0xd89c('0x106')],'div_color':_0x40bd02[_0xd89c('0xe9')],'labelText':_0x40bd02[_0xd89c('0x107')],'text_color':_0x40bd02[_0xd89c('0x108')],'text_button_color':_0x40bd02[_0xd89c('0x109')],'button_color':_0x40bd02[_0xd89c('0x10a')],'background_color':_0x40bd02['backgroundColor'],'hideWhenOffline':_0x40bd02[_0xd89c('0x10b')],'intervalId':_0x40bd02[_0xd89c('0x10c')],'isDevelopment':_0x15f2cf,'chatVersion':_0x487a6d}));})[_0xd89c('0x46')](handleError(_0x2194a4,null));};exports[_0xd89c('0x10d')]=function(_0x2fa0bf,_0x4403ca){var _0x4a84cb=_0x2fa0bf[_0xd89c('0x48')]['id'];var _0x169255=_0x2fa0bf['body'];var _0x53711c=0xc8;var _0x4648e6=null;return db[_0xd89c('0x10e')][_0xd89c('0xd0')]({'isolationLevel':db[_0xd89c('0x10e')][_0xd89c('0x10f')][_0xd89c('0x110')][_0xd89c('0x111')]},function(_0x422383){return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0x4a84cb},'transaction':_0x422383})[_0xd89c('0x15')](function(_0x235413){if(_0x235413){return db[_0xd89c('0x90')]['destroy']({'where':{'ChatWebsiteId':_0x4a84cb},'transaction':_0x422383})[_0xd89c('0x15')](function(){var _0x5c8ee3=_[_0xd89c('0x33')](_0x169255,function(_0x147521){_0x147521[_0xd89c('0x55')]=_0x4a84cb;return _0x147521;});return db[_0xd89c('0x90')][_0xd89c('0xd1')](_0x5c8ee3,{'transaction':_0x422383});});}else{_0x53711c=0x194;_0x4648e6=[];}});})[_0xd89c('0x15')](function(){if(_0x53711c!==0x194){return db[_0xd89c('0x90')][_0xd89c('0x112')]({'where':{'ChatWebsiteId':_0x4a84cb},'order':_0xd89c('0x113')})[_0xd89c('0x15')](function(_0x1ca223){_0x4648e6=_0x1ca223;});}})['catch'](function(_0x9ab544){_0x53711c=0x1f4;logger['error'](_0x9ab544[_0xd89c('0x2a')]);if(_0x9ab544[_0xd89c('0x34')]){delete _0x9ab544['name'];}_0x4648e6=_0x9ab544;})['finally'](function(){if(_0x4648e6===null){_0x4403ca[_0xd89c('0x1d')](_0x53711c);}else{if(_0x53711c===0x1f4){_0x4403ca['status'](_0x53711c)[_0xd89c('0xc1')](_0x4648e6);}else{_0x4403ca[_0xd89c('0x1e')](_0x53711c)['json'](_0x4648e6);}}});};exports[_0xd89c('0x114')]=function(_0x14e2a1,_0xe7e257){var _0x22f289={};var _0x4edb75={};var _0x59b118;var _0x26ce30;return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0x14e2a1['params']['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0xe7e257,null))[_0xd89c('0x15')](function(_0x107440){if(_0x107440){_0x59b118=_0x107440;_0x4edb75[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0x90')][_0xd89c('0x2e')]);_0x4edb75['query']=_[_0xd89c('0x35')](_0x14e2a1[_0xd89c('0x36')]);_0x4edb75[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x4edb75[_0xd89c('0x32')],_0x4edb75[_0xd89c('0x36')]);_0x22f289[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x4edb75[_0xd89c('0x32')],qs['fields'](_0x14e2a1[_0xd89c('0x36')][_0xd89c('0x3a')]));_0x22f289[_0xd89c('0x39')]=_0x22f289[_0xd89c('0x39')]['length']?_0x22f289['attributes']:_0x4edb75[_0xd89c('0x32')];_0x22f289[_0xd89c('0x3d')]=qs['sort'](_0x14e2a1['query'][_0xd89c('0x3e')]);_0x22f289[_0xd89c('0x3f')]=qs[_0xd89c('0x37')](_[_0xd89c('0x40')](_0x14e2a1['query'],_0x4edb75[_0xd89c('0x37')]));if(_0x14e2a1[_0xd89c('0x36')]['filter']){_0x22f289[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x22f289[_0xd89c('0x3f')],{'$or':_[_0xd89c('0x33')](_0x22f289['attributes'],function(_0x517857){var _0x51768b={};_0x51768b[_0x517857]={'$like':'%'+_0x14e2a1[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x51768b;})});}_0x22f289=_[_0xd89c('0x42')]({},_0x22f289,_0x14e2a1[_0xd89c('0x44')]);return _0x59b118['getApplications'](_0x22f289);}})[_0xd89c('0x15')](function(_0x149163){if(_0x149163){_0x26ce30=_0x149163[_0xd89c('0x3b')];if(!_0x14e2a1[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x22f289['limit']=qs['limit'](_0x14e2a1[_0xd89c('0x36')][_0xd89c('0x22')]);_0x22f289[_0xd89c('0x24')]=qs[_0xd89c('0x24')](_0x14e2a1[_0xd89c('0x36')][_0xd89c('0x24')]);}return _0x59b118[_0xd89c('0x114')](_0x22f289);}})[_0xd89c('0x15')](function(_0x13060c){if(_0x13060c){return _0x13060c?{'count':_0x26ce30,'rows':_0x13060c}:null;}})[_0xd89c('0x15')](respondWithResult(_0xe7e257,null))['catch'](handleError(_0xe7e257,null));};exports['addProactiveActions']=function(_0x251884,_0x5f4957){return db[_0xd89c('0x115')][_0xd89c('0x4a')]({'where':{'id':_0x251884[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x5f4957,null))[_0xd89c('0x15')](function(_0x2c9d8f){if(_0x2c9d8f){return _0x2c9d8f['addProactiveActions'](_0x251884[_0xd89c('0x52')][_0xd89c('0xe3')],_[_0xd89c('0xe4')](_0x251884[_0xd89c('0x52')],[_0xd89c('0xe3'),'id'])||{});}})[_0xd89c('0x15')](respondWithResult(_0x5f4957,null))[_0xd89c('0x46')](handleError(_0x5f4957,null));};exports['getProactiveActions']=function(_0x39c717,_0x442424){var _0x150317={};var _0x27b3ea={};var _0x2f3032;var _0x1a2f84;return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0x39c717[_0xd89c('0x48')]['id']}})['then'](handleEntityNotFound(_0x442424,null))[_0xd89c('0x15')](function(_0x522d4d){if(_0x522d4d){_0x2f3032=_0x522d4d;_0x27b3ea[_0xd89c('0x32')]=_[_0xd89c('0x35')](db[_0xd89c('0x116')][_0xd89c('0x2e')]);_0x27b3ea['query']=_[_0xd89c('0x35')](_0x39c717[_0xd89c('0x36')]);_0x27b3ea[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x27b3ea[_0xd89c('0x32')],_0x27b3ea[_0xd89c('0x36')]);_0x150317[_0xd89c('0x39')]=_[_0xd89c('0x38')](_0x27b3ea[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x39c717[_0xd89c('0x36')][_0xd89c('0x3a')]));_0x150317[_0xd89c('0x39')]=_0x150317[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x150317[_0xd89c('0x39')]:_0x27b3ea[_0xd89c('0x32')];_0x150317['order']=qs[_0xd89c('0x3e')](_0x39c717['query'][_0xd89c('0x3e')]);_0x150317[_0xd89c('0x3f')]=qs[_0xd89c('0x37')](_[_0xd89c('0x40')](_0x39c717[_0xd89c('0x36')],_0x27b3ea['filters']));if(_0x39c717['query'][_0xd89c('0x41')]){_0x150317[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x150317[_0xd89c('0x3f')],{'$or':_[_0xd89c('0x33')](_0x150317[_0xd89c('0x39')],function(_0x54258c){var _0x2cc0af={};_0x2cc0af[_0x54258c]={'$like':'%'+_0x39c717[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x2cc0af;})});}_0x150317=_[_0xd89c('0x42')]({},_0x150317,_0x39c717[_0xd89c('0x44')]);return _0x2f3032[_0xd89c('0x117')](_0x150317);}})[_0xd89c('0x15')](function(_0x180956){if(_0x180956){_0x1a2f84=_0x180956['length'];if(!_0x39c717[_0xd89c('0x36')]['hasOwnProperty'](_0xd89c('0x3c'))){_0x150317[_0xd89c('0x22')]=qs[_0xd89c('0x22')](_0x39c717[_0xd89c('0x36')][_0xd89c('0x22')]);_0x150317[_0xd89c('0x24')]=qs['offset'](_0x39c717[_0xd89c('0x36')][_0xd89c('0x24')]);}return _0x2f3032[_0xd89c('0x117')](_0x150317);}})[_0xd89c('0x15')](function(_0x5ee680){if(_0x5ee680){return _0x5ee680?{'count':_0x1a2f84,'rows':_0x5ee680}:null;}})[_0xd89c('0x15')](respondWithResult(_0x442424,null))[_0xd89c('0x46')](handleError(_0x442424,null));};exports[_0xd89c('0x118')]=function(_0x4037d7,_0x441a3f){var _0x4f13ea=_0x4037d7[_0xd89c('0x36')][_0xd89c('0x119')]===_0xd89c('0x11a')?'offlineForm':_0xd89c('0x11b');return db[_0xd89c('0x2d')]['find']({'attributes':['id',_0x4f13ea],'where':{'id':_0x4037d7[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x441a3f,null))[_0xd89c('0x15')](function(_0x3188c1){if(_0x3188c1){var _0xaa6ea2=_0x3188c1[_0x4f13ea];var _0x5a5a0e=_0xaa6ea2&&_0xaa6ea2['items']?_0xaa6ea2[_0xd89c('0x11c')]:[];_0x441a3f[_0xd89c('0xc1')]({'fromKey':_[_0xd89c('0x6f')](_0xaa6ea2[_0xd89c('0x11d')])?undefined:_0xaa6ea2['fromKey'],'count':_0x5a5a0e[_0xd89c('0x3b')],'rows':_0x5a5a0e});}})['catch'](handleError(_0x441a3f,null));};exports[_0xd89c('0x11e')]=function(_0x32e262,_0xd07261){var _0x41aec9={'raw':![],'where':{}};var _0x3cd180={};var _0x266049={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd89c('0x5e')]({'where':{'id':_0x32e262[_0xd89c('0x48')]['id']}})['then'](handleEntityNotFound(_0xd07261,null))[_0xd89c('0x15')](function(_0x4c7dc7){if(_0x4c7dc7){_0x3cd180['model']=_['keys'](db[_0xd89c('0xc9')][_0xd89c('0x2e')]);_0x3cd180[_0xd89c('0x36')]=_[_0xd89c('0x35')](_0x32e262[_0xd89c('0x36')]);_0x3cd180[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x3cd180[_0xd89c('0x32')],_0x3cd180[_0xd89c('0x36')]);_0x41aec9['attributes']=_['intersection'](_0x3cd180[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0x32e262['query'][_0xd89c('0x3a')]));_0x41aec9[_0xd89c('0x39')]=_0x41aec9[_0xd89c('0x39')][_0xd89c('0x3b')]?_0x41aec9[_0xd89c('0x39')]:_0x3cd180[_0xd89c('0x32')];if(!_0x32e262[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x41aec9[_0xd89c('0x22')]=qs['limit'](_0x32e262[_0xd89c('0x36')][_0xd89c('0x22')]);_0x41aec9[_0xd89c('0x24')]=qs[_0xd89c('0x24')](_0x32e262[_0xd89c('0x36')][_0xd89c('0x24')]);}_0x41aec9['order']=qs[_0xd89c('0x3e')](_0x32e262[_0xd89c('0x36')][_0xd89c('0x3e')]);_0x41aec9[_0xd89c('0x3f')]=qs[_0xd89c('0x37')](_['pick'](_0x32e262['query'],_0x3cd180[_0xd89c('0x37')]));_0x41aec9[_0xd89c('0x3f')][_0xd89c('0x55')]=_0x4c7dc7['id'];if(_0x32e262[_0xd89c('0x36')][_0xd89c('0x41')]){_0x41aec9['where']=_[_0xd89c('0x42')](_0x41aec9[_0xd89c('0x3f')],{'$or':_[_0xd89c('0x33')](_0x41aec9[_0xd89c('0x39')],function(_0x25eb62){var _0x13270b={};_0x13270b[_0x25eb62]={'$like':'%'+_0x32e262['query'][_0xd89c('0x41')]+'%'};return _0x13270b;})});}_0x41aec9=_[_0xd89c('0x42')]({},_0x41aec9,_0x32e262[_0xd89c('0x44')]);return db[_0xd89c('0xc9')][_0xd89c('0x23')]({'where':_0x41aec9[_0xd89c('0x3f')]})[_0xd89c('0x15')](function(_0x239ed6){_0x266049[_0xd89c('0x23')]=_0x239ed6;if(_0x32e262[_0xd89c('0x36')][_0xd89c('0x58')]){_0x41aec9[_0xd89c('0x49')]=[{'all':!![]}];}else{_0x41aec9[_0xd89c('0x49')]=[{'model':db[_0xd89c('0x7e')],'as':'Contact','required':![]},{'model':db[_0xd89c('0x11f')],'as':_0xd89c('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0xd89c('0x45')](_0x41aec9);})[_0xd89c('0x15')](function(_0x1ea9c9){_0x266049['rows']=_0x1ea9c9;return _0x266049;});}})[_0xd89c('0x15')](respondWithFilteredResult(_0xd07261,_0x41aec9))[_0xd89c('0x46')](handleError(_0xd07261,null));};exports[_0xd89c('0x121')]=function(_0x34c6f5,_0x33dc8){return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x34c6f5[_0xd89c('0x48')]['id']}})[_0xd89c('0x15')](handleEntityNotFound(_0x33dc8,null))[_0xd89c('0x15')](function(_0x9a9dba){if(_0x9a9dba){return _0x9a9dba[_0xd89c('0x121')](_0x34c6f5[_0xd89c('0x52')][_0xd89c('0xe3')],_['omit'](_0x34c6f5[_0xd89c('0x52')],[_0xd89c('0xe3'),'id'])||{})[_0xd89c('0xac')](function(_0x506f98){for(var _0x139d8e=0x0;_0x139d8e<_0x34c6f5[_0xd89c('0x52')][_0xd89c('0xe3')][_0xd89c('0x3b')];_0x139d8e+=0x1){socket[_0xd89c('0x122')](_0xd89c('0x123'),{'UserId':Number(_0x34c6f5[_0xd89c('0x52')][_0xd89c('0xe3')][_0x139d8e]),'ChatWebsiteId':Number(_0x34c6f5[_0xd89c('0x48')]['id'])});}return _0x506f98;});}})[_0xd89c('0x15')](respondWithResult(_0x33dc8,null))[_0xd89c('0x46')](handleError(_0x33dc8,null));};exports[_0xd89c('0x124')]=function(_0x3f7c26,_0x299dcb){return db[_0xd89c('0x2d')][_0xd89c('0x4a')]({'where':{'id':_0x3f7c26[_0xd89c('0x48')]['id']}})['then'](handleEntityNotFound(_0x299dcb,null))['then'](function(_0x1a407c){if(_0x1a407c){return _0x1a407c['removeAgents'](_0x3f7c26['query']['ids'])[_0xd89c('0x15')](function(){if(_['isArray'](_0x3f7c26[_0xd89c('0x36')][_0xd89c('0xe3')])){for(var _0xba1256=0x0;_0xba1256<_0x3f7c26[_0xd89c('0x36')][_0xd89c('0xe3')][_0xd89c('0x3b')];_0xba1256+=0x1){socket[_0xd89c('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x3f7c26[_0xd89c('0x36')][_0xd89c('0xe3')][_0xba1256]),'ChatWebsiteId':Number(_0x3f7c26['params']['id'])});}}else{socket[_0xd89c('0x122')](_0xd89c('0x125'),{'UserId':Number(_0x3f7c26['query'][_0xd89c('0xe3')]),'ChatWebsiteId':Number(_0x3f7c26[_0xd89c('0x48')]['id'])});}});}})[_0xd89c('0x15')](respondWithStatusCode(_0x299dcb,null))[_0xd89c('0x46')](handleError(_0x299dcb,null));};exports[_0xd89c('0x126')]=function(_0xe0ab68,_0x391c50){var _0x26bdcb={};var _0x12025c={};var _0x5e201d;var _0x28c946;return db[_0xd89c('0x2d')][_0xd89c('0x5e')]({'where':{'id':_0xe0ab68[_0xd89c('0x48')]['id']}})['then'](handleEntityNotFound(_0x391c50,null))[_0xd89c('0x15')](function(_0x5daa9f){if(_0x5daa9f){_0x5e201d=_0x5daa9f;_0x12025c[_0xd89c('0x32')]=_['keys'](db[_0xd89c('0xb7')][_0xd89c('0x2e')]);_0x12025c[_0xd89c('0x36')]=_[_0xd89c('0x35')](_0xe0ab68['query']);_0x12025c[_0xd89c('0x37')]=_[_0xd89c('0x38')](_0x12025c[_0xd89c('0x32')],_0x12025c[_0xd89c('0x36')]);_0x26bdcb['attributes']=_[_0xd89c('0x38')](_0x12025c[_0xd89c('0x32')],qs[_0xd89c('0x3a')](_0xe0ab68['query']['fields']));_0x26bdcb[_0xd89c('0x39')]=_0x26bdcb['attributes'][_0xd89c('0x3b')]?_0x26bdcb[_0xd89c('0x39')]:_0x12025c[_0xd89c('0x32')];_0x26bdcb[_0xd89c('0x3d')]=qs['sort'](_0xe0ab68[_0xd89c('0x36')][_0xd89c('0x3e')]);_0x26bdcb['where']=qs['filters'](_[_0xd89c('0x40')](_0xe0ab68[_0xd89c('0x36')],_0x12025c['filters']));if(_0xe0ab68['query'][_0xd89c('0x41')]){_0x26bdcb[_0xd89c('0x3f')]=_[_0xd89c('0x42')](_0x26bdcb[_0xd89c('0x3f')],{'$or':_['map'](_0x26bdcb[_0xd89c('0x39')],function(_0x500056){var _0x57d15a={};_0x57d15a[_0x500056]={'$like':'%'+_0xe0ab68[_0xd89c('0x36')][_0xd89c('0x41')]+'%'};return _0x57d15a;})});}_0x26bdcb=_[_0xd89c('0x42')]({},_0x26bdcb,_0xe0ab68['options']);return _0x5e201d['getAgents'](_0x26bdcb);}})[_0xd89c('0x15')](function(_0x26c105){if(_0x26c105){_0x28c946=_0x26c105['length'];if(!_0xe0ab68[_0xd89c('0x36')][_0xd89c('0x57')](_0xd89c('0x3c'))){_0x26bdcb[_0xd89c('0x22')]=qs[_0xd89c('0x22')](_0xe0ab68[_0xd89c('0x36')][_0xd89c('0x22')]);_0x26bdcb[_0xd89c('0x24')]=qs[_0xd89c('0x24')](_0xe0ab68[_0xd89c('0x36')]['offset']);}return _0x5e201d[_0xd89c('0x126')](_0x26bdcb);}})['then'](function(_0x4f5670){if(_0x4f5670){return _0x4f5670?{'count':_0x28c946,'rows':_0x4f5670}:null;}})[_0xd89c('0x15')](respondWithResult(_0x391c50,null))[_0xd89c('0x46')](handleError(_0x391c50,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4b72ef8..ff4b652 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 _0x4986=['ChatWebsite','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5eb643,_0x54d7b7){var _0x4681bb=function(_0x2e1d16){while(--_0x2e1d16){_0x5eb643['push'](_0x5eb643['shift']());}};_0x4681bb(++_0x54d7b7);}(_0x4986,0x6e));var _0x6498=function(_0x484ca8,_0x5b7573){_0x484ca8=_0x484ca8-0x0;var _0x2cebeb=_0x4986[_0x484ca8];return _0x2cebeb;};'use strict';var EventEmitter=require(_0x6498('0x0'));var ChatWebsite=require(_0x6498('0x1'))['db'][_0x6498('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6498('0x3'),'afterDestroy':_0x6498('0x4')};function emitEvent(_0x5d24c6){return function(_0x15e8d3,_0x12a6fb,_0x2c54ee){ChatWebsiteEvents[_0x6498('0x5')](_0x5d24c6+':'+_0x15e8d3['id'],_0x15e8d3);ChatWebsiteEvents[_0x6498('0x5')](_0x5d24c6,_0x15e8d3);_0x2c54ee(null);};}for(var e in events){if(events[_0x6498('0x6')](e)){var event=events[e];ChatWebsite[_0x6498('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xab5b=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xab5b,0x11a));var _0xbab5=function(_0x3d90b3,_0x542f6a){_0x3d90b3=_0x3d90b3-0x0;var _0x588233=_0xab5b[_0x3d90b3];return _0x588233;};'use strict';var EventEmitter=require(_0xbab5('0x0'));var ChatWebsite=require(_0xbab5('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbab5('0x2')](0x0);var events={'afterCreate':_0xbab5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a5d23){return function(_0x58f49f,_0xa320ef,_0x2fe469){ChatWebsiteEvents[_0xbab5('0x4')](_0x2a5d23+':'+_0x58f49f['id'],_0x58f49f);ChatWebsiteEvents[_0xbab5('0x4')](_0x2a5d23,_0x58f49f);_0x2fe469(null);};}for(var e in events){if(events[_0xbab5('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xbab5('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index eda243b..9b03fb2 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 _0xd434=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_websites','lodash','util','api'];(function(_0x32eaca,_0x119d38){var _0x45aa23=function(_0xd518e6){while(--_0xd518e6){_0x32eaca['push'](_0x32eaca['shift']());}};_0x45aa23(++_0x119d38);}(_0xd434,0x189));var _0x4d43=function(_0x2795ff,_0x48d3ea){_0x2795ff=_0x2795ff-0x0;var _0x9d96be=_0xd434[_0x2795ff];return _0x9d96be;};'use strict';var _=require(_0x4d43('0x0'));var util=require(_0x4d43('0x1'));var logger=require('../../config/logger')(_0x4d43('0x2'));var moment=require(_0x4d43('0x3'));var BPromise=require(_0x4d43('0x4'));var rp=require(_0x4d43('0x5'));var fs=require('fs');var path=require(_0x4d43('0x6'));var rimraf=require(_0x4d43('0x7'));var config=require(_0x4d43('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x4d43('0x9')]=function(_0x3d0592,_0x4406cd){return _0x3d0592['define']('ChatWebsite',attributes,{'tableName':_0x4d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ced=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x42b541,_0xd554cd){var _0x70a479=function(_0x384a84){while(--_0x384a84){_0x42b541['push'](_0x42b541['shift']());}};_0x70a479(++_0xd554cd);}(_0x0ced,0x1eb));var _0xd0ce=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0ced[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xd0ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd0ce('0x1'));var moment=require(_0xd0ce('0x2'));var BPromise=require(_0xd0ce('0x3'));var rp=require(_0xd0ce('0x4'));var fs=require('fs');var path=require(_0xd0ce('0x5'));var rimraf=require('rimraf');var config=require(_0xd0ce('0x6'));var attributes=require(_0xd0ce('0x7'));module[_0xd0ce('0x8')]=function(_0x52d916,_0x36479a){return _0x52d916[_0xd0ce('0x9')](_0xd0ce('0xa'),attributes,{'tableName':_0xd0ce('0xb'),'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 d83c5e9..46e9e46 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 _0x37dd=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x33681e,_0x2bda17){var _0x55718e=function(_0x3456c1){while(--_0x3456c1){_0x33681e['push'](_0x33681e['shift']());}};_0x55718e(++_0x2bda17);}(_0x37dd,0x1b6));var _0xd37d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x37dd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd37d('0x0'));var util=require(_0xd37d('0x1'));var moment=require(_0xd37d('0x2'));var BPromise=require(_0xd37d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd37d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd37d('0x5'));var config=require(_0xd37d('0x6'));var jayson=require(_0xd37d('0x7'));var client=jayson['client'][_0xd37d('0x8')]({'port':0x232a});config[_0xd37d('0x9')]=_['defaults'](config[_0xd37d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd37d('0xa'))(new Redis(config[_0xd37d('0x9')]));require('./chatWebsite.socket')[_0xd37d('0xb')](socket);function respondWithRpcPromise(_0x50c89b,_0x100b5b,_0x4e29ed){return new BPromise(function(_0x47a897,_0x4ecd58){return client[_0xd37d('0xc')](_0x50c89b,_0x4e29ed)[_0xd37d('0xd')](function(_0x26a312){logger[_0xd37d('0xe')](_0xd37d('0xf'),_0x100b5b,_0xd37d('0x10'));logger[_0xd37d('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x100b5b,_0xd37d('0x10'),JSON[_0xd37d('0x12')](_0x26a312));if(_0x26a312['error']){if(_0x26a312['error'][_0xd37d('0x13')]===0x1f4){logger[_0xd37d('0x14')](_0xd37d('0xf'),_0x100b5b,_0x26a312[_0xd37d('0x14')][_0xd37d('0x15')]);return _0x4ecd58(_0x26a312[_0xd37d('0x14')][_0xd37d('0x15')]);}logger[_0xd37d('0x14')](_0xd37d('0xf'),_0x100b5b,_0x26a312[_0xd37d('0x14')]['message']);return _0x47a897(_0x26a312['error'][_0xd37d('0x15')]);}else{logger['info'](_0xd37d('0xf'),_0x100b5b,'request\x20sent');_0x47a897(_0x26a312[_0xd37d('0x16')][_0xd37d('0x15')]);}})[_0xd37d('0x17')](function(_0x5cca69){logger[_0xd37d('0x14')](_0xd37d('0xf'),_0x100b5b,_0x5cca69);_0x4ecd58(_0x5cca69);});});} \ No newline at end of file +var _0x877b=['http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x7d8fff,_0x3c5889){var _0x1813be=function(_0xbac5df){while(--_0xbac5df){_0x7d8fff['push'](_0x7d8fff['shift']());}};_0x1813be(++_0x3c5889);}(_0x877b,0x17a));var _0xb877=function(_0x56fb89,_0x22844b){_0x56fb89=_0x56fb89-0x0;var _0x4a7fa7=_0x877b[_0x56fb89];return _0x4a7fa7;};'use strict';var _=require(_0xb877('0x0'));var util=require(_0xb877('0x1'));var moment=require(_0xb877('0x2'));var BPromise=require(_0xb877('0x3'));var rs=require(_0xb877('0x4'));var fs=require('fs');var Redis=require(_0xb877('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb877('0x6'));var logger=require(_0xb877('0x7'))(_0xb877('0x8'));var config=require(_0xb877('0x9'));var jayson=require(_0xb877('0xa'));var client=jayson[_0xb877('0xb')][_0xb877('0xc')]({'port':0x232a});config[_0xb877('0xd')]=_[_0xb877('0xe')](config[_0xb877('0xd')],{'host':_0xb877('0xf'),'port':0x18eb});var socket=require(_0xb877('0x10'))(new Redis(config[_0xb877('0xd')]));require(_0xb877('0x11'))[_0xb877('0x12')](socket);function respondWithRpcPromise(_0x2fa1a4,_0x1df79c,_0x2604b8){return new BPromise(function(_0x2254eb,_0x686e20){return client['request'](_0x2fa1a4,_0x2604b8)['then'](function(_0x5cca65){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1df79c,_0xb877('0x13'));logger[_0xb877('0x14')](_0xb877('0x15'),_0x1df79c,_0xb877('0x13'),JSON[_0xb877('0x16')](_0x5cca65));if(_0x5cca65[_0xb877('0x17')]){if(_0x5cca65['error'][_0xb877('0x18')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1df79c,_0x5cca65[_0xb877('0x17')][_0xb877('0x19')]);return _0x686e20(_0x5cca65[_0xb877('0x17')]['message']);}logger[_0xb877('0x17')](_0xb877('0x1a'),_0x1df79c,_0x5cca65[_0xb877('0x17')][_0xb877('0x19')]);return _0x2254eb(_0x5cca65[_0xb877('0x17')][_0xb877('0x19')]);}else{logger[_0xb877('0x1b')](_0xb877('0x1a'),_0x1df79c,_0xb877('0x13'));_0x2254eb(_0x5cca65[_0xb877('0x1c')][_0xb877('0x19')]);}})[_0xb877('0x1d')](function(_0x44c04e){logger[_0xb877('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1df79c,_0x44c04e);_0x686e20(_0x44c04e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ff38156..b60f21b 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 _0xf3ce=['removeListener','./chatWebsite.events','update','emit'];(function(_0xde7d5b,_0x3f4067){var _0x1cd42c=function(_0x34b048){while(--_0x34b048){_0xde7d5b['push'](_0xde7d5b['shift']());}};_0x1cd42c(++_0x3f4067);}(_0xf3ce,0x111));var _0xef3c=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0xf3ce[_0x5d1d6c];return _0x3f4b02;};'use strict';var ChatWebsiteEvents=require(_0xef3c('0x0'));var events=['save','remove',_0xef3c('0x1')];function createListener(_0x281165,_0x37e613){return function(_0x1514f3){_0x37e613[_0xef3c('0x2')](_0x281165,_0x1514f3);};}function removeListener(_0x2541bc,_0x5ba2cc){return function(){ChatWebsiteEvents[_0xef3c('0x3')](_0x2541bc,_0x5ba2cc);};}exports['register']=function(_0x2a5e19){for(var _0x4cb67f=0x0,_0x486be8=events['length'];_0x4cb67f<_0x486be8;_0x4cb67f++){var _0x1c2833=events[_0x4cb67f];var _0x3295eb=createListener('chatWebsite:'+_0x1c2833,_0x2a5e19);ChatWebsiteEvents['on'](_0x1c2833,_0x3295eb);}}; \ No newline at end of file +var _0xf500=['chatWebsite:','./chatWebsite.events','remove','update','emit','removeListener','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf500,0x158));var _0x0f50=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xf500[_0x2962d5];return _0x273406;};'use strict';var ChatWebsiteEvents=require(_0x0f50('0x0'));var events=['save',_0x0f50('0x1'),_0x0f50('0x2')];function createListener(_0xe9ff85,_0x547df3){return function(_0x59940d){_0x547df3[_0x0f50('0x3')](_0xe9ff85,_0x59940d);};}function removeListener(_0x3fdb9f,_0x4d1466){return function(){ChatWebsiteEvents[_0x0f50('0x4')](_0x3fdb9f,_0x4d1466);};}exports['register']=function(_0x2d86de){for(var _0x369d73=0x0,_0x20c4b4=events[_0x0f50('0x5')];_0x369d73<_0x20c4b4;_0x369d73++){var _0x1aa953=events[_0x369d73];var _0x3c6f8a=createListener(_0x0f50('0x6')+_0x1aa953,_0x2d86de);ChatWebsiteEvents['on'](_0x1aa953,_0x3c6f8a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1a71ee4..d3fc019 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 _0x27c3=['delete','removeDispositions','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','%s-%s','now','root','server/files/images/avatars/','originalname','single','file','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','replace','extname','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','/:id','update','destroy'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x27c3,0xd3));var _0x327c=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0x27c3[_0x48a96f];return _0x3ff3ef;};'use strict';var multer=require(_0x327c('0x0'));var util=require('util');var path=require(_0x327c('0x1'));var timeout=require('connect-timeout');var express=require(_0x327c('0x2'));var router=express[_0x327c('0x3')]();var fs_extra=require(_0x327c('0x4'));var auth=require(_0x327c('0x5'));var interaction=require(_0x327c('0x6'));var config=require('../../config/environment');var controller=require(_0x327c('0x7'));router[_0x327c('0x8')]('/',auth[_0x327c('0x9')](),controller[_0x327c('0xa')]);router[_0x327c('0x8')](_0x327c('0xb'),auth[_0x327c('0x9')](),controller['describe']);router[_0x327c('0x8')]('/:id',auth[_0x327c('0x9')](),controller[_0x327c('0xc')]);router[_0x327c('0x8')](_0x327c('0xd'),auth[_0x327c('0x9')](),controller['getDispositions']);router[_0x327c('0x8')](_0x327c('0xe'),auth[_0x327c('0x9')](),controller[_0x327c('0xf')]);router[_0x327c('0x8')](_0x327c('0x10'),controller[_0x327c('0x11')]);router[_0x327c('0x8')](_0x327c('0x12'),controller[_0x327c('0x13')]);router['get']('/:id/customer_avatar',controller[_0x327c('0x14')]);router[_0x327c('0x8')](_0x327c('0x15'),controller[_0x327c('0x16')]);router[_0x327c('0x8')](_0x327c('0x17'),auth[_0x327c('0x9')](),controller['getInteractions']);router[_0x327c('0x8')](_0x327c('0x18'),controller[_0x327c('0x19')]);router[_0x327c('0x8')](_0x327c('0x1a'),auth[_0x327c('0x9')](),controller['getApplications']);router[_0x327c('0x8')](_0x327c('0x1b'),auth[_0x327c('0x9')](),controller[_0x327c('0x1c')]);router['get'](_0x327c('0x1d'),controller[_0x327c('0x1e')]);router[_0x327c('0x8')](_0x327c('0x1f'),auth[_0x327c('0x9')](),controller[_0x327c('0x20')]);router[_0x327c('0x8')]('/:id/users',auth[_0x327c('0x9')](),controller[_0x327c('0x21')]);router[_0x327c('0x22')]('/',auth['isAuthenticated'](),controller[_0x327c('0x23')]);router['post'](_0x327c('0xd'),auth[_0x327c('0x9')](),controller[_0x327c('0x24')]);router[_0x327c('0x22')]('/:id/canned_answers',auth[_0x327c('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x327c('0x25')]({'destination':function(_0x1e4b73,_0x7474a3,_0x2c7592){_0x2c7592(null,path[_0x327c('0x26')](config['root'],_0x327c('0x27')));},'filename':function(_0xe6b02b,_0x3b2e5f,_0x466c20){_0x466c20(null,util[_0x327c('0x28')](_0x327c('0x29'),Date[_0x327c('0x2a')](),_0x3b2e5f['originalname']));}})});router[_0x327c('0x22')](_0x327c('0x10'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x327c('0x25')]({'destination':function(_0x463c27,_0xdea6f2,_0x284c06){_0x284c06(null,path['join'](config[_0x327c('0x2b')],_0x327c('0x2c')));},'filename':function(_0x5a9466,_0x195aa6,_0x20a0bb){_0x20a0bb(null,util[_0x327c('0x28')]('%s-%s',Date[_0x327c('0x2a')](),_0x195aa6[_0x327c('0x2d')]));}})});router[_0x327c('0x22')]('/:id/avatar',upload[_0x327c('0x2e')](_0x327c('0x2f')),controller[_0x327c('0x30')]);var upload=multer({'storage':multer[_0x327c('0x25')]({'destination':function(_0x3037df,_0x3d1883,_0x18864e){_0x18864e(null,path[_0x327c('0x26')](config[_0x327c('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x585dc1,_0x230859,_0x678c){_0x678c(null,util[_0x327c('0x28')](_0x327c('0x29'),Date[_0x327c('0x2a')](),_0x230859[_0x327c('0x2d')]));}})});router[_0x327c('0x22')]('/:id/customer_avatar',upload['single'](_0x327c('0x2f')),controller[_0x327c('0x31')]);var upload=multer({'storage':multer[_0x327c('0x25')]({'destination':function(_0x1eab61,_0x49c85e,_0x34f546){_0x34f546(null,path[_0x327c('0x26')](config[_0x327c('0x2b')],_0x327c('0x2c')));},'filename':function(_0x4146ec,_0x58a605,_0x54e889){_0x54e889(null,util[_0x327c('0x28')](_0x327c('0x29'),Date[_0x327c('0x2a')](),_0x58a605[_0x327c('0x2d')]));}})});router[_0x327c('0x22')]('/:id/system_avatar',upload[_0x327c('0x2e')](_0x327c('0x2f')),controller['addSystemAvatar']);router['post'](_0x327c('0x32'),controller[_0x327c('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x34ff19,_0x577788,_0x1eba0e){const _0x37878f=path[_0x327c('0x26')](config[_0x327c('0x2b')],_0x327c('0x34'),_0x327c('0x35'),'offline-chat');fs_extra['ensureDir'](_0x37878f,function(){_0x1eba0e(null,_0x37878f);});},'filename':function(_0x1a5eb7,_0xd13480,_0x51ed32){const _0x27c326=_0xd13480[_0x327c('0x2d')][_0x327c('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2096c0=path[_0x327c('0x37')](_0x27c326);const _0x30198e=Date[_0x327c('0x2a')]()+'-'+_0x27c326[_0x327c('0x36')](_0x2096c0,'')+_0x2096c0;_0x51ed32(null,_0x30198e);}})});router[_0x327c('0x22')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x327c('0x38')]);router[_0x327c('0x22')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x327c('0x39')]);router[_0x327c('0x22')](_0x327c('0x1a'),auth[_0x327c('0x9')](),controller[_0x327c('0x3a')]);router[_0x327c('0x22')]('/:id/proactive_actions',auth[_0x327c('0x9')](),controller[_0x327c('0x3b')]);router['post'](_0x327c('0x3c'),auth['isAuthenticated'](),controller[_0x327c('0x3d')]);router['put'](_0x327c('0x3e'),auth['isAuthenticated'](),controller[_0x327c('0x3f')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x327c('0x40')]);router[_0x327c('0x41')](_0x327c('0xd'),auth[_0x327c('0x9')](),controller[_0x327c('0x42')]);router[_0x327c('0x41')](_0x327c('0xe'),auth[_0x327c('0x9')](),controller['removeAnswers']);router[_0x327c('0x41')](_0x327c('0x3c'),auth['isAuthenticated'](),controller[_0x327c('0x43')]);module[_0x327c('0x44')]=router; \ No newline at end of file +var _0x410c=['server/files/images/avatars/','%s-%s','addAvatar','file','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','addLogo'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x410c,0x170));var _0xc410=function(_0x1ee254,_0x2b90b7){_0x1ee254=_0x1ee254-0x0;var _0x5fb989=_0x410c[_0x1ee254];return _0x5fb989;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc410('0x0'));var timeout=require(_0xc410('0x1'));var express=require(_0xc410('0x2'));var router=express[_0xc410('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc410('0x4'));var interaction=require(_0xc410('0x5'));var config=require(_0xc410('0x6'));var controller=require('./chatWebsite.controller');router[_0xc410('0x7')]('/',auth[_0xc410('0x8')](),controller['index']);router[_0xc410('0x7')](_0xc410('0x9'),auth[_0xc410('0x8')](),controller[_0xc410('0xa')]);router[_0xc410('0x7')](_0xc410('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc410('0x7')](_0xc410('0xc'),auth[_0xc410('0x8')](),controller[_0xc410('0xd')]);router[_0xc410('0x7')]('/:id/canned_answers',auth[_0xc410('0x8')](),controller['getAnswers']);router['get'](_0xc410('0xe'),controller['getLogo']);router[_0xc410('0x7')](_0xc410('0xf'),controller['getAvatar']);router['get'](_0xc410('0x10'),controller[_0xc410('0x11')]);router[_0xc410('0x7')]('/:id/system_avatar',controller[_0xc410('0x12')]);router['get']('/:id/interactions',auth[_0xc410('0x8')](),controller['getInteractions']);router[_0xc410('0x7')](_0xc410('0x13'),controller[_0xc410('0x14')]);router['get'](_0xc410('0x15'),auth[_0xc410('0x8')](),controller['getApplications']);router['get'](_0xc410('0x16'),auth[_0xc410('0x8')](),controller['getProactiveActions']);router[_0xc410('0x7')](_0xc410('0x17'),controller['getFields']);router['get'](_0xc410('0x18'),auth[_0xc410('0x8')](),controller[_0xc410('0x19')]);router['get'](_0xc410('0x1a'),auth[_0xc410('0x8')](),controller[_0xc410('0x1b')]);router['post']('/',auth[_0xc410('0x8')](),controller[_0xc410('0x1c')]);router[_0xc410('0x1d')](_0xc410('0xc'),auth[_0xc410('0x8')](),controller[_0xc410('0x1e')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xc410('0x1f')]({'destination':function(_0x4a1ef7,_0x524c38,_0x2e437a){_0x2e437a(null,path[_0xc410('0x20')](config[_0xc410('0x21')],_0xc410('0x22')));},'filename':function(_0x248062,_0x2b144d,_0x86672){_0x86672(null,util[_0xc410('0x23')]('%s-%s',Date[_0xc410('0x24')](),_0x2b144d[_0xc410('0x25')]));}})});router[_0xc410('0x1d')](_0xc410('0xe'),upload[_0xc410('0x26')]('file'),controller[_0xc410('0x27')]);var upload=multer({'storage':multer[_0xc410('0x1f')]({'destination':function(_0x53f312,_0x10b3df,_0x1eff5e){_0x1eff5e(null,path['join'](config[_0xc410('0x21')],_0xc410('0x28')));},'filename':function(_0x3e4dc8,_0x20d273,_0x3880d7){_0x3880d7(null,util['format'](_0xc410('0x29'),Date['now'](),_0x20d273[_0xc410('0x25')]));}})});router[_0xc410('0x1d')]('/:id/avatar',upload['single']('file'),controller[_0xc410('0x2a')]);var upload=multer({'storage':multer[_0xc410('0x1f')]({'destination':function(_0x56ddd3,_0x3bf3f3,_0x2bdc6f){_0x2bdc6f(null,path[_0xc410('0x20')](config[_0xc410('0x21')],'server/files/images/avatars/'));},'filename':function(_0x1038d3,_0x88ba7b,_0x9079e8){_0x9079e8(null,util[_0xc410('0x23')](_0xc410('0x29'),Date[_0xc410('0x24')](),_0x88ba7b[_0xc410('0x25')]));}})});router[_0xc410('0x1d')](_0xc410('0x10'),upload[_0xc410('0x26')](_0xc410('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xc410('0x1f')]({'destination':function(_0x443792,_0x429dd2,_0x3b4a58){_0x3b4a58(null,path[_0xc410('0x20')](config[_0xc410('0x21')],_0xc410('0x28')));},'filename':function(_0x4dd4a8,_0x5a1f66,_0x34e9d7){_0x34e9d7(null,util['format'](_0xc410('0x29'),Date[_0xc410('0x24')](),_0x5a1f66[_0xc410('0x25')]));}})});router[_0xc410('0x1d')](_0xc410('0x2c'),upload[_0xc410('0x26')]('file'),controller[_0xc410('0x2d')]);router[_0xc410('0x1d')](_0xc410('0x2e'),controller[_0xc410('0x2f')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3faceb,_0x29b6d5,_0x3ed33d){const _0x4cd755=path[_0xc410('0x20')](config['root'],'server/files',_0xc410('0x30'),_0xc410('0x31'));fs_extra[_0xc410('0x32')](_0x4cd755,function(){_0x3ed33d(null,_0x4cd755);});},'filename':function(_0x5067e8,_0x3432a8,_0x22e908){const _0xc2bb8=_0x3432a8[_0xc410('0x25')][_0xc410('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4eea14=path['extname'](_0xc2bb8);const _0x2762ee=Date[_0xc410('0x24')]()+'-'+_0xc2bb8[_0xc410('0x33')](_0x4eea14,'')+_0x4eea14;_0x22e908(null,_0x2762ee);}})});router[_0xc410('0x1d')](_0xc410('0x34'),offlineUploadMulter[_0xc410('0x35')](),controller[_0xc410('0x36')]);router['post'](_0xc410('0x37'),auth['isAuthenticated'](),controller[_0xc410('0x38')]);router[_0xc410('0x1d')]('/:id/applications',auth[_0xc410('0x8')](),controller[_0xc410('0x39')]);router[_0xc410('0x1d')](_0xc410('0x16'),auth[_0xc410('0x8')](),controller[_0xc410('0x3a')]);router[_0xc410('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0xc410('0x3b')]);router[_0xc410('0x3c')](_0xc410('0xb'),auth['isAuthenticated'](),controller[_0xc410('0x3d')]);router['delete'](_0xc410('0xb'),auth[_0xc410('0x8')](),controller['destroy']);router[_0xc410('0x3e')](_0xc410('0xc'),auth['isAuthenticated'](),controller[_0xc410('0x3f')]);router[_0xc410('0x3e')](_0xc410('0x40'),auth[_0xc410('0x8')](),controller[_0xc410('0x41')]);router['delete'](_0xc410('0x1a'),auth[_0xc410('0x8')](),controller[_0xc410('0x42')]);module[_0xc410('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 86c455b..ec3aae1 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 _0x2bbb=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','client-side-logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x2bbb,0x1f4));var _0xb2bb=function(_0x3f743e,_0x769800){_0x3f743e=_0x3f743e-0x0;var _0xf2d367=_0x2bbb[_0x3f743e];return _0xf2d367;};var beaverLogger=require(_0xb2bb('0x0'));var express=require(_0xb2bb('0x1'));var auth=require(_0xb2bb('0x2'));var config=require('../config/environment');var router=express[_0xb2bb('0x3')]();var isProduction=config[_0xb2bb('0x4')]===_0xb2bb('0x5')||![];function clientSideLogs(_0x27a32a,_0x39dffc,_0x47a59c){var _0x45b131=_0x27a32a['app']['get'](_0xb2bb('0x6'));if(!_0x45b131){throw new Error(_0xb2bb('0x7'));}return beaverLogger[_0xb2bb('0x8')]({'uri':_0xb2bb('0x9'),'logger':_0x45b131,'enableCors':!isProduction})(_0x27a32a,_0x39dffc,_0x47a59c);}router[_0xb2bb('0xa')](auth[_0xb2bb('0xb')](),clientSideLogs);module[_0xb2bb('0xc')]=router; \ No newline at end of file +var _0x6b59=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app'];(function(_0x7a5e71,_0x43ec4e){var _0x6d4521=function(_0x5a7a8e){while(--_0x5a7a8e){_0x7a5e71['push'](_0x7a5e71['shift']());}};_0x6d4521(++_0x43ec4e);}(_0x6b59,0x131));var _0x96b5=function(_0x2bcf65,_0x430d0c){_0x2bcf65=_0x2bcf65-0x0;var _0x2d2d61=_0x6b59[_0x2bcf65];return _0x2d2d61;};var beaverLogger=require(_0x96b5('0x0'));var express=require(_0x96b5('0x1'));var auth=require(_0x96b5('0x2'));var config=require(_0x96b5('0x3'));var router=express['Router']();var isProduction=config[_0x96b5('0x4')]===_0x96b5('0x5')||![];function clientSideLogs(_0x4d8c4c,_0x362cdd,_0x18a089){var _0x43b797=_0x4d8c4c[_0x96b5('0x6')][_0x96b5('0x7')](_0x96b5('0x8'));if(!_0x43b797){throw new Error(_0x96b5('0x9'));}return beaverLogger[_0x96b5('0xa')]({'uri':_0x96b5('0xb'),'logger':_0x43b797,'enableCors':!isProduction})(_0x4d8c4c,_0x362cdd,_0x18a089);}router[_0x96b5('0xc')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 04abb8f..67d1b27 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 _0xfc2a=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','AmazonAWS','ENUM','Outlook365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x2d2f1a,_0x57b966){var _0x55d9db=function(_0x15771f){while(--_0x15771f){_0x2d2f1a['push'](_0x2d2f1a['shift']());}};_0x55d9db(++_0x57b966);}(_0xfc2a,0xca));var _0xafc2=function(_0xd2d7a1,_0x59d7a4){_0xd2d7a1=_0xd2d7a1-0x0;var _0x3256c0=_0xfc2a[_0xd2d7a1];return _0x3256c0;};'use strict';var Sequelize=require(_0xafc2('0x0'));module[_0xafc2('0x1')]={'name':{'type':Sequelize[_0xafc2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xafc2('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xafc2('0x4')](_0xafc2('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xafc2('0x2')],'comment':_0xafc2('0x6')},'data2':{'type':Sequelize[_0xafc2('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xafc2('0x2')],'comment':_0xafc2('0x7')},'data4':{'type':Sequelize[_0xafc2('0x2')],'comment':_0xafc2('0x8')},'data5':{'type':Sequelize[_0xafc2('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xafc2('0x9')],'comment':_0xafc2('0xa')},'data7':{'type':Sequelize[_0xafc2('0x9')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x59bf=['Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x59bf,0xe5));var _0xf59b=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x59bf[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xf59b('0x0'));module[_0xf59b('0x1')]={'name':{'type':Sequelize[_0xf59b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf59b('0x3')](_0xf59b('0x4'),_0xf59b('0x5'),_0xf59b('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0xf59b('0x7'))},'data1':{'type':Sequelize[_0xf59b('0x2')],'comment':_0xf59b('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0xf59b('0x9')},'data3':{'type':Sequelize[_0xf59b('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0xf59b('0xa')},'data5':{'type':Sequelize[_0xf59b('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xf59b('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xf59b('0xb')],'comment':_0xf59b('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 901edde..9a8eaa8 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 _0x68ab=['model','map','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','CloudProvider','rows','service','decryptString','data3','show','keys','find','MicrosoftAzure','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','create','update','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','error','stack','name','send','padEnd','slice','index','rawAttributes','type'];(function(_0x3ce186,_0x4a846d){var _0x222380=function(_0x10f12e){while(--_0x10f12e){_0x3ce186['push'](_0x3ce186['shift']());}};_0x222380(++_0x4a846d);}(_0x68ab,0x1cb));var _0xb68a=function(_0x1103e6,_0x3a0217){_0x1103e6=_0x1103e6-0x0;var _0x5bc0ef=_0x68ab[_0x1103e6];return _0x5bc0ef;};'use strict';var _=require(_0xb68a('0x0'));var Redis=require(_0xb68a('0x1'));var qs=require(_0xb68a('0x2'));var encryptor=require(_0xb68a('0x3'));var config=require(_0xb68a('0x4'));var logger=require(_0xb68a('0x5'))('api');var db=require(_0xb68a('0x6'))['db'];var oauth=require(_0xb68a('0x7'));config[_0xb68a('0x8')]=_[_0xb68a('0x9')](config[_0xb68a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb68a('0xa'))(new Redis(config[_0xb68a('0x8')]));var redis=new Redis(config[_0xb68a('0x8')]);function respondWithStatusCode(_0xb8f356,_0x4d8665){_0x4d8665=_0x4d8665||0xcc;return function(_0x55393d){if(_0x55393d){return _0xb8f356[_0xb68a('0xb')](_0x4d8665);}return _0xb8f356[_0xb68a('0xc')](_0x4d8665)[_0xb68a('0xd')]();};}function respondWithResult(_0x38a2ea,_0x3a49dd){_0x3a49dd=_0x3a49dd||0xc8;return function(_0x321927){if(_0x321927){return _0x38a2ea[_0xb68a('0xc')](_0x3a49dd)[_0xb68a('0xe')](_0x321927);}};}function respondWithFilteredResult(_0x132f89,_0x3912ae){return function(_0x51744d){if(_0x51744d){var _0xe6571a=typeof _0x3912ae[_0xb68a('0xf')]===_0xb68a('0x10')&&typeof _0x3912ae[_0xb68a('0x11')]==='undefined';var _0xd94e3c=_0x51744d[_0xb68a('0x12')];var _0x2e40b7=_0xe6571a?0x0:_0x3912ae['offset'];var _0x406f65=_0xe6571a?_0x51744d[_0xb68a('0x12')]:_0x3912ae['offset']+_0x3912ae['limit'];var _0x18122e;if(_0x406f65>=_0xd94e3c){_0x406f65=_0xd94e3c;_0x18122e=0xc8;}else{_0x18122e=0xce;}_0x132f89[_0xb68a('0xc')](_0x18122e);return _0x132f89['set'](_0xb68a('0x13'),_0x2e40b7+'-'+_0x406f65+'/'+_0xd94e3c)[_0xb68a('0xe')](_0x51744d);}return null;};}function saveUpdates(_0x5b4dd0){return function(_0x5c58c6){if(_0x5c58c6){return _0x5c58c6['update'](_0x5b4dd0)[_0xb68a('0x14')](function(_0x189dd7){return _0x189dd7;});}return null;};}function removeEntity(_0x165b7a){return function(_0x26dd54){if(_0x26dd54){return _0x26dd54[_0xb68a('0x15')]()[_0xb68a('0x14')](function(){_0x165b7a[_0xb68a('0xc')](0xcc)[_0xb68a('0xd')]();});}};}function handleEntityNotFound(_0x4002d3){return function(_0x1daf8d){if(!_0x1daf8d){_0x4002d3['sendStatus'](0x194);}return _0x1daf8d;};}function handleError(_0x29223e,_0x2a654a){_0x2a654a=_0x2a654a||0x1f4;return function(_0x20bf1a){logger[_0xb68a('0x16')](_0x20bf1a[_0xb68a('0x17')]);if(_0x20bf1a[_0xb68a('0x18')]){delete _0x20bf1a[_0xb68a('0x18')];}_0x29223e[_0xb68a('0xc')](_0x2a654a)[_0xb68a('0x19')](_0x20bf1a);};}function maskClientSecret(_0x1d4736){return _[_0xb68a('0x1a')](_0x1d4736[_0xb68a('0x1b')](0x0,0x3),0x14,'*');}exports[_0xb68a('0x1c')]=function(_0x2358bc,_0x13e824){var _0x4dc276={},_0x3b9bca={},_0x51609b={'count':0x0,'rows':[]};var _0x42d945=_['map'](db['CloudProvider'][_0xb68a('0x1d')],function(_0x4e64af){return{'name':_0x4e64af['fieldName'],'type':_0x4e64af[_0xb68a('0x1e')]['key']};});_0x3b9bca[_0xb68a('0x1f')]=_[_0xb68a('0x20')](_0x42d945,_0xb68a('0x18'));_0x3b9bca['query']=_['keys'](_0x2358bc['query']);_0x3b9bca['filters']=_['intersection'](_0x3b9bca['model'],_0x3b9bca[_0xb68a('0x21')]);_0x4dc276[_0xb68a('0x22')]=_[_0xb68a('0x23')](_0x3b9bca[_0xb68a('0x1f')],qs[_0xb68a('0x24')](_0x2358bc[_0xb68a('0x21')]['fields']));_0x4dc276[_0xb68a('0x22')]=_0x4dc276[_0xb68a('0x22')][_0xb68a('0x25')]?_0x4dc276[_0xb68a('0x22')]:_0x3b9bca[_0xb68a('0x1f')];if(!_0x2358bc['query']['hasOwnProperty'](_0xb68a('0x26'))){_0x4dc276[_0xb68a('0x11')]=qs[_0xb68a('0x11')](_0x2358bc[_0xb68a('0x21')][_0xb68a('0x11')]);_0x4dc276[_0xb68a('0xf')]=qs['offset'](_0x2358bc[_0xb68a('0x21')]['offset']);}_0x4dc276[_0xb68a('0x27')]=qs[_0xb68a('0x28')](_0x2358bc['query']['sort']);_0x4dc276[_0xb68a('0x29')]=qs['filters'](_[_0xb68a('0x2a')](_0x2358bc[_0xb68a('0x21')],_0x3b9bca[_0xb68a('0x2b')]),_0x42d945);if(_0x2358bc[_0xb68a('0x21')][_0xb68a('0x2c')]){_0x4dc276[_0xb68a('0x29')]=_[_0xb68a('0x2d')](_0x4dc276[_0xb68a('0x29')],{'$or':_[_0xb68a('0x20')](_0x42d945,function(_0x3c376b){if(_0x3c376b[_0xb68a('0x1e')]!==_0xb68a('0x2e')){var _0x59168c={};_0x59168c[_0x3c376b[_0xb68a('0x18')]]={'$like':'%'+_0x2358bc[_0xb68a('0x21')][_0xb68a('0x2c')]+'%'};return _0x59168c;}})});}_0x4dc276=_['merge']({},_0x4dc276,_0x2358bc[_0xb68a('0x2f')]);var _0x30fd60={'where':_0x4dc276[_0xb68a('0x29')]};return db['CloudProvider'][_0xb68a('0x12')](_0x30fd60)['then'](function(_0x5c0ea9){_0x51609b[_0xb68a('0x12')]=_0x5c0ea9;if(_0x2358bc[_0xb68a('0x21')][_0xb68a('0x30')]){_0x4dc276[_0xb68a('0x31')]=[{'all':!![]}];}return db[_0xb68a('0x32')]['findAll'](_0x4dc276);})[_0xb68a('0x14')](function(_0x25ba5a){_0x51609b[_0xb68a('0x33')]=_[_0xb68a('0x20')](_0x25ba5a,function(_0x383913){if(_0x383913[_0xb68a('0x34')]==='MicrosoftAzure'){var _0x471613=encryptor[_0xb68a('0x35')](_0x383913[_0xb68a('0x36')]);_0x383913[_0xb68a('0x36')]=maskClientSecret(_0x471613);}return _0x383913;});return _0x51609b;})[_0xb68a('0x14')](respondWithFilteredResult(_0x13e824,_0x4dc276))['catch'](handleError(_0x13e824,null));};exports[_0xb68a('0x37')]=function(_0x2637df,_0x1d4a81){var _0x265845={'raw':!![],'where':{'id':_0x2637df['params']['id']}},_0x54083d={};_0x54083d[_0xb68a('0x1f')]=_[_0xb68a('0x38')](db[_0xb68a('0x32')][_0xb68a('0x1d')]);_0x54083d[_0xb68a('0x21')]=_[_0xb68a('0x38')](_0x2637df['query']);_0x54083d['filters']=_['intersection'](_0x54083d[_0xb68a('0x1f')],_0x54083d[_0xb68a('0x21')]);_0x265845[_0xb68a('0x22')]=_['intersection'](_0x54083d[_0xb68a('0x1f')],qs['fields'](_0x2637df[_0xb68a('0x21')][_0xb68a('0x24')]));_0x265845['attributes']=_0x265845['attributes']['length']?_0x265845[_0xb68a('0x22')]:_0x54083d['model'];if(_0x2637df[_0xb68a('0x21')]['includeAll']){_0x265845[_0xb68a('0x31')]=[{'all':!![]}];}_0x265845=_[_0xb68a('0x2d')]({},_0x265845,_0x2637df['options']);return db['CloudProvider'][_0xb68a('0x39')](_0x265845)['then'](handleEntityNotFound(_0x1d4a81,null))[_0xb68a('0x14')](function(_0xc7b935){if(_0xc7b935[_0xb68a('0x34')]===_0xb68a('0x3a')){var _0x596a8d=encryptor['decryptString'](_0xc7b935['data3']);_0xc7b935[_0xb68a('0x36')]=maskClientSecret(_0x596a8d);}return _0xc7b935;})['then'](respondWithResult(_0x1d4a81,null))[_0xb68a('0x3b')](handleError(_0x1d4a81,null));};exports['create']=function(_0x28d2df,_0x2f9f2d){if(!_0x28d2df[_0xb68a('0x3c')][_0xb68a('0x18')])throw new Error(_0xb68a('0x3d'));if(!_0x28d2df['body'][_0xb68a('0x34')])throw new Error(_0xb68a('0x3e'));var _0x48846c=db['CloudProvider'][_0xb68a('0x1d')][_0xb68a('0x34')]['values'];if(!_0x48846c[_0xb68a('0x3f')](_0x28d2df[_0xb68a('0x3c')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x48846c[_0xb68a('0x40')](',\x20'));if(_0x28d2df[_0xb68a('0x3c')][_0xb68a('0x34')]===_0xb68a('0x3a')&&_0x28d2df['body']['data3']){_0x28d2df['body'][_0xb68a('0x36')]=encryptor[_0xb68a('0x41')](_0x28d2df[_0xb68a('0x3c')][_0xb68a('0x36')]);}return db['CloudProvider'][_0xb68a('0x42')](_0x28d2df[_0xb68a('0x3c')],{})[_0xb68a('0x14')](respondWithResult(_0x2f9f2d,0xc9))[_0xb68a('0x3b')](handleError(_0x2f9f2d,null));};exports[_0xb68a('0x43')]=function(_0x1f005c,_0x2cc5c4){if(_0x1f005c[_0xb68a('0x3c')]['id']){delete _0x1f005c['body']['id'];}return db[_0xb68a('0x32')]['find']({'where':{'id':_0x1f005c[_0xb68a('0x44')]['id']}})[_0xb68a('0x14')](handleEntityNotFound(_0x2cc5c4,null))[_0xb68a('0x14')](function(_0x5f1eab){if(_0x5f1eab['service']==='MicrosoftAzure'&&_0x1f005c[_0xb68a('0x3c')]['data3']){_0x1f005c[_0xb68a('0x3c')][_0xb68a('0x36')]=encryptor['encryptString'](_0x1f005c['body'][_0xb68a('0x36')]);}return _0x5f1eab;})[_0xb68a('0x14')](saveUpdates(_0x1f005c[_0xb68a('0x3c')],null))[_0xb68a('0x14')](respondWithResult(_0x2cc5c4,null))[_0xb68a('0x3b')](handleError(_0x2cc5c4,null));};exports[_0xb68a('0x15')]=function(_0x577e36,_0x4e3ff4){return db[_0xb68a('0x32')][_0xb68a('0x39')]({'where':{'id':_0x577e36[_0xb68a('0x44')]['id']}})[_0xb68a('0x14')](handleEntityNotFound(_0x4e3ff4,null))['then'](removeEntity(_0x4e3ff4,null))[_0xb68a('0x3b')](handleError(_0x4e3ff4,null));};exports[_0xb68a('0x45')]=function(_0x11ada3,_0x593d69){return db[_0xb68a('0x32')][_0xb68a('0x46')]({'where':{'id':_0x11ada3[_0xb68a('0x44')]['id']},'raw':!![]})['then'](function(_0x462f1a){if(!_0x462f1a)return _0x593d69['sendStatus'](0x194);return{'url':oauth[_0xb68a('0x47')](_0x462f1a,_0x11ada3[_0xb68a('0x48')]['id'])};})[_0xb68a('0x14')](respondWithResult(_0x593d69,null))['catch'](handleError(_0x593d69,null));};exports[_0xb68a('0x49')]=function(_0x70ef47,_0x2243bc){var _0x37599c=_0x70ef47['body'];var _0x217a6c;var _0x4c3f84;if(_0x37599c[_0xb68a('0x16')])throw _0x37599c;redis[_0xb68a('0x4a')](_0x37599c[_0xb68a('0x4b')])[_0xb68a('0x14')](function(_0x22b2fd){if(!_0x22b2fd)throw new Error(_0xb68a('0x4c'));_0x217a6c=JSON['parse'](_0x22b2fd);var _0x30fea5=Buffer[_0xb68a('0x4d')](_0x37599c[_0xb68a('0x4b')],'base64')[_0xb68a('0x4e')](_0xb68a('0x4f'));_0x4c3f84=JSON[_0xb68a('0x50')](_0x30fea5);if(!oauth[_0xb68a('0x51')](_0x37599c[_0xb68a('0x52')],_0x217a6c[_0xb68a('0x53')]))throw new Error(_0xb68a('0x54'));redis[_0xb68a('0x55')](_0x37599c[_0xb68a('0x4b')]);return oauth[_0xb68a('0x56')](_0x37599c[_0xb68a('0x57')],_0x217a6c);})[_0xb68a('0x14')](function(_0xa3a0ba){_0x217a6c[_0xb68a('0x58')]=_0xa3a0ba['access_token'];_0x217a6c['data6']=_0xa3a0ba[_0xb68a('0x59')];return db[_0xb68a('0x32')][_0xb68a('0x43')]({'data5':_0x217a6c['data5'],'data6':_0x217a6c[_0xb68a('0x5a')]},{'where':{'id':_0x217a6c['id']}});})['then'](function(){oauth[_0xb68a('0x5b')](_0x217a6c);socket[_0xb68a('0x5c')](_0xb68a('0x5d'),{'id':_0x4c3f84['id']});return;})[_0xb68a('0x14')](respondWithStatusCode(_0x2243bc,null))[_0xb68a('0x3b')](function(_0x34d257){if(_0x4c3f84){socket[_0xb68a('0x5c')](_0xb68a('0x5e'),{'id':_0x4c3f84['id']});}if(!_0x217a6c){logger[_0xb68a('0x16')](_0xb68a('0x5f'),_0x34d257);return _0x2243bc[_0xb68a('0xc')](0x1f4)[_0xb68a('0x19')](_0x34d257[_0xb68a('0x60')]);}logger['error'](_0xb68a('0x61'),_0x217a6c['id'],JSON['stringify'](_0x34d257));});}; \ No newline at end of file +var _0x67a5=['microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','status','end','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','padEnd','slice','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','CloudProvider','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','encryptString','destroy','params','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','data6','refresh_token','startRefreshInterval'];(function(_0x49551a,_0x11947d){var _0x1843fa=function(_0x4ed058){while(--_0x4ed058){_0x49551a['push'](_0x49551a['shift']());}};_0x1843fa(++_0x11947d);}(_0x67a5,0x1b8));var _0x567a=function(_0x3b0d83,_0x596934){_0x3b0d83=_0x3b0d83-0x0;var _0x2c9da0=_0x67a5[_0x3b0d83];return _0x2c9da0;};'use strict';var _=require('lodash');var Redis=require(_0x567a('0x0'));var qs=require(_0x567a('0x1'));var encryptor=require(_0x567a('0x2'));var config=require('../../config/environment');var logger=require(_0x567a('0x3'))(_0x567a('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0x567a('0x5'));config[_0x567a('0x6')]=_[_0x567a('0x7')](config[_0x567a('0x6')],{'host':_0x567a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x567a('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xe233ac,_0x263a24){_0x263a24=_0x263a24||0xcc;return function(_0x203f60){if(_0x203f60){return _0xe233ac['sendStatus'](_0x263a24);}return _0xe233ac[_0x567a('0x9')](_0x263a24)[_0x567a('0xa')]();};}function respondWithResult(_0x5d2efb,_0xb6d626){_0xb6d626=_0xb6d626||0xc8;return function(_0x585786){if(_0x585786){return _0x5d2efb[_0x567a('0x9')](_0xb6d626)['json'](_0x585786);}};}function respondWithFilteredResult(_0x22d644,_0x80aee5){return function(_0x5cd33a){if(_0x5cd33a){var _0x39775f=typeof _0x80aee5[_0x567a('0xb')]===_0x567a('0xc')&&typeof _0x80aee5[_0x567a('0xd')]===_0x567a('0xc');var _0x403356=_0x5cd33a[_0x567a('0xe')];var _0x5db0e1=_0x39775f?0x0:_0x80aee5[_0x567a('0xb')];var _0x5e08f3=_0x39775f?_0x5cd33a['count']:_0x80aee5[_0x567a('0xb')]+_0x80aee5[_0x567a('0xd')];var _0x1a4adf;if(_0x5e08f3>=_0x403356){_0x5e08f3=_0x403356;_0x1a4adf=0xc8;}else{_0x1a4adf=0xce;}_0x22d644[_0x567a('0x9')](_0x1a4adf);return _0x22d644['set'](_0x567a('0xf'),_0x5db0e1+'-'+_0x5e08f3+'/'+_0x403356)['json'](_0x5cd33a);}return null;};}function saveUpdates(_0x5ca5aa){return function(_0x3f5eb7){if(_0x3f5eb7){return _0x3f5eb7[_0x567a('0x10')](_0x5ca5aa)[_0x567a('0x11')](function(_0x2f3ec1){return _0x2f3ec1;});}return null;};}function removeEntity(_0x545fe8){return function(_0x443094){if(_0x443094){return _0x443094['destroy']()['then'](function(){_0x545fe8[_0x567a('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501576){return function(_0x43d194){if(!_0x43d194){_0x501576[_0x567a('0x12')](0x194);}return _0x43d194;};}function handleError(_0x58d042,_0x30ef30){_0x30ef30=_0x30ef30||0x1f4;return function(_0x17a5ee){logger[_0x567a('0x13')](_0x17a5ee[_0x567a('0x14')]);if(_0x17a5ee[_0x567a('0x15')]){delete _0x17a5ee['name'];}_0x58d042[_0x567a('0x9')](_0x30ef30)['send'](_0x17a5ee);};}function maskClientSecret(_0x4cbc1c){return _[_0x567a('0x16')](_0x4cbc1c[_0x567a('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x8d9aa,_0x464435){var _0x340eb8={},_0x586d4f={},_0x589a77={'count':0x0,'rows':[]};var _0x2e798e=_[_0x567a('0x18')](db['CloudProvider'][_0x567a('0x19')],function(_0x1e0bb9){return{'name':_0x1e0bb9[_0x567a('0x1a')],'type':_0x1e0bb9[_0x567a('0x1b')]['key']};});_0x586d4f[_0x567a('0x1c')]=_[_0x567a('0x18')](_0x2e798e,_0x567a('0x15'));_0x586d4f[_0x567a('0x1d')]=_[_0x567a('0x1e')](_0x8d9aa['query']);_0x586d4f[_0x567a('0x1f')]=_['intersection'](_0x586d4f[_0x567a('0x1c')],_0x586d4f[_0x567a('0x1d')]);_0x340eb8[_0x567a('0x20')]=_[_0x567a('0x21')](_0x586d4f['model'],qs[_0x567a('0x22')](_0x8d9aa[_0x567a('0x1d')][_0x567a('0x22')]));_0x340eb8[_0x567a('0x20')]=_0x340eb8[_0x567a('0x20')][_0x567a('0x23')]?_0x340eb8[_0x567a('0x20')]:_0x586d4f['model'];if(!_0x8d9aa['query']['hasOwnProperty'](_0x567a('0x24'))){_0x340eb8[_0x567a('0xd')]=qs[_0x567a('0xd')](_0x8d9aa[_0x567a('0x1d')]['limit']);_0x340eb8[_0x567a('0xb')]=qs[_0x567a('0xb')](_0x8d9aa[_0x567a('0x1d')]['offset']);}_0x340eb8[_0x567a('0x25')]=qs[_0x567a('0x26')](_0x8d9aa['query'][_0x567a('0x26')]);_0x340eb8[_0x567a('0x27')]=qs[_0x567a('0x1f')](_['pick'](_0x8d9aa[_0x567a('0x1d')],_0x586d4f['filters']),_0x2e798e);if(_0x8d9aa[_0x567a('0x1d')]['filter']){_0x340eb8[_0x567a('0x27')]=_[_0x567a('0x28')](_0x340eb8[_0x567a('0x27')],{'$or':_['map'](_0x2e798e,function(_0x4ec2c6){if(_0x4ec2c6['type']!==_0x567a('0x29')){var _0x198274={};_0x198274[_0x4ec2c6[_0x567a('0x15')]]={'$like':'%'+_0x8d9aa[_0x567a('0x1d')]['filter']+'%'};return _0x198274;}})});}_0x340eb8=_[_0x567a('0x28')]({},_0x340eb8,_0x8d9aa[_0x567a('0x2a')]);var _0x1c3706={'where':_0x340eb8['where']};return db['CloudProvider']['count'](_0x1c3706)[_0x567a('0x11')](function(_0x919695){_0x589a77[_0x567a('0xe')]=_0x919695;if(_0x8d9aa['query'][_0x567a('0x2b')]){_0x340eb8[_0x567a('0x2c')]=[{'all':!![]}];}return db[_0x567a('0x2d')][_0x567a('0x2e')](_0x340eb8);})['then'](function(_0xdf6f6c){_0x589a77[_0x567a('0x2f')]=_[_0x567a('0x18')](_0xdf6f6c,function(_0x561b0e){if(_0x561b0e[_0x567a('0x30')]===_0x567a('0x31')){var _0x61c49a=encryptor[_0x567a('0x32')](_0x561b0e[_0x567a('0x33')]);_0x561b0e[_0x567a('0x33')]=maskClientSecret(_0x61c49a);}return _0x561b0e;});return _0x589a77;})[_0x567a('0x11')](respondWithFilteredResult(_0x464435,_0x340eb8))[_0x567a('0x34')](handleError(_0x464435,null));};exports['show']=function(_0x4e4536,_0x39afc8){var _0x3b3431={'raw':!![],'where':{'id':_0x4e4536['params']['id']}},_0x1bc851={};_0x1bc851[_0x567a('0x1c')]=_[_0x567a('0x1e')](db[_0x567a('0x2d')][_0x567a('0x19')]);_0x1bc851['query']=_['keys'](_0x4e4536[_0x567a('0x1d')]);_0x1bc851['filters']=_[_0x567a('0x21')](_0x1bc851['model'],_0x1bc851['query']);_0x3b3431['attributes']=_[_0x567a('0x21')](_0x1bc851[_0x567a('0x1c')],qs[_0x567a('0x22')](_0x4e4536[_0x567a('0x1d')][_0x567a('0x22')]));_0x3b3431[_0x567a('0x20')]=_0x3b3431[_0x567a('0x20')][_0x567a('0x23')]?_0x3b3431[_0x567a('0x20')]:_0x1bc851[_0x567a('0x1c')];if(_0x4e4536[_0x567a('0x1d')]['includeAll']){_0x3b3431['include']=[{'all':!![]}];}_0x3b3431=_['merge']({},_0x3b3431,_0x4e4536[_0x567a('0x2a')]);return db[_0x567a('0x2d')][_0x567a('0x35')](_0x3b3431)[_0x567a('0x11')](handleEntityNotFound(_0x39afc8,null))[_0x567a('0x11')](function(_0x401587){if(_0x401587[_0x567a('0x30')]===_0x567a('0x31')){var _0x4aad77=encryptor[_0x567a('0x32')](_0x401587[_0x567a('0x33')]);_0x401587[_0x567a('0x33')]=maskClientSecret(_0x4aad77);}return _0x401587;})[_0x567a('0x11')](respondWithResult(_0x39afc8,null))[_0x567a('0x34')](handleError(_0x39afc8,null));};exports[_0x567a('0x36')]=function(_0x56fb53,_0x291e01){if(!_0x56fb53[_0x567a('0x37')][_0x567a('0x15')])throw new Error(_0x567a('0x38'));if(!_0x56fb53['body'][_0x567a('0x30')])throw new Error(_0x567a('0x39'));var _0xdcaf68=db['CloudProvider'][_0x567a('0x19')]['service']['values'];if(!_0xdcaf68[_0x567a('0x3a')](_0x56fb53[_0x567a('0x37')][_0x567a('0x30')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0xdcaf68['join'](',\x20'));if(_0x56fb53[_0x567a('0x37')][_0x567a('0x30')]===_0x567a('0x31')&&_0x56fb53[_0x567a('0x37')]['data3']){_0x56fb53[_0x567a('0x37')][_0x567a('0x33')]=encryptor['encryptString'](_0x56fb53[_0x567a('0x37')]['data3']);}return db[_0x567a('0x2d')][_0x567a('0x36')](_0x56fb53[_0x567a('0x37')],{})[_0x567a('0x11')](respondWithResult(_0x291e01,0xc9))['catch'](handleError(_0x291e01,null));};exports[_0x567a('0x10')]=function(_0xb5fd53,_0x1ea596){if(_0xb5fd53[_0x567a('0x37')]['id']){delete _0xb5fd53[_0x567a('0x37')]['id'];}return db[_0x567a('0x2d')][_0x567a('0x35')]({'where':{'id':_0xb5fd53['params']['id']}})[_0x567a('0x11')](handleEntityNotFound(_0x1ea596,null))[_0x567a('0x11')](function(_0x47391b){if(_0x47391b[_0x567a('0x30')]===_0x567a('0x31')&&_0xb5fd53['body'][_0x567a('0x33')]){_0xb5fd53[_0x567a('0x37')][_0x567a('0x33')]=encryptor[_0x567a('0x3b')](_0xb5fd53[_0x567a('0x37')][_0x567a('0x33')]);}return _0x47391b;})[_0x567a('0x11')](saveUpdates(_0xb5fd53[_0x567a('0x37')],null))[_0x567a('0x11')](respondWithResult(_0x1ea596,null))['catch'](handleError(_0x1ea596,null));};exports[_0x567a('0x3c')]=function(_0x3bd026,_0x385f4b){return db[_0x567a('0x2d')][_0x567a('0x35')]({'where':{'id':_0x3bd026[_0x567a('0x3d')]['id']}})[_0x567a('0x11')](handleEntityNotFound(_0x385f4b,null))[_0x567a('0x11')](removeEntity(_0x385f4b,null))['catch'](handleError(_0x385f4b,null));};exports[_0x567a('0x3e')]=function(_0x7d3913,_0x243695){return db[_0x567a('0x2d')][_0x567a('0x3f')]({'where':{'id':_0x7d3913[_0x567a('0x3d')]['id']},'raw':!![]})[_0x567a('0x11')](function(_0x39b6b4){if(!_0x39b6b4)return _0x243695[_0x567a('0x12')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x39b6b4,_0x7d3913[_0x567a('0x40')]['id'])};})[_0x567a('0x11')](respondWithResult(_0x243695,null))[_0x567a('0x34')](handleError(_0x243695,null));};exports[_0x567a('0x41')]=function(_0x1649fa,_0x1411f7){var _0x8afa03=_0x1649fa[_0x567a('0x37')];var _0x2fe864;var _0x44ffce;if(_0x8afa03[_0x567a('0x13')])throw _0x8afa03;redis[_0x567a('0x42')](_0x8afa03[_0x567a('0x43')])[_0x567a('0x11')](function(_0x25c1b6){if(!_0x25c1b6)throw new Error(_0x567a('0x44'));_0x2fe864=JSON[_0x567a('0x45')](_0x25c1b6);var _0x22fc75=Buffer['from'](_0x8afa03[_0x567a('0x43')],_0x567a('0x46'))[_0x567a('0x47')](_0x567a('0x48'));_0x44ffce=JSON[_0x567a('0x45')](_0x22fc75);if(!oauth['isValidIdToken'](_0x8afa03[_0x567a('0x49')],_0x2fe864[_0x567a('0x4a')]))throw new Error(_0x567a('0x4b'));redis[_0x567a('0x4c')](_0x8afa03[_0x567a('0x43')]);return oauth['getOauth2MicrosoftAccessToken'](_0x8afa03[_0x567a('0x4d')],_0x2fe864);})[_0x567a('0x11')](function(_0x4e079d){_0x2fe864[_0x567a('0x4e')]=_0x4e079d['access_token'];_0x2fe864[_0x567a('0x4f')]=_0x4e079d[_0x567a('0x50')];return db[_0x567a('0x2d')][_0x567a('0x10')]({'data5':_0x2fe864['data5'],'data6':_0x2fe864[_0x567a('0x4f')]},{'where':{'id':_0x2fe864['id']}});})[_0x567a('0x11')](function(){oauth[_0x567a('0x51')](_0x2fe864);socket['emit'](_0x567a('0x52'),{'id':_0x44ffce['id']});return;})[_0x567a('0x11')](respondWithStatusCode(_0x1411f7,null))[_0x567a('0x34')](function(_0x1786a7){if(_0x44ffce){socket['emit']('microsoftAuthorization:error',{'id':_0x44ffce['id']});}if(!_0x2fe864){logger[_0x567a('0x13')](_0x567a('0x53'),_0x1786a7);return _0x1411f7['status'](0x1f4)['send'](_0x1786a7[_0x567a('0x54')]);}logger[_0x567a('0x13')](_0x567a('0x55'),_0x2fe864['id'],JSON[_0x567a('0x56')](_0x1786a7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 484ad21..8d7ab11 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 _0x3b98=['exports','define','CloudProvider','lodash','util','../../config/logger','moment','path','../../config/environment','./cloudProvider.attributes'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3b98,0x175));var _0x83b9=function(_0x2811ec,_0xc4c39d){_0x2811ec=_0x2811ec-0x0;var _0xe6bf42=_0x3b98[_0x2811ec];return _0xe6bf42;};'use strict';var _=require(_0x83b9('0x0'));var util=require(_0x83b9('0x1'));var logger=require(_0x83b9('0x2'))('api');var moment=require(_0x83b9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x83b9('0x4'));var rimraf=require('rimraf');var config=require(_0x83b9('0x5'));var attributes=require(_0x83b9('0x6'));module[_0x83b9('0x7')]=function(_0x431aa4,_0x19fbc6){return _0x431aa4[_0x83b9('0x8')](_0x83b9('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa0=['moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0xe3783f,_0x1c7079){var _0x289680=function(_0x2f033e){while(--_0x2f033e){_0xe3783f['push'](_0xe3783f['shift']());}};_0x289680(++_0x1c7079);}(_0xfaa0,0x6b));var _0x0faa=function(_0x5c1dba,_0x19298b){_0x5c1dba=_0x5c1dba-0x0;var _0x55f4ce=_0xfaa0[_0x5c1dba];return _0x55f4ce;};'use strict';var _=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var logger=require(_0x0faa('0x2'))('api');var moment=require(_0x0faa('0x3'));var BPromise=require('bluebird');var rp=require(_0x0faa('0x4'));var fs=require('fs');var path=require(_0x0faa('0x5'));var rimraf=require('rimraf');var config=require(_0x0faa('0x6'));var attributes=require(_0x0faa('0x7'));module[_0x0faa('0x8')]=function(_0xf4b733,_0x56d31c){return _0xf4b733['define'](_0x0faa('0x9'),attributes,{'tableName':_0x0faa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 44c35d3..b9e6b46 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 _0x2cef=['prompt','login','key','oauth2Claims','oauth2/','set','decode','issuer','audience','isAfter','exp','resolve','CloudProvider','findOne','then','refresh_token','decryptString','data3','POST','data5','access_token','data6','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data2','intervals','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','openid','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','join','Outlook365','/.default','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x2cef,0x6c));var _0xf2ce=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2cef[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xf2ce('0x0'));var crypto=require(_0xf2ce('0x1'));var jwt=require(_0xf2ce('0x2'));var moment=require('moment');var Redis=require(_0xf2ce('0x3'));var rp=require(_0xf2ce('0x4'));var util=require('util');var encryptor=require(_0xf2ce('0x5'));var config=require(_0xf2ce('0x6'));var logger=require('../../config/logger')(_0xf2ce('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xf2ce('0x8'))['db'];config[_0xf2ce('0x9')]=_[_0xf2ce('0xa')](config[_0xf2ce('0x9')],{'host':_0xf2ce('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xf2ce('0xc'),'profile','email',_0xf2ce('0xd'),_0xf2ce('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0xf2ce('0xf')],'Dynamics365':[_0xf2ce('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xf2ce('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0xf2ce('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x44634a){var _0x2e4762=_[_0xf2ce('0x12')](AZURE_AUTH_SCOPES[_0x44634a[_0xf2ce('0x13')]]);if(_0x44634a['type']===_0xf2ce('0x14'))_0x2e4762['push'](_0x44634a[_0xf2ce('0x15')]+'/.default');return _0x2e4762[_0xf2ce('0x16')]('\x20');}function getAccessTokenScope(_0x304b12){if(_0x304b12[_0xf2ce('0x13')]===_0xf2ce('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x304b12[_0xf2ce('0x13')]===_0xf2ce('0x14'))return _0x304b12[_0xf2ce('0x15')]+_0xf2ce('0x18');}function generateMicrosoftAuthorizationUrl(_0x2e651d,_0x4a9ce5){var _0x4f71c9=MICROSOFT_AUTH_URL[_0xf2ce('0x19')](_0xf2ce('0x1a'),_0x2e651d['data2']);var _0x7fc66c=[_0xf2ce('0x1b'),_0xf2ce('0x1c')];var _0x429d2e=Buffer[_0xf2ce('0x1d')](JSON[_0xf2ce('0x1e')]({'id':_0x4a9ce5}))[_0xf2ce('0x1f')](_0xf2ce('0x20'));var _0x369e3f=crypto['randomBytes'](0x10)['toString']('hex');var _0x446048=getAuthorizationScopes(_0x2e651d);var _0x4147ca=[{'key':_0xf2ce('0x21'),'value':_0x2e651d[_0xf2ce('0x22')]},{'key':_0xf2ce('0x23'),'value':encodeURIComponent(_0x7fc66c['join']('\x20'))},{'key':_0xf2ce('0x24'),'value':_0x2e651d[_0xf2ce('0x25')]},{'key':'response_mode','value':_0xf2ce('0x26')},{'key':_0xf2ce('0x27'),'value':encodeURIComponent(_0x446048)},{'key':_0xf2ce('0x28'),'value':_0x429d2e},{'key':_0xf2ce('0x29'),'value':_0x369e3f},{'key':_0xf2ce('0x2a'),'value':_0xf2ce('0x2b')}];var _0x45fe58=_0x4f71c9+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4147ca,function(_0x4d821a){return _0x4d821a[_0xf2ce('0x2c')]+'='+_0x4d821a['value'];})[_0xf2ce('0x16')]('&');_0x2e651d[_0xf2ce('0x2d')]={'issuer':_0x4f71c9[_0xf2ce('0x19')](_0xf2ce('0x2e'),''),'audience':_0x2e651d['data1'],'state':_0x429d2e,'nonce':_0x369e3f};redis[_0xf2ce('0x2f')](_0x429d2e,JSON[_0xf2ce('0x1e')](_0x2e651d));return _0x45fe58;}function isValidIdToken(_0x3d265d,_0x13b28d){try{var _0x558a23=jwt[_0xf2ce('0x30')](_0x3d265d,{'complete':!![]});var _0x3d6d72=_0x558a23['payload'];if(_0x3d6d72['iss']!==_0x13b28d[_0xf2ce('0x31')])return![];if(_0x3d6d72['aud']!==_0x13b28d[_0xf2ce('0x32')])return![];if(_0x3d6d72[_0xf2ce('0x29')]!==_0x13b28d['nonce'])return![];if(moment()[_0xf2ce('0x33')](moment['unix'](_0x3d6d72[_0xf2ce('0x34')])))return![];return!![];}catch(_0xb5d09b){throw _0xb5d09b;}}function refreshOauth2MicrosoftAccessToken(_0xfff895){return Promise[_0xf2ce('0x35')]()['then'](function(){if(_0xfff895['data3'])return _0xfff895;return db[_0xf2ce('0x36')][_0xf2ce('0x37')]({'where':{'id':_0xfff895['id']},'raw':!![]});})[_0xf2ce('0x38')](function(_0x2810ea){var _0x39f49a={'grant_type':_0xf2ce('0x39'),'refresh_token':_0x2810ea['data6'],'scope':getAccessTokenScope(_0x2810ea),'redirect_uri':_0x2810ea[_0xf2ce('0x25')],'client_id':_0x2810ea[_0xf2ce('0x22')],'client_secret':encryptor[_0xf2ce('0x3a')](_0x2810ea[_0xf2ce('0x3b')])};var _0x1b6c99={'method':_0xf2ce('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xf2ce('0x19')](_0xf2ce('0x1a'),_0x2810ea['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x39f49a,'json':!![]};return rp(_0x1b6c99);})[_0xf2ce('0x38')](function(_0x5c5256){_0xfff895[_0xf2ce('0x3d')]=_0x5c5256[_0xf2ce('0x3e')];_0xfff895[_0xf2ce('0x3f')]=_0x5c5256[_0xf2ce('0x39')];return db[_0xf2ce('0x36')][_0xf2ce('0x40')]({'data5':_0xfff895[_0xf2ce('0x3d')],'data6':_0xfff895[_0xf2ce('0x3f')]},{'where':{'id':_0xfff895['id']}});})[_0xf2ce('0x38')](function(){return _0xfff895;})[_0xf2ce('0x41')](function(_0x3b96e7){logger['error'](_0xf2ce('0x42'),_0xfff895['id'],_0x3b96e7);});}function getOauth2MicrosoftAccessToken(_0x4e2aa2,_0x436de7){var _0x59791d={'grant_type':_0xf2ce('0x43'),'code':_0x4e2aa2,'scope':getAccessTokenScope(_0x436de7),'redirect_uri':_0x436de7[_0xf2ce('0x25')],'client_id':_0x436de7['data1'],'client_secret':encryptor['decryptString'](_0x436de7[_0xf2ce('0x3b')])};var _0x7e546f={'method':_0xf2ce('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0xf2ce('0x1a'),_0x436de7[_0xf2ce('0x44')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59791d,'json':!![]};return rp(_0x7e546f);}function startRefreshInterval(_0x2b2f13){var _0x1fac8e=schedule[_0xf2ce('0x45')];if(_0x1fac8e[_0x2b2f13['id']])clearInterval(_0x1fac8e[_0x2b2f13['id']]);_0x1fac8e[_0x2b2f13['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x2b2f13['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf2ce('0x45')]=_0x1fac8e;}function startAllRefreshIntervals(){return db[_0xf2ce('0x36')][_0xf2ce('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf2ce('0x38')](function(_0x243075){var _0x1c2caa=_0x243075['map'](function(_0x5057fc){return refreshOauth2MicrosoftAccessToken(_0x5057fc)['then'](function(_0x4383b2){startRefreshInterval(_0x4383b2);});});return Promise['all'](_0x1c2caa);})[_0xf2ce('0x41')](function(_0x655700){var _0x543e06=_0x655700?util[_0xf2ce('0x47')](_0x655700,{'showHidden':![],'depth':null}):'';logger[_0xf2ce('0x48')](_0xf2ce('0x49'),_0x543e06);});}module[_0xf2ce('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x7a27=['/token','type','push','data7','join','Outlook365','Dynamics365','/.default','replace','{TENANT_ID}','data2','code','from','base64','randomBytes','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','map','key','value','oauth2Claims','oauth2/','set','stringify','decode','payload','issuer','isAfter','unix','exp','resolve','then','data3','CloudProvider','data6','POST','data5','access_token','refresh_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'];(function(_0x24e4ab,_0x3f680b){var _0x5e50eb=function(_0x42f656){while(--_0x42f656){_0x24e4ab['push'](_0x24e4ab['shift']());}};_0x5e50eb(++_0x3f680b);}(_0x7a27,0x1cc));var _0x77a2=function(_0x1565b0,_0x2958da){_0x1565b0=_0x1565b0-0x0;var _0x97b59d=_0x7a27[_0x1565b0];return _0x97b59d;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x77a2('0x0'));var moment=require(_0x77a2('0x1'));var Redis=require(_0x77a2('0x2'));var rp=require(_0x77a2('0x3'));var util=require(_0x77a2('0x4'));var encryptor=require(_0x77a2('0x5'));var config=require(_0x77a2('0x6'));var logger=require('../../config/logger')(_0x77a2('0x7'));var schedule=require(_0x77a2('0x8'));var db=require(_0x77a2('0x9'))['db'];config[_0x77a2('0xa')]=_[_0x77a2('0xb')](config[_0x77a2('0xa')],{'host':_0x77a2('0xc'),'port':0x18eb});var redis=new Redis(config[_0x77a2('0xa')]);var MICROSOFT_AUTH_URL=_0x77a2('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x77a2('0xe'),_0x77a2('0xf'),_0x77a2('0x10'),_0x77a2('0x11'),_0x77a2('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x77a2('0x13')],'Dynamics365':[_0x77a2('0xe'),_0x77a2('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x77a2('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x7b812c){var _0x738f61=_['map'](AZURE_AUTH_SCOPES[_0x7b812c[_0x77a2('0x15')]]);if(_0x7b812c[_0x77a2('0x15')]==='Dynamics365')_0x738f61[_0x77a2('0x16')](_0x7b812c[_0x77a2('0x17')]+'/.default');return _0x738f61[_0x77a2('0x18')]('\x20');}function getAccessTokenScope(_0x16f397){if(_0x16f397['type']===_0x77a2('0x19'))return _0x77a2('0x12');if(_0x16f397[_0x77a2('0x15')]===_0x77a2('0x1a'))return _0x16f397[_0x77a2('0x17')]+_0x77a2('0x1b');}function generateMicrosoftAuthorizationUrl(_0x2a7398,_0x23e8a8){var _0x416072=MICROSOFT_AUTH_URL[_0x77a2('0x1c')](_0x77a2('0x1d'),_0x2a7398[_0x77a2('0x1e')]);var _0x3b477e=[_0x77a2('0x1f'),'id_token'];var _0x3c6a5a=Buffer[_0x77a2('0x20')](JSON['stringify']({'id':_0x23e8a8}))['toString'](_0x77a2('0x21'));var _0x2bb46e=crypto[_0x77a2('0x22')](0x10)['toString']('hex');var _0x2de860=getAuthorizationScopes(_0x2a7398);var _0x3e4608=[{'key':_0x77a2('0x23'),'value':_0x2a7398[_0x77a2('0x24')]},{'key':_0x77a2('0x25'),'value':encodeURIComponent(_0x3b477e['join']('\x20'))},{'key':_0x77a2('0x26'),'value':_0x2a7398[_0x77a2('0x27')]},{'key':_0x77a2('0x28'),'value':_0x77a2('0x29')},{'key':_0x77a2('0x2a'),'value':encodeURIComponent(_0x2de860)},{'key':_0x77a2('0x2b'),'value':_0x3c6a5a},{'key':_0x77a2('0x2c'),'value':_0x2bb46e},{'key':_0x77a2('0x2d'),'value':'login'}];var _0x3133ff=_0x416072+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x77a2('0x2e')](_0x3e4608,function(_0xd4fc6a){return _0xd4fc6a[_0x77a2('0x2f')]+'='+_0xd4fc6a[_0x77a2('0x30')];})[_0x77a2('0x18')]('&');_0x2a7398[_0x77a2('0x31')]={'issuer':_0x416072[_0x77a2('0x1c')](_0x77a2('0x32'),''),'audience':_0x2a7398[_0x77a2('0x24')],'state':_0x3c6a5a,'nonce':_0x2bb46e};redis[_0x77a2('0x33')](_0x3c6a5a,JSON[_0x77a2('0x34')](_0x2a7398));return _0x3133ff;}function isValidIdToken(_0x50d28b,_0x50b6b1){try{var _0x45126e=jwt[_0x77a2('0x35')](_0x50d28b,{'complete':!![]});var _0x2a8b77=_0x45126e[_0x77a2('0x36')];if(_0x2a8b77['iss']!==_0x50b6b1[_0x77a2('0x37')])return![];if(_0x2a8b77['aud']!==_0x50b6b1['audience'])return![];if(_0x2a8b77[_0x77a2('0x2c')]!==_0x50b6b1[_0x77a2('0x2c')])return![];if(moment()[_0x77a2('0x38')](moment[_0x77a2('0x39')](_0x2a8b77[_0x77a2('0x3a')])))return![];return!![];}catch(_0x5be72f){throw _0x5be72f;}}function refreshOauth2MicrosoftAccessToken(_0x685189){return Promise[_0x77a2('0x3b')]()[_0x77a2('0x3c')](function(){if(_0x685189[_0x77a2('0x3d')])return _0x685189;return db[_0x77a2('0x3e')]['findOne']({'where':{'id':_0x685189['id']},'raw':!![]});})[_0x77a2('0x3c')](function(_0x210b2b){var _0x4f8348={'grant_type':'refresh_token','refresh_token':_0x210b2b[_0x77a2('0x3f')],'scope':getAccessTokenScope(_0x210b2b),'redirect_uri':_0x210b2b['data4'],'client_id':_0x210b2b['data1'],'client_secret':encryptor['decryptString'](_0x210b2b['data3'])};var _0x44df98={'method':_0x77a2('0x40'),'uri':MICROSOFT_AUTH_URL[_0x77a2('0x1c')](_0x77a2('0x1d'),_0x210b2b[_0x77a2('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f8348,'json':!![]};return rp(_0x44df98);})[_0x77a2('0x3c')](function(_0x531be9){_0x685189[_0x77a2('0x41')]=_0x531be9[_0x77a2('0x42')];_0x685189['data6']=_0x531be9[_0x77a2('0x43')];return db[_0x77a2('0x3e')][_0x77a2('0x44')]({'data5':_0x685189[_0x77a2('0x41')],'data6':_0x685189['data6']},{'where':{'id':_0x685189['id']}});})[_0x77a2('0x3c')](function(){return _0x685189;})[_0x77a2('0x45')](function(_0x486c26){logger['error'](_0x77a2('0x46'),_0x685189['id'],_0x486c26);});}function getOauth2MicrosoftAccessToken(_0xf008d6,_0x1f16c4){var _0x14a372={'grant_type':_0x77a2('0x47'),'code':_0xf008d6,'scope':getAccessTokenScope(_0x1f16c4),'redirect_uri':_0x1f16c4[_0x77a2('0x27')],'client_id':_0x1f16c4[_0x77a2('0x24')],'client_secret':encryptor[_0x77a2('0x48')](_0x1f16c4[_0x77a2('0x3d')])};var _0x76c1fa={'method':_0x77a2('0x40'),'uri':MICROSOFT_AUTH_URL[_0x77a2('0x1c')](_0x77a2('0x1d'),_0x1f16c4[_0x77a2('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x14a372,'json':!![]};return rp(_0x76c1fa);}function startRefreshInterval(_0x511085){var _0x31f7c1=schedule[_0x77a2('0x49')];if(_0x31f7c1[_0x511085['id']])clearInterval(_0x31f7c1[_0x511085['id']]);_0x31f7c1[_0x511085['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x511085['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x31f7c1;}function startAllRefreshIntervals(){return db[_0x77a2('0x3e')][_0x77a2('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x77a2('0x3c')](function(_0x547f8c){var _0x47c4e3=_0x547f8c[_0x77a2('0x2e')](function(_0x371579){return refreshOauth2MicrosoftAccessToken(_0x371579)[_0x77a2('0x3c')](function(_0x524223){startRefreshInterval(_0x524223);});});return Promise[_0x77a2('0x4b')](_0x47c4e3);})[_0x77a2('0x45')](function(_0x5e8c44){var _0x423932=_0x5e8c44?util[_0x77a2('0x4c')](_0x5e8c44,{'showHidden':![],'depth':null}):'';logger[_0x77a2('0x4d')](_0x77a2('0x4e'),_0x423932);});}module[_0x77a2('0x4f')]={'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 c0aa0ac..45bfd85 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1b2428,_0x2c5ac0){var _0x466f77=function(_0x55140e){while(--_0x55140e){_0x1b2428['push'](_0x1b2428['shift']());}};_0x466f77(++_0x2c5ac0);}(_0x66fa,0x117));var _0xa66f=function(_0x180718,_0x4357e5){_0x180718=_0x180718-0x0;var _0x26da49=_0x66fa[_0x180718];return _0x26da49;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('CloudProvider,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0xb7aa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2dd4c5,_0x22cc17){var _0x374d1c=function(_0x43bbdd){while(--_0x43bbdd){_0x2dd4c5['push'](_0x2dd4c5['shift']());}};_0x374d1c(++_0x22cc17);}(_0xb7aa,0x11a));var _0xab7a=function(_0x2da8c4,_0x27adda){_0x2da8c4=_0x2da8c4-0x0;var _0x3ee006=_0xb7aa[_0x2da8c4];return _0x3ee006;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require(_0xab7a('0x4'));var fs=require('fs');var Redis=require(_0xab7a('0x5'));var db=require(_0xab7a('0x6'))['db'];var utils=require(_0xab7a('0x7'));var logger=require(_0xab7a('0x8'))(_0xab7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xab7a('0xa'));var client=jayson[_0xab7a('0xb')][_0xab7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29ef15,_0x4e775f,_0x99ac82){return new BPromise(function(_0x1e3b23,_0x520d21){return client[_0xab7a('0xd')](_0x29ef15,_0x99ac82)[_0xab7a('0xe')](function(_0x40e6e6){logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));logger[_0xab7a('0x12')](_0xab7a('0x13'),_0x4e775f,_0xab7a('0x11'),JSON[_0xab7a('0x14')](_0x40e6e6));if(_0x40e6e6['error']){if(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x16')]===0x1f4){logger[_0xab7a('0x15')](_0xab7a('0x10'),_0x4e775f,_0x40e6e6['error'][_0xab7a('0x17')]);return _0x520d21(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);}logger[_0xab7a('0x15')]('CloudProvider,\x20%s,\x20%s',_0x4e775f,_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);return _0x1e3b23(_0x40e6e6['error'][_0xab7a('0x17')]);}else{logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));_0x1e3b23(_0x40e6e6[_0xab7a('0x18')]['message']);}})[_0xab7a('0x19')](function(_0x19eeb7){logger['error'](_0xab7a('0x10'),_0x4e775f,_0x19eeb7);_0x520d21(_0x19eeb7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9ac0547..eb2af68 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(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x1261,0x144));var _0x1126=function(_0x20a394,_0x5c4e0c){_0x20a394=_0x20a394-0x0;var _0x8a454f=_0x1261[_0x20a394];return _0x8a454f;};'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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x1261,0x144));var _0x1126=function(_0xc864d,_0x3443f2){_0xc864d=_0xc864d-0x0;var _0x4a1305=_0x1261[_0xc864d];return _0x4a1305;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 52b6ca6..004d62c 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 _0xda7a=['exports','name','STRING','sequelize'];(function(_0x1d06e9,_0x4be208){var _0x15faa3=function(_0x5e0c12){while(--_0x5e0c12){_0x1d06e9['push'](_0x1d06e9['shift']());}};_0x15faa3(++_0x4be208);}(_0xda7a,0x1d7));var _0xada7=function(_0x407d38,_0x4b29ef){_0x407d38=_0x407d38-0x0;var _0x543f4d=_0xda7a[_0x407d38];return _0x543f4d;};'use strict';var Sequelize=require(_0xada7('0x0'));module[_0xada7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xada7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xada7('0x3')]},'phone':{'type':Sequelize[_0xada7('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xada7('0x3')]},'street':{'type':Sequelize[_0xada7('0x3')]},'postalCode':{'type':Sequelize[_0xada7('0x3')]},'city':{'type':Sequelize[_0xada7('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xada7('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xada7('0x3')]},'sStreet':{'type':Sequelize[_0xada7('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xada7('0x3')]},'sCountry':{'type':Sequelize[_0xada7('0x3')]},'description':{'type':Sequelize[_0xada7('0x3')]}}; \ No newline at end of file +var _0x9788=['sequelize','exports','STRING'];(function(_0x27e4f5,_0x40da43){var _0x409725=function(_0x479dc5){while(--_0x479dc5){_0x27e4f5['push'](_0x27e4f5['shift']());}};_0x409725(++_0x40da43);}(_0x9788,0xf9));var _0x8978=function(_0x234c07,_0x2f78aa){_0x234c07=_0x234c07-0x0;var _0x407291=_0x9788[_0x234c07];return _0x407291;};'use strict';var Sequelize=require(_0x8978('0x0'));module[_0x8978('0x1')]={'name':{'type':Sequelize[_0x8978('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8978('0x2')]},'companyId':{'type':Sequelize[_0x8978('0x2')]},'website':{'type':Sequelize[_0x8978('0x2')]},'phone':{'type':Sequelize[_0x8978('0x2')]},'fax':{'type':Sequelize[_0x8978('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8978('0x2')]},'postalCode':{'type':Sequelize[_0x8978('0x2')]},'city':{'type':Sequelize[_0x8978('0x2')]},'country':{'type':Sequelize[_0x8978('0x2')]},'email':{'type':Sequelize[_0x8978('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8978('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8978('0x2')]},'sCity':{'type':Sequelize[_0x8978('0x2')]},'sCountry':{'type':Sequelize[_0x8978('0x2')]},'description':{'type':Sequelize[_0x8978('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 684af15..0b29c93 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 _0xd056=['fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','save','then','destroy','get','Companies','error','stack','name','send','CmCompany','describe','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','ids','omit','getContacts','findOne'];(function(_0x55aa41,_0x39c449){var _0xbdf804=function(_0x25c90e){while(--_0x25c90e){_0x55aa41['push'](_0x55aa41['shift']());}};_0xbdf804(++_0x39c449);}(_0xd056,0x164));var _0x6d05=function(_0x2ad5e0,_0x2396b0){_0x2ad5e0=_0x2ad5e0-0x0;var _0x555710=_0xd056[_0x2ad5e0];return _0x555710;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d05('0x0'));var rp=require('request-promise');var moment=require(_0x6d05('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6d05('0x2'));var util=require(_0x6d05('0x3'));var path=require(_0x6d05('0x4'));var sox=require(_0x6d05('0x5'));var csv=require(_0x6d05('0x6'));var ejs=require(_0x6d05('0x7'));var fs=require('fs');var fs_extra=require(_0x6d05('0x8'));var _=require(_0x6d05('0x9'));var squel=require(_0x6d05('0xa'));var crypto=require(_0x6d05('0xb'));var jsforce=require(_0x6d05('0xc'));var deskjs=require(_0x6d05('0xd'));var toCsv=require(_0x6d05('0x6'));var querystring=require(_0x6d05('0xe'));var Papa=require(_0x6d05('0xf'));var Redis=require(_0x6d05('0x10'));var authService=require(_0x6d05('0x11'));var qs=require(_0x6d05('0x12'));var as=require(_0x6d05('0x13'));var hardwareService=require(_0x6d05('0x14'));var logger=require(_0x6d05('0x15'))(_0x6d05('0x16'));var utils=require(_0x6d05('0x17'));var config=require(_0x6d05('0x18'));var licenseUtil=require(_0x6d05('0x19'));var db=require(_0x6d05('0x1a'))['db'];function respondWithStatusCode(_0x5a1cf3,_0x54e28d){_0x54e28d=_0x54e28d||0xcc;return function(_0x2f548d){if(_0x2f548d){return _0x5a1cf3[_0x6d05('0x1b')](_0x54e28d);}return _0x5a1cf3['status'](_0x54e28d)[_0x6d05('0x1c')]();};}function respondWithResult(_0x237e7f,_0x12d69b){_0x12d69b=_0x12d69b||0xc8;return function(_0x31991d){if(_0x31991d){return _0x237e7f[_0x6d05('0x1d')](_0x12d69b)['json'](_0x31991d);}};}function respondWithFilteredResult(_0x57908a,_0x2f9d80){return function(_0x5f0387){if(_0x5f0387){var _0x52e9b3=typeof _0x2f9d80['offset']===_0x6d05('0x1e')&&typeof _0x2f9d80['limit']===_0x6d05('0x1e');var _0x4c665c=_0x5f0387[_0x6d05('0x1f')];var _0xd28ac9=_0x52e9b3?0x0:_0x2f9d80[_0x6d05('0x20')];var _0x1bab18=_0x52e9b3?_0x5f0387[_0x6d05('0x1f')]:_0x2f9d80['offset']+_0x2f9d80[_0x6d05('0x21')];var _0x2181a1;if(_0x1bab18>=_0x4c665c){_0x1bab18=_0x4c665c;_0x2181a1=0xc8;}else{_0x2181a1=0xce;}_0x57908a['status'](_0x2181a1);return _0x57908a[_0x6d05('0x22')](_0x6d05('0x23'),_0xd28ac9+'-'+_0x1bab18+'/'+_0x4c665c)[_0x6d05('0x24')](_0x5f0387);}return null;};}function patchUpdates(_0x4ebd1a){return function(_0x1ae701){try{jsonpatch['apply'](_0x1ae701,_0x4ebd1a,!![]);}catch(_0x25aadf){return BPromise['reject'](_0x25aadf);}return _0x1ae701[_0x6d05('0x25')]();};}function saveUpdates(_0x2a0ef1,_0x21751f){return function(_0xb42286){if(_0xb42286){return _0xb42286['update'](_0x2a0ef1)[_0x6d05('0x26')](function(_0x4c0bff){return _0x4c0bff;});}return null;};}function removeEntity(_0x32b708,_0x50e49a){return function(_0x707b28){if(_0x707b28){return _0x707b28[_0x6d05('0x27')]()[_0x6d05('0x26')](function(){var _0x449838=_0x707b28[_0x6d05('0x28')]({'plain':!![]});var _0x575978=_0x6d05('0x29');return db['UserProfileResource'][_0x6d05('0x27')]({'where':{'type':_0x575978,'resourceId':_0x449838['id']}})['then'](function(){return _0x707b28;});})[_0x6d05('0x26')](function(){_0x32b708[_0x6d05('0x1d')](0xcc)[_0x6d05('0x1c')]();});}};}function handleEntityNotFound(_0x2ee9bf,_0x553db0){return function(_0x2788bc){if(!_0x2788bc){_0x2ee9bf[_0x6d05('0x1b')](0x194);}return _0x2788bc;};}function handleError(_0x4d2a54,_0x3beba9){_0x3beba9=_0x3beba9||0x1f4;return function(_0x138605){logger[_0x6d05('0x2a')](_0x138605[_0x6d05('0x2b')]);if(_0x138605[_0x6d05('0x2c')]){delete _0x138605['name'];}_0x4d2a54[_0x6d05('0x1d')](_0x3beba9)[_0x6d05('0x2d')](_0x138605);};}exports['index']=function(_0x34b605,_0x9ff78b){var _0x2288b4={},_0x306ed1={},_0x2fe3e5={'count':0x0,'rows':[]};return db[_0x6d05('0x2e')][_0x6d05('0x2f')]()[_0x6d05('0x26')](function(_0x4ec851){_0x306ed1[_0x6d05('0x30')]=_['keys'](_0x4ec851);_0x306ed1[_0x6d05('0x31')]=_[_0x6d05('0x32')](_0x34b605[_0x6d05('0x31')]);_0x306ed1[_0x6d05('0x33')]=_['intersection'](_0x306ed1[_0x6d05('0x30')],_0x306ed1[_0x6d05('0x31')]);_0x2288b4[_0x6d05('0x34')]=_[_0x6d05('0x35')](_0x306ed1[_0x6d05('0x30')],qs[_0x6d05('0x36')](_0x34b605[_0x6d05('0x31')][_0x6d05('0x36')]));_0x2288b4[_0x6d05('0x34')]=_0x2288b4[_0x6d05('0x34')][_0x6d05('0x37')]?_0x2288b4['attributes']:_0x306ed1[_0x6d05('0x30')];if(!_0x34b605[_0x6d05('0x31')][_0x6d05('0x38')](_0x6d05('0x39'))){_0x2288b4[_0x6d05('0x21')]=qs['limit'](_0x34b605[_0x6d05('0x31')][_0x6d05('0x21')]);_0x2288b4[_0x6d05('0x20')]=qs[_0x6d05('0x20')](_0x34b605[_0x6d05('0x31')]['offset']);}_0x2288b4['order']=qs[_0x6d05('0x3a')](_0x34b605['query'][_0x6d05('0x3a')]);_0x2288b4[_0x6d05('0x3b')]=qs[_0x6d05('0x33')](_[_0x6d05('0x3c')](_0x34b605[_0x6d05('0x31')],_0x306ed1[_0x6d05('0x33')]),_0x4ec851);if(_0x34b605[_0x6d05('0x31')][_0x6d05('0x3d')]){_0x2288b4['where']=_[_0x6d05('0x3e')](_0x2288b4['where'],{'$or':_[_0x6d05('0x3f')](_0x2288b4[_0x6d05('0x34')],function(_0x4925dc){var _0x3c9f18={};_0x3c9f18[_0x4925dc]={'$like':'%'+_0x34b605[_0x6d05('0x31')][_0x6d05('0x3d')]+'%'};return _0x3c9f18;})});}_0x2288b4=_[_0x6d05('0x3e')]({},_0x2288b4,_0x34b605[_0x6d05('0x40')]);var _0x375242={'where':_0x2288b4['where']};return db[_0x6d05('0x2e')][_0x6d05('0x1f')](_0x375242)[_0x6d05('0x26')](function(_0x38fafa){_0x2fe3e5['count']=_0x38fafa;if(_0x34b605[_0x6d05('0x31')]['includeAll']){_0x2288b4['include']=[{'all':!![]}];}return db[_0x6d05('0x2e')][_0x6d05('0x41')](_0x2288b4);})[_0x6d05('0x26')](function(_0x227b03){_0x2fe3e5['rows']=_0x227b03;return _0x2fe3e5;})['then'](respondWithFilteredResult(_0x9ff78b,_0x2288b4))[_0x6d05('0x42')](handleError(_0x9ff78b,null));})[_0x6d05('0x42')](handleError(_0x9ff78b,null));};exports[_0x6d05('0x43')]=function(_0xa85508,_0x49bbd0){var _0x17d4ce={'raw':![],'where':{'id':_0xa85508[_0x6d05('0x44')]['id']}},_0x10c8df={};_0x10c8df['model']=_['keys'](db[_0x6d05('0x2e')][_0x6d05('0x45')]);_0x10c8df['query']=_['keys'](_0xa85508[_0x6d05('0x31')]);_0x10c8df[_0x6d05('0x33')]=_[_0x6d05('0x35')](_0x10c8df[_0x6d05('0x30')],_0x10c8df['query']);_0x17d4ce[_0x6d05('0x34')]=_[_0x6d05('0x35')](_0x10c8df[_0x6d05('0x30')],qs['fields'](_0xa85508[_0x6d05('0x31')][_0x6d05('0x36')]));_0x17d4ce[_0x6d05('0x34')]=_0x17d4ce[_0x6d05('0x34')][_0x6d05('0x37')]?_0x17d4ce[_0x6d05('0x34')]:_0x10c8df[_0x6d05('0x30')];if(_0xa85508['query'][_0x6d05('0x46')]){_0x17d4ce[_0x6d05('0x47')]=[{'all':!![]}];}_0x17d4ce=_[_0x6d05('0x3e')]({},_0x17d4ce,_0xa85508[_0x6d05('0x40')]);return db['CmCompany'][_0x6d05('0x48')](_0x17d4ce)[_0x6d05('0x26')](handleEntityNotFound(_0x49bbd0,null))['then'](respondWithResult(_0x49bbd0,null))[_0x6d05('0x42')](handleError(_0x49bbd0,null));};exports[_0x6d05('0x49')]=function(_0x1cde89,_0x5f0ec2){return db['CmCompany'][_0x6d05('0x49')](_0x1cde89[_0x6d05('0x4a')],{})[_0x6d05('0x26')](function(_0x85fadb){var _0x6b3c9d=_0x1cde89['user'][_0x6d05('0x28')]({'plain':!![]});if(!_0x6b3c9d)throw new Error(_0x6d05('0x4b'));if(_0x6b3c9d[_0x6d05('0x4c')]===_0x6d05('0x4d')){var _0x1ad2a7=_0x85fadb['get']({'plain':!![]});var _0x23981f=_0x6d05('0x29');return db[_0x6d05('0x4e')][_0x6d05('0x48')]({'where':{'name':_0x23981f,'userProfileId':_0x6b3c9d[_0x6d05('0x4f')]},'raw':!![]})['then'](function(_0xf3b5b2){if(_0xf3b5b2&&_0xf3b5b2[_0x6d05('0x50')]===0x0){return db[_0x6d05('0x51')][_0x6d05('0x49')]({'name':_0x1ad2a7[_0x6d05('0x2c')],'resourceId':_0x1ad2a7['id'],'type':_0xf3b5b2[_0x6d05('0x2c')],'sectionId':_0xf3b5b2['id']},{})['then'](function(){return _0x85fadb;});}else{return _0x85fadb;}})[_0x6d05('0x42')](function(_0xc385d){logger['error'](_0x6d05('0x52'),_0xc385d);throw _0xc385d;});}return _0x85fadb;})[_0x6d05('0x26')](respondWithResult(_0x5f0ec2,0xc9))[_0x6d05('0x42')](handleError(_0x5f0ec2,null));};exports[_0x6d05('0x53')]=function(_0x2db439,_0x25b7f1){if(_0x2db439['body']['id']){delete _0x2db439['body']['id'];}return db[_0x6d05('0x2e')]['find']({'where':{'id':_0x2db439['params']['id']}})[_0x6d05('0x26')](handleEntityNotFound(_0x25b7f1,null))[_0x6d05('0x26')](saveUpdates(_0x2db439['body'],null))[_0x6d05('0x26')](respondWithResult(_0x25b7f1,null))[_0x6d05('0x42')](handleError(_0x25b7f1,null));};exports[_0x6d05('0x27')]=function(_0x2b8bb2,_0x27e08){return db[_0x6d05('0x2e')][_0x6d05('0x48')]({'where':{'id':_0x2b8bb2[_0x6d05('0x44')]['id']}})[_0x6d05('0x26')](handleEntityNotFound(_0x27e08,null))[_0x6d05('0x26')](removeEntity(_0x27e08,null))[_0x6d05('0x42')](handleError(_0x27e08,null));};exports[_0x6d05('0x2f')]=function(_0x371f22,_0x2acfb0){return db['CmCompany']['describe']()['then'](respondWithResult(_0x2acfb0,null))[_0x6d05('0x42')](handleError(_0x2acfb0,null));};exports['addContacts']=function(_0xb44b99,_0x569718,_0x1758b1){return db['CmContact'][_0x6d05('0x48')]({'where':{'id':_0xb44b99[_0x6d05('0x44')]['id']}})['then'](handleEntityNotFound(_0x569718,null))[_0x6d05('0x26')](function(_0x2c8969){if(_0x2c8969){return _0x2c8969[_0x6d05('0x54')](_0xb44b99[_0x6d05('0x4a')][_0x6d05('0x55')],_[_0x6d05('0x56')](_0xb44b99[_0x6d05('0x4a')],[_0x6d05('0x55'),'id'])||{});}})[_0x6d05('0x26')](respondWithResult(_0x569718,null))['catch'](handleError(_0x569718,null));};exports[_0x6d05('0x57')]=function(_0x4624eb,_0x1f9933,_0xb89384){var _0x59d7f2={};var _0x287232={};var _0x4015a6;var _0x5f81e;return db[_0x6d05('0x2e')][_0x6d05('0x58')]({'where':{'id':_0x4624eb[_0x6d05('0x44')]['id']}})[_0x6d05('0x26')](handleEntityNotFound(_0x1f9933,null))[_0x6d05('0x26')](function(_0x134d32){if(_0x134d32){_0x4015a6=_0x134d32;_0x287232[_0x6d05('0x30')]=_[_0x6d05('0x32')](db['CmContact']['rawAttributes']);_0x287232[_0x6d05('0x31')]=_[_0x6d05('0x32')](_0x4624eb['query']);_0x287232[_0x6d05('0x33')]=_[_0x6d05('0x35')](_0x287232[_0x6d05('0x30')],_0x287232[_0x6d05('0x31')]);_0x59d7f2[_0x6d05('0x34')]=_[_0x6d05('0x35')](_0x287232[_0x6d05('0x30')],qs['fields'](_0x4624eb[_0x6d05('0x31')]['fields']));_0x59d7f2[_0x6d05('0x34')]=_0x59d7f2['attributes'][_0x6d05('0x37')]?_0x59d7f2[_0x6d05('0x34')]:_0x287232[_0x6d05('0x30')];_0x59d7f2['order']=qs[_0x6d05('0x3a')](_0x4624eb[_0x6d05('0x31')][_0x6d05('0x3a')]);_0x59d7f2[_0x6d05('0x3b')]=qs[_0x6d05('0x33')](_[_0x6d05('0x3c')](_0x4624eb['query'],_0x287232[_0x6d05('0x33')]));if(_0x4624eb[_0x6d05('0x31')][_0x6d05('0x3d')]){_0x59d7f2[_0x6d05('0x3b')]=_['merge'](_0x59d7f2['where'],{'$or':_[_0x6d05('0x3f')](_0x59d7f2['attributes'],function(_0x1bbb55){var _0x47a31b={};_0x47a31b[_0x1bbb55]={'$like':'%'+_0x4624eb[_0x6d05('0x31')][_0x6d05('0x3d')]+'%'};return _0x47a31b;})});}_0x59d7f2=_[_0x6d05('0x3e')]({},_0x59d7f2,_0x4624eb[_0x6d05('0x40')]);return _0x4015a6['getContacts'](_0x59d7f2);}})[_0x6d05('0x26')](function(_0x58793d){if(_0x58793d){_0x5f81e=_0x58793d[_0x6d05('0x37')];if(!_0x4624eb['query']['hasOwnProperty'](_0x6d05('0x39'))){_0x59d7f2[_0x6d05('0x21')]=qs[_0x6d05('0x21')](_0x4624eb[_0x6d05('0x31')]['limit']);_0x59d7f2['offset']=qs[_0x6d05('0x20')](_0x4624eb[_0x6d05('0x31')][_0x6d05('0x20')]);}return _0x4015a6['getContacts'](_0x59d7f2);}})[_0x6d05('0x26')](function(_0x384c59){if(_0x384c59){return _0x384c59?{'count':_0x5f81e,'rows':_0x384c59}:null;}})[_0x6d05('0x26')](respondWithResult(_0x1f9933,null))[_0x6d05('0x42')](handleError(_0x1f9933,null));}; \ No newline at end of file +var _0x4f24=['limit','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','end','stack','name','send','CmCompany','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','include','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','intersection','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset'];(function(_0x34f3f7,_0x3ad6b6){var _0x3a01e3=function(_0x21292f){while(--_0x21292f){_0x34f3f7['push'](_0x34f3f7['shift']());}};_0x3a01e3(++_0x3ad6b6);}(_0x4f24,0x8c));var _0x44f2=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x4f24[_0x264545];return _0x114d10;};'use strict';var emlformat=require(_0x44f2('0x0'));var rimraf=require(_0x44f2('0x1'));var zipdir=require(_0x44f2('0x2'));var jsonpatch=require(_0x44f2('0x3'));var rp=require(_0x44f2('0x4'));var moment=require('moment');var BPromise=require(_0x44f2('0x5'));var Mustache=require(_0x44f2('0x6'));var util=require(_0x44f2('0x7'));var path=require(_0x44f2('0x8'));var sox=require(_0x44f2('0x9'));var csv=require(_0x44f2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44f2('0xb'));var _=require(_0x44f2('0xc'));var squel=require('squel');var crypto=require(_0x44f2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44f2('0xe'));var toCsv=require(_0x44f2('0xa'));var querystring=require(_0x44f2('0xf'));var Papa=require(_0x44f2('0x10'));var Redis=require('ioredis');var authService=require(_0x44f2('0x11'));var qs=require(_0x44f2('0x12'));var as=require(_0x44f2('0x13'));var hardwareService=require(_0x44f2('0x14'));var logger=require(_0x44f2('0x15'))('api');var utils=require(_0x44f2('0x16'));var config=require(_0x44f2('0x17'));var licenseUtil=require(_0x44f2('0x18'));var db=require(_0x44f2('0x19'))['db'];function respondWithStatusCode(_0x4f383b,_0x1e102a){_0x1e102a=_0x1e102a||0xcc;return function(_0x6a2f51){if(_0x6a2f51){return _0x4f383b[_0x44f2('0x1a')](_0x1e102a);}return _0x4f383b['status'](_0x1e102a)['end']();};}function respondWithResult(_0x1865fc,_0x4722b3){_0x4722b3=_0x4722b3||0xc8;return function(_0x516718){if(_0x516718){return _0x1865fc[_0x44f2('0x1b')](_0x4722b3)[_0x44f2('0x1c')](_0x516718);}};}function respondWithFilteredResult(_0x2f91b8,_0x1a1fd5){return function(_0x21b851){if(_0x21b851){var _0x5939f7=typeof _0x1a1fd5['offset']===_0x44f2('0x1d')&&typeof _0x1a1fd5['limit']===_0x44f2('0x1d');var _0x4ab32e=_0x21b851[_0x44f2('0x1e')];var _0x2d378e=_0x5939f7?0x0:_0x1a1fd5[_0x44f2('0x1f')];var _0x1bd615=_0x5939f7?_0x21b851['count']:_0x1a1fd5[_0x44f2('0x1f')]+_0x1a1fd5[_0x44f2('0x20')];var _0x435375;if(_0x1bd615>=_0x4ab32e){_0x1bd615=_0x4ab32e;_0x435375=0xc8;}else{_0x435375=0xce;}_0x2f91b8['status'](_0x435375);return _0x2f91b8['set'](_0x44f2('0x21'),_0x2d378e+'-'+_0x1bd615+'/'+_0x4ab32e)[_0x44f2('0x1c')](_0x21b851);}return null;};}function patchUpdates(_0x31434f){return function(_0x21977d){try{jsonpatch[_0x44f2('0x22')](_0x21977d,_0x31434f,!![]);}catch(_0x1580ec){return BPromise[_0x44f2('0x23')](_0x1580ec);}return _0x21977d[_0x44f2('0x24')]();};}function saveUpdates(_0x53d163,_0x268c63){return function(_0x40ab04){if(_0x40ab04){return _0x40ab04[_0x44f2('0x25')](_0x53d163)['then'](function(_0x5c860d){return _0x5c860d;});}return null;};}function removeEntity(_0x4d5eee,_0x3b2250){return function(_0x140b6e){if(_0x140b6e){return _0x140b6e[_0x44f2('0x26')]()[_0x44f2('0x27')](function(){var _0xeaffe5=_0x140b6e['get']({'plain':!![]});var _0x3eed91=_0x44f2('0x28');return db[_0x44f2('0x29')][_0x44f2('0x26')]({'where':{'type':_0x3eed91,'resourceId':_0xeaffe5['id']}})[_0x44f2('0x27')](function(){return _0x140b6e;});})[_0x44f2('0x27')](function(){_0x4d5eee['status'](0xcc)[_0x44f2('0x2a')]();});}};}function handleEntityNotFound(_0x543e3b,_0xd78045){return function(_0xa6ba5f){if(!_0xa6ba5f){_0x543e3b[_0x44f2('0x1a')](0x194);}return _0xa6ba5f;};}function handleError(_0x37cbfe,_0x28dd2c){_0x28dd2c=_0x28dd2c||0x1f4;return function(_0x4fbf74){logger['error'](_0x4fbf74[_0x44f2('0x2b')]);if(_0x4fbf74[_0x44f2('0x2c')]){delete _0x4fbf74['name'];}_0x37cbfe[_0x44f2('0x1b')](_0x28dd2c)[_0x44f2('0x2d')](_0x4fbf74);};}exports['index']=function(_0x4946fb,_0x2b056f){var _0x229428={},_0x4f478f={},_0x54f41f={'count':0x0,'rows':[]};return db[_0x44f2('0x2e')]['describe']()['then'](function(_0x2d4462){_0x4f478f[_0x44f2('0x2f')]=_[_0x44f2('0x30')](_0x2d4462);_0x4f478f[_0x44f2('0x31')]=_[_0x44f2('0x30')](_0x4946fb[_0x44f2('0x31')]);_0x4f478f[_0x44f2('0x32')]=_['intersection'](_0x4f478f[_0x44f2('0x2f')],_0x4f478f['query']);_0x229428[_0x44f2('0x33')]=_['intersection'](_0x4f478f[_0x44f2('0x2f')],qs['fields'](_0x4946fb['query']['fields']));_0x229428[_0x44f2('0x33')]=_0x229428[_0x44f2('0x33')][_0x44f2('0x34')]?_0x229428['attributes']:_0x4f478f[_0x44f2('0x2f')];if(!_0x4946fb['query'][_0x44f2('0x35')](_0x44f2('0x36'))){_0x229428[_0x44f2('0x20')]=qs['limit'](_0x4946fb['query'][_0x44f2('0x20')]);_0x229428[_0x44f2('0x1f')]=qs[_0x44f2('0x1f')](_0x4946fb[_0x44f2('0x31')][_0x44f2('0x1f')]);}_0x229428[_0x44f2('0x37')]=qs[_0x44f2('0x38')](_0x4946fb[_0x44f2('0x31')][_0x44f2('0x38')]);_0x229428[_0x44f2('0x39')]=qs['filters'](_[_0x44f2('0x3a')](_0x4946fb[_0x44f2('0x31')],_0x4f478f[_0x44f2('0x32')]),_0x2d4462);if(_0x4946fb[_0x44f2('0x31')][_0x44f2('0x3b')]){_0x229428[_0x44f2('0x39')]=_[_0x44f2('0x3c')](_0x229428[_0x44f2('0x39')],{'$or':_[_0x44f2('0x3d')](_0x229428['attributes'],function(_0xad7263){var _0x2e23d3={};_0x2e23d3[_0xad7263]={'$like':'%'+_0x4946fb[_0x44f2('0x31')]['filter']+'%'};return _0x2e23d3;})});}_0x229428=_[_0x44f2('0x3c')]({},_0x229428,_0x4946fb[_0x44f2('0x3e')]);var _0x2d728b={'where':_0x229428['where']};return db[_0x44f2('0x2e')][_0x44f2('0x1e')](_0x2d728b)['then'](function(_0x144b3e){_0x54f41f[_0x44f2('0x1e')]=_0x144b3e;if(_0x4946fb[_0x44f2('0x31')]['includeAll']){_0x229428[_0x44f2('0x3f')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x229428);})[_0x44f2('0x27')](function(_0x341145){_0x54f41f[_0x44f2('0x40')]=_0x341145;return _0x54f41f;})[_0x44f2('0x27')](respondWithFilteredResult(_0x2b056f,_0x229428))[_0x44f2('0x41')](handleError(_0x2b056f,null));})[_0x44f2('0x41')](handleError(_0x2b056f,null));};exports[_0x44f2('0x42')]=function(_0x1a95e1,_0x476e1e){var _0x39277a={'raw':![],'where':{'id':_0x1a95e1[_0x44f2('0x43')]['id']}},_0x284117={};_0x284117['model']=_[_0x44f2('0x30')](db[_0x44f2('0x2e')][_0x44f2('0x44')]);_0x284117[_0x44f2('0x31')]=_[_0x44f2('0x30')](_0x1a95e1['query']);_0x284117[_0x44f2('0x32')]=_['intersection'](_0x284117[_0x44f2('0x2f')],_0x284117[_0x44f2('0x31')]);_0x39277a['attributes']=_['intersection'](_0x284117['model'],qs[_0x44f2('0x45')](_0x1a95e1[_0x44f2('0x31')][_0x44f2('0x45')]));_0x39277a[_0x44f2('0x33')]=_0x39277a[_0x44f2('0x33')][_0x44f2('0x34')]?_0x39277a[_0x44f2('0x33')]:_0x284117[_0x44f2('0x2f')];if(_0x1a95e1[_0x44f2('0x31')][_0x44f2('0x46')]){_0x39277a['include']=[{'all':!![]}];}_0x39277a=_[_0x44f2('0x3c')]({},_0x39277a,_0x1a95e1[_0x44f2('0x3e')]);return db[_0x44f2('0x2e')][_0x44f2('0x47')](_0x39277a)[_0x44f2('0x27')](handleEntityNotFound(_0x476e1e,null))[_0x44f2('0x27')](respondWithResult(_0x476e1e,null))[_0x44f2('0x41')](handleError(_0x476e1e,null));};exports[_0x44f2('0x48')]=function(_0x22ff60,_0x38948b){return db[_0x44f2('0x2e')]['create'](_0x22ff60[_0x44f2('0x49')],{})[_0x44f2('0x27')](function(_0x2519ef){var _0x2188c3=_0x22ff60[_0x44f2('0x4a')]['get']({'plain':!![]});if(!_0x2188c3)throw new Error(_0x44f2('0x4b'));if(_0x2188c3['role']===_0x44f2('0x4a')){var _0x4ed0b2=_0x2519ef['get']({'plain':!![]});var _0x300373=_0x44f2('0x28');return db[_0x44f2('0x4c')]['find']({'where':{'name':_0x300373,'userProfileId':_0x2188c3[_0x44f2('0x4d')]},'raw':!![]})[_0x44f2('0x27')](function(_0x289cbd){if(_0x289cbd&&_0x289cbd['autoAssociation']===0x0){return db[_0x44f2('0x29')][_0x44f2('0x48')]({'name':_0x4ed0b2[_0x44f2('0x2c')],'resourceId':_0x4ed0b2['id'],'type':_0x289cbd[_0x44f2('0x2c')],'sectionId':_0x289cbd['id']},{})[_0x44f2('0x27')](function(){return _0x2519ef;});}else{return _0x2519ef;}})['catch'](function(_0x1f9914){logger['error'](_0x44f2('0x4e'),_0x1f9914);throw _0x1f9914;});}return _0x2519ef;})[_0x44f2('0x27')](respondWithResult(_0x38948b,0xc9))[_0x44f2('0x41')](handleError(_0x38948b,null));};exports[_0x44f2('0x25')]=function(_0xfdb306,_0x3dd28f){if(_0xfdb306[_0x44f2('0x49')]['id']){delete _0xfdb306['body']['id'];}return db[_0x44f2('0x2e')]['find']({'where':{'id':_0xfdb306[_0x44f2('0x43')]['id']}})[_0x44f2('0x27')](handleEntityNotFound(_0x3dd28f,null))['then'](saveUpdates(_0xfdb306[_0x44f2('0x49')],null))['then'](respondWithResult(_0x3dd28f,null))[_0x44f2('0x41')](handleError(_0x3dd28f,null));};exports[_0x44f2('0x26')]=function(_0x21b8fc,_0x4b2c95){return db[_0x44f2('0x2e')][_0x44f2('0x47')]({'where':{'id':_0x21b8fc[_0x44f2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b2c95,null))['then'](removeEntity(_0x4b2c95,null))[_0x44f2('0x41')](handleError(_0x4b2c95,null));};exports[_0x44f2('0x4f')]=function(_0x3857f5,_0xe57ba1){return db['CmCompany'][_0x44f2('0x4f')]()['then'](respondWithResult(_0xe57ba1,null))[_0x44f2('0x41')](handleError(_0xe57ba1,null));};exports[_0x44f2('0x50')]=function(_0x309bfb,_0x2b9839,_0x5cd25f){return db[_0x44f2('0x51')][_0x44f2('0x47')]({'where':{'id':_0x309bfb['params']['id']}})[_0x44f2('0x27')](handleEntityNotFound(_0x2b9839,null))[_0x44f2('0x27')](function(_0x1e2944){if(_0x1e2944){return _0x1e2944[_0x44f2('0x50')](_0x309bfb[_0x44f2('0x49')][_0x44f2('0x52')],_[_0x44f2('0x53')](_0x309bfb['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2b9839,null))[_0x44f2('0x41')](handleError(_0x2b9839,null));};exports[_0x44f2('0x54')]=function(_0x10c09d,_0x157834,_0x28a9ab){var _0x31e2fd={};var _0x166d38={};var _0x96cb71;var _0x3054a3;return db[_0x44f2('0x2e')]['findOne']({'where':{'id':_0x10c09d[_0x44f2('0x43')]['id']}})['then'](handleEntityNotFound(_0x157834,null))['then'](function(_0x4576ea){if(_0x4576ea){_0x96cb71=_0x4576ea;_0x166d38['model']=_['keys'](db[_0x44f2('0x51')][_0x44f2('0x44')]);_0x166d38[_0x44f2('0x31')]=_['keys'](_0x10c09d['query']);_0x166d38[_0x44f2('0x32')]=_[_0x44f2('0x55')](_0x166d38[_0x44f2('0x2f')],_0x166d38[_0x44f2('0x31')]);_0x31e2fd[_0x44f2('0x33')]=_[_0x44f2('0x55')](_0x166d38['model'],qs['fields'](_0x10c09d[_0x44f2('0x31')][_0x44f2('0x45')]));_0x31e2fd['attributes']=_0x31e2fd['attributes'][_0x44f2('0x34')]?_0x31e2fd[_0x44f2('0x33')]:_0x166d38[_0x44f2('0x2f')];_0x31e2fd[_0x44f2('0x37')]=qs[_0x44f2('0x38')](_0x10c09d[_0x44f2('0x31')][_0x44f2('0x38')]);_0x31e2fd[_0x44f2('0x39')]=qs['filters'](_[_0x44f2('0x3a')](_0x10c09d[_0x44f2('0x31')],_0x166d38['filters']));if(_0x10c09d[_0x44f2('0x31')][_0x44f2('0x3b')]){_0x31e2fd[_0x44f2('0x39')]=_[_0x44f2('0x3c')](_0x31e2fd[_0x44f2('0x39')],{'$or':_[_0x44f2('0x3d')](_0x31e2fd[_0x44f2('0x33')],function(_0x536612){var _0x482e18={};_0x482e18[_0x536612]={'$like':'%'+_0x10c09d[_0x44f2('0x31')][_0x44f2('0x3b')]+'%'};return _0x482e18;})});}_0x31e2fd=_[_0x44f2('0x3c')]({},_0x31e2fd,_0x10c09d[_0x44f2('0x3e')]);return _0x96cb71[_0x44f2('0x54')](_0x31e2fd);}})[_0x44f2('0x27')](function(_0x4916ad){if(_0x4916ad){_0x3054a3=_0x4916ad[_0x44f2('0x34')];if(!_0x10c09d[_0x44f2('0x31')][_0x44f2('0x35')](_0x44f2('0x36'))){_0x31e2fd['limit']=qs[_0x44f2('0x20')](_0x10c09d['query'][_0x44f2('0x20')]);_0x31e2fd[_0x44f2('0x1f')]=qs[_0x44f2('0x1f')](_0x10c09d[_0x44f2('0x31')][_0x44f2('0x1f')]);}return _0x96cb71[_0x44f2('0x54')](_0x31e2fd);}})[_0x44f2('0x27')](function(_0x72b470){if(_0x72b470){return _0x72b470?{'count':_0x3054a3,'rows':_0x72b470}:null;}})[_0x44f2('0x27')](respondWithResult(_0x157834,null))[_0x44f2('0x41')](handleError(_0x157834,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b697f41..003a7d4 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 _0x25ba=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1a011e,_0x2902c8){var _0x3a4735=function(_0xbcbec8){while(--_0xbcbec8){_0x1a011e['push'](_0x1a011e['shift']());}};_0x3a4735(++_0x2902c8);}(_0x25ba,0x1d6));var _0xa25b=function(_0x5d6bbb,_0x348707){_0x5d6bbb=_0x5d6bbb-0x0;var _0x10151c=_0x25ba[_0x5d6bbb];return _0x10151c;};'use strict';var _=require(_0xa25b('0x0'));var util=require(_0xa25b('0x1'));var logger=require(_0xa25b('0x2'))(_0xa25b('0x3'));var moment=require(_0xa25b('0x4'));var BPromise=require(_0xa25b('0x5'));var rp=require(_0xa25b('0x6'));var fs=require('fs');var path=require(_0xa25b('0x7'));var rimraf=require(_0xa25b('0x8'));var config=require(_0xa25b('0x9'));var attributes=require(_0xa25b('0xa'));module['exports']=function(_0x4d38f7,_0x2e8aa1){return _0x4d38f7[_0xa25b('0xb')](_0xa25b('0xc'),attributes,{'tableName':_0xa25b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad1=['moment','bluebird','../../config/environment','define','CmCompany','cm_companies','lodash','util'];(function(_0x3eee34,_0x2fff9a){var _0x743f86=function(_0x4c603a){while(--_0x4c603a){_0x3eee34['push'](_0x3eee34['shift']());}};_0x743f86(++_0x2fff9a);}(_0x8ad1,0xd6));var _0x18ad=function(_0x4576d5,_0x56abe6){_0x4576d5=_0x4576d5-0x0;var _0x5313ec=_0x8ad1[_0x4576d5];return _0x5313ec;};'use strict';var _=require(_0x18ad('0x0'));var util=require(_0x18ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x18ad('0x2'));var BPromise=require(_0x18ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x18ad('0x4'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x348f04,_0x1f9ea5){return _0x348f04[_0x18ad('0x5')](_0x18ad('0x6'),attributes,{'tableName':_0x18ad('0x7'),'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 638ed5a..0e9a539 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 _0x2447=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x2447,0x173));var _0x7244=function(_0xd9b5a2,_0x4b3e98){_0xd9b5a2=_0xd9b5a2-0x0;var _0x103385=_0x2447[_0xd9b5a2];return _0x103385;};'use strict';var _=require(_0x7244('0x0'));var util=require(_0x7244('0x1'));var moment=require('moment');var BPromise=require(_0x7244('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7244('0x3'));var db=require(_0x7244('0x4'))['db'];var utils=require(_0x7244('0x5'));var logger=require(_0x7244('0x6'))(_0x7244('0x7'));var config=require(_0x7244('0x8'));var jayson=require(_0x7244('0x9'));var client=jayson[_0x7244('0xa')][_0x7244('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf3f992,_0xbc222d,_0x21d8ac){return new BPromise(function(_0x51f4b7,_0x2e804e){return client[_0x7244('0xc')](_0xf3f992,_0x21d8ac)['then'](function(_0x55e1c4){logger[_0x7244('0xd')](_0x7244('0xe'),_0xbc222d,_0x7244('0xf'));logger[_0x7244('0x10')](_0x7244('0x11'),_0xbc222d,_0x7244('0xf'),JSON[_0x7244('0x12')](_0x55e1c4));if(_0x55e1c4[_0x7244('0x13')]){if(_0x55e1c4[_0x7244('0x13')]['code']===0x1f4){logger[_0x7244('0x13')](_0x7244('0xe'),_0xbc222d,_0x55e1c4['error']['message']);return _0x2e804e(_0x55e1c4[_0x7244('0x13')]['message']);}logger[_0x7244('0x13')](_0x7244('0xe'),_0xbc222d,_0x55e1c4['error']['message']);return _0x51f4b7(_0x55e1c4[_0x7244('0x13')][_0x7244('0x14')]);}else{logger[_0x7244('0xd')]('CmCompany,\x20%s,\x20%s',_0xbc222d,_0x7244('0xf'));_0x51f4b7(_0x55e1c4[_0x7244('0x15')]['message']);}})[_0x7244('0x16')](function(_0x2dfca8){logger[_0x7244('0x13')](_0x7244('0xe'),_0xbc222d,_0x2dfca8);_0x2e804e(_0x2dfca8);});});} \ No newline at end of file +var _0x6ba9=['client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cb4a9,_0x15bead){var _0x4763f6=function(_0x2e1fb1){while(--_0x2e1fb1){_0x3cb4a9['push'](_0x3cb4a9['shift']());}};_0x4763f6(++_0x15bead);}(_0x6ba9,0xf3));var _0x96ba=function(_0x5c646f,_0x4c9cbb){_0x5c646f=_0x5c646f-0x0;var _0x3c5e5f=_0x6ba9[_0x5c646f];return _0x3c5e5f;};'use strict';var _=require(_0x96ba('0x0'));var util=require(_0x96ba('0x1'));var moment=require(_0x96ba('0x2'));var BPromise=require(_0x96ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ba('0x4'));var db=require(_0x96ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96ba('0x6'))(_0x96ba('0x7'));var config=require(_0x96ba('0x8'));var jayson=require(_0x96ba('0x9'));var client=jayson[_0x96ba('0xa')][_0x96ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42cd9c,_0xc2967c,_0x35f2f9){return new BPromise(function(_0x1aeb57,_0x5d3d54){return client[_0x96ba('0xc')](_0x42cd9c,_0x35f2f9)[_0x96ba('0xd')](function(_0x59f675){logger[_0x96ba('0xe')](_0x96ba('0xf'),_0xc2967c,_0x96ba('0x10'));logger['debug'](_0x96ba('0x11'),_0xc2967c,_0x96ba('0x10'),JSON[_0x96ba('0x12')](_0x59f675));if(_0x59f675[_0x96ba('0x13')]){if(_0x59f675[_0x96ba('0x13')][_0x96ba('0x14')]===0x1f4){logger[_0x96ba('0x13')](_0x96ba('0xf'),_0xc2967c,_0x59f675[_0x96ba('0x13')]['message']);return _0x5d3d54(_0x59f675[_0x96ba('0x13')][_0x96ba('0x15')]);}logger[_0x96ba('0x13')](_0x96ba('0xf'),_0xc2967c,_0x59f675[_0x96ba('0x13')][_0x96ba('0x15')]);return _0x1aeb57(_0x59f675['error'][_0x96ba('0x15')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0xc2967c,_0x96ba('0x10'));_0x1aeb57(_0x59f675[_0x96ba('0x16')]['message']);}})['catch'](function(_0x4df0ab){logger[_0x96ba('0x13')]('CmCompany,\x20%s,\x20%s',_0xc2967c,_0x4df0ab);_0x5d3d54(_0x4df0ab);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d31cd2f..e4f3f09 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 _0x1c46=['show','/:id/contacts','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2868d4,_0x6dcbd9){var _0x126c87=function(_0x5a88fb){while(--_0x5a88fb){_0x2868d4['push'](_0x2868d4['shift']());}};_0x126c87(++_0x6dcbd9);}(_0x1c46,0x132));var _0x61c4=function(_0x1616c4,_0x5e6fd7){_0x1616c4=_0x1616c4-0x0;var _0x5675ec=_0x1c46[_0x1616c4];return _0x5675ec;};'use strict';var multer=require(_0x61c4('0x0'));var util=require(_0x61c4('0x1'));var path=require(_0x61c4('0x2'));var timeout=require(_0x61c4('0x3'));var express=require(_0x61c4('0x4'));var router=express[_0x61c4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x61c4('0x6'));var interaction=require(_0x61c4('0x7'));var config=require(_0x61c4('0x8'));var controller=require(_0x61c4('0x9'));router[_0x61c4('0xa')]('/',auth[_0x61c4('0xb')](),controller[_0x61c4('0xc')]);router['get'](_0x61c4('0xd'),auth['isAuthenticated'](),controller[_0x61c4('0xe')]);router['get'](_0x61c4('0xf'),auth[_0x61c4('0xb')](),controller[_0x61c4('0x10')]);router[_0x61c4('0xa')](_0x61c4('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0x61c4('0x12')]('/',auth[_0x61c4('0xb')](),controller[_0x61c4('0x13')]);router[_0x61c4('0x12')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['put'](_0x61c4('0xf'),auth[_0x61c4('0xb')](),controller['update']);router[_0x61c4('0x14')](_0x61c4('0xf'),auth[_0x61c4('0xb')](),controller[_0x61c4('0x15')]);module[_0x61c4('0x16')]=router; \ No newline at end of file +var _0x28fe=['/:id','show','getContacts','create','post','/:id/contacts','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./cmCompany.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x4d6a8f,_0x565271){var _0x537980=function(_0x35fb0c){while(--_0x35fb0c){_0x4d6a8f['push'](_0x4d6a8f['shift']());}};_0x537980(++_0x565271);}(_0x28fe,0x7e));var _0xe28f=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x28fe[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0xe28f('0x0'));var util=require(_0xe28f('0x1'));var path=require(_0xe28f('0x2'));var timeout=require(_0xe28f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe28f('0x4'));var auth=require(_0xe28f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe28f('0x6'));router['get']('/',auth[_0xe28f('0x7')](),controller[_0xe28f('0x8')]);router['get'](_0xe28f('0x9'),auth['isAuthenticated'](),controller[_0xe28f('0xa')]);router[_0xe28f('0xb')](_0xe28f('0xc'),auth[_0xe28f('0x7')](),controller[_0xe28f('0xd')]);router[_0xe28f('0xb')]('/:id/contacts',auth[_0xe28f('0x7')](),controller[_0xe28f('0xe')]);router['post']('/',auth[_0xe28f('0x7')](),controller[_0xe28f('0xf')]);router[_0xe28f('0x10')](_0xe28f('0x11'),auth[_0xe28f('0x7')](),controller[_0xe28f('0x12')]);router[_0xe28f('0x13')]('/:id',auth[_0xe28f('0x7')](),controller[_0xe28f('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe28f('0x15')]);module[_0xe28f('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1f214bb..2abe737 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 _0xf118=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0xf118,0xaa));var _0x8f11=function(_0x31021e,_0x248900){_0x31021e=_0x31021e-0x0;var _0x1e6fe5=_0xf118[_0x31021e];return _0x1e6fe5;};'use strict';var _=require(_0x8f11('0x0'));var Sequelize=require(_0x8f11('0x1'));module[_0x8f11('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8f11('0x3')]},'street':{'type':Sequelize[_0x8f11('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8f11('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8f11('0x3')]},'description':{'type':Sequelize[_0x8f11('0x4')]},'phone':{'type':Sequelize[_0x8f11('0x3')]},'mobile':{'type':Sequelize[_0x8f11('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8f11('0x3')]},'url':{'type':Sequelize[_0x8f11('0x3')]},'facebook':{'type':Sequelize[_0x8f11('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x8f11('0x3')]},'skype':{'type':Sequelize[_0x8f11('0x3')]},'teams':{'type':Sequelize[_0x8f11('0x3')]},'viber':{'type':Sequelize[_0x8f11('0x3')]},'line':{'type':Sequelize[_0x8f11('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x8f11('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x8f11('0x3')]},'priority':{'type':Sequelize[_0x8f11('0x5')](0x2)[_0x8f11('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8f11('0x7')],'defaultValue':Sequelize[_0x8f11('0x8')]},'dialTimezone':{'type':Sequelize[_0x8f11('0x3')]},'utcOffset':{'type':Sequelize[_0x8f11('0x5')]}}; \ No newline at end of file +var _0x9d44=['DATE','NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x979ddc,_0x3e8360){var _0x37608a=function(_0x3a543f){while(--_0x3a543f){_0x979ddc['push'](_0x979ddc['shift']());}};_0x37608a(++_0x3e8360);}(_0x9d44,0x172));var _0x49d4=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0x9d44[_0x4ded50];return _0xa92135;};'use strict';var _=require(_0x49d4('0x0'));var Sequelize=require(_0x49d4('0x1'));module[_0x49d4('0x2')]={'firstName':{'type':Sequelize[_0x49d4('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x49d4('0x3')]},'street':{'type':Sequelize[_0x49d4('0x3')]},'postalCode':{'type':Sequelize[_0x49d4('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x49d4('0x3')]},'dateOfBirth':{'type':Sequelize[_0x49d4('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x49d4('0x3')]},'fax':{'type':Sequelize[_0x49d4('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x49d4('0x3')]},'fb_data':{'type':Sequelize[_0x49d4('0x3')]},'twitter':{'type':Sequelize[_0x49d4('0x3')]},'skype':{'type':Sequelize[_0x49d4('0x3')]},'teams':{'type':Sequelize[_0x49d4('0x3')]},'viber':{'type':Sequelize[_0x49d4('0x3')]},'line':{'type':Sequelize[_0x49d4('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x49d4('0x3')]},'UserId':{'type':Sequelize[_0x49d4('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x49d4('0x4')](0x2)[_0x49d4('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x49d4('0x6')],'defaultValue':Sequelize[_0x49d4('0x7')]},'dialTimezone':{'type':Sequelize[_0x49d4('0x3')]},'utcOffset':{'type':Sequelize[_0x49d4('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3151e26..38da949 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2ea326b..df95ad7 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 _0x316b=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x2e515c,_0x4b5560){var _0x54b19f=function(_0x515cbb){while(--_0x515cbb){_0x2e515c['push'](_0x2e515c['shift']());}};_0x54b19f(++_0x4b5560);}(_0x316b,0xfe));var _0xb316=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x316b[_0x3d13bb];return _0x4b5a1b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb316('0x0'))['db'][_0xb316('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb316('0x2')](0x0);var events={'afterCreate':_0xb316('0x3'),'afterUpdate':_0xb316('0x4'),'afterDestroy':_0xb316('0x5')};function emitEvent(_0x55fdeb){return function(_0x19f26f,_0x1dac49,_0x18b6c2){CmContactEvents[_0xb316('0x6')](_0x55fdeb+':'+_0x19f26f['id'],_0x19f26f);CmContactEvents[_0xb316('0x6')](_0x55fdeb,_0x19f26f);_0x18b6c2(null);};}for(var e in events){if(events[_0xb316('0x7')](e)){var event=events[e];CmContact[_0xb316('0x8')](e,emitEvent(event));}}module[_0xb316('0x9')]=CmContactEvents; \ No newline at end of file +var _0x6909=['../../mysqldb','CmContact','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x507338,_0x79239){var _0x3b0c31=function(_0x27d125){while(--_0x27d125){_0x507338['push'](_0x507338['shift']());}};_0x3b0c31(++_0x79239);}(_0x6909,0x170));var _0x9690=function(_0x1ee03b,_0x24f12f){_0x1ee03b=_0x1ee03b-0x0;var _0x23b446=_0x6909[_0x1ee03b];return _0x23b446;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x9690('0x0'))['db'][_0x9690('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9690('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9690('0x3')};function emitEvent(_0x1cf18a){return function(_0x27c995,_0x430293,_0x3c4ec1){CmContactEvents['emit'](_0x1cf18a+':'+_0x27c995['id'],_0x27c995);CmContactEvents[_0x9690('0x4')](_0x1cf18a,_0x27c995);_0x3c4ec1(null);};}for(var e in events){if(events[_0x9690('0x5')](e)){var event=events[e];CmContact[_0x9690('0x6')](e,emitEvent(event));}}module[_0x9690('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 6180b16..e14f502 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 _0x59c0=['format','isNil','dialTimezone','findOne','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','then','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','CmHopper','cmContact,\x20afterCreate\x20','\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','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','catch','VoiceQueue','findAll','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','CmList','BlackLists','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','inspect','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','utf8mb4','models','get','cmContact','afterCreate','scheduledat'];(function(_0x4c4df5,_0x5f225d){var _0x2bd37c=function(_0x1b001c){while(--_0x1b001c){_0x4c4df5['push'](_0x4c4df5['shift']());}};_0x2bd37c(++_0x5f225d);}(_0x59c0,0x1ce));var _0x059c=function(_0x26483d,_0x12c290){_0x26483d=_0x26483d-0x0;var _0x1a2d1f=_0x59c0[_0x26483d];return _0x1a2d1f;};'use strict';var _=require(_0x059c('0x0'));var util=require('util');var logger=require(_0x059c('0x1'))('api');var moment=require(_0x059c('0x2'));var BPromise=require('bluebird');var rp=require(_0x059c('0x3'));var fs=require('fs');var path=require(_0x059c('0x4'));var rimraf=require(_0x059c('0x5'));var config=require(_0x059c('0x6'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module['exports']=function(_0x303300,_0x4401f5){return _0x303300['define'](_0x059c('0x7'),attributes,{'tableName':_0x059c('0x8'),'paranoid':!![],'indexes':[{'name':_0x059c('0x9'),'fields':[_0x059c('0x9')]},{'name':_0x059c('0xa'),'fields':[_0x059c('0xb'),'lastName',_0x059c('0x9'),_0x059c('0xc'),_0x059c('0xd'),_0x059c('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x059c('0xf'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x1928b0,_0x8bc86d,_0x44aa31){var _0x5c479e=_0x303300[_0x059c('0x10')];var _0x3b0d20=_0x1928b0[_0x059c('0x11')]({'plain':!![]});function _0x159927(){return function(_0x5ac812){logger['error'](_0x059c('0x12'),_0x059c('0x13'),util['inspect'](_0x5ac812,{'showHidden':![],'depth':null}));};}function _0x40305f(_0x30d4a7,_0x3357b7){var _0x14e452=_0x3357b7[_0x059c('0x14')]?_0x3357b7[_0x059c('0x14')]:moment()[_0x059c('0x15')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2f9585,_0x1b3c1c){if(_[_0x059c('0x16')](_0x3357b7[_0x059c('0x17')])){_0x2f9585({'ret':_0x14e452});}else{_0x5c479e['VoiceQueue'][_0x059c('0x18')]({'where':{'id':_0x30d4a7['id']}})['then'](function(_0x55cb27){if(!_[_0x059c('0x16')](_0x55cb27)){var _0x5dda3=_0x55cb27[_0x059c('0x17')];if(!_[_0x059c('0x16')](_0x5dda3)){var _0x39c38f=shared[_0x059c('0x19')];var _0xdb19f7=_0x39c38f[_0x5dda3];var _0x5029e9=_0x39c38f[_0x3357b7[_0x059c('0x17')]];if(!_[_0x059c('0x16')](_0xdb19f7)&&!_['isNil'](_0x5029e9)){var _0x55d748=_0xdb19f7[_0x059c('0x1a')]-_0x5029e9[_0x059c('0x1a')];_0x14e452=_0x3357b7['scheduledat']?_0x3357b7[_0x059c('0x14')]:moment();var _0x39227d=moment(_0x14e452)[_0x059c('0x1b')](_0x55d748,_0x059c('0x1c'));_0x2f9585({'ret':_0x39227d[_0x059c('0x15')](_0x059c('0x1d'))});}else _0x2f9585({'ret':_0x14e452});}else _0x2f9585({'ret':_0x14e452});}else{_0x2f9585({'ret':_0x14e452});}});}});return 0xa;}var _0x576ed9=function(_0x3abcd1){return new BPromise(function(_0x296ff9,_0x580e3f){_0x40305f(_0x3abcd1,_0x3b0d20)[_0x059c('0x1e')](function(_0x3ada6c){_0x3b0d20[_0x059c('0x14')]=_0x3ada6c[_0x059c('0x1f')];_0x5c479e['CmHopper'][_0x059c('0x18')]({'where':{'phone':_0x3b0d20[_0x059c('0x9')],'VoiceQueueId':_0x3abcd1['id']}})[_0x059c('0x1e')](function(_0x552bb1){if(!_[_0x059c('0x16')](_0x552bb1)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3b0d20['phone']+_0x059c('0x20')+_0x3abcd1['id']);}return _0x5c479e['CmHopper']['create']({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'priority':_0x3b0d20['priority']?_0x3b0d20[_0x059c('0x22')]:0x2,'scheduledat':_0x3b0d20[_0x059c('0x14')]?_0x3b0d20['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3b0d20[_0x059c('0x23')]?!![]:![],'callbackuniqueid':_0x3b0d20[_0x059c('0x23')]?_0x3b0d20[_0x059c('0x23')]:undefined,'callbackat':_0x3b0d20[_0x059c('0x23')]?moment()[_0x059c('0x15')](_0x059c('0x1d')):undefined,'VoiceQueueId':_0x3abcd1['id']});})['catch'](function(_0x4f24df){_0x580e3f(_0x4f24df);});});});};var _0x4a78ce=function(_0x2599eb){return new BPromise(function(_0x2a8d46,_0x2b5643){_0x40305f(_0x2599eb,_0x3b0d20)[_0x059c('0x1e')](function(_0x2f82d9){_0x3b0d20['scheduledat']=_0x2f82d9[_0x059c('0x1f')];_0x5c479e[_0x059c('0x24')][_0x059c('0x18')]({'where':{'phone':_0x3b0d20[_0x059c('0x9')],'VoiceQueueId':_0x2599eb['id']}})[_0x059c('0x1e')](function(_0x2d368b){if(!_[_0x059c('0x16')](_0x2d368b)){throw new Error(_0x059c('0x25')+_0x3b0d20['phone']+_0x059c('0x26')+_0x2599eb['id']);}return _0x5c479e['CmHopperFinal'][_0x059c('0x18')]({'where':{'calleridnum':_0x3b0d20[_0x059c('0x9')],'VoiceQueueId':_0x2599eb['id']}});})[_0x059c('0x1e')](function(_0x3cafe7){if(!_[_0x059c('0x16')](_0x3cafe7)){throw new Error(_0x059c('0x27')+_0x3b0d20[_0x059c('0x9')]+_0x059c('0x28')+_0x2599eb['id']);}return _0x5c479e[_0x059c('0x24')][_0x059c('0x29')]({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'priority':_0x3b0d20[_0x059c('0x22')]?_0x3b0d20[_0x059c('0x22')]:0x2,'scheduledat':_0x3b0d20[_0x059c('0x14')]?_0x3b0d20[_0x059c('0x14')]:moment()['format'](_0x059c('0x1d')),'callback':_0x3b0d20[_0x059c('0x23')]?!![]:![],'callbackuniqueid':_0x3b0d20[_0x059c('0x23')]?_0x3b0d20[_0x059c('0x23')]:undefined,'callbackat':_0x3b0d20['callbackUniqueid']?moment()['format'](_0x059c('0x1d')):undefined,'VoiceQueueId':_0x2599eb['id']});})['catch'](function(_0x481ed8){_0x2b5643(_0x481ed8);});});});};function _0x4f1697(){return function(_0x3898b7){logger[_0x059c('0x2a')]('cmContact',_0x059c('0x13'),util['inspect'](_0x3898b7,{'showHidden':![],'depth':null}));};}function _0x4a6262(_0x5ad3c1,_0x1d37b9){var _0x495156=_0x1d37b9[_0x059c('0x14')]?_0x1d37b9[_0x059c('0x14')]:moment()[_0x059c('0x15')](_0x059c('0x1d'));return new BPromise(function(_0x44e73a,_0x1c52bb){if(_[_0x059c('0x16')](_0x1d37b9[_0x059c('0x17')])){_0x44e73a({'ret':_0x495156});}else{_0x5c479e[_0x059c('0x2b')][_0x059c('0x18')]({'where':{'id':_0x5ad3c1['id']}})[_0x059c('0x1e')](function(_0x104cd3){if(!_[_0x059c('0x16')](_0x104cd3)){var _0xd41064=_0x104cd3['dialTimezone'];if(!_['isNil'](_0xd41064)){var _0x49f97b=shared[_0x059c('0x19')];var _0x1742a1=_0x49f97b[_0xd41064];var _0x1f6853=_0x49f97b[_0x1d37b9[_0x059c('0x17')]];if(!_[_0x059c('0x16')](_0x1742a1)&&!_[_0x059c('0x16')](_0x1f6853)){var _0x4d192b=_0x1742a1[_0x059c('0x1a')]-_0x1f6853[_0x059c('0x1a')];_0x495156=_0x1d37b9[_0x059c('0x14')]?_0x1d37b9[_0x059c('0x14')]:moment();var _0x21e124=moment(_0x495156)['add'](_0x4d192b,'minutes');_0x44e73a({'ret':_0x21e124[_0x059c('0x15')](_0x059c('0x1d'))});}else _0x44e73a({'ret':_0x495156});}else _0x44e73a({'ret':_0x495156});}else{_0x44e73a({'ret':_0x495156});}});}});return 0xa;}var _0x107ccd=function(_0x2c24f3){return new BPromise(function(_0x532fb3,_0x4d5e43){_0x4a6262(_0x2c24f3,_0x3b0d20)[_0x059c('0x1e')](function(_0x1b7d4f){_0x3b0d20[_0x059c('0x14')]=_0x1b7d4f[_0x059c('0x1f')];_0x5c479e[_0x059c('0x24')][_0x059c('0x18')]({'where':{'phone':_0x3b0d20['phone'],'CampaignId':_0x2c24f3['id']}})[_0x059c('0x1e')](function(_0x531e3c){if(!_[_0x059c('0x16')](_0x531e3c)){throw new Error(_0x059c('0x25')+_0x3b0d20[_0x059c('0x9')]+_0x059c('0x2c')+_0x2c24f3['id']);}return _0x5c479e[_0x059c('0x24')][_0x059c('0x29')]({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20['ListId'],'priority':_0x3b0d20[_0x059c('0x22')]?_0x3b0d20[_0x059c('0x22')]:0x2,'scheduledat':_0x3b0d20[_0x059c('0x14')]?_0x3b0d20[_0x059c('0x14')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3b0d20[_0x059c('0x23')]?!![]:![],'callbackuniqueid':_0x3b0d20[_0x059c('0x23')]?_0x3b0d20['callbackUniqueid']:undefined,'callbackat':_0x3b0d20[_0x059c('0x23')]?moment()[_0x059c('0x15')](_0x059c('0x1d')):undefined,'CampaignId':_0x2c24f3['id']});})['catch'](function(_0x32c961){_0x4d5e43(_0x32c961);});});});};var _0x4b74f9=function(_0x48a3c9){return new BPromise(function(_0xe7ad5e,_0x22644c){_0x4a6262(_0x48a3c9,_0x3b0d20)[_0x059c('0x1e')](function(_0x4a05b5){_0x3b0d20[_0x059c('0x14')]=_0x4a05b5[_0x059c('0x1f')];_0x5c479e[_0x059c('0x24')][_0x059c('0x18')]({'where':{'phone':_0x3b0d20[_0x059c('0x9')],'CampaignId':_0x48a3c9['id']}})['then'](function(_0x3d6b25){if(!_['isNil'](_0x3d6b25)){throw new Error(_0x059c('0x25')+_0x3b0d20['phone']+_0x059c('0x2d')+_0x48a3c9['id']);}return _0x5c479e['CmHopperFinal'][_0x059c('0x18')]({'where':{'calleridnum':_0x3b0d20[_0x059c('0x9')],'CampaignId':_0x48a3c9['id']}});})[_0x059c('0x1e')](function(_0x218d31){if(!_[_0x059c('0x16')](_0x218d31)){throw new Error(_0x059c('0x27')+_0x3b0d20['phone']+_0x059c('0x2e')+_0x48a3c9['id']);}return _0x5c479e[_0x059c('0x24')]['create']({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'priority':_0x3b0d20[_0x059c('0x22')]?_0x3b0d20[_0x059c('0x22')]:0x2,'scheduledat':_0x3b0d20[_0x059c('0x14')]?_0x3b0d20[_0x059c('0x14')]:moment()[_0x059c('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3b0d20['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3b0d20[_0x059c('0x23')]?_0x3b0d20['callbackUniqueid']:undefined,'callbackat':_0x3b0d20[_0x059c('0x23')]?moment()[_0x059c('0x15')](_0x059c('0x1d')):undefined,'CampaignId':_0x48a3c9['id']});})[_0x059c('0x2f')](function(_0x4b64e1){_0x22644c(_0x4b64e1);});});});};if(_0x3b0d20[_0x059c('0x21')]){_0x5c479e[_0x059c('0x30')][_0x059c('0x31')]({'where':{'type':'outbound'},'attributes':['id',_0x059c('0x32'),_0x059c('0x17')],'include':[{'model':_0x5c479e['CmList'],'as':_0x059c('0x33'),'where':{'id':_0x3b0d20[_0x059c('0x21')]}}]})[_0x059c('0x1e')](function(_0x379da9){if(_0x379da9){var _0x302b8e=[];for(var _0x1175b7=0x0,_0x5af21c;_0x1175b7<_0x379da9[_0x059c('0x34')];_0x1175b7+=0x1){_0x5af21c=_0x379da9[_0x1175b7][_0x059c('0x11')]({'plain':!![]});switch(_0x5af21c[_0x059c('0x32')]){case _0x059c('0x35'):_0x4a78ce(_0x5af21c)['catch'](_0x159927());break;case _0x059c('0x36'):_0x576ed9(_0x5af21c)['catch'](_0x159927());break;default:_0x4a6262(_0x5af21c,_0x3b0d20)[_0x059c('0x1e')](function(_0x3f2771){_0x3b0d20[_0x059c('0x14')]=_0x3f2771['ret'];_0x5c479e[_0x059c('0x24')]['create']({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20['ListId'],'scheduledat':_0x3b0d20['scheduledat']?_0x3b0d20[_0x059c('0x14')]:moment()[_0x059c('0x15')](_0x059c('0x1d')),'priority':_0x3b0d20[_0x059c('0x22')]?_0x3b0d20['priority']:0x2,'callback':_0x3b0d20[_0x059c('0x23')]?!![]:![],'callbackuniqueid':_0x3b0d20[_0x059c('0x23')]?_0x3b0d20[_0x059c('0x23')]:undefined,'callbackat':_0x3b0d20[_0x059c('0x23')]?moment()['format'](_0x059c('0x1d')):undefined,'VoiceQueueId':_0x5af21c['id']})[_0x059c('0x2f')](_0x159927());});}}}})[_0x059c('0x1e')](function(){return _0x5c479e[_0x059c('0x30')][_0x059c('0x31')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5c479e[_0x059c('0x37')],'as':_0x059c('0x38'),'where':{'id':_0x3b0d20['ListId']}}]})[_0x059c('0x1e')](function(_0x14fe0f){if(_0x14fe0f){var _0x245cd6=[];for(var _0x432d40=0x0,_0x2f6b3e;_0x432d40<_0x14fe0f['length'];_0x432d40+=0x1){_0x2f6b3e=_0x14fe0f[_0x432d40][_0x059c('0x11')]({'plain':!![]});_0x5c479e['CmHopperBlack'][_0x059c('0x29')]({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'VoiceQueueId':_0x2f6b3e['id']})[_0x059c('0x2f')](function(_0x49212d){logger[_0x059c('0x2a')](_0x059c('0x39'),_0x059c('0x13'),_0x49212d[_0x059c('0x3a')]);});}}});})[_0x059c('0x1e')](function(){return _0x5c479e[_0x059c('0x2b')][_0x059c('0x31')]({'attributes':['id',_0x059c('0x32'),_0x059c('0x17')],'include':[{'model':_0x5c479e[_0x059c('0x37')],'as':'Lists','where':{'id':_0x3b0d20[_0x059c('0x21')]}}]})[_0x059c('0x1e')](function(_0x3fcacf){if(_0x3fcacf){var _0x39c183=[];for(var _0x57ba01=0x0,_0x5d1e9c;_0x57ba01<_0x3fcacf['length'];_0x57ba01+=0x1){_0x5d1e9c=_0x3fcacf[_0x57ba01][_0x059c('0x11')]({'plain':!![]});switch(_0x5d1e9c['dialCheckDuplicateType']){case _0x059c('0x35'):_0x4b74f9(_0x5d1e9c)[_0x059c('0x2f')](_0x4f1697());break;case'onlyIfOpen':_0x107ccd(_0x5d1e9c)[_0x059c('0x2f')](_0x4f1697());break;default:_0x5c479e[_0x059c('0x24')][_0x059c('0x29')]({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'scheduledat':_0x3b0d20[_0x059c('0x14')]?_0x3b0d20[_0x059c('0x14')]:moment()[_0x059c('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3b0d20[_0x059c('0x22')]?_0x3b0d20['priority']:0x2,'callback':_0x3b0d20[_0x059c('0x23')]?!![]:![],'callbackuniqueid':_0x3b0d20['callbackUniqueid']?_0x3b0d20[_0x059c('0x23')]:undefined,'callbackat':_0x3b0d20[_0x059c('0x23')]?moment()['format'](_0x059c('0x1d')):undefined,'CampaignId':_0x5d1e9c['id']})[_0x059c('0x2f')](_0x4f1697());}}}});})[_0x059c('0x1e')](function(){return _0x5c479e[_0x059c('0x2b')][_0x059c('0x31')]({'attributes':['id'],'include':[{'model':_0x5c479e[_0x059c('0x37')],'as':_0x059c('0x38'),'where':{'id':_0x3b0d20['ListId']}}]})[_0x059c('0x1e')](function(_0x22aea9){if(_0x22aea9){var _0x53b402=[];for(var _0x15365e=0x0,_0xe559a;_0x15365e<_0x22aea9[_0x059c('0x34')];_0x15365e+=0x1){_0xe559a=_0x22aea9[_0x15365e]['get']({'plain':!![]});_0x5c479e['CmHopperBlack']['create']({'phone':_0x3b0d20[_0x059c('0x9')],'ContactId':_0x3b0d20['id'],'ListId':_0x3b0d20[_0x059c('0x21')],'CampaignId':_0xe559a['id']})[_0x059c('0x2f')](function(_0x18543a){logger[_0x059c('0x2a')](_0x059c('0x39'),_0x059c('0x13'),_0x18543a[_0x059c('0x3a')]);});}}});})[_0x059c('0x1e')](function(){_0x44aa31();})[_0x059c('0x2f')](function(_0x5f3fef){logger[_0x059c('0x2a')](_0x059c('0x39'),_0x059c('0x13'),_0x5f3fef['message']);_0x44aa31(_0x5f3fef);});}else{_0x44aa31(new Error(_0x059c('0x3b')));}},'afterDestroy':function(_0x2093fb,_0x566ccd,_0x5af0c0){var _0x592d01=_0x303300[_0x059c('0x10')];var _0x173a0c=_0x2093fb['get']({'plain':!![]});return _0x592d01['CmHopper'][_0x059c('0x31')]({'raw':!![],'where':{'ListId':_0x173a0c[_0x059c('0x21')],'ContactId':_0x173a0c['id']}})['then'](function(_0xa07953){if(!_[_0x059c('0x3c')](_0xa07953)){var _0x36a1a9=[];for(var _0x145ff9=0x0;_0x145ff9<_0xa07953[_0x059c('0x34')];_0x145ff9+=0x1){var _0x49d0cc=_0x592d01[_0x059c('0x24')][_0x059c('0x3d')]({'where':{'ListId':_0xa07953[_0x145ff9][_0x059c('0x21')],'ContactId':_0xa07953[_0x145ff9][_0x059c('0x3e')],'VoiceQueueId':_0xa07953[_0x145ff9][_0x059c('0x3f')],'CampaignId':_0xa07953[_0x145ff9][_0x059c('0x40')]}});_0x36a1a9[_0x059c('0x41')](_0x49d0cc);}return BPromise[_0x059c('0x42')](_0x36a1a9);}})[_0x059c('0x1e')](function(_0x24172a){logger[_0x059c('0x43')]('[CmContact][afterDestroy][Succesfull]',util[_0x059c('0x44')](_0x24172a,{'showHidden':![],'depth':null}));_0x5af0c0();})[_0x059c('0x2f')](function(_0x1752d3){logger[_0x059c('0x2a')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x1752d3,{'showHidden':![],'depth':null}));_0x5af0c0(_0x1752d3);});}}});}; \ No newline at end of file +var _0xf6ef=['findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','CmList','Lists','length','always','onlyIfOpen','outbound','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','dialCheckDuplicateType','List\x20not\x20found','models','isEmpty','ContactId','VoiceQueueId','CampaignId','push','all','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','email','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','isNil','timezones','utcOffset','minutes','ret','CmHopper'];(function(_0x5a1b87,_0x57ef4e){var _0x18cb8a=function(_0x1342a4){while(--_0x1342a4){_0x5a1b87['push'](_0x5a1b87['shift']());}};_0x18cb8a(++_0x57ef4e);}(_0xf6ef,0xfd));var _0xff6e=function(_0x1c37a5,_0x59ee51){_0x1c37a5=_0x1c37a5-0x0;var _0x389d03=_0xf6ef[_0x1c37a5];return _0x389d03;};'use strict';var _=require(_0xff6e('0x0'));var util=require(_0xff6e('0x1'));var logger=require(_0xff6e('0x2'))('api');var moment=require(_0xff6e('0x3'));var BPromise=require('bluebird');var rp=require(_0xff6e('0x4'));var fs=require('fs');var path=require(_0xff6e('0x5'));var rimraf=require(_0xff6e('0x6'));var config=require('../../config/environment');var shared=require(_0xff6e('0x7'));var attributes=require(_0xff6e('0x8'));module[_0xff6e('0x9')]=function(_0x5998ba,_0x5041b3){return _0x5998ba[_0xff6e('0xa')](_0xff6e('0xb'),attributes,{'tableName':_0xff6e('0xc'),'paranoid':!![],'indexes':[{'name':_0xff6e('0xd'),'fields':['phone']},{'name':_0xff6e('0xe'),'fields':[_0xff6e('0xf'),_0xff6e('0x10'),'phone','mobile','fax',_0xff6e('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xff6e('0x12'),'hooks':{'afterCreate':function(_0x2aadb3,_0x3de53c,_0x19c685){var _0x569017=_0x5998ba['models'];var _0x3c83ec=_0x2aadb3[_0xff6e('0x13')]({'plain':!![]});function _0x135e1b(){return function(_0x27abc7){logger[_0xff6e('0x14')](_0xff6e('0x15'),_0xff6e('0x16'),util['inspect'](_0x27abc7,{'showHidden':![],'depth':null}));};}function _0x187680(_0x1755a3,_0x26e9db){var _0x40b589=_0x26e9db[_0xff6e('0x17')]?_0x26e9db[_0xff6e('0x17')]:moment()[_0xff6e('0x18')](_0xff6e('0x19'));return new BPromise(function(_0x322716,_0x44596d){if(_['isNil'](_0x26e9db[_0xff6e('0x1a')])){_0x322716({'ret':_0x40b589});}else{_0x569017[_0xff6e('0x1b')]['findOne']({'where':{'id':_0x1755a3['id']}})[_0xff6e('0x1c')](function(_0x1c2094){if(!_[_0xff6e('0x1d')](_0x1c2094)){var _0x982099=_0x1c2094['dialTimezone'];if(!_[_0xff6e('0x1d')](_0x982099)){var _0xe1ab80=shared[_0xff6e('0x1e')];var _0x17e818=_0xe1ab80[_0x982099];var _0x318756=_0xe1ab80[_0x26e9db['dialTimezone']];if(!_[_0xff6e('0x1d')](_0x17e818)&&!_[_0xff6e('0x1d')](_0x318756)){var _0x4d818d=_0x17e818['utcOffset']-_0x318756[_0xff6e('0x1f')];_0x40b589=_0x26e9db[_0xff6e('0x17')]?_0x26e9db[_0xff6e('0x17')]:moment();var _0x418c49=moment(_0x40b589)['add'](_0x4d818d,_0xff6e('0x20'));_0x322716({'ret':_0x418c49['format'](_0xff6e('0x19'))});}else _0x322716({'ret':_0x40b589});}else _0x322716({'ret':_0x40b589});}else{_0x322716({'ret':_0x40b589});}});}});return 0xa;}var _0x58e8c3=function(_0x58b62b){return new BPromise(function(_0x26ed83,_0x3dbdb5){_0x187680(_0x58b62b,_0x3c83ec)['then'](function(_0xc95a09){_0x3c83ec[_0xff6e('0x17')]=_0xc95a09[_0xff6e('0x21')];_0x569017[_0xff6e('0x22')][_0xff6e('0x23')]({'where':{'phone':_0x3c83ec[_0xff6e('0xd')],'VoiceQueueId':_0x58b62b['id']}})[_0xff6e('0x1c')](function(_0x35262d){if(!_['isNil'](_0x35262d)){throw new Error(_0xff6e('0x24')+_0x3c83ec[_0xff6e('0xd')]+_0xff6e('0x25')+_0x58b62b['id']);}return _0x569017[_0xff6e('0x22')][_0xff6e('0x26')]({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'priority':_0x3c83ec['priority']?_0x3c83ec[_0xff6e('0x28')]:0x2,'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec['scheduledat']:moment()[_0xff6e('0x18')](_0xff6e('0x19')),'callback':_0x3c83ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c83ec[_0xff6e('0x29')]?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec['callbackUniqueid']?moment()['format'](_0xff6e('0x19')):undefined,'VoiceQueueId':_0x58b62b['id']});})[_0xff6e('0x2a')](function(_0x33e1c5){_0x3dbdb5(_0x33e1c5);});});});};var _0x4e1314=function(_0x37c7f9){return new BPromise(function(_0x4cb4eb,_0x180e98){_0x187680(_0x37c7f9,_0x3c83ec)['then'](function(_0x4877c8){_0x3c83ec[_0xff6e('0x17')]=_0x4877c8['ret'];_0x569017[_0xff6e('0x22')][_0xff6e('0x23')]({'where':{'phone':_0x3c83ec[_0xff6e('0xd')],'VoiceQueueId':_0x37c7f9['id']}})[_0xff6e('0x1c')](function(_0xb973c2){if(!_[_0xff6e('0x1d')](_0xb973c2)){throw new Error(_0xff6e('0x24')+_0x3c83ec[_0xff6e('0xd')]+_0xff6e('0x2b')+_0x37c7f9['id']);}return _0x569017[_0xff6e('0x2c')][_0xff6e('0x23')]({'where':{'calleridnum':_0x3c83ec[_0xff6e('0xd')],'VoiceQueueId':_0x37c7f9['id']}});})[_0xff6e('0x1c')](function(_0x164626){if(!_[_0xff6e('0x1d')](_0x164626)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x3c83ec[_0xff6e('0xd')]+_0xff6e('0x2d')+_0x37c7f9['id']);}return _0x569017['CmHopper']['create']({'phone':_0x3c83ec['phone'],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'priority':_0x3c83ec[_0xff6e('0x28')]?_0x3c83ec[_0xff6e('0x28')]:0x2,'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec[_0xff6e('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3c83ec[_0xff6e('0x29')]?!![]:![],'callbackuniqueid':_0x3c83ec[_0xff6e('0x29')]?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec['callbackUniqueid']?moment()[_0xff6e('0x18')](_0xff6e('0x19')):undefined,'VoiceQueueId':_0x37c7f9['id']});})[_0xff6e('0x2a')](function(_0x3a3772){_0x180e98(_0x3a3772);});});});};function _0x2ce33f(){return function(_0xa7c237){logger[_0xff6e('0x14')](_0xff6e('0x15'),_0xff6e('0x16'),util[_0xff6e('0x2e')](_0xa7c237,{'showHidden':![],'depth':null}));};}function _0x41f0e9(_0x1f5173,_0x2cbb2b){var _0x421f1f=_0x2cbb2b[_0xff6e('0x17')]?_0x2cbb2b['scheduledat']:moment()[_0xff6e('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x9f3f,_0x11159e){if(_[_0xff6e('0x1d')](_0x2cbb2b[_0xff6e('0x1a')])){_0x9f3f({'ret':_0x421f1f});}else{_0x569017['Campaign']['findOne']({'where':{'id':_0x1f5173['id']}})['then'](function(_0x28a18f){if(!_[_0xff6e('0x1d')](_0x28a18f)){var _0x50344e=_0x28a18f[_0xff6e('0x1a')];if(!_[_0xff6e('0x1d')](_0x50344e)){var _0x4c99b9=shared[_0xff6e('0x1e')];var _0x166579=_0x4c99b9[_0x50344e];var _0x3a7d41=_0x4c99b9[_0x2cbb2b[_0xff6e('0x1a')]];if(!_[_0xff6e('0x1d')](_0x166579)&&!_[_0xff6e('0x1d')](_0x3a7d41)){var _0x2cf94b=_0x166579['utcOffset']-_0x3a7d41['utcOffset'];_0x421f1f=_0x2cbb2b[_0xff6e('0x17')]?_0x2cbb2b['scheduledat']:moment();var _0x338614=moment(_0x421f1f)[_0xff6e('0x2f')](_0x2cf94b,'minutes');_0x9f3f({'ret':_0x338614['format'](_0xff6e('0x19'))});}else _0x9f3f({'ret':_0x421f1f});}else _0x9f3f({'ret':_0x421f1f});}else{_0x9f3f({'ret':_0x421f1f});}});}});return 0xa;}var _0x3b91c3=function(_0x4969b1){return new BPromise(function(_0x35866e,_0x535b72){_0x41f0e9(_0x4969b1,_0x3c83ec)[_0xff6e('0x1c')](function(_0x26f94f){_0x3c83ec['scheduledat']=_0x26f94f[_0xff6e('0x21')];_0x569017[_0xff6e('0x22')][_0xff6e('0x23')]({'where':{'phone':_0x3c83ec['phone'],'CampaignId':_0x4969b1['id']}})[_0xff6e('0x1c')](function(_0x28a303){if(!_[_0xff6e('0x1d')](_0x28a303)){throw new Error(_0xff6e('0x24')+_0x3c83ec['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x4969b1['id']);}return _0x569017[_0xff6e('0x22')]['create']({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec['ListId'],'priority':_0x3c83ec[_0xff6e('0x28')]?_0x3c83ec[_0xff6e('0x28')]:0x2,'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec['scheduledat']:moment()['format'](_0xff6e('0x19')),'callback':_0x3c83ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c83ec[_0xff6e('0x29')]?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec[_0xff6e('0x29')]?moment()[_0xff6e('0x18')](_0xff6e('0x19')):undefined,'CampaignId':_0x4969b1['id']});})[_0xff6e('0x2a')](function(_0x504f76){_0x535b72(_0x504f76);});});});};var _0x421829=function(_0x1b7ee6){return new BPromise(function(_0x45b2bf,_0x22171d){_0x41f0e9(_0x1b7ee6,_0x3c83ec)[_0xff6e('0x1c')](function(_0x18ebe7){_0x3c83ec[_0xff6e('0x17')]=_0x18ebe7['ret'];_0x569017['CmHopper'][_0xff6e('0x23')]({'where':{'phone':_0x3c83ec[_0xff6e('0xd')],'CampaignId':_0x1b7ee6['id']}})[_0xff6e('0x1c')](function(_0xe479a1){if(!_[_0xff6e('0x1d')](_0xe479a1)){throw new Error(_0xff6e('0x24')+_0x3c83ec[_0xff6e('0xd')]+_0xff6e('0x30')+_0x1b7ee6['id']);}return _0x569017[_0xff6e('0x2c')][_0xff6e('0x23')]({'where':{'calleridnum':_0x3c83ec[_0xff6e('0xd')],'CampaignId':_0x1b7ee6['id']}});})[_0xff6e('0x1c')](function(_0x1fdbb1){if(!_[_0xff6e('0x1d')](_0x1fdbb1)){throw new Error(_0xff6e('0x31')+_0x3c83ec[_0xff6e('0xd')]+_0xff6e('0x32')+_0x1b7ee6['id']);}return _0x569017[_0xff6e('0x22')][_0xff6e('0x26')]({'phone':_0x3c83ec['phone'],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'priority':_0x3c83ec[_0xff6e('0x28')]?_0x3c83ec[_0xff6e('0x28')]:0x2,'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec[_0xff6e('0x17')]:moment()[_0xff6e('0x18')](_0xff6e('0x19')),'callback':_0x3c83ec[_0xff6e('0x29')]?!![]:![],'callbackuniqueid':_0x3c83ec[_0xff6e('0x29')]?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec[_0xff6e('0x29')]?moment()[_0xff6e('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1b7ee6['id']});})[_0xff6e('0x2a')](function(_0x5999be){_0x22171d(_0x5999be);});});});};if(_0x3c83ec[_0xff6e('0x27')]){_0x569017['VoiceQueue'][_0xff6e('0x33')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0xff6e('0x1a')],'include':[{'model':_0x569017[_0xff6e('0x34')],'as':_0xff6e('0x35'),'where':{'id':_0x3c83ec[_0xff6e('0x27')]}}]})[_0xff6e('0x1c')](function(_0x46f88c){if(_0x46f88c){var _0x2a6561=[];for(var _0x3758bd=0x0,_0x1603fb;_0x3758bd<_0x46f88c[_0xff6e('0x36')];_0x3758bd+=0x1){_0x1603fb=_0x46f88c[_0x3758bd][_0xff6e('0x13')]({'plain':!![]});switch(_0x1603fb['dialCheckDuplicateType']){case _0xff6e('0x37'):_0x4e1314(_0x1603fb)[_0xff6e('0x2a')](_0x135e1b());break;case _0xff6e('0x38'):_0x58e8c3(_0x1603fb)['catch'](_0x135e1b());break;default:_0x41f0e9(_0x1603fb,_0x3c83ec)[_0xff6e('0x1c')](function(_0x260e1d){_0x3c83ec[_0xff6e('0x17')]=_0x260e1d[_0xff6e('0x21')];_0x569017[_0xff6e('0x22')]['create']({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec['scheduledat']:moment()['format'](_0xff6e('0x19')),'priority':_0x3c83ec[_0xff6e('0x28')]?_0x3c83ec[_0xff6e('0x28')]:0x2,'callback':_0x3c83ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c83ec['callbackUniqueid']?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec[_0xff6e('0x29')]?moment()[_0xff6e('0x18')](_0xff6e('0x19')):undefined,'VoiceQueueId':_0x1603fb['id']})[_0xff6e('0x2a')](_0x135e1b());});}}}})[_0xff6e('0x1c')](function(){return _0x569017['VoiceQueue'][_0xff6e('0x33')]({'where':{'type':_0xff6e('0x39')},'attributes':['id'],'include':[{'model':_0x569017[_0xff6e('0x34')],'as':_0xff6e('0x3a'),'where':{'id':_0x3c83ec[_0xff6e('0x27')]}}]})[_0xff6e('0x1c')](function(_0xfe9dba){if(_0xfe9dba){var _0x3ba321=[];for(var _0x2de3d1=0x0,_0x3585f7;_0x2de3d1<_0xfe9dba[_0xff6e('0x36')];_0x2de3d1+=0x1){_0x3585f7=_0xfe9dba[_0x2de3d1][_0xff6e('0x13')]({'plain':!![]});_0x569017[_0xff6e('0x3b')][_0xff6e('0x26')]({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'VoiceQueueId':_0x3585f7['id']})[_0xff6e('0x2a')](function(_0x209171){logger[_0xff6e('0x14')](_0xff6e('0x3c'),_0xff6e('0x16'),_0x209171[_0xff6e('0x3d')]);});}}});})[_0xff6e('0x1c')](function(){return _0x569017[_0xff6e('0x3e')][_0xff6e('0x33')]({'attributes':['id',_0xff6e('0x3f'),_0xff6e('0x1a')],'include':[{'model':_0x569017[_0xff6e('0x34')],'as':_0xff6e('0x35'),'where':{'id':_0x3c83ec[_0xff6e('0x27')]}}]})[_0xff6e('0x1c')](function(_0x256065){if(_0x256065){var _0x4569f8=[];for(var _0x4f0352=0x0,_0x3502cd;_0x4f0352<_0x256065[_0xff6e('0x36')];_0x4f0352+=0x1){_0x3502cd=_0x256065[_0x4f0352][_0xff6e('0x13')]({'plain':!![]});switch(_0x3502cd[_0xff6e('0x3f')]){case'always':_0x421829(_0x3502cd)[_0xff6e('0x2a')](_0x2ce33f());break;case _0xff6e('0x38'):_0x3b91c3(_0x3502cd)[_0xff6e('0x2a')](_0x2ce33f());break;default:_0x569017['CmHopper']['create']({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'scheduledat':_0x3c83ec[_0xff6e('0x17')]?_0x3c83ec['scheduledat']:moment()['format'](_0xff6e('0x19')),'priority':_0x3c83ec[_0xff6e('0x28')]?_0x3c83ec['priority']:0x2,'callback':_0x3c83ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c83ec[_0xff6e('0x29')]?_0x3c83ec[_0xff6e('0x29')]:undefined,'callbackat':_0x3c83ec[_0xff6e('0x29')]?moment()[_0xff6e('0x18')](_0xff6e('0x19')):undefined,'CampaignId':_0x3502cd['id']})[_0xff6e('0x2a')](_0x2ce33f());}}}});})[_0xff6e('0x1c')](function(){return _0x569017[_0xff6e('0x3e')][_0xff6e('0x33')]({'attributes':['id'],'include':[{'model':_0x569017['CmList'],'as':_0xff6e('0x3a'),'where':{'id':_0x3c83ec[_0xff6e('0x27')]}}]})[_0xff6e('0x1c')](function(_0xdf1cbd){if(_0xdf1cbd){var _0x4d24d4=[];for(var _0xc51805=0x0,_0x122371;_0xc51805<_0xdf1cbd['length'];_0xc51805+=0x1){_0x122371=_0xdf1cbd[_0xc51805][_0xff6e('0x13')]({'plain':!![]});_0x569017['CmHopperBlack']['create']({'phone':_0x3c83ec[_0xff6e('0xd')],'ContactId':_0x3c83ec['id'],'ListId':_0x3c83ec[_0xff6e('0x27')],'CampaignId':_0x122371['id']})[_0xff6e('0x2a')](function(_0x72bac){logger[_0xff6e('0x14')](_0xff6e('0x3c'),_0xff6e('0x16'),_0x72bac[_0xff6e('0x3d')]);});}}});})[_0xff6e('0x1c')](function(){_0x19c685();})[_0xff6e('0x2a')](function(_0x53fbaa){logger[_0xff6e('0x14')](_0xff6e('0x3c'),_0xff6e('0x16'),_0x53fbaa[_0xff6e('0x3d')]);_0x19c685(_0x53fbaa);});}else{_0x19c685(new Error(_0xff6e('0x40')));}},'afterDestroy':function(_0x279cd6,_0x4e44a2,_0x1042c2){var _0x328192=_0x5998ba[_0xff6e('0x41')];var _0xbc9673=_0x279cd6[_0xff6e('0x13')]({'plain':!![]});return _0x328192['CmHopper'][_0xff6e('0x33')]({'raw':!![],'where':{'ListId':_0xbc9673[_0xff6e('0x27')],'ContactId':_0xbc9673['id']}})[_0xff6e('0x1c')](function(_0x2237cb){if(!_[_0xff6e('0x42')](_0x2237cb)){var _0xc62f0=[];for(var _0x3b052c=0x0;_0x3b052c<_0x2237cb['length'];_0x3b052c+=0x1){var _0x2c1ff3=_0x328192['CmHopper']['destroy']({'where':{'ListId':_0x2237cb[_0x3b052c][_0xff6e('0x27')],'ContactId':_0x2237cb[_0x3b052c][_0xff6e('0x43')],'VoiceQueueId':_0x2237cb[_0x3b052c][_0xff6e('0x44')],'CampaignId':_0x2237cb[_0x3b052c][_0xff6e('0x45')]}});_0xc62f0[_0xff6e('0x46')](_0x2c1ff3);}return BPromise[_0xff6e('0x47')](_0xc62f0);}})['then'](function(_0x33b943){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xff6e('0x2e')](_0x33b943,{'showHidden':![],'depth':null}));_0x1042c2();})[_0xff6e('0x2a')](function(_0x2f3cd6){logger[_0xff6e('0x14')]('[CmContact][afterDestroy][Error]',util[_0xff6e('0x2e')](_0x2f3cd6,{'showHidden':![],'depth':null}));_0x1042c2(_0x2f3cd6);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 74c8cf4..2057c1d 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x53755c,_0x25a312){var _0x400533=function(_0x38dd40){while(--_0x38dd40){_0x53755c['push'](_0x53755c['shift']());}};_0x400533(++_0x25a312);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x594afa,_0x5735e6){var _0x529c43=function(_0x4b5a5b){while(--_0x4b5a5b){_0x594afa['push'](_0x594afa['shift']());}};_0x529c43(++_0x5735e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 b7fb225..da801c4 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 _0x949d=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x3a8a93,_0x91d782){var _0x223d43=function(_0x1c41a6){while(--_0x1c41a6){_0x3a8a93['push'](_0x3a8a93['shift']());}};_0x223d43(++_0x91d782);}(_0x949d,0x162));var _0xd949=function(_0x27df51,_0x194d8b){_0x27df51=_0x27df51-0x0;var _0x2a76a0=_0x949d[_0x27df51];return _0x2a76a0;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'CmContactId':{'type':Sequelize[_0xd949('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd949('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd949('0x4')},'OrderBy':{'type':Sequelize[_0xd949('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xf4dd=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4dd,0xb4));var _0xdf4d=function(_0xdd8d43,_0x26147b){_0xdd8d43=_0xdd8d43-0x0;var _0x2abf27=_0xf4dd[_0xdd8d43];return _0x2abf27;};'use strict';var Sequelize=require(_0xdf4d('0x0'));module[_0xdf4d('0x1')]={'CmContactId':{'type':Sequelize[_0xdf4d('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdf4d('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdf4d('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xdf4d('0x3')],'defaultValue':_0xdf4d('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xdf4d('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 4270715..60b641c 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 _0x66a0=['eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x66a0,0x98));var _0x066a=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x66a0[_0x1afabf];return _0x497ff1;};'use strict';var emlformat=require(_0x066a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x066a('0x1'));var moment=require('moment');var BPromise=require(_0x066a('0x2'));var Mustache=require(_0x066a('0x3'));var util=require(_0x066a('0x4'));var path=require(_0x066a('0x5'));var sox=require(_0x066a('0x6'));var csv=require(_0x066a('0x7'));var ejs=require(_0x066a('0x8'));var fs=require('fs');var fs_extra=require(_0x066a('0x9'));var _=require(_0x066a('0xa'));var squel=require('squel');var crypto=require(_0x066a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x066a('0x7'));var querystring=require(_0x066a('0xc'));var Papa=require(_0x066a('0xd'));var Redis=require(_0x066a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x066a('0xf'));var logger=require(_0x066a('0x10'))('api');var utils=require(_0x066a('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x066a('0x12'))['db'];function respondWithStatusCode(_0x118bc0,_0x40ebaa){_0x40ebaa=_0x40ebaa||0xcc;return function(_0x3548d2){if(_0x3548d2){return _0x118bc0['sendStatus'](_0x40ebaa);}return _0x118bc0[_0x066a('0x13')](_0x40ebaa)[_0x066a('0x14')]();};}function respondWithResult(_0x3bc915,_0x20e563){_0x20e563=_0x20e563||0xc8;return function(_0x129b55){if(_0x129b55){return _0x3bc915[_0x066a('0x13')](_0x20e563)['json'](_0x129b55);}};}function respondWithFilteredResult(_0x75a526,_0x35e4d6){return function(_0x4c6c36){if(_0x4c6c36){var _0x3dc159=typeof _0x35e4d6[_0x066a('0x15')]===_0x066a('0x16')&&typeof _0x35e4d6[_0x066a('0x17')]===_0x066a('0x16');var _0x566bf1=_0x4c6c36['count'];var _0x22488c=_0x3dc159?0x0:_0x35e4d6['offset'];var _0x19d0b9=_0x3dc159?_0x4c6c36[_0x066a('0x18')]:_0x35e4d6[_0x066a('0x15')]+_0x35e4d6[_0x066a('0x17')];var _0x36e80c;if(_0x19d0b9>=_0x566bf1){_0x19d0b9=_0x566bf1;_0x36e80c=0xc8;}else{_0x36e80c=0xce;}_0x75a526[_0x066a('0x13')](_0x36e80c);return _0x75a526[_0x066a('0x19')](_0x066a('0x1a'),_0x22488c+'-'+_0x19d0b9+'/'+_0x566bf1)[_0x066a('0x1b')](_0x4c6c36);}return null;};}function patchUpdates(_0x361227){return function(_0x26a999){try{jsonpatch[_0x066a('0x1c')](_0x26a999,_0x361227,!![]);}catch(_0x421a6f){return BPromise[_0x066a('0x1d')](_0x421a6f);}return _0x26a999['save']();};}function saveUpdates(_0x5c6f31,_0x18d0ee){return function(_0x2045b1){if(_0x2045b1){return _0x2045b1[_0x066a('0x1e')](_0x5c6f31)['then'](function(_0x2518f4){return _0x2518f4;});}return null;};}function removeEntity(_0x4a8412,_0x403922){return function(_0x38740f){if(_0x38740f){return _0x38740f[_0x066a('0x1f')]()[_0x066a('0x20')](function(){var _0x3571fd=_0x38740f[_0x066a('0x21')]({'plain':!![]});var _0x5b977a=_0x066a('0x22');return db[_0x066a('0x23')]['destroy']({'where':{'type':_0x5b977a,'resourceId':_0x3571fd['id']}})[_0x066a('0x20')](function(){return _0x38740f;});})[_0x066a('0x20')](function(){_0x4a8412[_0x066a('0x13')](0xcc)[_0x066a('0x14')]();});}};}function handleEntityNotFound(_0x4ccee0,_0x26366d){return function(_0x15b8d5){if(!_0x15b8d5){_0x4ccee0[_0x066a('0x24')](0x194);}return _0x15b8d5;};}function handleError(_0x3dab9f,_0x5d8c7d){_0x5d8c7d=_0x5d8c7d||0x1f4;return function(_0x4b9bed){logger[_0x066a('0x25')](_0x4b9bed[_0x066a('0x26')]);if(_0x4b9bed[_0x066a('0x27')]){delete _0x4b9bed[_0x066a('0x27')];}_0x3dab9f[_0x066a('0x13')](_0x5d8c7d)['send'](_0x4b9bed);};}exports[_0x066a('0x28')]=function(_0x939956,_0x166a69){var _0x27dd2d={},_0x3baee8={},_0x221165={'count':0x0,'rows':[]};var _0x3e9c1e=_[_0x066a('0x29')](db[_0x066a('0x2a')][_0x066a('0x2b')],function(_0x4bc61a){return{'name':_0x4bc61a[_0x066a('0x2c')],'type':_0x4bc61a[_0x066a('0x2d')]['key']};});_0x3baee8[_0x066a('0x2e')]=_['map'](_0x3e9c1e,_0x066a('0x27'));_0x3baee8[_0x066a('0x2f')]=_['keys'](_0x939956[_0x066a('0x2f')]);_0x3baee8[_0x066a('0x30')]=_[_0x066a('0x31')](_0x3baee8['model'],_0x3baee8[_0x066a('0x2f')]);_0x27dd2d['attributes']=_[_0x066a('0x31')](_0x3baee8[_0x066a('0x2e')],qs[_0x066a('0x32')](_0x939956[_0x066a('0x2f')][_0x066a('0x32')]));_0x27dd2d[_0x066a('0x33')]=_0x27dd2d[_0x066a('0x33')][_0x066a('0x34')]?_0x27dd2d[_0x066a('0x33')]:_0x3baee8[_0x066a('0x2e')];if(!_0x939956[_0x066a('0x2f')]['hasOwnProperty']('nolimit')){_0x27dd2d[_0x066a('0x17')]=qs['limit'](_0x939956[_0x066a('0x2f')]['limit']);_0x27dd2d[_0x066a('0x15')]=qs[_0x066a('0x15')](_0x939956['query'][_0x066a('0x15')]);}_0x27dd2d[_0x066a('0x35')]=qs[_0x066a('0x36')](_0x939956[_0x066a('0x2f')]['sort']);_0x27dd2d[_0x066a('0x37')]=qs[_0x066a('0x30')](_[_0x066a('0x38')](_0x939956['query'],_0x3baee8[_0x066a('0x30')]),_0x3e9c1e);if(_0x939956[_0x066a('0x2f')][_0x066a('0x39')]){_0x27dd2d[_0x066a('0x37')]=_[_0x066a('0x3a')](_0x27dd2d[_0x066a('0x37')],{'$or':_['map'](_0x3e9c1e,function(_0xe10cb0){if(_0xe10cb0['type']!==_0x066a('0x3b')){var _0x57e84b={};_0x57e84b[_0xe10cb0[_0x066a('0x27')]]={'$like':'%'+_0x939956[_0x066a('0x2f')]['filter']+'%'};return _0x57e84b;}})});}_0x27dd2d=_['merge']({},_0x27dd2d,_0x939956[_0x066a('0x3c')]);var _0x2abecf={'where':_0x27dd2d['where']};return db[_0x066a('0x2a')][_0x066a('0x18')](_0x2abecf)[_0x066a('0x20')](function(_0x4355b8){_0x221165[_0x066a('0x18')]=_0x4355b8;if(_0x939956[_0x066a('0x2f')][_0x066a('0x3d')]){_0x27dd2d['include']=[{'all':!![]}];}return db[_0x066a('0x2a')][_0x066a('0x3e')](_0x27dd2d);})[_0x066a('0x20')](function(_0x1f2d25){_0x221165[_0x066a('0x3f')]=_0x1f2d25;return _0x221165;})[_0x066a('0x20')](respondWithFilteredResult(_0x166a69,_0x27dd2d))[_0x066a('0x40')](handleError(_0x166a69,null));};exports[_0x066a('0x41')]=function(_0x37ec97,_0xf38c7b){var _0x2c058e={'raw':!![],'where':{'id':_0x37ec97[_0x066a('0x42')]['id']}},_0x270904={};_0x270904['model']=_[_0x066a('0x43')](db['CmContactHasItem'][_0x066a('0x2b')]);_0x270904['query']=_[_0x066a('0x43')](_0x37ec97[_0x066a('0x2f')]);_0x270904[_0x066a('0x30')]=_[_0x066a('0x31')](_0x270904['model'],_0x270904[_0x066a('0x2f')]);_0x2c058e[_0x066a('0x33')]=_[_0x066a('0x31')](_0x270904[_0x066a('0x2e')],qs['fields'](_0x37ec97[_0x066a('0x2f')][_0x066a('0x32')]));_0x2c058e[_0x066a('0x33')]=_0x2c058e['attributes']['length']?_0x2c058e[_0x066a('0x33')]:_0x270904[_0x066a('0x2e')];if(_0x37ec97[_0x066a('0x2f')]['includeAll']){_0x2c058e['include']=[{'all':!![]}];}_0x2c058e=_[_0x066a('0x3a')]({},_0x2c058e,_0x37ec97[_0x066a('0x3c')]);return db[_0x066a('0x2a')][_0x066a('0x44')](_0x2c058e)[_0x066a('0x20')](handleEntityNotFound(_0xf38c7b,null))[_0x066a('0x20')](respondWithResult(_0xf38c7b,null))[_0x066a('0x40')](handleError(_0xf38c7b,null));};exports[_0x066a('0x45')]=function(_0x122fe0,_0x3d276d){return db['CmContactHasItem']['create'](_0x122fe0[_0x066a('0x46')],{})[_0x066a('0x20')](function(_0x28e5b5){var _0x482203=_0x122fe0['user'][_0x066a('0x21')]({'plain':!![]});if(!_0x482203)throw new Error(_0x066a('0x47'));if(_0x482203['role']===_0x066a('0x48')){var _0x1bece5=_0x28e5b5[_0x066a('0x21')]({'plain':!![]});var _0x46e708=_0x066a('0x22');return db['UserProfileSection'][_0x066a('0x44')]({'where':{'name':_0x46e708,'userProfileId':_0x482203[_0x066a('0x49')]},'raw':!![]})['then'](function(_0x12386b){if(_0x12386b&&_0x12386b[_0x066a('0x4a')]===0x0){return db[_0x066a('0x23')]['create']({'name':_0x1bece5['name'],'resourceId':_0x1bece5['id'],'type':_0x12386b[_0x066a('0x27')],'sectionId':_0x12386b['id']},{})['then'](function(){return _0x28e5b5;});}else{return _0x28e5b5;}})[_0x066a('0x40')](function(_0x57d7ed){logger[_0x066a('0x25')](_0x066a('0x4b'),_0x57d7ed);throw _0x57d7ed;});}return _0x28e5b5;})[_0x066a('0x20')](respondWithResult(_0x3d276d,0xc9))['catch'](handleError(_0x3d276d,null));};exports[_0x066a('0x1e')]=function(_0x224f56,_0xd641b7){if(_0x224f56['body']['id']){delete _0x224f56[_0x066a('0x46')]['id'];}return db[_0x066a('0x2a')][_0x066a('0x44')]({'where':{'id':_0x224f56[_0x066a('0x42')]['id']}})[_0x066a('0x20')](handleEntityNotFound(_0xd641b7,null))[_0x066a('0x20')](saveUpdates(_0x224f56[_0x066a('0x46')],null))['then'](respondWithResult(_0xd641b7,null))[_0x066a('0x40')](handleError(_0xd641b7,null));};exports['destroy']=function(_0x5965f2,_0x430df1){return db[_0x066a('0x2a')]['find']({'where':{'id':_0x5965f2[_0x066a('0x42')]['id']}})[_0x066a('0x20')](handleEntityNotFound(_0x430df1,null))[_0x066a('0x20')](removeEntity(_0x430df1,null))[_0x066a('0x40')](handleError(_0x430df1,null));}; \ No newline at end of file +var _0x5fff=['../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','stack','name','index','map','CmContactHasItem','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','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'];(function(_0x26ede0,_0x4c3c91){var _0x34c5b3=function(_0x890daf){while(--_0x890daf){_0x26ede0['push'](_0x26ede0['shift']());}};_0x34c5b3(++_0x4c3c91);}(_0x5fff,0x131));var _0xf5ff=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x5fff[_0x2aec52];return _0x3b8835;};'use strict';var emlformat=require(_0xf5ff('0x0'));var rimraf=require(_0xf5ff('0x1'));var zipdir=require(_0xf5ff('0x2'));var jsonpatch=require(_0xf5ff('0x3'));var rp=require('request-promise');var moment=require(_0xf5ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf5ff('0x5'));var util=require(_0xf5ff('0x6'));var path=require(_0xf5ff('0x7'));var sox=require(_0xf5ff('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5ff('0x9'));var _=require(_0xf5ff('0xa'));var squel=require(_0xf5ff('0xb'));var crypto=require(_0xf5ff('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf5ff('0xd'));var querystring=require(_0xf5ff('0xe'));var Papa=require(_0xf5ff('0xf'));var Redis=require(_0xf5ff('0x10'));var authService=require(_0xf5ff('0x11'));var qs=require(_0xf5ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5ff('0x13'));var logger=require(_0xf5ff('0x14'))('api');var utils=require(_0xf5ff('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5ff('0x16'));var db=require(_0xf5ff('0x17'))['db'];function respondWithStatusCode(_0x30c11e,_0x3102d2){_0x3102d2=_0x3102d2||0xcc;return function(_0x230c03){if(_0x230c03){return _0x30c11e[_0xf5ff('0x18')](_0x3102d2);}return _0x30c11e['status'](_0x3102d2)[_0xf5ff('0x19')]();};}function respondWithResult(_0x4e5748,_0xc1d03c){_0xc1d03c=_0xc1d03c||0xc8;return function(_0x305227){if(_0x305227){return _0x4e5748['status'](_0xc1d03c)['json'](_0x305227);}};}function respondWithFilteredResult(_0x2c2929,_0x3f2cf0){return function(_0x4ff912){if(_0x4ff912){var _0x5cdfec=typeof _0x3f2cf0[_0xf5ff('0x1a')]===_0xf5ff('0x1b')&&typeof _0x3f2cf0[_0xf5ff('0x1c')]===_0xf5ff('0x1b');var _0x349ad3=_0x4ff912['count'];var _0x42423e=_0x5cdfec?0x0:_0x3f2cf0[_0xf5ff('0x1a')];var _0x34aee4=_0x5cdfec?_0x4ff912[_0xf5ff('0x1d')]:_0x3f2cf0['offset']+_0x3f2cf0['limit'];var _0x509f0e;if(_0x34aee4>=_0x349ad3){_0x34aee4=_0x349ad3;_0x509f0e=0xc8;}else{_0x509f0e=0xce;}_0x2c2929[_0xf5ff('0x1e')](_0x509f0e);return _0x2c2929['set'](_0xf5ff('0x1f'),_0x42423e+'-'+_0x34aee4+'/'+_0x349ad3)[_0xf5ff('0x20')](_0x4ff912);}return null;};}function patchUpdates(_0x26cf39){return function(_0xe97424){try{jsonpatch[_0xf5ff('0x21')](_0xe97424,_0x26cf39,!![]);}catch(_0x5d6551){return BPromise[_0xf5ff('0x22')](_0x5d6551);}return _0xe97424[_0xf5ff('0x23')]();};}function saveUpdates(_0x3afadf,_0x51b82b){return function(_0x3566f2){if(_0x3566f2){return _0x3566f2[_0xf5ff('0x24')](_0x3afadf)[_0xf5ff('0x25')](function(_0x3bad7d){return _0x3bad7d;});}return null;};}function removeEntity(_0x1f811d,_0x1322e0){return function(_0x20d87a){if(_0x20d87a){return _0x20d87a[_0xf5ff('0x26')]()[_0xf5ff('0x25')](function(){var _0x32353f=_0x20d87a[_0xf5ff('0x27')]({'plain':!![]});var _0x463df4=_0xf5ff('0x28');return db[_0xf5ff('0x29')][_0xf5ff('0x26')]({'where':{'type':_0x463df4,'resourceId':_0x32353f['id']}})[_0xf5ff('0x25')](function(){return _0x20d87a;});})['then'](function(){_0x1f811d[_0xf5ff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6de5,_0x2d0851){return function(_0x3552bf){if(!_0x3552bf){_0x4a6de5[_0xf5ff('0x18')](0x194);}return _0x3552bf;};}function handleError(_0x583a1b,_0x190627){_0x190627=_0x190627||0x1f4;return function(_0xb296d7){logger['error'](_0xb296d7[_0xf5ff('0x2a')]);if(_0xb296d7[_0xf5ff('0x2b')]){delete _0xb296d7[_0xf5ff('0x2b')];}_0x583a1b[_0xf5ff('0x1e')](_0x190627)['send'](_0xb296d7);};}exports[_0xf5ff('0x2c')]=function(_0x48a945,_0x30f762){var _0x413f8e={},_0x132443={},_0x1a703c={'count':0x0,'rows':[]};var _0x2508bb=_[_0xf5ff('0x2d')](db[_0xf5ff('0x2e')]['rawAttributes'],function(_0x3372ee){return{'name':_0x3372ee[_0xf5ff('0x2f')],'type':_0x3372ee['type'][_0xf5ff('0x30')]};});_0x132443['model']=_[_0xf5ff('0x2d')](_0x2508bb,_0xf5ff('0x2b'));_0x132443['query']=_[_0xf5ff('0x31')](_0x48a945[_0xf5ff('0x32')]);_0x132443[_0xf5ff('0x33')]=_[_0xf5ff('0x34')](_0x132443['model'],_0x132443[_0xf5ff('0x32')]);_0x413f8e[_0xf5ff('0x35')]=_['intersection'](_0x132443[_0xf5ff('0x36')],qs[_0xf5ff('0x37')](_0x48a945[_0xf5ff('0x32')][_0xf5ff('0x37')]));_0x413f8e[_0xf5ff('0x35')]=_0x413f8e['attributes'][_0xf5ff('0x38')]?_0x413f8e['attributes']:_0x132443['model'];if(!_0x48a945['query'][_0xf5ff('0x39')](_0xf5ff('0x3a'))){_0x413f8e[_0xf5ff('0x1c')]=qs[_0xf5ff('0x1c')](_0x48a945[_0xf5ff('0x32')][_0xf5ff('0x1c')]);_0x413f8e[_0xf5ff('0x1a')]=qs[_0xf5ff('0x1a')](_0x48a945[_0xf5ff('0x32')][_0xf5ff('0x1a')]);}_0x413f8e[_0xf5ff('0x3b')]=qs[_0xf5ff('0x3c')](_0x48a945[_0xf5ff('0x32')][_0xf5ff('0x3c')]);_0x413f8e[_0xf5ff('0x3d')]=qs[_0xf5ff('0x33')](_['pick'](_0x48a945[_0xf5ff('0x32')],_0x132443[_0xf5ff('0x33')]),_0x2508bb);if(_0x48a945['query']['filter']){_0x413f8e[_0xf5ff('0x3d')]=_[_0xf5ff('0x3e')](_0x413f8e[_0xf5ff('0x3d')],{'$or':_[_0xf5ff('0x2d')](_0x2508bb,function(_0x23c7dc){if(_0x23c7dc[_0xf5ff('0x3f')]!==_0xf5ff('0x40')){var _0x21a8c1={};_0x21a8c1[_0x23c7dc[_0xf5ff('0x2b')]]={'$like':'%'+_0x48a945['query'][_0xf5ff('0x41')]+'%'};return _0x21a8c1;}})});}_0x413f8e=_[_0xf5ff('0x3e')]({},_0x413f8e,_0x48a945[_0xf5ff('0x42')]);var _0x528780={'where':_0x413f8e['where']};return db[_0xf5ff('0x2e')][_0xf5ff('0x1d')](_0x528780)[_0xf5ff('0x25')](function(_0x59b371){_0x1a703c[_0xf5ff('0x1d')]=_0x59b371;if(_0x48a945[_0xf5ff('0x32')]['includeAll']){_0x413f8e[_0xf5ff('0x43')]=[{'all':!![]}];}return db[_0xf5ff('0x2e')]['findAll'](_0x413f8e);})[_0xf5ff('0x25')](function(_0x147b64){_0x1a703c[_0xf5ff('0x44')]=_0x147b64;return _0x1a703c;})[_0xf5ff('0x25')](respondWithFilteredResult(_0x30f762,_0x413f8e))[_0xf5ff('0x45')](handleError(_0x30f762,null));};exports['show']=function(_0x331fbf,_0x8ec386){var _0x171c08={'raw':!![],'where':{'id':_0x331fbf[_0xf5ff('0x46')]['id']}},_0x76f308={};_0x76f308[_0xf5ff('0x36')]=_[_0xf5ff('0x31')](db[_0xf5ff('0x2e')][_0xf5ff('0x47')]);_0x76f308[_0xf5ff('0x32')]=_[_0xf5ff('0x31')](_0x331fbf[_0xf5ff('0x32')]);_0x76f308[_0xf5ff('0x33')]=_[_0xf5ff('0x34')](_0x76f308[_0xf5ff('0x36')],_0x76f308[_0xf5ff('0x32')]);_0x171c08[_0xf5ff('0x35')]=_['intersection'](_0x76f308[_0xf5ff('0x36')],qs[_0xf5ff('0x37')](_0x331fbf[_0xf5ff('0x32')][_0xf5ff('0x37')]));_0x171c08[_0xf5ff('0x35')]=_0x171c08[_0xf5ff('0x35')][_0xf5ff('0x38')]?_0x171c08[_0xf5ff('0x35')]:_0x76f308[_0xf5ff('0x36')];if(_0x331fbf[_0xf5ff('0x32')][_0xf5ff('0x48')]){_0x171c08['include']=[{'all':!![]}];}_0x171c08=_['merge']({},_0x171c08,_0x331fbf[_0xf5ff('0x42')]);return db[_0xf5ff('0x2e')][_0xf5ff('0x49')](_0x171c08)[_0xf5ff('0x25')](handleEntityNotFound(_0x8ec386,null))[_0xf5ff('0x25')](respondWithResult(_0x8ec386,null))['catch'](handleError(_0x8ec386,null));};exports['create']=function(_0x47053f,_0x185ba8){return db[_0xf5ff('0x2e')][_0xf5ff('0x4a')](_0x47053f['body'],{})[_0xf5ff('0x25')](function(_0x244df5){var _0x546df1=_0x47053f[_0xf5ff('0x4b')][_0xf5ff('0x27')]({'plain':!![]});if(!_0x546df1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x546df1[_0xf5ff('0x4c')]===_0xf5ff('0x4b')){var _0x55b408=_0x244df5[_0xf5ff('0x27')]({'plain':!![]});var _0x20316c=_0xf5ff('0x28');return db[_0xf5ff('0x4d')]['find']({'where':{'name':_0x20316c,'userProfileId':_0x546df1[_0xf5ff('0x4e')]},'raw':!![]})[_0xf5ff('0x25')](function(_0x520a84){if(_0x520a84&&_0x520a84[_0xf5ff('0x4f')]===0x0){return db[_0xf5ff('0x29')][_0xf5ff('0x4a')]({'name':_0x55b408[_0xf5ff('0x2b')],'resourceId':_0x55b408['id'],'type':_0x520a84[_0xf5ff('0x2b')],'sectionId':_0x520a84['id']},{})[_0xf5ff('0x25')](function(){return _0x244df5;});}else{return _0x244df5;}})['catch'](function(_0x39e3dc){logger['error'](_0xf5ff('0x50'),_0x39e3dc);throw _0x39e3dc;});}return _0x244df5;})[_0xf5ff('0x25')](respondWithResult(_0x185ba8,0xc9))[_0xf5ff('0x45')](handleError(_0x185ba8,null));};exports['update']=function(_0x5423c2,_0x518e9b){if(_0x5423c2[_0xf5ff('0x51')]['id']){delete _0x5423c2['body']['id'];}return db[_0xf5ff('0x2e')][_0xf5ff('0x49')]({'where':{'id':_0x5423c2[_0xf5ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x518e9b,null))[_0xf5ff('0x25')](saveUpdates(_0x5423c2[_0xf5ff('0x51')],null))[_0xf5ff('0x25')](respondWithResult(_0x518e9b,null))[_0xf5ff('0x45')](handleError(_0x518e9b,null));};exports[_0xf5ff('0x26')]=function(_0x5da9ef,_0x533269){return db[_0xf5ff('0x2e')][_0xf5ff('0x49')]({'where':{'id':_0x5da9ef[_0xf5ff('0x46')]['id']}})[_0xf5ff('0x25')](handleEntityNotFound(_0x533269,null))[_0xf5ff('0x25')](removeEntity(_0x533269,null))['catch'](handleError(_0x533269,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 47e3949..509c3d6 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 _0xc034=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','CmContactHasItem'];(function(_0x5b7ef6,_0x3eb41d){var _0x3ad09c=function(_0x15a92d){while(--_0x15a92d){_0x5b7ef6['push'](_0x5b7ef6['shift']());}};_0x3ad09c(++_0x3eb41d);}(_0xc034,0x1b9));var _0x4c03=function(_0x46aa1d,_0x5421bc){_0x46aa1d=_0x46aa1d-0x0;var _0x49905c=_0xc034[_0x46aa1d];return _0x49905c;};'use strict';var _=require(_0x4c03('0x0'));var util=require('util');var logger=require(_0x4c03('0x1'))('api');var moment=require(_0x4c03('0x2'));var BPromise=require(_0x4c03('0x3'));var rp=require(_0x4c03('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c03('0x5'));var config=require(_0x4c03('0x6'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x5c17f1,_0x1f7630){return _0x5c17f1[_0x4c03('0x7')](_0x4c03('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa20=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util','../../config/logger','api'];(function(_0x160596,_0x136ac7){var _0x4519d0=function(_0x25a8b4){while(--_0x25a8b4){_0x160596['push'](_0x160596['shift']());}};_0x4519d0(++_0x136ac7);}(_0xfa20,0x188));var _0x0fa2=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0xfa20[_0x1ebd10];return _0x1004d3;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fa2('0x7'));var config=require(_0x0fa2('0x8'));var attributes=require(_0x0fa2('0x9'));module['exports']=function(_0x2d8964,_0x39e8e8){return _0x2d8964[_0x0fa2('0xa')](_0x0fa2('0xb'),attributes,{'tableName':'cm_contact_has_items','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 706a4b3..6fec1fd 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 _0x63c3=['rpc','../../config/environment','client','http','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x5d2b58,_0x37a620){var _0x2a1b19=function(_0x13f9f7){while(--_0x13f9f7){_0x5d2b58['push'](_0x5d2b58['shift']());}};_0x2a1b19(++_0x37a620);}(_0x63c3,0x80));var _0x363c=function(_0x228b77,_0x47215f){_0x228b77=_0x228b77-0x0;var _0x527bbd=_0x63c3[_0x228b77];return _0x527bbd;};'use strict';var _=require(_0x363c('0x0'));var util=require('util');var moment=require(_0x363c('0x1'));var BPromise=require('bluebird');var rs=require(_0x363c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x363c('0x3'));var logger=require(_0x363c('0x4'))(_0x363c('0x5'));var config=require(_0x363c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x363c('0x7')][_0x363c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41cfdf,_0xc85f33,_0x44464e){return new BPromise(function(_0x15f7c8,_0x52190f){return client['request'](_0x41cfdf,_0x44464e)['then'](function(_0x1f812a){logger[_0x363c('0x9')](_0x363c('0xa'),_0xc85f33,'request\x20sent');logger[_0x363c('0xb')](_0x363c('0xc'),_0xc85f33,_0x363c('0xd'),JSON['stringify'](_0x1f812a));if(_0x1f812a['error']){if(_0x1f812a[_0x363c('0xe')][_0x363c('0xf')]===0x1f4){logger[_0x363c('0xe')](_0x363c('0xa'),_0xc85f33,_0x1f812a[_0x363c('0xe')][_0x363c('0x10')]);return _0x52190f(_0x1f812a['error'][_0x363c('0x10')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0xc85f33,_0x1f812a[_0x363c('0xe')][_0x363c('0x10')]);return _0x15f7c8(_0x1f812a[_0x363c('0xe')]['message']);}else{logger[_0x363c('0x9')]('CmContactHasItem,\x20%s,\x20%s',_0xc85f33,_0x363c('0xd'));_0x15f7c8(_0x1f812a[_0x363c('0x11')][_0x363c('0x10')]);}})[_0x363c('0x12')](function(_0x145954){logger[_0x363c('0xe')](_0x363c('0xa'),_0xc85f33,_0x145954);_0x52190f(_0x145954);});});} \ No newline at end of file +var _0x4a99=['jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0xeb56e4,_0x4c711b){var _0x442e74=function(_0x2c7efa){while(--_0x2c7efa){_0xeb56e4['push'](_0xeb56e4['shift']());}};_0x442e74(++_0x4c711b);}(_0x4a99,0x19d));var _0x94a9=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4a99[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x94a9('0x0'));var util=require('util');var moment=require(_0x94a9('0x1'));var BPromise=require(_0x94a9('0x2'));var rs=require(_0x94a9('0x3'));var fs=require('fs');var Redis=require(_0x94a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x94a9('0x5'))('rpc');var config=require(_0x94a9('0x6'));var jayson=require(_0x94a9('0x7'));var client=jayson[_0x94a9('0x8')][_0x94a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2861b8,_0x262966,_0x58da70){return new BPromise(function(_0x8ebc53,_0x5c87e1){return client['request'](_0x2861b8,_0x58da70)[_0x94a9('0xa')](function(_0x3d423){logger[_0x94a9('0xb')](_0x94a9('0xc'),_0x262966,'request\x20sent');logger[_0x94a9('0xd')](_0x94a9('0xe'),_0x262966,'request\x20sent',JSON['stringify'](_0x3d423));if(_0x3d423['error']){if(_0x3d423[_0x94a9('0xf')][_0x94a9('0x10')]===0x1f4){logger[_0x94a9('0xf')](_0x94a9('0xc'),_0x262966,_0x3d423[_0x94a9('0xf')][_0x94a9('0x11')]);return _0x5c87e1(_0x3d423['error'][_0x94a9('0x11')]);}logger['error'](_0x94a9('0xc'),_0x262966,_0x3d423[_0x94a9('0xf')][_0x94a9('0x11')]);return _0x8ebc53(_0x3d423[_0x94a9('0xf')]['message']);}else{logger[_0x94a9('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x262966,_0x94a9('0x12'));_0x8ebc53(_0x3d423[_0x94a9('0x13')]['message']);}})['catch'](function(_0x38e967){logger[_0x94a9('0xf')](_0x94a9('0xc'),_0x262966,_0x38e967);_0x5c87e1(_0x38e967);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4e355ed..9e8d733 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 _0xbd9c=['util','path','connect-timeout','express','Router','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0xbd9c,0x175));var _0xcbd9=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xbd9c[_0x33554b];return _0x256954;};'use strict';var multer=require(_0xcbd9('0x0'));var util=require(_0xcbd9('0x1'));var path=require(_0xcbd9('0x2'));var timeout=require(_0xcbd9('0x3'));var express=require(_0xcbd9('0x4'));var router=express[_0xcbd9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbd9('0x6'));var config=require('../../config/environment');var controller=require(_0xcbd9('0x7'));router[_0xcbd9('0x8')]('/',auth[_0xcbd9('0x9')](),controller[_0xcbd9('0xa')]);router[_0xcbd9('0x8')](_0xcbd9('0xb'),auth[_0xcbd9('0x9')](),controller['show']);router[_0xcbd9('0xc')]('/',auth[_0xcbd9('0x9')](),controller[_0xcbd9('0xd')]);router['put']('/:id',auth[_0xcbd9('0x9')](),controller['update']);router[_0xcbd9('0xe')](_0xcbd9('0xb'),auth['isAuthenticated'](),controller[_0xcbd9('0xf')]);module[_0xcbd9('0x10')]=router; \ No newline at end of file +var _0xef5b=['multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x2624ad,_0x173b12){var _0x38c580=function(_0x186669){while(--_0x186669){_0x2624ad['push'](_0x2624ad['shift']());}};_0x38c580(++_0x173b12);}(_0xef5b,0xee));var _0xbef5=function(_0xae883a,_0x86a786){_0xae883a=_0xae883a-0x0;var _0x92ca0b=_0xef5b[_0xae883a];return _0x92ca0b;};'use strict';var multer=require(_0xbef5('0x0'));var util=require(_0xbef5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbef5('0x2'));var router=express[_0xbef5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbef5('0x4'));var config=require(_0xbef5('0x5'));var controller=require('./cmContactHasItem.controller');router[_0xbef5('0x6')]('/',auth[_0xbef5('0x7')](),controller[_0xbef5('0x8')]);router[_0xbef5('0x6')](_0xbef5('0x9'),auth[_0xbef5('0x7')](),controller['show']);router[_0xbef5('0xa')]('/',auth[_0xbef5('0x7')](),controller[_0xbef5('0xb')]);router[_0xbef5('0xc')](_0xbef5('0x9'),auth[_0xbef5('0x7')](),controller[_0xbef5('0xd')]);router[_0xbef5('0xe')]('/:id',auth[_0xbef5('0x7')](),controller[_0xbef5('0xf')]);module[_0xbef5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3593409..911f442 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 _0x4410=['stringify','ENUM','voice','sequelize','getDataValue','alias','STRING','name','TEXT','long','select','values','setDataValue'];(function(_0x1fad5b,_0x7cf578){var _0x2db29e=function(_0x53a8ec){while(--_0x53a8ec){_0x1fad5b['push'](_0x1fad5b['shift']());}};_0x2db29e(++_0x7cf578);}(_0x4410,0x121));var _0x0441=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x4410[_0x3dc538];return _0x72c2fd;};'use strict';var Sequelize=require(_0x0441('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x11036a){return this[_0x0441('0x1')](_0x0441('0x2'));}},'alias':{'type':Sequelize[_0x0441('0x3')],'allowNull':![],'set':function(_0x461430){this['setDataValue']('alias',_0x461430?_0x461430:this[_0x0441('0x1')](_0x0441('0x4')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x0441('0x5')](_0x0441('0x6')),'get':function(){if(this[_0x0441('0x1')]('type')===_0x0441('0x7')){return JSON['parse'](this[_0x0441('0x1')]('values'));}else{return this[_0x0441('0x1')](_0x0441('0x8'));}},'set':function(_0x11c32d){if(Array['isArray'](_0x11c32d)){this[_0x0441('0x9')](_0x0441('0x8'),JSON[_0x0441('0xa')](_0x11c32d));}else{this[_0x0441('0x9')](_0x0441('0x8'),_0x11c32d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0441('0xb')](_0x0441('0xc'))}}; \ No newline at end of file +var _0xe7df=['alias','STRING','setDataValue','type','select','parse','values','isArray','stringify','ENUM','voice','lodash','getDataValue'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xe7df,0x143));var _0xfe7d=function(_0x51b2ec,_0x168761){_0x51b2ec=_0x51b2ec-0x0;var _0x22fdd4=_0xe7df[_0x51b2ec];return _0x22fdd4;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfe7d('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x296790){return this[_0xfe7d('0x1')](_0xfe7d('0x2'));}},'alias':{'type':Sequelize[_0xfe7d('0x3')],'allowNull':![],'set':function(_0x5bb0d4){this[_0xfe7d('0x4')](_0xfe7d('0x2'),_0x5bb0d4?_0x5bb0d4:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xfe7d('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xfe7d('0x1')](_0xfe7d('0x5'))===_0xfe7d('0x6')){return JSON[_0xfe7d('0x7')](this[_0xfe7d('0x1')]('values'));}else{return this[_0xfe7d('0x1')](_0xfe7d('0x8'));}},'set':function(_0x146238){if(Array[_0xfe7d('0x9')](_0x146238)){this[_0xfe7d('0x4')]('values',JSON[_0xfe7d('0xa')](_0x146238));}else{this[_0xfe7d('0x4')]('values',_0x146238);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfe7d('0xb')](_0xfe7d('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 184b6c4..5e963f4 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 _0x0ab2=['error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','create','transaction','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%d','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x0ab2,0x1d4));var _0x20ab=function(_0x3cea2c,_0x5eb764){_0x3cea2c=_0x3cea2c-0x0;var _0x5c1067=_0x0ab2[_0x3cea2c];return _0x5c1067;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20ab('0x1'));var rp=require(_0x20ab('0x2'));var moment=require('moment');var BPromise=require(_0x20ab('0x3'));var Mustache=require(_0x20ab('0x4'));var util=require(_0x20ab('0x5'));var path=require(_0x20ab('0x6'));var sox=require('sox');var csv=require(_0x20ab('0x7'));var ejs=require(_0x20ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20ab('0x9'));var squel=require('squel');var crypto=require(_0x20ab('0xa'));var jsforce=require(_0x20ab('0xb'));var deskjs=require(_0x20ab('0xc'));var toCsv=require(_0x20ab('0x7'));var querystring=require(_0x20ab('0xd'));var Papa=require(_0x20ab('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20ab('0xf'));var as=require(_0x20ab('0x10'));var hardwareService=require(_0x20ab('0x11'));var logger=require(_0x20ab('0x12'))(_0x20ab('0x13'));var utils=require(_0x20ab('0x14'));var config=require(_0x20ab('0x15'));var licenseUtil=require(_0x20ab('0x16'));var db=require(_0x20ab('0x17'))['db'];function respondWithStatusCode(_0x10ea4a,_0x591103){_0x591103=_0x591103||0xcc;return function(_0x286e76){if(_0x286e76){return _0x10ea4a['sendStatus'](_0x591103);}return _0x10ea4a[_0x20ab('0x18')](_0x591103)['end']();};}function respondWithResult(_0x105b3c,_0x3f5655){_0x3f5655=_0x3f5655||0xc8;return function(_0x15b295){if(_0x15b295){return _0x105b3c['status'](_0x3f5655)[_0x20ab('0x19')](_0x15b295);}};}function respondWithFilteredResult(_0x38bec7,_0xeb36b4){return function(_0x4648cf){if(_0x4648cf){var _0x3d907=typeof _0xeb36b4[_0x20ab('0x1a')]===_0x20ab('0x1b')&&typeof _0xeb36b4[_0x20ab('0x1c')]==='undefined';var _0x48b48e=_0x4648cf[_0x20ab('0x1d')];var _0x54c02c=_0x3d907?0x0:_0xeb36b4['offset'];var _0x123a42=_0x3d907?_0x4648cf[_0x20ab('0x1d')]:_0xeb36b4['offset']+_0xeb36b4['limit'];var _0x2ae8a1;if(_0x123a42>=_0x48b48e){_0x123a42=_0x48b48e;_0x2ae8a1=0xc8;}else{_0x2ae8a1=0xce;}_0x38bec7['status'](_0x2ae8a1);return _0x38bec7[_0x20ab('0x1e')](_0x20ab('0x1f'),_0x54c02c+'-'+_0x123a42+'/'+_0x48b48e)[_0x20ab('0x19')](_0x4648cf);}return null;};}function patchUpdates(_0x1c0f93){return function(_0x4c6403){try{jsonpatch[_0x20ab('0x20')](_0x4c6403,_0x1c0f93,!![]);}catch(_0x4fae7c){return BPromise['reject'](_0x4fae7c);}return _0x4c6403['save']();};}function saveUpdates(_0x5a3cf9,_0x39f5b8){return function(_0x1d31f3){if(_0x1d31f3){return _0x1d31f3[_0x20ab('0x21')](_0x5a3cf9)['then'](function(_0x49e695){return _0x49e695;});}return null;};}function removeEntity(_0x16f6ad,_0x4c39e3){return function(_0x28e626){if(_0x28e626){return _0x28e626['destroy']()[_0x20ab('0x22')](function(){_0x16f6ad[_0x20ab('0x18')](0xcc)[_0x20ab('0x23')]();});}};}function handleEntityNotFound(_0x2940ea,_0xe100e5){return function(_0x31f340){if(!_0x31f340){_0x2940ea['sendStatus'](0x194);}return _0x31f340;};}function handleError(_0x2460fe,_0x463214){_0x463214=_0x463214||0x1f4;return function(_0x25e5d2){logger[_0x20ab('0x24')](_0x25e5d2[_0x20ab('0x25')]);if(_0x25e5d2[_0x20ab('0x26')]){delete _0x25e5d2[_0x20ab('0x26')];}_0x2460fe[_0x20ab('0x18')](_0x463214)[_0x20ab('0x27')](_0x25e5d2);};}exports['index']=function(_0x1f7567,_0x4a019d){var _0x4a24d6={},_0x3a3a52={},_0x5eebae={'count':0x0,'rows':[]};var _0x13a989=_[_0x20ab('0x28')](db[_0x20ab('0x29')][_0x20ab('0x2a')],function(_0x12fcb5){return{'name':_0x12fcb5[_0x20ab('0x2b')],'type':_0x12fcb5[_0x20ab('0x2c')][_0x20ab('0x2d')]};});_0x3a3a52[_0x20ab('0x2e')]=_[_0x20ab('0x2f')](_[_0x20ab('0x28')](_0x13a989,'name'),[_0x20ab('0x26')]);_0x3a3a52[_0x20ab('0x30')]=_[_0x20ab('0x31')](_0x1f7567[_0x20ab('0x30')]);_0x3a3a52[_0x20ab('0x32')]=_[_0x20ab('0x33')](_0x3a3a52['model'],_0x3a3a52['query']);_0x4a24d6[_0x20ab('0x34')]=_[_0x20ab('0x33')](_0x3a3a52[_0x20ab('0x2e')],qs['fields'](_0x1f7567[_0x20ab('0x30')][_0x20ab('0x35')]));_0x4a24d6['attributes']=_0x4a24d6[_0x20ab('0x34')][_0x20ab('0x36')]?_0x4a24d6['attributes']:_0x3a3a52[_0x20ab('0x2e')];if(!_0x1f7567[_0x20ab('0x30')][_0x20ab('0x37')]('nolimit')){_0x4a24d6['limit']=qs[_0x20ab('0x1c')](_0x1f7567[_0x20ab('0x30')][_0x20ab('0x1c')]);_0x4a24d6[_0x20ab('0x1a')]=qs[_0x20ab('0x1a')](_0x1f7567[_0x20ab('0x30')][_0x20ab('0x1a')]);}_0x4a24d6[_0x20ab('0x38')]=qs[_0x20ab('0x39')](_0x1f7567['query'][_0x20ab('0x39')]);_0x4a24d6[_0x20ab('0x3a')]=qs['filters'](_[_0x20ab('0x3b')](_0x1f7567[_0x20ab('0x30')],_0x3a3a52[_0x20ab('0x32')]),_0x13a989);if(_0x1f7567[_0x20ab('0x30')][_0x20ab('0x3c')]){_0x4a24d6['where']=_[_0x20ab('0x3d')](_0x4a24d6[_0x20ab('0x3a')],{'$or':_[_0x20ab('0x28')](_0x13a989,function(_0x109be0){if(_0x109be0['type']!==_0x20ab('0x3e')){var _0x4692fe={};_0x4692fe[_0x109be0['name']]={'$like':'%'+_0x1f7567[_0x20ab('0x30')]['filter']+'%'};return _0x4692fe;}})});}_0x4a24d6=_[_0x20ab('0x3d')]({},_0x4a24d6,_0x1f7567[_0x20ab('0x3f')]);var _0x2d7f90={'where':_0x4a24d6[_0x20ab('0x3a')]};return db[_0x20ab('0x29')][_0x20ab('0x1d')](_0x2d7f90)[_0x20ab('0x22')](function(_0x1f2e79){_0x5eebae[_0x20ab('0x1d')]=_0x1f2e79;if(_0x1f7567['query'][_0x20ab('0x40')]){_0x4a24d6[_0x20ab('0x41')]=[{'all':!![]}];}return db[_0x20ab('0x29')][_0x20ab('0x42')](_0x4a24d6);})[_0x20ab('0x22')](function(_0x58df14){_0x5eebae[_0x20ab('0x43')]=_0x58df14;return _0x5eebae;})[_0x20ab('0x22')](respondWithFilteredResult(_0x4a019d,_0x4a24d6))[_0x20ab('0x44')](handleError(_0x4a019d,null));};exports[_0x20ab('0x45')]=function(_0x2905ac,_0x52266c){var _0x511b8a={'raw':!![],'where':{'id':_0x2905ac[_0x20ab('0x46')]['id']}},_0x2d231e={};_0x2d231e[_0x20ab('0x2e')]=_[_0x20ab('0x31')](db['CmCustomField'][_0x20ab('0x2a')]);_0x2d231e[_0x20ab('0x30')]=_[_0x20ab('0x31')](_0x2905ac['query']);_0x2d231e['filters']=_[_0x20ab('0x33')](_0x2d231e[_0x20ab('0x2e')],_0x2d231e[_0x20ab('0x30')]);_0x511b8a[_0x20ab('0x34')]=_['intersection'](_0x2d231e[_0x20ab('0x2e')],qs[_0x20ab('0x35')](_0x2905ac[_0x20ab('0x30')][_0x20ab('0x35')]));_0x511b8a[_0x20ab('0x34')]=_0x511b8a[_0x20ab('0x34')][_0x20ab('0x36')]?_0x511b8a[_0x20ab('0x34')]:_0x2d231e[_0x20ab('0x2e')];if(_0x2905ac[_0x20ab('0x30')][_0x20ab('0x40')]){_0x511b8a[_0x20ab('0x41')]=[{'all':!![]}];}_0x511b8a=_[_0x20ab('0x3d')]({},_0x511b8a,_0x2905ac['options']);return db['CmCustomField'][_0x20ab('0x47')](_0x511b8a)[_0x20ab('0x22')](handleEntityNotFound(_0x52266c,null))[_0x20ab('0x22')](respondWithResult(_0x52266c,null))[_0x20ab('0x44')](handleError(_0x52266c,null));};exports[_0x20ab('0x21')]=function(_0x2d3954,_0x30a2c4){if(_0x2d3954[_0x20ab('0x48')]['id']){delete _0x2d3954[_0x20ab('0x48')]['id'];}return db[_0x20ab('0x29')][_0x20ab('0x47')]({'where':{'id':_0x2d3954[_0x20ab('0x46')]['id']}})[_0x20ab('0x22')](handleEntityNotFound(_0x30a2c4,null))['then'](saveUpdates(_0x2d3954[_0x20ab('0x48')],null))[_0x20ab('0x22')](respondWithResult(_0x30a2c4,null))[_0x20ab('0x44')](handleError(_0x30a2c4,null));};exports[_0x20ab('0x49')]=function(_0x3737c6,_0x48cd1f){return db[_0x20ab('0x29')]['find']({'where':{'id':_0x3737c6[_0x20ab('0x46')]['id']}})['then'](handleEntityNotFound(_0x48cd1f,null))[_0x20ab('0x22')](removeEntity(_0x48cd1f,null))[_0x20ab('0x44')](handleError(_0x48cd1f,null));};exports[_0x20ab('0x4a')]=function(_0x2aba36,_0x296d0b){var _0x697ffa;return db['sequelize'][_0x20ab('0x4b')](function(_0x3c35e1){return db[_0x20ab('0x29')]['create'](_0x2aba36[_0x20ab('0x48')],{'transaction':_0x3c35e1})['then'](function(_0x48a390){_0x697ffa=_0x48a390;var _0x5a53ee={'type':db['Sequelize']['TEXT'],'transaction':_0x3c35e1};switch(_0x2aba36[_0x20ab('0x48')][_0x20ab('0x2c')]){case _0x20ab('0x4c'):_0x5a53ee['type']=db['Sequelize'][_0x20ab('0x4d')];break;case _0x20ab('0x4e'):_0x5a53ee[_0x20ab('0x2c')]=db['Sequelize'][_0x20ab('0x4f')];break;case _0x20ab('0x50'):_0x5a53ee[_0x20ab('0x2c')]=db['Sequelize'][_0x20ab('0x51')];_0x5a53ee['defaultValue']=![];break;default:}return db['sequelize'][_0x20ab('0x52')]['addColumn']('cm_contacts',util['format'](_0x20ab('0x53'),_0x697ffa['id']),_0x5a53ee);})[_0x20ab('0x22')](function(){return _0x697ffa;});})[_0x20ab('0x22')](respondWithResult(_0x296d0b,0xc9))[_0x20ab('0x44')](handleError(_0x296d0b,null));}; \ No newline at end of file +var _0x85a2=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0x85a2,0x7c));var _0x285a=function(_0x43bd8c,_0x345062){_0x43bd8c=_0x43bd8c-0x0;var _0x214469=_0x85a2[_0x43bd8c];return _0x214469;};'use strict';var emlformat=require(_0x285a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x285a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x285a('0x2'));var moment=require(_0x285a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x285a('0x4'));var util=require(_0x285a('0x5'));var path=require(_0x285a('0x6'));var sox=require(_0x285a('0x7'));var csv=require(_0x285a('0x8'));var ejs=require(_0x285a('0x9'));var fs=require('fs');var fs_extra=require(_0x285a('0xa'));var _=require('lodash');var squel=require(_0x285a('0xb'));var crypto=require(_0x285a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x285a('0xd'));var toCsv=require(_0x285a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x285a('0xe'));var authService=require(_0x285a('0xf'));var qs=require(_0x285a('0x10'));var as=require(_0x285a('0x11'));var hardwareService=require(_0x285a('0x12'));var logger=require(_0x285a('0x13'))(_0x285a('0x14'));var utils=require(_0x285a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x285a('0x16'));var db=require(_0x285a('0x17'))['db'];function respondWithStatusCode(_0x4c1a23,_0x5c9613){_0x5c9613=_0x5c9613||0xcc;return function(_0x125b47){if(_0x125b47){return _0x4c1a23[_0x285a('0x18')](_0x5c9613);}return _0x4c1a23['status'](_0x5c9613)[_0x285a('0x19')]();};}function respondWithResult(_0x2b1324,_0x1ce375){_0x1ce375=_0x1ce375||0xc8;return function(_0x259a7e){if(_0x259a7e){return _0x2b1324[_0x285a('0x1a')](_0x1ce375)[_0x285a('0x1b')](_0x259a7e);}};}function respondWithFilteredResult(_0x2e02ac,_0x6528b1){return function(_0x28f2bc){if(_0x28f2bc){var _0x1174ee=typeof _0x6528b1[_0x285a('0x1c')]===_0x285a('0x1d')&&typeof _0x6528b1['limit']===_0x285a('0x1d');var _0x572cc8=_0x28f2bc[_0x285a('0x1e')];var _0x16e80b=_0x1174ee?0x0:_0x6528b1[_0x285a('0x1c')];var _0x196572=_0x1174ee?_0x28f2bc[_0x285a('0x1e')]:_0x6528b1[_0x285a('0x1c')]+_0x6528b1[_0x285a('0x1f')];var _0x60f256;if(_0x196572>=_0x572cc8){_0x196572=_0x572cc8;_0x60f256=0xc8;}else{_0x60f256=0xce;}_0x2e02ac[_0x285a('0x1a')](_0x60f256);return _0x2e02ac['set'](_0x285a('0x20'),_0x16e80b+'-'+_0x196572+'/'+_0x572cc8)['json'](_0x28f2bc);}return null;};}function patchUpdates(_0x505dec){return function(_0x5ca434){try{jsonpatch['apply'](_0x5ca434,_0x505dec,!![]);}catch(_0x37e943){return BPromise['reject'](_0x37e943);}return _0x5ca434[_0x285a('0x21')]();};}function saveUpdates(_0x28faa9,_0x64c412){return function(_0x319ad8){if(_0x319ad8){return _0x319ad8[_0x285a('0x22')](_0x28faa9)[_0x285a('0x23')](function(_0x25b345){return _0x25b345;});}return null;};}function removeEntity(_0x4da97e,_0x52b596){return function(_0x49ab9c){if(_0x49ab9c){return _0x49ab9c[_0x285a('0x24')]()[_0x285a('0x23')](function(){_0x4da97e[_0x285a('0x1a')](0xcc)[_0x285a('0x19')]();});}};}function handleEntityNotFound(_0x2b75d1,_0x3cf0b5){return function(_0x1fcc60){if(!_0x1fcc60){_0x2b75d1['sendStatus'](0x194);}return _0x1fcc60;};}function handleError(_0x5a14c4,_0x5680dd){_0x5680dd=_0x5680dd||0x1f4;return function(_0x5c1bcf){logger[_0x285a('0x25')](_0x5c1bcf['stack']);if(_0x5c1bcf[_0x285a('0x26')]){delete _0x5c1bcf[_0x285a('0x26')];}_0x5a14c4[_0x285a('0x1a')](_0x5680dd)[_0x285a('0x27')](_0x5c1bcf);};}exports[_0x285a('0x28')]=function(_0x30fdd5,_0x4417e4){var _0x2ac956={},_0x24bb42={},_0x1e58bc={'count':0x0,'rows':[]};var _0x44033c=_[_0x285a('0x29')](db[_0x285a('0x2a')][_0x285a('0x2b')],function(_0xca3a9){return{'name':_0xca3a9['fieldName'],'type':_0xca3a9[_0x285a('0x2c')][_0x285a('0x2d')]};});_0x24bb42[_0x285a('0x2e')]=_['differenceBy'](_['map'](_0x44033c,_0x285a('0x26')),[_0x285a('0x26')]);_0x24bb42['query']=_['keys'](_0x30fdd5[_0x285a('0x2f')]);_0x24bb42[_0x285a('0x30')]=_[_0x285a('0x31')](_0x24bb42[_0x285a('0x2e')],_0x24bb42[_0x285a('0x2f')]);_0x2ac956[_0x285a('0x32')]=_[_0x285a('0x31')](_0x24bb42[_0x285a('0x2e')],qs[_0x285a('0x33')](_0x30fdd5[_0x285a('0x2f')]['fields']));_0x2ac956['attributes']=_0x2ac956['attributes']['length']?_0x2ac956[_0x285a('0x32')]:_0x24bb42['model'];if(!_0x30fdd5['query'][_0x285a('0x34')](_0x285a('0x35'))){_0x2ac956[_0x285a('0x1f')]=qs[_0x285a('0x1f')](_0x30fdd5[_0x285a('0x2f')]['limit']);_0x2ac956[_0x285a('0x1c')]=qs[_0x285a('0x1c')](_0x30fdd5[_0x285a('0x2f')][_0x285a('0x1c')]);}_0x2ac956[_0x285a('0x36')]=qs['sort'](_0x30fdd5[_0x285a('0x2f')][_0x285a('0x37')]);_0x2ac956[_0x285a('0x38')]=qs['filters'](_[_0x285a('0x39')](_0x30fdd5[_0x285a('0x2f')],_0x24bb42['filters']),_0x44033c);if(_0x30fdd5[_0x285a('0x2f')][_0x285a('0x3a')]){_0x2ac956[_0x285a('0x38')]=_[_0x285a('0x3b')](_0x2ac956['where'],{'$or':_[_0x285a('0x29')](_0x44033c,function(_0x11b4c1){if(_0x11b4c1[_0x285a('0x2c')]!==_0x285a('0x3c')){var _0x59d750={};_0x59d750[_0x11b4c1[_0x285a('0x26')]]={'$like':'%'+_0x30fdd5[_0x285a('0x2f')]['filter']+'%'};return _0x59d750;}})});}_0x2ac956=_[_0x285a('0x3b')]({},_0x2ac956,_0x30fdd5[_0x285a('0x3d')]);var _0x3a2aae={'where':_0x2ac956['where']};return db['CmCustomField'][_0x285a('0x1e')](_0x3a2aae)['then'](function(_0x28eabe){_0x1e58bc[_0x285a('0x1e')]=_0x28eabe;if(_0x30fdd5[_0x285a('0x2f')][_0x285a('0x3e')]){_0x2ac956[_0x285a('0x3f')]=[{'all':!![]}];}return db[_0x285a('0x2a')][_0x285a('0x40')](_0x2ac956);})[_0x285a('0x23')](function(_0x17e3c9){_0x1e58bc['rows']=_0x17e3c9;return _0x1e58bc;})[_0x285a('0x23')](respondWithFilteredResult(_0x4417e4,_0x2ac956))[_0x285a('0x41')](handleError(_0x4417e4,null));};exports[_0x285a('0x42')]=function(_0x382c95,_0xf268cf){var _0x510aae={'raw':!![],'where':{'id':_0x382c95['params']['id']}},_0x825f1f={};_0x825f1f[_0x285a('0x2e')]=_['keys'](db[_0x285a('0x2a')][_0x285a('0x2b')]);_0x825f1f[_0x285a('0x2f')]=_[_0x285a('0x43')](_0x382c95[_0x285a('0x2f')]);_0x825f1f[_0x285a('0x30')]=_['intersection'](_0x825f1f[_0x285a('0x2e')],_0x825f1f[_0x285a('0x2f')]);_0x510aae['attributes']=_[_0x285a('0x31')](_0x825f1f['model'],qs[_0x285a('0x33')](_0x382c95[_0x285a('0x2f')]['fields']));_0x510aae[_0x285a('0x32')]=_0x510aae['attributes']['length']?_0x510aae[_0x285a('0x32')]:_0x825f1f['model'];if(_0x382c95[_0x285a('0x2f')]['includeAll']){_0x510aae[_0x285a('0x3f')]=[{'all':!![]}];}_0x510aae=_['merge']({},_0x510aae,_0x382c95['options']);return db['CmCustomField'][_0x285a('0x44')](_0x510aae)[_0x285a('0x23')](handleEntityNotFound(_0xf268cf,null))['then'](respondWithResult(_0xf268cf,null))['catch'](handleError(_0xf268cf,null));};exports[_0x285a('0x22')]=function(_0x8d468c,_0x2547cb){if(_0x8d468c[_0x285a('0x45')]['id']){delete _0x8d468c[_0x285a('0x45')]['id'];}return db[_0x285a('0x2a')]['find']({'where':{'id':_0x8d468c[_0x285a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2547cb,null))['then'](saveUpdates(_0x8d468c[_0x285a('0x45')],null))[_0x285a('0x23')](respondWithResult(_0x2547cb,null))['catch'](handleError(_0x2547cb,null));};exports[_0x285a('0x24')]=function(_0x29e73a,_0x11f86b){return db[_0x285a('0x2a')]['find']({'where':{'id':_0x29e73a[_0x285a('0x46')]['id']}})[_0x285a('0x23')](handleEntityNotFound(_0x11f86b,null))['then'](removeEntity(_0x11f86b,null))['catch'](handleError(_0x11f86b,null));};exports[_0x285a('0x47')]=function(_0xd16446,_0x28247c){var _0x5192e6;return db[_0x285a('0x48')][_0x285a('0x49')](function(_0x5199a8){return db[_0x285a('0x2a')][_0x285a('0x47')](_0xd16446[_0x285a('0x45')],{'transaction':_0x5199a8})[_0x285a('0x23')](function(_0xd40aff){_0x5192e6=_0xd40aff;var _0x440589={'type':db[_0x285a('0x4a')][_0x285a('0x4b')],'transaction':_0x5199a8};switch(_0xd16446[_0x285a('0x45')][_0x285a('0x2c')]){case _0x285a('0x4c'):_0x440589['type']=db[_0x285a('0x4a')][_0x285a('0x4b')];break;case'number':_0x440589[_0x285a('0x2c')]=db['Sequelize'][_0x285a('0x4d')];break;case _0x285a('0x4e'):_0x440589[_0x285a('0x2c')]=db[_0x285a('0x4a')][_0x285a('0x4f')];_0x440589['defaultValue']=![];break;default:}return db['sequelize'][_0x285a('0x50')][_0x285a('0x51')](_0x285a('0x52'),util[_0x285a('0x53')]('cf_%d',_0x5192e6['id']),_0x440589);})[_0x285a('0x23')](function(){return _0x5192e6;});})[_0x285a('0x23')](respondWithResult(_0x28247c,0xc9))[_0x285a('0x41')](handleError(_0x28247c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c43f423..3616188 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 _0xbe3b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','cm_custom_fields','util'];(function(_0x50d1ca,_0x56fec3){var _0x16cf5c=function(_0x5c057a){while(--_0x5c057a){_0x50d1ca['push'](_0x50d1ca['shift']());}};_0x16cf5c(++_0x56fec3);}(_0xbe3b,0x6d));var _0xbbe3=function(_0x58f8a7,_0xbd36a7){_0x58f8a7=_0x58f8a7-0x0;var _0x149b97=_0xbe3b[_0x58f8a7];return _0x149b97;};'use strict';var _=require('lodash');var util=require(_0xbbe3('0x0'));var logger=require(_0xbbe3('0x1'))(_0xbbe3('0x2'));var moment=require(_0xbbe3('0x3'));var BPromise=require(_0xbbe3('0x4'));var rp=require(_0xbbe3('0x5'));var fs=require('fs');var path=require(_0xbbe3('0x6'));var rimraf=require(_0xbbe3('0x7'));var config=require(_0xbbe3('0x8'));var attributes=require('./cmCustomField.attributes');module[_0xbbe3('0x9')]=function(_0x1fc1f9,_0x315a9b){return _0x1fc1f9['define']('CmCustomField',attributes,{'tableName':_0xbbe3('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf06a=['../../config/logger','api','request-promise','../../config/environment','exports','define','CmCustomField','util'];(function(_0x13f409,_0x34ec12){var _0x4560da=function(_0x75ee1a){while(--_0x75ee1a){_0x13f409['push'](_0x13f409['shift']());}};_0x4560da(++_0x34ec12);}(_0xf06a,0x147));var _0xaf06=function(_0x4669f9,_0x161343){_0x4669f9=_0x4669f9-0x0;var _0x693804=_0xf06a[_0x4669f9];return _0x693804;};'use strict';var _=require('lodash');var util=require(_0xaf06('0x0'));var logger=require(_0xaf06('0x1'))(_0xaf06('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf06('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf06('0x4'));var attributes=require('./cmCustomField.attributes');module[_0xaf06('0x5')]=function(_0x2c025d,_0x243f2a){return _0x2c025d[_0xaf06('0x6')](_0xaf06('0x7'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index e96d7cf..4f3f122 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 _0x35aa=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x579f59,_0x376987){var _0x52a2a5=function(_0xe7622d){while(--_0xe7622d){_0x579f59['push'](_0x579f59['shift']());}};_0x52a2a5(++_0x376987);}(_0x35aa,0x122));var _0xa35a=function(_0x560286,_0x17d496){_0x560286=_0x560286-0x0;var _0x1418aa=_0x35aa[_0x560286];return _0x1418aa;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var moment=require(_0xa35a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa35a('0x2'));var db=require(_0xa35a('0x3'))['db'];var utils=require(_0xa35a('0x4'));var logger=require(_0xa35a('0x5'))(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa35a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x477543,_0x335a06,_0x4cbb88){return new BPromise(function(_0x384633,_0x4eb8c4){return client[_0xa35a('0x9')](_0x477543,_0x4cbb88)[_0xa35a('0xa')](function(_0x1009fd){logger[_0xa35a('0xb')](_0xa35a('0xc'),_0x335a06,_0xa35a('0xd'));logger[_0xa35a('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x335a06,_0xa35a('0xd'),JSON[_0xa35a('0xf')](_0x1009fd));if(_0x1009fd[_0xa35a('0x10')]){if(_0x1009fd[_0xa35a('0x10')][_0xa35a('0x11')]===0x1f4){logger['error'](_0xa35a('0xc'),_0x335a06,_0x1009fd[_0xa35a('0x10')][_0xa35a('0x12')]);return _0x4eb8c4(_0x1009fd[_0xa35a('0x10')]['message']);}logger[_0xa35a('0x10')](_0xa35a('0xc'),_0x335a06,_0x1009fd[_0xa35a('0x10')][_0xa35a('0x12')]);return _0x384633(_0x1009fd[_0xa35a('0x10')][_0xa35a('0x12')]);}else{logger[_0xa35a('0xb')](_0xa35a('0xc'),_0x335a06,_0xa35a('0xd'));_0x384633(_0x1009fd[_0xa35a('0x13')][_0xa35a('0x12')]);}})[_0xa35a('0x14')](function(_0xed8dbf){logger[_0xa35a('0x10')](_0xa35a('0xc'),_0x335a06,_0xed8dbf);_0x4eb8c4(_0xed8dbf);});});} \ No newline at end of file +var _0xadf4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','util','moment','bluebird'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xadf4,0x8d));var _0x4adf=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xadf4[_0x308213];return _0x2e1619;};'use strict';var _=require('lodash');var util=require(_0x4adf('0x0'));var moment=require(_0x4adf('0x1'));var BPromise=require(_0x4adf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4adf('0x3'));var db=require(_0x4adf('0x4'))['db'];var utils=require(_0x4adf('0x5'));var logger=require(_0x4adf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4adf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7cf2,_0x295553,_0x3ad0d6){return new BPromise(function(_0x2704a5,_0x403eab){return client[_0x4adf('0x8')](_0x3b7cf2,_0x3ad0d6)['then'](function(_0x4fe71a){logger['info']('CmCustomField,\x20%s,\x20%s',_0x295553,'request\x20sent');logger[_0x4adf('0x9')](_0x4adf('0xa'),_0x295553,_0x4adf('0xb'),JSON[_0x4adf('0xc')](_0x4fe71a));if(_0x4fe71a[_0x4adf('0xd')]){if(_0x4fe71a[_0x4adf('0xd')]['code']===0x1f4){logger[_0x4adf('0xd')](_0x4adf('0xe'),_0x295553,_0x4fe71a[_0x4adf('0xd')]['message']);return _0x403eab(_0x4fe71a[_0x4adf('0xd')][_0x4adf('0xf')]);}logger[_0x4adf('0xd')](_0x4adf('0xe'),_0x295553,_0x4fe71a[_0x4adf('0xd')][_0x4adf('0xf')]);return _0x2704a5(_0x4fe71a['error'][_0x4adf('0xf')]);}else{logger[_0x4adf('0x10')](_0x4adf('0xe'),_0x295553,_0x4adf('0xb'));_0x2704a5(_0x4fe71a[_0x4adf('0x11')]['message']);}})['catch'](function(_0x3995bf){logger[_0x4adf('0xd')]('CmCustomField,\x20%s,\x20%s',_0x295553,_0x3995bf);_0x403eab(_0x3995bf);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 219b086..9d62275 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 _0x9f4b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x11580d,_0x3a3633){var _0x3355a3=function(_0x5e8a84){while(--_0x5e8a84){_0x11580d['push'](_0x11580d['shift']());}};_0x3355a3(++_0x3a3633);}(_0x9f4b,0xfc));var _0xb9f4=function(_0xa42372,_0x551dfb){_0xa42372=_0xa42372-0x0;var _0x2384eb=_0x9f4b[_0xa42372];return _0x2384eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb9f4('0x0'));var timeout=require(_0xb9f4('0x1'));var express=require(_0xb9f4('0x2'));var router=express[_0xb9f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f4('0x4'));var interaction=require(_0xb9f4('0x5'));var config=require(_0xb9f4('0x6'));var controller=require(_0xb9f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9f4('0x8')]);router[_0xb9f4('0x9')](_0xb9f4('0xa'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0xc')]);router['post']('/',auth[_0xb9f4('0xb')](),controller['create']);router[_0xb9f4('0xd')](_0xb9f4('0xa'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0xe')]);router[_0xb9f4('0xf')]('/:id',auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x10')]);module[_0xb9f4('0x11')]=router; \ No newline at end of file +var _0xb72d=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x1128b5,_0x205acc){var _0x16dbce=function(_0x56ae3c){while(--_0x56ae3c){_0x1128b5['push'](_0x1128b5['shift']());}};_0x16dbce(++_0x205acc);}(_0xb72d,0xc4));var _0xdb72=function(_0x39be22,_0x11f218){_0x39be22=_0x39be22-0x0;var _0x3ae604=_0xb72d[_0x39be22];return _0x3ae604;};'use strict';var multer=require(_0xdb72('0x0'));var util=require(_0xdb72('0x1'));var path=require(_0xdb72('0x2'));var timeout=require(_0xdb72('0x3'));var express=require('express');var router=express[_0xdb72('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdb72('0x5'));var interaction=require(_0xdb72('0x6'));var config=require(_0xdb72('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xdb72('0x8')](),controller[_0xdb72('0x9')]);router[_0xdb72('0xa')](_0xdb72('0xb'),auth[_0xdb72('0x8')](),controller[_0xdb72('0xc')]);router[_0xdb72('0xd')]('/',auth[_0xdb72('0x8')](),controller[_0xdb72('0xe')]);router[_0xdb72('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xdb72('0x10')]);router['delete'](_0xdb72('0xb'),auth[_0xdb72('0x8')](),controller[_0xdb72('0x11')]);module[_0xdb72('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 ead8409..797457a 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 _0xad59=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x269dd8,_0x54381d){var _0x269f1e=function(_0x2d402f){while(--_0x2d402f){_0x269dd8['push'](_0x269dd8['shift']());}};_0x269f1e(++_0x54381d);}(_0xad59,0x136));var _0x9ad5=function(_0x29e330,_0x5305e0){_0x29e330=_0x29e330-0x0;var _0x519272=_0xad59[_0x29e330];return _0x519272;};'use strict';var moment=require(_0x9ad5('0x0'));var Sequelize=require(_0x9ad5('0x1'));module['exports']={'phone':{'type':Sequelize[_0x9ad5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9ad5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9ad5('0x4')],'defaultValue':moment()[_0x9ad5('0x5')](_0x9ad5('0x6'))},'countbusyretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9ad5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9ad5('0x4')]},'priority':{'type':Sequelize[_0x9ad5('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9ad5('0x7')],'unique':_0x9ad5('0x8')},'ListId':{'type':Sequelize[_0x9ad5('0x7')],'unique':_0x9ad5('0x8')},'UserId':{'type':Sequelize[_0x9ad5('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9ad5('0x7')],'unique':_0x9ad5('0x8')},'CampaignId':{'type':Sequelize[_0x9ad5('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9ad5('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9ad5('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x2116=['UNSIGNED','contactListQueue','DATE','moment','sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x282320,_0x379ad6){var _0x271d54=function(_0x5bfe98){while(--_0x5bfe98){_0x282320['push'](_0x282320['shift']());}};_0x271d54(++_0x379ad6);}(_0x2116,0x1e3));var _0x6211=function(_0x2bc1f7,_0x17266a){_0x2bc1f7=_0x2bc1f7-0x0;var _0x4b0ec1=_0x2116[_0x2bc1f7];return _0x4b0ec1;};'use strict';var moment=require(_0x6211('0x0'));var Sequelize=require(_0x6211('0x1'));module['exports']={'phone':{'type':Sequelize[_0x6211('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6211('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6211('0x4')](_0x6211('0x5'))},'countbusyretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6211('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6211('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x6211('0x6')](0x2)[_0x6211('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6211('0x6')],'unique':_0x6211('0x8')},'ListId':{'type':Sequelize[_0x6211('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6211('0x6')],'unique':_0x6211('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6211('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6211('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6211('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6211('0x9')],'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 516cc2c..9724a85 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 _0x0fda=['scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','status','set','Content-Range','update','sendStatus','error','stack','send','CmHopper','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$ne','$eq','$notBetween','$in','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','then','rows','catch','show','params','include','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','format','map','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x507737,_0x2ada4a){_0x507737=_0x507737-0x0;var _0x379003=_0x0fda[_0x507737];return _0x379003;};'use strict';var moment=require(_0xa0fd('0x0'));var _=require('lodash');var qs=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var shared=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];function respondWithResult(_0xd8e73a,_0x13c734){_0x13c734=_0x13c734||0xc8;return function(_0x574fca){if(_0x574fca){return _0xd8e73a['status'](_0x13c734)[_0xa0fd('0x6')](_0x574fca);}};}function respondWithFilteredResult(_0x4aec58,_0x49b3c1){return function(_0x868183){if(_0x868183){var _0x62b109=typeof _0x49b3c1[_0xa0fd('0x7')]===_0xa0fd('0x8')&&typeof _0x49b3c1['limit']===_0xa0fd('0x8');var _0xe93771=_0x868183[_0xa0fd('0x9')];var _0x322a1a=_0x62b109?0x0:_0x49b3c1['offset'];var _0x31088d=_0x62b109?_0x868183[_0xa0fd('0x9')]:_0x49b3c1[_0xa0fd('0x7')]+_0x49b3c1['limit'];var _0x4409e4;if(_0x31088d>=_0xe93771){_0x31088d=_0xe93771;_0x4409e4=0xc8;}else{_0x4409e4=0xce;}_0x4aec58[_0xa0fd('0xa')](_0x4409e4);return _0x4aec58[_0xa0fd('0xb')](_0xa0fd('0xc'),_0x322a1a+'-'+_0x31088d+'/'+_0xe93771)[_0xa0fd('0x6')](_0x868183);}return null;};}function saveUpdates(_0x4d5c32,_0x490112){return function(_0x32dcee){if(_0x32dcee){return _0x32dcee[_0xa0fd('0xd')](_0x4d5c32)['then'](function(_0x21acc2){return _0x21acc2;});}return null;};}function handleEntityNotFound(_0x8a67a5,_0x11e4eb){return function(_0x1e4a48){if(!_0x1e4a48){_0x8a67a5[_0xa0fd('0xe')](0x194);}return _0x1e4a48;};}function handleError(_0x2e3692,_0x2811c0){_0x2811c0=_0x2811c0||0x1f4;return function(_0x4fe62c){logger[_0xa0fd('0xf')](_0x4fe62c[_0xa0fd('0x10')]);if(_0x4fe62c['name']){delete _0x4fe62c['name'];}_0x2e3692[_0xa0fd('0xa')](_0x2811c0)[_0xa0fd('0x11')](_0x4fe62c);};}exports['index']=function(_0x2b8d15,_0x22a876){var _0x1cb027={},_0x5073a8={},_0x50cde2={'count':0x0,'rows':[]};var _0x46e15a=_['map'](db[_0xa0fd('0x12')][_0xa0fd('0x13')],function(_0x10f64b){return{'name':_0x10f64b[_0xa0fd('0x14')],'type':_0x10f64b[_0xa0fd('0x15')][_0xa0fd('0x16')]};});_0x5073a8[_0xa0fd('0x17')]=_['map'](_0x46e15a,_0xa0fd('0x18'));_0x5073a8[_0xa0fd('0x19')]=_[_0xa0fd('0x1a')](_0x2b8d15[_0xa0fd('0x19')]);_0x5073a8[_0xa0fd('0x1b')]=_[_0xa0fd('0x1c')](_0x5073a8[_0xa0fd('0x17')],_0x5073a8[_0xa0fd('0x19')]);_0x5073a8[_0xa0fd('0x1b')]=_[_0xa0fd('0x1d')](_0x5073a8[_0xa0fd('0x1b')],[_0xa0fd('0x1e'),_0xa0fd('0x1f'),'$gt',_0xa0fd('0x20'),_0xa0fd('0x21'),'$lte',_0xa0fd('0x22'),_0xa0fd('0x23'),'$not','$between',_0xa0fd('0x24'),_0xa0fd('0x25'),'$notIn','$like','$notLike','$iLike',_0xa0fd('0x26'),'$like',_0xa0fd('0x27'),_0xa0fd('0x28'),_0xa0fd('0x29'),'$any']);_0x1cb027[_0xa0fd('0x2a')]=_[_0xa0fd('0x1c')](_0x5073a8[_0xa0fd('0x17')],qs[_0xa0fd('0x2b')](_0x2b8d15[_0xa0fd('0x19')]['fields']));_0x1cb027[_0xa0fd('0x2a')]=_0x1cb027[_0xa0fd('0x2a')][_0xa0fd('0x2c')]?_0x1cb027[_0xa0fd('0x2a')]:_0x5073a8['model'];if(!_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x2d')]('nolimit')){_0x1cb027['limit']=qs['limit'](_0x2b8d15[_0xa0fd('0x19')]['limit']);_0x1cb027['offset']=qs[_0xa0fd('0x7')](_0x2b8d15['query'][_0xa0fd('0x7')]);}_0x1cb027[_0xa0fd('0x2e')]=qs[_0xa0fd('0x2f')](_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x2f')]);_0x1cb027[_0xa0fd('0x30')]=qs[_0xa0fd('0x1b')](_[_0xa0fd('0x31')](_0x2b8d15['query'],_0x5073a8[_0xa0fd('0x1b')]),_0x46e15a);if(_0x2b8d15['query'][_0xa0fd('0x32')]){_0x1cb027['where']=_['merge'](_0x1cb027[_0xa0fd('0x30')],{'$or':_['map'](_0x46e15a,function(_0x40f8f0){if(_0x40f8f0[_0xa0fd('0x15')]!==_0xa0fd('0x33')){var _0x3c7884={};_0x3c7884[_0x40f8f0['name']]={'$like':'%'+_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x32')]+'%'};return _0x3c7884;}})});}_0x1cb027=_[_0xa0fd('0x34')]({},_0x1cb027,_0x2b8d15[_0xa0fd('0x35')]);var _0x2e3cfa={'where':_0x1cb027[_0xa0fd('0x30')]};return db[_0xa0fd('0x12')]['count'](_0x2e3cfa)['then'](function(_0x2aa6a8){_0x50cde2[_0xa0fd('0x9')]=_0x2aa6a8;if(_0x2b8d15[_0xa0fd('0x19')][_0xa0fd('0x36')]){_0x1cb027['include']=[{'all':!![]}];}return db[_0xa0fd('0x12')][_0xa0fd('0x37')](_0x1cb027);})[_0xa0fd('0x38')](function(_0x426ae6){_0x50cde2[_0xa0fd('0x39')]=_0x426ae6;return _0x50cde2;})['then'](respondWithFilteredResult(_0x22a876,_0x1cb027))[_0xa0fd('0x3a')](handleError(_0x22a876,null));};exports[_0xa0fd('0x3b')]=function(_0x558f67,_0x48125b){var _0x27082a={'raw':!![],'where':{'id':_0x558f67[_0xa0fd('0x3c')]['id']}},_0x163023={};_0x163023[_0xa0fd('0x17')]=_[_0xa0fd('0x1a')](db[_0xa0fd('0x12')][_0xa0fd('0x13')]);_0x163023[_0xa0fd('0x19')]=_[_0xa0fd('0x1a')](_0x558f67[_0xa0fd('0x19')]);_0x163023[_0xa0fd('0x1b')]=_[_0xa0fd('0x1c')](_0x163023[_0xa0fd('0x17')],_0x163023[_0xa0fd('0x19')]);_0x27082a[_0xa0fd('0x2a')]=_['intersection'](_0x163023['model'],qs['fields'](_0x558f67[_0xa0fd('0x19')][_0xa0fd('0x2b')]));_0x27082a[_0xa0fd('0x2a')]=_0x27082a['attributes'][_0xa0fd('0x2c')]?_0x27082a[_0xa0fd('0x2a')]:_0x163023[_0xa0fd('0x17')];if(_0x558f67['query'][_0xa0fd('0x36')]){_0x27082a[_0xa0fd('0x3d')]=[{'all':!![]}];}_0x27082a=_[_0xa0fd('0x34')]({},_0x27082a,_0x558f67[_0xa0fd('0x35')]);return db[_0xa0fd('0x12')][_0xa0fd('0x3e')](_0x27082a)['then'](handleEntityNotFound(_0x48125b,null))[_0xa0fd('0x38')](respondWithResult(_0x48125b,null))[_0xa0fd('0x3a')](handleError(_0x48125b,null));};exports[_0xa0fd('0x3f')]=function(_0x2498da,_0x324206){return db[_0xa0fd('0x12')]['create'](_0x2498da[_0xa0fd('0x40')],{})[_0xa0fd('0x38')](respondWithResult(_0x324206,0xc9))[_0xa0fd('0x3a')](handleError(_0x324206,null));};exports[_0xa0fd('0xd')]=function(_0x16d0cc,_0x508747){if(_0x16d0cc['body']['id']){delete _0x16d0cc[_0xa0fd('0x40')]['id'];}return db[_0xa0fd('0x12')][_0xa0fd('0x3e')]({'where':{'id':_0x16d0cc[_0xa0fd('0x3c')]['id']}})[_0xa0fd('0x38')](handleEntityNotFound(_0x508747,null))['then'](saveUpdates(_0x16d0cc[_0xa0fd('0x40')],null))[_0xa0fd('0x38')](respondWithResult(_0x508747,null))[_0xa0fd('0x3a')](handleError(_0x508747,null));};exports[_0xa0fd('0x41')]=function(_0x93d528,_0x22504a){return db['CmHopper']['describe']()['then'](respondWithResult(_0x22504a,null))[_0xa0fd('0x3a')](handleError(_0x22504a,null));};exports['destroy']=function(_0x4e4ce4,_0xcf725e){var _0x504a0a;var _0x357324=_0x4e4ce4[_0xa0fd('0x3c')]['id'];return db['CmHopper']['find']({'where':{'id':_0x4e4ce4[_0xa0fd('0x3c')]['id']}})[_0xa0fd('0x38')](handleEntityNotFound(_0xcf725e,null))[_0xa0fd('0x38')](function(_0x167503){if(_0x167503){return _0x167503[_0xa0fd('0x42')]()[_0xa0fd('0x38')](function(_0x5268ba){return _0x5268ba;});}})['then'](function(_0x50382c){_0x504a0a=_0x50382c;if(_0x50382c){if(_0x50382c['VoiceQueueId']||_0x50382c[_0xa0fd('0x43')]){return db[_0x50382c[_0xa0fd('0x44')]?_0xa0fd('0x45'):_0xa0fd('0x46')][_0xa0fd('0x3e')]({'where':{'id':_0x50382c['VoiceQueueId']?_0x50382c['VoiceQueueId']:_0x50382c['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x386dfe){var _0x4238e4={};if(_0x386dfe){_[_0xa0fd('0x34')](_0x4238e4,_[_0xa0fd('0x47')](_0x504a0a[_0xa0fd('0x48')],[_0xa0fd('0x49'),_0xa0fd('0x4a'),'id']));_0x4238e4[_0xa0fd('0x4b')]=0x15;_0x4238e4[_0xa0fd('0x4c')]=_0xa0fd('0x4d');_0x4238e4['campaign']=_0x386dfe['name'];_0x4238e4[_0xa0fd('0x4e')]=_0x4e4ce4[_0xa0fd('0x4f')][_0xa0fd('0x18')];_0x4238e4[_0xa0fd('0x50')]=_0x4e4ce4['user']['id'];_0x4238e4[_0xa0fd('0x4d')]=!![];_0x4238e4[_0xa0fd('0x51')]=moment()['format'](_0xa0fd('0x52'));_0x4238e4['calleridnum']=_0x504a0a[_0xa0fd('0x53')];_0x4238e4[_0xa0fd('0x54')]=_0x504a0a['VoiceQueueId']?_0xa0fd('0x55'):_0xa0fd('0x56');return db[_0xa0fd('0x57')][_0xa0fd('0x3e')]({'where':{'id':_0x4238e4[_0xa0fd('0x58')]},'attributes':[_0xa0fd('0x59'),_0xa0fd('0x5a')]})[_0xa0fd('0x38')](function(_0x5e0440){if(!_[_0xa0fd('0x5b')](_0xcf725e)&&!_['isNil'](_0x5e0440[_0xa0fd('0x59')])){_0x4238e4[_0xa0fd('0x5c')]=_0x5e0440[_0xa0fd('0x59')];if(!_[_0xa0fd('0x5b')](_0x5e0440[_0xa0fd('0x5a')])){_0x4238e4['calleridname']+='\x20'+_0x5e0440[_0xa0fd('0x5a')];}}})[_0xa0fd('0x5d')](function(){return db['CmHopperFinal'][_0xa0fd('0x3f')](_0x4238e4);});}})[_0xa0fd('0x38')](function(_0xfd99a9){return db['CmHopperAdditionalPhone'][_0xa0fd('0x42')]({'where':{'CmHopperId':_0x357324}});})['then'](function(){return _0xcf725e[_0xa0fd('0xa')](0xcc)['end']();})[_0xa0fd('0x3a')](handleError(_0xcf725e,null));};exports['getPreview']=function(_0x1a4da0,_0x62c3e7){var _0x3f9d1e=[];return db[_0xa0fd('0x57')][_0xa0fd('0x41')]()[_0xa0fd('0x38')](function(_0x38076b){_0x3f9d1e=_['keys'](_0x38076b);return _0x1a4da0[_0xa0fd('0x4f')][_0xa0fd('0x5e')]({'where':{'type':_0xa0fd('0x5f'),'dialActive':!![],'dialMethod':_0xa0fd('0x60')},'attributes':['id',_0xa0fd('0x61'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x4ed729){if(_0x4ed729&&_0x4ed729[_0xa0fd('0x2c')]){return db['sequelize'][_0xa0fd('0x62')](function(_0x589433){var _0x4524a3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0fd('0x63')](_0xa0fd('0x52'))},'VoiceQueueId':{'$in':_[_0xa0fd('0x64')](_0x4ed729,'id')},'$or':[{'UserId':null},{'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']}]};var _0x5c3efa={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4ed729)[_0xa0fd('0x32')]([_0xa0fd('0x65'),0x0])[_0xa0fd('0x64')]('id')[_0xa0fd('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']}]};var _0x26bd48={'$or':[_0x4524a3,_0x5c3efa]};var _0x527e93=[];if(_0x1a4da0['body'][_0xa0fd('0x67')]&&_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x67')]===_0xa0fd('0x68')){if(!_[_0xa0fd('0x69')](_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x6a')])){_0x26bd48['id']={'$in':_0x1a4da0[_0xa0fd('0x40')]['hopperIds']};}_0x527e93=[[_0xa0fd('0x6b'),_0xa0fd('0x6c')],[_0xa0fd('0x6d'),_0x4ed729[0x0][_0xa0fd('0x61')]===_0xa0fd('0x6c')?_0xa0fd('0x6e'):_0xa0fd('0x6c')],db[_0xa0fd('0x6f')][_0xa0fd('0x70')](_0xa0fd('0x71')),['id',_0xa0fd('0x6e')]];}else{if(!_[_0xa0fd('0x69')](_0x1a4da0['body'][_0xa0fd('0x6a')])){_0x26bd48['id']={'$notIn':_0x1a4da0[_0xa0fd('0x40')][_0xa0fd('0x6a')]};}_0x527e93=[[_0xa0fd('0x6b'),_0xa0fd('0x6e')],[_0xa0fd('0x6d'),_0x4ed729[0x0][_0xa0fd('0x61')]],db[_0xa0fd('0x6f')][_0xa0fd('0x70')](_0xa0fd('0x72')),['id','ASC']];}return db[_0xa0fd('0x12')][_0xa0fd('0x73')]({'attributes':['id',_0xa0fd('0x74'),_0xa0fd('0x53'),_0xa0fd('0x75')],'where':_0x26bd48,'order':_0x527e93,'transaction':_0x589433,'lock':_0x589433[_0xa0fd('0x76')][_0xa0fd('0x77')],'include':[{'model':db[_0xa0fd('0x57')],'as':'Contact','attributes':_0x3f9d1e,'include':[{'model':db[_0xa0fd('0x78')],'as':_0xa0fd('0x79'),'attributes':['id','name']}]},{'model':db[_0xa0fd('0x7a')],'as':_0xa0fd('0x7b'),'attributes':['id',_0xa0fd('0x18')]},{'model':db[_0xa0fd('0x45')],'as':_0xa0fd('0x7c'),'attributes':['id','name',_0xa0fd('0x7d')]}]})[_0xa0fd('0x38')](function(_0xccdeca){if(_0xccdeca){return _0xccdeca[_0xa0fd('0xd')]({'UserId':_0x1a4da0[_0xa0fd('0x4f')]['id']},{'transaction':_0x589433});}});});}})[_0xa0fd('0x38')](handleEntityNotFound(_0x62c3e7,null))[_0xa0fd('0x38')](respondWithResult(_0x62c3e7,null))[_0xa0fd('0x3a')](handleError(_0x62c3e7,null));};exports[_0xa0fd('0x7e')]=function(_0x4407a3,_0x3661f6,_0x245012){var _0x36452c=[];var _0x7d5b1d=_0x4407a3[_0xa0fd('0x3c')]['id'];var _0x1f3851=_0x4407a3[_0xa0fd('0x4f')]['id'];return db[_0xa0fd('0x57')][_0xa0fd('0x41')]()['then'](function(_0x2075cb){_0x36452c=_[_0xa0fd('0x1a')](_0x2075cb);return db[_0xa0fd('0x6f')][_0xa0fd('0x62')](function(_0x5551ff){const _0xeaddf={'id':_0x7d5b1d};return db[_0xa0fd('0x12')][_0xa0fd('0x73')]({'attributes':['id',_0xa0fd('0x74'),_0xa0fd('0x75')],'where':_0xeaddf,'transaction':_0x5551ff,'lock':_0x5551ff['LOCK'][_0xa0fd('0x77')],'include':[{'model':db[_0xa0fd('0x57')],'as':'Contact','attributes':_0x36452c,'include':[{'model':db['CmCompany'],'as':_0xa0fd('0x79'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xa0fd('0x7b'),'attributes':['id',_0xa0fd('0x18')]},{'model':db['VoiceQueue'],'as':_0xa0fd('0x7c'),'attributes':['id',_0xa0fd('0x18'),_0xa0fd('0x7d')]}]})[_0xa0fd('0x38')](function(_0x2aa91d){if(_0x2aa91d){return _0x2aa91d['update']({'UserId':_0x1f3851},{'transaction':_0x5551ff});}});});})[_0xa0fd('0x38')](handleEntityNotFound(_0x3661f6,null))[_0xa0fd('0x38')](respondWithResult(_0x3661f6,null))['catch'](handleError(_0x3661f6,null));};exports[_0xa0fd('0x7f')]=function(_0x37eb12,_0x6431a){return _0x37eb12['user'][_0xa0fd('0x5e')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa0fd('0x60')},'attributes':['id'],'raw':!![]})[_0xa0fd('0x38')](function(_0xe9600b){if(_0xe9600b&&_0xe9600b[_0xa0fd('0x2c')]){return db['CmHopper'][_0xa0fd('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0fd('0x63')](_0xa0fd('0x52'))},'VoiceQueueId':{'$in':_[_0xa0fd('0x64')](_0xe9600b,'id')},'$or':[{'UserId':null},{'UserId':_0x37eb12[_0xa0fd('0x4f')]['id']}]}});}return 0x0;})[_0xa0fd('0x38')](function(_0x59e347){if(!_[_0xa0fd('0x5b')](_0x59e347)&&_[_0xa0fd('0x80')](_0x59e347)){return _0x6431a[_0xa0fd('0xa')](0xc8)[_0xa0fd('0x6')]({'contacts':_0x59e347});}else{logger[_0xa0fd('0xf')](_0xa0fd('0x81'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x6431a[_0xa0fd('0xe')](0x194);}})[_0xa0fd('0x3a')](handleError(_0x6431a,null));};exports['getTimezones']=function(_0x1888d4,_0x42a27d){var _0x1bdcb=shared[_0xa0fd('0x82')];var _0x4ebc93=[];_[_0xa0fd('0x64')](_0x1bdcb,function(_0x1bcad3){_0x4ebc93[_0xa0fd('0x83')]({'id':_0x1bcad3[_0xa0fd('0x18')],'name':_0x1bcad3['name'],'utcOffset':_0x1bcad3[_0xa0fd('0x84')]});});return _0x42a27d[_0xa0fd('0xa')](0xc8)[_0xa0fd('0x6')]({'tz':_0x4ebc93});};exports['getTimezone']=function(_0x1ef642,_0x23e557){var _0x4c3da0=shared['timezones'];var _0xe8e94c={};if(!_[_0xa0fd('0x5b')](_0x4c3da0[_0x1ef642[_0xa0fd('0x40')]['id']]))_0xe8e94c=_0x4c3da0[_0x1ef642[_0xa0fd('0x40')]['id']];return _0x23e557['status'](0xc8)['json'](_0xe8e94c);}; \ No newline at end of file +var _0xaa7c=['$lte','$ne','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','literal','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmList','List','dialActive','CmCompany','Company','isNumber','getOpenContacts','entity\x20not\x20found','sendStatus','timezones','getTimezone','moment','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','update','then','error','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt'];(function(_0x5788f3,_0x275670){var _0x4f1d41=function(_0x239592){while(--_0x239592){_0x5788f3['push'](_0x5788f3['shift']());}};_0x4f1d41(++_0x275670);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x3478ad,_0x19867b){_0x3478ad=_0x3478ad-0x0;var _0x57d418=_0xaa7c[_0x3478ad];return _0x57d418;};'use strict';var moment=require(_0xcaa7('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var shared=require(_0xcaa7('0x1'));var db=require(_0xcaa7('0x2'))['db'];function respondWithResult(_0x4f837e,_0xd4ca36){_0xd4ca36=_0xd4ca36||0xc8;return function(_0xc85ba0){if(_0xc85ba0){return _0x4f837e[_0xcaa7('0x3')](_0xd4ca36)[_0xcaa7('0x4')](_0xc85ba0);}};}function respondWithFilteredResult(_0x27e610,_0x5a3674){return function(_0x4b9df0){if(_0x4b9df0){var _0x5bd940=typeof _0x5a3674['offset']===_0xcaa7('0x5')&&typeof _0x5a3674[_0xcaa7('0x6')]===_0xcaa7('0x5');var _0x5d2ca8=_0x4b9df0[_0xcaa7('0x7')];var _0x1de70a=_0x5bd940?0x0:_0x5a3674[_0xcaa7('0x8')];var _0x38a42d=_0x5bd940?_0x4b9df0[_0xcaa7('0x7')]:_0x5a3674['offset']+_0x5a3674[_0xcaa7('0x6')];var _0x39d53a;if(_0x38a42d>=_0x5d2ca8){_0x38a42d=_0x5d2ca8;_0x39d53a=0xc8;}else{_0x39d53a=0xce;}_0x27e610[_0xcaa7('0x3')](_0x39d53a);return _0x27e610[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x1de70a+'-'+_0x38a42d+'/'+_0x5d2ca8)[_0xcaa7('0x4')](_0x4b9df0);}return null;};}function saveUpdates(_0x563f57,_0x24d3b0){return function(_0x128cfb){if(_0x128cfb){return _0x128cfb[_0xcaa7('0xb')](_0x563f57)[_0xcaa7('0xc')](function(_0x2bbc71){return _0x2bbc71;});}return null;};}function handleEntityNotFound(_0x2eb4ff,_0x299490){return function(_0x4a1d5a){if(!_0x4a1d5a){_0x2eb4ff['sendStatus'](0x194);}return _0x4a1d5a;};}function handleError(_0x314b7c,_0x1c1286){_0x1c1286=_0x1c1286||0x1f4;return function(_0x1155fb){logger[_0xcaa7('0xd')](_0x1155fb['stack']);if(_0x1155fb[_0xcaa7('0xe')]){delete _0x1155fb[_0xcaa7('0xe')];}_0x314b7c[_0xcaa7('0x3')](_0x1c1286)[_0xcaa7('0xf')](_0x1155fb);};}exports[_0xcaa7('0x10')]=function(_0xc46e37,_0x20ede0){var _0x5c2a74={},_0x53e1cb={},_0x4309e0={'count':0x0,'rows':[]};var _0x4491d1=_[_0xcaa7('0x11')](db[_0xcaa7('0x12')][_0xcaa7('0x13')],function(_0x2a0416){return{'name':_0x2a0416[_0xcaa7('0x14')],'type':_0x2a0416['type'][_0xcaa7('0x15')]};});_0x53e1cb[_0xcaa7('0x16')]=_[_0xcaa7('0x11')](_0x4491d1,_0xcaa7('0xe'));_0x53e1cb[_0xcaa7('0x17')]=_[_0xcaa7('0x18')](_0xc46e37[_0xcaa7('0x17')]);_0x53e1cb[_0xcaa7('0x19')]=_[_0xcaa7('0x1a')](_0x53e1cb[_0xcaa7('0x16')],_0x53e1cb[_0xcaa7('0x17')]);_0x53e1cb[_0xcaa7('0x19')]=_[_0xcaa7('0x1b')](_0x53e1cb['filters'],[_0xcaa7('0x1c'),_0xcaa7('0x1d'),'$gt',_0xcaa7('0x1e'),_0xcaa7('0x1f'),_0xcaa7('0x20'),_0xcaa7('0x21'),'$eq','$not',_0xcaa7('0x22'),_0xcaa7('0x23'),_0xcaa7('0x24'),_0xcaa7('0x25'),_0xcaa7('0x26'),'$notLike',_0xcaa7('0x27'),'$notILike','$like',_0xcaa7('0x28'),'$contains',_0xcaa7('0x29'),_0xcaa7('0x2a')]);_0x5c2a74[_0xcaa7('0x2b')]=_[_0xcaa7('0x1a')](_0x53e1cb[_0xcaa7('0x16')],qs[_0xcaa7('0x2c')](_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x2c')]));_0x5c2a74['attributes']=_0x5c2a74[_0xcaa7('0x2b')][_0xcaa7('0x2d')]?_0x5c2a74[_0xcaa7('0x2b')]:_0x53e1cb[_0xcaa7('0x16')];if(!_0xc46e37[_0xcaa7('0x17')]['hasOwnProperty'](_0xcaa7('0x2e'))){_0x5c2a74[_0xcaa7('0x6')]=qs[_0xcaa7('0x6')](_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x6')]);_0x5c2a74['offset']=qs[_0xcaa7('0x8')](_0xc46e37['query'][_0xcaa7('0x8')]);}_0x5c2a74[_0xcaa7('0x2f')]=qs[_0xcaa7('0x30')](_0xc46e37['query'][_0xcaa7('0x30')]);_0x5c2a74[_0xcaa7('0x31')]=qs[_0xcaa7('0x19')](_[_0xcaa7('0x32')](_0xc46e37[_0xcaa7('0x17')],_0x53e1cb[_0xcaa7('0x19')]),_0x4491d1);if(_0xc46e37['query'][_0xcaa7('0x33')]){_0x5c2a74[_0xcaa7('0x31')]=_['merge'](_0x5c2a74[_0xcaa7('0x31')],{'$or':_[_0xcaa7('0x11')](_0x4491d1,function(_0x444add){if(_0x444add[_0xcaa7('0x34')]!=='VIRTUAL'){var _0x16af20={};_0x16af20[_0x444add[_0xcaa7('0xe')]]={'$like':'%'+_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x33')]+'%'};return _0x16af20;}})});}_0x5c2a74=_[_0xcaa7('0x35')]({},_0x5c2a74,_0xc46e37[_0xcaa7('0x36')]);var _0xcb5439={'where':_0x5c2a74[_0xcaa7('0x31')]};return db[_0xcaa7('0x12')][_0xcaa7('0x7')](_0xcb5439)[_0xcaa7('0xc')](function(_0x266d5f){_0x4309e0['count']=_0x266d5f;if(_0xc46e37[_0xcaa7('0x17')][_0xcaa7('0x37')]){_0x5c2a74[_0xcaa7('0x38')]=[{'all':!![]}];}return db[_0xcaa7('0x12')][_0xcaa7('0x39')](_0x5c2a74);})['then'](function(_0x3d3c13){_0x4309e0[_0xcaa7('0x3a')]=_0x3d3c13;return _0x4309e0;})[_0xcaa7('0xc')](respondWithFilteredResult(_0x20ede0,_0x5c2a74))['catch'](handleError(_0x20ede0,null));};exports[_0xcaa7('0x3b')]=function(_0x3016f1,_0x320b46){var _0x1138a6={'raw':!![],'where':{'id':_0x3016f1[_0xcaa7('0x3c')]['id']}},_0x569c5f={};_0x569c5f['model']=_[_0xcaa7('0x18')](db['CmHopper'][_0xcaa7('0x13')]);_0x569c5f['query']=_['keys'](_0x3016f1[_0xcaa7('0x17')]);_0x569c5f[_0xcaa7('0x19')]=_['intersection'](_0x569c5f[_0xcaa7('0x16')],_0x569c5f[_0xcaa7('0x17')]);_0x1138a6[_0xcaa7('0x2b')]=_[_0xcaa7('0x1a')](_0x569c5f[_0xcaa7('0x16')],qs[_0xcaa7('0x2c')](_0x3016f1[_0xcaa7('0x17')][_0xcaa7('0x2c')]));_0x1138a6['attributes']=_0x1138a6[_0xcaa7('0x2b')][_0xcaa7('0x2d')]?_0x1138a6[_0xcaa7('0x2b')]:_0x569c5f[_0xcaa7('0x16')];if(_0x3016f1[_0xcaa7('0x17')][_0xcaa7('0x37')]){_0x1138a6['include']=[{'all':!![]}];}_0x1138a6=_[_0xcaa7('0x35')]({},_0x1138a6,_0x3016f1[_0xcaa7('0x36')]);return db[_0xcaa7('0x12')][_0xcaa7('0x3d')](_0x1138a6)[_0xcaa7('0xc')](handleEntityNotFound(_0x320b46,null))['then'](respondWithResult(_0x320b46,null))[_0xcaa7('0x3e')](handleError(_0x320b46,null));};exports[_0xcaa7('0x3f')]=function(_0x33c748,_0x490b0d){return db[_0xcaa7('0x12')]['create'](_0x33c748[_0xcaa7('0x40')],{})[_0xcaa7('0xc')](respondWithResult(_0x490b0d,0xc9))[_0xcaa7('0x3e')](handleError(_0x490b0d,null));};exports[_0xcaa7('0xb')]=function(_0x94e72d,_0x208495){if(_0x94e72d[_0xcaa7('0x40')]['id']){delete _0x94e72d['body']['id'];}return db['CmHopper'][_0xcaa7('0x3d')]({'where':{'id':_0x94e72d['params']['id']}})[_0xcaa7('0xc')](handleEntityNotFound(_0x208495,null))['then'](saveUpdates(_0x94e72d[_0xcaa7('0x40')],null))['then'](respondWithResult(_0x208495,null))[_0xcaa7('0x3e')](handleError(_0x208495,null));};exports[_0xcaa7('0x41')]=function(_0x1304a1,_0x32ec2d){return db[_0xcaa7('0x12')][_0xcaa7('0x41')]()['then'](respondWithResult(_0x32ec2d,null))['catch'](handleError(_0x32ec2d,null));};exports[_0xcaa7('0x42')]=function(_0x3a5f1f,_0x4f162c){var _0x417aaa;var _0x8a94a8=_0x3a5f1f[_0xcaa7('0x3c')]['id'];return db[_0xcaa7('0x12')][_0xcaa7('0x3d')]({'where':{'id':_0x3a5f1f[_0xcaa7('0x3c')]['id']}})[_0xcaa7('0xc')](handleEntityNotFound(_0x4f162c,null))[_0xcaa7('0xc')](function(_0x30d75c){if(_0x30d75c){return _0x30d75c[_0xcaa7('0x42')]()[_0xcaa7('0xc')](function(_0x3cc7ae){return _0x3cc7ae;});}})[_0xcaa7('0xc')](function(_0x3e77a9){_0x417aaa=_0x3e77a9;if(_0x3e77a9){if(_0x3e77a9[_0xcaa7('0x43')]||_0x3e77a9[_0xcaa7('0x44')]){return db[_0x3e77a9['VoiceQueueId']?_0xcaa7('0x45'):'Campaign'][_0xcaa7('0x3d')]({'where':{'id':_0x3e77a9[_0xcaa7('0x43')]?_0x3e77a9[_0xcaa7('0x43')]:_0x3e77a9[_0xcaa7('0x44')]},'attributes':['id',_0xcaa7('0xe')],'raw':!![]});}}})[_0xcaa7('0xc')](function(_0x1a2e55){var _0x2a263e={};if(_0x1a2e55){_[_0xcaa7('0x35')](_0x2a263e,_[_0xcaa7('0x46')](_0x417aaa[_0xcaa7('0x47')],['createdAt',_0xcaa7('0x48'),'id']));_0x2a263e[_0xcaa7('0x49')]=0x15;_0x2a263e[_0xcaa7('0x4a')]='deleted';_0x2a263e[_0xcaa7('0x4b')]=_0x1a2e55['name'];_0x2a263e[_0xcaa7('0x4c')]=_0x3a5f1f[_0xcaa7('0x4d')][_0xcaa7('0xe')];_0x2a263e[_0xcaa7('0x4e')]=_0x3a5f1f['user']['id'];_0x2a263e[_0xcaa7('0x4f')]=!![];_0x2a263e[_0xcaa7('0x50')]=moment()[_0xcaa7('0x51')](_0xcaa7('0x52'));_0x2a263e[_0xcaa7('0x53')]=_0x417aaa[_0xcaa7('0x54')];_0x2a263e[_0xcaa7('0x55')]=_0x417aaa[_0xcaa7('0x43')]?'queue':_0xcaa7('0x56');return db[_0xcaa7('0x57')][_0xcaa7('0x3d')]({'where':{'id':_0x2a263e[_0xcaa7('0x58')]},'attributes':[_0xcaa7('0x59'),_0xcaa7('0x5a')]})['then'](function(_0xcf623b){if(!_[_0xcaa7('0x5b')](_0x4f162c)&&!_['isNil'](_0xcf623b[_0xcaa7('0x59')])){_0x2a263e[_0xcaa7('0x5c')]=_0xcf623b[_0xcaa7('0x59')];if(!_['isNil'](_0xcf623b[_0xcaa7('0x5a')])){_0x2a263e[_0xcaa7('0x5c')]+='\x20'+_0xcf623b['lastName'];}}})[_0xcaa7('0x5d')](function(){return db[_0xcaa7('0x5e')][_0xcaa7('0x3f')](_0x2a263e);});}})[_0xcaa7('0xc')](function(_0xa6be83){return db[_0xcaa7('0x5f')][_0xcaa7('0x42')]({'where':{'CmHopperId':_0x8a94a8}});})[_0xcaa7('0xc')](function(){return _0x4f162c[_0xcaa7('0x3')](0xcc)[_0xcaa7('0x60')]();})[_0xcaa7('0x3e')](handleError(_0x4f162c,null));};exports[_0xcaa7('0x61')]=function(_0x3a6793,_0x1b494a){var _0x2c2df3=[];return db[_0xcaa7('0x57')][_0xcaa7('0x41')]()[_0xcaa7('0xc')](function(_0x596c65){_0x2c2df3=_[_0xcaa7('0x18')](_0x596c65);return _0x3a6793['user'][_0xcaa7('0x62')]({'where':{'type':_0xcaa7('0x63'),'dialActive':!![],'dialMethod':_0xcaa7('0x64')},'attributes':['id','dialOrderByScheduledAt',_0xcaa7('0x65')],'raw':!![]});})[_0xcaa7('0xc')](function(_0x1cf62d){if(_0x1cf62d&&_0x1cf62d[_0xcaa7('0x2d')]){return db[_0xcaa7('0x66')][_0xcaa7('0x67')](function(_0x322423){var _0x188480={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcaa7('0x51')](_0xcaa7('0x52'))},'VoiceQueueId':{'$in':_['map'](_0x1cf62d,'id')},'$or':[{'UserId':null},{'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']}]};var _0x22a605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1cf62d)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xcaa7('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']}]};var _0x53c13c={'$or':[_0x188480,_0x22a605]};var _0x3dfb2d=[];if(_0x3a6793['body'][_0xcaa7('0x68')]&&_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x68')]===_0xcaa7('0x69')){if(!_[_0xcaa7('0x6a')](_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')])){_0x53c13c['id']={'$in':_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')]};}_0x3dfb2d=[[_0xcaa7('0x6c'),'ASC'],[_0xcaa7('0x6d'),_0x1cf62d[0x0][_0xcaa7('0x6e')]===_0xcaa7('0x6f')?_0xcaa7('0x70'):_0xcaa7('0x6f')],db[_0xcaa7('0x66')][_0xcaa7('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xcaa7('0x70')]];}else{if(!_[_0xcaa7('0x6a')](_0x3a6793[_0xcaa7('0x40')][_0xcaa7('0x6b')])){_0x53c13c['id']={'$notIn':_0x3a6793[_0xcaa7('0x40')]['hopperIds']};}_0x3dfb2d=[[_0xcaa7('0x6c'),'DESC'],['scheduledAt',_0x1cf62d[0x0][_0xcaa7('0x6e')]],db[_0xcaa7('0x66')][_0xcaa7('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xcaa7('0x6f')]];}return db['CmHopper'][_0xcaa7('0x72')]({'attributes':['id',_0xcaa7('0x73'),'phone',_0xcaa7('0x74')],'where':_0x53c13c,'order':_0x3dfb2d,'transaction':_0x322423,'lock':_0x322423[_0xcaa7('0x75')][_0xcaa7('0x76')],'include':[{'model':db[_0xcaa7('0x57')],'as':_0xcaa7('0x77'),'attributes':_0x2c2df3,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xcaa7('0xe')]}]},{'model':db[_0xcaa7('0x78')],'as':_0xcaa7('0x79'),'attributes':['id',_0xcaa7('0xe')]},{'model':db[_0xcaa7('0x45')],'as':'Queue','attributes':['id',_0xcaa7('0xe'),_0xcaa7('0x7a')]}]})['then'](function(_0x22841e){if(_0x22841e){return _0x22841e[_0xcaa7('0xb')]({'UserId':_0x3a6793[_0xcaa7('0x4d')]['id']},{'transaction':_0x322423});}});});}})[_0xcaa7('0xc')](handleEntityNotFound(_0x1b494a,null))[_0xcaa7('0xc')](respondWithResult(_0x1b494a,null))[_0xcaa7('0x3e')](handleError(_0x1b494a,null));};exports['getPreviewRecall']=function(_0x4af581,_0x3cbe09,_0x3ea57c){var _0x2b1e92=[];var _0x2381ce=_0x4af581['params']['id'];var _0x5c0380=_0x4af581[_0xcaa7('0x4d')]['id'];return db[_0xcaa7('0x57')][_0xcaa7('0x41')]()[_0xcaa7('0xc')](function(_0x30517b){_0x2b1e92=_['keys'](_0x30517b);return db[_0xcaa7('0x66')][_0xcaa7('0x67')](function(_0x273efe){const _0x2b4c26={'id':_0x2381ce};return db['CmHopper'][_0xcaa7('0x72')]({'attributes':['id',_0xcaa7('0x73'),_0xcaa7('0x74')],'where':_0x2b4c26,'transaction':_0x273efe,'lock':_0x273efe['LOCK'][_0xcaa7('0x76')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2b1e92,'include':[{'model':db[_0xcaa7('0x7b')],'as':_0xcaa7('0x7c'),'attributes':['id',_0xcaa7('0xe')]}]},{'model':db[_0xcaa7('0x78')],'as':'List','attributes':['id',_0xcaa7('0xe')]},{'model':db[_0xcaa7('0x45')],'as':'Queue','attributes':['id',_0xcaa7('0xe'),_0xcaa7('0x7a')]}]})[_0xcaa7('0xc')](function(_0x5399d3){if(_0x5399d3){return _0x5399d3[_0xcaa7('0xb')]({'UserId':_0x5c0380},{'transaction':_0x273efe});}});});})[_0xcaa7('0xc')](handleEntityNotFound(_0x3cbe09,null))['then'](respondWithResult(_0x3cbe09,null))[_0xcaa7('0x3e')](handleError(_0x3cbe09,null));};exports['getOpenContacts']=function(_0xdc48b8,_0xa3fcb3){return _0xdc48b8['user'][_0xcaa7('0x62')]({'where':{'type':_0xcaa7('0x63'),'dialActive':!![],'dialMethod':_0xcaa7('0x64')},'attributes':['id'],'raw':!![]})['then'](function(_0x1499e9){if(_0x1499e9&&_0x1499e9[_0xcaa7('0x2d')]){return db[_0xcaa7('0x12')][_0xcaa7('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xcaa7('0x52'))},'VoiceQueueId':{'$in':_[_0xcaa7('0x11')](_0x1499e9,'id')},'$or':[{'UserId':null},{'UserId':_0xdc48b8[_0xcaa7('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x505d43){if(!_[_0xcaa7('0x5b')](_0x505d43)&&_[_0xcaa7('0x7d')](_0x505d43)){return _0xa3fcb3[_0xcaa7('0x3')](0xc8)[_0xcaa7('0x4')]({'contacts':_0x505d43});}else{logger[_0xcaa7('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xcaa7('0x7e'),0x194,_0xcaa7('0x7f'));_0xa3fcb3[_0xcaa7('0x80')](0x194);}})[_0xcaa7('0x3e')](handleError(_0xa3fcb3,null));};exports['getTimezones']=function(_0x3e74be,_0x358643){var _0x332433=shared[_0xcaa7('0x81')];var _0x32c6bc=[];_[_0xcaa7('0x11')](_0x332433,function(_0x16559e){_0x32c6bc['push']({'id':_0x16559e[_0xcaa7('0xe')],'name':_0x16559e[_0xcaa7('0xe')],'utcOffset':_0x16559e['utcOffset']});});return _0x358643['status'](0xc8)[_0xcaa7('0x4')]({'tz':_0x32c6bc});};exports[_0xcaa7('0x82')]=function(_0x3797fc,_0x4dfb92){var _0x1a7f2a=shared[_0xcaa7('0x81')];var _0x28cfa4={};if(!_[_0xcaa7('0x5b')](_0x1a7f2a[_0x3797fc[_0xcaa7('0x40')]['id']]))_0x28cfa4=_0x1a7f2a[_0x3797fc[_0xcaa7('0x40')]['id']];return _0x4dfb92[_0xcaa7('0x3')](0xc8)[_0xcaa7('0x4')](_0x28cfa4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f7bc4f2..fe0d7eb 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0x687b[_0x7fd9e9];return _0x285d92;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x437b02,_0x252909){var _0x3ebd50=function(_0x6b3e95){while(--_0x6b3e95){_0x437b02['push'](_0x437b02['shift']());}};_0x3ebd50(++_0x252909);}(_0x1261,0x144));var _0x1126=function(_0x3815b2,_0xdeaa84){_0x3815b2=_0x3815b2-0x0;var _0x2ebd79=_0x1261[_0x3815b2];return _0x2ebd79;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0751e8f..a49244f 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 _0x0195=['findAll','LOCK','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UPDATE','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','CmHopper','options','raw','where','attributes','limit','include','model','map','then','info','GetCmHopper','debug','message','error','find','ShowCmHopper','stringify','catch','create','CreateCmHopper','UpdateCmHopper','update','body','active','DestroyCmHopper','CmContact','describe','transaction'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x0195,0x168));var _0x5019=function(_0x1c0a3d,_0x1f0fde){_0x1c0a3d=_0x1c0a3d-0x0;var _0x15526b=_0x0195[_0x1c0a3d];return _0x15526b;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require(_0x5019('0x3'));var db=require(_0x5019('0x4'))['db'];var logger=require(_0x5019('0x5'))('rpc');exports['GetCmHopper']=function(_0x552b72){var _0x3a1c03=this;return new Promise(function(_0x52619d,_0x351aa7){return db[_0x5019('0x6')]['findAll']({'raw':_0x552b72['options']?_0x552b72[_0x5019('0x7')][_0x5019('0x8')]===undefined?!![]:![]:!![],'where':_0x552b72['options']?_0x552b72['options'][_0x5019('0x9')]||null:null,'attributes':_0x552b72[_0x5019('0x7')]?_0x552b72[_0x5019('0x7')][_0x5019('0xa')]||null:null,'limit':_0x552b72[_0x5019('0x7')]?_0x552b72[_0x5019('0x7')][_0x5019('0xb')]||null:null,'include':_0x552b72[_0x5019('0x7')]?_0x552b72[_0x5019('0x7')][_0x5019('0xc')]?_['map'](_0x552b72[_0x5019('0x7')][_0x5019('0xc')],function(_0x4d6ef4){return{'model':db[_0x4d6ef4[_0x5019('0xd')]],'as':_0x4d6ef4['as'],'attributes':_0x4d6ef4['attributes'],'include':_0x4d6ef4[_0x5019('0xc')]?_[_0x5019('0xe')](_0x4d6ef4[_0x5019('0xc')],function(_0x182849){return{'model':db[_0x182849[_0x5019('0xd')]],'as':_0x182849['as'],'attributes':_0x182849[_0x5019('0xa')],'include':_0x182849[_0x5019('0xc')]?_[_0x5019('0xe')](_0x182849[_0x5019('0xc')],function(_0x500782){return{'model':db[_0x500782[_0x5019('0xd')]],'as':_0x500782['as'],'attributes':_0x500782[_0x5019('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5019('0xf')](function(_0x466392){logger[_0x5019('0x10')](_0x5019('0x11'),_0x552b72);logger[_0x5019('0x12')](_0x5019('0x11'),_0x552b72,JSON['stringify'](_0x466392));_0x52619d(_0x466392);})['catch'](function(_0x5de5dd){logger['error'](_0x5019('0x11'),_0x5de5dd[_0x5019('0x13')],_0x552b72);_0x351aa7(_0x3a1c03[_0x5019('0x14')](0x1f4,_0x5de5dd[_0x5019('0x13')]));});});};exports['ShowCmHopper']=function(_0x13f51e){var _0x81d2d7=this;return new Promise(function(_0x479760,_0x37c95b){return db['CmHopper'][_0x5019('0x15')]({'raw':_0x13f51e[_0x5019('0x7')]?_0x13f51e['options']['raw']===undefined?!![]:![]:!![],'where':_0x13f51e[_0x5019('0x7')]?_0x13f51e[_0x5019('0x7')][_0x5019('0x9')]||null:null,'attributes':_0x13f51e['options']?_0x13f51e[_0x5019('0x7')][_0x5019('0xa')]||null:null,'include':_0x13f51e[_0x5019('0x7')]?_0x13f51e['options'][_0x5019('0xc')]?_['map'](_0x13f51e[_0x5019('0x7')][_0x5019('0xc')],function(_0x542fff){return{'model':db[_0x542fff[_0x5019('0xd')]],'as':_0x542fff['as'],'attributes':_0x542fff[_0x5019('0xa')],'include':_0x542fff[_0x5019('0xc')]?_[_0x5019('0xe')](_0x542fff['include'],function(_0x334f55){return{'model':db[_0x334f55['model']],'as':_0x334f55['as'],'attributes':_0x334f55['attributes'],'include':_0x334f55['include']?_[_0x5019('0xe')](_0x334f55['include'],function(_0x215cda){return{'model':db[_0x215cda[_0x5019('0xd')]],'as':_0x215cda['as'],'attributes':_0x215cda[_0x5019('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5019('0xf')](function(_0x371251){logger[_0x5019('0x10')](_0x5019('0x16'),_0x13f51e);logger['debug'](_0x5019('0x16'),_0x13f51e,JSON[_0x5019('0x17')](_0x371251));_0x479760(_0x371251);})[_0x5019('0x18')](function(_0x1783da){logger[_0x5019('0x14')](_0x5019('0x16'),_0x1783da['message'],_0x13f51e);_0x37c95b(_0x81d2d7[_0x5019('0x14')](0x1f4,_0x1783da[_0x5019('0x13')]));});});};exports['CreateCmHopper']=function(_0x5b8139){var _0x4bf45f=this;return new Promise(function(_0x3b388e,_0x1ff672){return db['CmHopper'][_0x5019('0x19')](_0x5b8139['body'],{'raw':_0x5b8139[_0x5019('0x7')]?_0x5b8139[_0x5019('0x7')]['raw']===undefined?!![]:![]:!![]})[_0x5019('0xf')](function(_0x134d1d){logger[_0x5019('0x10')]('CreateCmHopper',_0x5b8139);logger['debug'](_0x5019('0x1a'),_0x5b8139,JSON[_0x5019('0x17')](_0x134d1d));_0x3b388e(_0x134d1d);})[_0x5019('0x18')](function(_0x23e798){logger[_0x5019('0x14')](_0x5019('0x1a'),_0x23e798[_0x5019('0x13')],_0x5b8139);_0x1ff672(_0x4bf45f[_0x5019('0x14')](0x1f4,_0x23e798[_0x5019('0x13')]));});});};exports[_0x5019('0x1b')]=function(_0x3ee4b2){var _0x2cf025=this;return new Promise(function(_0x111075,_0x4bab18){return db[_0x5019('0x6')][_0x5019('0x1c')](_0x3ee4b2[_0x5019('0x1d')],{'raw':_0x3ee4b2[_0x5019('0x7')]?_0x3ee4b2[_0x5019('0x7')][_0x5019('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee4b2[_0x5019('0x7')]?_0x3ee4b2['options'][_0x5019('0x9')]||null:null,'attributes':_0x3ee4b2[_0x5019('0x7')]?_0x3ee4b2[_0x5019('0x7')][_0x5019('0xa')]||null:null,'limit':_0x3ee4b2['options']?_0x3ee4b2[_0x5019('0x7')][_0x5019('0xb')]||null:null})[_0x5019('0xf')](function(_0x3450ad){logger[_0x5019('0x10')](_0x5019('0x1b'),_0x3ee4b2);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x5019('0x17')](_0x3ee4b2[_0x5019('0x7')][_0x5019('0x9')]),_0x3ee4b2[_0x5019('0x1d')][_0x5019('0x1e')]);logger[_0x5019('0x12')]('UpdateCmHopper',_0x3ee4b2,JSON[_0x5019('0x17')](_0x3450ad));_0x111075(_0x3450ad);})[_0x5019('0x18')](function(_0x2156c2){logger['error'](_0x5019('0x1b'),_0x2156c2[_0x5019('0x13')],_0x3ee4b2);_0x4bab18(_0x2cf025[_0x5019('0x14')](0x1f4,_0x2156c2[_0x5019('0x13')]));});});};exports[_0x5019('0x1f')]=function(_0x2785ae){var _0x56139e=this;return new Promise(function(_0x287d29,_0x2f9aad){return db['CmHopper']['destroy']({'where':_0x2785ae[_0x5019('0x7')]?_0x2785ae[_0x5019('0x7')][_0x5019('0x9')]||null:null})[_0x5019('0xf')](function(_0x4d8fbc){logger[_0x5019('0x10')]('DestroyCmHopper',_0x2785ae);logger['debug'](_0x5019('0x1f'),_0x2785ae,JSON[_0x5019('0x17')](_0x4d8fbc));_0x287d29(_0x4d8fbc);})[_0x5019('0x18')](function(_0x472287){logger[_0x5019('0x14')](_0x5019('0x1f'),_0x472287[_0x5019('0x13')],_0x2785ae);_0x2f9aad(_0x56139e[_0x5019('0x14')](0x1f4,_0x472287['message']));});});};exports['GetContactDialer']=function(_0x4d04a9){var _0x54a67e=this;return new Promise(function(_0x5898b9,_0x3b8cb9){return db[_0x5019('0x20')][_0x5019('0x21')]()[_0x5019('0xf')](function(_0x1fb7d5){return db['sequelize'][_0x5019('0x22')](function(_0xe8601c){return db['CmHopper'][_0x5019('0x23')]({'where':_0x4d04a9['options']?_0x4d04a9['options'][_0x5019('0x9')]||null:null,'attributes':_0x4d04a9[_0x5019('0x7')]?_0x4d04a9[_0x5019('0x7')][_0x5019('0xa')]||null:null,'limit':_0x4d04a9[_0x5019('0x7')]?_0x4d04a9['options']['limit']||null:null,'order':_0x4d04a9[_0x5019('0x7')]?_0x4d04a9[_0x5019('0x7')]['order']||null:null,'transaction':_0xe8601c,'lock':_0xe8601c[_0x5019('0x24')]['UPDATE'],'include':[{'model':db[_0x5019('0x20')],'as':_0x5019('0x25'),'attributes':_[_0x5019('0x26')](_0x1fb7d5)},{'model':db[_0x5019('0x27')],'as':_0x5019('0x28'),'attributes':['id',_0x5019('0x29'),_0x5019('0x2a')]}]})[_0x5019('0xf')](function(_0x1c5c3a){var _0x272434=[];var _0xc8b82f=[];for(var _0x13cf6f=0x0;_0x13cf6f<_0x1c5c3a['length'];_0x13cf6f+=0x1){var _0x5cc816=_0x1c5c3a[_0x13cf6f][_0x5019('0x2b')];if(_0x5cc816===null){_0x272434[_0x5019('0x2c')](_0x1c5c3a[_0x13cf6f][_0x5019('0x1c')](_0x4d04a9[_0x5019('0x1d')],{'transaction':_0xe8601c}));}else if(!_0xc8b82f[_0x5019('0x2d')](_0x5cc816)){_0xc8b82f['push'](_0x5cc816);_0x272434[_0x5019('0x2c')](_0x1c5c3a[_0x13cf6f][_0x5019('0x1c')](_0x4d04a9[_0x5019('0x1d')],{'transaction':_0xe8601c}));}}return BPromise[_0x5019('0x2e')](_0x272434);});})[_0x5019('0xf')](function(_0x10475c){logger[_0x5019('0x10')](_0x5019('0x2f'),_0x4d04a9);if(_0x10475c[_0x5019('0x30')]>0x0){logger['info'](_0x5019('0x31'),_0x10475c[0x0][_0x5019('0x32')]['id'],_0x10475c[0x0][_0x5019('0x32')][_0x5019('0x33')],_0x10475c[0x0]['dataValues']['active']);}logger[_0x5019('0x12')](_0x5019('0x2f'),_0x4d04a9,JSON[_0x5019('0x17')](_0x10475c));_0x5898b9(_0x10475c);})[_0x5019('0x18')](function(_0x445efd){logger[_0x5019('0x14')](_0x5019('0x2f'),_0x445efd[_0x5019('0x13')],_0x4d04a9);_0x3b8cb9(_0x54a67e[_0x5019('0x14')](0x1f4,_0x445efd[_0x5019('0x13')]));});});});};exports[_0x5019('0x34')]=function(_0x4cf94c){var _0x3c3f11=this;return new Promise(function(_0x5d2a98,_0x2411be){return db[_0x5019('0x35')][_0x5019('0x22')](function(_0xd9e410){return db['CmHopperFinal'][_0x5019('0x19')](_0x4cf94c['body'],{'raw':_0x4cf94c['options']?_0x4cf94c[_0x5019('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0xd9e410})[_0x5019('0xf')](function(){logger[_0x5019('0x10')](_0x5019('0x36'),JSON[_0x5019('0x17')](_0x4cf94c[_0x5019('0x7')][_0x5019('0x9')]),_0x4cf94c[_0x5019('0x7')][_0x5019('0x9')][_0x5019('0x1e')]);return db[_0x5019('0x6')]['destroy']({'where':_0x4cf94c[_0x5019('0x7')]?_0x4cf94c[_0x5019('0x7')][_0x5019('0x9')]||null:null,'transaction':_0xd9e410});});})['then'](function(_0x502dbe){logger[_0x5019('0x10')](_0x5019('0x34'),_0x4cf94c);logger[_0x5019('0x12')]('MoveContactManagedDialer',_0x4cf94c,JSON[_0x5019('0x17')](_0x502dbe));_0x5d2a98(_0x502dbe);})[_0x5019('0x18')](function(_0x2bfd34){logger[_0x5019('0x14')]('MoveContactManagedDialer',_0x2bfd34['message'],_0x4cf94c);_0x2411be(_0x3c3f11[_0x5019('0x14')](0x1f4,_0x2bfd34['message']));});});};exports[_0x5019('0x37')]=function(_0x411bc8){var _0x4d2574=this;return new Promise(function(_0xd668f3,_0x3ef25b){return db[_0x5019('0x6')][_0x5019('0x23')]({'raw':_0x411bc8[_0x5019('0x7')]?_0x411bc8[_0x5019('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x411bc8[_0x5019('0x7')]?_0x411bc8[_0x5019('0x7')]['where']||null:null,'attributes':[[db[_0x5019('0x35')]['fn'](_0x5019('0x38'),db[_0x5019('0x35')]['fn']('IF',db[_0x5019('0x35')][_0x5019('0x39')](_0x5019('0x3a')+util['format']('\x22%s\x22',moment()['format'](_0x5019('0x3b')))+_0x5019('0x3c')))),_0x5019('0x3d')]]})[_0x5019('0xf')](function(_0x211382){logger[_0x5019('0x10')](_0x5019('0x37'),_0x411bc8);logger[_0x5019('0x12')](_0x5019('0x37'),_0x411bc8,JSON[_0x5019('0x17')](_0x211382));_0xd668f3(_0x211382);})[_0x5019('0x18')](function(_0x4c6220){logger[_0x5019('0x14')](_0x5019('0x37'),_0x4c6220['message'],_0x411bc8);_0x3ef25b(_0x4d2574[_0x5019('0x14')](0x1f4,_0x4c6220[_0x5019('0x13')]));});});};exports[_0x5019('0x3e')]=function(_0x353df4){var _0x188bd9=this;return new Promise(function(_0x432f67,_0x35b1f7){return db[_0x5019('0x20')][_0x5019('0x21')]()[_0x5019('0xf')](function(){return db[_0x5019('0x35')][_0x5019('0x22')](function(_0x3016e6){return db[_0x5019('0x6')][_0x5019('0x23')]({'where':_0x353df4['options']?_0x353df4[_0x5019('0x7')][_0x5019('0x9')]||null:null,'attributes':_0x353df4[_0x5019('0x7')]?_0x353df4[_0x5019('0x7')][_0x5019('0xa')]||null:null,'limit':0x1,'order':_0x353df4[_0x5019('0x7')]?_0x353df4[_0x5019('0x7')][_0x5019('0x3f')]||null:null,'group':db[_0x5019('0x6')]['UserId'],'transaction':_0x3016e6,'lock':_0x3016e6['LOCK'][_0x5019('0x40')],'include':_0x353df4[_0x5019('0x7')]?_0x353df4[_0x5019('0x7')][_0x5019('0xc')]?_[_0x5019('0xe')](_0x353df4[_0x5019('0x7')][_0x5019('0xc')],function(_0x4e9118){return{'model':db[_0x4e9118[_0x5019('0xd')]],'as':_0x4e9118['as'],'attributes':_0x4e9118[_0x5019('0xa')],'include':_0x4e9118[_0x5019('0xc')]?_[_0x5019('0xe')](_0x4e9118[_0x5019('0xc')],function(_0x3c30a0){return{'model':db[_0x3c30a0[_0x5019('0xd')]],'as':_0x3c30a0['as'],'attributes':_0x3c30a0[_0x5019('0xa')],'include':_0x3c30a0[_0x5019('0xc')]?_[_0x5019('0xe')](_0x3c30a0['include'],function(_0x213746){return{'model':db[_0x213746['model']],'as':_0x213746['as'],'attributes':_0x213746[_0x5019('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5019('0xf')](function(_0x579130){var _0x24b4a3=[];for(var _0x4f7c9a=0x0;_0x4f7c9a<_0x579130[_0x5019('0x30')];_0x4f7c9a+=0x1){_0x24b4a3[_0x5019('0x2c')](_0x579130[_0x4f7c9a][_0x5019('0x1c')](_0x353df4[_0x5019('0x1d')],{'transaction':_0x3016e6}));}return BPromise['all'](_0x24b4a3);});})[_0x5019('0xf')](function(_0x57eb46){logger[_0x5019('0x10')]('GetContactRecallMe',_0x353df4);logger[_0x5019('0x12')](_0x5019('0x3e'),_0x353df4,JSON[_0x5019('0x17')](_0x57eb46));_0x432f67(_0x57eb46);})['catch'](function(_0xd89c7e){logger[_0x5019('0x14')]('GetContactRecallMe',_0xd89c7e[_0x5019('0x13')],_0x353df4);_0x35b1f7(_0x188bd9[_0x5019('0x14')](0x1f4,_0xd89c7e['message']));});});});};exports[_0x5019('0x41')]=function(_0x48c34e){var _0xbae654=this;return new Promise(function(_0x35ad2e,_0x21e09e){db[_0x5019('0x20')][_0x5019('0x21')]()[_0x5019('0xf')](function(_0x128b96){return db[_0x5019('0x6')][_0x5019('0x23')]({'raw':_0x48c34e['options']?_0x48c34e[_0x5019('0x7')][_0x5019('0x8')]===undefined?!![]:![]:!![],'where':_0x48c34e[_0x5019('0x7')]?_0x48c34e[_0x5019('0x7')][_0x5019('0x9')]||null:null,'attributes':_0x48c34e[_0x5019('0x7')]?_0x48c34e[_0x5019('0x7')][_0x5019('0xa')]||null:null,'limit':_0x48c34e[_0x5019('0x7')]?_0x48c34e['options'][_0x5019('0xb')]||null:null,'include':_0x48c34e[_0x5019('0x7')]?_0x48c34e['options'][_0x5019('0xc')]?_[_0x5019('0xe')](_0x48c34e[_0x5019('0x7')]['include'],function(_0x2b7896){return{'model':db[_0x2b7896[_0x5019('0xd')]],'as':_0x2b7896['as'],'attributes':_0x2b7896['as']===_0x5019('0x25')?_[_0x5019('0x26')](_0x128b96):_0x2b7896['attributes'],'include':_0x2b7896[_0x5019('0xc')]?_[_0x5019('0xe')](_0x2b7896[_0x5019('0xc')],function(_0xc6aaec){return{'model':db[_0xc6aaec[_0x5019('0xd')]],'as':_0xc6aaec['as'],'attributes':_0xc6aaec[_0x5019('0xa')],'include':_0xc6aaec[_0x5019('0xc')]?_[_0x5019('0xe')](_0xc6aaec['include'],function(_0x267022){return{'model':db[_0x267022[_0x5019('0xd')]],'as':_0x267022['as'],'attributes':_0x267022[_0x5019('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5019('0xf')](function(_0x127c69){logger[_0x5019('0x10')](_0x5019('0x11'),_0x48c34e);logger[_0x5019('0x12')](_0x5019('0x11'),_0x48c34e,JSON[_0x5019('0x17')](_0x127c69));_0x35ad2e(_0x127c69);})[_0x5019('0x18')](function(_0x39974f){logger[_0x5019('0x14')](_0x5019('0x11'),_0x39974f['message'],_0x48c34e);_0x21e09e(_0xbae654['error'](0x1f4,_0x39974f['message']));});});});};exports[_0x5019('0x42')]=function(_0x4fdfac){var _0x5a09ac=this;return new Promise(function(_0x8df182,_0x1cf6ad){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x4fdfac[_0x5019('0x7')][_0x5019('0x9')]['phone']},'attributes':['id',_0x5019('0x43')],'order':[['id',_0x5019('0x44')]]})[_0x5019('0xf')](function(_0xcc2e7f){logger['info'](_0x5019('0x45'),_0x4fdfac);logger[_0x5019('0x12')](_0x5019('0x45'),_0x4fdfac,JSON[_0x5019('0x17')](_0xcc2e7f));_0x8df182(_0xcc2e7f);})[_0x5019('0x18')](function(_0xbfabc2){logger['error'](_0x5019('0x45'),_0xbfabc2['message'],_0x4fdfac);_0x1cf6ad(_0x5a09ac['error'](0x1f4,_0xbfabc2['message']));});});};exports[_0x5019('0x46')]=function(_0x207b69){var _0xe92a3f=this;return new Promise(function(_0x567009,_0x55e9b6){return db[_0x5019('0x35')][_0x5019('0x22')](function(_0x5ac34b){var _0x336061=_0x207b69[_0x5019('0x7')]&&_0x207b69[_0x5019('0x7')][_0x5019('0x9')]?_0x207b69[_0x5019('0x7')][_0x5019('0x9')]:{};return db[_0x5019('0x6')][_0x5019('0x1c')](_0x207b69['body'],{'where':_0x336061,'transaction':_0x5ac34b})[_0x5019('0xf')](function(_0x4449bb){logger[_0x5019('0x10')](_0x5019('0x46'),_0x207b69);logger[_0x5019('0x12')]('ResetActiveCalls',_0x207b69,JSON[_0x5019('0x17')](_0x4449bb));_0x567009(_0x4449bb);})[_0x5019('0x18')](function(_0x2a4db9){logger[_0x5019('0x14')](_0x5019('0x46'),_0x2a4db9[_0x5019('0x13')],_0x207b69);_0x55e9b6(_0xe92a3f[_0x5019('0x14')](0x1f4,_0x2a4db9[_0x5019('0x13')]));});});});};exports[_0x5019('0x47')]=function(_0x11bd04){var _0x146993=this;var _0x37f6b5=_0x11bd04['body'][_0x5019('0x9')][_0x5019('0x48')];var _0x58dab1=_0x11bd04[_0x5019('0x1d')]['where'][_0x5019('0x49')];var _0x5ae4d3=_0x11bd04[_0x5019('0x1d')]['where'][_0x5019('0x4a')];return new Promise(function(_0x94e13d,_0x4373c2){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x37f6b5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x5019('0x39')](_0x5019('0x4b')+_0x58dab1+_0x5019('0x4c')),'$gt':db[_0x5019('0x35')][_0x5019('0x39')]('NOW()')}},'UserId':{'$in':_0x5ae4d3}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x5019('0x28'),'attributes':['id',_0x5019('0x29'),'voicePause']},{'model':db[_0x5019('0x4d')],'as':_0x5019('0x4e')}]})[_0x5019('0xf')](function(_0x1ba2bb){if(_0x1ba2bb['length']>0x0){return db[_0x5019('0x35')][_0x5019('0x22')](function(_0x2b6a75){return db[_0x5019('0x6')]['update']({'recallmeNotifiedDate':db[_0x5019('0x35')][_0x5019('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0x5019('0xe')](_0x1ba2bb,'id')}},'transaction':_0x2b6a75})[_0x5019('0xf')](function(){_0x94e13d(_0x1ba2bb);})['catch'](function(_0x45f52f){logger['error'](_0x5019('0x47'),_0x45f52f[_0x5019('0x13')],_0x11bd04);_0x4373c2(_0x146993[_0x5019('0x14')](0x1f4,_0x45f52f[_0x5019('0x13')]));});})[_0x5019('0x18')](function(_0x502686){logger[_0x5019('0x14')](_0x5019('0x47'),_0x502686[_0x5019('0x13')],_0x11bd04);_0x4373c2(_0x146993[_0x5019('0x14')](0x1f4,_0x502686[_0x5019('0x13')]));});}else{_0x94e13d(_0x1ba2bb);}});});}; \ No newline at end of file +var _0x9ebf=['NOW()','User','voicePause','CmList','List','lodash','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','attributes','limit','include','model','map','then','info','stringify','error','message','ShowCmHopper','find','raw','where','debug','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','Agent','name','push','includes','all','length','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','describe','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE'];(function(_0x3fa86c,_0x25b021){var _0x5e1de1=function(_0x3d3e5d){while(--_0x3d3e5d){_0x3fa86c['push'](_0x3fa86c['shift']());}};_0x5e1de1(++_0x25b021);}(_0x9ebf,0x145));var _0xf9eb=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9ebf[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xf9eb('0x0'));var util=require(_0xf9eb('0x1'));var moment=require('moment');var BPromise=require(_0xf9eb('0x2'));var db=require(_0xf9eb('0x3'))['db'];var logger=require('../../config/logger')(_0xf9eb('0x4'));exports[_0xf9eb('0x5')]=function(_0x285b8a){var _0x137c97=this;return new Promise(function(_0x3fa46f,_0x4c2caf){return db[_0xf9eb('0x6')]['findAll']({'raw':_0x285b8a[_0xf9eb('0x7')]?_0x285b8a[_0xf9eb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x285b8a[_0xf9eb('0x7')]?_0x285b8a['options']['where']||null:null,'attributes':_0x285b8a[_0xf9eb('0x7')]?_0x285b8a[_0xf9eb('0x7')][_0xf9eb('0x8')]||null:null,'limit':_0x285b8a[_0xf9eb('0x7')]?_0x285b8a['options'][_0xf9eb('0x9')]||null:null,'include':_0x285b8a[_0xf9eb('0x7')]?_0x285b8a[_0xf9eb('0x7')][_0xf9eb('0xa')]?_['map'](_0x285b8a['options'][_0xf9eb('0xa')],function(_0x2e749d){return{'model':db[_0x2e749d[_0xf9eb('0xb')]],'as':_0x2e749d['as'],'attributes':_0x2e749d[_0xf9eb('0x8')],'include':_0x2e749d['include']?_[_0xf9eb('0xc')](_0x2e749d['include'],function(_0xd2dadc){return{'model':db[_0xd2dadc[_0xf9eb('0xb')]],'as':_0xd2dadc['as'],'attributes':_0xd2dadc[_0xf9eb('0x8')],'include':_0xd2dadc[_0xf9eb('0xa')]?_[_0xf9eb('0xc')](_0xd2dadc[_0xf9eb('0xa')],function(_0x49fb3e){return{'model':db[_0x49fb3e['model']],'as':_0x49fb3e['as'],'attributes':_0x49fb3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9eb('0xd')](function(_0x3e072d){logger[_0xf9eb('0xe')](_0xf9eb('0x5'),_0x285b8a);logger['debug']('GetCmHopper',_0x285b8a,JSON[_0xf9eb('0xf')](_0x3e072d));_0x3fa46f(_0x3e072d);})['catch'](function(_0x58a55e){logger[_0xf9eb('0x10')](_0xf9eb('0x5'),_0x58a55e[_0xf9eb('0x11')],_0x285b8a);_0x4c2caf(_0x137c97['error'](0x1f4,_0x58a55e[_0xf9eb('0x11')]));});});};exports[_0xf9eb('0x12')]=function(_0x21c708){var _0x4af691=this;return new Promise(function(_0x28bf4b,_0x2f1922){return db[_0xf9eb('0x6')][_0xf9eb('0x13')]({'raw':_0x21c708[_0xf9eb('0x7')]?_0x21c708[_0xf9eb('0x7')][_0xf9eb('0x14')]===undefined?!![]:![]:!![],'where':_0x21c708['options']?_0x21c708[_0xf9eb('0x7')][_0xf9eb('0x15')]||null:null,'attributes':_0x21c708['options']?_0x21c708[_0xf9eb('0x7')][_0xf9eb('0x8')]||null:null,'include':_0x21c708[_0xf9eb('0x7')]?_0x21c708[_0xf9eb('0x7')][_0xf9eb('0xa')]?_[_0xf9eb('0xc')](_0x21c708[_0xf9eb('0x7')][_0xf9eb('0xa')],function(_0x178ba4){return{'model':db[_0x178ba4[_0xf9eb('0xb')]],'as':_0x178ba4['as'],'attributes':_0x178ba4[_0xf9eb('0x8')],'include':_0x178ba4['include']?_[_0xf9eb('0xc')](_0x178ba4[_0xf9eb('0xa')],function(_0x1e02bf){return{'model':db[_0x1e02bf[_0xf9eb('0xb')]],'as':_0x1e02bf['as'],'attributes':_0x1e02bf[_0xf9eb('0x8')],'include':_0x1e02bf['include']?_['map'](_0x1e02bf[_0xf9eb('0xa')],function(_0x5338f3){return{'model':db[_0x5338f3[_0xf9eb('0xb')]],'as':_0x5338f3['as'],'attributes':_0x5338f3[_0xf9eb('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf9eb('0xd')](function(_0x24fd22){logger[_0xf9eb('0xe')](_0xf9eb('0x12'),_0x21c708);logger[_0xf9eb('0x16')](_0xf9eb('0x12'),_0x21c708,JSON['stringify'](_0x24fd22));_0x28bf4b(_0x24fd22);})[_0xf9eb('0x17')](function(_0x1d73fa){logger[_0xf9eb('0x10')](_0xf9eb('0x12'),_0x1d73fa[_0xf9eb('0x11')],_0x21c708);_0x2f1922(_0x4af691[_0xf9eb('0x10')](0x1f4,_0x1d73fa['message']));});});};exports[_0xf9eb('0x18')]=function(_0x941ee4){var _0x38509e=this;return new Promise(function(_0x504ca2,_0x6f35e6){return db['CmHopper'][_0xf9eb('0x19')](_0x941ee4[_0xf9eb('0x1a')],{'raw':_0x941ee4[_0xf9eb('0x7')]?_0x941ee4[_0xf9eb('0x7')]['raw']===undefined?!![]:![]:!![]})[_0xf9eb('0xd')](function(_0x3319d3){logger['info']('CreateCmHopper',_0x941ee4);logger[_0xf9eb('0x16')](_0xf9eb('0x18'),_0x941ee4,JSON[_0xf9eb('0xf')](_0x3319d3));_0x504ca2(_0x3319d3);})[_0xf9eb('0x17')](function(_0x316469){logger[_0xf9eb('0x10')](_0xf9eb('0x18'),_0x316469[_0xf9eb('0x11')],_0x941ee4);_0x6f35e6(_0x38509e[_0xf9eb('0x10')](0x1f4,_0x316469[_0xf9eb('0x11')]));});});};exports[_0xf9eb('0x1b')]=function(_0x163d2b){var _0x5fc70f=this;return new Promise(function(_0x3b7380,_0x4e239a){return db[_0xf9eb('0x6')][_0xf9eb('0x1c')](_0x163d2b['body'],{'raw':_0x163d2b[_0xf9eb('0x7')]?_0x163d2b[_0xf9eb('0x7')][_0xf9eb('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163d2b['options']?_0x163d2b['options']['where']||null:null,'attributes':_0x163d2b['options']?_0x163d2b[_0xf9eb('0x7')][_0xf9eb('0x8')]||null:null,'limit':_0x163d2b[_0xf9eb('0x7')]?_0x163d2b[_0xf9eb('0x7')][_0xf9eb('0x9')]||null:null})['then'](function(_0x5128a0){logger[_0xf9eb('0xe')](_0xf9eb('0x1b'),_0x163d2b);logger[_0xf9eb('0xe')](_0xf9eb('0x1d'),JSON[_0xf9eb('0xf')](_0x163d2b[_0xf9eb('0x7')][_0xf9eb('0x15')]),_0x163d2b['body'][_0xf9eb('0x1e')]);logger[_0xf9eb('0x16')](_0xf9eb('0x1b'),_0x163d2b,JSON[_0xf9eb('0xf')](_0x5128a0));_0x3b7380(_0x5128a0);})[_0xf9eb('0x17')](function(_0x22831d){logger[_0xf9eb('0x10')](_0xf9eb('0x1b'),_0x22831d['message'],_0x163d2b);_0x4e239a(_0x5fc70f[_0xf9eb('0x10')](0x1f4,_0x22831d[_0xf9eb('0x11')]));});});};exports[_0xf9eb('0x1f')]=function(_0x3087a7){var _0x44caab=this;return new Promise(function(_0x365d82,_0x1ee652){return db[_0xf9eb('0x6')][_0xf9eb('0x20')]({'where':_0x3087a7[_0xf9eb('0x7')]?_0x3087a7[_0xf9eb('0x7')][_0xf9eb('0x15')]||null:null})[_0xf9eb('0xd')](function(_0xec414e){logger[_0xf9eb('0xe')](_0xf9eb('0x1f'),_0x3087a7);logger[_0xf9eb('0x16')](_0xf9eb('0x1f'),_0x3087a7,JSON['stringify'](_0xec414e));_0x365d82(_0xec414e);})['catch'](function(_0x4da623){logger[_0xf9eb('0x10')]('DestroyCmHopper',_0x4da623['message'],_0x3087a7);_0x1ee652(_0x44caab[_0xf9eb('0x10')](0x1f4,_0x4da623[_0xf9eb('0x11')]));});});};exports[_0xf9eb('0x21')]=function(_0xcbfe7f){var _0x8b075e=this;return new Promise(function(_0x5604a7,_0x5eae37){return db[_0xf9eb('0x22')]['describe']()[_0xf9eb('0xd')](function(_0x421d36){return db[_0xf9eb('0x23')][_0xf9eb('0x24')](function(_0x24a913){return db[_0xf9eb('0x6')][_0xf9eb('0x25')]({'where':_0xcbfe7f['options']?_0xcbfe7f[_0xf9eb('0x7')][_0xf9eb('0x15')]||null:null,'attributes':_0xcbfe7f[_0xf9eb('0x7')]?_0xcbfe7f['options'][_0xf9eb('0x8')]||null:null,'limit':_0xcbfe7f[_0xf9eb('0x7')]?_0xcbfe7f[_0xf9eb('0x7')]['limit']||null:null,'order':_0xcbfe7f['options']?_0xcbfe7f[_0xf9eb('0x7')][_0xf9eb('0x26')]||null:null,'transaction':_0x24a913,'lock':_0x24a913[_0xf9eb('0x27')][_0xf9eb('0x28')],'include':[{'model':db[_0xf9eb('0x22')],'as':_0xf9eb('0x29'),'attributes':_[_0xf9eb('0x2a')](_0x421d36)},{'model':db['User'],'as':_0xf9eb('0x2b'),'attributes':['id',_0xf9eb('0x2c'),'voicePause']}]})[_0xf9eb('0xd')](function(_0xa796ec){var _0x1d8cc5=[];var _0x266dbd=[];for(var _0x352c20=0x0;_0x352c20<_0xa796ec['length'];_0x352c20+=0x1){var _0x468f4e=_0xa796ec[_0x352c20]['UserId'];if(_0x468f4e===null){_0x1d8cc5[_0xf9eb('0x2d')](_0xa796ec[_0x352c20]['update'](_0xcbfe7f[_0xf9eb('0x1a')],{'transaction':_0x24a913}));}else if(!_0x266dbd[_0xf9eb('0x2e')](_0x468f4e)){_0x266dbd[_0xf9eb('0x2d')](_0x468f4e);_0x1d8cc5[_0xf9eb('0x2d')](_0xa796ec[_0x352c20]['update'](_0xcbfe7f[_0xf9eb('0x1a')],{'transaction':_0x24a913}));}}return BPromise[_0xf9eb('0x2f')](_0x1d8cc5);});})[_0xf9eb('0xd')](function(_0x1b320e){logger[_0xf9eb('0xe')](_0xf9eb('0x21'),_0xcbfe7f);if(_0x1b320e[_0xf9eb('0x30')]>0x0){logger[_0xf9eb('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1b320e[0x0][_0xf9eb('0x31')]['id'],_0x1b320e[0x0]['dataValues'][_0xf9eb('0x32')],_0x1b320e[0x0]['dataValues']['active']);}logger[_0xf9eb('0x16')](_0xf9eb('0x21'),_0xcbfe7f,JSON[_0xf9eb('0xf')](_0x1b320e));_0x5604a7(_0x1b320e);})[_0xf9eb('0x17')](function(_0x6b87cb){logger[_0xf9eb('0x10')](_0xf9eb('0x21'),_0x6b87cb[_0xf9eb('0x11')],_0xcbfe7f);_0x5eae37(_0x8b075e['error'](0x1f4,_0x6b87cb['message']));});});});};exports['MoveContactManagedDialer']=function(_0x9f8601){var _0x2a2909=this;return new Promise(function(_0x19278e,_0x496dac){return db[_0xf9eb('0x23')][_0xf9eb('0x24')](function(_0x22563b){return db['CmHopperFinal'][_0xf9eb('0x19')](_0x9f8601[_0xf9eb('0x1a')],{'raw':_0x9f8601[_0xf9eb('0x7')]?_0x9f8601[_0xf9eb('0x7')][_0xf9eb('0x14')]===undefined?!![]:![]:!![],'transaction':_0x22563b})[_0xf9eb('0xd')](function(){logger[_0xf9eb('0xe')](_0xf9eb('0x33'),JSON[_0xf9eb('0xf')](_0x9f8601[_0xf9eb('0x7')]['where']),_0x9f8601[_0xf9eb('0x7')][_0xf9eb('0x15')][_0xf9eb('0x1e')]);return db[_0xf9eb('0x6')]['destroy']({'where':_0x9f8601[_0xf9eb('0x7')]?_0x9f8601['options'][_0xf9eb('0x15')]||null:null,'transaction':_0x22563b});});})[_0xf9eb('0xd')](function(_0x3dc316){logger[_0xf9eb('0xe')](_0xf9eb('0x34'),_0x9f8601);logger[_0xf9eb('0x16')]('MoveContactManagedDialer',_0x9f8601,JSON['stringify'](_0x3dc316));_0x19278e(_0x3dc316);})[_0xf9eb('0x17')](function(_0x21a7c0){logger[_0xf9eb('0x10')]('MoveContactManagedDialer',_0x21a7c0['message'],_0x9f8601);_0x496dac(_0x2a2909['error'](0x1f4,_0x21a7c0['message']));});});};exports[_0xf9eb('0x35')]=function(_0x42e3ed){var _0x5ddbc9=this;return new Promise(function(_0x2e84da,_0x21966b){return db[_0xf9eb('0x6')][_0xf9eb('0x25')]({'raw':_0x42e3ed[_0xf9eb('0x7')]?_0x42e3ed[_0xf9eb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x42e3ed[_0xf9eb('0x7')]?_0x42e3ed['options'][_0xf9eb('0x15')]||null:null,'attributes':[[db[_0xf9eb('0x23')]['fn'](_0xf9eb('0x36'),db[_0xf9eb('0x23')]['fn']('IF',db['sequelize'][_0xf9eb('0x37')](_0xf9eb('0x38')+util[_0xf9eb('0x39')]('\x22%s\x22',moment()[_0xf9eb('0x39')](_0xf9eb('0x3a')))+'\x20,\x201,\x20null'))),_0xf9eb('0x3b')]]})[_0xf9eb('0xd')](function(_0x21463d){logger[_0xf9eb('0xe')](_0xf9eb('0x35'),_0x42e3ed);logger['debug'](_0xf9eb('0x35'),_0x42e3ed,JSON[_0xf9eb('0xf')](_0x21463d));_0x2e84da(_0x21463d);})['catch'](function(_0x566e93){logger['error']('CountReScheduled',_0x566e93['message'],_0x42e3ed);_0x21966b(_0x5ddbc9['error'](0x1f4,_0x566e93[_0xf9eb('0x11')]));});});};exports['GetContactRecallMe']=function(_0x4f3181){var _0x577779=this;return new Promise(function(_0x14142b,_0x212056){return db[_0xf9eb('0x22')][_0xf9eb('0x3c')]()[_0xf9eb('0xd')](function(){return db[_0xf9eb('0x23')][_0xf9eb('0x24')](function(_0x3b2fe2){return db[_0xf9eb('0x6')][_0xf9eb('0x25')]({'where':_0x4f3181[_0xf9eb('0x7')]?_0x4f3181[_0xf9eb('0x7')][_0xf9eb('0x15')]||null:null,'attributes':_0x4f3181[_0xf9eb('0x7')]?_0x4f3181[_0xf9eb('0x7')][_0xf9eb('0x8')]||null:null,'limit':0x1,'order':_0x4f3181[_0xf9eb('0x7')]?_0x4f3181[_0xf9eb('0x7')][_0xf9eb('0x26')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x3b2fe2,'lock':_0x3b2fe2[_0xf9eb('0x27')]['UPDATE'],'include':_0x4f3181['options']?_0x4f3181[_0xf9eb('0x7')]['include']?_[_0xf9eb('0xc')](_0x4f3181[_0xf9eb('0x7')]['include'],function(_0x18ed06){return{'model':db[_0x18ed06['model']],'as':_0x18ed06['as'],'attributes':_0x18ed06[_0xf9eb('0x8')],'include':_0x18ed06[_0xf9eb('0xa')]?_['map'](_0x18ed06[_0xf9eb('0xa')],function(_0x521e86){return{'model':db[_0x521e86['model']],'as':_0x521e86['as'],'attributes':_0x521e86[_0xf9eb('0x8')],'include':_0x521e86[_0xf9eb('0xa')]?_[_0xf9eb('0xc')](_0x521e86[_0xf9eb('0xa')],function(_0x5e88d5){return{'model':db[_0x5e88d5[_0xf9eb('0xb')]],'as':_0x5e88d5['as'],'attributes':_0x5e88d5[_0xf9eb('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a0d6){var _0x3c6919=[];for(var _0x2862bc=0x0;_0x2862bc<_0x56a0d6[_0xf9eb('0x30')];_0x2862bc+=0x1){_0x3c6919['push'](_0x56a0d6[_0x2862bc][_0xf9eb('0x1c')](_0x4f3181[_0xf9eb('0x1a')],{'transaction':_0x3b2fe2}));}return BPromise[_0xf9eb('0x2f')](_0x3c6919);});})['then'](function(_0x50060a){logger['info'](_0xf9eb('0x3d'),_0x4f3181);logger[_0xf9eb('0x16')](_0xf9eb('0x3d'),_0x4f3181,JSON[_0xf9eb('0xf')](_0x50060a));_0x14142b(_0x50060a);})[_0xf9eb('0x17')](function(_0x54414b){logger[_0xf9eb('0x10')]('GetContactRecallMe',_0x54414b[_0xf9eb('0x11')],_0x4f3181);_0x212056(_0x577779[_0xf9eb('0x10')](0x1f4,_0x54414b['message']));});});});};exports[_0xf9eb('0x3e')]=function(_0x1b7b67){var _0x57668=this;return new Promise(function(_0x3ef9b4,_0x524fbd){db[_0xf9eb('0x22')][_0xf9eb('0x3c')]()[_0xf9eb('0xd')](function(_0x32484f){return db['CmHopper'][_0xf9eb('0x25')]({'raw':_0x1b7b67[_0xf9eb('0x7')]?_0x1b7b67[_0xf9eb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7b67[_0xf9eb('0x7')]?_0x1b7b67[_0xf9eb('0x7')][_0xf9eb('0x15')]||null:null,'attributes':_0x1b7b67['options']?_0x1b7b67['options'][_0xf9eb('0x8')]||null:null,'limit':_0x1b7b67[_0xf9eb('0x7')]?_0x1b7b67[_0xf9eb('0x7')][_0xf9eb('0x9')]||null:null,'include':_0x1b7b67[_0xf9eb('0x7')]?_0x1b7b67['options'][_0xf9eb('0xa')]?_['map'](_0x1b7b67['options']['include'],function(_0x232fd0){return{'model':db[_0x232fd0[_0xf9eb('0xb')]],'as':_0x232fd0['as'],'attributes':_0x232fd0['as']===_0xf9eb('0x29')?_[_0xf9eb('0x2a')](_0x32484f):_0x232fd0[_0xf9eb('0x8')],'include':_0x232fd0[_0xf9eb('0xa')]?_[_0xf9eb('0xc')](_0x232fd0['include'],function(_0x2998dd){return{'model':db[_0x2998dd['model']],'as':_0x2998dd['as'],'attributes':_0x2998dd[_0xf9eb('0x8')],'include':_0x2998dd[_0xf9eb('0xa')]?_[_0xf9eb('0xc')](_0x2998dd['include'],function(_0x2cc8ae){return{'model':db[_0x2cc8ae[_0xf9eb('0xb')]],'as':_0x2cc8ae['as'],'attributes':_0x2cc8ae[_0xf9eb('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4225a6){logger[_0xf9eb('0xe')]('GetCmHopper',_0x1b7b67);logger['debug'](_0xf9eb('0x5'),_0x1b7b67,JSON[_0xf9eb('0xf')](_0x4225a6));_0x3ef9b4(_0x4225a6);})[_0xf9eb('0x17')](function(_0x355428){logger[_0xf9eb('0x10')](_0xf9eb('0x5'),_0x355428[_0xf9eb('0x11')],_0x1b7b67);_0x524fbd(_0x57668[_0xf9eb('0x10')](0x1f4,_0x355428[_0xf9eb('0x11')]));});});});};exports[_0xf9eb('0x3f')]=function(_0x27ae01){var _0x3b6540=this;return new Promise(function(_0x48932b,_0x457449){return db[_0xf9eb('0x22')][_0xf9eb('0x40')]({'raw':!![],'where':{'phone':_0x27ae01[_0xf9eb('0x7')][_0xf9eb('0x15')][_0xf9eb('0x41')]},'attributes':['id','dialTimezone'],'order':[['id',_0xf9eb('0x42')]]})[_0xf9eb('0xd')](function(_0x5b0ea6){logger[_0xf9eb('0xe')](_0xf9eb('0x43'),_0x27ae01);logger[_0xf9eb('0x16')](_0xf9eb('0x43'),_0x27ae01,JSON[_0xf9eb('0xf')](_0x5b0ea6));_0x48932b(_0x5b0ea6);})[_0xf9eb('0x17')](function(_0x247d3c){logger[_0xf9eb('0x10')](_0xf9eb('0x43'),_0x247d3c[_0xf9eb('0x11')],_0x27ae01);_0x457449(_0x3b6540[_0xf9eb('0x10')](0x1f4,_0x247d3c['message']));});});};exports['ResetActiveCalls']=function(_0x905372){var _0x20c8e4=this;return new Promise(function(_0x49524f,_0x2e0498){return db[_0xf9eb('0x23')]['transaction'](function(_0x10d17d){var _0x23ed98=_0x905372[_0xf9eb('0x7')]&&_0x905372[_0xf9eb('0x7')][_0xf9eb('0x15')]?_0x905372['options'][_0xf9eb('0x15')]:{};return db['CmHopper'][_0xf9eb('0x1c')](_0x905372['body'],{'where':_0x23ed98,'transaction':_0x10d17d})[_0xf9eb('0xd')](function(_0x327c13){logger[_0xf9eb('0xe')](_0xf9eb('0x44'),_0x905372);logger[_0xf9eb('0x16')]('ResetActiveCalls',_0x905372,JSON[_0xf9eb('0xf')](_0x327c13));_0x49524f(_0x327c13);})[_0xf9eb('0x17')](function(_0x3e16d5){logger[_0xf9eb('0x10')](_0xf9eb('0x44'),_0x3e16d5[_0xf9eb('0x11')],_0x905372);_0x2e0498(_0x20c8e4[_0xf9eb('0x10')](0x1f4,_0x3e16d5[_0xf9eb('0x11')]));});});});};exports[_0xf9eb('0x45')]=function(_0x13ffa1){var _0x25eac6=this;var _0x27287d=_0x13ffa1['body'][_0xf9eb('0x15')][_0xf9eb('0x46')];var _0x44fbbc=_0x13ffa1['body'][_0xf9eb('0x15')][_0xf9eb('0x47')];var _0x38a693=_0x13ffa1['body'][_0xf9eb('0x15')][_0xf9eb('0x48')];return new Promise(function(_0x2359ca,_0x2e8742){return db[_0xf9eb('0x6')][_0xf9eb('0x25')]({'where':{'voiceQueueId':{'$in':_0x27287d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf9eb('0x23')]['literal'](_0xf9eb('0x49')+_0x44fbbc+_0xf9eb('0x4a')),'$gt':db[_0xf9eb('0x23')]['literal'](_0xf9eb('0x4b'))}},'UserId':{'$in':_0x38a693}},'include':[{'model':db[_0xf9eb('0x22')],'as':'Contact'},{'model':db[_0xf9eb('0x4c')],'as':_0xf9eb('0x2b'),'attributes':['id',_0xf9eb('0x2c'),_0xf9eb('0x4d')]},{'model':db[_0xf9eb('0x4e')],'as':_0xf9eb('0x4f')}]})['then'](function(_0x12a5a2){if(_0x12a5a2[_0xf9eb('0x30')]>0x0){return db['sequelize'][_0xf9eb('0x24')](function(_0x3c99a4){return db[_0xf9eb('0x6')]['update']({'recallmeNotifiedDate':db[_0xf9eb('0x23')][_0xf9eb('0x37')](_0xf9eb('0x4b'))},{'where':{'id':{'$in':_[_0xf9eb('0xc')](_0x12a5a2,'id')}},'transaction':_0x3c99a4})['then'](function(){_0x2359ca(_0x12a5a2);})[_0xf9eb('0x17')](function(_0x17757f){logger[_0xf9eb('0x10')](_0xf9eb('0x45'),_0x17757f['message'],_0x13ffa1);_0x2e8742(_0x25eac6[_0xf9eb('0x10')](0x1f4,_0x17757f[_0xf9eb('0x11')]));});})[_0xf9eb('0x17')](function(_0x48def1){logger[_0xf9eb('0x10')](_0xf9eb('0x45'),_0x48def1[_0xf9eb('0x11')],_0x13ffa1);_0x2e8742(_0x25eac6['error'](0x1f4,_0x48def1[_0xf9eb('0x11')]));});}else{_0x2359ca(_0x12a5a2);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8a39155..0ea8a63 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 _0x2992=['post','/preview','getPreview','getTimezone','put','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2992,0x1c0));var _0x2299=function(_0x3748ab,_0x13059e){_0x3748ab=_0x3748ab-0x0;var _0x3aca73=_0x2992[_0x3748ab];return _0x3aca73;};'use strict';var express=require(_0x2299('0x0'));var router=express[_0x2299('0x1')]();var auth=require(_0x2299('0x2'));var controller=require(_0x2299('0x3'));router[_0x2299('0x4')]('/',auth[_0x2299('0x5')](),controller[_0x2299('0x6')]);router[_0x2299('0x4')]('/describe',auth[_0x2299('0x5')](),controller[_0x2299('0x7')]);router[_0x2299('0x4')](_0x2299('0x8'),auth[_0x2299('0x5')](),controller[_0x2299('0x9')]);router[_0x2299('0x4')]('/timezones',auth[_0x2299('0x5')](),controller[_0x2299('0xa')]);router[_0x2299('0x4')](_0x2299('0xb'),auth[_0x2299('0x5')](),controller[_0x2299('0xc')]);router[_0x2299('0x4')]('/:id/previewrecall',auth[_0x2299('0x5')](),controller['getPreviewRecall']);router['post']('/',auth[_0x2299('0x5')](),controller[_0x2299('0xd')]);router[_0x2299('0xe')](_0x2299('0xf'),auth[_0x2299('0x5')](),controller[_0x2299('0x10')]);router[_0x2299('0xe')]('/timezone',auth[_0x2299('0x5')](),controller[_0x2299('0x11')]);router[_0x2299('0x12')](_0x2299('0xb'),auth[_0x2299('0x5')](),controller['update']);router[_0x2299('0x13')](_0x2299('0xb'),auth[_0x2299('0x5')](),controller[_0x2299('0x14')]);module[_0x2299('0x15')]=router; \ No newline at end of file +var _0x2571=['/preview','getPreview','/timezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','create','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2571,0xa8));var _0x1257=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0x2571[_0xd3e0b9];return _0x470133;};'use strict';var express=require(_0x1257('0x0'));var router=express[_0x1257('0x1')]();var auth=require(_0x1257('0x2'));var controller=require(_0x1257('0x3'));router[_0x1257('0x4')]('/',auth['isAuthenticated'](),controller[_0x1257('0x5')]);router[_0x1257('0x4')](_0x1257('0x6'),auth[_0x1257('0x7')](),controller['describe']);router[_0x1257('0x4')]('/opencontacts',auth[_0x1257('0x7')](),controller[_0x1257('0x8')]);router[_0x1257('0x4')](_0x1257('0x9'),auth[_0x1257('0x7')](),controller[_0x1257('0xa')]);router[_0x1257('0x4')](_0x1257('0xb'),auth[_0x1257('0x7')](),controller[_0x1257('0xc')]);router['get']('/:id/previewrecall',auth[_0x1257('0x7')](),controller[_0x1257('0xd')]);router['post']('/',auth[_0x1257('0x7')](),controller[_0x1257('0xe')]);router[_0x1257('0xf')](_0x1257('0x10'),auth[_0x1257('0x7')](),controller[_0x1257('0x11')]);router['post'](_0x1257('0x12'),auth['isAuthenticated'](),controller['getTimezone']);router['put']('/:id',auth[_0x1257('0x7')](),controller[_0x1257('0x13')]);router[_0x1257('0x14')](_0x1257('0xb'),auth[_0x1257('0x7')](),controller[_0x1257('0x15')]);module[_0x1257('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 1d8a211..1e4bb7d 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 _0x907a=['exports','INTEGER','STRING','DATE','format'];(function(_0x37a4ca,_0x4532e4){var _0x63aa6=function(_0x3e35ff){while(--_0x3e35ff){_0x37a4ca['push'](_0x37a4ca['shift']());}};_0x63aa6(++_0x4532e4);}(_0x907a,0xb9));var _0xa907=function(_0x24b925,_0x5b7121){_0x24b925=_0x24b925-0x0;var _0x1925e5=_0x907a[_0x24b925];return _0x1925e5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa907('0x0')]={'CmHopperId':{'type':Sequelize[_0xa907('0x1')]},'phone':{'type':Sequelize[_0xa907('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa907('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa907('0x3')],'defaultValue':moment()[_0xa907('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa907('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa907('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa907('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa907('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa739=['INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0xa739,0x11d));var _0x9a73=function(_0x2f95dd,_0xc9f42e){_0x2f95dd=_0x2f95dd-0x0;var _0x284813=_0xa739[_0x2f95dd];return _0x284813;};'use strict';var moment=require(_0x9a73('0x0'));var Sequelize=require(_0x9a73('0x1'));module[_0x9a73('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9a73('0x4')],'defaultValue':moment()['format'](_0x9a73('0x5'))},'countbusyretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9a73('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index ea1d845..3e3feea 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 _0x993d=['UserProfileSection','userProfileId','autoAssociation','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones'];(function(_0x2d35ca,_0x5744c4){var _0x27ae73=function(_0x3be731){while(--_0x3be731){_0x2d35ca['push'](_0x2d35ca['shift']());}};_0x27ae73(++_0x5744c4);}(_0x993d,0xfd));var _0xd993=function(_0x503ff6,_0x5be7a6){_0x503ff6=_0x503ff6-0x0;var _0x127d58=_0x993d[_0x503ff6];return _0x127d58;};'use strict';var emlformat=require(_0xd993('0x0'));var rimraf=require(_0xd993('0x1'));var zipdir=require(_0xd993('0x2'));var jsonpatch=require(_0xd993('0x3'));var rp=require('request-promise');var moment=require(_0xd993('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd993('0x5'));var path=require(_0xd993('0x6'));var sox=require('sox');var csv=require(_0xd993('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd993('0x8'));var squel=require(_0xd993('0x9'));var crypto=require(_0xd993('0xa'));var jsforce=require(_0xd993('0xb'));var deskjs=require(_0xd993('0xc'));var toCsv=require(_0xd993('0x7'));var querystring=require('querystring');var Papa=require(_0xd993('0xd'));var Redis=require(_0xd993('0xe'));var authService=require(_0xd993('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd993('0x10'));var hardwareService=require(_0xd993('0x11'));var logger=require(_0xd993('0x12'))(_0xd993('0x13'));var utils=require(_0xd993('0x14'));var config=require(_0xd993('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd993('0x16'))['db'];function respondWithStatusCode(_0x5d8288,_0x5cf6b6){_0x5cf6b6=_0x5cf6b6||0xcc;return function(_0x4b0b08){if(_0x4b0b08){return _0x5d8288[_0xd993('0x17')](_0x5cf6b6);}return _0x5d8288[_0xd993('0x18')](_0x5cf6b6)[_0xd993('0x19')]();};}function respondWithResult(_0x2bb81c,_0x27608a){_0x27608a=_0x27608a||0xc8;return function(_0xd5579){if(_0xd5579){return _0x2bb81c[_0xd993('0x18')](_0x27608a)[_0xd993('0x1a')](_0xd5579);}};}function respondWithFilteredResult(_0x48bc55,_0x4fa048){return function(_0x4e42c1){if(_0x4e42c1){var _0x3b2a3c=typeof _0x4fa048[_0xd993('0x1b')]===_0xd993('0x1c')&&typeof _0x4fa048[_0xd993('0x1d')]===_0xd993('0x1c');var _0xd462ad=_0x4e42c1[_0xd993('0x1e')];var _0x4494fe=_0x3b2a3c?0x0:_0x4fa048[_0xd993('0x1b')];var _0x1cd4e4=_0x3b2a3c?_0x4e42c1[_0xd993('0x1e')]:_0x4fa048[_0xd993('0x1b')]+_0x4fa048[_0xd993('0x1d')];var _0x5e4073;if(_0x1cd4e4>=_0xd462ad){_0x1cd4e4=_0xd462ad;_0x5e4073=0xc8;}else{_0x5e4073=0xce;}_0x48bc55[_0xd993('0x18')](_0x5e4073);return _0x48bc55[_0xd993('0x1f')]('Content-Range',_0x4494fe+'-'+_0x1cd4e4+'/'+_0xd462ad)['json'](_0x4e42c1);}return null;};}function patchUpdates(_0x2910f9){return function(_0x149004){try{jsonpatch[_0xd993('0x20')](_0x149004,_0x2910f9,!![]);}catch(_0x16b2af){return BPromise[_0xd993('0x21')](_0x16b2af);}return _0x149004[_0xd993('0x22')]();};}function saveUpdates(_0x327428,_0x2a216d){return function(_0xd5d741){if(_0xd5d741){return _0xd5d741[_0xd993('0x23')](_0x327428)['then'](function(_0xafc2db){return _0xafc2db;});}return null;};}function removeEntity(_0x4e3cf6,_0x3de669){return function(_0x2fca35){if(_0x2fca35){return _0x2fca35['destroy']()[_0xd993('0x24')](function(){var _0x41c7c1=_0x2fca35[_0xd993('0x25')]({'plain':!![]});var _0x4d6ee0='CmHopperAdditionalPhones';return db[_0xd993('0x26')][_0xd993('0x27')]({'where':{'type':_0x4d6ee0,'resourceId':_0x41c7c1['id']}})[_0xd993('0x24')](function(){return _0x2fca35;});})[_0xd993('0x24')](function(){_0x4e3cf6[_0xd993('0x18')](0xcc)[_0xd993('0x19')]();});}};}function handleEntityNotFound(_0x3fc267,_0x4bf451){return function(_0x2c006b){if(!_0x2c006b){_0x3fc267['sendStatus'](0x194);}return _0x2c006b;};}function handleError(_0x56a8b3,_0x2d16ef){_0x2d16ef=_0x2d16ef||0x1f4;return function(_0x117699){logger[_0xd993('0x28')](_0x117699[_0xd993('0x29')]);if(_0x117699[_0xd993('0x2a')]){delete _0x117699[_0xd993('0x2a')];}_0x56a8b3[_0xd993('0x18')](_0x2d16ef)[_0xd993('0x2b')](_0x117699);};}exports[_0xd993('0x2c')]=function(_0x3a6270,_0x3f58c5){var _0x34fab0={},_0x49ea68={},_0x403a2e={'count':0x0,'rows':[]};var _0x35c062=_['map'](db[_0xd993('0x2d')][_0xd993('0x2e')],function(_0x2c482a){return{'name':_0x2c482a[_0xd993('0x2f')],'type':_0x2c482a[_0xd993('0x30')][_0xd993('0x31')]};});_0x49ea68[_0xd993('0x32')]=_[_0xd993('0x33')](_0x35c062,'name');_0x49ea68[_0xd993('0x34')]=_[_0xd993('0x35')](_0x3a6270['query']);_0x49ea68[_0xd993('0x36')]=_[_0xd993('0x37')](_0x49ea68['model'],_0x49ea68[_0xd993('0x34')]);_0x34fab0[_0xd993('0x38')]=_[_0xd993('0x37')](_0x49ea68[_0xd993('0x32')],qs[_0xd993('0x39')](_0x3a6270[_0xd993('0x34')][_0xd993('0x39')]));_0x34fab0[_0xd993('0x38')]=_0x34fab0[_0xd993('0x38')]['length']?_0x34fab0[_0xd993('0x38')]:_0x49ea68['model'];if(!_0x3a6270[_0xd993('0x34')][_0xd993('0x3a')]('nolimit')){_0x34fab0[_0xd993('0x1d')]=qs[_0xd993('0x1d')](_0x3a6270[_0xd993('0x34')][_0xd993('0x1d')]);_0x34fab0[_0xd993('0x1b')]=qs[_0xd993('0x1b')](_0x3a6270[_0xd993('0x34')][_0xd993('0x1b')]);}_0x34fab0[_0xd993('0x3b')]=qs[_0xd993('0x3c')](_0x3a6270[_0xd993('0x34')][_0xd993('0x3c')]);_0x34fab0[_0xd993('0x3d')]=qs[_0xd993('0x36')](_[_0xd993('0x3e')](_0x3a6270[_0xd993('0x34')],_0x49ea68[_0xd993('0x36')]),_0x35c062);if(_0x3a6270[_0xd993('0x34')][_0xd993('0x3f')]){_0x34fab0['where']=_[_0xd993('0x40')](_0x34fab0[_0xd993('0x3d')],{'$or':_[_0xd993('0x33')](_0x35c062,function(_0x47b12e){if(_0x47b12e[_0xd993('0x30')]!=='VIRTUAL'){var _0x4a69d9={};_0x4a69d9[_0x47b12e[_0xd993('0x2a')]]={'$like':'%'+_0x3a6270['query'][_0xd993('0x3f')]+'%'};return _0x4a69d9;}})});}_0x34fab0=_[_0xd993('0x40')]({},_0x34fab0,_0x3a6270[_0xd993('0x41')]);var _0x7e2d13={'where':_0x34fab0['where']};return db[_0xd993('0x2d')]['count'](_0x7e2d13)[_0xd993('0x24')](function(_0x43acd1){_0x403a2e[_0xd993('0x1e')]=_0x43acd1;if(_0x3a6270[_0xd993('0x34')]['includeAll']){_0x34fab0['include']=[{'all':!![]}];}return db[_0xd993('0x2d')][_0xd993('0x42')](_0x34fab0);})[_0xd993('0x24')](function(_0x1ae4dd){_0x403a2e[_0xd993('0x43')]=_0x1ae4dd;return _0x403a2e;})[_0xd993('0x24')](respondWithFilteredResult(_0x3f58c5,_0x34fab0))[_0xd993('0x44')](handleError(_0x3f58c5,null));};exports[_0xd993('0x45')]=function(_0x5d3e6,_0xf96733){var _0x5bda7c={'raw':!![],'where':{'id':_0x5d3e6[_0xd993('0x46')]['id']}},_0x3291e7={};_0x3291e7[_0xd993('0x32')]=_[_0xd993('0x35')](db['CmHopperAdditionalPhone'][_0xd993('0x2e')]);_0x3291e7[_0xd993('0x34')]=_[_0xd993('0x35')](_0x5d3e6[_0xd993('0x34')]);_0x3291e7['filters']=_[_0xd993('0x37')](_0x3291e7[_0xd993('0x32')],_0x3291e7['query']);_0x5bda7c[_0xd993('0x38')]=_['intersection'](_0x3291e7['model'],qs[_0xd993('0x39')](_0x5d3e6[_0xd993('0x34')]['fields']));_0x5bda7c['attributes']=_0x5bda7c[_0xd993('0x38')][_0xd993('0x47')]?_0x5bda7c[_0xd993('0x38')]:_0x3291e7[_0xd993('0x32')];if(_0x5d3e6[_0xd993('0x34')]['includeAll']){_0x5bda7c[_0xd993('0x48')]=[{'all':!![]}];}_0x5bda7c=_[_0xd993('0x40')]({},_0x5bda7c,_0x5d3e6['options']);return db[_0xd993('0x2d')]['find'](_0x5bda7c)[_0xd993('0x24')](handleEntityNotFound(_0xf96733,null))['then'](respondWithResult(_0xf96733,null))[_0xd993('0x44')](handleError(_0xf96733,null));};exports['create']=function(_0x13d23d,_0x47745d){return db[_0xd993('0x2d')][_0xd993('0x49')](_0x13d23d[_0xd993('0x4a')],{})[_0xd993('0x24')](function(_0xbba5fb){var _0x3c3ffc=_0x13d23d[_0xd993('0x4b')][_0xd993('0x25')]({'plain':!![]});if(!_0x3c3ffc)throw new Error(_0xd993('0x4c'));if(_0x3c3ffc[_0xd993('0x4d')]===_0xd993('0x4b')){var _0x340d71=_0xbba5fb[_0xd993('0x25')]({'plain':!![]});var _0x320450=_0xd993('0x4e');return db[_0xd993('0x4f')]['find']({'where':{'name':_0x320450,'userProfileId':_0x3c3ffc[_0xd993('0x50')]},'raw':!![]})[_0xd993('0x24')](function(_0xa20b14){if(_0xa20b14&&_0xa20b14[_0xd993('0x51')]===0x0){return db['UserProfileResource'][_0xd993('0x49')]({'name':_0x340d71[_0xd993('0x2a')],'resourceId':_0x340d71['id'],'type':_0xa20b14[_0xd993('0x2a')],'sectionId':_0xa20b14['id']},{})[_0xd993('0x24')](function(){return _0xbba5fb;});}else{return _0xbba5fb;}})[_0xd993('0x44')](function(_0x8899b0){logger[_0xd993('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8899b0);throw _0x8899b0;});}return _0xbba5fb;})[_0xd993('0x24')](respondWithResult(_0x47745d,0xc9))[_0xd993('0x44')](handleError(_0x47745d,null));};exports[_0xd993('0x23')]=function(_0x29190e,_0x31c82d){if(_0x29190e['body']['id']){delete _0x29190e['body']['id'];}return db[_0xd993('0x2d')][_0xd993('0x52')]({'where':{'id':_0x29190e[_0xd993('0x46')]['id']}})[_0xd993('0x24')](handleEntityNotFound(_0x31c82d,null))[_0xd993('0x24')](saveUpdates(_0x29190e[_0xd993('0x4a')],null))[_0xd993('0x24')](respondWithResult(_0x31c82d,null))[_0xd993('0x44')](handleError(_0x31c82d,null));};exports[_0xd993('0x27')]=function(_0x587b6e,_0x11d364){return db[_0xd993('0x2d')][_0xd993('0x52')]({'where':{'id':_0x587b6e[_0xd993('0x46')]['id']}})[_0xd993('0x24')](handleEntityNotFound(_0x11d364,null))[_0xd993('0x24')](removeEntity(_0x11d364,null))[_0xd993('0x44')](handleError(_0x11d364,null));}; \ No newline at end of file +var _0xa2a4=['util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','rawAttributes','fields','merge','find','create','body','user','role','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2a4,0xa4));var _0x4a2a=function(_0x1836ee,_0x3ab93f){_0x1836ee=_0x1836ee-0x0;var _0x57ca0e=_0xa2a4[_0x1836ee];return _0x57ca0e;};'use strict';var emlformat=require(_0x4a2a('0x0'));var rimraf=require(_0x4a2a('0x1'));var zipdir=require(_0x4a2a('0x2'));var jsonpatch=require(_0x4a2a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a2a('0x4'));var Mustache=require(_0x4a2a('0x5'));var util=require(_0x4a2a('0x6'));var path=require(_0x4a2a('0x7'));var sox=require(_0x4a2a('0x8'));var csv=require('to-csv');var ejs=require(_0x4a2a('0x9'));var fs=require('fs');var fs_extra=require(_0x4a2a('0xa'));var _=require(_0x4a2a('0xb'));var squel=require(_0x4a2a('0xc'));var crypto=require('crypto');var jsforce=require(_0x4a2a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4a2a('0xe'));var querystring=require(_0x4a2a('0xf'));var Papa=require(_0x4a2a('0x10'));var Redis=require(_0x4a2a('0x11'));var authService=require(_0x4a2a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4a2a('0x13'));var hardwareService=require(_0x4a2a('0x14'));var logger=require('../../config/logger')(_0x4a2a('0x15'));var utils=require(_0x4a2a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a2a('0x17'));var db=require(_0x4a2a('0x18'))['db'];function respondWithStatusCode(_0x3d0130,_0x592394){_0x592394=_0x592394||0xcc;return function(_0x3130bb){if(_0x3130bb){return _0x3d0130[_0x4a2a('0x19')](_0x592394);}return _0x3d0130[_0x4a2a('0x1a')](_0x592394)['end']();};}function respondWithResult(_0xfedced,_0x3199af){_0x3199af=_0x3199af||0xc8;return function(_0x2418a5){if(_0x2418a5){return _0xfedced[_0x4a2a('0x1a')](_0x3199af)[_0x4a2a('0x1b')](_0x2418a5);}};}function respondWithFilteredResult(_0x2aa08b,_0x1ceb55){return function(_0xf5071e){if(_0xf5071e){var _0x102fa5=typeof _0x1ceb55[_0x4a2a('0x1c')]==='undefined'&&typeof _0x1ceb55[_0x4a2a('0x1d')]==='undefined';var _0x3ebafc=_0xf5071e[_0x4a2a('0x1e')];var _0x1889cb=_0x102fa5?0x0:_0x1ceb55[_0x4a2a('0x1c')];var _0x4e293d=_0x102fa5?_0xf5071e[_0x4a2a('0x1e')]:_0x1ceb55[_0x4a2a('0x1c')]+_0x1ceb55['limit'];var _0x44e8b7;if(_0x4e293d>=_0x3ebafc){_0x4e293d=_0x3ebafc;_0x44e8b7=0xc8;}else{_0x44e8b7=0xce;}_0x2aa08b[_0x4a2a('0x1a')](_0x44e8b7);return _0x2aa08b[_0x4a2a('0x1f')](_0x4a2a('0x20'),_0x1889cb+'-'+_0x4e293d+'/'+_0x3ebafc)[_0x4a2a('0x1b')](_0xf5071e);}return null;};}function patchUpdates(_0x4175e5){return function(_0x1503bb){try{jsonpatch['apply'](_0x1503bb,_0x4175e5,!![]);}catch(_0x474620){return BPromise[_0x4a2a('0x21')](_0x474620);}return _0x1503bb[_0x4a2a('0x22')]();};}function saveUpdates(_0x2d8859,_0x34e055){return function(_0x27c09e){if(_0x27c09e){return _0x27c09e[_0x4a2a('0x23')](_0x2d8859)[_0x4a2a('0x24')](function(_0x231840){return _0x231840;});}return null;};}function removeEntity(_0x247357,_0x370597){return function(_0x1ee838){if(_0x1ee838){return _0x1ee838[_0x4a2a('0x25')]()[_0x4a2a('0x24')](function(){var _0xad07e8=_0x1ee838[_0x4a2a('0x26')]({'plain':!![]});var _0x1afcc8=_0x4a2a('0x27');return db[_0x4a2a('0x28')][_0x4a2a('0x25')]({'where':{'type':_0x1afcc8,'resourceId':_0xad07e8['id']}})[_0x4a2a('0x24')](function(){return _0x1ee838;});})[_0x4a2a('0x24')](function(){_0x247357[_0x4a2a('0x1a')](0xcc)[_0x4a2a('0x29')]();});}};}function handleEntityNotFound(_0x2f5042,_0x8a052){return function(_0x3c77f2){if(!_0x3c77f2){_0x2f5042[_0x4a2a('0x19')](0x194);}return _0x3c77f2;};}function handleError(_0x36b0e7,_0x1dda4b){_0x1dda4b=_0x1dda4b||0x1f4;return function(_0x1c0176){logger['error'](_0x1c0176[_0x4a2a('0x2a')]);if(_0x1c0176[_0x4a2a('0x2b')]){delete _0x1c0176[_0x4a2a('0x2b')];}_0x36b0e7[_0x4a2a('0x1a')](_0x1dda4b)[_0x4a2a('0x2c')](_0x1c0176);};}exports[_0x4a2a('0x2d')]=function(_0x1c4806,_0x4e071b){var _0x5ca86d={},_0x2f49fd={},_0x353844={'count':0x0,'rows':[]};var _0x340408=_[_0x4a2a('0x2e')](db[_0x4a2a('0x2f')]['rawAttributes'],function(_0x19697f){return{'name':_0x19697f[_0x4a2a('0x30')],'type':_0x19697f[_0x4a2a('0x31')][_0x4a2a('0x32')]};});_0x2f49fd[_0x4a2a('0x33')]=_[_0x4a2a('0x2e')](_0x340408,_0x4a2a('0x2b'));_0x2f49fd[_0x4a2a('0x34')]=_[_0x4a2a('0x35')](_0x1c4806[_0x4a2a('0x34')]);_0x2f49fd[_0x4a2a('0x36')]=_[_0x4a2a('0x37')](_0x2f49fd[_0x4a2a('0x33')],_0x2f49fd[_0x4a2a('0x34')]);_0x5ca86d[_0x4a2a('0x38')]=_[_0x4a2a('0x37')](_0x2f49fd[_0x4a2a('0x33')],qs['fields'](_0x1c4806[_0x4a2a('0x34')]['fields']));_0x5ca86d[_0x4a2a('0x38')]=_0x5ca86d[_0x4a2a('0x38')][_0x4a2a('0x39')]?_0x5ca86d[_0x4a2a('0x38')]:_0x2f49fd['model'];if(!_0x1c4806[_0x4a2a('0x34')][_0x4a2a('0x3a')](_0x4a2a('0x3b'))){_0x5ca86d[_0x4a2a('0x1d')]=qs[_0x4a2a('0x1d')](_0x1c4806[_0x4a2a('0x34')][_0x4a2a('0x1d')]);_0x5ca86d[_0x4a2a('0x1c')]=qs[_0x4a2a('0x1c')](_0x1c4806['query'][_0x4a2a('0x1c')]);}_0x5ca86d[_0x4a2a('0x3c')]=qs[_0x4a2a('0x3d')](_0x1c4806['query']['sort']);_0x5ca86d[_0x4a2a('0x3e')]=qs[_0x4a2a('0x36')](_[_0x4a2a('0x3f')](_0x1c4806[_0x4a2a('0x34')],_0x2f49fd['filters']),_0x340408);if(_0x1c4806[_0x4a2a('0x34')][_0x4a2a('0x40')]){_0x5ca86d[_0x4a2a('0x3e')]=_['merge'](_0x5ca86d[_0x4a2a('0x3e')],{'$or':_[_0x4a2a('0x2e')](_0x340408,function(_0x34456d){if(_0x34456d[_0x4a2a('0x31')]!=='VIRTUAL'){var _0xc13ee5={};_0xc13ee5[_0x34456d[_0x4a2a('0x2b')]]={'$like':'%'+_0x1c4806[_0x4a2a('0x34')][_0x4a2a('0x40')]+'%'};return _0xc13ee5;}})});}_0x5ca86d=_['merge']({},_0x5ca86d,_0x1c4806[_0x4a2a('0x41')]);var _0x4133ed={'where':_0x5ca86d[_0x4a2a('0x3e')]};return db[_0x4a2a('0x2f')][_0x4a2a('0x1e')](_0x4133ed)[_0x4a2a('0x24')](function(_0x4dad63){_0x353844[_0x4a2a('0x1e')]=_0x4dad63;if(_0x1c4806['query'][_0x4a2a('0x42')]){_0x5ca86d[_0x4a2a('0x43')]=[{'all':!![]}];}return db[_0x4a2a('0x2f')][_0x4a2a('0x44')](_0x5ca86d);})[_0x4a2a('0x24')](function(_0x33cdb3){_0x353844[_0x4a2a('0x45')]=_0x33cdb3;return _0x353844;})[_0x4a2a('0x24')](respondWithFilteredResult(_0x4e071b,_0x5ca86d))['catch'](handleError(_0x4e071b,null));};exports[_0x4a2a('0x46')]=function(_0x2bc786,_0x26dcad){var _0x17eb54={'raw':!![],'where':{'id':_0x2bc786['params']['id']}},_0x4f3220={};_0x4f3220[_0x4a2a('0x33')]=_[_0x4a2a('0x35')](db[_0x4a2a('0x2f')][_0x4a2a('0x47')]);_0x4f3220['query']=_[_0x4a2a('0x35')](_0x2bc786[_0x4a2a('0x34')]);_0x4f3220[_0x4a2a('0x36')]=_[_0x4a2a('0x37')](_0x4f3220['model'],_0x4f3220[_0x4a2a('0x34')]);_0x17eb54['attributes']=_[_0x4a2a('0x37')](_0x4f3220[_0x4a2a('0x33')],qs[_0x4a2a('0x48')](_0x2bc786['query']['fields']));_0x17eb54[_0x4a2a('0x38')]=_0x17eb54['attributes'][_0x4a2a('0x39')]?_0x17eb54[_0x4a2a('0x38')]:_0x4f3220['model'];if(_0x2bc786[_0x4a2a('0x34')][_0x4a2a('0x42')]){_0x17eb54[_0x4a2a('0x43')]=[{'all':!![]}];}_0x17eb54=_[_0x4a2a('0x49')]({},_0x17eb54,_0x2bc786[_0x4a2a('0x41')]);return db[_0x4a2a('0x2f')][_0x4a2a('0x4a')](_0x17eb54)[_0x4a2a('0x24')](handleEntityNotFound(_0x26dcad,null))[_0x4a2a('0x24')](respondWithResult(_0x26dcad,null))['catch'](handleError(_0x26dcad,null));};exports[_0x4a2a('0x4b')]=function(_0x2f5cf7,_0x277987){return db[_0x4a2a('0x2f')][_0x4a2a('0x4b')](_0x2f5cf7[_0x4a2a('0x4c')],{})['then'](function(_0x5f237b){var _0x1bce02=_0x2f5cf7[_0x4a2a('0x4d')]['get']({'plain':!![]});if(!_0x1bce02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bce02[_0x4a2a('0x4e')]===_0x4a2a('0x4d')){var _0x2048e1=_0x5f237b[_0x4a2a('0x26')]({'plain':!![]});var _0x58df92=_0x4a2a('0x27');return db[_0x4a2a('0x4f')][_0x4a2a('0x4a')]({'where':{'name':_0x58df92,'userProfileId':_0x1bce02['userProfileId']},'raw':!![]})[_0x4a2a('0x24')](function(_0x302904){if(_0x302904&&_0x302904[_0x4a2a('0x50')]===0x0){return db[_0x4a2a('0x28')][_0x4a2a('0x4b')]({'name':_0x2048e1[_0x4a2a('0x2b')],'resourceId':_0x2048e1['id'],'type':_0x302904[_0x4a2a('0x2b')],'sectionId':_0x302904['id']},{})[_0x4a2a('0x24')](function(){return _0x5f237b;});}else{return _0x5f237b;}})[_0x4a2a('0x51')](function(_0x25502c){logger[_0x4a2a('0x52')](_0x4a2a('0x53'),_0x25502c);throw _0x25502c;});}return _0x5f237b;})[_0x4a2a('0x24')](respondWithResult(_0x277987,0xc9))[_0x4a2a('0x51')](handleError(_0x277987,null));};exports[_0x4a2a('0x23')]=function(_0x20bd41,_0x40d39c){if(_0x20bd41['body']['id']){delete _0x20bd41[_0x4a2a('0x4c')]['id'];}return db[_0x4a2a('0x2f')]['find']({'where':{'id':_0x20bd41[_0x4a2a('0x54')]['id']}})[_0x4a2a('0x24')](handleEntityNotFound(_0x40d39c,null))[_0x4a2a('0x24')](saveUpdates(_0x20bd41[_0x4a2a('0x4c')],null))[_0x4a2a('0x24')](respondWithResult(_0x40d39c,null))[_0x4a2a('0x51')](handleError(_0x40d39c,null));};exports[_0x4a2a('0x25')]=function(_0x1f31a3,_0x37886e){return db['CmHopperAdditionalPhone'][_0x4a2a('0x4a')]({'where':{'id':_0x1f31a3['params']['id']}})['then'](handleEntityNotFound(_0x37886e,null))[_0x4a2a('0x24')](removeEntity(_0x37886e,null))[_0x4a2a('0x51')](handleError(_0x37886e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 32d1fae..6711d78 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 _0x9207=['api','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9207,0x1e8));var _0x7920=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x9207[_0x4ed1d4];return _0x28e363;};'use strict';var _=require(_0x7920('0x0'));var util=require('util');var logger=require(_0x7920('0x1'))(_0x7920('0x2'));var moment=require('moment');var BPromise=require(_0x7920('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7920('0x4'));var rimraf=require(_0x7920('0x5'));var config=require(_0x7920('0x6'));var attributes=require(_0x7920('0x7'));module['exports']=function(_0x5c1e0b,_0x3cf7f2){return _0x5c1e0b[_0x7920('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7920('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ae=['./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a17d6,_0x514820){var _0x409d71=function(_0x583acd){while(--_0x583acd){_0x5a17d6['push'](_0x5a17d6['shift']());}};_0x409d71(++_0x514820);}(_0xe3ae,0xdc));var _0xee3a=function(_0x5cead4,_0x95c854){_0x5cead4=_0x5cead4-0x0;var _0x25c561=_0xe3ae[_0x5cead4];return _0x25c561;};'use strict';var _=require(_0xee3a('0x0'));var util=require(_0xee3a('0x1'));var logger=require('../../config/logger')(_0xee3a('0x2'));var moment=require('moment');var BPromise=require(_0xee3a('0x3'));var rp=require(_0xee3a('0x4'));var fs=require('fs');var path=require(_0xee3a('0x5'));var rimraf=require(_0xee3a('0x6'));var config=require(_0xee3a('0x7'));var attributes=require(_0xee3a('0x8'));module[_0xee3a('0x9')]=function(_0x3788f7,_0x19937c){return _0x3788f7['define'](_0xee3a('0xa'),attributes,{'tableName':_0xee3a('0xb'),'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 d46b567..7a8bd3a 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 _0x959d=['SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countnosuchnumberretry','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','ASC','dialGlobalMaxRetry','VerifyAdditionalPhones'];(function(_0x4f95f8,_0x4545e3){var _0xb645ab=function(_0x129a1b){while(--_0x129a1b){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0xb645ab(++_0x4545e3);}(_0x959d,0x13c));var _0xd959=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x959d[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0xd959('0x0'));var util=require(_0xd959('0x1'));var moment=require(_0xd959('0x2'));var BPromise=require(_0xd959('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd959('0x4'));var db=require(_0xd959('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd959('0x6'))('rpc');var config=require(_0xd959('0x7'));var jayson=require(_0xd959('0x8'));var client=jayson[_0xd959('0x9')][_0xd959('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de413,_0xf3aea4,_0x190ca2){return new BPromise(function(_0x1b9819,_0x1e89bb){return client[_0xd959('0xb')](_0x1de413,_0x190ca2)[_0xd959('0xc')](function(_0x104e88){logger[_0xd959('0xd')](_0xd959('0xe'),_0xf3aea4,_0xd959('0xf'));logger[_0xd959('0x10')](_0xd959('0x11'),_0xf3aea4,'request\x20sent',JSON[_0xd959('0x12')](_0x104e88));if(_0x104e88['error']){if(_0x104e88[_0xd959('0x13')][_0xd959('0x14')]===0x1f4){logger[_0xd959('0x13')](_0xd959('0xe'),_0xf3aea4,_0x104e88['error'][_0xd959('0x15')]);return _0x1e89bb(_0x104e88[_0xd959('0x13')][_0xd959('0x15')]);}logger[_0xd959('0x13')](_0xd959('0xe'),_0xf3aea4,_0x104e88[_0xd959('0x13')][_0xd959('0x15')]);return _0x1b9819(_0x104e88[_0xd959('0x13')][_0xd959('0x15')]);}else{logger['info'](_0xd959('0xe'),_0xf3aea4,'request\x20sent');_0x1b9819(_0x104e88[_0xd959('0x16')][_0xd959('0x15')]);}})[_0xd959('0x17')](function(_0x1aac92){logger['error'](_0xd959('0xe'),_0xf3aea4,_0x1aac92);_0x1e89bb(_0x1aac92);});});}exports['VerifyAdditionalPhones']=function(_0x508e1c){var _0x296561=this;return new Promise(function(_0x27b9d3,_0x2adbcc){return db[_0xd959('0x18')][_0xd959('0x19')]({'raw':!![],'where':{'ContactId':_0x508e1c[_0xd959('0x1a')][_0xd959('0x1b')],'ListId':_0x508e1c[_0xd959('0x1a')][_0xd959('0x1c')],'VoiceQueueId':_0x508e1c['body'][_0xd959('0x1d')]===undefined?null:_0x508e1c[_0xd959('0x1a')]['VoiceQueueId'],'CampaignId':_0x508e1c[_0xd959('0x1a')]['CampaignId']===undefined?null:_0x508e1c[_0xd959('0x1a')][_0xd959('0x1e')]}})[_0xd959('0xc')](function(_0xd1dc38){if(_0xd1dc38!=null){return db[_0xd959('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xd1dc38['id'],'OrderBy':{'$gt':_0xd1dc38['OrderBy']}},'order':[[_0xd959('0x20'),'ASC']]})[_0xd959('0xc')](function(_0x5c1899){var _0x22f55c=0x0;if(_0x5c1899){if(_0x5c1899[_0xd959('0x21')]+_0x5c1899[_0xd959('0x22')]+_0x5c1899[_0xd959('0x23')]+_0x5c1899['countnosuchnumberretry']+_0x5c1899[_0xd959('0x24')]+_0x5c1899[_0xd959('0x25')]+_0x5c1899[_0xd959('0x26')]+_0x5c1899[_0xd959('0x27')]<_0x508e1c[_0xd959('0x28')]['dialGlobalMaxRetry'])_0x22f55c=0x1;_0x27b9d3({'additional':_0x22f55c});}else{return db['CmHopperAdditionalPhone'][_0xd959('0x19')]({'raw':!![],'where':{'CmHopperId':_0xd1dc38['id']},'order':[[_0xd959('0x20'),_0xd959('0x29')]]})[_0xd959('0xc')](function(_0x198206){var _0x56df47=0x0;if(_0x198206){if(_0x198206[_0xd959('0x21')]+_0x198206[_0xd959('0x22')]+_0x198206[_0xd959('0x23')]+_0x198206['countnosuchnumberretry']+_0x198206['countdropretry']+_0x198206['countabandonedretry']+_0x198206[_0xd959('0x26')]+_0x198206[_0xd959('0x27')]<_0x508e1c[_0xd959('0x28')][_0xd959('0x2a')])_0x56df47=0x1;_0x27b9d3({'additional':_0x56df47});}else{_0x27b9d3({'additional':0x0});}})[_0xd959('0x17')](function(_0x5bf384){logger[_0xd959('0x13')]('VerifyAdditionalPhones',_0x5bf384[_0xd959('0x15')]);_0x2adbcc(_0x296561[_0xd959('0x13')](0x1f4,_0x5bf384[_0xd959('0x15')]));});}})[_0xd959('0x17')](function(_0x41f649){logger[_0xd959('0x13')](_0xd959('0x2b'),_0x41f649[_0xd959('0x15')]);_0x2adbcc(_0x296561['error'](0x1f4,_0x41f649[_0xd959('0x15')]));});}else _0x27b9d3({'additional':0x0});});});};exports[_0xd959('0x2c')]=function(_0x4e76b1){var _0x5bd21a=this;return new Promise(function(_0x178c2d,_0x1fb7d2){return db[_0xd959('0x18')][_0xd959('0x19')]({'raw':!![],'where':{'ContactId':_0x4e76b1['body'][_0xd959('0x1b')],'ListId':_0x4e76b1[_0xd959('0x1a')][_0xd959('0x1c')],'VoiceQueueId':_0x4e76b1[_0xd959('0x1a')][_0xd959('0x1d')]===undefined?null:_0x4e76b1[_0xd959('0x1a')][_0xd959('0x1d')],'CampaignId':_0x4e76b1['body']['CampaignId']===undefined?null:_0x4e76b1[_0xd959('0x1a')][_0xd959('0x1e')]}})[_0xd959('0xc')](function(_0x9f597a){if(_0x9f597a!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x9f597a['id'],'OrderBy':{'$gte':_0x9f597a['OrderBy']}},'order':[[_0xd959('0x20'),_0xd959('0x29')]]})[_0xd959('0xc')](function(_0x40acf0){if(_0x40acf0)return activateAdditionalPhone(_0x9f597a,_0x4e76b1['body'],_0x40acf0,_0x4e76b1[_0xd959('0x2d')],_0x4e76b1[_0xd959('0x2e')])[_0xd959('0xc')](function(_0x51b722){_0x178c2d(_0x51b722);});else{return db['CmHopperAdditionalPhone'][_0xd959('0x19')]({'raw':!![],'where':{'CmHopperId':_0x9f597a['id']},'order':[[_0xd959('0x20'),_0xd959('0x29')]]})[_0xd959('0xc')](function(_0x4cefd2){if(_0x4cefd2)return activateAdditionalPhone(_0x9f597a,_0x4e76b1['body'],_0x4cefd2,_0x4e76b1[_0xd959('0x2d')],_0x4e76b1[_0xd959('0x2e')])[_0xd959('0xc')](function(_0x272b72){_0x178c2d(_0x272b72);});else{_0x178c2d({'id':_0x9f597a['id'],'phone':''});}})[_0xd959('0x17')](function(_0x42a552){logger[_0xd959('0x13')](_0xd959('0x2b'),_0x42a552['message']);_0x1fb7d2(_0x5bd21a[_0xd959('0x13')](0x1f4,_0x42a552[_0xd959('0x15')]));});}})['catch'](function(_0x48f564){logger[_0xd959('0x13')](_0xd959('0x2b'),_0x48f564[_0xd959('0x15')]);_0x1fb7d2(_0x5bd21a['error'](0x1f4,_0x48f564[_0xd959('0x15')]));});}else _0x178c2d(0x1);});});};function activateAdditionalPhone(_0x59131d,_0x42334f,_0x48d6da,_0x69d2cc,_0x278677){return new Promise(function(_0x425f1b,_0x5564d1){var _0x319d8c;if(_['isNil'](_0x48d6da[_0xd959('0x2f')])){_0x48d6da[_0xd959('0x2f')]=moment();}if(moment()>moment(_0x48d6da[_0xd959('0x2f')])){_0x319d8c=moment()[_0xd959('0x30')](_0x278677||0x3,_0xd959('0x31'));}else{if(_0x48d6da[_0xd959('0x20')]==0x0){_0x319d8c=moment(_0x48d6da['scheduledat']);}else{_0x319d8c=moment()[_0xd959('0x30')](_0x278677||0x3,_0xd959('0x31'));}}if(_[_0xd959('0x32')](_0x319d8c)){_0x319d8c=moment()[_0xd959('0x30')](_0x278677||0x3,_0xd959('0x31'));}var _0x53712f={'phone':_0x59131d[_0xd959('0x33')],'active':0x0,'OrderBy':_[_0xd959('0x32')](_0x59131d[_0xd959('0x20')])?0x0:_0x59131d[_0xd959('0x20')],'scheduledat':moment()[_0xd959('0x30')](_0x69d2cc||0x1,_0xd959('0x31')),'countbusyretry':_0x42334f[_0xd959('0x21')],'countcongestionretry':_0x42334f[_0xd959('0x22')],'countnoanswerretry':_0x42334f[_0xd959('0x23')],'countnosuchnumberretry':_0x42334f[_0xd959('0x34')],'countdropretry':_0x42334f[_0xd959('0x24')],'countabandonedretry':_0x42334f[_0xd959('0x25')],'countmachineretry':_0x42334f[_0xd959('0x26')],'countagentrejectretry':_0x42334f[_0xd959('0x27')],'createdAt':_0x42334f[_0xd959('0x35')],'updatedAt':_0x42334f['updatedAt']};var _0x50baa3={'CmHopperId':_0x59131d['id'],'phone':_0x48d6da['phone'],'active':0x0,'OrderBy':_[_0xd959('0x32')](_0x48d6da[_0xd959('0x20')])?0x0:_0x48d6da['OrderBy'],'scheduledat':_0x319d8c,'countbusyretry':_0x48d6da[_0xd959('0x21')],'countcongestionretry':_0x48d6da[_0xd959('0x22')],'countnoanswerretry':_0x48d6da[_0xd959('0x23')],'countnosuchnumberretry':_0x48d6da[_0xd959('0x34')],'countdropretry':_0x48d6da[_0xd959('0x24')],'countabandonedretry':_0x48d6da[_0xd959('0x25')],'countmachineretry':_0x48d6da[_0xd959('0x26')],'countagentrejectretry':_0x48d6da[_0xd959('0x27')],'createdAt':_0x48d6da[_0xd959('0x35')],'updatedAt':_0x48d6da['updatedAt']};return db[_0xd959('0x36')][_0xd959('0x37')](function(_0x369f4b){return db[_0xd959('0x1f')][_0xd959('0x38')](_0x53712f,{'where':{'id':_0x48d6da['id']}},{'transaction':_0x369f4b})[_0xd959('0xc')](function(){return db[_0xd959('0x18')]['update'](_0x50baa3,{'where':{'id':_0x59131d['id']}},{'transaction':_0x369f4b});});})[_0xd959('0xc')](function(_0x3137a1){_0x425f1b({'id':_0x59131d['id'],'phone':_0x48d6da[_0xd959('0x33')]});})['catch'](function(_0x539da7){logger[_0xd959('0x13')](_0xd959('0x39'),_0x539da7['message']);_0x5564d1({'error':_0x539da7[_0xd959('0x15')]});});});}exports[_0xd959('0x3a')]=function(_0x5b7a60){var _0x39a551=this;return new Promise(function(_0x222f3a,_0x1176ca){return db[_0xd959('0x18')][_0xd959('0x38')](_0x5b7a60[_0xd959('0x1a')][_0xd959('0x3b')],{'where':{'id':_0x5b7a60[_0xd959('0x1a')]['id']}})[_0xd959('0xc')](function(_0x52486c){_0x222f3a(_0x52486c);})[_0xd959('0x17')](function(_0x39a16b){logger[_0xd959('0x13')](_0xd959('0x3a'),_0x39a16b[_0xd959('0x15')]);_0x1176ca(_0x39a551['error'](0x1f4,_0x39a16b[_0xd959('0x15')]));});});}; \ No newline at end of file +var _0x0918=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','countabandonedretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','ASC','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','IncrementPreviewCounters'];(function(_0x26fe98,_0x30184e){var _0x14ad51=function(_0xa8c475){while(--_0xa8c475){_0x26fe98['push'](_0x26fe98['shift']());}};_0x14ad51(++_0x30184e);}(_0x0918,0x132));var _0x8091=function(_0x47470f,_0x411315){_0x47470f=_0x47470f-0x0;var _0x5b16a4=_0x0918[_0x47470f];return _0x5b16a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8091('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8091('0x1'));var db=require(_0x8091('0x2'))['db'];var utils=require(_0x8091('0x3'));var logger=require(_0x8091('0x4'))('rpc');var config=require(_0x8091('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8091('0x6')][_0x8091('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x451fcc,_0x7f32d3,_0x12479b){return new BPromise(function(_0x2b0713,_0x1e6dea){return client['request'](_0x451fcc,_0x12479b)[_0x8091('0x8')](function(_0x2263d8){logger['info'](_0x8091('0x9'),_0x7f32d3,_0x8091('0xa'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x7f32d3,_0x8091('0xa'),JSON['stringify'](_0x2263d8));if(_0x2263d8['error']){if(_0x2263d8[_0x8091('0xb')][_0x8091('0xc')]===0x1f4){logger[_0x8091('0xb')](_0x8091('0x9'),_0x7f32d3,_0x2263d8[_0x8091('0xb')]['message']);return _0x1e6dea(_0x2263d8['error'][_0x8091('0xd')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x7f32d3,_0x2263d8[_0x8091('0xb')][_0x8091('0xd')]);return _0x2b0713(_0x2263d8['error'][_0x8091('0xd')]);}else{logger['info'](_0x8091('0x9'),_0x7f32d3,_0x8091('0xa'));_0x2b0713(_0x2263d8[_0x8091('0xe')][_0x8091('0xd')]);}})[_0x8091('0xf')](function(_0x5ec3a2){logger[_0x8091('0xb')](_0x8091('0x9'),_0x7f32d3,_0x5ec3a2);_0x1e6dea(_0x5ec3a2);});});}exports['VerifyAdditionalPhones']=function(_0x53c988){var _0x54c365=this;return new Promise(function(_0x28e23c,_0x5cb9d7){return db['CmHopper'][_0x8091('0x10')]({'raw':!![],'where':{'ContactId':_0x53c988['body'][_0x8091('0x11')],'ListId':_0x53c988[_0x8091('0x12')][_0x8091('0x13')],'VoiceQueueId':_0x53c988[_0x8091('0x12')]['VoiceQueueId']===undefined?null:_0x53c988[_0x8091('0x12')][_0x8091('0x14')],'CampaignId':_0x53c988[_0x8091('0x12')][_0x8091('0x15')]===undefined?null:_0x53c988[_0x8091('0x12')][_0x8091('0x15')]}})[_0x8091('0x8')](function(_0x13ebba){if(_0x13ebba!=null){return db[_0x8091('0x16')][_0x8091('0x10')]({'raw':!![],'where':{'CmHopperId':_0x13ebba['id'],'OrderBy':{'$gt':_0x13ebba['OrderBy']}},'order':[[_0x8091('0x17'),'ASC']]})[_0x8091('0x8')](function(_0x4eca87){var _0xe8e3a=0x0;if(_0x4eca87){if(_0x4eca87[_0x8091('0x18')]+_0x4eca87[_0x8091('0x19')]+_0x4eca87[_0x8091('0x1a')]+_0x4eca87[_0x8091('0x1b')]+_0x4eca87[_0x8091('0x1c')]+_0x4eca87['countabandonedretry']+_0x4eca87[_0x8091('0x1d')]+_0x4eca87[_0x8091('0x1e')]<_0x53c988[_0x8091('0x1f')]['dialGlobalMaxRetry'])_0xe8e3a=0x1;_0x28e23c({'additional':_0xe8e3a});}else{return db[_0x8091('0x16')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x13ebba['id']},'order':[[_0x8091('0x17'),'ASC']]})[_0x8091('0x8')](function(_0x817398){var _0x342d8e=0x0;if(_0x817398){if(_0x817398[_0x8091('0x18')]+_0x817398[_0x8091('0x19')]+_0x817398[_0x8091('0x1a')]+_0x817398[_0x8091('0x1b')]+_0x817398['countdropretry']+_0x817398[_0x8091('0x20')]+_0x817398[_0x8091('0x1d')]+_0x817398[_0x8091('0x1e')]<_0x53c988[_0x8091('0x1f')][_0x8091('0x21')])_0x342d8e=0x1;_0x28e23c({'additional':_0x342d8e});}else{_0x28e23c({'additional':0x0});}})[_0x8091('0xf')](function(_0x37b069){logger[_0x8091('0xb')](_0x8091('0x22'),_0x37b069['message']);_0x5cb9d7(_0x54c365['error'](0x1f4,_0x37b069['message']));});}})[_0x8091('0xf')](function(_0x10dc4c){logger[_0x8091('0xb')](_0x8091('0x22'),_0x10dc4c[_0x8091('0xd')]);_0x5cb9d7(_0x54c365[_0x8091('0xb')](0x1f4,_0x10dc4c[_0x8091('0xd')]));});}else _0x28e23c({'additional':0x0});});});};exports[_0x8091('0x23')]=function(_0x1f19b1){var _0x445420=this;return new Promise(function(_0x459148,_0x141840){return db[_0x8091('0x24')][_0x8091('0x10')]({'raw':!![],'where':{'ContactId':_0x1f19b1[_0x8091('0x12')][_0x8091('0x11')],'ListId':_0x1f19b1['body'][_0x8091('0x13')],'VoiceQueueId':_0x1f19b1[_0x8091('0x12')][_0x8091('0x14')]===undefined?null:_0x1f19b1[_0x8091('0x12')][_0x8091('0x14')],'CampaignId':_0x1f19b1['body'][_0x8091('0x15')]===undefined?null:_0x1f19b1['body'][_0x8091('0x15')]}})[_0x8091('0x8')](function(_0x5b00c8){if(_0x5b00c8!=null){return db[_0x8091('0x16')][_0x8091('0x10')]({'raw':!![],'where':{'CmHopperId':_0x5b00c8['id'],'OrderBy':{'$gte':_0x5b00c8[_0x8091('0x17')]}},'order':[[_0x8091('0x17'),_0x8091('0x25')]]})['then'](function(_0x6dbaa0){if(_0x6dbaa0)return activateAdditionalPhone(_0x5b00c8,_0x1f19b1[_0x8091('0x12')],_0x6dbaa0,_0x1f19b1['duration'],_0x1f19b1['waitTime'])[_0x8091('0x8')](function(_0x3c14f9){_0x459148(_0x3c14f9);});else{return db[_0x8091('0x16')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b00c8['id']},'order':[[_0x8091('0x17'),_0x8091('0x25')]]})[_0x8091('0x8')](function(_0x13fcfe){if(_0x13fcfe)return activateAdditionalPhone(_0x5b00c8,_0x1f19b1[_0x8091('0x12')],_0x13fcfe,_0x1f19b1[_0x8091('0x26')],_0x1f19b1[_0x8091('0x27')])['then'](function(_0x557afd){_0x459148(_0x557afd);});else{_0x459148({'id':_0x5b00c8['id'],'phone':''});}})['catch'](function(_0x2fde80){logger['error']('VerifyAdditionalPhones',_0x2fde80[_0x8091('0xd')]);_0x141840(_0x445420['error'](0x1f4,_0x2fde80[_0x8091('0xd')]));});}})[_0x8091('0xf')](function(_0x3e37c1){logger[_0x8091('0xb')](_0x8091('0x22'),_0x3e37c1[_0x8091('0xd')]);_0x141840(_0x445420[_0x8091('0xb')](0x1f4,_0x3e37c1[_0x8091('0xd')]));});}else _0x459148(0x1);});});};function activateAdditionalPhone(_0x4a7379,_0x3c566b,_0x319d62,_0x443e47,_0x9e1675){return new Promise(function(_0x237a08,_0x566703){var _0xbf3b57;if(_[_0x8091('0x28')](_0x319d62[_0x8091('0x29')])){_0x319d62['scheduledat']=moment();}if(moment()>moment(_0x319d62['scheduledat'])){_0xbf3b57=moment()[_0x8091('0x2a')](_0x9e1675||0x3,_0x8091('0x2b'));}else{if(_0x319d62['OrderBy']==0x0){_0xbf3b57=moment(_0x319d62[_0x8091('0x29')]);}else{_0xbf3b57=moment()[_0x8091('0x2a')](_0x9e1675||0x3,'minutes');}}if(_[_0x8091('0x28')](_0xbf3b57)){_0xbf3b57=moment()['add'](_0x9e1675||0x3,_0x8091('0x2b'));}var _0xc2b824={'phone':_0x4a7379[_0x8091('0x2c')],'active':0x0,'OrderBy':_[_0x8091('0x28')](_0x4a7379[_0x8091('0x17')])?0x0:_0x4a7379[_0x8091('0x17')],'scheduledat':moment()[_0x8091('0x2a')](_0x443e47||0x1,_0x8091('0x2b')),'countbusyretry':_0x3c566b[_0x8091('0x18')],'countcongestionretry':_0x3c566b[_0x8091('0x19')],'countnoanswerretry':_0x3c566b[_0x8091('0x1a')],'countnosuchnumberretry':_0x3c566b[_0x8091('0x1b')],'countdropretry':_0x3c566b[_0x8091('0x1c')],'countabandonedretry':_0x3c566b[_0x8091('0x20')],'countmachineretry':_0x3c566b[_0x8091('0x1d')],'countagentrejectretry':_0x3c566b[_0x8091('0x1e')],'createdAt':_0x3c566b['createdAt'],'updatedAt':_0x3c566b[_0x8091('0x2d')]};var _0x3f832a={'CmHopperId':_0x4a7379['id'],'phone':_0x319d62[_0x8091('0x2c')],'active':0x0,'OrderBy':_[_0x8091('0x28')](_0x319d62[_0x8091('0x17')])?0x0:_0x319d62[_0x8091('0x17')],'scheduledat':_0xbf3b57,'countbusyretry':_0x319d62[_0x8091('0x18')],'countcongestionretry':_0x319d62[_0x8091('0x19')],'countnoanswerretry':_0x319d62[_0x8091('0x1a')],'countnosuchnumberretry':_0x319d62[_0x8091('0x1b')],'countdropretry':_0x319d62['countdropretry'],'countabandonedretry':_0x319d62[_0x8091('0x20')],'countmachineretry':_0x319d62[_0x8091('0x1d')],'countagentrejectretry':_0x319d62[_0x8091('0x1e')],'createdAt':_0x319d62[_0x8091('0x2e')],'updatedAt':_0x319d62['updatedAt']};return db[_0x8091('0x2f')][_0x8091('0x30')](function(_0x32c9d4){return db[_0x8091('0x16')][_0x8091('0x31')](_0xc2b824,{'where':{'id':_0x319d62['id']}},{'transaction':_0x32c9d4})[_0x8091('0x8')](function(){return db[_0x8091('0x24')][_0x8091('0x31')](_0x3f832a,{'where':{'id':_0x4a7379['id']}},{'transaction':_0x32c9d4});});})['then'](function(_0x4bc9ae){_0x237a08({'id':_0x4a7379['id'],'phone':_0x319d62['phone']});})[_0x8091('0xf')](function(_0x1e4c1f){logger[_0x8091('0xb')]('activateAdditionalPhone',_0x1e4c1f['message']);_0x566703({'error':_0x1e4c1f[_0x8091('0xd')]});});});}exports[_0x8091('0x32')]=function(_0x56c320){var _0x593abc=this;return new Promise(function(_0x2c6793,_0x135dad){return db['CmHopper'][_0x8091('0x31')](_0x56c320[_0x8091('0x12')]['field'],{'where':{'id':_0x56c320[_0x8091('0x12')]['id']}})[_0x8091('0x8')](function(_0x3263a9){_0x2c6793(_0x3263a9);})['catch'](function(_0x19b1d9){logger[_0x8091('0xb')]('IncrementPreviewCounters',_0x19b1d9[_0x8091('0xd')]);_0x135dad(_0x593abc[_0x8091('0xb')](0x1f4,_0x19b1d9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4256f72..fd22a7e 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 _0xc35d=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','show','post','isAuthenticated','put','update','destroy','exports','multer','util','path','express'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0xc35d,0x12e));var _0xdc35=function(_0xd3cc19,_0x491934){_0xd3cc19=_0xd3cc19-0x0;var _0xf69125=_0xc35d[_0xd3cc19];return _0xf69125;};'use strict';var multer=require(_0xdc35('0x0'));var util=require(_0xdc35('0x1'));var path=require(_0xdc35('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc35('0x3'));var router=express['Router']();var fs_extra=require(_0xdc35('0x4'));var auth=require(_0xdc35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc35('0x6'));var controller=require(_0xdc35('0x7'));router[_0xdc35('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc35('0x9')]);router[_0xdc35('0x8')](_0xdc35('0xa'),auth['isAuthenticated'](),controller[_0xdc35('0xb')]);router[_0xdc35('0xc')]('/',auth[_0xdc35('0xd')](),controller['create']);router[_0xdc35('0xe')](_0xdc35('0xa'),auth[_0xdc35('0xd')](),controller[_0xdc35('0xf')]);router['delete'](_0xdc35('0xa'),auth[_0xdc35('0xd')](),controller[_0xdc35('0x10')]);module[_0xdc35('0x11')]=router; \ No newline at end of file +var _0x9809=['./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4563b0,_0x56cf2e){var _0x77e70b=function(_0x2111cd){while(--_0x2111cd){_0x4563b0['push'](_0x4563b0['shift']());}};_0x77e70b(++_0x56cf2e);}(_0x9809,0x1da));var _0x9980=function(_0x438356,_0x559b32){_0x438356=_0x438356-0x0;var _0x9be077=_0x9809[_0x438356];return _0x9be077;};'use strict';var multer=require(_0x9980('0x0'));var util=require(_0x9980('0x1'));var path=require(_0x9980('0x2'));var timeout=require(_0x9980('0x3'));var express=require(_0x9980('0x4'));var router=express[_0x9980('0x5')]();var fs_extra=require(_0x9980('0x6'));var auth=require(_0x9980('0x7'));var interaction=require(_0x9980('0x8'));var config=require(_0x9980('0x9'));var controller=require(_0x9980('0xa'));router['get']('/',auth[_0x9980('0xb')](),controller[_0x9980('0xc')]);router['get'](_0x9980('0xd'),auth['isAuthenticated'](),controller[_0x9980('0xe')]);router[_0x9980('0xf')]('/',auth['isAuthenticated'](),controller[_0x9980('0x10')]);router[_0x9980('0x11')](_0x9980('0xd'),auth[_0x9980('0xb')](),controller[_0x9980('0x12')]);router[_0x9980('0x13')](_0x9980('0xd'),auth[_0x9980('0xb')](),controller[_0x9980('0x14')]);module[_0x9980('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 05bc77c..cc3abc5 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 _0xca96=['STRING','INTEGER','contactListQueue','sequelize'];(function(_0x28608f,_0x3bc3e2){var _0x1befbb=function(_0x204014){while(--_0x204014){_0x28608f['push'](_0x28608f['shift']());}};_0x1befbb(++_0x3bc3e2);}(_0xca96,0x10f));var _0x6ca9=function(_0x496ed6,_0x5c378b){_0x496ed6=_0x496ed6-0x0;var _0x448a72=_0xca96[_0x496ed6];return _0x448a72;};'use strict';var moment=require('moment');var Sequelize=require(_0x6ca9('0x0'));module['exports']={'phone':{'type':Sequelize[_0x6ca9('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6ca9('0x2')],'unique':_0x6ca9('0x3')},'ListId':{'type':Sequelize[_0x6ca9('0x2')],'unique':_0x6ca9('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6ca9('0x3')}}; \ No newline at end of file +var _0x4ce6=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4ce6,0x108));var _0x64ce=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0x4ce6[_0x5e2152];return _0x5ddcf6;};'use strict';var moment=require(_0x64ce('0x0'));var Sequelize=require('sequelize');module[_0x64ce('0x1')]={'phone':{'type':Sequelize[_0x64ce('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x64ce('0x3')],'unique':_0x64ce('0x4')},'ListId':{'type':Sequelize[_0x64ce('0x3')],'unique':_0x64ce('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x64ce('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a18d094..14d9be9 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 _0x336c=['order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0xa417ff,_0x2ab57c){var _0x2c0a82=function(_0x118e47){while(--_0x118e47){_0xa417ff['push'](_0xa417ff['shift']());}};_0x2c0a82(++_0x2ab57c);}(_0x336c,0xa8));var _0xc336=function(_0x17afd1,_0x43a946){_0x17afd1=_0x17afd1-0x0;var _0x24139d=_0x336c[_0x17afd1];return _0x24139d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc336('0x0'));var zipdir=require(_0xc336('0x1'));var jsonpatch=require(_0xc336('0x2'));var rp=require(_0xc336('0x3'));var moment=require('moment');var BPromise=require(_0xc336('0x4'));var Mustache=require(_0xc336('0x5'));var util=require(_0xc336('0x6'));var path=require(_0xc336('0x7'));var sox=require(_0xc336('0x8'));var csv=require(_0xc336('0x9'));var ejs=require(_0xc336('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc336('0xb'));var squel=require(_0xc336('0xc'));var crypto=require(_0xc336('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc336('0xe'));var toCsv=require(_0xc336('0x9'));var querystring=require(_0xc336('0xf'));var Papa=require('papaparse');var Redis=require(_0xc336('0x10'));var authService=require(_0xc336('0x11'));var qs=require(_0xc336('0x12'));var as=require(_0xc336('0x13'));var hardwareService=require(_0xc336('0x14'));var logger=require(_0xc336('0x15'))('api');var utils=require(_0xc336('0x16'));var config=require(_0xc336('0x17'));var licenseUtil=require(_0xc336('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xefda8e,_0x3914a5){_0x3914a5=_0x3914a5||0xcc;return function(_0x5225ea){if(_0x5225ea){return _0xefda8e[_0xc336('0x19')](_0x3914a5);}return _0xefda8e[_0xc336('0x1a')](_0x3914a5)[_0xc336('0x1b')]();};}function respondWithResult(_0x114380,_0x255712){_0x255712=_0x255712||0xc8;return function(_0x17491d){if(_0x17491d){return _0x114380[_0xc336('0x1a')](_0x255712)['json'](_0x17491d);}};}function respondWithFilteredResult(_0x42c2c5,_0x3faada){return function(_0x336bf9){if(_0x336bf9){var _0x255c35=typeof _0x3faada[_0xc336('0x1c')]==='undefined'&&typeof _0x3faada['limit']===_0xc336('0x1d');var _0x4a68e2=_0x336bf9['count'];var _0x43a960=_0x255c35?0x0:_0x3faada['offset'];var _0x367525=_0x255c35?_0x336bf9[_0xc336('0x1e')]:_0x3faada[_0xc336('0x1c')]+_0x3faada['limit'];var _0x47bd7f;if(_0x367525>=_0x4a68e2){_0x367525=_0x4a68e2;_0x47bd7f=0xc8;}else{_0x47bd7f=0xce;}_0x42c2c5[_0xc336('0x1a')](_0x47bd7f);return _0x42c2c5[_0xc336('0x1f')](_0xc336('0x20'),_0x43a960+'-'+_0x367525+'/'+_0x4a68e2)['json'](_0x336bf9);}return null;};}function patchUpdates(_0x5425ca){return function(_0x52d8fd){try{jsonpatch[_0xc336('0x21')](_0x52d8fd,_0x5425ca,!![]);}catch(_0x17f554){return BPromise['reject'](_0x17f554);}return _0x52d8fd[_0xc336('0x22')]();};}function saveUpdates(_0x19c545,_0x146d9d){return function(_0x5298b0){if(_0x5298b0){return _0x5298b0[_0xc336('0x23')](_0x19c545)[_0xc336('0x24')](function(_0x15fc9d){return _0x15fc9d;});}return null;};}function removeEntity(_0x138d97,_0x47a598){return function(_0x43a135){if(_0x43a135){return _0x43a135[_0xc336('0x25')]()['then'](function(){_0x138d97[_0xc336('0x1a')](0xcc)[_0xc336('0x1b')]();});}};}function handleEntityNotFound(_0x566718,_0x5ee689){return function(_0x136299){if(!_0x136299){_0x566718[_0xc336('0x19')](0x194);}return _0x136299;};}function handleError(_0x483309,_0x4e7e82){_0x4e7e82=_0x4e7e82||0x1f4;return function(_0x2ae8b8){logger[_0xc336('0x26')](_0x2ae8b8[_0xc336('0x27')]);if(_0x2ae8b8[_0xc336('0x28')]){delete _0x2ae8b8[_0xc336('0x28')];}_0x483309[_0xc336('0x1a')](_0x4e7e82)[_0xc336('0x29')](_0x2ae8b8);};}exports[_0xc336('0x2a')]=function(_0x2fbd16,_0x4d4c37){var _0x30b19b={},_0x244aec={},_0x3cae04={'count':0x0,'rows':[]};var _0x4d352e=_[_0xc336('0x2b')](db[_0xc336('0x2c')][_0xc336('0x2d')],function(_0x10d7a0){return{'name':_0x10d7a0[_0xc336('0x2e')],'type':_0x10d7a0[_0xc336('0x2f')][_0xc336('0x30')]};});_0x244aec['model']=_[_0xc336('0x2b')](_0x4d352e,_0xc336('0x28'));_0x244aec[_0xc336('0x31')]=_[_0xc336('0x32')](_0x2fbd16[_0xc336('0x31')]);_0x244aec[_0xc336('0x33')]=_[_0xc336('0x34')](_0x244aec[_0xc336('0x35')],_0x244aec[_0xc336('0x31')]);_0x30b19b[_0xc336('0x36')]=_['intersection'](_0x244aec[_0xc336('0x35')],qs['fields'](_0x2fbd16[_0xc336('0x31')][_0xc336('0x37')]));_0x30b19b[_0xc336('0x36')]=_0x30b19b['attributes'][_0xc336('0x38')]?_0x30b19b[_0xc336('0x36')]:_0x244aec[_0xc336('0x35')];if(!_0x2fbd16[_0xc336('0x31')][_0xc336('0x39')](_0xc336('0x3a'))){_0x30b19b[_0xc336('0x3b')]=qs[_0xc336('0x3b')](_0x2fbd16[_0xc336('0x31')][_0xc336('0x3b')]);_0x30b19b[_0xc336('0x1c')]=qs['offset'](_0x2fbd16[_0xc336('0x31')][_0xc336('0x1c')]);}_0x30b19b[_0xc336('0x3c')]=qs['sort'](_0x2fbd16[_0xc336('0x31')][_0xc336('0x3d')]);_0x30b19b[_0xc336('0x3e')]=qs[_0xc336('0x33')](_['pick'](_0x2fbd16['query'],_0x244aec['filters']),_0x4d352e);if(_0x2fbd16[_0xc336('0x31')]['filter']){_0x30b19b[_0xc336('0x3e')]=_[_0xc336('0x3f')](_0x30b19b['where'],{'$or':_['map'](_0x4d352e,function(_0x310cd2){if(_0x310cd2[_0xc336('0x2f')]!==_0xc336('0x40')){var _0x25a195={};_0x25a195[_0x310cd2[_0xc336('0x28')]]={'$like':'%'+_0x2fbd16[_0xc336('0x31')]['filter']+'%'};return _0x25a195;}})});}_0x30b19b=_[_0xc336('0x3f')]({},_0x30b19b,_0x2fbd16[_0xc336('0x41')]);var _0x1eb198={'where':_0x30b19b[_0xc336('0x3e')]};return db[_0xc336('0x2c')][_0xc336('0x1e')](_0x1eb198)['then'](function(_0x522dff){_0x3cae04[_0xc336('0x1e')]=_0x522dff;if(_0x2fbd16['query'][_0xc336('0x42')]){_0x30b19b[_0xc336('0x43')]=[{'all':!![]}];}return db[_0xc336('0x2c')][_0xc336('0x44')](_0x30b19b);})[_0xc336('0x24')](function(_0x22bb20){_0x3cae04[_0xc336('0x45')]=_0x22bb20;return _0x3cae04;})['then'](respondWithFilteredResult(_0x4d4c37,_0x30b19b))[_0xc336('0x46')](handleError(_0x4d4c37,null));};exports[_0xc336('0x47')]=function(_0xea0459,_0x41c5e6){var _0x35ead6={'raw':!![],'where':{'id':_0xea0459['params']['id']}},_0x33ecff={};_0x33ecff[_0xc336('0x35')]=_['keys'](db[_0xc336('0x2c')][_0xc336('0x2d')]);_0x33ecff['query']=_[_0xc336('0x32')](_0xea0459[_0xc336('0x31')]);_0x33ecff[_0xc336('0x33')]=_[_0xc336('0x34')](_0x33ecff[_0xc336('0x35')],_0x33ecff[_0xc336('0x31')]);_0x35ead6[_0xc336('0x36')]=_[_0xc336('0x34')](_0x33ecff[_0xc336('0x35')],qs['fields'](_0xea0459[_0xc336('0x31')][_0xc336('0x37')]));_0x35ead6[_0xc336('0x36')]=_0x35ead6[_0xc336('0x36')][_0xc336('0x38')]?_0x35ead6[_0xc336('0x36')]:_0x33ecff[_0xc336('0x35')];if(_0xea0459['query'][_0xc336('0x42')]){_0x35ead6[_0xc336('0x43')]=[{'all':!![]}];}_0x35ead6=_[_0xc336('0x3f')]({},_0x35ead6,_0xea0459[_0xc336('0x41')]);return db[_0xc336('0x2c')][_0xc336('0x48')](_0x35ead6)['then'](handleEntityNotFound(_0x41c5e6,null))[_0xc336('0x24')](respondWithResult(_0x41c5e6,null))[_0xc336('0x46')](handleError(_0x41c5e6,null));};exports['update']=function(_0x420bde,_0x53851d){if(_0x420bde['body']['id']){delete _0x420bde[_0xc336('0x49')]['id'];}return db[_0xc336('0x2c')]['find']({'where':{'id':_0x420bde[_0xc336('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53851d,null))['then'](saveUpdates(_0x420bde[_0xc336('0x49')],null))[_0xc336('0x24')](respondWithResult(_0x53851d,null))['catch'](handleError(_0x53851d,null));};exports[_0xc336('0x25')]=function(_0x5d4d8a,_0x35738f){return db[_0xc336('0x2c')]['find']({'where':{'id':_0x5d4d8a[_0xc336('0x4a')]['id']}})[_0xc336('0x24')](handleEntityNotFound(_0x35738f,null))[_0xc336('0x24')](removeEntity(_0x35738f,null))[_0xc336('0x46')](handleError(_0x35738f,null));};exports[_0xc336('0x4b')]=function(_0x2a5b2a,_0x6ceda6){return db[_0xc336('0x2c')][_0xc336('0x4b')]()[_0xc336('0x24')](respondWithResult(_0x6ceda6,null))[_0xc336('0x46')](handleError(_0x6ceda6,null));}; \ No newline at end of file +var _0x4288=['order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','body','params','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x3efc2,_0x1900e3){var _0x4512e4=function(_0x34d758){while(--_0x34d758){_0x3efc2['push'](_0x3efc2['shift']());}};_0x4512e4(++_0x1900e3);}(_0x4288,0xb8));var _0x8428=function(_0x4399e1,_0x33c7aa){_0x4399e1=_0x4399e1-0x0;var _0x7294d2=_0x4288[_0x4399e1];return _0x7294d2;};'use strict';var emlformat=require(_0x8428('0x0'));var rimraf=require(_0x8428('0x1'));var zipdir=require(_0x8428('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8428('0x3'));var moment=require(_0x8428('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8428('0x5'));var util=require('util');var path=require(_0x8428('0x6'));var sox=require(_0x8428('0x7'));var csv=require('to-csv');var ejs=require(_0x8428('0x8'));var fs=require('fs');var fs_extra=require(_0x8428('0x9'));var _=require(_0x8428('0xa'));var squel=require(_0x8428('0xb'));var crypto=require(_0x8428('0xc'));var jsforce=require(_0x8428('0xd'));var deskjs=require(_0x8428('0xe'));var toCsv=require(_0x8428('0xf'));var querystring=require(_0x8428('0x10'));var Papa=require(_0x8428('0x11'));var Redis=require(_0x8428('0x12'));var authService=require(_0x8428('0x13'));var qs=require(_0x8428('0x14'));var as=require(_0x8428('0x15'));var hardwareService=require(_0x8428('0x16'));var logger=require(_0x8428('0x17'))(_0x8428('0x18'));var utils=require(_0x8428('0x19'));var config=require(_0x8428('0x1a'));var licenseUtil=require(_0x8428('0x1b'));var db=require(_0x8428('0x1c'))['db'];function respondWithStatusCode(_0x333617,_0x2a88ff){_0x2a88ff=_0x2a88ff||0xcc;return function(_0x42e98c){if(_0x42e98c){return _0x333617[_0x8428('0x1d')](_0x2a88ff);}return _0x333617[_0x8428('0x1e')](_0x2a88ff)[_0x8428('0x1f')]();};}function respondWithResult(_0x44b389,_0x4287ce){_0x4287ce=_0x4287ce||0xc8;return function(_0x4f3973){if(_0x4f3973){return _0x44b389[_0x8428('0x1e')](_0x4287ce)[_0x8428('0x20')](_0x4f3973);}};}function respondWithFilteredResult(_0x54faf7,_0x3b5174){return function(_0x1b7bce){if(_0x1b7bce){var _0x39bcc6=typeof _0x3b5174[_0x8428('0x21')]===_0x8428('0x22')&&typeof _0x3b5174['limit']==='undefined';var _0x497844=_0x1b7bce[_0x8428('0x23')];var _0x5d3a1a=_0x39bcc6?0x0:_0x3b5174[_0x8428('0x21')];var _0x51ee87=_0x39bcc6?_0x1b7bce[_0x8428('0x23')]:_0x3b5174['offset']+_0x3b5174[_0x8428('0x24')];var _0x2c1877;if(_0x51ee87>=_0x497844){_0x51ee87=_0x497844;_0x2c1877=0xc8;}else{_0x2c1877=0xce;}_0x54faf7[_0x8428('0x1e')](_0x2c1877);return _0x54faf7[_0x8428('0x25')](_0x8428('0x26'),_0x5d3a1a+'-'+_0x51ee87+'/'+_0x497844)['json'](_0x1b7bce);}return null;};}function patchUpdates(_0x4c621a){return function(_0x439ccd){try{jsonpatch[_0x8428('0x27')](_0x439ccd,_0x4c621a,!![]);}catch(_0x5745ae){return BPromise[_0x8428('0x28')](_0x5745ae);}return _0x439ccd[_0x8428('0x29')]();};}function saveUpdates(_0x5eae5d,_0x52c8c7){return function(_0x630340){if(_0x630340){return _0x630340[_0x8428('0x2a')](_0x5eae5d)[_0x8428('0x2b')](function(_0x584bd4){return _0x584bd4;});}return null;};}function removeEntity(_0x9de8f1,_0x487bdb){return function(_0x554e9f){if(_0x554e9f){return _0x554e9f[_0x8428('0x2c')]()['then'](function(){_0x9de8f1[_0x8428('0x1e')](0xcc)[_0x8428('0x1f')]();});}};}function handleEntityNotFound(_0xf7aa2d,_0x87e7f8){return function(_0x517f1a){if(!_0x517f1a){_0xf7aa2d[_0x8428('0x1d')](0x194);}return _0x517f1a;};}function handleError(_0x3312b9,_0x147a58){_0x147a58=_0x147a58||0x1f4;return function(_0x16ba33){logger[_0x8428('0x2d')](_0x16ba33[_0x8428('0x2e')]);if(_0x16ba33[_0x8428('0x2f')]){delete _0x16ba33[_0x8428('0x2f')];}_0x3312b9[_0x8428('0x1e')](_0x147a58)[_0x8428('0x30')](_0x16ba33);};}exports[_0x8428('0x31')]=function(_0x49d336,_0x3942bf){var _0x5f19d6={},_0x241fa8={},_0x12044b={'count':0x0,'rows':[]};var _0x25b43a=_[_0x8428('0x32')](db[_0x8428('0x33')][_0x8428('0x34')],function(_0x5a34a7){return{'name':_0x5a34a7['fieldName'],'type':_0x5a34a7[_0x8428('0x35')][_0x8428('0x36')]};});_0x241fa8[_0x8428('0x37')]=_[_0x8428('0x32')](_0x25b43a,_0x8428('0x2f'));_0x241fa8['query']=_['keys'](_0x49d336['query']);_0x241fa8['filters']=_[_0x8428('0x38')](_0x241fa8[_0x8428('0x37')],_0x241fa8[_0x8428('0x39')]);_0x5f19d6[_0x8428('0x3a')]=_[_0x8428('0x38')](_0x241fa8[_0x8428('0x37')],qs[_0x8428('0x3b')](_0x49d336['query'][_0x8428('0x3b')]));_0x5f19d6[_0x8428('0x3a')]=_0x5f19d6['attributes'][_0x8428('0x3c')]?_0x5f19d6[_0x8428('0x3a')]:_0x241fa8['model'];if(!_0x49d336[_0x8428('0x39')][_0x8428('0x3d')]('nolimit')){_0x5f19d6[_0x8428('0x24')]=qs[_0x8428('0x24')](_0x49d336['query'][_0x8428('0x24')]);_0x5f19d6[_0x8428('0x21')]=qs[_0x8428('0x21')](_0x49d336[_0x8428('0x39')]['offset']);}_0x5f19d6[_0x8428('0x3e')]=qs[_0x8428('0x3f')](_0x49d336[_0x8428('0x39')]['sort']);_0x5f19d6[_0x8428('0x40')]=qs[_0x8428('0x41')](_[_0x8428('0x42')](_0x49d336['query'],_0x241fa8[_0x8428('0x41')]),_0x25b43a);if(_0x49d336[_0x8428('0x39')][_0x8428('0x43')]){_0x5f19d6[_0x8428('0x40')]=_[_0x8428('0x44')](_0x5f19d6['where'],{'$or':_[_0x8428('0x32')](_0x25b43a,function(_0x918ae8){if(_0x918ae8[_0x8428('0x35')]!==_0x8428('0x45')){var _0x177e4a={};_0x177e4a[_0x918ae8['name']]={'$like':'%'+_0x49d336[_0x8428('0x39')][_0x8428('0x43')]+'%'};return _0x177e4a;}})});}_0x5f19d6=_[_0x8428('0x44')]({},_0x5f19d6,_0x49d336['options']);var _0x193a85={'where':_0x5f19d6[_0x8428('0x40')]};return db[_0x8428('0x33')][_0x8428('0x23')](_0x193a85)['then'](function(_0x2ea062){_0x12044b[_0x8428('0x23')]=_0x2ea062;if(_0x49d336[_0x8428('0x39')][_0x8428('0x46')]){_0x5f19d6[_0x8428('0x47')]=[{'all':!![]}];}return db[_0x8428('0x33')][_0x8428('0x48')](_0x5f19d6);})[_0x8428('0x2b')](function(_0x2723fc){_0x12044b[_0x8428('0x49')]=_0x2723fc;return _0x12044b;})['then'](respondWithFilteredResult(_0x3942bf,_0x5f19d6))['catch'](handleError(_0x3942bf,null));};exports[_0x8428('0x4a')]=function(_0x27cc9f,_0x4af27e){var _0x4db288={'raw':!![],'where':{'id':_0x27cc9f['params']['id']}},_0x29b2ef={};_0x29b2ef['model']=_['keys'](db[_0x8428('0x33')][_0x8428('0x34')]);_0x29b2ef[_0x8428('0x39')]=_[_0x8428('0x4b')](_0x27cc9f[_0x8428('0x39')]);_0x29b2ef[_0x8428('0x41')]=_[_0x8428('0x38')](_0x29b2ef[_0x8428('0x37')],_0x29b2ef[_0x8428('0x39')]);_0x4db288[_0x8428('0x3a')]=_[_0x8428('0x38')](_0x29b2ef[_0x8428('0x37')],qs[_0x8428('0x3b')](_0x27cc9f[_0x8428('0x39')][_0x8428('0x3b')]));_0x4db288['attributes']=_0x4db288[_0x8428('0x3a')][_0x8428('0x3c')]?_0x4db288['attributes']:_0x29b2ef[_0x8428('0x37')];if(_0x27cc9f[_0x8428('0x39')][_0x8428('0x46')]){_0x4db288[_0x8428('0x47')]=[{'all':!![]}];}_0x4db288=_[_0x8428('0x44')]({},_0x4db288,_0x27cc9f[_0x8428('0x4c')]);return db[_0x8428('0x33')][_0x8428('0x4d')](_0x4db288)['then'](handleEntityNotFound(_0x4af27e,null))[_0x8428('0x2b')](respondWithResult(_0x4af27e,null))['catch'](handleError(_0x4af27e,null));};exports[_0x8428('0x2a')]=function(_0x4b52a0,_0xfd835f){if(_0x4b52a0[_0x8428('0x4e')]['id']){delete _0x4b52a0[_0x8428('0x4e')]['id'];}return db[_0x8428('0x33')]['find']({'where':{'id':_0x4b52a0[_0x8428('0x4f')]['id']}})[_0x8428('0x2b')](handleEntityNotFound(_0xfd835f,null))[_0x8428('0x2b')](saveUpdates(_0x4b52a0[_0x8428('0x4e')],null))[_0x8428('0x2b')](respondWithResult(_0xfd835f,null))['catch'](handleError(_0xfd835f,null));};exports[_0x8428('0x2c')]=function(_0x443880,_0x85111f){return db['CmHopperBlack'][_0x8428('0x4d')]({'where':{'id':_0x443880[_0x8428('0x4f')]['id']}})[_0x8428('0x2b')](handleEntityNotFound(_0x85111f,null))[_0x8428('0x2b')](removeEntity(_0x85111f,null))[_0x8428('0x50')](handleError(_0x85111f,null));};exports[_0x8428('0x51')]=function(_0x29236f,_0x754693){return db[_0x8428('0x33')][_0x8428('0x51')]()[_0x8428('0x2b')](respondWithResult(_0x754693,null))[_0x8428('0x50')](handleError(_0x754693,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3e37c8e..e4b4758 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 _0x8165=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','define'];(function(_0x213548,_0x2e5e7b){var _0x497876=function(_0x1ed508){while(--_0x1ed508){_0x213548['push'](_0x213548['shift']());}};_0x497876(++_0x2e5e7b);}(_0x8165,0xe0));var _0x5816=function(_0x3da225,_0x3f410c){_0x3da225=_0x3da225-0x0;var _0x3c05d4=_0x8165[_0x3da225];return _0x3c05d4;};'use strict';var _=require(_0x5816('0x0'));var util=require(_0x5816('0x1'));var logger=require(_0x5816('0x2'))('api');var moment=require(_0x5816('0x3'));var BPromise=require(_0x5816('0x4'));var rp=require(_0x5816('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5816('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x3fb320,_0x340bc3){return _0x3fb320[_0x5816('0x7')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb30=['./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ebf2f,_0x3e8f85){var _0x49a9bf=function(_0x152323){while(--_0x152323){_0x5ebf2f['push'](_0x5ebf2f['shift']());}};_0x49a9bf(++_0x3e8f85);}(_0xfb30,0x9e));var _0x0fb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfb30[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0fb3('0x2'));var BPromise=require(_0x0fb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fb3('0x4'));var rimraf=require(_0x0fb3('0x5'));var config=require(_0x0fb3('0x6'));var attributes=require(_0x0fb3('0x7'));module[_0x0fb3('0x8')]=function(_0x4daf11,_0x58f3d0){return _0x4daf11[_0x0fb3('0x9')]('CmHopperBlack',attributes,{'tableName':_0x0fb3('0xa'),'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 5495d75..9c4825b 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 _0xc5a1=['stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','findAll','options','limit','include','attributes','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','destroy','where','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x5bf51d,_0x11154a){var _0x411fd1=function(_0x284ca6){while(--_0x284ca6){_0x5bf51d['push'](_0x5bf51d['shift']());}};_0x411fd1(++_0x11154a);}(_0xc5a1,0x1d2));var _0x1c5a=function(_0x3221cd,_0x4a4a4a){_0x3221cd=_0x3221cd-0x0;var _0x21a689=_0xc5a1[_0x3221cd];return _0x21a689;};'use strict';var _=require(_0x1c5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c5a('0x1'));var rs=require(_0x1c5a('0x2'));var fs=require('fs');var Redis=require(_0x1c5a('0x3'));var db=require(_0x1c5a('0x4'))['db'];var utils=require(_0x1c5a('0x5'));var logger=require(_0x1c5a('0x6'))('rpc');var config=require(_0x1c5a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1c5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3418b4,_0xf6e0fd,_0x19a6dc){return new BPromise(function(_0x13356e,_0x35aba9){return client[_0x1c5a('0x9')](_0x3418b4,_0x19a6dc)[_0x1c5a('0xa')](function(_0x425d3f){logger[_0x1c5a('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0xf6e0fd,_0x1c5a('0xc'));logger[_0x1c5a('0xd')](_0x1c5a('0xe'),_0xf6e0fd,_0x1c5a('0xc'),JSON[_0x1c5a('0xf')](_0x425d3f));if(_0x425d3f['error']){if(_0x425d3f['error']['code']===0x1f4){logger[_0x1c5a('0x10')](_0x1c5a('0x11'),_0xf6e0fd,_0x425d3f[_0x1c5a('0x10')][_0x1c5a('0x12')]);return _0x35aba9(_0x425d3f[_0x1c5a('0x10')][_0x1c5a('0x12')]);}logger[_0x1c5a('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0xf6e0fd,_0x425d3f[_0x1c5a('0x10')]['message']);return _0x13356e(_0x425d3f[_0x1c5a('0x10')]['message']);}else{logger['info'](_0x1c5a('0x11'),_0xf6e0fd,_0x1c5a('0xc'));_0x13356e(_0x425d3f[_0x1c5a('0x13')][_0x1c5a('0x12')]);}})['catch'](function(_0x5c41c3){logger[_0x1c5a('0x10')](_0x1c5a('0x11'),_0xf6e0fd,_0x5c41c3);_0x35aba9(_0x5c41c3);});});}exports[_0x1c5a('0x14')]=function(_0x48e747){var _0x1dc9e5=this;return new Promise(function(_0x2ae426,_0x3a5074){return db['CmHopperBlack'][_0x1c5a('0x15')]({'raw':_0x48e747[_0x1c5a('0x16')]?_0x48e747[_0x1c5a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x48e747[_0x1c5a('0x16')]?_0x48e747[_0x1c5a('0x16')]['where']||null:null,'attributes':_0x48e747[_0x1c5a('0x16')]?_0x48e747['options']['attributes']||null:null,'limit':_0x48e747['options']?_0x48e747[_0x1c5a('0x16')][_0x1c5a('0x17')]||null:null,'include':_0x48e747[_0x1c5a('0x16')]?_0x48e747[_0x1c5a('0x16')][_0x1c5a('0x18')]?_['map'](_0x48e747[_0x1c5a('0x16')][_0x1c5a('0x18')],function(_0x140c52){return{'model':db[_0x140c52['model']],'as':_0x140c52['as'],'attributes':_0x140c52[_0x1c5a('0x19')],'include':_0x140c52['include']?_[_0x1c5a('0x1a')](_0x140c52[_0x1c5a('0x18')],function(_0x5d5209){return{'model':db[_0x5d5209[_0x1c5a('0x1b')]],'as':_0x5d5209['as'],'attributes':_0x5d5209['attributes'],'include':_0x5d5209['include']?_[_0x1c5a('0x1a')](_0x5d5209['include'],function(_0x359621){return{'model':db[_0x359621[_0x1c5a('0x1b')]],'as':_0x359621['as'],'attributes':_0x359621[_0x1c5a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1c5a('0xa')](function(_0x13fd48){logger[_0x1c5a('0xb')](_0x1c5a('0x14'),_0x48e747);logger['debug']('GetCmHopperBlack',_0x48e747,JSON[_0x1c5a('0xf')](_0x13fd48));_0x2ae426(_0x13fd48);})[_0x1c5a('0x1c')](function(_0x104d81){logger[_0x1c5a('0x10')](_0x1c5a('0x14'),_0x104d81[_0x1c5a('0x12')],_0x48e747);_0x3a5074(_0x1dc9e5[_0x1c5a('0x10')](0x1f4,_0x104d81['message']));});});};exports[_0x1c5a('0x1d')]=function(_0x3bd471){var _0xf20479=this;return new Promise(function(_0x41636b,_0x43c7ce){return db[_0x1c5a('0x1e')][_0x1c5a('0x1f')](_0x3bd471[_0x1c5a('0x20')],{'raw':_0x3bd471[_0x1c5a('0x16')]?_0x3bd471[_0x1c5a('0x16')][_0x1c5a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bd471['options']?_0x3bd471['options']['where']||null:null,'attributes':_0x3bd471[_0x1c5a('0x16')]?_0x3bd471[_0x1c5a('0x16')][_0x1c5a('0x19')]||null:null,'limit':_0x3bd471[_0x1c5a('0x16')]?_0x3bd471[_0x1c5a('0x16')][_0x1c5a('0x17')]||null:null})['then'](function(_0x29134e){logger[_0x1c5a('0xb')]('UpdateCmHopperBlack',_0x3bd471);logger[_0x1c5a('0xd')](_0x1c5a('0x1d'),_0x3bd471,JSON[_0x1c5a('0xf')](_0x29134e));_0x41636b(_0x29134e);})[_0x1c5a('0x1c')](function(_0x5462e3){logger[_0x1c5a('0x10')](_0x1c5a('0x1d'),_0x5462e3[_0x1c5a('0x12')],_0x3bd471);_0x43c7ce(_0xf20479['error'](0x1f4,_0x5462e3[_0x1c5a('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x557f83){var _0x4eb88f=this;return new Promise(function(_0x7682bf,_0x2254e0){return db[_0x1c5a('0x1e')][_0x1c5a('0x22')]({'where':_0x557f83[_0x1c5a('0x16')]?_0x557f83[_0x1c5a('0x16')][_0x1c5a('0x23')]||null:null})[_0x1c5a('0xa')](function(_0x4a16b4){logger[_0x1c5a('0xb')](_0x1c5a('0x24'),_0x557f83);logger[_0x1c5a('0xd')]('DestroyCmHopperBlack',_0x557f83,JSON[_0x1c5a('0xf')](_0x4a16b4));_0x7682bf(_0x4a16b4);})['catch'](function(_0x834784){logger[_0x1c5a('0x10')](_0x1c5a('0x24'),_0x834784['message'],_0x557f83);_0x2254e0(_0x4eb88f[_0x1c5a('0x10')](0x1f4,_0x834784[_0x1c5a('0x12')]));});});}; \ No newline at end of file +var _0xd692=['rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','where','limit','map','include','model','attributes','UpdateCmHopperBlack','CmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xd692,0x188));var _0x2d69=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd692[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x2d69('0x0'));var moment=require(_0x2d69('0x1'));var BPromise=require(_0x2d69('0x2'));var rs=require(_0x2d69('0x3'));var fs=require('fs');var Redis=require(_0x2d69('0x4'));var db=require(_0x2d69('0x5'))['db'];var utils=require(_0x2d69('0x6'));var logger=require(_0x2d69('0x7'))(_0x2d69('0x8'));var config=require(_0x2d69('0x9'));var jayson=require(_0x2d69('0xa'));var client=jayson[_0x2d69('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf982f6,_0x2b0aca,_0x1a20df){return new BPromise(function(_0x1bc88c,_0x289771){return client[_0x2d69('0xc')](_0xf982f6,_0x1a20df)[_0x2d69('0xd')](function(_0x3462dd){logger[_0x2d69('0xe')](_0x2d69('0xf'),_0x2b0aca,_0x2d69('0x10'));logger['debug'](_0x2d69('0x11'),_0x2b0aca,_0x2d69('0x10'),JSON[_0x2d69('0x12')](_0x3462dd));if(_0x3462dd[_0x2d69('0x13')]){if(_0x3462dd['error'][_0x2d69('0x14')]===0x1f4){logger['error'](_0x2d69('0xf'),_0x2b0aca,_0x3462dd[_0x2d69('0x13')][_0x2d69('0x15')]);return _0x289771(_0x3462dd['error'][_0x2d69('0x15')]);}logger[_0x2d69('0x13')](_0x2d69('0xf'),_0x2b0aca,_0x3462dd['error'][_0x2d69('0x15')]);return _0x1bc88c(_0x3462dd[_0x2d69('0x13')]['message']);}else{logger['info'](_0x2d69('0xf'),_0x2b0aca,_0x2d69('0x10'));_0x1bc88c(_0x3462dd[_0x2d69('0x16')][_0x2d69('0x15')]);}})[_0x2d69('0x17')](function(_0x4f74a7){logger[_0x2d69('0x13')](_0x2d69('0xf'),_0x2b0aca,_0x4f74a7);_0x289771(_0x4f74a7);});});}exports[_0x2d69('0x18')]=function(_0x100925){var _0x9f764e=this;return new Promise(function(_0x47edeb,_0x324b9e){return db['CmHopperBlack'][_0x2d69('0x19')]({'raw':_0x100925['options']?_0x100925['options']['raw']===undefined?!![]:![]:!![],'where':_0x100925[_0x2d69('0x1a')]?_0x100925[_0x2d69('0x1a')][_0x2d69('0x1b')]||null:null,'attributes':_0x100925[_0x2d69('0x1a')]?_0x100925[_0x2d69('0x1a')]['attributes']||null:null,'limit':_0x100925['options']?_0x100925['options'][_0x2d69('0x1c')]||null:null,'include':_0x100925['options']?_0x100925[_0x2d69('0x1a')]['include']?_[_0x2d69('0x1d')](_0x100925['options'][_0x2d69('0x1e')],function(_0x2fbc07){return{'model':db[_0x2fbc07[_0x2d69('0x1f')]],'as':_0x2fbc07['as'],'attributes':_0x2fbc07['attributes'],'include':_0x2fbc07['include']?_[_0x2d69('0x1d')](_0x2fbc07[_0x2d69('0x1e')],function(_0x369843){return{'model':db[_0x369843[_0x2d69('0x1f')]],'as':_0x369843['as'],'attributes':_0x369843[_0x2d69('0x20')],'include':_0x369843['include']?_[_0x2d69('0x1d')](_0x369843[_0x2d69('0x1e')],function(_0x4d6457){return{'model':db[_0x4d6457[_0x2d69('0x1f')]],'as':_0x4d6457['as'],'attributes':_0x4d6457[_0x2d69('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d69('0xd')](function(_0x5f31f2){logger[_0x2d69('0xe')](_0x2d69('0x18'),_0x100925);logger['debug']('GetCmHopperBlack',_0x100925,JSON[_0x2d69('0x12')](_0x5f31f2));_0x47edeb(_0x5f31f2);})[_0x2d69('0x17')](function(_0x2c5b37){logger[_0x2d69('0x13')](_0x2d69('0x18'),_0x2c5b37[_0x2d69('0x15')],_0x100925);_0x324b9e(_0x9f764e['error'](0x1f4,_0x2c5b37[_0x2d69('0x15')]));});});};exports[_0x2d69('0x21')]=function(_0x2743bc){var _0x426916=this;return new Promise(function(_0x575453,_0x3fd2bb){return db[_0x2d69('0x22')]['update'](_0x2743bc[_0x2d69('0x23')],{'raw':_0x2743bc[_0x2d69('0x1a')]?_0x2743bc['options'][_0x2d69('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2743bc[_0x2d69('0x1a')]?_0x2743bc[_0x2d69('0x1a')][_0x2d69('0x1b')]||null:null,'attributes':_0x2743bc[_0x2d69('0x1a')]?_0x2743bc['options']['attributes']||null:null,'limit':_0x2743bc[_0x2d69('0x1a')]?_0x2743bc[_0x2d69('0x1a')][_0x2d69('0x1c')]||null:null})['then'](function(_0x16f981){logger[_0x2d69('0xe')](_0x2d69('0x21'),_0x2743bc);logger['debug']('UpdateCmHopperBlack',_0x2743bc,JSON['stringify'](_0x16f981));_0x575453(_0x16f981);})[_0x2d69('0x17')](function(_0x32a88d){logger[_0x2d69('0x13')]('UpdateCmHopperBlack',_0x32a88d[_0x2d69('0x15')],_0x2743bc);_0x3fd2bb(_0x426916[_0x2d69('0x13')](0x1f4,_0x32a88d[_0x2d69('0x15')]));});});};exports[_0x2d69('0x25')]=function(_0x8f1d53){var _0x5bf88e=this;return new Promise(function(_0x50ae59,_0x22db31){return db['CmHopperBlack'][_0x2d69('0x26')]({'where':_0x8f1d53[_0x2d69('0x1a')]?_0x8f1d53['options'][_0x2d69('0x1b')]||null:null})[_0x2d69('0xd')](function(_0x78e172){logger[_0x2d69('0xe')](_0x2d69('0x25'),_0x8f1d53);logger[_0x2d69('0x27')](_0x2d69('0x25'),_0x8f1d53,JSON[_0x2d69('0x12')](_0x78e172));_0x50ae59(_0x78e172);})[_0x2d69('0x17')](function(_0x116d3a){logger[_0x2d69('0x13')](_0x2d69('0x25'),_0x116d3a['message'],_0x8f1d53);_0x22db31(_0x5bf88e[_0x2d69('0x13')](0x1f4,_0x116d3a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5b991c0..350904c 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 _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x5d17,0x114));var _0x75d1=function(_0x761b6d,_0x7c7fa8){_0x761b6d=_0x761b6d-0x0;var _0x3a1639=_0x5d17[_0x761b6d];return _0x3a1639;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6529be3..0b9660d 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 _0x8646=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x8646,0xb5));var _0x6864=function(_0x33f18f,_0x184eb){_0x33f18f=_0x33f18f-0x0;var _0x592236=_0x8646[_0x33f18f];return _0x592236;};'use strict';var Sequelize=require(_0x6864('0x0'));var moment=require(_0x6864('0x1'));module['exports']={'state':{'type':Sequelize[_0x6864('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6864('0x3')]},'scheduledat':{'type':Sequelize[_0x6864('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6864('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6864('0x3')]},'calleridnum':{'type':Sequelize[_0x6864('0x3')]},'calleridname':{'type':Sequelize[_0x6864('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6864('0x4')]},'droptime':{'type':Sequelize[_0x6864('0x4')]},'endtime':{'type':Sequelize[_0x6864('0x4')]},'ringtime':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6864('0x3')]},'campaign':{'type':Sequelize[_0x6864('0x3')]},'campaigntype':{'type':Sequelize[_0x6864('0x3')]},'membername':{'type':Sequelize[_0x6864('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6864('0x3')]},'secondDisposition':{'type':Sequelize[_0x6864('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6864('0x3')]},'dispositionat':{'type':Sequelize[_0x6864('0x4')],'set':function(_0x5e1252){var _0x403599=this[_0x6864('0x5')](_0x6864('0x6'));if(_0x403599&&_0x5e1252){this[_0x6864('0x7')](_0x6864('0x8'),moment(_0x5e1252)[_0x6864('0x9')](moment(_0x403599),_0x6864('0xa')));}}},'amd':{'type':Sequelize[_0x6864('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6864('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6864('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6864('0x4')]},'callback':{'type':Sequelize[_0x6864('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6864('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6864('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6864('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ffb=['getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x529ebb,_0x55bab4){var _0x2bd160=function(_0x1718d6){while(--_0x1718d6){_0x529ebb['push'](_0x529ebb['shift']());}};_0x2bd160(++_0x55bab4);}(_0x0ffb,0x166));var _0xb0ff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ffb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb0ff('0x0'));var moment=require(_0xb0ff('0x1'));module[_0xb0ff('0x2')]={'state':{'type':Sequelize[_0xb0ff('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb0ff('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb0ff('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xb0ff('0x4')]},'originatecalleridname':{'type':Sequelize[_0xb0ff('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb0ff('0x5')]},'answertime':{'type':Sequelize[_0xb0ff('0x5')]},'droptime':{'type':Sequelize[_0xb0ff('0x5')]},'endtime':{'type':Sequelize[_0xb0ff('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb0ff('0x4')]},'campaign':{'type':Sequelize[_0xb0ff('0x4')]},'campaigntype':{'type':Sequelize[_0xb0ff('0x4')]},'membername':{'type':Sequelize[_0xb0ff('0x4')]},'reason':{'type':Sequelize[_0xb0ff('0x4')]},'disposition':{'type':Sequelize[_0xb0ff('0x4')]},'secondDisposition':{'type':Sequelize[_0xb0ff('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x2711f2){var _0x189818=this[_0xb0ff('0x6')](_0xb0ff('0x7'));if(_0x189818&&_0x2711f2){this[_0xb0ff('0x8')](_0xb0ff('0x9'),moment(_0x2711f2)[_0xb0ff('0xa')](moment(_0x189818),_0xb0ff('0xb')));}}},'amd':{'type':Sequelize[_0xb0ff('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb0ff('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb0ff('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb0ff('0x5')]},'callback':{'type':Sequelize[_0xb0ff('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb0ff('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb0ff('0x5')]},'deleted':{'type':Sequelize[_0xb0ff('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb0ff('0x5')]},'recallme':{'type':Sequelize[_0xb0ff('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb0ff('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb0ff('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c5f8fea..10a12db 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(_0x2573fb,_0x1af92e){var _0x58e5eb=function(_0xd2a19f){while(--_0xd2a19f){_0x2573fb['push'](_0x2573fb['shift']());}};_0x58e5eb(++_0x1af92e);}(_0x33af,0xec));var _0xf33a=function(_0x5650d7,_0x51f443){_0x5650d7=_0x5650d7-0x0;var _0x42431d=_0x33af[_0x5650d7];return _0x42431d;};'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 _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x578939,_0x4a6aff){var _0x111887=function(_0x3e6332){while(--_0x3e6332){_0x578939['push'](_0x578939['shift']());}};_0x111887(++_0x4a6aff);}(_0xb016,0x159));var _0x6b01=function(_0x4e8220,_0x447dfa){_0x4e8220=_0x4e8220-0x0;var _0x261c31=_0xb016[_0x4e8220];return _0x261c31;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0f7f82f..eca2e2f 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 _0xd722=['CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x312560,_0x4d2745){var _0x23af13=function(_0x3dc7ea){while(--_0x3dc7ea){_0x312560['push'](_0x312560['shift']());}};_0x23af13(++_0x4d2745);}(_0xd722,0x19b));var _0x2d72=function(_0x34558a,_0x2109cf){_0x34558a=_0x34558a-0x0;var _0x379cdd=_0xd722[_0x34558a];return _0x379cdd;};'use strict';var _=require(_0x2d72('0x0'));var util=require('util');var logger=require(_0x2d72('0x1'))(_0x2d72('0x2'));var moment=require(_0x2d72('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d72('0x5'));var attributes=require(_0x2d72('0x6'));module[_0x2d72('0x7')]=function(_0x2313ac,_0x968915){return _0x2313ac[_0x2d72('0x8')](_0x2d72('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2d72('0xa'),'fields':[_0x2d72('0xa')]},{'name':_0x2d72('0xb'),'fields':[_0x2d72('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x1feca0,_0x71bd03){var _0x2df5e0=function(_0x4231c4){while(--_0x4231c4){_0x1feca0['push'](_0x1feca0['shift']());}};_0x2df5e0(++_0x71bd03);}(_0xff24,0x11a));var _0x4ff2=function(_0x54e176,_0x4bcce7){_0x54e176=_0x54e176-0x0;var _0x4c5de6=_0xff24[_0x54e176];return _0x4c5de6;};'use strict';var _=require(_0x4ff2('0x0'));var util=require(_0x4ff2('0x1'));var logger=require(_0x4ff2('0x2'))('api');var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require(_0x4ff2('0x6'));var rimraf=require(_0x4ff2('0x7'));var config=require(_0x4ff2('0x8'));var attributes=require(_0x4ff2('0x9'));module[_0x4ff2('0xa')]=function(_0xe494a7,_0x17cff3){return _0xe494a7['define'](_0x4ff2('0xb'),attributes,{'tableName':_0x4ff2('0xc'),'paranoid':![],'indexes':[{'name':_0x4ff2('0xd'),'fields':[_0x4ff2('0xd')]},{'name':'uniqueid','fields':[_0x4ff2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d26c0d6..10db82d 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(_0x3667ff,_0x40bf5e){var _0x43c94e=function(_0x7a6772){while(--_0x7a6772){_0x3667ff['push'](_0x3667ff['shift']());}};_0x43c94e(++_0x40bf5e);}(_0xb10b,0x12a));var _0xbb10=function(_0xee9aba,_0x3630d5){_0xee9aba=_0xee9aba-0x0;var _0x558030=_0xb10b[_0xee9aba];return _0x558030;};'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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x521abe,_0x506704){var _0x20f4b7=function(_0x3542aa){while(--_0x3542aa){_0x521abe['push'](_0x521abe['shift']());}};_0x20f4b7(++_0x506704);}(_0x7a54,0x106));var _0x47a5=function(_0x11822b,_0x59b554){_0x11822b=_0x11822b-0x0;var _0x18642c=_0x7a54[_0x11822b];return _0x18642c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 76b5ffb..52d0fdb 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 _0x59ac=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x32c40c,_0x5a48c1){var _0x56e979=function(_0x4ed72a){while(--_0x4ed72a){_0x32c40c['push'](_0x32c40c['shift']());}};_0x56e979(++_0x5a48c1);}(_0x59ac,0x73));var _0xc59a=function(_0x19688b,_0x203425){_0x19688b=_0x19688b-0x0;var _0x29df75=_0x59ac[_0x19688b];return _0x29df75;};'use strict';var multer=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var path=require(_0xc59a('0x2'));var timeout=require(_0xc59a('0x3'));var express=require(_0xc59a('0x4'));var router=express['Router']();var fs_extra=require(_0xc59a('0x5'));var auth=require(_0xc59a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc59a('0x7'));var controller=require(_0xc59a('0x8'));router[_0xc59a('0x9')]('/',auth[_0xc59a('0xa')](),controller[_0xc59a('0xb')]);router['get'](_0xc59a('0xc'),auth['isAuthenticated'](),controller[_0xc59a('0xd')]);router['get'](_0xc59a('0xe'),auth['isAuthenticated'](),controller[_0xc59a('0xf')]);router['get'](_0xc59a('0x10'),auth['isAuthenticated'](),controller[_0xc59a('0x11')]);router['get'](_0xc59a('0x12'),auth[_0xc59a('0xa')](),controller[_0xc59a('0x13')]);router['post'](_0xc59a('0x14'),auth[_0xc59a('0xa')](),controller[_0xc59a('0x15')]);router['post'](_0xc59a('0x16'),auth['isAuthenticated'](),controller[_0xc59a('0x17')]);router[_0xc59a('0x18')](_0xc59a('0x19'),auth[_0xc59a('0xa')](),controller[_0xc59a('0x1a')]);router[_0xc59a('0x1b')](_0xc59a('0xe'),auth[_0xc59a('0xa')](),controller[_0xc59a('0x1c')]);module[_0xc59a('0x1d')]=router; \ No newline at end of file +var _0x7417=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x318d00,_0x1da91f){var _0x3a3a91=function(_0x327532){while(--_0x327532){_0x318d00['push'](_0x318d00['shift']());}};_0x3a3a91(++_0x1da91f);}(_0x7417,0xec));var _0x7741=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7417[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x7741('0x0'));var util=require(_0x7741('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7741('0x2'));var router=express[_0x7741('0x3')]();var fs_extra=require(_0x7741('0x4'));var auth=require(_0x7741('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7741('0x6'));var controller=require(_0x7741('0x7'));router[_0x7741('0x8')]('/',auth[_0x7741('0x9')](),controller[_0x7741('0xa')]);router[_0x7741('0x8')](_0x7741('0xb'),auth[_0x7741('0x9')](),controller[_0x7741('0xc')]);router[_0x7741('0x8')](_0x7741('0xd'),auth[_0x7741('0x9')](),controller[_0x7741('0xe')]);router[_0x7741('0x8')](_0x7741('0xf'),auth[_0x7741('0x9')](),controller[_0x7741('0x10')]);router[_0x7741('0x8')]('/campaign/countAttributes/:id',auth[_0x7741('0x9')](),controller[_0x7741('0x11')]);router[_0x7741('0x12')](_0x7741('0x13'),auth['isAuthenticated'](),controller[_0x7741('0x14')]);router[_0x7741('0x12')](_0x7741('0x15'),auth[_0x7741('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth[_0x7741('0x9')](),controller[_0x7741('0x16')]);router['put'](_0x7741('0xd'),auth[_0x7741('0x9')](),controller[_0x7741('0x17')]);module[_0x7741('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f25a48a..62b9581 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 _0xd477=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x4bdcff,_0x1f4ee6){var _0x31d7ed=function(_0x49261a){while(--_0x49261a){_0x4bdcff['push'](_0x4bdcff['shift']());}};_0x31d7ed(++_0x1f4ee6);}(_0xd477,0xdf));var _0x7d47=function(_0x404deb,_0x700f79){_0x404deb=_0x404deb-0x0;var _0x41b21e=_0xd477[_0x404deb];return _0x41b21e;};'use strict';var Sequelize=require(_0x7d47('0x0'));module[_0x7d47('0x1')]={'state':{'type':Sequelize[_0x7d47('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7d47('0x3')]},'scheduledat':{'type':Sequelize[_0x7d47('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7d47('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7d47('0x3')]},'calleridnum':{'type':Sequelize[_0x7d47('0x3')]},'calleridname':{'type':Sequelize[_0x7d47('0x3')]},'starttime':{'type':Sequelize[_0x7d47('0x4')]},'responsetime':{'type':Sequelize[_0x7d47('0x4')]},'answertime':{'type':Sequelize[_0x7d47('0x4')]},'droptime':{'type':Sequelize[_0x7d47('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7d47('0x3')]},'campaign':{'type':Sequelize[_0x7d47('0x3')]},'campaigntype':{'type':Sequelize[_0x7d47('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7d47('0x3')]},'amd':{'type':Sequelize[_0x7d47('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7d47('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7d47('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d47('0x4')]},'recallme':{'type':Sequelize[_0x7d47('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7d47('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d47('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7d47('0x3')]}}; \ No newline at end of file +var _0xb04a=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0xc4b63,_0x2e1486){var _0x308452=function(_0xebd589){while(--_0xebd589){_0xc4b63['push'](_0xc4b63['shift']());}};_0x308452(++_0x2e1486);}(_0xb04a,0xbb));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xab04('0x0'));module['exports']={'state':{'type':Sequelize[_0xab04('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xab04('0x2')]},'scheduledat':{'type':Sequelize[_0xab04('0x3')]},'countbusyretry':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xab04('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xab04('0x2')]},'originatecalleridname':{'type':Sequelize[_0xab04('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xab04('0x3')]},'answertime':{'type':Sequelize[_0xab04('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xab04('0x3')]},'ringtime':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xab04('0x2')]},'campaign':{'type':Sequelize[_0xab04('0x2')]},'campaigntype':{'type':Sequelize[_0xab04('0x2')]},'membername':{'type':Sequelize[_0xab04('0x2')]},'reason':{'type':Sequelize[_0xab04('0x2')]},'amd':{'type':Sequelize[_0xab04('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xab04('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xab04('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xab04('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xab04('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xab04('0x3')]},'edited':{'type':Sequelize[_0xab04('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xab04('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xab04('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 897f61a..196e658 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 _0xfbf1=['update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','catch','show','include','create','body','describe','uniqueid','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5518dc,_0x2583e8){var _0x33b786=function(_0x3191b6){while(--_0x3191b6){_0x5518dc['push'](_0x5518dc['shift']());}};_0x33b786(++_0x2583e8);}(_0xfbf1,0xc9));var _0x1fbf=function(_0x4587b4,_0x5c419a){_0x4587b4=_0x4587b4-0x0;var _0x36fb63=_0xfbf1[_0x4587b4];return _0x36fb63;};'use strict';var emlformat=require(_0x1fbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fbf('0x1'));var jsonpatch=require(_0x1fbf('0x2'));var rp=require(_0x1fbf('0x3'));var moment=require('moment');var BPromise=require(_0x1fbf('0x4'));var Mustache=require('mustache');var util=require(_0x1fbf('0x5'));var path=require(_0x1fbf('0x6'));var sox=require(_0x1fbf('0x7'));var csv=require(_0x1fbf('0x8'));var ejs=require(_0x1fbf('0x9'));var fs=require('fs');var fs_extra=require(_0x1fbf('0xa'));var _=require(_0x1fbf('0xb'));var squel=require(_0x1fbf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1fbf('0xd'));var toCsv=require(_0x1fbf('0x8'));var querystring=require(_0x1fbf('0xe'));var Papa=require(_0x1fbf('0xf'));var Redis=require('ioredis');var authService=require(_0x1fbf('0x10'));var qs=require(_0x1fbf('0x11'));var as=require(_0x1fbf('0x12'));var hardwareService=require(_0x1fbf('0x13'));var logger=require(_0x1fbf('0x14'))(_0x1fbf('0x15'));var utils=require(_0x1fbf('0x16'));var config=require(_0x1fbf('0x17'));var licenseUtil=require(_0x1fbf('0x18'));var db=require(_0x1fbf('0x19'))['db'];function respondWithStatusCode(_0x3d4149,_0x5c60f0){_0x5c60f0=_0x5c60f0||0xcc;return function(_0x2f4b5c){if(_0x2f4b5c){return _0x3d4149[_0x1fbf('0x1a')](_0x5c60f0);}return _0x3d4149[_0x1fbf('0x1b')](_0x5c60f0)[_0x1fbf('0x1c')]();};}function respondWithResult(_0x5a2d7a,_0x26995e){_0x26995e=_0x26995e||0xc8;return function(_0x14edd9){if(_0x14edd9){return _0x5a2d7a[_0x1fbf('0x1b')](_0x26995e)[_0x1fbf('0x1d')](_0x14edd9);}};}function respondWithFilteredResult(_0x5a5bf9,_0x4903e9){return function(_0x20c3f9){if(_0x20c3f9){var _0x5730ff=typeof _0x4903e9[_0x1fbf('0x1e')]===_0x1fbf('0x1f')&&typeof _0x4903e9[_0x1fbf('0x20')]===_0x1fbf('0x1f');var _0x5857ad=_0x20c3f9['count'];var _0x5e8116=_0x5730ff?0x0:_0x4903e9[_0x1fbf('0x1e')];var _0x24c7d7=_0x5730ff?_0x20c3f9[_0x1fbf('0x21')]:_0x4903e9[_0x1fbf('0x1e')]+_0x4903e9[_0x1fbf('0x20')];var _0x8d3ece;if(_0x24c7d7>=_0x5857ad){_0x24c7d7=_0x5857ad;_0x8d3ece=0xc8;}else{_0x8d3ece=0xce;}_0x5a5bf9[_0x1fbf('0x1b')](_0x8d3ece);return _0x5a5bf9[_0x1fbf('0x22')](_0x1fbf('0x23'),_0x5e8116+'-'+_0x24c7d7+'/'+_0x5857ad)['json'](_0x20c3f9);}return null;};}function patchUpdates(_0x2308d6){return function(_0x13ed5d){try{jsonpatch[_0x1fbf('0x24')](_0x13ed5d,_0x2308d6,!![]);}catch(_0x3c9dd9){return BPromise[_0x1fbf('0x25')](_0x3c9dd9);}return _0x13ed5d[_0x1fbf('0x26')]();};}function saveUpdates(_0x2c82b4,_0xb96a55){return function(_0x1c5b36){if(_0x1c5b36){return _0x1c5b36[_0x1fbf('0x27')](_0x2c82b4)[_0x1fbf('0x28')](function(_0xc68c35){return _0xc68c35;});}return null;};}function removeEntity(_0x4d1e56,_0x1b0d56){return function(_0x134d0b){if(_0x134d0b){return _0x134d0b[_0x1fbf('0x29')]()[_0x1fbf('0x28')](function(){_0x4d1e56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x62854a,_0x389deb){return function(_0x269ca3){if(!_0x269ca3){_0x62854a['sendStatus'](0x194);}return _0x269ca3;};}function handleError(_0x418180,_0x202678){_0x202678=_0x202678||0x1f4;return function(_0x191c02){logger[_0x1fbf('0x2a')](_0x191c02[_0x1fbf('0x2b')]);if(_0x191c02[_0x1fbf('0x2c')]){delete _0x191c02[_0x1fbf('0x2c')];}_0x418180[_0x1fbf('0x1b')](_0x202678)[_0x1fbf('0x2d')](_0x191c02);};}exports['index']=function(_0x20b4df,_0x15656b){var _0x5b4a6e={},_0x42ac3a={},_0x10d8ca={'count':0x0,'rows':[]};var _0xd437d8=_[_0x1fbf('0x2e')](db[_0x1fbf('0x2f')][_0x1fbf('0x30')],function(_0x4e13c2){return{'name':_0x4e13c2[_0x1fbf('0x31')],'type':_0x4e13c2['type'][_0x1fbf('0x32')]};});_0x42ac3a['model']=_[_0x1fbf('0x2e')](_0xd437d8,_0x1fbf('0x2c'));_0x42ac3a['query']=_[_0x1fbf('0x33')](_0x20b4df[_0x1fbf('0x34')]);_0x42ac3a[_0x1fbf('0x35')]=_[_0x1fbf('0x36')](_0x42ac3a[_0x1fbf('0x37')],_0x42ac3a[_0x1fbf('0x34')]);_0x5b4a6e[_0x1fbf('0x38')]=_[_0x1fbf('0x36')](_0x42ac3a[_0x1fbf('0x37')],qs[_0x1fbf('0x39')](_0x20b4df['query'][_0x1fbf('0x39')]));_0x5b4a6e['attributes']=_0x5b4a6e['attributes'][_0x1fbf('0x3a')]?_0x5b4a6e['attributes']:_0x42ac3a[_0x1fbf('0x37')];if(!_0x20b4df[_0x1fbf('0x34')][_0x1fbf('0x3b')](_0x1fbf('0x3c'))){_0x5b4a6e[_0x1fbf('0x20')]=qs[_0x1fbf('0x20')](_0x20b4df[_0x1fbf('0x34')][_0x1fbf('0x20')]);_0x5b4a6e['offset']=qs[_0x1fbf('0x1e')](_0x20b4df[_0x1fbf('0x34')]['offset']);}_0x5b4a6e[_0x1fbf('0x3d')]=qs[_0x1fbf('0x3e')](_0x20b4df[_0x1fbf('0x34')]['sort']);_0x5b4a6e['where']=qs[_0x1fbf('0x35')](_[_0x1fbf('0x3f')](_0x20b4df[_0x1fbf('0x34')],_0x42ac3a[_0x1fbf('0x35')]),_0xd437d8);if(_0x20b4df[_0x1fbf('0x34')]['filter']){_0x5b4a6e[_0x1fbf('0x40')]=_['merge'](_0x5b4a6e[_0x1fbf('0x40')],{'$or':_['map'](_0xd437d8,function(_0x4e51ff){if(_0x4e51ff[_0x1fbf('0x41')]!==_0x1fbf('0x42')){var _0x5ca11b={};_0x5ca11b[_0x4e51ff[_0x1fbf('0x2c')]]={'$like':'%'+_0x20b4df[_0x1fbf('0x34')][_0x1fbf('0x43')]+'%'};return _0x5ca11b;}})});}_0x5b4a6e=_[_0x1fbf('0x44')]({},_0x5b4a6e,_0x20b4df[_0x1fbf('0x45')]);var _0x43413e={'where':_0x5b4a6e[_0x1fbf('0x40')]};return db[_0x1fbf('0x2f')]['count'](_0x43413e)[_0x1fbf('0x28')](function(_0x5ef94b){_0x10d8ca[_0x1fbf('0x21')]=_0x5ef94b;if(_0x20b4df[_0x1fbf('0x34')][_0x1fbf('0x46')]){_0x5b4a6e['include']=[{'all':!![]}];}return db[_0x1fbf('0x2f')]['findAll'](_0x5b4a6e);})[_0x1fbf('0x28')](function(_0x491597){_0x10d8ca['rows']=_0x491597;return _0x10d8ca;})[_0x1fbf('0x28')](respondWithFilteredResult(_0x15656b,_0x5b4a6e))[_0x1fbf('0x47')](handleError(_0x15656b,null));};exports[_0x1fbf('0x48')]=function(_0x101276,_0x199dc4){var _0x4e62f9={'raw':!![],'where':{'id':_0x101276['params']['id']}},_0x30d755={};_0x30d755[_0x1fbf('0x37')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x30d755['query']=_[_0x1fbf('0x33')](_0x101276[_0x1fbf('0x34')]);_0x30d755[_0x1fbf('0x35')]=_[_0x1fbf('0x36')](_0x30d755[_0x1fbf('0x37')],_0x30d755[_0x1fbf('0x34')]);_0x4e62f9[_0x1fbf('0x38')]=_[_0x1fbf('0x36')](_0x30d755[_0x1fbf('0x37')],qs[_0x1fbf('0x39')](_0x101276[_0x1fbf('0x34')]['fields']));_0x4e62f9[_0x1fbf('0x38')]=_0x4e62f9[_0x1fbf('0x38')][_0x1fbf('0x3a')]?_0x4e62f9[_0x1fbf('0x38')]:_0x30d755['model'];if(_0x101276[_0x1fbf('0x34')]['includeAll']){_0x4e62f9[_0x1fbf('0x49')]=[{'all':!![]}];}_0x4e62f9=_[_0x1fbf('0x44')]({},_0x4e62f9,_0x101276[_0x1fbf('0x45')]);return db[_0x1fbf('0x2f')]['find'](_0x4e62f9)[_0x1fbf('0x28')](handleEntityNotFound(_0x199dc4,null))[_0x1fbf('0x28')](respondWithResult(_0x199dc4,null))[_0x1fbf('0x47')](handleError(_0x199dc4,null));};exports[_0x1fbf('0x4a')]=function(_0x228375,_0x57b031){return db[_0x1fbf('0x2f')][_0x1fbf('0x4a')](_0x228375[_0x1fbf('0x4b')],{})[_0x1fbf('0x28')](respondWithResult(_0x57b031,0xc9))[_0x1fbf('0x47')](handleError(_0x57b031,null));};exports[_0x1fbf('0x4c')]=function(_0x529651,_0x3e86b8){return db[_0x1fbf('0x2f')]['describe']()[_0x1fbf('0x28')](respondWithResult(_0x3e86b8,null))['catch'](handleError(_0x3e86b8,null));};exports[_0x1fbf('0x27')]=function(_0x4cca40,_0x118c23){if(_0x4cca40['body'][_0x1fbf('0x4d')]){delete _0x4cca40[_0x1fbf('0x4b')][_0x1fbf('0x4d')];}return db[_0x1fbf('0x2f')][_0x1fbf('0x4e')]({'where':{'uniqueid':_0x4cca40[_0x1fbf('0x4f')]['id']}})['then'](handleEntityNotFound(_0x118c23,null))['then'](saveUpdates(_0x4cca40[_0x1fbf('0x4b')],null))[_0x1fbf('0x28')](respondWithResult(_0x118c23,null))[_0x1fbf('0x47')](handleError(_0x118c23,null));}; \ No newline at end of file +var _0x286f=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','CmHopperHistory','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x572f23,_0x133afd){var _0x5b1c83=function(_0x43e108){while(--_0x43e108){_0x572f23['push'](_0x572f23['shift']());}};_0x5b1c83(++_0x133afd);}(_0x286f,0x1bc));var _0xf286=function(_0x2ed7d7,_0xe61ce2){_0x2ed7d7=_0x2ed7d7-0x0;var _0x155d2d=_0x286f[_0x2ed7d7];return _0x155d2d;};'use strict';var emlformat=require(_0xf286('0x0'));var rimraf=require(_0xf286('0x1'));var zipdir=require(_0xf286('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf286('0x3'));var moment=require('moment');var BPromise=require(_0xf286('0x4'));var Mustache=require(_0xf286('0x5'));var util=require('util');var path=require(_0xf286('0x6'));var sox=require(_0xf286('0x7'));var csv=require(_0xf286('0x8'));var ejs=require(_0xf286('0x9'));var fs=require('fs');var fs_extra=require(_0xf286('0xa'));var _=require(_0xf286('0xb'));var squel=require('squel');var crypto=require(_0xf286('0xc'));var jsforce=require(_0xf286('0xd'));var deskjs=require(_0xf286('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf286('0xf'));var Papa=require(_0xf286('0x10'));var Redis=require(_0xf286('0x11'));var authService=require(_0xf286('0x12'));var qs=require(_0xf286('0x13'));var as=require(_0xf286('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf286('0x15'))(_0xf286('0x16'));var utils=require('../../config/utils');var config=require(_0xf286('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf286('0x18'))['db'];function respondWithStatusCode(_0xbc7081,_0x62fd56){_0x62fd56=_0x62fd56||0xcc;return function(_0x54bb7c){if(_0x54bb7c){return _0xbc7081[_0xf286('0x19')](_0x62fd56);}return _0xbc7081[_0xf286('0x1a')](_0x62fd56)[_0xf286('0x1b')]();};}function respondWithResult(_0x1eacbe,_0x3eb80c){_0x3eb80c=_0x3eb80c||0xc8;return function(_0x24304e){if(_0x24304e){return _0x1eacbe[_0xf286('0x1a')](_0x3eb80c)[_0xf286('0x1c')](_0x24304e);}};}function respondWithFilteredResult(_0x21bb1b,_0x5f1f09){return function(_0x195e6f){if(_0x195e6f){var _0x185bd5=typeof _0x5f1f09[_0xf286('0x1d')]===_0xf286('0x1e')&&typeof _0x5f1f09[_0xf286('0x1f')]===_0xf286('0x1e');var _0x1d2ca3=_0x195e6f[_0xf286('0x20')];var _0x1107fb=_0x185bd5?0x0:_0x5f1f09[_0xf286('0x1d')];var _0x3d4bb1=_0x185bd5?_0x195e6f[_0xf286('0x20')]:_0x5f1f09[_0xf286('0x1d')]+_0x5f1f09[_0xf286('0x1f')];var _0x2dee61;if(_0x3d4bb1>=_0x1d2ca3){_0x3d4bb1=_0x1d2ca3;_0x2dee61=0xc8;}else{_0x2dee61=0xce;}_0x21bb1b[_0xf286('0x1a')](_0x2dee61);return _0x21bb1b[_0xf286('0x21')](_0xf286('0x22'),_0x1107fb+'-'+_0x3d4bb1+'/'+_0x1d2ca3)[_0xf286('0x1c')](_0x195e6f);}return null;};}function patchUpdates(_0x3501ca){return function(_0x29f596){try{jsonpatch[_0xf286('0x23')](_0x29f596,_0x3501ca,!![]);}catch(_0x3762e3){return BPromise['reject'](_0x3762e3);}return _0x29f596['save']();};}function saveUpdates(_0x354716,_0x2d67e2){return function(_0x37bb44){if(_0x37bb44){return _0x37bb44[_0xf286('0x24')](_0x354716)[_0xf286('0x25')](function(_0x13a66f){return _0x13a66f;});}return null;};}function removeEntity(_0x3f11f7,_0x36714b){return function(_0x40efef){if(_0x40efef){return _0x40efef[_0xf286('0x26')]()[_0xf286('0x25')](function(){_0x3f11f7['status'](0xcc)[_0xf286('0x1b')]();});}};}function handleEntityNotFound(_0x3d13c3,_0x3bf5c2){return function(_0x312aef){if(!_0x312aef){_0x3d13c3[_0xf286('0x19')](0x194);}return _0x312aef;};}function handleError(_0x94c1c0,_0x1d4046){_0x1d4046=_0x1d4046||0x1f4;return function(_0x24a7a0){logger[_0xf286('0x27')](_0x24a7a0[_0xf286('0x28')]);if(_0x24a7a0['name']){delete _0x24a7a0[_0xf286('0x29')];}_0x94c1c0['status'](_0x1d4046)[_0xf286('0x2a')](_0x24a7a0);};}exports[_0xf286('0x2b')]=function(_0x4e0f4f,_0x16c737){var _0x5a871b={},_0x307e33={},_0x47f85a={'count':0x0,'rows':[]};var _0x4033d8=_['map'](db[_0xf286('0x2c')]['rawAttributes'],function(_0x505c6d){return{'name':_0x505c6d[_0xf286('0x2d')],'type':_0x505c6d[_0xf286('0x2e')]['key']};});_0x307e33[_0xf286('0x2f')]=_[_0xf286('0x30')](_0x4033d8,_0xf286('0x29'));_0x307e33[_0xf286('0x31')]=_[_0xf286('0x32')](_0x4e0f4f[_0xf286('0x31')]);_0x307e33[_0xf286('0x33')]=_[_0xf286('0x34')](_0x307e33[_0xf286('0x2f')],_0x307e33['query']);_0x5a871b[_0xf286('0x35')]=_['intersection'](_0x307e33['model'],qs[_0xf286('0x36')](_0x4e0f4f[_0xf286('0x31')]['fields']));_0x5a871b['attributes']=_0x5a871b[_0xf286('0x35')][_0xf286('0x37')]?_0x5a871b[_0xf286('0x35')]:_0x307e33[_0xf286('0x2f')];if(!_0x4e0f4f[_0xf286('0x31')][_0xf286('0x38')](_0xf286('0x39'))){_0x5a871b[_0xf286('0x1f')]=qs['limit'](_0x4e0f4f[_0xf286('0x31')]['limit']);_0x5a871b['offset']=qs[_0xf286('0x1d')](_0x4e0f4f[_0xf286('0x31')][_0xf286('0x1d')]);}_0x5a871b['order']=qs['sort'](_0x4e0f4f['query'][_0xf286('0x3a')]);_0x5a871b[_0xf286('0x3b')]=qs[_0xf286('0x33')](_[_0xf286('0x3c')](_0x4e0f4f[_0xf286('0x31')],_0x307e33[_0xf286('0x33')]),_0x4033d8);if(_0x4e0f4f['query'][_0xf286('0x3d')]){_0x5a871b[_0xf286('0x3b')]=_[_0xf286('0x3e')](_0x5a871b['where'],{'$or':_[_0xf286('0x30')](_0x4033d8,function(_0x1921e2){if(_0x1921e2['type']!==_0xf286('0x3f')){var _0x31a1ed={};_0x31a1ed[_0x1921e2['name']]={'$like':'%'+_0x4e0f4f['query'][_0xf286('0x3d')]+'%'};return _0x31a1ed;}})});}_0x5a871b=_['merge']({},_0x5a871b,_0x4e0f4f[_0xf286('0x40')]);var _0x23837f={'where':_0x5a871b[_0xf286('0x3b')]};return db[_0xf286('0x2c')][_0xf286('0x20')](_0x23837f)['then'](function(_0x189899){_0x47f85a['count']=_0x189899;if(_0x4e0f4f['query'][_0xf286('0x41')]){_0x5a871b['include']=[{'all':!![]}];}return db[_0xf286('0x2c')][_0xf286('0x42')](_0x5a871b);})[_0xf286('0x25')](function(_0x7c384e){_0x47f85a[_0xf286('0x43')]=_0x7c384e;return _0x47f85a;})['then'](respondWithFilteredResult(_0x16c737,_0x5a871b))[_0xf286('0x44')](handleError(_0x16c737,null));};exports[_0xf286('0x45')]=function(_0x201964,_0x14a434){var _0xeb3070={'raw':!![],'where':{'id':_0x201964[_0xf286('0x46')]['id']}},_0x4cc42e={};_0x4cc42e[_0xf286('0x2f')]=_[_0xf286('0x32')](db[_0xf286('0x2c')][_0xf286('0x47')]);_0x4cc42e[_0xf286('0x31')]=_[_0xf286('0x32')](_0x201964[_0xf286('0x31')]);_0x4cc42e['filters']=_[_0xf286('0x34')](_0x4cc42e[_0xf286('0x2f')],_0x4cc42e[_0xf286('0x31')]);_0xeb3070[_0xf286('0x35')]=_['intersection'](_0x4cc42e[_0xf286('0x2f')],qs[_0xf286('0x36')](_0x201964[_0xf286('0x31')]['fields']));_0xeb3070[_0xf286('0x35')]=_0xeb3070['attributes'][_0xf286('0x37')]?_0xeb3070[_0xf286('0x35')]:_0x4cc42e[_0xf286('0x2f')];if(_0x201964['query'][_0xf286('0x41')]){_0xeb3070['include']=[{'all':!![]}];}_0xeb3070=_[_0xf286('0x3e')]({},_0xeb3070,_0x201964[_0xf286('0x40')]);return db[_0xf286('0x2c')]['find'](_0xeb3070)[_0xf286('0x25')](handleEntityNotFound(_0x14a434,null))[_0xf286('0x25')](respondWithResult(_0x14a434,null))[_0xf286('0x44')](handleError(_0x14a434,null));};exports['create']=function(_0x435786,_0x48ebd3){return db['CmHopperHistory']['create'](_0x435786['body'],{})[_0xf286('0x25')](respondWithResult(_0x48ebd3,0xc9))['catch'](handleError(_0x48ebd3,null));};exports['describe']=function(_0x57b9d2,_0x2ac967){return db[_0xf286('0x2c')][_0xf286('0x48')]()[_0xf286('0x25')](respondWithResult(_0x2ac967,null))[_0xf286('0x44')](handleError(_0x2ac967,null));};exports['update']=function(_0x34e975,_0x5c0e50){if(_0x34e975[_0xf286('0x49')][_0xf286('0x4a')]){delete _0x34e975['body'][_0xf286('0x4a')];}return db[_0xf286('0x2c')][_0xf286('0x4b')]({'where':{'uniqueid':_0x34e975[_0xf286('0x46')]['id']}})[_0xf286('0x25')](handleEntityNotFound(_0x5c0e50,null))[_0xf286('0x25')](saveUpdates(_0x34e975[_0xf286('0x49')],null))[_0xf286('0x25')](respondWithResult(_0x5c0e50,null))['catch'](handleError(_0x5c0e50,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 82c5d33..2a1e26f 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 _0x6365=['../../config/environment','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x27053f,_0x563ff5){var _0x20ad84=function(_0x3610bb){while(--_0x3610bb){_0x27053f['push'](_0x27053f['shift']());}};_0x20ad84(++_0x563ff5);}(_0x6365,0x148));var _0x5636=function(_0xfb3e23,_0x536c9c){_0xfb3e23=_0xfb3e23-0x0;var _0x35bd65=_0x6365[_0xfb3e23];return _0x35bd65;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var logger=require(_0x5636('0x2'))(_0x5636('0x3'));var moment=require('moment');var BPromise=require(_0x5636('0x4'));var rp=require(_0x5636('0x5'));var fs=require('fs');var path=require(_0x5636('0x6'));var rimraf=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x5636('0x9')]=function(_0x230d78,_0x2a12df){return _0x230d78[_0x5636('0xa')]('CmHopperHistory',attributes,{'tableName':_0x5636('0xb'),'paranoid':![],'indexes':[{'name':_0x5636('0xc'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x5636('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9fc=['request-promise','rimraf','../../config/environment','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9fc,0x19f));var _0xca9f=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xa9fc[_0x5c72ee];return _0x231876;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var logger=require(_0xca9f('0x2'))(_0xca9f('0x3'));var moment=require(_0xca9f('0x4'));var BPromise=require('bluebird');var rp=require(_0xca9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5c7268,_0x234d90){return _0x5c7268['define'](_0xca9f('0x8'),attributes,{'tableName':_0xca9f('0x9'),'paranoid':![],'indexes':[{'name':_0xca9f('0xa'),'fields':[_0xca9f('0xa')]},{'name':_0xca9f('0xb'),'fields':[_0xca9f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9e2e596..7d38193 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 _0x6719=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x38ab3c,_0x52e1b4){var _0x1aa181=function(_0x5c175b){while(--_0x5c175b){_0x38ab3c['push'](_0x38ab3c['shift']());}};_0x1aa181(++_0x52e1b4);}(_0x6719,0xf6));var _0x9671=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x6719[_0x30b159];return _0x23c3f9;};'use strict';var _=require(_0x9671('0x0'));var util=require(_0x9671('0x1'));var moment=require(_0x9671('0x2'));var BPromise=require(_0x9671('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9671('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9671('0x5'))(_0x9671('0x6'));var config=require(_0x9671('0x7'));var jayson=require(_0x9671('0x8'));var client=jayson[_0x9671('0x9')][_0x9671('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3674c2,_0x57bb95,_0x14ef8c){return new BPromise(function(_0x9054ed,_0x5388d3){return client[_0x9671('0xb')](_0x3674c2,_0x14ef8c)['then'](function(_0x3c2c0c){logger[_0x9671('0xc')](_0x9671('0xd'),_0x57bb95,_0x9671('0xe'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x57bb95,'request\x20sent',JSON[_0x9671('0xf')](_0x3c2c0c));if(_0x3c2c0c[_0x9671('0x10')]){if(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x11')]===0x1f4){logger[_0x9671('0x10')](_0x9671('0xd'),_0x57bb95,_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);return _0x5388d3(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);}logger[_0x9671('0x10')](_0x9671('0xd'),_0x57bb95,_0x3c2c0c[_0x9671('0x10')]['message']);return _0x9054ed(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);}else{logger[_0x9671('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x57bb95,_0x9671('0xe'));_0x9054ed(_0x3c2c0c[_0x9671('0x13')][_0x9671('0x12')]);}})[_0x9671('0x14')](function(_0x3dbf37){logger[_0x9671('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x57bb95,_0x3dbf37);_0x5388d3(_0x3dbf37);});});}exports[_0x9671('0x15')]=function(_0x41b6f2){var _0x397fa6=this;return new Promise(function(_0x56c5fc,_0x18ae27){return db[_0x9671('0x16')][_0x9671('0x17')](_0x41b6f2[_0x9671('0x18')],{'raw':_0x41b6f2[_0x9671('0x19')]?_0x41b6f2[_0x9671('0x19')][_0x9671('0x1a')]===undefined?!![]:![]:!![]})[_0x9671('0x1b')](function(_0xeb8683){logger[_0x9671('0xc')](_0x9671('0x15'),_0x41b6f2);logger[_0x9671('0x1c')](_0x9671('0x15'),_0x41b6f2,JSON[_0x9671('0xf')](_0xeb8683));_0x56c5fc(_0xeb8683);})[_0x9671('0x14')](function(_0x48eb4a){logger['error'](_0x9671('0x15'),_0x48eb4a[_0x9671('0x12')],_0x41b6f2);_0x18ae27(_0x397fa6[_0x9671('0x10')](0x1f4,_0x48eb4a[_0x9671('0x12')]));});});};exports[_0x9671('0x1d')]=function(_0x17cd43){var _0x31fab8=this;return new Promise(function(_0x4ab440,_0x4c4ebd){return db[_0x9671('0x16')][_0x9671('0x1e')]({'raw':_0x17cd43['options']?_0x17cd43[_0x9671('0x19')][_0x9671('0x1a')]===undefined?!![]:![]:!![],'where':_0x17cd43[_0x9671('0x19')]?_0x17cd43[_0x9671('0x19')][_0x9671('0x1f')]||null:null,'attributes':[[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db['sequelize'][_0x9671('0x22')]('id')),_0x9671('0x23')],[db['sequelize']['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x25')))),_0x9671('0x26')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')]['literal'](_0x9671('0x27')))),_0x9671('0x28')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x29')))),_0x9671('0x2a')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0x9671('0x24')](_0x9671('0x2b')))),_0x9671('0x2c')],[db[_0x9671('0x20')]['fn'](_0x9671('0x2d'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x2e')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x5c312e){logger[_0x9671('0xc')](_0x9671('0x1d'),_0x17cd43);logger['debug'](_0x9671('0x1d'),_0x17cd43,JSON[_0x9671('0xf')](_0x5c312e));_0x4ab440(_0x5c312e);})[_0x9671('0x14')](function(_0x527d37){logger[_0x9671('0x10')](_0x9671('0x1d'),_0x527d37['message'],_0x17cd43);_0x4c4ebd(_0x31fab8['error'](0x1f4,_0x527d37[_0x9671('0x12')]));});});};exports[_0x9671('0x2f')]=function(_0x5da139){var _0x42408e=this;return new Promise(function(_0x35fbb9,_0x36663b){return db[_0x9671('0x16')][_0x9671('0x1e')]({'raw':_0x5da139['options']?_0x5da139[_0x9671('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5da139[_0x9671('0x19')]?_0x5da139[_0x9671('0x19')][_0x9671('0x1f')]||null:null,'attributes':[[_0x9671('0x30'),'name'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x9671('0x31')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x32')))),_0x9671('0x33')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x9671('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x9671('0x34')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db['sequelize']['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x9671('0x35')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')]['literal'](_0x9671('0x36')))),_0x9671('0x37')],[db[_0x9671('0x20')]['fn']('COUNT',db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x38')))),_0x9671('0x39')],[db['sequelize']['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x3a')))),_0x9671('0x3b')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')]['literal'](_0x9671('0x3c')))),_0x9671('0x3d')],[db['sequelize']['fn'](_0x9671('0x21'),db['sequelize']['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x3e')))),_0x9671('0x3f')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db['sequelize']['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')](_0x9671('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0x9671('0x41')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x9671('0x42')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')][_0x9671('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['fn']('IF',db['sequelize'][_0x9671('0x24')](_0x9671('0x43')))),'outboundReCallsDay']],'group':[_0x9671('0x30')]})[_0x9671('0x1b')](function(_0xab787a){logger[_0x9671('0xc')]('GetVoiceQueueHopperHistory',_0x5da139);logger[_0x9671('0x1c')](_0x9671('0x2f'),_0x5da139,JSON['stringify'](_0xab787a));_0x35fbb9(_0xab787a);})['catch'](function(_0x377856){logger[_0x9671('0x10')](_0x9671('0x2f'),_0x377856[_0x9671('0x12')],_0x5da139);_0x36663b(_0x42408e[_0x9671('0x10')](0x1f4,_0x377856[_0x9671('0x12')]));});});};exports[_0x9671('0x44')]=function(_0x3ced3c){var _0x290a69=this;return new Promise(function(_0x23f258,_0x3fb681){return db[_0x9671('0x16')][_0x9671('0x1e')]({'raw':_0x3ced3c[_0x9671('0x19')]?_0x3ced3c[_0x9671('0x19')][_0x9671('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ced3c[_0x9671('0x19')]?_0x3ced3c['options'][_0x9671('0x1f')]||null:null,'attributes':[['campaign',_0x9671('0x45')],[db[_0x9671('0x20')]['fn'](_0x9671('0x21'),db[_0x9671('0x20')]['col']('id')),_0x9671('0x46')],[db['sequelize']['fn']('COUNT',db[_0x9671('0x20')]['fn']('IF',db[_0x9671('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x9671('0x1b')](function(_0x113644){logger[_0x9671('0xc')]('GetCampaignHopperHistory',_0x3ced3c);logger[_0x9671('0x1c')](_0x9671('0x44'),_0x3ced3c,JSON['stringify'](_0x113644));_0x23f258(_0x113644);})[_0x9671('0x14')](function(_0x339a7f){logger[_0x9671('0x10')](_0x9671('0x44'),_0x339a7f[_0x9671('0x12')],_0x3ced3c);_0x3fb681(_0x290a69[_0x9671('0x10')](0x1f4,_0x339a7f['message']));});});}; \ No newline at end of file +var _0x7eee=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','CmHopperHistory','create','options','CreateCmHopperHistory','catch','AvgHandleTime','findAll','raw','where','col','predictiveIntervalTotalCalls','sequelize','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','util'];(function(_0x1dbf1b,_0x10f094){var _0x59808e=function(_0x53c810){while(--_0x53c810){_0x1dbf1b['push'](_0x1dbf1b['shift']());}};_0x59808e(++_0x10f094);}(_0x7eee,0x1bb));var _0xe7ee=function(_0x2b818a,_0x438cea){_0x2b818a=_0x2b818a-0x0;var _0x482c58=_0x7eee[_0x2b818a];return _0x482c58;};'use strict';var _=require('lodash');var util=require(_0xe7ee('0x0'));var moment=require('moment');var BPromise=require(_0xe7ee('0x1'));var rs=require(_0xe7ee('0x2'));var fs=require('fs');var Redis=require(_0xe7ee('0x3'));var db=require(_0xe7ee('0x4'))['db'];var utils=require(_0xe7ee('0x5'));var logger=require(_0xe7ee('0x6'))(_0xe7ee('0x7'));var config=require(_0xe7ee('0x8'));var jayson=require(_0xe7ee('0x9'));var client=jayson[_0xe7ee('0xa')][_0xe7ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x136dac,_0x55ac0f,_0x2d01ce){return new BPromise(function(_0x3cbf19,_0x2ea5be){return client[_0xe7ee('0xc')](_0x136dac,_0x2d01ce)[_0xe7ee('0xd')](function(_0x535342){logger['info'](_0xe7ee('0xe'),_0x55ac0f,'request\x20sent');logger[_0xe7ee('0xf')](_0xe7ee('0x10'),_0x55ac0f,'request\x20sent',JSON[_0xe7ee('0x11')](_0x535342));if(_0x535342[_0xe7ee('0x12')]){if(_0x535342[_0xe7ee('0x12')][_0xe7ee('0x13')]===0x1f4){logger[_0xe7ee('0x12')](_0xe7ee('0xe'),_0x55ac0f,_0x535342[_0xe7ee('0x12')][_0xe7ee('0x14')]);return _0x2ea5be(_0x535342[_0xe7ee('0x12')]['message']);}logger[_0xe7ee('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x55ac0f,_0x535342[_0xe7ee('0x12')]['message']);return _0x3cbf19(_0x535342[_0xe7ee('0x12')]['message']);}else{logger[_0xe7ee('0x15')](_0xe7ee('0xe'),_0x55ac0f,_0xe7ee('0x16'));_0x3cbf19(_0x535342[_0xe7ee('0x17')][_0xe7ee('0x14')]);}})['catch'](function(_0x57df4b){logger['error'](_0xe7ee('0xe'),_0x55ac0f,_0x57df4b);_0x2ea5be(_0x57df4b);});});}exports['CreateCmHopperHistory']=function(_0x45e23b){var _0x4c99ae=this;return new Promise(function(_0x40bf9a,_0x382450){return db[_0xe7ee('0x18')][_0xe7ee('0x19')](_0x45e23b['body'],{'raw':_0x45e23b['options']?_0x45e23b[_0xe7ee('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe7ee('0xd')](function(_0x2e2030){logger[_0xe7ee('0x15')]('CreateCmHopperHistory',_0x45e23b);logger[_0xe7ee('0xf')](_0xe7ee('0x1b'),_0x45e23b,JSON[_0xe7ee('0x11')](_0x2e2030));_0x40bf9a(_0x2e2030);})[_0xe7ee('0x1c')](function(_0x179df4){logger['error'](_0xe7ee('0x1b'),_0x179df4[_0xe7ee('0x14')],_0x45e23b);_0x382450(_0x4c99ae[_0xe7ee('0x12')](0x1f4,_0x179df4[_0xe7ee('0x14')]));});});};exports[_0xe7ee('0x1d')]=function(_0x141942){var _0x53605a=this;return new Promise(function(_0x2f1471,_0x241c09){return db[_0xe7ee('0x18')][_0xe7ee('0x1e')]({'raw':_0x141942[_0xe7ee('0x1a')]?_0x141942[_0xe7ee('0x1a')][_0xe7ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x141942['options']?_0x141942['options'][_0xe7ee('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0xe7ee('0x21')]('id')),_0xe7ee('0x22')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xe7ee('0x26')],[db[_0xe7ee('0x23')]['fn']('COUNT',db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x27')))),_0xe7ee('0x28')],[db['sequelize']['fn'](_0xe7ee('0x29'),db[_0xe7ee('0x23')]['fn']('IF',db['sequelize'][_0xe7ee('0x25')](_0xe7ee('0x2a')))),_0xe7ee('0x2b')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x29'),db['sequelize']['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x2c')))),'predictiveIntervalAvgTalktime']]})[_0xe7ee('0xd')](function(_0x1c498d){logger[_0xe7ee('0x15')](_0xe7ee('0x1d'),_0x141942);logger[_0xe7ee('0xf')]('AvgHandleTime',_0x141942,JSON[_0xe7ee('0x11')](_0x1c498d));_0x2f1471(_0x1c498d);})[_0xe7ee('0x1c')](function(_0x23a504){logger[_0xe7ee('0x12')](_0xe7ee('0x1d'),_0x23a504[_0xe7ee('0x14')],_0x141942);_0x241c09(_0x53605a[_0xe7ee('0x12')](0x1f4,_0x23a504[_0xe7ee('0x14')]));});});};exports[_0xe7ee('0x2d')]=function(_0x16bbc5){var _0x438f89=this;return new Promise(function(_0x48f56e,_0x2f7e44){return db['CmHopperHistory'][_0xe7ee('0x1e')]({'raw':_0x16bbc5[_0xe7ee('0x1a')]?_0x16bbc5[_0xe7ee('0x1a')][_0xe7ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x16bbc5[_0xe7ee('0x1a')]?_0x16bbc5[_0xe7ee('0x1a')][_0xe7ee('0x20')]||null:null,'attributes':[[_0xe7ee('0x2e'),_0xe7ee('0x2f')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x30')))),'outboundNoSuchCallsDay'],[db[_0xe7ee('0x23')]['fn']('COUNT',db[_0xe7ee('0x23')]['fn']('IF',db['sequelize'][_0xe7ee('0x25')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x31')))),_0xe7ee('0x32')],[db[_0xe7ee('0x23')]['fn']('COUNT',db[_0xe7ee('0x23')]['fn']('IF',db['sequelize'][_0xe7ee('0x25')](_0xe7ee('0x33')))),_0xe7ee('0x34')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x35')))),_0xe7ee('0x36')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x37')))),_0xe7ee('0x38')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')]['literal'](_0xe7ee('0x39')))),_0xe7ee('0x3a')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x3b')))),_0xe7ee('0x3c')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x3d')))),_0xe7ee('0x3e')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x3f')))),_0xe7ee('0x40')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x41')))),_0xe7ee('0x42')],[db['sequelize']['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')]['literal'](_0xe7ee('0x43')))),_0xe7ee('0x44')],[db[_0xe7ee('0x23')]['fn']('COUNT',db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')](_0xe7ee('0x45')))),_0xe7ee('0x42')],[db['sequelize']['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')]['literal'](_0xe7ee('0x46')))),_0xe7ee('0x47')]],'group':[_0xe7ee('0x2e')]})[_0xe7ee('0xd')](function(_0xd0e921){logger[_0xe7ee('0x15')]('GetVoiceQueueHopperHistory',_0x16bbc5);logger['debug'](_0xe7ee('0x2d'),_0x16bbc5,JSON['stringify'](_0xd0e921));_0x48f56e(_0xd0e921);})[_0xe7ee('0x1c')](function(_0x3be415){logger['error'](_0xe7ee('0x2d'),_0x3be415[_0xe7ee('0x14')],_0x16bbc5);_0x2f7e44(_0x438f89[_0xe7ee('0x12')](0x1f4,_0x3be415[_0xe7ee('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x33bb9e){var _0x4117f5=this;return new Promise(function(_0x330406,_0x1b9aa8){return db['CmHopperHistory']['findAll']({'raw':_0x33bb9e[_0xe7ee('0x1a')]?_0x33bb9e[_0xe7ee('0x1a')][_0xe7ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x33bb9e[_0xe7ee('0x1a')]?_0x33bb9e['options'][_0xe7ee('0x20')]||null:null,'attributes':[['campaign',_0xe7ee('0x2f')],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db[_0xe7ee('0x23')]['fn'](_0xe7ee('0x24'),db[_0xe7ee('0x23')]['fn']('IF',db[_0xe7ee('0x23')][_0xe7ee('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xe7ee('0x48')]],'group':[_0xe7ee('0x2e')]})[_0xe7ee('0xd')](function(_0x25310e){logger[_0xe7ee('0x15')](_0xe7ee('0x49'),_0x33bb9e);logger['debug']('GetCampaignHopperHistory',_0x33bb9e,JSON[_0xe7ee('0x11')](_0x25310e));_0x330406(_0x25310e);})['catch'](function(_0x2ca6fc){logger['error'](_0xe7ee('0x49'),_0x2ca6fc[_0xe7ee('0x14')],_0x33bb9e);_0x1b9aa8(_0x4117f5['error'](0x1f4,_0x2ca6fc[_0xe7ee('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5d617cf..3df5c19 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 _0x552c=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x17a2cd,_0x39302b){var _0x4a5405=function(_0x1ae449){while(--_0x1ae449){_0x17a2cd['push'](_0x17a2cd['shift']());}};_0x4a5405(++_0x39302b);}(_0x552c,0x187));var _0xc552=function(_0x584da3,_0x388a44){_0x584da3=_0x584da3-0x0;var _0x37aeb9=_0x552c[_0x584da3];return _0x37aeb9;};'use strict';var multer=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var path=require(_0xc552('0x2'));var timeout=require(_0xc552('0x3'));var express=require(_0xc552('0x4'));var router=express[_0xc552('0x5')]();var fs_extra=require(_0xc552('0x6'));var auth=require(_0xc552('0x7'));var interaction=require(_0xc552('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xc552('0x9')]('/',auth[_0xc552('0xa')](),controller[_0xc552('0xb')]);router[_0xc552('0x9')](_0xc552('0xc'),auth[_0xc552('0xa')](),controller[_0xc552('0xd')]);router[_0xc552('0x9')](_0xc552('0xe'),auth[_0xc552('0xa')](),controller['show']);router[_0xc552('0xf')]('/',auth['isAuthenticated'](),controller[_0xc552('0x10')]);router[_0xc552('0x11')]('/:id',auth[_0xc552('0xa')](),controller[_0xc552('0x12')]);module[_0xc552('0x13')]=router; \ No newline at end of file +var _0x9c1e=['update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','create'];(function(_0x3438ae,_0x165521){var _0x10a768=function(_0x468999){while(--_0x468999){_0x3438ae['push'](_0x3438ae['shift']());}};_0x10a768(++_0x165521);}(_0x9c1e,0x178));var _0xe9c1=function(_0xb14a3a,_0x5486cd){_0xb14a3a=_0xb14a3a-0x0;var _0x44d804=_0x9c1e[_0xb14a3a];return _0x44d804;};'use strict';var multer=require(_0xe9c1('0x0'));var util=require('util');var path=require(_0xe9c1('0x1'));var timeout=require(_0xe9c1('0x2'));var express=require(_0xe9c1('0x3'));var router=express[_0xe9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe9c1('0x5'));var config=require(_0xe9c1('0x6'));var controller=require(_0xe9c1('0x7'));router[_0xe9c1('0x8')]('/',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xa')]);router[_0xe9c1('0x8')](_0xe9c1('0xb'),auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xc')]);router[_0xe9c1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe9c1('0xd')]('/',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xe')]);router['put']('/:id',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xf')]);module[_0xe9c1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c696267..8e3628d 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 _0xac21=['STRING','exports'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xac21,0x1af));var _0x1ac2=function(_0x3048e3,_0x34ffc3){_0x3048e3=_0x3048e3-0x0;var _0x4e252a=_0xac21[_0x3048e3];return _0x4e252a;};'use strict';var Sequelize=require('sequelize');module[_0x1ac2('0x0')]={'name':{'type':Sequelize[_0x1ac2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ac2('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdab2=['sequelize','exports','name','STRING'];(function(_0x19468a,_0x4216bb){var _0x55d9f0=function(_0x5a0493){while(--_0x5a0493){_0x19468a['push'](_0x19468a['shift']());}};_0x55d9f0(++_0x4216bb);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));module[_0x2dab('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2dab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2dab('0x3')]},'dialPrefix':{'type':Sequelize[_0x2dab('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cf33881..db2ebb8 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 _0xe57d=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','CmList','includeAll','findAll','rows','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Lists','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','switch','defaultValue','queryInterface','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe57d,0x127));var _0xde57=function(_0x427e9d,_0x6a2c98){_0x427e9d=_0x427e9d-0x0;var _0x4fc009=_0xe57d[_0x427e9d];return _0x4fc009;};'use strict';var emlformat=require(_0xde57('0x0'));var rimraf=require(_0xde57('0x1'));var zipdir=require(_0xde57('0x2'));var jsonpatch=require(_0xde57('0x3'));var rp=require('request-promise');var moment=require(_0xde57('0x4'));var BPromise=require(_0xde57('0x5'));var Mustache=require(_0xde57('0x6'));var util=require(_0xde57('0x7'));var path=require(_0xde57('0x8'));var sox=require(_0xde57('0x9'));var csv=require(_0xde57('0xa'));var ejs=require(_0xde57('0xb'));var fs=require('fs');var fs_extra=require(_0xde57('0xc'));var _=require(_0xde57('0xd'));var squel=require(_0xde57('0xe'));var crypto=require(_0xde57('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xde57('0x10'));var toCsv=require(_0xde57('0xa'));var querystring=require(_0xde57('0x11'));var Papa=require(_0xde57('0x12'));var Redis=require(_0xde57('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xde57('0x14'));var as=require(_0xde57('0x15'));var hardwareService=require(_0xde57('0x16'));var logger=require('../../config/logger')(_0xde57('0x17'));var utils=require(_0xde57('0x18'));var config=require(_0xde57('0x19'));var licenseUtil=require(_0xde57('0x1a'));var db=require(_0xde57('0x1b'))['db'];var csv_results;config[_0xde57('0x1c')]=_[_0xde57('0x1d')](config[_0xde57('0x1c')],{'host':_0xde57('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde57('0x1c')]));require(_0xde57('0x1f'))['register'](socket);function respondWithStatusCode(_0x47e518,_0x504e6f){_0x504e6f=_0x504e6f||0xcc;return function(_0x24aabe){if(_0x24aabe){return _0x47e518[_0xde57('0x20')](_0x504e6f);}return _0x47e518[_0xde57('0x21')](_0x504e6f)[_0xde57('0x22')]();};}function respondWithResult(_0x14e401,_0x38620c){_0x38620c=_0x38620c||0xc8;return function(_0x28a255){if(_0x28a255){return _0x14e401[_0xde57('0x21')](_0x38620c)[_0xde57('0x23')](_0x28a255);}};}function respondWithFilteredResult(_0x995056,_0x3ce29f){return function(_0x120918){if(_0x120918){var _0x22a1a6=typeof _0x3ce29f['offset']==='undefined'&&typeof _0x3ce29f[_0xde57('0x24')]===_0xde57('0x25');var _0x3d85fa=_0x120918[_0xde57('0x26')];var _0x57ff37=_0x22a1a6?0x0:_0x3ce29f['offset'];var _0x3acabd=_0x22a1a6?_0x120918['count']:_0x3ce29f[_0xde57('0x27')]+_0x3ce29f[_0xde57('0x24')];var _0x5c23b9;if(_0x3acabd>=_0x3d85fa){_0x3acabd=_0x3d85fa;_0x5c23b9=0xc8;}else{_0x5c23b9=0xce;}_0x995056[_0xde57('0x21')](_0x5c23b9);return _0x995056[_0xde57('0x28')]('Content-Range',_0x57ff37+'-'+_0x3acabd+'/'+_0x3d85fa)[_0xde57('0x23')](_0x120918);}return null;};}function patchUpdates(_0x43827c){return function(_0x2e5131){try{jsonpatch[_0xde57('0x29')](_0x2e5131,_0x43827c,!![]);}catch(_0x2da9d9){return BPromise[_0xde57('0x2a')](_0x2da9d9);}return _0x2e5131[_0xde57('0x2b')]();};}function saveUpdates(_0x4ad523,_0x2d0dfb){return function(_0x27daea){if(_0x27daea){return _0x27daea[_0xde57('0x2c')](_0x4ad523)[_0xde57('0x2d')](function(_0x21c17f){return _0x21c17f;});}return null;};}function removeEntity(_0x709e78,_0xe7ffa){return function(_0x2cd7a6){if(_0x2cd7a6){return _0x2cd7a6[_0xde57('0x2e')]()['then'](function(){var _0x34b85f=_0x2cd7a6[_0xde57('0x2f')]({'plain':!![]});var _0x22a607='Lists';return db['UserProfileResource'][_0xde57('0x2e')]({'where':{'type':_0x22a607,'resourceId':_0x34b85f['id']}})['then'](function(){return _0x2cd7a6;});})['then'](function(){_0x709e78[_0xde57('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ae47,_0x21331c){return function(_0x3e916b){if(!_0x3e916b){_0x57ae47[_0xde57('0x20')](0x194);}return _0x3e916b;};}function handleError(_0x3fbcc4,_0x139e94){_0x139e94=_0x139e94||0x1f4;return function(_0x5eba7d){logger[_0xde57('0x30')](_0x5eba7d[_0xde57('0x31')]);if(_0x5eba7d['name']){delete _0x5eba7d[_0xde57('0x32')];}_0x3fbcc4[_0xde57('0x21')](_0x139e94)[_0xde57('0x33')](_0x5eba7d);};}exports[_0xde57('0x34')]=function(_0x3d9f3a,_0x1d88ab){var _0x3e7207={},_0x575134={},_0x19167a={'count':0x0,'rows':[]};var _0x3d5722=_[_0xde57('0x35')](db['CmList'][_0xde57('0x36')],function(_0x8ecade){return{'name':_0x8ecade[_0xde57('0x37')],'type':_0x8ecade[_0xde57('0x38')][_0xde57('0x39')]};});_0x575134[_0xde57('0x3a')]=_[_0xde57('0x35')](_0x3d5722,_0xde57('0x32'));_0x575134[_0xde57('0x3b')]=_[_0xde57('0x3c')](_0x3d9f3a[_0xde57('0x3b')]);_0x575134[_0xde57('0x3d')]=_[_0xde57('0x3e')](_0x575134[_0xde57('0x3a')],_0x575134[_0xde57('0x3b')]);_0x3e7207[_0xde57('0x3f')]=_[_0xde57('0x3e')](_0x575134[_0xde57('0x3a')],qs[_0xde57('0x40')](_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x40')]));_0x3e7207[_0xde57('0x3f')]=_0x3e7207[_0xde57('0x3f')][_0xde57('0x41')]?_0x3e7207['attributes']:_0x575134[_0xde57('0x3a')];if(!_0x3d9f3a[_0xde57('0x3b')]['hasOwnProperty'](_0xde57('0x42'))){_0x3e7207[_0xde57('0x24')]=qs['limit'](_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x24')]);_0x3e7207[_0xde57('0x27')]=qs['offset'](_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x27')]);}_0x3e7207[_0xde57('0x43')]=qs[_0xde57('0x44')](_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x44')]);_0x3e7207[_0xde57('0x45')]=qs[_0xde57('0x3d')](_[_0xde57('0x46')](_0x3d9f3a[_0xde57('0x3b')],_0x575134['filters']),_0x3d5722);if(_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x47')]){_0x3e7207['where']=_[_0xde57('0x48')](_0x3e7207[_0xde57('0x45')],{'$or':_['map'](_0x3d5722,function(_0xa205ec){if(_0xa205ec['type']!=='VIRTUAL'){var _0x281ea2={};_0x281ea2[_0xa205ec[_0xde57('0x32')]]={'$like':'%'+_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x47')]+'%'};return _0x281ea2;}})});}_0x3e7207=_[_0xde57('0x48')]({},_0x3e7207,_0x3d9f3a['options']);var _0x156a34={'where':_0x3e7207[_0xde57('0x45')]};return db[_0xde57('0x49')][_0xde57('0x26')](_0x156a34)[_0xde57('0x2d')](function(_0x5ac388){_0x19167a[_0xde57('0x26')]=_0x5ac388;if(_0x3d9f3a[_0xde57('0x3b')][_0xde57('0x4a')]){_0x3e7207['include']=[{'all':!![]}];}return db[_0xde57('0x49')][_0xde57('0x4b')](_0x3e7207);})[_0xde57('0x2d')](function(_0x1271ed){_0x19167a[_0xde57('0x4c')]=_0x1271ed;return _0x19167a;})[_0xde57('0x2d')](respondWithFilteredResult(_0x1d88ab,_0x3e7207))['catch'](handleError(_0x1d88ab,null));};exports['show']=function(_0x125069,_0x1aa09d){var _0x2ed5f7={'raw':![],'where':{'id':_0x125069['params']['id']}},_0x1b4c5={};_0x1b4c5[_0xde57('0x3a')]=_[_0xde57('0x3c')](db[_0xde57('0x49')]['rawAttributes']);_0x1b4c5['query']=_[_0xde57('0x3c')](_0x125069[_0xde57('0x3b')]);_0x1b4c5[_0xde57('0x3d')]=_[_0xde57('0x3e')](_0x1b4c5[_0xde57('0x3a')],_0x1b4c5[_0xde57('0x3b')]);_0x2ed5f7['attributes']=_[_0xde57('0x3e')](_0x1b4c5[_0xde57('0x3a')],qs[_0xde57('0x40')](_0x125069[_0xde57('0x3b')][_0xde57('0x40')]));_0x2ed5f7['attributes']=_0x2ed5f7['attributes'][_0xde57('0x41')]?_0x2ed5f7[_0xde57('0x3f')]:_0x1b4c5['model'];if(_0x125069[_0xde57('0x3b')][_0xde57('0x4a')]){_0x2ed5f7['include']=[{'all':!![]}];}_0x2ed5f7=_[_0xde57('0x48')]({},_0x2ed5f7,_0x125069[_0xde57('0x4d')]);return db[_0xde57('0x49')][_0xde57('0x4e')](_0x2ed5f7)[_0xde57('0x2d')](handleEntityNotFound(_0x1aa09d,null))[_0xde57('0x2d')](respondWithResult(_0x1aa09d,null))[_0xde57('0x4f')](handleError(_0x1aa09d,null));};exports[_0xde57('0x50')]=function(_0x3b5bf9,_0x5d619f){return db[_0xde57('0x49')]['create'](_0x3b5bf9[_0xde57('0x51')],{})['then'](function(_0x181119){var _0x2f7ef6=_0x3b5bf9['user'][_0xde57('0x2f')]({'plain':!![]});if(!_0x2f7ef6)throw new Error(_0xde57('0x52'));if(_0x2f7ef6['role']===_0xde57('0x53')){var _0x9c0d84=_0x181119[_0xde57('0x2f')]({'plain':!![]});var _0x3277fe=_0xde57('0x54');return db['UserProfileSection'][_0xde57('0x4e')]({'where':{'name':_0x3277fe,'userProfileId':_0x2f7ef6['userProfileId']},'raw':!![]})[_0xde57('0x2d')](function(_0x44fe47){if(_0x44fe47&&_0x44fe47[_0xde57('0x55')]===0x0){return db[_0xde57('0x56')][_0xde57('0x50')]({'name':_0x9c0d84['name'],'resourceId':_0x9c0d84['id'],'type':_0x44fe47[_0xde57('0x32')],'sectionId':_0x44fe47['id']},{})[_0xde57('0x2d')](function(){return _0x181119;});}else{return _0x181119;}})[_0xde57('0x4f')](function(_0x9513d8){logger[_0xde57('0x30')](_0xde57('0x57'),_0x9513d8);throw _0x9513d8;});}return _0x181119;})[_0xde57('0x2d')](respondWithResult(_0x5d619f,0xc9))[_0xde57('0x4f')](handleError(_0x5d619f,null));};exports[_0xde57('0x2c')]=function(_0xa4d6c,_0x3210fb){if(_0xa4d6c[_0xde57('0x51')]['id']){delete _0xa4d6c['body']['id'];}return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0xa4d6c['params']['id']}})['then'](handleEntityNotFound(_0x3210fb,null))[_0xde57('0x2d')](saveUpdates(_0xa4d6c[_0xde57('0x51')],null))[_0xde57('0x2d')](respondWithResult(_0x3210fb,null))[_0xde57('0x4f')](handleError(_0x3210fb,null));};exports[_0xde57('0x2e')]=function(_0x5b1a7b,_0x4521c8){return db['CmList'][_0xde57('0x4e')]({'where':{'id':_0x5b1a7b[_0xde57('0x58')]['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x4521c8,null))['then'](removeEntity(_0x4521c8,null))[_0xde57('0x4f')](handleError(_0x4521c8,null));};exports[_0xde57('0x59')]=function(_0x26ba20,_0x5d8dd1){return db['CmList'][_0xde57('0x59')]()[_0xde57('0x2d')](respondWithResult(_0x5d8dd1,null))['catch'](handleError(_0x5d8dd1,null));};exports[_0xde57('0x5a')]=function(_0xb3cc4d,_0x194e08,_0xfc6658){if(_0xb3cc4d[_0xde57('0x51')]['id']){delete _0xb3cc4d[_0xde57('0x51')]['id'];}return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0xb3cc4d[_0xde57('0x58')]['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x194e08,null))[_0xde57('0x2d')](function(_0x4ee6d4){if(_0x4ee6d4){_0xb3cc4d[_0xde57('0x51')][_0xde57('0x5b')]=_0x4ee6d4['id'];return db[_0xde57('0x5c')][_0xde57('0x50')](_0xb3cc4d[_0xde57('0x51')]);}})['then'](respondWithResult(_0x194e08,null))[_0xde57('0x4f')](handleError(_0x194e08,null));};exports[_0xde57('0x5d')]=function(_0x8640b8,_0x52acd0,_0x68dcd0){var _0xa45e66={'raw':![],'where':{}};var _0x1b32ef={};var _0x39b68e={'count':0x0,'rows':[]};return db['CmList'][_0xde57('0x5e')]({'where':{'id':_0x8640b8[_0xde57('0x58')]['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x52acd0,null))[_0xde57('0x2d')](function(_0x239953){if(_0x239953){_0x1b32ef[_0xde57('0x3a')]=_[_0xde57('0x3c')](db[_0xde57('0x5c')][_0xde57('0x36')]);_0x1b32ef[_0xde57('0x3b')]=_['keys'](_0x8640b8[_0xde57('0x3b')]);_0x1b32ef[_0xde57('0x3d')]=_[_0xde57('0x3e')](_0x1b32ef[_0xde57('0x3a')],_0x1b32ef[_0xde57('0x3b')]);_0xa45e66['attributes']=_[_0xde57('0x3e')](_0x1b32ef['model'],qs['fields'](_0x8640b8[_0xde57('0x3b')]['fields']));_0xa45e66['attributes']=_0xa45e66[_0xde57('0x3f')][_0xde57('0x41')]?_0xa45e66[_0xde57('0x3f')]:_0x1b32ef[_0xde57('0x3a')];if(!_0x8640b8[_0xde57('0x3b')][_0xde57('0x5f')](_0xde57('0x42'))){_0xa45e66[_0xde57('0x24')]=qs[_0xde57('0x24')](_0x8640b8[_0xde57('0x3b')][_0xde57('0x24')]);_0xa45e66[_0xde57('0x27')]=qs[_0xde57('0x27')](_0x8640b8['query'][_0xde57('0x27')]);}_0xa45e66[_0xde57('0x43')]=qs[_0xde57('0x44')](_0x8640b8[_0xde57('0x3b')][_0xde57('0x44')]);_0xa45e66[_0xde57('0x45')]=qs[_0xde57('0x3d')](_[_0xde57('0x46')](_0x8640b8[_0xde57('0x3b')],_0x1b32ef[_0xde57('0x3d')]));_0xa45e66[_0xde57('0x45')][_0xde57('0x5b')]=_0x239953['id'];if(_0x8640b8[_0xde57('0x3b')][_0xde57('0x47')]){_0xa45e66[_0xde57('0x45')]=_[_0xde57('0x48')](_0xa45e66['where'],{'$or':_[_0xde57('0x35')](_0xa45e66['attributes'],function(_0xb5b56){var _0x529885={};_0x529885[_0xb5b56]={'$like':'%'+_0x8640b8[_0xde57('0x3b')][_0xde57('0x47')]+'%'};return _0x529885;})});}_0xa45e66=_[_0xde57('0x48')]({},_0xa45e66,_0x8640b8['options']);return db[_0xde57('0x5c')][_0xde57('0x26')]({'where':_0xa45e66[_0xde57('0x45')]})['then'](function(_0x35e101){_0x39b68e[_0xde57('0x26')]=_0x35e101;if(_0x8640b8[_0xde57('0x3b')][_0xde57('0x4a')]){_0xa45e66[_0xde57('0x60')]=[{'all':!![]}];}return db[_0xde57('0x5c')][_0xde57('0x4b')](_0xa45e66);})['then'](function(_0x34c450){_0x39b68e[_0xde57('0x4c')]=_0x34c450;return _0x39b68e;});}})[_0xde57('0x2d')](respondWithFilteredResult(_0x52acd0,_0xa45e66))[_0xde57('0x4f')](handleError(_0x52acd0,null));};exports[_0xde57('0x61')]=function(_0x489c1b,_0x2019d7,_0x38fdbe){return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0x489c1b[_0xde57('0x58')]['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x2019d7,null))[_0xde57('0x2d')](function(_0x306540){if(_0x306540){return _0x306540[_0xde57('0x61')](_0x489c1b[_0xde57('0x3b')][_0xde57('0x62')]);}})[_0xde57('0x2d')](respondWithStatusCode(_0x2019d7,null))['catch'](handleError(_0x2019d7,null));};exports[_0xde57('0x63')]=function(_0x327831,_0x225375,_0x10a971){return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0x327831[_0xde57('0x58')]['id']}})['then'](handleEntityNotFound(_0x225375,null))[_0xde57('0x2d')](function(_0x3d9b16){if(_0x3d9b16){var _0x2d590a=[];var _0x32c455={'success':[],'errors':[]};return db[_0xde57('0x64')][_0xde57('0x59')]()[_0xde57('0x2d')](function(_0x3b7e50){if(_0x327831[_0xde57('0x51')][_0xde57('0x65')]&&_[_0xde57('0x66')](_0x327831['body']['tags'])){if(_0x327831[_0xde57('0x51')][_0xde57('0x65')][_0xde57('0x41')]){_0x327831['body']['tags']=_0x327831[_0xde57('0x51')][_0xde57('0x65')]['join'](';')+';';}else{_0x327831[_0xde57('0x51')]['tags']=null;}}else{_0x327831['body'][_0xde57('0x65')]=null;}if(_0x327831[_0xde57('0x51')]&&_[_0xde57('0x66')](_0x327831['body'])){for(var _0x387508=0x0;_0x387508<_0x327831[_0xde57('0x51')][_0xde57('0x41')];_0x387508+=0x1){_0x327831[_0xde57('0x51')][_0x387508][_0xde57('0x5b')]=_0x327831[_0xde57('0x58')]['id'];_0x2d590a[_0xde57('0x67')](_0x327831[_0xde57('0x51')][_0x387508]);}return BPromise[_0xde57('0x68')](_0x2d590a,function(_0x5133c8){return db[_0xde57('0x64')]['create'](_[_0xde57('0x69')](_0x5133c8,[_0xde57('0x62'),'id'])||{},{'fields':_[_0xde57('0x3c')](_0x3b7e50),'raw':!![]})[_0xde57('0x2d')](function(_0x1376c4){_0x32c455[_0xde57('0x6a')][_0xde57('0x67')](_0x1376c4[_0xde57('0x6b')]);})['catch'](function(_0x292c26){_0x32c455[_0xde57('0x6c')][_0xde57('0x67')]({'data':_0x5133c8,'error':_0x292c26[_0xde57('0x6d')]});});})[_0xde57('0x2d')](function(_0x4cf951){return _0x32c455;})[_0xde57('0x4f')](function(_0x55a5aa){return _0x55a5aa;});}else{_0x225375['status'](0x190)[_0xde57('0x23')]({'message':_0xde57('0x6e')});}});}})['then'](respondWithResult(_0x225375,null))[_0xde57('0x4f')](handleError(_0x225375,null));};exports[_0xde57('0x6f')]=function(_0x2162a8,_0x34a72,_0x2ea5a0){var _0x5ea024;return db['CmList']['find']({'where':{'id':_0x2162a8['params']['id']},'include':[{'model':db[_0xde57('0x70')],'as':_0xde57('0x71')}]})[_0xde57('0x2d')](handleEntityNotFound(_0x34a72,null))['then'](function(_0x294e4d){if(_0x294e4d){_0x5ea024=_0x294e4d;return db[_0xde57('0x64')]['rawAttributes'];}})[_0xde57('0x2d')](function(_0x5b1c0d){if(_0x5b1c0d){var _0x4d6c50={};var _0xdfaf={};_0xdfaf[_0xde57('0x3a')]=_[_0xde57('0x72')](_[_0xde57('0x3c')](_0x5b1c0d),_[_0xde57('0x35')](_0x5ea024[_0xde57('0x71')],function(_0x570cce){return util[_0xde57('0x73')](_0xde57('0x74'),_0x570cce['id']);}));_0xdfaf[_0xde57('0x3b')]=_[_0xde57('0x3c')](_0x2162a8['query']);_0xdfaf['filters']=_['intersection'](_0xdfaf[_0xde57('0x3a')],_0xdfaf[_0xde57('0x3b')]);_0x4d6c50['attributes']=_['intersection'](_0xdfaf[_0xde57('0x3a')],qs[_0xde57('0x40')](_0x2162a8['query'][_0xde57('0x40')]));_0x4d6c50[_0xde57('0x3f')]=_0x4d6c50[_0xde57('0x3f')][_0xde57('0x41')]?_0x4d6c50[_0xde57('0x3f')]:_0xdfaf[_0xde57('0x3a')];if(!_0x2162a8[_0xde57('0x3b')]['hasOwnProperty']('nolimit')){_0x4d6c50[_0xde57('0x24')]=qs[_0xde57('0x24')](_0x2162a8[_0xde57('0x3b')][_0xde57('0x24')]);_0x4d6c50['offset']=qs[_0xde57('0x27')](_0x2162a8['query']['offset']);}_0x4d6c50['order']=qs['sort'](_0x2162a8[_0xde57('0x3b')][_0xde57('0x44')]);_0x4d6c50[_0xde57('0x45')]=qs['filters'](_[_0xde57('0x46')](_0x2162a8[_0xde57('0x3b')],_0xdfaf[_0xde57('0x3d')]));_0x4d6c50['raw']=!![];if(_0x2162a8[_0xde57('0x3b')][_0xde57('0x47')]){_0x4d6c50[_0xde57('0x45')]=_[_0xde57('0x48')](_0x4d6c50[_0xde57('0x45')],{'$or':_[_0xde57('0x35')](_0x4d6c50[_0xde57('0x3f')],function(_0x59d338){var _0xbc6d8a={};_0xbc6d8a[_0x59d338]={'$like':'%'+_0x2162a8[_0xde57('0x3b')][_0xde57('0x47')]+'%'};return _0xbc6d8a;})});}_0x4d6c50=_[_0xde57('0x48')]({},_0x4d6c50,_0x2162a8[_0xde57('0x4d')]);return _0x5ea024['getContacts'](_0x4d6c50);}})[_0xde57('0x2d')](respondWithResult(_0x34a72,null))[_0xde57('0x4f')](handleError(_0x34a72,null));};exports['getContactsCsv']=function(_0xeb9ae6,_0x3e905b,_0x5df0b1){var _0x5cee8a;var _0x13033d;var _0x591643;var _0x16c9ed=_0xeb9ae6['params']['id'];csv_results=[];return db[_0xde57('0x75')][_0xde57('0x4b')]({'attributes':['id','name'],'raw':!![],'order':[_0xde57('0x76')]})[_0xde57('0x2d')](function(_0x7edfa6){_0x5cee8a=_0x7edfa6;var _0x3add99=_['keys'](db['CmContact']['rawAttributes']);return db[_0xde57('0x70')][_0xde57('0x4b')]({'raw':!![],'attributes':['id',_0xde57('0x77')]})[_0xde57('0x2d')](function(_0x5dd47b){_0x13033d=_0x5dd47b;var _0x266a74=squel[_0xde57('0x78')]()[_0xde57('0x40')](_0x3add99)[_0xde57('0x79')](_0xde57('0x7a'),'c')[_0xde57('0x45')](_0xde57('0x7b'),_0x16c9ed)[_0xde57('0x45')](_0xde57('0x7c'))[_0xde57('0x7d')]();for(var _0x1fcbb1=0x0;_0x1fcbb1<_0x13033d[_0xde57('0x41')];_0x1fcbb1++){_0x266a74['field']('c.cf_'+_0x13033d[_0x1fcbb1]['id'],'customField_'+_0x13033d[_0x1fcbb1][_0xde57('0x77')]);}for(var _0x1fcbb1=0x0;_0x1fcbb1<_0x5cee8a['length'];_0x1fcbb1++){_0x266a74['field'](squel[_0xde57('0x78')]()[_0xde57('0x7e')]('item')[_0xde57('0x79')](_0xde57('0x7f'))[_0xde57('0x45')](_0xde57('0x80'),_0x5cee8a[_0x1fcbb1]['id'])[_0xde57('0x45')]('CmContactId\x20=\x20c.id'),_0xde57('0x81')+_0x5cee8a[_0x1fcbb1][_0xde57('0x32')]);_0x266a74['field'](squel[_0xde57('0x78')]()[_0xde57('0x7e')](_0xde57('0x82'))[_0xde57('0x79')](_0xde57('0x7f'))[_0xde57('0x45')](_0xde57('0x80'),_0x5cee8a[_0x1fcbb1]['id'])[_0xde57('0x45')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x5cee8a[_0x1fcbb1]['name']);}var _0x5aa402=[];_0x5aa402[_0xde57('0x67')](_0x266a74[_0xde57('0x83')]());BPromise[_0xde57('0x68')](_0x5aa402,handleQuery)[_0xde57('0x2d')](function(_0x13535d){handleQuery(_0x266a74[_0xde57('0x83')]());var _0x2f7a8d=csv_results[0x0];if(!_[_0xde57('0x84')](_0x2f7a8d)){var _0x469f5a=toCsv(_0x2f7a8d);var _0x4180d3=Date[_0xde57('0x85')]();fs[_0xde57('0x86')](util['format'](_0xde57('0x87'),_0x16c9ed,_0x4180d3),_0x469f5a);_0x3e905b[_0xde57('0x88')](_0xde57('0x89'),'attachment;\x20filename='+util['format'](_0xde57('0x8a'),_0x16c9ed,_0x4180d3));_0x3e905b[_0xde57('0x88')]('Content-type',_0xde57('0x8b'));return _0x3e905b['download'](util[_0xde57('0x73')](_0xde57('0x87'),_0x16c9ed,_0x4180d3));}else{return _0x3e905b['sendStatus'](0xcc);}});});});};exports[_0xde57('0x8c')]=function(_0x59dffc,_0x1b7bc6,_0x229c91){var _0x1ffcbd;delete _0x59dffc[_0xde57('0x51')]['id'];return db[_0xde57('0x49')][_0xde57('0x5e')]({'where':{'id':_0x59dffc['params']['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x1b7bc6,null))[_0xde57('0x2d')](function(_0x461512){if(_0x461512){return db[_0xde57('0x8d')][_0xde57('0x8e')](function(_0x3b5ea0){return db['CmCustomField']['create'](_0x59dffc[_0xde57('0x51')],{'transaction':_0x3b5ea0})['then'](function(_0x2f7223){_0x1ffcbd=_0x2f7223;return _0x461512[_0xde57('0x8f')](_0x2f7223,{'transaction':_0x3b5ea0});})[_0xde57('0x2d')](function(){var _0x11bbe8={'type':db[_0xde57('0x90')]['TEXT'],'transaction':_0x3b5ea0};switch(_0x59dffc[_0xde57('0x51')][_0xde57('0x38')]){case'text':_0x11bbe8[_0xde57('0x38')]=db[_0xde57('0x90')][_0xde57('0x91')];break;case _0xde57('0x92'):_0x11bbe8['type']=db[_0xde57('0x90')]['INTEGER'];break;case _0xde57('0x93'):_0x11bbe8[_0xde57('0x38')]=db['Sequelize']['BOOLEAN'];_0x11bbe8[_0xde57('0x94')]=![];break;default:}return db[_0xde57('0x8d')][_0xde57('0x95')]['addColumn'](_0xde57('0x7a'),util[_0xde57('0x73')](_0xde57('0x96'),_0x1ffcbd['id']),_0x11bbe8);})[_0xde57('0x2d')](function(){return _0x1ffcbd;});});}})['then'](respondWithResult(_0x1b7bc6,null))[_0xde57('0x4f')](handleError(_0x1b7bc6,null));};exports['getCustomFields']=function(_0x10a4bc,_0x111339,_0x100834){var _0x1d2f03={};var _0x22863b={};var _0x29165d;var _0x42acd0;return db['CmList'][_0xde57('0x5e')]({'where':{'id':_0x10a4bc['params']['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x111339,null))[_0xde57('0x2d')](function(_0x2150a6){if(_0x2150a6){_0x29165d=_0x2150a6;_0x22863b[_0xde57('0x3a')]=_['keys'](db[_0xde57('0x70')][_0xde57('0x36')]);_0x22863b[_0xde57('0x3b')]=_['keys'](_0x10a4bc['query']);_0x22863b[_0xde57('0x3d')]=_['intersection'](_0x22863b[_0xde57('0x3a')],_0x22863b['query']);_0x1d2f03[_0xde57('0x3f')]=_['intersection'](_0x22863b[_0xde57('0x3a')],qs[_0xde57('0x40')](_0x10a4bc[_0xde57('0x3b')][_0xde57('0x40')]));_0x1d2f03[_0xde57('0x3f')]=_0x1d2f03['attributes'][_0xde57('0x41')]?_0x1d2f03[_0xde57('0x3f')]:_0x22863b[_0xde57('0x3a')];_0x1d2f03['order']=qs[_0xde57('0x44')](_0x10a4bc[_0xde57('0x3b')]['sort']);_0x1d2f03[_0xde57('0x45')]=qs[_0xde57('0x3d')](_[_0xde57('0x46')](_0x10a4bc['query'],_0x22863b[_0xde57('0x3d')]));_0x1d2f03[_0xde57('0x45')]=_[_0xde57('0x48')](_0x1d2f03['where'],{'$or':[{'ListId':_0x2150a6['id']},{'ListId':null}]});if(_0x10a4bc[_0xde57('0x3b')][_0xde57('0x47')]){_0x1d2f03[_0xde57('0x45')]=_['merge'](_0x1d2f03[_0xde57('0x45')],{'$or':_['map'](_0x1d2f03['attributes'],function(_0x2234cb){var _0x3095ad={};_0x3095ad[_0x2234cb]={'$like':'%'+_0x10a4bc[_0xde57('0x3b')][_0xde57('0x47')]+'%'};return _0x3095ad;})});}_0x1d2f03=_['merge']({},_0x1d2f03,_0x10a4bc[_0xde57('0x4d')]);return db[_0xde57('0x70')]['findAndCountAll'](_0x1d2f03);}})[_0xde57('0x2d')](respondWithResult(_0x111339,null))[_0xde57('0x4f')](handleError(_0x111339,null));};exports['getGlobalCustomFields']=function(_0x3cf4d9,_0x3ed9cc){return db['CmCustomField'][_0xde57('0x97')]({'where':{'ListId':null}})[_0xde57('0x2d')](handleEntityNotFound(_0x3ed9cc,null))[_0xde57('0x2d')](function(_0x554391){return _0x554391;})[_0xde57('0x2d')](respondWithResult(_0x3ed9cc,null))[_0xde57('0x4f')](handleError(_0x3ed9cc,null));};exports[_0xde57('0x98')]=function(_0x953e8c,_0x180849,_0x57f985){return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0x953e8c['params']['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x180849,null))[_0xde57('0x2d')](function(_0x16a92f){if(_0x16a92f){return _0x16a92f[_0xde57('0x98')](_0x953e8c[_0xde57('0x51')][_0xde57('0x62')],_['omit'](_0x953e8c[_0xde57('0x51')],[_0xde57('0x62'),'id'])||{})[_0xde57('0x99')](function(_0x2e003b){for(var _0x58b73b=0x0;_0x58b73b<_0x953e8c[_0xde57('0x51')][_0xde57('0x62')][_0xde57('0x41')];_0x58b73b+=0x1){socket[_0xde57('0x9a')](_0xde57('0x9b'),{'UserId':Number(_0x953e8c[_0xde57('0x51')]['ids'][_0x58b73b]),'CmListId':Number(_0x953e8c['params']['id'])});}return _0x2e003b;});}})[_0xde57('0x2d')](respondWithResult(_0x180849,null))[_0xde57('0x4f')](handleError(_0x180849,null));};exports[_0xde57('0x9c')]=function(_0x10c573,_0x397c5f,_0x3ea337){return db[_0xde57('0x49')][_0xde57('0x4e')]({'where':{'id':_0x10c573[_0xde57('0x58')]['id']}})['then'](handleEntityNotFound(_0x397c5f,null))[_0xde57('0x2d')](function(_0x1c626c){if(_0x1c626c){return _0x1c626c[_0xde57('0x9c')](_0x10c573[_0xde57('0x3b')]['ids'])[_0xde57('0x2d')](function(){if(_['isArray'](_0x10c573['query'][_0xde57('0x62')])){for(var _0x4af907=0x0;_0x4af907<_0x10c573['query'][_0xde57('0x62')][_0xde57('0x41')];_0x4af907+=0x1){socket[_0xde57('0x9a')](_0xde57('0x9d'),{'UserId':Number(_0x10c573[_0xde57('0x3b')][_0xde57('0x62')][_0x4af907]),'CmListId':Number(_0x10c573[_0xde57('0x58')]['id'])});}}else{socket[_0xde57('0x9a')](_0xde57('0x9d'),{'UserId':Number(_0x10c573[_0xde57('0x3b')]['ids']),'CmListId':Number(_0x10c573[_0xde57('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x397c5f,null))[_0xde57('0x4f')](handleError(_0x397c5f,null));};exports['getAgents']=function(_0x51073a,_0x54f62b,_0x4cc3ef){var _0x394573={};var _0x5b1fa8={};var _0x5babce;var _0x57d4e9;return db['CmList'][_0xde57('0x5e')]({'where':{'id':_0x51073a[_0xde57('0x58')]['id']}})[_0xde57('0x2d')](handleEntityNotFound(_0x54f62b,null))[_0xde57('0x2d')](function(_0x4d7de7){if(_0x4d7de7){_0x5babce=_0x4d7de7;_0x5b1fa8[_0xde57('0x3a')]=_['keys'](db['User']['rawAttributes']);_0x5b1fa8[_0xde57('0x3b')]=_[_0xde57('0x3c')](_0x51073a[_0xde57('0x3b')]);_0x5b1fa8[_0xde57('0x3d')]=_[_0xde57('0x3e')](_0x5b1fa8[_0xde57('0x3a')],_0x5b1fa8[_0xde57('0x3b')]);_0x394573[_0xde57('0x3f')]=_['intersection'](_0x5b1fa8[_0xde57('0x3a')],qs[_0xde57('0x40')](_0x51073a[_0xde57('0x3b')][_0xde57('0x40')]));_0x394573['attributes']=_0x394573['attributes'][_0xde57('0x41')]?_0x394573[_0xde57('0x3f')]:_0x5b1fa8[_0xde57('0x3a')];_0x394573[_0xde57('0x43')]=qs[_0xde57('0x44')](_0x51073a[_0xde57('0x3b')][_0xde57('0x44')]);_0x394573[_0xde57('0x45')]=qs[_0xde57('0x3d')](_[_0xde57('0x46')](_0x51073a['query'],_0x5b1fa8[_0xde57('0x3d')]));if(_0x51073a['query'][_0xde57('0x47')]){_0x394573[_0xde57('0x45')]=_['merge'](_0x394573['where'],{'$or':_[_0xde57('0x35')](_0x394573['attributes'],function(_0x377234){var _0x4e6008={};_0x4e6008[_0x377234]={'$like':'%'+_0x51073a[_0xde57('0x3b')][_0xde57('0x47')]+'%'};return _0x4e6008;})});}_0x394573=_['merge']({},_0x394573,_0x51073a[_0xde57('0x4d')]);return _0x5babce['getAgents'](_0x394573);}})['then'](function(_0x27e5d6){if(_0x27e5d6){_0x57d4e9=_0x27e5d6['length'];if(!_0x51073a[_0xde57('0x3b')][_0xde57('0x5f')](_0xde57('0x42'))){_0x394573[_0xde57('0x24')]=qs['limit'](_0x51073a[_0xde57('0x3b')][_0xde57('0x24')]);_0x394573[_0xde57('0x27')]=qs[_0xde57('0x27')](_0x51073a[_0xde57('0x3b')][_0xde57('0x27')]);}return _0x5babce[_0xde57('0x9e')](_0x394573);}})[_0xde57('0x2d')](function(_0x871cc6){if(_0x871cc6){return _0x871cc6?{'count':_0x57d4e9,'rows':_0x871cc6}:null;}})['then'](respondWithResult(_0x54f62b,null))[_0xde57('0x4f')](handleError(_0x54f62b,null));};function handleQuery(_0x1213b4){logger[_0xde57('0x9f')](_0x1213b4);return db[_0xde57('0x8d')][_0xde57('0x3b')](_0x1213b4)[_0xde57('0x99')](function(_0x172dd4){csv_results[_0xde57('0x67')](_0x172dd4);})[_0xde57('0x4f')](function(_0x526eec){logger[_0xde57('0x30')](_0x526eec[_0xde57('0x6d')]);});} \ No newline at end of file +var _0xf7a7=['TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','spread','eml-format','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','then','destroy','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','find','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','findOne','sequelize','Sequelize'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xf7a7,0xb2));var _0x7f7a=function(_0x1f874b,_0x2b09c7){_0x1f874b=_0x1f874b-0x0;var _0x36ff44=_0xf7a7[_0x1f874b];return _0x36ff44;};'use strict';var emlformat=require(_0x7f7a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f7a('0x1'));var rp=require(_0x7f7a('0x2'));var moment=require(_0x7f7a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7f7a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7f7a('0x5'));var csv=require('to-csv');var ejs=require(_0x7f7a('0x6'));var fs=require('fs');var fs_extra=require(_0x7f7a('0x7'));var _=require(_0x7f7a('0x8'));var squel=require(_0x7f7a('0x9'));var crypto=require('crypto');var jsforce=require(_0x7f7a('0xa'));var deskjs=require(_0x7f7a('0xb'));var toCsv=require(_0x7f7a('0xc'));var querystring=require(_0x7f7a('0xd'));var Papa=require(_0x7f7a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f7a('0xf'));var as=require(_0x7f7a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f7a('0x11'))(_0x7f7a('0x12'));var utils=require(_0x7f7a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7f7a('0x14'));var db=require(_0x7f7a('0x15'))['db'];var csv_results;config['redis']=_[_0x7f7a('0x16')](config[_0x7f7a('0x17')],{'host':_0x7f7a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f7a('0x17')]));require(_0x7f7a('0x19'))[_0x7f7a('0x1a')](socket);function respondWithStatusCode(_0x2642dc,_0x25862a){_0x25862a=_0x25862a||0xcc;return function(_0x4800f6){if(_0x4800f6){return _0x2642dc[_0x7f7a('0x1b')](_0x25862a);}return _0x2642dc['status'](_0x25862a)['end']();};}function respondWithResult(_0x68955,_0x24570f){_0x24570f=_0x24570f||0xc8;return function(_0x567740){if(_0x567740){return _0x68955[_0x7f7a('0x1c')](_0x24570f)['json'](_0x567740);}};}function respondWithFilteredResult(_0x19e6f2,_0x2d6601){return function(_0x165c5b){if(_0x165c5b){var _0x4e87fe=typeof _0x2d6601[_0x7f7a('0x1d')]===_0x7f7a('0x1e')&&typeof _0x2d6601[_0x7f7a('0x1f')]===_0x7f7a('0x1e');var _0x355fb7=_0x165c5b['count'];var _0x14fdf5=_0x4e87fe?0x0:_0x2d6601[_0x7f7a('0x1d')];var _0x438a4c=_0x4e87fe?_0x165c5b[_0x7f7a('0x20')]:_0x2d6601['offset']+_0x2d6601[_0x7f7a('0x1f')];var _0x31869a;if(_0x438a4c>=_0x355fb7){_0x438a4c=_0x355fb7;_0x31869a=0xc8;}else{_0x31869a=0xce;}_0x19e6f2['status'](_0x31869a);return _0x19e6f2[_0x7f7a('0x21')]('Content-Range',_0x14fdf5+'-'+_0x438a4c+'/'+_0x355fb7)['json'](_0x165c5b);}return null;};}function patchUpdates(_0x170eb9){return function(_0x436585){try{jsonpatch[_0x7f7a('0x22')](_0x436585,_0x170eb9,!![]);}catch(_0x4a3b39){return BPromise[_0x7f7a('0x23')](_0x4a3b39);}return _0x436585[_0x7f7a('0x24')]();};}function saveUpdates(_0x3be116,_0x2994f5){return function(_0x500479){if(_0x500479){return _0x500479['update'](_0x3be116)[_0x7f7a('0x25')](function(_0x19cf78){return _0x19cf78;});}return null;};}function removeEntity(_0x30efbc,_0x50ff44){return function(_0x5ebd30){if(_0x5ebd30){return _0x5ebd30[_0x7f7a('0x26')]()['then'](function(){var _0x2adcf0=_0x5ebd30['get']({'plain':!![]});var _0x1914da=_0x7f7a('0x27');return db[_0x7f7a('0x28')][_0x7f7a('0x26')]({'where':{'type':_0x1914da,'resourceId':_0x2adcf0['id']}})['then'](function(){return _0x5ebd30;});})[_0x7f7a('0x25')](function(){_0x30efbc[_0x7f7a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249dd1,_0x51c949){return function(_0x1b6c36){if(!_0x1b6c36){_0x249dd1[_0x7f7a('0x1b')](0x194);}return _0x1b6c36;};}function handleError(_0x553ceb,_0x558a1f){_0x558a1f=_0x558a1f||0x1f4;return function(_0x4c062d){logger[_0x7f7a('0x29')](_0x4c062d[_0x7f7a('0x2a')]);if(_0x4c062d[_0x7f7a('0x2b')]){delete _0x4c062d[_0x7f7a('0x2b')];}_0x553ceb[_0x7f7a('0x1c')](_0x558a1f)[_0x7f7a('0x2c')](_0x4c062d);};}exports['index']=function(_0x453414,_0x4aefa3){var _0x1c373b={},_0x1b2c6f={},_0xea94af={'count':0x0,'rows':[]};var _0x7b1fbd=_[_0x7f7a('0x2d')](db[_0x7f7a('0x2e')][_0x7f7a('0x2f')],function(_0x2ec2ab){return{'name':_0x2ec2ab[_0x7f7a('0x30')],'type':_0x2ec2ab[_0x7f7a('0x31')][_0x7f7a('0x32')]};});_0x1b2c6f[_0x7f7a('0x33')]=_[_0x7f7a('0x2d')](_0x7b1fbd,_0x7f7a('0x2b'));_0x1b2c6f[_0x7f7a('0x34')]=_['keys'](_0x453414[_0x7f7a('0x34')]);_0x1b2c6f['filters']=_[_0x7f7a('0x35')](_0x1b2c6f[_0x7f7a('0x33')],_0x1b2c6f[_0x7f7a('0x34')]);_0x1c373b[_0x7f7a('0x36')]=_[_0x7f7a('0x35')](_0x1b2c6f[_0x7f7a('0x33')],qs['fields'](_0x453414['query'][_0x7f7a('0x37')]));_0x1c373b[_0x7f7a('0x36')]=_0x1c373b[_0x7f7a('0x36')][_0x7f7a('0x38')]?_0x1c373b['attributes']:_0x1b2c6f[_0x7f7a('0x33')];if(!_0x453414['query'][_0x7f7a('0x39')](_0x7f7a('0x3a'))){_0x1c373b['limit']=qs[_0x7f7a('0x1f')](_0x453414[_0x7f7a('0x34')][_0x7f7a('0x1f')]);_0x1c373b[_0x7f7a('0x1d')]=qs[_0x7f7a('0x1d')](_0x453414[_0x7f7a('0x34')][_0x7f7a('0x1d')]);}_0x1c373b[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0x453414[_0x7f7a('0x34')][_0x7f7a('0x3c')]);_0x1c373b['where']=qs[_0x7f7a('0x3d')](_[_0x7f7a('0x3e')](_0x453414['query'],_0x1b2c6f['filters']),_0x7b1fbd);if(_0x453414['query']['filter']){_0x1c373b[_0x7f7a('0x3f')]=_['merge'](_0x1c373b['where'],{'$or':_[_0x7f7a('0x2d')](_0x7b1fbd,function(_0x49208f){if(_0x49208f[_0x7f7a('0x31')]!==_0x7f7a('0x40')){var _0x4f5cbe={};_0x4f5cbe[_0x49208f['name']]={'$like':'%'+_0x453414[_0x7f7a('0x34')][_0x7f7a('0x41')]+'%'};return _0x4f5cbe;}})});}_0x1c373b=_['merge']({},_0x1c373b,_0x453414[_0x7f7a('0x42')]);var _0x31ebc9={'where':_0x1c373b['where']};return db[_0x7f7a('0x2e')][_0x7f7a('0x20')](_0x31ebc9)[_0x7f7a('0x25')](function(_0x3c2e74){_0xea94af[_0x7f7a('0x20')]=_0x3c2e74;if(_0x453414[_0x7f7a('0x34')][_0x7f7a('0x43')]){_0x1c373b[_0x7f7a('0x44')]=[{'all':!![]}];}return db[_0x7f7a('0x2e')][_0x7f7a('0x45')](_0x1c373b);})['then'](function(_0x1ec385){_0xea94af['rows']=_0x1ec385;return _0xea94af;})[_0x7f7a('0x25')](respondWithFilteredResult(_0x4aefa3,_0x1c373b))[_0x7f7a('0x46')](handleError(_0x4aefa3,null));};exports[_0x7f7a('0x47')]=function(_0x27faaa,_0x59f835){var _0x2cbee7={'raw':![],'where':{'id':_0x27faaa[_0x7f7a('0x48')]['id']}},_0x3826bd={};_0x3826bd[_0x7f7a('0x33')]=_['keys'](db[_0x7f7a('0x2e')][_0x7f7a('0x2f')]);_0x3826bd[_0x7f7a('0x34')]=_[_0x7f7a('0x49')](_0x27faaa['query']);_0x3826bd[_0x7f7a('0x3d')]=_['intersection'](_0x3826bd[_0x7f7a('0x33')],_0x3826bd[_0x7f7a('0x34')]);_0x2cbee7[_0x7f7a('0x36')]=_['intersection'](_0x3826bd['model'],qs[_0x7f7a('0x37')](_0x27faaa[_0x7f7a('0x34')][_0x7f7a('0x37')]));_0x2cbee7[_0x7f7a('0x36')]=_0x2cbee7[_0x7f7a('0x36')][_0x7f7a('0x38')]?_0x2cbee7[_0x7f7a('0x36')]:_0x3826bd[_0x7f7a('0x33')];if(_0x27faaa[_0x7f7a('0x34')]['includeAll']){_0x2cbee7[_0x7f7a('0x44')]=[{'all':!![]}];}_0x2cbee7=_[_0x7f7a('0x4a')]({},_0x2cbee7,_0x27faaa[_0x7f7a('0x42')]);return db[_0x7f7a('0x2e')]['find'](_0x2cbee7)['then'](handleEntityNotFound(_0x59f835,null))[_0x7f7a('0x25')](respondWithResult(_0x59f835,null))[_0x7f7a('0x46')](handleError(_0x59f835,null));};exports[_0x7f7a('0x4b')]=function(_0x2b04f9,_0x596288){return db[_0x7f7a('0x2e')][_0x7f7a('0x4b')](_0x2b04f9[_0x7f7a('0x4c')],{})[_0x7f7a('0x25')](function(_0x276927){var _0x39902a=_0x2b04f9[_0x7f7a('0x4d')][_0x7f7a('0x4e')]({'plain':!![]});if(!_0x39902a)throw new Error(_0x7f7a('0x4f'));if(_0x39902a[_0x7f7a('0x50')]==='user'){var _0x5c0d06=_0x276927[_0x7f7a('0x4e')]({'plain':!![]});var _0x3db23c=_0x7f7a('0x27');return db[_0x7f7a('0x51')]['find']({'where':{'name':_0x3db23c,'userProfileId':_0x39902a['userProfileId']},'raw':!![]})['then'](function(_0x5c8b06){if(_0x5c8b06&&_0x5c8b06['autoAssociation']===0x0){return db[_0x7f7a('0x28')][_0x7f7a('0x4b')]({'name':_0x5c0d06[_0x7f7a('0x2b')],'resourceId':_0x5c0d06['id'],'type':_0x5c8b06[_0x7f7a('0x2b')],'sectionId':_0x5c8b06['id']},{})[_0x7f7a('0x25')](function(){return _0x276927;});}else{return _0x276927;}})[_0x7f7a('0x46')](function(_0x52973c){logger[_0x7f7a('0x29')](_0x7f7a('0x52'),_0x52973c);throw _0x52973c;});}return _0x276927;})[_0x7f7a('0x25')](respondWithResult(_0x596288,0xc9))[_0x7f7a('0x46')](handleError(_0x596288,null));};exports[_0x7f7a('0x53')]=function(_0x20e8d4,_0x3c7541){if(_0x20e8d4[_0x7f7a('0x4c')]['id']){delete _0x20e8d4[_0x7f7a('0x4c')]['id'];}return db[_0x7f7a('0x2e')]['find']({'where':{'id':_0x20e8d4[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x3c7541,null))['then'](saveUpdates(_0x20e8d4[_0x7f7a('0x4c')],null))[_0x7f7a('0x25')](respondWithResult(_0x3c7541,null))['catch'](handleError(_0x3c7541,null));};exports[_0x7f7a('0x26')]=function(_0x53b865,_0x17af9b){return db[_0x7f7a('0x2e')]['find']({'where':{'id':_0x53b865[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x17af9b,null))[_0x7f7a('0x25')](removeEntity(_0x17af9b,null))['catch'](handleError(_0x17af9b,null));};exports['describe']=function(_0x41b246,_0x414de1){return db['CmList'][_0x7f7a('0x54')]()[_0x7f7a('0x25')](respondWithResult(_0x414de1,null))['catch'](handleError(_0x414de1,null));};exports[_0x7f7a('0x55')]=function(_0x285413,_0x4b4855,_0x52a384){if(_0x285413[_0x7f7a('0x4c')]['id']){delete _0x285413[_0x7f7a('0x4c')]['id'];}return db['CmList'][_0x7f7a('0x56')]({'where':{'id':_0x285413[_0x7f7a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b4855,null))[_0x7f7a('0x25')](function(_0x37e1c9){if(_0x37e1c9){_0x285413[_0x7f7a('0x4c')][_0x7f7a('0x57')]=_0x37e1c9['id'];return db[_0x7f7a('0x58')][_0x7f7a('0x4b')](_0x285413['body']);}})[_0x7f7a('0x25')](respondWithResult(_0x4b4855,null))[_0x7f7a('0x46')](handleError(_0x4b4855,null));};exports[_0x7f7a('0x59')]=function(_0xf38542,_0x2bb22d,_0x500573){var _0x1e269e={'raw':![],'where':{}};var _0x279d3e={};var _0x2faded={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0xf38542['params']['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x2bb22d,null))['then'](function(_0x47fe43){if(_0x47fe43){_0x279d3e[_0x7f7a('0x33')]=_[_0x7f7a('0x49')](db[_0x7f7a('0x58')]['rawAttributes']);_0x279d3e[_0x7f7a('0x34')]=_[_0x7f7a('0x49')](_0xf38542[_0x7f7a('0x34')]);_0x279d3e[_0x7f7a('0x3d')]=_[_0x7f7a('0x35')](_0x279d3e['model'],_0x279d3e[_0x7f7a('0x34')]);_0x1e269e['attributes']=_[_0x7f7a('0x35')](_0x279d3e[_0x7f7a('0x33')],qs[_0x7f7a('0x37')](_0xf38542[_0x7f7a('0x34')]['fields']));_0x1e269e[_0x7f7a('0x36')]=_0x1e269e[_0x7f7a('0x36')][_0x7f7a('0x38')]?_0x1e269e['attributes']:_0x279d3e[_0x7f7a('0x33')];if(!_0xf38542[_0x7f7a('0x34')]['hasOwnProperty'](_0x7f7a('0x3a'))){_0x1e269e[_0x7f7a('0x1f')]=qs[_0x7f7a('0x1f')](_0xf38542['query'][_0x7f7a('0x1f')]);_0x1e269e[_0x7f7a('0x1d')]=qs[_0x7f7a('0x1d')](_0xf38542[_0x7f7a('0x34')]['offset']);}_0x1e269e[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0xf38542[_0x7f7a('0x34')][_0x7f7a('0x3c')]);_0x1e269e[_0x7f7a('0x3f')]=qs[_0x7f7a('0x3d')](_[_0x7f7a('0x3e')](_0xf38542['query'],_0x279d3e[_0x7f7a('0x3d')]));_0x1e269e[_0x7f7a('0x3f')][_0x7f7a('0x57')]=_0x47fe43['id'];if(_0xf38542[_0x7f7a('0x34')][_0x7f7a('0x41')]){_0x1e269e[_0x7f7a('0x3f')]=_[_0x7f7a('0x4a')](_0x1e269e[_0x7f7a('0x3f')],{'$or':_[_0x7f7a('0x2d')](_0x1e269e[_0x7f7a('0x36')],function(_0x507434){var _0x25fb49={};_0x25fb49[_0x507434]={'$like':'%'+_0xf38542[_0x7f7a('0x34')][_0x7f7a('0x41')]+'%'};return _0x25fb49;})});}_0x1e269e=_['merge']({},_0x1e269e,_0xf38542[_0x7f7a('0x42')]);return db['Disposition'][_0x7f7a('0x20')]({'where':_0x1e269e[_0x7f7a('0x3f')]})['then'](function(_0x5cc46e){_0x2faded['count']=_0x5cc46e;if(_0xf38542[_0x7f7a('0x34')][_0x7f7a('0x43')]){_0x1e269e['include']=[{'all':!![]}];}return db[_0x7f7a('0x58')][_0x7f7a('0x45')](_0x1e269e);})[_0x7f7a('0x25')](function(_0x54d867){_0x2faded['rows']=_0x54d867;return _0x2faded;});}})[_0x7f7a('0x25')](respondWithFilteredResult(_0x2bb22d,_0x1e269e))[_0x7f7a('0x46')](handleError(_0x2bb22d,null));};exports[_0x7f7a('0x5a')]=function(_0x22df43,_0x16b41d,_0x4f70a0){return db[_0x7f7a('0x2e')][_0x7f7a('0x56')]({'where':{'id':_0x22df43[_0x7f7a('0x48')]['id']}})['then'](handleEntityNotFound(_0x16b41d,null))['then'](function(_0x537cf6){if(_0x537cf6){return _0x537cf6[_0x7f7a('0x5a')](_0x22df43['query'][_0x7f7a('0x5b')]);}})[_0x7f7a('0x25')](respondWithStatusCode(_0x16b41d,null))[_0x7f7a('0x46')](handleError(_0x16b41d,null));};exports[_0x7f7a('0x5c')]=function(_0x363f7d,_0x392df7,_0x37e6dc){return db[_0x7f7a('0x2e')]['find']({'where':{'id':_0x363f7d[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x392df7,null))[_0x7f7a('0x25')](function(_0x5c964f){if(_0x5c964f){var _0x1b2d44=[];var _0x20fc95={'success':[],'errors':[]};return db[_0x7f7a('0x5d')][_0x7f7a('0x54')]()['then'](function(_0x22d10f){if(_0x363f7d['body'][_0x7f7a('0x5e')]&&_[_0x7f7a('0x5f')](_0x363f7d[_0x7f7a('0x4c')][_0x7f7a('0x5e')])){if(_0x363f7d['body'][_0x7f7a('0x5e')][_0x7f7a('0x38')]){_0x363f7d[_0x7f7a('0x4c')][_0x7f7a('0x5e')]=_0x363f7d[_0x7f7a('0x4c')][_0x7f7a('0x5e')][_0x7f7a('0x60')](';')+';';}else{_0x363f7d[_0x7f7a('0x4c')][_0x7f7a('0x5e')]=null;}}else{_0x363f7d['body'][_0x7f7a('0x5e')]=null;}if(_0x363f7d[_0x7f7a('0x4c')]&&_[_0x7f7a('0x5f')](_0x363f7d['body'])){for(var _0x2fa037=0x0;_0x2fa037<_0x363f7d[_0x7f7a('0x4c')]['length'];_0x2fa037+=0x1){_0x363f7d[_0x7f7a('0x4c')][_0x2fa037]['ListId']=_0x363f7d[_0x7f7a('0x48')]['id'];_0x1b2d44[_0x7f7a('0x61')](_0x363f7d[_0x7f7a('0x4c')][_0x2fa037]);}return BPromise['each'](_0x1b2d44,function(_0x3776d8){return db['CmContact'][_0x7f7a('0x4b')](_[_0x7f7a('0x62')](_0x3776d8,[_0x7f7a('0x5b'),'id'])||{},{'fields':_[_0x7f7a('0x49')](_0x22d10f),'raw':!![]})[_0x7f7a('0x25')](function(_0x2da82a){_0x20fc95[_0x7f7a('0x63')][_0x7f7a('0x61')](_0x2da82a[_0x7f7a('0x64')]);})[_0x7f7a('0x46')](function(_0x4d3ff2){_0x20fc95[_0x7f7a('0x65')]['push']({'data':_0x3776d8,'error':_0x4d3ff2[_0x7f7a('0x66')]});});})['then'](function(_0x3ba4c5){return _0x20fc95;})[_0x7f7a('0x46')](function(_0x290ba9){return _0x290ba9;});}else{_0x392df7[_0x7f7a('0x1c')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x7f7a('0x25')](respondWithResult(_0x392df7,null))[_0x7f7a('0x46')](handleError(_0x392df7,null));};exports[_0x7f7a('0x67')]=function(_0x408afe,_0x394f62,_0x4e330a){var _0x18d609;return db['CmList'][_0x7f7a('0x56')]({'where':{'id':_0x408afe[_0x7f7a('0x48')]['id']},'include':[{'model':db[_0x7f7a('0x68')],'as':_0x7f7a('0x69')}]})[_0x7f7a('0x25')](handleEntityNotFound(_0x394f62,null))[_0x7f7a('0x25')](function(_0x1b7639){if(_0x1b7639){_0x18d609=_0x1b7639;return db[_0x7f7a('0x5d')]['rawAttributes'];}})[_0x7f7a('0x25')](function(_0x502518){if(_0x502518){var _0x44bbda={};var _0x453e39={};_0x453e39['model']=_[_0x7f7a('0x6a')](_[_0x7f7a('0x49')](_0x502518),_[_0x7f7a('0x2d')](_0x18d609[_0x7f7a('0x69')],function(_0x22c0d5){return util[_0x7f7a('0x6b')](_0x7f7a('0x6c'),_0x22c0d5['id']);}));_0x453e39[_0x7f7a('0x34')]=_[_0x7f7a('0x49')](_0x408afe[_0x7f7a('0x34')]);_0x453e39['filters']=_[_0x7f7a('0x35')](_0x453e39['model'],_0x453e39[_0x7f7a('0x34')]);_0x44bbda[_0x7f7a('0x36')]=_[_0x7f7a('0x35')](_0x453e39[_0x7f7a('0x33')],qs[_0x7f7a('0x37')](_0x408afe[_0x7f7a('0x34')][_0x7f7a('0x37')]));_0x44bbda['attributes']=_0x44bbda[_0x7f7a('0x36')]['length']?_0x44bbda[_0x7f7a('0x36')]:_0x453e39[_0x7f7a('0x33')];if(!_0x408afe[_0x7f7a('0x34')][_0x7f7a('0x39')](_0x7f7a('0x3a'))){_0x44bbda[_0x7f7a('0x1f')]=qs[_0x7f7a('0x1f')](_0x408afe[_0x7f7a('0x34')][_0x7f7a('0x1f')]);_0x44bbda[_0x7f7a('0x1d')]=qs[_0x7f7a('0x1d')](_0x408afe[_0x7f7a('0x34')]['offset']);}_0x44bbda[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0x408afe['query'][_0x7f7a('0x3c')]);_0x44bbda['where']=qs[_0x7f7a('0x3d')](_['pick'](_0x408afe['query'],_0x453e39[_0x7f7a('0x3d')]));_0x44bbda['raw']=!![];if(_0x408afe[_0x7f7a('0x34')]['filter']){_0x44bbda[_0x7f7a('0x3f')]=_[_0x7f7a('0x4a')](_0x44bbda[_0x7f7a('0x3f')],{'$or':_['map'](_0x44bbda['attributes'],function(_0x3c9934){var _0xe199fe={};_0xe199fe[_0x3c9934]={'$like':'%'+_0x408afe[_0x7f7a('0x34')][_0x7f7a('0x41')]+'%'};return _0xe199fe;})});}_0x44bbda=_[_0x7f7a('0x4a')]({},_0x44bbda,_0x408afe[_0x7f7a('0x42')]);return _0x18d609[_0x7f7a('0x67')](_0x44bbda);}})[_0x7f7a('0x25')](respondWithResult(_0x394f62,null))[_0x7f7a('0x46')](handleError(_0x394f62,null));};exports['getContactsCsv']=function(_0x4ca955,_0x37f13a,_0x1b1d94){var _0x571047;var _0x1d96bc;var _0x4a70b7;var _0x40f212=_0x4ca955[_0x7f7a('0x48')]['id'];csv_results=[];return db[_0x7f7a('0x6d')]['findAll']({'attributes':['id',_0x7f7a('0x2b')],'raw':!![],'order':[_0x7f7a('0x6e')]})[_0x7f7a('0x25')](function(_0xce7aec){_0x571047=_0xce7aec;var _0x3de5c8=_[_0x7f7a('0x49')](db[_0x7f7a('0x5d')][_0x7f7a('0x2f')]);return db[_0x7f7a('0x68')][_0x7f7a('0x45')]({'raw':!![],'attributes':['id',_0x7f7a('0x6f')]})[_0x7f7a('0x25')](function(_0x2c3c1f){_0x1d96bc=_0x2c3c1f;var _0x12a942=squel[_0x7f7a('0x70')]()[_0x7f7a('0x37')](_0x3de5c8)['from'](_0x7f7a('0x71'),'c')[_0x7f7a('0x3f')](_0x7f7a('0x72'),_0x40f212)[_0x7f7a('0x3f')](_0x7f7a('0x73'))[_0x7f7a('0x74')]();for(var _0x330d16=0x0;_0x330d16<_0x1d96bc[_0x7f7a('0x38')];_0x330d16++){_0x12a942[_0x7f7a('0x75')](_0x7f7a('0x76')+_0x1d96bc[_0x330d16]['id'],'customField_'+_0x1d96bc[_0x330d16][_0x7f7a('0x6f')]);}for(var _0x330d16=0x0;_0x330d16<_0x571047[_0x7f7a('0x38')];_0x330d16++){_0x12a942[_0x7f7a('0x75')](squel['select']()[_0x7f7a('0x75')]('item')[_0x7f7a('0x77')](_0x7f7a('0x78'))[_0x7f7a('0x3f')]('ItemTypeId\x20=\x20?',_0x571047[_0x330d16]['id'])[_0x7f7a('0x3f')](_0x7f7a('0x79')),_0x7f7a('0x7a')+_0x571047[_0x330d16][_0x7f7a('0x2b')]);_0x12a942['field'](squel[_0x7f7a('0x70')]()['field'](_0x7f7a('0x7b'))[_0x7f7a('0x77')](_0x7f7a('0x78'))['where'](_0x7f7a('0x7c'),_0x571047[_0x330d16]['id'])[_0x7f7a('0x3f')]('CmContactId\x20=\x20c.id'),_0x7f7a('0x7d')+_0x571047[_0x330d16][_0x7f7a('0x2b')]);}var _0x7c3b27=[];_0x7c3b27[_0x7f7a('0x61')](_0x12a942[_0x7f7a('0x7e')]());BPromise[_0x7f7a('0x7f')](_0x7c3b27,handleQuery)[_0x7f7a('0x25')](function(_0x22fd76){handleQuery(_0x12a942['toString']());var _0x4e03ae=csv_results[0x0];if(!_['isEmpty'](_0x4e03ae)){var _0x2b51a9=toCsv(_0x4e03ae);var _0x281101=Date[_0x7f7a('0x80')]();fs[_0x7f7a('0x81')](util[_0x7f7a('0x6b')](_0x7f7a('0x82'),_0x40f212,_0x281101),_0x2b51a9);_0x37f13a['setHeader'](_0x7f7a('0x83'),_0x7f7a('0x84')+util[_0x7f7a('0x6b')]('list_%d_%s.csv',_0x40f212,_0x281101));_0x37f13a[_0x7f7a('0x85')](_0x7f7a('0x86'),_0x7f7a('0x87'));return _0x37f13a[_0x7f7a('0x88')](util[_0x7f7a('0x6b')](_0x7f7a('0x82'),_0x40f212,_0x281101));}else{return _0x37f13a[_0x7f7a('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x443ec2,_0x4ff45d,_0x4d088f){var _0x379c54;delete _0x443ec2[_0x7f7a('0x4c')]['id'];return db[_0x7f7a('0x2e')][_0x7f7a('0x89')]({'where':{'id':_0x443ec2[_0x7f7a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ff45d,null))[_0x7f7a('0x25')](function(_0x47d6df){if(_0x47d6df){return db[_0x7f7a('0x8a')]['transaction'](function(_0x2e6a1b){return db['CmCustomField'][_0x7f7a('0x4b')](_0x443ec2['body'],{'transaction':_0x2e6a1b})[_0x7f7a('0x25')](function(_0x25003f){_0x379c54=_0x25003f;return _0x47d6df['addCustomFields'](_0x25003f,{'transaction':_0x2e6a1b});})[_0x7f7a('0x25')](function(){var _0x3a86af={'type':db[_0x7f7a('0x8b')][_0x7f7a('0x8c')],'transaction':_0x2e6a1b};switch(_0x443ec2['body'][_0x7f7a('0x31')]){case'text':_0x3a86af['type']=db[_0x7f7a('0x8b')][_0x7f7a('0x8c')];break;case _0x7f7a('0x8d'):_0x3a86af[_0x7f7a('0x31')]=db['Sequelize'][_0x7f7a('0x8e')];break;case _0x7f7a('0x8f'):_0x3a86af[_0x7f7a('0x31')]=db[_0x7f7a('0x8b')][_0x7f7a('0x90')];_0x3a86af[_0x7f7a('0x91')]=![];break;default:}return db[_0x7f7a('0x8a')][_0x7f7a('0x92')]['addColumn'](_0x7f7a('0x71'),util['format'](_0x7f7a('0x93'),_0x379c54['id']),_0x3a86af);})[_0x7f7a('0x25')](function(){return _0x379c54;});});}})['then'](respondWithResult(_0x4ff45d,null))[_0x7f7a('0x46')](handleError(_0x4ff45d,null));};exports[_0x7f7a('0x94')]=function(_0x3fe552,_0x44250b,_0x3f394d){var _0x1b1bbe={};var _0x5f0cc5={};var _0x2b8454;var _0x5c699d;return db[_0x7f7a('0x2e')][_0x7f7a('0x89')]({'where':{'id':_0x3fe552[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x44250b,null))[_0x7f7a('0x25')](function(_0x1c23f2){if(_0x1c23f2){_0x2b8454=_0x1c23f2;_0x5f0cc5[_0x7f7a('0x33')]=_[_0x7f7a('0x49')](db[_0x7f7a('0x68')][_0x7f7a('0x2f')]);_0x5f0cc5['query']=_[_0x7f7a('0x49')](_0x3fe552['query']);_0x5f0cc5[_0x7f7a('0x3d')]=_['intersection'](_0x5f0cc5['model'],_0x5f0cc5['query']);_0x1b1bbe['attributes']=_['intersection'](_0x5f0cc5[_0x7f7a('0x33')],qs[_0x7f7a('0x37')](_0x3fe552[_0x7f7a('0x34')][_0x7f7a('0x37')]));_0x1b1bbe[_0x7f7a('0x36')]=_0x1b1bbe['attributes'][_0x7f7a('0x38')]?_0x1b1bbe[_0x7f7a('0x36')]:_0x5f0cc5[_0x7f7a('0x33')];_0x1b1bbe[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0x3fe552['query'][_0x7f7a('0x3c')]);_0x1b1bbe['where']=qs[_0x7f7a('0x3d')](_[_0x7f7a('0x3e')](_0x3fe552[_0x7f7a('0x34')],_0x5f0cc5[_0x7f7a('0x3d')]));_0x1b1bbe[_0x7f7a('0x3f')]=_[_0x7f7a('0x4a')](_0x1b1bbe[_0x7f7a('0x3f')],{'$or':[{'ListId':_0x1c23f2['id']},{'ListId':null}]});if(_0x3fe552['query']['filter']){_0x1b1bbe[_0x7f7a('0x3f')]=_[_0x7f7a('0x4a')](_0x1b1bbe[_0x7f7a('0x3f')],{'$or':_[_0x7f7a('0x2d')](_0x1b1bbe[_0x7f7a('0x36')],function(_0x20f4d3){var _0x1ef441={};_0x1ef441[_0x20f4d3]={'$like':'%'+_0x3fe552[_0x7f7a('0x34')][_0x7f7a('0x41')]+'%'};return _0x1ef441;})});}_0x1b1bbe=_[_0x7f7a('0x4a')]({},_0x1b1bbe,_0x3fe552[_0x7f7a('0x42')]);return db['CmCustomField']['findAndCountAll'](_0x1b1bbe);}})[_0x7f7a('0x25')](respondWithResult(_0x44250b,null))[_0x7f7a('0x46')](handleError(_0x44250b,null));};exports['getGlobalCustomFields']=function(_0x478553,_0x135076){return db[_0x7f7a('0x68')][_0x7f7a('0x95')]({'where':{'ListId':null}})[_0x7f7a('0x25')](handleEntityNotFound(_0x135076,null))[_0x7f7a('0x25')](function(_0x1bfa8e){return _0x1bfa8e;})['then'](respondWithResult(_0x135076,null))[_0x7f7a('0x46')](handleError(_0x135076,null));};exports['addAgents']=function(_0x4b7c67,_0x32b5e5,_0x5bed3e){return db[_0x7f7a('0x2e')][_0x7f7a('0x56')]({'where':{'id':_0x4b7c67['params']['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x32b5e5,null))['then'](function(_0x2b2a30){if(_0x2b2a30){return _0x2b2a30[_0x7f7a('0x96')](_0x4b7c67[_0x7f7a('0x4c')]['ids'],_[_0x7f7a('0x62')](_0x4b7c67[_0x7f7a('0x4c')],[_0x7f7a('0x5b'),'id'])||{})['spread'](function(_0x6685d9){for(var _0x1cade0=0x0;_0x1cade0<_0x4b7c67['body']['ids'][_0x7f7a('0x38')];_0x1cade0+=0x1){socket['emit'](_0x7f7a('0x97'),{'UserId':Number(_0x4b7c67[_0x7f7a('0x4c')][_0x7f7a('0x5b')][_0x1cade0]),'CmListId':Number(_0x4b7c67[_0x7f7a('0x48')]['id'])});}return _0x6685d9;});}})[_0x7f7a('0x25')](respondWithResult(_0x32b5e5,null))[_0x7f7a('0x46')](handleError(_0x32b5e5,null));};exports[_0x7f7a('0x98')]=function(_0x5b1e00,_0x4177ed,_0x38ce78){return db[_0x7f7a('0x2e')][_0x7f7a('0x56')]({'where':{'id':_0x5b1e00[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x4177ed,null))['then'](function(_0x30f346){if(_0x30f346){return _0x30f346[_0x7f7a('0x98')](_0x5b1e00[_0x7f7a('0x34')][_0x7f7a('0x5b')])[_0x7f7a('0x25')](function(){if(_[_0x7f7a('0x5f')](_0x5b1e00['query'][_0x7f7a('0x5b')])){for(var _0x5459a3=0x0;_0x5459a3<_0x5b1e00[_0x7f7a('0x34')][_0x7f7a('0x5b')][_0x7f7a('0x38')];_0x5459a3+=0x1){socket[_0x7f7a('0x99')](_0x7f7a('0x9a'),{'UserId':Number(_0x5b1e00[_0x7f7a('0x34')][_0x7f7a('0x5b')][_0x5459a3]),'CmListId':Number(_0x5b1e00['params']['id'])});}}else{socket[_0x7f7a('0x99')]('userCmList:remove',{'UserId':Number(_0x5b1e00[_0x7f7a('0x34')]['ids']),'CmListId':Number(_0x5b1e00[_0x7f7a('0x48')]['id'])});}});}})[_0x7f7a('0x25')](respondWithStatusCode(_0x4177ed,null))[_0x7f7a('0x46')](handleError(_0x4177ed,null));};exports[_0x7f7a('0x9b')]=function(_0x315dd1,_0x31ed3f,_0x503832){var _0x4981a9={};var _0x4c66d9={};var _0x57bf57;var _0x300cbc;return db['CmList'][_0x7f7a('0x89')]({'where':{'id':_0x315dd1[_0x7f7a('0x48')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x31ed3f,null))[_0x7f7a('0x25')](function(_0x3fc5f8){if(_0x3fc5f8){_0x57bf57=_0x3fc5f8;_0x4c66d9[_0x7f7a('0x33')]=_[_0x7f7a('0x49')](db[_0x7f7a('0x9c')][_0x7f7a('0x2f')]);_0x4c66d9[_0x7f7a('0x34')]=_['keys'](_0x315dd1[_0x7f7a('0x34')]);_0x4c66d9['filters']=_['intersection'](_0x4c66d9[_0x7f7a('0x33')],_0x4c66d9[_0x7f7a('0x34')]);_0x4981a9[_0x7f7a('0x36')]=_[_0x7f7a('0x35')](_0x4c66d9[_0x7f7a('0x33')],qs[_0x7f7a('0x37')](_0x315dd1[_0x7f7a('0x34')]['fields']));_0x4981a9['attributes']=_0x4981a9[_0x7f7a('0x36')][_0x7f7a('0x38')]?_0x4981a9[_0x7f7a('0x36')]:_0x4c66d9[_0x7f7a('0x33')];_0x4981a9[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0x315dd1[_0x7f7a('0x34')][_0x7f7a('0x3c')]);_0x4981a9[_0x7f7a('0x3f')]=qs[_0x7f7a('0x3d')](_['pick'](_0x315dd1[_0x7f7a('0x34')],_0x4c66d9[_0x7f7a('0x3d')]));if(_0x315dd1[_0x7f7a('0x34')][_0x7f7a('0x41')]){_0x4981a9[_0x7f7a('0x3f')]=_[_0x7f7a('0x4a')](_0x4981a9['where'],{'$or':_['map'](_0x4981a9[_0x7f7a('0x36')],function(_0x442b41){var _0x5608cb={};_0x5608cb[_0x442b41]={'$like':'%'+_0x315dd1[_0x7f7a('0x34')]['filter']+'%'};return _0x5608cb;})});}_0x4981a9=_[_0x7f7a('0x4a')]({},_0x4981a9,_0x315dd1[_0x7f7a('0x42')]);return _0x57bf57[_0x7f7a('0x9b')](_0x4981a9);}})[_0x7f7a('0x25')](function(_0x5d8671){if(_0x5d8671){_0x300cbc=_0x5d8671[_0x7f7a('0x38')];if(!_0x315dd1[_0x7f7a('0x34')][_0x7f7a('0x39')](_0x7f7a('0x3a'))){_0x4981a9[_0x7f7a('0x1f')]=qs[_0x7f7a('0x1f')](_0x315dd1['query'][_0x7f7a('0x1f')]);_0x4981a9[_0x7f7a('0x1d')]=qs[_0x7f7a('0x1d')](_0x315dd1[_0x7f7a('0x34')][_0x7f7a('0x1d')]);}return _0x57bf57['getAgents'](_0x4981a9);}})[_0x7f7a('0x25')](function(_0x4ac4b3){if(_0x4ac4b3){return _0x4ac4b3?{'count':_0x300cbc,'rows':_0x4ac4b3}:null;}})[_0x7f7a('0x25')](respondWithResult(_0x31ed3f,null))[_0x7f7a('0x46')](handleError(_0x31ed3f,null));};function handleQuery(_0x1c279e){logger[_0x7f7a('0x9d')](_0x1c279e);return db[_0x7f7a('0x8a')][_0x7f7a('0x34')](_0x1c279e)[_0x7f7a('0x9e')](function(_0x3e39b5){csv_results[_0x7f7a('0x61')](_0x3e39b5);})[_0x7f7a('0x46')](function(_0x3a4956){logger[_0x7f7a('0x29')](_0x3a4956[_0x7f7a('0x66')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b8e1bda..ca43d88 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x5fc3[_0x1ee62e];return _0x27c6c8;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7c47b8d..183c027 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 _0xb4e6=['path','rimraf','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ef51c,_0x4d72ca){var _0x11ec15=function(_0x4b3849){while(--_0x4b3849){_0x3ef51c['push'](_0x3ef51c['shift']());}};_0x11ec15(++_0x4d72ca);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0xb4e6[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x366fc7,_0x37779a){var _0x4570c0=function(_0x3bf3af){while(--_0x3bf3af){_0x366fc7['push'](_0x366fc7['shift']());}};_0x4570c0(++_0x37779a);}(_0x702d,0x147));var _0xd702=function(_0x2be8a6,_0x3da2f2){_0x2be8a6=_0x2be8a6-0x0;var _0x4f9983=_0x702d[_0x2be8a6];return _0x4f9983;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 22b06bb..eab8726 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 _0x5cf1=['redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','CmList,\x20%s,\x20%s','message','catch','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults'];(function(_0x2ae3e9,_0x151a3a){var _0x3e1eb3=function(_0x1c3c4c){while(--_0x1c3c4c){_0x2ae3e9['push'](_0x2ae3e9['shift']());}};_0x3e1eb3(++_0x151a3a);}(_0x5cf1,0x8b));var _0x15cf=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0x5cf1[_0x4f74a5];return _0x5be8b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15cf('0x0'));var BPromise=require(_0x15cf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15cf('0x2'));var logger=require(_0x15cf('0x3'))(_0x15cf('0x4'));var config=require('../../config/environment');var jayson=require(_0x15cf('0x5'));var client=jayson[_0x15cf('0x6')]['http']({'port':0x232a});config['redis']=_[_0x15cf('0x7')](config[_0x15cf('0x8')],{'host':_0x15cf('0x9'),'port':0x18eb});var socket=require(_0x15cf('0xa'))(new Redis(config[_0x15cf('0x8')]));require(_0x15cf('0xb'))[_0x15cf('0xc')](socket);function respondWithRpcPromise(_0x47bda7,_0x11e223,_0x1ff1fe){return new BPromise(function(_0x5239e2,_0x3d0e20){return client[_0x15cf('0xd')](_0x47bda7,_0x1ff1fe)['then'](function(_0x5beb00){logger[_0x15cf('0xe')]('CmList,\x20%s,\x20%s',_0x11e223,_0x15cf('0xf'));logger['debug'](_0x15cf('0x10'),_0x11e223,_0x15cf('0xf'),JSON['stringify'](_0x5beb00));if(_0x5beb00[_0x15cf('0x11')]){if(_0x5beb00[_0x15cf('0x11')]['code']===0x1f4){logger[_0x15cf('0x11')](_0x15cf('0x12'),_0x11e223,_0x5beb00['error'][_0x15cf('0x13')]);return _0x3d0e20(_0x5beb00[_0x15cf('0x11')][_0x15cf('0x13')]);}logger['error'](_0x15cf('0x12'),_0x11e223,_0x5beb00[_0x15cf('0x11')]['message']);return _0x5239e2(_0x5beb00[_0x15cf('0x11')][_0x15cf('0x13')]);}else{logger[_0x15cf('0xe')](_0x15cf('0x12'),_0x11e223,'request\x20sent');_0x5239e2(_0x5beb00['result'][_0x15cf('0x13')]);}})[_0x15cf('0x14')](function(_0x448d9a){logger['error'](_0x15cf('0x12'),_0x11e223,_0x448d9a);_0x3d0e20(_0x448d9a);});});} \ No newline at end of file +var _0x3a8c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x138e0a,_0x431db7){var _0x24ef77=function(_0x47a3a9){while(--_0x47a3a9){_0x138e0a['push'](_0x138e0a['shift']());}};_0x24ef77(++_0x431db7);}(_0x3a8c,0xa8));var _0xc3a8=function(_0x1f3eb7,_0x54224e){_0x1f3eb7=_0x1f3eb7-0x0;var _0xe8544d=_0x3a8c[_0x1f3eb7];return _0xe8544d;};'use strict';var _=require(_0xc3a8('0x0'));var util=require(_0xc3a8('0x1'));var moment=require(_0xc3a8('0x2'));var BPromise=require(_0xc3a8('0x3'));var rs=require(_0xc3a8('0x4'));var fs=require('fs');var Redis=require(_0xc3a8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3a8('0x6'));var logger=require(_0xc3a8('0x7'))(_0xc3a8('0x8'));var config=require(_0xc3a8('0x9'));var jayson=require(_0xc3a8('0xa'));var client=jayson[_0xc3a8('0xb')][_0xc3a8('0xc')]({'port':0x232a});config[_0xc3a8('0xd')]=_[_0xc3a8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc3a8('0xf'))(new Redis(config[_0xc3a8('0xd')]));require('./cmList.socket')[_0xc3a8('0x10')](socket);function respondWithRpcPromise(_0x16ba27,_0x31563a,_0x2b8f32){return new BPromise(function(_0x26ccb1,_0x728539){return client['request'](_0x16ba27,_0x2b8f32)[_0xc3a8('0x11')](function(_0x470433){logger[_0xc3a8('0x12')](_0xc3a8('0x13'),_0x31563a,_0xc3a8('0x14'));logger[_0xc3a8('0x15')](_0xc3a8('0x16'),_0x31563a,'request\x20sent',JSON[_0xc3a8('0x17')](_0x470433));if(_0x470433['error']){if(_0x470433[_0xc3a8('0x18')][_0xc3a8('0x19')]===0x1f4){logger['error'](_0xc3a8('0x13'),_0x31563a,_0x470433['error'][_0xc3a8('0x1a')]);return _0x728539(_0x470433[_0xc3a8('0x18')]['message']);}logger[_0xc3a8('0x18')](_0xc3a8('0x13'),_0x31563a,_0x470433[_0xc3a8('0x18')][_0xc3a8('0x1a')]);return _0x26ccb1(_0x470433[_0xc3a8('0x18')][_0xc3a8('0x1a')]);}else{logger[_0xc3a8('0x12')](_0xc3a8('0x13'),_0x31563a,_0xc3a8('0x14'));_0x26ccb1(_0x470433[_0xc3a8('0x1b')]['message']);}})[_0xc3a8('0x1c')](function(_0x519f96){logger[_0xc3a8('0x18')](_0xc3a8('0x13'),_0x31563a,_0x519f96);_0x728539(_0x519f96);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6131df3..cee4543 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 _0x6227=['register','length','cmList:','./cmList.events','update','emit','removeListener'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x6227,0x1ca));var _0x7622=function(_0x44f9f3,_0x3417c8){_0x44f9f3=_0x44f9f3-0x0;var _0x29bb75=_0x6227[_0x44f9f3];return _0x29bb75;};'use strict';var CmListEvents=require(_0x7622('0x0'));var events=['save','remove',_0x7622('0x1')];function createListener(_0x2e9387,_0x3e8d49){return function(_0x3f04f8){_0x3e8d49[_0x7622('0x2')](_0x2e9387,_0x3f04f8);};}function removeListener(_0x191800,_0x153732){return function(){CmListEvents[_0x7622('0x3')](_0x191800,_0x153732);};}exports[_0x7622('0x4')]=function(_0x4e063c){for(var _0x784fed=0x0,_0x4be9d7=events[_0x7622('0x5')];_0x784fed<_0x4be9d7;_0x784fed++){var _0x224da0=events[_0x784fed];var _0xec439=createListener(_0x7622('0x6')+_0x224da0,_0x4e063c);CmListEvents['on'](_0x224da0,_0xec439);}}; \ No newline at end of file +var _0xd68f=['./cmList.events','remove','update','emit','length','cmList:'];(function(_0x90ab52,_0x21ca17){var _0x1891fb=function(_0x2c97b4){while(--_0x2c97b4){_0x90ab52['push'](_0x90ab52['shift']());}};_0x1891fb(++_0x21ca17);}(_0xd68f,0x168));var _0xfd68=function(_0x28c26f,_0x91f3c7){_0x28c26f=_0x28c26f-0x0;var _0x284a74=_0xd68f[_0x28c26f];return _0x284a74;};'use strict';var CmListEvents=require(_0xfd68('0x0'));var events=['save',_0xfd68('0x1'),_0xfd68('0x2')];function createListener(_0x7df610,_0x3d2c43){return function(_0x2ed083){_0x3d2c43[_0xfd68('0x3')](_0x7df610,_0x2ed083);};}function removeListener(_0x3e15e5,_0x50ec72){return function(){CmListEvents['removeListener'](_0x3e15e5,_0x50ec72);};}exports['register']=function(_0x376248){for(var _0xc97d36=0x0,_0x263238=events[_0xfd68('0x4')];_0xc97d36<_0x263238;_0xc97d36++){var _0x10d102=events[_0xc97d36];var _0x3b18c8=createListener(_0xfd68('0x5')+_0x10d102,_0x376248);CmListEvents['on'](_0x10d102,_0x3b18c8);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6ed7a89..29e2e07 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 _0x0431=['getAgents','post','create','/:id/contacts','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users'];(function(_0x5e2576,_0x4344a7){var _0x2d2655=function(_0x1945b2){while(--_0x1945b2){_0x5e2576['push'](_0x5e2576['shift']());}};_0x2d2655(++_0x4344a7);}(_0x0431,0x11d));var _0x1043=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x0431[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0x1043('0x0'));var util=require(_0x1043('0x1'));var path=require(_0x1043('0x2'));var timeout=require(_0x1043('0x3'));var express=require(_0x1043('0x4'));var router=express['Router']();var fs_extra=require(_0x1043('0x5'));var auth=require(_0x1043('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1043('0x7'));var controller=require(_0x1043('0x8'));router[_0x1043('0x9')]('/',auth[_0x1043('0xa')](),controller['index']);router[_0x1043('0x9')]('/describe',auth[_0x1043('0xa')](),controller['describe']);router[_0x1043('0x9')]('/global_fields',auth[_0x1043('0xa')](),controller[_0x1043('0xb')]);router[_0x1043('0x9')](_0x1043('0xc'),auth[_0x1043('0xa')](),controller[_0x1043('0xd')]);router[_0x1043('0x9')](_0x1043('0xe'),auth['isAuthenticated'](),controller[_0x1043('0xf')]);router['get']('/:id/contacts',auth[_0x1043('0xa')](),controller[_0x1043('0x10')]);router[_0x1043('0x9')](_0x1043('0x11'),auth['isAuthenticated'](),controller[_0x1043('0x12')]);router[_0x1043('0x9')](_0x1043('0x13'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x1043('0x9')](_0x1043('0x14'),auth[_0x1043('0xa')](),controller[_0x1043('0x15')]);router[_0x1043('0x16')]('/',auth[_0x1043('0xa')](),controller[_0x1043('0x17')]);router[_0x1043('0x16')](_0x1043('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x1043('0x18'),auth[_0x1043('0xa')](),controller[_0x1043('0x19')]);router['post'](_0x1043('0x13'),auth['isAuthenticated'](),controller[_0x1043('0x1a')]);router[_0x1043('0x16')](_0x1043('0x14'),auth[_0x1043('0xa')](),controller[_0x1043('0x1b')]);router['put']('/:id',auth[_0x1043('0xa')](),controller[_0x1043('0x1c')]);router[_0x1043('0x1d')](_0x1043('0xc'),auth['isAuthenticated'](),controller[_0x1043('0x1e')]);router['delete'](_0x1043('0xe'),auth['isAuthenticated'](),controller[_0x1043('0x1f')]);router[_0x1043('0x1d')](_0x1043('0x14'),auth[_0x1043('0xa')](),controller[_0x1043('0x20')]);module[_0x1043('0x21')]=router; \ No newline at end of file +var _0x121d=['update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','addDisposition','addContacts','/:id/fields','/:id/users','put','/:id'];(function(_0x3bb46a,_0x4d3a51){var _0xf30f8f=function(_0xb55d1e){while(--_0xb55d1e){_0x3bb46a['push'](_0x3bb46a['shift']());}};_0xf30f8f(++_0x4d3a51);}(_0x121d,0xea));var _0xd121=function(_0x99d0d1,_0x5a7985){_0x99d0d1=_0x99d0d1-0x0;var _0x3dc55e=_0x121d[_0x99d0d1];return _0x3dc55e;};'use strict';var multer=require(_0xd121('0x0'));var util=require(_0xd121('0x1'));var path=require(_0xd121('0x2'));var timeout=require(_0xd121('0x3'));var express=require(_0xd121('0x4'));var router=express[_0xd121('0x5')]();var fs_extra=require(_0xd121('0x6'));var auth=require(_0xd121('0x7'));var interaction=require(_0xd121('0x8'));var config=require(_0xd121('0x9'));var controller=require(_0xd121('0xa'));router[_0xd121('0xb')]('/',auth[_0xd121('0xc')](),controller[_0xd121('0xd')]);router['get'](_0xd121('0xe'),auth['isAuthenticated'](),controller[_0xd121('0xf')]);router['get'](_0xd121('0x10'),auth[_0xd121('0xc')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0xd121('0xc')](),controller[_0xd121('0x11')]);router[_0xd121('0xb')](_0xd121('0x12'),auth[_0xd121('0xc')](),controller[_0xd121('0x13')]);router[_0xd121('0xb')]('/:id/contacts',auth[_0xd121('0xc')](),controller[_0xd121('0x14')]);router['get'](_0xd121('0x15'),auth[_0xd121('0xc')](),controller[_0xd121('0x16')]);router[_0xd121('0xb')]('/:id/fields',auth[_0xd121('0xc')](),controller[_0xd121('0x17')]);router[_0xd121('0xb')]('/:id/users',auth[_0xd121('0xc')](),controller[_0xd121('0x18')]);router['post']('/',auth[_0xd121('0xc')](),controller['create']);router[_0xd121('0x19')](_0xd121('0x12'),auth[_0xd121('0xc')](),controller[_0xd121('0x1a')]);router['post']('/:id/contacts',auth[_0xd121('0xc')](),controller[_0xd121('0x1b')]);router['post'](_0xd121('0x1c'),auth['isAuthenticated'](),controller['addCustomField']);router['post'](_0xd121('0x1d'),auth[_0xd121('0xc')](),controller['addAgents']);router[_0xd121('0x1e')](_0xd121('0x1f'),auth[_0xd121('0xc')](),controller[_0xd121('0x20')]);router[_0xd121('0x21')]('/:id',auth[_0xd121('0xc')](),controller[_0xd121('0x22')]);router['delete'](_0xd121('0x12'),auth['isAuthenticated'](),controller[_0xd121('0x23')]);router[_0xd121('0x21')](_0xd121('0x1d'),auth[_0xd121('0xc')](),controller[_0xd121('0x24')]);module[_0xd121('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7c3832d..99dbf63 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 _0x971f=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x971f,0x1a3));var _0xf971=function(_0x143168,_0x499827){_0x143168=_0x143168-0x0;var _0x4aa79f=_0x971f[_0x143168];return _0x4aa79f;};'use strict';var Sequelize=require('sequelize');module[_0xf971('0x0')]={'name':{'type':Sequelize[_0xf971('0x1')],'get':function(_0x2620f4){return this[_0xf971('0x2')](_0xf971('0x3'));}},'field':{'type':Sequelize[_0xf971('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf971('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd47b=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x25f41f,_0x47465e){var _0x1bcebe=function(_0x2e0b90){while(--_0x2e0b90){_0x25f41f['push'](_0x25f41f['shift']());}};_0x1bcebe(++_0x47465e);}(_0xd47b,0x1ba));var _0xbd47=function(_0x583b3b,_0x31271d){_0x583b3b=_0x583b3b-0x0;var _0xcdb6d0=_0xd47b[_0x583b3b];return _0xcdb6d0;};'use strict';var Sequelize=require(_0xbd47('0x0'));module[_0xbd47('0x1')]={'name':{'type':Sequelize[_0xbd47('0x2')],'get':function(_0x5a1c42){return this[_0xbd47('0x3')](_0xbd47('0x4'));}},'field':{'type':Sequelize[_0xbd47('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xbd47('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 827c7f2..95e2892 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5418ac,_0x252c9b){var _0x35eff8=function(_0x4f9695){while(--_0x4f9695){_0x5418ac['push'](_0x5418ac['shift']());}};_0x35eff8(++_0x252c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x3f159e,_0x335c13){_0x3f159e=_0x3f159e-0x0;var _0x1ec786=_0x7a54[_0x3f159e];return _0x1ec786;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x55472b,_0x2845b5){var _0x466eb3=function(_0x51bc74){while(--_0x51bc74){_0x55472b['push'](_0x55472b['shift']());}};_0x466eb3(++_0x2845b5);}(_0x7a54,0x106));var _0x47a5=function(_0x514b2e,_0xb48d85){_0x514b2e=_0x514b2e-0x0;var _0x4219a2=_0x7a54[_0x514b2e];return _0x4219a2;};'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 a24037d..e53ca88 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 _0x2bb5=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util'];(function(_0x584852,_0x50b8a5){var _0x47efc9=function(_0x3c363f){while(--_0x3c363f){_0x584852['push'](_0x584852['shift']());}};_0x47efc9(++_0x50b8a5);}(_0x2bb5,0xb2));var _0x52bb=function(_0x430ea6,_0x58db3b){_0x430ea6=_0x430ea6-0x0;var _0x8c837=_0x2bb5[_0x430ea6];return _0x8c837;};'use strict';var _=require(_0x52bb('0x0'));var util=require(_0x52bb('0x1'));var logger=require(_0x52bb('0x2'))('api');var moment=require(_0x52bb('0x3'));var BPromise=require(_0x52bb('0x4'));var rp=require(_0x52bb('0x5'));var fs=require('fs');var path=require(_0x52bb('0x6'));var rimraf=require('rimraf');var config=require(_0x52bb('0x7'));var attributes=require(_0x52bb('0x8'));module[_0x52bb('0x9')]=function(_0x47a5f,_0x2972c7){return _0x47a5f[_0x52bb('0xa')](_0x52bb('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e05=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./condition.attributes','define','Condition'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7e05,0x186));var _0x57e0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7e05[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x57e0('0x0'));var util=require('util');var logger=require(_0x57e0('0x1'))(_0x57e0('0x2'));var moment=require(_0x57e0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57e0('0x4'));var rimraf=require(_0x57e0('0x5'));var config=require(_0x57e0('0x6'));var attributes=require(_0x57e0('0x7'));module['exports']=function(_0x12b483,_0x3d9bcb){return _0x12b483[_0x57e0('0x8')](_0x57e0('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 77bed53..02949fd 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 _0xcfac=['message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x3ed5b0,_0x5cd3e6){var _0xa24ce8=function(_0xb8a46f){while(--_0xb8a46f){_0x3ed5b0['push'](_0x3ed5b0['shift']());}};_0xa24ce8(++_0x5cd3e6);}(_0xcfac,0x70));var _0xccfa=function(_0x73e6ad,_0x1d5752){_0x73e6ad=_0x73e6ad-0x0;var _0x4aa103=_0xcfac[_0x73e6ad];return _0x4aa103;};'use strict';var _=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var moment=require(_0xccfa('0x2'));var BPromise=require(_0xccfa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccfa('0x4'));var db=require(_0xccfa('0x5'))['db'];var utils=require(_0xccfa('0x6'));var logger=require(_0xccfa('0x7'))(_0xccfa('0x8'));var config=require(_0xccfa('0x9'));var jayson=require(_0xccfa('0xa'));var client=jayson[_0xccfa('0xb')][_0xccfa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x783536,_0x8d37be,_0x5a7972){return new BPromise(function(_0x1ca28a,_0x5d5ae1){return client[_0xccfa('0xd')](_0x783536,_0x5a7972)[_0xccfa('0xe')](function(_0x2666d0){logger['info'](_0xccfa('0xf'),_0x8d37be,'request\x20sent');logger[_0xccfa('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x8d37be,_0xccfa('0x11'),JSON['stringify'](_0x2666d0));if(_0x2666d0[_0xccfa('0x12')]){if(_0x2666d0[_0xccfa('0x12')][_0xccfa('0x13')]===0x1f4){logger[_0xccfa('0x12')](_0xccfa('0xf'),_0x8d37be,_0x2666d0[_0xccfa('0x12')][_0xccfa('0x14')]);return _0x5d5ae1(_0x2666d0[_0xccfa('0x12')][_0xccfa('0x14')]);}logger[_0xccfa('0x12')](_0xccfa('0xf'),_0x8d37be,_0x2666d0[_0xccfa('0x12')][_0xccfa('0x14')]);return _0x1ca28a(_0x2666d0[_0xccfa('0x12')][_0xccfa('0x14')]);}else{logger[_0xccfa('0x15')](_0xccfa('0xf'),_0x8d37be,'request\x20sent');_0x1ca28a(_0x2666d0['result'][_0xccfa('0x14')]);}})['catch'](function(_0x58dca5){logger[_0xccfa('0x12')](_0xccfa('0xf'),_0x8d37be,_0x58dca5);_0x5d5ae1(_0x58dca5);});});} \ No newline at end of file +var _0xf278=['Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x394c4c,_0x201031){var _0x5bfa5a=function(_0x4a5eed){while(--_0x4a5eed){_0x394c4c['push'](_0x394c4c['shift']());}};_0x5bfa5a(++_0x201031);}(_0xf278,0x16e));var _0x8f27=function(_0x65c597,_0x39e7e0){_0x65c597=_0x65c597-0x0;var _0x1ec368=_0xf278[_0x65c597];return _0x1ec368;};'use strict';var _=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var moment=require(_0x8f27('0x2'));var BPromise=require(_0x8f27('0x3'));var rs=require(_0x8f27('0x4'));var fs=require('fs');var Redis=require(_0x8f27('0x5'));var db=require(_0x8f27('0x6'))['db'];var utils=require(_0x8f27('0x7'));var logger=require(_0x8f27('0x8'))(_0x8f27('0x9'));var config=require(_0x8f27('0xa'));var jayson=require(_0x8f27('0xb'));var client=jayson[_0x8f27('0xc')][_0x8f27('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26877f,_0x374f80,_0x2d2315){return new BPromise(function(_0x59c7e9,_0x14eb5c){return client['request'](_0x26877f,_0x2d2315)['then'](function(_0x45c8ec){logger[_0x8f27('0xe')](_0x8f27('0xf'),_0x374f80,_0x8f27('0x10'));logger[_0x8f27('0x11')](_0x8f27('0x12'),_0x374f80,'request\x20sent',JSON['stringify'](_0x45c8ec));if(_0x45c8ec[_0x8f27('0x13')]){if(_0x45c8ec[_0x8f27('0x13')][_0x8f27('0x14')]===0x1f4){logger[_0x8f27('0x13')](_0x8f27('0xf'),_0x374f80,_0x45c8ec['error'][_0x8f27('0x15')]);return _0x14eb5c(_0x45c8ec[_0x8f27('0x13')][_0x8f27('0x15')]);}logger[_0x8f27('0x13')](_0x8f27('0xf'),_0x374f80,_0x45c8ec[_0x8f27('0x13')][_0x8f27('0x15')]);return _0x59c7e9(_0x45c8ec['error'][_0x8f27('0x15')]);}else{logger[_0x8f27('0xe')](_0x8f27('0xf'),_0x374f80,'request\x20sent');_0x59c7e9(_0x45c8ec[_0x8f27('0x16')][_0x8f27('0x15')]);}})[_0x8f27('0x17')](function(_0x34310d){logger['error'](_0x8f27('0xf'),_0x374f80,_0x34310d);_0x14eb5c(_0x34310d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a1fe76e..edf84e8 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 _0x7727=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x31e899,_0x251b48){var _0x51d16b=function(_0x19180c){while(--_0x19180c){_0x31e899['push'](_0x31e899['shift']());}};_0x51d16b(++_0x251b48);}(_0x7727,0x199));var _0x7772=function(_0x4edaf1,_0x3c0639){_0x4edaf1=_0x4edaf1-0x0;var _0x4c4a2a=_0x7727[_0x4edaf1];return _0x4c4a2a;};'use strict';var multer=require(_0x7772('0x0'));var util=require(_0x7772('0x1'));var path=require(_0x7772('0x2'));var timeout=require(_0x7772('0x3'));var express=require('express');var router=express[_0x7772('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7772('0x5'));var interaction=require(_0x7772('0x6'));var config=require(_0x7772('0x7'));var controller=require(_0x7772('0x8'));router[_0x7772('0x9')](_0x7772('0xa'),auth[_0x7772('0xb')](),controller[_0x7772('0xc')]);router['delete'](_0x7772('0xa'),auth[_0x7772('0xb')](),controller[_0x7772('0xd')]);module[_0x7772('0xe')]=router; \ No newline at end of file +var _0x22f2=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5663ec,_0x3007b6){var _0x1977a3=function(_0xf2bcda){while(--_0xf2bcda){_0x5663ec['push'](_0x5663ec['shift']());}};_0x1977a3(++_0x3007b6);}(_0x22f2,0x98));var _0x222f=function(_0x26cd6f,_0xc578c){_0x26cd6f=_0x26cd6f-0x0;var _0x555953=_0x22f2[_0x26cd6f];return _0x555953;};'use strict';var multer=require(_0x222f('0x0'));var util=require(_0x222f('0x1'));var path=require(_0x222f('0x2'));var timeout=require(_0x222f('0x3'));var express=require('express');var router=express[_0x222f('0x4')]();var fs_extra=require(_0x222f('0x5'));var auth=require(_0x222f('0x6'));var interaction=require(_0x222f('0x7'));var config=require(_0x222f('0x8'));var controller=require(_0x222f('0x9'));router[_0x222f('0xa')](_0x222f('0xb'),auth[_0x222f('0xc')](),controller[_0x222f('0xd')]);router[_0x222f('0xe')](_0x222f('0xb'),auth[_0x222f('0xc')](),controller['destroy']);module[_0x222f('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 0991a15..f8a79f7 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 _0x7254=['sequelize','exports','STRING','name'];(function(_0x5f2faf,_0x2d3480){var _0xa2551=function(_0x3d3c6d){while(--_0x3d3c6d){_0x5f2faf['push'](_0x5f2faf['shift']());}};_0xa2551(++_0x2d3480);}(_0x7254,0x1b8));var _0x4725=function(_0x340690,_0x177106){_0x340690=_0x340690-0x0;var _0x152af1=_0x7254[_0x340690];return _0x152af1;};'use strict';var Sequelize=require(_0x4725('0x0'));module[_0x4725('0x1')]={'name':{'type':Sequelize[_0x4725('0x2')],'allowNull':![],'unique':_0x4725('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4725('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3057=['sequelize','exports','STRING','name'];(function(_0x2fff52,_0x1580ac){var _0x4fef52=function(_0x422782){while(--_0x422782){_0x2fff52['push'](_0x2fff52['shift']());}};_0x4fef52(++_0x1580ac);}(_0x3057,0xf8));var _0x7305=function(_0x576399,_0x149742){_0x576399=_0x576399-0x0;var _0xa8bcd3=_0x3057[_0x576399];return _0xa8bcd3;};'use strict';var Sequelize=require(_0x7305('0x0'));module[_0x7305('0x1')]={'name':{'type':Sequelize[_0x7305('0x2')],'allowNull':![],'unique':_0x7305('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7305('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 58e7f30..57b98e3 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 _0x5c3c=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','findAll','rows','catch','params','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0xec0bf7,_0x1b1ecd){var _0x54044d=function(_0x1f73fe){while(--_0x1f73fe){_0xec0bf7['push'](_0xec0bf7['shift']());}};_0x54044d(++_0x1b1ecd);}(_0x5c3c,0x132));var _0xc5c3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x5c3c[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){var _0x23e2fb=_0x38dd9e[_0xc5c3('0x24')]({'plain':!![]});var _0x38a3df='ContactItemTypes';return db['UserProfileResource'][_0xc5c3('0x25')]({'where':{'type':_0x38a3df,'resourceId':_0x23e2fb['id']}})[_0xc5c3('0x23')](function(){return _0x38dd9e;});})[_0xc5c3('0x23')](function(){_0x52d638[_0xc5c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21efd6,_0x5176c4){return function(_0x2eacec){if(!_0x2eacec){_0x21efd6['sendStatus'](0x194);}return _0x2eacec;};}function handleError(_0x1da259,_0x40d341){_0x40d341=_0x40d341||0x1f4;return function(_0x4269eb){logger[_0xc5c3('0x26')](_0x4269eb[_0xc5c3('0x27')]);if(_0x4269eb[_0xc5c3('0x28')]){delete _0x4269eb[_0xc5c3('0x28')];}_0x1da259['status'](_0x40d341)[_0xc5c3('0x29')](_0x4269eb);};}exports['index']=function(_0xc4b134,_0x43ebfc){var _0x5b26e9={},_0x4daa8b={},_0x2e648f={'count':0x0,'rows':[]};var _0x46f149=_[_0xc5c3('0x2a')](db[_0xc5c3('0x2b')]['rawAttributes'],function(_0x3f9591){return{'name':_0x3f9591[_0xc5c3('0x2c')],'type':_0x3f9591[_0xc5c3('0x2d')][_0xc5c3('0x2e')]};});_0x4daa8b[_0xc5c3('0x2f')]=_[_0xc5c3('0x2a')](_0x46f149,_0xc5c3('0x28'));_0x4daa8b[_0xc5c3('0x30')]=_[_0xc5c3('0x31')](_0xc4b134['query']);_0x4daa8b[_0xc5c3('0x32')]=_[_0xc5c3('0x33')](_0x4daa8b[_0xc5c3('0x2f')],_0x4daa8b[_0xc5c3('0x30')]);_0x5b26e9[_0xc5c3('0x34')]=_[_0xc5c3('0x33')](_0x4daa8b[_0xc5c3('0x2f')],qs['fields'](_0xc4b134['query'][_0xc5c3('0x35')]));_0x5b26e9['attributes']=_0x5b26e9[_0xc5c3('0x34')][_0xc5c3('0x36')]?_0x5b26e9[_0xc5c3('0x34')]:_0x4daa8b[_0xc5c3('0x2f')];if(!_0xc4b134[_0xc5c3('0x30')]['hasOwnProperty'](_0xc5c3('0x37'))){_0x5b26e9[_0xc5c3('0x1a')]=qs['limit'](_0xc4b134[_0xc5c3('0x30')][_0xc5c3('0x1a')]);_0x5b26e9[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0xc4b134[_0xc5c3('0x30')][_0xc5c3('0x1c')]);}_0x5b26e9[_0xc5c3('0x38')]=qs[_0xc5c3('0x39')](_0xc4b134[_0xc5c3('0x30')][_0xc5c3('0x39')]);_0x5b26e9['where']=qs[_0xc5c3('0x32')](_['pick'](_0xc4b134['query'],_0x4daa8b[_0xc5c3('0x32')]),_0x46f149);if(_0xc4b134[_0xc5c3('0x30')][_0xc5c3('0x3a')]){_0x5b26e9[_0xc5c3('0x3b')]=_[_0xc5c3('0x3c')](_0x5b26e9['where'],{'$or':_['map'](_0x46f149,function(_0x17e263){if(_0x17e263[_0xc5c3('0x2d')]!=='VIRTUAL'){var _0x3e12ee={};_0x3e12ee[_0x17e263['name']]={'$like':'%'+_0xc4b134[_0xc5c3('0x30')][_0xc5c3('0x3a')]+'%'};return _0x3e12ee;}})});}_0x5b26e9=_[_0xc5c3('0x3c')]({},_0x5b26e9,_0xc4b134['options']);var _0xca2b9a={'where':_0x5b26e9[_0xc5c3('0x3b')]};return db['ContactItemType'][_0xc5c3('0x1b')](_0xca2b9a)['then'](function(_0x33936c){_0x2e648f[_0xc5c3('0x1b')]=_0x33936c;if(_0xc4b134['query']['includeAll']){_0x5b26e9['include']=[{'all':!![]}];}return db[_0xc5c3('0x2b')][_0xc5c3('0x3d')](_0x5b26e9);})['then'](function(_0x1a8490){_0x2e648f[_0xc5c3('0x3e')]=_0x1a8490;return _0x2e648f;})[_0xc5c3('0x23')](respondWithFilteredResult(_0x43ebfc,_0x5b26e9))[_0xc5c3('0x3f')](handleError(_0x43ebfc,null));};exports['show']=function(_0x3688a9,_0x523fdf){var _0x585a3b={'raw':!![],'where':{'id':_0x3688a9[_0xc5c3('0x40')]['id']}},_0x1363fa={};_0x1363fa['model']=_[_0xc5c3('0x31')](db[_0xc5c3('0x2b')]['rawAttributes']);_0x1363fa[_0xc5c3('0x30')]=_['keys'](_0x3688a9[_0xc5c3('0x30')]);_0x1363fa[_0xc5c3('0x32')]=_['intersection'](_0x1363fa[_0xc5c3('0x2f')],_0x1363fa['query']);_0x585a3b[_0xc5c3('0x34')]=_[_0xc5c3('0x33')](_0x1363fa['model'],qs[_0xc5c3('0x35')](_0x3688a9[_0xc5c3('0x30')][_0xc5c3('0x35')]));_0x585a3b[_0xc5c3('0x34')]=_0x585a3b[_0xc5c3('0x34')][_0xc5c3('0x36')]?_0x585a3b['attributes']:_0x1363fa[_0xc5c3('0x2f')];if(_0x3688a9[_0xc5c3('0x30')][_0xc5c3('0x41')]){_0x585a3b[_0xc5c3('0x42')]=[{'all':!![]}];}_0x585a3b=_[_0xc5c3('0x3c')]({},_0x585a3b,_0x3688a9['options']);return db['ContactItemType'][_0xc5c3('0x43')](_0x585a3b)[_0xc5c3('0x23')](handleEntityNotFound(_0x523fdf,null))[_0xc5c3('0x23')](respondWithResult(_0x523fdf,null))['catch'](handleError(_0x523fdf,null));};exports[_0xc5c3('0x44')]=function(_0x65f720,_0x3a901f){return db[_0xc5c3('0x2b')][_0xc5c3('0x44')](_0x65f720[_0xc5c3('0x45')],{})[_0xc5c3('0x23')](function(_0x5ac7c8){var _0x259a4d=_0x65f720[_0xc5c3('0x46')][_0xc5c3('0x24')]({'plain':!![]});if(!_0x259a4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x259a4d[_0xc5c3('0x47')]===_0xc5c3('0x46')){var _0x3b1bc2=_0x5ac7c8[_0xc5c3('0x24')]({'plain':!![]});var _0x21d480='ContactItemTypes';return db[_0xc5c3('0x48')]['find']({'where':{'name':_0x21d480,'userProfileId':_0x259a4d[_0xc5c3('0x49')]},'raw':!![]})['then'](function(_0x2f7a0a){if(_0x2f7a0a&&_0x2f7a0a[_0xc5c3('0x4a')]===0x0){return db[_0xc5c3('0x4b')][_0xc5c3('0x44')]({'name':_0x3b1bc2[_0xc5c3('0x28')],'resourceId':_0x3b1bc2['id'],'type':_0x2f7a0a['name'],'sectionId':_0x2f7a0a['id']},{})[_0xc5c3('0x23')](function(){return _0x5ac7c8;});}else{return _0x5ac7c8;}})[_0xc5c3('0x3f')](function(_0x348960){logger[_0xc5c3('0x26')](_0xc5c3('0x4c'),_0x348960);throw _0x348960;});}return _0x5ac7c8;})['then'](respondWithResult(_0x3a901f,0xc9))[_0xc5c3('0x3f')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x22')]=function(_0x24ef39,_0x4d1ff8){if(_0x24ef39[_0xc5c3('0x45')]['id']){delete _0x24ef39['body']['id'];}return db['ContactItemType'][_0xc5c3('0x43')]({'where':{'id':_0x24ef39[_0xc5c3('0x40')]['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x4d1ff8,null))[_0xc5c3('0x23')](saveUpdates(_0x24ef39[_0xc5c3('0x45')],null))[_0xc5c3('0x23')](respondWithResult(_0x4d1ff8,null))['catch'](handleError(_0x4d1ff8,null));};exports[_0xc5c3('0x25')]=function(_0x1ad3aa,_0x260f12){return db[_0xc5c3('0x2b')][_0xc5c3('0x43')]({'where':{'id':_0x1ad3aa[_0xc5c3('0x40')]['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x260f12,null))['then'](db['CmContactHasItem'][_0xc5c3('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1ad3aa[_0xc5c3('0x40')]['id']}}))['then'](removeEntity(_0x260f12,null))[_0xc5c3('0x3f')](handleError(_0x260f12,null));}; \ No newline at end of file +var _0xbbbc=['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','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','create','body','user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x4afe6a,_0x76d912){var _0x24333d=function(_0x160096){while(--_0x160096){_0x4afe6a['push'](_0x4afe6a['shift']());}};_0x24333d(++_0x76d912);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x356ed3,_0x4edc4a){_0x356ed3=_0x356ed3-0x0;var _0xcfbee=_0xbbbc[_0x356ed3];return _0xcfbee;};'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(){var _0x4c543a=_0x5e3970[_0xcbbb('0x27')]({'plain':!![]});var _0x4ffa80='ContactItemTypes';return db[_0xcbbb('0x28')][_0xcbbb('0x26')]({'where':{'type':_0x4ffa80,'resourceId':_0x4c543a['id']}})['then'](function(){return _0x5e3970;});})['then'](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x55e1d8,_0x4da775){return function(_0x21e3b1){if(!_0x21e3b1){_0x55e1d8[_0xcbbb('0x18')](0x194);}return _0x21e3b1;};}function handleError(_0x38f1c6,_0x13121e){_0x13121e=_0x13121e||0x1f4;return function(_0x372024){logger[_0xcbbb('0x29')](_0x372024[_0xcbbb('0x2a')]);if(_0x372024[_0xcbbb('0x2b')]){delete _0x372024[_0xcbbb('0x2b')];}_0x38f1c6[_0xcbbb('0x19')](_0x13121e)[_0xcbbb('0x2c')](_0x372024);};}exports[_0xcbbb('0x2d')]=function(_0xfa973b,_0x1ce741){var _0x2a9639={},_0xcae72c={},_0x117739={'count':0x0,'rows':[]};var _0x21c560=_['map'](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')],function(_0x5332f9){return{'name':_0x5332f9[_0xcbbb('0x30')],'type':_0x5332f9['type'][_0xcbbb('0x31')]};});_0xcae72c[_0xcbbb('0x32')]=_[_0xcbbb('0x33')](_0x21c560,'name');_0xcae72c[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0xfa973b[_0xcbbb('0x34')]);_0xcae72c[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],_0xcae72c[_0xcbbb('0x34')]);_0x2a9639[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],qs['fields'](_0xfa973b['query']['fields']));_0x2a9639['attributes']=_0x2a9639[_0xcbbb('0x38')][_0xcbbb('0x39')]?_0x2a9639[_0xcbbb('0x38')]:_0xcae72c[_0xcbbb('0x32')];if(!_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3a')](_0xcbbb('0x3b'))){_0x2a9639[_0xcbbb('0x1f')]=qs[_0xcbbb('0x1f')](_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x1f')]);_0x2a9639[_0xcbbb('0x1c')]=qs['offset'](_0xfa973b['query'][_0xcbbb('0x1c')]);}_0x2a9639['order']=qs['sort'](_0xfa973b['query'][_0xcbbb('0x3c')]);_0x2a9639[_0xcbbb('0x3d')]=qs[_0xcbbb('0x36')](_[_0xcbbb('0x3e')](_0xfa973b[_0xcbbb('0x34')],_0xcae72c[_0xcbbb('0x36')]),_0x21c560);if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]){_0x2a9639[_0xcbbb('0x3d')]=_[_0xcbbb('0x40')](_0x2a9639[_0xcbbb('0x3d')],{'$or':_['map'](_0x21c560,function(_0x21ec4b){if(_0x21ec4b['type']!==_0xcbbb('0x41')){var _0xf5b6f9={};_0xf5b6f9[_0x21ec4b[_0xcbbb('0x2b')]]={'$like':'%'+_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]+'%'};return _0xf5b6f9;}})});}_0x2a9639=_[_0xcbbb('0x40')]({},_0x2a9639,_0xfa973b['options']);var _0x4d31d2={'where':_0x2a9639['where']};return db[_0xcbbb('0x2e')][_0xcbbb('0x1e')](_0x4d31d2)[_0xcbbb('0x25')](function(_0x162979){_0x117739[_0xcbbb('0x1e')]=_0x162979;if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x2a9639['include']=[{'all':!![]}];}return db[_0xcbbb('0x2e')][_0xcbbb('0x43')](_0x2a9639);})['then'](function(_0x15b3bc){_0x117739[_0xcbbb('0x44')]=_0x15b3bc;return _0x117739;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x1ce741,_0x2a9639))[_0xcbbb('0x45')](handleError(_0x1ce741,null));};exports[_0xcbbb('0x46')]=function(_0x50adf5,_0x224682){var _0x58d5cb={'raw':!![],'where':{'id':_0x50adf5[_0xcbbb('0x47')]['id']}},_0x520448={};_0x520448[_0xcbbb('0x32')]=_[_0xcbbb('0x35')](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')]);_0x520448[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0x50adf5[_0xcbbb('0x34')]);_0x520448[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0x520448[_0xcbbb('0x32')],_0x520448[_0xcbbb('0x34')]);_0x58d5cb[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0x520448['model'],qs[_0xcbbb('0x48')](_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x48')]));_0x58d5cb[_0xcbbb('0x38')]=_0x58d5cb['attributes']['length']?_0x58d5cb['attributes']:_0x520448[_0xcbbb('0x32')];if(_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x58d5cb[_0xcbbb('0x49')]=[{'all':!![]}];}_0x58d5cb=_[_0xcbbb('0x40')]({},_0x58d5cb,_0x50adf5[_0xcbbb('0x4a')]);return db[_0xcbbb('0x2e')]['find'](_0x58d5cb)[_0xcbbb('0x25')](handleEntityNotFound(_0x224682,null))[_0xcbbb('0x25')](respondWithResult(_0x224682,null))[_0xcbbb('0x45')](handleError(_0x224682,null));};exports[_0xcbbb('0x4b')]=function(_0x478c22,_0x3378cd){return db[_0xcbbb('0x2e')][_0xcbbb('0x4b')](_0x478c22[_0xcbbb('0x4c')],{})['then'](function(_0x5e0366){var _0x3e1fdc=_0x478c22[_0xcbbb('0x4d')][_0xcbbb('0x27')]({'plain':!![]});if(!_0x3e1fdc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1fdc['role']==='user'){var _0x189a40=_0x5e0366[_0xcbbb('0x27')]({'plain':!![]});var _0x4b866e=_0xcbbb('0x4e');return db[_0xcbbb('0x4f')][_0xcbbb('0x50')]({'where':{'name':_0x4b866e,'userProfileId':_0x3e1fdc[_0xcbbb('0x51')]},'raw':!![]})['then'](function(_0x33d21c){if(_0x33d21c&&_0x33d21c[_0xcbbb('0x52')]===0x0){return db[_0xcbbb('0x28')][_0xcbbb('0x4b')]({'name':_0x189a40[_0xcbbb('0x2b')],'resourceId':_0x189a40['id'],'type':_0x33d21c[_0xcbbb('0x2b')],'sectionId':_0x33d21c['id']},{})[_0xcbbb('0x25')](function(){return _0x5e0366;});}else{return _0x5e0366;}})[_0xcbbb('0x45')](function(_0x2d3990){logger[_0xcbbb('0x29')](_0xcbbb('0x53'),_0x2d3990);throw _0x2d3990;});}return _0x5e0366;})['then'](respondWithResult(_0x3378cd,0xc9))['catch'](handleError(_0x3378cd,null));};exports[_0xcbbb('0x24')]=function(_0x1eb822,_0x354efc){if(_0x1eb822['body']['id']){delete _0x1eb822[_0xcbbb('0x4c')]['id'];}return db['ContactItemType'][_0xcbbb('0x50')]({'where':{'id':_0x1eb822[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x354efc,null))[_0xcbbb('0x25')](saveUpdates(_0x1eb822[_0xcbbb('0x4c')],null))[_0xcbbb('0x25')](respondWithResult(_0x354efc,null))['catch'](handleError(_0x354efc,null));};exports['destroy']=function(_0x4cc098,_0x370e6d){return db[_0xcbbb('0x2e')][_0xcbbb('0x50')]({'where':{'id':_0x4cc098[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x370e6d,null))[_0xcbbb('0x25')](db[_0xcbbb('0x54')][_0xcbbb('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4cc098[_0xcbbb('0x47')]['id']}}))[_0xcbbb('0x25')](removeEntity(_0x370e6d,null))[_0xcbbb('0x45')](handleError(_0x370e6d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d1458a8..13ec40a 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 _0x6611=['./contactItemType.attributes','exports','define','ContactItemType','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x26c372,_0x39af30){var _0x249257=function(_0x175fc7){while(--_0x175fc7){_0x26c372['push'](_0x26c372['shift']());}};_0x249257(++_0x39af30);}(_0x6611,0x10c));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1661('0x0'));var util=require(_0x1661('0x1'));var logger=require('../../config/logger')(_0x1661('0x2'));var moment=require(_0x1661('0x3'));var BPromise=require(_0x1661('0x4'));var rp=require(_0x1661('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1661('0x6'));var config=require(_0x1661('0x7'));var attributes=require(_0x1661('0x8'));module[_0x1661('0x9')]=function(_0x5812b9,_0x4de2fb){return _0x5812b9[_0x1661('0xa')](_0x1661('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcec8=['api','moment','bluebird','request-promise','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','util'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xcec8,0x95));var _0x8cec=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xcec8[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require('lodash');var util=require(_0x8cec('0x0'));var logger=require('../../config/logger')(_0x8cec('0x1'));var moment=require(_0x8cec('0x2'));var BPromise=require(_0x8cec('0x3'));var rp=require(_0x8cec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8cec('0x5'));var attributes=require(_0x8cec('0x6'));module[_0x8cec('0x7')]=function(_0x212f31,_0xf5cab4){return _0x212f31['define'](_0x8cec('0x8'),attributes,{'tableName':_0x8cec('0x9'),'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 69abb9e..515a928 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 _0xcb93=['then','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x55ec67,_0x1c90d5){var _0x1350f6=function(_0x5ed223){while(--_0x5ed223){_0x55ec67['push'](_0x55ec67['shift']());}};_0x1350f6(++_0x1c90d5);}(_0xcb93,0xdc));var _0x3cb9=function(_0x1dcc8b,_0x1a1cd3){_0x1dcc8b=_0x1dcc8b-0x0;var _0x471e9b=_0xcb93[_0x1dcc8b];return _0x471e9b;};'use strict';var _=require(_0x3cb9('0x0'));var util=require(_0x3cb9('0x1'));var moment=require(_0x3cb9('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cb9('0x3'));var fs=require('fs');var Redis=require(_0x3cb9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cb9('0x5'));var logger=require('../../config/logger')(_0x3cb9('0x6'));var config=require(_0x3cb9('0x7'));var jayson=require(_0x3cb9('0x8'));var client=jayson[_0x3cb9('0x9')][_0x3cb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2da34d,_0x5aed32,_0x502c3e){return new BPromise(function(_0x25742d,_0xc052bd){return client['request'](_0x2da34d,_0x502c3e)[_0x3cb9('0xb')](function(_0x2eeb82){logger['info'](_0x3cb9('0xc'),_0x5aed32,'request\x20sent');logger[_0x3cb9('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5aed32,_0x3cb9('0xe'),JSON[_0x3cb9('0xf')](_0x2eeb82));if(_0x2eeb82[_0x3cb9('0x10')]){if(_0x2eeb82[_0x3cb9('0x10')][_0x3cb9('0x11')]===0x1f4){logger[_0x3cb9('0x10')]('ContactItemType,\x20%s,\x20%s',_0x5aed32,_0x2eeb82[_0x3cb9('0x10')][_0x3cb9('0x12')]);return _0xc052bd(_0x2eeb82[_0x3cb9('0x10')][_0x3cb9('0x12')]);}logger[_0x3cb9('0x10')](_0x3cb9('0xc'),_0x5aed32,_0x2eeb82['error'][_0x3cb9('0x12')]);return _0x25742d(_0x2eeb82[_0x3cb9('0x10')][_0x3cb9('0x12')]);}else{logger[_0x3cb9('0x13')](_0x3cb9('0xc'),_0x5aed32,'request\x20sent');_0x25742d(_0x2eeb82[_0x3cb9('0x14')][_0x3cb9('0x12')]);}})['catch'](function(_0x48e026){logger[_0x3cb9('0x10')](_0x3cb9('0xc'),_0x5aed32,_0x48e026);_0xc052bd(_0x48e026);});});} \ No newline at end of file +var _0x3d38=['jayson/promise','client','http','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x27d5dc,_0x59a41e){var _0x4fa227=function(_0x3c2ffd){while(--_0x3c2ffd){_0x27d5dc['push'](_0x27d5dc['shift']());}};_0x4fa227(++_0x59a41e);}(_0x3d38,0xc1));var _0x83d3=function(_0x242c29,_0x168f0a){_0x242c29=_0x242c29-0x0;var _0x3f4d1c=_0x3d38[_0x242c29];return _0x3f4d1c;};'use strict';var _=require(_0x83d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x83d3('0x1'));var rs=require(_0x83d3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83d3('0x3'))('rpc');var config=require(_0x83d3('0x4'));var jayson=require(_0x83d3('0x5'));var client=jayson[_0x83d3('0x6')][_0x83d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44d6d6,_0x3767c6,_0x330e80){return new BPromise(function(_0x3e2282,_0x311836){return client[_0x83d3('0x8')](_0x44d6d6,_0x330e80)['then'](function(_0x83a5e9){logger[_0x83d3('0x9')]('ContactItemType,\x20%s,\x20%s',_0x3767c6,_0x83d3('0xa'));logger[_0x83d3('0xb')](_0x83d3('0xc'),_0x3767c6,_0x83d3('0xa'),JSON[_0x83d3('0xd')](_0x83a5e9));if(_0x83a5e9['error']){if(_0x83a5e9['error']['code']===0x1f4){logger[_0x83d3('0xe')](_0x83d3('0xf'),_0x3767c6,_0x83a5e9['error'][_0x83d3('0x10')]);return _0x311836(_0x83a5e9[_0x83d3('0xe')]['message']);}logger[_0x83d3('0xe')](_0x83d3('0xf'),_0x3767c6,_0x83a5e9[_0x83d3('0xe')][_0x83d3('0x10')]);return _0x3e2282(_0x83a5e9[_0x83d3('0xe')]['message']);}else{logger[_0x83d3('0x9')](_0x83d3('0xf'),_0x3767c6,_0x83d3('0xa'));_0x3e2282(_0x83a5e9[_0x83d3('0x11')][_0x83d3('0x10')]);}})['catch'](function(_0x2b9c58){logger['error']('ContactItemType,\x20%s,\x20%s',_0x3767c6,_0x2b9c58);_0x311836(_0x2b9c58);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2a3bf1d..e3dd97f 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 _0x61d4=['express','Router','fs-extra','../../components/interaction/service','./contactItemType.controller','get','index','post','create','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x27d54a,_0x3ab77a){var _0x1d24ee=function(_0x333225){while(--_0x333225){_0x27d54a['push'](_0x27d54a['shift']());}};_0x1d24ee(++_0x3ab77a);}(_0x61d4,0x1c4));var _0x461d=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0x61d4[_0x3c42ff];return _0x4c0f6d;};'use strict';var multer=require(_0x461d('0x0'));var util=require(_0x461d('0x1'));var path=require(_0x461d('0x2'));var timeout=require(_0x461d('0x3'));var express=require(_0x461d('0x4'));var router=express[_0x461d('0x5')]();var fs_extra=require(_0x461d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x461d('0x7'));var config=require('../../config/environment');var controller=require(_0x461d('0x8'));router[_0x461d('0x9')]('/',auth['isAuthenticated'](),controller[_0x461d('0xa')]);router[_0x461d('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x461d('0xb')]('/',auth['isAuthenticated'](),controller[_0x461d('0xc')]);router[_0x461d('0xd')](_0x461d('0xe'),auth[_0x461d('0xf')](),controller[_0x461d('0x10')]);router[_0x461d('0x11')](_0x461d('0xe'),auth['isAuthenticated'](),controller[_0x461d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe264=['update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe264,0x74));var _0x4e26=function(_0x5c08cb,_0x456960){_0x5c08cb=_0x5c08cb-0x0;var _0x147907=_0xe264[_0x5c08cb];return _0x147907;};'use strict';var multer=require(_0x4e26('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e26('0x1'));var express=require('express');var router=express[_0x4e26('0x2')]();var fs_extra=require(_0x4e26('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e26('0x4'));router[_0x4e26('0x5')]('/',auth[_0x4e26('0x6')](),controller['index']);router['get'](_0x4e26('0x7'),auth['isAuthenticated'](),controller[_0x4e26('0x8')]);router[_0x4e26('0x9')]('/',auth[_0x4e26('0x6')](),controller[_0x4e26('0xa')]);router[_0x4e26('0xb')](_0x4e26('0x7'),auth['isAuthenticated'](),controller[_0x4e26('0xc')]);router[_0x4e26('0xd')](_0x4e26('0x7'),auth[_0x4e26('0x6')](),controller[_0x4e26('0xe')]);module[_0x4e26('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 02656d9..d94e9f5 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1d9586,_0x43401f){var _0x343811=function(_0x5e164e){while(--_0x5e164e){_0x1d9586['push'](_0x1d9586['shift']());}};_0x343811(++_0x43401f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x492d81,_0x50d980){var _0x53e8ee=function(_0x47641d){while(--_0x47641d){_0x492d81['push'](_0x492d81['shift']());}};_0x53e8ee(++_0x50d980);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b14f643..9f7a626 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 _0xfa59=['CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','autoAssociation','params','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie3','attrEmailAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfa59,0x1be));var _0x9fa5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfa59[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x9fa5('0x0'));var rimraf=require(_0x9fa5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fa5('0x2'));var rp=require(_0x9fa5('0x3'));var moment=require(_0x9fa5('0x4'));var BPromise=require(_0x9fa5('0x5'));var Mustache=require(_0x9fa5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9fa5('0x7'));var csv=require(_0x9fa5('0x8'));var ejs=require(_0x9fa5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fa5('0xa'));var squel=require(_0x9fa5('0xb'));var crypto=require('crypto');var jsforce=require(_0x9fa5('0xc'));var deskjs=require(_0x9fa5('0xd'));var toCsv=require(_0x9fa5('0x8'));var querystring=require(_0x9fa5('0xe'));var Papa=require(_0x9fa5('0xf'));var Redis=require(_0x9fa5('0x10'));var authService=require(_0x9fa5('0x11'));var qs=require(_0x9fa5('0x12'));var as=require(_0x9fa5('0x13'));var hardwareService=require(_0x9fa5('0x14'));var logger=require(_0x9fa5('0x15'))(_0x9fa5('0x16'));var utils=require(_0x9fa5('0x17'));var config=require(_0x9fa5('0x18'));var licenseUtil=require(_0x9fa5('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9fa5('0x1a')](config[_0x9fa5('0x1b')],{'host':_0x9fa5('0x1c'),'port':0x18eb});var socket=require(_0x9fa5('0x1d'))(new Redis(config['redis']));require(_0x9fa5('0x1e'))[_0x9fa5('0x1f')](socket);function respondWithStatusCode(_0x2e50e5,_0x35970d){_0x35970d=_0x35970d||0xcc;return function(_0x53e70b){if(_0x53e70b){return _0x2e50e5[_0x9fa5('0x20')](_0x35970d);}return _0x2e50e5[_0x9fa5('0x21')](_0x35970d)[_0x9fa5('0x22')]();};}function respondWithResult(_0x49206e,_0x9da7bc){_0x9da7bc=_0x9da7bc||0xc8;return function(_0x1c48d1){if(_0x1c48d1){return _0x49206e['status'](_0x9da7bc)[_0x9fa5('0x23')](_0x1c48d1);}};}function respondWithFilteredResult(_0x75522e,_0x130ea4){return function(_0xd16f3c){if(_0xd16f3c){var _0x5f1006=typeof _0x130ea4[_0x9fa5('0x24')]===_0x9fa5('0x25')&&typeof _0x130ea4[_0x9fa5('0x26')]===_0x9fa5('0x25');var _0x3b411a=_0xd16f3c[_0x9fa5('0x27')];var _0xfa68f4=_0x5f1006?0x0:_0x130ea4[_0x9fa5('0x24')];var _0x20f75d=_0x5f1006?_0xd16f3c[_0x9fa5('0x27')]:_0x130ea4[_0x9fa5('0x24')]+_0x130ea4[_0x9fa5('0x26')];var _0x3ac207;if(_0x20f75d>=_0x3b411a){_0x20f75d=_0x3b411a;_0x3ac207=0xc8;}else{_0x3ac207=0xce;}_0x75522e[_0x9fa5('0x21')](_0x3ac207);return _0x75522e['set'](_0x9fa5('0x28'),_0xfa68f4+'-'+_0x20f75d+'/'+_0x3b411a)[_0x9fa5('0x23')](_0xd16f3c);}return null;};}function patchUpdates(_0x4c2306){return function(_0x577c29){try{jsonpatch[_0x9fa5('0x29')](_0x577c29,_0x4c2306,!![]);}catch(_0x31391f){return BPromise['reject'](_0x31391f);}return _0x577c29[_0x9fa5('0x2a')]();};}function saveUpdates(_0x168bb3,_0x579788){return function(_0x521715){if(_0x521715){return _0x521715[_0x9fa5('0x2b')](_0x168bb3)[_0x9fa5('0x2c')](function(_0x3a08d1){return _0x3a08d1;});}return null;};}function removeEntity(_0x2e6be6,_0x5aca6c){return function(_0x4e41fd){if(_0x4e41fd){return _0x4e41fd[_0x9fa5('0x2d')]()[_0x9fa5('0x2c')](function(){var _0x27c4be=_0x4e41fd['get']({'plain':!![]});var _0x31d1bf='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x31d1bf,'resourceId':_0x27c4be['id']}})[_0x9fa5('0x2c')](function(){return _0x4e41fd;});})['then'](function(){_0x2e6be6[_0x9fa5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cc07,_0x1a013f){return function(_0xda8337){if(!_0xda8337){_0x38cc07[_0x9fa5('0x20')](0x194);}return _0xda8337;};}function handleError(_0x4396fa,_0x153f31){_0x153f31=_0x153f31||0x1f4;return function(_0x48fd23){logger[_0x9fa5('0x2e')](_0x48fd23[_0x9fa5('0x2f')]);if(_0x48fd23['name']){delete _0x48fd23['name'];}_0x4396fa[_0x9fa5('0x21')](_0x153f31)[_0x9fa5('0x30')](_0x48fd23);};}exports[_0x9fa5('0x31')]=function(_0x2affb9,_0x228446){var _0x58b937={},_0x10e905={},_0x1b9d13={'count':0x0,'rows':[]};var _0x1d751c=_[_0x9fa5('0x32')](db[_0x9fa5('0x33')][_0x9fa5('0x34')],function(_0x4aeb34){return{'name':_0x4aeb34[_0x9fa5('0x35')],'type':_0x4aeb34[_0x9fa5('0x36')][_0x9fa5('0x37')]};});_0x10e905[_0x9fa5('0x38')]=_[_0x9fa5('0x32')](_0x1d751c,_0x9fa5('0x39'));_0x10e905[_0x9fa5('0x3a')]=_[_0x9fa5('0x3b')](_0x2affb9[_0x9fa5('0x3a')]);_0x10e905[_0x9fa5('0x3c')]=_[_0x9fa5('0x3d')](_0x10e905['model'],_0x10e905[_0x9fa5('0x3a')]);_0x58b937[_0x9fa5('0x3e')]=_[_0x9fa5('0x3d')](_0x10e905[_0x9fa5('0x38')],qs[_0x9fa5('0x3f')](_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x3f')]));_0x58b937[_0x9fa5('0x3e')]=_0x58b937['attributes'][_0x9fa5('0x40')]?_0x58b937[_0x9fa5('0x3e')]:_0x10e905[_0x9fa5('0x38')];if(!_0x2affb9['query'][_0x9fa5('0x41')](_0x9fa5('0x42'))){_0x58b937[_0x9fa5('0x26')]=qs[_0x9fa5('0x26')](_0x2affb9['query'][_0x9fa5('0x26')]);_0x58b937['offset']=qs[_0x9fa5('0x24')](_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x24')]);}_0x58b937[_0x9fa5('0x43')]=qs['sort'](_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x44')]);_0x58b937['where']=qs[_0x9fa5('0x3c')](_[_0x9fa5('0x45')](_0x2affb9[_0x9fa5('0x3a')],_0x10e905[_0x9fa5('0x3c')]),_0x1d751c);if(_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x46')]){_0x58b937[_0x9fa5('0x47')]=_[_0x9fa5('0x48')](_0x58b937[_0x9fa5('0x47')],{'$or':_[_0x9fa5('0x32')](_0x1d751c,function(_0x59f9b5){if(_0x59f9b5[_0x9fa5('0x36')]!==_0x9fa5('0x49')){var _0x4dcd9e={};_0x4dcd9e[_0x59f9b5[_0x9fa5('0x39')]]={'$like':'%'+_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x46')]+'%'};return _0x4dcd9e;}})});}_0x58b937=_[_0x9fa5('0x48')]({},_0x58b937,_0x2affb9[_0x9fa5('0x4a')]);var _0x26175f={'where':_0x58b937[_0x9fa5('0x47')]};return db[_0x9fa5('0x33')][_0x9fa5('0x27')](_0x26175f)[_0x9fa5('0x2c')](function(_0x2680d4){_0x1b9d13[_0x9fa5('0x27')]=_0x2680d4;if(_0x2affb9[_0x9fa5('0x3a')][_0x9fa5('0x4b')]){_0x58b937['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x58b937);})[_0x9fa5('0x2c')](function(_0x36cbbe){_0x1b9d13[_0x9fa5('0x4c')]=_0x36cbbe;return _0x1b9d13;})['then'](respondWithFilteredResult(_0x228446,_0x58b937))[_0x9fa5('0x4d')](handleError(_0x228446,null));};exports[_0x9fa5('0x4e')]=function(_0x13466f,_0x5a951c){var _0x6bd6c5={'raw':![],'where':{'id':_0x13466f['params']['id']}},_0xc1d7d3={};_0xc1d7d3[_0x9fa5('0x38')]=_[_0x9fa5('0x3b')](db[_0x9fa5('0x33')][_0x9fa5('0x34')]);_0xc1d7d3['query']=_['keys'](_0x13466f[_0x9fa5('0x3a')]);_0xc1d7d3[_0x9fa5('0x3c')]=_['intersection'](_0xc1d7d3['model'],_0xc1d7d3['query']);_0x6bd6c5[_0x9fa5('0x3e')]=_[_0x9fa5('0x3d')](_0xc1d7d3[_0x9fa5('0x38')],qs[_0x9fa5('0x3f')](_0x13466f['query']['fields']));_0x6bd6c5[_0x9fa5('0x3e')]=_0x6bd6c5[_0x9fa5('0x3e')]['length']?_0x6bd6c5[_0x9fa5('0x3e')]:_0xc1d7d3[_0x9fa5('0x38')];if(_0x13466f['query'][_0x9fa5('0x4b')]){_0x6bd6c5['include']=[{'all':!![]}];}_0x6bd6c5=_[_0x9fa5('0x48')]({},_0x6bd6c5,_0x13466f[_0x9fa5('0x4a')]);return db['Dashboard'][_0x9fa5('0x4f')](_0x6bd6c5)[_0x9fa5('0x2c')](handleEntityNotFound(_0x5a951c,null))[_0x9fa5('0x2c')](respondWithResult(_0x5a951c,null))['catch'](handleError(_0x5a951c,null));};exports[_0x9fa5('0x50')]=function(_0x463dd0,_0x2def79){return db[_0x9fa5('0x33')]['create'](_0x463dd0[_0x9fa5('0x51')],{})[_0x9fa5('0x2c')](function(_0x298c24){var _0x769fbb=_0x463dd0['user'][_0x9fa5('0x52')]({'plain':!![]});if(!_0x769fbb)throw new Error(_0x9fa5('0x53'));if(_0x769fbb[_0x9fa5('0x54')]===_0x9fa5('0x55')){var _0x264d2a=_0x298c24[_0x9fa5('0x52')]({'plain':!![]});var _0x495528=_0x9fa5('0x56');return db[_0x9fa5('0x57')][_0x9fa5('0x4f')]({'where':{'name':_0x495528,'userProfileId':_0x769fbb[_0x9fa5('0x58')]},'raw':!![]})['then'](function(_0xea1aee){if(_0xea1aee&&_0xea1aee['autoAssociation']===0x0){return db[_0x9fa5('0x59')][_0x9fa5('0x50')]({'name':_0x264d2a[_0x9fa5('0x39')],'resourceId':_0x264d2a['id'],'type':_0xea1aee[_0x9fa5('0x39')],'sectionId':_0xea1aee['id']},{})[_0x9fa5('0x2c')](function(){return _0x298c24;});}else{return _0x298c24;}})['catch'](function(_0x43d68f){logger['error'](_0x9fa5('0x5a'),_0x43d68f);throw _0x43d68f;});}return _0x298c24;})[_0x9fa5('0x2c')](respondWithResult(_0x2def79,0xc9))['catch'](handleError(_0x2def79,null));};exports[_0x9fa5('0x5b')]=function(_0x3eea67,_0x2b4a5d){var _0x4ecf33={'where':{'id':_0x3eea67['params']['id']}},_0x3e11ef={};_0x3e11ef['model']=_[_0x9fa5('0x3b')](db['Dashboard'][_0x9fa5('0x34')]);_0x4ecf33[_0x9fa5('0x3e')]=_[_0x9fa5('0x3d')](_0x3e11ef[_0x9fa5('0x38')],qs[_0x9fa5('0x3f')](_0x3eea67[_0x9fa5('0x3a')][_0x9fa5('0x3f')]));_0x4ecf33['attributes']=_0x4ecf33[_0x9fa5('0x3e')][_0x9fa5('0x40')]?_0x4ecf33[_0x9fa5('0x3e')]:_0x3e11ef[_0x9fa5('0x38')];if(_0x3eea67[_0x9fa5('0x3a')][_0x9fa5('0x4b')]){_0x4ecf33[_0x9fa5('0x5c')]=[{'all':!![]}];}_0x4ecf33=_['merge']({},_0x4ecf33,_0x3eea67[_0x9fa5('0x4a')]);return db[_0x9fa5('0x33')][_0x9fa5('0x4f')](_0x4ecf33)['then'](handleEntityNotFound(_0x2b4a5d,null))[_0x9fa5('0x2c')](function(_0x6c8d1a){if(_0x6c8d1a){var _0x364eab=_0x6c8d1a[_0x9fa5('0x52')]({'plain':!![]});_0x364eab=qs[_0x9fa5('0x5d')](_0x364eab,['id',_0x9fa5('0x5e'),_0x9fa5('0x5f')]);_0x3eea67['body']=_[_0x9fa5('0x5d')](_0x3eea67[_0x9fa5('0x51')],['id',_0x9fa5('0x5e'),_0x9fa5('0x5f')]);return db[_0x9fa5('0x33')][_0x9fa5('0x50')](_[_0x9fa5('0x48')](_0x364eab,_0x3eea67[_0x9fa5('0x51')]),{'include':_0x3eea67[_0x9fa5('0x3a')][_0x9fa5('0x4b')]?[{'all':!![]}]:undefined})[_0x9fa5('0x2c')](function(_0x284d97){var _0x222a42=_0x3eea67[_0x9fa5('0x55')]['get']({'plain':!![]});if(!_0x222a42)throw new Error(_0x9fa5('0x53'));if(_0x222a42[_0x9fa5('0x54')]===_0x9fa5('0x55')){var _0x3df23f=_0x284d97[_0x9fa5('0x52')]({'plain':!![]});var _0x18efb5=_0x9fa5('0x56');return db[_0x9fa5('0x57')]['find']({'where':{'name':_0x18efb5,'userProfileId':_0x222a42[_0x9fa5('0x58')]},'raw':!![]})[_0x9fa5('0x2c')](function(_0x5ba1f1){if(_0x5ba1f1&&_0x5ba1f1[_0x9fa5('0x60')]===0x0){return db[_0x9fa5('0x59')]['create']({'name':_0x3df23f[_0x9fa5('0x39')],'resourceId':_0x3df23f['id'],'type':_0x5ba1f1['name'],'sectionId':_0x5ba1f1['id']},{})['then'](function(){return _0x284d97;});}else{return _0x284d97;}})[_0x9fa5('0x4d')](function(_0x14bd80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14bd80);throw _0x14bd80;});}return _0x284d97;});}})[_0x9fa5('0x2c')](respondWithResult(_0x2b4a5d,0xc9))['catch'](handleError(_0x2b4a5d,null));};exports['update']=function(_0x3d008d,_0x3bb0a1){if(_0x3d008d[_0x9fa5('0x51')]['id']){delete _0x3d008d['body']['id'];}return db[_0x9fa5('0x33')][_0x9fa5('0x4f')]({'where':{'id':_0x3d008d['params']['id']}})[_0x9fa5('0x2c')](handleEntityNotFound(_0x3bb0a1,null))[_0x9fa5('0x2c')](saveUpdates(_0x3d008d['body'],null))['then'](respondWithResult(_0x3bb0a1,null))[_0x9fa5('0x4d')](handleError(_0x3bb0a1,null));};exports[_0x9fa5('0x2d')]=function(_0x1f029b,_0x3dfc70){return db[_0x9fa5('0x33')]['find']({'where':{'id':_0x1f029b[_0x9fa5('0x61')]['id']}})[_0x9fa5('0x2c')](handleEntityNotFound(_0x3dfc70,null))['then'](removeEntity(_0x3dfc70,null))[_0x9fa5('0x4d')](handleError(_0x3dfc70,null));};function widgetAttributes(_0x52b934){try{switch(_0x52b934[_0x9fa5('0x36')]){case'iframe':return[{'name':'attrUrl','value':_0x52b934[_0x9fa5('0x62')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0][_0x9fa5('0x64')]:undefined)||_0x9fa5('0x65')}];case _0x9fa5('0x66'):return[{'name':'attrPath','value':_0x52b934[_0x9fa5('0x67')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0][_0x9fa5('0x64')]:undefined)||''}];case _0x9fa5('0x68'):return[{'name':_0x9fa5('0x69'),'value':_0x52b934[_0x9fa5('0x69')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0][_0x9fa5('0x64')]:undefined)||_0x9fa5('0x6a')},{'name':_0x9fa5('0x6b'),'value':_0x52b934[_0x9fa5('0x6b')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x1]?_0x52b934[_0x9fa5('0x63')][0x1][_0x9fa5('0x64')]:undefined)||_0x9fa5('0x6c')},{'name':_0x9fa5('0x6d'),'value':_0x52b934['attrFontSize']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x2]?_0x52b934[_0x9fa5('0x63')][0x2][_0x9fa5('0x64')]:undefined)||0xc}];case _0x9fa5('0x6e'):return[{'name':'attrMetric','value':_0x52b934['attrMetric']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0][_0x9fa5('0x64')]:undefined)||'total'},{'name':_0x9fa5('0x6f'),'value':_0x52b934[_0x9fa5('0x6f')]||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x1]?_0x52b934[_0x9fa5('0x63')][0x1]['value']:undefined)||[]},{'name':_0x9fa5('0x6d'),'value':_0x52b934[_0x9fa5('0x6d')]||(_0x52b934['attrs']&&_0x52b934['attrs'][0x2]?_0x52b934[_0x9fa5('0x63')][0x2]['value']:undefined)||0x14},{'name':_0x9fa5('0x70'),'value':_0x52b934[_0x9fa5('0x70')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x3]?_0x52b934[_0x9fa5('0x63')][0x3]['value']:undefined)||_0x9fa5('0x71')},{'name':'attrEmailAccounts','value':_0x52b934['attrEmailAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x4]?_0x52b934[_0x9fa5('0x63')][0x4][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x72'),'value':_0x52b934['attrFaxAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x5]?_0x52b934[_0x9fa5('0x63')][0x5][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x73'),'value':_0x52b934[_0x9fa5('0x73')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x6]?_0x52b934['attrs'][0x6]['value']:undefined)||''},{'name':_0x9fa5('0x74'),'value':_0x52b934['attrOpenchannelAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x7]?_0x52b934['attrs'][0x7][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x75'),'value':_0x52b934[_0x9fa5('0x75')]||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x8]?_0x52b934[_0x9fa5('0x63')][0x8]['value']:undefined)||''},{'name':_0x9fa5('0x76'),'value':_0x52b934[_0x9fa5('0x76')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x9]?_0x52b934['attrs'][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x9fa5('0x77'):return[{'name':_0x9fa5('0x78'),'value':_0x52b934['attrSerie1']||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0][_0x9fa5('0x64')]:undefined)||_0x9fa5('0x79')},{'name':'attrSerie2','value':_0x52b934['attrSerie2']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x1]?_0x52b934[_0x9fa5('0x63')][0x1][_0x9fa5('0x64')]:undefined)||null},{'name':_0x9fa5('0x7a'),'value':_0x52b934[_0x9fa5('0x7a')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x2]?_0x52b934[_0x9fa5('0x63')][0x2]['value']:undefined)||null},{'name':_0x9fa5('0x6f'),'value':_0x52b934[_0x9fa5('0x6f')]||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x3]?_0x52b934['attrs'][0x3][_0x9fa5('0x64')]:undefined)||[]},{'name':'attrChannel','value':_0x52b934[_0x9fa5('0x70')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x4]?_0x52b934['attrs'][0x4][_0x9fa5('0x64')]:undefined)||'voice'},{'name':_0x9fa5('0x7b'),'value':_0x52b934['attrEmailAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x5]?_0x52b934[_0x9fa5('0x63')][0x5]['value']:undefined)||''},{'name':_0x9fa5('0x72'),'value':_0x52b934['attrFaxAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x6]?_0x52b934['attrs'][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x52b934[_0x9fa5('0x73')]||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x7]?_0x52b934[_0x9fa5('0x63')][0x7][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x74'),'value':_0x52b934[_0x9fa5('0x74')]||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x8]?_0x52b934['attrs'][0x8][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x75'),'value':_0x52b934['attrWhatsappAccounts']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934['attrs'][0x9]?_0x52b934[_0x9fa5('0x63')][0x9][_0x9fa5('0x64')]:undefined)||''},{'name':_0x9fa5('0x76'),'value':_0x52b934['attrChatWebsites']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0xa]?_0x52b934[_0x9fa5('0x63')][0xa][_0x9fa5('0x64')]:undefined)||''}];case _0x9fa5('0x7c'):return[{'name':_0x9fa5('0x7d'),'type':_0x52b934['reportType']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0]['type']:undefined)||null,'value':_0x52b934['attrReport']||(_0x52b934[_0x9fa5('0x63')]&&_0x52b934[_0x9fa5('0x63')][0x0]?_0x52b934[_0x9fa5('0x63')][0x0]['value']:undefined)||null},{'name':_0x9fa5('0x7e'),'value':_0x52b934[_0x9fa5('0x7e')]||(_0x52b934['attrs']&&_0x52b934[_0x9fa5('0x63')][0x1]?_0x52b934[_0x9fa5('0x63')][0x1][_0x9fa5('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x28b374){logger['error'](_0x9fa5('0x7f'),JSON[_0x9fa5('0x80')](_0x28b374));return[];}}exports['addItem']=function(_0x2efbe7,_0x48cd8e,_0x24ed9c){if(_0x2efbe7[_0x9fa5('0x51')]['id']){delete _0x2efbe7[_0x9fa5('0x51')]['id'];}return db['Dashboard'][_0x9fa5('0x4f')]({'where':{'id':_0x2efbe7['params']['id']}})[_0x9fa5('0x2c')](handleEntityNotFound(_0x48cd8e,null))[_0x9fa5('0x2c')](function(_0x1cf6a0){if(_0x1cf6a0){_0x2efbe7['body'][_0x9fa5('0x81')]=_0x1cf6a0['id'];_0x2efbe7[_0x9fa5('0x51')][_0x9fa5('0x63')]=widgetAttributes(_0x2efbe7[_0x9fa5('0x51')]);return db[_0x9fa5('0x82')][_0x9fa5('0x50')](_0x2efbe7[_0x9fa5('0x51')]);}})['then'](respondWithResult(_0x48cd8e,null))[_0x9fa5('0x4d')](handleError(_0x48cd8e,null));};exports[_0x9fa5('0x83')]=function(_0x340a9d,_0x2806b7,_0x5966e3){var _0x30d089={};var _0x32391b={};var _0x308ff0;var _0x9557fb;return db[_0x9fa5('0x33')][_0x9fa5('0x84')]({'where':{'id':_0x340a9d[_0x9fa5('0x61')]['id']}})['then'](handleEntityNotFound(_0x2806b7,null))[_0x9fa5('0x2c')](function(_0x41d41e){if(_0x41d41e){_0x308ff0=_0x41d41e;_0x32391b[_0x9fa5('0x38')]=_[_0x9fa5('0x3b')](db[_0x9fa5('0x82')][_0x9fa5('0x34')]);_0x32391b[_0x9fa5('0x3a')]=_['keys'](_0x340a9d['query']);_0x32391b[_0x9fa5('0x3c')]=_[_0x9fa5('0x3d')](_0x32391b[_0x9fa5('0x38')],_0x32391b[_0x9fa5('0x3a')]);_0x30d089[_0x9fa5('0x3e')]=_[_0x9fa5('0x3d')](_0x32391b[_0x9fa5('0x38')],qs[_0x9fa5('0x3f')](_0x340a9d[_0x9fa5('0x3a')][_0x9fa5('0x3f')]));_0x30d089[_0x9fa5('0x3e')]=_0x30d089[_0x9fa5('0x3e')]['length']?_0x30d089[_0x9fa5('0x3e')]:_0x32391b[_0x9fa5('0x38')];_0x30d089[_0x9fa5('0x43')]=qs[_0x9fa5('0x44')](_0x340a9d[_0x9fa5('0x3a')][_0x9fa5('0x44')]);_0x30d089[_0x9fa5('0x47')]=qs[_0x9fa5('0x3c')](_[_0x9fa5('0x45')](_0x340a9d['query'],_0x32391b['filters']));if(_0x340a9d['query'][_0x9fa5('0x46')]){_0x30d089[_0x9fa5('0x47')]=_[_0x9fa5('0x48')](_0x30d089[_0x9fa5('0x47')],{'$or':_[_0x9fa5('0x32')](_0x30d089[_0x9fa5('0x3e')],function(_0x51ae4e){var _0xf57e00={};_0xf57e00[_0x51ae4e]={'$like':'%'+_0x340a9d[_0x9fa5('0x3a')][_0x9fa5('0x46')]+'%'};return _0xf57e00;})});}_0x30d089=_[_0x9fa5('0x48')]({},_0x30d089,_0x340a9d[_0x9fa5('0x4a')]);return _0x308ff0[_0x9fa5('0x83')](_0x30d089);}})['then'](function(_0x19a4c2){if(_0x19a4c2){_0x9557fb=_0x19a4c2['length'];if(!_0x340a9d[_0x9fa5('0x3a')][_0x9fa5('0x41')](_0x9fa5('0x42'))){_0x30d089[_0x9fa5('0x26')]=qs[_0x9fa5('0x26')](_0x340a9d['query']['limit']);_0x30d089[_0x9fa5('0x24')]=qs[_0x9fa5('0x24')](_0x340a9d[_0x9fa5('0x3a')][_0x9fa5('0x24')]);}return _0x308ff0[_0x9fa5('0x83')](_0x30d089);}})[_0x9fa5('0x2c')](function(_0x28ea14){if(_0x28ea14){return _0x28ea14?{'count':_0x9557fb,'rows':_0x28ea14}:null;}})[_0x9fa5('0x2c')](respondWithResult(_0x2806b7,null))[_0x9fa5('0x4d')](handleError(_0x2806b7,null));}; \ No newline at end of file +var _0x0b6a=['end','json','offset','undefined','limit','count','set','apply','update','then','destroy','UserProfileResource','error','name','send','map','Dashboard','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrReport','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status'];(function(_0x2b1ab1,_0x56087a){var _0x32775c=function(_0x5e9569){while(--_0x5e9569){_0x2b1ab1['push'](_0x2b1ab1['shift']());}};_0x32775c(++_0x56087a);}(_0x0b6a,0x1d5));var _0xa0b6=function(_0x2f139f,_0x4d782a){_0x2f139f=_0x2f139f-0x0;var _0x8c174b=_0x0b6a[_0x2f139f];return _0x8c174b;};'use strict';var emlformat=require(_0xa0b6('0x0'));var rimraf=require(_0xa0b6('0x1'));var zipdir=require(_0xa0b6('0x2'));var jsonpatch=require(_0xa0b6('0x3'));var rp=require(_0xa0b6('0x4'));var moment=require(_0xa0b6('0x5'));var BPromise=require(_0xa0b6('0x6'));var Mustache=require(_0xa0b6('0x7'));var util=require(_0xa0b6('0x8'));var path=require(_0xa0b6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa0b6('0xa'));var fs=require('fs');var fs_extra=require(_0xa0b6('0xb'));var _=require(_0xa0b6('0xc'));var squel=require(_0xa0b6('0xd'));var crypto=require(_0xa0b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa0b6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa0b6('0x10'));var Papa=require(_0xa0b6('0x11'));var Redis=require(_0xa0b6('0x12'));var authService=require(_0xa0b6('0x13'));var qs=require(_0xa0b6('0x14'));var as=require(_0xa0b6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0b6('0x16'))(_0xa0b6('0x17'));var utils=require(_0xa0b6('0x18'));var config=require(_0xa0b6('0x19'));var licenseUtil=require(_0xa0b6('0x1a'));var db=require(_0xa0b6('0x1b'))['db'];config['redis']=_[_0xa0b6('0x1c')](config[_0xa0b6('0x1d')],{'host':_0xa0b6('0x1e'),'port':0x18eb});var socket=require(_0xa0b6('0x1f'))(new Redis(config['redis']));require('./dashboard.socket')[_0xa0b6('0x20')](socket);function respondWithStatusCode(_0x3b1329,_0x4ab2db){_0x4ab2db=_0x4ab2db||0xcc;return function(_0x568996){if(_0x568996){return _0x3b1329[_0xa0b6('0x21')](_0x4ab2db);}return _0x3b1329[_0xa0b6('0x22')](_0x4ab2db)[_0xa0b6('0x23')]();};}function respondWithResult(_0x507792,_0x44fc2c){_0x44fc2c=_0x44fc2c||0xc8;return function(_0x448169){if(_0x448169){return _0x507792['status'](_0x44fc2c)[_0xa0b6('0x24')](_0x448169);}};}function respondWithFilteredResult(_0xadfe06,_0x500ef8){return function(_0x79a7aa){if(_0x79a7aa){var _0x436bf1=typeof _0x500ef8[_0xa0b6('0x25')]===_0xa0b6('0x26')&&typeof _0x500ef8[_0xa0b6('0x27')]===_0xa0b6('0x26');var _0x418829=_0x79a7aa[_0xa0b6('0x28')];var _0x4dcc18=_0x436bf1?0x0:_0x500ef8[_0xa0b6('0x25')];var _0x3ac268=_0x436bf1?_0x79a7aa[_0xa0b6('0x28')]:_0x500ef8['offset']+_0x500ef8[_0xa0b6('0x27')];var _0x24712f;if(_0x3ac268>=_0x418829){_0x3ac268=_0x418829;_0x24712f=0xc8;}else{_0x24712f=0xce;}_0xadfe06['status'](_0x24712f);return _0xadfe06[_0xa0b6('0x29')]('Content-Range',_0x4dcc18+'-'+_0x3ac268+'/'+_0x418829)[_0xa0b6('0x24')](_0x79a7aa);}return null;};}function patchUpdates(_0x41f062){return function(_0x5c7c21){try{jsonpatch[_0xa0b6('0x2a')](_0x5c7c21,_0x41f062,!![]);}catch(_0x4c2b20){return BPromise['reject'](_0x4c2b20);}return _0x5c7c21['save']();};}function saveUpdates(_0x95aeb6,_0xde3315){return function(_0x54113c){if(_0x54113c){return _0x54113c[_0xa0b6('0x2b')](_0x95aeb6)[_0xa0b6('0x2c')](function(_0x3f5f7e){return _0x3f5f7e;});}return null;};}function removeEntity(_0xc2f5e7,_0x3a04ad){return function(_0x2dd176){if(_0x2dd176){return _0x2dd176[_0xa0b6('0x2d')]()[_0xa0b6('0x2c')](function(){var _0x35af48=_0x2dd176['get']({'plain':!![]});var _0x5d3201='CustomDashboards';return db[_0xa0b6('0x2e')][_0xa0b6('0x2d')]({'where':{'type':_0x5d3201,'resourceId':_0x35af48['id']}})['then'](function(){return _0x2dd176;});})[_0xa0b6('0x2c')](function(){_0xc2f5e7[_0xa0b6('0x22')](0xcc)[_0xa0b6('0x23')]();});}};}function handleEntityNotFound(_0x42a217,_0x74e8ca){return function(_0x16d8e4){if(!_0x16d8e4){_0x42a217[_0xa0b6('0x21')](0x194);}return _0x16d8e4;};}function handleError(_0xcdb5de,_0x306f51){_0x306f51=_0x306f51||0x1f4;return function(_0x3e8088){logger[_0xa0b6('0x2f')](_0x3e8088['stack']);if(_0x3e8088[_0xa0b6('0x30')]){delete _0x3e8088['name'];}_0xcdb5de[_0xa0b6('0x22')](_0x306f51)[_0xa0b6('0x31')](_0x3e8088);};}exports['index']=function(_0x4d2bc6,_0x434364){var _0x51efda={},_0x29fc5b={},_0x73c230={'count':0x0,'rows':[]};var _0x5bbada=_[_0xa0b6('0x32')](db[_0xa0b6('0x33')][_0xa0b6('0x34')],function(_0x5cc5d8){return{'name':_0x5cc5d8['fieldName'],'type':_0x5cc5d8[_0xa0b6('0x35')]['key']};});_0x29fc5b[_0xa0b6('0x36')]=_['map'](_0x5bbada,_0xa0b6('0x30'));_0x29fc5b['query']=_[_0xa0b6('0x37')](_0x4d2bc6[_0xa0b6('0x38')]);_0x29fc5b[_0xa0b6('0x39')]=_['intersection'](_0x29fc5b[_0xa0b6('0x36')],_0x29fc5b[_0xa0b6('0x38')]);_0x51efda[_0xa0b6('0x3a')]=_['intersection'](_0x29fc5b[_0xa0b6('0x36')],qs[_0xa0b6('0x3b')](_0x4d2bc6[_0xa0b6('0x38')][_0xa0b6('0x3b')]));_0x51efda[_0xa0b6('0x3a')]=_0x51efda[_0xa0b6('0x3a')][_0xa0b6('0x3c')]?_0x51efda[_0xa0b6('0x3a')]:_0x29fc5b['model'];if(!_0x4d2bc6[_0xa0b6('0x38')][_0xa0b6('0x3d')](_0xa0b6('0x3e'))){_0x51efda[_0xa0b6('0x27')]=qs['limit'](_0x4d2bc6['query'][_0xa0b6('0x27')]);_0x51efda[_0xa0b6('0x25')]=qs[_0xa0b6('0x25')](_0x4d2bc6['query'][_0xa0b6('0x25')]);}_0x51efda['order']=qs[_0xa0b6('0x3f')](_0x4d2bc6[_0xa0b6('0x38')]['sort']);_0x51efda[_0xa0b6('0x40')]=qs[_0xa0b6('0x39')](_[_0xa0b6('0x41')](_0x4d2bc6['query'],_0x29fc5b[_0xa0b6('0x39')]),_0x5bbada);if(_0x4d2bc6[_0xa0b6('0x38')][_0xa0b6('0x42')]){_0x51efda[_0xa0b6('0x40')]=_['merge'](_0x51efda[_0xa0b6('0x40')],{'$or':_[_0xa0b6('0x32')](_0x5bbada,function(_0x1fbb89){if(_0x1fbb89[_0xa0b6('0x35')]!==_0xa0b6('0x43')){var _0x6ca7dc={};_0x6ca7dc[_0x1fbb89[_0xa0b6('0x30')]]={'$like':'%'+_0x4d2bc6[_0xa0b6('0x38')][_0xa0b6('0x42')]+'%'};return _0x6ca7dc;}})});}_0x51efda=_[_0xa0b6('0x44')]({},_0x51efda,_0x4d2bc6[_0xa0b6('0x45')]);var _0x2c28ea={'where':_0x51efda['where']};return db[_0xa0b6('0x33')]['count'](_0x2c28ea)[_0xa0b6('0x2c')](function(_0xabf3bf){_0x73c230[_0xa0b6('0x28')]=_0xabf3bf;if(_0x4d2bc6['query'][_0xa0b6('0x46')]){_0x51efda[_0xa0b6('0x47')]=[{'all':!![]}];}return db[_0xa0b6('0x33')]['findAll'](_0x51efda);})[_0xa0b6('0x2c')](function(_0x4697cd){_0x73c230[_0xa0b6('0x48')]=_0x4697cd;return _0x73c230;})[_0xa0b6('0x2c')](respondWithFilteredResult(_0x434364,_0x51efda))[_0xa0b6('0x49')](handleError(_0x434364,null));};exports['show']=function(_0x19ceda,_0x4cd04f){var _0x47eaa6={'raw':![],'where':{'id':_0x19ceda['params']['id']}},_0x4d18e7={};_0x4d18e7[_0xa0b6('0x36')]=_[_0xa0b6('0x37')](db[_0xa0b6('0x33')]['rawAttributes']);_0x4d18e7[_0xa0b6('0x38')]=_[_0xa0b6('0x37')](_0x19ceda[_0xa0b6('0x38')]);_0x4d18e7['filters']=_[_0xa0b6('0x4a')](_0x4d18e7['model'],_0x4d18e7[_0xa0b6('0x38')]);_0x47eaa6[_0xa0b6('0x3a')]=_[_0xa0b6('0x4a')](_0x4d18e7[_0xa0b6('0x36')],qs[_0xa0b6('0x3b')](_0x19ceda[_0xa0b6('0x38')][_0xa0b6('0x3b')]));_0x47eaa6[_0xa0b6('0x3a')]=_0x47eaa6[_0xa0b6('0x3a')][_0xa0b6('0x3c')]?_0x47eaa6['attributes']:_0x4d18e7[_0xa0b6('0x36')];if(_0x19ceda['query']['includeAll']){_0x47eaa6[_0xa0b6('0x47')]=[{'all':!![]}];}_0x47eaa6=_[_0xa0b6('0x44')]({},_0x47eaa6,_0x19ceda[_0xa0b6('0x45')]);return db[_0xa0b6('0x33')][_0xa0b6('0x4b')](_0x47eaa6)[_0xa0b6('0x2c')](handleEntityNotFound(_0x4cd04f,null))[_0xa0b6('0x2c')](respondWithResult(_0x4cd04f,null))[_0xa0b6('0x49')](handleError(_0x4cd04f,null));};exports[_0xa0b6('0x4c')]=function(_0x1bb435,_0x149b5e){return db[_0xa0b6('0x33')]['create'](_0x1bb435[_0xa0b6('0x4d')],{})['then'](function(_0x4e5364){var _0x4f024d=_0x1bb435[_0xa0b6('0x4e')][_0xa0b6('0x4f')]({'plain':!![]});if(!_0x4f024d)throw new Error(_0xa0b6('0x50'));if(_0x4f024d['role']===_0xa0b6('0x4e')){var _0x3aa1fe=_0x4e5364[_0xa0b6('0x4f')]({'plain':!![]});var _0xbc20ef=_0xa0b6('0x51');return db[_0xa0b6('0x52')][_0xa0b6('0x4b')]({'where':{'name':_0xbc20ef,'userProfileId':_0x4f024d[_0xa0b6('0x53')]},'raw':!![]})[_0xa0b6('0x2c')](function(_0x4ec520){if(_0x4ec520&&_0x4ec520[_0xa0b6('0x54')]===0x0){return db[_0xa0b6('0x2e')][_0xa0b6('0x4c')]({'name':_0x3aa1fe[_0xa0b6('0x30')],'resourceId':_0x3aa1fe['id'],'type':_0x4ec520['name'],'sectionId':_0x4ec520['id']},{})[_0xa0b6('0x2c')](function(){return _0x4e5364;});}else{return _0x4e5364;}})[_0xa0b6('0x49')](function(_0x2aeaa3){logger[_0xa0b6('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aeaa3);throw _0x2aeaa3;});}return _0x4e5364;})[_0xa0b6('0x2c')](respondWithResult(_0x149b5e,0xc9))['catch'](handleError(_0x149b5e,null));};exports[_0xa0b6('0x55')]=function(_0x44676b,_0x2896db){var _0x3befa4={'where':{'id':_0x44676b['params']['id']}},_0x547c7e={};_0x547c7e[_0xa0b6('0x36')]=_[_0xa0b6('0x37')](db[_0xa0b6('0x33')][_0xa0b6('0x34')]);_0x3befa4[_0xa0b6('0x3a')]=_[_0xa0b6('0x4a')](_0x547c7e[_0xa0b6('0x36')],qs[_0xa0b6('0x3b')](_0x44676b[_0xa0b6('0x38')][_0xa0b6('0x3b')]));_0x3befa4[_0xa0b6('0x3a')]=_0x3befa4[_0xa0b6('0x3a')][_0xa0b6('0x3c')]?_0x3befa4[_0xa0b6('0x3a')]:_0x547c7e[_0xa0b6('0x36')];if(_0x44676b[_0xa0b6('0x38')][_0xa0b6('0x46')]){_0x3befa4[_0xa0b6('0x47')]=[{'all':!![]}];}_0x3befa4=_[_0xa0b6('0x44')]({},_0x3befa4,_0x44676b[_0xa0b6('0x45')]);return db['Dashboard'][_0xa0b6('0x4b')](_0x3befa4)[_0xa0b6('0x2c')](handleEntityNotFound(_0x2896db,null))[_0xa0b6('0x2c')](function(_0x243d55){if(_0x243d55){var _0x3be304=_0x243d55[_0xa0b6('0x4f')]({'plain':!![]});_0x3be304=qs[_0xa0b6('0x56')](_0x3be304,['id','createdAt',_0xa0b6('0x57')]);_0x44676b[_0xa0b6('0x4d')]=_[_0xa0b6('0x56')](_0x44676b[_0xa0b6('0x4d')],['id',_0xa0b6('0x58'),_0xa0b6('0x57')]);return db[_0xa0b6('0x33')]['create'](_['merge'](_0x3be304,_0x44676b[_0xa0b6('0x4d')]),{'include':_0x44676b[_0xa0b6('0x38')][_0xa0b6('0x46')]?[{'all':!![]}]:undefined})[_0xa0b6('0x2c')](function(_0x16b2fc){var _0x2e1460=_0x44676b['user'][_0xa0b6('0x4f')]({'plain':!![]});if(!_0x2e1460)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e1460['role']==='user'){var _0x435770=_0x16b2fc[_0xa0b6('0x4f')]({'plain':!![]});var _0x32b7d8='CustomDashboards';return db[_0xa0b6('0x52')][_0xa0b6('0x4b')]({'where':{'name':_0x32b7d8,'userProfileId':_0x2e1460[_0xa0b6('0x53')]},'raw':!![]})[_0xa0b6('0x2c')](function(_0x3099d9){if(_0x3099d9&&_0x3099d9[_0xa0b6('0x54')]===0x0){return db[_0xa0b6('0x2e')][_0xa0b6('0x4c')]({'name':_0x435770[_0xa0b6('0x30')],'resourceId':_0x435770['id'],'type':_0x3099d9['name'],'sectionId':_0x3099d9['id']},{})[_0xa0b6('0x2c')](function(){return _0x16b2fc;});}else{return _0x16b2fc;}})[_0xa0b6('0x49')](function(_0x299bd4){logger[_0xa0b6('0x2f')](_0xa0b6('0x59'),_0x299bd4);throw _0x299bd4;});}return _0x16b2fc;});}})['then'](respondWithResult(_0x2896db,0xc9))['catch'](handleError(_0x2896db,null));};exports['update']=function(_0x582671,_0x498278){if(_0x582671['body']['id']){delete _0x582671['body']['id'];}return db[_0xa0b6('0x33')][_0xa0b6('0x4b')]({'where':{'id':_0x582671[_0xa0b6('0x5a')]['id']}})[_0xa0b6('0x2c')](handleEntityNotFound(_0x498278,null))[_0xa0b6('0x2c')](saveUpdates(_0x582671[_0xa0b6('0x4d')],null))['then'](respondWithResult(_0x498278,null))[_0xa0b6('0x49')](handleError(_0x498278,null));};exports[_0xa0b6('0x2d')]=function(_0x324156,_0x597afd){return db[_0xa0b6('0x33')]['find']({'where':{'id':_0x324156[_0xa0b6('0x5a')]['id']}})[_0xa0b6('0x2c')](handleEntityNotFound(_0x597afd,null))[_0xa0b6('0x2c')](removeEntity(_0x597afd,null))[_0xa0b6('0x49')](handleError(_0x597afd,null));};function widgetAttributes(_0x3682a8){try{switch(_0x3682a8['type']){case'iframe':return[{'name':_0xa0b6('0x5b'),'value':_0x3682a8[_0xa0b6('0x5b')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x5d')]:undefined)||_0xa0b6('0x5e')}];case _0xa0b6('0x5f'):return[{'name':_0xa0b6('0x60'),'value':_0x3682a8[_0xa0b6('0x60')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x5d')]:undefined)||''}];case _0xa0b6('0x61'):return[{'name':_0xa0b6('0x62'),'value':_0x3682a8[_0xa0b6('0x62')]||(_0x3682a8['attrs']&&_0x3682a8['attrs'][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x5d')]:undefined)||_0xa0b6('0x63')},{'name':_0xa0b6('0x64'),'value':_0x3682a8[_0xa0b6('0x64')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x1]?_0x3682a8[_0xa0b6('0x5c')][0x1][_0xa0b6('0x5d')]:undefined)||'0.00'},{'name':_0xa0b6('0x65'),'value':_0x3682a8[_0xa0b6('0x65')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x2]?_0x3682a8[_0xa0b6('0x5c')][0x2][_0xa0b6('0x5d')]:undefined)||0xc}];case _0xa0b6('0x66'):return[{'name':'attrMetric','value':_0x3682a8[_0xa0b6('0x67')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x5d')]:undefined)||_0xa0b6('0x68')},{'name':_0xa0b6('0x69'),'value':_0x3682a8[_0xa0b6('0x69')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x1]?_0x3682a8[_0xa0b6('0x5c')][0x1][_0xa0b6('0x5d')]:undefined)||[]},{'name':_0xa0b6('0x65'),'value':_0x3682a8[_0xa0b6('0x65')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x2]?_0x3682a8[_0xa0b6('0x5c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x3682a8[_0xa0b6('0x6a')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x3]?_0x3682a8[_0xa0b6('0x5c')][0x3]['value']:undefined)||_0xa0b6('0x6b')},{'name':_0xa0b6('0x6c'),'value':_0x3682a8[_0xa0b6('0x6c')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x4]?_0x3682a8[_0xa0b6('0x5c')][0x4][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x6d'),'value':_0x3682a8[_0xa0b6('0x6d')]||(_0x3682a8['attrs']&&_0x3682a8['attrs'][0x5]?_0x3682a8[_0xa0b6('0x5c')][0x5]['value']:undefined)||''},{'name':_0xa0b6('0x6e'),'value':_0x3682a8[_0xa0b6('0x6e')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x6]?_0x3682a8[_0xa0b6('0x5c')][0x6][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x6f'),'value':_0x3682a8[_0xa0b6('0x6f')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8['attrs'][0x7]?_0x3682a8[_0xa0b6('0x5c')][0x7][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x70'),'value':_0x3682a8[_0xa0b6('0x70')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8['attrs'][0x8]?_0x3682a8['attrs'][0x8][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x71'),'value':_0x3682a8[_0xa0b6('0x71')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x9]?_0x3682a8[_0xa0b6('0x5c')][0x9][_0xa0b6('0x5d')]:undefined)||''}];case _0xa0b6('0x72'):case _0xa0b6('0x73'):return[{'name':_0xa0b6('0x74'),'value':_0x3682a8[_0xa0b6('0x74')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8['attrs'][0x0][_0xa0b6('0x5d')]:undefined)||'total'},{'name':_0xa0b6('0x75'),'value':_0x3682a8[_0xa0b6('0x75')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x1]?_0x3682a8[_0xa0b6('0x5c')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3682a8['attrSerie3']||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x2]?_0x3682a8[_0xa0b6('0x5c')][0x2][_0xa0b6('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3682a8[_0xa0b6('0x69')]||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x3]?_0x3682a8[_0xa0b6('0x5c')][0x3][_0xa0b6('0x5d')]:undefined)||[]},{'name':_0xa0b6('0x6a'),'value':_0x3682a8[_0xa0b6('0x6a')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8['attrs'][0x4]?_0x3682a8[_0xa0b6('0x5c')][0x4][_0xa0b6('0x5d')]:undefined)||'voice'},{'name':_0xa0b6('0x6c'),'value':_0x3682a8['attrEmailAccounts']||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x5]?_0x3682a8[_0xa0b6('0x5c')][0x5][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x6d'),'value':_0x3682a8[_0xa0b6('0x6d')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x6]?_0x3682a8[_0xa0b6('0x5c')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3682a8[_0xa0b6('0x6e')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x7]?_0x3682a8[_0xa0b6('0x5c')][0x7]['value']:undefined)||''},{'name':_0xa0b6('0x6f'),'value':_0x3682a8[_0xa0b6('0x6f')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8['attrs'][0x8]?_0x3682a8['attrs'][0x8][_0xa0b6('0x5d')]:undefined)||''},{'name':_0xa0b6('0x70'),'value':_0x3682a8[_0xa0b6('0x70')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8['attrs'][0x9]?_0x3682a8[_0xa0b6('0x5c')][0x9]['value']:undefined)||''},{'name':_0xa0b6('0x71'),'value':_0x3682a8['attrChatWebsites']||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0xa]?_0x3682a8[_0xa0b6('0x5c')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xa0b6('0x76'),'type':_0x3682a8['reportType']||(_0x3682a8['attrs']&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x35')]:undefined)||null,'value':_0x3682a8[_0xa0b6('0x76')]||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x0]?_0x3682a8[_0xa0b6('0x5c')][0x0][_0xa0b6('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x3682a8['attrRefresh']||(_0x3682a8[_0xa0b6('0x5c')]&&_0x3682a8[_0xa0b6('0x5c')][0x1]?_0x3682a8[_0xa0b6('0x5c')][0x1][_0xa0b6('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x46fb91){logger['error'](_0xa0b6('0x77'),JSON[_0xa0b6('0x78')](_0x46fb91));return[];}}exports['addItem']=function(_0x50c49b,_0x7cc879,_0x51f3b3){if(_0x50c49b['body']['id']){delete _0x50c49b[_0xa0b6('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x50c49b[_0xa0b6('0x5a')]['id']}})[_0xa0b6('0x2c')](handleEntityNotFound(_0x7cc879,null))[_0xa0b6('0x2c')](function(_0x129fac){if(_0x129fac){_0x50c49b['body'][_0xa0b6('0x79')]=_0x129fac['id'];_0x50c49b['body'][_0xa0b6('0x5c')]=widgetAttributes(_0x50c49b['body']);return db[_0xa0b6('0x7a')][_0xa0b6('0x4c')](_0x50c49b[_0xa0b6('0x4d')]);}})[_0xa0b6('0x2c')](respondWithResult(_0x7cc879,null))['catch'](handleError(_0x7cc879,null));};exports[_0xa0b6('0x7b')]=function(_0x2f5bbd,_0x16bf76,_0x360c26){var _0x27c544={};var _0x435762={};var _0x27cfba;var _0x3ffec5;return db[_0xa0b6('0x33')][_0xa0b6('0x7c')]({'where':{'id':_0x2f5bbd[_0xa0b6('0x5a')]['id']}})[_0xa0b6('0x2c')](handleEntityNotFound(_0x16bf76,null))[_0xa0b6('0x2c')](function(_0x4288d6){if(_0x4288d6){_0x27cfba=_0x4288d6;_0x435762[_0xa0b6('0x36')]=_['keys'](db[_0xa0b6('0x7a')]['rawAttributes']);_0x435762[_0xa0b6('0x38')]=_[_0xa0b6('0x37')](_0x2f5bbd[_0xa0b6('0x38')]);_0x435762['filters']=_['intersection'](_0x435762['model'],_0x435762['query']);_0x27c544['attributes']=_['intersection'](_0x435762[_0xa0b6('0x36')],qs[_0xa0b6('0x3b')](_0x2f5bbd['query'][_0xa0b6('0x3b')]));_0x27c544[_0xa0b6('0x3a')]=_0x27c544[_0xa0b6('0x3a')][_0xa0b6('0x3c')]?_0x27c544['attributes']:_0x435762[_0xa0b6('0x36')];_0x27c544[_0xa0b6('0x7d')]=qs[_0xa0b6('0x3f')](_0x2f5bbd[_0xa0b6('0x38')]['sort']);_0x27c544[_0xa0b6('0x40')]=qs[_0xa0b6('0x39')](_[_0xa0b6('0x41')](_0x2f5bbd['query'],_0x435762[_0xa0b6('0x39')]));if(_0x2f5bbd['query'][_0xa0b6('0x42')]){_0x27c544[_0xa0b6('0x40')]=_[_0xa0b6('0x44')](_0x27c544[_0xa0b6('0x40')],{'$or':_[_0xa0b6('0x32')](_0x27c544[_0xa0b6('0x3a')],function(_0x253184){var _0x15919c={};_0x15919c[_0x253184]={'$like':'%'+_0x2f5bbd[_0xa0b6('0x38')]['filter']+'%'};return _0x15919c;})});}_0x27c544=_[_0xa0b6('0x44')]({},_0x27c544,_0x2f5bbd[_0xa0b6('0x45')]);return _0x27cfba['getItems'](_0x27c544);}})[_0xa0b6('0x2c')](function(_0x7cd0be){if(_0x7cd0be){_0x3ffec5=_0x7cd0be[_0xa0b6('0x3c')];if(!_0x2f5bbd[_0xa0b6('0x38')][_0xa0b6('0x3d')](_0xa0b6('0x3e'))){_0x27c544[_0xa0b6('0x27')]=qs[_0xa0b6('0x27')](_0x2f5bbd[_0xa0b6('0x38')][_0xa0b6('0x27')]);_0x27c544['offset']=qs[_0xa0b6('0x25')](_0x2f5bbd[_0xa0b6('0x38')][_0xa0b6('0x25')]);}return _0x27cfba[_0xa0b6('0x7b')](_0x27c544);}})[_0xa0b6('0x2c')](function(_0x5dae2b){if(_0x5dae2b){return _0x5dae2b?{'count':_0x3ffec5,'rows':_0x5dae2b}:null;}})[_0xa0b6('0x2c')](respondWithResult(_0x16bf76,null))[_0xa0b6('0x49')](handleError(_0x16bf76,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8f67973..59f1e6e 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 _0x7298=['Dashboard','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x7298,0x12f));var _0x8729=function(_0xff2ece,_0x33b446){_0xff2ece=_0xff2ece-0x0;var _0x4a1f2f=_0x7298[_0xff2ece];return _0x4a1f2f;};'use strict';var EventEmitter=require(_0x8729('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x8729('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8729('0x2'),'afterUpdate':_0x8729('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45ad14){return function(_0x53cf42,_0x6d4b17,_0x2fdc6e){DashboardEvents[_0x8729('0x4')](_0x45ad14+':'+_0x53cf42['id'],_0x53cf42);DashboardEvents[_0x8729('0x4')](_0x45ad14,_0x53cf42);_0x2fdc6e(null);};}for(var e in events){if(events[_0x8729('0x5')](e)){var event=events[e];Dashboard[_0x8729('0x6')](e,emitEvent(event));}}module[_0x8729('0x7')]=DashboardEvents; \ No newline at end of file +var _0x3025=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x29f876,_0x1cf831){var _0x97e59f=function(_0x1fcc03){while(--_0x1fcc03){_0x29f876['push'](_0x29f876['shift']());}};_0x97e59f(++_0x1cf831);}(_0x3025,0x1c7));var _0x5302=function(_0x1488b5,_0x2d58e6){_0x1488b5=_0x1488b5-0x0;var _0x20f0ed=_0x3025[_0x1488b5];return _0x20f0ed;};'use strict';var EventEmitter=require(_0x5302('0x0'));var Dashboard=require(_0x5302('0x1'))['db'][_0x5302('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5302('0x3')](0x0);var events={'afterCreate':_0x5302('0x4'),'afterUpdate':_0x5302('0x5'),'afterDestroy':_0x5302('0x6')};function emitEvent(_0x414e92){return function(_0x110b96,_0x4b65a8,_0x1a0802){DashboardEvents[_0x5302('0x7')](_0x414e92+':'+_0x110b96['id'],_0x110b96);DashboardEvents['emit'](_0x414e92,_0x110b96);_0x1a0802(null);};}for(var e in events){if(events[_0x5302('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x5302('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 18b0288..beb704e 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 _0xf13e=['exports','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xf13e,0x1cb));var _0xef13=function(_0x2b68a0,_0x31dd39){_0x2b68a0=_0x2b68a0-0x0;var _0x3da45d=_0xf13e[_0x2b68a0];return _0x3da45d;};'use strict';var _=require(_0xef13('0x0'));var util=require(_0xef13('0x1'));var logger=require(_0xef13('0x2'))('api');var moment=require(_0xef13('0x3'));var BPromise=require(_0xef13('0x4'));var rp=require(_0xef13('0x5'));var fs=require('fs');var path=require(_0xef13('0x6'));var rimraf=require(_0xef13('0x7'));var config=require(_0xef13('0x8'));var attributes=require('./dashboard.attributes');module[_0xef13('0x9')]=function(_0xc339bf,_0x42878e){return _0xc339bf['define'](_0xef13('0xa'),attributes,{'tableName':_0xef13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1912=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','request-promise','path','rimraf'];(function(_0x251dea,_0x438307){var _0x4c3beb=function(_0x3870c2){while(--_0x3870c2){_0x251dea['push'](_0x251dea['shift']());}};_0x4c3beb(++_0x438307);}(_0x1912,0x8a));var _0x2191=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1912[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x2191('0x0'));var util=require(_0x2191('0x1'));var logger=require('../../config/logger')(_0x2191('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2191('0x3'));var fs=require('fs');var path=require(_0x2191('0x4'));var rimraf=require(_0x2191('0x5'));var config=require(_0x2191('0x6'));var attributes=require(_0x2191('0x7'));module[_0x2191('0x8')]=function(_0x42d821,_0xc07bbe){return _0x42d821[_0x2191('0x9')](_0x2191('0xa'),attributes,{'tableName':_0x2191('0xb'),'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 c33c4f0..70b34a1 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 _0x53a9=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info'];(function(_0x55b6f9,_0xe106b3){var _0x324d7d=function(_0x328d61){while(--_0x328d61){_0x55b6f9['push'](_0x55b6f9['shift']());}};_0x324d7d(++_0xe106b3);}(_0x53a9,0xe0));var _0x953a=function(_0x58bdf3,_0x339b34){_0x58bdf3=_0x58bdf3-0x0;var _0x597229=_0x53a9[_0x58bdf3];return _0x597229;};'use strict';var _=require(_0x953a('0x0'));var util=require(_0x953a('0x1'));var moment=require(_0x953a('0x2'));var BPromise=require(_0x953a('0x3'));var rs=require(_0x953a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x953a('0x5'))['db'];var utils=require(_0x953a('0x6'));var logger=require('../../config/logger')(_0x953a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x953a('0x8')]({'port':0x232a});config[_0x953a('0x9')]=_['defaults'](config[_0x953a('0x9')],{'host':_0x953a('0xa'),'port':0x18eb});var socket=require(_0x953a('0xb'))(new Redis(config[_0x953a('0x9')]));require(_0x953a('0xc'))['register'](socket);function respondWithRpcPromise(_0x3aaf74,_0x35ca60,_0x7a5a68){return new BPromise(function(_0x49dfeb,_0x212770){return client[_0x953a('0xd')](_0x3aaf74,_0x7a5a68)[_0x953a('0xe')](function(_0x2f2418){logger[_0x953a('0xf')](_0x953a('0x10'),_0x35ca60,_0x953a('0x11'));logger[_0x953a('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x35ca60,_0x953a('0x11'),JSON[_0x953a('0x13')](_0x2f2418));if(_0x2f2418[_0x953a('0x14')]){if(_0x2f2418[_0x953a('0x14')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x35ca60,_0x2f2418[_0x953a('0x14')][_0x953a('0x15')]);return _0x212770(_0x2f2418[_0x953a('0x14')]['message']);}logger[_0x953a('0x14')](_0x953a('0x10'),_0x35ca60,_0x2f2418[_0x953a('0x14')][_0x953a('0x15')]);return _0x49dfeb(_0x2f2418[_0x953a('0x14')][_0x953a('0x15')]);}else{logger['info'](_0x953a('0x10'),_0x35ca60,_0x953a('0x11'));_0x49dfeb(_0x2f2418[_0x953a('0x16')][_0x953a('0x15')]);}})[_0x953a('0x17')](function(_0x46864a){logger['error']('Dashboard,\x20%s,\x20%s',_0x35ca60,_0x46864a);_0x212770(_0x46864a);});});} \ No newline at end of file +var _0x24b4=['error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x316d15,_0x3e91df){var _0x1bb71a=function(_0xe5a2a4){while(--_0xe5a2a4){_0x316d15['push'](_0x316d15['shift']());}};_0x1bb71a(++_0x3e91df);}(_0x24b4,0x139));var _0x424b=function(_0x150737,_0x4d1f68){_0x150737=_0x150737-0x0;var _0x76fa42=_0x24b4[_0x150737];return _0x76fa42;};'use strict';var _=require(_0x424b('0x0'));var util=require(_0x424b('0x1'));var moment=require(_0x424b('0x2'));var BPromise=require(_0x424b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x424b('0x4'));var db=require(_0x424b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x424b('0x6'))('rpc');var config=require(_0x424b('0x7'));var jayson=require(_0x424b('0x8'));var client=jayson[_0x424b('0x9')][_0x424b('0xa')]({'port':0x232a});config[_0x424b('0xb')]=_[_0x424b('0xc')](config[_0x424b('0xb')],{'host':_0x424b('0xd'),'port':0x18eb});var socket=require(_0x424b('0xe'))(new Redis(config[_0x424b('0xb')]));require(_0x424b('0xf'))[_0x424b('0x10')](socket);function respondWithRpcPromise(_0x23b575,_0x4dd7f5,_0x3890fc){return new BPromise(function(_0x1559a6,_0x1f5074){return client[_0x424b('0x11')](_0x23b575,_0x3890fc)[_0x424b('0x12')](function(_0x52e730){logger['info'](_0x424b('0x13'),_0x4dd7f5,'request\x20sent');logger[_0x424b('0x14')](_0x424b('0x15'),_0x4dd7f5,_0x424b('0x16'),JSON['stringify'](_0x52e730));if(_0x52e730[_0x424b('0x17')]){if(_0x52e730[_0x424b('0x17')]['code']===0x1f4){logger['error'](_0x424b('0x13'),_0x4dd7f5,_0x52e730['error'][_0x424b('0x18')]);return _0x1f5074(_0x52e730['error'][_0x424b('0x18')]);}logger[_0x424b('0x17')](_0x424b('0x13'),_0x4dd7f5,_0x52e730[_0x424b('0x17')]['message']);return _0x1559a6(_0x52e730[_0x424b('0x17')][_0x424b('0x18')]);}else{logger[_0x424b('0x19')]('Dashboard,\x20%s,\x20%s',_0x4dd7f5,_0x424b('0x16'));_0x1559a6(_0x52e730[_0x424b('0x1a')]['message']);}})[_0x424b('0x1b')](function(_0x283529){logger['error']('Dashboard,\x20%s,\x20%s',_0x4dd7f5,_0x283529);_0x1f5074(_0x283529);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 81b5a4b..e9cd412 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 _0x683c=['./dashboard.events','remove','update','emit','length'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0x683c,0x8c));var _0xc683=function(_0xf31a31,_0x21d199){_0xf31a31=_0xf31a31-0x0;var _0x6d1b72=_0x683c[_0xf31a31];return _0x6d1b72;};'use strict';var DashboardEvents=require(_0xc683('0x0'));var events=['save',_0xc683('0x1'),_0xc683('0x2')];function createListener(_0xdeb357,_0x4ee3ed){return function(_0x11eab7){_0x4ee3ed[_0xc683('0x3')](_0xdeb357,_0x11eab7);};}function removeListener(_0x226ebc,_0x71e3f2){return function(){DashboardEvents['removeListener'](_0x226ebc,_0x71e3f2);};}exports['register']=function(_0x469528){for(var _0x59dbae=0x0,_0x7f6408=events[_0xc683('0x4')];_0x59dbae<_0x7f6408;_0x59dbae++){var _0x14ff70=events[_0x59dbae];var _0x289a0=createListener('dashboard:'+_0x14ff70,_0x469528);DashboardEvents['on'](_0x14ff70,_0x289a0);}}; \ No newline at end of file +var _0xe69f=['remove','update','removeListener','register','length','./dashboard.events'];(function(_0xfb7bc0,_0x44ef58){var _0x40b7ee=function(_0x13545b){while(--_0x13545b){_0xfb7bc0['push'](_0xfb7bc0['shift']());}};_0x40b7ee(++_0x44ef58);}(_0xe69f,0x143));var _0xfe69=function(_0x2c189b,_0x327969){_0x2c189b=_0x2c189b-0x0;var _0x351def=_0xe69f[_0x2c189b];return _0x351def;};'use strict';var DashboardEvents=require(_0xfe69('0x0'));var events=['save',_0xfe69('0x1'),_0xfe69('0x2')];function createListener(_0x4798a4,_0x1b3c3c){return function(_0x35af35){_0x1b3c3c['emit'](_0x4798a4,_0x35af35);};}function removeListener(_0x44f0fb,_0xdb12f8){return function(){DashboardEvents[_0xfe69('0x3')](_0x44f0fb,_0xdb12f8);};}exports[_0xfe69('0x4')]=function(_0x3a2f62){for(var _0x355e19=0x0,_0x588f1c=events[_0xfe69('0x5')];_0x355e19<_0x588f1c;_0x355e19++){var _0x1408d9=events[_0x355e19];var _0x3114d4=createListener('dashboard:'+_0x1408d9,_0x3a2f62);DashboardEvents['on'](_0x1408d9,_0x3114d4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0e8a5dd..17a5fb9 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 _0xa22c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','/:id/clone','clone','addItem','put','update','destroy','exports','multer','util','path'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0xa22c,0x1ad));var _0xca22=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa22c[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xca22('0x0'));var util=require(_0xca22('0x1'));var path=require(_0xca22('0x2'));var timeout=require(_0xca22('0x3'));var express=require(_0xca22('0x4'));var router=express[_0xca22('0x5')]();var fs_extra=require(_0xca22('0x6'));var auth=require(_0xca22('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xca22('0x8'));var controller=require(_0xca22('0x9'));router[_0xca22('0xa')]('/',auth[_0xca22('0xb')](),controller[_0xca22('0xc')]);router[_0xca22('0xa')](_0xca22('0xd'),auth[_0xca22('0xb')](),controller[_0xca22('0xe')]);router['get'](_0xca22('0xf'),auth[_0xca22('0xb')](),controller['getItems']);router[_0xca22('0x10')]('/',auth[_0xca22('0xb')](),controller['create']);router['post'](_0xca22('0x11'),auth['isAuthenticated'](),controller[_0xca22('0x12')]);router[_0xca22('0x10')](_0xca22('0xf'),auth[_0xca22('0xb')](),controller[_0xca22('0x13')]);router[_0xca22('0x14')](_0xca22('0xd'),auth[_0xca22('0xb')](),controller[_0xca22('0x15')]);router['delete'](_0xca22('0xd'),auth[_0xca22('0xb')](),controller[_0xca22('0x16')]);module[_0xca22('0x17')]=router; \ No newline at end of file +var _0xacb8=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','put','delete','exports'];(function(_0x414d91,_0x160508){var _0x2b9e6f=function(_0x2700bf){while(--_0x2700bf){_0x414d91['push'](_0x414d91['shift']());}};_0x2b9e6f(++_0x160508);}(_0xacb8,0x1b5));var _0x8acb=function(_0x442ae1,_0x34e977){_0x442ae1=_0x442ae1-0x0;var _0x585adb=_0xacb8[_0x442ae1];return _0x585adb;};'use strict';var multer=require(_0x8acb('0x0'));var util=require(_0x8acb('0x1'));var path=require(_0x8acb('0x2'));var timeout=require('connect-timeout');var express=require(_0x8acb('0x3'));var router=express[_0x8acb('0x4')]();var fs_extra=require(_0x8acb('0x5'));var auth=require(_0x8acb('0x6'));var interaction=require(_0x8acb('0x7'));var config=require(_0x8acb('0x8'));var controller=require('./dashboard.controller');router[_0x8acb('0x9')]('/',auth[_0x8acb('0xa')](),controller[_0x8acb('0xb')]);router[_0x8acb('0x9')](_0x8acb('0xc'),auth[_0x8acb('0xa')](),controller[_0x8acb('0xd')]);router['get'](_0x8acb('0xe'),auth[_0x8acb('0xa')](),controller[_0x8acb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8acb('0x10')]);router[_0x8acb('0x11')](_0x8acb('0x12'),auth[_0x8acb('0xa')](),controller[_0x8acb('0x13')]);router[_0x8acb('0x11')](_0x8acb('0xe'),auth[_0x8acb('0xa')](),controller['addItem']);router[_0x8acb('0x14')](_0x8acb('0xc'),auth[_0x8acb('0xa')](),controller['update']);router[_0x8acb('0x15')](_0x8acb('0xc'),auth[_0x8acb('0xa')](),controller['destroy']);module[_0x8acb('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fdd09ec..965c5db 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 _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x5bb60e,_0x171676){var _0x753d4f=function(_0x403495){while(--_0x403495){_0x5bb60e['push'](_0x5bb60e['shift']());}};_0x753d4f(++_0x171676);}(_0x326f,0xd1));var _0xf326=function(_0x2502f2,_0x5f42af){_0x2502f2=_0x2502f2-0x0;var _0x5a2ed6=_0x326f[_0x2502f2];return _0x5a2ed6;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3cf233,_0x3201c0){_0x3cf233=_0x3cf233-0x0;var _0x2cd1df=_0xb4c7[_0x3cf233];return _0x2cd1df;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ff36b76..886ea83 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 _0x522b=['../../config/license/util','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','destroy','type','iframe','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','update','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x298d2a,_0x3c524c){var _0x115562=function(_0x2a2020){while(--_0x2a2020){_0x298d2a['push'](_0x298d2a['shift']());}};_0x115562(++_0x3c524c);}(_0x522b,0x1c3));var _0xb522=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x522b[_0x2eac4f];return _0x58f73b;};'use strict';var emlformat=require(_0xb522('0x0'));var rimraf=require(_0xb522('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb522('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb522('0x3'));var Mustache=require(_0xb522('0x4'));var util=require('util');var path=require(_0xb522('0x5'));var sox=require(_0xb522('0x6'));var csv=require(_0xb522('0x7'));var ejs=require(_0xb522('0x8'));var fs=require('fs');var fs_extra=require(_0xb522('0x9'));var _=require('lodash');var squel=require(_0xb522('0xa'));var crypto=require(_0xb522('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb522('0x7'));var querystring=require('querystring');var Papa=require(_0xb522('0xc'));var Redis=require(_0xb522('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb522('0xe'));var as=require(_0xb522('0xf'));var hardwareService=require(_0xb522('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb522('0x11'));var config=require(_0xb522('0x12'));var licenseUtil=require(_0xb522('0x13'));var db=require('../../mysqldb')['db'];config[_0xb522('0x14')]=_['defaults'](config[_0xb522('0x14')],{'host':_0xb522('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb522('0x14')]));require('./dashboardItem.socket')[_0xb522('0x16')](socket);function respondWithStatusCode(_0x3cff05,_0x3958ce){_0x3958ce=_0x3958ce||0xcc;return function(_0x369cd9){if(_0x369cd9){return _0x3cff05[_0xb522('0x17')](_0x3958ce);}return _0x3cff05[_0xb522('0x18')](_0x3958ce)[_0xb522('0x19')]();};}function respondWithResult(_0x4c31cd,_0x1c778f){_0x1c778f=_0x1c778f||0xc8;return function(_0x56abe9){if(_0x56abe9){return _0x4c31cd[_0xb522('0x18')](_0x1c778f)[_0xb522('0x1a')](_0x56abe9);}};}function respondWithFilteredResult(_0x33f6ea,_0x47a273){return function(_0x2077e8){if(_0x2077e8){var _0x49a898=typeof _0x47a273[_0xb522('0x1b')]===_0xb522('0x1c')&&typeof _0x47a273[_0xb522('0x1d')]===_0xb522('0x1c');var _0x476837=_0x2077e8[_0xb522('0x1e')];var _0x326769=_0x49a898?0x0:_0x47a273['offset'];var _0x58a513=_0x49a898?_0x2077e8['count']:_0x47a273[_0xb522('0x1b')]+_0x47a273[_0xb522('0x1d')];var _0x2c795a;if(_0x58a513>=_0x476837){_0x58a513=_0x476837;_0x2c795a=0xc8;}else{_0x2c795a=0xce;}_0x33f6ea[_0xb522('0x18')](_0x2c795a);return _0x33f6ea[_0xb522('0x1f')](_0xb522('0x20'),_0x326769+'-'+_0x58a513+'/'+_0x476837)[_0xb522('0x1a')](_0x2077e8);}return null;};}function patchUpdates(_0x1eece7){return function(_0x45f510){try{jsonpatch[_0xb522('0x21')](_0x45f510,_0x1eece7,!![]);}catch(_0x3cf1a5){return BPromise[_0xb522('0x22')](_0x3cf1a5);}return _0x45f510[_0xb522('0x23')]();};}function saveUpdates(_0x5434ef,_0x2d9ddf){return function(_0x2baa5b){if(_0x2baa5b){return _0x2baa5b['update'](_0x5434ef)[_0xb522('0x24')](function(_0x149abf){return _0x149abf;});}return null;};}function removeEntity(_0x175683,_0x52d5db){return function(_0x434084){if(_0x434084){return _0x434084['destroy']()[_0xb522('0x24')](function(){_0x175683[_0xb522('0x18')](0xcc)[_0xb522('0x19')]();});}};}function handleEntityNotFound(_0x4295e6,_0x5ed9ae){return function(_0x518f56){if(!_0x518f56){_0x4295e6[_0xb522('0x17')](0x194);}return _0x518f56;};}function handleError(_0x4a6599,_0x1523ed){_0x1523ed=_0x1523ed||0x1f4;return function(_0x430491){logger[_0xb522('0x25')](_0x430491['stack']);if(_0x430491[_0xb522('0x26')]){delete _0x430491[_0xb522('0x26')];}_0x4a6599['status'](_0x1523ed)[_0xb522('0x27')](_0x430491);};}exports[_0xb522('0x28')]=function(_0x14a4af,_0x10fa51){var _0x139a9a={'raw':![],'where':{'id':_0x14a4af[_0xb522('0x29')]['id']}},_0x5bc250={};_0x5bc250[_0xb522('0x2a')]=_[_0xb522('0x2b')](db[_0xb522('0x2c')][_0xb522('0x2d')]);_0x5bc250[_0xb522('0x2e')]=_[_0xb522('0x2b')](_0x14a4af['query']);_0x5bc250[_0xb522('0x2f')]=_[_0xb522('0x30')](_0x5bc250[_0xb522('0x2a')],_0x5bc250['query']);_0x139a9a[_0xb522('0x31')]=_[_0xb522('0x30')](_0x5bc250['model'],qs['fields'](_0x14a4af[_0xb522('0x2e')][_0xb522('0x32')]));_0x139a9a[_0xb522('0x31')]=_0x139a9a[_0xb522('0x31')][_0xb522('0x33')]?_0x139a9a[_0xb522('0x31')]:_0x5bc250[_0xb522('0x2a')];if(_0x14a4af[_0xb522('0x2e')][_0xb522('0x34')]){_0x139a9a[_0xb522('0x35')]=[{'all':!![]}];}_0x139a9a=_[_0xb522('0x36')]({},_0x139a9a,_0x14a4af[_0xb522('0x37')]);return db[_0xb522('0x2c')][_0xb522('0x38')](_0x139a9a)[_0xb522('0x24')](handleEntityNotFound(_0x10fa51,null))[_0xb522('0x24')](respondWithResult(_0x10fa51,null))[_0xb522('0x39')](handleError(_0x10fa51,null));};exports[_0xb522('0x3a')]=function(_0x37853e,_0x4beccd){return db['DashboardItem']['find']({'where':{'id':_0x37853e[_0xb522('0x29')]['id']}})[_0xb522('0x24')](handleEntityNotFound(_0x4beccd,null))[_0xb522('0x24')](removeEntity(_0x4beccd,null))[_0xb522('0x39')](handleError(_0x4beccd,null));};function widgetAttributes(_0x9fc420){try{switch(_0x9fc420[_0xb522('0x3b')]){case _0xb522('0x3c'):return[{'name':'attrUrl','value':_0x9fc420['attrUrl']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3e')]:undefined)||_0xb522('0x3f')}];case _0xb522('0x40'):return[{'name':_0xb522('0x41'),'value':_0x9fc420[_0xb522('0x41')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x0]?_0x9fc420['attrs'][0x0][_0xb522('0x3e')]:undefined)||''}];case _0xb522('0x42'):return[{'name':'attrHourFormat','value':_0x9fc420['attrHourFormat']||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3e')]:undefined)||_0xb522('0x43')},{'name':_0xb522('0x44'),'value':_0x9fc420[_0xb522('0x44')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x1]?_0x9fc420[_0xb522('0x3d')][0x1][_0xb522('0x3e')]:undefined)||_0xb522('0x45')},{'name':_0xb522('0x46'),'value':_0x9fc420['attrFontSize']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x2]?_0x9fc420[_0xb522('0x3d')][0x2]['value']:undefined)||0xc}];case _0xb522('0x47'):return[{'name':_0xb522('0x48'),'value':_0x9fc420['attrMetric']||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3e')]:undefined)||_0xb522('0x49')},{'name':_0xb522('0x4a'),'value':_0x9fc420[_0xb522('0x4a')]||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x1]?_0x9fc420['attrs'][0x1][_0xb522('0x3e')]:undefined)||[]},{'name':_0xb522('0x46'),'value':_0x9fc420[_0xb522('0x46')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x2]?_0x9fc420[_0xb522('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0xb522('0x4b'),'value':_0x9fc420[_0xb522('0x4b')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x3]?_0x9fc420[_0xb522('0x3d')][0x3][_0xb522('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x9fc420[_0xb522('0x4c')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x4]?_0x9fc420[_0xb522('0x3d')][0x4]['value']:undefined)||''},{'name':_0xb522('0x4d'),'value':_0x9fc420['attrFaxAccounts']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x5]?_0x9fc420['attrs'][0x5][_0xb522('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x9fc420[_0xb522('0x4e')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x6]?_0x9fc420[_0xb522('0x3d')][0x6][_0xb522('0x3e')]:undefined)||''},{'name':_0xb522('0x4f'),'value':_0x9fc420[_0xb522('0x4f')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x7]?_0x9fc420[_0xb522('0x3d')][0x7][_0xb522('0x3e')]:undefined)||''},{'name':_0xb522('0x50'),'value':_0x9fc420['attrWhatsappAccounts']||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x8]?_0x9fc420['attrs'][0x8][_0xb522('0x3e')]:undefined)||''},{'name':_0xb522('0x51'),'value':_0x9fc420[_0xb522('0x51')]||(_0x9fc420['attrs']&&_0x9fc420['attrs'][0x9]?_0x9fc420['attrs'][0x9]['value']:undefined)||''}];case _0xb522('0x52'):case _0xb522('0x53'):return[{'name':_0xb522('0x54'),'value':_0x9fc420[_0xb522('0x54')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3e')]:undefined)||'total'},{'name':_0xb522('0x55'),'value':_0x9fc420['attrSerie2']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x1]?_0x9fc420[_0xb522('0x3d')][0x1]['value']:undefined)||null},{'name':_0xb522('0x56'),'value':_0x9fc420[_0xb522('0x56')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x2]?_0x9fc420[_0xb522('0x3d')][0x2][_0xb522('0x3e')]:undefined)||null},{'name':_0xb522('0x4a'),'value':_0x9fc420[_0xb522('0x4a')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x3]?_0x9fc420['attrs'][0x3]['value']:undefined)||[]},{'name':_0xb522('0x4b'),'value':_0x9fc420[_0xb522('0x4b')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x4]?_0x9fc420[_0xb522('0x3d')][0x4][_0xb522('0x3e')]:undefined)||_0xb522('0x57')},{'name':_0xb522('0x4c'),'value':_0x9fc420[_0xb522('0x4c')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x5]?_0x9fc420[_0xb522('0x3d')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x9fc420[_0xb522('0x4d')]||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x6]?_0x9fc420[_0xb522('0x3d')][0x6][_0xb522('0x3e')]:undefined)||''},{'name':_0xb522('0x4e'),'value':_0x9fc420[_0xb522('0x4e')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x7]?_0x9fc420[_0xb522('0x3d')][0x7][_0xb522('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x9fc420[_0xb522('0x4f')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x8]?_0x9fc420[_0xb522('0x3d')][0x8][_0xb522('0x3e')]:undefined)||''},{'name':_0xb522('0x50'),'value':_0x9fc420[_0xb522('0x50')]||(_0x9fc420['attrs']&&_0x9fc420[_0xb522('0x3d')][0x9]?_0x9fc420['attrs'][0x9][_0xb522('0x3e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x9fc420['attrChatWebsites']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0xa]?_0x9fc420['attrs'][0xa][_0xb522('0x3e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x9fc420['reportType']||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3b')]:undefined)||null,'value':_0x9fc420[_0xb522('0x58')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420['attrs'][0x0]?_0x9fc420[_0xb522('0x3d')][0x0][_0xb522('0x3e')]:undefined)||null},{'name':_0xb522('0x59'),'value':_0x9fc420[_0xb522('0x59')]||(_0x9fc420[_0xb522('0x3d')]&&_0x9fc420[_0xb522('0x3d')][0x1]?_0x9fc420[_0xb522('0x3d')][0x1][_0xb522('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x333351){logger[_0xb522('0x25')](_0xb522('0x5a'),JSON[_0xb522('0x5b')](_0x333351));return[];}}exports['create']=function(_0x1109b6,_0x3a49da){if(_0x1109b6['body']){_0x1109b6[_0xb522('0x5c')][_0xb522('0x3d')]=widgetAttributes(_0x1109b6[_0xb522('0x5c')]);}return db['DashboardItem']['create'](_0x1109b6[_0xb522('0x5c')],{})['then'](respondWithResult(_0x3a49da,0xc9))['catch'](handleError(_0x3a49da,null));};exports[_0xb522('0x5d')]=function(_0x37b4a7,_0x875069){if(_0x37b4a7[_0xb522('0x5c')]['id']){delete _0x37b4a7['body']['id'];}_0x37b4a7[_0xb522('0x5c')][_0xb522('0x3d')]=widgetAttributes(_0x37b4a7['body']);return db[_0xb522('0x2c')][_0xb522('0x38')]({'where':{'id':_0x37b4a7['params']['id']}})[_0xb522('0x24')](handleEntityNotFound(_0x875069,null))[_0xb522('0x24')](saveUpdates(_0x37b4a7[_0xb522('0x5c')],null))[_0xb522('0x24')](respondWithResult(_0x875069,null))[_0xb522('0x39')](handleError(_0x875069,null));}; \ No newline at end of file +var _0xb296=['undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','attrOpenchannelAccounts','attrChatWebsites','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./dashboardItem.socket','sendStatus','status','end','json','offset'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb296,0xa3));var _0x6b29=function(_0x51e9cc,_0x214648){_0x51e9cc=_0x51e9cc-0x0;var _0xc2c3a=_0xb296[_0x51e9cc];return _0xc2c3a;};'use strict';var emlformat=require(_0x6b29('0x0'));var rimraf=require(_0x6b29('0x1'));var zipdir=require(_0x6b29('0x2'));var jsonpatch=require(_0x6b29('0x3'));var rp=require(_0x6b29('0x4'));var moment=require(_0x6b29('0x5'));var BPromise=require(_0x6b29('0x6'));var Mustache=require('mustache');var util=require(_0x6b29('0x7'));var path=require('path');var sox=require(_0x6b29('0x8'));var csv=require(_0x6b29('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b29('0xa'));var _=require(_0x6b29('0xb'));var squel=require(_0x6b29('0xc'));var crypto=require(_0x6b29('0xd'));var jsforce=require(_0x6b29('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b29('0x9'));var querystring=require(_0x6b29('0xf'));var Papa=require(_0x6b29('0x10'));var Redis=require(_0x6b29('0x11'));var authService=require(_0x6b29('0x12'));var qs=require(_0x6b29('0x13'));var as=require(_0x6b29('0x14'));var hardwareService=require(_0x6b29('0x15'));var logger=require('../../config/logger')(_0x6b29('0x16'));var utils=require(_0x6b29('0x17'));var config=require(_0x6b29('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b29('0x19'))['db'];config['redis']=_['defaults'](config[_0x6b29('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b29('0x1a')]));require(_0x6b29('0x1b'))['register'](socket);function respondWithStatusCode(_0x37a206,_0x222635){_0x222635=_0x222635||0xcc;return function(_0x9e1b53){if(_0x9e1b53){return _0x37a206[_0x6b29('0x1c')](_0x222635);}return _0x37a206[_0x6b29('0x1d')](_0x222635)[_0x6b29('0x1e')]();};}function respondWithResult(_0x383e5f,_0x578ab5){_0x578ab5=_0x578ab5||0xc8;return function(_0x45acdf){if(_0x45acdf){return _0x383e5f[_0x6b29('0x1d')](_0x578ab5)[_0x6b29('0x1f')](_0x45acdf);}};}function respondWithFilteredResult(_0x49620d,_0x4b348d){return function(_0xc9511c){if(_0xc9511c){var _0x298470=typeof _0x4b348d[_0x6b29('0x20')]===_0x6b29('0x21')&&typeof _0x4b348d[_0x6b29('0x22')]===_0x6b29('0x21');var _0x412e1d=_0xc9511c[_0x6b29('0x23')];var _0x555008=_0x298470?0x0:_0x4b348d[_0x6b29('0x20')];var _0xdf69a8=_0x298470?_0xc9511c[_0x6b29('0x23')]:_0x4b348d['offset']+_0x4b348d[_0x6b29('0x22')];var _0x2f2fdc;if(_0xdf69a8>=_0x412e1d){_0xdf69a8=_0x412e1d;_0x2f2fdc=0xc8;}else{_0x2f2fdc=0xce;}_0x49620d['status'](_0x2f2fdc);return _0x49620d[_0x6b29('0x24')](_0x6b29('0x25'),_0x555008+'-'+_0xdf69a8+'/'+_0x412e1d)['json'](_0xc9511c);}return null;};}function patchUpdates(_0x312e12){return function(_0x1696cd){try{jsonpatch[_0x6b29('0x26')](_0x1696cd,_0x312e12,!![]);}catch(_0x263fb2){return BPromise[_0x6b29('0x27')](_0x263fb2);}return _0x1696cd['save']();};}function saveUpdates(_0x2765d5,_0x4d7521){return function(_0x237cad){if(_0x237cad){return _0x237cad[_0x6b29('0x28')](_0x2765d5)[_0x6b29('0x29')](function(_0x5ab584){return _0x5ab584;});}return null;};}function removeEntity(_0x308142,_0x21c442){return function(_0x269d55){if(_0x269d55){return _0x269d55['destroy']()[_0x6b29('0x29')](function(){_0x308142[_0x6b29('0x1d')](0xcc)[_0x6b29('0x1e')]();});}};}function handleEntityNotFound(_0x654528,_0x5546b4){return function(_0x537092){if(!_0x537092){_0x654528[_0x6b29('0x1c')](0x194);}return _0x537092;};}function handleError(_0x207c39,_0x330a6d){_0x330a6d=_0x330a6d||0x1f4;return function(_0x18ea35){logger[_0x6b29('0x2a')](_0x18ea35[_0x6b29('0x2b')]);if(_0x18ea35[_0x6b29('0x2c')]){delete _0x18ea35['name'];}_0x207c39[_0x6b29('0x1d')](_0x330a6d)[_0x6b29('0x2d')](_0x18ea35);};}exports[_0x6b29('0x2e')]=function(_0x36e708,_0x36e293){var _0x2343c0={'raw':![],'where':{'id':_0x36e708[_0x6b29('0x2f')]['id']}},_0x49bb5b={};_0x49bb5b[_0x6b29('0x30')]=_[_0x6b29('0x31')](db[_0x6b29('0x32')][_0x6b29('0x33')]);_0x49bb5b[_0x6b29('0x34')]=_[_0x6b29('0x31')](_0x36e708['query']);_0x49bb5b[_0x6b29('0x35')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],_0x49bb5b[_0x6b29('0x34')]);_0x2343c0[_0x6b29('0x37')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],qs[_0x6b29('0x38')](_0x36e708['query']['fields']));_0x2343c0['attributes']=_0x2343c0['attributes'][_0x6b29('0x39')]?_0x2343c0[_0x6b29('0x37')]:_0x49bb5b[_0x6b29('0x30')];if(_0x36e708['query'][_0x6b29('0x3a')]){_0x2343c0[_0x6b29('0x3b')]=[{'all':!![]}];}_0x2343c0=_[_0x6b29('0x3c')]({},_0x2343c0,_0x36e708[_0x6b29('0x3d')]);return db['DashboardItem'][_0x6b29('0x3e')](_0x2343c0)[_0x6b29('0x29')](handleEntityNotFound(_0x36e293,null))[_0x6b29('0x29')](respondWithResult(_0x36e293,null))['catch'](handleError(_0x36e293,null));};exports['destroy']=function(_0x31fe46,_0x5b8e0f){return db['DashboardItem'][_0x6b29('0x3e')]({'where':{'id':_0x31fe46[_0x6b29('0x2f')]['id']}})[_0x6b29('0x29')](handleEntityNotFound(_0x5b8e0f,null))[_0x6b29('0x29')](removeEntity(_0x5b8e0f,null))['catch'](handleError(_0x5b8e0f,null));};function widgetAttributes(_0x37f14e){try{switch(_0x37f14e['type']){case _0x6b29('0x3f'):return[{'name':_0x6b29('0x40'),'value':_0x37f14e[_0x6b29('0x40')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e['attrs'][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x43')}];case _0x6b29('0x44'):return[{'name':_0x6b29('0x45'),'value':_0x37f14e['attrPath']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x37f14e[_0x6b29('0x46')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x47')},{'name':_0x6b29('0x48'),'value':_0x37f14e['attrTimezone']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||_0x6b29('0x49')},{'name':_0x6b29('0x4a'),'value':_0x37f14e['attrFontSize']||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||0xc}];case _0x6b29('0x4b'):return[{'name':_0x6b29('0x4c'),'value':_0x37f14e[_0x6b29('0x4c')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x4d')},{'name':'attrVoiceQueues','value':_0x37f14e['attrVoiceQueues']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e[_0x6b29('0x41')][0x1]['value']:undefined)||[]},{'name':_0x6b29('0x4a'),'value':_0x37f14e[_0x6b29('0x4a')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e['attrs'][0x2][_0x6b29('0x42')]:undefined)||0x14},{'name':_0x6b29('0x4e'),'value':_0x37f14e['attrChannel']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x3]?_0x37f14e[_0x6b29('0x41')][0x3][_0x6b29('0x42')]:undefined)||'voice'},{'name':_0x6b29('0x4f'),'value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e['attrs'][0x4][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e[_0x6b29('0x51')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e['attrOpenchannelAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e[_0x6b29('0x41')][0x7][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e[_0x6b29('0x41')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e['attrChatWebsites']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e['attrs'][0x9][_0x6b29('0x42')]:undefined)||''}];case _0x6b29('0x53'):case'pie-chart':return[{'name':_0x6b29('0x54'),'value':_0x37f14e[_0x6b29('0x54')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x4d')},{'name':_0x6b29('0x55'),'value':_0x37f14e[_0x6b29('0x55')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x1]?_0x37f14e[_0x6b29('0x41')][0x1][_0x6b29('0x42')]:undefined)||null},{'name':_0x6b29('0x56'),'value':_0x37f14e[_0x6b29('0x56')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x37f14e[_0x6b29('0x57')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x3]?_0x37f14e[_0x6b29('0x41')][0x3]['value']:undefined)||[]},{'name':_0x6b29('0x4e'),'value':_0x37f14e[_0x6b29('0x4e')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e[_0x6b29('0x41')][0x4][_0x6b29('0x42')]:undefined)||_0x6b29('0x58')},{'name':'attrEmailAccounts','value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e['attrSmsAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e['attrs'][0x7][_0x6b29('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e[_0x6b29('0x59')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e['attrs'][0x8]['value']:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e[_0x6b29('0x41')][0x9][_0x6b29('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e[_0x6b29('0x5a')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0xa]?_0x37f14e['attrs'][0xa][_0x6b29('0x42')]:undefined)||''}];case'web-report':return[{'name':_0x6b29('0x5b'),'type':_0x37f14e['reportType']||(_0x37f14e['attrs']&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['type']:undefined)||null,'value':_0x37f14e[_0x6b29('0x5b')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x37f14e[_0x6b29('0x5c')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x41e527){logger[_0x6b29('0x2a')](_0x6b29('0x5d'),JSON[_0x6b29('0x5e')](_0x41e527));return[];}}exports[_0x6b29('0x5f')]=function(_0x466222,_0x1e4684){if(_0x466222[_0x6b29('0x60')]){_0x466222['body'][_0x6b29('0x41')]=widgetAttributes(_0x466222[_0x6b29('0x60')]);}return db[_0x6b29('0x32')][_0x6b29('0x5f')](_0x466222['body'],{})[_0x6b29('0x29')](respondWithResult(_0x1e4684,0xc9))['catch'](handleError(_0x1e4684,null));};exports['update']=function(_0x2e9ee0,_0x92a3b2){if(_0x2e9ee0[_0x6b29('0x60')]['id']){delete _0x2e9ee0[_0x6b29('0x60')]['id'];}_0x2e9ee0[_0x6b29('0x60')][_0x6b29('0x41')]=widgetAttributes(_0x2e9ee0[_0x6b29('0x60')]);return db[_0x6b29('0x32')][_0x6b29('0x3e')]({'where':{'id':_0x2e9ee0['params']['id']}})['then'](handleEntityNotFound(_0x92a3b2,null))[_0x6b29('0x29')](saveUpdates(_0x2e9ee0[_0x6b29('0x60')],null))['then'](respondWithResult(_0x92a3b2,null))[_0x6b29('0x61')](handleError(_0x92a3b2,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2494350..0451293 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 _0x04fc=['update','remove','emit','hasOwnProperty','exports','events','DashboardItem','setMaxListeners','save'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x04fc,0x11c));var _0xc04f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04fc[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc04f('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc04f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc04f('0x2')](0x0);var events={'afterCreate':_0xc04f('0x3'),'afterUpdate':_0xc04f('0x4'),'afterDestroy':_0xc04f('0x5')};function emitEvent(_0x5230a7){return function(_0x4fb694,_0x73d3ce,_0x36e748){DashboardItemEvents[_0xc04f('0x6')](_0x5230a7+':'+_0x4fb694['id'],_0x4fb694);DashboardItemEvents[_0xc04f('0x6')](_0x5230a7,_0x4fb694);_0x36e748(null);};}for(var e in events){if(events[_0xc04f('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xc04f('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xeaf5=['setMaxListeners','update','remove','emit','hook','exports','events','DashboardItem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaf5,0x19e));var _0x5eaf=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xeaf5[_0x13843f];return _0x1063ae;};'use strict';var EventEmitter=require(_0x5eaf('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5eaf('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5eaf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5eaf('0x3'),'afterDestroy':_0x5eaf('0x4')};function emitEvent(_0x2e8316){return function(_0x5c71e4,_0x5c83d5,_0x164762){DashboardItemEvents[_0x5eaf('0x5')](_0x2e8316+':'+_0x5c71e4['id'],_0x5c71e4);DashboardItemEvents[_0x5eaf('0x5')](_0x2e8316,_0x5c71e4);_0x164762(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x5eaf('0x6')](e,emitEvent(event));}}module[_0x5eaf('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6dd6718..c9f4b54 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 _0x39ff=['lodash','moment','request-promise','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x39ff,0x188));var _0xf39f=function(_0x5d5f56,_0x56e254){_0x5d5f56=_0x5d5f56-0x0;var _0x479205=_0x39ff[_0x5d5f56];return _0x479205;};'use strict';var _=require(_0xf39f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf39f('0x1'));var BPromise=require('bluebird');var rp=require(_0xf39f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf39f('0x3'));var attributes=require(_0xf39f('0x4'));module['exports']=function(_0x5c44b6,_0x719383){return _0x5c44b6[_0xf39f('0x5')](_0xf39f('0x6'),attributes,{'tableName':_0xf39f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa91=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfa91,0x1df));var _0x1fa9=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xfa91[_0xd09668];return _0x68726;};'use strict';var _=require(_0x1fa9('0x0'));var util=require(_0x1fa9('0x1'));var logger=require(_0x1fa9('0x2'))(_0x1fa9('0x3'));var moment=require(_0x1fa9('0x4'));var BPromise=require(_0x1fa9('0x5'));var rp=require(_0x1fa9('0x6'));var fs=require('fs');var path=require(_0x1fa9('0x7'));var rimraf=require(_0x1fa9('0x8'));var config=require(_0x1fa9('0x9'));var attributes=require(_0x1fa9('0xa'));module['exports']=function(_0x400ae3,_0x4b4503){return _0x400ae3[_0x1fa9('0xb')](_0x1fa9('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2403e87..b679700 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 _0xd24f=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request','then','info'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xd24f,0x154));var _0xfd24=function(_0x461c39,_0x2ffc4e){_0x461c39=_0x461c39-0x0;var _0x149a9b=_0xd24f[_0x461c39];return _0x149a9b;};'use strict';var _=require(_0xfd24('0x0'));var util=require(_0xfd24('0x1'));var moment=require(_0xfd24('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd24('0x3'));var fs=require('fs');var Redis=require(_0xfd24('0x4'));var db=require(_0xfd24('0x5'))['db'];var utils=require(_0xfd24('0x6'));var logger=require(_0xfd24('0x7'))(_0xfd24('0x8'));var config=require(_0xfd24('0x9'));var jayson=require(_0xfd24('0xa'));var client=jayson[_0xfd24('0xb')][_0xfd24('0xc')]({'port':0x232a});config[_0xfd24('0xd')]=_[_0xfd24('0xe')](config[_0xfd24('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd24('0xf'))[_0xfd24('0x10')](socket);function respondWithRpcPromise(_0x4a0694,_0x1d0c00,_0x1a9c08){return new BPromise(function(_0x3c9c6b,_0x56fe02){return client[_0xfd24('0x11')](_0x4a0694,_0x1a9c08)[_0xfd24('0x12')](function(_0x132887){logger[_0xfd24('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1d0c00,_0xfd24('0x14'));logger[_0xfd24('0x15')](_0xfd24('0x16'),_0x1d0c00,_0xfd24('0x14'),JSON[_0xfd24('0x17')](_0x132887));if(_0x132887[_0xfd24('0x18')]){if(_0x132887[_0xfd24('0x18')][_0xfd24('0x19')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1d0c00,_0x132887[_0xfd24('0x18')][_0xfd24('0x1a')]);return _0x56fe02(_0x132887[_0xfd24('0x18')][_0xfd24('0x1a')]);}logger['error'](_0xfd24('0x1b'),_0x1d0c00,_0x132887[_0xfd24('0x18')][_0xfd24('0x1a')]);return _0x3c9c6b(_0x132887[_0xfd24('0x18')][_0xfd24('0x1a')]);}else{logger['info'](_0xfd24('0x1b'),_0x1d0c00,'request\x20sent');_0x3c9c6b(_0x132887[_0xfd24('0x1c')]['message']);}})[_0xfd24('0x1d')](function(_0x2a59ad){logger[_0xfd24('0x18')](_0xfd24('0x1b'),_0x1d0c00,_0x2a59ad);_0x56fe02(_0x2a59ad);});});} \ No newline at end of file +var _0x550f=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2fd7fc,_0x394ce2){var _0x25ef6c=function(_0x46f97f){while(--_0x46f97f){_0x2fd7fc['push'](_0x2fd7fc['shift']());}};_0x25ef6c(++_0x394ce2);}(_0x550f,0x118));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf550('0x0'));var util=require(_0xf550('0x1'));var moment=require(_0xf550('0x2'));var BPromise=require(_0xf550('0x3'));var rs=require(_0xf550('0x4'));var fs=require('fs');var Redis=require(_0xf550('0x5'));var db=require(_0xf550('0x6'))['db'];var utils=require(_0xf550('0x7'));var logger=require(_0xf550('0x8'))(_0xf550('0x9'));var config=require(_0xf550('0xa'));var jayson=require(_0xf550('0xb'));var client=jayson[_0xf550('0xc')]['http']({'port':0x232a});config[_0xf550('0xd')]=_['defaults'](config['redis'],{'host':_0xf550('0xe'),'port':0x18eb});var socket=require(_0xf550('0xf'))(new Redis(config['redis']));require(_0xf550('0x10'))[_0xf550('0x11')](socket);function respondWithRpcPromise(_0x5dd58d,_0xffc363,_0x3b174c){return new BPromise(function(_0x3e9f64,_0x5dc79b){return client[_0xf550('0x12')](_0x5dd58d,_0x3b174c)[_0xf550('0x13')](function(_0x3a8380){logger[_0xf550('0x14')](_0xf550('0x15'),_0xffc363,'request\x20sent');logger[_0xf550('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xffc363,_0xf550('0x17'),JSON['stringify'](_0x3a8380));if(_0x3a8380[_0xf550('0x18')]){if(_0x3a8380[_0xf550('0x18')][_0xf550('0x19')]===0x1f4){logger[_0xf550('0x18')](_0xf550('0x15'),_0xffc363,_0x3a8380[_0xf550('0x18')]['message']);return _0x5dc79b(_0x3a8380['error'][_0xf550('0x1a')]);}logger[_0xf550('0x18')](_0xf550('0x15'),_0xffc363,_0x3a8380['error'][_0xf550('0x1a')]);return _0x3e9f64(_0x3a8380[_0xf550('0x18')][_0xf550('0x1a')]);}else{logger['info'](_0xf550('0x15'),_0xffc363,_0xf550('0x17'));_0x3e9f64(_0x3a8380[_0xf550('0x1b')][_0xf550('0x1a')]);}})[_0xf550('0x1c')](function(_0x21a70a){logger['error'](_0xf550('0x15'),_0xffc363,_0x21a70a);_0x5dc79b(_0x21a70a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index fb6d970..0c8b831 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 _0x8e02=['./dashboardItem.events','save','emit','removeListener','length','dashboardItem:'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x8e02,0x14a));var _0x28e0=function(_0x14b083,_0x21dec6){_0x14b083=_0x14b083-0x0;var _0x2a94d1=_0x8e02[_0x14b083];return _0x2a94d1;};'use strict';var DashboardItemEvents=require(_0x28e0('0x0'));var events=[_0x28e0('0x1'),'remove','update'];function createListener(_0x6c9537,_0x562a37){return function(_0x1aca9b){_0x562a37[_0x28e0('0x2')](_0x6c9537,_0x1aca9b);};}function removeListener(_0x366bd,_0x33cba2){return function(){DashboardItemEvents[_0x28e0('0x3')](_0x366bd,_0x33cba2);};}exports['register']=function(_0x15f70d){for(var _0x1c7ca5=0x0,_0x30b281=events[_0x28e0('0x4')];_0x1c7ca5<_0x30b281;_0x1c7ca5++){var _0x381084=events[_0x1c7ca5];var _0x4bf4fd=createListener(_0x28e0('0x5')+_0x381084,_0x15f70d);DashboardItemEvents['on'](_0x381084,_0x4bf4fd);}}; \ No newline at end of file +var _0x685e=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x122f33,_0x4aae96){var _0x5eef1e=function(_0x3f5cc1){while(--_0x3f5cc1){_0x122f33['push'](_0x122f33['shift']());}};_0x5eef1e(++_0x4aae96);}(_0x685e,0x153));var _0xe685=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x685e[_0x3616bb];return _0x1c0994;};'use strict';var DashboardItemEvents=require(_0xe685('0x0'));var events=[_0xe685('0x1'),_0xe685('0x2'),_0xe685('0x3')];function createListener(_0x45d832,_0x5c4797){return function(_0x11c56c){_0x5c4797[_0xe685('0x4')](_0x45d832,_0x11c56c);};}function removeListener(_0x2477ee,_0x5b96ba){return function(){DashboardItemEvents[_0xe685('0x5')](_0x2477ee,_0x5b96ba);};}exports[_0xe685('0x6')]=function(_0x5acb16){for(var _0x37a656=0x0,_0x27d501=events['length'];_0x37a656<_0x27d501;_0x37a656++){var _0x49c7cd=events[_0x37a656];var _0xd4316a=createListener(_0xe685('0x7')+_0x49c7cd,_0x5acb16);DashboardItemEvents['on'](_0x49c7cd,_0xd4316a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5138906..478f1b2 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 _0x73b0=['isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x73b0,0xf5));var _0x073b=function(_0x24d6da,_0x2eb754){_0x24d6da=_0x24d6da-0x0;var _0x3e4e6c=_0x73b0[_0x24d6da];return _0x3e4e6c;};'use strict';var multer=require(_0x073b('0x0'));var util=require(_0x073b('0x1'));var path=require(_0x073b('0x2'));var timeout=require('connect-timeout');var express=require(_0x073b('0x3'));var router=express[_0x073b('0x4')]();var fs_extra=require(_0x073b('0x5'));var auth=require(_0x073b('0x6'));var interaction=require(_0x073b('0x7'));var config=require(_0x073b('0x8'));var controller=require(_0x073b('0x9'));router['get']('/:id',auth[_0x073b('0xa')](),controller[_0x073b('0xb')]);router[_0x073b('0xc')]('/',auth[_0x073b('0xa')](),controller[_0x073b('0xd')]);router[_0x073b('0xe')](_0x073b('0xf'),auth[_0x073b('0xa')](),controller['update']);router[_0x073b('0x10')](_0x073b('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7d88=['create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','isAuthenticated','show','post'];(function(_0x27c37c,_0x755b76){var _0x414bd0=function(_0x34b896){while(--_0x34b896){_0x27c37c['push'](_0x27c37c['shift']());}};_0x414bd0(++_0x755b76);}(_0x7d88,0x73));var _0x87d8=function(_0x55c17d,_0x268a3e){_0x55c17d=_0x55c17d-0x0;var _0x581d5e=_0x7d88[_0x55c17d];return _0x581d5e;};'use strict';var multer=require(_0x87d8('0x0'));var util=require('util');var path=require(_0x87d8('0x1'));var timeout=require(_0x87d8('0x2'));var express=require(_0x87d8('0x3'));var router=express[_0x87d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x87d8('0x5'));var interaction=require(_0x87d8('0x6'));var config=require('../../config/environment');var controller=require(_0x87d8('0x7'));router['get']('/:id',auth[_0x87d8('0x8')](),controller[_0x87d8('0x9')]);router[_0x87d8('0xa')]('/',auth[_0x87d8('0x8')](),controller[_0x87d8('0xb')]);router[_0x87d8('0xc')](_0x87d8('0xd'),auth[_0x87d8('0x8')](),controller[_0x87d8('0xe')]);router[_0x87d8('0xf')](_0x87d8('0xd'),auth[_0x87d8('0x8')](),controller[_0x87d8('0x10')]);module[_0x87d8('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 44630c6..6e421bd 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 _0xc651=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xc651,0x178));var _0x1c65=function(_0x152218,_0x2dc063){_0x152218=_0x152218-0x0;var _0x1a5a4e=_0xc651[_0x152218];return _0x1a5a4e;};'use strict';var Sequelize=require(_0x1c65('0x0'));module[_0x1c65('0x1')]={'name':{'type':Sequelize[_0x1c65('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1c65('0x3')](_0x1c65('0x4'),_0x1c65('0x5'),_0x1c65('0x6')),'allowNull':![],'defaultValue':_0x1c65('0x4')},'description':{'type':Sequelize[_0x1c65('0x2')]}}; \ No newline at end of file +var _0xb105=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x8f6a2c,_0x435996){var _0x42a718=function(_0x572dd2){while(--_0x572dd2){_0x8f6a2c['push'](_0x8f6a2c['shift']());}};_0x42a718(++_0x435996);}(_0xb105,0x1b9));var _0x5b10=function(_0x72ba9,_0x554024){_0x72ba9=_0x72ba9-0x0;var _0x42e6b6=_0xb105[_0x72ba9];return _0x42e6b6;};'use strict';var Sequelize=require(_0x5b10('0x0'));module[_0x5b10('0x1')]={'name':{'type':Sequelize[_0x5b10('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5b10('0x3')](_0x5b10('0x4'),_0x5b10('0x5'),'third'),'allowNull':![],'defaultValue':_0x5b10('0x4')},'description':{'type':Sequelize[_0x5b10('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7d85399..532e029 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 _0x9b69=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','Dispositions','end','sendStatus','name','index','map','Disposition','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','mustache','util','path'];(function(_0x4917a1,_0x19208a){var _0x276fa0=function(_0x3e4625){while(--_0x3e4625){_0x4917a1['push'](_0x4917a1['shift']());}};_0x276fa0(++_0x19208a);}(_0x9b69,0xa3));var _0x99b6=function(_0x53bd6f,_0x15828a){_0x53bd6f=_0x53bd6f-0x0;var _0x5f4e08=_0x9b69[_0x53bd6f];return _0x5f4e08;};'use strict';var emlformat=require(_0x99b6('0x0'));var rimraf=require(_0x99b6('0x1'));var zipdir=require(_0x99b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99b6('0x4'));var util=require(_0x99b6('0x5'));var path=require(_0x99b6('0x6'));var sox=require('sox');var csv=require(_0x99b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b6('0x8'));var _=require(_0x99b6('0x9'));var squel=require(_0x99b6('0xa'));var crypto=require(_0x99b6('0xb'));var jsforce=require(_0x99b6('0xc'));var deskjs=require(_0x99b6('0xd'));var toCsv=require(_0x99b6('0x7'));var querystring=require(_0x99b6('0xe'));var Papa=require(_0x99b6('0xf'));var Redis=require(_0x99b6('0x10'));var authService=require(_0x99b6('0x11'));var qs=require(_0x99b6('0x12'));var as=require(_0x99b6('0x13'));var hardwareService=require(_0x99b6('0x14'));var logger=require(_0x99b6('0x15'))(_0x99b6('0x16'));var utils=require(_0x99b6('0x17'));var config=require(_0x99b6('0x18'));var licenseUtil=require(_0x99b6('0x19'));var db=require(_0x99b6('0x1a'))['db'];function respondWithStatusCode(_0x48a408,_0x4fc440){_0x4fc440=_0x4fc440||0xcc;return function(_0x5791e5){if(_0x5791e5){return _0x48a408['sendStatus'](_0x4fc440);}return _0x48a408['status'](_0x4fc440)['end']();};}function respondWithResult(_0x54cd12,_0x172f35){_0x172f35=_0x172f35||0xc8;return function(_0x184e90){if(_0x184e90){return _0x54cd12[_0x99b6('0x1b')](_0x172f35)['json'](_0x184e90);}};}function respondWithFilteredResult(_0xb63749,_0x1ceee5){return function(_0x70b3f5){if(_0x70b3f5){var _0x417e9a=typeof _0x1ceee5['offset']===_0x99b6('0x1c')&&typeof _0x1ceee5[_0x99b6('0x1d')]===_0x99b6('0x1c');var _0x2a2bf2=_0x70b3f5[_0x99b6('0x1e')];var _0x3fd5ad=_0x417e9a?0x0:_0x1ceee5[_0x99b6('0x1f')];var _0x4cb2e7=_0x417e9a?_0x70b3f5[_0x99b6('0x1e')]:_0x1ceee5['offset']+_0x1ceee5[_0x99b6('0x1d')];var _0x391c6a;if(_0x4cb2e7>=_0x2a2bf2){_0x4cb2e7=_0x2a2bf2;_0x391c6a=0xc8;}else{_0x391c6a=0xce;}_0xb63749[_0x99b6('0x1b')](_0x391c6a);return _0xb63749[_0x99b6('0x20')](_0x99b6('0x21'),_0x3fd5ad+'-'+_0x4cb2e7+'/'+_0x2a2bf2)[_0x99b6('0x22')](_0x70b3f5);}return null;};}function patchUpdates(_0x35b47a){return function(_0x59045f){try{jsonpatch['apply'](_0x59045f,_0x35b47a,!![]);}catch(_0x11b866){return BPromise[_0x99b6('0x23')](_0x11b866);}return _0x59045f[_0x99b6('0x24')]();};}function saveUpdates(_0x465587,_0x4db3a8){return function(_0x38a916){if(_0x38a916){return _0x38a916[_0x99b6('0x25')](_0x465587)[_0x99b6('0x26')](function(_0x563210){return _0x563210;});}return null;};}function removeEntity(_0x13c52d,_0x22db3f){return function(_0x454d43){if(_0x454d43){return _0x454d43[_0x99b6('0x27')]()[_0x99b6('0x26')](function(){var _0x343db4=_0x454d43[_0x99b6('0x28')]({'plain':!![]});var _0x2d92a6=_0x99b6('0x29');return db['UserProfileResource'][_0x99b6('0x27')]({'where':{'type':_0x2d92a6,'resourceId':_0x343db4['id']}})['then'](function(){return _0x454d43;});})[_0x99b6('0x26')](function(){_0x13c52d['status'](0xcc)[_0x99b6('0x2a')]();});}};}function handleEntityNotFound(_0x246b17,_0x49dc9a){return function(_0x5dcf7f){if(!_0x5dcf7f){_0x246b17[_0x99b6('0x2b')](0x194);}return _0x5dcf7f;};}function handleError(_0x9617c4,_0x368e6e){_0x368e6e=_0x368e6e||0x1f4;return function(_0x48f796){logger['error'](_0x48f796['stack']);if(_0x48f796['name']){delete _0x48f796[_0x99b6('0x2c')];}_0x9617c4[_0x99b6('0x1b')](_0x368e6e)['send'](_0x48f796);};}exports[_0x99b6('0x2d')]=function(_0x3e4461,_0x2228d1){var _0x311351={},_0x200caf={},_0x4be34f={'count':0x0,'rows':[]};var _0x197565=_[_0x99b6('0x2e')](db[_0x99b6('0x2f')][_0x99b6('0x30')],function(_0x313bd3){return{'name':_0x313bd3['fieldName'],'type':_0x313bd3[_0x99b6('0x31')][_0x99b6('0x32')]};});_0x200caf[_0x99b6('0x33')]=_[_0x99b6('0x2e')](_0x197565,_0x99b6('0x2c'));_0x200caf[_0x99b6('0x34')]=_[_0x99b6('0x35')](_0x3e4461[_0x99b6('0x34')]);_0x200caf['filters']=_[_0x99b6('0x36')](_0x200caf[_0x99b6('0x33')],_0x200caf[_0x99b6('0x34')]);_0x311351[_0x99b6('0x37')]=_[_0x99b6('0x36')](_0x200caf[_0x99b6('0x33')],qs[_0x99b6('0x38')](_0x3e4461[_0x99b6('0x34')][_0x99b6('0x38')]));_0x311351['attributes']=_0x311351[_0x99b6('0x37')][_0x99b6('0x39')]?_0x311351['attributes']:_0x200caf[_0x99b6('0x33')];if(!_0x3e4461['query'][_0x99b6('0x3a')](_0x99b6('0x3b'))){_0x311351[_0x99b6('0x1d')]=qs[_0x99b6('0x1d')](_0x3e4461['query'][_0x99b6('0x1d')]);_0x311351['offset']=qs[_0x99b6('0x1f')](_0x3e4461[_0x99b6('0x34')][_0x99b6('0x1f')]);}_0x311351[_0x99b6('0x3c')]=qs[_0x99b6('0x3d')](_0x3e4461[_0x99b6('0x34')][_0x99b6('0x3d')]);_0x311351[_0x99b6('0x3e')]=qs[_0x99b6('0x3f')](_[_0x99b6('0x40')](_0x3e4461[_0x99b6('0x34')],_0x200caf[_0x99b6('0x3f')]),_0x197565);if(_0x3e4461['query']['filter']){_0x311351[_0x99b6('0x3e')]=_[_0x99b6('0x41')](_0x311351[_0x99b6('0x3e')],{'$or':_[_0x99b6('0x2e')](_0x197565,function(_0x596225){if(_0x596225[_0x99b6('0x31')]!==_0x99b6('0x42')){var _0x4dff97={};_0x4dff97[_0x596225[_0x99b6('0x2c')]]={'$like':'%'+_0x3e4461['query']['filter']+'%'};return _0x4dff97;}})});}_0x311351=_['merge']({},_0x311351,_0x3e4461[_0x99b6('0x43')]);var _0x5db349={'where':_0x311351[_0x99b6('0x3e')]};return db[_0x99b6('0x2f')]['count'](_0x5db349)[_0x99b6('0x26')](function(_0x97b552){_0x4be34f[_0x99b6('0x1e')]=_0x97b552;if(_0x3e4461[_0x99b6('0x34')][_0x99b6('0x44')]){_0x311351[_0x99b6('0x45')]=[{'all':!![]}];}return db[_0x99b6('0x2f')][_0x99b6('0x46')](_0x311351);})[_0x99b6('0x26')](function(_0x4f4d41){_0x4be34f[_0x99b6('0x47')]=_0x4f4d41;return _0x4be34f;})[_0x99b6('0x26')](respondWithFilteredResult(_0x2228d1,_0x311351))['catch'](handleError(_0x2228d1,null));};exports['show']=function(_0x3a68b8,_0x2f7c51){var _0x7d48a0={'raw':!![],'where':{'id':_0x3a68b8[_0x99b6('0x48')]['id']}},_0xa2a0f4={};_0xa2a0f4[_0x99b6('0x33')]=_[_0x99b6('0x35')](db[_0x99b6('0x2f')][_0x99b6('0x30')]);_0xa2a0f4[_0x99b6('0x34')]=_[_0x99b6('0x35')](_0x3a68b8[_0x99b6('0x34')]);_0xa2a0f4[_0x99b6('0x3f')]=_['intersection'](_0xa2a0f4['model'],_0xa2a0f4[_0x99b6('0x34')]);_0x7d48a0['attributes']=_['intersection'](_0xa2a0f4[_0x99b6('0x33')],qs[_0x99b6('0x38')](_0x3a68b8[_0x99b6('0x34')][_0x99b6('0x38')]));_0x7d48a0[_0x99b6('0x37')]=_0x7d48a0[_0x99b6('0x37')][_0x99b6('0x39')]?_0x7d48a0[_0x99b6('0x37')]:_0xa2a0f4['model'];if(_0x3a68b8['query'][_0x99b6('0x44')]){_0x7d48a0[_0x99b6('0x45')]=[{'all':!![]}];}_0x7d48a0=_[_0x99b6('0x41')]({},_0x7d48a0,_0x3a68b8['options']);return db['Disposition'][_0x99b6('0x49')](_0x7d48a0)[_0x99b6('0x26')](handleEntityNotFound(_0x2f7c51,null))['then'](respondWithResult(_0x2f7c51,null))[_0x99b6('0x4a')](handleError(_0x2f7c51,null));};exports['create']=function(_0x45a424,_0x44d9a0){return db[_0x99b6('0x2f')][_0x99b6('0x4b')](_0x45a424[_0x99b6('0x4c')],{})[_0x99b6('0x26')](function(_0x68f83){var _0x3d0de4=_0x45a424[_0x99b6('0x4d')][_0x99b6('0x28')]({'plain':!![]});if(!_0x3d0de4)throw new Error(_0x99b6('0x4e'));if(_0x3d0de4['role']===_0x99b6('0x4d')){var _0x390245=_0x68f83[_0x99b6('0x28')]({'plain':!![]});var _0x5bd42e=_0x99b6('0x29');return db[_0x99b6('0x4f')][_0x99b6('0x49')]({'where':{'name':_0x5bd42e,'userProfileId':_0x3d0de4[_0x99b6('0x50')]},'raw':!![]})[_0x99b6('0x26')](function(_0x67d1cc){if(_0x67d1cc&&_0x67d1cc[_0x99b6('0x51')]===0x0){return db[_0x99b6('0x52')]['create']({'name':_0x390245[_0x99b6('0x2c')],'resourceId':_0x390245['id'],'type':_0x67d1cc['name'],'sectionId':_0x67d1cc['id']},{})[_0x99b6('0x26')](function(){return _0x68f83;});}else{return _0x68f83;}})['catch'](function(_0x347166){logger[_0x99b6('0x53')](_0x99b6('0x54'),_0x347166);throw _0x347166;});}return _0x68f83;})[_0x99b6('0x26')](respondWithResult(_0x44d9a0,0xc9))[_0x99b6('0x4a')](handleError(_0x44d9a0,null));};exports[_0x99b6('0x25')]=function(_0x5eb341,_0x2cbd78){if(_0x5eb341[_0x99b6('0x4c')]['id']){delete _0x5eb341['body']['id'];}return db[_0x99b6('0x2f')][_0x99b6('0x49')]({'where':{'id':_0x5eb341[_0x99b6('0x48')]['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0x2cbd78,null))[_0x99b6('0x26')](saveUpdates(_0x5eb341[_0x99b6('0x4c')],null))['then'](respondWithResult(_0x2cbd78,null))[_0x99b6('0x4a')](handleError(_0x2cbd78,null));};exports[_0x99b6('0x27')]=function(_0xec2e82,_0x23a865){return db[_0x99b6('0x2f')][_0x99b6('0x49')]({'where':{'id':_0xec2e82['params']['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0x23a865,null))[_0x99b6('0x26')](removeEntity(_0x23a865,null))['catch'](handleError(_0x23a865,null));}; \ No newline at end of file +var _0x25ed=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x42c341,_0x31d467){var _0x43621b=function(_0x54be74){while(--_0x54be74){_0x42c341['push'](_0x42c341['shift']());}};_0x43621b(++_0x31d467);}(_0x25ed,0x1e8));var _0xd25e=function(_0x46390e,_0x39d20f){_0x46390e=_0x46390e-0x0;var _0x4db91c=_0x25ed[_0x46390e];return _0x4db91c;};'use strict';var emlformat=require(_0xd25e('0x0'));var rimraf=require(_0xd25e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd25e('0x2'));var rp=require(_0xd25e('0x3'));var moment=require(_0xd25e('0x4'));var BPromise=require(_0xd25e('0x5'));var Mustache=require(_0xd25e('0x6'));var util=require(_0xd25e('0x7'));var path=require(_0xd25e('0x8'));var sox=require(_0xd25e('0x9'));var csv=require(_0xd25e('0xa'));var ejs=require(_0xd25e('0xb'));var fs=require('fs');var fs_extra=require(_0xd25e('0xc'));var _=require(_0xd25e('0xd'));var squel=require(_0xd25e('0xe'));var crypto=require(_0xd25e('0xf'));var jsforce=require(_0xd25e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd25e('0xa'));var querystring=require(_0xd25e('0x11'));var Papa=require(_0xd25e('0x12'));var Redis=require(_0xd25e('0x13'));var authService=require(_0xd25e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd25e('0x15'));var utils=require(_0xd25e('0x16'));var config=require(_0xd25e('0x17'));var licenseUtil=require(_0xd25e('0x18'));var db=require(_0xd25e('0x19'))['db'];function respondWithStatusCode(_0x12402b,_0x1a2bb1){_0x1a2bb1=_0x1a2bb1||0xcc;return function(_0x2afb97){if(_0x2afb97){return _0x12402b['sendStatus'](_0x1a2bb1);}return _0x12402b['status'](_0x1a2bb1)[_0xd25e('0x1a')]();};}function respondWithResult(_0xecae2e,_0x5e6369){_0x5e6369=_0x5e6369||0xc8;return function(_0x293388){if(_0x293388){return _0xecae2e[_0xd25e('0x1b')](_0x5e6369)[_0xd25e('0x1c')](_0x293388);}};}function respondWithFilteredResult(_0x2ebd2d,_0x5e9481){return function(_0x1bed2e){if(_0x1bed2e){var _0x48c98e=typeof _0x5e9481[_0xd25e('0x1d')]==='undefined'&&typeof _0x5e9481[_0xd25e('0x1e')]==='undefined';var _0x24f3a3=_0x1bed2e[_0xd25e('0x1f')];var _0x3d3cfb=_0x48c98e?0x0:_0x5e9481[_0xd25e('0x1d')];var _0x296f1a=_0x48c98e?_0x1bed2e[_0xd25e('0x1f')]:_0x5e9481[_0xd25e('0x1d')]+_0x5e9481[_0xd25e('0x1e')];var _0x3a93f2;if(_0x296f1a>=_0x24f3a3){_0x296f1a=_0x24f3a3;_0x3a93f2=0xc8;}else{_0x3a93f2=0xce;}_0x2ebd2d[_0xd25e('0x1b')](_0x3a93f2);return _0x2ebd2d['set'](_0xd25e('0x20'),_0x3d3cfb+'-'+_0x296f1a+'/'+_0x24f3a3)[_0xd25e('0x1c')](_0x1bed2e);}return null;};}function patchUpdates(_0xb1287a){return function(_0x4d6dde){try{jsonpatch[_0xd25e('0x21')](_0x4d6dde,_0xb1287a,!![]);}catch(_0x595a1c){return BPromise[_0xd25e('0x22')](_0x595a1c);}return _0x4d6dde[_0xd25e('0x23')]();};}function saveUpdates(_0x42930e,_0x217539){return function(_0x357307){if(_0x357307){return _0x357307[_0xd25e('0x24')](_0x42930e)[_0xd25e('0x25')](function(_0x2f516e){return _0x2f516e;});}return null;};}function removeEntity(_0x54764d,_0x1ced69){return function(_0x3f6c9d){if(_0x3f6c9d){return _0x3f6c9d[_0xd25e('0x26')]()[_0xd25e('0x25')](function(){var _0x30f785=_0x3f6c9d[_0xd25e('0x27')]({'plain':!![]});var _0x1250d6='Dispositions';return db[_0xd25e('0x28')][_0xd25e('0x26')]({'where':{'type':_0x1250d6,'resourceId':_0x30f785['id']}})[_0xd25e('0x25')](function(){return _0x3f6c9d;});})[_0xd25e('0x25')](function(){_0x54764d[_0xd25e('0x1b')](0xcc)[_0xd25e('0x1a')]();});}};}function handleEntityNotFound(_0x491732,_0x32df25){return function(_0xb900c1){if(!_0xb900c1){_0x491732['sendStatus'](0x194);}return _0xb900c1;};}function handleError(_0x4133a9,_0x3f46c9){_0x3f46c9=_0x3f46c9||0x1f4;return function(_0x21f7ee){logger[_0xd25e('0x29')](_0x21f7ee['stack']);if(_0x21f7ee[_0xd25e('0x2a')]){delete _0x21f7ee[_0xd25e('0x2a')];}_0x4133a9[_0xd25e('0x1b')](_0x3f46c9)[_0xd25e('0x2b')](_0x21f7ee);};}exports[_0xd25e('0x2c')]=function(_0x5d567d,_0x5989ea){var _0x30642e={},_0x489f68={},_0x1baf32={'count':0x0,'rows':[]};var _0x225eed=_[_0xd25e('0x2d')](db[_0xd25e('0x2e')][_0xd25e('0x2f')],function(_0xcff3af){return{'name':_0xcff3af[_0xd25e('0x30')],'type':_0xcff3af[_0xd25e('0x31')][_0xd25e('0x32')]};});_0x489f68[_0xd25e('0x33')]=_['map'](_0x225eed,_0xd25e('0x2a'));_0x489f68[_0xd25e('0x34')]=_[_0xd25e('0x35')](_0x5d567d[_0xd25e('0x34')]);_0x489f68[_0xd25e('0x36')]=_[_0xd25e('0x37')](_0x489f68[_0xd25e('0x33')],_0x489f68['query']);_0x30642e[_0xd25e('0x38')]=_[_0xd25e('0x37')](_0x489f68['model'],qs[_0xd25e('0x39')](_0x5d567d['query'][_0xd25e('0x39')]));_0x30642e['attributes']=_0x30642e['attributes'][_0xd25e('0x3a')]?_0x30642e[_0xd25e('0x38')]:_0x489f68['model'];if(!_0x5d567d['query'][_0xd25e('0x3b')](_0xd25e('0x3c'))){_0x30642e[_0xd25e('0x1e')]=qs['limit'](_0x5d567d['query'][_0xd25e('0x1e')]);_0x30642e[_0xd25e('0x1d')]=qs[_0xd25e('0x1d')](_0x5d567d[_0xd25e('0x34')][_0xd25e('0x1d')]);}_0x30642e[_0xd25e('0x3d')]=qs[_0xd25e('0x3e')](_0x5d567d[_0xd25e('0x34')][_0xd25e('0x3e')]);_0x30642e[_0xd25e('0x3f')]=qs[_0xd25e('0x36')](_['pick'](_0x5d567d[_0xd25e('0x34')],_0x489f68[_0xd25e('0x36')]),_0x225eed);if(_0x5d567d[_0xd25e('0x34')][_0xd25e('0x40')]){_0x30642e[_0xd25e('0x3f')]=_[_0xd25e('0x41')](_0x30642e[_0xd25e('0x3f')],{'$or':_['map'](_0x225eed,function(_0x3b753f){if(_0x3b753f['type']!==_0xd25e('0x42')){var _0x17ed54={};_0x17ed54[_0x3b753f[_0xd25e('0x2a')]]={'$like':'%'+_0x5d567d['query'][_0xd25e('0x40')]+'%'};return _0x17ed54;}})});}_0x30642e=_[_0xd25e('0x41')]({},_0x30642e,_0x5d567d[_0xd25e('0x43')]);var _0x2ec32b={'where':_0x30642e[_0xd25e('0x3f')]};return db[_0xd25e('0x2e')][_0xd25e('0x1f')](_0x2ec32b)[_0xd25e('0x25')](function(_0x18eb36){_0x1baf32['count']=_0x18eb36;if(_0x5d567d[_0xd25e('0x34')]['includeAll']){_0x30642e[_0xd25e('0x44')]=[{'all':!![]}];}return db[_0xd25e('0x2e')][_0xd25e('0x45')](_0x30642e);})[_0xd25e('0x25')](function(_0x2911e6){_0x1baf32[_0xd25e('0x46')]=_0x2911e6;return _0x1baf32;})[_0xd25e('0x25')](respondWithFilteredResult(_0x5989ea,_0x30642e))[_0xd25e('0x47')](handleError(_0x5989ea,null));};exports[_0xd25e('0x48')]=function(_0x3e8ad0,_0x488997){var _0x24f960={'raw':!![],'where':{'id':_0x3e8ad0['params']['id']}},_0x1c9bd1={};_0x1c9bd1['model']=_['keys'](db[_0xd25e('0x2e')]['rawAttributes']);_0x1c9bd1[_0xd25e('0x34')]=_['keys'](_0x3e8ad0[_0xd25e('0x34')]);_0x1c9bd1['filters']=_['intersection'](_0x1c9bd1[_0xd25e('0x33')],_0x1c9bd1['query']);_0x24f960[_0xd25e('0x38')]=_['intersection'](_0x1c9bd1[_0xd25e('0x33')],qs['fields'](_0x3e8ad0[_0xd25e('0x34')][_0xd25e('0x39')]));_0x24f960[_0xd25e('0x38')]=_0x24f960[_0xd25e('0x38')]['length']?_0x24f960[_0xd25e('0x38')]:_0x1c9bd1[_0xd25e('0x33')];if(_0x3e8ad0[_0xd25e('0x34')][_0xd25e('0x49')]){_0x24f960['include']=[{'all':!![]}];}_0x24f960=_[_0xd25e('0x41')]({},_0x24f960,_0x3e8ad0[_0xd25e('0x43')]);return db['Disposition'][_0xd25e('0x4a')](_0x24f960)[_0xd25e('0x25')](handleEntityNotFound(_0x488997,null))['then'](respondWithResult(_0x488997,null))[_0xd25e('0x47')](handleError(_0x488997,null));};exports['create']=function(_0x50c7aa,_0x4c670c){return db['Disposition'][_0xd25e('0x4b')](_0x50c7aa['body'],{})[_0xd25e('0x25')](function(_0x2b7df3){var _0x44d880=_0x50c7aa[_0xd25e('0x4c')][_0xd25e('0x27')]({'plain':!![]});if(!_0x44d880)throw new Error(_0xd25e('0x4d'));if(_0x44d880['role']==='user'){var _0x4ca74f=_0x2b7df3[_0xd25e('0x27')]({'plain':!![]});var _0x156b20=_0xd25e('0x4e');return db['UserProfileSection'][_0xd25e('0x4a')]({'where':{'name':_0x156b20,'userProfileId':_0x44d880[_0xd25e('0x4f')]},'raw':!![]})[_0xd25e('0x25')](function(_0x44be6e){if(_0x44be6e&&_0x44be6e[_0xd25e('0x50')]===0x0){return db[_0xd25e('0x28')]['create']({'name':_0x4ca74f[_0xd25e('0x2a')],'resourceId':_0x4ca74f['id'],'type':_0x44be6e['name'],'sectionId':_0x44be6e['id']},{})[_0xd25e('0x25')](function(){return _0x2b7df3;});}else{return _0x2b7df3;}})[_0xd25e('0x47')](function(_0x53ad22){logger[_0xd25e('0x29')](_0xd25e('0x51'),_0x53ad22);throw _0x53ad22;});}return _0x2b7df3;})[_0xd25e('0x25')](respondWithResult(_0x4c670c,0xc9))[_0xd25e('0x47')](handleError(_0x4c670c,null));};exports[_0xd25e('0x24')]=function(_0x668e7e,_0x2dcb2b){if(_0x668e7e[_0xd25e('0x52')]['id']){delete _0x668e7e['body']['id'];}return db[_0xd25e('0x2e')]['find']({'where':{'id':_0x668e7e['params']['id']}})[_0xd25e('0x25')](handleEntityNotFound(_0x2dcb2b,null))[_0xd25e('0x25')](saveUpdates(_0x668e7e[_0xd25e('0x52')],null))['then'](respondWithResult(_0x2dcb2b,null))[_0xd25e('0x47')](handleError(_0x2dcb2b,null));};exports[_0xd25e('0x26')]=function(_0x16cebb,_0x980b4c){return db[_0xd25e('0x2e')][_0xd25e('0x4a')]({'where':{'id':_0x16cebb[_0xd25e('0x53')]['id']}})[_0xd25e('0x25')](handleEntityNotFound(_0x980b4c,null))[_0xd25e('0x25')](removeEntity(_0x980b4c,null))['catch'](handleError(_0x980b4c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index bfe6dee..961991e 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 _0x19d8=['Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','api','request-promise','path','./disposition.attributes','exports'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x19d8,0x1a9));var _0x819d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19d8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x819d('0x0'));var util=require('util');var logger=require(_0x819d('0x1'))(_0x819d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x819d('0x3'));var fs=require('fs');var path=require(_0x819d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x819d('0x5'));module[_0x819d('0x6')]=function(_0x157e60,_0x280a99){return _0x157e60['define'](_0x819d('0x7'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x819d('0x8'),'fields':[_0x819d('0x9'),_0x819d('0xa')]},{'unique':!![],'name':_0x819d('0xb'),'fields':[_0x819d('0x9'),_0x819d('0xc')]},{'unique':!![],'name':'name_mail','fields':[_0x819d('0x9'),'MailAccountId']},{'unique':!![],'name':_0x819d('0xd'),'fields':[_0x819d('0x9'),_0x819d('0xe')]},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':_0x819d('0xf'),'fields':[_0x819d('0x9'),_0x819d('0x10')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x819d('0x9'),_0x819d('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4a2=['WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x37eb40,_0x441982){var _0x3b886a=function(_0x1e7e8d){while(--_0x1e7e8d){_0x37eb40['push'](_0x37eb40['shift']());}};_0x3b886a(++_0x441982);}(_0xc4a2,0x131));var _0x2c4a=function(_0x3b19b8,_0x2742c5){_0x3b19b8=_0x3b19b8-0x0;var _0x43c78c=_0xc4a2[_0x3b19b8];return _0x43c78c;};'use strict';var _=require(_0x2c4a('0x0'));var util=require('util');var logger=require(_0x2c4a('0x1'))(_0x2c4a('0x2'));var moment=require(_0x2c4a('0x3'));var BPromise=require(_0x2c4a('0x4'));var rp=require(_0x2c4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2c4a('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x5dd13f,_0x1e95f1){return _0x5dd13f['define']('Disposition',attributes,{'tableName':_0x2c4a('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2c4a('0x8'),'fields':[_0x2c4a('0x9'),_0x2c4a('0xa')]},{'unique':!![],'name':_0x2c4a('0xb'),'fields':['name',_0x2c4a('0xc')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name',_0x2c4a('0xd')]},{'unique':!![],'name':_0x2c4a('0xe'),'fields':[_0x2c4a('0x9'),'FaxAccountId']},{'unique':!![],'name':_0x2c4a('0xf'),'fields':[_0x2c4a('0x9'),_0x2c4a('0x10')]},{'unique':!![],'name':_0x2c4a('0x11'),'fields':[_0x2c4a('0x9'),_0x2c4a('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8f95459..95f6d60 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(_0x49c612,_0x479780){var _0x4ad5ca=function(_0x331e16){while(--_0x331e16){_0x49c612['push'](_0x49c612['shift']());}};_0x4ad5ca(++_0x479780);}(_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 +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(_0x1298b8,_0x5077e4){var _0x5d101c=function(_0x7415c3){while(--_0x7415c3){_0x1298b8['push'](_0x1298b8['shift']());}};_0x5d101c(++_0x5077e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5eb06a5..052ff70 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 _0x7c21=['fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','get','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xe9dbf7,_0x8ebb04){var _0x44986b=function(_0x281b2b){while(--_0x281b2b){_0xe9dbf7['push'](_0xe9dbf7['shift']());}};_0x44986b(++_0x8ebb04);}(_0x7c21,0x174));var _0x17c2=function(_0x4d5e5e,_0x315b20){_0x4d5e5e=_0x4d5e5e-0x0;var _0x2ec492=_0x7c21[_0x4d5e5e];return _0x2ec492;};'use strict';var multer=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var path=require(_0x17c2('0x2'));var timeout=require(_0x17c2('0x3'));var express=require(_0x17c2('0x4'));var router=express[_0x17c2('0x5')]();var fs_extra=require(_0x17c2('0x6'));var auth=require(_0x17c2('0x7'));var interaction=require(_0x17c2('0x8'));var config=require('../../config/environment');var controller=require(_0x17c2('0x9'));router['get']('/',auth[_0x17c2('0xa')](),controller['index']);router[_0x17c2('0xb')](_0x17c2('0xc'),auth[_0x17c2('0xa')](),controller['show']);router[_0x17c2('0xd')]('/',auth[_0x17c2('0xa')](),controller[_0x17c2('0xe')]);router[_0x17c2('0xf')](_0x17c2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x17c2('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x17c2('0x11')]=router; \ No newline at end of file +var _0x8f0a=['path','connect-timeout','express','Router','../../components/interaction/service','./disposition.controller','index','get','/:id','isAuthenticated','post','create','update','delete','destroy','exports','util'];(function(_0x39a3a5,_0x52a134){var _0x1728c9=function(_0x529380){while(--_0x529380){_0x39a3a5['push'](_0x39a3a5['shift']());}};_0x1728c9(++_0x52a134);}(_0x8f0a,0x120));var _0xa8f0=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x8f0a[_0x1d128e];return _0x3d5236;};'use strict';var multer=require('multer');var util=require(_0xa8f0('0x0'));var path=require(_0xa8f0('0x1'));var timeout=require(_0xa8f0('0x2'));var express=require(_0xa8f0('0x3'));var router=express[_0xa8f0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8f0('0x5'));var config=require('../../config/environment');var controller=require(_0xa8f0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa8f0('0x7')]);router[_0xa8f0('0x8')](_0xa8f0('0x9'),auth[_0xa8f0('0xa')](),controller['show']);router[_0xa8f0('0xb')]('/',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0xc')]);router['put']('/:id',auth[_0xa8f0('0xa')](),controller[_0xa8f0('0xd')]);router[_0xa8f0('0xe')](_0xa8f0('0x9'),auth[_0xa8f0('0xa')](),controller[_0xa8f0('0xf')]);module[_0xa8f0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3f416ea..1290523 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 _0x77a2=['yes','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING'];(function(_0x5d7ec5,_0x374c30){var _0x2fe8d9=function(_0x567555){while(--_0x567555){_0x5d7ec5['push'](_0x5d7ec5['shift']());}};_0x2fe8d9(++_0x374c30);}(_0x77a2,0x15e));var _0x277a=function(_0xc598d7,_0x10ed60){_0xc598d7=_0xc598d7-0x0;var _0x4107b9=_0x77a2[_0xc598d7];return _0x4107b9;};'use strict';var Sequelize=require('sequelize');module[_0x277a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x277a('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x277a('0x2'),'no'),'defaultValue':_0x277a('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x277a('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x277a('0x3')](_0x277a('0x4'),_0x277a('0x5'),_0x277a('0x6'),_0x277a('0x7'),_0x277a('0x8'),_0x277a('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x277a('0x3')](_0x277a('0x4'),_0x277a('0x5'),'7200',_0x277a('0x7'),_0x277a('0x8'),_0x277a('0x9')),'defaultValue':_0x277a('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x277a('0xa')},'gateway':{'type':Sequelize[_0x277a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x277a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x277a('0x3')](_0x277a('0xb'),_0x277a('0xc'),_0x277a('0xd'),'KHOMP'),'defaultValue':_0x277a('0xb')},'key':{'type':Sequelize[_0x277a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x277a('0xe')],'defaultValue':function(){return _0x277a('0xf');}},'notificationSound':{'type':Sequelize[_0x277a('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x277a('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x277a('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x277a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x277a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x277a('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x277a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x277a('0x13'),'set':function(_0x6f3fac){if(!_0x6f3fac)this['setDataValue'](_0x277a('0x14'),null);this['setDataValue'](_0x277a('0x15'),_0x6f3fac);}}}; \ No newline at end of file +var _0x74ca=['14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000'];(function(_0x2bd9b6,_0x111781){var _0x1a0bc7=function(_0x24e6a2){while(--_0x24e6a2){_0x2bd9b6['push'](_0x2bd9b6['shift']());}};_0x1a0bc7(++_0x111781);}(_0x74ca,0x83));var _0xa74c=function(_0x49a301,_0xe9f707){_0x49a301=_0x49a301-0x0;var _0x10a16d=_0x74ca[_0x49a301];return _0x10a16d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa74c('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa74c('0x0')]},'ecm':{'type':Sequelize[_0xa74c('0x1')](_0xa74c('0x2'),'no'),'defaultValue':_0xa74c('0x2')},'headerinfo':{'type':Sequelize[_0xa74c('0x0')],'defaultValue':_0xa74c('0x3')},'localstationid':{'type':Sequelize[_0xa74c('0x0')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xa74c('0x1')](_0xa74c('0x4'),_0xa74c('0x5'),_0xa74c('0x6'),_0xa74c('0x7'),_0xa74c('0x8'),_0xa74c('0x9')),'defaultValue':_0xa74c('0x5')},'maxrate':{'type':Sequelize[_0xa74c('0x1')](_0xa74c('0x4'),_0xa74c('0x5'),_0xa74c('0x6'),_0xa74c('0x7'),'12000',_0xa74c('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xa74c('0x0')],'defaultValue':_0xa74c('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa74c('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa74c('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa74c('0x1')](_0xa74c('0xc'),_0xa74c('0xd'),_0xa74c('0xe'),_0xa74c('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa74c('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa74c('0x10');}},'notificationSound':{'type':Sequelize[_0xa74c('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa74c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa74c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa74c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa74c('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa74c('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x51f2b4){if(!_0x51f2b4)this[_0xa74c('0x13')]('mandatoryDispositionPauseId',null);this[_0xa74c('0x13')]('mandatoryDisposition',_0x51f2b4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index eab1baf..7f6d967 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 _0xc201=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','FaxAccount','include','findAll','rows','params','Pause','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','getApplications','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','transaction','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','destroy','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xc201,0x7f));var _0x1c20=function(_0x263582,_0x42bd35){_0x263582=_0x263582-0x0;var _0x20f217=_0xc201[_0x263582];return _0x20f217;};'use strict';var emlformat=require(_0x1c20('0x0'));var rimraf=require(_0x1c20('0x1'));var zipdir=require(_0x1c20('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c20('0x3'));var BPromise=require(_0x1c20('0x4'));var Mustache=require(_0x1c20('0x5'));var util=require(_0x1c20('0x6'));var path=require(_0x1c20('0x7'));var sox=require(_0x1c20('0x8'));var csv=require(_0x1c20('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c20('0xa'));var squel=require(_0x1c20('0xb'));var crypto=require(_0x1c20('0xc'));var jsforce=require(_0x1c20('0xd'));var deskjs=require(_0x1c20('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1c20('0xf'));var Papa=require(_0x1c20('0x10'));var Redis=require(_0x1c20('0x11'));var authService=require(_0x1c20('0x12'));var qs=require(_0x1c20('0x13'));var as=require(_0x1c20('0x14'));var hardwareService=require(_0x1c20('0x15'));var logger=require(_0x1c20('0x16'))(_0x1c20('0x17'));var utils=require(_0x1c20('0x18'));var config=require(_0x1c20('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c20('0x1a'))['db'];config[_0x1c20('0x1b')]=_[_0x1c20('0x1c')](config[_0x1c20('0x1b')],{'host':_0x1c20('0x1d'),'port':0x18eb});var socket=require(_0x1c20('0x1e'))(new Redis(config[_0x1c20('0x1b')]));require(_0x1c20('0x1f'))[_0x1c20('0x20')](socket);var jayson=require(_0x1c20('0x21'));var client=jayson[_0x1c20('0x22')][_0x1c20('0x23')]({'port':0x232c});var client9002=jayson[_0x1c20('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dcdcf,_0x2f0158,_0x19e848,_0xaf4b1a){return new BPromise(function(_0x40ac03,_0x41e685){var _0x20ea19=_0xaf4b1a||client;return _0x20ea19[_0x1c20('0x24')](_0x4dcdcf,_0x19e848)['then'](function(_0xa29b62){logger[_0x1c20('0x25')]('FaxAccount,\x20%s,\x20%s',_0x2f0158,_0x1c20('0x26'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2f0158,_0x1c20('0x26'),JSON[_0x1c20('0x27')](_0xa29b62));if(_0xa29b62[_0x1c20('0x28')]){if(_0xa29b62[_0x1c20('0x28')][_0x1c20('0x29')]===0x1f4){logger[_0x1c20('0x28')]('FaxAccount,\x20%s,\x20%s',_0x2f0158,_0xa29b62['error'][_0x1c20('0x2a')]);return _0x41e685(_0xa29b62[_0x1c20('0x28')]['message']);}logger[_0x1c20('0x28')](_0x1c20('0x2b'),_0x2f0158,_0xa29b62['error'][_0x1c20('0x2a')]);return _0x40ac03(_0xa29b62['error'][_0x1c20('0x2a')]);}else{logger[_0x1c20('0x25')](_0x1c20('0x2b'),_0x2f0158,_0x1c20('0x26'));_0x40ac03(_0xa29b62['result']['message']);}})[_0x1c20('0x2c')](function(_0x58d0a0){logger['error'](_0x1c20('0x2b'),_0x2f0158,_0x58d0a0);_0x41e685(_0x58d0a0);});});}function respondWithStatusCode(_0x2e80cf,_0xaf9a38){_0xaf9a38=_0xaf9a38||0xcc;return function(_0x23e2ae){if(_0x23e2ae){return _0x2e80cf[_0x1c20('0x2d')](_0xaf9a38);}return _0x2e80cf['status'](_0xaf9a38)[_0x1c20('0x2e')]();};}function respondWithResult(_0x5cc568,_0x52034a){_0x52034a=_0x52034a||0xc8;return function(_0x3562c5){if(_0x3562c5){return _0x5cc568[_0x1c20('0x2f')](_0x52034a)[_0x1c20('0x30')](_0x3562c5);}};}function respondWithFilteredResult(_0x999d3,_0x1e38ea){return function(_0x5c8737){if(_0x5c8737){var _0xb3bf3d=typeof _0x1e38ea[_0x1c20('0x31')]===_0x1c20('0x32')&&typeof _0x1e38ea[_0x1c20('0x33')]==='undefined';var _0x355ab8=_0x5c8737[_0x1c20('0x34')];var _0x29b96a=_0xb3bf3d?0x0:_0x1e38ea['offset'];var _0x3a56bb=_0xb3bf3d?_0x5c8737[_0x1c20('0x34')]:_0x1e38ea[_0x1c20('0x31')]+_0x1e38ea['limit'];var _0x27e1bd;if(_0x3a56bb>=_0x355ab8){_0x3a56bb=_0x355ab8;_0x27e1bd=0xc8;}else{_0x27e1bd=0xce;}_0x999d3['status'](_0x27e1bd);return _0x999d3[_0x1c20('0x35')](_0x1c20('0x36'),_0x29b96a+'-'+_0x3a56bb+'/'+_0x355ab8)[_0x1c20('0x30')](_0x5c8737);}return null;};}function patchUpdates(_0x4d032e){return function(_0x3fb88a){try{jsonpatch[_0x1c20('0x37')](_0x3fb88a,_0x4d032e,!![]);}catch(_0x4f9d64){return BPromise[_0x1c20('0x38')](_0x4f9d64);}return _0x3fb88a[_0x1c20('0x39')]();};}function saveUpdates(_0x6b9164,_0x3b981d){return function(_0x7b00d5){if(_0x7b00d5){return _0x7b00d5[_0x1c20('0x3a')](_0x6b9164)[_0x1c20('0x3b')](function(_0xebe840){return _0xebe840;});}return null;};}function removeEntity(_0x46b833,_0x25f777){return function(_0x4ecb5e){if(_0x4ecb5e){return _0x4ecb5e['destroy']()[_0x1c20('0x3b')](function(){var _0x50ff38=_0x4ecb5e[_0x1c20('0x3c')]({'plain':!![]});var _0x26f50d='FaxAccounts';return db['UserProfileResource'][_0x1c20('0x3d')]({'where':{'type':_0x26f50d,'resourceId':_0x50ff38['id']}})[_0x1c20('0x3b')](function(){return _0x4ecb5e;});})['then'](function(){_0x46b833[_0x1c20('0x2f')](0xcc)[_0x1c20('0x2e')]();});}};}function handleEntityNotFound(_0x1c3e0c,_0x1b0921){return function(_0x49801c){if(!_0x49801c){_0x1c3e0c[_0x1c20('0x2d')](0x194);}return _0x49801c;};}function handleError(_0x142ce1,_0x48c78a){_0x48c78a=_0x48c78a||0x1f4;return function(_0x1bd780){logger[_0x1c20('0x28')](_0x1bd780['stack']);if(_0x1bd780[_0x1c20('0x3e')]){delete _0x1bd780[_0x1c20('0x3e')];}_0x142ce1[_0x1c20('0x2f')](_0x48c78a)[_0x1c20('0x3f')](_0x1bd780);};}exports[_0x1c20('0x40')]=function(_0x2c936f,_0x41f7a9){var _0x471bc1={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x27a564={},_0x21075e={'count':0x0,'rows':[]};var _0x56f938=_['map'](db['FaxAccount'][_0x1c20('0x41')],function(_0x5db4e1){return{'name':_0x5db4e1[_0x1c20('0x42')],'type':_0x5db4e1[_0x1c20('0x43')]['key']};});_0x27a564[_0x1c20('0x44')]=_[_0x1c20('0x45')](_0x56f938,_0x1c20('0x3e'));_0x27a564[_0x1c20('0x46')]=_[_0x1c20('0x47')](_0x2c936f[_0x1c20('0x46')]);_0x27a564[_0x1c20('0x48')]=_['intersection'](_0x27a564['model'],_0x27a564[_0x1c20('0x46')]);_0x471bc1[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x27a564['model'],qs[_0x1c20('0x4b')](_0x2c936f[_0x1c20('0x46')][_0x1c20('0x4b')]));_0x471bc1['attributes']=_0x471bc1[_0x1c20('0x49')][_0x1c20('0x4c')]?_0x471bc1[_0x1c20('0x49')]:_0x27a564[_0x1c20('0x44')];if(!_0x2c936f[_0x1c20('0x46')][_0x1c20('0x4d')](_0x1c20('0x4e'))){_0x471bc1[_0x1c20('0x33')]=qs['limit'](_0x2c936f[_0x1c20('0x46')][_0x1c20('0x33')]);_0x471bc1[_0x1c20('0x31')]=qs['offset'](_0x2c936f[_0x1c20('0x46')][_0x1c20('0x31')]);}_0x471bc1[_0x1c20('0x4f')]=qs['sort'](_0x2c936f[_0x1c20('0x46')][_0x1c20('0x50')]);_0x471bc1[_0x1c20('0x51')]=qs['filters'](_[_0x1c20('0x52')](_0x2c936f[_0x1c20('0x46')],_0x27a564[_0x1c20('0x48')]),_0x56f938);if(_0x2c936f[_0x1c20('0x46')][_0x1c20('0x53')]){_0x471bc1[_0x1c20('0x51')]=_['merge'](_0x471bc1[_0x1c20('0x51')],{'$or':_[_0x1c20('0x45')](_0x56f938,function(_0x1ad109){if(_0x1ad109[_0x1c20('0x43')]!=='VIRTUAL'){var _0x3ed013={};_0x3ed013[_0x1ad109[_0x1c20('0x3e')]]={'$like':'%'+_0x2c936f[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x3ed013;}})});}_0x471bc1=_['merge']({},_0x471bc1,_0x2c936f[_0x1c20('0x54')]);var _0x22f443={'where':_0x471bc1[_0x1c20('0x51')]};return db[_0x1c20('0x55')][_0x1c20('0x34')](_0x22f443)['then'](function(_0x1b6f29){_0x21075e[_0x1c20('0x34')]=_0x1b6f29;if(_0x2c936f[_0x1c20('0x46')]['includeAll']){_0x471bc1[_0x1c20('0x56')]=[{'all':!![]}];}return db[_0x1c20('0x55')][_0x1c20('0x57')](_0x471bc1);})[_0x1c20('0x3b')](function(_0x5af4b2){_0x21075e[_0x1c20('0x58')]=_0x5af4b2;return _0x21075e;})[_0x1c20('0x3b')](respondWithFilteredResult(_0x41f7a9,_0x471bc1))[_0x1c20('0x2c')](handleError(_0x41f7a9,null));};exports['show']=function(_0x33271c,_0x6a69ca){var _0x5670e5={'raw':![],'where':{'id':_0x33271c[_0x1c20('0x59')]['id']},'include':[{'model':db[_0x1c20('0x5a')],'as':'mandatoryDispositionPause'}]},_0x12e1ed={};_0x12e1ed[_0x1c20('0x44')]=_[_0x1c20('0x47')](db[_0x1c20('0x55')][_0x1c20('0x41')]);_0x12e1ed[_0x1c20('0x46')]=_['keys'](_0x33271c[_0x1c20('0x46')]);_0x12e1ed[_0x1c20('0x48')]=_[_0x1c20('0x4a')](_0x12e1ed['model'],_0x12e1ed[_0x1c20('0x46')]);_0x5670e5[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x12e1ed[_0x1c20('0x44')],qs['fields'](_0x33271c['query'][_0x1c20('0x4b')]));_0x5670e5[_0x1c20('0x49')]=_0x5670e5['attributes'][_0x1c20('0x4c')]?_0x5670e5[_0x1c20('0x49')]:_0x12e1ed[_0x1c20('0x44')];if(_0x33271c[_0x1c20('0x46')][_0x1c20('0x5b')]){_0x5670e5[_0x1c20('0x56')]=[{'all':!![]}];}_0x5670e5=_[_0x1c20('0x5c')]({},_0x5670e5,_0x33271c[_0x1c20('0x54')]);return db[_0x1c20('0x55')][_0x1c20('0x5d')](_0x5670e5)[_0x1c20('0x3b')](handleEntityNotFound(_0x6a69ca,null))[_0x1c20('0x3b')](respondWithResult(_0x6a69ca,null))[_0x1c20('0x2c')](handleError(_0x6a69ca,null));};exports['create']=function(_0x4f405b,_0x3475e4){return db[_0x1c20('0x55')][_0x1c20('0x5e')](_0x4f405b[_0x1c20('0x5f')],{})[_0x1c20('0x3b')](function(_0x36cc31){var _0x32c8be=_0x4f405b[_0x1c20('0x60')][_0x1c20('0x3c')]({'plain':!![]});if(!_0x32c8be)throw new Error(_0x1c20('0x61'));if(_0x32c8be[_0x1c20('0x62')]===_0x1c20('0x60')){var _0x1bfced=_0x36cc31['get']({'plain':!![]});var _0x548397=_0x1c20('0x63');return db[_0x1c20('0x64')][_0x1c20('0x5d')]({'where':{'name':_0x548397,'userProfileId':_0x32c8be['userProfileId']},'raw':!![]})[_0x1c20('0x3b')](function(_0x422aef){if(_0x422aef&&_0x422aef[_0x1c20('0x65')]===0x0){return db[_0x1c20('0x66')][_0x1c20('0x5e')]({'name':_0x1bfced['name'],'resourceId':_0x1bfced['id'],'type':_0x422aef[_0x1c20('0x3e')],'sectionId':_0x422aef['id']},{})['then'](function(){return _0x36cc31;});}else{return _0x36cc31;}})[_0x1c20('0x2c')](function(_0x4da86f){logger[_0x1c20('0x28')](_0x1c20('0x67'),_0x4da86f);throw _0x4da86f;});}return _0x36cc31;})[_0x1c20('0x3b')](respondWithResult(_0x3475e4,0xc9))['catch'](handleError(_0x3475e4,null));};exports['update']=function(_0x4092a9,_0x39a733){if(_0x4092a9[_0x1c20('0x5f')]['id']){delete _0x4092a9[_0x1c20('0x5f')]['id'];}return db[_0x1c20('0x55')][_0x1c20('0x5d')]({'where':{'id':_0x4092a9['params']['id']},'include':[{'model':db[_0x1c20('0x5a')],'as':_0x1c20('0x68')}]})['then'](handleEntityNotFound(_0x39a733,null))[_0x1c20('0x3b')](saveUpdates(_0x4092a9[_0x1c20('0x5f')],null))[_0x1c20('0x3b')](respondWithResult(_0x39a733,null))[_0x1c20('0x2c')](handleError(_0x39a733,null));};exports[_0x1c20('0x3d')]=function(_0x4c037c,_0x586b30){return db[_0x1c20('0x55')][_0x1c20('0x5d')]({'where':{'id':_0x4c037c[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x586b30,null))[_0x1c20('0x3b')](removeEntity(_0x586b30,null))['catch'](handleError(_0x586b30,null));};exports[_0x1c20('0x69')]=function(_0x2eaa2e,_0x5e30c9){return db[_0x1c20('0x55')]['describe']()['then'](respondWithResult(_0x5e30c9,null))['catch'](handleError(_0x5e30c9,null));};exports[_0x1c20('0x6a')]=function(_0x18df99,_0xa10edb,_0x5662c7){if(_0x18df99[_0x1c20('0x5f')]['id']){delete _0x18df99[_0x1c20('0x5f')]['id'];}return db[_0x1c20('0x55')][_0x1c20('0x5d')]({'where':{'id':_0x18df99['params']['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0xa10edb,null))['then'](function(_0x1135ea){if(_0x1135ea){_0x18df99['body'][_0x1c20('0x6b')]=_0x1135ea['id'];return db['Disposition'][_0x1c20('0x5e')](_0x18df99[_0x1c20('0x5f')]);}})[_0x1c20('0x3b')](respondWithResult(_0xa10edb,null))[_0x1c20('0x2c')](handleError(_0xa10edb,null));};exports[_0x1c20('0x6c')]=function(_0x845959,_0x1df735,_0x382e7d){var _0x1c478e={'raw':![],'where':{}};var _0x34cf6a={};var _0x22d740={'count':0x0,'rows':[]};return db[_0x1c20('0x55')][_0x1c20('0x6d')]({'where':{'id':_0x845959[_0x1c20('0x59')]['id']}})['then'](handleEntityNotFound(_0x1df735,null))[_0x1c20('0x3b')](function(_0x46c29d){if(_0x46c29d){_0x34cf6a[_0x1c20('0x44')]=_[_0x1c20('0x47')](db[_0x1c20('0x6e')][_0x1c20('0x41')]);_0x34cf6a[_0x1c20('0x46')]=_['keys'](_0x845959[_0x1c20('0x46')]);_0x34cf6a[_0x1c20('0x48')]=_[_0x1c20('0x4a')](_0x34cf6a[_0x1c20('0x44')],_0x34cf6a[_0x1c20('0x46')]);_0x1c478e[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x34cf6a['model'],qs['fields'](_0x845959[_0x1c20('0x46')]['fields']));_0x1c478e[_0x1c20('0x49')]=_0x1c478e[_0x1c20('0x49')]['length']?_0x1c478e[_0x1c20('0x49')]:_0x34cf6a[_0x1c20('0x44')];if(!_0x845959[_0x1c20('0x46')][_0x1c20('0x4d')](_0x1c20('0x4e'))){_0x1c478e['limit']=qs[_0x1c20('0x33')](_0x845959['query'][_0x1c20('0x33')]);_0x1c478e[_0x1c20('0x31')]=qs[_0x1c20('0x31')](_0x845959[_0x1c20('0x46')][_0x1c20('0x31')]);}_0x1c478e[_0x1c20('0x4f')]=qs[_0x1c20('0x50')](_0x845959[_0x1c20('0x46')][_0x1c20('0x50')]);_0x1c478e['where']=qs['filters'](_['pick'](_0x845959[_0x1c20('0x46')],_0x34cf6a[_0x1c20('0x48')]));_0x1c478e[_0x1c20('0x51')]['FaxAccountId']=_0x46c29d['id'];if(_0x845959[_0x1c20('0x46')]['filter']){_0x1c478e[_0x1c20('0x51')]=_[_0x1c20('0x5c')](_0x1c478e[_0x1c20('0x51')],{'$or':_[_0x1c20('0x45')](_0x1c478e['attributes'],function(_0x5c95db){var _0x170207={};_0x170207[_0x5c95db]={'$like':'%'+_0x845959[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x170207;})});}_0x1c478e=_[_0x1c20('0x5c')]({},_0x1c478e,_0x845959['options']);return db['Disposition']['count']({'where':_0x1c478e[_0x1c20('0x51')]})[_0x1c20('0x3b')](function(_0x32fd0f){_0x22d740[_0x1c20('0x34')]=_0x32fd0f;if(_0x845959[_0x1c20('0x46')]['includeAll']){_0x1c478e['include']=[{'all':!![]}];}return db[_0x1c20('0x6e')][_0x1c20('0x57')](_0x1c478e);})[_0x1c20('0x3b')](function(_0x4da3e2){_0x22d740[_0x1c20('0x58')]=_0x4da3e2;return _0x22d740;});}})[_0x1c20('0x3b')](respondWithFilteredResult(_0x1df735,_0x1c478e))[_0x1c20('0x2c')](handleError(_0x1df735,null));};exports[_0x1c20('0x6f')]=function(_0x54f0fd,_0xe7459b,_0x133e57){return db['FaxAccount'][_0x1c20('0x5d')]({'where':{'id':_0x54f0fd[_0x1c20('0x59')]['id']}})['then'](handleEntityNotFound(_0xe7459b,null))['then'](function(_0x50eee3){if(_0x50eee3){return _0x50eee3[_0x1c20('0x6f')](_0x54f0fd[_0x1c20('0x46')]['ids']);}})[_0x1c20('0x3b')](respondWithStatusCode(_0xe7459b,null))[_0x1c20('0x2c')](handleError(_0xe7459b,null));};exports['addAnswer']=function(_0x36cfcf,_0x2b29d1,_0x514423){if(_0x36cfcf[_0x1c20('0x5f')]['id']){delete _0x36cfcf['body']['id'];}return db['FaxAccount'][_0x1c20('0x5d')]({'where':{'id':_0x36cfcf[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x2b29d1,null))[_0x1c20('0x3b')](function(_0x2ca016){if(_0x2ca016){_0x36cfcf[_0x1c20('0x5f')][_0x1c20('0x6b')]=_0x2ca016['id'];return db[_0x1c20('0x70')][_0x1c20('0x5e')](_0x36cfcf[_0x1c20('0x5f')]);}})[_0x1c20('0x3b')](respondWithResult(_0x2b29d1,null))['catch'](handleError(_0x2b29d1,null));};exports[_0x1c20('0x71')]=function(_0x39152b,_0x46e8e3,_0x3b2afc){var _0x5ddf53={'raw':![],'where':{}};var _0x121c88={};var _0x3b99df={'count':0x0,'rows':[]};return db[_0x1c20('0x55')]['findOne']({'where':{'id':_0x39152b[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x46e8e3,null))[_0x1c20('0x3b')](function(_0xc53d9b){if(_0xc53d9b){_0x121c88[_0x1c20('0x44')]=_['keys'](db[_0x1c20('0x70')]['rawAttributes']);_0x121c88[_0x1c20('0x46')]=_[_0x1c20('0x47')](_0x39152b[_0x1c20('0x46')]);_0x121c88[_0x1c20('0x48')]=_[_0x1c20('0x4a')](_0x121c88[_0x1c20('0x44')],_0x121c88[_0x1c20('0x46')]);_0x5ddf53[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x121c88['model'],qs[_0x1c20('0x4b')](_0x39152b[_0x1c20('0x46')][_0x1c20('0x4b')]));_0x5ddf53[_0x1c20('0x49')]=_0x5ddf53[_0x1c20('0x49')]['length']?_0x5ddf53['attributes']:_0x121c88[_0x1c20('0x44')];if(!_0x39152b[_0x1c20('0x46')][_0x1c20('0x4d')](_0x1c20('0x4e'))){_0x5ddf53[_0x1c20('0x33')]=qs[_0x1c20('0x33')](_0x39152b[_0x1c20('0x46')][_0x1c20('0x33')]);_0x5ddf53[_0x1c20('0x31')]=qs[_0x1c20('0x31')](_0x39152b[_0x1c20('0x46')]['offset']);}_0x5ddf53[_0x1c20('0x4f')]=qs['sort'](_0x39152b[_0x1c20('0x46')][_0x1c20('0x50')]);_0x5ddf53['where']=qs[_0x1c20('0x48')](_[_0x1c20('0x52')](_0x39152b[_0x1c20('0x46')],_0x121c88[_0x1c20('0x48')]));_0x5ddf53[_0x1c20('0x51')][_0x1c20('0x6b')]=_0xc53d9b['id'];if(_0x39152b[_0x1c20('0x46')][_0x1c20('0x53')]){_0x5ddf53[_0x1c20('0x51')]=_[_0x1c20('0x5c')](_0x5ddf53[_0x1c20('0x51')],{'$or':_['map'](_0x5ddf53[_0x1c20('0x49')],function(_0x156439){var _0x2e3444={};_0x2e3444[_0x156439]={'$like':'%'+_0x39152b['query'][_0x1c20('0x53')]+'%'};return _0x2e3444;})});}_0x5ddf53=_[_0x1c20('0x5c')]({},_0x5ddf53,_0x39152b['options']);return db['CannedAnswer'][_0x1c20('0x34')]({'where':_0x5ddf53['where']})[_0x1c20('0x3b')](function(_0x3927ad){_0x3b99df[_0x1c20('0x34')]=_0x3927ad;if(_0x39152b[_0x1c20('0x46')][_0x1c20('0x5b')]){_0x5ddf53[_0x1c20('0x56')]=[{'all':!![]}];}return db[_0x1c20('0x70')][_0x1c20('0x57')](_0x5ddf53);})[_0x1c20('0x3b')](function(_0x19ef5f){_0x3b99df[_0x1c20('0x58')]=_0x19ef5f;return _0x3b99df;});}})[_0x1c20('0x3b')](respondWithFilteredResult(_0x46e8e3,_0x5ddf53))[_0x1c20('0x2c')](handleError(_0x46e8e3,null));};exports[_0x1c20('0x72')]=function(_0x44c8b4,_0x2b40cd,_0x29f68a){return db[_0x1c20('0x55')]['find']({'where':{'id':_0x44c8b4[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x2b40cd,null))[_0x1c20('0x3b')](function(_0x434451){if(_0x434451){return _0x434451[_0x1c20('0x72')](_0x44c8b4[_0x1c20('0x46')][_0x1c20('0x73')]);}})['then'](respondWithStatusCode(_0x2b40cd,null))['catch'](handleError(_0x2b40cd,null));};exports[_0x1c20('0x74')]=function(_0x3e00e0,_0x3374b1,_0x32580d){return db[_0x1c20('0x75')][_0x1c20('0x5d')]({'where':{'id':_0x3e00e0[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x3374b1,null))[_0x1c20('0x3b')](function(_0x38f2f5){if(_0x38f2f5){return _0x38f2f5[_0x1c20('0x74')](_0x3e00e0[_0x1c20('0x5f')][_0x1c20('0x73')],_['omit'](_0x3e00e0[_0x1c20('0x5f')],['ids','id'])||{});}})[_0x1c20('0x3b')](respondWithResult(_0x3374b1,null))[_0x1c20('0x2c')](handleError(_0x3374b1,null));};exports['getInteractions']=function(_0x2d97fe,_0x35b980,_0x1c84f0){var _0x1f39a5={'raw':![],'where':{}};var _0x205449={};var _0x4ca27f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1c20('0x6d')]({'where':{'id':_0x2d97fe[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x35b980,null))[_0x1c20('0x3b')](function(_0x41f326){if(_0x41f326){_0x205449['model']=_[_0x1c20('0x47')](db[_0x1c20('0x75')]['rawAttributes']);_0x205449[_0x1c20('0x46')]=_['keys'](_0x2d97fe[_0x1c20('0x46')]);_0x205449['filters']=_[_0x1c20('0x4a')](_0x205449[_0x1c20('0x44')],_0x205449[_0x1c20('0x46')]);_0x1f39a5[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x205449[_0x1c20('0x44')],qs['fields'](_0x2d97fe[_0x1c20('0x46')]['fields']));_0x1f39a5['attributes']=_0x1f39a5[_0x1c20('0x49')]['length']?_0x1f39a5[_0x1c20('0x49')]:_0x205449[_0x1c20('0x44')];if(!_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x4d')](_0x1c20('0x4e'))){_0x1f39a5[_0x1c20('0x33')]=qs['limit'](_0x2d97fe['query'][_0x1c20('0x33')]);_0x1f39a5[_0x1c20('0x31')]=qs['offset'](_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x31')]);}_0x1f39a5[_0x1c20('0x4f')]=qs['sort'](_0x2d97fe['query'][_0x1c20('0x50')]);_0x1f39a5[_0x1c20('0x51')]=qs[_0x1c20('0x48')](_[_0x1c20('0x52')](_0x2d97fe[_0x1c20('0x46')],_0x205449[_0x1c20('0x48')]));_0x1f39a5[_0x1c20('0x51')][_0x1c20('0x6b')]=_0x41f326['id'];if(_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x53')]){_0x1f39a5['where']=_['merge'](_0x1f39a5[_0x1c20('0x51')],{'$or':_[_0x1c20('0x45')](_0x1f39a5['attributes'],function(_0x349a8f){var _0x258b94={};_0x258b94[_0x349a8f]={'$like':'%'+_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x258b94;})});}_0x1f39a5=_['merge']({},_0x1f39a5,_0x2d97fe[_0x1c20('0x54')]);return db['FaxInteraction']['count']({'where':_0x1f39a5[_0x1c20('0x51')]})['then'](function(_0x42d7ad){_0x4ca27f[_0x1c20('0x34')]=_0x42d7ad;if(_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x5b')]){_0x1f39a5[_0x1c20('0x56')]=[{'model':db[_0x1c20('0x76')],'as':_0x1c20('0x77'),'required':![]},{'model':db[_0x1c20('0x78')],'as':_0x1c20('0x79'),'attributes':[_0x1c20('0x3e'),_0x1c20('0x7a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x1c20('0x7b'),'attributes':['id','name',_0x1c20('0x7c')],'where':_0x2d97fe['query']['tag']?{'id':_0x2d97fe[_0x1c20('0x46')]['tag']}:undefined,'required':_0x2d97fe[_0x1c20('0x46')][_0x1c20('0x7d')]?!![]:![]}];}return db[_0x1c20('0x75')][_0x1c20('0x57')](_0x1f39a5);})[_0x1c20('0x3b')](function(_0x42ab4c){_0x4ca27f[_0x1c20('0x58')]=_0x42ab4c;return _0x4ca27f;});}})[_0x1c20('0x3b')](respondWithFilteredResult(_0x35b980,_0x1f39a5))['catch'](handleError(_0x35b980,null));};exports[_0x1c20('0x7e')]=function(_0x23f88d,_0x98ef51){var _0x2ec5d3=_0x23f88d['params']['id'];var _0x14de55=_0x23f88d[_0x1c20('0x5f')];var _0x52086f=0xc8;var _0x46fbef=null;return db[_0x1c20('0x7f')]['transaction']({'isolationLevel':db['sequelize'][_0x1c20('0x80')][_0x1c20('0x81')][_0x1c20('0x82')]},function(_0x370350){return db[_0x1c20('0x55')][_0x1c20('0x6d')]({'where':{'id':_0x2ec5d3},'transaction':_0x370350})[_0x1c20('0x3b')](function(_0x377dc2){if(_0x377dc2){return db[_0x1c20('0x83')][_0x1c20('0x3d')]({'where':{'FaxAccountId':_0x2ec5d3},'transaction':_0x370350})[_0x1c20('0x3b')](function(){var _0x5c206e=_[_0x1c20('0x45')](_0x14de55,function(_0x59f48e){_0x59f48e[_0x1c20('0x6b')]=_0x2ec5d3;return _0x59f48e;});return db[_0x1c20('0x83')][_0x1c20('0x84')](_0x5c206e,{'transaction':_0x370350});});}else{_0x52086f=0x194;_0x46fbef=[];}});})[_0x1c20('0x3b')](function(){if(_0x52086f!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x2ec5d3},'order':_0x1c20('0x85')})[_0x1c20('0x3b')](function(_0x1d532d){_0x46fbef=_0x1d532d;});}})['catch'](function(_0xf78678){_0x52086f=0x1f4;logger[_0x1c20('0x28')](_0xf78678[_0x1c20('0x86')]);if(_0xf78678[_0x1c20('0x3e')]){delete _0xf78678[_0x1c20('0x3e')];}_0x46fbef=_0xf78678;})[_0x1c20('0x87')](function(){if(_0x46fbef===null){_0x98ef51[_0x1c20('0x2d')](_0x52086f);}else{if(_0x52086f===0x1f4){_0x98ef51[_0x1c20('0x2f')](_0x52086f)[_0x1c20('0x3f')](_0x46fbef);}else{_0x98ef51[_0x1c20('0x2f')](_0x52086f)[_0x1c20('0x30')](_0x46fbef);}}});};exports[_0x1c20('0x88')]=function(_0x15b588,_0x1ea765,_0x5130f6){var _0x484f71={};var _0x14f080={};var _0x106fd1;var _0x24d40c;return db[_0x1c20('0x55')]['findOne']({'where':{'id':_0x15b588[_0x1c20('0x59')]['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x1ea765,null))[_0x1c20('0x3b')](function(_0x353107){if(_0x353107){_0x106fd1=_0x353107;_0x14f080[_0x1c20('0x44')]=_[_0x1c20('0x47')](db[_0x1c20('0x83')][_0x1c20('0x41')]);_0x14f080['query']=_['keys'](_0x15b588['query']);_0x14f080[_0x1c20('0x48')]=_[_0x1c20('0x4a')](_0x14f080[_0x1c20('0x44')],_0x14f080['query']);_0x484f71[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x14f080[_0x1c20('0x44')],qs['fields'](_0x15b588[_0x1c20('0x46')][_0x1c20('0x4b')]));_0x484f71[_0x1c20('0x49')]=_0x484f71[_0x1c20('0x49')][_0x1c20('0x4c')]?_0x484f71[_0x1c20('0x49')]:_0x14f080['model'];_0x484f71[_0x1c20('0x4f')]=qs[_0x1c20('0x50')](_0x15b588[_0x1c20('0x46')][_0x1c20('0x50')]);_0x484f71[_0x1c20('0x51')]=qs[_0x1c20('0x48')](_['pick'](_0x15b588[_0x1c20('0x46')],_0x14f080[_0x1c20('0x48')]));if(_0x15b588[_0x1c20('0x46')]['filter']){_0x484f71[_0x1c20('0x51')]=_[_0x1c20('0x5c')](_0x484f71[_0x1c20('0x51')],{'$or':_['map'](_0x484f71[_0x1c20('0x49')],function(_0x416b40){var _0x4737bf={};_0x4737bf[_0x416b40]={'$like':'%'+_0x15b588[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x4737bf;})});}_0x484f71=_[_0x1c20('0x5c')]({},_0x484f71,_0x15b588['options']);return _0x106fd1[_0x1c20('0x88')](_0x484f71);}})[_0x1c20('0x3b')](function(_0x31ef32){if(_0x31ef32){_0x24d40c=_0x31ef32[_0x1c20('0x4c')];if(!_0x15b588[_0x1c20('0x46')][_0x1c20('0x4d')]('nolimit')){_0x484f71[_0x1c20('0x33')]=qs[_0x1c20('0x33')](_0x15b588[_0x1c20('0x46')]['limit']);_0x484f71[_0x1c20('0x31')]=qs['offset'](_0x15b588[_0x1c20('0x46')][_0x1c20('0x31')]);}return _0x106fd1['getApplications'](_0x484f71);}})[_0x1c20('0x3b')](function(_0xbdf127){if(_0xbdf127){return _0xbdf127?{'count':_0x24d40c,'rows':_0xbdf127}:null;}})[_0x1c20('0x3b')](respondWithResult(_0x1ea765,null))[_0x1c20('0x2c')](handleError(_0x1ea765,null));};function Extension(_0x713b77,_0x243cd4,_0x28a968,_0xaf803e){this['context']=_0x1c20('0x89');this[_0x1c20('0x8a')]=_0x713b77[_0x1c20('0x8b')];this['app']=_0xaf803e;this['type']='system';this[_0x1c20('0x8c')]=_0x1c20('0x8d');this[_0x1c20('0x6b')]=_0x713b77['id'];this[_0x1c20('0x85')]=_0x243cd4;this[_0x1c20('0x8e')]=_0x28a968;}function createExtensionsReciveFax(_0x229f84){var _0x166d31=0x1;var _0x24a887=[];_0x24a887[_0x1c20('0x8f')](new Extension(_0x229f84,_0x166d31,'','Answer'));_0x166d31+=0x1;_0x24a887[_0x1c20('0x8f')](new Extension(_0x229f84,_0x166d31,_0x1c20('0x90'),_0x1c20('0x91')));_0x166d31+=0x1;for(var _0x521b61 in _0x229f84){if(_0x229f84[_0x1c20('0x4d')](_0x521b61)&&(_0x521b61==='ecm'||_0x521b61===_0x1c20('0x8b')||_0x521b61===_0x1c20('0x92')||_0x521b61===_0x1c20('0x93')||_0x521b61===_0x1c20('0x94')||_0x521b61===_0x1c20('0x95')||_0x521b61===_0x1c20('0x96')||_0x521b61===_0x1c20('0x97')||_0x521b61===_0x1c20('0x98'))){_0x24a887['push'](new Extension(_0x229f84,_0x166d31,_0x1c20('0x99')+_0x521b61+')='+_0x229f84[_0x521b61],_0x1c20('0x91')));_0x166d31+=0x1;}}_0x24a887[_0x1c20('0x8f')](new Extension(_0x229f84,_0x166d31,'6',_0x1c20('0x9a')));_0x166d31+=0x1;_0x24a887[_0x1c20('0x8f')](new Extension(_0x229f84,_0x166d31,_0x1c20('0x9b'),_0x1c20('0x9c')));_0x166d31=0x0;return _0x24a887;}exports[_0x1c20('0x9d')]=function(_0x1fbf20,_0x321441,_0x1db335){var _0x2e9d51;return db[_0x1c20('0x7f')]['transaction'](function(_0x4acc71){return db['FaxAccount'][_0x1c20('0x5e')](_0x1fbf20[_0x1c20('0x5f')],{'transaction':_0x4acc71})[_0x1c20('0x3b')](function(_0x4fc545){_0x2e9d51=_0x4fc545['get']({'plain':!![]});return db[_0x1c20('0x9e')][_0x1c20('0x84')](createExtensionsReciveFax(_0x2e9d51),{'transaction':_0x4acc71});});})[_0x1c20('0x3b')](function(){return _0x2e9d51;})[_0x1c20('0x3b')](respondWithResult(_0x321441,null))[_0x1c20('0x2c')](handleError(_0x321441,null));};exports['updateAccountApplications']=function(_0x1ffdbe,_0x3a9032,_0x43be6a){var _0x40ec9b;return db[_0x1c20('0x7f')][_0x1c20('0x9f')](function(_0x227c6b){return db[_0x1c20('0x55')][_0x1c20('0x3a')](_0x1ffdbe[_0x1c20('0x5f')],{'where':{'id':_0x1ffdbe[_0x1c20('0x5f')]['id']},'transaction':_0x227c6b})[_0x1c20('0x3b')](function(_0x1c7561){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x1ffdbe['body']['id']},'transaction':_0x227c6b})[_0x1c20('0x3b')](function(_0x3cc55d){return db['VoiceExtension'][_0x1c20('0x84')](createExtensionsReciveFax(_['omit'](_0x1ffdbe['body'],[_0x1c20('0xa0'),'key',_0x1c20('0xa1'),_0x1c20('0xa2'),'TrunkId',_0x1c20('0xa3')])),{'transaction':_0x227c6b});});});})[_0x1c20('0x3b')](function(){return db['FaxAccount'][_0x1c20('0xa4')](_0x1ffdbe[_0x1c20('0x5f')]['id']);})[_0x1c20('0x3b')](respondWithResult(_0x3a9032,null))[_0x1c20('0x2c')](handleError(_0x3a9032,null));};exports[_0x1c20('0xa5')]=function(_0x4ec0ce,_0xccef2e,_0x31e5c7){var _0x10cfbf={'raw':!![],'where':{}};var _0x2ce001={};var _0x7d3553={'count':0x0,'rows':[]};return db[_0x1c20('0x55')][_0x1c20('0x6d')]({'where':{'id':_0x4ec0ce['params']['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0xccef2e,null))['then'](function(_0x220b76){if(_0x220b76){_0x2ce001[_0x1c20('0x44')]=_['keys'](db[_0x1c20('0xa6')][_0x1c20('0x41')]);_0x2ce001['query']=_[_0x1c20('0x47')](_0x4ec0ce[_0x1c20('0x46')]);_0x2ce001[_0x1c20('0x48')]=_[_0x1c20('0x4a')](_0x2ce001[_0x1c20('0x44')],_0x2ce001['query']);_0x10cfbf[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x2ce001['model'],qs[_0x1c20('0x4b')](_0x4ec0ce[_0x1c20('0x46')]['fields']));_0x10cfbf[_0x1c20('0x49')]=_0x10cfbf[_0x1c20('0x49')][_0x1c20('0x4c')]?_0x10cfbf[_0x1c20('0x49')]:_0x2ce001[_0x1c20('0x44')];if(!_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0x4d')](_0x1c20('0x4e'))){_0x10cfbf['limit']=qs[_0x1c20('0x33')](_0x4ec0ce['query']['limit']);_0x10cfbf['offset']=qs['offset'](_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0x31')]);}_0x10cfbf[_0x1c20('0x4f')]=qs[_0x1c20('0x50')](_0x4ec0ce[_0x1c20('0x46')]['sort']);_0x10cfbf[_0x1c20('0x51')]=qs[_0x1c20('0x48')](_[_0x1c20('0x52')](_0x4ec0ce['query'],_0x2ce001[_0x1c20('0x48')]));_0x10cfbf[_0x1c20('0x51')][_0x1c20('0x6b')]=_0x220b76['id'];if(_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0x53')]){_0x10cfbf['where']=_['merge'](_0x10cfbf['where'],{'$or':_[_0x1c20('0x45')](_0x10cfbf[_0x1c20('0x49')],function(_0x119816){var _0x48c7d2={};_0x48c7d2[_0x119816]={'$like':'%'+_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x48c7d2;})});}if(_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0xa7')]){var _0x5d7c08=_0x4ec0ce[_0x1c20('0x46')][_0x1c20('0xa7')][_0x1c20('0xa8')](',');var _0x28cd13={};_0x28cd13[_0x5d7c08[0x0]]={'$gte':moment(_0x5d7c08[0x1])[_0x1c20('0xa9')](_0x1c20('0xaa'))};_0x10cfbf['where']=_['merge'](_0x10cfbf[_0x1c20('0x51')],_0x28cd13);}_0x10cfbf=_[_0x1c20('0x5c')]({},_0x10cfbf,_0x4ec0ce[_0x1c20('0x54')]);return db[_0x1c20('0xa6')][_0x1c20('0x34')]({'where':_0x10cfbf[_0x1c20('0x51')]})[_0x1c20('0x3b')](function(_0x12f24e){_0x7d3553[_0x1c20('0x34')]=_0x12f24e;if(_0x4ec0ce['query'][_0x1c20('0x5b')]){_0x10cfbf[_0x1c20('0x56')]=[{'all':!![]}];}return db[_0x1c20('0xa6')][_0x1c20('0x57')](_0x10cfbf);})['then'](function(_0x1cb81d){_0x7d3553[_0x1c20('0x58')]=_0x1cb81d;return _0x7d3553;});}})[_0x1c20('0x3b')](respondWithFilteredResult(_0xccef2e,_0x10cfbf))[_0x1c20('0x2c')](handleError(_0xccef2e,null));};exports['send']=function(_0x348f06,_0x5aadc1,_0x8c3521){var _0x184fbf,_0x2592ab={},_0x1b6a36;if(_0x348f06['body']['to']){_0x1b6a36=_0x348f06['body']['to'][0x0];}return db[_0x1c20('0x55')][_0x1c20('0x5d')]({'where':{'id':_0x348f06[_0x1c20('0x59')]['id']},'include':[{'model':db[_0x1c20('0xab')],'as':_0x1c20('0xac'),'include':[{'model':db['CmContact'],'as':_0x1c20('0xad'),'where':{'fax':_0x1b6a36},'limit':0x1,'order':[['updatedAt',_0x1c20('0xae')]]}]}]})[_0x1c20('0x3b')](handleEntityNotFound(_0x5aadc1,null))[_0x1c20('0x3b')](function(_0x24512e){_0x184fbf=_0x24512e;if(_0x348f06['body'][_0x1c20('0xaf')]&&_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][_0x1c20('0x4c')]){for(var _0x220f2d=0x0;_0x220f2d<_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][_0x1c20('0x4c')];_0x220f2d+=0x1){_0x348f06['body'][_0x1c20('0xaf')][_0x220f2d]={'filename':_0x348f06['body'][_0x1c20('0xaf')][_0x220f2d][_0x1c20('0x3e')],'id':_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][_0x220f2d]['id'],'path':path[_0x1c20('0xb0')](config[_0x1c20('0xb1')],'server/files/attachments',_0x348f06[_0x1c20('0x5f')]['attachments'][_0x220f2d][_0x1c20('0xb2')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x348f06[_0x1c20('0x59')]['id'])?undefined:_0x348f06['params']['id'],'path':_[_0x1c20('0xb3')](_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][0x0]['path'])?undefined:_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][0x0][_0x1c20('0x7')],'fax':_[_0x1c20('0xb3')](_0x348f06[_0x1c20('0x5f')]['to'][0x0])?undefined:_0x348f06[_0x1c20('0x5f')]['to'][0x0]},client9002);})[_0x1c20('0x3b')](function(){if(_0x184fbf){if(_[_0x1c20('0xb3')](_0x348f06[_0x1c20('0x5f')][_0x1c20('0xb4')])){_0x348f06[_0x1c20('0x5f')][_0x1c20('0xb4')]=util[_0x1c20('0xa9')](_0x1c20('0xb5'),_0x184fbf['name'],_0x184fbf[_0x1c20('0xb6')]);}if(_0x184fbf[_0x1c20('0xac')]){if(_0x184fbf[_0x1c20('0xac')][_0x1c20('0xad')][_0x1c20('0x4c')]){return _0x184fbf['List'][_0x1c20('0xad')][0x0];}else{return db[_0x1c20('0x76')][_0x1c20('0x5e')](_[_0x1c20('0x1c')](_0x348f06[_0x1c20('0x5f')],{'firstName':_0x348f06[_0x1c20('0x5f')]['to'][0x0],'phone':_0x348f06[_0x1c20('0x5f')]['to'][0x0],'fax':_0x348f06[_0x1c20('0x5f')]['to'][0x0],'ListId':_0x184fbf[_0x1c20('0xa3')]}));}}else{throw new Error(_0x1c20('0xb7'));}}else{throw new Error(_0x1c20('0xb8'));}})[_0x1c20('0x3b')](function(_0x34371f){if(_0x34371f){return db[_0x1c20('0x75')][_0x1c20('0x5d')]({'where':{'ContactId':_0x34371f['id'],'closed':![],'FaxAccountId':_0x184fbf['id']}})[_0x1c20('0x3b')](function(_0x18fc29){if(_0x18fc29){return[_0x18fc29,![]];}return db[_0x1c20('0x75')][_0x1c20('0x5e')]({'UserId':_0x348f06['user']['id'],'ContactId':_0x34371f['id'],'FaxAccountId':_0x184fbf['id'],'fax':_0x348f06[_0x1c20('0x5f')]['to'][0x0],'firstMsgDirection':_0x1c20('0xb9'),'Messages':[_[_0x1c20('0x5c')](_0x348f06[_0x1c20('0x5f')],{'read':![],'body':_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][0x0][_0x1c20('0xba')],'FaxAccountId':_0x184fbf['id'],'UserId':_0x348f06[_0x1c20('0x60')]['id'],'ContactId':_0x34371f['id'],'AttachmentId':_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x31b968){return[_0x31b968,!![]];});});}else{throw new Error(_0x1c20('0xbb'));}})[_0x1c20('0xbc')](function(_0x5df197,_0x39c041){if(_0x39c041){return _0x5df197;}return db['FaxMessage'][_0x1c20('0x5e')]({'direction':_0x1c20('0xb9'),'read':![],'body':_0x348f06['body']['attachments'][0x0][_0x1c20('0xba')],'FaxAccountId':_0x184fbf['id'],'FaxInteractionId':_0x5df197['id'],'UserId':_0x348f06['user']['id'],'ContactId':_0x5df197[_0x1c20('0xbd')],'AttachmentId':_0x348f06['body'][_0x1c20('0xaf')][0x0]['id']})[_0x1c20('0x3b')](function(_0x562a21){_0x5df197[_0x1c20('0xbe')][_0x1c20('0xbf')]=[];_0x5df197[_0x1c20('0xbe')]['Messages'][_0x1c20('0x8f')](_0x562a21[_0x1c20('0xbe')]);return _0x5df197;});})[_0x1c20('0x3b')](function(_0xca7d0c){respondWithRpcPromise('SendFax',_0x1c20('0xc0'),{'FaxAccountId':_['isNil'](_0x348f06['params']['id'])?undefined:_0x348f06[_0x1c20('0x59')]['id'],'path':_[_0x1c20('0xb3')](_0x348f06[_0x1c20('0x5f')][_0x1c20('0xaf')][0x0][_0x1c20('0x7')])?undefined:_0x348f06['body'][_0x1c20('0xaf')][0x0]['path'],'fax':_['isNil'](_0x348f06[_0x1c20('0x5f')]['to'][0x0])?undefined:_0x348f06['body']['to'][0x0],'AttachmentId':_0x348f06['body']['attachments'][0x0]['id']},client9002)[_0x1c20('0x3b')](function(_0x1f5180){logger[_0x1c20('0x25')](_0x1c20('0xc1'),_0x1f5180);})[_0x1c20('0x2c')](function(_0x1a9f12){logger[_0x1c20('0x25')](_0x1c20('0xc1'),_0x1a9f12);});return _0xca7d0c;})[_0x1c20('0x3b')](respondWithResult(_0x5aadc1,null))[_0x1c20('0x2c')](handleError(_0x5aadc1,null));};exports[_0x1c20('0xc2')]=function(_0x406a86,_0x20ad5f,_0x224d1e){return db[_0x1c20('0x55')]['find']({'where':{'id':_0x406a86['params']['id']}})[_0x1c20('0x3b')](handleEntityNotFound(_0x20ad5f,null))[_0x1c20('0x3b')](function(_0xeecca7){if(_0xeecca7){return _0xeecca7['addAgents'](_0x406a86[_0x1c20('0x5f')][_0x1c20('0x73')],_[_0x1c20('0xc3')](_0x406a86['body'],[_0x1c20('0x73'),'id'])||{})[_0x1c20('0xbc')](function(_0x51ca59){for(var _0x3ba13e=0x0;_0x3ba13e<_0x406a86['body'][_0x1c20('0x73')][_0x1c20('0x4c')];_0x3ba13e+=0x1){socket[_0x1c20('0xc4')](_0x1c20('0xc5'),{'UserId':Number(_0x406a86[_0x1c20('0x5f')]['ids'][_0x3ba13e]),'FaxAccountId':Number(_0x406a86['params']['id'])});}return _0x51ca59;});}})[_0x1c20('0x3b')](respondWithResult(_0x20ad5f,null))[_0x1c20('0x2c')](handleError(_0x20ad5f,null));};exports['removeAgents']=function(_0x53bc9a,_0xe12c3d,_0xe16230){return db[_0x1c20('0x55')][_0x1c20('0x5d')]({'where':{'id':_0x53bc9a[_0x1c20('0x59')]['id']}})['then'](handleEntityNotFound(_0xe12c3d,null))[_0x1c20('0x3b')](function(_0xb9869c){if(_0xb9869c){return _0xb9869c[_0x1c20('0xc6')](_0x53bc9a[_0x1c20('0x46')][_0x1c20('0x73')])['then'](function(){if(_[_0x1c20('0xc7')](_0x53bc9a[_0x1c20('0x46')][_0x1c20('0x73')])){for(var _0x1cce0e=0x0;_0x1cce0e<_0x53bc9a[_0x1c20('0x46')]['ids'][_0x1c20('0x4c')];_0x1cce0e+=0x1){socket[_0x1c20('0xc4')](_0x1c20('0xc8'),{'UserId':Number(_0x53bc9a[_0x1c20('0x46')][_0x1c20('0x73')][_0x1cce0e]),'FaxAccountId':Number(_0x53bc9a['params']['id'])});}}else{socket[_0x1c20('0xc4')](_0x1c20('0xc8'),{'UserId':Number(_0x53bc9a['query']['ids']),'FaxAccountId':Number(_0x53bc9a[_0x1c20('0x59')]['id'])});}});}})[_0x1c20('0x3b')](respondWithStatusCode(_0xe12c3d,null))['catch'](handleError(_0xe12c3d,null));};exports['getAgents']=function(_0x4f0386,_0x347c24,_0x4ac0de){var _0x5429dc={};var _0x37adb2={};var _0x318408;var _0x3d2eca;return db[_0x1c20('0x55')]['findOne']({'where':{'id':_0x4f0386[_0x1c20('0x59')]['id']}})['then'](handleEntityNotFound(_0x347c24,null))[_0x1c20('0x3b')](function(_0x5c3109){if(_0x5c3109){_0x318408=_0x5c3109;_0x37adb2['model']=_[_0x1c20('0x47')](db['User'][_0x1c20('0x41')]);_0x37adb2[_0x1c20('0x46')]=_['keys'](_0x4f0386['query']);_0x37adb2['filters']=_[_0x1c20('0x4a')](_0x37adb2[_0x1c20('0x44')],_0x37adb2['query']);_0x5429dc[_0x1c20('0x49')]=_[_0x1c20('0x4a')](_0x37adb2[_0x1c20('0x44')],qs[_0x1c20('0x4b')](_0x4f0386[_0x1c20('0x46')][_0x1c20('0x4b')]));_0x5429dc[_0x1c20('0x49')]=_0x5429dc['attributes'][_0x1c20('0x4c')]?_0x5429dc[_0x1c20('0x49')]:_0x37adb2[_0x1c20('0x44')];_0x5429dc[_0x1c20('0x4f')]=qs[_0x1c20('0x50')](_0x4f0386[_0x1c20('0x46')][_0x1c20('0x50')]);_0x5429dc[_0x1c20('0x51')]=qs[_0x1c20('0x48')](_['pick'](_0x4f0386[_0x1c20('0x46')],_0x37adb2[_0x1c20('0x48')]));if(_0x4f0386[_0x1c20('0x46')][_0x1c20('0x53')]){_0x5429dc[_0x1c20('0x51')]=_[_0x1c20('0x5c')](_0x5429dc['where'],{'$or':_[_0x1c20('0x45')](_0x5429dc[_0x1c20('0x49')],function(_0x3092d6){var _0x41473c={};_0x41473c[_0x3092d6]={'$like':'%'+_0x4f0386[_0x1c20('0x46')][_0x1c20('0x53')]+'%'};return _0x41473c;})});}_0x5429dc=_[_0x1c20('0x5c')]({},_0x5429dc,_0x4f0386['options']);return _0x318408['getAgents'](_0x5429dc);}})['then'](function(_0x41230d){if(_0x41230d){_0x3d2eca=_0x41230d['length'];if(!_0x4f0386['query'][_0x1c20('0x4d')]('nolimit')){_0x5429dc[_0x1c20('0x33')]=qs[_0x1c20('0x33')](_0x4f0386['query'][_0x1c20('0x33')]);_0x5429dc[_0x1c20('0x31')]=qs[_0x1c20('0x31')](_0x4f0386['query'][_0x1c20('0x31')]);}return _0x318408[_0x1c20('0xc9')](_0x5429dc);}})[_0x1c20('0x3b')](function(_0x3146ed){if(_0x3146ed){return _0x3146ed?{'count':_0x3d2eca,'rows':_0x3146ed}:null;}})[_0x1c20('0x3b')](respondWithResult(_0x347c24,null))['catch'](handleError(_0x347c24,null));}; \ No newline at end of file +var _0xa57c=['gateway','maxrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','Pause','map','FaxAccount','rawAttributes','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','options','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','send','getApplications','from-voip-provider','localstationid','app','description','Fax\x20Extension','Answer','push','CDR(type)=inbound-fax','Set'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0xa57c,0x1c1));var _0xca57=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa57c[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0xca57('0x0'));var rimraf=require(_0xca57('0x1'));var zipdir=require(_0xca57('0x2'));var jsonpatch=require(_0xca57('0x3'));var rp=require(_0xca57('0x4'));var moment=require(_0xca57('0x5'));var BPromise=require(_0xca57('0x6'));var Mustache=require(_0xca57('0x7'));var util=require(_0xca57('0x8'));var path=require(_0xca57('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca57('0xa'));var fs=require('fs');var fs_extra=require(_0xca57('0xb'));var _=require(_0xca57('0xc'));var squel=require(_0xca57('0xd'));var crypto=require(_0xca57('0xe'));var jsforce=require(_0xca57('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca57('0x10'));var querystring=require(_0xca57('0x11'));var Papa=require(_0xca57('0x12'));var Redis=require(_0xca57('0x13'));var authService=require(_0xca57('0x14'));var qs=require(_0xca57('0x15'));var as=require(_0xca57('0x16'));var hardwareService=require(_0xca57('0x17'));var logger=require(_0xca57('0x18'))(_0xca57('0x19'));var utils=require(_0xca57('0x1a'));var config=require(_0xca57('0x1b'));var licenseUtil=require(_0xca57('0x1c'));var db=require(_0xca57('0x1d'))['db'];config[_0xca57('0x1e')]=_[_0xca57('0x1f')](config[_0xca57('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca57('0x1e')]));require('./faxAccount.socket')[_0xca57('0x20')](socket);var jayson=require(_0xca57('0x21'));var client=jayson[_0xca57('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xca57('0x22')][_0xca57('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x498b08,_0x93bc6b,_0x3ff443,_0x5bf88a){return new BPromise(function(_0x5b2678,_0x41d744){var _0x314919=_0x5bf88a||client;return _0x314919['request'](_0x498b08,_0x3ff443)[_0xca57('0x24')](function(_0xebe190){logger['info'](_0xca57('0x25'),_0x93bc6b,_0xca57('0x26'));logger[_0xca57('0x27')](_0xca57('0x28'),_0x93bc6b,_0xca57('0x26'),JSON[_0xca57('0x29')](_0xebe190));if(_0xebe190[_0xca57('0x2a')]){if(_0xebe190[_0xca57('0x2a')][_0xca57('0x2b')]===0x1f4){logger[_0xca57('0x2a')](_0xca57('0x25'),_0x93bc6b,_0xebe190[_0xca57('0x2a')][_0xca57('0x2c')]);return _0x41d744(_0xebe190['error']['message']);}logger[_0xca57('0x2a')](_0xca57('0x25'),_0x93bc6b,_0xebe190[_0xca57('0x2a')][_0xca57('0x2c')]);return _0x5b2678(_0xebe190[_0xca57('0x2a')][_0xca57('0x2c')]);}else{logger[_0xca57('0x2d')](_0xca57('0x25'),_0x93bc6b,_0xca57('0x26'));_0x5b2678(_0xebe190[_0xca57('0x2e')][_0xca57('0x2c')]);}})['catch'](function(_0x7a1f9f){logger[_0xca57('0x2a')](_0xca57('0x25'),_0x93bc6b,_0x7a1f9f);_0x41d744(_0x7a1f9f);});});}function respondWithStatusCode(_0x558818,_0x2fe74a){_0x2fe74a=_0x2fe74a||0xcc;return function(_0x35faea){if(_0x35faea){return _0x558818[_0xca57('0x2f')](_0x2fe74a);}return _0x558818['status'](_0x2fe74a)[_0xca57('0x30')]();};}function respondWithResult(_0x541593,_0x39f25a){_0x39f25a=_0x39f25a||0xc8;return function(_0x1f6eba){if(_0x1f6eba){return _0x541593[_0xca57('0x31')](_0x39f25a)['json'](_0x1f6eba);}};}function respondWithFilteredResult(_0x33df17,_0x2410bb){return function(_0x268bb9){if(_0x268bb9){var _0xde2b6b=typeof _0x2410bb[_0xca57('0x32')]===_0xca57('0x33')&&typeof _0x2410bb[_0xca57('0x34')]===_0xca57('0x33');var _0x331f92=_0x268bb9[_0xca57('0x35')];var _0x1eae0e=_0xde2b6b?0x0:_0x2410bb[_0xca57('0x32')];var _0x593744=_0xde2b6b?_0x268bb9[_0xca57('0x35')]:_0x2410bb[_0xca57('0x32')]+_0x2410bb[_0xca57('0x34')];var _0x45b6e8;if(_0x593744>=_0x331f92){_0x593744=_0x331f92;_0x45b6e8=0xc8;}else{_0x45b6e8=0xce;}_0x33df17[_0xca57('0x31')](_0x45b6e8);return _0x33df17[_0xca57('0x36')](_0xca57('0x37'),_0x1eae0e+'-'+_0x593744+'/'+_0x331f92)[_0xca57('0x38')](_0x268bb9);}return null;};}function patchUpdates(_0x500637){return function(_0x79478f){try{jsonpatch[_0xca57('0x39')](_0x79478f,_0x500637,!![]);}catch(_0x49503c){return BPromise[_0xca57('0x3a')](_0x49503c);}return _0x79478f[_0xca57('0x3b')]();};}function saveUpdates(_0xa813f3,_0x47be6d){return function(_0x1855fb){if(_0x1855fb){return _0x1855fb[_0xca57('0x3c')](_0xa813f3)[_0xca57('0x24')](function(_0x571204){return _0x571204;});}return null;};}function removeEntity(_0xa137d5,_0x2b6f73){return function(_0x19b944){if(_0x19b944){return _0x19b944[_0xca57('0x3d')]()[_0xca57('0x24')](function(){var _0x5d6d60=_0x19b944['get']({'plain':!![]});var _0x21db14=_0xca57('0x3e');return db[_0xca57('0x3f')][_0xca57('0x3d')]({'where':{'type':_0x21db14,'resourceId':_0x5d6d60['id']}})[_0xca57('0x24')](function(){return _0x19b944;});})[_0xca57('0x24')](function(){_0xa137d5[_0xca57('0x31')](0xcc)[_0xca57('0x30')]();});}};}function handleEntityNotFound(_0x19a2f3,_0x329cf1){return function(_0x2e2422){if(!_0x2e2422){_0x19a2f3[_0xca57('0x2f')](0x194);}return _0x2e2422;};}function handleError(_0x13c8d6,_0xe2ca71){_0xe2ca71=_0xe2ca71||0x1f4;return function(_0x45f401){logger[_0xca57('0x2a')](_0x45f401[_0xca57('0x40')]);if(_0x45f401[_0xca57('0x41')]){delete _0x45f401[_0xca57('0x41')];}_0x13c8d6['status'](_0xe2ca71)['send'](_0x45f401);};}exports['index']=function(_0x1c2358,_0x4f2c3d){var _0x4aa06b={'include':[{'model':db[_0xca57('0x42')],'as':'mandatoryDispositionPause'}]},_0x1c43d4={},_0x5e3c15={'count':0x0,'rows':[]};var _0x1d2bb6=_[_0xca57('0x43')](db[_0xca57('0x44')][_0xca57('0x45')],function(_0x52d37a){return{'name':_0x52d37a['fieldName'],'type':_0x52d37a[_0xca57('0x46')][_0xca57('0x47')]};});_0x1c43d4['model']=_['map'](_0x1d2bb6,_0xca57('0x41'));_0x1c43d4[_0xca57('0x48')]=_['keys'](_0x1c2358[_0xca57('0x48')]);_0x1c43d4[_0xca57('0x49')]=_['intersection'](_0x1c43d4['model'],_0x1c43d4['query']);_0x4aa06b[_0xca57('0x4a')]=_[_0xca57('0x4b')](_0x1c43d4[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x1c2358[_0xca57('0x48')][_0xca57('0x4d')]));_0x4aa06b['attributes']=_0x4aa06b[_0xca57('0x4a')][_0xca57('0x4e')]?_0x4aa06b[_0xca57('0x4a')]:_0x1c43d4[_0xca57('0x4c')];if(!_0x1c2358['query'][_0xca57('0x4f')](_0xca57('0x50'))){_0x4aa06b['limit']=qs[_0xca57('0x34')](_0x1c2358[_0xca57('0x48')][_0xca57('0x34')]);_0x4aa06b[_0xca57('0x32')]=qs[_0xca57('0x32')](_0x1c2358[_0xca57('0x48')][_0xca57('0x32')]);}_0x4aa06b[_0xca57('0x51')]=qs[_0xca57('0x52')](_0x1c2358[_0xca57('0x48')]['sort']);_0x4aa06b[_0xca57('0x53')]=qs['filters'](_[_0xca57('0x54')](_0x1c2358[_0xca57('0x48')],_0x1c43d4[_0xca57('0x49')]),_0x1d2bb6);if(_0x1c2358[_0xca57('0x48')]['filter']){_0x4aa06b[_0xca57('0x53')]=_[_0xca57('0x55')](_0x4aa06b['where'],{'$or':_['map'](_0x1d2bb6,function(_0x52ff73){if(_0x52ff73[_0xca57('0x46')]!==_0xca57('0x56')){var _0xffad6d={};_0xffad6d[_0x52ff73['name']]={'$like':'%'+_0x1c2358[_0xca57('0x48')][_0xca57('0x57')]+'%'};return _0xffad6d;}})});}_0x4aa06b=_[_0xca57('0x55')]({},_0x4aa06b,_0x1c2358['options']);var _0x7277e8={'where':_0x4aa06b[_0xca57('0x53')]};return db[_0xca57('0x44')][_0xca57('0x35')](_0x7277e8)['then'](function(_0x70c415){_0x5e3c15[_0xca57('0x35')]=_0x70c415;if(_0x1c2358[_0xca57('0x48')]['includeAll']){_0x4aa06b[_0xca57('0x58')]=[{'all':!![]}];}return db['FaxAccount'][_0xca57('0x59')](_0x4aa06b);})[_0xca57('0x24')](function(_0x4c20d8){_0x5e3c15[_0xca57('0x5a')]=_0x4c20d8;return _0x5e3c15;})['then'](respondWithFilteredResult(_0x4f2c3d,_0x4aa06b))[_0xca57('0x5b')](handleError(_0x4f2c3d,null));};exports[_0xca57('0x5c')]=function(_0x46ef30,_0x4fff6f){var _0x2943ee={'raw':![],'where':{'id':_0x46ef30[_0xca57('0x5d')]['id']},'include':[{'model':db[_0xca57('0x42')],'as':'mandatoryDispositionPause'}]},_0x5972c1={};_0x5972c1[_0xca57('0x4c')]=_[_0xca57('0x5e')](db[_0xca57('0x44')][_0xca57('0x45')]);_0x5972c1['query']=_[_0xca57('0x5e')](_0x46ef30[_0xca57('0x48')]);_0x5972c1[_0xca57('0x49')]=_[_0xca57('0x4b')](_0x5972c1['model'],_0x5972c1[_0xca57('0x48')]);_0x2943ee['attributes']=_[_0xca57('0x4b')](_0x5972c1['model'],qs[_0xca57('0x4d')](_0x46ef30['query'][_0xca57('0x4d')]));_0x2943ee[_0xca57('0x4a')]=_0x2943ee[_0xca57('0x4a')]['length']?_0x2943ee[_0xca57('0x4a')]:_0x5972c1[_0xca57('0x4c')];if(_0x46ef30[_0xca57('0x48')]['includeAll']){_0x2943ee[_0xca57('0x58')]=[{'all':!![]}];}_0x2943ee=_[_0xca57('0x55')]({},_0x2943ee,_0x46ef30['options']);return db[_0xca57('0x44')]['find'](_0x2943ee)[_0xca57('0x24')](handleEntityNotFound(_0x4fff6f,null))[_0xca57('0x24')](respondWithResult(_0x4fff6f,null))[_0xca57('0x5b')](handleError(_0x4fff6f,null));};exports[_0xca57('0x5f')]=function(_0x59fbba,_0x406509){return db[_0xca57('0x44')][_0xca57('0x5f')](_0x59fbba[_0xca57('0x60')],{})[_0xca57('0x24')](function(_0x55fc48){var _0x269b23=_0x59fbba[_0xca57('0x61')][_0xca57('0x62')]({'plain':!![]});if(!_0x269b23)throw new Error(_0xca57('0x63'));if(_0x269b23[_0xca57('0x64')]===_0xca57('0x61')){var _0x1ea989=_0x55fc48['get']({'plain':!![]});var _0x4574f9=_0xca57('0x3e');return db[_0xca57('0x65')][_0xca57('0x66')]({'where':{'name':_0x4574f9,'userProfileId':_0x269b23['userProfileId']},'raw':!![]})[_0xca57('0x24')](function(_0x678c6e){if(_0x678c6e&&_0x678c6e['autoAssociation']===0x0){return db[_0xca57('0x3f')][_0xca57('0x5f')]({'name':_0x1ea989[_0xca57('0x41')],'resourceId':_0x1ea989['id'],'type':_0x678c6e[_0xca57('0x41')],'sectionId':_0x678c6e['id']},{})[_0xca57('0x24')](function(){return _0x55fc48;});}else{return _0x55fc48;}})[_0xca57('0x5b')](function(_0x54489e){logger[_0xca57('0x2a')](_0xca57('0x67'),_0x54489e);throw _0x54489e;});}return _0x55fc48;})[_0xca57('0x24')](respondWithResult(_0x406509,0xc9))['catch'](handleError(_0x406509,null));};exports[_0xca57('0x3c')]=function(_0x3c4a19,_0x5ac31e){if(_0x3c4a19['body']['id']){delete _0x3c4a19['body']['id'];}return db['FaxAccount'][_0xca57('0x66')]({'where':{'id':_0x3c4a19[_0xca57('0x5d')]['id']},'include':[{'model':db[_0xca57('0x42')],'as':_0xca57('0x68')}]})[_0xca57('0x24')](handleEntityNotFound(_0x5ac31e,null))[_0xca57('0x24')](saveUpdates(_0x3c4a19[_0xca57('0x60')],null))[_0xca57('0x24')](respondWithResult(_0x5ac31e,null))[_0xca57('0x5b')](handleError(_0x5ac31e,null));};exports[_0xca57('0x3d')]=function(_0x26af65,_0x23a4ae){return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0x26af65['params']['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x23a4ae,null))['then'](removeEntity(_0x23a4ae,null))[_0xca57('0x5b')](handleError(_0x23a4ae,null));};exports[_0xca57('0x69')]=function(_0x31fcba,_0x50a639){return db[_0xca57('0x44')]['describe']()[_0xca57('0x24')](respondWithResult(_0x50a639,null))['catch'](handleError(_0x50a639,null));};exports[_0xca57('0x6a')]=function(_0xf4ff43,_0x384a0f,_0x26b968){if(_0xf4ff43[_0xca57('0x60')]['id']){delete _0xf4ff43[_0xca57('0x60')]['id'];}return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0xf4ff43[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x384a0f,null))[_0xca57('0x24')](function(_0x27f741){if(_0x27f741){_0xf4ff43[_0xca57('0x60')][_0xca57('0x6b')]=_0x27f741['id'];return db[_0xca57('0x6c')][_0xca57('0x5f')](_0xf4ff43[_0xca57('0x60')]);}})['then'](respondWithResult(_0x384a0f,null))['catch'](handleError(_0x384a0f,null));};exports['getDispositions']=function(_0x437fb5,_0x5a688f,_0x267c54){var _0x154bbd={'raw':![],'where':{}};var _0x242eed={};var _0x26a5b7={'count':0x0,'rows':[]};return db[_0xca57('0x44')]['findOne']({'where':{'id':_0x437fb5['params']['id']}})['then'](handleEntityNotFound(_0x5a688f,null))[_0xca57('0x24')](function(_0x4c13bd){if(_0x4c13bd){_0x242eed['model']=_[_0xca57('0x5e')](db[_0xca57('0x6c')][_0xca57('0x45')]);_0x242eed[_0xca57('0x48')]=_[_0xca57('0x5e')](_0x437fb5[_0xca57('0x48')]);_0x242eed[_0xca57('0x49')]=_['intersection'](_0x242eed[_0xca57('0x4c')],_0x242eed['query']);_0x154bbd[_0xca57('0x4a')]=_[_0xca57('0x4b')](_0x242eed[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x437fb5[_0xca57('0x48')][_0xca57('0x4d')]));_0x154bbd[_0xca57('0x4a')]=_0x154bbd['attributes'][_0xca57('0x4e')]?_0x154bbd[_0xca57('0x4a')]:_0x242eed[_0xca57('0x4c')];if(!_0x437fb5['query'][_0xca57('0x4f')](_0xca57('0x50'))){_0x154bbd[_0xca57('0x34')]=qs['limit'](_0x437fb5[_0xca57('0x48')]['limit']);_0x154bbd['offset']=qs[_0xca57('0x32')](_0x437fb5['query']['offset']);}_0x154bbd[_0xca57('0x51')]=qs[_0xca57('0x52')](_0x437fb5[_0xca57('0x48')][_0xca57('0x52')]);_0x154bbd[_0xca57('0x53')]=qs[_0xca57('0x49')](_[_0xca57('0x54')](_0x437fb5[_0xca57('0x48')],_0x242eed[_0xca57('0x49')]));_0x154bbd[_0xca57('0x53')]['FaxAccountId']=_0x4c13bd['id'];if(_0x437fb5[_0xca57('0x48')][_0xca57('0x57')]){_0x154bbd[_0xca57('0x53')]=_['merge'](_0x154bbd[_0xca57('0x53')],{'$or':_[_0xca57('0x43')](_0x154bbd[_0xca57('0x4a')],function(_0x244c45){var _0x2ead7f={};_0x2ead7f[_0x244c45]={'$like':'%'+_0x437fb5[_0xca57('0x48')][_0xca57('0x57')]+'%'};return _0x2ead7f;})});}_0x154bbd=_['merge']({},_0x154bbd,_0x437fb5[_0xca57('0x6d')]);return db[_0xca57('0x6c')][_0xca57('0x35')]({'where':_0x154bbd['where']})['then'](function(_0xbccf58){_0x26a5b7[_0xca57('0x35')]=_0xbccf58;if(_0x437fb5[_0xca57('0x48')][_0xca57('0x6e')]){_0x154bbd[_0xca57('0x58')]=[{'all':!![]}];}return db[_0xca57('0x6c')][_0xca57('0x59')](_0x154bbd);})[_0xca57('0x24')](function(_0x397d34){_0x26a5b7[_0xca57('0x5a')]=_0x397d34;return _0x26a5b7;});}})[_0xca57('0x24')](respondWithFilteredResult(_0x5a688f,_0x154bbd))['catch'](handleError(_0x5a688f,null));};exports[_0xca57('0x6f')]=function(_0x505eba,_0x501b71,_0x445583){return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0x505eba[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x501b71,null))[_0xca57('0x24')](function(_0x105187){if(_0x105187){return _0x105187['removeDispositions'](_0x505eba['query']['ids']);}})['then'](respondWithStatusCode(_0x501b71,null))[_0xca57('0x5b')](handleError(_0x501b71,null));};exports[_0xca57('0x70')]=function(_0x3a2e35,_0x2a1557,_0x4e0864){if(_0x3a2e35['body']['id']){delete _0x3a2e35['body']['id'];}return db[_0xca57('0x44')]['find']({'where':{'id':_0x3a2e35['params']['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x2a1557,null))[_0xca57('0x24')](function(_0x589ce8){if(_0x589ce8){_0x3a2e35['body'][_0xca57('0x6b')]=_0x589ce8['id'];return db[_0xca57('0x71')][_0xca57('0x5f')](_0x3a2e35['body']);}})['then'](respondWithResult(_0x2a1557,null))['catch'](handleError(_0x2a1557,null));};exports[_0xca57('0x72')]=function(_0x2e24bc,_0x4a77ce,_0x5d8445){var _0x5e21a5={'raw':![],'where':{}};var _0x319368={};var _0xc3e33={'count':0x0,'rows':[]};return db['FaxAccount'][_0xca57('0x73')]({'where':{'id':_0x2e24bc[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x4a77ce,null))['then'](function(_0x58b8ee){if(_0x58b8ee){_0x319368[_0xca57('0x4c')]=_[_0xca57('0x5e')](db[_0xca57('0x71')]['rawAttributes']);_0x319368['query']=_['keys'](_0x2e24bc[_0xca57('0x48')]);_0x319368['filters']=_['intersection'](_0x319368['model'],_0x319368[_0xca57('0x48')]);_0x5e21a5[_0xca57('0x4a')]=_['intersection'](_0x319368[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x2e24bc[_0xca57('0x48')][_0xca57('0x4d')]));_0x5e21a5[_0xca57('0x4a')]=_0x5e21a5[_0xca57('0x4a')][_0xca57('0x4e')]?_0x5e21a5[_0xca57('0x4a')]:_0x319368[_0xca57('0x4c')];if(!_0x2e24bc['query'][_0xca57('0x4f')]('nolimit')){_0x5e21a5['limit']=qs[_0xca57('0x34')](_0x2e24bc[_0xca57('0x48')]['limit']);_0x5e21a5[_0xca57('0x32')]=qs[_0xca57('0x32')](_0x2e24bc[_0xca57('0x48')][_0xca57('0x32')]);}_0x5e21a5[_0xca57('0x51')]=qs['sort'](_0x2e24bc['query'][_0xca57('0x52')]);_0x5e21a5['where']=qs[_0xca57('0x49')](_[_0xca57('0x54')](_0x2e24bc[_0xca57('0x48')],_0x319368[_0xca57('0x49')]));_0x5e21a5[_0xca57('0x53')][_0xca57('0x6b')]=_0x58b8ee['id'];if(_0x2e24bc[_0xca57('0x48')][_0xca57('0x57')]){_0x5e21a5[_0xca57('0x53')]=_['merge'](_0x5e21a5[_0xca57('0x53')],{'$or':_[_0xca57('0x43')](_0x5e21a5['attributes'],function(_0x274e67){var _0x224d01={};_0x224d01[_0x274e67]={'$like':'%'+_0x2e24bc[_0xca57('0x48')][_0xca57('0x57')]+'%'};return _0x224d01;})});}_0x5e21a5=_[_0xca57('0x55')]({},_0x5e21a5,_0x2e24bc[_0xca57('0x6d')]);return db[_0xca57('0x71')][_0xca57('0x35')]({'where':_0x5e21a5[_0xca57('0x53')]})[_0xca57('0x24')](function(_0x15d16b){_0xc3e33[_0xca57('0x35')]=_0x15d16b;if(_0x2e24bc[_0xca57('0x48')]['includeAll']){_0x5e21a5[_0xca57('0x58')]=[{'all':!![]}];}return db[_0xca57('0x71')][_0xca57('0x59')](_0x5e21a5);})[_0xca57('0x24')](function(_0x143266){_0xc3e33[_0xca57('0x5a')]=_0x143266;return _0xc3e33;});}})['then'](respondWithFilteredResult(_0x4a77ce,_0x5e21a5))[_0xca57('0x5b')](handleError(_0x4a77ce,null));};exports[_0xca57('0x74')]=function(_0x4173f1,_0x35846e,_0x5e5fe0){return db['FaxAccount']['find']({'where':{'id':_0x4173f1[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x35846e,null))[_0xca57('0x24')](function(_0x8ca2c){if(_0x8ca2c){return _0x8ca2c[_0xca57('0x74')](_0x4173f1[_0xca57('0x48')][_0xca57('0x75')]);}})[_0xca57('0x24')](respondWithStatusCode(_0x35846e,null))[_0xca57('0x5b')](handleError(_0x35846e,null));};exports[_0xca57('0x76')]=function(_0x13783a,_0x461ad9,_0x746e3){return db['FaxInteraction'][_0xca57('0x66')]({'where':{'id':_0x13783a['params']['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x461ad9,null))[_0xca57('0x24')](function(_0x205b84){if(_0x205b84){return _0x205b84[_0xca57('0x76')](_0x13783a[_0xca57('0x60')][_0xca57('0x75')],_[_0xca57('0x77')](_0x13783a[_0xca57('0x60')],[_0xca57('0x75'),'id'])||{});}})['then'](respondWithResult(_0x461ad9,null))[_0xca57('0x5b')](handleError(_0x461ad9,null));};exports[_0xca57('0x78')]=function(_0xd04a1,_0x4fd61a,_0x35d5d7){var _0x37c2e0={'raw':![],'where':{}};var _0x520eb9={};var _0x1b594d={'count':0x0,'rows':[]};return db[_0xca57('0x44')][_0xca57('0x73')]({'where':{'id':_0xd04a1[_0xca57('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4fd61a,null))[_0xca57('0x24')](function(_0x455465){if(_0x455465){_0x520eb9[_0xca57('0x4c')]=_[_0xca57('0x5e')](db[_0xca57('0x79')][_0xca57('0x45')]);_0x520eb9[_0xca57('0x48')]=_[_0xca57('0x5e')](_0xd04a1[_0xca57('0x48')]);_0x520eb9['filters']=_[_0xca57('0x4b')](_0x520eb9['model'],_0x520eb9[_0xca57('0x48')]);_0x37c2e0[_0xca57('0x4a')]=_[_0xca57('0x4b')](_0x520eb9[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0xd04a1['query'][_0xca57('0x4d')]));_0x37c2e0[_0xca57('0x4a')]=_0x37c2e0[_0xca57('0x4a')]['length']?_0x37c2e0[_0xca57('0x4a')]:_0x520eb9[_0xca57('0x4c')];if(!_0xd04a1[_0xca57('0x48')]['hasOwnProperty'](_0xca57('0x50'))){_0x37c2e0[_0xca57('0x34')]=qs[_0xca57('0x34')](_0xd04a1[_0xca57('0x48')]['limit']);_0x37c2e0[_0xca57('0x32')]=qs[_0xca57('0x32')](_0xd04a1[_0xca57('0x48')]['offset']);}_0x37c2e0[_0xca57('0x51')]=qs[_0xca57('0x52')](_0xd04a1[_0xca57('0x48')][_0xca57('0x52')]);_0x37c2e0[_0xca57('0x53')]=qs[_0xca57('0x49')](_['pick'](_0xd04a1[_0xca57('0x48')],_0x520eb9[_0xca57('0x49')]));_0x37c2e0[_0xca57('0x53')]['FaxAccountId']=_0x455465['id'];if(_0xd04a1['query'][_0xca57('0x57')]){_0x37c2e0['where']=_['merge'](_0x37c2e0[_0xca57('0x53')],{'$or':_[_0xca57('0x43')](_0x37c2e0[_0xca57('0x4a')],function(_0x12dd00){var _0x3f4898={};_0x3f4898[_0x12dd00]={'$like':'%'+_0xd04a1['query'][_0xca57('0x57')]+'%'};return _0x3f4898;})});}_0x37c2e0=_['merge']({},_0x37c2e0,_0xd04a1['options']);return db[_0xca57('0x79')]['count']({'where':_0x37c2e0[_0xca57('0x53')]})[_0xca57('0x24')](function(_0x750b98){_0x1b594d[_0xca57('0x35')]=_0x750b98;if(_0xd04a1[_0xca57('0x48')][_0xca57('0x6e')]){_0x37c2e0[_0xca57('0x58')]=[{'model':db[_0xca57('0x7a')],'as':_0xca57('0x7b'),'required':![]},{'model':db[_0xca57('0x7c')],'as':_0xca57('0x7d'),'attributes':[_0xca57('0x41'),'fullname',_0xca57('0x7e')],'required':![]},{'model':db[_0xca57('0x7f')],'as':'Tags','attributes':['id',_0xca57('0x41'),_0xca57('0x80')],'where':_0xd04a1[_0xca57('0x48')][_0xca57('0x81')]?{'id':_0xd04a1[_0xca57('0x48')][_0xca57('0x81')]}:undefined,'required':_0xd04a1['query'][_0xca57('0x81')]?!![]:![]}];}return db[_0xca57('0x79')][_0xca57('0x59')](_0x37c2e0);})[_0xca57('0x24')](function(_0x1a2fdc){_0x1b594d[_0xca57('0x5a')]=_0x1a2fdc;return _0x1b594d;});}})['then'](respondWithFilteredResult(_0x4fd61a,_0x37c2e0))[_0xca57('0x5b')](handleError(_0x4fd61a,null));};exports[_0xca57('0x82')]=function(_0x317127,_0x4a0a09){var _0x496459=_0x317127['params']['id'];var _0x47d55c=_0x317127[_0xca57('0x60')];var _0x25f7f0=0xc8;var _0x1cf5ae=null;return db[_0xca57('0x83')][_0xca57('0x84')]({'isolationLevel':db[_0xca57('0x83')][_0xca57('0x85')][_0xca57('0x86')][_0xca57('0x87')]},function(_0x32477b){return db[_0xca57('0x44')][_0xca57('0x73')]({'where':{'id':_0x496459},'transaction':_0x32477b})['then'](function(_0x5a424){if(_0x5a424){return db[_0xca57('0x88')][_0xca57('0x3d')]({'where':{'FaxAccountId':_0x496459},'transaction':_0x32477b})[_0xca57('0x24')](function(){var _0x498f29=_[_0xca57('0x43')](_0x47d55c,function(_0x23f567){_0x23f567[_0xca57('0x6b')]=_0x496459;return _0x23f567;});return db[_0xca57('0x88')]['bulkCreate'](_0x498f29,{'transaction':_0x32477b});});}else{_0x25f7f0=0x194;_0x1cf5ae=[];}});})['then'](function(){if(_0x25f7f0!==0x194){return db[_0xca57('0x88')][_0xca57('0x89')]({'where':{'FaxAccountId':_0x496459},'order':_0xca57('0x8a')})[_0xca57('0x24')](function(_0x1f0101){_0x1cf5ae=_0x1f0101;});}})['catch'](function(_0x567353){_0x25f7f0=0x1f4;logger[_0xca57('0x2a')](_0x567353['stack']);if(_0x567353['name']){delete _0x567353[_0xca57('0x41')];}_0x1cf5ae=_0x567353;})[_0xca57('0x8b')](function(){if(_0x1cf5ae===null){_0x4a0a09[_0xca57('0x2f')](_0x25f7f0);}else{if(_0x25f7f0===0x1f4){_0x4a0a09['status'](_0x25f7f0)[_0xca57('0x8c')](_0x1cf5ae);}else{_0x4a0a09[_0xca57('0x31')](_0x25f7f0)['json'](_0x1cf5ae);}}});};exports[_0xca57('0x8d')]=function(_0x29698c,_0x2fb1d0,_0x2e5f38){var _0x54f3da={};var _0xc79e7c={};var _0x1a0631;var _0x44b47c;return db[_0xca57('0x44')][_0xca57('0x73')]({'where':{'id':_0x29698c['params']['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x2fb1d0,null))[_0xca57('0x24')](function(_0x4ed0ac){if(_0x4ed0ac){_0x1a0631=_0x4ed0ac;_0xc79e7c['model']=_[_0xca57('0x5e')](db[_0xca57('0x88')][_0xca57('0x45')]);_0xc79e7c[_0xca57('0x48')]=_[_0xca57('0x5e')](_0x29698c['query']);_0xc79e7c[_0xca57('0x49')]=_[_0xca57('0x4b')](_0xc79e7c['model'],_0xc79e7c['query']);_0x54f3da['attributes']=_[_0xca57('0x4b')](_0xc79e7c[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x29698c[_0xca57('0x48')]['fields']));_0x54f3da['attributes']=_0x54f3da[_0xca57('0x4a')][_0xca57('0x4e')]?_0x54f3da[_0xca57('0x4a')]:_0xc79e7c[_0xca57('0x4c')];_0x54f3da[_0xca57('0x51')]=qs['sort'](_0x29698c['query']['sort']);_0x54f3da[_0xca57('0x53')]=qs[_0xca57('0x49')](_['pick'](_0x29698c[_0xca57('0x48')],_0xc79e7c[_0xca57('0x49')]));if(_0x29698c[_0xca57('0x48')][_0xca57('0x57')]){_0x54f3da[_0xca57('0x53')]=_[_0xca57('0x55')](_0x54f3da[_0xca57('0x53')],{'$or':_[_0xca57('0x43')](_0x54f3da[_0xca57('0x4a')],function(_0x1435cf){var _0x4bf839={};_0x4bf839[_0x1435cf]={'$like':'%'+_0x29698c[_0xca57('0x48')][_0xca57('0x57')]+'%'};return _0x4bf839;})});}_0x54f3da=_[_0xca57('0x55')]({},_0x54f3da,_0x29698c['options']);return _0x1a0631[_0xca57('0x8d')](_0x54f3da);}})[_0xca57('0x24')](function(_0x2fb998){if(_0x2fb998){_0x44b47c=_0x2fb998[_0xca57('0x4e')];if(!_0x29698c[_0xca57('0x48')][_0xca57('0x4f')](_0xca57('0x50'))){_0x54f3da[_0xca57('0x34')]=qs['limit'](_0x29698c[_0xca57('0x48')][_0xca57('0x34')]);_0x54f3da[_0xca57('0x32')]=qs[_0xca57('0x32')](_0x29698c['query'][_0xca57('0x32')]);}return _0x1a0631[_0xca57('0x8d')](_0x54f3da);}})[_0xca57('0x24')](function(_0x4e7a96){if(_0x4e7a96){return _0x4e7a96?{'count':_0x44b47c,'rows':_0x4e7a96}:null;}})[_0xca57('0x24')](respondWithResult(_0x2fb1d0,null))[_0xca57('0x5b')](handleError(_0x2fb1d0,null));};function Extension(_0xb9a020,_0x47a3de,_0x1ca9a4,_0x1a3c09){this['context']=_0xca57('0x8e');this['exten']=_0xb9a020[_0xca57('0x8f')];this[_0xca57('0x90')]=_0x1a3c09;this[_0xca57('0x46')]='system';this[_0xca57('0x91')]=_0xca57('0x92');this[_0xca57('0x6b')]=_0xb9a020['id'];this[_0xca57('0x8a')]=_0x47a3de;this['appdata']=_0x1ca9a4;}function createExtensionsReciveFax(_0x5539fe){var _0x59d292=0x1;var _0x38f8fc=[];_0x38f8fc['push'](new Extension(_0x5539fe,_0x59d292,'',_0xca57('0x93')));_0x59d292+=0x1;_0x38f8fc[_0xca57('0x94')](new Extension(_0x5539fe,_0x59d292,_0xca57('0x95'),_0xca57('0x96')));_0x59d292+=0x1;for(var _0x2ddf94 in _0x5539fe){if(_0x5539fe[_0xca57('0x4f')](_0x2ddf94)&&(_0x2ddf94==='ecm'||_0x2ddf94===_0xca57('0x8f')||_0x2ddf94===_0xca57('0x97')||_0x2ddf94==='faxdetect'||_0x2ddf94==='headerinfo'||_0x2ddf94===_0xca57('0x98')||_0x2ddf94==='minrate'||_0x2ddf94===_0xca57('0x99')||_0x2ddf94==='t38timeout')){_0x38f8fc[_0xca57('0x94')](new Extension(_0x5539fe,_0x59d292,'FAXOPT('+_0x2ddf94+')='+_0x5539fe[_0x2ddf94],'Set'));_0x59d292+=0x1;}}_0x38f8fc[_0xca57('0x94')](new Extension(_0x5539fe,_0x59d292,'6',_0xca57('0x9a')));_0x59d292+=0x1;_0x38f8fc[_0xca57('0x94')](new Extension(_0x5539fe,_0x59d292,_0xca57('0x9b'),_0xca57('0x9c')));_0x59d292=0x0;return _0x38f8fc;}exports[_0xca57('0x9d')]=function(_0x2da315,_0x55f041,_0x4e5511){var _0x54d603;return db[_0xca57('0x83')]['transaction'](function(_0x59ea66){return db[_0xca57('0x44')][_0xca57('0x5f')](_0x2da315[_0xca57('0x60')],{'transaction':_0x59ea66})[_0xca57('0x24')](function(_0x2fd705){_0x54d603=_0x2fd705[_0xca57('0x62')]({'plain':!![]});return db[_0xca57('0x9e')][_0xca57('0x9f')](createExtensionsReciveFax(_0x54d603),{'transaction':_0x59ea66});});})['then'](function(){return _0x54d603;})['then'](respondWithResult(_0x55f041,null))[_0xca57('0x5b')](handleError(_0x55f041,null));};exports[_0xca57('0xa0')]=function(_0x18bf42,_0x5cac06,_0x4e7575){var _0x21d158;return db[_0xca57('0x83')][_0xca57('0x84')](function(_0x4d0f8d){return db[_0xca57('0x44')][_0xca57('0x3c')](_0x18bf42[_0xca57('0x60')],{'where':{'id':_0x18bf42['body']['id']},'transaction':_0x4d0f8d})[_0xca57('0x24')](function(_0xa57ff){return db[_0xca57('0x9e')][_0xca57('0x3d')]({'where':{'FaxAccountId':_0x18bf42[_0xca57('0x60')]['id']},'transaction':_0x4d0f8d})['then'](function(_0x3a002d){return db[_0xca57('0x9e')][_0xca57('0x9f')](createExtensionsReciveFax(_[_0xca57('0x77')](_0x18bf42['body'],['tech',_0xca57('0x47'),_0xca57('0xa1'),_0xca57('0xa2'),'TrunkId',_0xca57('0xa3')])),{'transaction':_0x4d0f8d});});});})[_0xca57('0x24')](function(){return db[_0xca57('0x44')][_0xca57('0xa4')](_0x18bf42[_0xca57('0x60')]['id']);})[_0xca57('0x24')](respondWithResult(_0x5cac06,null))[_0xca57('0x5b')](handleError(_0x5cac06,null));};exports[_0xca57('0xa5')]=function(_0x413fa0,_0x579484,_0x5e8b59){var _0x23e18b={'raw':!![],'where':{}};var _0x23d95c={};var _0x4dc771={'count':0x0,'rows':[]};return db[_0xca57('0x44')][_0xca57('0x73')]({'where':{'id':_0x413fa0[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x579484,null))[_0xca57('0x24')](function(_0x26c449){if(_0x26c449){_0x23d95c['model']=_[_0xca57('0x5e')](db[_0xca57('0xa6')][_0xca57('0x45')]);_0x23d95c[_0xca57('0x48')]=_[_0xca57('0x5e')](_0x413fa0[_0xca57('0x48')]);_0x23d95c[_0xca57('0x49')]=_['intersection'](_0x23d95c[_0xca57('0x4c')],_0x23d95c[_0xca57('0x48')]);_0x23e18b[_0xca57('0x4a')]=_[_0xca57('0x4b')](_0x23d95c[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x413fa0['query'][_0xca57('0x4d')]));_0x23e18b['attributes']=_0x23e18b[_0xca57('0x4a')]['length']?_0x23e18b[_0xca57('0x4a')]:_0x23d95c[_0xca57('0x4c')];if(!_0x413fa0[_0xca57('0x48')][_0xca57('0x4f')](_0xca57('0x50'))){_0x23e18b[_0xca57('0x34')]=qs[_0xca57('0x34')](_0x413fa0[_0xca57('0x48')]['limit']);_0x23e18b[_0xca57('0x32')]=qs[_0xca57('0x32')](_0x413fa0[_0xca57('0x48')][_0xca57('0x32')]);}_0x23e18b[_0xca57('0x51')]=qs[_0xca57('0x52')](_0x413fa0[_0xca57('0x48')]['sort']);_0x23e18b[_0xca57('0x53')]=qs[_0xca57('0x49')](_['pick'](_0x413fa0[_0xca57('0x48')],_0x23d95c[_0xca57('0x49')]));_0x23e18b[_0xca57('0x53')]['FaxAccountId']=_0x26c449['id'];if(_0x413fa0[_0xca57('0x48')][_0xca57('0x57')]){_0x23e18b[_0xca57('0x53')]=_[_0xca57('0x55')](_0x23e18b['where'],{'$or':_['map'](_0x23e18b['attributes'],function(_0x448373){var _0x502915={};_0x502915[_0x448373]={'$like':'%'+_0x413fa0[_0xca57('0x48')]['filter']+'%'};return _0x502915;})});}if(_0x413fa0['query'][_0xca57('0xa7')]){var _0x4a4e93=_0x413fa0[_0xca57('0x48')][_0xca57('0xa7')][_0xca57('0xa8')](',');var _0x508c8b={};_0x508c8b[_0x4a4e93[0x0]]={'$gte':moment(_0x4a4e93[0x1])[_0xca57('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23e18b['where']=_[_0xca57('0x55')](_0x23e18b[_0xca57('0x53')],_0x508c8b);}_0x23e18b=_[_0xca57('0x55')]({},_0x23e18b,_0x413fa0[_0xca57('0x6d')]);return db['FaxMessage']['count']({'where':_0x23e18b[_0xca57('0x53')]})[_0xca57('0x24')](function(_0x2e4df9){_0x4dc771[_0xca57('0x35')]=_0x2e4df9;if(_0x413fa0['query']['includeAll']){_0x23e18b[_0xca57('0x58')]=[{'all':!![]}];}return db[_0xca57('0xa6')]['findAll'](_0x23e18b);})[_0xca57('0x24')](function(_0x4aa2cc){_0x4dc771['rows']=_0x4aa2cc;return _0x4dc771;});}})[_0xca57('0x24')](respondWithFilteredResult(_0x579484,_0x23e18b))[_0xca57('0x5b')](handleError(_0x579484,null));};exports['send']=function(_0x363e01,_0x300df1,_0x540866){var _0xd25082,_0x5d755a={},_0x3e2401;if(_0x363e01[_0xca57('0x60')]['to']){_0x3e2401=_0x363e01[_0xca57('0x60')]['to'][0x0];}return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0x363e01[_0xca57('0x5d')]['id']},'include':[{'model':db[_0xca57('0xaa')],'as':_0xca57('0xab'),'include':[{'model':db['CmContact'],'as':_0xca57('0xac'),'where':{'fax':_0x3e2401},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xca57('0x24')](handleEntityNotFound(_0x300df1,null))[_0xca57('0x24')](function(_0x34e227){_0xd25082=_0x34e227;if(_0x363e01[_0xca57('0x60')][_0xca57('0xad')]&&_0x363e01[_0xca57('0x60')][_0xca57('0xad')]['length']){for(var _0xe5e064=0x0;_0xe5e064<_0x363e01[_0xca57('0x60')][_0xca57('0xad')]['length'];_0xe5e064+=0x1){_0x363e01['body'][_0xca57('0xad')][_0xe5e064]={'filename':_0x363e01[_0xca57('0x60')]['attachments'][_0xe5e064][_0xca57('0x41')],'id':_0x363e01[_0xca57('0x60')][_0xca57('0xad')][_0xe5e064]['id'],'path':path[_0xca57('0xae')](config[_0xca57('0xaf')],_0xca57('0xb0'),_0x363e01[_0xca57('0x60')][_0xca57('0xad')][_0xe5e064][_0xca57('0xb1')])};}}return respondWithRpcPromise(_0xca57('0xb2'),_0xca57('0xb2'),{'FaxAccountId':_[_0xca57('0xb3')](_0x363e01[_0xca57('0x5d')]['id'])?undefined:_0x363e01[_0xca57('0x5d')]['id'],'path':_[_0xca57('0xb3')](_0x363e01[_0xca57('0x60')][_0xca57('0xad')][0x0]['path'])?undefined:_0x363e01[_0xca57('0x60')][_0xca57('0xad')][0x0][_0xca57('0x9')],'fax':_[_0xca57('0xb3')](_0x363e01[_0xca57('0x60')]['to'][0x0])?undefined:_0x363e01['body']['to'][0x0]},client9002);})[_0xca57('0x24')](function(){if(_0xd25082){if(_[_0xca57('0xb3')](_0x363e01[_0xca57('0x60')]['from'])){_0x363e01[_0xca57('0x60')][_0xca57('0xb4')]=util['format'](_0xca57('0xb5'),_0xd25082['name'],_0xd25082[_0xca57('0xb6')]);}if(_0xd25082[_0xca57('0xab')]){if(_0xd25082[_0xca57('0xab')]['Contacts']['length']){return _0xd25082[_0xca57('0xab')][_0xca57('0xac')][0x0];}else{return db[_0xca57('0x7a')][_0xca57('0x5f')](_[_0xca57('0x1f')](_0x363e01['body'],{'firstName':_0x363e01[_0xca57('0x60')]['to'][0x0],'phone':_0x363e01['body']['to'][0x0],'fax':_0x363e01['body']['to'][0x0],'ListId':_0xd25082['ListId']}));}}else{throw new Error(_0xca57('0xb7'));}}else{throw new Error(_0xca57('0xb8'));}})[_0xca57('0x24')](function(_0x4bc71b){if(_0x4bc71b){return db[_0xca57('0x79')]['find']({'where':{'ContactId':_0x4bc71b['id'],'closed':![],'FaxAccountId':_0xd25082['id']}})[_0xca57('0x24')](function(_0x469f7d){if(_0x469f7d){return[_0x469f7d,![]];}return db[_0xca57('0x79')]['create']({'UserId':_0x363e01[_0xca57('0x61')]['id'],'ContactId':_0x4bc71b['id'],'FaxAccountId':_0xd25082['id'],'fax':_0x363e01[_0xca57('0x60')]['to'][0x0],'firstMsgDirection':_0xca57('0xb9'),'Messages':[_[_0xca57('0x55')](_0x363e01[_0xca57('0x60')],{'read':![],'body':_0x363e01[_0xca57('0x60')][_0xca57('0xad')][0x0][_0xca57('0xba')],'FaxAccountId':_0xd25082['id'],'UserId':_0x363e01[_0xca57('0x61')]['id'],'ContactId':_0x4bc71b['id'],'AttachmentId':_0x363e01['body'][_0xca57('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xca57('0xa6')],'as':'Messages'}]})[_0xca57('0x24')](function(_0x2fe004){return[_0x2fe004,!![]];});});}else{throw new Error(_0xca57('0xbb'));}})['spread'](function(_0xbfff3f,_0x2dcc41){if(_0x2dcc41){return _0xbfff3f;}return db[_0xca57('0xa6')][_0xca57('0x5f')]({'direction':_0xca57('0xb9'),'read':![],'body':_0x363e01[_0xca57('0x60')]['attachments'][0x0][_0xca57('0xba')],'FaxAccountId':_0xd25082['id'],'FaxInteractionId':_0xbfff3f['id'],'UserId':_0x363e01['user']['id'],'ContactId':_0xbfff3f[_0xca57('0xbc')],'AttachmentId':_0x363e01[_0xca57('0x60')][_0xca57('0xad')][0x0]['id']})[_0xca57('0x24')](function(_0x514fe9){_0xbfff3f[_0xca57('0xbd')]['Messages']=[];_0xbfff3f[_0xca57('0xbd')]['Messages'][_0xca57('0x94')](_0x514fe9[_0xca57('0xbd')]);return _0xbfff3f;});})[_0xca57('0x24')](function(_0x16a58b){respondWithRpcPromise('SendFax',_0xca57('0xbe'),{'FaxAccountId':_['isNil'](_0x363e01[_0xca57('0x5d')]['id'])?undefined:_0x363e01[_0xca57('0x5d')]['id'],'path':_[_0xca57('0xb3')](_0x363e01[_0xca57('0x60')][_0xca57('0xad')][0x0][_0xca57('0x9')])?undefined:_0x363e01['body'][_0xca57('0xad')][0x0][_0xca57('0x9')],'fax':_[_0xca57('0xb3')](_0x363e01['body']['to'][0x0])?undefined:_0x363e01['body']['to'][0x0],'AttachmentId':_0x363e01['body']['attachments'][0x0]['id']},client9002)[_0xca57('0x24')](function(_0x2b73fa){logger['info']('SendFaxRpc,\x20%s',_0x2b73fa);})[_0xca57('0x5b')](function(_0x251dac){logger[_0xca57('0x2d')](_0xca57('0xbf'),_0x251dac);});return _0x16a58b;})[_0xca57('0x24')](respondWithResult(_0x300df1,null))[_0xca57('0x5b')](handleError(_0x300df1,null));};exports[_0xca57('0xc0')]=function(_0x2fccd0,_0x503f4c,_0x2a4a7d){return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0x2fccd0[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x503f4c,null))['then'](function(_0x38fdd7){if(_0x38fdd7){return _0x38fdd7['addAgents'](_0x2fccd0['body'][_0xca57('0x75')],_[_0xca57('0x77')](_0x2fccd0[_0xca57('0x60')],[_0xca57('0x75'),'id'])||{})[_0xca57('0xc1')](function(_0xff7656){for(var _0x58567e=0x0;_0x58567e<_0x2fccd0[_0xca57('0x60')][_0xca57('0x75')]['length'];_0x58567e+=0x1){socket[_0xca57('0xc2')](_0xca57('0xc3'),{'UserId':Number(_0x2fccd0['body']['ids'][_0x58567e]),'FaxAccountId':Number(_0x2fccd0['params']['id'])});}return _0xff7656;});}})['then'](respondWithResult(_0x503f4c,null))[_0xca57('0x5b')](handleError(_0x503f4c,null));};exports[_0xca57('0xc4')]=function(_0x3dbff9,_0x328de7,_0x576116){return db[_0xca57('0x44')][_0xca57('0x66')]({'where':{'id':_0x3dbff9[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x328de7,null))[_0xca57('0x24')](function(_0x44ba4a){if(_0x44ba4a){return _0x44ba4a[_0xca57('0xc4')](_0x3dbff9[_0xca57('0x48')][_0xca57('0x75')])[_0xca57('0x24')](function(){if(_[_0xca57('0xc5')](_0x3dbff9['query'][_0xca57('0x75')])){for(var _0x6ed36a=0x0;_0x6ed36a<_0x3dbff9[_0xca57('0x48')][_0xca57('0x75')][_0xca57('0x4e')];_0x6ed36a+=0x1){socket[_0xca57('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x3dbff9[_0xca57('0x48')]['ids'][_0x6ed36a]),'FaxAccountId':Number(_0x3dbff9[_0xca57('0x5d')]['id'])});}}else{socket['emit'](_0xca57('0xc6'),{'UserId':Number(_0x3dbff9['query'][_0xca57('0x75')]),'FaxAccountId':Number(_0x3dbff9['params']['id'])});}});}})[_0xca57('0x24')](respondWithStatusCode(_0x328de7,null))[_0xca57('0x5b')](handleError(_0x328de7,null));};exports[_0xca57('0xc7')]=function(_0x2a52f6,_0x5d7925,_0x425069){var _0x3b9009={};var _0x9a0f2f={};var _0x5474ea;var _0x13ebee;return db[_0xca57('0x44')]['findOne']({'where':{'id':_0x2a52f6[_0xca57('0x5d')]['id']}})[_0xca57('0x24')](handleEntityNotFound(_0x5d7925,null))[_0xca57('0x24')](function(_0x47c290){if(_0x47c290){_0x5474ea=_0x47c290;_0x9a0f2f['model']=_[_0xca57('0x5e')](db['User'][_0xca57('0x45')]);_0x9a0f2f[_0xca57('0x48')]=_[_0xca57('0x5e')](_0x2a52f6[_0xca57('0x48')]);_0x9a0f2f[_0xca57('0x49')]=_['intersection'](_0x9a0f2f[_0xca57('0x4c')],_0x9a0f2f[_0xca57('0x48')]);_0x3b9009[_0xca57('0x4a')]=_['intersection'](_0x9a0f2f[_0xca57('0x4c')],qs[_0xca57('0x4d')](_0x2a52f6[_0xca57('0x48')][_0xca57('0x4d')]));_0x3b9009['attributes']=_0x3b9009[_0xca57('0x4a')][_0xca57('0x4e')]?_0x3b9009[_0xca57('0x4a')]:_0x9a0f2f[_0xca57('0x4c')];_0x3b9009[_0xca57('0x51')]=qs[_0xca57('0x52')](_0x2a52f6[_0xca57('0x48')][_0xca57('0x52')]);_0x3b9009[_0xca57('0x53')]=qs[_0xca57('0x49')](_[_0xca57('0x54')](_0x2a52f6[_0xca57('0x48')],_0x9a0f2f[_0xca57('0x49')]));if(_0x2a52f6[_0xca57('0x48')][_0xca57('0x57')]){_0x3b9009['where']=_[_0xca57('0x55')](_0x3b9009[_0xca57('0x53')],{'$or':_[_0xca57('0x43')](_0x3b9009[_0xca57('0x4a')],function(_0x2ccb3b){var _0xb9bbda={};_0xb9bbda[_0x2ccb3b]={'$like':'%'+_0x2a52f6[_0xca57('0x48')][_0xca57('0x57')]+'%'};return _0xb9bbda;})});}_0x3b9009=_[_0xca57('0x55')]({},_0x3b9009,_0x2a52f6[_0xca57('0x6d')]);return _0x5474ea['getAgents'](_0x3b9009);}})['then'](function(_0x307a58){if(_0x307a58){_0x13ebee=_0x307a58[_0xca57('0x4e')];if(!_0x2a52f6['query']['hasOwnProperty'](_0xca57('0x50'))){_0x3b9009[_0xca57('0x34')]=qs['limit'](_0x2a52f6[_0xca57('0x48')]['limit']);_0x3b9009[_0xca57('0x32')]=qs[_0xca57('0x32')](_0x2a52f6['query'][_0xca57('0x32')]);}return _0x5474ea[_0xca57('0xc7')](_0x3b9009);}})['then'](function(_0x724bfb){if(_0x724bfb){return _0x724bfb?{'count':_0x13ebee,'rows':_0x724bfb}:null;}})[_0xca57('0x24')](respondWithResult(_0x5d7925,null))[_0xca57('0x5b')](handleError(_0x5d7925,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5d87c6b..1edacb3 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 _0x63a6=['save','update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x5adb18,_0x222326){var _0x420c98=function(_0x146b7b){while(--_0x146b7b){_0x5adb18['push'](_0x5adb18['shift']());}};_0x420c98(++_0x222326);}(_0x63a6,0x12e));var _0x663a=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x63a6[_0x258fb0];return _0x4d1afe;};'use strict';var EventEmitter=require(_0x663a('0x0'));var FaxAccount=require(_0x663a('0x1'))['db'][_0x663a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x663a('0x3')](0x0);var events={'afterCreate':_0x663a('0x4'),'afterUpdate':_0x663a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48b9c2){return function(_0x21b93a,_0x311614,_0x1b065d){FaxAccountEvents[_0x663a('0x6')](_0x48b9c2+':'+_0x21b93a['id'],_0x21b93a);FaxAccountEvents[_0x663a('0x6')](_0x48b9c2,_0x21b93a);_0x1b065d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x663a('0x7')](e,emitEvent(event));}}module[_0x663a('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x0b00=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x3657f1,_0x26fcfb){var _0x66b891=function(_0x319f1a){while(--_0x319f1a){_0x3657f1['push'](_0x3657f1['shift']());}};_0x66b891(++_0x26fcfb);}(_0x0b00,0x1d5));var _0x00b0=function(_0x4c96ff,_0x10d8b6){_0x4c96ff=_0x4c96ff-0x0;var _0x52c324=_0x0b00[_0x4c96ff];return _0x52c324;};'use strict';var EventEmitter=require(_0x00b0('0x0'));var FaxAccount=require(_0x00b0('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00b0('0x2'),'afterUpdate':'update','afterDestroy':_0x00b0('0x3')};function emitEvent(_0x56c699){return function(_0x1d6117,_0xac4022,_0x1a09b0){FaxAccountEvents[_0x00b0('0x4')](_0x56c699+':'+_0x1d6117['id'],_0x1d6117);FaxAccountEvents[_0x00b0('0x4')](_0x56c699,_0x1d6117);_0x1a09b0(null);};}for(var e in events){if(events[_0x00b0('0x5')](e)){var event=events[e];FaxAccount[_0x00b0('0x6')](e,emitEvent(event));}}module[_0x00b0('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c295fc4..919a429 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 _0x00d3=['exports','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00d3,0x108));var _0x300d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x00d3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x300d('0x0'));var util=require(_0x300d('0x1'));var logger=require('../../config/logger')(_0x300d('0x2'));var moment=require(_0x300d('0x3'));var BPromise=require(_0x300d('0x4'));var rp=require(_0x300d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x300d('0x6'));var config=require(_0x300d('0x7'));var attributes=require(_0x300d('0x8'));module[_0x300d('0x9')]=function(_0x5c005f,_0x5d09a6){return _0x5c005f[_0x300d('0xa')](_0x300d('0xb'),attributes,{'tableName':_0x300d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eda=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x41f192,_0x2a41b){var _0x39b685=function(_0x299fd4){while(--_0x299fd4){_0x41f192['push'](_0x41f192['shift']());}};_0x39b685(++_0x2a41b);}(_0x3eda,0xca));var _0xa3ed=function(_0x53e156,_0xa27f9c){_0x53e156=_0x53e156-0x0;var _0x28ee0f=_0x3eda[_0x53e156];return _0x28ee0f;};'use strict';var _=require(_0xa3ed('0x0'));var util=require(_0xa3ed('0x1'));var logger=require(_0xa3ed('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa3ed('0x3'));var rp=require(_0xa3ed('0x4'));var fs=require('fs');var path=require(_0xa3ed('0x5'));var rimraf=require('rimraf');var config=require(_0xa3ed('0x6'));var attributes=require('./faxAccount.attributes');module[_0xa3ed('0x7')]=function(_0xe9bd88,_0x26df1a){return _0xe9bd88[_0xa3ed('0x8')](_0xa3ed('0x9'),attributes,{'tableName':_0xa3ed('0xa'),'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 51fbaac..b73b54c 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 _0xae8c=['client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','FaxAccount','options','where','attributes','include','model','map','then','GetFaxAccount','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','CmContact','Contacts','FaxApplication','Applications','List','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','spread','get','autoclose','push','unmanaged','created','FaxMessage','AttachmentId','interaction','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1d690c,_0x23db8b){var _0xe09ec=function(_0x3d5364){while(--_0x3d5364){_0x1d690c['push'](_0x1d690c['shift']());}};_0xe09ec(++_0x23db8b);}(_0xae8c,0x102));var _0xcae8=function(_0x23fd5f,_0x18f835){_0x23fd5f=_0x23fd5f-0x0;var _0x5ccab0=_0xae8c[_0x23fd5f];return _0x5ccab0;};'use strict';var _=require(_0xcae8('0x0'));var util=require('util');var moment=require(_0xcae8('0x1'));var BPromise=require('bluebird');var rs=require(_0xcae8('0x2'));var fs=require('fs');var Redis=require(_0xcae8('0x3'));var db=require(_0xcae8('0x4'))['db'];var utils=require(_0xcae8('0x5'));var logger=require(_0xcae8('0x6'))(_0xcae8('0x7'));var config=require('../../config/environment');var jayson=require(_0xcae8('0x8'));var client=jayson[_0xcae8('0x9')][_0xcae8('0xa')]({'port':0x232c});config[_0xcae8('0xb')]=_[_0xcae8('0xc')](config[_0xcae8('0xb')],{'host':_0xcae8('0xd'),'port':0x18eb});var socket=require(_0xcae8('0xe'))(new Redis(config[_0xcae8('0xb')]));require(_0xcae8('0xf'))[_0xcae8('0x10')](socket);function respondWithRpcPromise(_0x64848e,_0x192e59,_0xcbb496){return new BPromise(function(_0xbc1750,_0x33c75b){return client[_0xcae8('0x11')](_0x64848e,_0xcbb496)['then'](function(_0x4fd1a4){logger[_0xcae8('0x12')](_0xcae8('0x13'),_0x192e59,_0xcae8('0x14'));logger[_0xcae8('0x15')](_0xcae8('0x16'),_0x192e59,_0xcae8('0x14'),JSON[_0xcae8('0x17')](_0x4fd1a4));if(_0x4fd1a4['error']){if(_0x4fd1a4['error'][_0xcae8('0x18')]===0x1f4){logger['error'](_0xcae8('0x13'),_0x192e59,_0x4fd1a4[_0xcae8('0x19')]['message']);return _0x33c75b(_0x4fd1a4['error']['message']);}logger['error'](_0xcae8('0x13'),_0x192e59,_0x4fd1a4[_0xcae8('0x19')]['message']);return _0xbc1750(_0x4fd1a4[_0xcae8('0x19')][_0xcae8('0x1a')]);}else{logger[_0xcae8('0x12')](_0xcae8('0x13'),_0x192e59,'request\x20sent');_0xbc1750(_0x4fd1a4[_0xcae8('0x1b')][_0xcae8('0x1a')]);}})[_0xcae8('0x1c')](function(_0x311488){logger['error'](_0xcae8('0x13'),_0x192e59,_0x311488);_0x33c75b(_0x311488);});});}exports['GetFaxAccount']=function(_0x368a4d){var _0x16e169=this;return new Promise(function(_0x54f514,_0x17aeb0){return db[_0xcae8('0x1d')]['findAll']({'raw':_0x368a4d[_0xcae8('0x1e')]?_0x368a4d[_0xcae8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x368a4d[_0xcae8('0x1e')]?_0x368a4d[_0xcae8('0x1e')][_0xcae8('0x1f')]||null:null,'attributes':_0x368a4d[_0xcae8('0x1e')]?_0x368a4d[_0xcae8('0x1e')][_0xcae8('0x20')]||null:null,'limit':_0x368a4d[_0xcae8('0x1e')]?_0x368a4d[_0xcae8('0x1e')]['limit']||null:null,'include':_0x368a4d[_0xcae8('0x1e')]?_0x368a4d['options'][_0xcae8('0x21')]?_['map'](_0x368a4d['options'][_0xcae8('0x21')],function(_0x57cf7a){return{'model':db[_0x57cf7a[_0xcae8('0x22')]],'as':_0x57cf7a['as'],'attributes':_0x57cf7a[_0xcae8('0x20')],'include':_0x57cf7a['include']?_[_0xcae8('0x23')](_0x57cf7a['include'],function(_0x1f55e2){return{'model':db[_0x1f55e2['model']],'as':_0x1f55e2['as'],'attributes':_0x1f55e2[_0xcae8('0x20')],'include':_0x1f55e2[_0xcae8('0x21')]?_[_0xcae8('0x23')](_0x1f55e2[_0xcae8('0x21')],function(_0x287d4d){return{'model':db[_0x287d4d['model']],'as':_0x287d4d['as'],'attributes':_0x287d4d[_0xcae8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcae8('0x24')](function(_0x2ba42d){logger[_0xcae8('0x12')](_0xcae8('0x25'),_0x368a4d);logger['debug'](_0xcae8('0x25'),_0x368a4d,JSON[_0xcae8('0x17')](_0x2ba42d));_0x54f514(_0x2ba42d);})[_0xcae8('0x1c')](function(_0x2cf94d){logger[_0xcae8('0x19')]('GetFaxAccount',_0x2cf94d[_0xcae8('0x1a')],_0x368a4d);_0x17aeb0(_0x16e169[_0xcae8('0x19')](0x1f4,_0x2cf94d[_0xcae8('0x1a')]));});});};exports[_0xcae8('0x26')]=function(_0x1a6b29,_0x72e2e0,_0x217031){var _0x1de29d=this;return new Promise(function(_0x22a0bc,_0x3ad622){var _0x2485a7={'body':_0x1a6b29[_0xcae8('0x27')],'channel':_0xcae8('0x28')};var _0x444c34=[];var _0x569db0=[];var _0x274474={};return db['CmContact'][_0xcae8('0x29')]()['then'](function(_0x305f51){if(!_0x305f51){throw new db[(_0xcae8('0x2a'))][(_0xcae8('0x2b'))](_0xcae8('0x2c'));}_0x444c34=_[_0xcae8('0x2d')](_[_0xcae8('0x2e')](_0x305f51),[_0xcae8('0x2f'),_0xcae8('0x30')]);_0x569db0=_[_0xcae8('0x2d')](_[_0xcae8('0x2e')](_0x305f51),['createdAt','updatedAt',_0xcae8('0x31'),'ListId']);if(_0x1a6b29[_0xcae8('0x27')]['id']){delete _0x1a6b29['body']['id'];}if(_[_0xcae8('0x32')](_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x33')])){throw new db[(_0xcae8('0x2a'))][(_0xcae8('0x2b'))]('from\x20is\x20mandatory');}if(_[_0xcae8('0x32')](_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x27')])||_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x27')]===''){throw new db[(_0xcae8('0x2a'))][(_0xcae8('0x2b'))](_0xcae8('0x34'));}if(_[_0xcae8('0x32')](_0x1a6b29['body']['mapKey'])){throw new db[(_0xcae8('0x2a'))][(_0xcae8('0x2b'))](_0xcae8('0x35')+_0x569db0);}if(!_[_0xcae8('0x36')](_0x569db0,_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x37')])){throw new db['Sequelize'][(_0xcae8('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x569db0);}_0x274474[_0x1a6b29['body'][_0xcae8('0x37')]]=_0x1a6b29['body'][_0xcae8('0x33')];})['then'](function(){return db[_0xcae8('0x1d')][_0xcae8('0x38')]({'where':{'id':_0x1a6b29[_0xcae8('0x39')]['id']},'include':[{'model':db[_0xcae8('0x3a')],'as':'List','include':[{'model':db[_0xcae8('0x3b')],'as':_0xcae8('0x3c'),'where':_0x274474,'limit':0x1,'order':[[_0xcae8('0x30'),'DESC']]}]},{'model':db[_0xcae8('0x3d')],'as':_0xcae8('0x3e')}]});})[_0xcae8('0x24')](function(_0x502dc8){if(_0x502dc8&&_0x502dc8[_0xcae8('0x3f')]){var _0x2f2187=_0x502dc8['get']({'plain':!![]});_0x2485a7[_0xcae8('0x39')]=_0x2f2187;_0x2485a7['applications']=_0x2f2187[_0xcae8('0x3e')];_0x2485a7[_0xcae8('0x40')]=_0x2f2187[_0xcae8('0x3f')];_0x2485a7[_0xcae8('0x41')]=_[_0xcae8('0x42')](_0x2485a7[_0xcae8('0x41')],[_0xcae8('0x43')],[_0xcae8('0x44')]);if(_0x2485a7[_0xcae8('0x39')][_0xcae8('0x3e')]){delete _0x2485a7[_0xcae8('0x39')][_0xcae8('0x3e')];}if(_0x2485a7[_0xcae8('0x39')][_0xcae8('0x3f')]&&_0x2485a7['account'][_0xcae8('0x3f')][_0xcae8('0x3c')][_0xcae8('0x45')]){return _0x2485a7[_0xcae8('0x39')][_0xcae8('0x3f')][_0xcae8('0x3c')][0x0];}var _0x243230=_[_0xcae8('0xc')](_0x1a6b29[_0xcae8('0x27')],{'firstName':_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x33')],'ListId':_0x2f2187['ListId']});_0x243230[_0x1a6b29['body'][_0xcae8('0x37')]]=_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x33')];return db[_0xcae8('0x3b')][_0xcae8('0x46')](_0x243230,{'fields':_0x444c34,'raw':!![]});}})['then'](function(_0x41e482){_0x2485a7[_0xcae8('0x47')]=_0x41e482;if(_0x41e482){var _0x5149cd={'ContactId':_0x41e482['id'],'FaxAccountId':_0x1a6b29[_0xcae8('0x39')]['id'],'fax':_0x41e482[_0xcae8('0x28')]};return db[_0xcae8('0x48')][_0xcae8('0x38')]({'where':{'ContactId':_0x41e482['id'],'closed':![],'FaxAccountId':_0x1a6b29[_0xcae8('0x39')]['id']}})[_0xcae8('0x24')](function(_0x163619){if(_0x163619){return[_0x163619,![]];}return db[_0xcae8('0x48')][_0xcae8('0x46')](_0x5149cd)[_0xcae8('0x24')](function(_0x423323){return[_0x423323,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xcae8('0x49')](function(_0x3d29be,_0x496218){var _0x3a18a8=_0x3d29be[_0xcae8('0x4a')]({'plain':!![]});if(_0x496218){if(_0x2485a7[_0xcae8('0x39')][_0xcae8('0x4b')]){_0x2485a7[_0xcae8('0x41')][_0xcae8('0x4c')]({'id':0x0,'priority':_0x2485a7[_0xcae8('0x41')]['length']+0x1,'app':'close','appdata':_0xcae8('0x4d'),'interval':'*,*,*,*'});}_0x3a18a8[_0xcae8('0x4e')]=!![];}else{_0x3a18a8[_0xcae8('0x4e')]=![];}_0x2485a7['interaction']=_0x3a18a8;return db[_0xcae8('0x4f')][_0xcae8('0x46')]({'body':_0x1a6b29['body'][_0xcae8('0x27')],'FaxAccountId':_0x1a6b29['account']['id'],'FaxInteractionId':_0x3d29be['id'],'direction':'in','ContactId':_0x3d29be['ContactId'],'AttachmentId':_0x1a6b29[_0xcae8('0x27')][_0xcae8('0x50')]});})[_0xcae8('0x24')](function(_0x3b5ff9){_0x2485a7[_0xcae8('0x1a')]=_0x3b5ff9;if(_0x2485a7[_0xcae8('0x51')][_0xcae8('0x52')]){return db[_0xcae8('0x53')][_0xcae8('0x38')]({'attributes':['id','name'],'where':{'id':_0x2485a7['interaction'][_0xcae8('0x52')]}})[_0xcae8('0x24')](function(_0x2595d6){if(_0x2595d6){_0x2485a7[_0xcae8('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2595d6[_0xcae8('0x54')]+','+(_0x2485a7[_0xcae8('0x39')][_0xcae8('0x55')]||0xa),'interval':_0xcae8('0x56')});}return respondWithRpcPromise(_0xcae8('0x57'),_0xcae8('0x58'),_0x2485a7);});}return respondWithRpcPromise(_0xcae8('0x57'),_0xcae8('0x58'),_0x2485a7);})[_0xcae8('0x24')](function(_0xa60a62){_0x22a0bc(_0xa60a62);})[_0xcae8('0x1c')](function(_0x376ec7){_0x3ad622(_0x1de29d['error'](0x1f4,_0x376ec7[_0xcae8('0x1a')]));});});}; \ No newline at end of file +var _0x90c1=['body','fax','CmContact','describe','Sequelize','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','ValidationError','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','FaxAccount','CmList','List','DESC','FaxApplication','get','applications','Applications','list','priority','asc','account','Contacts','contact','FaxInteraction','find','create','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','findAll','options','raw','attributes','map','include','model','NotifyFaxAccount'];(function(_0x56b991,_0x49ea55){var _0x4950e2=function(_0xf9b304){while(--_0xf9b304){_0x56b991['push'](_0x56b991['shift']());}};_0x4950e2(++_0x49ea55);}(_0x90c1,0x90));var _0x190c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x90c1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x190c('0x0'));var util=require(_0x190c('0x1'));var moment=require(_0x190c('0x2'));var BPromise=require(_0x190c('0x3'));var rs=require(_0x190c('0x4'));var fs=require('fs');var Redis=require(_0x190c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x190c('0x6'))('rpc');var config=require(_0x190c('0x7'));var jayson=require(_0x190c('0x8'));var client=jayson[_0x190c('0x9')][_0x190c('0xa')]({'port':0x232c});config[_0x190c('0xb')]=_[_0x190c('0xc')](config[_0x190c('0xb')],{'host':_0x190c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x190c('0xe'))[_0x190c('0xf')](socket);function respondWithRpcPromise(_0x1c7281,_0x528c8f,_0x4e0e1b){return new BPromise(function(_0x486dcf,_0x13fd9f){return client[_0x190c('0x10')](_0x1c7281,_0x4e0e1b)[_0x190c('0x11')](function(_0x27c33f){logger[_0x190c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x528c8f,_0x190c('0x13'));logger[_0x190c('0x14')](_0x190c('0x15'),_0x528c8f,_0x190c('0x13'),JSON[_0x190c('0x16')](_0x27c33f));if(_0x27c33f['error']){if(_0x27c33f['error'][_0x190c('0x17')]===0x1f4){logger[_0x190c('0x18')]('FaxAccount,\x20%s,\x20%s',_0x528c8f,_0x27c33f['error'][_0x190c('0x19')]);return _0x13fd9f(_0x27c33f[_0x190c('0x18')][_0x190c('0x19')]);}logger[_0x190c('0x18')](_0x190c('0x1a'),_0x528c8f,_0x27c33f[_0x190c('0x18')]['message']);return _0x486dcf(_0x27c33f[_0x190c('0x18')][_0x190c('0x19')]);}else{logger[_0x190c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x528c8f,_0x190c('0x13'));_0x486dcf(_0x27c33f[_0x190c('0x1b')][_0x190c('0x19')]);}})[_0x190c('0x1c')](function(_0x3ac1ad){logger[_0x190c('0x18')](_0x190c('0x1a'),_0x528c8f,_0x3ac1ad);_0x13fd9f(_0x3ac1ad);});});}exports[_0x190c('0x1d')]=function(_0x43af07){var _0x2290de=this;return new Promise(function(_0xf2b667,_0x192526){return db['FaxAccount'][_0x190c('0x1e')]({'raw':_0x43af07[_0x190c('0x1f')]?_0x43af07[_0x190c('0x1f')][_0x190c('0x20')]===undefined?!![]:![]:!![],'where':_0x43af07[_0x190c('0x1f')]?_0x43af07[_0x190c('0x1f')]['where']||null:null,'attributes':_0x43af07[_0x190c('0x1f')]?_0x43af07['options'][_0x190c('0x21')]||null:null,'limit':_0x43af07[_0x190c('0x1f')]?_0x43af07[_0x190c('0x1f')]['limit']||null:null,'include':_0x43af07[_0x190c('0x1f')]?_0x43af07[_0x190c('0x1f')]['include']?_[_0x190c('0x22')](_0x43af07[_0x190c('0x1f')][_0x190c('0x23')],function(_0x425a27){return{'model':db[_0x425a27['model']],'as':_0x425a27['as'],'attributes':_0x425a27['attributes'],'include':_0x425a27['include']?_['map'](_0x425a27[_0x190c('0x23')],function(_0x3cdf59){return{'model':db[_0x3cdf59[_0x190c('0x24')]],'as':_0x3cdf59['as'],'attributes':_0x3cdf59['attributes'],'include':_0x3cdf59['include']?_[_0x190c('0x22')](_0x3cdf59[_0x190c('0x23')],function(_0x8e0f01){return{'model':db[_0x8e0f01[_0x190c('0x24')]],'as':_0x8e0f01['as'],'attributes':_0x8e0f01[_0x190c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x190c('0x11')](function(_0x54582d){logger[_0x190c('0x12')](_0x190c('0x1d'),_0x43af07);logger[_0x190c('0x14')]('GetFaxAccount',_0x43af07,JSON['stringify'](_0x54582d));_0xf2b667(_0x54582d);})['catch'](function(_0x2eb6c3){logger[_0x190c('0x18')](_0x190c('0x1d'),_0x2eb6c3[_0x190c('0x19')],_0x43af07);_0x192526(_0x2290de['error'](0x1f4,_0x2eb6c3[_0x190c('0x19')]));});});};exports[_0x190c('0x25')]=function(_0xa09cd6,_0x3088af,_0x1fe092){var _0x12bd36=this;return new Promise(function(_0x2ef586,_0xacee76){var _0x3f8220={'body':_0xa09cd6[_0x190c('0x26')],'channel':_0x190c('0x27')};var _0x1d3ab2=[];var _0x191f3d=[];var _0x4c8308={};return db[_0x190c('0x28')][_0x190c('0x29')]()[_0x190c('0x11')](function(_0xf025bd){if(!_0xf025bd){throw new db[(_0x190c('0x2a'))]['ValidationError']('no\x20available\x20attributes');}_0x1d3ab2=_[_0x190c('0x2b')](_['keys'](_0xf025bd),[_0x190c('0x2c'),_0x190c('0x2d')]);_0x191f3d=_[_0x190c('0x2b')](_[_0x190c('0x2e')](_0xf025bd),[_0x190c('0x2c'),_0x190c('0x2d'),_0x190c('0x2f'),_0x190c('0x30')]);if(_0xa09cd6[_0x190c('0x26')]['id']){delete _0xa09cd6['body']['id'];}if(_[_0x190c('0x31')](_0xa09cd6[_0x190c('0x26')][_0x190c('0x32')])){throw new db[(_0x190c('0x2a'))][(_0x190c('0x33'))](_0x190c('0x34'));}if(_[_0x190c('0x31')](_0xa09cd6[_0x190c('0x26')][_0x190c('0x26')])||_0xa09cd6['body'][_0x190c('0x26')]===''){throw new db[(_0x190c('0x2a'))][(_0x190c('0x33'))](_0x190c('0x35'));}if(_[_0x190c('0x31')](_0xa09cd6[_0x190c('0x26')][_0x190c('0x36')])){throw new db[(_0x190c('0x2a'))][(_0x190c('0x33'))](_0x190c('0x37')+_0x191f3d);}if(!_[_0x190c('0x38')](_0x191f3d,_0xa09cd6[_0x190c('0x26')][_0x190c('0x36')])){throw new db['Sequelize'][(_0x190c('0x33'))](_0x190c('0x39')+_0x191f3d);}_0x4c8308[_0xa09cd6[_0x190c('0x26')]['mapKey']]=_0xa09cd6['body'][_0x190c('0x32')];})['then'](function(){return db[_0x190c('0x3a')]['find']({'where':{'id':_0xa09cd6['account']['id']},'include':[{'model':db[_0x190c('0x3b')],'as':_0x190c('0x3c'),'include':[{'model':db[_0x190c('0x28')],'as':'Contacts','where':_0x4c8308,'limit':0x1,'order':[['updatedAt',_0x190c('0x3d')]]}]},{'model':db[_0x190c('0x3e')],'as':'Applications'}]});})[_0x190c('0x11')](function(_0x5ad8f0){if(_0x5ad8f0&&_0x5ad8f0['List']){var _0x143c37=_0x5ad8f0[_0x190c('0x3f')]({'plain':!![]});_0x3f8220['account']=_0x143c37;_0x3f8220[_0x190c('0x40')]=_0x143c37[_0x190c('0x41')];_0x3f8220[_0x190c('0x42')]=_0x143c37['List'];_0x3f8220[_0x190c('0x40')]=_['orderBy'](_0x3f8220['applications'],[_0x190c('0x43')],[_0x190c('0x44')]);if(_0x3f8220['account'][_0x190c('0x41')]){delete _0x3f8220['account'][_0x190c('0x41')];}if(_0x3f8220[_0x190c('0x45')]['List']&&_0x3f8220['account']['List'][_0x190c('0x46')]['length']){return _0x3f8220[_0x190c('0x45')][_0x190c('0x3c')][_0x190c('0x46')][0x0];}var _0xa54dcf=_['defaults'](_0xa09cd6[_0x190c('0x26')],{'firstName':_0xa09cd6[_0x190c('0x26')][_0x190c('0x32')],'ListId':_0x143c37['ListId']});_0xa54dcf[_0xa09cd6[_0x190c('0x26')][_0x190c('0x36')]]=_0xa09cd6[_0x190c('0x26')][_0x190c('0x32')];return db[_0x190c('0x28')]['create'](_0xa54dcf,{'fields':_0x1d3ab2,'raw':!![]});}})[_0x190c('0x11')](function(_0x425b16){_0x3f8220[_0x190c('0x47')]=_0x425b16;if(_0x425b16){var _0x562758={'ContactId':_0x425b16['id'],'FaxAccountId':_0xa09cd6[_0x190c('0x45')]['id'],'fax':_0x425b16[_0x190c('0x27')]};return db[_0x190c('0x48')][_0x190c('0x49')]({'where':{'ContactId':_0x425b16['id'],'closed':![],'FaxAccountId':_0xa09cd6[_0x190c('0x45')]['id']}})[_0x190c('0x11')](function(_0x102f19){if(_0x102f19){return[_0x102f19,![]];}return db[_0x190c('0x48')][_0x190c('0x4a')](_0x562758)[_0x190c('0x11')](function(_0x1f055b){return[_0x1f055b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x190c('0x4b')](function(_0x57352d,_0x55b2a3){var _0x4e52ec=_0x57352d[_0x190c('0x3f')]({'plain':!![]});if(_0x55b2a3){if(_0x3f8220[_0x190c('0x45')][_0x190c('0x4c')]){_0x3f8220[_0x190c('0x40')][_0x190c('0x4d')]({'id':0x0,'priority':_0x3f8220[_0x190c('0x40')][_0x190c('0x4e')]+0x1,'app':_0x190c('0x4f'),'appdata':_0x190c('0x50'),'interval':_0x190c('0x51')});}_0x4e52ec['created']=!![];}else{_0x4e52ec[_0x190c('0x52')]=![];}_0x3f8220[_0x190c('0x53')]=_0x4e52ec;return db['FaxMessage'][_0x190c('0x4a')]({'body':_0xa09cd6[_0x190c('0x26')][_0x190c('0x26')],'FaxAccountId':_0xa09cd6[_0x190c('0x45')]['id'],'FaxInteractionId':_0x57352d['id'],'direction':'in','ContactId':_0x57352d['ContactId'],'AttachmentId':_0xa09cd6['body']['AttachmentId']});})['then'](function(_0x1092e3){_0x3f8220[_0x190c('0x19')]=_0x1092e3;if(_0x3f8220[_0x190c('0x53')][_0x190c('0x54')]){return db[_0x190c('0x55')]['find']({'attributes':['id',_0x190c('0x56')],'where':{'id':_0x3f8220[_0x190c('0x53')][_0x190c('0x54')]}})[_0x190c('0x11')](function(_0x4e2e51){if(_0x4e2e51){_0x3f8220[_0x190c('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0x190c('0x57'),'appdata':_0x4e2e51['name']+','+(_0x3f8220[_0x190c('0x45')][_0x190c('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x3f8220);});}return respondWithRpcPromise(_0x190c('0x59'),_0x190c('0x5a'),_0x3f8220);})[_0x190c('0x11')](function(_0x30b5b9){_0x2ef586(_0x30b5b9);})['catch'](function(_0x17eeea){_0xacee76(_0x12bd36[_0x190c('0x18')](0x1f4,_0x17eeea[_0x190c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b2b0f8b..1609656 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 _0x204d=['length','remove','update','removeListener'];(function(_0x3cd0c8,_0x58c16e){var _0xce69db=function(_0x46edfa){while(--_0x46edfa){_0x3cd0c8['push'](_0x3cd0c8['shift']());}};_0xce69db(++_0x58c16e);}(_0x204d,0xc1));var _0xd204=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x204d[_0x2dafbe];return _0x58a45a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xd204('0x0'),_0xd204('0x1')];function createListener(_0x468bbf,_0x9fd0b0){return function(_0x366fea){_0x9fd0b0['emit'](_0x468bbf,_0x366fea);};}function removeListener(_0x2f2328,_0x1cd1e6){return function(){FaxAccountEvents[_0xd204('0x2')](_0x2f2328,_0x1cd1e6);};}exports['register']=function(_0x4a83ef){for(var _0x4f550e=0x0,_0x25c49f=events[_0xd204('0x3')];_0x4f550e<_0x25c49f;_0x4f550e++){var _0x1f1d3b=events[_0x4f550e];var _0x1b755b=createListener('faxAccount:'+_0x1f1d3b,_0x4a83ef);FaxAccountEvents['on'](_0x1f1d3b,_0x1b755b);}}; \ No newline at end of file +var _0xdd84=['removeListener','length','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xdd84,0x114));var _0x4dd8=function(_0x131309,_0x2b672e){_0x131309=_0x131309-0x0;var _0xf6619e=_0xdd84[_0x131309];return _0xf6619e;};'use strict';var FaxAccountEvents=require(_0x4dd8('0x0'));var events=['save',_0x4dd8('0x1'),_0x4dd8('0x2')];function createListener(_0x16d047,_0x1c29fc){return function(_0x383f8c){_0x1c29fc[_0x4dd8('0x3')](_0x16d047,_0x383f8c);};}function removeListener(_0x4a0230,_0x482e8a){return function(){FaxAccountEvents[_0x4dd8('0x4')](_0x4a0230,_0x482e8a);};}exports['register']=function(_0x518e08){for(var _0x470ea2=0x0,_0x55ac52=events[_0x4dd8('0x5')];_0x470ea2<_0x55ac52;_0x470ea2++){var _0x5383ae=events[_0x470ea2];var _0x351cd4=createListener(_0x4dd8('0x6')+_0x5383ae,_0x518e08);FaxAccountEvents['on'](_0x5383ae,_0x351cd4);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6895198..0e9a3f6 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x355488,_0x55d26a){var _0x4eaf2e=function(_0x571c4a){while(--_0x571c4a){_0x355488['push'](_0x355488['shift']());}};_0x4eaf2e(++_0x55d26a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x158b54,_0xc7a51b){var _0x5d0e54=function(_0x10dcfd){while(--_0x10dcfd){_0x158b54['push'](_0x158b54['shift']());}};_0x5d0e54(++_0xc7a51b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 870ae43..3e2a937 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 _0xf122=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x399839,_0x472233){var _0x213846=function(_0x5c49bd){while(--_0x5c49bd){_0x399839['push'](_0x399839['shift']());}};_0x213846(++_0x472233);}(_0xf122,0x177));var _0x2f12=function(_0x33eec7,_0x3e9d71){_0x33eec7=_0x33eec7-0x0;var _0x52bd12=_0xf122[_0x33eec7];return _0x52bd12;};'use strict';var Sequelize=require(_0x2f12('0x0'));module[_0x2f12('0x1')]={'priority':{'type':Sequelize[_0x2f12('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2f12('0x3')],'allowNull':![],'defaultValue':_0x2f12('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2f12('0x3')],'defaultValue':_0x2f12('0x5')}}; \ No newline at end of file +var _0x896e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1a4a8a,_0x3b505a){var _0x4c4618=function(_0x2de158){while(--_0x2de158){_0x1a4a8a['push'](_0x1a4a8a['shift']());}};_0x4c4618(++_0x3b505a);}(_0x896e,0x1e9));var _0xe896=function(_0x548c73,_0x521130){_0x548c73=_0x548c73-0x0;var _0x24e9eb=_0x896e[_0x548c73];return _0x24e9eb;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'priority':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe896('0x3')],'allowNull':![],'defaultValue':_0xe896('0x4')},'appdata':{'type':Sequelize[_0xe896('0x5')]()},'description':{'type':Sequelize[_0xe896('0x3')]},'interval':{'type':Sequelize[_0xe896('0x3')],'defaultValue':_0xe896('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8a74f29..5154dd3 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 _0x1534=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x704df6,_0x49a1cf){var _0x1edb40=function(_0x313dda){while(--_0x313dda){_0x704df6['push'](_0x704df6['shift']());}};_0x1edb40(++_0x49a1cf);}(_0x1534,0x16d));var _0x4153=function(_0x461d47,_0x16aa7a){_0x461d47=_0x461d47-0x0;var _0x25e8b8=_0x1534[_0x461d47];return _0x25e8b8;};'use strict';var emlformat=require(_0x4153('0x0'));var rimraf=require(_0x4153('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4153('0x2'));var rp=require(_0x4153('0x3'));var moment=require(_0x4153('0x4'));var BPromise=require(_0x4153('0x5'));var Mustache=require('mustache');var util=require(_0x4153('0x6'));var path=require(_0x4153('0x7'));var sox=require(_0x4153('0x8'));var csv=require(_0x4153('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4153('0xa'));var _=require(_0x4153('0xb'));var squel=require(_0x4153('0xc'));var crypto=require('crypto');var jsforce=require(_0x4153('0xd'));var deskjs=require(_0x4153('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4153('0xf'));var Papa=require(_0x4153('0x10'));var Redis=require(_0x4153('0x11'));var authService=require(_0x4153('0x12'));var qs=require(_0x4153('0x13'));var as=require(_0x4153('0x14'));var hardwareService=require(_0x4153('0x15'));var logger=require(_0x4153('0x16'))('api');var utils=require(_0x4153('0x17'));var config=require(_0x4153('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4153('0x19'))['db'];function respondWithStatusCode(_0x18b7c5,_0xc10fa1){_0xc10fa1=_0xc10fa1||0xcc;return function(_0x417c6a){if(_0x417c6a){return _0x18b7c5['sendStatus'](_0xc10fa1);}return _0x18b7c5[_0x4153('0x1a')](_0xc10fa1)[_0x4153('0x1b')]();};}function respondWithResult(_0x220f92,_0x5122a2){_0x5122a2=_0x5122a2||0xc8;return function(_0x124785){if(_0x124785){return _0x220f92['status'](_0x5122a2)[_0x4153('0x1c')](_0x124785);}};}function respondWithFilteredResult(_0x48a42a,_0x4438a8){return function(_0x1bd43b){if(_0x1bd43b){var _0x5a15ed=typeof _0x4438a8[_0x4153('0x1d')]==='undefined'&&typeof _0x4438a8[_0x4153('0x1e')]==='undefined';var _0x4815f6=_0x1bd43b[_0x4153('0x1f')];var _0x2caa04=_0x5a15ed?0x0:_0x4438a8[_0x4153('0x1d')];var _0x52a15c=_0x5a15ed?_0x1bd43b[_0x4153('0x1f')]:_0x4438a8['offset']+_0x4438a8['limit'];var _0x2016b6;if(_0x52a15c>=_0x4815f6){_0x52a15c=_0x4815f6;_0x2016b6=0xc8;}else{_0x2016b6=0xce;}_0x48a42a['status'](_0x2016b6);return _0x48a42a['set'](_0x4153('0x20'),_0x2caa04+'-'+_0x52a15c+'/'+_0x4815f6)['json'](_0x1bd43b);}return null;};}function patchUpdates(_0x1efc04){return function(_0x54d2ac){try{jsonpatch[_0x4153('0x21')](_0x54d2ac,_0x1efc04,!![]);}catch(_0x2d6bfe){return BPromise[_0x4153('0x22')](_0x2d6bfe);}return _0x54d2ac[_0x4153('0x23')]();};}function saveUpdates(_0x3b39e6,_0x3a50ae){return function(_0x2eb100){if(_0x2eb100){return _0x2eb100[_0x4153('0x24')](_0x3b39e6)[_0x4153('0x25')](function(_0x30dcd0){return _0x30dcd0;});}return null;};}function removeEntity(_0x47bf8b,_0x72e942){return function(_0x4b968c){if(_0x4b968c){return _0x4b968c['destroy']()[_0x4153('0x25')](function(){_0x47bf8b[_0x4153('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30321b,_0x4280b6){return function(_0x10d991){if(!_0x10d991){_0x30321b['sendStatus'](0x194);}return _0x10d991;};}function handleError(_0x2aa13e,_0xaf152d){_0xaf152d=_0xaf152d||0x1f4;return function(_0x3216d5){logger[_0x4153('0x26')](_0x3216d5[_0x4153('0x27')]);if(_0x3216d5['name']){delete _0x3216d5[_0x4153('0x28')];}_0x2aa13e[_0x4153('0x1a')](_0xaf152d)[_0x4153('0x29')](_0x3216d5);};}exports[_0x4153('0x2a')]=function(_0x572dbf,_0x4b09aa){var _0x1837ad={},_0x1a7450={},_0x46c6b3={'count':0x0,'rows':[]};var _0x21bd02=_['map'](db[_0x4153('0x2b')][_0x4153('0x2c')],function(_0x2c1456){return{'name':_0x2c1456[_0x4153('0x2d')],'type':_0x2c1456[_0x4153('0x2e')][_0x4153('0x2f')]};});_0x1a7450[_0x4153('0x30')]=_[_0x4153('0x31')](_0x21bd02,_0x4153('0x28'));_0x1a7450['query']=_[_0x4153('0x32')](_0x572dbf[_0x4153('0x33')]);_0x1a7450['filters']=_[_0x4153('0x34')](_0x1a7450[_0x4153('0x30')],_0x1a7450['query']);_0x1837ad[_0x4153('0x35')]=_['intersection'](_0x1a7450[_0x4153('0x30')],qs[_0x4153('0x36')](_0x572dbf['query']['fields']));_0x1837ad[_0x4153('0x35')]=_0x1837ad[_0x4153('0x35')][_0x4153('0x37')]?_0x1837ad[_0x4153('0x35')]:_0x1a7450[_0x4153('0x30')];if(!_0x572dbf[_0x4153('0x33')][_0x4153('0x38')](_0x4153('0x39'))){_0x1837ad[_0x4153('0x1e')]=qs[_0x4153('0x1e')](_0x572dbf[_0x4153('0x33')][_0x4153('0x1e')]);_0x1837ad[_0x4153('0x1d')]=qs[_0x4153('0x1d')](_0x572dbf[_0x4153('0x33')][_0x4153('0x1d')]);}_0x1837ad[_0x4153('0x3a')]=qs[_0x4153('0x3b')](_0x572dbf[_0x4153('0x33')][_0x4153('0x3b')]);_0x1837ad[_0x4153('0x3c')]=qs[_0x4153('0x3d')](_['pick'](_0x572dbf[_0x4153('0x33')],_0x1a7450[_0x4153('0x3d')]),_0x21bd02);if(_0x572dbf[_0x4153('0x33')][_0x4153('0x3e')]){_0x1837ad[_0x4153('0x3c')]=_[_0x4153('0x3f')](_0x1837ad['where'],{'$or':_['map'](_0x21bd02,function(_0x5374bf){if(_0x5374bf['type']!==_0x4153('0x40')){var _0x42a91a={};_0x42a91a[_0x5374bf[_0x4153('0x28')]]={'$like':'%'+_0x572dbf[_0x4153('0x33')]['filter']+'%'};return _0x42a91a;}})});}_0x1837ad=_['merge']({},_0x1837ad,_0x572dbf[_0x4153('0x41')]);var _0x523ef7={'where':_0x1837ad[_0x4153('0x3c')]};return db[_0x4153('0x2b')][_0x4153('0x1f')](_0x523ef7)[_0x4153('0x25')](function(_0x583a64){_0x46c6b3[_0x4153('0x1f')]=_0x583a64;if(_0x572dbf[_0x4153('0x33')]['includeAll']){_0x1837ad[_0x4153('0x42')]=[{'all':!![]}];}return db[_0x4153('0x2b')][_0x4153('0x43')](_0x1837ad);})[_0x4153('0x25')](function(_0x55948f){_0x46c6b3['rows']=_0x55948f;return _0x46c6b3;})[_0x4153('0x25')](respondWithFilteredResult(_0x4b09aa,_0x1837ad))[_0x4153('0x44')](handleError(_0x4b09aa,null));};exports[_0x4153('0x45')]=function(_0x558e4d,_0x469768){var _0x44b69a={'raw':!![],'where':{'id':_0x558e4d[_0x4153('0x46')]['id']}},_0x45443d={};_0x45443d[_0x4153('0x30')]=_[_0x4153('0x32')](db[_0x4153('0x2b')][_0x4153('0x2c')]);_0x45443d[_0x4153('0x33')]=_[_0x4153('0x32')](_0x558e4d[_0x4153('0x33')]);_0x45443d[_0x4153('0x3d')]=_[_0x4153('0x34')](_0x45443d['model'],_0x45443d[_0x4153('0x33')]);_0x44b69a[_0x4153('0x35')]=_[_0x4153('0x34')](_0x45443d['model'],qs[_0x4153('0x36')](_0x558e4d[_0x4153('0x33')]['fields']));_0x44b69a[_0x4153('0x35')]=_0x44b69a[_0x4153('0x35')][_0x4153('0x37')]?_0x44b69a['attributes']:_0x45443d[_0x4153('0x30')];if(_0x558e4d[_0x4153('0x33')]['includeAll']){_0x44b69a[_0x4153('0x42')]=[{'all':!![]}];}_0x44b69a=_[_0x4153('0x3f')]({},_0x44b69a,_0x558e4d['options']);return db[_0x4153('0x2b')][_0x4153('0x47')](_0x44b69a)[_0x4153('0x25')](handleEntityNotFound(_0x469768,null))[_0x4153('0x25')](respondWithResult(_0x469768,null))[_0x4153('0x44')](handleError(_0x469768,null));};exports['create']=function(_0x57e4fd,_0x64b031){return db[_0x4153('0x2b')][_0x4153('0x48')](_0x57e4fd[_0x4153('0x49')],{})[_0x4153('0x25')](respondWithResult(_0x64b031,0xc9))[_0x4153('0x44')](handleError(_0x64b031,null));};exports['update']=function(_0x4acb2c,_0x1c7bfd){if(_0x4acb2c[_0x4153('0x49')]['id']){delete _0x4acb2c['body']['id'];}return db['FaxApplication'][_0x4153('0x47')]({'where':{'id':_0x4acb2c[_0x4153('0x46')]['id']}})[_0x4153('0x25')](handleEntityNotFound(_0x1c7bfd,null))[_0x4153('0x25')](saveUpdates(_0x4acb2c[_0x4153('0x49')],null))[_0x4153('0x25')](respondWithResult(_0x1c7bfd,null))[_0x4153('0x44')](handleError(_0x1c7bfd,null));};exports[_0x4153('0x4a')]=function(_0x175bf0,_0x20463c){return db[_0x4153('0x2b')][_0x4153('0x47')]({'where':{'id':_0x175bf0[_0x4153('0x46')]['id']}})[_0x4153('0x25')](handleEntityNotFound(_0x20463c,null))[_0x4153('0x25')](removeEntity(_0x20463c,null))['catch'](handleError(_0x20463c,null));}; \ No newline at end of file +var _0xa86a=['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','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv'];(function(_0x3e0bd7,_0x126130){var _0x15fbe4=function(_0x28479){while(--_0x28479){_0x3e0bd7['push'](_0x3e0bd7['shift']());}};_0x15fbe4(++_0x126130);}(_0xa86a,0x123));var _0xaa86=function(_0xc0ce7f,_0x1007db){_0xc0ce7f=_0xc0ce7f-0x0;var _0x2ac351=_0xa86a[_0xc0ce7f];return _0x2ac351;};'use strict';var emlformat=require(_0xaa86('0x0'));var rimraf=require(_0xaa86('0x1'));var zipdir=require(_0xaa86('0x2'));var jsonpatch=require(_0xaa86('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaa86('0x4'));var Mustache=require(_0xaa86('0x5'));var util=require(_0xaa86('0x6'));var path=require('path');var sox=require(_0xaa86('0x7'));var csv=require(_0xaa86('0x8'));var ejs=require(_0xaa86('0x9'));var fs=require('fs');var fs_extra=require(_0xaa86('0xa'));var _=require(_0xaa86('0xb'));var squel=require(_0xaa86('0xc'));var crypto=require(_0xaa86('0xd'));var jsforce=require(_0xaa86('0xe'));var deskjs=require(_0xaa86('0xf'));var toCsv=require(_0xaa86('0x8'));var querystring=require(_0xaa86('0x10'));var Papa=require(_0xaa86('0x11'));var Redis=require(_0xaa86('0x12'));var authService=require(_0xaa86('0x13'));var qs=require(_0xaa86('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa86('0x15'))(_0xaa86('0x16'));var utils=require(_0xaa86('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa86('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c0a18,_0x35300d){_0x35300d=_0x35300d||0xcc;return function(_0x381c07){if(_0x381c07){return _0x2c0a18[_0xaa86('0x19')](_0x35300d);}return _0x2c0a18['status'](_0x35300d)[_0xaa86('0x1a')]();};}function respondWithResult(_0x135d09,_0x3ceacd){_0x3ceacd=_0x3ceacd||0xc8;return function(_0xd91c65){if(_0xd91c65){return _0x135d09[_0xaa86('0x1b')](_0x3ceacd)[_0xaa86('0x1c')](_0xd91c65);}};}function respondWithFilteredResult(_0x5f3743,_0x4932ad){return function(_0xf01b82){if(_0xf01b82){var _0x256249=typeof _0x4932ad['offset']===_0xaa86('0x1d')&&typeof _0x4932ad[_0xaa86('0x1e')]===_0xaa86('0x1d');var _0x1f23e1=_0xf01b82[_0xaa86('0x1f')];var _0x455fa7=_0x256249?0x0:_0x4932ad['offset'];var _0x1488a8=_0x256249?_0xf01b82[_0xaa86('0x1f')]:_0x4932ad[_0xaa86('0x20')]+_0x4932ad[_0xaa86('0x1e')];var _0x15eab0;if(_0x1488a8>=_0x1f23e1){_0x1488a8=_0x1f23e1;_0x15eab0=0xc8;}else{_0x15eab0=0xce;}_0x5f3743['status'](_0x15eab0);return _0x5f3743['set'](_0xaa86('0x21'),_0x455fa7+'-'+_0x1488a8+'/'+_0x1f23e1)[_0xaa86('0x1c')](_0xf01b82);}return null;};}function patchUpdates(_0x2664df){return function(_0x7ffd74){try{jsonpatch[_0xaa86('0x22')](_0x7ffd74,_0x2664df,!![]);}catch(_0xeecab3){return BPromise['reject'](_0xeecab3);}return _0x7ffd74[_0xaa86('0x23')]();};}function saveUpdates(_0x791bcd,_0x587747){return function(_0x218c3c){if(_0x218c3c){return _0x218c3c[_0xaa86('0x24')](_0x791bcd)[_0xaa86('0x25')](function(_0x19fae7){return _0x19fae7;});}return null;};}function removeEntity(_0x98ed0f,_0x1bdefe){return function(_0x5b449b){if(_0x5b449b){return _0x5b449b[_0xaa86('0x26')]()[_0xaa86('0x25')](function(){_0x98ed0f['status'](0xcc)[_0xaa86('0x1a')]();});}};}function handleEntityNotFound(_0x2a6227,_0x474ff9){return function(_0x342494){if(!_0x342494){_0x2a6227['sendStatus'](0x194);}return _0x342494;};}function handleError(_0x53469a,_0x47da84){_0x47da84=_0x47da84||0x1f4;return function(_0x126f37){logger[_0xaa86('0x27')](_0x126f37[_0xaa86('0x28')]);if(_0x126f37[_0xaa86('0x29')]){delete _0x126f37[_0xaa86('0x29')];}_0x53469a[_0xaa86('0x1b')](_0x47da84)[_0xaa86('0x2a')](_0x126f37);};}exports[_0xaa86('0x2b')]=function(_0x5d3afe,_0x3a00b5){var _0x1bc31c={},_0x2f1f4c={},_0x31f6ba={'count':0x0,'rows':[]};var _0x341ab3=_[_0xaa86('0x2c')](db[_0xaa86('0x2d')][_0xaa86('0x2e')],function(_0x18b8fc){return{'name':_0x18b8fc[_0xaa86('0x2f')],'type':_0x18b8fc[_0xaa86('0x30')][_0xaa86('0x31')]};});_0x2f1f4c[_0xaa86('0x32')]=_['map'](_0x341ab3,_0xaa86('0x29'));_0x2f1f4c['query']=_[_0xaa86('0x33')](_0x5d3afe[_0xaa86('0x34')]);_0x2f1f4c[_0xaa86('0x35')]=_[_0xaa86('0x36')](_0x2f1f4c[_0xaa86('0x32')],_0x2f1f4c['query']);_0x1bc31c['attributes']=_[_0xaa86('0x36')](_0x2f1f4c[_0xaa86('0x32')],qs[_0xaa86('0x37')](_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x37')]));_0x1bc31c[_0xaa86('0x38')]=_0x1bc31c[_0xaa86('0x38')][_0xaa86('0x39')]?_0x1bc31c[_0xaa86('0x38')]:_0x2f1f4c[_0xaa86('0x32')];if(!_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x3a')]('nolimit')){_0x1bc31c[_0xaa86('0x1e')]=qs['limit'](_0x5d3afe['query'][_0xaa86('0x1e')]);_0x1bc31c[_0xaa86('0x20')]=qs[_0xaa86('0x20')](_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x20')]);}_0x1bc31c[_0xaa86('0x3b')]=qs[_0xaa86('0x3c')](_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x3c')]);_0x1bc31c[_0xaa86('0x3d')]=qs['filters'](_[_0xaa86('0x3e')](_0x5d3afe[_0xaa86('0x34')],_0x2f1f4c['filters']),_0x341ab3);if(_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x3f')]){_0x1bc31c[_0xaa86('0x3d')]=_['merge'](_0x1bc31c[_0xaa86('0x3d')],{'$or':_[_0xaa86('0x2c')](_0x341ab3,function(_0x2c9fad){if(_0x2c9fad[_0xaa86('0x30')]!==_0xaa86('0x40')){var _0x46f5e5={};_0x46f5e5[_0x2c9fad[_0xaa86('0x29')]]={'$like':'%'+_0x5d3afe[_0xaa86('0x34')]['filter']+'%'};return _0x46f5e5;}})});}_0x1bc31c=_['merge']({},_0x1bc31c,_0x5d3afe[_0xaa86('0x41')]);var _0x4eb088={'where':_0x1bc31c['where']};return db[_0xaa86('0x2d')][_0xaa86('0x1f')](_0x4eb088)[_0xaa86('0x25')](function(_0x2e95c7){_0x31f6ba[_0xaa86('0x1f')]=_0x2e95c7;if(_0x5d3afe[_0xaa86('0x34')][_0xaa86('0x42')]){_0x1bc31c[_0xaa86('0x43')]=[{'all':!![]}];}return db[_0xaa86('0x2d')][_0xaa86('0x44')](_0x1bc31c);})[_0xaa86('0x25')](function(_0x4916f4){_0x31f6ba[_0xaa86('0x45')]=_0x4916f4;return _0x31f6ba;})['then'](respondWithFilteredResult(_0x3a00b5,_0x1bc31c))['catch'](handleError(_0x3a00b5,null));};exports['show']=function(_0x408e13,_0x2b8041){var _0x4a3299={'raw':!![],'where':{'id':_0x408e13[_0xaa86('0x46')]['id']}},_0x127f5a={};_0x127f5a[_0xaa86('0x32')]=_[_0xaa86('0x33')](db[_0xaa86('0x2d')][_0xaa86('0x2e')]);_0x127f5a[_0xaa86('0x34')]=_[_0xaa86('0x33')](_0x408e13[_0xaa86('0x34')]);_0x127f5a['filters']=_[_0xaa86('0x36')](_0x127f5a[_0xaa86('0x32')],_0x127f5a['query']);_0x4a3299[_0xaa86('0x38')]=_[_0xaa86('0x36')](_0x127f5a['model'],qs[_0xaa86('0x37')](_0x408e13[_0xaa86('0x34')][_0xaa86('0x37')]));_0x4a3299[_0xaa86('0x38')]=_0x4a3299['attributes'][_0xaa86('0x39')]?_0x4a3299['attributes']:_0x127f5a[_0xaa86('0x32')];if(_0x408e13['query']['includeAll']){_0x4a3299[_0xaa86('0x43')]=[{'all':!![]}];}_0x4a3299=_['merge']({},_0x4a3299,_0x408e13['options']);return db[_0xaa86('0x2d')]['find'](_0x4a3299)[_0xaa86('0x25')](handleEntityNotFound(_0x2b8041,null))['then'](respondWithResult(_0x2b8041,null))[_0xaa86('0x47')](handleError(_0x2b8041,null));};exports[_0xaa86('0x48')]=function(_0xba18c3,_0x5be2cf){return db[_0xaa86('0x2d')]['create'](_0xba18c3[_0xaa86('0x49')],{})['then'](respondWithResult(_0x5be2cf,0xc9))[_0xaa86('0x47')](handleError(_0x5be2cf,null));};exports[_0xaa86('0x24')]=function(_0x2a046a,_0x9dec4a){if(_0x2a046a['body']['id']){delete _0x2a046a[_0xaa86('0x49')]['id'];}return db[_0xaa86('0x2d')]['find']({'where':{'id':_0x2a046a[_0xaa86('0x46')]['id']}})[_0xaa86('0x25')](handleEntityNotFound(_0x9dec4a,null))[_0xaa86('0x25')](saveUpdates(_0x2a046a[_0xaa86('0x49')],null))[_0xaa86('0x25')](respondWithResult(_0x9dec4a,null))['catch'](handleError(_0x9dec4a,null));};exports[_0xaa86('0x26')]=function(_0x527fa9,_0x2f31af){return db[_0xaa86('0x2d')][_0xaa86('0x4a')]({'where':{'id':_0x527fa9[_0xaa86('0x46')]['id']}})[_0xaa86('0x25')](handleEntityNotFound(_0x2f31af,null))[_0xaa86('0x25')](removeEntity(_0x2f31af,null))[_0xaa86('0x47')](handleError(_0x2f31af,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 885e1e1..539be9b 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 _0xa58a=['define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x400631,_0x49f9b5){var _0x712b20=function(_0x27b347){while(--_0x27b347){_0x400631['push'](_0x400631['shift']());}};_0x712b20(++_0x49f9b5);}(_0xa58a,0x17e));var _0xaa58=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xa58a[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xaa58('0x0'));var util=require(_0xaa58('0x1'));var logger=require(_0xaa58('0x2'))(_0xaa58('0x3'));var moment=require(_0xaa58('0x4'));var BPromise=require(_0xaa58('0x5'));var rp=require(_0xaa58('0x6'));var fs=require('fs');var path=require(_0xaa58('0x7'));var rimraf=require(_0xaa58('0x8'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xaa58('0x9')]=function(_0x3c717b,_0x595024){return _0x3c717b[_0xaa58('0xa')](_0xaa58('0xb'),attributes,{'tableName':_0xaa58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaa58('0xd')});}; \ No newline at end of file +var _0x49b0=['bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x2ded48,_0x4812d0){var _0x267aed=function(_0x2f9cb1){while(--_0x2f9cb1){_0x2ded48['push'](_0x2ded48['shift']());}};_0x267aed(++_0x4812d0);}(_0x49b0,0x1a1));var _0x049b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x49b0[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x049b('0x0'));var logger=require('../../config/logger')(_0x049b('0x1'));var moment=require(_0x049b('0x2'));var BPromise=require(_0x049b('0x3'));var rp=require(_0x049b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x049b('0x5'));var config=require(_0x049b('0x6'));var attributes=require(_0x049b('0x7'));module[_0x049b('0x8')]=function(_0x4bece3,_0xde7ab2){return _0x4bece3['define'](_0x049b('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x049b('0xa'),'collate':_0x049b('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 14be0c6..858fb7a 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 _0x67d3=['limit','UpdateFaxApplication','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','code','error','FaxApplication,\x20%s,\x20%s','message','update','body','options','where','attributes'];(function(_0x41162e,_0x5424df){var _0x5f3dbf=function(_0x428fd4){while(--_0x428fd4){_0x41162e['push'](_0x41162e['shift']());}};_0x5f3dbf(++_0x5424df);}(_0x67d3,0x15f));var _0x367d=function(_0x9c9103,_0x209ce2){_0x9c9103=_0x9c9103-0x0;var _0x114b58=_0x67d3[_0x9c9103];return _0x114b58;};'use strict';var _=require(_0x367d('0x0'));var util=require(_0x367d('0x1'));var moment=require(_0x367d('0x2'));var BPromise=require(_0x367d('0x3'));var rs=require(_0x367d('0x4'));var fs=require('fs');var Redis=require(_0x367d('0x5'));var db=require(_0x367d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x367d('0x7'))(_0x367d('0x8'));var config=require(_0x367d('0x9'));var jayson=require(_0x367d('0xa'));var client=jayson[_0x367d('0xb')][_0x367d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1810df,_0x4860a9,_0x1eeced){return new BPromise(function(_0x11a4d,_0x16f3db){return client['request'](_0x1810df,_0x1eeced)[_0x367d('0xd')](function(_0x1fb5ba){logger[_0x367d('0xe')]('FaxApplication,\x20%s,\x20%s',_0x4860a9,_0x367d('0xf'));logger[_0x367d('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4860a9,_0x367d('0xf'),JSON['stringify'](_0x1fb5ba));if(_0x1fb5ba['error']){if(_0x1fb5ba['error'][_0x367d('0x11')]===0x1f4){logger[_0x367d('0x12')](_0x367d('0x13'),_0x4860a9,_0x1fb5ba[_0x367d('0x12')]['message']);return _0x16f3db(_0x1fb5ba[_0x367d('0x12')]['message']);}logger[_0x367d('0x12')](_0x367d('0x13'),_0x4860a9,_0x1fb5ba[_0x367d('0x12')][_0x367d('0x14')]);return _0x11a4d(_0x1fb5ba[_0x367d('0x12')][_0x367d('0x14')]);}else{logger[_0x367d('0xe')]('FaxApplication,\x20%s,\x20%s',_0x4860a9,_0x367d('0xf'));_0x11a4d(_0x1fb5ba['result'][_0x367d('0x14')]);}})['catch'](function(_0x1fb249){logger['error'](_0x367d('0x13'),_0x4860a9,_0x1fb249);_0x16f3db(_0x1fb249);});});}exports['UpdateFaxApplication']=function(_0x824ec2){var _0x37a81a=this;return new Promise(function(_0x89ed8a,_0x58dfe9){return db['FaxApplication'][_0x367d('0x15')](_0x824ec2[_0x367d('0x16')],{'raw':_0x824ec2[_0x367d('0x17')]?_0x824ec2[_0x367d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x824ec2[_0x367d('0x17')]?_0x824ec2[_0x367d('0x17')][_0x367d('0x18')]||null:null,'attributes':_0x824ec2['options']?_0x824ec2[_0x367d('0x17')][_0x367d('0x19')]||null:null,'limit':_0x824ec2[_0x367d('0x17')]?_0x824ec2['options'][_0x367d('0x1a')]||null:null})['then'](function(_0x1c76c9){logger[_0x367d('0xe')](_0x367d('0x1b'),_0x824ec2);logger['debug']('UpdateFaxApplication',_0x824ec2,JSON['stringify'](_0x1c76c9));_0x89ed8a(_0x1c76c9);})[_0x367d('0x1c')](function(_0x111a84){logger['error']('UpdateFaxApplication',_0x111a84[_0x367d('0x14')],_0x824ec2);_0x58dfe9(_0x37a81a[_0x367d('0x12')](0x1f4,_0x111a84['message']));});});}; \ No newline at end of file +var _0xf331=['stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','then','catch','lodash','util','moment','bluebird','../../config/utils','../../config/environment','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf331,0xb0));var _0x1f33=function(_0x33ff46,_0x31a557){_0x33ff46=_0x33ff46-0x0;var _0x38e60d=_0xf331[_0x33ff46];return _0x38e60d;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var moment=require(_0x1f33('0x2'));var BPromise=require(_0x1f33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f33('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f33('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1f33('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cdd7a,_0x12966a,_0x221447){return new BPromise(function(_0x543275,_0x58136b){return client[_0x1f33('0x7')](_0x3cdd7a,_0x221447)['then'](function(_0x42c2c7){logger[_0x1f33('0x8')](_0x1f33('0x9'),_0x12966a,_0x1f33('0xa'));logger[_0x1f33('0xb')](_0x1f33('0xc'),_0x12966a,_0x1f33('0xa'),JSON[_0x1f33('0xd')](_0x42c2c7));if(_0x42c2c7[_0x1f33('0xe')]){if(_0x42c2c7[_0x1f33('0xe')][_0x1f33('0xf')]===0x1f4){logger['error'](_0x1f33('0x9'),_0x12966a,_0x42c2c7['error']['message']);return _0x58136b(_0x42c2c7[_0x1f33('0xe')][_0x1f33('0x10')]);}logger[_0x1f33('0xe')](_0x1f33('0x9'),_0x12966a,_0x42c2c7[_0x1f33('0xe')][_0x1f33('0x10')]);return _0x543275(_0x42c2c7[_0x1f33('0xe')][_0x1f33('0x10')]);}else{logger[_0x1f33('0x8')](_0x1f33('0x9'),_0x12966a,_0x1f33('0xa'));_0x543275(_0x42c2c7[_0x1f33('0x11')][_0x1f33('0x10')]);}})['catch'](function(_0x5347aa){logger[_0x1f33('0xe')](_0x1f33('0x9'),_0x12966a,_0x5347aa);_0x58136b(_0x5347aa);});});}exports[_0x1f33('0x12')]=function(_0x18fb89){var _0x4d997c=this;return new Promise(function(_0x504f03,_0x8e5fef){return db[_0x1f33('0x13')][_0x1f33('0x14')](_0x18fb89[_0x1f33('0x15')],{'raw':_0x18fb89[_0x1f33('0x16')]?_0x18fb89['options'][_0x1f33('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18fb89['options']?_0x18fb89[_0x1f33('0x16')]['where']||null:null,'attributes':_0x18fb89[_0x1f33('0x16')]?_0x18fb89[_0x1f33('0x16')][_0x1f33('0x18')]||null:null,'limit':_0x18fb89['options']?_0x18fb89[_0x1f33('0x16')]['limit']||null:null})[_0x1f33('0x19')](function(_0xf51c36){logger[_0x1f33('0x8')]('UpdateFaxApplication',_0x18fb89);logger[_0x1f33('0xb')](_0x1f33('0x12'),_0x18fb89,JSON['stringify'](_0xf51c36));_0x504f03(_0xf51c36);})[_0x1f33('0x1a')](function(_0x4a42aa){logger['error'](_0x1f33('0x12'),_0x4a42aa['message'],_0x18fb89);_0x8e5fef(_0x4d997c['error'](0x1f4,_0x4a42aa[_0x1f33('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 973ca5b..cae4bbe 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 _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0xa73d5e,_0xa5df81){var _0xaa2e8=function(_0x2bf6c1){while(--_0x2bf6c1){_0xa73d5e['push'](_0xa73d5e['shift']());}};_0xaa2e8(++_0xa5df81);}(_0xd4a2,0x173));var _0x2d4a=function(_0x220109,_0x1d2547){_0x220109=_0x220109-0x0;var _0x4ccd65=_0xd4a2[_0x220109];return _0x4ccd65;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1401ab,_0x5eb473){_0x1401ab=_0x1401ab-0x0;var _0x146d08=_0xd7d1[_0x1401ab];return _0x146d08;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 0526071..78e2b29 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 _0x9891=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x51fcb1,_0x48966a){var _0x470de4=function(_0x127a60){while(--_0x127a60){_0x51fcb1['push'](_0x51fcb1['shift']());}};_0x470de4(++_0x48966a);}(_0x9891,0x73));var _0x1989=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x9891[_0x1d3a5d];return _0x257078;};'use strict';var Sequelize=require(_0x1989('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1989('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1989('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1989('0x3')]},'note':{'type':Sequelize[_0x1989('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1989('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1989('0x4')]('in',_0x1989('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1989('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1989('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2a4f=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x26cd7e,_0x24647d){var _0x24b2b3=function(_0x1f0013){while(--_0x1f0013){_0x26cd7e['push'](_0x26cd7e['shift']());}};_0x24b2b3(++_0x24647d);}(_0x2a4f,0x153));var _0xf2a4=function(_0x2d747c,_0x851c49){_0x2d747c=_0x2d747c-0x0;var _0x2ac042=_0x2a4f[_0x2d747c];return _0x2ac042;};'use strict';var Sequelize=require(_0xf2a4('0x0'));module[_0xf2a4('0x1')]={'closed':{'type':Sequelize[_0xf2a4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf2a4('0x3')]},'disposition':{'type':Sequelize[_0xf2a4('0x4')]},'secondDisposition':{'type':Sequelize[_0xf2a4('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf2a4('0x4')]},'note':{'type':Sequelize[_0xf2a4('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf2a4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf2a4('0x5')]('in',_0xf2a4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf2a4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf2a4('0x5')]('in',_0xf2a4('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ddc3a95..b8637aa 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 _0xf167=['findAll','setTags','ids','spread','Tag','faxInteractionTags:save','removeTags','toString','join','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','download','log','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','FaxInteraction','rawAttributes','type','key','getOptions','fax','user','catch','show','params','model','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','omit','getMessages','findOne','keys','FaxMessage','nolimit','sort','where','pick','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x99ee07,_0x3ff597){var _0x323cda=function(_0x49d285){while(--_0x49d285){_0x99ee07['push'](_0x99ee07['shift']());}};_0x323cda(++_0x3ff597);}(_0xf167,0x19e));var _0x7f16=function(_0x1fa805,_0x33eb74){_0x1fa805=_0x1fa805-0x0;var _0x30958c=_0xf167[_0x1fa805];return _0x30958c;};'use strict';var rimraf=require(_0x7f16('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7f16('0x1'));var BPromise=require(_0x7f16('0x2'));var util=require(_0x7f16('0x3'));var path=require(_0x7f16('0x4'));var fs=require('fs');var _=require(_0x7f16('0x5'));var Redis=require(_0x7f16('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x7f16('0x7'));var logger=require(_0x7f16('0x8'))(_0x7f16('0x9'));var config=require(_0x7f16('0xa'));var db=require('../../mysqldb')['db'];config[_0x7f16('0xb')]=_[_0x7f16('0xc')](config[_0x7f16('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f16('0xd'))(new Redis(config[_0x7f16('0xb')]));require(_0x7f16('0xe'))[_0x7f16('0xf')](socket);function respondWithStatusCode(_0xae4e40,_0x38fb66){_0x38fb66=_0x38fb66||0xcc;return function(_0x5410eb){if(_0x5410eb){return _0xae4e40[_0x7f16('0x10')](_0x38fb66);}return _0xae4e40['status'](_0x38fb66)[_0x7f16('0x11')]();};}function respondWithResult(_0x263cd4,_0x2daa44){_0x2daa44=_0x2daa44||0xc8;return function(_0x30843c){if(_0x30843c){return _0x263cd4[_0x7f16('0x12')](_0x2daa44)[_0x7f16('0x13')](_0x30843c);}};}function respondWithFilteredResult(_0x21b257,_0x473ed5){return function(_0x5c5288){if(_0x5c5288){var _0x1b6475=typeof _0x473ed5['offset']===_0x7f16('0x14')&&typeof _0x473ed5[_0x7f16('0x15')]===_0x7f16('0x14');var _0xfe6b91=_0x5c5288[_0x7f16('0x16')];var _0x4ec1ad=_0x1b6475?0x0:_0x473ed5[_0x7f16('0x17')];var _0x11f197=_0x1b6475?_0x5c5288[_0x7f16('0x16')]:_0x473ed5[_0x7f16('0x17')]+_0x473ed5[_0x7f16('0x15')];var _0x4f5335;if(_0x11f197>=_0xfe6b91){_0x11f197=_0xfe6b91;_0x4f5335=0xc8;}else{_0x4f5335=0xce;}_0x21b257[_0x7f16('0x12')](_0x4f5335);return _0x21b257[_0x7f16('0x18')](_0x7f16('0x19'),_0x4ec1ad+'-'+_0x11f197+'/'+_0xfe6b91)[_0x7f16('0x13')](_0x5c5288);}return null;};}function saveUpdates(_0x5ac40a){return function(_0x3805bd){if(_0x3805bd){return _0x3805bd[_0x7f16('0x1a')](_0x5ac40a)[_0x7f16('0x1b')](function(_0x5ade6a){return _0x5ade6a;});}return null;};}function removeEntity(_0x1ca758){return function(_0x4c270b){if(_0x4c270b){return _0x4c270b[_0x7f16('0x1c')]()[_0x7f16('0x1b')](function(){_0x1ca758[_0x7f16('0x12')](0xcc)[_0x7f16('0x11')]();});}};}function handleEntityNotFound(_0x4a1272){return function(_0x4bc4a2){if(!_0x4bc4a2){_0x4a1272['sendStatus'](0x194);}return _0x4bc4a2;};}function handleError(_0x992a77,_0x1fed58){_0x1fed58=_0x1fed58||0x1f4;return function(_0x5a5527){logger[_0x7f16('0x1d')](_0x5a5527[_0x7f16('0x1e')]);if(_0x5a5527['name']){delete _0x5a5527[_0x7f16('0x1f')];}_0x992a77[_0x7f16('0x12')](_0x1fed58)['send'](_0x5a5527);};}exports['index']=function(_0x5a5a23,_0x55be66){var _0x24982a={};var _0x2c201f=_['map'](db[_0x7f16('0x20')][_0x7f16('0x21')],function(_0x5586e7){return{'name':_0x5586e7['fieldName'],'type':_0x5586e7[_0x7f16('0x22')][_0x7f16('0x23')]};});_0x24982a=qs[_0x7f16('0x24')](_0x2c201f,_0x5a5a23);return interaction['findAll'](_0x7f16('0x25'),_0x5a5a23['query'],_0x5a5a23[_0x7f16('0x26')],_0x24982a,_0x2c201f)['then'](respondWithFilteredResult(_0x55be66,_0x24982a))[_0x7f16('0x27')](handleError(_0x55be66,null));};exports[_0x7f16('0x28')]=function(_0x143053,_0x54f745){var _0x3437ec={'raw':![],'where':{'id':_0x143053[_0x7f16('0x29')]['id']}},_0x3f8271={};_0x3f8271[_0x7f16('0x2a')]=_['keys'](db[_0x7f16('0x20')][_0x7f16('0x21')]);_0x3f8271[_0x7f16('0x2b')]=_['keys'](_0x143053[_0x7f16('0x2b')]);_0x3f8271[_0x7f16('0x2c')]=_[_0x7f16('0x2d')](_0x3f8271[_0x7f16('0x2a')],_0x3f8271[_0x7f16('0x2b')]);_0x3437ec['attributes']=_['intersection'](_0x3f8271['model'],qs[_0x7f16('0x2e')](_0x143053[_0x7f16('0x2b')][_0x7f16('0x2e')]));_0x3437ec[_0x7f16('0x2f')]=_0x3437ec[_0x7f16('0x2f')][_0x7f16('0x30')]?_0x3437ec[_0x7f16('0x2f')]:_0x3f8271[_0x7f16('0x2a')];if(_0x143053[_0x7f16('0x2b')][_0x7f16('0x31')]){_0x3437ec[_0x7f16('0x32')]=[{'all':!![]}];}_0x3437ec=_[_0x7f16('0x33')]({},_0x3437ec,_0x143053[_0x7f16('0x34')]);return db[_0x7f16('0x20')][_0x7f16('0x35')](_0x3437ec)[_0x7f16('0x1b')](handleEntityNotFound(_0x54f745,null))[_0x7f16('0x1b')](respondWithResult(_0x54f745,null))[_0x7f16('0x27')](handleError(_0x54f745,null));};exports[_0x7f16('0x36')]=function(_0x422f06,_0x41e52d){return db[_0x7f16('0x20')]['create'](_0x422f06['body'],{})[_0x7f16('0x1b')](respondWithResult(_0x41e52d,0xc9))[_0x7f16('0x27')](handleError(_0x41e52d,null));};exports['update']=function(_0x23aadf,_0x447069){if(_0x23aadf[_0x7f16('0x37')]['id']){delete _0x23aadf['body']['id'];}return db[_0x7f16('0x20')][_0x7f16('0x35')]({'where':{'id':_0x23aadf[_0x7f16('0x29')]['id']}})[_0x7f16('0x1b')](handleEntityNotFound(_0x447069,null))['then'](saveUpdates(_0x23aadf[_0x7f16('0x37')],null))['then'](respondWithResult(_0x447069,null))[_0x7f16('0x27')](handleError(_0x447069,null));};exports[_0x7f16('0x1c')]=function(_0x5b038a,_0x4fa05a){return db[_0x7f16('0x20')]['find']({'where':{'id':_0x5b038a['params']['id']}})[_0x7f16('0x1b')](handleEntityNotFound(_0x4fa05a,null))[_0x7f16('0x1b')](removeEntity(_0x4fa05a,null))['catch'](handleError(_0x4fa05a,null));};exports[_0x7f16('0x38')]=function(_0x18c539,_0x2fa430){return db[_0x7f16('0x20')][_0x7f16('0x38')]()[_0x7f16('0x1b')](respondWithResult(_0x2fa430,null))['catch'](handleError(_0x2fa430,null));};exports['addMessage']=function(_0x2a51e3,_0x12760f){return db['FaxMessage']['find']({'where':{'id':_0x2a51e3['params']['id']}})[_0x7f16('0x1b')](handleEntityNotFound(_0x12760f,null))[_0x7f16('0x1b')](function(_0x189085){if(_0x189085){return _0x189085['addMessage'](_0x2a51e3['body']['ids'],_[_0x7f16('0x39')](_0x2a51e3[_0x7f16('0x37')],['ids','id'])||{});}})[_0x7f16('0x1b')](respondWithResult(_0x12760f,null))[_0x7f16('0x27')](handleError(_0x12760f,null));};exports[_0x7f16('0x3a')]=function(_0x4076da,_0x427540){var _0x38f018={'raw':![],'where':{}};var _0x598ef4={};var _0x38b075={'count':0x0,'rows':[]};return db[_0x7f16('0x20')][_0x7f16('0x3b')]({'where':{'id':_0x4076da['params']['id']}})[_0x7f16('0x1b')](handleEntityNotFound(_0x427540,null))[_0x7f16('0x1b')](function(_0x4832b7){if(_0x4832b7){_0x598ef4['model']=_[_0x7f16('0x3c')](db[_0x7f16('0x3d')][_0x7f16('0x21')]);_0x598ef4['query']=_[_0x7f16('0x3c')](_0x4076da[_0x7f16('0x2b')]);_0x598ef4[_0x7f16('0x2c')]=_[_0x7f16('0x2d')](_0x598ef4[_0x7f16('0x2a')],_0x598ef4[_0x7f16('0x2b')]);_0x38f018[_0x7f16('0x2f')]=_[_0x7f16('0x2d')](_0x598ef4['model'],qs['fields'](_0x4076da[_0x7f16('0x2b')]['fields']));_0x38f018[_0x7f16('0x2f')]=_0x38f018[_0x7f16('0x2f')]['length']?_0x38f018[_0x7f16('0x2f')]:_0x598ef4[_0x7f16('0x2a')];if(!_0x4076da[_0x7f16('0x2b')]['hasOwnProperty'](_0x7f16('0x3e'))){_0x38f018[_0x7f16('0x15')]=qs[_0x7f16('0x15')](_0x4076da[_0x7f16('0x2b')][_0x7f16('0x15')]);_0x38f018[_0x7f16('0x17')]=qs[_0x7f16('0x17')](_0x4076da['query'][_0x7f16('0x17')]);}_0x38f018['order']=qs[_0x7f16('0x3f')](_0x4076da[_0x7f16('0x2b')][_0x7f16('0x3f')]);_0x38f018[_0x7f16('0x40')]=qs[_0x7f16('0x2c')](_[_0x7f16('0x41')](_0x4076da['query'],_0x598ef4[_0x7f16('0x2c')]));_0x38f018[_0x7f16('0x40')][_0x7f16('0x42')]=_0x4832b7['id'];if(_0x4076da[_0x7f16('0x2b')]['filter']){_0x38f018['where']=_['merge'](_0x38f018[_0x7f16('0x40')],{'$or':_['map'](_0x38f018['attributes'],function(_0x3d61f4){var _0x2a1dcf={};_0x2a1dcf[_0x3d61f4]={'$like':'%'+_0x4076da['query']['filter']+'%'};return _0x2a1dcf;})});}if(_0x4076da['query'][_0x7f16('0x43')]){var _0x388c2b=_0x4076da[_0x7f16('0x2b')]['$gte'][_0x7f16('0x44')](',');var _0x36031d={};_0x36031d[_0x388c2b[0x0]]={'$gte':moment(_0x388c2b[0x1])[_0x7f16('0x45')](_0x7f16('0x46'))};_0x38f018['where']=_[_0x7f16('0x33')](_0x38f018[_0x7f16('0x40')],_0x36031d);}_0x38f018=_[_0x7f16('0x33')]({},_0x38f018,_0x4076da[_0x7f16('0x34')]);return db[_0x7f16('0x3d')][_0x7f16('0x16')]({'where':_0x38f018[_0x7f16('0x40')]})[_0x7f16('0x1b')](function(_0x2624be){_0x38b075[_0x7f16('0x16')]=_0x2624be;if(_0x4076da[_0x7f16('0x2b')][_0x7f16('0x31')]){_0x38f018['include']=[{'all':!![]}];}return db['FaxMessage'][_0x7f16('0x47')](_0x38f018);})[_0x7f16('0x1b')](function(_0x5bdbcd){_0x38b075['rows']=_0x5bdbcd;return _0x38b075;});}})[_0x7f16('0x1b')](respondWithFilteredResult(_0x427540,_0x38f018))[_0x7f16('0x27')](handleError(_0x427540,null));};exports['addTags']=function(_0x4f8433,_0x46156f){return db[_0x7f16('0x20')][_0x7f16('0x35')]({'where':{'id':_0x4f8433['params']['id']}})[_0x7f16('0x1b')](handleEntityNotFound(_0x46156f,null))[_0x7f16('0x1b')](function(_0x89818c){if(_0x89818c){return _0x89818c[_0x7f16('0x48')](_0x4f8433['body'][_0x7f16('0x49')],_[_0x7f16('0x39')](_0x4f8433[_0x7f16('0x37')],[_0x7f16('0x49'),'id'])||{})[_0x7f16('0x4a')](function(){return db[_0x7f16('0x4b')][_0x7f16('0x47')]({'attributes':['id',_0x7f16('0x1f'),'color'],'where':{'id':_0x4f8433[_0x7f16('0x37')][_0x7f16('0x49')]}});})[_0x7f16('0x1b')](function(_0x333211){socket['emit'](_0x7f16('0x4c'),{'id':Number(_0x4f8433[_0x7f16('0x29')]['id']),'tags':_0x333211||[]});return{'id':Number(_0x4f8433[_0x7f16('0x29')]['id']),'tags':_0x333211||[]};});}})[_0x7f16('0x1b')](respondWithResult(_0x46156f,null))['catch'](handleError(_0x46156f,null));};exports['removeTags']=function(_0x412991,_0x45906c){return db[_0x7f16('0x20')][_0x7f16('0x35')]({'where':{'id':_0x412991[_0x7f16('0x29')]['id']}})['then'](handleEntityNotFound(_0x45906c,null))['then'](function(_0x3eda0e){if(_0x3eda0e){return _0x3eda0e[_0x7f16('0x4d')](_0x412991[_0x7f16('0x2b')]['ids']);}})[_0x7f16('0x1b')](respondWithStatusCode(_0x45906c,null))[_0x7f16('0x27')](handleError(_0x45906c,null));};exports['download']=function(_0x115d27,_0x3be836){var _0xc692dd=moment()['unix']()[_0x7f16('0x4e')]();var _0x227f13=path[_0x7f16('0x4f')](config['root'],'server',_0x7f16('0x50'),_0x7f16('0x51'));var _0x324939=path[_0x7f16('0x4f')](config[_0x7f16('0x52')],'server','files',_0x7f16('0x53'));var _0x2bdd69=path['join'](_0x227f13,_0xc692dd);var _0x3c9761=util[_0x7f16('0x45')](_0x7f16('0x54'),_0x115d27[_0x7f16('0x29')]['id'],_0xc692dd);var _0x4b6212=path['join'](_0x227f13,_0x3c9761);var _0x27bbcd=[];_0x27bbcd[_0x7f16('0x55')]({'model':db['Attachment'],'as':_0x7f16('0x56'),'raw':!![]});var _0x50e359=[{'model':db[_0x7f16('0x3d')],'as':_0x7f16('0x57'),'attributes':['id',_0x7f16('0x37'),'createdAt'],'include':_0x27bbcd}];return db[_0x7f16('0x20')][_0x7f16('0x35')]({'where':{'id':_0x115d27[_0x7f16('0x29')]['id']},'include':_0x50e359})[_0x7f16('0x1b')](handleEntityNotFound(_0x3be836,null))['then'](function(_0x3a5955){if(_0x3a5955&&_0x3a5955['Messages']){var _0x304ede=_0x3a5955[_0x7f16('0x58')]({'plain':!![]});fs[_0x7f16('0x59')](_0x2bdd69);for(var _0x109f91=0x0;_0x109f91<_0x304ede['Messages'][_0x7f16('0x30')];_0x109f91++){var _0x5dad1a=_0x304ede[_0x7f16('0x57')][_0x109f91][_0x7f16('0x56')];if(_0x5dad1a){var _0x5e0c55=path[_0x7f16('0x4f')](_0x324939,_0x5dad1a[_0x7f16('0x5a')]);if(fs[_0x7f16('0x5b')](_0x5e0c55)){fs[_0x7f16('0x5c')](_0x5e0c55)['pipe'](fs[_0x7f16('0x5d')](path[_0x7f16('0x4f')](_0x2bdd69,_0x5dad1a[_0x7f16('0x5a')])));}}}return BPromise['resolve']()[_0x7f16('0x1b')](function(){return new BPromise(function(_0x47bbd9,_0x551d9d){zipdir(_0x2bdd69,{'saveTo':_0x4b6212},function(_0x3b0640,_0x4ef6cb){if(_0x3b0640)return _0x551d9d(_0x3b0640);return _0x47bbd9(_0x4ef6cb);});})[_0x7f16('0x1b')](function(){return new BPromise(function(_0x54b6c5,_0xd8b527){rimraf(_0x2bdd69,function(_0x34eef5){if(_0x34eef5)_0xd8b527(_0x34eef5);return _0x54b6c5();});});})['then'](function(){return _0x3be836[_0x7f16('0x5e')](_0x4b6212,_0x3c9761,function(_0x4a26fb){if(_0x4a26fb){console[_0x7f16('0x5f')]('err',_0x4a26fb);}else{fs[_0x7f16('0x60')](_0x4b6212);}});});});}else{return _0x3be836[_0x7f16('0x10')](0xc8);}})[_0x7f16('0x27')](handleError(_0x3be836,null));}; \ No newline at end of file +var _0x6d40=['toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','find','create','body','destroy','describe','FaxMessage','ids','omit','getMessages','findOne','nolimit','limit','order','sort','where','filter','$gte','split','options','rows','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x6d40,0x7a));var _0x06d4=function(_0x2457b4,_0x48b064){_0x2457b4=_0x2457b4-0x0;var _0x1f2a70=_0x6d40[_0x2457b4];return _0x1f2a70;};'use strict';var rimraf=require(_0x06d4('0x0'));var zipdir=require(_0x06d4('0x1'));var moment=require(_0x06d4('0x2'));var BPromise=require(_0x06d4('0x3'));var util=require(_0x06d4('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x06d4('0x5'));var Redis=require(_0x06d4('0x6'));var interaction=require(_0x06d4('0x7'));var qs=require(_0x06d4('0x8'));var logger=require(_0x06d4('0x9'))(_0x06d4('0xa'));var config=require(_0x06d4('0xb'));var db=require('../../mysqldb')['db'];config[_0x06d4('0xc')]=_['defaults'](config[_0x06d4('0xc')],{'host':_0x06d4('0xd'),'port':0x18eb});var socket=require(_0x06d4('0xe'))(new Redis(config['redis']));require(_0x06d4('0xf'))[_0x06d4('0x10')](socket);function respondWithStatusCode(_0x2c7b90,_0x1cb1fc){_0x1cb1fc=_0x1cb1fc||0xcc;return function(_0x424836){if(_0x424836){return _0x2c7b90['sendStatus'](_0x1cb1fc);}return _0x2c7b90[_0x06d4('0x11')](_0x1cb1fc)['end']();};}function respondWithResult(_0x53a618,_0x38c2ca){_0x38c2ca=_0x38c2ca||0xc8;return function(_0x5e8ca4){if(_0x5e8ca4){return _0x53a618[_0x06d4('0x11')](_0x38c2ca)[_0x06d4('0x12')](_0x5e8ca4);}};}function respondWithFilteredResult(_0x528f09,_0x45cfe7){return function(_0x5c9898){if(_0x5c9898){var _0x136ea1=typeof _0x45cfe7[_0x06d4('0x13')]===_0x06d4('0x14')&&typeof _0x45cfe7['limit']===_0x06d4('0x14');var _0x538a7a=_0x5c9898[_0x06d4('0x15')];var _0x4760dc=_0x136ea1?0x0:_0x45cfe7['offset'];var _0x41e099=_0x136ea1?_0x5c9898[_0x06d4('0x15')]:_0x45cfe7[_0x06d4('0x13')]+_0x45cfe7['limit'];var _0x3c538e;if(_0x41e099>=_0x538a7a){_0x41e099=_0x538a7a;_0x3c538e=0xc8;}else{_0x3c538e=0xce;}_0x528f09[_0x06d4('0x11')](_0x3c538e);return _0x528f09['set'](_0x06d4('0x16'),_0x4760dc+'-'+_0x41e099+'/'+_0x538a7a)[_0x06d4('0x12')](_0x5c9898);}return null;};}function saveUpdates(_0xa41842){return function(_0x9b4e8c){if(_0x9b4e8c){return _0x9b4e8c[_0x06d4('0x17')](_0xa41842)[_0x06d4('0x18')](function(_0x4f1055){return _0x4f1055;});}return null;};}function removeEntity(_0x4f9b4c){return function(_0x200174){if(_0x200174){return _0x200174['destroy']()[_0x06d4('0x18')](function(){_0x4f9b4c[_0x06d4('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fdd9d){return function(_0x1ebb3d){if(!_0x1ebb3d){_0x1fdd9d[_0x06d4('0x19')](0x194);}return _0x1ebb3d;};}function handleError(_0x53d1e7,_0x171d22){_0x171d22=_0x171d22||0x1f4;return function(_0x49e51f){logger[_0x06d4('0x1a')](_0x49e51f[_0x06d4('0x1b')]);if(_0x49e51f[_0x06d4('0x1c')]){delete _0x49e51f['name'];}_0x53d1e7[_0x06d4('0x11')](_0x171d22)[_0x06d4('0x1d')](_0x49e51f);};}exports[_0x06d4('0x1e')]=function(_0xc3d96c,_0x159bac){var _0x4854fd={};var _0x34b976=_['map'](db[_0x06d4('0x1f')][_0x06d4('0x20')],function(_0x33cfd9){return{'name':_0x33cfd9[_0x06d4('0x21')],'type':_0x33cfd9['type']['key']};});_0x4854fd=qs[_0x06d4('0x22')](_0x34b976,_0xc3d96c);return interaction[_0x06d4('0x23')](_0x06d4('0x24'),_0xc3d96c[_0x06d4('0x25')],_0xc3d96c[_0x06d4('0x26')],_0x4854fd,_0x34b976)['then'](respondWithFilteredResult(_0x159bac,_0x4854fd))[_0x06d4('0x27')](handleError(_0x159bac,null));};exports[_0x06d4('0x28')]=function(_0x54b142,_0x5eac28){var _0x352157={'raw':![],'where':{'id':_0x54b142[_0x06d4('0x29')]['id']}},_0x369a7a={};_0x369a7a['model']=_[_0x06d4('0x2a')](db[_0x06d4('0x1f')]['rawAttributes']);_0x369a7a[_0x06d4('0x25')]=_[_0x06d4('0x2a')](_0x54b142[_0x06d4('0x25')]);_0x369a7a[_0x06d4('0x2b')]=_[_0x06d4('0x2c')](_0x369a7a[_0x06d4('0x2d')],_0x369a7a['query']);_0x352157['attributes']=_[_0x06d4('0x2c')](_0x369a7a['model'],qs[_0x06d4('0x2e')](_0x54b142[_0x06d4('0x25')][_0x06d4('0x2e')]));_0x352157['attributes']=_0x352157[_0x06d4('0x2f')][_0x06d4('0x30')]?_0x352157[_0x06d4('0x2f')]:_0x369a7a[_0x06d4('0x2d')];if(_0x54b142[_0x06d4('0x25')][_0x06d4('0x31')]){_0x352157[_0x06d4('0x32')]=[{'all':!![]}];}_0x352157=_[_0x06d4('0x33')]({},_0x352157,_0x54b142['options']);return db[_0x06d4('0x1f')][_0x06d4('0x34')](_0x352157)[_0x06d4('0x18')](handleEntityNotFound(_0x5eac28,null))[_0x06d4('0x18')](respondWithResult(_0x5eac28,null))[_0x06d4('0x27')](handleError(_0x5eac28,null));};exports['create']=function(_0x27e868,_0x4269b7){return db[_0x06d4('0x1f')][_0x06d4('0x35')](_0x27e868[_0x06d4('0x36')],{})['then'](respondWithResult(_0x4269b7,0xc9))[_0x06d4('0x27')](handleError(_0x4269b7,null));};exports['update']=function(_0xeb813b,_0x4ebd91){if(_0xeb813b[_0x06d4('0x36')]['id']){delete _0xeb813b[_0x06d4('0x36')]['id'];}return db[_0x06d4('0x1f')][_0x06d4('0x34')]({'where':{'id':_0xeb813b['params']['id']}})['then'](handleEntityNotFound(_0x4ebd91,null))[_0x06d4('0x18')](saveUpdates(_0xeb813b[_0x06d4('0x36')],null))[_0x06d4('0x18')](respondWithResult(_0x4ebd91,null))[_0x06d4('0x27')](handleError(_0x4ebd91,null));};exports[_0x06d4('0x37')]=function(_0x806c8d,_0x598314){return db[_0x06d4('0x1f')]['find']({'where':{'id':_0x806c8d[_0x06d4('0x29')]['id']}})[_0x06d4('0x18')](handleEntityNotFound(_0x598314,null))[_0x06d4('0x18')](removeEntity(_0x598314,null))['catch'](handleError(_0x598314,null));};exports[_0x06d4('0x38')]=function(_0x96d4ef,_0x23c61a){return db[_0x06d4('0x1f')]['describe']()[_0x06d4('0x18')](respondWithResult(_0x23c61a,null))[_0x06d4('0x27')](handleError(_0x23c61a,null));};exports['addMessage']=function(_0x107877,_0x4d4f13){return db[_0x06d4('0x39')][_0x06d4('0x34')]({'where':{'id':_0x107877['params']['id']}})[_0x06d4('0x18')](handleEntityNotFound(_0x4d4f13,null))[_0x06d4('0x18')](function(_0x583704){if(_0x583704){return _0x583704['addMessage'](_0x107877[_0x06d4('0x36')][_0x06d4('0x3a')],_[_0x06d4('0x3b')](_0x107877[_0x06d4('0x36')],[_0x06d4('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x4d4f13,null))[_0x06d4('0x27')](handleError(_0x4d4f13,null));};exports[_0x06d4('0x3c')]=function(_0x19699e,_0x47761e){var _0x1a7e60={'raw':![],'where':{}};var _0x3382dd={};var _0x221d10={'count':0x0,'rows':[]};return db[_0x06d4('0x1f')][_0x06d4('0x3d')]({'where':{'id':_0x19699e['params']['id']}})[_0x06d4('0x18')](handleEntityNotFound(_0x47761e,null))[_0x06d4('0x18')](function(_0x4181cc){if(_0x4181cc){_0x3382dd['model']=_[_0x06d4('0x2a')](db[_0x06d4('0x39')]['rawAttributes']);_0x3382dd[_0x06d4('0x25')]=_[_0x06d4('0x2a')](_0x19699e['query']);_0x3382dd[_0x06d4('0x2b')]=_[_0x06d4('0x2c')](_0x3382dd['model'],_0x3382dd[_0x06d4('0x25')]);_0x1a7e60['attributes']=_[_0x06d4('0x2c')](_0x3382dd[_0x06d4('0x2d')],qs[_0x06d4('0x2e')](_0x19699e[_0x06d4('0x25')][_0x06d4('0x2e')]));_0x1a7e60[_0x06d4('0x2f')]=_0x1a7e60['attributes'][_0x06d4('0x30')]?_0x1a7e60[_0x06d4('0x2f')]:_0x3382dd[_0x06d4('0x2d')];if(!_0x19699e[_0x06d4('0x25')]['hasOwnProperty'](_0x06d4('0x3e'))){_0x1a7e60[_0x06d4('0x3f')]=qs['limit'](_0x19699e[_0x06d4('0x25')][_0x06d4('0x3f')]);_0x1a7e60[_0x06d4('0x13')]=qs['offset'](_0x19699e[_0x06d4('0x25')][_0x06d4('0x13')]);}_0x1a7e60[_0x06d4('0x40')]=qs[_0x06d4('0x41')](_0x19699e[_0x06d4('0x25')]['sort']);_0x1a7e60[_0x06d4('0x42')]=qs[_0x06d4('0x2b')](_['pick'](_0x19699e[_0x06d4('0x25')],_0x3382dd[_0x06d4('0x2b')]));_0x1a7e60['where']['FaxInteractionId']=_0x4181cc['id'];if(_0x19699e[_0x06d4('0x25')]['filter']){_0x1a7e60['where']=_[_0x06d4('0x33')](_0x1a7e60[_0x06d4('0x42')],{'$or':_['map'](_0x1a7e60[_0x06d4('0x2f')],function(_0x31e4b2){var _0xcab585={};_0xcab585[_0x31e4b2]={'$like':'%'+_0x19699e[_0x06d4('0x25')][_0x06d4('0x43')]+'%'};return _0xcab585;})});}if(_0x19699e['query'][_0x06d4('0x44')]){var _0x20587a=_0x19699e[_0x06d4('0x25')][_0x06d4('0x44')][_0x06d4('0x45')](',');var _0x3fd630={};_0x3fd630[_0x20587a[0x0]]={'$gte':moment(_0x20587a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1a7e60[_0x06d4('0x42')]=_[_0x06d4('0x33')](_0x1a7e60[_0x06d4('0x42')],_0x3fd630);}_0x1a7e60=_[_0x06d4('0x33')]({},_0x1a7e60,_0x19699e[_0x06d4('0x46')]);return db['FaxMessage'][_0x06d4('0x15')]({'where':_0x1a7e60[_0x06d4('0x42')]})[_0x06d4('0x18')](function(_0x48e839){_0x221d10[_0x06d4('0x15')]=_0x48e839;if(_0x19699e[_0x06d4('0x25')][_0x06d4('0x31')]){_0x1a7e60[_0x06d4('0x32')]=[{'all':!![]}];}return db['FaxMessage'][_0x06d4('0x23')](_0x1a7e60);})[_0x06d4('0x18')](function(_0x423e65){_0x221d10[_0x06d4('0x47')]=_0x423e65;return _0x221d10;});}})['then'](respondWithFilteredResult(_0x47761e,_0x1a7e60))[_0x06d4('0x27')](handleError(_0x47761e,null));};exports[_0x06d4('0x48')]=function(_0x370598,_0x4f9dc6){return db[_0x06d4('0x1f')][_0x06d4('0x34')]({'where':{'id':_0x370598[_0x06d4('0x29')]['id']}})[_0x06d4('0x18')](handleEntityNotFound(_0x4f9dc6,null))[_0x06d4('0x18')](function(_0x542e62){if(_0x542e62){return _0x542e62[_0x06d4('0x49')](_0x370598['body'][_0x06d4('0x3a')],_[_0x06d4('0x3b')](_0x370598[_0x06d4('0x36')],[_0x06d4('0x3a'),'id'])||{})[_0x06d4('0x4a')](function(){return db['Tag'][_0x06d4('0x23')]({'attributes':['id',_0x06d4('0x1c'),'color'],'where':{'id':_0x370598[_0x06d4('0x36')][_0x06d4('0x3a')]}});})[_0x06d4('0x18')](function(_0x4e1c79){socket[_0x06d4('0x4b')](_0x06d4('0x4c'),{'id':Number(_0x370598[_0x06d4('0x29')]['id']),'tags':_0x4e1c79||[]});return{'id':Number(_0x370598[_0x06d4('0x29')]['id']),'tags':_0x4e1c79||[]};});}})[_0x06d4('0x18')](respondWithResult(_0x4f9dc6,null))['catch'](handleError(_0x4f9dc6,null));};exports['removeTags']=function(_0x447a1f,_0x483006){return db[_0x06d4('0x1f')][_0x06d4('0x34')]({'where':{'id':_0x447a1f['params']['id']}})[_0x06d4('0x18')](handleEntityNotFound(_0x483006,null))[_0x06d4('0x18')](function(_0x56f878){if(_0x56f878){return _0x56f878[_0x06d4('0x4d')](_0x447a1f[_0x06d4('0x25')][_0x06d4('0x3a')]);}})[_0x06d4('0x18')](respondWithStatusCode(_0x483006,null))[_0x06d4('0x27')](handleError(_0x483006,null));};exports[_0x06d4('0x4e')]=function(_0x2465e7,_0x4b9fd5){var _0xa7ac63=moment()[_0x06d4('0x4f')]()[_0x06d4('0x50')]();var _0x5074c9=path[_0x06d4('0x51')](config[_0x06d4('0x52')],_0x06d4('0x53'),_0x06d4('0x54'),_0x06d4('0x55'));var _0x1d5572=path[_0x06d4('0x51')](config['root'],_0x06d4('0x53'),_0x06d4('0x54'),_0x06d4('0x56'));var _0x21b421=path[_0x06d4('0x51')](_0x5074c9,_0xa7ac63);var _0x5a530c=util[_0x06d4('0x57')](_0x06d4('0x58'),_0x2465e7[_0x06d4('0x29')]['id'],_0xa7ac63);var _0x53951e=path[_0x06d4('0x51')](_0x5074c9,_0x5a530c);var _0x4775c8=[];_0x4775c8['push']({'model':db[_0x06d4('0x59')],'as':_0x06d4('0x59'),'raw':!![]});var _0x537a72=[{'model':db[_0x06d4('0x39')],'as':_0x06d4('0x5a'),'attributes':['id',_0x06d4('0x36'),_0x06d4('0x5b')],'include':_0x4775c8}];return db['FaxInteraction'][_0x06d4('0x34')]({'where':{'id':_0x2465e7['params']['id']},'include':_0x537a72})[_0x06d4('0x18')](handleEntityNotFound(_0x4b9fd5,null))[_0x06d4('0x18')](function(_0x56e539){if(_0x56e539&&_0x56e539[_0x06d4('0x5a')]){var _0x58a386=_0x56e539['get']({'plain':!![]});fs['mkdirSync'](_0x21b421);for(var _0x2930ff=0x0;_0x2930ff<_0x58a386[_0x06d4('0x5a')]['length'];_0x2930ff++){var _0x3212d8=_0x58a386[_0x06d4('0x5a')][_0x2930ff]['Attachment'];if(_0x3212d8){var _0x543243=path[_0x06d4('0x51')](_0x1d5572,_0x3212d8[_0x06d4('0x5c')]);if(fs[_0x06d4('0x5d')](_0x543243)){fs[_0x06d4('0x5e')](_0x543243)[_0x06d4('0x5f')](fs[_0x06d4('0x60')](path[_0x06d4('0x51')](_0x21b421,_0x3212d8[_0x06d4('0x5c')])));}}}return BPromise[_0x06d4('0x61')]()[_0x06d4('0x18')](function(){return new BPromise(function(_0x2748dc,_0xc80540){zipdir(_0x21b421,{'saveTo':_0x53951e},function(_0x4c93d3,_0x33d0f4){if(_0x4c93d3)return _0xc80540(_0x4c93d3);return _0x2748dc(_0x33d0f4);});})['then'](function(){return new BPromise(function(_0x4e218e,_0x5d181d){rimraf(_0x21b421,function(_0x14216e){if(_0x14216e)_0x5d181d(_0x14216e);return _0x4e218e();});});})[_0x06d4('0x18')](function(){return _0x4b9fd5[_0x06d4('0x4e')](_0x53951e,_0x5a530c,function(_0x5625b0){if(_0x5625b0){console[_0x06d4('0x62')](_0x06d4('0x63'),_0x5625b0);}else{fs[_0x06d4('0x64')](_0x53951e);}});});});}else{return _0x4b9fd5['sendStatus'](0xc8);}})[_0x06d4('0x27')](handleError(_0x4b9fd5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f506244..a298625 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 _0x727b=['hook','exports','events','../../mysqldb','FaxMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4adbb0,_0x5f5a74){var _0x5e235c=function(_0x3e84e7){while(--_0x3e84e7){_0x4adbb0['push'](_0x4adbb0['shift']());}};_0x5e235c(++_0x5f5a74);}(_0x727b,0x6e));var _0xb727=function(_0xe9013e,_0x44a7fb){_0xe9013e=_0xe9013e-0x0;var _0x500765=_0x727b[_0xe9013e];return _0x500765;};'use strict';var EventEmitter=require(_0xb727('0x0'));var FaxInteraction=require(_0xb727('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xb727('0x1'))['db'][_0xb727('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb727('0x3'),'afterUpdate':'update','afterDestroy':_0xb727('0x4')};function emitEvent(_0x155ff0){return function(_0x24c9a7,_0x7431c1,_0x56fe73){_0x24c9a7[_0xb727('0x5')]({'attributes':['id'],'raw':!![]})[_0xb727('0x6')](function(_0x18d64c){_0x24c9a7[_0xb727('0x7')](_0xb727('0x8'),_0x18d64c[_0xb727('0x9')](function(_0x47a34f){return{'id':_0x47a34f['id']};}));return FaxMessage[_0xb727('0xa')]({'where':{'FaxInteractionId':_0x24c9a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb727('0x6')](function(_0xa68989){_0x24c9a7[_0xb727('0x7')](_0xb727('0xb'),_0xa68989[_0xb727('0xc')]);FaxInteractionEvents['emit'](_0x155ff0+':'+_0x24c9a7['id'],_0x24c9a7);FaxInteractionEvents[_0xb727('0xd')](_0x155ff0,_0x24c9a7);_0x56fe73(null);})[_0xb727('0xe')](_0x56fe73(null));};}for(var e in events){if(events[_0xb727('0xf')](e)){var event=events[e];FaxInteraction[_0xb727('0x10')](e,emitEvent(event));}}module[_0xb727('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x2654=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0xfa280c,_0x39a349){var _0x278019=function(_0x56ddfb){while(--_0x56ddfb){_0xfa280c['push'](_0xfa280c['shift']());}};_0x278019(++_0x39a349);}(_0x2654,0x1cd));var _0x4265=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x2654[_0x1937c8];return _0x48bedf;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x4265('0x0'))['db'][_0x4265('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4265('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4265('0x3'),'afterDestroy':_0x4265('0x4')};function emitEvent(_0x25d20a){return function(_0x38c905,_0x37021c,_0x228f63){_0x38c905[_0x4265('0x5')]({'attributes':['id'],'raw':!![]})[_0x4265('0x6')](function(_0x55ae65){_0x38c905[_0x4265('0x7')](_0x4265('0x8'),_0x55ae65[_0x4265('0x9')](function(_0x2f5d25){return{'id':_0x2f5d25['id']};}));return FaxMessage[_0x4265('0xa')]({'where':{'FaxInteractionId':_0x38c905['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4265('0x6')](function(_0x3de209){_0x38c905['setDataValue'](_0x4265('0xb'),_0x3de209[_0x4265('0xc')]);FaxInteractionEvents[_0x4265('0xd')](_0x25d20a+':'+_0x38c905['id'],_0x38c905);FaxInteractionEvents[_0x4265('0xd')](_0x25d20a,_0x38c905);_0x228f63(null);})['catch'](_0x228f63(null));};}for(var e in events){if(events[_0x4265('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4265('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c01634f..ea5d057 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 _0xfed6=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xfed6,0x14a));var _0x6fed=function(_0x2a696e,_0x40f973){_0x2a696e=_0x2a696e-0x0;var _0x17242d=_0xfed6[_0x2a696e];return _0x17242d;};'use strict';var _=require(_0x6fed('0x0'));var util=require(_0x6fed('0x1'));var logger=require(_0x6fed('0x2'))(_0x6fed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6fed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fed('0x5'));var config=require(_0x6fed('0x6'));var attributes=require(_0x6fed('0x7'));module[_0x6fed('0x8')]=function(_0x571665,_0x27f596){return _0x571665[_0x6fed('0x9')](_0x6fed('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481db5,_0x3f7c13,_0x590d82){if(_0x481db5['changed'](_0x6fed('0xb'))){_0x481db5[_0x6fed('0xc')]=moment()[_0x6fed('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x590d82(null,_0x481db5);}}});}; \ No newline at end of file +var _0xbb3e=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x36a38a,_0x2d0457){var _0x25e3a0=function(_0x5cbb93){while(--_0x5cbb93){_0x36a38a['push'](_0x36a38a['shift']());}};_0x25e3a0(++_0x2d0457);}(_0xbb3e,0x181));var _0xebb3=function(_0x176ea8,_0x3d73e9){_0x176ea8=_0x176ea8-0x0;var _0x42405e=_0xbb3e[_0x176ea8];return _0x42405e;};'use strict';var _=require(_0xebb3('0x0'));var util=require(_0xebb3('0x1'));var logger=require(_0xebb3('0x2'))(_0xebb3('0x3'));var moment=require('moment');var BPromise=require(_0xebb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebb3('0x5'));var rimraf=require(_0xebb3('0x6'));var config=require(_0xebb3('0x7'));var attributes=require(_0xebb3('0x8'));module[_0xebb3('0x9')]=function(_0x112b0b,_0x225d4b){return _0x112b0b[_0xebb3('0xa')](_0xebb3('0xb'),attributes,{'tableName':_0xebb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a907a,_0x9d4c5a,_0x396ce9){if(_0x1a907a[_0xebb3('0xd')](_0xebb3('0xe'))){_0x1a907a[_0xebb3('0xf')]=moment()[_0xebb3('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x396ce9(null,_0x1a907a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dc2c93b..dae2d25 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 _0xa052=['message','result','FaxInteraction','update','body','options','raw','where','attributes','limit','then','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','redis','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa052,0x1e6));var _0x2a05=function(_0x27f0d1,_0x1f34a3){_0x27f0d1=_0x27f0d1-0x0;var _0x35bf17=_0xa052[_0x27f0d1];return _0x35bf17;};'use strict';var _=require(_0x2a05('0x0'));var util=require('util');var moment=require(_0x2a05('0x1'));var BPromise=require(_0x2a05('0x2'));var rs=require(_0x2a05('0x3'));var fs=require('fs');var Redis=require(_0x2a05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a05('0x5'));var logger=require('../../config/logger')(_0x2a05('0x6'));var config=require(_0x2a05('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2a05('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2a05('0x9'))(new Redis(config['redis']));require(_0x2a05('0xa'))[_0x2a05('0xb')](socket);function respondWithRpcPromise(_0xa68cb1,_0x240841,_0x4e1c47){return new BPromise(function(_0xc265b4,_0x457545){return client[_0x2a05('0xc')](_0xa68cb1,_0x4e1c47)['then'](function(_0x52c8e2){logger[_0x2a05('0xd')](_0x2a05('0xe'),_0x240841,'request\x20sent');logger[_0x2a05('0xf')](_0x2a05('0x10'),_0x240841,_0x2a05('0x11'),JSON[_0x2a05('0x12')](_0x52c8e2));if(_0x52c8e2[_0x2a05('0x13')]){if(_0x52c8e2[_0x2a05('0x13')][_0x2a05('0x14')]===0x1f4){logger[_0x2a05('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x240841,_0x52c8e2['error'][_0x2a05('0x15')]);return _0x457545(_0x52c8e2['error']['message']);}logger['error'](_0x2a05('0xe'),_0x240841,_0x52c8e2[_0x2a05('0x13')][_0x2a05('0x15')]);return _0xc265b4(_0x52c8e2['error']['message']);}else{logger[_0x2a05('0xd')]('FaxInteraction,\x20%s,\x20%s',_0x240841,'request\x20sent');_0xc265b4(_0x52c8e2[_0x2a05('0x16')]['message']);}})['catch'](function(_0xac839f){logger[_0x2a05('0x13')](_0x2a05('0xe'),_0x240841,_0xac839f);_0x457545(_0xac839f);});});}exports['UpdateFaxInteraction']=function(_0x142494){var _0x386f33=this;return new Promise(function(_0x46135b,_0x2bf2e5){return db[_0x2a05('0x17')][_0x2a05('0x18')](_0x142494[_0x2a05('0x19')],{'raw':_0x142494['options']?_0x142494[_0x2a05('0x1a')][_0x2a05('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142494[_0x2a05('0x1a')]?_0x142494['options'][_0x2a05('0x1c')]||null:null,'attributes':_0x142494[_0x2a05('0x1a')]?_0x142494[_0x2a05('0x1a')][_0x2a05('0x1d')]||null:null,'limit':_0x142494['options']?_0x142494[_0x2a05('0x1a')][_0x2a05('0x1e')]||null:null})[_0x2a05('0x1f')](function(_0x2eb18e){logger['info'](_0x2a05('0x20'),_0x142494);logger[_0x2a05('0xf')](_0x2a05('0x20'),_0x142494,JSON[_0x2a05('0x12')](_0x2eb18e));_0x46135b(_0x2eb18e);})[_0x2a05('0x21')](function(_0x37af44){logger[_0x2a05('0x13')]('UpdateFaxInteraction',_0x37af44[_0x2a05('0x15')],_0x142494);_0x2bf2e5(_0x386f33[_0x2a05('0x13')](0x1f4,_0x37af44['message']));});});};exports[_0x2a05('0x22')]=function(_0x16e0af){return new Promise(function(_0x2ba7a8,_0x312d43){return db[_0x2a05('0x17')]['find']({'where':_0x16e0af['options']?_0x16e0af[_0x2a05('0x1a')][_0x2a05('0x1c')]||null:null})[_0x2a05('0x1f')](function(_0x56d122){if(_0x56d122){return _0x56d122[_0x2a05('0x23')](_0x16e0af[_0x2a05('0x19')][_0x2a05('0x24')],_[_0x2a05('0x25')](_0x16e0af['body'],[_0x2a05('0x24'),'id'])||{});}})['spread'](function(_0x24ab9f){logger['info'](_0x2a05('0x26'),_0x16e0af);logger[_0x2a05('0xf')](_0x2a05('0x26'),_0x16e0af,JSON[_0x2a05('0x12')](_0x24ab9f));_0x2ba7a8(_0x24ab9f);})[_0x2a05('0x21')](function(_0x4e7f5d){logger[_0x2a05('0x13')]('AddTags',_0x4e7f5d[_0x2a05('0x15')],_0x16e0af);_0x312d43(_this[_0x2a05('0x13')](0x1f4,_0x4e7f5d['message']));});});}; \ No newline at end of file +var _0x3a56=['./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','info','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','AddTagsToFaxInteraction','find','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3a56,0xb0));var _0x63a5=function(_0x5947f8,_0x305779){_0x5947f8=_0x5947f8-0x0;var _0x43888e=_0x3a56[_0x5947f8];return _0x43888e;};'use strict';var _=require('lodash');var util=require(_0x63a5('0x0'));var moment=require('moment');var BPromise=require(_0x63a5('0x1'));var rs=require(_0x63a5('0x2'));var fs=require('fs');var Redis=require(_0x63a5('0x3'));var db=require(_0x63a5('0x4'))['db'];var utils=require(_0x63a5('0x5'));var logger=require('../../config/logger')(_0x63a5('0x6'));var config=require(_0x63a5('0x7'));var jayson=require(_0x63a5('0x8'));var client=jayson[_0x63a5('0x9')]['http']({'port':0x232a});config[_0x63a5('0xa')]=_[_0x63a5('0xb')](config[_0x63a5('0xa')],{'host':_0x63a5('0xc'),'port':0x18eb});var socket=require(_0x63a5('0xd'))(new Redis(config[_0x63a5('0xa')]));require(_0x63a5('0xe'))[_0x63a5('0xf')](socket);function respondWithRpcPromise(_0x5cdbe5,_0x27f692,_0x1d3964){return new BPromise(function(_0x446291,_0x4a1c5d){return client[_0x63a5('0x10')](_0x5cdbe5,_0x1d3964)[_0x63a5('0x11')](function(_0x4eb0e9){logger['info'](_0x63a5('0x12'),_0x27f692,_0x63a5('0x13'));logger[_0x63a5('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x27f692,_0x63a5('0x13'),JSON[_0x63a5('0x15')](_0x4eb0e9));if(_0x4eb0e9['error']){if(_0x4eb0e9['error'][_0x63a5('0x16')]===0x1f4){logger['error'](_0x63a5('0x12'),_0x27f692,_0x4eb0e9['error'][_0x63a5('0x17')]);return _0x4a1c5d(_0x4eb0e9[_0x63a5('0x18')][_0x63a5('0x17')]);}logger[_0x63a5('0x18')](_0x63a5('0x12'),_0x27f692,_0x4eb0e9['error'][_0x63a5('0x17')]);return _0x446291(_0x4eb0e9[_0x63a5('0x18')]['message']);}else{logger[_0x63a5('0x19')](_0x63a5('0x12'),_0x27f692,'request\x20sent');_0x446291(_0x4eb0e9['result'][_0x63a5('0x17')]);}})[_0x63a5('0x1a')](function(_0x2ac303){logger[_0x63a5('0x18')](_0x63a5('0x12'),_0x27f692,_0x2ac303);_0x4a1c5d(_0x2ac303);});});}exports[_0x63a5('0x1b')]=function(_0x2a1965){var _0x2b483b=this;return new Promise(function(_0xe321ca,_0x2fc544){return db[_0x63a5('0x1c')][_0x63a5('0x1d')](_0x2a1965[_0x63a5('0x1e')],{'raw':_0x2a1965[_0x63a5('0x1f')]?_0x2a1965[_0x63a5('0x1f')][_0x63a5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1965[_0x63a5('0x1f')]?_0x2a1965[_0x63a5('0x1f')][_0x63a5('0x21')]||null:null,'attributes':_0x2a1965[_0x63a5('0x1f')]?_0x2a1965[_0x63a5('0x1f')]['attributes']||null:null,'limit':_0x2a1965[_0x63a5('0x1f')]?_0x2a1965[_0x63a5('0x1f')]['limit']||null:null})[_0x63a5('0x11')](function(_0x2459e4){logger[_0x63a5('0x19')](_0x63a5('0x1b'),_0x2a1965);logger[_0x63a5('0x14')](_0x63a5('0x1b'),_0x2a1965,JSON['stringify'](_0x2459e4));_0xe321ca(_0x2459e4);})[_0x63a5('0x1a')](function(_0x1d8e3d){logger[_0x63a5('0x18')]('UpdateFaxInteraction',_0x1d8e3d['message'],_0x2a1965);_0x2fc544(_0x2b483b[_0x63a5('0x18')](0x1f4,_0x1d8e3d['message']));});});};exports[_0x63a5('0x22')]=function(_0x25bdd2){return new Promise(function(_0x213b94,_0x4391bc){return db[_0x63a5('0x1c')][_0x63a5('0x23')]({'where':_0x25bdd2[_0x63a5('0x1f')]?_0x25bdd2[_0x63a5('0x1f')][_0x63a5('0x21')]||null:null})[_0x63a5('0x11')](function(_0x4504e7){if(_0x4504e7){return _0x4504e7['addTags'](_0x25bdd2['body']['ids'],_['omit'](_0x25bdd2[_0x63a5('0x1e')],['ids','id'])||{});}})[_0x63a5('0x24')](function(_0xb492ea){logger[_0x63a5('0x19')](_0x63a5('0x25'),_0x25bdd2);logger['debug'](_0x63a5('0x25'),_0x25bdd2,JSON[_0x63a5('0x15')](_0xb492ea));_0x213b94(_0xb492ea);})[_0x63a5('0x1a')](function(_0x14e3dd){logger['error'](_0x63a5('0x25'),_0x14e3dd[_0x63a5('0x17')],_0x25bdd2);_0x4391bc(_this['error'](0x1f4,_0x14e3dd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dc1a891..e5aa1e5 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 _0x9f8b=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','emit'];(function(_0xc1ba42,_0x3728a7){var _0xc74e0b=function(_0x25775a){while(--_0x25775a){_0xc1ba42['push'](_0xc1ba42['shift']());}};_0xc74e0b(++_0x3728a7);}(_0x9f8b,0x1a1));var _0xb9f8=function(_0x47d69e,_0x4ea1e9){_0x47d69e=_0x47d69e-0x0;var _0x3aa1e9=_0x9f8b[_0x47d69e];return _0x3aa1e9;};'use strict';var FaxInteractionEvents=require(_0xb9f8('0x0'));var events=[_0xb9f8('0x1'),'remove','update'];function createListener(_0x5f4184,_0x3cf339){return function(_0x135888){_0x3cf339[_0xb9f8('0x2')](_0x5f4184,_0x135888);};}function removeListener(_0x2cf68f,_0x4dbb02){return function(){FaxInteractionEvents[_0xb9f8('0x3')](_0x2cf68f,_0x4dbb02);};}exports[_0xb9f8('0x4')]=function(_0x5dd834){for(var _0xdf9046=0x0,_0x4730b6=events[_0xb9f8('0x5')];_0xdf9046<_0x4730b6;_0xdf9046++){var _0x49a561=events[_0xdf9046];var _0x1b6ff0=createListener(_0xb9f8('0x6')+_0x49a561,_0x5dd834);FaxInteractionEvents['on'](_0x49a561,_0x1b6ff0);}}; \ No newline at end of file +var _0x3437=['update','emit','removeListener','register','length','./faxInteraction.events','save'];(function(_0x116160,_0x4762a2){var _0x43a153=function(_0x2c215b){while(--_0x2c215b){_0x116160['push'](_0x116160['shift']());}};_0x43a153(++_0x4762a2);}(_0x3437,0x15c));var _0x7343=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3437[_0x21a9d9];return _0x46adce;};'use strict';var FaxInteractionEvents=require(_0x7343('0x0'));var events=[_0x7343('0x1'),'remove',_0x7343('0x2')];function createListener(_0x4f4a47,_0x1f4138){return function(_0x9f9659){_0x1f4138[_0x7343('0x3')](_0x4f4a47,_0x9f9659);};}function removeListener(_0x5d6676,_0x2ba001){return function(){FaxInteractionEvents[_0x7343('0x4')](_0x5d6676,_0x2ba001);};}exports[_0x7343('0x5')]=function(_0x2919ef){for(var _0x2d02e9=0x0,_0x360856=events[_0x7343('0x6')];_0x2d02e9<_0x360856;_0x2d02e9++){var _0x431197=events[_0x2d02e9];var _0xbe23d2=createListener('faxInteraction:'+_0x431197,_0x2919ef);FaxInteractionEvents['on'](_0x431197,_0xbe23d2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 29024ce..0134f8a 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 _0xd9cf=['/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','fax','faxinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x401ccb,_0x2186a1){var _0x142061=function(_0x37f104){while(--_0x37f104){_0x401ccb['push'](_0x401ccb['shift']());}};_0x142061(++_0x2186a1);}(_0xd9cf,0x16c));var _0xfd9c=function(_0x37554c,_0x8af708){_0x37554c=_0x37554c-0x0;var _0x57de0e=_0xd9cf[_0x37554c];return _0x57de0e;};'use strict';var multer=require('multer');var util=require(_0xfd9c('0x0'));var path=require('path');var timeout=require(_0xfd9c('0x1'));var express=require('express');var router=express[_0xfd9c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfd9c('0x3'));var interaction=require(_0xfd9c('0x4'));var config=require(_0xfd9c('0x5'));var controller=require('./faxInteraction.controller');router[_0xfd9c('0x6')]('/',auth[_0xfd9c('0x7')](),controller['index']);router[_0xfd9c('0x6')](_0xfd9c('0x8'),auth[_0xfd9c('0x7')](),controller[_0xfd9c('0x9')]);router[_0xfd9c('0x6')]('/:id',auth[_0xfd9c('0x7')](),controller[_0xfd9c('0xa')]);router[_0xfd9c('0x6')](_0xfd9c('0xb'),auth['isAuthenticated'](),controller[_0xfd9c('0xc')]);router['get'](_0xfd9c('0xd'),auth[_0xfd9c('0x7')](),controller[_0xfd9c('0xe')]);router[_0xfd9c('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd9c('0x10')]);router['post']('/:id/messages',auth[_0xfd9c('0x7')](),controller[_0xfd9c('0x11')]);router[_0xfd9c('0xf')](_0xfd9c('0x12'),auth['isAuthenticated'](),interaction[_0xfd9c('0x13')]('fax',_0xfd9c('0x14')),controller[_0xfd9c('0x15')]);router[_0xfd9c('0x16')](_0xfd9c('0x17'),auth['isAuthenticated'](),interaction[_0xfd9c('0x13')]('fax',_0xfd9c('0x18')),controller[_0xfd9c('0x19')]);router['delete'](_0xfd9c('0x17'),auth[_0xfd9c('0x7')](),interaction[_0xfd9c('0x13')](_0xfd9c('0x1a'),_0xfd9c('0x1b')),controller[_0xfd9c('0x1c')]);router['delete'](_0xfd9c('0x12'),auth[_0xfd9c('0x7')](),controller[_0xfd9c('0x1d')]);module[_0xfd9c('0x1e')]=router; \ No newline at end of file +var _0x760b=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe'];(function(_0x5d6ae2,_0x31e225){var _0x79df01=function(_0x408bb0){while(--_0x408bb0){_0x5d6ae2['push'](_0x5d6ae2['shift']());}};_0x79df01(++_0x31e225);}(_0x760b,0x95));var _0xb760=function(_0x208e31,_0x50e391){_0x208e31=_0x208e31-0x0;var _0x3091c2=_0x760b[_0x208e31];return _0x3091c2;};'use strict';var multer=require('multer');var util=require(_0xb760('0x0'));var path=require(_0xb760('0x1'));var timeout=require(_0xb760('0x2'));var express=require(_0xb760('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb760('0x4'));var interaction=require(_0xb760('0x5'));var config=require(_0xb760('0x6'));var controller=require(_0xb760('0x7'));router[_0xb760('0x8')]('/',auth[_0xb760('0x9')](),controller['index']);router[_0xb760('0x8')](_0xb760('0xa'),auth[_0xb760('0x9')](),controller[_0xb760('0xb')]);router['get'](_0xb760('0xc'),auth[_0xb760('0x9')](),controller[_0xb760('0xd')]);router[_0xb760('0x8')](_0xb760('0xe'),auth[_0xb760('0x9')](),controller[_0xb760('0xf')]);router[_0xb760('0x8')](_0xb760('0x10'),auth[_0xb760('0x9')](),controller[_0xb760('0x11')]);router['post']('/',auth[_0xb760('0x9')](),controller['create']);router[_0xb760('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb760('0x13')]);router[_0xb760('0x12')]('/:id/tags',auth[_0xb760('0x9')](),interaction[_0xb760('0x14')](_0xb760('0x15'),_0xb760('0x16')),controller[_0xb760('0x17')]);router[_0xb760('0x18')](_0xb760('0xc'),auth[_0xb760('0x9')](),interaction[_0xb760('0x14')](_0xb760('0x15'),'faxinteraction:update'),controller[_0xb760('0x19')]);router['delete'](_0xb760('0xc'),auth[_0xb760('0x9')](),interaction[_0xb760('0x14')](_0xb760('0x15'),_0xb760('0x1a')),controller[_0xb760('0x1b')]);router[_0xb760('0x1c')](_0xb760('0x1d'),auth[_0xb760('0x9')](),controller[_0xb760('0x1e')]);module[_0xb760('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8f3f2a6..5e84d31 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 _0x98d3=['exports','medium','ENUM','out','TEXT','sequelize'];(function(_0x21afa0,_0x1f7b19){var _0x55f0e4=function(_0x3e6406){while(--_0x3e6406){_0x21afa0['push'](_0x21afa0['shift']());}};_0x55f0e4(++_0x1f7b19);}(_0x98d3,0x173));var _0x398d=function(_0x270f69,_0x30420c){_0x270f69=_0x270f69-0x0;var _0xbc1b21=_0x98d3[_0x270f69];return _0xbc1b21;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x398d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x398d('0x3')]('in','out'),'defaultValue':_0x398d('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x398d('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xcea2=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x184e30,_0xbc916b){var _0x3a7767=function(_0x348e0d){while(--_0x348e0d){_0x184e30['push'](_0x184e30['shift']());}};_0x3a7767(++_0xbc916b);}(_0xcea2,0x15a));var _0x2cea=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcea2[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cea('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cea('0x3')]('in',_0x2cea('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2cea('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2cea('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8c2a3c1..a9035b5 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 _0xcba2=['reject','save','update','destroy','stack','name','send','map','FaxMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','findAll','rows','catch','show','params','length','includeAll','find','body','describe','fax-interactions','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','read1stAt','get','user','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','role','RejectMessage','User','rejectmessage','create','CmContact','findOne','isNil','SendFax','basename','AttachmentId','download','server','attachments','Attachment','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','limit','count','set','apply'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xcba2,0xdf));var _0x2cba=function(_0x2f8943,_0x5d1cac){_0x2f8943=_0x2f8943-0x0;var _0x44c63f=_0xcba2[_0x2f8943];return _0x44c63f;};'use strict';var emlformat=require(_0x2cba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2cba('0x1'));var rp=require(_0x2cba('0x2'));var moment=require(_0x2cba('0x3'));var BPromise=require(_0x2cba('0x4'));var Mustache=require('mustache');var util=require(_0x2cba('0x5'));var path=require(_0x2cba('0x6'));var sox=require('sox');var csv=require(_0x2cba('0x7'));var ejs=require(_0x2cba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cba('0x9'));var squel=require(_0x2cba('0xa'));var crypto=require(_0x2cba('0xb'));var jsforce=require(_0x2cba('0xc'));var deskjs=require(_0x2cba('0xd'));var toCsv=require(_0x2cba('0x7'));var querystring=require(_0x2cba('0xe'));var Papa=require('papaparse');var Redis=require(_0x2cba('0xf'));var authService=require(_0x2cba('0x10'));var qs=require(_0x2cba('0x11'));var as=require(_0x2cba('0x12'));var hardwareService=require(_0x2cba('0x13'));var logger=require(_0x2cba('0x14'))(_0x2cba('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cba('0x16'));var db=require(_0x2cba('0x17'))['db'];config[_0x2cba('0x18')]=_[_0x2cba('0x19')](config['redis'],{'host':_0x2cba('0x1a'),'port':0x18eb});var socket=require(_0x2cba('0x1b'))(new Redis(config['redis']));require(_0x2cba('0x1c'))[_0x2cba('0x1d')](socket);var jayson=require(_0x2cba('0x1e'));var client=jayson[_0x2cba('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2cba('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1e4d62,_0x50f2e3,_0x216801,_0x5f2205){return new BPromise(function(_0x29944c,_0x57ab17){var _0x2737fd=_0x5f2205||client;return _0x2737fd[_0x2cba('0x21')](_0x1e4d62,_0x216801)[_0x2cba('0x22')](function(_0x321439){logger['info'](_0x2cba('0x23'),_0x50f2e3,_0x2cba('0x24'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x50f2e3,_0x2cba('0x24'),JSON[_0x2cba('0x25')](_0x321439));if(_0x321439['error']){if(_0x321439[_0x2cba('0x26')]['code']===0x1f4){logger[_0x2cba('0x26')](_0x2cba('0x23'),_0x50f2e3,_0x321439[_0x2cba('0x26')]['message']);return _0x57ab17(_0x321439[_0x2cba('0x26')][_0x2cba('0x27')]);}logger['error'](_0x2cba('0x23'),_0x50f2e3,_0x321439['error']['message']);return _0x29944c(_0x321439[_0x2cba('0x26')]['message']);}else{logger[_0x2cba('0x28')](_0x2cba('0x23'),_0x50f2e3,_0x2cba('0x24'));_0x29944c(_0x321439[_0x2cba('0x29')][_0x2cba('0x27')]);}})['catch'](function(_0x271ab9){logger[_0x2cba('0x26')](_0x2cba('0x23'),_0x50f2e3,_0x271ab9);_0x57ab17(_0x271ab9);});});}function respondWithStatusCode(_0x52402e,_0x24e827){_0x24e827=_0x24e827||0xcc;return function(_0x1a0ed2){if(_0x1a0ed2){return _0x52402e[_0x2cba('0x2a')](_0x24e827);}return _0x52402e[_0x2cba('0x2b')](_0x24e827)['end']();};}function respondWithResult(_0x2ac322,_0x71bf1a){_0x71bf1a=_0x71bf1a||0xc8;return function(_0x3a9c48){if(_0x3a9c48){return _0x2ac322[_0x2cba('0x2b')](_0x71bf1a)[_0x2cba('0x2c')](_0x3a9c48);}};}function respondWithFilteredResult(_0x3c655b,_0x44cde2){return function(_0x4033b3){if(_0x4033b3){var _0x10d77b=typeof _0x44cde2[_0x2cba('0x2d')]===_0x2cba('0x2e')&&typeof _0x44cde2[_0x2cba('0x2f')]===_0x2cba('0x2e');var _0x1d3641=_0x4033b3[_0x2cba('0x30')];var _0x354e19=_0x10d77b?0x0:_0x44cde2['offset'];var _0x12ed05=_0x10d77b?_0x4033b3[_0x2cba('0x30')]:_0x44cde2[_0x2cba('0x2d')]+_0x44cde2[_0x2cba('0x2f')];var _0xbc9809;if(_0x12ed05>=_0x1d3641){_0x12ed05=_0x1d3641;_0xbc9809=0xc8;}else{_0xbc9809=0xce;}_0x3c655b[_0x2cba('0x2b')](_0xbc9809);return _0x3c655b[_0x2cba('0x31')]('Content-Range',_0x354e19+'-'+_0x12ed05+'/'+_0x1d3641)['json'](_0x4033b3);}return null;};}function patchUpdates(_0x391341){return function(_0xa39a70){try{jsonpatch[_0x2cba('0x32')](_0xa39a70,_0x391341,!![]);}catch(_0x1f7f7e){return BPromise[_0x2cba('0x33')](_0x1f7f7e);}return _0xa39a70[_0x2cba('0x34')]();};}function saveUpdates(_0x3aaa79,_0x5cb881){return function(_0x3cdeac){if(_0x3cdeac){return _0x3cdeac[_0x2cba('0x35')](_0x3aaa79)[_0x2cba('0x22')](function(_0xae43fd){return _0xae43fd;});}return null;};}function removeEntity(_0x34bd90,_0x2fcddb){return function(_0x275d9d){if(_0x275d9d){return _0x275d9d[_0x2cba('0x36')]()['then'](function(){_0x34bd90[_0x2cba('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x114d85,_0x270c9a){return function(_0x567ba8){if(!_0x567ba8){_0x114d85[_0x2cba('0x2a')](0x194);}return _0x567ba8;};}function handleError(_0x4dabe5,_0x328ed0){_0x328ed0=_0x328ed0||0x1f4;return function(_0x5141e5){logger[_0x2cba('0x26')](_0x5141e5[_0x2cba('0x37')]);if(_0x5141e5[_0x2cba('0x38')]){delete _0x5141e5[_0x2cba('0x38')];}_0x4dabe5[_0x2cba('0x2b')](_0x328ed0)[_0x2cba('0x39')](_0x5141e5);};}exports['index']=function(_0x1f9f0b,_0x2a2367){var _0x2f0669={},_0x2731ee={},_0x2698a5={'count':0x0,'rows':[]};var _0x2b5418=_[_0x2cba('0x3a')](db[_0x2cba('0x3b')][_0x2cba('0x3c')],function(_0x3aef9f){return{'name':_0x3aef9f[_0x2cba('0x3d')],'type':_0x3aef9f['type'][_0x2cba('0x3e')]};});_0x2731ee[_0x2cba('0x3f')]=_['map'](_0x2b5418,_0x2cba('0x38'));_0x2731ee['query']=_[_0x2cba('0x40')](_0x1f9f0b[_0x2cba('0x41')]);_0x2731ee[_0x2cba('0x42')]=_['intersection'](_0x2731ee[_0x2cba('0x3f')],_0x2731ee[_0x2cba('0x41')]);_0x2f0669[_0x2cba('0x43')]=_[_0x2cba('0x44')](_0x2731ee[_0x2cba('0x3f')],qs[_0x2cba('0x45')](_0x1f9f0b['query'][_0x2cba('0x45')]));_0x2f0669[_0x2cba('0x43')]=_0x2f0669[_0x2cba('0x43')]['length']?_0x2f0669[_0x2cba('0x43')]:_0x2731ee[_0x2cba('0x3f')];if(!_0x1f9f0b[_0x2cba('0x41')][_0x2cba('0x46')](_0x2cba('0x47'))){_0x2f0669['limit']=qs[_0x2cba('0x2f')](_0x1f9f0b[_0x2cba('0x41')][_0x2cba('0x2f')]);_0x2f0669['offset']=qs[_0x2cba('0x2d')](_0x1f9f0b[_0x2cba('0x41')][_0x2cba('0x2d')]);}_0x2f0669[_0x2cba('0x48')]=qs['sort'](_0x1f9f0b['query'][_0x2cba('0x49')]);_0x2f0669[_0x2cba('0x4a')]=qs[_0x2cba('0x42')](_['pick'](_0x1f9f0b['query'],_0x2731ee[_0x2cba('0x42')]),_0x2b5418);if(_0x1f9f0b[_0x2cba('0x41')][_0x2cba('0x4b')]){_0x2f0669['where']=_[_0x2cba('0x4c')](_0x2f0669['where'],{'$or':_['map'](_0x2b5418,function(_0x230813){if(_0x230813[_0x2cba('0x4d')]!=='VIRTUAL'){var _0xcc259={};_0xcc259[_0x230813['name']]={'$like':'%'+_0x1f9f0b['query'][_0x2cba('0x4b')]+'%'};return _0xcc259;}})});}_0x2f0669=_[_0x2cba('0x4c')]({},_0x2f0669,_0x1f9f0b[_0x2cba('0x4e')]);var _0x50a049={'where':_0x2f0669[_0x2cba('0x4a')]};return db[_0x2cba('0x3b')]['count'](_0x50a049)[_0x2cba('0x22')](function(_0x1942b0){_0x2698a5[_0x2cba('0x30')]=_0x1942b0;if(_0x1f9f0b[_0x2cba('0x41')]['includeAll']){_0x2f0669['include']=[{'all':!![]}];}return db[_0x2cba('0x3b')][_0x2cba('0x4f')](_0x2f0669);})[_0x2cba('0x22')](function(_0x6677f5){_0x2698a5[_0x2cba('0x50')]=_0x6677f5;return _0x2698a5;})[_0x2cba('0x22')](respondWithFilteredResult(_0x2a2367,_0x2f0669))[_0x2cba('0x51')](handleError(_0x2a2367,null));};exports[_0x2cba('0x52')]=function(_0x6fefaa,_0x298985){var _0x1048e7={'raw':!![],'where':{'id':_0x6fefaa[_0x2cba('0x53')]['id']}},_0x2ada39={};_0x2ada39[_0x2cba('0x3f')]=_[_0x2cba('0x40')](db[_0x2cba('0x3b')][_0x2cba('0x3c')]);_0x2ada39[_0x2cba('0x41')]=_[_0x2cba('0x40')](_0x6fefaa[_0x2cba('0x41')]);_0x2ada39[_0x2cba('0x42')]=_[_0x2cba('0x44')](_0x2ada39['model'],_0x2ada39[_0x2cba('0x41')]);_0x1048e7[_0x2cba('0x43')]=_[_0x2cba('0x44')](_0x2ada39[_0x2cba('0x3f')],qs['fields'](_0x6fefaa[_0x2cba('0x41')][_0x2cba('0x45')]));_0x1048e7['attributes']=_0x1048e7[_0x2cba('0x43')][_0x2cba('0x54')]?_0x1048e7[_0x2cba('0x43')]:_0x2ada39[_0x2cba('0x3f')];if(_0x6fefaa[_0x2cba('0x41')][_0x2cba('0x55')]){_0x1048e7['include']=[{'all':!![]}];}_0x1048e7=_[_0x2cba('0x4c')]({},_0x1048e7,_0x6fefaa['options']);return db[_0x2cba('0x3b')][_0x2cba('0x56')](_0x1048e7)[_0x2cba('0x22')](handleEntityNotFound(_0x298985,null))[_0x2cba('0x22')](respondWithResult(_0x298985,null))[_0x2cba('0x51')](handleError(_0x298985,null));};exports['update']=function(_0x2060a2,_0x458b3d){if(_0x2060a2[_0x2cba('0x57')]['id']){delete _0x2060a2[_0x2cba('0x57')]['id'];}return db[_0x2cba('0x3b')]['find']({'where':{'id':_0x2060a2[_0x2cba('0x53')]['id']}})[_0x2cba('0x22')](handleEntityNotFound(_0x458b3d,null))[_0x2cba('0x22')](saveUpdates(_0x2060a2[_0x2cba('0x57')],null))['then'](respondWithResult(_0x458b3d,null))[_0x2cba('0x51')](handleError(_0x458b3d,null));};exports[_0x2cba('0x36')]=function(_0x5680e4,_0x46e119){return db[_0x2cba('0x3b')][_0x2cba('0x56')]({'where':{'id':_0x5680e4[_0x2cba('0x53')]['id']}})['then'](handleEntityNotFound(_0x46e119,null))[_0x2cba('0x22')](removeEntity(_0x46e119,null))[_0x2cba('0x51')](handleError(_0x46e119,null));};exports[_0x2cba('0x58')]=function(_0x1abbbe,_0x56e6f5){return db[_0x2cba('0x3b')][_0x2cba('0x58')]()[_0x2cba('0x22')](respondWithResult(_0x56e6f5,null))[_0x2cba('0x51')](handleError(_0x56e6f5,null));};var interaction_log=require(_0x2cba('0x14'))(_0x2cba('0x59'));exports['accept']=function(_0x52551,_0x55791b,_0x449bb8){var _0x50b550={'agent':{},'channel':_0x2cba('0x5a')};if(_0x52551[_0x2cba('0x57')]['id']){delete _0x52551['body']['id'];}_0x52551[_0x2cba('0x57')][_0x2cba('0x5b')]=!![];_0x52551[_0x2cba('0x57')][_0x2cba('0x5c')]=moment()['format'](_0x2cba('0x5d'));_0x52551['body'][_0x2cba('0x5e')]=_0x52551[_0x2cba('0x57')]['UserId']||_0x52551['user']['id'];_0x50b550[_0x2cba('0x5f')]['id']=_0x52551[_0x2cba('0x57')][_0x2cba('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x52551[_0x2cba('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x55791b,null))[_0x2cba('0x22')](saveUpdates(_0x52551[_0x2cba('0x57')],null))[_0x2cba('0x22')](function(_0x3634a8){if(_0x3634a8){_0x50b550[_0x2cba('0x27')]=_0x3634a8['get']({'plain':!![]});return db[_0x2cba('0x60')][_0x2cba('0x56')]({'where':{'id':_0x3634a8[_0x2cba('0x61')]}});}return null;})[_0x2cba('0x22')](handleEntityNotFound(_0x55791b,null))[_0x2cba('0x22')](function(_0x58c281){if(_0x58c281){return _0x58c281[_0x2cba('0x35')]({'UserId':_0x52551[_0x2cba('0x57')][_0x2cba('0x5e')],'read1stAt':_['isNil'](_0x58c281[_0x2cba('0x62')])?moment()['format'](_0x2cba('0x5d')):undefined});}return null;})[_0x2cba('0x22')](function(_0x37685b){if(_0x37685b){_0x50b550['interaction']=_0x37685b[_0x2cba('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52551[_0x2cba('0x64')]['id'],_0x52551['user'][_0x2cba('0x38')],_0x52551[_0x2cba('0x64')]['role'],_0x50b550[_0x2cba('0x65')]['id'],_0x52551[_0x2cba('0x57')]?JSON[_0x2cba('0x25')](_0x52551[_0x2cba('0x57')]):_0x2cba('0x66'));return respondWithRpcPromise(_0x2cba('0x67'),'acceptMessage',_0x50b550);}return null;})[_0x2cba('0x22')](function(_0x5a4630){var _0x264ada=_0x2cba('0x68')+_0x5a4630[_0x2cba('0x27')][_0x2cba('0x69')];return db['sequelize'][_0x2cba('0x41')](_0x264ada,{'type':db[_0x2cba('0x6a')][_0x2cba('0x6b')][_0x2cba('0x6c')],'raw':!![]})[_0x2cba('0x22')](function(_0x25d994){return _0x25d994;});})[_0x2cba('0x22')](function(_0x2d5132){if(_0x2d5132){_0x50b550[_0x2cba('0x27')][_0x2cba('0x6d')]=_0x2d5132[0x0];if(!_0x52551['body'][_0x2cba('0x5e')])return;return db['User'][_0x2cba('0x56')]({'where':{'id':_0x52551[_0x2cba('0x57')][_0x2cba('0x5e')],'role':_0x2cba('0x5f')},'attributes':['id','name',_0x2cba('0x6e'),'email',_0x2cba('0x6f')],'raw':!![]});}return null;})[_0x2cba('0x22')](function(_0x4b2eb1){if(!_0x4b2eb1)return null;_0x50b550[_0x2cba('0x27')][_0x2cba('0x5f')]=_0x4b2eb1;return _0x50b550;})['then'](function(_0x4b8c6b){if(_0x4b8c6b){if(_0x52551[_0x2cba('0x57')][_0x2cba('0x70')]){_0x50b550[_0x2cba('0x27')][_0x2cba('0x71')]=util[_0x2cba('0x72')](_0x2cba('0x73'),_0x52551[_0x2cba('0x64')]['name']);_0x50b550[_0x2cba('0x27')][_0x2cba('0x74')]=_0x50b550[_0x2cba('0x74')];_0x50b550[_0x2cba('0x27')][_0x2cba('0x75')]=_0x50b550['channel'];_0x50b550[_0x2cba('0x27')][_0x2cba('0x76')]=_0x2cba('0x77');return respondWithRpcPromise(_0x2cba('0x78'),_0x2cba('0x78'),{'event':_0x2cba('0x79'),'message':_0x50b550[_0x2cba('0x27')]},client9002)[_0x2cba('0x22')](function(){return _0x50b550;});}return _0x50b550;}return null;})[_0x2cba('0x22')](respondWithResult(_0x55791b,null))[_0x2cba('0x51')](handleError(_0x55791b,null));};var interaction_log=require(_0x2cba('0x14'))('fax-interactions');exports[_0x2cba('0x33')]=function(_0x58a558,_0x557330,_0x4be49b){var _0x3fbe7c={'agent':{},'channel':_0x2cba('0x5a')};if(_0x58a558[_0x2cba('0x57')]['id']){delete _0x58a558[_0x2cba('0x57')]['id'];}_0x58a558[_0x2cba('0x57')][_0x2cba('0x5e')]=_0x58a558[_0x2cba('0x57')][_0x2cba('0x5e')]||_0x58a558[_0x2cba('0x64')]['id'];_0x3fbe7c[_0x2cba('0x5f')]['id']=_0x58a558['body'][_0x2cba('0x5e')];return db[_0x2cba('0x3b')][_0x2cba('0x56')]({'where':{'id':_0x58a558[_0x2cba('0x53')]['id'],'UserId':null}})[_0x2cba('0x22')](handleEntityNotFound(_0x557330,null))[_0x2cba('0x22')](function(_0x2bee26){if(_0x2bee26){_0x3fbe7c[_0x2cba('0x27')]=_0x2bee26['get']({'plain':!![]});return db[_0x2cba('0x60')][_0x2cba('0x56')]({'where':{'id':_0x2bee26['FaxInteractionId']}});}return null;})[_0x2cba('0x22')](handleEntityNotFound(_0x557330,null))[_0x2cba('0x22')](function(_0x3e6923){if(_0x3e6923){_0x3fbe7c[_0x2cba('0x65')]=_0x3e6923['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58a558[_0x2cba('0x64')]['id'],_0x58a558[_0x2cba('0x64')]['name'],_0x58a558[_0x2cba('0x64')][_0x2cba('0x7a')],_0x3fbe7c[_0x2cba('0x65')]['id'],_0x58a558['body']?JSON['stringify'](_0x58a558[_0x2cba('0x57')]):_0x2cba('0x66'));return respondWithRpcPromise(_0x2cba('0x7b'),'rejectMessage',_0x3fbe7c);}return null;})[_0x2cba('0x22')](function(_0x1e2bac){var _0x9e4761='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e2bac[_0x2cba('0x27')][_0x2cba('0x69')];return db['sequelize']['query'](_0x9e4761,{'type':db['Sequelize'][_0x2cba('0x6b')]['SELECT'],'raw':!![]})[_0x2cba('0x22')](function(_0x22ae79){return _0x22ae79;});})[_0x2cba('0x22')](function(_0x30ae32){if(_0x30ae32){_0x3fbe7c[_0x2cba('0x27')]['contact']=_0x30ae32[0x0];if(!_0x58a558[_0x2cba('0x57')]['UserId'])return;return db[_0x2cba('0x7c')][_0x2cba('0x56')]({'where':{'id':_0x58a558[_0x2cba('0x57')][_0x2cba('0x5e')],'role':_0x2cba('0x5f')},'attributes':['id',_0x2cba('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x2cba('0x22')](function(_0xb44d5f){if(!_0xb44d5f)return null;_0x3fbe7c[_0x2cba('0x27')][_0x2cba('0x5f')]=_0xb44d5f;return _0x3fbe7c;})[_0x2cba('0x22')](function(_0x212743){if(_0x212743){_0x212743[_0x2cba('0x27')][_0x2cba('0x71')]=util[_0x2cba('0x72')](_0x2cba('0x73'),_0x58a558[_0x2cba('0x64')][_0x2cba('0x38')]);_0x212743[_0x2cba('0x27')][_0x2cba('0x74')]=_0x3fbe7c[_0x2cba('0x74')];_0x212743[_0x2cba('0x27')][_0x2cba('0x75')]=_0x3fbe7c[_0x2cba('0x74')];_0x212743[_0x2cba('0x27')][_0x2cba('0x76')]=_0x2cba('0x33');respondWithRpcPromise(_0x2cba('0x78'),'EventManager',{'event':_0x2cba('0x7d'),'message':_0x212743[_0x2cba('0x27')]},client9002);return _0x3fbe7c;}return null;})['then'](respondWithResult(_0x557330,null))[_0x2cba('0x51')](handleError(_0x557330,null));};exports['create']=function(_0x2a6481,_0x40d3d3){var _0x24a2bb;return db['FaxMessage'][_0x2cba('0x7e')](_0x2a6481[_0x2cba('0x57')],{})[_0x2cba('0x22')](function(_0x4338d4){_0x24a2bb=_0x4338d4;return db[_0x2cba('0x7f')][_0x2cba('0x80')]({'where':{'id':_0x24a2bb['ContactId']}});})[_0x2cba('0x22')](function(_0x55a08c){if(_[_0x2cba('0x81')](_0x55a08c)){return;}else{_0x24a2bb[_0x2cba('0x5a')]=_0x55a08c[_0x2cba('0x5a')];return db['Attachment'][_0x2cba('0x80')]({'where':{'id':_0x24a2bb['AttachmentId']}});}})[_0x2cba('0x22')](function(_0x285fcf){return respondWithRpcPromise(_0x2cba('0x82'),'SendFax',{'FaxAccountId':_[_0x2cba('0x81')](_0x2a6481['body'])?undefined:_0x2a6481[_0x2cba('0x57')]['FaxAccountId'],'path':_[_0x2cba('0x81')](_0x285fcf)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x285fcf[_0x2cba('0x83')]),'fax':_[_0x2cba('0x81')](_0x24a2bb['fax'])?undefined:_0x24a2bb[_0x2cba('0x5a')],'AttachmentId':_0x24a2bb[_0x2cba('0x84')]},client9002);})['then'](respondWithResult(_0x40d3d3,0xc9))[_0x2cba('0x51')](handleError(_0x40d3d3,null));};exports[_0x2cba('0x85')]=function(_0x296151,_0x3eba4f){var _0x12c28d=path['join'](config['root'],_0x2cba('0x86'),'files',_0x2cba('0x87'));return db[_0x2cba('0x3b')][_0x2cba('0x56')]({'where':{'id':_0x296151[_0x2cba('0x53')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x3eba4f,null))[_0x2cba('0x22')](function(_0x5ab402){if(_0x5ab402){return _0x3eba4f[_0x2cba('0x85')](path['join'](_0x12c28d,_0x5ab402[_0x2cba('0x88')][_0x2cba('0x83')]));}})[_0x2cba('0x51')](handleError(_0x3eba4f,null));}; \ No newline at end of file +var _0x39ba=['query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','role','interaction','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax','FaxInteraction','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','User','rejectmessage','create','findOne','ContactId','Attachment','FaxAccountId','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','http','client','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','keys'];(function(_0x481f0b,_0x2539d0){var _0x3d9ba0=function(_0x4b1126){while(--_0x4b1126){_0x481f0b['push'](_0x481f0b['shift']());}};_0x3d9ba0(++_0x2539d0);}(_0x39ba,0xdc));var _0xa39b=function(_0x2de599,_0x5f463e){_0x2de599=_0x2de599-0x0;var _0x447bcb=_0x39ba[_0x2de599];return _0x447bcb;};'use strict';var emlformat=require(_0xa39b('0x0'));var rimraf=require(_0xa39b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa39b('0x2'));var rp=require(_0xa39b('0x3'));var moment=require(_0xa39b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa39b('0x5'));var util=require(_0xa39b('0x6'));var path=require(_0xa39b('0x7'));var sox=require(_0xa39b('0x8'));var csv=require(_0xa39b('0x9'));var ejs=require(_0xa39b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa39b('0xb'));var squel=require(_0xa39b('0xc'));var crypto=require(_0xa39b('0xd'));var jsforce=require(_0xa39b('0xe'));var deskjs=require(_0xa39b('0xf'));var toCsv=require(_0xa39b('0x9'));var querystring=require(_0xa39b('0x10'));var Papa=require(_0xa39b('0x11'));var Redis=require(_0xa39b('0x12'));var authService=require(_0xa39b('0x13'));var qs=require(_0xa39b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa39b('0x15'));var logger=require(_0xa39b('0x16'))(_0xa39b('0x17'));var utils=require('../../config/utils');var config=require(_0xa39b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa39b('0x19')]=_[_0xa39b('0x1a')](config[_0xa39b('0x19')],{'host':_0xa39b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0xa39b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa39b('0x1d')]({'port':0x232c});var client9002=jayson[_0xa39b('0x1e')][_0xa39b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x15d3e5,_0x272300,_0x38a04b,_0xeae34d){return new BPromise(function(_0x198b08,_0xd2a398){var _0x2993ed=_0xeae34d||client;return _0x2993ed['request'](_0x15d3e5,_0x38a04b)[_0xa39b('0x1f')](function(_0x5bbfca){logger[_0xa39b('0x20')]('FaxMessage,\x20%s,\x20%s',_0x272300,_0xa39b('0x21'));logger[_0xa39b('0x22')](_0xa39b('0x23'),_0x272300,_0xa39b('0x21'),JSON[_0xa39b('0x24')](_0x5bbfca));if(_0x5bbfca[_0xa39b('0x25')]){if(_0x5bbfca['error']['code']===0x1f4){logger['error'](_0xa39b('0x26'),_0x272300,_0x5bbfca[_0xa39b('0x25')][_0xa39b('0x27')]);return _0xd2a398(_0x5bbfca[_0xa39b('0x25')][_0xa39b('0x27')]);}logger[_0xa39b('0x25')](_0xa39b('0x26'),_0x272300,_0x5bbfca[_0xa39b('0x25')]['message']);return _0x198b08(_0x5bbfca[_0xa39b('0x25')]['message']);}else{logger[_0xa39b('0x20')]('FaxMessage,\x20%s,\x20%s',_0x272300,_0xa39b('0x21'));_0x198b08(_0x5bbfca[_0xa39b('0x28')][_0xa39b('0x27')]);}})['catch'](function(_0x5caec7){logger['error'](_0xa39b('0x26'),_0x272300,_0x5caec7);_0xd2a398(_0x5caec7);});});}function respondWithStatusCode(_0x4f3526,_0x2ab652){_0x2ab652=_0x2ab652||0xcc;return function(_0x26df42){if(_0x26df42){return _0x4f3526[_0xa39b('0x29')](_0x2ab652);}return _0x4f3526['status'](_0x2ab652)[_0xa39b('0x2a')]();};}function respondWithResult(_0x4c4b84,_0x53aeb7){_0x53aeb7=_0x53aeb7||0xc8;return function(_0x4dff8d){if(_0x4dff8d){return _0x4c4b84[_0xa39b('0x2b')](_0x53aeb7)['json'](_0x4dff8d);}};}function respondWithFilteredResult(_0x1c40ca,_0x3b2305){return function(_0x4f9089){if(_0x4f9089){var _0xbb36a8=typeof _0x3b2305[_0xa39b('0x2c')]===_0xa39b('0x2d')&&typeof _0x3b2305[_0xa39b('0x2e')]===_0xa39b('0x2d');var _0x475e4c=_0x4f9089[_0xa39b('0x2f')];var _0x7e1030=_0xbb36a8?0x0:_0x3b2305[_0xa39b('0x2c')];var _0x201e91=_0xbb36a8?_0x4f9089[_0xa39b('0x2f')]:_0x3b2305[_0xa39b('0x2c')]+_0x3b2305[_0xa39b('0x2e')];var _0x5a6a0a;if(_0x201e91>=_0x475e4c){_0x201e91=_0x475e4c;_0x5a6a0a=0xc8;}else{_0x5a6a0a=0xce;}_0x1c40ca[_0xa39b('0x2b')](_0x5a6a0a);return _0x1c40ca['set'](_0xa39b('0x30'),_0x7e1030+'-'+_0x201e91+'/'+_0x475e4c)[_0xa39b('0x31')](_0x4f9089);}return null;};}function patchUpdates(_0x44950a){return function(_0x409c9b){try{jsonpatch[_0xa39b('0x32')](_0x409c9b,_0x44950a,!![]);}catch(_0x56c03c){return BPromise[_0xa39b('0x33')](_0x56c03c);}return _0x409c9b[_0xa39b('0x34')]();};}function saveUpdates(_0x57cfdd,_0x53df2f){return function(_0xf1c702){if(_0xf1c702){return _0xf1c702[_0xa39b('0x35')](_0x57cfdd)[_0xa39b('0x1f')](function(_0x4848d3){return _0x4848d3;});}return null;};}function removeEntity(_0x3da0da,_0x19e826){return function(_0x3b91b5){if(_0x3b91b5){return _0x3b91b5['destroy']()[_0xa39b('0x1f')](function(){_0x3da0da[_0xa39b('0x2b')](0xcc)[_0xa39b('0x2a')]();});}};}function handleEntityNotFound(_0x3f6639,_0x27e893){return function(_0x2ce27e){if(!_0x2ce27e){_0x3f6639[_0xa39b('0x29')](0x194);}return _0x2ce27e;};}function handleError(_0x5694ef,_0x2695cd){_0x2695cd=_0x2695cd||0x1f4;return function(_0x5ae552){logger['error'](_0x5ae552[_0xa39b('0x36')]);if(_0x5ae552['name']){delete _0x5ae552[_0xa39b('0x37')];}_0x5694ef['status'](_0x2695cd)[_0xa39b('0x38')](_0x5ae552);};}exports[_0xa39b('0x39')]=function(_0x6379c9,_0xcf2b31){var _0x2f20b0={},_0x5ca0de={},_0x35f36d={'count':0x0,'rows':[]};var _0x1797d0=_[_0xa39b('0x3a')](db[_0xa39b('0x3b')][_0xa39b('0x3c')],function(_0x27493d){return{'name':_0x27493d[_0xa39b('0x3d')],'type':_0x27493d[_0xa39b('0x3e')]['key']};});_0x5ca0de['model']=_[_0xa39b('0x3a')](_0x1797d0,_0xa39b('0x37'));_0x5ca0de['query']=_[_0xa39b('0x3f')](_0x6379c9[_0xa39b('0x40')]);_0x5ca0de[_0xa39b('0x41')]=_['intersection'](_0x5ca0de[_0xa39b('0x42')],_0x5ca0de[_0xa39b('0x40')]);_0x2f20b0[_0xa39b('0x43')]=_['intersection'](_0x5ca0de['model'],qs[_0xa39b('0x44')](_0x6379c9[_0xa39b('0x40')][_0xa39b('0x44')]));_0x2f20b0[_0xa39b('0x43')]=_0x2f20b0[_0xa39b('0x43')][_0xa39b('0x45')]?_0x2f20b0[_0xa39b('0x43')]:_0x5ca0de[_0xa39b('0x42')];if(!_0x6379c9[_0xa39b('0x40')][_0xa39b('0x46')](_0xa39b('0x47'))){_0x2f20b0[_0xa39b('0x2e')]=qs[_0xa39b('0x2e')](_0x6379c9[_0xa39b('0x40')][_0xa39b('0x2e')]);_0x2f20b0[_0xa39b('0x2c')]=qs[_0xa39b('0x2c')](_0x6379c9[_0xa39b('0x40')]['offset']);}_0x2f20b0[_0xa39b('0x48')]=qs[_0xa39b('0x49')](_0x6379c9['query'][_0xa39b('0x49')]);_0x2f20b0[_0xa39b('0x4a')]=qs['filters'](_[_0xa39b('0x4b')](_0x6379c9['query'],_0x5ca0de[_0xa39b('0x41')]),_0x1797d0);if(_0x6379c9[_0xa39b('0x40')][_0xa39b('0x4c')]){_0x2f20b0['where']=_[_0xa39b('0x4d')](_0x2f20b0[_0xa39b('0x4a')],{'$or':_[_0xa39b('0x3a')](_0x1797d0,function(_0x101471){if(_0x101471[_0xa39b('0x3e')]!=='VIRTUAL'){var _0x3d1c7f={};_0x3d1c7f[_0x101471[_0xa39b('0x37')]]={'$like':'%'+_0x6379c9[_0xa39b('0x40')][_0xa39b('0x4c')]+'%'};return _0x3d1c7f;}})});}_0x2f20b0=_[_0xa39b('0x4d')]({},_0x2f20b0,_0x6379c9[_0xa39b('0x4e')]);var _0x45575a={'where':_0x2f20b0[_0xa39b('0x4a')]};return db[_0xa39b('0x3b')][_0xa39b('0x2f')](_0x45575a)[_0xa39b('0x1f')](function(_0xf227cf){_0x35f36d['count']=_0xf227cf;if(_0x6379c9[_0xa39b('0x40')][_0xa39b('0x4f')]){_0x2f20b0[_0xa39b('0x50')]=[{'all':!![]}];}return db[_0xa39b('0x3b')][_0xa39b('0x51')](_0x2f20b0);})['then'](function(_0x237c72){_0x35f36d[_0xa39b('0x52')]=_0x237c72;return _0x35f36d;})[_0xa39b('0x1f')](respondWithFilteredResult(_0xcf2b31,_0x2f20b0))[_0xa39b('0x53')](handleError(_0xcf2b31,null));};exports[_0xa39b('0x54')]=function(_0x16592b,_0x52f8f6){var _0x4e942e={'raw':!![],'where':{'id':_0x16592b[_0xa39b('0x55')]['id']}},_0x2e3ff0={};_0x2e3ff0[_0xa39b('0x42')]=_[_0xa39b('0x3f')](db[_0xa39b('0x3b')][_0xa39b('0x3c')]);_0x2e3ff0[_0xa39b('0x40')]=_[_0xa39b('0x3f')](_0x16592b[_0xa39b('0x40')]);_0x2e3ff0[_0xa39b('0x41')]=_[_0xa39b('0x56')](_0x2e3ff0[_0xa39b('0x42')],_0x2e3ff0[_0xa39b('0x40')]);_0x4e942e[_0xa39b('0x43')]=_[_0xa39b('0x56')](_0x2e3ff0[_0xa39b('0x42')],qs[_0xa39b('0x44')](_0x16592b[_0xa39b('0x40')][_0xa39b('0x44')]));_0x4e942e[_0xa39b('0x43')]=_0x4e942e[_0xa39b('0x43')][_0xa39b('0x45')]?_0x4e942e['attributes']:_0x2e3ff0[_0xa39b('0x42')];if(_0x16592b[_0xa39b('0x40')][_0xa39b('0x4f')]){_0x4e942e[_0xa39b('0x50')]=[{'all':!![]}];}_0x4e942e=_[_0xa39b('0x4d')]({},_0x4e942e,_0x16592b[_0xa39b('0x4e')]);return db[_0xa39b('0x3b')][_0xa39b('0x57')](_0x4e942e)[_0xa39b('0x1f')](handleEntityNotFound(_0x52f8f6,null))['then'](respondWithResult(_0x52f8f6,null))[_0xa39b('0x53')](handleError(_0x52f8f6,null));};exports[_0xa39b('0x35')]=function(_0x27c2f9,_0x41ef40){if(_0x27c2f9[_0xa39b('0x58')]['id']){delete _0x27c2f9[_0xa39b('0x58')]['id'];}return db[_0xa39b('0x3b')][_0xa39b('0x57')]({'where':{'id':_0x27c2f9['params']['id']}})[_0xa39b('0x1f')](handleEntityNotFound(_0x41ef40,null))['then'](saveUpdates(_0x27c2f9[_0xa39b('0x58')],null))[_0xa39b('0x1f')](respondWithResult(_0x41ef40,null))['catch'](handleError(_0x41ef40,null));};exports['destroy']=function(_0x2b6aea,_0x1f76a4){return db[_0xa39b('0x3b')][_0xa39b('0x57')]({'where':{'id':_0x2b6aea[_0xa39b('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f76a4,null))[_0xa39b('0x1f')](removeEntity(_0x1f76a4,null))['catch'](handleError(_0x1f76a4,null));};exports[_0xa39b('0x59')]=function(_0x113425,_0x1eb197){return db['FaxMessage'][_0xa39b('0x59')]()['then'](respondWithResult(_0x1eb197,null))[_0xa39b('0x53')](handleError(_0x1eb197,null));};var interaction_log=require(_0xa39b('0x16'))(_0xa39b('0x5a'));exports[_0xa39b('0x5b')]=function(_0x1dd372,_0xf7759b,_0x229654){var _0x5c2e64={'agent':{},'channel':'fax'};if(_0x1dd372[_0xa39b('0x58')]['id']){delete _0x1dd372[_0xa39b('0x58')]['id'];}_0x1dd372['body']['read']=!![];_0x1dd372[_0xa39b('0x58')][_0xa39b('0x5c')]=moment()[_0xa39b('0x5d')](_0xa39b('0x5e'));_0x1dd372['body']['UserId']=_0x1dd372[_0xa39b('0x58')][_0xa39b('0x5f')]||_0x1dd372[_0xa39b('0x60')]['id'];_0x5c2e64[_0xa39b('0x61')]['id']=_0x1dd372[_0xa39b('0x58')]['UserId'];return db['FaxMessage'][_0xa39b('0x57')]({'where':{'id':_0x1dd372['params']['id'],'UserId':null}})[_0xa39b('0x1f')](handleEntityNotFound(_0xf7759b,null))[_0xa39b('0x1f')](saveUpdates(_0x1dd372[_0xa39b('0x58')],null))['then'](function(_0x247da3){if(_0x247da3){_0x5c2e64[_0xa39b('0x27')]=_0x247da3[_0xa39b('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xa39b('0x57')]({'where':{'id':_0x247da3[_0xa39b('0x63')]}});}return null;})[_0xa39b('0x1f')](handleEntityNotFound(_0xf7759b,null))['then'](function(_0x25d01e){if(_0x25d01e){return _0x25d01e[_0xa39b('0x35')]({'UserId':_0x1dd372[_0xa39b('0x58')]['UserId'],'read1stAt':_[_0xa39b('0x64')](_0x25d01e[_0xa39b('0x65')])?moment()[_0xa39b('0x5d')](_0xa39b('0x5e')):undefined});}return null;})['then'](function(_0x13c069){if(_0x13c069){_0x5c2e64['interaction']=_0x13c069[_0xa39b('0x62')]({'plain':!![]});interaction_log[_0xa39b('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1dd372['user']['id'],_0x1dd372[_0xa39b('0x60')][_0xa39b('0x37')],_0x1dd372[_0xa39b('0x60')][_0xa39b('0x66')],_0x5c2e64[_0xa39b('0x67')]['id'],_0x1dd372[_0xa39b('0x58')]?JSON[_0xa39b('0x24')](_0x1dd372['body']):'null');return respondWithRpcPromise(_0xa39b('0x68'),_0xa39b('0x69'),_0x5c2e64);}return null;})[_0xa39b('0x1f')](function(_0x16f2e5){var _0x16cbf1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x16f2e5[_0xa39b('0x27')]['ContactId'];return db[_0xa39b('0x6a')][_0xa39b('0x40')](_0x16cbf1,{'type':db[_0xa39b('0x6b')][_0xa39b('0x6c')]['SELECT'],'raw':!![]})[_0xa39b('0x1f')](function(_0x2c353a){return _0x2c353a;});})['then'](function(_0x5c7d62){if(_0x5c7d62){_0x5c2e64[_0xa39b('0x27')][_0xa39b('0x6d')]=_0x5c7d62[0x0];if(!_0x1dd372['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x1dd372['body']['UserId'],'role':'agent'},'attributes':['id',_0xa39b('0x37'),_0xa39b('0x6e'),_0xa39b('0x6f'),_0xa39b('0x70')],'raw':!![]});}return null;})['then'](function(_0x318104){if(!_0x318104)return null;_0x5c2e64[_0xa39b('0x27')][_0xa39b('0x61')]=_0x318104;return _0x5c2e64;})[_0xa39b('0x1f')](function(_0x2a774e){if(_0x2a774e){if(_0x1dd372[_0xa39b('0x58')][_0xa39b('0x71')]){_0x5c2e64[_0xa39b('0x27')][_0xa39b('0x72')]=util['format'](_0xa39b('0x73'),_0x1dd372[_0xa39b('0x60')][_0xa39b('0x37')]);_0x5c2e64[_0xa39b('0x27')][_0xa39b('0x74')]=_0x5c2e64[_0xa39b('0x74')];_0x5c2e64[_0xa39b('0x27')][_0xa39b('0x75')]=_0x5c2e64[_0xa39b('0x74')];_0x5c2e64['message'][_0xa39b('0x76')]=_0xa39b('0x5b');return respondWithRpcPromise(_0xa39b('0x77'),'EventManager',{'event':_0xa39b('0x78'),'message':_0x5c2e64['message']},client9002)['then'](function(){return _0x5c2e64;});}return _0x5c2e64;}return null;})['then'](respondWithResult(_0xf7759b,null))[_0xa39b('0x53')](handleError(_0xf7759b,null));};var interaction_log=require(_0xa39b('0x16'))(_0xa39b('0x5a'));exports[_0xa39b('0x33')]=function(_0x2961c6,_0x303498,_0x15b571){var _0x9aab9e={'agent':{},'channel':_0xa39b('0x79')};if(_0x2961c6[_0xa39b('0x58')]['id']){delete _0x2961c6[_0xa39b('0x58')]['id'];}_0x2961c6[_0xa39b('0x58')][_0xa39b('0x5f')]=_0x2961c6[_0xa39b('0x58')]['UserId']||_0x2961c6[_0xa39b('0x60')]['id'];_0x9aab9e[_0xa39b('0x61')]['id']=_0x2961c6['body'][_0xa39b('0x5f')];return db[_0xa39b('0x3b')]['find']({'where':{'id':_0x2961c6[_0xa39b('0x55')]['id'],'UserId':null}})[_0xa39b('0x1f')](handleEntityNotFound(_0x303498,null))['then'](function(_0x38e115){if(_0x38e115){_0x9aab9e['message']=_0x38e115[_0xa39b('0x62')]({'plain':!![]});return db[_0xa39b('0x7a')]['find']({'where':{'id':_0x38e115[_0xa39b('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x303498,null))[_0xa39b('0x1f')](function(_0x4672ef){if(_0x4672ef){_0x9aab9e[_0xa39b('0x67')]=_0x4672ef[_0xa39b('0x62')]({'plain':!![]});interaction_log[_0xa39b('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2961c6['user']['id'],_0x2961c6[_0xa39b('0x60')]['name'],_0x2961c6[_0xa39b('0x60')]['role'],_0x9aab9e[_0xa39b('0x67')]['id'],_0x2961c6['body']?JSON[_0xa39b('0x24')](_0x2961c6[_0xa39b('0x58')]):_0xa39b('0x7b'));return respondWithRpcPromise('RejectMessage',_0xa39b('0x7c'),_0x9aab9e);}return null;})['then'](function(_0x525784){var _0x54d38d=_0xa39b('0x7d')+_0x525784[_0xa39b('0x27')]['ContactId'];return db['sequelize'][_0xa39b('0x40')](_0x54d38d,{'type':db[_0xa39b('0x6b')]['QueryTypes'][_0xa39b('0x7e')],'raw':!![]})[_0xa39b('0x1f')](function(_0x5715b5){return _0x5715b5;});})[_0xa39b('0x1f')](function(_0x367d8d){if(_0x367d8d){_0x9aab9e[_0xa39b('0x27')]['contact']=_0x367d8d[0x0];if(!_0x2961c6['body'][_0xa39b('0x5f')])return;return db[_0xa39b('0x7f')]['find']({'where':{'id':_0x2961c6[_0xa39b('0x58')][_0xa39b('0x5f')],'role':_0xa39b('0x61')},'attributes':['id',_0xa39b('0x37'),_0xa39b('0x6e'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x57e357){if(!_0x57e357)return null;_0x9aab9e[_0xa39b('0x27')][_0xa39b('0x61')]=_0x57e357;return _0x9aab9e;})[_0xa39b('0x1f')](function(_0x5788fe){if(_0x5788fe){_0x5788fe['message']['interface']=util['format'](_0xa39b('0x73'),_0x2961c6[_0xa39b('0x60')][_0xa39b('0x37')]);_0x5788fe[_0xa39b('0x27')][_0xa39b('0x74')]=_0x9aab9e[_0xa39b('0x74')];_0x5788fe[_0xa39b('0x27')][_0xa39b('0x75')]=_0x9aab9e[_0xa39b('0x74')];_0x5788fe[_0xa39b('0x27')][_0xa39b('0x76')]='reject';respondWithRpcPromise(_0xa39b('0x77'),_0xa39b('0x77'),{'event':_0xa39b('0x80'),'message':_0x5788fe[_0xa39b('0x27')]},client9002);return _0x9aab9e;}return null;})['then'](respondWithResult(_0x303498,null))[_0xa39b('0x53')](handleError(_0x303498,null));};exports[_0xa39b('0x81')]=function(_0x2f585e,_0x580425){var _0x1fcad3;return db[_0xa39b('0x3b')][_0xa39b('0x81')](_0x2f585e['body'],{})['then'](function(_0x11b449){_0x1fcad3=_0x11b449;return db['CmContact'][_0xa39b('0x82')]({'where':{'id':_0x1fcad3[_0xa39b('0x83')]}});})[_0xa39b('0x1f')](function(_0x4211ad){if(_[_0xa39b('0x64')](_0x4211ad)){return;}else{_0x1fcad3[_0xa39b('0x79')]=_0x4211ad['fax'];return db[_0xa39b('0x84')]['findOne']({'where':{'id':_0x1fcad3['AttachmentId']}});}})[_0xa39b('0x1f')](function(_0x5d33b4){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x2f585e[_0xa39b('0x58')])?undefined:_0x2f585e[_0xa39b('0x58')][_0xa39b('0x85')],'path':_[_0xa39b('0x64')](_0x5d33b4)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x5d33b4[_0xa39b('0x86')]),'fax':_[_0xa39b('0x64')](_0x1fcad3[_0xa39b('0x79')])?undefined:_0x1fcad3[_0xa39b('0x79')],'AttachmentId':_0x1fcad3[_0xa39b('0x87')]},client9002);})['then'](respondWithResult(_0x580425,0xc9))[_0xa39b('0x53')](handleError(_0x580425,null));};exports[_0xa39b('0x88')]=function(_0x7868d2,_0x40af4a){var _0x1cbfff=path[_0xa39b('0x89')](config[_0xa39b('0x8a')],_0xa39b('0x8b'),_0xa39b('0x8c'),_0xa39b('0x8d'));return db['FaxMessage']['find']({'where':{'id':_0x7868d2['params']['id']},'include':[{'model':db[_0xa39b('0x84')],'as':'Attachment'}]})[_0xa39b('0x1f')](handleEntityNotFound(_0x40af4a,null))['then'](function(_0xc126fd){if(_0xc126fd){return _0x40af4a[_0xa39b('0x88')](path[_0xa39b('0x89')](_0x1cbfff,_0xc126fd[_0xa39b('0x84')]['basename']));}})[_0xa39b('0x53')](handleError(_0x40af4a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 03f1bc7..7fa9f6f 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 _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','FaxMessage','setMaxListeners','save'];(function(_0x17b2a1,_0x27baab){var _0x4b89fa=function(_0xf86959){while(--_0xf86959){_0x17b2a1['push'](_0x17b2a1['shift']());}};_0x4b89fa(++_0x27baab);}(_0xacf4,0xe7));var _0x4acf=function(_0x437f69,_0x4a49b6){_0x437f69=_0x437f69-0x0;var _0x4bfc5d=_0xacf4[_0x437f69];return _0x4bfc5d;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4acf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){FaxMessageEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);FaxMessageEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];FaxMessage[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x5a63=['../../mysqldb','save','emit','hasOwnProperty','exports','events'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x5a63,0xe3));var _0x35a6=function(_0x51b013,_0x4b3b2e){_0x51b013=_0x51b013-0x0;var _0x255081=_0x5a63[_0x51b013];return _0x255081;};'use strict';var EventEmitter=require(_0x35a6('0x0'));var FaxMessage=require(_0x35a6('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35a6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x308a05){return function(_0x3462ed,_0x7a89ee,_0x4c032d){FaxMessageEvents[_0x35a6('0x3')](_0x308a05+':'+_0x3462ed['id'],_0x3462ed);FaxMessageEvents['emit'](_0x308a05,_0x3462ed);_0x4c032d(null);};}for(var e in events){if(events[_0x35a6('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x35a6('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d6d16bd..cefd263 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 _0xd552=['UserId','FaxInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil'];(function(_0x4d0b47,_0x52ff0e){var _0x2fd803=function(_0x2d2fec){while(--_0x2d2fec){_0x4d0b47['push'](_0x4d0b47['shift']());}};_0x2fd803(++_0x52ff0e);}(_0xd552,0x1dd));var _0x2d55=function(_0xa6e64c,_0x1e78f5){_0xa6e64c=_0xa6e64c-0x0;var _0x5c2de0=_0xd552[_0xa6e64c];return _0x5c2de0;};'use strict';var _=require('lodash');var util=require(_0x2d55('0x0'));var logger=require('../../config/logger')(_0x2d55('0x1'));var moment=require('moment');var BPromise=require(_0x2d55('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d55('0x3'));var config=require(_0x2d55('0x4'));var attributes=require(_0x2d55('0x5'));module['exports']=function(_0x745109,_0x320afd){return _0x745109[_0x2d55('0x6')](_0x2d55('0x7'),attributes,{'tableName':_0x2d55('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x2d55('0x9')],'type':_0x2d55('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56c1eb,_0x226a82,_0x22f96c){var _0x372a16=_0x745109[_0x2d55('0xb')];var _0x53207d=_0x56c1eb[_0x2d55('0xc')]({'plain':!![]});if(_0x53207d['direction'][_0x2d55('0xd')]()==='in'||_0x53207d[_0x2d55('0xe')][_0x2d55('0xd')]()==='out'&&!_0x53207d[_0x2d55('0xf')]&&!_[_0x2d55('0x10')](_0x53207d[_0x2d55('0x11')])){_0x372a16[_0x2d55('0x12')][_0x2d55('0x13')]({'where':{'id':_0x53207d['FaxInteractionId']}})[_0x2d55('0x14')](function(_0xe76a0a){if(_0xe76a0a){_0xe76a0a[_0x2d55('0x15')]({'lastMsgAt':_0x53207d[_0x2d55('0x16')],'lastMsgDirection':_0x53207d[_0x2d55('0xe')][_0x2d55('0xd')]()});}})['catch'](function(_0x39a1ac){console[_0x2d55('0x17')](_0x39a1ac);});}_0x22f96c();}},'charset':_0x2d55('0x18'),'collate':_0x2d55('0x19')});}; \ No newline at end of file +var _0x961d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','findOne','then','update','error','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x961d,0x1d9));var _0xd961=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x961d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var logger=require(_0xd961('0x2'))(_0xd961('0x3'));var moment=require(_0xd961('0x4'));var BPromise=require(_0xd961('0x5'));var rp=require(_0xd961('0x6'));var fs=require('fs');var path=require(_0xd961('0x7'));var rimraf=require(_0xd961('0x8'));var config=require(_0xd961('0x9'));var attributes=require(_0xd961('0xa'));module[_0xd961('0xb')]=function(_0x5df7d4,_0x122ac9){return _0x5df7d4[_0xd961('0xc')]('FaxMessage',attributes,{'tableName':_0xd961('0xd'),'paranoid':![],'indexes':[{'name':_0xd961('0xe'),'fields':[_0xd961('0xf')],'type':_0xd961('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x309cce,_0x32fa8c,_0x59b9df){var _0x17c98d=_0x5df7d4[_0xd961('0x11')];var _0x5008d8=_0x309cce['get']({'plain':!![]});if(_0x5008d8[_0xd961('0x12')][_0xd961('0x13')]()==='in'||_0x5008d8[_0xd961('0x12')][_0xd961('0x13')]()===_0xd961('0x14')&&!_0x5008d8[_0xd961('0x15')]&&!_[_0xd961('0x16')](_0x5008d8['UserId'])){_0x17c98d['FaxInteraction'][_0xd961('0x17')]({'where':{'id':_0x5008d8['FaxInteractionId']}})[_0xd961('0x18')](function(_0x37bd1b){if(_0x37bd1b){_0x37bd1b[_0xd961('0x19')]({'lastMsgAt':_0x5008d8['createdAt'],'lastMsgDirection':_0x5008d8['direction'][_0xd961('0x13')]()});}})['catch'](function(_0x22ceab){console[_0xd961('0x1a')](_0x22ceab);});}_0x59b9df();}},'charset':'utf8mb4','collate':_0xd961('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5c7803f..a70d9b5 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 _0x99e9=['register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x99e9,0xb4));var _0x999e=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x99e9[_0x44784c];return _0x4bbfb1;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});config[_0x999e('0xa')]=_[_0x999e('0xb')](config['redis'],{'host':_0x999e('0xc'),'port':0x18eb});var socket=require(_0x999e('0xd'))(new Redis(config[_0x999e('0xa')]));require(_0x999e('0xe'))[_0x999e('0xf')](socket);function respondWithRpcPromise(_0x175042,_0x3f2c24,_0x180846){return new BPromise(function(_0x3cb1c2,_0xf40130){return client[_0x999e('0x10')](_0x175042,_0x180846)[_0x999e('0x11')](function(_0x4246b1){logger[_0x999e('0x12')](_0x999e('0x13'),_0x3f2c24,_0x999e('0x14'));logger[_0x999e('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3f2c24,_0x999e('0x14'),JSON['stringify'](_0x4246b1));if(_0x4246b1[_0x999e('0x16')]){if(_0x4246b1[_0x999e('0x16')][_0x999e('0x17')]===0x1f4){logger['error'](_0x999e('0x13'),_0x3f2c24,_0x4246b1['error'][_0x999e('0x18')]);return _0xf40130(_0x4246b1['error']['message']);}logger[_0x999e('0x16')](_0x999e('0x13'),_0x3f2c24,_0x4246b1[_0x999e('0x16')][_0x999e('0x18')]);return _0x3cb1c2(_0x4246b1[_0x999e('0x16')][_0x999e('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3f2c24,'request\x20sent');_0x3cb1c2(_0x4246b1[_0x999e('0x19')][_0x999e('0x18')]);}})[_0x999e('0x1a')](function(_0x302f52){logger[_0x999e('0x16')](_0x999e('0x13'),_0x3f2c24,_0x302f52);_0xf40130(_0x302f52);});});}exports['CreateFaxMessage']=function(_0x5d86d4){var _0xc20d3e=this;return new Promise(function(_0x3f4d7c,_0x3b3642){return db['FaxMessage'][_0x999e('0x1b')](_0x5d86d4[_0x999e('0x1c')],{'raw':_0x5d86d4[_0x999e('0x1d')]?_0x5d86d4[_0x999e('0x1d')][_0x999e('0x1e')]===undefined?!![]:![]:!![]})[_0x999e('0x11')](function(_0x427bcf){logger['info']('CreateFaxMessage',_0x5d86d4);logger[_0x999e('0x15')](_0x999e('0x1f'),_0x5d86d4,JSON['stringify'](_0x427bcf));_0x3f4d7c(_0x427bcf);})[_0x999e('0x1a')](function(_0xe324d8){logger[_0x999e('0x16')](_0x999e('0x1f'),_0xe324d8[_0x999e('0x18')],_0x5d86d4);_0x3b3642(_0xc20d3e[_0x999e('0x16')](0x1f4,_0xe324d8['message']));});});};exports[_0x999e('0x20')]=function(_0x4199ff){var _0x11068e=this;return new Promise(function(_0x12b9ad,_0x1b7adb){return db[_0x999e('0x21')][_0x999e('0x22')](_0x4199ff['body'],{'raw':_0x4199ff[_0x999e('0x1d')]?_0x4199ff['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4199ff[_0x999e('0x1d')]?_0x4199ff[_0x999e('0x1d')][_0x999e('0x23')]||null:null,'attributes':_0x4199ff['options']?_0x4199ff[_0x999e('0x1d')][_0x999e('0x24')]||null:null,'limit':_0x4199ff[_0x999e('0x1d')]?_0x4199ff[_0x999e('0x1d')][_0x999e('0x25')]||null:null})[_0x999e('0x11')](function(_0x82e067){logger[_0x999e('0x12')](_0x999e('0x20'),_0x4199ff);logger[_0x999e('0x15')]('UpdateFaxMessage',_0x4199ff,JSON[_0x999e('0x26')](_0x82e067));_0x12b9ad(_0x82e067);})[_0x999e('0x1a')](function(_0x371613){logger['error'](_0x999e('0x20'),_0x371613['message'],_0x4199ff);_0x1b7adb(_0x11068e['error'](0x1f4,_0x371613[_0x999e('0x18')]));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0xc38c3d,_0x905485){var _0x51e658=function(_0xf36360){while(--_0xf36360){_0xc38c3d['push'](_0xc38c3d['shift']());}};_0x51e658(++_0x905485);}(_0x81bd,0x7c));var _0xd81b=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x81bd[_0x39b316];return _0x182ab1;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b818bf4..6c21709 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 _0xfa64=['update','emit','register','length','save'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xfa64,0xa4));var _0x4fa6=function(_0x4b7cd7,_0x5343d0){_0x4b7cd7=_0x4b7cd7-0x0;var _0x196f6d=_0xfa64[_0x4b7cd7];return _0x196f6d;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x4fa6('0x0'),'remove',_0x4fa6('0x1')];function createListener(_0x33f3f9,_0xe98386){return function(_0x2c5c5b){_0xe98386[_0x4fa6('0x2')](_0x33f3f9,_0x2c5c5b);};}function removeListener(_0x63cdee,_0xcdc10d){return function(){FaxMessageEvents['removeListener'](_0x63cdee,_0xcdc10d);};}exports[_0x4fa6('0x3')]=function(_0x3a4084){for(var _0x111ab7=0x0,_0x401f4e=events[_0x4fa6('0x4')];_0x111ab7<_0x401f4e;_0x111ab7++){var _0x1efaae=events[_0x111ab7];var _0x337cdb=createListener('faxMessage:'+_0x1efaae,_0x3a4084);FaxMessageEvents['on'](_0x1efaae,_0x337cdb);}}; \ No newline at end of file +var _0x29ba=['update','emit','removeListener','faxMessage:','./faxMessage.events','remove'];(function(_0x59c864,_0xedb852){var _0x3b52bc=function(_0x3f9177){while(--_0x3f9177){_0x59c864['push'](_0x59c864['shift']());}};_0x3b52bc(++_0xedb852);}(_0x29ba,0x1b4));var _0xa29b=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x29ba[_0x57f345];return _0x255e43;};'use strict';var FaxMessageEvents=require(_0xa29b('0x0'));var events=['save',_0xa29b('0x1'),_0xa29b('0x2')];function createListener(_0x13a82b,_0xa55bb9){return function(_0x2dd106){_0xa55bb9[_0xa29b('0x3')](_0x13a82b,_0x2dd106);};}function removeListener(_0x3bddf7,_0x42f9d1){return function(){FaxMessageEvents[_0xa29b('0x4')](_0x3bddf7,_0x42f9d1);};}exports['register']=function(_0x5880df){for(var _0x17f92a=0x0,_0x39cf61=events['length'];_0x17f92a<_0x39cf61;_0x17f92a++){var _0x5ae1cf=events[_0x17f92a];var _0x1cc6e9=createListener(_0xa29b('0x5')+_0x5ae1cf,_0x5880df);FaxMessageEvents['on'](_0x5ae1cf,_0x1cc6e9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f2fb39f..c195a01 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 _0xec56=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','reject','delete','exports','multer','connect-timeout','express'];(function(_0x18eb72,_0x3c8781){var _0x5e8883=function(_0x4297f2){while(--_0x4297f2){_0x18eb72['push'](_0x18eb72['shift']());}};_0x5e8883(++_0x3c8781);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2f0b32,_0x540e5e){_0x2f0b32=_0x2f0b32-0x0;var _0x356a71=_0xec56[_0x2f0b32];return _0x356a71;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['get'](_0x6ec5('0x10'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')]('/',auth[_0x6ec5('0xa')](),interaction[_0x6ec5('0x13')](_0x6ec5('0x14'),'faxmessage:create'),controller[_0x6ec5('0x15')]);router[_0x6ec5('0x16')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x17')]);router[_0x6ec5('0x16')](_0x6ec5('0x18'),auth[_0x6ec5('0xa')](),controller['accept']);router[_0x6ec5('0x16')]('/:id/reject',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x19')]);router[_0x6ec5('0x1a')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller['destroy']);module[_0x6ec5('0x1b')]=router; \ No newline at end of file +var _0xb821=['path','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','reject','exports','util'];(function(_0x4aaed1,_0x348a38){var _0x3e0566=function(_0x2386b6){while(--_0x2386b6){_0x4aaed1['push'](_0x4aaed1['shift']());}};_0x3e0566(++_0x348a38);}(_0xb821,0xa7));var _0x1b82=function(_0xcd9043,_0x2e6767){_0xcd9043=_0xcd9043-0x0;var _0x5c810d=_0xb821[_0xcd9043];return _0x5c810d;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['get'](_0x1b82('0xd'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')]('/',auth[_0x1b82('0x9')](),interaction[_0x1b82('0x10')](_0x1b82('0x11'),_0x1b82('0x12')),controller['create']);router[_0x1b82('0x13')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0x14')]);router['put'](_0x1b82('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x1b82('0x13')]('/:id/reject',auth[_0x1b82('0x9')](),controller[_0x1b82('0x16')]);router['delete'](_0x1b82('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b82('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 86d4501..263129a 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 _0x21bd=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x5d2443,_0x96de9e){var _0x27e6d6=function(_0x16d971){while(--_0x16d971){_0x5d2443['push'](_0x5d2443['shift']());}};_0x27e6d6(++_0x96de9e);}(_0x21bd,0x157));var _0xd21b=function(_0x350a40,_0x58c430){_0x350a40=_0x350a40-0x0;var _0x14d07e=_0x21bd[_0x350a40];return _0x14d07e;};'use strict';var Sequelize=require(_0xd21b('0x0'));module[_0xd21b('0x1')]={'name':{'type':Sequelize[_0xd21b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd21b('0x2')]},'timeout':{'type':Sequelize[_0xd21b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd21b('0x4')](_0xd21b('0x5'),'beepall',_0xd21b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f12=['INTEGER','rrmemory','beepall','roundrobin','STRING','name'];(function(_0x100bd2,_0x486e14){var _0x34ca8e=function(_0x5ad69d){while(--_0x5ad69d){_0x100bd2['push'](_0x100bd2['shift']());}};_0x34ca8e(++_0x486e14);}(_0x9f12,0xe8));var _0x29f1=function(_0x27685e,_0x845417){_0x27685e=_0x27685e-0x0;var _0x224a6f=_0x9f12[_0x27685e];return _0x224a6f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x29f1('0x0')],'unique':_0x29f1('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x29f1('0x0')]},'timeout':{'type':Sequelize[_0x29f1('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x29f1('0x3'),_0x29f1('0x4'),_0x29f1('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x29f1('0x2')],'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 2aaeecf..0a574de 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 _0xdea6=['error','stack','name','send','index','type','model','map','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','filter','merge','options','FaxQueue','includeAll','rows','params','fields','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','rawAttributes','hasOwnProperty','pick','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','addTeams','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','ids','Agents','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','spread','getAgents','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','status','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','end','sendStatus'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xdea6,0xdf));var _0x6dea=function(_0x3f0042,_0xc42d32){_0x3f0042=_0x3f0042-0x0;var _0x3ee577=_0xdea6[_0x3f0042];return _0x3ee577;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dea('0x0'));var zipdir=require(_0x6dea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6dea('0x2'));var Mustache=require(_0x6dea('0x3'));var util=require('util');var path=require(_0x6dea('0x4'));var sox=require(_0x6dea('0x5'));var csv=require(_0x6dea('0x6'));var ejs=require(_0x6dea('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dea('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6dea('0x9'));var deskjs=require(_0x6dea('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6dea('0xb'));var Papa=require(_0x6dea('0xc'));var Redis=require(_0x6dea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6dea('0xe'));var as=require(_0x6dea('0xf'));var hardwareService=require(_0x6dea('0x10'));var logger=require(_0x6dea('0x11'))('api');var utils=require(_0x6dea('0x12'));var config=require(_0x6dea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6dea('0x14'))['db'];config[_0x6dea('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6dea('0x16'))(new Redis(config[_0x6dea('0x15')]));require(_0x6dea('0x17'))[_0x6dea('0x18')](socket);function respondWithStatusCode(_0x3dbf5d,_0x5e31b9){_0x5e31b9=_0x5e31b9||0xcc;return function(_0x4afdbb){if(_0x4afdbb){return _0x3dbf5d['sendStatus'](_0x5e31b9);}return _0x3dbf5d[_0x6dea('0x19')](_0x5e31b9)['end']();};}function respondWithResult(_0x344765,_0x2b56c7){_0x2b56c7=_0x2b56c7||0xc8;return function(_0x2181d2){if(_0x2181d2){return _0x344765[_0x6dea('0x19')](_0x2b56c7)['json'](_0x2181d2);}};}function respondWithFilteredResult(_0x18de9c,_0x37ca42){return function(_0x525022){if(_0x525022){var _0xf4c56d=typeof _0x37ca42['offset']===_0x6dea('0x1a')&&typeof _0x37ca42[_0x6dea('0x1b')]===_0x6dea('0x1a');var _0x1194b5=_0x525022[_0x6dea('0x1c')];var _0x51e01e=_0xf4c56d?0x0:_0x37ca42[_0x6dea('0x1d')];var _0x5d5696=_0xf4c56d?_0x525022['count']:_0x37ca42['offset']+_0x37ca42[_0x6dea('0x1b')];var _0x3c0467;if(_0x5d5696>=_0x1194b5){_0x5d5696=_0x1194b5;_0x3c0467=0xc8;}else{_0x3c0467=0xce;}_0x18de9c[_0x6dea('0x19')](_0x3c0467);return _0x18de9c[_0x6dea('0x1e')]('Content-Range',_0x51e01e+'-'+_0x5d5696+'/'+_0x1194b5)[_0x6dea('0x1f')](_0x525022);}return null;};}function patchUpdates(_0x4bf37b){return function(_0x1d2bc4){try{jsonpatch[_0x6dea('0x20')](_0x1d2bc4,_0x4bf37b,!![]);}catch(_0x1ff178){return BPromise[_0x6dea('0x21')](_0x1ff178);}return _0x1d2bc4[_0x6dea('0x22')]();};}function saveUpdates(_0x4e8cad,_0x3f9fae){return function(_0x59184c){if(_0x59184c){return _0x59184c['update'](_0x4e8cad)[_0x6dea('0x23')](function(_0x2b7cd8){return _0x2b7cd8;});}return null;};}function removeEntity(_0x2b12d4,_0x27f0ba){return function(_0x162f3){if(_0x162f3){return _0x162f3[_0x6dea('0x24')]()['then'](function(){var _0x50a017=_0x162f3['get']({'plain':!![]});var _0x4ab034=_0x6dea('0x25');return db[_0x6dea('0x26')]['destroy']({'where':{'type':_0x4ab034,'resourceId':_0x50a017['id']}})[_0x6dea('0x23')](function(){return _0x162f3;});})['then'](function(){_0x2b12d4[_0x6dea('0x19')](0xcc)[_0x6dea('0x27')]();});}};}function handleEntityNotFound(_0x16bdef,_0x101f1c){return function(_0x558831){if(!_0x558831){_0x16bdef[_0x6dea('0x28')](0x194);}return _0x558831;};}function handleError(_0x1c4ab8,_0x5f0251){_0x5f0251=_0x5f0251||0x1f4;return function(_0x36641f){logger[_0x6dea('0x29')](_0x36641f[_0x6dea('0x2a')]);if(_0x36641f[_0x6dea('0x2b')]){delete _0x36641f['name'];}_0x1c4ab8['status'](_0x5f0251)[_0x6dea('0x2c')](_0x36641f);};}exports[_0x6dea('0x2d')]=function(_0x35784f,_0xcccf4a){var _0x25c1c0={},_0x145519={},_0x1845f9={'count':0x0,'rows':[]};var _0x2f4b02=_['map'](db['FaxQueue']['rawAttributes'],function(_0x3d0aeb){return{'name':_0x3d0aeb['fieldName'],'type':_0x3d0aeb[_0x6dea('0x2e')]['key']};});_0x145519[_0x6dea('0x2f')]=_[_0x6dea('0x30')](_0x2f4b02,_0x6dea('0x2b'));_0x145519[_0x6dea('0x31')]=_[_0x6dea('0x32')](_0x35784f[_0x6dea('0x31')]);_0x145519[_0x6dea('0x33')]=_['intersection'](_0x145519[_0x6dea('0x2f')],_0x145519['query']);_0x25c1c0[_0x6dea('0x34')]=_[_0x6dea('0x35')](_0x145519['model'],qs['fields'](_0x35784f['query']['fields']));_0x25c1c0['attributes']=_0x25c1c0['attributes'][_0x6dea('0x36')]?_0x25c1c0[_0x6dea('0x34')]:_0x145519[_0x6dea('0x2f')];if(!_0x35784f[_0x6dea('0x31')]['hasOwnProperty'](_0x6dea('0x37'))){_0x25c1c0['limit']=qs[_0x6dea('0x1b')](_0x35784f[_0x6dea('0x31')][_0x6dea('0x1b')]);_0x25c1c0[_0x6dea('0x1d')]=qs[_0x6dea('0x1d')](_0x35784f[_0x6dea('0x31')]['offset']);}_0x25c1c0[_0x6dea('0x38')]=qs[_0x6dea('0x39')](_0x35784f[_0x6dea('0x31')][_0x6dea('0x39')]);_0x25c1c0[_0x6dea('0x3a')]=qs[_0x6dea('0x33')](_['pick'](_0x35784f[_0x6dea('0x31')],_0x145519['filters']),_0x2f4b02);if(_0x35784f[_0x6dea('0x31')][_0x6dea('0x3b')]){_0x25c1c0[_0x6dea('0x3a')]=_[_0x6dea('0x3c')](_0x25c1c0[_0x6dea('0x3a')],{'$or':_[_0x6dea('0x30')](_0x2f4b02,function(_0x22c6a7){if(_0x22c6a7['type']!=='VIRTUAL'){var _0x522fdf={};_0x522fdf[_0x22c6a7[_0x6dea('0x2b')]]={'$like':'%'+_0x35784f[_0x6dea('0x31')]['filter']+'%'};return _0x522fdf;}})});}_0x25c1c0=_[_0x6dea('0x3c')]({},_0x25c1c0,_0x35784f[_0x6dea('0x3d')]);var _0x580ea5={'where':_0x25c1c0[_0x6dea('0x3a')]};return db[_0x6dea('0x3e')][_0x6dea('0x1c')](_0x580ea5)[_0x6dea('0x23')](function(_0x51aa32){_0x1845f9['count']=_0x51aa32;if(_0x35784f[_0x6dea('0x31')][_0x6dea('0x3f')]){_0x25c1c0['include']=[{'all':!![]}];}return db[_0x6dea('0x3e')]['findAll'](_0x25c1c0);})[_0x6dea('0x23')](function(_0x568813){_0x1845f9[_0x6dea('0x40')]=_0x568813;return _0x1845f9;})[_0x6dea('0x23')](respondWithFilteredResult(_0xcccf4a,_0x25c1c0))['catch'](handleError(_0xcccf4a,null));};exports['show']=function(_0x43a5ef,_0x250896){var _0x46f5a2={'raw':!![],'where':{'id':_0x43a5ef[_0x6dea('0x41')]['id']}},_0xcfc79e={};_0xcfc79e[_0x6dea('0x2f')]=_['keys'](db[_0x6dea('0x3e')]['rawAttributes']);_0xcfc79e['query']=_[_0x6dea('0x32')](_0x43a5ef[_0x6dea('0x31')]);_0xcfc79e['filters']=_['intersection'](_0xcfc79e[_0x6dea('0x2f')],_0xcfc79e[_0x6dea('0x31')]);_0x46f5a2['attributes']=_[_0x6dea('0x35')](_0xcfc79e['model'],qs[_0x6dea('0x42')](_0x43a5ef[_0x6dea('0x31')]['fields']));_0x46f5a2[_0x6dea('0x34')]=_0x46f5a2[_0x6dea('0x34')][_0x6dea('0x36')]?_0x46f5a2[_0x6dea('0x34')]:_0xcfc79e[_0x6dea('0x2f')];if(_0x43a5ef[_0x6dea('0x31')][_0x6dea('0x3f')]){_0x46f5a2[_0x6dea('0x43')]=[{'all':!![]}];}_0x46f5a2=_[_0x6dea('0x3c')]({},_0x46f5a2,_0x43a5ef[_0x6dea('0x3d')]);return db['FaxQueue'][_0x6dea('0x44')](_0x46f5a2)[_0x6dea('0x23')](handleEntityNotFound(_0x250896,null))[_0x6dea('0x23')](respondWithResult(_0x250896,null))[_0x6dea('0x45')](handleError(_0x250896,null));};exports['create']=function(_0x51df74,_0x4b6ad8){return db[_0x6dea('0x3e')][_0x6dea('0x46')](_0x51df74['body'],{})[_0x6dea('0x23')](function(_0x45ec8f){var _0x3f41d0=_0x51df74[_0x6dea('0x47')]['get']({'plain':!![]});if(!_0x3f41d0)throw new Error(_0x6dea('0x48'));if(_0x3f41d0[_0x6dea('0x49')]===_0x6dea('0x47')){var _0x3ddcdf=_0x45ec8f[_0x6dea('0x4a')]({'plain':!![]});var _0xd8c2a3=_0x6dea('0x25');return db['UserProfileSection'][_0x6dea('0x44')]({'where':{'name':_0xd8c2a3,'userProfileId':_0x3f41d0[_0x6dea('0x4b')]},'raw':!![]})[_0x6dea('0x23')](function(_0x1af7d6){if(_0x1af7d6&&_0x1af7d6[_0x6dea('0x4c')]===0x0){return db[_0x6dea('0x26')][_0x6dea('0x46')]({'name':_0x3ddcdf[_0x6dea('0x2b')],'resourceId':_0x3ddcdf['id'],'type':_0x1af7d6[_0x6dea('0x2b')],'sectionId':_0x1af7d6['id']},{})[_0x6dea('0x23')](function(){return _0x45ec8f;});}else{return _0x45ec8f;}})['catch'](function(_0x4850fc){logger[_0x6dea('0x29')](_0x6dea('0x4d'),_0x4850fc);throw _0x4850fc;});}return _0x45ec8f;})['then'](respondWithResult(_0x4b6ad8,0xc9))['catch'](handleError(_0x4b6ad8,null));};exports[_0x6dea('0x4e')]=function(_0x337d77,_0x5745a3){if(_0x337d77[_0x6dea('0x4f')]['id']){delete _0x337d77[_0x6dea('0x4f')]['id'];}return db[_0x6dea('0x3e')]['find']({'where':{'id':_0x337d77[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](handleEntityNotFound(_0x5745a3,null))['then'](saveUpdates(_0x337d77[_0x6dea('0x4f')],null))['then'](respondWithResult(_0x5745a3,null))[_0x6dea('0x45')](handleError(_0x5745a3,null));};exports[_0x6dea('0x24')]=function(_0x1887b3,_0x5e863e){return db[_0x6dea('0x3e')]['find']({'where':{'id':_0x1887b3[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](handleEntityNotFound(_0x5e863e,null))[_0x6dea('0x23')](removeEntity(_0x5e863e,null))[_0x6dea('0x45')](handleError(_0x5e863e,null));};exports[_0x6dea('0x50')]=function(_0x467d80,_0x55da91){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x55da91,null))[_0x6dea('0x45')](handleError(_0x55da91,null));};exports[_0x6dea('0x51')]=function(_0x4804ad,_0xc10315,_0x3fd222){var _0x1dff91={'raw':!![],'where':{}},_0x51d049={},_0x4df956;return db[_0x6dea('0x3e')][_0x6dea('0x52')]({'where':{'id':_0x4804ad[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](handleEntityNotFound(_0xc10315,null))[_0x6dea('0x23')](function(_0x55b893){if(_0x55b893){_0x4df956=_0x55b893[_0x6dea('0x4a')]({'plain':!![]});_0x51d049[_0x6dea('0x2f')]=_[_0x6dea('0x32')](db[_0x6dea('0x53')][_0x6dea('0x54')]);_0x51d049[_0x6dea('0x31')]=_['keys'](_0x4804ad[_0x6dea('0x31')]);_0x51d049[_0x6dea('0x33')]=_['intersection'](_0x51d049[_0x6dea('0x2f')],_0x51d049[_0x6dea('0x31')]);_0x1dff91[_0x6dea('0x34')]=_[_0x6dea('0x35')](_0x51d049[_0x6dea('0x2f')],qs[_0x6dea('0x42')](_0x4804ad[_0x6dea('0x31')]['fields']));_0x1dff91[_0x6dea('0x34')]=_0x1dff91['attributes'][_0x6dea('0x36')]?_0x1dff91['attributes']:_0x51d049[_0x6dea('0x2f')];if(!_0x4804ad[_0x6dea('0x31')][_0x6dea('0x55')](_0x6dea('0x37'))){_0x1dff91['limit']=qs[_0x6dea('0x1b')](_0x4804ad[_0x6dea('0x31')][_0x6dea('0x1b')]);_0x1dff91[_0x6dea('0x1d')]=qs[_0x6dea('0x1d')](_0x4804ad[_0x6dea('0x31')]['offset']);}_0x1dff91[_0x6dea('0x38')]=qs[_0x6dea('0x39')](_0x4804ad[_0x6dea('0x31')][_0x6dea('0x39')]);_0x1dff91[_0x6dea('0x3a')]=qs[_0x6dea('0x33')](_[_0x6dea('0x56')](_0x4804ad[_0x6dea('0x31')],_0x51d049[_0x6dea('0x33')]));_0x1dff91[_0x6dea('0x3a')][_0x6dea('0x57')]=_0x55b893['id'];if(_0x4804ad[_0x6dea('0x31')][_0x6dea('0x3b')]){_0x1dff91['where']=_[_0x6dea('0x3c')](_0x1dff91['where'],{'$or':_[_0x6dea('0x30')](_0x1dff91[_0x6dea('0x34')],function(_0x1c3dd8){var _0x1525da={};_0x1525da[_0x1c3dd8]={'$like':'%'+_0x4804ad[_0x6dea('0x31')][_0x6dea('0x3b')]+'%'};return _0x1525da;})});}_0x1dff91=_['merge']({},_0x1dff91,_0x4804ad[_0x6dea('0x3d')]);return db['UserFaxQueue'][_0x6dea('0x58')](_0x1dff91);}})[_0x6dea('0x23')](function(_0x70a41e){if(_0x70a41e){return db[_0x6dea('0x59')][_0x6dea('0x5a')]({'where':{'id':_['map'](_0x70a41e,_0x6dea('0x5b')),'role':_0x6dea('0x5c')},'attributes':['id',_0x6dea('0x2b'),'faxPause',_0x6dea('0x5d'),_0x6dea('0x5e')]});}})[_0x6dea('0x23')](function(_0x3c662d){if(_0x3c662d){return{'count':_0x3c662d[_0x6dea('0x1c')],'rows':_[_0x6dea('0x30')](_0x3c662d[_0x6dea('0x40')],function(_0xb867e2){return{'membername':_0xb867e2['name'],'UserId':_0xb867e2['id'],'queue_name':_0x4df956[_0x6dea('0x2b')],'FaxQueueId':_0x4df956['id'],'interface':util[_0x6dea('0x5f')](_0x6dea('0x60'),_0x6dea('0x61'),_0xb867e2['name']),'penalty':0x0,'paused':_0xb867e2[_0x6dea('0x62')],'createdAt':_0xb867e2[_0x6dea('0x5e')],'updatedAt':_0xb867e2[_0x6dea('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6dea('0x23')](respondWithFilteredResult(_0xc10315,_0x1dff91))['catch'](handleError(_0xc10315,null));};exports[_0x6dea('0x63')]=function(_0x37b35d,_0x916c4,_0x48b8ba){var _0x3093cc={};var _0x36b8c8={};var _0xa55141;var _0x447b51;return db[_0x6dea('0x3e')][_0x6dea('0x52')]({'where':{'id':_0x37b35d[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](handleEntityNotFound(_0x916c4,null))['then'](function(_0x13affc){if(_0x13affc){_0xa55141=_0x13affc;_0x36b8c8['model']=_['keys'](db[_0x6dea('0x64')][_0x6dea('0x54')]);_0x36b8c8['query']=_[_0x6dea('0x32')](_0x37b35d[_0x6dea('0x31')]);_0x36b8c8[_0x6dea('0x33')]=_[_0x6dea('0x35')](_0x36b8c8[_0x6dea('0x2f')],_0x36b8c8[_0x6dea('0x31')]);_0x3093cc[_0x6dea('0x34')]=_['intersection'](_0x36b8c8[_0x6dea('0x2f')],qs[_0x6dea('0x42')](_0x37b35d[_0x6dea('0x31')][_0x6dea('0x42')]));_0x3093cc[_0x6dea('0x34')]=_0x3093cc[_0x6dea('0x34')][_0x6dea('0x36')]?_0x3093cc[_0x6dea('0x34')]:_0x36b8c8[_0x6dea('0x2f')];_0x3093cc['order']=qs['sort'](_0x37b35d[_0x6dea('0x31')][_0x6dea('0x39')]);_0x3093cc['where']=qs[_0x6dea('0x33')](_[_0x6dea('0x56')](_0x37b35d['query'],_0x36b8c8[_0x6dea('0x33')]));if(_0x37b35d['query'][_0x6dea('0x3b')]){_0x3093cc[_0x6dea('0x3a')]=_[_0x6dea('0x3c')](_0x3093cc[_0x6dea('0x3a')],{'$or':_[_0x6dea('0x30')](_0x3093cc['attributes'],function(_0xa1af8b){var _0x22c71e={};_0x22c71e[_0xa1af8b]={'$like':'%'+_0x37b35d[_0x6dea('0x31')][_0x6dea('0x3b')]+'%'};return _0x22c71e;})});}_0x3093cc=_[_0x6dea('0x3c')]({},_0x3093cc,_0x37b35d['options']);return _0xa55141['getTeams'](_0x3093cc);}})[_0x6dea('0x23')](function(_0x2450b4){if(_0x2450b4){_0x447b51=_0x2450b4['length'];if(!_0x37b35d[_0x6dea('0x31')]['hasOwnProperty']('nolimit')){_0x3093cc[_0x6dea('0x1b')]=qs[_0x6dea('0x1b')](_0x37b35d['query'][_0x6dea('0x1b')]);_0x3093cc[_0x6dea('0x1d')]=qs['offset'](_0x37b35d[_0x6dea('0x31')][_0x6dea('0x1d')]);}return _0xa55141['getTeams'](_0x3093cc);}})[_0x6dea('0x23')](function(_0x2707d8){if(_0x2707d8){return _0x2707d8?{'count':_0x447b51,'rows':_0x2707d8}:null;}})['then'](respondWithResult(_0x916c4,null))[_0x6dea('0x45')](handleError(_0x916c4,null));};exports[_0x6dea('0x65')]=function(_0x4bdcaf,_0x4dc17b,_0x1cbc21){var _0x4cc689=_0x4bdcaf[_0x6dea('0x4f')]['ids'];return db[_0x6dea('0x64')][_0x6dea('0x58')]({'where':{'id':_0x4cc689},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x6dea('0x2b'),'online','voicePause',_0x6dea('0x66')],'raw':!![]}]})[_0x6dea('0x23')](function(_0x169af9){if(_0x169af9){var _0x52db95=_[_0x6dea('0x67')](_0x169af9,function(_0x4fbcdf){var _0x42bb86=_0x4fbcdf[_0x6dea('0x4a')]({'plain':!![]});return _0x42bb86['Agents'];});return db[_0x6dea('0x3e')][_0x6dea('0x44')]({'where':{'id':_0x4bdcaf[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](function(_0x5b72b){return db[_0x6dea('0x68')][_0x6dea('0x69')](function(_0x13feb8){return _0x5b72b[_0x6dea('0x65')](_0x4cc689,{'transaction':_0x13feb8})[_0x6dea('0x23')](function(){return BPromise[_0x6dea('0x6a')](_0x52db95,function(_0x333520){return db[_0x6dea('0x53')]['findOrCreate']({'where':{'UserId':_0x333520['id'],'FaxQueueId':_0x4bdcaf[_0x6dea('0x41')]['id']},'transaction':_0x13feb8});});})[_0x6dea('0x23')](function(){_0x52db95[_0x6dea('0x6b')](function(_0x4a6e14){socket[_0x6dea('0x6c')]('userFaxQueue:save',{'UserId':_0x4a6e14['id'],'FaxQueueId':_0x5b72b['id']});});});});});}})[_0x6dea('0x23')](respondWithStatusCode(_0x4dc17b,null))[_0x6dea('0x45')](handleError(_0x4dc17b,null));};exports[_0x6dea('0x6d')]=function(_0x2b7956,_0x3beb97,_0x149318){return db[_0x6dea('0x64')][_0x6dea('0x58')]({'where':{'id':_0x2b7956[_0x6dea('0x31')][_0x6dea('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x6dea('0x59')],'as':_0x6dea('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x6dea('0x23')](handleEntityNotFound(_0x3beb97,null))[_0x6dea('0x23')](function(_0x54c892){var _0x30f22a=_['map'](_0x54c892,'id');var _0x5932d4=[];var _0x7e05b2=[];var _0x54329e=squel['select']();_0x54329e[_0x6dea('0x70')](_0x6dea('0x71'))[_0x6dea('0x72')](_0x6dea('0x73'),'tq')[_0x6dea('0x74')](_0x6dea('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6dea('0x3a')]('FaxQueueId\x20=\x20?',_0x2b7956[_0x6dea('0x41')]['id']);for(var _0x184763=0x0;_0x184763<_0x54c892[_0x6dea('0x36')];_0x184763+=0x1){let _0x24302a=_0x54c892[_0x184763];for(var _0x4f1539=0x0;_0x4f1539<_0x24302a[_0x6dea('0x6f')][_0x6dea('0x36')];_0x4f1539+=0x1){let _0x45739c=_0x24302a[_0x6dea('0x6f')][_0x4f1539];var _0x1cf617=_0x54329e['clone']();_0x1cf617[_0x6dea('0x3a')]('ut.UserId\x20=\x20?',_0x45739c['id']);_0x7e05b2['push'](db['sequelize'][_0x6dea('0x31')](_0x1cf617[_0x6dea('0x76')](),{'type':db[_0x6dea('0x68')][_0x6dea('0x77')][_0x6dea('0x78')]})[_0x6dea('0x23')](function(_0x5ef322){if(_0x5ef322[_0x6dea('0x36')]===0x1){return _0x45739c['id'];}else{var _0x4b3f52=_[_0x6dea('0x79')](_['map'](_0x5ef322,'TeamId'),function(_0x50be61){return _[_0x6dea('0x7a')](_0x30f22a,_0x50be61);});if(_0x4b3f52){return _0x45739c['id'];}}}));}}return BPromise[_0x6dea('0x7b')](_0x7e05b2)[_0x6dea('0x23')](function(_0xb73d5){_0x5932d4=_(_0x5932d4)[_0x6dea('0x7c')](_0xb73d5)[_0x6dea('0x7d')]()[_0x6dea('0x7e')]();return db[_0x6dea('0x3e')]['find']({'where':{'id':_0x2b7956['params']['id']}})[_0x6dea('0x23')](function(_0x596d2d){return db[_0x6dea('0x68')][_0x6dea('0x69')](function(_0x379410){return _0x596d2d[_0x6dea('0x6d')](_0x2b7956[_0x6dea('0x31')]['ids'],{'transaction':_0x379410})['then'](function(){if(!_[_0x6dea('0x7f')](_0x5932d4)){return _0x596d2d[_0x6dea('0x80')](_0x5932d4,{'transaction':_0x379410});}})['then'](function(){_0x5932d4[_0x6dea('0x6b')](function(_0x5d4d5c){socket[_0x6dea('0x6c')](_0x6dea('0x81'),{'UserId':_0x5d4d5c,'FaxQueueId':_0x596d2d['id']});});});});});});})[_0x6dea('0x23')](respondWithStatusCode(_0x3beb97,null))[_0x6dea('0x45')](handleError(_0x3beb97,null));};exports['addAgents']=function(_0x174973,_0x148121,_0x37c8de){return db['FaxQueue'][_0x6dea('0x44')]({'where':{'id':_0x174973[_0x6dea('0x41')]['id']}})['then'](handleEntityNotFound(_0x148121,null))[_0x6dea('0x23')](function(_0xb84a8c){if(_0xb84a8c){return _0xb84a8c['addAgents'](_0x174973[_0x6dea('0x4f')][_0x6dea('0x6e')],_['omit'](_0x174973[_0x6dea('0x4f')],[_0x6dea('0x6e'),'id'])||{})[_0x6dea('0x82')](function(_0x457ddd){for(var _0x428a4f=0x0;_0x428a4f<_0x174973[_0x6dea('0x4f')][_0x6dea('0x6e')][_0x6dea('0x36')];_0x428a4f+=0x1){socket[_0x6dea('0x6c')]('userFaxQueue:save',{'UserId':Number(_0x174973[_0x6dea('0x4f')][_0x6dea('0x6e')][_0x428a4f]),'FaxQueueId':Number(_0x174973[_0x6dea('0x41')]['id'])});}return _0x457ddd;});}})[_0x6dea('0x23')](respondWithResult(_0x148121,null))[_0x6dea('0x45')](handleError(_0x148121,null));};exports['removeAgents']=function(_0x312b64,_0x176ef4,_0xb07c81){return db['FaxQueue'][_0x6dea('0x44')]({'where':{'id':_0x312b64[_0x6dea('0x41')]['id']}})[_0x6dea('0x23')](handleEntityNotFound(_0x176ef4,null))[_0x6dea('0x23')](function(_0x37ef73){if(_0x37ef73){return _0x37ef73['removeAgents'](_0x312b64[_0x6dea('0x31')][_0x6dea('0x6e')])['then'](function(){if(_['isArray'](_0x312b64[_0x6dea('0x31')][_0x6dea('0x6e')])){for(var _0x3bc1e6=0x0;_0x3bc1e6<_0x312b64['query'][_0x6dea('0x6e')][_0x6dea('0x36')];_0x3bc1e6+=0x1){socket[_0x6dea('0x6c')](_0x6dea('0x81'),{'UserId':Number(_0x312b64[_0x6dea('0x31')][_0x6dea('0x6e')][_0x3bc1e6]),'FaxQueueId':Number(_0x312b64[_0x6dea('0x41')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x312b64[_0x6dea('0x31')][_0x6dea('0x6e')]),'FaxQueueId':Number(_0x312b64['params']['id'])});}});}})['then'](respondWithStatusCode(_0x176ef4,null))['catch'](handleError(_0x176ef4,null));};exports['getAgents']=function(_0x41c45e,_0x5dbc85,_0x86a75c){var _0x44c122={};var _0x456ce2={};var _0x393654;var _0x4608af;return db['FaxQueue'][_0x6dea('0x52')]({'where':{'id':_0x41c45e[_0x6dea('0x41')]['id']}})['then'](handleEntityNotFound(_0x5dbc85,null))[_0x6dea('0x23')](function(_0x5600d7){if(_0x5600d7){_0x393654=_0x5600d7;_0x456ce2[_0x6dea('0x2f')]=_[_0x6dea('0x32')](db[_0x6dea('0x59')]['rawAttributes']);_0x456ce2[_0x6dea('0x31')]=_[_0x6dea('0x32')](_0x41c45e[_0x6dea('0x31')]);_0x456ce2[_0x6dea('0x33')]=_[_0x6dea('0x35')](_0x456ce2[_0x6dea('0x2f')],_0x456ce2['query']);_0x44c122[_0x6dea('0x34')]=_[_0x6dea('0x35')](_0x456ce2['model'],qs['fields'](_0x41c45e['query'][_0x6dea('0x42')]));_0x44c122[_0x6dea('0x34')]=_0x44c122[_0x6dea('0x34')][_0x6dea('0x36')]?_0x44c122[_0x6dea('0x34')]:_0x456ce2[_0x6dea('0x2f')];_0x44c122[_0x6dea('0x38')]=qs[_0x6dea('0x39')](_0x41c45e['query']['sort']);_0x44c122[_0x6dea('0x3a')]=qs['filters'](_[_0x6dea('0x56')](_0x41c45e[_0x6dea('0x31')],_0x456ce2['filters']));if(_0x41c45e['query'][_0x6dea('0x3b')]){_0x44c122['where']=_[_0x6dea('0x3c')](_0x44c122['where'],{'$or':_[_0x6dea('0x30')](_0x44c122[_0x6dea('0x34')],function(_0x1dd5a4){var _0x30f652={};_0x30f652[_0x1dd5a4]={'$like':'%'+_0x41c45e['query'][_0x6dea('0x3b')]+'%'};return _0x30f652;})});}_0x44c122=_[_0x6dea('0x3c')]({},_0x44c122,_0x41c45e[_0x6dea('0x3d')]);return _0x393654[_0x6dea('0x83')](_0x44c122);}})[_0x6dea('0x23')](function(_0x5f2cd9){if(_0x5f2cd9){_0x4608af=_0x5f2cd9[_0x6dea('0x36')];if(!_0x41c45e[_0x6dea('0x31')][_0x6dea('0x55')](_0x6dea('0x37'))){_0x44c122[_0x6dea('0x1b')]=qs[_0x6dea('0x1b')](_0x41c45e[_0x6dea('0x31')][_0x6dea('0x1b')]);_0x44c122[_0x6dea('0x1d')]=qs[_0x6dea('0x1d')](_0x41c45e[_0x6dea('0x31')][_0x6dea('0x1d')]);}return _0x393654['getAgents'](_0x44c122);}})[_0x6dea('0x23')](function(_0x23703e){if(_0x23703e){return _0x23703e?{'count':_0x4608af,'rows':_0x23703e}:null;}})['then'](respondWithResult(_0x5dbc85,null))['catch'](handleError(_0x5dbc85,null));}; \ No newline at end of file +var _0x8f1d=['createdAt','getTeams','findOne','Team','Agents','online','voicePause','interface','transaction','addTeams','each','forEach','emit','userFaxQueue:save','removeTeams','ids','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','includes','union','compact','value','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','sendStatus','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserFaxQueue','pick','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','%s/%s','SIP','faxPause'];(function(_0x37abda,_0x2635ec){var _0x46a26f=function(_0x55a590){while(--_0x55a590){_0x37abda['push'](_0x37abda['shift']());}};_0x46a26f(++_0x2635ec);}(_0x8f1d,0xb0));var _0xd8f1=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x8f1d[_0x58999b];return _0x5efc3a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8f1('0x0'));var jsonpatch=require(_0xd8f1('0x1'));var rp=require(_0xd8f1('0x2'));var moment=require(_0xd8f1('0x3'));var BPromise=require(_0xd8f1('0x4'));var Mustache=require('mustache');var util=require(_0xd8f1('0x5'));var path=require(_0xd8f1('0x6'));var sox=require(_0xd8f1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8f1('0x8'));var _=require('lodash');var squel=require(_0xd8f1('0x9'));var crypto=require(_0xd8f1('0xa'));var jsforce=require(_0xd8f1('0xb'));var deskjs=require(_0xd8f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd8f1('0xd'));var Papa=require(_0xd8f1('0xe'));var Redis=require(_0xd8f1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd8f1('0x10'));var hardwareService=require(_0xd8f1('0x11'));var logger=require(_0xd8f1('0x12'))(_0xd8f1('0x13'));var utils=require(_0xd8f1('0x14'));var config=require(_0xd8f1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f1('0x16'))['db'];config['redis']=_['defaults'](config[_0xd8f1('0x17')],{'host':_0xd8f1('0x18'),'port':0x18eb});var socket=require(_0xd8f1('0x19'))(new Redis(config[_0xd8f1('0x17')]));require(_0xd8f1('0x1a'))['register'](socket);function respondWithStatusCode(_0x11b59d,_0x45cbfa){_0x45cbfa=_0x45cbfa||0xcc;return function(_0x3c1d61){if(_0x3c1d61){return _0x11b59d['sendStatus'](_0x45cbfa);}return _0x11b59d[_0xd8f1('0x1b')](_0x45cbfa)[_0xd8f1('0x1c')]();};}function respondWithResult(_0x3f7a8f,_0x55417a){_0x55417a=_0x55417a||0xc8;return function(_0x146015){if(_0x146015){return _0x3f7a8f[_0xd8f1('0x1b')](_0x55417a)[_0xd8f1('0x1d')](_0x146015);}};}function respondWithFilteredResult(_0x144049,_0x2a9fb8){return function(_0x4c0b41){if(_0x4c0b41){var _0x5c3a4d=typeof _0x2a9fb8[_0xd8f1('0x1e')]===_0xd8f1('0x1f')&&typeof _0x2a9fb8[_0xd8f1('0x20')]==='undefined';var _0x439f5d=_0x4c0b41['count'];var _0x16a9bd=_0x5c3a4d?0x0:_0x2a9fb8[_0xd8f1('0x1e')];var _0x313ee7=_0x5c3a4d?_0x4c0b41['count']:_0x2a9fb8['offset']+_0x2a9fb8[_0xd8f1('0x20')];var _0x3bccd8;if(_0x313ee7>=_0x439f5d){_0x313ee7=_0x439f5d;_0x3bccd8=0xc8;}else{_0x3bccd8=0xce;}_0x144049[_0xd8f1('0x1b')](_0x3bccd8);return _0x144049[_0xd8f1('0x21')](_0xd8f1('0x22'),_0x16a9bd+'-'+_0x313ee7+'/'+_0x439f5d)['json'](_0x4c0b41);}return null;};}function patchUpdates(_0x70184a){return function(_0xe59f){try{jsonpatch[_0xd8f1('0x23')](_0xe59f,_0x70184a,!![]);}catch(_0x5c4ce5){return BPromise[_0xd8f1('0x24')](_0x5c4ce5);}return _0xe59f[_0xd8f1('0x25')]();};}function saveUpdates(_0x3f0295,_0x1b2f2c){return function(_0x1cee9d){if(_0x1cee9d){return _0x1cee9d[_0xd8f1('0x26')](_0x3f0295)[_0xd8f1('0x27')](function(_0x1f2f47){return _0x1f2f47;});}return null;};}function removeEntity(_0x3d6244,_0x3c7000){return function(_0x828f5c){if(_0x828f5c){return _0x828f5c['destroy']()[_0xd8f1('0x27')](function(){var _0xe7764f=_0x828f5c[_0xd8f1('0x28')]({'plain':!![]});var _0x3da356='FaxQueues';return db['UserProfileResource'][_0xd8f1('0x29')]({'where':{'type':_0x3da356,'resourceId':_0xe7764f['id']}})[_0xd8f1('0x27')](function(){return _0x828f5c;});})[_0xd8f1('0x27')](function(){_0x3d6244[_0xd8f1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfaf8d2,_0x2af59a){return function(_0x6d3b23){if(!_0x6d3b23){_0xfaf8d2[_0xd8f1('0x2a')](0x194);}return _0x6d3b23;};}function handleError(_0x5f5513,_0x151549){_0x151549=_0x151549||0x1f4;return function(_0x484160){logger['error'](_0x484160[_0xd8f1('0x2b')]);if(_0x484160[_0xd8f1('0x2c')]){delete _0x484160[_0xd8f1('0x2c')];}_0x5f5513[_0xd8f1('0x1b')](_0x151549)['send'](_0x484160);};}exports[_0xd8f1('0x2d')]=function(_0xe057e4,_0x398d1b){var _0x5c84ba={},_0xa45195={},_0x3ff234={'count':0x0,'rows':[]};var _0x25f46b=_['map'](db[_0xd8f1('0x2e')][_0xd8f1('0x2f')],function(_0x4b7d6e){return{'name':_0x4b7d6e[_0xd8f1('0x30')],'type':_0x4b7d6e[_0xd8f1('0x31')][_0xd8f1('0x32')]};});_0xa45195[_0xd8f1('0x33')]=_[_0xd8f1('0x34')](_0x25f46b,_0xd8f1('0x2c'));_0xa45195[_0xd8f1('0x35')]=_[_0xd8f1('0x36')](_0xe057e4['query']);_0xa45195[_0xd8f1('0x37')]=_[_0xd8f1('0x38')](_0xa45195[_0xd8f1('0x33')],_0xa45195['query']);_0x5c84ba['attributes']=_[_0xd8f1('0x38')](_0xa45195[_0xd8f1('0x33')],qs[_0xd8f1('0x39')](_0xe057e4[_0xd8f1('0x35')]['fields']));_0x5c84ba[_0xd8f1('0x3a')]=_0x5c84ba[_0xd8f1('0x3a')][_0xd8f1('0x3b')]?_0x5c84ba[_0xd8f1('0x3a')]:_0xa45195[_0xd8f1('0x33')];if(!_0xe057e4[_0xd8f1('0x35')][_0xd8f1('0x3c')](_0xd8f1('0x3d'))){_0x5c84ba[_0xd8f1('0x20')]=qs[_0xd8f1('0x20')](_0xe057e4[_0xd8f1('0x35')][_0xd8f1('0x20')]);_0x5c84ba[_0xd8f1('0x1e')]=qs['offset'](_0xe057e4[_0xd8f1('0x35')][_0xd8f1('0x1e')]);}_0x5c84ba[_0xd8f1('0x3e')]=qs[_0xd8f1('0x3f')](_0xe057e4[_0xd8f1('0x35')]['sort']);_0x5c84ba[_0xd8f1('0x40')]=qs['filters'](_['pick'](_0xe057e4[_0xd8f1('0x35')],_0xa45195['filters']),_0x25f46b);if(_0xe057e4[_0xd8f1('0x35')][_0xd8f1('0x41')]){_0x5c84ba[_0xd8f1('0x40')]=_[_0xd8f1('0x42')](_0x5c84ba[_0xd8f1('0x40')],{'$or':_[_0xd8f1('0x34')](_0x25f46b,function(_0x1e6642){if(_0x1e6642[_0xd8f1('0x31')]!==_0xd8f1('0x43')){var _0x588b39={};_0x588b39[_0x1e6642[_0xd8f1('0x2c')]]={'$like':'%'+_0xe057e4['query'][_0xd8f1('0x41')]+'%'};return _0x588b39;}})});}_0x5c84ba=_['merge']({},_0x5c84ba,_0xe057e4[_0xd8f1('0x44')]);var _0x5551ad={'where':_0x5c84ba['where']};return db[_0xd8f1('0x2e')][_0xd8f1('0x45')](_0x5551ad)[_0xd8f1('0x27')](function(_0x4b18df){_0x3ff234[_0xd8f1('0x45')]=_0x4b18df;if(_0xe057e4[_0xd8f1('0x35')][_0xd8f1('0x46')]){_0x5c84ba[_0xd8f1('0x47')]=[{'all':!![]}];}return db[_0xd8f1('0x2e')]['findAll'](_0x5c84ba);})['then'](function(_0x2279ff){_0x3ff234[_0xd8f1('0x48')]=_0x2279ff;return _0x3ff234;})[_0xd8f1('0x27')](respondWithFilteredResult(_0x398d1b,_0x5c84ba))[_0xd8f1('0x49')](handleError(_0x398d1b,null));};exports[_0xd8f1('0x4a')]=function(_0x4e302f,_0x5368eb){var _0x55849a={'raw':!![],'where':{'id':_0x4e302f['params']['id']}},_0x2c562a={};_0x2c562a[_0xd8f1('0x33')]=_[_0xd8f1('0x36')](db[_0xd8f1('0x2e')][_0xd8f1('0x2f')]);_0x2c562a[_0xd8f1('0x35')]=_['keys'](_0x4e302f[_0xd8f1('0x35')]);_0x2c562a[_0xd8f1('0x37')]=_['intersection'](_0x2c562a[_0xd8f1('0x33')],_0x2c562a[_0xd8f1('0x35')]);_0x55849a[_0xd8f1('0x3a')]=_['intersection'](_0x2c562a[_0xd8f1('0x33')],qs['fields'](_0x4e302f[_0xd8f1('0x35')][_0xd8f1('0x39')]));_0x55849a[_0xd8f1('0x3a')]=_0x55849a[_0xd8f1('0x3a')][_0xd8f1('0x3b')]?_0x55849a[_0xd8f1('0x3a')]:_0x2c562a[_0xd8f1('0x33')];if(_0x4e302f[_0xd8f1('0x35')][_0xd8f1('0x46')]){_0x55849a[_0xd8f1('0x47')]=[{'all':!![]}];}_0x55849a=_['merge']({},_0x55849a,_0x4e302f[_0xd8f1('0x44')]);return db[_0xd8f1('0x2e')][_0xd8f1('0x4b')](_0x55849a)[_0xd8f1('0x27')](handleEntityNotFound(_0x5368eb,null))[_0xd8f1('0x27')](respondWithResult(_0x5368eb,null))['catch'](handleError(_0x5368eb,null));};exports[_0xd8f1('0x4c')]=function(_0x4ce5e5,_0xabef5e){return db['FaxQueue'][_0xd8f1('0x4c')](_0x4ce5e5[_0xd8f1('0x4d')],{})[_0xd8f1('0x27')](function(_0x3939a9){var _0x34008c=_0x4ce5e5[_0xd8f1('0x4e')][_0xd8f1('0x28')]({'plain':!![]});if(!_0x34008c)throw new Error(_0xd8f1('0x4f'));if(_0x34008c[_0xd8f1('0x50')]===_0xd8f1('0x4e')){var _0x413a6d=_0x3939a9['get']({'plain':!![]});var _0x1ce0a0=_0xd8f1('0x51');return db[_0xd8f1('0x52')]['find']({'where':{'name':_0x1ce0a0,'userProfileId':_0x34008c[_0xd8f1('0x53')]},'raw':!![]})[_0xd8f1('0x27')](function(_0x51203f){if(_0x51203f&&_0x51203f[_0xd8f1('0x54')]===0x0){return db[_0xd8f1('0x55')][_0xd8f1('0x4c')]({'name':_0x413a6d[_0xd8f1('0x2c')],'resourceId':_0x413a6d['id'],'type':_0x51203f[_0xd8f1('0x2c')],'sectionId':_0x51203f['id']},{})['then'](function(){return _0x3939a9;});}else{return _0x3939a9;}})['catch'](function(_0x2db3c1){logger[_0xd8f1('0x56')](_0xd8f1('0x57'),_0x2db3c1);throw _0x2db3c1;});}return _0x3939a9;})['then'](respondWithResult(_0xabef5e,0xc9))[_0xd8f1('0x49')](handleError(_0xabef5e,null));};exports['update']=function(_0x36d548,_0x730e52){if(_0x36d548[_0xd8f1('0x4d')]['id']){delete _0x36d548['body']['id'];}return db[_0xd8f1('0x2e')][_0xd8f1('0x4b')]({'where':{'id':_0x36d548['params']['id']}})[_0xd8f1('0x27')](handleEntityNotFound(_0x730e52,null))[_0xd8f1('0x27')](saveUpdates(_0x36d548[_0xd8f1('0x4d')],null))[_0xd8f1('0x27')](respondWithResult(_0x730e52,null))[_0xd8f1('0x49')](handleError(_0x730e52,null));};exports[_0xd8f1('0x29')]=function(_0x83e26e,_0x177ba6){return db['FaxQueue'][_0xd8f1('0x4b')]({'where':{'id':_0x83e26e[_0xd8f1('0x58')]['id']}})[_0xd8f1('0x27')](handleEntityNotFound(_0x177ba6,null))[_0xd8f1('0x27')](removeEntity(_0x177ba6,null))[_0xd8f1('0x49')](handleError(_0x177ba6,null));};exports[_0xd8f1('0x59')]=function(_0x2ceb06,_0x16bac8){return db[_0xd8f1('0x2e')]['describe']()[_0xd8f1('0x27')](respondWithResult(_0x16bac8,null))[_0xd8f1('0x49')](handleError(_0x16bac8,null));};exports['getMembers']=function(_0x579ccf,_0x4e2193,_0x471ad3){var _0x558f40={'raw':!![],'where':{}},_0x3ba047={},_0x3fd103;return db['FaxQueue']['findOne']({'where':{'id':_0x579ccf['params']['id']}})[_0xd8f1('0x27')](handleEntityNotFound(_0x4e2193,null))[_0xd8f1('0x27')](function(_0x14ec53){if(_0x14ec53){_0x3fd103=_0x14ec53[_0xd8f1('0x28')]({'plain':!![]});_0x3ba047[_0xd8f1('0x33')]=_[_0xd8f1('0x36')](db[_0xd8f1('0x5a')]['rawAttributes']);_0x3ba047['query']=_[_0xd8f1('0x36')](_0x579ccf[_0xd8f1('0x35')]);_0x3ba047[_0xd8f1('0x37')]=_[_0xd8f1('0x38')](_0x3ba047['model'],_0x3ba047['query']);_0x558f40[_0xd8f1('0x3a')]=_[_0xd8f1('0x38')](_0x3ba047[_0xd8f1('0x33')],qs[_0xd8f1('0x39')](_0x579ccf[_0xd8f1('0x35')]['fields']));_0x558f40[_0xd8f1('0x3a')]=_0x558f40[_0xd8f1('0x3a')][_0xd8f1('0x3b')]?_0x558f40[_0xd8f1('0x3a')]:_0x3ba047[_0xd8f1('0x33')];if(!_0x579ccf[_0xd8f1('0x35')][_0xd8f1('0x3c')](_0xd8f1('0x3d'))){_0x558f40[_0xd8f1('0x20')]=qs['limit'](_0x579ccf['query'][_0xd8f1('0x20')]);_0x558f40[_0xd8f1('0x1e')]=qs[_0xd8f1('0x1e')](_0x579ccf[_0xd8f1('0x35')][_0xd8f1('0x1e')]);}_0x558f40[_0xd8f1('0x3e')]=qs[_0xd8f1('0x3f')](_0x579ccf[_0xd8f1('0x35')][_0xd8f1('0x3f')]);_0x558f40['where']=qs[_0xd8f1('0x37')](_[_0xd8f1('0x5b')](_0x579ccf[_0xd8f1('0x35')],_0x3ba047[_0xd8f1('0x37')]));_0x558f40[_0xd8f1('0x40')][_0xd8f1('0x5c')]=_0x14ec53['id'];if(_0x579ccf[_0xd8f1('0x35')][_0xd8f1('0x41')]){_0x558f40[_0xd8f1('0x40')]=_[_0xd8f1('0x42')](_0x558f40[_0xd8f1('0x40')],{'$or':_[_0xd8f1('0x34')](_0x558f40[_0xd8f1('0x3a')],function(_0x4e4888){var _0x309e4f={};_0x309e4f[_0x4e4888]={'$like':'%'+_0x579ccf[_0xd8f1('0x35')]['filter']+'%'};return _0x309e4f;})});}_0x558f40=_[_0xd8f1('0x42')]({},_0x558f40,_0x579ccf['options']);return db['UserFaxQueue'][_0xd8f1('0x5d')](_0x558f40);}})[_0xd8f1('0x27')](function(_0x36e93d){if(_0x36e93d){return db[_0xd8f1('0x5e')][_0xd8f1('0x5f')]({'where':{'id':_[_0xd8f1('0x34')](_0x36e93d,_0xd8f1('0x60')),'role':_0xd8f1('0x61')},'attributes':['id',_0xd8f1('0x2c'),'faxPause',_0xd8f1('0x62'),'createdAt']});}})[_0xd8f1('0x27')](function(_0x28b4a0){if(_0x28b4a0){return{'count':_0x28b4a0[_0xd8f1('0x45')],'rows':_[_0xd8f1('0x34')](_0x28b4a0['rows'],function(_0x10389b){return{'membername':_0x10389b[_0xd8f1('0x2c')],'UserId':_0x10389b['id'],'queue_name':_0x3fd103[_0xd8f1('0x2c')],'FaxQueueId':_0x3fd103['id'],'interface':util['format'](_0xd8f1('0x63'),_0xd8f1('0x64'),_0x10389b['name']),'penalty':0x0,'paused':_0x10389b[_0xd8f1('0x65')],'createdAt':_0x10389b[_0xd8f1('0x66')],'updatedAt':_0x10389b[_0xd8f1('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8f1('0x27')](respondWithFilteredResult(_0x4e2193,_0x558f40))[_0xd8f1('0x49')](handleError(_0x4e2193,null));};exports[_0xd8f1('0x67')]=function(_0x1f85ae,_0x6b81f9,_0x169ce6){var _0x4af4c3={};var _0x26f51c={};var _0x235dc5;var _0x3d3f98;return db[_0xd8f1('0x2e')][_0xd8f1('0x68')]({'where':{'id':_0x1f85ae[_0xd8f1('0x58')]['id']}})['then'](handleEntityNotFound(_0x6b81f9,null))[_0xd8f1('0x27')](function(_0xc14621){if(_0xc14621){_0x235dc5=_0xc14621;_0x26f51c[_0xd8f1('0x33')]=_[_0xd8f1('0x36')](db[_0xd8f1('0x69')][_0xd8f1('0x2f')]);_0x26f51c[_0xd8f1('0x35')]=_[_0xd8f1('0x36')](_0x1f85ae['query']);_0x26f51c[_0xd8f1('0x37')]=_[_0xd8f1('0x38')](_0x26f51c['model'],_0x26f51c['query']);_0x4af4c3['attributes']=_[_0xd8f1('0x38')](_0x26f51c['model'],qs['fields'](_0x1f85ae['query'][_0xd8f1('0x39')]));_0x4af4c3[_0xd8f1('0x3a')]=_0x4af4c3[_0xd8f1('0x3a')][_0xd8f1('0x3b')]?_0x4af4c3[_0xd8f1('0x3a')]:_0x26f51c[_0xd8f1('0x33')];_0x4af4c3[_0xd8f1('0x3e')]=qs[_0xd8f1('0x3f')](_0x1f85ae[_0xd8f1('0x35')][_0xd8f1('0x3f')]);_0x4af4c3[_0xd8f1('0x40')]=qs[_0xd8f1('0x37')](_[_0xd8f1('0x5b')](_0x1f85ae['query'],_0x26f51c['filters']));if(_0x1f85ae[_0xd8f1('0x35')][_0xd8f1('0x41')]){_0x4af4c3[_0xd8f1('0x40')]=_[_0xd8f1('0x42')](_0x4af4c3[_0xd8f1('0x40')],{'$or':_[_0xd8f1('0x34')](_0x4af4c3[_0xd8f1('0x3a')],function(_0xeffc1f){var _0x400e8a={};_0x400e8a[_0xeffc1f]={'$like':'%'+_0x1f85ae[_0xd8f1('0x35')]['filter']+'%'};return _0x400e8a;})});}_0x4af4c3=_['merge']({},_0x4af4c3,_0x1f85ae[_0xd8f1('0x44')]);return _0x235dc5[_0xd8f1('0x67')](_0x4af4c3);}})[_0xd8f1('0x27')](function(_0x598499){if(_0x598499){_0x3d3f98=_0x598499[_0xd8f1('0x3b')];if(!_0x1f85ae[_0xd8f1('0x35')][_0xd8f1('0x3c')]('nolimit')){_0x4af4c3[_0xd8f1('0x20')]=qs[_0xd8f1('0x20')](_0x1f85ae['query'][_0xd8f1('0x20')]);_0x4af4c3[_0xd8f1('0x1e')]=qs[_0xd8f1('0x1e')](_0x1f85ae[_0xd8f1('0x35')]['offset']);}return _0x235dc5['getTeams'](_0x4af4c3);}})['then'](function(_0x1e8637){if(_0x1e8637){return _0x1e8637?{'count':_0x3d3f98,'rows':_0x1e8637}:null;}})[_0xd8f1('0x27')](respondWithResult(_0x6b81f9,null))[_0xd8f1('0x49')](handleError(_0x6b81f9,null));};exports['addTeams']=function(_0x3413b2,_0x416998,_0x2c22a6){var _0x59cb56=_0x3413b2['body']['ids'];return db[_0xd8f1('0x69')][_0xd8f1('0x5d')]({'where':{'id':_0x59cb56},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd8f1('0x6a'),'attributes':['id',_0xd8f1('0x2c'),_0xd8f1('0x6b'),_0xd8f1('0x6c'),_0xd8f1('0x6d')],'raw':!![]}]})['then'](function(_0x5a3527){if(_0x5a3527){var _0x41b2db=_['flatMap'](_0x5a3527,function(_0x3298a1){var _0x5ad3e1=_0x3298a1[_0xd8f1('0x28')]({'plain':!![]});return _0x5ad3e1[_0xd8f1('0x6a')];});return db[_0xd8f1('0x2e')]['find']({'where':{'id':_0x3413b2[_0xd8f1('0x58')]['id']}})[_0xd8f1('0x27')](function(_0x3dabcb){return db['sequelize'][_0xd8f1('0x6e')](function(_0x28cb3b){return _0x3dabcb[_0xd8f1('0x6f')](_0x59cb56,{'transaction':_0x28cb3b})[_0xd8f1('0x27')](function(){return BPromise[_0xd8f1('0x70')](_0x41b2db,function(_0xa174d4){return db[_0xd8f1('0x5a')]['findOrCreate']({'where':{'UserId':_0xa174d4['id'],'FaxQueueId':_0x3413b2[_0xd8f1('0x58')]['id']},'transaction':_0x28cb3b});});})['then'](function(){_0x41b2db[_0xd8f1('0x71')](function(_0x5a1102){socket[_0xd8f1('0x72')](_0xd8f1('0x73'),{'UserId':_0x5a1102['id'],'FaxQueueId':_0x3dabcb['id']});});});});});}})[_0xd8f1('0x27')](respondWithStatusCode(_0x416998,null))[_0xd8f1('0x49')](handleError(_0x416998,null));};exports[_0xd8f1('0x74')]=function(_0xf85b78,_0x1a6281,_0x275291){return db[_0xd8f1('0x69')][_0xd8f1('0x5d')]({'where':{'id':_0xf85b78[_0xd8f1('0x35')][_0xd8f1('0x75')]},'attributes':['id'],'include':[{'model':db[_0xd8f1('0x5e')],'as':_0xd8f1('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xd8f1('0x27')](handleEntityNotFound(_0x1a6281,null))[_0xd8f1('0x27')](function(_0x28af71){var _0x4b2382=_[_0xd8f1('0x34')](_0x28af71,'id');var _0x56822e=[];var _0x237e50=[];var _0x20424c=squel['select']();_0x20424c[_0xd8f1('0x76')](_0xd8f1('0x77'))['from'](_0xd8f1('0x78'),'tq')[_0xd8f1('0x79')](_0xd8f1('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd8f1('0x40')](_0xd8f1('0x7b'),_0xf85b78['params']['id']);for(var _0x5f5d5e=0x0;_0x5f5d5e<_0x28af71[_0xd8f1('0x3b')];_0x5f5d5e+=0x1){let _0x34040d=_0x28af71[_0x5f5d5e];for(var _0x391eab=0x0;_0x391eab<_0x34040d[_0xd8f1('0x6a')][_0xd8f1('0x3b')];_0x391eab+=0x1){let _0x352017=_0x34040d['Agents'][_0x391eab];var _0x51e890=_0x20424c[_0xd8f1('0x7c')]();_0x51e890[_0xd8f1('0x40')](_0xd8f1('0x7d'),_0x352017['id']);_0x237e50[_0xd8f1('0x7e')](db[_0xd8f1('0x7f')][_0xd8f1('0x35')](_0x51e890[_0xd8f1('0x80')](),{'type':db[_0xd8f1('0x7f')]['QueryTypes']['SELECT']})[_0xd8f1('0x27')](function(_0x2ff35d){if(_0x2ff35d[_0xd8f1('0x3b')]===0x1){return _0x352017['id'];}else{var _0x403917=_[_0xd8f1('0x81')](_[_0xd8f1('0x34')](_0x2ff35d,'TeamId'),function(_0x3b14ea){return _[_0xd8f1('0x82')](_0x4b2382,_0x3b14ea);});if(_0x403917){return _0x352017['id'];}}}));}}return BPromise['all'](_0x237e50)[_0xd8f1('0x27')](function(_0x28095e){_0x56822e=_(_0x56822e)[_0xd8f1('0x83')](_0x28095e)[_0xd8f1('0x84')]()[_0xd8f1('0x85')]();return db[_0xd8f1('0x2e')][_0xd8f1('0x4b')]({'where':{'id':_0xf85b78['params']['id']}})[_0xd8f1('0x27')](function(_0x1cb3c1){return db[_0xd8f1('0x7f')]['transaction'](function(_0x30236a){return _0x1cb3c1[_0xd8f1('0x74')](_0xf85b78['query'][_0xd8f1('0x75')],{'transaction':_0x30236a})[_0xd8f1('0x27')](function(){if(!_['isEmpty'](_0x56822e)){return _0x1cb3c1['removeAgents'](_0x56822e,{'transaction':_0x30236a});}})[_0xd8f1('0x27')](function(){_0x56822e[_0xd8f1('0x71')](function(_0x5eb790){socket[_0xd8f1('0x72')](_0xd8f1('0x86'),{'UserId':_0x5eb790,'FaxQueueId':_0x1cb3c1['id']});});});});});});})[_0xd8f1('0x27')](respondWithStatusCode(_0x1a6281,null))[_0xd8f1('0x49')](handleError(_0x1a6281,null));};exports[_0xd8f1('0x87')]=function(_0x579492,_0x3acfe5,_0x586e88){return db[_0xd8f1('0x2e')][_0xd8f1('0x4b')]({'where':{'id':_0x579492['params']['id']}})[_0xd8f1('0x27')](handleEntityNotFound(_0x3acfe5,null))[_0xd8f1('0x27')](function(_0x49d190){if(_0x49d190){return _0x49d190[_0xd8f1('0x87')](_0x579492['body']['ids'],_['omit'](_0x579492[_0xd8f1('0x4d')],[_0xd8f1('0x75'),'id'])||{})['spread'](function(_0x5454e9){for(var _0x532d9a=0x0;_0x532d9a<_0x579492[_0xd8f1('0x4d')][_0xd8f1('0x75')][_0xd8f1('0x3b')];_0x532d9a+=0x1){socket[_0xd8f1('0x72')](_0xd8f1('0x73'),{'UserId':Number(_0x579492[_0xd8f1('0x4d')]['ids'][_0x532d9a]),'FaxQueueId':Number(_0x579492['params']['id'])});}return _0x5454e9;});}})['then'](respondWithResult(_0x3acfe5,null))[_0xd8f1('0x49')](handleError(_0x3acfe5,null));};exports[_0xd8f1('0x88')]=function(_0x31e979,_0x51c332,_0x5ac743){return db['FaxQueue'][_0xd8f1('0x4b')]({'where':{'id':_0x31e979[_0xd8f1('0x58')]['id']}})[_0xd8f1('0x27')](handleEntityNotFound(_0x51c332,null))[_0xd8f1('0x27')](function(_0x2dcef9){if(_0x2dcef9){return _0x2dcef9[_0xd8f1('0x88')](_0x31e979['query'][_0xd8f1('0x75')])['then'](function(){if(_[_0xd8f1('0x89')](_0x31e979[_0xd8f1('0x35')]['ids'])){for(var _0x58ebe6=0x0;_0x58ebe6<_0x31e979['query'][_0xd8f1('0x75')]['length'];_0x58ebe6+=0x1){socket['emit'](_0xd8f1('0x86'),{'UserId':Number(_0x31e979['query'][_0xd8f1('0x75')][_0x58ebe6]),'FaxQueueId':Number(_0x31e979[_0xd8f1('0x58')]['id'])});}}else{socket[_0xd8f1('0x72')](_0xd8f1('0x86'),{'UserId':Number(_0x31e979[_0xd8f1('0x35')]['ids']),'FaxQueueId':Number(_0x31e979['params']['id'])});}});}})['then'](respondWithStatusCode(_0x51c332,null))[_0xd8f1('0x49')](handleError(_0x51c332,null));};exports['getAgents']=function(_0x4e048e,_0x3cb231,_0x1a5e75){var _0x154aef={};var _0x5441c8={};var _0x5789d4;var _0x535f00;return db[_0xd8f1('0x2e')][_0xd8f1('0x68')]({'where':{'id':_0x4e048e[_0xd8f1('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cb231,null))[_0xd8f1('0x27')](function(_0x2256fe){if(_0x2256fe){_0x5789d4=_0x2256fe;_0x5441c8[_0xd8f1('0x33')]=_[_0xd8f1('0x36')](db[_0xd8f1('0x5e')][_0xd8f1('0x2f')]);_0x5441c8[_0xd8f1('0x35')]=_['keys'](_0x4e048e[_0xd8f1('0x35')]);_0x5441c8[_0xd8f1('0x37')]=_['intersection'](_0x5441c8[_0xd8f1('0x33')],_0x5441c8[_0xd8f1('0x35')]);_0x154aef[_0xd8f1('0x3a')]=_[_0xd8f1('0x38')](_0x5441c8[_0xd8f1('0x33')],qs['fields'](_0x4e048e[_0xd8f1('0x35')]['fields']));_0x154aef['attributes']=_0x154aef['attributes'][_0xd8f1('0x3b')]?_0x154aef[_0xd8f1('0x3a')]:_0x5441c8[_0xd8f1('0x33')];_0x154aef[_0xd8f1('0x3e')]=qs[_0xd8f1('0x3f')](_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x3f')]);_0x154aef[_0xd8f1('0x40')]=qs['filters'](_[_0xd8f1('0x5b')](_0x4e048e['query'],_0x5441c8['filters']));if(_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x41')]){_0x154aef['where']=_[_0xd8f1('0x42')](_0x154aef[_0xd8f1('0x40')],{'$or':_[_0xd8f1('0x34')](_0x154aef['attributes'],function(_0x18ee28){var _0x663981={};_0x663981[_0x18ee28]={'$like':'%'+_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x41')]+'%'};return _0x663981;})});}_0x154aef=_[_0xd8f1('0x42')]({},_0x154aef,_0x4e048e['options']);return _0x5789d4[_0xd8f1('0x8a')](_0x154aef);}})['then'](function(_0x2fec91){if(_0x2fec91){_0x535f00=_0x2fec91['length'];if(!_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x3c')](_0xd8f1('0x3d'))){_0x154aef[_0xd8f1('0x20')]=qs[_0xd8f1('0x20')](_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x20')]);_0x154aef[_0xd8f1('0x1e')]=qs[_0xd8f1('0x1e')](_0x4e048e[_0xd8f1('0x35')][_0xd8f1('0x1e')]);}return _0x5789d4[_0xd8f1('0x8a')](_0x154aef);}})[_0xd8f1('0x27')](function(_0x575ffe){if(_0x575ffe){return _0x575ffe?{'count':_0x535f00,'rows':_0x575ffe}:null;}})[_0xd8f1('0x27')](respondWithResult(_0x3cb231,null))[_0xd8f1('0x49')](handleError(_0x3cb231,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f5c4ba4..b232de9 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 _0x4262=['save','remove','emit','hasOwnProperty','hook','exports','FaxQueue'];(function(_0x49fffd,_0x346e58){var _0x20558f=function(_0x23dc25){while(--_0x23dc25){_0x49fffd['push'](_0x49fffd['shift']());}};_0x20558f(++_0x346e58);}(_0x4262,0x125));var _0x2426=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4262[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x2426('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2426('0x1'),'afterUpdate':'update','afterDestroy':_0x2426('0x2')};function emitEvent(_0x38fc0b){return function(_0x26ab38,_0xa0fb77,_0x236610){FaxQueueEvents[_0x2426('0x3')](_0x38fc0b+':'+_0x26ab38['id'],_0x26ab38);FaxQueueEvents['emit'](_0x38fc0b,_0x26ab38);_0x236610(null);};}for(var e in events){if(events[_0x2426('0x4')](e)){var event=events[e];FaxQueue[_0x2426('0x5')](e,emitEvent(event));}}module[_0x2426('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x6d64=['update','remove','emit','hook','exports','events','FaxQueue','setMaxListeners','save'];(function(_0x2761be,_0x237ed9){var _0x329d7a=function(_0x2aa3f7){while(--_0x2aa3f7){_0x2761be['push'](_0x2761be['shift']());}};_0x329d7a(++_0x237ed9);}(_0x6d64,0x140));var _0x46d6=function(_0x70d79f,_0x214e5b){_0x70d79f=_0x70d79f-0x0;var _0xe69a3f=_0x6d64[_0x70d79f];return _0xe69a3f;};'use strict';var EventEmitter=require(_0x46d6('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x46d6('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x46d6('0x2')](0x0);var events={'afterCreate':_0x46d6('0x3'),'afterUpdate':_0x46d6('0x4'),'afterDestroy':_0x46d6('0x5')};function emitEvent(_0x468e50){return function(_0x128c21,_0x337e3f,_0x20648f){FaxQueueEvents['emit'](_0x468e50+':'+_0x128c21['id'],_0x128c21);FaxQueueEvents[_0x46d6('0x6')](_0x468e50,_0x128c21);_0x20648f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x46d6('0x7')](e,emitEvent(event));}}module[_0x46d6('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a9b421d..bf3ffc8 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 _0x57f5=['moment','bluebird','request-promise','path','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0x47accc,_0x502160){var _0x23c2ab=function(_0x12ee73){while(--_0x12ee73){_0x47accc['push'](_0x47accc['shift']());}};_0x23c2ab(++_0x502160);}(_0x57f5,0x98));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x557f('0x0'));var util=require(_0x557f('0x1'));var logger=require(_0x557f('0x2'))(_0x557f('0x3'));var moment=require(_0x557f('0x4'));var BPromise=require(_0x557f('0x5'));var rp=require(_0x557f('0x6'));var fs=require('fs');var path=require(_0x557f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x557f('0x8'));module[_0x557f('0x9')]=function(_0x3311a3,_0x2deaa1){return _0x3311a3['define'](_0x557f('0xa'),attributes,{'tableName':_0x557f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd53b=['fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x4c5928,_0xda2365){var _0x153c04=function(_0x1a2234){while(--_0x1a2234){_0x4c5928['push'](_0x4c5928['shift']());}};_0x153c04(++_0xda2365);}(_0xd53b,0x1ef));var _0xbd53=function(_0x338048,_0xc9b2b0){_0x338048=_0x338048-0x0;var _0x337377=_0xd53b[_0x338048];return _0x337377;};'use strict';var _=require(_0xbd53('0x0'));var util=require(_0xbd53('0x1'));var logger=require(_0xbd53('0x2'))(_0xbd53('0x3'));var moment=require(_0xbd53('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd53('0x5'));var fs=require('fs');var path=require(_0xbd53('0x6'));var rimraf=require('rimraf');var config=require(_0xbd53('0x7'));var attributes=require(_0xbd53('0x8'));module[_0xbd53('0x9')]=function(_0x1ed0fd,_0xbd3230){return _0x1ed0fd[_0xbd53('0xa')](_0xbd53('0xb'),attributes,{'tableName':_0xbd53('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index e7380be..029fee3 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 _0x381e=['map','model','attributes','where','ShowFaxQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','./faxQueue.socket','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','limit','include'];(function(_0x3d3a3c,_0x4f1b8b){var _0x1c551b=function(_0x48db05){while(--_0x48db05){_0x3d3a3c['push'](_0x3d3a3c['shift']());}};_0x1c551b(++_0x4f1b8b);}(_0x381e,0x125));var _0xe381=function(_0x1adb6a,_0x320633){_0x1adb6a=_0x1adb6a-0x0;var _0x13f15b=_0x381e[_0x1adb6a];return _0x13f15b;};'use strict';var _=require(_0xe381('0x0'));var util=require(_0xe381('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe381('0x2'));var fs=require('fs');var Redis=require(_0xe381('0x3'));var db=require(_0xe381('0x4'))['db'];var utils=require(_0xe381('0x5'));var logger=require(_0xe381('0x6'))(_0xe381('0x7'));var config=require(_0xe381('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe381('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe381('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe381('0xb')]));require(_0xe381('0xc'))['register'](socket);function respondWithRpcPromise(_0x2f149e,_0x3ee37c,_0x35face){return new BPromise(function(_0x4a1dff,_0x78ceae){return client['request'](_0x2f149e,_0x35face)[_0xe381('0xd')](function(_0x295c31){logger[_0xe381('0xe')]('FaxQueue,\x20%s,\x20%s',_0x3ee37c,_0xe381('0xf'));logger[_0xe381('0x10')](_0xe381('0x11'),_0x3ee37c,'request\x20sent',JSON[_0xe381('0x12')](_0x295c31));if(_0x295c31['error']){if(_0x295c31[_0xe381('0x13')][_0xe381('0x14')]===0x1f4){logger['error'](_0xe381('0x15'),_0x3ee37c,_0x295c31[_0xe381('0x13')][_0xe381('0x16')]);return _0x78ceae(_0x295c31[_0xe381('0x13')][_0xe381('0x16')]);}logger['error'](_0xe381('0x15'),_0x3ee37c,_0x295c31[_0xe381('0x13')][_0xe381('0x16')]);return _0x4a1dff(_0x295c31[_0xe381('0x13')][_0xe381('0x16')]);}else{logger[_0xe381('0xe')]('FaxQueue,\x20%s,\x20%s',_0x3ee37c,_0xe381('0xf'));_0x4a1dff(_0x295c31['result']['message']);}})[_0xe381('0x17')](function(_0x506173){logger[_0xe381('0x13')](_0xe381('0x15'),_0x3ee37c,_0x506173);_0x78ceae(_0x506173);});});}exports[_0xe381('0x18')]=function(_0x422e54){var _0x1683de=this;return new Promise(function(_0x397d77,_0x4b38d4){return db[_0xe381('0x19')][_0xe381('0x1a')]({'raw':_0x422e54[_0xe381('0x1b')]?_0x422e54[_0xe381('0x1b')][_0xe381('0x1c')]===undefined?!![]:![]:!![],'where':_0x422e54[_0xe381('0x1b')]?_0x422e54[_0xe381('0x1b')]['where']||null:null,'attributes':_0x422e54[_0xe381('0x1b')]?_0x422e54[_0xe381('0x1b')]['attributes']||null:null,'limit':_0x422e54['options']?_0x422e54['options'][_0xe381('0x1d')]||null:null,'include':_0x422e54[_0xe381('0x1b')]?_0x422e54['options'][_0xe381('0x1e')]?_[_0xe381('0x1f')](_0x422e54[_0xe381('0x1b')][_0xe381('0x1e')],function(_0x2061fc){return{'model':db[_0x2061fc[_0xe381('0x20')]],'as':_0x2061fc['as'],'attributes':_0x2061fc[_0xe381('0x21')],'include':_0x2061fc[_0xe381('0x1e')]?_[_0xe381('0x1f')](_0x2061fc[_0xe381('0x1e')],function(_0x182533){return{'model':db[_0x182533[_0xe381('0x20')]],'as':_0x182533['as'],'attributes':_0x182533[_0xe381('0x21')],'include':_0x182533['include']?_['map'](_0x182533[_0xe381('0x1e')],function(_0x34cc93){return{'model':db[_0x34cc93[_0xe381('0x20')]],'as':_0x34cc93['as'],'attributes':_0x34cc93[_0xe381('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe381('0xd')](function(_0x499977){logger[_0xe381('0xe')]('GetFaxQueue',_0x422e54);logger[_0xe381('0x10')](_0xe381('0x18'),_0x422e54,JSON[_0xe381('0x12')](_0x499977));_0x397d77(_0x499977);})[_0xe381('0x17')](function(_0x35c1df){logger[_0xe381('0x13')](_0xe381('0x18'),_0x35c1df[_0xe381('0x16')],_0x422e54);_0x4b38d4(_0x1683de[_0xe381('0x13')](0x1f4,_0x35c1df[_0xe381('0x16')]));});});};exports['ShowFaxQueue']=function(_0x49782c){var _0x1d70a6=this;return new Promise(function(_0xabed18,_0x1dab16){return db[_0xe381('0x19')]['find']({'raw':_0x49782c[_0xe381('0x1b')]?_0x49782c['options'][_0xe381('0x1c')]===undefined?!![]:![]:!![],'where':_0x49782c[_0xe381('0x1b')]?_0x49782c[_0xe381('0x1b')][_0xe381('0x22')]||null:null,'attributes':_0x49782c['options']?_0x49782c[_0xe381('0x1b')][_0xe381('0x21')]||null:null,'include':_0x49782c[_0xe381('0x1b')]?_0x49782c[_0xe381('0x1b')][_0xe381('0x1e')]?_[_0xe381('0x1f')](_0x49782c[_0xe381('0x1b')][_0xe381('0x1e')],function(_0x1d9000){return{'model':db[_0x1d9000[_0xe381('0x20')]],'as':_0x1d9000['as'],'attributes':_0x1d9000[_0xe381('0x21')],'include':_0x1d9000[_0xe381('0x1e')]?_[_0xe381('0x1f')](_0x1d9000[_0xe381('0x1e')],function(_0x230e3e){return{'model':db[_0x230e3e[_0xe381('0x20')]],'as':_0x230e3e['as'],'attributes':_0x230e3e[_0xe381('0x21')],'include':_0x230e3e['include']?_[_0xe381('0x1f')](_0x230e3e['include'],function(_0x29578c){return{'model':db[_0x29578c[_0xe381('0x20')]],'as':_0x29578c['as'],'attributes':_0x29578c[_0xe381('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe381('0xd')](function(_0x4d7a99){logger['info'](_0xe381('0x23'),_0x49782c);logger[_0xe381('0x10')](_0xe381('0x23'),_0x49782c,JSON[_0xe381('0x12')](_0x4d7a99));_0xabed18(_0x4d7a99);})[_0xe381('0x17')](function(_0x5bda58){logger[_0xe381('0x13')](_0xe381('0x23'),_0x5bda58[_0xe381('0x16')],_0x49782c);_0x1dab16(_0x1d70a6[_0xe381('0x13')](0x1f4,_0x5bda58[_0xe381('0x16')]));});});}; \ No newline at end of file +var _0x757a=['jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowFaxQueue','FaxQueue','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x46f337,_0x5e837c){var _0x4d178b=function(_0x2f7214){while(--_0x2f7214){_0x46f337['push'](_0x46f337['shift']());}};_0x4d178b(++_0x5e837c);}(_0x757a,0x6e));var _0xa757=function(_0x27854a,_0x3f4df5){_0x27854a=_0x27854a-0x0;var _0x4737b0=_0x757a[_0x27854a];return _0x4737b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa757('0x0'));var rs=require(_0xa757('0x1'));var fs=require('fs');var Redis=require(_0xa757('0x2'));var db=require(_0xa757('0x3'))['db'];var utils=require(_0xa757('0x4'));var logger=require(_0xa757('0x5'))('rpc');var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson[_0xa757('0x8')][_0xa757('0x9')]({'port':0x232a});config[_0xa757('0xa')]=_['defaults'](config[_0xa757('0xa')],{'host':_0xa757('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa757('0xa')]));require(_0xa757('0xc'))[_0xa757('0xd')](socket);function respondWithRpcPromise(_0x31cf51,_0x2842d3,_0x41688d){return new BPromise(function(_0x37c822,_0x41f16a){return client[_0xa757('0xe')](_0x31cf51,_0x41688d)[_0xa757('0xf')](function(_0x48fd14){logger['info'](_0xa757('0x10'),_0x2842d3,_0xa757('0x11'));logger[_0xa757('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2842d3,_0xa757('0x11'),JSON[_0xa757('0x13')](_0x48fd14));if(_0x48fd14[_0xa757('0x14')]){if(_0x48fd14[_0xa757('0x14')][_0xa757('0x15')]===0x1f4){logger[_0xa757('0x14')](_0xa757('0x10'),_0x2842d3,_0x48fd14['error'][_0xa757('0x16')]);return _0x41f16a(_0x48fd14[_0xa757('0x14')][_0xa757('0x16')]);}logger['error'](_0xa757('0x10'),_0x2842d3,_0x48fd14[_0xa757('0x14')]['message']);return _0x37c822(_0x48fd14['error'][_0xa757('0x16')]);}else{logger[_0xa757('0x17')](_0xa757('0x10'),_0x2842d3,'request\x20sent');_0x37c822(_0x48fd14[_0xa757('0x18')][_0xa757('0x16')]);}})[_0xa757('0x19')](function(_0x14d7ca){logger[_0xa757('0x14')](_0xa757('0x10'),_0x2842d3,_0x14d7ca);_0x41f16a(_0x14d7ca);});});}exports[_0xa757('0x1a')]=function(_0x57588b){var _0x1ef6d4=this;return new Promise(function(_0x3fe5e9,_0xdaa531){return db['FaxQueue'][_0xa757('0x1b')]({'raw':_0x57588b[_0xa757('0x1c')]?_0x57588b[_0xa757('0x1c')][_0xa757('0x1d')]===undefined?!![]:![]:!![],'where':_0x57588b[_0xa757('0x1c')]?_0x57588b['options'][_0xa757('0x1e')]||null:null,'attributes':_0x57588b[_0xa757('0x1c')]?_0x57588b[_0xa757('0x1c')]['attributes']||null:null,'limit':_0x57588b[_0xa757('0x1c')]?_0x57588b[_0xa757('0x1c')][_0xa757('0x1f')]||null:null,'include':_0x57588b['options']?_0x57588b[_0xa757('0x1c')][_0xa757('0x20')]?_[_0xa757('0x21')](_0x57588b[_0xa757('0x1c')][_0xa757('0x20')],function(_0xe940d7){return{'model':db[_0xe940d7[_0xa757('0x22')]],'as':_0xe940d7['as'],'attributes':_0xe940d7[_0xa757('0x23')],'include':_0xe940d7[_0xa757('0x20')]?_[_0xa757('0x21')](_0xe940d7[_0xa757('0x20')],function(_0x1349d5){return{'model':db[_0x1349d5[_0xa757('0x22')]],'as':_0x1349d5['as'],'attributes':_0x1349d5[_0xa757('0x23')],'include':_0x1349d5['include']?_[_0xa757('0x21')](_0x1349d5['include'],function(_0x118128){return{'model':db[_0x118128[_0xa757('0x22')]],'as':_0x118128['as'],'attributes':_0x118128[_0xa757('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xf')](function(_0x37810c){logger[_0xa757('0x17')](_0xa757('0x1a'),_0x57588b);logger['debug'](_0xa757('0x1a'),_0x57588b,JSON[_0xa757('0x13')](_0x37810c));_0x3fe5e9(_0x37810c);})[_0xa757('0x19')](function(_0xdeae84){logger[_0xa757('0x14')]('GetFaxQueue',_0xdeae84[_0xa757('0x16')],_0x57588b);_0xdaa531(_0x1ef6d4[_0xa757('0x14')](0x1f4,_0xdeae84[_0xa757('0x16')]));});});};exports[_0xa757('0x24')]=function(_0x455176){var _0x5dd99c=this;return new Promise(function(_0x4cd52f,_0x573f84){return db[_0xa757('0x25')][_0xa757('0x26')]({'raw':_0x455176[_0xa757('0x1c')]?_0x455176['options'][_0xa757('0x1d')]===undefined?!![]:![]:!![],'where':_0x455176[_0xa757('0x1c')]?_0x455176['options']['where']||null:null,'attributes':_0x455176[_0xa757('0x1c')]?_0x455176[_0xa757('0x1c')][_0xa757('0x23')]||null:null,'include':_0x455176[_0xa757('0x1c')]?_0x455176[_0xa757('0x1c')]['include']?_[_0xa757('0x21')](_0x455176['options'][_0xa757('0x20')],function(_0x540b0e){return{'model':db[_0x540b0e[_0xa757('0x22')]],'as':_0x540b0e['as'],'attributes':_0x540b0e[_0xa757('0x23')],'include':_0x540b0e['include']?_[_0xa757('0x21')](_0x540b0e[_0xa757('0x20')],function(_0x1f095e){return{'model':db[_0x1f095e[_0xa757('0x22')]],'as':_0x1f095e['as'],'attributes':_0x1f095e[_0xa757('0x23')],'include':_0x1f095e[_0xa757('0x20')]?_[_0xa757('0x21')](_0x1f095e['include'],function(_0x391801){return{'model':db[_0x391801[_0xa757('0x22')]],'as':_0x391801['as'],'attributes':_0x391801[_0xa757('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3e89){logger[_0xa757('0x17')](_0xa757('0x24'),_0x455176);logger['debug'](_0xa757('0x24'),_0x455176,JSON[_0xa757('0x13')](_0x2b3e89));_0x4cd52f(_0x2b3e89);})[_0xa757('0x19')](function(_0x3f485d){logger[_0xa757('0x14')](_0xa757('0x24'),_0x3f485d['message'],_0x455176);_0x573f84(_0x5dd99c[_0xa757('0x14')](0x1f4,_0x3f485d[_0xa757('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 172702d..00bea8c 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 _0x71af=['update','emit','removeListener','register','faxQueue:','./faxQueue.events','save','remove'];(function(_0x2d4c16,_0x1cc64a){var _0x354ed8=function(_0x1aee44){while(--_0x1aee44){_0x2d4c16['push'](_0x2d4c16['shift']());}};_0x354ed8(++_0x1cc64a);}(_0x71af,0x17d));var _0xf71a=function(_0x3562cf,_0x3380b1){_0x3562cf=_0x3562cf-0x0;var _0x168e97=_0x71af[_0x3562cf];return _0x168e97;};'use strict';var FaxQueueEvents=require(_0xf71a('0x0'));var events=[_0xf71a('0x1'),_0xf71a('0x2'),_0xf71a('0x3')];function createListener(_0x26f666,_0x6d2f41){return function(_0x21a214){_0x6d2f41[_0xf71a('0x4')](_0x26f666,_0x21a214);};}function removeListener(_0x460282,_0x5d8e58){return function(){FaxQueueEvents[_0xf71a('0x5')](_0x460282,_0x5d8e58);};}exports[_0xf71a('0x6')]=function(_0x28a634){for(var _0x5b8f2d=0x0,_0xc5d7a1=events['length'];_0x5b8f2d<_0xc5d7a1;_0x5b8f2d++){var _0xd7cae4=events[_0x5b8f2d];var _0x42813c=createListener(_0xf71a('0x7')+_0xd7cae4,_0x28a634);FaxQueueEvents['on'](_0xd7cae4,_0x42813c);}}; \ No newline at end of file +var _0x50f0=['register','length','./faxQueue.events','save','remove','update','emit'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x50f0,0x6b));var _0x050f=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x50f0[_0x10d670];return _0x20d6f8;};'use strict';var FaxQueueEvents=require(_0x050f('0x0'));var events=[_0x050f('0x1'),_0x050f('0x2'),_0x050f('0x3')];function createListener(_0x571da8,_0x314b23){return function(_0xcc8b64){_0x314b23[_0x050f('0x4')](_0x571da8,_0xcc8b64);};}function removeListener(_0x4340de,_0x3fd255){return function(){FaxQueueEvents['removeListener'](_0x4340de,_0x3fd255);};}exports[_0x050f('0x5')]=function(_0x5e2708){for(var _0x21c7de=0x0,_0x2fb30d=events[_0x050f('0x6')];_0x21c7de<_0x2fb30d;_0x21c7de++){var _0x2944b8=events[_0x21c7de];var _0x9c050c=createListener('faxQueue:'+_0x2944b8,_0x5e2708);FaxQueueEvents['on'](_0x2944b8,_0x9c050c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c6c5635..629995a 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 _0x7524=['express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','destroy','removeAgents','exports','util','path'];(function(_0x590c4d,_0x189c79){var _0x37b95e=function(_0x5b85db){while(--_0x5b85db){_0x590c4d['push'](_0x590c4d['shift']());}};_0x37b95e(++_0x189c79);}(_0x7524,0xce));var _0x4752=function(_0x1f3ca9,_0xa669b7){_0x1f3ca9=_0x1f3ca9-0x0;var _0x3d0eae=_0x7524[_0x1f3ca9];return _0x3d0eae;};'use strict';var multer=require('multer');var util=require(_0x4752('0x0'));var path=require(_0x4752('0x1'));var timeout=require('connect-timeout');var express=require(_0x4752('0x2'));var router=express[_0x4752('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4752('0x4'));var config=require('../../config/environment');var controller=require(_0x4752('0x5'));router[_0x4752('0x6')]('/',auth[_0x4752('0x7')](),controller[_0x4752('0x8')]);router[_0x4752('0x6')]('/describe',auth[_0x4752('0x7')](),controller[_0x4752('0x9')]);router['get']('/:id',auth[_0x4752('0x7')](),controller[_0x4752('0xa')]);router[_0x4752('0x6')](_0x4752('0xb'),auth['isAuthenticated'](),controller[_0x4752('0xc')]);router[_0x4752('0x6')](_0x4752('0xd'),auth[_0x4752('0x7')](),controller[_0x4752('0xe')]);router['get'](_0x4752('0xf'),auth[_0x4752('0x7')](),controller[_0x4752('0x10')]);router[_0x4752('0x11')]('/',auth[_0x4752('0x7')](),controller[_0x4752('0x12')]);router[_0x4752('0x11')]('/:id/teams',auth[_0x4752('0x7')](),controller['addTeams']);router[_0x4752('0x11')](_0x4752('0xf'),auth[_0x4752('0x7')](),controller[_0x4752('0x13')]);router[_0x4752('0x14')](_0x4752('0x15'),auth[_0x4752('0x7')](),controller['update']);router[_0x4752('0x16')](_0x4752('0x15'),auth['isAuthenticated'](),controller[_0x4752('0x17')]);router['delete'](_0x4752('0xd'),auth[_0x4752('0x7')](),controller['removeTeams']);router[_0x4752('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x4752('0x18')]);module[_0x4752('0x19')]=router; \ No newline at end of file +var _0x8f9d=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['get']('/:id/members',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0xb')](_0xd8f9('0x10'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0xb')]('/:id/users',auth[_0xd8f9('0x9')](),controller['getAgents']);router[_0xd8f9('0x12')]('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x13')]);router['post'](_0xd8f9('0x10'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x14')]);router[_0xd8f9('0x12')]('/:id/users',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x15')]);router[_0xd8f9('0x16')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x17')]);router[_0xd8f9('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd8f9('0x19')]);router[_0xd8f9('0x18')]('/:id/teams',auth[_0xd8f9('0x9')](),controller['removeTeams']);router[_0xd8f9('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xd8f9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 55e4c17..414f558 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 _0xece3=['STRING','DATE','sequelize','exports'];(function(_0xa62004,_0x29f3b4){var _0xf42eaa=function(_0x18da7a){while(--_0x18da7a){_0xa62004['push'](_0xa62004['shift']());}};_0xf42eaa(++_0x29f3b4);}(_0xece3,0x102));var _0x3ece=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xece3[_0x57e00e];return _0x415e60;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ece('0x0'));module[_0x3ece('0x1')]={'uniqueid':{'type':Sequelize[_0x3ece('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3ece('0x3')]},'acceptAt':{'type':Sequelize[_0x3ece('0x3')]},'exitAt':{'type':Sequelize[_0x3ece('0x3')]},'reason':{'type':Sequelize[_0x3ece('0x2')]}}; \ No newline at end of file +var _0x8331=['DATE','moment','exports'];(function(_0x17704c,_0x2c791d){var _0x447520=function(_0x2b22aa){while(--_0x2b22aa){_0x17704c['push'](_0x17704c['shift']());}};_0x447520(++_0x2c791d);}(_0x8331,0x196));var _0x1833=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x8331[_0x7dbd65];return _0x33d551;};'use strict';var moment=require(_0x1833('0x0'));var Sequelize=require('sequelize');module[_0x1833('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1833('0x2')]},'leaveAt':{'type':Sequelize[_0x1833('0x2')]},'acceptAt':{'type':Sequelize[_0x1833('0x2')]},'exitAt':{'type':Sequelize[_0x1833('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index cc945af..97ebdbf 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 _0xf7f3=['attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxQueueReport','fieldName','type','model','keys','query','filters'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x161f53,_0x4326d2){_0x161f53=_0x161f53-0x0;var _0x49c92d=_0xf7f3[_0x161f53];return _0x49c92d;};'use strict';var emlformat=require(_0x3f7f('0x0'));var rimraf=require(_0x3f7f('0x1'));var zipdir=require(_0x3f7f('0x2'));var jsonpatch=require(_0x3f7f('0x3'));var rp=require(_0x3f7f('0x4'));var moment=require(_0x3f7f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f7f('0x6'));var path=require(_0x3f7f('0x7'));var sox=require('sox');var csv=require(_0x3f7f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f7f('0x9'));var _=require(_0x3f7f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3f7f('0x8'));var querystring=require(_0x3f7f('0xb'));var Papa=require(_0x3f7f('0xc'));var Redis=require(_0x3f7f('0xd'));var authService=require(_0x3f7f('0xe'));var qs=require(_0x3f7f('0xf'));var as=require(_0x3f7f('0x10'));var hardwareService=require(_0x3f7f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3f7f('0x12'));var config=require(_0x3f7f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x476a1b,_0x3427d1){_0x3427d1=_0x3427d1||0xcc;return function(_0x5b9d49){if(_0x5b9d49){return _0x476a1b[_0x3f7f('0x14')](_0x3427d1);}return _0x476a1b[_0x3f7f('0x15')](_0x3427d1)[_0x3f7f('0x16')]();};}function respondWithResult(_0x4dc9b4,_0x1f2303){_0x1f2303=_0x1f2303||0xc8;return function(_0xf4e693){if(_0xf4e693){return _0x4dc9b4[_0x3f7f('0x15')](_0x1f2303)[_0x3f7f('0x17')](_0xf4e693);}};}function respondWithFilteredResult(_0x3d8963,_0x53c24b){return function(_0x14c08e){if(_0x14c08e){var _0x5c7e42=typeof _0x53c24b[_0x3f7f('0x18')]===_0x3f7f('0x19')&&typeof _0x53c24b['limit']===_0x3f7f('0x19');var _0x59fd8b=_0x14c08e[_0x3f7f('0x1a')];var _0x4ce1c5=_0x5c7e42?0x0:_0x53c24b['offset'];var _0x4a9f51=_0x5c7e42?_0x14c08e['count']:_0x53c24b[_0x3f7f('0x18')]+_0x53c24b[_0x3f7f('0x1b')];var _0x3a47ce;if(_0x4a9f51>=_0x59fd8b){_0x4a9f51=_0x59fd8b;_0x3a47ce=0xc8;}else{_0x3a47ce=0xce;}_0x3d8963[_0x3f7f('0x15')](_0x3a47ce);return _0x3d8963['set'](_0x3f7f('0x1c'),_0x4ce1c5+'-'+_0x4a9f51+'/'+_0x59fd8b)[_0x3f7f('0x17')](_0x14c08e);}return null;};}function patchUpdates(_0x6e57b7){return function(_0x4197d1){try{jsonpatch[_0x3f7f('0x1d')](_0x4197d1,_0x6e57b7,!![]);}catch(_0x105fd9){return BPromise[_0x3f7f('0x1e')](_0x105fd9);}return _0x4197d1[_0x3f7f('0x1f')]();};}function saveUpdates(_0x4b2b3d,_0x4c5566){return function(_0xeb7e8){if(_0xeb7e8){return _0xeb7e8[_0x3f7f('0x20')](_0x4b2b3d)[_0x3f7f('0x21')](function(_0x4d52f1){return _0x4d52f1;});}return null;};}function removeEntity(_0x58c519,_0x5c1fdd){return function(_0x3e980f){if(_0x3e980f){return _0x3e980f[_0x3f7f('0x22')]()[_0x3f7f('0x21')](function(){_0x58c519[_0x3f7f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351bfc,_0x286784){return function(_0x913eda){if(!_0x913eda){_0x351bfc[_0x3f7f('0x14')](0x194);}return _0x913eda;};}function handleError(_0x59f0d6,_0x325ecb){_0x325ecb=_0x325ecb||0x1f4;return function(_0x487dea){logger[_0x3f7f('0x23')](_0x487dea['stack']);if(_0x487dea[_0x3f7f('0x24')]){delete _0x487dea['name'];}_0x59f0d6[_0x3f7f('0x15')](_0x325ecb)[_0x3f7f('0x25')](_0x487dea);};}exports[_0x3f7f('0x26')]=function(_0x182b52,_0xc1f65c){var _0x10ac1f={},_0x1167b8={},_0x266763={'count':0x0,'rows':[]};var _0x1f2b19=_[_0x3f7f('0x27')](db[_0x3f7f('0x28')]['rawAttributes'],function(_0x4da6f1){return{'name':_0x4da6f1[_0x3f7f('0x29')],'type':_0x4da6f1[_0x3f7f('0x2a')]['key']};});_0x1167b8[_0x3f7f('0x2b')]=_[_0x3f7f('0x27')](_0x1f2b19,_0x3f7f('0x24'));_0x1167b8['query']=_[_0x3f7f('0x2c')](_0x182b52[_0x3f7f('0x2d')]);_0x1167b8[_0x3f7f('0x2e')]=_['intersection'](_0x1167b8[_0x3f7f('0x2b')],_0x1167b8['query']);_0x10ac1f[_0x3f7f('0x2f')]=_[_0x3f7f('0x30')](_0x1167b8[_0x3f7f('0x2b')],qs['fields'](_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x31')]));_0x10ac1f[_0x3f7f('0x2f')]=_0x10ac1f[_0x3f7f('0x2f')][_0x3f7f('0x32')]?_0x10ac1f[_0x3f7f('0x2f')]:_0x1167b8[_0x3f7f('0x2b')];if(!_0x182b52[_0x3f7f('0x2d')]['hasOwnProperty'](_0x3f7f('0x33'))){_0x10ac1f['limit']=qs['limit'](_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x1b')]);_0x10ac1f[_0x3f7f('0x18')]=qs[_0x3f7f('0x18')](_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x18')]);}_0x10ac1f['order']=qs['sort'](_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x34')]);_0x10ac1f[_0x3f7f('0x35')]=qs[_0x3f7f('0x2e')](_['pick'](_0x182b52[_0x3f7f('0x2d')],_0x1167b8[_0x3f7f('0x2e')]),_0x1f2b19);if(_0x182b52[_0x3f7f('0x2d')]['filter']){_0x10ac1f[_0x3f7f('0x35')]=_[_0x3f7f('0x36')](_0x10ac1f[_0x3f7f('0x35')],{'$or':_['map'](_0x1f2b19,function(_0x1769ce){if(_0x1769ce[_0x3f7f('0x2a')]!==_0x3f7f('0x37')){var _0x5afd22={};_0x5afd22[_0x1769ce[_0x3f7f('0x24')]]={'$like':'%'+_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x38')]+'%'};return _0x5afd22;}})});}_0x10ac1f=_[_0x3f7f('0x36')]({},_0x10ac1f,_0x182b52[_0x3f7f('0x39')]);var _0x588939={'where':_0x10ac1f[_0x3f7f('0x35')]};return db[_0x3f7f('0x28')]['count'](_0x588939)['then'](function(_0xb7f12b){_0x266763['count']=_0xb7f12b;if(_0x182b52[_0x3f7f('0x2d')][_0x3f7f('0x3a')]){_0x10ac1f['include']=[{'all':!![]}];}return db[_0x3f7f('0x28')][_0x3f7f('0x3b')](_0x10ac1f);})[_0x3f7f('0x21')](function(_0x53587a){_0x266763[_0x3f7f('0x3c')]=_0x53587a;return _0x266763;})[_0x3f7f('0x21')](respondWithFilteredResult(_0xc1f65c,_0x10ac1f))[_0x3f7f('0x3d')](handleError(_0xc1f65c,null));};exports['show']=function(_0x1142d4,_0xb6ea25){var _0x1f3dbe={'raw':!![],'where':{'id':_0x1142d4[_0x3f7f('0x3e')]['id']}},_0x318556={};_0x318556[_0x3f7f('0x2b')]=_[_0x3f7f('0x2c')](db[_0x3f7f('0x28')][_0x3f7f('0x3f')]);_0x318556['query']=_[_0x3f7f('0x2c')](_0x1142d4['query']);_0x318556[_0x3f7f('0x2e')]=_[_0x3f7f('0x30')](_0x318556[_0x3f7f('0x2b')],_0x318556[_0x3f7f('0x2d')]);_0x1f3dbe['attributes']=_['intersection'](_0x318556[_0x3f7f('0x2b')],qs['fields'](_0x1142d4['query'][_0x3f7f('0x31')]));_0x1f3dbe[_0x3f7f('0x2f')]=_0x1f3dbe[_0x3f7f('0x2f')][_0x3f7f('0x32')]?_0x1f3dbe['attributes']:_0x318556[_0x3f7f('0x2b')];if(_0x1142d4[_0x3f7f('0x2d')][_0x3f7f('0x3a')]){_0x1f3dbe[_0x3f7f('0x40')]=[{'all':!![]}];}_0x1f3dbe=_[_0x3f7f('0x36')]({},_0x1f3dbe,_0x1142d4[_0x3f7f('0x39')]);return db[_0x3f7f('0x28')][_0x3f7f('0x41')](_0x1f3dbe)[_0x3f7f('0x21')](handleEntityNotFound(_0xb6ea25,null))[_0x3f7f('0x21')](respondWithResult(_0xb6ea25,null))[_0x3f7f('0x3d')](handleError(_0xb6ea25,null));};exports[_0x3f7f('0x42')]=function(_0x57c90e,_0x56479e){return db['FaxQueueReport'][_0x3f7f('0x42')](_0x57c90e[_0x3f7f('0x43')],{})['then'](respondWithResult(_0x56479e,0xc9))[_0x3f7f('0x3d')](handleError(_0x56479e,null));};exports[_0x3f7f('0x20')]=function(_0x3d8dc0,_0x35f35e){if(_0x3d8dc0['body']['id']){delete _0x3d8dc0[_0x3f7f('0x43')]['id'];}return db[_0x3f7f('0x28')][_0x3f7f('0x41')]({'where':{'id':_0x3d8dc0[_0x3f7f('0x3e')]['id']}})[_0x3f7f('0x21')](handleEntityNotFound(_0x35f35e,null))['then'](saveUpdates(_0x3d8dc0[_0x3f7f('0x43')],null))[_0x3f7f('0x21')](respondWithResult(_0x35f35e,null))[_0x3f7f('0x3d')](handleError(_0x35f35e,null));};exports[_0x3f7f('0x22')]=function(_0x2041d3,_0x37d86e){return db[_0x3f7f('0x28')][_0x3f7f('0x41')]({'where':{'id':_0x2041d3[_0x3f7f('0x3e')]['id']}})[_0x3f7f('0x21')](handleEntityNotFound(_0x37d86e,null))[_0x3f7f('0x21')](removeEntity(_0x37d86e,null))['catch'](handleError(_0x37d86e,null));};exports[_0x3f7f('0x44')]=function(_0x25d767,_0x542cba){return db[_0x3f7f('0x28')]['describe']()[_0x3f7f('0x21')](respondWithResult(_0x542cba,null))['catch'](handleError(_0x542cba,null));}; \ No newline at end of file +var _0x8aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0x8aa7,0xb6));var _0x78aa=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x8aa7[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78aa('0x0'));var zipdir=require(_0x78aa('0x1'));var jsonpatch=require(_0x78aa('0x2'));var rp=require(_0x78aa('0x3'));var moment=require(_0x78aa('0x4'));var BPromise=require(_0x78aa('0x5'));var Mustache=require(_0x78aa('0x6'));var util=require('util');var path=require(_0x78aa('0x7'));var sox=require(_0x78aa('0x8'));var csv=require(_0x78aa('0x9'));var ejs=require(_0x78aa('0xa'));var fs=require('fs');var fs_extra=require(_0x78aa('0xb'));var _=require(_0x78aa('0xc'));var squel=require(_0x78aa('0xd'));var crypto=require(_0x78aa('0xe'));var jsforce=require(_0x78aa('0xf'));var deskjs=require(_0x78aa('0x10'));var toCsv=require(_0x78aa('0x9'));var querystring=require(_0x78aa('0x11'));var Papa=require(_0x78aa('0x12'));var Redis=require(_0x78aa('0x13'));var authService=require(_0x78aa('0x14'));var qs=require(_0x78aa('0x15'));var as=require(_0x78aa('0x16'));var hardwareService=require(_0x78aa('0x17'));var logger=require(_0x78aa('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x78aa('0x19'));var licenseUtil=require(_0x78aa('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a53ba,_0x41b378){_0x41b378=_0x41b378||0xcc;return function(_0x1ef828){if(_0x1ef828){return _0x1a53ba[_0x78aa('0x1b')](_0x41b378);}return _0x1a53ba[_0x78aa('0x1c')](_0x41b378)['end']();};}function respondWithResult(_0xe657d5,_0x431a26){_0x431a26=_0x431a26||0xc8;return function(_0x28d235){if(_0x28d235){return _0xe657d5[_0x78aa('0x1c')](_0x431a26)[_0x78aa('0x1d')](_0x28d235);}};}function respondWithFilteredResult(_0x4f2fe7,_0x43aa6b){return function(_0x1cbf5f){if(_0x1cbf5f){var _0x23dbb4=typeof _0x43aa6b[_0x78aa('0x1e')]===_0x78aa('0x1f')&&typeof _0x43aa6b[_0x78aa('0x20')]==='undefined';var _0x4a1eed=_0x1cbf5f[_0x78aa('0x21')];var _0x345e4d=_0x23dbb4?0x0:_0x43aa6b[_0x78aa('0x1e')];var _0x4207b0=_0x23dbb4?_0x1cbf5f[_0x78aa('0x21')]:_0x43aa6b[_0x78aa('0x1e')]+_0x43aa6b[_0x78aa('0x20')];var _0x137354;if(_0x4207b0>=_0x4a1eed){_0x4207b0=_0x4a1eed;_0x137354=0xc8;}else{_0x137354=0xce;}_0x4f2fe7[_0x78aa('0x1c')](_0x137354);return _0x4f2fe7[_0x78aa('0x22')](_0x78aa('0x23'),_0x345e4d+'-'+_0x4207b0+'/'+_0x4a1eed)['json'](_0x1cbf5f);}return null;};}function patchUpdates(_0x18c60d){return function(_0x4728d8){try{jsonpatch['apply'](_0x4728d8,_0x18c60d,!![]);}catch(_0xa732df){return BPromise[_0x78aa('0x24')](_0xa732df);}return _0x4728d8[_0x78aa('0x25')]();};}function saveUpdates(_0x507b19,_0x5a9dbf){return function(_0x157d43){if(_0x157d43){return _0x157d43[_0x78aa('0x26')](_0x507b19)['then'](function(_0x13a601){return _0x13a601;});}return null;};}function removeEntity(_0xb94f8f,_0x22a98c){return function(_0x3b17b8){if(_0x3b17b8){return _0x3b17b8['destroy']()[_0x78aa('0x27')](function(){_0xb94f8f[_0x78aa('0x1c')](0xcc)[_0x78aa('0x28')]();});}};}function handleEntityNotFound(_0x24cbaa,_0x45b012){return function(_0x262cc7){if(!_0x262cc7){_0x24cbaa[_0x78aa('0x1b')](0x194);}return _0x262cc7;};}function handleError(_0x328714,_0x595611){_0x595611=_0x595611||0x1f4;return function(_0x339805){logger['error'](_0x339805[_0x78aa('0x29')]);if(_0x339805['name']){delete _0x339805[_0x78aa('0x2a')];}_0x328714[_0x78aa('0x1c')](_0x595611)[_0x78aa('0x2b')](_0x339805);};}exports[_0x78aa('0x2c')]=function(_0x3047c1,_0x5683c8){var _0x2d8b5e={},_0x434bc4={},_0x4dc0a6={'count':0x0,'rows':[]};var _0x156170=_['map'](db['FaxQueueReport'][_0x78aa('0x2d')],function(_0x5a7f57){return{'name':_0x5a7f57['fieldName'],'type':_0x5a7f57[_0x78aa('0x2e')][_0x78aa('0x2f')]};});_0x434bc4[_0x78aa('0x30')]=_[_0x78aa('0x31')](_0x156170,_0x78aa('0x2a'));_0x434bc4[_0x78aa('0x32')]=_[_0x78aa('0x33')](_0x3047c1['query']);_0x434bc4['filters']=_['intersection'](_0x434bc4[_0x78aa('0x30')],_0x434bc4[_0x78aa('0x32')]);_0x2d8b5e[_0x78aa('0x34')]=_[_0x78aa('0x35')](_0x434bc4['model'],qs[_0x78aa('0x36')](_0x3047c1[_0x78aa('0x32')][_0x78aa('0x36')]));_0x2d8b5e['attributes']=_0x2d8b5e['attributes']['length']?_0x2d8b5e['attributes']:_0x434bc4[_0x78aa('0x30')];if(!_0x3047c1[_0x78aa('0x32')][_0x78aa('0x37')](_0x78aa('0x38'))){_0x2d8b5e[_0x78aa('0x20')]=qs[_0x78aa('0x20')](_0x3047c1[_0x78aa('0x32')][_0x78aa('0x20')]);_0x2d8b5e[_0x78aa('0x1e')]=qs['offset'](_0x3047c1[_0x78aa('0x32')]['offset']);}_0x2d8b5e[_0x78aa('0x39')]=qs[_0x78aa('0x3a')](_0x3047c1[_0x78aa('0x32')][_0x78aa('0x3a')]);_0x2d8b5e[_0x78aa('0x3b')]=qs[_0x78aa('0x3c')](_[_0x78aa('0x3d')](_0x3047c1[_0x78aa('0x32')],_0x434bc4['filters']),_0x156170);if(_0x3047c1[_0x78aa('0x32')][_0x78aa('0x3e')]){_0x2d8b5e['where']=_[_0x78aa('0x3f')](_0x2d8b5e['where'],{'$or':_[_0x78aa('0x31')](_0x156170,function(_0x362bfe){if(_0x362bfe[_0x78aa('0x2e')]!==_0x78aa('0x40')){var _0x46a282={};_0x46a282[_0x362bfe[_0x78aa('0x2a')]]={'$like':'%'+_0x3047c1[_0x78aa('0x32')][_0x78aa('0x3e')]+'%'};return _0x46a282;}})});}_0x2d8b5e=_[_0x78aa('0x3f')]({},_0x2d8b5e,_0x3047c1[_0x78aa('0x41')]);var _0x51fa={'where':_0x2d8b5e[_0x78aa('0x3b')]};return db[_0x78aa('0x42')][_0x78aa('0x21')](_0x51fa)['then'](function(_0x4eb60c){_0x4dc0a6[_0x78aa('0x21')]=_0x4eb60c;if(_0x3047c1['query'][_0x78aa('0x43')]){_0x2d8b5e[_0x78aa('0x44')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x78aa('0x45')](_0x2d8b5e);})[_0x78aa('0x27')](function(_0x4e03fa){_0x4dc0a6[_0x78aa('0x46')]=_0x4e03fa;return _0x4dc0a6;})['then'](respondWithFilteredResult(_0x5683c8,_0x2d8b5e))['catch'](handleError(_0x5683c8,null));};exports[_0x78aa('0x47')]=function(_0x279f94,_0x854921){var _0x461d56={'raw':!![],'where':{'id':_0x279f94[_0x78aa('0x48')]['id']}},_0x59d035={};_0x59d035['model']=_[_0x78aa('0x33')](db[_0x78aa('0x42')]['rawAttributes']);_0x59d035['query']=_[_0x78aa('0x33')](_0x279f94['query']);_0x59d035['filters']=_[_0x78aa('0x35')](_0x59d035[_0x78aa('0x30')],_0x59d035['query']);_0x461d56[_0x78aa('0x34')]=_[_0x78aa('0x35')](_0x59d035[_0x78aa('0x30')],qs[_0x78aa('0x36')](_0x279f94[_0x78aa('0x32')][_0x78aa('0x36')]));_0x461d56[_0x78aa('0x34')]=_0x461d56[_0x78aa('0x34')][_0x78aa('0x49')]?_0x461d56[_0x78aa('0x34')]:_0x59d035[_0x78aa('0x30')];if(_0x279f94[_0x78aa('0x32')][_0x78aa('0x43')]){_0x461d56['include']=[{'all':!![]}];}_0x461d56=_['merge']({},_0x461d56,_0x279f94[_0x78aa('0x41')]);return db[_0x78aa('0x42')]['find'](_0x461d56)[_0x78aa('0x27')](handleEntityNotFound(_0x854921,null))['then'](respondWithResult(_0x854921,null))[_0x78aa('0x4a')](handleError(_0x854921,null));};exports[_0x78aa('0x4b')]=function(_0x5dabe6,_0x5b29a3){return db[_0x78aa('0x42')][_0x78aa('0x4b')](_0x5dabe6['body'],{})['then'](respondWithResult(_0x5b29a3,0xc9))[_0x78aa('0x4a')](handleError(_0x5b29a3,null));};exports[_0x78aa('0x26')]=function(_0x580adc,_0x1ddc12){if(_0x580adc[_0x78aa('0x4c')]['id']){delete _0x580adc[_0x78aa('0x4c')]['id'];}return db[_0x78aa('0x42')][_0x78aa('0x4d')]({'where':{'id':_0x580adc['params']['id']}})[_0x78aa('0x27')](handleEntityNotFound(_0x1ddc12,null))[_0x78aa('0x27')](saveUpdates(_0x580adc[_0x78aa('0x4c')],null))[_0x78aa('0x27')](respondWithResult(_0x1ddc12,null))[_0x78aa('0x4a')](handleError(_0x1ddc12,null));};exports[_0x78aa('0x4e')]=function(_0x49be51,_0x465d21){return db[_0x78aa('0x42')][_0x78aa('0x4d')]({'where':{'id':_0x49be51['params']['id']}})[_0x78aa('0x27')](handleEntityNotFound(_0x465d21,null))['then'](removeEntity(_0x465d21,null))['catch'](handleError(_0x465d21,null));};exports[_0x78aa('0x4f')]=function(_0x3489b8,_0x24f647){return db['FaxQueueReport'][_0x78aa('0x4f')]()[_0x78aa('0x27')](respondWithResult(_0x24f647,null))[_0x78aa('0x4a')](handleError(_0x24f647,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9c69b95..f77bf92 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4aca17,_0x393f11){var _0x1cdc4a=function(_0x23af9a){while(--_0x23af9a){_0x4aca17['push'](_0x4aca17['shift']());}};_0x1cdc4a(++_0x393f11);}(_0xabce,0x103));var _0xeabc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xabce[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x2fcbce,_0x325014){var _0x1eb8ae=function(_0x5f2a4e){while(--_0x5f2a4e){_0x2fcbce['push'](_0x2fcbce['shift']());}};_0x1eb8ae(++_0x325014);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3e80d3,_0x4188cc){_0x3e80d3=_0x3e80d3-0x0;var _0x4d5330=_0x7fbe[_0x3e80d3];return _0x4d5330;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f1422e7..e3f1a30 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 _0x7439=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x26ce01,_0x2046b2){var _0x15b336=function(_0x5cd022){while(--_0x5cd022){_0x26ce01['push'](_0x26ce01['shift']());}};_0x15b336(++_0x2046b2);}(_0x7439,0x191));var _0x9743=function(_0x2ce372,_0x4022e3){_0x2ce372=_0x2ce372-0x0;var _0x58703f=_0x7439[_0x2ce372];return _0x58703f;};'use strict';var _=require(_0x9743('0x0'));var util=require(_0x9743('0x1'));var moment=require(_0x9743('0x2'));var BPromise=require(_0x9743('0x3'));var rs=require(_0x9743('0x4'));var fs=require('fs');var Redis=require(_0x9743('0x5'));var db=require(_0x9743('0x6'))['db'];var utils=require(_0x9743('0x7'));var logger=require(_0x9743('0x8'))(_0x9743('0x9'));var config=require(_0x9743('0xa'));var jayson=require(_0x9743('0xb'));var client=jayson[_0x9743('0xc')][_0x9743('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22135a,_0x46883c,_0x562b08){return new BPromise(function(_0x424891,_0x20a558){return client['request'](_0x22135a,_0x562b08)[_0x9743('0xe')](function(_0x1efff7){logger[_0x9743('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x46883c,'request\x20sent');logger[_0x9743('0x10')](_0x9743('0x11'),_0x46883c,'request\x20sent',JSON[_0x9743('0x12')](_0x1efff7));if(_0x1efff7[_0x9743('0x13')]){if(_0x1efff7[_0x9743('0x13')][_0x9743('0x14')]===0x1f4){logger[_0x9743('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x46883c,_0x1efff7[_0x9743('0x13')][_0x9743('0x15')]);return _0x20a558(_0x1efff7['error']['message']);}logger[_0x9743('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x46883c,_0x1efff7[_0x9743('0x13')][_0x9743('0x15')]);return _0x424891(_0x1efff7[_0x9743('0x13')][_0x9743('0x15')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x46883c,_0x9743('0x16'));_0x424891(_0x1efff7[_0x9743('0x17')][_0x9743('0x15')]);}})[_0x9743('0x18')](function(_0x5271ee){logger[_0x9743('0x13')](_0x9743('0x19'),_0x46883c,_0x5271ee);_0x20a558(_0x5271ee);});});}exports['CreateFaxQueueReport']=function(_0x35b2bd){var _0x1ceab9=this;return new Promise(function(_0x5022db,_0xb5b4b6){return db[_0x9743('0x1a')][_0x9743('0x1b')](_0x35b2bd['body'],{'raw':_0x35b2bd[_0x9743('0x1c')]?_0x35b2bd[_0x9743('0x1c')][_0x9743('0x1d')]===undefined?!![]:![]:!![]})[_0x9743('0xe')](function(_0x50ad2a){logger[_0x9743('0xf')](_0x9743('0x1e'),_0x35b2bd);logger[_0x9743('0x10')](_0x9743('0x1e'),_0x35b2bd,JSON[_0x9743('0x12')](_0x50ad2a));_0x5022db(_0x50ad2a);})[_0x9743('0x18')](function(_0x51ffaa){logger['error']('CreateFaxQueueReport',_0x51ffaa['message'],_0x35b2bd);_0xb5b4b6(_0x1ceab9[_0x9743('0x13')](0x1f4,_0x51ffaa['message']));});});};exports[_0x9743('0x1f')]=function(_0x1b1817){var _0x9f5a23=this;return new Promise(function(_0x2b312b,_0x3e29c5){return db[_0x9743('0x1a')][_0x9743('0x20')](_0x1b1817[_0x9743('0x21')],{'raw':_0x1b1817[_0x9743('0x1c')]?_0x1b1817[_0x9743('0x1c')][_0x9743('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1817[_0x9743('0x1c')]?_0x1b1817[_0x9743('0x1c')][_0x9743('0x22')]||null:null,'attributes':_0x1b1817[_0x9743('0x1c')]?_0x1b1817[_0x9743('0x1c')][_0x9743('0x23')]||null:null,'limit':_0x1b1817[_0x9743('0x1c')]?_0x1b1817['options'][_0x9743('0x24')]||null:null})['then'](function(_0x30f0a8){logger[_0x9743('0xf')](_0x9743('0x1f'),_0x1b1817);logger['debug'](_0x9743('0x1f'),_0x1b1817,JSON['stringify'](_0x30f0a8));_0x2b312b(_0x30f0a8);})[_0x9743('0x18')](function(_0x2238da){logger[_0x9743('0x13')](_0x9743('0x1f'),_0x2238da[_0x9743('0x15')],_0x1b1817);_0x3e29c5(_0x9f5a23[_0x9743('0x13')](0x1f4,_0x2238da[_0x9743('0x15')]));});});}; \ No newline at end of file +var _0x6268=['catch','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','body','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result'];(function(_0x59940b,_0x1b6744){var _0xf112ae=function(_0x465e14){while(--_0x465e14){_0x59940b['push'](_0x59940b['shift']());}};_0xf112ae(++_0x1b6744);}(_0x6268,0xdd));var _0x8626=function(_0x291891,_0x5266bf){_0x291891=_0x291891-0x0;var _0x31bd2e=_0x6268[_0x291891];return _0x31bd2e;};'use strict';var _=require(_0x8626('0x0'));var util=require(_0x8626('0x1'));var moment=require(_0x8626('0x2'));var BPromise=require(_0x8626('0x3'));var rs=require(_0x8626('0x4'));var fs=require('fs');var Redis=require(_0x8626('0x5'));var db=require(_0x8626('0x6'))['db'];var utils=require(_0x8626('0x7'));var logger=require(_0x8626('0x8'))(_0x8626('0x9'));var config=require(_0x8626('0xa'));var jayson=require(_0x8626('0xb'));var client=jayson[_0x8626('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x486c0e,_0x458f24,_0x23b4a6){return new BPromise(function(_0x455c55,_0x549060){return client[_0x8626('0xd')](_0x486c0e,_0x23b4a6)[_0x8626('0xe')](function(_0xe6f34e){logger[_0x8626('0xf')](_0x8626('0x10'),_0x458f24,'request\x20sent');logger['debug'](_0x8626('0x11'),_0x458f24,_0x8626('0x12'),JSON[_0x8626('0x13')](_0xe6f34e));if(_0xe6f34e['error']){if(_0xe6f34e['error'][_0x8626('0x14')]===0x1f4){logger['error'](_0x8626('0x10'),_0x458f24,_0xe6f34e['error'][_0x8626('0x15')]);return _0x549060(_0xe6f34e[_0x8626('0x16')][_0x8626('0x15')]);}logger[_0x8626('0x16')](_0x8626('0x10'),_0x458f24,_0xe6f34e['error'][_0x8626('0x15')]);return _0x455c55(_0xe6f34e[_0x8626('0x16')][_0x8626('0x15')]);}else{logger[_0x8626('0xf')](_0x8626('0x10'),_0x458f24,'request\x20sent');_0x455c55(_0xe6f34e[_0x8626('0x17')][_0x8626('0x15')]);}})[_0x8626('0x18')](function(_0x3910a2){logger['error'](_0x8626('0x10'),_0x458f24,_0x3910a2);_0x549060(_0x3910a2);});});}exports['CreateFaxQueueReport']=function(_0x4bcd69){var _0x350079=this;return new Promise(function(_0x15bd06,_0x5dfd8d){return db['FaxQueueReport']['create'](_0x4bcd69['body'],{'raw':_0x4bcd69[_0x8626('0x19')]?_0x4bcd69[_0x8626('0x19')][_0x8626('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e6f06){logger[_0x8626('0xf')]('CreateFaxQueueReport',_0x4bcd69);logger['debug'](_0x8626('0x1b'),_0x4bcd69,JSON[_0x8626('0x13')](_0x3e6f06));_0x15bd06(_0x3e6f06);})['catch'](function(_0x225338){logger[_0x8626('0x16')]('CreateFaxQueueReport',_0x225338[_0x8626('0x15')],_0x4bcd69);_0x5dfd8d(_0x350079[_0x8626('0x16')](0x1f4,_0x225338[_0x8626('0x15')]));});});};exports[_0x8626('0x1c')]=function(_0x3ad32b){var _0x3ee271=this;return new Promise(function(_0x2ab30e,_0xadcb1b){return db[_0x8626('0x1d')][_0x8626('0x1e')](_0x3ad32b[_0x8626('0x1f')],{'raw':_0x3ad32b['options']?_0x3ad32b[_0x8626('0x19')][_0x8626('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad32b[_0x8626('0x19')]?_0x3ad32b[_0x8626('0x19')]['where']||null:null,'attributes':_0x3ad32b[_0x8626('0x19')]?_0x3ad32b[_0x8626('0x19')][_0x8626('0x20')]||null:null,'limit':_0x3ad32b['options']?_0x3ad32b[_0x8626('0x19')][_0x8626('0x21')]||null:null})[_0x8626('0xe')](function(_0x25e7cc){logger[_0x8626('0xf')](_0x8626('0x1c'),_0x3ad32b);logger[_0x8626('0x22')](_0x8626('0x1c'),_0x3ad32b,JSON['stringify'](_0x25e7cc));_0x2ab30e(_0x25e7cc);})['catch'](function(_0x742485){logger['error']('UpdateFaxQueueReport',_0x742485[_0x8626('0x15')],_0x3ad32b);_0xadcb1b(_0x3ee271['error'](0x1f4,_0x742485['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index aedbcef..953365b 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 _0x5244=['show','post','create','/:id','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x5244,0xf4));var _0x4524=function(_0x1a48de,_0x39090c){_0x1a48de=_0x1a48de-0x0;var _0x2b8ea7=_0x5244[_0x1a48de];return _0x2b8ea7;};'use strict';var multer=require(_0x4524('0x0'));var util=require('util');var path=require(_0x4524('0x1'));var timeout=require(_0x4524('0x2'));var express=require(_0x4524('0x3'));var router=express['Router']();var fs_extra=require(_0x4524('0x4'));var auth=require(_0x4524('0x5'));var interaction=require(_0x4524('0x6'));var config=require('../../config/environment');var controller=require(_0x4524('0x7'));router[_0x4524('0x8')]('/',auth[_0x4524('0x9')](),controller['index']);router[_0x4524('0x8')](_0x4524('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x4524('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4524('0xb')]);router[_0x4524('0xc')]('/',auth['isAuthenticated'](),controller[_0x4524('0xd')]);router['put'](_0x4524('0xe'),auth[_0x4524('0x9')](),controller[_0x4524('0xf')]);router['delete'](_0x4524('0xe'),auth[_0x4524('0x9')](),controller[_0x4524('0x10')]);module['exports']=router; \ No newline at end of file +var _0xae94=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','/:id','exports','multer','connect-timeout'];(function(_0x1af590,_0x22459f){var _0x55f0f2=function(_0x111b57){while(--_0x111b57){_0x1af590['push'](_0x1af590['shift']());}};_0x55f0f2(++_0x22459f);}(_0xae94,0x1e1));var _0x4ae9=function(_0x46d063,_0x33116e){_0x46d063=_0x46d063-0x0;var _0x54b3f0=_0xae94[_0x46d063];return _0x54b3f0;};'use strict';var multer=require(_0x4ae9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ae9('0x1'));var express=require(_0x4ae9('0x2'));var router=express[_0x4ae9('0x3')]();var fs_extra=require(_0x4ae9('0x4'));var auth=require(_0x4ae9('0x5'));var interaction=require(_0x4ae9('0x6'));var config=require(_0x4ae9('0x7'));var controller=require(_0x4ae9('0x8'));router[_0x4ae9('0x9')]('/',auth[_0x4ae9('0xa')](),controller['index']);router['get'](_0x4ae9('0xb'),auth[_0x4ae9('0xa')](),controller[_0x4ae9('0xc')]);router['get']('/:id',auth[_0x4ae9('0xa')](),controller[_0x4ae9('0xd')]);router[_0x4ae9('0xe')]('/',auth[_0x4ae9('0xa')](),controller[_0x4ae9('0xf')]);router[_0x4ae9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4ae9('0x11')]);router[_0x4ae9('0x12')](_0x4ae9('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x4ae9('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 db01987..da5a32a 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x379e2f,_0x55bb52){var _0x3ca1ab=function(_0x342356){while(--_0x342356){_0x379e2f['push'](_0x379e2f['shift']());}};_0x3ca1ab(++_0x55bb52);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0xf3cd[_0x4d3a9b];return _0x1b5471;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1c4188,_0x4debe2){var _0x199ded=function(_0x5e3f32){while(--_0x5e3f32){_0x1c4188['push'](_0x1c4188['shift']());}};_0x199ded(++_0x4debe2);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x534617,_0x41a7ba){_0x534617=_0x534617-0x0;var _0x516e6a=_0xf3cd[_0x534617];return _0x516e6a;};'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 4a79724..00aaa44 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 _0x17c1=['fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','catch','show','params','keys','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv'];(function(_0x5e1f8c,_0x4e8a99){var _0x1a8e69=function(_0x172b44){while(--_0x172b44){_0x5e1f8c['push'](_0x5e1f8c['shift']());}};_0x1a8e69(++_0x4e8a99);}(_0x17c1,0xd5));var _0x117c=function(_0x498b88,_0x157e5c){_0x498b88=_0x498b88-0x0;var _0x52b2a1=_0x17c1[_0x498b88];return _0x52b2a1;};'use strict';var emlformat=require(_0x117c('0x0'));var rimraf=require(_0x117c('0x1'));var zipdir=require(_0x117c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x117c('0x3'));var moment=require(_0x117c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x117c('0x5'));var util=require(_0x117c('0x6'));var path=require(_0x117c('0x7'));var sox=require('sox');var csv=require(_0x117c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x117c('0x9'));var _=require(_0x117c('0xa'));var squel=require(_0x117c('0xb'));var crypto=require(_0x117c('0xc'));var jsforce=require(_0x117c('0xd'));var deskjs=require(_0x117c('0xe'));var toCsv=require(_0x117c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x117c('0xf'));var authService=require(_0x117c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x117c('0x11'));var hardwareService=require(_0x117c('0x12'));var logger=require(_0x117c('0x13'))(_0x117c('0x14'));var utils=require(_0x117c('0x15'));var config=require(_0x117c('0x16'));var licenseUtil=require(_0x117c('0x17'));var db=require(_0x117c('0x18'))['db'];function respondWithStatusCode(_0xba084b,_0x55fc01){_0x55fc01=_0x55fc01||0xcc;return function(_0x5d9fbb){if(_0x5d9fbb){return _0xba084b['sendStatus'](_0x55fc01);}return _0xba084b['status'](_0x55fc01)[_0x117c('0x19')]();};}function respondWithResult(_0x42993e,_0x7e45bd){_0x7e45bd=_0x7e45bd||0xc8;return function(_0x935e3a){if(_0x935e3a){return _0x42993e[_0x117c('0x1a')](_0x7e45bd)[_0x117c('0x1b')](_0x935e3a);}};}function respondWithFilteredResult(_0x1217b3,_0x22ced2){return function(_0x4944f4){if(_0x4944f4){var _0xa84e3=typeof _0x22ced2['offset']==='undefined'&&typeof _0x22ced2['limit']===_0x117c('0x1c');var _0x1ed12a=_0x4944f4[_0x117c('0x1d')];var _0x4eb1c2=_0xa84e3?0x0:_0x22ced2[_0x117c('0x1e')];var _0x521079=_0xa84e3?_0x4944f4[_0x117c('0x1d')]:_0x22ced2['offset']+_0x22ced2[_0x117c('0x1f')];var _0x56fbd2;if(_0x521079>=_0x1ed12a){_0x521079=_0x1ed12a;_0x56fbd2=0xc8;}else{_0x56fbd2=0xce;}_0x1217b3[_0x117c('0x1a')](_0x56fbd2);return _0x1217b3[_0x117c('0x20')](_0x117c('0x21'),_0x4eb1c2+'-'+_0x521079+'/'+_0x1ed12a)[_0x117c('0x1b')](_0x4944f4);}return null;};}function patchUpdates(_0x58853b){return function(_0x31177f){try{jsonpatch[_0x117c('0x22')](_0x31177f,_0x58853b,!![]);}catch(_0x33abf8){return BPromise[_0x117c('0x23')](_0x33abf8);}return _0x31177f['save']();};}function saveUpdates(_0x7cbb03,_0x2ea85c){return function(_0x59fef7){if(_0x59fef7){return _0x59fef7[_0x117c('0x24')](_0x7cbb03)[_0x117c('0x25')](function(_0xe8176c){return _0xe8176c;});}return null;};}function removeEntity(_0x5b6583,_0x286882){return function(_0x3ec8db){if(_0x3ec8db){return _0x3ec8db[_0x117c('0x26')]()[_0x117c('0x25')](function(){_0x5b6583[_0x117c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376e94,_0x431bf6){return function(_0x26b670){if(!_0x26b670){_0x376e94[_0x117c('0x27')](0x194);}return _0x26b670;};}function handleError(_0x39c391,_0x1ffd9c){_0x1ffd9c=_0x1ffd9c||0x1f4;return function(_0x5ddae4){logger['error'](_0x5ddae4['stack']);if(_0x5ddae4[_0x117c('0x28')]){delete _0x5ddae4[_0x117c('0x28')];}_0x39c391[_0x117c('0x1a')](_0x1ffd9c)['send'](_0x5ddae4);};}exports['index']=function(_0x9ab574,_0x5945d5){var _0x935a98={},_0x20b880={},_0x152d93={'count':0x0,'rows':[]};var _0xf7e18a=_[_0x117c('0x29')](db[_0x117c('0x2a')][_0x117c('0x2b')],function(_0x32b0ea){return{'name':_0x32b0ea[_0x117c('0x2c')],'type':_0x32b0ea[_0x117c('0x2d')][_0x117c('0x2e')]};});_0x20b880[_0x117c('0x2f')]=_['map'](_0xf7e18a,_0x117c('0x28'));_0x20b880[_0x117c('0x30')]=_['keys'](_0x9ab574['query']);_0x20b880[_0x117c('0x31')]=_[_0x117c('0x32')](_0x20b880[_0x117c('0x2f')],_0x20b880[_0x117c('0x30')]);_0x935a98[_0x117c('0x33')]=_[_0x117c('0x32')](_0x20b880['model'],qs['fields'](_0x9ab574['query'][_0x117c('0x34')]));_0x935a98[_0x117c('0x33')]=_0x935a98[_0x117c('0x33')][_0x117c('0x35')]?_0x935a98[_0x117c('0x33')]:_0x20b880[_0x117c('0x2f')];if(!_0x9ab574[_0x117c('0x30')][_0x117c('0x36')](_0x117c('0x37'))){_0x935a98[_0x117c('0x1f')]=qs[_0x117c('0x1f')](_0x9ab574[_0x117c('0x30')][_0x117c('0x1f')]);_0x935a98[_0x117c('0x1e')]=qs[_0x117c('0x1e')](_0x9ab574[_0x117c('0x30')][_0x117c('0x1e')]);}_0x935a98[_0x117c('0x38')]=qs['sort'](_0x9ab574['query'][_0x117c('0x39')]);_0x935a98['where']=qs[_0x117c('0x31')](_[_0x117c('0x3a')](_0x9ab574['query'],_0x20b880[_0x117c('0x31')]),_0xf7e18a);if(_0x9ab574[_0x117c('0x30')][_0x117c('0x3b')]){_0x935a98[_0x117c('0x3c')]=_[_0x117c('0x3d')](_0x935a98[_0x117c('0x3c')],{'$or':_[_0x117c('0x29')](_0xf7e18a,function(_0x3d70a7){if(_0x3d70a7[_0x117c('0x2d')]!==_0x117c('0x3e')){var _0x760a2c={};_0x760a2c[_0x3d70a7[_0x117c('0x28')]]={'$like':'%'+_0x9ab574[_0x117c('0x30')][_0x117c('0x3b')]+'%'};return _0x760a2c;}})});}_0x935a98=_[_0x117c('0x3d')]({},_0x935a98,_0x9ab574['options']);var _0x444370={'where':_0x935a98[_0x117c('0x3c')]};return db['FaxTransferReport'][_0x117c('0x1d')](_0x444370)[_0x117c('0x25')](function(_0x3a451d){_0x152d93[_0x117c('0x1d')]=_0x3a451d;if(_0x9ab574[_0x117c('0x30')]['includeAll']){_0x935a98['include']=[{'all':!![]}];}return db[_0x117c('0x2a')][_0x117c('0x3f')](_0x935a98);})['then'](function(_0x204278){_0x152d93['rows']=_0x204278;return _0x152d93;})[_0x117c('0x25')](respondWithFilteredResult(_0x5945d5,_0x935a98))[_0x117c('0x40')](handleError(_0x5945d5,null));};exports[_0x117c('0x41')]=function(_0x330f46,_0x11b5ea){var _0x532555={'raw':!![],'where':{'id':_0x330f46[_0x117c('0x42')]['id']}},_0x50b029={};_0x50b029[_0x117c('0x2f')]=_[_0x117c('0x43')](db[_0x117c('0x2a')]['rawAttributes']);_0x50b029[_0x117c('0x30')]=_[_0x117c('0x43')](_0x330f46[_0x117c('0x30')]);_0x50b029[_0x117c('0x31')]=_['intersection'](_0x50b029['model'],_0x50b029[_0x117c('0x30')]);_0x532555[_0x117c('0x33')]=_['intersection'](_0x50b029['model'],qs[_0x117c('0x34')](_0x330f46['query'][_0x117c('0x34')]));_0x532555[_0x117c('0x33')]=_0x532555[_0x117c('0x33')][_0x117c('0x35')]?_0x532555[_0x117c('0x33')]:_0x50b029[_0x117c('0x2f')];if(_0x330f46[_0x117c('0x30')][_0x117c('0x44')]){_0x532555[_0x117c('0x45')]=[{'all':!![]}];}_0x532555=_[_0x117c('0x3d')]({},_0x532555,_0x330f46[_0x117c('0x46')]);return db[_0x117c('0x2a')][_0x117c('0x47')](_0x532555)[_0x117c('0x25')](handleEntityNotFound(_0x11b5ea,null))['then'](respondWithResult(_0x11b5ea,null))[_0x117c('0x40')](handleError(_0x11b5ea,null));};exports[_0x117c('0x48')]=function(_0x352f53,_0x4bcb6a){return db[_0x117c('0x2a')][_0x117c('0x48')](_0x352f53[_0x117c('0x49')],{})['then'](respondWithResult(_0x4bcb6a,0xc9))[_0x117c('0x40')](handleError(_0x4bcb6a,null));};exports[_0x117c('0x24')]=function(_0x3b7686,_0x1327bb){if(_0x3b7686[_0x117c('0x49')]['id']){delete _0x3b7686['body']['id'];}return db['FaxTransferReport'][_0x117c('0x47')]({'where':{'id':_0x3b7686['params']['id']}})[_0x117c('0x25')](handleEntityNotFound(_0x1327bb,null))[_0x117c('0x25')](saveUpdates(_0x3b7686[_0x117c('0x49')],null))[_0x117c('0x25')](respondWithResult(_0x1327bb,null))[_0x117c('0x40')](handleError(_0x1327bb,null));};exports[_0x117c('0x26')]=function(_0x3cb8a5,_0x75d2b9){return db[_0x117c('0x2a')]['find']({'where':{'id':_0x3cb8a5['params']['id']}})['then'](handleEntityNotFound(_0x75d2b9,null))[_0x117c('0x25')](removeEntity(_0x75d2b9,null))[_0x117c('0x40')](handleError(_0x75d2b9,null));};exports['describe']=function(_0x3fa8d0,_0x106855){return db[_0x117c('0x2a')]['describe']()[_0x117c('0x25')](respondWithResult(_0x106855,null))['catch'](handleError(_0x106855,null));}; \ No newline at end of file +var _0xb906=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','fields','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x17783f,_0x5671fb){var _0xfdd2d2=function(_0x3024ec){while(--_0x3024ec){_0x17783f['push'](_0x17783f['shift']());}};_0xfdd2d2(++_0x5671fb);}(_0xb906,0xe7));var _0x6b90=function(_0x3bf6a5,_0x4b8928){_0x3bf6a5=_0x3bf6a5-0x0;var _0x2a873d=_0xb906[_0x3bf6a5];return _0x2a873d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b90('0x0'));var zipdir=require(_0x6b90('0x1'));var jsonpatch=require(_0x6b90('0x2'));var rp=require(_0x6b90('0x3'));var moment=require(_0x6b90('0x4'));var BPromise=require(_0x6b90('0x5'));var Mustache=require(_0x6b90('0x6'));var util=require('util');var path=require(_0x6b90('0x7'));var sox=require(_0x6b90('0x8'));var csv=require(_0x6b90('0x9'));var ejs=require(_0x6b90('0xa'));var fs=require('fs');var fs_extra=require(_0x6b90('0xb'));var _=require(_0x6b90('0xc'));var squel=require(_0x6b90('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b90('0xe'));var deskjs=require(_0x6b90('0xf'));var toCsv=require(_0x6b90('0x9'));var querystring=require(_0x6b90('0x10'));var Papa=require('papaparse');var Redis=require(_0x6b90('0x11'));var authService=require(_0x6b90('0x12'));var qs=require(_0x6b90('0x13'));var as=require(_0x6b90('0x14'));var hardwareService=require(_0x6b90('0x15'));var logger=require('../../config/logger')(_0x6b90('0x16'));var utils=require(_0x6b90('0x17'));var config=require(_0x6b90('0x18'));var licenseUtil=require(_0x6b90('0x19'));var db=require(_0x6b90('0x1a'))['db'];function respondWithStatusCode(_0x2d8209,_0x22ec4f){_0x22ec4f=_0x22ec4f||0xcc;return function(_0x4913fa){if(_0x4913fa){return _0x2d8209[_0x6b90('0x1b')](_0x22ec4f);}return _0x2d8209[_0x6b90('0x1c')](_0x22ec4f)[_0x6b90('0x1d')]();};}function respondWithResult(_0x44fdbd,_0x14b224){_0x14b224=_0x14b224||0xc8;return function(_0x24b539){if(_0x24b539){return _0x44fdbd[_0x6b90('0x1c')](_0x14b224)[_0x6b90('0x1e')](_0x24b539);}};}function respondWithFilteredResult(_0x22fc1e,_0x27758d){return function(_0x4bb772){if(_0x4bb772){var _0x55194a=typeof _0x27758d['offset']===_0x6b90('0x1f')&&typeof _0x27758d[_0x6b90('0x20')]===_0x6b90('0x1f');var _0x14f661=_0x4bb772[_0x6b90('0x21')];var _0x19cddc=_0x55194a?0x0:_0x27758d['offset'];var _0x29efc5=_0x55194a?_0x4bb772[_0x6b90('0x21')]:_0x27758d['offset']+_0x27758d['limit'];var _0x30e8fc;if(_0x29efc5>=_0x14f661){_0x29efc5=_0x14f661;_0x30e8fc=0xc8;}else{_0x30e8fc=0xce;}_0x22fc1e[_0x6b90('0x1c')](_0x30e8fc);return _0x22fc1e[_0x6b90('0x22')](_0x6b90('0x23'),_0x19cddc+'-'+_0x29efc5+'/'+_0x14f661)[_0x6b90('0x1e')](_0x4bb772);}return null;};}function patchUpdates(_0x196e91){return function(_0x40ae7b){try{jsonpatch[_0x6b90('0x24')](_0x40ae7b,_0x196e91,!![]);}catch(_0x5a4ebe){return BPromise[_0x6b90('0x25')](_0x5a4ebe);}return _0x40ae7b[_0x6b90('0x26')]();};}function saveUpdates(_0x167bae,_0x5d41c7){return function(_0x45827c){if(_0x45827c){return _0x45827c[_0x6b90('0x27')](_0x167bae)[_0x6b90('0x28')](function(_0x49eec8){return _0x49eec8;});}return null;};}function removeEntity(_0x4d9ac6,_0x5808fb){return function(_0x3a4eed){if(_0x3a4eed){return _0x3a4eed[_0x6b90('0x29')]()[_0x6b90('0x28')](function(){_0x4d9ac6[_0x6b90('0x1c')](0xcc)[_0x6b90('0x1d')]();});}};}function handleEntityNotFound(_0x522779,_0x3cd9fb){return function(_0x1b1b88){if(!_0x1b1b88){_0x522779[_0x6b90('0x1b')](0x194);}return _0x1b1b88;};}function handleError(_0x38ada0,_0x5c4a21){_0x5c4a21=_0x5c4a21||0x1f4;return function(_0x3213a){logger[_0x6b90('0x2a')](_0x3213a[_0x6b90('0x2b')]);if(_0x3213a[_0x6b90('0x2c')]){delete _0x3213a[_0x6b90('0x2c')];}_0x38ada0[_0x6b90('0x1c')](_0x5c4a21)[_0x6b90('0x2d')](_0x3213a);};}exports[_0x6b90('0x2e')]=function(_0x4e751b,_0x81a523){var _0x304ae7={},_0x2e2033={},_0x170c8d={'count':0x0,'rows':[]};var _0x1fa05d=_[_0x6b90('0x2f')](db[_0x6b90('0x30')]['rawAttributes'],function(_0x39a9e9){return{'name':_0x39a9e9[_0x6b90('0x31')],'type':_0x39a9e9[_0x6b90('0x32')][_0x6b90('0x33')]};});_0x2e2033[_0x6b90('0x34')]=_[_0x6b90('0x2f')](_0x1fa05d,_0x6b90('0x2c'));_0x2e2033[_0x6b90('0x35')]=_[_0x6b90('0x36')](_0x4e751b[_0x6b90('0x35')]);_0x2e2033['filters']=_[_0x6b90('0x37')](_0x2e2033[_0x6b90('0x34')],_0x2e2033['query']);_0x304ae7['attributes']=_[_0x6b90('0x37')](_0x2e2033[_0x6b90('0x34')],qs['fields'](_0x4e751b[_0x6b90('0x35')]['fields']));_0x304ae7['attributes']=_0x304ae7[_0x6b90('0x38')][_0x6b90('0x39')]?_0x304ae7[_0x6b90('0x38')]:_0x2e2033['model'];if(!_0x4e751b[_0x6b90('0x35')][_0x6b90('0x3a')](_0x6b90('0x3b'))){_0x304ae7['limit']=qs[_0x6b90('0x20')](_0x4e751b[_0x6b90('0x35')]['limit']);_0x304ae7[_0x6b90('0x3c')]=qs[_0x6b90('0x3c')](_0x4e751b[_0x6b90('0x35')][_0x6b90('0x3c')]);}_0x304ae7[_0x6b90('0x3d')]=qs[_0x6b90('0x3e')](_0x4e751b['query'][_0x6b90('0x3e')]);_0x304ae7[_0x6b90('0x3f')]=qs[_0x6b90('0x40')](_['pick'](_0x4e751b[_0x6b90('0x35')],_0x2e2033['filters']),_0x1fa05d);if(_0x4e751b['query'][_0x6b90('0x41')]){_0x304ae7[_0x6b90('0x3f')]=_[_0x6b90('0x42')](_0x304ae7['where'],{'$or':_[_0x6b90('0x2f')](_0x1fa05d,function(_0x3a1e12){if(_0x3a1e12['type']!==_0x6b90('0x43')){var _0xfbc453={};_0xfbc453[_0x3a1e12[_0x6b90('0x2c')]]={'$like':'%'+_0x4e751b['query']['filter']+'%'};return _0xfbc453;}})});}_0x304ae7=_[_0x6b90('0x42')]({},_0x304ae7,_0x4e751b['options']);var _0x3ad121={'where':_0x304ae7[_0x6b90('0x3f')]};return db[_0x6b90('0x30')][_0x6b90('0x21')](_0x3ad121)[_0x6b90('0x28')](function(_0x4c29b8){_0x170c8d[_0x6b90('0x21')]=_0x4c29b8;if(_0x4e751b['query'][_0x6b90('0x44')]){_0x304ae7[_0x6b90('0x45')]=[{'all':!![]}];}return db[_0x6b90('0x30')]['findAll'](_0x304ae7);})[_0x6b90('0x28')](function(_0x5a8091){_0x170c8d[_0x6b90('0x46')]=_0x5a8091;return _0x170c8d;})[_0x6b90('0x28')](respondWithFilteredResult(_0x81a523,_0x304ae7))[_0x6b90('0x47')](handleError(_0x81a523,null));};exports['show']=function(_0x17d52b,_0x417c0b){var _0x2ca9f8={'raw':!![],'where':{'id':_0x17d52b[_0x6b90('0x48')]['id']}},_0x3b895a={};_0x3b895a['model']=_[_0x6b90('0x36')](db[_0x6b90('0x30')][_0x6b90('0x49')]);_0x3b895a[_0x6b90('0x35')]=_[_0x6b90('0x36')](_0x17d52b[_0x6b90('0x35')]);_0x3b895a['filters']=_[_0x6b90('0x37')](_0x3b895a[_0x6b90('0x34')],_0x3b895a[_0x6b90('0x35')]);_0x2ca9f8[_0x6b90('0x38')]=_[_0x6b90('0x37')](_0x3b895a[_0x6b90('0x34')],qs[_0x6b90('0x4a')](_0x17d52b[_0x6b90('0x35')][_0x6b90('0x4a')]));_0x2ca9f8[_0x6b90('0x38')]=_0x2ca9f8[_0x6b90('0x38')]['length']?_0x2ca9f8[_0x6b90('0x38')]:_0x3b895a[_0x6b90('0x34')];if(_0x17d52b[_0x6b90('0x35')][_0x6b90('0x44')]){_0x2ca9f8['include']=[{'all':!![]}];}_0x2ca9f8=_[_0x6b90('0x42')]({},_0x2ca9f8,_0x17d52b[_0x6b90('0x4b')]);return db[_0x6b90('0x30')][_0x6b90('0x4c')](_0x2ca9f8)[_0x6b90('0x28')](handleEntityNotFound(_0x417c0b,null))[_0x6b90('0x28')](respondWithResult(_0x417c0b,null))['catch'](handleError(_0x417c0b,null));};exports['create']=function(_0x515b52,_0x1167d1){return db['FaxTransferReport']['create'](_0x515b52[_0x6b90('0x4d')],{})['then'](respondWithResult(_0x1167d1,0xc9))[_0x6b90('0x47')](handleError(_0x1167d1,null));};exports[_0x6b90('0x27')]=function(_0x946ce2,_0x231c96){if(_0x946ce2[_0x6b90('0x4d')]['id']){delete _0x946ce2[_0x6b90('0x4d')]['id'];}return db[_0x6b90('0x30')][_0x6b90('0x4c')]({'where':{'id':_0x946ce2[_0x6b90('0x48')]['id']}})[_0x6b90('0x28')](handleEntityNotFound(_0x231c96,null))[_0x6b90('0x28')](saveUpdates(_0x946ce2[_0x6b90('0x4d')],null))[_0x6b90('0x28')](respondWithResult(_0x231c96,null))[_0x6b90('0x47')](handleError(_0x231c96,null));};exports[_0x6b90('0x29')]=function(_0x20b7ac,_0x1533c5){return db['FaxTransferReport']['find']({'where':{'id':_0x20b7ac[_0x6b90('0x48')]['id']}})[_0x6b90('0x28')](handleEntityNotFound(_0x1533c5,null))[_0x6b90('0x28')](removeEntity(_0x1533c5,null))['catch'](handleError(_0x1533c5,null));};exports[_0x6b90('0x4e')]=function(_0x52b1bc,_0xc53cac){return db[_0x6b90('0x30')]['describe']()[_0x6b90('0x28')](respondWithResult(_0xc53cac,null))['catch'](handleError(_0xc53cac,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1a17825..3f7ebc6 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 _0x08f1=['util','../../config/logger','moment','path','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','uniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x08f1,0xd8));var _0x108f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x08f1[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x108f('0x0'));var logger=require(_0x108f('0x1'))('api');var moment=require(_0x108f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x108f('0x3'));var rimraf=require('rimraf');var config=require(_0x108f('0x4'));var attributes=require(_0x108f('0x5'));module['exports']=function(_0x1a3a5e,_0x2f1b08){return _0x1a3a5e[_0x108f('0x6')](_0x108f('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x108f('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xefb7=['bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x13f0ae,_0x37b1bf){var _0x3f0c0c=function(_0x328ae2){while(--_0x328ae2){_0x13f0ae['push'](_0x13f0ae['shift']());}};_0x3f0c0c(++_0x37b1bf);}(_0xefb7,0x14b));var _0x7efb=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xefb7[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x7efb('0x0'));var util=require(_0x7efb('0x1'));var logger=require(_0x7efb('0x2'))(_0x7efb('0x3'));var moment=require(_0x7efb('0x4'));var BPromise=require(_0x7efb('0x5'));var rp=require(_0x7efb('0x6'));var fs=require('fs');var path=require(_0x7efb('0x7'));var rimraf=require(_0x7efb('0x8'));var config=require(_0x7efb('0x9'));var attributes=require(_0x7efb('0xa'));module[_0x7efb('0xb')]=function(_0x47954e,_0x92d049){return _0x47954e[_0x7efb('0xc')](_0x7efb('0xd'),attributes,{'tableName':_0x7efb('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7efb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f227e87..6590c21 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 _0x8b1a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0x8b1a,0x15e));var _0xa8b1=function(_0x2cdf81,_0x359166){_0x2cdf81=_0x2cdf81-0x0;var _0x432e9e=_0x8b1a[_0x2cdf81];return _0x432e9e;};'use strict';var _=require(_0xa8b1('0x0'));var util=require(_0xa8b1('0x1'));var moment=require(_0xa8b1('0x2'));var BPromise=require(_0xa8b1('0x3'));var rs=require(_0xa8b1('0x4'));var fs=require('fs');var Redis=require(_0xa8b1('0x5'));var db=require(_0xa8b1('0x6'))['db'];var utils=require(_0xa8b1('0x7'));var logger=require(_0xa8b1('0x8'))('rpc');var config=require(_0xa8b1('0x9'));var jayson=require(_0xa8b1('0xa'));var client=jayson[_0xa8b1('0xb')][_0xa8b1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x294d17,_0x50f32f,_0x101968){return new BPromise(function(_0x88600a,_0x31ae39){return client[_0xa8b1('0xd')](_0x294d17,_0x101968)['then'](function(_0x2ff53e){logger[_0xa8b1('0xe')](_0xa8b1('0xf'),_0x50f32f,_0xa8b1('0x10'));logger['debug'](_0xa8b1('0x11'),_0x50f32f,_0xa8b1('0x10'),JSON[_0xa8b1('0x12')](_0x2ff53e));if(_0x2ff53e['error']){if(_0x2ff53e[_0xa8b1('0x13')][_0xa8b1('0x14')]===0x1f4){logger[_0xa8b1('0x13')](_0xa8b1('0xf'),_0x50f32f,_0x2ff53e[_0xa8b1('0x13')][_0xa8b1('0x15')]);return _0x31ae39(_0x2ff53e[_0xa8b1('0x13')]['message']);}logger[_0xa8b1('0x13')](_0xa8b1('0xf'),_0x50f32f,_0x2ff53e[_0xa8b1('0x13')]['message']);return _0x88600a(_0x2ff53e[_0xa8b1('0x13')][_0xa8b1('0x15')]);}else{logger[_0xa8b1('0xe')](_0xa8b1('0xf'),_0x50f32f,_0xa8b1('0x10'));_0x88600a(_0x2ff53e['result']['message']);}})['catch'](function(_0x3f547f){logger[_0xa8b1('0x13')](_0xa8b1('0xf'),_0x50f32f,_0x3f547f);_0x31ae39(_0x3f547f);});});} \ No newline at end of file +var _0x5d15=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FaxTransferReport,\x20%s,\x20%s'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0x5d15,0xc7));var _0x55d1=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x5d15[_0x246227];return _0x37bd4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x55d1('0x0'));var rs=require(_0x55d1('0x1'));var fs=require('fs');var Redis=require(_0x55d1('0x2'));var db=require(_0x55d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x55d1('0x4'))(_0x55d1('0x5'));var config=require(_0x55d1('0x6'));var jayson=require(_0x55d1('0x7'));var client=jayson['client'][_0x55d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16a1d5,_0x588b9c,_0x1094aa){return new BPromise(function(_0x1d8cd1,_0x57f6d1){return client['request'](_0x16a1d5,_0x1094aa)[_0x55d1('0x9')](function(_0x3005ce){logger['info'](_0x55d1('0xa'),_0x588b9c,_0x55d1('0xb'));logger[_0x55d1('0xc')](_0x55d1('0xd'),_0x588b9c,_0x55d1('0xb'),JSON[_0x55d1('0xe')](_0x3005ce));if(_0x3005ce[_0x55d1('0xf')]){if(_0x3005ce['error'][_0x55d1('0x10')]===0x1f4){logger[_0x55d1('0xf')](_0x55d1('0xa'),_0x588b9c,_0x3005ce[_0x55d1('0xf')][_0x55d1('0x11')]);return _0x57f6d1(_0x3005ce[_0x55d1('0xf')][_0x55d1('0x11')]);}logger[_0x55d1('0xf')](_0x55d1('0xa'),_0x588b9c,_0x3005ce[_0x55d1('0xf')]['message']);return _0x1d8cd1(_0x3005ce[_0x55d1('0xf')][_0x55d1('0x11')]);}else{logger[_0x55d1('0x12')](_0x55d1('0xa'),_0x588b9c,_0x55d1('0xb'));_0x1d8cd1(_0x3005ce[_0x55d1('0x13')][_0x55d1('0x11')]);}})[_0x55d1('0x14')](function(_0x5b028f){logger[_0x55d1('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x588b9c,_0x5b028f);_0x57f6d1(_0x5b028f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ba990dd..1a5536d 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 _0x6f24=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path','express','Router'];(function(_0x4c6f32,_0x11f826){var _0x1ce469=function(_0x28d6d1){while(--_0x28d6d1){_0x4c6f32['push'](_0x4c6f32['shift']());}};_0x1ce469(++_0x11f826);}(_0x6f24,0x1b3));var _0x46f2=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x6f24[_0x1505e5];return _0x5b1dcd;};'use strict';var multer=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var path=require(_0x46f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x46f2('0x3'));var router=express[_0x46f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46f2('0x5'));var interaction=require(_0x46f2('0x6'));var config=require(_0x46f2('0x7'));var controller=require(_0x46f2('0x8'));router[_0x46f2('0x9')]('/',auth[_0x46f2('0xa')](),controller[_0x46f2('0xb')]);router[_0x46f2('0x9')](_0x46f2('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x46f2('0x9')](_0x46f2('0xd'),auth[_0x46f2('0xa')](),controller[_0x46f2('0xe')]);router[_0x46f2('0xf')]('/',auth['isAuthenticated'](),controller[_0x46f2('0x10')]);router[_0x46f2('0x11')](_0x46f2('0xd'),auth[_0x46f2('0xa')](),controller['update']);router[_0x46f2('0x12')]('/:id',auth[_0x46f2('0xa')](),controller['destroy']);module[_0x46f2('0x13')]=router; \ No newline at end of file +var _0x4480=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','destroy','multer','util','path','connect-timeout'];(function(_0x2bdbd5,_0x1edcb0){var _0x456faa=function(_0xeb91fc){while(--_0xeb91fc){_0x2bdbd5['push'](_0x2bdbd5['shift']());}};_0x456faa(++_0x1edcb0);}(_0x4480,0x11d));var _0x0448=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x4480[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x0448('0x0'));var util=require(_0x0448('0x1'));var path=require(_0x0448('0x2'));var timeout=require(_0x0448('0x3'));var express=require(_0x0448('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0448('0x5'));var interaction=require(_0x0448('0x6'));var config=require(_0x0448('0x7'));var controller=require(_0x0448('0x8'));router['get']('/',auth[_0x0448('0x9')](),controller[_0x0448('0xa')]);router[_0x0448('0xb')](_0x0448('0xc'),auth[_0x0448('0x9')](),controller[_0x0448('0xd')]);router[_0x0448('0xb')](_0x0448('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0448('0x9')](),controller[_0x0448('0xf')]);router['put'](_0x0448('0xe'),auth[_0x0448('0x9')](),controller['update']);router['delete'](_0x0448('0xe'),auth[_0x0448('0x9')](),controller[_0x0448('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5b55342..898e91f 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 _0x8b99=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','exports','multer','path'];(function(_0x18c44d,_0x33976d){var _0x71abcf=function(_0x43072b){while(--_0x43072b){_0x18c44d['push'](_0x18c44d['shift']());}};_0x71abcf(++_0x33976d);}(_0x8b99,0x1b7));var _0x98b9=function(_0x429b07,_0x2ad6b5){_0x429b07=_0x429b07-0x0;var _0x5bf7c5=_0x8b99[_0x429b07];return _0x5bf7c5;};'use strict';var multer=require(_0x98b9('0x0'));var util=require('util');var path=require(_0x98b9('0x1'));var timeout=require(_0x98b9('0x2'));var express=require(_0x98b9('0x3'));var router=express[_0x98b9('0x4')]();var fs_extra=require(_0x98b9('0x5'));var auth=require(_0x98b9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x98b9('0x7')]('/',auth[_0x98b9('0x8')](),controller[_0x98b9('0x9')]);router[_0x98b9('0x7')](_0x98b9('0xa'),auth[_0x98b9('0x8')](),controller[_0x98b9('0xb')]);router[_0x98b9('0x7')](_0x98b9('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x98b9('0x7')](_0x98b9('0xd'),auth[_0x98b9('0x8')](),controller[_0x98b9('0xe')]);router['post']('/',auth[_0x98b9('0x8')](),controller[_0x98b9('0xf')]);router[_0x98b9('0x10')](_0x98b9('0xc'),auth[_0x98b9('0x8')](),controller[_0x98b9('0x11')]);router[_0x98b9('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x98b9('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x98b9('0x14')]=router; \ No newline at end of file +var _0x66bf=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5dba09,_0x31b9){var _0x21e054=function(_0x11a196){while(--_0x11a196){_0x5dba09['push'](_0x5dba09['shift']());}};_0x21e054(++_0x31b9);}(_0x66bf,0x1eb));var _0xf66b=function(_0x2f8619,_0x195689){_0x2f8619=_0x2f8619-0x0;var _0x13b303=_0x66bf[_0x2f8619];return _0x13b303;};'use strict';var multer=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var path=require(_0xf66b('0x2'));var timeout=require(_0xf66b('0x3'));var express=require(_0xf66b('0x4'));var router=express[_0xf66b('0x5')]();var fs_extra=require(_0xf66b('0x6'));var auth=require(_0xf66b('0x7'));var interaction=require(_0xf66b('0x8'));var config=require(_0xf66b('0x9'));var controller=require(_0xf66b('0xa'));router[_0xf66b('0xb')]('/',auth[_0xf66b('0xc')](),controller[_0xf66b('0xd')]);router[_0xf66b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf66b('0xe')]);router['get'](_0xf66b('0xf'),auth[_0xf66b('0xc')](),controller[_0xf66b('0x10')]);router[_0xf66b('0xb')](_0xf66b('0x11'),auth[_0xf66b('0xc')](),controller[_0xf66b('0x12')]);router[_0xf66b('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf66b('0x13')](_0xf66b('0xf'),auth['isAuthenticated'](),controller[_0xf66b('0x14')]);router['put']('/:id',auth[_0xf66b('0xc')](),controller[_0xf66b('0x15')]);router['delete'](_0xf66b('0x16'),auth[_0xf66b('0xc')](),controller[_0xf66b('0x17')]);module[_0xf66b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 4a80123..69c9aa4 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 _0x7290=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x252f47,_0xbc8b53){var _0x58bf71=function(_0x1b064b){while(--_0x1b064b){_0x252f47['push'](_0x252f47['shift']());}};_0x58bf71(++_0xbc8b53);}(_0x7290,0x65));var _0x0729=function(_0x47cfb2,_0x550212){_0x47cfb2=_0x47cfb2-0x0;var _0x1d5212=_0x7290[_0x47cfb2];return _0x1d5212;};'use strict';var Sequelize=require(_0x0729('0x0'));module[_0x0729('0x1')]={'name':{'type':Sequelize[_0x0729('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0729('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x0729('0x3')](_0x0729('0x4')),'defaultValue':_0x0729('0x4')},'password':{'type':Sequelize[_0x0729('0x2')]},'consumerKey':{'type':Sequelize[_0x0729('0x2')]},'consumerSecret':{'type':Sequelize[_0x0729('0x2')]},'token':{'type':Sequelize[_0x0729('0x2')]},'tokenSecret':{'type':Sequelize[_0x0729('0x2')]},'serverUrl':{'type':Sequelize[_0x0729('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0729('0x3')](_0x0729('0x5'),'newTab'),'defaultValue':_0x0729('0x5')}}; \ No newline at end of file +var _0xf5ab=['newTab','integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x1278bc,_0x4fa4e8){var _0x396082=function(_0xb1e96d){while(--_0xb1e96d){_0x1278bc['push'](_0x1278bc['shift']());}};_0x396082(++_0x4fa4e8);}(_0xf5ab,0x175));var _0xbf5a=function(_0xcdc0a2,_0x7cedb){_0xcdc0a2=_0xcdc0a2-0x0;var _0x2f2bec=_0xf5ab[_0xcdc0a2];return _0x2f2bec;};'use strict';var Sequelize=require(_0xbf5a('0x0'));module[_0xbf5a('0x1')]={'name':{'type':Sequelize[_0xbf5a('0x2')]},'description':{'type':Sequelize[_0xbf5a('0x2')]},'username':{'type':Sequelize[_0xbf5a('0x2')]},'remoteUri':{'type':Sequelize[_0xbf5a('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xbf5a('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xbf5a('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf5a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbf5a('0x4')]('integrationTab',_0xbf5a('0x5')),'defaultValue':_0xbf5a('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9e99d97..d5624fa 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 _0xbf3d=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','DeskAccount','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','priority','remoteUri','authType','username','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xbf3d,0xd9));var _0xdbf3=function(_0x16a0cb,_0x59ff7c){_0x16a0cb=_0x16a0cb-0x0;var _0xcebd6f=_0xbf3d[_0x16a0cb];return _0xcebd6f;};'use strict';var emlformat=require(_0xdbf3('0x0'));var rimraf=require(_0xdbf3('0x1'));var zipdir=require(_0xdbf3('0x2'));var jsonpatch=require(_0xdbf3('0x3'));var rp=require(_0xdbf3('0x4'));var moment=require(_0xdbf3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbf3('0x6'));var util=require(_0xdbf3('0x7'));var path=require(_0xdbf3('0x8'));var sox=require(_0xdbf3('0x9'));var csv=require('to-csv');var ejs=require(_0xdbf3('0xa'));var fs=require('fs');var fs_extra=require(_0xdbf3('0xb'));var _=require('lodash');var squel=require(_0xdbf3('0xc'));var crypto=require('crypto');var jsforce=require(_0xdbf3('0xd'));var deskjs=require(_0xdbf3('0xe'));var toCsv=require(_0xdbf3('0xf'));var querystring=require(_0xdbf3('0x10'));var Papa=require('papaparse');var Redis=require(_0xdbf3('0x11'));var authService=require(_0xdbf3('0x12'));var qs=require(_0xdbf3('0x13'));var as=require(_0xdbf3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbf3('0x15'))(_0xdbf3('0x16'));var utils=require(_0xdbf3('0x17'));var config=require(_0xdbf3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbf3('0x19'))['db'];var integrations=require(_0xdbf3('0x1a'));function respondWithStatusCode(_0x27a434,_0x11696e){_0x11696e=_0x11696e||0xcc;return function(_0x43a07a){if(_0x43a07a){return _0x27a434[_0xdbf3('0x1b')](_0x11696e);}return _0x27a434[_0xdbf3('0x1c')](_0x11696e)[_0xdbf3('0x1d')]();};}function respondWithResult(_0x93b447,_0x489966){_0x489966=_0x489966||0xc8;return function(_0x373de3){if(_0x373de3){return _0x93b447[_0xdbf3('0x1c')](_0x489966)[_0xdbf3('0x1e')](_0x373de3);}};}function respondWithFilteredResult(_0x38f037,_0x348e5e){return function(_0x3dcc7e){if(_0x3dcc7e){var _0x2457a0=typeof _0x348e5e[_0xdbf3('0x1f')]===_0xdbf3('0x20')&&typeof _0x348e5e[_0xdbf3('0x21')]===_0xdbf3('0x20');var _0x5db548=_0x3dcc7e[_0xdbf3('0x22')];var _0x153fe7=_0x2457a0?0x0:_0x348e5e['offset'];var _0x146797=_0x2457a0?_0x3dcc7e['count']:_0x348e5e['offset']+_0x348e5e[_0xdbf3('0x21')];var _0x1c1d2e;if(_0x146797>=_0x5db548){_0x146797=_0x5db548;_0x1c1d2e=0xc8;}else{_0x1c1d2e=0xce;}_0x38f037[_0xdbf3('0x1c')](_0x1c1d2e);return _0x38f037[_0xdbf3('0x23')](_0xdbf3('0x24'),_0x153fe7+'-'+_0x146797+'/'+_0x5db548)[_0xdbf3('0x1e')](_0x3dcc7e);}return null;};}function patchUpdates(_0x22a771){return function(_0x2db416){try{jsonpatch[_0xdbf3('0x25')](_0x2db416,_0x22a771,!![]);}catch(_0x477bc1){return BPromise[_0xdbf3('0x26')](_0x477bc1);}return _0x2db416[_0xdbf3('0x27')]();};}function saveUpdates(_0x30313f,_0x10ac08){return function(_0x257a9c){if(_0x257a9c){return _0x257a9c[_0xdbf3('0x28')](_0x30313f)['then'](function(_0x3485dc){return _0x3485dc;});}return null;};}function removeEntity(_0x45ebd1,_0x1712ad){return function(_0x121bf8){if(_0x121bf8){return _0x121bf8[_0xdbf3('0x29')]()[_0xdbf3('0x2a')](function(){_0x45ebd1[_0xdbf3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x797c41,_0x2c57a6){return function(_0x4cfdf7){if(!_0x4cfdf7){_0x797c41['sendStatus'](0x194);}return _0x4cfdf7;};}function handleError(_0xb5af68,_0x52aa0d){_0x52aa0d=_0x52aa0d||0x1f4;return function(_0x52b115){logger['error'](_0x52b115[_0xdbf3('0x2b')]);if(_0x52b115[_0xdbf3('0x2c')]){delete _0x52b115[_0xdbf3('0x2c')];}_0xb5af68[_0xdbf3('0x1c')](_0x52aa0d)[_0xdbf3('0x2d')](_0x52b115);};}exports['index']=function(_0x23c935,_0x184c61){var _0x2cbbf1={},_0xf21ee3={},_0x300435={'count':0x0,'rows':[]};var _0x29f5d8=_[_0xdbf3('0x2e')](db[_0xdbf3('0x2f')]['rawAttributes'],function(_0x1265dc){return{'name':_0x1265dc['fieldName'],'type':_0x1265dc[_0xdbf3('0x30')]['key']};});_0xf21ee3[_0xdbf3('0x31')]=_['map'](_0x29f5d8,_0xdbf3('0x2c'));_0xf21ee3[_0xdbf3('0x32')]=_[_0xdbf3('0x33')](_0x23c935[_0xdbf3('0x32')]);_0xf21ee3[_0xdbf3('0x34')]=_[_0xdbf3('0x35')](_0xf21ee3[_0xdbf3('0x31')],_0xf21ee3[_0xdbf3('0x32')]);_0x2cbbf1[_0xdbf3('0x36')]=_['intersection'](_0xf21ee3[_0xdbf3('0x31')],qs[_0xdbf3('0x37')](_0x23c935[_0xdbf3('0x32')][_0xdbf3('0x37')]));_0x2cbbf1['attributes']=_0x2cbbf1['attributes']['length']?_0x2cbbf1['attributes']:_0xf21ee3[_0xdbf3('0x31')];if(!_0x23c935[_0xdbf3('0x32')]['hasOwnProperty'](_0xdbf3('0x38'))){_0x2cbbf1[_0xdbf3('0x21')]=qs[_0xdbf3('0x21')](_0x23c935[_0xdbf3('0x32')]['limit']);_0x2cbbf1['offset']=qs['offset'](_0x23c935['query'][_0xdbf3('0x1f')]);}_0x2cbbf1[_0xdbf3('0x39')]=qs['sort'](_0x23c935['query'][_0xdbf3('0x3a')]);_0x2cbbf1[_0xdbf3('0x3b')]=qs[_0xdbf3('0x34')](_[_0xdbf3('0x3c')](_0x23c935[_0xdbf3('0x32')],_0xf21ee3[_0xdbf3('0x34')]),_0x29f5d8);if(_0x23c935[_0xdbf3('0x32')]['filter']){_0x2cbbf1[_0xdbf3('0x3b')]=_['merge'](_0x2cbbf1['where'],{'$or':_['map'](_0x29f5d8,function(_0x110a87){if(_0x110a87[_0xdbf3('0x30')]!==_0xdbf3('0x3d')){var _0x1f03cb={};_0x1f03cb[_0x110a87[_0xdbf3('0x2c')]]={'$like':'%'+_0x23c935[_0xdbf3('0x32')][_0xdbf3('0x3e')]+'%'};return _0x1f03cb;}})});}_0x2cbbf1=_[_0xdbf3('0x3f')]({},_0x2cbbf1,_0x23c935[_0xdbf3('0x40')]);var _0x4b9974={'where':_0x2cbbf1[_0xdbf3('0x3b')]};return db[_0xdbf3('0x2f')][_0xdbf3('0x22')](_0x4b9974)[_0xdbf3('0x2a')](function(_0x1bdf63){_0x300435['count']=_0x1bdf63;if(_0x23c935[_0xdbf3('0x32')]['includeAll']){_0x2cbbf1[_0xdbf3('0x41')]=[{'all':!![]}];}return db[_0xdbf3('0x2f')][_0xdbf3('0x42')](_0x2cbbf1);})[_0xdbf3('0x2a')](function(_0x3b5203){_0x300435[_0xdbf3('0x43')]=_0x3b5203;return _0x300435;})[_0xdbf3('0x2a')](respondWithFilteredResult(_0x184c61,_0x2cbbf1))['catch'](handleError(_0x184c61,null));};exports[_0xdbf3('0x44')]=function(_0x100ee5,_0x48330c){var _0xfff57b={'raw':![],'where':{'id':_0x100ee5[_0xdbf3('0x45')]['id']}},_0x2080b7={};_0x2080b7[_0xdbf3('0x31')]=_[_0xdbf3('0x33')](db[_0xdbf3('0x2f')][_0xdbf3('0x46')]);_0x2080b7['query']=_[_0xdbf3('0x33')](_0x100ee5[_0xdbf3('0x32')]);_0x2080b7[_0xdbf3('0x34')]=_[_0xdbf3('0x35')](_0x2080b7['model'],_0x2080b7[_0xdbf3('0x32')]);_0xfff57b[_0xdbf3('0x36')]=_[_0xdbf3('0x35')](_0x2080b7['model'],qs[_0xdbf3('0x37')](_0x100ee5[_0xdbf3('0x32')]['fields']));_0xfff57b['attributes']=_0xfff57b[_0xdbf3('0x36')][_0xdbf3('0x47')]?_0xfff57b['attributes']:_0x2080b7['model'];if(_0x100ee5[_0xdbf3('0x32')]['includeAll']){_0xfff57b[_0xdbf3('0x41')]=[{'all':!![]}];}_0xfff57b=_[_0xdbf3('0x3f')]({},_0xfff57b,_0x100ee5[_0xdbf3('0x40')]);return db[_0xdbf3('0x2f')][_0xdbf3('0x48')](_0xfff57b)[_0xdbf3('0x2a')](handleEntityNotFound(_0x48330c,null))['then'](respondWithResult(_0x48330c,null))[_0xdbf3('0x49')](handleError(_0x48330c,null));};exports['create']=function(_0x1f3bf4,_0x41d1c2){return db[_0xdbf3('0x2f')][_0xdbf3('0x4a')](_0x1f3bf4['body'],{})[_0xdbf3('0x2a')](respondWithResult(_0x41d1c2,0xc9))[_0xdbf3('0x49')](handleError(_0x41d1c2,null));};exports[_0xdbf3('0x28')]=function(_0x560ebb,_0x533f65){if(_0x560ebb[_0xdbf3('0x4b')]['id']){delete _0x560ebb[_0xdbf3('0x4b')]['id'];}return db[_0xdbf3('0x2f')]['find']({'where':{'id':_0x560ebb[_0xdbf3('0x45')]['id']}})[_0xdbf3('0x2a')](handleEntityNotFound(_0x533f65,null))[_0xdbf3('0x2a')](saveUpdates(_0x560ebb['body'],null))[_0xdbf3('0x2a')](respondWithResult(_0x533f65,null))[_0xdbf3('0x49')](handleError(_0x533f65,null));};exports[_0xdbf3('0x29')]=function(_0x2952a0,_0x35dc60){return db[_0xdbf3('0x2f')][_0xdbf3('0x48')]({'where':{'id':_0x2952a0['params']['id']}})[_0xdbf3('0x2a')](handleEntityNotFound(_0x35dc60,null))[_0xdbf3('0x2a')](removeEntity(_0x35dc60,null))['catch'](handleError(_0x35dc60,null));};exports['getConfigurations']=function(_0x31bfb1,_0x5be3c8,_0xe11069){var _0x4df70a={};var _0x2a2d19={};var _0x5d490d;var _0x46e8a3;return db['DeskAccount'][_0xdbf3('0x4c')]({'where':{'id':_0x31bfb1[_0xdbf3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5be3c8,null))[_0xdbf3('0x2a')](function(_0x2ff830){if(_0x2ff830){_0x5d490d=_0x2ff830;_0x2a2d19[_0xdbf3('0x31')]=_[_0xdbf3('0x33')](db[_0xdbf3('0x4d')][_0xdbf3('0x46')]);_0x2a2d19[_0xdbf3('0x32')]=_[_0xdbf3('0x33')](_0x31bfb1[_0xdbf3('0x32')]);_0x2a2d19[_0xdbf3('0x34')]=_[_0xdbf3('0x35')](_0x2a2d19[_0xdbf3('0x31')],_0x2a2d19[_0xdbf3('0x32')]);_0x4df70a['attributes']=_['intersection'](_0x2a2d19['model'],qs[_0xdbf3('0x37')](_0x31bfb1['query']['fields']));_0x4df70a[_0xdbf3('0x36')]=_0x4df70a[_0xdbf3('0x36')]['length']?_0x4df70a['attributes']:_0x2a2d19['model'];_0x4df70a['order']=qs[_0xdbf3('0x3a')](_0x31bfb1['query'][_0xdbf3('0x3a')]);_0x4df70a['where']=qs['filters'](_['pick'](_0x31bfb1[_0xdbf3('0x32')],_0x2a2d19[_0xdbf3('0x34')]));if(_0x31bfb1['query']['filter']){_0x4df70a['where']=_[_0xdbf3('0x3f')](_0x4df70a[_0xdbf3('0x3b')],{'$or':_[_0xdbf3('0x2e')](_0x4df70a[_0xdbf3('0x36')],function(_0x40f1f5){var _0x190366={};_0x190366[_0x40f1f5]={'$like':'%'+_0x31bfb1[_0xdbf3('0x32')][_0xdbf3('0x3e')]+'%'};return _0x190366;})});}_0x4df70a=_[_0xdbf3('0x3f')]({},_0x4df70a,_0x31bfb1['options']);return _0x5d490d['getConfigurations'](_0x4df70a);}})['then'](function(_0x7b12db){if(_0x7b12db){_0x46e8a3=_0x7b12db[_0xdbf3('0x47')];if(!_0x31bfb1[_0xdbf3('0x32')][_0xdbf3('0x4e')]('nolimit')){_0x4df70a[_0xdbf3('0x21')]=qs[_0xdbf3('0x21')](_0x31bfb1[_0xdbf3('0x32')][_0xdbf3('0x21')]);_0x4df70a[_0xdbf3('0x1f')]=qs['offset'](_0x31bfb1[_0xdbf3('0x32')][_0xdbf3('0x1f')]);}return _0x5d490d['getConfigurations'](_0x4df70a);}})[_0xdbf3('0x2a')](function(_0x433903){if(_0x433903){return _0x433903?{'count':_0x46e8a3,'rows':_0x433903}:null;}})['then'](respondWithResult(_0x5be3c8,null))[_0xdbf3('0x49')](handleError(_0x5be3c8,null));};exports['addConfiguration']=function(_0xabffe1,_0x5a0390,_0x25da0d){if(_0xabffe1[_0xdbf3('0x4b')]['id']){delete _0xabffe1[_0xdbf3('0x4b')]['id'];}return db['DeskAccount'][_0xdbf3('0x4c')]({'where':{'id':_0xabffe1[_0xdbf3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a0390,null))[_0xdbf3('0x2a')](function(_0x18bcb9){if(_0x18bcb9){_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x4f')]=_0x18bcb9['id'];_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x50')]=integrations[_0xdbf3('0x51')](_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x52')],_0xabffe1[_0xdbf3('0x4b')]['type']);_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x53')]=integrations[_0xdbf3('0x54')](_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x52')],_0xabffe1[_0xdbf3('0x4b')][_0xdbf3('0x30')]);return db[_0xdbf3('0x4d')][_0xdbf3('0x4a')](_0xabffe1[_0xdbf3('0x4b')],{'include':[{'model':db['DeskField'],'as':_0xdbf3('0x50')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xdbf3('0x2a')](respondWithResult(_0x5a0390,null))[_0xdbf3('0x49')](handleError(_0x5a0390,null));};exports[_0xdbf3('0x55')]=function(_0x19a55f,_0x18996e,_0x594a55){var _0x15a1e2=[{'name':_0xdbf3('0x56'),'label':_0xdbf3('0x56'),'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 _0x51973e='';return db[_0xdbf3('0x2f')][_0xdbf3('0x4c')]({'where':{'id':_0x19a55f[_0xdbf3('0x45')]['id']},'attributes':['id',_0xdbf3('0x57'),_0xdbf3('0x58'),_0xdbf3('0x59'),'password','consumerKey','consumerSecret','token',_0xdbf3('0x5a')]})[_0xdbf3('0x2a')](handleEntityNotFound(_0x18996e,null))[_0xdbf3('0x2a')](function(_0x204483){if(_0x204483){_0x51973e=_0x204483['remoteUri'];var _0xc5484b=_0x51973e[_0xdbf3('0x5b')](-0x1);if(_0xc5484b==='/'){_0x51973e=_0x51973e[_0xdbf3('0x5c')](0x0,_0x51973e[_0xdbf3('0x5d')](_0xc5484b));}var _0x46a7e3={'method':_0xdbf3('0x5e'),'uri':util[_0xdbf3('0x5f')](_0xdbf3('0x60'),_0x51973e),'headers':{'Content-Type':'application/json','Accept':_0xdbf3('0x61')},'json':!![]};if(_0x204483[_0xdbf3('0x58')]===_0xdbf3('0x62')){_0x46a7e3[_0xdbf3('0x63')][_0xdbf3('0x64')]=util[_0xdbf3('0x5f')](_0xdbf3('0x65'),new Buffer(util[_0xdbf3('0x5f')](_0xdbf3('0x66'),_0x204483[_0xdbf3('0x59')],_0x204483[_0xdbf3('0x67')]))[_0xdbf3('0x68')](_0xdbf3('0x69')));}return rp(_0x46a7e3)[_0xdbf3('0x2a')](function(_0x2414db){return _0x15a1e2[_0xdbf3('0x6a')](_[_0xdbf3('0x2e')](_0x2414db[_0xdbf3('0x6b')][_0xdbf3('0x6c')],function(_0x4ca91b){return{'id':_0x4ca91b[_0xdbf3('0x2c')],'name':_0x4ca91b[_0xdbf3('0x2c')],'type':_0x4ca91b[_0xdbf3('0x30')],'active':_0x4ca91b[_0xdbf3('0x6d')],'label':_0x4ca91b[_0xdbf3('0x6e')],'custom':!![]};}));});}})['then'](function(_0x349b79){return{'count':_0x349b79[_0xdbf3('0x47')],'rows':_0x349b79};})[_0xdbf3('0x2a')](respondWithResult(_0x18996e,null))[_0xdbf3('0x49')](function(_0x5d99b6){var _0x63eaa=_0x19a55f[_0xdbf3('0x32')]['test']?0x1f4:_0x5d99b6[_0xdbf3('0x6f')]||0x1f4;logger[_0xdbf3('0x70')](_0xdbf3('0x71'),_0xdbf3('0x55'),_0x63eaa,JSON[_0xdbf3('0x72')](_0x5d99b6));delete _0x5d99b6[_0xdbf3('0x2c')];if(_0x63eaa===0x191){_0x63eaa=0x190;}_0x18996e['status'](_0x63eaa)['send'](_0x19a55f[_0xdbf3('0x32')][_0xdbf3('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5d99b6['statusCode']}:_0x5d99b6);});}; \ No newline at end of file +var _0x9b5c=['end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','catch','create','body','find','getConfigurations','findOne','DeskConfiguration','order','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','remoteUri','username','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x73ec2c,_0x397d36){var _0x24304d=function(_0xf4487){while(--_0xf4487){_0x73ec2c['push'](_0x73ec2c['shift']());}};_0x24304d(++_0x397d36);}(_0x9b5c,0x193));var _0xc9b5=function(_0x5f2f93,_0x1d772b){_0x5f2f93=_0x5f2f93-0x0;var _0x2a3d1b=_0x9b5c[_0x5f2f93];return _0x2a3d1b;};'use strict';var emlformat=require(_0xc9b5('0x0'));var rimraf=require(_0xc9b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9b5('0x2'));var rp=require(_0xc9b5('0x3'));var moment=require(_0xc9b5('0x4'));var BPromise=require(_0xc9b5('0x5'));var Mustache=require(_0xc9b5('0x6'));var util=require(_0xc9b5('0x7'));var path=require(_0xc9b5('0x8'));var sox=require('sox');var csv=require(_0xc9b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9b5('0xa'));var _=require('lodash');var squel=require(_0xc9b5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9b5('0xc'));var toCsv=require(_0xc9b5('0x9'));var querystring=require(_0xc9b5('0xd'));var Papa=require('papaparse');var Redis=require(_0xc9b5('0xe'));var authService=require(_0xc9b5('0xf'));var qs=require(_0xc9b5('0x10'));var as=require(_0xc9b5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9b5('0x12'))(_0xc9b5('0x13'));var utils=require(_0xc9b5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc9b5('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc9b5('0x16'));function respondWithStatusCode(_0x583221,_0x12d75d){_0x12d75d=_0x12d75d||0xcc;return function(_0x8b979b){if(_0x8b979b){return _0x583221[_0xc9b5('0x17')](_0x12d75d);}return _0x583221[_0xc9b5('0x18')](_0x12d75d)[_0xc9b5('0x19')]();};}function respondWithResult(_0x337258,_0x7dd9ac){_0x7dd9ac=_0x7dd9ac||0xc8;return function(_0x457a51){if(_0x457a51){return _0x337258['status'](_0x7dd9ac)['json'](_0x457a51);}};}function respondWithFilteredResult(_0x12a212,_0x39d6db){return function(_0x3f696a){if(_0x3f696a){var _0x467bb9=typeof _0x39d6db[_0xc9b5('0x1a')]===_0xc9b5('0x1b')&&typeof _0x39d6db[_0xc9b5('0x1c')]===_0xc9b5('0x1b');var _0x41d266=_0x3f696a[_0xc9b5('0x1d')];var _0x5b3dd3=_0x467bb9?0x0:_0x39d6db[_0xc9b5('0x1a')];var _0x56d778=_0x467bb9?_0x3f696a['count']:_0x39d6db['offset']+_0x39d6db[_0xc9b5('0x1c')];var _0x10505e;if(_0x56d778>=_0x41d266){_0x56d778=_0x41d266;_0x10505e=0xc8;}else{_0x10505e=0xce;}_0x12a212[_0xc9b5('0x18')](_0x10505e);return _0x12a212['set'](_0xc9b5('0x1e'),_0x5b3dd3+'-'+_0x56d778+'/'+_0x41d266)[_0xc9b5('0x1f')](_0x3f696a);}return null;};}function patchUpdates(_0x2c662f){return function(_0x2e5c41){try{jsonpatch[_0xc9b5('0x20')](_0x2e5c41,_0x2c662f,!![]);}catch(_0x21bfbb){return BPromise[_0xc9b5('0x21')](_0x21bfbb);}return _0x2e5c41['save']();};}function saveUpdates(_0x213099,_0x2fec88){return function(_0x569a90){if(_0x569a90){return _0x569a90[_0xc9b5('0x22')](_0x213099)[_0xc9b5('0x23')](function(_0x2fa53b){return _0x2fa53b;});}return null;};}function removeEntity(_0x52dd8f,_0x448449){return function(_0x25f7b6){if(_0x25f7b6){return _0x25f7b6[_0xc9b5('0x24')]()[_0xc9b5('0x23')](function(){_0x52dd8f[_0xc9b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c57fe,_0x1897b0){return function(_0x10d44f){if(!_0x10d44f){_0x5c57fe[_0xc9b5('0x17')](0x194);}return _0x10d44f;};}function handleError(_0x434db6,_0x47415d){_0x47415d=_0x47415d||0x1f4;return function(_0x1944e6){logger['error'](_0x1944e6[_0xc9b5('0x25')]);if(_0x1944e6[_0xc9b5('0x26')]){delete _0x1944e6['name'];}_0x434db6[_0xc9b5('0x18')](_0x47415d)[_0xc9b5('0x27')](_0x1944e6);};}exports['index']=function(_0x55a4bb,_0x3ad83a){var _0x22678b={},_0x289a8d={},_0x42d184={'count':0x0,'rows':[]};var _0x504203=_['map'](db[_0xc9b5('0x28')][_0xc9b5('0x29')],function(_0x31df14){return{'name':_0x31df14[_0xc9b5('0x2a')],'type':_0x31df14[_0xc9b5('0x2b')]['key']};});_0x289a8d[_0xc9b5('0x2c')]=_['map'](_0x504203,_0xc9b5('0x26'));_0x289a8d[_0xc9b5('0x2d')]=_[_0xc9b5('0x2e')](_0x55a4bb['query']);_0x289a8d[_0xc9b5('0x2f')]=_[_0xc9b5('0x30')](_0x289a8d[_0xc9b5('0x2c')],_0x289a8d['query']);_0x22678b['attributes']=_['intersection'](_0x289a8d[_0xc9b5('0x2c')],qs['fields'](_0x55a4bb['query'][_0xc9b5('0x31')]));_0x22678b['attributes']=_0x22678b[_0xc9b5('0x32')]['length']?_0x22678b[_0xc9b5('0x32')]:_0x289a8d[_0xc9b5('0x2c')];if(!_0x55a4bb[_0xc9b5('0x2d')][_0xc9b5('0x33')]('nolimit')){_0x22678b[_0xc9b5('0x1c')]=qs[_0xc9b5('0x1c')](_0x55a4bb[_0xc9b5('0x2d')]['limit']);_0x22678b[_0xc9b5('0x1a')]=qs[_0xc9b5('0x1a')](_0x55a4bb[_0xc9b5('0x2d')][_0xc9b5('0x1a')]);}_0x22678b['order']=qs[_0xc9b5('0x34')](_0x55a4bb[_0xc9b5('0x2d')][_0xc9b5('0x34')]);_0x22678b[_0xc9b5('0x35')]=qs['filters'](_['pick'](_0x55a4bb['query'],_0x289a8d['filters']),_0x504203);if(_0x55a4bb['query'][_0xc9b5('0x36')]){_0x22678b[_0xc9b5('0x35')]=_['merge'](_0x22678b[_0xc9b5('0x35')],{'$or':_[_0xc9b5('0x37')](_0x504203,function(_0x3300f9){if(_0x3300f9[_0xc9b5('0x2b')]!==_0xc9b5('0x38')){var _0x522e20={};_0x522e20[_0x3300f9['name']]={'$like':'%'+_0x55a4bb['query'][_0xc9b5('0x36')]+'%'};return _0x522e20;}})});}_0x22678b=_[_0xc9b5('0x39')]({},_0x22678b,_0x55a4bb[_0xc9b5('0x3a')]);var _0x504547={'where':_0x22678b[_0xc9b5('0x35')]};return db['DeskAccount'][_0xc9b5('0x1d')](_0x504547)[_0xc9b5('0x23')](function(_0x5845f0){_0x42d184['count']=_0x5845f0;if(_0x55a4bb[_0xc9b5('0x2d')][_0xc9b5('0x3b')]){_0x22678b['include']=[{'all':!![]}];}return db[_0xc9b5('0x28')][_0xc9b5('0x3c')](_0x22678b);})[_0xc9b5('0x23')](function(_0x3c3d09){_0x42d184[_0xc9b5('0x3d')]=_0x3c3d09;return _0x42d184;})['then'](respondWithFilteredResult(_0x3ad83a,_0x22678b))['catch'](handleError(_0x3ad83a,null));};exports[_0xc9b5('0x3e')]=function(_0x2037d7,_0x9e7b7a){var _0x38c009={'raw':![],'where':{'id':_0x2037d7[_0xc9b5('0x3f')]['id']}},_0x279fa6={};_0x279fa6[_0xc9b5('0x2c')]=_[_0xc9b5('0x2e')](db['DeskAccount'][_0xc9b5('0x29')]);_0x279fa6[_0xc9b5('0x2d')]=_[_0xc9b5('0x2e')](_0x2037d7[_0xc9b5('0x2d')]);_0x279fa6[_0xc9b5('0x2f')]=_[_0xc9b5('0x30')](_0x279fa6[_0xc9b5('0x2c')],_0x279fa6[_0xc9b5('0x2d')]);_0x38c009['attributes']=_['intersection'](_0x279fa6['model'],qs['fields'](_0x2037d7[_0xc9b5('0x2d')]['fields']));_0x38c009[_0xc9b5('0x32')]=_0x38c009[_0xc9b5('0x32')][_0xc9b5('0x40')]?_0x38c009[_0xc9b5('0x32')]:_0x279fa6['model'];if(_0x2037d7[_0xc9b5('0x2d')][_0xc9b5('0x3b')]){_0x38c009['include']=[{'all':!![]}];}_0x38c009=_['merge']({},_0x38c009,_0x2037d7['options']);return db[_0xc9b5('0x28')]['find'](_0x38c009)['then'](handleEntityNotFound(_0x9e7b7a,null))[_0xc9b5('0x23')](respondWithResult(_0x9e7b7a,null))[_0xc9b5('0x41')](handleError(_0x9e7b7a,null));};exports[_0xc9b5('0x42')]=function(_0x5df42c,_0x15294d){return db[_0xc9b5('0x28')][_0xc9b5('0x42')](_0x5df42c[_0xc9b5('0x43')],{})[_0xc9b5('0x23')](respondWithResult(_0x15294d,0xc9))[_0xc9b5('0x41')](handleError(_0x15294d,null));};exports['update']=function(_0x5d3ef3,_0x59fc54){if(_0x5d3ef3[_0xc9b5('0x43')]['id']){delete _0x5d3ef3[_0xc9b5('0x43')]['id'];}return db[_0xc9b5('0x28')][_0xc9b5('0x44')]({'where':{'id':_0x5d3ef3[_0xc9b5('0x3f')]['id']}})[_0xc9b5('0x23')](handleEntityNotFound(_0x59fc54,null))[_0xc9b5('0x23')](saveUpdates(_0x5d3ef3[_0xc9b5('0x43')],null))[_0xc9b5('0x23')](respondWithResult(_0x59fc54,null))[_0xc9b5('0x41')](handleError(_0x59fc54,null));};exports[_0xc9b5('0x24')]=function(_0x1758ed,_0x1b31aa){return db[_0xc9b5('0x28')][_0xc9b5('0x44')]({'where':{'id':_0x1758ed['params']['id']}})['then'](handleEntityNotFound(_0x1b31aa,null))[_0xc9b5('0x23')](removeEntity(_0x1b31aa,null))[_0xc9b5('0x41')](handleError(_0x1b31aa,null));};exports[_0xc9b5('0x45')]=function(_0x338e78,_0x361064,_0x3d3706){var _0x1119e5={};var _0x1e4c59={};var _0x4e1e67;var _0x4caf26;return db[_0xc9b5('0x28')][_0xc9b5('0x46')]({'where':{'id':_0x338e78[_0xc9b5('0x3f')]['id']}})[_0xc9b5('0x23')](handleEntityNotFound(_0x361064,null))[_0xc9b5('0x23')](function(_0x306867){if(_0x306867){_0x4e1e67=_0x306867;_0x1e4c59[_0xc9b5('0x2c')]=_[_0xc9b5('0x2e')](db[_0xc9b5('0x47')][_0xc9b5('0x29')]);_0x1e4c59['query']=_[_0xc9b5('0x2e')](_0x338e78[_0xc9b5('0x2d')]);_0x1e4c59[_0xc9b5('0x2f')]=_['intersection'](_0x1e4c59['model'],_0x1e4c59[_0xc9b5('0x2d')]);_0x1119e5[_0xc9b5('0x32')]=_[_0xc9b5('0x30')](_0x1e4c59[_0xc9b5('0x2c')],qs[_0xc9b5('0x31')](_0x338e78['query'][_0xc9b5('0x31')]));_0x1119e5['attributes']=_0x1119e5[_0xc9b5('0x32')]['length']?_0x1119e5[_0xc9b5('0x32')]:_0x1e4c59[_0xc9b5('0x2c')];_0x1119e5[_0xc9b5('0x48')]=qs[_0xc9b5('0x34')](_0x338e78['query'][_0xc9b5('0x34')]);_0x1119e5[_0xc9b5('0x35')]=qs[_0xc9b5('0x2f')](_['pick'](_0x338e78['query'],_0x1e4c59['filters']));if(_0x338e78[_0xc9b5('0x2d')]['filter']){_0x1119e5[_0xc9b5('0x35')]=_[_0xc9b5('0x39')](_0x1119e5[_0xc9b5('0x35')],{'$or':_[_0xc9b5('0x37')](_0x1119e5[_0xc9b5('0x32')],function(_0x2c355f){var _0x14d02d={};_0x14d02d[_0x2c355f]={'$like':'%'+_0x338e78['query'][_0xc9b5('0x36')]+'%'};return _0x14d02d;})});}_0x1119e5=_[_0xc9b5('0x39')]({},_0x1119e5,_0x338e78['options']);return _0x4e1e67[_0xc9b5('0x45')](_0x1119e5);}})['then'](function(_0x53e561){if(_0x53e561){_0x4caf26=_0x53e561[_0xc9b5('0x40')];if(!_0x338e78[_0xc9b5('0x2d')][_0xc9b5('0x33')](_0xc9b5('0x49'))){_0x1119e5[_0xc9b5('0x1c')]=qs[_0xc9b5('0x1c')](_0x338e78[_0xc9b5('0x2d')]['limit']);_0x1119e5[_0xc9b5('0x1a')]=qs[_0xc9b5('0x1a')](_0x338e78['query'][_0xc9b5('0x1a')]);}return _0x4e1e67[_0xc9b5('0x45')](_0x1119e5);}})[_0xc9b5('0x23')](function(_0x1b8651){if(_0x1b8651){return _0x1b8651?{'count':_0x4caf26,'rows':_0x1b8651}:null;}})[_0xc9b5('0x23')](respondWithResult(_0x361064,null))['catch'](handleError(_0x361064,null));};exports[_0xc9b5('0x4a')]=function(_0x14d707,_0x3fc8ae,_0x44fdf8){if(_0x14d707['body']['id']){delete _0x14d707[_0xc9b5('0x43')]['id'];}return db['DeskAccount'][_0xc9b5('0x46')]({'where':{'id':_0x14d707['params']['id']}})[_0xc9b5('0x23')](handleEntityNotFound(_0x3fc8ae,null))[_0xc9b5('0x23')](function(_0x549b54){if(_0x549b54){_0x14d707[_0xc9b5('0x43')]['AccountId']=_0x549b54['id'];_0x14d707[_0xc9b5('0x43')][_0xc9b5('0x4b')]=integrations['getSubjects'](_0x14d707[_0xc9b5('0x43')][_0xc9b5('0x4c')],_0x14d707[_0xc9b5('0x43')][_0xc9b5('0x2b')]);_0x14d707[_0xc9b5('0x43')][_0xc9b5('0x4d')]=integrations[_0xc9b5('0x4e')](_0x14d707['body'][_0xc9b5('0x4c')],_0x14d707['body'][_0xc9b5('0x2b')]);return db[_0xc9b5('0x47')][_0xc9b5('0x42')](_0x14d707[_0xc9b5('0x43')],{'include':[{'model':db[_0xc9b5('0x4f')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xc9b5('0x23')](respondWithResult(_0x3fc8ae,null))[_0xc9b5('0x41')](handleError(_0x3fc8ae,null));};exports[_0xc9b5('0x50')]=function(_0xd88688,_0x3910f5,_0x2ba5f3){var _0x4ab1bf=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3d2d62='';return db['DeskAccount'][_0xc9b5('0x46')]({'where':{'id':_0xd88688[_0xc9b5('0x3f')]['id']},'attributes':['id',_0xc9b5('0x51'),'authType',_0xc9b5('0x52'),'password','consumerKey',_0xc9b5('0x53'),'token',_0xc9b5('0x54')]})[_0xc9b5('0x23')](handleEntityNotFound(_0x3910f5,null))['then'](function(_0x1adbd2){if(_0x1adbd2){_0x3d2d62=_0x1adbd2[_0xc9b5('0x51')];var _0x3e2f11=_0x3d2d62[_0xc9b5('0x55')](-0x1);if(_0x3e2f11==='/'){_0x3d2d62=_0x3d2d62[_0xc9b5('0x56')](0x0,_0x3d2d62[_0xc9b5('0x57')](_0x3e2f11));}var _0x425b58={'method':_0xc9b5('0x58'),'uri':util[_0xc9b5('0x59')](_0xc9b5('0x5a'),_0x3d2d62),'headers':{'Content-Type':_0xc9b5('0x5b'),'Accept':'application/json'},'json':!![]};if(_0x1adbd2['authType']===_0xc9b5('0x5c')){_0x425b58['headers']['Authorization']=util[_0xc9b5('0x59')](_0xc9b5('0x5d'),new Buffer(util[_0xc9b5('0x59')](_0xc9b5('0x5e'),_0x1adbd2[_0xc9b5('0x52')],_0x1adbd2[_0xc9b5('0x5f')]))[_0xc9b5('0x60')]('base64'));}return rp(_0x425b58)[_0xc9b5('0x23')](function(_0x152a22){return _0x4ab1bf[_0xc9b5('0x61')](_[_0xc9b5('0x37')](_0x152a22[_0xc9b5('0x62')][_0xc9b5('0x63')],function(_0x10a282){return{'id':_0x10a282[_0xc9b5('0x26')],'name':_0x10a282[_0xc9b5('0x26')],'type':_0x10a282['type'],'active':_0x10a282[_0xc9b5('0x64')],'label':_0x10a282['label'],'custom':!![]};}));});}})[_0xc9b5('0x23')](function(_0x151d1c){return{'count':_0x151d1c[_0xc9b5('0x40')],'rows':_0x151d1c};})['then'](respondWithResult(_0x3910f5,null))[_0xc9b5('0x41')](function(_0xf545fd){var _0x65c124=_0xd88688[_0xc9b5('0x2d')]['test']?0x1f4:_0xf545fd[_0xc9b5('0x65')]||0x1f4;logger[_0xc9b5('0x66')](_0xc9b5('0x67'),'getFields',_0x65c124,JSON[_0xc9b5('0x68')](_0xf545fd));delete _0xf545fd[_0xc9b5('0x26')];if(_0x65c124===0x191){_0x65c124=0x190;}_0x3910f5[_0xc9b5('0x18')](_0x65c124)[_0xc9b5('0x27')](_0xd88688[_0xc9b5('0x2d')][_0xc9b5('0x69')]?{'message':_0xc9b5('0x6a'),'statusCode':_0xf545fd[_0xc9b5('0x65')]}:_0xf545fd);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 48852a3..03b6aa7 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 _0xbe71=['../../config/logger','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','util'];(function(_0x1ddd3f,_0x423825){var _0x1621eb=function(_0x13b858){while(--_0x13b858){_0x1ddd3f['push'](_0x1ddd3f['shift']());}};_0x1621eb(++_0x423825);}(_0xbe71,0x97));var _0x1be7=function(_0x257f0f,_0x5ed168){_0x257f0f=_0x257f0f-0x0;var _0x3fcaee=_0xbe71[_0x257f0f];return _0x3fcaee;};'use strict';var _=require('lodash');var util=require(_0x1be7('0x0'));var logger=require(_0x1be7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1be7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1be7('0x3'));var attributes=require(_0x1be7('0x4'));var integrations=require(_0x1be7('0x5'));module[_0x1be7('0x6')]=function(_0x2dc64b,_0x267219){return _0x2dc64b[_0x1be7('0x7')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfc5=['bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports','DeskAccount','api','moment'];(function(_0x40da8f,_0x5ea1cc){var _0x5aa751=function(_0x3ded4a){while(--_0x3ded4a){_0x40da8f['push'](_0x40da8f['shift']());}};_0x5aa751(++_0x5ea1cc);}(_0xcfc5,0x1a5));var _0x5cfc=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xcfc5[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5cfc('0x0'));var moment=require(_0x5cfc('0x1'));var BPromise=require(_0x5cfc('0x2'));var rp=require(_0x5cfc('0x3'));var fs=require('fs');var path=require(_0x5cfc('0x4'));var rimraf=require(_0x5cfc('0x5'));var config=require('../../config/environment');var attributes=require(_0x5cfc('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5cfc('0x7')]=function(_0x70ad19,_0x52eea4){return _0x70ad19['define'](_0x5cfc('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 16c6f3c..15cd825 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 _0x0877=['error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0877,0xd6));var _0x7087=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x0877[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0x7087('0x0'));var util=require('util');var moment=require(_0x7087('0x1'));var BPromise=require(_0x7087('0x2'));var rs=require(_0x7087('0x3'));var fs=require('fs');var Redis=require(_0x7087('0x4'));var db=require(_0x7087('0x5'))['db'];var utils=require(_0x7087('0x6'));var logger=require(_0x7087('0x7'))(_0x7087('0x8'));var config=require(_0x7087('0x9'));var jayson=require(_0x7087('0xa'));var client=jayson[_0x7087('0xb')][_0x7087('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf33047,_0x20625d,_0x18cb75){return new BPromise(function(_0x15dfc1,_0x1c8ff5){return client[_0x7087('0xd')](_0xf33047,_0x18cb75)['then'](function(_0x5e4936){logger[_0x7087('0xe')]('DeskAccount,\x20%s,\x20%s',_0x20625d,'request\x20sent');logger[_0x7087('0xf')](_0x7087('0x10'),_0x20625d,_0x7087('0x11'),JSON[_0x7087('0x12')](_0x5e4936));if(_0x5e4936['error']){if(_0x5e4936['error'][_0x7087('0x13')]===0x1f4){logger[_0x7087('0x14')](_0x7087('0x15'),_0x20625d,_0x5e4936['error'][_0x7087('0x16')]);return _0x1c8ff5(_0x5e4936['error'][_0x7087('0x16')]);}logger[_0x7087('0x14')](_0x7087('0x15'),_0x20625d,_0x5e4936[_0x7087('0x14')]['message']);return _0x15dfc1(_0x5e4936[_0x7087('0x14')][_0x7087('0x16')]);}else{logger['info'](_0x7087('0x15'),_0x20625d,_0x7087('0x11'));_0x15dfc1(_0x5e4936[_0x7087('0x17')][_0x7087('0x16')]);}})[_0x7087('0x18')](function(_0x1938e8){logger[_0x7087('0x14')](_0x7087('0x15'),_0x20625d,_0x1938e8);_0x1c8ff5(_0x1938e8);});});}exports[_0x7087('0x19')]=function(_0x5aa755){var _0x1f3060=this;return new Promise(function(_0x36438f,_0x2f9da5){return db[_0x7087('0x1a')][_0x7087('0x1b')]({'raw':_0x5aa755[_0x7087('0x1c')]?_0x5aa755[_0x7087('0x1c')][_0x7087('0x1d')]===undefined?!![]:![]:!![],'where':_0x5aa755['options']?_0x5aa755[_0x7087('0x1c')][_0x7087('0x1e')]||null:null,'attributes':_0x5aa755[_0x7087('0x1c')]?_0x5aa755[_0x7087('0x1c')][_0x7087('0x1f')]||null:null,'limit':_0x5aa755[_0x7087('0x1c')]?_0x5aa755[_0x7087('0x1c')][_0x7087('0x20')]||null:null,'include':_0x5aa755['options']?_0x5aa755[_0x7087('0x1c')][_0x7087('0x21')]?_[_0x7087('0x22')](_0x5aa755[_0x7087('0x1c')][_0x7087('0x21')],function(_0x3d82c9){return{'model':db[_0x3d82c9[_0x7087('0x23')]],'as':_0x3d82c9['as'],'attributes':_0x3d82c9[_0x7087('0x1f')],'include':_0x3d82c9['include']?_[_0x7087('0x22')](_0x3d82c9[_0x7087('0x21')],function(_0x176ebe){return{'model':db[_0x176ebe[_0x7087('0x23')]],'as':_0x176ebe['as'],'attributes':_0x176ebe[_0x7087('0x1f')],'include':_0x176ebe[_0x7087('0x21')]?_[_0x7087('0x22')](_0x176ebe[_0x7087('0x21')],function(_0x98b1a8){return{'model':db[_0x98b1a8['model']],'as':_0x98b1a8['as'],'attributes':_0x98b1a8[_0x7087('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7087('0x24')](function(_0x34beca){logger[_0x7087('0xe')](_0x7087('0x19'),_0x5aa755);logger[_0x7087('0xf')](_0x7087('0x19'),_0x5aa755,JSON[_0x7087('0x12')](_0x34beca));_0x36438f(_0x34beca);})[_0x7087('0x18')](function(_0x1e1355){logger['error'](_0x7087('0x19'),_0x1e1355[_0x7087('0x16')],_0x5aa755);_0x2f9da5(_0x1f3060['error'](0x1f4,_0x1e1355[_0x7087('0x16')]));});});};exports[_0x7087('0x25')]=function(_0x3b2d46){var _0x20759f=this;return new Promise(function(_0x55eb76,_0x477e91){return db['DeskAccount'][_0x7087('0x26')]({'raw':_0x3b2d46['options']?_0x3b2d46['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b2d46[_0x7087('0x1c')]?_0x3b2d46[_0x7087('0x1c')][_0x7087('0x1e')]||null:null,'attributes':_0x3b2d46[_0x7087('0x1c')]?_0x3b2d46[_0x7087('0x1c')]['attributes']||null:null,'include':_0x3b2d46[_0x7087('0x1c')]?_0x3b2d46[_0x7087('0x1c')]['include']?_[_0x7087('0x22')](_0x3b2d46['options'][_0x7087('0x21')],function(_0x22bbad){return{'model':db[_0x22bbad[_0x7087('0x23')]],'as':_0x22bbad['as'],'attributes':_0x22bbad[_0x7087('0x1f')],'include':_0x22bbad[_0x7087('0x21')]?_[_0x7087('0x22')](_0x22bbad[_0x7087('0x21')],function(_0x508c58){return{'model':db[_0x508c58[_0x7087('0x23')]],'as':_0x508c58['as'],'attributes':_0x508c58['attributes'],'include':_0x508c58[_0x7087('0x21')]?_[_0x7087('0x22')](_0x508c58['include'],function(_0x18761f){return{'model':db[_0x18761f[_0x7087('0x23')]],'as':_0x18761f['as'],'attributes':_0x18761f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7087('0x24')](function(_0x458535){logger[_0x7087('0xe')](_0x7087('0x25'),_0x3b2d46);logger['debug']('ShowDeskAccount',_0x3b2d46,JSON[_0x7087('0x12')](_0x458535));_0x55eb76(_0x458535);})[_0x7087('0x18')](function(_0x3e8f1e){logger[_0x7087('0x14')](_0x7087('0x25'),_0x3e8f1e['message'],_0x3b2d46);_0x477e91(_0x20759f['error'](0x1f4,_0x3e8f1e[_0x7087('0x16')]));});});}; \ No newline at end of file +var _0xaa25=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','debug','find','then','ShowDeskAccount','lodash','util','randomstring'];(function(_0x3ea38e,_0x12ff2b){var _0xcd934e=function(_0x3f8ab7){while(--_0x3f8ab7){_0x3ea38e['push'](_0x3ea38e['shift']());}};_0xcd934e(++_0x12ff2b);}(_0xaa25,0x1cd));var _0x5aa2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xaa25[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x5aa2('0x0'));var util=require(_0x5aa2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5aa2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5aa2('0x3'));var logger=require(_0x5aa2('0x4'))('rpc');var config=require(_0x5aa2('0x5'));var jayson=require(_0x5aa2('0x6'));var client=jayson['client'][_0x5aa2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x761561,_0x32297b,_0x47b6cf){return new BPromise(function(_0x4f99e6,_0x2fb1c9){return client[_0x5aa2('0x8')](_0x761561,_0x47b6cf)['then'](function(_0x1244d8){logger[_0x5aa2('0x9')](_0x5aa2('0xa'),_0x32297b,_0x5aa2('0xb'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x32297b,_0x5aa2('0xb'),JSON['stringify'](_0x1244d8));if(_0x1244d8[_0x5aa2('0xc')]){if(_0x1244d8[_0x5aa2('0xc')][_0x5aa2('0xd')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x32297b,_0x1244d8['error']['message']);return _0x2fb1c9(_0x1244d8['error'][_0x5aa2('0xe')]);}logger[_0x5aa2('0xc')](_0x5aa2('0xa'),_0x32297b,_0x1244d8[_0x5aa2('0xc')][_0x5aa2('0xe')]);return _0x4f99e6(_0x1244d8[_0x5aa2('0xc')]['message']);}else{logger[_0x5aa2('0x9')](_0x5aa2('0xa'),_0x32297b,'request\x20sent');_0x4f99e6(_0x1244d8['result'][_0x5aa2('0xe')]);}})[_0x5aa2('0xf')](function(_0x3ae964){logger[_0x5aa2('0xc')](_0x5aa2('0xa'),_0x32297b,_0x3ae964);_0x2fb1c9(_0x3ae964);});});}exports[_0x5aa2('0x10')]=function(_0x356018){var _0x390371=this;return new Promise(function(_0x4e9322,_0x137f31){return db[_0x5aa2('0x11')]['findAll']({'raw':_0x356018[_0x5aa2('0x12')]?_0x356018[_0x5aa2('0x12')][_0x5aa2('0x13')]===undefined?!![]:![]:!![],'where':_0x356018[_0x5aa2('0x12')]?_0x356018['options'][_0x5aa2('0x14')]||null:null,'attributes':_0x356018[_0x5aa2('0x12')]?_0x356018[_0x5aa2('0x12')][_0x5aa2('0x15')]||null:null,'limit':_0x356018[_0x5aa2('0x12')]?_0x356018[_0x5aa2('0x12')]['limit']||null:null,'include':_0x356018['options']?_0x356018[_0x5aa2('0x12')][_0x5aa2('0x16')]?_[_0x5aa2('0x17')](_0x356018[_0x5aa2('0x12')][_0x5aa2('0x16')],function(_0x5501e0){return{'model':db[_0x5501e0[_0x5aa2('0x18')]],'as':_0x5501e0['as'],'attributes':_0x5501e0['attributes'],'include':_0x5501e0['include']?_[_0x5aa2('0x17')](_0x5501e0[_0x5aa2('0x16')],function(_0x3f5a66){return{'model':db[_0x3f5a66[_0x5aa2('0x18')]],'as':_0x3f5a66['as'],'attributes':_0x3f5a66[_0x5aa2('0x15')],'include':_0x3f5a66[_0x5aa2('0x16')]?_['map'](_0x3f5a66[_0x5aa2('0x16')],function(_0x30f405){return{'model':db[_0x30f405[_0x5aa2('0x18')]],'as':_0x30f405['as'],'attributes':_0x30f405[_0x5aa2('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1542e0){logger[_0x5aa2('0x9')]('GetDeskAccount',_0x356018);logger[_0x5aa2('0x19')](_0x5aa2('0x10'),_0x356018,JSON['stringify'](_0x1542e0));_0x4e9322(_0x1542e0);})[_0x5aa2('0xf')](function(_0xac9b96){logger[_0x5aa2('0xc')](_0x5aa2('0x10'),_0xac9b96[_0x5aa2('0xe')],_0x356018);_0x137f31(_0x390371[_0x5aa2('0xc')](0x1f4,_0xac9b96[_0x5aa2('0xe')]));});});};exports['ShowDeskAccount']=function(_0x3549e8){var _0x250e68=this;return new Promise(function(_0x52dca9,_0x4d3b11){return db[_0x5aa2('0x11')][_0x5aa2('0x1a')]({'raw':_0x3549e8[_0x5aa2('0x12')]?_0x3549e8['options'][_0x5aa2('0x13')]===undefined?!![]:![]:!![],'where':_0x3549e8[_0x5aa2('0x12')]?_0x3549e8[_0x5aa2('0x12')][_0x5aa2('0x14')]||null:null,'attributes':_0x3549e8[_0x5aa2('0x12')]?_0x3549e8[_0x5aa2('0x12')][_0x5aa2('0x15')]||null:null,'include':_0x3549e8[_0x5aa2('0x12')]?_0x3549e8[_0x5aa2('0x12')][_0x5aa2('0x16')]?_['map'](_0x3549e8[_0x5aa2('0x12')][_0x5aa2('0x16')],function(_0x2ef105){return{'model':db[_0x2ef105[_0x5aa2('0x18')]],'as':_0x2ef105['as'],'attributes':_0x2ef105['attributes'],'include':_0x2ef105[_0x5aa2('0x16')]?_['map'](_0x2ef105[_0x5aa2('0x16')],function(_0x83c1c9){return{'model':db[_0x83c1c9[_0x5aa2('0x18')]],'as':_0x83c1c9['as'],'attributes':_0x83c1c9[_0x5aa2('0x15')],'include':_0x83c1c9['include']?_[_0x5aa2('0x17')](_0x83c1c9[_0x5aa2('0x16')],function(_0x31e562){return{'model':db[_0x31e562[_0x5aa2('0x18')]],'as':_0x31e562['as'],'attributes':_0x31e562[_0x5aa2('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5aa2('0x1b')](function(_0x4807de){logger[_0x5aa2('0x9')](_0x5aa2('0x1c'),_0x3549e8);logger[_0x5aa2('0x19')](_0x5aa2('0x1c'),_0x3549e8,JSON['stringify'](_0x4807de));_0x52dca9(_0x4807de);})[_0x5aa2('0xf')](function(_0x2e3172){logger[_0x5aa2('0xc')](_0x5aa2('0x1c'),_0x2e3172[_0x5aa2('0xe')],_0x3549e8);_0x4d3b11(_0x250e68[_0x5aa2('0xc')](0x1f4,_0x2e3172[_0x5aa2('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cd3394f..83bdfc9 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x59701b,_0x41c78b){var _0x3cfc4a=function(_0x4762d3){while(--_0x4762d3){_0x59701b['push'](_0x59701b['shift']());}};_0x3cfc4a(++_0x41c78b);}(_0x34e8,0x12c));var _0x834e=function(_0x208d76,_0x31544d){_0x208d76=_0x208d76-0x0;var _0x39572c=_0x34e8[_0x208d76];return _0x39572c;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x37f79c,_0x38f023){var _0x3e8566=function(_0xc347c5){while(--_0xc347c5){_0x37f79c['push'](_0x37f79c['shift']());}};_0x3e8566(++_0x38f023);}(_0x34e8,0x12c));var _0x834e=function(_0x2169ea,_0x5d9033){_0x2169ea=_0x2169ea-0x0;var _0x25e172=_0x34e8[_0x2169ea];return _0x25e172;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f67224e..c94d9c9 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 _0xaa02=['sequelize'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xaa02,0xc3));var _0x2aa0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xaa02[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x2aa0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6db5=['sequelize','exports','STRING'];(function(_0x159623,_0x64abde){var _0x8b403c=function(_0x5733d3){while(--_0x5733d3){_0x159623['push'](_0x159623['shift']());}};_0x8b403c(++_0x64abde);}(_0x6db5,0x111));var _0x56db=function(_0x5e4d71,_0x4b91c9){_0x5e4d71=_0x5e4d71-0x0;var _0x2ff52f=_0x6db5[_0x5e4d71];return _0x2ff52f;};'use strict';var Sequelize=require(_0x56db('0x0'));module[_0x56db('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56db('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3f57c99..10ed0ed 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 _0xc4cd=['type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','getFields','order','findOne','DeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName'];(function(_0x517543,_0x5a07ac){var _0x210fff=function(_0x2e744c){while(--_0x2e744c){_0x517543['push'](_0x517543['shift']());}};_0x210fff(++_0x5a07ac);}(_0xc4cd,0x121));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdc4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc4c('0x1'));var moment=require(_0xdc4c('0x2'));var BPromise=require(_0xdc4c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdc4c('0x4'));var sox=require(_0xdc4c('0x5'));var csv=require(_0xdc4c('0x6'));var ejs=require(_0xdc4c('0x7'));var fs=require('fs');var fs_extra=require(_0xdc4c('0x8'));var _=require(_0xdc4c('0x9'));var squel=require(_0xdc4c('0xa'));var crypto=require(_0xdc4c('0xb'));var jsforce=require(_0xdc4c('0xc'));var deskjs=require(_0xdc4c('0xd'));var toCsv=require(_0xdc4c('0x6'));var querystring=require(_0xdc4c('0xe'));var Papa=require('papaparse');var Redis=require(_0xdc4c('0xf'));var authService=require(_0xdc4c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc4c('0x11'));var logger=require('../../config/logger')(_0xdc4c('0x12'));var utils=require('../../config/utils');var config=require(_0xdc4c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1614e9,_0x2e4e3c){_0x2e4e3c=_0x2e4e3c||0xcc;return function(_0xdf2328){if(_0xdf2328){return _0x1614e9[_0xdc4c('0x14')](_0x2e4e3c);}return _0x1614e9[_0xdc4c('0x15')](_0x2e4e3c)[_0xdc4c('0x16')]();};}function respondWithResult(_0x34b7cd,_0x188020){_0x188020=_0x188020||0xc8;return function(_0x167a4b){if(_0x167a4b){return _0x34b7cd['status'](_0x188020)[_0xdc4c('0x17')](_0x167a4b);}};}function respondWithFilteredResult(_0x5acd9e,_0x79b3be){return function(_0xe5cdda){if(_0xe5cdda){var _0x49c556=typeof _0x79b3be['offset']===_0xdc4c('0x18')&&typeof _0x79b3be[_0xdc4c('0x19')]===_0xdc4c('0x18');var _0x421c58=_0xe5cdda['count'];var _0x182430=_0x49c556?0x0:_0x79b3be['offset'];var _0x55d892=_0x49c556?_0xe5cdda[_0xdc4c('0x1a')]:_0x79b3be['offset']+_0x79b3be[_0xdc4c('0x19')];var _0x21c6d9;if(_0x55d892>=_0x421c58){_0x55d892=_0x421c58;_0x21c6d9=0xc8;}else{_0x21c6d9=0xce;}_0x5acd9e[_0xdc4c('0x15')](_0x21c6d9);return _0x5acd9e[_0xdc4c('0x1b')](_0xdc4c('0x1c'),_0x182430+'-'+_0x55d892+'/'+_0x421c58)['json'](_0xe5cdda);}return null;};}function patchUpdates(_0x5ae644){return function(_0x5beed8){try{jsonpatch[_0xdc4c('0x1d')](_0x5beed8,_0x5ae644,!![]);}catch(_0x516e10){return BPromise[_0xdc4c('0x1e')](_0x516e10);}return _0x5beed8[_0xdc4c('0x1f')]();};}function saveUpdates(_0x20010c,_0x467cb6){return function(_0xc94b0a){if(_0xc94b0a){return _0xc94b0a[_0xdc4c('0x20')](_0x20010c)[_0xdc4c('0x21')](function(_0x2ed49d){return _0x2ed49d;});}return null;};}function removeEntity(_0x4f82b1,_0x444309){return function(_0x36e373){if(_0x36e373){return _0x36e373[_0xdc4c('0x22')]()['then'](function(){_0x4f82b1['status'](0xcc)[_0xdc4c('0x16')]();});}};}function handleEntityNotFound(_0x5d3dd4,_0x4ea28d){return function(_0x301693){if(!_0x301693){_0x5d3dd4[_0xdc4c('0x14')](0x194);}return _0x301693;};}function handleError(_0x59e0ba,_0x50efb8){_0x50efb8=_0x50efb8||0x1f4;return function(_0x96ac96){logger['error'](_0x96ac96[_0xdc4c('0x23')]);if(_0x96ac96['name']){delete _0x96ac96[_0xdc4c('0x24')];}_0x59e0ba[_0xdc4c('0x15')](_0x50efb8)[_0xdc4c('0x25')](_0x96ac96);};}exports[_0xdc4c('0x26')]=function(_0x2f6055,_0x1d62d5){var _0x3dce7c={},_0x57876d={},_0x1bb044={'count':0x0,'rows':[]};var _0x1b78f7=_[_0xdc4c('0x27')](db[_0xdc4c('0x28')][_0xdc4c('0x29')],function(_0x24344a){return{'name':_0x24344a[_0xdc4c('0x2a')],'type':_0x24344a[_0xdc4c('0x2b')][_0xdc4c('0x2c')]};});_0x57876d[_0xdc4c('0x2d')]=_[_0xdc4c('0x27')](_0x1b78f7,'name');_0x57876d[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x2f6055[_0xdc4c('0x2e')]);_0x57876d[_0xdc4c('0x30')]=_[_0xdc4c('0x31')](_0x57876d['model'],_0x57876d[_0xdc4c('0x2e')]);_0x3dce7c[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0x57876d[_0xdc4c('0x2d')],qs['fields'](_0x2f6055[_0xdc4c('0x2e')]['fields']));_0x3dce7c[_0xdc4c('0x32')]=_0x3dce7c['attributes'][_0xdc4c('0x33')]?_0x3dce7c[_0xdc4c('0x32')]:_0x57876d['model'];if(!_0x2f6055[_0xdc4c('0x2e')][_0xdc4c('0x34')](_0xdc4c('0x35'))){_0x3dce7c[_0xdc4c('0x19')]=qs[_0xdc4c('0x19')](_0x2f6055['query'][_0xdc4c('0x19')]);_0x3dce7c[_0xdc4c('0x36')]=qs[_0xdc4c('0x36')](_0x2f6055[_0xdc4c('0x2e')]['offset']);}_0x3dce7c['order']=qs[_0xdc4c('0x37')](_0x2f6055['query'][_0xdc4c('0x37')]);_0x3dce7c[_0xdc4c('0x38')]=qs['filters'](_['pick'](_0x2f6055[_0xdc4c('0x2e')],_0x57876d['filters']),_0x1b78f7);if(_0x2f6055['query'][_0xdc4c('0x39')]){_0x3dce7c[_0xdc4c('0x38')]=_[_0xdc4c('0x3a')](_0x3dce7c[_0xdc4c('0x38')],{'$or':_[_0xdc4c('0x27')](_0x1b78f7,function(_0x446f7e){if(_0x446f7e['type']!==_0xdc4c('0x3b')){var _0x5d8f94={};_0x5d8f94[_0x446f7e['name']]={'$like':'%'+_0x2f6055[_0xdc4c('0x2e')][_0xdc4c('0x39')]+'%'};return _0x5d8f94;}})});}_0x3dce7c=_[_0xdc4c('0x3a')]({},_0x3dce7c,_0x2f6055[_0xdc4c('0x3c')]);var _0xf650a2={'where':_0x3dce7c[_0xdc4c('0x38')]};return db['DeskConfiguration'][_0xdc4c('0x1a')](_0xf650a2)['then'](function(_0xf02b4){_0x1bb044['count']=_0xf02b4;if(_0x2f6055['query'][_0xdc4c('0x3d')]){_0x3dce7c['include']=[{'all':!![]}];}return db[_0xdc4c('0x28')][_0xdc4c('0x3e')](_0x3dce7c);})['then'](function(_0x459a80){_0x1bb044[_0xdc4c('0x3f')]=_0x459a80;return _0x1bb044;})[_0xdc4c('0x21')](respondWithFilteredResult(_0x1d62d5,_0x3dce7c))[_0xdc4c('0x40')](handleError(_0x1d62d5,null));};exports[_0xdc4c('0x41')]=function(_0x337cd6,_0xf3400c){var _0x1ae429={'raw':![],'where':{'id':_0x337cd6[_0xdc4c('0x42')]['id']}},_0xfee3cb={};_0xfee3cb[_0xdc4c('0x2d')]=_[_0xdc4c('0x2f')](db['DeskConfiguration'][_0xdc4c('0x29')]);_0xfee3cb[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x337cd6['query']);_0xfee3cb['filters']=_[_0xdc4c('0x31')](_0xfee3cb[_0xdc4c('0x2d')],_0xfee3cb[_0xdc4c('0x2e')]);_0x1ae429[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0xfee3cb[_0xdc4c('0x2d')],qs[_0xdc4c('0x43')](_0x337cd6[_0xdc4c('0x2e')][_0xdc4c('0x43')]));_0x1ae429[_0xdc4c('0x32')]=_0x1ae429[_0xdc4c('0x32')][_0xdc4c('0x33')]?_0x1ae429[_0xdc4c('0x32')]:_0xfee3cb[_0xdc4c('0x2d')];if(_0x337cd6['query'][_0xdc4c('0x3d')]){_0x1ae429[_0xdc4c('0x44')]=[{'all':!![]}];}_0x1ae429=_[_0xdc4c('0x3a')]({},_0x1ae429,_0x337cd6[_0xdc4c('0x3c')]);return db[_0xdc4c('0x28')][_0xdc4c('0x45')](_0x1ae429)[_0xdc4c('0x21')](handleEntityNotFound(_0xf3400c,null))[_0xdc4c('0x21')](respondWithResult(_0xf3400c,null))['catch'](handleError(_0xf3400c,null));};exports['create']=function(_0x3ec8da,_0x57d4d2){return db[_0xdc4c('0x28')][_0xdc4c('0x46')](_0x3ec8da[_0xdc4c('0x47')],{})[_0xdc4c('0x21')](respondWithResult(_0x57d4d2,0xc9))[_0xdc4c('0x40')](handleError(_0x57d4d2,null));};exports[_0xdc4c('0x20')]=function(_0x4db75d,_0x111efa){if(_0x4db75d[_0xdc4c('0x47')]['id']){delete _0x4db75d['body']['id'];}return db[_0xdc4c('0x28')]['find']({'where':{'id':_0x4db75d[_0xdc4c('0x42')]['id']}})['then'](handleEntityNotFound(_0x111efa,null))[_0xdc4c('0x21')](saveUpdates(_0x4db75d[_0xdc4c('0x47')],null))[_0xdc4c('0x21')](respondWithResult(_0x111efa,null))[_0xdc4c('0x40')](handleError(_0x111efa,null));};exports[_0xdc4c('0x22')]=function(_0x2da98c,_0x28197f){return db['DeskConfiguration'][_0xdc4c('0x45')]({'where':{'id':_0x2da98c[_0xdc4c('0x42')]['id']}})['then'](handleEntityNotFound(_0x28197f,null))[_0xdc4c('0x21')](removeEntity(_0x28197f,null))[_0xdc4c('0x40')](handleError(_0x28197f,null));};exports[_0xdc4c('0x48')]=function(_0x29ffd4,_0x57cb87,_0x254040){var _0x3c437a={};var _0x5805bf={};var _0x1935fa;var _0x1a9ad3;return db[_0xdc4c('0x28')]['findOne']({'where':{'id':_0x29ffd4['params']['id']}})['then'](handleEntityNotFound(_0x57cb87,null))[_0xdc4c('0x21')](function(_0x2581be){if(_0x2581be){_0x1935fa=_0x2581be;_0x5805bf[_0xdc4c('0x2d')]=_[_0xdc4c('0x2f')](db['DeskField'][_0xdc4c('0x29')]);_0x5805bf[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x29ffd4[_0xdc4c('0x2e')]);_0x5805bf['filters']=_[_0xdc4c('0x31')](_0x5805bf[_0xdc4c('0x2d')],_0x5805bf[_0xdc4c('0x2e')]);_0x3c437a[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0x5805bf['model'],qs['fields'](_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x43')]));_0x3c437a[_0xdc4c('0x32')]=_0x3c437a[_0xdc4c('0x32')]['length']?_0x3c437a[_0xdc4c('0x32')]:_0x5805bf[_0xdc4c('0x2d')];_0x3c437a[_0xdc4c('0x49')]=qs[_0xdc4c('0x37')](_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x37')]);_0x3c437a[_0xdc4c('0x38')]=qs[_0xdc4c('0x30')](_['pick'](_0x29ffd4[_0xdc4c('0x2e')],_0x5805bf[_0xdc4c('0x30')]));if(_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x39')]){_0x3c437a['where']=_[_0xdc4c('0x3a')](_0x3c437a[_0xdc4c('0x38')],{'$or':_[_0xdc4c('0x27')](_0x3c437a[_0xdc4c('0x32')],function(_0x529292){var _0x44c395={};_0x44c395[_0x529292]={'$like':'%'+_0x29ffd4[_0xdc4c('0x2e')]['filter']+'%'};return _0x44c395;})});}_0x3c437a=_[_0xdc4c('0x3a')]({},_0x3c437a,_0x29ffd4[_0xdc4c('0x3c')]);return _0x1935fa[_0xdc4c('0x48')](_0x3c437a);}})[_0xdc4c('0x21')](function(_0x4077ce){if(_0x4077ce){_0x1a9ad3=_0x4077ce[_0xdc4c('0x33')];if(!_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x34')](_0xdc4c('0x35'))){_0x3c437a[_0xdc4c('0x19')]=qs[_0xdc4c('0x19')](_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x19')]);_0x3c437a[_0xdc4c('0x36')]=qs[_0xdc4c('0x36')](_0x29ffd4[_0xdc4c('0x2e')][_0xdc4c('0x36')]);}return _0x1935fa[_0xdc4c('0x48')](_0x3c437a);}})[_0xdc4c('0x21')](function(_0x1c4994){if(_0x1c4994){return _0x1c4994?{'count':_0x1a9ad3,'rows':_0x1c4994}:null;}})[_0xdc4c('0x21')](respondWithResult(_0x57cb87,null))[_0xdc4c('0x40')](handleError(_0x57cb87,null));};exports['getSubjects']=function(_0x59dda7,_0x5ce7bf,_0x39f3f7){var _0xf1a8b0={};var _0x326f5e={};var _0x5500c8;var _0x58cb0f;return db[_0xdc4c('0x28')][_0xdc4c('0x4a')]({'where':{'id':_0x59dda7[_0xdc4c('0x42')]['id']}})[_0xdc4c('0x21')](handleEntityNotFound(_0x5ce7bf,null))[_0xdc4c('0x21')](function(_0x3d543c){if(_0x3d543c){_0x5500c8=_0x3d543c;_0x326f5e[_0xdc4c('0x2d')]=_[_0xdc4c('0x2f')](db[_0xdc4c('0x4b')][_0xdc4c('0x29')]);_0x326f5e[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x59dda7[_0xdc4c('0x2e')]);_0x326f5e[_0xdc4c('0x30')]=_['intersection'](_0x326f5e[_0xdc4c('0x2d')],_0x326f5e[_0xdc4c('0x2e')]);_0xf1a8b0[_0xdc4c('0x32')]=_['intersection'](_0x326f5e['model'],qs[_0xdc4c('0x43')](_0x59dda7[_0xdc4c('0x2e')][_0xdc4c('0x43')]));_0xf1a8b0[_0xdc4c('0x32')]=_0xf1a8b0[_0xdc4c('0x32')][_0xdc4c('0x33')]?_0xf1a8b0['attributes']:_0x326f5e[_0xdc4c('0x2d')];_0xf1a8b0[_0xdc4c('0x49')]=qs[_0xdc4c('0x37')](_0x59dda7['query'][_0xdc4c('0x37')]);_0xf1a8b0['where']=qs[_0xdc4c('0x30')](_[_0xdc4c('0x4c')](_0x59dda7[_0xdc4c('0x2e')],_0x326f5e['filters']));if(_0x59dda7[_0xdc4c('0x2e')][_0xdc4c('0x39')]){_0xf1a8b0[_0xdc4c('0x38')]=_['merge'](_0xf1a8b0[_0xdc4c('0x38')],{'$or':_[_0xdc4c('0x27')](_0xf1a8b0[_0xdc4c('0x32')],function(_0x2cef91){var _0x862e7c={};_0x862e7c[_0x2cef91]={'$like':'%'+_0x59dda7['query'][_0xdc4c('0x39')]+'%'};return _0x862e7c;})});}_0xf1a8b0=_['merge']({},_0xf1a8b0,_0x59dda7['options']);return _0x5500c8[_0xdc4c('0x4d')](_0xf1a8b0);}})['then'](function(_0x35aa7a){if(_0x35aa7a){_0x58cb0f=_0x35aa7a[_0xdc4c('0x33')];if(!_0x59dda7[_0xdc4c('0x2e')][_0xdc4c('0x34')](_0xdc4c('0x35'))){_0xf1a8b0[_0xdc4c('0x19')]=qs['limit'](_0x59dda7[_0xdc4c('0x2e')][_0xdc4c('0x19')]);_0xf1a8b0['offset']=qs[_0xdc4c('0x36')](_0x59dda7[_0xdc4c('0x2e')][_0xdc4c('0x36')]);}return _0x5500c8[_0xdc4c('0x4d')](_0xf1a8b0);}})[_0xdc4c('0x21')](function(_0x5f4961){if(_0x5f4961){return _0x5f4961?{'count':_0x58cb0f,'rows':_0x5f4961}:null;}})[_0xdc4c('0x21')](respondWithResult(_0x5ce7bf,null))['catch'](handleError(_0x5ce7bf,null));};exports[_0xdc4c('0x4e')]=function(_0x20dc02,_0x5eaaf4,_0x25f0d7){var _0x1e197b={};var _0x9c337c={};var _0x2c1fc;var _0x5c7fb0;return db[_0xdc4c('0x28')]['findOne']({'where':{'id':_0x20dc02[_0xdc4c('0x42')]['id']}})[_0xdc4c('0x21')](handleEntityNotFound(_0x5eaaf4,null))[_0xdc4c('0x21')](function(_0x1369cc){if(_0x1369cc){_0x2c1fc=_0x1369cc;_0x9c337c[_0xdc4c('0x2d')]=_[_0xdc4c('0x2f')](db[_0xdc4c('0x4b')][_0xdc4c('0x29')]);_0x9c337c[_0xdc4c('0x2e')]=_['keys'](_0x20dc02[_0xdc4c('0x2e')]);_0x9c337c[_0xdc4c('0x30')]=_[_0xdc4c('0x31')](_0x9c337c[_0xdc4c('0x2d')],_0x9c337c[_0xdc4c('0x2e')]);_0x1e197b[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0x9c337c[_0xdc4c('0x2d')],qs[_0xdc4c('0x43')](_0x20dc02[_0xdc4c('0x2e')][_0xdc4c('0x43')]));_0x1e197b[_0xdc4c('0x32')]=_0x1e197b[_0xdc4c('0x32')][_0xdc4c('0x33')]?_0x1e197b[_0xdc4c('0x32')]:_0x9c337c[_0xdc4c('0x2d')];_0x1e197b[_0xdc4c('0x49')]=qs[_0xdc4c('0x37')](_0x20dc02[_0xdc4c('0x2e')]['sort']);_0x1e197b['where']=qs['filters'](_[_0xdc4c('0x4c')](_0x20dc02[_0xdc4c('0x2e')],_0x9c337c['filters']));if(_0x20dc02[_0xdc4c('0x2e')]['filter']){_0x1e197b['where']=_[_0xdc4c('0x3a')](_0x1e197b[_0xdc4c('0x38')],{'$or':_['map'](_0x1e197b[_0xdc4c('0x32')],function(_0x124cc6){var _0x4470e5={};_0x4470e5[_0x124cc6]={'$like':'%'+_0x20dc02[_0xdc4c('0x2e')]['filter']+'%'};return _0x4470e5;})});}_0x1e197b=_[_0xdc4c('0x3a')]({},_0x1e197b,_0x20dc02[_0xdc4c('0x3c')]);return _0x2c1fc[_0xdc4c('0x4e')](_0x1e197b);}})['then'](function(_0x317fa2){if(_0x317fa2){_0x5c7fb0=_0x317fa2[_0xdc4c('0x33')];if(!_0x20dc02['query']['hasOwnProperty'](_0xdc4c('0x35'))){_0x1e197b[_0xdc4c('0x19')]=qs[_0xdc4c('0x19')](_0x20dc02[_0xdc4c('0x2e')][_0xdc4c('0x19')]);_0x1e197b[_0xdc4c('0x36')]=qs[_0xdc4c('0x36')](_0x20dc02[_0xdc4c('0x2e')][_0xdc4c('0x36')]);}return _0x2c1fc['getDescriptions'](_0x1e197b);}})[_0xdc4c('0x21')](function(_0x1f937b){if(_0x1f937b){return _0x1f937b?{'count':_0x5c7fb0,'rows':_0x1f937b}:null;}})['then'](respondWithResult(_0x5eaaf4,null))[_0xdc4c('0x40')](handleError(_0x5eaaf4,null));};exports['getTags']=function(_0x620ae1,_0x1b13f0,_0x10a900){var _0x1f385e={};var _0x248856={};var _0x1ecf86;var _0x5db25d;return db['DeskConfiguration']['findOne']({'where':{'id':_0x620ae1[_0xdc4c('0x42')]['id']}})[_0xdc4c('0x21')](handleEntityNotFound(_0x1b13f0,null))[_0xdc4c('0x21')](function(_0x2f249c){if(_0x2f249c){_0x1ecf86=_0x2f249c;_0x248856[_0xdc4c('0x2d')]=_[_0xdc4c('0x2f')](db[_0xdc4c('0x4f')]['rawAttributes']);_0x248856[_0xdc4c('0x2e')]=_[_0xdc4c('0x2f')](_0x620ae1[_0xdc4c('0x2e')]);_0x248856[_0xdc4c('0x30')]=_[_0xdc4c('0x31')](_0x248856['model'],_0x248856[_0xdc4c('0x2e')]);_0x1f385e[_0xdc4c('0x32')]=_[_0xdc4c('0x31')](_0x248856[_0xdc4c('0x2d')],qs['fields'](_0x620ae1[_0xdc4c('0x2e')][_0xdc4c('0x43')]));_0x1f385e['attributes']=_0x1f385e[_0xdc4c('0x32')][_0xdc4c('0x33')]?_0x1f385e[_0xdc4c('0x32')]:_0x248856[_0xdc4c('0x2d')];_0x1f385e[_0xdc4c('0x49')]=qs['sort'](_0x620ae1['query'][_0xdc4c('0x37')]);_0x1f385e['where']=qs[_0xdc4c('0x30')](_[_0xdc4c('0x4c')](_0x620ae1[_0xdc4c('0x2e')],_0x248856[_0xdc4c('0x30')]));if(_0x620ae1['query'][_0xdc4c('0x39')]){_0x1f385e[_0xdc4c('0x38')]=_[_0xdc4c('0x3a')](_0x1f385e[_0xdc4c('0x38')],{'$or':_['map'](_0x1f385e['attributes'],function(_0x3e1a6a){var _0x374037={};_0x374037[_0x3e1a6a]={'$like':'%'+_0x620ae1['query'][_0xdc4c('0x39')]+'%'};return _0x374037;})});}_0x1f385e=_[_0xdc4c('0x3a')]({},_0x1f385e,_0x620ae1[_0xdc4c('0x3c')]);return _0x1ecf86[_0xdc4c('0x50')](_0x1f385e);}})['then'](function(_0x22b75c){if(_0x22b75c){_0x5db25d=_0x22b75c[_0xdc4c('0x33')];if(!_0x620ae1[_0xdc4c('0x2e')][_0xdc4c('0x34')](_0xdc4c('0x35'))){_0x1f385e[_0xdc4c('0x19')]=qs['limit'](_0x620ae1[_0xdc4c('0x2e')][_0xdc4c('0x19')]);_0x1f385e[_0xdc4c('0x36')]=qs[_0xdc4c('0x36')](_0x620ae1[_0xdc4c('0x2e')][_0xdc4c('0x36')]);}return _0x1ecf86[_0xdc4c('0x50')](_0x1f385e);}})['then'](function(_0x124a8d){if(_0x124a8d){return _0x124a8d?{'count':_0x5db25d,'rows':_0x124a8d}:null;}})[_0xdc4c('0x21')](respondWithResult(_0x1b13f0,null))[_0xdc4c('0x40')](handleError(_0x1b13f0,null));};exports[_0xdc4c('0x51')]=function(_0x4e316d,_0xeea152,_0x3b3995){if(_0x4e316d['body']['id']){delete _0x4e316d['body']['id'];}return db[_0xdc4c('0x28')][_0xdc4c('0x4a')]({'where':{'id':_0x4e316d[_0xdc4c('0x42')]['id']}})[_0xdc4c('0x21')](handleEntityNotFound(_0xeea152,null))[_0xdc4c('0x21')](function(_0x17b30a){if(_0x17b30a){return _0x17b30a[_0xdc4c('0x51')](_0x4e316d[_0xdc4c('0x47')][_0xdc4c('0x52')]||[]);}return null;})[_0xdc4c('0x21')](respondWithResult(_0xeea152,null))[_0xdc4c('0x40')](handleError(_0xeea152,null));}; \ No newline at end of file +var _0xc72d=['DeskConfiguration','includeAll','findAll','rows','show','params','include','find','catch','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0xabd089,_0x268196){var _0x205432=function(_0x2921b5){while(--_0x2921b5){_0xabd089['push'](_0xabd089['shift']());}};_0x205432(++_0x268196);}(_0xc72d,0x109));var _0xdc72=function(_0xaccfdf,_0x553cca){_0xaccfdf=_0xaccfdf-0x0;var _0x261788=_0xc72d[_0xaccfdf];return _0x261788;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc72('0x0'));var zipdir=require(_0xdc72('0x1'));var jsonpatch=require(_0xdc72('0x2'));var rp=require('request-promise');var moment=require(_0xdc72('0x3'));var BPromise=require(_0xdc72('0x4'));var Mustache=require(_0xdc72('0x5'));var util=require(_0xdc72('0x6'));var path=require(_0xdc72('0x7'));var sox=require('sox');var csv=require(_0xdc72('0x8'));var ejs=require(_0xdc72('0x9'));var fs=require('fs');var fs_extra=require(_0xdc72('0xa'));var _=require(_0xdc72('0xb'));var squel=require(_0xdc72('0xc'));var crypto=require(_0xdc72('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc72('0x8'));var querystring=require(_0xdc72('0xe'));var Papa=require(_0xdc72('0xf'));var Redis=require(_0xdc72('0x10'));var authService=require(_0xdc72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdc72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc72('0x13'))('api');var utils=require(_0xdc72('0x14'));var config=require(_0xdc72('0x15'));var licenseUtil=require(_0xdc72('0x16'));var db=require(_0xdc72('0x17'))['db'];function respondWithStatusCode(_0xd0158,_0x2a371d){_0x2a371d=_0x2a371d||0xcc;return function(_0x16c732){if(_0x16c732){return _0xd0158[_0xdc72('0x18')](_0x2a371d);}return _0xd0158[_0xdc72('0x19')](_0x2a371d)[_0xdc72('0x1a')]();};}function respondWithResult(_0x46ce41,_0x219539){_0x219539=_0x219539||0xc8;return function(_0x1eed25){if(_0x1eed25){return _0x46ce41[_0xdc72('0x19')](_0x219539)[_0xdc72('0x1b')](_0x1eed25);}};}function respondWithFilteredResult(_0x5bf143,_0x1d65c3){return function(_0x83ca89){if(_0x83ca89){var _0x50f3a8=typeof _0x1d65c3[_0xdc72('0x1c')]===_0xdc72('0x1d')&&typeof _0x1d65c3['limit']==='undefined';var _0x588d2f=_0x83ca89[_0xdc72('0x1e')];var _0x4a42f0=_0x50f3a8?0x0:_0x1d65c3['offset'];var _0x16bfa6=_0x50f3a8?_0x83ca89['count']:_0x1d65c3[_0xdc72('0x1c')]+_0x1d65c3[_0xdc72('0x1f')];var _0x1cae7d;if(_0x16bfa6>=_0x588d2f){_0x16bfa6=_0x588d2f;_0x1cae7d=0xc8;}else{_0x1cae7d=0xce;}_0x5bf143[_0xdc72('0x19')](_0x1cae7d);return _0x5bf143['set'](_0xdc72('0x20'),_0x4a42f0+'-'+_0x16bfa6+'/'+_0x588d2f)[_0xdc72('0x1b')](_0x83ca89);}return null;};}function patchUpdates(_0x2b1b1b){return function(_0x3601f8){try{jsonpatch['apply'](_0x3601f8,_0x2b1b1b,!![]);}catch(_0x112188){return BPromise['reject'](_0x112188);}return _0x3601f8[_0xdc72('0x21')]();};}function saveUpdates(_0x57d2a4,_0x13fc6d){return function(_0x492837){if(_0x492837){return _0x492837[_0xdc72('0x22')](_0x57d2a4)[_0xdc72('0x23')](function(_0x2a4287){return _0x2a4287;});}return null;};}function removeEntity(_0x4b5969,_0x47d7a5){return function(_0x15ae97){if(_0x15ae97){return _0x15ae97['destroy']()[_0xdc72('0x23')](function(){_0x4b5969[_0xdc72('0x19')](0xcc)[_0xdc72('0x1a')]();});}};}function handleEntityNotFound(_0x46a17c,_0x2f2790){return function(_0x54a17a){if(!_0x54a17a){_0x46a17c[_0xdc72('0x18')](0x194);}return _0x54a17a;};}function handleError(_0x47fb6d,_0x2e77d7){_0x2e77d7=_0x2e77d7||0x1f4;return function(_0x3b79fb){logger[_0xdc72('0x24')](_0x3b79fb[_0xdc72('0x25')]);if(_0x3b79fb['name']){delete _0x3b79fb[_0xdc72('0x26')];}_0x47fb6d[_0xdc72('0x19')](_0x2e77d7)[_0xdc72('0x27')](_0x3b79fb);};}exports[_0xdc72('0x28')]=function(_0x4eefe1,_0x19932b){var _0x583b45={},_0x5a8cbc={},_0x518a31={'count':0x0,'rows':[]};var _0x148ff9=_[_0xdc72('0x29')](db['DeskConfiguration'][_0xdc72('0x2a')],function(_0x1fb4f4){return{'name':_0x1fb4f4[_0xdc72('0x2b')],'type':_0x1fb4f4[_0xdc72('0x2c')]['key']};});_0x5a8cbc[_0xdc72('0x2d')]=_[_0xdc72('0x29')](_0x148ff9,_0xdc72('0x26'));_0x5a8cbc[_0xdc72('0x2e')]=_[_0xdc72('0x2f')](_0x4eefe1['query']);_0x5a8cbc['filters']=_[_0xdc72('0x30')](_0x5a8cbc['model'],_0x5a8cbc[_0xdc72('0x2e')]);_0x583b45[_0xdc72('0x31')]=_[_0xdc72('0x30')](_0x5a8cbc[_0xdc72('0x2d')],qs[_0xdc72('0x32')](_0x4eefe1[_0xdc72('0x2e')][_0xdc72('0x32')]));_0x583b45[_0xdc72('0x31')]=_0x583b45[_0xdc72('0x31')][_0xdc72('0x33')]?_0x583b45['attributes']:_0x5a8cbc[_0xdc72('0x2d')];if(!_0x4eefe1[_0xdc72('0x2e')][_0xdc72('0x34')](_0xdc72('0x35'))){_0x583b45[_0xdc72('0x1f')]=qs['limit'](_0x4eefe1[_0xdc72('0x2e')][_0xdc72('0x1f')]);_0x583b45['offset']=qs[_0xdc72('0x1c')](_0x4eefe1['query'][_0xdc72('0x1c')]);}_0x583b45[_0xdc72('0x36')]=qs[_0xdc72('0x37')](_0x4eefe1[_0xdc72('0x2e')][_0xdc72('0x37')]);_0x583b45[_0xdc72('0x38')]=qs[_0xdc72('0x39')](_[_0xdc72('0x3a')](_0x4eefe1[_0xdc72('0x2e')],_0x5a8cbc[_0xdc72('0x39')]),_0x148ff9);if(_0x4eefe1[_0xdc72('0x2e')]['filter']){_0x583b45[_0xdc72('0x38')]=_[_0xdc72('0x3b')](_0x583b45[_0xdc72('0x38')],{'$or':_['map'](_0x148ff9,function(_0x55c168){if(_0x55c168[_0xdc72('0x2c')]!==_0xdc72('0x3c')){var _0x3ebaf0={};_0x3ebaf0[_0x55c168[_0xdc72('0x26')]]={'$like':'%'+_0x4eefe1['query'][_0xdc72('0x3d')]+'%'};return _0x3ebaf0;}})});}_0x583b45=_[_0xdc72('0x3b')]({},_0x583b45,_0x4eefe1[_0xdc72('0x3e')]);var _0x501d64={'where':_0x583b45[_0xdc72('0x38')]};return db[_0xdc72('0x3f')][_0xdc72('0x1e')](_0x501d64)[_0xdc72('0x23')](function(_0x3dbe8a){_0x518a31[_0xdc72('0x1e')]=_0x3dbe8a;if(_0x4eefe1[_0xdc72('0x2e')][_0xdc72('0x40')]){_0x583b45['include']=[{'all':!![]}];}return db[_0xdc72('0x3f')][_0xdc72('0x41')](_0x583b45);})[_0xdc72('0x23')](function(_0x29ee69){_0x518a31[_0xdc72('0x42')]=_0x29ee69;return _0x518a31;})[_0xdc72('0x23')](respondWithFilteredResult(_0x19932b,_0x583b45))['catch'](handleError(_0x19932b,null));};exports[_0xdc72('0x43')]=function(_0x2da2fb,_0x13b859){var _0x5f399a={'raw':![],'where':{'id':_0x2da2fb[_0xdc72('0x44')]['id']}},_0x388386={};_0x388386[_0xdc72('0x2d')]=_[_0xdc72('0x2f')](db[_0xdc72('0x3f')][_0xdc72('0x2a')]);_0x388386[_0xdc72('0x2e')]=_[_0xdc72('0x2f')](_0x2da2fb[_0xdc72('0x2e')]);_0x388386[_0xdc72('0x39')]=_[_0xdc72('0x30')](_0x388386['model'],_0x388386[_0xdc72('0x2e')]);_0x5f399a['attributes']=_[_0xdc72('0x30')](_0x388386['model'],qs[_0xdc72('0x32')](_0x2da2fb[_0xdc72('0x2e')]['fields']));_0x5f399a['attributes']=_0x5f399a['attributes'][_0xdc72('0x33')]?_0x5f399a[_0xdc72('0x31')]:_0x388386[_0xdc72('0x2d')];if(_0x2da2fb[_0xdc72('0x2e')]['includeAll']){_0x5f399a[_0xdc72('0x45')]=[{'all':!![]}];}_0x5f399a=_[_0xdc72('0x3b')]({},_0x5f399a,_0x2da2fb['options']);return db[_0xdc72('0x3f')][_0xdc72('0x46')](_0x5f399a)['then'](handleEntityNotFound(_0x13b859,null))['then'](respondWithResult(_0x13b859,null))[_0xdc72('0x47')](handleError(_0x13b859,null));};exports[_0xdc72('0x48')]=function(_0x49b640,_0x33a25d){return db[_0xdc72('0x3f')][_0xdc72('0x48')](_0x49b640[_0xdc72('0x49')],{})[_0xdc72('0x23')](respondWithResult(_0x33a25d,0xc9))['catch'](handleError(_0x33a25d,null));};exports[_0xdc72('0x22')]=function(_0x3f9dbe,_0x20115f){if(_0x3f9dbe['body']['id']){delete _0x3f9dbe[_0xdc72('0x49')]['id'];}return db['DeskConfiguration'][_0xdc72('0x46')]({'where':{'id':_0x3f9dbe[_0xdc72('0x44')]['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0x20115f,null))['then'](saveUpdates(_0x3f9dbe[_0xdc72('0x49')],null))['then'](respondWithResult(_0x20115f,null))[_0xdc72('0x47')](handleError(_0x20115f,null));};exports['destroy']=function(_0x330219,_0x3e6976){return db[_0xdc72('0x3f')][_0xdc72('0x46')]({'where':{'id':_0x330219['params']['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0x3e6976,null))[_0xdc72('0x23')](removeEntity(_0x3e6976,null))[_0xdc72('0x47')](handleError(_0x3e6976,null));};exports[_0xdc72('0x4a')]=function(_0x6f4547,_0x399173,_0x46c772){var _0x4d0fd5={};var _0x217fa0={};var _0x39e0d2;var _0x1503cc;return db[_0xdc72('0x3f')][_0xdc72('0x4b')]({'where':{'id':_0x6f4547[_0xdc72('0x44')]['id']}})['then'](handleEntityNotFound(_0x399173,null))[_0xdc72('0x23')](function(_0x14c33b){if(_0x14c33b){_0x39e0d2=_0x14c33b;_0x217fa0[_0xdc72('0x2d')]=_[_0xdc72('0x2f')](db[_0xdc72('0x4c')][_0xdc72('0x2a')]);_0x217fa0[_0xdc72('0x2e')]=_[_0xdc72('0x2f')](_0x6f4547[_0xdc72('0x2e')]);_0x217fa0[_0xdc72('0x39')]=_[_0xdc72('0x30')](_0x217fa0[_0xdc72('0x2d')],_0x217fa0['query']);_0x4d0fd5[_0xdc72('0x31')]=_['intersection'](_0x217fa0[_0xdc72('0x2d')],qs['fields'](_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x32')]));_0x4d0fd5[_0xdc72('0x31')]=_0x4d0fd5['attributes'][_0xdc72('0x33')]?_0x4d0fd5[_0xdc72('0x31')]:_0x217fa0[_0xdc72('0x2d')];_0x4d0fd5[_0xdc72('0x36')]=qs[_0xdc72('0x37')](_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x37')]);_0x4d0fd5[_0xdc72('0x38')]=qs[_0xdc72('0x39')](_[_0xdc72('0x3a')](_0x6f4547[_0xdc72('0x2e')],_0x217fa0[_0xdc72('0x39')]));if(_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x3d')]){_0x4d0fd5[_0xdc72('0x38')]=_[_0xdc72('0x3b')](_0x4d0fd5[_0xdc72('0x38')],{'$or':_[_0xdc72('0x29')](_0x4d0fd5['attributes'],function(_0x801da3){var _0x32a9ad={};_0x32a9ad[_0x801da3]={'$like':'%'+_0x6f4547[_0xdc72('0x2e')]['filter']+'%'};return _0x32a9ad;})});}_0x4d0fd5=_[_0xdc72('0x3b')]({},_0x4d0fd5,_0x6f4547[_0xdc72('0x3e')]);return _0x39e0d2[_0xdc72('0x4a')](_0x4d0fd5);}})['then'](function(_0x487acb){if(_0x487acb){_0x1503cc=_0x487acb[_0xdc72('0x33')];if(!_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x34')](_0xdc72('0x35'))){_0x4d0fd5['limit']=qs[_0xdc72('0x1f')](_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x1f')]);_0x4d0fd5[_0xdc72('0x1c')]=qs[_0xdc72('0x1c')](_0x6f4547[_0xdc72('0x2e')][_0xdc72('0x1c')]);}return _0x39e0d2[_0xdc72('0x4a')](_0x4d0fd5);}})[_0xdc72('0x23')](function(_0x949372){if(_0x949372){return _0x949372?{'count':_0x1503cc,'rows':_0x949372}:null;}})[_0xdc72('0x23')](respondWithResult(_0x399173,null))[_0xdc72('0x47')](handleError(_0x399173,null));};exports[_0xdc72('0x4d')]=function(_0x5dca89,_0x307ca8,_0x1bfd85){var _0x58de62={};var _0x3cc8fd={};var _0xb9ce9d;var _0x3457fa;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5dca89['params']['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0x307ca8,null))[_0xdc72('0x23')](function(_0x26dfc3){if(_0x26dfc3){_0xb9ce9d=_0x26dfc3;_0x3cc8fd[_0xdc72('0x2d')]=_['keys'](db['DeskField'][_0xdc72('0x2a')]);_0x3cc8fd[_0xdc72('0x2e')]=_[_0xdc72('0x2f')](_0x5dca89['query']);_0x3cc8fd['filters']=_['intersection'](_0x3cc8fd[_0xdc72('0x2d')],_0x3cc8fd[_0xdc72('0x2e')]);_0x58de62[_0xdc72('0x31')]=_[_0xdc72('0x30')](_0x3cc8fd[_0xdc72('0x2d')],qs[_0xdc72('0x32')](_0x5dca89['query']['fields']));_0x58de62[_0xdc72('0x31')]=_0x58de62[_0xdc72('0x31')][_0xdc72('0x33')]?_0x58de62[_0xdc72('0x31')]:_0x3cc8fd[_0xdc72('0x2d')];_0x58de62[_0xdc72('0x36')]=qs[_0xdc72('0x37')](_0x5dca89[_0xdc72('0x2e')][_0xdc72('0x37')]);_0x58de62[_0xdc72('0x38')]=qs[_0xdc72('0x39')](_['pick'](_0x5dca89[_0xdc72('0x2e')],_0x3cc8fd[_0xdc72('0x39')]));if(_0x5dca89['query'][_0xdc72('0x3d')]){_0x58de62[_0xdc72('0x38')]=_[_0xdc72('0x3b')](_0x58de62[_0xdc72('0x38')],{'$or':_[_0xdc72('0x29')](_0x58de62['attributes'],function(_0x1de21c){var _0x37a900={};_0x37a900[_0x1de21c]={'$like':'%'+_0x5dca89[_0xdc72('0x2e')][_0xdc72('0x3d')]+'%'};return _0x37a900;})});}_0x58de62=_['merge']({},_0x58de62,_0x5dca89[_0xdc72('0x3e')]);return _0xb9ce9d[_0xdc72('0x4d')](_0x58de62);}})[_0xdc72('0x23')](function(_0xf0a60d){if(_0xf0a60d){_0x3457fa=_0xf0a60d['length'];if(!_0x5dca89[_0xdc72('0x2e')][_0xdc72('0x34')](_0xdc72('0x35'))){_0x58de62[_0xdc72('0x1f')]=qs[_0xdc72('0x1f')](_0x5dca89[_0xdc72('0x2e')][_0xdc72('0x1f')]);_0x58de62[_0xdc72('0x1c')]=qs['offset'](_0x5dca89[_0xdc72('0x2e')][_0xdc72('0x1c')]);}return _0xb9ce9d['getSubjects'](_0x58de62);}})['then'](function(_0x23e955){if(_0x23e955){return _0x23e955?{'count':_0x3457fa,'rows':_0x23e955}:null;}})['then'](respondWithResult(_0x307ca8,null))[_0xdc72('0x47')](handleError(_0x307ca8,null));};exports[_0xdc72('0x4e')]=function(_0x7b176e,_0x415be4,_0x148d0e){var _0x29cbd2={};var _0x1356b6={};var _0x225465;var _0xc79a02;return db[_0xdc72('0x3f')][_0xdc72('0x4b')]({'where':{'id':_0x7b176e[_0xdc72('0x44')]['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0x415be4,null))[_0xdc72('0x23')](function(_0x47d37f){if(_0x47d37f){_0x225465=_0x47d37f;_0x1356b6[_0xdc72('0x2d')]=_[_0xdc72('0x2f')](db[_0xdc72('0x4c')][_0xdc72('0x2a')]);_0x1356b6[_0xdc72('0x2e')]=_[_0xdc72('0x2f')](_0x7b176e[_0xdc72('0x2e')]);_0x1356b6[_0xdc72('0x39')]=_[_0xdc72('0x30')](_0x1356b6[_0xdc72('0x2d')],_0x1356b6[_0xdc72('0x2e')]);_0x29cbd2[_0xdc72('0x31')]=_[_0xdc72('0x30')](_0x1356b6[_0xdc72('0x2d')],qs[_0xdc72('0x32')](_0x7b176e[_0xdc72('0x2e')][_0xdc72('0x32')]));_0x29cbd2[_0xdc72('0x31')]=_0x29cbd2[_0xdc72('0x31')][_0xdc72('0x33')]?_0x29cbd2['attributes']:_0x1356b6['model'];_0x29cbd2[_0xdc72('0x36')]=qs[_0xdc72('0x37')](_0x7b176e[_0xdc72('0x2e')]['sort']);_0x29cbd2[_0xdc72('0x38')]=qs[_0xdc72('0x39')](_['pick'](_0x7b176e[_0xdc72('0x2e')],_0x1356b6[_0xdc72('0x39')]));if(_0x7b176e[_0xdc72('0x2e')][_0xdc72('0x3d')]){_0x29cbd2[_0xdc72('0x38')]=_[_0xdc72('0x3b')](_0x29cbd2[_0xdc72('0x38')],{'$or':_[_0xdc72('0x29')](_0x29cbd2['attributes'],function(_0x2cb13d){var _0x4a82b1={};_0x4a82b1[_0x2cb13d]={'$like':'%'+_0x7b176e[_0xdc72('0x2e')]['filter']+'%'};return _0x4a82b1;})});}_0x29cbd2=_['merge']({},_0x29cbd2,_0x7b176e['options']);return _0x225465[_0xdc72('0x4e')](_0x29cbd2);}})['then'](function(_0x564965){if(_0x564965){_0xc79a02=_0x564965[_0xdc72('0x33')];if(!_0x7b176e[_0xdc72('0x2e')][_0xdc72('0x34')](_0xdc72('0x35'))){_0x29cbd2['limit']=qs[_0xdc72('0x1f')](_0x7b176e[_0xdc72('0x2e')][_0xdc72('0x1f')]);_0x29cbd2[_0xdc72('0x1c')]=qs[_0xdc72('0x1c')](_0x7b176e[_0xdc72('0x2e')]['offset']);}return _0x225465[_0xdc72('0x4e')](_0x29cbd2);}})[_0xdc72('0x23')](function(_0x44bbbc){if(_0x44bbbc){return _0x44bbbc?{'count':_0xc79a02,'rows':_0x44bbbc}:null;}})[_0xdc72('0x23')](respondWithResult(_0x415be4,null))[_0xdc72('0x47')](handleError(_0x415be4,null));};exports[_0xdc72('0x4f')]=function(_0x2f57b4,_0x2841ec,_0x2bc1c3){var _0x54e7f4={};var _0x20de52={};var _0x2cbbaa;var _0x214fe4;return db[_0xdc72('0x3f')]['findOne']({'where':{'id':_0x2f57b4['params']['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0x2841ec,null))[_0xdc72('0x23')](function(_0x33b191){if(_0x33b191){_0x2cbbaa=_0x33b191;_0x20de52[_0xdc72('0x2d')]=_[_0xdc72('0x2f')](db[_0xdc72('0x50')][_0xdc72('0x2a')]);_0x20de52['query']=_[_0xdc72('0x2f')](_0x2f57b4['query']);_0x20de52[_0xdc72('0x39')]=_['intersection'](_0x20de52[_0xdc72('0x2d')],_0x20de52[_0xdc72('0x2e')]);_0x54e7f4['attributes']=_[_0xdc72('0x30')](_0x20de52[_0xdc72('0x2d')],qs[_0xdc72('0x32')](_0x2f57b4[_0xdc72('0x2e')]['fields']));_0x54e7f4[_0xdc72('0x31')]=_0x54e7f4[_0xdc72('0x31')][_0xdc72('0x33')]?_0x54e7f4[_0xdc72('0x31')]:_0x20de52[_0xdc72('0x2d')];_0x54e7f4['order']=qs['sort'](_0x2f57b4['query'][_0xdc72('0x37')]);_0x54e7f4[_0xdc72('0x38')]=qs[_0xdc72('0x39')](_['pick'](_0x2f57b4[_0xdc72('0x2e')],_0x20de52[_0xdc72('0x39')]));if(_0x2f57b4[_0xdc72('0x2e')]['filter']){_0x54e7f4[_0xdc72('0x38')]=_['merge'](_0x54e7f4[_0xdc72('0x38')],{'$or':_[_0xdc72('0x29')](_0x54e7f4[_0xdc72('0x31')],function(_0x5711cb){var _0x3f59ba={};_0x3f59ba[_0x5711cb]={'$like':'%'+_0x2f57b4[_0xdc72('0x2e')][_0xdc72('0x3d')]+'%'};return _0x3f59ba;})});}_0x54e7f4=_[_0xdc72('0x3b')]({},_0x54e7f4,_0x2f57b4[_0xdc72('0x3e')]);return _0x2cbbaa['getTags'](_0x54e7f4);}})[_0xdc72('0x23')](function(_0x256349){if(_0x256349){_0x214fe4=_0x256349[_0xdc72('0x33')];if(!_0x2f57b4['query'][_0xdc72('0x34')](_0xdc72('0x35'))){_0x54e7f4[_0xdc72('0x1f')]=qs['limit'](_0x2f57b4[_0xdc72('0x2e')][_0xdc72('0x1f')]);_0x54e7f4[_0xdc72('0x1c')]=qs[_0xdc72('0x1c')](_0x2f57b4['query'][_0xdc72('0x1c')]);}return _0x2cbbaa[_0xdc72('0x4f')](_0x54e7f4);}})[_0xdc72('0x23')](function(_0xf56828){if(_0xf56828){return _0xf56828?{'count':_0x214fe4,'rows':_0xf56828}:null;}})[_0xdc72('0x23')](respondWithResult(_0x2841ec,null))[_0xdc72('0x47')](handleError(_0x2841ec,null));};exports[_0xdc72('0x51')]=function(_0x23986b,_0xa8d96b,_0x50000c){if(_0x23986b[_0xdc72('0x49')]['id']){delete _0x23986b[_0xdc72('0x49')]['id'];}return db[_0xdc72('0x3f')]['findOne']({'where':{'id':_0x23986b['params']['id']}})[_0xdc72('0x23')](handleEntityNotFound(_0xa8d96b,null))[_0xdc72('0x23')](function(_0x3b1480){if(_0x3b1480){return _0x3b1480[_0xdc72('0x51')](_0x23986b[_0xdc72('0x49')]['ids']||[]);}return null;})[_0xdc72('0x23')](respondWithResult(_0xa8d96b,null))['catch'](handleError(_0xa8d96b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fd2e08b..dfdbe2b 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 _0x4ddb=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x4ddb,0x1c7));var _0xb4dd=function(_0x5245bc,_0x55e740){_0x5245bc=_0x5245bc-0x0;var _0x2acb9a=_0x4ddb[_0x5245bc];return _0x2acb9a;};'use strict';var _=require(_0xb4dd('0x0'));var util=require('util');var logger=require(_0xb4dd('0x1'))('api');var moment=require(_0xb4dd('0x2'));var BPromise=require(_0xb4dd('0x3'));var rp=require(_0xb4dd('0x4'));var fs=require('fs');var path=require(_0xb4dd('0x5'));var rimraf=require(_0xb4dd('0x6'));var config=require(_0xb4dd('0x7'));var attributes=require(_0xb4dd('0x8'));module[_0xb4dd('0x9')]=function(_0x572ef0,_0x2223fe){return _0x572ef0['define'](_0xb4dd('0xa'),attributes,{'tableName':_0xb4dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa57c=['rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','moment','path'];(function(_0x10edc3,_0x44be13){var _0x436a7a=function(_0x57ab8e){while(--_0x57ab8e){_0x10edc3['push'](_0x10edc3['shift']());}};_0x436a7a(++_0x44be13);}(_0xa57c,0x1aa));var _0xca57=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa57c[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0xca57('0x0'));var logger=require(_0xca57('0x1'))('api');var moment=require(_0xca57('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca57('0x3'));var rimraf=require(_0xca57('0x4'));var config=require('../../config/environment');var attributes=require(_0xca57('0x5'));module[_0xca57('0x6')]=function(_0x53ba60,_0x53ee3c){return _0x53ba60[_0xca57('0x7')](_0xca57('0x8'),attributes,{'tableName':_0xca57('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 56c2d0f..05b9917 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 _0xe2ab=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x4b19cf,_0x24be08){_0x4b19cf=_0x4b19cf-0x0;var _0x4fdb3b=_0xe2ab[_0x4b19cf];return _0x4fdb3b;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require(_0xbe2a('0x7'))(_0xbe2a('0x8'));var config=require(_0xbe2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f504b,_0x58b8f1,_0x5a8a5d){return new BPromise(function(_0xfccbff,_0x232194){return client['request'](_0x2f504b,_0x5a8a5d)['then'](function(_0x83d775){logger[_0xbe2a('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x58b8f1,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x58b8f1,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x83d775));if(_0x83d775['error']){if(_0x83d775['error']['code']===0x1f4){logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);return _0x232194(_0x83d775[_0xbe2a('0x10')]['message']);}logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')]['message']);return _0xfccbff(_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);}else{logger[_0xbe2a('0xb')](_0xbe2a('0x11'),_0x58b8f1,_0xbe2a('0xc'));_0xfccbff(_0x83d775[_0xbe2a('0x13')][_0xbe2a('0x12')]);}})[_0xbe2a('0x14')](function(_0x4395fe){logger['error'](_0xbe2a('0x11'),_0x58b8f1,_0x4395fe);_0x232194(_0x4395fe);});});} \ No newline at end of file +var _0x8863=['catch','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0xed86e7,_0x3c3545){var _0x1e5bdb=function(_0x10396e){while(--_0x10396e){_0xed86e7['push'](_0xed86e7['shift']());}};_0x1e5bdb(++_0x3c3545);}(_0x8863,0x1b6));var _0x3886=function(_0x1eee6e,_0x12f7a3){_0x1eee6e=_0x1eee6e-0x0;var _0x3caf1d=_0x8863[_0x1eee6e];return _0x3caf1d;};'use strict';var _=require('lodash');var util=require(_0x3886('0x0'));var moment=require(_0x3886('0x1'));var BPromise=require(_0x3886('0x2'));var rs=require(_0x3886('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3886('0x4'));var config=require(_0x3886('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3886('0x6')][_0x3886('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x566503,_0x25d62e,_0x6edf8a){return new BPromise(function(_0x3a7943,_0x2718ec){return client['request'](_0x566503,_0x6edf8a)[_0x3886('0x8')](function(_0x2dbdc1){logger[_0x3886('0x9')](_0x3886('0xa'),_0x25d62e,_0x3886('0xb'));logger['debug'](_0x3886('0xc'),_0x25d62e,_0x3886('0xb'),JSON[_0x3886('0xd')](_0x2dbdc1));if(_0x2dbdc1['error']){if(_0x2dbdc1['error'][_0x3886('0xe')]===0x1f4){logger[_0x3886('0xf')](_0x3886('0xa'),_0x25d62e,_0x2dbdc1[_0x3886('0xf')][_0x3886('0x10')]);return _0x2718ec(_0x2dbdc1[_0x3886('0xf')][_0x3886('0x10')]);}logger[_0x3886('0xf')](_0x3886('0xa'),_0x25d62e,_0x2dbdc1[_0x3886('0xf')][_0x3886('0x10')]);return _0x3a7943(_0x2dbdc1[_0x3886('0xf')]['message']);}else{logger[_0x3886('0x9')](_0x3886('0xa'),_0x25d62e,'request\x20sent');_0x3a7943(_0x2dbdc1[_0x3886('0x11')]['message']);}})[_0x3886('0x12')](function(_0xdbb8c){logger[_0x3886('0xf')](_0x3886('0xa'),_0x25d62e,_0xdbb8c);_0x2718ec(_0xdbb8c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a5e7e6f..4257456 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 _0x59b9=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create'];(function(_0x1ae35e,_0x5dc0d9){var _0x1f83f1=function(_0x1f2fff){while(--_0x1f2fff){_0x1ae35e['push'](_0x1ae35e['shift']());}};_0x1f83f1(++_0x5dc0d9);}(_0x59b9,0x15b));var _0x959b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x59b9[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x959b('0x0'));var util=require('util');var path=require(_0x959b('0x1'));var timeout=require(_0x959b('0x2'));var express=require(_0x959b('0x3'));var router=express[_0x959b('0x4')]();var fs_extra=require(_0x959b('0x5'));var auth=require(_0x959b('0x6'));var interaction=require(_0x959b('0x7'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x959b('0x8')]('/',auth[_0x959b('0x9')](),controller['index']);router['get'](_0x959b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x959b('0xb')]('/',auth[_0x959b('0x9')](),controller[_0x959b('0xc')]);router[_0x959b('0xd')](_0x959b('0xa'),auth[_0x959b('0x9')](),controller[_0x959b('0xe')]);router[_0x959b('0xf')]('/:id',auth[_0x959b('0x9')](),controller[_0x959b('0x10')]);module[_0x959b('0x11')]=router; \ No newline at end of file +var _0xec0c=['../../components/interaction/service','isAuthenticated','get','show','post','/:id','delete','exports','multer','util','path','express','fs-extra'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xec0c,0xa4));var _0xcec0=function(_0x40b947,_0x15a799){_0x40b947=_0x40b947-0x0;var _0x2e2ef0=_0xec0c[_0x40b947];return _0x2e2ef0;};'use strict';var multer=require(_0xcec0('0x0'));var util=require(_0xcec0('0x1'));var path=require(_0xcec0('0x2'));var timeout=require('connect-timeout');var express=require(_0xcec0('0x3'));var router=express['Router']();var fs_extra=require(_0xcec0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcec0('0x5'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0xcec0('0x6')](),controller['index']);router[_0xcec0('0x7')]('/:id',auth[_0xcec0('0x6')](),controller[_0xcec0('0x8')]);router[_0xcec0('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcec0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcec0('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcec0('0xc')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b669980..b3d0e49 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 _0x8a9b=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x58aad3,_0x2a1647){var _0x2618d9=function(_0x3b760a){while(--_0x3b760a){_0x58aad3['push'](_0x58aad3['shift']());}};_0x2618d9(++_0x2a1647);}(_0x8a9b,0x14f));var _0xb8a9=function(_0x585088,_0x4702ce){_0x585088=_0x585088-0x0;var _0x4e721a=_0x8a9b[_0x585088];return _0x4e721a;};'use strict';var Sequelize=require(_0xb8a9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb8a9('0x1'),_0xb8a9('0x2'),_0xb8a9('0x3'),_0xb8a9('0x4'),_0xb8a9('0x5')),'defaultValue':_0xb8a9('0x1')},'content':{'type':Sequelize[_0xb8a9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xb8a9('0x2'),_0xb8a9('0x3'))},'keyContent':{'type':Sequelize[_0xb8a9('0x6')]},'idField':{'type':Sequelize[_0xb8a9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb8a9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8a9('0x6')]}}; \ No newline at end of file +var _0x5197=['string','variable','keyValue','STRING','ENUM','customVariable','exports'];(function(_0x25d123,_0x1360aa){var _0xcaef=function(_0x76ed5){while(--_0x76ed5){_0x25d123['push'](_0x25d123['shift']());}};_0xcaef(++_0x1360aa);}(_0x5197,0xdf));var _0x7519=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5197[_0x279d37];return _0x530173;};'use strict';var Sequelize=require('sequelize');module[_0x7519('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7519('0x1'),_0x7519('0x2'),'customVariable',_0x7519('0x3'),'picklist'),'defaultValue':_0x7519('0x1')},'content':{'type':Sequelize[_0x7519('0x4')]},'key':{'type':Sequelize[_0x7519('0x4')]},'keyType':{'type':Sequelize[_0x7519('0x5')](_0x7519('0x1'),_0x7519('0x2'),_0x7519('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7519('0x4')]},'nameField':{'type':Sequelize[_0x7519('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7519('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 854a984..3a3945d 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 _0xacea=['status','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','count','includeAll','findAll','show','params','length','include','find','create','catch','update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','limit','undefined','set','Content-Range','json','reject','save','then','destroy','stack','name'];(function(_0x511a19,_0x417e36){var _0x499aa6=function(_0x270874){while(--_0x270874){_0x511a19['push'](_0x511a19['shift']());}};_0x499aa6(++_0x417e36);}(_0xacea,0x1d2));var _0xaace=function(_0x4e9b3b,_0x147f0b){_0x4e9b3b=_0x4e9b3b-0x0;var _0x25c65d=_0xacea[_0x4e9b3b];return _0x25c65d;};'use strict';var emlformat=require(_0xaace('0x0'));var rimraf=require(_0xaace('0x1'));var zipdir=require(_0xaace('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaace('0x3'));var moment=require(_0xaace('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaace('0x5'));var util=require('util');var path=require(_0xaace('0x6'));var sox=require(_0xaace('0x7'));var csv=require(_0xaace('0x8'));var ejs=require(_0xaace('0x9'));var fs=require('fs');var fs_extra=require(_0xaace('0xa'));var _=require(_0xaace('0xb'));var squel=require(_0xaace('0xc'));var crypto=require(_0xaace('0xd'));var jsforce=require(_0xaace('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaace('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaace('0x10'));var qs=require(_0xaace('0x11'));var as=require(_0xaace('0x12'));var hardwareService=require(_0xaace('0x13'));var logger=require('../../config/logger')(_0xaace('0x14'));var utils=require(_0xaace('0x15'));var config=require(_0xaace('0x16'));var licenseUtil=require(_0xaace('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bfd19,_0xbc1edf){_0xbc1edf=_0xbc1edf||0xcc;return function(_0x3727ad){if(_0x3727ad){return _0x3bfd19[_0xaace('0x18')](_0xbc1edf);}return _0x3bfd19['status'](_0xbc1edf)[_0xaace('0x19')]();};}function respondWithResult(_0x59323c,_0x1e2287){_0x1e2287=_0x1e2287||0xc8;return function(_0x36204f){if(_0x36204f){return _0x59323c['status'](_0x1e2287)['json'](_0x36204f);}};}function respondWithFilteredResult(_0x366be9,_0x42c302){return function(_0x2d64e0){if(_0x2d64e0){var _0x3d6a34=typeof _0x42c302[_0xaace('0x1a')]==='undefined'&&typeof _0x42c302[_0xaace('0x1b')]===_0xaace('0x1c');var _0x23b500=_0x2d64e0['count'];var _0x3e71cf=_0x3d6a34?0x0:_0x42c302['offset'];var _0x560200=_0x3d6a34?_0x2d64e0['count']:_0x42c302['offset']+_0x42c302[_0xaace('0x1b')];var _0x4b4ff2;if(_0x560200>=_0x23b500){_0x560200=_0x23b500;_0x4b4ff2=0xc8;}else{_0x4b4ff2=0xce;}_0x366be9['status'](_0x4b4ff2);return _0x366be9[_0xaace('0x1d')](_0xaace('0x1e'),_0x3e71cf+'-'+_0x560200+'/'+_0x23b500)[_0xaace('0x1f')](_0x2d64e0);}return null;};}function patchUpdates(_0x3ca1df){return function(_0x37471a){try{jsonpatch['apply'](_0x37471a,_0x3ca1df,!![]);}catch(_0x59d98f){return BPromise[_0xaace('0x20')](_0x59d98f);}return _0x37471a[_0xaace('0x21')]();};}function saveUpdates(_0x1d9976,_0x177d18){return function(_0x46faea){if(_0x46faea){return _0x46faea['update'](_0x1d9976)[_0xaace('0x22')](function(_0xf9c26){return _0xf9c26;});}return null;};}function removeEntity(_0x18e8de,_0x258c70){return function(_0x4b88f7){if(_0x4b88f7){return _0x4b88f7[_0xaace('0x23')]()[_0xaace('0x22')](function(){_0x18e8de['status'](0xcc)[_0xaace('0x19')]();});}};}function handleEntityNotFound(_0x421e36,_0x4788a5){return function(_0x5dc773){if(!_0x5dc773){_0x421e36[_0xaace('0x18')](0x194);}return _0x5dc773;};}function handleError(_0x464b88,_0x50b4bd){_0x50b4bd=_0x50b4bd||0x1f4;return function(_0x1360c4){logger['error'](_0x1360c4[_0xaace('0x24')]);if(_0x1360c4[_0xaace('0x25')]){delete _0x1360c4[_0xaace('0x25')];}_0x464b88[_0xaace('0x26')](_0x50b4bd)['send'](_0x1360c4);};}exports[_0xaace('0x27')]=function(_0x1ab969,_0x5b34e6){var _0x309357={},_0x1fb86={},_0x15228f={'count':0x0,'rows':[]};var _0x2f83af=_[_0xaace('0x28')](db[_0xaace('0x29')][_0xaace('0x2a')],function(_0x352de1){return{'name':_0x352de1[_0xaace('0x2b')],'type':_0x352de1[_0xaace('0x2c')][_0xaace('0x2d')]};});_0x1fb86[_0xaace('0x2e')]=_[_0xaace('0x28')](_0x2f83af,'name');_0x1fb86[_0xaace('0x2f')]=_[_0xaace('0x30')](_0x1ab969['query']);_0x1fb86[_0xaace('0x31')]=_[_0xaace('0x32')](_0x1fb86[_0xaace('0x2e')],_0x1fb86[_0xaace('0x2f')]);_0x309357[_0xaace('0x33')]=_[_0xaace('0x32')](_0x1fb86[_0xaace('0x2e')],qs[_0xaace('0x34')](_0x1ab969['query'][_0xaace('0x34')]));_0x309357[_0xaace('0x33')]=_0x309357[_0xaace('0x33')]['length']?_0x309357['attributes']:_0x1fb86[_0xaace('0x2e')];if(!_0x1ab969['query']['hasOwnProperty'](_0xaace('0x35'))){_0x309357['limit']=qs['limit'](_0x1ab969['query'][_0xaace('0x1b')]);_0x309357[_0xaace('0x1a')]=qs[_0xaace('0x1a')](_0x1ab969['query'][_0xaace('0x1a')]);}_0x309357[_0xaace('0x36')]=qs[_0xaace('0x37')](_0x1ab969['query'][_0xaace('0x37')]);_0x309357[_0xaace('0x38')]=qs[_0xaace('0x31')](_[_0xaace('0x39')](_0x1ab969[_0xaace('0x2f')],_0x1fb86[_0xaace('0x31')]),_0x2f83af);if(_0x1ab969[_0xaace('0x2f')][_0xaace('0x3a')]){_0x309357['where']=_[_0xaace('0x3b')](_0x309357[_0xaace('0x38')],{'$or':_[_0xaace('0x28')](_0x2f83af,function(_0x4a4a1f){if(_0x4a4a1f['type']!=='VIRTUAL'){var _0x42e5c9={};_0x42e5c9[_0x4a4a1f['name']]={'$like':'%'+_0x1ab969['query']['filter']+'%'};return _0x42e5c9;}})});}_0x309357=_[_0xaace('0x3b')]({},_0x309357,_0x1ab969['options']);var _0x36d967={'where':_0x309357[_0xaace('0x38')]};return db[_0xaace('0x29')]['count'](_0x36d967)['then'](function(_0x248076){_0x15228f[_0xaace('0x3c')]=_0x248076;if(_0x1ab969[_0xaace('0x2f')][_0xaace('0x3d')]){_0x309357['include']=[{'all':!![]}];}return db['DeskField'][_0xaace('0x3e')](_0x309357);})[_0xaace('0x22')](function(_0x41c779){_0x15228f['rows']=_0x41c779;return _0x15228f;})['then'](respondWithFilteredResult(_0x5b34e6,_0x309357))['catch'](handleError(_0x5b34e6,null));};exports[_0xaace('0x3f')]=function(_0x222155,_0xb25499){var _0x1c56e3={'raw':!![],'where':{'id':_0x222155[_0xaace('0x40')]['id']}},_0x57cf3e={};_0x57cf3e['model']=_[_0xaace('0x30')](db[_0xaace('0x29')]['rawAttributes']);_0x57cf3e[_0xaace('0x2f')]=_[_0xaace('0x30')](_0x222155['query']);_0x57cf3e[_0xaace('0x31')]=_['intersection'](_0x57cf3e[_0xaace('0x2e')],_0x57cf3e[_0xaace('0x2f')]);_0x1c56e3[_0xaace('0x33')]=_[_0xaace('0x32')](_0x57cf3e[_0xaace('0x2e')],qs[_0xaace('0x34')](_0x222155['query'][_0xaace('0x34')]));_0x1c56e3[_0xaace('0x33')]=_0x1c56e3[_0xaace('0x33')][_0xaace('0x41')]?_0x1c56e3['attributes']:_0x57cf3e[_0xaace('0x2e')];if(_0x222155['query'][_0xaace('0x3d')]){_0x1c56e3[_0xaace('0x42')]=[{'all':!![]}];}_0x1c56e3=_[_0xaace('0x3b')]({},_0x1c56e3,_0x222155['options']);return db[_0xaace('0x29')][_0xaace('0x43')](_0x1c56e3)[_0xaace('0x22')](handleEntityNotFound(_0xb25499,null))[_0xaace('0x22')](respondWithResult(_0xb25499,null))['catch'](handleError(_0xb25499,null));};exports[_0xaace('0x44')]=function(_0x4f0171,_0x444b99){return db[_0xaace('0x29')]['create'](_0x4f0171['body'],{})[_0xaace('0x22')](respondWithResult(_0x444b99,0xc9))[_0xaace('0x45')](handleError(_0x444b99,null));};exports[_0xaace('0x46')]=function(_0x496470,_0x161455){if(_0x496470['body']['id']){delete _0x496470[_0xaace('0x47')]['id'];}return db[_0xaace('0x29')][_0xaace('0x43')]({'where':{'id':_0x496470[_0xaace('0x40')]['id']}})[_0xaace('0x22')](handleEntityNotFound(_0x161455,null))['then'](saveUpdates(_0x496470[_0xaace('0x47')],null))[_0xaace('0x22')](respondWithResult(_0x161455,null))[_0xaace('0x45')](handleError(_0x161455,null));};exports[_0xaace('0x23')]=function(_0x5b2970,_0x53bca0){return db['DeskField'][_0xaace('0x43')]({'where':{'id':_0x5b2970[_0xaace('0x40')]['id']}})['then'](handleEntityNotFound(_0x53bca0,null))[_0xaace('0x22')](removeEntity(_0x53bca0,null))[_0xaace('0x45')](handleError(_0x53bca0,null));}; \ No newline at end of file +var _0xb2b4=['sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','name','send','index','DeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1a6c82,_0x1c6016){var _0x28cc3a=function(_0x14db4b){while(--_0x14db4b){_0x1a6c82['push'](_0x1a6c82['shift']());}};_0x28cc3a(++_0x1c6016);}(_0xb2b4,0x141));var _0x4b2b=function(_0x23a299,_0x30e49c){_0x23a299=_0x23a299-0x0;var _0x560bb3=_0xb2b4[_0x23a299];return _0x560bb3;};'use strict';var emlformat=require(_0x4b2b('0x0'));var rimraf=require(_0x4b2b('0x1'));var zipdir=require(_0x4b2b('0x2'));var jsonpatch=require(_0x4b2b('0x3'));var rp=require(_0x4b2b('0x4'));var moment=require('moment');var BPromise=require(_0x4b2b('0x5'));var Mustache=require(_0x4b2b('0x6'));var util=require(_0x4b2b('0x7'));var path=require(_0x4b2b('0x8'));var sox=require(_0x4b2b('0x9'));var csv=require(_0x4b2b('0xa'));var ejs=require(_0x4b2b('0xb'));var fs=require('fs');var fs_extra=require(_0x4b2b('0xc'));var _=require(_0x4b2b('0xd'));var squel=require(_0x4b2b('0xe'));var crypto=require('crypto');var jsforce=require(_0x4b2b('0xf'));var deskjs=require(_0x4b2b('0x10'));var toCsv=require(_0x4b2b('0xa'));var querystring=require('querystring');var Papa=require(_0x4b2b('0x11'));var Redis=require(_0x4b2b('0x12'));var authService=require(_0x4b2b('0x13'));var qs=require(_0x4b2b('0x14'));var as=require(_0x4b2b('0x15'));var hardwareService=require(_0x4b2b('0x16'));var logger=require('../../config/logger')(_0x4b2b('0x17'));var utils=require(_0x4b2b('0x18'));var config=require(_0x4b2b('0x19'));var licenseUtil=require(_0x4b2b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13f26c,_0xb9919b){_0xb9919b=_0xb9919b||0xcc;return function(_0x3ec3a7){if(_0x3ec3a7){return _0x13f26c['sendStatus'](_0xb9919b);}return _0x13f26c[_0x4b2b('0x1b')](_0xb9919b)['end']();};}function respondWithResult(_0x904f80,_0x25a9db){_0x25a9db=_0x25a9db||0xc8;return function(_0x1bd34f){if(_0x1bd34f){return _0x904f80[_0x4b2b('0x1b')](_0x25a9db)[_0x4b2b('0x1c')](_0x1bd34f);}};}function respondWithFilteredResult(_0x8b764d,_0x49cd92){return function(_0x25c0bc){if(_0x25c0bc){var _0xa73fca=typeof _0x49cd92[_0x4b2b('0x1d')]===_0x4b2b('0x1e')&&typeof _0x49cd92[_0x4b2b('0x1f')]===_0x4b2b('0x1e');var _0x4bda81=_0x25c0bc[_0x4b2b('0x20')];var _0x42e656=_0xa73fca?0x0:_0x49cd92[_0x4b2b('0x1d')];var _0x157c81=_0xa73fca?_0x25c0bc[_0x4b2b('0x20')]:_0x49cd92[_0x4b2b('0x1d')]+_0x49cd92[_0x4b2b('0x1f')];var _0x9d54c4;if(_0x157c81>=_0x4bda81){_0x157c81=_0x4bda81;_0x9d54c4=0xc8;}else{_0x9d54c4=0xce;}_0x8b764d[_0x4b2b('0x1b')](_0x9d54c4);return _0x8b764d[_0x4b2b('0x21')]('Content-Range',_0x42e656+'-'+_0x157c81+'/'+_0x4bda81)[_0x4b2b('0x1c')](_0x25c0bc);}return null;};}function patchUpdates(_0x4c7649){return function(_0xc36148){try{jsonpatch[_0x4b2b('0x22')](_0xc36148,_0x4c7649,!![]);}catch(_0x7c1e09){return BPromise['reject'](_0x7c1e09);}return _0xc36148[_0x4b2b('0x23')]();};}function saveUpdates(_0x585850,_0x138d07){return function(_0x1de565){if(_0x1de565){return _0x1de565[_0x4b2b('0x24')](_0x585850)['then'](function(_0x24f538){return _0x24f538;});}return null;};}function removeEntity(_0x455890,_0xaac592){return function(_0x1fdb0d){if(_0x1fdb0d){return _0x1fdb0d[_0x4b2b('0x25')]()[_0x4b2b('0x26')](function(){_0x455890[_0x4b2b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a74e4,_0x1af3b7){return function(_0x7d3c21){if(!_0x7d3c21){_0x2a74e4['sendStatus'](0x194);}return _0x7d3c21;};}function handleError(_0x236fc7,_0x2d018a){_0x2d018a=_0x2d018a||0x1f4;return function(_0x2d2485){logger[_0x4b2b('0x27')](_0x2d2485['stack']);if(_0x2d2485[_0x4b2b('0x28')]){delete _0x2d2485['name'];}_0x236fc7['status'](_0x2d018a)[_0x4b2b('0x29')](_0x2d2485);};}exports[_0x4b2b('0x2a')]=function(_0x585fed,_0x1fba36){var _0x6cb317={},_0x16b8d4={},_0x3298ef={'count':0x0,'rows':[]};var _0x24d85c=_['map'](db[_0x4b2b('0x2b')][_0x4b2b('0x2c')],function(_0x3eed02){return{'name':_0x3eed02[_0x4b2b('0x2d')],'type':_0x3eed02[_0x4b2b('0x2e')][_0x4b2b('0x2f')]};});_0x16b8d4['model']=_[_0x4b2b('0x30')](_0x24d85c,_0x4b2b('0x28'));_0x16b8d4[_0x4b2b('0x31')]=_[_0x4b2b('0x32')](_0x585fed[_0x4b2b('0x31')]);_0x16b8d4[_0x4b2b('0x33')]=_['intersection'](_0x16b8d4[_0x4b2b('0x34')],_0x16b8d4[_0x4b2b('0x31')]);_0x6cb317[_0x4b2b('0x35')]=_[_0x4b2b('0x36')](_0x16b8d4[_0x4b2b('0x34')],qs[_0x4b2b('0x37')](_0x585fed[_0x4b2b('0x31')]['fields']));_0x6cb317[_0x4b2b('0x35')]=_0x6cb317[_0x4b2b('0x35')][_0x4b2b('0x38')]?_0x6cb317[_0x4b2b('0x35')]:_0x16b8d4[_0x4b2b('0x34')];if(!_0x585fed['query'][_0x4b2b('0x39')](_0x4b2b('0x3a'))){_0x6cb317[_0x4b2b('0x1f')]=qs[_0x4b2b('0x1f')](_0x585fed[_0x4b2b('0x31')][_0x4b2b('0x1f')]);_0x6cb317['offset']=qs['offset'](_0x585fed[_0x4b2b('0x31')][_0x4b2b('0x1d')]);}_0x6cb317['order']=qs[_0x4b2b('0x3b')](_0x585fed['query'][_0x4b2b('0x3b')]);_0x6cb317[_0x4b2b('0x3c')]=qs['filters'](_[_0x4b2b('0x3d')](_0x585fed[_0x4b2b('0x31')],_0x16b8d4[_0x4b2b('0x33')]),_0x24d85c);if(_0x585fed[_0x4b2b('0x31')]['filter']){_0x6cb317['where']=_[_0x4b2b('0x3e')](_0x6cb317[_0x4b2b('0x3c')],{'$or':_[_0x4b2b('0x30')](_0x24d85c,function(_0x5a78ea){if(_0x5a78ea[_0x4b2b('0x2e')]!==_0x4b2b('0x3f')){var _0x3e1b50={};_0x3e1b50[_0x5a78ea[_0x4b2b('0x28')]]={'$like':'%'+_0x585fed['query'][_0x4b2b('0x40')]+'%'};return _0x3e1b50;}})});}_0x6cb317=_[_0x4b2b('0x3e')]({},_0x6cb317,_0x585fed[_0x4b2b('0x41')]);var _0x5aa464={'where':_0x6cb317['where']};return db['DeskField'][_0x4b2b('0x20')](_0x5aa464)[_0x4b2b('0x26')](function(_0x3b43d6){_0x3298ef['count']=_0x3b43d6;if(_0x585fed[_0x4b2b('0x31')]['includeAll']){_0x6cb317[_0x4b2b('0x42')]=[{'all':!![]}];}return db[_0x4b2b('0x2b')][_0x4b2b('0x43')](_0x6cb317);})['then'](function(_0x5690ce){_0x3298ef[_0x4b2b('0x44')]=_0x5690ce;return _0x3298ef;})[_0x4b2b('0x26')](respondWithFilteredResult(_0x1fba36,_0x6cb317))[_0x4b2b('0x45')](handleError(_0x1fba36,null));};exports[_0x4b2b('0x46')]=function(_0x3c4e44,_0x2d8d99){var _0x7ed360={'raw':!![],'where':{'id':_0x3c4e44[_0x4b2b('0x47')]['id']}},_0x47f930={};_0x47f930[_0x4b2b('0x34')]=_[_0x4b2b('0x32')](db[_0x4b2b('0x2b')]['rawAttributes']);_0x47f930[_0x4b2b('0x31')]=_['keys'](_0x3c4e44[_0x4b2b('0x31')]);_0x47f930[_0x4b2b('0x33')]=_['intersection'](_0x47f930[_0x4b2b('0x34')],_0x47f930[_0x4b2b('0x31')]);_0x7ed360['attributes']=_[_0x4b2b('0x36')](_0x47f930[_0x4b2b('0x34')],qs[_0x4b2b('0x37')](_0x3c4e44[_0x4b2b('0x31')][_0x4b2b('0x37')]));_0x7ed360[_0x4b2b('0x35')]=_0x7ed360['attributes'][_0x4b2b('0x38')]?_0x7ed360['attributes']:_0x47f930[_0x4b2b('0x34')];if(_0x3c4e44['query'][_0x4b2b('0x48')]){_0x7ed360[_0x4b2b('0x42')]=[{'all':!![]}];}_0x7ed360=_[_0x4b2b('0x3e')]({},_0x7ed360,_0x3c4e44['options']);return db[_0x4b2b('0x2b')]['find'](_0x7ed360)[_0x4b2b('0x26')](handleEntityNotFound(_0x2d8d99,null))[_0x4b2b('0x26')](respondWithResult(_0x2d8d99,null))[_0x4b2b('0x45')](handleError(_0x2d8d99,null));};exports['create']=function(_0x3df0d7,_0x367cfb){return db['DeskField'][_0x4b2b('0x49')](_0x3df0d7[_0x4b2b('0x4a')],{})[_0x4b2b('0x26')](respondWithResult(_0x367cfb,0xc9))[_0x4b2b('0x45')](handleError(_0x367cfb,null));};exports[_0x4b2b('0x24')]=function(_0x505d47,_0x189045){if(_0x505d47[_0x4b2b('0x4a')]['id']){delete _0x505d47[_0x4b2b('0x4a')]['id'];}return db[_0x4b2b('0x2b')][_0x4b2b('0x4b')]({'where':{'id':_0x505d47[_0x4b2b('0x47')]['id']}})[_0x4b2b('0x26')](handleEntityNotFound(_0x189045,null))[_0x4b2b('0x26')](saveUpdates(_0x505d47[_0x4b2b('0x4a')],null))['then'](respondWithResult(_0x189045,null))[_0x4b2b('0x45')](handleError(_0x189045,null));};exports['destroy']=function(_0x23f1ca,_0x20b0e4){return db[_0x4b2b('0x2b')]['find']({'where':{'id':_0x23f1ca[_0x4b2b('0x47')]['id']}})[_0x4b2b('0x26')](handleEntityNotFound(_0x20b0e4,null))['then'](removeEntity(_0x20b0e4,null))['catch'](handleError(_0x20b0e4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d30545e..f17b41e 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 _0x91b3=['request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2d72dc,_0x39503c){var _0x492d9d=function(_0x1e9a3b){while(--_0x1e9a3b){_0x2d72dc['push'](_0x2d72dc['shift']());}};_0x492d9d(++_0x39503c);}(_0x91b3,0x1ea));var _0x391b=function(_0x212390,_0x2de335){_0x212390=_0x212390-0x0;var _0x46e140=_0x91b3[_0x212390];return _0x46e140;};'use strict';var _=require(_0x391b('0x0'));var util=require(_0x391b('0x1'));var logger=require(_0x391b('0x2'))(_0x391b('0x3'));var moment=require(_0x391b('0x4'));var BPromise=require(_0x391b('0x5'));var rp=require(_0x391b('0x6'));var fs=require('fs');var path=require(_0x391b('0x7'));var rimraf=require(_0x391b('0x8'));var config=require(_0x391b('0x9'));var attributes=require('./intDeskField.attributes');module[_0x391b('0xa')]=function(_0x441800,_0x9f6478){return _0x441800[_0x391b('0xb')](_0x391b('0xc'),attributes,{'tableName':_0x391b('0xd'),'paranoid':![],'indexes':[{'name':_0x391b('0xe'),'fields':[_0x391b('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa87=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId'];(function(_0x50c5af,_0x4fae47){var _0x150919=function(_0x208285){while(--_0x208285){_0x50c5af['push'](_0x50c5af['shift']());}};_0x150919(++_0x4fae47);}(_0xfa87,0x1d1));var _0x7fa8=function(_0x4c7e8e,_0x3c5035){_0x4c7e8e=_0x4c7e8e-0x0;var _0x503c3f=_0xfa87[_0x4c7e8e];return _0x503c3f;};'use strict';var _=require(_0x7fa8('0x0'));var util=require(_0x7fa8('0x1'));var logger=require(_0x7fa8('0x2'))(_0x7fa8('0x3'));var moment=require(_0x7fa8('0x4'));var BPromise=require(_0x7fa8('0x5'));var rp=require(_0x7fa8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fa8('0x7'));var config=require(_0x7fa8('0x8'));var attributes=require(_0x7fa8('0x9'));module[_0x7fa8('0xa')]=function(_0x44065e,_0x272beb){return _0x44065e[_0x7fa8('0xb')]('DeskField',attributes,{'tableName':_0x7fa8('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7fa8('0xd'),_0x7fa8('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 55b0599..eb89033 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 _0x065e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x100340,_0x87ca98){var _0x2b059f=function(_0x2e529e){while(--_0x2e529e){_0x100340['push'](_0x100340['shift']());}};_0x2b059f(++_0x87ca98);}(_0x065e,0xb9));var _0xe065=function(_0x308a49,_0x522c88){_0x308a49=_0x308a49-0x0;var _0x48a495=_0x065e[_0x308a49];return _0x48a495;};'use strict';var _=require(_0xe065('0x0'));var util=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var rs=require(_0xe065('0x4'));var fs=require('fs');var Redis=require(_0xe065('0x5'));var db=require(_0xe065('0x6'))['db'];var utils=require(_0xe065('0x7'));var logger=require(_0xe065('0x8'))(_0xe065('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe065('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c617f,_0x4deb47,_0x37df35){return new BPromise(function(_0x1c9227,_0x516ca3){return client[_0xe065('0xb')](_0x4c617f,_0x37df35)[_0xe065('0xc')](function(_0x494dc0){logger[_0xe065('0xd')](_0xe065('0xe'),_0x4deb47,_0xe065('0xf'));logger['debug'](_0xe065('0x10'),_0x4deb47,_0xe065('0xf'),JSON[_0xe065('0x11')](_0x494dc0));if(_0x494dc0[_0xe065('0x12')]){if(_0x494dc0[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')](_0xe065('0xe'),_0x4deb47,_0x494dc0['error'][_0xe065('0x14')]);return _0x516ca3(_0x494dc0['error']['message']);}logger[_0xe065('0x12')]('DeskField,\x20%s,\x20%s',_0x4deb47,_0x494dc0[_0xe065('0x12')][_0xe065('0x14')]);return _0x1c9227(_0x494dc0[_0xe065('0x12')]['message']);}else{logger[_0xe065('0xd')](_0xe065('0xe'),_0x4deb47,_0xe065('0xf'));_0x1c9227(_0x494dc0[_0xe065('0x15')][_0xe065('0x14')]);}})[_0xe065('0x16')](function(_0x52b229){logger[_0xe065('0x12')]('DeskField,\x20%s,\x20%s',_0x4deb47,_0x52b229);_0x516ca3(_0x52b229);});});} \ No newline at end of file +var _0x38e9=['stringify','error','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x38e9,0x1ab));var _0x938e=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x38e9[_0x1857c6];return _0x51011c;};'use strict';var _=require(_0x938e('0x0'));var util=require(_0x938e('0x1'));var moment=require(_0x938e('0x2'));var BPromise=require(_0x938e('0x3'));var rs=require(_0x938e('0x4'));var fs=require('fs');var Redis=require(_0x938e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x938e('0x6'));var logger=require('../../config/logger')(_0x938e('0x7'));var config=require('../../config/environment');var jayson=require(_0x938e('0x8'));var client=jayson[_0x938e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2d5f,_0x5236e4,_0x4eaa3d){return new BPromise(function(_0x5f24f3,_0x184350){return client['request'](_0x4e2d5f,_0x4eaa3d)[_0x938e('0xa')](function(_0xb1ce0e){logger['info']('DeskField,\x20%s,\x20%s',_0x5236e4,_0x938e('0xb'));logger[_0x938e('0xc')](_0x938e('0xd'),_0x5236e4,_0x938e('0xb'),JSON[_0x938e('0xe')](_0xb1ce0e));if(_0xb1ce0e[_0x938e('0xf')]){if(_0xb1ce0e['error']['code']===0x1f4){logger[_0x938e('0xf')](_0x938e('0x10'),_0x5236e4,_0xb1ce0e[_0x938e('0xf')]['message']);return _0x184350(_0xb1ce0e['error'][_0x938e('0x11')]);}logger[_0x938e('0xf')](_0x938e('0x10'),_0x5236e4,_0xb1ce0e[_0x938e('0xf')][_0x938e('0x11')]);return _0x5f24f3(_0xb1ce0e[_0x938e('0xf')]['message']);}else{logger[_0x938e('0x12')](_0x938e('0x10'),_0x5236e4,'request\x20sent');_0x5f24f3(_0xb1ce0e[_0x938e('0x13')][_0x938e('0x11')]);}})[_0x938e('0x14')](function(_0x59547e){logger[_0x938e('0xf')](_0x938e('0x10'),_0x5236e4,_0x59547e);_0x184350(_0x59547e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5f1d060..a89c0dd 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 _0xd6a3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','multer','util','path'];(function(_0x44875d,_0xa8f494){var _0x525604=function(_0x430bd5){while(--_0x430bd5){_0x44875d['push'](_0x44875d['shift']());}};_0x525604(++_0xa8f494);}(_0xd6a3,0xbd));var _0x3d6a=function(_0xf8d6,_0x10adf3){_0xf8d6=_0xf8d6-0x0;var _0x3a14be=_0xd6a3[_0xf8d6];return _0x3a14be;};'use strict';var multer=require(_0x3d6a('0x0'));var util=require(_0x3d6a('0x1'));var path=require(_0x3d6a('0x2'));var timeout=require(_0x3d6a('0x3'));var express=require(_0x3d6a('0x4'));var router=express[_0x3d6a('0x5')]();var fs_extra=require(_0x3d6a('0x6'));var auth=require(_0x3d6a('0x7'));var interaction=require(_0x3d6a('0x8'));var config=require(_0x3d6a('0x9'));var controller=require(_0x3d6a('0xa'));router[_0x3d6a('0xb')]('/',auth[_0x3d6a('0xc')](),controller[_0x3d6a('0xd')]);router[_0x3d6a('0xb')](_0x3d6a('0xe'),auth[_0x3d6a('0xc')](),controller['show']);router['get'](_0x3d6a('0xf'),auth[_0x3d6a('0xc')](),controller[_0x3d6a('0x10')]);router[_0x3d6a('0xb')](_0x3d6a('0x11'),auth[_0x3d6a('0xc')](),controller[_0x3d6a('0x12')]);router[_0x3d6a('0x13')]('/',auth[_0x3d6a('0xc')](),controller[_0x3d6a('0x14')]);router[_0x3d6a('0x13')]('/:id/configurations',auth[_0x3d6a('0xc')](),controller['addConfiguration']);router[_0x3d6a('0x15')](_0x3d6a('0xe'),auth['isAuthenticated'](),controller[_0x3d6a('0x16')]);router['delete'](_0x3d6a('0xe'),auth[_0x3d6a('0xc')](),controller[_0x3d6a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9f51=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x9f51,0x1bd));var _0x19f5=function(_0x29271a,_0x232277){_0x29271a=_0x29271a-0x0;var _0x10dc39=_0x9f51[_0x29271a];return _0x10dc39;};'use strict';var multer=require(_0x19f5('0x0'));var util=require(_0x19f5('0x1'));var path=require(_0x19f5('0x2'));var timeout=require(_0x19f5('0x3'));var express=require('express');var router=express[_0x19f5('0x4')]();var fs_extra=require(_0x19f5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x19f5('0x6'));var config=require('../../config/environment');var controller=require(_0x19f5('0x7'));router[_0x19f5('0x8')]('/',auth[_0x19f5('0x9')](),controller[_0x19f5('0xa')]);router[_0x19f5('0x8')]('/:id',auth[_0x19f5('0x9')](),controller['show']);router['get'](_0x19f5('0xb'),auth[_0x19f5('0x9')](),controller['getConfigurations']);router['get'](_0x19f5('0xc'),auth[_0x19f5('0x9')](),controller[_0x19f5('0xd')]);router['post']('/',auth[_0x19f5('0x9')](),controller['create']);router[_0x19f5('0xe')](_0x19f5('0xb'),auth[_0x19f5('0x9')](),controller['addConfiguration']);router[_0x19f5('0xf')](_0x19f5('0x10'),auth[_0x19f5('0x9')](),controller['update']);router[_0x19f5('0x11')](_0x19f5('0x10'),auth[_0x19f5('0x9')](),controller[_0x19f5('0x12')]);module[_0x19f5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4ffd7b3..c7fa46a 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 _0x09f4=['STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09f4,0xe4));var _0x409f=function(_0x366d91,_0x4abd6c){_0x366d91=_0x366d91-0x0;var _0x11ac2c=_0x09f4[_0x366d91];return _0x11ac2c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'username':{'type':Sequelize[_0x409f('0x0')]},'password':{'type':Sequelize[_0x409f('0x0')]},'remoteUri':{'type':Sequelize[_0x409f('0x0')]},'tenantId':{'type':Sequelize[_0x409f('0x0')]},'clientId':{'type':Sequelize[_0x409f('0x0')]},'clientSecret':{'type':Sequelize[_0x409f('0x0')]},'serverUrl':{'type':Sequelize[_0x409f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x409f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x409f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc4f5=['exports','STRING','BOOLEAN'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0xc4f5[_0x5a91a5];return _0x8f99de;};'use strict';var Sequelize=require('sequelize');module[_0x5c4f('0x0')]={'name':{'type':Sequelize[_0x5c4f('0x1')]},'username':{'type':Sequelize[_0x5c4f('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5c4f('0x1')]},'tenantId':{'type':Sequelize[_0x5c4f('0x1')]},'clientId':{'type':Sequelize[_0x5c4f('0x1')]},'clientSecret':{'type':Sequelize[_0x5c4f('0x1')]},'serverUrl':{'type':Sequelize[_0x5c4f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5c4f('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 7e78743..f88a3b6 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 _0xc9cc=['keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','Dynamics365Configuration','order','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','actualserviceunits','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/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)','TrueOption','true',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','Content-Range','update','then','status','end','stack','name','send','Dynamics365Account','fieldName','type','key','model','map','query'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xc9cc,0x162));var _0xcc9c=function(_0x4fb452,_0x32f7b3){_0x4fb452=_0x4fb452-0x0;var _0x35b1bd=_0xc9cc[_0x4fb452];return _0x35b1bd;};'use strict';var rp=require('request-promise');var util=require(_0xcc9c('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xcc9c('0x1'))('api');var db=require(_0xcc9c('0x2'))['db'];var integrations=require(_0xcc9c('0x3'));function respondWithResult(_0x32d394,_0x7ff968){_0x7ff968=_0x7ff968||0xc8;return function(_0x563052){if(_0x563052){return _0x32d394['status'](_0x7ff968)[_0xcc9c('0x4')](_0x563052);}};}function respondWithFilteredResult(_0x1d0508,_0x360166){return function(_0x4b4369){if(_0x4b4369){var _0x559aad=typeof _0x360166[_0xcc9c('0x5')]===_0xcc9c('0x6')&&typeof _0x360166[_0xcc9c('0x7')]===_0xcc9c('0x6');var _0x2d6af7=_0x4b4369[_0xcc9c('0x8')];var _0x14168e=_0x559aad?0x0:_0x360166[_0xcc9c('0x5')];var _0x5b995b=_0x559aad?_0x4b4369[_0xcc9c('0x8')]:_0x360166['offset']+_0x360166[_0xcc9c('0x7')];var _0x9a16b5;if(_0x5b995b>=_0x2d6af7){_0x5b995b=_0x2d6af7;_0x9a16b5=0xc8;}else{_0x9a16b5=0xce;}_0x1d0508['status'](_0x9a16b5);return _0x1d0508['set'](_0xcc9c('0x9'),_0x14168e+'-'+_0x5b995b+'/'+_0x2d6af7)[_0xcc9c('0x4')](_0x4b4369);}return null;};}function saveUpdates(_0x4bd435){return function(_0x12a4cb){if(_0x12a4cb){return _0x12a4cb[_0xcc9c('0xa')](_0x4bd435)[_0xcc9c('0xb')](function(_0x141e2e){return _0x141e2e;});}return null;};}function removeEntity(_0x5922a5){return function(_0x4928cd){if(_0x4928cd){return _0x4928cd['destroy']()[_0xcc9c('0xb')](function(){_0x5922a5[_0xcc9c('0xc')](0xcc)[_0xcc9c('0xd')]();});}};}function handleEntityNotFound(_0x5de0af){return function(_0x53dc89){if(!_0x53dc89){_0x5de0af['sendStatus'](0x194);}return _0x53dc89;};}function handleError(_0x57184,_0x140bc0){_0x140bc0=_0x140bc0||0x1f4;return function(_0x2ae6aa){logger['error'](_0x2ae6aa[_0xcc9c('0xe')]);if(_0x2ae6aa[_0xcc9c('0xf')]){delete _0x2ae6aa[_0xcc9c('0xf')];}_0x57184[_0xcc9c('0xc')](_0x140bc0)[_0xcc9c('0x10')](_0x2ae6aa);};}exports['index']=function(_0x2e32bc,_0x5781c6){var _0x36bd89={},_0x53e846={},_0x2d0f17={'count':0x0,'rows':[]};var _0x364c29=_['map'](db[_0xcc9c('0x11')]['rawAttributes'],function(_0x4ebd42){return{'name':_0x4ebd42[_0xcc9c('0x12')],'type':_0x4ebd42[_0xcc9c('0x13')][_0xcc9c('0x14')]};});_0x53e846[_0xcc9c('0x15')]=_[_0xcc9c('0x16')](_0x364c29,_0xcc9c('0xf'));_0x53e846[_0xcc9c('0x17')]=_[_0xcc9c('0x18')](_0x2e32bc[_0xcc9c('0x17')]);_0x53e846[_0xcc9c('0x19')]=_[_0xcc9c('0x1a')](_0x53e846[_0xcc9c('0x15')],_0x53e846[_0xcc9c('0x17')]);_0x36bd89[_0xcc9c('0x1b')]=_['intersection'](_0x53e846[_0xcc9c('0x15')],qs[_0xcc9c('0x1c')](_0x2e32bc[_0xcc9c('0x17')][_0xcc9c('0x1c')]));_0x36bd89[_0xcc9c('0x1b')]=_0x36bd89['attributes'][_0xcc9c('0x1d')]?_0x36bd89['attributes']:_0x53e846[_0xcc9c('0x15')];if(!_0x2e32bc[_0xcc9c('0x17')]['hasOwnProperty'](_0xcc9c('0x1e'))){_0x36bd89[_0xcc9c('0x7')]=qs[_0xcc9c('0x7')](_0x2e32bc[_0xcc9c('0x17')]['limit']);_0x36bd89[_0xcc9c('0x5')]=qs[_0xcc9c('0x5')](_0x2e32bc[_0xcc9c('0x17')][_0xcc9c('0x5')]);}_0x36bd89['order']=qs[_0xcc9c('0x1f')](_0x2e32bc[_0xcc9c('0x17')][_0xcc9c('0x1f')]);_0x36bd89[_0xcc9c('0x20')]=qs[_0xcc9c('0x19')](_[_0xcc9c('0x21')](_0x2e32bc['query'],_0x53e846[_0xcc9c('0x19')]),_0x364c29);if(_0x2e32bc[_0xcc9c('0x17')]['filter']){_0x36bd89[_0xcc9c('0x20')]=_['merge'](_0x36bd89[_0xcc9c('0x20')],{'$or':_[_0xcc9c('0x16')](_0x364c29,function(_0x39e241){if(_0x39e241[_0xcc9c('0x13')]!==_0xcc9c('0x22')){var _0x27e777={};_0x27e777[_0x39e241[_0xcc9c('0xf')]]={'$like':'%'+_0x2e32bc['query'][_0xcc9c('0x23')]+'%'};return _0x27e777;}})});}_0x36bd89=_[_0xcc9c('0x24')]({},_0x36bd89,_0x2e32bc[_0xcc9c('0x25')]);var _0x355f77={'where':_0x36bd89[_0xcc9c('0x20')]};return db[_0xcc9c('0x11')]['count'](_0x355f77)[_0xcc9c('0xb')](function(_0x18c817){_0x2d0f17['count']=_0x18c817;if(_0x2e32bc[_0xcc9c('0x17')][_0xcc9c('0x26')]){_0x36bd89[_0xcc9c('0x27')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xcc9c('0x28')](_0x36bd89);})[_0xcc9c('0xb')](function(_0x184e55){_0x2d0f17[_0xcc9c('0x29')]=_0x184e55;return _0x2d0f17;})[_0xcc9c('0xb')](respondWithFilteredResult(_0x5781c6,_0x36bd89))[_0xcc9c('0x2a')](handleError(_0x5781c6,null));};exports[_0xcc9c('0x2b')]=function(_0x154384,_0x7c7de3){var _0x7d3f1={'raw':![],'where':{'id':_0x154384[_0xcc9c('0x2c')]['id']}},_0x587380={};_0x587380['model']=_[_0xcc9c('0x18')](db[_0xcc9c('0x11')][_0xcc9c('0x2d')]);_0x587380[_0xcc9c('0x17')]=_[_0xcc9c('0x18')](_0x154384['query']);_0x587380[_0xcc9c('0x19')]=_['intersection'](_0x587380[_0xcc9c('0x15')],_0x587380[_0xcc9c('0x17')]);_0x7d3f1[_0xcc9c('0x1b')]=_['intersection'](_0x587380['model'],qs[_0xcc9c('0x1c')](_0x154384[_0xcc9c('0x17')]['fields']));_0x7d3f1[_0xcc9c('0x1b')]=_0x7d3f1[_0xcc9c('0x1b')][_0xcc9c('0x1d')]?_0x7d3f1[_0xcc9c('0x1b')]:_0x587380['model'];if(_0x154384[_0xcc9c('0x17')][_0xcc9c('0x26')]){_0x7d3f1[_0xcc9c('0x27')]=[{'all':!![]}];}_0x7d3f1=_['merge']({},_0x7d3f1,_0x154384[_0xcc9c('0x25')]);return db[_0xcc9c('0x11')][_0xcc9c('0x2e')](_0x7d3f1)[_0xcc9c('0xb')](handleEntityNotFound(_0x7c7de3,null))[_0xcc9c('0xb')](respondWithResult(_0x7c7de3,null))['catch'](handleError(_0x7c7de3,null));};exports['create']=function(_0x28397c,_0x2536a6){return db[_0xcc9c('0x11')][_0xcc9c('0x2f')](_0x28397c['body'],{})['then'](respondWithResult(_0x2536a6,0xc9))[_0xcc9c('0x2a')](handleError(_0x2536a6,null));};exports[_0xcc9c('0xa')]=function(_0x506f5c,_0x5330ea){if(_0x506f5c[_0xcc9c('0x30')]['id']){delete _0x506f5c[_0xcc9c('0x30')]['id'];}return db[_0xcc9c('0x11')][_0xcc9c('0x2e')]({'where':{'id':_0x506f5c[_0xcc9c('0x2c')]['id']}})[_0xcc9c('0xb')](handleEntityNotFound(_0x5330ea,null))[_0xcc9c('0xb')](saveUpdates(_0x506f5c[_0xcc9c('0x30')],null))[_0xcc9c('0xb')](respondWithResult(_0x5330ea,null))[_0xcc9c('0x2a')](handleError(_0x5330ea,null));};exports[_0xcc9c('0x31')]=function(_0x493053,_0x37545e){return db['Dynamics365Account'][_0xcc9c('0x2e')]({'where':{'id':_0x493053[_0xcc9c('0x2c')]['id']}})[_0xcc9c('0xb')](handleEntityNotFound(_0x37545e,null))[_0xcc9c('0xb')](removeEntity(_0x37545e,null))[_0xcc9c('0x2a')](handleError(_0x37545e,null));};exports['getConfigurations']=function(_0x3d4027,_0x1b1934){var _0xeda6b2={};var _0x53d505={};var _0x4f3bfb;var _0x134efe;return db[_0xcc9c('0x11')]['findOne']({'where':{'id':_0x3d4027['params']['id']}})[_0xcc9c('0xb')](handleEntityNotFound(_0x1b1934,null))[_0xcc9c('0xb')](function(_0x2449c1){if(_0x2449c1){_0x4f3bfb=_0x2449c1;_0x53d505['model']=_[_0xcc9c('0x18')](db[_0xcc9c('0x32')][_0xcc9c('0x2d')]);_0x53d505['query']=_[_0xcc9c('0x18')](_0x3d4027[_0xcc9c('0x17')]);_0x53d505['filters']=_[_0xcc9c('0x1a')](_0x53d505[_0xcc9c('0x15')],_0x53d505[_0xcc9c('0x17')]);_0xeda6b2[_0xcc9c('0x1b')]=_[_0xcc9c('0x1a')](_0x53d505['model'],qs['fields'](_0x3d4027[_0xcc9c('0x17')][_0xcc9c('0x1c')]));_0xeda6b2[_0xcc9c('0x1b')]=_0xeda6b2[_0xcc9c('0x1b')][_0xcc9c('0x1d')]?_0xeda6b2['attributes']:_0x53d505['model'];_0xeda6b2[_0xcc9c('0x33')]=qs['sort'](_0x3d4027[_0xcc9c('0x17')][_0xcc9c('0x1f')]);_0xeda6b2['where']=qs['filters'](_[_0xcc9c('0x21')](_0x3d4027[_0xcc9c('0x17')],_0x53d505['filters']));if(_0x3d4027[_0xcc9c('0x17')][_0xcc9c('0x23')]){_0xeda6b2['where']=_['merge'](_0xeda6b2[_0xcc9c('0x20')],{'$or':_[_0xcc9c('0x16')](_0xeda6b2['attributes'],function(_0xed4ce4){var _0x38a5cf={};_0x38a5cf[_0xed4ce4]={'$like':'%'+_0x3d4027[_0xcc9c('0x17')][_0xcc9c('0x23')]+'%'};return _0x38a5cf;})});}_0xeda6b2=_[_0xcc9c('0x24')]({},_0xeda6b2,_0x3d4027['options']);return _0x4f3bfb[_0xcc9c('0x34')](_0xeda6b2);}})['then'](function(_0x1fac75){if(_0x1fac75){_0x134efe=_0x1fac75[_0xcc9c('0x1d')];if(!_0x3d4027['query'][_0xcc9c('0x35')](_0xcc9c('0x1e'))){_0xeda6b2[_0xcc9c('0x7')]=qs[_0xcc9c('0x7')](_0x3d4027[_0xcc9c('0x17')][_0xcc9c('0x7')]);_0xeda6b2[_0xcc9c('0x5')]=qs['offset'](_0x3d4027[_0xcc9c('0x17')]['offset']);}return _0x4f3bfb[_0xcc9c('0x34')](_0xeda6b2);}})[_0xcc9c('0xb')](function(_0x44dee1){if(_0x44dee1){return _0x44dee1?{'count':_0x134efe,'rows':_0x44dee1}:null;}})['then'](respondWithResult(_0x1b1934,null))[_0xcc9c('0x2a')](handleError(_0x1b1934,null));};exports[_0xcc9c('0x36')]=function(_0x2b28a0,_0x29e3a5){if(_0x2b28a0['body']['id']){delete _0x2b28a0[_0xcc9c('0x30')]['id'];}return db[_0xcc9c('0x11')][_0xcc9c('0x37')]({'where':{'id':_0x2b28a0[_0xcc9c('0x2c')]['id']}})[_0xcc9c('0xb')](handleEntityNotFound(_0x29e3a5,null))[_0xcc9c('0xb')](function(_0x236e36){if(_0x236e36){_0x2b28a0[_0xcc9c('0x30')][_0xcc9c('0x38')]=_0x236e36['id'];_0x2b28a0[_0xcc9c('0x30')][_0xcc9c('0x39')]=integrations['getSubjects'](_0x2b28a0[_0xcc9c('0x30')]['channel'],_0x2b28a0[_0xcc9c('0x30')][_0xcc9c('0x13')]);_0x2b28a0[_0xcc9c('0x30')][_0xcc9c('0x3a')]=integrations[_0xcc9c('0x3b')](_0x2b28a0[_0xcc9c('0x30')][_0xcc9c('0x3c')],_0x2b28a0['body'][_0xcc9c('0x13')]);return db[_0xcc9c('0x32')][_0xcc9c('0x2f')](_0x2b28a0[_0xcc9c('0x30')],{'include':[{'model':db[_0xcc9c('0x3d')],'as':_0xcc9c('0x39')},{'model':db[_0xcc9c('0x3d')],'as':_0xcc9c('0x3a')}]});}return null;})[_0xcc9c('0xb')](respondWithResult(_0x29e3a5,null))[_0xcc9c('0x2a')](handleError(_0x29e3a5,null));};function sanitizeRemoteUri(_0x2371fc){var _0xb5b994=_0x2371fc['slice'](-0x1);if(_0xb5b994==='/')return _0x2371fc[_0xcc9c('0x3e')](0x0,_0x2371fc[_0xcc9c('0x3f')](_0xb5b994));return _0x2371fc;}function getWebApiUrl(_0x496be0){return util[_0xcc9c('0x40')](_0xcc9c('0x41'),_0x496be0);}exports[_0xcc9c('0x42')]=function(_0x39298b,_0x365be5){var _0x3d4662=_0x39298b[_0xcc9c('0x17')][_0xcc9c('0x43')];var _0x36d69b=_0x3d4662===_0xcc9c('0x44')?_0xcc9c('0x45'):_0xcc9c('0x46');var _0x296776='';var _0x27ad08='';var _0x4ab71b='';var _0x549e48='';var _0x383755='';var _0x41e938='';var _0x3e31e2='';var _0x5d7362='';var _0x1ec025=[_0xcc9c('0x47'),_0xcc9c('0x48'),_0xcc9c('0x49'),_0xcc9c('0x4a'),_0xcc9c('0x4b'),_0xcc9c('0x4c'),_0xcc9c('0x4d'),'regardingobjectid',_0xcc9c('0x4e'),_0xcc9c('0x4f')];var _0x37199c=['accountidname','accountidyominame',_0xcc9c('0x50'),'billedserviceunits','contactidname','contactidyominame',_0xcc9c('0x51'),'contractidname',_0xcc9c('0x52'),_0xcc9c('0x53'),_0xcc9c('0x54'),_0xcc9c('0x55'),_0xcc9c('0x56'),_0xcc9c('0x57'),_0xcc9c('0x58'),'customeridname','customeridtype',_0xcc9c('0x59'),_0xcc9c('0x5a'),_0xcc9c('0x5b'),'entityimage_timestamp',_0xcc9c('0x5c'),_0xcc9c('0x5d'),_0xcc9c('0x5e'),_0xcc9c('0x5f'),_0xcc9c('0x60'),'importsequencenumber',_0xcc9c('0x61'),_0xcc9c('0x62'),'lastonholdtime',_0xcc9c('0x63'),_0xcc9c('0x64'),_0xcc9c('0x65'),_0xcc9c('0x66'),_0xcc9c('0x67'),'modifiedon','modifiedonbehalfbyname',_0xcc9c('0x68'),_0xcc9c('0x69'),'msdyn_iotalertname',_0xcc9c('0x6a'),_0xcc9c('0x6b'),_0xcc9c('0x6c'),_0xcc9c('0x6d'),_0xcc9c('0x6e'),_0xcc9c('0x6f'),_0xcc9c('0x70'),_0xcc9c('0x71'),_0xcc9c('0x72'),_0xcc9c('0x73'),_0xcc9c('0x74'),_0xcc9c('0x75'),_0xcc9c('0x76'),_0xcc9c('0x77'),_0xcc9c('0x78'),_0xcc9c('0x79'),_0xcc9c('0x7a'),_0xcc9c('0x7b'),_0xcc9c('0x7c'),_0xcc9c('0x7d'),_0xcc9c('0x7e'),_0xcc9c('0x7f'),'statuscode',_0xcc9c('0x80'),_0xcc9c('0x81'),_0xcc9c('0x82'),_0xcc9c('0x83'),'traversedpath',_0xcc9c('0x84'),_0xcc9c('0x85')];var _0x59788b=_0x1ec025[_0xcc9c('0x86')](_0x37199c);return db[_0xcc9c('0x11')][_0xcc9c('0x37')]({'where':{'id':_0x39298b[_0xcc9c('0x2c')]['id']},'attributes':['id',_0xcc9c('0x87'),_0xcc9c('0x88'),'remoteUri',_0xcc9c('0x89'),_0xcc9c('0x8a'),_0xcc9c('0x8b'),_0xcc9c('0x8c')],'include':[{'model':db[_0xcc9c('0x8d')],'as':_0xcc9c('0x8d'),'attributes':['id','data5',_0xcc9c('0x8e')]}]})[_0xcc9c('0xb')](handleEntityNotFound(_0x365be5,null))[_0xcc9c('0xb')](function(_0x4ccdd4){if(_0x4ccdd4){if(_0x4ccdd4[_0xcc9c('0x8c')]){_0x4ccdd4[_0xcc9c('0x8f')]=_0x4ccdd4[_0xcc9c('0x8d')]['data5'];_0x5d7362=sanitizeRemoteUri(_0x4ccdd4[_0xcc9c('0x8d')][_0xcc9c('0x8e')]);_0x3e31e2=getWebApiUrl(_0x5d7362);return _0x4ccdd4;}_0x5d7362=sanitizeRemoteUri(_0x4ccdd4[_0xcc9c('0x90')]);_0x3e31e2=getWebApiUrl(_0x5d7362);var _0x489448={'method':_0xcc9c('0x91'),'uri':_0xcc9c('0x92')+_0x4ccdd4[_0xcc9c('0x89')]+_0xcc9c('0x93'),'form':{'client_id':_0x4ccdd4['clientId'],'resource':_0x5d7362,'username':_0x4ccdd4['username'],'password':_0x4ccdd4[_0xcc9c('0x88')],'grant_type':_0xcc9c('0x88'),'client_secret':_0x4ccdd4[_0xcc9c('0x8b')]},'json':!![]};return rp(_0x489448);}})[_0xcc9c('0xb')](function(_0x71b385){_0x41e938=_0x71b385[_0xcc9c('0x8f')];var _0x3512b9={'method':_0xcc9c('0x94'),'uri':encodeURI(_0x3e31e2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x36d69b+'\x27'),'headers':{'Authorization':_0xcc9c('0x95')+_0x41e938,'If-None-Match':null,'OData-Version':_0xcc9c('0x96')},'json':!![]};return rp(_0x3512b9);})[_0xcc9c('0xb')](function(_0x52ce47){var _0x53d72b=_0x52ce47[_0xcc9c('0x97')][0x0];var _0x3e6c5b=_0x53d72b[_0xcc9c('0x98')];var _0x40ef35={'method':'GET','uri':_0x3e31e2+_0xcc9c('0x99')+_0x3e6c5b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xcc9c('0x95')+_0x41e938,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40ef35);})[_0xcc9c('0xb')](function(_0x5f5bb6){_0x296776=_0x5f5bb6;_0x27ad08=_0x296776[_0xcc9c('0x9a')];_0x27ad08=_['remove'](_0x27ad08,function(_0x16d17b){return!_0x59788b['includes'](_0x16d17b[_0xcc9c('0x9b')]);});var _0x121449=[];var _0x12e169=[];_0x27ad08[_0xcc9c('0x9c')](function(_0x3b1733){if(_0x3b1733[_0xcc9c('0x9d')]){var _0x3480c9=_0x3b1733[_0xcc9c('0x9d')][_0xcc9c('0x3e')](_0x3b1733[_0xcc9c('0x9d')][_0xcc9c('0x3f')]('.')+0x1);if(_0x3480c9===_0xcc9c('0x9e')){_0x121449[_0xcc9c('0x9f')](getSelectList(_0x3e31e2,_0x3d4662,_0x12e169,_0x296776['MetadataId'],_0x3b1733[_0xcc9c('0x98')],_0x41e938));}}});return Promise[_0xcc9c('0xa0')](_0x121449);})['then'](function(_0xa09ca7){_0x4ab71b=_0xa09ca7[0x0];var _0x1f522f=[];var _0x5f294d=[];_0x27ad08[_0xcc9c('0x9c')](function(_0x2b6065){if(!_['isNil'](_0x2b6065['@odata.type'])){var _0x5c9d61=_0x2b6065['@odata.type'][_0xcc9c('0x3e')](_0x2b6065[_0xcc9c('0x9d')][_0xcc9c('0x3f')]('.')+0x1);if(_0x5c9d61==='BooleanAttributeMetadata'){_0x1f522f[_0xcc9c('0x9f')](getBooleanList(_0x3e31e2,_0x3d4662,_0x5f294d,_0x296776[_0xcc9c('0x98')],_0x2b6065[_0xcc9c('0x98')],_0x41e938));}}});return Promise[_0xcc9c('0xa0')](_0x1f522f);})['then'](function(_0x350726){_0x549e48=_0x350726[0x0];var _0x3ffc0d=[];var _0x3cc923=[];_0x27ad08[_0xcc9c('0x9c')](function(_0x35a059){if(_0x35a059[_0xcc9c('0x9d')]){var _0xa2ad13=_0x35a059[_0xcc9c('0x9d')][_0xcc9c('0x3e')](_0x35a059[_0xcc9c('0x9d')][_0xcc9c('0x3f')]('.')+0x1);if(_0xa2ad13===_0xcc9c('0xa1')||_0xa2ad13===_0xcc9c('0xa2')||_0xa2ad13===_0xcc9c('0xa3')||_0xa2ad13===_0xcc9c('0xa4')||_0xa2ad13===_0xcc9c('0xa5')||_0xa2ad13===_0xcc9c('0xa6')||_0xa2ad13===_0xcc9c('0xa7')||_0xa2ad13===_0xcc9c('0xa8')||_0xa2ad13===_0xcc9c('0xa9')||_0xa2ad13===_0xcc9c('0xaa')){_0x3ffc0d[_0xcc9c('0x9f')](getInputList(_0x3e31e2,_0x3d4662,_0xa2ad13,_0x3cc923,_0x296776['MetadataId'],_0x35a059[_0xcc9c('0x98')],_0x41e938));}}});return Promise[_0xcc9c('0xa0')](_0x3ffc0d);})[_0xcc9c('0xb')](function(_0x22e176){_0x383755=_0x22e176[0x0];var _0x501e97=_0x4ab71b[_0xcc9c('0x86')](_0x549e48)[_0xcc9c('0x86')](_0x383755);var _0x5f3b0f={'count':_0x501e97[_0xcc9c('0x1d')],'rows':_0x501e97};return _0x5f3b0f;})['then'](respondWithResult(_0x365be5,null))[_0xcc9c('0x2a')](function(_0x3d50ae){var _0x28c178=_0x39298b[_0xcc9c('0x17')][_0xcc9c('0xab')]?0x1f4:_0x3d50ae[_0xcc9c('0xac')]||0x1f4;logger[_0xcc9c('0xad')](_0x3d50ae[_0xcc9c('0xe')]);delete _0x3d50ae[_0xcc9c('0xf')];if(_0x28c178===0x191){_0x28c178=0x190;}_0x365be5[_0xcc9c('0xc')](_0x28c178)[_0xcc9c('0x10')](_0x39298b[_0xcc9c('0x17')][_0xcc9c('0xab')]?{'message':_0xcc9c('0xae'),'statusCode':_0x3d50ae[_0xcc9c('0xac')]}:_0x3d50ae);});};function getSelectList(_0x16245d,_0x19b3e1,_0x2d78bc,_0x4eec15,_0x242d47,_0x493342){var _0x7a295d={'method':'GET','uri':_0x16245d+_0xcc9c('0x99')+_0x4eec15+')/Attributes('+_0x242d47+_0xcc9c('0xaf')+_0xcc9c('0xb0'),'headers':{'Authorization':_0xcc9c('0x95')+_0x493342,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7a295d)[_0xcc9c('0xb')](function(_0x8851d9){var _0x458023=[];var _0x219cec=_0x8851d9[_0xcc9c('0xb1')][_0xcc9c('0xb2')];_0x219cec[_0xcc9c('0x9c')](function(_0x577977){_0x458023[_0xcc9c('0x9f')]({'name':_0x577977[_0xcc9c('0xb3')][_0xcc9c('0xb4')][_0xcc9c('0xb3')],'value':String(_0x577977[_0xcc9c('0xb5')])});});var _0x2054c5={'id':_0x19b3e1+'_'+_0x8851d9[_0xcc9c('0x9b')],'name':_0x8851d9[_0xcc9c('0xb6')][_0xcc9c('0xb4')][_0xcc9c('0xb3')],'custom':![],'options':_0x458023};_0x2d78bc[_0xcc9c('0x9f')](_0x2054c5);return _0x2d78bc;});}function getBooleanList(_0x383f77,_0xd2194c,_0x38fcaf,_0x37f7a2,_0x21c3b8,_0x33d8e7){var _0x354ea3={'method':'GET','uri':_0x383f77+_0xcc9c('0x99')+_0x37f7a2+')/Attributes('+_0x21c3b8+_0xcc9c('0xb7'),'headers':{'Authorization':_0xcc9c('0x95')+_0x33d8e7,'If-None-Match':null,'OData-Version':_0xcc9c('0x96')},'json':!![]};return rp(_0x354ea3)[_0xcc9c('0xb')](function(_0x58ed10){var _0x41f702=[];_0x41f702[_0xcc9c('0x9f')]({'name':_0x58ed10[_0xcc9c('0xb1')][_0xcc9c('0xb8')][_0xcc9c('0xb3')][_0xcc9c('0xb4')][_0xcc9c('0xb3')],'value':_0xcc9c('0xb9')},{'name':_0x58ed10[_0xcc9c('0xb1')]['FalseOption'][_0xcc9c('0xb3')][_0xcc9c('0xb4')][_0xcc9c('0xb3')],'value':'false'});var _0x5654f8={'id':_0xd2194c+'_'+_0x58ed10[_0xcc9c('0x9b')],'name':_0x58ed10[_0xcc9c('0xb6')][_0xcc9c('0xb4')][_0xcc9c('0xb3')],'custom':![],'options':_0x41f702};_0x38fcaf[_0xcc9c('0x9f')](_0x5654f8);return _0x38fcaf;});}function getInputList(_0x2973c2,_0x5bdc32,_0x168365,_0x2a7267,_0x3f9ff8,_0x1c8086,_0x24fe05){var _0x6bfa82={'method':_0xcc9c('0x94'),'uri':_0x2973c2+_0xcc9c('0x99')+_0x3f9ff8+_0xcc9c('0xba')+_0x1c8086+_0xcc9c('0xbb')+_0x168365+_0xcc9c('0xbc'),'headers':{'Authorization':_0xcc9c('0x95')+_0x24fe05,'If-None-Match':null,'OData-Version':_0xcc9c('0x96')},'json':!![]};return rp(_0x6bfa82)['then'](function(_0x58691c){var _0x11a7b8={'id':_0x5bdc32+'_'+_0x58691c['LogicalName'],'name':_0x58691c[_0xcc9c('0xb6')][_0xcc9c('0xb4')]?_0x58691c[_0xcc9c('0xb6')]['UserLocalizedLabel'][_0xcc9c('0xb3')]:_0x58691c[_0xcc9c('0x9b')],'custom':![],'options':[]};_0x2a7267[_0xcc9c('0x9f')](_0x11a7b8);return _0x2a7267;});} \ No newline at end of file +var _0x8d2b=['modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','DisplayName','TrueOption','UserLocalizedLabel','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','include','catch','show','params','keys','rawAttributes','filters','includeAll','find','body','update','getConfigurations','Dynamics365Configuration','sort','findOne','channel','Descriptions','getDescriptions','create','Dynamics365Field','Subjects','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','lastonholdtime','modifiedbyexternalpartyyominame'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x8d2b[_0x19b84f];return _0x18067b;};'use strict';var rp=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var _=require(_0xb8d2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xb8d2('0x3'))(_0xb8d2('0x4'));var db=require(_0xb8d2('0x5'))['db'];var integrations=require(_0xb8d2('0x6'));function respondWithResult(_0x3e661c,_0x2f4d30){_0x2f4d30=_0x2f4d30||0xc8;return function(_0x5691b3){if(_0x5691b3){return _0x3e661c[_0xb8d2('0x7')](_0x2f4d30)[_0xb8d2('0x8')](_0x5691b3);}};}function respondWithFilteredResult(_0x355e61,_0x5ad266){return function(_0x459b58){if(_0x459b58){var _0x3b1c3b=typeof _0x5ad266['offset']===_0xb8d2('0x9')&&typeof _0x5ad266[_0xb8d2('0xa')]===_0xb8d2('0x9');var _0x5cb228=_0x459b58[_0xb8d2('0xb')];var _0x10787a=_0x3b1c3b?0x0:_0x5ad266[_0xb8d2('0xc')];var _0x183783=_0x3b1c3b?_0x459b58['count']:_0x5ad266[_0xb8d2('0xc')]+_0x5ad266[_0xb8d2('0xa')];var _0x3ccd48;if(_0x183783>=_0x5cb228){_0x183783=_0x5cb228;_0x3ccd48=0xc8;}else{_0x3ccd48=0xce;}_0x355e61[_0xb8d2('0x7')](_0x3ccd48);return _0x355e61[_0xb8d2('0xd')](_0xb8d2('0xe'),_0x10787a+'-'+_0x183783+'/'+_0x5cb228)[_0xb8d2('0x8')](_0x459b58);}return null;};}function saveUpdates(_0x4f2afc){return function(_0x2014e5){if(_0x2014e5){return _0x2014e5['update'](_0x4f2afc)[_0xb8d2('0xf')](function(_0x474cc5){return _0x474cc5;});}return null;};}function removeEntity(_0x3c1b0f){return function(_0x50297b){if(_0x50297b){return _0x50297b[_0xb8d2('0x10')]()[_0xb8d2('0xf')](function(){_0x3c1b0f[_0xb8d2('0x7')](0xcc)[_0xb8d2('0x11')]();});}};}function handleEntityNotFound(_0x199033){return function(_0x2f6b6c){if(!_0x2f6b6c){_0x199033[_0xb8d2('0x12')](0x194);}return _0x2f6b6c;};}function handleError(_0x26f4a9,_0x1f2f87){_0x1f2f87=_0x1f2f87||0x1f4;return function(_0xa17b11){logger['error'](_0xa17b11[_0xb8d2('0x13')]);if(_0xa17b11[_0xb8d2('0x14')]){delete _0xa17b11['name'];}_0x26f4a9[_0xb8d2('0x7')](_0x1f2f87)[_0xb8d2('0x15')](_0xa17b11);};}exports[_0xb8d2('0x16')]=function(_0x2da62f,_0x16b2f2){var _0x3fdbee={},_0x12d41e={},_0x5ac8ad={'count':0x0,'rows':[]};var _0x38bb04=_[_0xb8d2('0x17')](db[_0xb8d2('0x18')]['rawAttributes'],function(_0x2c4aa6){return{'name':_0x2c4aa6[_0xb8d2('0x19')],'type':_0x2c4aa6[_0xb8d2('0x1a')][_0xb8d2('0x1b')]};});_0x12d41e[_0xb8d2('0x1c')]=_[_0xb8d2('0x17')](_0x38bb04,_0xb8d2('0x14'));_0x12d41e[_0xb8d2('0x1d')]=_['keys'](_0x2da62f['query']);_0x12d41e['filters']=_[_0xb8d2('0x1e')](_0x12d41e[_0xb8d2('0x1c')],_0x12d41e[_0xb8d2('0x1d')]);_0x3fdbee['attributes']=_[_0xb8d2('0x1e')](_0x12d41e['model'],qs['fields'](_0x2da62f[_0xb8d2('0x1d')][_0xb8d2('0x1f')]));_0x3fdbee[_0xb8d2('0x20')]=_0x3fdbee[_0xb8d2('0x20')][_0xb8d2('0x21')]?_0x3fdbee[_0xb8d2('0x20')]:_0x12d41e[_0xb8d2('0x1c')];if(!_0x2da62f[_0xb8d2('0x1d')][_0xb8d2('0x22')](_0xb8d2('0x23'))){_0x3fdbee[_0xb8d2('0xa')]=qs[_0xb8d2('0xa')](_0x2da62f[_0xb8d2('0x1d')][_0xb8d2('0xa')]);_0x3fdbee['offset']=qs[_0xb8d2('0xc')](_0x2da62f[_0xb8d2('0x1d')][_0xb8d2('0xc')]);}_0x3fdbee[_0xb8d2('0x24')]=qs['sort'](_0x2da62f['query']['sort']);_0x3fdbee['where']=qs['filters'](_[_0xb8d2('0x25')](_0x2da62f[_0xb8d2('0x1d')],_0x12d41e['filters']),_0x38bb04);if(_0x2da62f[_0xb8d2('0x1d')]['filter']){_0x3fdbee[_0xb8d2('0x26')]=_[_0xb8d2('0x27')](_0x3fdbee['where'],{'$or':_[_0xb8d2('0x17')](_0x38bb04,function(_0x477035){if(_0x477035['type']!==_0xb8d2('0x28')){var _0x4b0f9f={};_0x4b0f9f[_0x477035[_0xb8d2('0x14')]]={'$like':'%'+_0x2da62f['query'][_0xb8d2('0x29')]+'%'};return _0x4b0f9f;}})});}_0x3fdbee=_['merge']({},_0x3fdbee,_0x2da62f[_0xb8d2('0x2a')]);var _0x38ec6e={'where':_0x3fdbee['where']};return db[_0xb8d2('0x18')][_0xb8d2('0xb')](_0x38ec6e)[_0xb8d2('0xf')](function(_0x24f07e){_0x5ac8ad['count']=_0x24f07e;if(_0x2da62f['query']['includeAll']){_0x3fdbee[_0xb8d2('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3fdbee);})[_0xb8d2('0xf')](function(_0x92c89e){_0x5ac8ad['rows']=_0x92c89e;return _0x5ac8ad;})[_0xb8d2('0xf')](respondWithFilteredResult(_0x16b2f2,_0x3fdbee))[_0xb8d2('0x2c')](handleError(_0x16b2f2,null));};exports[_0xb8d2('0x2d')]=function(_0x21750b,_0x1d9b82){var _0x513efa={'raw':![],'where':{'id':_0x21750b[_0xb8d2('0x2e')]['id']}},_0x2fd83f={};_0x2fd83f[_0xb8d2('0x1c')]=_[_0xb8d2('0x2f')](db[_0xb8d2('0x18')][_0xb8d2('0x30')]);_0x2fd83f[_0xb8d2('0x1d')]=_[_0xb8d2('0x2f')](_0x21750b[_0xb8d2('0x1d')]);_0x2fd83f[_0xb8d2('0x31')]=_['intersection'](_0x2fd83f[_0xb8d2('0x1c')],_0x2fd83f['query']);_0x513efa[_0xb8d2('0x20')]=_[_0xb8d2('0x1e')](_0x2fd83f[_0xb8d2('0x1c')],qs['fields'](_0x21750b[_0xb8d2('0x1d')][_0xb8d2('0x1f')]));_0x513efa[_0xb8d2('0x20')]=_0x513efa[_0xb8d2('0x20')]['length']?_0x513efa[_0xb8d2('0x20')]:_0x2fd83f['model'];if(_0x21750b[_0xb8d2('0x1d')][_0xb8d2('0x32')]){_0x513efa[_0xb8d2('0x2b')]=[{'all':!![]}];}_0x513efa=_['merge']({},_0x513efa,_0x21750b['options']);return db[_0xb8d2('0x18')][_0xb8d2('0x33')](_0x513efa)[_0xb8d2('0xf')](handleEntityNotFound(_0x1d9b82,null))['then'](respondWithResult(_0x1d9b82,null))[_0xb8d2('0x2c')](handleError(_0x1d9b82,null));};exports['create']=function(_0x81547d,_0xfe2361){return db[_0xb8d2('0x18')]['create'](_0x81547d[_0xb8d2('0x34')],{})[_0xb8d2('0xf')](respondWithResult(_0xfe2361,0xc9))['catch'](handleError(_0xfe2361,null));};exports[_0xb8d2('0x35')]=function(_0x949a16,_0x559c76){if(_0x949a16[_0xb8d2('0x34')]['id']){delete _0x949a16['body']['id'];}return db[_0xb8d2('0x18')]['find']({'where':{'id':_0x949a16['params']['id']}})[_0xb8d2('0xf')](handleEntityNotFound(_0x559c76,null))['then'](saveUpdates(_0x949a16[_0xb8d2('0x34')],null))[_0xb8d2('0xf')](respondWithResult(_0x559c76,null))['catch'](handleError(_0x559c76,null));};exports[_0xb8d2('0x10')]=function(_0xfb8b4c,_0x4b1c23){return db[_0xb8d2('0x18')][_0xb8d2('0x33')]({'where':{'id':_0xfb8b4c[_0xb8d2('0x2e')]['id']}})[_0xb8d2('0xf')](handleEntityNotFound(_0x4b1c23,null))[_0xb8d2('0xf')](removeEntity(_0x4b1c23,null))[_0xb8d2('0x2c')](handleError(_0x4b1c23,null));};exports[_0xb8d2('0x36')]=function(_0x2a5b08,_0x511b1c){var _0x2657eb={};var _0x5e059b={};var _0x2f49ae;var _0x393a77;return db[_0xb8d2('0x18')]['findOne']({'where':{'id':_0x2a5b08['params']['id']}})[_0xb8d2('0xf')](handleEntityNotFound(_0x511b1c,null))[_0xb8d2('0xf')](function(_0x389a43){if(_0x389a43){_0x2f49ae=_0x389a43;_0x5e059b[_0xb8d2('0x1c')]=_['keys'](db[_0xb8d2('0x37')][_0xb8d2('0x30')]);_0x5e059b[_0xb8d2('0x1d')]=_[_0xb8d2('0x2f')](_0x2a5b08['query']);_0x5e059b['filters']=_[_0xb8d2('0x1e')](_0x5e059b['model'],_0x5e059b['query']);_0x2657eb[_0xb8d2('0x20')]=_['intersection'](_0x5e059b[_0xb8d2('0x1c')],qs[_0xb8d2('0x1f')](_0x2a5b08[_0xb8d2('0x1d')][_0xb8d2('0x1f')]));_0x2657eb[_0xb8d2('0x20')]=_0x2657eb[_0xb8d2('0x20')][_0xb8d2('0x21')]?_0x2657eb[_0xb8d2('0x20')]:_0x5e059b[_0xb8d2('0x1c')];_0x2657eb['order']=qs[_0xb8d2('0x38')](_0x2a5b08[_0xb8d2('0x1d')][_0xb8d2('0x38')]);_0x2657eb[_0xb8d2('0x26')]=qs['filters'](_[_0xb8d2('0x25')](_0x2a5b08[_0xb8d2('0x1d')],_0x5e059b[_0xb8d2('0x31')]));if(_0x2a5b08[_0xb8d2('0x1d')][_0xb8d2('0x29')]){_0x2657eb['where']=_[_0xb8d2('0x27')](_0x2657eb['where'],{'$or':_['map'](_0x2657eb['attributes'],function(_0x166dac){var _0x4d139f={};_0x4d139f[_0x166dac]={'$like':'%'+_0x2a5b08[_0xb8d2('0x1d')][_0xb8d2('0x29')]+'%'};return _0x4d139f;})});}_0x2657eb=_['merge']({},_0x2657eb,_0x2a5b08[_0xb8d2('0x2a')]);return _0x2f49ae[_0xb8d2('0x36')](_0x2657eb);}})[_0xb8d2('0xf')](function(_0x4d1129){if(_0x4d1129){_0x393a77=_0x4d1129[_0xb8d2('0x21')];if(!_0x2a5b08[_0xb8d2('0x1d')]['hasOwnProperty'](_0xb8d2('0x23'))){_0x2657eb[_0xb8d2('0xa')]=qs[_0xb8d2('0xa')](_0x2a5b08['query'][_0xb8d2('0xa')]);_0x2657eb[_0xb8d2('0xc')]=qs[_0xb8d2('0xc')](_0x2a5b08[_0xb8d2('0x1d')][_0xb8d2('0xc')]);}return _0x2f49ae[_0xb8d2('0x36')](_0x2657eb);}})[_0xb8d2('0xf')](function(_0x33a4be){if(_0x33a4be){return _0x33a4be?{'count':_0x393a77,'rows':_0x33a4be}:null;}})[_0xb8d2('0xf')](respondWithResult(_0x511b1c,null))['catch'](handleError(_0x511b1c,null));};exports['addConfiguration']=function(_0x18c553,_0x23057f){if(_0x18c553['body']['id']){delete _0x18c553[_0xb8d2('0x34')]['id'];}return db[_0xb8d2('0x18')][_0xb8d2('0x39')]({'where':{'id':_0x18c553[_0xb8d2('0x2e')]['id']}})[_0xb8d2('0xf')](handleEntityNotFound(_0x23057f,null))[_0xb8d2('0xf')](function(_0x1c7a43){if(_0x1c7a43){_0x18c553[_0xb8d2('0x34')]['AccountId']=_0x1c7a43['id'];_0x18c553['body']['Subjects']=integrations['getSubjects'](_0x18c553[_0xb8d2('0x34')][_0xb8d2('0x3a')],_0x18c553[_0xb8d2('0x34')]['type']);_0x18c553['body'][_0xb8d2('0x3b')]=integrations[_0xb8d2('0x3c')](_0x18c553[_0xb8d2('0x34')][_0xb8d2('0x3a')],_0x18c553[_0xb8d2('0x34')]['type']);return db[_0xb8d2('0x37')][_0xb8d2('0x3d')](_0x18c553[_0xb8d2('0x34')],{'include':[{'model':db[_0xb8d2('0x3e')],'as':_0xb8d2('0x3f')},{'model':db[_0xb8d2('0x3e')],'as':_0xb8d2('0x3b')}]});}return null;})['then'](respondWithResult(_0x23057f,null))[_0xb8d2('0x2c')](handleError(_0x23057f,null));};function sanitizeRemoteUri(_0x161c32){var _0x499ebf=_0x161c32[_0xb8d2('0x40')](-0x1);if(_0x499ebf==='/')return _0x161c32[_0xb8d2('0x41')](0x0,_0x161c32[_0xb8d2('0x42')](_0x499ebf));return _0x161c32;}function getWebApiUrl(_0x46beb4){return util[_0xb8d2('0x43')](_0xb8d2('0x44'),_0x46beb4);}exports[_0xb8d2('0x45')]=function(_0x465f42,_0x3d870f){var _0x58264d=_0x465f42['query'][_0xb8d2('0x46')];var _0x10f0e7=_0x58264d===_0xb8d2('0x47')?'Incident':_0xb8d2('0x48');var _0x1d9bc1='';var _0x4c351a='';var _0x118f5c='';var _0x157d9e='';var _0x1d0f0d='';var _0x49e2ba='';var _0x3bf576='';var _0x50570f='';var _0x494d88=[_0xb8d2('0x49'),_0xb8d2('0x4a'),_0xb8d2('0x4b'),_0xb8d2('0x4c'),_0xb8d2('0x4d'),_0xb8d2('0x4e'),'phonenumber',_0xb8d2('0x4f'),'directioncode',_0xb8d2('0x50')];var _0x232cbd=[_0xb8d2('0x51'),_0xb8d2('0x52'),'actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname',_0xb8d2('0x53'),_0xb8d2('0x54'),_0xb8d2('0x55'),_0xb8d2('0x56'),_0xb8d2('0x57'),_0xb8d2('0x58'),_0xb8d2('0x59'),_0xb8d2('0x5a'),_0xb8d2('0x5b'),'customeridtype',_0xb8d2('0x5c'),'emailaddress','entitlementidname',_0xb8d2('0x5d'),_0xb8d2('0x5e'),_0xb8d2('0x5f'),_0xb8d2('0x60'),_0xb8d2('0x61'),'followupby',_0xb8d2('0x62'),'influencescore','kbarticleidname',_0xb8d2('0x63'),'masteridname','modifiedbyexternalpartyname',_0xb8d2('0x64'),'modifiedbyname','modifiedbyyominame',_0xb8d2('0x65'),_0xb8d2('0x66'),'modifiedonbehalfbyyominame',_0xb8d2('0x67'),_0xb8d2('0x68'),_0xb8d2('0x69'),_0xb8d2('0x6a'),_0xb8d2('0x6b'),_0xb8d2('0x6c'),_0xb8d2('0x6d'),'owneridyominame',_0xb8d2('0x6e'),'primarycontactidname',_0xb8d2('0x6f'),_0xb8d2('0x70'),_0xb8d2('0x71'),_0xb8d2('0x72'),_0xb8d2('0x73'),_0xb8d2('0x74'),_0xb8d2('0x75'),_0xb8d2('0x76'),_0xb8d2('0x77'),_0xb8d2('0x78'),_0xb8d2('0x79'),_0xb8d2('0x7a'),'socialprofileidname',_0xb8d2('0x7b'),'statuscode',_0xb8d2('0x7c'),_0xb8d2('0x7d'),'timezoneruleversionnumber',_0xb8d2('0x7e'),_0xb8d2('0x7f'),_0xb8d2('0x80'),_0xb8d2('0x81')];var _0x5c8017=_0x494d88[_0xb8d2('0x82')](_0x232cbd);return db['Dynamics365Account'][_0xb8d2('0x39')]({'where':{'id':_0x465f42[_0xb8d2('0x2e')]['id']},'attributes':['id',_0xb8d2('0x83'),_0xb8d2('0x84'),_0xb8d2('0x85'),_0xb8d2('0x86'),_0xb8d2('0x87'),_0xb8d2('0x88'),_0xb8d2('0x89')],'include':[{'model':db[_0xb8d2('0x8a')],'as':'CloudProvider','attributes':['id',_0xb8d2('0x8b'),'data7']}]})[_0xb8d2('0xf')](handleEntityNotFound(_0x3d870f,null))['then'](function(_0x1698a6){if(_0x1698a6){if(_0x1698a6[_0xb8d2('0x89')]){_0x1698a6[_0xb8d2('0x8c')]=_0x1698a6[_0xb8d2('0x8a')][_0xb8d2('0x8b')];_0x50570f=sanitizeRemoteUri(_0x1698a6['CloudProvider'][_0xb8d2('0x8d')]);_0x3bf576=getWebApiUrl(_0x50570f);return _0x1698a6;}_0x50570f=sanitizeRemoteUri(_0x1698a6['remoteUri']);_0x3bf576=getWebApiUrl(_0x50570f);var _0x35dad6={'method':_0xb8d2('0x8e'),'uri':_0xb8d2('0x8f')+_0x1698a6[_0xb8d2('0x86')]+_0xb8d2('0x90'),'form':{'client_id':_0x1698a6[_0xb8d2('0x87')],'resource':_0x50570f,'username':_0x1698a6['username'],'password':_0x1698a6[_0xb8d2('0x84')],'grant_type':'password','client_secret':_0x1698a6[_0xb8d2('0x88')]},'json':!![]};return rp(_0x35dad6);}})[_0xb8d2('0xf')](function(_0x3ceebe){_0x49e2ba=_0x3ceebe[_0xb8d2('0x8c')];var _0x409094={'method':'GET','uri':encodeURI(_0x3bf576+_0xb8d2('0x91')+_0x10f0e7+'\x27'),'headers':{'Authorization':_0xb8d2('0x92')+_0x49e2ba,'If-None-Match':null,'OData-Version':_0xb8d2('0x93')},'json':!![]};return rp(_0x409094);})[_0xb8d2('0xf')](function(_0x2fdcd6){var _0x39e860=_0x2fdcd6[_0xb8d2('0x94')][0x0];var _0x5e30e3=_0x39e860[_0xb8d2('0x95')];var _0x35d91d={'method':_0xb8d2('0x96'),'uri':_0x3bf576+_0xb8d2('0x97')+_0x5e30e3+_0xb8d2('0x98'),'headers':{'Authorization':_0xb8d2('0x92')+_0x49e2ba,'If-None-Match':null,'OData-Version':_0xb8d2('0x93')},'json':!![]};return rp(_0x35d91d);})['then'](function(_0x2aa21d){_0x1d9bc1=_0x2aa21d;_0x4c351a=_0x1d9bc1['Attributes'];_0x4c351a=_[_0xb8d2('0x99')](_0x4c351a,function(_0x1bd637){return!_0x5c8017[_0xb8d2('0x9a')](_0x1bd637[_0xb8d2('0x9b')]);});var _0x26d7b4=[];var _0x24a04f=[];_0x4c351a[_0xb8d2('0x9c')](function(_0x50e549){if(_0x50e549[_0xb8d2('0x9d')]){var _0x1e817e=_0x50e549[_0xb8d2('0x9d')]['substring'](_0x50e549[_0xb8d2('0x9d')][_0xb8d2('0x42')]('.')+0x1);if(_0x1e817e==='PicklistAttributeMetadata'){_0x26d7b4['push'](getSelectList(_0x3bf576,_0x58264d,_0x24a04f,_0x1d9bc1[_0xb8d2('0x95')],_0x50e549[_0xb8d2('0x95')],_0x49e2ba));}}});return Promise[_0xb8d2('0x9e')](_0x26d7b4);})[_0xb8d2('0xf')](function(_0x3529f4){_0x118f5c=_0x3529f4[0x0];var _0x63e581=[];var _0x2457c8=[];_0x4c351a['forEach'](function(_0x26fddf){if(!_[_0xb8d2('0x9f')](_0x26fddf[_0xb8d2('0x9d')])){var _0x19cacf=_0x26fddf[_0xb8d2('0x9d')]['substring'](_0x26fddf[_0xb8d2('0x9d')][_0xb8d2('0x42')]('.')+0x1);if(_0x19cacf===_0xb8d2('0xa0')){_0x63e581[_0xb8d2('0xa1')](getBooleanList(_0x3bf576,_0x58264d,_0x2457c8,_0x1d9bc1[_0xb8d2('0x95')],_0x26fddf['MetadataId'],_0x49e2ba));}}});return Promise[_0xb8d2('0x9e')](_0x63e581);})[_0xb8d2('0xf')](function(_0x2fdb59){_0x157d9e=_0x2fdb59[0x0];var _0x3f50e2=[];var _0x2a5e72=[];_0x4c351a[_0xb8d2('0x9c')](function(_0x3e55d3){if(_0x3e55d3[_0xb8d2('0x9d')]){var _0x341bdb=_0x3e55d3[_0xb8d2('0x9d')][_0xb8d2('0x41')](_0x3e55d3[_0xb8d2('0x9d')][_0xb8d2('0x42')]('.')+0x1);if(_0x341bdb===_0xb8d2('0xa2')||_0x341bdb===_0xb8d2('0xa3')||_0x341bdb===_0xb8d2('0xa4')||_0x341bdb===_0xb8d2('0xa5')||_0x341bdb===_0xb8d2('0xa6')||_0x341bdb===_0xb8d2('0xa7')||_0x341bdb===_0xb8d2('0xa8')||_0x341bdb===_0xb8d2('0xa9')||_0x341bdb===_0xb8d2('0xaa')||_0x341bdb===_0xb8d2('0xab')){_0x3f50e2[_0xb8d2('0xa1')](getInputList(_0x3bf576,_0x58264d,_0x341bdb,_0x2a5e72,_0x1d9bc1[_0xb8d2('0x95')],_0x3e55d3[_0xb8d2('0x95')],_0x49e2ba));}}});return Promise[_0xb8d2('0x9e')](_0x3f50e2);})[_0xb8d2('0xf')](function(_0x509c67){_0x1d0f0d=_0x509c67[0x0];var _0xedbcfd=_0x118f5c['concat'](_0x157d9e)[_0xb8d2('0x82')](_0x1d0f0d);var _0x3bd3b5={'count':_0xedbcfd[_0xb8d2('0x21')],'rows':_0xedbcfd};return _0x3bd3b5;})[_0xb8d2('0xf')](respondWithResult(_0x3d870f,null))[_0xb8d2('0x2c')](function(_0x4dee0b){var _0xee86d6=_0x465f42[_0xb8d2('0x1d')]['test']?0x1f4:_0x4dee0b['statusCode']||0x1f4;logger['error'](_0x4dee0b['stack']);delete _0x4dee0b[_0xb8d2('0x14')];if(_0xee86d6===0x191){_0xee86d6=0x190;}_0x3d870f['status'](_0xee86d6)[_0xb8d2('0x15')](_0x465f42['query'][_0xb8d2('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x4dee0b[_0xb8d2('0xad')]}:_0x4dee0b);});};function getSelectList(_0x2f7179,_0x32b877,_0xa06273,_0x270b8b,_0x15b349,_0xa476f0){var _0x203a0c={'method':'GET','uri':_0x2f7179+'EntityDefinitions('+_0x270b8b+_0xb8d2('0xae')+_0x15b349+_0xb8d2('0xaf')+_0xb8d2('0xb0'),'headers':{'Authorization':_0xb8d2('0x92')+_0xa476f0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x203a0c)[_0xb8d2('0xf')](function(_0xb1ec1c){var _0xe927c5=[];var _0x337e82=_0xb1ec1c[_0xb8d2('0xb1')]['Options'];_0x337e82[_0xb8d2('0x9c')](function(_0x506acb){_0xe927c5['push']({'name':_0x506acb[_0xb8d2('0xb2')]['UserLocalizedLabel'][_0xb8d2('0xb2')],'value':String(_0x506acb['Value'])});});var _0x5ef60e={'id':_0x32b877+'_'+_0xb1ec1c[_0xb8d2('0x9b')],'name':_0xb1ec1c[_0xb8d2('0xb3')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xe927c5};_0xa06273[_0xb8d2('0xa1')](_0x5ef60e);return _0xa06273;});}function getBooleanList(_0x4e9b0c,_0x2ef1d3,_0x45a981,_0x167fd6,_0x599706,_0x2cf30d){var _0x3a2a01={'method':_0xb8d2('0x96'),'uri':_0x4e9b0c+'EntityDefinitions('+_0x167fd6+')/Attributes('+_0x599706+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xb8d2('0x92')+_0x2cf30d,'If-None-Match':null,'OData-Version':_0xb8d2('0x93')},'json':!![]};return rp(_0x3a2a01)['then'](function(_0x5c6d8a){var _0x15e0e3=[];_0x15e0e3['push']({'name':_0x5c6d8a[_0xb8d2('0xb1')][_0xb8d2('0xb4')][_0xb8d2('0xb2')][_0xb8d2('0xb5')][_0xb8d2('0xb2')],'value':_0xb8d2('0xb6')},{'name':_0x5c6d8a['OptionSet'][_0xb8d2('0xb7')][_0xb8d2('0xb2')]['UserLocalizedLabel'][_0xb8d2('0xb2')],'value':'false'});var _0x4a2fea={'id':_0x2ef1d3+'_'+_0x5c6d8a[_0xb8d2('0x9b')],'name':_0x5c6d8a[_0xb8d2('0xb3')]['UserLocalizedLabel'][_0xb8d2('0xb2')],'custom':![],'options':_0x15e0e3};_0x45a981[_0xb8d2('0xa1')](_0x4a2fea);return _0x45a981;});}function getInputList(_0x39d4ac,_0x1f2825,_0x3ef5de,_0x2bf8d7,_0x5b7c7b,_0x51f00b,_0x5afeff){var _0x1332e7={'method':_0xb8d2('0x96'),'uri':_0x39d4ac+_0xb8d2('0x97')+_0x5b7c7b+')/Attributes('+_0x51f00b+_0xb8d2('0xb8')+_0x3ef5de+_0xb8d2('0xb9'),'headers':{'Authorization':_0xb8d2('0x92')+_0x5afeff,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1332e7)['then'](function(_0x19d9f0){var _0x2e3934={'id':_0x1f2825+'_'+_0x19d9f0[_0xb8d2('0x9b')],'name':_0x19d9f0[_0xb8d2('0xb3')]['UserLocalizedLabel']?_0x19d9f0[_0xb8d2('0xb3')][_0xb8d2('0xb5')]['Label']:_0x19d9f0[_0xb8d2('0x9b')],'custom':![],'options':[]};_0x2bf8d7[_0xb8d2('0xa1')](_0x2e3934);return _0x2bf8d7;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4923d53..5cd352a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0xcc6469,_0x708c09){var _0x268d20=function(_0x5bbb77){while(--_0x5bbb77){_0xcc6469['push'](_0xcc6469['shift']());}};_0x268d20(++_0x708c09);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x382e66,_0x340e18){var _0x5a753f=function(_0xe8f7a){while(--_0xe8f7a){_0x382e66['push'](_0x382e66['shift']());}};_0x5a753f(++_0x340e18);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var 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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 0d2211b..9cc47cc 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 _0xcbfa=['where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','raw','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbfa,0x1ac));var _0xacbf=function(_0x54d486,_0x193223){_0x54d486=_0x54d486-0x0;var _0x3a639e=_0xcbfa[_0x54d486];return _0x3a639e;};'use strict';var _=require(_0xacbf('0x0'));var util=require(_0xacbf('0x1'));var moment=require(_0xacbf('0x2'));var BPromise=require('bluebird');var rs=require(_0xacbf('0x3'));var fs=require('fs');var Redis=require(_0xacbf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacbf('0x5'))(_0xacbf('0x6'));var config=require('../../config/environment');var jayson=require(_0xacbf('0x7'));var client=jayson[_0xacbf('0x8')][_0xacbf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493c2a,_0x460876,_0x22769f){return new BPromise(function(_0x54c16c,_0x1eee4b){return client[_0xacbf('0xa')](_0x493c2a,_0x22769f)[_0xacbf('0xb')](function(_0x4c3c24){logger[_0xacbf('0xc')](_0xacbf('0xd'),_0x460876,_0xacbf('0xe'));logger[_0xacbf('0xf')](_0xacbf('0x10'),_0x460876,_0xacbf('0xe'),JSON[_0xacbf('0x11')](_0x4c3c24));if(_0x4c3c24['error']){if(_0x4c3c24[_0xacbf('0x12')][_0xacbf('0x13')]===0x1f4){logger['error'](_0xacbf('0xd'),_0x460876,_0x4c3c24['error'][_0xacbf('0x14')]);return _0x1eee4b(_0x4c3c24[_0xacbf('0x12')][_0xacbf('0x14')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x460876,_0x4c3c24[_0xacbf('0x12')][_0xacbf('0x14')]);return _0x54c16c(_0x4c3c24[_0xacbf('0x12')][_0xacbf('0x14')]);}else{logger[_0xacbf('0xc')](_0xacbf('0xd'),_0x460876,_0xacbf('0xe'));_0x54c16c(_0x4c3c24[_0xacbf('0x15')][_0xacbf('0x14')]);}})[_0xacbf('0x16')](function(_0x34bd01){logger['error'](_0xacbf('0xd'),_0x460876,_0x34bd01);_0x1eee4b(_0x34bd01);});});}exports[_0xacbf('0x17')]=function(_0x4c51e8){var _0xd34981=this;return new Promise(function(_0x35525e,_0x541670){return db['Dynamics365Account'][_0xacbf('0x18')]({'raw':_0x4c51e8['options']?_0x4c51e8['options'][_0xacbf('0x19')]===undefined?!![]:![]:!![],'where':_0x4c51e8[_0xacbf('0x1a')]?_0x4c51e8[_0xacbf('0x1a')][_0xacbf('0x1b')]||null:null,'attributes':_0x4c51e8[_0xacbf('0x1a')]?_0x4c51e8[_0xacbf('0x1a')][_0xacbf('0x1c')]||null:null,'limit':_0x4c51e8[_0xacbf('0x1a')]?_0x4c51e8[_0xacbf('0x1a')][_0xacbf('0x1d')]||null:null,'include':_0x4c51e8[_0xacbf('0x1a')]?_0x4c51e8['options'][_0xacbf('0x1e')]?_[_0xacbf('0x1f')](_0x4c51e8['options'][_0xacbf('0x1e')],function(_0x4e481f){return{'model':db[_0x4e481f['model']],'as':_0x4e481f['as'],'attributes':_0x4e481f['attributes'],'include':_0x4e481f['include']?_[_0xacbf('0x1f')](_0x4e481f['include'],function(_0x249179){return{'model':db[_0x249179[_0xacbf('0x20')]],'as':_0x249179['as'],'attributes':_0x249179[_0xacbf('0x1c')],'include':_0x249179[_0xacbf('0x1e')]?_[_0xacbf('0x1f')](_0x249179[_0xacbf('0x1e')],function(_0x463c55){return{'model':db[_0x463c55[_0xacbf('0x20')]],'as':_0x463c55['as'],'attributes':_0x463c55[_0xacbf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacbf('0xb')](function(_0x516899){logger['info'](_0xacbf('0x17'),_0x4c51e8);logger[_0xacbf('0xf')](_0xacbf('0x17'),_0x4c51e8,JSON[_0xacbf('0x11')](_0x516899));_0x35525e(_0x516899);})[_0xacbf('0x16')](function(_0x2f50c7){logger[_0xacbf('0x12')]('GetDynamics365Account',_0x2f50c7[_0xacbf('0x14')],_0x4c51e8);_0x541670(_0xd34981[_0xacbf('0x12')](0x1f4,_0x2f50c7[_0xacbf('0x14')]));});});};exports[_0xacbf('0x21')]=function(_0x118d84){var _0x87390c=this;return new Promise(function(_0x5229f0,_0x3f8099){return db['Dynamics365Account'][_0xacbf('0x22')]({'raw':_0x118d84[_0xacbf('0x1a')]?_0x118d84['options'][_0xacbf('0x19')]===undefined?!![]:![]:!![],'where':_0x118d84[_0xacbf('0x1a')]?_0x118d84[_0xacbf('0x1a')][_0xacbf('0x1b')]||null:null,'attributes':_0x118d84[_0xacbf('0x1a')]?_0x118d84[_0xacbf('0x1a')]['attributes']||null:null,'include':_0x118d84[_0xacbf('0x1a')]?_0x118d84[_0xacbf('0x1a')][_0xacbf('0x1e')]?_[_0xacbf('0x1f')](_0x118d84[_0xacbf('0x1a')][_0xacbf('0x1e')],function(_0x1f90e8){return{'model':db[_0x1f90e8[_0xacbf('0x20')]],'as':_0x1f90e8['as'],'attributes':_0x1f90e8[_0xacbf('0x1c')],'include':_0x1f90e8['include']?_[_0xacbf('0x1f')](_0x1f90e8[_0xacbf('0x1e')],function(_0x1f2d87){return{'model':db[_0x1f2d87['model']],'as':_0x1f2d87['as'],'attributes':_0x1f2d87[_0xacbf('0x1c')],'include':_0x1f2d87[_0xacbf('0x1e')]?_[_0xacbf('0x1f')](_0x1f2d87[_0xacbf('0x1e')],function(_0x2b811c){return{'model':db[_0x2b811c[_0xacbf('0x20')]],'as':_0x2b811c['as'],'attributes':_0x2b811c[_0xacbf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacbf('0xb')](function(_0x42c1db){logger['info'](_0xacbf('0x21'),_0x118d84);logger[_0xacbf('0xf')](_0xacbf('0x21'),_0x118d84,JSON[_0xacbf('0x11')](_0x42c1db));_0x5229f0(_0x42c1db);})[_0xacbf('0x16')](function(_0x5e3bc3){logger[_0xacbf('0x12')](_0xacbf('0x21'),_0x5e3bc3[_0xacbf('0x14')],_0x118d84);_0x3f8099(_0x87390c[_0xacbf('0x12')](0x1f4,_0x5e3bc3['message']));});});}; \ No newline at end of file +var _0xd5bc=['jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','catch','ShowDynamics365Account','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x305fc8,_0x16e31e){var _0x427cea=function(_0x524995){while(--_0x524995){_0x305fc8['push'](_0x305fc8['shift']());}};_0x427cea(++_0x16e31e);}(_0xd5bc,0x12d));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcd5b('0x0'));var util=require(_0xcd5b('0x1'));var moment=require(_0xcd5b('0x2'));var BPromise=require(_0xcd5b('0x3'));var rs=require(_0xcd5b('0x4'));var fs=require('fs');var Redis=require(_0xcd5b('0x5'));var db=require(_0xcd5b('0x6'))['db'];var utils=require(_0xcd5b('0x7'));var logger=require(_0xcd5b('0x8'))(_0xcd5b('0x9'));var config=require(_0xcd5b('0xa'));var jayson=require(_0xcd5b('0xb'));var client=jayson[_0xcd5b('0xc')][_0xcd5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2399f5,_0x27a9d0,_0x574f49){return new BPromise(function(_0x447dc3,_0x3630fa){return client[_0xcd5b('0xe')](_0x2399f5,_0x574f49)[_0xcd5b('0xf')](function(_0x93648e){logger[_0xcd5b('0x10')](_0xcd5b('0x11'),_0x27a9d0,_0xcd5b('0x12'));logger[_0xcd5b('0x13')](_0xcd5b('0x14'),_0x27a9d0,_0xcd5b('0x12'),JSON[_0xcd5b('0x15')](_0x93648e));if(_0x93648e['error']){if(_0x93648e[_0xcd5b('0x16')][_0xcd5b('0x17')]===0x1f4){logger[_0xcd5b('0x16')](_0xcd5b('0x11'),_0x27a9d0,_0x93648e['error']['message']);return _0x3630fa(_0x93648e['error'][_0xcd5b('0x18')]);}logger[_0xcd5b('0x16')](_0xcd5b('0x11'),_0x27a9d0,_0x93648e[_0xcd5b('0x16')]['message']);return _0x447dc3(_0x93648e[_0xcd5b('0x16')][_0xcd5b('0x18')]);}else{logger[_0xcd5b('0x10')](_0xcd5b('0x11'),_0x27a9d0,_0xcd5b('0x12'));_0x447dc3(_0x93648e[_0xcd5b('0x19')][_0xcd5b('0x18')]);}})['catch'](function(_0x3ffb1d){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x27a9d0,_0x3ffb1d);_0x3630fa(_0x3ffb1d);});});}exports[_0xcd5b('0x1a')]=function(_0x12e9d3){var _0x3eee9e=this;return new Promise(function(_0x11ed72,_0x6ace31){return db[_0xcd5b('0x1b')][_0xcd5b('0x1c')]({'raw':_0x12e9d3['options']?_0x12e9d3[_0xcd5b('0x1d')][_0xcd5b('0x1e')]===undefined?!![]:![]:!![],'where':_0x12e9d3[_0xcd5b('0x1d')]?_0x12e9d3[_0xcd5b('0x1d')]['where']||null:null,'attributes':_0x12e9d3['options']?_0x12e9d3[_0xcd5b('0x1d')][_0xcd5b('0x1f')]||null:null,'limit':_0x12e9d3[_0xcd5b('0x1d')]?_0x12e9d3[_0xcd5b('0x1d')][_0xcd5b('0x20')]||null:null,'include':_0x12e9d3[_0xcd5b('0x1d')]?_0x12e9d3[_0xcd5b('0x1d')][_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x12e9d3[_0xcd5b('0x1d')][_0xcd5b('0x21')],function(_0x1df6d1){return{'model':db[_0x1df6d1[_0xcd5b('0x23')]],'as':_0x1df6d1['as'],'attributes':_0x1df6d1[_0xcd5b('0x1f')],'include':_0x1df6d1[_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x1df6d1[_0xcd5b('0x21')],function(_0x2c12a8){return{'model':db[_0x2c12a8[_0xcd5b('0x23')]],'as':_0x2c12a8['as'],'attributes':_0x2c12a8[_0xcd5b('0x1f')],'include':_0x2c12a8[_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x2c12a8[_0xcd5b('0x21')],function(_0x56701f){return{'model':db[_0x56701f[_0xcd5b('0x23')]],'as':_0x56701f['as'],'attributes':_0x56701f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd5b('0xf')](function(_0x5a282a){logger['info'](_0xcd5b('0x1a'),_0x12e9d3);logger[_0xcd5b('0x13')]('GetDynamics365Account',_0x12e9d3,JSON[_0xcd5b('0x15')](_0x5a282a));_0x11ed72(_0x5a282a);})[_0xcd5b('0x24')](function(_0x512ad9){logger[_0xcd5b('0x16')](_0xcd5b('0x1a'),_0x512ad9[_0xcd5b('0x18')],_0x12e9d3);_0x6ace31(_0x3eee9e['error'](0x1f4,_0x512ad9[_0xcd5b('0x18')]));});});};exports[_0xcd5b('0x25')]=function(_0x5971a0){var _0x27c2a6=this;return new Promise(function(_0xd08438,_0x10479d){return db[_0xcd5b('0x1b')]['find']({'raw':_0x5971a0[_0xcd5b('0x1d')]?_0x5971a0['options'][_0xcd5b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5971a0['options']?_0x5971a0[_0xcd5b('0x1d')][_0xcd5b('0x26')]||null:null,'attributes':_0x5971a0[_0xcd5b('0x1d')]?_0x5971a0[_0xcd5b('0x1d')][_0xcd5b('0x1f')]||null:null,'include':_0x5971a0[_0xcd5b('0x1d')]?_0x5971a0[_0xcd5b('0x1d')][_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x5971a0[_0xcd5b('0x1d')][_0xcd5b('0x21')],function(_0x57c5ba){return{'model':db[_0x57c5ba[_0xcd5b('0x23')]],'as':_0x57c5ba['as'],'attributes':_0x57c5ba[_0xcd5b('0x1f')],'include':_0x57c5ba[_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x57c5ba[_0xcd5b('0x21')],function(_0x234150){return{'model':db[_0x234150[_0xcd5b('0x23')]],'as':_0x234150['as'],'attributes':_0x234150[_0xcd5b('0x1f')],'include':_0x234150[_0xcd5b('0x21')]?_[_0xcd5b('0x22')](_0x234150['include'],function(_0x223a38){return{'model':db[_0x223a38['model']],'as':_0x223a38['as'],'attributes':_0x223a38[_0xcd5b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd5b('0xf')](function(_0x32eca7){logger[_0xcd5b('0x10')](_0xcd5b('0x25'),_0x5971a0);logger['debug']('ShowDynamics365Account',_0x5971a0,JSON[_0xcd5b('0x15')](_0x32eca7));_0xd08438(_0x32eca7);})[_0xcd5b('0x24')](function(_0x534abb){logger[_0xcd5b('0x16')](_0xcd5b('0x25'),_0x534abb[_0xcd5b('0x18')],_0x5971a0);_0x10479d(_0x27c2a6[_0xcd5b('0x16')](0x1f4,_0x534abb[_0xcd5b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 30901bd..e3a4a0c 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 _0xe027=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','/:id','get','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete'];(function(_0x48229a,_0x2dac65){var _0x5342e5=function(_0x3ccffe){while(--_0x3ccffe){_0x48229a['push'](_0x48229a['shift']());}};_0x5342e5(++_0x2dac65);}(_0xe027,0x106));var _0x7e02=function(_0x423f21,_0x178eb7){_0x423f21=_0x423f21-0x0;var _0x56f8b6=_0xe027[_0x423f21];return _0x56f8b6;};'use strict';var multer=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var path=require(_0x7e02('0x2'));var timeout=require(_0x7e02('0x3'));var express=require(_0x7e02('0x4'));var router=express[_0x7e02('0x5')]();var fs_extra=require(_0x7e02('0x6'));var auth=require(_0x7e02('0x7'));var interaction=require(_0x7e02('0x8'));var config=require(_0x7e02('0x9'));var controller=require(_0x7e02('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x7e02('0xb')]);router['get'](_0x7e02('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7e02('0xd')]('/:id/fields',auth[_0x7e02('0xe')](),controller[_0x7e02('0xf')]);router[_0x7e02('0xd')](_0x7e02('0x10'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x11')]);router['get'](_0x7e02('0x12'),auth['isAuthenticated'](),controller[_0x7e02('0x13')]);router[_0x7e02('0x14')]('/',auth[_0x7e02('0xe')](),controller[_0x7e02('0x15')]);router[_0x7e02('0x16')](_0x7e02('0xc'),auth[_0x7e02('0xe')](),controller['update']);router[_0x7e02('0x17')]('/:id',auth[_0x7e02('0xe')](),controller[_0x7e02('0x18')]);module[_0x7e02('0x19')]=router; \ No newline at end of file +var _0x184d=['../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47da0d,_0x34dbae){var _0x39996d=function(_0x58d8f3){while(--_0x58d8f3){_0x47da0d['push'](_0x47da0d['shift']());}};_0x39996d(++_0x34dbae);}(_0x184d,0x1d0));var _0xd184=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x184d[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require('multer');var util=require(_0xd184('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd184('0x1'));var auth=require(_0xd184('0x2'));var interaction=require(_0xd184('0x3'));var config=require(_0xd184('0x4'));var controller=require(_0xd184('0x5'));router[_0xd184('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd184('0x7'),auth[_0xd184('0x8')](),controller['show']);router[_0xd184('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd184('0x9')]);router[_0xd184('0x6')](_0xd184('0xa'),auth[_0xd184('0x8')](),controller[_0xd184('0xb')]);router[_0xd184('0x6')]('/:id/descriptions',auth[_0xd184('0x8')](),controller[_0xd184('0xc')]);router[_0xd184('0xd')]('/',auth['isAuthenticated'](),controller[_0xd184('0xe')]);router['put'](_0xd184('0x7'),auth[_0xd184('0x8')](),controller[_0xd184('0xf')]);router[_0xd184('0x10')](_0xd184('0x7'),auth[_0xd184('0x8')](),controller['destroy']);module[_0xd184('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 807f2b8..d50a9b0 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 _0x5675=['BOOLEAN','sequelize','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x78929c,_0x529d2f){var _0x1c1c5c=function(_0x5c097b){while(--_0x5c097b){_0x78929c['push'](_0x78929c['shift']());}};_0x1c1c5c(++_0x529d2f);}(_0x5675,0x71));var _0x5567=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x5675[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x5567('0x0'));module['exports']={'name':{'type':Sequelize[_0x5567('0x1')]},'description':{'type':Sequelize[_0x5567('0x1')]},'ticketType':{'type':Sequelize[_0x5567('0x2')](_0x5567('0x3'),_0x5567('0x4')),'defaultValue':_0x5567('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x5567('0x5'),_0x5567('0x6')),'defaultValue':_0x5567('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5567('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5567('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d9e=['nothing','STRING','exports','ENUM','incident','phonecall','contact'];(function(_0x5ac2c8,_0x4bdac8){var _0xd1f748=function(_0x38adab){while(--_0x38adab){_0x5ac2c8['push'](_0x5ac2c8['shift']());}};_0xd1f748(++_0x4bdac8);}(_0x7d9e,0x1c2));var _0xe7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe7d9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe7d9('0x1')](_0xe7d9('0x2'),_0xe7d9('0x3')),'defaultValue':_0xe7d9('0x2')},'moduleCreate':{'type':Sequelize[_0xe7d9('0x1')](_0xe7d9('0x4'),_0xe7d9('0x5')),'defaultValue':_0xe7d9('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe7d9('0x6')],'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 d78b369..49c74a6 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 _0x652a=['sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','filters','find','create','body','getFields','findOne','getSubjects','getDescriptions','Dynamics365Field','fast-json-patch','moment','util','path'];(function(_0x21e382,_0x36c719){var _0x1a8b7c=function(_0x482fb9){while(--_0x482fb9){_0x21e382['push'](_0x21e382['shift']());}};_0x1a8b7c(++_0x36c719);}(_0x652a,0x1d0));var _0xa652=function(_0x1efde8,_0x4a42f3){_0x1efde8=_0x1efde8-0x0;var _0x402adc=_0x652a[_0x1efde8];return _0x402adc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa652('0x0'));var rp=require('request-promise');var moment=require(_0xa652('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa652('0x2'));var path=require(_0xa652('0x3'));var sox=require(_0xa652('0x4'));var csv=require('to-csv');var ejs=require(_0xa652('0x5'));var fs=require('fs');var fs_extra=require(_0xa652('0x6'));var _=require(_0xa652('0x7'));var squel=require(_0xa652('0x8'));var crypto=require('crypto');var jsforce=require(_0xa652('0x9'));var deskjs=require(_0xa652('0xa'));var toCsv=require(_0xa652('0xb'));var querystring=require(_0xa652('0xc'));var Papa=require(_0xa652('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa652('0xe'));var as=require(_0xa652('0xf'));var hardwareService=require(_0xa652('0x10'));var logger=require(_0xa652('0x11'))('api');var utils=require(_0xa652('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa652('0x13'));var db=require(_0xa652('0x14'))['db'];function respondWithStatusCode(_0x3ba47b,_0x4a82f8){_0x4a82f8=_0x4a82f8||0xcc;return function(_0x145c0f){if(_0x145c0f){return _0x3ba47b[_0xa652('0x15')](_0x4a82f8);}return _0x3ba47b[_0xa652('0x16')](_0x4a82f8)[_0xa652('0x17')]();};}function respondWithResult(_0x2faa2d,_0x4fcae4){_0x4fcae4=_0x4fcae4||0xc8;return function(_0x29e25e){if(_0x29e25e){return _0x2faa2d[_0xa652('0x16')](_0x4fcae4)[_0xa652('0x18')](_0x29e25e);}};}function respondWithFilteredResult(_0xe666ee,_0x543932){return function(_0x58de2d){if(_0x58de2d){var _0x5d54f0=typeof _0x543932[_0xa652('0x19')]===_0xa652('0x1a')&&typeof _0x543932['limit']==='undefined';var _0x16f4f2=_0x58de2d[_0xa652('0x1b')];var _0x4019ca=_0x5d54f0?0x0:_0x543932[_0xa652('0x19')];var _0x5e4011=_0x5d54f0?_0x58de2d[_0xa652('0x1b')]:_0x543932['offset']+_0x543932['limit'];var _0x2b73bc;if(_0x5e4011>=_0x16f4f2){_0x5e4011=_0x16f4f2;_0x2b73bc=0xc8;}else{_0x2b73bc=0xce;}_0xe666ee[_0xa652('0x16')](_0x2b73bc);return _0xe666ee[_0xa652('0x1c')]('Content-Range',_0x4019ca+'-'+_0x5e4011+'/'+_0x16f4f2)[_0xa652('0x18')](_0x58de2d);}return null;};}function patchUpdates(_0x5c8184){return function(_0x1c5978){try{jsonpatch[_0xa652('0x1d')](_0x1c5978,_0x5c8184,!![]);}catch(_0x2dece4){return BPromise[_0xa652('0x1e')](_0x2dece4);}return _0x1c5978[_0xa652('0x1f')]();};}function saveUpdates(_0x28e09c,_0x22f58c){return function(_0x44b750){if(_0x44b750){return _0x44b750[_0xa652('0x20')](_0x28e09c)[_0xa652('0x21')](function(_0x1e11cb){return _0x1e11cb;});}return null;};}function removeEntity(_0x2ee8e2,_0x3225cc){return function(_0x3596cd){if(_0x3596cd){return _0x3596cd[_0xa652('0x22')]()[_0xa652('0x21')](function(){_0x2ee8e2[_0xa652('0x16')](0xcc)[_0xa652('0x17')]();});}};}function handleEntityNotFound(_0x245fa3,_0x284d95){return function(_0x15db5b){if(!_0x15db5b){_0x245fa3[_0xa652('0x15')](0x194);}return _0x15db5b;};}function handleError(_0x4523bd,_0x21e18b){_0x21e18b=_0x21e18b||0x1f4;return function(_0x5dda7d){logger[_0xa652('0x23')](_0x5dda7d[_0xa652('0x24')]);if(_0x5dda7d[_0xa652('0x25')]){delete _0x5dda7d[_0xa652('0x25')];}_0x4523bd[_0xa652('0x16')](_0x21e18b)[_0xa652('0x26')](_0x5dda7d);};}exports['index']=function(_0x1dae92,_0x25f4ec){var _0x561103={},_0x240c75={},_0x5448d9={'count':0x0,'rows':[]};var _0x1f0710=_[_0xa652('0x27')](db[_0xa652('0x28')]['rawAttributes'],function(_0x5e7db2){return{'name':_0x5e7db2[_0xa652('0x29')],'type':_0x5e7db2[_0xa652('0x2a')][_0xa652('0x2b')]};});_0x240c75[_0xa652('0x2c')]=_[_0xa652('0x27')](_0x1f0710,_0xa652('0x25'));_0x240c75[_0xa652('0x2d')]=_['keys'](_0x1dae92[_0xa652('0x2d')]);_0x240c75['filters']=_[_0xa652('0x2e')](_0x240c75[_0xa652('0x2c')],_0x240c75[_0xa652('0x2d')]);_0x561103[_0xa652('0x2f')]=_[_0xa652('0x2e')](_0x240c75[_0xa652('0x2c')],qs[_0xa652('0x30')](_0x1dae92[_0xa652('0x2d')][_0xa652('0x30')]));_0x561103[_0xa652('0x2f')]=_0x561103['attributes'][_0xa652('0x31')]?_0x561103[_0xa652('0x2f')]:_0x240c75[_0xa652('0x2c')];if(!_0x1dae92['query'][_0xa652('0x32')](_0xa652('0x33'))){_0x561103[_0xa652('0x34')]=qs[_0xa652('0x34')](_0x1dae92[_0xa652('0x2d')][_0xa652('0x34')]);_0x561103[_0xa652('0x19')]=qs[_0xa652('0x19')](_0x1dae92[_0xa652('0x2d')]['offset']);}_0x561103[_0xa652('0x35')]=qs[_0xa652('0x36')](_0x1dae92['query'][_0xa652('0x36')]);_0x561103[_0xa652('0x37')]=qs['filters'](_[_0xa652('0x38')](_0x1dae92[_0xa652('0x2d')],_0x240c75['filters']),_0x1f0710);if(_0x1dae92[_0xa652('0x2d')]['filter']){_0x561103[_0xa652('0x37')]=_[_0xa652('0x39')](_0x561103[_0xa652('0x37')],{'$or':_[_0xa652('0x27')](_0x1f0710,function(_0x5e21e2){if(_0x5e21e2[_0xa652('0x2a')]!==_0xa652('0x3a')){var _0x119459={};_0x119459[_0x5e21e2['name']]={'$like':'%'+_0x1dae92[_0xa652('0x2d')][_0xa652('0x3b')]+'%'};return _0x119459;}})});}_0x561103=_['merge']({},_0x561103,_0x1dae92[_0xa652('0x3c')]);var _0x5a4208={'where':_0x561103[_0xa652('0x37')]};return db[_0xa652('0x28')]['count'](_0x5a4208)[_0xa652('0x21')](function(_0x3e3344){_0x5448d9[_0xa652('0x1b')]=_0x3e3344;if(_0x1dae92[_0xa652('0x2d')][_0xa652('0x3d')]){_0x561103[_0xa652('0x3e')]=[{'all':!![]}];}return db[_0xa652('0x28')][_0xa652('0x3f')](_0x561103);})['then'](function(_0xabb1d3){_0x5448d9['rows']=_0xabb1d3;return _0x5448d9;})[_0xa652('0x21')](respondWithFilteredResult(_0x25f4ec,_0x561103))[_0xa652('0x40')](handleError(_0x25f4ec,null));};exports[_0xa652('0x41')]=function(_0xee889c,_0x613e82){var _0x5355c2={'raw':![],'where':{'id':_0xee889c[_0xa652('0x42')]['id']}},_0x47450={};_0x47450[_0xa652('0x2c')]=_[_0xa652('0x43')](db[_0xa652('0x28')][_0xa652('0x44')]);_0x47450['query']=_[_0xa652('0x43')](_0xee889c[_0xa652('0x2d')]);_0x47450[_0xa652('0x45')]=_['intersection'](_0x47450[_0xa652('0x2c')],_0x47450[_0xa652('0x2d')]);_0x5355c2[_0xa652('0x2f')]=_[_0xa652('0x2e')](_0x47450[_0xa652('0x2c')],qs[_0xa652('0x30')](_0xee889c[_0xa652('0x2d')][_0xa652('0x30')]));_0x5355c2[_0xa652('0x2f')]=_0x5355c2[_0xa652('0x2f')]['length']?_0x5355c2['attributes']:_0x47450[_0xa652('0x2c')];if(_0xee889c[_0xa652('0x2d')][_0xa652('0x3d')]){_0x5355c2[_0xa652('0x3e')]=[{'all':!![]}];}_0x5355c2=_[_0xa652('0x39')]({},_0x5355c2,_0xee889c[_0xa652('0x3c')]);return db[_0xa652('0x28')][_0xa652('0x46')](_0x5355c2)[_0xa652('0x21')](handleEntityNotFound(_0x613e82,null))[_0xa652('0x21')](respondWithResult(_0x613e82,null))[_0xa652('0x40')](handleError(_0x613e82,null));};exports[_0xa652('0x47')]=function(_0x1047d6,_0x362e7f){return db[_0xa652('0x28')]['create'](_0x1047d6['body'],{})[_0xa652('0x21')](respondWithResult(_0x362e7f,0xc9))['catch'](handleError(_0x362e7f,null));};exports[_0xa652('0x20')]=function(_0x1720c1,_0x3aeb57){if(_0x1720c1[_0xa652('0x48')]['id']){delete _0x1720c1['body']['id'];}return db['Dynamics365Configuration'][_0xa652('0x46')]({'where':{'id':_0x1720c1['params']['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x3aeb57,null))[_0xa652('0x21')](saveUpdates(_0x1720c1[_0xa652('0x48')],null))[_0xa652('0x21')](respondWithResult(_0x3aeb57,null))[_0xa652('0x40')](handleError(_0x3aeb57,null));};exports[_0xa652('0x22')]=function(_0x10b643,_0x3fa37b){return db['Dynamics365Configuration']['find']({'where':{'id':_0x10b643['params']['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x3fa37b,null))[_0xa652('0x21')](removeEntity(_0x3fa37b,null))[_0xa652('0x40')](handleError(_0x3fa37b,null));};exports[_0xa652('0x49')]=function(_0x2592c3,_0x5803dc,_0x17b370){var _0x433938={};var _0x23ae23={};var _0x69ed4;var _0x27e5af;return db[_0xa652('0x28')][_0xa652('0x4a')]({'where':{'id':_0x2592c3[_0xa652('0x42')]['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x5803dc,null))['then'](function(_0x492c97){if(_0x492c97){_0x69ed4=_0x492c97;_0x23ae23[_0xa652('0x2c')]=_[_0xa652('0x43')](db['Dynamics365Field'][_0xa652('0x44')]);_0x23ae23[_0xa652('0x2d')]=_[_0xa652('0x43')](_0x2592c3['query']);_0x23ae23[_0xa652('0x45')]=_[_0xa652('0x2e')](_0x23ae23[_0xa652('0x2c')],_0x23ae23['query']);_0x433938[_0xa652('0x2f')]=_['intersection'](_0x23ae23[_0xa652('0x2c')],qs[_0xa652('0x30')](_0x2592c3[_0xa652('0x2d')][_0xa652('0x30')]));_0x433938['attributes']=_0x433938[_0xa652('0x2f')][_0xa652('0x31')]?_0x433938[_0xa652('0x2f')]:_0x23ae23[_0xa652('0x2c')];_0x433938[_0xa652('0x35')]=qs[_0xa652('0x36')](_0x2592c3[_0xa652('0x2d')]['sort']);_0x433938[_0xa652('0x37')]=qs['filters'](_[_0xa652('0x38')](_0x2592c3[_0xa652('0x2d')],_0x23ae23[_0xa652('0x45')]));if(_0x2592c3[_0xa652('0x2d')][_0xa652('0x3b')]){_0x433938[_0xa652('0x37')]=_[_0xa652('0x39')](_0x433938[_0xa652('0x37')],{'$or':_['map'](_0x433938[_0xa652('0x2f')],function(_0x13c46f){var _0x32a82f={};_0x32a82f[_0x13c46f]={'$like':'%'+_0x2592c3[_0xa652('0x2d')]['filter']+'%'};return _0x32a82f;})});}_0x433938=_['merge']({},_0x433938,_0x2592c3[_0xa652('0x3c')]);return _0x69ed4[_0xa652('0x49')](_0x433938);}})['then'](function(_0x9a3784){if(_0x9a3784){_0x27e5af=_0x9a3784[_0xa652('0x31')];if(!_0x2592c3['query'][_0xa652('0x32')](_0xa652('0x33'))){_0x433938[_0xa652('0x34')]=qs['limit'](_0x2592c3[_0xa652('0x2d')][_0xa652('0x34')]);_0x433938['offset']=qs['offset'](_0x2592c3[_0xa652('0x2d')][_0xa652('0x19')]);}return _0x69ed4[_0xa652('0x49')](_0x433938);}})[_0xa652('0x21')](function(_0x1d2782){if(_0x1d2782){return _0x1d2782?{'count':_0x27e5af,'rows':_0x1d2782}:null;}})['then'](respondWithResult(_0x5803dc,null))[_0xa652('0x40')](handleError(_0x5803dc,null));};exports[_0xa652('0x4b')]=function(_0x240e3d,_0x9da6f8,_0x265d1c){var _0x126730={};var _0x1b47d1={};var _0x5decf5;var _0x1f7ee7;return db['Dynamics365Configuration'][_0xa652('0x4a')]({'where':{'id':_0x240e3d[_0xa652('0x42')]['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x9da6f8,null))[_0xa652('0x21')](function(_0x48c90b){if(_0x48c90b){_0x5decf5=_0x48c90b;_0x1b47d1['model']=_[_0xa652('0x43')](db['Dynamics365Field'][_0xa652('0x44')]);_0x1b47d1['query']=_[_0xa652('0x43')](_0x240e3d['query']);_0x1b47d1['filters']=_[_0xa652('0x2e')](_0x1b47d1[_0xa652('0x2c')],_0x1b47d1[_0xa652('0x2d')]);_0x126730['attributes']=_['intersection'](_0x1b47d1[_0xa652('0x2c')],qs['fields'](_0x240e3d[_0xa652('0x2d')][_0xa652('0x30')]));_0x126730[_0xa652('0x2f')]=_0x126730[_0xa652('0x2f')][_0xa652('0x31')]?_0x126730['attributes']:_0x1b47d1['model'];_0x126730[_0xa652('0x35')]=qs['sort'](_0x240e3d[_0xa652('0x2d')][_0xa652('0x36')]);_0x126730[_0xa652('0x37')]=qs[_0xa652('0x45')](_['pick'](_0x240e3d['query'],_0x1b47d1[_0xa652('0x45')]));if(_0x240e3d[_0xa652('0x2d')][_0xa652('0x3b')]){_0x126730[_0xa652('0x37')]=_[_0xa652('0x39')](_0x126730[_0xa652('0x37')],{'$or':_['map'](_0x126730['attributes'],function(_0x5f42fb){var _0x44a889={};_0x44a889[_0x5f42fb]={'$like':'%'+_0x240e3d[_0xa652('0x2d')][_0xa652('0x3b')]+'%'};return _0x44a889;})});}_0x126730=_[_0xa652('0x39')]({},_0x126730,_0x240e3d[_0xa652('0x3c')]);return _0x5decf5[_0xa652('0x4b')](_0x126730);}})[_0xa652('0x21')](function(_0x2ee293){if(_0x2ee293){_0x1f7ee7=_0x2ee293[_0xa652('0x31')];if(!_0x240e3d[_0xa652('0x2d')]['hasOwnProperty'](_0xa652('0x33'))){_0x126730[_0xa652('0x34')]=qs[_0xa652('0x34')](_0x240e3d[_0xa652('0x2d')]['limit']);_0x126730[_0xa652('0x19')]=qs['offset'](_0x240e3d[_0xa652('0x2d')]['offset']);}return _0x5decf5['getSubjects'](_0x126730);}})[_0xa652('0x21')](function(_0x5c831f){if(_0x5c831f){return _0x5c831f?{'count':_0x1f7ee7,'rows':_0x5c831f}:null;}})[_0xa652('0x21')](respondWithResult(_0x9da6f8,null))[_0xa652('0x40')](handleError(_0x9da6f8,null));};exports[_0xa652('0x4c')]=function(_0x53a44e,_0x433b9e,_0x18c549){var _0x26f302={};var _0x3c58e9={};var _0x4b9e91;var _0x585b94;return db[_0xa652('0x28')]['findOne']({'where':{'id':_0x53a44e[_0xa652('0x42')]['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x433b9e,null))[_0xa652('0x21')](function(_0x98084f){if(_0x98084f){_0x4b9e91=_0x98084f;_0x3c58e9[_0xa652('0x2c')]=_[_0xa652('0x43')](db[_0xa652('0x4d')][_0xa652('0x44')]);_0x3c58e9['query']=_[_0xa652('0x43')](_0x53a44e[_0xa652('0x2d')]);_0x3c58e9['filters']=_['intersection'](_0x3c58e9['model'],_0x3c58e9[_0xa652('0x2d')]);_0x26f302['attributes']=_['intersection'](_0x3c58e9[_0xa652('0x2c')],qs['fields'](_0x53a44e['query']['fields']));_0x26f302[_0xa652('0x2f')]=_0x26f302[_0xa652('0x2f')][_0xa652('0x31')]?_0x26f302['attributes']:_0x3c58e9[_0xa652('0x2c')];_0x26f302['order']=qs[_0xa652('0x36')](_0x53a44e['query'][_0xa652('0x36')]);_0x26f302[_0xa652('0x37')]=qs[_0xa652('0x45')](_[_0xa652('0x38')](_0x53a44e[_0xa652('0x2d')],_0x3c58e9[_0xa652('0x45')]));if(_0x53a44e[_0xa652('0x2d')][_0xa652('0x3b')]){_0x26f302['where']=_[_0xa652('0x39')](_0x26f302['where'],{'$or':_[_0xa652('0x27')](_0x26f302[_0xa652('0x2f')],function(_0x48b53f){var _0x30093e={};_0x30093e[_0x48b53f]={'$like':'%'+_0x53a44e[_0xa652('0x2d')][_0xa652('0x3b')]+'%'};return _0x30093e;})});}_0x26f302=_[_0xa652('0x39')]({},_0x26f302,_0x53a44e['options']);return _0x4b9e91[_0xa652('0x4c')](_0x26f302);}})[_0xa652('0x21')](function(_0x59efc2){if(_0x59efc2){_0x585b94=_0x59efc2[_0xa652('0x31')];if(!_0x53a44e[_0xa652('0x2d')][_0xa652('0x32')](_0xa652('0x33'))){_0x26f302[_0xa652('0x34')]=qs[_0xa652('0x34')](_0x53a44e[_0xa652('0x2d')][_0xa652('0x34')]);_0x26f302[_0xa652('0x19')]=qs[_0xa652('0x19')](_0x53a44e['query'][_0xa652('0x19')]);}return _0x4b9e91[_0xa652('0x4c')](_0x26f302);}})[_0xa652('0x21')](function(_0x56b133){if(_0x56b133){return _0x56b133?{'count':_0x585b94,'rows':_0x56b133}:null;}})[_0xa652('0x21')](respondWithResult(_0x433b9e,null))[_0xa652('0x40')](handleError(_0x433b9e,null));}; \ No newline at end of file +var _0x0afe=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x3b5363,_0xfade20){var _0xc98ce6=function(_0x309f29){while(--_0x309f29){_0x3b5363['push'](_0x3b5363['shift']());}};_0xc98ce6(++_0xfade20);}(_0x0afe,0x92));var _0xe0af=function(_0x36c959,_0xe2b9dd){_0x36c959=_0x36c959-0x0;var _0x95e353=_0x0afe[_0x36c959];return _0x95e353;};'use strict';var emlformat=require(_0xe0af('0x0'));var rimraf=require(_0xe0af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0af('0x2'));var rp=require('request-promise');var moment=require(_0xe0af('0x3'));var BPromise=require(_0xe0af('0x4'));var Mustache=require('mustache');var util=require(_0xe0af('0x5'));var path=require(_0xe0af('0x6'));var sox=require(_0xe0af('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0af('0x8'));var _=require('lodash');var squel=require(_0xe0af('0x9'));var crypto=require(_0xe0af('0xa'));var jsforce=require(_0xe0af('0xb'));var deskjs=require(_0xe0af('0xc'));var toCsv=require(_0xe0af('0xd'));var querystring=require(_0xe0af('0xe'));var Papa=require(_0xe0af('0xf'));var Redis=require(_0xe0af('0x10'));var authService=require(_0xe0af('0x11'));var qs=require(_0xe0af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0af('0x13'))(_0xe0af('0x14'));var utils=require(_0xe0af('0x15'));var config=require(_0xe0af('0x16'));var licenseUtil=require(_0xe0af('0x17'));var db=require(_0xe0af('0x18'))['db'];function respondWithStatusCode(_0x1f10e1,_0x135971){_0x135971=_0x135971||0xcc;return function(_0x3f3445){if(_0x3f3445){return _0x1f10e1[_0xe0af('0x19')](_0x135971);}return _0x1f10e1[_0xe0af('0x1a')](_0x135971)[_0xe0af('0x1b')]();};}function respondWithResult(_0x434563,_0xc7cf08){_0xc7cf08=_0xc7cf08||0xc8;return function(_0xaa28c9){if(_0xaa28c9){return _0x434563[_0xe0af('0x1a')](_0xc7cf08)['json'](_0xaa28c9);}};}function respondWithFilteredResult(_0x5e27e5,_0x289994){return function(_0x2d87fd){if(_0x2d87fd){var _0x1094d7=typeof _0x289994[_0xe0af('0x1c')]===_0xe0af('0x1d')&&typeof _0x289994['limit']===_0xe0af('0x1d');var _0x42cda2=_0x2d87fd[_0xe0af('0x1e')];var _0x1986ae=_0x1094d7?0x0:_0x289994[_0xe0af('0x1c')];var _0x133df4=_0x1094d7?_0x2d87fd[_0xe0af('0x1e')]:_0x289994[_0xe0af('0x1c')]+_0x289994['limit'];var _0x577711;if(_0x133df4>=_0x42cda2){_0x133df4=_0x42cda2;_0x577711=0xc8;}else{_0x577711=0xce;}_0x5e27e5[_0xe0af('0x1a')](_0x577711);return _0x5e27e5[_0xe0af('0x1f')](_0xe0af('0x20'),_0x1986ae+'-'+_0x133df4+'/'+_0x42cda2)[_0xe0af('0x21')](_0x2d87fd);}return null;};}function patchUpdates(_0x1b97b1){return function(_0x1d4006){try{jsonpatch[_0xe0af('0x22')](_0x1d4006,_0x1b97b1,!![]);}catch(_0x4bd31d){return BPromise[_0xe0af('0x23')](_0x4bd31d);}return _0x1d4006[_0xe0af('0x24')]();};}function saveUpdates(_0x53a56b,_0xdd03c3){return function(_0x5e4ef4){if(_0x5e4ef4){return _0x5e4ef4[_0xe0af('0x25')](_0x53a56b)[_0xe0af('0x26')](function(_0x470678){return _0x470678;});}return null;};}function removeEntity(_0x19343f,_0x2c3be5){return function(_0x26aa33){if(_0x26aa33){return _0x26aa33[_0xe0af('0x27')]()[_0xe0af('0x26')](function(){_0x19343f['status'](0xcc)[_0xe0af('0x1b')]();});}};}function handleEntityNotFound(_0x59d4f7,_0x52f446){return function(_0x245369){if(!_0x245369){_0x59d4f7[_0xe0af('0x19')](0x194);}return _0x245369;};}function handleError(_0x87709b,_0x1adebb){_0x1adebb=_0x1adebb||0x1f4;return function(_0x15290d){logger[_0xe0af('0x28')](_0x15290d[_0xe0af('0x29')]);if(_0x15290d[_0xe0af('0x2a')]){delete _0x15290d[_0xe0af('0x2a')];}_0x87709b[_0xe0af('0x1a')](_0x1adebb)[_0xe0af('0x2b')](_0x15290d);};}exports['index']=function(_0x41e1c6,_0x5a1cef){var _0xb3856e={},_0xea3499={},_0x4ed9e3={'count':0x0,'rows':[]};var _0x1d0d5c=_[_0xe0af('0x2c')](db[_0xe0af('0x2d')][_0xe0af('0x2e')],function(_0x18d7ca){return{'name':_0x18d7ca['fieldName'],'type':_0x18d7ca[_0xe0af('0x2f')][_0xe0af('0x30')]};});_0xea3499[_0xe0af('0x31')]=_[_0xe0af('0x2c')](_0x1d0d5c,'name');_0xea3499['query']=_['keys'](_0x41e1c6[_0xe0af('0x32')]);_0xea3499[_0xe0af('0x33')]=_['intersection'](_0xea3499[_0xe0af('0x31')],_0xea3499[_0xe0af('0x32')]);_0xb3856e['attributes']=_[_0xe0af('0x34')](_0xea3499['model'],qs[_0xe0af('0x35')](_0x41e1c6['query'][_0xe0af('0x35')]));_0xb3856e[_0xe0af('0x36')]=_0xb3856e[_0xe0af('0x36')][_0xe0af('0x37')]?_0xb3856e['attributes']:_0xea3499[_0xe0af('0x31')];if(!_0x41e1c6['query'][_0xe0af('0x38')](_0xe0af('0x39'))){_0xb3856e[_0xe0af('0x3a')]=qs[_0xe0af('0x3a')](_0x41e1c6[_0xe0af('0x32')][_0xe0af('0x3a')]);_0xb3856e[_0xe0af('0x1c')]=qs[_0xe0af('0x1c')](_0x41e1c6[_0xe0af('0x32')][_0xe0af('0x1c')]);}_0xb3856e[_0xe0af('0x3b')]=qs[_0xe0af('0x3c')](_0x41e1c6[_0xe0af('0x32')]['sort']);_0xb3856e['where']=qs[_0xe0af('0x33')](_['pick'](_0x41e1c6[_0xe0af('0x32')],_0xea3499['filters']),_0x1d0d5c);if(_0x41e1c6[_0xe0af('0x32')][_0xe0af('0x3d')]){_0xb3856e[_0xe0af('0x3e')]=_[_0xe0af('0x3f')](_0xb3856e['where'],{'$or':_['map'](_0x1d0d5c,function(_0x4ca83d){if(_0x4ca83d[_0xe0af('0x2f')]!==_0xe0af('0x40')){var _0x1025ee={};_0x1025ee[_0x4ca83d[_0xe0af('0x2a')]]={'$like':'%'+_0x41e1c6[_0xe0af('0x32')]['filter']+'%'};return _0x1025ee;}})});}_0xb3856e=_[_0xe0af('0x3f')]({},_0xb3856e,_0x41e1c6[_0xe0af('0x41')]);var _0x5523ed={'where':_0xb3856e[_0xe0af('0x3e')]};return db[_0xe0af('0x2d')]['count'](_0x5523ed)['then'](function(_0x4bf307){_0x4ed9e3['count']=_0x4bf307;if(_0x41e1c6[_0xe0af('0x32')][_0xe0af('0x42')]){_0xb3856e[_0xe0af('0x43')]=[{'all':!![]}];}return db[_0xe0af('0x2d')][_0xe0af('0x44')](_0xb3856e);})['then'](function(_0x363149){_0x4ed9e3[_0xe0af('0x45')]=_0x363149;return _0x4ed9e3;})[_0xe0af('0x26')](respondWithFilteredResult(_0x5a1cef,_0xb3856e))[_0xe0af('0x46')](handleError(_0x5a1cef,null));};exports[_0xe0af('0x47')]=function(_0x4a5b97,_0x5ca261){var _0x816993={'raw':![],'where':{'id':_0x4a5b97[_0xe0af('0x48')]['id']}},_0x57a65b={};_0x57a65b[_0xe0af('0x31')]=_[_0xe0af('0x49')](db[_0xe0af('0x2d')][_0xe0af('0x2e')]);_0x57a65b[_0xe0af('0x32')]=_[_0xe0af('0x49')](_0x4a5b97[_0xe0af('0x32')]);_0x57a65b[_0xe0af('0x33')]=_[_0xe0af('0x34')](_0x57a65b[_0xe0af('0x31')],_0x57a65b['query']);_0x816993['attributes']=_[_0xe0af('0x34')](_0x57a65b[_0xe0af('0x31')],qs[_0xe0af('0x35')](_0x4a5b97['query']['fields']));_0x816993[_0xe0af('0x36')]=_0x816993[_0xe0af('0x36')][_0xe0af('0x37')]?_0x816993['attributes']:_0x57a65b[_0xe0af('0x31')];if(_0x4a5b97[_0xe0af('0x32')][_0xe0af('0x42')]){_0x816993[_0xe0af('0x43')]=[{'all':!![]}];}_0x816993=_[_0xe0af('0x3f')]({},_0x816993,_0x4a5b97[_0xe0af('0x41')]);return db[_0xe0af('0x2d')]['find'](_0x816993)[_0xe0af('0x26')](handleEntityNotFound(_0x5ca261,null))['then'](respondWithResult(_0x5ca261,null))[_0xe0af('0x46')](handleError(_0x5ca261,null));};exports['create']=function(_0x462e36,_0x3893b4){return db['Dynamics365Configuration'][_0xe0af('0x4a')](_0x462e36[_0xe0af('0x4b')],{})[_0xe0af('0x26')](respondWithResult(_0x3893b4,0xc9))[_0xe0af('0x46')](handleError(_0x3893b4,null));};exports['update']=function(_0x1332c5,_0x498eed){if(_0x1332c5[_0xe0af('0x4b')]['id']){delete _0x1332c5['body']['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x1332c5['params']['id']}})[_0xe0af('0x26')](handleEntityNotFound(_0x498eed,null))[_0xe0af('0x26')](saveUpdates(_0x1332c5[_0xe0af('0x4b')],null))['then'](respondWithResult(_0x498eed,null))[_0xe0af('0x46')](handleError(_0x498eed,null));};exports[_0xe0af('0x27')]=function(_0x467109,_0x479150){return db[_0xe0af('0x2d')][_0xe0af('0x4c')]({'where':{'id':_0x467109[_0xe0af('0x48')]['id']}})[_0xe0af('0x26')](handleEntityNotFound(_0x479150,null))[_0xe0af('0x26')](removeEntity(_0x479150,null))[_0xe0af('0x46')](handleError(_0x479150,null));};exports[_0xe0af('0x4d')]=function(_0x433c49,_0x1303a6,_0x5b596a){var _0xfe8d8a={};var _0x2aea76={};var _0x5135b0;var _0x327c25;return db[_0xe0af('0x2d')]['findOne']({'where':{'id':_0x433c49[_0xe0af('0x48')]['id']}})[_0xe0af('0x26')](handleEntityNotFound(_0x1303a6,null))[_0xe0af('0x26')](function(_0x2e35f3){if(_0x2e35f3){_0x5135b0=_0x2e35f3;_0x2aea76[_0xe0af('0x31')]=_[_0xe0af('0x49')](db[_0xe0af('0x4e')][_0xe0af('0x2e')]);_0x2aea76[_0xe0af('0x32')]=_[_0xe0af('0x49')](_0x433c49[_0xe0af('0x32')]);_0x2aea76[_0xe0af('0x33')]=_['intersection'](_0x2aea76[_0xe0af('0x31')],_0x2aea76[_0xe0af('0x32')]);_0xfe8d8a['attributes']=_[_0xe0af('0x34')](_0x2aea76[_0xe0af('0x31')],qs[_0xe0af('0x35')](_0x433c49[_0xe0af('0x32')][_0xe0af('0x35')]));_0xfe8d8a['attributes']=_0xfe8d8a['attributes'][_0xe0af('0x37')]?_0xfe8d8a[_0xe0af('0x36')]:_0x2aea76[_0xe0af('0x31')];_0xfe8d8a['order']=qs[_0xe0af('0x3c')](_0x433c49[_0xe0af('0x32')][_0xe0af('0x3c')]);_0xfe8d8a['where']=qs[_0xe0af('0x33')](_[_0xe0af('0x4f')](_0x433c49[_0xe0af('0x32')],_0x2aea76[_0xe0af('0x33')]));if(_0x433c49['query'][_0xe0af('0x3d')]){_0xfe8d8a[_0xe0af('0x3e')]=_[_0xe0af('0x3f')](_0xfe8d8a['where'],{'$or':_['map'](_0xfe8d8a['attributes'],function(_0x1f5c91){var _0x4c3a5b={};_0x4c3a5b[_0x1f5c91]={'$like':'%'+_0x433c49['query'][_0xe0af('0x3d')]+'%'};return _0x4c3a5b;})});}_0xfe8d8a=_['merge']({},_0xfe8d8a,_0x433c49['options']);return _0x5135b0[_0xe0af('0x4d')](_0xfe8d8a);}})[_0xe0af('0x26')](function(_0x2f8eda){if(_0x2f8eda){_0x327c25=_0x2f8eda[_0xe0af('0x37')];if(!_0x433c49['query'][_0xe0af('0x38')](_0xe0af('0x39'))){_0xfe8d8a[_0xe0af('0x3a')]=qs[_0xe0af('0x3a')](_0x433c49[_0xe0af('0x32')]['limit']);_0xfe8d8a[_0xe0af('0x1c')]=qs[_0xe0af('0x1c')](_0x433c49[_0xe0af('0x32')][_0xe0af('0x1c')]);}return _0x5135b0[_0xe0af('0x4d')](_0xfe8d8a);}})[_0xe0af('0x26')](function(_0x2d1b92){if(_0x2d1b92){return _0x2d1b92?{'count':_0x327c25,'rows':_0x2d1b92}:null;}})[_0xe0af('0x26')](respondWithResult(_0x1303a6,null))[_0xe0af('0x46')](handleError(_0x1303a6,null));};exports[_0xe0af('0x50')]=function(_0x3885b3,_0x3fa25c,_0xf45ca6){var _0x2012c2={};var _0x393b5b={};var _0x7822d9;var _0x371feb;return db[_0xe0af('0x2d')][_0xe0af('0x51')]({'where':{'id':_0x3885b3['params']['id']}})[_0xe0af('0x26')](handleEntityNotFound(_0x3fa25c,null))[_0xe0af('0x26')](function(_0x9fd538){if(_0x9fd538){_0x7822d9=_0x9fd538;_0x393b5b[_0xe0af('0x31')]=_[_0xe0af('0x49')](db[_0xe0af('0x4e')][_0xe0af('0x2e')]);_0x393b5b['query']=_[_0xe0af('0x49')](_0x3885b3[_0xe0af('0x32')]);_0x393b5b['filters']=_['intersection'](_0x393b5b[_0xe0af('0x31')],_0x393b5b[_0xe0af('0x32')]);_0x2012c2[_0xe0af('0x36')]=_[_0xe0af('0x34')](_0x393b5b[_0xe0af('0x31')],qs[_0xe0af('0x35')](_0x3885b3[_0xe0af('0x32')][_0xe0af('0x35')]));_0x2012c2[_0xe0af('0x36')]=_0x2012c2[_0xe0af('0x36')][_0xe0af('0x37')]?_0x2012c2[_0xe0af('0x36')]:_0x393b5b['model'];_0x2012c2['order']=qs['sort'](_0x3885b3[_0xe0af('0x32')][_0xe0af('0x3c')]);_0x2012c2[_0xe0af('0x3e')]=qs[_0xe0af('0x33')](_['pick'](_0x3885b3[_0xe0af('0x32')],_0x393b5b[_0xe0af('0x33')]));if(_0x3885b3[_0xe0af('0x32')]['filter']){_0x2012c2[_0xe0af('0x3e')]=_[_0xe0af('0x3f')](_0x2012c2[_0xe0af('0x3e')],{'$or':_[_0xe0af('0x2c')](_0x2012c2[_0xe0af('0x36')],function(_0x21c7e3){var _0x21d639={};_0x21d639[_0x21c7e3]={'$like':'%'+_0x3885b3['query']['filter']+'%'};return _0x21d639;})});}_0x2012c2=_['merge']({},_0x2012c2,_0x3885b3[_0xe0af('0x41')]);return _0x7822d9[_0xe0af('0x50')](_0x2012c2);}})['then'](function(_0x3b9431){if(_0x3b9431){_0x371feb=_0x3b9431['length'];if(!_0x3885b3['query'][_0xe0af('0x38')](_0xe0af('0x39'))){_0x2012c2[_0xe0af('0x3a')]=qs[_0xe0af('0x3a')](_0x3885b3[_0xe0af('0x32')]['limit']);_0x2012c2[_0xe0af('0x1c')]=qs[_0xe0af('0x1c')](_0x3885b3['query'][_0xe0af('0x1c')]);}return _0x7822d9['getSubjects'](_0x2012c2);}})[_0xe0af('0x26')](function(_0x99d81c){if(_0x99d81c){return _0x99d81c?{'count':_0x371feb,'rows':_0x99d81c}:null;}})[_0xe0af('0x26')](respondWithResult(_0x3fa25c,null))[_0xe0af('0x46')](handleError(_0x3fa25c,null));};exports[_0xe0af('0x52')]=function(_0x30f005,_0xadba56,_0x3030fa){var _0x63b8fb={};var _0x165bb1={};var _0x1ea7ce;var _0x59f40e;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x30f005[_0xe0af('0x48')]['id']}})['then'](handleEntityNotFound(_0xadba56,null))[_0xe0af('0x26')](function(_0x1bbf28){if(_0x1bbf28){_0x1ea7ce=_0x1bbf28;_0x165bb1['model']=_[_0xe0af('0x49')](db['Dynamics365Field']['rawAttributes']);_0x165bb1['query']=_['keys'](_0x30f005[_0xe0af('0x32')]);_0x165bb1[_0xe0af('0x33')]=_['intersection'](_0x165bb1['model'],_0x165bb1[_0xe0af('0x32')]);_0x63b8fb[_0xe0af('0x36')]=_['intersection'](_0x165bb1[_0xe0af('0x31')],qs[_0xe0af('0x35')](_0x30f005['query'][_0xe0af('0x35')]));_0x63b8fb[_0xe0af('0x36')]=_0x63b8fb[_0xe0af('0x36')]['length']?_0x63b8fb[_0xe0af('0x36')]:_0x165bb1[_0xe0af('0x31')];_0x63b8fb['order']=qs[_0xe0af('0x3c')](_0x30f005[_0xe0af('0x32')][_0xe0af('0x3c')]);_0x63b8fb[_0xe0af('0x3e')]=qs[_0xe0af('0x33')](_[_0xe0af('0x4f')](_0x30f005[_0xe0af('0x32')],_0x165bb1[_0xe0af('0x33')]));if(_0x30f005[_0xe0af('0x32')][_0xe0af('0x3d')]){_0x63b8fb['where']=_['merge'](_0x63b8fb['where'],{'$or':_[_0xe0af('0x2c')](_0x63b8fb[_0xe0af('0x36')],function(_0x243269){var _0x22a8c9={};_0x22a8c9[_0x243269]={'$like':'%'+_0x30f005[_0xe0af('0x32')][_0xe0af('0x3d')]+'%'};return _0x22a8c9;})});}_0x63b8fb=_['merge']({},_0x63b8fb,_0x30f005['options']);return _0x1ea7ce[_0xe0af('0x52')](_0x63b8fb);}})['then'](function(_0x37c456){if(_0x37c456){_0x59f40e=_0x37c456[_0xe0af('0x37')];if(!_0x30f005[_0xe0af('0x32')][_0xe0af('0x38')]('nolimit')){_0x63b8fb['limit']=qs[_0xe0af('0x3a')](_0x30f005['query']['limit']);_0x63b8fb[_0xe0af('0x1c')]=qs['offset'](_0x30f005[_0xe0af('0x32')][_0xe0af('0x1c')]);}return _0x1ea7ce['getDescriptions'](_0x63b8fb);}})[_0xe0af('0x26')](function(_0x2fa2fc){if(_0x2fa2fc){return _0x2fa2fc?{'count':_0x59f40e,'rows':_0x2fa2fc}:null;}})[_0xe0af('0x26')](respondWithResult(_0xadba56,null))[_0xe0af('0x46')](handleError(_0xadba56,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1083b3b..d0af3df 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 _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x4b84[_0x51beba];return _0x167ee0;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x4dde11,_0x341645){var _0x1384f0=function(_0x53bf0e){while(--_0x53bf0e){_0x4dde11['push'](_0x4dde11['shift']());}};_0x1384f0(++_0x341645);}(_0x84ab,0x12f));var _0xb84a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x84ab[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 686fedc..301d029 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 _0x8877=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x2264d0,_0x236367){var _0x2d3ec2=function(_0x1a0d29){while(--_0x1a0d29){_0x2264d0['push'](_0x2264d0['shift']());}};_0x2d3ec2(++_0x236367);}(_0x8877,0x138));var _0x7887=function(_0x2e6299,_0x2f20dc){_0x2e6299=_0x2e6299-0x0;var _0x3098ff=_0x8877[_0x2e6299];return _0x3098ff;};'use strict';var _=require(_0x7887('0x0'));var util=require(_0x7887('0x1'));var moment=require(_0x7887('0x2'));var BPromise=require(_0x7887('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7887('0x4'))['db'];var utils=require(_0x7887('0x5'));var logger=require(_0x7887('0x6'))(_0x7887('0x7'));var config=require('../../config/environment');var jayson=require(_0x7887('0x8'));var client=jayson[_0x7887('0x9')][_0x7887('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4753ba,_0x2a4137,_0x139078){return new BPromise(function(_0x23427d,_0x3710d3){return client['request'](_0x4753ba,_0x139078)[_0x7887('0xb')](function(_0x40d805){logger[_0x7887('0xc')](_0x7887('0xd'),_0x2a4137,_0x7887('0xe'));logger[_0x7887('0xf')](_0x7887('0x10'),_0x2a4137,_0x7887('0xe'),JSON['stringify'](_0x40d805));if(_0x40d805['error']){if(_0x40d805[_0x7887('0x11')][_0x7887('0x12')]===0x1f4){logger[_0x7887('0x11')](_0x7887('0xd'),_0x2a4137,_0x40d805[_0x7887('0x11')][_0x7887('0x13')]);return _0x3710d3(_0x40d805[_0x7887('0x11')]['message']);}logger[_0x7887('0x11')](_0x7887('0xd'),_0x2a4137,_0x40d805[_0x7887('0x11')][_0x7887('0x13')]);return _0x23427d(_0x40d805[_0x7887('0x11')]['message']);}else{logger[_0x7887('0xc')](_0x7887('0xd'),_0x2a4137,_0x7887('0xe'));_0x23427d(_0x40d805[_0x7887('0x14')][_0x7887('0x13')]);}})[_0x7887('0x15')](function(_0x88192b){logger[_0x7887('0x11')](_0x7887('0xd'),_0x2a4137,_0x88192b);_0x3710d3(_0x88192b);});});} \ No newline at end of file +var _0x3b5a=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x556307,_0x3c677f){var _0x308b4e=function(_0x3e3089){while(--_0x3e3089){_0x556307['push'](_0x556307['shift']());}};_0x308b4e(++_0x3c677f);}(_0x3b5a,0x130));var _0xa3b5=function(_0x310926,_0x226e01){_0x310926=_0x310926-0x0;var _0x205927=_0x3b5a[_0x310926];return _0x205927;};'use strict';var _=require(_0xa3b5('0x0'));var util=require(_0xa3b5('0x1'));var moment=require(_0xa3b5('0x2'));var BPromise=require(_0xa3b5('0x3'));var rs=require(_0xa3b5('0x4'));var fs=require('fs');var Redis=require(_0xa3b5('0x5'));var db=require(_0xa3b5('0x6'))['db'];var utils=require(_0xa3b5('0x7'));var logger=require('../../config/logger')(_0xa3b5('0x8'));var config=require(_0xa3b5('0x9'));var jayson=require(_0xa3b5('0xa'));var client=jayson[_0xa3b5('0xb')][_0xa3b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x399107,_0x573a06,_0x800b9d){return new BPromise(function(_0x4b4d43,_0x52f78c){return client[_0xa3b5('0xd')](_0x399107,_0x800b9d)[_0xa3b5('0xe')](function(_0x1aa88d){logger[_0xa3b5('0xf')](_0xa3b5('0x10'),_0x573a06,_0xa3b5('0x11'));logger['debug'](_0xa3b5('0x12'),_0x573a06,_0xa3b5('0x11'),JSON[_0xa3b5('0x13')](_0x1aa88d));if(_0x1aa88d[_0xa3b5('0x14')]){if(_0x1aa88d[_0xa3b5('0x14')]['code']===0x1f4){logger[_0xa3b5('0x14')](_0xa3b5('0x10'),_0x573a06,_0x1aa88d[_0xa3b5('0x14')][_0xa3b5('0x15')]);return _0x52f78c(_0x1aa88d[_0xa3b5('0x14')][_0xa3b5('0x15')]);}logger[_0xa3b5('0x14')](_0xa3b5('0x10'),_0x573a06,_0x1aa88d[_0xa3b5('0x14')][_0xa3b5('0x15')]);return _0x4b4d43(_0x1aa88d[_0xa3b5('0x14')][_0xa3b5('0x15')]);}else{logger[_0xa3b5('0xf')](_0xa3b5('0x10'),_0x573a06,_0xa3b5('0x11'));_0x4b4d43(_0x1aa88d['result'][_0xa3b5('0x15')]);}})[_0xa3b5('0x16')](function(_0x816e8b){logger[_0xa3b5('0x14')](_0xa3b5('0x10'),_0x573a06,_0x816e8b);_0x52f78c(_0x816e8b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bc17a45..c1c0d26 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 _0x7f00=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','index','get','/:id','isAuthenticated','create','put','update','destroy','util','path'];(function(_0x1df3e5,_0x2d37f1){var _0x422d0c=function(_0x51d43f){while(--_0x51d43f){_0x1df3e5['push'](_0x1df3e5['shift']());}};_0x422d0c(++_0x2d37f1);}(_0x7f00,0xfe));var _0x07f0=function(_0x26b462,_0x4a2fe2){_0x26b462=_0x26b462-0x0;var _0x5050af=_0x7f00[_0x26b462];return _0x5050af;};'use strict';var multer=require('multer');var util=require(_0x07f0('0x0'));var path=require(_0x07f0('0x1'));var timeout=require(_0x07f0('0x2'));var express=require(_0x07f0('0x3'));var router=express[_0x07f0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x07f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x07f0('0x6'));var controller=require(_0x07f0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x07f0('0x8')]);router[_0x07f0('0x9')](_0x07f0('0xa'),auth[_0x07f0('0xb')](),controller['show']);router['post']('/',auth[_0x07f0('0xb')](),controller[_0x07f0('0xc')]);router[_0x07f0('0xd')](_0x07f0('0xa'),auth[_0x07f0('0xb')](),controller[_0x07f0('0xe')]);router['delete'](_0x07f0('0xa'),auth[_0x07f0('0xb')](),controller[_0x07f0('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe5a6=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x2538ca,_0xb651c1){var _0x5b4cee=function(_0x1ad646){while(--_0x1ad646){_0x2538ca['push'](_0x2538ca['shift']());}};_0x5b4cee(++_0xb651c1);}(_0xe5a6,0x172));var _0x6e5a=function(_0x42c903,_0x5c81bc){_0x42c903=_0x42c903-0x0;var _0xcfd717=_0xe5a6[_0x42c903];return _0xcfd717;};'use strict';var multer=require(_0x6e5a('0x0'));var util=require(_0x6e5a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6e5a('0x2'));var router=express[_0x6e5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e5a('0x4'));var interaction=require(_0x6e5a('0x5'));var config=require(_0x6e5a('0x6'));var controller=require(_0x6e5a('0x7'));router[_0x6e5a('0x8')]('/',auth[_0x6e5a('0x9')](),controller[_0x6e5a('0xa')]);router['get'](_0x6e5a('0xb'),auth[_0x6e5a('0x9')](),controller[_0x6e5a('0xc')]);router['post']('/',auth[_0x6e5a('0x9')](),controller[_0x6e5a('0xd')]);router[_0x6e5a('0xe')](_0x6e5a('0xb'),auth['isAuthenticated'](),controller[_0x6e5a('0xf')]);router[_0x6e5a('0x10')](_0x6e5a('0xb'),auth[_0x6e5a('0x9')](),controller[_0x6e5a('0x11')]);module[_0x6e5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 64b9781..843517f 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 _0x167c=['customVariable','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x167c,0x7f));var _0xc167=function(_0x422bd4,_0x4408ec){_0x422bd4=_0x422bd4-0x0;var _0x3acc39=_0x167c[_0x422bd4];return _0x3acc39;};'use strict';var Sequelize=require(_0xc167('0x0'));module[_0xc167('0x1')]={'type':{'type':Sequelize[_0xc167('0x2')]('string',_0xc167('0x3'),'customVariable',_0xc167('0x4'),_0xc167('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc167('0x6')]},'key':{'type':Sequelize[_0xc167('0x6')]},'keyType':{'type':Sequelize[_0xc167('0x2')](_0xc167('0x7'),_0xc167('0x3'),_0xc167('0x8'))},'keyContent':{'type':Sequelize[_0xc167('0x6')]},'idField':{'type':Sequelize[_0xc167('0x6')]},'nameField':{'type':Sequelize[_0xc167('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaae5=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaae5,0x1e5));var _0x5aae=function(_0x3d1bf9,_0x4d36c5){_0x3d1bf9=_0x3d1bf9-0x0;var _0x162988=_0xaae5[_0x3d1bf9];return _0x162988;};'use strict';var Sequelize=require(_0x5aae('0x0'));module['exports']={'type':{'type':Sequelize[_0x5aae('0x1')](_0x5aae('0x2'),_0x5aae('0x3'),_0x5aae('0x4'),_0x5aae('0x5'),_0x5aae('0x6')),'defaultValue':_0x5aae('0x2')},'content':{'type':Sequelize[_0x5aae('0x7')]},'key':{'type':Sequelize[_0x5aae('0x7')]},'keyType':{'type':Sequelize[_0x5aae('0x1')](_0x5aae('0x2'),_0x5aae('0x3'),_0x5aae('0x4'))},'keyContent':{'type':Sequelize[_0x5aae('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5aae('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5aae('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 86a5b46..410417b 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 _0x88b1=['sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','rows','show','params','catch','create','body','update','find','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x3f9c5d,_0x283784){var _0x2f2c73=function(_0x22bb42){while(--_0x22bb42){_0x3f9c5d['push'](_0x3f9c5d['shift']());}};_0x2f2c73(++_0x283784);}(_0x88b1,0x126));var _0x188b=function(_0x15f978,_0x979ce7){_0x15f978=_0x15f978-0x0;var _0x2889b3=_0x88b1[_0x15f978];return _0x2889b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x188b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x188b('0x1'));var BPromise=require(_0x188b('0x2'));var Mustache=require(_0x188b('0x3'));var util=require(_0x188b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x188b('0x5'));var ejs=require(_0x188b('0x6'));var fs=require('fs');var fs_extra=require(_0x188b('0x7'));var _=require(_0x188b('0x8'));var squel=require(_0x188b('0x9'));var crypto=require('crypto');var jsforce=require(_0x188b('0xa'));var deskjs=require(_0x188b('0xb'));var toCsv=require(_0x188b('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x188b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x188b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x188b('0xe'));var logger=require(_0x188b('0xf'))(_0x188b('0x10'));var utils=require(_0x188b('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x188b('0x12'))['db'];function respondWithStatusCode(_0x2294ac,_0x3f6786){_0x3f6786=_0x3f6786||0xcc;return function(_0x497288){if(_0x497288){return _0x2294ac[_0x188b('0x13')](_0x3f6786);}return _0x2294ac[_0x188b('0x14')](_0x3f6786)[_0x188b('0x15')]();};}function respondWithResult(_0x59ee78,_0x4166fa){_0x4166fa=_0x4166fa||0xc8;return function(_0x5178e3){if(_0x5178e3){return _0x59ee78[_0x188b('0x14')](_0x4166fa)['json'](_0x5178e3);}};}function respondWithFilteredResult(_0x42c3b1,_0x14c996){return function(_0x40e42e){if(_0x40e42e){var _0x2e9d5c=typeof _0x14c996[_0x188b('0x16')]==='undefined'&&typeof _0x14c996[_0x188b('0x17')]===_0x188b('0x18');var _0x22fd39=_0x40e42e['count'];var _0x203ab2=_0x2e9d5c?0x0:_0x14c996[_0x188b('0x16')];var _0x123dc5=_0x2e9d5c?_0x40e42e[_0x188b('0x19')]:_0x14c996[_0x188b('0x16')]+_0x14c996[_0x188b('0x17')];var _0x354e4a;if(_0x123dc5>=_0x22fd39){_0x123dc5=_0x22fd39;_0x354e4a=0xc8;}else{_0x354e4a=0xce;}_0x42c3b1[_0x188b('0x14')](_0x354e4a);return _0x42c3b1[_0x188b('0x1a')]('Content-Range',_0x203ab2+'-'+_0x123dc5+'/'+_0x22fd39)[_0x188b('0x1b')](_0x40e42e);}return null;};}function patchUpdates(_0x27bfe9){return function(_0x71b511){try{jsonpatch[_0x188b('0x1c')](_0x71b511,_0x27bfe9,!![]);}catch(_0x407760){return BPromise['reject'](_0x407760);}return _0x71b511[_0x188b('0x1d')]();};}function saveUpdates(_0x59c13b,_0x4c4829){return function(_0xf05ec2){if(_0xf05ec2){return _0xf05ec2['update'](_0x59c13b)[_0x188b('0x1e')](function(_0x40a445){return _0x40a445;});}return null;};}function removeEntity(_0x39f5df,_0x6af7c2){return function(_0x6231de){if(_0x6231de){return _0x6231de[_0x188b('0x1f')]()['then'](function(){_0x39f5df['status'](0xcc)[_0x188b('0x15')]();});}};}function handleEntityNotFound(_0x56f365,_0x26ee3b){return function(_0x201fdd){if(!_0x201fdd){_0x56f365['sendStatus'](0x194);}return _0x201fdd;};}function handleError(_0xb7ca37,_0x378863){_0x378863=_0x378863||0x1f4;return function(_0x5e9c5e){logger[_0x188b('0x20')](_0x5e9c5e[_0x188b('0x21')]);if(_0x5e9c5e['name']){delete _0x5e9c5e[_0x188b('0x22')];}_0xb7ca37[_0x188b('0x14')](_0x378863)[_0x188b('0x23')](_0x5e9c5e);};}exports[_0x188b('0x24')]=function(_0x5dbe3e,_0x4feabc){var _0x474c8b={},_0x4a27ae={},_0x3f11e5={'count':0x0,'rows':[]};var _0x2040c5=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x556b41){return{'name':_0x556b41[_0x188b('0x25')],'type':_0x556b41[_0x188b('0x26')][_0x188b('0x27')]};});_0x4a27ae[_0x188b('0x28')]=_[_0x188b('0x29')](_0x2040c5,_0x188b('0x22'));_0x4a27ae['query']=_[_0x188b('0x2a')](_0x5dbe3e[_0x188b('0x2b')]);_0x4a27ae[_0x188b('0x2c')]=_['intersection'](_0x4a27ae[_0x188b('0x28')],_0x4a27ae['query']);_0x474c8b[_0x188b('0x2d')]=_[_0x188b('0x2e')](_0x4a27ae['model'],qs[_0x188b('0x2f')](_0x5dbe3e[_0x188b('0x2b')][_0x188b('0x2f')]));_0x474c8b['attributes']=_0x474c8b[_0x188b('0x2d')][_0x188b('0x30')]?_0x474c8b[_0x188b('0x2d')]:_0x4a27ae[_0x188b('0x28')];if(!_0x5dbe3e[_0x188b('0x2b')][_0x188b('0x31')]('nolimit')){_0x474c8b[_0x188b('0x17')]=qs['limit'](_0x5dbe3e['query']['limit']);_0x474c8b[_0x188b('0x16')]=qs[_0x188b('0x16')](_0x5dbe3e[_0x188b('0x2b')]['offset']);}_0x474c8b[_0x188b('0x32')]=qs[_0x188b('0x33')](_0x5dbe3e[_0x188b('0x2b')]['sort']);_0x474c8b[_0x188b('0x34')]=qs['filters'](_[_0x188b('0x35')](_0x5dbe3e['query'],_0x4a27ae[_0x188b('0x2c')]),_0x2040c5);if(_0x5dbe3e['query'][_0x188b('0x36')]){_0x474c8b[_0x188b('0x34')]=_[_0x188b('0x37')](_0x474c8b[_0x188b('0x34')],{'$or':_[_0x188b('0x29')](_0x2040c5,function(_0x33317c){if(_0x33317c[_0x188b('0x26')]!==_0x188b('0x38')){var _0x41bc8f={};_0x41bc8f[_0x33317c['name']]={'$like':'%'+_0x5dbe3e[_0x188b('0x2b')]['filter']+'%'};return _0x41bc8f;}})});}_0x474c8b=_[_0x188b('0x37')]({},_0x474c8b,_0x5dbe3e[_0x188b('0x39')]);var _0x187406={'where':_0x474c8b[_0x188b('0x34')]};return db[_0x188b('0x3a')][_0x188b('0x19')](_0x187406)['then'](function(_0x5d89a5){_0x3f11e5['count']=_0x5d89a5;if(_0x5dbe3e['query'][_0x188b('0x3b')]){_0x474c8b[_0x188b('0x3c')]=[{'all':!![]}];}return db[_0x188b('0x3a')]['findAll'](_0x474c8b);})[_0x188b('0x1e')](function(_0x1767b4){_0x3f11e5[_0x188b('0x3d')]=_0x1767b4;return _0x3f11e5;})[_0x188b('0x1e')](respondWithFilteredResult(_0x4feabc,_0x474c8b))['catch'](handleError(_0x4feabc,null));};exports[_0x188b('0x3e')]=function(_0xcff4fa,_0xd1e350){var _0x23e90b={'raw':!![],'where':{'id':_0xcff4fa[_0x188b('0x3f')]['id']}},_0x524e20={};_0x524e20[_0x188b('0x28')]=_[_0x188b('0x2a')](db[_0x188b('0x3a')]['rawAttributes']);_0x524e20['query']=_[_0x188b('0x2a')](_0xcff4fa[_0x188b('0x2b')]);_0x524e20['filters']=_['intersection'](_0x524e20['model'],_0x524e20[_0x188b('0x2b')]);_0x23e90b[_0x188b('0x2d')]=_['intersection'](_0x524e20['model'],qs['fields'](_0xcff4fa[_0x188b('0x2b')][_0x188b('0x2f')]));_0x23e90b[_0x188b('0x2d')]=_0x23e90b[_0x188b('0x2d')][_0x188b('0x30')]?_0x23e90b[_0x188b('0x2d')]:_0x524e20['model'];if(_0xcff4fa[_0x188b('0x2b')]['includeAll']){_0x23e90b['include']=[{'all':!![]}];}_0x23e90b=_[_0x188b('0x37')]({},_0x23e90b,_0xcff4fa[_0x188b('0x39')]);return db[_0x188b('0x3a')]['find'](_0x23e90b)[_0x188b('0x1e')](handleEntityNotFound(_0xd1e350,null))[_0x188b('0x1e')](respondWithResult(_0xd1e350,null))[_0x188b('0x40')](handleError(_0xd1e350,null));};exports[_0x188b('0x41')]=function(_0x1880b9,_0x19138c){return db[_0x188b('0x3a')][_0x188b('0x41')](_0x1880b9[_0x188b('0x42')],{})['then'](respondWithResult(_0x19138c,0xc9))[_0x188b('0x40')](handleError(_0x19138c,null));};exports[_0x188b('0x43')]=function(_0x1c7c76,_0x3c7337){if(_0x1c7c76[_0x188b('0x42')]['id']){delete _0x1c7c76['body']['id'];}return db[_0x188b('0x3a')][_0x188b('0x44')]({'where':{'id':_0x1c7c76[_0x188b('0x3f')]['id']}})[_0x188b('0x1e')](handleEntityNotFound(_0x3c7337,null))[_0x188b('0x1e')](saveUpdates(_0x1c7c76[_0x188b('0x42')],null))[_0x188b('0x1e')](respondWithResult(_0x3c7337,null))[_0x188b('0x40')](handleError(_0x3c7337,null));};exports[_0x188b('0x1f')]=function(_0x4e288b,_0xab254f){return db[_0x188b('0x3a')]['find']({'where':{'id':_0x4e288b[_0x188b('0x3f')]['id']}})['then'](handleEntityNotFound(_0xab254f,null))['then'](removeEntity(_0xab254f,null))[_0x188b('0x40')](handleError(_0xab254f,null));}; \ No newline at end of file +var _0xcdf9=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','map'];(function(_0x1a0e6a,_0x1b43de){var _0x4b3934=function(_0x81dc97){while(--_0x81dc97){_0x1a0e6a['push'](_0x1a0e6a['shift']());}};_0x4b3934(++_0x1b43de);}(_0xcdf9,0x142));var _0x9cdf=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0xcdf9[_0x282ccc];return _0x27c2dd;};'use strict';var emlformat=require(_0x9cdf('0x0'));var rimraf=require(_0x9cdf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cdf('0x2'));var rp=require(_0x9cdf('0x3'));var moment=require('moment');var BPromise=require(_0x9cdf('0x4'));var Mustache=require(_0x9cdf('0x5'));var util=require(_0x9cdf('0x6'));var path=require('path');var sox=require(_0x9cdf('0x7'));var csv=require(_0x9cdf('0x8'));var ejs=require(_0x9cdf('0x9'));var fs=require('fs');var fs_extra=require(_0x9cdf('0xa'));var _=require(_0x9cdf('0xb'));var squel=require(_0x9cdf('0xc'));var crypto=require(_0x9cdf('0xd'));var jsforce=require(_0x9cdf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9cdf('0x8'));var querystring=require(_0x9cdf('0xf'));var Papa=require('papaparse');var Redis=require(_0x9cdf('0x10'));var authService=require(_0x9cdf('0x11'));var qs=require(_0x9cdf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cdf('0x13'));var logger=require(_0x9cdf('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9cdf('0x15'));var licenseUtil=require(_0x9cdf('0x16'));var db=require(_0x9cdf('0x17'))['db'];function respondWithStatusCode(_0x1d06ae,_0x4801b4){_0x4801b4=_0x4801b4||0xcc;return function(_0x21ab49){if(_0x21ab49){return _0x1d06ae[_0x9cdf('0x18')](_0x4801b4);}return _0x1d06ae[_0x9cdf('0x19')](_0x4801b4)[_0x9cdf('0x1a')]();};}function respondWithResult(_0x57ee20,_0x1d87a1){_0x1d87a1=_0x1d87a1||0xc8;return function(_0x286cb2){if(_0x286cb2){return _0x57ee20['status'](_0x1d87a1)['json'](_0x286cb2);}};}function respondWithFilteredResult(_0x3d72e0,_0x549e9b){return function(_0x1d96be){if(_0x1d96be){var _0xc11259=typeof _0x549e9b['offset']===_0x9cdf('0x1b')&&typeof _0x549e9b[_0x9cdf('0x1c')]===_0x9cdf('0x1b');var _0x364067=_0x1d96be['count'];var _0x57fa1b=_0xc11259?0x0:_0x549e9b[_0x9cdf('0x1d')];var _0x1c761c=_0xc11259?_0x1d96be[_0x9cdf('0x1e')]:_0x549e9b[_0x9cdf('0x1d')]+_0x549e9b[_0x9cdf('0x1c')];var _0x16da4d;if(_0x1c761c>=_0x364067){_0x1c761c=_0x364067;_0x16da4d=0xc8;}else{_0x16da4d=0xce;}_0x3d72e0[_0x9cdf('0x19')](_0x16da4d);return _0x3d72e0['set'](_0x9cdf('0x1f'),_0x57fa1b+'-'+_0x1c761c+'/'+_0x364067)[_0x9cdf('0x20')](_0x1d96be);}return null;};}function patchUpdates(_0x43c248){return function(_0x42b434){try{jsonpatch[_0x9cdf('0x21')](_0x42b434,_0x43c248,!![]);}catch(_0x51f298){return BPromise[_0x9cdf('0x22')](_0x51f298);}return _0x42b434[_0x9cdf('0x23')]();};}function saveUpdates(_0x2a1259,_0xd44ff5){return function(_0x481412){if(_0x481412){return _0x481412[_0x9cdf('0x24')](_0x2a1259)[_0x9cdf('0x25')](function(_0x166a30){return _0x166a30;});}return null;};}function removeEntity(_0x43c882,_0x3fd059){return function(_0x9b665d){if(_0x9b665d){return _0x9b665d[_0x9cdf('0x26')]()[_0x9cdf('0x25')](function(){_0x43c882['status'](0xcc)[_0x9cdf('0x1a')]();});}};}function handleEntityNotFound(_0x283947,_0x56af4a){return function(_0x2121bf){if(!_0x2121bf){_0x283947[_0x9cdf('0x18')](0x194);}return _0x2121bf;};}function handleError(_0x5dc846,_0x20e754){_0x20e754=_0x20e754||0x1f4;return function(_0x29792e){logger['error'](_0x29792e[_0x9cdf('0x27')]);if(_0x29792e[_0x9cdf('0x28')]){delete _0x29792e['name'];}_0x5dc846[_0x9cdf('0x19')](_0x20e754)[_0x9cdf('0x29')](_0x29792e);};}exports[_0x9cdf('0x2a')]=function(_0x51f6ca,_0x143444){var _0xc1a00b={},_0xec97c1={},_0x49556e={'count':0x0,'rows':[]};var _0x53e6c0=_['map'](db[_0x9cdf('0x2b')][_0x9cdf('0x2c')],function(_0x564413){return{'name':_0x564413[_0x9cdf('0x2d')],'type':_0x564413[_0x9cdf('0x2e')]['key']};});_0xec97c1['model']=_[_0x9cdf('0x2f')](_0x53e6c0,_0x9cdf('0x28'));_0xec97c1[_0x9cdf('0x30')]=_[_0x9cdf('0x31')](_0x51f6ca[_0x9cdf('0x30')]);_0xec97c1[_0x9cdf('0x32')]=_[_0x9cdf('0x33')](_0xec97c1[_0x9cdf('0x34')],_0xec97c1[_0x9cdf('0x30')]);_0xc1a00b[_0x9cdf('0x35')]=_['intersection'](_0xec97c1[_0x9cdf('0x34')],qs[_0x9cdf('0x36')](_0x51f6ca[_0x9cdf('0x30')]['fields']));_0xc1a00b['attributes']=_0xc1a00b['attributes'][_0x9cdf('0x37')]?_0xc1a00b[_0x9cdf('0x35')]:_0xec97c1[_0x9cdf('0x34')];if(!_0x51f6ca[_0x9cdf('0x30')][_0x9cdf('0x38')]('nolimit')){_0xc1a00b['limit']=qs[_0x9cdf('0x1c')](_0x51f6ca['query'][_0x9cdf('0x1c')]);_0xc1a00b[_0x9cdf('0x1d')]=qs[_0x9cdf('0x1d')](_0x51f6ca[_0x9cdf('0x30')][_0x9cdf('0x1d')]);}_0xc1a00b['order']=qs[_0x9cdf('0x39')](_0x51f6ca[_0x9cdf('0x30')]['sort']);_0xc1a00b[_0x9cdf('0x3a')]=qs[_0x9cdf('0x32')](_[_0x9cdf('0x3b')](_0x51f6ca[_0x9cdf('0x30')],_0xec97c1['filters']),_0x53e6c0);if(_0x51f6ca[_0x9cdf('0x30')][_0x9cdf('0x3c')]){_0xc1a00b[_0x9cdf('0x3a')]=_[_0x9cdf('0x3d')](_0xc1a00b[_0x9cdf('0x3a')],{'$or':_[_0x9cdf('0x2f')](_0x53e6c0,function(_0x554913){if(_0x554913[_0x9cdf('0x2e')]!==_0x9cdf('0x3e')){var _0x1b0f5e={};_0x1b0f5e[_0x554913[_0x9cdf('0x28')]]={'$like':'%'+_0x51f6ca[_0x9cdf('0x30')][_0x9cdf('0x3c')]+'%'};return _0x1b0f5e;}})});}_0xc1a00b=_[_0x9cdf('0x3d')]({},_0xc1a00b,_0x51f6ca[_0x9cdf('0x3f')]);var _0x282ce6={'where':_0xc1a00b[_0x9cdf('0x3a')]};return db[_0x9cdf('0x2b')][_0x9cdf('0x1e')](_0x282ce6)[_0x9cdf('0x25')](function(_0x1139c4){_0x49556e['count']=_0x1139c4;if(_0x51f6ca['query'][_0x9cdf('0x40')]){_0xc1a00b[_0x9cdf('0x41')]=[{'all':!![]}];}return db[_0x9cdf('0x2b')][_0x9cdf('0x42')](_0xc1a00b);})[_0x9cdf('0x25')](function(_0x383b74){_0x49556e[_0x9cdf('0x43')]=_0x383b74;return _0x49556e;})[_0x9cdf('0x25')](respondWithFilteredResult(_0x143444,_0xc1a00b))[_0x9cdf('0x44')](handleError(_0x143444,null));};exports[_0x9cdf('0x45')]=function(_0x5c5489,_0x2b9177){var _0x59eaab={'raw':!![],'where':{'id':_0x5c5489['params']['id']}},_0xcca44b={};_0xcca44b['model']=_[_0x9cdf('0x31')](db[_0x9cdf('0x2b')][_0x9cdf('0x2c')]);_0xcca44b[_0x9cdf('0x30')]=_[_0x9cdf('0x31')](_0x5c5489[_0x9cdf('0x30')]);_0xcca44b[_0x9cdf('0x32')]=_[_0x9cdf('0x33')](_0xcca44b[_0x9cdf('0x34')],_0xcca44b[_0x9cdf('0x30')]);_0x59eaab['attributes']=_[_0x9cdf('0x33')](_0xcca44b[_0x9cdf('0x34')],qs[_0x9cdf('0x36')](_0x5c5489[_0x9cdf('0x30')][_0x9cdf('0x36')]));_0x59eaab['attributes']=_0x59eaab[_0x9cdf('0x35')][_0x9cdf('0x37')]?_0x59eaab[_0x9cdf('0x35')]:_0xcca44b[_0x9cdf('0x34')];if(_0x5c5489[_0x9cdf('0x30')][_0x9cdf('0x40')]){_0x59eaab[_0x9cdf('0x41')]=[{'all':!![]}];}_0x59eaab=_[_0x9cdf('0x3d')]({},_0x59eaab,_0x5c5489[_0x9cdf('0x3f')]);return db['Dynamics365Field'][_0x9cdf('0x46')](_0x59eaab)['then'](handleEntityNotFound(_0x2b9177,null))['then'](respondWithResult(_0x2b9177,null))[_0x9cdf('0x44')](handleError(_0x2b9177,null));};exports[_0x9cdf('0x47')]=function(_0x37f93e,_0x5790cd){return db[_0x9cdf('0x2b')]['create'](_0x37f93e[_0x9cdf('0x48')],{})[_0x9cdf('0x25')](respondWithResult(_0x5790cd,0xc9))[_0x9cdf('0x44')](handleError(_0x5790cd,null));};exports[_0x9cdf('0x24')]=function(_0x59ed34,_0x34c27f){if(_0x59ed34['body']['id']){delete _0x59ed34[_0x9cdf('0x48')]['id'];}return db[_0x9cdf('0x2b')][_0x9cdf('0x46')]({'where':{'id':_0x59ed34[_0x9cdf('0x49')]['id']}})[_0x9cdf('0x25')](handleEntityNotFound(_0x34c27f,null))[_0x9cdf('0x25')](saveUpdates(_0x59ed34['body'],null))[_0x9cdf('0x25')](respondWithResult(_0x34c27f,null))[_0x9cdf('0x44')](handleError(_0x34c27f,null));};exports[_0x9cdf('0x26')]=function(_0x59ac51,_0x56a782){return db['Dynamics365Field']['find']({'where':{'id':_0x59ac51[_0x9cdf('0x49')]['id']}})[_0x9cdf('0x25')](handleEntityNotFound(_0x56a782,null))[_0x9cdf('0x25')](removeEntity(_0x56a782,null))[_0x9cdf('0x44')](handleError(_0x56a782,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6158418..3de1343 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 _0xf485=['int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf485,0x1ed));var _0x5f48=function(_0x48a367,_0x35decb){_0x48a367=_0x48a367-0x0;var _0x108c20=_0xf485[_0x48a367];return _0x108c20;};'use strict';var _=require(_0x5f48('0x0'));var util=require(_0x5f48('0x1'));var logger=require(_0x5f48('0x2'))(_0x5f48('0x3'));var moment=require('moment');var BPromise=require(_0x5f48('0x4'));var rp=require(_0x5f48('0x5'));var fs=require('fs');var path=require(_0x5f48('0x6'));var rimraf=require(_0x5f48('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f48('0x8'));module[_0x5f48('0x9')]=function(_0xcea265,_0x5006d2){return _0xcea265[_0x5f48('0xa')]('Dynamics365Field',attributes,{'tableName':_0x5f48('0xb'),'paranoid':![],'indexes':[{'name':_0x5f48('0xc'),'fields':['idField',_0x5f48('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd4=['request-promise','path','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x313fe2,_0x29cc38){var _0x5224f0=function(_0x2a2467){while(--_0x2a2467){_0x313fe2['push'](_0x313fe2['shift']());}};_0x5224f0(++_0x29cc38);}(_0x8cd4,0xcc));var _0x48cd=function(_0x19fbdc,_0x2e1d6a){_0x19fbdc=_0x19fbdc-0x0;var _0x176533=_0x8cd4[_0x19fbdc];return _0x176533;};'use strict';var _=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var logger=require(_0x48cd('0x2'))(_0x48cd('0x3'));var moment=require(_0x48cd('0x4'));var BPromise=require(_0x48cd('0x5'));var rp=require(_0x48cd('0x6'));var fs=require('fs');var path=require(_0x48cd('0x7'));var rimraf=require('rimraf');var config=require(_0x48cd('0x8'));var attributes=require(_0x48cd('0x9'));module['exports']=function(_0x40a9bd,_0xb3a773){return _0x40a9bd['define'](_0x48cd('0xa'),attributes,{'tableName':_0x48cd('0xb'),'paranoid':![],'indexes':[{'name':_0x48cd('0xc'),'fields':[_0x48cd('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 4138680..5e3e0f9 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 _0x5257=['request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5257,0x1f0));var _0x7525=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x5257[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7525('0x0'));var BPromise=require(_0x7525('0x1'));var rs=require(_0x7525('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7525('0x3'))['db'];var utils=require(_0x7525('0x4'));var logger=require(_0x7525('0x5'))(_0x7525('0x6'));var config=require(_0x7525('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7525('0x8')][_0x7525('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526754,_0x330bea,_0x351fd4){return new BPromise(function(_0x55ac14,_0x4e6d68){return client[_0x7525('0xa')](_0x526754,_0x351fd4)[_0x7525('0xb')](function(_0x2c3ae1){logger[_0x7525('0xc')](_0x7525('0xd'),_0x330bea,'request\x20sent');logger[_0x7525('0xe')](_0x7525('0xf'),_0x330bea,_0x7525('0x10'),JSON[_0x7525('0x11')](_0x2c3ae1));if(_0x2c3ae1[_0x7525('0x12')]){if(_0x2c3ae1[_0x7525('0x12')][_0x7525('0x13')]===0x1f4){logger[_0x7525('0x12')](_0x7525('0xd'),_0x330bea,_0x2c3ae1[_0x7525('0x12')][_0x7525('0x14')]);return _0x4e6d68(_0x2c3ae1['error'][_0x7525('0x14')]);}logger[_0x7525('0x12')](_0x7525('0xd'),_0x330bea,_0x2c3ae1[_0x7525('0x12')][_0x7525('0x14')]);return _0x55ac14(_0x2c3ae1[_0x7525('0x12')]['message']);}else{logger[_0x7525('0xc')](_0x7525('0xd'),_0x330bea,_0x7525('0x10'));_0x55ac14(_0x2c3ae1[_0x7525('0x15')][_0x7525('0x14')]);}})[_0x7525('0x16')](function(_0x64c5cf){logger[_0x7525('0x12')](_0x7525('0xd'),_0x330bea,_0x64c5cf);_0x4e6d68(_0x64c5cf);});});} \ No newline at end of file +var _0x16c2=['client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2d26fa,_0x3e1907){var _0x3f8dc1=function(_0x344749){while(--_0x344749){_0x2d26fa['push'](_0x2d26fa['shift']());}};_0x3f8dc1(++_0x3e1907);}(_0x16c2,0xe9));var _0x216c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x216c('0x0'));var util=require(_0x216c('0x1'));var moment=require(_0x216c('0x2'));var BPromise=require('bluebird');var rs=require(_0x216c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x216c('0x4'))['db'];var utils=require(_0x216c('0x5'));var logger=require(_0x216c('0x6'))(_0x216c('0x7'));var config=require('../../config/environment');var jayson=require(_0x216c('0x8'));var client=jayson[_0x216c('0x9')][_0x216c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x386a9c,_0x4f3713,_0x37d150){return new BPromise(function(_0x621d3b,_0x172bf2){return client['request'](_0x386a9c,_0x37d150)[_0x216c('0xb')](function(_0x14e6e6){logger['info'](_0x216c('0xc'),_0x4f3713,_0x216c('0xd'));logger[_0x216c('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4f3713,_0x216c('0xd'),JSON[_0x216c('0xf')](_0x14e6e6));if(_0x14e6e6[_0x216c('0x10')]){if(_0x14e6e6['error'][_0x216c('0x11')]===0x1f4){logger[_0x216c('0x10')](_0x216c('0xc'),_0x4f3713,_0x14e6e6[_0x216c('0x10')][_0x216c('0x12')]);return _0x172bf2(_0x14e6e6[_0x216c('0x10')]['message']);}logger[_0x216c('0x10')](_0x216c('0xc'),_0x4f3713,_0x14e6e6[_0x216c('0x10')][_0x216c('0x12')]);return _0x621d3b(_0x14e6e6[_0x216c('0x10')][_0x216c('0x12')]);}else{logger[_0x216c('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x4f3713,_0x216c('0xd'));_0x621d3b(_0x14e6e6[_0x216c('0x14')][_0x216c('0x12')]);}})[_0x216c('0x15')](function(_0x57e775){logger[_0x216c('0x10')](_0x216c('0xc'),_0x4f3713,_0x57e775);_0x172bf2(_0x57e775);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1bedf68..a7b8954 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 _0xd4ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0x370f7e,_0x510cad){var _0x5b1a23=function(_0x1144cf){while(--_0x1144cf){_0x370f7e['push'](_0x370f7e['shift']());}};_0x5b1a23(++_0x510cad);}(_0xd4ac,0x1b2));var _0xcd4a=function(_0x56c695,_0x174191){_0x56c695=_0x56c695-0x0;var _0x2b1cb2=_0xd4ac[_0x56c695];return _0x2b1cb2;};'use strict';var multer=require(_0xcd4a('0x0'));var util=require(_0xcd4a('0x1'));var path=require(_0xcd4a('0x2'));var timeout=require(_0xcd4a('0x3'));var express=require(_0xcd4a('0x4'));var router=express[_0xcd4a('0x5')]();var fs_extra=require(_0xcd4a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcd4a('0x7'));var config=require('../../config/environment');var controller=require(_0xcd4a('0x8'));router[_0xcd4a('0x9')]('/',auth[_0xcd4a('0xa')](),controller[_0xcd4a('0xb')]);router[_0xcd4a('0x9')](_0xcd4a('0xc'),auth[_0xcd4a('0xa')](),controller[_0xcd4a('0xd')]);router[_0xcd4a('0x9')]('/:id/configurations',auth[_0xcd4a('0xa')](),controller[_0xcd4a('0xe')]);router[_0xcd4a('0x9')](_0xcd4a('0xf'),auth[_0xcd4a('0xa')](),controller[_0xcd4a('0x10')]);router['post']('/',auth[_0xcd4a('0xa')](),controller['create']);router[_0xcd4a('0x11')](_0xcd4a('0x12'),auth[_0xcd4a('0xa')](),controller[_0xcd4a('0x13')]);router[_0xcd4a('0x14')](_0xcd4a('0xc'),auth['isAuthenticated'](),controller[_0xcd4a('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcd4a('0x16')]);module[_0xcd4a('0x17')]=router; \ No newline at end of file +var _0x48d7=['util','path','express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','put','update','delete','destroy','exports','multer'];(function(_0x2b42dd,_0x318a16){var _0x39d7ab=function(_0x286e39){while(--_0x286e39){_0x2b42dd['push'](_0x2b42dd['shift']());}};_0x39d7ab(++_0x318a16);}(_0x48d7,0xe6));var _0x748d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x48d7[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x748d('0x0'));var util=require(_0x748d('0x1'));var path=require(_0x748d('0x2'));var timeout=require('connect-timeout');var express=require(_0x748d('0x3'));var router=express[_0x748d('0x4')]();var fs_extra=require(_0x748d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x748d('0x6'));var controller=require(_0x748d('0x7'));router[_0x748d('0x8')]('/',auth[_0x748d('0x9')](),controller[_0x748d('0xa')]);router['get'](_0x748d('0xb'),auth[_0x748d('0x9')](),controller['show']);router[_0x748d('0x8')](_0x748d('0xc'),auth[_0x748d('0x9')](),controller[_0x748d('0xd')]);router['get']('/:id/fields',auth[_0x748d('0x9')](),controller[_0x748d('0xe')]);router[_0x748d('0xf')]('/',auth[_0x748d('0x9')](),controller['create']);router[_0x748d('0xf')](_0x748d('0xc'),auth[_0x748d('0x9')](),controller['addConfiguration']);router[_0x748d('0x10')](_0x748d('0xb'),auth[_0x748d('0x9')](),controller[_0x748d('0x11')]);router[_0x748d('0x12')](_0x748d('0xb'),auth[_0x748d('0x9')](),controller[_0x748d('0x13')]);module[_0x748d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 87399cc..c92a65f 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x55f122,_0x56edaf){var _0x1a28d6=function(_0x180bb6){while(--_0x180bb6){_0x55f122['push'](_0x55f122['shift']());}};_0x1a28d6(++_0x56edaf);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xc2f92b,_0x17b1c8){_0xc2f92b=_0xc2f92b-0x0;var _0x278b46=_0xdd4f[_0xc2f92b];return _0x278b46;};'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 _0xffd6=['exports','STRING','username','sequelize'];(function(_0x2b88f7,_0x617696){var _0x112132=function(_0x22369c){while(--_0x22369c){_0x2b88f7['push'](_0x2b88f7['shift']());}};_0x112132(++_0x617696);}(_0xffd6,0x97));var _0x6ffd=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xffd6[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f602cde..cac4f8c 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 _0xb43b=['Content-Range','json','save','then','end','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','catch','create','body','update','find','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x41c7d7,_0x43693e){_0x41c7d7=_0x41c7d7-0x0;var _0x31c482=_0xb43b[_0x41c7d7];return _0x31c482;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x578392,_0x41e7e5){_0x41e7e5=_0x41e7e5||0xcc;return function(_0x4a3714){if(_0x4a3714){return _0x578392['sendStatus'](_0x41e7e5);}return _0x578392[_0xbb43('0x19')](_0x41e7e5)['end']();};}function respondWithResult(_0x68d45d,_0x43021d){_0x43021d=_0x43021d||0xc8;return function(_0x55926f){if(_0x55926f){return _0x68d45d['status'](_0x43021d)['json'](_0x55926f);}};}function respondWithFilteredResult(_0x338120,_0x2abce0){return function(_0x57bd1d){if(_0x57bd1d){var _0x526330=typeof _0x2abce0[_0xbb43('0x1a')]==='undefined'&&typeof _0x2abce0['limit']===_0xbb43('0x1b');var _0x8242ab=_0x57bd1d[_0xbb43('0x1c')];var _0x55dd73=_0x526330?0x0:_0x2abce0[_0xbb43('0x1a')];var _0x4f28b8=_0x526330?_0x57bd1d[_0xbb43('0x1c')]:_0x2abce0[_0xbb43('0x1a')]+_0x2abce0['limit'];var _0x5d765b;if(_0x4f28b8>=_0x8242ab){_0x4f28b8=_0x8242ab;_0x5d765b=0xc8;}else{_0x5d765b=0xce;}_0x338120[_0xbb43('0x19')](_0x5d765b);return _0x338120[_0xbb43('0x1d')](_0xbb43('0x1e'),_0x55dd73+'-'+_0x4f28b8+'/'+_0x8242ab)[_0xbb43('0x1f')](_0x57bd1d);}return null;};}function patchUpdates(_0x5bcce7){return function(_0x40a650){try{jsonpatch['apply'](_0x40a650,_0x5bcce7,!![]);}catch(_0x3a257d){return BPromise['reject'](_0x3a257d);}return _0x40a650[_0xbb43('0x20')]();};}function saveUpdates(_0x565256,_0x3f323e){return function(_0x451cbd){if(_0x451cbd){return _0x451cbd['update'](_0x565256)[_0xbb43('0x21')](function(_0x4dfb7f){return _0x4dfb7f;});}return null;};}function removeEntity(_0xf24e60,_0x298ce2){return function(_0x16384e){if(_0x16384e){return _0x16384e['destroy']()['then'](function(){_0xf24e60['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x32d7f0,_0x5d8310){return function(_0x3b3083){if(!_0x3b3083){_0x32d7f0[_0xbb43('0x23')](0x194);}return _0x3b3083;};}function handleError(_0x226827,_0x3874fb){_0x3874fb=_0x3874fb||0x1f4;return function(_0x4ed43f){logger['error'](_0x4ed43f[_0xbb43('0x24')]);if(_0x4ed43f[_0xbb43('0x25')]){delete _0x4ed43f[_0xbb43('0x25')];}_0x226827[_0xbb43('0x19')](_0x3874fb)[_0xbb43('0x26')](_0x4ed43f);};}exports[_0xbb43('0x27')]=function(_0x21d386,_0x473828){var _0x539730={},_0x2ad6da={},_0x56fe33={'count':0x0,'rows':[]};var _0x31fbc8=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x555b99){return{'name':_0x555b99[_0xbb43('0x2b')],'type':_0x555b99['type']['key']};});_0x2ad6da['model']=_[_0xbb43('0x28')](_0x31fbc8,'name');_0x2ad6da[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x21d386[_0xbb43('0x2c')]);_0x2ad6da['filters']=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],_0x2ad6da[_0xbb43('0x2c')]);_0x539730[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x2ad6da[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x21d386[_0xbb43('0x2c')]['fields']));_0x539730[_0xbb43('0x30')]=_0x539730[_0xbb43('0x30')][_0xbb43('0x32')]?_0x539730[_0xbb43('0x30')]:_0x2ad6da[_0xbb43('0x2f')];if(!_0x21d386[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0x539730[_0xbb43('0x35')]=qs[_0xbb43('0x35')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x35')]);_0x539730[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x21d386[_0xbb43('0x2c')][_0xbb43('0x1a')]);}_0x539730['order']=qs[_0xbb43('0x36')](_0x21d386[_0xbb43('0x2c')]['sort']);_0x539730[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x21d386['query'],_0x2ad6da['filters']),_0x31fbc8);if(_0x21d386['query'][_0xbb43('0x3a')]){_0x539730[_0xbb43('0x37')]=_['merge'](_0x539730['where'],{'$or':_[_0xbb43('0x28')](_0x31fbc8,function(_0x275425){if(_0x275425[_0xbb43('0x3b')]!==_0xbb43('0x3c')){var _0x3f9e7f={};_0x3f9e7f[_0x275425['name']]={'$like':'%'+_0x21d386[_0xbb43('0x2c')][_0xbb43('0x3a')]+'%'};return _0x3f9e7f;}})});}_0x539730=_[_0xbb43('0x3d')]({},_0x539730,_0x21d386[_0xbb43('0x3e')]);var _0x22fccc={'where':_0x539730['where']};return db[_0xbb43('0x29')]['count'](_0x22fccc)[_0xbb43('0x21')](function(_0x93aa1c){_0x56fe33['count']=_0x93aa1c;if(_0x21d386[_0xbb43('0x2c')]['includeAll']){_0x539730[_0xbb43('0x3f')]=[{'all':!![]}];}return db[_0xbb43('0x29')][_0xbb43('0x40')](_0x539730);})[_0xbb43('0x21')](function(_0x5d864a){_0x56fe33[_0xbb43('0x41')]=_0x5d864a;return _0x56fe33;})[_0xbb43('0x21')](respondWithFilteredResult(_0x473828,_0x539730))['catch'](handleError(_0x473828,null));};exports[_0xbb43('0x42')]=function(_0x5198a2,_0x42b965){var _0x14285d={'raw':![],'where':{'id':_0x5198a2[_0xbb43('0x43')]['id']}},_0xcb5000={};_0xcb5000[_0xbb43('0x2f')]=_[_0xbb43('0x2d')](db['FreshdeskAccount'][_0xbb43('0x2a')]);_0xcb5000['query']=_[_0xbb43('0x2d')](_0x5198a2[_0xbb43('0x2c')]);_0xcb5000[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0xcb5000['model'],_0xcb5000[_0xbb43('0x2c')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0xcb5000[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x5198a2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0x14285d[_0xbb43('0x30')]=_0x14285d['attributes'][_0xbb43('0x32')]?_0x14285d[_0xbb43('0x30')]:_0xcb5000['model'];if(_0x5198a2[_0xbb43('0x2c')]['includeAll']){_0x14285d['include']=[{'all':!![]}];}_0x14285d=_['merge']({},_0x14285d,_0x5198a2['options']);return db[_0xbb43('0x29')]['find'](_0x14285d)[_0xbb43('0x21')](handleEntityNotFound(_0x42b965,null))['then'](respondWithResult(_0x42b965,null))[_0xbb43('0x44')](handleError(_0x42b965,null));};exports[_0xbb43('0x45')]=function(_0x1f3fb4,_0x4a0755){return db[_0xbb43('0x29')]['create'](_0x1f3fb4[_0xbb43('0x46')],{})[_0xbb43('0x21')](respondWithResult(_0x4a0755,0xc9))[_0xbb43('0x44')](handleError(_0x4a0755,null));};exports[_0xbb43('0x47')]=function(_0x417ad9,_0x13d0a5){if(_0x417ad9[_0xbb43('0x46')]['id']){delete _0x417ad9['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x417ad9[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x13d0a5,null))['then'](saveUpdates(_0x417ad9[_0xbb43('0x46')],null))[_0xbb43('0x21')](respondWithResult(_0x13d0a5,null))[_0xbb43('0x44')](handleError(_0x13d0a5,null));};exports[_0xbb43('0x49')]=function(_0x4b7712,_0x3206c0){return db[_0xbb43('0x29')][_0xbb43('0x48')]({'where':{'id':_0x4b7712['params']['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x3206c0,null))[_0xbb43('0x21')](removeEntity(_0x3206c0,null))[_0xbb43('0x44')](handleError(_0x3206c0,null));};exports[_0xbb43('0x4a')]=function(_0x3402f2,_0x59c805,_0x4cd4cd){var _0xb44557={};var _0x5c75ba={};var _0xf5d5c;var _0xe0cdba;return db['FreshdeskAccount'][_0xbb43('0x4b')]({'where':{'id':_0x3402f2[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x59c805,null))[_0xbb43('0x21')](function(_0x1dfbb9){if(_0x1dfbb9){_0xf5d5c=_0x1dfbb9;_0x5c75ba['model']=_[_0xbb43('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x5c75ba[_0xbb43('0x2c')]=_[_0xbb43('0x2d')](_0x3402f2[_0xbb43('0x2c')]);_0x5c75ba[_0xbb43('0x38')]=_[_0xbb43('0x2e')](_0x5c75ba['model'],_0x5c75ba['query']);_0xb44557[_0xbb43('0x30')]=_[_0xbb43('0x2e')](_0x5c75ba[_0xbb43('0x2f')],qs[_0xbb43('0x31')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x31')]));_0xb44557[_0xbb43('0x30')]=_0xb44557[_0xbb43('0x30')][_0xbb43('0x32')]?_0xb44557['attributes']:_0x5c75ba[_0xbb43('0x2f')];_0xb44557[_0xbb43('0x4c')]=qs[_0xbb43('0x36')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x36')]);_0xb44557[_0xbb43('0x37')]=qs[_0xbb43('0x38')](_[_0xbb43('0x39')](_0x3402f2[_0xbb43('0x2c')],_0x5c75ba['filters']));if(_0x3402f2['query'][_0xbb43('0x3a')]){_0xb44557[_0xbb43('0x37')]=_[_0xbb43('0x3d')](_0xb44557[_0xbb43('0x37')],{'$or':_[_0xbb43('0x28')](_0xb44557[_0xbb43('0x30')],function(_0x2e01fb){var _0x51d702={};_0x51d702[_0x2e01fb]={'$like':'%'+_0x3402f2[_0xbb43('0x2c')]['filter']+'%'};return _0x51d702;})});}_0xb44557=_['merge']({},_0xb44557,_0x3402f2[_0xbb43('0x3e')]);return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x22ce17){if(_0x22ce17){_0xe0cdba=_0x22ce17[_0xbb43('0x32')];if(!_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x33')](_0xbb43('0x34'))){_0xb44557['limit']=qs['limit'](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x35')]);_0xb44557[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x3402f2[_0xbb43('0x2c')][_0xbb43('0x1a')]);}return _0xf5d5c[_0xbb43('0x4a')](_0xb44557);}})[_0xbb43('0x21')](function(_0x3ca6ad){if(_0x3ca6ad){return _0x3ca6ad?{'count':_0xe0cdba,'rows':_0x3ca6ad}:null;}})['then'](respondWithResult(_0x59c805,null))[_0xbb43('0x44')](handleError(_0x59c805,null));};exports[_0xbb43('0x4d')]=function(_0x234bc7,_0x8aaf33,_0x2612be){if(_0x234bc7[_0xbb43('0x46')]['id']){delete _0x234bc7['body']['id'];}return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x234bc7[_0xbb43('0x43')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x8aaf33,null))[_0xbb43('0x21')](function(_0x4ec63a){if(_0x4ec63a){_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4e')]=_0x4ec63a['id'];_0x234bc7[_0xbb43('0x46')][_0xbb43('0x4f')]=integrations[_0xbb43('0x50')](_0x234bc7[_0xbb43('0x46')][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);_0x234bc7[_0xbb43('0x46')]['Descriptions']=integrations[_0xbb43('0x52')](_0x234bc7['body'][_0xbb43('0x51')],_0x234bc7[_0xbb43('0x46')][_0xbb43('0x3b')]);return db[_0xbb43('0x53')][_0xbb43('0x45')](_0x234bc7['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xbb43('0x4f')},{'model':db[_0xbb43('0x54')],'as':'Descriptions'}]});}return null;})[_0xbb43('0x21')](respondWithResult(_0x8aaf33,null))[_0xbb43('0x44')](handleError(_0x8aaf33,null));};exports[_0xbb43('0x55')]=function(_0x52ca51,_0x333ded,_0x298a77){var _0x3b89ec='';return db[_0xbb43('0x29')][_0xbb43('0x4b')]({'where':{'id':_0x52ca51[_0xbb43('0x43')]['id']},'attributes':['id',_0xbb43('0x56'),_0xbb43('0x57')]})[_0xbb43('0x21')](handleEntityNotFound(_0x333ded,null))[_0xbb43('0x21')](function(_0x566268){if(_0x566268){_0x3b89ec=_0x566268['remoteUri'];var _0x21d610=_0x3b89ec[_0xbb43('0x58')](-0x1);if(_0x21d610==='/'){_0x3b89ec=_0x3b89ec[_0xbb43('0x59')](0x0,_0x3b89ec['lastIndexOf'](_0x21d610));}return rp({'method':_0xbb43('0x5a'),'uri':util[_0xbb43('0x5b')](_0xbb43('0x5c'),_0x3b89ec,_0xbb43('0x5d')),'headers':{'Authorization':util[_0xbb43('0x5b')]('Basic\x20%s',new Buffer(util[_0xbb43('0x5b')](_0xbb43('0x5e'),_0x566268[_0xbb43('0x57')]))['toString'](_0xbb43('0x5f')))},'json':!![]});}})[_0xbb43('0x21')](function(_0x3e4619){if(_0x3e4619){var _0x38f301=[_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x63'),_0xbb43('0x19'),_0xbb43('0x64'),_0xbb43('0x65'),'source',_0xbb43('0x66'),_0xbb43('0x65'),_0xbb43('0x67')];_[_0xbb43('0x68')](_0x3e4619,function(_0x34c1cd){return _0x38f301['includes'](_0x34c1cd['name'])||!_0x34c1cd['default']&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x69')&&_0x34c1cd[_0xbb43('0x3b')]!==_0xbb43('0x6a');});return{'count':_0x3e4619[_0xbb43('0x32')],'rows':_[_0xbb43('0x28')](_0x3e4619,function(_0x53cd0b){return{'id':_0x53cd0b['name'],'name':_0x53cd0b[_0xbb43('0x6b')],'custom':!_0x53cd0b[_0xbb43('0x6c')],'options':_0x53cd0b[_0xbb43('0x6d')]?_['map'](_0x53cd0b[_0xbb43('0x6d')],function(_0x5e43b4){return{'name':_[_0xbb43('0x6e')](_0x5e43b4),'value':_0x5e43b4};}):[]};})};}})['then'](respondWithResult(_0x333ded,null))[_0xbb43('0x44')](function(_0x17e939){var _0x41b9cd=_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?0x1f4:_0x17e939[_0xbb43('0x70')]||0x1f4;logger[_0xbb43('0x71')](_0xbb43('0x72'),'getFields',_0x41b9cd,JSON[_0xbb43('0x73')](_0x17e939));delete _0x17e939[_0xbb43('0x25')];if(_0x41b9cd===0x191){_0x41b9cd=0x190;}_0x333ded['status'](_0x41b9cd)[_0xbb43('0x26')](_0x52ca51[_0xbb43('0x2c')][_0xbb43('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x17e939[_0xbb43('0x70')]}:_0x17e939);});}; \ No newline at end of file +var _0x1d2d=['source','ticket_type','company','remove','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','send','index','FreshdeskAccount','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','findAll','catch','includeAll','find','create','body','params','getConfigurations','FreshdeskConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','remoteUri','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','subject','agent','description','priority','group'];(function(_0x3367f4,_0x5e57d7){var _0x2c0179=function(_0x525316){while(--_0x525316){_0x3367f4['push'](_0x3367f4['shift']());}};_0x2c0179(++_0x5e57d7);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5219c6,_0x590941){_0x5219c6=_0x5219c6-0x0;var _0x529411=_0x1d2d[_0x5219c6];return _0x529411;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];var integrations=require(_0xd1d2('0x1b'));function respondWithStatusCode(_0x129d8f,_0xc3ee82){_0xc3ee82=_0xc3ee82||0xcc;return function(_0x2df8a5){if(_0x2df8a5){return _0x129d8f[_0xd1d2('0x1c')](_0xc3ee82);}return _0x129d8f[_0xd1d2('0x1d')](_0xc3ee82)[_0xd1d2('0x1e')]();};}function respondWithResult(_0x4cf702,_0x2e7fec){_0x2e7fec=_0x2e7fec||0xc8;return function(_0x3c0296){if(_0x3c0296){return _0x4cf702[_0xd1d2('0x1d')](_0x2e7fec)['json'](_0x3c0296);}};}function respondWithFilteredResult(_0x35381b,_0xc36ce){return function(_0x208425){if(_0x208425){var _0x2f4cf9=typeof _0xc36ce[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0xc36ce[_0xd1d2('0x21')]==='undefined';var _0x539d5a=_0x208425[_0xd1d2('0x22')];var _0x55320b=_0x2f4cf9?0x0:_0xc36ce[_0xd1d2('0x1f')];var _0x42565b=_0x2f4cf9?_0x208425[_0xd1d2('0x22')]:_0xc36ce[_0xd1d2('0x1f')]+_0xc36ce['limit'];var _0x4f1201;if(_0x42565b>=_0x539d5a){_0x42565b=_0x539d5a;_0x4f1201=0xc8;}else{_0x4f1201=0xce;}_0x35381b[_0xd1d2('0x1d')](_0x4f1201);return _0x35381b['set']('Content-Range',_0x55320b+'-'+_0x42565b+'/'+_0x539d5a)[_0xd1d2('0x23')](_0x208425);}return null;};}function patchUpdates(_0x27e26b){return function(_0x3414ce){try{jsonpatch[_0xd1d2('0x24')](_0x3414ce,_0x27e26b,!![]);}catch(_0x596cd8){return BPromise[_0xd1d2('0x25')](_0x596cd8);}return _0x3414ce[_0xd1d2('0x26')]();};}function saveUpdates(_0x24b8db,_0x4eb082){return function(_0x59e72c){if(_0x59e72c){return _0x59e72c[_0xd1d2('0x27')](_0x24b8db)[_0xd1d2('0x28')](function(_0x19d535){return _0x19d535;});}return null;};}function removeEntity(_0x2f92ee,_0x3f229c){return function(_0x33a171){if(_0x33a171){return _0x33a171[_0xd1d2('0x29')]()['then'](function(){_0x2f92ee[_0xd1d2('0x1d')](0xcc)[_0xd1d2('0x1e')]();});}};}function handleEntityNotFound(_0x41330f,_0x2e1709){return function(_0x5d3ee1){if(!_0x5d3ee1){_0x41330f[_0xd1d2('0x1c')](0x194);}return _0x5d3ee1;};}function handleError(_0x28b8be,_0x34faf7){_0x34faf7=_0x34faf7||0x1f4;return function(_0xe6ef3c){logger[_0xd1d2('0x2a')](_0xe6ef3c[_0xd1d2('0x2b')]);if(_0xe6ef3c['name']){delete _0xe6ef3c['name'];}_0x28b8be[_0xd1d2('0x1d')](_0x34faf7)[_0xd1d2('0x2c')](_0xe6ef3c);};}exports[_0xd1d2('0x2d')]=function(_0x2b4c1f,_0xc815ea){var _0x48ade1={},_0x39d694={},_0x41171c={'count':0x0,'rows':[]};var _0x383947=_['map'](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')],function(_0xbd855a){return{'name':_0xbd855a['fieldName'],'type':_0xbd855a[_0xd1d2('0x30')][_0xd1d2('0x31')]};});_0x39d694[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x383947,_0xd1d2('0x34'));_0x39d694[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0x2b4c1f[_0xd1d2('0x35')]);_0x39d694[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],_0x39d694[_0xd1d2('0x35')]);_0x48ade1[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x48ade1['attributes']=_0x48ade1[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x48ade1[_0xd1d2('0x39')]:_0x39d694['model'];if(!_0x2b4c1f[_0xd1d2('0x35')]['hasOwnProperty']('nolimit')){_0x48ade1[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x21')]);_0x48ade1[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x2b4c1f['query'][_0xd1d2('0x1f')]);}_0x48ade1[_0xd1d2('0x3c')]=qs['sort'](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x48ade1[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0x2b4c1f['query'],_0x39d694[_0xd1d2('0x37')]),_0x383947);if(_0x2b4c1f['query']['filter']){_0x48ade1['where']=_[_0xd1d2('0x3f')](_0x48ade1['where'],{'$or':_[_0xd1d2('0x33')](_0x383947,function(_0x4e7640){if(_0x4e7640['type']!=='VIRTUAL'){var _0x2dabfa={};_0x2dabfa[_0x4e7640[_0xd1d2('0x34')]]={'$like':'%'+_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x40')]+'%'};return _0x2dabfa;}})});}_0x48ade1=_[_0xd1d2('0x3f')]({},_0x48ade1,_0x2b4c1f[_0xd1d2('0x41')]);var _0x178f8b={'where':_0x48ade1[_0xd1d2('0x3e')]};return db[_0xd1d2('0x2e')][_0xd1d2('0x22')](_0x178f8b)[_0xd1d2('0x28')](function(_0x1fb5b5){_0x41171c[_0xd1d2('0x22')]=_0x1fb5b5;if(_0x2b4c1f[_0xd1d2('0x35')]['includeAll']){_0x48ade1['include']=[{'all':!![]}];}return db[_0xd1d2('0x2e')][_0xd1d2('0x42')](_0x48ade1);})[_0xd1d2('0x28')](function(_0x4d0fd9){_0x41171c['rows']=_0x4d0fd9;return _0x41171c;})[_0xd1d2('0x28')](respondWithFilteredResult(_0xc815ea,_0x48ade1))[_0xd1d2('0x43')](handleError(_0xc815ea,null));};exports['show']=function(_0x2fe92a,_0x4c5d49){var _0x5a3790={'raw':![],'where':{'id':_0x2fe92a['params']['id']}},_0x21eb24={};_0x21eb24['model']=_[_0xd1d2('0x36')](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')]);_0x21eb24['query']=_[_0xd1d2('0x36')](_0x2fe92a[_0xd1d2('0x35')]);_0x21eb24[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x21eb24['model'],_0x21eb24[_0xd1d2('0x35')]);_0x5a3790[_0xd1d2('0x39')]=_['intersection'](_0x21eb24[_0xd1d2('0x32')],qs['fields'](_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x5a3790[_0xd1d2('0x39')]=_0x5a3790[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x5a3790['attributes']:_0x21eb24['model'];if(_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x44')]){_0x5a3790['include']=[{'all':!![]}];}_0x5a3790=_[_0xd1d2('0x3f')]({},_0x5a3790,_0x2fe92a[_0xd1d2('0x41')]);return db[_0xd1d2('0x2e')][_0xd1d2('0x45')](_0x5a3790)[_0xd1d2('0x28')](handleEntityNotFound(_0x4c5d49,null))[_0xd1d2('0x28')](respondWithResult(_0x4c5d49,null))[_0xd1d2('0x43')](handleError(_0x4c5d49,null));};exports['create']=function(_0xed9e9,_0xc10c10){return db['FreshdeskAccount'][_0xd1d2('0x46')](_0xed9e9[_0xd1d2('0x47')],{})['then'](respondWithResult(_0xc10c10,0xc9))['catch'](handleError(_0xc10c10,null));};exports[_0xd1d2('0x27')]=function(_0x182ea8,_0x4cb376){if(_0x182ea8[_0xd1d2('0x47')]['id']){delete _0x182ea8[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x45')]({'where':{'id':_0x182ea8[_0xd1d2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cb376,null))['then'](saveUpdates(_0x182ea8[_0xd1d2('0x47')],null))['then'](respondWithResult(_0x4cb376,null))[_0xd1d2('0x43')](handleError(_0x4cb376,null));};exports[_0xd1d2('0x29')]=function(_0x4f4cb9,_0x389fcb){return db[_0xd1d2('0x2e')]['find']({'where':{'id':_0x4f4cb9['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x389fcb,null))[_0xd1d2('0x28')](removeEntity(_0x389fcb,null))[_0xd1d2('0x43')](handleError(_0x389fcb,null));};exports[_0xd1d2('0x49')]=function(_0xa013ce,_0x34a793,_0x1f6150){var _0x3411c8={};var _0x33e332={};var _0x5e15cb;var _0x1958f3;return db['FreshdeskAccount']['findOne']({'where':{'id':_0xa013ce[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x34a793,null))[_0xd1d2('0x28')](function(_0x47417f){if(_0x47417f){_0x5e15cb=_0x47417f;_0x33e332[_0xd1d2('0x32')]=_[_0xd1d2('0x36')](db[_0xd1d2('0x4a')][_0xd1d2('0x2f')]);_0x33e332[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0xa013ce[_0xd1d2('0x35')]);_0x33e332[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x33e332['model'],_0x33e332['query']);_0x3411c8[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x33e332[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x3411c8[_0xd1d2('0x39')]=_0x3411c8[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x3411c8[_0xd1d2('0x39')]:_0x33e332[_0xd1d2('0x32')];_0x3411c8['order']=qs['sort'](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x3411c8[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0xa013ce[_0xd1d2('0x35')],_0x33e332[_0xd1d2('0x37')]));if(_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x40')]){_0x3411c8[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x3411c8[_0xd1d2('0x3e')],{'$or':_['map'](_0x3411c8[_0xd1d2('0x39')],function(_0x24d92c){var _0x1d8788={};_0x1d8788[_0x24d92c]={'$like':'%'+_0xa013ce['query']['filter']+'%'};return _0x1d8788;})});}_0x3411c8=_[_0xd1d2('0x3f')]({},_0x3411c8,_0xa013ce[_0xd1d2('0x41')]);return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0x598e6c){if(_0x598e6c){_0x1958f3=_0x598e6c[_0xd1d2('0x3b')];if(!_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x4b')]('nolimit')){_0x3411c8[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0xa013ce['query'][_0xd1d2('0x21')]);_0x3411c8[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0xa013ce[_0xd1d2('0x35')]['offset']);}return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0xd82d10){if(_0xd82d10){return _0xd82d10?{'count':_0x1958f3,'rows':_0xd82d10}:null;}})[_0xd1d2('0x28')](respondWithResult(_0x34a793,null))[_0xd1d2('0x43')](handleError(_0x34a793,null));};exports['addConfiguration']=function(_0x47aa13,_0x500465,_0x541676){if(_0x47aa13['body']['id']){delete _0x47aa13[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x47aa13['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x500465,null))[_0xd1d2('0x28')](function(_0x22d617){if(_0x22d617){_0x47aa13['body'][_0xd1d2('0x4d')]=_0x22d617['id'];_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x4e')]=integrations[_0xd1d2('0x4f')](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13['body'][_0xd1d2('0x30')]);_0x47aa13[_0xd1d2('0x47')]['Descriptions']=integrations['getDescriptions'](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x30')]);return db['FreshdeskConfiguration'][_0xd1d2('0x46')](_0x47aa13[_0xd1d2('0x47')],{'include':[{'model':db[_0xd1d2('0x51')],'as':_0xd1d2('0x4e')},{'model':db['FreshdeskField'],'as':_0xd1d2('0x52')}]});}return null;})[_0xd1d2('0x28')](respondWithResult(_0x500465,null))[_0xd1d2('0x43')](handleError(_0x500465,null));};exports['getFields']=function(_0x46ff4d,_0x1ae9af,_0x4c35cb){var _0x2175ab='';return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x46ff4d[_0xd1d2('0x48')]['id']},'attributes':['id',_0xd1d2('0x53'),'apiKey']})[_0xd1d2('0x28')](handleEntityNotFound(_0x1ae9af,null))['then'](function(_0x4ec2e1){if(_0x4ec2e1){_0x2175ab=_0x4ec2e1['remoteUri'];var _0x502432=_0x2175ab[_0xd1d2('0x54')](-0x1);if(_0x502432==='/'){_0x2175ab=_0x2175ab['substring'](0x0,_0x2175ab[_0xd1d2('0x55')](_0x502432));}return rp({'method':'GET','uri':util[_0xd1d2('0x56')](_0xd1d2('0x57'),_0x2175ab,_0xd1d2('0x58')),'headers':{'Authorization':util[_0xd1d2('0x56')](_0xd1d2('0x59'),new Buffer(util[_0xd1d2('0x56')]('%s:X',_0x4ec2e1[_0xd1d2('0x5a')]))[_0xd1d2('0x5b')](_0xd1d2('0x5c')))},'json':!![]});}})[_0xd1d2('0x28')](function(_0x448134){if(_0x448134){var _0x2e8b15=[_0xd1d2('0x5d'),_0xd1d2('0x5e'),_0xd1d2('0x5f'),_0xd1d2('0x60'),'status',_0xd1d2('0x61'),_0xd1d2('0x62'),_0xd1d2('0x63'),_0xd1d2('0x64'),'group',_0xd1d2('0x65')];_[_0xd1d2('0x66')](_0x448134,function(_0xb7bf6a){return _0x2e8b15['includes'](_0xb7bf6a[_0xd1d2('0x34')])||!_0xb7bf6a[_0xd1d2('0x67')]&&_0xb7bf6a['type']!=='custom_text'&&_0xb7bf6a[_0xd1d2('0x30')]!==_0xd1d2('0x68');});return{'count':_0x448134[_0xd1d2('0x3b')],'rows':_[_0xd1d2('0x33')](_0x448134,function(_0x348b1d){return{'id':_0x348b1d[_0xd1d2('0x34')],'name':_0x348b1d[_0xd1d2('0x69')],'custom':!_0x348b1d['default'],'options':_0x348b1d[_0xd1d2('0x6a')]?_[_0xd1d2('0x33')](_0x348b1d[_0xd1d2('0x6a')],function(_0x24b8d1){return{'name':_[_0xd1d2('0x6b')](_0x24b8d1),'value':_0x24b8d1};}):[]};})};}})[_0xd1d2('0x28')](respondWithResult(_0x1ae9af,null))[_0xd1d2('0x43')](function(_0x3dbc87){var _0x44409e=_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6c')]?0x1f4:_0x3dbc87[_0xd1d2('0x6d')]||0x1f4;logger[_0xd1d2('0x2a')](_0xd1d2('0x6e'),'getFields',_0x44409e,JSON[_0xd1d2('0x6f')](_0x3dbc87));delete _0x3dbc87[_0xd1d2('0x34')];if(_0x44409e===0x191){_0x44409e=0x190;}_0x1ae9af[_0xd1d2('0x1d')](_0x44409e)[_0xd1d2('0x2c')](_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6c')]?{'message':_0xd1d2('0x70'),'statusCode':_0x3dbc87[_0xd1d2('0x6d')]}:_0x3dbc87);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index fad2b1f..8a96dc0 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 _0xdf3b=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb4002b,_0xd5bc8d){var _0x32c176=function(_0x23f473){while(--_0x23f473){_0xb4002b['push'](_0xb4002b['shift']());}};_0x32c176(++_0xd5bc8d);}(_0xdf3b,0xad));var _0xbdf3=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0xdf3b[_0x49d7ca];return _0x12422f;};'use strict';var _=require(_0xbdf3('0x0'));var util=require(_0xbdf3('0x1'));var logger=require(_0xbdf3('0x2'))(_0xbdf3('0x3'));var moment=require(_0xbdf3('0x4'));var BPromise=require(_0xbdf3('0x5'));var rp=require(_0xbdf3('0x6'));var fs=require('fs');var path=require(_0xbdf3('0x7'));var rimraf=require(_0xbdf3('0x8'));var config=require(_0xbdf3('0x9'));var attributes=require(_0xbdf3('0xa'));var integrations=require(_0xbdf3('0xb'));module[_0xbdf3('0xc')]=function(_0x494c23,_0x3744b2){return _0x494c23[_0xbdf3('0xd')](_0xbdf3('0xe'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe588=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x24bfd8,_0x3570c2){var _0x15822b=function(_0x3e9829){while(--_0x3e9829){_0x24bfd8['push'](_0x24bfd8['shift']());}};_0x15822b(++_0x3570c2);}(_0xe588,0xbf));var _0x8e58=function(_0x472ffa,_0x22e185){_0x472ffa=_0x472ffa-0x0;var _0x2bfefd=_0xe588[_0x472ffa];return _0x2bfefd;};'use strict';var _=require(_0x8e58('0x0'));var util=require(_0x8e58('0x1'));var logger=require(_0x8e58('0x2'))('api');var moment=require(_0x8e58('0x3'));var BPromise=require(_0x8e58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e58('0x5'));var rimraf=require('rimraf');var config=require(_0x8e58('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x8e58('0x7'));module[_0x8e58('0x8')]=function(_0x5ca6d9,_0x3ddb57){return _0x5ca6d9['define'](_0x8e58('0x9'),attributes,{'tableName':_0x8e58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 44b045d..30ef7c1 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 _0xad4d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowFreshdeskAccount','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x1a0ba3,_0x2fde23){var _0x3570fc=function(_0xfc84d6){while(--_0xfc84d6){_0x1a0ba3['push'](_0x1a0ba3['shift']());}};_0x3570fc(++_0x2fde23);}(_0xad4d,0x19f));var _0xdad4=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xad4d[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xdad4('0x0'));var util=require(_0xdad4('0x1'));var moment=require(_0xdad4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdad4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdad4('0x4'))(_0xdad4('0x5'));var config=require(_0xdad4('0x6'));var jayson=require(_0xdad4('0x7'));var client=jayson[_0xdad4('0x8')][_0xdad4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40b462,_0x141254,_0x2145d4){return new BPromise(function(_0x31e2c4,_0xd3d296){return client[_0xdad4('0xa')](_0x40b462,_0x2145d4)[_0xdad4('0xb')](function(_0x19f812){logger[_0xdad4('0xc')](_0xdad4('0xd'),_0x141254,_0xdad4('0xe'));logger[_0xdad4('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x141254,_0xdad4('0xe'),JSON['stringify'](_0x19f812));if(_0x19f812['error']){if(_0x19f812[_0xdad4('0x10')][_0xdad4('0x11')]===0x1f4){logger['error'](_0xdad4('0xd'),_0x141254,_0x19f812[_0xdad4('0x10')][_0xdad4('0x12')]);return _0xd3d296(_0x19f812[_0xdad4('0x10')][_0xdad4('0x12')]);}logger[_0xdad4('0x10')](_0xdad4('0xd'),_0x141254,_0x19f812['error']['message']);return _0x31e2c4(_0x19f812[_0xdad4('0x10')][_0xdad4('0x12')]);}else{logger[_0xdad4('0xc')](_0xdad4('0xd'),_0x141254,_0xdad4('0xe'));_0x31e2c4(_0x19f812[_0xdad4('0x13')][_0xdad4('0x12')]);}})['catch'](function(_0x9f9397){logger[_0xdad4('0x10')](_0xdad4('0xd'),_0x141254,_0x9f9397);_0xd3d296(_0x9f9397);});});}exports[_0xdad4('0x14')]=function(_0x53394c){var _0x407d8c=this;return new Promise(function(_0x389a18,_0x5c0470){return db[_0xdad4('0x15')][_0xdad4('0x16')]({'raw':_0x53394c['options']?_0x53394c[_0xdad4('0x17')][_0xdad4('0x18')]===undefined?!![]:![]:!![],'where':_0x53394c[_0xdad4('0x17')]?_0x53394c['options'][_0xdad4('0x19')]||null:null,'attributes':_0x53394c[_0xdad4('0x17')]?_0x53394c[_0xdad4('0x17')][_0xdad4('0x1a')]||null:null,'limit':_0x53394c['options']?_0x53394c[_0xdad4('0x17')][_0xdad4('0x1b')]||null:null,'include':_0x53394c['options']?_0x53394c[_0xdad4('0x17')][_0xdad4('0x1c')]?_[_0xdad4('0x1d')](_0x53394c['options'][_0xdad4('0x1c')],function(_0x5955ec){return{'model':db[_0x5955ec['model']],'as':_0x5955ec['as'],'attributes':_0x5955ec[_0xdad4('0x1a')],'include':_0x5955ec[_0xdad4('0x1c')]?_[_0xdad4('0x1d')](_0x5955ec[_0xdad4('0x1c')],function(_0x2dc852){return{'model':db[_0x2dc852[_0xdad4('0x1e')]],'as':_0x2dc852['as'],'attributes':_0x2dc852[_0xdad4('0x1a')],'include':_0x2dc852['include']?_[_0xdad4('0x1d')](_0x2dc852[_0xdad4('0x1c')],function(_0x3d4999){return{'model':db[_0x3d4999[_0xdad4('0x1e')]],'as':_0x3d4999['as'],'attributes':_0x3d4999[_0xdad4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c97b){logger[_0xdad4('0xc')](_0xdad4('0x14'),_0x53394c);logger[_0xdad4('0xf')](_0xdad4('0x14'),_0x53394c,JSON[_0xdad4('0x1f')](_0x51c97b));_0x389a18(_0x51c97b);})['catch'](function(_0x380071){logger[_0xdad4('0x10')](_0xdad4('0x14'),_0x380071['message'],_0x53394c);_0x5c0470(_0x407d8c[_0xdad4('0x10')](0x1f4,_0x380071[_0xdad4('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x30b896){var _0x4d49eb=this;return new Promise(function(_0x4acba0,_0x8fd02d){return db[_0xdad4('0x15')][_0xdad4('0x20')]({'raw':_0x30b896[_0xdad4('0x17')]?_0x30b896[_0xdad4('0x17')][_0xdad4('0x18')]===undefined?!![]:![]:!![],'where':_0x30b896[_0xdad4('0x17')]?_0x30b896[_0xdad4('0x17')][_0xdad4('0x19')]||null:null,'attributes':_0x30b896[_0xdad4('0x17')]?_0x30b896[_0xdad4('0x17')][_0xdad4('0x1a')]||null:null,'include':_0x30b896[_0xdad4('0x17')]?_0x30b896[_0xdad4('0x17')][_0xdad4('0x1c')]?_[_0xdad4('0x1d')](_0x30b896['options'][_0xdad4('0x1c')],function(_0x1d0e9e){return{'model':db[_0x1d0e9e['model']],'as':_0x1d0e9e['as'],'attributes':_0x1d0e9e[_0xdad4('0x1a')],'include':_0x1d0e9e[_0xdad4('0x1c')]?_[_0xdad4('0x1d')](_0x1d0e9e['include'],function(_0x3814bb){return{'model':db[_0x3814bb[_0xdad4('0x1e')]],'as':_0x3814bb['as'],'attributes':_0x3814bb[_0xdad4('0x1a')],'include':_0x3814bb[_0xdad4('0x1c')]?_[_0xdad4('0x1d')](_0x3814bb[_0xdad4('0x1c')],function(_0xe48a8d){return{'model':db[_0xe48a8d[_0xdad4('0x1e')]],'as':_0xe48a8d['as'],'attributes':_0xe48a8d[_0xdad4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdad4('0xb')](function(_0x102134){logger[_0xdad4('0xc')](_0xdad4('0x21'),_0x30b896);logger[_0xdad4('0xf')](_0xdad4('0x21'),_0x30b896,JSON['stringify'](_0x102134));_0x4acba0(_0x102134);})[_0xdad4('0x22')](function(_0x1f7d46){logger[_0xdad4('0x10')](_0xdad4('0x21'),_0x1f7d46['message'],_0x30b896);_0x8fd02d(_0x4d49eb[_0xdad4('0x10')](0x1f4,_0x1f7d46[_0xdad4('0x12')]));});});}; \ No newline at end of file +var _0x84af=['then','ShowFreshdeskAccount','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x17fd88,_0x13ee8c){var _0x34007f=function(_0x2aa6b3){while(--_0x2aa6b3){_0x17fd88['push'](_0x17fd88['shift']());}};_0x34007f(++_0x13ee8c);}(_0x84af,0x195));var _0xf84a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x84af[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xf84a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf84a('0x1'));var db=require(_0xf84a('0x2'))['db'];var utils=require(_0xf84a('0x3'));var logger=require(_0xf84a('0x4'))('rpc');var config=require(_0xf84a('0x5'));var jayson=require(_0xf84a('0x6'));var client=jayson['client'][_0xf84a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36300d,_0x393f8b,_0x1c60a8){return new BPromise(function(_0x41e4f7,_0x1f7a2f){return client['request'](_0x36300d,_0x1c60a8)['then'](function(_0x3307d3){logger[_0xf84a('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x393f8b,'request\x20sent');logger[_0xf84a('0x9')](_0xf84a('0xa'),_0x393f8b,_0xf84a('0xb'),JSON[_0xf84a('0xc')](_0x3307d3));if(_0x3307d3[_0xf84a('0xd')]){if(_0x3307d3[_0xf84a('0xd')]['code']===0x1f4){logger['error'](_0xf84a('0xe'),_0x393f8b,_0x3307d3['error'][_0xf84a('0xf')]);return _0x1f7a2f(_0x3307d3['error'][_0xf84a('0xf')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x393f8b,_0x3307d3[_0xf84a('0xd')][_0xf84a('0xf')]);return _0x41e4f7(_0x3307d3[_0xf84a('0xd')]['message']);}else{logger[_0xf84a('0x8')](_0xf84a('0xe'),_0x393f8b,_0xf84a('0xb'));_0x41e4f7(_0x3307d3[_0xf84a('0x10')]['message']);}})[_0xf84a('0x11')](function(_0x3ef953){logger[_0xf84a('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x393f8b,_0x3ef953);_0x1f7a2f(_0x3ef953);});});}exports[_0xf84a('0x12')]=function(_0x2cdc28){var _0x94b0b9=this;return new Promise(function(_0x28a694,_0x1178ef){return db[_0xf84a('0x13')][_0xf84a('0x14')]({'raw':_0x2cdc28['options']?_0x2cdc28[_0xf84a('0x15')][_0xf84a('0x16')]===undefined?!![]:![]:!![],'where':_0x2cdc28[_0xf84a('0x15')]?_0x2cdc28[_0xf84a('0x15')][_0xf84a('0x17')]||null:null,'attributes':_0x2cdc28[_0xf84a('0x15')]?_0x2cdc28['options'][_0xf84a('0x18')]||null:null,'limit':_0x2cdc28[_0xf84a('0x15')]?_0x2cdc28[_0xf84a('0x15')][_0xf84a('0x19')]||null:null,'include':_0x2cdc28[_0xf84a('0x15')]?_0x2cdc28[_0xf84a('0x15')][_0xf84a('0x1a')]?_[_0xf84a('0x1b')](_0x2cdc28[_0xf84a('0x15')][_0xf84a('0x1a')],function(_0x1823fc){return{'model':db[_0x1823fc[_0xf84a('0x1c')]],'as':_0x1823fc['as'],'attributes':_0x1823fc[_0xf84a('0x18')],'include':_0x1823fc['include']?_[_0xf84a('0x1b')](_0x1823fc[_0xf84a('0x1a')],function(_0x201cf8){return{'model':db[_0x201cf8[_0xf84a('0x1c')]],'as':_0x201cf8['as'],'attributes':_0x201cf8['attributes'],'include':_0x201cf8[_0xf84a('0x1a')]?_[_0xf84a('0x1b')](_0x201cf8[_0xf84a('0x1a')],function(_0x71a12b){return{'model':db[_0x71a12b[_0xf84a('0x1c')]],'as':_0x71a12b['as'],'attributes':_0x71a12b[_0xf84a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf84a('0x1d')](function(_0x725c6a){logger[_0xf84a('0x8')](_0xf84a('0x12'),_0x2cdc28);logger[_0xf84a('0x9')]('GetFreshdeskAccount',_0x2cdc28,JSON[_0xf84a('0xc')](_0x725c6a));_0x28a694(_0x725c6a);})[_0xf84a('0x11')](function(_0x4321d3){logger[_0xf84a('0xd')]('GetFreshdeskAccount',_0x4321d3['message'],_0x2cdc28);_0x1178ef(_0x94b0b9[_0xf84a('0xd')](0x1f4,_0x4321d3['message']));});});};exports[_0xf84a('0x1e')]=function(_0x4c0f71){var _0x2aef24=this;return new Promise(function(_0x172847,_0x3d02a3){return db['FreshdeskAccount']['find']({'raw':_0x4c0f71['options']?_0x4c0f71[_0xf84a('0x15')][_0xf84a('0x16')]===undefined?!![]:![]:!![],'where':_0x4c0f71[_0xf84a('0x15')]?_0x4c0f71['options'][_0xf84a('0x17')]||null:null,'attributes':_0x4c0f71[_0xf84a('0x15')]?_0x4c0f71[_0xf84a('0x15')]['attributes']||null:null,'include':_0x4c0f71[_0xf84a('0x15')]?_0x4c0f71[_0xf84a('0x15')][_0xf84a('0x1a')]?_[_0xf84a('0x1b')](_0x4c0f71[_0xf84a('0x15')][_0xf84a('0x1a')],function(_0x790f76){return{'model':db[_0x790f76[_0xf84a('0x1c')]],'as':_0x790f76['as'],'attributes':_0x790f76[_0xf84a('0x18')],'include':_0x790f76[_0xf84a('0x1a')]?_[_0xf84a('0x1b')](_0x790f76[_0xf84a('0x1a')],function(_0xe703ab){return{'model':db[_0xe703ab[_0xf84a('0x1c')]],'as':_0xe703ab['as'],'attributes':_0xe703ab[_0xf84a('0x18')],'include':_0xe703ab[_0xf84a('0x1a')]?_[_0xf84a('0x1b')](_0xe703ab['include'],function(_0x4dc90e){return{'model':db[_0x4dc90e['model']],'as':_0x4dc90e['as'],'attributes':_0x4dc90e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf84a('0x1d')](function(_0x7056e9){logger[_0xf84a('0x8')](_0xf84a('0x1e'),_0x4c0f71);logger[_0xf84a('0x9')]('ShowFreshdeskAccount',_0x4c0f71,JSON[_0xf84a('0xc')](_0x7056e9));_0x172847(_0x7056e9);})[_0xf84a('0x11')](function(_0x1c3d76){logger[_0xf84a('0xd')](_0xf84a('0x1e'),_0x1c3d76[_0xf84a('0xf')],_0x4c0f71);_0x3d02a3(_0x2aef24[_0xf84a('0xd')](0x1f4,_0x1c3d76[_0xf84a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 784a06c..5264a79 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 _0xda04=['/:id/tags','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','create'];(function(_0x1b1336,_0x1b0ec6){var _0x3dc39a=function(_0x8a468c){while(--_0x8a468c){_0x1b1336['push'](_0x1b1336['shift']());}};_0x3dc39a(++_0x1b0ec6);}(_0xda04,0x156));var _0x4da0=function(_0x456eae,_0x4290c3){_0x456eae=_0x456eae-0x0;var _0x49f4b1=_0xda04[_0x456eae];return _0x49f4b1;};'use strict';var multer=require(_0x4da0('0x0'));var util=require(_0x4da0('0x1'));var path=require(_0x4da0('0x2'));var timeout=require(_0x4da0('0x3'));var express=require(_0x4da0('0x4'));var router=express[_0x4da0('0x5')]();var fs_extra=require(_0x4da0('0x6'));var auth=require(_0x4da0('0x7'));var interaction=require(_0x4da0('0x8'));var config=require(_0x4da0('0x9'));var controller=require(_0x4da0('0xa'));router['get']('/',auth[_0x4da0('0xb')](),controller[_0x4da0('0xc')]);router[_0x4da0('0xd')](_0x4da0('0xe'),auth[_0x4da0('0xb')](),controller['show']);router[_0x4da0('0xd')](_0x4da0('0xf'),auth[_0x4da0('0xb')](),controller[_0x4da0('0x10')]);router['get'](_0x4da0('0x11'),auth[_0x4da0('0xb')](),controller[_0x4da0('0x12')]);router[_0x4da0('0xd')]('/:id/descriptions',auth[_0x4da0('0xb')](),controller[_0x4da0('0x13')]);router[_0x4da0('0xd')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4da0('0x14')]);router['post']('/',auth[_0x4da0('0xb')](),controller[_0x4da0('0x15')]);router['post'](_0x4da0('0x16'),auth[_0x4da0('0xb')](),controller[_0x4da0('0x17')]);router[_0x4da0('0x18')](_0x4da0('0xe'),auth[_0x4da0('0xb')](),controller[_0x4da0('0x19')]);router[_0x4da0('0x1a')](_0x4da0('0xe'),auth[_0x4da0('0xb')](),controller['destroy']);module[_0x4da0('0x1b')]=router; \ No newline at end of file +var _0x70b5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','setTags','put','delete','multer','util'];(function(_0x89b752,_0x1db379){var _0x3b6413=function(_0x2926c1){while(--_0x2926c1){_0x89b752['push'](_0x89b752['shift']());}};_0x3b6413(++_0x1db379);}(_0x70b5,0x14e));var _0x570b=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x70b5[_0x52a857];return _0x4e2aae;};'use strict';var multer=require(_0x570b('0x0'));var util=require(_0x570b('0x1'));var path=require(_0x570b('0x2'));var timeout=require(_0x570b('0x3'));var express=require(_0x570b('0x4'));var router=express[_0x570b('0x5')]();var fs_extra=require(_0x570b('0x6'));var auth=require(_0x570b('0x7'));var interaction=require(_0x570b('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x570b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x570b('0xa'),auth[_0x570b('0xb')](),controller['show']);router[_0x570b('0x9')](_0x570b('0xc'),auth[_0x570b('0xb')](),controller[_0x570b('0xd')]);router[_0x570b('0x9')]('/:id/subjects',auth[_0x570b('0xb')](),controller[_0x570b('0xe')]);router[_0x570b('0x9')](_0x570b('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x570b('0x9')](_0x570b('0x10'),auth['isAuthenticated'](),controller[_0x570b('0x11')]);router['post']('/',auth[_0x570b('0xb')](),controller['create']);router['post'](_0x570b('0x10'),auth['isAuthenticated'](),controller[_0x570b('0x12')]);router[_0x570b('0x13')](_0x570b('0xa'),auth[_0x570b('0xb')](),controller['update']);router[_0x570b('0x14')]('/:id',auth[_0x570b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6bc208d..0ded224 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 _0xa8c0=['exports','STRING','sequelize'];(function(_0x5dd439,_0x32cdf2){var _0x3fc93b=function(_0xbf20ee){while(--_0xbf20ee){_0x5dd439['push'](_0x5dd439['shift']());}};_0x3fc93b(++_0x32cdf2);}(_0xa8c0,0xa4));var _0x0a8c=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xa8c0[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require(_0x0a8c('0x0'));module[_0x0a8c('0x1')]={'name':{'type':Sequelize[_0x0a8c('0x2')]},'description':{'type':Sequelize[_0x0a8c('0x2')]}}; \ No newline at end of file +var _0xd6c0=['sequelize','STRING'];(function(_0x2d173f,_0x49eb44){var _0x45f5af=function(_0x4de402){while(--_0x4de402){_0x2d173f['push'](_0x2d173f['shift']());}};_0x45f5af(++_0x49eb44);}(_0xd6c0,0x10c));var _0x0d6c=function(_0x5e6094,_0x31919b){_0x5e6094=_0x5e6094-0x0;var _0xf4c05e=_0xd6c0[_0x5e6094];return _0xf4c05e;};'use strict';var Sequelize=require(_0x0d6c('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d6c('0x1')]},'description':{'type':Sequelize[_0x0d6c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8568738..88b2b19 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 _0x8328=['then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0x8328,0x1ba));var _0x8832=function(_0x104842,_0x2d8ea4){_0x104842=_0x104842-0x0;var _0x32710a=_0x8328[_0x104842];return _0x32710a;};'use strict';var emlformat=require(_0x8832('0x0'));var rimraf=require(_0x8832('0x1'));var zipdir=require(_0x8832('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8832('0x3'));var moment=require(_0x8832('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8832('0x5'));var csv=require('to-csv');var ejs=require(_0x8832('0x6'));var fs=require('fs');var fs_extra=require(_0x8832('0x7'));var _=require(_0x8832('0x8'));var squel=require(_0x8832('0x9'));var crypto=require(_0x8832('0xa'));var jsforce=require(_0x8832('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8832('0xc'));var querystring=require(_0x8832('0xd'));var Papa=require(_0x8832('0xe'));var Redis=require(_0x8832('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8832('0x10'));var hardwareService=require(_0x8832('0x11'));var logger=require(_0x8832('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8832('0x13'));var licenseUtil=require(_0x8832('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4e43,_0xd92848){_0xd92848=_0xd92848||0xcc;return function(_0x57f105){if(_0x57f105){return _0x5f4e43[_0x8832('0x15')](_0xd92848);}return _0x5f4e43[_0x8832('0x16')](_0xd92848)[_0x8832('0x17')]();};}function respondWithResult(_0x1a8cf9,_0xec4a73){_0xec4a73=_0xec4a73||0xc8;return function(_0x3fdcd8){if(_0x3fdcd8){return _0x1a8cf9[_0x8832('0x16')](_0xec4a73)[_0x8832('0x18')](_0x3fdcd8);}};}function respondWithFilteredResult(_0x672d47,_0x2bfdc8){return function(_0x36139e){if(_0x36139e){var _0x44d07e=typeof _0x2bfdc8[_0x8832('0x19')]==='undefined'&&typeof _0x2bfdc8[_0x8832('0x1a')]==='undefined';var _0x5e9330=_0x36139e['count'];var _0x17f4bc=_0x44d07e?0x0:_0x2bfdc8[_0x8832('0x19')];var _0x2667c1=_0x44d07e?_0x36139e['count']:_0x2bfdc8[_0x8832('0x19')]+_0x2bfdc8[_0x8832('0x1a')];var _0x579dbf;if(_0x2667c1>=_0x5e9330){_0x2667c1=_0x5e9330;_0x579dbf=0xc8;}else{_0x579dbf=0xce;}_0x672d47[_0x8832('0x16')](_0x579dbf);return _0x672d47[_0x8832('0x1b')](_0x8832('0x1c'),_0x17f4bc+'-'+_0x2667c1+'/'+_0x5e9330)[_0x8832('0x18')](_0x36139e);}return null;};}function patchUpdates(_0xcdec00){return function(_0x42ddc2){try{jsonpatch[_0x8832('0x1d')](_0x42ddc2,_0xcdec00,!![]);}catch(_0x34803b){return BPromise[_0x8832('0x1e')](_0x34803b);}return _0x42ddc2['save']();};}function saveUpdates(_0x2c2223,_0x4c13ee){return function(_0x45f9c4){if(_0x45f9c4){return _0x45f9c4[_0x8832('0x1f')](_0x2c2223)[_0x8832('0x20')](function(_0x815ad0){return _0x815ad0;});}return null;};}function removeEntity(_0x1b1cc4,_0x33023b){return function(_0x4e4dd6){if(_0x4e4dd6){return _0x4e4dd6[_0x8832('0x21')]()[_0x8832('0x20')](function(){_0x1b1cc4[_0x8832('0x16')](0xcc)[_0x8832('0x17')]();});}};}function handleEntityNotFound(_0x3b139c,_0x3e84b8){return function(_0x2cf32b){if(!_0x2cf32b){_0x3b139c[_0x8832('0x15')](0x194);}return _0x2cf32b;};}function handleError(_0xf8176b,_0x4cd048){_0x4cd048=_0x4cd048||0x1f4;return function(_0x3c9c17){logger[_0x8832('0x22')](_0x3c9c17['stack']);if(_0x3c9c17[_0x8832('0x23')]){delete _0x3c9c17[_0x8832('0x23')];}_0xf8176b[_0x8832('0x16')](_0x4cd048)[_0x8832('0x24')](_0x3c9c17);};}exports['index']=function(_0x29d495,_0xbbfba9){var _0x212535={},_0x27e243={},_0x3cd51b={'count':0x0,'rows':[]};var _0x4aa497=_[_0x8832('0x25')](db[_0x8832('0x26')][_0x8832('0x27')],function(_0x1016a8){return{'name':_0x1016a8[_0x8832('0x28')],'type':_0x1016a8['type'][_0x8832('0x29')]};});_0x27e243[_0x8832('0x2a')]=_[_0x8832('0x25')](_0x4aa497,_0x8832('0x23'));_0x27e243['query']=_[_0x8832('0x2b')](_0x29d495['query']);_0x27e243[_0x8832('0x2c')]=_[_0x8832('0x2d')](_0x27e243['model'],_0x27e243['query']);_0x212535[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x27e243[_0x8832('0x2a')],qs['fields'](_0x29d495[_0x8832('0x2f')]['fields']));_0x212535[_0x8832('0x2e')]=_0x212535[_0x8832('0x2e')][_0x8832('0x30')]?_0x212535[_0x8832('0x2e')]:_0x27e243[_0x8832('0x2a')];if(!_0x29d495[_0x8832('0x2f')][_0x8832('0x31')](_0x8832('0x32'))){_0x212535['limit']=qs[_0x8832('0x1a')](_0x29d495[_0x8832('0x2f')][_0x8832('0x1a')]);_0x212535[_0x8832('0x19')]=qs['offset'](_0x29d495[_0x8832('0x2f')][_0x8832('0x19')]);}_0x212535[_0x8832('0x33')]=qs[_0x8832('0x34')](_0x29d495[_0x8832('0x2f')][_0x8832('0x34')]);_0x212535[_0x8832('0x35')]=qs[_0x8832('0x2c')](_[_0x8832('0x36')](_0x29d495[_0x8832('0x2f')],_0x27e243['filters']),_0x4aa497);if(_0x29d495[_0x8832('0x2f')][_0x8832('0x37')]){_0x212535[_0x8832('0x35')]=_[_0x8832('0x38')](_0x212535[_0x8832('0x35')],{'$or':_[_0x8832('0x25')](_0x4aa497,function(_0x80caca){if(_0x80caca[_0x8832('0x39')]!==_0x8832('0x3a')){var _0x2f09bd={};_0x2f09bd[_0x80caca['name']]={'$like':'%'+_0x29d495[_0x8832('0x2f')][_0x8832('0x37')]+'%'};return _0x2f09bd;}})});}_0x212535=_[_0x8832('0x38')]({},_0x212535,_0x29d495[_0x8832('0x3b')]);var _0x4b6a4e={'where':_0x212535[_0x8832('0x35')]};return db[_0x8832('0x26')]['count'](_0x4b6a4e)['then'](function(_0x2c764b){_0x3cd51b[_0x8832('0x3c')]=_0x2c764b;if(_0x29d495[_0x8832('0x2f')][_0x8832('0x3d')]){_0x212535[_0x8832('0x3e')]=[{'all':!![]}];}return db[_0x8832('0x26')][_0x8832('0x3f')](_0x212535);})[_0x8832('0x20')](function(_0x377625){_0x3cd51b[_0x8832('0x40')]=_0x377625;return _0x3cd51b;})[_0x8832('0x20')](respondWithFilteredResult(_0xbbfba9,_0x212535))[_0x8832('0x41')](handleError(_0xbbfba9,null));};exports[_0x8832('0x42')]=function(_0x59ec94,_0x3d1d66){var _0x4bf733={'raw':![],'where':{'id':_0x59ec94[_0x8832('0x43')]['id']}},_0x4200be={};_0x4200be[_0x8832('0x2a')]=_[_0x8832('0x2b')](db[_0x8832('0x26')][_0x8832('0x27')]);_0x4200be[_0x8832('0x2f')]=_[_0x8832('0x2b')](_0x59ec94[_0x8832('0x2f')]);_0x4200be[_0x8832('0x2c')]=_['intersection'](_0x4200be[_0x8832('0x2a')],_0x4200be[_0x8832('0x2f')]);_0x4bf733[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x4200be[_0x8832('0x2a')],qs['fields'](_0x59ec94[_0x8832('0x2f')][_0x8832('0x44')]));_0x4bf733[_0x8832('0x2e')]=_0x4bf733[_0x8832('0x2e')][_0x8832('0x30')]?_0x4bf733['attributes']:_0x4200be[_0x8832('0x2a')];if(_0x59ec94[_0x8832('0x2f')]['includeAll']){_0x4bf733[_0x8832('0x3e')]=[{'all':!![]}];}_0x4bf733=_[_0x8832('0x38')]({},_0x4bf733,_0x59ec94[_0x8832('0x3b')]);return db[_0x8832('0x26')]['find'](_0x4bf733)[_0x8832('0x20')](handleEntityNotFound(_0x3d1d66,null))[_0x8832('0x20')](respondWithResult(_0x3d1d66,null))[_0x8832('0x41')](handleError(_0x3d1d66,null));};exports['create']=function(_0x1733fa,_0x51fef5){return db[_0x8832('0x26')][_0x8832('0x45')](_0x1733fa[_0x8832('0x46')],{})['then'](respondWithResult(_0x51fef5,0xc9))['catch'](handleError(_0x51fef5,null));};exports[_0x8832('0x1f')]=function(_0x764973,_0xaac2f9){if(_0x764973['body']['id']){delete _0x764973[_0x8832('0x46')]['id'];}return db[_0x8832('0x26')][_0x8832('0x47')]({'where':{'id':_0x764973[_0x8832('0x43')]['id']}})[_0x8832('0x20')](handleEntityNotFound(_0xaac2f9,null))[_0x8832('0x20')](saveUpdates(_0x764973['body'],null))[_0x8832('0x20')](respondWithResult(_0xaac2f9,null))[_0x8832('0x41')](handleError(_0xaac2f9,null));};exports[_0x8832('0x21')]=function(_0x21013d,_0x3efc1d){return db[_0x8832('0x26')][_0x8832('0x47')]({'where':{'id':_0x21013d[_0x8832('0x43')]['id']}})['then'](handleEntityNotFound(_0x3efc1d,null))['then'](removeEntity(_0x3efc1d,null))[_0x8832('0x41')](handleError(_0x3efc1d,null));};exports['getFields']=function(_0x3988f3,_0x460292,_0x4ea1fb){var _0x147cb9={};var _0x27f4ab={};var _0x55e56a;var _0x2f5963;return db['FreshdeskConfiguration'][_0x8832('0x48')]({'where':{'id':_0x3988f3['params']['id']}})[_0x8832('0x20')](handleEntityNotFound(_0x460292,null))['then'](function(_0x5a9c36){if(_0x5a9c36){_0x55e56a=_0x5a9c36;_0x27f4ab[_0x8832('0x2a')]=_[_0x8832('0x2b')](db[_0x8832('0x49')][_0x8832('0x27')]);_0x27f4ab['query']=_[_0x8832('0x2b')](_0x3988f3[_0x8832('0x2f')]);_0x27f4ab[_0x8832('0x2c')]=_[_0x8832('0x2d')](_0x27f4ab[_0x8832('0x2a')],_0x27f4ab[_0x8832('0x2f')]);_0x147cb9[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x27f4ab[_0x8832('0x2a')],qs['fields'](_0x3988f3[_0x8832('0x2f')][_0x8832('0x44')]));_0x147cb9[_0x8832('0x2e')]=_0x147cb9['attributes'][_0x8832('0x30')]?_0x147cb9['attributes']:_0x27f4ab[_0x8832('0x2a')];_0x147cb9[_0x8832('0x33')]=qs[_0x8832('0x34')](_0x3988f3[_0x8832('0x2f')][_0x8832('0x34')]);_0x147cb9[_0x8832('0x35')]=qs[_0x8832('0x2c')](_[_0x8832('0x36')](_0x3988f3[_0x8832('0x2f')],_0x27f4ab[_0x8832('0x2c')]));if(_0x3988f3[_0x8832('0x2f')][_0x8832('0x37')]){_0x147cb9['where']=_[_0x8832('0x38')](_0x147cb9['where'],{'$or':_['map'](_0x147cb9['attributes'],function(_0x4526ad){var _0x3d165c={};_0x3d165c[_0x4526ad]={'$like':'%'+_0x3988f3[_0x8832('0x2f')][_0x8832('0x37')]+'%'};return _0x3d165c;})});}_0x147cb9=_[_0x8832('0x38')]({},_0x147cb9,_0x3988f3[_0x8832('0x3b')]);return _0x55e56a[_0x8832('0x4a')](_0x147cb9);}})[_0x8832('0x20')](function(_0x4a36f7){if(_0x4a36f7){_0x2f5963=_0x4a36f7[_0x8832('0x30')];if(!_0x3988f3[_0x8832('0x2f')][_0x8832('0x31')]('nolimit')){_0x147cb9[_0x8832('0x1a')]=qs[_0x8832('0x1a')](_0x3988f3[_0x8832('0x2f')][_0x8832('0x1a')]);_0x147cb9[_0x8832('0x19')]=qs['offset'](_0x3988f3[_0x8832('0x2f')][_0x8832('0x19')]);}return _0x55e56a['getFields'](_0x147cb9);}})[_0x8832('0x20')](function(_0x3547be){if(_0x3547be){return _0x3547be?{'count':_0x2f5963,'rows':_0x3547be}:null;}})['then'](respondWithResult(_0x460292,null))['catch'](handleError(_0x460292,null));};exports['getSubjects']=function(_0x2d4017,_0x2de751,_0x350368){var _0x3df162={};var _0x110356={};var _0x3a0a53;var _0x450c38;return db[_0x8832('0x26')][_0x8832('0x48')]({'where':{'id':_0x2d4017[_0x8832('0x43')]['id']}})[_0x8832('0x20')](handleEntityNotFound(_0x2de751,null))[_0x8832('0x20')](function(_0x2d62fe){if(_0x2d62fe){_0x3a0a53=_0x2d62fe;_0x110356[_0x8832('0x2a')]=_[_0x8832('0x2b')](db[_0x8832('0x49')][_0x8832('0x27')]);_0x110356['query']=_['keys'](_0x2d4017['query']);_0x110356[_0x8832('0x2c')]=_['intersection'](_0x110356[_0x8832('0x2a')],_0x110356[_0x8832('0x2f')]);_0x3df162[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x110356[_0x8832('0x2a')],qs[_0x8832('0x44')](_0x2d4017[_0x8832('0x2f')][_0x8832('0x44')]));_0x3df162[_0x8832('0x2e')]=_0x3df162[_0x8832('0x2e')][_0x8832('0x30')]?_0x3df162[_0x8832('0x2e')]:_0x110356[_0x8832('0x2a')];_0x3df162[_0x8832('0x33')]=qs[_0x8832('0x34')](_0x2d4017[_0x8832('0x2f')][_0x8832('0x34')]);_0x3df162[_0x8832('0x35')]=qs[_0x8832('0x2c')](_['pick'](_0x2d4017[_0x8832('0x2f')],_0x110356['filters']));if(_0x2d4017[_0x8832('0x2f')][_0x8832('0x37')]){_0x3df162[_0x8832('0x35')]=_[_0x8832('0x38')](_0x3df162[_0x8832('0x35')],{'$or':_['map'](_0x3df162['attributes'],function(_0x3a000c){var _0x3e38bd={};_0x3e38bd[_0x3a000c]={'$like':'%'+_0x2d4017[_0x8832('0x2f')][_0x8832('0x37')]+'%'};return _0x3e38bd;})});}_0x3df162=_[_0x8832('0x38')]({},_0x3df162,_0x2d4017[_0x8832('0x3b')]);return _0x3a0a53[_0x8832('0x4b')](_0x3df162);}})[_0x8832('0x20')](function(_0x4b3c01){if(_0x4b3c01){_0x450c38=_0x4b3c01[_0x8832('0x30')];if(!_0x2d4017[_0x8832('0x2f')][_0x8832('0x31')](_0x8832('0x32'))){_0x3df162[_0x8832('0x1a')]=qs[_0x8832('0x1a')](_0x2d4017[_0x8832('0x2f')][_0x8832('0x1a')]);_0x3df162[_0x8832('0x19')]=qs[_0x8832('0x19')](_0x2d4017[_0x8832('0x2f')][_0x8832('0x19')]);}return _0x3a0a53['getSubjects'](_0x3df162);}})[_0x8832('0x20')](function(_0x16ab40){if(_0x16ab40){return _0x16ab40?{'count':_0x450c38,'rows':_0x16ab40}:null;}})['then'](respondWithResult(_0x2de751,null))[_0x8832('0x41')](handleError(_0x2de751,null));};exports[_0x8832('0x4c')]=function(_0x627de,_0x53c815,_0x570982){var _0x3b621a={};var _0x2b7d7e={};var _0x280a08;var _0x57b062;return db['FreshdeskConfiguration'][_0x8832('0x48')]({'where':{'id':_0x627de[_0x8832('0x43')]['id']}})[_0x8832('0x20')](handleEntityNotFound(_0x53c815,null))[_0x8832('0x20')](function(_0x4c076e){if(_0x4c076e){_0x280a08=_0x4c076e;_0x2b7d7e['model']=_[_0x8832('0x2b')](db[_0x8832('0x49')][_0x8832('0x27')]);_0x2b7d7e[_0x8832('0x2f')]=_[_0x8832('0x2b')](_0x627de['query']);_0x2b7d7e['filters']=_[_0x8832('0x2d')](_0x2b7d7e[_0x8832('0x2a')],_0x2b7d7e[_0x8832('0x2f')]);_0x3b621a[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x2b7d7e[_0x8832('0x2a')],qs[_0x8832('0x44')](_0x627de[_0x8832('0x2f')]['fields']));_0x3b621a[_0x8832('0x2e')]=_0x3b621a[_0x8832('0x2e')][_0x8832('0x30')]?_0x3b621a['attributes']:_0x2b7d7e[_0x8832('0x2a')];_0x3b621a['order']=qs[_0x8832('0x34')](_0x627de[_0x8832('0x2f')][_0x8832('0x34')]);_0x3b621a['where']=qs[_0x8832('0x2c')](_[_0x8832('0x36')](_0x627de[_0x8832('0x2f')],_0x2b7d7e['filters']));if(_0x627de[_0x8832('0x2f')][_0x8832('0x37')]){_0x3b621a[_0x8832('0x35')]=_['merge'](_0x3b621a[_0x8832('0x35')],{'$or':_[_0x8832('0x25')](_0x3b621a[_0x8832('0x2e')],function(_0x2582d0){var _0x1542e2={};_0x1542e2[_0x2582d0]={'$like':'%'+_0x627de['query'][_0x8832('0x37')]+'%'};return _0x1542e2;})});}_0x3b621a=_[_0x8832('0x38')]({},_0x3b621a,_0x627de[_0x8832('0x3b')]);return _0x280a08[_0x8832('0x4c')](_0x3b621a);}})['then'](function(_0x3b9509){if(_0x3b9509){_0x57b062=_0x3b9509['length'];if(!_0x627de[_0x8832('0x2f')][_0x8832('0x31')](_0x8832('0x32'))){_0x3b621a['limit']=qs[_0x8832('0x1a')](_0x627de['query'][_0x8832('0x1a')]);_0x3b621a[_0x8832('0x19')]=qs['offset'](_0x627de[_0x8832('0x2f')]['offset']);}return _0x280a08[_0x8832('0x4c')](_0x3b621a);}})[_0x8832('0x20')](function(_0x4889ac){if(_0x4889ac){return _0x4889ac?{'count':_0x57b062,'rows':_0x4889ac}:null;}})[_0x8832('0x20')](respondWithResult(_0x53c815,null))[_0x8832('0x41')](handleError(_0x53c815,null));};exports[_0x8832('0x4d')]=function(_0x2f3edd,_0xe77e1,_0x901926){var _0x275438={};var _0x2643da={};var _0x2282df;var _0x414e77;return db[_0x8832('0x26')][_0x8832('0x48')]({'where':{'id':_0x2f3edd['params']['id']}})[_0x8832('0x20')](handleEntityNotFound(_0xe77e1,null))[_0x8832('0x20')](function(_0x63b348){if(_0x63b348){_0x2282df=_0x63b348;_0x2643da['model']=_[_0x8832('0x2b')](db['Tag'][_0x8832('0x27')]);_0x2643da[_0x8832('0x2f')]=_[_0x8832('0x2b')](_0x2f3edd['query']);_0x2643da[_0x8832('0x2c')]=_['intersection'](_0x2643da[_0x8832('0x2a')],_0x2643da['query']);_0x275438[_0x8832('0x2e')]=_[_0x8832('0x2d')](_0x2643da[_0x8832('0x2a')],qs[_0x8832('0x44')](_0x2f3edd[_0x8832('0x2f')][_0x8832('0x44')]));_0x275438['attributes']=_0x275438[_0x8832('0x2e')][_0x8832('0x30')]?_0x275438[_0x8832('0x2e')]:_0x2643da[_0x8832('0x2a')];_0x275438[_0x8832('0x33')]=qs['sort'](_0x2f3edd[_0x8832('0x2f')][_0x8832('0x34')]);_0x275438['where']=qs['filters'](_[_0x8832('0x36')](_0x2f3edd[_0x8832('0x2f')],_0x2643da['filters']));if(_0x2f3edd['query']['filter']){_0x275438[_0x8832('0x35')]=_[_0x8832('0x38')](_0x275438['where'],{'$or':_[_0x8832('0x25')](_0x275438['attributes'],function(_0x5b34c0){var _0x4fad4c={};_0x4fad4c[_0x5b34c0]={'$like':'%'+_0x2f3edd[_0x8832('0x2f')]['filter']+'%'};return _0x4fad4c;})});}_0x275438=_[_0x8832('0x38')]({},_0x275438,_0x2f3edd['options']);return _0x2282df[_0x8832('0x4d')](_0x275438);}})[_0x8832('0x20')](function(_0x218ff7){if(_0x218ff7){_0x414e77=_0x218ff7[_0x8832('0x30')];if(!_0x2f3edd[_0x8832('0x2f')][_0x8832('0x31')](_0x8832('0x32'))){_0x275438[_0x8832('0x1a')]=qs[_0x8832('0x1a')](_0x2f3edd[_0x8832('0x2f')]['limit']);_0x275438[_0x8832('0x19')]=qs[_0x8832('0x19')](_0x2f3edd[_0x8832('0x2f')][_0x8832('0x19')]);}return _0x2282df['getTags'](_0x275438);}})[_0x8832('0x20')](function(_0xbc9197){if(_0xbc9197){return _0xbc9197?{'count':_0x414e77,'rows':_0xbc9197}:null;}})[_0x8832('0x20')](respondWithResult(_0xe77e1,null))[_0x8832('0x41')](handleError(_0xe77e1,null));};exports[_0x8832('0x4e')]=function(_0x25f032,_0x337c84,_0x1a95a8){if(_0x25f032['body']['id']){delete _0x25f032[_0x8832('0x46')]['id'];}return db[_0x8832('0x26')][_0x8832('0x48')]({'where':{'id':_0x25f032['params']['id']}})['then'](handleEntityNotFound(_0x337c84,null))[_0x8832('0x20')](function(_0x83be4c){if(_0x83be4c){return _0x83be4c[_0x8832('0x4e')](_0x25f032[_0x8832('0x46')]['ids']||[]);}return null;})[_0x8832('0x20')](respondWithResult(_0x337c84,null))[_0x8832('0x41')](handleError(_0x337c84,null));}; \ No newline at end of file +var _0xb498=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','find','getFields','FreshdeskField','order','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs'];(function(_0xef1383,_0x11d557){var _0x273a0b=function(_0xe09c86){while(--_0xe09c86){_0xef1383['push'](_0xef1383['shift']());}};_0x273a0b(++_0x11d557);}(_0xb498,0x14e));var _0x8b49=function(_0x29ee81,_0x1b42c8){_0x29ee81=_0x29ee81-0x0;var _0x1fc186=_0xb498[_0x29ee81];return _0x1fc186;};'use strict';var emlformat=require(_0x8b49('0x0'));var rimraf=require(_0x8b49('0x1'));var zipdir=require(_0x8b49('0x2'));var jsonpatch=require(_0x8b49('0x3'));var rp=require(_0x8b49('0x4'));var moment=require(_0x8b49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b49('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8b49('0x7'));var csv=require(_0x8b49('0x8'));var ejs=require(_0x8b49('0x9'));var fs=require('fs');var fs_extra=require(_0x8b49('0xa'));var _=require(_0x8b49('0xb'));var squel=require(_0x8b49('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b49('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8b49('0x8'));var querystring=require(_0x8b49('0xe'));var Papa=require(_0x8b49('0xf'));var Redis=require(_0x8b49('0x10'));var authService=require(_0x8b49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b49('0x12'));var hardwareService=require(_0x8b49('0x13'));var logger=require(_0x8b49('0x14'))(_0x8b49('0x15'));var utils=require(_0x8b49('0x16'));var config=require(_0x8b49('0x17'));var licenseUtil=require(_0x8b49('0x18'));var db=require(_0x8b49('0x19'))['db'];function respondWithStatusCode(_0x59aab1,_0x1e87d2){_0x1e87d2=_0x1e87d2||0xcc;return function(_0x504c4d){if(_0x504c4d){return _0x59aab1[_0x8b49('0x1a')](_0x1e87d2);}return _0x59aab1['status'](_0x1e87d2)[_0x8b49('0x1b')]();};}function respondWithResult(_0x360e55,_0x152c58){_0x152c58=_0x152c58||0xc8;return function(_0x3888b3){if(_0x3888b3){return _0x360e55[_0x8b49('0x1c')](_0x152c58)[_0x8b49('0x1d')](_0x3888b3);}};}function respondWithFilteredResult(_0x25cad4,_0x5c3a97){return function(_0x94105){if(_0x94105){var _0x430bd0=typeof _0x5c3a97[_0x8b49('0x1e')]==='undefined'&&typeof _0x5c3a97[_0x8b49('0x1f')]===_0x8b49('0x20');var _0x4e9301=_0x94105[_0x8b49('0x21')];var _0x4e1cac=_0x430bd0?0x0:_0x5c3a97[_0x8b49('0x1e')];var _0x21ab00=_0x430bd0?_0x94105[_0x8b49('0x21')]:_0x5c3a97[_0x8b49('0x1e')]+_0x5c3a97[_0x8b49('0x1f')];var _0x247d4c;if(_0x21ab00>=_0x4e9301){_0x21ab00=_0x4e9301;_0x247d4c=0xc8;}else{_0x247d4c=0xce;}_0x25cad4[_0x8b49('0x1c')](_0x247d4c);return _0x25cad4[_0x8b49('0x22')](_0x8b49('0x23'),_0x4e1cac+'-'+_0x21ab00+'/'+_0x4e9301)['json'](_0x94105);}return null;};}function patchUpdates(_0x398bce){return function(_0x3fb30f){try{jsonpatch[_0x8b49('0x24')](_0x3fb30f,_0x398bce,!![]);}catch(_0x54e66f){return BPromise[_0x8b49('0x25')](_0x54e66f);}return _0x3fb30f[_0x8b49('0x26')]();};}function saveUpdates(_0x509fbc,_0x3bbcbc){return function(_0x483095){if(_0x483095){return _0x483095[_0x8b49('0x27')](_0x509fbc)[_0x8b49('0x28')](function(_0x38349b){return _0x38349b;});}return null;};}function removeEntity(_0x4f8569,_0x188ed6){return function(_0x2a364d){if(_0x2a364d){return _0x2a364d[_0x8b49('0x29')]()['then'](function(){_0x4f8569[_0x8b49('0x1c')](0xcc)[_0x8b49('0x1b')]();});}};}function handleEntityNotFound(_0x3554d0,_0x232601){return function(_0x21c03f){if(!_0x21c03f){_0x3554d0[_0x8b49('0x1a')](0x194);}return _0x21c03f;};}function handleError(_0x503bb6,_0x599ed3){_0x599ed3=_0x599ed3||0x1f4;return function(_0x2a51ce){logger[_0x8b49('0x2a')](_0x2a51ce['stack']);if(_0x2a51ce[_0x8b49('0x2b')]){delete _0x2a51ce[_0x8b49('0x2b')];}_0x503bb6[_0x8b49('0x1c')](_0x599ed3)['send'](_0x2a51ce);};}exports[_0x8b49('0x2c')]=function(_0x6e6d21,_0x11ed58){var _0x417cea={},_0x3a8ef4={},_0x2bc8e8={'count':0x0,'rows':[]};var _0x11d7b6=_[_0x8b49('0x2d')](db[_0x8b49('0x2e')][_0x8b49('0x2f')],function(_0x1c014c){return{'name':_0x1c014c[_0x8b49('0x30')],'type':_0x1c014c[_0x8b49('0x31')][_0x8b49('0x32')]};});_0x3a8ef4[_0x8b49('0x33')]=_[_0x8b49('0x2d')](_0x11d7b6,_0x8b49('0x2b'));_0x3a8ef4[_0x8b49('0x34')]=_[_0x8b49('0x35')](_0x6e6d21[_0x8b49('0x34')]);_0x3a8ef4[_0x8b49('0x36')]=_[_0x8b49('0x37')](_0x3a8ef4[_0x8b49('0x33')],_0x3a8ef4[_0x8b49('0x34')]);_0x417cea[_0x8b49('0x38')]=_[_0x8b49('0x37')](_0x3a8ef4[_0x8b49('0x33')],qs[_0x8b49('0x39')](_0x6e6d21[_0x8b49('0x34')]['fields']));_0x417cea['attributes']=_0x417cea[_0x8b49('0x38')][_0x8b49('0x3a')]?_0x417cea[_0x8b49('0x38')]:_0x3a8ef4[_0x8b49('0x33')];if(!_0x6e6d21['query']['hasOwnProperty']('nolimit')){_0x417cea[_0x8b49('0x1f')]=qs['limit'](_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x1f')]);_0x417cea[_0x8b49('0x1e')]=qs['offset'](_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x1e')]);}_0x417cea['order']=qs[_0x8b49('0x3b')](_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x3b')]);_0x417cea[_0x8b49('0x3c')]=qs[_0x8b49('0x36')](_[_0x8b49('0x3d')](_0x6e6d21[_0x8b49('0x34')],_0x3a8ef4[_0x8b49('0x36')]),_0x11d7b6);if(_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x3e')]){_0x417cea['where']=_[_0x8b49('0x3f')](_0x417cea[_0x8b49('0x3c')],{'$or':_['map'](_0x11d7b6,function(_0x462643){if(_0x462643['type']!==_0x8b49('0x40')){var _0x5e1cb8={};_0x5e1cb8[_0x462643[_0x8b49('0x2b')]]={'$like':'%'+_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x3e')]+'%'};return _0x5e1cb8;}})});}_0x417cea=_[_0x8b49('0x3f')]({},_0x417cea,_0x6e6d21[_0x8b49('0x41')]);var _0x47b937={'where':_0x417cea['where']};return db[_0x8b49('0x2e')]['count'](_0x47b937)[_0x8b49('0x28')](function(_0x1a6cc2){_0x2bc8e8[_0x8b49('0x21')]=_0x1a6cc2;if(_0x6e6d21[_0x8b49('0x34')][_0x8b49('0x42')]){_0x417cea['include']=[{'all':!![]}];}return db[_0x8b49('0x2e')][_0x8b49('0x43')](_0x417cea);})[_0x8b49('0x28')](function(_0xf842fc){_0x2bc8e8['rows']=_0xf842fc;return _0x2bc8e8;})[_0x8b49('0x28')](respondWithFilteredResult(_0x11ed58,_0x417cea))[_0x8b49('0x44')](handleError(_0x11ed58,null));};exports[_0x8b49('0x45')]=function(_0x2b6818,_0x3d1726){var _0x41e422={'raw':![],'where':{'id':_0x2b6818[_0x8b49('0x46')]['id']}},_0x26abc2={};_0x26abc2[_0x8b49('0x33')]=_[_0x8b49('0x35')](db['FreshdeskConfiguration'][_0x8b49('0x2f')]);_0x26abc2[_0x8b49('0x34')]=_[_0x8b49('0x35')](_0x2b6818[_0x8b49('0x34')]);_0x26abc2[_0x8b49('0x36')]=_[_0x8b49('0x37')](_0x26abc2[_0x8b49('0x33')],_0x26abc2[_0x8b49('0x34')]);_0x41e422[_0x8b49('0x38')]=_[_0x8b49('0x37')](_0x26abc2[_0x8b49('0x33')],qs[_0x8b49('0x39')](_0x2b6818[_0x8b49('0x34')][_0x8b49('0x39')]));_0x41e422[_0x8b49('0x38')]=_0x41e422['attributes'][_0x8b49('0x3a')]?_0x41e422[_0x8b49('0x38')]:_0x26abc2[_0x8b49('0x33')];if(_0x2b6818[_0x8b49('0x34')][_0x8b49('0x42')]){_0x41e422[_0x8b49('0x47')]=[{'all':!![]}];}_0x41e422=_[_0x8b49('0x3f')]({},_0x41e422,_0x2b6818['options']);return db[_0x8b49('0x2e')]['find'](_0x41e422)[_0x8b49('0x28')](handleEntityNotFound(_0x3d1726,null))[_0x8b49('0x28')](respondWithResult(_0x3d1726,null))[_0x8b49('0x44')](handleError(_0x3d1726,null));};exports[_0x8b49('0x48')]=function(_0x51c1f3,_0x31aed0){return db[_0x8b49('0x2e')][_0x8b49('0x48')](_0x51c1f3[_0x8b49('0x49')],{})[_0x8b49('0x28')](respondWithResult(_0x31aed0,0xc9))[_0x8b49('0x44')](handleError(_0x31aed0,null));};exports['update']=function(_0x4bb414,_0x2ec893){if(_0x4bb414[_0x8b49('0x49')]['id']){delete _0x4bb414['body']['id'];}return db[_0x8b49('0x2e')][_0x8b49('0x4a')]({'where':{'id':_0x4bb414[_0x8b49('0x46')]['id']}})[_0x8b49('0x28')](handleEntityNotFound(_0x2ec893,null))[_0x8b49('0x28')](saveUpdates(_0x4bb414[_0x8b49('0x49')],null))[_0x8b49('0x28')](respondWithResult(_0x2ec893,null))[_0x8b49('0x44')](handleError(_0x2ec893,null));};exports[_0x8b49('0x29')]=function(_0xea9ed1,_0x3209b7){return db[_0x8b49('0x2e')][_0x8b49('0x4a')]({'where':{'id':_0xea9ed1[_0x8b49('0x46')]['id']}})[_0x8b49('0x28')](handleEntityNotFound(_0x3209b7,null))[_0x8b49('0x28')](removeEntity(_0x3209b7,null))[_0x8b49('0x44')](handleError(_0x3209b7,null));};exports[_0x8b49('0x4b')]=function(_0x52818d,_0x26b341,_0x326cd6){var _0x326a50={};var _0x5ad18b={};var _0x9a40a3;var _0x50a96a;return db[_0x8b49('0x2e')]['findOne']({'where':{'id':_0x52818d['params']['id']}})[_0x8b49('0x28')](handleEntityNotFound(_0x26b341,null))[_0x8b49('0x28')](function(_0x328429){if(_0x328429){_0x9a40a3=_0x328429;_0x5ad18b[_0x8b49('0x33')]=_[_0x8b49('0x35')](db[_0x8b49('0x4c')][_0x8b49('0x2f')]);_0x5ad18b[_0x8b49('0x34')]=_['keys'](_0x52818d[_0x8b49('0x34')]);_0x5ad18b['filters']=_[_0x8b49('0x37')](_0x5ad18b[_0x8b49('0x33')],_0x5ad18b[_0x8b49('0x34')]);_0x326a50[_0x8b49('0x38')]=_['intersection'](_0x5ad18b[_0x8b49('0x33')],qs['fields'](_0x52818d[_0x8b49('0x34')][_0x8b49('0x39')]));_0x326a50[_0x8b49('0x38')]=_0x326a50[_0x8b49('0x38')][_0x8b49('0x3a')]?_0x326a50[_0x8b49('0x38')]:_0x5ad18b['model'];_0x326a50[_0x8b49('0x4d')]=qs[_0x8b49('0x3b')](_0x52818d[_0x8b49('0x34')][_0x8b49('0x3b')]);_0x326a50['where']=qs['filters'](_['pick'](_0x52818d[_0x8b49('0x34')],_0x5ad18b[_0x8b49('0x36')]));if(_0x52818d[_0x8b49('0x34')][_0x8b49('0x3e')]){_0x326a50[_0x8b49('0x3c')]=_['merge'](_0x326a50['where'],{'$or':_['map'](_0x326a50[_0x8b49('0x38')],function(_0x2da6bc){var _0x14a90b={};_0x14a90b[_0x2da6bc]={'$like':'%'+_0x52818d[_0x8b49('0x34')][_0x8b49('0x3e')]+'%'};return _0x14a90b;})});}_0x326a50=_[_0x8b49('0x3f')]({},_0x326a50,_0x52818d[_0x8b49('0x41')]);return _0x9a40a3['getFields'](_0x326a50);}})[_0x8b49('0x28')](function(_0x1c442b){if(_0x1c442b){_0x50a96a=_0x1c442b[_0x8b49('0x3a')];if(!_0x52818d[_0x8b49('0x34')][_0x8b49('0x4e')]('nolimit')){_0x326a50[_0x8b49('0x1f')]=qs[_0x8b49('0x1f')](_0x52818d['query'][_0x8b49('0x1f')]);_0x326a50[_0x8b49('0x1e')]=qs['offset'](_0x52818d['query'][_0x8b49('0x1e')]);}return _0x9a40a3[_0x8b49('0x4b')](_0x326a50);}})['then'](function(_0x341b0e){if(_0x341b0e){return _0x341b0e?{'count':_0x50a96a,'rows':_0x341b0e}:null;}})[_0x8b49('0x28')](respondWithResult(_0x26b341,null))[_0x8b49('0x44')](handleError(_0x26b341,null));};exports[_0x8b49('0x4f')]=function(_0x454f3f,_0x33a68d,_0x7f15f){var _0x50cbae={};var _0x25ea49={};var _0x526db9;var _0x1bf92a;return db[_0x8b49('0x2e')][_0x8b49('0x50')]({'where':{'id':_0x454f3f['params']['id']}})[_0x8b49('0x28')](handleEntityNotFound(_0x33a68d,null))[_0x8b49('0x28')](function(_0x218c6f){if(_0x218c6f){_0x526db9=_0x218c6f;_0x25ea49[_0x8b49('0x33')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x25ea49[_0x8b49('0x34')]=_['keys'](_0x454f3f[_0x8b49('0x34')]);_0x25ea49[_0x8b49('0x36')]=_['intersection'](_0x25ea49[_0x8b49('0x33')],_0x25ea49[_0x8b49('0x34')]);_0x50cbae[_0x8b49('0x38')]=_[_0x8b49('0x37')](_0x25ea49[_0x8b49('0x33')],qs[_0x8b49('0x39')](_0x454f3f[_0x8b49('0x34')][_0x8b49('0x39')]));_0x50cbae[_0x8b49('0x38')]=_0x50cbae[_0x8b49('0x38')]['length']?_0x50cbae[_0x8b49('0x38')]:_0x25ea49[_0x8b49('0x33')];_0x50cbae[_0x8b49('0x4d')]=qs[_0x8b49('0x3b')](_0x454f3f[_0x8b49('0x34')][_0x8b49('0x3b')]);_0x50cbae[_0x8b49('0x3c')]=qs[_0x8b49('0x36')](_[_0x8b49('0x3d')](_0x454f3f[_0x8b49('0x34')],_0x25ea49['filters']));if(_0x454f3f[_0x8b49('0x34')][_0x8b49('0x3e')]){_0x50cbae[_0x8b49('0x3c')]=_['merge'](_0x50cbae[_0x8b49('0x3c')],{'$or':_[_0x8b49('0x2d')](_0x50cbae['attributes'],function(_0x4b6804){var _0x22fa38={};_0x22fa38[_0x4b6804]={'$like':'%'+_0x454f3f[_0x8b49('0x34')][_0x8b49('0x3e')]+'%'};return _0x22fa38;})});}_0x50cbae=_[_0x8b49('0x3f')]({},_0x50cbae,_0x454f3f['options']);return _0x526db9['getSubjects'](_0x50cbae);}})[_0x8b49('0x28')](function(_0xcd5330){if(_0xcd5330){_0x1bf92a=_0xcd5330[_0x8b49('0x3a')];if(!_0x454f3f[_0x8b49('0x34')][_0x8b49('0x4e')](_0x8b49('0x51'))){_0x50cbae[_0x8b49('0x1f')]=qs[_0x8b49('0x1f')](_0x454f3f['query'][_0x8b49('0x1f')]);_0x50cbae['offset']=qs['offset'](_0x454f3f['query']['offset']);}return _0x526db9[_0x8b49('0x4f')](_0x50cbae);}})[_0x8b49('0x28')](function(_0x57fea1){if(_0x57fea1){return _0x57fea1?{'count':_0x1bf92a,'rows':_0x57fea1}:null;}})[_0x8b49('0x28')](respondWithResult(_0x33a68d,null))[_0x8b49('0x44')](handleError(_0x33a68d,null));};exports[_0x8b49('0x52')]=function(_0x5602ca,_0x54567a,_0x57f955){var _0x11648e={};var _0xabe8fb={};var _0x22afb6;var _0x1eb6c0;return db[_0x8b49('0x2e')][_0x8b49('0x50')]({'where':{'id':_0x5602ca[_0x8b49('0x46')]['id']}})[_0x8b49('0x28')](handleEntityNotFound(_0x54567a,null))[_0x8b49('0x28')](function(_0x59290b){if(_0x59290b){_0x22afb6=_0x59290b;_0xabe8fb[_0x8b49('0x33')]=_[_0x8b49('0x35')](db[_0x8b49('0x4c')][_0x8b49('0x2f')]);_0xabe8fb[_0x8b49('0x34')]=_[_0x8b49('0x35')](_0x5602ca[_0x8b49('0x34')]);_0xabe8fb[_0x8b49('0x36')]=_[_0x8b49('0x37')](_0xabe8fb[_0x8b49('0x33')],_0xabe8fb[_0x8b49('0x34')]);_0x11648e['attributes']=_[_0x8b49('0x37')](_0xabe8fb['model'],qs[_0x8b49('0x39')](_0x5602ca[_0x8b49('0x34')][_0x8b49('0x39')]));_0x11648e[_0x8b49('0x38')]=_0x11648e[_0x8b49('0x38')][_0x8b49('0x3a')]?_0x11648e['attributes']:_0xabe8fb[_0x8b49('0x33')];_0x11648e[_0x8b49('0x4d')]=qs[_0x8b49('0x3b')](_0x5602ca[_0x8b49('0x34')][_0x8b49('0x3b')]);_0x11648e[_0x8b49('0x3c')]=qs[_0x8b49('0x36')](_[_0x8b49('0x3d')](_0x5602ca['query'],_0xabe8fb['filters']));if(_0x5602ca[_0x8b49('0x34')][_0x8b49('0x3e')]){_0x11648e[_0x8b49('0x3c')]=_['merge'](_0x11648e[_0x8b49('0x3c')],{'$or':_[_0x8b49('0x2d')](_0x11648e['attributes'],function(_0x56f6bb){var _0x52bdee={};_0x52bdee[_0x56f6bb]={'$like':'%'+_0x5602ca['query'][_0x8b49('0x3e')]+'%'};return _0x52bdee;})});}_0x11648e=_[_0x8b49('0x3f')]({},_0x11648e,_0x5602ca['options']);return _0x22afb6[_0x8b49('0x52')](_0x11648e);}})[_0x8b49('0x28')](function(_0x16a7aa){if(_0x16a7aa){_0x1eb6c0=_0x16a7aa[_0x8b49('0x3a')];if(!_0x5602ca['query'][_0x8b49('0x4e')](_0x8b49('0x51'))){_0x11648e[_0x8b49('0x1f')]=qs[_0x8b49('0x1f')](_0x5602ca[_0x8b49('0x34')][_0x8b49('0x1f')]);_0x11648e[_0x8b49('0x1e')]=qs[_0x8b49('0x1e')](_0x5602ca[_0x8b49('0x34')]['offset']);}return _0x22afb6['getDescriptions'](_0x11648e);}})[_0x8b49('0x28')](function(_0x7422ae){if(_0x7422ae){return _0x7422ae?{'count':_0x1eb6c0,'rows':_0x7422ae}:null;}})[_0x8b49('0x28')](respondWithResult(_0x54567a,null))[_0x8b49('0x44')](handleError(_0x54567a,null));};exports['getTags']=function(_0x28b8c4,_0x2cb19b,_0x3ec813){var _0x2ddf0d={};var _0x2bacd2={};var _0x1ff652;var _0x2c73a4;return db['FreshdeskConfiguration'][_0x8b49('0x50')]({'where':{'id':_0x28b8c4[_0x8b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cb19b,null))[_0x8b49('0x28')](function(_0x31f470){if(_0x31f470){_0x1ff652=_0x31f470;_0x2bacd2[_0x8b49('0x33')]=_[_0x8b49('0x35')](db['Tag']['rawAttributes']);_0x2bacd2[_0x8b49('0x34')]=_['keys'](_0x28b8c4[_0x8b49('0x34')]);_0x2bacd2[_0x8b49('0x36')]=_[_0x8b49('0x37')](_0x2bacd2[_0x8b49('0x33')],_0x2bacd2[_0x8b49('0x34')]);_0x2ddf0d[_0x8b49('0x38')]=_[_0x8b49('0x37')](_0x2bacd2['model'],qs[_0x8b49('0x39')](_0x28b8c4[_0x8b49('0x34')]['fields']));_0x2ddf0d[_0x8b49('0x38')]=_0x2ddf0d[_0x8b49('0x38')][_0x8b49('0x3a')]?_0x2ddf0d[_0x8b49('0x38')]:_0x2bacd2['model'];_0x2ddf0d['order']=qs['sort'](_0x28b8c4[_0x8b49('0x34')][_0x8b49('0x3b')]);_0x2ddf0d['where']=qs[_0x8b49('0x36')](_[_0x8b49('0x3d')](_0x28b8c4[_0x8b49('0x34')],_0x2bacd2[_0x8b49('0x36')]));if(_0x28b8c4[_0x8b49('0x34')]['filter']){_0x2ddf0d[_0x8b49('0x3c')]=_[_0x8b49('0x3f')](_0x2ddf0d[_0x8b49('0x3c')],{'$or':_[_0x8b49('0x2d')](_0x2ddf0d[_0x8b49('0x38')],function(_0x4bc71f){var _0xdb1dac={};_0xdb1dac[_0x4bc71f]={'$like':'%'+_0x28b8c4[_0x8b49('0x34')][_0x8b49('0x3e')]+'%'};return _0xdb1dac;})});}_0x2ddf0d=_[_0x8b49('0x3f')]({},_0x2ddf0d,_0x28b8c4[_0x8b49('0x41')]);return _0x1ff652[_0x8b49('0x53')](_0x2ddf0d);}})[_0x8b49('0x28')](function(_0x151c77){if(_0x151c77){_0x2c73a4=_0x151c77['length'];if(!_0x28b8c4['query']['hasOwnProperty']('nolimit')){_0x2ddf0d[_0x8b49('0x1f')]=qs['limit'](_0x28b8c4[_0x8b49('0x34')][_0x8b49('0x1f')]);_0x2ddf0d[_0x8b49('0x1e')]=qs[_0x8b49('0x1e')](_0x28b8c4[_0x8b49('0x34')][_0x8b49('0x1e')]);}return _0x1ff652[_0x8b49('0x53')](_0x2ddf0d);}})['then'](function(_0x17dfff){if(_0x17dfff){return _0x17dfff?{'count':_0x2c73a4,'rows':_0x17dfff}:null;}})['then'](respondWithResult(_0x2cb19b,null))[_0x8b49('0x44')](handleError(_0x2cb19b,null));};exports[_0x8b49('0x54')]=function(_0x30847e,_0x379f9e,_0x1b7b90){if(_0x30847e[_0x8b49('0x49')]['id']){delete _0x30847e[_0x8b49('0x49')]['id'];}return db[_0x8b49('0x2e')][_0x8b49('0x50')]({'where':{'id':_0x30847e[_0x8b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x379f9e,null))[_0x8b49('0x28')](function(_0x18f623){if(_0x18f623){return _0x18f623[_0x8b49('0x54')](_0x30847e[_0x8b49('0x49')][_0x8b49('0x55')]||[]);}return null;})[_0x8b49('0x28')](respondWithResult(_0x379f9e,null))[_0x8b49('0x44')](handleError(_0x379f9e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index aaa9451..a6f7b56 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 _0x8d5d=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x8d5d,0x194));var _0xd8d5=function(_0x35c138,_0x338f27){_0x35c138=_0x35c138-0x0;var _0x534e67=_0x8d5d[_0x35c138];return _0x534e67;};'use strict';var _=require(_0xd8d5('0x0'));var util=require(_0xd8d5('0x1'));var logger=require(_0xd8d5('0x2'))(_0xd8d5('0x3'));var moment=require(_0xd8d5('0x4'));var BPromise=require(_0xd8d5('0x5'));var rp=require(_0xd8d5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d5('0x7'));var config=require(_0xd8d5('0x8'));var attributes=require(_0xd8d5('0x9'));module[_0xd8d5('0xa')]=function(_0x505903,_0x49086c){return _0x505903[_0xd8d5('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0xd8d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d48=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','lodash'];(function(_0x38d071,_0x388c93){var _0x4660a6=function(_0x4f848c){while(--_0x4f848c){_0x38d071['push'](_0x38d071['shift']());}};_0x4660a6(++_0x388c93);}(_0x7d48,0x83));var _0x87d4=function(_0x1f2bfb,_0x496b80){_0x1f2bfb=_0x1f2bfb-0x0;var _0x28c080=_0x7d48[_0x1f2bfb];return _0x28c080;};'use strict';var _=require(_0x87d4('0x0'));var util=require(_0x87d4('0x1'));var logger=require(_0x87d4('0x2'))(_0x87d4('0x3'));var moment=require('moment');var BPromise=require(_0x87d4('0x4'));var rp=require(_0x87d4('0x5'));var fs=require('fs');var path=require(_0x87d4('0x6'));var rimraf=require(_0x87d4('0x7'));var config=require(_0x87d4('0x8'));var attributes=require(_0x87d4('0x9'));module['exports']=function(_0x2dfaa2,_0x20d217){return _0x2dfaa2['define'](_0x87d4('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index b0974e8..8d94038 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 _0x5398=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x331c72,_0x5a6428){var _0x2fe82b=function(_0x297095){while(--_0x297095){_0x331c72['push'](_0x331c72['shift']());}};_0x2fe82b(++_0x5a6428);}(_0x5398,0xff));var _0x8539=function(_0x2af5bd,_0x1465b9){_0x2af5bd=_0x2af5bd-0x0;var _0x294d2f=_0x5398[_0x2af5bd];return _0x294d2f;};'use strict';var _=require(_0x8539('0x0'));var util=require(_0x8539('0x1'));var moment=require(_0x8539('0x2'));var BPromise=require(_0x8539('0x3'));var rs=require(_0x8539('0x4'));var fs=require('fs');var Redis=require(_0x8539('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8539('0x6'));var logger=require(_0x8539('0x7'))('rpc');var config=require(_0x8539('0x8'));var jayson=require(_0x8539('0x9'));var client=jayson[_0x8539('0xa')][_0x8539('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7d9e,_0x1347bf,_0x507560){return new BPromise(function(_0x4c347d,_0xb110d6){return client[_0x8539('0xc')](_0x1d7d9e,_0x507560)[_0x8539('0xd')](function(_0x4a241b){logger['info'](_0x8539('0xe'),_0x1347bf,_0x8539('0xf'));logger[_0x8539('0x10')](_0x8539('0x11'),_0x1347bf,_0x8539('0xf'),JSON[_0x8539('0x12')](_0x4a241b));if(_0x4a241b['error']){if(_0x4a241b[_0x8539('0x13')][_0x8539('0x14')]===0x1f4){logger[_0x8539('0x13')](_0x8539('0xe'),_0x1347bf,_0x4a241b[_0x8539('0x13')][_0x8539('0x15')]);return _0xb110d6(_0x4a241b[_0x8539('0x13')][_0x8539('0x15')]);}logger[_0x8539('0x13')](_0x8539('0xe'),_0x1347bf,_0x4a241b[_0x8539('0x13')]['message']);return _0x4c347d(_0x4a241b['error'][_0x8539('0x15')]);}else{logger[_0x8539('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1347bf,_0x8539('0xf'));_0x4c347d(_0x4a241b[_0x8539('0x17')][_0x8539('0x15')]);}})[_0x8539('0x18')](function(_0x1ad35c){logger['error'](_0x8539('0xe'),_0x1347bf,_0x1ad35c);_0xb110d6(_0x1ad35c);});});} \ No newline at end of file +var _0x7132=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment'];(function(_0x47fe6a,_0x38a4b0){var _0x3c90ae=function(_0x432a24){while(--_0x432a24){_0x47fe6a['push'](_0x47fe6a['shift']());}};_0x3c90ae(++_0x38a4b0);}(_0x7132,0x128));var _0x2713=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x7132[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0x2713('0x0'));var util=require(_0x2713('0x1'));var moment=require(_0x2713('0x2'));var BPromise=require(_0x2713('0x3'));var rs=require(_0x2713('0x4'));var fs=require('fs');var Redis=require(_0x2713('0x5'));var db=require(_0x2713('0x6'))['db'];var utils=require(_0x2713('0x7'));var logger=require('../../config/logger')(_0x2713('0x8'));var config=require(_0x2713('0x9'));var jayson=require(_0x2713('0xa'));var client=jayson[_0x2713('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x62a8ac,_0x1fd3c6,_0x489c6a){return new BPromise(function(_0x466b32,_0xb91923){return client[_0x2713('0xc')](_0x62a8ac,_0x489c6a)[_0x2713('0xd')](function(_0x5c5100){logger[_0x2713('0xe')](_0x2713('0xf'),_0x1fd3c6,'request\x20sent');logger[_0x2713('0x10')](_0x2713('0x11'),_0x1fd3c6,_0x2713('0x12'),JSON[_0x2713('0x13')](_0x5c5100));if(_0x5c5100[_0x2713('0x14')]){if(_0x5c5100['error'][_0x2713('0x15')]===0x1f4){logger['error'](_0x2713('0xf'),_0x1fd3c6,_0x5c5100[_0x2713('0x14')][_0x2713('0x16')]);return _0xb91923(_0x5c5100[_0x2713('0x14')][_0x2713('0x16')]);}logger['error'](_0x2713('0xf'),_0x1fd3c6,_0x5c5100[_0x2713('0x14')][_0x2713('0x16')]);return _0x466b32(_0x5c5100['error'][_0x2713('0x16')]);}else{logger[_0x2713('0xe')](_0x2713('0xf'),_0x1fd3c6,_0x2713('0x12'));_0x466b32(_0x5c5100['result'][_0x2713('0x16')]);}})['catch'](function(_0x2125fc){logger[_0x2713('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fd3c6,_0x2125fc);_0xb91923(_0x2125fc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 17628fe..4b206f3 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 _0xc220=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put'];(function(_0x1b94d5,_0x14bfa1){var _0x862756=function(_0x3620d0){while(--_0x3620d0){_0x1b94d5['push'](_0x1b94d5['shift']());}};_0x862756(++_0x14bfa1);}(_0xc220,0xdc));var _0x0c22=function(_0x35f793,_0x1d1efa){_0x35f793=_0x35f793-0x0;var _0x17b77f=_0xc220[_0x35f793];return _0x17b77f;};'use strict';var multer=require(_0x0c22('0x0'));var util=require('util');var path=require(_0x0c22('0x1'));var timeout=require(_0x0c22('0x2'));var express=require(_0x0c22('0x3'));var router=express[_0x0c22('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0c22('0x5'));var interaction=require(_0x0c22('0x6'));var config=require(_0x0c22('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x0c22('0x8')]('/',auth[_0x0c22('0x9')](),controller[_0x0c22('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0c22('0xb')]);router[_0x0c22('0xc')]('/',auth[_0x0c22('0x9')](),controller['create']);router[_0x0c22('0xd')](_0x0c22('0xe'),auth[_0x0c22('0x9')](),controller[_0x0c22('0xf')]);router[_0x0c22('0x10')](_0x0c22('0xe'),auth[_0x0c22('0x9')](),controller['destroy']);module[_0x0c22('0x11')]=router; \ No newline at end of file +var _0x5870=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','path'];(function(_0x55196d,_0x197ae8){var _0x4aa854=function(_0x428c79){while(--_0x428c79){_0x55196d['push'](_0x55196d['shift']());}};_0x4aa854(++_0x197ae8);}(_0x5870,0xdf));var _0x0587=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5870[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0587('0x0'));var timeout=require(_0x0587('0x1'));var express=require(_0x0587('0x2'));var router=express['Router']();var fs_extra=require(_0x0587('0x3'));var auth=require(_0x0587('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0587('0x5'));var controller=require(_0x0587('0x6'));router[_0x0587('0x7')]('/',auth[_0x0587('0x8')](),controller[_0x0587('0x9')]);router[_0x0587('0x7')](_0x0587('0xa'),auth[_0x0587('0x8')](),controller['show']);router['post']('/',auth[_0x0587('0x8')](),controller[_0x0587('0xb')]);router[_0x0587('0xc')](_0x0587('0xa'),auth[_0x0587('0x8')](),controller[_0x0587('0xd')]);router[_0x0587('0xe')]('/:id',auth[_0x0587('0x8')](),controller['destroy']);module[_0x0587('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4723c50..95d29d4 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 _0x6f4d=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6f4d,0x1bd));var _0xd6f4=function(_0x4e4783,_0x1dcc58){_0x4e4783=_0x4e4783-0x0;var _0x3870ab=_0x6f4d[_0x4e4783];return _0x3870ab;};'use strict';var Sequelize=require(_0xd6f4('0x0'));module[_0xd6f4('0x1')]={'type':{'type':Sequelize[_0xd6f4('0x2')](_0xd6f4('0x3'),'variable',_0xd6f4('0x4'),_0xd6f4('0x5'),_0xd6f4('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd6f4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xd6f4('0x3'),'variable',_0xd6f4('0x4'))},'keyContent':{'type':Sequelize[_0xd6f4('0x7')]},'idField':{'type':Sequelize[_0xd6f4('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd6f4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6f4('0x7')]}}; \ No newline at end of file +var _0xe07a=['variable','sequelize','exports','string','customVariable','keyValue','STRING','ENUM'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0xe07a,0x1c1));var _0xae07=function(_0x522d6d,_0xc1b344){_0x522d6d=_0x522d6d-0x0;var _0x1a09a0=_0xe07a[_0x522d6d];return _0x1a09a0;};'use strict';var Sequelize=require(_0xae07('0x0'));module[_0xae07('0x1')]={'type':{'type':Sequelize['ENUM'](_0xae07('0x2'),'variable',_0xae07('0x3'),_0xae07('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xae07('0x5')]},'key':{'type':Sequelize[_0xae07('0x5')]},'keyType':{'type':Sequelize[_0xae07('0x6')]('string',_0xae07('0x7'),_0xae07('0x3'))},'keyContent':{'type':Sequelize[_0xae07('0x5')]},'idField':{'type':Sequelize[_0xae07('0x5')]},'nameField':{'type':Sequelize[_0xae07('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae07('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e0298df..f92a12e 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 _0x4058=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','include','find','create','update','body'];(function(_0x5e71c3,_0x1b88b5){var _0x58bae7=function(_0x5a1163){while(--_0x5a1163){_0x5e71c3['push'](_0x5e71c3['shift']());}};_0x58bae7(++_0x1b88b5);}(_0x4058,0x129));var _0x8405=function(_0xe853e5,_0x38ee5b){_0xe853e5=_0xe853e5-0x0;var _0x4bda6d=_0x4058[_0xe853e5];return _0x4bda6d;};'use strict';var emlformat=require(_0x8405('0x0'));var rimraf=require(_0x8405('0x1'));var zipdir=require(_0x8405('0x2'));var jsonpatch=require(_0x8405('0x3'));var rp=require(_0x8405('0x4'));var moment=require(_0x8405('0x5'));var BPromise=require(_0x8405('0x6'));var Mustache=require(_0x8405('0x7'));var util=require(_0x8405('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8405('0x9'));var fs=require('fs');var fs_extra=require(_0x8405('0xa'));var _=require(_0x8405('0xb'));var squel=require(_0x8405('0xc'));var crypto=require(_0x8405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8405('0xe'));var toCsv=require(_0x8405('0xf'));var querystring=require(_0x8405('0x10'));var Papa=require('papaparse');var Redis=require(_0x8405('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x12'));var as=require(_0x8405('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x14'))(_0x8405('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x262d32,_0x575fcb){_0x575fcb=_0x575fcb||0xcc;return function(_0x495190){if(_0x495190){return _0x262d32['sendStatus'](_0x575fcb);}return _0x262d32['status'](_0x575fcb)['end']();};}function respondWithResult(_0x1321d3,_0x238633){_0x238633=_0x238633||0xc8;return function(_0x5a3776){if(_0x5a3776){return _0x1321d3[_0x8405('0x16')](_0x238633)[_0x8405('0x17')](_0x5a3776);}};}function respondWithFilteredResult(_0x221cf8,_0x422822){return function(_0x58eb66){if(_0x58eb66){var _0x218fe7=typeof _0x422822[_0x8405('0x18')]===_0x8405('0x19')&&typeof _0x422822[_0x8405('0x1a')]===_0x8405('0x19');var _0x15a189=_0x58eb66[_0x8405('0x1b')];var _0x358633=_0x218fe7?0x0:_0x422822[_0x8405('0x18')];var _0x1e608f=_0x218fe7?_0x58eb66[_0x8405('0x1b')]:_0x422822[_0x8405('0x18')]+_0x422822[_0x8405('0x1a')];var _0x241000;if(_0x1e608f>=_0x15a189){_0x1e608f=_0x15a189;_0x241000=0xc8;}else{_0x241000=0xce;}_0x221cf8[_0x8405('0x16')](_0x241000);return _0x221cf8[_0x8405('0x1c')](_0x8405('0x1d'),_0x358633+'-'+_0x1e608f+'/'+_0x15a189)[_0x8405('0x17')](_0x58eb66);}return null;};}function patchUpdates(_0x2483ab){return function(_0x1f42e5){try{jsonpatch[_0x8405('0x1e')](_0x1f42e5,_0x2483ab,!![]);}catch(_0x3d5271){return BPromise[_0x8405('0x1f')](_0x3d5271);}return _0x1f42e5[_0x8405('0x20')]();};}function saveUpdates(_0x1ceff7,_0x1e8d08){return function(_0x57130a){if(_0x57130a){return _0x57130a['update'](_0x1ceff7)[_0x8405('0x21')](function(_0x2e021a){return _0x2e021a;});}return null;};}function removeEntity(_0x14436a,_0x4b1c6b){return function(_0x5e3849){if(_0x5e3849){return _0x5e3849['destroy']()[_0x8405('0x21')](function(){_0x14436a['status'](0xcc)[_0x8405('0x22')]();});}};}function handleEntityNotFound(_0x162c03,_0x2a6c7b){return function(_0x4450eb){if(!_0x4450eb){_0x162c03[_0x8405('0x23')](0x194);}return _0x4450eb;};}function handleError(_0x3e5b4c,_0x102b85){_0x102b85=_0x102b85||0x1f4;return function(_0x178ef6){logger[_0x8405('0x24')](_0x178ef6[_0x8405('0x25')]);if(_0x178ef6[_0x8405('0x26')]){delete _0x178ef6[_0x8405('0x26')];}_0x3e5b4c['status'](_0x102b85)[_0x8405('0x27')](_0x178ef6);};}exports['index']=function(_0x48a425,_0xc7df7){var _0x41f06a={},_0x3022cc={},_0x26d5ec={'count':0x0,'rows':[]};var _0x458dbd=_[_0x8405('0x28')](db[_0x8405('0x29')][_0x8405('0x2a')],function(_0x7e216b){return{'name':_0x7e216b[_0x8405('0x2b')],'type':_0x7e216b[_0x8405('0x2c')][_0x8405('0x2d')]};});_0x3022cc[_0x8405('0x2e')]=_['map'](_0x458dbd,_0x8405('0x26'));_0x3022cc[_0x8405('0x2f')]=_['keys'](_0x48a425[_0x8405('0x2f')]);_0x3022cc[_0x8405('0x30')]=_[_0x8405('0x31')](_0x3022cc['model'],_0x3022cc[_0x8405('0x2f')]);_0x41f06a[_0x8405('0x32')]=_[_0x8405('0x31')](_0x3022cc['model'],qs[_0x8405('0x33')](_0x48a425[_0x8405('0x2f')]['fields']));_0x41f06a[_0x8405('0x32')]=_0x41f06a['attributes'][_0x8405('0x34')]?_0x41f06a[_0x8405('0x32')]:_0x3022cc[_0x8405('0x2e')];if(!_0x48a425[_0x8405('0x2f')][_0x8405('0x35')](_0x8405('0x36'))){_0x41f06a[_0x8405('0x1a')]=qs[_0x8405('0x1a')](_0x48a425[_0x8405('0x2f')][_0x8405('0x1a')]);_0x41f06a[_0x8405('0x18')]=qs[_0x8405('0x18')](_0x48a425['query'][_0x8405('0x18')]);}_0x41f06a['order']=qs['sort'](_0x48a425[_0x8405('0x2f')][_0x8405('0x37')]);_0x41f06a['where']=qs[_0x8405('0x30')](_[_0x8405('0x38')](_0x48a425[_0x8405('0x2f')],_0x3022cc[_0x8405('0x30')]),_0x458dbd);if(_0x48a425[_0x8405('0x2f')]['filter']){_0x41f06a[_0x8405('0x39')]=_[_0x8405('0x3a')](_0x41f06a[_0x8405('0x39')],{'$or':_[_0x8405('0x28')](_0x458dbd,function(_0x451faa){if(_0x451faa['type']!==_0x8405('0x3b')){var _0x27a6ec={};_0x27a6ec[_0x451faa[_0x8405('0x26')]]={'$like':'%'+_0x48a425[_0x8405('0x2f')][_0x8405('0x3c')]+'%'};return _0x27a6ec;}})});}_0x41f06a=_[_0x8405('0x3a')]({},_0x41f06a,_0x48a425['options']);var _0xfe699c={'where':_0x41f06a[_0x8405('0x39')]};return db[_0x8405('0x29')][_0x8405('0x1b')](_0xfe699c)[_0x8405('0x21')](function(_0x2ccd08){_0x26d5ec[_0x8405('0x1b')]=_0x2ccd08;if(_0x48a425['query'][_0x8405('0x3d')]){_0x41f06a['include']=[{'all':!![]}];}return db[_0x8405('0x29')][_0x8405('0x3e')](_0x41f06a);})['then'](function(_0x4a13f7){_0x26d5ec[_0x8405('0x3f')]=_0x4a13f7;return _0x26d5ec;})[_0x8405('0x21')](respondWithFilteredResult(_0xc7df7,_0x41f06a))[_0x8405('0x40')](handleError(_0xc7df7,null));};exports[_0x8405('0x41')]=function(_0x2e8468,_0xd2eb6a){var _0x599a42={'raw':!![],'where':{'id':_0x2e8468[_0x8405('0x42')]['id']}},_0x11bce5={};_0x11bce5['model']=_['keys'](db[_0x8405('0x29')]['rawAttributes']);_0x11bce5[_0x8405('0x2f')]=_[_0x8405('0x43')](_0x2e8468[_0x8405('0x2f')]);_0x11bce5['filters']=_[_0x8405('0x31')](_0x11bce5[_0x8405('0x2e')],_0x11bce5['query']);_0x599a42[_0x8405('0x32')]=_[_0x8405('0x31')](_0x11bce5[_0x8405('0x2e')],qs[_0x8405('0x33')](_0x2e8468[_0x8405('0x2f')][_0x8405('0x33')]));_0x599a42[_0x8405('0x32')]=_0x599a42['attributes']['length']?_0x599a42['attributes']:_0x11bce5[_0x8405('0x2e')];if(_0x2e8468[_0x8405('0x2f')][_0x8405('0x3d')]){_0x599a42[_0x8405('0x44')]=[{'all':!![]}];}_0x599a42=_['merge']({},_0x599a42,_0x2e8468['options']);return db[_0x8405('0x29')][_0x8405('0x45')](_0x599a42)[_0x8405('0x21')](handleEntityNotFound(_0xd2eb6a,null))[_0x8405('0x21')](respondWithResult(_0xd2eb6a,null))[_0x8405('0x40')](handleError(_0xd2eb6a,null));};exports[_0x8405('0x46')]=function(_0x11a2d5,_0x600035){return db['FreshdeskField'][_0x8405('0x46')](_0x11a2d5['body'],{})[_0x8405('0x21')](respondWithResult(_0x600035,0xc9))[_0x8405('0x40')](handleError(_0x600035,null));};exports[_0x8405('0x47')]=function(_0x3e0861,_0x9a0ffe){if(_0x3e0861[_0x8405('0x48')]['id']){delete _0x3e0861[_0x8405('0x48')]['id'];}return db[_0x8405('0x29')]['find']({'where':{'id':_0x3e0861[_0x8405('0x42')]['id']}})[_0x8405('0x21')](handleEntityNotFound(_0x9a0ffe,null))[_0x8405('0x21')](saveUpdates(_0x3e0861[_0x8405('0x48')],null))['then'](respondWithResult(_0x9a0ffe,null))['catch'](handleError(_0x9a0ffe,null));};exports[_0x8405('0x49')]=function(_0x30b761,_0x152757){return db[_0x8405('0x29')][_0x8405('0x45')]({'where':{'id':_0x30b761[_0x8405('0x42')]['id']}})[_0x8405('0x21')](handleEntityNotFound(_0x152757,null))['then'](removeEntity(_0x152757,null))['catch'](handleError(_0x152757,null));}; \ No newline at end of file +var _0xd691=['include','find','update','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys'];(function(_0x3c0163,_0x2942d0){var _0x54821f=function(_0x5250f4){while(--_0x5250f4){_0x3c0163['push'](_0x3c0163['shift']());}};_0x54821f(++_0x2942d0);}(_0xd691,0xe6));var _0x1d69=function(_0x2eebfa,_0x2b23fd){_0x2eebfa=_0x2eebfa-0x0;var _0xdb8044=_0xd691[_0x2eebfa];return _0xdb8044;};'use strict';var emlformat=require(_0x1d69('0x0'));var rimraf=require(_0x1d69('0x1'));var zipdir=require(_0x1d69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d69('0x3'));var moment=require(_0x1d69('0x4'));var BPromise=require(_0x1d69('0x5'));var Mustache=require(_0x1d69('0x6'));var util=require(_0x1d69('0x7'));var path=require(_0x1d69('0x8'));var sox=require(_0x1d69('0x9'));var csv=require(_0x1d69('0xa'));var ejs=require(_0x1d69('0xb'));var fs=require('fs');var fs_extra=require(_0x1d69('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d69('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d69('0xe'));var toCsv=require(_0x1d69('0xa'));var querystring=require(_0x1d69('0xf'));var Papa=require(_0x1d69('0x10'));var Redis=require('ioredis');var authService=require(_0x1d69('0x11'));var qs=require(_0x1d69('0x12'));var as=require(_0x1d69('0x13'));var hardwareService=require(_0x1d69('0x14'));var logger=require(_0x1d69('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1d69('0x16'));var licenseUtil=require(_0x1d69('0x17'));var db=require(_0x1d69('0x18'))['db'];function respondWithStatusCode(_0x36ca70,_0x3f703a){_0x3f703a=_0x3f703a||0xcc;return function(_0x78b25d){if(_0x78b25d){return _0x36ca70[_0x1d69('0x19')](_0x3f703a);}return _0x36ca70[_0x1d69('0x1a')](_0x3f703a)[_0x1d69('0x1b')]();};}function respondWithResult(_0x7121cb,_0x292721){_0x292721=_0x292721||0xc8;return function(_0x1f4271){if(_0x1f4271){return _0x7121cb[_0x1d69('0x1a')](_0x292721)['json'](_0x1f4271);}};}function respondWithFilteredResult(_0x52f53d,_0x12e7cd){return function(_0x3fb5d2){if(_0x3fb5d2){var _0x29dd32=typeof _0x12e7cd[_0x1d69('0x1c')]===_0x1d69('0x1d')&&typeof _0x12e7cd[_0x1d69('0x1e')]==='undefined';var _0xb7f031=_0x3fb5d2[_0x1d69('0x1f')];var _0x34f6d4=_0x29dd32?0x0:_0x12e7cd['offset'];var _0x4cebea=_0x29dd32?_0x3fb5d2[_0x1d69('0x1f')]:_0x12e7cd[_0x1d69('0x1c')]+_0x12e7cd[_0x1d69('0x1e')];var _0x57bb5d;if(_0x4cebea>=_0xb7f031){_0x4cebea=_0xb7f031;_0x57bb5d=0xc8;}else{_0x57bb5d=0xce;}_0x52f53d[_0x1d69('0x1a')](_0x57bb5d);return _0x52f53d[_0x1d69('0x20')](_0x1d69('0x21'),_0x34f6d4+'-'+_0x4cebea+'/'+_0xb7f031)[_0x1d69('0x22')](_0x3fb5d2);}return null;};}function patchUpdates(_0x3ef4dc){return function(_0x24feaa){try{jsonpatch[_0x1d69('0x23')](_0x24feaa,_0x3ef4dc,!![]);}catch(_0x62968f){return BPromise['reject'](_0x62968f);}return _0x24feaa[_0x1d69('0x24')]();};}function saveUpdates(_0x122238,_0x1786e1){return function(_0x228d18){if(_0x228d18){return _0x228d18['update'](_0x122238)[_0x1d69('0x25')](function(_0x411ca0){return _0x411ca0;});}return null;};}function removeEntity(_0x2b9a7a,_0x54783d){return function(_0x5352d3){if(_0x5352d3){return _0x5352d3['destroy']()[_0x1d69('0x25')](function(){_0x2b9a7a[_0x1d69('0x1a')](0xcc)[_0x1d69('0x1b')]();});}};}function handleEntityNotFound(_0x1c91bf,_0x4f4449){return function(_0x3af518){if(!_0x3af518){_0x1c91bf[_0x1d69('0x19')](0x194);}return _0x3af518;};}function handleError(_0x51e91b,_0x377913){_0x377913=_0x377913||0x1f4;return function(_0x2dc73f){logger[_0x1d69('0x26')](_0x2dc73f[_0x1d69('0x27')]);if(_0x2dc73f[_0x1d69('0x28')]){delete _0x2dc73f[_0x1d69('0x28')];}_0x51e91b['status'](_0x377913)[_0x1d69('0x29')](_0x2dc73f);};}exports[_0x1d69('0x2a')]=function(_0x3c6b2b,_0x1d521b){var _0x3c0962={},_0x1e5818={},_0x2fd8d3={'count':0x0,'rows':[]};var _0x215052=_[_0x1d69('0x2b')](db[_0x1d69('0x2c')][_0x1d69('0x2d')],function(_0x5e8e8e){return{'name':_0x5e8e8e[_0x1d69('0x2e')],'type':_0x5e8e8e['type'][_0x1d69('0x2f')]};});_0x1e5818[_0x1d69('0x30')]=_[_0x1d69('0x2b')](_0x215052,_0x1d69('0x28'));_0x1e5818['query']=_['keys'](_0x3c6b2b[_0x1d69('0x31')]);_0x1e5818['filters']=_[_0x1d69('0x32')](_0x1e5818[_0x1d69('0x30')],_0x1e5818[_0x1d69('0x31')]);_0x3c0962[_0x1d69('0x33')]=_[_0x1d69('0x32')](_0x1e5818[_0x1d69('0x30')],qs[_0x1d69('0x34')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x34')]));_0x3c0962[_0x1d69('0x33')]=_0x3c0962[_0x1d69('0x33')][_0x1d69('0x35')]?_0x3c0962[_0x1d69('0x33')]:_0x1e5818[_0x1d69('0x30')];if(!_0x3c6b2b['query'][_0x1d69('0x36')](_0x1d69('0x37'))){_0x3c0962[_0x1d69('0x1e')]=qs[_0x1d69('0x1e')](_0x3c6b2b[_0x1d69('0x31')]['limit']);_0x3c0962[_0x1d69('0x1c')]=qs[_0x1d69('0x1c')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x1c')]);}_0x3c0962['order']=qs[_0x1d69('0x38')](_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x38')]);_0x3c0962[_0x1d69('0x39')]=qs[_0x1d69('0x3a')](_['pick'](_0x3c6b2b['query'],_0x1e5818['filters']),_0x215052);if(_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x3b')]){_0x3c0962['where']=_[_0x1d69('0x3c')](_0x3c0962[_0x1d69('0x39')],{'$or':_[_0x1d69('0x2b')](_0x215052,function(_0x497e02){if(_0x497e02[_0x1d69('0x3d')]!==_0x1d69('0x3e')){var _0x1a8ba4={};_0x1a8ba4[_0x497e02[_0x1d69('0x28')]]={'$like':'%'+_0x3c6b2b['query'][_0x1d69('0x3b')]+'%'};return _0x1a8ba4;}})});}_0x3c0962=_[_0x1d69('0x3c')]({},_0x3c0962,_0x3c6b2b[_0x1d69('0x3f')]);var _0x3c09bb={'where':_0x3c0962['where']};return db[_0x1d69('0x2c')][_0x1d69('0x1f')](_0x3c09bb)[_0x1d69('0x25')](function(_0x38306a){_0x2fd8d3[_0x1d69('0x1f')]=_0x38306a;if(_0x3c6b2b[_0x1d69('0x31')][_0x1d69('0x40')]){_0x3c0962['include']=[{'all':!![]}];}return db[_0x1d69('0x2c')][_0x1d69('0x41')](_0x3c0962);})['then'](function(_0x3d68c3){_0x2fd8d3['rows']=_0x3d68c3;return _0x2fd8d3;})[_0x1d69('0x25')](respondWithFilteredResult(_0x1d521b,_0x3c0962))[_0x1d69('0x42')](handleError(_0x1d521b,null));};exports[_0x1d69('0x43')]=function(_0xc052d6,_0x5b0a74){var _0x1d6fee={'raw':!![],'where':{'id':_0xc052d6[_0x1d69('0x44')]['id']}},_0x21dfc2={};_0x21dfc2['model']=_[_0x1d69('0x45')](db['FreshdeskField']['rawAttributes']);_0x21dfc2[_0x1d69('0x31')]=_[_0x1d69('0x45')](_0xc052d6['query']);_0x21dfc2[_0x1d69('0x3a')]=_['intersection'](_0x21dfc2[_0x1d69('0x30')],_0x21dfc2[_0x1d69('0x31')]);_0x1d6fee['attributes']=_[_0x1d69('0x32')](_0x21dfc2[_0x1d69('0x30')],qs[_0x1d69('0x34')](_0xc052d6['query'][_0x1d69('0x34')]));_0x1d6fee[_0x1d69('0x33')]=_0x1d6fee[_0x1d69('0x33')][_0x1d69('0x35')]?_0x1d6fee[_0x1d69('0x33')]:_0x21dfc2[_0x1d69('0x30')];if(_0xc052d6[_0x1d69('0x31')][_0x1d69('0x40')]){_0x1d6fee[_0x1d69('0x46')]=[{'all':!![]}];}_0x1d6fee=_[_0x1d69('0x3c')]({},_0x1d6fee,_0xc052d6[_0x1d69('0x3f')]);return db[_0x1d69('0x2c')][_0x1d69('0x47')](_0x1d6fee)[_0x1d69('0x25')](handleEntityNotFound(_0x5b0a74,null))[_0x1d69('0x25')](respondWithResult(_0x5b0a74,null))[_0x1d69('0x42')](handleError(_0x5b0a74,null));};exports['create']=function(_0x438b3a,_0x11cf7c){return db[_0x1d69('0x2c')]['create'](_0x438b3a['body'],{})[_0x1d69('0x25')](respondWithResult(_0x11cf7c,0xc9))['catch'](handleError(_0x11cf7c,null));};exports[_0x1d69('0x48')]=function(_0x370645,_0x131304){if(_0x370645['body']['id']){delete _0x370645['body']['id'];}return db[_0x1d69('0x2c')]['find']({'where':{'id':_0x370645[_0x1d69('0x44')]['id']}})['then'](handleEntityNotFound(_0x131304,null))['then'](saveUpdates(_0x370645[_0x1d69('0x49')],null))[_0x1d69('0x25')](respondWithResult(_0x131304,null))[_0x1d69('0x42')](handleError(_0x131304,null));};exports[_0x1d69('0x4a')]=function(_0x442041,_0x4e6453){return db[_0x1d69('0x2c')][_0x1d69('0x47')]({'where':{'id':_0x442041['params']['id']}})[_0x1d69('0x25')](handleEntityNotFound(_0x4e6453,null))[_0x1d69('0x25')](removeEntity(_0x4e6453,null))[_0x1d69('0x42')](handleError(_0x4e6453,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2e59a69..ef5a9b3 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 _0x5a81=['freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields'];(function(_0x20ed19,_0x43a040){var _0x40e7b9=function(_0x9190e2){while(--_0x9190e2){_0x20ed19['push'](_0x20ed19['shift']());}};_0x40e7b9(++_0x43a040);}(_0x5a81,0x92));var _0x15a8=function(_0xc05dc,_0x57f81b){_0xc05dc=_0xc05dc-0x0;var _0x367332=_0x5a81[_0xc05dc];return _0x367332;};'use strict';var _=require('lodash');var util=require(_0x15a8('0x0'));var logger=require(_0x15a8('0x1'))(_0x15a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15a8('0x3'));var rimraf=require(_0x15a8('0x4'));var config=require(_0x15a8('0x5'));var attributes=require(_0x15a8('0x6'));module[_0x15a8('0x7')]=function(_0x21beba,_0x4c65c5){return _0x21beba[_0x15a8('0x8')]('FreshdeskField',attributes,{'tableName':_0x15a8('0x9'),'paranoid':![],'indexes':[{'name':_0x15a8('0xa'),'fields':[_0x15a8('0xb'),_0x15a8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ca3=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x263549,_0x5c1a83){var _0x52b8ee=function(_0x4d3a2f){while(--_0x4d3a2f){_0x263549['push'](_0x263549['shift']());}};_0x52b8ee(++_0x5c1a83);}(_0x7ca3,0x9b));var _0x37ca=function(_0x133296,_0xe8ff9a){_0x133296=_0x133296-0x0;var _0x193517=_0x7ca3[_0x133296];return _0x193517;};'use strict';var _=require('lodash');var util=require(_0x37ca('0x0'));var logger=require(_0x37ca('0x1'))(_0x37ca('0x2'));var moment=require(_0x37ca('0x3'));var BPromise=require(_0x37ca('0x4'));var rp=require(_0x37ca('0x5'));var fs=require('fs');var path=require(_0x37ca('0x6'));var rimraf=require('rimraf');var config=require(_0x37ca('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x37ca('0x8')]=function(_0x3f0a23,_0xbb16e3){return _0x3f0a23['define'](_0x37ca('0x9'),attributes,{'tableName':_0x37ca('0xa'),'paranoid':![],'indexes':[{'name':_0x37ca('0xb'),'fields':[_0x37ca('0xc'),_0x37ca('0xd')],'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 b652a6e..23a26a9 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 _0x65bd=['request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x6a7421,_0x20b4f5){var _0x33f5d1=function(_0x2714a4){while(--_0x2714a4){_0x6a7421['push'](_0x6a7421['shift']());}};_0x33f5d1(++_0x20b4f5);}(_0x65bd,0xb3));var _0xd65b=function(_0x384993,_0x137785){_0x384993=_0x384993-0x0;var _0xfe947b=_0x65bd[_0x384993];return _0xfe947b;};'use strict';var _=require(_0xd65b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd65b('0x1'));var rs=require(_0xd65b('0x2'));var fs=require('fs');var Redis=require(_0xd65b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd65b('0x4'));var logger=require(_0xd65b('0x5'))(_0xd65b('0x6'));var config=require('../../config/environment');var jayson=require(_0xd65b('0x7'));var client=jayson[_0xd65b('0x8')][_0xd65b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21837c,_0x274c53,_0x5def45){return new BPromise(function(_0x4af3a8,_0x46677f){return client[_0xd65b('0xa')](_0x21837c,_0x5def45)['then'](function(_0x5059b2){logger[_0xd65b('0xb')](_0xd65b('0xc'),_0x274c53,_0xd65b('0xd'));logger[_0xd65b('0xe')](_0xd65b('0xf'),_0x274c53,_0xd65b('0xd'),JSON[_0xd65b('0x10')](_0x5059b2));if(_0x5059b2[_0xd65b('0x11')]){if(_0x5059b2[_0xd65b('0x11')]['code']===0x1f4){logger[_0xd65b('0x11')](_0xd65b('0xc'),_0x274c53,_0x5059b2['error'][_0xd65b('0x12')]);return _0x46677f(_0x5059b2['error'][_0xd65b('0x12')]);}logger[_0xd65b('0x11')](_0xd65b('0xc'),_0x274c53,_0x5059b2[_0xd65b('0x11')][_0xd65b('0x12')]);return _0x4af3a8(_0x5059b2[_0xd65b('0x11')]['message']);}else{logger[_0xd65b('0xb')](_0xd65b('0xc'),_0x274c53,_0xd65b('0xd'));_0x4af3a8(_0x5059b2[_0xd65b('0x13')]['message']);}})[_0xd65b('0x14')](function(_0x2d0560){logger[_0xd65b('0x11')](_0xd65b('0xc'),_0x274c53,_0x2d0560);_0x46677f(_0x2d0560);});});} \ No newline at end of file +var _0x4219=['stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x4219,0x14f));var _0x9421=function(_0x1963fe,_0x7faae){_0x1963fe=_0x1963fe-0x0;var _0x54afd5=_0x4219[_0x1963fe];return _0x54afd5;};'use strict';var _=require(_0x9421('0x0'));var util=require('util');var moment=require(_0x9421('0x1'));var BPromise=require(_0x9421('0x2'));var rs=require(_0x9421('0x3'));var fs=require('fs');var Redis=require(_0x9421('0x4'));var db=require(_0x9421('0x5'))['db'];var utils=require(_0x9421('0x6'));var logger=require(_0x9421('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9421('0x8'));var client=jayson[_0x9421('0x9')][_0x9421('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7f8e5e,_0xc00321,_0x36db80){return new BPromise(function(_0x5cb7c6,_0x19ab4c){return client['request'](_0x7f8e5e,_0x36db80)[_0x9421('0xb')](function(_0x594656){logger[_0x9421('0xc')](_0x9421('0xd'),_0xc00321,'request\x20sent');logger[_0x9421('0xe')](_0x9421('0xf'),_0xc00321,_0x9421('0x10'),JSON[_0x9421('0x11')](_0x594656));if(_0x594656[_0x9421('0x12')]){if(_0x594656['error'][_0x9421('0x13')]===0x1f4){logger[_0x9421('0x12')](_0x9421('0xd'),_0xc00321,_0x594656[_0x9421('0x12')]['message']);return _0x19ab4c(_0x594656[_0x9421('0x12')]['message']);}logger[_0x9421('0x12')](_0x9421('0xd'),_0xc00321,_0x594656[_0x9421('0x12')][_0x9421('0x14')]);return _0x5cb7c6(_0x594656[_0x9421('0x12')][_0x9421('0x14')]);}else{logger[_0x9421('0xc')](_0x9421('0xd'),_0xc00321,_0x9421('0x10'));_0x5cb7c6(_0x594656[_0x9421('0x15')][_0x9421('0x14')]);}})['catch'](function(_0x2c0dec){logger[_0x9421('0x12')](_0x9421('0xd'),_0xc00321,_0x2c0dec);_0x19ab4c(_0x2c0dec);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 958d10a..c5efbac 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 _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5ddb67,_0x5e7d44){var _0xcf904=function(_0x3b6107){while(--_0x3b6107){_0x5ddb67['push'](_0x5ddb67['shift']());}};_0xcf904(++_0x5e7d44);}(_0xc900,0xb3));var _0x0c90=function(_0x59d28f,_0xc9c500){_0x59d28f=_0x59d28f-0x0;var _0x3b075b=_0xc900[_0x59d28f];return _0x3b075b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x503444,_0x392264){var _0x38d77e=function(_0xf2ad19){while(--_0xf2ad19){_0x503444['push'](_0x503444['shift']());}};_0x38d77e(++_0x392264);}(_0x80ed,0x11c));var _0xd80e=function(_0x38d16c,_0x5d82d4){_0x38d16c=_0x38d16c-0x0;var _0x4d1189=_0x80ed[_0x38d16c];return _0x4d1189;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b783018..f31553d 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 _0x0598=['exports','STRING','sequelize'];(function(_0x2d5805,_0x21954e){var _0x1cae4f=function(_0x53ff24){while(--_0x53ff24){_0x2d5805['push'](_0x2d5805['shift']());}};_0x1cae4f(++_0x21954e);}(_0x0598,0x92));var _0x8059=function(_0x2adc9d,_0x2ae979){_0x2adc9d=_0x2adc9d-0x0;var _0x1a889d=_0x0598[_0x2adc9d];return _0x1a889d;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x443a01,_0x51fe5a){var _0x1e897f=function(_0x3c2298){while(--_0x3c2298){_0x443a01['push'](_0x443a01['shift']());}};_0x1e897f(++_0x51fe5a);}(_0x236c,0x155));var _0xc236=function(_0x371b6a,_0x4a55be){_0x371b6a=_0x371b6a-0x0;var _0x31a407=_0x236c[_0x371b6a];return _0x31a407;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5a393eb..3aab8e5 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 _0xf61f=['stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','intersection','include','create','FreshsalesAccount','body','getConfigurations','FreshsalesConfiguration','order','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','getFields','remoteUri','username','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','statusCode'];(function(_0x32170e,_0x5b2efc){var _0x117af9=function(_0x46f278){while(--_0x46f278){_0x32170e['push'](_0x32170e['shift']());}};_0x117af9(++_0x5b2efc);}(_0xf61f,0x19a));var _0xff61=function(_0x19b2d2,_0x2485b2){_0x19b2d2=_0x19b2d2-0x0;var _0x183e8e=_0xf61f[_0x19b2d2];return _0x183e8e;};'use strict';var emlformat=require(_0xff61('0x0'));var rimraf=require(_0xff61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff61('0x2'));var rp=require(_0xff61('0x3'));var moment=require(_0xff61('0x4'));var BPromise=require(_0xff61('0x5'));var Mustache=require(_0xff61('0x6'));var util=require('util');var path=require(_0xff61('0x7'));var sox=require('sox');var csv=require(_0xff61('0x8'));var ejs=require(_0xff61('0x9'));var fs=require('fs');var fs_extra=require(_0xff61('0xa'));var _=require(_0xff61('0xb'));var squel=require(_0xff61('0xc'));var crypto=require(_0xff61('0xd'));var jsforce=require(_0xff61('0xe'));var deskjs=require(_0xff61('0xf'));var toCsv=require('to-csv');var querystring=require(_0xff61('0x10'));var Papa=require('papaparse');var Redis=require(_0xff61('0x11'));var authService=require(_0xff61('0x12'));var qs=require(_0xff61('0x13'));var as=require(_0xff61('0x14'));var hardwareService=require(_0xff61('0x15'));var logger=require(_0xff61('0x16'))(_0xff61('0x17'));var utils=require(_0xff61('0x18'));var config=require(_0xff61('0x19'));var licenseUtil=require(_0xff61('0x1a'));var db=require(_0xff61('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46a98a,_0x2ccc8b){_0x2ccc8b=_0x2ccc8b||0xcc;return function(_0x17439b){if(_0x17439b){return _0x46a98a[_0xff61('0x1c')](_0x2ccc8b);}return _0x46a98a[_0xff61('0x1d')](_0x2ccc8b)[_0xff61('0x1e')]();};}function respondWithResult(_0x1ea56e,_0x114bc9){_0x114bc9=_0x114bc9||0xc8;return function(_0x46a173){if(_0x46a173){return _0x1ea56e[_0xff61('0x1d')](_0x114bc9)[_0xff61('0x1f')](_0x46a173);}};}function respondWithFilteredResult(_0x70baf6,_0x3dd41c){return function(_0x43a4ad){if(_0x43a4ad){var _0x5158a5=typeof _0x3dd41c[_0xff61('0x20')]===_0xff61('0x21')&&typeof _0x3dd41c[_0xff61('0x22')]==='undefined';var _0x4d8fef=_0x43a4ad[_0xff61('0x23')];var _0x16ed2b=_0x5158a5?0x0:_0x3dd41c['offset'];var _0x203137=_0x5158a5?_0x43a4ad[_0xff61('0x23')]:_0x3dd41c[_0xff61('0x20')]+_0x3dd41c[_0xff61('0x22')];var _0xf50524;if(_0x203137>=_0x4d8fef){_0x203137=_0x4d8fef;_0xf50524=0xc8;}else{_0xf50524=0xce;}_0x70baf6[_0xff61('0x1d')](_0xf50524);return _0x70baf6[_0xff61('0x24')](_0xff61('0x25'),_0x16ed2b+'-'+_0x203137+'/'+_0x4d8fef)[_0xff61('0x1f')](_0x43a4ad);}return null;};}function patchUpdates(_0x4c7c5d){return function(_0x5bc8b5){try{jsonpatch['apply'](_0x5bc8b5,_0x4c7c5d,!![]);}catch(_0x42ad8e){return BPromise['reject'](_0x42ad8e);}return _0x5bc8b5['save']();};}function saveUpdates(_0x2429a7,_0x4eba92){return function(_0x159432){if(_0x159432){return _0x159432[_0xff61('0x26')](_0x2429a7)[_0xff61('0x27')](function(_0x4aeec8){return _0x4aeec8;});}return null;};}function removeEntity(_0x2c1ad6,_0x23fa58){return function(_0x48b494){if(_0x48b494){return _0x48b494[_0xff61('0x28')]()[_0xff61('0x27')](function(){_0x2c1ad6['status'](0xcc)[_0xff61('0x1e')]();});}};}function handleEntityNotFound(_0x3cc3f6,_0x5bb080){return function(_0x497ca8){if(!_0x497ca8){_0x3cc3f6[_0xff61('0x1c')](0x194);}return _0x497ca8;};}function handleError(_0xcc3881,_0x59b2f5){_0x59b2f5=_0x59b2f5||0x1f4;return function(_0x15fbf7){logger[_0xff61('0x29')](_0x15fbf7[_0xff61('0x2a')]);if(_0x15fbf7[_0xff61('0x2b')]){delete _0x15fbf7['name'];}_0xcc3881['status'](_0x59b2f5)[_0xff61('0x2c')](_0x15fbf7);};}exports[_0xff61('0x2d')]=function(_0x386590,_0x217a97){var _0x53da4e={},_0x490c98={},_0x52cc0a={'count':0x0,'rows':[]};var _0x533795=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x489f88){return{'name':_0x489f88['fieldName'],'type':_0x489f88[_0xff61('0x2e')][_0xff61('0x2f')]};});_0x490c98[_0xff61('0x30')]=_['map'](_0x533795,_0xff61('0x2b'));_0x490c98['query']=_[_0xff61('0x31')](_0x386590[_0xff61('0x32')]);_0x490c98['filters']=_['intersection'](_0x490c98['model'],_0x490c98[_0xff61('0x32')]);_0x53da4e[_0xff61('0x33')]=_['intersection'](_0x490c98['model'],qs[_0xff61('0x34')](_0x386590['query'][_0xff61('0x34')]));_0x53da4e[_0xff61('0x33')]=_0x53da4e[_0xff61('0x33')][_0xff61('0x35')]?_0x53da4e[_0xff61('0x33')]:_0x490c98[_0xff61('0x30')];if(!_0x386590[_0xff61('0x32')][_0xff61('0x36')](_0xff61('0x37'))){_0x53da4e[_0xff61('0x22')]=qs[_0xff61('0x22')](_0x386590[_0xff61('0x32')][_0xff61('0x22')]);_0x53da4e[_0xff61('0x20')]=qs[_0xff61('0x20')](_0x386590[_0xff61('0x32')][_0xff61('0x20')]);}_0x53da4e['order']=qs[_0xff61('0x38')](_0x386590['query'][_0xff61('0x38')]);_0x53da4e['where']=qs[_0xff61('0x39')](_[_0xff61('0x3a')](_0x386590[_0xff61('0x32')],_0x490c98['filters']),_0x533795);if(_0x386590[_0xff61('0x32')][_0xff61('0x3b')]){_0x53da4e[_0xff61('0x3c')]=_[_0xff61('0x3d')](_0x53da4e[_0xff61('0x3c')],{'$or':_[_0xff61('0x3e')](_0x533795,function(_0x31479d){if(_0x31479d[_0xff61('0x2e')]!==_0xff61('0x3f')){var _0x45d451={};_0x45d451[_0x31479d[_0xff61('0x2b')]]={'$like':'%'+_0x386590['query']['filter']+'%'};return _0x45d451;}})});}_0x53da4e=_[_0xff61('0x3d')]({},_0x53da4e,_0x386590[_0xff61('0x40')]);var _0x6664c8={'where':_0x53da4e[_0xff61('0x3c')]};return db['FreshsalesAccount']['count'](_0x6664c8)[_0xff61('0x27')](function(_0x442540){_0x52cc0a[_0xff61('0x23')]=_0x442540;if(_0x386590['query'][_0xff61('0x41')]){_0x53da4e['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xff61('0x42')](_0x53da4e);})['then'](function(_0x1067be){_0x52cc0a['rows']=_0x1067be;return _0x52cc0a;})[_0xff61('0x27')](respondWithFilteredResult(_0x217a97,_0x53da4e))[_0xff61('0x43')](handleError(_0x217a97,null));};exports[_0xff61('0x44')]=function(_0x1e0e2e,_0x58a0ea){var _0x12b796={'raw':![],'where':{'id':_0x1e0e2e[_0xff61('0x45')]['id']}},_0x4b6eec={};_0x4b6eec['model']=_['keys'](db['FreshsalesAccount'][_0xff61('0x46')]);_0x4b6eec[_0xff61('0x32')]=_[_0xff61('0x31')](_0x1e0e2e[_0xff61('0x32')]);_0x4b6eec[_0xff61('0x39')]=_[_0xff61('0x47')](_0x4b6eec[_0xff61('0x30')],_0x4b6eec[_0xff61('0x32')]);_0x12b796[_0xff61('0x33')]=_[_0xff61('0x47')](_0x4b6eec[_0xff61('0x30')],qs[_0xff61('0x34')](_0x1e0e2e[_0xff61('0x32')][_0xff61('0x34')]));_0x12b796['attributes']=_0x12b796[_0xff61('0x33')]['length']?_0x12b796[_0xff61('0x33')]:_0x4b6eec[_0xff61('0x30')];if(_0x1e0e2e[_0xff61('0x32')]['includeAll']){_0x12b796[_0xff61('0x48')]=[{'all':!![]}];}_0x12b796=_[_0xff61('0x3d')]({},_0x12b796,_0x1e0e2e[_0xff61('0x40')]);return db['FreshsalesAccount']['find'](_0x12b796)[_0xff61('0x27')](handleEntityNotFound(_0x58a0ea,null))['then'](respondWithResult(_0x58a0ea,null))[_0xff61('0x43')](handleError(_0x58a0ea,null));};exports[_0xff61('0x49')]=function(_0x42d642,_0x314268){return db[_0xff61('0x4a')][_0xff61('0x49')](_0x42d642[_0xff61('0x4b')],{})['then'](respondWithResult(_0x314268,0xc9))[_0xff61('0x43')](handleError(_0x314268,null));};exports[_0xff61('0x26')]=function(_0x3b0d3a,_0x44974e){if(_0x3b0d3a[_0xff61('0x4b')]['id']){delete _0x3b0d3a[_0xff61('0x4b')]['id'];}return db[_0xff61('0x4a')]['find']({'where':{'id':_0x3b0d3a[_0xff61('0x45')]['id']}})[_0xff61('0x27')](handleEntityNotFound(_0x44974e,null))[_0xff61('0x27')](saveUpdates(_0x3b0d3a['body'],null))[_0xff61('0x27')](respondWithResult(_0x44974e,null))[_0xff61('0x43')](handleError(_0x44974e,null));};exports[_0xff61('0x28')]=function(_0x49d26a,_0x34be8c){return db['FreshsalesAccount']['find']({'where':{'id':_0x49d26a['params']['id']}})['then'](handleEntityNotFound(_0x34be8c,null))['then'](removeEntity(_0x34be8c,null))[_0xff61('0x43')](handleError(_0x34be8c,null));};exports[_0xff61('0x4c')]=function(_0x24e417,_0xd52067,_0x40c246){var _0x3b4690={};var _0x28f758={};var _0x52c9ea;var _0x1f7d6a;return db[_0xff61('0x4a')]['findOne']({'where':{'id':_0x24e417[_0xff61('0x45')]['id']}})[_0xff61('0x27')](handleEntityNotFound(_0xd52067,null))[_0xff61('0x27')](function(_0x1a6eaf){if(_0x1a6eaf){_0x52c9ea=_0x1a6eaf;_0x28f758[_0xff61('0x30')]=_[_0xff61('0x31')](db[_0xff61('0x4d')]['rawAttributes']);_0x28f758['query']=_[_0xff61('0x31')](_0x24e417[_0xff61('0x32')]);_0x28f758['filters']=_['intersection'](_0x28f758['model'],_0x28f758[_0xff61('0x32')]);_0x3b4690[_0xff61('0x33')]=_[_0xff61('0x47')](_0x28f758[_0xff61('0x30')],qs['fields'](_0x24e417['query'][_0xff61('0x34')]));_0x3b4690[_0xff61('0x33')]=_0x3b4690[_0xff61('0x33')][_0xff61('0x35')]?_0x3b4690[_0xff61('0x33')]:_0x28f758[_0xff61('0x30')];_0x3b4690[_0xff61('0x4e')]=qs[_0xff61('0x38')](_0x24e417[_0xff61('0x32')][_0xff61('0x38')]);_0x3b4690[_0xff61('0x3c')]=qs['filters'](_[_0xff61('0x3a')](_0x24e417[_0xff61('0x32')],_0x28f758['filters']));if(_0x24e417[_0xff61('0x32')][_0xff61('0x3b')]){_0x3b4690[_0xff61('0x3c')]=_['merge'](_0x3b4690[_0xff61('0x3c')],{'$or':_[_0xff61('0x3e')](_0x3b4690['attributes'],function(_0x58ff3c){var _0x193b39={};_0x193b39[_0x58ff3c]={'$like':'%'+_0x24e417[_0xff61('0x32')][_0xff61('0x3b')]+'%'};return _0x193b39;})});}_0x3b4690=_[_0xff61('0x3d')]({},_0x3b4690,_0x24e417[_0xff61('0x40')]);return _0x52c9ea[_0xff61('0x4c')](_0x3b4690);}})[_0xff61('0x27')](function(_0x158347){if(_0x158347){_0x1f7d6a=_0x158347[_0xff61('0x35')];if(!_0x24e417[_0xff61('0x32')][_0xff61('0x36')](_0xff61('0x37'))){_0x3b4690[_0xff61('0x22')]=qs[_0xff61('0x22')](_0x24e417['query']['limit']);_0x3b4690[_0xff61('0x20')]=qs[_0xff61('0x20')](_0x24e417[_0xff61('0x32')]['offset']);}return _0x52c9ea[_0xff61('0x4c')](_0x3b4690);}})[_0xff61('0x27')](function(_0x3fab65){if(_0x3fab65){return _0x3fab65?{'count':_0x1f7d6a,'rows':_0x3fab65}:null;}})[_0xff61('0x27')](respondWithResult(_0xd52067,null))[_0xff61('0x43')](handleError(_0xd52067,null));};exports['addConfiguration']=function(_0x10dca2,_0x31346a,_0x3b06f1){if(_0x10dca2[_0xff61('0x4b')]['id']){delete _0x10dca2[_0xff61('0x4b')]['id'];}return db[_0xff61('0x4a')]['findOne']({'where':{'id':_0x10dca2['params']['id']}})[_0xff61('0x27')](handleEntityNotFound(_0x31346a,null))['then'](function(_0x55aa50){if(_0x55aa50){_0x10dca2['body'][_0xff61('0x4f')]=_0x55aa50['id'];_0x10dca2[_0xff61('0x4b')]['Subjects']=integrations[_0xff61('0x50')](_0x10dca2[_0xff61('0x4b')][_0xff61('0x51')],_0x10dca2[_0xff61('0x4b')]['type']);_0x10dca2[_0xff61('0x4b')][_0xff61('0x52')]=integrations[_0xff61('0x53')](_0x10dca2['body'][_0xff61('0x51')],_0x10dca2[_0xff61('0x4b')][_0xff61('0x2e')]);return db['FreshsalesConfiguration']['create'](_0x10dca2['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xff61('0x54')},{'model':db[_0xff61('0x55')],'as':_0xff61('0x52')}]});}return null;})[_0xff61('0x27')](respondWithResult(_0x31346a,null))[_0xff61('0x43')](handleError(_0x31346a,null));};exports[_0xff61('0x56')]=function(_0x9e3574,_0x4ec1c4,_0x107903){var _0x280715='';var _0x145996='';return db[_0xff61('0x4a')]['findOne']({'where':{'id':_0x9e3574[_0xff61('0x45')]['id']},'attributes':['id','username',_0xff61('0x57'),'apiKey']})[_0xff61('0x27')](handleEntityNotFound(_0x4ec1c4,null))[_0xff61('0x27')](function(_0x1e24a1){if(_0x1e24a1){_0x145996=_0x1e24a1[_0xff61('0x58')];_0x280715=_0x1e24a1[_0xff61('0x57')];var _0x267c0b=_0x1e24a1[_0xff61('0x57')][_0xff61('0x59')](-0x1);if(_0x267c0b==='/'){_0x280715=_0x280715['substring'](0x0,_0x280715['lastIndexOf'](_0x267c0b));}return rp({'method':_0xff61('0x5a'),'uri':util[_0xff61('0x5b')](_0xff61('0x5c'),_0x280715,_0xff61('0x5d')),'headers':{'Authorization':_0xff61('0x5e')+_0x1e24a1[_0xff61('0x5f')]},'json':!![]});}})[_0xff61('0x27')](function(_0x2387db){if(_0x2387db){var _0x4b8e85=_0x2387db[_0xff61('0x60')];var _0x42f55c=![];var _0x483c31=null;for(_0x483c31=0x0;_0x483c31<_0x4b8e85[_0xff61('0x35')];_0x483c31++){if(_0x4b8e85[_0x483c31][_0xff61('0x61')]===_0x145996){_0x42f55c=!![];}}if(_0x42f55c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xff61('0x27')](respondWithResult(_0x4ec1c4,null))[_0xff61('0x43')](function(_0xc10b52){var _0x8e29c7=_0x9e3574[_0xff61('0x32')][_0xff61('0x62')]?0x1f4:_0xc10b52[_0xff61('0x63')]||0x1f4;logger[_0xff61('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xff61('0x56'),_0x8e29c7,JSON[_0xff61('0x64')](_0xc10b52));delete _0xc10b52['name'];if(_0x8e29c7===0x191){_0x8e29c7=0x190;}_0x4ec1c4[_0xff61('0x1d')](_0x8e29c7)[_0xff61('0x2c')](_0x9e3574[_0xff61('0x32')][_0xff61('0x62')]?{'message':_0xff61('0x65'),'statusCode':_0xc10b52[_0xff61('0x63')]}:_0xc10b52);});}; \ No newline at end of file +var _0x3228=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','merge','options','count','include','FreshsalesAccount','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','catch','findOne','FreshsalesConfiguration','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x2c4ddb,_0x582ebf){var _0x163111=function(_0x451f98){while(--_0x451f98){_0x2c4ddb['push'](_0x2c4ddb['shift']());}};_0x163111(++_0x582ebf);}(_0x3228,0x12c));var _0x8322=function(_0x3d949e,_0x3fb856){_0x3d949e=_0x3d949e-0x0;var _0x3a2824=_0x3228[_0x3d949e];return _0x3a2824;};'use strict';var emlformat=require(_0x8322('0x0'));var rimraf=require(_0x8322('0x1'));var zipdir=require(_0x8322('0x2'));var jsonpatch=require(_0x8322('0x3'));var rp=require(_0x8322('0x4'));var moment=require(_0x8322('0x5'));var BPromise=require(_0x8322('0x6'));var Mustache=require(_0x8322('0x7'));var util=require(_0x8322('0x8'));var path=require(_0x8322('0x9'));var sox=require(_0x8322('0xa'));var csv=require(_0x8322('0xb'));var ejs=require(_0x8322('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8322('0xd'));var squel=require(_0x8322('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8322('0xf'));var toCsv=require(_0x8322('0xb'));var querystring=require(_0x8322('0x10'));var Papa=require(_0x8322('0x11'));var Redis=require(_0x8322('0x12'));var authService=require(_0x8322('0x13'));var qs=require(_0x8322('0x14'));var as=require(_0x8322('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8322('0x16'))(_0x8322('0x17'));var utils=require(_0x8322('0x18'));var config=require(_0x8322('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8322('0x1a'));function respondWithStatusCode(_0x1f724f,_0x49d8ff){_0x49d8ff=_0x49d8ff||0xcc;return function(_0x4ab93e){if(_0x4ab93e){return _0x1f724f[_0x8322('0x1b')](_0x49d8ff);}return _0x1f724f[_0x8322('0x1c')](_0x49d8ff)[_0x8322('0x1d')]();};}function respondWithResult(_0x5ea687,_0x720cd4){_0x720cd4=_0x720cd4||0xc8;return function(_0x4d23ca){if(_0x4d23ca){return _0x5ea687[_0x8322('0x1c')](_0x720cd4)['json'](_0x4d23ca);}};}function respondWithFilteredResult(_0x5293a7,_0x34bd27){return function(_0x43b414){if(_0x43b414){var _0x402f0c=typeof _0x34bd27[_0x8322('0x1e')]===_0x8322('0x1f')&&typeof _0x34bd27[_0x8322('0x20')]==='undefined';var _0x3c8d5a=_0x43b414['count'];var _0x5dec1b=_0x402f0c?0x0:_0x34bd27[_0x8322('0x1e')];var _0x238740=_0x402f0c?_0x43b414['count']:_0x34bd27['offset']+_0x34bd27[_0x8322('0x20')];var _0x1c67f8;if(_0x238740>=_0x3c8d5a){_0x238740=_0x3c8d5a;_0x1c67f8=0xc8;}else{_0x1c67f8=0xce;}_0x5293a7[_0x8322('0x1c')](_0x1c67f8);return _0x5293a7[_0x8322('0x21')](_0x8322('0x22'),_0x5dec1b+'-'+_0x238740+'/'+_0x3c8d5a)[_0x8322('0x23')](_0x43b414);}return null;};}function patchUpdates(_0x2f6606){return function(_0x365065){try{jsonpatch['apply'](_0x365065,_0x2f6606,!![]);}catch(_0x58730a){return BPromise[_0x8322('0x24')](_0x58730a);}return _0x365065['save']();};}function saveUpdates(_0xef3057,_0x2f59a8){return function(_0x5a7548){if(_0x5a7548){return _0x5a7548[_0x8322('0x25')](_0xef3057)['then'](function(_0x1ba0a0){return _0x1ba0a0;});}return null;};}function removeEntity(_0x1b1e7f,_0x1818cb){return function(_0x6de00a){if(_0x6de00a){return _0x6de00a[_0x8322('0x26')]()[_0x8322('0x27')](function(){_0x1b1e7f[_0x8322('0x1c')](0xcc)[_0x8322('0x1d')]();});}};}function handleEntityNotFound(_0x302238,_0xd54ee){return function(_0x420b91){if(!_0x420b91){_0x302238['sendStatus'](0x194);}return _0x420b91;};}function handleError(_0x478f27,_0x55cc52){_0x55cc52=_0x55cc52||0x1f4;return function(_0x3d55e8){logger[_0x8322('0x28')](_0x3d55e8[_0x8322('0x29')]);if(_0x3d55e8[_0x8322('0x2a')]){delete _0x3d55e8['name'];}_0x478f27[_0x8322('0x1c')](_0x55cc52)[_0x8322('0x2b')](_0x3d55e8);};}exports[_0x8322('0x2c')]=function(_0x5e78b0,_0x47a173){var _0x973fca={},_0x6fe220={},_0x34375c={'count':0x0,'rows':[]};var _0x127fdf=_[_0x8322('0x2d')](db['FreshsalesAccount']['rawAttributes'],function(_0x39d6ef){return{'name':_0x39d6ef[_0x8322('0x2e')],'type':_0x39d6ef['type'][_0x8322('0x2f')]};});_0x6fe220[_0x8322('0x30')]=_[_0x8322('0x2d')](_0x127fdf,_0x8322('0x2a'));_0x6fe220['query']=_['keys'](_0x5e78b0[_0x8322('0x31')]);_0x6fe220[_0x8322('0x32')]=_['intersection'](_0x6fe220[_0x8322('0x30')],_0x6fe220[_0x8322('0x31')]);_0x973fca[_0x8322('0x33')]=_[_0x8322('0x34')](_0x6fe220[_0x8322('0x30')],qs[_0x8322('0x35')](_0x5e78b0[_0x8322('0x31')][_0x8322('0x35')]));_0x973fca[_0x8322('0x33')]=_0x973fca[_0x8322('0x33')][_0x8322('0x36')]?_0x973fca[_0x8322('0x33')]:_0x6fe220[_0x8322('0x30')];if(!_0x5e78b0[_0x8322('0x31')][_0x8322('0x37')](_0x8322('0x38'))){_0x973fca['limit']=qs[_0x8322('0x20')](_0x5e78b0[_0x8322('0x31')][_0x8322('0x20')]);_0x973fca['offset']=qs[_0x8322('0x1e')](_0x5e78b0[_0x8322('0x31')][_0x8322('0x1e')]);}_0x973fca[_0x8322('0x39')]=qs[_0x8322('0x3a')](_0x5e78b0[_0x8322('0x31')][_0x8322('0x3a')]);_0x973fca['where']=qs[_0x8322('0x32')](_[_0x8322('0x3b')](_0x5e78b0[_0x8322('0x31')],_0x6fe220[_0x8322('0x32')]),_0x127fdf);if(_0x5e78b0[_0x8322('0x31')][_0x8322('0x3c')]){_0x973fca[_0x8322('0x3d')]=_['merge'](_0x973fca['where'],{'$or':_['map'](_0x127fdf,function(_0x495f95){if(_0x495f95[_0x8322('0x3e')]!=='VIRTUAL'){var _0x1e4ee5={};_0x1e4ee5[_0x495f95[_0x8322('0x2a')]]={'$like':'%'+_0x5e78b0[_0x8322('0x31')]['filter']+'%'};return _0x1e4ee5;}})});}_0x973fca=_[_0x8322('0x3f')]({},_0x973fca,_0x5e78b0[_0x8322('0x40')]);var _0x87ab55={'where':_0x973fca[_0x8322('0x3d')]};return db['FreshsalesAccount']['count'](_0x87ab55)[_0x8322('0x27')](function(_0x5d6c2c){_0x34375c[_0x8322('0x41')]=_0x5d6c2c;if(_0x5e78b0['query']['includeAll']){_0x973fca[_0x8322('0x42')]=[{'all':!![]}];}return db[_0x8322('0x43')][_0x8322('0x44')](_0x973fca);})[_0x8322('0x27')](function(_0x503038){_0x34375c[_0x8322('0x45')]=_0x503038;return _0x34375c;})['then'](respondWithFilteredResult(_0x47a173,_0x973fca))['catch'](handleError(_0x47a173,null));};exports[_0x8322('0x46')]=function(_0x17f3fe,_0x18575f){var _0x9bfc94={'raw':![],'where':{'id':_0x17f3fe[_0x8322('0x47')]['id']}},_0x3dd821={};_0x3dd821[_0x8322('0x30')]=_[_0x8322('0x48')](db['FreshsalesAccount'][_0x8322('0x49')]);_0x3dd821[_0x8322('0x31')]=_[_0x8322('0x48')](_0x17f3fe[_0x8322('0x31')]);_0x3dd821[_0x8322('0x32')]=_[_0x8322('0x34')](_0x3dd821[_0x8322('0x30')],_0x3dd821[_0x8322('0x31')]);_0x9bfc94[_0x8322('0x33')]=_['intersection'](_0x3dd821['model'],qs[_0x8322('0x35')](_0x17f3fe[_0x8322('0x31')][_0x8322('0x35')]));_0x9bfc94['attributes']=_0x9bfc94[_0x8322('0x33')]['length']?_0x9bfc94[_0x8322('0x33')]:_0x3dd821['model'];if(_0x17f3fe[_0x8322('0x31')][_0x8322('0x4a')]){_0x9bfc94['include']=[{'all':!![]}];}_0x9bfc94=_[_0x8322('0x3f')]({},_0x9bfc94,_0x17f3fe[_0x8322('0x40')]);return db[_0x8322('0x43')][_0x8322('0x4b')](_0x9bfc94)[_0x8322('0x27')](handleEntityNotFound(_0x18575f,null))['then'](respondWithResult(_0x18575f,null))['catch'](handleError(_0x18575f,null));};exports['create']=function(_0x2a393f,_0x330a65){return db[_0x8322('0x43')][_0x8322('0x4c')](_0x2a393f[_0x8322('0x4d')],{})['then'](respondWithResult(_0x330a65,0xc9))[_0x8322('0x4e')](handleError(_0x330a65,null));};exports['update']=function(_0x4e6cc7,_0x5f4ec6){if(_0x4e6cc7[_0x8322('0x4d')]['id']){delete _0x4e6cc7[_0x8322('0x4d')]['id'];}return db[_0x8322('0x43')]['find']({'where':{'id':_0x4e6cc7[_0x8322('0x47')]['id']}})[_0x8322('0x27')](handleEntityNotFound(_0x5f4ec6,null))['then'](saveUpdates(_0x4e6cc7[_0x8322('0x4d')],null))['then'](respondWithResult(_0x5f4ec6,null))[_0x8322('0x4e')](handleError(_0x5f4ec6,null));};exports[_0x8322('0x26')]=function(_0x2d639a,_0x4c12b3){return db[_0x8322('0x43')]['find']({'where':{'id':_0x2d639a[_0x8322('0x47')]['id']}})[_0x8322('0x27')](handleEntityNotFound(_0x4c12b3,null))['then'](removeEntity(_0x4c12b3,null))[_0x8322('0x4e')](handleError(_0x4c12b3,null));};exports['getConfigurations']=function(_0x1a2525,_0x4ed102,_0x3ead22){var _0x48c282={};var _0x966ee3={};var _0x34c1fb;var _0x38303d;return db[_0x8322('0x43')][_0x8322('0x4f')]({'where':{'id':_0x1a2525[_0x8322('0x47')]['id']}})[_0x8322('0x27')](handleEntityNotFound(_0x4ed102,null))[_0x8322('0x27')](function(_0xa11408){if(_0xa11408){_0x34c1fb=_0xa11408;_0x966ee3['model']=_['keys'](db[_0x8322('0x50')][_0x8322('0x49')]);_0x966ee3[_0x8322('0x31')]=_[_0x8322('0x48')](_0x1a2525[_0x8322('0x31')]);_0x966ee3['filters']=_[_0x8322('0x34')](_0x966ee3[_0x8322('0x30')],_0x966ee3['query']);_0x48c282[_0x8322('0x33')]=_[_0x8322('0x34')](_0x966ee3[_0x8322('0x30')],qs[_0x8322('0x35')](_0x1a2525['query']['fields']));_0x48c282[_0x8322('0x33')]=_0x48c282[_0x8322('0x33')]['length']?_0x48c282[_0x8322('0x33')]:_0x966ee3['model'];_0x48c282[_0x8322('0x39')]=qs['sort'](_0x1a2525[_0x8322('0x31')][_0x8322('0x3a')]);_0x48c282[_0x8322('0x3d')]=qs['filters'](_[_0x8322('0x3b')](_0x1a2525[_0x8322('0x31')],_0x966ee3[_0x8322('0x32')]));if(_0x1a2525[_0x8322('0x31')][_0x8322('0x3c')]){_0x48c282[_0x8322('0x3d')]=_[_0x8322('0x3f')](_0x48c282[_0x8322('0x3d')],{'$or':_['map'](_0x48c282[_0x8322('0x33')],function(_0x4c37b9){var _0x53720b={};_0x53720b[_0x4c37b9]={'$like':'%'+_0x1a2525[_0x8322('0x31')][_0x8322('0x3c')]+'%'};return _0x53720b;})});}_0x48c282=_[_0x8322('0x3f')]({},_0x48c282,_0x1a2525[_0x8322('0x40')]);return _0x34c1fb[_0x8322('0x51')](_0x48c282);}})['then'](function(_0xb5be11){if(_0xb5be11){_0x38303d=_0xb5be11[_0x8322('0x36')];if(!_0x1a2525[_0x8322('0x31')][_0x8322('0x37')](_0x8322('0x38'))){_0x48c282[_0x8322('0x20')]=qs['limit'](_0x1a2525[_0x8322('0x31')][_0x8322('0x20')]);_0x48c282[_0x8322('0x1e')]=qs['offset'](_0x1a2525[_0x8322('0x31')][_0x8322('0x1e')]);}return _0x34c1fb[_0x8322('0x51')](_0x48c282);}})[_0x8322('0x27')](function(_0x26f791){if(_0x26f791){return _0x26f791?{'count':_0x38303d,'rows':_0x26f791}:null;}})['then'](respondWithResult(_0x4ed102,null))[_0x8322('0x4e')](handleError(_0x4ed102,null));};exports[_0x8322('0x52')]=function(_0x27a2cd,_0x411f38,_0x4f69a2){if(_0x27a2cd[_0x8322('0x4d')]['id']){delete _0x27a2cd[_0x8322('0x4d')]['id'];}return db[_0x8322('0x43')][_0x8322('0x4f')]({'where':{'id':_0x27a2cd['params']['id']}})['then'](handleEntityNotFound(_0x411f38,null))[_0x8322('0x27')](function(_0xb9c86d){if(_0xb9c86d){_0x27a2cd[_0x8322('0x4d')]['AccountId']=_0xb9c86d['id'];_0x27a2cd['body']['Subjects']=integrations['getSubjects'](_0x27a2cd[_0x8322('0x4d')][_0x8322('0x53')],_0x27a2cd[_0x8322('0x4d')]['type']);_0x27a2cd[_0x8322('0x4d')][_0x8322('0x54')]=integrations[_0x8322('0x55')](_0x27a2cd[_0x8322('0x4d')]['channel'],_0x27a2cd[_0x8322('0x4d')]['type']);return db[_0x8322('0x50')][_0x8322('0x4c')](_0x27a2cd[_0x8322('0x4d')],{'include':[{'model':db[_0x8322('0x56')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x8322('0x54')}]});}return null;})[_0x8322('0x27')](respondWithResult(_0x411f38,null))[_0x8322('0x4e')](handleError(_0x411f38,null));};exports[_0x8322('0x57')]=function(_0x4788c3,_0x1ec4a8,_0x4c0964){var _0x27d4d0='';var _0xb1ac91='';return db[_0x8322('0x43')][_0x8322('0x4f')]({'where':{'id':_0x4788c3[_0x8322('0x47')]['id']},'attributes':['id',_0x8322('0x58'),_0x8322('0x59'),'apiKey']})[_0x8322('0x27')](handleEntityNotFound(_0x1ec4a8,null))[_0x8322('0x27')](function(_0x11f862){if(_0x11f862){_0xb1ac91=_0x11f862[_0x8322('0x58')];_0x27d4d0=_0x11f862[_0x8322('0x59')];var _0x2ceb2a=_0x11f862[_0x8322('0x59')]['slice'](-0x1);if(_0x2ceb2a==='/'){_0x27d4d0=_0x27d4d0[_0x8322('0x5a')](0x0,_0x27d4d0['lastIndexOf'](_0x2ceb2a));}return rp({'method':_0x8322('0x5b'),'uri':util[_0x8322('0x5c')](_0x8322('0x5d'),_0x27d4d0,_0x8322('0x5e')),'headers':{'Authorization':_0x8322('0x5f')+_0x11f862[_0x8322('0x60')]},'json':!![]});}})[_0x8322('0x27')](function(_0x5efd97){if(_0x5efd97){var _0x1cf42d=_0x5efd97[_0x8322('0x61')];var _0x1ccc17=![];var _0x57b720=null;for(_0x57b720=0x0;_0x57b720<_0x1cf42d[_0x8322('0x36')];_0x57b720++){if(_0x1cf42d[_0x57b720][_0x8322('0x62')]===_0xb1ac91){_0x1ccc17=!![];}}if(_0x1ccc17){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8322('0x63')});}}})['then'](respondWithResult(_0x1ec4a8,null))[_0x8322('0x4e')](function(_0xb1d439){var _0xd13d55=_0x4788c3[_0x8322('0x31')][_0x8322('0x64')]?0x1f4:_0xb1d439[_0x8322('0x65')]||0x1f4;logger[_0x8322('0x28')](_0x8322('0x66'),_0x8322('0x57'),_0xd13d55,JSON[_0x8322('0x67')](_0xb1d439));delete _0xb1d439[_0x8322('0x2a')];if(_0xd13d55===0x191){_0xd13d55=0x190;}_0x1ec4a8[_0x8322('0x1c')](_0xd13d55)[_0x8322('0x2b')](_0x4788c3[_0x8322('0x31')][_0x8322('0x64')]?{'message':_0x8322('0x68'),'statusCode':_0xb1d439['statusCode']}:_0xb1d439);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index cf64c9c..986698f 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xfcf0,0x138));var _0x0fcf=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0xfcf0[_0x7b484];return _0x2ae1cf;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['exports','lodash','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0295,0x1f0));var _0x5029=function(_0x51472d,_0x592b0b){_0x51472d=_0x51472d-0x0;var _0x5f00f1=_0x0295[_0x51472d];return _0x5f00f1;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));var integrations=require(_0x5029('0x7'));module[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return _0x215955['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 3b49860..abcacd7 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 _0x3d04=['result','FreshsalesAccount','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','debug','catch','find','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','info'];(function(_0x17a6f4,_0x3d9a3d){var _0x3cb583=function(_0xe60c31){while(--_0xe60c31){_0x17a6f4['push'](_0x17a6f4['shift']());}};_0x3cb583(++_0x3d9a3d);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['GetFreshsalesAccount']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['findAll']({'raw':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'limit':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x19')]||null:null,'include':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x48aa18){return{'model':db[_0x48aa18[_0x43d0('0x1c')]],'as':_0x48aa18['as'],'attributes':_0x48aa18[_0x43d0('0x18')],'include':_0x48aa18['include']?_[_0x43d0('0x1b')](_0x48aa18['include'],function(_0x29c111){return{'model':db[_0x29c111[_0x43d0('0x1c')]],'as':_0x29c111['as'],'attributes':_0x29c111['attributes'],'include':_0x29c111[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x29c111['include'],function(_0x12df30){return{'model':db[_0x12df30[_0x43d0('0x1c')]],'as':_0x12df30['as'],'attributes':_0x12df30[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447725){logger[_0x43d0('0x13')](_0x43d0('0x1d'),_0x2c641e);logger[_0x43d0('0x1e')](_0x43d0('0x1d'),_0x2c641e,JSON[_0x43d0('0xf')](_0x447725));_0x2c9d06(_0x447725);})[_0x43d0('0x1f')](function(_0x4a3cd4){logger[_0x43d0('0x10')](_0x43d0('0x1d'),_0x4a3cd4[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402['error'](0x1f4,_0x4a3cd4['message']));});});};exports['ShowFreshsalesAccount']=function(_0x3c1ea3){var _0x2db9dc=this;return new Promise(function(_0x10086b,_0x13e3c9){return db[_0x43d0('0x15')][_0x43d0('0x20')]({'raw':_0x3c1ea3['options']?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x21')]===undefined?!![]:![]:!![],'where':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'include':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')]?_['map'](_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x45ec78){return{'model':db[_0x45ec78[_0x43d0('0x1c')]],'as':_0x45ec78['as'],'attributes':_0x45ec78['attributes'],'include':_0x45ec78[_0x43d0('0x1a')]?_['map'](_0x45ec78[_0x43d0('0x1a')],function(_0x23cc5b){return{'model':db[_0x23cc5b['model']],'as':_0x23cc5b['as'],'attributes':_0x23cc5b[_0x43d0('0x18')],'include':_0x23cc5b[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x23cc5b[_0x43d0('0x1a')],function(_0x154db6){return{'model':db[_0x154db6[_0x43d0('0x1c')]],'as':_0x154db6['as'],'attributes':_0x154db6[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43d0('0xd')](function(_0x7b7983){logger[_0x43d0('0x13')](_0x43d0('0x22'),_0x3c1ea3);logger['debug'](_0x43d0('0x22'),_0x3c1ea3,JSON[_0x43d0('0xf')](_0x7b7983));_0x10086b(_0x7b7983);})[_0x43d0('0x1f')](function(_0x7891c5){logger[_0x43d0('0x10')](_0x43d0('0x22'),_0x7891c5[_0x43d0('0x12')],_0x3c1ea3);_0x13e3c9(_0x2db9dc[_0x43d0('0x10')](0x1f4,_0x7891c5[_0x43d0('0x12')]));});});}; \ No newline at end of file +var _0xe2fe=['find','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowFreshsalesAccount'];(function(_0x417c84,_0x146055){var _0x3d18f7=function(_0x564a35){while(--_0x564a35){_0x417c84['push'](_0x417c84['shift']());}};_0x3d18f7(++_0x146055);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')]({'raw':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options'][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x17')]||null:null,'attributes':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options']['attributes']||null:null,'limit':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x18')]||null:null,'include':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x502eb6['options'][_0xee2f('0x19')],function(_0x2c47c5){return{'model':db[_0x2c47c5[_0xee2f('0x1b')]],'as':_0x2c47c5['as'],'attributes':_0x2c47c5[_0xee2f('0x1c')],'include':_0x2c47c5[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x2c47c5[_0xee2f('0x19')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1b')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x1c')],'include':_0x13013f[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x13013f[_0xee2f('0x19')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bdbb){logger[_0xee2f('0xb')](_0xee2f('0x12'),_0x502eb6);logger[_0xee2f('0x1d')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x18bdbb));_0x40b5bc(_0x18bdbb);})['catch'](function(_0x3d3806){logger['error'](_0xee2f('0x12'),_0x3d3806[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x3d3806[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1e')]=function(_0x47d5a6){var _0x310c0b=this;return new Promise(function(_0xd16e35,_0x56706e){return db['FreshsalesAccount'][_0xee2f('0x1f')]({'raw':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')]['where']||null:null,'attributes':_0x47d5a6['options']?_0x47d5a6['options'][_0xee2f('0x1c')]||null:null,'include':_0x47d5a6[_0xee2f('0x15')]?_0x47d5a6['options'][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x19')],function(_0x1c3a01){return{'model':db[_0x1c3a01['model']],'as':_0x1c3a01['as'],'attributes':_0x1c3a01[_0xee2f('0x1c')],'include':_0x1c3a01['include']?_[_0xee2f('0x1a')](_0x1c3a01[_0xee2f('0x19')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x1c')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1a')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1b')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0xa')](function(_0x1b9f6c){logger[_0xee2f('0xb')](_0xee2f('0x1e'),_0x47d5a6);logger[_0xee2f('0x1d')](_0xee2f('0x1e'),_0x47d5a6,JSON[_0xee2f('0xd')](_0x1b9f6c));_0xd16e35(_0x1b9f6c);})[_0xee2f('0x20')](function(_0x5ad0a7){logger[_0xee2f('0xe')]('ShowFreshsalesAccount',_0x5ad0a7[_0xee2f('0xf')],_0x47d5a6);_0x56706e(_0x310c0b[_0xee2f('0xe')](0x1f4,_0x5ad0a7[_0xee2f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7d90dfe..a7a5ef2 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 _0xc80c=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','show','getSubjects'];(function(_0x425483,_0x3a4ada){var _0x3a716f=function(_0x518bd9){while(--_0x518bd9){_0x425483['push'](_0x425483['shift']());}};_0x3a716f(++_0x3a4ada);}(_0xc80c,0x136));var _0xcc80=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xc80c[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0xcc80('0x0'));var util=require(_0xcc80('0x1'));var path=require('path');var timeout=require(_0xcc80('0x2'));var express=require(_0xcc80('0x3'));var router=express[_0xcc80('0x4')]();var fs_extra=require(_0xcc80('0x5'));var auth=require(_0xcc80('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc80('0x7'));var controller=require(_0xcc80('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc80('0x9')]);router[_0xcc80('0xa')](_0xcc80('0xb'),auth[_0xcc80('0xc')](),controller[_0xcc80('0xd')]);router[_0xcc80('0xa')]('/:id/subjects',auth[_0xcc80('0xc')](),controller[_0xcc80('0xe')]);router['get'](_0xcc80('0xf'),auth['isAuthenticated'](),controller[_0xcc80('0x10')]);router[_0xcc80('0xa')](_0xcc80('0x11'),auth[_0xcc80('0xc')](),controller[_0xcc80('0x12')]);router[_0xcc80('0x13')]('/',auth[_0xcc80('0xc')](),controller[_0xcc80('0x14')]);router[_0xcc80('0x15')](_0xcc80('0xb'),auth[_0xcc80('0xc')](),controller[_0xcc80('0x16')]);router[_0xcc80('0x17')](_0xcc80('0xb'),auth[_0xcc80('0xc')](),controller['destroy']);module[_0xcc80('0x18')]=router; \ No newline at end of file +var _0x4926=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getDescriptions','/:id/fields','post','create','update','delete','exports','multer','util'];(function(_0x293826,_0x509b25){var _0x4a52ac=function(_0x35e183){while(--_0x35e183){_0x293826['push'](_0x293826['shift']());}};_0x4a52ac(++_0x509b25);}(_0x4926,0x91));var _0x6492=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x4926[_0x14a0a0];return _0x56b651;};'use strict';var multer=require(_0x6492('0x0'));var util=require(_0x6492('0x1'));var path=require(_0x6492('0x2'));var timeout=require('connect-timeout');var express=require(_0x6492('0x3'));var router=express[_0x6492('0x4')]();var fs_extra=require(_0x6492('0x5'));var auth=require(_0x6492('0x6'));var interaction=require(_0x6492('0x7'));var config=require('../../config/environment');var controller=require(_0x6492('0x8'));router[_0x6492('0x9')]('/',auth[_0x6492('0xa')](),controller[_0x6492('0xb')]);router[_0x6492('0x9')](_0x6492('0xc'),auth[_0x6492('0xa')](),controller['show']);router['get'](_0x6492('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x6492('0xa')](),controller[_0x6492('0xe')]);router[_0x6492('0x9')](_0x6492('0xf'),auth[_0x6492('0xa')](),controller['getFields']);router[_0x6492('0x10')]('/',auth['isAuthenticated'](),controller[_0x6492('0x11')]);router['put'](_0x6492('0xc'),auth[_0x6492('0xa')](),controller[_0x6492('0x12')]);router[_0x6492('0x13')]('/:id',auth[_0x6492('0xa')](),controller['destroy']);module[_0x6492('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ce50536..cd3d593 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 _0xb767=['exports','STRING','sequelize'];(function(_0x109fbb,_0xa85e95){var _0x259275=function(_0x30fa80){while(--_0x30fa80){_0x109fbb['push'](_0x109fbb['shift']());}};_0x259275(++_0xa85e95);}(_0xb767,0x15e));var _0x7b76=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb767[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7b76('0x0'));module[_0x7b76('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7b76('0x2')]}}; \ No newline at end of file +var _0x5ab7=['STRING','sequelize'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x5ab7,0x14b));var _0x75ab=function(_0x2a2bdd,_0x1c56c9){_0x2a2bdd=_0x2a2bdd-0x0;var _0x464785=_0x5ab7[_0x2a2bdd];return _0x464785;};'use strict';var Sequelize=require(_0x75ab('0x0'));module['exports']={'name':{'type':Sequelize[_0x75ab('0x1')]},'description':{'type':Sequelize[_0x75ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1b03932..d455dbe 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 _0x431c=['status','Content-Range','apply','save','update','destroy','then','error','stack','map','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','show','params','FreshsalesConfiguration','length','merge','options','find','catch','create','body','findOne','FreshsalesField','getSubjects','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count'];(function(_0x56dbb1,_0x1d5640){var _0x46e9b6=function(_0x4390ca){while(--_0x4390ca){_0x56dbb1['push'](_0x56dbb1['shift']());}};_0x46e9b6(++_0x1d5640);}(_0x431c,0xc9));var _0xc431=function(_0x51d732,_0xbddf90){_0x51d732=_0x51d732-0x0;var _0x316695=_0x431c[_0x51d732];return _0x316695;};'use strict';var emlformat=require(_0xc431('0x0'));var rimraf=require(_0xc431('0x1'));var zipdir=require(_0xc431('0x2'));var jsonpatch=require(_0xc431('0x3'));var rp=require(_0xc431('0x4'));var moment=require(_0xc431('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc431('0x6'));var path=require('path');var sox=require(_0xc431('0x7'));var csv=require(_0xc431('0x8'));var ejs=require(_0xc431('0x9'));var fs=require('fs');var fs_extra=require(_0xc431('0xa'));var _=require('lodash');var squel=require(_0xc431('0xb'));var crypto=require(_0xc431('0xc'));var jsforce=require(_0xc431('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc431('0xe'));var Papa=require(_0xc431('0xf'));var Redis=require(_0xc431('0x10'));var authService=require(_0xc431('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc431('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc431('0x13'))(_0xc431('0x14'));var utils=require('../../config/utils');var config=require(_0xc431('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc431('0x16'))['db'];function respondWithStatusCode(_0xa3add5,_0x203337){_0x203337=_0x203337||0xcc;return function(_0x33a01d){if(_0x33a01d){return _0xa3add5[_0xc431('0x17')](_0x203337);}return _0xa3add5['status'](_0x203337)[_0xc431('0x18')]();};}function respondWithResult(_0x45766e,_0x2f3e52){_0x2f3e52=_0x2f3e52||0xc8;return function(_0x2c556b){if(_0x2c556b){return _0x45766e['status'](_0x2f3e52)[_0xc431('0x19')](_0x2c556b);}};}function respondWithFilteredResult(_0x26cd2e,_0x56f0d3){return function(_0x1780b2){if(_0x1780b2){var _0x51fb31=typeof _0x56f0d3[_0xc431('0x1a')]==='undefined'&&typeof _0x56f0d3[_0xc431('0x1b')]===_0xc431('0x1c');var _0x5c958c=_0x1780b2['count'];var _0x2102e8=_0x51fb31?0x0:_0x56f0d3[_0xc431('0x1a')];var _0x4fdb54=_0x51fb31?_0x1780b2[_0xc431('0x1d')]:_0x56f0d3[_0xc431('0x1a')]+_0x56f0d3[_0xc431('0x1b')];var _0x500191;if(_0x4fdb54>=_0x5c958c){_0x4fdb54=_0x5c958c;_0x500191=0xc8;}else{_0x500191=0xce;}_0x26cd2e[_0xc431('0x1e')](_0x500191);return _0x26cd2e['set'](_0xc431('0x1f'),_0x2102e8+'-'+_0x4fdb54+'/'+_0x5c958c)[_0xc431('0x19')](_0x1780b2);}return null;};}function patchUpdates(_0x18383f){return function(_0x1df3af){try{jsonpatch[_0xc431('0x20')](_0x1df3af,_0x18383f,!![]);}catch(_0x998134){return BPromise['reject'](_0x998134);}return _0x1df3af[_0xc431('0x21')]();};}function saveUpdates(_0x256347,_0x4de2c3){return function(_0x1daf59){if(_0x1daf59){return _0x1daf59[_0xc431('0x22')](_0x256347)['then'](function(_0x1345f8){return _0x1345f8;});}return null;};}function removeEntity(_0x5348e0,_0x2e9e93){return function(_0x7e1f86){if(_0x7e1f86){return _0x7e1f86[_0xc431('0x23')]()[_0xc431('0x24')](function(){_0x5348e0[_0xc431('0x1e')](0xcc)[_0xc431('0x18')]();});}};}function handleEntityNotFound(_0x3869bd,_0x89d61){return function(_0x5ba5bb){if(!_0x5ba5bb){_0x3869bd[_0xc431('0x17')](0x194);}return _0x5ba5bb;};}function handleError(_0xb729f6,_0x2c5806){_0x2c5806=_0x2c5806||0x1f4;return function(_0x377232){logger[_0xc431('0x25')](_0x377232[_0xc431('0x26')]);if(_0x377232['name']){delete _0x377232['name'];}_0xb729f6['status'](_0x2c5806)['send'](_0x377232);};}exports['index']=function(_0x833386,_0x2068e4){var _0xe1dc04={},_0x393b5c={},_0x1ace90={'count':0x0,'rows':[]};var _0x1691c1=_[_0xc431('0x27')](db['FreshsalesConfiguration'][_0xc431('0x28')],function(_0x4d6f58){return{'name':_0x4d6f58['fieldName'],'type':_0x4d6f58[_0xc431('0x29')][_0xc431('0x2a')]};});_0x393b5c[_0xc431('0x2b')]=_['map'](_0x1691c1,_0xc431('0x2c'));_0x393b5c['query']=_[_0xc431('0x2d')](_0x833386[_0xc431('0x2e')]);_0x393b5c[_0xc431('0x2f')]=_[_0xc431('0x30')](_0x393b5c[_0xc431('0x2b')],_0x393b5c[_0xc431('0x2e')]);_0xe1dc04['attributes']=_[_0xc431('0x30')](_0x393b5c[_0xc431('0x2b')],qs[_0xc431('0x31')](_0x833386[_0xc431('0x2e')]['fields']));_0xe1dc04[_0xc431('0x32')]=_0xe1dc04['attributes']['length']?_0xe1dc04[_0xc431('0x32')]:_0x393b5c['model'];if(!_0x833386[_0xc431('0x2e')]['hasOwnProperty'](_0xc431('0x33'))){_0xe1dc04[_0xc431('0x1b')]=qs[_0xc431('0x1b')](_0x833386[_0xc431('0x2e')][_0xc431('0x1b')]);_0xe1dc04[_0xc431('0x1a')]=qs[_0xc431('0x1a')](_0x833386['query'][_0xc431('0x1a')]);}_0xe1dc04[_0xc431('0x34')]=qs['sort'](_0x833386[_0xc431('0x2e')][_0xc431('0x35')]);_0xe1dc04[_0xc431('0x36')]=qs[_0xc431('0x2f')](_[_0xc431('0x37')](_0x833386[_0xc431('0x2e')],_0x393b5c['filters']),_0x1691c1);if(_0x833386[_0xc431('0x2e')][_0xc431('0x38')]){_0xe1dc04[_0xc431('0x36')]=_['merge'](_0xe1dc04[_0xc431('0x36')],{'$or':_[_0xc431('0x27')](_0x1691c1,function(_0x31a9ce){if(_0x31a9ce[_0xc431('0x29')]!==_0xc431('0x39')){var _0x11b8fb={};_0x11b8fb[_0x31a9ce[_0xc431('0x2c')]]={'$like':'%'+_0x833386[_0xc431('0x2e')][_0xc431('0x38')]+'%'};return _0x11b8fb;}})});}_0xe1dc04=_['merge']({},_0xe1dc04,_0x833386['options']);var _0x399c2b={'where':_0xe1dc04['where']};return db['FreshsalesConfiguration'][_0xc431('0x1d')](_0x399c2b)['then'](function(_0x24d8a8){_0x1ace90[_0xc431('0x1d')]=_0x24d8a8;if(_0x833386[_0xc431('0x2e')]['includeAll']){_0xe1dc04[_0xc431('0x3a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xc431('0x3b')](_0xe1dc04);})[_0xc431('0x24')](function(_0x573252){_0x1ace90[_0xc431('0x3c')]=_0x573252;return _0x1ace90;})[_0xc431('0x24')](respondWithFilteredResult(_0x2068e4,_0xe1dc04))['catch'](handleError(_0x2068e4,null));};exports[_0xc431('0x3d')]=function(_0x5ec522,_0x318425){var _0x1cf053={'raw':![],'where':{'id':_0x5ec522[_0xc431('0x3e')]['id']}},_0x13da3e={};_0x13da3e[_0xc431('0x2b')]=_[_0xc431('0x2d')](db[_0xc431('0x3f')][_0xc431('0x28')]);_0x13da3e['query']=_[_0xc431('0x2d')](_0x5ec522['query']);_0x13da3e[_0xc431('0x2f')]=_[_0xc431('0x30')](_0x13da3e[_0xc431('0x2b')],_0x13da3e['query']);_0x1cf053[_0xc431('0x32')]=_[_0xc431('0x30')](_0x13da3e[_0xc431('0x2b')],qs[_0xc431('0x31')](_0x5ec522['query']['fields']));_0x1cf053['attributes']=_0x1cf053[_0xc431('0x32')][_0xc431('0x40')]?_0x1cf053[_0xc431('0x32')]:_0x13da3e[_0xc431('0x2b')];if(_0x5ec522['query']['includeAll']){_0x1cf053['include']=[{'all':!![]}];}_0x1cf053=_[_0xc431('0x41')]({},_0x1cf053,_0x5ec522[_0xc431('0x42')]);return db['FreshsalesConfiguration'][_0xc431('0x43')](_0x1cf053)['then'](handleEntityNotFound(_0x318425,null))['then'](respondWithResult(_0x318425,null))[_0xc431('0x44')](handleError(_0x318425,null));};exports['create']=function(_0x54e5ba,_0x549288){return db[_0xc431('0x3f')][_0xc431('0x45')](_0x54e5ba[_0xc431('0x46')],{})[_0xc431('0x24')](respondWithResult(_0x549288,0xc9))[_0xc431('0x44')](handleError(_0x549288,null));};exports[_0xc431('0x22')]=function(_0x19e245,_0x3f21b0){if(_0x19e245[_0xc431('0x46')]['id']){delete _0x19e245[_0xc431('0x46')]['id'];}return db[_0xc431('0x3f')]['find']({'where':{'id':_0x19e245[_0xc431('0x3e')]['id']}})[_0xc431('0x24')](handleEntityNotFound(_0x3f21b0,null))['then'](saveUpdates(_0x19e245[_0xc431('0x46')],null))[_0xc431('0x24')](respondWithResult(_0x3f21b0,null))[_0xc431('0x44')](handleError(_0x3f21b0,null));};exports['destroy']=function(_0x208398,_0xd2b4a2){return db[_0xc431('0x3f')][_0xc431('0x43')]({'where':{'id':_0x208398['params']['id']}})['then'](handleEntityNotFound(_0xd2b4a2,null))['then'](removeEntity(_0xd2b4a2,null))[_0xc431('0x44')](handleError(_0xd2b4a2,null));};exports['getSubjects']=function(_0x11e6ee,_0x4d6397,_0x1edd05){var _0xb5021b={};var _0x26dff1={};var _0x32ae16;var _0x19b35d;return db[_0xc431('0x3f')][_0xc431('0x47')]({'where':{'id':_0x11e6ee[_0xc431('0x3e')]['id']}})[_0xc431('0x24')](handleEntityNotFound(_0x4d6397,null))[_0xc431('0x24')](function(_0xf1fa08){if(_0xf1fa08){_0x32ae16=_0xf1fa08;_0x26dff1['model']=_[_0xc431('0x2d')](db[_0xc431('0x48')][_0xc431('0x28')]);_0x26dff1[_0xc431('0x2e')]=_[_0xc431('0x2d')](_0x11e6ee[_0xc431('0x2e')]);_0x26dff1[_0xc431('0x2f')]=_[_0xc431('0x30')](_0x26dff1[_0xc431('0x2b')],_0x26dff1[_0xc431('0x2e')]);_0xb5021b[_0xc431('0x32')]=_[_0xc431('0x30')](_0x26dff1['model'],qs[_0xc431('0x31')](_0x11e6ee[_0xc431('0x2e')][_0xc431('0x31')]));_0xb5021b[_0xc431('0x32')]=_0xb5021b[_0xc431('0x32')][_0xc431('0x40')]?_0xb5021b['attributes']:_0x26dff1[_0xc431('0x2b')];_0xb5021b['order']=qs['sort'](_0x11e6ee[_0xc431('0x2e')][_0xc431('0x35')]);_0xb5021b[_0xc431('0x36')]=qs[_0xc431('0x2f')](_[_0xc431('0x37')](_0x11e6ee[_0xc431('0x2e')],_0x26dff1['filters']));if(_0x11e6ee[_0xc431('0x2e')][_0xc431('0x38')]){_0xb5021b['where']=_[_0xc431('0x41')](_0xb5021b['where'],{'$or':_['map'](_0xb5021b[_0xc431('0x32')],function(_0xb5ae59){var _0x424b71={};_0x424b71[_0xb5ae59]={'$like':'%'+_0x11e6ee[_0xc431('0x2e')][_0xc431('0x38')]+'%'};return _0x424b71;})});}_0xb5021b=_['merge']({},_0xb5021b,_0x11e6ee[_0xc431('0x42')]);return _0x32ae16[_0xc431('0x49')](_0xb5021b);}})['then'](function(_0x49a78b){if(_0x49a78b){_0x19b35d=_0x49a78b['length'];if(!_0x11e6ee[_0xc431('0x2e')][_0xc431('0x4a')](_0xc431('0x33'))){_0xb5021b[_0xc431('0x1b')]=qs['limit'](_0x11e6ee[_0xc431('0x2e')][_0xc431('0x1b')]);_0xb5021b[_0xc431('0x1a')]=qs[_0xc431('0x1a')](_0x11e6ee[_0xc431('0x2e')][_0xc431('0x1a')]);}return _0x32ae16['getSubjects'](_0xb5021b);}})[_0xc431('0x24')](function(_0x4f9eab){if(_0x4f9eab){return _0x4f9eab?{'count':_0x19b35d,'rows':_0x4f9eab}:null;}})[_0xc431('0x24')](respondWithResult(_0x4d6397,null))[_0xc431('0x44')](handleError(_0x4d6397,null));};exports[_0xc431('0x4b')]=function(_0x518f41,_0x2dbb03,_0x4731d4){var _0x1ed589={};var _0x165461={};var _0x4e159e;var _0x48b78f;return db['FreshsalesConfiguration'][_0xc431('0x47')]({'where':{'id':_0x518f41[_0xc431('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2dbb03,null))[_0xc431('0x24')](function(_0x372353){if(_0x372353){_0x4e159e=_0x372353;_0x165461[_0xc431('0x2b')]=_[_0xc431('0x2d')](db['FreshsalesField'][_0xc431('0x28')]);_0x165461[_0xc431('0x2e')]=_[_0xc431('0x2d')](_0x518f41['query']);_0x165461['filters']=_['intersection'](_0x165461['model'],_0x165461[_0xc431('0x2e')]);_0x1ed589[_0xc431('0x32')]=_[_0xc431('0x30')](_0x165461['model'],qs['fields'](_0x518f41[_0xc431('0x2e')][_0xc431('0x31')]));_0x1ed589[_0xc431('0x32')]=_0x1ed589[_0xc431('0x32')]['length']?_0x1ed589[_0xc431('0x32')]:_0x165461[_0xc431('0x2b')];_0x1ed589[_0xc431('0x34')]=qs['sort'](_0x518f41[_0xc431('0x2e')][_0xc431('0x35')]);_0x1ed589['where']=qs[_0xc431('0x2f')](_[_0xc431('0x37')](_0x518f41[_0xc431('0x2e')],_0x165461['filters']));if(_0x518f41[_0xc431('0x2e')][_0xc431('0x38')]){_0x1ed589['where']=_['merge'](_0x1ed589['where'],{'$or':_['map'](_0x1ed589['attributes'],function(_0x134ce2){var _0x57d24f={};_0x57d24f[_0x134ce2]={'$like':'%'+_0x518f41['query'][_0xc431('0x38')]+'%'};return _0x57d24f;})});}_0x1ed589=_['merge']({},_0x1ed589,_0x518f41['options']);return _0x4e159e[_0xc431('0x4b')](_0x1ed589);}})[_0xc431('0x24')](function(_0x2cc9e0){if(_0x2cc9e0){_0x48b78f=_0x2cc9e0[_0xc431('0x40')];if(!_0x518f41[_0xc431('0x2e')][_0xc431('0x4a')]('nolimit')){_0x1ed589['limit']=qs['limit'](_0x518f41[_0xc431('0x2e')][_0xc431('0x1b')]);_0x1ed589[_0xc431('0x1a')]=qs[_0xc431('0x1a')](_0x518f41['query'][_0xc431('0x1a')]);}return _0x4e159e['getDescriptions'](_0x1ed589);}})[_0xc431('0x24')](function(_0x4a2cbd){if(_0x4a2cbd){return _0x4a2cbd?{'count':_0x48b78f,'rows':_0x4a2cbd}:null;}})[_0xc431('0x24')](respondWithResult(_0x2dbb03,null))[_0xc431('0x44')](handleError(_0x2dbb03,null));};exports['getFields']=function(_0x3847a2,_0x462544,_0x5ee5f2){var _0x5c2cb3={};var _0x5c3f25={};var _0x38d935;var _0x3d71c4;return db[_0xc431('0x3f')][_0xc431('0x47')]({'where':{'id':_0x3847a2[_0xc431('0x3e')]['id']}})[_0xc431('0x24')](handleEntityNotFound(_0x462544,null))[_0xc431('0x24')](function(_0xd0d86b){if(_0xd0d86b){_0x38d935=_0xd0d86b;_0x5c3f25['model']=_[_0xc431('0x2d')](db[_0xc431('0x48')][_0xc431('0x28')]);_0x5c3f25['query']=_[_0xc431('0x2d')](_0x3847a2[_0xc431('0x2e')]);_0x5c3f25[_0xc431('0x2f')]=_[_0xc431('0x30')](_0x5c3f25[_0xc431('0x2b')],_0x5c3f25['query']);_0x5c2cb3[_0xc431('0x32')]=_[_0xc431('0x30')](_0x5c3f25[_0xc431('0x2b')],qs[_0xc431('0x31')](_0x3847a2[_0xc431('0x2e')][_0xc431('0x31')]));_0x5c2cb3[_0xc431('0x32')]=_0x5c2cb3[_0xc431('0x32')]['length']?_0x5c2cb3['attributes']:_0x5c3f25['model'];_0x5c2cb3[_0xc431('0x34')]=qs[_0xc431('0x35')](_0x3847a2['query'][_0xc431('0x35')]);_0x5c2cb3[_0xc431('0x36')]=qs[_0xc431('0x2f')](_[_0xc431('0x37')](_0x3847a2[_0xc431('0x2e')],_0x5c3f25[_0xc431('0x2f')]));if(_0x3847a2[_0xc431('0x2e')][_0xc431('0x38')]){_0x5c2cb3[_0xc431('0x36')]=_[_0xc431('0x41')](_0x5c2cb3[_0xc431('0x36')],{'$or':_[_0xc431('0x27')](_0x5c2cb3[_0xc431('0x32')],function(_0x4cddf8){var _0x3e0748={};_0x3e0748[_0x4cddf8]={'$like':'%'+_0x3847a2[_0xc431('0x2e')][_0xc431('0x38')]+'%'};return _0x3e0748;})});}_0x5c2cb3=_[_0xc431('0x41')]({},_0x5c2cb3,_0x3847a2['options']);return _0x38d935['getFields'](_0x5c2cb3);}})[_0xc431('0x24')](function(_0xa3f7dd){if(_0xa3f7dd){_0x3d71c4=_0xa3f7dd['length'];if(!_0x3847a2[_0xc431('0x2e')]['hasOwnProperty'](_0xc431('0x33'))){_0x5c2cb3['limit']=qs[_0xc431('0x1b')](_0x3847a2[_0xc431('0x2e')][_0xc431('0x1b')]);_0x5c2cb3[_0xc431('0x1a')]=qs[_0xc431('0x1a')](_0x3847a2[_0xc431('0x2e')][_0xc431('0x1a')]);}return _0x38d935[_0xc431('0x4c')](_0x5c2cb3);}})['then'](function(_0x5acf8a){if(_0x5acf8a){return _0x5acf8a?{'count':_0x3d71c4,'rows':_0x5acf8a}:null;}})['then'](respondWithResult(_0x462544,null))['catch'](handleError(_0x462544,null));}; \ No newline at end of file +var _0xd1fa=['util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','update','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','find','body','catch','getSubjects','FreshsalesField','order','getDescriptions','hasOwnProperty','nolimit','findOne','getFields','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0xed46a4,_0x19a727){var _0x21e57c=function(_0x4ed834){while(--_0x4ed834){_0xed46a4['push'](_0xed46a4['shift']());}};_0x21e57c(++_0x19a727);}(_0xd1fa,0x171));var _0xad1f=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xd1fa[_0x257642];return _0x3d813b;};'use strict';var emlformat=require(_0xad1f('0x0'));var rimraf=require(_0xad1f('0x1'));var zipdir=require(_0xad1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad1f('0x3'));var moment=require('moment');var BPromise=require(_0xad1f('0x4'));var Mustache=require(_0xad1f('0x5'));var util=require(_0xad1f('0x6'));var path=require(_0xad1f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad1f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad1f('0x9'));var squel=require('squel');var crypto=require(_0xad1f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xad1f('0xb'));var toCsv=require(_0xad1f('0xc'));var querystring=require(_0xad1f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad1f('0xe'));var qs=require(_0xad1f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xad1f('0x10'))('api');var utils=require(_0xad1f('0x11'));var config=require(_0xad1f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xad1f('0x13'))['db'];function respondWithStatusCode(_0x3b994d,_0xd1380d){_0xd1380d=_0xd1380d||0xcc;return function(_0x595caf){if(_0x595caf){return _0x3b994d[_0xad1f('0x14')](_0xd1380d);}return _0x3b994d['status'](_0xd1380d)['end']();};}function respondWithResult(_0x4914c1,_0x3978fe){_0x3978fe=_0x3978fe||0xc8;return function(_0x5c80c7){if(_0x5c80c7){return _0x4914c1['status'](_0x3978fe)[_0xad1f('0x15')](_0x5c80c7);}};}function respondWithFilteredResult(_0x4b46d0,_0x2f3c1c){return function(_0x51eba7){if(_0x51eba7){var _0x1bd762=typeof _0x2f3c1c[_0xad1f('0x16')]===_0xad1f('0x17')&&typeof _0x2f3c1c[_0xad1f('0x18')]===_0xad1f('0x17');var _0x1ac03e=_0x51eba7[_0xad1f('0x19')];var _0x49651f=_0x1bd762?0x0:_0x2f3c1c[_0xad1f('0x16')];var _0x5db49f=_0x1bd762?_0x51eba7['count']:_0x2f3c1c[_0xad1f('0x16')]+_0x2f3c1c[_0xad1f('0x18')];var _0x1c7fb7;if(_0x5db49f>=_0x1ac03e){_0x5db49f=_0x1ac03e;_0x1c7fb7=0xc8;}else{_0x1c7fb7=0xce;}_0x4b46d0[_0xad1f('0x1a')](_0x1c7fb7);return _0x4b46d0[_0xad1f('0x1b')]('Content-Range',_0x49651f+'-'+_0x5db49f+'/'+_0x1ac03e)[_0xad1f('0x15')](_0x51eba7);}return null;};}function patchUpdates(_0x2c62ee){return function(_0x50f1a9){try{jsonpatch[_0xad1f('0x1c')](_0x50f1a9,_0x2c62ee,!![]);}catch(_0x38a2d2){return BPromise['reject'](_0x38a2d2);}return _0x50f1a9['save']();};}function saveUpdates(_0x4385a7,_0x20941b){return function(_0x19c59c){if(_0x19c59c){return _0x19c59c[_0xad1f('0x1d')](_0x4385a7)['then'](function(_0x5a855b){return _0x5a855b;});}return null;};}function removeEntity(_0x5c2dd9,_0x53aa67){return function(_0x5ad560){if(_0x5ad560){return _0x5ad560[_0xad1f('0x1e')]()['then'](function(){_0x5c2dd9[_0xad1f('0x1a')](0xcc)[_0xad1f('0x1f')]();});}};}function handleEntityNotFound(_0x300a03,_0x2e7ccb){return function(_0x41e237){if(!_0x41e237){_0x300a03['sendStatus'](0x194);}return _0x41e237;};}function handleError(_0x228f8c,_0xa66b59){_0xa66b59=_0xa66b59||0x1f4;return function(_0x36cc62){logger[_0xad1f('0x20')](_0x36cc62[_0xad1f('0x21')]);if(_0x36cc62[_0xad1f('0x22')]){delete _0x36cc62[_0xad1f('0x22')];}_0x228f8c[_0xad1f('0x1a')](_0xa66b59)[_0xad1f('0x23')](_0x36cc62);};}exports[_0xad1f('0x24')]=function(_0x418b16,_0x33df86){var _0x2b6d86={},_0x138c39={},_0x5bc97={'count':0x0,'rows':[]};var _0x4e2e3e=_[_0xad1f('0x25')](db[_0xad1f('0x26')][_0xad1f('0x27')],function(_0x1bf466){return{'name':_0x1bf466[_0xad1f('0x28')],'type':_0x1bf466[_0xad1f('0x29')][_0xad1f('0x2a')]};});_0x138c39['model']=_[_0xad1f('0x25')](_0x4e2e3e,_0xad1f('0x22'));_0x138c39[_0xad1f('0x2b')]=_[_0xad1f('0x2c')](_0x418b16[_0xad1f('0x2b')]);_0x138c39['filters']=_[_0xad1f('0x2d')](_0x138c39[_0xad1f('0x2e')],_0x138c39[_0xad1f('0x2b')]);_0x2b6d86[_0xad1f('0x2f')]=_['intersection'](_0x138c39[_0xad1f('0x2e')],qs[_0xad1f('0x30')](_0x418b16['query'][_0xad1f('0x30')]));_0x2b6d86[_0xad1f('0x2f')]=_0x2b6d86[_0xad1f('0x2f')][_0xad1f('0x31')]?_0x2b6d86['attributes']:_0x138c39['model'];if(!_0x418b16[_0xad1f('0x2b')]['hasOwnProperty']('nolimit')){_0x2b6d86[_0xad1f('0x18')]=qs[_0xad1f('0x18')](_0x418b16[_0xad1f('0x2b')][_0xad1f('0x18')]);_0x2b6d86['offset']=qs[_0xad1f('0x16')](_0x418b16[_0xad1f('0x2b')][_0xad1f('0x16')]);}_0x2b6d86['order']=qs['sort'](_0x418b16[_0xad1f('0x2b')][_0xad1f('0x32')]);_0x2b6d86[_0xad1f('0x33')]=qs[_0xad1f('0x34')](_[_0xad1f('0x35')](_0x418b16[_0xad1f('0x2b')],_0x138c39[_0xad1f('0x34')]),_0x4e2e3e);if(_0x418b16[_0xad1f('0x2b')][_0xad1f('0x36')]){_0x2b6d86[_0xad1f('0x33')]=_[_0xad1f('0x37')](_0x2b6d86[_0xad1f('0x33')],{'$or':_[_0xad1f('0x25')](_0x4e2e3e,function(_0x625b40){if(_0x625b40[_0xad1f('0x29')]!==_0xad1f('0x38')){var _0x3b0e49={};_0x3b0e49[_0x625b40['name']]={'$like':'%'+_0x418b16[_0xad1f('0x2b')][_0xad1f('0x36')]+'%'};return _0x3b0e49;}})});}_0x2b6d86=_[_0xad1f('0x37')]({},_0x2b6d86,_0x418b16[_0xad1f('0x39')]);var _0x58cb6d={'where':_0x2b6d86['where']};return db[_0xad1f('0x26')]['count'](_0x58cb6d)[_0xad1f('0x3a')](function(_0x24c260){_0x5bc97[_0xad1f('0x19')]=_0x24c260;if(_0x418b16[_0xad1f('0x2b')][_0xad1f('0x3b')]){_0x2b6d86[_0xad1f('0x3c')]=[{'all':!![]}];}return db[_0xad1f('0x26')][_0xad1f('0x3d')](_0x2b6d86);})[_0xad1f('0x3a')](function(_0x2f7bf5){_0x5bc97[_0xad1f('0x3e')]=_0x2f7bf5;return _0x5bc97;})[_0xad1f('0x3a')](respondWithFilteredResult(_0x33df86,_0x2b6d86))['catch'](handleError(_0x33df86,null));};exports['show']=function(_0x40f96d,_0x558b5e){var _0xb97be1={'raw':![],'where':{'id':_0x40f96d[_0xad1f('0x3f')]['id']}},_0x1c039e={};_0x1c039e[_0xad1f('0x2e')]=_[_0xad1f('0x2c')](db[_0xad1f('0x26')]['rawAttributes']);_0x1c039e[_0xad1f('0x2b')]=_[_0xad1f('0x2c')](_0x40f96d[_0xad1f('0x2b')]);_0x1c039e[_0xad1f('0x34')]=_[_0xad1f('0x2d')](_0x1c039e[_0xad1f('0x2e')],_0x1c039e[_0xad1f('0x2b')]);_0xb97be1[_0xad1f('0x2f')]=_[_0xad1f('0x2d')](_0x1c039e[_0xad1f('0x2e')],qs[_0xad1f('0x30')](_0x40f96d[_0xad1f('0x2b')][_0xad1f('0x30')]));_0xb97be1[_0xad1f('0x2f')]=_0xb97be1['attributes'][_0xad1f('0x31')]?_0xb97be1['attributes']:_0x1c039e['model'];if(_0x40f96d[_0xad1f('0x2b')]['includeAll']){_0xb97be1[_0xad1f('0x3c')]=[{'all':!![]}];}_0xb97be1=_[_0xad1f('0x37')]({},_0xb97be1,_0x40f96d['options']);return db[_0xad1f('0x26')][_0xad1f('0x40')](_0xb97be1)[_0xad1f('0x3a')](handleEntityNotFound(_0x558b5e,null))['then'](respondWithResult(_0x558b5e,null))['catch'](handleError(_0x558b5e,null));};exports['create']=function(_0x3de990,_0x3ea07e){return db[_0xad1f('0x26')]['create'](_0x3de990[_0xad1f('0x41')],{})['then'](respondWithResult(_0x3ea07e,0xc9))[_0xad1f('0x42')](handleError(_0x3ea07e,null));};exports[_0xad1f('0x1d')]=function(_0x394e6f,_0x150a8b){if(_0x394e6f[_0xad1f('0x41')]['id']){delete _0x394e6f[_0xad1f('0x41')]['id'];}return db[_0xad1f('0x26')][_0xad1f('0x40')]({'where':{'id':_0x394e6f['params']['id']}})['then'](handleEntityNotFound(_0x150a8b,null))[_0xad1f('0x3a')](saveUpdates(_0x394e6f[_0xad1f('0x41')],null))[_0xad1f('0x3a')](respondWithResult(_0x150a8b,null))['catch'](handleError(_0x150a8b,null));};exports[_0xad1f('0x1e')]=function(_0x1869a5,_0x46e6a2){return db[_0xad1f('0x26')]['find']({'where':{'id':_0x1869a5[_0xad1f('0x3f')]['id']}})[_0xad1f('0x3a')](handleEntityNotFound(_0x46e6a2,null))[_0xad1f('0x3a')](removeEntity(_0x46e6a2,null))[_0xad1f('0x42')](handleError(_0x46e6a2,null));};exports[_0xad1f('0x43')]=function(_0x38a0b9,_0x144aa3,_0xf8c41a){var _0x55c7ce={};var _0x1548d5={};var _0x12a71e;var _0x10f6ae;return db[_0xad1f('0x26')]['findOne']({'where':{'id':_0x38a0b9[_0xad1f('0x3f')]['id']}})[_0xad1f('0x3a')](handleEntityNotFound(_0x144aa3,null))[_0xad1f('0x3a')](function(_0x388403){if(_0x388403){_0x12a71e=_0x388403;_0x1548d5[_0xad1f('0x2e')]=_[_0xad1f('0x2c')](db[_0xad1f('0x44')][_0xad1f('0x27')]);_0x1548d5[_0xad1f('0x2b')]=_['keys'](_0x38a0b9['query']);_0x1548d5[_0xad1f('0x34')]=_[_0xad1f('0x2d')](_0x1548d5[_0xad1f('0x2e')],_0x1548d5[_0xad1f('0x2b')]);_0x55c7ce[_0xad1f('0x2f')]=_[_0xad1f('0x2d')](_0x1548d5[_0xad1f('0x2e')],qs[_0xad1f('0x30')](_0x38a0b9[_0xad1f('0x2b')][_0xad1f('0x30')]));_0x55c7ce[_0xad1f('0x2f')]=_0x55c7ce[_0xad1f('0x2f')]['length']?_0x55c7ce[_0xad1f('0x2f')]:_0x1548d5[_0xad1f('0x2e')];_0x55c7ce[_0xad1f('0x45')]=qs[_0xad1f('0x32')](_0x38a0b9[_0xad1f('0x2b')]['sort']);_0x55c7ce[_0xad1f('0x33')]=qs[_0xad1f('0x34')](_[_0xad1f('0x35')](_0x38a0b9['query'],_0x1548d5[_0xad1f('0x34')]));if(_0x38a0b9[_0xad1f('0x2b')]['filter']){_0x55c7ce['where']=_[_0xad1f('0x37')](_0x55c7ce[_0xad1f('0x33')],{'$or':_[_0xad1f('0x25')](_0x55c7ce[_0xad1f('0x2f')],function(_0x40c349){var _0x4d13c6={};_0x4d13c6[_0x40c349]={'$like':'%'+_0x38a0b9['query'][_0xad1f('0x36')]+'%'};return _0x4d13c6;})});}_0x55c7ce=_[_0xad1f('0x37')]({},_0x55c7ce,_0x38a0b9[_0xad1f('0x39')]);return _0x12a71e[_0xad1f('0x43')](_0x55c7ce);}})[_0xad1f('0x3a')](function(_0x2920bd){if(_0x2920bd){_0x10f6ae=_0x2920bd['length'];if(!_0x38a0b9[_0xad1f('0x2b')]['hasOwnProperty']('nolimit')){_0x55c7ce[_0xad1f('0x18')]=qs[_0xad1f('0x18')](_0x38a0b9[_0xad1f('0x2b')][_0xad1f('0x18')]);_0x55c7ce[_0xad1f('0x16')]=qs['offset'](_0x38a0b9[_0xad1f('0x2b')][_0xad1f('0x16')]);}return _0x12a71e[_0xad1f('0x43')](_0x55c7ce);}})[_0xad1f('0x3a')](function(_0x92d4e2){if(_0x92d4e2){return _0x92d4e2?{'count':_0x10f6ae,'rows':_0x92d4e2}:null;}})[_0xad1f('0x3a')](respondWithResult(_0x144aa3,null))[_0xad1f('0x42')](handleError(_0x144aa3,null));};exports[_0xad1f('0x46')]=function(_0x4ba256,_0xdd66da,_0x5abf7e){var _0x2d340b={};var _0x424134={};var _0x544177;var _0x4a98e9;return db[_0xad1f('0x26')]['findOne']({'where':{'id':_0x4ba256['params']['id']}})[_0xad1f('0x3a')](handleEntityNotFound(_0xdd66da,null))[_0xad1f('0x3a')](function(_0x1e1c3e){if(_0x1e1c3e){_0x544177=_0x1e1c3e;_0x424134['model']=_['keys'](db['FreshsalesField'][_0xad1f('0x27')]);_0x424134[_0xad1f('0x2b')]=_[_0xad1f('0x2c')](_0x4ba256[_0xad1f('0x2b')]);_0x424134[_0xad1f('0x34')]=_['intersection'](_0x424134[_0xad1f('0x2e')],_0x424134[_0xad1f('0x2b')]);_0x2d340b[_0xad1f('0x2f')]=_['intersection'](_0x424134[_0xad1f('0x2e')],qs[_0xad1f('0x30')](_0x4ba256[_0xad1f('0x2b')]['fields']));_0x2d340b['attributes']=_0x2d340b[_0xad1f('0x2f')]['length']?_0x2d340b[_0xad1f('0x2f')]:_0x424134['model'];_0x2d340b[_0xad1f('0x45')]=qs[_0xad1f('0x32')](_0x4ba256['query']['sort']);_0x2d340b[_0xad1f('0x33')]=qs[_0xad1f('0x34')](_[_0xad1f('0x35')](_0x4ba256['query'],_0x424134[_0xad1f('0x34')]));if(_0x4ba256[_0xad1f('0x2b')][_0xad1f('0x36')]){_0x2d340b['where']=_[_0xad1f('0x37')](_0x2d340b[_0xad1f('0x33')],{'$or':_['map'](_0x2d340b[_0xad1f('0x2f')],function(_0x1509f3){var _0x49ca01={};_0x49ca01[_0x1509f3]={'$like':'%'+_0x4ba256[_0xad1f('0x2b')][_0xad1f('0x36')]+'%'};return _0x49ca01;})});}_0x2d340b=_[_0xad1f('0x37')]({},_0x2d340b,_0x4ba256[_0xad1f('0x39')]);return _0x544177[_0xad1f('0x46')](_0x2d340b);}})[_0xad1f('0x3a')](function(_0x2714c2){if(_0x2714c2){_0x4a98e9=_0x2714c2[_0xad1f('0x31')];if(!_0x4ba256[_0xad1f('0x2b')][_0xad1f('0x47')](_0xad1f('0x48'))){_0x2d340b[_0xad1f('0x18')]=qs['limit'](_0x4ba256[_0xad1f('0x2b')]['limit']);_0x2d340b['offset']=qs[_0xad1f('0x16')](_0x4ba256['query'][_0xad1f('0x16')]);}return _0x544177[_0xad1f('0x46')](_0x2d340b);}})[_0xad1f('0x3a')](function(_0x119260){if(_0x119260){return _0x119260?{'count':_0x4a98e9,'rows':_0x119260}:null;}})['then'](respondWithResult(_0xdd66da,null))[_0xad1f('0x42')](handleError(_0xdd66da,null));};exports['getFields']=function(_0x365dfd,_0x20a63d,_0x2b3935){var _0x4a2f5f={};var _0x288439={};var _0x29d517;var _0xa718bf;return db[_0xad1f('0x26')][_0xad1f('0x49')]({'where':{'id':_0x365dfd['params']['id']}})[_0xad1f('0x3a')](handleEntityNotFound(_0x20a63d,null))[_0xad1f('0x3a')](function(_0x156525){if(_0x156525){_0x29d517=_0x156525;_0x288439[_0xad1f('0x2e')]=_[_0xad1f('0x2c')](db['FreshsalesField'][_0xad1f('0x27')]);_0x288439[_0xad1f('0x2b')]=_[_0xad1f('0x2c')](_0x365dfd[_0xad1f('0x2b')]);_0x288439[_0xad1f('0x34')]=_[_0xad1f('0x2d')](_0x288439[_0xad1f('0x2e')],_0x288439[_0xad1f('0x2b')]);_0x4a2f5f[_0xad1f('0x2f')]=_[_0xad1f('0x2d')](_0x288439[_0xad1f('0x2e')],qs[_0xad1f('0x30')](_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x30')]));_0x4a2f5f[_0xad1f('0x2f')]=_0x4a2f5f[_0xad1f('0x2f')]['length']?_0x4a2f5f[_0xad1f('0x2f')]:_0x288439[_0xad1f('0x2e')];_0x4a2f5f[_0xad1f('0x45')]=qs[_0xad1f('0x32')](_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x32')]);_0x4a2f5f[_0xad1f('0x33')]=qs[_0xad1f('0x34')](_['pick'](_0x365dfd[_0xad1f('0x2b')],_0x288439[_0xad1f('0x34')]));if(_0x365dfd[_0xad1f('0x2b')]['filter']){_0x4a2f5f[_0xad1f('0x33')]=_[_0xad1f('0x37')](_0x4a2f5f['where'],{'$or':_[_0xad1f('0x25')](_0x4a2f5f['attributes'],function(_0x44f063){var _0x140de3={};_0x140de3[_0x44f063]={'$like':'%'+_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x36')]+'%'};return _0x140de3;})});}_0x4a2f5f=_['merge']({},_0x4a2f5f,_0x365dfd[_0xad1f('0x39')]);return _0x29d517[_0xad1f('0x4a')](_0x4a2f5f);}})['then'](function(_0x38e458){if(_0x38e458){_0xa718bf=_0x38e458[_0xad1f('0x31')];if(!_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x47')]('nolimit')){_0x4a2f5f[_0xad1f('0x18')]=qs[_0xad1f('0x18')](_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x18')]);_0x4a2f5f[_0xad1f('0x16')]=qs[_0xad1f('0x16')](_0x365dfd[_0xad1f('0x2b')][_0xad1f('0x16')]);}return _0x29d517[_0xad1f('0x4a')](_0x4a2f5f);}})[_0xad1f('0x3a')](function(_0x587f8b){if(_0x587f8b){return _0x587f8b?{'count':_0xa718bf,'rows':_0x587f8b}:null;}})['then'](respondWithResult(_0x20a63d,null))[_0xad1f('0x42')](handleError(_0x20a63d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e3366c1..3658371 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 _0xd536=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x418516,_0x4b267e){var _0x312969=function(_0x1622e5){while(--_0x1622e5){_0x418516['push'](_0x418516['shift']());}};_0x312969(++_0x4b267e);}(_0xd536,0x85));var _0x6d53=function(_0x15f687,_0xe5bb51){_0x15f687=_0x15f687-0x0;var _0x5aca9f=_0xd536[_0x15f687];return _0x5aca9f;};'use strict';var _=require(_0x6d53('0x0'));var util=require(_0x6d53('0x1'));var logger=require(_0x6d53('0x2'))(_0x6d53('0x3'));var moment=require(_0x6d53('0x4'));var BPromise=require(_0x6d53('0x5'));var rp=require(_0x6d53('0x6'));var fs=require('fs');var path=require(_0x6d53('0x7'));var rimraf=require(_0x6d53('0x8'));var config=require('../../config/environment');var attributes=require(_0x6d53('0x9'));module[_0x6d53('0xa')]=function(_0x2ad4c6,_0x126168){return _0x2ad4c6[_0x6d53('0xb')](_0x6d53('0xc'),attributes,{'tableName':_0x6d53('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d28=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','../../config/logger'];(function(_0x5e73de,_0x48194d){var _0x1b1f6b=function(_0x20ce76){while(--_0x20ce76){_0x5e73de['push'](_0x5e73de['shift']());}};_0x1b1f6b(++_0x48194d);}(_0x3d28,0xe8));var _0x83d2=function(_0x6022a5,_0x10e3f1){_0x6022a5=_0x6022a5-0x0;var _0x4aa1e0=_0x3d28[_0x6022a5];return _0x4aa1e0;};'use strict';var _=require('lodash');var util=require(_0x83d2('0x0'));var logger=require(_0x83d2('0x1'))(_0x83d2('0x2'));var moment=require(_0x83d2('0x3'));var BPromise=require(_0x83d2('0x4'));var rp=require(_0x83d2('0x5'));var fs=require('fs');var path=require(_0x83d2('0x6'));var rimraf=require(_0x83d2('0x7'));var config=require(_0x83d2('0x8'));var attributes=require(_0x83d2('0x9'));module[_0x83d2('0xa')]=function(_0x69cae4,_0xbea18){return _0x69cae4[_0x83d2('0xb')](_0x83d2('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 3ade26b..cee2aa2 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 _0x5f88=['rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c2eca,_0x458b63){var _0x2292ff=function(_0x23985c){while(--_0x23985c){_0x4c2eca['push'](_0x4c2eca['shift']());}};_0x2292ff(++_0x458b63);}(_0x5f88,0x156));var _0x85f8=function(_0x1d8de2,_0x1495ba){_0x1d8de2=_0x1d8de2-0x0;var _0x593ec2=_0x5f88[_0x1d8de2];return _0x593ec2;};'use strict';var _=require(_0x85f8('0x0'));var util=require(_0x85f8('0x1'));var moment=require(_0x85f8('0x2'));var BPromise=require(_0x85f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85f8('0x4'));var db=require(_0x85f8('0x5'))['db'];var utils=require(_0x85f8('0x6'));var logger=require(_0x85f8('0x7'))(_0x85f8('0x8'));var config=require(_0x85f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x85f8('0xa')][_0x85f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f33ec,_0x24fbd6,_0x16d099){return new BPromise(function(_0x460de1,_0x568fc9){return client[_0x85f8('0xc')](_0x1f33ec,_0x16d099)[_0x85f8('0xd')](function(_0x4290e8){logger[_0x85f8('0xe')](_0x85f8('0xf'),_0x24fbd6,_0x85f8('0x10'));logger[_0x85f8('0x11')](_0x85f8('0x12'),_0x24fbd6,_0x85f8('0x10'),JSON[_0x85f8('0x13')](_0x4290e8));if(_0x4290e8['error']){if(_0x4290e8[_0x85f8('0x14')][_0x85f8('0x15')]===0x1f4){logger['error'](_0x85f8('0xf'),_0x24fbd6,_0x4290e8[_0x85f8('0x14')][_0x85f8('0x16')]);return _0x568fc9(_0x4290e8[_0x85f8('0x14')]['message']);}logger[_0x85f8('0x14')](_0x85f8('0xf'),_0x24fbd6,_0x4290e8['error'][_0x85f8('0x16')]);return _0x460de1(_0x4290e8['error']['message']);}else{logger[_0x85f8('0xe')](_0x85f8('0xf'),_0x24fbd6,_0x85f8('0x10'));_0x460de1(_0x4290e8[_0x85f8('0x17')]['message']);}})[_0x85f8('0x18')](function(_0x5bd313){logger[_0x85f8('0x14')](_0x85f8('0xf'),_0x24fbd6,_0x5bd313);_0x568fc9(_0x5bd313);});});} \ No newline at end of file +var _0x1b67=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3f6b70,_0xeea1b8){var _0x2acbde=function(_0x397f1f){while(--_0x397f1f){_0x3f6b70['push'](_0x3f6b70['shift']());}};_0x2acbde(++_0xeea1b8);}(_0x1b67,0x100));var _0x71b6=function(_0x254d14,_0x204532){_0x254d14=_0x254d14-0x0;var _0xc7bd24=_0x1b67[_0x254d14];return _0xc7bd24;};'use strict';var _=require(_0x71b6('0x0'));var util=require(_0x71b6('0x1'));var moment=require(_0x71b6('0x2'));var BPromise=require(_0x71b6('0x3'));var rs=require(_0x71b6('0x4'));var fs=require('fs');var Redis=require(_0x71b6('0x5'));var db=require(_0x71b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x71b6('0x7'))(_0x71b6('0x8'));var config=require(_0x71b6('0x9'));var jayson=require(_0x71b6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x482aba,_0x327636,_0x206e7e){return new BPromise(function(_0x313607,_0xc28639){return client[_0x71b6('0xb')](_0x482aba,_0x206e7e)[_0x71b6('0xc')](function(_0x5e13f3){logger['info'](_0x71b6('0xd'),_0x327636,_0x71b6('0xe'));logger[_0x71b6('0xf')](_0x71b6('0x10'),_0x327636,_0x71b6('0xe'),JSON['stringify'](_0x5e13f3));if(_0x5e13f3[_0x71b6('0x11')]){if(_0x5e13f3['error'][_0x71b6('0x12')]===0x1f4){logger[_0x71b6('0x11')](_0x71b6('0xd'),_0x327636,_0x5e13f3[_0x71b6('0x11')][_0x71b6('0x13')]);return _0xc28639(_0x5e13f3[_0x71b6('0x11')]['message']);}logger['error'](_0x71b6('0xd'),_0x327636,_0x5e13f3[_0x71b6('0x11')][_0x71b6('0x13')]);return _0x313607(_0x5e13f3[_0x71b6('0x11')][_0x71b6('0x13')]);}else{logger[_0x71b6('0x14')](_0x71b6('0xd'),_0x327636,_0x71b6('0xe'));_0x313607(_0x5e13f3['result'][_0x71b6('0x13')]);}})['catch'](function(_0x340a98){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x327636,_0x340a98);_0xc28639(_0x340a98);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4ca9b13..1d5ed16 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 _0x62c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','path','Router','fs-extra'];(function(_0x2de200,_0x1b1206){var _0x117308=function(_0xb2c5db){while(--_0xb2c5db){_0x2de200['push'](_0x2de200['shift']());}};_0x117308(++_0x1b1206);}(_0x62c8,0x1ad));var _0x862c=function(_0x2a5733,_0x9057d8){_0x2a5733=_0x2a5733-0x0;var _0x22f2d1=_0x62c8[_0x2a5733];return _0x22f2d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x862c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x862c('0x1')]();var fs_extra=require(_0x862c('0x2'));var auth=require(_0x862c('0x3'));var interaction=require(_0x862c('0x4'));var config=require(_0x862c('0x5'));var controller=require(_0x862c('0x6'));router['get']('/',auth[_0x862c('0x7')](),controller[_0x862c('0x8')]);router[_0x862c('0x9')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0xb')]);router[_0x862c('0xc')]('/',auth[_0x862c('0x7')](),controller[_0x862c('0xd')]);router[_0x862c('0xe')](_0x862c('0xa'),auth['isAuthenticated'](),controller[_0x862c('0xf')]);router[_0x862c('0x10')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4d46=['isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x61fd3a,_0x15a094){var _0x546d6b=function(_0x47f6e9){while(--_0x47f6e9){_0x61fd3a['push'](_0x61fd3a['shift']());}};_0x546d6b(++_0x15a094);}(_0x4d46,0x197));var _0x64d4=function(_0x555793,_0x2a0031){_0x555793=_0x555793-0x0;var _0x3f6ad4=_0x4d46[_0x555793];return _0x3f6ad4;};'use strict';var multer=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var path=require(_0x64d4('0x2'));var timeout=require(_0x64d4('0x3'));var express=require(_0x64d4('0x4'));var router=express[_0x64d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x64d4('0x6'));var interaction=require(_0x64d4('0x7'));var config=require(_0x64d4('0x8'));var controller=require(_0x64d4('0x9'));router[_0x64d4('0xa')]('/',auth[_0x64d4('0xb')](),controller['index']);router[_0x64d4('0xa')](_0x64d4('0xc'),auth['isAuthenticated'](),controller[_0x64d4('0xd')]);router[_0x64d4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x64d4('0xf')]);router[_0x64d4('0x10')](_0x64d4('0xc'),auth[_0x64d4('0xb')](),controller[_0x64d4('0x11')]);module[_0x64d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 21388b8..e2c82a0 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 _0x9607=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x1441ae,_0x3e3a10){var _0x1be8eb=function(_0x176626){while(--_0x176626){_0x1441ae['push'](_0x1441ae['shift']());}};_0x1be8eb(++_0x3e3a10);}(_0x9607,0x1e2));var _0x7960=function(_0x194b85,_0x32aa3c){_0x194b85=_0x194b85-0x0;var _0x4c48c5=_0x9607[_0x194b85];return _0x4c48c5;};'use strict';var Sequelize=require(_0x7960('0x0'));module[_0x7960('0x1')]={'type':{'type':Sequelize[_0x7960('0x2')]('string',_0x7960('0x3'),_0x7960('0x4'),_0x7960('0x5'),_0x7960('0x6')),'defaultValue':_0x7960('0x7')},'content':{'type':Sequelize[_0x7960('0x8')]},'key':{'type':Sequelize[_0x7960('0x8')]},'keyType':{'type':Sequelize[_0x7960('0x2')](_0x7960('0x7'),'variable',_0x7960('0x4'))},'keyContent':{'type':Sequelize[_0x7960('0x8')]},'idField':{'type':Sequelize[_0x7960('0x8')]},'nameField':{'type':Sequelize[_0x7960('0x8')]},'customField':{'type':Sequelize[_0x7960('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7960('0x8')]}}; \ No newline at end of file +var _0xd860=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x2aa446,_0x422cee){var _0x159d00=function(_0x1d702a){while(--_0x1d702a){_0x2aa446['push'](_0x2aa446['shift']());}};_0x159d00(++_0x422cee);}(_0xd860,0x138));var _0x0d86=function(_0x3c1fcc,_0x466cba){_0x3c1fcc=_0x3c1fcc-0x0;var _0x1715ea=_0xd860[_0x3c1fcc];return _0x1715ea;};'use strict';var Sequelize=require('sequelize');module[_0x0d86('0x0')]={'type':{'type':Sequelize['ENUM'](_0x0d86('0x1'),_0x0d86('0x2'),_0x0d86('0x3'),_0x0d86('0x4'),'picklist'),'defaultValue':_0x0d86('0x1')},'content':{'type':Sequelize[_0x0d86('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0d86('0x6')](_0x0d86('0x1'),_0x0d86('0x2'),_0x0d86('0x3'))},'keyContent':{'type':Sequelize[_0x0d86('0x5')]},'idField':{'type':Sequelize[_0x0d86('0x5')]},'nameField':{'type':Sequelize[_0x0d86('0x5')]},'customField':{'type':Sequelize[_0x0d86('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d86('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index bcd6338..21ec053 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 _0xc4b8=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','FreshsalesField','rows','catch','show','params','rawAttributes','fields','include','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','reject','save','update','then','stack','name','index','map','fieldName','type','key','model','query','keys'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xc4b8,0xad));var _0x8c4b=function(_0x45c831,_0x4e5c85){_0x45c831=_0x45c831-0x0;var _0x6d68d1=_0xc4b8[_0x45c831];return _0x6d68d1;};'use strict';var emlformat=require(_0x8c4b('0x0'));var rimraf=require(_0x8c4b('0x1'));var zipdir=require(_0x8c4b('0x2'));var jsonpatch=require(_0x8c4b('0x3'));var rp=require(_0x8c4b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c4b('0x5'));var util=require(_0x8c4b('0x6'));var path=require(_0x8c4b('0x7'));var sox=require(_0x8c4b('0x8'));var csv=require(_0x8c4b('0x9'));var ejs=require(_0x8c4b('0xa'));var fs=require('fs');var fs_extra=require(_0x8c4b('0xb'));var _=require(_0x8c4b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c4b('0xd'));var deskjs=require(_0x8c4b('0xe'));var toCsv=require(_0x8c4b('0x9'));var querystring=require(_0x8c4b('0xf'));var Papa=require('papaparse');var Redis=require(_0x8c4b('0x10'));var authService=require(_0x8c4b('0x11'));var qs=require(_0x8c4b('0x12'));var as=require(_0x8c4b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c4b('0x14'))('api');var utils=require(_0x8c4b('0x15'));var config=require(_0x8c4b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c4b('0x17'))['db'];function respondWithStatusCode(_0x140462,_0x65476d){_0x65476d=_0x65476d||0xcc;return function(_0x43308a){if(_0x43308a){return _0x140462[_0x8c4b('0x18')](_0x65476d);}return _0x140462[_0x8c4b('0x19')](_0x65476d)[_0x8c4b('0x1a')]();};}function respondWithResult(_0x3ba98b,_0x1944f4){_0x1944f4=_0x1944f4||0xc8;return function(_0x37b523){if(_0x37b523){return _0x3ba98b[_0x8c4b('0x19')](_0x1944f4)['json'](_0x37b523);}};}function respondWithFilteredResult(_0x418b9c,_0x2655c3){return function(_0x2292f7){if(_0x2292f7){var _0x383721=typeof _0x2655c3[_0x8c4b('0x1b')]==='undefined'&&typeof _0x2655c3[_0x8c4b('0x1c')]===_0x8c4b('0x1d');var _0x46f2e8=_0x2292f7[_0x8c4b('0x1e')];var _0x515f87=_0x383721?0x0:_0x2655c3['offset'];var _0x5d812c=_0x383721?_0x2292f7[_0x8c4b('0x1e')]:_0x2655c3[_0x8c4b('0x1b')]+_0x2655c3[_0x8c4b('0x1c')];var _0x5bedf4;if(_0x5d812c>=_0x46f2e8){_0x5d812c=_0x46f2e8;_0x5bedf4=0xc8;}else{_0x5bedf4=0xce;}_0x418b9c[_0x8c4b('0x19')](_0x5bedf4);return _0x418b9c['set'](_0x8c4b('0x1f'),_0x515f87+'-'+_0x5d812c+'/'+_0x46f2e8)['json'](_0x2292f7);}return null;};}function patchUpdates(_0x2b8cfa){return function(_0x354816){try{jsonpatch['apply'](_0x354816,_0x2b8cfa,!![]);}catch(_0x712877){return BPromise[_0x8c4b('0x20')](_0x712877);}return _0x354816[_0x8c4b('0x21')]();};}function saveUpdates(_0x1a9f0b,_0x2a7a3e){return function(_0x57b8b8){if(_0x57b8b8){return _0x57b8b8[_0x8c4b('0x22')](_0x1a9f0b)[_0x8c4b('0x23')](function(_0xcd4dba){return _0xcd4dba;});}return null;};}function removeEntity(_0x15bdf1,_0x29613f){return function(_0x256dae){if(_0x256dae){return _0x256dae['destroy']()[_0x8c4b('0x23')](function(){_0x15bdf1[_0x8c4b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f9d7,_0x424697){return function(_0x3ad3fa){if(!_0x3ad3fa){_0x35f9d7['sendStatus'](0x194);}return _0x3ad3fa;};}function handleError(_0x2e6b8d,_0x421ae3){_0x421ae3=_0x421ae3||0x1f4;return function(_0x1badb7){logger['error'](_0x1badb7[_0x8c4b('0x24')]);if(_0x1badb7['name']){delete _0x1badb7[_0x8c4b('0x25')];}_0x2e6b8d[_0x8c4b('0x19')](_0x421ae3)['send'](_0x1badb7);};}exports[_0x8c4b('0x26')]=function(_0x16890b,_0x1831d1){var _0x3c9a04={},_0x3b7722={},_0xdf1922={'count':0x0,'rows':[]};var _0xcbbe12=_[_0x8c4b('0x27')](db['FreshsalesField']['rawAttributes'],function(_0x133107){return{'name':_0x133107[_0x8c4b('0x28')],'type':_0x133107[_0x8c4b('0x29')][_0x8c4b('0x2a')]};});_0x3b7722[_0x8c4b('0x2b')]=_['map'](_0xcbbe12,_0x8c4b('0x25'));_0x3b7722[_0x8c4b('0x2c')]=_[_0x8c4b('0x2d')](_0x16890b[_0x8c4b('0x2c')]);_0x3b7722[_0x8c4b('0x2e')]=_[_0x8c4b('0x2f')](_0x3b7722[_0x8c4b('0x2b')],_0x3b7722[_0x8c4b('0x2c')]);_0x3c9a04['attributes']=_['intersection'](_0x3b7722[_0x8c4b('0x2b')],qs['fields'](_0x16890b['query']['fields']));_0x3c9a04[_0x8c4b('0x30')]=_0x3c9a04['attributes'][_0x8c4b('0x31')]?_0x3c9a04[_0x8c4b('0x30')]:_0x3b7722[_0x8c4b('0x2b')];if(!_0x16890b[_0x8c4b('0x2c')][_0x8c4b('0x32')](_0x8c4b('0x33'))){_0x3c9a04[_0x8c4b('0x1c')]=qs[_0x8c4b('0x1c')](_0x16890b[_0x8c4b('0x2c')]['limit']);_0x3c9a04[_0x8c4b('0x1b')]=qs['offset'](_0x16890b['query'][_0x8c4b('0x1b')]);}_0x3c9a04[_0x8c4b('0x34')]=qs[_0x8c4b('0x35')](_0x16890b[_0x8c4b('0x2c')]['sort']);_0x3c9a04['where']=qs[_0x8c4b('0x2e')](_[_0x8c4b('0x36')](_0x16890b['query'],_0x3b7722[_0x8c4b('0x2e')]),_0xcbbe12);if(_0x16890b[_0x8c4b('0x2c')][_0x8c4b('0x37')]){_0x3c9a04[_0x8c4b('0x38')]=_[_0x8c4b('0x39')](_0x3c9a04['where'],{'$or':_[_0x8c4b('0x27')](_0xcbbe12,function(_0x5cd72b){if(_0x5cd72b[_0x8c4b('0x29')]!==_0x8c4b('0x3a')){var _0x55e7a0={};_0x55e7a0[_0x5cd72b[_0x8c4b('0x25')]]={'$like':'%'+_0x16890b[_0x8c4b('0x2c')][_0x8c4b('0x37')]+'%'};return _0x55e7a0;}})});}_0x3c9a04=_[_0x8c4b('0x39')]({},_0x3c9a04,_0x16890b[_0x8c4b('0x3b')]);var _0x432467={'where':_0x3c9a04[_0x8c4b('0x38')]};return db['FreshsalesField']['count'](_0x432467)[_0x8c4b('0x23')](function(_0x36c767){_0xdf1922['count']=_0x36c767;if(_0x16890b[_0x8c4b('0x2c')][_0x8c4b('0x3c')]){_0x3c9a04['include']=[{'all':!![]}];}return db[_0x8c4b('0x3d')]['findAll'](_0x3c9a04);})[_0x8c4b('0x23')](function(_0x201d1d){_0xdf1922[_0x8c4b('0x3e')]=_0x201d1d;return _0xdf1922;})[_0x8c4b('0x23')](respondWithFilteredResult(_0x1831d1,_0x3c9a04))[_0x8c4b('0x3f')](handleError(_0x1831d1,null));};exports[_0x8c4b('0x40')]=function(_0x6eb44a,_0x32d6ec){var _0x43c820={'raw':!![],'where':{'id':_0x6eb44a[_0x8c4b('0x41')]['id']}},_0x354ae7={};_0x354ae7['model']=_[_0x8c4b('0x2d')](db[_0x8c4b('0x3d')][_0x8c4b('0x42')]);_0x354ae7['query']=_[_0x8c4b('0x2d')](_0x6eb44a['query']);_0x354ae7[_0x8c4b('0x2e')]=_['intersection'](_0x354ae7[_0x8c4b('0x2b')],_0x354ae7[_0x8c4b('0x2c')]);_0x43c820['attributes']=_[_0x8c4b('0x2f')](_0x354ae7[_0x8c4b('0x2b')],qs[_0x8c4b('0x43')](_0x6eb44a[_0x8c4b('0x2c')][_0x8c4b('0x43')]));_0x43c820['attributes']=_0x43c820[_0x8c4b('0x30')]['length']?_0x43c820['attributes']:_0x354ae7[_0x8c4b('0x2b')];if(_0x6eb44a[_0x8c4b('0x2c')][_0x8c4b('0x3c')]){_0x43c820[_0x8c4b('0x44')]=[{'all':!![]}];}_0x43c820=_[_0x8c4b('0x39')]({},_0x43c820,_0x6eb44a[_0x8c4b('0x3b')]);return db[_0x8c4b('0x3d')]['find'](_0x43c820)[_0x8c4b('0x23')](handleEntityNotFound(_0x32d6ec,null))[_0x8c4b('0x23')](respondWithResult(_0x32d6ec,null))[_0x8c4b('0x3f')](handleError(_0x32d6ec,null));};exports[_0x8c4b('0x45')]=function(_0x5c7b5c,_0x2d1cc2){return db[_0x8c4b('0x3d')][_0x8c4b('0x45')](_0x5c7b5c[_0x8c4b('0x46')],{})[_0x8c4b('0x23')](respondWithResult(_0x2d1cc2,0xc9))[_0x8c4b('0x3f')](handleError(_0x2d1cc2,null));};exports[_0x8c4b('0x22')]=function(_0x2e7def,_0x3499da){if(_0x2e7def[_0x8c4b('0x46')]['id']){delete _0x2e7def[_0x8c4b('0x46')]['id'];}return db[_0x8c4b('0x3d')]['find']({'where':{'id':_0x2e7def['params']['id']}})[_0x8c4b('0x23')](handleEntityNotFound(_0x3499da,null))[_0x8c4b('0x23')](saveUpdates(_0x2e7def['body'],null))[_0x8c4b('0x23')](respondWithResult(_0x3499da,null))[_0x8c4b('0x3f')](handleError(_0x3499da,null));};exports[_0x8c4b('0x47')]=function(_0x24615f,_0x25a5ba){return db['FreshsalesField'][_0x8c4b('0x48')]({'where':{'id':_0x24615f[_0x8c4b('0x41')]['id']}})[_0x8c4b('0x23')](handleEntityNotFound(_0x25a5ba,null))[_0x8c4b('0x23')](removeEntity(_0x25a5ba,null))['catch'](handleError(_0x25a5ba,null));}; \ No newline at end of file +var _0x656f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','keys','find','create','update','params','body','eml-format','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xd27796,_0x2e404e){var _0x1d3a9b=function(_0x838fa2){while(--_0x838fa2){_0xd27796['push'](_0xd27796['shift']());}};_0x1d3a9b(++_0x2e404e);}(_0x656f,0x192));var _0xf656=function(_0x280d3b,_0x29b7cc){_0x280d3b=_0x280d3b-0x0;var _0x5d5313=_0x656f[_0x280d3b];return _0x5d5313;};'use strict';var emlformat=require(_0xf656('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf656('0x1'));var jsonpatch=require(_0xf656('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf656('0x3'));var Mustache=require('mustache');var util=require(_0xf656('0x4'));var path=require(_0xf656('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf656('0x6'));var fs=require('fs');var fs_extra=require(_0xf656('0x7'));var _=require(_0xf656('0x8'));var squel=require('squel');var crypto=require(_0xf656('0x9'));var jsforce=require(_0xf656('0xa'));var deskjs=require(_0xf656('0xb'));var toCsv=require(_0xf656('0xc'));var querystring=require('querystring');var Papa=require(_0xf656('0xd'));var Redis=require(_0xf656('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf656('0xf'));var hardwareService=require(_0xf656('0x10'));var logger=require(_0xf656('0x11'))(_0xf656('0x12'));var utils=require(_0xf656('0x13'));var config=require(_0xf656('0x14'));var licenseUtil=require(_0xf656('0x15'));var db=require(_0xf656('0x16'))['db'];function respondWithStatusCode(_0x554fbb,_0x252bb1){_0x252bb1=_0x252bb1||0xcc;return function(_0x5675e9){if(_0x5675e9){return _0x554fbb[_0xf656('0x17')](_0x252bb1);}return _0x554fbb['status'](_0x252bb1)[_0xf656('0x18')]();};}function respondWithResult(_0x48c32c,_0x591810){_0x591810=_0x591810||0xc8;return function(_0x4faffe){if(_0x4faffe){return _0x48c32c[_0xf656('0x19')](_0x591810)['json'](_0x4faffe);}};}function respondWithFilteredResult(_0x2afb22,_0xd3b359){return function(_0x30371a){if(_0x30371a){var _0x252227=typeof _0xd3b359[_0xf656('0x1a')]===_0xf656('0x1b')&&typeof _0xd3b359[_0xf656('0x1c')]==='undefined';var _0x340bc4=_0x30371a['count'];var _0x407dca=_0x252227?0x0:_0xd3b359[_0xf656('0x1a')];var _0x17bd26=_0x252227?_0x30371a[_0xf656('0x1d')]:_0xd3b359[_0xf656('0x1a')]+_0xd3b359[_0xf656('0x1c')];var _0x250d9b;if(_0x17bd26>=_0x340bc4){_0x17bd26=_0x340bc4;_0x250d9b=0xc8;}else{_0x250d9b=0xce;}_0x2afb22[_0xf656('0x19')](_0x250d9b);return _0x2afb22[_0xf656('0x1e')]('Content-Range',_0x407dca+'-'+_0x17bd26+'/'+_0x340bc4)[_0xf656('0x1f')](_0x30371a);}return null;};}function patchUpdates(_0x403a00){return function(_0x411b54){try{jsonpatch[_0xf656('0x20')](_0x411b54,_0x403a00,!![]);}catch(_0x1db8c3){return BPromise[_0xf656('0x21')](_0x1db8c3);}return _0x411b54['save']();};}function saveUpdates(_0x2719e8,_0x3b47b5){return function(_0x3f5768){if(_0x3f5768){return _0x3f5768['update'](_0x2719e8)[_0xf656('0x22')](function(_0x2145f0){return _0x2145f0;});}return null;};}function removeEntity(_0x1861c3,_0x424d61){return function(_0x29fddf){if(_0x29fddf){return _0x29fddf[_0xf656('0x23')]()[_0xf656('0x22')](function(){_0x1861c3['status'](0xcc)[_0xf656('0x18')]();});}};}function handleEntityNotFound(_0x10760d,_0x5880e8){return function(_0x5323d5){if(!_0x5323d5){_0x10760d[_0xf656('0x17')](0x194);}return _0x5323d5;};}function handleError(_0x106c2d,_0x284037){_0x284037=_0x284037||0x1f4;return function(_0x162c81){logger[_0xf656('0x24')](_0x162c81[_0xf656('0x25')]);if(_0x162c81[_0xf656('0x26')]){delete _0x162c81['name'];}_0x106c2d['status'](_0x284037)['send'](_0x162c81);};}exports[_0xf656('0x27')]=function(_0x35c820,_0x1b5156){var _0x75ce29={},_0x21a28e={},_0x21723c={'count':0x0,'rows':[]};var _0x15afa3=_[_0xf656('0x28')](db['FreshsalesField'][_0xf656('0x29')],function(_0x18a1b0){return{'name':_0x18a1b0[_0xf656('0x2a')],'type':_0x18a1b0['type']['key']};});_0x21a28e[_0xf656('0x2b')]=_[_0xf656('0x28')](_0x15afa3,'name');_0x21a28e[_0xf656('0x2c')]=_['keys'](_0x35c820[_0xf656('0x2c')]);_0x21a28e[_0xf656('0x2d')]=_[_0xf656('0x2e')](_0x21a28e[_0xf656('0x2b')],_0x21a28e[_0xf656('0x2c')]);_0x75ce29[_0xf656('0x2f')]=_[_0xf656('0x2e')](_0x21a28e['model'],qs[_0xf656('0x30')](_0x35c820['query'][_0xf656('0x30')]));_0x75ce29[_0xf656('0x2f')]=_0x75ce29[_0xf656('0x2f')][_0xf656('0x31')]?_0x75ce29[_0xf656('0x2f')]:_0x21a28e[_0xf656('0x2b')];if(!_0x35c820[_0xf656('0x2c')]['hasOwnProperty']('nolimit')){_0x75ce29[_0xf656('0x1c')]=qs['limit'](_0x35c820[_0xf656('0x2c')][_0xf656('0x1c')]);_0x75ce29[_0xf656('0x1a')]=qs[_0xf656('0x1a')](_0x35c820[_0xf656('0x2c')][_0xf656('0x1a')]);}_0x75ce29['order']=qs[_0xf656('0x32')](_0x35c820[_0xf656('0x2c')][_0xf656('0x32')]);_0x75ce29[_0xf656('0x33')]=qs[_0xf656('0x2d')](_['pick'](_0x35c820[_0xf656('0x2c')],_0x21a28e[_0xf656('0x2d')]),_0x15afa3);if(_0x35c820[_0xf656('0x2c')][_0xf656('0x34')]){_0x75ce29[_0xf656('0x33')]=_[_0xf656('0x35')](_0x75ce29[_0xf656('0x33')],{'$or':_['map'](_0x15afa3,function(_0x952558){if(_0x952558[_0xf656('0x36')]!==_0xf656('0x37')){var _0x3988fa={};_0x3988fa[_0x952558[_0xf656('0x26')]]={'$like':'%'+_0x35c820[_0xf656('0x2c')][_0xf656('0x34')]+'%'};return _0x3988fa;}})});}_0x75ce29=_['merge']({},_0x75ce29,_0x35c820[_0xf656('0x38')]);var _0x1107b2={'where':_0x75ce29[_0xf656('0x33')]};return db[_0xf656('0x39')][_0xf656('0x1d')](_0x1107b2)[_0xf656('0x22')](function(_0x5b23bd){_0x21723c[_0xf656('0x1d')]=_0x5b23bd;if(_0x35c820['query'][_0xf656('0x3a')]){_0x75ce29[_0xf656('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0xf656('0x3c')](_0x75ce29);})['then'](function(_0xc67b2){_0x21723c[_0xf656('0x3d')]=_0xc67b2;return _0x21723c;})[_0xf656('0x22')](respondWithFilteredResult(_0x1b5156,_0x75ce29))[_0xf656('0x3e')](handleError(_0x1b5156,null));};exports[_0xf656('0x3f')]=function(_0x3978a0,_0x4b6698){var _0x40e04a={'raw':!![],'where':{'id':_0x3978a0['params']['id']}},_0x1fff63={};_0x1fff63[_0xf656('0x2b')]=_[_0xf656('0x40')](db[_0xf656('0x39')][_0xf656('0x29')]);_0x1fff63[_0xf656('0x2c')]=_[_0xf656('0x40')](_0x3978a0[_0xf656('0x2c')]);_0x1fff63[_0xf656('0x2d')]=_[_0xf656('0x2e')](_0x1fff63[_0xf656('0x2b')],_0x1fff63[_0xf656('0x2c')]);_0x40e04a['attributes']=_[_0xf656('0x2e')](_0x1fff63[_0xf656('0x2b')],qs[_0xf656('0x30')](_0x3978a0[_0xf656('0x2c')][_0xf656('0x30')]));_0x40e04a[_0xf656('0x2f')]=_0x40e04a[_0xf656('0x2f')]['length']?_0x40e04a['attributes']:_0x1fff63['model'];if(_0x3978a0[_0xf656('0x2c')][_0xf656('0x3a')]){_0x40e04a[_0xf656('0x3b')]=[{'all':!![]}];}_0x40e04a=_[_0xf656('0x35')]({},_0x40e04a,_0x3978a0[_0xf656('0x38')]);return db['FreshsalesField'][_0xf656('0x41')](_0x40e04a)['then'](handleEntityNotFound(_0x4b6698,null))[_0xf656('0x22')](respondWithResult(_0x4b6698,null))['catch'](handleError(_0x4b6698,null));};exports[_0xf656('0x42')]=function(_0xa72873,_0xbb7288){return db[_0xf656('0x39')]['create'](_0xa72873['body'],{})[_0xf656('0x22')](respondWithResult(_0xbb7288,0xc9))[_0xf656('0x3e')](handleError(_0xbb7288,null));};exports[_0xf656('0x43')]=function(_0x4cce70,_0x411383){if(_0x4cce70['body']['id']){delete _0x4cce70['body']['id'];}return db[_0xf656('0x39')][_0xf656('0x41')]({'where':{'id':_0x4cce70[_0xf656('0x44')]['id']}})['then'](handleEntityNotFound(_0x411383,null))[_0xf656('0x22')](saveUpdates(_0x4cce70[_0xf656('0x45')],null))['then'](respondWithResult(_0x411383,null))[_0xf656('0x3e')](handleError(_0x411383,null));};exports[_0xf656('0x23')]=function(_0x2d5893,_0x45a8fe){return db['FreshsalesField']['find']({'where':{'id':_0x2d5893[_0xf656('0x44')]['id']}})['then'](handleEntityNotFound(_0x45a8fe,null))[_0xf656('0x22')](removeEntity(_0x45a8fe,null))[_0xf656('0x3e')](handleError(_0x45a8fe,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 81b8533..112deab 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 _0x4efb=['api','bluebird','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4efb,0xfa));var _0xb4ef=function(_0x98cb54,_0x4b20d1){_0x98cb54=_0x98cb54-0x0;var _0x4f5d9a=_0x4efb[_0x98cb54];return _0x4f5d9a;};'use strict';var _=require('lodash');var util=require(_0xb4ef('0x0'));var logger=require(_0xb4ef('0x1'))(_0xb4ef('0x2'));var moment=require('moment');var BPromise=require(_0xb4ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4ef('0x4'));var rimraf=require(_0xb4ef('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4ef('0x6'));module['exports']=function(_0x1f69fc,_0xd99454){return _0x1f69fc[_0xb4ef('0x7')](_0xb4ef('0x8'),attributes,{'tableName':_0xb4ef('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb4ef('0xa'),_0xb4ef('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e4=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField','lodash'];(function(_0x1b79ae,_0xb0de2f){var _0x44f333=function(_0x327c4e){while(--_0x327c4e){_0x1b79ae['push'](_0x1b79ae['shift']());}};_0x44f333(++_0xb0de2f);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x477328,_0x132b3f){_0x477328=_0x477328-0x0;var _0x91ccd0=_0xd0e4[_0x477328];return _0x91ccd0;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var logger=require(_0x4d0e('0x2'))(_0x4d0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d0e('0x4'));var fs=require('fs');var path=require(_0x4d0e('0x5'));var rimraf=require(_0x4d0e('0x6'));var config=require(_0x4d0e('0x7'));var attributes=require(_0x4d0e('0x8'));module['exports']=function(_0x588895,_0x5be772){return _0x588895[_0x4d0e('0x9')](_0x4d0e('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4d0e('0xb'),'fields':[_0x4d0e('0xc'),'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 45e93db..a984359 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 _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x98c448,_0x340f1f){var _0x1b1034=function(_0x5f4ad0){while(--_0x5f4ad0){_0x98c448['push'](_0x98c448['shift']());}};_0x1b1034(++_0x340f1f);}(_0x1883,0xab));var _0x3188=function(_0x34ecfd,_0x557f00){_0x34ecfd=_0x34ecfd-0x0;var _0x57457e=_0x1883[_0x34ecfd];return _0x57457e;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file +var _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x3ba630,_0x910cfa){var _0x51ab4e=function(_0x49b8f2){while(--_0x49b8f2){_0x3ba630['push'](_0x3ba630['shift']());}};_0x51ab4e(++_0x910cfa);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f6f3978..883ccd1 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x169b33,_0x19594a){var _0x255014=function(_0x591caf){while(--_0x591caf){_0x169b33['push'](_0x169b33['shift']());}};_0x255014(++_0x19594a);}(_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/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4ae297,_0x12c133){var _0x3dbda9=function(_0x13674f){while(--_0x13674f){_0x4ae297['push'](_0x4ae297['shift']());}};_0x3dbda9(++_0x12c133);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ce99c05..8dd7e7a 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 _0xaf97=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x23bd56,_0x580781){var _0x4dfaff=function(_0xceddad){while(--_0xceddad){_0x23bd56['push'](_0x23bd56['shift']());}};_0x4dfaff(++_0x580781);}(_0xaf97,0x15a));var _0x7af9=function(_0x4c95ad,_0x1b5ea0){_0x4c95ad=_0x4c95ad-0x0;var _0x38586b=_0xaf97[_0x4c95ad];return _0x38586b;};'use strict';var Sequelize=require(_0x7af9('0x0'));module[_0x7af9('0x1')]={'name':{'type':Sequelize[_0x7af9('0x2')]},'description':{'type':Sequelize[_0x7af9('0x2')]},'username':{'type':Sequelize[_0x7af9('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x7af9('0x2')]},'password':{'type':Sequelize[_0x7af9('0x2')]},'clientId':{'type':Sequelize[_0x7af9('0x2')]},'clientSecret':{'type':Sequelize[_0x7af9('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7af9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7af9('0x3')](_0x7af9('0x4'),_0x7af9('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x6c20=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x6c20,0x88));var _0x06c2=function(_0x4f1a5b,_0x53c5f7){_0x4f1a5b=_0x4f1a5b-0x0;var _0x2a0e3a=_0x6c20[_0x4f1a5b];return _0x2a0e3a;};'use strict';var Sequelize=require(_0x06c2('0x0'));module[_0x06c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x06c2('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x06c2('0x2')]},'clientId':{'type':Sequelize[_0x06c2('0x2')]},'clientSecret':{'type':Sequelize[_0x06c2('0x2')]},'securityToken':{'type':Sequelize[_0x06c2('0x2')]},'serverUrl':{'type':Sequelize[_0x06c2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x06c2('0x3')](_0x06c2('0x4'),_0x06c2('0x5')),'defaultValue':_0x06c2('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f7ef984..54043af 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 _0x6c33=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','lastIndexOf','Connection','login','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','remove','includes','label','custom','picklistValues','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x556ff6,_0x308db4){var _0x242cc3=function(_0x989eb){while(--_0x989eb){_0x556ff6['push'](_0x556ff6['shift']());}};_0x242cc3(++_0x308db4);}(_0x6c33,0x70));var _0x36c3=function(_0x221eda,_0xcf03bf){_0x221eda=_0x221eda-0x0;var _0x132929=_0x6c33[_0x221eda];return _0x132929;};'use strict';var emlformat=require(_0x36c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x36c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36c3('0x2'));var moment=require(_0x36c3('0x3'));var BPromise=require(_0x36c3('0x4'));var Mustache=require(_0x36c3('0x5'));var util=require(_0x36c3('0x6'));var path=require(_0x36c3('0x7'));var sox=require('sox');var csv=require(_0x36c3('0x8'));var ejs=require(_0x36c3('0x9'));var fs=require('fs');var fs_extra=require(_0x36c3('0xa'));var _=require(_0x36c3('0xb'));var squel=require(_0x36c3('0xc'));var crypto=require(_0x36c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x36c3('0xe'));var toCsv=require(_0x36c3('0x8'));var querystring=require(_0x36c3('0xf'));var Papa=require(_0x36c3('0x10'));var Redis=require(_0x36c3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x36c3('0x12'));var as=require(_0x36c3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36c3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x36c3('0x15'))['db'];var integrations=require(_0x36c3('0x16'));function respondWithStatusCode(_0x13f5be,_0x163092){_0x163092=_0x163092||0xcc;return function(_0x1a214b){if(_0x1a214b){return _0x13f5be[_0x36c3('0x17')](_0x163092);}return _0x13f5be[_0x36c3('0x18')](_0x163092)['end']();};}function respondWithResult(_0x4b4c1a,_0x57bb2c){_0x57bb2c=_0x57bb2c||0xc8;return function(_0x4b3f1c){if(_0x4b3f1c){return _0x4b4c1a[_0x36c3('0x18')](_0x57bb2c)[_0x36c3('0x19')](_0x4b3f1c);}};}function respondWithFilteredResult(_0x5e6e64,_0x1f2497){return function(_0x4cc079){if(_0x4cc079){var _0x48a9e4=typeof _0x1f2497[_0x36c3('0x1a')]===_0x36c3('0x1b')&&typeof _0x1f2497[_0x36c3('0x1c')]==='undefined';var _0x10c31b=_0x4cc079[_0x36c3('0x1d')];var _0x28ee6e=_0x48a9e4?0x0:_0x1f2497[_0x36c3('0x1a')];var _0x336028=_0x48a9e4?_0x4cc079[_0x36c3('0x1d')]:_0x1f2497[_0x36c3('0x1a')]+_0x1f2497[_0x36c3('0x1c')];var _0x31b423;if(_0x336028>=_0x10c31b){_0x336028=_0x10c31b;_0x31b423=0xc8;}else{_0x31b423=0xce;}_0x5e6e64[_0x36c3('0x18')](_0x31b423);return _0x5e6e64[_0x36c3('0x1e')](_0x36c3('0x1f'),_0x28ee6e+'-'+_0x336028+'/'+_0x10c31b)[_0x36c3('0x19')](_0x4cc079);}return null;};}function patchUpdates(_0x50b1a0){return function(_0x53cf3e){try{jsonpatch[_0x36c3('0x20')](_0x53cf3e,_0x50b1a0,!![]);}catch(_0x22bb3c){return BPromise[_0x36c3('0x21')](_0x22bb3c);}return _0x53cf3e[_0x36c3('0x22')]();};}function saveUpdates(_0x4f32fb,_0x56919c){return function(_0x460ece){if(_0x460ece){return _0x460ece['update'](_0x4f32fb)[_0x36c3('0x23')](function(_0x59905a){return _0x59905a;});}return null;};}function removeEntity(_0x7d2536,_0x2d80f9){return function(_0x8ec0f4){if(_0x8ec0f4){return _0x8ec0f4[_0x36c3('0x24')]()[_0x36c3('0x23')](function(){_0x7d2536[_0x36c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42ec3d,_0x1a1122){return function(_0x4eb26d){if(!_0x4eb26d){_0x42ec3d['sendStatus'](0x194);}return _0x4eb26d;};}function handleError(_0x49ec92,_0xfbc4ab){_0xfbc4ab=_0xfbc4ab||0x1f4;return function(_0x378ce1){logger[_0x36c3('0x25')](_0x378ce1[_0x36c3('0x26')]);if(_0x378ce1[_0x36c3('0x27')]){delete _0x378ce1[_0x36c3('0x27')];}_0x49ec92[_0x36c3('0x18')](_0xfbc4ab)[_0x36c3('0x28')](_0x378ce1);};}exports[_0x36c3('0x29')]=function(_0x3d54f7,_0x51e45e){var _0xb4f190={},_0x117c87={},_0x3e5626={'count':0x0,'rows':[]};var _0x5717e0=_[_0x36c3('0x2a')](db[_0x36c3('0x2b')][_0x36c3('0x2c')],function(_0x2059bb){return{'name':_0x2059bb[_0x36c3('0x2d')],'type':_0x2059bb[_0x36c3('0x2e')][_0x36c3('0x2f')]};});_0x117c87[_0x36c3('0x30')]=_[_0x36c3('0x2a')](_0x5717e0,_0x36c3('0x27'));_0x117c87[_0x36c3('0x31')]=_['keys'](_0x3d54f7[_0x36c3('0x31')]);_0x117c87[_0x36c3('0x32')]=_[_0x36c3('0x33')](_0x117c87[_0x36c3('0x30')],_0x117c87[_0x36c3('0x31')]);_0xb4f190[_0x36c3('0x34')]=_[_0x36c3('0x33')](_0x117c87['model'],qs[_0x36c3('0x35')](_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x35')]));_0xb4f190[_0x36c3('0x34')]=_0xb4f190[_0x36c3('0x34')][_0x36c3('0x36')]?_0xb4f190[_0x36c3('0x34')]:_0x117c87[_0x36c3('0x30')];if(!_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x37')](_0x36c3('0x38'))){_0xb4f190[_0x36c3('0x1c')]=qs[_0x36c3('0x1c')](_0x3d54f7[_0x36c3('0x31')]['limit']);_0xb4f190[_0x36c3('0x1a')]=qs[_0x36c3('0x1a')](_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x1a')]);}_0xb4f190['order']=qs[_0x36c3('0x39')](_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x39')]);_0xb4f190[_0x36c3('0x3a')]=qs[_0x36c3('0x32')](_[_0x36c3('0x3b')](_0x3d54f7[_0x36c3('0x31')],_0x117c87[_0x36c3('0x32')]),_0x5717e0);if(_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x3c')]){_0xb4f190[_0x36c3('0x3a')]=_['merge'](_0xb4f190[_0x36c3('0x3a')],{'$or':_[_0x36c3('0x2a')](_0x5717e0,function(_0x5d8467){if(_0x5d8467[_0x36c3('0x2e')]!==_0x36c3('0x3d')){var _0x5cd131={};_0x5cd131[_0x5d8467[_0x36c3('0x27')]]={'$like':'%'+_0x3d54f7[_0x36c3('0x31')][_0x36c3('0x3c')]+'%'};return _0x5cd131;}})});}_0xb4f190=_[_0x36c3('0x3e')]({},_0xb4f190,_0x3d54f7[_0x36c3('0x3f')]);var _0x3ecd90={'where':_0xb4f190[_0x36c3('0x3a')]};return db[_0x36c3('0x2b')]['count'](_0x3ecd90)['then'](function(_0x6fad0f){_0x3e5626[_0x36c3('0x1d')]=_0x6fad0f;if(_0x3d54f7[_0x36c3('0x31')]['includeAll']){_0xb4f190[_0x36c3('0x40')]=[{'all':!![]}];}return db[_0x36c3('0x2b')][_0x36c3('0x41')](_0xb4f190);})[_0x36c3('0x23')](function(_0x43b74f){_0x3e5626[_0x36c3('0x42')]=_0x43b74f;return _0x3e5626;})[_0x36c3('0x23')](respondWithFilteredResult(_0x51e45e,_0xb4f190))[_0x36c3('0x43')](handleError(_0x51e45e,null));};exports[_0x36c3('0x44')]=function(_0x566f33,_0x1f7650){var _0x22d434={'raw':![],'where':{'id':_0x566f33[_0x36c3('0x45')]['id']}},_0x3a04a6={};_0x3a04a6[_0x36c3('0x30')]=_['keys'](db[_0x36c3('0x2b')][_0x36c3('0x2c')]);_0x3a04a6[_0x36c3('0x31')]=_[_0x36c3('0x46')](_0x566f33['query']);_0x3a04a6['filters']=_[_0x36c3('0x33')](_0x3a04a6['model'],_0x3a04a6[_0x36c3('0x31')]);_0x22d434['attributes']=_[_0x36c3('0x33')](_0x3a04a6[_0x36c3('0x30')],qs[_0x36c3('0x35')](_0x566f33['query']['fields']));_0x22d434[_0x36c3('0x34')]=_0x22d434[_0x36c3('0x34')][_0x36c3('0x36')]?_0x22d434[_0x36c3('0x34')]:_0x3a04a6[_0x36c3('0x30')];if(_0x566f33[_0x36c3('0x31')][_0x36c3('0x47')]){_0x22d434[_0x36c3('0x40')]=[{'all':!![]}];}_0x22d434=_[_0x36c3('0x3e')]({},_0x22d434,_0x566f33[_0x36c3('0x3f')]);return db['SalesforceAccount'][_0x36c3('0x48')](_0x22d434)[_0x36c3('0x23')](handleEntityNotFound(_0x1f7650,null))[_0x36c3('0x23')](respondWithResult(_0x1f7650,null))[_0x36c3('0x43')](handleError(_0x1f7650,null));};exports[_0x36c3('0x49')]=function(_0x4f8a92,_0x2cb73f){return db[_0x36c3('0x2b')][_0x36c3('0x49')](_0x4f8a92[_0x36c3('0x4a')],{})[_0x36c3('0x23')](respondWithResult(_0x2cb73f,0xc9))[_0x36c3('0x43')](handleError(_0x2cb73f,null));};exports[_0x36c3('0x4b')]=function(_0x24e5a7,_0x1961fe){if(_0x24e5a7[_0x36c3('0x4a')]['id']){delete _0x24e5a7[_0x36c3('0x4a')]['id'];}return db[_0x36c3('0x2b')][_0x36c3('0x48')]({'where':{'id':_0x24e5a7['params']['id']}})['then'](handleEntityNotFound(_0x1961fe,null))[_0x36c3('0x23')](saveUpdates(_0x24e5a7['body'],null))[_0x36c3('0x23')](respondWithResult(_0x1961fe,null))[_0x36c3('0x43')](handleError(_0x1961fe,null));};exports[_0x36c3('0x24')]=function(_0x14e62a,_0x25a91e){return db[_0x36c3('0x2b')][_0x36c3('0x48')]({'where':{'id':_0x14e62a[_0x36c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x25a91e,null))['then'](removeEntity(_0x25a91e,null))[_0x36c3('0x43')](handleError(_0x25a91e,null));};exports[_0x36c3('0x4c')]=function(_0x1cc63b,_0x3ec46c,_0x31f7a0){var _0x1c0a2b={};var _0x228ace={};var _0x308af5;var _0x1a8a3e;return db[_0x36c3('0x2b')][_0x36c3('0x4d')]({'where':{'id':_0x1cc63b[_0x36c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ec46c,null))[_0x36c3('0x23')](function(_0x39000c){if(_0x39000c){_0x308af5=_0x39000c;_0x228ace[_0x36c3('0x30')]=_['keys'](db[_0x36c3('0x4e')][_0x36c3('0x2c')]);_0x228ace[_0x36c3('0x31')]=_['keys'](_0x1cc63b[_0x36c3('0x31')]);_0x228ace[_0x36c3('0x32')]=_['intersection'](_0x228ace['model'],_0x228ace[_0x36c3('0x31')]);_0x1c0a2b[_0x36c3('0x34')]=_['intersection'](_0x228ace[_0x36c3('0x30')],qs[_0x36c3('0x35')](_0x1cc63b[_0x36c3('0x31')][_0x36c3('0x35')]));_0x1c0a2b['attributes']=_0x1c0a2b['attributes']['length']?_0x1c0a2b[_0x36c3('0x34')]:_0x228ace['model'];_0x1c0a2b[_0x36c3('0x4f')]=qs[_0x36c3('0x39')](_0x1cc63b[_0x36c3('0x31')][_0x36c3('0x39')]);_0x1c0a2b[_0x36c3('0x3a')]=qs[_0x36c3('0x32')](_[_0x36c3('0x3b')](_0x1cc63b[_0x36c3('0x31')],_0x228ace[_0x36c3('0x32')]));if(_0x1cc63b[_0x36c3('0x31')][_0x36c3('0x3c')]){_0x1c0a2b[_0x36c3('0x3a')]=_[_0x36c3('0x3e')](_0x1c0a2b[_0x36c3('0x3a')],{'$or':_[_0x36c3('0x2a')](_0x1c0a2b['attributes'],function(_0x1ab586){var _0x4c8ac2={};_0x4c8ac2[_0x1ab586]={'$like':'%'+_0x1cc63b['query'][_0x36c3('0x3c')]+'%'};return _0x4c8ac2;})});}_0x1c0a2b=_[_0x36c3('0x3e')]({},_0x1c0a2b,_0x1cc63b[_0x36c3('0x3f')]);return _0x308af5[_0x36c3('0x4c')](_0x1c0a2b);}})[_0x36c3('0x23')](function(_0x47f92f){if(_0x47f92f){_0x1a8a3e=_0x47f92f[_0x36c3('0x36')];if(!_0x1cc63b[_0x36c3('0x31')][_0x36c3('0x37')](_0x36c3('0x38'))){_0x1c0a2b[_0x36c3('0x1c')]=qs[_0x36c3('0x1c')](_0x1cc63b['query'][_0x36c3('0x1c')]);_0x1c0a2b[_0x36c3('0x1a')]=qs[_0x36c3('0x1a')](_0x1cc63b[_0x36c3('0x31')]['offset']);}return _0x308af5[_0x36c3('0x4c')](_0x1c0a2b);}})[_0x36c3('0x23')](function(_0x47817d){if(_0x47817d){return _0x47817d?{'count':_0x1a8a3e,'rows':_0x47817d}:null;}})[_0x36c3('0x23')](respondWithResult(_0x3ec46c,null))[_0x36c3('0x43')](handleError(_0x3ec46c,null));};exports[_0x36c3('0x50')]=function(_0x458032,_0x5d177c,_0x17327d){if(_0x458032['body']['id']){delete _0x458032[_0x36c3('0x4a')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x458032[_0x36c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d177c,null))[_0x36c3('0x23')](function(_0x1d27eb){if(_0x1d27eb){_0x458032['body'][_0x36c3('0x51')]=_0x1d27eb['id'];_0x458032['body']['Subjects']=integrations[_0x36c3('0x52')](_0x458032[_0x36c3('0x4a')][_0x36c3('0x53')],_0x458032[_0x36c3('0x4a')][_0x36c3('0x2e')]);_0x458032['body'][_0x36c3('0x54')]=integrations['getDescriptions'](_0x458032[_0x36c3('0x4a')][_0x36c3('0x53')],_0x458032[_0x36c3('0x4a')][_0x36c3('0x2e')]);return db[_0x36c3('0x4e')][_0x36c3('0x49')](_0x458032[_0x36c3('0x4a')],{'include':[{'model':db[_0x36c3('0x55')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x36c3('0x54')}]});}return null;})[_0x36c3('0x23')](respondWithResult(_0x5d177c,null))[_0x36c3('0x43')](handleError(_0x5d177c,null));};exports['getFields']=function(_0x2030a2,_0x5ce347,_0x57897b){var _0x524f4e;var _0x31893f='';var _0x1e2c76=_0x36c3('0x56');return db[_0x36c3('0x2b')][_0x36c3('0x4d')]({'where':{'id':_0x2030a2[_0x36c3('0x45')]['id']},'attributes':['id',_0x36c3('0x57'),_0x36c3('0x58'),_0x36c3('0x59'),_0x36c3('0x5a'),'password',_0x36c3('0x5b')]})[_0x36c3('0x23')](handleEntityNotFound(_0x5ce347,null))[_0x36c3('0x23')](function(_0xd4457f){if(_0xd4457f){_0x31893f=_0xd4457f[_0x36c3('0x57')];var _0x118add=_0x31893f[_0x36c3('0x5c')](-0x1);if(_0x118add==='/'){_0x31893f=_0x31893f['substring'](0x0,_0x31893f[_0x36c3('0x5d')](_0x118add));}_0x524f4e=new jsforce[(_0x36c3('0x5e'))]({'oauth2':{'loginUrl':_0x31893f,'clientId':_0xd4457f[_0x36c3('0x58')],'clientSecret':_0xd4457f[_0x36c3('0x59')]}});return _0x524f4e[_0x36c3('0x5f')](_0xd4457f[_0x36c3('0x5a')],_0xd4457f[_0x36c3('0x60')][_0x36c3('0x61')](_0xd4457f[_0x36c3('0x5b')]));}})[_0x36c3('0x23')](function(_0x33821f){if(_0x33821f){if(!_[_0x36c3('0x62')](_0x2030a2[_0x36c3('0x31')][_0x36c3('0x63')])){_0x1e2c76=_0x2030a2[_0x36c3('0x31')]['ticketType'];}return _0x524f4e['sobject'](_0x1e2c76)[_0x36c3('0x64')]();}})[_0x36c3('0x23')](function(_0x4245e7){var _0x56f354=[_0x36c3('0x65'),_0x36c3('0x66'),_0x36c3('0x67'),_0x36c3('0x68'),_0x36c3('0x69'),_0x36c3('0x6a')];var _0x2f4c5a=[_0x36c3('0x6b'),_0x36c3('0x6c'),_0x36c3('0x6d'),'boolean',_0x36c3('0x6e'),_0x36c3('0x6f'),'phone'];if(_0x4245e7){_[_0x36c3('0x70')](_0x4245e7[_0x36c3('0x35')],function(_0x4698d6){return _0x56f354[_0x36c3('0x71')](_0x4698d6[_0x36c3('0x27')])||!_0x2f4c5a['includes'](_0x4698d6[_0x36c3('0x2e')]);});return{'count':_0x4245e7['fields'][_0x36c3('0x36')],'rows':_[_0x36c3('0x2a')](_0x4245e7[_0x36c3('0x35')],function(_0x8a9320){return{'id':_0x8a9320['name'],'name':_0x8a9320[_0x36c3('0x72')],'custom':_0x8a9320[_0x36c3('0x73')],'options':_0x8a9320['picklistValues'][_0x36c3('0x36')]>0x0?_[_0x36c3('0x2a')](_0x8a9320[_0x36c3('0x74')],function(_0x4d89f0){return{'name':_0x4d89f0['label'],'value':_0x4d89f0['value']};}):_0x8a9320[_0x36c3('0x2e')]==_0x36c3('0x75')?[{'name':_0x36c3('0x76'),'value':_0x36c3('0x77')},{'name':_0x36c3('0x78'),'value':_0x36c3('0x79')}]:[]};})};}})[_0x36c3('0x23')](respondWithResult(_0x5ce347,null))[_0x36c3('0x43')](function(_0x29326c){var _0x2ece0e=_0x2030a2[_0x36c3('0x31')]['test']?0x1f4:_0x29326c[_0x36c3('0x7a')]||0x1f4;logger[_0x36c3('0x25')](_0x36c3('0x7b'),_0x36c3('0x7c'),_0x2ece0e,JSON['stringify'](_0x29326c));delete _0x29326c[_0x36c3('0x27')];if(_0x2ece0e===0x191){_0x2ece0e=0x190;}_0x5ce347[_0x36c3('0x18')](_0x2ece0e)['send'](_0x2030a2['query'][_0x36c3('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x29326c[_0x36c3('0x7a')]}:_0x29326c);});}; \ No newline at end of file +var _0xb243=['include','findAll','catch','show','params','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','login','username','concat','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','boolean','textarea','phone','includes','label','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','SalesforceAccount','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x2c44aa,_0x2fd67f){var _0xa104f8=function(_0x49a05c){while(--_0x49a05c){_0x2c44aa['push'](_0x2c44aa['shift']());}};_0xa104f8(++_0x2fd67f);}(_0xb243,0xaa));var _0x3b24=function(_0x579cc7,_0x3d3a6f){_0x579cc7=_0x579cc7-0x0;var _0x42a5db=_0xb243[_0x579cc7];return _0x42a5db;};'use strict';var emlformat=require(_0x3b24('0x0'));var rimraf=require(_0x3b24('0x1'));var zipdir=require(_0x3b24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b24('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b24('0x4'));var util=require(_0x3b24('0x5'));var path=require('path');var sox=require(_0x3b24('0x6'));var csv=require(_0x3b24('0x7'));var ejs=require(_0x3b24('0x8'));var fs=require('fs');var fs_extra=require(_0x3b24('0x9'));var _=require(_0x3b24('0xa'));var squel=require(_0x3b24('0xb'));var crypto=require('crypto');var jsforce=require(_0x3b24('0xc'));var deskjs=require(_0x3b24('0xd'));var toCsv=require(_0x3b24('0x7'));var querystring=require(_0x3b24('0xe'));var Papa=require(_0x3b24('0xf'));var Redis=require(_0x3b24('0x10'));var authService=require(_0x3b24('0x11'));var qs=require(_0x3b24('0x12'));var as=require(_0x3b24('0x13'));var hardwareService=require(_0x3b24('0x14'));var logger=require(_0x3b24('0x15'))(_0x3b24('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b24('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x292b72,_0x1fe9e8){_0x1fe9e8=_0x1fe9e8||0xcc;return function(_0x25b32a){if(_0x25b32a){return _0x292b72[_0x3b24('0x18')](_0x1fe9e8);}return _0x292b72[_0x3b24('0x19')](_0x1fe9e8)['end']();};}function respondWithResult(_0xe1d3e0,_0x526a7b){_0x526a7b=_0x526a7b||0xc8;return function(_0x509ee3){if(_0x509ee3){return _0xe1d3e0['status'](_0x526a7b)[_0x3b24('0x1a')](_0x509ee3);}};}function respondWithFilteredResult(_0x358571,_0x2783a1){return function(_0x373da8){if(_0x373da8){var _0x1d5d26=typeof _0x2783a1[_0x3b24('0x1b')]===_0x3b24('0x1c')&&typeof _0x2783a1[_0x3b24('0x1d')]===_0x3b24('0x1c');var _0x632a3f=_0x373da8[_0x3b24('0x1e')];var _0x506c09=_0x1d5d26?0x0:_0x2783a1[_0x3b24('0x1b')];var _0x551eab=_0x1d5d26?_0x373da8[_0x3b24('0x1e')]:_0x2783a1[_0x3b24('0x1b')]+_0x2783a1['limit'];var _0x8d0087;if(_0x551eab>=_0x632a3f){_0x551eab=_0x632a3f;_0x8d0087=0xc8;}else{_0x8d0087=0xce;}_0x358571[_0x3b24('0x19')](_0x8d0087);return _0x358571['set'](_0x3b24('0x1f'),_0x506c09+'-'+_0x551eab+'/'+_0x632a3f)[_0x3b24('0x1a')](_0x373da8);}return null;};}function patchUpdates(_0x39d0bc){return function(_0x252661){try{jsonpatch['apply'](_0x252661,_0x39d0bc,!![]);}catch(_0x870d4d){return BPromise[_0x3b24('0x20')](_0x870d4d);}return _0x252661[_0x3b24('0x21')]();};}function saveUpdates(_0x15de63,_0x245694){return function(_0x1b6456){if(_0x1b6456){return _0x1b6456['update'](_0x15de63)[_0x3b24('0x22')](function(_0x30519d){return _0x30519d;});}return null;};}function removeEntity(_0x40cc04,_0xa59b44){return function(_0x337699){if(_0x337699){return _0x337699[_0x3b24('0x23')]()[_0x3b24('0x22')](function(){_0x40cc04[_0x3b24('0x19')](0xcc)[_0x3b24('0x24')]();});}};}function handleEntityNotFound(_0x1a6b94,_0x340d63){return function(_0x417b05){if(!_0x417b05){_0x1a6b94['sendStatus'](0x194);}return _0x417b05;};}function handleError(_0x3d7668,_0x32d637){_0x32d637=_0x32d637||0x1f4;return function(_0x1dd4b7){logger[_0x3b24('0x25')](_0x1dd4b7[_0x3b24('0x26')]);if(_0x1dd4b7['name']){delete _0x1dd4b7[_0x3b24('0x27')];}_0x3d7668['status'](_0x32d637)[_0x3b24('0x28')](_0x1dd4b7);};}exports[_0x3b24('0x29')]=function(_0x6260f5,_0xcc5e17){var _0x273c43={},_0x1b233a={},_0x17e9fd={'count':0x0,'rows':[]};var _0x1b31bf=_['map'](db[_0x3b24('0x2a')]['rawAttributes'],function(_0x5b65c5){return{'name':_0x5b65c5[_0x3b24('0x2b')],'type':_0x5b65c5['type'][_0x3b24('0x2c')]};});_0x1b233a['model']=_[_0x3b24('0x2d')](_0x1b31bf,_0x3b24('0x27'));_0x1b233a[_0x3b24('0x2e')]=_[_0x3b24('0x2f')](_0x6260f5[_0x3b24('0x2e')]);_0x1b233a[_0x3b24('0x30')]=_[_0x3b24('0x31')](_0x1b233a[_0x3b24('0x32')],_0x1b233a[_0x3b24('0x2e')]);_0x273c43[_0x3b24('0x33')]=_[_0x3b24('0x31')](_0x1b233a['model'],qs[_0x3b24('0x34')](_0x6260f5[_0x3b24('0x2e')][_0x3b24('0x34')]));_0x273c43[_0x3b24('0x33')]=_0x273c43[_0x3b24('0x33')][_0x3b24('0x35')]?_0x273c43[_0x3b24('0x33')]:_0x1b233a[_0x3b24('0x32')];if(!_0x6260f5['query'][_0x3b24('0x36')](_0x3b24('0x37'))){_0x273c43[_0x3b24('0x1d')]=qs['limit'](_0x6260f5[_0x3b24('0x2e')]['limit']);_0x273c43[_0x3b24('0x1b')]=qs[_0x3b24('0x1b')](_0x6260f5[_0x3b24('0x2e')][_0x3b24('0x1b')]);}_0x273c43[_0x3b24('0x38')]=qs[_0x3b24('0x39')](_0x6260f5[_0x3b24('0x2e')][_0x3b24('0x39')]);_0x273c43[_0x3b24('0x3a')]=qs[_0x3b24('0x30')](_[_0x3b24('0x3b')](_0x6260f5[_0x3b24('0x2e')],_0x1b233a[_0x3b24('0x30')]),_0x1b31bf);if(_0x6260f5[_0x3b24('0x2e')][_0x3b24('0x3c')]){_0x273c43[_0x3b24('0x3a')]=_[_0x3b24('0x3d')](_0x273c43[_0x3b24('0x3a')],{'$or':_['map'](_0x1b31bf,function(_0x1fba96){if(_0x1fba96[_0x3b24('0x3e')]!==_0x3b24('0x3f')){var _0x138597={};_0x138597[_0x1fba96['name']]={'$like':'%'+_0x6260f5['query'][_0x3b24('0x3c')]+'%'};return _0x138597;}})});}_0x273c43=_[_0x3b24('0x3d')]({},_0x273c43,_0x6260f5[_0x3b24('0x40')]);var _0x15db61={'where':_0x273c43[_0x3b24('0x3a')]};return db[_0x3b24('0x2a')][_0x3b24('0x1e')](_0x15db61)[_0x3b24('0x22')](function(_0x31d602){_0x17e9fd[_0x3b24('0x1e')]=_0x31d602;if(_0x6260f5[_0x3b24('0x2e')][_0x3b24('0x41')]){_0x273c43[_0x3b24('0x42')]=[{'all':!![]}];}return db[_0x3b24('0x2a')][_0x3b24('0x43')](_0x273c43);})[_0x3b24('0x22')](function(_0x3400a6){_0x17e9fd['rows']=_0x3400a6;return _0x17e9fd;})['then'](respondWithFilteredResult(_0xcc5e17,_0x273c43))[_0x3b24('0x44')](handleError(_0xcc5e17,null));};exports[_0x3b24('0x45')]=function(_0x166f1c,_0x50539a){var _0x40e9ea={'raw':![],'where':{'id':_0x166f1c[_0x3b24('0x46')]['id']}},_0xda566b={};_0xda566b[_0x3b24('0x32')]=_[_0x3b24('0x2f')](db[_0x3b24('0x2a')]['rawAttributes']);_0xda566b[_0x3b24('0x2e')]=_[_0x3b24('0x2f')](_0x166f1c[_0x3b24('0x2e')]);_0xda566b[_0x3b24('0x30')]=_[_0x3b24('0x31')](_0xda566b[_0x3b24('0x32')],_0xda566b[_0x3b24('0x2e')]);_0x40e9ea[_0x3b24('0x33')]=_['intersection'](_0xda566b[_0x3b24('0x32')],qs[_0x3b24('0x34')](_0x166f1c[_0x3b24('0x2e')][_0x3b24('0x34')]));_0x40e9ea[_0x3b24('0x33')]=_0x40e9ea['attributes']['length']?_0x40e9ea[_0x3b24('0x33')]:_0xda566b['model'];if(_0x166f1c['query'][_0x3b24('0x41')]){_0x40e9ea[_0x3b24('0x42')]=[{'all':!![]}];}_0x40e9ea=_[_0x3b24('0x3d')]({},_0x40e9ea,_0x166f1c[_0x3b24('0x40')]);return db[_0x3b24('0x2a')][_0x3b24('0x47')](_0x40e9ea)[_0x3b24('0x22')](handleEntityNotFound(_0x50539a,null))['then'](respondWithResult(_0x50539a,null))[_0x3b24('0x44')](handleError(_0x50539a,null));};exports['create']=function(_0x42d438,_0x2fdad1){return db[_0x3b24('0x2a')][_0x3b24('0x48')](_0x42d438[_0x3b24('0x49')],{})[_0x3b24('0x22')](respondWithResult(_0x2fdad1,0xc9))[_0x3b24('0x44')](handleError(_0x2fdad1,null));};exports[_0x3b24('0x4a')]=function(_0x376e49,_0xe725c){if(_0x376e49['body']['id']){delete _0x376e49['body']['id'];}return db[_0x3b24('0x2a')]['find']({'where':{'id':_0x376e49[_0x3b24('0x46')]['id']}})[_0x3b24('0x22')](handleEntityNotFound(_0xe725c,null))[_0x3b24('0x22')](saveUpdates(_0x376e49[_0x3b24('0x49')],null))['then'](respondWithResult(_0xe725c,null))[_0x3b24('0x44')](handleError(_0xe725c,null));};exports[_0x3b24('0x23')]=function(_0x39bb6f,_0x3762aa){return db[_0x3b24('0x2a')]['find']({'where':{'id':_0x39bb6f[_0x3b24('0x46')]['id']}})[_0x3b24('0x22')](handleEntityNotFound(_0x3762aa,null))['then'](removeEntity(_0x3762aa,null))[_0x3b24('0x44')](handleError(_0x3762aa,null));};exports[_0x3b24('0x4b')]=function(_0x2aabf6,_0x5156fb,_0x55b438){var _0x16db60={};var _0x3ea4ee={};var _0x26c1a2;var _0x3c070b;return db[_0x3b24('0x2a')][_0x3b24('0x4c')]({'where':{'id':_0x2aabf6[_0x3b24('0x46')]['id']}})[_0x3b24('0x22')](handleEntityNotFound(_0x5156fb,null))['then'](function(_0x1c430d){if(_0x1c430d){_0x26c1a2=_0x1c430d;_0x3ea4ee[_0x3b24('0x32')]=_['keys'](db[_0x3b24('0x4d')]['rawAttributes']);_0x3ea4ee['query']=_[_0x3b24('0x2f')](_0x2aabf6[_0x3b24('0x2e')]);_0x3ea4ee[_0x3b24('0x30')]=_[_0x3b24('0x31')](_0x3ea4ee[_0x3b24('0x32')],_0x3ea4ee[_0x3b24('0x2e')]);_0x16db60['attributes']=_['intersection'](_0x3ea4ee[_0x3b24('0x32')],qs[_0x3b24('0x34')](_0x2aabf6[_0x3b24('0x2e')][_0x3b24('0x34')]));_0x16db60[_0x3b24('0x33')]=_0x16db60[_0x3b24('0x33')]['length']?_0x16db60[_0x3b24('0x33')]:_0x3ea4ee[_0x3b24('0x32')];_0x16db60[_0x3b24('0x38')]=qs[_0x3b24('0x39')](_0x2aabf6['query'][_0x3b24('0x39')]);_0x16db60[_0x3b24('0x3a')]=qs[_0x3b24('0x30')](_[_0x3b24('0x3b')](_0x2aabf6[_0x3b24('0x2e')],_0x3ea4ee['filters']));if(_0x2aabf6[_0x3b24('0x2e')]['filter']){_0x16db60[_0x3b24('0x3a')]=_[_0x3b24('0x3d')](_0x16db60[_0x3b24('0x3a')],{'$or':_['map'](_0x16db60['attributes'],function(_0x1b3b20){var _0x305b25={};_0x305b25[_0x1b3b20]={'$like':'%'+_0x2aabf6[_0x3b24('0x2e')][_0x3b24('0x3c')]+'%'};return _0x305b25;})});}_0x16db60=_[_0x3b24('0x3d')]({},_0x16db60,_0x2aabf6[_0x3b24('0x40')]);return _0x26c1a2['getConfigurations'](_0x16db60);}})[_0x3b24('0x22')](function(_0x58ad56){if(_0x58ad56){_0x3c070b=_0x58ad56[_0x3b24('0x35')];if(!_0x2aabf6[_0x3b24('0x2e')][_0x3b24('0x36')](_0x3b24('0x37'))){_0x16db60[_0x3b24('0x1d')]=qs[_0x3b24('0x1d')](_0x2aabf6[_0x3b24('0x2e')][_0x3b24('0x1d')]);_0x16db60[_0x3b24('0x1b')]=qs[_0x3b24('0x1b')](_0x2aabf6[_0x3b24('0x2e')][_0x3b24('0x1b')]);}return _0x26c1a2[_0x3b24('0x4b')](_0x16db60);}})['then'](function(_0x27225b){if(_0x27225b){return _0x27225b?{'count':_0x3c070b,'rows':_0x27225b}:null;}})[_0x3b24('0x22')](respondWithResult(_0x5156fb,null))['catch'](handleError(_0x5156fb,null));};exports[_0x3b24('0x4e')]=function(_0x36eb59,_0x4fb4dc,_0x1176ae){if(_0x36eb59['body']['id']){delete _0x36eb59['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x36eb59[_0x3b24('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fb4dc,null))[_0x3b24('0x22')](function(_0x161aea){if(_0x161aea){_0x36eb59[_0x3b24('0x49')][_0x3b24('0x4f')]=_0x161aea['id'];_0x36eb59[_0x3b24('0x49')][_0x3b24('0x50')]=integrations[_0x3b24('0x51')](_0x36eb59[_0x3b24('0x49')][_0x3b24('0x52')],_0x36eb59[_0x3b24('0x49')]['type']);_0x36eb59[_0x3b24('0x49')][_0x3b24('0x53')]=integrations['getDescriptions'](_0x36eb59[_0x3b24('0x49')]['channel'],_0x36eb59[_0x3b24('0x49')][_0x3b24('0x3e')]);return db[_0x3b24('0x4d')][_0x3b24('0x48')](_0x36eb59[_0x3b24('0x49')],{'include':[{'model':db[_0x3b24('0x54')],'as':_0x3b24('0x50')},{'model':db[_0x3b24('0x54')],'as':_0x3b24('0x53')}]});}return null;})[_0x3b24('0x22')](respondWithResult(_0x4fb4dc,null))[_0x3b24('0x44')](handleError(_0x4fb4dc,null));};exports['getFields']=function(_0xa35f4e,_0x5d9e48,_0x28bad2){var _0x27dcd4;var _0x903449='';var _0x2e41f0='Task';return db[_0x3b24('0x2a')][_0x3b24('0x4c')]({'where':{'id':_0xa35f4e['params']['id']},'attributes':['id',_0x3b24('0x55'),_0x3b24('0x56'),_0x3b24('0x57'),'username',_0x3b24('0x58'),_0x3b24('0x59')]})[_0x3b24('0x22')](handleEntityNotFound(_0x5d9e48,null))[_0x3b24('0x22')](function(_0x10d7be){if(_0x10d7be){_0x903449=_0x10d7be[_0x3b24('0x55')];var _0x5746ad=_0x903449[_0x3b24('0x5a')](-0x1);if(_0x5746ad==='/'){_0x903449=_0x903449[_0x3b24('0x5b')](0x0,_0x903449[_0x3b24('0x5c')](_0x5746ad));}_0x27dcd4=new jsforce['Connection']({'oauth2':{'loginUrl':_0x903449,'clientId':_0x10d7be[_0x3b24('0x56')],'clientSecret':_0x10d7be['clientSecret']}});return _0x27dcd4[_0x3b24('0x5d')](_0x10d7be[_0x3b24('0x5e')],_0x10d7be[_0x3b24('0x58')][_0x3b24('0x5f')](_0x10d7be[_0x3b24('0x59')]));}})['then'](function(_0x55134e){if(_0x55134e){if(!_['isNil'](_0xa35f4e[_0x3b24('0x2e')][_0x3b24('0x60')])){_0x2e41f0=_0xa35f4e[_0x3b24('0x2e')][_0x3b24('0x60')];}return _0x27dcd4['sobject'](_0x2e41f0)[_0x3b24('0x61')]();}})[_0x3b24('0x22')](function(_0x29e9a2){var _0xb8abe8=[_0x3b24('0x62'),_0x3b24('0x63'),_0x3b24('0x64'),_0x3b24('0x65'),'Subject',_0x3b24('0x66')];var _0x27375e=[_0x3b24('0x67'),_0x3b24('0x68'),'picklist',_0x3b24('0x69'),'email',_0x3b24('0x6a'),_0x3b24('0x6b')];if(_0x29e9a2){_['remove'](_0x29e9a2[_0x3b24('0x34')],function(_0x3a20a0){return _0xb8abe8['includes'](_0x3a20a0['name'])||!_0x27375e[_0x3b24('0x6c')](_0x3a20a0['type']);});return{'count':_0x29e9a2[_0x3b24('0x34')][_0x3b24('0x35')],'rows':_[_0x3b24('0x2d')](_0x29e9a2[_0x3b24('0x34')],function(_0xb41ff){return{'id':_0xb41ff[_0x3b24('0x27')],'name':_0xb41ff[_0x3b24('0x6d')],'custom':_0xb41ff['custom'],'options':_0xb41ff[_0x3b24('0x6e')][_0x3b24('0x35')]>0x0?_[_0x3b24('0x2d')](_0xb41ff[_0x3b24('0x6e')],function(_0x53a2e7){return{'name':_0x53a2e7['label'],'value':_0x53a2e7[_0x3b24('0x6f')]};}):_0xb41ff[_0x3b24('0x3e')]==_0x3b24('0x69')?[{'name':'True','value':_0x3b24('0x70')},{'name':_0x3b24('0x71'),'value':_0x3b24('0x72')}]:[]};})};}})['then'](respondWithResult(_0x5d9e48,null))[_0x3b24('0x44')](function(_0x1e36db){var _0x3ff678=_0xa35f4e['query'][_0x3b24('0x73')]?0x1f4:_0x1e36db[_0x3b24('0x74')]||0x1f4;logger[_0x3b24('0x25')](_0x3b24('0x75'),'getFields',_0x3ff678,JSON['stringify'](_0x1e36db));delete _0x1e36db[_0x3b24('0x27')];if(_0x3ff678===0x191){_0x3ff678=0x190;}_0x5d9e48[_0x3b24('0x19')](_0x3ff678)[_0x3b24('0x28')](_0xa35f4e[_0x3b24('0x2e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1e36db[_0x3b24('0x74')]}:_0x1e36db);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2a2c204..4591126 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 _0x1165=['path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','api','moment','bluebird'];(function(_0x3a1749,_0x456218){var _0x5425a7=function(_0x525b41){while(--_0x525b41){_0x3a1749['push'](_0x3a1749['shift']());}};_0x5425a7(++_0x456218);}(_0x1165,0x1d6));var _0x5116=function(_0x465da7,_0x495254){_0x465da7=_0x465da7-0x0;var _0x3bcb75=_0x1165[_0x465da7];return _0x3bcb75;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5116('0x0'));var moment=require(_0x5116('0x1'));var BPromise=require(_0x5116('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5116('0x3'));var rimraf=require('rimraf');var config=require(_0x5116('0x4'));var attributes=require(_0x5116('0x5'));var integrations=require(_0x5116('0x6'));module[_0x5116('0x7')]=function(_0x112845,_0x313b36){return _0x112845[_0x5116('0x8')](_0x5116('0x9'),attributes,{'tableName':_0x5116('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf78=['define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x341231,_0x54fcb9){var _0x18a72e=function(_0x238d82){while(--_0x238d82){_0x341231['push'](_0x341231['shift']());}};_0x18a72e(++_0x54fcb9);}(_0xcf78,0x13b));var _0x8cf7=function(_0x496c54,_0x35888b){_0x496c54=_0x496c54-0x0;var _0x25a638=_0xcf78[_0x496c54];return _0x25a638;};'use strict';var _=require(_0x8cf7('0x0'));var util=require('util');var logger=require(_0x8cf7('0x1'))(_0x8cf7('0x2'));var moment=require(_0x8cf7('0x3'));var BPromise=require('bluebird');var rp=require(_0x8cf7('0x4'));var fs=require('fs');var path=require(_0x8cf7('0x5'));var rimraf=require(_0x8cf7('0x6'));var config=require(_0x8cf7('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x8cf7('0x8'));module['exports']=function(_0x3f67e4,_0x2bf59a){return _0x3f67e4[_0x8cf7('0x9')](_0x8cf7('0xa'),attributes,{'tableName':_0x8cf7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 2baef7f..12c77c0 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 _0x08f3=['limit','include','map','model','then','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','raw','options','where','attributes'];(function(_0x4f74f1,_0x2c0cce){var _0x22bb61=function(_0x474aa9){while(--_0x474aa9){_0x4f74f1['push'](_0x4f74f1['shift']());}};_0x22bb61(++_0x2c0cce);}(_0x08f3,0x142));var _0x308f=function(_0x484cae,_0xdcb4d8){_0x484cae=_0x484cae-0x0;var _0x336f2f=_0x08f3[_0x484cae];return _0x336f2f;};'use strict';var _=require(_0x308f('0x0'));var util=require(_0x308f('0x1'));var moment=require(_0x308f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x308f('0x3'));var db=require(_0x308f('0x4'))['db'];var utils=require(_0x308f('0x5'));var logger=require(_0x308f('0x6'))('rpc');var config=require(_0x308f('0x7'));var jayson=require(_0x308f('0x8'));var client=jayson[_0x308f('0x9')][_0x308f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45c471,_0x33c7ed,_0x265715){return new BPromise(function(_0x114888,_0x15d34e){return client[_0x308f('0xb')](_0x45c471,_0x265715)['then'](function(_0x5825d5){logger[_0x308f('0xc')](_0x308f('0xd'),_0x33c7ed,_0x308f('0xe'));logger[_0x308f('0xf')](_0x308f('0x10'),_0x33c7ed,'request\x20sent',JSON[_0x308f('0x11')](_0x5825d5));if(_0x5825d5[_0x308f('0x12')]){if(_0x5825d5[_0x308f('0x12')][_0x308f('0x13')]===0x1f4){logger[_0x308f('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x33c7ed,_0x5825d5[_0x308f('0x12')]['message']);return _0x15d34e(_0x5825d5[_0x308f('0x12')][_0x308f('0x14')]);}logger['error'](_0x308f('0xd'),_0x33c7ed,_0x5825d5[_0x308f('0x12')]['message']);return _0x114888(_0x5825d5['error'][_0x308f('0x14')]);}else{logger[_0x308f('0xc')](_0x308f('0xd'),_0x33c7ed,'request\x20sent');_0x114888(_0x5825d5[_0x308f('0x15')]['message']);}})[_0x308f('0x16')](function(_0x5e6b14){logger[_0x308f('0x12')](_0x308f('0xd'),_0x33c7ed,_0x5e6b14);_0x15d34e(_0x5e6b14);});});}exports[_0x308f('0x17')]=function(_0x973880){var _0x2cc842=this;return new Promise(function(_0x11bc0e,_0x474c91){return db['SalesforceAccount']['findAll']({'raw':_0x973880['options']?_0x973880['options'][_0x308f('0x18')]===undefined?!![]:![]:!![],'where':_0x973880[_0x308f('0x19')]?_0x973880['options'][_0x308f('0x1a')]||null:null,'attributes':_0x973880['options']?_0x973880['options'][_0x308f('0x1b')]||null:null,'limit':_0x973880[_0x308f('0x19')]?_0x973880[_0x308f('0x19')][_0x308f('0x1c')]||null:null,'include':_0x973880[_0x308f('0x19')]?_0x973880[_0x308f('0x19')][_0x308f('0x1d')]?_[_0x308f('0x1e')](_0x973880[_0x308f('0x19')][_0x308f('0x1d')],function(_0x57762f){return{'model':db[_0x57762f['model']],'as':_0x57762f['as'],'attributes':_0x57762f['attributes'],'include':_0x57762f['include']?_['map'](_0x57762f[_0x308f('0x1d')],function(_0x4e56b9){return{'model':db[_0x4e56b9[_0x308f('0x1f')]],'as':_0x4e56b9['as'],'attributes':_0x4e56b9[_0x308f('0x1b')],'include':_0x4e56b9['include']?_[_0x308f('0x1e')](_0x4e56b9[_0x308f('0x1d')],function(_0x639ac4){return{'model':db[_0x639ac4['model']],'as':_0x639ac4['as'],'attributes':_0x639ac4[_0x308f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x308f('0x20')](function(_0x484206){logger[_0x308f('0xc')](_0x308f('0x17'),_0x973880);logger[_0x308f('0xf')]('GetSalesforceAccount',_0x973880,JSON[_0x308f('0x11')](_0x484206));_0x11bc0e(_0x484206);})[_0x308f('0x16')](function(_0x26b026){logger[_0x308f('0x12')](_0x308f('0x17'),_0x26b026[_0x308f('0x14')],_0x973880);_0x474c91(_0x2cc842[_0x308f('0x12')](0x1f4,_0x26b026[_0x308f('0x14')]));});});};exports[_0x308f('0x21')]=function(_0x32159c){var _0x41c4a=this;return new Promise(function(_0x3b4686,_0x3b7c5b){return db[_0x308f('0x22')]['find']({'raw':_0x32159c['options']?_0x32159c[_0x308f('0x19')][_0x308f('0x18')]===undefined?!![]:![]:!![],'where':_0x32159c[_0x308f('0x19')]?_0x32159c[_0x308f('0x19')][_0x308f('0x1a')]||null:null,'attributes':_0x32159c[_0x308f('0x19')]?_0x32159c[_0x308f('0x19')]['attributes']||null:null,'include':_0x32159c[_0x308f('0x19')]?_0x32159c[_0x308f('0x19')]['include']?_['map'](_0x32159c['options'][_0x308f('0x1d')],function(_0x48a046){return{'model':db[_0x48a046[_0x308f('0x1f')]],'as':_0x48a046['as'],'attributes':_0x48a046[_0x308f('0x1b')],'include':_0x48a046[_0x308f('0x1d')]?_[_0x308f('0x1e')](_0x48a046['include'],function(_0x7cbae2){return{'model':db[_0x7cbae2['model']],'as':_0x7cbae2['as'],'attributes':_0x7cbae2[_0x308f('0x1b')],'include':_0x7cbae2[_0x308f('0x1d')]?_[_0x308f('0x1e')](_0x7cbae2[_0x308f('0x1d')],function(_0xffe571){return{'model':db[_0xffe571[_0x308f('0x1f')]],'as':_0xffe571['as'],'attributes':_0xffe571[_0x308f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x308f('0x20')](function(_0x5d2dc6){logger[_0x308f('0xc')](_0x308f('0x21'),_0x32159c);logger[_0x308f('0xf')](_0x308f('0x21'),_0x32159c,JSON[_0x308f('0x11')](_0x5d2dc6));_0x3b4686(_0x5d2dc6);})[_0x308f('0x16')](function(_0xb766f6){logger[_0x308f('0x12')]('ShowSalesforceAccount',_0xb766f6[_0x308f('0x14')],_0x32159c);_0x3b7c5b(_0x41c4a['error'](0x1f4,_0xb766f6['message']));});});}; \ No newline at end of file +var _0x4472=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','map','include','model','attributes','ShowSalesforceAccount','find','raw','stringify'];(function(_0x4a75b2,_0x570c36){var _0x2df8fb=function(_0x125805){while(--_0x125805){_0x4a75b2['push'](_0x4a75b2['shift']());}};_0x2df8fb(++_0x570c36);}(_0x4472,0x1d4));var _0x2447=function(_0x5e7c7f,_0x5153dc){_0x5e7c7f=_0x5e7c7f-0x0;var _0x16fb3b=_0x4472[_0x5e7c7f];return _0x16fb3b;};'use strict';var _=require(_0x2447('0x0'));var util=require(_0x2447('0x1'));var moment=require(_0x2447('0x2'));var BPromise=require(_0x2447('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2447('0x4'));var db=require(_0x2447('0x5'))['db'];var utils=require(_0x2447('0x6'));var logger=require(_0x2447('0x7'))(_0x2447('0x8'));var config=require(_0x2447('0x9'));var jayson=require(_0x2447('0xa'));var client=jayson[_0x2447('0xb')][_0x2447('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3369cd,_0x35fdea,_0x3c2d24){return new BPromise(function(_0x1ddc9d,_0x218f86){return client['request'](_0x3369cd,_0x3c2d24)[_0x2447('0xd')](function(_0x4482b1){logger[_0x2447('0xe')](_0x2447('0xf'),_0x35fdea,_0x2447('0x10'));logger[_0x2447('0x11')](_0x2447('0x12'),_0x35fdea,'request\x20sent',JSON['stringify'](_0x4482b1));if(_0x4482b1[_0x2447('0x13')]){if(_0x4482b1[_0x2447('0x13')]['code']===0x1f4){logger[_0x2447('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x35fdea,_0x4482b1[_0x2447('0x13')][_0x2447('0x14')]);return _0x218f86(_0x4482b1[_0x2447('0x13')][_0x2447('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x35fdea,_0x4482b1[_0x2447('0x13')][_0x2447('0x14')]);return _0x1ddc9d(_0x4482b1[_0x2447('0x13')]['message']);}else{logger[_0x2447('0xe')](_0x2447('0xf'),_0x35fdea,_0x2447('0x10'));_0x1ddc9d(_0x4482b1[_0x2447('0x15')][_0x2447('0x14')]);}})[_0x2447('0x16')](function(_0x56f947){logger[_0x2447('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x35fdea,_0x56f947);_0x218f86(_0x56f947);});});}exports[_0x2447('0x17')]=function(_0x1fc293){var _0x1fbb73=this;return new Promise(function(_0x526584,_0x1cf61a){return db[_0x2447('0x18')][_0x2447('0x19')]({'raw':_0x1fc293[_0x2447('0x1a')]?_0x1fc293[_0x2447('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc293[_0x2447('0x1a')]?_0x1fc293[_0x2447('0x1a')][_0x2447('0x1b')]||null:null,'attributes':_0x1fc293[_0x2447('0x1a')]?_0x1fc293[_0x2447('0x1a')]['attributes']||null:null,'limit':_0x1fc293['options']?_0x1fc293[_0x2447('0x1a')]['limit']||null:null,'include':_0x1fc293['options']?_0x1fc293[_0x2447('0x1a')]['include']?_[_0x2447('0x1c')](_0x1fc293['options'][_0x2447('0x1d')],function(_0x5a9477){return{'model':db[_0x5a9477[_0x2447('0x1e')]],'as':_0x5a9477['as'],'attributes':_0x5a9477[_0x2447('0x1f')],'include':_0x5a9477[_0x2447('0x1d')]?_['map'](_0x5a9477['include'],function(_0x5ad34f){return{'model':db[_0x5ad34f['model']],'as':_0x5ad34f['as'],'attributes':_0x5ad34f[_0x2447('0x1f')],'include':_0x5ad34f[_0x2447('0x1d')]?_['map'](_0x5ad34f['include'],function(_0x55cc9d){return{'model':db[_0x55cc9d[_0x2447('0x1e')]],'as':_0x55cc9d['as'],'attributes':_0x55cc9d[_0x2447('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbdee){logger[_0x2447('0xe')](_0x2447('0x17'),_0x1fc293);logger[_0x2447('0x11')](_0x2447('0x17'),_0x1fc293,JSON['stringify'](_0x4cbdee));_0x526584(_0x4cbdee);})[_0x2447('0x16')](function(_0x37dd96){logger[_0x2447('0x13')](_0x2447('0x17'),_0x37dd96[_0x2447('0x14')],_0x1fc293);_0x1cf61a(_0x1fbb73[_0x2447('0x13')](0x1f4,_0x37dd96['message']));});});};exports[_0x2447('0x20')]=function(_0x465864){var _0x432d7f=this;return new Promise(function(_0x5d4bd6,_0x2b18f1){return db['SalesforceAccount'][_0x2447('0x21')]({'raw':_0x465864['options']?_0x465864[_0x2447('0x1a')][_0x2447('0x22')]===undefined?!![]:![]:!![],'where':_0x465864[_0x2447('0x1a')]?_0x465864[_0x2447('0x1a')]['where']||null:null,'attributes':_0x465864['options']?_0x465864[_0x2447('0x1a')]['attributes']||null:null,'include':_0x465864[_0x2447('0x1a')]?_0x465864[_0x2447('0x1a')][_0x2447('0x1d')]?_['map'](_0x465864[_0x2447('0x1a')][_0x2447('0x1d')],function(_0x580cb6){return{'model':db[_0x580cb6[_0x2447('0x1e')]],'as':_0x580cb6['as'],'attributes':_0x580cb6[_0x2447('0x1f')],'include':_0x580cb6[_0x2447('0x1d')]?_['map'](_0x580cb6[_0x2447('0x1d')],function(_0xae3a6){return{'model':db[_0xae3a6[_0x2447('0x1e')]],'as':_0xae3a6['as'],'attributes':_0xae3a6[_0x2447('0x1f')],'include':_0xae3a6[_0x2447('0x1d')]?_[_0x2447('0x1c')](_0xae3a6[_0x2447('0x1d')],function(_0x28b7e7){return{'model':db[_0x28b7e7[_0x2447('0x1e')]],'as':_0x28b7e7['as'],'attributes':_0x28b7e7[_0x2447('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2447('0xd')](function(_0x6efe54){logger[_0x2447('0xe')](_0x2447('0x20'),_0x465864);logger['debug'](_0x2447('0x20'),_0x465864,JSON[_0x2447('0x23')](_0x6efe54));_0x5d4bd6(_0x6efe54);})[_0x2447('0x16')](function(_0x1daa41){logger[_0x2447('0x13')](_0x2447('0x20'),_0x1daa41[_0x2447('0x14')],_0x465864);_0x2b18f1(_0x432d7f['error'](0x1f4,_0x1daa41[_0x2447('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 16e3e8b..41c348a 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x0b0e[_0x57474e];return _0xfaae8c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0xa7cb1f,_0x5ec798){var _0xa4dd5b=function(_0x51241e){while(--_0x51241e){_0xa7cb1f['push'](_0xa7cb1f['shift']());}};_0xa4dd5b(++_0x5ec798);}(_0x7a54,0x106));var _0x47a5=function(_0x43eb3d,_0x4cd496){_0x43eb3d=_0x43eb3d-0x0;var _0x93f58d=_0x7a54[_0x43eb3d];return _0x93f58d;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 111dad2..c78af66 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 _0x3bea=['account','sequelize','STRING','Task','Case','ENUM','contact','lead','contact_lead'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x3bea,0x10f));var _0xa3be=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3bea[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0xa3be('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3be('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xa3be('0x2'),_0xa3be('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xa3be('0x4')]('contact_lead',_0xa3be('0x5'),_0xa3be('0x6'),'account_contact_lead','account'),'defaultValue':_0xa3be('0x7')},'moduleCreate':{'type':Sequelize[_0xa3be('0x4')]('nothing',_0xa3be('0x5'),'lead',_0xa3be('0x8')),'defaultValue':_0xa3be('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xa3be('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xa3be('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xa3be('0x1')]}}; \ No newline at end of file +var _0x17d6=['STRING','ENUM','Task','Case','lead','account','contact_lead','contact','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x17d6,0xbc));var _0x617d=function(_0x4053ac,_0x4539f3){_0x4053ac=_0x4053ac-0x0;var _0x2c80c7=_0x17d6[_0x4053ac];return _0x2c80c7;};'use strict';var Sequelize=require('sequelize');module[_0x617d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x617d('0x1')]},'ticketType':{'type':Sequelize[_0x617d('0x2')](_0x617d('0x3'),_0x617d('0x4')),'defaultValue':_0x617d('0x3')},'moduleSearch':{'type':Sequelize[_0x617d('0x2')]('contact_lead','contact',_0x617d('0x5'),'account_contact_lead',_0x617d('0x6')),'defaultValue':_0x617d('0x7')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x617d('0x8'),_0x617d('0x5'),_0x617d('0x6')),'defaultValue':_0x617d('0x5')},'leadId':{'type':Sequelize[_0x617d('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x617d('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b49ceae..1fd8af5 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 _0x8d6f=['end','error','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy'];(function(_0x4e8410,_0x1eb762){var _0x59b2cf=function(_0x4e2644){while(--_0x4e2644){_0x4e8410['push'](_0x4e8410['shift']());}};_0x59b2cf(++_0x1eb762);}(_0x8d6f,0x1bb));var _0xf8d6=function(_0x3c97a3,_0x19a5cc){_0x3c97a3=_0x3c97a3-0x0;var _0x410d97=_0x8d6f[_0x3c97a3];return _0x410d97;};'use strict';var emlformat=require(_0xf8d6('0x0'));var rimraf=require(_0xf8d6('0x1'));var zipdir=require(_0xf8d6('0x2'));var jsonpatch=require(_0xf8d6('0x3'));var rp=require(_0xf8d6('0x4'));var moment=require(_0xf8d6('0x5'));var BPromise=require(_0xf8d6('0x6'));var Mustache=require(_0xf8d6('0x7'));var util=require(_0xf8d6('0x8'));var path=require(_0xf8d6('0x9'));var sox=require(_0xf8d6('0xa'));var csv=require(_0xf8d6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8d6('0xc'));var squel=require('squel');var crypto=require(_0xf8d6('0xd'));var jsforce=require(_0xf8d6('0xe'));var deskjs=require(_0xf8d6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf8d6('0x10'));var Papa=require(_0xf8d6('0x11'));var Redis=require(_0xf8d6('0x12'));var authService=require(_0xf8d6('0x13'));var qs=require(_0xf8d6('0x14'));var as=require(_0xf8d6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8d6('0x16'))('api');var utils=require(_0xf8d6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf8d6('0x18'))['db'];function respondWithStatusCode(_0x4716a6,_0x37c61f){_0x37c61f=_0x37c61f||0xcc;return function(_0x243e34){if(_0x243e34){return _0x4716a6[_0xf8d6('0x19')](_0x37c61f);}return _0x4716a6['status'](_0x37c61f)['end']();};}function respondWithResult(_0x7a99e8,_0x4bb394){_0x4bb394=_0x4bb394||0xc8;return function(_0x5b51ae){if(_0x5b51ae){return _0x7a99e8[_0xf8d6('0x1a')](_0x4bb394)['json'](_0x5b51ae);}};}function respondWithFilteredResult(_0x1759f1,_0x2d4f4b){return function(_0x1164d8){if(_0x1164d8){var _0x502d77=typeof _0x2d4f4b['offset']===_0xf8d6('0x1b')&&typeof _0x2d4f4b[_0xf8d6('0x1c')]==='undefined';var _0x11d450=_0x1164d8[_0xf8d6('0x1d')];var _0x8b596c=_0x502d77?0x0:_0x2d4f4b[_0xf8d6('0x1e')];var _0x2fb4f1=_0x502d77?_0x1164d8['count']:_0x2d4f4b[_0xf8d6('0x1e')]+_0x2d4f4b[_0xf8d6('0x1c')];var _0x499158;if(_0x2fb4f1>=_0x11d450){_0x2fb4f1=_0x11d450;_0x499158=0xc8;}else{_0x499158=0xce;}_0x1759f1[_0xf8d6('0x1a')](_0x499158);return _0x1759f1['set'](_0xf8d6('0x1f'),_0x8b596c+'-'+_0x2fb4f1+'/'+_0x11d450)['json'](_0x1164d8);}return null;};}function patchUpdates(_0x42983e){return function(_0x27d1f8){try{jsonpatch[_0xf8d6('0x20')](_0x27d1f8,_0x42983e,!![]);}catch(_0x55e468){return BPromise[_0xf8d6('0x21')](_0x55e468);}return _0x27d1f8[_0xf8d6('0x22')]();};}function saveUpdates(_0x131abf,_0x2b915a){return function(_0x26a750){if(_0x26a750){return _0x26a750['update'](_0x131abf)[_0xf8d6('0x23')](function(_0x422c60){return _0x422c60;});}return null;};}function removeEntity(_0x3354af,_0x132ce8){return function(_0x57a0c0){if(_0x57a0c0){return _0x57a0c0[_0xf8d6('0x24')]()[_0xf8d6('0x23')](function(){_0x3354af[_0xf8d6('0x1a')](0xcc)[_0xf8d6('0x25')]();});}};}function handleEntityNotFound(_0x36cd4a,_0x345e06){return function(_0x5a14d4){if(!_0x5a14d4){_0x36cd4a['sendStatus'](0x194);}return _0x5a14d4;};}function handleError(_0x2e843e,_0x34cf08){_0x34cf08=_0x34cf08||0x1f4;return function(_0x19d726){logger[_0xf8d6('0x26')](_0x19d726['stack']);if(_0x19d726['name']){delete _0x19d726[_0xf8d6('0x27')];}_0x2e843e[_0xf8d6('0x1a')](_0x34cf08)[_0xf8d6('0x28')](_0x19d726);};}exports[_0xf8d6('0x29')]=function(_0x4f0a9d,_0x5c549d){var _0x1d01cb={},_0x11ebd7={},_0x359916={'count':0x0,'rows':[]};var _0x5b2d28=_['map'](db[_0xf8d6('0x2a')][_0xf8d6('0x2b')],function(_0x6c9d80){return{'name':_0x6c9d80[_0xf8d6('0x2c')],'type':_0x6c9d80[_0xf8d6('0x2d')]['key']};});_0x11ebd7[_0xf8d6('0x2e')]=_['map'](_0x5b2d28,_0xf8d6('0x27'));_0x11ebd7['query']=_[_0xf8d6('0x2f')](_0x4f0a9d[_0xf8d6('0x30')]);_0x11ebd7[_0xf8d6('0x31')]=_[_0xf8d6('0x32')](_0x11ebd7[_0xf8d6('0x2e')],_0x11ebd7[_0xf8d6('0x30')]);_0x1d01cb[_0xf8d6('0x33')]=_['intersection'](_0x11ebd7[_0xf8d6('0x2e')],qs[_0xf8d6('0x34')](_0x4f0a9d[_0xf8d6('0x30')]['fields']));_0x1d01cb[_0xf8d6('0x33')]=_0x1d01cb[_0xf8d6('0x33')][_0xf8d6('0x35')]?_0x1d01cb[_0xf8d6('0x33')]:_0x11ebd7[_0xf8d6('0x2e')];if(!_0x4f0a9d[_0xf8d6('0x30')][_0xf8d6('0x36')](_0xf8d6('0x37'))){_0x1d01cb[_0xf8d6('0x1c')]=qs[_0xf8d6('0x1c')](_0x4f0a9d[_0xf8d6('0x30')][_0xf8d6('0x1c')]);_0x1d01cb[_0xf8d6('0x1e')]=qs[_0xf8d6('0x1e')](_0x4f0a9d[_0xf8d6('0x30')]['offset']);}_0x1d01cb['order']=qs[_0xf8d6('0x38')](_0x4f0a9d['query']['sort']);_0x1d01cb[_0xf8d6('0x39')]=qs['filters'](_['pick'](_0x4f0a9d[_0xf8d6('0x30')],_0x11ebd7[_0xf8d6('0x31')]),_0x5b2d28);if(_0x4f0a9d[_0xf8d6('0x30')]['filter']){_0x1d01cb[_0xf8d6('0x39')]=_[_0xf8d6('0x3a')](_0x1d01cb[_0xf8d6('0x39')],{'$or':_[_0xf8d6('0x3b')](_0x5b2d28,function(_0x1f58a1){if(_0x1f58a1['type']!==_0xf8d6('0x3c')){var _0x4141d0={};_0x4141d0[_0x1f58a1[_0xf8d6('0x27')]]={'$like':'%'+_0x4f0a9d['query'][_0xf8d6('0x3d')]+'%'};return _0x4141d0;}})});}_0x1d01cb=_[_0xf8d6('0x3a')]({},_0x1d01cb,_0x4f0a9d[_0xf8d6('0x3e')]);var _0x2a47ad={'where':_0x1d01cb[_0xf8d6('0x39')]};return db[_0xf8d6('0x2a')][_0xf8d6('0x1d')](_0x2a47ad)['then'](function(_0x89842f){_0x359916[_0xf8d6('0x1d')]=_0x89842f;if(_0x4f0a9d['query'][_0xf8d6('0x3f')]){_0x1d01cb[_0xf8d6('0x40')]=[{'all':!![]}];}return db[_0xf8d6('0x2a')][_0xf8d6('0x41')](_0x1d01cb);})['then'](function(_0x465746){_0x359916[_0xf8d6('0x42')]=_0x465746;return _0x359916;})['then'](respondWithFilteredResult(_0x5c549d,_0x1d01cb))[_0xf8d6('0x43')](handleError(_0x5c549d,null));};exports[_0xf8d6('0x44')]=function(_0x309916,_0x55cc0c){var _0x42038f={'raw':![],'where':{'id':_0x309916[_0xf8d6('0x45')]['id']}},_0x56a86d={};_0x56a86d[_0xf8d6('0x2e')]=_['keys'](db[_0xf8d6('0x2a')][_0xf8d6('0x2b')]);_0x56a86d[_0xf8d6('0x30')]=_['keys'](_0x309916[_0xf8d6('0x30')]);_0x56a86d[_0xf8d6('0x31')]=_[_0xf8d6('0x32')](_0x56a86d[_0xf8d6('0x2e')],_0x56a86d[_0xf8d6('0x30')]);_0x42038f['attributes']=_[_0xf8d6('0x32')](_0x56a86d[_0xf8d6('0x2e')],qs[_0xf8d6('0x34')](_0x309916['query'][_0xf8d6('0x34')]));_0x42038f['attributes']=_0x42038f[_0xf8d6('0x33')][_0xf8d6('0x35')]?_0x42038f[_0xf8d6('0x33')]:_0x56a86d[_0xf8d6('0x2e')];if(_0x309916[_0xf8d6('0x30')][_0xf8d6('0x3f')]){_0x42038f[_0xf8d6('0x40')]=[{'all':!![]}];}_0x42038f=_[_0xf8d6('0x3a')]({},_0x42038f,_0x309916[_0xf8d6('0x3e')]);return db[_0xf8d6('0x2a')][_0xf8d6('0x46')](_0x42038f)[_0xf8d6('0x23')](handleEntityNotFound(_0x55cc0c,null))[_0xf8d6('0x23')](respondWithResult(_0x55cc0c,null))[_0xf8d6('0x43')](handleError(_0x55cc0c,null));};exports['create']=function(_0x4d2407,_0x4b21b9){return db[_0xf8d6('0x2a')][_0xf8d6('0x47')](_0x4d2407[_0xf8d6('0x48')],{})[_0xf8d6('0x23')](respondWithResult(_0x4b21b9,0xc9))['catch'](handleError(_0x4b21b9,null));};exports['update']=function(_0x483225,_0x5be92d){if(_0x483225[_0xf8d6('0x48')]['id']){delete _0x483225[_0xf8d6('0x48')]['id'];}return db['SalesforceConfiguration'][_0xf8d6('0x46')]({'where':{'id':_0x483225['params']['id']}})[_0xf8d6('0x23')](handleEntityNotFound(_0x5be92d,null))[_0xf8d6('0x23')](saveUpdates(_0x483225[_0xf8d6('0x48')],null))['then'](respondWithResult(_0x5be92d,null))[_0xf8d6('0x43')](handleError(_0x5be92d,null));};exports['destroy']=function(_0x2dd58e,_0x490966){return db['SalesforceConfiguration']['find']({'where':{'id':_0x2dd58e[_0xf8d6('0x45')]['id']}})[_0xf8d6('0x23')](handleEntityNotFound(_0x490966,null))['then'](removeEntity(_0x490966,null))[_0xf8d6('0x43')](handleError(_0x490966,null));};exports[_0xf8d6('0x49')]=function(_0x3318ab,_0x5aeb67,_0x20b2cd){var _0x37a6ee={};var _0x3b0d77={};var _0x108785;var _0x453706;return db[_0xf8d6('0x2a')][_0xf8d6('0x4a')]({'where':{'id':_0x3318ab[_0xf8d6('0x45')]['id']}})[_0xf8d6('0x23')](handleEntityNotFound(_0x5aeb67,null))[_0xf8d6('0x23')](function(_0x33f528){if(_0x33f528){_0x108785=_0x33f528;_0x3b0d77[_0xf8d6('0x2e')]=_[_0xf8d6('0x2f')](db[_0xf8d6('0x4b')][_0xf8d6('0x2b')]);_0x3b0d77[_0xf8d6('0x30')]=_[_0xf8d6('0x2f')](_0x3318ab['query']);_0x3b0d77[_0xf8d6('0x31')]=_[_0xf8d6('0x32')](_0x3b0d77['model'],_0x3b0d77['query']);_0x37a6ee[_0xf8d6('0x33')]=_['intersection'](_0x3b0d77['model'],qs[_0xf8d6('0x34')](_0x3318ab[_0xf8d6('0x30')][_0xf8d6('0x34')]));_0x37a6ee[_0xf8d6('0x33')]=_0x37a6ee[_0xf8d6('0x33')][_0xf8d6('0x35')]?_0x37a6ee[_0xf8d6('0x33')]:_0x3b0d77[_0xf8d6('0x2e')];_0x37a6ee[_0xf8d6('0x4c')]=qs['sort'](_0x3318ab[_0xf8d6('0x30')]['sort']);_0x37a6ee[_0xf8d6('0x39')]=qs[_0xf8d6('0x31')](_[_0xf8d6('0x4d')](_0x3318ab[_0xf8d6('0x30')],_0x3b0d77['filters']));if(_0x3318ab['query'][_0xf8d6('0x3d')]){_0x37a6ee['where']=_[_0xf8d6('0x3a')](_0x37a6ee[_0xf8d6('0x39')],{'$or':_[_0xf8d6('0x3b')](_0x37a6ee[_0xf8d6('0x33')],function(_0x4601fb){var _0x33100e={};_0x33100e[_0x4601fb]={'$like':'%'+_0x3318ab[_0xf8d6('0x30')]['filter']+'%'};return _0x33100e;})});}_0x37a6ee=_[_0xf8d6('0x3a')]({},_0x37a6ee,_0x3318ab[_0xf8d6('0x3e')]);return _0x108785['getFields'](_0x37a6ee);}})[_0xf8d6('0x23')](function(_0xaeaa09){if(_0xaeaa09){_0x453706=_0xaeaa09[_0xf8d6('0x35')];if(!_0x3318ab['query'][_0xf8d6('0x36')](_0xf8d6('0x37'))){_0x37a6ee[_0xf8d6('0x1c')]=qs[_0xf8d6('0x1c')](_0x3318ab[_0xf8d6('0x30')][_0xf8d6('0x1c')]);_0x37a6ee['offset']=qs[_0xf8d6('0x1e')](_0x3318ab[_0xf8d6('0x30')]['offset']);}return _0x108785[_0xf8d6('0x49')](_0x37a6ee);}})[_0xf8d6('0x23')](function(_0x257974){if(_0x257974){return _0x257974?{'count':_0x453706,'rows':_0x257974}:null;}})[_0xf8d6('0x23')](respondWithResult(_0x5aeb67,null))[_0xf8d6('0x43')](handleError(_0x5aeb67,null));};exports[_0xf8d6('0x4e')]=function(_0x3aef0f,_0x3eba02,_0x10a895){var _0x209398={};var _0x5735b5={};var _0x4dc688;var _0xfcaf29;return db[_0xf8d6('0x2a')][_0xf8d6('0x4a')]({'where':{'id':_0x3aef0f[_0xf8d6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3eba02,null))[_0xf8d6('0x23')](function(_0x3edb1b){if(_0x3edb1b){_0x4dc688=_0x3edb1b;_0x5735b5[_0xf8d6('0x2e')]=_[_0xf8d6('0x2f')](db['SalesforceField'][_0xf8d6('0x2b')]);_0x5735b5[_0xf8d6('0x30')]=_[_0xf8d6('0x2f')](_0x3aef0f['query']);_0x5735b5[_0xf8d6('0x31')]=_[_0xf8d6('0x32')](_0x5735b5[_0xf8d6('0x2e')],_0x5735b5[_0xf8d6('0x30')]);_0x209398['attributes']=_['intersection'](_0x5735b5[_0xf8d6('0x2e')],qs[_0xf8d6('0x34')](_0x3aef0f[_0xf8d6('0x30')]['fields']));_0x209398['attributes']=_0x209398[_0xf8d6('0x33')][_0xf8d6('0x35')]?_0x209398[_0xf8d6('0x33')]:_0x5735b5[_0xf8d6('0x2e')];_0x209398['order']=qs[_0xf8d6('0x38')](_0x3aef0f['query']['sort']);_0x209398[_0xf8d6('0x39')]=qs[_0xf8d6('0x31')](_['pick'](_0x3aef0f[_0xf8d6('0x30')],_0x5735b5[_0xf8d6('0x31')]));if(_0x3aef0f[_0xf8d6('0x30')][_0xf8d6('0x3d')]){_0x209398[_0xf8d6('0x39')]=_['merge'](_0x209398[_0xf8d6('0x39')],{'$or':_[_0xf8d6('0x3b')](_0x209398[_0xf8d6('0x33')],function(_0x1c0585){var _0x4a5929={};_0x4a5929[_0x1c0585]={'$like':'%'+_0x3aef0f[_0xf8d6('0x30')][_0xf8d6('0x3d')]+'%'};return _0x4a5929;})});}_0x209398=_['merge']({},_0x209398,_0x3aef0f[_0xf8d6('0x3e')]);return _0x4dc688['getSubjects'](_0x209398);}})[_0xf8d6('0x23')](function(_0x3def2d){if(_0x3def2d){_0xfcaf29=_0x3def2d[_0xf8d6('0x35')];if(!_0x3aef0f[_0xf8d6('0x30')][_0xf8d6('0x36')](_0xf8d6('0x37'))){_0x209398['limit']=qs[_0xf8d6('0x1c')](_0x3aef0f[_0xf8d6('0x30')][_0xf8d6('0x1c')]);_0x209398[_0xf8d6('0x1e')]=qs[_0xf8d6('0x1e')](_0x3aef0f[_0xf8d6('0x30')][_0xf8d6('0x1e')]);}return _0x4dc688[_0xf8d6('0x4e')](_0x209398);}})['then'](function(_0x1f175e){if(_0x1f175e){return _0x1f175e?{'count':_0xfcaf29,'rows':_0x1f175e}:null;}})[_0xf8d6('0x23')](respondWithResult(_0x3eba02,null))[_0xf8d6('0x43')](handleError(_0x3eba02,null));};exports[_0xf8d6('0x4f')]=function(_0xc92ac5,_0x305f91,_0x20e2e4){var _0x10ffee={};var _0x128cab={};var _0x1eaae5;var _0x1c92d7;return db['SalesforceConfiguration'][_0xf8d6('0x4a')]({'where':{'id':_0xc92ac5[_0xf8d6('0x45')]['id']}})[_0xf8d6('0x23')](handleEntityNotFound(_0x305f91,null))[_0xf8d6('0x23')](function(_0x13d811){if(_0x13d811){_0x1eaae5=_0x13d811;_0x128cab[_0xf8d6('0x2e')]=_[_0xf8d6('0x2f')](db[_0xf8d6('0x4b')]['rawAttributes']);_0x128cab[_0xf8d6('0x30')]=_[_0xf8d6('0x2f')](_0xc92ac5[_0xf8d6('0x30')]);_0x128cab[_0xf8d6('0x31')]=_['intersection'](_0x128cab[_0xf8d6('0x2e')],_0x128cab[_0xf8d6('0x30')]);_0x10ffee[_0xf8d6('0x33')]=_[_0xf8d6('0x32')](_0x128cab['model'],qs[_0xf8d6('0x34')](_0xc92ac5['query'][_0xf8d6('0x34')]));_0x10ffee[_0xf8d6('0x33')]=_0x10ffee[_0xf8d6('0x33')]['length']?_0x10ffee[_0xf8d6('0x33')]:_0x128cab[_0xf8d6('0x2e')];_0x10ffee[_0xf8d6('0x4c')]=qs['sort'](_0xc92ac5[_0xf8d6('0x30')][_0xf8d6('0x38')]);_0x10ffee[_0xf8d6('0x39')]=qs[_0xf8d6('0x31')](_['pick'](_0xc92ac5[_0xf8d6('0x30')],_0x128cab['filters']));if(_0xc92ac5[_0xf8d6('0x30')][_0xf8d6('0x3d')]){_0x10ffee[_0xf8d6('0x39')]=_[_0xf8d6('0x3a')](_0x10ffee[_0xf8d6('0x39')],{'$or':_[_0xf8d6('0x3b')](_0x10ffee['attributes'],function(_0x404ca8){var _0x25e13f={};_0x25e13f[_0x404ca8]={'$like':'%'+_0xc92ac5[_0xf8d6('0x30')]['filter']+'%'};return _0x25e13f;})});}_0x10ffee=_[_0xf8d6('0x3a')]({},_0x10ffee,_0xc92ac5[_0xf8d6('0x3e')]);return _0x1eaae5[_0xf8d6('0x4f')](_0x10ffee);}})['then'](function(_0x3399a0){if(_0x3399a0){_0x1c92d7=_0x3399a0[_0xf8d6('0x35')];if(!_0xc92ac5[_0xf8d6('0x30')][_0xf8d6('0x36')](_0xf8d6('0x37'))){_0x10ffee[_0xf8d6('0x1c')]=qs['limit'](_0xc92ac5[_0xf8d6('0x30')][_0xf8d6('0x1c')]);_0x10ffee[_0xf8d6('0x1e')]=qs[_0xf8d6('0x1e')](_0xc92ac5[_0xf8d6('0x30')][_0xf8d6('0x1e')]);}return _0x1eaae5['getDescriptions'](_0x10ffee);}})[_0xf8d6('0x23')](function(_0x521d55){if(_0x521d55){return _0x521d55?{'count':_0x1c92d7,'rows':_0x521d55}:null;}})[_0xf8d6('0x23')](respondWithResult(_0x305f91,null))[_0xf8d6('0x43')](handleError(_0x305f91,null));}; \ No newline at end of file +var _0x0f16=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','destroy','getFields','findOne','order','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x2c416a,_0x732630){var _0x4218d5=function(_0x436357){while(--_0x436357){_0x2c416a['push'](_0x2c416a['shift']());}};_0x4218d5(++_0x732630);}(_0x0f16,0x192));var _0x60f1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0f16[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x60f1('0x0'));var rimraf=require(_0x60f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60f1('0x2'));var rp=require(_0x60f1('0x3'));var moment=require(_0x60f1('0x4'));var BPromise=require(_0x60f1('0x5'));var Mustache=require(_0x60f1('0x6'));var util=require(_0x60f1('0x7'));var path=require('path');var sox=require(_0x60f1('0x8'));var csv=require(_0x60f1('0x9'));var ejs=require(_0x60f1('0xa'));var fs=require('fs');var fs_extra=require(_0x60f1('0xb'));var _=require(_0x60f1('0xc'));var squel=require(_0x60f1('0xd'));var crypto=require(_0x60f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x60f1('0xf'));var toCsv=require(_0x60f1('0x9'));var querystring=require(_0x60f1('0x10'));var Papa=require(_0x60f1('0x11'));var Redis=require(_0x60f1('0x12'));var authService=require(_0x60f1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x60f1('0x14'));var hardwareService=require(_0x60f1('0x15'));var logger=require(_0x60f1('0x16'))('api');var utils=require(_0x60f1('0x17'));var config=require(_0x60f1('0x18'));var licenseUtil=require(_0x60f1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d1be3,_0x257b7c){_0x257b7c=_0x257b7c||0xcc;return function(_0x2da820){if(_0x2da820){return _0x2d1be3[_0x60f1('0x1a')](_0x257b7c);}return _0x2d1be3['status'](_0x257b7c)['end']();};}function respondWithResult(_0x16af08,_0x5e7f90){_0x5e7f90=_0x5e7f90||0xc8;return function(_0x3df4b9){if(_0x3df4b9){return _0x16af08['status'](_0x5e7f90)[_0x60f1('0x1b')](_0x3df4b9);}};}function respondWithFilteredResult(_0x59cad1,_0x806026){return function(_0x147e5f){if(_0x147e5f){var _0x47cd3d=typeof _0x806026['offset']==='undefined'&&typeof _0x806026[_0x60f1('0x1c')]===_0x60f1('0x1d');var _0x2ff9bf=_0x147e5f[_0x60f1('0x1e')];var _0x486121=_0x47cd3d?0x0:_0x806026[_0x60f1('0x1f')];var _0x2b570f=_0x47cd3d?_0x147e5f['count']:_0x806026['offset']+_0x806026[_0x60f1('0x1c')];var _0x4747e7;if(_0x2b570f>=_0x2ff9bf){_0x2b570f=_0x2ff9bf;_0x4747e7=0xc8;}else{_0x4747e7=0xce;}_0x59cad1[_0x60f1('0x20')](_0x4747e7);return _0x59cad1[_0x60f1('0x21')](_0x60f1('0x22'),_0x486121+'-'+_0x2b570f+'/'+_0x2ff9bf)[_0x60f1('0x1b')](_0x147e5f);}return null;};}function patchUpdates(_0x39af74){return function(_0x538917){try{jsonpatch[_0x60f1('0x23')](_0x538917,_0x39af74,!![]);}catch(_0x2dc5ce){return BPromise[_0x60f1('0x24')](_0x2dc5ce);}return _0x538917[_0x60f1('0x25')]();};}function saveUpdates(_0x4b90b1,_0x1dfeda){return function(_0x5692d4){if(_0x5692d4){return _0x5692d4['update'](_0x4b90b1)[_0x60f1('0x26')](function(_0xf509ec){return _0xf509ec;});}return null;};}function removeEntity(_0x333d77,_0x1c970a){return function(_0x369f7b){if(_0x369f7b){return _0x369f7b['destroy']()[_0x60f1('0x26')](function(){_0x333d77[_0x60f1('0x20')](0xcc)[_0x60f1('0x27')]();});}};}function handleEntityNotFound(_0x4a6b5d,_0x2df145){return function(_0x4534b4){if(!_0x4534b4){_0x4a6b5d[_0x60f1('0x1a')](0x194);}return _0x4534b4;};}function handleError(_0x2eb607,_0x4ae84f){_0x4ae84f=_0x4ae84f||0x1f4;return function(_0x149b90){logger['error'](_0x149b90['stack']);if(_0x149b90[_0x60f1('0x28')]){delete _0x149b90[_0x60f1('0x28')];}_0x2eb607['status'](_0x4ae84f)[_0x60f1('0x29')](_0x149b90);};}exports[_0x60f1('0x2a')]=function(_0x51c21b,_0x29189a){var _0x34d80a={},_0x3146c3={},_0x42ecbb={'count':0x0,'rows':[]};var _0x277c02=_[_0x60f1('0x2b')](db['SalesforceConfiguration'][_0x60f1('0x2c')],function(_0x234072){return{'name':_0x234072[_0x60f1('0x2d')],'type':_0x234072[_0x60f1('0x2e')][_0x60f1('0x2f')]};});_0x3146c3['model']=_[_0x60f1('0x2b')](_0x277c02,_0x60f1('0x28'));_0x3146c3[_0x60f1('0x30')]=_[_0x60f1('0x31')](_0x51c21b[_0x60f1('0x30')]);_0x3146c3[_0x60f1('0x32')]=_[_0x60f1('0x33')](_0x3146c3[_0x60f1('0x34')],_0x3146c3['query']);_0x34d80a[_0x60f1('0x35')]=_[_0x60f1('0x33')](_0x3146c3[_0x60f1('0x34')],qs[_0x60f1('0x36')](_0x51c21b[_0x60f1('0x30')][_0x60f1('0x36')]));_0x34d80a['attributes']=_0x34d80a['attributes'][_0x60f1('0x37')]?_0x34d80a[_0x60f1('0x35')]:_0x3146c3[_0x60f1('0x34')];if(!_0x51c21b[_0x60f1('0x30')]['hasOwnProperty'](_0x60f1('0x38'))){_0x34d80a[_0x60f1('0x1c')]=qs[_0x60f1('0x1c')](_0x51c21b['query'][_0x60f1('0x1c')]);_0x34d80a[_0x60f1('0x1f')]=qs[_0x60f1('0x1f')](_0x51c21b[_0x60f1('0x30')][_0x60f1('0x1f')]);}_0x34d80a['order']=qs[_0x60f1('0x39')](_0x51c21b['query']['sort']);_0x34d80a[_0x60f1('0x3a')]=qs[_0x60f1('0x32')](_[_0x60f1('0x3b')](_0x51c21b[_0x60f1('0x30')],_0x3146c3['filters']),_0x277c02);if(_0x51c21b[_0x60f1('0x30')]['filter']){_0x34d80a[_0x60f1('0x3a')]=_['merge'](_0x34d80a[_0x60f1('0x3a')],{'$or':_[_0x60f1('0x2b')](_0x277c02,function(_0x32f52c){if(_0x32f52c[_0x60f1('0x2e')]!==_0x60f1('0x3c')){var _0x4e6658={};_0x4e6658[_0x32f52c[_0x60f1('0x28')]]={'$like':'%'+_0x51c21b[_0x60f1('0x30')][_0x60f1('0x3d')]+'%'};return _0x4e6658;}})});}_0x34d80a=_[_0x60f1('0x3e')]({},_0x34d80a,_0x51c21b[_0x60f1('0x3f')]);var _0x3d5fcb={'where':_0x34d80a[_0x60f1('0x3a')]};return db[_0x60f1('0x40')][_0x60f1('0x1e')](_0x3d5fcb)[_0x60f1('0x26')](function(_0x2dbe08){_0x42ecbb[_0x60f1('0x1e')]=_0x2dbe08;if(_0x51c21b[_0x60f1('0x30')][_0x60f1('0x41')]){_0x34d80a[_0x60f1('0x42')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x60f1('0x43')](_0x34d80a);})[_0x60f1('0x26')](function(_0x14b39b){_0x42ecbb[_0x60f1('0x44')]=_0x14b39b;return _0x42ecbb;})[_0x60f1('0x26')](respondWithFilteredResult(_0x29189a,_0x34d80a))['catch'](handleError(_0x29189a,null));};exports[_0x60f1('0x45')]=function(_0x538832,_0x5de259){var _0x40e42c={'raw':![],'where':{'id':_0x538832[_0x60f1('0x46')]['id']}},_0x1b8b86={};_0x1b8b86[_0x60f1('0x34')]=_[_0x60f1('0x31')](db['SalesforceConfiguration'][_0x60f1('0x2c')]);_0x1b8b86['query']=_[_0x60f1('0x31')](_0x538832[_0x60f1('0x30')]);_0x1b8b86[_0x60f1('0x32')]=_[_0x60f1('0x33')](_0x1b8b86['model'],_0x1b8b86[_0x60f1('0x30')]);_0x40e42c['attributes']=_['intersection'](_0x1b8b86['model'],qs['fields'](_0x538832[_0x60f1('0x30')]['fields']));_0x40e42c['attributes']=_0x40e42c[_0x60f1('0x35')][_0x60f1('0x37')]?_0x40e42c['attributes']:_0x1b8b86[_0x60f1('0x34')];if(_0x538832[_0x60f1('0x30')]['includeAll']){_0x40e42c[_0x60f1('0x42')]=[{'all':!![]}];}_0x40e42c=_[_0x60f1('0x3e')]({},_0x40e42c,_0x538832[_0x60f1('0x3f')]);return db[_0x60f1('0x40')]['find'](_0x40e42c)['then'](handleEntityNotFound(_0x5de259,null))[_0x60f1('0x26')](respondWithResult(_0x5de259,null))[_0x60f1('0x47')](handleError(_0x5de259,null));};exports[_0x60f1('0x48')]=function(_0x37b59a,_0x54c42b){return db['SalesforceConfiguration'][_0x60f1('0x48')](_0x37b59a[_0x60f1('0x49')],{})[_0x60f1('0x26')](respondWithResult(_0x54c42b,0xc9))[_0x60f1('0x47')](handleError(_0x54c42b,null));};exports[_0x60f1('0x4a')]=function(_0x2fe6de,_0x560d7a){if(_0x2fe6de[_0x60f1('0x49')]['id']){delete _0x2fe6de[_0x60f1('0x49')]['id'];}return db[_0x60f1('0x40')][_0x60f1('0x4b')]({'where':{'id':_0x2fe6de[_0x60f1('0x46')]['id']}})[_0x60f1('0x26')](handleEntityNotFound(_0x560d7a,null))[_0x60f1('0x26')](saveUpdates(_0x2fe6de[_0x60f1('0x49')],null))['then'](respondWithResult(_0x560d7a,null))[_0x60f1('0x47')](handleError(_0x560d7a,null));};exports[_0x60f1('0x4c')]=function(_0x1f47d4,_0x3f1651){return db[_0x60f1('0x40')]['find']({'where':{'id':_0x1f47d4['params']['id']}})['then'](handleEntityNotFound(_0x3f1651,null))[_0x60f1('0x26')](removeEntity(_0x3f1651,null))[_0x60f1('0x47')](handleError(_0x3f1651,null));};exports[_0x60f1('0x4d')]=function(_0x2e9e8f,_0x59aee6,_0x17a5ae){var _0x2a4bb1={};var _0x3f3f10={};var _0x53d5af;var _0x4a0e1f;return db['SalesforceConfiguration'][_0x60f1('0x4e')]({'where':{'id':_0x2e9e8f[_0x60f1('0x46')]['id']}})[_0x60f1('0x26')](handleEntityNotFound(_0x59aee6,null))[_0x60f1('0x26')](function(_0x37d5a3){if(_0x37d5a3){_0x53d5af=_0x37d5a3;_0x3f3f10[_0x60f1('0x34')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x3f3f10['query']=_[_0x60f1('0x31')](_0x2e9e8f[_0x60f1('0x30')]);_0x3f3f10[_0x60f1('0x32')]=_[_0x60f1('0x33')](_0x3f3f10[_0x60f1('0x34')],_0x3f3f10[_0x60f1('0x30')]);_0x2a4bb1[_0x60f1('0x35')]=_[_0x60f1('0x33')](_0x3f3f10[_0x60f1('0x34')],qs['fields'](_0x2e9e8f['query'][_0x60f1('0x36')]));_0x2a4bb1[_0x60f1('0x35')]=_0x2a4bb1['attributes'][_0x60f1('0x37')]?_0x2a4bb1[_0x60f1('0x35')]:_0x3f3f10[_0x60f1('0x34')];_0x2a4bb1[_0x60f1('0x4f')]=qs[_0x60f1('0x39')](_0x2e9e8f['query'][_0x60f1('0x39')]);_0x2a4bb1[_0x60f1('0x3a')]=qs[_0x60f1('0x32')](_[_0x60f1('0x3b')](_0x2e9e8f[_0x60f1('0x30')],_0x3f3f10[_0x60f1('0x32')]));if(_0x2e9e8f[_0x60f1('0x30')]['filter']){_0x2a4bb1[_0x60f1('0x3a')]=_['merge'](_0x2a4bb1[_0x60f1('0x3a')],{'$or':_['map'](_0x2a4bb1[_0x60f1('0x35')],function(_0x11ec1f){var _0x10a544={};_0x10a544[_0x11ec1f]={'$like':'%'+_0x2e9e8f['query'][_0x60f1('0x3d')]+'%'};return _0x10a544;})});}_0x2a4bb1=_[_0x60f1('0x3e')]({},_0x2a4bb1,_0x2e9e8f[_0x60f1('0x3f')]);return _0x53d5af['getFields'](_0x2a4bb1);}})[_0x60f1('0x26')](function(_0x492ff4){if(_0x492ff4){_0x4a0e1f=_0x492ff4['length'];if(!_0x2e9e8f[_0x60f1('0x30')][_0x60f1('0x50')](_0x60f1('0x38'))){_0x2a4bb1[_0x60f1('0x1c')]=qs[_0x60f1('0x1c')](_0x2e9e8f['query'][_0x60f1('0x1c')]);_0x2a4bb1[_0x60f1('0x1f')]=qs[_0x60f1('0x1f')](_0x2e9e8f[_0x60f1('0x30')][_0x60f1('0x1f')]);}return _0x53d5af['getFields'](_0x2a4bb1);}})[_0x60f1('0x26')](function(_0x127e53){if(_0x127e53){return _0x127e53?{'count':_0x4a0e1f,'rows':_0x127e53}:null;}})[_0x60f1('0x26')](respondWithResult(_0x59aee6,null))[_0x60f1('0x47')](handleError(_0x59aee6,null));};exports[_0x60f1('0x51')]=function(_0x28e5eb,_0x2cc116,_0x24fb27){var _0x265530={};var _0x7686e3={};var _0x3257f2;var _0x50b6a0;return db[_0x60f1('0x40')]['findOne']({'where':{'id':_0x28e5eb[_0x60f1('0x46')]['id']}})[_0x60f1('0x26')](handleEntityNotFound(_0x2cc116,null))[_0x60f1('0x26')](function(_0x51baf7){if(_0x51baf7){_0x3257f2=_0x51baf7;_0x7686e3[_0x60f1('0x34')]=_[_0x60f1('0x31')](db[_0x60f1('0x52')][_0x60f1('0x2c')]);_0x7686e3[_0x60f1('0x30')]=_[_0x60f1('0x31')](_0x28e5eb[_0x60f1('0x30')]);_0x7686e3['filters']=_[_0x60f1('0x33')](_0x7686e3[_0x60f1('0x34')],_0x7686e3[_0x60f1('0x30')]);_0x265530[_0x60f1('0x35')]=_[_0x60f1('0x33')](_0x7686e3['model'],qs[_0x60f1('0x36')](_0x28e5eb['query'][_0x60f1('0x36')]));_0x265530['attributes']=_0x265530[_0x60f1('0x35')][_0x60f1('0x37')]?_0x265530[_0x60f1('0x35')]:_0x7686e3['model'];_0x265530[_0x60f1('0x4f')]=qs['sort'](_0x28e5eb[_0x60f1('0x30')]['sort']);_0x265530['where']=qs[_0x60f1('0x32')](_['pick'](_0x28e5eb['query'],_0x7686e3[_0x60f1('0x32')]));if(_0x28e5eb['query'][_0x60f1('0x3d')]){_0x265530['where']=_[_0x60f1('0x3e')](_0x265530[_0x60f1('0x3a')],{'$or':_['map'](_0x265530[_0x60f1('0x35')],function(_0x5f3dea){var _0x1b1da3={};_0x1b1da3[_0x5f3dea]={'$like':'%'+_0x28e5eb[_0x60f1('0x30')]['filter']+'%'};return _0x1b1da3;})});}_0x265530=_[_0x60f1('0x3e')]({},_0x265530,_0x28e5eb[_0x60f1('0x3f')]);return _0x3257f2[_0x60f1('0x51')](_0x265530);}})[_0x60f1('0x26')](function(_0x3c4b87){if(_0x3c4b87){_0x50b6a0=_0x3c4b87[_0x60f1('0x37')];if(!_0x28e5eb[_0x60f1('0x30')][_0x60f1('0x50')](_0x60f1('0x38'))){_0x265530[_0x60f1('0x1c')]=qs['limit'](_0x28e5eb[_0x60f1('0x30')][_0x60f1('0x1c')]);_0x265530['offset']=qs[_0x60f1('0x1f')](_0x28e5eb[_0x60f1('0x30')]['offset']);}return _0x3257f2[_0x60f1('0x51')](_0x265530);}})[_0x60f1('0x26')](function(_0x5a000f){if(_0x5a000f){return _0x5a000f?{'count':_0x50b6a0,'rows':_0x5a000f}:null;}})[_0x60f1('0x26')](respondWithResult(_0x2cc116,null))[_0x60f1('0x47')](handleError(_0x2cc116,null));};exports[_0x60f1('0x53')]=function(_0x2d93eb,_0x5da7a6,_0x233ebd){var _0x54c41d={};var _0x4d16d4={};var _0x56cfe3;var _0x38a594;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2d93eb['params']['id']}})[_0x60f1('0x26')](handleEntityNotFound(_0x5da7a6,null))[_0x60f1('0x26')](function(_0x19492b){if(_0x19492b){_0x56cfe3=_0x19492b;_0x4d16d4[_0x60f1('0x34')]=_[_0x60f1('0x31')](db['SalesforceField'][_0x60f1('0x2c')]);_0x4d16d4['query']=_[_0x60f1('0x31')](_0x2d93eb[_0x60f1('0x30')]);_0x4d16d4[_0x60f1('0x32')]=_[_0x60f1('0x33')](_0x4d16d4[_0x60f1('0x34')],_0x4d16d4['query']);_0x54c41d['attributes']=_['intersection'](_0x4d16d4['model'],qs[_0x60f1('0x36')](_0x2d93eb['query']['fields']));_0x54c41d[_0x60f1('0x35')]=_0x54c41d[_0x60f1('0x35')][_0x60f1('0x37')]?_0x54c41d[_0x60f1('0x35')]:_0x4d16d4[_0x60f1('0x34')];_0x54c41d[_0x60f1('0x4f')]=qs[_0x60f1('0x39')](_0x2d93eb['query']['sort']);_0x54c41d['where']=qs[_0x60f1('0x32')](_[_0x60f1('0x3b')](_0x2d93eb[_0x60f1('0x30')],_0x4d16d4[_0x60f1('0x32')]));if(_0x2d93eb[_0x60f1('0x30')][_0x60f1('0x3d')]){_0x54c41d['where']=_[_0x60f1('0x3e')](_0x54c41d[_0x60f1('0x3a')],{'$or':_['map'](_0x54c41d[_0x60f1('0x35')],function(_0x24c75e){var _0x4f93aa={};_0x4f93aa[_0x24c75e]={'$like':'%'+_0x2d93eb[_0x60f1('0x30')][_0x60f1('0x3d')]+'%'};return _0x4f93aa;})});}_0x54c41d=_[_0x60f1('0x3e')]({},_0x54c41d,_0x2d93eb[_0x60f1('0x3f')]);return _0x56cfe3[_0x60f1('0x53')](_0x54c41d);}})[_0x60f1('0x26')](function(_0x58ec3b){if(_0x58ec3b){_0x38a594=_0x58ec3b[_0x60f1('0x37')];if(!_0x2d93eb[_0x60f1('0x30')][_0x60f1('0x50')](_0x60f1('0x38'))){_0x54c41d[_0x60f1('0x1c')]=qs['limit'](_0x2d93eb['query']['limit']);_0x54c41d[_0x60f1('0x1f')]=qs[_0x60f1('0x1f')](_0x2d93eb[_0x60f1('0x30')][_0x60f1('0x1f')]);}return _0x56cfe3['getDescriptions'](_0x54c41d);}})['then'](function(_0x2d1a59){if(_0x2d1a59){return _0x2d1a59?{'count':_0x38a594,'rows':_0x2d1a59}:null;}})[_0x60f1('0x26')](respondWithResult(_0x5da7a6,null))['catch'](handleError(_0x5da7a6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fc8e5ed..8f599f6 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 _0x9a60=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x9a60,0x16a));var _0x09a6=function(_0x5d0186,_0x18e803){_0x5d0186=_0x5d0186-0x0;var _0x2e705a=_0x9a60[_0x5d0186];return _0x2e705a;};'use strict';var _=require(_0x09a6('0x0'));var util=require(_0x09a6('0x1'));var logger=require(_0x09a6('0x2'))(_0x09a6('0x3'));var moment=require('moment');var BPromise=require(_0x09a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09a6('0x5'));var rimraf=require('rimraf');var config=require(_0x09a6('0x6'));var attributes=require(_0x09a6('0x7'));module[_0x09a6('0x8')]=function(_0xbd58e3,_0x4e5268){return _0xbd58e3[_0x09a6('0x9')](_0x09a6('0xa'),attributes,{'tableName':_0x09a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x252d=['rimraf','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','api','bluebird'];(function(_0x598b5d,_0x3787b0){var _0x2f9d4b=function(_0x3bc4a0){while(--_0x3bc4a0){_0x598b5d['push'](_0x598b5d['shift']());}};_0x2f9d4b(++_0x3787b0);}(_0x252d,0x97));var _0xd252=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x252d[_0x3b19ea];return _0x40ece9;};'use strict';var _=require(_0xd252('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd252('0x1'));var moment=require('moment');var BPromise=require(_0xd252('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd252('0x3'));var config=require('../../config/environment');var attributes=require(_0xd252('0x4'));module[_0xd252('0x5')]=function(_0x56865d,_0x3ff745){return _0x56865d['define']('SalesforceConfiguration',attributes,{'tableName':_0xd252('0x6'),'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 26c9257..f8bbce0 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 _0x62d4=['SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x62d4,0x1bf));var _0x462d=function(_0x20ef94,_0x1e7873){_0x20ef94=_0x20ef94-0x0;var _0x512171=_0x62d4[_0x20ef94];return _0x512171;};'use strict';var _=require(_0x462d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x462d('0x1'));var rs=require(_0x462d('0x2'));var fs=require('fs');var Redis=require(_0x462d('0x3'));var db=require(_0x462d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x462d('0x5'))(_0x462d('0x6'));var config=require(_0x462d('0x7'));var jayson=require(_0x462d('0x8'));var client=jayson[_0x462d('0x9')][_0x462d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56bde9,_0x4bb92b,_0x23c313){return new BPromise(function(_0x34859d,_0x3d121f){return client[_0x462d('0xb')](_0x56bde9,_0x23c313)[_0x462d('0xc')](function(_0xf73248){logger['info'](_0x462d('0xd'),_0x4bb92b,'request\x20sent');logger[_0x462d('0xe')](_0x462d('0xf'),_0x4bb92b,_0x462d('0x10'),JSON[_0x462d('0x11')](_0xf73248));if(_0xf73248[_0x462d('0x12')]){if(_0xf73248[_0x462d('0x12')][_0x462d('0x13')]===0x1f4){logger[_0x462d('0x12')](_0x462d('0xd'),_0x4bb92b,_0xf73248['error'][_0x462d('0x14')]);return _0x3d121f(_0xf73248[_0x462d('0x12')][_0x462d('0x14')]);}logger[_0x462d('0x12')](_0x462d('0xd'),_0x4bb92b,_0xf73248[_0x462d('0x12')][_0x462d('0x14')]);return _0x34859d(_0xf73248[_0x462d('0x12')][_0x462d('0x14')]);}else{logger[_0x462d('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bb92b,'request\x20sent');_0x34859d(_0xf73248[_0x462d('0x16')][_0x462d('0x14')]);}})['catch'](function(_0x5beb45){logger[_0x462d('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bb92b,_0x5beb45);_0x3d121f(_0x5beb45);});});} \ No newline at end of file +var _0x8c91=['then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x51969c,_0x1b119b){var _0x547574=function(_0x2a2991){while(--_0x2a2991){_0x51969c['push'](_0x51969c['shift']());}};_0x547574(++_0x1b119b);}(_0x8c91,0x199));var _0x18c9=function(_0x334cab,_0x58c2aa){_0x334cab=_0x334cab-0x0;var _0x4cdd18=_0x8c91[_0x334cab];return _0x4cdd18;};'use strict';var _=require('lodash');var util=require(_0x18c9('0x0'));var moment=require(_0x18c9('0x1'));var BPromise=require(_0x18c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18c9('0x3'));var db=require(_0x18c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x18c9('0x5'))('rpc');var config=require(_0x18c9('0x6'));var jayson=require(_0x18c9('0x7'));var client=jayson['client'][_0x18c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2debd0,_0x1d66e7,_0x41ed26){return new BPromise(function(_0x1ce1f3,_0x44cc39){return client['request'](_0x2debd0,_0x41ed26)[_0x18c9('0x9')](function(_0x13dfca){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d66e7,_0x18c9('0xa'));logger[_0x18c9('0xb')](_0x18c9('0xc'),_0x1d66e7,_0x18c9('0xa'),JSON['stringify'](_0x13dfca));if(_0x13dfca[_0x18c9('0xd')]){if(_0x13dfca[_0x18c9('0xd')]['code']===0x1f4){logger[_0x18c9('0xd')](_0x18c9('0xe'),_0x1d66e7,_0x13dfca['error'][_0x18c9('0xf')]);return _0x44cc39(_0x13dfca[_0x18c9('0xd')][_0x18c9('0xf')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d66e7,_0x13dfca[_0x18c9('0xd')][_0x18c9('0xf')]);return _0x1ce1f3(_0x13dfca[_0x18c9('0xd')][_0x18c9('0xf')]);}else{logger[_0x18c9('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1d66e7,_0x18c9('0xa'));_0x1ce1f3(_0x13dfca[_0x18c9('0x11')]['message']);}})[_0x18c9('0x12')](function(_0x3ebf74){logger[_0x18c9('0xd')](_0x18c9('0xe'),_0x1d66e7,_0x3ebf74);_0x44cc39(_0x3ebf74);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 260cb5d..836a1ee 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 _0x65aa=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x65aa,0x10a));var _0xa65a=function(_0x5f271e,_0x2a487c){_0x5f271e=_0x5f271e-0x0;var _0x378415=_0x65aa[_0x5f271e];return _0x378415;};'use strict';var multer=require(_0xa65a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa65a('0x1'));var express=require(_0xa65a('0x2'));var router=express[_0xa65a('0x3')]();var fs_extra=require(_0xa65a('0x4'));var auth=require(_0xa65a('0x5'));var interaction=require(_0xa65a('0x6'));var config=require(_0xa65a('0x7'));var controller=require('./intSalesforceField.controller');router[_0xa65a('0x8')]('/',auth['isAuthenticated'](),controller[_0xa65a('0x9')]);router[_0xa65a('0x8')](_0xa65a('0xa'),auth[_0xa65a('0xb')](),controller[_0xa65a('0xc')]);router[_0xa65a('0xd')]('/',auth[_0xa65a('0xb')](),controller['create']);router[_0xa65a('0xe')](_0xa65a('0xa'),auth[_0xa65a('0xb')](),controller['update']);router[_0xa65a('0xf')]('/:id',auth[_0xa65a('0xb')](),controller[_0xa65a('0x10')]);module[_0xa65a('0x11')]=router; \ No newline at end of file +var _0x583b=['connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa0f1b9,_0x4f1175){var _0x528a48=function(_0x363ee8){while(--_0x363ee8){_0xa0f1b9['push'](_0xa0f1b9['shift']());}};_0x528a48(++_0x4f1175);}(_0x583b,0x184));var _0xb583=function(_0x2c2733,_0x1f7666){_0x2c2733=_0x2c2733-0x0;var _0x546d10=_0x583b[_0x2c2733];return _0x546d10;};'use strict';var multer=require(_0xb583('0x0'));var util=require(_0xb583('0x1'));var path=require(_0xb583('0x2'));var timeout=require(_0xb583('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb583('0x4'));var interaction=require(_0xb583('0x5'));var config=require('../../config/environment');var controller=require(_0xb583('0x6'));router[_0xb583('0x7')]('/',auth[_0xb583('0x8')](),controller[_0xb583('0x9')]);router[_0xb583('0x7')](_0xb583('0xa'),auth[_0xb583('0x8')](),controller['show']);router['post']('/',auth[_0xb583('0x8')](),controller[_0xb583('0xb')]);router[_0xb583('0xc')](_0xb583('0xa'),auth[_0xb583('0x8')](),controller[_0xb583('0xd')]);router[_0xb583('0xe')](_0xb583('0xa'),auth['isAuthenticated'](),controller[_0xb583('0xf')]);module[_0xb583('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 99420dc..4c02637 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 _0xd681=['customVariable','picklist','STRING','variable','exports','ENUM','string'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xd681,0x1c4));var _0x1d68=function(_0x566d91,_0x571455){_0x566d91=_0x566d91-0x0;var _0xab9eef=_0xd681[_0x566d91];return _0xab9eef;};'use strict';var Sequelize=require('sequelize');module[_0x1d68('0x0')]={'type':{'type':Sequelize[_0x1d68('0x1')](_0x1d68('0x2'),'variable',_0x1d68('0x3'),'keyValue',_0x1d68('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1d68('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x1d68('0x6'),_0x1d68('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d68('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc211=['customVariable','keyValue','picklist','STRING','variable','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc211,0x1dd));var _0x1c21=function(_0x5c21fc,_0x6e3113){_0x5c21fc=_0x5c21fc-0x0;var _0x114c45=_0xc211[_0x5c21fc];return _0x114c45;};'use strict';var Sequelize=require('sequelize');module[_0x1c21('0x0')]={'type':{'type':Sequelize[_0x1c21('0x1')](_0x1c21('0x2'),'variable',_0x1c21('0x3'),_0x1c21('0x4'),_0x1c21('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1c21('0x6')]},'key':{'type':Sequelize[_0x1c21('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x1c21('0x7'),_0x1c21('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1c21('0x6')]},'variableName':{'type':Sequelize[_0x1c21('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index aa707ae..32f83c0 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 _0x4b01=['where','merge','options','SalesforceField','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','eml-format','rimraf','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','Content-Range','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','length','hasOwnProperty','order','sort','filters','pick','filter'];(function(_0x1e4980,_0x1dbb7f){var _0xd816f5=function(_0x13b2c5){while(--_0x13b2c5){_0x1e4980['push'](_0x1e4980['shift']());}};_0xd816f5(++_0x1dbb7f);}(_0x4b01,0x123));var _0x14b0=function(_0x23f4cf,_0x216b72){_0x23f4cf=_0x23f4cf-0x0;var _0x27e360=_0x4b01[_0x23f4cf];return _0x27e360;};'use strict';var emlformat=require(_0x14b0('0x0'));var rimraf=require(_0x14b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14b0('0x2'));var BPromise=require(_0x14b0('0x3'));var Mustache=require('mustache');var util=require(_0x14b0('0x4'));var path=require(_0x14b0('0x5'));var sox=require('sox');var csv=require(_0x14b0('0x6'));var ejs=require(_0x14b0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14b0('0x8'));var squel=require('squel');var crypto=require(_0x14b0('0x9'));var jsforce=require(_0x14b0('0xa'));var deskjs=require(_0x14b0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x14b0('0xc'));var Redis=require(_0x14b0('0xd'));var authService=require(_0x14b0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x14b0('0xf'));var hardwareService=require(_0x14b0('0x10'));var logger=require(_0x14b0('0x11'))(_0x14b0('0x12'));var utils=require(_0x14b0('0x13'));var config=require(_0x14b0('0x14'));var licenseUtil=require(_0x14b0('0x15'));var db=require(_0x14b0('0x16'))['db'];function respondWithStatusCode(_0xd4fd13,_0x3ba7b6){_0x3ba7b6=_0x3ba7b6||0xcc;return function(_0x7448d6){if(_0x7448d6){return _0xd4fd13[_0x14b0('0x17')](_0x3ba7b6);}return _0xd4fd13[_0x14b0('0x18')](_0x3ba7b6)['end']();};}function respondWithResult(_0x138354,_0x5ade55){_0x5ade55=_0x5ade55||0xc8;return function(_0x544e89){if(_0x544e89){return _0x138354[_0x14b0('0x18')](_0x5ade55)['json'](_0x544e89);}};}function respondWithFilteredResult(_0x12919b,_0x509284){return function(_0xd57954){if(_0xd57954){var _0x318cc5=typeof _0x509284[_0x14b0('0x19')]==='undefined'&&typeof _0x509284[_0x14b0('0x1a')]==='undefined';var _0x51d535=_0xd57954[_0x14b0('0x1b')];var _0x50f56d=_0x318cc5?0x0:_0x509284['offset'];var _0x1d1cd9=_0x318cc5?_0xd57954[_0x14b0('0x1b')]:_0x509284[_0x14b0('0x19')]+_0x509284[_0x14b0('0x1a')];var _0x1da1b0;if(_0x1d1cd9>=_0x51d535){_0x1d1cd9=_0x51d535;_0x1da1b0=0xc8;}else{_0x1da1b0=0xce;}_0x12919b[_0x14b0('0x18')](_0x1da1b0);return _0x12919b['set'](_0x14b0('0x1c'),_0x50f56d+'-'+_0x1d1cd9+'/'+_0x51d535)['json'](_0xd57954);}return null;};}function patchUpdates(_0x4ada4d){return function(_0x2fd9d2){try{jsonpatch['apply'](_0x2fd9d2,_0x4ada4d,!![]);}catch(_0x15bf06){return BPromise['reject'](_0x15bf06);}return _0x2fd9d2['save']();};}function saveUpdates(_0x1d14a5,_0x508680){return function(_0x56c370){if(_0x56c370){return _0x56c370[_0x14b0('0x1d')](_0x1d14a5)[_0x14b0('0x1e')](function(_0xab0fda){return _0xab0fda;});}return null;};}function removeEntity(_0x3691cc,_0x226951){return function(_0x2e2714){if(_0x2e2714){return _0x2e2714[_0x14b0('0x1f')]()[_0x14b0('0x1e')](function(){_0x3691cc[_0x14b0('0x18')](0xcc)[_0x14b0('0x20')]();});}};}function handleEntityNotFound(_0xa1737c,_0x50a507){return function(_0x49e1e1){if(!_0x49e1e1){_0xa1737c['sendStatus'](0x194);}return _0x49e1e1;};}function handleError(_0x49c80e,_0x632c81){_0x632c81=_0x632c81||0x1f4;return function(_0x1383b1){logger[_0x14b0('0x21')](_0x1383b1[_0x14b0('0x22')]);if(_0x1383b1[_0x14b0('0x23')]){delete _0x1383b1[_0x14b0('0x23')];}_0x49c80e[_0x14b0('0x18')](_0x632c81)[_0x14b0('0x24')](_0x1383b1);};}exports[_0x14b0('0x25')]=function(_0x3a1b8e,_0x341a96){var _0x23fc15={},_0x5f40d7={},_0x568bf7={'count':0x0,'rows':[]};var _0x42b9cc=_['map'](db['SalesforceField'][_0x14b0('0x26')],function(_0x30612f){return{'name':_0x30612f[_0x14b0('0x27')],'type':_0x30612f[_0x14b0('0x28')][_0x14b0('0x29')]};});_0x5f40d7[_0x14b0('0x2a')]=_[_0x14b0('0x2b')](_0x42b9cc,_0x14b0('0x23'));_0x5f40d7[_0x14b0('0x2c')]=_['keys'](_0x3a1b8e['query']);_0x5f40d7['filters']=_[_0x14b0('0x2d')](_0x5f40d7[_0x14b0('0x2a')],_0x5f40d7[_0x14b0('0x2c')]);_0x23fc15[_0x14b0('0x2e')]=_['intersection'](_0x5f40d7[_0x14b0('0x2a')],qs['fields'](_0x3a1b8e[_0x14b0('0x2c')]['fields']));_0x23fc15[_0x14b0('0x2e')]=_0x23fc15[_0x14b0('0x2e')][_0x14b0('0x2f')]?_0x23fc15[_0x14b0('0x2e')]:_0x5f40d7[_0x14b0('0x2a')];if(!_0x3a1b8e[_0x14b0('0x2c')][_0x14b0('0x30')]('nolimit')){_0x23fc15[_0x14b0('0x1a')]=qs[_0x14b0('0x1a')](_0x3a1b8e['query']['limit']);_0x23fc15[_0x14b0('0x19')]=qs['offset'](_0x3a1b8e['query'][_0x14b0('0x19')]);}_0x23fc15[_0x14b0('0x31')]=qs[_0x14b0('0x32')](_0x3a1b8e[_0x14b0('0x2c')][_0x14b0('0x32')]);_0x23fc15['where']=qs[_0x14b0('0x33')](_[_0x14b0('0x34')](_0x3a1b8e['query'],_0x5f40d7[_0x14b0('0x33')]),_0x42b9cc);if(_0x3a1b8e['query'][_0x14b0('0x35')]){_0x23fc15[_0x14b0('0x36')]=_[_0x14b0('0x37')](_0x23fc15[_0x14b0('0x36')],{'$or':_[_0x14b0('0x2b')](_0x42b9cc,function(_0x5e3e28){if(_0x5e3e28[_0x14b0('0x28')]!=='VIRTUAL'){var _0xc4961c={};_0xc4961c[_0x5e3e28[_0x14b0('0x23')]]={'$like':'%'+_0x3a1b8e[_0x14b0('0x2c')][_0x14b0('0x35')]+'%'};return _0xc4961c;}})});}_0x23fc15=_[_0x14b0('0x37')]({},_0x23fc15,_0x3a1b8e[_0x14b0('0x38')]);var _0x21722b={'where':_0x23fc15[_0x14b0('0x36')]};return db[_0x14b0('0x39')][_0x14b0('0x1b')](_0x21722b)[_0x14b0('0x1e')](function(_0x1c3a4f){_0x568bf7['count']=_0x1c3a4f;if(_0x3a1b8e[_0x14b0('0x2c')][_0x14b0('0x3a')]){_0x23fc15[_0x14b0('0x3b')]=[{'all':!![]}];}return db['SalesforceField'][_0x14b0('0x3c')](_0x23fc15);})[_0x14b0('0x1e')](function(_0xe7a276){_0x568bf7[_0x14b0('0x3d')]=_0xe7a276;return _0x568bf7;})['then'](respondWithFilteredResult(_0x341a96,_0x23fc15))[_0x14b0('0x3e')](handleError(_0x341a96,null));};exports['show']=function(_0x458a99,_0x32c041){var _0x4596af={'raw':!![],'where':{'id':_0x458a99[_0x14b0('0x3f')]['id']}},_0x11fd24={};_0x11fd24['model']=_['keys'](db[_0x14b0('0x39')][_0x14b0('0x26')]);_0x11fd24['query']=_[_0x14b0('0x40')](_0x458a99['query']);_0x11fd24[_0x14b0('0x33')]=_[_0x14b0('0x2d')](_0x11fd24[_0x14b0('0x2a')],_0x11fd24[_0x14b0('0x2c')]);_0x4596af[_0x14b0('0x2e')]=_['intersection'](_0x11fd24[_0x14b0('0x2a')],qs['fields'](_0x458a99[_0x14b0('0x2c')][_0x14b0('0x41')]));_0x4596af['attributes']=_0x4596af[_0x14b0('0x2e')]['length']?_0x4596af['attributes']:_0x11fd24['model'];if(_0x458a99[_0x14b0('0x2c')][_0x14b0('0x3a')]){_0x4596af['include']=[{'all':!![]}];}_0x4596af=_[_0x14b0('0x37')]({},_0x4596af,_0x458a99[_0x14b0('0x38')]);return db['SalesforceField'][_0x14b0('0x42')](_0x4596af)['then'](handleEntityNotFound(_0x32c041,null))[_0x14b0('0x1e')](respondWithResult(_0x32c041,null))[_0x14b0('0x3e')](handleError(_0x32c041,null));};exports[_0x14b0('0x43')]=function(_0x22d534,_0x5e0491){return db['SalesforceField'][_0x14b0('0x43')](_0x22d534[_0x14b0('0x44')],{})[_0x14b0('0x1e')](respondWithResult(_0x5e0491,0xc9))[_0x14b0('0x3e')](handleError(_0x5e0491,null));};exports['update']=function(_0x3f7bb5,_0x41908f){if(_0x3f7bb5[_0x14b0('0x44')]['id']){delete _0x3f7bb5[_0x14b0('0x44')]['id'];}return db[_0x14b0('0x39')][_0x14b0('0x42')]({'where':{'id':_0x3f7bb5[_0x14b0('0x3f')]['id']}})[_0x14b0('0x1e')](handleEntityNotFound(_0x41908f,null))['then'](saveUpdates(_0x3f7bb5[_0x14b0('0x44')],null))[_0x14b0('0x1e')](respondWithResult(_0x41908f,null))[_0x14b0('0x3e')](handleError(_0x41908f,null));};exports['destroy']=function(_0x3fc53c,_0x2bc5cb){return db['SalesforceField'][_0x14b0('0x42')]({'where':{'id':_0x3fc53c[_0x14b0('0x3f')]['id']}})[_0x14b0('0x1e')](handleEntityNotFound(_0x2bc5cb,null))[_0x14b0('0x1e')](removeEntity(_0x2bc5cb,null))['catch'](handleError(_0x2bc5cb,null));}; \ No newline at end of file +var _0x06f6=['rawAttributes','type','key','model','keys','query','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','length','find','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','SalesforceField'];(function(_0x3eb475,_0x43e757){var _0x58e47b=function(_0x192000){while(--_0x192000){_0x3eb475['push'](_0x3eb475['shift']());}};_0x58e47b(++_0x43e757);}(_0x06f6,0x18a));var _0x606f=function(_0x2aaf12,_0x572e7a){_0x2aaf12=_0x2aaf12-0x0;var _0x289e2e=_0x06f6[_0x2aaf12];return _0x289e2e;};'use strict';var emlformat=require(_0x606f('0x0'));var rimraf=require(_0x606f('0x1'));var zipdir=require(_0x606f('0x2'));var jsonpatch=require(_0x606f('0x3'));var rp=require(_0x606f('0x4'));var moment=require(_0x606f('0x5'));var BPromise=require(_0x606f('0x6'));var Mustache=require('mustache');var util=require(_0x606f('0x7'));var path=require(_0x606f('0x8'));var sox=require(_0x606f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x606f('0xa'));var _=require('lodash');var squel=require(_0x606f('0xb'));var crypto=require(_0x606f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x606f('0xd'));var toCsv=require(_0x606f('0xe'));var querystring=require(_0x606f('0xf'));var Papa=require(_0x606f('0x10'));var Redis=require('ioredis');var authService=require(_0x606f('0x11'));var qs=require(_0x606f('0x12'));var as=require(_0x606f('0x13'));var hardwareService=require(_0x606f('0x14'));var logger=require(_0x606f('0x15'))(_0x606f('0x16'));var utils=require(_0x606f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x606f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5703b0,_0x9d3867){_0x9d3867=_0x9d3867||0xcc;return function(_0x5bd623){if(_0x5bd623){return _0x5703b0['sendStatus'](_0x9d3867);}return _0x5703b0[_0x606f('0x19')](_0x9d3867)[_0x606f('0x1a')]();};}function respondWithResult(_0x4a4117,_0x440fc0){_0x440fc0=_0x440fc0||0xc8;return function(_0x29014a){if(_0x29014a){return _0x4a4117[_0x606f('0x19')](_0x440fc0)[_0x606f('0x1b')](_0x29014a);}};}function respondWithFilteredResult(_0x47b7ea,_0x5e04f2){return function(_0x47e120){if(_0x47e120){var _0x3a8ade=typeof _0x5e04f2[_0x606f('0x1c')]===_0x606f('0x1d')&&typeof _0x5e04f2[_0x606f('0x1e')]===_0x606f('0x1d');var _0x57d4a1=_0x47e120[_0x606f('0x1f')];var _0x625658=_0x3a8ade?0x0:_0x5e04f2[_0x606f('0x1c')];var _0x230e0a=_0x3a8ade?_0x47e120[_0x606f('0x1f')]:_0x5e04f2[_0x606f('0x1c')]+_0x5e04f2[_0x606f('0x1e')];var _0x3d906a;if(_0x230e0a>=_0x57d4a1){_0x230e0a=_0x57d4a1;_0x3d906a=0xc8;}else{_0x3d906a=0xce;}_0x47b7ea[_0x606f('0x19')](_0x3d906a);return _0x47b7ea['set'](_0x606f('0x20'),_0x625658+'-'+_0x230e0a+'/'+_0x57d4a1)[_0x606f('0x1b')](_0x47e120);}return null;};}function patchUpdates(_0x159cf3){return function(_0x411fb8){try{jsonpatch[_0x606f('0x21')](_0x411fb8,_0x159cf3,!![]);}catch(_0x306bb7){return BPromise['reject'](_0x306bb7);}return _0x411fb8[_0x606f('0x22')]();};}function saveUpdates(_0x55a9d6,_0x5ce760){return function(_0x1aa469){if(_0x1aa469){return _0x1aa469['update'](_0x55a9d6)[_0x606f('0x23')](function(_0x58d566){return _0x58d566;});}return null;};}function removeEntity(_0x5c06f2,_0x34376a){return function(_0x580600){if(_0x580600){return _0x580600[_0x606f('0x24')]()[_0x606f('0x23')](function(){_0x5c06f2[_0x606f('0x19')](0xcc)[_0x606f('0x1a')]();});}};}function handleEntityNotFound(_0x3720e9,_0x3d5c1b){return function(_0x33c135){if(!_0x33c135){_0x3720e9[_0x606f('0x25')](0x194);}return _0x33c135;};}function handleError(_0x2e79c4,_0x4c7596){_0x4c7596=_0x4c7596||0x1f4;return function(_0x498152){logger['error'](_0x498152[_0x606f('0x26')]);if(_0x498152[_0x606f('0x27')]){delete _0x498152[_0x606f('0x27')];}_0x2e79c4[_0x606f('0x19')](_0x4c7596)[_0x606f('0x28')](_0x498152);};}exports[_0x606f('0x29')]=function(_0x556440,_0x1e33ee){var _0x502002={},_0x222f04={},_0x5e8e54={'count':0x0,'rows':[]};var _0x59dee8=_[_0x606f('0x2a')](db[_0x606f('0x2b')][_0x606f('0x2c')],function(_0x495c42){return{'name':_0x495c42['fieldName'],'type':_0x495c42[_0x606f('0x2d')][_0x606f('0x2e')]};});_0x222f04[_0x606f('0x2f')]=_[_0x606f('0x2a')](_0x59dee8,_0x606f('0x27'));_0x222f04['query']=_[_0x606f('0x30')](_0x556440[_0x606f('0x31')]);_0x222f04['filters']=_['intersection'](_0x222f04[_0x606f('0x2f')],_0x222f04['query']);_0x502002[_0x606f('0x32')]=_['intersection'](_0x222f04[_0x606f('0x2f')],qs['fields'](_0x556440['query'][_0x606f('0x33')]));_0x502002[_0x606f('0x32')]=_0x502002[_0x606f('0x32')]['length']?_0x502002['attributes']:_0x222f04[_0x606f('0x2f')];if(!_0x556440[_0x606f('0x31')]['hasOwnProperty'](_0x606f('0x34'))){_0x502002['limit']=qs['limit'](_0x556440[_0x606f('0x31')][_0x606f('0x1e')]);_0x502002[_0x606f('0x1c')]=qs[_0x606f('0x1c')](_0x556440['query']['offset']);}_0x502002[_0x606f('0x35')]=qs[_0x606f('0x36')](_0x556440[_0x606f('0x31')][_0x606f('0x36')]);_0x502002[_0x606f('0x37')]=qs[_0x606f('0x38')](_[_0x606f('0x39')](_0x556440[_0x606f('0x31')],_0x222f04[_0x606f('0x38')]),_0x59dee8);if(_0x556440[_0x606f('0x31')][_0x606f('0x3a')]){_0x502002['where']=_[_0x606f('0x3b')](_0x502002['where'],{'$or':_['map'](_0x59dee8,function(_0xa8b740){if(_0xa8b740[_0x606f('0x2d')]!==_0x606f('0x3c')){var _0x2c0b1b={};_0x2c0b1b[_0xa8b740[_0x606f('0x27')]]={'$like':'%'+_0x556440[_0x606f('0x31')][_0x606f('0x3a')]+'%'};return _0x2c0b1b;}})});}_0x502002=_[_0x606f('0x3b')]({},_0x502002,_0x556440[_0x606f('0x3d')]);var _0x596232={'where':_0x502002[_0x606f('0x37')]};return db[_0x606f('0x2b')]['count'](_0x596232)[_0x606f('0x23')](function(_0x1a508a){_0x5e8e54[_0x606f('0x1f')]=_0x1a508a;if(_0x556440[_0x606f('0x31')][_0x606f('0x3e')]){_0x502002[_0x606f('0x3f')]=[{'all':!![]}];}return db[_0x606f('0x2b')][_0x606f('0x40')](_0x502002);})[_0x606f('0x23')](function(_0x57c03d){_0x5e8e54['rows']=_0x57c03d;return _0x5e8e54;})[_0x606f('0x23')](respondWithFilteredResult(_0x1e33ee,_0x502002))[_0x606f('0x41')](handleError(_0x1e33ee,null));};exports[_0x606f('0x42')]=function(_0x3a4390,_0x381d64){var _0x277b36={'raw':!![],'where':{'id':_0x3a4390[_0x606f('0x43')]['id']}},_0x556245={};_0x556245[_0x606f('0x2f')]=_[_0x606f('0x30')](db[_0x606f('0x2b')][_0x606f('0x2c')]);_0x556245['query']=_['keys'](_0x3a4390['query']);_0x556245[_0x606f('0x38')]=_['intersection'](_0x556245[_0x606f('0x2f')],_0x556245['query']);_0x277b36[_0x606f('0x32')]=_[_0x606f('0x44')](_0x556245[_0x606f('0x2f')],qs['fields'](_0x3a4390['query'][_0x606f('0x33')]));_0x277b36['attributes']=_0x277b36['attributes'][_0x606f('0x45')]?_0x277b36[_0x606f('0x32')]:_0x556245['model'];if(_0x3a4390[_0x606f('0x31')]['includeAll']){_0x277b36[_0x606f('0x3f')]=[{'all':!![]}];}_0x277b36=_[_0x606f('0x3b')]({},_0x277b36,_0x3a4390[_0x606f('0x3d')]);return db['SalesforceField'][_0x606f('0x46')](_0x277b36)[_0x606f('0x23')](handleEntityNotFound(_0x381d64,null))[_0x606f('0x23')](respondWithResult(_0x381d64,null))['catch'](handleError(_0x381d64,null));};exports['create']=function(_0x2292f8,_0x26bc1f){return db['SalesforceField']['create'](_0x2292f8['body'],{})[_0x606f('0x23')](respondWithResult(_0x26bc1f,0xc9))[_0x606f('0x41')](handleError(_0x26bc1f,null));};exports[_0x606f('0x47')]=function(_0x454e95,_0x5140ac){if(_0x454e95[_0x606f('0x48')]['id']){delete _0x454e95[_0x606f('0x48')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x454e95[_0x606f('0x43')]['id']}})[_0x606f('0x23')](handleEntityNotFound(_0x5140ac,null))['then'](saveUpdates(_0x454e95[_0x606f('0x48')],null))['then'](respondWithResult(_0x5140ac,null))['catch'](handleError(_0x5140ac,null));};exports[_0x606f('0x24')]=function(_0x4f25d1,_0x556163){return db[_0x606f('0x2b')][_0x606f('0x46')]({'where':{'id':_0x4f25d1['params']['id']}})['then'](handleEntityNotFound(_0x556163,null))[_0x606f('0x23')](removeEntity(_0x556163,null))[_0x606f('0x41')](handleError(_0x556163,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f300bf0..da13376 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 _0x5f87=['moment','bluebird','request-promise','path','exports','define','salesforce_unique_index','idField','lodash','../../config/logger'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x5f87,0x1f2));var _0x75f8=function(_0x25f9ca,_0x508ba3){_0x25f9ca=_0x25f9ca-0x0;var _0x530c2c=_0x5f87[_0x25f9ca];return _0x530c2c;};'use strict';var _=require(_0x75f8('0x0'));var util=require('util');var logger=require(_0x75f8('0x1'))('api');var moment=require(_0x75f8('0x2'));var BPromise=require(_0x75f8('0x3'));var rp=require(_0x75f8('0x4'));var fs=require('fs');var path=require(_0x75f8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x75f8('0x6')]=function(_0x5a5d55,_0x1a4736){return _0x5a5d55[_0x75f8('0x7')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x75f8('0x8'),'fields':[_0x75f8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59c1=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5b274a,_0x3424b3){var _0x137601=function(_0x85558b){while(--_0x85558b){_0x5b274a['push'](_0x5b274a['shift']());}};_0x137601(++_0x3424b3);}(_0x59c1,0x157));var _0x159c=function(_0x44fb7e,_0x53fa74){_0x44fb7e=_0x44fb7e-0x0;var _0x467386=_0x59c1[_0x44fb7e];return _0x467386;};'use strict';var _=require('lodash');var util=require(_0x159c('0x0'));var logger=require(_0x159c('0x1'))(_0x159c('0x2'));var moment=require(_0x159c('0x3'));var BPromise=require(_0x159c('0x4'));var rp=require(_0x159c('0x5'));var fs=require('fs');var path=require(_0x159c('0x6'));var rimraf=require('rimraf');var config=require(_0x159c('0x7'));var attributes=require(_0x159c('0x8'));module[_0x159c('0x9')]=function(_0x3e64d2,_0x107806){return _0x3e64d2[_0x159c('0xa')](_0x159c('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x159c('0xc'),'fields':['idField',_0x159c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 2668a15..37b4e07 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 _0xa048=['then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request'];(function(_0x436d03,_0x1853d4){var _0x44cf28=function(_0x1a1fe9){while(--_0x1a1fe9){_0x436d03['push'](_0x436d03['shift']());}};_0x44cf28(++_0x1853d4);}(_0xa048,0xbe));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8a04('0x0'));var moment=require('moment');var BPromise=require(_0x8a04('0x1'));var rs=require(_0x8a04('0x2'));var fs=require('fs');var Redis=require(_0x8a04('0x3'));var db=require(_0x8a04('0x4'))['db'];var utils=require(_0x8a04('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a04('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3187b2,_0xff5bcd,_0x5b1460){return new BPromise(function(_0x8e4bc1,_0x1898c9){return client[_0x8a04('0x7')](_0x3187b2,_0x5b1460)[_0x8a04('0x8')](function(_0x12c6de){logger[_0x8a04('0x9')](_0x8a04('0xa'),_0xff5bcd,_0x8a04('0xb'));logger[_0x8a04('0xc')](_0x8a04('0xd'),_0xff5bcd,'request\x20sent',JSON[_0x8a04('0xe')](_0x12c6de));if(_0x12c6de[_0x8a04('0xf')]){if(_0x12c6de[_0x8a04('0xf')]['code']===0x1f4){logger[_0x8a04('0xf')](_0x8a04('0xa'),_0xff5bcd,_0x12c6de[_0x8a04('0xf')][_0x8a04('0x10')]);return _0x1898c9(_0x12c6de[_0x8a04('0xf')]['message']);}logger[_0x8a04('0xf')](_0x8a04('0xa'),_0xff5bcd,_0x12c6de[_0x8a04('0xf')][_0x8a04('0x10')]);return _0x8e4bc1(_0x12c6de['error'][_0x8a04('0x10')]);}else{logger[_0x8a04('0x9')](_0x8a04('0xa'),_0xff5bcd,_0x8a04('0xb'));_0x8e4bc1(_0x12c6de['result']['message']);}})[_0x8a04('0x11')](function(_0x293d56){logger[_0x8a04('0xf')](_0x8a04('0xa'),_0xff5bcd,_0x293d56);_0x1898c9(_0x293d56);});});} \ No newline at end of file +var _0x33ca=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x34b935,_0x1b0e16){var _0x4acb3c=function(_0x111735){while(--_0x111735){_0x34b935['push'](_0x34b935['shift']());}};_0x4acb3c(++_0x1b0e16);}(_0x33ca,0xbb));var _0xa33c=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x33ca[_0x1ac6ec];return _0x48a489;};'use strict';var _=require(_0xa33c('0x0'));var util=require(_0xa33c('0x1'));var moment=require('moment');var BPromise=require(_0xa33c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa33c('0x3'));var db=require(_0xa33c('0x4'))['db'];var utils=require(_0xa33c('0x5'));var logger=require(_0xa33c('0x6'))(_0xa33c('0x7'));var config=require('../../config/environment');var jayson=require(_0xa33c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16774d,_0x438269,_0x732236){return new BPromise(function(_0x12fbc9,_0x26034a){return client[_0xa33c('0x9')](_0x16774d,_0x732236)[_0xa33c('0xa')](function(_0x44d49e){logger[_0xa33c('0xb')](_0xa33c('0xc'),_0x438269,_0xa33c('0xd'));logger[_0xa33c('0xe')](_0xa33c('0xf'),_0x438269,_0xa33c('0xd'),JSON['stringify'](_0x44d49e));if(_0x44d49e['error']){if(_0x44d49e[_0xa33c('0x10')][_0xa33c('0x11')]===0x1f4){logger[_0xa33c('0x10')](_0xa33c('0xc'),_0x438269,_0x44d49e[_0xa33c('0x10')][_0xa33c('0x12')]);return _0x26034a(_0x44d49e[_0xa33c('0x10')][_0xa33c('0x12')]);}logger[_0xa33c('0x10')](_0xa33c('0xc'),_0x438269,_0x44d49e['error'][_0xa33c('0x12')]);return _0x12fbc9(_0x44d49e[_0xa33c('0x10')][_0xa33c('0x12')]);}else{logger[_0xa33c('0xb')](_0xa33c('0xc'),_0x438269,_0xa33c('0xd'));_0x12fbc9(_0x44d49e[_0xa33c('0x13')][_0xa33c('0x12')]);}})[_0xa33c('0x14')](function(_0x1ba89b){logger['error'](_0xa33c('0xc'),_0x438269,_0x1ba89b);_0x26034a(_0x1ba89b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cbf89fe..3900e48 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 _0xdd89=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x2b6584,_0x51f6e4){var _0x3380be=function(_0x19931c){while(--_0x19931c){_0x2b6584['push'](_0x2b6584['shift']());}};_0x3380be(++_0x51f6e4);}(_0xdd89,0xc5));var _0x9dd8=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0xdd89[_0xdbd4f7];return _0x5c3f9d;};'use strict';var multer=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var path=require(_0x9dd8('0x2'));var timeout=require(_0x9dd8('0x3'));var express=require(_0x9dd8('0x4'));var router=express[_0x9dd8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9dd8('0x6'));var config=require(_0x9dd8('0x7'));var controller=require(_0x9dd8('0x8'));router[_0x9dd8('0x9')]('/',auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xb')]);router[_0x9dd8('0x9')](_0x9dd8('0xc'),auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xd')]);router['get'](_0x9dd8('0xe'),auth[_0x9dd8('0xa')](),controller[_0x9dd8('0xf')]);router[_0x9dd8('0x9')](_0x9dd8('0x10'),auth[_0x9dd8('0xa')](),controller[_0x9dd8('0x11')]);router[_0x9dd8('0x12')]('/',auth['isAuthenticated'](),controller[_0x9dd8('0x13')]);router[_0x9dd8('0x12')](_0x9dd8('0xe'),auth['isAuthenticated'](),controller[_0x9dd8('0x14')]);router[_0x9dd8('0x15')](_0x9dd8('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9dd8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9dd8('0x16')]=router; \ No newline at end of file +var _0x34e5=['fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4bdc86,_0x13735c){var _0x2a5a30=function(_0x121267){while(--_0x121267){_0x4bdc86['push'](_0x4bdc86['shift']());}};_0x2a5a30(++_0x13735c);}(_0x34e5,0x172));var _0x534e=function(_0x1eab7f,_0x4af32c){_0x1eab7f=_0x1eab7f-0x0;var _0x2cc606=_0x34e5[_0x1eab7f];return _0x2cc606;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xc')]);router[_0x534e('0x8')](_0x534e('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x534e('0x8')]('/:id/fields',auth[_0x534e('0x9')](),controller['getFields']);router[_0x534e('0xe')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xf')]);router['post'](_0x534e('0xd'),auth[_0x534e('0x9')](),controller[_0x534e('0x10')]);router[_0x534e('0x11')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0x12')]);router[_0x534e('0x13')](_0x534e('0xb'),auth[_0x534e('0x9')](),controller[_0x534e('0x14')]);module[_0x534e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f113f89..caa7164 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 _0xc5b6=['STRING','remoteUri','sequelize'];(function(_0x287dbe,_0x3f43ad){var _0x656b3c=function(_0x2c1126){while(--_0x2c1126){_0x287dbe['push'](_0x287dbe['shift']());}};_0x656b3c(++_0x3f43ad);}(_0xc5b6,0x11f));var _0x6c5b=function(_0x191f11,_0x245b9a){_0x191f11=_0x191f11-0x0;var _0x25948a=_0xc5b6[_0x191f11];return _0x25948a;};'use strict';var Sequelize=require(_0x6c5b('0x0'));module['exports']={'name':{'type':Sequelize[_0x6c5b('0x1')]},'description':{'type':Sequelize[_0x6c5b('0x1')]},'username':{'type':Sequelize[_0x6c5b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x6c5b('0x1')]},'email':{'type':Sequelize[_0x6c5b('0x1')]},'remoteUri':{'type':Sequelize[_0x6c5b('0x1')],'unique':_0x6c5b('0x2')},'serverUrl':{'type':Sequelize[_0x6c5b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbb45=['remoteUri','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb45,0xfd));var _0x5bb4=function(_0x4e91a4,_0x396618){_0x4e91a4=_0x4e91a4-0x0;var _0x4bb692=_0xbb45[_0x4e91a4];return _0x4bb692;};'use strict';var Sequelize=require('sequelize');module[_0x5bb4('0x0')]={'name':{'type':Sequelize[_0x5bb4('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5bb4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x5bb4('0x1')]},'email':{'type':Sequelize[_0x5bb4('0x1')]},'remoteUri':{'type':Sequelize[_0x5bb4('0x1')],'unique':_0x5bb4('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f298f8a..07cd2ab 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 _0x9568=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','map','ServicenowAccount','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','update','body','destroy','getConfigurations','rawAttributes','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','log','incident\x20table\x20objects','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','false','GET','sys_choice?sysparm_query=name=incident^element=','result','forEach','inactive','value','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5a5f21,_0x37567c){var _0x57c676=function(_0x4465f4){while(--_0x4465f4){_0x5a5f21['push'](_0x5a5f21['shift']());}};_0x57c676(++_0x37567c);}(_0x9568,0xa8));var _0x8956=function(_0x316b13,_0x21c7b3){_0x316b13=_0x316b13-0x0;var _0x29ab59=_0x9568[_0x316b13];return _0x29ab59;};'use strict';var emlformat=require(_0x8956('0x0'));var rimraf=require(_0x8956('0x1'));var zipdir=require(_0x8956('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8956('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8956('0x4'));var path=require(_0x8956('0x5'));var sox=require(_0x8956('0x6'));var csv=require(_0x8956('0x7'));var ejs=require(_0x8956('0x8'));var fs=require('fs');var fs_extra=require(_0x8956('0x9'));var _=require(_0x8956('0xa'));var squel=require(_0x8956('0xb'));var crypto=require(_0x8956('0xc'));var jsforce=require(_0x8956('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8956('0x7'));var querystring=require(_0x8956('0xe'));var Papa=require('papaparse');var Redis=require(_0x8956('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8956('0x10'));var as=require(_0x8956('0x11'));var hardwareService=require(_0x8956('0x12'));var logger=require(_0x8956('0x13'))(_0x8956('0x14'));var utils=require(_0x8956('0x15'));var config=require(_0x8956('0x16'));var licenseUtil=require(_0x8956('0x17'));var db=require(_0x8956('0x18'))['db'];var integrations=require(_0x8956('0x19'));function respondWithStatusCode(_0x3d5795,_0x465531){_0x465531=_0x465531||0xcc;return function(_0x198395){if(_0x198395){return _0x3d5795[_0x8956('0x1a')](_0x465531);}return _0x3d5795['status'](_0x465531)[_0x8956('0x1b')]();};}function respondWithResult(_0x5a4660,_0x5f17d2){_0x5f17d2=_0x5f17d2||0xc8;return function(_0x40732b){if(_0x40732b){return _0x5a4660[_0x8956('0x1c')](_0x5f17d2)[_0x8956('0x1d')](_0x40732b);}};}function respondWithFilteredResult(_0x149534,_0x4fb65f){return function(_0xcfa292){if(_0xcfa292){var _0x1bd44a=typeof _0x4fb65f[_0x8956('0x1e')]===_0x8956('0x1f')&&typeof _0x4fb65f[_0x8956('0x20')]===_0x8956('0x1f');var _0x83a0fc=_0xcfa292[_0x8956('0x21')];var _0x46d6a1=_0x1bd44a?0x0:_0x4fb65f[_0x8956('0x1e')];var _0x59a844=_0x1bd44a?_0xcfa292[_0x8956('0x21')]:_0x4fb65f['offset']+_0x4fb65f['limit'];var _0x2a5249;if(_0x59a844>=_0x83a0fc){_0x59a844=_0x83a0fc;_0x2a5249=0xc8;}else{_0x2a5249=0xce;}_0x149534[_0x8956('0x1c')](_0x2a5249);return _0x149534[_0x8956('0x22')](_0x8956('0x23'),_0x46d6a1+'-'+_0x59a844+'/'+_0x83a0fc)[_0x8956('0x1d')](_0xcfa292);}return null;};}function patchUpdates(_0x4b0891){return function(_0x23e70b){try{jsonpatch[_0x8956('0x24')](_0x23e70b,_0x4b0891,!![]);}catch(_0x26cea3){return BPromise['reject'](_0x26cea3);}return _0x23e70b[_0x8956('0x25')]();};}function saveUpdates(_0x18f36a,_0x490c9f){return function(_0x21455f){if(_0x21455f){return _0x21455f['update'](_0x18f36a)[_0x8956('0x26')](function(_0x2ed3ef){return _0x2ed3ef;});}return null;};}function removeEntity(_0x13b3be,_0x349a13){return function(_0x102cc0){if(_0x102cc0){return _0x102cc0['destroy']()[_0x8956('0x26')](function(){_0x13b3be[_0x8956('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4f6e5,_0x364041){return function(_0x13f147){if(!_0x13f147){_0xc4f6e5[_0x8956('0x1a')](0x194);}return _0x13f147;};}function handleError(_0x26943c,_0x2e5712){_0x2e5712=_0x2e5712||0x1f4;return function(_0x1ca041){logger[_0x8956('0x27')](_0x1ca041[_0x8956('0x28')]);if(_0x1ca041['name']){delete _0x1ca041[_0x8956('0x29')];}_0x26943c[_0x8956('0x1c')](_0x2e5712)[_0x8956('0x2a')](_0x1ca041);};}exports['index']=function(_0x4afd09,_0x4d7d26){var _0x10ae9b={},_0x42d14b={},_0x4b5dc5={'count':0x0,'rows':[]};var _0x204c09=_[_0x8956('0x2b')](db[_0x8956('0x2c')]['rawAttributes'],function(_0x725e48){return{'name':_0x725e48['fieldName'],'type':_0x725e48[_0x8956('0x2d')]['key']};});_0x42d14b[_0x8956('0x2e')]=_[_0x8956('0x2b')](_0x204c09,_0x8956('0x29'));_0x42d14b['query']=_[_0x8956('0x2f')](_0x4afd09[_0x8956('0x30')]);_0x42d14b[_0x8956('0x31')]=_[_0x8956('0x32')](_0x42d14b[_0x8956('0x2e')],_0x42d14b[_0x8956('0x30')]);_0x10ae9b['attributes']=_[_0x8956('0x32')](_0x42d14b['model'],qs[_0x8956('0x33')](_0x4afd09[_0x8956('0x30')][_0x8956('0x33')]));_0x10ae9b['attributes']=_0x10ae9b[_0x8956('0x34')][_0x8956('0x35')]?_0x10ae9b[_0x8956('0x34')]:_0x42d14b[_0x8956('0x2e')];if(!_0x4afd09[_0x8956('0x30')][_0x8956('0x36')](_0x8956('0x37'))){_0x10ae9b[_0x8956('0x20')]=qs['limit'](_0x4afd09[_0x8956('0x30')][_0x8956('0x20')]);_0x10ae9b[_0x8956('0x1e')]=qs[_0x8956('0x1e')](_0x4afd09[_0x8956('0x30')][_0x8956('0x1e')]);}_0x10ae9b[_0x8956('0x38')]=qs[_0x8956('0x39')](_0x4afd09[_0x8956('0x30')][_0x8956('0x39')]);_0x10ae9b[_0x8956('0x3a')]=qs[_0x8956('0x31')](_[_0x8956('0x3b')](_0x4afd09['query'],_0x42d14b[_0x8956('0x31')]),_0x204c09);if(_0x4afd09[_0x8956('0x30')][_0x8956('0x3c')]){_0x10ae9b[_0x8956('0x3a')]=_[_0x8956('0x3d')](_0x10ae9b['where'],{'$or':_[_0x8956('0x2b')](_0x204c09,function(_0x370300){if(_0x370300[_0x8956('0x2d')]!==_0x8956('0x3e')){var _0x48565f={};_0x48565f[_0x370300['name']]={'$like':'%'+_0x4afd09[_0x8956('0x30')]['filter']+'%'};return _0x48565f;}})});}_0x10ae9b=_[_0x8956('0x3d')]({},_0x10ae9b,_0x4afd09[_0x8956('0x3f')]);var _0x3b9289={'where':_0x10ae9b[_0x8956('0x3a')]};return db[_0x8956('0x2c')][_0x8956('0x21')](_0x3b9289)['then'](function(_0x2e3052){_0x4b5dc5[_0x8956('0x21')]=_0x2e3052;if(_0x4afd09['query'][_0x8956('0x40')]){_0x10ae9b[_0x8956('0x41')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x10ae9b);})[_0x8956('0x26')](function(_0x40ce4c){_0x4b5dc5[_0x8956('0x42')]=_0x40ce4c;return _0x4b5dc5;})['then'](respondWithFilteredResult(_0x4d7d26,_0x10ae9b))[_0x8956('0x43')](handleError(_0x4d7d26,null));};exports['show']=function(_0x5b8fa0,_0x4c8aef){var _0x4c433b={'raw':![],'where':{'id':_0x5b8fa0[_0x8956('0x44')]['id']}},_0x188f33={};_0x188f33['model']=_[_0x8956('0x2f')](db[_0x8956('0x2c')]['rawAttributes']);_0x188f33[_0x8956('0x30')]=_[_0x8956('0x2f')](_0x5b8fa0[_0x8956('0x30')]);_0x188f33[_0x8956('0x31')]=_[_0x8956('0x32')](_0x188f33[_0x8956('0x2e')],_0x188f33[_0x8956('0x30')]);_0x4c433b[_0x8956('0x34')]=_[_0x8956('0x32')](_0x188f33['model'],qs[_0x8956('0x33')](_0x5b8fa0[_0x8956('0x30')][_0x8956('0x33')]));_0x4c433b[_0x8956('0x34')]=_0x4c433b[_0x8956('0x34')][_0x8956('0x35')]?_0x4c433b[_0x8956('0x34')]:_0x188f33[_0x8956('0x2e')];if(_0x5b8fa0['query'][_0x8956('0x40')]){_0x4c433b[_0x8956('0x41')]=[{'all':!![]}];}_0x4c433b=_[_0x8956('0x3d')]({},_0x4c433b,_0x5b8fa0[_0x8956('0x3f')]);return db[_0x8956('0x2c')][_0x8956('0x45')](_0x4c433b)[_0x8956('0x26')](handleEntityNotFound(_0x4c8aef,null))[_0x8956('0x26')](respondWithResult(_0x4c8aef,null))[_0x8956('0x43')](handleError(_0x4c8aef,null));};exports[_0x8956('0x46')]=function(_0x944c76,_0x636d60){return db[_0x8956('0x2c')]['create'](_0x944c76['body'],{})['then'](respondWithResult(_0x636d60,0xc9))[_0x8956('0x43')](handleError(_0x636d60,null));};exports[_0x8956('0x47')]=function(_0x33a431,_0x2ec577){if(_0x33a431[_0x8956('0x48')]['id']){delete _0x33a431[_0x8956('0x48')]['id'];}return db[_0x8956('0x2c')]['find']({'where':{'id':_0x33a431[_0x8956('0x44')]['id']}})[_0x8956('0x26')](handleEntityNotFound(_0x2ec577,null))['then'](saveUpdates(_0x33a431[_0x8956('0x48')],null))['then'](respondWithResult(_0x2ec577,null))['catch'](handleError(_0x2ec577,null));};exports[_0x8956('0x49')]=function(_0x5ed5d0,_0xacb6df){return db[_0x8956('0x2c')][_0x8956('0x45')]({'where':{'id':_0x5ed5d0[_0x8956('0x44')]['id']}})[_0x8956('0x26')](handleEntityNotFound(_0xacb6df,null))['then'](removeEntity(_0xacb6df,null))[_0x8956('0x43')](handleError(_0xacb6df,null));};exports[_0x8956('0x4a')]=function(_0x26963f,_0x8e1218,_0x5e5f47){var _0x4d9559={};var _0x2b82ff={};var _0x1613e6;var _0x48e07e;return db['ServicenowAccount']['findOne']({'where':{'id':_0x26963f[_0x8956('0x44')]['id']}})[_0x8956('0x26')](handleEntityNotFound(_0x8e1218,null))[_0x8956('0x26')](function(_0x1e8c62){if(_0x1e8c62){_0x1613e6=_0x1e8c62;_0x2b82ff[_0x8956('0x2e')]=_[_0x8956('0x2f')](db['ServicenowConfiguration'][_0x8956('0x4b')]);_0x2b82ff[_0x8956('0x30')]=_[_0x8956('0x2f')](_0x26963f[_0x8956('0x30')]);_0x2b82ff['filters']=_['intersection'](_0x2b82ff[_0x8956('0x2e')],_0x2b82ff[_0x8956('0x30')]);_0x4d9559[_0x8956('0x34')]=_[_0x8956('0x32')](_0x2b82ff[_0x8956('0x2e')],qs[_0x8956('0x33')](_0x26963f['query'][_0x8956('0x33')]));_0x4d9559[_0x8956('0x34')]=_0x4d9559[_0x8956('0x34')][_0x8956('0x35')]?_0x4d9559[_0x8956('0x34')]:_0x2b82ff[_0x8956('0x2e')];_0x4d9559[_0x8956('0x38')]=qs[_0x8956('0x39')](_0x26963f[_0x8956('0x30')]['sort']);_0x4d9559[_0x8956('0x3a')]=qs[_0x8956('0x31')](_[_0x8956('0x3b')](_0x26963f['query'],_0x2b82ff[_0x8956('0x31')]));if(_0x26963f[_0x8956('0x30')]['filter']){_0x4d9559[_0x8956('0x3a')]=_[_0x8956('0x3d')](_0x4d9559[_0x8956('0x3a')],{'$or':_[_0x8956('0x2b')](_0x4d9559['attributes'],function(_0x187227){var _0x37f0d2={};_0x37f0d2[_0x187227]={'$like':'%'+_0x26963f['query'][_0x8956('0x3c')]+'%'};return _0x37f0d2;})});}_0x4d9559=_['merge']({},_0x4d9559,_0x26963f[_0x8956('0x3f')]);return _0x1613e6[_0x8956('0x4a')](_0x4d9559);}})[_0x8956('0x26')](function(_0xad3731){if(_0xad3731){_0x48e07e=_0xad3731[_0x8956('0x35')];if(!_0x26963f['query'][_0x8956('0x36')](_0x8956('0x37'))){_0x4d9559[_0x8956('0x20')]=qs[_0x8956('0x20')](_0x26963f[_0x8956('0x30')]['limit']);_0x4d9559[_0x8956('0x1e')]=qs['offset'](_0x26963f['query'][_0x8956('0x1e')]);}return _0x1613e6[_0x8956('0x4a')](_0x4d9559);}})[_0x8956('0x26')](function(_0x324d02){if(_0x324d02){return _0x324d02?{'count':_0x48e07e,'rows':_0x324d02}:null;}})[_0x8956('0x26')](respondWithResult(_0x8e1218,null))[_0x8956('0x43')](handleError(_0x8e1218,null));};exports[_0x8956('0x4c')]=function(_0x2ee629,_0x1ec520,_0x319fc5){if(_0x2ee629['body']['id']){delete _0x2ee629['body']['id'];}return db[_0x8956('0x2c')][_0x8956('0x4d')]({'where':{'id':_0x2ee629[_0x8956('0x44')]['id']}})[_0x8956('0x26')](handleEntityNotFound(_0x1ec520,null))[_0x8956('0x26')](function(_0x4d666d){if(_0x4d666d){_0x2ee629[_0x8956('0x48')][_0x8956('0x4e')]=_0x4d666d['id'];_0x2ee629[_0x8956('0x48')][_0x8956('0x4f')]=integrations['getSubjects'](_0x2ee629[_0x8956('0x48')][_0x8956('0x50')],_0x2ee629[_0x8956('0x48')][_0x8956('0x2d')]);_0x2ee629[_0x8956('0x48')]['Descriptions']=integrations[_0x8956('0x51')](_0x2ee629['body'][_0x8956('0x50')],_0x2ee629[_0x8956('0x48')]['type']);return db[_0x8956('0x52')][_0x8956('0x46')](_0x2ee629[_0x8956('0x48')],{'include':[{'model':db[_0x8956('0x53')],'as':_0x8956('0x4f')},{'model':db['ServicenowField'],'as':_0x8956('0x54')}]});}return null;})[_0x8956('0x26')](respondWithResult(_0x1ec520,null))['catch'](handleError(_0x1ec520,null));};exports[_0x8956('0x55')]=function(_0x3d39ac,_0x2ec2c3,_0x54480f){var _0x40cef1=[_0x8956('0x56'),_0x8956('0x57'),'knowledge',_0x8956('0x58'),_0x8956('0x59'),'notify',_0x8956('0x5a'),_0x8956('0x5b'),_0x8956('0x5c')];var _0x29eaf4=[_0x8956('0x5d'),_0x8956('0x56'),_0x8956('0x5e'),_0x8956('0x5f'),_0x8956('0x60'),_0x8956('0x61'),_0x8956('0x62'),_0x8956('0x57'),_0x8956('0x63'),'number',_0x8956('0x64'),'sys_updated_by',_0x8956('0x65'),_0x8956('0x66'),_0x8956('0x67'),_0x8956('0x68'),_0x8956('0x69'),_0x8956('0x6a'),_0x8956('0x6b'),_0x8956('0x38'),_0x8956('0x6c'),_0x8956('0x6d'),_0x8956('0x6e'),_0x8956('0x6f'),'impact',_0x8956('0x70'),_0x8956('0x71'),_0x8956('0x72'),_0x8956('0x73'),_0x8956('0x74'),_0x8956('0x75'),_0x8956('0x76'),'expected_start',_0x8956('0x77'),_0x8956('0x78'),_0x8956('0x79'),_0x8956('0x7a'),_0x8956('0x7b'),_0x8956('0x7c'),_0x8956('0x7d'),_0x8956('0x7e'),_0x8956('0x58'),_0x8956('0x7f'),_0x8956('0x80'),_0x8956('0x59'),_0x8956('0x81'),'delivery_task','work_start',_0x8956('0x82'),_0x8956('0x83'),_0x8956('0x84'),_0x8956('0x85'),_0x8956('0x86'),_0x8956('0x87'),'sys_class_name','close_notes','closed_by',_0x8956('0x88'),'parent_incident',_0x8956('0x89'),_0x8956('0x8a'),_0x8956('0x8b'),'incident_state',_0x8956('0x8c'),_0x8956('0x8d'),'company','reassignment_count',_0x8956('0x8e'),'assigned_to',_0x8956('0x5b'),_0x8956('0x8f'),_0x8956('0x90'),_0x8956('0x91'),_0x8956('0x92'),_0x8956('0x93'),'sys_mod_count','reopen_count',_0x8956('0x94'),_0x8956('0x95'),_0x8956('0x96'),'correlation_id','location',_0x8956('0x5c')];var _0x576a14='';var _0x588b9d='';var _0x1842c2=[];var _0x2c17a3='';var _0x5e5ec1='';var _0x47bab5=[];var _0x395923='';var _0x255bea='';var _0x1b9f2b={};var _0x50eb59='';return db[_0x8956('0x2c')][_0x8956('0x4d')]({'where':{'id':_0x3d39ac['params']['id']},'attributes':['id',_0x8956('0x97'),_0x8956('0x98'),_0x8956('0x99'),_0x8956('0x9a'),_0x8956('0x9b')]})[_0x8956('0x26')](handleEntityNotFound(_0x2ec2c3,null))[_0x8956('0x26')](function(_0x533f3b){if(_0x533f3b){_0x50eb59=_0x533f3b[_0x8956('0x9a')];var _0x38d28c=_0x50eb59[_0x8956('0x9c')](-0x1);if(_0x38d28c==='/'){_0x50eb59=_0x50eb59[_0x8956('0x9d')](0x0,_0x50eb59[_0x8956('0x9e')](_0x38d28c));}_0x255bea=util['format'](_0x8956('0x9f'),_0x50eb59);_0x395923=util[_0x8956('0xa0')](_0x8956('0xa1'),_0x50eb59);_0x1b9f2b={'user':_0x533f3b[_0x8956('0x97')],'pass':_0x533f3b[_0x8956('0x98')]};var _0x4d0582={'method':'GET','uri':_0x255bea+'incident?sysparm_display_value=all','auth':_0x1b9f2b,'json':!![]};return rp(_0x4d0582);}})[_0x8956('0x26')](function(_0x527d1a){if(_0x527d1a['result'][_0x8956('0x35')]>0x0){_0x576a14=_0x527d1a['result'];}console[_0x8956('0xa2')](_0x8956('0xa3'),_0x576a14);_0x47bab5=[];_0x588b9d=Object[_0x8956('0xa4')]([],_0x576a14);_[_0x8956('0xa5')](_0x588b9d,function(_0x122bd3){return!_0x40cef1[_0x8956('0xa6')](_0x122bd3[_0x8956('0x29')]);});_0x588b9d['forEach'](function(_0x184613){var _0x52be34=createFieldObject(_0x395923,_0x1b9f2b,_0x184613[_0x8956('0xa7')],_0x184613[_0x8956('0x29')],_0x184613['label'],![]);_0x47bab5[_0x8956('0xa8')](_0x52be34);});return Promise[_0x8956('0xa9')](_0x47bab5);})[_0x8956('0x26')](function(_0x1806c3){_0x1842c2=_0x1806c3;_0x2c17a3=Object['assign']([],_0x576a14);console[_0x8956('0xa2')](_0x8956('0xaa'),_0x576a14);_['remove'](_0x2c17a3,function(_0x5ea063){return _0x29eaf4[_0x8956('0xa6')](_0x5ea063[_0x8956('0x29')]);});console[_0x8956('0xa2')](_0x8956('0xab'),_0x2c17a3);_0x47bab5=[];_0x2c17a3['forEach'](function(_0xfbcc79){var _0x26c171=createFieldObject(_0x395923,_0x1b9f2b,_0xfbcc79[_0x8956('0xa7')],_0xfbcc79[_0x8956('0x29')],_0xfbcc79[_0x8956('0xac')],!![]);_0x47bab5[_0x8956('0xa8')](_0x26c171);});return Promise[_0x8956('0xa9')](_0x47bab5);})['then'](function(_0x14920e){_0x5e5ec1=_0x14920e;var _0x5c0cf1=_0x1842c2[_0x8956('0xad')](_0x5e5ec1);return{'count':_0x5c0cf1['length'],'rows':_0x5c0cf1};})[_0x8956('0x26')](respondWithResult(_0x2ec2c3,null))[_0x8956('0x43')](function(_0x5136b1){console[_0x8956('0xa2')](_0x8956('0xae')+_0x5136b1);var _0x1f1ceb=_0x3d39ac[_0x8956('0x30')][_0x8956('0xaf')]?0x1f4:_0x5136b1['statusCode']||0x1f4;logger[_0x8956('0x27')](_0x5136b1['stack']);delete _0x5136b1[_0x8956('0x29')];if(_0x1f1ceb===0x191){_0x1f1ceb=0x190;}_0x2ec2c3[_0x8956('0x1c')](_0x1f1ceb)['send'](_0x3d39ac['query'][_0x8956('0xaf')]?{'message':_0x8956('0xb0'),'statusCode':_0x5136b1[_0x8956('0xb1')]}:_0x5136b1);});};function createFieldObject(_0x7ee084,_0x2e3470,_0x15d764,_0x312431,_0x6078f0,_0x5a57ca){return new Promise(function(_0x4e6f9a,_0x375c78){var _0x10a03d={'id':_0x312431,'name':_0x6078f0,'custom':_0x5a57ca};if(_0x15d764===_0x8956('0xb2')){_0x10a03d[_0x8956('0x3f')]=[{'name':_0x8956('0xb3'),'value':'true'},{'name':'False','value':_0x8956('0xb4')}];_0x4e6f9a(_0x10a03d);}else{var _0xaad941={'method':_0x8956('0xb5'),'uri':_0x7ee084+_0x8956('0xb6')+_0x312431,'auth':_0x2e3470,'json':!![]};return rp(_0xaad941)['then'](function(_0x51bbf7){var _0x27d5c3=[];if(_0x51bbf7['result'][_0x8956('0x35')]>0x0){_0x51bbf7[_0x8956('0xb7')][_0x8956('0xb8')](function(_0x4087ab){if(_0x4087ab[_0x8956('0xb9')]===_0x8956('0xb4')){var _0x40fa6d={'name':_0x4087ab[_0x8956('0xac')],'value':_0x4087ab[_0x8956('0xba')]};_0x27d5c3['push'](_0x40fa6d);}});}_0x10a03d[_0x8956('0x3f')]=_0x27d5c3;if(_0x10a03d[_0x8956('0x3f')][_0x8956('0x35')]>0x0){_0x4e6f9a(_0x10a03d);}else{if(_0x5a57ca==![]){_0x4e6f9a();}else{_0x4e6f9a(_0x10a03d);}}});}});} \ No newline at end of file +var _0x4b78=['lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','findOne','ServicenowConfiguration','filter','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','category','parent','caused_by','upon_reject','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','work_notes_list','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','activity_due','assigned_to','severity','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','password','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','result','log','remove','includes','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x4b78,0x156));var _0x84b7=function(_0x2c348f,_0xaad6dd){_0x2c348f=_0x2c348f-0x0;var _0x39a62a=_0x4b78[_0x2c348f];return _0x39a62a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84b7('0x0'));var zipdir=require(_0x84b7('0x1'));var jsonpatch=require(_0x84b7('0x2'));var rp=require(_0x84b7('0x3'));var moment=require(_0x84b7('0x4'));var BPromise=require(_0x84b7('0x5'));var Mustache=require(_0x84b7('0x6'));var util=require(_0x84b7('0x7'));var path=require(_0x84b7('0x8'));var sox=require(_0x84b7('0x9'));var csv=require(_0x84b7('0xa'));var ejs=require(_0x84b7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84b7('0xc'));var squel=require('squel');var crypto=require(_0x84b7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x84b7('0xe'));var toCsv=require(_0x84b7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x84b7('0xf'));var qs=require(_0x84b7('0x10'));var as=require(_0x84b7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x84b7('0x12'));var utils=require(_0x84b7('0x13'));var config=require(_0x84b7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x84b7('0x15'))['db'];var integrations=require(_0x84b7('0x16'));function respondWithStatusCode(_0x27a60d,_0x29e53e){_0x29e53e=_0x29e53e||0xcc;return function(_0x9a5ea0){if(_0x9a5ea0){return _0x27a60d[_0x84b7('0x17')](_0x29e53e);}return _0x27a60d[_0x84b7('0x18')](_0x29e53e)[_0x84b7('0x19')]();};}function respondWithResult(_0x203e6b,_0x41a225){_0x41a225=_0x41a225||0xc8;return function(_0x564dd2){if(_0x564dd2){return _0x203e6b[_0x84b7('0x18')](_0x41a225)[_0x84b7('0x1a')](_0x564dd2);}};}function respondWithFilteredResult(_0x306123,_0x220b4b){return function(_0x4525e8){if(_0x4525e8){var _0x3f7f44=typeof _0x220b4b[_0x84b7('0x1b')]===_0x84b7('0x1c')&&typeof _0x220b4b['limit']===_0x84b7('0x1c');var _0x3922ba=_0x4525e8['count'];var _0x29f816=_0x3f7f44?0x0:_0x220b4b[_0x84b7('0x1b')];var _0xa07031=_0x3f7f44?_0x4525e8[_0x84b7('0x1d')]:_0x220b4b[_0x84b7('0x1b')]+_0x220b4b[_0x84b7('0x1e')];var _0x16df0c;if(_0xa07031>=_0x3922ba){_0xa07031=_0x3922ba;_0x16df0c=0xc8;}else{_0x16df0c=0xce;}_0x306123['status'](_0x16df0c);return _0x306123['set'](_0x84b7('0x1f'),_0x29f816+'-'+_0xa07031+'/'+_0x3922ba)[_0x84b7('0x1a')](_0x4525e8);}return null;};}function patchUpdates(_0x3db5ce){return function(_0x4bbb5d){try{jsonpatch[_0x84b7('0x20')](_0x4bbb5d,_0x3db5ce,!![]);}catch(_0x56a4ac){return BPromise[_0x84b7('0x21')](_0x56a4ac);}return _0x4bbb5d[_0x84b7('0x22')]();};}function saveUpdates(_0x54a894,_0x5bd71c){return function(_0x1a8c28){if(_0x1a8c28){return _0x1a8c28['update'](_0x54a894)['then'](function(_0x30f19c){return _0x30f19c;});}return null;};}function removeEntity(_0xa567d9,_0x1cc7bc){return function(_0x2a447b){if(_0x2a447b){return _0x2a447b['destroy']()[_0x84b7('0x23')](function(){_0xa567d9[_0x84b7('0x18')](0xcc)[_0x84b7('0x19')]();});}};}function handleEntityNotFound(_0x5c9c1f,_0x1daca8){return function(_0x525df4){if(!_0x525df4){_0x5c9c1f[_0x84b7('0x17')](0x194);}return _0x525df4;};}function handleError(_0x440bc3,_0xf388fe){_0xf388fe=_0xf388fe||0x1f4;return function(_0x2a3fbe){logger[_0x84b7('0x24')](_0x2a3fbe[_0x84b7('0x25')]);if(_0x2a3fbe[_0x84b7('0x26')]){delete _0x2a3fbe[_0x84b7('0x26')];}_0x440bc3[_0x84b7('0x18')](_0xf388fe)['send'](_0x2a3fbe);};}exports['index']=function(_0x9cc6d6,_0x497f54){var _0x1e860e={},_0x4a38cd={},_0x536cda={'count':0x0,'rows':[]};var _0x267c84=_[_0x84b7('0x27')](db[_0x84b7('0x28')][_0x84b7('0x29')],function(_0x11f796){return{'name':_0x11f796[_0x84b7('0x2a')],'type':_0x11f796[_0x84b7('0x2b')][_0x84b7('0x2c')]};});_0x4a38cd['model']=_[_0x84b7('0x27')](_0x267c84,_0x84b7('0x26'));_0x4a38cd[_0x84b7('0x2d')]=_['keys'](_0x9cc6d6['query']);_0x4a38cd[_0x84b7('0x2e')]=_['intersection'](_0x4a38cd[_0x84b7('0x2f')],_0x4a38cd[_0x84b7('0x2d')]);_0x1e860e['attributes']=_[_0x84b7('0x30')](_0x4a38cd[_0x84b7('0x2f')],qs['fields'](_0x9cc6d6[_0x84b7('0x2d')][_0x84b7('0x31')]));_0x1e860e[_0x84b7('0x32')]=_0x1e860e[_0x84b7('0x32')][_0x84b7('0x33')]?_0x1e860e['attributes']:_0x4a38cd[_0x84b7('0x2f')];if(!_0x9cc6d6[_0x84b7('0x2d')][_0x84b7('0x34')](_0x84b7('0x35'))){_0x1e860e['limit']=qs[_0x84b7('0x1e')](_0x9cc6d6[_0x84b7('0x2d')][_0x84b7('0x1e')]);_0x1e860e[_0x84b7('0x1b')]=qs[_0x84b7('0x1b')](_0x9cc6d6['query'][_0x84b7('0x1b')]);}_0x1e860e[_0x84b7('0x36')]=qs[_0x84b7('0x37')](_0x9cc6d6[_0x84b7('0x2d')]['sort']);_0x1e860e[_0x84b7('0x38')]=qs['filters'](_[_0x84b7('0x39')](_0x9cc6d6[_0x84b7('0x2d')],_0x4a38cd[_0x84b7('0x2e')]),_0x267c84);if(_0x9cc6d6['query']['filter']){_0x1e860e['where']=_[_0x84b7('0x3a')](_0x1e860e[_0x84b7('0x38')],{'$or':_[_0x84b7('0x27')](_0x267c84,function(_0x4c6175){if(_0x4c6175[_0x84b7('0x2b')]!==_0x84b7('0x3b')){var _0x5bd75f={};_0x5bd75f[_0x4c6175[_0x84b7('0x26')]]={'$like':'%'+_0x9cc6d6['query']['filter']+'%'};return _0x5bd75f;}})});}_0x1e860e=_['merge']({},_0x1e860e,_0x9cc6d6[_0x84b7('0x3c')]);var _0x5922a4={'where':_0x1e860e[_0x84b7('0x38')]};return db[_0x84b7('0x28')][_0x84b7('0x1d')](_0x5922a4)[_0x84b7('0x23')](function(_0x1323e8){_0x536cda[_0x84b7('0x1d')]=_0x1323e8;if(_0x9cc6d6[_0x84b7('0x2d')][_0x84b7('0x3d')]){_0x1e860e[_0x84b7('0x3e')]=[{'all':!![]}];}return db[_0x84b7('0x28')][_0x84b7('0x3f')](_0x1e860e);})[_0x84b7('0x23')](function(_0xd949c0){_0x536cda[_0x84b7('0x40')]=_0xd949c0;return _0x536cda;})['then'](respondWithFilteredResult(_0x497f54,_0x1e860e))[_0x84b7('0x41')](handleError(_0x497f54,null));};exports[_0x84b7('0x42')]=function(_0x51859e,_0x287180){var _0x5b4726={'raw':![],'where':{'id':_0x51859e[_0x84b7('0x43')]['id']}},_0x7d88ea={};_0x7d88ea[_0x84b7('0x2f')]=_[_0x84b7('0x44')](db[_0x84b7('0x28')]['rawAttributes']);_0x7d88ea[_0x84b7('0x2d')]=_['keys'](_0x51859e[_0x84b7('0x2d')]);_0x7d88ea[_0x84b7('0x2e')]=_[_0x84b7('0x30')](_0x7d88ea['model'],_0x7d88ea[_0x84b7('0x2d')]);_0x5b4726[_0x84b7('0x32')]=_['intersection'](_0x7d88ea[_0x84b7('0x2f')],qs[_0x84b7('0x31')](_0x51859e[_0x84b7('0x2d')][_0x84b7('0x31')]));_0x5b4726[_0x84b7('0x32')]=_0x5b4726[_0x84b7('0x32')][_0x84b7('0x33')]?_0x5b4726[_0x84b7('0x32')]:_0x7d88ea[_0x84b7('0x2f')];if(_0x51859e[_0x84b7('0x2d')]['includeAll']){_0x5b4726[_0x84b7('0x3e')]=[{'all':!![]}];}_0x5b4726=_['merge']({},_0x5b4726,_0x51859e[_0x84b7('0x3c')]);return db[_0x84b7('0x28')][_0x84b7('0x45')](_0x5b4726)[_0x84b7('0x23')](handleEntityNotFound(_0x287180,null))['then'](respondWithResult(_0x287180,null))[_0x84b7('0x41')](handleError(_0x287180,null));};exports[_0x84b7('0x46')]=function(_0x4d078d,_0x5e4803){return db[_0x84b7('0x28')][_0x84b7('0x46')](_0x4d078d[_0x84b7('0x47')],{})[_0x84b7('0x23')](respondWithResult(_0x5e4803,0xc9))[_0x84b7('0x41')](handleError(_0x5e4803,null));};exports[_0x84b7('0x48')]=function(_0x155fc2,_0x496959){if(_0x155fc2[_0x84b7('0x47')]['id']){delete _0x155fc2[_0x84b7('0x47')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x155fc2[_0x84b7('0x43')]['id']}})[_0x84b7('0x23')](handleEntityNotFound(_0x496959,null))[_0x84b7('0x23')](saveUpdates(_0x155fc2['body'],null))['then'](respondWithResult(_0x496959,null))[_0x84b7('0x41')](handleError(_0x496959,null));};exports[_0x84b7('0x49')]=function(_0x5cb19c,_0x48b783){return db[_0x84b7('0x28')]['find']({'where':{'id':_0x5cb19c[_0x84b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x48b783,null))['then'](removeEntity(_0x48b783,null))[_0x84b7('0x41')](handleError(_0x48b783,null));};exports['getConfigurations']=function(_0x3ed8c7,_0xbf46da,_0x5005fa){var _0x27131b={};var _0x122cdb={};var _0x43477e;var _0x4c0d75;return db[_0x84b7('0x28')][_0x84b7('0x4a')]({'where':{'id':_0x3ed8c7[_0x84b7('0x43')]['id']}})['then'](handleEntityNotFound(_0xbf46da,null))[_0x84b7('0x23')](function(_0x307363){if(_0x307363){_0x43477e=_0x307363;_0x122cdb[_0x84b7('0x2f')]=_['keys'](db[_0x84b7('0x4b')][_0x84b7('0x29')]);_0x122cdb[_0x84b7('0x2d')]=_['keys'](_0x3ed8c7[_0x84b7('0x2d')]);_0x122cdb[_0x84b7('0x2e')]=_['intersection'](_0x122cdb[_0x84b7('0x2f')],_0x122cdb['query']);_0x27131b[_0x84b7('0x32')]=_[_0x84b7('0x30')](_0x122cdb[_0x84b7('0x2f')],qs[_0x84b7('0x31')](_0x3ed8c7[_0x84b7('0x2d')][_0x84b7('0x31')]));_0x27131b['attributes']=_0x27131b[_0x84b7('0x32')][_0x84b7('0x33')]?_0x27131b[_0x84b7('0x32')]:_0x122cdb[_0x84b7('0x2f')];_0x27131b[_0x84b7('0x36')]=qs['sort'](_0x3ed8c7[_0x84b7('0x2d')][_0x84b7('0x37')]);_0x27131b[_0x84b7('0x38')]=qs[_0x84b7('0x2e')](_[_0x84b7('0x39')](_0x3ed8c7[_0x84b7('0x2d')],_0x122cdb['filters']));if(_0x3ed8c7[_0x84b7('0x2d')]['filter']){_0x27131b[_0x84b7('0x38')]=_[_0x84b7('0x3a')](_0x27131b[_0x84b7('0x38')],{'$or':_[_0x84b7('0x27')](_0x27131b['attributes'],function(_0x4e8e98){var _0x13f2cf={};_0x13f2cf[_0x4e8e98]={'$like':'%'+_0x3ed8c7[_0x84b7('0x2d')][_0x84b7('0x4c')]+'%'};return _0x13f2cf;})});}_0x27131b=_[_0x84b7('0x3a')]({},_0x27131b,_0x3ed8c7[_0x84b7('0x3c')]);return _0x43477e[_0x84b7('0x4d')](_0x27131b);}})[_0x84b7('0x23')](function(_0x30d12c){if(_0x30d12c){_0x4c0d75=_0x30d12c[_0x84b7('0x33')];if(!_0x3ed8c7[_0x84b7('0x2d')][_0x84b7('0x34')](_0x84b7('0x35'))){_0x27131b['limit']=qs[_0x84b7('0x1e')](_0x3ed8c7['query']['limit']);_0x27131b[_0x84b7('0x1b')]=qs[_0x84b7('0x1b')](_0x3ed8c7['query']['offset']);}return _0x43477e[_0x84b7('0x4d')](_0x27131b);}})[_0x84b7('0x23')](function(_0x1f756e){if(_0x1f756e){return _0x1f756e?{'count':_0x4c0d75,'rows':_0x1f756e}:null;}})[_0x84b7('0x23')](respondWithResult(_0xbf46da,null))[_0x84b7('0x41')](handleError(_0xbf46da,null));};exports[_0x84b7('0x4e')]=function(_0x5f001a,_0x350f75,_0x22646d){if(_0x5f001a[_0x84b7('0x47')]['id']){delete _0x5f001a[_0x84b7('0x47')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5f001a[_0x84b7('0x43')]['id']}})[_0x84b7('0x23')](handleEntityNotFound(_0x350f75,null))[_0x84b7('0x23')](function(_0x480055){if(_0x480055){_0x5f001a[_0x84b7('0x47')]['AccountId']=_0x480055['id'];_0x5f001a['body']['Subjects']=integrations[_0x84b7('0x4f')](_0x5f001a[_0x84b7('0x47')][_0x84b7('0x50')],_0x5f001a[_0x84b7('0x47')][_0x84b7('0x2b')]);_0x5f001a['body'][_0x84b7('0x51')]=integrations[_0x84b7('0x52')](_0x5f001a['body'][_0x84b7('0x50')],_0x5f001a[_0x84b7('0x47')][_0x84b7('0x2b')]);return db['ServicenowConfiguration'][_0x84b7('0x46')](_0x5f001a[_0x84b7('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x84b7('0x53')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x350f75,null))[_0x84b7('0x41')](handleError(_0x350f75,null));};exports[_0x84b7('0x54')]=function(_0x3469f8,_0x18158d,_0x56cc81){var _0x407f54=[_0x84b7('0x55'),_0x84b7('0x56'),_0x84b7('0x57'),_0x84b7('0x58'),_0x84b7('0x59'),'notify','incident_state','severity',_0x84b7('0x5a')];var _0x339c01=[_0x84b7('0x5b'),_0x84b7('0x55'),_0x84b7('0x5c'),'watch_list',_0x84b7('0x5d'),'sys_updated_on','child_incidents',_0x84b7('0x56'),'approval_history',_0x84b7('0x5e'),_0x84b7('0x5f'),_0x84b7('0x60'),_0x84b7('0x61'),_0x84b7('0x62'),_0x84b7('0x63'),_0x84b7('0x64'),_0x84b7('0x65'),_0x84b7('0x66'),'knowledge',_0x84b7('0x36'),_0x84b7('0x67'),_0x84b7('0x68'),_0x84b7('0x69'),_0x84b7('0x6a'),'impact','active',_0x84b7('0x6b'),'business_service',_0x84b7('0x6c'),_0x84b7('0x6d'),_0x84b7('0x6e'),'time_worked',_0x84b7('0x6f'),'opened_at',_0x84b7('0x70'),_0x84b7('0x71'),_0x84b7('0x72'),_0x84b7('0x73'),_0x84b7('0x74'),'caller_id',_0x84b7('0x75'),_0x84b7('0x58'),_0x84b7('0x76'),_0x84b7('0x77'),_0x84b7('0x59'),_0x84b7('0x78'),_0x84b7('0x79'),_0x84b7('0x7a'),_0x84b7('0x7b'),_0x84b7('0x7c'),_0x84b7('0x7d'),_0x84b7('0x7e'),'calendar_duration',_0x84b7('0x7f'),_0x84b7('0x80'),_0x84b7('0x81'),'closed_by',_0x84b7('0x82'),_0x84b7('0x83'),'sys_id',_0x84b7('0x84'),_0x84b7('0x85'),'incident_state',_0x84b7('0x86'),_0x84b7('0x87'),'company','reassignment_count',_0x84b7('0x88'),_0x84b7('0x89'),_0x84b7('0x8a'),'comments','sla_due',_0x84b7('0x8b'),_0x84b7('0x8c'),_0x84b7('0x8d'),_0x84b7('0x8e'),_0x84b7('0x8f'),'sys_tags',_0x84b7('0x90'),_0x84b7('0x91'),_0x84b7('0x92'),'location','category'];var _0x5d800f='';var _0x14a299='';var _0x1c28f8=[];var _0x1f7ced='';var _0x243d36='';var _0x4d1ebf=[];var _0x32e989='';var _0x2edc08='';var _0x553b74={};var _0x2ea45c='';return db[_0x84b7('0x28')]['findOne']({'where':{'id':_0x3469f8[_0x84b7('0x43')]['id']},'attributes':['id','username',_0x84b7('0x93'),'email',_0x84b7('0x94'),_0x84b7('0x95')]})[_0x84b7('0x23')](handleEntityNotFound(_0x18158d,null))[_0x84b7('0x23')](function(_0x5f5115){if(_0x5f5115){_0x2ea45c=_0x5f5115['remoteUri'];var _0x189f20=_0x2ea45c[_0x84b7('0x96')](-0x1);if(_0x189f20==='/'){_0x2ea45c=_0x2ea45c[_0x84b7('0x97')](0x0,_0x2ea45c['lastIndexOf'](_0x189f20));}_0x2edc08=util['format'](_0x84b7('0x98'),_0x2ea45c);_0x32e989=util['format'](_0x84b7('0x99'),_0x2ea45c);_0x553b74={'user':_0x5f5115[_0x84b7('0x9a')],'pass':_0x5f5115['password']};var _0x12011e={'method':_0x84b7('0x9b'),'uri':_0x2edc08+'incident?sysparm_display_value=all','auth':_0x553b74,'json':!![]};return rp(_0x12011e);}})['then'](function(_0x40b021){if(_0x40b021[_0x84b7('0x9c')][_0x84b7('0x33')]>0x0){_0x5d800f=_0x40b021['result'];}console[_0x84b7('0x9d')]('incident\x20table\x20objects',_0x5d800f);_0x4d1ebf=[];_0x14a299=Object['assign']([],_0x5d800f);_[_0x84b7('0x9e')](_0x14a299,function(_0x45c191){return!_0x407f54[_0x84b7('0x9f')](_0x45c191[_0x84b7('0x26')]);});_0x14a299['forEach'](function(_0x4ffe76){var _0x522294=createFieldObject(_0x32e989,_0x553b74,_0x4ffe76[_0x84b7('0xa0')],_0x4ffe76[_0x84b7('0x26')],_0x4ffe76[_0x84b7('0xa1')],![]);_0x4d1ebf[_0x84b7('0xa2')](_0x522294);});return Promise['all'](_0x4d1ebf);})[_0x84b7('0x23')](function(_0x30848e){_0x1c28f8=_0x30848e;_0x1f7ced=Object['assign']([],_0x5d800f);console[_0x84b7('0x9d')](_0x84b7('0xa3'),_0x5d800f);_[_0x84b7('0x9e')](_0x1f7ced,function(_0x5627db){return _0x339c01[_0x84b7('0x9f')](_0x5627db['name']);});console['log'](_0x84b7('0xa4'),_0x1f7ced);_0x4d1ebf=[];_0x1f7ced[_0x84b7('0xa5')](function(_0xb6d127){var _0x51b1dc=createFieldObject(_0x32e989,_0x553b74,_0xb6d127[_0x84b7('0xa0')],_0xb6d127['name'],_0xb6d127[_0x84b7('0xa1')],!![]);_0x4d1ebf[_0x84b7('0xa2')](_0x51b1dc);});return Promise['all'](_0x4d1ebf);})[_0x84b7('0x23')](function(_0x387ec3){_0x243d36=_0x387ec3;var _0x4b7253=_0x1c28f8[_0x84b7('0xa6')](_0x243d36);return{'count':_0x4b7253[_0x84b7('0x33')],'rows':_0x4b7253};})[_0x84b7('0x23')](respondWithResult(_0x18158d,null))[_0x84b7('0x41')](function(_0x14b75b){console['log'](_0x84b7('0xa7')+_0x14b75b);var _0x30d217=_0x3469f8['query'][_0x84b7('0xa8')]?0x1f4:_0x14b75b[_0x84b7('0xa9')]||0x1f4;logger[_0x84b7('0x24')](_0x14b75b['stack']);delete _0x14b75b[_0x84b7('0x26')];if(_0x30d217===0x191){_0x30d217=0x190;}_0x18158d[_0x84b7('0x18')](_0x30d217)[_0x84b7('0xaa')](_0x3469f8[_0x84b7('0x2d')][_0x84b7('0xa8')]?{'message':_0x84b7('0xab'),'statusCode':_0x14b75b[_0x84b7('0xa9')]}:_0x14b75b);});};function createFieldObject(_0x4b97f0,_0xbcb4c0,_0x1bd3f6,_0x294221,_0x2cdde1,_0x44981b){return new Promise(function(_0x15d209,_0x575049){var _0x30a76d={'id':_0x294221,'name':_0x2cdde1,'custom':_0x44981b};if(_0x1bd3f6===_0x84b7('0xac')){_0x30a76d[_0x84b7('0x3c')]=[{'name':_0x84b7('0xad'),'value':_0x84b7('0xae')},{'name':_0x84b7('0xaf'),'value':_0x84b7('0xb0')}];_0x15d209(_0x30a76d);}else{var _0x4653ea={'method':_0x84b7('0x9b'),'uri':_0x4b97f0+'sys_choice?sysparm_query=name=incident^element='+_0x294221,'auth':_0xbcb4c0,'json':!![]};return rp(_0x4653ea)[_0x84b7('0x23')](function(_0x38704e){var _0x1b5921=[];if(_0x38704e['result']['length']>0x0){_0x38704e[_0x84b7('0x9c')]['forEach'](function(_0x1acbf4){if(_0x1acbf4['inactive']==='false'){var _0x5eae08={'name':_0x1acbf4[_0x84b7('0xa1')],'value':_0x1acbf4['value']};_0x1b5921['push'](_0x5eae08);}});}_0x30a76d[_0x84b7('0x3c')]=_0x1b5921;if(_0x30a76d[_0x84b7('0x3c')][_0x84b7('0x33')]>0x0){_0x15d209(_0x30a76d);}else{if(_0x44981b==![]){_0x15d209();}else{_0x15d209(_0x30a76d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 44fe781..39d069f 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 _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x81ea09,_0x28ccd1){var _0x300e8c=function(_0x4d5dce){while(--_0x4d5dce){_0x81ea09['push'](_0x81ea09['shift']());}};_0x300e8c(++_0x28ccd1);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x24301e,_0x591f1f){var _0x7cc7b=function(_0x1128b5){while(--_0x1128b5){_0x24301e['push'](_0x24301e['shift']());}};_0x7cc7b(++_0x591f1f);}(_0x2bd8,0x130));var _0x82bd=function(_0xd9a88b,_0xd85234){_0xd9a88b=_0xd9a88b-0x0;var _0xe28295=_0x2bd8[_0xd9a88b];return _0xe28295;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));var integrations=require(_0x82bd('0x9'));module[_0x82bd('0xa')]=function(_0x5ceb60,_0x19dbb1){return _0x5ceb60[_0x82bd('0xb')](_0x82bd('0xc'),attributes,{'tableName':_0x82bd('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 f418a1c..211e004 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 _0xfe88=['message','result','catch','GetServicenowAccount','findAll','options','raw','where','limit','map','include','model','attributes','info','ShowServicenowAccount','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s'];(function(_0x5dfbb1,_0x100cc7){var _0x136934=function(_0x40b17e){while(--_0x40b17e){_0x5dfbb1['push'](_0x5dfbb1['shift']());}};_0x136934(++_0x100cc7);}(_0xfe88,0x186));var _0x8fe8=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xfe88[_0x4d6ac0];return _0x5296c4;};'use strict';var _=require(_0x8fe8('0x0'));var util=require('util');var moment=require(_0x8fe8('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fe8('0x2'));var fs=require('fs');var Redis=require(_0x8fe8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fe8('0x4'));var logger=require(_0x8fe8('0x5'))(_0x8fe8('0x6'));var config=require('../../config/environment');var jayson=require(_0x8fe8('0x7'));var client=jayson[_0x8fe8('0x8')][_0x8fe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3caeef,_0x1d9b43,_0x1273d0){return new BPromise(function(_0xdbe8af,_0x534593){return client['request'](_0x3caeef,_0x1273d0)[_0x8fe8('0xa')](function(_0x1c5720){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1d9b43,_0x8fe8('0xb'));logger[_0x8fe8('0xc')](_0x8fe8('0xd'),_0x1d9b43,'request\x20sent',JSON[_0x8fe8('0xe')](_0x1c5720));if(_0x1c5720[_0x8fe8('0xf')]){if(_0x1c5720['error'][_0x8fe8('0x10')]===0x1f4){logger[_0x8fe8('0xf')](_0x8fe8('0x11'),_0x1d9b43,_0x1c5720[_0x8fe8('0xf')][_0x8fe8('0x12')]);return _0x534593(_0x1c5720[_0x8fe8('0xf')][_0x8fe8('0x12')]);}logger[_0x8fe8('0xf')](_0x8fe8('0x11'),_0x1d9b43,_0x1c5720[_0x8fe8('0xf')][_0x8fe8('0x12')]);return _0xdbe8af(_0x1c5720['error'][_0x8fe8('0x12')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1d9b43,'request\x20sent');_0xdbe8af(_0x1c5720[_0x8fe8('0x13')]['message']);}})[_0x8fe8('0x14')](function(_0x370634){logger[_0x8fe8('0xf')](_0x8fe8('0x11'),_0x1d9b43,_0x370634);_0x534593(_0x370634);});});}exports[_0x8fe8('0x15')]=function(_0xd19efd){var _0x4b5b3f=this;return new Promise(function(_0x356fb6,_0x56a6bc){return db['ServicenowAccount'][_0x8fe8('0x16')]({'raw':_0xd19efd[_0x8fe8('0x17')]?_0xd19efd[_0x8fe8('0x17')][_0x8fe8('0x18')]===undefined?!![]:![]:!![],'where':_0xd19efd[_0x8fe8('0x17')]?_0xd19efd[_0x8fe8('0x17')][_0x8fe8('0x19')]||null:null,'attributes':_0xd19efd['options']?_0xd19efd[_0x8fe8('0x17')]['attributes']||null:null,'limit':_0xd19efd[_0x8fe8('0x17')]?_0xd19efd['options'][_0x8fe8('0x1a')]||null:null,'include':_0xd19efd[_0x8fe8('0x17')]?_0xd19efd[_0x8fe8('0x17')]['include']?_[_0x8fe8('0x1b')](_0xd19efd[_0x8fe8('0x17')][_0x8fe8('0x1c')],function(_0x4d770c){return{'model':db[_0x4d770c[_0x8fe8('0x1d')]],'as':_0x4d770c['as'],'attributes':_0x4d770c[_0x8fe8('0x1e')],'include':_0x4d770c['include']?_['map'](_0x4d770c[_0x8fe8('0x1c')],function(_0x1ceaf7){return{'model':db[_0x1ceaf7[_0x8fe8('0x1d')]],'as':_0x1ceaf7['as'],'attributes':_0x1ceaf7[_0x8fe8('0x1e')],'include':_0x1ceaf7['include']?_[_0x8fe8('0x1b')](_0x1ceaf7[_0x8fe8('0x1c')],function(_0x5e7905){return{'model':db[_0x5e7905['model']],'as':_0x5e7905['as'],'attributes':_0x5e7905[_0x8fe8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fe8('0xa')](function(_0x2b08be){logger[_0x8fe8('0x1f')](_0x8fe8('0x15'),_0xd19efd);logger[_0x8fe8('0xc')](_0x8fe8('0x15'),_0xd19efd,JSON[_0x8fe8('0xe')](_0x2b08be));_0x356fb6(_0x2b08be);})[_0x8fe8('0x14')](function(_0x1cca10){logger[_0x8fe8('0xf')](_0x8fe8('0x15'),_0x1cca10[_0x8fe8('0x12')],_0xd19efd);_0x56a6bc(_0x4b5b3f['error'](0x1f4,_0x1cca10[_0x8fe8('0x12')]));});});};exports[_0x8fe8('0x20')]=function(_0x399b24){var _0x48efe1=this;return new Promise(function(_0x5e17a2,_0x501759){return db['ServicenowAccount'][_0x8fe8('0x21')]({'raw':_0x399b24[_0x8fe8('0x17')]?_0x399b24[_0x8fe8('0x17')][_0x8fe8('0x18')]===undefined?!![]:![]:!![],'where':_0x399b24[_0x8fe8('0x17')]?_0x399b24[_0x8fe8('0x17')]['where']||null:null,'attributes':_0x399b24[_0x8fe8('0x17')]?_0x399b24[_0x8fe8('0x17')][_0x8fe8('0x1e')]||null:null,'include':_0x399b24[_0x8fe8('0x17')]?_0x399b24[_0x8fe8('0x17')][_0x8fe8('0x1c')]?_[_0x8fe8('0x1b')](_0x399b24[_0x8fe8('0x17')][_0x8fe8('0x1c')],function(_0xbb27b5){return{'model':db[_0xbb27b5[_0x8fe8('0x1d')]],'as':_0xbb27b5['as'],'attributes':_0xbb27b5[_0x8fe8('0x1e')],'include':_0xbb27b5[_0x8fe8('0x1c')]?_['map'](_0xbb27b5['include'],function(_0x102ebe){return{'model':db[_0x102ebe[_0x8fe8('0x1d')]],'as':_0x102ebe['as'],'attributes':_0x102ebe['attributes'],'include':_0x102ebe[_0x8fe8('0x1c')]?_[_0x8fe8('0x1b')](_0x102ebe[_0x8fe8('0x1c')],function(_0xc271c9){return{'model':db[_0xc271c9[_0x8fe8('0x1d')]],'as':_0xc271c9['as'],'attributes':_0xc271c9[_0x8fe8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fe8('0xa')](function(_0x44ad24){logger[_0x8fe8('0x1f')](_0x8fe8('0x20'),_0x399b24);logger['debug'](_0x8fe8('0x20'),_0x399b24,JSON[_0x8fe8('0xe')](_0x44ad24));_0x5e17a2(_0x44ad24);})['catch'](function(_0x12a831){logger['error'](_0x8fe8('0x20'),_0x12a831['message'],_0x399b24);_0x501759(_0x48efe1[_0x8fe8('0xf')](0x1f4,_0x12a831['message']));});});}; \ No newline at end of file +var _0xff5a=['error','message','result','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ServicenowAccount','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3e9030,_0x16c384){var _0x526b49=function(_0x3228fe){while(--_0x3228fe){_0x3e9030['push'](_0x3e9030['shift']());}};_0x526b49(++_0x16c384);}(_0xff5a,0xa8));var _0xaff5=function(_0x54ca0c,_0x58311b){_0x54ca0c=_0x54ca0c-0x0;var _0x323826=_0xff5a[_0x54ca0c];return _0x323826;};'use strict';var _=require('lodash');var util=require(_0xaff5('0x0'));var moment=require(_0xaff5('0x1'));var BPromise=require(_0xaff5('0x2'));var rs=require(_0xaff5('0x3'));var fs=require('fs');var Redis=require(_0xaff5('0x4'));var db=require(_0xaff5('0x5'))['db'];var utils=require(_0xaff5('0x6'));var logger=require(_0xaff5('0x7'))(_0xaff5('0x8'));var config=require(_0xaff5('0x9'));var jayson=require(_0xaff5('0xa'));var client=jayson[_0xaff5('0xb')][_0xaff5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b210f,_0x3f73f2,_0x228161){return new BPromise(function(_0x44a38b,_0x42c154){return client[_0xaff5('0xd')](_0x1b210f,_0x228161)[_0xaff5('0xe')](function(_0x3f001d){logger[_0xaff5('0xf')](_0xaff5('0x10'),_0x3f73f2,_0xaff5('0x11'));logger[_0xaff5('0x12')](_0xaff5('0x13'),_0x3f73f2,_0xaff5('0x11'),JSON[_0xaff5('0x14')](_0x3f001d));if(_0x3f001d['error']){if(_0x3f001d['error'][_0xaff5('0x15')]===0x1f4){logger[_0xaff5('0x16')](_0xaff5('0x10'),_0x3f73f2,_0x3f001d[_0xaff5('0x16')]['message']);return _0x42c154(_0x3f001d['error'][_0xaff5('0x17')]);}logger[_0xaff5('0x16')](_0xaff5('0x10'),_0x3f73f2,_0x3f001d[_0xaff5('0x16')][_0xaff5('0x17')]);return _0x44a38b(_0x3f001d[_0xaff5('0x16')][_0xaff5('0x17')]);}else{logger[_0xaff5('0xf')](_0xaff5('0x10'),_0x3f73f2,_0xaff5('0x11'));_0x44a38b(_0x3f001d[_0xaff5('0x18')][_0xaff5('0x17')]);}})['catch'](function(_0x28e442){logger[_0xaff5('0x16')](_0xaff5('0x10'),_0x3f73f2,_0x28e442);_0x42c154(_0x28e442);});});}exports[_0xaff5('0x19')]=function(_0x4e246c){var _0x11c825=this;return new Promise(function(_0x16f3bd,_0x4d74b9){return db['ServicenowAccount'][_0xaff5('0x1a')]({'raw':_0x4e246c[_0xaff5('0x1b')]?_0x4e246c[_0xaff5('0x1b')][_0xaff5('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e246c[_0xaff5('0x1b')]?_0x4e246c[_0xaff5('0x1b')][_0xaff5('0x1d')]||null:null,'attributes':_0x4e246c['options']?_0x4e246c[_0xaff5('0x1b')][_0xaff5('0x1e')]||null:null,'limit':_0x4e246c[_0xaff5('0x1b')]?_0x4e246c[_0xaff5('0x1b')][_0xaff5('0x1f')]||null:null,'include':_0x4e246c['options']?_0x4e246c[_0xaff5('0x1b')]['include']?_[_0xaff5('0x20')](_0x4e246c[_0xaff5('0x1b')][_0xaff5('0x21')],function(_0x1017dd){return{'model':db[_0x1017dd[_0xaff5('0x22')]],'as':_0x1017dd['as'],'attributes':_0x1017dd['attributes'],'include':_0x1017dd['include']?_[_0xaff5('0x20')](_0x1017dd['include'],function(_0x520ac3){return{'model':db[_0x520ac3[_0xaff5('0x22')]],'as':_0x520ac3['as'],'attributes':_0x520ac3['attributes'],'include':_0x520ac3['include']?_[_0xaff5('0x20')](_0x520ac3[_0xaff5('0x21')],function(_0xf4a744){return{'model':db[_0xf4a744[_0xaff5('0x22')]],'as':_0xf4a744['as'],'attributes':_0xf4a744[_0xaff5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1978ee){logger[_0xaff5('0xf')](_0xaff5('0x19'),_0x4e246c);logger[_0xaff5('0x12')](_0xaff5('0x19'),_0x4e246c,JSON[_0xaff5('0x14')](_0x1978ee));_0x16f3bd(_0x1978ee);})[_0xaff5('0x23')](function(_0x5894fe){logger['error'](_0xaff5('0x19'),_0x5894fe[_0xaff5('0x17')],_0x4e246c);_0x4d74b9(_0x11c825[_0xaff5('0x16')](0x1f4,_0x5894fe[_0xaff5('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x4eab16){var _0x458a20=this;return new Promise(function(_0x3e0543,_0x195d9f){return db[_0xaff5('0x24')]['find']({'raw':_0x4eab16[_0xaff5('0x1b')]?_0x4eab16[_0xaff5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4eab16['options']?_0x4eab16[_0xaff5('0x1b')][_0xaff5('0x1d')]||null:null,'attributes':_0x4eab16[_0xaff5('0x1b')]?_0x4eab16['options'][_0xaff5('0x1e')]||null:null,'include':_0x4eab16[_0xaff5('0x1b')]?_0x4eab16[_0xaff5('0x1b')][_0xaff5('0x21')]?_['map'](_0x4eab16[_0xaff5('0x1b')]['include'],function(_0x2d6539){return{'model':db[_0x2d6539[_0xaff5('0x22')]],'as':_0x2d6539['as'],'attributes':_0x2d6539['attributes'],'include':_0x2d6539[_0xaff5('0x21')]?_[_0xaff5('0x20')](_0x2d6539[_0xaff5('0x21')],function(_0x2b41cc){return{'model':db[_0x2b41cc[_0xaff5('0x22')]],'as':_0x2b41cc['as'],'attributes':_0x2b41cc[_0xaff5('0x1e')],'include':_0x2b41cc[_0xaff5('0x21')]?_[_0xaff5('0x20')](_0x2b41cc[_0xaff5('0x21')],function(_0x32cade){return{'model':db[_0x32cade[_0xaff5('0x22')]],'as':_0x32cade['as'],'attributes':_0x32cade[_0xaff5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaff5('0xe')](function(_0x11719f){logger[_0xaff5('0xf')]('ShowServicenowAccount',_0x4eab16);logger[_0xaff5('0x12')](_0xaff5('0x25'),_0x4eab16,JSON[_0xaff5('0x14')](_0x11719f));_0x3e0543(_0x11719f);})[_0xaff5('0x23')](function(_0x1cf8ee){logger['error'](_0xaff5('0x25'),_0x1cf8ee[_0xaff5('0x17')],_0x4eab16);_0x195d9f(_0x458a20[_0xaff5('0x16')](0x1f4,_0x1cf8ee[_0xaff5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7e24950..b2d1f8b 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 _0x52d1=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','multer','util'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x52d1,0x129));var _0x152d=function(_0x2c77c2,_0x35f9ec){_0x2c77c2=_0x2c77c2-0x0;var _0x5b9782=_0x52d1[_0x2c77c2];return _0x5b9782;};'use strict';var multer=require(_0x152d('0x0'));var util=require(_0x152d('0x1'));var path=require(_0x152d('0x2'));var timeout=require('connect-timeout');var express=require(_0x152d('0x3'));var router=express['Router']();var fs_extra=require(_0x152d('0x4'));var auth=require(_0x152d('0x5'));var interaction=require(_0x152d('0x6'));var config=require(_0x152d('0x7'));var controller=require(_0x152d('0x8'));router['get']('/',auth[_0x152d('0x9')](),controller[_0x152d('0xa')]);router[_0x152d('0xb')](_0x152d('0xc'),auth[_0x152d('0x9')](),controller[_0x152d('0xd')]);router['get']('/:id/fields',auth[_0x152d('0x9')](),controller[_0x152d('0xe')]);router['get'](_0x152d('0xf'),auth[_0x152d('0x9')](),controller[_0x152d('0x10')]);router[_0x152d('0xb')](_0x152d('0x11'),auth[_0x152d('0x9')](),controller[_0x152d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x152d('0x13')](_0x152d('0xc'),auth[_0x152d('0x9')](),controller[_0x152d('0x14')]);router[_0x152d('0x15')]('/:id',auth[_0x152d('0x9')](),controller[_0x152d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1a46=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','destroy','multer','util'];(function(_0x528c57,_0x5207d9){var _0x3a3051=function(_0x5ae247){while(--_0x5ae247){_0x528c57['push'](_0x528c57['shift']());}};_0x3a3051(++_0x5207d9);}(_0x1a46,0x67));var _0x61a4=function(_0x434f49,_0x390167){_0x434f49=_0x434f49-0x0;var _0x4d3bde=_0x1a46[_0x434f49];return _0x4d3bde;};'use strict';var multer=require(_0x61a4('0x0'));var util=require(_0x61a4('0x1'));var path=require('path');var timeout=require(_0x61a4('0x2'));var express=require(_0x61a4('0x3'));var router=express['Router']();var fs_extra=require(_0x61a4('0x4'));var auth=require(_0x61a4('0x5'));var interaction=require(_0x61a4('0x6'));var config=require(_0x61a4('0x7'));var controller=require(_0x61a4('0x8'));router[_0x61a4('0x9')]('/',auth[_0x61a4('0xa')](),controller['index']);router[_0x61a4('0x9')](_0x61a4('0xb'),auth[_0x61a4('0xa')](),controller[_0x61a4('0xc')]);router['get'](_0x61a4('0xd'),auth[_0x61a4('0xa')](),controller[_0x61a4('0xe')]);router[_0x61a4('0x9')]('/:id/subjects',auth[_0x61a4('0xa')](),controller['getSubjects']);router[_0x61a4('0x9')](_0x61a4('0xf'),auth[_0x61a4('0xa')](),controller[_0x61a4('0x10')]);router[_0x61a4('0x11')]('/',auth[_0x61a4('0xa')](),controller[_0x61a4('0x12')]);router[_0x61a4('0x13')](_0x61a4('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x61a4('0xb'),auth[_0x61a4('0xa')](),controller[_0x61a4('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f65aace..c1a01dc 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 _0x56a3=['STRING','sequelize'];(function(_0x288b41,_0x429d53){var _0x245598=function(_0x281873){while(--_0x281873){_0x288b41['push'](_0x288b41['shift']());}};_0x245598(++_0x429d53);}(_0x56a3,0x99));var _0x356a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56a3[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x356a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x356a('0x1')]}}; \ No newline at end of file +var _0x49bf=['sequelize','exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x49bf,0x1e6));var _0xf49b=function(_0x1c645a,_0x27f9d7){_0x1c645a=_0x1c645a-0x0;var _0x2a0ab2=_0x49bf[_0x1c645a];return _0x2a0ab2;};'use strict';var Sequelize=require(_0xf49b('0x0'));module[_0xf49b('0x1')]={'name':{'type':Sequelize[_0xf49b('0x2')]},'description':{'type':Sequelize[_0xf49b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a118b87..a506c18 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 _0x8b00=['status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','update','body','find','getFields','findOne','ServicenowField','order','getSubjects','sort','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3acba4,_0x470898){var _0x32df4a=function(_0x249de3){while(--_0x249de3){_0x3acba4['push'](_0x3acba4['shift']());}};_0x32df4a(++_0x470898);}(_0x8b00,0x89));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x08b0('0x0'));var rimraf=require(_0x08b0('0x1'));var zipdir=require(_0x08b0('0x2'));var jsonpatch=require(_0x08b0('0x3'));var rp=require('request-promise');var moment=require(_0x08b0('0x4'));var BPromise=require(_0x08b0('0x5'));var Mustache=require(_0x08b0('0x6'));var util=require(_0x08b0('0x7'));var path=require(_0x08b0('0x8'));var sox=require(_0x08b0('0x9'));var csv=require(_0x08b0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08b0('0xb'));var _=require(_0x08b0('0xc'));var squel=require(_0x08b0('0xd'));var crypto=require(_0x08b0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x08b0('0xa'));var querystring=require(_0x08b0('0xf'));var Papa=require(_0x08b0('0x10'));var Redis=require(_0x08b0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x08b0('0x12'));var as=require(_0x08b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08b0('0x14'))(_0x08b0('0x15'));var utils=require(_0x08b0('0x16'));var config=require(_0x08b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a03af,_0x4093d8){_0x4093d8=_0x4093d8||0xcc;return function(_0x3b3022){if(_0x3b3022){return _0x3a03af[_0x08b0('0x18')](_0x4093d8);}return _0x3a03af[_0x08b0('0x19')](_0x4093d8)[_0x08b0('0x1a')]();};}function respondWithResult(_0x15580d,_0x1ec961){_0x1ec961=_0x1ec961||0xc8;return function(_0xda4242){if(_0xda4242){return _0x15580d[_0x08b0('0x19')](_0x1ec961)[_0x08b0('0x1b')](_0xda4242);}};}function respondWithFilteredResult(_0x40546c,_0x3366bf){return function(_0x2b0e1a){if(_0x2b0e1a){var _0x24f53b=typeof _0x3366bf[_0x08b0('0x1c')]===_0x08b0('0x1d')&&typeof _0x3366bf['limit']===_0x08b0('0x1d');var _0x293763=_0x2b0e1a[_0x08b0('0x1e')];var _0x20c30d=_0x24f53b?0x0:_0x3366bf[_0x08b0('0x1c')];var _0x37af80=_0x24f53b?_0x2b0e1a[_0x08b0('0x1e')]:_0x3366bf[_0x08b0('0x1c')]+_0x3366bf[_0x08b0('0x1f')];var _0x422a53;if(_0x37af80>=_0x293763){_0x37af80=_0x293763;_0x422a53=0xc8;}else{_0x422a53=0xce;}_0x40546c[_0x08b0('0x19')](_0x422a53);return _0x40546c[_0x08b0('0x20')]('Content-Range',_0x20c30d+'-'+_0x37af80+'/'+_0x293763)[_0x08b0('0x1b')](_0x2b0e1a);}return null;};}function patchUpdates(_0x28e105){return function(_0x15fff4){try{jsonpatch[_0x08b0('0x21')](_0x15fff4,_0x28e105,!![]);}catch(_0x107d7e){return BPromise[_0x08b0('0x22')](_0x107d7e);}return _0x15fff4[_0x08b0('0x23')]();};}function saveUpdates(_0x2d8db2,_0x2cbb2c){return function(_0x23d8c8){if(_0x23d8c8){return _0x23d8c8['update'](_0x2d8db2)[_0x08b0('0x24')](function(_0xbc102e){return _0xbc102e;});}return null;};}function removeEntity(_0x164026,_0xad4538){return function(_0x31c225){if(_0x31c225){return _0x31c225[_0x08b0('0x25')]()[_0x08b0('0x24')](function(){_0x164026[_0x08b0('0x19')](0xcc)[_0x08b0('0x1a')]();});}};}function handleEntityNotFound(_0x47306a,_0x2b5d46){return function(_0x551c4f){if(!_0x551c4f){_0x47306a[_0x08b0('0x18')](0x194);}return _0x551c4f;};}function handleError(_0x3a6a22,_0x18b5eb){_0x18b5eb=_0x18b5eb||0x1f4;return function(_0x562ba1){logger[_0x08b0('0x26')](_0x562ba1['stack']);if(_0x562ba1['name']){delete _0x562ba1[_0x08b0('0x27')];}_0x3a6a22['status'](_0x18b5eb)[_0x08b0('0x28')](_0x562ba1);};}exports[_0x08b0('0x29')]=function(_0x3d82a6,_0x3db269){var _0x2e9b96={},_0x5b7330={},_0x285fb5={'count':0x0,'rows':[]};var _0x283314=_[_0x08b0('0x2a')](db[_0x08b0('0x2b')][_0x08b0('0x2c')],function(_0x5de497){return{'name':_0x5de497[_0x08b0('0x2d')],'type':_0x5de497[_0x08b0('0x2e')][_0x08b0('0x2f')]};});_0x5b7330[_0x08b0('0x30')]=_[_0x08b0('0x2a')](_0x283314,'name');_0x5b7330[_0x08b0('0x31')]=_[_0x08b0('0x32')](_0x3d82a6[_0x08b0('0x31')]);_0x5b7330[_0x08b0('0x33')]=_['intersection'](_0x5b7330[_0x08b0('0x30')],_0x5b7330[_0x08b0('0x31')]);_0x2e9b96[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x5b7330[_0x08b0('0x30')],qs['fields'](_0x3d82a6[_0x08b0('0x31')][_0x08b0('0x36')]));_0x2e9b96['attributes']=_0x2e9b96['attributes'][_0x08b0('0x37')]?_0x2e9b96[_0x08b0('0x34')]:_0x5b7330[_0x08b0('0x30')];if(!_0x3d82a6[_0x08b0('0x31')]['hasOwnProperty'](_0x08b0('0x38'))){_0x2e9b96[_0x08b0('0x1f')]=qs[_0x08b0('0x1f')](_0x3d82a6[_0x08b0('0x31')][_0x08b0('0x1f')]);_0x2e9b96[_0x08b0('0x1c')]=qs['offset'](_0x3d82a6[_0x08b0('0x31')][_0x08b0('0x1c')]);}_0x2e9b96['order']=qs['sort'](_0x3d82a6[_0x08b0('0x31')]['sort']);_0x2e9b96[_0x08b0('0x39')]=qs['filters'](_[_0x08b0('0x3a')](_0x3d82a6[_0x08b0('0x31')],_0x5b7330[_0x08b0('0x33')]),_0x283314);if(_0x3d82a6['query'][_0x08b0('0x3b')]){_0x2e9b96[_0x08b0('0x39')]=_[_0x08b0('0x3c')](_0x2e9b96[_0x08b0('0x39')],{'$or':_[_0x08b0('0x2a')](_0x283314,function(_0x28c46b){if(_0x28c46b[_0x08b0('0x2e')]!==_0x08b0('0x3d')){var _0xb98bac={};_0xb98bac[_0x28c46b['name']]={'$like':'%'+_0x3d82a6['query'][_0x08b0('0x3b')]+'%'};return _0xb98bac;}})});}_0x2e9b96=_['merge']({},_0x2e9b96,_0x3d82a6[_0x08b0('0x3e')]);var _0x36a15c={'where':_0x2e9b96['where']};return db['ServicenowConfiguration'][_0x08b0('0x1e')](_0x36a15c)['then'](function(_0xabd0c0){_0x285fb5[_0x08b0('0x1e')]=_0xabd0c0;if(_0x3d82a6[_0x08b0('0x31')][_0x08b0('0x3f')]){_0x2e9b96[_0x08b0('0x40')]=[{'all':!![]}];}return db[_0x08b0('0x2b')][_0x08b0('0x41')](_0x2e9b96);})[_0x08b0('0x24')](function(_0x46e7d9){_0x285fb5['rows']=_0x46e7d9;return _0x285fb5;})[_0x08b0('0x24')](respondWithFilteredResult(_0x3db269,_0x2e9b96))[_0x08b0('0x42')](handleError(_0x3db269,null));};exports[_0x08b0('0x43')]=function(_0x3d6cf4,_0xf56c1a){var _0x4e9dc3={'raw':![],'where':{'id':_0x3d6cf4[_0x08b0('0x44')]['id']}},_0x3d0bc7={};_0x3d0bc7[_0x08b0('0x30')]=_[_0x08b0('0x32')](db['ServicenowConfiguration'][_0x08b0('0x2c')]);_0x3d0bc7[_0x08b0('0x31')]=_[_0x08b0('0x32')](_0x3d6cf4[_0x08b0('0x31')]);_0x3d0bc7[_0x08b0('0x33')]=_['intersection'](_0x3d0bc7['model'],_0x3d0bc7['query']);_0x4e9dc3[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x3d0bc7[_0x08b0('0x30')],qs[_0x08b0('0x36')](_0x3d6cf4['query'][_0x08b0('0x36')]));_0x4e9dc3['attributes']=_0x4e9dc3['attributes'][_0x08b0('0x37')]?_0x4e9dc3[_0x08b0('0x34')]:_0x3d0bc7[_0x08b0('0x30')];if(_0x3d6cf4[_0x08b0('0x31')][_0x08b0('0x3f')]){_0x4e9dc3['include']=[{'all':!![]}];}_0x4e9dc3=_['merge']({},_0x4e9dc3,_0x3d6cf4[_0x08b0('0x3e')]);return db[_0x08b0('0x2b')]['find'](_0x4e9dc3)[_0x08b0('0x24')](handleEntityNotFound(_0xf56c1a,null))[_0x08b0('0x24')](respondWithResult(_0xf56c1a,null))[_0x08b0('0x42')](handleError(_0xf56c1a,null));};exports[_0x08b0('0x45')]=function(_0x1f45a0,_0x3233e9){return db[_0x08b0('0x2b')][_0x08b0('0x45')](_0x1f45a0['body'],{})[_0x08b0('0x24')](respondWithResult(_0x3233e9,0xc9))[_0x08b0('0x42')](handleError(_0x3233e9,null));};exports[_0x08b0('0x46')]=function(_0x486796,_0x297399){if(_0x486796[_0x08b0('0x47')]['id']){delete _0x486796[_0x08b0('0x47')]['id'];}return db['ServicenowConfiguration'][_0x08b0('0x48')]({'where':{'id':_0x486796[_0x08b0('0x44')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x297399,null))[_0x08b0('0x24')](saveUpdates(_0x486796[_0x08b0('0x47')],null))[_0x08b0('0x24')](respondWithResult(_0x297399,null))[_0x08b0('0x42')](handleError(_0x297399,null));};exports['destroy']=function(_0x3b3060,_0x2e86ec){return db[_0x08b0('0x2b')][_0x08b0('0x48')]({'where':{'id':_0x3b3060['params']['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x2e86ec,null))['then'](removeEntity(_0x2e86ec,null))[_0x08b0('0x42')](handleError(_0x2e86ec,null));};exports[_0x08b0('0x49')]=function(_0x46efc0,_0x5404a1,_0x3cffbb){var _0x456cf0={};var _0x4a9576={};var _0x30feea;var _0x559d77;return db[_0x08b0('0x2b')][_0x08b0('0x4a')]({'where':{'id':_0x46efc0[_0x08b0('0x44')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x5404a1,null))[_0x08b0('0x24')](function(_0x562c02){if(_0x562c02){_0x30feea=_0x562c02;_0x4a9576[_0x08b0('0x30')]=_['keys'](db[_0x08b0('0x4b')]['rawAttributes']);_0x4a9576[_0x08b0('0x31')]=_[_0x08b0('0x32')](_0x46efc0[_0x08b0('0x31')]);_0x4a9576[_0x08b0('0x33')]=_[_0x08b0('0x35')](_0x4a9576[_0x08b0('0x30')],_0x4a9576[_0x08b0('0x31')]);_0x456cf0[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x4a9576[_0x08b0('0x30')],qs[_0x08b0('0x36')](_0x46efc0[_0x08b0('0x31')][_0x08b0('0x36')]));_0x456cf0[_0x08b0('0x34')]=_0x456cf0['attributes']['length']?_0x456cf0[_0x08b0('0x34')]:_0x4a9576[_0x08b0('0x30')];_0x456cf0[_0x08b0('0x4c')]=qs['sort'](_0x46efc0[_0x08b0('0x31')]['sort']);_0x456cf0['where']=qs[_0x08b0('0x33')](_['pick'](_0x46efc0[_0x08b0('0x31')],_0x4a9576[_0x08b0('0x33')]));if(_0x46efc0['query'][_0x08b0('0x3b')]){_0x456cf0['where']=_['merge'](_0x456cf0[_0x08b0('0x39')],{'$or':_['map'](_0x456cf0['attributes'],function(_0x2ae1e9){var _0x5a8156={};_0x5a8156[_0x2ae1e9]={'$like':'%'+_0x46efc0['query']['filter']+'%'};return _0x5a8156;})});}_0x456cf0=_['merge']({},_0x456cf0,_0x46efc0[_0x08b0('0x3e')]);return _0x30feea[_0x08b0('0x49')](_0x456cf0);}})[_0x08b0('0x24')](function(_0x17362a){if(_0x17362a){_0x559d77=_0x17362a[_0x08b0('0x37')];if(!_0x46efc0[_0x08b0('0x31')]['hasOwnProperty'](_0x08b0('0x38'))){_0x456cf0[_0x08b0('0x1f')]=qs['limit'](_0x46efc0[_0x08b0('0x31')][_0x08b0('0x1f')]);_0x456cf0[_0x08b0('0x1c')]=qs[_0x08b0('0x1c')](_0x46efc0[_0x08b0('0x31')][_0x08b0('0x1c')]);}return _0x30feea[_0x08b0('0x49')](_0x456cf0);}})['then'](function(_0x3a719f){if(_0x3a719f){return _0x3a719f?{'count':_0x559d77,'rows':_0x3a719f}:null;}})[_0x08b0('0x24')](respondWithResult(_0x5404a1,null))[_0x08b0('0x42')](handleError(_0x5404a1,null));};exports[_0x08b0('0x4d')]=function(_0x5ced4f,_0x2f92c8,_0x21be0a){var _0x373a51={};var _0x1b8970={};var _0x207d2b;var _0x44520b;return db[_0x08b0('0x2b')][_0x08b0('0x4a')]({'where':{'id':_0x5ced4f[_0x08b0('0x44')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x2f92c8,null))[_0x08b0('0x24')](function(_0x152f32){if(_0x152f32){_0x207d2b=_0x152f32;_0x1b8970[_0x08b0('0x30')]=_[_0x08b0('0x32')](db['ServicenowField'][_0x08b0('0x2c')]);_0x1b8970[_0x08b0('0x31')]=_[_0x08b0('0x32')](_0x5ced4f[_0x08b0('0x31')]);_0x1b8970[_0x08b0('0x33')]=_[_0x08b0('0x35')](_0x1b8970['model'],_0x1b8970[_0x08b0('0x31')]);_0x373a51[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x1b8970['model'],qs[_0x08b0('0x36')](_0x5ced4f[_0x08b0('0x31')]['fields']));_0x373a51[_0x08b0('0x34')]=_0x373a51[_0x08b0('0x34')][_0x08b0('0x37')]?_0x373a51[_0x08b0('0x34')]:_0x1b8970[_0x08b0('0x30')];_0x373a51[_0x08b0('0x4c')]=qs['sort'](_0x5ced4f[_0x08b0('0x31')][_0x08b0('0x4e')]);_0x373a51['where']=qs[_0x08b0('0x33')](_[_0x08b0('0x3a')](_0x5ced4f['query'],_0x1b8970[_0x08b0('0x33')]));if(_0x5ced4f[_0x08b0('0x31')][_0x08b0('0x3b')]){_0x373a51[_0x08b0('0x39')]=_[_0x08b0('0x3c')](_0x373a51[_0x08b0('0x39')],{'$or':_[_0x08b0('0x2a')](_0x373a51[_0x08b0('0x34')],function(_0x5a60c7){var _0x39710c={};_0x39710c[_0x5a60c7]={'$like':'%'+_0x5ced4f[_0x08b0('0x31')][_0x08b0('0x3b')]+'%'};return _0x39710c;})});}_0x373a51=_['merge']({},_0x373a51,_0x5ced4f[_0x08b0('0x3e')]);return _0x207d2b['getSubjects'](_0x373a51);}})['then'](function(_0x3a03ad){if(_0x3a03ad){_0x44520b=_0x3a03ad['length'];if(!_0x5ced4f['query'][_0x08b0('0x4f')](_0x08b0('0x38'))){_0x373a51[_0x08b0('0x1f')]=qs['limit'](_0x5ced4f[_0x08b0('0x31')]['limit']);_0x373a51[_0x08b0('0x1c')]=qs[_0x08b0('0x1c')](_0x5ced4f['query'][_0x08b0('0x1c')]);}return _0x207d2b[_0x08b0('0x4d')](_0x373a51);}})[_0x08b0('0x24')](function(_0x17d59d){if(_0x17d59d){return _0x17d59d?{'count':_0x44520b,'rows':_0x17d59d}:null;}})[_0x08b0('0x24')](respondWithResult(_0x2f92c8,null))[_0x08b0('0x42')](handleError(_0x2f92c8,null));};exports['getDescriptions']=function(_0x1af4b9,_0x4cdae7,_0xde1f28){var _0x3c8aa4={};var _0x218986={};var _0x538b2d;var _0x24753d;return db[_0x08b0('0x2b')][_0x08b0('0x4a')]({'where':{'id':_0x1af4b9[_0x08b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cdae7,null))['then'](function(_0x2dc729){if(_0x2dc729){_0x538b2d=_0x2dc729;_0x218986['model']=_[_0x08b0('0x32')](db['ServicenowField'][_0x08b0('0x2c')]);_0x218986[_0x08b0('0x31')]=_['keys'](_0x1af4b9[_0x08b0('0x31')]);_0x218986[_0x08b0('0x33')]=_['intersection'](_0x218986[_0x08b0('0x30')],_0x218986[_0x08b0('0x31')]);_0x3c8aa4['attributes']=_[_0x08b0('0x35')](_0x218986[_0x08b0('0x30')],qs['fields'](_0x1af4b9['query'][_0x08b0('0x36')]));_0x3c8aa4[_0x08b0('0x34')]=_0x3c8aa4['attributes']['length']?_0x3c8aa4['attributes']:_0x218986['model'];_0x3c8aa4[_0x08b0('0x4c')]=qs[_0x08b0('0x4e')](_0x1af4b9[_0x08b0('0x31')][_0x08b0('0x4e')]);_0x3c8aa4[_0x08b0('0x39')]=qs[_0x08b0('0x33')](_[_0x08b0('0x3a')](_0x1af4b9[_0x08b0('0x31')],_0x218986[_0x08b0('0x33')]));if(_0x1af4b9[_0x08b0('0x31')][_0x08b0('0x3b')]){_0x3c8aa4['where']=_[_0x08b0('0x3c')](_0x3c8aa4[_0x08b0('0x39')],{'$or':_[_0x08b0('0x2a')](_0x3c8aa4[_0x08b0('0x34')],function(_0x3a1fca){var _0x3eb619={};_0x3eb619[_0x3a1fca]={'$like':'%'+_0x1af4b9[_0x08b0('0x31')][_0x08b0('0x3b')]+'%'};return _0x3eb619;})});}_0x3c8aa4=_[_0x08b0('0x3c')]({},_0x3c8aa4,_0x1af4b9[_0x08b0('0x3e')]);return _0x538b2d['getDescriptions'](_0x3c8aa4);}})['then'](function(_0x2162ad){if(_0x2162ad){_0x24753d=_0x2162ad['length'];if(!_0x1af4b9['query'][_0x08b0('0x4f')](_0x08b0('0x38'))){_0x3c8aa4[_0x08b0('0x1f')]=qs[_0x08b0('0x1f')](_0x1af4b9['query']['limit']);_0x3c8aa4[_0x08b0('0x1c')]=qs[_0x08b0('0x1c')](_0x1af4b9[_0x08b0('0x31')][_0x08b0('0x1c')]);}return _0x538b2d[_0x08b0('0x50')](_0x3c8aa4);}})['then'](function(_0x55544d){if(_0x55544d){return _0x55544d?{'count':_0x24753d,'rows':_0x55544d}:null;}})[_0x08b0('0x24')](respondWithResult(_0x4cdae7,null))[_0x08b0('0x42')](handleError(_0x4cdae7,null));}; \ No newline at end of file +var _0xc77c=['options','include','findAll','catch','rawAttributes','includeAll','create','body','params','find','getFields','findOne','ServicenowField','length','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','name','send','map','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x49d6e9,_0x2e0615){var _0x11a53b=function(_0x777676){while(--_0x777676){_0x49d6e9['push'](_0x49d6e9['shift']());}};_0x11a53b(++_0x2e0615);}(_0xc77c,0x135));var _0xcc77=function(_0x53be99,_0x5c9f20){_0x53be99=_0x53be99-0x0;var _0x68b4e2=_0xc77c[_0x53be99];return _0x68b4e2;};'use strict';var emlformat=require(_0xcc77('0x0'));var rimraf=require(_0xcc77('0x1'));var zipdir=require(_0xcc77('0x2'));var jsonpatch=require(_0xcc77('0x3'));var rp=require(_0xcc77('0x4'));var moment=require('moment');var BPromise=require(_0xcc77('0x5'));var Mustache=require(_0xcc77('0x6'));var util=require(_0xcc77('0x7'));var path=require('path');var sox=require(_0xcc77('0x8'));var csv=require(_0xcc77('0x9'));var ejs=require(_0xcc77('0xa'));var fs=require('fs');var fs_extra=require(_0xcc77('0xb'));var _=require('lodash');var squel=require(_0xcc77('0xc'));var crypto=require(_0xcc77('0xd'));var jsforce=require(_0xcc77('0xe'));var deskjs=require(_0xcc77('0xf'));var toCsv=require(_0xcc77('0x9'));var querystring=require(_0xcc77('0x10'));var Papa=require(_0xcc77('0x11'));var Redis=require(_0xcc77('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc77('0x13'))('api');var utils=require(_0xcc77('0x14'));var config=require(_0xcc77('0x15'));var licenseUtil=require(_0xcc77('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15aae6,_0x35d4d4){_0x35d4d4=_0x35d4d4||0xcc;return function(_0x1eb2b){if(_0x1eb2b){return _0x15aae6[_0xcc77('0x17')](_0x35d4d4);}return _0x15aae6[_0xcc77('0x18')](_0x35d4d4)[_0xcc77('0x19')]();};}function respondWithResult(_0x3cb7a5,_0x36c7f7){_0x36c7f7=_0x36c7f7||0xc8;return function(_0x285f75){if(_0x285f75){return _0x3cb7a5['status'](_0x36c7f7)[_0xcc77('0x1a')](_0x285f75);}};}function respondWithFilteredResult(_0x553e1c,_0x3e3e24){return function(_0x349451){if(_0x349451){var _0x5c64cc=typeof _0x3e3e24[_0xcc77('0x1b')]===_0xcc77('0x1c')&&typeof _0x3e3e24['limit']===_0xcc77('0x1c');var _0x2202af=_0x349451[_0xcc77('0x1d')];var _0x47f2d4=_0x5c64cc?0x0:_0x3e3e24['offset'];var _0x3df31d=_0x5c64cc?_0x349451[_0xcc77('0x1d')]:_0x3e3e24[_0xcc77('0x1b')]+_0x3e3e24[_0xcc77('0x1e')];var _0x364867;if(_0x3df31d>=_0x2202af){_0x3df31d=_0x2202af;_0x364867=0xc8;}else{_0x364867=0xce;}_0x553e1c['status'](_0x364867);return _0x553e1c['set'](_0xcc77('0x1f'),_0x47f2d4+'-'+_0x3df31d+'/'+_0x2202af)[_0xcc77('0x1a')](_0x349451);}return null;};}function patchUpdates(_0x695503){return function(_0x461939){try{jsonpatch['apply'](_0x461939,_0x695503,!![]);}catch(_0x3233d4){return BPromise[_0xcc77('0x20')](_0x3233d4);}return _0x461939[_0xcc77('0x21')]();};}function saveUpdates(_0x3785c2,_0x59591d){return function(_0x367bde){if(_0x367bde){return _0x367bde['update'](_0x3785c2)[_0xcc77('0x22')](function(_0xcb5091){return _0xcb5091;});}return null;};}function removeEntity(_0x13b627,_0x140fc6){return function(_0x8811be){if(_0x8811be){return _0x8811be[_0xcc77('0x23')]()[_0xcc77('0x22')](function(){_0x13b627[_0xcc77('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9312,_0x7aae5d){return function(_0x293385){if(!_0x293385){_0x2e9312[_0xcc77('0x17')](0x194);}return _0x293385;};}function handleError(_0x428877,_0x53fe47){_0x53fe47=_0x53fe47||0x1f4;return function(_0xc1777b){logger['error'](_0xc1777b['stack']);if(_0xc1777b[_0xcc77('0x24')]){delete _0xc1777b[_0xcc77('0x24')];}_0x428877[_0xcc77('0x18')](_0x53fe47)[_0xcc77('0x25')](_0xc1777b);};}exports['index']=function(_0x352523,_0x1a54ab){var _0x10077a={},_0x2d9151={},_0x381416={'count':0x0,'rows':[]};var _0x4acc73=_[_0xcc77('0x26')](db[_0xcc77('0x27')]['rawAttributes'],function(_0x234fbe){return{'name':_0x234fbe[_0xcc77('0x28')],'type':_0x234fbe[_0xcc77('0x29')]['key']};});_0x2d9151[_0xcc77('0x2a')]=_[_0xcc77('0x26')](_0x4acc73,_0xcc77('0x24'));_0x2d9151[_0xcc77('0x2b')]=_[_0xcc77('0x2c')](_0x352523[_0xcc77('0x2b')]);_0x2d9151[_0xcc77('0x2d')]=_[_0xcc77('0x2e')](_0x2d9151[_0xcc77('0x2a')],_0x2d9151[_0xcc77('0x2b')]);_0x10077a[_0xcc77('0x2f')]=_['intersection'](_0x2d9151['model'],qs[_0xcc77('0x30')](_0x352523[_0xcc77('0x2b')][_0xcc77('0x30')]));_0x10077a[_0xcc77('0x2f')]=_0x10077a[_0xcc77('0x2f')]['length']?_0x10077a['attributes']:_0x2d9151['model'];if(!_0x352523['query'][_0xcc77('0x31')](_0xcc77('0x32'))){_0x10077a[_0xcc77('0x1e')]=qs['limit'](_0x352523['query'][_0xcc77('0x1e')]);_0x10077a[_0xcc77('0x1b')]=qs[_0xcc77('0x1b')](_0x352523[_0xcc77('0x2b')][_0xcc77('0x1b')]);}_0x10077a[_0xcc77('0x33')]=qs[_0xcc77('0x34')](_0x352523[_0xcc77('0x2b')]['sort']);_0x10077a[_0xcc77('0x35')]=qs[_0xcc77('0x2d')](_['pick'](_0x352523[_0xcc77('0x2b')],_0x2d9151[_0xcc77('0x2d')]),_0x4acc73);if(_0x352523[_0xcc77('0x2b')][_0xcc77('0x36')]){_0x10077a[_0xcc77('0x35')]=_[_0xcc77('0x37')](_0x10077a[_0xcc77('0x35')],{'$or':_[_0xcc77('0x26')](_0x4acc73,function(_0x32c39c){if(_0x32c39c['type']!=='VIRTUAL'){var _0x323f8e={};_0x323f8e[_0x32c39c[_0xcc77('0x24')]]={'$like':'%'+_0x352523['query'][_0xcc77('0x36')]+'%'};return _0x323f8e;}})});}_0x10077a=_['merge']({},_0x10077a,_0x352523[_0xcc77('0x38')]);var _0x47924f={'where':_0x10077a[_0xcc77('0x35')]};return db['ServicenowConfiguration'][_0xcc77('0x1d')](_0x47924f)[_0xcc77('0x22')](function(_0x1d363b){_0x381416[_0xcc77('0x1d')]=_0x1d363b;if(_0x352523[_0xcc77('0x2b')]['includeAll']){_0x10077a[_0xcc77('0x39')]=[{'all':!![]}];}return db[_0xcc77('0x27')][_0xcc77('0x3a')](_0x10077a);})['then'](function(_0x3a775a){_0x381416['rows']=_0x3a775a;return _0x381416;})[_0xcc77('0x22')](respondWithFilteredResult(_0x1a54ab,_0x10077a))[_0xcc77('0x3b')](handleError(_0x1a54ab,null));};exports['show']=function(_0x1050f1,_0x499afd){var _0x50979f={'raw':![],'where':{'id':_0x1050f1['params']['id']}},_0x21c900={};_0x21c900[_0xcc77('0x2a')]=_['keys'](db[_0xcc77('0x27')][_0xcc77('0x3c')]);_0x21c900[_0xcc77('0x2b')]=_[_0xcc77('0x2c')](_0x1050f1[_0xcc77('0x2b')]);_0x21c900[_0xcc77('0x2d')]=_[_0xcc77('0x2e')](_0x21c900[_0xcc77('0x2a')],_0x21c900[_0xcc77('0x2b')]);_0x50979f[_0xcc77('0x2f')]=_[_0xcc77('0x2e')](_0x21c900[_0xcc77('0x2a')],qs[_0xcc77('0x30')](_0x1050f1[_0xcc77('0x2b')][_0xcc77('0x30')]));_0x50979f[_0xcc77('0x2f')]=_0x50979f[_0xcc77('0x2f')]['length']?_0x50979f[_0xcc77('0x2f')]:_0x21c900['model'];if(_0x1050f1[_0xcc77('0x2b')][_0xcc77('0x3d')]){_0x50979f[_0xcc77('0x39')]=[{'all':!![]}];}_0x50979f=_['merge']({},_0x50979f,_0x1050f1[_0xcc77('0x38')]);return db[_0xcc77('0x27')]['find'](_0x50979f)['then'](handleEntityNotFound(_0x499afd,null))['then'](respondWithResult(_0x499afd,null))['catch'](handleError(_0x499afd,null));};exports[_0xcc77('0x3e')]=function(_0x50b340,_0x44fd2c){return db[_0xcc77('0x27')]['create'](_0x50b340[_0xcc77('0x3f')],{})[_0xcc77('0x22')](respondWithResult(_0x44fd2c,0xc9))[_0xcc77('0x3b')](handleError(_0x44fd2c,null));};exports['update']=function(_0x379522,_0x130dd9){if(_0x379522[_0xcc77('0x3f')]['id']){delete _0x379522[_0xcc77('0x3f')]['id'];}return db[_0xcc77('0x27')]['find']({'where':{'id':_0x379522[_0xcc77('0x40')]['id']}})['then'](handleEntityNotFound(_0x130dd9,null))['then'](saveUpdates(_0x379522[_0xcc77('0x3f')],null))['then'](respondWithResult(_0x130dd9,null))[_0xcc77('0x3b')](handleError(_0x130dd9,null));};exports[_0xcc77('0x23')]=function(_0x1a5cca,_0x284ad6){return db['ServicenowConfiguration'][_0xcc77('0x41')]({'where':{'id':_0x1a5cca[_0xcc77('0x40')]['id']}})[_0xcc77('0x22')](handleEntityNotFound(_0x284ad6,null))[_0xcc77('0x22')](removeEntity(_0x284ad6,null))[_0xcc77('0x3b')](handleError(_0x284ad6,null));};exports[_0xcc77('0x42')]=function(_0x17d573,_0x3ee6ac,_0xd8139c){var _0x25a257={};var _0x551726={};var _0x51e552;var _0x1db0ee;return db[_0xcc77('0x27')][_0xcc77('0x43')]({'where':{'id':_0x17d573[_0xcc77('0x40')]['id']}})['then'](handleEntityNotFound(_0x3ee6ac,null))['then'](function(_0x21d25d){if(_0x21d25d){_0x51e552=_0x21d25d;_0x551726[_0xcc77('0x2a')]=_[_0xcc77('0x2c')](db[_0xcc77('0x44')]['rawAttributes']);_0x551726[_0xcc77('0x2b')]=_[_0xcc77('0x2c')](_0x17d573[_0xcc77('0x2b')]);_0x551726['filters']=_[_0xcc77('0x2e')](_0x551726[_0xcc77('0x2a')],_0x551726[_0xcc77('0x2b')]);_0x25a257['attributes']=_[_0xcc77('0x2e')](_0x551726[_0xcc77('0x2a')],qs[_0xcc77('0x30')](_0x17d573[_0xcc77('0x2b')][_0xcc77('0x30')]));_0x25a257[_0xcc77('0x2f')]=_0x25a257[_0xcc77('0x2f')][_0xcc77('0x45')]?_0x25a257[_0xcc77('0x2f')]:_0x551726[_0xcc77('0x2a')];_0x25a257[_0xcc77('0x33')]=qs[_0xcc77('0x34')](_0x17d573[_0xcc77('0x2b')][_0xcc77('0x34')]);_0x25a257[_0xcc77('0x35')]=qs[_0xcc77('0x2d')](_[_0xcc77('0x46')](_0x17d573[_0xcc77('0x2b')],_0x551726[_0xcc77('0x2d')]));if(_0x17d573['query'][_0xcc77('0x36')]){_0x25a257[_0xcc77('0x35')]=_[_0xcc77('0x37')](_0x25a257['where'],{'$or':_[_0xcc77('0x26')](_0x25a257[_0xcc77('0x2f')],function(_0x30b37d){var _0x4b755a={};_0x4b755a[_0x30b37d]={'$like':'%'+_0x17d573[_0xcc77('0x2b')][_0xcc77('0x36')]+'%'};return _0x4b755a;})});}_0x25a257=_[_0xcc77('0x37')]({},_0x25a257,_0x17d573[_0xcc77('0x38')]);return _0x51e552[_0xcc77('0x42')](_0x25a257);}})['then'](function(_0x2c2f9e){if(_0x2c2f9e){_0x1db0ee=_0x2c2f9e[_0xcc77('0x45')];if(!_0x17d573[_0xcc77('0x2b')][_0xcc77('0x31')](_0xcc77('0x32'))){_0x25a257[_0xcc77('0x1e')]=qs['limit'](_0x17d573[_0xcc77('0x2b')][_0xcc77('0x1e')]);_0x25a257[_0xcc77('0x1b')]=qs['offset'](_0x17d573[_0xcc77('0x2b')][_0xcc77('0x1b')]);}return _0x51e552['getFields'](_0x25a257);}})['then'](function(_0x94b821){if(_0x94b821){return _0x94b821?{'count':_0x1db0ee,'rows':_0x94b821}:null;}})[_0xcc77('0x22')](respondWithResult(_0x3ee6ac,null))['catch'](handleError(_0x3ee6ac,null));};exports[_0xcc77('0x47')]=function(_0x5e632d,_0x398dd4,_0x1aee83){var _0x4ae1f6={};var _0x5817d7={};var _0x6321d5;var _0x1a9cde;return db[_0xcc77('0x27')][_0xcc77('0x43')]({'where':{'id':_0x5e632d['params']['id']}})['then'](handleEntityNotFound(_0x398dd4,null))['then'](function(_0x278f73){if(_0x278f73){_0x6321d5=_0x278f73;_0x5817d7['model']=_['keys'](db[_0xcc77('0x44')][_0xcc77('0x3c')]);_0x5817d7[_0xcc77('0x2b')]=_[_0xcc77('0x2c')](_0x5e632d[_0xcc77('0x2b')]);_0x5817d7['filters']=_['intersection'](_0x5817d7['model'],_0x5817d7['query']);_0x4ae1f6[_0xcc77('0x2f')]=_['intersection'](_0x5817d7['model'],qs[_0xcc77('0x30')](_0x5e632d[_0xcc77('0x2b')][_0xcc77('0x30')]));_0x4ae1f6['attributes']=_0x4ae1f6[_0xcc77('0x2f')][_0xcc77('0x45')]?_0x4ae1f6['attributes']:_0x5817d7[_0xcc77('0x2a')];_0x4ae1f6['order']=qs[_0xcc77('0x34')](_0x5e632d['query'][_0xcc77('0x34')]);_0x4ae1f6[_0xcc77('0x35')]=qs[_0xcc77('0x2d')](_[_0xcc77('0x46')](_0x5e632d[_0xcc77('0x2b')],_0x5817d7[_0xcc77('0x2d')]));if(_0x5e632d[_0xcc77('0x2b')][_0xcc77('0x36')]){_0x4ae1f6['where']=_['merge'](_0x4ae1f6[_0xcc77('0x35')],{'$or':_[_0xcc77('0x26')](_0x4ae1f6[_0xcc77('0x2f')],function(_0x35d8d0){var _0x4a3684={};_0x4a3684[_0x35d8d0]={'$like':'%'+_0x5e632d['query'][_0xcc77('0x36')]+'%'};return _0x4a3684;})});}_0x4ae1f6=_[_0xcc77('0x37')]({},_0x4ae1f6,_0x5e632d[_0xcc77('0x38')]);return _0x6321d5['getSubjects'](_0x4ae1f6);}})[_0xcc77('0x22')](function(_0x17fdc4){if(_0x17fdc4){_0x1a9cde=_0x17fdc4[_0xcc77('0x45')];if(!_0x5e632d['query']['hasOwnProperty']('nolimit')){_0x4ae1f6[_0xcc77('0x1e')]=qs['limit'](_0x5e632d[_0xcc77('0x2b')]['limit']);_0x4ae1f6[_0xcc77('0x1b')]=qs[_0xcc77('0x1b')](_0x5e632d[_0xcc77('0x2b')][_0xcc77('0x1b')]);}return _0x6321d5['getSubjects'](_0x4ae1f6);}})[_0xcc77('0x22')](function(_0x366c3f){if(_0x366c3f){return _0x366c3f?{'count':_0x1a9cde,'rows':_0x366c3f}:null;}})[_0xcc77('0x22')](respondWithResult(_0x398dd4,null))['catch'](handleError(_0x398dd4,null));};exports['getDescriptions']=function(_0x30895f,_0x5c83e0,_0x10992b){var _0x1060fe={};var _0x231661={};var _0x956511;var _0x20e0e5;return db['ServicenowConfiguration'][_0xcc77('0x43')]({'where':{'id':_0x30895f[_0xcc77('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c83e0,null))['then'](function(_0x169695){if(_0x169695){_0x956511=_0x169695;_0x231661[_0xcc77('0x2a')]=_['keys'](db[_0xcc77('0x44')]['rawAttributes']);_0x231661[_0xcc77('0x2b')]=_[_0xcc77('0x2c')](_0x30895f[_0xcc77('0x2b')]);_0x231661[_0xcc77('0x2d')]=_['intersection'](_0x231661[_0xcc77('0x2a')],_0x231661[_0xcc77('0x2b')]);_0x1060fe[_0xcc77('0x2f')]=_[_0xcc77('0x2e')](_0x231661[_0xcc77('0x2a')],qs[_0xcc77('0x30')](_0x30895f[_0xcc77('0x2b')][_0xcc77('0x30')]));_0x1060fe[_0xcc77('0x2f')]=_0x1060fe[_0xcc77('0x2f')]['length']?_0x1060fe['attributes']:_0x231661[_0xcc77('0x2a')];_0x1060fe['order']=qs[_0xcc77('0x34')](_0x30895f['query'][_0xcc77('0x34')]);_0x1060fe['where']=qs[_0xcc77('0x2d')](_[_0xcc77('0x46')](_0x30895f[_0xcc77('0x2b')],_0x231661[_0xcc77('0x2d')]));if(_0x30895f[_0xcc77('0x2b')]['filter']){_0x1060fe[_0xcc77('0x35')]=_[_0xcc77('0x37')](_0x1060fe[_0xcc77('0x35')],{'$or':_['map'](_0x1060fe['attributes'],function(_0x264022){var _0x44c87c={};_0x44c87c[_0x264022]={'$like':'%'+_0x30895f[_0xcc77('0x2b')]['filter']+'%'};return _0x44c87c;})});}_0x1060fe=_[_0xcc77('0x37')]({},_0x1060fe,_0x30895f['options']);return _0x956511[_0xcc77('0x48')](_0x1060fe);}})[_0xcc77('0x22')](function(_0x541e18){if(_0x541e18){_0x20e0e5=_0x541e18['length'];if(!_0x30895f['query'][_0xcc77('0x31')](_0xcc77('0x32'))){_0x1060fe[_0xcc77('0x1e')]=qs['limit'](_0x30895f[_0xcc77('0x2b')][_0xcc77('0x1e')]);_0x1060fe[_0xcc77('0x1b')]=qs[_0xcc77('0x1b')](_0x30895f[_0xcc77('0x2b')][_0xcc77('0x1b')]);}return _0x956511[_0xcc77('0x48')](_0x1060fe);}})[_0xcc77('0x22')](function(_0x41abbf){if(_0x41abbf){return _0x41abbf?{'count':_0x20e0e5,'rows':_0x41abbf}:null;}})[_0xcc77('0x22')](respondWithResult(_0x5c83e0,null))[_0xcc77('0x3b')](handleError(_0x5c83e0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4143ccd..2d3cc7d 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 _0x5706=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','moment'];(function(_0x3206ab,_0x22cbbd){var _0x1717c3=function(_0x516268){while(--_0x516268){_0x3206ab['push'](_0x3206ab['shift']());}};_0x1717c3(++_0x22cbbd);}(_0x5706,0xb0));var _0x6570=function(_0x5ad2ef,_0x540077){_0x5ad2ef=_0x5ad2ef-0x0;var _0x1d93de=_0x5706[_0x5ad2ef];return _0x1d93de;};'use strict';var _=require(_0x6570('0x0'));var util=require(_0x6570('0x1'));var logger=require(_0x6570('0x2'))('api');var moment=require(_0x6570('0x3'));var BPromise=require('bluebird');var rp=require(_0x6570('0x4'));var fs=require('fs');var path=require(_0x6570('0x5'));var rimraf=require(_0x6570('0x6'));var config=require(_0x6570('0x7'));var attributes=require(_0x6570('0x8'));module[_0x6570('0x9')]=function(_0x3ae2f1,_0x3eb22a){return _0x3ae2f1[_0x6570('0xa')](_0x6570('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f42=['api','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x259f9d,_0x1a4c7d){var _0x592832=function(_0x49ca66){while(--_0x49ca66){_0x259f9d['push'](_0x259f9d['shift']());}};_0x592832(++_0x1a4c7d);}(_0x0f42,0x126));var _0x20f4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f42[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var logger=require(_0x20f4('0x2'))(_0x20f4('0x3'));var moment=require('moment');var BPromise=require(_0x20f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f4('0x5'));var rimraf=require('rimraf');var config=require(_0x20f4('0x6'));var attributes=require(_0x20f4('0x7'));module[_0x20f4('0x8')]=function(_0x4c3214,_0x435359){return _0x4c3214[_0x20f4('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x20f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 7948b9c..d667370 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 _0xad1c=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad1c,0x1c8));var _0xcad1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xad1c[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xcad1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcad1('0x1'));var fs=require('fs');var Redis=require(_0xcad1('0x2'));var db=require(_0xcad1('0x3'))['db'];var utils=require(_0xcad1('0x4'));var logger=require(_0xcad1('0x5'))(_0xcad1('0x6'));var config=require('../../config/environment');var jayson=require(_0xcad1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57dafe,_0x192649,_0x5d78d3){return new BPromise(function(_0x1ef1e3,_0x1ea1d8){return client['request'](_0x57dafe,_0x5d78d3)[_0xcad1('0x8')](function(_0x54132d){logger[_0xcad1('0x9')](_0xcad1('0xa'),_0x192649,_0xcad1('0xb'));logger[_0xcad1('0xc')](_0xcad1('0xd'),_0x192649,_0xcad1('0xb'),JSON['stringify'](_0x54132d));if(_0x54132d[_0xcad1('0xe')]){if(_0x54132d['error']['code']===0x1f4){logger['error'](_0xcad1('0xa'),_0x192649,_0x54132d['error'][_0xcad1('0xf')]);return _0x1ea1d8(_0x54132d['error'][_0xcad1('0xf')]);}logger[_0xcad1('0xe')](_0xcad1('0xa'),_0x192649,_0x54132d['error'][_0xcad1('0xf')]);return _0x1ef1e3(_0x54132d['error']['message']);}else{logger[_0xcad1('0x9')](_0xcad1('0xa'),_0x192649,_0xcad1('0xb'));_0x1ef1e3(_0x54132d[_0xcad1('0x10')]['message']);}})[_0xcad1('0x11')](function(_0x1c9ceb){logger[_0xcad1('0xe')](_0xcad1('0xa'),_0x192649,_0x1c9ceb);_0x1ea1d8(_0x1c9ceb);});});} \ No newline at end of file +var _0x2a2b=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x2a2b,0x1de));var _0xb2a2=function(_0x323021,_0x30f030){_0x323021=_0x323021-0x0;var _0x52cb3e=_0x2a2b[_0x323021];return _0x52cb3e;};'use strict';var _=require(_0xb2a2('0x0'));var util=require(_0xb2a2('0x1'));var moment=require('moment');var BPromise=require(_0xb2a2('0x2'));var rs=require(_0xb2a2('0x3'));var fs=require('fs');var Redis=require(_0xb2a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb2a2('0x5'));var config=require(_0xb2a2('0x6'));var jayson=require(_0xb2a2('0x7'));var client=jayson[_0xb2a2('0x8')][_0xb2a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x447777,_0x2d0168,_0x4e3ec6){return new BPromise(function(_0x10ca5e,_0x559a86){return client[_0xb2a2('0xa')](_0x447777,_0x4e3ec6)[_0xb2a2('0xb')](function(_0x22bd5b){logger[_0xb2a2('0xc')](_0xb2a2('0xd'),_0x2d0168,_0xb2a2('0xe'));logger[_0xb2a2('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2d0168,_0xb2a2('0xe'),JSON[_0xb2a2('0x10')](_0x22bd5b));if(_0x22bd5b[_0xb2a2('0x11')]){if(_0x22bd5b['error'][_0xb2a2('0x12')]===0x1f4){logger[_0xb2a2('0x11')](_0xb2a2('0xd'),_0x2d0168,_0x22bd5b['error']['message']);return _0x559a86(_0x22bd5b[_0xb2a2('0x11')][_0xb2a2('0x13')]);}logger[_0xb2a2('0x11')](_0xb2a2('0xd'),_0x2d0168,_0x22bd5b[_0xb2a2('0x11')][_0xb2a2('0x13')]);return _0x10ca5e(_0x22bd5b[_0xb2a2('0x11')][_0xb2a2('0x13')]);}else{logger['info'](_0xb2a2('0xd'),_0x2d0168,_0xb2a2('0xe'));_0x10ca5e(_0x22bd5b[_0xb2a2('0x14')][_0xb2a2('0x13')]);}})[_0xb2a2('0x15')](function(_0x123d28){logger[_0xb2a2('0x11')](_0xb2a2('0xd'),_0x2d0168,_0x123d28);_0x559a86(_0x123d28);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index cae9aee..117364d 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 _0x6ac2=['../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra'];(function(_0x23831c,_0x25da03){var _0x23a5fe=function(_0x438308){while(--_0x438308){_0x23831c['push'](_0x23831c['shift']());}};_0x23a5fe(++_0x25da03);}(_0x6ac2,0x13f));var _0x26ac=function(_0x4bbe6e,_0x1321ac){_0x4bbe6e=_0x4bbe6e-0x0;var _0xa7e0cd=_0x6ac2[_0x4bbe6e];return _0xa7e0cd;};'use strict';var multer=require(_0x26ac('0x0'));var util=require(_0x26ac('0x1'));var path=require(_0x26ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x26ac('0x3'));var router=express['Router']();var fs_extra=require(_0x26ac('0x4'));var auth=require(_0x26ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x26ac('0x6'));var controller=require(_0x26ac('0x7'));router[_0x26ac('0x8')]('/',auth[_0x26ac('0x9')](),controller[_0x26ac('0xa')]);router[_0x26ac('0x8')](_0x26ac('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x26ac('0xc')]('/',auth[_0x26ac('0x9')](),controller[_0x26ac('0xd')]);router[_0x26ac('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x26ac('0xf')]);router[_0x26ac('0x10')](_0x26ac('0xb'),auth[_0x26ac('0x9')](),controller[_0x26ac('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe42b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','put','update','delete','exports'];(function(_0x5f34b6,_0x4fbc1c){var _0x4207cf=function(_0x2bb308){while(--_0x2bb308){_0x5f34b6['push'](_0x5f34b6['shift']());}};_0x4207cf(++_0x4fbc1c);}(_0xe42b,0x150));var _0xbe42=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0xe42b[_0xf6aec0];return _0x59a51b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe42('0x0')]();var fs_extra=require(_0xbe42('0x1'));var auth=require(_0xbe42('0x2'));var interaction=require(_0xbe42('0x3'));var config=require(_0xbe42('0x4'));var controller=require('./intServicenowField.controller');router[_0xbe42('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe42('0x6')]);router[_0xbe42('0x5')](_0xbe42('0x7'),auth[_0xbe42('0x8')](),controller[_0xbe42('0x9')]);router['post']('/',auth[_0xbe42('0x8')](),controller['create']);router[_0xbe42('0xa')](_0xbe42('0x7'),auth[_0xbe42('0x8')](),controller[_0xbe42('0xb')]);router[_0xbe42('0xc')](_0xbe42('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe42('0xd')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 18c18f3..671a434 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 _0xf88f=['picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x258df2,_0x4eddd1){var _0x2600ef=function(_0x4cf77f){while(--_0x4cf77f){_0x258df2['push'](_0x258df2['shift']());}};_0x2600ef(++_0x4eddd1);}(_0xf88f,0xe9));var _0xff88=function(_0x48ab3c,_0x117a08){_0x48ab3c=_0x48ab3c-0x0;var _0x383a40=_0xf88f[_0x48ab3c];return _0x383a40;};'use strict';var Sequelize=require(_0xff88('0x0'));module['exports']={'type':{'type':Sequelize[_0xff88('0x1')](_0xff88('0x2'),_0xff88('0x3'),_0xff88('0x4'),'keyValue',_0xff88('0x5')),'defaultValue':_0xff88('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff88('0x6')]},'keyType':{'type':Sequelize[_0xff88('0x1')]('string',_0xff88('0x3'),_0xff88('0x4'))},'keyContent':{'type':Sequelize[_0xff88('0x6')]},'idField':{'type':Sequelize[_0xff88('0x6')]},'nameField':{'type':Sequelize[_0xff88('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xff88('0x6')]}}; \ No newline at end of file +var _0x47f5=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x47f5,0x1b1));var _0x547f=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x47f5[_0x17406e];return _0x2bfc5a;};'use strict';var Sequelize=require(_0x547f('0x0'));module[_0x547f('0x1')]={'type':{'type':Sequelize[_0x547f('0x2')](_0x547f('0x3'),'variable',_0x547f('0x4'),_0x547f('0x5'),_0x547f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x547f('0x7')]},'key':{'type':Sequelize[_0x547f('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x547f('0x3'),_0x547f('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x547f('0x7')]},'idField':{'type':Sequelize[_0x547f('0x7')]},'nameField':{'type':Sequelize[_0x547f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2e37f38..01bd9f0 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 _0x9a8a=['count','offset','limit','apply','reject','save','update','then','error','stack','name','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','ServicenowField','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','destroy','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined'];(function(_0x198c38,_0x54d00a){var _0x2886ba=function(_0x1a9e88){while(--_0x1a9e88){_0x198c38['push'](_0x198c38['shift']());}};_0x2886ba(++_0x54d00a);}(_0x9a8a,0x17f));var _0xa9a8=function(_0x5eeb2e,_0x521326){_0x5eeb2e=_0x5eeb2e-0x0;var _0x5d9476=_0x9a8a[_0x5eeb2e];return _0x5d9476;};'use strict';var emlformat=require(_0xa9a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9a8('0x2'));var BPromise=require(_0xa9a8('0x3'));var Mustache=require('mustache');var util=require(_0xa9a8('0x4'));var path=require(_0xa9a8('0x5'));var sox=require(_0xa9a8('0x6'));var csv=require(_0xa9a8('0x7'));var ejs=require(_0xa9a8('0x8'));var fs=require('fs');var fs_extra=require(_0xa9a8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa9a8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa9a8('0xb'));var toCsv=require(_0xa9a8('0x7'));var querystring=require(_0xa9a8('0xc'));var Papa=require(_0xa9a8('0xd'));var Redis=require(_0xa9a8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9a8('0xf'));var logger=require(_0xa9a8('0x10'))(_0xa9a8('0x11'));var utils=require('../../config/utils');var config=require(_0xa9a8('0x12'));var licenseUtil=require(_0xa9a8('0x13'));var db=require(_0xa9a8('0x14'))['db'];function respondWithStatusCode(_0x793f36,_0x1dc26a){_0x1dc26a=_0x1dc26a||0xcc;return function(_0x461c3c){if(_0x461c3c){return _0x793f36[_0xa9a8('0x15')](_0x1dc26a);}return _0x793f36[_0xa9a8('0x16')](_0x1dc26a)['end']();};}function respondWithResult(_0x479576,_0x41630e){_0x41630e=_0x41630e||0xc8;return function(_0x5404ca){if(_0x5404ca){return _0x479576[_0xa9a8('0x16')](_0x41630e)[_0xa9a8('0x17')](_0x5404ca);}};}function respondWithFilteredResult(_0x37baf0,_0xe1671a){return function(_0x1710c3){if(_0x1710c3){var _0x28bfe7=typeof _0xe1671a['offset']===_0xa9a8('0x18')&&typeof _0xe1671a['limit']===_0xa9a8('0x18');var _0x3d3362=_0x1710c3['count'];var _0x2e75dd=_0x28bfe7?0x0:_0xe1671a['offset'];var _0x6333bf=_0x28bfe7?_0x1710c3[_0xa9a8('0x19')]:_0xe1671a[_0xa9a8('0x1a')]+_0xe1671a[_0xa9a8('0x1b')];var _0x3947a3;if(_0x6333bf>=_0x3d3362){_0x6333bf=_0x3d3362;_0x3947a3=0xc8;}else{_0x3947a3=0xce;}_0x37baf0[_0xa9a8('0x16')](_0x3947a3);return _0x37baf0['set']('Content-Range',_0x2e75dd+'-'+_0x6333bf+'/'+_0x3d3362)[_0xa9a8('0x17')](_0x1710c3);}return null;};}function patchUpdates(_0x5676d4){return function(_0x1a614d){try{jsonpatch[_0xa9a8('0x1c')](_0x1a614d,_0x5676d4,!![]);}catch(_0x1de5f5){return BPromise[_0xa9a8('0x1d')](_0x1de5f5);}return _0x1a614d[_0xa9a8('0x1e')]();};}function saveUpdates(_0x29f343,_0x1b3f8d){return function(_0x59d83e){if(_0x59d83e){return _0x59d83e[_0xa9a8('0x1f')](_0x29f343)['then'](function(_0x1abad8){return _0x1abad8;});}return null;};}function removeEntity(_0x4476ea,_0x2d21f4){return function(_0x37651b){if(_0x37651b){return _0x37651b['destroy']()[_0xa9a8('0x20')](function(){_0x4476ea[_0xa9a8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc055,_0x3023af){return function(_0x2855ef){if(!_0x2855ef){_0x4dc055['sendStatus'](0x194);}return _0x2855ef;};}function handleError(_0x11a33a,_0x2ed2d7){_0x2ed2d7=_0x2ed2d7||0x1f4;return function(_0x423b23){logger[_0xa9a8('0x21')](_0x423b23[_0xa9a8('0x22')]);if(_0x423b23[_0xa9a8('0x23')]){delete _0x423b23[_0xa9a8('0x23')];}_0x11a33a[_0xa9a8('0x16')](_0x2ed2d7)['send'](_0x423b23);};}exports['index']=function(_0x3f098a,_0x1a6031){var _0x4a930b={},_0x2db4ce={},_0x475697={'count':0x0,'rows':[]};var _0x1df994=_[_0xa9a8('0x24')](db['ServicenowField'][_0xa9a8('0x25')],function(_0xe744b6){return{'name':_0xe744b6[_0xa9a8('0x26')],'type':_0xe744b6[_0xa9a8('0x27')][_0xa9a8('0x28')]};});_0x2db4ce['model']=_[_0xa9a8('0x24')](_0x1df994,_0xa9a8('0x23'));_0x2db4ce['query']=_['keys'](_0x3f098a[_0xa9a8('0x29')]);_0x2db4ce['filters']=_[_0xa9a8('0x2a')](_0x2db4ce[_0xa9a8('0x2b')],_0x2db4ce[_0xa9a8('0x29')]);_0x4a930b[_0xa9a8('0x2c')]=_[_0xa9a8('0x2a')](_0x2db4ce[_0xa9a8('0x2b')],qs[_0xa9a8('0x2d')](_0x3f098a[_0xa9a8('0x29')][_0xa9a8('0x2d')]));_0x4a930b[_0xa9a8('0x2c')]=_0x4a930b[_0xa9a8('0x2c')][_0xa9a8('0x2e')]?_0x4a930b[_0xa9a8('0x2c')]:_0x2db4ce['model'];if(!_0x3f098a[_0xa9a8('0x29')][_0xa9a8('0x2f')](_0xa9a8('0x30'))){_0x4a930b[_0xa9a8('0x1b')]=qs[_0xa9a8('0x1b')](_0x3f098a[_0xa9a8('0x29')]['limit']);_0x4a930b[_0xa9a8('0x1a')]=qs[_0xa9a8('0x1a')](_0x3f098a[_0xa9a8('0x29')][_0xa9a8('0x1a')]);}_0x4a930b[_0xa9a8('0x31')]=qs[_0xa9a8('0x32')](_0x3f098a[_0xa9a8('0x29')]['sort']);_0x4a930b[_0xa9a8('0x33')]=qs[_0xa9a8('0x34')](_['pick'](_0x3f098a['query'],_0x2db4ce[_0xa9a8('0x34')]),_0x1df994);if(_0x3f098a[_0xa9a8('0x29')]['filter']){_0x4a930b[_0xa9a8('0x33')]=_['merge'](_0x4a930b['where'],{'$or':_[_0xa9a8('0x24')](_0x1df994,function(_0x24b8c6){if(_0x24b8c6[_0xa9a8('0x27')]!=='VIRTUAL'){var _0x42c757={};_0x42c757[_0x24b8c6[_0xa9a8('0x23')]]={'$like':'%'+_0x3f098a[_0xa9a8('0x29')][_0xa9a8('0x35')]+'%'};return _0x42c757;}})});}_0x4a930b=_['merge']({},_0x4a930b,_0x3f098a['options']);var _0x15efad={'where':_0x4a930b[_0xa9a8('0x33')]};return db[_0xa9a8('0x36')]['count'](_0x15efad)['then'](function(_0x523928){_0x475697[_0xa9a8('0x19')]=_0x523928;if(_0x3f098a[_0xa9a8('0x29')]['includeAll']){_0x4a930b['include']=[{'all':!![]}];}return db[_0xa9a8('0x36')][_0xa9a8('0x37')](_0x4a930b);})[_0xa9a8('0x20')](function(_0x5e9715){_0x475697[_0xa9a8('0x38')]=_0x5e9715;return _0x475697;})['then'](respondWithFilteredResult(_0x1a6031,_0x4a930b))['catch'](handleError(_0x1a6031,null));};exports[_0xa9a8('0x39')]=function(_0xe231ec,_0x1398e9){var _0x5821e4={'raw':!![],'where':{'id':_0xe231ec[_0xa9a8('0x3a')]['id']}},_0x98c687={};_0x98c687[_0xa9a8('0x2b')]=_[_0xa9a8('0x3b')](db[_0xa9a8('0x36')]['rawAttributes']);_0x98c687[_0xa9a8('0x29')]=_['keys'](_0xe231ec[_0xa9a8('0x29')]);_0x98c687[_0xa9a8('0x34')]=_['intersection'](_0x98c687['model'],_0x98c687[_0xa9a8('0x29')]);_0x5821e4[_0xa9a8('0x2c')]=_[_0xa9a8('0x2a')](_0x98c687['model'],qs['fields'](_0xe231ec[_0xa9a8('0x29')][_0xa9a8('0x2d')]));_0x5821e4[_0xa9a8('0x2c')]=_0x5821e4[_0xa9a8('0x2c')][_0xa9a8('0x2e')]?_0x5821e4[_0xa9a8('0x2c')]:_0x98c687[_0xa9a8('0x2b')];if(_0xe231ec[_0xa9a8('0x29')][_0xa9a8('0x3c')]){_0x5821e4[_0xa9a8('0x3d')]=[{'all':!![]}];}_0x5821e4=_['merge']({},_0x5821e4,_0xe231ec[_0xa9a8('0x3e')]);return db['ServicenowField'][_0xa9a8('0x3f')](_0x5821e4)[_0xa9a8('0x20')](handleEntityNotFound(_0x1398e9,null))[_0xa9a8('0x20')](respondWithResult(_0x1398e9,null))[_0xa9a8('0x40')](handleError(_0x1398e9,null));};exports['create']=function(_0x4aca7d,_0x51435c){return db[_0xa9a8('0x36')][_0xa9a8('0x41')](_0x4aca7d[_0xa9a8('0x42')],{})[_0xa9a8('0x20')](respondWithResult(_0x51435c,0xc9))['catch'](handleError(_0x51435c,null));};exports[_0xa9a8('0x1f')]=function(_0x3fb93a,_0x2ca671){if(_0x3fb93a[_0xa9a8('0x42')]['id']){delete _0x3fb93a[_0xa9a8('0x42')]['id'];}return db[_0xa9a8('0x36')]['find']({'where':{'id':_0x3fb93a['params']['id']}})[_0xa9a8('0x20')](handleEntityNotFound(_0x2ca671,null))['then'](saveUpdates(_0x3fb93a['body'],null))['then'](respondWithResult(_0x2ca671,null))[_0xa9a8('0x40')](handleError(_0x2ca671,null));};exports[_0xa9a8('0x43')]=function(_0x25d168,_0x7bafb2){return db[_0xa9a8('0x36')]['find']({'where':{'id':_0x25d168[_0xa9a8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x7bafb2,null))['then'](removeEntity(_0x7bafb2,null))[_0xa9a8('0x40')](handleError(_0x7bafb2,null));}; \ No newline at end of file +var _0x1e2b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ServicenowField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1e2b,0xd5));var _0xb1e2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1e2b[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xb1e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1e2('0x1'));var jsonpatch=require(_0xb1e2('0x2'));var rp=require(_0xb1e2('0x3'));var moment=require(_0xb1e2('0x4'));var BPromise=require(_0xb1e2('0x5'));var Mustache=require(_0xb1e2('0x6'));var util=require(_0xb1e2('0x7'));var path=require(_0xb1e2('0x8'));var sox=require(_0xb1e2('0x9'));var csv=require(_0xb1e2('0xa'));var ejs=require(_0xb1e2('0xb'));var fs=require('fs');var fs_extra=require(_0xb1e2('0xc'));var _=require(_0xb1e2('0xd'));var squel=require(_0xb1e2('0xe'));var crypto=require(_0xb1e2('0xf'));var jsforce=require(_0xb1e2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb1e2('0xa'));var querystring=require(_0xb1e2('0x11'));var Papa=require(_0xb1e2('0x12'));var Redis=require(_0xb1e2('0x13'));var authService=require(_0xb1e2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb1e2('0x15'));var hardwareService=require(_0xb1e2('0x16'));var logger=require(_0xb1e2('0x17'))(_0xb1e2('0x18'));var utils=require('../../config/utils');var config=require(_0xb1e2('0x19'));var licenseUtil=require(_0xb1e2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29730b,_0x29785d){_0x29785d=_0x29785d||0xcc;return function(_0x219fec){if(_0x219fec){return _0x29730b['sendStatus'](_0x29785d);}return _0x29730b[_0xb1e2('0x1b')](_0x29785d)[_0xb1e2('0x1c')]();};}function respondWithResult(_0x2eddd5,_0x31db0a){_0x31db0a=_0x31db0a||0xc8;return function(_0x37d4ed){if(_0x37d4ed){return _0x2eddd5[_0xb1e2('0x1b')](_0x31db0a)[_0xb1e2('0x1d')](_0x37d4ed);}};}function respondWithFilteredResult(_0x57ca11,_0x1e79c4){return function(_0x481b9c){if(_0x481b9c){var _0x3106be=typeof _0x1e79c4[_0xb1e2('0x1e')]==='undefined'&&typeof _0x1e79c4['limit']===_0xb1e2('0x1f');var _0x387a12=_0x481b9c['count'];var _0x5cf536=_0x3106be?0x0:_0x1e79c4[_0xb1e2('0x1e')];var _0x5bc3fa=_0x3106be?_0x481b9c[_0xb1e2('0x20')]:_0x1e79c4['offset']+_0x1e79c4[_0xb1e2('0x21')];var _0x28b49a;if(_0x5bc3fa>=_0x387a12){_0x5bc3fa=_0x387a12;_0x28b49a=0xc8;}else{_0x28b49a=0xce;}_0x57ca11[_0xb1e2('0x1b')](_0x28b49a);return _0x57ca11[_0xb1e2('0x22')](_0xb1e2('0x23'),_0x5cf536+'-'+_0x5bc3fa+'/'+_0x387a12)[_0xb1e2('0x1d')](_0x481b9c);}return null;};}function patchUpdates(_0x32fbd9){return function(_0x373f21){try{jsonpatch[_0xb1e2('0x24')](_0x373f21,_0x32fbd9,!![]);}catch(_0x44eea4){return BPromise[_0xb1e2('0x25')](_0x44eea4);}return _0x373f21[_0xb1e2('0x26')]();};}function saveUpdates(_0x511679,_0x3c364a){return function(_0x213b93){if(_0x213b93){return _0x213b93[_0xb1e2('0x27')](_0x511679)[_0xb1e2('0x28')](function(_0x158012){return _0x158012;});}return null;};}function removeEntity(_0x7b1278,_0x1adbcc){return function(_0x4eddce){if(_0x4eddce){return _0x4eddce[_0xb1e2('0x29')]()[_0xb1e2('0x28')](function(){_0x7b1278[_0xb1e2('0x1b')](0xcc)[_0xb1e2('0x1c')]();});}};}function handleEntityNotFound(_0x2b3485,_0x5f112e){return function(_0x2491e0){if(!_0x2491e0){_0x2b3485[_0xb1e2('0x2a')](0x194);}return _0x2491e0;};}function handleError(_0x4b8374,_0x2f8a0d){_0x2f8a0d=_0x2f8a0d||0x1f4;return function(_0x359e2f){logger[_0xb1e2('0x2b')](_0x359e2f[_0xb1e2('0x2c')]);if(_0x359e2f[_0xb1e2('0x2d')]){delete _0x359e2f[_0xb1e2('0x2d')];}_0x4b8374[_0xb1e2('0x1b')](_0x2f8a0d)[_0xb1e2('0x2e')](_0x359e2f);};}exports['index']=function(_0x138936,_0x26e7fc){var _0x428a46={},_0x4bf617={},_0x3079bb={'count':0x0,'rows':[]};var _0x12ec32=_[_0xb1e2('0x2f')](db[_0xb1e2('0x30')]['rawAttributes'],function(_0x2e2eac){return{'name':_0x2e2eac[_0xb1e2('0x31')],'type':_0x2e2eac[_0xb1e2('0x32')]['key']};});_0x4bf617[_0xb1e2('0x33')]=_[_0xb1e2('0x2f')](_0x12ec32,_0xb1e2('0x2d'));_0x4bf617[_0xb1e2('0x34')]=_[_0xb1e2('0x35')](_0x138936[_0xb1e2('0x34')]);_0x4bf617[_0xb1e2('0x36')]=_[_0xb1e2('0x37')](_0x4bf617[_0xb1e2('0x33')],_0x4bf617[_0xb1e2('0x34')]);_0x428a46[_0xb1e2('0x38')]=_[_0xb1e2('0x37')](_0x4bf617[_0xb1e2('0x33')],qs[_0xb1e2('0x39')](_0x138936['query'][_0xb1e2('0x39')]));_0x428a46['attributes']=_0x428a46['attributes'][_0xb1e2('0x3a')]?_0x428a46[_0xb1e2('0x38')]:_0x4bf617[_0xb1e2('0x33')];if(!_0x138936[_0xb1e2('0x34')][_0xb1e2('0x3b')](_0xb1e2('0x3c'))){_0x428a46['limit']=qs['limit'](_0x138936[_0xb1e2('0x34')][_0xb1e2('0x21')]);_0x428a46[_0xb1e2('0x1e')]=qs[_0xb1e2('0x1e')](_0x138936[_0xb1e2('0x34')][_0xb1e2('0x1e')]);}_0x428a46[_0xb1e2('0x3d')]=qs[_0xb1e2('0x3e')](_0x138936['query'][_0xb1e2('0x3e')]);_0x428a46['where']=qs['filters'](_[_0xb1e2('0x3f')](_0x138936[_0xb1e2('0x34')],_0x4bf617['filters']),_0x12ec32);if(_0x138936[_0xb1e2('0x34')]['filter']){_0x428a46['where']=_[_0xb1e2('0x40')](_0x428a46[_0xb1e2('0x41')],{'$or':_[_0xb1e2('0x2f')](_0x12ec32,function(_0x312469){if(_0x312469['type']!==_0xb1e2('0x42')){var _0x343674={};_0x343674[_0x312469[_0xb1e2('0x2d')]]={'$like':'%'+_0x138936[_0xb1e2('0x34')][_0xb1e2('0x43')]+'%'};return _0x343674;}})});}_0x428a46=_[_0xb1e2('0x40')]({},_0x428a46,_0x138936['options']);var _0x5010d9={'where':_0x428a46['where']};return db[_0xb1e2('0x30')]['count'](_0x5010d9)[_0xb1e2('0x28')](function(_0x114baa){_0x3079bb[_0xb1e2('0x20')]=_0x114baa;if(_0x138936[_0xb1e2('0x34')][_0xb1e2('0x44')]){_0x428a46[_0xb1e2('0x45')]=[{'all':!![]}];}return db[_0xb1e2('0x30')][_0xb1e2('0x46')](_0x428a46);})[_0xb1e2('0x28')](function(_0x325998){_0x3079bb[_0xb1e2('0x47')]=_0x325998;return _0x3079bb;})[_0xb1e2('0x28')](respondWithFilteredResult(_0x26e7fc,_0x428a46))[_0xb1e2('0x48')](handleError(_0x26e7fc,null));};exports[_0xb1e2('0x49')]=function(_0x2d1f78,_0x2ba8b5){var _0x2fb974={'raw':!![],'where':{'id':_0x2d1f78['params']['id']}},_0x98ec2={};_0x98ec2[_0xb1e2('0x33')]=_['keys'](db[_0xb1e2('0x30')]['rawAttributes']);_0x98ec2[_0xb1e2('0x34')]=_['keys'](_0x2d1f78['query']);_0x98ec2[_0xb1e2('0x36')]=_[_0xb1e2('0x37')](_0x98ec2[_0xb1e2('0x33')],_0x98ec2[_0xb1e2('0x34')]);_0x2fb974[_0xb1e2('0x38')]=_[_0xb1e2('0x37')](_0x98ec2['model'],qs[_0xb1e2('0x39')](_0x2d1f78[_0xb1e2('0x34')][_0xb1e2('0x39')]));_0x2fb974[_0xb1e2('0x38')]=_0x2fb974['attributes'][_0xb1e2('0x3a')]?_0x2fb974[_0xb1e2('0x38')]:_0x98ec2[_0xb1e2('0x33')];if(_0x2d1f78[_0xb1e2('0x34')]['includeAll']){_0x2fb974[_0xb1e2('0x45')]=[{'all':!![]}];}_0x2fb974=_['merge']({},_0x2fb974,_0x2d1f78['options']);return db['ServicenowField'][_0xb1e2('0x4a')](_0x2fb974)[_0xb1e2('0x28')](handleEntityNotFound(_0x2ba8b5,null))['then'](respondWithResult(_0x2ba8b5,null))[_0xb1e2('0x48')](handleError(_0x2ba8b5,null));};exports[_0xb1e2('0x4b')]=function(_0x1405a0,_0x28bfe2){return db[_0xb1e2('0x30')][_0xb1e2('0x4b')](_0x1405a0[_0xb1e2('0x4c')],{})[_0xb1e2('0x28')](respondWithResult(_0x28bfe2,0xc9))[_0xb1e2('0x48')](handleError(_0x28bfe2,null));};exports[_0xb1e2('0x27')]=function(_0x179d68,_0x136878){if(_0x179d68['body']['id']){delete _0x179d68[_0xb1e2('0x4c')]['id'];}return db[_0xb1e2('0x30')][_0xb1e2('0x4a')]({'where':{'id':_0x179d68[_0xb1e2('0x4d')]['id']}})[_0xb1e2('0x28')](handleEntityNotFound(_0x136878,null))[_0xb1e2('0x28')](saveUpdates(_0x179d68['body'],null))[_0xb1e2('0x28')](respondWithResult(_0x136878,null))[_0xb1e2('0x48')](handleError(_0x136878,null));};exports[_0xb1e2('0x29')]=function(_0x5957d5,_0x405ba6){return db[_0xb1e2('0x30')][_0xb1e2('0x4a')]({'where':{'id':_0x5957d5[_0xb1e2('0x4d')]['id']}})[_0xb1e2('0x28')](handleEntityNotFound(_0x405ba6,null))[_0xb1e2('0x28')](removeEntity(_0x405ba6,null))[_0xb1e2('0x48')](handleError(_0x405ba6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a26a0a7..668e905 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 _0xcbc3=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xcbc3,0x1c3));var _0x3cbc=function(_0x299721,_0x2f27c4){_0x299721=_0x299721-0x0;var _0x50a594=_0xcbc3[_0x299721];return _0x50a594;};'use strict';var _=require(_0x3cbc('0x0'));var util=require(_0x3cbc('0x1'));var logger=require('../../config/logger')(_0x3cbc('0x2'));var moment=require(_0x3cbc('0x3'));var BPromise=require(_0x3cbc('0x4'));var rp=require(_0x3cbc('0x5'));var fs=require('fs');var path=require(_0x3cbc('0x6'));var rimraf=require('rimraf');var config=require(_0x3cbc('0x7'));var attributes=require(_0x3cbc('0x8'));module[_0x3cbc('0x9')]=function(_0x2a223a,_0x11923d){return _0x2a223a[_0x3cbc('0xa')](_0x3cbc('0xb'),attributes,{'tableName':_0x3cbc('0xc'),'paranoid':![],'indexes':[{'name':_0x3cbc('0xd'),'fields':[_0x3cbc('0xe'),_0x3cbc('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89b4=['../../config/logger','api','bluebird','path','../../config/environment','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0x89b4,0x1e0));var _0x489b=function(_0x21e666,_0x12700e){_0x21e666=_0x21e666-0x0;var _0x1d383e=_0x89b4[_0x21e666];return _0x1d383e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x489b('0x0'))(_0x489b('0x1'));var moment=require('moment');var BPromise=require(_0x489b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x489b('0x3'));var rimraf=require('rimraf');var config=require(_0x489b('0x4'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2a0006,_0x409289){return _0x2a0006[_0x489b('0x5')](_0x489b('0x6'),attributes,{'tableName':_0x489b('0x7'),'paranoid':![],'indexes':[{'name':_0x489b('0x8'),'fields':['idField',_0x489b('0x9')],'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 fbe644e..96b2fd8 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xda3f,0xec));var _0xfda3=function(_0x545278,_0x909b4c){_0x545278=_0x545278-0x0;var _0x32a2fa=_0xda3f[_0x545278];return _0x32a2fa;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6143f1e..5c17bb8 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x568121,_0x3a3157){var _0x1dd146=function(_0x3465e){while(--_0x3465e){_0x568121['push'](_0x568121['shift']());}};_0x1dd146(++_0x3a3157);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4fb564,_0x3803bf){var _0x3cf5b0=function(_0x13a6bc){while(--_0x13a6bc){_0x4fb564['push'](_0x4fb564['shift']());}};_0x3cf5b0(++_0x3803bf);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 18d9f47..1ffdb5b 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(_0x3a3593,_0x9f9b75){var _0x26ca23=function(_0x1086f4){while(--_0x1086f4){_0x3a3593['push'](_0x3a3593['shift']());}};_0x26ca23(++_0x9f9b75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x5a3b2a,_0x144fe5){var _0x10fc13=function(_0x397297){while(--_0x397297){_0x5a3b2a['push'](_0x5a3b2a['shift']());}};_0x10fc13(++_0x144fe5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 c839e53..39d2a59 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 _0xa522=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','limit','undefined','count','offset','status','set','Content-Range','reject','destroy','end','stack','index','map','SugarcrmAccount','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','then','includeAll','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x4304fe,_0x2e77f6){var _0x181c4d=function(_0x206d6e){while(--_0x206d6e){_0x4304fe['push'](_0x4304fe['shift']());}};_0x181c4d(++_0x2e77f6);}(_0xa522,0xe4));var _0x2a52=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa522[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0x2a52('0x0'));var rimraf=require(_0x2a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a52('0x2'));var rp=require(_0x2a52('0x3'));var moment=require('moment');var BPromise=require(_0x2a52('0x4'));var Mustache=require(_0x2a52('0x5'));var util=require(_0x2a52('0x6'));var path=require(_0x2a52('0x7'));var sox=require(_0x2a52('0x8'));var csv=require(_0x2a52('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a52('0xa'));var _=require(_0x2a52('0xb'));var squel=require(_0x2a52('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a52('0xd'));var deskjs=require(_0x2a52('0xe'));var toCsv=require(_0x2a52('0x9'));var querystring=require(_0x2a52('0xf'));var Papa=require(_0x2a52('0x10'));var Redis=require(_0x2a52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2a52('0x12'));var as=require(_0x2a52('0x13'));var hardwareService=require(_0x2a52('0x14'));var logger=require(_0x2a52('0x15'))(_0x2a52('0x16'));var utils=require(_0x2a52('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2a52('0x18'));var db=require(_0x2a52('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3abe43,_0x257806){_0x257806=_0x257806||0xcc;return function(_0x1934f5){if(_0x1934f5){return _0x3abe43[_0x2a52('0x1a')](_0x257806);}return _0x3abe43['status'](_0x257806)['end']();};}function respondWithResult(_0x299e31,_0x3b5b2a){_0x3b5b2a=_0x3b5b2a||0xc8;return function(_0x46eaea){if(_0x46eaea){return _0x299e31['status'](_0x3b5b2a)[_0x2a52('0x1b')](_0x46eaea);}};}function respondWithFilteredResult(_0x3d29bc,_0x1334ab){return function(_0x943f02){if(_0x943f02){var _0x114b35=typeof _0x1334ab['offset']==='undefined'&&typeof _0x1334ab[_0x2a52('0x1c')]===_0x2a52('0x1d');var _0x1118c8=_0x943f02[_0x2a52('0x1e')];var _0xe4d5ed=_0x114b35?0x0:_0x1334ab[_0x2a52('0x1f')];var _0xe32145=_0x114b35?_0x943f02[_0x2a52('0x1e')]:_0x1334ab['offset']+_0x1334ab[_0x2a52('0x1c')];var _0x27f013;if(_0xe32145>=_0x1118c8){_0xe32145=_0x1118c8;_0x27f013=0xc8;}else{_0x27f013=0xce;}_0x3d29bc[_0x2a52('0x20')](_0x27f013);return _0x3d29bc[_0x2a52('0x21')](_0x2a52('0x22'),_0xe4d5ed+'-'+_0xe32145+'/'+_0x1118c8)[_0x2a52('0x1b')](_0x943f02);}return null;};}function patchUpdates(_0x1faeb0){return function(_0x378b69){try{jsonpatch['apply'](_0x378b69,_0x1faeb0,!![]);}catch(_0x3cd3e9){return BPromise[_0x2a52('0x23')](_0x3cd3e9);}return _0x378b69['save']();};}function saveUpdates(_0x2e6437,_0x115d36){return function(_0x697ef0){if(_0x697ef0){return _0x697ef0['update'](_0x2e6437)['then'](function(_0x2334e2){return _0x2334e2;});}return null;};}function removeEntity(_0x23b01f,_0xcb98e7){return function(_0x344ccf){if(_0x344ccf){return _0x344ccf[_0x2a52('0x24')]()['then'](function(){_0x23b01f[_0x2a52('0x20')](0xcc)[_0x2a52('0x25')]();});}};}function handleEntityNotFound(_0x3c5e5c,_0x367e7b){return function(_0x244601){if(!_0x244601){_0x3c5e5c[_0x2a52('0x1a')](0x194);}return _0x244601;};}function handleError(_0x19dfc8,_0x3c5733){_0x3c5733=_0x3c5733||0x1f4;return function(_0x4fa857){logger['error'](_0x4fa857[_0x2a52('0x26')]);if(_0x4fa857['name']){delete _0x4fa857['name'];}_0x19dfc8['status'](_0x3c5733)['send'](_0x4fa857);};}exports[_0x2a52('0x27')]=function(_0x521a2a,_0x6146be){var _0x3f226c={},_0x46990f={},_0x4fe798={'count':0x0,'rows':[]};var _0x39acde=_[_0x2a52('0x28')](db[_0x2a52('0x29')][_0x2a52('0x2a')],function(_0x50dc86){return{'name':_0x50dc86['fieldName'],'type':_0x50dc86['type']['key']};});_0x46990f[_0x2a52('0x2b')]=_[_0x2a52('0x28')](_0x39acde,'name');_0x46990f[_0x2a52('0x2c')]=_[_0x2a52('0x2d')](_0x521a2a['query']);_0x46990f[_0x2a52('0x2e')]=_[_0x2a52('0x2f')](_0x46990f[_0x2a52('0x2b')],_0x46990f['query']);_0x3f226c['attributes']=_[_0x2a52('0x2f')](_0x46990f[_0x2a52('0x2b')],qs[_0x2a52('0x30')](_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x30')]));_0x3f226c[_0x2a52('0x31')]=_0x3f226c[_0x2a52('0x31')]['length']?_0x3f226c[_0x2a52('0x31')]:_0x46990f[_0x2a52('0x2b')];if(!_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x32')](_0x2a52('0x33'))){_0x3f226c[_0x2a52('0x1c')]=qs[_0x2a52('0x1c')](_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x1c')]);_0x3f226c['offset']=qs['offset'](_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x1f')]);}_0x3f226c[_0x2a52('0x34')]=qs[_0x2a52('0x35')](_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x35')]);_0x3f226c[_0x2a52('0x36')]=qs[_0x2a52('0x2e')](_[_0x2a52('0x37')](_0x521a2a[_0x2a52('0x2c')],_0x46990f[_0x2a52('0x2e')]),_0x39acde);if(_0x521a2a['query'][_0x2a52('0x38')]){_0x3f226c['where']=_[_0x2a52('0x39')](_0x3f226c[_0x2a52('0x36')],{'$or':_[_0x2a52('0x28')](_0x39acde,function(_0xd3d758){if(_0xd3d758['type']!==_0x2a52('0x3a')){var _0x8ad394={};_0x8ad394[_0xd3d758[_0x2a52('0x3b')]]={'$like':'%'+_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x38')]+'%'};return _0x8ad394;}})});}_0x3f226c=_['merge']({},_0x3f226c,_0x521a2a[_0x2a52('0x3c')]);var _0x48d823={'where':_0x3f226c[_0x2a52('0x36')]};return db['SugarcrmAccount'][_0x2a52('0x1e')](_0x48d823)[_0x2a52('0x3d')](function(_0x341581){_0x4fe798['count']=_0x341581;if(_0x521a2a[_0x2a52('0x2c')][_0x2a52('0x3e')]){_0x3f226c['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2a52('0x3f')](_0x3f226c);})[_0x2a52('0x3d')](function(_0x355ed5){_0x4fe798[_0x2a52('0x40')]=_0x355ed5;return _0x4fe798;})[_0x2a52('0x3d')](respondWithFilteredResult(_0x6146be,_0x3f226c))[_0x2a52('0x41')](handleError(_0x6146be,null));};exports[_0x2a52('0x42')]=function(_0xe7943b,_0x40b8b9){var _0x8dd9c3={'raw':![],'where':{'id':_0xe7943b[_0x2a52('0x43')]['id']}},_0x7d7c52={};_0x7d7c52[_0x2a52('0x2b')]=_['keys'](db[_0x2a52('0x29')][_0x2a52('0x2a')]);_0x7d7c52['query']=_[_0x2a52('0x2d')](_0xe7943b['query']);_0x7d7c52[_0x2a52('0x2e')]=_[_0x2a52('0x2f')](_0x7d7c52[_0x2a52('0x2b')],_0x7d7c52[_0x2a52('0x2c')]);_0x8dd9c3['attributes']=_[_0x2a52('0x2f')](_0x7d7c52[_0x2a52('0x2b')],qs[_0x2a52('0x30')](_0xe7943b[_0x2a52('0x2c')]['fields']));_0x8dd9c3[_0x2a52('0x31')]=_0x8dd9c3[_0x2a52('0x31')][_0x2a52('0x44')]?_0x8dd9c3[_0x2a52('0x31')]:_0x7d7c52[_0x2a52('0x2b')];if(_0xe7943b[_0x2a52('0x2c')]['includeAll']){_0x8dd9c3['include']=[{'all':!![]}];}_0x8dd9c3=_[_0x2a52('0x39')]({},_0x8dd9c3,_0xe7943b['options']);return db[_0x2a52('0x29')][_0x2a52('0x45')](_0x8dd9c3)['then'](handleEntityNotFound(_0x40b8b9,null))[_0x2a52('0x3d')](respondWithResult(_0x40b8b9,null))[_0x2a52('0x41')](handleError(_0x40b8b9,null));};exports['create']=function(_0x239029,_0x2f9280){return db[_0x2a52('0x29')][_0x2a52('0x46')](_0x239029[_0x2a52('0x47')],{})[_0x2a52('0x3d')](respondWithResult(_0x2f9280,0xc9))[_0x2a52('0x41')](handleError(_0x2f9280,null));};exports[_0x2a52('0x48')]=function(_0x2ed51e,_0x1aa32a){if(_0x2ed51e[_0x2a52('0x47')]['id']){delete _0x2ed51e['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x2ed51e[_0x2a52('0x43')]['id']}})[_0x2a52('0x3d')](handleEntityNotFound(_0x1aa32a,null))[_0x2a52('0x3d')](saveUpdates(_0x2ed51e[_0x2a52('0x47')],null))[_0x2a52('0x3d')](respondWithResult(_0x1aa32a,null))['catch'](handleError(_0x1aa32a,null));};exports[_0x2a52('0x24')]=function(_0x32886e,_0x1f04b8){return db['SugarcrmAccount'][_0x2a52('0x45')]({'where':{'id':_0x32886e[_0x2a52('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f04b8,null))[_0x2a52('0x3d')](removeEntity(_0x1f04b8,null))['catch'](handleError(_0x1f04b8,null));};exports[_0x2a52('0x49')]=function(_0x4ba8d8,_0x2f7496,_0x560988){var _0xd05837={};var _0x291e52={};var _0x25691e;var _0x5957bf;return db[_0x2a52('0x29')][_0x2a52('0x4a')]({'where':{'id':_0x4ba8d8[_0x2a52('0x43')]['id']}})[_0x2a52('0x3d')](handleEntityNotFound(_0x2f7496,null))['then'](function(_0x3e1a91){if(_0x3e1a91){_0x25691e=_0x3e1a91;_0x291e52[_0x2a52('0x2b')]=_[_0x2a52('0x2d')](db[_0x2a52('0x4b')][_0x2a52('0x2a')]);_0x291e52[_0x2a52('0x2c')]=_[_0x2a52('0x2d')](_0x4ba8d8[_0x2a52('0x2c')]);_0x291e52[_0x2a52('0x2e')]=_['intersection'](_0x291e52[_0x2a52('0x2b')],_0x291e52[_0x2a52('0x2c')]);_0xd05837['attributes']=_[_0x2a52('0x2f')](_0x291e52[_0x2a52('0x2b')],qs['fields'](_0x4ba8d8[_0x2a52('0x2c')][_0x2a52('0x30')]));_0xd05837['attributes']=_0xd05837[_0x2a52('0x31')][_0x2a52('0x44')]?_0xd05837[_0x2a52('0x31')]:_0x291e52[_0x2a52('0x2b')];_0xd05837['order']=qs[_0x2a52('0x35')](_0x4ba8d8[_0x2a52('0x2c')][_0x2a52('0x35')]);_0xd05837[_0x2a52('0x36')]=qs['filters'](_[_0x2a52('0x37')](_0x4ba8d8[_0x2a52('0x2c')],_0x291e52['filters']));if(_0x4ba8d8[_0x2a52('0x2c')][_0x2a52('0x38')]){_0xd05837[_0x2a52('0x36')]=_[_0x2a52('0x39')](_0xd05837[_0x2a52('0x36')],{'$or':_[_0x2a52('0x28')](_0xd05837[_0x2a52('0x31')],function(_0x19dc40){var _0x53f6bf={};_0x53f6bf[_0x19dc40]={'$like':'%'+_0x4ba8d8['query'][_0x2a52('0x38')]+'%'};return _0x53f6bf;})});}_0xd05837=_[_0x2a52('0x39')]({},_0xd05837,_0x4ba8d8['options']);return _0x25691e['getConfigurations'](_0xd05837);}})[_0x2a52('0x3d')](function(_0x4591a3){if(_0x4591a3){_0x5957bf=_0x4591a3[_0x2a52('0x44')];if(!_0x4ba8d8['query'][_0x2a52('0x32')](_0x2a52('0x33'))){_0xd05837[_0x2a52('0x1c')]=qs[_0x2a52('0x1c')](_0x4ba8d8['query'][_0x2a52('0x1c')]);_0xd05837[_0x2a52('0x1f')]=qs[_0x2a52('0x1f')](_0x4ba8d8['query'][_0x2a52('0x1f')]);}return _0x25691e['getConfigurations'](_0xd05837);}})['then'](function(_0x4862b8){if(_0x4862b8){return _0x4862b8?{'count':_0x5957bf,'rows':_0x4862b8}:null;}})['then'](respondWithResult(_0x2f7496,null))['catch'](handleError(_0x2f7496,null));};exports['addConfiguration']=function(_0x16af5c,_0x1a75de,_0x1fd2c7){if(_0x16af5c['body']['id']){delete _0x16af5c[_0x2a52('0x47')]['id'];}return db[_0x2a52('0x29')][_0x2a52('0x4a')]({'where':{'id':_0x16af5c['params']['id']}})[_0x2a52('0x3d')](handleEntityNotFound(_0x1a75de,null))[_0x2a52('0x3d')](function(_0x31c925){if(_0x31c925){_0x16af5c[_0x2a52('0x47')][_0x2a52('0x4c')]=_0x31c925['id'];_0x16af5c[_0x2a52('0x47')][_0x2a52('0x4d')]=integrations[_0x2a52('0x4e')](_0x16af5c[_0x2a52('0x47')]['channel'],_0x16af5c[_0x2a52('0x47')][_0x2a52('0x4f')]);_0x16af5c[_0x2a52('0x47')][_0x2a52('0x50')]=integrations[_0x2a52('0x51')](_0x16af5c[_0x2a52('0x47')][_0x2a52('0x52')],_0x16af5c[_0x2a52('0x47')][_0x2a52('0x4f')]);return db[_0x2a52('0x4b')][_0x2a52('0x46')](_0x16af5c[_0x2a52('0x47')],{'include':[{'model':db[_0x2a52('0x53')],'as':_0x2a52('0x4d')},{'model':db[_0x2a52('0x53')],'as':_0x2a52('0x50')}]});}return null;})['then'](respondWithResult(_0x1a75de,null))[_0x2a52('0x41')](handleError(_0x1a75de,null));};exports[_0x2a52('0x54')]=function(_0x580522,_0x12eea2,_0x1967d6){var _0x3edd9f='';var _0x138f63=['id',_0x2a52('0x3b'),_0x2a52('0x55'),_0x2a52('0x56'),_0x2a52('0x57'),'date_start','duration_hours',_0x2a52('0x58'),'parent_id',_0x2a52('0x59'),_0x2a52('0x5a'),'direction'];return db[_0x2a52('0x29')]['findOne']({'where':{'id':_0x580522[_0x2a52('0x43')]['id']},'attributes':['id',_0x2a52('0x5b'),_0x2a52('0x5c'),_0x2a52('0x5d')]})[_0x2a52('0x3d')](handleEntityNotFound(_0x12eea2,null))[_0x2a52('0x3d')](function(_0x1630d7){if(_0x1630d7){_0x3edd9f=_0x1630d7[_0x2a52('0x5d')];var _0x1e4e21=_0x3edd9f[_0x2a52('0x5e')](-0x1);if(_0x1e4e21==='/'){_0x3edd9f=_0x3edd9f[_0x2a52('0x5f')](0x0,_0x3edd9f[_0x2a52('0x60')](_0x1e4e21));}return rp({'method':_0x2a52('0x61'),'uri':util[_0x2a52('0x62')](_0x2a52('0x63'),_0x3edd9f,_0x2a52('0x64')),'json':!![],'form':{'method':_0x2a52('0x65'),'input_type':_0x2a52('0x66'),'response_type':_0x2a52('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1630d7[_0x2a52('0x5b')],'password':_0x1630d7[_0x2a52('0x5c')],'encryption':_0x2a52('0x67')},'application':_0x2a52('0x68')})}});}})['then'](function(_0x158a5a){if(_0x158a5a&&_0x158a5a[_0x2a52('0x3b')]!==_0x2a52('0x69')&&_0x158a5a[_0x2a52('0x3b')]!==_0x2a52('0x6a')){return rp({'method':_0x2a52('0x61'),'uri':util[_0x2a52('0x62')](_0x2a52('0x63'),_0x3edd9f,_0x2a52('0x64')),'json':!![],'form':{'method':_0x2a52('0x6b'),'input_type':_0x2a52('0x66'),'response_type':_0x2a52('0x66'),'rest_data':JSON[_0x2a52('0x6c')]({'session':_0x158a5a['id'],'module_name':'Calls'})}})[_0x2a52('0x3d')](function(_0x5c5662){if(_0x5c5662){var _0x470096=_[_0x2a52('0x6d')](_0x5c5662[_0x2a52('0x6e')]);_[_0x2a52('0x6f')](_0x470096,function(_0x5f0b3c){return _0x138f63[_0x2a52('0x70')](_0x5f0b3c[_0x2a52('0x3b')]);});return{'count':_0x470096[_0x2a52('0x44')],'rows':_[_0x2a52('0x28')](_0x470096,function(_0x1b5b68){return{'id':_0x1b5b68['name'],'name':_0x1b5b68[_0x2a52('0x71')],'custom':_[_0x2a52('0x72')](_0x1b5b68[_0x2a52('0x3b')],'_c')?!![]:![],'options':_0x1b5b68[_0x2a52('0x3c')]?_[_0x2a52('0x28')](_[_0x2a52('0x6d')](_0x1b5b68['options']),function(_0x43f2ef){return{'name':_0x43f2ef[_0x2a52('0x73')],'value':_0x43f2ef[_0x2a52('0x3b')]};}):[]};})};}})[_0x2a52('0x3d')](respondWithResult(_0x12eea2,null))[_0x2a52('0x41')](function(_0x325100){var _0x35e817=_0x580522[_0x2a52('0x2c')][_0x2a52('0x74')]?0x1f4:_0x325100[_0x2a52('0x75')]||0x1f4;logger[_0x2a52('0x76')](_0x2a52('0x77'),_0x2a52('0x54'),_0x35e817,JSON[_0x2a52('0x6c')](_0x325100));delete _0x325100[_0x2a52('0x3b')];if(_0x35e817===0x191){_0x35e817=0x190;}_0x12eea2[_0x2a52('0x20')](_0x35e817)[_0x2a52('0x78')](_0x580522[_0x2a52('0x2c')][_0x2a52('0x74')]?{'message':_0x2a52('0x79'),'statusCode':_0x325100[_0x2a52('0x75')]}:_0x325100);});}else{var _0x44eaed=0x1f4;_0x12eea2['status'](_0x44eaed)[_0x2a52('0x78')]({'message':_0x2a52('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4f38=['Subjects','Descriptions','type','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','stringify','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','AccountId'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x4f38,0x11c));var _0x84f3=function(_0x42125c,_0x200ebe){_0x42125c=_0x42125c-0x0;var _0x3c990e=_0x4f38[_0x42125c];return _0x3c990e;};'use strict';var emlformat=require(_0x84f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84f3('0x1'));var jsonpatch=require(_0x84f3('0x2'));var rp=require(_0x84f3('0x3'));var moment=require(_0x84f3('0x4'));var BPromise=require(_0x84f3('0x5'));var Mustache=require(_0x84f3('0x6'));var util=require(_0x84f3('0x7'));var path=require(_0x84f3('0x8'));var sox=require('sox');var csv=require(_0x84f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x84f3('0xa'));var crypto=require(_0x84f3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x84f3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x84f3('0xd'));var Papa=require(_0x84f3('0xe'));var Redis=require(_0x84f3('0xf'));var authService=require(_0x84f3('0x10'));var qs=require(_0x84f3('0x11'));var as=require(_0x84f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x84f3('0x13'));var utils=require('../../config/utils');var config=require(_0x84f3('0x14'));var licenseUtil=require(_0x84f3('0x15'));var db=require(_0x84f3('0x16'))['db'];var integrations=require(_0x84f3('0x17'));function respondWithStatusCode(_0x168e21,_0x348c3f){_0x348c3f=_0x348c3f||0xcc;return function(_0x50fe94){if(_0x50fe94){return _0x168e21[_0x84f3('0x18')](_0x348c3f);}return _0x168e21[_0x84f3('0x19')](_0x348c3f)['end']();};}function respondWithResult(_0x10ee6a,_0x53ab4){_0x53ab4=_0x53ab4||0xc8;return function(_0x5539c0){if(_0x5539c0){return _0x10ee6a[_0x84f3('0x19')](_0x53ab4)[_0x84f3('0x1a')](_0x5539c0);}};}function respondWithFilteredResult(_0x577401,_0x2b3c3d){return function(_0x375d7c){if(_0x375d7c){var _0x5433c5=typeof _0x2b3c3d[_0x84f3('0x1b')]===_0x84f3('0x1c')&&typeof _0x2b3c3d['limit']===_0x84f3('0x1c');var _0x3b0cd9=_0x375d7c[_0x84f3('0x1d')];var _0x3954b8=_0x5433c5?0x0:_0x2b3c3d[_0x84f3('0x1b')];var _0x2f14db=_0x5433c5?_0x375d7c[_0x84f3('0x1d')]:_0x2b3c3d[_0x84f3('0x1b')]+_0x2b3c3d['limit'];var _0x77bcd3;if(_0x2f14db>=_0x3b0cd9){_0x2f14db=_0x3b0cd9;_0x77bcd3=0xc8;}else{_0x77bcd3=0xce;}_0x577401[_0x84f3('0x19')](_0x77bcd3);return _0x577401[_0x84f3('0x1e')](_0x84f3('0x1f'),_0x3954b8+'-'+_0x2f14db+'/'+_0x3b0cd9)[_0x84f3('0x1a')](_0x375d7c);}return null;};}function patchUpdates(_0x47a933){return function(_0x1d1ddc){try{jsonpatch['apply'](_0x1d1ddc,_0x47a933,!![]);}catch(_0x1e2b65){return BPromise[_0x84f3('0x20')](_0x1e2b65);}return _0x1d1ddc[_0x84f3('0x21')]();};}function saveUpdates(_0x39dec6,_0x227b3d){return function(_0x5cdc4d){if(_0x5cdc4d){return _0x5cdc4d[_0x84f3('0x22')](_0x39dec6)['then'](function(_0x4b52c2){return _0x4b52c2;});}return null;};}function removeEntity(_0x25a3d6,_0x2fcfd6){return function(_0x53eec3){if(_0x53eec3){return _0x53eec3['destroy']()[_0x84f3('0x23')](function(){_0x25a3d6[_0x84f3('0x19')](0xcc)[_0x84f3('0x24')]();});}};}function handleEntityNotFound(_0x7383ba,_0x4a99bf){return function(_0x1684d8){if(!_0x1684d8){_0x7383ba['sendStatus'](0x194);}return _0x1684d8;};}function handleError(_0x296284,_0x347767){_0x347767=_0x347767||0x1f4;return function(_0x4920c9){logger[_0x84f3('0x25')](_0x4920c9[_0x84f3('0x26')]);if(_0x4920c9[_0x84f3('0x27')]){delete _0x4920c9[_0x84f3('0x27')];}_0x296284[_0x84f3('0x19')](_0x347767)[_0x84f3('0x28')](_0x4920c9);};}exports[_0x84f3('0x29')]=function(_0x575cdb,_0x5c729b){var _0x4dec31={},_0x43773d={},_0x2df0c2={'count':0x0,'rows':[]};var _0x1a3ad6=_[_0x84f3('0x2a')](db[_0x84f3('0x2b')][_0x84f3('0x2c')],function(_0xf3f166){return{'name':_0xf3f166['fieldName'],'type':_0xf3f166['type'][_0x84f3('0x2d')]};});_0x43773d[_0x84f3('0x2e')]=_[_0x84f3('0x2a')](_0x1a3ad6,_0x84f3('0x27'));_0x43773d[_0x84f3('0x2f')]=_[_0x84f3('0x30')](_0x575cdb[_0x84f3('0x2f')]);_0x43773d[_0x84f3('0x31')]=_[_0x84f3('0x32')](_0x43773d[_0x84f3('0x2e')],_0x43773d[_0x84f3('0x2f')]);_0x4dec31[_0x84f3('0x33')]=_[_0x84f3('0x32')](_0x43773d[_0x84f3('0x2e')],qs[_0x84f3('0x34')](_0x575cdb[_0x84f3('0x2f')]['fields']));_0x4dec31[_0x84f3('0x33')]=_0x4dec31[_0x84f3('0x33')][_0x84f3('0x35')]?_0x4dec31[_0x84f3('0x33')]:_0x43773d[_0x84f3('0x2e')];if(!_0x575cdb[_0x84f3('0x2f')][_0x84f3('0x36')](_0x84f3('0x37'))){_0x4dec31[_0x84f3('0x38')]=qs[_0x84f3('0x38')](_0x575cdb['query'][_0x84f3('0x38')]);_0x4dec31['offset']=qs['offset'](_0x575cdb[_0x84f3('0x2f')][_0x84f3('0x1b')]);}_0x4dec31[_0x84f3('0x39')]=qs[_0x84f3('0x3a')](_0x575cdb['query']['sort']);_0x4dec31['where']=qs[_0x84f3('0x31')](_['pick'](_0x575cdb[_0x84f3('0x2f')],_0x43773d['filters']),_0x1a3ad6);if(_0x575cdb[_0x84f3('0x2f')][_0x84f3('0x3b')]){_0x4dec31['where']=_[_0x84f3('0x3c')](_0x4dec31[_0x84f3('0x3d')],{'$or':_[_0x84f3('0x2a')](_0x1a3ad6,function(_0xe8dfc2){if(_0xe8dfc2['type']!==_0x84f3('0x3e')){var _0xa29b7d={};_0xa29b7d[_0xe8dfc2[_0x84f3('0x27')]]={'$like':'%'+_0x575cdb[_0x84f3('0x2f')][_0x84f3('0x3b')]+'%'};return _0xa29b7d;}})});}_0x4dec31=_[_0x84f3('0x3c')]({},_0x4dec31,_0x575cdb[_0x84f3('0x3f')]);var _0x934d5e={'where':_0x4dec31[_0x84f3('0x3d')]};return db[_0x84f3('0x2b')]['count'](_0x934d5e)['then'](function(_0x3fbf0b){_0x2df0c2['count']=_0x3fbf0b;if(_0x575cdb[_0x84f3('0x2f')][_0x84f3('0x40')]){_0x4dec31[_0x84f3('0x41')]=[{'all':!![]}];}return db[_0x84f3('0x2b')][_0x84f3('0x42')](_0x4dec31);})[_0x84f3('0x23')](function(_0x4f46d5){_0x2df0c2[_0x84f3('0x43')]=_0x4f46d5;return _0x2df0c2;})[_0x84f3('0x23')](respondWithFilteredResult(_0x5c729b,_0x4dec31))[_0x84f3('0x44')](handleError(_0x5c729b,null));};exports[_0x84f3('0x45')]=function(_0x4ecfc7,_0x1ef860){var _0x9e0424={'raw':![],'where':{'id':_0x4ecfc7['params']['id']}},_0x320821={};_0x320821[_0x84f3('0x2e')]=_[_0x84f3('0x30')](db[_0x84f3('0x2b')][_0x84f3('0x2c')]);_0x320821['query']=_[_0x84f3('0x30')](_0x4ecfc7['query']);_0x320821[_0x84f3('0x31')]=_[_0x84f3('0x32')](_0x320821[_0x84f3('0x2e')],_0x320821['query']);_0x9e0424[_0x84f3('0x33')]=_[_0x84f3('0x32')](_0x320821[_0x84f3('0x2e')],qs[_0x84f3('0x34')](_0x4ecfc7[_0x84f3('0x2f')][_0x84f3('0x34')]));_0x9e0424[_0x84f3('0x33')]=_0x9e0424['attributes']['length']?_0x9e0424[_0x84f3('0x33')]:_0x320821[_0x84f3('0x2e')];if(_0x4ecfc7[_0x84f3('0x2f')][_0x84f3('0x40')]){_0x9e0424[_0x84f3('0x41')]=[{'all':!![]}];}_0x9e0424=_['merge']({},_0x9e0424,_0x4ecfc7['options']);return db[_0x84f3('0x2b')][_0x84f3('0x46')](_0x9e0424)[_0x84f3('0x23')](handleEntityNotFound(_0x1ef860,null))[_0x84f3('0x23')](respondWithResult(_0x1ef860,null))[_0x84f3('0x44')](handleError(_0x1ef860,null));};exports['create']=function(_0x303039,_0x58e89d){return db['SugarcrmAccount'][_0x84f3('0x47')](_0x303039['body'],{})[_0x84f3('0x23')](respondWithResult(_0x58e89d,0xc9))[_0x84f3('0x44')](handleError(_0x58e89d,null));};exports[_0x84f3('0x22')]=function(_0xfec068,_0x367925){if(_0xfec068[_0x84f3('0x48')]['id']){delete _0xfec068['body']['id'];}return db[_0x84f3('0x2b')][_0x84f3('0x46')]({'where':{'id':_0xfec068[_0x84f3('0x49')]['id']}})[_0x84f3('0x23')](handleEntityNotFound(_0x367925,null))['then'](saveUpdates(_0xfec068[_0x84f3('0x48')],null))['then'](respondWithResult(_0x367925,null))[_0x84f3('0x44')](handleError(_0x367925,null));};exports[_0x84f3('0x4a')]=function(_0x171bac,_0x3c5f89){return db[_0x84f3('0x2b')][_0x84f3('0x46')]({'where':{'id':_0x171bac[_0x84f3('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c5f89,null))['then'](removeEntity(_0x3c5f89,null))[_0x84f3('0x44')](handleError(_0x3c5f89,null));};exports[_0x84f3('0x4b')]=function(_0x2aa699,_0x3ca6d3,_0x134d4d){var _0x1aa74c={};var _0x554a49={};var _0x3e765;var _0xc0e702;return db[_0x84f3('0x2b')][_0x84f3('0x4c')]({'where':{'id':_0x2aa699[_0x84f3('0x49')]['id']}})[_0x84f3('0x23')](handleEntityNotFound(_0x3ca6d3,null))['then'](function(_0x2c056a){if(_0x2c056a){_0x3e765=_0x2c056a;_0x554a49[_0x84f3('0x2e')]=_[_0x84f3('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x554a49[_0x84f3('0x2f')]=_[_0x84f3('0x30')](_0x2aa699[_0x84f3('0x2f')]);_0x554a49[_0x84f3('0x31')]=_[_0x84f3('0x32')](_0x554a49['model'],_0x554a49['query']);_0x1aa74c[_0x84f3('0x33')]=_[_0x84f3('0x32')](_0x554a49[_0x84f3('0x2e')],qs[_0x84f3('0x34')](_0x2aa699[_0x84f3('0x2f')]['fields']));_0x1aa74c[_0x84f3('0x33')]=_0x1aa74c[_0x84f3('0x33')]['length']?_0x1aa74c[_0x84f3('0x33')]:_0x554a49[_0x84f3('0x2e')];_0x1aa74c[_0x84f3('0x39')]=qs[_0x84f3('0x3a')](_0x2aa699[_0x84f3('0x2f')]['sort']);_0x1aa74c[_0x84f3('0x3d')]=qs['filters'](_['pick'](_0x2aa699[_0x84f3('0x2f')],_0x554a49[_0x84f3('0x31')]));if(_0x2aa699[_0x84f3('0x2f')][_0x84f3('0x3b')]){_0x1aa74c[_0x84f3('0x3d')]=_[_0x84f3('0x3c')](_0x1aa74c[_0x84f3('0x3d')],{'$or':_[_0x84f3('0x2a')](_0x1aa74c[_0x84f3('0x33')],function(_0xab703e){var _0x1399fb={};_0x1399fb[_0xab703e]={'$like':'%'+_0x2aa699['query']['filter']+'%'};return _0x1399fb;})});}_0x1aa74c=_[_0x84f3('0x3c')]({},_0x1aa74c,_0x2aa699[_0x84f3('0x3f')]);return _0x3e765[_0x84f3('0x4b')](_0x1aa74c);}})['then'](function(_0x210fb3){if(_0x210fb3){_0xc0e702=_0x210fb3[_0x84f3('0x35')];if(!_0x2aa699[_0x84f3('0x2f')][_0x84f3('0x36')](_0x84f3('0x37'))){_0x1aa74c[_0x84f3('0x38')]=qs[_0x84f3('0x38')](_0x2aa699[_0x84f3('0x2f')][_0x84f3('0x38')]);_0x1aa74c['offset']=qs[_0x84f3('0x1b')](_0x2aa699[_0x84f3('0x2f')][_0x84f3('0x1b')]);}return _0x3e765[_0x84f3('0x4b')](_0x1aa74c);}})[_0x84f3('0x23')](function(_0x16d662){if(_0x16d662){return _0x16d662?{'count':_0xc0e702,'rows':_0x16d662}:null;}})[_0x84f3('0x23')](respondWithResult(_0x3ca6d3,null))[_0x84f3('0x44')](handleError(_0x3ca6d3,null));};exports[_0x84f3('0x4d')]=function(_0x298522,_0x4b6b82,_0x4cdd69){if(_0x298522[_0x84f3('0x48')]['id']){delete _0x298522['body']['id'];}return db[_0x84f3('0x2b')][_0x84f3('0x4c')]({'where':{'id':_0x298522[_0x84f3('0x49')]['id']}})[_0x84f3('0x23')](handleEntityNotFound(_0x4b6b82,null))[_0x84f3('0x23')](function(_0x5659af){if(_0x5659af){_0x298522[_0x84f3('0x48')][_0x84f3('0x4e')]=_0x5659af['id'];_0x298522[_0x84f3('0x48')][_0x84f3('0x4f')]=integrations['getSubjects'](_0x298522[_0x84f3('0x48')]['channel'],_0x298522['body']['type']);_0x298522[_0x84f3('0x48')][_0x84f3('0x50')]=integrations['getDescriptions'](_0x298522['body']['channel'],_0x298522[_0x84f3('0x48')][_0x84f3('0x51')]);return db[_0x84f3('0x52')][_0x84f3('0x47')](_0x298522[_0x84f3('0x48')],{'include':[{'model':db[_0x84f3('0x53')],'as':_0x84f3('0x4f')},{'model':db[_0x84f3('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4b6b82,null))[_0x84f3('0x44')](handleError(_0x4b6b82,null));};exports[_0x84f3('0x54')]=function(_0xf857a8,_0x46ba91,_0x4fcdfe){var _0x6d638='';var _0x32354e=['id',_0x84f3('0x27'),_0x84f3('0x55'),_0x84f3('0x56'),_0x84f3('0x57'),_0x84f3('0x58'),_0x84f3('0x59'),_0x84f3('0x5a'),_0x84f3('0x5b'),_0x84f3('0x5c'),_0x84f3('0x5d'),_0x84f3('0x5e')];return db['SugarcrmAccount'][_0x84f3('0x4c')]({'where':{'id':_0xf857a8['params']['id']},'attributes':['id',_0x84f3('0x5f'),_0x84f3('0x60'),'remoteUri']})['then'](handleEntityNotFound(_0x46ba91,null))[_0x84f3('0x23')](function(_0x4f87b4){if(_0x4f87b4){_0x6d638=_0x4f87b4[_0x84f3('0x61')];var _0x394281=_0x6d638['slice'](-0x1);if(_0x394281==='/'){_0x6d638=_0x6d638[_0x84f3('0x62')](0x0,_0x6d638[_0x84f3('0x63')](_0x394281));}return rp({'method':'POST','uri':util[_0x84f3('0x64')](_0x84f3('0x65'),_0x6d638,_0x84f3('0x66')),'json':!![],'form':{'method':_0x84f3('0x67'),'input_type':_0x84f3('0x68'),'response_type':_0x84f3('0x68'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4f87b4[_0x84f3('0x5f')],'password':_0x4f87b4['password'],'encryption':'PLAIN'},'application':_0x84f3('0x69')})}});}})[_0x84f3('0x23')](function(_0xbf6bb){if(_0xbf6bb&&_0xbf6bb[_0x84f3('0x27')]!==_0x84f3('0x6a')&&_0xbf6bb[_0x84f3('0x27')]!==_0x84f3('0x6b')){return rp({'method':_0x84f3('0x6c'),'uri':util[_0x84f3('0x64')]('%s%s',_0x6d638,_0x84f3('0x66')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x84f3('0x68'),'rest_data':JSON[_0x84f3('0x6d')]({'session':_0xbf6bb['id'],'module_name':'Calls'})}})[_0x84f3('0x23')](function(_0x81d0f2){if(_0x81d0f2){var _0x34cd4f=_[_0x84f3('0x6e')](_0x81d0f2[_0x84f3('0x6f')]);_[_0x84f3('0x70')](_0x34cd4f,function(_0x2d150e){return _0x32354e[_0x84f3('0x71')](_0x2d150e[_0x84f3('0x27')]);});return{'count':_0x34cd4f[_0x84f3('0x35')],'rows':_[_0x84f3('0x2a')](_0x34cd4f,function(_0xcd5ed1){return{'id':_0xcd5ed1[_0x84f3('0x27')],'name':_0xcd5ed1[_0x84f3('0x72')],'custom':_[_0x84f3('0x73')](_0xcd5ed1[_0x84f3('0x27')],'_c')?!![]:![],'options':_0xcd5ed1[_0x84f3('0x3f')]?_[_0x84f3('0x2a')](_[_0x84f3('0x6e')](_0xcd5ed1[_0x84f3('0x3f')]),function(_0x4c92c3){return{'name':_0x4c92c3[_0x84f3('0x74')],'value':_0x4c92c3[_0x84f3('0x27')]};}):[]};})};}})[_0x84f3('0x23')](respondWithResult(_0x46ba91,null))[_0x84f3('0x44')](function(_0x4c6ac8){var _0x469f13=_0xf857a8[_0x84f3('0x2f')]['test']?0x1f4:_0x4c6ac8[_0x84f3('0x75')]||0x1f4;logger[_0x84f3('0x25')](_0x84f3('0x76'),_0x84f3('0x54'),_0x469f13,JSON[_0x84f3('0x6d')](_0x4c6ac8));delete _0x4c6ac8['name'];if(_0x469f13===0x191){_0x469f13=0x190;}_0x46ba91['status'](_0x469f13)['send'](_0xf857a8['query'][_0x84f3('0x77')]?{'message':_0x84f3('0x78'),'statusCode':_0x4c6ac8[_0x84f3('0x75')]}:_0x4c6ac8);});}else{var _0x12af36=0x1f4;_0x46ba91[_0x84f3('0x19')](_0x12af36)[_0x84f3('0x28')]({'message':_0x84f3('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 4a66b3a..06e011f 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 _0x9be8=['request-promise','path','rimraf','./intSugarcrmAccount.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x394c84,_0x10d9df){var _0x467df0=function(_0xe5a6d0){while(--_0xe5a6d0){_0x394c84['push'](_0x394c84['shift']());}};_0x467df0(++_0x10d9df);}(_0x9be8,0x103));var _0x89be=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0x9be8[_0x14b767];return _0x22267a;};'use strict';var _=require(_0x89be('0x0'));var util=require('util');var logger=require(_0x89be('0x1'))(_0x89be('0x2'));var moment=require(_0x89be('0x3'));var BPromise=require(_0x89be('0x4'));var rp=require(_0x89be('0x5'));var fs=require('fs');var path=require(_0x89be('0x6'));var rimraf=require(_0x89be('0x7'));var config=require('../../config/environment');var attributes=require(_0x89be('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x89be('0x9')]=function(_0x3a4c12,_0x2ed40e){return _0x3a4c12[_0x89be('0xa')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7f8=['util','../../config/logger','moment','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x4c3f1c,_0x30d1a5){var _0x2119b4=function(_0x122be9){while(--_0x122be9){_0x4c3f1c['push'](_0x4c3f1c['shift']());}};_0x2119b4(++_0x30d1a5);}(_0xa7f8,0x160));var _0x8a7f=function(_0x3cc90b,_0x1b69d9){_0x3cc90b=_0x3cc90b-0x0;var _0x34051b=_0xa7f8[_0x3cc90b];return _0x34051b;};'use strict';var _=require('lodash');var util=require(_0x8a7f('0x0'));var logger=require(_0x8a7f('0x1'))('api');var moment=require(_0x8a7f('0x2'));var BPromise=require('bluebird');var rp=require(_0x8a7f('0x3'));var fs=require('fs');var path=require(_0x8a7f('0x4'));var rimraf=require(_0x8a7f('0x5'));var config=require('../../config/environment');var attributes=require(_0x8a7f('0x6'));var integrations=require(_0x8a7f('0x7'));module[_0x8a7f('0x8')]=function(_0x1af2bb,_0x42da44){return _0x1af2bb[_0x8a7f('0x9')](_0x8a7f('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','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 3098211..055f237 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 _0x6c3c=['ShowSugarcrmAccount','util','moment','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','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','include','model','map','find'];(function(_0x23f046,_0x5cabce){var _0x5f4880=function(_0x48442d){while(--_0x48442d){_0x23f046['push'](_0x23f046['shift']());}};_0x5f4880(++_0x5cabce);}(_0x6c3c,0x199));var _0xc6c3=function(_0x33f12f,_0x879e83){_0x33f12f=_0x33f12f-0x0;var _0x548294=_0x6c3c[_0x33f12f];return _0x548294;};'use strict';var _=require('lodash');var util=require(_0xc6c3('0x0'));var moment=require(_0xc6c3('0x1'));var BPromise=require(_0xc6c3('0x2'));var rs=require(_0xc6c3('0x3'));var fs=require('fs');var Redis=require(_0xc6c3('0x4'));var db=require(_0xc6c3('0x5'))['db'];var utils=require(_0xc6c3('0x6'));var logger=require(_0xc6c3('0x7'))(_0xc6c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xc6c3('0x9'));var client=jayson['client'][_0xc6c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae6dc,_0x258934,_0x2e3a96){return new BPromise(function(_0x478313,_0x56ffe5){return client[_0xc6c3('0xb')](_0x2ae6dc,_0x2e3a96)[_0xc6c3('0xc')](function(_0x591ad9){logger[_0xc6c3('0xd')](_0xc6c3('0xe'),_0x258934,_0xc6c3('0xf'));logger[_0xc6c3('0x10')](_0xc6c3('0x11'),_0x258934,_0xc6c3('0xf'),JSON[_0xc6c3('0x12')](_0x591ad9));if(_0x591ad9['error']){if(_0x591ad9[_0xc6c3('0x13')][_0xc6c3('0x14')]===0x1f4){logger[_0xc6c3('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x258934,_0x591ad9[_0xc6c3('0x13')][_0xc6c3('0x15')]);return _0x56ffe5(_0x591ad9[_0xc6c3('0x13')][_0xc6c3('0x15')]);}logger[_0xc6c3('0x13')](_0xc6c3('0xe'),_0x258934,_0x591ad9[_0xc6c3('0x13')][_0xc6c3('0x15')]);return _0x478313(_0x591ad9[_0xc6c3('0x13')][_0xc6c3('0x15')]);}else{logger[_0xc6c3('0xd')](_0xc6c3('0xe'),_0x258934,_0xc6c3('0xf'));_0x478313(_0x591ad9['result'][_0xc6c3('0x15')]);}})[_0xc6c3('0x16')](function(_0x148bf1){logger[_0xc6c3('0x13')](_0xc6c3('0xe'),_0x258934,_0x148bf1);_0x56ffe5(_0x148bf1);});});}exports[_0xc6c3('0x17')]=function(_0x2ef7e8){var _0x2bcd86=this;return new Promise(function(_0x1f4a41,_0x203e26){return db[_0xc6c3('0x18')]['findAll']({'raw':_0x2ef7e8[_0xc6c3('0x19')]?_0x2ef7e8[_0xc6c3('0x19')][_0xc6c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ef7e8['options']?_0x2ef7e8[_0xc6c3('0x19')][_0xc6c3('0x1b')]||null:null,'attributes':_0x2ef7e8['options']?_0x2ef7e8['options'][_0xc6c3('0x1c')]||null:null,'limit':_0x2ef7e8[_0xc6c3('0x19')]?_0x2ef7e8[_0xc6c3('0x19')]['limit']||null:null,'include':_0x2ef7e8[_0xc6c3('0x19')]?_0x2ef7e8[_0xc6c3('0x19')][_0xc6c3('0x1d')]?_['map'](_0x2ef7e8[_0xc6c3('0x19')][_0xc6c3('0x1d')],function(_0x45fca9){return{'model':db[_0x45fca9[_0xc6c3('0x1e')]],'as':_0x45fca9['as'],'attributes':_0x45fca9[_0xc6c3('0x1c')],'include':_0x45fca9[_0xc6c3('0x1d')]?_[_0xc6c3('0x1f')](_0x45fca9[_0xc6c3('0x1d')],function(_0x20087a){return{'model':db[_0x20087a['model']],'as':_0x20087a['as'],'attributes':_0x20087a[_0xc6c3('0x1c')],'include':_0x20087a[_0xc6c3('0x1d')]?_[_0xc6c3('0x1f')](_0x20087a[_0xc6c3('0x1d')],function(_0x10db3c){return{'model':db[_0x10db3c['model']],'as':_0x10db3c['as'],'attributes':_0x10db3c[_0xc6c3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x184cb1){logger[_0xc6c3('0xd')](_0xc6c3('0x17'),_0x2ef7e8);logger[_0xc6c3('0x10')]('GetSugarcrmAccount',_0x2ef7e8,JSON[_0xc6c3('0x12')](_0x184cb1));_0x1f4a41(_0x184cb1);})[_0xc6c3('0x16')](function(_0x511ee2){logger[_0xc6c3('0x13')]('GetSugarcrmAccount',_0x511ee2[_0xc6c3('0x15')],_0x2ef7e8);_0x203e26(_0x2bcd86['error'](0x1f4,_0x511ee2[_0xc6c3('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x54bc3c){var _0x4a041d=this;return new Promise(function(_0x162b47,_0x1617e8){return db[_0xc6c3('0x18')][_0xc6c3('0x20')]({'raw':_0x54bc3c[_0xc6c3('0x19')]?_0x54bc3c[_0xc6c3('0x19')][_0xc6c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x54bc3c['options']?_0x54bc3c[_0xc6c3('0x19')][_0xc6c3('0x1b')]||null:null,'attributes':_0x54bc3c[_0xc6c3('0x19')]?_0x54bc3c[_0xc6c3('0x19')][_0xc6c3('0x1c')]||null:null,'include':_0x54bc3c['options']?_0x54bc3c[_0xc6c3('0x19')][_0xc6c3('0x1d')]?_['map'](_0x54bc3c[_0xc6c3('0x19')][_0xc6c3('0x1d')],function(_0x187969){return{'model':db[_0x187969[_0xc6c3('0x1e')]],'as':_0x187969['as'],'attributes':_0x187969[_0xc6c3('0x1c')],'include':_0x187969['include']?_[_0xc6c3('0x1f')](_0x187969[_0xc6c3('0x1d')],function(_0x5794fa){return{'model':db[_0x5794fa[_0xc6c3('0x1e')]],'as':_0x5794fa['as'],'attributes':_0x5794fa[_0xc6c3('0x1c')],'include':_0x5794fa[_0xc6c3('0x1d')]?_[_0xc6c3('0x1f')](_0x5794fa[_0xc6c3('0x1d')],function(_0x21d171){return{'model':db[_0x21d171['model']],'as':_0x21d171['as'],'attributes':_0x21d171[_0xc6c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc6c3('0xc')](function(_0x32ffbb){logger[_0xc6c3('0xd')]('ShowSugarcrmAccount',_0x54bc3c);logger['debug'](_0xc6c3('0x21'),_0x54bc3c,JSON[_0xc6c3('0x12')](_0x32ffbb));_0x162b47(_0x32ffbb);})['catch'](function(_0x5e9487){logger['error']('ShowSugarcrmAccount',_0x5e9487[_0xc6c3('0x15')],_0x54bc3c);_0x1617e8(_0x4a041d[_0xc6c3('0x13')](0x1f4,_0x5e9487[_0xc6c3('0x15')]));});});}; \ No newline at end of file +var _0x8200=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowSugarcrmAccount','find','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info'];(function(_0x5f387c,_0x3a7214){var _0x5232da=function(_0x450b77){while(--_0x450b77){_0x5f387c['push'](_0x5f387c['shift']());}};_0x5232da(++_0x3a7214);}(_0x8200,0x18d));var _0x0820=function(_0x1861a0,_0x2dc7ea){_0x1861a0=_0x1861a0-0x0;var _0x447f3f=_0x8200[_0x1861a0];return _0x447f3f;};'use strict';var _=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var moment=require('moment');var BPromise=require(_0x0820('0x2'));var rs=require(_0x0820('0x3'));var fs=require('fs');var Redis=require(_0x0820('0x4'));var db=require(_0x0820('0x5'))['db'];var utils=require(_0x0820('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0820('0x7'));var jayson=require(_0x0820('0x8'));var client=jayson['client'][_0x0820('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515bec,_0x15bacd,_0x2e943f){return new BPromise(function(_0x2ff4fa,_0x50eb3c){return client['request'](_0x515bec,_0x2e943f)['then'](function(_0x1d0b6d){logger[_0x0820('0xa')](_0x0820('0xb'),_0x15bacd,_0x0820('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x15bacd,_0x0820('0xc'),JSON[_0x0820('0xd')](_0x1d0b6d));if(_0x1d0b6d[_0x0820('0xe')]){if(_0x1d0b6d[_0x0820('0xe')][_0x0820('0xf')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x15bacd,_0x1d0b6d[_0x0820('0xe')][_0x0820('0x10')]);return _0x50eb3c(_0x1d0b6d[_0x0820('0xe')]['message']);}logger['error'](_0x0820('0xb'),_0x15bacd,_0x1d0b6d[_0x0820('0xe')][_0x0820('0x10')]);return _0x2ff4fa(_0x1d0b6d[_0x0820('0xe')][_0x0820('0x10')]);}else{logger[_0x0820('0xa')](_0x0820('0xb'),_0x15bacd,_0x0820('0xc'));_0x2ff4fa(_0x1d0b6d[_0x0820('0x11')][_0x0820('0x10')]);}})['catch'](function(_0x308eb9){logger[_0x0820('0xe')](_0x0820('0xb'),_0x15bacd,_0x308eb9);_0x50eb3c(_0x308eb9);});});}exports[_0x0820('0x12')]=function(_0x1c337a){var _0x23c41f=this;return new Promise(function(_0x167c18,_0x36d121){return db[_0x0820('0x13')][_0x0820('0x14')]({'raw':_0x1c337a['options']?_0x1c337a[_0x0820('0x15')][_0x0820('0x16')]===undefined?!![]:![]:!![],'where':_0x1c337a[_0x0820('0x15')]?_0x1c337a[_0x0820('0x15')][_0x0820('0x17')]||null:null,'attributes':_0x1c337a[_0x0820('0x15')]?_0x1c337a[_0x0820('0x15')][_0x0820('0x18')]||null:null,'limit':_0x1c337a[_0x0820('0x15')]?_0x1c337a['options'][_0x0820('0x19')]||null:null,'include':_0x1c337a['options']?_0x1c337a[_0x0820('0x15')]['include']?_[_0x0820('0x1a')](_0x1c337a[_0x0820('0x15')][_0x0820('0x1b')],function(_0x4b5320){return{'model':db[_0x4b5320[_0x0820('0x1c')]],'as':_0x4b5320['as'],'attributes':_0x4b5320[_0x0820('0x18')],'include':_0x4b5320[_0x0820('0x1b')]?_['map'](_0x4b5320['include'],function(_0x3502fa){return{'model':db[_0x3502fa['model']],'as':_0x3502fa['as'],'attributes':_0x3502fa[_0x0820('0x18')],'include':_0x3502fa[_0x0820('0x1b')]?_[_0x0820('0x1a')](_0x3502fa['include'],function(_0x1676eb){return{'model':db[_0x1676eb[_0x0820('0x1c')]],'as':_0x1676eb['as'],'attributes':_0x1676eb[_0x0820('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0820('0x1d')](function(_0x33179f){logger['info'](_0x0820('0x12'),_0x1c337a);logger['debug'](_0x0820('0x12'),_0x1c337a,JSON['stringify'](_0x33179f));_0x167c18(_0x33179f);})['catch'](function(_0x2ba042){logger[_0x0820('0xe')](_0x0820('0x12'),_0x2ba042[_0x0820('0x10')],_0x1c337a);_0x36d121(_0x23c41f['error'](0x1f4,_0x2ba042[_0x0820('0x10')]));});});};exports[_0x0820('0x1e')]=function(_0x2636e6){var _0x4dd0b5=this;return new Promise(function(_0x3353e3,_0x1372cd){return db['SugarcrmAccount'][_0x0820('0x1f')]({'raw':_0x2636e6[_0x0820('0x15')]?_0x2636e6[_0x0820('0x15')][_0x0820('0x16')]===undefined?!![]:![]:!![],'where':_0x2636e6['options']?_0x2636e6[_0x0820('0x15')]['where']||null:null,'attributes':_0x2636e6['options']?_0x2636e6['options'][_0x0820('0x18')]||null:null,'include':_0x2636e6[_0x0820('0x15')]?_0x2636e6['options'][_0x0820('0x1b')]?_['map'](_0x2636e6[_0x0820('0x15')]['include'],function(_0x48bb6d){return{'model':db[_0x48bb6d['model']],'as':_0x48bb6d['as'],'attributes':_0x48bb6d[_0x0820('0x18')],'include':_0x48bb6d[_0x0820('0x1b')]?_[_0x0820('0x1a')](_0x48bb6d[_0x0820('0x1b')],function(_0x45beeb){return{'model':db[_0x45beeb['model']],'as':_0x45beeb['as'],'attributes':_0x45beeb['attributes'],'include':_0x45beeb[_0x0820('0x1b')]?_[_0x0820('0x1a')](_0x45beeb[_0x0820('0x1b')],function(_0x419cb4){return{'model':db[_0x419cb4['model']],'as':_0x419cb4['as'],'attributes':_0x419cb4[_0x0820('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0820('0x1d')](function(_0xf250){logger[_0x0820('0xa')](_0x0820('0x1e'),_0x2636e6);logger[_0x0820('0x20')]('ShowSugarcrmAccount',_0x2636e6,JSON[_0x0820('0xd')](_0xf250));_0x3353e3(_0xf250);})[_0x0820('0x21')](function(_0x22278a){logger['error'](_0x0820('0x1e'),_0x22278a['message'],_0x2636e6);_0x1372cd(_0x4dd0b5['error'](0x1f4,_0x22278a[_0x0820('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ccbefa2..b704bad 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 _0xb496=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x23473a,_0x3989e5){var _0x4dea04=function(_0x324ca2){while(--_0x324ca2){_0x23473a['push'](_0x23473a['shift']());}};_0x4dea04(++_0x3989e5);}(_0xb496,0x15d));var _0x6b49=function(_0x95362,_0x325f2a){_0x95362=_0x95362-0x0;var _0x10c43a=_0xb496[_0x95362];return _0x10c43a;};'use strict';var multer=require(_0x6b49('0x0'));var util=require(_0x6b49('0x1'));var path=require(_0x6b49('0x2'));var timeout=require(_0x6b49('0x3'));var express=require('express');var router=express[_0x6b49('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b49('0x5'));var interaction=require(_0x6b49('0x6'));var config=require('../../config/environment');var controller=require(_0x6b49('0x7'));router[_0x6b49('0x8')]('/',auth['isAuthenticated'](),controller[_0x6b49('0x9')]);router[_0x6b49('0x8')](_0x6b49('0xa'),auth[_0x6b49('0xb')](),controller[_0x6b49('0xc')]);router['get'](_0x6b49('0xd'),auth[_0x6b49('0xb')](),controller['getFields']);router[_0x6b49('0x8')](_0x6b49('0xe'),auth[_0x6b49('0xb')](),controller[_0x6b49('0xf')]);router['get'](_0x6b49('0x10'),auth['isAuthenticated'](),controller[_0x6b49('0x11')]);router[_0x6b49('0x12')]('/',auth[_0x6b49('0xb')](),controller['create']);router[_0x6b49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6b49('0x14')]);router['delete']('/:id',auth[_0x6b49('0xb')](),controller[_0x6b49('0x15')]);module[_0x6b49('0x16')]=router; \ No newline at end of file +var _0xbfb5=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfb5,0x146));var _0x5bfb=function(_0x3d0975,_0x320b36){_0x3d0975=_0x3d0975-0x0;var _0x3ac3d5=_0xbfb5[_0x3d0975];return _0x3ac3d5;};'use strict';var multer=require(_0x5bfb('0x0'));var util=require('util');var path=require(_0x5bfb('0x1'));var timeout=require(_0x5bfb('0x2'));var express=require('express');var router=express[_0x5bfb('0x3')]();var fs_extra=require(_0x5bfb('0x4'));var auth=require(_0x5bfb('0x5'));var interaction=require(_0x5bfb('0x6'));var config=require(_0x5bfb('0x7'));var controller=require(_0x5bfb('0x8'));router['get']('/',auth[_0x5bfb('0x9')](),controller[_0x5bfb('0xa')]);router[_0x5bfb('0xb')](_0x5bfb('0xc'),auth[_0x5bfb('0x9')](),controller[_0x5bfb('0xd')]);router['get'](_0x5bfb('0xe'),auth[_0x5bfb('0x9')](),controller[_0x5bfb('0xf')]);router[_0x5bfb('0xb')](_0x5bfb('0x10'),auth['isAuthenticated'](),controller[_0x5bfb('0x11')]);router[_0x5bfb('0xb')]('/:id/descriptions',auth[_0x5bfb('0x9')](),controller[_0x5bfb('0x12')]);router[_0x5bfb('0x13')]('/',auth[_0x5bfb('0x9')](),controller[_0x5bfb('0x14')]);router[_0x5bfb('0x15')](_0x5bfb('0xc'),auth[_0x5bfb('0x9')](),controller[_0x5bfb('0x16')]);router['delete'](_0x5bfb('0xc'),auth['isAuthenticated'](),controller[_0x5bfb('0x17')]);module[_0x5bfb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b3da0d4..12bab9c 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 _0x4eab=['exports','STRING','sequelize'];(function(_0x39e29f,_0x162ac9){var _0x193f1b=function(_0x19b168){while(--_0x19b168){_0x39e29f['push'](_0x39e29f['shift']());}};_0x193f1b(++_0x162ac9);}(_0x4eab,0x1a0));var _0xb4ea=function(_0x46cd2d,_0xdc9c91){_0x46cd2d=_0x46cd2d-0x0;var _0x58638b=_0x4eab[_0x46cd2d];return _0x58638b;};'use strict';var Sequelize=require(_0xb4ea('0x0'));module[_0xb4ea('0x1')]={'name':{'type':Sequelize[_0xb4ea('0x2')]},'description':{'type':Sequelize[_0xb4ea('0x2')]}}; \ No newline at end of file +var _0x9ecf=['sequelize','exports','STRING'];(function(_0x143b8f,_0x34492c){var _0x480fa6=function(_0x1c4d2c){while(--_0x1c4d2c){_0x143b8f['push'](_0x143b8f['shift']());}};_0x480fa6(++_0x34492c);}(_0x9ecf,0x123));var _0xf9ec=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x9ecf[_0x448bab];return _0x5dc534;};'use strict';var Sequelize=require(_0xf9ec('0x0'));module[_0xf9ec('0x1')]={'name':{'type':Sequelize[_0xf9ec('0x2')]},'description':{'type':Sequelize[_0xf9ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8ab48ae..46f1b2b 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 _0x479b=['pick','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','update','getFields','findOne','rawAttributes'];(function(_0x4f7122,_0x35e5e5){var _0x1d1053=function(_0x37fd91){while(--_0x37fd91){_0x4f7122['push'](_0x4f7122['shift']());}};_0x1d1053(++_0x35e5e5);}(_0x479b,0x1a3));var _0xb479=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x479b[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0xb479('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb479('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb479('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb479('0x3'));var util=require(_0xb479('0x4'));var path=require(_0xb479('0x5'));var sox=require('sox');var csv=require(_0xb479('0x6'));var ejs=require(_0xb479('0x7'));var fs=require('fs');var fs_extra=require(_0xb479('0x8'));var _=require(_0xb479('0x9'));var squel=require(_0xb479('0xa'));var crypto=require(_0xb479('0xb'));var jsforce=require(_0xb479('0xc'));var deskjs=require(_0xb479('0xd'));var toCsv=require(_0xb479('0x6'));var querystring=require(_0xb479('0xe'));var Papa=require(_0xb479('0xf'));var Redis=require(_0xb479('0x10'));var authService=require(_0xb479('0x11'));var qs=require(_0xb479('0x12'));var as=require(_0xb479('0x13'));var hardwareService=require(_0xb479('0x14'));var logger=require(_0xb479('0x15'))(_0xb479('0x16'));var utils=require(_0xb479('0x17'));var config=require(_0xb479('0x18'));var licenseUtil=require(_0xb479('0x19'));var db=require(_0xb479('0x1a'))['db'];function respondWithStatusCode(_0x4bbb2b,_0x1e1b06){_0x1e1b06=_0x1e1b06||0xcc;return function(_0x4ff729){if(_0x4ff729){return _0x4bbb2b['sendStatus'](_0x1e1b06);}return _0x4bbb2b[_0xb479('0x1b')](_0x1e1b06)[_0xb479('0x1c')]();};}function respondWithResult(_0x2fbb52,_0x2fbd90){_0x2fbd90=_0x2fbd90||0xc8;return function(_0x29400a){if(_0x29400a){return _0x2fbb52[_0xb479('0x1b')](_0x2fbd90)[_0xb479('0x1d')](_0x29400a);}};}function respondWithFilteredResult(_0x216fcc,_0x2a2c80){return function(_0x2e9985){if(_0x2e9985){var _0x297b95=typeof _0x2a2c80['offset']===_0xb479('0x1e')&&typeof _0x2a2c80['limit']===_0xb479('0x1e');var _0x5a063d=_0x2e9985[_0xb479('0x1f')];var _0x59a4a6=_0x297b95?0x0:_0x2a2c80['offset'];var _0x3595b5=_0x297b95?_0x2e9985[_0xb479('0x1f')]:_0x2a2c80[_0xb479('0x20')]+_0x2a2c80[_0xb479('0x21')];var _0xa3c9a1;if(_0x3595b5>=_0x5a063d){_0x3595b5=_0x5a063d;_0xa3c9a1=0xc8;}else{_0xa3c9a1=0xce;}_0x216fcc[_0xb479('0x1b')](_0xa3c9a1);return _0x216fcc['set']('Content-Range',_0x59a4a6+'-'+_0x3595b5+'/'+_0x5a063d)[_0xb479('0x1d')](_0x2e9985);}return null;};}function patchUpdates(_0x4b3b2b){return function(_0xd1c3a){try{jsonpatch[_0xb479('0x22')](_0xd1c3a,_0x4b3b2b,!![]);}catch(_0x502625){return BPromise[_0xb479('0x23')](_0x502625);}return _0xd1c3a['save']();};}function saveUpdates(_0x299cbc,_0x4252dd){return function(_0x4dfe0a){if(_0x4dfe0a){return _0x4dfe0a['update'](_0x299cbc)['then'](function(_0x4807cf){return _0x4807cf;});}return null;};}function removeEntity(_0x3f0c6f,_0x1a03df){return function(_0x7402c1){if(_0x7402c1){return _0x7402c1[_0xb479('0x24')]()[_0xb479('0x25')](function(){_0x3f0c6f[_0xb479('0x1b')](0xcc)[_0xb479('0x1c')]();});}};}function handleEntityNotFound(_0x3024b1,_0x49e8d2){return function(_0x2a8c52){if(!_0x2a8c52){_0x3024b1[_0xb479('0x26')](0x194);}return _0x2a8c52;};}function handleError(_0x153cb7,_0x26020b){_0x26020b=_0x26020b||0x1f4;return function(_0x597379){logger[_0xb479('0x27')](_0x597379[_0xb479('0x28')]);if(_0x597379[_0xb479('0x29')]){delete _0x597379['name'];}_0x153cb7['status'](_0x26020b)[_0xb479('0x2a')](_0x597379);};}exports[_0xb479('0x2b')]=function(_0x18bb0a,_0x2f51aa){var _0x55af7e={},_0x1349ae={},_0xc1b87f={'count':0x0,'rows':[]};var _0x3c2b51=_[_0xb479('0x2c')](db[_0xb479('0x2d')]['rawAttributes'],function(_0x568d34){return{'name':_0x568d34['fieldName'],'type':_0x568d34[_0xb479('0x2e')][_0xb479('0x2f')]};});_0x1349ae[_0xb479('0x30')]=_['map'](_0x3c2b51,_0xb479('0x29'));_0x1349ae[_0xb479('0x31')]=_[_0xb479('0x32')](_0x18bb0a[_0xb479('0x31')]);_0x1349ae[_0xb479('0x33')]=_[_0xb479('0x34')](_0x1349ae[_0xb479('0x30')],_0x1349ae[_0xb479('0x31')]);_0x55af7e[_0xb479('0x35')]=_[_0xb479('0x34')](_0x1349ae[_0xb479('0x30')],qs[_0xb479('0x36')](_0x18bb0a['query']['fields']));_0x55af7e[_0xb479('0x35')]=_0x55af7e[_0xb479('0x35')]['length']?_0x55af7e[_0xb479('0x35')]:_0x1349ae[_0xb479('0x30')];if(!_0x18bb0a[_0xb479('0x31')][_0xb479('0x37')](_0xb479('0x38'))){_0x55af7e['limit']=qs[_0xb479('0x21')](_0x18bb0a[_0xb479('0x31')][_0xb479('0x21')]);_0x55af7e[_0xb479('0x20')]=qs['offset'](_0x18bb0a['query'][_0xb479('0x20')]);}_0x55af7e[_0xb479('0x39')]=qs['sort'](_0x18bb0a[_0xb479('0x31')][_0xb479('0x3a')]);_0x55af7e['where']=qs[_0xb479('0x33')](_['pick'](_0x18bb0a[_0xb479('0x31')],_0x1349ae['filters']),_0x3c2b51);if(_0x18bb0a[_0xb479('0x31')][_0xb479('0x3b')]){_0x55af7e[_0xb479('0x3c')]=_[_0xb479('0x3d')](_0x55af7e['where'],{'$or':_[_0xb479('0x2c')](_0x3c2b51,function(_0xf34340){if(_0xf34340[_0xb479('0x2e')]!==_0xb479('0x3e')){var _0x298ec4={};_0x298ec4[_0xf34340['name']]={'$like':'%'+_0x18bb0a[_0xb479('0x31')][_0xb479('0x3b')]+'%'};return _0x298ec4;}})});}_0x55af7e=_[_0xb479('0x3d')]({},_0x55af7e,_0x18bb0a[_0xb479('0x3f')]);var _0x5d3908={'where':_0x55af7e['where']};return db[_0xb479('0x2d')]['count'](_0x5d3908)['then'](function(_0xd0dc5){_0xc1b87f['count']=_0xd0dc5;if(_0x18bb0a['query']['includeAll']){_0x55af7e[_0xb479('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xb479('0x41')](_0x55af7e);})[_0xb479('0x25')](function(_0x5d2595){_0xc1b87f[_0xb479('0x42')]=_0x5d2595;return _0xc1b87f;})[_0xb479('0x25')](respondWithFilteredResult(_0x2f51aa,_0x55af7e))['catch'](handleError(_0x2f51aa,null));};exports[_0xb479('0x43')]=function(_0x41186c,_0xddc98c){var _0x15ab19={'raw':![],'where':{'id':_0x41186c[_0xb479('0x44')]['id']}},_0x4a6059={};_0x4a6059['model']=_[_0xb479('0x32')](db['SugarcrmConfiguration']['rawAttributes']);_0x4a6059[_0xb479('0x31')]=_[_0xb479('0x32')](_0x41186c[_0xb479('0x31')]);_0x4a6059[_0xb479('0x33')]=_[_0xb479('0x34')](_0x4a6059[_0xb479('0x30')],_0x4a6059[_0xb479('0x31')]);_0x15ab19[_0xb479('0x35')]=_[_0xb479('0x34')](_0x4a6059[_0xb479('0x30')],qs['fields'](_0x41186c['query'][_0xb479('0x36')]));_0x15ab19[_0xb479('0x35')]=_0x15ab19[_0xb479('0x35')][_0xb479('0x45')]?_0x15ab19[_0xb479('0x35')]:_0x4a6059['model'];if(_0x41186c[_0xb479('0x31')][_0xb479('0x46')]){_0x15ab19[_0xb479('0x40')]=[{'all':!![]}];}_0x15ab19=_[_0xb479('0x3d')]({},_0x15ab19,_0x41186c[_0xb479('0x3f')]);return db[_0xb479('0x2d')][_0xb479('0x47')](_0x15ab19)[_0xb479('0x25')](handleEntityNotFound(_0xddc98c,null))['then'](respondWithResult(_0xddc98c,null))['catch'](handleError(_0xddc98c,null));};exports[_0xb479('0x48')]=function(_0x1ee564,_0x209a5d){return db[_0xb479('0x2d')][_0xb479('0x48')](_0x1ee564[_0xb479('0x49')],{})[_0xb479('0x25')](respondWithResult(_0x209a5d,0xc9))[_0xb479('0x4a')](handleError(_0x209a5d,null));};exports[_0xb479('0x4b')]=function(_0x5b51d1,_0x1399e9){if(_0x5b51d1['body']['id']){delete _0x5b51d1[_0xb479('0x49')]['id'];}return db[_0xb479('0x2d')][_0xb479('0x47')]({'where':{'id':_0x5b51d1[_0xb479('0x44')]['id']}})[_0xb479('0x25')](handleEntityNotFound(_0x1399e9,null))['then'](saveUpdates(_0x5b51d1['body'],null))[_0xb479('0x25')](respondWithResult(_0x1399e9,null))['catch'](handleError(_0x1399e9,null));};exports[_0xb479('0x24')]=function(_0x551c16,_0x1cbad6){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x551c16['params']['id']}})[_0xb479('0x25')](handleEntityNotFound(_0x1cbad6,null))[_0xb479('0x25')](removeEntity(_0x1cbad6,null))['catch'](handleError(_0x1cbad6,null));};exports[_0xb479('0x4c')]=function(_0x3fdf4d,_0x5c871b,_0x145036){var _0x4893f6={};var _0x3ff7b8={};var _0x56e6c3;var _0x124fa7;return db[_0xb479('0x2d')][_0xb479('0x4d')]({'where':{'id':_0x3fdf4d[_0xb479('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c871b,null))[_0xb479('0x25')](function(_0x36e4a8){if(_0x36e4a8){_0x56e6c3=_0x36e4a8;_0x3ff7b8[_0xb479('0x30')]=_[_0xb479('0x32')](db['SugarcrmField'][_0xb479('0x4e')]);_0x3ff7b8[_0xb479('0x31')]=_['keys'](_0x3fdf4d[_0xb479('0x31')]);_0x3ff7b8[_0xb479('0x33')]=_[_0xb479('0x34')](_0x3ff7b8[_0xb479('0x30')],_0x3ff7b8[_0xb479('0x31')]);_0x4893f6[_0xb479('0x35')]=_[_0xb479('0x34')](_0x3ff7b8[_0xb479('0x30')],qs['fields'](_0x3fdf4d[_0xb479('0x31')][_0xb479('0x36')]));_0x4893f6['attributes']=_0x4893f6[_0xb479('0x35')][_0xb479('0x45')]?_0x4893f6[_0xb479('0x35')]:_0x3ff7b8[_0xb479('0x30')];_0x4893f6[_0xb479('0x39')]=qs[_0xb479('0x3a')](_0x3fdf4d['query'][_0xb479('0x3a')]);_0x4893f6['where']=qs[_0xb479('0x33')](_[_0xb479('0x4f')](_0x3fdf4d[_0xb479('0x31')],_0x3ff7b8[_0xb479('0x33')]));if(_0x3fdf4d[_0xb479('0x31')][_0xb479('0x3b')]){_0x4893f6[_0xb479('0x3c')]=_['merge'](_0x4893f6[_0xb479('0x3c')],{'$or':_[_0xb479('0x2c')](_0x4893f6['attributes'],function(_0x5e2669){var _0x49b9a2={};_0x49b9a2[_0x5e2669]={'$like':'%'+_0x3fdf4d['query'][_0xb479('0x3b')]+'%'};return _0x49b9a2;})});}_0x4893f6=_['merge']({},_0x4893f6,_0x3fdf4d[_0xb479('0x3f')]);return _0x56e6c3[_0xb479('0x4c')](_0x4893f6);}})[_0xb479('0x25')](function(_0x591673){if(_0x591673){_0x124fa7=_0x591673[_0xb479('0x45')];if(!_0x3fdf4d['query']['hasOwnProperty'](_0xb479('0x38'))){_0x4893f6[_0xb479('0x21')]=qs[_0xb479('0x21')](_0x3fdf4d[_0xb479('0x31')][_0xb479('0x21')]);_0x4893f6['offset']=qs['offset'](_0x3fdf4d[_0xb479('0x31')][_0xb479('0x20')]);}return _0x56e6c3[_0xb479('0x4c')](_0x4893f6);}})[_0xb479('0x25')](function(_0x269d54){if(_0x269d54){return _0x269d54?{'count':_0x124fa7,'rows':_0x269d54}:null;}})[_0xb479('0x25')](respondWithResult(_0x5c871b,null))['catch'](handleError(_0x5c871b,null));};exports['getSubjects']=function(_0x4cf1eb,_0x14d3ce,_0x2c3485){var _0x2441b8={};var _0x53f97a={};var _0x376cfd;var _0x513528;return db['SugarcrmConfiguration'][_0xb479('0x4d')]({'where':{'id':_0x4cf1eb['params']['id']}})[_0xb479('0x25')](handleEntityNotFound(_0x14d3ce,null))[_0xb479('0x25')](function(_0x32e556){if(_0x32e556){_0x376cfd=_0x32e556;_0x53f97a['model']=_['keys'](db[_0xb479('0x50')][_0xb479('0x4e')]);_0x53f97a[_0xb479('0x31')]=_[_0xb479('0x32')](_0x4cf1eb[_0xb479('0x31')]);_0x53f97a[_0xb479('0x33')]=_['intersection'](_0x53f97a[_0xb479('0x30')],_0x53f97a['query']);_0x2441b8[_0xb479('0x35')]=_['intersection'](_0x53f97a[_0xb479('0x30')],qs[_0xb479('0x36')](_0x4cf1eb[_0xb479('0x31')][_0xb479('0x36')]));_0x2441b8[_0xb479('0x35')]=_0x2441b8[_0xb479('0x35')]['length']?_0x2441b8[_0xb479('0x35')]:_0x53f97a[_0xb479('0x30')];_0x2441b8[_0xb479('0x39')]=qs['sort'](_0x4cf1eb['query'][_0xb479('0x3a')]);_0x2441b8[_0xb479('0x3c')]=qs[_0xb479('0x33')](_[_0xb479('0x4f')](_0x4cf1eb[_0xb479('0x31')],_0x53f97a[_0xb479('0x33')]));if(_0x4cf1eb['query'][_0xb479('0x3b')]){_0x2441b8[_0xb479('0x3c')]=_[_0xb479('0x3d')](_0x2441b8[_0xb479('0x3c')],{'$or':_[_0xb479('0x2c')](_0x2441b8[_0xb479('0x35')],function(_0x4465d7){var _0xd50a6c={};_0xd50a6c[_0x4465d7]={'$like':'%'+_0x4cf1eb[_0xb479('0x31')]['filter']+'%'};return _0xd50a6c;})});}_0x2441b8=_[_0xb479('0x3d')]({},_0x2441b8,_0x4cf1eb[_0xb479('0x3f')]);return _0x376cfd[_0xb479('0x51')](_0x2441b8);}})[_0xb479('0x25')](function(_0x5468f0){if(_0x5468f0){_0x513528=_0x5468f0[_0xb479('0x45')];if(!_0x4cf1eb[_0xb479('0x31')][_0xb479('0x37')](_0xb479('0x38'))){_0x2441b8[_0xb479('0x21')]=qs[_0xb479('0x21')](_0x4cf1eb[_0xb479('0x31')][_0xb479('0x21')]);_0x2441b8['offset']=qs[_0xb479('0x20')](_0x4cf1eb[_0xb479('0x31')][_0xb479('0x20')]);}return _0x376cfd[_0xb479('0x51')](_0x2441b8);}})['then'](function(_0x44d721){if(_0x44d721){return _0x44d721?{'count':_0x513528,'rows':_0x44d721}:null;}})[_0xb479('0x25')](respondWithResult(_0x14d3ce,null))[_0xb479('0x4a')](handleError(_0x14d3ce,null));};exports[_0xb479('0x52')]=function(_0x365294,_0x1a07ac,_0x37d17a){var _0x676973={};var _0x317d6c={};var _0x242aa9;var _0x50cf15;return db[_0xb479('0x2d')][_0xb479('0x4d')]({'where':{'id':_0x365294[_0xb479('0x44')]['id']}})[_0xb479('0x25')](handleEntityNotFound(_0x1a07ac,null))[_0xb479('0x25')](function(_0x3747bd){if(_0x3747bd){_0x242aa9=_0x3747bd;_0x317d6c[_0xb479('0x30')]=_[_0xb479('0x32')](db[_0xb479('0x50')][_0xb479('0x4e')]);_0x317d6c['query']=_[_0xb479('0x32')](_0x365294[_0xb479('0x31')]);_0x317d6c[_0xb479('0x33')]=_[_0xb479('0x34')](_0x317d6c[_0xb479('0x30')],_0x317d6c[_0xb479('0x31')]);_0x676973[_0xb479('0x35')]=_[_0xb479('0x34')](_0x317d6c['model'],qs[_0xb479('0x36')](_0x365294['query'][_0xb479('0x36')]));_0x676973[_0xb479('0x35')]=_0x676973[_0xb479('0x35')]['length']?_0x676973[_0xb479('0x35')]:_0x317d6c[_0xb479('0x30')];_0x676973['order']=qs[_0xb479('0x3a')](_0x365294[_0xb479('0x31')]['sort']);_0x676973[_0xb479('0x3c')]=qs['filters'](_[_0xb479('0x4f')](_0x365294['query'],_0x317d6c[_0xb479('0x33')]));if(_0x365294[_0xb479('0x31')]['filter']){_0x676973['where']=_[_0xb479('0x3d')](_0x676973[_0xb479('0x3c')],{'$or':_[_0xb479('0x2c')](_0x676973[_0xb479('0x35')],function(_0x325a6a){var _0x3b7b77={};_0x3b7b77[_0x325a6a]={'$like':'%'+_0x365294[_0xb479('0x31')][_0xb479('0x3b')]+'%'};return _0x3b7b77;})});}_0x676973=_['merge']({},_0x676973,_0x365294[_0xb479('0x3f')]);return _0x242aa9[_0xb479('0x52')](_0x676973);}})[_0xb479('0x25')](function(_0xb8157a){if(_0xb8157a){_0x50cf15=_0xb8157a[_0xb479('0x45')];if(!_0x365294[_0xb479('0x31')][_0xb479('0x37')](_0xb479('0x38'))){_0x676973['limit']=qs['limit'](_0x365294['query'][_0xb479('0x21')]);_0x676973[_0xb479('0x20')]=qs[_0xb479('0x20')](_0x365294[_0xb479('0x31')][_0xb479('0x20')]);}return _0x242aa9['getDescriptions'](_0x676973);}})[_0xb479('0x25')](function(_0x382d30){if(_0x382d30){return _0x382d30?{'count':_0x50cf15,'rows':_0x382d30}:null;}})[_0xb479('0x25')](respondWithResult(_0x1a07ac,null))[_0xb479('0x4a')](handleError(_0x1a07ac,null));}; \ No newline at end of file +var _0x57bf=['save','then','destroy','error','name','index','map','SugarcrmConfiguration','type','key','keys','query','filters','model','fields','attributes','length','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','create','update','body','find','getFields','findOne','SugarcrmField','pick','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x57bf,0x7c));var _0xf57b=function(_0x8c7870,_0x322bd5){_0x8c7870=_0x8c7870-0x0;var _0x45ac68=_0x57bf[_0x8c7870];return _0x45ac68;};'use strict';var emlformat=require(_0xf57b('0x0'));var rimraf=require(_0xf57b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf57b('0x2'));var rp=require(_0xf57b('0x3'));var moment=require('moment');var BPromise=require(_0xf57b('0x4'));var Mustache=require(_0xf57b('0x5'));var util=require(_0xf57b('0x6'));var path=require(_0xf57b('0x7'));var sox=require(_0xf57b('0x8'));var csv=require(_0xf57b('0x9'));var ejs=require(_0xf57b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf57b('0xb'));var squel=require(_0xf57b('0xc'));var crypto=require(_0xf57b('0xd'));var jsforce=require(_0xf57b('0xe'));var deskjs=require(_0xf57b('0xf'));var toCsv=require(_0xf57b('0x9'));var querystring=require('querystring');var Papa=require(_0xf57b('0x10'));var Redis=require(_0xf57b('0x11'));var authService=require(_0xf57b('0x12'));var qs=require(_0xf57b('0x13'));var as=require(_0xf57b('0x14'));var hardwareService=require(_0xf57b('0x15'));var logger=require(_0xf57b('0x16'))(_0xf57b('0x17'));var utils=require(_0xf57b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf57b('0x19'))['db'];function respondWithStatusCode(_0x53261a,_0x23c645){_0x23c645=_0x23c645||0xcc;return function(_0x33f867){if(_0x33f867){return _0x53261a[_0xf57b('0x1a')](_0x23c645);}return _0x53261a[_0xf57b('0x1b')](_0x23c645)[_0xf57b('0x1c')]();};}function respondWithResult(_0x12a916,_0x1737f2){_0x1737f2=_0x1737f2||0xc8;return function(_0xa0589d){if(_0xa0589d){return _0x12a916[_0xf57b('0x1b')](_0x1737f2)[_0xf57b('0x1d')](_0xa0589d);}};}function respondWithFilteredResult(_0x3ac5ce,_0xe03705){return function(_0x367d40){if(_0x367d40){var _0x32b082=typeof _0xe03705[_0xf57b('0x1e')]===_0xf57b('0x1f')&&typeof _0xe03705[_0xf57b('0x20')]===_0xf57b('0x1f');var _0x5bcac2=_0x367d40[_0xf57b('0x21')];var _0x560ed2=_0x32b082?0x0:_0xe03705[_0xf57b('0x1e')];var _0x543a3b=_0x32b082?_0x367d40[_0xf57b('0x21')]:_0xe03705[_0xf57b('0x1e')]+_0xe03705[_0xf57b('0x20')];var _0x44925e;if(_0x543a3b>=_0x5bcac2){_0x543a3b=_0x5bcac2;_0x44925e=0xc8;}else{_0x44925e=0xce;}_0x3ac5ce[_0xf57b('0x1b')](_0x44925e);return _0x3ac5ce['set'](_0xf57b('0x22'),_0x560ed2+'-'+_0x543a3b+'/'+_0x5bcac2)['json'](_0x367d40);}return null;};}function patchUpdates(_0x5ac82e){return function(_0x55a63f){try{jsonpatch[_0xf57b('0x23')](_0x55a63f,_0x5ac82e,!![]);}catch(_0x49a386){return BPromise['reject'](_0x49a386);}return _0x55a63f[_0xf57b('0x24')]();};}function saveUpdates(_0x407415,_0x545da1){return function(_0x57b407){if(_0x57b407){return _0x57b407['update'](_0x407415)[_0xf57b('0x25')](function(_0x1ba306){return _0x1ba306;});}return null;};}function removeEntity(_0xda1760,_0x580f00){return function(_0x56b9ae){if(_0x56b9ae){return _0x56b9ae[_0xf57b('0x26')]()[_0xf57b('0x25')](function(){_0xda1760[_0xf57b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab422,_0x324bb4){return function(_0x40de45){if(!_0x40de45){_0x3ab422['sendStatus'](0x194);}return _0x40de45;};}function handleError(_0x4bf008,_0x343a7a){_0x343a7a=_0x343a7a||0x1f4;return function(_0x31141e){logger[_0xf57b('0x27')](_0x31141e['stack']);if(_0x31141e[_0xf57b('0x28')]){delete _0x31141e[_0xf57b('0x28')];}_0x4bf008['status'](_0x343a7a)['send'](_0x31141e);};}exports[_0xf57b('0x29')]=function(_0xfa28a7,_0x3eb0b9){var _0x2edf8c={},_0x4fb6b5={},_0x2a2817={'count':0x0,'rows':[]};var _0x42c082=_[_0xf57b('0x2a')](db[_0xf57b('0x2b')]['rawAttributes'],function(_0x42ed20){return{'name':_0x42ed20['fieldName'],'type':_0x42ed20[_0xf57b('0x2c')][_0xf57b('0x2d')]};});_0x4fb6b5['model']=_[_0xf57b('0x2a')](_0x42c082,'name');_0x4fb6b5['query']=_[_0xf57b('0x2e')](_0xfa28a7[_0xf57b('0x2f')]);_0x4fb6b5[_0xf57b('0x30')]=_['intersection'](_0x4fb6b5[_0xf57b('0x31')],_0x4fb6b5[_0xf57b('0x2f')]);_0x2edf8c['attributes']=_['intersection'](_0x4fb6b5[_0xf57b('0x31')],qs[_0xf57b('0x32')](_0xfa28a7[_0xf57b('0x2f')][_0xf57b('0x32')]));_0x2edf8c[_0xf57b('0x33')]=_0x2edf8c[_0xf57b('0x33')][_0xf57b('0x34')]?_0x2edf8c['attributes']:_0x4fb6b5['model'];if(!_0xfa28a7[_0xf57b('0x2f')]['hasOwnProperty']('nolimit')){_0x2edf8c[_0xf57b('0x20')]=qs[_0xf57b('0x20')](_0xfa28a7[_0xf57b('0x2f')][_0xf57b('0x20')]);_0x2edf8c[_0xf57b('0x1e')]=qs[_0xf57b('0x1e')](_0xfa28a7[_0xf57b('0x2f')][_0xf57b('0x1e')]);}_0x2edf8c[_0xf57b('0x35')]=qs[_0xf57b('0x36')](_0xfa28a7[_0xf57b('0x2f')][_0xf57b('0x36')]);_0x2edf8c['where']=qs[_0xf57b('0x30')](_['pick'](_0xfa28a7[_0xf57b('0x2f')],_0x4fb6b5[_0xf57b('0x30')]),_0x42c082);if(_0xfa28a7['query'][_0xf57b('0x37')]){_0x2edf8c[_0xf57b('0x38')]=_[_0xf57b('0x39')](_0x2edf8c['where'],{'$or':_[_0xf57b('0x2a')](_0x42c082,function(_0x48ac2c){if(_0x48ac2c[_0xf57b('0x2c')]!==_0xf57b('0x3a')){var _0x457073={};_0x457073[_0x48ac2c[_0xf57b('0x28')]]={'$like':'%'+_0xfa28a7['query']['filter']+'%'};return _0x457073;}})});}_0x2edf8c=_[_0xf57b('0x39')]({},_0x2edf8c,_0xfa28a7['options']);var _0x33e5ed={'where':_0x2edf8c[_0xf57b('0x38')]};return db[_0xf57b('0x2b')][_0xf57b('0x21')](_0x33e5ed)[_0xf57b('0x25')](function(_0x2adfb7){_0x2a2817[_0xf57b('0x21')]=_0x2adfb7;if(_0xfa28a7[_0xf57b('0x2f')][_0xf57b('0x3b')]){_0x2edf8c[_0xf57b('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf57b('0x3d')](_0x2edf8c);})[_0xf57b('0x25')](function(_0x27e7b4){_0x2a2817['rows']=_0x27e7b4;return _0x2a2817;})['then'](respondWithFilteredResult(_0x3eb0b9,_0x2edf8c))[_0xf57b('0x3e')](handleError(_0x3eb0b9,null));};exports[_0xf57b('0x3f')]=function(_0x4a0d9e,_0x377822){var _0x5bcabc={'raw':![],'where':{'id':_0x4a0d9e[_0xf57b('0x40')]['id']}},_0x9799a3={};_0x9799a3[_0xf57b('0x31')]=_[_0xf57b('0x2e')](db[_0xf57b('0x2b')][_0xf57b('0x41')]);_0x9799a3['query']=_[_0xf57b('0x2e')](_0x4a0d9e['query']);_0x9799a3[_0xf57b('0x30')]=_['intersection'](_0x9799a3[_0xf57b('0x31')],_0x9799a3[_0xf57b('0x2f')]);_0x5bcabc[_0xf57b('0x33')]=_[_0xf57b('0x42')](_0x9799a3[_0xf57b('0x31')],qs[_0xf57b('0x32')](_0x4a0d9e['query'][_0xf57b('0x32')]));_0x5bcabc[_0xf57b('0x33')]=_0x5bcabc['attributes'][_0xf57b('0x34')]?_0x5bcabc[_0xf57b('0x33')]:_0x9799a3[_0xf57b('0x31')];if(_0x4a0d9e[_0xf57b('0x2f')]['includeAll']){_0x5bcabc[_0xf57b('0x3c')]=[{'all':!![]}];}_0x5bcabc=_['merge']({},_0x5bcabc,_0x4a0d9e['options']);return db['SugarcrmConfiguration']['find'](_0x5bcabc)['then'](handleEntityNotFound(_0x377822,null))[_0xf57b('0x25')](respondWithResult(_0x377822,null))[_0xf57b('0x3e')](handleError(_0x377822,null));};exports[_0xf57b('0x43')]=function(_0x5dcbc3,_0x6fc5c3){return db[_0xf57b('0x2b')][_0xf57b('0x43')](_0x5dcbc3['body'],{})[_0xf57b('0x25')](respondWithResult(_0x6fc5c3,0xc9))[_0xf57b('0x3e')](handleError(_0x6fc5c3,null));};exports[_0xf57b('0x44')]=function(_0x3e4212,_0xbbe3ea){if(_0x3e4212[_0xf57b('0x45')]['id']){delete _0x3e4212[_0xf57b('0x45')]['id'];}return db[_0xf57b('0x2b')][_0xf57b('0x46')]({'where':{'id':_0x3e4212['params']['id']}})[_0xf57b('0x25')](handleEntityNotFound(_0xbbe3ea,null))['then'](saveUpdates(_0x3e4212[_0xf57b('0x45')],null))[_0xf57b('0x25')](respondWithResult(_0xbbe3ea,null))['catch'](handleError(_0xbbe3ea,null));};exports[_0xf57b('0x26')]=function(_0x49fdd1,_0x2dfabf){return db[_0xf57b('0x2b')]['find']({'where':{'id':_0x49fdd1['params']['id']}})[_0xf57b('0x25')](handleEntityNotFound(_0x2dfabf,null))['then'](removeEntity(_0x2dfabf,null))[_0xf57b('0x3e')](handleError(_0x2dfabf,null));};exports[_0xf57b('0x47')]=function(_0xf9cefb,_0x3c86a5,_0x2aa7a8){var _0x3db80c={};var _0x2303d3={};var _0xf64ab0;var _0x5c3541;return db[_0xf57b('0x2b')][_0xf57b('0x48')]({'where':{'id':_0xf9cefb['params']['id']}})[_0xf57b('0x25')](handleEntityNotFound(_0x3c86a5,null))[_0xf57b('0x25')](function(_0x21869f){if(_0x21869f){_0xf64ab0=_0x21869f;_0x2303d3[_0xf57b('0x31')]=_['keys'](db[_0xf57b('0x49')]['rawAttributes']);_0x2303d3['query']=_['keys'](_0xf9cefb[_0xf57b('0x2f')]);_0x2303d3[_0xf57b('0x30')]=_[_0xf57b('0x42')](_0x2303d3[_0xf57b('0x31')],_0x2303d3['query']);_0x3db80c[_0xf57b('0x33')]=_[_0xf57b('0x42')](_0x2303d3[_0xf57b('0x31')],qs[_0xf57b('0x32')](_0xf9cefb[_0xf57b('0x2f')]['fields']));_0x3db80c[_0xf57b('0x33')]=_0x3db80c[_0xf57b('0x33')][_0xf57b('0x34')]?_0x3db80c[_0xf57b('0x33')]:_0x2303d3[_0xf57b('0x31')];_0x3db80c[_0xf57b('0x35')]=qs[_0xf57b('0x36')](_0xf9cefb[_0xf57b('0x2f')]['sort']);_0x3db80c[_0xf57b('0x38')]=qs[_0xf57b('0x30')](_[_0xf57b('0x4a')](_0xf9cefb['query'],_0x2303d3[_0xf57b('0x30')]));if(_0xf9cefb[_0xf57b('0x2f')]['filter']){_0x3db80c['where']=_[_0xf57b('0x39')](_0x3db80c[_0xf57b('0x38')],{'$or':_[_0xf57b('0x2a')](_0x3db80c[_0xf57b('0x33')],function(_0x2a1865){var _0x3a7689={};_0x3a7689[_0x2a1865]={'$like':'%'+_0xf9cefb[_0xf57b('0x2f')][_0xf57b('0x37')]+'%'};return _0x3a7689;})});}_0x3db80c=_[_0xf57b('0x39')]({},_0x3db80c,_0xf9cefb[_0xf57b('0x4b')]);return _0xf64ab0[_0xf57b('0x47')](_0x3db80c);}})[_0xf57b('0x25')](function(_0x3685c5){if(_0x3685c5){_0x5c3541=_0x3685c5[_0xf57b('0x34')];if(!_0xf9cefb[_0xf57b('0x2f')][_0xf57b('0x4c')](_0xf57b('0x4d'))){_0x3db80c[_0xf57b('0x20')]=qs[_0xf57b('0x20')](_0xf9cefb['query'][_0xf57b('0x20')]);_0x3db80c[_0xf57b('0x1e')]=qs['offset'](_0xf9cefb[_0xf57b('0x2f')][_0xf57b('0x1e')]);}return _0xf64ab0[_0xf57b('0x47')](_0x3db80c);}})[_0xf57b('0x25')](function(_0x2e0a6e){if(_0x2e0a6e){return _0x2e0a6e?{'count':_0x5c3541,'rows':_0x2e0a6e}:null;}})[_0xf57b('0x25')](respondWithResult(_0x3c86a5,null))[_0xf57b('0x3e')](handleError(_0x3c86a5,null));};exports[_0xf57b('0x4e')]=function(_0x4d3ddf,_0x5ac1b4,_0x534530){var _0x529a5c={};var _0x441548={};var _0x362a5d;var _0x1f5d4e;return db[_0xf57b('0x2b')][_0xf57b('0x48')]({'where':{'id':_0x4d3ddf[_0xf57b('0x40')]['id']}})[_0xf57b('0x25')](handleEntityNotFound(_0x5ac1b4,null))[_0xf57b('0x25')](function(_0x44a1c8){if(_0x44a1c8){_0x362a5d=_0x44a1c8;_0x441548['model']=_['keys'](db[_0xf57b('0x49')][_0xf57b('0x41')]);_0x441548[_0xf57b('0x2f')]=_[_0xf57b('0x2e')](_0x4d3ddf[_0xf57b('0x2f')]);_0x441548[_0xf57b('0x30')]=_[_0xf57b('0x42')](_0x441548['model'],_0x441548[_0xf57b('0x2f')]);_0x529a5c[_0xf57b('0x33')]=_[_0xf57b('0x42')](_0x441548['model'],qs[_0xf57b('0x32')](_0x4d3ddf[_0xf57b('0x2f')]['fields']));_0x529a5c[_0xf57b('0x33')]=_0x529a5c['attributes']['length']?_0x529a5c[_0xf57b('0x33')]:_0x441548[_0xf57b('0x31')];_0x529a5c[_0xf57b('0x35')]=qs['sort'](_0x4d3ddf[_0xf57b('0x2f')][_0xf57b('0x36')]);_0x529a5c['where']=qs[_0xf57b('0x30')](_[_0xf57b('0x4a')](_0x4d3ddf[_0xf57b('0x2f')],_0x441548[_0xf57b('0x30')]));if(_0x4d3ddf[_0xf57b('0x2f')][_0xf57b('0x37')]){_0x529a5c[_0xf57b('0x38')]=_[_0xf57b('0x39')](_0x529a5c['where'],{'$or':_[_0xf57b('0x2a')](_0x529a5c['attributes'],function(_0x4b0e9e){var _0x231fba={};_0x231fba[_0x4b0e9e]={'$like':'%'+_0x4d3ddf['query'][_0xf57b('0x37')]+'%'};return _0x231fba;})});}_0x529a5c=_[_0xf57b('0x39')]({},_0x529a5c,_0x4d3ddf[_0xf57b('0x4b')]);return _0x362a5d['getSubjects'](_0x529a5c);}})['then'](function(_0x2b4db2){if(_0x2b4db2){_0x1f5d4e=_0x2b4db2[_0xf57b('0x34')];if(!_0x4d3ddf['query'][_0xf57b('0x4c')](_0xf57b('0x4d'))){_0x529a5c[_0xf57b('0x20')]=qs[_0xf57b('0x20')](_0x4d3ddf[_0xf57b('0x2f')]['limit']);_0x529a5c[_0xf57b('0x1e')]=qs[_0xf57b('0x1e')](_0x4d3ddf['query']['offset']);}return _0x362a5d[_0xf57b('0x4e')](_0x529a5c);}})[_0xf57b('0x25')](function(_0x58f4c1){if(_0x58f4c1){return _0x58f4c1?{'count':_0x1f5d4e,'rows':_0x58f4c1}:null;}})[_0xf57b('0x25')](respondWithResult(_0x5ac1b4,null))[_0xf57b('0x3e')](handleError(_0x5ac1b4,null));};exports['getDescriptions']=function(_0x34ac35,_0x425aef,_0x237b3e){var _0x42dace={};var _0x3ae201={};var _0x10c83a;var _0x2b1f90;return db[_0xf57b('0x2b')][_0xf57b('0x48')]({'where':{'id':_0x34ac35[_0xf57b('0x40')]['id']}})[_0xf57b('0x25')](handleEntityNotFound(_0x425aef,null))['then'](function(_0x2de635){if(_0x2de635){_0x10c83a=_0x2de635;_0x3ae201['model']=_[_0xf57b('0x2e')](db['SugarcrmField'][_0xf57b('0x41')]);_0x3ae201['query']=_[_0xf57b('0x2e')](_0x34ac35['query']);_0x3ae201[_0xf57b('0x30')]=_[_0xf57b('0x42')](_0x3ae201[_0xf57b('0x31')],_0x3ae201[_0xf57b('0x2f')]);_0x42dace[_0xf57b('0x33')]=_[_0xf57b('0x42')](_0x3ae201[_0xf57b('0x31')],qs['fields'](_0x34ac35[_0xf57b('0x2f')][_0xf57b('0x32')]));_0x42dace[_0xf57b('0x33')]=_0x42dace[_0xf57b('0x33')][_0xf57b('0x34')]?_0x42dace[_0xf57b('0x33')]:_0x3ae201[_0xf57b('0x31')];_0x42dace[_0xf57b('0x35')]=qs[_0xf57b('0x36')](_0x34ac35['query'][_0xf57b('0x36')]);_0x42dace[_0xf57b('0x38')]=qs['filters'](_[_0xf57b('0x4a')](_0x34ac35['query'],_0x3ae201[_0xf57b('0x30')]));if(_0x34ac35[_0xf57b('0x2f')]['filter']){_0x42dace[_0xf57b('0x38')]=_[_0xf57b('0x39')](_0x42dace['where'],{'$or':_[_0xf57b('0x2a')](_0x42dace['attributes'],function(_0x56b77f){var _0x6c55ba={};_0x6c55ba[_0x56b77f]={'$like':'%'+_0x34ac35[_0xf57b('0x2f')][_0xf57b('0x37')]+'%'};return _0x6c55ba;})});}_0x42dace=_[_0xf57b('0x39')]({},_0x42dace,_0x34ac35[_0xf57b('0x4b')]);return _0x10c83a[_0xf57b('0x4f')](_0x42dace);}})[_0xf57b('0x25')](function(_0x29b050){if(_0x29b050){_0x2b1f90=_0x29b050['length'];if(!_0x34ac35[_0xf57b('0x2f')][_0xf57b('0x4c')](_0xf57b('0x4d'))){_0x42dace[_0xf57b('0x20')]=qs['limit'](_0x34ac35[_0xf57b('0x2f')][_0xf57b('0x20')]);_0x42dace[_0xf57b('0x1e')]=qs['offset'](_0x34ac35[_0xf57b('0x2f')][_0xf57b('0x1e')]);}return _0x10c83a[_0xf57b('0x4f')](_0x42dace);}})['then'](function(_0x4cea53){if(_0x4cea53){return _0x4cea53?{'count':_0x2b1f90,'rows':_0x4cea53}:null;}})['then'](respondWithResult(_0x425aef,null))[_0xf57b('0x3e')](handleError(_0x425aef,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3e324b8..da18b3d 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 _0x60d1=['request-promise','path','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird'];(function(_0x1a2625,_0x533673){var _0x5281df=function(_0x429912){while(--_0x429912){_0x1a2625['push'](_0x1a2625['shift']());}};_0x5281df(++_0x533673);}(_0x60d1,0x74));var _0x160d=function(_0x3701f5,_0x5ddcca){_0x3701f5=_0x3701f5-0x0;var _0x2b837f=_0x60d1[_0x3701f5];return _0x2b837f;};'use strict';var _=require(_0x160d('0x0'));var util=require('util');var logger=require(_0x160d('0x1'))(_0x160d('0x2'));var moment=require('moment');var BPromise=require(_0x160d('0x3'));var rp=require(_0x160d('0x4'));var fs=require('fs');var path=require(_0x160d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x160d('0x6'));module['exports']=function(_0x3fa6ea,_0xeeb5ad){return _0x3fa6ea[_0x160d('0x7')](_0x160d('0x8'),attributes,{'tableName':_0x160d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1f9=['bluebird','request-promise','path','rimraf','exports','lodash','moment'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xe1f9,0x1c5));var _0x9e1f=function(_0x3a9c46,_0x4a7f3f){_0x3a9c46=_0x3a9c46-0x0;var _0x2aee82=_0xe1f9[_0x3a9c46];return _0x2aee82;};'use strict';var _=require(_0x9e1f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9e1f('0x1'));var BPromise=require(_0x9e1f('0x2'));var rp=require(_0x9e1f('0x3'));var fs=require('fs');var path=require(_0x9e1f('0x4'));var rimraf=require(_0x9e1f('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x9e1f('0x6')]=function(_0x490508,_0x5758bc){return _0x490508['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index bb9ef45..2798c98 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 _0xf1f6=['client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x243a87,_0x58a169){var _0x1138dc=function(_0x10f2ba){while(--_0x10f2ba){_0x243a87['push'](_0x243a87['shift']());}};_0x1138dc(++_0x58a169);}(_0xf1f6,0x6f));var _0x6f1f=function(_0x5e2290,_0x492bf8){_0x5e2290=_0x5e2290-0x0;var _0x5ba0c7=_0xf1f6[_0x5e2290];return _0x5ba0c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f1f('0x0'));var BPromise=require(_0x6f1f('0x1'));var rs=require(_0x6f1f('0x2'));var fs=require('fs');var Redis=require(_0x6f1f('0x3'));var db=require(_0x6f1f('0x4'))['db'];var utils=require(_0x6f1f('0x5'));var logger=require('../../config/logger')(_0x6f1f('0x6'));var config=require(_0x6f1f('0x7'));var jayson=require(_0x6f1f('0x8'));var client=jayson[_0x6f1f('0x9')][_0x6f1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaf78,_0x11c962,_0x122539){return new BPromise(function(_0x4f18ed,_0x3c82ea){return client['request'](_0x4aaf78,_0x122539)[_0x6f1f('0xb')](function(_0x25a4c9){logger[_0x6f1f('0xc')](_0x6f1f('0xd'),_0x11c962,_0x6f1f('0xe'));logger['debug'](_0x6f1f('0xf'),_0x11c962,_0x6f1f('0xe'),JSON['stringify'](_0x25a4c9));if(_0x25a4c9[_0x6f1f('0x10')]){if(_0x25a4c9['error']['code']===0x1f4){logger['error'](_0x6f1f('0xd'),_0x11c962,_0x25a4c9['error'][_0x6f1f('0x11')]);return _0x3c82ea(_0x25a4c9[_0x6f1f('0x10')][_0x6f1f('0x11')]);}logger[_0x6f1f('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x11c962,_0x25a4c9[_0x6f1f('0x10')]['message']);return _0x4f18ed(_0x25a4c9[_0x6f1f('0x10')][_0x6f1f('0x11')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x11c962,_0x6f1f('0xe'));_0x4f18ed(_0x25a4c9[_0x6f1f('0x12')]['message']);}})[_0x6f1f('0x13')](function(_0x220b77){logger['error'](_0x6f1f('0xd'),_0x11c962,_0x220b77);_0x3c82ea(_0x220b77);});});} \ No newline at end of file +var _0xc4e6=['../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x50b618,_0x2c2aec){var _0x811a9a=function(_0x32ce53){while(--_0x32ce53){_0x50b618['push'](_0x50b618['shift']());}};_0x811a9a(++_0x2c2aec);}(_0xc4e6,0xf5));var _0x6c4e=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xc4e6[_0x4a7e98];return _0x27d10d;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var moment=require(_0x6c4e('0x2'));var BPromise=require(_0x6c4e('0x3'));var rs=require(_0x6c4e('0x4'));var fs=require('fs');var Redis=require('ioredis');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(_0x6c4e('0x9'));var client=jayson[_0x6c4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53beb3,_0x456405,_0x1345db){return new BPromise(function(_0x30ca2a,_0x3685d0){return client[_0x6c4e('0xb')](_0x53beb3,_0x1345db)[_0x6c4e('0xc')](function(_0x27723b){logger[_0x6c4e('0xd')](_0x6c4e('0xe'),_0x456405,'request\x20sent');logger[_0x6c4e('0xf')](_0x6c4e('0x10'),_0x456405,_0x6c4e('0x11'),JSON[_0x6c4e('0x12')](_0x27723b));if(_0x27723b[_0x6c4e('0x13')]){if(_0x27723b[_0x6c4e('0x13')][_0x6c4e('0x14')]===0x1f4){logger['error'](_0x6c4e('0xe'),_0x456405,_0x27723b[_0x6c4e('0x13')][_0x6c4e('0x15')]);return _0x3685d0(_0x27723b[_0x6c4e('0x13')]['message']);}logger['error'](_0x6c4e('0xe'),_0x456405,_0x27723b[_0x6c4e('0x13')][_0x6c4e('0x15')]);return _0x30ca2a(_0x27723b['error']['message']);}else{logger['info'](_0x6c4e('0xe'),_0x456405,_0x6c4e('0x11'));_0x30ca2a(_0x27723b['result'][_0x6c4e('0x15')]);}})[_0x6c4e('0x16')](function(_0x2aa2d6){logger[_0x6c4e('0x13')](_0x6c4e('0xe'),_0x456405,_0x2aa2d6);_0x3685d0(_0x2aa2d6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c4d9a60..546eb7d 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 _0x08e4=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','create','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x08e4,0x1bb));var _0x408e=function(_0x3278f3,_0x393931){_0x3278f3=_0x3278f3-0x0;var _0x2b0048=_0x08e4[_0x3278f3];return _0x2b0048;};'use strict';var multer=require(_0x408e('0x0'));var util=require(_0x408e('0x1'));var path=require(_0x408e('0x2'));var timeout=require(_0x408e('0x3'));var express=require('express');var router=express[_0x408e('0x4')]();var fs_extra=require(_0x408e('0x5'));var auth=require(_0x408e('0x6'));var interaction=require(_0x408e('0x7'));var config=require(_0x408e('0x8'));var controller=require(_0x408e('0x9'));router[_0x408e('0xa')]('/',auth[_0x408e('0xb')](),controller[_0x408e('0xc')]);router[_0x408e('0xa')]('/:id',auth[_0x408e('0xb')](),controller[_0x408e('0xd')]);router['post']('/',auth[_0x408e('0xb')](),controller[_0x408e('0xe')]);router['put'](_0x408e('0xf'),auth[_0x408e('0xb')](),controller['update']);router['delete'](_0x408e('0xf'),auth['isAuthenticated'](),controller[_0x408e('0x10')]);module[_0x408e('0x11')]=router; \ No newline at end of file +var _0xc8bd=['fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x144616,_0x1188de){var _0x100e2f=function(_0x35d543){while(--_0x35d543){_0x144616['push'](_0x144616['shift']());}};_0x100e2f(++_0x1188de);}(_0xc8bd,0x14a));var _0xdc8b=function(_0x5332b1,_0x192941){_0x5332b1=_0x5332b1-0x0;var _0x129b49=_0xc8bd[_0x5332b1];return _0x129b49;};'use strict';var multer=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var path=require(_0xdc8b('0x2'));var timeout=require(_0xdc8b('0x3'));var express=require(_0xdc8b('0x4'));var router=express[_0xdc8b('0x5')]();var fs_extra=require(_0xdc8b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdc8b('0x7'));var config=require(_0xdc8b('0x8'));var controller=require(_0xdc8b('0x9'));router[_0xdc8b('0xa')]('/',auth[_0xdc8b('0xb')](),controller['index']);router[_0xdc8b('0xa')](_0xdc8b('0xc'),auth[_0xdc8b('0xb')](),controller[_0xdc8b('0xd')]);router[_0xdc8b('0xe')]('/',auth['isAuthenticated'](),controller[_0xdc8b('0xf')]);router[_0xdc8b('0x10')](_0xdc8b('0xc'),auth[_0xdc8b('0xb')](),controller[_0xdc8b('0x11')]);router[_0xdc8b('0x12')](_0xdc8b('0xc'),auth[_0xdc8b('0xb')](),controller[_0xdc8b('0x13')]);module[_0xdc8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 624a2d8..e322ee6 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 _0xcd15=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xcd15,0x65));var _0x5cd1=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0xcd15[_0x267d8d];return _0x11a98f;};'use strict';var Sequelize=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'type':{'type':Sequelize[_0x5cd1('0x2')]('string',_0x5cd1('0x3'),'customVariable',_0x5cd1('0x4'),_0x5cd1('0x5')),'defaultValue':_0x5cd1('0x6')},'content':{'type':Sequelize[_0x5cd1('0x7')]},'key':{'type':Sequelize[_0x5cd1('0x7')]},'keyType':{'type':Sequelize[_0x5cd1('0x2')](_0x5cd1('0x6'),_0x5cd1('0x3'),_0x5cd1('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5cd1('0x7')]},'customField':{'type':Sequelize[_0x5cd1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cd1('0x7')]}}; \ No newline at end of file +var _0x80ec=['STRING','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x54aa34,_0x49e8ff){var _0x3d61e2=function(_0x2c0e14){while(--_0x2c0e14){_0x54aa34['push'](_0x54aa34['shift']());}};_0x3d61e2(++_0x49e8ff);}(_0x80ec,0x122));var _0xc80e=function(_0xfee7a,_0xdd3ac6){_0xfee7a=_0xfee7a-0x0;var _0x2b84a5=_0x80ec[_0xfee7a];return _0x2b84a5;};'use strict';var Sequelize=require(_0xc80e('0x0'));module['exports']={'type':{'type':Sequelize[_0xc80e('0x1')](_0xc80e('0x2'),'variable',_0xc80e('0x3'),_0xc80e('0x4'),_0xc80e('0x5')),'defaultValue':_0xc80e('0x2')},'content':{'type':Sequelize[_0xc80e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc80e('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc80e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc80e('0x6')]},'customField':{'type':Sequelize[_0xc80e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc80e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0a36e7d..32470a2 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 _0xc54f=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','SugarcrmField','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','merge','create','body','find','destroy','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc54f,0xc4));var _0xfc54=function(_0x276c16,_0xdf24a2){_0x276c16=_0x276c16-0x0;var _0x10c4eb=_0xc54f[_0x276c16];return _0x10c4eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc54('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc54('0x1'));var moment=require('moment');var BPromise=require(_0xfc54('0x2'));var Mustache=require(_0xfc54('0x3'));var util=require(_0xfc54('0x4'));var path=require(_0xfc54('0x5'));var sox=require(_0xfc54('0x6'));var csv=require('to-csv');var ejs=require(_0xfc54('0x7'));var fs=require('fs');var fs_extra=require(_0xfc54('0x8'));var _=require(_0xfc54('0x9'));var squel=require(_0xfc54('0xa'));var crypto=require(_0xfc54('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc54('0xc'));var querystring=require('querystring');var Papa=require(_0xfc54('0xd'));var Redis=require(_0xfc54('0xe'));var authService=require(_0xfc54('0xf'));var qs=require(_0xfc54('0x10'));var as=require(_0xfc54('0x11'));var hardwareService=require(_0xfc54('0x12'));var logger=require(_0xfc54('0x13'))(_0xfc54('0x14'));var utils=require(_0xfc54('0x15'));var config=require(_0xfc54('0x16'));var licenseUtil=require(_0xfc54('0x17'));var db=require(_0xfc54('0x18'))['db'];function respondWithStatusCode(_0x31aae1,_0x44e777){_0x44e777=_0x44e777||0xcc;return function(_0x1225d2){if(_0x1225d2){return _0x31aae1['sendStatus'](_0x44e777);}return _0x31aae1[_0xfc54('0x19')](_0x44e777)[_0xfc54('0x1a')]();};}function respondWithResult(_0x4c1b39,_0x42c276){_0x42c276=_0x42c276||0xc8;return function(_0x34499c){if(_0x34499c){return _0x4c1b39[_0xfc54('0x19')](_0x42c276)[_0xfc54('0x1b')](_0x34499c);}};}function respondWithFilteredResult(_0x34b285,_0xc9d4ca){return function(_0x5e68f6){if(_0x5e68f6){var _0x56d086=typeof _0xc9d4ca[_0xfc54('0x1c')]==='undefined'&&typeof _0xc9d4ca[_0xfc54('0x1d')]===_0xfc54('0x1e');var _0xf4b8b1=_0x5e68f6[_0xfc54('0x1f')];var _0x2fb881=_0x56d086?0x0:_0xc9d4ca['offset'];var _0x3711a1=_0x56d086?_0x5e68f6['count']:_0xc9d4ca[_0xfc54('0x1c')]+_0xc9d4ca[_0xfc54('0x1d')];var _0x102a38;if(_0x3711a1>=_0xf4b8b1){_0x3711a1=_0xf4b8b1;_0x102a38=0xc8;}else{_0x102a38=0xce;}_0x34b285['status'](_0x102a38);return _0x34b285[_0xfc54('0x20')]('Content-Range',_0x2fb881+'-'+_0x3711a1+'/'+_0xf4b8b1)['json'](_0x5e68f6);}return null;};}function patchUpdates(_0x552d8f){return function(_0x13dfc4){try{jsonpatch[_0xfc54('0x21')](_0x13dfc4,_0x552d8f,!![]);}catch(_0x236f29){return BPromise[_0xfc54('0x22')](_0x236f29);}return _0x13dfc4['save']();};}function saveUpdates(_0x34c5b2,_0x46244f){return function(_0x1b9e74){if(_0x1b9e74){return _0x1b9e74[_0xfc54('0x23')](_0x34c5b2)[_0xfc54('0x24')](function(_0x59a547){return _0x59a547;});}return null;};}function removeEntity(_0x3002ff,_0xaadfe8){return function(_0x5961f6){if(_0x5961f6){return _0x5961f6['destroy']()[_0xfc54('0x24')](function(){_0x3002ff[_0xfc54('0x19')](0xcc)[_0xfc54('0x1a')]();});}};}function handleEntityNotFound(_0x3bbbe6,_0x3fbd90){return function(_0x181d0c){if(!_0x181d0c){_0x3bbbe6['sendStatus'](0x194);}return _0x181d0c;};}function handleError(_0x3af947,_0x4731a2){_0x4731a2=_0x4731a2||0x1f4;return function(_0xe9bc72){logger[_0xfc54('0x25')](_0xe9bc72[_0xfc54('0x26')]);if(_0xe9bc72[_0xfc54('0x27')]){delete _0xe9bc72[_0xfc54('0x27')];}_0x3af947[_0xfc54('0x19')](_0x4731a2)['send'](_0xe9bc72);};}exports['index']=function(_0x31d5fc,_0x369c56){var _0x438335={},_0x681164={},_0x47071e={'count':0x0,'rows':[]};var _0x320b0a=_['map'](db[_0xfc54('0x28')][_0xfc54('0x29')],function(_0x2b1624){return{'name':_0x2b1624['fieldName'],'type':_0x2b1624[_0xfc54('0x2a')]['key']};});_0x681164[_0xfc54('0x2b')]=_['map'](_0x320b0a,_0xfc54('0x27'));_0x681164[_0xfc54('0x2c')]=_[_0xfc54('0x2d')](_0x31d5fc['query']);_0x681164['filters']=_['intersection'](_0x681164[_0xfc54('0x2b')],_0x681164[_0xfc54('0x2c')]);_0x438335[_0xfc54('0x2e')]=_['intersection'](_0x681164[_0xfc54('0x2b')],qs[_0xfc54('0x2f')](_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x2f')]));_0x438335[_0xfc54('0x2e')]=_0x438335[_0xfc54('0x2e')][_0xfc54('0x30')]?_0x438335[_0xfc54('0x2e')]:_0x681164[_0xfc54('0x2b')];if(!_0x31d5fc['query'][_0xfc54('0x31')](_0xfc54('0x32'))){_0x438335[_0xfc54('0x1d')]=qs[_0xfc54('0x1d')](_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x1d')]);_0x438335[_0xfc54('0x1c')]=qs['offset'](_0x31d5fc[_0xfc54('0x2c')]['offset']);}_0x438335[_0xfc54('0x33')]=qs[_0xfc54('0x34')](_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x34')]);_0x438335['where']=qs[_0xfc54('0x35')](_['pick'](_0x31d5fc[_0xfc54('0x2c')],_0x681164[_0xfc54('0x35')]),_0x320b0a);if(_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x36')]){_0x438335[_0xfc54('0x37')]=_['merge'](_0x438335[_0xfc54('0x37')],{'$or':_[_0xfc54('0x38')](_0x320b0a,function(_0x1b0790){if(_0x1b0790[_0xfc54('0x2a')]!==_0xfc54('0x39')){var _0x3a2708={};_0x3a2708[_0x1b0790[_0xfc54('0x27')]]={'$like':'%'+_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x36')]+'%'};return _0x3a2708;}})});}_0x438335=_['merge']({},_0x438335,_0x31d5fc[_0xfc54('0x3a')]);var _0x4ccc01={'where':_0x438335['where']};return db[_0xfc54('0x28')][_0xfc54('0x1f')](_0x4ccc01)[_0xfc54('0x24')](function(_0x193cb1){_0x47071e[_0xfc54('0x1f')]=_0x193cb1;if(_0x31d5fc[_0xfc54('0x2c')][_0xfc54('0x3b')]){_0x438335[_0xfc54('0x3c')]=[{'all':!![]}];}return db[_0xfc54('0x28')]['findAll'](_0x438335);})[_0xfc54('0x24')](function(_0x580bf5){_0x47071e[_0xfc54('0x3d')]=_0x580bf5;return _0x47071e;})[_0xfc54('0x24')](respondWithFilteredResult(_0x369c56,_0x438335))[_0xfc54('0x3e')](handleError(_0x369c56,null));};exports[_0xfc54('0x3f')]=function(_0xb39a5d,_0x42fca9){var _0x3e8922={'raw':!![],'where':{'id':_0xb39a5d[_0xfc54('0x40')]['id']}},_0xe521fe={};_0xe521fe['model']=_[_0xfc54('0x2d')](db['SugarcrmField'][_0xfc54('0x29')]);_0xe521fe[_0xfc54('0x2c')]=_['keys'](_0xb39a5d[_0xfc54('0x2c')]);_0xe521fe['filters']=_[_0xfc54('0x41')](_0xe521fe[_0xfc54('0x2b')],_0xe521fe['query']);_0x3e8922[_0xfc54('0x2e')]=_[_0xfc54('0x41')](_0xe521fe[_0xfc54('0x2b')],qs[_0xfc54('0x2f')](_0xb39a5d[_0xfc54('0x2c')][_0xfc54('0x2f')]));_0x3e8922[_0xfc54('0x2e')]=_0x3e8922[_0xfc54('0x2e')][_0xfc54('0x30')]?_0x3e8922[_0xfc54('0x2e')]:_0xe521fe[_0xfc54('0x2b')];if(_0xb39a5d[_0xfc54('0x2c')][_0xfc54('0x3b')]){_0x3e8922[_0xfc54('0x3c')]=[{'all':!![]}];}_0x3e8922=_[_0xfc54('0x42')]({},_0x3e8922,_0xb39a5d[_0xfc54('0x3a')]);return db[_0xfc54('0x28')]['find'](_0x3e8922)[_0xfc54('0x24')](handleEntityNotFound(_0x42fca9,null))[_0xfc54('0x24')](respondWithResult(_0x42fca9,null))['catch'](handleError(_0x42fca9,null));};exports[_0xfc54('0x43')]=function(_0x258a6f,_0x4c2f1b){return db['SugarcrmField'][_0xfc54('0x43')](_0x258a6f[_0xfc54('0x44')],{})[_0xfc54('0x24')](respondWithResult(_0x4c2f1b,0xc9))[_0xfc54('0x3e')](handleError(_0x4c2f1b,null));};exports[_0xfc54('0x23')]=function(_0x190e0d,_0x402df4){if(_0x190e0d[_0xfc54('0x44')]['id']){delete _0x190e0d[_0xfc54('0x44')]['id'];}return db[_0xfc54('0x28')][_0xfc54('0x45')]({'where':{'id':_0x190e0d['params']['id']}})[_0xfc54('0x24')](handleEntityNotFound(_0x402df4,null))[_0xfc54('0x24')](saveUpdates(_0x190e0d[_0xfc54('0x44')],null))['then'](respondWithResult(_0x402df4,null))[_0xfc54('0x3e')](handleError(_0x402df4,null));};exports[_0xfc54('0x46')]=function(_0x999624,_0x13222d){return db[_0xfc54('0x28')]['find']({'where':{'id':_0x999624[_0xfc54('0x40')]['id']}})[_0xfc54('0x24')](handleEntityNotFound(_0x13222d,null))[_0xfc54('0x24')](removeEntity(_0x13222d,null))[_0xfc54('0x3e')](handleError(_0x13222d,null));}; \ No newline at end of file +var _0x6831=['destroy','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x498b7c,_0xc217c9){var _0x679a5e=function(_0x2f2445){while(--_0x2f2445){_0x498b7c['push'](_0x498b7c['shift']());}};_0x679a5e(++_0xc217c9);}(_0x6831,0x144));var _0x1683=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6831[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x1683('0x0'));var rimraf=require(_0x1683('0x1'));var zipdir=require(_0x1683('0x2'));var jsonpatch=require(_0x1683('0x3'));var rp=require('request-promise');var moment=require(_0x1683('0x4'));var BPromise=require(_0x1683('0x5'));var Mustache=require(_0x1683('0x6'));var util=require('util');var path=require(_0x1683('0x7'));var sox=require('sox');var csv=require(_0x1683('0x8'));var ejs=require(_0x1683('0x9'));var fs=require('fs');var fs_extra=require(_0x1683('0xa'));var _=require(_0x1683('0xb'));var squel=require(_0x1683('0xc'));var crypto=require(_0x1683('0xd'));var jsforce=require(_0x1683('0xe'));var deskjs=require(_0x1683('0xf'));var toCsv=require(_0x1683('0x8'));var querystring=require(_0x1683('0x10'));var Papa=require(_0x1683('0x11'));var Redis=require(_0x1683('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1683('0x13'));var as=require(_0x1683('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1683('0x15'))(_0x1683('0x16'));var utils=require('../../config/utils');var config=require(_0x1683('0x17'));var licenseUtil=require(_0x1683('0x18'));var db=require(_0x1683('0x19'))['db'];function respondWithStatusCode(_0x3adcd2,_0x12f6c6){_0x12f6c6=_0x12f6c6||0xcc;return function(_0x238b97){if(_0x238b97){return _0x3adcd2[_0x1683('0x1a')](_0x12f6c6);}return _0x3adcd2[_0x1683('0x1b')](_0x12f6c6)[_0x1683('0x1c')]();};}function respondWithResult(_0x209a2f,_0x33cf09){_0x33cf09=_0x33cf09||0xc8;return function(_0x41174a){if(_0x41174a){return _0x209a2f['status'](_0x33cf09)[_0x1683('0x1d')](_0x41174a);}};}function respondWithFilteredResult(_0x479aab,_0x193ca6){return function(_0x3e6db4){if(_0x3e6db4){var _0x1e1a86=typeof _0x193ca6[_0x1683('0x1e')]===_0x1683('0x1f')&&typeof _0x193ca6[_0x1683('0x20')]===_0x1683('0x1f');var _0x8e0bf0=_0x3e6db4['count'];var _0x2f1501=_0x1e1a86?0x0:_0x193ca6[_0x1683('0x1e')];var _0x407197=_0x1e1a86?_0x3e6db4[_0x1683('0x21')]:_0x193ca6[_0x1683('0x1e')]+_0x193ca6[_0x1683('0x20')];var _0x1b4bab;if(_0x407197>=_0x8e0bf0){_0x407197=_0x8e0bf0;_0x1b4bab=0xc8;}else{_0x1b4bab=0xce;}_0x479aab[_0x1683('0x1b')](_0x1b4bab);return _0x479aab[_0x1683('0x22')](_0x1683('0x23'),_0x2f1501+'-'+_0x407197+'/'+_0x8e0bf0)[_0x1683('0x1d')](_0x3e6db4);}return null;};}function patchUpdates(_0x39f4f7){return function(_0x3bcf2e){try{jsonpatch[_0x1683('0x24')](_0x3bcf2e,_0x39f4f7,!![]);}catch(_0x139e85){return BPromise[_0x1683('0x25')](_0x139e85);}return _0x3bcf2e[_0x1683('0x26')]();};}function saveUpdates(_0x5e15dc,_0x1c1607){return function(_0x167529){if(_0x167529){return _0x167529[_0x1683('0x27')](_0x5e15dc)[_0x1683('0x28')](function(_0x2dd48c){return _0x2dd48c;});}return null;};}function removeEntity(_0x48da84,_0x246284){return function(_0x265d92){if(_0x265d92){return _0x265d92[_0x1683('0x29')]()['then'](function(){_0x48da84[_0x1683('0x1b')](0xcc)[_0x1683('0x1c')]();});}};}function handleEntityNotFound(_0x102e79,_0x10fa43){return function(_0x4c1106){if(!_0x4c1106){_0x102e79[_0x1683('0x1a')](0x194);}return _0x4c1106;};}function handleError(_0x32d74d,_0xe82873){_0xe82873=_0xe82873||0x1f4;return function(_0x153357){logger['error'](_0x153357[_0x1683('0x2a')]);if(_0x153357[_0x1683('0x2b')]){delete _0x153357['name'];}_0x32d74d[_0x1683('0x1b')](_0xe82873)['send'](_0x153357);};}exports['index']=function(_0x5e60b9,_0xe59b0d){var _0x43b550={},_0xa3a31={},_0x325bba={'count':0x0,'rows':[]};var _0x56972a=_[_0x1683('0x2c')](db[_0x1683('0x2d')][_0x1683('0x2e')],function(_0x194b52){return{'name':_0x194b52[_0x1683('0x2f')],'type':_0x194b52[_0x1683('0x30')]['key']};});_0xa3a31['model']=_[_0x1683('0x2c')](_0x56972a,_0x1683('0x2b'));_0xa3a31[_0x1683('0x31')]=_[_0x1683('0x32')](_0x5e60b9['query']);_0xa3a31[_0x1683('0x33')]=_['intersection'](_0xa3a31[_0x1683('0x34')],_0xa3a31[_0x1683('0x31')]);_0x43b550[_0x1683('0x35')]=_[_0x1683('0x36')](_0xa3a31[_0x1683('0x34')],qs[_0x1683('0x37')](_0x5e60b9['query'][_0x1683('0x37')]));_0x43b550['attributes']=_0x43b550[_0x1683('0x35')][_0x1683('0x38')]?_0x43b550[_0x1683('0x35')]:_0xa3a31['model'];if(!_0x5e60b9[_0x1683('0x31')]['hasOwnProperty']('nolimit')){_0x43b550[_0x1683('0x20')]=qs[_0x1683('0x20')](_0x5e60b9[_0x1683('0x31')]['limit']);_0x43b550[_0x1683('0x1e')]=qs[_0x1683('0x1e')](_0x5e60b9[_0x1683('0x31')]['offset']);}_0x43b550['order']=qs[_0x1683('0x39')](_0x5e60b9['query']['sort']);_0x43b550[_0x1683('0x3a')]=qs[_0x1683('0x33')](_[_0x1683('0x3b')](_0x5e60b9[_0x1683('0x31')],_0xa3a31[_0x1683('0x33')]),_0x56972a);if(_0x5e60b9[_0x1683('0x31')][_0x1683('0x3c')]){_0x43b550[_0x1683('0x3a')]=_['merge'](_0x43b550[_0x1683('0x3a')],{'$or':_[_0x1683('0x2c')](_0x56972a,function(_0x10a825){if(_0x10a825['type']!=='VIRTUAL'){var _0x51f266={};_0x51f266[_0x10a825[_0x1683('0x2b')]]={'$like':'%'+_0x5e60b9['query']['filter']+'%'};return _0x51f266;}})});}_0x43b550=_[_0x1683('0x3d')]({},_0x43b550,_0x5e60b9['options']);var _0x1e8a2a={'where':_0x43b550['where']};return db[_0x1683('0x2d')]['count'](_0x1e8a2a)[_0x1683('0x28')](function(_0x224e26){_0x325bba[_0x1683('0x21')]=_0x224e26;if(_0x5e60b9['query'][_0x1683('0x3e')]){_0x43b550[_0x1683('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x1683('0x40')](_0x43b550);})[_0x1683('0x28')](function(_0x232a95){_0x325bba[_0x1683('0x41')]=_0x232a95;return _0x325bba;})['then'](respondWithFilteredResult(_0xe59b0d,_0x43b550))[_0x1683('0x42')](handleError(_0xe59b0d,null));};exports[_0x1683('0x43')]=function(_0x239cc2,_0x242f9c){var _0x8e12ec={'raw':!![],'where':{'id':_0x239cc2['params']['id']}},_0x412624={};_0x412624['model']=_[_0x1683('0x32')](db[_0x1683('0x2d')][_0x1683('0x2e')]);_0x412624[_0x1683('0x31')]=_['keys'](_0x239cc2['query']);_0x412624['filters']=_[_0x1683('0x36')](_0x412624[_0x1683('0x34')],_0x412624[_0x1683('0x31')]);_0x8e12ec[_0x1683('0x35')]=_[_0x1683('0x36')](_0x412624[_0x1683('0x34')],qs[_0x1683('0x37')](_0x239cc2['query']['fields']));_0x8e12ec[_0x1683('0x35')]=_0x8e12ec['attributes'][_0x1683('0x38')]?_0x8e12ec[_0x1683('0x35')]:_0x412624[_0x1683('0x34')];if(_0x239cc2[_0x1683('0x31')][_0x1683('0x3e')]){_0x8e12ec[_0x1683('0x3f')]=[{'all':!![]}];}_0x8e12ec=_[_0x1683('0x3d')]({},_0x8e12ec,_0x239cc2[_0x1683('0x44')]);return db[_0x1683('0x2d')][_0x1683('0x45')](_0x8e12ec)[_0x1683('0x28')](handleEntityNotFound(_0x242f9c,null))[_0x1683('0x28')](respondWithResult(_0x242f9c,null))[_0x1683('0x42')](handleError(_0x242f9c,null));};exports[_0x1683('0x46')]=function(_0x1f977a,_0x5998c6){return db[_0x1683('0x2d')][_0x1683('0x46')](_0x1f977a['body'],{})[_0x1683('0x28')](respondWithResult(_0x5998c6,0xc9))[_0x1683('0x42')](handleError(_0x5998c6,null));};exports[_0x1683('0x27')]=function(_0x1955d4,_0x574be5){if(_0x1955d4[_0x1683('0x47')]['id']){delete _0x1955d4[_0x1683('0x47')]['id'];}return db['SugarcrmField'][_0x1683('0x45')]({'where':{'id':_0x1955d4[_0x1683('0x48')]['id']}})[_0x1683('0x28')](handleEntityNotFound(_0x574be5,null))[_0x1683('0x28')](saveUpdates(_0x1955d4['body'],null))[_0x1683('0x28')](respondWithResult(_0x574be5,null))[_0x1683('0x42')](handleError(_0x574be5,null));};exports['destroy']=function(_0x5c4310,_0x1f5907){return db[_0x1683('0x2d')][_0x1683('0x45')]({'where':{'id':_0x5c4310['params']['id']}})[_0x1683('0x28')](handleEntityNotFound(_0x1f5907,null))[_0x1683('0x28')](removeEntity(_0x1f5907,null))['catch'](handleError(_0x1f5907,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c175847..018bf3f 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 _0x63ea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x63ea,0x7a));var _0xa63e=function(_0x25ce24,_0x4dfd85){_0x25ce24=_0x25ce24-0x0;var _0x1bf0c3=_0x63ea[_0x25ce24];return _0x1bf0c3;};'use strict';var _=require(_0xa63e('0x0'));var util=require(_0xa63e('0x1'));var logger=require(_0xa63e('0x2'))(_0xa63e('0x3'));var moment=require(_0xa63e('0x4'));var BPromise=require(_0xa63e('0x5'));var rp=require(_0xa63e('0x6'));var fs=require('fs');var path=require(_0xa63e('0x7'));var rimraf=require(_0xa63e('0x8'));var config=require(_0xa63e('0x9'));var attributes=require('./intSugarcrmField.attributes');module[_0xa63e('0xa')]=function(_0x3308e9,_0x56a051){return _0x3308e9[_0xa63e('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa63e('0xc'),'fields':['idField',_0xa63e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca2=['../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0x6ca2,0x1b6));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x26ca('0x0'));var logger=require(_0x26ca('0x1'))(_0x26ca('0x2'));var moment=require(_0x26ca('0x3'));var BPromise=require(_0x26ca('0x4'));var rp=require(_0x26ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26ca('0x6'));var attributes=require(_0x26ca('0x7'));module[_0x26ca('0x8')]=function(_0x4ba3f3,_0x3f1f52){return _0x4ba3f3['define'](_0x26ca('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x26ca('0xa'),'fields':[_0x26ca('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 6da1445..fd08ead 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 _0xe9b2=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','SugarcrmField,\x20%s,\x20%s','info','result','message','catch','util','moment','ioredis'];(function(_0x1e3b26,_0x14ea53){var _0x2eeeaf=function(_0x2bb84c){while(--_0x2bb84c){_0x1e3b26['push'](_0x1e3b26['shift']());}};_0x2eeeaf(++_0x14ea53);}(_0xe9b2,0x153));var _0x2e9b=function(_0x9553a2,_0x5424d9){_0x9553a2=_0x9553a2-0x0;var _0x3e398c=_0xe9b2[_0x9553a2];return _0x3e398c;};'use strict';var _=require('lodash');var util=require(_0x2e9b('0x0'));var moment=require(_0x2e9b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9b('0x2'));var db=require(_0x2e9b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e9b('0x4'))('rpc');var config=require(_0x2e9b('0x5'));var jayson=require(_0x2e9b('0x6'));var client=jayson['client'][_0x2e9b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1506b0,_0x2ae3cf,_0x3a91c3){return new BPromise(function(_0xd27ae8,_0x450f6d){return client[_0x2e9b('0x8')](_0x1506b0,_0x3a91c3)[_0x2e9b('0x9')](function(_0x3d78a7){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2ae3cf,_0x2e9b('0xa'));logger[_0x2e9b('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2ae3cf,_0x2e9b('0xa'),JSON[_0x2e9b('0xc')](_0x3d78a7));if(_0x3d78a7[_0x2e9b('0xd')]){if(_0x3d78a7[_0x2e9b('0xd')]['code']===0x1f4){logger['error'](_0x2e9b('0xe'),_0x2ae3cf,_0x3d78a7['error']['message']);return _0x450f6d(_0x3d78a7[_0x2e9b('0xd')]['message']);}logger[_0x2e9b('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2ae3cf,_0x3d78a7['error']['message']);return _0xd27ae8(_0x3d78a7['error']['message']);}else{logger[_0x2e9b('0xf')](_0x2e9b('0xe'),_0x2ae3cf,_0x2e9b('0xa'));_0xd27ae8(_0x3d78a7[_0x2e9b('0x10')][_0x2e9b('0x11')]);}})[_0x2e9b('0x12')](function(_0x42685d){logger[_0x2e9b('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2ae3cf,_0x42685d);_0x450f6d(_0x42685d);});});} \ No newline at end of file +var _0x247f=['lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x412c7d,_0x1d26ba){var _0x424b2c=function(_0x5b9660){while(--_0x5b9660){_0x412c7d['push'](_0x412c7d['shift']());}};_0x424b2c(++_0x1d26ba);}(_0x247f,0x85));var _0xf247=function(_0x3c22c5,_0x3e60b8){_0x3c22c5=_0x3c22c5-0x0;var _0x3e6355=_0x247f[_0x3c22c5];return _0x3e6355;};'use strict';var _=require(_0xf247('0x0'));var util=require(_0xf247('0x1'));var moment=require(_0xf247('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf247('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf247('0x4'));var logger=require('../../config/logger')(_0xf247('0x5'));var config=require('../../config/environment');var jayson=require(_0xf247('0x6'));var client=jayson[_0xf247('0x7')][_0xf247('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x103221,_0x2d256d,_0x4fdcc7){return new BPromise(function(_0x535182,_0x2252d4){return client[_0xf247('0x9')](_0x103221,_0x4fdcc7)['then'](function(_0x230c79){logger['info'](_0xf247('0xa'),_0x2d256d,_0xf247('0xb'));logger['debug'](_0xf247('0xc'),_0x2d256d,_0xf247('0xb'),JSON[_0xf247('0xd')](_0x230c79));if(_0x230c79['error']){if(_0x230c79[_0xf247('0xe')][_0xf247('0xf')]===0x1f4){logger[_0xf247('0xe')](_0xf247('0xa'),_0x2d256d,_0x230c79[_0xf247('0xe')][_0xf247('0x10')]);return _0x2252d4(_0x230c79[_0xf247('0xe')][_0xf247('0x10')]);}logger[_0xf247('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2d256d,_0x230c79[_0xf247('0xe')][_0xf247('0x10')]);return _0x535182(_0x230c79[_0xf247('0xe')][_0xf247('0x10')]);}else{logger['info'](_0xf247('0xa'),_0x2d256d,_0xf247('0xb'));_0x535182(_0x230c79[_0xf247('0x11')][_0xf247('0x10')]);}})[_0xf247('0x12')](function(_0x5079c1){logger['error'](_0xf247('0xa'),_0x2d256d,_0x5079c1);_0x2252d4(_0x5079c1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index d489b07..9858078 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 _0xb7a8=['create','addConfiguration','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x2a695a,_0x35e384){var _0x7340e4=function(_0x8b02f2){while(--_0x8b02f2){_0x2a695a['push'](_0x2a695a['shift']());}};_0x7340e4(++_0x35e384);}(_0xb7a8,0xec));var _0x8b7a=function(_0x3f79ec,_0x3bc59a){_0x3f79ec=_0x3f79ec-0x0;var _0x3b2f8a=_0xb7a8[_0x3f79ec];return _0x3b2f8a;};'use strict';var multer=require('multer');var util=require(_0x8b7a('0x0'));var path=require(_0x8b7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b7a('0x2'));var router=express[_0x8b7a('0x3')]();var fs_extra=require(_0x8b7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var controller=require(_0x8b7a('0x7'));router[_0x8b7a('0x8')]('/',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xa')]);router[_0x8b7a('0x8')](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xc')]);router[_0x8b7a('0x8')](_0x8b7a('0xd'),auth['isAuthenticated'](),controller[_0x8b7a('0xe')]);router['get'](_0x8b7a('0xf'),auth[_0x8b7a('0x9')](),controller['getFields']);router[_0x8b7a('0x10')]('/',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0x11')]);router['post'](_0x8b7a('0xd'),auth['isAuthenticated'](),controller[_0x8b7a('0x12')]);router[_0x8b7a('0x13')](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller['update']);router[_0x8b7a('0x14')]('/:id',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0x15')]);module[_0x8b7a('0x16')]=router; \ No newline at end of file +var _0x3edb=['fs-extra','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x3edb,0x1c9));var _0xb3ed=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3edb[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xb3ed('0x0'));var util=require(_0xb3ed('0x1'));var path=require('path');var timeout=require(_0xb3ed('0x2'));var express=require(_0xb3ed('0x3'));var router=express[_0xb3ed('0x4')]();var fs_extra=require(_0xb3ed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb3ed('0x6'));var config=require('../../config/environment');var controller=require(_0xb3ed('0x7'));router['get']('/',auth[_0xb3ed('0x8')](),controller[_0xb3ed('0x9')]);router[_0xb3ed('0xa')]('/:id',auth[_0xb3ed('0x8')](),controller[_0xb3ed('0xb')]);router[_0xb3ed('0xa')](_0xb3ed('0xc'),auth[_0xb3ed('0x8')](),controller[_0xb3ed('0xd')]);router['get'](_0xb3ed('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xb3ed('0xf')]('/',auth[_0xb3ed('0x8')](),controller[_0xb3ed('0x10')]);router[_0xb3ed('0xf')](_0xb3ed('0xc'),auth['isAuthenticated'](),controller[_0xb3ed('0x11')]);router['put']('/:id',auth[_0xb3ed('0x8')](),controller[_0xb3ed('0x12')]);router['delete'](_0xb3ed('0x13'),auth[_0xb3ed('0x8')](),controller[_0xb3ed('0x14')]);module[_0xb3ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index fe49661..018bde4 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 _0xe802=['HelpDesk','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe802,0x1ea));var _0x2e80=function(_0x134fd6,_0x5c12fd){_0x134fd6=_0x134fd6-0x0;var _0x512bc6=_0xe802[_0x134fd6];return _0x512bc6;};'use strict';var Sequelize=require('sequelize');module[_0x2e80('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2e80('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2e80('0x1')],'allowNull':![],'defaultValue':_0x2e80('0x2')},'remoteUri':{'type':Sequelize[_0x2e80('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2e80('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x06ad=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06ad,0xa0));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd06a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xd06a('0x0')]},'username':{'type':Sequelize[_0xd06a('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd06a('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd06a('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd06a('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0d1a1b7..3d74213 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 _0x7272=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','VtigerAccount','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','login','result','token','sessionName','autogenerated','owner','includes','remove','editable','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','error','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7272,0x171));var _0x2727=function(_0x4b599d,_0x5e4f1d){_0x4b599d=_0x4b599d-0x0;var _0x18cebc=_0x7272[_0x4b599d];return _0x18cebc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2727('0x0'));var zipdir=require(_0x2727('0x1'));var jsonpatch=require(_0x2727('0x2'));var rp=require(_0x2727('0x3'));var moment=require(_0x2727('0x4'));var BPromise=require(_0x2727('0x5'));var Mustache=require(_0x2727('0x6'));var util=require(_0x2727('0x7'));var path=require(_0x2727('0x8'));var sox=require(_0x2727('0x9'));var csv=require(_0x2727('0xa'));var ejs=require(_0x2727('0xb'));var fs=require('fs');var fs_extra=require(_0x2727('0xc'));var _=require(_0x2727('0xd'));var squel=require(_0x2727('0xe'));var crypto=require('crypto');var jsforce=require(_0x2727('0xf'));var deskjs=require(_0x2727('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2727('0x11'));var Papa=require(_0x2727('0x12'));var Redis=require(_0x2727('0x13'));var authService=require(_0x2727('0x14'));var qs=require(_0x2727('0x15'));var as=require(_0x2727('0x16'));var hardwareService=require(_0x2727('0x17'));var logger=require(_0x2727('0x18'))(_0x2727('0x19'));var utils=require('../../config/utils');var config=require(_0x2727('0x1a'));var licenseUtil=require(_0x2727('0x1b'));var db=require(_0x2727('0x1c'))['db'];var integrations=require(_0x2727('0x1d'));function respondWithStatusCode(_0x16a770,_0x18c261){_0x18c261=_0x18c261||0xcc;return function(_0x296252){if(_0x296252){return _0x16a770[_0x2727('0x1e')](_0x18c261);}return _0x16a770[_0x2727('0x1f')](_0x18c261)[_0x2727('0x20')]();};}function respondWithResult(_0x1b4c76,_0x28b533){_0x28b533=_0x28b533||0xc8;return function(_0xc42b1e){if(_0xc42b1e){return _0x1b4c76[_0x2727('0x1f')](_0x28b533)[_0x2727('0x21')](_0xc42b1e);}};}function respondWithFilteredResult(_0x1540dc,_0x34a411){return function(_0x6cf391){if(_0x6cf391){var _0x3ff908=typeof _0x34a411[_0x2727('0x22')]===_0x2727('0x23')&&typeof _0x34a411[_0x2727('0x24')]===_0x2727('0x23');var _0x1cb695=_0x6cf391[_0x2727('0x25')];var _0x2c5f48=_0x3ff908?0x0:_0x34a411[_0x2727('0x22')];var _0x33c701=_0x3ff908?_0x6cf391[_0x2727('0x25')]:_0x34a411['offset']+_0x34a411[_0x2727('0x24')];var _0x3ebce7;if(_0x33c701>=_0x1cb695){_0x33c701=_0x1cb695;_0x3ebce7=0xc8;}else{_0x3ebce7=0xce;}_0x1540dc['status'](_0x3ebce7);return _0x1540dc[_0x2727('0x26')](_0x2727('0x27'),_0x2c5f48+'-'+_0x33c701+'/'+_0x1cb695)['json'](_0x6cf391);}return null;};}function patchUpdates(_0x30a528){return function(_0x2c7052){try{jsonpatch[_0x2727('0x28')](_0x2c7052,_0x30a528,!![]);}catch(_0x5431e3){return BPromise[_0x2727('0x29')](_0x5431e3);}return _0x2c7052['save']();};}function saveUpdates(_0x56c027,_0x5b7a97){return function(_0xf7dd4d){if(_0xf7dd4d){return _0xf7dd4d[_0x2727('0x2a')](_0x56c027)[_0x2727('0x2b')](function(_0x37f0c0){return _0x37f0c0;});}return null;};}function removeEntity(_0x4c1a8f,_0x3d3eee){return function(_0x481dd7){if(_0x481dd7){return _0x481dd7[_0x2727('0x2c')]()[_0x2727('0x2b')](function(){_0x4c1a8f[_0x2727('0x1f')](0xcc)[_0x2727('0x20')]();});}};}function handleEntityNotFound(_0x4cb558,_0x3049a9){return function(_0x4d6a15){if(!_0x4d6a15){_0x4cb558['sendStatus'](0x194);}return _0x4d6a15;};}function handleError(_0x43030e,_0x44f85e){_0x44f85e=_0x44f85e||0x1f4;return function(_0xfe60ee){logger['error'](_0xfe60ee[_0x2727('0x2d')]);if(_0xfe60ee[_0x2727('0x2e')]){delete _0xfe60ee['name'];}_0x43030e[_0x2727('0x1f')](_0x44f85e)[_0x2727('0x2f')](_0xfe60ee);};}exports[_0x2727('0x30')]=function(_0x30d247,_0x17db11){var _0x492382={},_0xfc9a7e={},_0x510d3f={'count':0x0,'rows':[]};var _0x377b4b=_['map'](db[_0x2727('0x31')]['rawAttributes'],function(_0x169270){return{'name':_0x169270[_0x2727('0x32')],'type':_0x169270[_0x2727('0x33')]['key']};});_0xfc9a7e[_0x2727('0x34')]=_[_0x2727('0x35')](_0x377b4b,_0x2727('0x2e'));_0xfc9a7e['query']=_['keys'](_0x30d247[_0x2727('0x36')]);_0xfc9a7e['filters']=_[_0x2727('0x37')](_0xfc9a7e['model'],_0xfc9a7e[_0x2727('0x36')]);_0x492382[_0x2727('0x38')]=_[_0x2727('0x37')](_0xfc9a7e[_0x2727('0x34')],qs[_0x2727('0x39')](_0x30d247[_0x2727('0x36')][_0x2727('0x39')]));_0x492382[_0x2727('0x38')]=_0x492382[_0x2727('0x38')][_0x2727('0x3a')]?_0x492382[_0x2727('0x38')]:_0xfc9a7e['model'];if(!_0x30d247[_0x2727('0x36')][_0x2727('0x3b')](_0x2727('0x3c'))){_0x492382[_0x2727('0x24')]=qs[_0x2727('0x24')](_0x30d247[_0x2727('0x36')][_0x2727('0x24')]);_0x492382[_0x2727('0x22')]=qs[_0x2727('0x22')](_0x30d247[_0x2727('0x36')]['offset']);}_0x492382[_0x2727('0x3d')]=qs['sort'](_0x30d247['query'][_0x2727('0x3e')]);_0x492382[_0x2727('0x3f')]=qs[_0x2727('0x40')](_[_0x2727('0x41')](_0x30d247['query'],_0xfc9a7e['filters']),_0x377b4b);if(_0x30d247[_0x2727('0x36')][_0x2727('0x42')]){_0x492382[_0x2727('0x3f')]=_[_0x2727('0x43')](_0x492382[_0x2727('0x3f')],{'$or':_['map'](_0x377b4b,function(_0x573ba7){if(_0x573ba7[_0x2727('0x33')]!==_0x2727('0x44')){var _0x23e8fe={};_0x23e8fe[_0x573ba7[_0x2727('0x2e')]]={'$like':'%'+_0x30d247[_0x2727('0x36')][_0x2727('0x42')]+'%'};return _0x23e8fe;}})});}_0x492382=_[_0x2727('0x43')]({},_0x492382,_0x30d247['options']);var _0xcdf9f2={'where':_0x492382[_0x2727('0x3f')]};return db[_0x2727('0x31')][_0x2727('0x25')](_0xcdf9f2)[_0x2727('0x2b')](function(_0x5018be){_0x510d3f['count']=_0x5018be;if(_0x30d247['query']['includeAll']){_0x492382[_0x2727('0x45')]=[{'all':!![]}];}return db[_0x2727('0x31')][_0x2727('0x46')](_0x492382);})[_0x2727('0x2b')](function(_0x15e7d0){_0x510d3f[_0x2727('0x47')]=_0x15e7d0;return _0x510d3f;})[_0x2727('0x2b')](respondWithFilteredResult(_0x17db11,_0x492382))[_0x2727('0x48')](handleError(_0x17db11,null));};exports[_0x2727('0x49')]=function(_0x2a55ea,_0x543d58){var _0x1cde9c={'raw':![],'where':{'id':_0x2a55ea[_0x2727('0x4a')]['id']}},_0x1adc89={};_0x1adc89[_0x2727('0x34')]=_[_0x2727('0x4b')](db[_0x2727('0x31')][_0x2727('0x4c')]);_0x1adc89['query']=_['keys'](_0x2a55ea['query']);_0x1adc89[_0x2727('0x40')]=_['intersection'](_0x1adc89[_0x2727('0x34')],_0x1adc89['query']);_0x1cde9c[_0x2727('0x38')]=_[_0x2727('0x37')](_0x1adc89['model'],qs['fields'](_0x2a55ea['query'][_0x2727('0x39')]));_0x1cde9c['attributes']=_0x1cde9c[_0x2727('0x38')]['length']?_0x1cde9c['attributes']:_0x1adc89['model'];if(_0x2a55ea[_0x2727('0x36')][_0x2727('0x4d')]){_0x1cde9c[_0x2727('0x45')]=[{'all':!![]}];}_0x1cde9c=_[_0x2727('0x43')]({},_0x1cde9c,_0x2a55ea[_0x2727('0x4e')]);return db[_0x2727('0x31')][_0x2727('0x4f')](_0x1cde9c)[_0x2727('0x2b')](handleEntityNotFound(_0x543d58,null))['then'](respondWithResult(_0x543d58,null))[_0x2727('0x48')](handleError(_0x543d58,null));};exports[_0x2727('0x50')]=function(_0x2eda19,_0x3a8a5a){return db[_0x2727('0x31')][_0x2727('0x50')](_0x2eda19[_0x2727('0x51')],{})[_0x2727('0x2b')](respondWithResult(_0x3a8a5a,0xc9))[_0x2727('0x48')](handleError(_0x3a8a5a,null));};exports[_0x2727('0x2a')]=function(_0x5b192e,_0x45bbc9){if(_0x5b192e[_0x2727('0x51')]['id']){delete _0x5b192e[_0x2727('0x51')]['id'];}return db[_0x2727('0x31')][_0x2727('0x4f')]({'where':{'id':_0x5b192e['params']['id']}})['then'](handleEntityNotFound(_0x45bbc9,null))['then'](saveUpdates(_0x5b192e['body'],null))[_0x2727('0x2b')](respondWithResult(_0x45bbc9,null))['catch'](handleError(_0x45bbc9,null));};exports[_0x2727('0x2c')]=function(_0xcc13db,_0x174ebd){return db[_0x2727('0x31')][_0x2727('0x4f')]({'where':{'id':_0xcc13db['params']['id']}})['then'](handleEntityNotFound(_0x174ebd,null))[_0x2727('0x2b')](removeEntity(_0x174ebd,null))[_0x2727('0x48')](handleError(_0x174ebd,null));};exports[_0x2727('0x52')]=function(_0x3236d5,_0x4af665,_0x59282b){var _0x1732af={};var _0x406b0c={};var _0x35cb0d;var _0x4e8365;return db[_0x2727('0x31')][_0x2727('0x53')]({'where':{'id':_0x3236d5[_0x2727('0x4a')]['id']}})[_0x2727('0x2b')](handleEntityNotFound(_0x4af665,null))[_0x2727('0x2b')](function(_0x5317a0){if(_0x5317a0){_0x35cb0d=_0x5317a0;_0x406b0c[_0x2727('0x34')]=_[_0x2727('0x4b')](db[_0x2727('0x54')][_0x2727('0x4c')]);_0x406b0c[_0x2727('0x36')]=_['keys'](_0x3236d5['query']);_0x406b0c[_0x2727('0x40')]=_['intersection'](_0x406b0c[_0x2727('0x34')],_0x406b0c[_0x2727('0x36')]);_0x1732af['attributes']=_['intersection'](_0x406b0c[_0x2727('0x34')],qs['fields'](_0x3236d5[_0x2727('0x36')][_0x2727('0x39')]));_0x1732af['attributes']=_0x1732af[_0x2727('0x38')][_0x2727('0x3a')]?_0x1732af['attributes']:_0x406b0c[_0x2727('0x34')];_0x1732af[_0x2727('0x3d')]=qs[_0x2727('0x3e')](_0x3236d5[_0x2727('0x36')][_0x2727('0x3e')]);_0x1732af[_0x2727('0x3f')]=qs[_0x2727('0x40')](_['pick'](_0x3236d5[_0x2727('0x36')],_0x406b0c['filters']));if(_0x3236d5['query'][_0x2727('0x42')]){_0x1732af[_0x2727('0x3f')]=_[_0x2727('0x43')](_0x1732af[_0x2727('0x3f')],{'$or':_[_0x2727('0x35')](_0x1732af[_0x2727('0x38')],function(_0x16bf67){var _0x1911fc={};_0x1911fc[_0x16bf67]={'$like':'%'+_0x3236d5[_0x2727('0x36')][_0x2727('0x42')]+'%'};return _0x1911fc;})});}_0x1732af=_[_0x2727('0x43')]({},_0x1732af,_0x3236d5[_0x2727('0x4e')]);return _0x35cb0d[_0x2727('0x52')](_0x1732af);}})[_0x2727('0x2b')](function(_0x2fbfb8){if(_0x2fbfb8){_0x4e8365=_0x2fbfb8[_0x2727('0x3a')];if(!_0x3236d5['query'][_0x2727('0x3b')](_0x2727('0x3c'))){_0x1732af[_0x2727('0x24')]=qs[_0x2727('0x24')](_0x3236d5['query'][_0x2727('0x24')]);_0x1732af[_0x2727('0x22')]=qs[_0x2727('0x22')](_0x3236d5[_0x2727('0x36')][_0x2727('0x22')]);}return _0x35cb0d[_0x2727('0x52')](_0x1732af);}})[_0x2727('0x2b')](function(_0x50c679){if(_0x50c679){return _0x50c679?{'count':_0x4e8365,'rows':_0x50c679}:null;}})[_0x2727('0x2b')](respondWithResult(_0x4af665,null))['catch'](handleError(_0x4af665,null));};exports[_0x2727('0x55')]=function(_0x2b2945,_0x2e977d,_0x5f3d6f){if(_0x2b2945['body']['id']){delete _0x2b2945[_0x2727('0x51')]['id'];}return db['VtigerAccount'][_0x2727('0x53')]({'where':{'id':_0x2b2945['params']['id']}})[_0x2727('0x2b')](handleEntityNotFound(_0x2e977d,null))[_0x2727('0x2b')](function(_0xd0b145){if(_0xd0b145){_0x2b2945[_0x2727('0x51')][_0x2727('0x56')]=_0xd0b145['id'];_0x2b2945[_0x2727('0x51')][_0x2727('0x57')]=integrations[_0x2727('0x58')](_0x2b2945[_0x2727('0x51')]['channel'],_0x2b2945[_0x2727('0x51')][_0x2727('0x33')]);_0x2b2945[_0x2727('0x51')][_0x2727('0x59')]=integrations[_0x2727('0x5a')](_0x2b2945['body'][_0x2727('0x5b')],_0x2b2945[_0x2727('0x51')]['type']);return db[_0x2727('0x54')][_0x2727('0x50')](_0x2b2945[_0x2727('0x51')],{'include':[{'model':db['VtigerField'],'as':_0x2727('0x57')},{'model':db[_0x2727('0x5c')],'as':_0x2727('0x59')}]});}return null;})['then'](respondWithResult(_0x2e977d,null))[_0x2727('0x48')](handleError(_0x2e977d,null));};var md5=require(_0x2727('0x5d'));exports['getFields']=function(_0x199746,_0x5a1b47,_0x4bccaf){var _0x5a0976=null;var _0x495be1=null;var _0x3c20a9=null;var _0x2055dd=null;var _0x35f591='';return db[_0x2727('0x31')][_0x2727('0x53')]({'where':{'id':_0x199746[_0x2727('0x4a')]['id']},'attributes':['id',_0x2727('0x2e'),_0x2727('0x5e'),'description',_0x2727('0x5f'),_0x2727('0x60'),_0x2727('0x61'),_0x2727('0x62')]})['then'](handleEntityNotFound(_0x5a1b47,null))[_0x2727('0x2b')](function(_0x5cf3a9){if(_0x5cf3a9){_0x5a0976=_0x5cf3a9[_0x2727('0x5e')];_0x495be1=_0x5cf3a9[_0x2727('0x62')];_0x3c20a9=_0x5cf3a9[_0x2727('0x5f')];_0x35f591=_0x5cf3a9[_0x2727('0x60')];var _0x54f43b=_0x35f591[_0x2727('0x63')](-0x1);if(_0x54f43b==='/'){_0x35f591=_0x35f591[_0x2727('0x64')](0x0,_0x35f591[_0x2727('0x65')](_0x54f43b));}_0x2055dd=util['format']('%s/webservice.php',_0x35f591);var _0x4e60c4={'method':_0x2727('0x66'),'uri':_0x2055dd,'qs':{'operation':_0x2727('0x67'),'username':_0x5cf3a9[_0x2727('0x5e')]},'json':!![]};return rp(_0x4e60c4);}})[_0x2727('0x2b')](function(_0x3c5794){if(_0x3c5794[_0x2727('0x68')]){var _0x263b45={'method':'POST','uri':_0x2055dd,'form':{'operation':_0x2727('0x69'),'username':_0x5a0976,'accessKey':md5(_0x3c5794[_0x2727('0x6a')][_0x2727('0x6b')]+_0x495be1)},'json':!![]};return rp(_0x263b45);}})['then'](function(_0x959300){if(_0x959300[_0x2727('0x68')]){var _0x138057={'method':_0x2727('0x66'),'uri':_0x2055dd,'qs':{'operation':'describe','username':_0x5a0976,'sessionName':_0x959300['result'][_0x2727('0x6c')],'elementType':_0x3c20a9},'json':!![]};return rp(_0x138057);}})[_0x2727('0x2b')](function(_0x57629d){if(_0x57629d[_0x2727('0x68')]){var _0x21acda=[_0x2727('0x6d'),'reference',_0x2727('0x6e')];_['remove'](_0x57629d[_0x2727('0x6a')][_0x2727('0x39')],function(_0x81082f){return _0x21acda[_0x2727('0x6f')](_0x81082f[_0x2727('0x33')][_0x2727('0x2e')]);});_[_0x2727('0x70')](_0x57629d['result'][_0x2727('0x39')],function(_0x3b8b01){return _0x3b8b01[_0x2727('0x71')]==='false';});return{'count':_0x57629d[_0x2727('0x6a')][_0x2727('0x39')][_0x2727('0x3a')],'rows':_['map'](_0x57629d['result'][_0x2727('0x39')],function(_0x451d6d){return{'id':_0x451d6d[_0x2727('0x2e')],'name':_0x451d6d[_0x2727('0x72')],'custom':_['startsWith'](_0x451d6d[_0x2727('0x2e')],_0x2727('0x73'))?!![]:![],'options':_0x451d6d[_0x2727('0x33')]['name']===_0x2727('0x74')&&_0x451d6d[_0x2727('0x33')][_0x2727('0x75')][_0x2727('0x3a')]>0x0?_['map'](_0x451d6d[_0x2727('0x33')][_0x2727('0x75')],function(_0x121916){return{'name':_0x121916[_0x2727('0x72')],'value':_0x121916[_0x2727('0x76')]};}):[]};})};}})['then'](respondWithResult(_0x5a1b47,null))['catch'](function(_0x30c8e7){console['log'](_0x2727('0x77')+_0x30c8e7);var _0xdec857=_0x199746[_0x2727('0x36')]['test']?0x1f4:_0x30c8e7[_0x2727('0x78')]||0x1f4;logger[_0x2727('0x79')]('getFields,\x20%s,\x20%s,\x20%s',_0x2727('0x7a'),_0xdec857,JSON[_0x2727('0x7b')](_0x30c8e7));delete _0x30c8e7['name'];if(_0xdec857===0x191){_0xdec857=0x190;}_0x5a1b47['status'](_0xdec857)[_0x2727('0x2f')](_0x199746[_0x2727('0x36')][_0x2727('0x7c')]?{'message':_0x2727('0x7d'),'statusCode':_0x30c8e7[_0x2727('0x78')]}:_0x30c8e7);});}; \ No newline at end of file +var _0x3569=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','order','sort','where','filter','options','then','includeAll','findAll','rows','catch','show','params','keys','include','merge','find','body','getConfigurations','findOne','VtigerConfiguration','length','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','%s/webservice.php','GET','getchallenge','login','result','token','success','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials'];(function(_0x1e33ed,_0x10ccbb){var _0x1cb0f8=function(_0x4f1ae5){while(--_0x4f1ae5){_0x1e33ed['push'](_0x1e33ed['shift']());}};_0x1cb0f8(++_0x10ccbb);}(_0x3569,0xf8));var _0x9356=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x3569[_0x479650];return _0x26b288;};'use strict';var emlformat=require(_0x9356('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9356('0x1'));var jsonpatch=require(_0x9356('0x2'));var rp=require(_0x9356('0x3'));var moment=require(_0x9356('0x4'));var BPromise=require(_0x9356('0x5'));var Mustache=require(_0x9356('0x6'));var util=require(_0x9356('0x7'));var path=require(_0x9356('0x8'));var sox=require(_0x9356('0x9'));var csv=require(_0x9356('0xa'));var ejs=require(_0x9356('0xb'));var fs=require('fs');var fs_extra=require(_0x9356('0xc'));var _=require(_0x9356('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9356('0xe'));var deskjs=require(_0x9356('0xf'));var toCsv=require(_0x9356('0xa'));var querystring=require('querystring');var Papa=require(_0x9356('0x10'));var Redis=require(_0x9356('0x11'));var authService=require(_0x9356('0x12'));var qs=require(_0x9356('0x13'));var as=require(_0x9356('0x14'));var hardwareService=require(_0x9356('0x15'));var logger=require(_0x9356('0x16'))(_0x9356('0x17'));var utils=require(_0x9356('0x18'));var config=require(_0x9356('0x19'));var licenseUtil=require(_0x9356('0x1a'));var db=require(_0x9356('0x1b'))['db'];var integrations=require(_0x9356('0x1c'));function respondWithStatusCode(_0x2426f8,_0x3ab788){_0x3ab788=_0x3ab788||0xcc;return function(_0x223dff){if(_0x223dff){return _0x2426f8[_0x9356('0x1d')](_0x3ab788);}return _0x2426f8[_0x9356('0x1e')](_0x3ab788)[_0x9356('0x1f')]();};}function respondWithResult(_0x333ef4,_0x22a735){_0x22a735=_0x22a735||0xc8;return function(_0x46ca0a){if(_0x46ca0a){return _0x333ef4['status'](_0x22a735)['json'](_0x46ca0a);}};}function respondWithFilteredResult(_0x3acbf0,_0x4ce5d2){return function(_0x19a2ec){if(_0x19a2ec){var _0x5ed393=typeof _0x4ce5d2[_0x9356('0x20')]===_0x9356('0x21')&&typeof _0x4ce5d2[_0x9356('0x22')]===_0x9356('0x21');var _0x24c14b=_0x19a2ec[_0x9356('0x23')];var _0x23ad89=_0x5ed393?0x0:_0x4ce5d2[_0x9356('0x20')];var _0xfd35a5=_0x5ed393?_0x19a2ec[_0x9356('0x23')]:_0x4ce5d2['offset']+_0x4ce5d2['limit'];var _0x5ab623;if(_0xfd35a5>=_0x24c14b){_0xfd35a5=_0x24c14b;_0x5ab623=0xc8;}else{_0x5ab623=0xce;}_0x3acbf0['status'](_0x5ab623);return _0x3acbf0[_0x9356('0x24')](_0x9356('0x25'),_0x23ad89+'-'+_0xfd35a5+'/'+_0x24c14b)['json'](_0x19a2ec);}return null;};}function patchUpdates(_0x50c50b){return function(_0x296206){try{jsonpatch[_0x9356('0x26')](_0x296206,_0x50c50b,!![]);}catch(_0x136402){return BPromise[_0x9356('0x27')](_0x136402);}return _0x296206[_0x9356('0x28')]();};}function saveUpdates(_0x3f7b80,_0x7e8950){return function(_0x2bc515){if(_0x2bc515){return _0x2bc515[_0x9356('0x29')](_0x3f7b80)['then'](function(_0xc99d50){return _0xc99d50;});}return null;};}function removeEntity(_0x2b0799,_0x20f3c4){return function(_0xf72860){if(_0xf72860){return _0xf72860[_0x9356('0x2a')]()['then'](function(){_0x2b0799[_0x9356('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50aa8d,_0x42dd3b){return function(_0x5b345e){if(!_0x5b345e){_0x50aa8d['sendStatus'](0x194);}return _0x5b345e;};}function handleError(_0x38d678,_0x5cbc0f){_0x5cbc0f=_0x5cbc0f||0x1f4;return function(_0x163aea){logger[_0x9356('0x2b')](_0x163aea[_0x9356('0x2c')]);if(_0x163aea['name']){delete _0x163aea[_0x9356('0x2d')];}_0x38d678['status'](_0x5cbc0f)[_0x9356('0x2e')](_0x163aea);};}exports[_0x9356('0x2f')]=function(_0x15d9cb,_0x58b56a){var _0x221ed9={},_0xadbaa9={},_0x285e9c={'count':0x0,'rows':[]};var _0x47c08e=_['map'](db[_0x9356('0x30')][_0x9356('0x31')],function(_0x4a529f){return{'name':_0x4a529f['fieldName'],'type':_0x4a529f[_0x9356('0x32')]['key']};});_0xadbaa9[_0x9356('0x33')]=_[_0x9356('0x34')](_0x47c08e,_0x9356('0x2d'));_0xadbaa9[_0x9356('0x35')]=_['keys'](_0x15d9cb[_0x9356('0x35')]);_0xadbaa9[_0x9356('0x36')]=_[_0x9356('0x37')](_0xadbaa9[_0x9356('0x33')],_0xadbaa9[_0x9356('0x35')]);_0x221ed9[_0x9356('0x38')]=_['intersection'](_0xadbaa9[_0x9356('0x33')],qs[_0x9356('0x39')](_0x15d9cb[_0x9356('0x35')][_0x9356('0x39')]));_0x221ed9[_0x9356('0x38')]=_0x221ed9[_0x9356('0x38')]['length']?_0x221ed9[_0x9356('0x38')]:_0xadbaa9[_0x9356('0x33')];if(!_0x15d9cb['query']['hasOwnProperty']('nolimit')){_0x221ed9['limit']=qs[_0x9356('0x22')](_0x15d9cb[_0x9356('0x35')]['limit']);_0x221ed9[_0x9356('0x20')]=qs['offset'](_0x15d9cb[_0x9356('0x35')]['offset']);}_0x221ed9[_0x9356('0x3a')]=qs[_0x9356('0x3b')](_0x15d9cb[_0x9356('0x35')][_0x9356('0x3b')]);_0x221ed9[_0x9356('0x3c')]=qs[_0x9356('0x36')](_['pick'](_0x15d9cb[_0x9356('0x35')],_0xadbaa9[_0x9356('0x36')]),_0x47c08e);if(_0x15d9cb[_0x9356('0x35')][_0x9356('0x3d')]){_0x221ed9[_0x9356('0x3c')]=_['merge'](_0x221ed9['where'],{'$or':_['map'](_0x47c08e,function(_0x32fb8e){if(_0x32fb8e[_0x9356('0x32')]!=='VIRTUAL'){var _0x48f2a3={};_0x48f2a3[_0x32fb8e[_0x9356('0x2d')]]={'$like':'%'+_0x15d9cb[_0x9356('0x35')]['filter']+'%'};return _0x48f2a3;}})});}_0x221ed9=_['merge']({},_0x221ed9,_0x15d9cb[_0x9356('0x3e')]);var _0x304365={'where':_0x221ed9[_0x9356('0x3c')]};return db[_0x9356('0x30')][_0x9356('0x23')](_0x304365)[_0x9356('0x3f')](function(_0x13566d){_0x285e9c['count']=_0x13566d;if(_0x15d9cb[_0x9356('0x35')][_0x9356('0x40')]){_0x221ed9['include']=[{'all':!![]}];}return db[_0x9356('0x30')][_0x9356('0x41')](_0x221ed9);})[_0x9356('0x3f')](function(_0x5f2dd3){_0x285e9c[_0x9356('0x42')]=_0x5f2dd3;return _0x285e9c;})[_0x9356('0x3f')](respondWithFilteredResult(_0x58b56a,_0x221ed9))[_0x9356('0x43')](handleError(_0x58b56a,null));};exports[_0x9356('0x44')]=function(_0x31dfef,_0x44767b){var _0x1c6de1={'raw':![],'where':{'id':_0x31dfef[_0x9356('0x45')]['id']}},_0x1e5caf={};_0x1e5caf[_0x9356('0x33')]=_[_0x9356('0x46')](db['VtigerAccount']['rawAttributes']);_0x1e5caf[_0x9356('0x35')]=_[_0x9356('0x46')](_0x31dfef[_0x9356('0x35')]);_0x1e5caf[_0x9356('0x36')]=_[_0x9356('0x37')](_0x1e5caf[_0x9356('0x33')],_0x1e5caf['query']);_0x1c6de1[_0x9356('0x38')]=_[_0x9356('0x37')](_0x1e5caf[_0x9356('0x33')],qs[_0x9356('0x39')](_0x31dfef[_0x9356('0x35')]['fields']));_0x1c6de1['attributes']=_0x1c6de1['attributes']['length']?_0x1c6de1[_0x9356('0x38')]:_0x1e5caf['model'];if(_0x31dfef[_0x9356('0x35')]['includeAll']){_0x1c6de1[_0x9356('0x47')]=[{'all':!![]}];}_0x1c6de1=_[_0x9356('0x48')]({},_0x1c6de1,_0x31dfef[_0x9356('0x3e')]);return db['VtigerAccount'][_0x9356('0x49')](_0x1c6de1)['then'](handleEntityNotFound(_0x44767b,null))[_0x9356('0x3f')](respondWithResult(_0x44767b,null))['catch'](handleError(_0x44767b,null));};exports['create']=function(_0x5c4e38,_0x2e91e4){return db[_0x9356('0x30')]['create'](_0x5c4e38[_0x9356('0x4a')],{})['then'](respondWithResult(_0x2e91e4,0xc9))[_0x9356('0x43')](handleError(_0x2e91e4,null));};exports[_0x9356('0x29')]=function(_0xde1526,_0x4148a2){if(_0xde1526['body']['id']){delete _0xde1526[_0x9356('0x4a')]['id'];}return db[_0x9356('0x30')][_0x9356('0x49')]({'where':{'id':_0xde1526['params']['id']}})['then'](handleEntityNotFound(_0x4148a2,null))[_0x9356('0x3f')](saveUpdates(_0xde1526[_0x9356('0x4a')],null))[_0x9356('0x3f')](respondWithResult(_0x4148a2,null))[_0x9356('0x43')](handleError(_0x4148a2,null));};exports[_0x9356('0x2a')]=function(_0x55d773,_0x4d7a81){return db[_0x9356('0x30')][_0x9356('0x49')]({'where':{'id':_0x55d773[_0x9356('0x45')]['id']}})[_0x9356('0x3f')](handleEntityNotFound(_0x4d7a81,null))[_0x9356('0x3f')](removeEntity(_0x4d7a81,null))[_0x9356('0x43')](handleError(_0x4d7a81,null));};exports[_0x9356('0x4b')]=function(_0x37226a,_0x3ea7a8,_0x420ede){var _0x3f0ccf={};var _0x30df8d={};var _0x3ae78b;var _0x42a62c;return db[_0x9356('0x30')][_0x9356('0x4c')]({'where':{'id':_0x37226a[_0x9356('0x45')]['id']}})[_0x9356('0x3f')](handleEntityNotFound(_0x3ea7a8,null))[_0x9356('0x3f')](function(_0x3139b6){if(_0x3139b6){_0x3ae78b=_0x3139b6;_0x30df8d[_0x9356('0x33')]=_[_0x9356('0x46')](db[_0x9356('0x4d')][_0x9356('0x31')]);_0x30df8d[_0x9356('0x35')]=_[_0x9356('0x46')](_0x37226a[_0x9356('0x35')]);_0x30df8d['filters']=_['intersection'](_0x30df8d[_0x9356('0x33')],_0x30df8d['query']);_0x3f0ccf[_0x9356('0x38')]=_[_0x9356('0x37')](_0x30df8d[_0x9356('0x33')],qs[_0x9356('0x39')](_0x37226a[_0x9356('0x35')][_0x9356('0x39')]));_0x3f0ccf[_0x9356('0x38')]=_0x3f0ccf[_0x9356('0x38')][_0x9356('0x4e')]?_0x3f0ccf[_0x9356('0x38')]:_0x30df8d['model'];_0x3f0ccf[_0x9356('0x3a')]=qs[_0x9356('0x3b')](_0x37226a[_0x9356('0x35')][_0x9356('0x3b')]);_0x3f0ccf[_0x9356('0x3c')]=qs[_0x9356('0x36')](_[_0x9356('0x4f')](_0x37226a[_0x9356('0x35')],_0x30df8d[_0x9356('0x36')]));if(_0x37226a[_0x9356('0x35')][_0x9356('0x3d')]){_0x3f0ccf[_0x9356('0x3c')]=_[_0x9356('0x48')](_0x3f0ccf[_0x9356('0x3c')],{'$or':_[_0x9356('0x34')](_0x3f0ccf[_0x9356('0x38')],function(_0x505d63){var _0x25a49b={};_0x25a49b[_0x505d63]={'$like':'%'+_0x37226a[_0x9356('0x35')][_0x9356('0x3d')]+'%'};return _0x25a49b;})});}_0x3f0ccf=_[_0x9356('0x48')]({},_0x3f0ccf,_0x37226a[_0x9356('0x3e')]);return _0x3ae78b[_0x9356('0x4b')](_0x3f0ccf);}})[_0x9356('0x3f')](function(_0x116aea){if(_0x116aea){_0x42a62c=_0x116aea[_0x9356('0x4e')];if(!_0x37226a[_0x9356('0x35')][_0x9356('0x50')](_0x9356('0x51'))){_0x3f0ccf[_0x9356('0x22')]=qs[_0x9356('0x22')](_0x37226a[_0x9356('0x35')][_0x9356('0x22')]);_0x3f0ccf[_0x9356('0x20')]=qs[_0x9356('0x20')](_0x37226a[_0x9356('0x35')]['offset']);}return _0x3ae78b[_0x9356('0x4b')](_0x3f0ccf);}})[_0x9356('0x3f')](function(_0x508c67){if(_0x508c67){return _0x508c67?{'count':_0x42a62c,'rows':_0x508c67}:null;}})[_0x9356('0x3f')](respondWithResult(_0x3ea7a8,null))[_0x9356('0x43')](handleError(_0x3ea7a8,null));};exports[_0x9356('0x52')]=function(_0x44a171,_0x34faea,_0x2fd66e){if(_0x44a171[_0x9356('0x4a')]['id']){delete _0x44a171[_0x9356('0x4a')]['id'];}return db[_0x9356('0x30')][_0x9356('0x4c')]({'where':{'id':_0x44a171['params']['id']}})[_0x9356('0x3f')](handleEntityNotFound(_0x34faea,null))[_0x9356('0x3f')](function(_0x38ac74){if(_0x38ac74){_0x44a171[_0x9356('0x4a')][_0x9356('0x53')]=_0x38ac74['id'];_0x44a171[_0x9356('0x4a')][_0x9356('0x54')]=integrations['getSubjects'](_0x44a171[_0x9356('0x4a')][_0x9356('0x55')],_0x44a171[_0x9356('0x4a')]['type']);_0x44a171[_0x9356('0x4a')][_0x9356('0x56')]=integrations[_0x9356('0x57')](_0x44a171[_0x9356('0x4a')]['channel'],_0x44a171['body'][_0x9356('0x32')]);return db[_0x9356('0x4d')][_0x9356('0x58')](_0x44a171[_0x9356('0x4a')],{'include':[{'model':db[_0x9356('0x59')],'as':_0x9356('0x54')},{'model':db[_0x9356('0x59')],'as':_0x9356('0x56')}]});}return null;})[_0x9356('0x3f')](respondWithResult(_0x34faea,null))[_0x9356('0x43')](handleError(_0x34faea,null));};var md5=require(_0x9356('0x5a'));exports[_0x9356('0x5b')]=function(_0x5561d2,_0x1e7687,_0x5b464c){var _0x3870fb=null;var _0x2002ee=null;var _0x235637=null;var _0x41e31b=null;var _0xa097a6='';return db[_0x9356('0x30')]['findOne']({'where':{'id':_0x5561d2[_0x9356('0x45')]['id']},'attributes':['id',_0x9356('0x2d'),'username','description',_0x9356('0x5c'),_0x9356('0x5d'),_0x9356('0x5e'),_0x9356('0x5f')]})['then'](handleEntityNotFound(_0x1e7687,null))['then'](function(_0x43f025){if(_0x43f025){_0x3870fb=_0x43f025[_0x9356('0x60')];_0x2002ee=_0x43f025[_0x9356('0x5f')];_0x235637=_0x43f025[_0x9356('0x5c')];_0xa097a6=_0x43f025[_0x9356('0x5d')];var _0x4832ba=_0xa097a6[_0x9356('0x61')](-0x1);if(_0x4832ba==='/'){_0xa097a6=_0xa097a6[_0x9356('0x62')](0x0,_0xa097a6['lastIndexOf'](_0x4832ba));}_0x41e31b=util[_0x9356('0x63')](_0x9356('0x64'),_0xa097a6);var _0xcb826f={'method':_0x9356('0x65'),'uri':_0x41e31b,'qs':{'operation':_0x9356('0x66'),'username':_0x43f025[_0x9356('0x60')]},'json':!![]};return rp(_0xcb826f);}})[_0x9356('0x3f')](function(_0x19747b){if(_0x19747b['success']){var _0x1111be={'method':'POST','uri':_0x41e31b,'form':{'operation':_0x9356('0x67'),'username':_0x3870fb,'accessKey':md5(_0x19747b[_0x9356('0x68')][_0x9356('0x69')]+_0x2002ee)},'json':!![]};return rp(_0x1111be);}})[_0x9356('0x3f')](function(_0xebf77d){if(_0xebf77d[_0x9356('0x6a')]){var _0x5bd917={'method':_0x9356('0x65'),'uri':_0x41e31b,'qs':{'operation':'describe','username':_0x3870fb,'sessionName':_0xebf77d[_0x9356('0x68')][_0x9356('0x6b')],'elementType':_0x235637},'json':!![]};return rp(_0x5bd917);}})[_0x9356('0x3f')](function(_0x734bc7){if(_0x734bc7[_0x9356('0x6a')]){var _0x120cb5=[_0x9356('0x6c'),_0x9356('0x6d'),_0x9356('0x6e')];_[_0x9356('0x6f')](_0x734bc7[_0x9356('0x68')][_0x9356('0x39')],function(_0x5ae4f9){return _0x120cb5['includes'](_0x5ae4f9['type']['name']);});_['remove'](_0x734bc7[_0x9356('0x68')]['fields'],function(_0x53f1d1){return _0x53f1d1[_0x9356('0x70')]==='false';});return{'count':_0x734bc7[_0x9356('0x68')][_0x9356('0x39')]['length'],'rows':_['map'](_0x734bc7[_0x9356('0x68')][_0x9356('0x39')],function(_0x369217){return{'id':_0x369217[_0x9356('0x2d')],'name':_0x369217[_0x9356('0x71')],'custom':_[_0x9356('0x72')](_0x369217[_0x9356('0x2d')],_0x9356('0x73'))?!![]:![],'options':_0x369217[_0x9356('0x32')]['name']==='picklist'&&_0x369217['type'][_0x9356('0x74')][_0x9356('0x4e')]>0x0?_[_0x9356('0x34')](_0x369217['type'][_0x9356('0x74')],function(_0x3ae82e){return{'name':_0x3ae82e['label'],'value':_0x3ae82e[_0x9356('0x75')]};}):[]};})};}})[_0x9356('0x3f')](respondWithResult(_0x1e7687,null))['catch'](function(_0x4547ae){console[_0x9356('0x76')](_0x9356('0x77')+_0x4547ae);var _0x4617d6=_0x5561d2[_0x9356('0x35')][_0x9356('0x78')]?0x1f4:_0x4547ae[_0x9356('0x79')]||0x1f4;logger[_0x9356('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0x9356('0x5b'),_0x4617d6,JSON[_0x9356('0x7a')](_0x4547ae));delete _0x4547ae[_0x9356('0x2d')];if(_0x4617d6===0x191){_0x4617d6=0x190;}_0x1e7687[_0x9356('0x1e')](_0x4617d6)[_0x9356('0x2e')](_0x5561d2[_0x9356('0x35')][_0x9356('0x78')]?{'message':_0x9356('0x7b'),'statusCode':_0x4547ae[_0x9356('0x79')]}:_0x4547ae);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 900b4b8..a4d2f00 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 _0x6bcf=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2970e1,_0x5becbc){var _0x3a99cd=function(_0x20c185){while(--_0x20c185){_0x2970e1['push'](_0x2970e1['shift']());}};_0x3a99cd(++_0x5becbc);}(_0x6bcf,0x158));var _0xf6bc=function(_0x5934c0,_0x67f618){_0x5934c0=_0x5934c0-0x0;var _0x81879a=_0x6bcf[_0x5934c0];return _0x81879a;};'use strict';var _=require(_0xf6bc('0x0'));var util=require(_0xf6bc('0x1'));var logger=require(_0xf6bc('0x2'))(_0xf6bc('0x3'));var moment=require('moment');var BPromise=require(_0xf6bc('0x4'));var rp=require(_0xf6bc('0x5'));var fs=require('fs');var path=require(_0xf6bc('0x6'));var rimraf=require(_0xf6bc('0x7'));var config=require(_0xf6bc('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xf6bc('0x9'));module[_0xf6bc('0xa')]=function(_0x541835,_0x2e8118){return _0x541835[_0xf6bc('0xb')](_0xf6bc('0xc'),attributes,{'tableName':_0xf6bc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba8c=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x229655,_0x1a3ea9){var _0x523483=function(_0xa4aeec){while(--_0xa4aeec){_0x229655['push'](_0x229655['shift']());}};_0x523483(++_0x1a3ea9);}(_0xba8c,0x159));var _0xcba8=function(_0x3d3339,_0xa4a90a){_0x3d3339=_0x3d3339-0x0;var _0x4b51c4=_0xba8c[_0x3d3339];return _0x4b51c4;};'use strict';var _=require(_0xcba8('0x0'));var util=require(_0xcba8('0x1'));var logger=require(_0xcba8('0x2'))(_0xcba8('0x3'));var moment=require('moment');var BPromise=require(_0xcba8('0x4'));var rp=require(_0xcba8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcba8('0x6'));var attributes=require(_0xcba8('0x7'));var integrations=require(_0xcba8('0x8'));module[_0xcba8('0x9')]=function(_0x3aa456,_0x3bcc7d){return _0x3aa456[_0xcba8('0xa')](_0xcba8('0xb'),attributes,{'tableName':_0xcba8('0xc'),'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 90d5b89..8102085 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 _0x44a3=['code','message','VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0xd3a9b,_0x4d4e72){var _0x2dd44e=function(_0x512581){while(--_0x512581){_0xd3a9b['push'](_0xd3a9b['shift']());}};_0x2dd44e(++_0x4d4e72);}(_0x44a3,0x1a9));var _0x344a=function(_0x5f2368,_0x29c539){_0x5f2368=_0x5f2368-0x0;var _0x11d9a3=_0x44a3[_0x5f2368];return _0x11d9a3;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')]({'raw':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x277c06['options']?_0x277c06[_0x344a('0x1a')][_0x344a('0x1d')]||null:null,'limit':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1e')]||null:null,'include':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')]?_[_0x344a('0x20')](_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x3b2ab9){return{'model':db[_0x3b2ab9[_0x344a('0x21')]],'as':_0x3b2ab9['as'],'attributes':_0x3b2ab9[_0x344a('0x1d')],'include':_0x3b2ab9['include']?_[_0x344a('0x20')](_0x3b2ab9['include'],function(_0x2a5e49){return{'model':db[_0x2a5e49['model']],'as':_0x2a5e49['as'],'attributes':_0x2a5e49[_0x344a('0x1d')],'include':_0x2a5e49[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x2a5e49[_0x344a('0x1f')],function(_0x26f059){return{'model':db[_0x26f059[_0x344a('0x21')]],'as':_0x26f059['as'],'attributes':_0x26f059[_0x344a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0x4f2499){logger[_0x344a('0xf')](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x22')](_0x4f2499));_0x9fe854(_0x4f2499);})[_0x344a('0x16')](function(_0x5b877d){logger[_0x344a('0x12')]('GetVtigerAccount',_0x5b877d['message'],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x5b877d[_0x344a('0x14')]));});});};exports[_0x344a('0x23')]=function(_0x4803db){var _0x5cd9c6=this;return new Promise(function(_0x5cafd2,_0x16f490){return db[_0x344a('0x18')][_0x344a('0x24')]({'raw':_0x4803db['options']?_0x4803db[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')]['attributes']||null:null,'include':_0x4803db[_0x344a('0x1a')]?_0x4803db['options']['include']?_['map'](_0x4803db[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x2b8e71){return{'model':db[_0x2b8e71[_0x344a('0x21')]],'as':_0x2b8e71['as'],'attributes':_0x2b8e71[_0x344a('0x1d')],'include':_0x2b8e71[_0x344a('0x1f')]?_['map'](_0x2b8e71[_0x344a('0x1f')],function(_0x1fbf64){return{'model':db[_0x1fbf64[_0x344a('0x21')]],'as':_0x1fbf64['as'],'attributes':_0x1fbf64['attributes'],'include':_0x1fbf64[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x1fbf64[_0x344a('0x1f')],function(_0x487a9b){return{'model':db[_0x487a9b[_0x344a('0x21')]],'as':_0x487a9b['as'],'attributes':_0x487a9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0xeabc7c){logger[_0x344a('0xf')](_0x344a('0x23'),_0x4803db);logger[_0x344a('0x11')]('ShowVtigerAccount',_0x4803db,JSON[_0x344a('0x22')](_0xeabc7c));_0x5cafd2(_0xeabc7c);})[_0x344a('0x16')](function(_0x11e81f){logger[_0x344a('0x12')](_0x344a('0x23'),_0x11e81f['message'],_0x4803db);_0x16f490(_0x5cd9c6[_0x344a('0x12')](0x1f4,_0x11e81f[_0x344a('0x14')]));});});}; \ No newline at end of file +var _0xb9be=['VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','GetVtigerAccount'];(function(_0x5ec9e6,_0x462ab0){var _0x54cfd2=function(_0x275cc3){while(--_0x275cc3){_0x5ec9e6['push'](_0x5ec9e6['shift']());}};_0x54cfd2(++_0x462ab0);}(_0xb9be,0xc5));var _0xeb9b=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xb9be[_0x5c6299];return _0x23b564;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')]({'raw':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6['options']['where']||null:null,'attributes':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['attributes']||null:null,'limit':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1c')]||null:null,'include':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x46df93){return{'model':db[_0x46df93[_0xeb9b('0x1f')]],'as':_0x46df93['as'],'attributes':_0x46df93[_0xeb9b('0x20')],'include':_0x46df93[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x46df93[_0xeb9b('0x1d')],function(_0x434461){return{'model':db[_0x434461['model']],'as':_0x434461['as'],'attributes':_0x434461[_0xeb9b('0x20')],'include':_0x434461['include']?_[_0xeb9b('0x1e')](_0x434461['include'],function(_0x347ec1){return{'model':db[_0x347ec1[_0xeb9b('0x1f')]],'as':_0x347ec1['as'],'attributes':_0x347ec1[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb9b('0xd')](function(_0x52f6c1){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x52f6c1));_0x3cbe3e(_0x52f6c1);})['catch'](function(_0x2a4b51){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x2a4b51['message'],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x2a4b51['message']));});});};exports[_0xeb9b('0x21')]=function(_0x4c1331){var _0x411467=this;return new Promise(function(_0x54c659,_0x27578d){return db['VtigerAccount'][_0xeb9b('0x22')]({'raw':_0x4c1331['options']?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x23')]===undefined?!![]:![]:!![],'where':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x24')]||null:null,'attributes':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x20')]||null:null,'include':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')]['include']?_[_0xeb9b('0x1e')](_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x21ecfd){return{'model':db[_0x21ecfd[_0xeb9b('0x1f')]],'as':_0x21ecfd['as'],'attributes':_0x21ecfd[_0xeb9b('0x20')],'include':_0x21ecfd[_0xeb9b('0x1d')]?_['map'](_0x21ecfd[_0xeb9b('0x1d')],function(_0x2f3179){return{'model':db[_0x2f3179[_0xeb9b('0x1f')]],'as':_0x2f3179['as'],'attributes':_0x2f3179['attributes'],'include':_0x2f3179[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x2f3179[_0xeb9b('0x1d')],function(_0xab9ad5){return{'model':db[_0xab9ad5[_0xeb9b('0x1f')]],'as':_0xab9ad5['as'],'attributes':_0xab9ad5[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d235){logger[_0xeb9b('0xe')]('ShowVtigerAccount',_0x4c1331);logger[_0xeb9b('0x10')](_0xeb9b('0x21'),_0x4c1331,JSON[_0xeb9b('0x11')](_0x24d235));_0x54c659(_0x24d235);})[_0xeb9b('0x17')](function(_0x37c678){logger[_0xeb9b('0x12')](_0xeb9b('0x21'),_0x37c678['message'],_0x4c1331);_0x27578d(_0x411467[_0xeb9b('0x12')](0x1f4,_0x37c678[_0xeb9b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 86739fd..5b557e3 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 _0xca8d=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x299255,_0x44cfd3){var _0x993b5f=function(_0x439ad1){while(--_0x439ad1){_0x299255['push'](_0x299255['shift']());}};_0x993b5f(++_0x44cfd3);}(_0xca8d,0x102));var _0xdca8=function(_0x5aedc7,_0x102a15){_0x5aedc7=_0x5aedc7-0x0;var _0x54a4ce=_0xca8d[_0x5aedc7];return _0x54a4ce;};'use strict';var multer=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var path=require(_0xdca8('0x2'));var timeout=require(_0xdca8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdca8('0x4'));var auth=require(_0xdca8('0x5'));var interaction=require(_0xdca8('0x6'));var config=require(_0xdca8('0x7'));var controller=require(_0xdca8('0x8'));router[_0xdca8('0x9')]('/',auth[_0xdca8('0xa')](),controller[_0xdca8('0xb')]);router['get'](_0xdca8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdca8('0x9')](_0xdca8('0xd'),auth[_0xdca8('0xa')](),controller[_0xdca8('0xe')]);router[_0xdca8('0x9')](_0xdca8('0xf'),auth['isAuthenticated'](),controller[_0xdca8('0x10')]);router[_0xdca8('0x9')](_0xdca8('0x11'),auth['isAuthenticated'](),controller[_0xdca8('0x12')]);router[_0xdca8('0x13')]('/',auth[_0xdca8('0xa')](),controller[_0xdca8('0x14')]);router['put'](_0xdca8('0xc'),auth['isAuthenticated'](),controller[_0xdca8('0x15')]);router[_0xdca8('0x16')](_0xdca8('0xc'),auth[_0xdca8('0xa')](),controller['destroy']);module[_0xdca8('0x17')]=router; \ No newline at end of file +var _0x4c69=['/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0xc5e0f2,_0x4e9601){var _0x38fe98=function(_0x33ce5f){while(--_0x33ce5f){_0xc5e0f2['push'](_0xc5e0f2['shift']());}};_0x38fe98(++_0x4e9601);}(_0x4c69,0x86));var _0x94c6=function(_0x3bb9e2,_0x29caac){_0x3bb9e2=_0x3bb9e2-0x0;var _0x531ad3=_0x4c69[_0x3bb9e2];return _0x531ad3;};'use strict';var multer=require(_0x94c6('0x0'));var util=require(_0x94c6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94c6('0x2'));var router=express[_0x94c6('0x3')]();var fs_extra=require(_0x94c6('0x4'));var auth=require(_0x94c6('0x5'));var interaction=require(_0x94c6('0x6'));var config=require(_0x94c6('0x7'));var controller=require(_0x94c6('0x8'));router[_0x94c6('0x9')]('/',auth[_0x94c6('0xa')](),controller[_0x94c6('0xb')]);router[_0x94c6('0x9')](_0x94c6('0xc'),auth[_0x94c6('0xa')](),controller[_0x94c6('0xd')]);router[_0x94c6('0x9')](_0x94c6('0xe'),auth[_0x94c6('0xa')](),controller[_0x94c6('0xf')]);router[_0x94c6('0x9')](_0x94c6('0x10'),auth[_0x94c6('0xa')](),controller['getSubjects']);router[_0x94c6('0x9')](_0x94c6('0x11'),auth[_0x94c6('0xa')](),controller[_0x94c6('0x12')]);router[_0x94c6('0x13')]('/',auth[_0x94c6('0xa')](),controller['create']);router[_0x94c6('0x14')]('/:id',auth[_0x94c6('0xa')](),controller[_0x94c6('0x15')]);router[_0x94c6('0x16')](_0x94c6('0xc'),auth[_0x94c6('0xa')](),controller[_0x94c6('0x17')]);module[_0x94c6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2c60b0f..3d5e5c4 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 _0x07ba=['STRING','sequelize'];(function(_0x4cdebe,_0x32469c){var _0x278f58=function(_0x18e3c4){while(--_0x18e3c4){_0x4cdebe['push'](_0x4cdebe['shift']());}};_0x278f58(++_0x32469c);}(_0x07ba,0xcd));var _0xa07b=function(_0x188950,_0x4b69e1){_0x188950=_0x188950-0x0;var _0x252466=_0x07ba[_0x188950];return _0x252466;};'use strict';var Sequelize=require(_0xa07b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa07b('0x1')]},'description':{'type':Sequelize[_0xa07b('0x1')]}}; \ No newline at end of file +var _0xb5e7=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5e7,0x143));var _0x7b5e=function(_0x37b435,_0x5cdfc9){_0x37b435=_0x37b435-0x0;var _0x298619=_0xb5e7[_0x37b435];return _0x298619;};'use strict';var Sequelize=require(_0x7b5e('0x0'));module[_0x7b5e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7b5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d675b15..d55cc81 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 _0xb236=['VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','VtigerField','pick','getFields','getSubjects','getDescriptions','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x36d9a8,_0xee34e3){var _0x30add4=function(_0x54daf6){while(--_0x54daf6){_0x36d9a8['push'](_0x36d9a8['shift']());}};_0x30add4(++_0xee34e3);}(_0xb236,0x157));var _0x6b23=function(_0x1fc55c,_0x5b20c0){_0x1fc55c=_0x1fc55c-0x0;var _0x375e54=_0xb236[_0x1fc55c];return _0x375e54;};'use strict';var emlformat=require(_0x6b23('0x0'));var rimraf=require(_0x6b23('0x1'));var zipdir=require(_0x6b23('0x2'));var jsonpatch=require(_0x6b23('0x3'));var rp=require(_0x6b23('0x4'));var moment=require(_0x6b23('0x5'));var BPromise=require(_0x6b23('0x6'));var Mustache=require('mustache');var util=require(_0x6b23('0x7'));var path=require(_0x6b23('0x8'));var sox=require(_0x6b23('0x9'));var csv=require(_0x6b23('0xa'));var ejs=require(_0x6b23('0xb'));var fs=require('fs');var fs_extra=require(_0x6b23('0xc'));var _=require(_0x6b23('0xd'));var squel=require('squel');var crypto=require(_0x6b23('0xe'));var jsforce=require(_0x6b23('0xf'));var deskjs=require(_0x6b23('0x10'));var toCsv=require(_0x6b23('0xa'));var querystring=require(_0x6b23('0x11'));var Papa=require(_0x6b23('0x12'));var Redis=require(_0x6b23('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6b23('0x14'));var as=require(_0x6b23('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b23('0x16'))('api');var utils=require(_0x6b23('0x17'));var config=require(_0x6b23('0x18'));var licenseUtil=require(_0x6b23('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4acf71,_0x4e92ea){_0x4e92ea=_0x4e92ea||0xcc;return function(_0x1b3cec){if(_0x1b3cec){return _0x4acf71[_0x6b23('0x1a')](_0x4e92ea);}return _0x4acf71['status'](_0x4e92ea)[_0x6b23('0x1b')]();};}function respondWithResult(_0x16c1ad,_0x9638ab){_0x9638ab=_0x9638ab||0xc8;return function(_0x59186a){if(_0x59186a){return _0x16c1ad[_0x6b23('0x1c')](_0x9638ab)[_0x6b23('0x1d')](_0x59186a);}};}function respondWithFilteredResult(_0x14db39,_0x2d860e){return function(_0x2fd21d){if(_0x2fd21d){var _0x2ac312=typeof _0x2d860e[_0x6b23('0x1e')]===_0x6b23('0x1f')&&typeof _0x2d860e[_0x6b23('0x20')]===_0x6b23('0x1f');var _0x3a81d0=_0x2fd21d[_0x6b23('0x21')];var _0x53f576=_0x2ac312?0x0:_0x2d860e[_0x6b23('0x1e')];var _0x41091c=_0x2ac312?_0x2fd21d[_0x6b23('0x21')]:_0x2d860e[_0x6b23('0x1e')]+_0x2d860e[_0x6b23('0x20')];var _0x58556b;if(_0x41091c>=_0x3a81d0){_0x41091c=_0x3a81d0;_0x58556b=0xc8;}else{_0x58556b=0xce;}_0x14db39[_0x6b23('0x1c')](_0x58556b);return _0x14db39['set'](_0x6b23('0x22'),_0x53f576+'-'+_0x41091c+'/'+_0x3a81d0)[_0x6b23('0x1d')](_0x2fd21d);}return null;};}function patchUpdates(_0x3de238){return function(_0x44cdef){try{jsonpatch[_0x6b23('0x23')](_0x44cdef,_0x3de238,!![]);}catch(_0x2a3940){return BPromise['reject'](_0x2a3940);}return _0x44cdef[_0x6b23('0x24')]();};}function saveUpdates(_0x2b58da,_0x38e3dc){return function(_0x54e29d){if(_0x54e29d){return _0x54e29d[_0x6b23('0x25')](_0x2b58da)[_0x6b23('0x26')](function(_0xc42d2){return _0xc42d2;});}return null;};}function removeEntity(_0x447810,_0x3ad88d){return function(_0x49c861){if(_0x49c861){return _0x49c861[_0x6b23('0x27')]()[_0x6b23('0x26')](function(){_0x447810[_0x6b23('0x1c')](0xcc)[_0x6b23('0x1b')]();});}};}function handleEntityNotFound(_0x3b440c,_0x5568b6){return function(_0x59f2a4){if(!_0x59f2a4){_0x3b440c[_0x6b23('0x1a')](0x194);}return _0x59f2a4;};}function handleError(_0x5b4ae4,_0x3cf6be){_0x3cf6be=_0x3cf6be||0x1f4;return function(_0x28f341){logger[_0x6b23('0x28')](_0x28f341[_0x6b23('0x29')]);if(_0x28f341[_0x6b23('0x2a')]){delete _0x28f341[_0x6b23('0x2a')];}_0x5b4ae4['status'](_0x3cf6be)[_0x6b23('0x2b')](_0x28f341);};}exports[_0x6b23('0x2c')]=function(_0x461dd1,_0x50f781){var _0x49fc6a={},_0x38ec53={},_0x219714={'count':0x0,'rows':[]};var _0x4f5245=_[_0x6b23('0x2d')](db[_0x6b23('0x2e')][_0x6b23('0x2f')],function(_0x5e1aaa){return{'name':_0x5e1aaa['fieldName'],'type':_0x5e1aaa['type'][_0x6b23('0x30')]};});_0x38ec53[_0x6b23('0x31')]=_['map'](_0x4f5245,_0x6b23('0x2a'));_0x38ec53[_0x6b23('0x32')]=_[_0x6b23('0x33')](_0x461dd1[_0x6b23('0x32')]);_0x38ec53[_0x6b23('0x34')]=_[_0x6b23('0x35')](_0x38ec53[_0x6b23('0x31')],_0x38ec53['query']);_0x49fc6a[_0x6b23('0x36')]=_['intersection'](_0x38ec53['model'],qs['fields'](_0x461dd1[_0x6b23('0x32')][_0x6b23('0x37')]));_0x49fc6a[_0x6b23('0x36')]=_0x49fc6a[_0x6b23('0x36')][_0x6b23('0x38')]?_0x49fc6a['attributes']:_0x38ec53[_0x6b23('0x31')];if(!_0x461dd1[_0x6b23('0x32')][_0x6b23('0x39')](_0x6b23('0x3a'))){_0x49fc6a[_0x6b23('0x20')]=qs['limit'](_0x461dd1[_0x6b23('0x32')][_0x6b23('0x20')]);_0x49fc6a[_0x6b23('0x1e')]=qs[_0x6b23('0x1e')](_0x461dd1[_0x6b23('0x32')][_0x6b23('0x1e')]);}_0x49fc6a[_0x6b23('0x3b')]=qs[_0x6b23('0x3c')](_0x461dd1[_0x6b23('0x32')][_0x6b23('0x3c')]);_0x49fc6a['where']=qs[_0x6b23('0x34')](_['pick'](_0x461dd1[_0x6b23('0x32')],_0x38ec53[_0x6b23('0x34')]),_0x4f5245);if(_0x461dd1[_0x6b23('0x32')]['filter']){_0x49fc6a[_0x6b23('0x3d')]=_['merge'](_0x49fc6a['where'],{'$or':_[_0x6b23('0x2d')](_0x4f5245,function(_0x4ddfc3){if(_0x4ddfc3['type']!==_0x6b23('0x3e')){var _0x29a258={};_0x29a258[_0x4ddfc3['name']]={'$like':'%'+_0x461dd1['query'][_0x6b23('0x3f')]+'%'};return _0x29a258;}})});}_0x49fc6a=_[_0x6b23('0x40')]({},_0x49fc6a,_0x461dd1[_0x6b23('0x41')]);var _0x1de983={'where':_0x49fc6a[_0x6b23('0x3d')]};return db[_0x6b23('0x2e')][_0x6b23('0x21')](_0x1de983)[_0x6b23('0x26')](function(_0x10fc11){_0x219714[_0x6b23('0x21')]=_0x10fc11;if(_0x461dd1[_0x6b23('0x32')][_0x6b23('0x42')]){_0x49fc6a[_0x6b23('0x43')]=[{'all':!![]}];}return db[_0x6b23('0x2e')][_0x6b23('0x44')](_0x49fc6a);})['then'](function(_0xc92aec){_0x219714[_0x6b23('0x45')]=_0xc92aec;return _0x219714;})[_0x6b23('0x26')](respondWithFilteredResult(_0x50f781,_0x49fc6a))[_0x6b23('0x46')](handleError(_0x50f781,null));};exports['show']=function(_0x7e0347,_0x440628){var _0x460873={'raw':![],'where':{'id':_0x7e0347[_0x6b23('0x47')]['id']}},_0x1b9e9f={};_0x1b9e9f[_0x6b23('0x31')]=_[_0x6b23('0x33')](db[_0x6b23('0x2e')][_0x6b23('0x2f')]);_0x1b9e9f['query']=_[_0x6b23('0x33')](_0x7e0347[_0x6b23('0x32')]);_0x1b9e9f[_0x6b23('0x34')]=_[_0x6b23('0x35')](_0x1b9e9f[_0x6b23('0x31')],_0x1b9e9f['query']);_0x460873[_0x6b23('0x36')]=_['intersection'](_0x1b9e9f[_0x6b23('0x31')],qs[_0x6b23('0x37')](_0x7e0347[_0x6b23('0x32')][_0x6b23('0x37')]));_0x460873[_0x6b23('0x36')]=_0x460873[_0x6b23('0x36')][_0x6b23('0x38')]?_0x460873[_0x6b23('0x36')]:_0x1b9e9f[_0x6b23('0x31')];if(_0x7e0347['query'][_0x6b23('0x42')]){_0x460873[_0x6b23('0x43')]=[{'all':!![]}];}_0x460873=_[_0x6b23('0x40')]({},_0x460873,_0x7e0347['options']);return db[_0x6b23('0x2e')][_0x6b23('0x48')](_0x460873)[_0x6b23('0x26')](handleEntityNotFound(_0x440628,null))[_0x6b23('0x26')](respondWithResult(_0x440628,null))[_0x6b23('0x46')](handleError(_0x440628,null));};exports[_0x6b23('0x49')]=function(_0x43803d,_0x2557bb){return db['VtigerConfiguration'][_0x6b23('0x49')](_0x43803d[_0x6b23('0x4a')],{})[_0x6b23('0x26')](respondWithResult(_0x2557bb,0xc9))[_0x6b23('0x46')](handleError(_0x2557bb,null));};exports[_0x6b23('0x25')]=function(_0x576e2c,_0x5187e9){if(_0x576e2c[_0x6b23('0x4a')]['id']){delete _0x576e2c[_0x6b23('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x576e2c[_0x6b23('0x47')]['id']}})[_0x6b23('0x26')](handleEntityNotFound(_0x5187e9,null))[_0x6b23('0x26')](saveUpdates(_0x576e2c[_0x6b23('0x4a')],null))[_0x6b23('0x26')](respondWithResult(_0x5187e9,null))[_0x6b23('0x46')](handleError(_0x5187e9,null));};exports[_0x6b23('0x27')]=function(_0x47ebfa,_0xa1d890){return db[_0x6b23('0x2e')][_0x6b23('0x48')]({'where':{'id':_0x47ebfa[_0x6b23('0x47')]['id']}})['then'](handleEntityNotFound(_0xa1d890,null))[_0x6b23('0x26')](removeEntity(_0xa1d890,null))['catch'](handleError(_0xa1d890,null));};exports['getFields']=function(_0x3f3695,_0x29c23f,_0x46889c){var _0xf678f7={};var _0x526d5d={};var _0x552826;var _0x10ad47;return db[_0x6b23('0x2e')][_0x6b23('0x4b')]({'where':{'id':_0x3f3695[_0x6b23('0x47')]['id']}})[_0x6b23('0x26')](handleEntityNotFound(_0x29c23f,null))['then'](function(_0x3d99c6){if(_0x3d99c6){_0x552826=_0x3d99c6;_0x526d5d[_0x6b23('0x31')]=_[_0x6b23('0x33')](db[_0x6b23('0x4c')]['rawAttributes']);_0x526d5d[_0x6b23('0x32')]=_[_0x6b23('0x33')](_0x3f3695['query']);_0x526d5d['filters']=_[_0x6b23('0x35')](_0x526d5d[_0x6b23('0x31')],_0x526d5d[_0x6b23('0x32')]);_0xf678f7['attributes']=_[_0x6b23('0x35')](_0x526d5d[_0x6b23('0x31')],qs[_0x6b23('0x37')](_0x3f3695[_0x6b23('0x32')]['fields']));_0xf678f7[_0x6b23('0x36')]=_0xf678f7[_0x6b23('0x36')]['length']?_0xf678f7[_0x6b23('0x36')]:_0x526d5d[_0x6b23('0x31')];_0xf678f7['order']=qs['sort'](_0x3f3695['query'][_0x6b23('0x3c')]);_0xf678f7[_0x6b23('0x3d')]=qs[_0x6b23('0x34')](_[_0x6b23('0x4d')](_0x3f3695[_0x6b23('0x32')],_0x526d5d['filters']));if(_0x3f3695[_0x6b23('0x32')][_0x6b23('0x3f')]){_0xf678f7[_0x6b23('0x3d')]=_[_0x6b23('0x40')](_0xf678f7[_0x6b23('0x3d')],{'$or':_[_0x6b23('0x2d')](_0xf678f7[_0x6b23('0x36')],function(_0xd6affd){var _0x1fda76={};_0x1fda76[_0xd6affd]={'$like':'%'+_0x3f3695['query'][_0x6b23('0x3f')]+'%'};return _0x1fda76;})});}_0xf678f7=_[_0x6b23('0x40')]({},_0xf678f7,_0x3f3695[_0x6b23('0x41')]);return _0x552826[_0x6b23('0x4e')](_0xf678f7);}})[_0x6b23('0x26')](function(_0x3fc1db){if(_0x3fc1db){_0x10ad47=_0x3fc1db['length'];if(!_0x3f3695[_0x6b23('0x32')]['hasOwnProperty'](_0x6b23('0x3a'))){_0xf678f7[_0x6b23('0x20')]=qs[_0x6b23('0x20')](_0x3f3695[_0x6b23('0x32')][_0x6b23('0x20')]);_0xf678f7['offset']=qs[_0x6b23('0x1e')](_0x3f3695[_0x6b23('0x32')][_0x6b23('0x1e')]);}return _0x552826[_0x6b23('0x4e')](_0xf678f7);}})[_0x6b23('0x26')](function(_0x3cd9ed){if(_0x3cd9ed){return _0x3cd9ed?{'count':_0x10ad47,'rows':_0x3cd9ed}:null;}})[_0x6b23('0x26')](respondWithResult(_0x29c23f,null))['catch'](handleError(_0x29c23f,null));};exports[_0x6b23('0x4f')]=function(_0x2a8f4d,_0x10b748,_0x5239ea){var _0x56331e={};var _0x4a8229={};var _0x36d6b7;var _0x3718b1;return db[_0x6b23('0x2e')][_0x6b23('0x4b')]({'where':{'id':_0x2a8f4d[_0x6b23('0x47')]['id']}})['then'](handleEntityNotFound(_0x10b748,null))[_0x6b23('0x26')](function(_0x8f8875){if(_0x8f8875){_0x36d6b7=_0x8f8875;_0x4a8229[_0x6b23('0x31')]=_[_0x6b23('0x33')](db[_0x6b23('0x4c')][_0x6b23('0x2f')]);_0x4a8229[_0x6b23('0x32')]=_[_0x6b23('0x33')](_0x2a8f4d[_0x6b23('0x32')]);_0x4a8229['filters']=_['intersection'](_0x4a8229[_0x6b23('0x31')],_0x4a8229[_0x6b23('0x32')]);_0x56331e[_0x6b23('0x36')]=_[_0x6b23('0x35')](_0x4a8229[_0x6b23('0x31')],qs['fields'](_0x2a8f4d['query'][_0x6b23('0x37')]));_0x56331e['attributes']=_0x56331e[_0x6b23('0x36')][_0x6b23('0x38')]?_0x56331e[_0x6b23('0x36')]:_0x4a8229[_0x6b23('0x31')];_0x56331e[_0x6b23('0x3b')]=qs['sort'](_0x2a8f4d['query']['sort']);_0x56331e[_0x6b23('0x3d')]=qs[_0x6b23('0x34')](_[_0x6b23('0x4d')](_0x2a8f4d[_0x6b23('0x32')],_0x4a8229[_0x6b23('0x34')]));if(_0x2a8f4d[_0x6b23('0x32')][_0x6b23('0x3f')]){_0x56331e[_0x6b23('0x3d')]=_[_0x6b23('0x40')](_0x56331e[_0x6b23('0x3d')],{'$or':_[_0x6b23('0x2d')](_0x56331e[_0x6b23('0x36')],function(_0x4ea7a5){var _0x2c9fab={};_0x2c9fab[_0x4ea7a5]={'$like':'%'+_0x2a8f4d[_0x6b23('0x32')][_0x6b23('0x3f')]+'%'};return _0x2c9fab;})});}_0x56331e=_[_0x6b23('0x40')]({},_0x56331e,_0x2a8f4d[_0x6b23('0x41')]);return _0x36d6b7['getSubjects'](_0x56331e);}})[_0x6b23('0x26')](function(_0x5d867b){if(_0x5d867b){_0x3718b1=_0x5d867b[_0x6b23('0x38')];if(!_0x2a8f4d[_0x6b23('0x32')][_0x6b23('0x39')](_0x6b23('0x3a'))){_0x56331e['limit']=qs[_0x6b23('0x20')](_0x2a8f4d['query']['limit']);_0x56331e[_0x6b23('0x1e')]=qs[_0x6b23('0x1e')](_0x2a8f4d[_0x6b23('0x32')]['offset']);}return _0x36d6b7[_0x6b23('0x4f')](_0x56331e);}})[_0x6b23('0x26')](function(_0x5e892c){if(_0x5e892c){return _0x5e892c?{'count':_0x3718b1,'rows':_0x5e892c}:null;}})[_0x6b23('0x26')](respondWithResult(_0x10b748,null))['catch'](handleError(_0x10b748,null));};exports[_0x6b23('0x50')]=function(_0xaddd62,_0x586151,_0x2e4252){var _0x26c8bb={};var _0x18eb18={};var _0xa28f78;var _0x132e03;return db['VtigerConfiguration'][_0x6b23('0x4b')]({'where':{'id':_0xaddd62[_0x6b23('0x47')]['id']}})[_0x6b23('0x26')](handleEntityNotFound(_0x586151,null))[_0x6b23('0x26')](function(_0x26e401){if(_0x26e401){_0xa28f78=_0x26e401;_0x18eb18[_0x6b23('0x31')]=_['keys'](db['VtigerField'][_0x6b23('0x2f')]);_0x18eb18[_0x6b23('0x32')]=_[_0x6b23('0x33')](_0xaddd62[_0x6b23('0x32')]);_0x18eb18[_0x6b23('0x34')]=_[_0x6b23('0x35')](_0x18eb18[_0x6b23('0x31')],_0x18eb18[_0x6b23('0x32')]);_0x26c8bb[_0x6b23('0x36')]=_['intersection'](_0x18eb18['model'],qs[_0x6b23('0x37')](_0xaddd62[_0x6b23('0x32')][_0x6b23('0x37')]));_0x26c8bb[_0x6b23('0x36')]=_0x26c8bb[_0x6b23('0x36')][_0x6b23('0x38')]?_0x26c8bb['attributes']:_0x18eb18[_0x6b23('0x31')];_0x26c8bb[_0x6b23('0x3b')]=qs['sort'](_0xaddd62[_0x6b23('0x32')][_0x6b23('0x3c')]);_0x26c8bb[_0x6b23('0x3d')]=qs['filters'](_[_0x6b23('0x4d')](_0xaddd62['query'],_0x18eb18[_0x6b23('0x34')]));if(_0xaddd62[_0x6b23('0x32')][_0x6b23('0x3f')]){_0x26c8bb['where']=_[_0x6b23('0x40')](_0x26c8bb[_0x6b23('0x3d')],{'$or':_['map'](_0x26c8bb[_0x6b23('0x36')],function(_0x568ff1){var _0x3b6238={};_0x3b6238[_0x568ff1]={'$like':'%'+_0xaddd62[_0x6b23('0x32')][_0x6b23('0x3f')]+'%'};return _0x3b6238;})});}_0x26c8bb=_[_0x6b23('0x40')]({},_0x26c8bb,_0xaddd62[_0x6b23('0x41')]);return _0xa28f78[_0x6b23('0x50')](_0x26c8bb);}})[_0x6b23('0x26')](function(_0x263f39){if(_0x263f39){_0x132e03=_0x263f39[_0x6b23('0x38')];if(!_0xaddd62['query'][_0x6b23('0x39')](_0x6b23('0x3a'))){_0x26c8bb[_0x6b23('0x20')]=qs[_0x6b23('0x20')](_0xaddd62['query'][_0x6b23('0x20')]);_0x26c8bb[_0x6b23('0x1e')]=qs[_0x6b23('0x1e')](_0xaddd62[_0x6b23('0x32')][_0x6b23('0x1e')]);}return _0xa28f78[_0x6b23('0x50')](_0x26c8bb);}})[_0x6b23('0x26')](function(_0x5a2d34){if(_0x5a2d34){return _0x5a2d34?{'count':_0x132e03,'rows':_0x5a2d34}:null;}})[_0x6b23('0x26')](respondWithResult(_0x586151,null))['catch'](handleError(_0x586151,null));}; \ No newline at end of file +var _0x036d=['filters','intersection','attributes','fields','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','getFields','findOne','VtigerField','nolimit','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','VtigerConfiguration','rawAttributes','type','key','model','query'];(function(_0x40af98,_0x741324){var _0x570ba3=function(_0x28ae7f){while(--_0x28ae7f){_0x40af98['push'](_0x40af98['shift']());}};_0x570ba3(++_0x741324);}(_0x036d,0x15d));var _0xd036=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x036d[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0xd036('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd036('0x1'));var jsonpatch=require(_0xd036('0x2'));var rp=require(_0xd036('0x3'));var moment=require(_0xd036('0x4'));var BPromise=require(_0xd036('0x5'));var Mustache=require('mustache');var util=require(_0xd036('0x6'));var path=require(_0xd036('0x7'));var sox=require(_0xd036('0x8'));var csv=require(_0xd036('0x9'));var ejs=require(_0xd036('0xa'));var fs=require('fs');var fs_extra=require(_0xd036('0xb'));var _=require(_0xd036('0xc'));var squel=require('squel');var crypto=require(_0xd036('0xd'));var jsforce=require(_0xd036('0xe'));var deskjs=require(_0xd036('0xf'));var toCsv=require(_0xd036('0x9'));var querystring=require(_0xd036('0x10'));var Papa=require(_0xd036('0x11'));var Redis=require(_0xd036('0x12'));var authService=require(_0xd036('0x13'));var qs=require(_0xd036('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd036('0x15'));var logger=require(_0xd036('0x16'))(_0xd036('0x17'));var utils=require(_0xd036('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd036('0x19'))['db'];function respondWithStatusCode(_0x5b5b70,_0x195dfc){_0x195dfc=_0x195dfc||0xcc;return function(_0x24cf8b){if(_0x24cf8b){return _0x5b5b70[_0xd036('0x1a')](_0x195dfc);}return _0x5b5b70['status'](_0x195dfc)[_0xd036('0x1b')]();};}function respondWithResult(_0x4e4035,_0x3f325e){_0x3f325e=_0x3f325e||0xc8;return function(_0x2cc23d){if(_0x2cc23d){return _0x4e4035[_0xd036('0x1c')](_0x3f325e)[_0xd036('0x1d')](_0x2cc23d);}};}function respondWithFilteredResult(_0x153059,_0x3f9c83){return function(_0x192283){if(_0x192283){var _0x38df24=typeof _0x3f9c83[_0xd036('0x1e')]===_0xd036('0x1f')&&typeof _0x3f9c83[_0xd036('0x20')]===_0xd036('0x1f');var _0x263871=_0x192283[_0xd036('0x21')];var _0x219535=_0x38df24?0x0:_0x3f9c83['offset'];var _0x3ba9bf=_0x38df24?_0x192283[_0xd036('0x21')]:_0x3f9c83[_0xd036('0x1e')]+_0x3f9c83[_0xd036('0x20')];var _0x476dd4;if(_0x3ba9bf>=_0x263871){_0x3ba9bf=_0x263871;_0x476dd4=0xc8;}else{_0x476dd4=0xce;}_0x153059[_0xd036('0x1c')](_0x476dd4);return _0x153059[_0xd036('0x22')](_0xd036('0x23'),_0x219535+'-'+_0x3ba9bf+'/'+_0x263871)[_0xd036('0x1d')](_0x192283);}return null;};}function patchUpdates(_0x160ac6){return function(_0x373aff){try{jsonpatch[_0xd036('0x24')](_0x373aff,_0x160ac6,!![]);}catch(_0x46d778){return BPromise['reject'](_0x46d778);}return _0x373aff[_0xd036('0x25')]();};}function saveUpdates(_0x138cec,_0x2ccbfa){return function(_0xd4df9c){if(_0xd4df9c){return _0xd4df9c[_0xd036('0x26')](_0x138cec)[_0xd036('0x27')](function(_0x36b20f){return _0x36b20f;});}return null;};}function removeEntity(_0x1b006e,_0x3cc779){return function(_0x343d53){if(_0x343d53){return _0x343d53[_0xd036('0x28')]()[_0xd036('0x27')](function(){_0x1b006e[_0xd036('0x1c')](0xcc)[_0xd036('0x1b')]();});}};}function handleEntityNotFound(_0x593427,_0x173cab){return function(_0x4a6f57){if(!_0x4a6f57){_0x593427[_0xd036('0x1a')](0x194);}return _0x4a6f57;};}function handleError(_0x35934e,_0x4e91f0){_0x4e91f0=_0x4e91f0||0x1f4;return function(_0x3ed069){logger[_0xd036('0x29')](_0x3ed069['stack']);if(_0x3ed069[_0xd036('0x2a')]){delete _0x3ed069[_0xd036('0x2a')];}_0x35934e[_0xd036('0x1c')](_0x4e91f0)[_0xd036('0x2b')](_0x3ed069);};}exports['index']=function(_0x46361f,_0x1ac7de){var _0x2e2c5d={},_0x61bb26={},_0x3c6f3b={'count':0x0,'rows':[]};var _0x26e51f=_[_0xd036('0x2c')](db[_0xd036('0x2d')][_0xd036('0x2e')],function(_0x3cc5df){return{'name':_0x3cc5df['fieldName'],'type':_0x3cc5df[_0xd036('0x2f')][_0xd036('0x30')]};});_0x61bb26[_0xd036('0x31')]=_['map'](_0x26e51f,_0xd036('0x2a'));_0x61bb26[_0xd036('0x32')]=_['keys'](_0x46361f['query']);_0x61bb26[_0xd036('0x33')]=_[_0xd036('0x34')](_0x61bb26[_0xd036('0x31')],_0x61bb26[_0xd036('0x32')]);_0x2e2c5d[_0xd036('0x35')]=_[_0xd036('0x34')](_0x61bb26[_0xd036('0x31')],qs[_0xd036('0x36')](_0x46361f[_0xd036('0x32')]['fields']));_0x2e2c5d[_0xd036('0x35')]=_0x2e2c5d[_0xd036('0x35')]['length']?_0x2e2c5d[_0xd036('0x35')]:_0x61bb26[_0xd036('0x31')];if(!_0x46361f[_0xd036('0x32')]['hasOwnProperty']('nolimit')){_0x2e2c5d[_0xd036('0x20')]=qs[_0xd036('0x20')](_0x46361f[_0xd036('0x32')][_0xd036('0x20')]);_0x2e2c5d['offset']=qs[_0xd036('0x1e')](_0x46361f[_0xd036('0x32')]['offset']);}_0x2e2c5d[_0xd036('0x37')]=qs[_0xd036('0x38')](_0x46361f[_0xd036('0x32')][_0xd036('0x38')]);_0x2e2c5d[_0xd036('0x39')]=qs[_0xd036('0x33')](_['pick'](_0x46361f[_0xd036('0x32')],_0x61bb26['filters']),_0x26e51f);if(_0x46361f[_0xd036('0x32')]['filter']){_0x2e2c5d[_0xd036('0x39')]=_[_0xd036('0x3a')](_0x2e2c5d['where'],{'$or':_['map'](_0x26e51f,function(_0x2c2472){if(_0x2c2472['type']!=='VIRTUAL'){var _0x419df9={};_0x419df9[_0x2c2472[_0xd036('0x2a')]]={'$like':'%'+_0x46361f[_0xd036('0x32')][_0xd036('0x3b')]+'%'};return _0x419df9;}})});}_0x2e2c5d=_[_0xd036('0x3a')]({},_0x2e2c5d,_0x46361f[_0xd036('0x3c')]);var _0xe8bdc={'where':_0x2e2c5d['where']};return db[_0xd036('0x2d')][_0xd036('0x21')](_0xe8bdc)['then'](function(_0x3a08d1){_0x3c6f3b[_0xd036('0x21')]=_0x3a08d1;if(_0x46361f['query'][_0xd036('0x3d')]){_0x2e2c5d[_0xd036('0x3e')]=[{'all':!![]}];}return db[_0xd036('0x2d')][_0xd036('0x3f')](_0x2e2c5d);})[_0xd036('0x27')](function(_0x1b3f17){_0x3c6f3b[_0xd036('0x40')]=_0x1b3f17;return _0x3c6f3b;})[_0xd036('0x27')](respondWithFilteredResult(_0x1ac7de,_0x2e2c5d))[_0xd036('0x41')](handleError(_0x1ac7de,null));};exports['show']=function(_0x2fdf75,_0x5a9c18){var _0x34f294={'raw':![],'where':{'id':_0x2fdf75[_0xd036('0x42')]['id']}},_0x3265d1={};_0x3265d1[_0xd036('0x31')]=_[_0xd036('0x43')](db[_0xd036('0x2d')][_0xd036('0x2e')]);_0x3265d1[_0xd036('0x32')]=_[_0xd036('0x43')](_0x2fdf75[_0xd036('0x32')]);_0x3265d1[_0xd036('0x33')]=_['intersection'](_0x3265d1[_0xd036('0x31')],_0x3265d1[_0xd036('0x32')]);_0x34f294[_0xd036('0x35')]=_[_0xd036('0x34')](_0x3265d1[_0xd036('0x31')],qs['fields'](_0x2fdf75['query'][_0xd036('0x36')]));_0x34f294[_0xd036('0x35')]=_0x34f294[_0xd036('0x35')][_0xd036('0x44')]?_0x34f294[_0xd036('0x35')]:_0x3265d1[_0xd036('0x31')];if(_0x2fdf75['query']['includeAll']){_0x34f294[_0xd036('0x3e')]=[{'all':!![]}];}_0x34f294=_[_0xd036('0x3a')]({},_0x34f294,_0x2fdf75[_0xd036('0x3c')]);return db[_0xd036('0x2d')][_0xd036('0x45')](_0x34f294)['then'](handleEntityNotFound(_0x5a9c18,null))[_0xd036('0x27')](respondWithResult(_0x5a9c18,null))[_0xd036('0x41')](handleError(_0x5a9c18,null));};exports[_0xd036('0x46')]=function(_0x4a96a9,_0x22594d){return db[_0xd036('0x2d')]['create'](_0x4a96a9[_0xd036('0x47')],{})[_0xd036('0x27')](respondWithResult(_0x22594d,0xc9))[_0xd036('0x41')](handleError(_0x22594d,null));};exports['update']=function(_0x189002,_0x4508bf){if(_0x189002['body']['id']){delete _0x189002[_0xd036('0x47')]['id'];}return db[_0xd036('0x2d')][_0xd036('0x45')]({'where':{'id':_0x189002[_0xd036('0x42')]['id']}})[_0xd036('0x27')](handleEntityNotFound(_0x4508bf,null))[_0xd036('0x27')](saveUpdates(_0x189002[_0xd036('0x47')],null))[_0xd036('0x27')](respondWithResult(_0x4508bf,null))['catch'](handleError(_0x4508bf,null));};exports[_0xd036('0x28')]=function(_0x414650,_0x10d6ba){return db[_0xd036('0x2d')][_0xd036('0x45')]({'where':{'id':_0x414650[_0xd036('0x42')]['id']}})[_0xd036('0x27')](handleEntityNotFound(_0x10d6ba,null))[_0xd036('0x27')](removeEntity(_0x10d6ba,null))[_0xd036('0x41')](handleError(_0x10d6ba,null));};exports[_0xd036('0x48')]=function(_0x310d18,_0x5190e0,_0x19db16){var _0x1e9229={};var _0x29825d={};var _0x3b5ef6;var _0x3a8b2d;return db['VtigerConfiguration'][_0xd036('0x49')]({'where':{'id':_0x310d18[_0xd036('0x42')]['id']}})[_0xd036('0x27')](handleEntityNotFound(_0x5190e0,null))['then'](function(_0x44e0cb){if(_0x44e0cb){_0x3b5ef6=_0x44e0cb;_0x29825d[_0xd036('0x31')]=_[_0xd036('0x43')](db[_0xd036('0x4a')]['rawAttributes']);_0x29825d[_0xd036('0x32')]=_[_0xd036('0x43')](_0x310d18[_0xd036('0x32')]);_0x29825d[_0xd036('0x33')]=_[_0xd036('0x34')](_0x29825d[_0xd036('0x31')],_0x29825d[_0xd036('0x32')]);_0x1e9229[_0xd036('0x35')]=_['intersection'](_0x29825d[_0xd036('0x31')],qs[_0xd036('0x36')](_0x310d18[_0xd036('0x32')]['fields']));_0x1e9229['attributes']=_0x1e9229[_0xd036('0x35')]['length']?_0x1e9229[_0xd036('0x35')]:_0x29825d[_0xd036('0x31')];_0x1e9229['order']=qs[_0xd036('0x38')](_0x310d18[_0xd036('0x32')][_0xd036('0x38')]);_0x1e9229[_0xd036('0x39')]=qs[_0xd036('0x33')](_['pick'](_0x310d18[_0xd036('0x32')],_0x29825d[_0xd036('0x33')]));if(_0x310d18[_0xd036('0x32')][_0xd036('0x3b')]){_0x1e9229[_0xd036('0x39')]=_[_0xd036('0x3a')](_0x1e9229[_0xd036('0x39')],{'$or':_['map'](_0x1e9229[_0xd036('0x35')],function(_0x2a7cb3){var _0x3abbf7={};_0x3abbf7[_0x2a7cb3]={'$like':'%'+_0x310d18[_0xd036('0x32')]['filter']+'%'};return _0x3abbf7;})});}_0x1e9229=_[_0xd036('0x3a')]({},_0x1e9229,_0x310d18[_0xd036('0x3c')]);return _0x3b5ef6[_0xd036('0x48')](_0x1e9229);}})[_0xd036('0x27')](function(_0x1164f8){if(_0x1164f8){_0x3a8b2d=_0x1164f8[_0xd036('0x44')];if(!_0x310d18[_0xd036('0x32')]['hasOwnProperty'](_0xd036('0x4b'))){_0x1e9229[_0xd036('0x20')]=qs[_0xd036('0x20')](_0x310d18[_0xd036('0x32')][_0xd036('0x20')]);_0x1e9229['offset']=qs['offset'](_0x310d18[_0xd036('0x32')][_0xd036('0x1e')]);}return _0x3b5ef6[_0xd036('0x48')](_0x1e9229);}})['then'](function(_0x1875ac){if(_0x1875ac){return _0x1875ac?{'count':_0x3a8b2d,'rows':_0x1875ac}:null;}})[_0xd036('0x27')](respondWithResult(_0x5190e0,null))[_0xd036('0x41')](handleError(_0x5190e0,null));};exports['getSubjects']=function(_0x19c451,_0x536e41,_0x109a74){var _0x168472={};var _0x34932b={};var _0x189714;var _0x38a93a;return db[_0xd036('0x2d')][_0xd036('0x49')]({'where':{'id':_0x19c451[_0xd036('0x42')]['id']}})[_0xd036('0x27')](handleEntityNotFound(_0x536e41,null))[_0xd036('0x27')](function(_0x4de191){if(_0x4de191){_0x189714=_0x4de191;_0x34932b[_0xd036('0x31')]=_['keys'](db[_0xd036('0x4a')][_0xd036('0x2e')]);_0x34932b[_0xd036('0x32')]=_[_0xd036('0x43')](_0x19c451[_0xd036('0x32')]);_0x34932b['filters']=_[_0xd036('0x34')](_0x34932b[_0xd036('0x31')],_0x34932b['query']);_0x168472[_0xd036('0x35')]=_[_0xd036('0x34')](_0x34932b[_0xd036('0x31')],qs['fields'](_0x19c451['query'][_0xd036('0x36')]));_0x168472[_0xd036('0x35')]=_0x168472['attributes'][_0xd036('0x44')]?_0x168472[_0xd036('0x35')]:_0x34932b[_0xd036('0x31')];_0x168472[_0xd036('0x37')]=qs[_0xd036('0x38')](_0x19c451[_0xd036('0x32')][_0xd036('0x38')]);_0x168472[_0xd036('0x39')]=qs[_0xd036('0x33')](_[_0xd036('0x4c')](_0x19c451[_0xd036('0x32')],_0x34932b[_0xd036('0x33')]));if(_0x19c451[_0xd036('0x32')][_0xd036('0x3b')]){_0x168472[_0xd036('0x39')]=_[_0xd036('0x3a')](_0x168472[_0xd036('0x39')],{'$or':_['map'](_0x168472[_0xd036('0x35')],function(_0x1eb2ec){var _0x429c61={};_0x429c61[_0x1eb2ec]={'$like':'%'+_0x19c451[_0xd036('0x32')][_0xd036('0x3b')]+'%'};return _0x429c61;})});}_0x168472=_[_0xd036('0x3a')]({},_0x168472,_0x19c451[_0xd036('0x3c')]);return _0x189714[_0xd036('0x4d')](_0x168472);}})[_0xd036('0x27')](function(_0x543d22){if(_0x543d22){_0x38a93a=_0x543d22['length'];if(!_0x19c451[_0xd036('0x32')][_0xd036('0x4e')](_0xd036('0x4b'))){_0x168472[_0xd036('0x20')]=qs[_0xd036('0x20')](_0x19c451[_0xd036('0x32')][_0xd036('0x20')]);_0x168472['offset']=qs[_0xd036('0x1e')](_0x19c451['query'][_0xd036('0x1e')]);}return _0x189714[_0xd036('0x4d')](_0x168472);}})[_0xd036('0x27')](function(_0x4c15c5){if(_0x4c15c5){return _0x4c15c5?{'count':_0x38a93a,'rows':_0x4c15c5}:null;}})['then'](respondWithResult(_0x536e41,null))[_0xd036('0x41')](handleError(_0x536e41,null));};exports[_0xd036('0x4f')]=function(_0x304ee6,_0x4426df,_0x2a65c6){var _0x5bec0f={};var _0x2ebc5b={};var _0x3317f8;var _0x14cfb9;return db['VtigerConfiguration'][_0xd036('0x49')]({'where':{'id':_0x304ee6[_0xd036('0x42')]['id']}})[_0xd036('0x27')](handleEntityNotFound(_0x4426df,null))['then'](function(_0x2f6480){if(_0x2f6480){_0x3317f8=_0x2f6480;_0x2ebc5b[_0xd036('0x31')]=_[_0xd036('0x43')](db[_0xd036('0x4a')][_0xd036('0x2e')]);_0x2ebc5b['query']=_['keys'](_0x304ee6[_0xd036('0x32')]);_0x2ebc5b[_0xd036('0x33')]=_['intersection'](_0x2ebc5b['model'],_0x2ebc5b[_0xd036('0x32')]);_0x5bec0f['attributes']=_[_0xd036('0x34')](_0x2ebc5b[_0xd036('0x31')],qs[_0xd036('0x36')](_0x304ee6[_0xd036('0x32')][_0xd036('0x36')]));_0x5bec0f[_0xd036('0x35')]=_0x5bec0f[_0xd036('0x35')][_0xd036('0x44')]?_0x5bec0f[_0xd036('0x35')]:_0x2ebc5b[_0xd036('0x31')];_0x5bec0f[_0xd036('0x37')]=qs[_0xd036('0x38')](_0x304ee6[_0xd036('0x32')][_0xd036('0x38')]);_0x5bec0f[_0xd036('0x39')]=qs[_0xd036('0x33')](_[_0xd036('0x4c')](_0x304ee6[_0xd036('0x32')],_0x2ebc5b[_0xd036('0x33')]));if(_0x304ee6[_0xd036('0x32')][_0xd036('0x3b')]){_0x5bec0f[_0xd036('0x39')]=_[_0xd036('0x3a')](_0x5bec0f['where'],{'$or':_['map'](_0x5bec0f[_0xd036('0x35')],function(_0x42384e){var _0x49a6f3={};_0x49a6f3[_0x42384e]={'$like':'%'+_0x304ee6[_0xd036('0x32')][_0xd036('0x3b')]+'%'};return _0x49a6f3;})});}_0x5bec0f=_[_0xd036('0x3a')]({},_0x5bec0f,_0x304ee6['options']);return _0x3317f8['getDescriptions'](_0x5bec0f);}})['then'](function(_0x199184){if(_0x199184){_0x14cfb9=_0x199184[_0xd036('0x44')];if(!_0x304ee6[_0xd036('0x32')]['hasOwnProperty'](_0xd036('0x4b'))){_0x5bec0f[_0xd036('0x20')]=qs[_0xd036('0x20')](_0x304ee6[_0xd036('0x32')][_0xd036('0x20')]);_0x5bec0f[_0xd036('0x1e')]=qs[_0xd036('0x1e')](_0x304ee6['query']['offset']);}return _0x3317f8[_0xd036('0x4f')](_0x5bec0f);}})['then'](function(_0x23db94){if(_0x23db94){return _0x23db94?{'count':_0x14cfb9,'rows':_0x23db94}:null;}})[_0xd036('0x27')](respondWithResult(_0x4426df,null))['catch'](handleError(_0x4426df,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f750976..05cdda9 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 _0x40e7=['request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment'];(function(_0x535bfb,_0x2f1cc4){var _0x3d70ab=function(_0x54220a){while(--_0x54220a){_0x535bfb['push'](_0x535bfb['shift']());}};_0x3d70ab(++_0x2f1cc4);}(_0x40e7,0x164));var _0x740e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x40e7[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x740e('0x0'));var util=require('util');var logger=require(_0x740e('0x1'))(_0x740e('0x2'));var moment=require(_0x740e('0x3'));var BPromise=require('bluebird');var rp=require(_0x740e('0x4'));var fs=require('fs');var path=require(_0x740e('0x5'));var rimraf=require('rimraf');var config=require(_0x740e('0x6'));var attributes=require(_0x740e('0x7'));module[_0x740e('0x8')]=function(_0x31dd28,_0x4558b7){return _0x31dd28[_0x740e('0x9')](_0x740e('0xa'),attributes,{'tableName':_0x740e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f6b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x8f6b,0x8a));var _0xb8f6=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8f6b[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var logger=require(_0xb8f6('0x2'))(_0xb8f6('0x3'));var moment=require(_0xb8f6('0x4'));var BPromise=require(_0xb8f6('0x5'));var rp=require(_0xb8f6('0x6'));var fs=require('fs');var path=require(_0xb8f6('0x7'));var rimraf=require(_0xb8f6('0x8'));var config=require(_0xb8f6('0x9'));var attributes=require(_0xb8f6('0xa'));module[_0xb8f6('0xb')]=function(_0x3c5061,_0x4eb212){return _0x3c5061[_0xb8f6('0xc')]('VtigerConfiguration',attributes,{'tableName':_0xb8f6('0xd'),'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 0d0e284..5c2f287 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 _0x21c8=['rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x21b07d,_0x3e64e7){var _0x2f85fd=function(_0x1e6894){while(--_0x1e6894){_0x21b07d['push'](_0x21b07d['shift']());}};_0x2f85fd(++_0x3e64e7);}(_0x21c8,0xb8));var _0x821c=function(_0x46b01f,_0x43dc27){_0x46b01f=_0x46b01f-0x0;var _0x5b091a=_0x21c8[_0x46b01f];return _0x5b091a;};'use strict';var _=require(_0x821c('0x0'));var util=require('util');var moment=require(_0x821c('0x1'));var BPromise=require(_0x821c('0x2'));var rs=require(_0x821c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x821c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x821c('0x5'))(_0x821c('0x6'));var config=require(_0x821c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x821c('0x8')][_0x821c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d1b18,_0x45e9fe,_0x5099d7){return new BPromise(function(_0xb17ff9,_0x3903e2){return client[_0x821c('0xa')](_0x2d1b18,_0x5099d7)[_0x821c('0xb')](function(_0x5e04b8){logger[_0x821c('0xc')](_0x821c('0xd'),_0x45e9fe,_0x821c('0xe'));logger[_0x821c('0xf')](_0x821c('0x10'),_0x45e9fe,'request\x20sent',JSON['stringify'](_0x5e04b8));if(_0x5e04b8[_0x821c('0x11')]){if(_0x5e04b8[_0x821c('0x11')]['code']===0x1f4){logger[_0x821c('0x11')](_0x821c('0xd'),_0x45e9fe,_0x5e04b8[_0x821c('0x11')][_0x821c('0x12')]);return _0x3903e2(_0x5e04b8['error'][_0x821c('0x12')]);}logger['error'](_0x821c('0xd'),_0x45e9fe,_0x5e04b8['error'][_0x821c('0x12')]);return _0xb17ff9(_0x5e04b8[_0x821c('0x11')][_0x821c('0x12')]);}else{logger['info'](_0x821c('0xd'),_0x45e9fe,_0x821c('0xe'));_0xb17ff9(_0x5e04b8['result']['message']);}})['catch'](function(_0x4a9684){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x45e9fe,_0x4a9684);_0x3903e2(_0x4a9684);});});} \ No newline at end of file +var _0x30a4=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0x30a4,0x131));var _0x430a=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x30a4[_0x485201];return _0x9ca98a;};'use strict';var _=require(_0x430a('0x0'));var util=require(_0x430a('0x1'));var moment=require(_0x430a('0x2'));var BPromise=require(_0x430a('0x3'));var rs=require(_0x430a('0x4'));var fs=require('fs');var Redis=require(_0x430a('0x5'));var db=require(_0x430a('0x6'))['db'];var utils=require(_0x430a('0x7'));var logger=require(_0x430a('0x8'))(_0x430a('0x9'));var config=require(_0x430a('0xa'));var jayson=require(_0x430a('0xb'));var client=jayson[_0x430a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x230c22,_0x1da319,_0x101b7e){return new BPromise(function(_0x559388,_0x2f2271){return client[_0x430a('0xd')](_0x230c22,_0x101b7e)[_0x430a('0xe')](function(_0x1db3cd){logger[_0x430a('0xf')](_0x430a('0x10'),_0x1da319,_0x430a('0x11'));logger[_0x430a('0x12')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1da319,'request\x20sent',JSON[_0x430a('0x13')](_0x1db3cd));if(_0x1db3cd[_0x430a('0x14')]){if(_0x1db3cd['error'][_0x430a('0x15')]===0x1f4){logger[_0x430a('0x14')](_0x430a('0x10'),_0x1da319,_0x1db3cd[_0x430a('0x14')][_0x430a('0x16')]);return _0x2f2271(_0x1db3cd[_0x430a('0x14')][_0x430a('0x16')]);}logger[_0x430a('0x14')](_0x430a('0x10'),_0x1da319,_0x1db3cd[_0x430a('0x14')]['message']);return _0x559388(_0x1db3cd[_0x430a('0x14')]['message']);}else{logger[_0x430a('0xf')](_0x430a('0x10'),_0x1da319,_0x430a('0x11'));_0x559388(_0x1db3cd[_0x430a('0x17')][_0x430a('0x16')]);}})[_0x430a('0x18')](function(_0x104db4){logger[_0x430a('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x1da319,_0x104db4);_0x2f2271(_0x104db4);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 05fcf17..c209834 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 _0x1bd1=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intVtigerField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x3fb510,_0x284994){var _0x4ed645=function(_0x452d6c){while(--_0x452d6c){_0x3fb510['push'](_0x3fb510['shift']());}};_0x4ed645(++_0x284994);}(_0x1bd1,0xd9));var _0x11bd=function(_0xdd66e5,_0x579918){_0xdd66e5=_0xdd66e5-0x0;var _0x2146bc=_0x1bd1[_0xdd66e5];return _0x2146bc;};'use strict';var multer=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var path=require(_0x11bd('0x2'));var timeout=require(_0x11bd('0x3'));var express=require(_0x11bd('0x4'));var router=express[_0x11bd('0x5')]();var fs_extra=require(_0x11bd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11bd('0x7'));router[_0x11bd('0x8')]('/',auth[_0x11bd('0x9')](),controller['index']);router['get'](_0x11bd('0xa'),auth[_0x11bd('0x9')](),controller['show']);router[_0x11bd('0xb')]('/',auth['isAuthenticated'](),controller[_0x11bd('0xc')]);router[_0x11bd('0xd')](_0x11bd('0xa'),auth['isAuthenticated'](),controller[_0x11bd('0xe')]);router[_0x11bd('0xf')](_0x11bd('0xa'),auth[_0x11bd('0x9')](),controller[_0x11bd('0x10')]);module[_0x11bd('0x11')]=router; \ No newline at end of file +var _0xc0b0=['index','/:id','show','post','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x521ab2,_0x40db7f){var _0x803491=function(_0x56b26a){while(--_0x56b26a){_0x521ab2['push'](_0x521ab2['shift']());}};_0x803491(++_0x40db7f);}(_0xc0b0,0x8d));var _0x0c0b=function(_0x4e89fc,_0xfcd120){_0x4e89fc=_0x4e89fc-0x0;var _0x10d46b=_0xc0b0[_0x4e89fc];return _0x10d46b;};'use strict';var multer=require('multer');var util=require(_0x0c0b('0x0'));var path=require(_0x0c0b('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c0b('0x2'));var router=express[_0x0c0b('0x3')]();var fs_extra=require(_0x0c0b('0x4'));var auth=require(_0x0c0b('0x5'));var interaction=require(_0x0c0b('0x6'));var config=require(_0x0c0b('0x7'));var controller=require(_0x0c0b('0x8'));router[_0x0c0b('0x9')]('/',auth[_0x0c0b('0xa')](),controller[_0x0c0b('0xb')]);router['get'](_0x0c0b('0xc'),auth['isAuthenticated'](),controller[_0x0c0b('0xd')]);router[_0x0c0b('0xe')]('/',auth[_0x0c0b('0xa')](),controller['create']);router['put'](_0x0c0b('0xc'),auth[_0x0c0b('0xa')](),controller[_0x0c0b('0xf')]);router[_0x0c0b('0x10')]('/:id',auth[_0x0c0b('0xa')](),controller[_0x0c0b('0x11')]);module[_0x0c0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 859f203..3711ec8 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 _0x840f=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x840f,0x16a));var _0xf840=function(_0x5cbe0f,_0x4cb3d2){_0x5cbe0f=_0x5cbe0f-0x0;var _0x2d3aeb=_0x840f[_0x5cbe0f];return _0x2d3aeb;};'use strict';var Sequelize=require(_0xf840('0x0'));module[_0xf840('0x1')]={'type':{'type':Sequelize[_0xf840('0x2')](_0xf840('0x3'),_0xf840('0x4'),'customVariable',_0xf840('0x5'),_0xf840('0x6')),'defaultValue':_0xf840('0x3')},'content':{'type':Sequelize[_0xf840('0x7')]},'key':{'type':Sequelize[_0xf840('0x7')]},'keyType':{'type':Sequelize[_0xf840('0x2')]('string',_0xf840('0x4'),_0xf840('0x8'))},'keyContent':{'type':Sequelize[_0xf840('0x7')]},'idField':{'type':Sequelize[_0xf840('0x7')]},'nameField':{'type':Sequelize[_0xf840('0x7')]},'customField':{'type':Sequelize[_0xf840('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf840('0x7')]}}; \ No newline at end of file +var _0xdcc3=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4193ed,_0x417f27){var _0x202b5f=function(_0x66b311){while(--_0x66b311){_0x4193ed['push'](_0x4193ed['shift']());}};_0x202b5f(++_0x417f27);}(_0xdcc3,0x1cd));var _0x3dcc=function(_0x1776f8,_0x4ce775){_0x1776f8=_0x1776f8-0x0;var _0x3c0de0=_0xdcc3[_0x1776f8];return _0x3c0de0;};'use strict';var Sequelize=require(_0x3dcc('0x0'));module[_0x3dcc('0x1')]={'type':{'type':Sequelize[_0x3dcc('0x2')](_0x3dcc('0x3'),_0x3dcc('0x4'),_0x3dcc('0x5'),_0x3dcc('0x6'),_0x3dcc('0x7')),'defaultValue':_0x3dcc('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3dcc('0x8')]},'keyType':{'type':Sequelize[_0x3dcc('0x2')](_0x3dcc('0x3'),'variable',_0x3dcc('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3dcc('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3dcc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3dcc('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 679798e..d9b714b 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 _0x9b48=['includeAll','include','findAll','rows','params','filters','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options'];(function(_0x2cc985,_0xd0de2d){var _0x91ff81=function(_0x9305b0){while(--_0x9305b0){_0x2cc985['push'](_0x2cc985['shift']());}};_0x91ff81(++_0xd0de2d);}(_0x9b48,0x139));var _0x89b4=function(_0x5b4824,_0x1f239f){_0x5b4824=_0x5b4824-0x0;var _0x282435=_0x9b48[_0x5b4824];return _0x282435;};'use strict';var emlformat=require(_0x89b4('0x0'));var rimraf=require(_0x89b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89b4('0x2'));var rp=require('request-promise');var moment=require(_0x89b4('0x3'));var BPromise=require(_0x89b4('0x4'));var Mustache=require(_0x89b4('0x5'));var util=require(_0x89b4('0x6'));var path=require(_0x89b4('0x7'));var sox=require(_0x89b4('0x8'));var csv=require(_0x89b4('0x9'));var ejs=require(_0x89b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x89b4('0xb'));var crypto=require(_0x89b4('0xc'));var jsforce=require(_0x89b4('0xd'));var deskjs=require(_0x89b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x89b4('0xf'));var Papa=require(_0x89b4('0x10'));var Redis=require(_0x89b4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x89b4('0x12'));var hardwareService=require(_0x89b4('0x13'));var logger=require(_0x89b4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x89b4('0x15'));var licenseUtil=require(_0x89b4('0x16'));var db=require(_0x89b4('0x17'))['db'];function respondWithStatusCode(_0x490c00,_0x61664b){_0x61664b=_0x61664b||0xcc;return function(_0x13a2c1){if(_0x13a2c1){return _0x490c00[_0x89b4('0x18')](_0x61664b);}return _0x490c00['status'](_0x61664b)[_0x89b4('0x19')]();};}function respondWithResult(_0x1f6653,_0x52fa3a){_0x52fa3a=_0x52fa3a||0xc8;return function(_0x523d95){if(_0x523d95){return _0x1f6653[_0x89b4('0x1a')](_0x52fa3a)[_0x89b4('0x1b')](_0x523d95);}};}function respondWithFilteredResult(_0x52d55a,_0x2c6481){return function(_0x2e3dee){if(_0x2e3dee){var _0x2b4778=typeof _0x2c6481[_0x89b4('0x1c')]===_0x89b4('0x1d')&&typeof _0x2c6481[_0x89b4('0x1e')]==='undefined';var _0x46928f=_0x2e3dee[_0x89b4('0x1f')];var _0x1890da=_0x2b4778?0x0:_0x2c6481['offset'];var _0x5b570a=_0x2b4778?_0x2e3dee['count']:_0x2c6481[_0x89b4('0x1c')]+_0x2c6481[_0x89b4('0x1e')];var _0x504a5f;if(_0x5b570a>=_0x46928f){_0x5b570a=_0x46928f;_0x504a5f=0xc8;}else{_0x504a5f=0xce;}_0x52d55a['status'](_0x504a5f);return _0x52d55a[_0x89b4('0x20')](_0x89b4('0x21'),_0x1890da+'-'+_0x5b570a+'/'+_0x46928f)['json'](_0x2e3dee);}return null;};}function patchUpdates(_0x4358a1){return function(_0x58babc){try{jsonpatch[_0x89b4('0x22')](_0x58babc,_0x4358a1,!![]);}catch(_0x5a6ab9){return BPromise[_0x89b4('0x23')](_0x5a6ab9);}return _0x58babc[_0x89b4('0x24')]();};}function saveUpdates(_0x253790,_0x51feb2){return function(_0x3f1d69){if(_0x3f1d69){return _0x3f1d69[_0x89b4('0x25')](_0x253790)[_0x89b4('0x26')](function(_0x4f6da7){return _0x4f6da7;});}return null;};}function removeEntity(_0x560e48,_0x20f56f){return function(_0x188569){if(_0x188569){return _0x188569[_0x89b4('0x27')]()[_0x89b4('0x26')](function(){_0x560e48[_0x89b4('0x1a')](0xcc)[_0x89b4('0x19')]();});}};}function handleEntityNotFound(_0x5ea89c,_0x56223e){return function(_0x42facc){if(!_0x42facc){_0x5ea89c[_0x89b4('0x18')](0x194);}return _0x42facc;};}function handleError(_0x1244c3,_0x12d5ec){_0x12d5ec=_0x12d5ec||0x1f4;return function(_0x33df98){logger[_0x89b4('0x28')](_0x33df98[_0x89b4('0x29')]);if(_0x33df98['name']){delete _0x33df98[_0x89b4('0x2a')];}_0x1244c3[_0x89b4('0x1a')](_0x12d5ec)[_0x89b4('0x2b')](_0x33df98);};}exports[_0x89b4('0x2c')]=function(_0x1ef229,_0x58e5db){var _0x1223ad={},_0x4e2373={},_0x2a0ac6={'count':0x0,'rows':[]};var _0x37773a=_[_0x89b4('0x2d')](db[_0x89b4('0x2e')][_0x89b4('0x2f')],function(_0x28bf6a){return{'name':_0x28bf6a[_0x89b4('0x30')],'type':_0x28bf6a['type'][_0x89b4('0x31')]};});_0x4e2373[_0x89b4('0x32')]=_['map'](_0x37773a,_0x89b4('0x2a'));_0x4e2373[_0x89b4('0x33')]=_[_0x89b4('0x34')](_0x1ef229[_0x89b4('0x33')]);_0x4e2373['filters']=_[_0x89b4('0x35')](_0x4e2373[_0x89b4('0x32')],_0x4e2373[_0x89b4('0x33')]);_0x1223ad['attributes']=_[_0x89b4('0x35')](_0x4e2373[_0x89b4('0x32')],qs[_0x89b4('0x36')](_0x1ef229[_0x89b4('0x33')][_0x89b4('0x36')]));_0x1223ad[_0x89b4('0x37')]=_0x1223ad[_0x89b4('0x37')][_0x89b4('0x38')]?_0x1223ad[_0x89b4('0x37')]:_0x4e2373[_0x89b4('0x32')];if(!_0x1ef229[_0x89b4('0x33')][_0x89b4('0x39')](_0x89b4('0x3a'))){_0x1223ad[_0x89b4('0x1e')]=qs['limit'](_0x1ef229[_0x89b4('0x33')][_0x89b4('0x1e')]);_0x1223ad['offset']=qs['offset'](_0x1ef229[_0x89b4('0x33')][_0x89b4('0x1c')]);}_0x1223ad[_0x89b4('0x3b')]=qs[_0x89b4('0x3c')](_0x1ef229[_0x89b4('0x33')][_0x89b4('0x3c')]);_0x1223ad[_0x89b4('0x3d')]=qs['filters'](_[_0x89b4('0x3e')](_0x1ef229[_0x89b4('0x33')],_0x4e2373['filters']),_0x37773a);if(_0x1ef229[_0x89b4('0x33')]['filter']){_0x1223ad[_0x89b4('0x3d')]=_[_0x89b4('0x3f')](_0x1223ad['where'],{'$or':_[_0x89b4('0x2d')](_0x37773a,function(_0x41553c){if(_0x41553c[_0x89b4('0x40')]!=='VIRTUAL'){var _0x3f7aeb={};_0x3f7aeb[_0x41553c['name']]={'$like':'%'+_0x1ef229[_0x89b4('0x33')][_0x89b4('0x41')]+'%'};return _0x3f7aeb;}})});}_0x1223ad=_[_0x89b4('0x3f')]({},_0x1223ad,_0x1ef229[_0x89b4('0x42')]);var _0x2c6d1b={'where':_0x1223ad[_0x89b4('0x3d')]};return db[_0x89b4('0x2e')][_0x89b4('0x1f')](_0x2c6d1b)[_0x89b4('0x26')](function(_0x165375){_0x2a0ac6[_0x89b4('0x1f')]=_0x165375;if(_0x1ef229[_0x89b4('0x33')][_0x89b4('0x43')]){_0x1223ad[_0x89b4('0x44')]=[{'all':!![]}];}return db[_0x89b4('0x2e')][_0x89b4('0x45')](_0x1223ad);})['then'](function(_0xba8239){_0x2a0ac6[_0x89b4('0x46')]=_0xba8239;return _0x2a0ac6;})[_0x89b4('0x26')](respondWithFilteredResult(_0x58e5db,_0x1223ad))['catch'](handleError(_0x58e5db,null));};exports['show']=function(_0x5d61ce,_0x290400){var _0x1e6576={'raw':!![],'where':{'id':_0x5d61ce[_0x89b4('0x47')]['id']}},_0x2eba8e={};_0x2eba8e[_0x89b4('0x32')]=_[_0x89b4('0x34')](db[_0x89b4('0x2e')][_0x89b4('0x2f')]);_0x2eba8e[_0x89b4('0x33')]=_['keys'](_0x5d61ce[_0x89b4('0x33')]);_0x2eba8e[_0x89b4('0x48')]=_[_0x89b4('0x35')](_0x2eba8e[_0x89b4('0x32')],_0x2eba8e[_0x89b4('0x33')]);_0x1e6576['attributes']=_[_0x89b4('0x35')](_0x2eba8e['model'],qs[_0x89b4('0x36')](_0x5d61ce['query']['fields']));_0x1e6576['attributes']=_0x1e6576[_0x89b4('0x37')][_0x89b4('0x38')]?_0x1e6576['attributes']:_0x2eba8e[_0x89b4('0x32')];if(_0x5d61ce['query'][_0x89b4('0x43')]){_0x1e6576['include']=[{'all':!![]}];}_0x1e6576=_[_0x89b4('0x3f')]({},_0x1e6576,_0x5d61ce[_0x89b4('0x42')]);return db[_0x89b4('0x2e')]['find'](_0x1e6576)[_0x89b4('0x26')](handleEntityNotFound(_0x290400,null))[_0x89b4('0x26')](respondWithResult(_0x290400,null))[_0x89b4('0x49')](handleError(_0x290400,null));};exports[_0x89b4('0x4a')]=function(_0xb500d5,_0x5be7f3){return db['VtigerField'][_0x89b4('0x4a')](_0xb500d5[_0x89b4('0x4b')],{})[_0x89b4('0x26')](respondWithResult(_0x5be7f3,0xc9))[_0x89b4('0x49')](handleError(_0x5be7f3,null));};exports[_0x89b4('0x25')]=function(_0x19b16e,_0xd5f744){if(_0x19b16e[_0x89b4('0x4b')]['id']){delete _0x19b16e[_0x89b4('0x4b')]['id'];}return db[_0x89b4('0x2e')]['find']({'where':{'id':_0x19b16e[_0x89b4('0x47')]['id']}})['then'](handleEntityNotFound(_0xd5f744,null))[_0x89b4('0x26')](saveUpdates(_0x19b16e[_0x89b4('0x4b')],null))['then'](respondWithResult(_0xd5f744,null))['catch'](handleError(_0xd5f744,null));};exports[_0x89b4('0x27')]=function(_0x38654f,_0x7f5aae){return db['VtigerField']['find']({'where':{'id':_0x38654f[_0x89b4('0x47')]['id']}})[_0x89b4('0x26')](handleEntityNotFound(_0x7f5aae,null))[_0x89b4('0x26')](removeEntity(_0x7f5aae,null))[_0x89b4('0x49')](handleError(_0x7f5aae,null));}; \ No newline at end of file +var _0x1b9c=['catch','show','params','filters','include','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','error','stack','name','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','findAll'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x3ebbaf,_0x565b4e){_0x3ebbaf=_0x3ebbaf-0x0;var _0x2d823a=_0x1b9c[_0x3ebbaf];return _0x2d823a;};'use strict';var emlformat=require(_0xc1b9('0x0'));var rimraf=require(_0xc1b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1b9('0x2'));var rp=require(_0xc1b9('0x3'));var moment=require('moment');var BPromise=require(_0xc1b9('0x4'));var Mustache=require('mustache');var util=require(_0xc1b9('0x5'));var path=require('path');var sox=require(_0xc1b9('0x6'));var csv=require('to-csv');var ejs=require(_0xc1b9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc1b9('0x8'));var crypto=require(_0xc1b9('0x9'));var jsforce=require(_0xc1b9('0xa'));var deskjs=require(_0xc1b9('0xb'));var toCsv=require(_0xc1b9('0xc'));var querystring=require(_0xc1b9('0xd'));var Papa=require(_0xc1b9('0xe'));var Redis=require(_0xc1b9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1b9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1b9('0x11'));var utils=require(_0xc1b9('0x12'));var config=require(_0xc1b9('0x13'));var licenseUtil=require(_0xc1b9('0x14'));var db=require(_0xc1b9('0x15'))['db'];function respondWithStatusCode(_0x341943,_0x1b94b2){_0x1b94b2=_0x1b94b2||0xcc;return function(_0x47814f){if(_0x47814f){return _0x341943[_0xc1b9('0x16')](_0x1b94b2);}return _0x341943[_0xc1b9('0x17')](_0x1b94b2)[_0xc1b9('0x18')]();};}function respondWithResult(_0x1b2bdf,_0x340ec0){_0x340ec0=_0x340ec0||0xc8;return function(_0x322caa){if(_0x322caa){return _0x1b2bdf[_0xc1b9('0x17')](_0x340ec0)['json'](_0x322caa);}};}function respondWithFilteredResult(_0x3e23e1,_0x4d7a2a){return function(_0x7a41cb){if(_0x7a41cb){var _0x4db01e=typeof _0x4d7a2a['offset']==='undefined'&&typeof _0x4d7a2a['limit']===_0xc1b9('0x19');var _0x39be35=_0x7a41cb['count'];var _0x7b1ffe=_0x4db01e?0x0:_0x4d7a2a['offset'];var _0x71fcb5=_0x4db01e?_0x7a41cb[_0xc1b9('0x1a')]:_0x4d7a2a[_0xc1b9('0x1b')]+_0x4d7a2a[_0xc1b9('0x1c')];var _0x42097e;if(_0x71fcb5>=_0x39be35){_0x71fcb5=_0x39be35;_0x42097e=0xc8;}else{_0x42097e=0xce;}_0x3e23e1[_0xc1b9('0x17')](_0x42097e);return _0x3e23e1['set'](_0xc1b9('0x1d'),_0x7b1ffe+'-'+_0x71fcb5+'/'+_0x39be35)['json'](_0x7a41cb);}return null;};}function patchUpdates(_0x26c80e){return function(_0x2e2f0c){try{jsonpatch[_0xc1b9('0x1e')](_0x2e2f0c,_0x26c80e,!![]);}catch(_0x49ff51){return BPromise[_0xc1b9('0x1f')](_0x49ff51);}return _0x2e2f0c[_0xc1b9('0x20')]();};}function saveUpdates(_0x4c3e21,_0x478772){return function(_0x521400){if(_0x521400){return _0x521400['update'](_0x4c3e21)['then'](function(_0x2b28dd){return _0x2b28dd;});}return null;};}function removeEntity(_0x3de0bb,_0x484716){return function(_0x3c5187){if(_0x3c5187){return _0x3c5187[_0xc1b9('0x21')]()['then'](function(){_0x3de0bb[_0xc1b9('0x17')](0xcc)[_0xc1b9('0x18')]();});}};}function handleEntityNotFound(_0x2a1fac,_0x262ae6){return function(_0x3e52f2){if(!_0x3e52f2){_0x2a1fac[_0xc1b9('0x16')](0x194);}return _0x3e52f2;};}function handleError(_0x2af3da,_0x56d89c){_0x56d89c=_0x56d89c||0x1f4;return function(_0x50a0ec){logger[_0xc1b9('0x22')](_0x50a0ec[_0xc1b9('0x23')]);if(_0x50a0ec['name']){delete _0x50a0ec[_0xc1b9('0x24')];}_0x2af3da['status'](_0x56d89c)['send'](_0x50a0ec);};}exports['index']=function(_0x157e66,_0x3ffa28){var _0x5c7c3b={},_0xd6bd4d={},_0x4dc8d3={'count':0x0,'rows':[]};var _0x1cdaab=_[_0xc1b9('0x25')](db[_0xc1b9('0x26')][_0xc1b9('0x27')],function(_0x46fdb1){return{'name':_0x46fdb1[_0xc1b9('0x28')],'type':_0x46fdb1['type'][_0xc1b9('0x29')]};});_0xd6bd4d[_0xc1b9('0x2a')]=_[_0xc1b9('0x25')](_0x1cdaab,_0xc1b9('0x24'));_0xd6bd4d['query']=_[_0xc1b9('0x2b')](_0x157e66[_0xc1b9('0x2c')]);_0xd6bd4d['filters']=_[_0xc1b9('0x2d')](_0xd6bd4d[_0xc1b9('0x2a')],_0xd6bd4d[_0xc1b9('0x2c')]);_0x5c7c3b['attributes']=_['intersection'](_0xd6bd4d['model'],qs[_0xc1b9('0x2e')](_0x157e66[_0xc1b9('0x2c')]['fields']));_0x5c7c3b[_0xc1b9('0x2f')]=_0x5c7c3b[_0xc1b9('0x2f')][_0xc1b9('0x30')]?_0x5c7c3b[_0xc1b9('0x2f')]:_0xd6bd4d[_0xc1b9('0x2a')];if(!_0x157e66['query'][_0xc1b9('0x31')](_0xc1b9('0x32'))){_0x5c7c3b['limit']=qs['limit'](_0x157e66[_0xc1b9('0x2c')][_0xc1b9('0x1c')]);_0x5c7c3b[_0xc1b9('0x1b')]=qs[_0xc1b9('0x1b')](_0x157e66[_0xc1b9('0x2c')][_0xc1b9('0x1b')]);}_0x5c7c3b[_0xc1b9('0x33')]=qs[_0xc1b9('0x34')](_0x157e66[_0xc1b9('0x2c')][_0xc1b9('0x34')]);_0x5c7c3b[_0xc1b9('0x35')]=qs['filters'](_[_0xc1b9('0x36')](_0x157e66['query'],_0xd6bd4d['filters']),_0x1cdaab);if(_0x157e66[_0xc1b9('0x2c')][_0xc1b9('0x37')]){_0x5c7c3b[_0xc1b9('0x35')]=_['merge'](_0x5c7c3b[_0xc1b9('0x35')],{'$or':_[_0xc1b9('0x25')](_0x1cdaab,function(_0x2c62c6){if(_0x2c62c6['type']!==_0xc1b9('0x38')){var _0x1165a6={};_0x1165a6[_0x2c62c6[_0xc1b9('0x24')]]={'$like':'%'+_0x157e66[_0xc1b9('0x2c')]['filter']+'%'};return _0x1165a6;}})});}_0x5c7c3b=_['merge']({},_0x5c7c3b,_0x157e66[_0xc1b9('0x39')]);var _0xe46b9a={'where':_0x5c7c3b[_0xc1b9('0x35')]};return db[_0xc1b9('0x26')][_0xc1b9('0x1a')](_0xe46b9a)[_0xc1b9('0x3a')](function(_0x43c15d){_0x4dc8d3[_0xc1b9('0x1a')]=_0x43c15d;if(_0x157e66[_0xc1b9('0x2c')][_0xc1b9('0x3b')]){_0x5c7c3b['include']=[{'all':!![]}];}return db[_0xc1b9('0x26')][_0xc1b9('0x3c')](_0x5c7c3b);})[_0xc1b9('0x3a')](function(_0x1a1e5c){_0x4dc8d3['rows']=_0x1a1e5c;return _0x4dc8d3;})[_0xc1b9('0x3a')](respondWithFilteredResult(_0x3ffa28,_0x5c7c3b))[_0xc1b9('0x3d')](handleError(_0x3ffa28,null));};exports[_0xc1b9('0x3e')]=function(_0x44cd75,_0x1ec676){var _0x4986fb={'raw':!![],'where':{'id':_0x44cd75[_0xc1b9('0x3f')]['id']}},_0x4465df={};_0x4465df[_0xc1b9('0x2a')]=_[_0xc1b9('0x2b')](db['VtigerField'][_0xc1b9('0x27')]);_0x4465df[_0xc1b9('0x2c')]=_[_0xc1b9('0x2b')](_0x44cd75[_0xc1b9('0x2c')]);_0x4465df[_0xc1b9('0x40')]=_['intersection'](_0x4465df['model'],_0x4465df[_0xc1b9('0x2c')]);_0x4986fb[_0xc1b9('0x2f')]=_[_0xc1b9('0x2d')](_0x4465df[_0xc1b9('0x2a')],qs[_0xc1b9('0x2e')](_0x44cd75['query'][_0xc1b9('0x2e')]));_0x4986fb['attributes']=_0x4986fb[_0xc1b9('0x2f')][_0xc1b9('0x30')]?_0x4986fb[_0xc1b9('0x2f')]:_0x4465df[_0xc1b9('0x2a')];if(_0x44cd75[_0xc1b9('0x2c')][_0xc1b9('0x3b')]){_0x4986fb[_0xc1b9('0x41')]=[{'all':!![]}];}_0x4986fb=_['merge']({},_0x4986fb,_0x44cd75[_0xc1b9('0x39')]);return db['VtigerField']['find'](_0x4986fb)['then'](handleEntityNotFound(_0x1ec676,null))[_0xc1b9('0x3a')](respondWithResult(_0x1ec676,null))['catch'](handleError(_0x1ec676,null));};exports['create']=function(_0x317baa,_0x231206){return db[_0xc1b9('0x26')][_0xc1b9('0x42')](_0x317baa[_0xc1b9('0x43')],{})['then'](respondWithResult(_0x231206,0xc9))[_0xc1b9('0x3d')](handleError(_0x231206,null));};exports[_0xc1b9('0x44')]=function(_0xf4498b,_0x43b20e){if(_0xf4498b[_0xc1b9('0x43')]['id']){delete _0xf4498b['body']['id'];}return db[_0xc1b9('0x26')][_0xc1b9('0x45')]({'where':{'id':_0xf4498b[_0xc1b9('0x3f')]['id']}})[_0xc1b9('0x3a')](handleEntityNotFound(_0x43b20e,null))[_0xc1b9('0x3a')](saveUpdates(_0xf4498b[_0xc1b9('0x43')],null))[_0xc1b9('0x3a')](respondWithResult(_0x43b20e,null))['catch'](handleError(_0x43b20e,null));};exports['destroy']=function(_0x29333d,_0x4b66bc){return db['VtigerField'][_0xc1b9('0x45')]({'where':{'id':_0x29333d[_0xc1b9('0x3f')]['id']}})[_0xc1b9('0x3a')](handleEntityNotFound(_0x4b66bc,null))[_0xc1b9('0x3a')](removeEntity(_0x4b66bc,null))[_0xc1b9('0x3d')](handleError(_0x4b66bc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index fa37439..7f5cfb7 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 _0xa12b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x848ce,_0x250f39){var _0x2d9e0b=function(_0x5d5f74){while(--_0x5d5f74){_0x848ce['push'](_0x848ce['shift']());}};_0x2d9e0b(++_0x250f39);}(_0xa12b,0xd2));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var util=require(_0xba12('0x1'));var logger=require(_0xba12('0x2'))('api');var moment=require(_0xba12('0x3'));var BPromise=require(_0xba12('0x4'));var rp=require(_0xba12('0x5'));var fs=require('fs');var path=require(_0xba12('0x6'));var rimraf=require(_0xba12('0x7'));var config=require(_0xba12('0x8'));var attributes=require(_0xba12('0x9'));module['exports']=function(_0xe0ec22,_0x1918f2){return _0xe0ec22[_0xba12('0xa')](_0xba12('0xb'),attributes,{'tableName':_0xba12('0xc'),'paranoid':![],'indexes':[{'name':_0xba12('0xd'),'fields':[_0xba12('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b45=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x4deded,_0x48a142){var _0x279cf8=function(_0x5df8c4){while(--_0x5df8c4){_0x4deded['push'](_0x4deded['shift']());}};_0x279cf8(++_0x48a142);}(_0x5b45,0xfa));var _0x55b4=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x5b45[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0x55b4('0x0'));var util=require(_0x55b4('0x1'));var logger=require(_0x55b4('0x2'))(_0x55b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x55b4('0x4'));var fs=require('fs');var path=require(_0x55b4('0x5'));var rimraf=require(_0x55b4('0x6'));var config=require(_0x55b4('0x7'));var attributes=require(_0x55b4('0x8'));module['exports']=function(_0x1fc37e,_0x26bd14){return _0x1fc37e['define'](_0x55b4('0x9'),attributes,{'tableName':_0x55b4('0xa'),'paranoid':![],'indexes':[{'name':_0x55b4('0xb'),'fields':[_0x55b4('0xc'),_0x55b4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index bb6ae95..5c25b12 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 _0x5d89=['code','VtigerField,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16e8bc,_0x142c3d){var _0x240ddd=function(_0x4c5ffb){while(--_0x4c5ffb){_0x16e8bc['push'](_0x16e8bc['shift']());}};_0x240ddd(++_0x142c3d);}(_0x5d89,0x1e8));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x95d8('0x0'));var util=require(_0x95d8('0x1'));var moment=require(_0x95d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x95d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95d8('0x4'));var logger=require(_0x95d8('0x5'))(_0x95d8('0x6'));var config=require('../../config/environment');var jayson=require(_0x95d8('0x7'));var client=jayson[_0x95d8('0x8')][_0x95d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x544c76,_0x42f11,_0x2011b2){return new BPromise(function(_0x2f5144,_0x191c37){return client[_0x95d8('0xa')](_0x544c76,_0x2011b2)[_0x95d8('0xb')](function(_0xc2feed){logger[_0x95d8('0xc')]('VtigerField,\x20%s,\x20%s',_0x42f11,_0x95d8('0xd'));logger[_0x95d8('0xe')](_0x95d8('0xf'),_0x42f11,_0x95d8('0xd'),JSON[_0x95d8('0x10')](_0xc2feed));if(_0xc2feed[_0x95d8('0x11')]){if(_0xc2feed[_0x95d8('0x11')][_0x95d8('0x12')]===0x1f4){logger['error'](_0x95d8('0x13'),_0x42f11,_0xc2feed['error'][_0x95d8('0x14')]);return _0x191c37(_0xc2feed[_0x95d8('0x11')][_0x95d8('0x14')]);}logger['error'](_0x95d8('0x13'),_0x42f11,_0xc2feed[_0x95d8('0x11')]['message']);return _0x2f5144(_0xc2feed['error']['message']);}else{logger[_0x95d8('0xc')]('VtigerField,\x20%s,\x20%s',_0x42f11,'request\x20sent');_0x2f5144(_0xc2feed[_0x95d8('0x15')]['message']);}})['catch'](function(_0x42a5e3){logger[_0x95d8('0x11')](_0x95d8('0x13'),_0x42f11,_0x42a5e3);_0x191c37(_0x42a5e3);});});} \ No newline at end of file +var _0x7c7c=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x140ede,_0x4abc15){var _0x5c316f=function(_0x6d9659){while(--_0x6d9659){_0x140ede['push'](_0x140ede['shift']());}};_0x5c316f(++_0x4abc15);}(_0x7c7c,0xd5));var _0xc7c7=function(_0x26ac67,_0x1626d9){_0x26ac67=_0x26ac67-0x0;var _0x2240af=_0x7c7c[_0x26ac67];return _0x2240af;};'use strict';var _=require(_0xc7c7('0x0'));var util=require(_0xc7c7('0x1'));var moment=require(_0xc7c7('0x2'));var BPromise=require(_0xc7c7('0x3'));var rs=require(_0xc7c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7c7('0x6'))(_0xc7c7('0x7'));var config=require(_0xc7c7('0x8'));var jayson=require(_0xc7c7('0x9'));var client=jayson['client'][_0xc7c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x765af3,_0x17cd7e,_0x174a5d){return new BPromise(function(_0x103d29,_0x5d2240){return client[_0xc7c7('0xb')](_0x765af3,_0x174a5d)[_0xc7c7('0xc')](function(_0x1aaf29){logger[_0xc7c7('0xd')](_0xc7c7('0xe'),_0x17cd7e,'request\x20sent');logger[_0xc7c7('0xf')](_0xc7c7('0x10'),_0x17cd7e,_0xc7c7('0x11'),JSON[_0xc7c7('0x12')](_0x1aaf29));if(_0x1aaf29[_0xc7c7('0x13')]){if(_0x1aaf29[_0xc7c7('0x13')]['code']===0x1f4){logger[_0xc7c7('0x13')](_0xc7c7('0xe'),_0x17cd7e,_0x1aaf29['error']['message']);return _0x5d2240(_0x1aaf29[_0xc7c7('0x13')][_0xc7c7('0x14')]);}logger['error'](_0xc7c7('0xe'),_0x17cd7e,_0x1aaf29['error'][_0xc7c7('0x14')]);return _0x103d29(_0x1aaf29['error'][_0xc7c7('0x14')]);}else{logger[_0xc7c7('0xd')](_0xc7c7('0xe'),_0x17cd7e,_0xc7c7('0x11'));_0x103d29(_0x1aaf29[_0xc7c7('0x15')][_0xc7c7('0x14')]);}})[_0xc7c7('0x16')](function(_0x53a097){logger[_0xc7c7('0x13')](_0xc7c7('0xe'),_0x17cd7e,_0x53a097);_0x5d2240(_0x53a097);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 717f7ec..448a6d2 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 _0x7e15=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x164e8f,_0xdba27a){var _0x2b2840=function(_0x4458f0){while(--_0x4458f0){_0x164e8f['push'](_0x164e8f['shift']());}};_0x2b2840(++_0xdba27a);}(_0x7e15,0x144));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x57e1('0x0'));var util=require(_0x57e1('0x1'));var path=require(_0x57e1('0x2'));var timeout=require(_0x57e1('0x3'));var express=require(_0x57e1('0x4'));var router=express[_0x57e1('0x5')]();var fs_extra=require(_0x57e1('0x6'));var auth=require(_0x57e1('0x7'));var interaction=require(_0x57e1('0x8'));var config=require(_0x57e1('0x9'));var controller=require(_0x57e1('0xa'));router[_0x57e1('0xb')]('/',auth[_0x57e1('0xc')](),controller[_0x57e1('0xd')]);router['get'](_0x57e1('0xe'),auth['isAuthenticated'](),controller[_0x57e1('0xf')]);router[_0x57e1('0xb')](_0x57e1('0x10'),auth[_0x57e1('0xc')](),controller['getConfigurations']);router['get'](_0x57e1('0x11'),auth[_0x57e1('0xc')](),controller[_0x57e1('0x12')]);router['post']('/',auth[_0x57e1('0xc')](),controller[_0x57e1('0x13')]);router[_0x57e1('0x14')]('/:id/configurations',auth[_0x57e1('0xc')](),controller[_0x57e1('0x15')]);router[_0x57e1('0x16')](_0x57e1('0xe'),auth['isAuthenticated'](),controller[_0x57e1('0x17')]);router[_0x57e1('0x18')]('/:id',auth[_0x57e1('0xc')](),controller[_0x57e1('0x19')]);module[_0x57e1('0x1a')]=router; \ No newline at end of file +var _0xfc91=['index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfc91,0xb5));var _0x1fc9=function(_0x1f6984,_0x1d87ba){_0x1f6984=_0x1f6984-0x0;var _0x25815d=_0xfc91[_0x1f6984];return _0x25815d;};'use strict';var multer=require('multer');var util=require(_0x1fc9('0x0'));var path=require('path');var timeout=require(_0x1fc9('0x1'));var express=require(_0x1fc9('0x2'));var router=express[_0x1fc9('0x3')]();var fs_extra=require(_0x1fc9('0x4'));var auth=require(_0x1fc9('0x5'));var interaction=require(_0x1fc9('0x6'));var config=require(_0x1fc9('0x7'));var controller=require(_0x1fc9('0x8'));router[_0x1fc9('0x9')]('/',auth[_0x1fc9('0xa')](),controller[_0x1fc9('0xb')]);router[_0x1fc9('0x9')]('/:id',auth[_0x1fc9('0xa')](),controller['show']);router['get'](_0x1fc9('0xc'),auth[_0x1fc9('0xa')](),controller[_0x1fc9('0xd')]);router[_0x1fc9('0x9')](_0x1fc9('0xe'),auth[_0x1fc9('0xa')](),controller[_0x1fc9('0xf')]);router[_0x1fc9('0x10')]('/',auth[_0x1fc9('0xa')](),controller[_0x1fc9('0x11')]);router[_0x1fc9('0x10')](_0x1fc9('0xc'),auth[_0x1fc9('0xa')](),controller[_0x1fc9('0x12')]);router[_0x1fc9('0x13')](_0x1fc9('0x14'),auth[_0x1fc9('0xa')](),controller['update']);router[_0x1fc9('0x15')](_0x1fc9('0x14'),auth['isAuthenticated'](),controller[_0x1fc9('0x16')]);module[_0x1fc9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a65eb19..83dbbd3 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 _0x1d11=['STRING','username','remoteUri','ENUM','token','integrationTab','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1d11,0xb6));var _0x11d1=function(_0x3958fe,_0x3c6605){_0x3958fe=_0x3958fe-0x0;var _0x1f27d6=_0x1d11[_0x3958fe];return _0x1f27d6;};'use strict';var Sequelize=require(_0x11d1('0x0'));module[_0x11d1('0x1')]={'name':{'type':Sequelize[_0x11d1('0x2')]},'description':{'type':Sequelize[_0x11d1('0x2')]},'username':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x3')},'password':{'type':Sequelize[_0x11d1('0x2')]},'token':{'type':Sequelize[_0x11d1('0x2')]},'remoteUri':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x4')},'authType':{'type':Sequelize[_0x11d1('0x5')]('password',_0x11d1('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x11d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x11d1('0x5')]('integrationTab','newTab'),'defaultValue':_0x11d1('0x7')}}; \ No newline at end of file +var _0x8b8e=['remoteUri','ENUM','password','token','integrationTab','sequelize','STRING'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x8b8e,0x108));var _0xe8b8=function(_0x503a1f,_0x37ae69){_0x503a1f=_0x503a1f-0x0;var _0x2aa6f6=_0x8b8e[_0x503a1f];return _0x2aa6f6;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8b8('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe8b8('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe8b8('0x1')]},'remoteUri':{'type':Sequelize[_0xe8b8('0x1')],'unique':_0xe8b8('0x2')},'authType':{'type':Sequelize[_0xe8b8('0x3')](_0xe8b8('0x4'),_0xe8b8('0x5')),'defaultValue':_0xe8b8('0x4')},'serverUrl':{'type':Sequelize[_0xe8b8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe8b8('0x3')](_0xe8b8('0x6'),'newTab'),'defaultValue':_0xe8b8('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ec2b0d3..24acc43 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 _0xeb74=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5ad342,_0x35c957){_0x5ad342=_0x5ad342-0x0;var _0x5597db=_0xeb74[_0x5ad342];return _0x5597db;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];var integrations=require(_0x4eb7('0x19'));function respondWithStatusCode(_0x4194e1,_0x3c9f45){_0x3c9f45=_0x3c9f45||0xcc;return function(_0x4c27a4){if(_0x4c27a4){return _0x4194e1['sendStatus'](_0x3c9f45);}return _0x4194e1['status'](_0x3c9f45)[_0x4eb7('0x1a')]();};}function respondWithResult(_0x51f09d,_0x84c68b){_0x84c68b=_0x84c68b||0xc8;return function(_0x119afa){if(_0x119afa){return _0x51f09d[_0x4eb7('0x1b')](_0x84c68b)[_0x4eb7('0x1c')](_0x119afa);}};}function respondWithFilteredResult(_0x5d6d5,_0x21433d){return function(_0x11674f){if(_0x11674f){var _0x76988=typeof _0x21433d[_0x4eb7('0x1d')]===_0x4eb7('0x1e')&&typeof _0x21433d['limit']===_0x4eb7('0x1e');var _0x11ac9f=_0x11674f[_0x4eb7('0x1f')];var _0xf14478=_0x76988?0x0:_0x21433d[_0x4eb7('0x1d')];var _0x44f1b9=_0x76988?_0x11674f[_0x4eb7('0x1f')]:_0x21433d[_0x4eb7('0x1d')]+_0x21433d['limit'];var _0x3cf53a;if(_0x44f1b9>=_0x11ac9f){_0x44f1b9=_0x11ac9f;_0x3cf53a=0xc8;}else{_0x3cf53a=0xce;}_0x5d6d5[_0x4eb7('0x1b')](_0x3cf53a);return _0x5d6d5[_0x4eb7('0x20')](_0x4eb7('0x21'),_0xf14478+'-'+_0x44f1b9+'/'+_0x11ac9f)[_0x4eb7('0x1c')](_0x11674f);}return null;};}function patchUpdates(_0x2efd67){return function(_0x11fb0a){try{jsonpatch['apply'](_0x11fb0a,_0x2efd67,!![]);}catch(_0x214a28){return BPromise[_0x4eb7('0x22')](_0x214a28);}return _0x11fb0a[_0x4eb7('0x23')]();};}function saveUpdates(_0x164515,_0x14a7be){return function(_0x1b4640){if(_0x1b4640){return _0x1b4640[_0x4eb7('0x24')](_0x164515)[_0x4eb7('0x25')](function(_0x1a2b8b){return _0x1a2b8b;});}return null;};}function removeEntity(_0x13e871,_0x4de2d9){return function(_0x3e72cd){if(_0x3e72cd){return _0x3e72cd[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x13e871[_0x4eb7('0x1b')](0xcc)[_0x4eb7('0x1a')]();});}};}function handleEntityNotFound(_0x25eb74,_0x365060){return function(_0xe9db8){if(!_0xe9db8){_0x25eb74[_0x4eb7('0x27')](0x194);}return _0xe9db8;};}function handleError(_0x248759,_0xf83c11){_0xf83c11=_0xf83c11||0x1f4;return function(_0x2984b2){logger[_0x4eb7('0x28')](_0x2984b2[_0x4eb7('0x29')]);if(_0x2984b2[_0x4eb7('0x2a')]){delete _0x2984b2[_0x4eb7('0x2a')];}_0x248759[_0x4eb7('0x1b')](_0xf83c11)[_0x4eb7('0x2b')](_0x2984b2);};}exports[_0x4eb7('0x2c')]=function(_0x28fda8,_0x114c68){var _0x17030a={},_0x3ed224={},_0x50209d={'count':0x0,'rows':[]};var _0x34515c=_['map'](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')],function(_0xc5aa21){return{'name':_0xc5aa21[_0x4eb7('0x2f')],'type':_0xc5aa21[_0x4eb7('0x30')][_0x4eb7('0x31')]};});_0x3ed224[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x34515c,_0x4eb7('0x2a'));_0x3ed224['query']=_[_0x4eb7('0x34')](_0x28fda8['query']);_0x3ed224[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x3ed224['model'],_0x3ed224['query']);_0x17030a[_0x4eb7('0x37')]=_[_0x4eb7('0x36')](_0x3ed224[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x28fda8['query'][_0x4eb7('0x38')]));_0x17030a[_0x4eb7('0x37')]=_0x17030a[_0x4eb7('0x37')][_0x4eb7('0x39')]?_0x17030a[_0x4eb7('0x37')]:_0x3ed224['model'];if(!_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3b')](_0x4eb7('0x3c'))){_0x17030a['limit']=qs[_0x4eb7('0x3d')](_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3d')]);_0x17030a['offset']=qs[_0x4eb7('0x1d')](_0x28fda8['query'][_0x4eb7('0x1d')]);}_0x17030a[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x28fda8[_0x4eb7('0x3a')]['sort']);_0x17030a[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_[_0x4eb7('0x41')](_0x28fda8[_0x4eb7('0x3a')],_0x3ed224['filters']),_0x34515c);if(_0x28fda8['query']['filter']){_0x17030a[_0x4eb7('0x40')]=_[_0x4eb7('0x42')](_0x17030a[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x34515c,function(_0x210c20){if(_0x210c20[_0x4eb7('0x30')]!==_0x4eb7('0x43')){var _0x20d2bc={};_0x20d2bc[_0x210c20[_0x4eb7('0x2a')]]={'$like':'%'+_0x28fda8[_0x4eb7('0x3a')]['filter']+'%'};return _0x20d2bc;}})});}_0x17030a=_[_0x4eb7('0x42')]({},_0x17030a,_0x28fda8[_0x4eb7('0x44')]);var _0xe04d76={'where':_0x17030a[_0x4eb7('0x40')]};return db[_0x4eb7('0x2d')][_0x4eb7('0x1f')](_0xe04d76)[_0x4eb7('0x25')](function(_0xef998f){_0x50209d[_0x4eb7('0x1f')]=_0xef998f;if(_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x17030a[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x2d')][_0x4eb7('0x47')](_0x17030a);})[_0x4eb7('0x25')](function(_0x5b819f){_0x50209d[_0x4eb7('0x48')]=_0x5b819f;return _0x50209d;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x114c68,_0x17030a))[_0x4eb7('0x49')](handleError(_0x114c68,null));};exports[_0x4eb7('0x4a')]=function(_0x5eff9e,_0x2fd5c2){var _0x2df542={'raw':![],'where':{'id':_0x5eff9e[_0x4eb7('0x4b')]['id']}},_0x482357={};_0x482357[_0x4eb7('0x32')]=_[_0x4eb7('0x34')](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')]);_0x482357[_0x4eb7('0x3a')]=_['keys'](_0x5eff9e[_0x4eb7('0x3a')]);_0x482357['filters']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],_0x482357[_0x4eb7('0x3a')]);_0x2df542['attributes']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x5eff9e[_0x4eb7('0x3a')]['fields']));_0x2df542[_0x4eb7('0x37')]=_0x2df542['attributes'][_0x4eb7('0x39')]?_0x2df542[_0x4eb7('0x37')]:_0x482357[_0x4eb7('0x32')];if(_0x5eff9e[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x2df542['include']=[{'all':!![]}];}_0x2df542=_['merge']({},_0x2df542,_0x5eff9e[_0x4eb7('0x44')]);return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')](_0x2df542)[_0x4eb7('0x25')](handleEntityNotFound(_0x2fd5c2,null))[_0x4eb7('0x25')](respondWithResult(_0x2fd5c2,null))['catch'](handleError(_0x2fd5c2,null));};exports[_0x4eb7('0x4d')]=function(_0x104284,_0x56609e){return db[_0x4eb7('0x2d')][_0x4eb7('0x4d')](_0x104284['body'],{})[_0x4eb7('0x25')](respondWithResult(_0x56609e,0xc9))[_0x4eb7('0x49')](handleError(_0x56609e,null));};exports[_0x4eb7('0x24')]=function(_0x5774d5,_0x130113){if(_0x5774d5['body']['id']){delete _0x5774d5['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x5774d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x130113,null))[_0x4eb7('0x25')](saveUpdates(_0x5774d5[_0x4eb7('0x4e')],null))[_0x4eb7('0x25')](respondWithResult(_0x130113,null))[_0x4eb7('0x49')](handleError(_0x130113,null));};exports[_0x4eb7('0x26')]=function(_0x23c0d5,_0x42a1d9){return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x23c0d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x42a1d9,null))[_0x4eb7('0x25')](removeEntity(_0x42a1d9,null))[_0x4eb7('0x49')](handleError(_0x42a1d9,null));};exports[_0x4eb7('0x4f')]=function(_0x1411c9,_0x11cc3d,_0x4cfba8){var _0x3f3d41={};var _0x550888={};var _0x4db5f7;var _0x3f3a5f;return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x1411c9[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x11cc3d,null))['then'](function(_0x4e3163){if(_0x4e3163){_0x4db5f7=_0x4e3163;_0x550888[_0x4eb7('0x32')]=_['keys'](db[_0x4eb7('0x51')][_0x4eb7('0x2e')]);_0x550888[_0x4eb7('0x3a')]=_[_0x4eb7('0x34')](_0x1411c9['query']);_0x550888[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],_0x550888[_0x4eb7('0x3a')]);_0x3f3d41['attributes']=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],qs['fields'](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x38')]));_0x3f3d41['attributes']=_0x3f3d41[_0x4eb7('0x37')]['length']?_0x3f3d41[_0x4eb7('0x37')]:_0x550888['model'];_0x3f3d41[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x3f')]);_0x3f3d41[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_['pick'](_0x1411c9['query'],_0x550888[_0x4eb7('0x35')]));if(_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]){_0x3f3d41[_0x4eb7('0x40')]=_['merge'](_0x3f3d41[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x3f3d41['attributes'],function(_0x452f21){var _0xba9272={};_0xba9272[_0x452f21]={'$like':'%'+_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]+'%'};return _0xba9272;})});}_0x3f3d41=_[_0x4eb7('0x42')]({},_0x3f3d41,_0x1411c9[_0x4eb7('0x44')]);return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})['then'](function(_0x5839f1){if(_0x5839f1){_0x3f3a5f=_0x5839f1[_0x4eb7('0x39')];if(!_0x1411c9['query'][_0x4eb7('0x3b')]('nolimit')){_0x3f3d41[_0x4eb7('0x3d')]=qs['limit'](_0x1411c9['query'][_0x4eb7('0x3d')]);_0x3f3d41[_0x4eb7('0x1d')]=qs['offset'](_0x1411c9[_0x4eb7('0x3a')]['offset']);}return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})[_0x4eb7('0x25')](function(_0x4ab8e8){if(_0x4ab8e8){return _0x4ab8e8?{'count':_0x3f3a5f,'rows':_0x4ab8e8}:null;}})[_0x4eb7('0x25')](respondWithResult(_0x11cc3d,null))[_0x4eb7('0x49')](handleError(_0x11cc3d,null));};exports['addConfiguration']=function(_0x4b492a,_0x5c8d45,_0x59e2f2){if(_0x4b492a[_0x4eb7('0x4e')]['id']){delete _0x4b492a['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x4b492a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5c8d45,null))[_0x4eb7('0x25')](function(_0x463ab6){if(_0x463ab6){_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x53')]=_0x463ab6['id'];_0x4b492a[_0x4eb7('0x4e')]['Subjects']=integrations['getSubjects'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x55')]=integrations['getDescriptions'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);return db[_0x4eb7('0x51')][_0x4eb7('0x4d')](_0x4b492a['body'],{'include':[{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x57')},{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x55')}]});}return null;})['then'](respondWithResult(_0x5c8d45,null))['catch'](handleError(_0x5c8d45,null));};exports[_0x4eb7('0x58')]=function(_0x3883f3,_0x4e8125,_0x1911ad){var _0x4b698b='';return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x3883f3[_0x4eb7('0x4b')]['id']},'attributes':['id',_0x4eb7('0x59'),'password',_0x4eb7('0x5a'),_0x4eb7('0x5b'),_0x4eb7('0x5c')]})[_0x4eb7('0x25')](handleEntityNotFound(_0x4e8125,null))[_0x4eb7('0x25')](function(_0x3271d0){if(_0x3271d0){_0x4b698b=_0x3271d0[_0x4eb7('0x5c')];var _0x232242=_0x4b698b[_0x4eb7('0x5d')](-0x1);if(_0x232242==='/'){_0x4b698b=_0x4b698b[_0x4eb7('0x5e')](0x0,_0x4b698b[_0x4eb7('0x5f')](_0x232242));}var _0x713b0a={'method':_0x4eb7('0x60'),'uri':util[_0x4eb7('0x61')](_0x4eb7('0x62'),_0x4b698b,_0x4eb7('0x63')),'json':!![]};switch(_0x3271d0[_0x4eb7('0x5b')]){case _0x4eb7('0x64'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x66'),_0x3271d0[_0x4eb7('0x59')],_0x3271d0[_0x4eb7('0x64')]))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;case _0x4eb7('0x5a'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format'](_0x4eb7('0x69'),new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x6a'),_0x3271d0['username'],_0x3271d0['token']))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;default:throw new db[(_0x4eb7('0x6b'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x713b0a);}})[_0x4eb7('0x25')](function(_0x1a1525){if(_0x1a1525){var _0x4778f9=[_0x4eb7('0x6c'),_0x4eb7('0x6d'),_0x4eb7('0x6e'),_0x4eb7('0x6f')];_[_0x4eb7('0x70')](_0x1a1525[_0x4eb7('0x63')],function(_0x2e531e){return _0x4778f9[_0x4eb7('0x71')](_0x2e531e[_0x4eb7('0x30')]);});return{'count':_0x1a1525['ticket_fields']['length'],'rows':_[_0x4eb7('0x33')](_0x1a1525[_0x4eb7('0x63')],function(_0x14648d){return{'id':_0x14648d['id'],'name':_0x14648d[_0x4eb7('0x72')]>0x7?_0x14648d[_0x4eb7('0x73')]:_0x14648d[_0x4eb7('0x30')],'custom':_0x14648d['position']>0x7?!![]:![],'options':_0x14648d['system_field_options']?_0x14648d[_0x4eb7('0x74')]:_0x14648d[_0x4eb7('0x75')]?_0x14648d[_0x4eb7('0x75')]:[]};})};}})[_0x4eb7('0x25')](respondWithResult(_0x4e8125,null))[_0x4eb7('0x49')](function(_0x2480ed){var _0x13f574=_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?0x1f4:_0x2480ed[_0x4eb7('0x77')]||0x1f4;logger[_0x4eb7('0x28')](_0x4eb7('0x78'),_0x4eb7('0x58'),_0x13f574,JSON[_0x4eb7('0x79')](_0x2480ed));delete _0x2480ed['name'];if(_0x13f574===0x191){_0x13f574=0x190;}_0x4e8125[_0x4eb7('0x1b')](_0x13f574)[_0x4eb7('0x2b')](_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2480ed[_0x4eb7('0x77')]}:_0x2480ed);});}; \ No newline at end of file +var _0xa74f=['Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','sendStatus','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskAccount','findAll','rows','params','length','find','catch','create','body','findOne','getConfigurations','addConfiguration'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xa74f,0x9a));var _0xfa74=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xa74f[_0x1deb72];return _0x18bbdf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfa74('0x16'));function respondWithStatusCode(_0x998585,_0x78173f){_0x78173f=_0x78173f||0xcc;return function(_0x278e8b){if(_0x278e8b){return _0x998585['sendStatus'](_0x78173f);}return _0x998585[_0xfa74('0x17')](_0x78173f)[_0xfa74('0x18')]();};}function respondWithResult(_0x3eb49b,_0x3947ca){_0x3947ca=_0x3947ca||0xc8;return function(_0xe3c97e){if(_0xe3c97e){return _0x3eb49b['status'](_0x3947ca)[_0xfa74('0x19')](_0xe3c97e);}};}function respondWithFilteredResult(_0x13d911,_0x947da6){return function(_0x1f1de0){if(_0x1f1de0){var _0x3867f8=typeof _0x947da6[_0xfa74('0x1a')]===_0xfa74('0x1b')&&typeof _0x947da6['limit']===_0xfa74('0x1b');var _0xe0e33d=_0x1f1de0['count'];var _0x4928b6=_0x3867f8?0x0:_0x947da6[_0xfa74('0x1a')];var _0x25a36b=_0x3867f8?_0x1f1de0[_0xfa74('0x1c')]:_0x947da6['offset']+_0x947da6[_0xfa74('0x1d')];var _0x2edebb;if(_0x25a36b>=_0xe0e33d){_0x25a36b=_0xe0e33d;_0x2edebb=0xc8;}else{_0x2edebb=0xce;}_0x13d911[_0xfa74('0x17')](_0x2edebb);return _0x13d911['set'](_0xfa74('0x1e'),_0x4928b6+'-'+_0x25a36b+'/'+_0xe0e33d)[_0xfa74('0x19')](_0x1f1de0);}return null;};}function patchUpdates(_0x2e6c33){return function(_0x4a5ee4){try{jsonpatch['apply'](_0x4a5ee4,_0x2e6c33,!![]);}catch(_0x100851){return BPromise[_0xfa74('0x1f')](_0x100851);}return _0x4a5ee4[_0xfa74('0x20')]();};}function saveUpdates(_0xeaaa19,_0x1a453d){return function(_0x554e0e){if(_0x554e0e){return _0x554e0e['update'](_0xeaaa19)[_0xfa74('0x21')](function(_0x5aa8a7){return _0x5aa8a7;});}return null;};}function removeEntity(_0x48cbd3,_0x529810){return function(_0x42c439){if(_0x42c439){return _0x42c439[_0xfa74('0x22')]()[_0xfa74('0x21')](function(){_0x48cbd3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9eb68c,_0xeb6c11){return function(_0x5ed1c8){if(!_0x5ed1c8){_0x9eb68c[_0xfa74('0x23')](0x194);}return _0x5ed1c8;};}function handleError(_0x5d3b26,_0x1a8cf7){_0x1a8cf7=_0x1a8cf7||0x1f4;return function(_0x153b2a){logger['error'](_0x153b2a[_0xfa74('0x24')]);if(_0x153b2a[_0xfa74('0x25')]){delete _0x153b2a[_0xfa74('0x25')];}_0x5d3b26[_0xfa74('0x17')](_0x1a8cf7)['send'](_0x153b2a);};}exports[_0xfa74('0x26')]=function(_0x2f7cd7,_0x204e01){var _0x57d90e={},_0x4d4bed={},_0x1322a4={'count':0x0,'rows':[]};var _0x8b706e=_['map'](db['ZendeskAccount'][_0xfa74('0x27')],function(_0x564060){return{'name':_0x564060[_0xfa74('0x28')],'type':_0x564060['type'][_0xfa74('0x29')]};});_0x4d4bed[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x8b706e,_0xfa74('0x25'));_0x4d4bed['query']=_[_0xfa74('0x2c')](_0x2f7cd7[_0xfa74('0x2d')]);_0x4d4bed[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x4d4bed[_0xfa74('0x2a')],_0x4d4bed[_0xfa74('0x2d')]);_0x57d90e[_0xfa74('0x30')]=_['intersection'](_0x4d4bed[_0xfa74('0x2a')],qs['fields'](_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x57d90e[_0xfa74('0x30')]=_0x57d90e[_0xfa74('0x30')]['length']?_0x57d90e['attributes']:_0x4d4bed[_0xfa74('0x2a')];if(!_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x32')](_0xfa74('0x33'))){_0x57d90e['limit']=qs[_0xfa74('0x1d')](_0x2f7cd7[_0xfa74('0x2d')]['limit']);_0x57d90e['offset']=qs['offset'](_0x2f7cd7['query']['offset']);}_0x57d90e[_0xfa74('0x34')]=qs[_0xfa74('0x35')](_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x35')]);_0x57d90e[_0xfa74('0x36')]=qs[_0xfa74('0x2e')](_[_0xfa74('0x37')](_0x2f7cd7[_0xfa74('0x2d')],_0x4d4bed[_0xfa74('0x2e')]),_0x8b706e);if(_0x2f7cd7['query'][_0xfa74('0x38')]){_0x57d90e[_0xfa74('0x36')]=_[_0xfa74('0x39')](_0x57d90e[_0xfa74('0x36')],{'$or':_[_0xfa74('0x2b')](_0x8b706e,function(_0x186126){if(_0x186126['type']!==_0xfa74('0x3a')){var _0x1f0806={};_0x1f0806[_0x186126[_0xfa74('0x25')]]={'$like':'%'+_0x2f7cd7[_0xfa74('0x2d')]['filter']+'%'};return _0x1f0806;}})});}_0x57d90e=_[_0xfa74('0x39')]({},_0x57d90e,_0x2f7cd7[_0xfa74('0x3b')]);var _0xe8491b={'where':_0x57d90e[_0xfa74('0x36')]};return db['ZendeskAccount'][_0xfa74('0x1c')](_0xe8491b)[_0xfa74('0x21')](function(_0x3dacc2){_0x1322a4['count']=_0x3dacc2;if(_0x2f7cd7['query'][_0xfa74('0x3c')]){_0x57d90e[_0xfa74('0x3d')]=[{'all':!![]}];}return db[_0xfa74('0x3e')][_0xfa74('0x3f')](_0x57d90e);})['then'](function(_0x1ab026){_0x1322a4[_0xfa74('0x40')]=_0x1ab026;return _0x1322a4;})['then'](respondWithFilteredResult(_0x204e01,_0x57d90e))['catch'](handleError(_0x204e01,null));};exports['show']=function(_0x492c7d,_0x95c891){var _0x3098ca={'raw':![],'where':{'id':_0x492c7d[_0xfa74('0x41')]['id']}},_0x3f92b2={};_0x3f92b2[_0xfa74('0x2a')]=_[_0xfa74('0x2c')](db[_0xfa74('0x3e')]['rawAttributes']);_0x3f92b2[_0xfa74('0x2d')]=_[_0xfa74('0x2c')](_0x492c7d[_0xfa74('0x2d')]);_0x3f92b2[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x3f92b2['model'],_0x3f92b2[_0xfa74('0x2d')]);_0x3098ca[_0xfa74('0x30')]=_[_0xfa74('0x2f')](_0x3f92b2[_0xfa74('0x2a')],qs[_0xfa74('0x31')](_0x492c7d[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x3098ca[_0xfa74('0x30')]=_0x3098ca[_0xfa74('0x30')][_0xfa74('0x42')]?_0x3098ca['attributes']:_0x3f92b2[_0xfa74('0x2a')];if(_0x492c7d['query'][_0xfa74('0x3c')]){_0x3098ca[_0xfa74('0x3d')]=[{'all':!![]}];}_0x3098ca=_[_0xfa74('0x39')]({},_0x3098ca,_0x492c7d[_0xfa74('0x3b')]);return db['ZendeskAccount'][_0xfa74('0x43')](_0x3098ca)[_0xfa74('0x21')](handleEntityNotFound(_0x95c891,null))['then'](respondWithResult(_0x95c891,null))[_0xfa74('0x44')](handleError(_0x95c891,null));};exports[_0xfa74('0x45')]=function(_0x5cbb70,_0x2be89f){return db[_0xfa74('0x3e')][_0xfa74('0x45')](_0x5cbb70[_0xfa74('0x46')],{})[_0xfa74('0x21')](respondWithResult(_0x2be89f,0xc9))['catch'](handleError(_0x2be89f,null));};exports['update']=function(_0x36f6ca,_0x91df44){if(_0x36f6ca['body']['id']){delete _0x36f6ca[_0xfa74('0x46')]['id'];}return db[_0xfa74('0x3e')][_0xfa74('0x43')]({'where':{'id':_0x36f6ca['params']['id']}})['then'](handleEntityNotFound(_0x91df44,null))[_0xfa74('0x21')](saveUpdates(_0x36f6ca[_0xfa74('0x46')],null))[_0xfa74('0x21')](respondWithResult(_0x91df44,null))[_0xfa74('0x44')](handleError(_0x91df44,null));};exports[_0xfa74('0x22')]=function(_0x3cb23d,_0x2d217d){return db[_0xfa74('0x3e')]['find']({'where':{'id':_0x3cb23d[_0xfa74('0x41')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x2d217d,null))[_0xfa74('0x21')](removeEntity(_0x2d217d,null))[_0xfa74('0x44')](handleError(_0x2d217d,null));};exports['getConfigurations']=function(_0x4ec218,_0x3146de,_0x5b3404){var _0x152eaa={};var _0x221dc7={};var _0x427469;var _0x33e31e;return db[_0xfa74('0x3e')][_0xfa74('0x47')]({'where':{'id':_0x4ec218[_0xfa74('0x41')]['id']}})['then'](handleEntityNotFound(_0x3146de,null))[_0xfa74('0x21')](function(_0x4bcee3){if(_0x4bcee3){_0x427469=_0x4bcee3;_0x221dc7[_0xfa74('0x2a')]=_['keys'](db['ZendeskConfiguration'][_0xfa74('0x27')]);_0x221dc7[_0xfa74('0x2d')]=_['keys'](_0x4ec218['query']);_0x221dc7[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x221dc7[_0xfa74('0x2a')],_0x221dc7[_0xfa74('0x2d')]);_0x152eaa[_0xfa74('0x30')]=_[_0xfa74('0x2f')](_0x221dc7[_0xfa74('0x2a')],qs[_0xfa74('0x31')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x152eaa['attributes']=_0x152eaa[_0xfa74('0x30')][_0xfa74('0x42')]?_0x152eaa['attributes']:_0x221dc7['model'];_0x152eaa[_0xfa74('0x34')]=qs[_0xfa74('0x35')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x35')]);_0x152eaa[_0xfa74('0x36')]=qs['filters'](_[_0xfa74('0x37')](_0x4ec218['query'],_0x221dc7[_0xfa74('0x2e')]));if(_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x38')]){_0x152eaa['where']=_['merge'](_0x152eaa[_0xfa74('0x36')],{'$or':_[_0xfa74('0x2b')](_0x152eaa[_0xfa74('0x30')],function(_0x1b3484){var _0x53eca4={};_0x53eca4[_0x1b3484]={'$like':'%'+_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x38')]+'%'};return _0x53eca4;})});}_0x152eaa=_['merge']({},_0x152eaa,_0x4ec218[_0xfa74('0x3b')]);return _0x427469[_0xfa74('0x48')](_0x152eaa);}})[_0xfa74('0x21')](function(_0x1681e7){if(_0x1681e7){_0x33e31e=_0x1681e7['length'];if(!_0x4ec218[_0xfa74('0x2d')]['hasOwnProperty'](_0xfa74('0x33'))){_0x152eaa[_0xfa74('0x1d')]=qs[_0xfa74('0x1d')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x1d')]);_0x152eaa[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x1a')]);}return _0x427469[_0xfa74('0x48')](_0x152eaa);}})[_0xfa74('0x21')](function(_0x930728){if(_0x930728){return _0x930728?{'count':_0x33e31e,'rows':_0x930728}:null;}})[_0xfa74('0x21')](respondWithResult(_0x3146de,null))[_0xfa74('0x44')](handleError(_0x3146de,null));};exports[_0xfa74('0x49')]=function(_0x512b58,_0x2361d2,_0x3b0dd5){if(_0x512b58['body']['id']){delete _0x512b58['body']['id'];}return db[_0xfa74('0x3e')]['findOne']({'where':{'id':_0x512b58[_0xfa74('0x41')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x2361d2,null))[_0xfa74('0x21')](function(_0x529921){if(_0x529921){_0x512b58[_0xfa74('0x46')]['AccountId']=_0x529921['id'];_0x512b58['body'][_0xfa74('0x4a')]=integrations[_0xfa74('0x4b')](_0x512b58[_0xfa74('0x46')][_0xfa74('0x4c')],_0x512b58[_0xfa74('0x46')][_0xfa74('0x4d')]);_0x512b58[_0xfa74('0x46')][_0xfa74('0x4e')]=integrations[_0xfa74('0x4f')](_0x512b58[_0xfa74('0x46')][_0xfa74('0x4c')],_0x512b58['body'][_0xfa74('0x4d')]);return db['ZendeskConfiguration'][_0xfa74('0x45')](_0x512b58[_0xfa74('0x46')],{'include':[{'model':db[_0xfa74('0x50')],'as':'Subjects'},{'model':db[_0xfa74('0x50')],'as':_0xfa74('0x4e')}]});}return null;})[_0xfa74('0x21')](respondWithResult(_0x2361d2,null))['catch'](handleError(_0x2361d2,null));};exports[_0xfa74('0x51')]=function(_0x34e772,_0x474462,_0x1105e5){var _0x10e5f5='';return db['ZendeskAccount'][_0xfa74('0x47')]({'where':{'id':_0x34e772[_0xfa74('0x41')]['id']},'attributes':['id',_0xfa74('0x52'),_0xfa74('0x53'),_0xfa74('0x54'),_0xfa74('0x55'),_0xfa74('0x56')]})[_0xfa74('0x21')](handleEntityNotFound(_0x474462,null))[_0xfa74('0x21')](function(_0x3526d7){if(_0x3526d7){_0x10e5f5=_0x3526d7[_0xfa74('0x56')];var _0x30aec7=_0x10e5f5['slice'](-0x1);if(_0x30aec7==='/'){_0x10e5f5=_0x10e5f5[_0xfa74('0x57')](0x0,_0x10e5f5[_0xfa74('0x58')](_0x30aec7));}var _0xdffc88={'method':_0xfa74('0x59'),'uri':util[_0xfa74('0x5a')](_0xfa74('0x5b'),_0x10e5f5,_0xfa74('0x5c')),'json':!![]};switch(_0x3526d7[_0xfa74('0x55')]){case'password':_0xdffc88[_0xfa74('0x5d')]={'Authorization':util[_0xfa74('0x5a')](_0xfa74('0x5e'),new Buffer(util[_0xfa74('0x5a')]('%s:%s',_0x3526d7[_0xfa74('0x52')],_0x3526d7[_0xfa74('0x53')]))[_0xfa74('0x5f')](_0xfa74('0x60')))};break;case'token':_0xdffc88[_0xfa74('0x5d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xfa74('0x5a')]('%s/token:%s',_0x3526d7[_0xfa74('0x52')],_0x3526d7[_0xfa74('0x54')]))['toString']('base64'))};break;default:throw new db[(_0xfa74('0x61'))][(_0xfa74('0x62'))](_0xfa74('0x63'));}return rp(_0xdffc88);}})[_0xfa74('0x21')](function(_0x4f1acc){if(_0x4f1acc){var _0x5acb9b=['subject',_0xfa74('0x64'),_0xfa74('0x65'),_0xfa74('0x66')];_[_0xfa74('0x67')](_0x4f1acc[_0xfa74('0x5c')],function(_0x52e8ac){return _0x5acb9b[_0xfa74('0x68')](_0x52e8ac[_0xfa74('0x4d')]);});return{'count':_0x4f1acc[_0xfa74('0x5c')][_0xfa74('0x42')],'rows':_[_0xfa74('0x2b')](_0x4f1acc[_0xfa74('0x5c')],function(_0x358db2){return{'id':_0x358db2['id'],'name':_0x358db2[_0xfa74('0x69')]>0x7?_0x358db2[_0xfa74('0x6a')]:_0x358db2['type'],'custom':_0x358db2['position']>0x7?!![]:![],'options':_0x358db2['system_field_options']?_0x358db2[_0xfa74('0x6b')]:_0x358db2[_0xfa74('0x6c')]?_0x358db2[_0xfa74('0x6c')]:[]};})};}})[_0xfa74('0x21')](respondWithResult(_0x474462,null))[_0xfa74('0x44')](function(_0x533649){var _0x3e4323=_0x34e772[_0xfa74('0x2d')]['test']?0x1f4:_0x533649[_0xfa74('0x6d')]||0x1f4;logger['error'](_0xfa74('0x6e'),_0xfa74('0x51'),_0x3e4323,JSON[_0xfa74('0x6f')](_0x533649));delete _0x533649[_0xfa74('0x25')];if(_0x3e4323===0x191){_0x3e4323=0x190;}_0x474462[_0xfa74('0x17')](_0x3e4323)[_0xfa74('0x70')](_0x34e772[_0xfa74('0x2d')][_0xfa74('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x533649['statusCode']}:_0x533649);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c34b0b2..fea5f79 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 _0x3536=['ZendeskAccount','util','../../config/logger','api','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3536,0xc9));var _0x6353=function(_0x436798,_0x299f97){_0x436798=_0x436798-0x0;var _0x95ae16=_0x3536[_0x436798];return _0x95ae16;};'use strict';var _=require('lodash');var util=require(_0x6353('0x0'));var logger=require(_0x6353('0x1'))(_0x6353('0x2'));var moment=require('moment');var BPromise=require(_0x6353('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6353('0x4'));var rimraf=require('rimraf');var config=require(_0x6353('0x5'));var attributes=require(_0x6353('0x6'));var integrations=require(_0x6353('0x7'));module[_0x6353('0x8')]=function(_0x5e7b70,_0x1d6bb1){return _0x5e7b70['define'](_0x6353('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0de=['request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf0de,0x1a0));var _0xef0d=function(_0x2f02c5,_0x4c3f9f){_0x2f02c5=_0x2f02c5-0x0;var _0x2d7278=_0xf0de[_0x2f02c5];return _0x2d7278;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xef0d('0x0'));var BPromise=require(_0xef0d('0x1'));var rp=require(_0xef0d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef0d('0x3'));var config=require(_0xef0d('0x4'));var attributes=require(_0xef0d('0x5'));var integrations=require(_0xef0d('0x6'));module[_0xef0d('0x7')]=function(_0x2c75fd,_0x29d4a7){return _0x2c75fd[_0xef0d('0x8')](_0xef0d('0x9'),attributes,{'tableName':_0xef0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e8fe119..2071dc9 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 _0xa43d=['model','map','find','ShowZendeskAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa43d,0x190));var _0xda43=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xa43d[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0xda43('0x0'));var util=require('util');var moment=require(_0xda43('0x1'));var BPromise=require(_0xda43('0x2'));var rs=require(_0xda43('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda43('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda43('0x5'))(_0xda43('0x6'));var config=require(_0xda43('0x7'));var jayson=require(_0xda43('0x8'));var client=jayson[_0xda43('0x9')][_0xda43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a1334,_0x1da8bb,_0x22e3c6){return new BPromise(function(_0x32a655,_0x1e2332){return client[_0xda43('0xb')](_0x8a1334,_0x22e3c6)[_0xda43('0xc')](function(_0x4320d0){logger[_0xda43('0xd')](_0xda43('0xe'),_0x1da8bb,'request\x20sent');logger[_0xda43('0xf')](_0xda43('0x10'),_0x1da8bb,'request\x20sent',JSON[_0xda43('0x11')](_0x4320d0));if(_0x4320d0[_0xda43('0x12')]){if(_0x4320d0[_0xda43('0x12')][_0xda43('0x13')]===0x1f4){logger[_0xda43('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x1da8bb,_0x4320d0['error'][_0xda43('0x14')]);return _0x1e2332(_0x4320d0['error'][_0xda43('0x14')]);}logger[_0xda43('0x12')](_0xda43('0xe'),_0x1da8bb,_0x4320d0[_0xda43('0x12')][_0xda43('0x14')]);return _0x32a655(_0x4320d0[_0xda43('0x12')][_0xda43('0x14')]);}else{logger[_0xda43('0xd')](_0xda43('0xe'),_0x1da8bb,_0xda43('0x15'));_0x32a655(_0x4320d0[_0xda43('0x16')]['message']);}})[_0xda43('0x17')](function(_0xf25e1c){logger[_0xda43('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x1da8bb,_0xf25e1c);_0x1e2332(_0xf25e1c);});});}exports[_0xda43('0x18')]=function(_0x459332){var _0x2438f9=this;return new Promise(function(_0x237bbd,_0x42f220){return db[_0xda43('0x19')]['findAll']({'raw':_0x459332[_0xda43('0x1a')]?_0x459332[_0xda43('0x1a')][_0xda43('0x1b')]===undefined?!![]:![]:!![],'where':_0x459332[_0xda43('0x1a')]?_0x459332[_0xda43('0x1a')][_0xda43('0x1c')]||null:null,'attributes':_0x459332['options']?_0x459332['options'][_0xda43('0x1d')]||null:null,'limit':_0x459332[_0xda43('0x1a')]?_0x459332[_0xda43('0x1a')][_0xda43('0x1e')]||null:null,'include':_0x459332['options']?_0x459332[_0xda43('0x1a')][_0xda43('0x1f')]?_['map'](_0x459332['options']['include'],function(_0x1ddf7b){return{'model':db[_0x1ddf7b['model']],'as':_0x1ddf7b['as'],'attributes':_0x1ddf7b['attributes'],'include':_0x1ddf7b['include']?_['map'](_0x1ddf7b['include'],function(_0x11715e){return{'model':db[_0x11715e[_0xda43('0x20')]],'as':_0x11715e['as'],'attributes':_0x11715e[_0xda43('0x1d')],'include':_0x11715e[_0xda43('0x1f')]?_[_0xda43('0x21')](_0x11715e[_0xda43('0x1f')],function(_0x479e29){return{'model':db[_0x479e29[_0xda43('0x20')]],'as':_0x479e29['as'],'attributes':_0x479e29[_0xda43('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xda43('0xc')](function(_0x2cb7c3){logger[_0xda43('0xd')](_0xda43('0x18'),_0x459332);logger[_0xda43('0xf')](_0xda43('0x18'),_0x459332,JSON[_0xda43('0x11')](_0x2cb7c3));_0x237bbd(_0x2cb7c3);})[_0xda43('0x17')](function(_0x139a70){logger[_0xda43('0x12')](_0xda43('0x18'),_0x139a70[_0xda43('0x14')],_0x459332);_0x42f220(_0x2438f9[_0xda43('0x12')](0x1f4,_0x139a70[_0xda43('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x58cdd7){var _0x56a69e=this;return new Promise(function(_0x4aa30d,_0x4af9ed){return db[_0xda43('0x19')][_0xda43('0x22')]({'raw':_0x58cdd7[_0xda43('0x1a')]?_0x58cdd7[_0xda43('0x1a')][_0xda43('0x1b')]===undefined?!![]:![]:!![],'where':_0x58cdd7['options']?_0x58cdd7['options'][_0xda43('0x1c')]||null:null,'attributes':_0x58cdd7[_0xda43('0x1a')]?_0x58cdd7[_0xda43('0x1a')][_0xda43('0x1d')]||null:null,'include':_0x58cdd7['options']?_0x58cdd7[_0xda43('0x1a')][_0xda43('0x1f')]?_[_0xda43('0x21')](_0x58cdd7[_0xda43('0x1a')]['include'],function(_0x222186){return{'model':db[_0x222186[_0xda43('0x20')]],'as':_0x222186['as'],'attributes':_0x222186[_0xda43('0x1d')],'include':_0x222186['include']?_[_0xda43('0x21')](_0x222186['include'],function(_0x3bcd7c){return{'model':db[_0x3bcd7c[_0xda43('0x20')]],'as':_0x3bcd7c['as'],'attributes':_0x3bcd7c[_0xda43('0x1d')],'include':_0x3bcd7c[_0xda43('0x1f')]?_['map'](_0x3bcd7c[_0xda43('0x1f')],function(_0xee1a7){return{'model':db[_0xee1a7['model']],'as':_0xee1a7['as'],'attributes':_0xee1a7[_0xda43('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2287b9){logger[_0xda43('0xd')](_0xda43('0x23'),_0x58cdd7);logger[_0xda43('0xf')](_0xda43('0x23'),_0x58cdd7,JSON[_0xda43('0x11')](_0x2287b9));_0x4aa30d(_0x2287b9);})[_0xda43('0x17')](function(_0x427dcc){logger[_0xda43('0x12')](_0xda43('0x23'),_0x427dcc['message'],_0x58cdd7);_0x4af9ed(_0x56a69e[_0xda43('0x12')](0x1f4,_0x427dcc[_0xda43('0x14')]));});});}; \ No newline at end of file +var _0x54f3=['stringify','error','code','message','info','result','GetZendeskAccount','options','raw','attributes','limit','include','map','model','then','catch','ZendeskAccount','where','ShowZendeskAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e97b2,_0x34ff1f){var _0xd90f4d=function(_0x429b55){while(--_0x429b55){_0x4e97b2['push'](_0x4e97b2['shift']());}};_0xd90f4d(++_0x34ff1f);}(_0x54f3,0xec));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var moment=require(_0x354f('0x2'));var BPromise=require('bluebird');var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x354f('0x4'))['db'];var utils=require(_0x354f('0x5'));var logger=require('../../config/logger')(_0x354f('0x6'));var config=require('../../config/environment');var jayson=require(_0x354f('0x7'));var client=jayson[_0x354f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x223964,_0x39bed0,_0x5670d6){return new BPromise(function(_0x4f3e8f,_0x3438be){return client['request'](_0x223964,_0x5670d6)['then'](function(_0x4b68cf){logger['info'](_0x354f('0x9'),_0x39bed0,_0x354f('0xa'));logger[_0x354f('0xb')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x39bed0,_0x354f('0xa'),JSON[_0x354f('0xc')](_0x4b68cf));if(_0x4b68cf[_0x354f('0xd')]){if(_0x4b68cf[_0x354f('0xd')][_0x354f('0xe')]===0x1f4){logger[_0x354f('0xd')](_0x354f('0x9'),_0x39bed0,_0x4b68cf[_0x354f('0xd')][_0x354f('0xf')]);return _0x3438be(_0x4b68cf[_0x354f('0xd')][_0x354f('0xf')]);}logger['error'](_0x354f('0x9'),_0x39bed0,_0x4b68cf[_0x354f('0xd')][_0x354f('0xf')]);return _0x4f3e8f(_0x4b68cf['error'][_0x354f('0xf')]);}else{logger[_0x354f('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x39bed0,_0x354f('0xa'));_0x4f3e8f(_0x4b68cf[_0x354f('0x11')]['message']);}})['catch'](function(_0x1509f2){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x39bed0,_0x1509f2);_0x3438be(_0x1509f2);});});}exports[_0x354f('0x12')]=function(_0x4c8da4){var _0x4dcc20=this;return new Promise(function(_0x56de89,_0x18ee87){return db['ZendeskAccount']['findAll']({'raw':_0x4c8da4[_0x354f('0x13')]?_0x4c8da4[_0x354f('0x13')][_0x354f('0x14')]===undefined?!![]:![]:!![],'where':_0x4c8da4['options']?_0x4c8da4['options']['where']||null:null,'attributes':_0x4c8da4[_0x354f('0x13')]?_0x4c8da4['options'][_0x354f('0x15')]||null:null,'limit':_0x4c8da4[_0x354f('0x13')]?_0x4c8da4['options'][_0x354f('0x16')]||null:null,'include':_0x4c8da4[_0x354f('0x13')]?_0x4c8da4[_0x354f('0x13')][_0x354f('0x17')]?_[_0x354f('0x18')](_0x4c8da4[_0x354f('0x13')][_0x354f('0x17')],function(_0x457476){return{'model':db[_0x457476[_0x354f('0x19')]],'as':_0x457476['as'],'attributes':_0x457476[_0x354f('0x15')],'include':_0x457476[_0x354f('0x17')]?_[_0x354f('0x18')](_0x457476[_0x354f('0x17')],function(_0x27ea31){return{'model':db[_0x27ea31[_0x354f('0x19')]],'as':_0x27ea31['as'],'attributes':_0x27ea31[_0x354f('0x15')],'include':_0x27ea31[_0x354f('0x17')]?_[_0x354f('0x18')](_0x27ea31[_0x354f('0x17')],function(_0x3005c6){return{'model':db[_0x3005c6['model']],'as':_0x3005c6['as'],'attributes':_0x3005c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x354f('0x1a')](function(_0x40dc91){logger['info'](_0x354f('0x12'),_0x4c8da4);logger[_0x354f('0xb')](_0x354f('0x12'),_0x4c8da4,JSON['stringify'](_0x40dc91));_0x56de89(_0x40dc91);})[_0x354f('0x1b')](function(_0x150fba){logger[_0x354f('0xd')](_0x354f('0x12'),_0x150fba[_0x354f('0xf')],_0x4c8da4);_0x18ee87(_0x4dcc20[_0x354f('0xd')](0x1f4,_0x150fba[_0x354f('0xf')]));});});};exports['ShowZendeskAccount']=function(_0x1f9a54){var _0x390cc4=this;return new Promise(function(_0x190fc8,_0x2c1fff){return db[_0x354f('0x1c')]['find']({'raw':_0x1f9a54['options']?_0x1f9a54['options'][_0x354f('0x14')]===undefined?!![]:![]:!![],'where':_0x1f9a54[_0x354f('0x13')]?_0x1f9a54['options'][_0x354f('0x1d')]||null:null,'attributes':_0x1f9a54['options']?_0x1f9a54[_0x354f('0x13')][_0x354f('0x15')]||null:null,'include':_0x1f9a54[_0x354f('0x13')]?_0x1f9a54[_0x354f('0x13')][_0x354f('0x17')]?_[_0x354f('0x18')](_0x1f9a54[_0x354f('0x13')][_0x354f('0x17')],function(_0x4d966d){return{'model':db[_0x4d966d[_0x354f('0x19')]],'as':_0x4d966d['as'],'attributes':_0x4d966d[_0x354f('0x15')],'include':_0x4d966d['include']?_[_0x354f('0x18')](_0x4d966d[_0x354f('0x17')],function(_0x5ba977){return{'model':db[_0x5ba977[_0x354f('0x19')]],'as':_0x5ba977['as'],'attributes':_0x5ba977[_0x354f('0x15')],'include':_0x5ba977[_0x354f('0x17')]?_[_0x354f('0x18')](_0x5ba977[_0x354f('0x17')],function(_0x23d211){return{'model':db[_0x23d211[_0x354f('0x19')]],'as':_0x23d211['as'],'attributes':_0x23d211[_0x354f('0x15')]};}):[]};}):[]};}):[]:[]})[_0x354f('0x1a')](function(_0x27397e){logger['info']('ShowZendeskAccount',_0x1f9a54);logger[_0x354f('0xb')](_0x354f('0x1e'),_0x1f9a54,JSON[_0x354f('0xc')](_0x27397e));_0x190fc8(_0x27397e);})[_0x354f('0x1b')](function(_0x232122){logger[_0x354f('0xd')](_0x354f('0x1e'),_0x232122[_0x354f('0xf')],_0x1f9a54);_0x2c1fff(_0x390cc4['error'](0x1f4,_0x232122['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8a2c7b4..2a351f6 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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5d0dfc,_0x4c1392){var _0x275e08=function(_0x56d21c){while(--_0x56d21c){_0x5d0dfc['push'](_0x5d0dfc['shift']());}};_0x275e08(++_0x4c1392);}(_0xac4a,0x13f));var _0xaac4=function(_0x34fe08,_0x7befb3){_0x34fe08=_0x34fe08-0x0;var _0x5e9fec=_0xac4a[_0x34fe08];return _0x5e9fec;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x3f8470,_0x18d674){var _0x45eea4=function(_0x2a9f4b){while(--_0x2a9f4b){_0x3f8470['push'](_0x3f8470['shift']());}};_0x45eea4(++_0x18d674);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 239c80e..67a77fb 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 _0x8963=['STRING','sequelize'];(function(_0x25d6e1,_0xbcd1bb){var _0x58f06f=function(_0x5eef6d){while(--_0x5eef6d){_0x25d6e1['push'](_0x25d6e1['shift']());}};_0x58f06f(++_0xbcd1bb);}(_0x8963,0x10f));var _0x3896=function(_0x1f4e6d,_0x1f3076){_0x1f4e6d=_0x1f4e6d-0x0;var _0x543f3a=_0x8963[_0x1f4e6d];return _0x543f3a;};'use strict';var Sequelize=require(_0x3896('0x0'));module['exports']={'name':{'type':Sequelize[_0x3896('0x1')]},'description':{'type':Sequelize[_0x3896('0x1')]}}; \ No newline at end of file +var _0x97e1=['exports','STRING','sequelize'];(function(_0x422ae7,_0x4842d4){var _0x391603=function(_0x34a056){while(--_0x34a056){_0x422ae7['push'](_0x422ae7['shift']());}};_0x391603(++_0x4842d4);}(_0x97e1,0x107));var _0x197e=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x97e1[_0x43444b];return _0x392fe5;};'use strict';var Sequelize=require(_0x197e('0x0'));module[_0x197e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x197e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f352575..2cb68aa 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 _0xc4e1=['body','getFields','findOne','ZendeskField','rawAttributes','getSubjects','pick','nolimit','getDescriptions','order','Tag','getTags','setTags','ids','eml-format','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','ZendeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','params','keys','length','find','create'];(function(_0x13a5b4,_0x806f55){var _0x408e0e=function(_0xa2a595){while(--_0xa2a595){_0x13a5b4['push'](_0x13a5b4['shift']());}};_0x408e0e(++_0x806f55);}(_0xc4e1,0x67));var _0x1c4e=function(_0x59e739,_0x316d5a){_0x59e739=_0x59e739-0x0;var _0x2aff8e=_0xc4e1[_0x59e739];return _0x2aff8e;};'use strict';var emlformat=require(_0x1c4e('0x0'));var rimraf=require(_0x1c4e('0x1'));var zipdir=require(_0x1c4e('0x2'));var jsonpatch=require(_0x1c4e('0x3'));var rp=require(_0x1c4e('0x4'));var moment=require(_0x1c4e('0x5'));var BPromise=require(_0x1c4e('0x6'));var Mustache=require('mustache');var util=require(_0x1c4e('0x7'));var path=require(_0x1c4e('0x8'));var sox=require(_0x1c4e('0x9'));var csv=require(_0x1c4e('0xa'));var ejs=require(_0x1c4e('0xb'));var fs=require('fs');var fs_extra=require(_0x1c4e('0xc'));var _=require(_0x1c4e('0xd'));var squel=require(_0x1c4e('0xe'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xf'));var deskjs=require(_0x1c4e('0x10'));var toCsv=require(_0x1c4e('0xa'));var querystring=require(_0x1c4e('0x11'));var Papa=require(_0x1c4e('0x12'));var Redis=require(_0x1c4e('0x13'));var authService=require(_0x1c4e('0x14'));var qs=require(_0x1c4e('0x15'));var as=require(_0x1c4e('0x16'));var hardwareService=require(_0x1c4e('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x1c4e('0x18'));var config=require(_0x1c4e('0x19'));var licenseUtil=require(_0x1c4e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x128c1b,_0x40ef88){_0x40ef88=_0x40ef88||0xcc;return function(_0x207065){if(_0x207065){return _0x128c1b[_0x1c4e('0x1b')](_0x40ef88);}return _0x128c1b['status'](_0x40ef88)[_0x1c4e('0x1c')]();};}function respondWithResult(_0x2f962b,_0x399ed4){_0x399ed4=_0x399ed4||0xc8;return function(_0x2ca16c){if(_0x2ca16c){return _0x2f962b['status'](_0x399ed4)[_0x1c4e('0x1d')](_0x2ca16c);}};}function respondWithFilteredResult(_0x44e0d4,_0x91902b){return function(_0x2e4b87){if(_0x2e4b87){var _0x3ac5c9=typeof _0x91902b[_0x1c4e('0x1e')]===_0x1c4e('0x1f')&&typeof _0x91902b['limit']===_0x1c4e('0x1f');var _0x5f4877=_0x2e4b87[_0x1c4e('0x20')];var _0x4caac5=_0x3ac5c9?0x0:_0x91902b['offset'];var _0x1f9032=_0x3ac5c9?_0x2e4b87[_0x1c4e('0x20')]:_0x91902b[_0x1c4e('0x1e')]+_0x91902b[_0x1c4e('0x21')];var _0x4a57c3;if(_0x1f9032>=_0x5f4877){_0x1f9032=_0x5f4877;_0x4a57c3=0xc8;}else{_0x4a57c3=0xce;}_0x44e0d4[_0x1c4e('0x22')](_0x4a57c3);return _0x44e0d4[_0x1c4e('0x23')](_0x1c4e('0x24'),_0x4caac5+'-'+_0x1f9032+'/'+_0x5f4877)[_0x1c4e('0x1d')](_0x2e4b87);}return null;};}function patchUpdates(_0x2b83c7){return function(_0x53a7bb){try{jsonpatch[_0x1c4e('0x25')](_0x53a7bb,_0x2b83c7,!![]);}catch(_0x180c74){return BPromise[_0x1c4e('0x26')](_0x180c74);}return _0x53a7bb[_0x1c4e('0x27')]();};}function saveUpdates(_0x3ced2c,_0x4fcfc2){return function(_0x32eaea){if(_0x32eaea){return _0x32eaea[_0x1c4e('0x28')](_0x3ced2c)['then'](function(_0x312057){return _0x312057;});}return null;};}function removeEntity(_0x248b22,_0x2453ea){return function(_0x3adcfd){if(_0x3adcfd){return _0x3adcfd[_0x1c4e('0x29')]()['then'](function(){_0x248b22[_0x1c4e('0x22')](0xcc)[_0x1c4e('0x1c')]();});}};}function handleEntityNotFound(_0x570d3a,_0x5206fb){return function(_0x21656b){if(!_0x21656b){_0x570d3a[_0x1c4e('0x1b')](0x194);}return _0x21656b;};}function handleError(_0x77cb7f,_0x3d535a){_0x3d535a=_0x3d535a||0x1f4;return function(_0x3cc81b){logger[_0x1c4e('0x2a')](_0x3cc81b[_0x1c4e('0x2b')]);if(_0x3cc81b['name']){delete _0x3cc81b[_0x1c4e('0x2c')];}_0x77cb7f['status'](_0x3d535a)[_0x1c4e('0x2d')](_0x3cc81b);};}exports['index']=function(_0x3d61e8,_0x2925d4){var _0x1d85d9={},_0x90ff96={},_0x14873b={'count':0x0,'rows':[]};var _0x580dcd=_[_0x1c4e('0x2e')](db[_0x1c4e('0x2f')]['rawAttributes'],function(_0x57fd48){return{'name':_0x57fd48[_0x1c4e('0x30')],'type':_0x57fd48[_0x1c4e('0x31')][_0x1c4e('0x32')]};});_0x90ff96[_0x1c4e('0x33')]=_[_0x1c4e('0x2e')](_0x580dcd,_0x1c4e('0x2c'));_0x90ff96['query']=_['keys'](_0x3d61e8[_0x1c4e('0x34')]);_0x90ff96[_0x1c4e('0x35')]=_[_0x1c4e('0x36')](_0x90ff96[_0x1c4e('0x33')],_0x90ff96['query']);_0x1d85d9[_0x1c4e('0x37')]=_[_0x1c4e('0x36')](_0x90ff96[_0x1c4e('0x33')],qs['fields'](_0x3d61e8[_0x1c4e('0x34')][_0x1c4e('0x38')]));_0x1d85d9[_0x1c4e('0x37')]=_0x1d85d9['attributes']['length']?_0x1d85d9['attributes']:_0x90ff96[_0x1c4e('0x33')];if(!_0x3d61e8[_0x1c4e('0x34')][_0x1c4e('0x39')]('nolimit')){_0x1d85d9[_0x1c4e('0x21')]=qs['limit'](_0x3d61e8[_0x1c4e('0x34')][_0x1c4e('0x21')]);_0x1d85d9['offset']=qs[_0x1c4e('0x1e')](_0x3d61e8[_0x1c4e('0x34')][_0x1c4e('0x1e')]);}_0x1d85d9['order']=qs[_0x1c4e('0x3a')](_0x3d61e8['query'][_0x1c4e('0x3a')]);_0x1d85d9[_0x1c4e('0x3b')]=qs[_0x1c4e('0x35')](_['pick'](_0x3d61e8['query'],_0x90ff96['filters']),_0x580dcd);if(_0x3d61e8[_0x1c4e('0x34')][_0x1c4e('0x3c')]){_0x1d85d9[_0x1c4e('0x3b')]=_[_0x1c4e('0x3d')](_0x1d85d9['where'],{'$or':_[_0x1c4e('0x2e')](_0x580dcd,function(_0x59b768){if(_0x59b768[_0x1c4e('0x31')]!==_0x1c4e('0x3e')){var _0x4c2957={};_0x4c2957[_0x59b768['name']]={'$like':'%'+_0x3d61e8['query'][_0x1c4e('0x3c')]+'%'};return _0x4c2957;}})});}_0x1d85d9=_[_0x1c4e('0x3d')]({},_0x1d85d9,_0x3d61e8[_0x1c4e('0x3f')]);var _0x3f9d53={'where':_0x1d85d9[_0x1c4e('0x3b')]};return db['ZendeskConfiguration'][_0x1c4e('0x20')](_0x3f9d53)['then'](function(_0x44ee34){_0x14873b[_0x1c4e('0x20')]=_0x44ee34;if(_0x3d61e8['query'][_0x1c4e('0x40')]){_0x1d85d9[_0x1c4e('0x41')]=[{'all':!![]}];}return db[_0x1c4e('0x2f')][_0x1c4e('0x42')](_0x1d85d9);})[_0x1c4e('0x43')](function(_0x5442ee){_0x14873b[_0x1c4e('0x44')]=_0x5442ee;return _0x14873b;})['then'](respondWithFilteredResult(_0x2925d4,_0x1d85d9))[_0x1c4e('0x45')](handleError(_0x2925d4,null));};exports['show']=function(_0x1d4398,_0x127a14){var _0x2a1b27={'raw':![],'where':{'id':_0x1d4398[_0x1c4e('0x46')]['id']}},_0x3395d9={};_0x3395d9[_0x1c4e('0x33')]=_[_0x1c4e('0x47')](db[_0x1c4e('0x2f')]['rawAttributes']);_0x3395d9[_0x1c4e('0x34')]=_[_0x1c4e('0x47')](_0x1d4398[_0x1c4e('0x34')]);_0x3395d9['filters']=_[_0x1c4e('0x36')](_0x3395d9[_0x1c4e('0x33')],_0x3395d9[_0x1c4e('0x34')]);_0x2a1b27['attributes']=_[_0x1c4e('0x36')](_0x3395d9[_0x1c4e('0x33')],qs['fields'](_0x1d4398[_0x1c4e('0x34')][_0x1c4e('0x38')]));_0x2a1b27[_0x1c4e('0x37')]=_0x2a1b27[_0x1c4e('0x37')][_0x1c4e('0x48')]?_0x2a1b27[_0x1c4e('0x37')]:_0x3395d9[_0x1c4e('0x33')];if(_0x1d4398['query'][_0x1c4e('0x40')]){_0x2a1b27[_0x1c4e('0x41')]=[{'all':!![]}];}_0x2a1b27=_['merge']({},_0x2a1b27,_0x1d4398[_0x1c4e('0x3f')]);return db['ZendeskConfiguration'][_0x1c4e('0x49')](_0x2a1b27)['then'](handleEntityNotFound(_0x127a14,null))[_0x1c4e('0x43')](respondWithResult(_0x127a14,null))[_0x1c4e('0x45')](handleError(_0x127a14,null));};exports[_0x1c4e('0x4a')]=function(_0x1e9475,_0xefa299){return db[_0x1c4e('0x2f')][_0x1c4e('0x4a')](_0x1e9475[_0x1c4e('0x4b')],{})[_0x1c4e('0x43')](respondWithResult(_0xefa299,0xc9))[_0x1c4e('0x45')](handleError(_0xefa299,null));};exports['update']=function(_0x2e0b58,_0x4ff7f8){if(_0x2e0b58[_0x1c4e('0x4b')]['id']){delete _0x2e0b58['body']['id'];}return db[_0x1c4e('0x2f')][_0x1c4e('0x49')]({'where':{'id':_0x2e0b58[_0x1c4e('0x46')]['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x4ff7f8,null))[_0x1c4e('0x43')](saveUpdates(_0x2e0b58[_0x1c4e('0x4b')],null))[_0x1c4e('0x43')](respondWithResult(_0x4ff7f8,null))['catch'](handleError(_0x4ff7f8,null));};exports[_0x1c4e('0x29')]=function(_0x329c9d,_0x2c3f59){return db['ZendeskConfiguration'][_0x1c4e('0x49')]({'where':{'id':_0x329c9d[_0x1c4e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c3f59,null))[_0x1c4e('0x43')](removeEntity(_0x2c3f59,null))[_0x1c4e('0x45')](handleError(_0x2c3f59,null));};exports[_0x1c4e('0x4c')]=function(_0x40f09e,_0x1a8c5e,_0x28a97b){var _0x30e68={};var _0x5b920d={};var _0x130630;var _0xad5387;return db['ZendeskConfiguration'][_0x1c4e('0x4d')]({'where':{'id':_0x40f09e[_0x1c4e('0x46')]['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x1a8c5e,null))[_0x1c4e('0x43')](function(_0x4d3a59){if(_0x4d3a59){_0x130630=_0x4d3a59;_0x5b920d['model']=_['keys'](db[_0x1c4e('0x4e')][_0x1c4e('0x4f')]);_0x5b920d['query']=_[_0x1c4e('0x47')](_0x40f09e[_0x1c4e('0x34')]);_0x5b920d['filters']=_[_0x1c4e('0x36')](_0x5b920d['model'],_0x5b920d[_0x1c4e('0x34')]);_0x30e68['attributes']=_[_0x1c4e('0x36')](_0x5b920d['model'],qs[_0x1c4e('0x38')](_0x40f09e[_0x1c4e('0x34')]['fields']));_0x30e68[_0x1c4e('0x37')]=_0x30e68[_0x1c4e('0x37')][_0x1c4e('0x48')]?_0x30e68[_0x1c4e('0x37')]:_0x5b920d[_0x1c4e('0x33')];_0x30e68['order']=qs['sort'](_0x40f09e[_0x1c4e('0x34')]['sort']);_0x30e68[_0x1c4e('0x3b')]=qs['filters'](_['pick'](_0x40f09e[_0x1c4e('0x34')],_0x5b920d[_0x1c4e('0x35')]));if(_0x40f09e['query'][_0x1c4e('0x3c')]){_0x30e68[_0x1c4e('0x3b')]=_['merge'](_0x30e68[_0x1c4e('0x3b')],{'$or':_['map'](_0x30e68[_0x1c4e('0x37')],function(_0x3d3555){var _0x5b44d0={};_0x5b44d0[_0x3d3555]={'$like':'%'+_0x40f09e[_0x1c4e('0x34')][_0x1c4e('0x3c')]+'%'};return _0x5b44d0;})});}_0x30e68=_['merge']({},_0x30e68,_0x40f09e[_0x1c4e('0x3f')]);return _0x130630['getFields'](_0x30e68);}})[_0x1c4e('0x43')](function(_0x3a0071){if(_0x3a0071){_0xad5387=_0x3a0071[_0x1c4e('0x48')];if(!_0x40f09e[_0x1c4e('0x34')]['hasOwnProperty']('nolimit')){_0x30e68[_0x1c4e('0x21')]=qs[_0x1c4e('0x21')](_0x40f09e[_0x1c4e('0x34')][_0x1c4e('0x21')]);_0x30e68[_0x1c4e('0x1e')]=qs[_0x1c4e('0x1e')](_0x40f09e['query']['offset']);}return _0x130630[_0x1c4e('0x4c')](_0x30e68);}})[_0x1c4e('0x43')](function(_0x4a8573){if(_0x4a8573){return _0x4a8573?{'count':_0xad5387,'rows':_0x4a8573}:null;}})['then'](respondWithResult(_0x1a8c5e,null))[_0x1c4e('0x45')](handleError(_0x1a8c5e,null));};exports[_0x1c4e('0x50')]=function(_0x592d01,_0x4c60f3,_0x38a272){var _0x1342ab={};var _0x48f84f={};var _0x770864;var _0x112539;return db[_0x1c4e('0x2f')]['findOne']({'where':{'id':_0x592d01[_0x1c4e('0x46')]['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x4c60f3,null))[_0x1c4e('0x43')](function(_0x5b4c0){if(_0x5b4c0){_0x770864=_0x5b4c0;_0x48f84f['model']=_[_0x1c4e('0x47')](db[_0x1c4e('0x4e')]['rawAttributes']);_0x48f84f[_0x1c4e('0x34')]=_['keys'](_0x592d01[_0x1c4e('0x34')]);_0x48f84f[_0x1c4e('0x35')]=_['intersection'](_0x48f84f[_0x1c4e('0x33')],_0x48f84f['query']);_0x1342ab[_0x1c4e('0x37')]=_['intersection'](_0x48f84f['model'],qs[_0x1c4e('0x38')](_0x592d01[_0x1c4e('0x34')][_0x1c4e('0x38')]));_0x1342ab['attributes']=_0x1342ab[_0x1c4e('0x37')][_0x1c4e('0x48')]?_0x1342ab[_0x1c4e('0x37')]:_0x48f84f['model'];_0x1342ab['order']=qs[_0x1c4e('0x3a')](_0x592d01[_0x1c4e('0x34')][_0x1c4e('0x3a')]);_0x1342ab[_0x1c4e('0x3b')]=qs[_0x1c4e('0x35')](_[_0x1c4e('0x51')](_0x592d01[_0x1c4e('0x34')],_0x48f84f[_0x1c4e('0x35')]));if(_0x592d01[_0x1c4e('0x34')][_0x1c4e('0x3c')]){_0x1342ab[_0x1c4e('0x3b')]=_[_0x1c4e('0x3d')](_0x1342ab[_0x1c4e('0x3b')],{'$or':_[_0x1c4e('0x2e')](_0x1342ab[_0x1c4e('0x37')],function(_0x9c747e){var _0x26f8ce={};_0x26f8ce[_0x9c747e]={'$like':'%'+_0x592d01['query'][_0x1c4e('0x3c')]+'%'};return _0x26f8ce;})});}_0x1342ab=_[_0x1c4e('0x3d')]({},_0x1342ab,_0x592d01['options']);return _0x770864[_0x1c4e('0x50')](_0x1342ab);}})[_0x1c4e('0x43')](function(_0x21eab1){if(_0x21eab1){_0x112539=_0x21eab1[_0x1c4e('0x48')];if(!_0x592d01['query'][_0x1c4e('0x39')](_0x1c4e('0x52'))){_0x1342ab[_0x1c4e('0x21')]=qs[_0x1c4e('0x21')](_0x592d01[_0x1c4e('0x34')]['limit']);_0x1342ab[_0x1c4e('0x1e')]=qs[_0x1c4e('0x1e')](_0x592d01[_0x1c4e('0x34')][_0x1c4e('0x1e')]);}return _0x770864[_0x1c4e('0x50')](_0x1342ab);}})[_0x1c4e('0x43')](function(_0x3e1693){if(_0x3e1693){return _0x3e1693?{'count':_0x112539,'rows':_0x3e1693}:null;}})[_0x1c4e('0x43')](respondWithResult(_0x4c60f3,null))[_0x1c4e('0x45')](handleError(_0x4c60f3,null));};exports[_0x1c4e('0x53')]=function(_0x2c2457,_0x2759c5,_0x449642){var _0x7e0c82={};var _0x34dff3={};var _0x28f5ad;var _0x5b2c1b;return db[_0x1c4e('0x2f')]['findOne']({'where':{'id':_0x2c2457[_0x1c4e('0x46')]['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x2759c5,null))[_0x1c4e('0x43')](function(_0x331309){if(_0x331309){_0x28f5ad=_0x331309;_0x34dff3[_0x1c4e('0x33')]=_[_0x1c4e('0x47')](db[_0x1c4e('0x4e')][_0x1c4e('0x4f')]);_0x34dff3[_0x1c4e('0x34')]=_[_0x1c4e('0x47')](_0x2c2457[_0x1c4e('0x34')]);_0x34dff3[_0x1c4e('0x35')]=_[_0x1c4e('0x36')](_0x34dff3[_0x1c4e('0x33')],_0x34dff3[_0x1c4e('0x34')]);_0x7e0c82['attributes']=_[_0x1c4e('0x36')](_0x34dff3['model'],qs[_0x1c4e('0x38')](_0x2c2457['query']['fields']));_0x7e0c82[_0x1c4e('0x37')]=_0x7e0c82[_0x1c4e('0x37')]['length']?_0x7e0c82[_0x1c4e('0x37')]:_0x34dff3[_0x1c4e('0x33')];_0x7e0c82[_0x1c4e('0x54')]=qs[_0x1c4e('0x3a')](_0x2c2457['query'][_0x1c4e('0x3a')]);_0x7e0c82[_0x1c4e('0x3b')]=qs['filters'](_[_0x1c4e('0x51')](_0x2c2457['query'],_0x34dff3[_0x1c4e('0x35')]));if(_0x2c2457[_0x1c4e('0x34')][_0x1c4e('0x3c')]){_0x7e0c82[_0x1c4e('0x3b')]=_[_0x1c4e('0x3d')](_0x7e0c82[_0x1c4e('0x3b')],{'$or':_[_0x1c4e('0x2e')](_0x7e0c82[_0x1c4e('0x37')],function(_0x2ab7c9){var _0x605529={};_0x605529[_0x2ab7c9]={'$like':'%'+_0x2c2457[_0x1c4e('0x34')][_0x1c4e('0x3c')]+'%'};return _0x605529;})});}_0x7e0c82=_[_0x1c4e('0x3d')]({},_0x7e0c82,_0x2c2457[_0x1c4e('0x3f')]);return _0x28f5ad[_0x1c4e('0x53')](_0x7e0c82);}})[_0x1c4e('0x43')](function(_0x4d5195){if(_0x4d5195){_0x5b2c1b=_0x4d5195[_0x1c4e('0x48')];if(!_0x2c2457[_0x1c4e('0x34')]['hasOwnProperty'](_0x1c4e('0x52'))){_0x7e0c82[_0x1c4e('0x21')]=qs['limit'](_0x2c2457[_0x1c4e('0x34')][_0x1c4e('0x21')]);_0x7e0c82[_0x1c4e('0x1e')]=qs[_0x1c4e('0x1e')](_0x2c2457['query'][_0x1c4e('0x1e')]);}return _0x28f5ad[_0x1c4e('0x53')](_0x7e0c82);}})[_0x1c4e('0x43')](function(_0x1f2e2d){if(_0x1f2e2d){return _0x1f2e2d?{'count':_0x5b2c1b,'rows':_0x1f2e2d}:null;}})['then'](respondWithResult(_0x2759c5,null))[_0x1c4e('0x45')](handleError(_0x2759c5,null));};exports['getTags']=function(_0x47520a,_0x6c86fa,_0x1a55f2){var _0x4449f0={};var _0x3b1f60={};var _0x4420e5;var _0x394168;return db['ZendeskConfiguration'][_0x1c4e('0x4d')]({'where':{'id':_0x47520a['params']['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x6c86fa,null))['then'](function(_0x461c3b){if(_0x461c3b){_0x4420e5=_0x461c3b;_0x3b1f60['model']=_[_0x1c4e('0x47')](db[_0x1c4e('0x55')][_0x1c4e('0x4f')]);_0x3b1f60['query']=_[_0x1c4e('0x47')](_0x47520a['query']);_0x3b1f60[_0x1c4e('0x35')]=_[_0x1c4e('0x36')](_0x3b1f60[_0x1c4e('0x33')],_0x3b1f60[_0x1c4e('0x34')]);_0x4449f0['attributes']=_[_0x1c4e('0x36')](_0x3b1f60['model'],qs[_0x1c4e('0x38')](_0x47520a['query']['fields']));_0x4449f0[_0x1c4e('0x37')]=_0x4449f0['attributes'][_0x1c4e('0x48')]?_0x4449f0['attributes']:_0x3b1f60[_0x1c4e('0x33')];_0x4449f0[_0x1c4e('0x54')]=qs[_0x1c4e('0x3a')](_0x47520a[_0x1c4e('0x34')][_0x1c4e('0x3a')]);_0x4449f0['where']=qs[_0x1c4e('0x35')](_[_0x1c4e('0x51')](_0x47520a[_0x1c4e('0x34')],_0x3b1f60[_0x1c4e('0x35')]));if(_0x47520a[_0x1c4e('0x34')][_0x1c4e('0x3c')]){_0x4449f0[_0x1c4e('0x3b')]=_[_0x1c4e('0x3d')](_0x4449f0['where'],{'$or':_[_0x1c4e('0x2e')](_0x4449f0['attributes'],function(_0x1c4471){var _0x5c6cf4={};_0x5c6cf4[_0x1c4471]={'$like':'%'+_0x47520a[_0x1c4e('0x34')]['filter']+'%'};return _0x5c6cf4;})});}_0x4449f0=_[_0x1c4e('0x3d')]({},_0x4449f0,_0x47520a[_0x1c4e('0x3f')]);return _0x4420e5[_0x1c4e('0x56')](_0x4449f0);}})[_0x1c4e('0x43')](function(_0x464c41){if(_0x464c41){_0x394168=_0x464c41[_0x1c4e('0x48')];if(!_0x47520a[_0x1c4e('0x34')][_0x1c4e('0x39')](_0x1c4e('0x52'))){_0x4449f0[_0x1c4e('0x21')]=qs[_0x1c4e('0x21')](_0x47520a['query'][_0x1c4e('0x21')]);_0x4449f0['offset']=qs[_0x1c4e('0x1e')](_0x47520a[_0x1c4e('0x34')][_0x1c4e('0x1e')]);}return _0x4420e5[_0x1c4e('0x56')](_0x4449f0);}})[_0x1c4e('0x43')](function(_0x5efa4c){if(_0x5efa4c){return _0x5efa4c?{'count':_0x394168,'rows':_0x5efa4c}:null;}})[_0x1c4e('0x43')](respondWithResult(_0x6c86fa,null))['catch'](handleError(_0x6c86fa,null));};exports[_0x1c4e('0x57')]=function(_0x25f2b5,_0x4d0963,_0x553d5c){if(_0x25f2b5[_0x1c4e('0x4b')]['id']){delete _0x25f2b5[_0x1c4e('0x4b')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x25f2b5[_0x1c4e('0x46')]['id']}})[_0x1c4e('0x43')](handleEntityNotFound(_0x4d0963,null))[_0x1c4e('0x43')](function(_0x54e9b7){if(_0x54e9b7){return _0x54e9b7[_0x1c4e('0x57')](_0x25f2b5[_0x1c4e('0x4b')][_0x1c4e('0x58')]||[]);}return null;})[_0x1c4e('0x43')](respondWithResult(_0x4d0963,null))['catch'](handleError(_0x4d0963,null));}; \ No newline at end of file +var _0x8132=['setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','getFields','ZendeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag'];(function(_0x499fb2,_0x47517a){var _0x1bfc30=function(_0x1484d9){while(--_0x1484d9){_0x499fb2['push'](_0x499fb2['shift']());}};_0x1bfc30(++_0x47517a);}(_0x8132,0x1b5));var _0x2813=function(_0x2f1a3e,_0x5715d9){_0x2f1a3e=_0x2f1a3e-0x0;var _0x1fe3eb=_0x8132[_0x2f1a3e];return _0x1fe3eb;};'use strict';var emlformat=require(_0x2813('0x0'));var rimraf=require(_0x2813('0x1'));var zipdir=require(_0x2813('0x2'));var jsonpatch=require(_0x2813('0x3'));var rp=require('request-promise');var moment=require(_0x2813('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2813('0x5'));var util=require('util');var path=require(_0x2813('0x6'));var sox=require(_0x2813('0x7'));var csv=require(_0x2813('0x8'));var ejs=require(_0x2813('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2813('0xa'));var squel=require(_0x2813('0xb'));var crypto=require(_0x2813('0xc'));var jsforce=require(_0x2813('0xd'));var deskjs=require(_0x2813('0xe'));var toCsv=require(_0x2813('0x8'));var querystring=require(_0x2813('0xf'));var Papa=require(_0x2813('0x10'));var Redis=require(_0x2813('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2813('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2813('0x13'));var logger=require('../../config/logger')(_0x2813('0x14'));var utils=require(_0x2813('0x15'));var config=require(_0x2813('0x16'));var licenseUtil=require(_0x2813('0x17'));var db=require(_0x2813('0x18'))['db'];function respondWithStatusCode(_0x390862,_0x1807a8){_0x1807a8=_0x1807a8||0xcc;return function(_0x432a8c){if(_0x432a8c){return _0x390862[_0x2813('0x19')](_0x1807a8);}return _0x390862[_0x2813('0x1a')](_0x1807a8)['end']();};}function respondWithResult(_0x532020,_0x5ab93e){_0x5ab93e=_0x5ab93e||0xc8;return function(_0x4efc3c){if(_0x4efc3c){return _0x532020[_0x2813('0x1a')](_0x5ab93e)[_0x2813('0x1b')](_0x4efc3c);}};}function respondWithFilteredResult(_0x1fac53,_0x1e314f){return function(_0x33569c){if(_0x33569c){var _0x36996e=typeof _0x1e314f['offset']===_0x2813('0x1c')&&typeof _0x1e314f[_0x2813('0x1d')]===_0x2813('0x1c');var _0x468eae=_0x33569c['count'];var _0x2c9e66=_0x36996e?0x0:_0x1e314f['offset'];var _0x5a984c=_0x36996e?_0x33569c[_0x2813('0x1e')]:_0x1e314f[_0x2813('0x1f')]+_0x1e314f[_0x2813('0x1d')];var _0x36bb69;if(_0x5a984c>=_0x468eae){_0x5a984c=_0x468eae;_0x36bb69=0xc8;}else{_0x36bb69=0xce;}_0x1fac53[_0x2813('0x1a')](_0x36bb69);return _0x1fac53[_0x2813('0x20')](_0x2813('0x21'),_0x2c9e66+'-'+_0x5a984c+'/'+_0x468eae)['json'](_0x33569c);}return null;};}function patchUpdates(_0x2a8103){return function(_0x38b30){try{jsonpatch[_0x2813('0x22')](_0x38b30,_0x2a8103,!![]);}catch(_0x9ac8b6){return BPromise[_0x2813('0x23')](_0x9ac8b6);}return _0x38b30[_0x2813('0x24')]();};}function saveUpdates(_0x3ebeb3,_0x17cab2){return function(_0x37fe8d){if(_0x37fe8d){return _0x37fe8d[_0x2813('0x25')](_0x3ebeb3)['then'](function(_0x50dfb1){return _0x50dfb1;});}return null;};}function removeEntity(_0x16d1e2,_0x512353){return function(_0x60218c){if(_0x60218c){return _0x60218c['destroy']()[_0x2813('0x26')](function(){_0x16d1e2[_0x2813('0x1a')](0xcc)[_0x2813('0x27')]();});}};}function handleEntityNotFound(_0x643c27,_0x17083a){return function(_0x10f72d){if(!_0x10f72d){_0x643c27['sendStatus'](0x194);}return _0x10f72d;};}function handleError(_0x27bd59,_0x42a97b){_0x42a97b=_0x42a97b||0x1f4;return function(_0x24b9be){logger[_0x2813('0x28')](_0x24b9be['stack']);if(_0x24b9be[_0x2813('0x29')]){delete _0x24b9be[_0x2813('0x29')];}_0x27bd59[_0x2813('0x1a')](_0x42a97b)[_0x2813('0x2a')](_0x24b9be);};}exports[_0x2813('0x2b')]=function(_0x408e35,_0x4f5141){var _0x3ba36e={},_0x49a93e={},_0x89cfd6={'count':0x0,'rows':[]};var _0x45b1b7=_[_0x2813('0x2c')](db[_0x2813('0x2d')][_0x2813('0x2e')],function(_0xe82eaf){return{'name':_0xe82eaf[_0x2813('0x2f')],'type':_0xe82eaf[_0x2813('0x30')][_0x2813('0x31')]};});_0x49a93e[_0x2813('0x32')]=_[_0x2813('0x2c')](_0x45b1b7,_0x2813('0x29'));_0x49a93e[_0x2813('0x33')]=_['keys'](_0x408e35['query']);_0x49a93e['filters']=_['intersection'](_0x49a93e['model'],_0x49a93e['query']);_0x3ba36e[_0x2813('0x34')]=_[_0x2813('0x35')](_0x49a93e['model'],qs[_0x2813('0x36')](_0x408e35['query'][_0x2813('0x36')]));_0x3ba36e[_0x2813('0x34')]=_0x3ba36e[_0x2813('0x34')][_0x2813('0x37')]?_0x3ba36e[_0x2813('0x34')]:_0x49a93e[_0x2813('0x32')];if(!_0x408e35[_0x2813('0x33')][_0x2813('0x38')](_0x2813('0x39'))){_0x3ba36e['limit']=qs[_0x2813('0x1d')](_0x408e35[_0x2813('0x33')][_0x2813('0x1d')]);_0x3ba36e[_0x2813('0x1f')]=qs[_0x2813('0x1f')](_0x408e35['query'][_0x2813('0x1f')]);}_0x3ba36e['order']=qs['sort'](_0x408e35[_0x2813('0x33')][_0x2813('0x3a')]);_0x3ba36e[_0x2813('0x3b')]=qs[_0x2813('0x3c')](_[_0x2813('0x3d')](_0x408e35[_0x2813('0x33')],_0x49a93e[_0x2813('0x3c')]),_0x45b1b7);if(_0x408e35[_0x2813('0x33')]['filter']){_0x3ba36e[_0x2813('0x3b')]=_[_0x2813('0x3e')](_0x3ba36e[_0x2813('0x3b')],{'$or':_[_0x2813('0x2c')](_0x45b1b7,function(_0x3cbea2){if(_0x3cbea2[_0x2813('0x30')]!==_0x2813('0x3f')){var _0x31a9aa={};_0x31a9aa[_0x3cbea2['name']]={'$like':'%'+_0x408e35[_0x2813('0x33')][_0x2813('0x40')]+'%'};return _0x31a9aa;}})});}_0x3ba36e=_[_0x2813('0x3e')]({},_0x3ba36e,_0x408e35[_0x2813('0x41')]);var _0x28c436={'where':_0x3ba36e[_0x2813('0x3b')]};return db[_0x2813('0x2d')][_0x2813('0x1e')](_0x28c436)[_0x2813('0x26')](function(_0x1095c4){_0x89cfd6[_0x2813('0x1e')]=_0x1095c4;if(_0x408e35['query'][_0x2813('0x42')]){_0x3ba36e[_0x2813('0x43')]=[{'all':!![]}];}return db[_0x2813('0x2d')]['findAll'](_0x3ba36e);})[_0x2813('0x26')](function(_0x5bf691){_0x89cfd6[_0x2813('0x44')]=_0x5bf691;return _0x89cfd6;})['then'](respondWithFilteredResult(_0x4f5141,_0x3ba36e))[_0x2813('0x45')](handleError(_0x4f5141,null));};exports[_0x2813('0x46')]=function(_0x25fdf1,_0x3c2f28){var _0x4e3802={'raw':![],'where':{'id':_0x25fdf1[_0x2813('0x47')]['id']}},_0x12080e={};_0x12080e[_0x2813('0x32')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x12080e[_0x2813('0x33')]=_[_0x2813('0x48')](_0x25fdf1[_0x2813('0x33')]);_0x12080e['filters']=_[_0x2813('0x35')](_0x12080e['model'],_0x12080e['query']);_0x4e3802['attributes']=_[_0x2813('0x35')](_0x12080e[_0x2813('0x32')],qs[_0x2813('0x36')](_0x25fdf1[_0x2813('0x33')][_0x2813('0x36')]));_0x4e3802[_0x2813('0x34')]=_0x4e3802[_0x2813('0x34')][_0x2813('0x37')]?_0x4e3802[_0x2813('0x34')]:_0x12080e[_0x2813('0x32')];if(_0x25fdf1[_0x2813('0x33')]['includeAll']){_0x4e3802[_0x2813('0x43')]=[{'all':!![]}];}_0x4e3802=_[_0x2813('0x3e')]({},_0x4e3802,_0x25fdf1[_0x2813('0x41')]);return db[_0x2813('0x2d')][_0x2813('0x49')](_0x4e3802)['then'](handleEntityNotFound(_0x3c2f28,null))[_0x2813('0x26')](respondWithResult(_0x3c2f28,null))[_0x2813('0x45')](handleError(_0x3c2f28,null));};exports[_0x2813('0x4a')]=function(_0x4be0c2,_0x3e9d42){return db['ZendeskConfiguration']['create'](_0x4be0c2[_0x2813('0x4b')],{})[_0x2813('0x26')](respondWithResult(_0x3e9d42,0xc9))['catch'](handleError(_0x3e9d42,null));};exports[_0x2813('0x25')]=function(_0x5690e3,_0x35dea1){if(_0x5690e3['body']['id']){delete _0x5690e3['body']['id'];}return db[_0x2813('0x2d')]['find']({'where':{'id':_0x5690e3['params']['id']}})[_0x2813('0x26')](handleEntityNotFound(_0x35dea1,null))['then'](saveUpdates(_0x5690e3['body'],null))[_0x2813('0x26')](respondWithResult(_0x35dea1,null))[_0x2813('0x45')](handleError(_0x35dea1,null));};exports[_0x2813('0x4c')]=function(_0x4fa9cc,_0x3bc4b8){return db[_0x2813('0x2d')][_0x2813('0x49')]({'where':{'id':_0x4fa9cc[_0x2813('0x47')]['id']}})[_0x2813('0x26')](handleEntityNotFound(_0x3bc4b8,null))[_0x2813('0x26')](removeEntity(_0x3bc4b8,null))[_0x2813('0x45')](handleError(_0x3bc4b8,null));};exports[_0x2813('0x4d')]=function(_0x3b8215,_0x117a23,_0x25f6d8){var _0x7d3f79={};var _0x40c9e3={};var _0x26204b;var _0x25283c;return db[_0x2813('0x2d')]['findOne']({'where':{'id':_0x3b8215[_0x2813('0x47')]['id']}})[_0x2813('0x26')](handleEntityNotFound(_0x117a23,null))[_0x2813('0x26')](function(_0x430353){if(_0x430353){_0x26204b=_0x430353;_0x40c9e3[_0x2813('0x32')]=_['keys'](db[_0x2813('0x4e')][_0x2813('0x2e')]);_0x40c9e3['query']=_[_0x2813('0x48')](_0x3b8215[_0x2813('0x33')]);_0x40c9e3[_0x2813('0x3c')]=_['intersection'](_0x40c9e3['model'],_0x40c9e3[_0x2813('0x33')]);_0x7d3f79[_0x2813('0x34')]=_[_0x2813('0x35')](_0x40c9e3[_0x2813('0x32')],qs['fields'](_0x3b8215['query'][_0x2813('0x36')]));_0x7d3f79[_0x2813('0x34')]=_0x7d3f79[_0x2813('0x34')][_0x2813('0x37')]?_0x7d3f79[_0x2813('0x34')]:_0x40c9e3['model'];_0x7d3f79[_0x2813('0x4f')]=qs['sort'](_0x3b8215[_0x2813('0x33')][_0x2813('0x3a')]);_0x7d3f79[_0x2813('0x3b')]=qs[_0x2813('0x3c')](_[_0x2813('0x3d')](_0x3b8215[_0x2813('0x33')],_0x40c9e3[_0x2813('0x3c')]));if(_0x3b8215['query'][_0x2813('0x40')]){_0x7d3f79['where']=_[_0x2813('0x3e')](_0x7d3f79['where'],{'$or':_[_0x2813('0x2c')](_0x7d3f79[_0x2813('0x34')],function(_0x30a371){var _0x4a73c5={};_0x4a73c5[_0x30a371]={'$like':'%'+_0x3b8215[_0x2813('0x33')][_0x2813('0x40')]+'%'};return _0x4a73c5;})});}_0x7d3f79=_['merge']({},_0x7d3f79,_0x3b8215[_0x2813('0x41')]);return _0x26204b[_0x2813('0x4d')](_0x7d3f79);}})[_0x2813('0x26')](function(_0x58dfb8){if(_0x58dfb8){_0x25283c=_0x58dfb8['length'];if(!_0x3b8215['query']['hasOwnProperty']('nolimit')){_0x7d3f79[_0x2813('0x1d')]=qs[_0x2813('0x1d')](_0x3b8215[_0x2813('0x33')][_0x2813('0x1d')]);_0x7d3f79['offset']=qs[_0x2813('0x1f')](_0x3b8215[_0x2813('0x33')][_0x2813('0x1f')]);}return _0x26204b[_0x2813('0x4d')](_0x7d3f79);}})[_0x2813('0x26')](function(_0x110e51){if(_0x110e51){return _0x110e51?{'count':_0x25283c,'rows':_0x110e51}:null;}})[_0x2813('0x26')](respondWithResult(_0x117a23,null))[_0x2813('0x45')](handleError(_0x117a23,null));};exports['getSubjects']=function(_0x40f620,_0x3ecb75,_0x289a60){var _0x1de027={};var _0x8ed352={};var _0x2c61cd;var _0x2c1c0a;return db['ZendeskConfiguration'][_0x2813('0x50')]({'where':{'id':_0x40f620['params']['id']}})[_0x2813('0x26')](handleEntityNotFound(_0x3ecb75,null))['then'](function(_0x20e1e4){if(_0x20e1e4){_0x2c61cd=_0x20e1e4;_0x8ed352[_0x2813('0x32')]=_[_0x2813('0x48')](db[_0x2813('0x4e')]['rawAttributes']);_0x8ed352[_0x2813('0x33')]=_['keys'](_0x40f620['query']);_0x8ed352[_0x2813('0x3c')]=_[_0x2813('0x35')](_0x8ed352[_0x2813('0x32')],_0x8ed352[_0x2813('0x33')]);_0x1de027['attributes']=_[_0x2813('0x35')](_0x8ed352[_0x2813('0x32')],qs[_0x2813('0x36')](_0x40f620[_0x2813('0x33')]['fields']));_0x1de027[_0x2813('0x34')]=_0x1de027[_0x2813('0x34')][_0x2813('0x37')]?_0x1de027['attributes']:_0x8ed352[_0x2813('0x32')];_0x1de027[_0x2813('0x4f')]=qs[_0x2813('0x3a')](_0x40f620['query'][_0x2813('0x3a')]);_0x1de027[_0x2813('0x3b')]=qs[_0x2813('0x3c')](_['pick'](_0x40f620[_0x2813('0x33')],_0x8ed352[_0x2813('0x3c')]));if(_0x40f620[_0x2813('0x33')]['filter']){_0x1de027[_0x2813('0x3b')]=_['merge'](_0x1de027[_0x2813('0x3b')],{'$or':_[_0x2813('0x2c')](_0x1de027['attributes'],function(_0x1621c8){var _0x1cda9a={};_0x1cda9a[_0x1621c8]={'$like':'%'+_0x40f620[_0x2813('0x33')][_0x2813('0x40')]+'%'};return _0x1cda9a;})});}_0x1de027=_['merge']({},_0x1de027,_0x40f620[_0x2813('0x41')]);return _0x2c61cd[_0x2813('0x51')](_0x1de027);}})[_0x2813('0x26')](function(_0x4fe0c7){if(_0x4fe0c7){_0x2c1c0a=_0x4fe0c7[_0x2813('0x37')];if(!_0x40f620[_0x2813('0x33')][_0x2813('0x38')](_0x2813('0x39'))){_0x1de027[_0x2813('0x1d')]=qs[_0x2813('0x1d')](_0x40f620[_0x2813('0x33')][_0x2813('0x1d')]);_0x1de027[_0x2813('0x1f')]=qs['offset'](_0x40f620[_0x2813('0x33')][_0x2813('0x1f')]);}return _0x2c61cd['getSubjects'](_0x1de027);}})[_0x2813('0x26')](function(_0x41a4f4){if(_0x41a4f4){return _0x41a4f4?{'count':_0x2c1c0a,'rows':_0x41a4f4}:null;}})[_0x2813('0x26')](respondWithResult(_0x3ecb75,null))[_0x2813('0x45')](handleError(_0x3ecb75,null));};exports[_0x2813('0x52')]=function(_0x39be6a,_0x3fdc01,_0xd73dbc){var _0x1a865a={};var _0x610c58={};var _0x367565;var _0x133b82;return db['ZendeskConfiguration'][_0x2813('0x50')]({'where':{'id':_0x39be6a[_0x2813('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fdc01,null))['then'](function(_0x1e8a69){if(_0x1e8a69){_0x367565=_0x1e8a69;_0x610c58[_0x2813('0x32')]=_[_0x2813('0x48')](db[_0x2813('0x4e')][_0x2813('0x2e')]);_0x610c58[_0x2813('0x33')]=_[_0x2813('0x48')](_0x39be6a['query']);_0x610c58[_0x2813('0x3c')]=_[_0x2813('0x35')](_0x610c58[_0x2813('0x32')],_0x610c58[_0x2813('0x33')]);_0x1a865a[_0x2813('0x34')]=_[_0x2813('0x35')](_0x610c58[_0x2813('0x32')],qs[_0x2813('0x36')](_0x39be6a['query'][_0x2813('0x36')]));_0x1a865a[_0x2813('0x34')]=_0x1a865a[_0x2813('0x34')][_0x2813('0x37')]?_0x1a865a[_0x2813('0x34')]:_0x610c58[_0x2813('0x32')];_0x1a865a[_0x2813('0x4f')]=qs[_0x2813('0x3a')](_0x39be6a[_0x2813('0x33')][_0x2813('0x3a')]);_0x1a865a['where']=qs[_0x2813('0x3c')](_['pick'](_0x39be6a[_0x2813('0x33')],_0x610c58['filters']));if(_0x39be6a[_0x2813('0x33')][_0x2813('0x40')]){_0x1a865a['where']=_[_0x2813('0x3e')](_0x1a865a[_0x2813('0x3b')],{'$or':_['map'](_0x1a865a['attributes'],function(_0x2deba1){var _0x3c4acf={};_0x3c4acf[_0x2deba1]={'$like':'%'+_0x39be6a[_0x2813('0x33')][_0x2813('0x40')]+'%'};return _0x3c4acf;})});}_0x1a865a=_['merge']({},_0x1a865a,_0x39be6a[_0x2813('0x41')]);return _0x367565['getDescriptions'](_0x1a865a);}})[_0x2813('0x26')](function(_0x156bad){if(_0x156bad){_0x133b82=_0x156bad[_0x2813('0x37')];if(!_0x39be6a[_0x2813('0x33')]['hasOwnProperty']('nolimit')){_0x1a865a[_0x2813('0x1d')]=qs[_0x2813('0x1d')](_0x39be6a[_0x2813('0x33')]['limit']);_0x1a865a[_0x2813('0x1f')]=qs[_0x2813('0x1f')](_0x39be6a['query']['offset']);}return _0x367565['getDescriptions'](_0x1a865a);}})[_0x2813('0x26')](function(_0x185792){if(_0x185792){return _0x185792?{'count':_0x133b82,'rows':_0x185792}:null;}})['then'](respondWithResult(_0x3fdc01,null))[_0x2813('0x45')](handleError(_0x3fdc01,null));};exports[_0x2813('0x53')]=function(_0x5b8905,_0xe90034,_0x19895e){var _0x116322={};var _0xa8da85={};var _0x3e7ba8;var _0x3edbf7;return db[_0x2813('0x2d')][_0x2813('0x50')]({'where':{'id':_0x5b8905[_0x2813('0x47')]['id']}})['then'](handleEntityNotFound(_0xe90034,null))[_0x2813('0x26')](function(_0x26f28e){if(_0x26f28e){_0x3e7ba8=_0x26f28e;_0xa8da85[_0x2813('0x32')]=_[_0x2813('0x48')](db[_0x2813('0x54')][_0x2813('0x2e')]);_0xa8da85[_0x2813('0x33')]=_['keys'](_0x5b8905[_0x2813('0x33')]);_0xa8da85[_0x2813('0x3c')]=_[_0x2813('0x35')](_0xa8da85[_0x2813('0x32')],_0xa8da85[_0x2813('0x33')]);_0x116322[_0x2813('0x34')]=_[_0x2813('0x35')](_0xa8da85[_0x2813('0x32')],qs['fields'](_0x5b8905['query']['fields']));_0x116322[_0x2813('0x34')]=_0x116322[_0x2813('0x34')]['length']?_0x116322[_0x2813('0x34')]:_0xa8da85['model'];_0x116322[_0x2813('0x4f')]=qs[_0x2813('0x3a')](_0x5b8905[_0x2813('0x33')]['sort']);_0x116322[_0x2813('0x3b')]=qs[_0x2813('0x3c')](_[_0x2813('0x3d')](_0x5b8905[_0x2813('0x33')],_0xa8da85[_0x2813('0x3c')]));if(_0x5b8905['query'][_0x2813('0x40')]){_0x116322[_0x2813('0x3b')]=_[_0x2813('0x3e')](_0x116322[_0x2813('0x3b')],{'$or':_['map'](_0x116322[_0x2813('0x34')],function(_0x396ed6){var _0x534a61={};_0x534a61[_0x396ed6]={'$like':'%'+_0x5b8905[_0x2813('0x33')][_0x2813('0x40')]+'%'};return _0x534a61;})});}_0x116322=_[_0x2813('0x3e')]({},_0x116322,_0x5b8905[_0x2813('0x41')]);return _0x3e7ba8[_0x2813('0x53')](_0x116322);}})[_0x2813('0x26')](function(_0x2eaf6c){if(_0x2eaf6c){_0x3edbf7=_0x2eaf6c[_0x2813('0x37')];if(!_0x5b8905['query'][_0x2813('0x38')](_0x2813('0x39'))){_0x116322[_0x2813('0x1d')]=qs[_0x2813('0x1d')](_0x5b8905[_0x2813('0x33')][_0x2813('0x1d')]);_0x116322[_0x2813('0x1f')]=qs[_0x2813('0x1f')](_0x5b8905['query']['offset']);}return _0x3e7ba8[_0x2813('0x53')](_0x116322);}})[_0x2813('0x26')](function(_0x505e7a){if(_0x505e7a){return _0x505e7a?{'count':_0x3edbf7,'rows':_0x505e7a}:null;}})[_0x2813('0x26')](respondWithResult(_0xe90034,null))['catch'](handleError(_0xe90034,null));};exports[_0x2813('0x55')]=function(_0x3c41dc,_0x54f996,_0x3c6cd5){if(_0x3c41dc[_0x2813('0x4b')]['id']){delete _0x3c41dc[_0x2813('0x4b')]['id'];}return db[_0x2813('0x2d')][_0x2813('0x50')]({'where':{'id':_0x3c41dc[_0x2813('0x47')]['id']}})[_0x2813('0x26')](handleEntityNotFound(_0x54f996,null))['then'](function(_0x591904){if(_0x591904){return _0x591904[_0x2813('0x55')](_0x3c41dc[_0x2813('0x4b')][_0x2813('0x56')]||[]);}return null;})[_0x2813('0x26')](respondWithResult(_0x54f996,null))[_0x2813('0x45')](handleError(_0x54f996,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 398fdbd..4699a4a 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 _0x97c1=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x2986d8,_0xcf7b5a){var _0x53a36c=function(_0x1b4a7b){while(--_0x1b4a7b){_0x2986d8['push'](_0x2986d8['shift']());}};_0x53a36c(++_0xcf7b5a);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var logger=require('../../config/logger')(_0x197c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197c('0x3'));var fs=require('fs');var path=require(_0x197c('0x4'));var rimraf=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var attributes=require(_0x197c('0x7'));module['exports']=function(_0x5cbff6,_0x1cb6e1){return _0x5cbff6[_0x197c('0x8')](_0x197c('0x9'),attributes,{'tableName':_0x197c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4024=['define','int_zendesk_configurations','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x397ac5,_0x51014a){var _0x150040=function(_0x593043){while(--_0x593043){_0x397ac5['push'](_0x397ac5['shift']());}};_0x150040(++_0x51014a);}(_0x4024,0x89));var _0x4402=function(_0x375449,_0x165945){_0x375449=_0x375449-0x0;var _0x1889e6=_0x4024[_0x375449];return _0x1889e6;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('ZendeskConfiguration',attributes,{'tableName':_0x4402('0x8'),'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 45f5e7b..c27d32a 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 _0xd148=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xc6cfb5,_0x2f90ad){var _0x411236=function(_0x114525){while(--_0x114525){_0xc6cfb5['push'](_0xc6cfb5['shift']());}};_0x411236(++_0x2f90ad);}(_0xd148,0x163));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8d14('0x0'));var util=require(_0x8d14('0x1'));var moment=require(_0x8d14('0x2'));var BPromise=require(_0x8d14('0x3'));var rs=require(_0x8d14('0x4'));var fs=require('fs');var Redis=require(_0x8d14('0x5'));var db=require(_0x8d14('0x6'))['db'];var utils=require(_0x8d14('0x7'));var logger=require(_0x8d14('0x8'))(_0x8d14('0x9'));var config=require('../../config/environment');var jayson=require(_0x8d14('0xa'));var client=jayson[_0x8d14('0xb')][_0x8d14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x597490,_0x531510,_0x5cb80b){return new BPromise(function(_0x5825ac,_0x716934){return client[_0x8d14('0xd')](_0x597490,_0x5cb80b)[_0x8d14('0xe')](function(_0xde2483){logger[_0x8d14('0xf')](_0x8d14('0x10'),_0x531510,'request\x20sent');logger[_0x8d14('0x11')](_0x8d14('0x12'),_0x531510,_0x8d14('0x13'),JSON[_0x8d14('0x14')](_0xde2483));if(_0xde2483[_0x8d14('0x15')]){if(_0xde2483[_0x8d14('0x15')][_0x8d14('0x16')]===0x1f4){logger['error'](_0x8d14('0x10'),_0x531510,_0xde2483[_0x8d14('0x15')][_0x8d14('0x17')]);return _0x716934(_0xde2483[_0x8d14('0x15')][_0x8d14('0x17')]);}logger['error'](_0x8d14('0x10'),_0x531510,_0xde2483[_0x8d14('0x15')][_0x8d14('0x17')]);return _0x5825ac(_0xde2483[_0x8d14('0x15')][_0x8d14('0x17')]);}else{logger['info'](_0x8d14('0x10'),_0x531510,_0x8d14('0x13'));_0x5825ac(_0xde2483[_0x8d14('0x18')][_0x8d14('0x17')]);}})['catch'](function(_0x418836){logger[_0x8d14('0x15')](_0x8d14('0x10'),_0x531510,_0x418836);_0x716934(_0x418836);});});} \ No newline at end of file +var _0x2cc3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2cc3,0x84));var _0x32cc=function(_0x5bc76b,_0x354ff1){_0x5bc76b=_0x5bc76b-0x0;var _0x305e82=_0x2cc3[_0x5bc76b];return _0x305e82;};'use strict';var _=require(_0x32cc('0x0'));var util=require(_0x32cc('0x1'));var moment=require(_0x32cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32cc('0x3'));var db=require(_0x32cc('0x4'))['db'];var utils=require(_0x32cc('0x5'));var logger=require(_0x32cc('0x6'))(_0x32cc('0x7'));var config=require(_0x32cc('0x8'));var jayson=require(_0x32cc('0x9'));var client=jayson[_0x32cc('0xa')][_0x32cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x262672,_0x5cb48c,_0x5dabb2){return new BPromise(function(_0x3c8e3f,_0xe6ee58){return client['request'](_0x262672,_0x5dabb2)[_0x32cc('0xc')](function(_0x5bdb38){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5cb48c,_0x32cc('0xd'));logger[_0x32cc('0xe')](_0x32cc('0xf'),_0x5cb48c,_0x32cc('0xd'),JSON['stringify'](_0x5bdb38));if(_0x5bdb38[_0x32cc('0x10')]){if(_0x5bdb38[_0x32cc('0x10')][_0x32cc('0x11')]===0x1f4){logger[_0x32cc('0x10')](_0x32cc('0x12'),_0x5cb48c,_0x5bdb38[_0x32cc('0x10')][_0x32cc('0x13')]);return _0xe6ee58(_0x5bdb38['error']['message']);}logger[_0x32cc('0x10')](_0x32cc('0x12'),_0x5cb48c,_0x5bdb38[_0x32cc('0x10')][_0x32cc('0x13')]);return _0x3c8e3f(_0x5bdb38[_0x32cc('0x10')][_0x32cc('0x13')]);}else{logger[_0x32cc('0x14')](_0x32cc('0x12'),_0x5cb48c,'request\x20sent');_0x3c8e3f(_0x5bdb38[_0x32cc('0x15')]['message']);}})[_0x32cc('0x16')](function(_0xb19079){logger[_0x32cc('0x10')](_0x32cc('0x12'),_0x5cb48c,_0xb19079);_0xe6ee58(_0xb19079);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9b8cf0c..d5e916d 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 _0x7a66=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x35a88a,_0x35738f){var _0xbd8701=function(_0x174a77){while(--_0x174a77){_0x35a88a['push'](_0x35a88a['shift']());}};_0xbd8701(++_0x35738f);}(_0x7a66,0x1cc));var _0x67a6=function(_0x3e7b67,_0x2f6f3f){_0x3e7b67=_0x3e7b67-0x0;var _0x40de5f=_0x7a66[_0x3e7b67];return _0x40de5f;};'use strict';var multer=require(_0x67a6('0x0'));var util=require(_0x67a6('0x1'));var path=require(_0x67a6('0x2'));var timeout=require(_0x67a6('0x3'));var express=require('express');var router=express[_0x67a6('0x4')]();var fs_extra=require(_0x67a6('0x5'));var auth=require(_0x67a6('0x6'));var interaction=require(_0x67a6('0x7'));var config=require(_0x67a6('0x8'));var controller=require(_0x67a6('0x9'));router[_0x67a6('0xa')]('/',auth['isAuthenticated'](),controller[_0x67a6('0xb')]);router[_0x67a6('0xa')](_0x67a6('0xc'),auth[_0x67a6('0xd')](),controller[_0x67a6('0xe')]);router[_0x67a6('0xf')]('/',auth[_0x67a6('0xd')](),controller[_0x67a6('0x10')]);router[_0x67a6('0x11')](_0x67a6('0xc'),auth[_0x67a6('0xd')](),controller[_0x67a6('0x12')]);router[_0x67a6('0x13')](_0x67a6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x67a6('0x14')]=router; \ No newline at end of file +var _0xc34f=['express','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0xc34f,0x86));var _0xfc34=function(_0x366071,_0x4c4256){_0x366071=_0x366071-0x0;var _0x5dfb89=_0xc34f[_0x366071];return _0x5dfb89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc34('0x0'));var timeout=require(_0xfc34('0x1'));var express=require(_0xfc34('0x2'));var router=express[_0xfc34('0x3')]();var fs_extra=require(_0xfc34('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfc34('0x5'));var config=require('../../config/environment');var controller=require(_0xfc34('0x6'));router[_0xfc34('0x7')]('/',auth[_0xfc34('0x8')](),controller[_0xfc34('0x9')]);router[_0xfc34('0x7')](_0xfc34('0xa'),auth[_0xfc34('0x8')](),controller[_0xfc34('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc34('0xc')]);router[_0xfc34('0xd')](_0xfc34('0xa'),auth[_0xfc34('0x8')](),controller[_0xfc34('0xe')]);router[_0xfc34('0xf')](_0xfc34('0xa'),auth['isAuthenticated'](),controller[_0xfc34('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5219220..9b7c1e9 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 _0xed32=['STRING','ENUM','variable','customVariable','BOOLEAN','exports','string','picklist'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0xed32,0x13d));var _0x2ed3=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xed32[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module[_0x2ed3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2ed3('0x1'),'variable','customVariable','keyValue',_0x2ed3('0x2')),'defaultValue':_0x2ed3('0x1')},'content':{'type':Sequelize[_0x2ed3('0x3')]},'key':{'type':Sequelize[_0x2ed3('0x3')]},'keyType':{'type':Sequelize[_0x2ed3('0x4')](_0x2ed3('0x1'),_0x2ed3('0x5'),_0x2ed3('0x6'))},'keyContent':{'type':Sequelize[_0x2ed3('0x3')]},'idField':{'type':Sequelize[_0x2ed3('0x3')]},'nameField':{'type':Sequelize[_0x2ed3('0x3')]},'customField':{'type':Sequelize[_0x2ed3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ed3('0x3')]}}; \ No newline at end of file +var _0xf940=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x32504a,_0x475539){var _0x536848=function(_0x5d3040){while(--_0x5d3040){_0x32504a['push'](_0x32504a['shift']());}};_0x536848(++_0x475539);}(_0xf940,0xb0));var _0x0f94=function(_0x12ef9a,_0x5dfbf7){_0x12ef9a=_0x12ef9a-0x0;var _0x3a6833=_0xf940[_0x12ef9a];return _0x3a6833;};'use strict';var Sequelize=require(_0x0f94('0x0'));module[_0x0f94('0x1')]={'type':{'type':Sequelize[_0x0f94('0x2')]('string',_0x0f94('0x3'),'customVariable',_0x0f94('0x4'),_0x0f94('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0f94('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x0f94('0x3'),_0x0f94('0x7'))},'keyContent':{'type':Sequelize[_0x0f94('0x6')]},'idField':{'type':Sequelize[_0x0f94('0x6')]},'nameField':{'type':Sequelize[_0x0f94('0x6')]},'customField':{'type':Sequelize[_0x0f94('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f94('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b4b70ac..6ba4830 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 _0xad9c=['order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','ZendeskField','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit'];(function(_0x41f3f9,_0x349ea2){var _0x57149f=function(_0x33e218){while(--_0x33e218){_0x41f3f9['push'](_0x41f3f9['shift']());}};_0x57149f(++_0x349ea2);}(_0xad9c,0x143));var _0xcad9=function(_0x337780,_0x55b7d9){_0x337780=_0x337780-0x0;var _0x19bc31=_0xad9c[_0x337780];return _0x19bc31;};'use strict';var emlformat=require(_0xcad9('0x0'));var rimraf=require(_0xcad9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcad9('0x2'));var moment=require('moment');var BPromise=require(_0xcad9('0x3'));var Mustache=require(_0xcad9('0x4'));var util=require(_0xcad9('0x5'));var path=require(_0xcad9('0x6'));var sox=require(_0xcad9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcad9('0x8'));var _=require(_0xcad9('0x9'));var squel=require(_0xcad9('0xa'));var crypto=require(_0xcad9('0xb'));var jsforce=require(_0xcad9('0xc'));var deskjs=require(_0xcad9('0xd'));var toCsv=require(_0xcad9('0xe'));var querystring=require(_0xcad9('0xf'));var Papa=require(_0xcad9('0x10'));var Redis=require(_0xcad9('0x11'));var authService=require(_0xcad9('0x12'));var qs=require(_0xcad9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcad9('0x14'));var logger=require(_0xcad9('0x15'))(_0xcad9('0x16'));var utils=require(_0xcad9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcad9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7e27,_0x167fd8){_0x167fd8=_0x167fd8||0xcc;return function(_0x30cb9a){if(_0x30cb9a){return _0x5e7e27[_0xcad9('0x19')](_0x167fd8);}return _0x5e7e27[_0xcad9('0x1a')](_0x167fd8)[_0xcad9('0x1b')]();};}function respondWithResult(_0x3cd999,_0x4863ba){_0x4863ba=_0x4863ba||0xc8;return function(_0x2b1094){if(_0x2b1094){return _0x3cd999[_0xcad9('0x1a')](_0x4863ba)[_0xcad9('0x1c')](_0x2b1094);}};}function respondWithFilteredResult(_0x509168,_0xfc53b8){return function(_0x446c2d){if(_0x446c2d){var _0x6f0ada=typeof _0xfc53b8[_0xcad9('0x1d')]==='undefined'&&typeof _0xfc53b8[_0xcad9('0x1e')]==='undefined';var _0x52899e=_0x446c2d[_0xcad9('0x1f')];var _0x30e48d=_0x6f0ada?0x0:_0xfc53b8['offset'];var _0x1a4a62=_0x6f0ada?_0x446c2d[_0xcad9('0x1f')]:_0xfc53b8[_0xcad9('0x1d')]+_0xfc53b8['limit'];var _0x133a65;if(_0x1a4a62>=_0x52899e){_0x1a4a62=_0x52899e;_0x133a65=0xc8;}else{_0x133a65=0xce;}_0x509168[_0xcad9('0x1a')](_0x133a65);return _0x509168[_0xcad9('0x20')](_0xcad9('0x21'),_0x30e48d+'-'+_0x1a4a62+'/'+_0x52899e)['json'](_0x446c2d);}return null;};}function patchUpdates(_0x43866f){return function(_0x75e49d){try{jsonpatch[_0xcad9('0x22')](_0x75e49d,_0x43866f,!![]);}catch(_0x20a87c){return BPromise[_0xcad9('0x23')](_0x20a87c);}return _0x75e49d['save']();};}function saveUpdates(_0x3bd8d1,_0x53afe4){return function(_0x4246b6){if(_0x4246b6){return _0x4246b6[_0xcad9('0x24')](_0x3bd8d1)[_0xcad9('0x25')](function(_0x52555c){return _0x52555c;});}return null;};}function removeEntity(_0x22bf3f,_0x3ab390){return function(_0x15f1dd){if(_0x15f1dd){return _0x15f1dd['destroy']()[_0xcad9('0x25')](function(){_0x22bf3f[_0xcad9('0x1a')](0xcc)[_0xcad9('0x1b')]();});}};}function handleEntityNotFound(_0x4e45de,_0x2d1774){return function(_0x2d9c36){if(!_0x2d9c36){_0x4e45de[_0xcad9('0x19')](0x194);}return _0x2d9c36;};}function handleError(_0x332534,_0x5284b4){_0x5284b4=_0x5284b4||0x1f4;return function(_0x3db40a){logger[_0xcad9('0x26')](_0x3db40a[_0xcad9('0x27')]);if(_0x3db40a['name']){delete _0x3db40a[_0xcad9('0x28')];}_0x332534['status'](_0x5284b4)[_0xcad9('0x29')](_0x3db40a);};}exports[_0xcad9('0x2a')]=function(_0x6fb579,_0x4bb534){var _0x431b9c={},_0x2ba038={},_0x467795={'count':0x0,'rows':[]};var _0x51fd36=_['map'](db[_0xcad9('0x2b')][_0xcad9('0x2c')],function(_0x2e23bb){return{'name':_0x2e23bb['fieldName'],'type':_0x2e23bb[_0xcad9('0x2d')][_0xcad9('0x2e')]};});_0x2ba038[_0xcad9('0x2f')]=_[_0xcad9('0x30')](_0x51fd36,_0xcad9('0x28'));_0x2ba038['query']=_[_0xcad9('0x31')](_0x6fb579['query']);_0x2ba038[_0xcad9('0x32')]=_[_0xcad9('0x33')](_0x2ba038['model'],_0x2ba038[_0xcad9('0x34')]);_0x431b9c[_0xcad9('0x35')]=_[_0xcad9('0x33')](_0x2ba038[_0xcad9('0x2f')],qs[_0xcad9('0x36')](_0x6fb579[_0xcad9('0x34')][_0xcad9('0x36')]));_0x431b9c[_0xcad9('0x35')]=_0x431b9c['attributes']['length']?_0x431b9c[_0xcad9('0x35')]:_0x2ba038[_0xcad9('0x2f')];if(!_0x6fb579[_0xcad9('0x34')][_0xcad9('0x37')](_0xcad9('0x38'))){_0x431b9c[_0xcad9('0x1e')]=qs[_0xcad9('0x1e')](_0x6fb579['query'][_0xcad9('0x1e')]);_0x431b9c[_0xcad9('0x1d')]=qs[_0xcad9('0x1d')](_0x6fb579['query'][_0xcad9('0x1d')]);}_0x431b9c[_0xcad9('0x39')]=qs[_0xcad9('0x3a')](_0x6fb579[_0xcad9('0x34')][_0xcad9('0x3a')]);_0x431b9c[_0xcad9('0x3b')]=qs[_0xcad9('0x32')](_[_0xcad9('0x3c')](_0x6fb579[_0xcad9('0x34')],_0x2ba038['filters']),_0x51fd36);if(_0x6fb579['query'][_0xcad9('0x3d')]){_0x431b9c[_0xcad9('0x3b')]=_[_0xcad9('0x3e')](_0x431b9c[_0xcad9('0x3b')],{'$or':_[_0xcad9('0x30')](_0x51fd36,function(_0x535987){if(_0x535987[_0xcad9('0x2d')]!==_0xcad9('0x3f')){var _0x332c11={};_0x332c11[_0x535987[_0xcad9('0x28')]]={'$like':'%'+_0x6fb579[_0xcad9('0x34')][_0xcad9('0x3d')]+'%'};return _0x332c11;}})});}_0x431b9c=_[_0xcad9('0x3e')]({},_0x431b9c,_0x6fb579['options']);var _0x216951={'where':_0x431b9c[_0xcad9('0x3b')]};return db[_0xcad9('0x2b')][_0xcad9('0x1f')](_0x216951)['then'](function(_0x329555){_0x467795[_0xcad9('0x1f')]=_0x329555;if(_0x6fb579[_0xcad9('0x34')]['includeAll']){_0x431b9c[_0xcad9('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0xcad9('0x41')](_0x431b9c);})[_0xcad9('0x25')](function(_0x1a3189){_0x467795[_0xcad9('0x42')]=_0x1a3189;return _0x467795;})['then'](respondWithFilteredResult(_0x4bb534,_0x431b9c))[_0xcad9('0x43')](handleError(_0x4bb534,null));};exports[_0xcad9('0x44')]=function(_0x224e9d,_0x2360c6){var _0x17cdf7={'raw':!![],'where':{'id':_0x224e9d['params']['id']}},_0x2565e8={};_0x2565e8[_0xcad9('0x2f')]=_['keys'](db[_0xcad9('0x2b')][_0xcad9('0x2c')]);_0x2565e8['query']=_[_0xcad9('0x31')](_0x224e9d['query']);_0x2565e8['filters']=_['intersection'](_0x2565e8[_0xcad9('0x2f')],_0x2565e8[_0xcad9('0x34')]);_0x17cdf7[_0xcad9('0x35')]=_[_0xcad9('0x33')](_0x2565e8['model'],qs[_0xcad9('0x36')](_0x224e9d['query'][_0xcad9('0x36')]));_0x17cdf7[_0xcad9('0x35')]=_0x17cdf7['attributes'][_0xcad9('0x45')]?_0x17cdf7[_0xcad9('0x35')]:_0x2565e8[_0xcad9('0x2f')];if(_0x224e9d[_0xcad9('0x34')][_0xcad9('0x46')]){_0x17cdf7[_0xcad9('0x40')]=[{'all':!![]}];}_0x17cdf7=_[_0xcad9('0x3e')]({},_0x17cdf7,_0x224e9d[_0xcad9('0x47')]);return db[_0xcad9('0x2b')][_0xcad9('0x48')](_0x17cdf7)[_0xcad9('0x25')](handleEntityNotFound(_0x2360c6,null))[_0xcad9('0x25')](respondWithResult(_0x2360c6,null))[_0xcad9('0x43')](handleError(_0x2360c6,null));};exports[_0xcad9('0x49')]=function(_0x1ca244,_0x4b8462){return db[_0xcad9('0x2b')][_0xcad9('0x49')](_0x1ca244[_0xcad9('0x4a')],{})[_0xcad9('0x25')](respondWithResult(_0x4b8462,0xc9))[_0xcad9('0x43')](handleError(_0x4b8462,null));};exports[_0xcad9('0x24')]=function(_0x512c0c,_0x440a9f){if(_0x512c0c[_0xcad9('0x4a')]['id']){delete _0x512c0c[_0xcad9('0x4a')]['id'];}return db[_0xcad9('0x2b')]['find']({'where':{'id':_0x512c0c[_0xcad9('0x4b')]['id']}})[_0xcad9('0x25')](handleEntityNotFound(_0x440a9f,null))[_0xcad9('0x25')](saveUpdates(_0x512c0c[_0xcad9('0x4a')],null))[_0xcad9('0x25')](respondWithResult(_0x440a9f,null))[_0xcad9('0x43')](handleError(_0x440a9f,null));};exports['destroy']=function(_0x3eb853,_0x43b9a1){return db['ZendeskField']['find']({'where':{'id':_0x3eb853[_0xcad9('0x4b')]['id']}})[_0xcad9('0x25')](handleEntityNotFound(_0x43b9a1,null))[_0xcad9('0x25')](removeEntity(_0x43b9a1,null))['catch'](handleError(_0x43b9a1,null));}; \ No newline at end of file +var _0x2720=['attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection'];(function(_0x5b564d,_0x533fa7){var _0x37cac6=function(_0x5e12a0){while(--_0x5e12a0){_0x5b564d['push'](_0x5b564d['shift']());}};_0x37cac6(++_0x533fa7);}(_0x2720,0x13a));var _0x0272=function(_0x3e006f,_0x13d8a1){_0x3e006f=_0x3e006f-0x0;var _0x96b90e=_0x2720[_0x3e006f];return _0x96b90e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0272('0x0'));var zipdir=require(_0x0272('0x1'));var jsonpatch=require(_0x0272('0x2'));var rp=require(_0x0272('0x3'));var moment=require('moment');var BPromise=require(_0x0272('0x4'));var Mustache=require(_0x0272('0x5'));var util=require('util');var path=require(_0x0272('0x6'));var sox=require(_0x0272('0x7'));var csv=require(_0x0272('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0272('0x9'));var _=require(_0x0272('0xa'));var squel=require(_0x0272('0xb'));var crypto=require(_0x0272('0xc'));var jsforce=require(_0x0272('0xd'));var deskjs=require(_0x0272('0xe'));var toCsv=require(_0x0272('0x8'));var querystring=require(_0x0272('0xf'));var Papa=require(_0x0272('0x10'));var Redis=require('ioredis');var authService=require(_0x0272('0x11'));var qs=require(_0x0272('0x12'));var as=require(_0x0272('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0272('0x14'))(_0x0272('0x15'));var utils=require(_0x0272('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0272('0x17'));var db=require(_0x0272('0x18'))['db'];function respondWithStatusCode(_0x37c6f4,_0x248f55){_0x248f55=_0x248f55||0xcc;return function(_0x778baf){if(_0x778baf){return _0x37c6f4[_0x0272('0x19')](_0x248f55);}return _0x37c6f4[_0x0272('0x1a')](_0x248f55)[_0x0272('0x1b')]();};}function respondWithResult(_0x571cff,_0x16004f){_0x16004f=_0x16004f||0xc8;return function(_0xc0f7a7){if(_0xc0f7a7){return _0x571cff[_0x0272('0x1a')](_0x16004f)['json'](_0xc0f7a7);}};}function respondWithFilteredResult(_0x47434b,_0x4e5713){return function(_0x32b95e){if(_0x32b95e){var _0x489742=typeof _0x4e5713[_0x0272('0x1c')]==='undefined'&&typeof _0x4e5713['limit']===_0x0272('0x1d');var _0xade6e6=_0x32b95e[_0x0272('0x1e')];var _0x129bcc=_0x489742?0x0:_0x4e5713['offset'];var _0x2712c1=_0x489742?_0x32b95e[_0x0272('0x1e')]:_0x4e5713[_0x0272('0x1c')]+_0x4e5713[_0x0272('0x1f')];var _0x3a1bac;if(_0x2712c1>=_0xade6e6){_0x2712c1=_0xade6e6;_0x3a1bac=0xc8;}else{_0x3a1bac=0xce;}_0x47434b[_0x0272('0x1a')](_0x3a1bac);return _0x47434b[_0x0272('0x20')](_0x0272('0x21'),_0x129bcc+'-'+_0x2712c1+'/'+_0xade6e6)[_0x0272('0x22')](_0x32b95e);}return null;};}function patchUpdates(_0x3f8d41){return function(_0x45afe9){try{jsonpatch[_0x0272('0x23')](_0x45afe9,_0x3f8d41,!![]);}catch(_0x279aec){return BPromise[_0x0272('0x24')](_0x279aec);}return _0x45afe9['save']();};}function saveUpdates(_0x4ea9e3,_0x1a92a7){return function(_0x4712a6){if(_0x4712a6){return _0x4712a6[_0x0272('0x25')](_0x4ea9e3)['then'](function(_0x4a4b7f){return _0x4a4b7f;});}return null;};}function removeEntity(_0x51892a,_0x1f6a7e){return function(_0x4318a4){if(_0x4318a4){return _0x4318a4['destroy']()[_0x0272('0x26')](function(){_0x51892a[_0x0272('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ec3c,_0xb0b75d){return function(_0x4bd3){if(!_0x4bd3){_0x32ec3c[_0x0272('0x19')](0x194);}return _0x4bd3;};}function handleError(_0xb31fb8,_0x25631a){_0x25631a=_0x25631a||0x1f4;return function(_0xae83ad){logger[_0x0272('0x27')](_0xae83ad['stack']);if(_0xae83ad['name']){delete _0xae83ad[_0x0272('0x28')];}_0xb31fb8[_0x0272('0x1a')](_0x25631a)['send'](_0xae83ad);};}exports[_0x0272('0x29')]=function(_0x466fdf,_0xee3c5f){var _0x5aae9c={},_0x1ee603={},_0x1876dd={'count':0x0,'rows':[]};var _0x31720f=_[_0x0272('0x2a')](db[_0x0272('0x2b')][_0x0272('0x2c')],function(_0x262ebc){return{'name':_0x262ebc[_0x0272('0x2d')],'type':_0x262ebc[_0x0272('0x2e')][_0x0272('0x2f')]};});_0x1ee603[_0x0272('0x30')]=_[_0x0272('0x2a')](_0x31720f,_0x0272('0x28'));_0x1ee603[_0x0272('0x31')]=_['keys'](_0x466fdf['query']);_0x1ee603['filters']=_[_0x0272('0x32')](_0x1ee603[_0x0272('0x30')],_0x1ee603[_0x0272('0x31')]);_0x5aae9c[_0x0272('0x33')]=_[_0x0272('0x32')](_0x1ee603[_0x0272('0x30')],qs['fields'](_0x466fdf[_0x0272('0x31')][_0x0272('0x34')]));_0x5aae9c[_0x0272('0x33')]=_0x5aae9c['attributes'][_0x0272('0x35')]?_0x5aae9c[_0x0272('0x33')]:_0x1ee603[_0x0272('0x30')];if(!_0x466fdf['query']['hasOwnProperty']('nolimit')){_0x5aae9c[_0x0272('0x1f')]=qs[_0x0272('0x1f')](_0x466fdf[_0x0272('0x31')][_0x0272('0x1f')]);_0x5aae9c['offset']=qs[_0x0272('0x1c')](_0x466fdf[_0x0272('0x31')][_0x0272('0x1c')]);}_0x5aae9c[_0x0272('0x36')]=qs[_0x0272('0x37')](_0x466fdf[_0x0272('0x31')][_0x0272('0x37')]);_0x5aae9c[_0x0272('0x38')]=qs[_0x0272('0x39')](_[_0x0272('0x3a')](_0x466fdf[_0x0272('0x31')],_0x1ee603[_0x0272('0x39')]),_0x31720f);if(_0x466fdf[_0x0272('0x31')][_0x0272('0x3b')]){_0x5aae9c[_0x0272('0x38')]=_[_0x0272('0x3c')](_0x5aae9c[_0x0272('0x38')],{'$or':_[_0x0272('0x2a')](_0x31720f,function(_0x352619){if(_0x352619[_0x0272('0x2e')]!=='VIRTUAL'){var _0x25703d={};_0x25703d[_0x352619['name']]={'$like':'%'+_0x466fdf[_0x0272('0x31')]['filter']+'%'};return _0x25703d;}})});}_0x5aae9c=_[_0x0272('0x3c')]({},_0x5aae9c,_0x466fdf[_0x0272('0x3d')]);var _0x22fca1={'where':_0x5aae9c[_0x0272('0x38')]};return db[_0x0272('0x2b')]['count'](_0x22fca1)[_0x0272('0x26')](function(_0x554fb4){_0x1876dd[_0x0272('0x1e')]=_0x554fb4;if(_0x466fdf['query'][_0x0272('0x3e')]){_0x5aae9c[_0x0272('0x3f')]=[{'all':!![]}];}return db[_0x0272('0x2b')][_0x0272('0x40')](_0x5aae9c);})[_0x0272('0x26')](function(_0x52b270){_0x1876dd[_0x0272('0x41')]=_0x52b270;return _0x1876dd;})[_0x0272('0x26')](respondWithFilteredResult(_0xee3c5f,_0x5aae9c))[_0x0272('0x42')](handleError(_0xee3c5f,null));};exports['show']=function(_0x462388,_0x1a7163){var _0x3d3231={'raw':!![],'where':{'id':_0x462388['params']['id']}},_0x4ca89f={};_0x4ca89f['model']=_[_0x0272('0x43')](db[_0x0272('0x2b')][_0x0272('0x2c')]);_0x4ca89f[_0x0272('0x31')]=_['keys'](_0x462388[_0x0272('0x31')]);_0x4ca89f['filters']=_[_0x0272('0x32')](_0x4ca89f['model'],_0x4ca89f[_0x0272('0x31')]);_0x3d3231[_0x0272('0x33')]=_[_0x0272('0x32')](_0x4ca89f[_0x0272('0x30')],qs[_0x0272('0x34')](_0x462388[_0x0272('0x31')][_0x0272('0x34')]));_0x3d3231[_0x0272('0x33')]=_0x3d3231[_0x0272('0x33')][_0x0272('0x35')]?_0x3d3231[_0x0272('0x33')]:_0x4ca89f[_0x0272('0x30')];if(_0x462388[_0x0272('0x31')][_0x0272('0x3e')]){_0x3d3231[_0x0272('0x3f')]=[{'all':!![]}];}_0x3d3231=_[_0x0272('0x3c')]({},_0x3d3231,_0x462388[_0x0272('0x3d')]);return db[_0x0272('0x2b')][_0x0272('0x44')](_0x3d3231)[_0x0272('0x26')](handleEntityNotFound(_0x1a7163,null))['then'](respondWithResult(_0x1a7163,null))[_0x0272('0x42')](handleError(_0x1a7163,null));};exports[_0x0272('0x45')]=function(_0x4258d0,_0x5d2cba){return db[_0x0272('0x2b')]['create'](_0x4258d0[_0x0272('0x46')],{})[_0x0272('0x26')](respondWithResult(_0x5d2cba,0xc9))[_0x0272('0x42')](handleError(_0x5d2cba,null));};exports[_0x0272('0x25')]=function(_0x5db2eb,_0x52ce88){if(_0x5db2eb[_0x0272('0x46')]['id']){delete _0x5db2eb[_0x0272('0x46')]['id'];}return db['ZendeskField'][_0x0272('0x44')]({'where':{'id':_0x5db2eb['params']['id']}})['then'](handleEntityNotFound(_0x52ce88,null))['then'](saveUpdates(_0x5db2eb[_0x0272('0x46')],null))[_0x0272('0x26')](respondWithResult(_0x52ce88,null))[_0x0272('0x42')](handleError(_0x52ce88,null));};exports[_0x0272('0x47')]=function(_0x5a71a9,_0x310a8f){return db[_0x0272('0x2b')][_0x0272('0x44')]({'where':{'id':_0x5a71a9[_0x0272('0x48')]['id']}})['then'](handleEntityNotFound(_0x310a8f,null))[_0x0272('0x26')](removeEntity(_0x310a8f,null))[_0x0272('0x42')](handleError(_0x310a8f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d02a4b9..f635a09 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 _0x4a98=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a98,0x89));var _0x84a9=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x4a98[_0x33155c];return _0x5becf7;};'use strict';var _=require(_0x84a9('0x0'));var util=require(_0x84a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x84a9('0x2'));var BPromise=require(_0x84a9('0x3'));var rp=require(_0x84a9('0x4'));var fs=require('fs');var path=require(_0x84a9('0x5'));var rimraf=require(_0x84a9('0x6'));var config=require(_0x84a9('0x7'));var attributes=require(_0x84a9('0x8'));module[_0x84a9('0x9')]=function(_0x2d1abe,_0x157eb7){return _0x2d1abe[_0x84a9('0xa')]('ZendeskField',attributes,{'tableName':_0x84a9('0xb'),'paranoid':![],'indexes':[{'name':_0x84a9('0xc'),'fields':[_0x84a9('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30fe=['zendesk_unique_index','idField','api','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x372733,_0x17996d){var _0x1a41ea=function(_0x37ec53){while(--_0x37ec53){_0x372733['push'](_0x372733['shift']());}};_0x1a41ea(++_0x17996d);}(_0x30fe,0x176));var _0xe30f=function(_0x29f8f2,_0x2ca0b2){_0x29f8f2=_0x29f8f2-0x0;var _0x120a3d=_0x30fe[_0x29f8f2];return _0x120a3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe30f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe30f('0x1'));var fs=require('fs');var path=require(_0xe30f('0x2'));var rimraf=require(_0xe30f('0x3'));var config=require(_0xe30f('0x4'));var attributes=require(_0xe30f('0x5'));module[_0xe30f('0x6')]=function(_0x58d89b,_0xfa893d){return _0x58d89b[_0xe30f('0x7')](_0xe30f('0x8'),attributes,{'tableName':_0xe30f('0x9'),'paranoid':![],'indexes':[{'name':_0xe30f('0xa'),'fields':[_0xe30f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5e1542b..1507e5f 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 _0xa9d7=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0xb9311,_0x5ab0fd){var _0x1daeab=function(_0x4addbe){while(--_0x4addbe){_0xb9311['push'](_0xb9311['shift']());}};_0x1daeab(++_0x5ab0fd);}(_0xa9d7,0x170));var _0x7a9d=function(_0x312aad,_0x495b70){_0x312aad=_0x312aad-0x0;var _0x99c6cf=_0xa9d7[_0x312aad];return _0x99c6cf;};'use strict';var _=require(_0x7a9d('0x0'));var util=require(_0x7a9d('0x1'));var moment=require(_0x7a9d('0x2'));var BPromise=require(_0x7a9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a9d('0x4'));var db=require(_0x7a9d('0x5'))['db'];var utils=require(_0x7a9d('0x6'));var logger=require(_0x7a9d('0x7'))(_0x7a9d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c26d4,_0x4caa5c,_0x585207){return new BPromise(function(_0x550ffa,_0xdce8b0){return client[_0x7a9d('0xa')](_0x2c26d4,_0x585207)[_0x7a9d('0xb')](function(_0x46b73f){logger[_0x7a9d('0xc')](_0x7a9d('0xd'),_0x4caa5c,_0x7a9d('0xe'));logger[_0x7a9d('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4caa5c,'request\x20sent',JSON[_0x7a9d('0x10')](_0x46b73f));if(_0x46b73f[_0x7a9d('0x11')]){if(_0x46b73f[_0x7a9d('0x11')]['code']===0x1f4){logger['error'](_0x7a9d('0xd'),_0x4caa5c,_0x46b73f[_0x7a9d('0x11')]['message']);return _0xdce8b0(_0x46b73f['error'][_0x7a9d('0x12')]);}logger[_0x7a9d('0x11')](_0x7a9d('0xd'),_0x4caa5c,_0x46b73f[_0x7a9d('0x11')]['message']);return _0x550ffa(_0x46b73f[_0x7a9d('0x11')]['message']);}else{logger[_0x7a9d('0xc')](_0x7a9d('0xd'),_0x4caa5c,_0x7a9d('0xe'));_0x550ffa(_0x46b73f[_0x7a9d('0x13')][_0x7a9d('0x12')]);}})[_0x7a9d('0x14')](function(_0x434d2b){logger[_0x7a9d('0x11')](_0x7a9d('0xd'),_0x4caa5c,_0x434d2b);_0xdce8b0(_0x434d2b);});});} \ No newline at end of file +var _0xf329=['ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x2997da,_0x35e1a6){var _0x43f745=function(_0x48b056){while(--_0x48b056){_0x2997da['push'](_0x2997da['shift']());}};_0x43f745(++_0x35e1a6);}(_0xf329,0x1be));var _0x9f32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf329[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f32('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f32('0x1'));var fs=require('fs');var Redis=require(_0x9f32('0x2'));var db=require(_0x9f32('0x3'))['db'];var utils=require(_0x9f32('0x4'));var logger=require(_0x9f32('0x5'))(_0x9f32('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f32('0x7')][_0x9f32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52d835,_0x16f22d,_0x59508e){return new BPromise(function(_0x5baf41,_0x43b9eb){return client[_0x9f32('0x9')](_0x52d835,_0x59508e)[_0x9f32('0xa')](function(_0x44d142){logger[_0x9f32('0xb')](_0x9f32('0xc'),_0x16f22d,_0x9f32('0xd'));logger['debug'](_0x9f32('0xe'),_0x16f22d,_0x9f32('0xd'),JSON['stringify'](_0x44d142));if(_0x44d142[_0x9f32('0xf')]){if(_0x44d142['error'][_0x9f32('0x10')]===0x1f4){logger[_0x9f32('0xf')]('ZendeskField,\x20%s,\x20%s',_0x16f22d,_0x44d142[_0x9f32('0xf')][_0x9f32('0x11')]);return _0x43b9eb(_0x44d142['error'][_0x9f32('0x11')]);}logger[_0x9f32('0xf')]('ZendeskField,\x20%s,\x20%s',_0x16f22d,_0x44d142[_0x9f32('0xf')][_0x9f32('0x11')]);return _0x5baf41(_0x44d142[_0x9f32('0xf')][_0x9f32('0x11')]);}else{logger[_0x9f32('0xb')](_0x9f32('0xc'),_0x16f22d,_0x9f32('0xd'));_0x5baf41(_0x44d142[_0x9f32('0x12')][_0x9f32('0x11')]);}})[_0x9f32('0x13')](function(_0x50eff5){logger[_0x9f32('0xf')]('ZendeskField,\x20%s,\x20%s',_0x16f22d,_0x50eff5);_0x43b9eb(_0x50eff5);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3f82089..29d3cbb 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 _0xc2e1=['addConfiguration','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2e1,0x1f3));var _0x1c2e=function(_0x466c49,_0x40a20e){_0x466c49=_0x466c49-0x0;var _0x152618=_0xc2e1[_0x466c49];return _0x152618;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c2e('0x0'));var timeout=require(_0x1c2e('0x1'));var express=require('express');var router=express[_0x1c2e('0x2')]();var fs_extra=require(_0x1c2e('0x3'));var auth=require(_0x1c2e('0x4'));var interaction=require(_0x1c2e('0x5'));var config=require(_0x1c2e('0x6'));var controller=require('./intZohoAccount.controller');router[_0x1c2e('0x7')]('/',auth[_0x1c2e('0x8')](),controller['index']);router[_0x1c2e('0x7')](_0x1c2e('0x9'),auth[_0x1c2e('0x8')](),controller['show']);router[_0x1c2e('0x7')](_0x1c2e('0xa'),auth[_0x1c2e('0x8')](),controller['getConfigurations']);router[_0x1c2e('0x7')](_0x1c2e('0xb'),auth[_0x1c2e('0x8')](),controller[_0x1c2e('0xc')]);router['post']('/',auth[_0x1c2e('0x8')](),controller[_0x1c2e('0xd')]);router['post'](_0x1c2e('0xa'),auth[_0x1c2e('0x8')](),controller[_0x1c2e('0xe')]);router[_0x1c2e('0xf')](_0x1c2e('0x9'),auth['isAuthenticated'](),controller[_0x1c2e('0x10')]);router['delete'](_0x1c2e('0x9'),auth[_0x1c2e('0x8')](),controller[_0x1c2e('0x11')]);module[_0x1c2e('0x12')]=router; \ No newline at end of file +var _0xcdf0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','/:id','multer','util','connect-timeout'];(function(_0x306b28,_0x20dba5){var _0xdbd43f=function(_0xfa250f){while(--_0xfa250f){_0x306b28['push'](_0x306b28['shift']());}};_0xdbd43f(++_0x20dba5);}(_0xcdf0,0x105));var _0x0cdf=function(_0x1ccdb5,_0x34bc4a){_0x1ccdb5=_0x1ccdb5-0x0;var _0xdf2142=_0xcdf0[_0x1ccdb5];return _0xdf2142;};'use strict';var multer=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var path=require('path');var timeout=require(_0x0cdf('0x2'));var express=require(_0x0cdf('0x3'));var router=express[_0x0cdf('0x4')]();var fs_extra=require(_0x0cdf('0x5'));var auth=require(_0x0cdf('0x6'));var interaction=require(_0x0cdf('0x7'));var config=require(_0x0cdf('0x8'));var controller=require(_0x0cdf('0x9'));router[_0x0cdf('0xa')]('/',auth[_0x0cdf('0xb')](),controller[_0x0cdf('0xc')]);router[_0x0cdf('0xa')]('/:id',auth[_0x0cdf('0xb')](),controller[_0x0cdf('0xd')]);router[_0x0cdf('0xa')](_0x0cdf('0xe'),auth[_0x0cdf('0xb')](),controller[_0x0cdf('0xf')]);router[_0x0cdf('0xa')](_0x0cdf('0x10'),auth[_0x0cdf('0xb')](),controller[_0x0cdf('0x11')]);router[_0x0cdf('0x12')]('/',auth[_0x0cdf('0xb')](),controller[_0x0cdf('0x13')]);router['post'](_0x0cdf('0xe'),auth[_0x0cdf('0xb')](),controller[_0x0cdf('0x14')]);router[_0x0cdf('0x15')]('/:id',auth[_0x0cdf('0xb')](),controller['update']);router[_0x0cdf('0x16')](_0x0cdf('0x17'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3c15639..95fa3dc 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 _0x55e0=['STRING','sequelize','exports'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x55e0,0xdc));var _0x055e=function(_0x46cb4d,_0x1b4f68){_0x46cb4d=_0x46cb4d-0x0;var _0x3acf6d=_0x55e0[_0x46cb4d];return _0x3acf6d;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'name':{'type':Sequelize[_0x055e('0x2')]},'description':{'type':Sequelize[_0x055e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x055e('0x2')]},'clientSecret':{'type':Sequelize[_0x055e('0x2')]},'serverUrl':{'type':Sequelize[_0x055e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x055e('0x2')]},'refreshToken':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x1f1bbc,_0x40ca9b){var _0x3f9d0d=function(_0x33f1a8){while(--_0x33f1a8){_0x1f1bbc['push'](_0x1f1bbc['shift']());}};_0x3f9d0d(++_0x40ca9b);}(_0x34e8,0x12c));var _0x834e=function(_0x21f22a,_0x2b9ccd){_0x21f22a=_0x21f22a-0x0;var _0x3da325=_0x34e8[_0x21f22a];return _0x3da325;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 8909ea3..7bbc677 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 _0x2cbd=['format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','Call_Duration','Call_Result','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','error','name','send','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET'];(function(_0x459665,_0x180404){var _0x273f15=function(_0x41d74e){while(--_0x41d74e){_0x459665['push'](_0x459665['shift']());}};_0x273f15(++_0x180404);}(_0x2cbd,0x99));var _0xd2cb=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x2cbd[_0x50f392];return _0x5926f2;};'use strict';var emlformat=require(_0xd2cb('0x0'));var rimraf=require(_0xd2cb('0x1'));var zipdir=require(_0xd2cb('0x2'));var jsonpatch=require(_0xd2cb('0x3'));var rp=require(_0xd2cb('0x4'));var moment=require(_0xd2cb('0x5'));var BPromise=require(_0xd2cb('0x6'));var Mustache=require(_0xd2cb('0x7'));var util=require(_0xd2cb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd2cb('0x9'));var ejs=require(_0xd2cb('0xa'));var fs=require('fs');var fs_extra=require(_0xd2cb('0xb'));var _=require(_0xd2cb('0xc'));var squel=require(_0xd2cb('0xd'));var crypto=require(_0xd2cb('0xe'));var jsforce=require(_0xd2cb('0xf'));var deskjs=require(_0xd2cb('0x10'));var toCsv=require(_0xd2cb('0x9'));var querystring=require('querystring');var Papa=require(_0xd2cb('0x11'));var Redis=require(_0xd2cb('0x12'));var authService=require(_0xd2cb('0x13'));var qs=require(_0xd2cb('0x14'));var as=require(_0xd2cb('0x15'));var hardwareService=require(_0xd2cb('0x16'));var logger=require('../../config/logger')(_0xd2cb('0x17'));var utils=require('../../config/utils');var config=require(_0xd2cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2cb('0x19'))['db'];var integrations=require(_0xd2cb('0x1a'));function respondWithStatusCode(_0x15784e,_0x2afce9){_0x2afce9=_0x2afce9||0xcc;return function(_0x3666ab){if(_0x3666ab){return _0x15784e[_0xd2cb('0x1b')](_0x2afce9);}return _0x15784e[_0xd2cb('0x1c')](_0x2afce9)[_0xd2cb('0x1d')]();};}function respondWithResult(_0x1772cf,_0x40c4e7){_0x40c4e7=_0x40c4e7||0xc8;return function(_0x1621c5){if(_0x1621c5){return _0x1772cf[_0xd2cb('0x1c')](_0x40c4e7)['json'](_0x1621c5);}};}function respondWithFilteredResult(_0x3fa426,_0x235abe){return function(_0x58b345){if(_0x58b345){var _0x17423b=typeof _0x235abe[_0xd2cb('0x1e')]===_0xd2cb('0x1f')&&typeof _0x235abe['limit']===_0xd2cb('0x1f');var _0x49b4f1=_0x58b345[_0xd2cb('0x20')];var _0x1b0a1e=_0x17423b?0x0:_0x235abe[_0xd2cb('0x1e')];var _0x447257=_0x17423b?_0x58b345[_0xd2cb('0x20')]:_0x235abe[_0xd2cb('0x1e')]+_0x235abe[_0xd2cb('0x21')];var _0x2502b9;if(_0x447257>=_0x49b4f1){_0x447257=_0x49b4f1;_0x2502b9=0xc8;}else{_0x2502b9=0xce;}_0x3fa426['status'](_0x2502b9);return _0x3fa426[_0xd2cb('0x22')]('Content-Range',_0x1b0a1e+'-'+_0x447257+'/'+_0x49b4f1)[_0xd2cb('0x23')](_0x58b345);}return null;};}function patchUpdates(_0x4ab625){return function(_0x3b1b9c){try{jsonpatch[_0xd2cb('0x24')](_0x3b1b9c,_0x4ab625,!![]);}catch(_0x48a12b){return BPromise[_0xd2cb('0x25')](_0x48a12b);}return _0x3b1b9c[_0xd2cb('0x26')]();};}function saveUpdates(_0x2b43a2,_0x11584e){return function(_0x485d22){if(_0x485d22){return _0x485d22['update'](_0x2b43a2)[_0xd2cb('0x27')](function(_0x89fbc7){return _0x89fbc7;});}return null;};}function removeEntity(_0x1a9e61,_0x17d257){return function(_0x45cd13){if(_0x45cd13){return _0x45cd13[_0xd2cb('0x28')]()[_0xd2cb('0x27')](function(){_0x1a9e61[_0xd2cb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40de0b,_0x86effe){return function(_0x27fb62){if(!_0x27fb62){_0x40de0b[_0xd2cb('0x1b')](0x194);}return _0x27fb62;};}function handleError(_0x505fb4,_0x12c5f4){_0x12c5f4=_0x12c5f4||0x1f4;return function(_0x121739){logger[_0xd2cb('0x29')](_0x121739['stack']);if(_0x121739[_0xd2cb('0x2a')]){delete _0x121739[_0xd2cb('0x2a')];}_0x505fb4[_0xd2cb('0x1c')](_0x12c5f4)[_0xd2cb('0x2b')](_0x121739);};}exports['index']=function(_0x5f34ec,_0x4835ec){var _0x29c16={},_0x222877={},_0x5202a8={'count':0x0,'rows':[]};var _0x33c7f8=_[_0xd2cb('0x2c')](db[_0xd2cb('0x2d')][_0xd2cb('0x2e')],function(_0x1eccfa){return{'name':_0x1eccfa[_0xd2cb('0x2f')],'type':_0x1eccfa['type'][_0xd2cb('0x30')]};});_0x222877[_0xd2cb('0x31')]=_['map'](_0x33c7f8,_0xd2cb('0x2a'));_0x222877[_0xd2cb('0x32')]=_[_0xd2cb('0x33')](_0x5f34ec[_0xd2cb('0x32')]);_0x222877[_0xd2cb('0x34')]=_['intersection'](_0x222877[_0xd2cb('0x31')],_0x222877[_0xd2cb('0x32')]);_0x29c16[_0xd2cb('0x35')]=_[_0xd2cb('0x36')](_0x222877[_0xd2cb('0x31')],qs[_0xd2cb('0x37')](_0x5f34ec[_0xd2cb('0x32')][_0xd2cb('0x37')]));_0x29c16[_0xd2cb('0x35')]=_0x29c16[_0xd2cb('0x35')][_0xd2cb('0x38')]?_0x29c16[_0xd2cb('0x35')]:_0x222877['model'];if(!_0x5f34ec[_0xd2cb('0x32')]['hasOwnProperty'](_0xd2cb('0x39'))){_0x29c16['limit']=qs['limit'](_0x5f34ec[_0xd2cb('0x32')][_0xd2cb('0x21')]);_0x29c16['offset']=qs[_0xd2cb('0x1e')](_0x5f34ec['query'][_0xd2cb('0x1e')]);}_0x29c16[_0xd2cb('0x3a')]=qs[_0xd2cb('0x3b')](_0x5f34ec[_0xd2cb('0x32')][_0xd2cb('0x3b')]);_0x29c16[_0xd2cb('0x3c')]=qs['filters'](_[_0xd2cb('0x3d')](_0x5f34ec['query'],_0x222877[_0xd2cb('0x34')]),_0x33c7f8);if(_0x5f34ec[_0xd2cb('0x32')]['filter']){_0x29c16[_0xd2cb('0x3c')]=_[_0xd2cb('0x3e')](_0x29c16[_0xd2cb('0x3c')],{'$or':_['map'](_0x33c7f8,function(_0x48f9ca){if(_0x48f9ca[_0xd2cb('0x3f')]!==_0xd2cb('0x40')){var _0x294b51={};_0x294b51[_0x48f9ca[_0xd2cb('0x2a')]]={'$like':'%'+_0x5f34ec[_0xd2cb('0x32')][_0xd2cb('0x41')]+'%'};return _0x294b51;}})});}_0x29c16=_['merge']({},_0x29c16,_0x5f34ec[_0xd2cb('0x42')]);var _0xce442e={'where':_0x29c16[_0xd2cb('0x3c')]};return db['ZohoAccount'][_0xd2cb('0x20')](_0xce442e)[_0xd2cb('0x27')](function(_0xa334aa){_0x5202a8[_0xd2cb('0x20')]=_0xa334aa;if(_0x5f34ec[_0xd2cb('0x32')][_0xd2cb('0x43')]){_0x29c16['include']=[{'all':!![]}];}return db[_0xd2cb('0x2d')]['findAll'](_0x29c16);})[_0xd2cb('0x27')](function(_0x394550){_0x5202a8[_0xd2cb('0x44')]=_0x394550;return _0x5202a8;})['then'](respondWithFilteredResult(_0x4835ec,_0x29c16))[_0xd2cb('0x45')](handleError(_0x4835ec,null));};exports[_0xd2cb('0x46')]=function(_0xc2486c,_0x55c494){var _0x41b023={'raw':![],'where':{'id':_0xc2486c[_0xd2cb('0x47')]['id']}},_0x57d4b1={};_0x57d4b1['model']=_[_0xd2cb('0x33')](db[_0xd2cb('0x2d')][_0xd2cb('0x2e')]);_0x57d4b1['query']=_[_0xd2cb('0x33')](_0xc2486c['query']);_0x57d4b1[_0xd2cb('0x34')]=_[_0xd2cb('0x36')](_0x57d4b1[_0xd2cb('0x31')],_0x57d4b1[_0xd2cb('0x32')]);_0x41b023[_0xd2cb('0x35')]=_[_0xd2cb('0x36')](_0x57d4b1[_0xd2cb('0x31')],qs[_0xd2cb('0x37')](_0xc2486c[_0xd2cb('0x32')][_0xd2cb('0x37')]));_0x41b023[_0xd2cb('0x35')]=_0x41b023[_0xd2cb('0x35')][_0xd2cb('0x38')]?_0x41b023['attributes']:_0x57d4b1[_0xd2cb('0x31')];if(_0xc2486c[_0xd2cb('0x32')][_0xd2cb('0x43')]){_0x41b023[_0xd2cb('0x48')]=[{'all':!![]}];}_0x41b023=_[_0xd2cb('0x3e')]({},_0x41b023,_0xc2486c[_0xd2cb('0x42')]);return db[_0xd2cb('0x2d')][_0xd2cb('0x49')](_0x41b023)[_0xd2cb('0x27')](handleEntityNotFound(_0x55c494,null))[_0xd2cb('0x27')](respondWithResult(_0x55c494,null))['catch'](handleError(_0x55c494,null));};exports[_0xd2cb('0x4a')]=function(_0x4c218e,_0x2535a1){return db['ZohoAccount'][_0xd2cb('0x4a')](_0x4c218e[_0xd2cb('0x4b')],{})[_0xd2cb('0x27')](respondWithResult(_0x2535a1,0xc9))[_0xd2cb('0x45')](handleError(_0x2535a1,null));};exports[_0xd2cb('0x4c')]=function(_0x1cae05,_0x59ecbb){if(_0x1cae05['body']['id']){delete _0x1cae05['body']['id'];}return db['ZohoAccount'][_0xd2cb('0x49')]({'where':{'id':_0x1cae05['params']['id']}})[_0xd2cb('0x27')](handleEntityNotFound(_0x59ecbb,null))[_0xd2cb('0x27')](saveUpdates(_0x1cae05[_0xd2cb('0x4b')],null))['then'](respondWithResult(_0x59ecbb,null))['catch'](handleError(_0x59ecbb,null));};exports[_0xd2cb('0x28')]=function(_0x3b93ba,_0x17a06f){return db[_0xd2cb('0x2d')][_0xd2cb('0x49')]({'where':{'id':_0x3b93ba[_0xd2cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x17a06f,null))['then'](removeEntity(_0x17a06f,null))[_0xd2cb('0x45')](handleError(_0x17a06f,null));};exports[_0xd2cb('0x4d')]=function(_0x48dee1,_0x1229bc,_0x139c96){var _0x1770d0={};var _0x208fb7={};var _0x27141b;var _0x1300e5;return db[_0xd2cb('0x2d')][_0xd2cb('0x4e')]({'where':{'id':_0x48dee1['params']['id']}})['then'](handleEntityNotFound(_0x1229bc,null))[_0xd2cb('0x27')](function(_0x32feda){if(_0x32feda){_0x27141b=_0x32feda;_0x208fb7[_0xd2cb('0x31')]=_['keys'](db[_0xd2cb('0x4f')][_0xd2cb('0x2e')]);_0x208fb7[_0xd2cb('0x32')]=_[_0xd2cb('0x33')](_0x48dee1[_0xd2cb('0x32')]);_0x208fb7[_0xd2cb('0x34')]=_['intersection'](_0x208fb7[_0xd2cb('0x31')],_0x208fb7[_0xd2cb('0x32')]);_0x1770d0[_0xd2cb('0x35')]=_['intersection'](_0x208fb7[_0xd2cb('0x31')],qs[_0xd2cb('0x37')](_0x48dee1[_0xd2cb('0x32')]['fields']));_0x1770d0[_0xd2cb('0x35')]=_0x1770d0['attributes']['length']?_0x1770d0['attributes']:_0x208fb7[_0xd2cb('0x31')];_0x1770d0['order']=qs['sort'](_0x48dee1['query'][_0xd2cb('0x3b')]);_0x1770d0[_0xd2cb('0x3c')]=qs[_0xd2cb('0x34')](_[_0xd2cb('0x3d')](_0x48dee1[_0xd2cb('0x32')],_0x208fb7[_0xd2cb('0x34')]));if(_0x48dee1['query'][_0xd2cb('0x41')]){_0x1770d0[_0xd2cb('0x3c')]=_['merge'](_0x1770d0['where'],{'$or':_[_0xd2cb('0x2c')](_0x1770d0[_0xd2cb('0x35')],function(_0x1e1c9a){var _0x15823f={};_0x15823f[_0x1e1c9a]={'$like':'%'+_0x48dee1[_0xd2cb('0x32')][_0xd2cb('0x41')]+'%'};return _0x15823f;})});}_0x1770d0=_['merge']({},_0x1770d0,_0x48dee1[_0xd2cb('0x42')]);return _0x27141b[_0xd2cb('0x4d')](_0x1770d0);}})['then'](function(_0x295ae2){if(_0x295ae2){_0x1300e5=_0x295ae2[_0xd2cb('0x38')];if(!_0x48dee1[_0xd2cb('0x32')][_0xd2cb('0x50')](_0xd2cb('0x39'))){_0x1770d0[_0xd2cb('0x21')]=qs[_0xd2cb('0x21')](_0x48dee1['query'][_0xd2cb('0x21')]);_0x1770d0[_0xd2cb('0x1e')]=qs['offset'](_0x48dee1['query'][_0xd2cb('0x1e')]);}return _0x27141b[_0xd2cb('0x4d')](_0x1770d0);}})[_0xd2cb('0x27')](function(_0xe9e093){if(_0xe9e093){return _0xe9e093?{'count':_0x1300e5,'rows':_0xe9e093}:null;}})[_0xd2cb('0x27')](respondWithResult(_0x1229bc,null))[_0xd2cb('0x45')](handleError(_0x1229bc,null));};exports['addConfiguration']=function(_0x3ab695,_0x1f0b48,_0x46ca70){if(_0x3ab695[_0xd2cb('0x4b')]['id']){delete _0x3ab695['body']['id'];}return db[_0xd2cb('0x2d')]['findOne']({'where':{'id':_0x3ab695[_0xd2cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f0b48,null))[_0xd2cb('0x27')](function(_0xd3997b){if(_0xd3997b){_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x51')]=_0xd3997b['id'];_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x52')]=integrations['getSubjects'](_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x53')],_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x3f')]);_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x54')]=integrations[_0xd2cb('0x55')](_0x3ab695[_0xd2cb('0x4b')][_0xd2cb('0x53')],_0x3ab695[_0xd2cb('0x4b')]['type']);return db[_0xd2cb('0x4f')]['create'](_0x3ab695[_0xd2cb('0x4b')],{'include':[{'model':db['ZohoField'],'as':_0xd2cb('0x52')},{'model':db[_0xd2cb('0x56')],'as':'Descriptions'}]});}return null;})[_0xd2cb('0x27')](respondWithResult(_0x1f0b48,null))[_0xd2cb('0x45')](handleError(_0x1f0b48,null));};function getAccessToken(_0x333bc5){return new Promise(function(_0x1a0ff9,_0x56f689){var _0x26916b;switch(_0x333bc5[_0xd2cb('0x57')]){case'US':_0x26916b=_0xd2cb('0x58');break;case'AU':_0x26916b=_0xd2cb('0x59');break;case'EU':_0x26916b=_0xd2cb('0x5a');break;case'IN':_0x26916b=_0xd2cb('0x5b');break;case'CN':_0x26916b='https://accounts.zoho.com.cn';break;default:_0x26916b=_0xd2cb('0x5a');break;}var _0x551245={'method':_0xd2cb('0x5c'),'uri':_0x26916b+_0xd2cb('0x5d'),'qs':{'refresh_token':_0x333bc5[_0xd2cb('0x5e')],'client_id':_0x333bc5['clientId'],'client_secret':_0x333bc5['clientSecret'],'grant_type':_0xd2cb('0x5f')},'json':!![]};return rp(_0x551245)['then'](function(_0x4ffe99){if(_0x4ffe99[_0xd2cb('0x60')]){_0x1a0ff9(_0x4ffe99[_0xd2cb('0x60')]);}else{_0x56f689(_0xd2cb('0x61'));}})[_0xd2cb('0x45')](function(_0x53e5da){_0x56f689(_0x53e5da);});});}exports[_0xd2cb('0x62')]=function(_0x18d5ad,_0x27a5fc,_0x528748){var _0x170d50,_0x260556,_0x8911da,_0x45b689,_0x165cca;return db[_0xd2cb('0x2d')]['findOne']({'where':{'id':_0x18d5ad[_0xd2cb('0x47')]['id']},'attributes':['id',_0xd2cb('0x63'),_0xd2cb('0x57'),_0xd2cb('0x64'),_0xd2cb('0x65'),_0xd2cb('0x66'),'code',_0xd2cb('0x5e')]})['then'](handleEntityNotFound(_0x27a5fc,null))[_0xd2cb('0x27')](function(_0x2787d8){_0x165cca=_0x2787d8;_0x170d50=_0x165cca[_0xd2cb('0x63')];_0x260556=_0x170d50===_0xd2cb('0x67')?'eu':_0xd2cb('0x68');_0x8911da=_0x165cca[_0xd2cb('0x66')];var _0x258a58=_0x8911da[_0xd2cb('0x69')](-0x1);if(_0x258a58==='/'||_0x258a58==='\x5c'||_0x258a58===':'){_0x8911da=_0x8911da['substring'](0x0,_0x8911da[_0xd2cb('0x6a')](_0x258a58));}if(!_0x165cca[_0xd2cb('0x5e')]){throw new Error(_0xd2cb('0x6b'));}return getAccessToken(_0x165cca);})[_0xd2cb('0x27')](function(_0x32352f){if(_0x32352f){return rp({'method':_0xd2cb('0x6c'),'uri':util[_0xd2cb('0x6d')](_0xd2cb('0x6e'),_0x260556),'qs':{'module':_0xd2cb('0x6f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x32352f},'json':!![]});}})[_0xd2cb('0x27')](function(_0x1576b9){if(_0x1576b9){if(_0x1576b9['response']&&_0x1576b9[_0xd2cb('0x70')][_0xd2cb('0x29')]){throw new Error(_0x1576b9[_0xd2cb('0x70')]['error'][_0xd2cb('0x71')]);}var _0x25ae75=[];var _0x1a3d29=[];var _0x5a8922=[_0xd2cb('0x72'),_0xd2cb('0x73'),_0xd2cb('0x74'),'WhoId',_0xd2cb('0x75'),_0xd2cb('0x76'),'Call_Start_Time','Call_Type'];_0x1a3d29=_['remove'](_0x1576b9[_0xd2cb('0x37')],function(_0x54ecd1){return _0x5a8922[_0xd2cb('0x77')](_0x54ecd1['api_name']);});for(var _0x3a66a4=0x0;_0x3a66a4<_0x1a3d29[_0xd2cb('0x38')];_0x3a66a4++){if(_0x1a3d29[_0x3a66a4][_0xd2cb('0x78')]===![]){_0x25ae75[_0xd2cb('0x79')]({'id':_0x1a3d29[_0x3a66a4]['id'],'name':_0x1a3d29[_0x3a66a4][_0xd2cb('0x7a')],'custom':_0x1a3d29[_0x3a66a4][_0xd2cb('0x7b')],'options':_0x1a3d29[_0x3a66a4][_0xd2cb('0x7c')]==='picklist'&&_0x1a3d29[_0x3a66a4]['pick_list_values'][_0xd2cb('0x38')]>-0x1?_[_0xd2cb('0x2c')](_0x1a3d29[_0x3a66a4][_0xd2cb('0x7d')],function(_0x33af7d){return{'name':_0x33af7d,'value':_0x33af7d};}):[]});}}return{'count':_0x25ae75[_0xd2cb('0x38')],'rows':_0x25ae75};}else{return{'count':0x0,'rows':[]};}})[_0xd2cb('0x27')](respondWithResult(_0x27a5fc,null))['catch'](function(_0x3962fd){var _0x423dfe=_0x18d5ad[_0xd2cb('0x32')][_0xd2cb('0x7e')]?0x1f4:_0x3962fd[_0xd2cb('0x7f')]||0x1f4;logger['error'](_0xd2cb('0x80'),_0xd2cb('0x62'),_0x423dfe,JSON[_0xd2cb('0x81')](_0x3962fd));delete _0x3962fd[_0xd2cb('0x2a')];if(_0x423dfe===0x191){_0x423dfe=0x190;}_0x27a5fc[_0xd2cb('0x1c')](_0x423dfe)[_0xd2cb('0x2b')](_0x18d5ad[_0xd2cb('0x32')]['test']?{'message':_0xd2cb('0x82'),'statusCode':_0x3962fd['statusCode']}:_0x3962fd);});}; \ No newline at end of file +var _0x39bc=['Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','stack','name','index','ZohoAccount','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','length','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','rawAttributes','order','hasOwnProperty','AccountId'];(function(_0x38c9fa,_0x11dd08){var _0x1b1263=function(_0x497548){while(--_0x497548){_0x38c9fa['push'](_0x38c9fa['shift']());}};_0x1b1263(++_0x11dd08);}(_0x39bc,0x11d));var _0xc39b=function(_0x51c62c,_0x2720fe){_0x51c62c=_0x51c62c-0x0;var _0x4e91dd=_0x39bc[_0x51c62c];return _0x4e91dd;};'use strict';var emlformat=require(_0xc39b('0x0'));var rimraf=require(_0xc39b('0x1'));var zipdir=require(_0xc39b('0x2'));var jsonpatch=require(_0xc39b('0x3'));var rp=require('request-promise');var moment=require(_0xc39b('0x4'));var BPromise=require(_0xc39b('0x5'));var Mustache=require(_0xc39b('0x6'));var util=require('util');var path=require(_0xc39b('0x7'));var sox=require(_0xc39b('0x8'));var csv=require(_0xc39b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc39b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc39b('0xb'));var jsforce=require(_0xc39b('0xc'));var deskjs=require(_0xc39b('0xd'));var toCsv=require(_0xc39b('0x9'));var querystring=require(_0xc39b('0xe'));var Papa=require(_0xc39b('0xf'));var Redis=require(_0xc39b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc39b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc39b('0x12'));var logger=require(_0xc39b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc39b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc39b('0x15'));function respondWithStatusCode(_0x3d1fdc,_0x2c1bad){_0x2c1bad=_0x2c1bad||0xcc;return function(_0x30dcae){if(_0x30dcae){return _0x3d1fdc[_0xc39b('0x16')](_0x2c1bad);}return _0x3d1fdc[_0xc39b('0x17')](_0x2c1bad)['end']();};}function respondWithResult(_0x30e602,_0x3ae617){_0x3ae617=_0x3ae617||0xc8;return function(_0x3a3b83){if(_0x3a3b83){return _0x30e602[_0xc39b('0x17')](_0x3ae617)[_0xc39b('0x18')](_0x3a3b83);}};}function respondWithFilteredResult(_0x1b0b16,_0x2877da){return function(_0x107f74){if(_0x107f74){var _0x5976b1=typeof _0x2877da[_0xc39b('0x19')]===_0xc39b('0x1a')&&typeof _0x2877da[_0xc39b('0x1b')]===_0xc39b('0x1a');var _0x395d40=_0x107f74[_0xc39b('0x1c')];var _0x3e663f=_0x5976b1?0x0:_0x2877da[_0xc39b('0x19')];var _0x33db71=_0x5976b1?_0x107f74['count']:_0x2877da['offset']+_0x2877da[_0xc39b('0x1b')];var _0x54c3b0;if(_0x33db71>=_0x395d40){_0x33db71=_0x395d40;_0x54c3b0=0xc8;}else{_0x54c3b0=0xce;}_0x1b0b16[_0xc39b('0x17')](_0x54c3b0);return _0x1b0b16[_0xc39b('0x1d')]('Content-Range',_0x3e663f+'-'+_0x33db71+'/'+_0x395d40)['json'](_0x107f74);}return null;};}function patchUpdates(_0x37065d){return function(_0xfa0abd){try{jsonpatch[_0xc39b('0x1e')](_0xfa0abd,_0x37065d,!![]);}catch(_0x595168){return BPromise['reject'](_0x595168);}return _0xfa0abd[_0xc39b('0x1f')]();};}function saveUpdates(_0x4b3197,_0x57ec9e){return function(_0x32a045){if(_0x32a045){return _0x32a045[_0xc39b('0x20')](_0x4b3197)[_0xc39b('0x21')](function(_0x10bb4b){return _0x10bb4b;});}return null;};}function removeEntity(_0x1f351b,_0xf5df29){return function(_0x3b3105){if(_0x3b3105){return _0x3b3105[_0xc39b('0x22')]()[_0xc39b('0x21')](function(){_0x1f351b['status'](0xcc)[_0xc39b('0x23')]();});}};}function handleEntityNotFound(_0x400b38,_0x50f6f4){return function(_0x479b12){if(!_0x479b12){_0x400b38[_0xc39b('0x16')](0x194);}return _0x479b12;};}function handleError(_0x23b6ad,_0x489b17){_0x489b17=_0x489b17||0x1f4;return function(_0x19a02e){logger[_0xc39b('0x24')](_0x19a02e[_0xc39b('0x25')]);if(_0x19a02e[_0xc39b('0x26')]){delete _0x19a02e['name'];}_0x23b6ad['status'](_0x489b17)['send'](_0x19a02e);};}exports[_0xc39b('0x27')]=function(_0x585846,_0x2ef30e){var _0x1b744e={},_0x3d1780={},_0x96d0c1={'count':0x0,'rows':[]};var _0x11f8c0=_['map'](db[_0xc39b('0x28')]['rawAttributes'],function(_0x83dbba){return{'name':_0x83dbba[_0xc39b('0x29')],'type':_0x83dbba[_0xc39b('0x2a')][_0xc39b('0x2b')]};});_0x3d1780[_0xc39b('0x2c')]=_[_0xc39b('0x2d')](_0x11f8c0,_0xc39b('0x26'));_0x3d1780['query']=_[_0xc39b('0x2e')](_0x585846[_0xc39b('0x2f')]);_0x3d1780[_0xc39b('0x30')]=_[_0xc39b('0x31')](_0x3d1780[_0xc39b('0x2c')],_0x3d1780[_0xc39b('0x2f')]);_0x1b744e['attributes']=_[_0xc39b('0x31')](_0x3d1780['model'],qs['fields'](_0x585846[_0xc39b('0x2f')][_0xc39b('0x32')]));_0x1b744e[_0xc39b('0x33')]=_0x1b744e[_0xc39b('0x33')]['length']?_0x1b744e['attributes']:_0x3d1780['model'];if(!_0x585846['query']['hasOwnProperty'](_0xc39b('0x34'))){_0x1b744e[_0xc39b('0x1b')]=qs[_0xc39b('0x1b')](_0x585846[_0xc39b('0x2f')]['limit']);_0x1b744e[_0xc39b('0x19')]=qs[_0xc39b('0x19')](_0x585846[_0xc39b('0x2f')][_0xc39b('0x19')]);}_0x1b744e['order']=qs[_0xc39b('0x35')](_0x585846[_0xc39b('0x2f')]['sort']);_0x1b744e[_0xc39b('0x36')]=qs['filters'](_[_0xc39b('0x37')](_0x585846[_0xc39b('0x2f')],_0x3d1780['filters']),_0x11f8c0);if(_0x585846['query'][_0xc39b('0x38')]){_0x1b744e[_0xc39b('0x36')]=_[_0xc39b('0x39')](_0x1b744e['where'],{'$or':_['map'](_0x11f8c0,function(_0x5e4b95){if(_0x5e4b95[_0xc39b('0x2a')]!==_0xc39b('0x3a')){var _0x18b470={};_0x18b470[_0x5e4b95[_0xc39b('0x26')]]={'$like':'%'+_0x585846[_0xc39b('0x2f')][_0xc39b('0x38')]+'%'};return _0x18b470;}})});}_0x1b744e=_[_0xc39b('0x39')]({},_0x1b744e,_0x585846[_0xc39b('0x3b')]);var _0x59cdab={'where':_0x1b744e[_0xc39b('0x36')]};return db[_0xc39b('0x28')]['count'](_0x59cdab)[_0xc39b('0x21')](function(_0xdd0ef4){_0x96d0c1['count']=_0xdd0ef4;if(_0x585846[_0xc39b('0x2f')][_0xc39b('0x3c')]){_0x1b744e[_0xc39b('0x3d')]=[{'all':!![]}];}return db[_0xc39b('0x28')]['findAll'](_0x1b744e);})[_0xc39b('0x21')](function(_0x7acbd2){_0x96d0c1['rows']=_0x7acbd2;return _0x96d0c1;})[_0xc39b('0x21')](respondWithFilteredResult(_0x2ef30e,_0x1b744e))['catch'](handleError(_0x2ef30e,null));};exports['show']=function(_0x17bc9a,_0x916e69){var _0x15a53a={'raw':![],'where':{'id':_0x17bc9a[_0xc39b('0x3e')]['id']}},_0x5dd892={};_0x5dd892[_0xc39b('0x2c')]=_[_0xc39b('0x2e')](db[_0xc39b('0x28')]['rawAttributes']);_0x5dd892[_0xc39b('0x2f')]=_['keys'](_0x17bc9a[_0xc39b('0x2f')]);_0x5dd892['filters']=_[_0xc39b('0x31')](_0x5dd892[_0xc39b('0x2c')],_0x5dd892[_0xc39b('0x2f')]);_0x15a53a[_0xc39b('0x33')]=_[_0xc39b('0x31')](_0x5dd892['model'],qs[_0xc39b('0x32')](_0x17bc9a[_0xc39b('0x2f')][_0xc39b('0x32')]));_0x15a53a[_0xc39b('0x33')]=_0x15a53a[_0xc39b('0x33')][_0xc39b('0x3f')]?_0x15a53a[_0xc39b('0x33')]:_0x5dd892[_0xc39b('0x2c')];if(_0x17bc9a[_0xc39b('0x2f')]['includeAll']){_0x15a53a[_0xc39b('0x3d')]=[{'all':!![]}];}_0x15a53a=_[_0xc39b('0x39')]({},_0x15a53a,_0x17bc9a[_0xc39b('0x3b')]);return db['ZohoAccount'][_0xc39b('0x40')](_0x15a53a)['then'](handleEntityNotFound(_0x916e69,null))[_0xc39b('0x21')](respondWithResult(_0x916e69,null))[_0xc39b('0x41')](handleError(_0x916e69,null));};exports[_0xc39b('0x42')]=function(_0x1bc8fd,_0xf4fbfd){return db[_0xc39b('0x28')][_0xc39b('0x42')](_0x1bc8fd[_0xc39b('0x43')],{})[_0xc39b('0x21')](respondWithResult(_0xf4fbfd,0xc9))['catch'](handleError(_0xf4fbfd,null));};exports[_0xc39b('0x20')]=function(_0x1c9609,_0x35a496){if(_0x1c9609[_0xc39b('0x43')]['id']){delete _0x1c9609[_0xc39b('0x43')]['id'];}return db['ZohoAccount'][_0xc39b('0x40')]({'where':{'id':_0x1c9609[_0xc39b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x35a496,null))[_0xc39b('0x21')](saveUpdates(_0x1c9609[_0xc39b('0x43')],null))[_0xc39b('0x21')](respondWithResult(_0x35a496,null))['catch'](handleError(_0x35a496,null));};exports[_0xc39b('0x22')]=function(_0x10c5fe,_0x217799){return db[_0xc39b('0x28')]['find']({'where':{'id':_0x10c5fe[_0xc39b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x217799,null))[_0xc39b('0x21')](removeEntity(_0x217799,null))[_0xc39b('0x41')](handleError(_0x217799,null));};exports[_0xc39b('0x44')]=function(_0x507340,_0x68df68,_0x46d3a0){var _0x5b0ee8={};var _0xa2a268={};var _0x4818b0;var _0x11936a;return db[_0xc39b('0x28')][_0xc39b('0x45')]({'where':{'id':_0x507340['params']['id']}})[_0xc39b('0x21')](handleEntityNotFound(_0x68df68,null))[_0xc39b('0x21')](function(_0x14c695){if(_0x14c695){_0x4818b0=_0x14c695;_0xa2a268[_0xc39b('0x2c')]=_[_0xc39b('0x2e')](db[_0xc39b('0x46')][_0xc39b('0x47')]);_0xa2a268[_0xc39b('0x2f')]=_[_0xc39b('0x2e')](_0x507340['query']);_0xa2a268['filters']=_[_0xc39b('0x31')](_0xa2a268[_0xc39b('0x2c')],_0xa2a268[_0xc39b('0x2f')]);_0x5b0ee8[_0xc39b('0x33')]=_[_0xc39b('0x31')](_0xa2a268[_0xc39b('0x2c')],qs[_0xc39b('0x32')](_0x507340[_0xc39b('0x2f')]['fields']));_0x5b0ee8[_0xc39b('0x33')]=_0x5b0ee8[_0xc39b('0x33')][_0xc39b('0x3f')]?_0x5b0ee8[_0xc39b('0x33')]:_0xa2a268[_0xc39b('0x2c')];_0x5b0ee8[_0xc39b('0x48')]=qs[_0xc39b('0x35')](_0x507340[_0xc39b('0x2f')][_0xc39b('0x35')]);_0x5b0ee8[_0xc39b('0x36')]=qs['filters'](_[_0xc39b('0x37')](_0x507340[_0xc39b('0x2f')],_0xa2a268[_0xc39b('0x30')]));if(_0x507340[_0xc39b('0x2f')][_0xc39b('0x38')]){_0x5b0ee8[_0xc39b('0x36')]=_['merge'](_0x5b0ee8[_0xc39b('0x36')],{'$or':_[_0xc39b('0x2d')](_0x5b0ee8['attributes'],function(_0x5226c7){var _0x53aeef={};_0x53aeef[_0x5226c7]={'$like':'%'+_0x507340['query'][_0xc39b('0x38')]+'%'};return _0x53aeef;})});}_0x5b0ee8=_['merge']({},_0x5b0ee8,_0x507340['options']);return _0x4818b0[_0xc39b('0x44')](_0x5b0ee8);}})['then'](function(_0x462ed4){if(_0x462ed4){_0x11936a=_0x462ed4[_0xc39b('0x3f')];if(!_0x507340[_0xc39b('0x2f')][_0xc39b('0x49')](_0xc39b('0x34'))){_0x5b0ee8[_0xc39b('0x1b')]=qs[_0xc39b('0x1b')](_0x507340['query'][_0xc39b('0x1b')]);_0x5b0ee8[_0xc39b('0x19')]=qs[_0xc39b('0x19')](_0x507340['query'][_0xc39b('0x19')]);}return _0x4818b0[_0xc39b('0x44')](_0x5b0ee8);}})[_0xc39b('0x21')](function(_0x17d7dd){if(_0x17d7dd){return _0x17d7dd?{'count':_0x11936a,'rows':_0x17d7dd}:null;}})['then'](respondWithResult(_0x68df68,null))[_0xc39b('0x41')](handleError(_0x68df68,null));};exports['addConfiguration']=function(_0x3cce29,_0x185e62,_0x1dd2fc){if(_0x3cce29['body']['id']){delete _0x3cce29['body']['id'];}return db[_0xc39b('0x28')]['findOne']({'where':{'id':_0x3cce29['params']['id']}})['then'](handleEntityNotFound(_0x185e62,null))['then'](function(_0x505acd){if(_0x505acd){_0x3cce29[_0xc39b('0x43')][_0xc39b('0x4a')]=_0x505acd['id'];_0x3cce29[_0xc39b('0x43')][_0xc39b('0x4b')]=integrations['getSubjects'](_0x3cce29[_0xc39b('0x43')][_0xc39b('0x4c')],_0x3cce29['body'][_0xc39b('0x2a')]);_0x3cce29[_0xc39b('0x43')][_0xc39b('0x4d')]=integrations['getDescriptions'](_0x3cce29[_0xc39b('0x43')][_0xc39b('0x4c')],_0x3cce29[_0xc39b('0x43')][_0xc39b('0x2a')]);return db[_0xc39b('0x46')][_0xc39b('0x42')](_0x3cce29['body'],{'include':[{'model':db[_0xc39b('0x4e')],'as':_0xc39b('0x4b')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xc39b('0x21')](respondWithResult(_0x185e62,null))[_0xc39b('0x41')](handleError(_0x185e62,null));};function getAccessToken(_0x4f1ef1){return new Promise(function(_0x382c9a,_0x3dfcaa){var _0x23e165;switch(_0x4f1ef1[_0xc39b('0x4f')]){case'US':_0x23e165='https://accounts.zoho.com';break;case'AU':_0x23e165=_0xc39b('0x50');break;case'EU':_0x23e165=_0xc39b('0x51');break;case'IN':_0x23e165=_0xc39b('0x52');break;case'CN':_0x23e165='https://accounts.zoho.com.cn';break;default:_0x23e165='https://accounts.zoho.eu';break;}var _0x2846b8={'method':_0xc39b('0x53'),'uri':_0x23e165+'/oauth/v2/token','qs':{'refresh_token':_0x4f1ef1[_0xc39b('0x54')],'client_id':_0x4f1ef1[_0xc39b('0x55')],'client_secret':_0x4f1ef1[_0xc39b('0x56')],'grant_type':_0xc39b('0x57')},'json':!![]};return rp(_0x2846b8)['then'](function(_0x52a995){if(_0x52a995[_0xc39b('0x58')]){_0x382c9a(_0x52a995['access_token']);}else{_0x3dfcaa(_0xc39b('0x59'));}})[_0xc39b('0x41')](function(_0x5dd6b5){_0x3dfcaa(_0x5dd6b5);});});}exports[_0xc39b('0x5a')]=function(_0x8e7e5b,_0x3e8d5a,_0x332199){var _0x46ab8c,_0x39bea6,_0x2c63f1,_0x2d9c1d,_0x1c0c6c;return db[_0xc39b('0x28')][_0xc39b('0x45')]({'where':{'id':_0x8e7e5b[_0xc39b('0x3e')]['id']},'attributes':['id',_0xc39b('0x5b'),_0xc39b('0x4f'),_0xc39b('0x55'),_0xc39b('0x56'),_0xc39b('0x5c'),_0xc39b('0x5d'),'refreshToken']})[_0xc39b('0x21')](handleEntityNotFound(_0x3e8d5a,null))['then'](function(_0x1f038a){_0x1c0c6c=_0x1f038a;_0x46ab8c=_0x1c0c6c[_0xc39b('0x5b')];_0x39bea6=_0x46ab8c===_0xc39b('0x5e')?'eu':_0xc39b('0x5f');_0x2c63f1=_0x1c0c6c[_0xc39b('0x5c')];var _0x10c1f1=_0x2c63f1['slice'](-0x1);if(_0x10c1f1==='/'||_0x10c1f1==='\x5c'||_0x10c1f1===':'){_0x2c63f1=_0x2c63f1[_0xc39b('0x60')](0x0,_0x2c63f1[_0xc39b('0x61')](_0x10c1f1));}if(!_0x1c0c6c[_0xc39b('0x54')]){throw new Error(_0xc39b('0x62'));}return getAccessToken(_0x1c0c6c);})[_0xc39b('0x21')](function(_0x1b3ea3){if(_0x1b3ea3){return rp({'method':_0xc39b('0x63'),'uri':util[_0xc39b('0x64')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x39bea6),'qs':{'module':_0xc39b('0x65')},'headers':{'Authorization':_0xc39b('0x66')+_0x1b3ea3},'json':!![]});}})[_0xc39b('0x21')](function(_0x9e51ba){if(_0x9e51ba){if(_0x9e51ba[_0xc39b('0x67')]&&_0x9e51ba[_0xc39b('0x67')][_0xc39b('0x24')]){throw new Error(_0x9e51ba[_0xc39b('0x67')][_0xc39b('0x24')][_0xc39b('0x68')]);}var _0x43e7e9=[];var _0x4ba57f=[];var _0x4cd72b=[_0xc39b('0x69'),_0xc39b('0x6a'),'Description','WhoId',_0xc39b('0x6b'),_0xc39b('0x6c'),'Call_Start_Time',_0xc39b('0x6d')];_0x4ba57f=_[_0xc39b('0x6e')](_0x9e51ba[_0xc39b('0x32')],function(_0x2974b3){return _0x4cd72b[_0xc39b('0x6f')](_0x2974b3[_0xc39b('0x70')]);});for(var _0xb0d047=0x0;_0xb0d047<_0x4ba57f[_0xc39b('0x3f')];_0xb0d047++){if(_0x4ba57f[_0xb0d047]['system_mandatory']===![]){_0x43e7e9[_0xc39b('0x71')]({'id':_0x4ba57f[_0xb0d047]['id'],'name':_0x4ba57f[_0xb0d047][_0xc39b('0x72')],'custom':_0x4ba57f[_0xb0d047][_0xc39b('0x73')],'options':_0x4ba57f[_0xb0d047]['data_type']===_0xc39b('0x74')&&_0x4ba57f[_0xb0d047]['pick_list_values'][_0xc39b('0x3f')]>-0x1?_[_0xc39b('0x2d')](_0x4ba57f[_0xb0d047]['pick_list_values'],function(_0x4e0b61){return{'name':_0x4e0b61,'value':_0x4e0b61};}):[]});}}return{'count':_0x43e7e9[_0xc39b('0x3f')],'rows':_0x43e7e9};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3e8d5a,null))[_0xc39b('0x41')](function(_0x334cd8){var _0x58ed41=_0x8e7e5b[_0xc39b('0x2f')][_0xc39b('0x75')]?0x1f4:_0x334cd8[_0xc39b('0x76')]||0x1f4;logger[_0xc39b('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x58ed41,JSON['stringify'](_0x334cd8));delete _0x334cd8[_0xc39b('0x26')];if(_0x58ed41===0x191){_0x58ed41=0x190;}_0x3e8d5a[_0xc39b('0x17')](_0x58ed41)['send'](_0x8e7e5b[_0xc39b('0x2f')]['test']?{'message':_0xc39b('0x77'),'statusCode':_0x334cd8[_0xc39b('0x76')]}:_0x334cd8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index fb69702..12d357c 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 _0x8b35=['../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','code','application/x-www-form-urlencoded','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.cn','authorization_code','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes'];(function(_0x24f1ff,_0x4014c9){var _0x349109=function(_0x253267){while(--_0x253267){_0x24f1ff['push'](_0x24f1ff['shift']());}};_0x349109(++_0x4014c9);}(_0x8b35,0x1ba));var _0x58b3=function(_0x11ff18,_0x591920){_0x11ff18=_0x11ff18-0x0;var _0x7d6366=_0x8b35[_0x11ff18];return _0x7d6366;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var logger=require(_0x58b3('0x2'))('api');var moment=require(_0x58b3('0x3'));var BPromise=require(_0x58b3('0x4'));var rp=require(_0x58b3('0x5'));var fs=require('fs');var path=require(_0x58b3('0x6'));var rimraf=require(_0x58b3('0x7'));var config=require('../../config/environment');var attributes=require(_0x58b3('0x8'));var integrations=require(_0x58b3('0x9'));module[_0x58b3('0xa')]=function(_0x990f31,_0x26baed){return _0x990f31['define'](_0x58b3('0xb'),attributes,{'tableName':_0x58b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f4785,_0x2a5351,_0x284d37){if(_0x4f4785[_0x58b3('0xd')](_0x58b3('0xe'))||_0x4f4785['changed'](_0x58b3('0xf'))||_0x4f4785[_0x58b3('0xd')]('clientId')||_0x4f4785[_0x58b3('0xd')](_0x58b3('0x10'))||_0x4f4785['changed']('code')||_0x4f4785['changed'](_0x58b3('0x11'))){var _0x22ecdd,_0x46a94d;_0x22ecdd=_0x4f4785[_0x58b3('0xf')];var _0x59d6dd=_0x22ecdd[_0x58b3('0x12')](-0x1);if(_0x59d6dd==='/'||_0x59d6dd==='\x5c'||_0x59d6dd===':'){_0x22ecdd=_0x22ecdd[_0x58b3('0x13')](0x0,_0x22ecdd[_0x58b3('0x14')](_0x59d6dd));}switch(_0x4f4785[_0x58b3('0xe')]){case'US':_0x46a94d=_0x58b3('0x15');break;case'AU':_0x46a94d=_0x58b3('0x16');break;case'IN':_0x46a94d=_0x58b3('0x17');break;case'CN':_0x46a94d='https://accounts.zoho.com.cn';break;default:_0x46a94d=_0x58b3('0x18');break;}var _0x47b1e8={'method':_0x58b3('0x19'),'uri':_0x46a94d+_0x58b3('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x4f4785[_0x58b3('0x1b')],'client_secret':_0x4f4785[_0x58b3('0x10')],'redirect_uri':_0x4f4785[_0x58b3('0xf')],'code':_0x4f4785[_0x58b3('0x1c')]},'headers':{'Content-Type':_0x58b3('0x1d')}};return rp(_0x47b1e8)['then'](function(_0x3c76ba){var _0x373cd4=JSON['parse'](_0x3c76ba);if(_0x373cd4[_0x58b3('0x1e')]){_0x4f4785[_0x58b3('0x1f')]=_0x373cd4[_0x58b3('0x1e')];logger['info'](util[_0x58b3('0x20')](_0x58b3('0x21'),_0x4f4785[_0x58b3('0x22')],_0x4f4785['id']));}else{logger['error'](util[_0x58b3('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f4785[_0x58b3('0x22')],_0x4f4785['id']),util[_0x58b3('0x23')](_0x373cd4,{'showHidden':![],'depth':null}));}return _0x284d37(null,_0x2a5351);})[_0x58b3('0x24')](function(_0x5b8ad3){logger[_0x58b3('0x25')](util[_0x58b3('0x20')](_0x58b3('0x26'),_0x4f4785[_0x58b3('0x22')],_0x4f4785['id']),util[_0x58b3('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x284d37(_0x5b8ad3);});}else{return _0x284d37(null,_0x2a5351);}},'beforeUpdate':function(_0x11b60a,_0x390acc,_0x128458){if(_0x11b60a[_0x58b3('0xd')](_0x58b3('0xe'))||_0x11b60a['changed'](_0x58b3('0xf'))||_0x11b60a['changed'](_0x58b3('0x1b'))||_0x11b60a['changed'](_0x58b3('0x10'))||_0x11b60a[_0x58b3('0xd')](_0x58b3('0x1c'))||_0x11b60a[_0x58b3('0xd')](_0x58b3('0x11'))){var _0x4d23e3,_0x5af279;_0x4d23e3=_0x11b60a['serverUrl'];var _0x5b1ac0=_0x4d23e3[_0x58b3('0x12')](-0x1);if(_0x5b1ac0==='/'||_0x5b1ac0==='\x5c'||_0x5b1ac0===':'){_0x4d23e3=_0x4d23e3[_0x58b3('0x13')](0x0,_0x4d23e3[_0x58b3('0x14')](_0x5b1ac0));}switch(_0x11b60a[_0x58b3('0xe')]){case'US':_0x5af279=_0x58b3('0x15');break;case'AU':_0x5af279=_0x58b3('0x16');break;case'IN':_0x5af279=_0x58b3('0x17');break;case'CN':_0x5af279=_0x58b3('0x27');break;default:_0x5af279=_0x58b3('0x18');break;}var _0x513b20={'method':'POST','uri':_0x5af279+_0x58b3('0x1a'),'form':{'grant_type':_0x58b3('0x28'),'client_id':_0x11b60a[_0x58b3('0x1b')],'client_secret':_0x11b60a[_0x58b3('0x10')],'redirect_uri':_0x11b60a['serverUrl'],'code':_0x11b60a['code']},'headers':{'Content-Type':_0x58b3('0x1d')}};return rp(_0x513b20)['then'](function(_0x247606){var _0x496963=JSON['parse'](_0x247606);if(_0x496963['refresh_token']){_0x11b60a['refreshToken']=_0x496963[_0x58b3('0x1e')];logger['info'](util[_0x58b3('0x20')](_0x58b3('0x21'),_0x11b60a[_0x58b3('0x22')],_0x11b60a['id']));}else{logger[_0x58b3('0x25')](util[_0x58b3('0x20')](_0x58b3('0x26'),_0x11b60a[_0x58b3('0x22')],_0x11b60a['id']),util['inspect'](_0x496963,{'showHidden':![],'depth':null}));}return _0x128458(null,_0x390acc);})[_0x58b3('0x24')](function(_0x8e08da){logger[_0x58b3('0x25')](util[_0x58b3('0x20')](_0x58b3('0x26'),_0x11b60a[_0x58b3('0x22')],_0x11b60a['id']),util[_0x58b3('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x128458(_0x8e08da);});}else{return _0x128458(null,_0x390acc);}}}});}; \ No newline at end of file +var _0x3caf=['https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','POST','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','util','api','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x2b5584,_0x2c1bab){var _0x3f8885=function(_0x4dc68c){while(--_0x4dc68c){_0x2b5584['push'](_0x2b5584['shift']());}};_0x3f8885(++_0x2c1bab);}(_0x3caf,0x108));var _0xf3ca=function(_0x582536,_0x3502ba){_0x582536=_0x582536-0x0;var _0x1d12fb=_0x3caf[_0x582536];return _0x1d12fb;};'use strict';var _=require('lodash');var util=require(_0xf3ca('0x0'));var logger=require('../../config/logger')(_0xf3ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf3ca('0x2'));var fs=require('fs');var path=require(_0xf3ca('0x3'));var rimraf=require(_0xf3ca('0x4'));var config=require(_0xf3ca('0x5'));var attributes=require(_0xf3ca('0x6'));var integrations=require(_0xf3ca('0x7'));module[_0xf3ca('0x8')]=function(_0x44f097,_0x339c4c){return _0x44f097['define'](_0xf3ca('0x9'),attributes,{'tableName':_0xf3ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x497fec,_0x47b384,_0x20a791){if(_0x497fec[_0xf3ca('0xb')](_0xf3ca('0xc'))||_0x497fec['changed'](_0xf3ca('0xd'))||_0x497fec[_0xf3ca('0xb')](_0xf3ca('0xe'))||_0x497fec[_0xf3ca('0xb')](_0xf3ca('0xf'))||_0x497fec[_0xf3ca('0xb')](_0xf3ca('0x10'))||_0x497fec[_0xf3ca('0xb')]('host')){var _0x11b7b9,_0x374996;_0x11b7b9=_0x497fec[_0xf3ca('0xd')];var _0xfaaedd=_0x11b7b9[_0xf3ca('0x11')](-0x1);if(_0xfaaedd==='/'||_0xfaaedd==='\x5c'||_0xfaaedd===':'){_0x11b7b9=_0x11b7b9[_0xf3ca('0x12')](0x0,_0x11b7b9[_0xf3ca('0x13')](_0xfaaedd));}switch(_0x497fec[_0xf3ca('0xc')]){case'US':_0x374996=_0xf3ca('0x14');break;case'AU':_0x374996=_0xf3ca('0x15');break;case'IN':_0x374996=_0xf3ca('0x16');break;case'CN':_0x374996=_0xf3ca('0x17');break;default:_0x374996='https://accounts.zoho.eu';break;}var _0x36a81e={'method':'POST','uri':_0x374996+_0xf3ca('0x18'),'form':{'grant_type':_0xf3ca('0x19'),'client_id':_0x497fec['clientId'],'client_secret':_0x497fec[_0xf3ca('0xf')],'redirect_uri':_0x497fec[_0xf3ca('0xd')],'code':_0x497fec[_0xf3ca('0x10')]},'headers':{'Content-Type':_0xf3ca('0x1a')}};return rp(_0x36a81e)[_0xf3ca('0x1b')](function(_0x4e2a44){var _0x4b042f=JSON[_0xf3ca('0x1c')](_0x4e2a44);if(_0x4b042f[_0xf3ca('0x1d')]){_0x497fec['refreshToken']=_0x4b042f[_0xf3ca('0x1d')];logger[_0xf3ca('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x497fec['name'],_0x497fec['id']));}else{logger[_0xf3ca('0x1f')](util[_0xf3ca('0x20')](_0xf3ca('0x21'),_0x497fec['name'],_0x497fec['id']),util[_0xf3ca('0x22')](_0x4b042f,{'showHidden':![],'depth':null}));}return _0x20a791(null,_0x47b384);})[_0xf3ca('0x23')](function(_0x4605c0){logger[_0xf3ca('0x1f')](util[_0xf3ca('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x497fec['name'],_0x497fec['id']),util[_0xf3ca('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x20a791(_0x4605c0);});}else{return _0x20a791(null,_0x47b384);}},'beforeUpdate':function(_0x1dde01,_0x3a4331,_0x28b623){if(_0x1dde01[_0xf3ca('0xb')](_0xf3ca('0xc'))||_0x1dde01[_0xf3ca('0xb')](_0xf3ca('0xd'))||_0x1dde01[_0xf3ca('0xb')](_0xf3ca('0xe'))||_0x1dde01['changed']('clientSecret')||_0x1dde01[_0xf3ca('0xb')](_0xf3ca('0x10'))||_0x1dde01[_0xf3ca('0xb')](_0xf3ca('0x24'))){var _0x2dcf20,_0x2c12a3;_0x2dcf20=_0x1dde01['serverUrl'];var _0x2bb238=_0x2dcf20[_0xf3ca('0x11')](-0x1);if(_0x2bb238==='/'||_0x2bb238==='\x5c'||_0x2bb238===':'){_0x2dcf20=_0x2dcf20[_0xf3ca('0x12')](0x0,_0x2dcf20[_0xf3ca('0x13')](_0x2bb238));}switch(_0x1dde01['zone']){case'US':_0x2c12a3=_0xf3ca('0x14');break;case'AU':_0x2c12a3=_0xf3ca('0x15');break;case'IN':_0x2c12a3=_0xf3ca('0x16');break;case'CN':_0x2c12a3=_0xf3ca('0x17');break;default:_0x2c12a3='https://accounts.zoho.eu';break;}var _0x42073d={'method':_0xf3ca('0x25'),'uri':_0x2c12a3+_0xf3ca('0x18'),'form':{'grant_type':_0xf3ca('0x19'),'client_id':_0x1dde01[_0xf3ca('0xe')],'client_secret':_0x1dde01[_0xf3ca('0xf')],'redirect_uri':_0x1dde01[_0xf3ca('0xd')],'code':_0x1dde01[_0xf3ca('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x42073d)[_0xf3ca('0x1b')](function(_0x2ecf8e){var _0x46dc9c=JSON['parse'](_0x2ecf8e);if(_0x46dc9c['refresh_token']){_0x1dde01[_0xf3ca('0x26')]=_0x46dc9c[_0xf3ca('0x1d')];logger[_0xf3ca('0x1e')](util['format'](_0xf3ca('0x27'),_0x1dde01[_0xf3ca('0x28')],_0x1dde01['id']));}else{logger['error'](util[_0xf3ca('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1dde01[_0xf3ca('0x28')],_0x1dde01['id']),util['inspect'](_0x46dc9c,{'showHidden':![],'depth':null}));}return _0x28b623(null,_0x3a4331);})[_0xf3ca('0x23')](function(_0x36e932){logger[_0xf3ca('0x1f')](util[_0xf3ca('0x20')](_0xf3ca('0x21'),_0x1dde01[_0xf3ca('0x28')],_0x1dde01['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x28b623(_0x36e932);});}else{return _0x28b623(null,_0x3a4331);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bd8b0a0..c9649d4 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 _0xc373=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetZohoAccount','find','ShowZohoAccount'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xc373,0x1c7));var _0x3c37=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0xc373[_0x1f7996];return _0x584609;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1941,_0x1244e6,_0x14b09d){return new BPromise(function(_0x10617,_0x465de6){return client[_0x3c37('0x9')](_0x2e1941,_0x14b09d)[_0x3c37('0xa')](function(_0x59d4f9){logger[_0x3c37('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x1244e6,'request\x20sent');logger[_0x3c37('0xc')](_0x3c37('0xd'),_0x1244e6,_0x3c37('0xe'),JSON[_0x3c37('0xf')](_0x59d4f9));if(_0x59d4f9[_0x3c37('0x10')]){if(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0x12'),_0x1244e6,_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);return _0x465de6(_0x59d4f9['error']['message']);}logger[_0x3c37('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1244e6,_0x59d4f9['error'][_0x3c37('0x13')]);return _0x10617(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);}else{logger[_0x3c37('0xb')](_0x3c37('0x12'),_0x1244e6,_0x3c37('0xe'));_0x10617(_0x59d4f9[_0x3c37('0x14')][_0x3c37('0x13')]);}})[_0x3c37('0x15')](function(_0x4e1560){logger[_0x3c37('0x10')](_0x3c37('0x12'),_0x1244e6,_0x4e1560);_0x465de6(_0x4e1560);});});}exports['GetZohoAccount']=function(_0x55761e){var _0x3ae991=this;return new Promise(function(_0x12a47c,_0x2f3f34){return db[_0x3c37('0x16')][_0x3c37('0x17')]({'raw':_0x55761e[_0x3c37('0x18')]?_0x55761e['options'][_0x3c37('0x19')]===undefined?!![]:![]:!![],'where':_0x55761e['options']?_0x55761e['options'][_0x3c37('0x1a')]||null:null,'attributes':_0x55761e[_0x3c37('0x18')]?_0x55761e[_0x3c37('0x18')][_0x3c37('0x1b')]||null:null,'limit':_0x55761e[_0x3c37('0x18')]?_0x55761e['options'][_0x3c37('0x1c')]||null:null,'include':_0x55761e['options']?_0x55761e[_0x3c37('0x18')]['include']?_[_0x3c37('0x1d')](_0x55761e[_0x3c37('0x18')][_0x3c37('0x1e')],function(_0x574890){return{'model':db[_0x574890['model']],'as':_0x574890['as'],'attributes':_0x574890['attributes'],'include':_0x574890['include']?_['map'](_0x574890[_0x3c37('0x1e')],function(_0xb334d0){return{'model':db[_0xb334d0[_0x3c37('0x1f')]],'as':_0xb334d0['as'],'attributes':_0xb334d0[_0x3c37('0x1b')],'include':_0xb334d0['include']?_['map'](_0xb334d0['include'],function(_0x65ac66){return{'model':db[_0x65ac66[_0x3c37('0x1f')]],'as':_0x65ac66['as'],'attributes':_0x65ac66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ba7e0){logger[_0x3c37('0xb')](_0x3c37('0x20'),_0x55761e);logger[_0x3c37('0xc')](_0x3c37('0x20'),_0x55761e,JSON[_0x3c37('0xf')](_0x1ba7e0));_0x12a47c(_0x1ba7e0);})[_0x3c37('0x15')](function(_0x3abacf){logger[_0x3c37('0x10')](_0x3c37('0x20'),_0x3abacf['message'],_0x55761e);_0x2f3f34(_0x3ae991[_0x3c37('0x10')](0x1f4,_0x3abacf[_0x3c37('0x13')]));});});};exports['ShowZohoAccount']=function(_0x579142){var _0x14936d=this;return new Promise(function(_0x3bc99a,_0x35590b){return db['ZohoAccount'][_0x3c37('0x21')]({'raw':_0x579142['options']?_0x579142[_0x3c37('0x18')][_0x3c37('0x19')]===undefined?!![]:![]:!![],'where':_0x579142[_0x3c37('0x18')]?_0x579142[_0x3c37('0x18')][_0x3c37('0x1a')]||null:null,'attributes':_0x579142[_0x3c37('0x18')]?_0x579142[_0x3c37('0x18')][_0x3c37('0x1b')]||null:null,'include':_0x579142[_0x3c37('0x18')]?_0x579142[_0x3c37('0x18')]['include']?_['map'](_0x579142['options'][_0x3c37('0x1e')],function(_0x4502c2){return{'model':db[_0x4502c2[_0x3c37('0x1f')]],'as':_0x4502c2['as'],'attributes':_0x4502c2[_0x3c37('0x1b')],'include':_0x4502c2[_0x3c37('0x1e')]?_[_0x3c37('0x1d')](_0x4502c2[_0x3c37('0x1e')],function(_0xd72614){return{'model':db[_0xd72614[_0x3c37('0x1f')]],'as':_0xd72614['as'],'attributes':_0xd72614[_0x3c37('0x1b')],'include':_0xd72614[_0x3c37('0x1e')]?_[_0x3c37('0x1d')](_0xd72614['include'],function(_0xecdc5b){return{'model':db[_0xecdc5b[_0x3c37('0x1f')]],'as':_0xecdc5b['as'],'attributes':_0xecdc5b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a3f5b){logger[_0x3c37('0xb')](_0x3c37('0x22'),_0x579142);logger[_0x3c37('0xc')](_0x3c37('0x22'),_0x579142,JSON[_0x3c37('0xf')](_0x3a3f5b));_0x3bc99a(_0x3a3f5b);})[_0x3c37('0x15')](function(_0x12053a){logger[_0x3c37('0x10')]('ShowZohoAccount',_0x12053a[_0x3c37('0x13')],_0x579142);_0x35590b(_0x14936d[_0x3c37('0x10')](0x1f4,_0x12053a[_0x3c37('0x13')]));});});}; \ No newline at end of file +var _0xc3ed=['request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','map','model','include','stringify','catch','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xc3ed,0x111));var _0xdc3e=function(_0x2c5b89,_0x17f52f){_0x2c5b89=_0x2c5b89-0x0;var _0x47e4b6=_0xc3ed[_0x2c5b89];return _0x47e4b6;};'use strict';var _=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var moment=require('moment');var BPromise=require(_0xdc3e('0x2'));var rs=require(_0xdc3e('0x3'));var fs=require('fs');var Redis=require(_0xdc3e('0x4'));var db=require(_0xdc3e('0x5'))['db'];var utils=require(_0xdc3e('0x6'));var logger=require('../../config/logger')(_0xdc3e('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc3e('0x8'));var client=jayson[_0xdc3e('0x9')][_0xdc3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49e3f3,_0xd0916c,_0x4506d1){return new BPromise(function(_0x358cb8,_0x4f8345){return client[_0xdc3e('0xb')](_0x49e3f3,_0x4506d1)[_0xdc3e('0xc')](function(_0x3becac){logger[_0xdc3e('0xd')](_0xdc3e('0xe'),_0xd0916c,_0xdc3e('0xf'));logger[_0xdc3e('0x10')](_0xdc3e('0x11'),_0xd0916c,_0xdc3e('0xf'),JSON['stringify'](_0x3becac));if(_0x3becac[_0xdc3e('0x12')]){if(_0x3becac[_0xdc3e('0x12')][_0xdc3e('0x13')]===0x1f4){logger['error'](_0xdc3e('0xe'),_0xd0916c,_0x3becac['error'][_0xdc3e('0x14')]);return _0x4f8345(_0x3becac[_0xdc3e('0x12')]['message']);}logger['error'](_0xdc3e('0xe'),_0xd0916c,_0x3becac['error'][_0xdc3e('0x14')]);return _0x358cb8(_0x3becac[_0xdc3e('0x12')][_0xdc3e('0x14')]);}else{logger['info'](_0xdc3e('0xe'),_0xd0916c,_0xdc3e('0xf'));_0x358cb8(_0x3becac[_0xdc3e('0x15')][_0xdc3e('0x14')]);}})['catch'](function(_0x832b8c){logger[_0xdc3e('0x12')](_0xdc3e('0xe'),_0xd0916c,_0x832b8c);_0x4f8345(_0x832b8c);});});}exports[_0xdc3e('0x16')]=function(_0x4d1136){var _0x406d90=this;return new Promise(function(_0x1a0890,_0x1019b8){return db[_0xdc3e('0x17')][_0xdc3e('0x18')]({'raw':_0x4d1136[_0xdc3e('0x19')]?_0x4d1136[_0xdc3e('0x19')][_0xdc3e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d1136[_0xdc3e('0x19')]?_0x4d1136[_0xdc3e('0x19')][_0xdc3e('0x1b')]||null:null,'attributes':_0x4d1136[_0xdc3e('0x19')]?_0x4d1136[_0xdc3e('0x19')][_0xdc3e('0x1c')]||null:null,'limit':_0x4d1136['options']?_0x4d1136[_0xdc3e('0x19')]['limit']||null:null,'include':_0x4d1136[_0xdc3e('0x19')]?_0x4d1136[_0xdc3e('0x19')]['include']?_[_0xdc3e('0x1d')](_0x4d1136[_0xdc3e('0x19')]['include'],function(_0x31bb6a){return{'model':db[_0x31bb6a[_0xdc3e('0x1e')]],'as':_0x31bb6a['as'],'attributes':_0x31bb6a[_0xdc3e('0x1c')],'include':_0x31bb6a[_0xdc3e('0x1f')]?_[_0xdc3e('0x1d')](_0x31bb6a[_0xdc3e('0x1f')],function(_0x5d597f){return{'model':db[_0x5d597f[_0xdc3e('0x1e')]],'as':_0x5d597f['as'],'attributes':_0x5d597f['attributes'],'include':_0x5d597f[_0xdc3e('0x1f')]?_[_0xdc3e('0x1d')](_0x5d597f[_0xdc3e('0x1f')],function(_0x519a09){return{'model':db[_0x519a09[_0xdc3e('0x1e')]],'as':_0x519a09['as'],'attributes':_0x519a09[_0xdc3e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdc3e('0xc')](function(_0x25887f){logger['info'](_0xdc3e('0x16'),_0x4d1136);logger['debug']('GetZohoAccount',_0x4d1136,JSON[_0xdc3e('0x20')](_0x25887f));_0x1a0890(_0x25887f);})[_0xdc3e('0x21')](function(_0x1168bb){logger[_0xdc3e('0x12')](_0xdc3e('0x16'),_0x1168bb['message'],_0x4d1136);_0x1019b8(_0x406d90['error'](0x1f4,_0x1168bb[_0xdc3e('0x14')]));});});};exports[_0xdc3e('0x22')]=function(_0x2cd904){var _0x2eced9=this;return new Promise(function(_0x4f69e7,_0x49b97d){return db[_0xdc3e('0x17')][_0xdc3e('0x23')]({'raw':_0x2cd904[_0xdc3e('0x19')]?_0x2cd904[_0xdc3e('0x19')][_0xdc3e('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cd904[_0xdc3e('0x19')]?_0x2cd904[_0xdc3e('0x19')][_0xdc3e('0x1b')]||null:null,'attributes':_0x2cd904[_0xdc3e('0x19')]?_0x2cd904[_0xdc3e('0x19')][_0xdc3e('0x1c')]||null:null,'include':_0x2cd904['options']?_0x2cd904[_0xdc3e('0x19')]['include']?_[_0xdc3e('0x1d')](_0x2cd904[_0xdc3e('0x19')][_0xdc3e('0x1f')],function(_0x76366d){return{'model':db[_0x76366d[_0xdc3e('0x1e')]],'as':_0x76366d['as'],'attributes':_0x76366d[_0xdc3e('0x1c')],'include':_0x76366d[_0xdc3e('0x1f')]?_['map'](_0x76366d[_0xdc3e('0x1f')],function(_0x1dee65){return{'model':db[_0x1dee65[_0xdc3e('0x1e')]],'as':_0x1dee65['as'],'attributes':_0x1dee65[_0xdc3e('0x1c')],'include':_0x1dee65[_0xdc3e('0x1f')]?_[_0xdc3e('0x1d')](_0x1dee65[_0xdc3e('0x1f')],function(_0x2df2bc){return{'model':db[_0x2df2bc[_0xdc3e('0x1e')]],'as':_0x2df2bc['as'],'attributes':_0x2df2bc[_0xdc3e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdc3e('0xc')](function(_0x4753a6){logger[_0xdc3e('0xd')]('ShowZohoAccount',_0x2cd904);logger[_0xdc3e('0x10')](_0xdc3e('0x22'),_0x2cd904,JSON[_0xdc3e('0x20')](_0x4753a6));_0x4f69e7(_0x4753a6);})[_0xdc3e('0x21')](function(_0x325532){logger[_0xdc3e('0x12')](_0xdc3e('0x22'),_0x325532[_0xdc3e('0x14')],_0x2cd904);_0x49b97d(_0x2eced9[_0xdc3e('0x12')](0x1f4,_0x325532['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7964ef8..a07c3cb 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 _0x973a=['getSubjects','/:id/descriptions','put','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x973a,0x113));var _0xa973=function(_0xacec9a,_0x2cecb9){_0xacec9a=_0xacec9a-0x0;var _0x31be8b=_0x973a[_0xacec9a];return _0x31be8b;};'use strict';var multer=require(_0xa973('0x0'));var util=require('util');var path=require(_0xa973('0x1'));var timeout=require('connect-timeout');var express=require(_0xa973('0x2'));var router=express['Router']();var fs_extra=require(_0xa973('0x3'));var auth=require(_0xa973('0x4'));var interaction=require(_0xa973('0x5'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa973('0x6')]('/',auth['isAuthenticated'](),controller[_0xa973('0x7')]);router['get'](_0xa973('0x8'),auth[_0xa973('0x9')](),controller[_0xa973('0xa')]);router[_0xa973('0x6')]('/:id/fields',auth[_0xa973('0x9')](),controller[_0xa973('0xb')]);router['get'](_0xa973('0xc'),auth[_0xa973('0x9')](),controller[_0xa973('0xd')]);router[_0xa973('0x6')](_0xa973('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xa973('0x9')](),controller['create']);router[_0xa973('0xf')](_0xa973('0x8'),auth[_0xa973('0x9')](),controller['update']);router['delete'](_0xa973('0x8'),auth[_0xa973('0x9')](),controller[_0xa973('0x10')]);module[_0xa973('0x11')]=router; \ No newline at end of file +var _0x99f1=['post','create','put','update','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x49f73b,_0xb9428){var _0x530a57=function(_0x79220a){while(--_0x79220a){_0x49f73b['push'](_0x49f73b['shift']());}};_0x530a57(++_0xb9428);}(_0x99f1,0x11a));var _0x199f=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x99f1[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0x199f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x199f('0x1'));var express=require('express');var router=express[_0x199f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x199f('0x3'));var interaction=require(_0x199f('0x4'));var config=require(_0x199f('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x199f('0x6')]('/',auth[_0x199f('0x7')](),controller[_0x199f('0x8')]);router[_0x199f('0x6')](_0x199f('0x9'),auth['isAuthenticated'](),controller[_0x199f('0xa')]);router['get'](_0x199f('0xb'),auth[_0x199f('0x7')](),controller[_0x199f('0xc')]);router[_0x199f('0x6')](_0x199f('0xd'),auth['isAuthenticated'](),controller[_0x199f('0xe')]);router[_0x199f('0x6')](_0x199f('0xf'),auth['isAuthenticated'](),controller[_0x199f('0x10')]);router[_0x199f('0x11')]('/',auth['isAuthenticated'](),controller[_0x199f('0x12')]);router[_0x199f('0x13')](_0x199f('0x9'),auth[_0x199f('0x7')](),controller[_0x199f('0x14')]);router[_0x199f('0x15')](_0x199f('0x9'),auth[_0x199f('0x7')](),controller[_0x199f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ad94765..90e9eed 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 _0x7a6f=['lead','contact','contact_lead','STRING','sequelize','ENUM'];(function(_0x4d2c37,_0x13ccbe){var _0x242f8a=function(_0x4f8254){while(--_0x4f8254){_0x4d2c37['push'](_0x4d2c37['shift']());}};_0x242f8a(++_0x13ccbe);}(_0x7a6f,0x148));var _0xf7a6=function(_0x5a16f9,_0x2d1df1){_0x5a16f9=_0x5a16f9-0x0;var _0x51ace9=_0x7a6f[_0x5a16f9];return _0x51ace9;};'use strict';var Sequelize=require(_0xf7a6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf7a6('0x1')](_0xf7a6('0x2'),_0xf7a6('0x3'),'nothing'),'defaultValue':_0xf7a6('0x2')},'moduleSearch':{'type':Sequelize[_0xf7a6('0x1')](_0xf7a6('0x4'),_0xf7a6('0x3'),_0xf7a6('0x2')),'defaultValue':_0xf7a6('0x4')},'description':{'type':Sequelize[_0xf7a6('0x5')]}}; \ No newline at end of file +var _0xa553=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x491be2,_0x2fc843){var _0x821f14=function(_0x2d7c1a){while(--_0x2d7c1a){_0x491be2['push'](_0x491be2['shift']());}};_0x821f14(++_0x2fc843);}(_0xa553,0x158));var _0x3a55=function(_0x45cd5c,_0x57904d){_0x45cd5c=_0x45cd5c-0x0;var _0x572ea8=_0xa553[_0x45cd5c];return _0x572ea8;};'use strict';var Sequelize=require(_0x3a55('0x0'));module[_0x3a55('0x1')]={'name':{'type':Sequelize[_0x3a55('0x2')]},'moduleCreate':{'type':Sequelize[_0x3a55('0x3')](_0x3a55('0x4'),_0x3a55('0x5'),_0x3a55('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x3a55('0x3')](_0x3a55('0x7'),_0x3a55('0x5'),_0x3a55('0x4')),'defaultValue':_0x3a55('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f7d641a..67a9a5c 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 _0xa055=['squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','ZohoConfiguration','includeAll','include','show','params','options','find','create','body','catch','ZohoField','pick','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa055,0x132));var _0x5a05=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0xa055[_0x4cb231];return _0x4d5063;};'use strict';var emlformat=require(_0x5a05('0x0'));var rimraf=require(_0x5a05('0x1'));var zipdir=require(_0x5a05('0x2'));var jsonpatch=require(_0x5a05('0x3'));var rp=require('request-promise');var moment=require(_0x5a05('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a05('0x5'));var util=require(_0x5a05('0x6'));var path=require('path');var sox=require(_0x5a05('0x7'));var csv=require('to-csv');var ejs=require(_0x5a05('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a05('0x9'));var squel=require(_0x5a05('0xa'));var crypto=require(_0x5a05('0xb'));var jsforce=require(_0x5a05('0xc'));var deskjs=require(_0x5a05('0xd'));var toCsv=require(_0x5a05('0xe'));var querystring=require(_0x5a05('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5a05('0x10'));var qs=require(_0x5a05('0x11'));var as=require(_0x5a05('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a05('0x13'))(_0x5a05('0x14'));var utils=require(_0x5a05('0x15'));var config=require(_0x5a05('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a05('0x17'))['db'];function respondWithStatusCode(_0x508f93,_0x2f3c81){_0x2f3c81=_0x2f3c81||0xcc;return function(_0x355e03){if(_0x355e03){return _0x508f93[_0x5a05('0x18')](_0x2f3c81);}return _0x508f93['status'](_0x2f3c81)[_0x5a05('0x19')]();};}function respondWithResult(_0x445706,_0x183831){_0x183831=_0x183831||0xc8;return function(_0x62eb90){if(_0x62eb90){return _0x445706['status'](_0x183831)['json'](_0x62eb90);}};}function respondWithFilteredResult(_0x5d973d,_0x28de29){return function(_0x440369){if(_0x440369){var _0x43f20b=typeof _0x28de29['offset']===_0x5a05('0x1a')&&typeof _0x28de29['limit']===_0x5a05('0x1a');var _0x51f8c6=_0x440369[_0x5a05('0x1b')];var _0x3a57d3=_0x43f20b?0x0:_0x28de29[_0x5a05('0x1c')];var _0x38c25e=_0x43f20b?_0x440369['count']:_0x28de29['offset']+_0x28de29[_0x5a05('0x1d')];var _0x22fdf6;if(_0x38c25e>=_0x51f8c6){_0x38c25e=_0x51f8c6;_0x22fdf6=0xc8;}else{_0x22fdf6=0xce;}_0x5d973d[_0x5a05('0x1e')](_0x22fdf6);return _0x5d973d[_0x5a05('0x1f')](_0x5a05('0x20'),_0x3a57d3+'-'+_0x38c25e+'/'+_0x51f8c6)[_0x5a05('0x21')](_0x440369);}return null;};}function patchUpdates(_0x408a06){return function(_0x25b1b9){try{jsonpatch['apply'](_0x25b1b9,_0x408a06,!![]);}catch(_0x3f6cc8){return BPromise[_0x5a05('0x22')](_0x3f6cc8);}return _0x25b1b9[_0x5a05('0x23')]();};}function saveUpdates(_0x59d647,_0x45588b){return function(_0x17359c){if(_0x17359c){return _0x17359c[_0x5a05('0x24')](_0x59d647)[_0x5a05('0x25')](function(_0x1f985b){return _0x1f985b;});}return null;};}function removeEntity(_0x15f52c,_0x539597){return function(_0x5d5433){if(_0x5d5433){return _0x5d5433[_0x5a05('0x26')]()[_0x5a05('0x25')](function(){_0x15f52c[_0x5a05('0x1e')](0xcc)[_0x5a05('0x19')]();});}};}function handleEntityNotFound(_0x5da4cd,_0x1f6a44){return function(_0x2a917c){if(!_0x2a917c){_0x5da4cd[_0x5a05('0x18')](0x194);}return _0x2a917c;};}function handleError(_0x205020,_0x243679){_0x243679=_0x243679||0x1f4;return function(_0x2f4b7b){logger[_0x5a05('0x27')](_0x2f4b7b[_0x5a05('0x28')]);if(_0x2f4b7b['name']){delete _0x2f4b7b[_0x5a05('0x29')];}_0x205020['status'](_0x243679)['send'](_0x2f4b7b);};}exports[_0x5a05('0x2a')]=function(_0x24176e,_0x1e3d9a){var _0x3d517b={},_0x2ff4cb={},_0x56f716={'count':0x0,'rows':[]};var _0x234149=_[_0x5a05('0x2b')](db['ZohoConfiguration'][_0x5a05('0x2c')],function(_0x4b3a62){return{'name':_0x4b3a62['fieldName'],'type':_0x4b3a62[_0x5a05('0x2d')][_0x5a05('0x2e')]};});_0x2ff4cb[_0x5a05('0x2f')]=_[_0x5a05('0x2b')](_0x234149,'name');_0x2ff4cb['query']=_[_0x5a05('0x30')](_0x24176e[_0x5a05('0x31')]);_0x2ff4cb[_0x5a05('0x32')]=_[_0x5a05('0x33')](_0x2ff4cb[_0x5a05('0x2f')],_0x2ff4cb[_0x5a05('0x31')]);_0x3d517b[_0x5a05('0x34')]=_[_0x5a05('0x33')](_0x2ff4cb[_0x5a05('0x2f')],qs[_0x5a05('0x35')](_0x24176e[_0x5a05('0x31')]['fields']));_0x3d517b['attributes']=_0x3d517b[_0x5a05('0x34')][_0x5a05('0x36')]?_0x3d517b['attributes']:_0x2ff4cb['model'];if(!_0x24176e[_0x5a05('0x31')]['hasOwnProperty'](_0x5a05('0x37'))){_0x3d517b['limit']=qs['limit'](_0x24176e[_0x5a05('0x31')][_0x5a05('0x1d')]);_0x3d517b[_0x5a05('0x1c')]=qs['offset'](_0x24176e['query'][_0x5a05('0x1c')]);}_0x3d517b[_0x5a05('0x38')]=qs['sort'](_0x24176e['query'][_0x5a05('0x39')]);_0x3d517b[_0x5a05('0x3a')]=qs[_0x5a05('0x32')](_['pick'](_0x24176e[_0x5a05('0x31')],_0x2ff4cb[_0x5a05('0x32')]),_0x234149);if(_0x24176e[_0x5a05('0x31')][_0x5a05('0x3b')]){_0x3d517b[_0x5a05('0x3a')]=_[_0x5a05('0x3c')](_0x3d517b[_0x5a05('0x3a')],{'$or':_[_0x5a05('0x2b')](_0x234149,function(_0x39f25b){if(_0x39f25b[_0x5a05('0x2d')]!==_0x5a05('0x3d')){var _0x298807={};_0x298807[_0x39f25b['name']]={'$like':'%'+_0x24176e[_0x5a05('0x31')]['filter']+'%'};return _0x298807;}})});}_0x3d517b=_[_0x5a05('0x3c')]({},_0x3d517b,_0x24176e['options']);var _0x25e0ae={'where':_0x3d517b[_0x5a05('0x3a')]};return db[_0x5a05('0x3e')][_0x5a05('0x1b')](_0x25e0ae)[_0x5a05('0x25')](function(_0x15e686){_0x56f716[_0x5a05('0x1b')]=_0x15e686;if(_0x24176e[_0x5a05('0x31')][_0x5a05('0x3f')]){_0x3d517b[_0x5a05('0x40')]=[{'all':!![]}];}return db[_0x5a05('0x3e')]['findAll'](_0x3d517b);})[_0x5a05('0x25')](function(_0x3d93ec){_0x56f716['rows']=_0x3d93ec;return _0x56f716;})[_0x5a05('0x25')](respondWithFilteredResult(_0x1e3d9a,_0x3d517b))['catch'](handleError(_0x1e3d9a,null));};exports[_0x5a05('0x41')]=function(_0x1eedc7,_0x5046c5){var _0x97ed54={'raw':![],'where':{'id':_0x1eedc7[_0x5a05('0x42')]['id']}},_0x1a00b7={};_0x1a00b7[_0x5a05('0x2f')]=_['keys'](db[_0x5a05('0x3e')]['rawAttributes']);_0x1a00b7[_0x5a05('0x31')]=_[_0x5a05('0x30')](_0x1eedc7[_0x5a05('0x31')]);_0x1a00b7[_0x5a05('0x32')]=_['intersection'](_0x1a00b7[_0x5a05('0x2f')],_0x1a00b7[_0x5a05('0x31')]);_0x97ed54[_0x5a05('0x34')]=_[_0x5a05('0x33')](_0x1a00b7['model'],qs[_0x5a05('0x35')](_0x1eedc7[_0x5a05('0x31')][_0x5a05('0x35')]));_0x97ed54[_0x5a05('0x34')]=_0x97ed54['attributes']['length']?_0x97ed54['attributes']:_0x1a00b7['model'];if(_0x1eedc7[_0x5a05('0x31')][_0x5a05('0x3f')]){_0x97ed54[_0x5a05('0x40')]=[{'all':!![]}];}_0x97ed54=_[_0x5a05('0x3c')]({},_0x97ed54,_0x1eedc7[_0x5a05('0x43')]);return db['ZohoConfiguration'][_0x5a05('0x44')](_0x97ed54)[_0x5a05('0x25')](handleEntityNotFound(_0x5046c5,null))[_0x5a05('0x25')](respondWithResult(_0x5046c5,null))['catch'](handleError(_0x5046c5,null));};exports[_0x5a05('0x45')]=function(_0xb88a3d,_0x23874e){return db[_0x5a05('0x3e')][_0x5a05('0x45')](_0xb88a3d['body'],{})[_0x5a05('0x25')](respondWithResult(_0x23874e,0xc9))['catch'](handleError(_0x23874e,null));};exports[_0x5a05('0x24')]=function(_0x1eabef,_0x34cd9d){if(_0x1eabef['body']['id']){delete _0x1eabef[_0x5a05('0x46')]['id'];}return db['ZohoConfiguration'][_0x5a05('0x44')]({'where':{'id':_0x1eabef[_0x5a05('0x42')]['id']}})[_0x5a05('0x25')](handleEntityNotFound(_0x34cd9d,null))[_0x5a05('0x25')](saveUpdates(_0x1eabef[_0x5a05('0x46')],null))[_0x5a05('0x25')](respondWithResult(_0x34cd9d,null))['catch'](handleError(_0x34cd9d,null));};exports[_0x5a05('0x26')]=function(_0x4a349a,_0x3ebe08){return db[_0x5a05('0x3e')][_0x5a05('0x44')]({'where':{'id':_0x4a349a[_0x5a05('0x42')]['id']}})[_0x5a05('0x25')](handleEntityNotFound(_0x3ebe08,null))[_0x5a05('0x25')](removeEntity(_0x3ebe08,null))[_0x5a05('0x47')](handleError(_0x3ebe08,null));};exports['getFields']=function(_0x5d0225,_0x18e3bf,_0x3ec814){var _0x582e65={};var _0x4959c7={};var _0x11bdfb;var _0x47e754;return db[_0x5a05('0x3e')]['findOne']({'where':{'id':_0x5d0225['params']['id']}})[_0x5a05('0x25')](handleEntityNotFound(_0x18e3bf,null))[_0x5a05('0x25')](function(_0x22f20c){if(_0x22f20c){_0x11bdfb=_0x22f20c;_0x4959c7['model']=_['keys'](db[_0x5a05('0x48')][_0x5a05('0x2c')]);_0x4959c7[_0x5a05('0x31')]=_[_0x5a05('0x30')](_0x5d0225[_0x5a05('0x31')]);_0x4959c7['filters']=_[_0x5a05('0x33')](_0x4959c7[_0x5a05('0x2f')],_0x4959c7[_0x5a05('0x31')]);_0x582e65[_0x5a05('0x34')]=_[_0x5a05('0x33')](_0x4959c7[_0x5a05('0x2f')],qs[_0x5a05('0x35')](_0x5d0225[_0x5a05('0x31')][_0x5a05('0x35')]));_0x582e65[_0x5a05('0x34')]=_0x582e65[_0x5a05('0x34')][_0x5a05('0x36')]?_0x582e65[_0x5a05('0x34')]:_0x4959c7['model'];_0x582e65[_0x5a05('0x38')]=qs['sort'](_0x5d0225['query'][_0x5a05('0x39')]);_0x582e65[_0x5a05('0x3a')]=qs[_0x5a05('0x32')](_[_0x5a05('0x49')](_0x5d0225[_0x5a05('0x31')],_0x4959c7[_0x5a05('0x32')]));if(_0x5d0225[_0x5a05('0x31')]['filter']){_0x582e65[_0x5a05('0x3a')]=_[_0x5a05('0x3c')](_0x582e65['where'],{'$or':_[_0x5a05('0x2b')](_0x582e65['attributes'],function(_0x4aba46){var _0x149753={};_0x149753[_0x4aba46]={'$like':'%'+_0x5d0225[_0x5a05('0x31')]['filter']+'%'};return _0x149753;})});}_0x582e65=_[_0x5a05('0x3c')]({},_0x582e65,_0x5d0225[_0x5a05('0x43')]);return _0x11bdfb[_0x5a05('0x4a')](_0x582e65);}})[_0x5a05('0x25')](function(_0x2b3dee){if(_0x2b3dee){_0x47e754=_0x2b3dee['length'];if(!_0x5d0225[_0x5a05('0x31')][_0x5a05('0x4b')](_0x5a05('0x37'))){_0x582e65[_0x5a05('0x1d')]=qs[_0x5a05('0x1d')](_0x5d0225[_0x5a05('0x31')]['limit']);_0x582e65[_0x5a05('0x1c')]=qs[_0x5a05('0x1c')](_0x5d0225[_0x5a05('0x31')]['offset']);}return _0x11bdfb['getFields'](_0x582e65);}})[_0x5a05('0x25')](function(_0x2cea0b){if(_0x2cea0b){return _0x2cea0b?{'count':_0x47e754,'rows':_0x2cea0b}:null;}})[_0x5a05('0x25')](respondWithResult(_0x18e3bf,null))[_0x5a05('0x47')](handleError(_0x18e3bf,null));};exports[_0x5a05('0x4c')]=function(_0x2d17ac,_0x3b8f4d,_0x2d9a5f){var _0x2435d0={};var _0xe29b33={};var _0xf874b2;var _0x44ba7d;return db['ZohoConfiguration'][_0x5a05('0x4d')]({'where':{'id':_0x2d17ac[_0x5a05('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b8f4d,null))[_0x5a05('0x25')](function(_0x2f0680){if(_0x2f0680){_0xf874b2=_0x2f0680;_0xe29b33['model']=_[_0x5a05('0x30')](db[_0x5a05('0x48')]['rawAttributes']);_0xe29b33[_0x5a05('0x31')]=_[_0x5a05('0x30')](_0x2d17ac['query']);_0xe29b33[_0x5a05('0x32')]=_[_0x5a05('0x33')](_0xe29b33['model'],_0xe29b33['query']);_0x2435d0['attributes']=_[_0x5a05('0x33')](_0xe29b33[_0x5a05('0x2f')],qs[_0x5a05('0x35')](_0x2d17ac[_0x5a05('0x31')][_0x5a05('0x35')]));_0x2435d0[_0x5a05('0x34')]=_0x2435d0[_0x5a05('0x34')][_0x5a05('0x36')]?_0x2435d0['attributes']:_0xe29b33[_0x5a05('0x2f')];_0x2435d0[_0x5a05('0x38')]=qs[_0x5a05('0x39')](_0x2d17ac[_0x5a05('0x31')]['sort']);_0x2435d0['where']=qs['filters'](_['pick'](_0x2d17ac['query'],_0xe29b33[_0x5a05('0x32')]));if(_0x2d17ac[_0x5a05('0x31')][_0x5a05('0x3b')]){_0x2435d0['where']=_[_0x5a05('0x3c')](_0x2435d0[_0x5a05('0x3a')],{'$or':_[_0x5a05('0x2b')](_0x2435d0[_0x5a05('0x34')],function(_0x7877ba){var _0x1b4a18={};_0x1b4a18[_0x7877ba]={'$like':'%'+_0x2d17ac[_0x5a05('0x31')][_0x5a05('0x3b')]+'%'};return _0x1b4a18;})});}_0x2435d0=_[_0x5a05('0x3c')]({},_0x2435d0,_0x2d17ac[_0x5a05('0x43')]);return _0xf874b2['getSubjects'](_0x2435d0);}})['then'](function(_0x392703){if(_0x392703){_0x44ba7d=_0x392703['length'];if(!_0x2d17ac[_0x5a05('0x31')][_0x5a05('0x4b')](_0x5a05('0x37'))){_0x2435d0[_0x5a05('0x1d')]=qs[_0x5a05('0x1d')](_0x2d17ac[_0x5a05('0x31')][_0x5a05('0x1d')]);_0x2435d0[_0x5a05('0x1c')]=qs[_0x5a05('0x1c')](_0x2d17ac['query'][_0x5a05('0x1c')]);}return _0xf874b2[_0x5a05('0x4c')](_0x2435d0);}})[_0x5a05('0x25')](function(_0x1950b2){if(_0x1950b2){return _0x1950b2?{'count':_0x44ba7d,'rows':_0x1950b2}:null;}})[_0x5a05('0x25')](respondWithResult(_0x3b8f4d,null))[_0x5a05('0x47')](handleError(_0x3b8f4d,null));};exports['getDescriptions']=function(_0x25049c,_0x4c11de,_0x47ecdd){var _0x1ea4f5={};var _0x3f13bd={};var _0x2d14a7;var _0x57ec69;return db[_0x5a05('0x3e')][_0x5a05('0x4d')]({'where':{'id':_0x25049c[_0x5a05('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c11de,null))[_0x5a05('0x25')](function(_0x6d93e5){if(_0x6d93e5){_0x2d14a7=_0x6d93e5;_0x3f13bd['model']=_['keys'](db[_0x5a05('0x48')][_0x5a05('0x2c')]);_0x3f13bd[_0x5a05('0x31')]=_['keys'](_0x25049c['query']);_0x3f13bd[_0x5a05('0x32')]=_[_0x5a05('0x33')](_0x3f13bd[_0x5a05('0x2f')],_0x3f13bd['query']);_0x1ea4f5[_0x5a05('0x34')]=_[_0x5a05('0x33')](_0x3f13bd[_0x5a05('0x2f')],qs[_0x5a05('0x35')](_0x25049c[_0x5a05('0x31')][_0x5a05('0x35')]));_0x1ea4f5[_0x5a05('0x34')]=_0x1ea4f5[_0x5a05('0x34')][_0x5a05('0x36')]?_0x1ea4f5[_0x5a05('0x34')]:_0x3f13bd[_0x5a05('0x2f')];_0x1ea4f5[_0x5a05('0x38')]=qs[_0x5a05('0x39')](_0x25049c['query']['sort']);_0x1ea4f5[_0x5a05('0x3a')]=qs[_0x5a05('0x32')](_[_0x5a05('0x49')](_0x25049c['query'],_0x3f13bd[_0x5a05('0x32')]));if(_0x25049c[_0x5a05('0x31')][_0x5a05('0x3b')]){_0x1ea4f5[_0x5a05('0x3a')]=_[_0x5a05('0x3c')](_0x1ea4f5[_0x5a05('0x3a')],{'$or':_[_0x5a05('0x2b')](_0x1ea4f5[_0x5a05('0x34')],function(_0x44b8d1){var _0x2b88e6={};_0x2b88e6[_0x44b8d1]={'$like':'%'+_0x25049c[_0x5a05('0x31')][_0x5a05('0x3b')]+'%'};return _0x2b88e6;})});}_0x1ea4f5=_['merge']({},_0x1ea4f5,_0x25049c[_0x5a05('0x43')]);return _0x2d14a7[_0x5a05('0x4e')](_0x1ea4f5);}})[_0x5a05('0x25')](function(_0x56fb39){if(_0x56fb39){_0x57ec69=_0x56fb39[_0x5a05('0x36')];if(!_0x25049c['query']['hasOwnProperty']('nolimit')){_0x1ea4f5[_0x5a05('0x1d')]=qs[_0x5a05('0x1d')](_0x25049c['query']['limit']);_0x1ea4f5[_0x5a05('0x1c')]=qs['offset'](_0x25049c['query']['offset']);}return _0x2d14a7[_0x5a05('0x4e')](_0x1ea4f5);}})[_0x5a05('0x25')](function(_0x18f2bc){if(_0x18f2bc){return _0x18f2bc?{'count':_0x57ec69,'rows':_0x18f2bc}:null;}})[_0x5a05('0x25')](respondWithResult(_0x4c11de,null))[_0x5a05('0x47')](handleError(_0x4c11de,null));}; \ No newline at end of file +var _0x1e17=['model','map','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','length','options','find','catch','create','body','params','getFields','findOne','hasOwnProperty','getSubjects','ZohoField','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','type'];(function(_0x1eac4f,_0x100225){var _0x43b5ff=function(_0x5b9678){while(--_0x5b9678){_0x1eac4f['push'](_0x1eac4f['shift']());}};_0x43b5ff(++_0x100225);}(_0x1e17,0x115));var _0x71e1=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x1e17[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0x71e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71e1('0x1'));var jsonpatch=require(_0x71e1('0x2'));var rp=require('request-promise');var moment=require(_0x71e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71e1('0x4'));var util=require(_0x71e1('0x5'));var path=require(_0x71e1('0x6'));var sox=require(_0x71e1('0x7'));var csv=require('to-csv');var ejs=require(_0x71e1('0x8'));var fs=require('fs');var fs_extra=require(_0x71e1('0x9'));var _=require(_0x71e1('0xa'));var squel=require(_0x71e1('0xb'));var crypto=require(_0x71e1('0xc'));var jsforce=require(_0x71e1('0xd'));var deskjs=require(_0x71e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x71e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x71e1('0x10'));var authService=require(_0x71e1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x71e1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71e1('0x13'))('api');var utils=require(_0x71e1('0x14'));var config=require(_0x71e1('0x15'));var licenseUtil=require(_0x71e1('0x16'));var db=require(_0x71e1('0x17'))['db'];function respondWithStatusCode(_0x1ea391,_0x10bf51){_0x10bf51=_0x10bf51||0xcc;return function(_0x5f2eef){if(_0x5f2eef){return _0x1ea391[_0x71e1('0x18')](_0x10bf51);}return _0x1ea391[_0x71e1('0x19')](_0x10bf51)[_0x71e1('0x1a')]();};}function respondWithResult(_0xb95f20,_0x3a1c27){_0x3a1c27=_0x3a1c27||0xc8;return function(_0x42d1ad){if(_0x42d1ad){return _0xb95f20[_0x71e1('0x19')](_0x3a1c27)[_0x71e1('0x1b')](_0x42d1ad);}};}function respondWithFilteredResult(_0x344c11,_0x47b7fc){return function(_0x2a43d5){if(_0x2a43d5){var _0x939ad7=typeof _0x47b7fc[_0x71e1('0x1c')]===_0x71e1('0x1d')&&typeof _0x47b7fc[_0x71e1('0x1e')]==='undefined';var _0x242067=_0x2a43d5[_0x71e1('0x1f')];var _0x1ea447=_0x939ad7?0x0:_0x47b7fc['offset'];var _0xd3aff=_0x939ad7?_0x2a43d5['count']:_0x47b7fc[_0x71e1('0x1c')]+_0x47b7fc[_0x71e1('0x1e')];var _0x372a07;if(_0xd3aff>=_0x242067){_0xd3aff=_0x242067;_0x372a07=0xc8;}else{_0x372a07=0xce;}_0x344c11['status'](_0x372a07);return _0x344c11[_0x71e1('0x20')](_0x71e1('0x21'),_0x1ea447+'-'+_0xd3aff+'/'+_0x242067)[_0x71e1('0x1b')](_0x2a43d5);}return null;};}function patchUpdates(_0x48762d){return function(_0x16e5ac){try{jsonpatch[_0x71e1('0x22')](_0x16e5ac,_0x48762d,!![]);}catch(_0x236643){return BPromise['reject'](_0x236643);}return _0x16e5ac[_0x71e1('0x23')]();};}function saveUpdates(_0x303411,_0x5143cd){return function(_0x1886c6){if(_0x1886c6){return _0x1886c6[_0x71e1('0x24')](_0x303411)[_0x71e1('0x25')](function(_0x265c6d){return _0x265c6d;});}return null;};}function removeEntity(_0x1d36e6,_0x37514d){return function(_0x59aba8){if(_0x59aba8){return _0x59aba8[_0x71e1('0x26')]()[_0x71e1('0x25')](function(){_0x1d36e6['status'](0xcc)[_0x71e1('0x1a')]();});}};}function handleEntityNotFound(_0x295b25,_0x37ddaa){return function(_0xf1709c){if(!_0xf1709c){_0x295b25[_0x71e1('0x18')](0x194);}return _0xf1709c;};}function handleError(_0x21fe47,_0x1fcaf0){_0x1fcaf0=_0x1fcaf0||0x1f4;return function(_0x275db0){logger[_0x71e1('0x27')](_0x275db0[_0x71e1('0x28')]);if(_0x275db0[_0x71e1('0x29')]){delete _0x275db0['name'];}_0x21fe47[_0x71e1('0x19')](_0x1fcaf0)[_0x71e1('0x2a')](_0x275db0);};}exports[_0x71e1('0x2b')]=function(_0x2c5cf6,_0x2c03ea){var _0x14843c={},_0x3350c1={},_0x308e2e={'count':0x0,'rows':[]};var _0x506850=_['map'](db[_0x71e1('0x2c')][_0x71e1('0x2d')],function(_0x597281){return{'name':_0x597281['fieldName'],'type':_0x597281[_0x71e1('0x2e')]['key']};});_0x3350c1[_0x71e1('0x2f')]=_[_0x71e1('0x30')](_0x506850,'name');_0x3350c1['query']=_['keys'](_0x2c5cf6[_0x71e1('0x31')]);_0x3350c1['filters']=_[_0x71e1('0x32')](_0x3350c1[_0x71e1('0x2f')],_0x3350c1[_0x71e1('0x31')]);_0x14843c[_0x71e1('0x33')]=_[_0x71e1('0x32')](_0x3350c1[_0x71e1('0x2f')],qs[_0x71e1('0x34')](_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x34')]));_0x14843c[_0x71e1('0x33')]=_0x14843c[_0x71e1('0x33')]['length']?_0x14843c[_0x71e1('0x33')]:_0x3350c1[_0x71e1('0x2f')];if(!_0x2c5cf6[_0x71e1('0x31')]['hasOwnProperty'](_0x71e1('0x35'))){_0x14843c[_0x71e1('0x1e')]=qs[_0x71e1('0x1e')](_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x1e')]);_0x14843c['offset']=qs[_0x71e1('0x1c')](_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x1c')]);}_0x14843c[_0x71e1('0x36')]=qs['sort'](_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x37')]);_0x14843c[_0x71e1('0x38')]=qs[_0x71e1('0x39')](_[_0x71e1('0x3a')](_0x2c5cf6[_0x71e1('0x31')],_0x3350c1[_0x71e1('0x39')]),_0x506850);if(_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x3b')]){_0x14843c['where']=_[_0x71e1('0x3c')](_0x14843c['where'],{'$or':_[_0x71e1('0x30')](_0x506850,function(_0x2bb7f3){if(_0x2bb7f3['type']!==_0x71e1('0x3d')){var _0x2e68a5={};_0x2e68a5[_0x2bb7f3[_0x71e1('0x29')]]={'$like':'%'+_0x2c5cf6['query']['filter']+'%'};return _0x2e68a5;}})});}_0x14843c=_[_0x71e1('0x3c')]({},_0x14843c,_0x2c5cf6['options']);var _0x536e06={'where':_0x14843c[_0x71e1('0x38')]};return db[_0x71e1('0x2c')][_0x71e1('0x1f')](_0x536e06)[_0x71e1('0x25')](function(_0x1b3c2d){_0x308e2e[_0x71e1('0x1f')]=_0x1b3c2d;if(_0x2c5cf6[_0x71e1('0x31')][_0x71e1('0x3e')]){_0x14843c[_0x71e1('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x71e1('0x40')](_0x14843c);})[_0x71e1('0x25')](function(_0x5924c5){_0x308e2e[_0x71e1('0x41')]=_0x5924c5;return _0x308e2e;})[_0x71e1('0x25')](respondWithFilteredResult(_0x2c03ea,_0x14843c))['catch'](handleError(_0x2c03ea,null));};exports[_0x71e1('0x42')]=function(_0x3f6d11,_0x1945b2){var _0x5f5ba7={'raw':![],'where':{'id':_0x3f6d11['params']['id']}},_0x1d0093={};_0x1d0093['model']=_[_0x71e1('0x43')](db[_0x71e1('0x2c')][_0x71e1('0x2d')]);_0x1d0093['query']=_[_0x71e1('0x43')](_0x3f6d11['query']);_0x1d0093[_0x71e1('0x39')]=_[_0x71e1('0x32')](_0x1d0093[_0x71e1('0x2f')],_0x1d0093['query']);_0x5f5ba7[_0x71e1('0x33')]=_[_0x71e1('0x32')](_0x1d0093[_0x71e1('0x2f')],qs[_0x71e1('0x34')](_0x3f6d11['query'][_0x71e1('0x34')]));_0x5f5ba7[_0x71e1('0x33')]=_0x5f5ba7[_0x71e1('0x33')][_0x71e1('0x44')]?_0x5f5ba7[_0x71e1('0x33')]:_0x1d0093[_0x71e1('0x2f')];if(_0x3f6d11[_0x71e1('0x31')][_0x71e1('0x3e')]){_0x5f5ba7['include']=[{'all':!![]}];}_0x5f5ba7=_[_0x71e1('0x3c')]({},_0x5f5ba7,_0x3f6d11[_0x71e1('0x45')]);return db[_0x71e1('0x2c')][_0x71e1('0x46')](_0x5f5ba7)[_0x71e1('0x25')](handleEntityNotFound(_0x1945b2,null))['then'](respondWithResult(_0x1945b2,null))[_0x71e1('0x47')](handleError(_0x1945b2,null));};exports[_0x71e1('0x48')]=function(_0x1b98cd,_0x17dc37){return db[_0x71e1('0x2c')][_0x71e1('0x48')](_0x1b98cd[_0x71e1('0x49')],{})['then'](respondWithResult(_0x17dc37,0xc9))[_0x71e1('0x47')](handleError(_0x17dc37,null));};exports[_0x71e1('0x24')]=function(_0x5bcc02,_0x1a8376){if(_0x5bcc02['body']['id']){delete _0x5bcc02[_0x71e1('0x49')]['id'];}return db[_0x71e1('0x2c')][_0x71e1('0x46')]({'where':{'id':_0x5bcc02['params']['id']}})[_0x71e1('0x25')](handleEntityNotFound(_0x1a8376,null))[_0x71e1('0x25')](saveUpdates(_0x5bcc02[_0x71e1('0x49')],null))[_0x71e1('0x25')](respondWithResult(_0x1a8376,null))[_0x71e1('0x47')](handleError(_0x1a8376,null));};exports[_0x71e1('0x26')]=function(_0x30e877,_0x3299bc){return db[_0x71e1('0x2c')][_0x71e1('0x46')]({'where':{'id':_0x30e877[_0x71e1('0x4a')]['id']}})[_0x71e1('0x25')](handleEntityNotFound(_0x3299bc,null))[_0x71e1('0x25')](removeEntity(_0x3299bc,null))[_0x71e1('0x47')](handleError(_0x3299bc,null));};exports[_0x71e1('0x4b')]=function(_0x4a96b9,_0x398527,_0x14cd7f){var _0x44c7cf={};var _0x2b707b={};var _0x1ecede;var _0xe6a472;return db[_0x71e1('0x2c')][_0x71e1('0x4c')]({'where':{'id':_0x4a96b9['params']['id']}})[_0x71e1('0x25')](handleEntityNotFound(_0x398527,null))['then'](function(_0xaa73a5){if(_0xaa73a5){_0x1ecede=_0xaa73a5;_0x2b707b[_0x71e1('0x2f')]=_[_0x71e1('0x43')](db['ZohoField']['rawAttributes']);_0x2b707b[_0x71e1('0x31')]=_['keys'](_0x4a96b9[_0x71e1('0x31')]);_0x2b707b['filters']=_[_0x71e1('0x32')](_0x2b707b[_0x71e1('0x2f')],_0x2b707b[_0x71e1('0x31')]);_0x44c7cf[_0x71e1('0x33')]=_['intersection'](_0x2b707b['model'],qs[_0x71e1('0x34')](_0x4a96b9[_0x71e1('0x31')][_0x71e1('0x34')]));_0x44c7cf[_0x71e1('0x33')]=_0x44c7cf[_0x71e1('0x33')][_0x71e1('0x44')]?_0x44c7cf[_0x71e1('0x33')]:_0x2b707b[_0x71e1('0x2f')];_0x44c7cf[_0x71e1('0x36')]=qs[_0x71e1('0x37')](_0x4a96b9['query'][_0x71e1('0x37')]);_0x44c7cf[_0x71e1('0x38')]=qs[_0x71e1('0x39')](_['pick'](_0x4a96b9['query'],_0x2b707b['filters']));if(_0x4a96b9[_0x71e1('0x31')]['filter']){_0x44c7cf[_0x71e1('0x38')]=_[_0x71e1('0x3c')](_0x44c7cf[_0x71e1('0x38')],{'$or':_[_0x71e1('0x30')](_0x44c7cf[_0x71e1('0x33')],function(_0x5ad617){var _0x2ab6ce={};_0x2ab6ce[_0x5ad617]={'$like':'%'+_0x4a96b9['query'][_0x71e1('0x3b')]+'%'};return _0x2ab6ce;})});}_0x44c7cf=_[_0x71e1('0x3c')]({},_0x44c7cf,_0x4a96b9[_0x71e1('0x45')]);return _0x1ecede[_0x71e1('0x4b')](_0x44c7cf);}})[_0x71e1('0x25')](function(_0x215bf7){if(_0x215bf7){_0xe6a472=_0x215bf7['length'];if(!_0x4a96b9[_0x71e1('0x31')][_0x71e1('0x4d')](_0x71e1('0x35'))){_0x44c7cf[_0x71e1('0x1e')]=qs[_0x71e1('0x1e')](_0x4a96b9['query'][_0x71e1('0x1e')]);_0x44c7cf[_0x71e1('0x1c')]=qs[_0x71e1('0x1c')](_0x4a96b9[_0x71e1('0x31')]['offset']);}return _0x1ecede['getFields'](_0x44c7cf);}})['then'](function(_0x7ebd85){if(_0x7ebd85){return _0x7ebd85?{'count':_0xe6a472,'rows':_0x7ebd85}:null;}})[_0x71e1('0x25')](respondWithResult(_0x398527,null))[_0x71e1('0x47')](handleError(_0x398527,null));};exports[_0x71e1('0x4e')]=function(_0x6cede2,_0x58c0cf,_0x2b740e){var _0x1311b1={};var _0x315e1f={};var _0x201ebe;var _0x5239d9;return db[_0x71e1('0x2c')][_0x71e1('0x4c')]({'where':{'id':_0x6cede2[_0x71e1('0x4a')]['id']}})[_0x71e1('0x25')](handleEntityNotFound(_0x58c0cf,null))[_0x71e1('0x25')](function(_0x33c600){if(_0x33c600){_0x201ebe=_0x33c600;_0x315e1f['model']=_[_0x71e1('0x43')](db[_0x71e1('0x4f')][_0x71e1('0x2d')]);_0x315e1f['query']=_[_0x71e1('0x43')](_0x6cede2['query']);_0x315e1f[_0x71e1('0x39')]=_[_0x71e1('0x32')](_0x315e1f[_0x71e1('0x2f')],_0x315e1f[_0x71e1('0x31')]);_0x1311b1['attributes']=_[_0x71e1('0x32')](_0x315e1f['model'],qs['fields'](_0x6cede2[_0x71e1('0x31')]['fields']));_0x1311b1[_0x71e1('0x33')]=_0x1311b1[_0x71e1('0x33')][_0x71e1('0x44')]?_0x1311b1[_0x71e1('0x33')]:_0x315e1f[_0x71e1('0x2f')];_0x1311b1[_0x71e1('0x36')]=qs['sort'](_0x6cede2[_0x71e1('0x31')][_0x71e1('0x37')]);_0x1311b1[_0x71e1('0x38')]=qs[_0x71e1('0x39')](_['pick'](_0x6cede2['query'],_0x315e1f[_0x71e1('0x39')]));if(_0x6cede2[_0x71e1('0x31')][_0x71e1('0x3b')]){_0x1311b1[_0x71e1('0x38')]=_['merge'](_0x1311b1[_0x71e1('0x38')],{'$or':_['map'](_0x1311b1['attributes'],function(_0x131b03){var _0x4c877f={};_0x4c877f[_0x131b03]={'$like':'%'+_0x6cede2['query'][_0x71e1('0x3b')]+'%'};return _0x4c877f;})});}_0x1311b1=_[_0x71e1('0x3c')]({},_0x1311b1,_0x6cede2['options']);return _0x201ebe[_0x71e1('0x4e')](_0x1311b1);}})[_0x71e1('0x25')](function(_0x5ef289){if(_0x5ef289){_0x5239d9=_0x5ef289[_0x71e1('0x44')];if(!_0x6cede2[_0x71e1('0x31')][_0x71e1('0x4d')](_0x71e1('0x35'))){_0x1311b1[_0x71e1('0x1e')]=qs['limit'](_0x6cede2[_0x71e1('0x31')]['limit']);_0x1311b1['offset']=qs[_0x71e1('0x1c')](_0x6cede2[_0x71e1('0x31')][_0x71e1('0x1c')]);}return _0x201ebe[_0x71e1('0x4e')](_0x1311b1);}})[_0x71e1('0x25')](function(_0x3c5927){if(_0x3c5927){return _0x3c5927?{'count':_0x5239d9,'rows':_0x3c5927}:null;}})[_0x71e1('0x25')](respondWithResult(_0x58c0cf,null))[_0x71e1('0x47')](handleError(_0x58c0cf,null));};exports[_0x71e1('0x50')]=function(_0x5ed777,_0x5c610c,_0x34da3d){var _0x2a0408={};var _0x4222e2={};var _0x42bd3d;var _0x4dfc22;return db[_0x71e1('0x2c')][_0x71e1('0x4c')]({'where':{'id':_0x5ed777[_0x71e1('0x4a')]['id']}})[_0x71e1('0x25')](handleEntityNotFound(_0x5c610c,null))['then'](function(_0x45bbee){if(_0x45bbee){_0x42bd3d=_0x45bbee;_0x4222e2['model']=_[_0x71e1('0x43')](db['ZohoField'][_0x71e1('0x2d')]);_0x4222e2['query']=_['keys'](_0x5ed777['query']);_0x4222e2[_0x71e1('0x39')]=_[_0x71e1('0x32')](_0x4222e2['model'],_0x4222e2[_0x71e1('0x31')]);_0x2a0408[_0x71e1('0x33')]=_[_0x71e1('0x32')](_0x4222e2[_0x71e1('0x2f')],qs['fields'](_0x5ed777['query'][_0x71e1('0x34')]));_0x2a0408[_0x71e1('0x33')]=_0x2a0408[_0x71e1('0x33')][_0x71e1('0x44')]?_0x2a0408[_0x71e1('0x33')]:_0x4222e2[_0x71e1('0x2f')];_0x2a0408[_0x71e1('0x36')]=qs[_0x71e1('0x37')](_0x5ed777[_0x71e1('0x31')][_0x71e1('0x37')]);_0x2a0408['where']=qs[_0x71e1('0x39')](_[_0x71e1('0x3a')](_0x5ed777['query'],_0x4222e2[_0x71e1('0x39')]));if(_0x5ed777[_0x71e1('0x31')]['filter']){_0x2a0408[_0x71e1('0x38')]=_[_0x71e1('0x3c')](_0x2a0408[_0x71e1('0x38')],{'$or':_['map'](_0x2a0408['attributes'],function(_0x3ef04f){var _0x18684e={};_0x18684e[_0x3ef04f]={'$like':'%'+_0x5ed777[_0x71e1('0x31')]['filter']+'%'};return _0x18684e;})});}_0x2a0408=_[_0x71e1('0x3c')]({},_0x2a0408,_0x5ed777[_0x71e1('0x45')]);return _0x42bd3d['getDescriptions'](_0x2a0408);}})[_0x71e1('0x25')](function(_0x2f2fc1){if(_0x2f2fc1){_0x4dfc22=_0x2f2fc1[_0x71e1('0x44')];if(!_0x5ed777[_0x71e1('0x31')][_0x71e1('0x4d')](_0x71e1('0x35'))){_0x2a0408[_0x71e1('0x1e')]=qs[_0x71e1('0x1e')](_0x5ed777[_0x71e1('0x31')][_0x71e1('0x1e')]);_0x2a0408[_0x71e1('0x1c')]=qs['offset'](_0x5ed777[_0x71e1('0x31')][_0x71e1('0x1c')]);}return _0x42bd3d[_0x71e1('0x50')](_0x2a0408);}})['then'](function(_0x350d3c){if(_0x350d3c){return _0x350d3c?{'count':_0x4dfc22,'rows':_0x350d3c}:null;}})[_0x71e1('0x25')](respondWithResult(_0x5c610c,null))[_0x71e1('0x47')](handleError(_0x5c610c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 02ba166..57120ea 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 _0x9a84=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a84,0x10e));var _0x49a8=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x9a84[_0x23a8ba];return _0x468389;};'use strict';var _=require(_0x49a8('0x0'));var util=require(_0x49a8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x49a8('0x2'));var BPromise=require(_0x49a8('0x3'));var rp=require(_0x49a8('0x4'));var fs=require('fs');var path=require(_0x49a8('0x5'));var rimraf=require(_0x49a8('0x6'));var config=require(_0x49a8('0x7'));var attributes=require(_0x49a8('0x8'));module[_0x49a8('0x9')]=function(_0x32cde7,_0x149bcb){return _0x32cde7['define'](_0x49a8('0xa'),attributes,{'tableName':_0x49a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3daa=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment'];(function(_0x2acae5,_0x52a75a){var _0x33aafd=function(_0x362051){while(--_0x362051){_0x2acae5['push'](_0x2acae5['shift']());}};_0x33aafd(++_0x52a75a);}(_0x3daa,0x1c3));var _0xa3da=function(_0x104142,_0x368085){_0x104142=_0x104142-0x0;var _0x481408=_0x3daa[_0x104142];return _0x481408;};'use strict';var _=require('lodash');var util=require(_0xa3da('0x0'));var logger=require(_0xa3da('0x1'))(_0xa3da('0x2'));var moment=require(_0xa3da('0x3'));var BPromise=require(_0xa3da('0x4'));var rp=require(_0xa3da('0x5'));var fs=require('fs');var path=require(_0xa3da('0x6'));var rimraf=require(_0xa3da('0x7'));var config=require(_0xa3da('0x8'));var attributes=require(_0xa3da('0x9'));module['exports']=function(_0x2724ba,_0x13bbdc){return _0x2724ba[_0xa3da('0xa')](_0xa3da('0xb'),attributes,{'tableName':_0xa3da('0xc'),'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 1391a37..daa78bb 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 _0x4435=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x1134c4,_0x39cba2){var _0x5ece50=function(_0x91087){while(--_0x91087){_0x1134c4['push'](_0x1134c4['shift']());}};_0x5ece50(++_0x39cba2);}(_0x4435,0xf7));var _0x5443=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x4435[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x5443('0x0'));var util=require(_0x5443('0x1'));var moment=require(_0x5443('0x2'));var BPromise=require(_0x5443('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5443('0x4'));var db=require(_0x5443('0x5'))['db'];var utils=require(_0x5443('0x6'));var logger=require(_0x5443('0x7'))(_0x5443('0x8'));var config=require('../../config/environment');var jayson=require(_0x5443('0x9'));var client=jayson['client'][_0x5443('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11da62,_0x1341de,_0x6bd71c){return new BPromise(function(_0x199f17,_0x4f4126){return client['request'](_0x11da62,_0x6bd71c)[_0x5443('0xb')](function(_0x10c180){logger[_0x5443('0xc')](_0x5443('0xd'),_0x1341de,_0x5443('0xe'));logger[_0x5443('0xf')](_0x5443('0x10'),_0x1341de,'request\x20sent',JSON['stringify'](_0x10c180));if(_0x10c180[_0x5443('0x11')]){if(_0x10c180[_0x5443('0x11')][_0x5443('0x12')]===0x1f4){logger['error'](_0x5443('0xd'),_0x1341de,_0x10c180[_0x5443('0x11')]['message']);return _0x4f4126(_0x10c180['error'][_0x5443('0x13')]);}logger[_0x5443('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x1341de,_0x10c180[_0x5443('0x11')][_0x5443('0x13')]);return _0x199f17(_0x10c180['error'][_0x5443('0x13')]);}else{logger[_0x5443('0xc')](_0x5443('0xd'),_0x1341de,_0x5443('0xe'));_0x199f17(_0x10c180[_0x5443('0x14')][_0x5443('0x13')]);}})['catch'](function(_0xf4810a){logger[_0x5443('0x11')](_0x5443('0xd'),_0x1341de,_0xf4810a);_0x4f4126(_0xf4810a);});});} \ No newline at end of file +var _0xe060=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x4ad534,_0x8de8ad){var _0x790662=function(_0x2fbd84){while(--_0x2fbd84){_0x4ad534['push'](_0x4ad534['shift']());}};_0x790662(++_0x8de8ad);}(_0xe060,0x196));var _0x0e06=function(_0x33cfca,_0x3058d1){_0x33cfca=_0x33cfca-0x0;var _0x68d722=_0xe060[_0x33cfca];return _0x68d722;};'use strict';var _=require(_0x0e06('0x0'));var util=require(_0x0e06('0x1'));var moment=require(_0x0e06('0x2'));var BPromise=require(_0x0e06('0x3'));var rs=require(_0x0e06('0x4'));var fs=require('fs');var Redis=require(_0x0e06('0x5'));var db=require(_0x0e06('0x6'))['db'];var utils=require(_0x0e06('0x7'));var logger=require(_0x0e06('0x8'))(_0x0e06('0x9'));var config=require(_0x0e06('0xa'));var jayson=require(_0x0e06('0xb'));var client=jayson[_0x0e06('0xc')][_0x0e06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e4f28,_0x2a5efb,_0x57da2e){return new BPromise(function(_0x3e41ed,_0x17aecb){return client[_0x0e06('0xe')](_0x4e4f28,_0x57da2e)['then'](function(_0x5601f0){logger[_0x0e06('0xf')](_0x0e06('0x10'),_0x2a5efb,_0x0e06('0x11'));logger['debug'](_0x0e06('0x12'),_0x2a5efb,'request\x20sent',JSON['stringify'](_0x5601f0));if(_0x5601f0['error']){if(_0x5601f0[_0x0e06('0x13')][_0x0e06('0x14')]===0x1f4){logger['error'](_0x0e06('0x10'),_0x2a5efb,_0x5601f0[_0x0e06('0x13')][_0x0e06('0x15')]);return _0x17aecb(_0x5601f0[_0x0e06('0x13')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2a5efb,_0x5601f0[_0x0e06('0x13')][_0x0e06('0x15')]);return _0x3e41ed(_0x5601f0[_0x0e06('0x13')]['message']);}else{logger[_0x0e06('0xf')](_0x0e06('0x10'),_0x2a5efb,_0x0e06('0x11'));_0x3e41ed(_0x5601f0[_0x0e06('0x16')][_0x0e06('0x15')]);}})[_0x0e06('0x17')](function(_0x30a172){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2a5efb,_0x30a172);_0x17aecb(_0x30a172);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2faff7c..edfe302 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 _0xd33f=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x38f34e,_0x287825){var _0x3f3adf=function(_0x40c089){while(--_0x40c089){_0x38f34e['push'](_0x38f34e['shift']());}};_0x3f3adf(++_0x287825);}(_0xd33f,0x78));var _0xfd33=function(_0x5802a2,_0x555883){_0x5802a2=_0x5802a2-0x0;var _0x52a30f=_0xd33f[_0x5802a2];return _0x52a30f;};'use strict';var multer=require(_0xfd33('0x0'));var util=require(_0xfd33('0x1'));var path=require(_0xfd33('0x2'));var timeout=require(_0xfd33('0x3'));var express=require(_0xfd33('0x4'));var router=express[_0xfd33('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfd33('0x6'));var interaction=require(_0xfd33('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xfd33('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd33('0x9')]);router[_0xfd33('0x8')](_0xfd33('0xa'),auth[_0xfd33('0xb')](),controller[_0xfd33('0xc')]);router[_0xfd33('0xd')]('/',auth['isAuthenticated'](),controller[_0xfd33('0xe')]);router[_0xfd33('0xf')](_0xfd33('0xa'),auth[_0xfd33('0xb')](),controller[_0xfd33('0x10')]);router[_0xfd33('0x11')](_0xfd33('0xa'),auth['isAuthenticated'](),controller[_0xfd33('0x12')]);module[_0xfd33('0x13')]=router; \ No newline at end of file +var _0xb641=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','create','destroy','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0xb641,0x87));var _0x1b64=function(_0x4c9312,_0xe4d06e){_0x4c9312=_0x4c9312-0x0;var _0x33850c=_0xb641[_0x4c9312];return _0x33850c;};'use strict';var multer=require('multer');var util=require(_0x1b64('0x0'));var path=require('path');var timeout=require(_0x1b64('0x1'));var express=require(_0x1b64('0x2'));var router=express[_0x1b64('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1b64('0x4'));var interaction=require(_0x1b64('0x5'));var config=require(_0x1b64('0x6'));var controller=require(_0x1b64('0x7'));router[_0x1b64('0x8')]('/',auth[_0x1b64('0x9')](),controller[_0x1b64('0xa')]);router[_0x1b64('0x8')](_0x1b64('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1b64('0x9')](),controller[_0x1b64('0xc')]);router['put'](_0x1b64('0xb'),auth[_0x1b64('0x9')](),controller['update']);router['delete'](_0x1b64('0xb'),auth[_0x1b64('0x9')](),controller[_0x1b64('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 156df9f..7b5362e 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 _0x0d95=['picklist','STRING','ENUM','BOOLEAN','string','variable','customVariable','keyValue'];(function(_0x24efdd,_0xb82d5a){var _0x5c5795=function(_0x143d92){while(--_0x143d92){_0x24efdd['push'](_0x24efdd['shift']());}};_0x5c5795(++_0xb82d5a);}(_0x0d95,0x13c));var _0x50d9=function(_0x3e9318,_0x2356e3){_0x3e9318=_0x3e9318-0x0;var _0x5ae20e=_0x0d95[_0x3e9318];return _0x5ae20e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x50d9('0x0'),_0x50d9('0x1'),_0x50d9('0x2'),_0x50d9('0x3'),_0x50d9('0x4')),'defaultValue':_0x50d9('0x0')},'content':{'type':Sequelize[_0x50d9('0x5')]},'key':{'type':Sequelize[_0x50d9('0x5')]},'keyType':{'type':Sequelize[_0x50d9('0x6')](_0x50d9('0x0'),'variable',_0x50d9('0x2'))},'keyContent':{'type':Sequelize[_0x50d9('0x5')]},'idField':{'type':Sequelize[_0x50d9('0x5')]},'nameField':{'type':Sequelize[_0x50d9('0x5')]},'customField':{'type':Sequelize[_0x50d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x50d9('0x5')]}}; \ No newline at end of file +var _0x62ec=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x5f378b,_0x408bf8){var _0x5427ef=function(_0x10d024){while(--_0x10d024){_0x5f378b['push'](_0x5f378b['shift']());}};_0x5427ef(++_0x408bf8);}(_0x62ec,0x105));var _0xc62e=function(_0x12ef74,_0x919761){_0x12ef74=_0x12ef74-0x0;var _0x261c44=_0x62ec[_0x12ef74];return _0x261c44;};'use strict';var Sequelize=require(_0xc62e('0x0'));module[_0xc62e('0x1')]={'type':{'type':Sequelize[_0xc62e('0x2')](_0xc62e('0x3'),_0xc62e('0x4'),'customVariable',_0xc62e('0x5'),_0xc62e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc62e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc62e('0x3'),_0xc62e('0x4'),_0xc62e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc62e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc62e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d51a9b6..ba71684 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 _0x2405=['params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','rows','catch','show','keys','include','find','create','body'];(function(_0x35a0e6,_0x1bc82b){var _0xaae01c=function(_0x2e58dc){while(--_0x2e58dc){_0x35a0e6['push'](_0x35a0e6['shift']());}};_0xaae01c(++_0x1bc82b);}(_0x2405,0x173));var _0x5240=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x2405[_0x16e57d];return _0x40239c;};'use strict';var emlformat=require(_0x5240('0x0'));var rimraf=require(_0x5240('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5240('0x2'));var rp=require(_0x5240('0x3'));var moment=require(_0x5240('0x4'));var BPromise=require(_0x5240('0x5'));var Mustache=require('mustache');var util=require(_0x5240('0x6'));var path=require('path');var sox=require(_0x5240('0x7'));var csv=require(_0x5240('0x8'));var ejs=require(_0x5240('0x9'));var fs=require('fs');var fs_extra=require(_0x5240('0xa'));var _=require('lodash');var squel=require(_0x5240('0xb'));var crypto=require('crypto');var jsforce=require(_0x5240('0xc'));var deskjs=require(_0x5240('0xd'));var toCsv=require(_0x5240('0x8'));var querystring=require(_0x5240('0xe'));var Papa=require(_0x5240('0xf'));var Redis=require(_0x5240('0x10'));var authService=require(_0x5240('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5240('0x12'));var hardwareService=require(_0x5240('0x13'));var logger=require(_0x5240('0x14'))(_0x5240('0x15'));var utils=require(_0x5240('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5240('0x17'))['db'];function respondWithStatusCode(_0x561580,_0x4dda78){_0x4dda78=_0x4dda78||0xcc;return function(_0x143295){if(_0x143295){return _0x561580['sendStatus'](_0x4dda78);}return _0x561580[_0x5240('0x18')](_0x4dda78)[_0x5240('0x19')]();};}function respondWithResult(_0x4f1df5,_0x5d957a){_0x5d957a=_0x5d957a||0xc8;return function(_0x885f35){if(_0x885f35){return _0x4f1df5[_0x5240('0x18')](_0x5d957a)[_0x5240('0x1a')](_0x885f35);}};}function respondWithFilteredResult(_0x264bfd,_0x14c4f7){return function(_0x3c6ec1){if(_0x3c6ec1){var _0x37a122=typeof _0x14c4f7[_0x5240('0x1b')]===_0x5240('0x1c')&&typeof _0x14c4f7[_0x5240('0x1d')]===_0x5240('0x1c');var _0x4c14ae=_0x3c6ec1[_0x5240('0x1e')];var _0x57ae81=_0x37a122?0x0:_0x14c4f7[_0x5240('0x1b')];var _0x2bc697=_0x37a122?_0x3c6ec1[_0x5240('0x1e')]:_0x14c4f7[_0x5240('0x1b')]+_0x14c4f7['limit'];var _0x39d4d9;if(_0x2bc697>=_0x4c14ae){_0x2bc697=_0x4c14ae;_0x39d4d9=0xc8;}else{_0x39d4d9=0xce;}_0x264bfd['status'](_0x39d4d9);return _0x264bfd[_0x5240('0x1f')](_0x5240('0x20'),_0x57ae81+'-'+_0x2bc697+'/'+_0x4c14ae)[_0x5240('0x1a')](_0x3c6ec1);}return null;};}function patchUpdates(_0x4df806){return function(_0x86f8e1){try{jsonpatch[_0x5240('0x21')](_0x86f8e1,_0x4df806,!![]);}catch(_0x5e39d6){return BPromise['reject'](_0x5e39d6);}return _0x86f8e1[_0x5240('0x22')]();};}function saveUpdates(_0x2347a5,_0x4c0c60){return function(_0x4188e8){if(_0x4188e8){return _0x4188e8[_0x5240('0x23')](_0x2347a5)['then'](function(_0x190070){return _0x190070;});}return null;};}function removeEntity(_0x5d06bc,_0x1accd1){return function(_0x521670){if(_0x521670){return _0x521670[_0x5240('0x24')]()[_0x5240('0x25')](function(){_0x5d06bc[_0x5240('0x18')](0xcc)[_0x5240('0x19')]();});}};}function handleEntityNotFound(_0x51993e,_0x362cc6){return function(_0x2be826){if(!_0x2be826){_0x51993e[_0x5240('0x26')](0x194);}return _0x2be826;};}function handleError(_0x328672,_0x4370a4){_0x4370a4=_0x4370a4||0x1f4;return function(_0x33d0b1){logger[_0x5240('0x27')](_0x33d0b1[_0x5240('0x28')]);if(_0x33d0b1['name']){delete _0x33d0b1[_0x5240('0x29')];}_0x328672['status'](_0x4370a4)['send'](_0x33d0b1);};}exports[_0x5240('0x2a')]=function(_0x521632,_0x9d09d0){var _0x376a43={},_0x1df083={},_0x3b658f={'count':0x0,'rows':[]};var _0x387d9b=_[_0x5240('0x2b')](db[_0x5240('0x2c')][_0x5240('0x2d')],function(_0xd7944){return{'name':_0xd7944[_0x5240('0x2e')],'type':_0xd7944[_0x5240('0x2f')][_0x5240('0x30')]};});_0x1df083['model']=_[_0x5240('0x2b')](_0x387d9b,_0x5240('0x29'));_0x1df083[_0x5240('0x31')]=_['keys'](_0x521632[_0x5240('0x31')]);_0x1df083['filters']=_[_0x5240('0x32')](_0x1df083[_0x5240('0x33')],_0x1df083['query']);_0x376a43[_0x5240('0x34')]=_[_0x5240('0x32')](_0x1df083[_0x5240('0x33')],qs[_0x5240('0x35')](_0x521632[_0x5240('0x31')][_0x5240('0x35')]));_0x376a43[_0x5240('0x34')]=_0x376a43[_0x5240('0x34')][_0x5240('0x36')]?_0x376a43['attributes']:_0x1df083[_0x5240('0x33')];if(!_0x521632[_0x5240('0x31')][_0x5240('0x37')](_0x5240('0x38'))){_0x376a43[_0x5240('0x1d')]=qs[_0x5240('0x1d')](_0x521632['query'][_0x5240('0x1d')]);_0x376a43['offset']=qs[_0x5240('0x1b')](_0x521632[_0x5240('0x31')][_0x5240('0x1b')]);}_0x376a43['order']=qs[_0x5240('0x39')](_0x521632['query'][_0x5240('0x39')]);_0x376a43['where']=qs['filters'](_[_0x5240('0x3a')](_0x521632[_0x5240('0x31')],_0x1df083[_0x5240('0x3b')]),_0x387d9b);if(_0x521632[_0x5240('0x31')][_0x5240('0x3c')]){_0x376a43['where']=_['merge'](_0x376a43[_0x5240('0x3d')],{'$or':_[_0x5240('0x2b')](_0x387d9b,function(_0x2a8bb2){if(_0x2a8bb2[_0x5240('0x2f')]!=='VIRTUAL'){var _0x563605={};_0x563605[_0x2a8bb2['name']]={'$like':'%'+_0x521632[_0x5240('0x31')][_0x5240('0x3c')]+'%'};return _0x563605;}})});}_0x376a43=_[_0x5240('0x3e')]({},_0x376a43,_0x521632[_0x5240('0x3f')]);var _0x5b4d71={'where':_0x376a43['where']};return db[_0x5240('0x2c')][_0x5240('0x1e')](_0x5b4d71)[_0x5240('0x25')](function(_0x2c6409){_0x3b658f['count']=_0x2c6409;if(_0x521632[_0x5240('0x31')][_0x5240('0x40')]){_0x376a43['include']=[{'all':!![]}];}return db[_0x5240('0x2c')]['findAll'](_0x376a43);})[_0x5240('0x25')](function(_0x542eb3){_0x3b658f[_0x5240('0x41')]=_0x542eb3;return _0x3b658f;})[_0x5240('0x25')](respondWithFilteredResult(_0x9d09d0,_0x376a43))[_0x5240('0x42')](handleError(_0x9d09d0,null));};exports[_0x5240('0x43')]=function(_0x134e71,_0x1ae327){var _0x1849e6={'raw':!![],'where':{'id':_0x134e71['params']['id']}},_0x14c649={};_0x14c649[_0x5240('0x33')]=_[_0x5240('0x44')](db[_0x5240('0x2c')][_0x5240('0x2d')]);_0x14c649[_0x5240('0x31')]=_[_0x5240('0x44')](_0x134e71['query']);_0x14c649[_0x5240('0x3b')]=_[_0x5240('0x32')](_0x14c649['model'],_0x14c649[_0x5240('0x31')]);_0x1849e6[_0x5240('0x34')]=_[_0x5240('0x32')](_0x14c649[_0x5240('0x33')],qs[_0x5240('0x35')](_0x134e71[_0x5240('0x31')][_0x5240('0x35')]));_0x1849e6[_0x5240('0x34')]=_0x1849e6[_0x5240('0x34')][_0x5240('0x36')]?_0x1849e6[_0x5240('0x34')]:_0x14c649[_0x5240('0x33')];if(_0x134e71[_0x5240('0x31')][_0x5240('0x40')]){_0x1849e6[_0x5240('0x45')]=[{'all':!![]}];}_0x1849e6=_[_0x5240('0x3e')]({},_0x1849e6,_0x134e71['options']);return db[_0x5240('0x2c')][_0x5240('0x46')](_0x1849e6)[_0x5240('0x25')](handleEntityNotFound(_0x1ae327,null))['then'](respondWithResult(_0x1ae327,null))[_0x5240('0x42')](handleError(_0x1ae327,null));};exports[_0x5240('0x47')]=function(_0x16ab42,_0x4e6769){return db[_0x5240('0x2c')]['create'](_0x16ab42['body'],{})['then'](respondWithResult(_0x4e6769,0xc9))[_0x5240('0x42')](handleError(_0x4e6769,null));};exports[_0x5240('0x23')]=function(_0x299e23,_0x495d83){if(_0x299e23[_0x5240('0x48')]['id']){delete _0x299e23[_0x5240('0x48')]['id'];}return db[_0x5240('0x2c')]['find']({'where':{'id':_0x299e23[_0x5240('0x49')]['id']}})[_0x5240('0x25')](handleEntityNotFound(_0x495d83,null))['then'](saveUpdates(_0x299e23[_0x5240('0x48')],null))[_0x5240('0x25')](respondWithResult(_0x495d83,null))[_0x5240('0x42')](handleError(_0x495d83,null));};exports[_0x5240('0x24')]=function(_0x17c5ae,_0x314970){return db[_0x5240('0x2c')][_0x5240('0x46')]({'where':{'id':_0x17c5ae[_0x5240('0x49')]['id']}})[_0x5240('0x25')](handleEntityNotFound(_0x314970,null))[_0x5240('0x25')](removeEntity(_0x314970,null))[_0x5240('0x42')](handleError(_0x314970,null));}; \ No newline at end of file +var _0xaa55=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZohoField','includeAll','include','rows','catch','show','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x5f31db,_0x102645){var _0x4d3258=function(_0x59e451){while(--_0x59e451){_0x5f31db['push'](_0x5f31db['shift']());}};_0x4d3258(++_0x102645);}(_0xaa55,0x183));var _0x5aa5=function(_0x1b4e5a,_0x27d110){_0x1b4e5a=_0x1b4e5a-0x0;var _0x3aa95b=_0xaa55[_0x1b4e5a];return _0x3aa95b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5aa5('0x0'));var zipdir=require(_0x5aa5('0x1'));var jsonpatch=require(_0x5aa5('0x2'));var rp=require(_0x5aa5('0x3'));var moment=require(_0x5aa5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5aa5('0x5'));var path=require(_0x5aa5('0x6'));var sox=require('sox');var csv=require(_0x5aa5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5aa5('0x8'));var _=require(_0x5aa5('0x9'));var squel=require('squel');var crypto=require(_0x5aa5('0xa'));var jsforce=require(_0x5aa5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5aa5('0xc'));var Papa=require(_0x5aa5('0xd'));var Redis=require(_0x5aa5('0xe'));var authService=require(_0x5aa5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5aa5('0x10'));var logger=require(_0x5aa5('0x11'))(_0x5aa5('0x12'));var utils=require(_0x5aa5('0x13'));var config=require(_0x5aa5('0x14'));var licenseUtil=require(_0x5aa5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19f7ba,_0x299a26){_0x299a26=_0x299a26||0xcc;return function(_0xe45e59){if(_0xe45e59){return _0x19f7ba['sendStatus'](_0x299a26);}return _0x19f7ba[_0x5aa5('0x16')](_0x299a26)[_0x5aa5('0x17')]();};}function respondWithResult(_0x277edd,_0x3f6379){_0x3f6379=_0x3f6379||0xc8;return function(_0x420f23){if(_0x420f23){return _0x277edd[_0x5aa5('0x16')](_0x3f6379)[_0x5aa5('0x18')](_0x420f23);}};}function respondWithFilteredResult(_0x559a99,_0x18a904){return function(_0xd97eb6){if(_0xd97eb6){var _0xb79ffb=typeof _0x18a904['offset']==='undefined'&&typeof _0x18a904[_0x5aa5('0x19')]===_0x5aa5('0x1a');var _0x2c5175=_0xd97eb6['count'];var _0x57ad53=_0xb79ffb?0x0:_0x18a904[_0x5aa5('0x1b')];var _0x3cecad=_0xb79ffb?_0xd97eb6[_0x5aa5('0x1c')]:_0x18a904[_0x5aa5('0x1b')]+_0x18a904[_0x5aa5('0x19')];var _0x1e31c7;if(_0x3cecad>=_0x2c5175){_0x3cecad=_0x2c5175;_0x1e31c7=0xc8;}else{_0x1e31c7=0xce;}_0x559a99[_0x5aa5('0x16')](_0x1e31c7);return _0x559a99[_0x5aa5('0x1d')](_0x5aa5('0x1e'),_0x57ad53+'-'+_0x3cecad+'/'+_0x2c5175)[_0x5aa5('0x18')](_0xd97eb6);}return null;};}function patchUpdates(_0x547553){return function(_0x31509d){try{jsonpatch['apply'](_0x31509d,_0x547553,!![]);}catch(_0x1010ea){return BPromise[_0x5aa5('0x1f')](_0x1010ea);}return _0x31509d[_0x5aa5('0x20')]();};}function saveUpdates(_0x55e941,_0x2dfd7d){return function(_0x96503a){if(_0x96503a){return _0x96503a[_0x5aa5('0x21')](_0x55e941)[_0x5aa5('0x22')](function(_0x4a3ab4){return _0x4a3ab4;});}return null;};}function removeEntity(_0x5242b5,_0x44e436){return function(_0x460877){if(_0x460877){return _0x460877[_0x5aa5('0x23')]()[_0x5aa5('0x22')](function(){_0x5242b5['status'](0xcc)[_0x5aa5('0x17')]();});}};}function handleEntityNotFound(_0x3b4ba5,_0x2c2a76){return function(_0x4f910d){if(!_0x4f910d){_0x3b4ba5[_0x5aa5('0x24')](0x194);}return _0x4f910d;};}function handleError(_0x1df82b,_0xf9bce1){_0xf9bce1=_0xf9bce1||0x1f4;return function(_0xc9404c){logger[_0x5aa5('0x25')](_0xc9404c['stack']);if(_0xc9404c[_0x5aa5('0x26')]){delete _0xc9404c[_0x5aa5('0x26')];}_0x1df82b[_0x5aa5('0x16')](_0xf9bce1)[_0x5aa5('0x27')](_0xc9404c);};}exports['index']=function(_0x9ecf9a,_0x4a9fde){var _0xb417cb={},_0x1ebc6a={},_0x4d3894={'count':0x0,'rows':[]};var _0xd06645=_[_0x5aa5('0x28')](db['ZohoField'][_0x5aa5('0x29')],function(_0x4106f3){return{'name':_0x4106f3[_0x5aa5('0x2a')],'type':_0x4106f3[_0x5aa5('0x2b')][_0x5aa5('0x2c')]};});_0x1ebc6a[_0x5aa5('0x2d')]=_[_0x5aa5('0x28')](_0xd06645,'name');_0x1ebc6a[_0x5aa5('0x2e')]=_[_0x5aa5('0x2f')](_0x9ecf9a[_0x5aa5('0x2e')]);_0x1ebc6a[_0x5aa5('0x30')]=_[_0x5aa5('0x31')](_0x1ebc6a['model'],_0x1ebc6a[_0x5aa5('0x2e')]);_0xb417cb[_0x5aa5('0x32')]=_[_0x5aa5('0x31')](_0x1ebc6a['model'],qs[_0x5aa5('0x33')](_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x33')]));_0xb417cb[_0x5aa5('0x32')]=_0xb417cb['attributes'][_0x5aa5('0x34')]?_0xb417cb['attributes']:_0x1ebc6a[_0x5aa5('0x2d')];if(!_0x9ecf9a['query'][_0x5aa5('0x35')](_0x5aa5('0x36'))){_0xb417cb['limit']=qs[_0x5aa5('0x19')](_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x19')]);_0xb417cb['offset']=qs[_0x5aa5('0x1b')](_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x1b')]);}_0xb417cb[_0x5aa5('0x37')]=qs[_0x5aa5('0x38')](_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x38')]);_0xb417cb[_0x5aa5('0x39')]=qs['filters'](_[_0x5aa5('0x3a')](_0x9ecf9a['query'],_0x1ebc6a[_0x5aa5('0x30')]),_0xd06645);if(_0x9ecf9a[_0x5aa5('0x2e')]['filter']){_0xb417cb[_0x5aa5('0x39')]=_[_0x5aa5('0x3b')](_0xb417cb[_0x5aa5('0x39')],{'$or':_[_0x5aa5('0x28')](_0xd06645,function(_0x40011d){if(_0x40011d['type']!==_0x5aa5('0x3c')){var _0x287410={};_0x287410[_0x40011d[_0x5aa5('0x26')]]={'$like':'%'+_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x3d')]+'%'};return _0x287410;}})});}_0xb417cb=_[_0x5aa5('0x3b')]({},_0xb417cb,_0x9ecf9a['options']);var _0x40c98e={'where':_0xb417cb['where']};return db[_0x5aa5('0x3e')][_0x5aa5('0x1c')](_0x40c98e)['then'](function(_0x475f54){_0x4d3894['count']=_0x475f54;if(_0x9ecf9a[_0x5aa5('0x2e')][_0x5aa5('0x3f')]){_0xb417cb[_0x5aa5('0x40')]=[{'all':!![]}];}return db[_0x5aa5('0x3e')]['findAll'](_0xb417cb);})[_0x5aa5('0x22')](function(_0xe0939d){_0x4d3894[_0x5aa5('0x41')]=_0xe0939d;return _0x4d3894;})['then'](respondWithFilteredResult(_0x4a9fde,_0xb417cb))[_0x5aa5('0x42')](handleError(_0x4a9fde,null));};exports[_0x5aa5('0x43')]=function(_0x1a02fb,_0x30c6dd){var _0x2a9f40={'raw':!![],'where':{'id':_0x1a02fb['params']['id']}},_0x2878d3={};_0x2878d3[_0x5aa5('0x2d')]=_['keys'](db[_0x5aa5('0x3e')]['rawAttributes']);_0x2878d3[_0x5aa5('0x2e')]=_['keys'](_0x1a02fb[_0x5aa5('0x2e')]);_0x2878d3[_0x5aa5('0x30')]=_[_0x5aa5('0x31')](_0x2878d3[_0x5aa5('0x2d')],_0x2878d3[_0x5aa5('0x2e')]);_0x2a9f40[_0x5aa5('0x32')]=_[_0x5aa5('0x31')](_0x2878d3[_0x5aa5('0x2d')],qs[_0x5aa5('0x33')](_0x1a02fb[_0x5aa5('0x2e')][_0x5aa5('0x33')]));_0x2a9f40[_0x5aa5('0x32')]=_0x2a9f40[_0x5aa5('0x32')]['length']?_0x2a9f40[_0x5aa5('0x32')]:_0x2878d3[_0x5aa5('0x2d')];if(_0x1a02fb[_0x5aa5('0x2e')][_0x5aa5('0x3f')]){_0x2a9f40[_0x5aa5('0x40')]=[{'all':!![]}];}_0x2a9f40=_[_0x5aa5('0x3b')]({},_0x2a9f40,_0x1a02fb[_0x5aa5('0x44')]);return db['ZohoField']['find'](_0x2a9f40)['then'](handleEntityNotFound(_0x30c6dd,null))[_0x5aa5('0x22')](respondWithResult(_0x30c6dd,null))[_0x5aa5('0x42')](handleError(_0x30c6dd,null));};exports['create']=function(_0x3fed11,_0x54a1d9){return db['ZohoField'][_0x5aa5('0x45')](_0x3fed11['body'],{})['then'](respondWithResult(_0x54a1d9,0xc9))[_0x5aa5('0x42')](handleError(_0x54a1d9,null));};exports[_0x5aa5('0x21')]=function(_0x5c5e88,_0x48b156){if(_0x5c5e88[_0x5aa5('0x46')]['id']){delete _0x5c5e88[_0x5aa5('0x46')]['id'];}return db[_0x5aa5('0x3e')][_0x5aa5('0x47')]({'where':{'id':_0x5c5e88['params']['id']}})[_0x5aa5('0x22')](handleEntityNotFound(_0x48b156,null))[_0x5aa5('0x22')](saveUpdates(_0x5c5e88[_0x5aa5('0x46')],null))['then'](respondWithResult(_0x48b156,null))[_0x5aa5('0x42')](handleError(_0x48b156,null));};exports[_0x5aa5('0x23')]=function(_0x4dda7a,_0x119374){return db[_0x5aa5('0x3e')][_0x5aa5('0x47')]({'where':{'id':_0x4dda7a[_0x5aa5('0x48')]['id']}})[_0x5aa5('0x22')](handleEntityNotFound(_0x119374,null))[_0x5aa5('0x22')](removeEntity(_0x119374,null))[_0x5aa5('0x42')](handleError(_0x119374,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index faadcfd..e98daa7 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 _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x30a604,_0x243139){var _0x4d918b=function(_0x4353f6){while(--_0x4353f6){_0x30a604['push'](_0x30a604['shift']());}};_0x4d918b(++_0x243139);}(_0xa46e,0x8a));var _0xea46=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xa46e[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','ZohoField','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x524e,0x15e));var _0xe524=function(_0x3745bf,_0x4e3c9b){_0x3745bf=_0x3745bf-0x0;var _0x2f9633=_0x524e[_0x3745bf];return _0x2f9633;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xd'),_0xe524('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 73fb9a9..70c4ec1 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 _0x6ab2=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','ZohoField,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ab2,0x134));var _0x26ab=function(_0x3197a6,_0x43399e){_0x3197a6=_0x3197a6-0x0;var _0x2cca8c=_0x6ab2[_0x3197a6];return _0x2cca8c;};'use strict';var _=require(_0x26ab('0x0'));var util=require(_0x26ab('0x1'));var moment=require(_0x26ab('0x2'));var BPromise=require(_0x26ab('0x3'));var rs=require(_0x26ab('0x4'));var fs=require('fs');var Redis=require(_0x26ab('0x5'));var db=require(_0x26ab('0x6'))['db'];var utils=require(_0x26ab('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x26ab('0x8'));var jayson=require(_0x26ab('0x9'));var client=jayson[_0x26ab('0xa')][_0x26ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x331d11,_0x3e6f77,_0x1c0fa9){return new BPromise(function(_0x5e4d6d,_0x3da5b3){return client['request'](_0x331d11,_0x1c0fa9)[_0x26ab('0xc')](function(_0x1fd11b){logger[_0x26ab('0xd')]('ZohoField,\x20%s,\x20%s',_0x3e6f77,_0x26ab('0xe'));logger[_0x26ab('0xf')](_0x26ab('0x10'),_0x3e6f77,_0x26ab('0xe'),JSON['stringify'](_0x1fd11b));if(_0x1fd11b[_0x26ab('0x11')]){if(_0x1fd11b[_0x26ab('0x11')]['code']===0x1f4){logger[_0x26ab('0x11')]('ZohoField,\x20%s,\x20%s',_0x3e6f77,_0x1fd11b[_0x26ab('0x11')][_0x26ab('0x12')]);return _0x3da5b3(_0x1fd11b[_0x26ab('0x11')][_0x26ab('0x12')]);}logger[_0x26ab('0x11')]('ZohoField,\x20%s,\x20%s',_0x3e6f77,_0x1fd11b[_0x26ab('0x11')]['message']);return _0x5e4d6d(_0x1fd11b[_0x26ab('0x11')]['message']);}else{logger['info'](_0x26ab('0x13'),_0x3e6f77,_0x26ab('0xe'));_0x5e4d6d(_0x1fd11b[_0x26ab('0x14')][_0x26ab('0x12')]);}})[_0x26ab('0x15')](function(_0x57889a){logger[_0x26ab('0x11')](_0x26ab('0x13'),_0x3e6f77,_0x57889a);_0x3da5b3(_0x57889a);});});} \ No newline at end of file +var _0xebf6=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0xebf6,0x98));var _0x6ebf=function(_0x280a81,_0xbe23b8){_0x280a81=_0x280a81-0x0;var _0x46ba97=_0xebf6[_0x280a81];return _0x46ba97;};'use strict';var _=require(_0x6ebf('0x0'));var util=require('util');var moment=require(_0x6ebf('0x1'));var BPromise=require(_0x6ebf('0x2'));var rs=require(_0x6ebf('0x3'));var fs=require('fs');var Redis=require(_0x6ebf('0x4'));var db=require(_0x6ebf('0x5'))['db'];var utils=require(_0x6ebf('0x6'));var logger=require(_0x6ebf('0x7'))(_0x6ebf('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ebf('0x9')][_0x6ebf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4eda,_0x586852,_0xf4a951){return new BPromise(function(_0x494b55,_0x127b3b){return client[_0x6ebf('0xb')](_0x3a4eda,_0xf4a951)[_0x6ebf('0xc')](function(_0x455ab7){logger[_0x6ebf('0xd')](_0x6ebf('0xe'),_0x586852,_0x6ebf('0xf'));logger[_0x6ebf('0x10')](_0x6ebf('0x11'),_0x586852,_0x6ebf('0xf'),JSON[_0x6ebf('0x12')](_0x455ab7));if(_0x455ab7[_0x6ebf('0x13')]){if(_0x455ab7[_0x6ebf('0x13')][_0x6ebf('0x14')]===0x1f4){logger[_0x6ebf('0x13')](_0x6ebf('0xe'),_0x586852,_0x455ab7[_0x6ebf('0x13')][_0x6ebf('0x15')]);return _0x127b3b(_0x455ab7[_0x6ebf('0x13')][_0x6ebf('0x15')]);}logger[_0x6ebf('0x13')]('ZohoField,\x20%s,\x20%s',_0x586852,_0x455ab7['error'][_0x6ebf('0x15')]);return _0x494b55(_0x455ab7['error']['message']);}else{logger[_0x6ebf('0xd')](_0x6ebf('0xe'),_0x586852,_0x6ebf('0xf'));_0x494b55(_0x455ab7[_0x6ebf('0x16')]['message']);}})[_0x6ebf('0x17')](function(_0x5b5076){logger[_0x6ebf('0x13')]('ZohoField,\x20%s,\x20%s',_0x586852,_0x5b5076);_0x127b3b(_0x5b5076);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 132024b..bb74888 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x558130,_0x3e16b7){var _0x4b6b0a=function(_0x30d6fa){while(--_0x30d6fa){_0x558130['push'](_0x558130['shift']());}};_0x4b6b0a(++_0x3e16b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x154ffb,_0x45a886){var _0x5aee36=function(_0x1c86e3){while(--_0x1c86e3){_0x154ffb['push'](_0x154ffb['shift']());}};_0x5aee36(++_0x45a886);}(_0xe706,0xa3));var _0x6e70=function(_0x39d89b,_0x413243){_0x39d89b=_0x39d89b-0x0;var _0x477b21=_0xe706[_0x39d89b];return _0x477b21;};'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 36baea6..f20eb78 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 _0x86f5=['state','sequelize','STRING','unique_name_and_version','INTEGER'];(function(_0x4758e9,_0x55d62a){var _0x460ea7=function(_0x44cde3){while(--_0x44cde3){_0x4758e9['push'](_0x4758e9['shift']());}};_0x460ea7(++_0x55d62a);}(_0x86f5,0x74));var _0x586f=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x86f5[_0x4573bd];return _0xc07bb9;};'use strict';var Sequelize=require(_0x586f('0x0'));module['exports']={'name':{'type':Sequelize[_0x586f('0x1')],'allowNull':![],'unique':_0x586f('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x586f('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x586f('0x1')]},'path':{'type':Sequelize[_0x586f('0x1')]},'type':{'type':Sequelize[_0x586f('0x1')]},'size':{'type':Sequelize[_0x586f('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x586f('0x1')]},'logo':{'type':Sequelize[_0x586f('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x586f('0x4')},'description':{'type':Sequelize[_0x586f('0x1')]},'title':{'type':Sequelize[_0x586f('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xf09f=['unique_name_and_version','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xf09f,0x1cc));var _0xff09=function(_0x38164e,_0x37965b){_0x38164e=_0x38164e-0x0;var _0x5ac387=_0xf09f[_0x38164e];return _0x5ac387;};'use strict';var Sequelize=require('sequelize');module[_0xff09('0x0')]={'name':{'type':Sequelize[_0xff09('0x1')],'allowNull':![],'unique':_0xff09('0x2')},'version':{'type':Sequelize[_0xff09('0x1')],'allowNull':![],'unique':_0xff09('0x2')},'main':{'type':Sequelize[_0xff09('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xff09('0x1')]},'path':{'type':Sequelize[_0xff09('0x1')]},'type':{'type':Sequelize[_0xff09('0x1')]},'size':{'type':Sequelize[_0xff09('0x3')]},'active':{'type':Sequelize[_0xff09('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xff09('0x1')]},'logo':{'type':Sequelize[_0xff09('0x1')]},'state':{'type':Sequelize[_0xff09('0x1')],'unique':_0xff09('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xff09('0x1')]},'remoteUri':{'type':Sequelize[_0xff09('0x1')]},'link':{'type':Sequelize[_0xff09('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a10718e..3055764 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 _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x430c,0x1a1));var _0xc430=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x430c[_0x5e8eae];return _0xdd09cd;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5f2f,0x73));var _0xf5f2=function(_0x136743,_0x3edfa6){_0x136743=_0x136743-0x0;var _0x9e84e6=_0x5f2f[_0x136743];return _0x9e84e6;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f1be08e..e6510e1 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 _0xf96b=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','api','moment','bluebird','request-promise'];(function(_0x59e8c6,_0x847c24){var _0x4e6c5b=function(_0x34f364){while(--_0x34f364){_0x59e8c6['push'](_0x59e8c6['shift']());}};_0x4e6c5b(++_0x847c24);}(_0xf96b,0x12f));var _0xbf96=function(_0x59bde1,_0x51a354){_0x59bde1=_0x59bde1-0x0;var _0x4883fa=_0xf96b[_0x59bde1];return _0x4883fa;};'use strict';var _=require(_0xbf96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf96('0x1'));var moment=require(_0xbf96('0x2'));var BPromise=require(_0xbf96('0x3'));var rp=require(_0xbf96('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf96('0x5'));var config=require(_0xbf96('0x6'));var attributes=require(_0xbf96('0x7'));module[_0xbf96('0x8')]=function(_0x28c621,_0x190222){return _0x28c621[_0xbf96('0x9')](_0xbf96('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f23=['integrations','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3f23,0x1d7));var _0x33f2=function(_0xcbee18,_0x5abd24){_0xcbee18=_0xcbee18-0x0;var _0x5e5979=_0x3f23[_0xcbee18];return _0x5e5979;};'use strict';var _=require('lodash');var util=require(_0x33f2('0x0'));var logger=require(_0x33f2('0x1'))(_0x33f2('0x2'));var moment=require('moment');var BPromise=require(_0x33f2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33f2('0x4'));var rimraf=require(_0x33f2('0x5'));var config=require(_0x33f2('0x6'));var attributes=require('./integration.attributes');module[_0x33f2('0x7')]=function(_0x4e20c1,_0x1b0664){return _0x4e20c1[_0x33f2('0x8')]('Integration',attributes,{'tableName':_0x33f2('0x9'),'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 1ed7ab0..d2e9f95 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4929c,_0x1241e7){var _0x2251ba=function(_0x3b8c8f){while(--_0x3b8c8f){_0x4929c['push'](_0x4929c['shift']());}};_0x2251ba(++_0x1241e7);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25120d,_0x525958){var _0x127dea=function(_0x2677b6){while(--_0x2677b6){_0x25120d['push'](_0x25120d['shift']());}};_0x127dea(++_0x525958);}(_0x7880,0x1f4));var _0x0788=function(_0x2f4311,_0xd2d511){_0x2f4311=_0x2f4311-0x0;var _0x309ccb=_0x7880[_0x2f4311];return _0x309ccb;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bcfe92f..1117192 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 _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x1967,0x173));var _0x7196=function(_0x96a8d7,_0x2df3d2){_0x96a8d7=_0x96a8d7-0x0;var _0x433a60=_0x1967[_0x96a8d7];return _0x433a60;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file +var _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x896e,0x1e9));var _0xe896=function(_0x32233e,_0x57a0a0){_0x32233e=_0x32233e-0x0;var _0x3af118=_0x896e[_0x32233e];return _0x3af118;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6d5bf9a..58bfade 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 _0xf6ac=['TEXT','ENUM','SENT','RECEIVED','FAILED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5ba513,_0x459c3b){var _0x1132a0=function(_0x2fe943){while(--_0x2fe943){_0x5ba513['push'](_0x5ba513['shift']());}};_0x1132a0(++_0x459c3b);}(_0xf6ac,0x181));var _0xcf6a=function(_0x2cb1df,_0x4b439c){_0x2cb1df=_0x2cb1df-0x0;var _0x30e674=_0xf6ac[_0x2cb1df];return _0x30e674;};'use strict';var Sequelize=require('sequelize');module[_0xcf6a('0x0')]={'integration':{'type':Sequelize[_0xcf6a('0x1')]},'eventChannel':{'type':Sequelize[_0xcf6a('0x1')]},'exitStatus':{'type':Sequelize[_0xcf6a('0x1')]},'ticketId':{'type':Sequelize[_0xcf6a('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xcf6a('0x1')]},'uniqueid':{'type':Sequelize[_0xcf6a('0x1')]},'calleridnum':{'type':Sequelize[_0xcf6a('0x1')]},'calleridname':{'type':Sequelize[_0xcf6a('0x1')]},'queue':{'type':Sequelize[_0xcf6a('0x1')]},'interface':{'type':Sequelize[_0xcf6a('0x1')]},'membername':{'type':Sequelize[_0xcf6a('0x1')]},'agentcalledAt':{'type':Sequelize[_0xcf6a('0x2')]},'agentconnectAt':{'type':Sequelize[_0xcf6a('0x2')]},'holdtime':{'type':Sequelize[_0xcf6a('0x3')]},'agentcomplete':{'type':Sequelize[_0xcf6a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xcf6a('0x3')]},'agentacw':{'type':Sequelize[_0xcf6a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xcf6a('0x3')]},'reason':{'type':Sequelize[_0xcf6a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xcf6a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xcf6a('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xcf6a('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcf6a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcf6a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcf6a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcf6a('0x1')]},'accountcode':{'type':Sequelize[_0xcf6a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcf6a('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xcf6a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xcf6a('0x1')]},'destcalleridname':{'type':Sequelize[_0xcf6a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xcf6a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xcf6a('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xcf6a('0x1')]},'destpriority':{'type':Sequelize[_0xcf6a('0x1')]},'destuniqueid':{'type':Sequelize[_0xcf6a('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcf6a('0x1')]},'subject':{'type':Sequelize[_0xcf6a('0x1')]},'from':{'type':Sequelize[_0xcf6a('0x1')]},'to':{'type':Sequelize[_0xcf6a('0x1')]},'cc':{'type':Sequelize[_0xcf6a('0x1')]},'attachment':{'type':Sequelize[_0xcf6a('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xcf6a('0x6')](_0xcf6a('0x7'),'SENDING',_0xcf6a('0x8'),_0xcf6a('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xcf6a('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2131=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x406c24,_0x179d52){var _0x3ce5cd=function(_0x5200cb){while(--_0x5200cb){_0x406c24['push'](_0x406c24['shift']());}};_0x3ce5cd(++_0x179d52);}(_0x2131,0x156));var _0x1213=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x2131[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require(_0x1213('0x0'));module[_0x1213('0x1')]={'integration':{'type':Sequelize[_0x1213('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x1213('0x2')]},'ticketId':{'type':Sequelize[_0x1213('0x2')]},'integrationId':{'type':Sequelize[_0x1213('0x3')]},'contacts':{'type':Sequelize[_0x1213('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1213('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1213('0x2')]},'interface':{'type':Sequelize[_0x1213('0x2')]},'membername':{'type':Sequelize[_0x1213('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1213('0x4')]},'agentconnectAt':{'type':Sequelize[_0x1213('0x4')]},'holdtime':{'type':Sequelize[_0x1213('0x3')]},'agentcomplete':{'type':Sequelize[_0x1213('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1213('0x3')]},'agentacw':{'type':Sequelize[_0x1213('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1213('0x3')]},'reason':{'type':Sequelize[_0x1213('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x1213('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1213('0x4')]},'agentdump':{'type':Sequelize[_0x1213('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1213('0x4')]},'lastevent':{'type':Sequelize[_0x1213('0x2')]},'channel':{'type':Sequelize[_0x1213('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1213('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1213('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1213('0x2')]},'context':{'type':Sequelize[_0x1213('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1213('0x2')]},'destchannel':{'type':Sequelize[_0x1213('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1213('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1213('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1213('0x2')]},'destlanguage':{'type':Sequelize[_0x1213('0x2')]},'destaccountcode':{'type':Sequelize[_0x1213('0x2')]},'destcontext':{'type':Sequelize[_0x1213('0x2')]},'destexten':{'type':Sequelize[_0x1213('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x1213('0x2')]},'messageId':{'type':Sequelize[_0x1213('0x2')]},'inReplyTo':{'type':Sequelize[_0x1213('0x2')]},'subject':{'type':Sequelize[_0x1213('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1213('0x2')]},'cc':{'type':Sequelize[_0x1213('0x2')]},'attachment':{'type':Sequelize[_0x1213('0x6')]},'html':{'type':Sequelize[_0x1213('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x1213('0x7')]('SENT','SENDING',_0x1213('0x8'),_0x1213('0x9'))},'url':{'type':Sequelize[_0x1213('0x2')]},'app':{'type':Sequelize[_0x1213('0x2')]},'appdata':{'type':Sequelize[_0x1213('0x2')]},'projectId':{'type':Sequelize[_0x1213('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index dd28ea6..582cb63 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 _0xa1a5=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','type','query','keys','filters','attributes','intersection','model','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa1a5,0x81));var _0x5a1a=function(_0x59b268,_0x189b4d){_0x59b268=_0x59b268-0x0;var _0x248e0b=_0xa1a5[_0x59b268];return _0x248e0b;};'use strict';var emlformat=require(_0x5a1a('0x0'));var rimraf=require(_0x5a1a('0x1'));var zipdir=require(_0x5a1a('0x2'));var jsonpatch=require(_0x5a1a('0x3'));var rp=require(_0x5a1a('0x4'));var moment=require('moment');var BPromise=require(_0x5a1a('0x5'));var Mustache=require(_0x5a1a('0x6'));var util=require(_0x5a1a('0x7'));var path=require(_0x5a1a('0x8'));var sox=require(_0x5a1a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a1a('0xa'));var _=require('lodash');var squel=require(_0x5a1a('0xb'));var crypto=require('crypto');var jsforce=require(_0x5a1a('0xc'));var deskjs=require(_0x5a1a('0xd'));var toCsv=require(_0x5a1a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5a1a('0xf'));var authService=require(_0x5a1a('0x10'));var qs=require(_0x5a1a('0x11'));var as=require(_0x5a1a('0x12'));var hardwareService=require(_0x5a1a('0x13'));var logger=require(_0x5a1a('0x14'))(_0x5a1a('0x15'));var utils=require(_0x5a1a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5a1a('0x17'));var db=require(_0x5a1a('0x18'))['db'];function respondWithStatusCode(_0x4619da,_0x37a83e){_0x37a83e=_0x37a83e||0xcc;return function(_0x869f09){if(_0x869f09){return _0x4619da[_0x5a1a('0x19')](_0x37a83e);}return _0x4619da['status'](_0x37a83e)[_0x5a1a('0x1a')]();};}function respondWithResult(_0x3f415b,_0x79fc7c){_0x79fc7c=_0x79fc7c||0xc8;return function(_0x48af22){if(_0x48af22){return _0x3f415b['status'](_0x79fc7c)[_0x5a1a('0x1b')](_0x48af22);}};}function respondWithFilteredResult(_0x5c7db9,_0x437a83){return function(_0x266c63){if(_0x266c63){var _0x432a55=typeof _0x437a83[_0x5a1a('0x1c')]==='undefined'&&typeof _0x437a83[_0x5a1a('0x1d')]==='undefined';var _0x40c9ce=_0x266c63[_0x5a1a('0x1e')];var _0x4b0e82=_0x432a55?0x0:_0x437a83[_0x5a1a('0x1c')];var _0x3a0ba3=_0x432a55?_0x266c63[_0x5a1a('0x1e')]:_0x437a83[_0x5a1a('0x1c')]+_0x437a83[_0x5a1a('0x1d')];var _0x279162;if(_0x3a0ba3>=_0x40c9ce){_0x3a0ba3=_0x40c9ce;_0x279162=0xc8;}else{_0x279162=0xce;}_0x5c7db9[_0x5a1a('0x1f')](_0x279162);return _0x5c7db9[_0x5a1a('0x20')](_0x5a1a('0x21'),_0x4b0e82+'-'+_0x3a0ba3+'/'+_0x40c9ce)[_0x5a1a('0x1b')](_0x266c63);}return null;};}function patchUpdates(_0x1ff87a){return function(_0x152dc1){try{jsonpatch[_0x5a1a('0x22')](_0x152dc1,_0x1ff87a,!![]);}catch(_0x8b9a7f){return BPromise[_0x5a1a('0x23')](_0x8b9a7f);}return _0x152dc1['save']();};}function saveUpdates(_0x1c4e79,_0x434e7a){return function(_0x5a027a){if(_0x5a027a){return _0x5a027a[_0x5a1a('0x24')](_0x1c4e79)[_0x5a1a('0x25')](function(_0x492043){return _0x492043;});}return null;};}function removeEntity(_0x594f97,_0x2fb0b9){return function(_0xd3ea5){if(_0xd3ea5){return _0xd3ea5[_0x5a1a('0x26')]()[_0x5a1a('0x25')](function(){_0x594f97['status'](0xcc)[_0x5a1a('0x1a')]();});}};}function handleEntityNotFound(_0x52b537,_0xe5b0e4){return function(_0x25d6d2){if(!_0x25d6d2){_0x52b537[_0x5a1a('0x19')](0x194);}return _0x25d6d2;};}function handleError(_0x4b5e47,_0x5c5c02){_0x5c5c02=_0x5c5c02||0x1f4;return function(_0x1157a3){logger[_0x5a1a('0x27')](_0x1157a3[_0x5a1a('0x28')]);if(_0x1157a3[_0x5a1a('0x29')]){delete _0x1157a3[_0x5a1a('0x29')];}_0x4b5e47[_0x5a1a('0x1f')](_0x5c5c02)[_0x5a1a('0x2a')](_0x1157a3);};}exports[_0x5a1a('0x2b')]=function(_0x5ca4f6,_0x529a4e){var _0x4cfbe5={},_0x5347e5={},_0x260f85={'count':0x0,'rows':[]};var _0x3cf3ad=_[_0x5a1a('0x2c')](db[_0x5a1a('0x2d')]['rawAttributes'],function(_0x5d2ac6){return{'name':_0x5d2ac6['fieldName'],'type':_0x5d2ac6[_0x5a1a('0x2e')]['key']};});_0x5347e5['model']=_[_0x5a1a('0x2c')](_0x3cf3ad,_0x5a1a('0x29'));_0x5347e5[_0x5a1a('0x2f')]=_[_0x5a1a('0x30')](_0x5ca4f6['query']);_0x5347e5[_0x5a1a('0x31')]=_['intersection'](_0x5347e5['model'],_0x5347e5[_0x5a1a('0x2f')]);_0x4cfbe5[_0x5a1a('0x32')]=_[_0x5a1a('0x33')](_0x5347e5[_0x5a1a('0x34')],qs['fields'](_0x5ca4f6[_0x5a1a('0x2f')][_0x5a1a('0x35')]));_0x4cfbe5[_0x5a1a('0x32')]=_0x4cfbe5['attributes']['length']?_0x4cfbe5[_0x5a1a('0x32')]:_0x5347e5[_0x5a1a('0x34')];if(!_0x5ca4f6[_0x5a1a('0x2f')]['hasOwnProperty'](_0x5a1a('0x36'))){_0x4cfbe5[_0x5a1a('0x1d')]=qs[_0x5a1a('0x1d')](_0x5ca4f6['query'][_0x5a1a('0x1d')]);_0x4cfbe5[_0x5a1a('0x1c')]=qs[_0x5a1a('0x1c')](_0x5ca4f6[_0x5a1a('0x2f')][_0x5a1a('0x1c')]);}_0x4cfbe5['order']=qs[_0x5a1a('0x37')](_0x5ca4f6[_0x5a1a('0x2f')][_0x5a1a('0x37')]);_0x4cfbe5[_0x5a1a('0x38')]=qs['filters'](_[_0x5a1a('0x39')](_0x5ca4f6[_0x5a1a('0x2f')],_0x5347e5['filters']),_0x3cf3ad);if(_0x5ca4f6[_0x5a1a('0x2f')][_0x5a1a('0x3a')]){_0x4cfbe5[_0x5a1a('0x38')]=_[_0x5a1a('0x3b')](_0x4cfbe5[_0x5a1a('0x38')],{'$or':_[_0x5a1a('0x2c')](_0x3cf3ad,function(_0xa10c17){if(_0xa10c17['type']!==_0x5a1a('0x3c')){var _0x2253ce={};_0x2253ce[_0xa10c17[_0x5a1a('0x29')]]={'$like':'%'+_0x5ca4f6['query'][_0x5a1a('0x3a')]+'%'};return _0x2253ce;}})});}_0x4cfbe5=_[_0x5a1a('0x3b')]({},_0x4cfbe5,_0x5ca4f6[_0x5a1a('0x3d')]);var _0x138f8e={'where':_0x4cfbe5[_0x5a1a('0x38')]};return db[_0x5a1a('0x2d')][_0x5a1a('0x1e')](_0x138f8e)[_0x5a1a('0x25')](function(_0x17c254){_0x260f85[_0x5a1a('0x1e')]=_0x17c254;if(_0x5ca4f6[_0x5a1a('0x2f')][_0x5a1a('0x3e')]){_0x4cfbe5[_0x5a1a('0x3f')]=[{'all':!![]}];}return db[_0x5a1a('0x2d')][_0x5a1a('0x40')](_0x4cfbe5);})['then'](function(_0x4692e1){_0x260f85[_0x5a1a('0x41')]=_0x4692e1;return _0x260f85;})[_0x5a1a('0x25')](respondWithFilteredResult(_0x529a4e,_0x4cfbe5))[_0x5a1a('0x42')](handleError(_0x529a4e,null));};exports[_0x5a1a('0x43')]=function(_0x5c8c3b,_0x1c713c){var _0x3c0ce1={'raw':![],'where':{'id':_0x5c8c3b[_0x5a1a('0x44')]['id']}},_0x34e3b3={};_0x34e3b3[_0x5a1a('0x34')]=_[_0x5a1a('0x30')](db[_0x5a1a('0x2d')][_0x5a1a('0x45')]);_0x34e3b3['query']=_[_0x5a1a('0x30')](_0x5c8c3b['query']);_0x34e3b3[_0x5a1a('0x31')]=_[_0x5a1a('0x33')](_0x34e3b3[_0x5a1a('0x34')],_0x34e3b3[_0x5a1a('0x2f')]);_0x3c0ce1['attributes']=_[_0x5a1a('0x33')](_0x34e3b3['model'],qs[_0x5a1a('0x35')](_0x5c8c3b['query'][_0x5a1a('0x35')]));_0x3c0ce1['attributes']=_0x3c0ce1['attributes'][_0x5a1a('0x46')]?_0x3c0ce1['attributes']:_0x34e3b3[_0x5a1a('0x34')];if(_0x5c8c3b['query']['includeAll']){_0x3c0ce1[_0x5a1a('0x3f')]=[{'all':!![]}];}_0x3c0ce1=_[_0x5a1a('0x3b')]({},_0x3c0ce1,_0x5c8c3b[_0x5a1a('0x3d')]);return db[_0x5a1a('0x2d')]['find'](_0x3c0ce1)[_0x5a1a('0x25')](handleEntityNotFound(_0x1c713c,null))[_0x5a1a('0x25')](respondWithResult(_0x1c713c,null))[_0x5a1a('0x42')](handleError(_0x1c713c,null));};exports[_0x5a1a('0x47')]=function(_0x53786d,_0x2b9f18){return db[_0x5a1a('0x2d')][_0x5a1a('0x47')](_0x53786d[_0x5a1a('0x48')],{})[_0x5a1a('0x25')](respondWithResult(_0x2b9f18,0xc9))['catch'](handleError(_0x2b9f18,null));};exports[_0x5a1a('0x24')]=function(_0x145daa,_0x340c51){if(_0x145daa['body']['id']){delete _0x145daa['body']['id'];}return db[_0x5a1a('0x2d')][_0x5a1a('0x49')]({'where':{'id':_0x145daa['params']['id']}})[_0x5a1a('0x25')](handleEntityNotFound(_0x340c51,null))[_0x5a1a('0x25')](saveUpdates(_0x145daa[_0x5a1a('0x48')],null))[_0x5a1a('0x25')](respondWithResult(_0x340c51,null))[_0x5a1a('0x42')](handleError(_0x340c51,null));};exports[_0x5a1a('0x26')]=function(_0x354872,_0x43a5fb){return db['IntegrationReport'][_0x5a1a('0x49')]({'where':{'id':_0x354872[_0x5a1a('0x44')]['id']}})[_0x5a1a('0x25')](handleEntityNotFound(_0x43a5fb,null))[_0x5a1a('0x25')](removeEntity(_0x43a5fb,null))[_0x5a1a('0x42')](handleError(_0x43a5fb,null));};exports[_0x5a1a('0x4a')]=function(_0x53cbb5,_0x2a0bcb){return db[_0x5a1a('0x2d')][_0x5a1a('0x4a')]()[_0x5a1a('0x25')](respondWithResult(_0x2a0bcb,null))['catch'](handleError(_0x2a0bcb,null));}; \ No newline at end of file +var _0xa833=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa833,0x89));var _0x3a83=function(_0x2cd6d6,_0xed7a03){_0x2cd6d6=_0x2cd6d6-0x0;var _0x2c1d96=_0xa833[_0x2cd6d6];return _0x2c1d96;};'use strict';var emlformat=require(_0x3a83('0x0'));var rimraf=require(_0x3a83('0x1'));var zipdir=require(_0x3a83('0x2'));var jsonpatch=require(_0x3a83('0x3'));var rp=require(_0x3a83('0x4'));var moment=require('moment');var BPromise=require(_0x3a83('0x5'));var Mustache=require(_0x3a83('0x6'));var util=require(_0x3a83('0x7'));var path=require(_0x3a83('0x8'));var sox=require('sox');var csv=require(_0x3a83('0x9'));var ejs=require(_0x3a83('0xa'));var fs=require('fs');var fs_extra=require(_0x3a83('0xb'));var _=require(_0x3a83('0xc'));var squel=require(_0x3a83('0xd'));var crypto=require('crypto');var jsforce=require(_0x3a83('0xe'));var deskjs=require(_0x3a83('0xf'));var toCsv=require(_0x3a83('0x9'));var querystring=require(_0x3a83('0x10'));var Papa=require(_0x3a83('0x11'));var Redis=require(_0x3a83('0x12'));var authService=require(_0x3a83('0x13'));var qs=require(_0x3a83('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a83('0x15'));var logger=require(_0x3a83('0x16'))('api');var utils=require(_0x3a83('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3a83('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x792d96,_0x10fc86){_0x10fc86=_0x10fc86||0xcc;return function(_0x4986a1){if(_0x4986a1){return _0x792d96[_0x3a83('0x19')](_0x10fc86);}return _0x792d96[_0x3a83('0x1a')](_0x10fc86)[_0x3a83('0x1b')]();};}function respondWithResult(_0x475898,_0x5ba8dc){_0x5ba8dc=_0x5ba8dc||0xc8;return function(_0x28e0a8){if(_0x28e0a8){return _0x475898[_0x3a83('0x1a')](_0x5ba8dc)[_0x3a83('0x1c')](_0x28e0a8);}};}function respondWithFilteredResult(_0x56ec99,_0x462840){return function(_0x5ba631){if(_0x5ba631){var _0x19e5b1=typeof _0x462840[_0x3a83('0x1d')]===_0x3a83('0x1e')&&typeof _0x462840[_0x3a83('0x1f')]===_0x3a83('0x1e');var _0x577e68=_0x5ba631[_0x3a83('0x20')];var _0x19037d=_0x19e5b1?0x0:_0x462840[_0x3a83('0x1d')];var _0x52a54a=_0x19e5b1?_0x5ba631[_0x3a83('0x20')]:_0x462840['offset']+_0x462840[_0x3a83('0x1f')];var _0x1dcad5;if(_0x52a54a>=_0x577e68){_0x52a54a=_0x577e68;_0x1dcad5=0xc8;}else{_0x1dcad5=0xce;}_0x56ec99[_0x3a83('0x1a')](_0x1dcad5);return _0x56ec99[_0x3a83('0x21')](_0x3a83('0x22'),_0x19037d+'-'+_0x52a54a+'/'+_0x577e68)[_0x3a83('0x1c')](_0x5ba631);}return null;};}function patchUpdates(_0x473311){return function(_0x33f338){try{jsonpatch['apply'](_0x33f338,_0x473311,!![]);}catch(_0x2214ce){return BPromise[_0x3a83('0x23')](_0x2214ce);}return _0x33f338['save']();};}function saveUpdates(_0x25fb5a,_0x739c25){return function(_0x54ff85){if(_0x54ff85){return _0x54ff85['update'](_0x25fb5a)[_0x3a83('0x24')](function(_0x443e20){return _0x443e20;});}return null;};}function removeEntity(_0x5b0ba9,_0x5dc77c){return function(_0x2f4777){if(_0x2f4777){return _0x2f4777[_0x3a83('0x25')]()[_0x3a83('0x24')](function(){_0x5b0ba9[_0x3a83('0x1a')](0xcc)[_0x3a83('0x1b')]();});}};}function handleEntityNotFound(_0x4ba30b,_0x30b4c){return function(_0x3ea734){if(!_0x3ea734){_0x4ba30b[_0x3a83('0x19')](0x194);}return _0x3ea734;};}function handleError(_0x1c6226,_0x5673b6){_0x5673b6=_0x5673b6||0x1f4;return function(_0x29f334){logger[_0x3a83('0x26')](_0x29f334[_0x3a83('0x27')]);if(_0x29f334[_0x3a83('0x28')]){delete _0x29f334['name'];}_0x1c6226['status'](_0x5673b6)[_0x3a83('0x29')](_0x29f334);};}exports['index']=function(_0x496520,_0x36ae60){var _0x5dcc62={},_0x554e51={},_0x4e2d71={'count':0x0,'rows':[]};var _0x2284fb=_[_0x3a83('0x2a')](db[_0x3a83('0x2b')][_0x3a83('0x2c')],function(_0x4b7f10){return{'name':_0x4b7f10[_0x3a83('0x2d')],'type':_0x4b7f10['type'][_0x3a83('0x2e')]};});_0x554e51[_0x3a83('0x2f')]=_[_0x3a83('0x2a')](_0x2284fb,_0x3a83('0x28'));_0x554e51[_0x3a83('0x30')]=_[_0x3a83('0x31')](_0x496520['query']);_0x554e51[_0x3a83('0x32')]=_[_0x3a83('0x33')](_0x554e51[_0x3a83('0x2f')],_0x554e51[_0x3a83('0x30')]);_0x5dcc62['attributes']=_[_0x3a83('0x33')](_0x554e51['model'],qs['fields'](_0x496520[_0x3a83('0x30')][_0x3a83('0x34')]));_0x5dcc62[_0x3a83('0x35')]=_0x5dcc62[_0x3a83('0x35')][_0x3a83('0x36')]?_0x5dcc62[_0x3a83('0x35')]:_0x554e51[_0x3a83('0x2f')];if(!_0x496520[_0x3a83('0x30')][_0x3a83('0x37')]('nolimit')){_0x5dcc62[_0x3a83('0x1f')]=qs[_0x3a83('0x1f')](_0x496520[_0x3a83('0x30')][_0x3a83('0x1f')]);_0x5dcc62[_0x3a83('0x1d')]=qs['offset'](_0x496520[_0x3a83('0x30')]['offset']);}_0x5dcc62[_0x3a83('0x38')]=qs[_0x3a83('0x39')](_0x496520['query'][_0x3a83('0x39')]);_0x5dcc62[_0x3a83('0x3a')]=qs[_0x3a83('0x32')](_['pick'](_0x496520[_0x3a83('0x30')],_0x554e51['filters']),_0x2284fb);if(_0x496520[_0x3a83('0x30')]['filter']){_0x5dcc62['where']=_[_0x3a83('0x3b')](_0x5dcc62[_0x3a83('0x3a')],{'$or':_['map'](_0x2284fb,function(_0x37e441){if(_0x37e441[_0x3a83('0x3c')]!==_0x3a83('0x3d')){var _0x3cd1c2={};_0x3cd1c2[_0x37e441['name']]={'$like':'%'+_0x496520[_0x3a83('0x30')][_0x3a83('0x3e')]+'%'};return _0x3cd1c2;}})});}_0x5dcc62=_[_0x3a83('0x3b')]({},_0x5dcc62,_0x496520['options']);var _0x34e81c={'where':_0x5dcc62[_0x3a83('0x3a')]};return db[_0x3a83('0x2b')][_0x3a83('0x20')](_0x34e81c)[_0x3a83('0x24')](function(_0x573106){_0x4e2d71[_0x3a83('0x20')]=_0x573106;if(_0x496520[_0x3a83('0x30')][_0x3a83('0x3f')]){_0x5dcc62[_0x3a83('0x40')]=[{'all':!![]}];}return db[_0x3a83('0x2b')][_0x3a83('0x41')](_0x5dcc62);})['then'](function(_0x5e399b){_0x4e2d71[_0x3a83('0x42')]=_0x5e399b;return _0x4e2d71;})[_0x3a83('0x24')](respondWithFilteredResult(_0x36ae60,_0x5dcc62))[_0x3a83('0x43')](handleError(_0x36ae60,null));};exports[_0x3a83('0x44')]=function(_0x3ce535,_0x4df30b){var _0x299cef={'raw':![],'where':{'id':_0x3ce535['params']['id']}},_0x14c8fc={};_0x14c8fc[_0x3a83('0x2f')]=_[_0x3a83('0x31')](db[_0x3a83('0x2b')][_0x3a83('0x2c')]);_0x14c8fc[_0x3a83('0x30')]=_[_0x3a83('0x31')](_0x3ce535['query']);_0x14c8fc['filters']=_[_0x3a83('0x33')](_0x14c8fc[_0x3a83('0x2f')],_0x14c8fc[_0x3a83('0x30')]);_0x299cef[_0x3a83('0x35')]=_['intersection'](_0x14c8fc[_0x3a83('0x2f')],qs['fields'](_0x3ce535['query'][_0x3a83('0x34')]));_0x299cef['attributes']=_0x299cef[_0x3a83('0x35')][_0x3a83('0x36')]?_0x299cef[_0x3a83('0x35')]:_0x14c8fc[_0x3a83('0x2f')];if(_0x3ce535['query'][_0x3a83('0x3f')]){_0x299cef['include']=[{'all':!![]}];}_0x299cef=_[_0x3a83('0x3b')]({},_0x299cef,_0x3ce535[_0x3a83('0x45')]);return db[_0x3a83('0x2b')][_0x3a83('0x46')](_0x299cef)[_0x3a83('0x24')](handleEntityNotFound(_0x4df30b,null))[_0x3a83('0x24')](respondWithResult(_0x4df30b,null))[_0x3a83('0x43')](handleError(_0x4df30b,null));};exports['create']=function(_0xa42a3a,_0x4b46ff){return db[_0x3a83('0x2b')][_0x3a83('0x47')](_0xa42a3a[_0x3a83('0x48')],{})[_0x3a83('0x24')](respondWithResult(_0x4b46ff,0xc9))[_0x3a83('0x43')](handleError(_0x4b46ff,null));};exports[_0x3a83('0x49')]=function(_0x2490b1,_0x40cdb6){if(_0x2490b1[_0x3a83('0x48')]['id']){delete _0x2490b1[_0x3a83('0x48')]['id'];}return db[_0x3a83('0x2b')][_0x3a83('0x46')]({'where':{'id':_0x2490b1[_0x3a83('0x4a')]['id']}})[_0x3a83('0x24')](handleEntityNotFound(_0x40cdb6,null))[_0x3a83('0x24')](saveUpdates(_0x2490b1[_0x3a83('0x48')],null))[_0x3a83('0x24')](respondWithResult(_0x40cdb6,null))[_0x3a83('0x43')](handleError(_0x40cdb6,null));};exports[_0x3a83('0x25')]=function(_0x4e4919,_0x12b9c3){return db[_0x3a83('0x2b')][_0x3a83('0x46')]({'where':{'id':_0x4e4919[_0x3a83('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12b9c3,null))['then'](removeEntity(_0x12b9c3,null))[_0x3a83('0x43')](handleError(_0x12b9c3,null));};exports['describe']=function(_0xc706a3,_0x4fbdd4){return db['IntegrationReport'][_0x3a83('0x4b')]()[_0x3a83('0x24')](respondWithResult(_0x4fbdd4,null))[_0x3a83('0x43')](handleError(_0x4fbdd4,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 03a34d2..d280b67 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 _0x259a=['util','../../config/logger','api','moment','../../config/environment','define','IntegrationReport'];(function(_0x49988d,_0x15dae4){var _0x2259f7=function(_0x1c964d){while(--_0x1c964d){_0x49988d['push'](_0x49988d['shift']());}};_0x2259f7(++_0x15dae4);}(_0x259a,0x196));var _0xa259=function(_0x32e2f6,_0x11e862){_0x32e2f6=_0x32e2f6-0x0;var _0x109fa7=_0x259a[_0x32e2f6];return _0x109fa7;};'use strict';var _=require('lodash');var util=require(_0xa259('0x0'));var logger=require(_0xa259('0x1'))(_0xa259('0x2'));var moment=require(_0xa259('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(_0xa259('0x4'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x49b83a,_0x2d8b74){return _0x49b83a[_0xa259('0x5')](_0xa259('0x6'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3985=['bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','../../config/logger','moment'];(function(_0x15126c,_0x4bba87){var _0x1df910=function(_0x8f49b2){while(--_0x8f49b2){_0x15126c['push'](_0x15126c['shift']());}};_0x1df910(++_0x4bba87);}(_0x3985,0x75));var _0x5398=function(_0xf58068,_0x477039){_0xf58068=_0xf58068-0x0;var _0x47b40a=_0x3985[_0xf58068];return _0x47b40a;};'use strict';var _=require(_0x5398('0x0'));var util=require('util');var logger=require(_0x5398('0x1'))('api');var moment=require(_0x5398('0x2'));var BPromise=require(_0x5398('0x3'));var rp=require(_0x5398('0x4'));var fs=require('fs');var path=require(_0x5398('0x5'));var rimraf=require(_0x5398('0x6'));var config=require(_0x5398('0x7'));var attributes=require(_0x5398('0x8'));module[_0x5398('0x9')]=function(_0x3dceb3,_0x13f6e8){return _0x3dceb3[_0x5398('0xa')]('IntegrationReport',attributes,{'tableName':_0x5398('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3478e7f..11e3d0c 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0xca3285,_0x147f1b){var _0x193e81=function(_0x4f19d3){while(--_0x4f19d3){_0xca3285['push'](_0xca3285['shift']());}};_0x193e81(++_0x147f1b);}(_0x2675,0x75));var _0x5267=function(_0x29f2c8,_0x3bbedc){_0x29f2c8=_0x29f2c8-0x0;var _0x105934=_0x2675[_0x29f2c8];return _0x105934;};'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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4ed529,_0x16dd6d){var _0x4bde17=function(_0x561213){while(--_0x561213){_0x4ed529['push'](_0x4ed529['shift']());}};_0x4bde17(++_0x16dd6d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d069bf0..fc93b4a 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 _0x2cc4=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addIntervals'];(function(_0x3b08c0,_0x54e8e0){var _0x4c3e43=function(_0x5d04f4){while(--_0x5d04f4){_0x3b08c0['push'](_0x3b08c0['shift']());}};_0x4c3e43(++_0x54e8e0);}(_0x2cc4,0xdd));var _0x42cc=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x2cc4[_0x5c768b];return _0x335af8;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require(_0x42cc('0x4'));var router=express['Router']();var fs_extra=require(_0x42cc('0x5'));var auth=require(_0x42cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x42cc('0x7'));var controller=require(_0x42cc('0x8'));router[_0x42cc('0x9')]('/',auth[_0x42cc('0xa')](),controller[_0x42cc('0xb')]);router['get'](_0x42cc('0xc'),auth[_0x42cc('0xa')](),controller[_0x42cc('0xd')]);router[_0x42cc('0x9')](_0x42cc('0xe'),auth[_0x42cc('0xa')](),controller[_0x42cc('0xf')]);router[_0x42cc('0x10')]('/',auth[_0x42cc('0xa')](),controller[_0x42cc('0x11')]);router[_0x42cc('0x10')](_0x42cc('0xe'),auth['isAuthenticated'](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0x42cc('0xa')](),controller[_0x42cc('0x12')]);router[_0x42cc('0x13')](_0x42cc('0xc'),auth['isAuthenticated'](),controller[_0x42cc('0x14')]);router[_0x42cc('0x15')](_0x42cc('0xc'),auth[_0x42cc('0xa')](),controller[_0x42cc('0x16')]);module[_0x42cc('0x17')]=router; \ No newline at end of file +var _0xb175=['multer','util','path','connect-timeout','Router','isAuthenticated','index','get','/:id','show','getIntervals','create','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy'];(function(_0x4084fe,_0x19aad9){var _0x598649=function(_0xa81c8f){while(--_0xa81c8f){_0x4084fe['push'](_0x4084fe['shift']());}};_0x598649(++_0x19aad9);}(_0xb175,0x1a4));var _0x5b17=function(_0x2c60b2,_0x17bea9){_0x2c60b2=_0x2c60b2-0x0;var _0x56045e=_0xb175[_0x2c60b2];return _0x56045e;};'use strict';var multer=require(_0x5b17('0x0'));var util=require(_0x5b17('0x1'));var path=require(_0x5b17('0x2'));var timeout=require(_0x5b17('0x3'));var express=require('express');var router=express[_0x5b17('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('./interval.controller');router['get']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0x6')]);router[_0x5b17('0x7')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x9')]);router[_0x5b17('0x7')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x5b17('0xa')]);router['post']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0xb')]);router[_0x5b17('0xc')](_0x5b17('0xd'),auth[_0x5b17('0x5')](),controller[_0x5b17('0xe')]);router[_0x5b17('0xc')](_0x5b17('0xf'),auth[_0x5b17('0x5')](),controller['addIntervals']);router[_0x5b17('0x10')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x11')]);router[_0x5b17('0x12')](_0x5b17('0x8'),auth['isAuthenticated'](),controller[_0x5b17('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 96047ce..40791b3 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 _0xa522=['STRING'];(function(_0x3a0e04,_0x2b31b4){var _0x1788a5=function(_0x3a543b){while(--_0x3a543b){_0x3a0e04['push'](_0x3a0e04['shift']());}};_0x1788a5(++_0x2b31b4);}(_0xa522,0x1cc));var _0x2a52=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xa522[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2a52('0x0')]},'description':{'type':Sequelize[_0x2a52('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xcab8=['STRING','sequelize'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xcab8,0x183));var _0x8cab=function(_0x305730,_0x185538){_0x305730=_0x305730-0x0;var _0x3a3f2c=_0xcab8[_0x305730];return _0x3a3f2c;};'use strict';var Sequelize=require(_0x8cab('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cab('0x1')]},'description':{'type':Sequelize[_0x8cab('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7716215..2c5d98a 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 _0x614c=['send','index','map','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','Interval','rows','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','end','sendStatus','error','stack'];(function(_0x422c4e,_0x3468a9){var _0x484021=function(_0x34dd49){while(--_0x34dd49){_0x422c4e['push'](_0x422c4e['shift']());}};_0x484021(++_0x3468a9);}(_0x614c,0x1a9));var _0xc614=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x614c[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc614('0x0'));var jsonpatch=require(_0xc614('0x1'));var rp=require(_0xc614('0x2'));var moment=require(_0xc614('0x3'));var BPromise=require(_0xc614('0x4'));var Mustache=require('mustache');var util=require(_0xc614('0x5'));var path=require(_0xc614('0x6'));var sox=require(_0xc614('0x7'));var csv=require(_0xc614('0x8'));var ejs=require(_0xc614('0x9'));var fs=require('fs');var fs_extra=require(_0xc614('0xa'));var _=require(_0xc614('0xb'));var squel=require(_0xc614('0xc'));var crypto=require(_0xc614('0xd'));var jsforce=require(_0xc614('0xe'));var deskjs=require(_0xc614('0xf'));var toCsv=require(_0xc614('0x8'));var querystring=require(_0xc614('0x10'));var Papa=require('papaparse');var Redis=require(_0xc614('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc614('0x12'));var as=require(_0xc614('0x13'));var hardwareService=require(_0xc614('0x14'));var logger=require(_0xc614('0x15'))(_0xc614('0x16'));var utils=require(_0xc614('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc614('0x18'));var db=require(_0xc614('0x19'))['db'];var extensions=require(_0xc614('0x1a'));function respondWithStatusCode(_0x44792b,_0x2d9bee){_0x2d9bee=_0x2d9bee||0xcc;return function(_0x5b824b){if(_0x5b824b){return _0x44792b['sendStatus'](_0x2d9bee);}return _0x44792b[_0xc614('0x1b')](_0x2d9bee)['end']();};}function respondWithResult(_0x263b1f,_0x55659b){_0x55659b=_0x55659b||0xc8;return function(_0x4eb912){if(_0x4eb912){return _0x263b1f[_0xc614('0x1b')](_0x55659b)[_0xc614('0x1c')](_0x4eb912);}};}function respondWithFilteredResult(_0x2f6030,_0x29210e){return function(_0x4b3762){if(_0x4b3762){var _0x2eb7b3=typeof _0x29210e[_0xc614('0x1d')]===_0xc614('0x1e')&&typeof _0x29210e[_0xc614('0x1f')]==='undefined';var _0x379d7f=_0x4b3762[_0xc614('0x20')];var _0x5ea096=_0x2eb7b3?0x0:_0x29210e[_0xc614('0x1d')];var _0x6fb8ed=_0x2eb7b3?_0x4b3762[_0xc614('0x20')]:_0x29210e[_0xc614('0x1d')]+_0x29210e[_0xc614('0x1f')];var _0x3a29bd;if(_0x6fb8ed>=_0x379d7f){_0x6fb8ed=_0x379d7f;_0x3a29bd=0xc8;}else{_0x3a29bd=0xce;}_0x2f6030[_0xc614('0x1b')](_0x3a29bd);return _0x2f6030[_0xc614('0x21')](_0xc614('0x22'),_0x5ea096+'-'+_0x6fb8ed+'/'+_0x379d7f)[_0xc614('0x1c')](_0x4b3762);}return null;};}function patchUpdates(_0x4af676){return function(_0x5884c6){try{jsonpatch[_0xc614('0x23')](_0x5884c6,_0x4af676,!![]);}catch(_0x2225d8){return BPromise[_0xc614('0x24')](_0x2225d8);}return _0x5884c6['save']();};}function saveUpdates(_0x27d4db,_0x74f067){return function(_0x84e044){if(_0x84e044){return _0x84e044['update'](_0x27d4db)[_0xc614('0x25')](function(_0x47f497){return _0x47f497;});}return null;};}function removeEntity(_0x3d9404,_0x1525ca){return function(_0x2057c1){if(_0x2057c1){return _0x2057c1[_0xc614('0x26')]()[_0xc614('0x25')](function(){var _0x53a1a0=_0x2057c1[_0xc614('0x27')]({'plain':!![]});var _0x458c5d='Intervals';return db[_0xc614('0x28')][_0xc614('0x26')]({'where':{'type':_0x458c5d,'resourceId':_0x53a1a0['id']}})[_0xc614('0x25')](function(){return _0x2057c1;});})[_0xc614('0x25')](function(){_0x3d9404[_0xc614('0x1b')](0xcc)[_0xc614('0x29')]();});}};}function handleEntityNotFound(_0x2fae48,_0x3f7807){return function(_0x3d0ea9){if(!_0x3d0ea9){_0x2fae48[_0xc614('0x2a')](0x194);}return _0x3d0ea9;};}function handleError(_0x42c13e,_0x4d7d7f){_0x4d7d7f=_0x4d7d7f||0x1f4;return function(_0x2a7d3e){logger[_0xc614('0x2b')](_0x2a7d3e[_0xc614('0x2c')]);if(_0x2a7d3e['name']){delete _0x2a7d3e['name'];}_0x42c13e['status'](_0x4d7d7f)[_0xc614('0x2d')](_0x2a7d3e);};}exports[_0xc614('0x2e')]=function(_0x503fd4,_0x522c42){var _0x15c10b={},_0x286ddd={},_0x2cf849={'count':0x0,'rows':[]};var _0x2b2b57=_[_0xc614('0x2f')](db['Interval']['rawAttributes'],function(_0x1f3933){return{'name':_0x1f3933['fieldName'],'type':_0x1f3933[_0xc614('0x30')]['key']};});_0x286ddd[_0xc614('0x31')]=_['map'](_0x2b2b57,_0xc614('0x32'));_0x286ddd[_0xc614('0x33')]=_[_0xc614('0x34')](_0x503fd4[_0xc614('0x33')]);_0x286ddd[_0xc614('0x35')]=_[_0xc614('0x36')](_0x286ddd[_0xc614('0x31')],_0x286ddd[_0xc614('0x33')]);_0x15c10b[_0xc614('0x37')]=_[_0xc614('0x36')](_0x286ddd[_0xc614('0x31')],qs[_0xc614('0x38')](_0x503fd4[_0xc614('0x33')]['fields']));_0x15c10b[_0xc614('0x37')]=_0x15c10b[_0xc614('0x37')][_0xc614('0x39')]?_0x15c10b[_0xc614('0x37')]:_0x286ddd[_0xc614('0x31')];if(!_0x503fd4[_0xc614('0x33')][_0xc614('0x3a')](_0xc614('0x3b'))){_0x15c10b[_0xc614('0x1f')]=qs[_0xc614('0x1f')](_0x503fd4[_0xc614('0x33')][_0xc614('0x1f')]);_0x15c10b[_0xc614('0x1d')]=qs['offset'](_0x503fd4['query'][_0xc614('0x1d')]);}_0x15c10b[_0xc614('0x3c')]=qs['sort'](_0x503fd4[_0xc614('0x33')][_0xc614('0x3d')]);_0x15c10b[_0xc614('0x3e')]=qs[_0xc614('0x35')](_[_0xc614('0x3f')](_0x503fd4[_0xc614('0x33')],_0x286ddd['filters']),_0x2b2b57);if(_0x503fd4['query'][_0xc614('0x40')]){_0x15c10b['where']=_[_0xc614('0x41')](_0x15c10b[_0xc614('0x3e')],{'$or':_['map'](_0x2b2b57,function(_0x5a6260){if(_0x5a6260['type']!==_0xc614('0x42')){var _0x2d8bf5={};_0x2d8bf5[_0x5a6260['name']]={'$like':'%'+_0x503fd4['query']['filter']+'%'};return _0x2d8bf5;}})});}_0x15c10b=_[_0xc614('0x41')]({},_0x15c10b,_0x503fd4['options']);var _0x5f3878={'where':_0x15c10b['where']};return db['Interval'][_0xc614('0x20')](_0x5f3878)[_0xc614('0x25')](function(_0x51f8c8){_0x2cf849[_0xc614('0x20')]=_0x51f8c8;if(_0x503fd4[_0xc614('0x33')][_0xc614('0x43')]){_0x15c10b[_0xc614('0x44')]=[{'all':!![]}];}return db[_0xc614('0x45')]['findAll'](_0x15c10b);})[_0xc614('0x25')](function(_0x1262e9){_0x2cf849[_0xc614('0x46')]=_0x1262e9;return _0x2cf849;})[_0xc614('0x25')](respondWithFilteredResult(_0x522c42,_0x15c10b))['catch'](handleError(_0x522c42,null));};exports['show']=function(_0x222a44,_0x3e65ed){var _0xf65ce8={'raw':!![],'where':{'id':_0x222a44[_0xc614('0x47')]['id']}},_0x400f8c={};_0x400f8c[_0xc614('0x31')]=_['keys'](db['Interval'][_0xc614('0x48')]);_0x400f8c[_0xc614('0x33')]=_[_0xc614('0x34')](_0x222a44[_0xc614('0x33')]);_0x400f8c['filters']=_[_0xc614('0x36')](_0x400f8c[_0xc614('0x31')],_0x400f8c[_0xc614('0x33')]);_0xf65ce8[_0xc614('0x37')]=_[_0xc614('0x36')](_0x400f8c[_0xc614('0x31')],qs[_0xc614('0x38')](_0x222a44[_0xc614('0x33')][_0xc614('0x38')]));_0xf65ce8[_0xc614('0x37')]=_0xf65ce8['attributes'][_0xc614('0x39')]?_0xf65ce8[_0xc614('0x37')]:_0x400f8c[_0xc614('0x31')];if(_0x222a44[_0xc614('0x33')][_0xc614('0x43')]){_0xf65ce8[_0xc614('0x44')]=[{'all':!![]}];}_0xf65ce8=_[_0xc614('0x41')]({},_0xf65ce8,_0x222a44[_0xc614('0x49')]);return db[_0xc614('0x45')][_0xc614('0x4a')](_0xf65ce8)[_0xc614('0x25')](handleEntityNotFound(_0x3e65ed,null))[_0xc614('0x25')](respondWithResult(_0x3e65ed,null))['catch'](handleError(_0x3e65ed,null));};exports[_0xc614('0x4b')]=function(_0x45da6c,_0x37616a){return db[_0xc614('0x45')][_0xc614('0x4b')](_0x45da6c[_0xc614('0x4c')],{})[_0xc614('0x25')](function(_0x408f22){var _0x2f4c30=_0x45da6c['user'][_0xc614('0x27')]({'plain':!![]});if(!_0x2f4c30)throw new Error(_0xc614('0x4d'));if(_0x2f4c30[_0xc614('0x4e')]===_0xc614('0x4f')){var _0x5de83f=_0x408f22[_0xc614('0x27')]({'plain':!![]});var _0x1a3657=_0xc614('0x50');return db[_0xc614('0x51')][_0xc614('0x4a')]({'where':{'name':_0x1a3657,'userProfileId':_0x2f4c30[_0xc614('0x52')]},'raw':!![]})[_0xc614('0x25')](function(_0x1104d0){if(_0x1104d0&&_0x1104d0[_0xc614('0x53')]===0x0){return db[_0xc614('0x28')]['create']({'name':_0x5de83f[_0xc614('0x32')],'resourceId':_0x5de83f['id'],'type':_0x1104d0[_0xc614('0x32')],'sectionId':_0x1104d0['id']},{})[_0xc614('0x25')](function(){return _0x408f22;});}else{return _0x408f22;}})[_0xc614('0x54')](function(_0x5de6c9){logger[_0xc614('0x2b')](_0xc614('0x55'),_0x5de6c9);throw _0x5de6c9;});}return _0x408f22;})['then'](respondWithResult(_0x37616a,0xc9))[_0xc614('0x54')](handleError(_0x37616a,null));};exports[_0xc614('0x56')]=function(_0x58b79f,_0x893d86){if(_0x58b79f[_0xc614('0x4c')]['id']){delete _0x58b79f[_0xc614('0x4c')]['id'];}return db[_0xc614('0x45')][_0xc614('0x4a')]({'where':{'id':_0x58b79f['params']['id']}})['then'](handleEntityNotFound(_0x893d86,null))['then'](saveUpdates(_0x58b79f[_0xc614('0x4c')],null))[_0xc614('0x25')](respondWithResult(_0x893d86,null))['catch'](handleError(_0x893d86,null));};exports[_0xc614('0x26')]=function(_0x293984,_0xa41278){return db[_0xc614('0x45')]['find']({'where':{'id':_0x293984['params']['id']}})[_0xc614('0x25')](handleEntityNotFound(_0xa41278,null))[_0xc614('0x25')](removeEntity(_0xa41278,null))[_0xc614('0x54')](handleError(_0xa41278,null));};exports[_0xc614('0x57')]=function(_0x300685,_0x5c1f1d,_0x4f33f9){if(_0x300685[_0xc614('0x4c')]['id']){delete _0x300685[_0xc614('0x4c')]['id'];}return db['Interval']['find']({'where':{'id':_0x300685[_0xc614('0x47')]['id']}})[_0xc614('0x25')](handleEntityNotFound(_0x5c1f1d,null))[_0xc614('0x25')](function(_0x1e1d15){if(_0x1e1d15){_0x300685[_0xc614('0x4c')][_0xc614('0x58')]=_0x1e1d15['id'];return db[_0xc614('0x45')]['create'](_0x300685['body']);}})[_0xc614('0x25')](respondWithResult(_0x5c1f1d,null))[_0xc614('0x54')](handleError(_0x5c1f1d,null));};exports[_0xc614('0x59')]=function(_0x4de270,_0x44124f,_0x54541d){var _0x4c261d={};var _0x2fd975={};var _0x396862;var _0x5b81c8;return db[_0xc614('0x45')][_0xc614('0x5a')]({'where':{'id':_0x4de270['params']['id']}})[_0xc614('0x25')](handleEntityNotFound(_0x44124f,null))['then'](function(_0x1cb4ba){if(_0x1cb4ba){_0x396862=_0x1cb4ba;_0x2fd975[_0xc614('0x31')]=_[_0xc614('0x34')](db[_0xc614('0x45')][_0xc614('0x48')]);_0x2fd975['query']=_['keys'](_0x4de270['query']);_0x2fd975['filters']=_['intersection'](_0x2fd975[_0xc614('0x31')],_0x2fd975['query']);_0x4c261d[_0xc614('0x37')]=_['intersection'](_0x2fd975[_0xc614('0x31')],qs[_0xc614('0x38')](_0x4de270['query'][_0xc614('0x38')]));_0x4c261d[_0xc614('0x37')]=_0x4c261d[_0xc614('0x37')][_0xc614('0x39')]?_0x4c261d[_0xc614('0x37')]:_0x2fd975[_0xc614('0x31')];_0x4c261d[_0xc614('0x3c')]=qs[_0xc614('0x3d')](_0x4de270[_0xc614('0x33')][_0xc614('0x3d')]);_0x4c261d[_0xc614('0x3e')]=qs[_0xc614('0x35')](_[_0xc614('0x3f')](_0x4de270[_0xc614('0x33')],_0x2fd975[_0xc614('0x35')]));if(_0x4de270['query'][_0xc614('0x40')]){_0x4c261d[_0xc614('0x3e')]=_[_0xc614('0x41')](_0x4c261d['where'],{'$or':_['map'](_0x4c261d['attributes'],function(_0x526f5d){var _0x512075={};_0x512075[_0x526f5d]={'$like':'%'+_0x4de270[_0xc614('0x33')][_0xc614('0x40')]+'%'};return _0x512075;})});}_0x4c261d=_[_0xc614('0x41')]({},_0x4c261d,_0x4de270['options']);return _0x396862['getIntervals'](_0x4c261d);}})[_0xc614('0x25')](function(_0x2ee18a){if(_0x2ee18a){_0x5b81c8=_0x2ee18a[_0xc614('0x39')];if(!_0x4de270[_0xc614('0x33')][_0xc614('0x3a')](_0xc614('0x3b'))){_0x4c261d[_0xc614('0x1f')]=qs[_0xc614('0x1f')](_0x4de270[_0xc614('0x33')][_0xc614('0x1f')]);_0x4c261d['offset']=qs[_0xc614('0x1d')](_0x4de270[_0xc614('0x33')][_0xc614('0x1d')]);}return _0x396862[_0xc614('0x59')](_0x4c261d);}})[_0xc614('0x25')](function(_0x14eb0e){if(_0x14eb0e){return _0x14eb0e?{'count':_0x5b81c8,'rows':_0x14eb0e}:null;}})[_0xc614('0x25')](respondWithResult(_0x44124f,null))['catch'](handleError(_0x44124f,null));};exports[_0xc614('0x5b')]=function(_0x3dc752,_0xe99f2b,_0x49907d){return db[_0xc614('0x45')][_0xc614('0x5a')]({'where':{'id':_0x3dc752[_0xc614('0x47')]['id']}})['then'](handleEntityNotFound(_0xe99f2b,null))['then'](function(_0xb396ff){if(_0xb396ff){return db[_0xc614('0x5c')]['transaction'](function(_0x493274){return db[_0xc614('0x45')][_0xc614('0x26')]({'where':{'IntervalId':_0x3dc752[_0xc614('0x47')]['id']},'transaction':_0x493274})[_0xc614('0x25')](function(_0x4657f1){var _0x15c1ca=_['map'](_0x3dc752[_0xc614('0x4c')],function(_0x41606c){delete _0x41606c['id'];_0x41606c[_0xc614('0x58')]=_0x3dc752[_0xc614('0x47')]['id'];return _0x41606c;});return db[_0xc614('0x45')][_0xc614('0x5d')](_0x15c1ca,{'transaction':_0x493274});});})[_0xc614('0x25')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x3dc752[_0xc614('0x47')]['id']}});});}})[_0xc614('0x25')](respondWithResult(_0xe99f2b,null))[_0xc614('0x54')](handleError(_0xe99f2b,null));}; \ No newline at end of file +var _0x0420=['path','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/utils','../../components/extensions/rewrite','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','Intervals','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','body','find','addInterval','IntervalId','getIntervals','order','findOne','sequelize','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x36a645,_0x49dc2f){var _0x361ca7=function(_0x268548){while(--_0x268548){_0x36a645['push'](_0x36a645['shift']());}};_0x361ca7(++_0x49dc2f);}(_0x0420,0x164));var _0x0042=function(_0x216f98,_0x470c7f){_0x216f98=_0x216f98-0x0;var _0xea6b36=_0x0420[_0x216f98];return _0xea6b36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0042('0x0'));var zipdir=require(_0x0042('0x1'));var jsonpatch=require(_0x0042('0x2'));var rp=require(_0x0042('0x3'));var moment=require(_0x0042('0x4'));var BPromise=require(_0x0042('0x5'));var Mustache=require(_0x0042('0x6'));var util=require(_0x0042('0x7'));var path=require(_0x0042('0x8'));var sox=require('sox');var csv=require(_0x0042('0x9'));var ejs=require(_0x0042('0xa'));var fs=require('fs');var fs_extra=require(_0x0042('0xb'));var _=require(_0x0042('0xc'));var squel=require(_0x0042('0xd'));var crypto=require(_0x0042('0xe'));var jsforce=require(_0x0042('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0042('0x9'));var querystring=require(_0x0042('0x10'));var Papa=require(_0x0042('0x11'));var Redis=require('ioredis');var authService=require(_0x0042('0x12'));var qs=require(_0x0042('0x13'));var as=require(_0x0042('0x14'));var hardwareService=require(_0x0042('0x15'));var logger=require(_0x0042('0x16'))(_0x0042('0x17'));var utils=require(_0x0042('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x0042('0x19'));function respondWithStatusCode(_0x2b5add,_0x30291d){_0x30291d=_0x30291d||0xcc;return function(_0x42d662){if(_0x42d662){return _0x2b5add[_0x0042('0x1a')](_0x30291d);}return _0x2b5add[_0x0042('0x1b')](_0x30291d)[_0x0042('0x1c')]();};}function respondWithResult(_0x4e602b,_0x4bdfdf){_0x4bdfdf=_0x4bdfdf||0xc8;return function(_0x26379e){if(_0x26379e){return _0x4e602b['status'](_0x4bdfdf)['json'](_0x26379e);}};}function respondWithFilteredResult(_0xa280b1,_0x1e6974){return function(_0x1b34bf){if(_0x1b34bf){var _0x58ec94=typeof _0x1e6974['offset']===_0x0042('0x1d')&&typeof _0x1e6974['limit']===_0x0042('0x1d');var _0x4915da=_0x1b34bf[_0x0042('0x1e')];var _0x135009=_0x58ec94?0x0:_0x1e6974[_0x0042('0x1f')];var _0x4acc62=_0x58ec94?_0x1b34bf[_0x0042('0x1e')]:_0x1e6974[_0x0042('0x1f')]+_0x1e6974[_0x0042('0x20')];var _0x4a6671;if(_0x4acc62>=_0x4915da){_0x4acc62=_0x4915da;_0x4a6671=0xc8;}else{_0x4a6671=0xce;}_0xa280b1['status'](_0x4a6671);return _0xa280b1[_0x0042('0x21')](_0x0042('0x22'),_0x135009+'-'+_0x4acc62+'/'+_0x4915da)[_0x0042('0x23')](_0x1b34bf);}return null;};}function patchUpdates(_0x520eb1){return function(_0x8b1478){try{jsonpatch[_0x0042('0x24')](_0x8b1478,_0x520eb1,!![]);}catch(_0x3ecde6){return BPromise[_0x0042('0x25')](_0x3ecde6);}return _0x8b1478['save']();};}function saveUpdates(_0x29320a,_0x5a1d30){return function(_0x7caadb){if(_0x7caadb){return _0x7caadb[_0x0042('0x26')](_0x29320a)['then'](function(_0xb48310){return _0xb48310;});}return null;};}function removeEntity(_0x28d329,_0x446089){return function(_0x3bd259){if(_0x3bd259){return _0x3bd259[_0x0042('0x27')]()[_0x0042('0x28')](function(){var _0x40c5fa=_0x3bd259[_0x0042('0x29')]({'plain':!![]});var _0x4a8316=_0x0042('0x2a');return db['UserProfileResource'][_0x0042('0x27')]({'where':{'type':_0x4a8316,'resourceId':_0x40c5fa['id']}})[_0x0042('0x28')](function(){return _0x3bd259;});})['then'](function(){_0x28d329[_0x0042('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d213,_0x1d5329){return function(_0x267f75){if(!_0x267f75){_0x38d213['sendStatus'](0x194);}return _0x267f75;};}function handleError(_0x2e1bf5,_0x5af85b){_0x5af85b=_0x5af85b||0x1f4;return function(_0x208f1d){logger[_0x0042('0x2b')](_0x208f1d[_0x0042('0x2c')]);if(_0x208f1d[_0x0042('0x2d')]){delete _0x208f1d[_0x0042('0x2d')];}_0x2e1bf5[_0x0042('0x1b')](_0x5af85b)[_0x0042('0x2e')](_0x208f1d);};}exports['index']=function(_0x383899,_0x1b93a8){var _0x427918={},_0x22c84a={},_0x16053b={'count':0x0,'rows':[]};var _0x423eff=_[_0x0042('0x2f')](db[_0x0042('0x30')][_0x0042('0x31')],function(_0x56510c){return{'name':_0x56510c[_0x0042('0x32')],'type':_0x56510c[_0x0042('0x33')]['key']};});_0x22c84a[_0x0042('0x34')]=_[_0x0042('0x2f')](_0x423eff,_0x0042('0x2d'));_0x22c84a[_0x0042('0x35')]=_[_0x0042('0x36')](_0x383899[_0x0042('0x35')]);_0x22c84a[_0x0042('0x37')]=_['intersection'](_0x22c84a[_0x0042('0x34')],_0x22c84a[_0x0042('0x35')]);_0x427918[_0x0042('0x38')]=_[_0x0042('0x39')](_0x22c84a[_0x0042('0x34')],qs[_0x0042('0x3a')](_0x383899[_0x0042('0x35')][_0x0042('0x3a')]));_0x427918[_0x0042('0x38')]=_0x427918[_0x0042('0x38')]['length']?_0x427918[_0x0042('0x38')]:_0x22c84a[_0x0042('0x34')];if(!_0x383899[_0x0042('0x35')][_0x0042('0x3b')](_0x0042('0x3c'))){_0x427918[_0x0042('0x20')]=qs[_0x0042('0x20')](_0x383899['query']['limit']);_0x427918[_0x0042('0x1f')]=qs['offset'](_0x383899[_0x0042('0x35')]['offset']);}_0x427918['order']=qs['sort'](_0x383899['query'][_0x0042('0x3d')]);_0x427918[_0x0042('0x3e')]=qs[_0x0042('0x37')](_[_0x0042('0x3f')](_0x383899[_0x0042('0x35')],_0x22c84a['filters']),_0x423eff);if(_0x383899[_0x0042('0x35')][_0x0042('0x40')]){_0x427918[_0x0042('0x3e')]=_[_0x0042('0x41')](_0x427918[_0x0042('0x3e')],{'$or':_[_0x0042('0x2f')](_0x423eff,function(_0x412b9c){if(_0x412b9c[_0x0042('0x33')]!==_0x0042('0x42')){var _0x22fa7b={};_0x22fa7b[_0x412b9c[_0x0042('0x2d')]]={'$like':'%'+_0x383899['query']['filter']+'%'};return _0x22fa7b;}})});}_0x427918=_['merge']({},_0x427918,_0x383899['options']);var _0x500df3={'where':_0x427918[_0x0042('0x3e')]};return db[_0x0042('0x30')]['count'](_0x500df3)[_0x0042('0x28')](function(_0x16a6ec){_0x16053b['count']=_0x16a6ec;if(_0x383899['query'][_0x0042('0x43')]){_0x427918[_0x0042('0x44')]=[{'all':!![]}];}return db[_0x0042('0x30')][_0x0042('0x45')](_0x427918);})[_0x0042('0x28')](function(_0x5ad386){_0x16053b['rows']=_0x5ad386;return _0x16053b;})[_0x0042('0x28')](respondWithFilteredResult(_0x1b93a8,_0x427918))['catch'](handleError(_0x1b93a8,null));};exports[_0x0042('0x46')]=function(_0x3200d1,_0x6a3ffc){var _0xc39cab={'raw':!![],'where':{'id':_0x3200d1[_0x0042('0x47')]['id']}},_0x4edac3={};_0x4edac3[_0x0042('0x34')]=_[_0x0042('0x36')](db[_0x0042('0x30')][_0x0042('0x31')]);_0x4edac3[_0x0042('0x35')]=_[_0x0042('0x36')](_0x3200d1[_0x0042('0x35')]);_0x4edac3['filters']=_[_0x0042('0x39')](_0x4edac3[_0x0042('0x34')],_0x4edac3[_0x0042('0x35')]);_0xc39cab['attributes']=_['intersection'](_0x4edac3[_0x0042('0x34')],qs[_0x0042('0x3a')](_0x3200d1[_0x0042('0x35')][_0x0042('0x3a')]));_0xc39cab[_0x0042('0x38')]=_0xc39cab[_0x0042('0x38')][_0x0042('0x48')]?_0xc39cab[_0x0042('0x38')]:_0x4edac3[_0x0042('0x34')];if(_0x3200d1[_0x0042('0x35')][_0x0042('0x43')]){_0xc39cab[_0x0042('0x44')]=[{'all':!![]}];}_0xc39cab=_[_0x0042('0x41')]({},_0xc39cab,_0x3200d1[_0x0042('0x49')]);return db[_0x0042('0x30')]['find'](_0xc39cab)['then'](handleEntityNotFound(_0x6a3ffc,null))['then'](respondWithResult(_0x6a3ffc,null))['catch'](handleError(_0x6a3ffc,null));};exports[_0x0042('0x4a')]=function(_0x5b85aa,_0xa153b0){return db[_0x0042('0x30')][_0x0042('0x4a')](_0x5b85aa['body'],{})[_0x0042('0x28')](function(_0x157035){var _0x394159=_0x5b85aa[_0x0042('0x4b')][_0x0042('0x29')]({'plain':!![]});if(!_0x394159)throw new Error(_0x0042('0x4c'));if(_0x394159[_0x0042('0x4d')]===_0x0042('0x4b')){var _0x5482f1=_0x157035[_0x0042('0x29')]({'plain':!![]});var _0x364661='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x364661,'userProfileId':_0x394159[_0x0042('0x4e')]},'raw':!![]})[_0x0042('0x28')](function(_0x1add08){if(_0x1add08&&_0x1add08[_0x0042('0x4f')]===0x0){return db[_0x0042('0x50')][_0x0042('0x4a')]({'name':_0x5482f1[_0x0042('0x2d')],'resourceId':_0x5482f1['id'],'type':_0x1add08[_0x0042('0x2d')],'sectionId':_0x1add08['id']},{})[_0x0042('0x28')](function(){return _0x157035;});}else{return _0x157035;}})[_0x0042('0x51')](function(_0x43f2bb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43f2bb);throw _0x43f2bb;});}return _0x157035;})[_0x0042('0x28')](respondWithResult(_0xa153b0,0xc9))['catch'](handleError(_0xa153b0,null));};exports[_0x0042('0x26')]=function(_0x363247,_0x5ca936){if(_0x363247[_0x0042('0x52')]['id']){delete _0x363247[_0x0042('0x52')]['id'];}return db[_0x0042('0x30')]['find']({'where':{'id':_0x363247[_0x0042('0x47')]['id']}})[_0x0042('0x28')](handleEntityNotFound(_0x5ca936,null))[_0x0042('0x28')](saveUpdates(_0x363247[_0x0042('0x52')],null))[_0x0042('0x28')](respondWithResult(_0x5ca936,null))[_0x0042('0x51')](handleError(_0x5ca936,null));};exports[_0x0042('0x27')]=function(_0x14e6d4,_0x427e04){return db[_0x0042('0x30')][_0x0042('0x53')]({'where':{'id':_0x14e6d4[_0x0042('0x47')]['id']}})['then'](handleEntityNotFound(_0x427e04,null))[_0x0042('0x28')](removeEntity(_0x427e04,null))[_0x0042('0x51')](handleError(_0x427e04,null));};exports[_0x0042('0x54')]=function(_0x25c316,_0x1b26c1,_0x1ed8de){if(_0x25c316[_0x0042('0x52')]['id']){delete _0x25c316['body']['id'];}return db[_0x0042('0x30')][_0x0042('0x53')]({'where':{'id':_0x25c316['params']['id']}})['then'](handleEntityNotFound(_0x1b26c1,null))[_0x0042('0x28')](function(_0x8b9d8d){if(_0x8b9d8d){_0x25c316[_0x0042('0x52')][_0x0042('0x55')]=_0x8b9d8d['id'];return db['Interval'][_0x0042('0x4a')](_0x25c316[_0x0042('0x52')]);}})[_0x0042('0x28')](respondWithResult(_0x1b26c1,null))[_0x0042('0x51')](handleError(_0x1b26c1,null));};exports[_0x0042('0x56')]=function(_0x3dcf09,_0x1b9df0,_0x5a176f){var _0x83d826={};var _0x4904f7={};var _0x1c5a31;var _0x1df08e;return db[_0x0042('0x30')]['findOne']({'where':{'id':_0x3dcf09[_0x0042('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b9df0,null))[_0x0042('0x28')](function(_0x31fc9d){if(_0x31fc9d){_0x1c5a31=_0x31fc9d;_0x4904f7[_0x0042('0x34')]=_[_0x0042('0x36')](db['Interval'][_0x0042('0x31')]);_0x4904f7['query']=_[_0x0042('0x36')](_0x3dcf09['query']);_0x4904f7[_0x0042('0x37')]=_[_0x0042('0x39')](_0x4904f7['model'],_0x4904f7[_0x0042('0x35')]);_0x83d826[_0x0042('0x38')]=_['intersection'](_0x4904f7[_0x0042('0x34')],qs[_0x0042('0x3a')](_0x3dcf09[_0x0042('0x35')][_0x0042('0x3a')]));_0x83d826[_0x0042('0x38')]=_0x83d826[_0x0042('0x38')][_0x0042('0x48')]?_0x83d826['attributes']:_0x4904f7[_0x0042('0x34')];_0x83d826[_0x0042('0x57')]=qs['sort'](_0x3dcf09['query']['sort']);_0x83d826['where']=qs[_0x0042('0x37')](_[_0x0042('0x3f')](_0x3dcf09['query'],_0x4904f7[_0x0042('0x37')]));if(_0x3dcf09[_0x0042('0x35')][_0x0042('0x40')]){_0x83d826[_0x0042('0x3e')]=_['merge'](_0x83d826['where'],{'$or':_[_0x0042('0x2f')](_0x83d826[_0x0042('0x38')],function(_0x3cd9c6){var _0x221ad2={};_0x221ad2[_0x3cd9c6]={'$like':'%'+_0x3dcf09[_0x0042('0x35')][_0x0042('0x40')]+'%'};return _0x221ad2;})});}_0x83d826=_['merge']({},_0x83d826,_0x3dcf09['options']);return _0x1c5a31['getIntervals'](_0x83d826);}})[_0x0042('0x28')](function(_0x37e3d4){if(_0x37e3d4){_0x1df08e=_0x37e3d4[_0x0042('0x48')];if(!_0x3dcf09['query'][_0x0042('0x3b')]('nolimit')){_0x83d826[_0x0042('0x20')]=qs[_0x0042('0x20')](_0x3dcf09[_0x0042('0x35')][_0x0042('0x20')]);_0x83d826[_0x0042('0x1f')]=qs[_0x0042('0x1f')](_0x3dcf09[_0x0042('0x35')]['offset']);}return _0x1c5a31[_0x0042('0x56')](_0x83d826);}})['then'](function(_0x1ece6d){if(_0x1ece6d){return _0x1ece6d?{'count':_0x1df08e,'rows':_0x1ece6d}:null;}})[_0x0042('0x28')](respondWithResult(_0x1b9df0,null))['catch'](handleError(_0x1b9df0,null));};exports['addIntervals']=function(_0x1143f5,_0x2d0829,_0x2063b4){return db[_0x0042('0x30')][_0x0042('0x58')]({'where':{'id':_0x1143f5['params']['id']}})[_0x0042('0x28')](handleEntityNotFound(_0x2d0829,null))[_0x0042('0x28')](function(_0x1482a8){if(_0x1482a8){return db[_0x0042('0x59')][_0x0042('0x5a')](function(_0x474737){return db['Interval']['destroy']({'where':{'IntervalId':_0x1143f5['params']['id']},'transaction':_0x474737})[_0x0042('0x28')](function(_0xbec24b){var _0x2a0ac9=_['map'](_0x1143f5[_0x0042('0x52')],function(_0x14cf39){delete _0x14cf39['id'];_0x14cf39[_0x0042('0x55')]=_0x1143f5[_0x0042('0x47')]['id'];return _0x14cf39;});return db[_0x0042('0x30')]['bulkCreate'](_0x2a0ac9,{'transaction':_0x474737});});})[_0x0042('0x28')](function(){return db[_0x0042('0x30')][_0x0042('0x45')]({'where':{'IntervalId':_0x1143f5[_0x0042('0x47')]['id']}});});}})[_0x0042('0x28')](respondWithResult(_0x2d0829,null))[_0x0042('0x51')](handleError(_0x2d0829,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 55ac3ef..47d26fe 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 _0xd7de=['ifTime','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','rewrite','interval','getIntervals','then','map'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd7de,0x121));var _0xed7d=function(_0x1510e7,_0x598173){_0x1510e7=_0x1510e7-0x0;var _0x2f3797=_0xd7de[_0x1510e7];return _0x2f3797;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xed7d('0x0'));var iftime=require(_0xed7d('0x1'))[_0xed7d('0x2')];module[_0xed7d('0x3')]=function(_0x480559){return _0x480559[_0xed7d('0x4')](_0xed7d('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x533651){extensions[_0xed7d('0x6')](_0x480559,_0x533651);},'afterBulkCreate':function(_0x40b693,_0x542a5f,_0xf9d7e0){_0xf9d7e0();extensions[_0xed7d('0x6')](_0x480559,_0x40b693[0x0]);},'afterUpdate':function(_0x1dc942){extensions[_0xed7d('0x6')](_0x480559,_0x1dc942);},'afterDestroy':function(_0xddbecc){extensions['rewrite'](_0x480559,_0xddbecc);}},'instanceMethods':{'ifTime':function(_0x5f3fa4=undefined,_0x52ca7d=new Date()){if(typeof this[_0xed7d('0x7')]==='string'){return iftime(this[_0xed7d('0x7')],_0x5f3fa4,_0x52ca7d);}else{return this[_0xed7d('0x8')]()[_0xed7d('0x9')](function(_0x5f3299){return Promise['all'](_0x5f3299[_0xed7d('0xa')](function(_0x3c7bd9){return _0x3c7bd9[_0xed7d('0xb')](_0x5f3fa4,_0x52ca7d);}));})[_0xed7d('0x9')](function(_0x306855){return _0x306855['reduce'](function(_0x22869b,_0x53abdc){return _0x22869b||_0x53abdc;},![]);});}}}});}; \ No newline at end of file +var _0xa15d=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','reduce'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xa15d,0x1f0));var _0xda15=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xa15d[_0x32b30c];return _0xcfc212;};'use strict';var attributes=require(_0xda15('0x0'));var extensions=require(_0xda15('0x1'));var iftime=require(_0xda15('0x2'))[_0xda15('0x3')];module[_0xda15('0x4')]=function(_0x47ed20){return _0x47ed20['define'](_0xda15('0x5'),attributes,{'tableName':_0xda15('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f98c){extensions[_0xda15('0x7')](_0x47ed20,_0x16f98c);},'afterBulkCreate':function(_0x13fb03,_0x1316f2,_0x44564c){_0x44564c();extensions[_0xda15('0x7')](_0x47ed20,_0x13fb03[0x0]);},'afterUpdate':function(_0x511ba2){extensions[_0xda15('0x7')](_0x47ed20,_0x511ba2);},'afterDestroy':function(_0x3acdf2){extensions[_0xda15('0x7')](_0x47ed20,_0x3acdf2);}},'instanceMethods':{'ifTime':function(_0x3384d5=undefined,_0x4a8473=new Date()){if(typeof this[_0xda15('0x8')]===_0xda15('0x9')){return iftime(this['interval'],_0x3384d5,_0x4a8473);}else{return this[_0xda15('0xa')]()[_0xda15('0xb')](function(_0x43b5ce){return Promise[_0xda15('0xc')](_0x43b5ce[_0xda15('0xd')](function(_0x548422){return _0x548422[_0xda15('0xe')](_0x3384d5,_0x4a8473);}));})['then'](function(_0xb8a874){return _0xb8a874[_0xda15('0xf')](function(_0x50c204,_0x5ae0d9){return _0x50c204||_0x5ae0d9;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4f3e1c5..f4243d1 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 _0x5ec2=['catch','error','message','find','where','attributes','then','ShowInterval','all','reduce','name','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','intervalIds','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','isArray','IntervalIftime','../../mysqldb','iftime','../../config/logger','rpc','Interval','findAll','options','raw','limit','map','include','model','info','GetInterval','debug','stringify'];(function(_0x285610,_0xdd1a21){var _0x4f9eb1=function(_0x56b225){while(--_0x56b225){_0x285610['push'](_0x285610['shift']());}};_0x4f9eb1(++_0xdd1a21);}(_0x5ec2,0xb8));var _0x25ec=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0x5ec2[_0x1a8ff0];return _0x3588bf;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x25ec('0x0'))['db'];var iftime=require('../../utils/iftime')[_0x25ec('0x1')];var logger=require(_0x25ec('0x2'))(_0x25ec('0x3'));exports['GetInterval']=function(_0x144418){var _0xd0534e=this;return new Promise(function(_0x1dbfe1,_0x4e241c){return db[_0x25ec('0x4')][_0x25ec('0x5')]({'raw':_0x144418[_0x25ec('0x6')]?_0x144418[_0x25ec('0x6')][_0x25ec('0x7')]===undefined?!![]:![]:!![],'where':_0x144418['options']?_0x144418[_0x25ec('0x6')]['where']||null:null,'attributes':_0x144418[_0x25ec('0x6')]?_0x144418['options']['attributes']||null:null,'limit':_0x144418['options']?_0x144418['options'][_0x25ec('0x8')]||null:null,'include':_0x144418[_0x25ec('0x6')]?_0x144418[_0x25ec('0x6')]['include']?_['map'](_0x144418[_0x25ec('0x6')]['include'],function(_0x5d665e){return{'model':db[_0x5d665e['model']],'as':_0x5d665e['as'],'attributes':_0x5d665e['attributes'],'include':_0x5d665e['include']?_[_0x25ec('0x9')](_0x5d665e[_0x25ec('0xa')],function(_0xfa1a3e){return{'model':db[_0xfa1a3e[_0x25ec('0xb')]],'as':_0xfa1a3e['as'],'attributes':_0xfa1a3e['attributes'],'include':_0xfa1a3e[_0x25ec('0xa')]?_['map'](_0xfa1a3e['include'],function(_0x511739){return{'model':db[_0x511739['model']],'as':_0x511739['as'],'attributes':_0x511739['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x264c4b){logger[_0x25ec('0xc')](_0x25ec('0xd'),_0x144418);logger[_0x25ec('0xe')](_0x25ec('0xd'),_0x144418,JSON[_0x25ec('0xf')](_0x264c4b));_0x1dbfe1(_0x264c4b);})[_0x25ec('0x10')](function(_0xe9d204){logger[_0x25ec('0x11')](_0x25ec('0xd'),_0xe9d204[_0x25ec('0x12')],_0x144418);_0x4e241c(_0xd0534e[_0x25ec('0x11')](0x1f4,_0xe9d204[_0x25ec('0x12')]));});});};exports['ShowInterval']=function(_0x1d0f39){var _0x182400=this;return new Promise(function(_0xf69ec0,_0x487edd){return db[_0x25ec('0x4')][_0x25ec('0x13')]({'raw':_0x1d0f39[_0x25ec('0x6')]?_0x1d0f39[_0x25ec('0x6')][_0x25ec('0x7')]===undefined?!![]:![]:!![],'where':_0x1d0f39['options']?_0x1d0f39[_0x25ec('0x6')][_0x25ec('0x14')]||null:null,'attributes':_0x1d0f39[_0x25ec('0x6')]?_0x1d0f39[_0x25ec('0x6')]['attributes']||null:null,'include':_0x1d0f39[_0x25ec('0x6')]?_0x1d0f39['options']['include']?_[_0x25ec('0x9')](_0x1d0f39[_0x25ec('0x6')][_0x25ec('0xa')],function(_0x3ab437){return{'model':db[_0x3ab437[_0x25ec('0xb')]],'as':_0x3ab437['as'],'attributes':_0x3ab437['attributes'],'include':_0x3ab437[_0x25ec('0xa')]?_[_0x25ec('0x9')](_0x3ab437['include'],function(_0x430aa4){return{'model':db[_0x430aa4[_0x25ec('0xb')]],'as':_0x430aa4['as'],'attributes':_0x430aa4[_0x25ec('0x15')],'include':_0x430aa4[_0x25ec('0xa')]?_[_0x25ec('0x9')](_0x430aa4['include'],function(_0x54ee70){return{'model':db[_0x54ee70[_0x25ec('0xb')]],'as':_0x54ee70['as'],'attributes':_0x54ee70[_0x25ec('0x15')]};}):[]};}):[]};}):[]:[]})[_0x25ec('0x16')](function(_0x4b8bfa){logger[_0x25ec('0xc')](_0x25ec('0x17'),_0x1d0f39);logger['debug']('ShowInterval',_0x1d0f39,JSON['stringify'](_0x4b8bfa));_0xf69ec0(_0x4b8bfa);})[_0x25ec('0x10')](function(_0x260ead){logger['error'](_0x25ec('0x17'),_0x260ead[_0x25ec('0x12')],_0x1d0f39);_0x487edd(_0x182400[_0x25ec('0x11')](0x1f4,_0x260ead[_0x25ec('0x12')]));});});};function checkArrayOfIntervals(_0x4aeaae,_0x2c0a3c){var _0x1db109=[];return db['Interval'][_0x25ec('0x5')]({'where':{'id':_0x4aeaae}})[_0x25ec('0x16')](function(_0x14bc9a){_0x1db109=_0x14bc9a;return Promise[_0x25ec('0x18')](_0x1db109[_0x25ec('0x9')](function(_0x42741f){return _0x42741f['ifTime'](_0x2c0a3c);}));})[_0x25ec('0x16')](function(_0x6b5a30){var _0x5af8ce=_0x6b5a30[_0x25ec('0x19')](function(_0x4e0442,_0xa8850c){return _0x4e0442||_0xa8850c;},![]);logger[_0x25ec('0xc')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x1db109[_0x25ec('0x9')](function(_0x29dfba){return _0x29dfba[_0x25ec('0x1a')];})[_0x25ec('0x1b')](',\x20'),_0x1db109['map'](function(_0x1d1495){return _0x1d1495['id'];})[_0x25ec('0x1b')](',\x20')));return _0x5af8ce;});}function checkSingleInterval(_0x511876,_0x955aad){return db['Interval']['findById'](_0x511876)['then'](function(_0x3debd1){if(_0x3debd1){logger[_0x25ec('0xc')](util[_0x25ec('0x1c')](_0x25ec('0x1d'),_0x3debd1[_0x25ec('0x1a')],_0x3debd1['id']));return _0x3debd1[_0x25ec('0x1e')](_0x955aad);}});}exports['IntervalIftime']=function(_0x5a411d){var _0x5c930b=_0x5a411d[_0x25ec('0x1f')];var _0x22c208=Array['isArray'](_0x5a411d['intervals'])?_0x5a411d[_0x25ec('0x20')]:typeof _0x5a411d[_0x25ec('0x20')]===_0x25ec('0x21')?[_0x5a411d[_0x25ec('0x20')]]:[];var _0x2d1c3e=_0x5a411d['timezone']||undefined;var _0x3a60f4=![];if(_0x22c208[_0x25ec('0x22')]){logger[_0x25ec('0xc')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x22c208[_0x25ec('0x1b')](';\x20')));}if(_0x2d1c3e){logger['info'](util[_0x25ec('0x1c')](_0x25ec('0x23'),_0x2d1c3e));}logger[_0x25ec('0xe')](_0x25ec('0x24'),_0x3a60f4);logger[_0x25ec('0x25')]('IntervalIftime',_0x5a411d);return Promise['resolve']()['then'](function(){if(Array[_0x25ec('0x26')](_0x5c930b)){return checkArrayOfIntervals(_0x5c930b,_0x2d1c3e);}else if(_0x5c930b){return checkSingleInterval(_0x5c930b,_0x2d1c3e);}})[_0x25ec('0x16')](function(_0x5f1e13){var _0x7a2133=_0x22c208['reduce'](function(_0x4421d1,_0x252496){return _0x4421d1||iftime(_0x252496,_0x2d1c3e);},![]);_0x3a60f4=_0x5f1e13||_0x7a2133;return _0x3a60f4;})[_0x25ec('0x10')](function(_0x395690){logger['error'](_0x25ec('0x27'),_0x5a411d,_0x395690);throw this[_0x25ec('0x11')](0x1f4,_0x395690[_0x25ec('0x12')]);});}; \ No newline at end of file +var _0xc4a1=['limit','map','include','model','then','stringify','error','message','ShowInterval','find','catch','all','reduce','info','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','debug','silly','resolve','lodash','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes'];(function(_0x36aede,_0x119c83){var _0x33a727=function(_0x46a392){while(--_0x46a392){_0x36aede['push'](_0x36aede['shift']());}};_0x33a727(++_0x119c83);}(_0xc4a1,0xec));var _0x1c4a=function(_0x412077,_0x18d499){_0x412077=_0x412077-0x0;var _0x52dd22=_0xc4a1[_0x412077];return _0x52dd22;};'use strict';var _=require(_0x1c4a('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x1c4a('0x1'))(_0x1c4a('0x2'));exports[_0x1c4a('0x3')]=function(_0x5e13a9){var _0x1d7979=this;return new Promise(function(_0x271631,_0x4ea100){return db[_0x1c4a('0x4')][_0x1c4a('0x5')]({'raw':_0x5e13a9[_0x1c4a('0x6')]?_0x5e13a9[_0x1c4a('0x6')][_0x1c4a('0x7')]===undefined?!![]:![]:!![],'where':_0x5e13a9[_0x1c4a('0x6')]?_0x5e13a9[_0x1c4a('0x6')][_0x1c4a('0x8')]||null:null,'attributes':_0x5e13a9[_0x1c4a('0x6')]?_0x5e13a9[_0x1c4a('0x6')][_0x1c4a('0x9')]||null:null,'limit':_0x5e13a9[_0x1c4a('0x6')]?_0x5e13a9[_0x1c4a('0x6')][_0x1c4a('0xa')]||null:null,'include':_0x5e13a9[_0x1c4a('0x6')]?_0x5e13a9[_0x1c4a('0x6')]['include']?_[_0x1c4a('0xb')](_0x5e13a9[_0x1c4a('0x6')][_0x1c4a('0xc')],function(_0x383cab){return{'model':db[_0x383cab[_0x1c4a('0xd')]],'as':_0x383cab['as'],'attributes':_0x383cab[_0x1c4a('0x9')],'include':_0x383cab[_0x1c4a('0xc')]?_['map'](_0x383cab[_0x1c4a('0xc')],function(_0xb56c4b){return{'model':db[_0xb56c4b['model']],'as':_0xb56c4b['as'],'attributes':_0xb56c4b[_0x1c4a('0x9')],'include':_0xb56c4b[_0x1c4a('0xc')]?_[_0x1c4a('0xb')](_0xb56c4b[_0x1c4a('0xc')],function(_0x217e25){return{'model':db[_0x217e25[_0x1c4a('0xd')]],'as':_0x217e25['as'],'attributes':_0x217e25[_0x1c4a('0x9')]};}):[]};}):[]};}):[]:[]})[_0x1c4a('0xe')](function(_0x43a2fe){logger['info'](_0x1c4a('0x3'),_0x5e13a9);logger['debug'](_0x1c4a('0x3'),_0x5e13a9,JSON[_0x1c4a('0xf')](_0x43a2fe));_0x271631(_0x43a2fe);})['catch'](function(_0x3d5dbd){logger[_0x1c4a('0x10')](_0x1c4a('0x3'),_0x3d5dbd[_0x1c4a('0x11')],_0x5e13a9);_0x4ea100(_0x1d7979[_0x1c4a('0x10')](0x1f4,_0x3d5dbd[_0x1c4a('0x11')]));});});};exports[_0x1c4a('0x12')]=function(_0x4d66f7){var _0x22a49b=this;return new Promise(function(_0x19399c,_0x1ad9bc){return db[_0x1c4a('0x4')][_0x1c4a('0x13')]({'raw':_0x4d66f7[_0x1c4a('0x6')]?_0x4d66f7[_0x1c4a('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x4d66f7[_0x1c4a('0x6')]?_0x4d66f7[_0x1c4a('0x6')][_0x1c4a('0x8')]||null:null,'attributes':_0x4d66f7['options']?_0x4d66f7[_0x1c4a('0x6')][_0x1c4a('0x9')]||null:null,'include':_0x4d66f7[_0x1c4a('0x6')]?_0x4d66f7['options'][_0x1c4a('0xc')]?_[_0x1c4a('0xb')](_0x4d66f7['options'][_0x1c4a('0xc')],function(_0x57c488){return{'model':db[_0x57c488[_0x1c4a('0xd')]],'as':_0x57c488['as'],'attributes':_0x57c488[_0x1c4a('0x9')],'include':_0x57c488['include']?_[_0x1c4a('0xb')](_0x57c488[_0x1c4a('0xc')],function(_0x39a43f){return{'model':db[_0x39a43f[_0x1c4a('0xd')]],'as':_0x39a43f['as'],'attributes':_0x39a43f[_0x1c4a('0x9')],'include':_0x39a43f[_0x1c4a('0xc')]?_[_0x1c4a('0xb')](_0x39a43f[_0x1c4a('0xc')],function(_0x557380){return{'model':db[_0x557380['model']],'as':_0x557380['as'],'attributes':_0x557380[_0x1c4a('0x9')]};}):[]};}):[]};}):[]:[]})[_0x1c4a('0xe')](function(_0x1dd466){logger['info']('ShowInterval',_0x4d66f7);logger['debug'](_0x1c4a('0x12'),_0x4d66f7,JSON['stringify'](_0x1dd466));_0x19399c(_0x1dd466);})[_0x1c4a('0x14')](function(_0x31c1df){logger['error'](_0x1c4a('0x12'),_0x31c1df[_0x1c4a('0x11')],_0x4d66f7);_0x1ad9bc(_0x22a49b[_0x1c4a('0x10')](0x1f4,_0x31c1df[_0x1c4a('0x11')]));});});};function checkArrayOfIntervals(_0x10c78e,_0x18124e){var _0x3401ca=[];return db[_0x1c4a('0x4')]['findAll']({'where':{'id':_0x10c78e}})['then'](function(_0x3cdb4f){_0x3401ca=_0x3cdb4f;return Promise[_0x1c4a('0x15')](_0x3401ca[_0x1c4a('0xb')](function(_0x17e88e){return _0x17e88e['ifTime'](_0x18124e);}));})[_0x1c4a('0xe')](function(_0x100c23){var _0x5ac53c=_0x100c23[_0x1c4a('0x16')](function(_0x704eff,_0x5a2c74){return _0x704eff||_0x5a2c74;},![]);logger[_0x1c4a('0x17')](util[_0x1c4a('0x18')](_0x1c4a('0x19'),_0x3401ca[_0x1c4a('0xb')](function(_0x3bc08e){return _0x3bc08e[_0x1c4a('0x1a')];})['join'](',\x20'),_0x3401ca[_0x1c4a('0xb')](function(_0x476e48){return _0x476e48['id'];})['join'](',\x20')));return _0x5ac53c;});}function checkSingleInterval(_0x5280d4,_0x194108){return db['Interval'][_0x1c4a('0x1b')](_0x5280d4)[_0x1c4a('0xe')](function(_0x416680){if(_0x416680){logger['info'](util[_0x1c4a('0x18')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x416680[_0x1c4a('0x1a')],_0x416680['id']));return _0x416680[_0x1c4a('0x1c')](_0x194108);}});}exports[_0x1c4a('0x1d')]=function(_0x53e5bb){var _0x22ef53=_0x53e5bb[_0x1c4a('0x1e')];var _0x1c0fa3=Array[_0x1c4a('0x1f')](_0x53e5bb[_0x1c4a('0x20')])?_0x53e5bb[_0x1c4a('0x20')]:typeof _0x53e5bb['intervals']===_0x1c4a('0x21')?[_0x53e5bb[_0x1c4a('0x20')]]:[];var _0x42f83f=_0x53e5bb[_0x1c4a('0x22')]||undefined;var _0x56eb0c=![];if(_0x1c0fa3[_0x1c4a('0x23')]){logger[_0x1c4a('0x17')](util['format'](_0x1c4a('0x24'),_0x1c0fa3[_0x1c4a('0x25')](';\x20')));}if(_0x42f83f){logger['info'](util[_0x1c4a('0x18')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x42f83f));}logger[_0x1c4a('0x26')]('Iftime',_0x56eb0c);logger[_0x1c4a('0x27')]('IntervalIftime',_0x53e5bb);return Promise[_0x1c4a('0x28')]()[_0x1c4a('0xe')](function(){if(Array['isArray'](_0x22ef53)){return checkArrayOfIntervals(_0x22ef53,_0x42f83f);}else if(_0x22ef53){return checkSingleInterval(_0x22ef53,_0x42f83f);}})[_0x1c4a('0xe')](function(_0x3d44ae){var _0x554b78=_0x1c0fa3['reduce'](function(_0x10f541,_0x16c63c){return _0x10f541||iftime(_0x16c63c,_0x42f83f);},![]);_0x56eb0c=_0x3d44ae||_0x554b78;return _0x56eb0c;})[_0x1c4a('0x14')](function(_0x196400){logger[_0x1c4a('0x10')]('IntervalIftime',_0x53e5bb,_0x196400);throw this[_0x1c4a('0x10')](0x1f4,_0x196400[_0x1c4a('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e471b4a..bbeb98c 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x1571d4,_0xc9bff0){var _0x24eb7e=function(_0x13d6a0){while(--_0x13d6a0){_0x1571d4['push'](_0x1571d4['shift']());}};_0x24eb7e(++_0xc9bff0);}(_0xadb5,0xad));var _0x5adb=function(_0x2e59a2,_0x1289e5){_0x2e59a2=_0x2e59a2-0x0;var _0x13c121=_0xadb5[_0x2e59a2];return _0x13c121;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x118986,_0x2ea044){var _0x25c9e6=function(_0x13b4d4){while(--_0x13b4d4){_0x118986['push'](_0x118986['shift']());}};_0x25c9e6(++_0x2ea044);}(_0x5f2f,0x73));var _0xf5f2=function(_0x173647,_0x12629f){_0x173647=_0x173647-0x0;var _0x226b62=_0x5f2f[_0x173647];return _0x226b62;};'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 01c0abb..7f35eb3 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 _0x41f1=['https','../../config/logger','api','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress'];(function(_0x270a39,_0x3f8ced){var _0x306788=function(_0x44a053){while(--_0x44a053){_0x270a39['push'](_0x270a39['shift']());}};_0x306788(++_0x3f8ced);}(_0x41f1,0x87));var _0x141f=function(_0x493fc9,_0x597cf9){_0x493fc9=_0x493fc9-0x0;var _0x3a90c3=_0x41f1[_0x493fc9];return _0x3a90c3;};'use strict';var BPromise=require('bluebird');var https=require(_0x141f('0x0'));var logger=require(_0x141f('0x1'))(_0x141f('0x2'));var USERNAME=_0x141f('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0xe2b61c,_0x457ced){var _0x94affd={'fields':{'project':{'key':_0xe2b61c[_0x141f('0x4')]||_0x141f('0x5')},'summary':(_0xe2b61c[_0x141f('0x6')]||_0x141f('0x7'))+_0x141f('0x8')+_0xe2b61c['ip'],'description':_0xe2b61c[_0x141f('0x9')]||JSON[_0x141f('0xa')](_0xe2b61c),'issuetype':{'name':_0xe2b61c[_0x141f('0xb')]||_0x141f('0xc')}}};_0x94affd[_0x141f('0xd')][_0x141f('0xe')]=_0xe2b61c[_0x141f('0xf')];_0x94affd[_0x141f('0xd')][_0x141f('0x10')]=_0xe2b61c[_0x141f('0x11')];_0x94affd[_0x141f('0xd')]['customfield_11502']=_0xe2b61c['newToken'];_0x94affd['fields'][_0x141f('0x12')]=_0xe2b61c[_0x141f('0x13')];_0x94affd[_0x141f('0xd')][_0x141f('0x14')]=_0xe2b61c[_0x141f('0x15')];_0x94affd['fields'][_0x141f('0x16')]=_0xe2b61c['ip'];var _0x5cb932={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x141f('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x141f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x141f('0x19')](_0x141f('0x1a'))}};var _0x2f96af=JSON[_0x141f('0xa')](_0x94affd);var _0xa9054e=https[_0x141f('0x1b')](_0x5cb932,function(_0x2a6273){_0x2a6273[_0x141f('0x1c')](_0x141f('0x1d'));var _0x3a48db='';_0x2a6273['on'](_0x141f('0x1e'),function(_0x422b10){_0x3a48db+=_0x422b10;});_0x2a6273['on'](_0x141f('0x1f'),function(){if(_0x457ced){return _0x457ced[_0x141f('0x20')](_0x2a6273[_0x141f('0x21')])[_0x141f('0x22')](JSON['parse'](_0x3a48db));}});});_0xa9054e['on'](_0x141f('0x23'),function(_0x2861b5){if(_0x457ced){return _0x457ced[_0x141f('0x20')](0x1f4)[_0x141f('0x22')]({'errors':[{'message':_0x141f('0x24'),'type':_0x141f('0x25')}]});}});_0xa9054e[_0x141f('0x26')](_0x2f96af);_0xa9054e[_0x141f('0x1f')]();}exports[_0x141f('0x27')]=openIssue;exports[_0x141f('0x28')]=function(_0x2df96b,_0x2a0dc2){_0x2df96b[_0x141f('0x29')]['ip']=_0x2df96b['headers'][_0x141f('0x2a')]||_0x2df96b[_0x141f('0x2b')][_0x141f('0x2c')]||_0x2df96b['socket'][_0x141f('0x2c')]||_0x2df96b[_0x141f('0x2b')]['socket'][_0x141f('0x2c')];return openIssue(_0x2df96b[_0x141f('0x29')],_0x2a0dc2);}; \ No newline at end of file +var _0x8b3c=['api.jira','send','body','headers','x-forwarded-for','remoteAddress','connection','bluebird','https','../../config/logger','api','support','key','Report','\x20from\x20','description','issuetype','Bug','email','fields','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x2c151d,_0x479ea1){var _0x49147a=function(_0x28a50b){while(--_0x28a50b){_0x2c151d['push'](_0x2c151d['shift']());}};_0x49147a(++_0x479ea1);}(_0x8b3c,0xca));var _0xc8b3=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x8b3c[_0x5c1cdc];return _0x2e8317;};'use strict';var BPromise=require(_0xc8b3('0x0'));var https=require(_0xc8b3('0x1'));var logger=require(_0xc8b3('0x2'))(_0xc8b3('0x3'));var USERNAME=_0xc8b3('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x253bea,_0x4b62e9){var _0x41f5d4={'fields':{'project':{'key':_0x253bea[_0xc8b3('0x5')]||'MOTGUI'},'summary':(_0x253bea['summary']||_0xc8b3('0x6'))+_0xc8b3('0x7')+_0x253bea['ip'],'description':_0x253bea[_0xc8b3('0x8')]||JSON['stringify'](_0x253bea),'issuetype':{'name':_0x253bea[_0xc8b3('0x9')]||_0xc8b3('0xa')}}};_0x41f5d4['fields']['customfield_11500']=_0x253bea[_0xc8b3('0xb')];_0x41f5d4[_0xc8b3('0xc')][_0xc8b3('0xd')]=_0x253bea['oldToken'];_0x41f5d4['fields'][_0xc8b3('0xe')]=_0x253bea['newToken'];_0x41f5d4[_0xc8b3('0xc')][_0xc8b3('0xf')]=_0x253bea[_0xc8b3('0x10')];_0x41f5d4[_0xc8b3('0xc')][_0xc8b3('0x11')]=_0x253bea['reason'];_0x41f5d4[_0xc8b3('0xc')]['customfield_10102']=_0x253bea['ip'];var _0xe6cbdd={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xc8b3('0x12')+new Buffer(USERNAME+':'+PASSWORD)[_0xc8b3('0x13')](_0xc8b3('0x14'))}};var _0x37a268=JSON[_0xc8b3('0x15')](_0x41f5d4);var _0x2a3b22=https[_0xc8b3('0x16')](_0xe6cbdd,function(_0x5d69aa){_0x5d69aa[_0xc8b3('0x17')](_0xc8b3('0x18'));var _0x211f10='';_0x5d69aa['on']('data',function(_0x38c716){_0x211f10+=_0x38c716;});_0x5d69aa['on'](_0xc8b3('0x19'),function(){if(_0x4b62e9){return _0x4b62e9[_0xc8b3('0x1a')](_0x5d69aa[_0xc8b3('0x1b')])[_0xc8b3('0x1c')](JSON[_0xc8b3('0x1d')](_0x211f10));}});});_0x2a3b22['on'](_0xc8b3('0x1e'),function(_0x5b4e03){if(_0x4b62e9){return _0x4b62e9[_0xc8b3('0x1a')](0x1f4)[_0xc8b3('0x1c')]({'errors':[{'message':_0xc8b3('0x1f'),'type':_0xc8b3('0x20')}]});}});_0x2a3b22['write'](_0x37a268);_0x2a3b22['end']();}exports['openIssue']=openIssue;exports[_0xc8b3('0x21')]=function(_0xa3881d,_0x3d528f){_0xa3881d[_0xc8b3('0x22')]['ip']=_0xa3881d[_0xc8b3('0x23')][_0xc8b3('0x24')]||_0xa3881d['connection'][_0xc8b3('0x25')]||_0xa3881d['socket'][_0xc8b3('0x25')]||_0xa3881d[_0xc8b3('0x26')]['socket'][_0xc8b3('0x25')];return openIssue(_0xa3881d[_0xc8b3('0x22')],_0x3d528f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 77b3880..fe20e39 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 _0xdace=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x2fc24b,_0xa5ebbb){var _0x19aff9=function(_0x455797){while(--_0x455797){_0x2fc24b['push'](_0x2fc24b['shift']());}};_0x19aff9(++_0xa5ebbb);}(_0xdace,0xc5));var _0xedac=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xdace[_0x152121];return _0x592a85;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')]('/:id',auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x13')]=router; \ No newline at end of file +var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x3ffa61,_0x1b7d10){var _0x38ecb4=function(_0x60204){while(--_0x60204){_0x3ffa61['push'](_0x3ffa61['shift']());}};_0x38ecb4(++_0x1b7d10);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x54e217,_0x243297){_0x54e217=_0x54e217-0x0;var _0x590ead=_0xf3cd[_0x54e217];return _0x590ead;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index bb70ca3..61cc8c2 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x29ce0c,_0x52a73a){_0x29ce0c=_0x29ce0c-0x0;var _0x25d534=_0x7a54[_0x29ce0c];return _0x25d534;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x2cd2fe,_0x8d4f85){_0x2cd2fe=_0x2cd2fe-0x0;var _0x5d47de=_0x7a54[_0x2cd2fe];return _0x5d47de;};'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 a97a621..fd7a67d 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 _0xf8b2=['sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','JscriptyAnswerReport','include','findAll','then','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x6fc37a,_0x44c1e0){var _0x50fba8=function(_0x444c94){while(--_0x444c94){_0x6fc37a['push'](_0x6fc37a['shift']());}};_0x50fba8(++_0x44c1e0);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x569aa0,_0x5e18b8){_0x569aa0=_0x569aa0-0x0;var _0x4f18f9=_0xf8b2[_0x569aa0];return _0x4f18f9;};'use strict';var emlformat=require(_0x2f8b('0x0'));var rimraf=require(_0x2f8b('0x1'));var zipdir=require(_0x2f8b('0x2'));var jsonpatch=require(_0x2f8b('0x3'));var rp=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var BPromise=require(_0x2f8b('0x6'));var Mustache=require(_0x2f8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f8b('0x8'));var csv=require(_0x2f8b('0x9'));var ejs=require(_0x2f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8b('0xb'));var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var licenseUtil=require(_0x2f8b('0x19'));var db=require(_0x2f8b('0x1a'))['db'];function respondWithStatusCode(_0x175111,_0x4cb1e0){_0x4cb1e0=_0x4cb1e0||0xcc;return function(_0x16d5a2){if(_0x16d5a2){return _0x175111['sendStatus'](_0x4cb1e0);}return _0x175111[_0x2f8b('0x1b')](_0x4cb1e0)[_0x2f8b('0x1c')]();};}function respondWithResult(_0x1b6a17,_0x15634){_0x15634=_0x15634||0xc8;return function(_0xf9cbe0){if(_0xf9cbe0){return _0x1b6a17[_0x2f8b('0x1b')](_0x15634)[_0x2f8b('0x1d')](_0xf9cbe0);}};}function respondWithFilteredResult(_0x2b6003,_0x532fe4){return function(_0x14a248){if(_0x14a248){var _0xdec711=typeof _0x532fe4[_0x2f8b('0x1e')]===_0x2f8b('0x1f')&&typeof _0x532fe4[_0x2f8b('0x20')]===_0x2f8b('0x1f');var _0x3d65ee=_0x14a248[_0x2f8b('0x21')];var _0x35ec40=_0xdec711?0x0:_0x532fe4['offset'];var _0x23dd63=_0xdec711?_0x14a248[_0x2f8b('0x21')]:_0x532fe4[_0x2f8b('0x1e')]+_0x532fe4['limit'];var _0xdc8171;if(_0x23dd63>=_0x3d65ee){_0x23dd63=_0x3d65ee;_0xdc8171=0xc8;}else{_0xdc8171=0xce;}_0x2b6003['status'](_0xdc8171);return _0x2b6003[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x35ec40+'-'+_0x23dd63+'/'+_0x3d65ee)[_0x2f8b('0x1d')](_0x14a248);}return null;};}function patchUpdates(_0x26d78f){return function(_0x3be6dc){try{jsonpatch['apply'](_0x3be6dc,_0x26d78f,!![]);}catch(_0x29c2f3){return BPromise[_0x2f8b('0x24')](_0x29c2f3);}return _0x3be6dc[_0x2f8b('0x25')]();};}function saveUpdates(_0x17b251,_0x3ad38b){return function(_0x1ffbae){if(_0x1ffbae){return _0x1ffbae[_0x2f8b('0x26')](_0x17b251)['then'](function(_0x273950){return _0x273950;});}return null;};}function removeEntity(_0x23f73c,_0x3560c4){return function(_0x41e12b){if(_0x41e12b){return _0x41e12b[_0x2f8b('0x27')]()['then'](function(){_0x23f73c[_0x2f8b('0x1b')](0xcc)[_0x2f8b('0x1c')]();});}};}function handleEntityNotFound(_0x152492,_0x46a95a){return function(_0x183e51){if(!_0x183e51){_0x152492[_0x2f8b('0x28')](0x194);}return _0x183e51;};}function handleError(_0x45e313,_0x347f5a){_0x347f5a=_0x347f5a||0x1f4;return function(_0x4145b3){logger['error'](_0x4145b3[_0x2f8b('0x29')]);if(_0x4145b3['name']){delete _0x4145b3[_0x2f8b('0x2a')];}_0x45e313[_0x2f8b('0x1b')](_0x347f5a)[_0x2f8b('0x2b')](_0x4145b3);};}exports[_0x2f8b('0x2c')]=function(_0x72b23b,_0x4adacd){var _0x2cfbea={},_0x5cc78c={},_0x5207a8={'count':0x0,'rows':[]};var _0x194e75=_[_0x2f8b('0x2d')](db['JscriptyAnswerReport'][_0x2f8b('0x2e')],function(_0x20d80c){return{'name':_0x20d80c[_0x2f8b('0x2f')],'type':_0x20d80c[_0x2f8b('0x30')][_0x2f8b('0x31')]};});_0x5cc78c[_0x2f8b('0x32')]=_['map'](_0x194e75,_0x2f8b('0x2a'));_0x5cc78c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0x72b23b[_0x2f8b('0x33')]);_0x5cc78c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x5cc78c[_0x2f8b('0x32')],_0x5cc78c['query']);_0x2cfbea[_0x2f8b('0x37')]=_['intersection'](_0x5cc78c[_0x2f8b('0x32')],qs[_0x2f8b('0x38')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x38')]));_0x2cfbea[_0x2f8b('0x37')]=_0x2cfbea[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x2cfbea[_0x2f8b('0x37')]:_0x5cc78c[_0x2f8b('0x32')];if(!_0x72b23b['query']['hasOwnProperty'](_0x2f8b('0x3a'))){_0x2cfbea[_0x2f8b('0x20')]=qs[_0x2f8b('0x20')](_0x72b23b[_0x2f8b('0x33')]['limit']);_0x2cfbea[_0x2f8b('0x1e')]=qs[_0x2f8b('0x1e')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x1e')]);}_0x2cfbea[_0x2f8b('0x3b')]=qs['sort'](_0x72b23b['query'][_0x2f8b('0x3c')]);_0x2cfbea[_0x2f8b('0x3d')]=qs[_0x2f8b('0x35')](_[_0x2f8b('0x3e')](_0x72b23b[_0x2f8b('0x33')],_0x5cc78c[_0x2f8b('0x35')]),_0x194e75);if(_0x72b23b[_0x2f8b('0x33')]['filter']){_0x2cfbea[_0x2f8b('0x3d')]=_[_0x2f8b('0x3f')](_0x2cfbea['where'],{'$or':_[_0x2f8b('0x2d')](_0x194e75,function(_0x4594b2){if(_0x4594b2[_0x2f8b('0x30')]!=='VIRTUAL'){var _0xa1d8de={};_0xa1d8de[_0x4594b2[_0x2f8b('0x2a')]]={'$like':'%'+_0x72b23b['query'][_0x2f8b('0x40')]+'%'};return _0xa1d8de;}})});}_0x2cfbea=_[_0x2f8b('0x3f')]({},_0x2cfbea,_0x72b23b['options']);var _0x92b37a={'where':_0x2cfbea['where']};return db[_0x2f8b('0x41')][_0x2f8b('0x21')](_0x92b37a)['then'](function(_0x9030da){_0x5207a8[_0x2f8b('0x21')]=_0x9030da;if(_0x72b23b[_0x2f8b('0x33')]['includeAll']){_0x2cfbea[_0x2f8b('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2f8b('0x43')](_0x2cfbea);})[_0x2f8b('0x44')](function(_0x1ff6e7){_0x5207a8[_0x2f8b('0x45')]=_0x1ff6e7;return _0x5207a8;})[_0x2f8b('0x44')](respondWithFilteredResult(_0x4adacd,_0x2cfbea))[_0x2f8b('0x46')](handleError(_0x4adacd,null));};exports[_0x2f8b('0x47')]=function(_0xa2fc94,_0x1c0b64){var _0x40577c={'raw':!![],'where':{'id':_0xa2fc94[_0x2f8b('0x48')]['id']}},_0x45c92c={};_0x45c92c[_0x2f8b('0x32')]=_[_0x2f8b('0x34')](db[_0x2f8b('0x41')][_0x2f8b('0x2e')]);_0x45c92c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0xa2fc94[_0x2f8b('0x33')]);_0x45c92c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x45c92c[_0x2f8b('0x32')],_0x45c92c[_0x2f8b('0x33')]);_0x40577c[_0x2f8b('0x37')]=_[_0x2f8b('0x36')](_0x45c92c['model'],qs['fields'](_0xa2fc94['query'][_0x2f8b('0x38')]));_0x40577c['attributes']=_0x40577c[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x40577c[_0x2f8b('0x37')]:_0x45c92c['model'];if(_0xa2fc94[_0x2f8b('0x33')]['includeAll']){_0x40577c[_0x2f8b('0x42')]=[{'all':!![]}];}_0x40577c=_['merge']({},_0x40577c,_0xa2fc94[_0x2f8b('0x49')]);return db[_0x2f8b('0x41')]['find'](_0x40577c)[_0x2f8b('0x44')](handleEntityNotFound(_0x1c0b64,null))[_0x2f8b('0x44')](respondWithResult(_0x1c0b64,null))[_0x2f8b('0x46')](handleError(_0x1c0b64,null));};exports[_0x2f8b('0x4a')]=function(_0x1e6ac2,_0x465d59){return db[_0x2f8b('0x41')][_0x2f8b('0x4a')](_0x1e6ac2[_0x2f8b('0x4b')],{})['then'](respondWithResult(_0x465d59,0xc9))[_0x2f8b('0x46')](handleError(_0x465d59,null));};exports[_0x2f8b('0x26')]=function(_0x2d79f9,_0x1bb257){if(_0x2d79f9[_0x2f8b('0x4b')]['id']){delete _0x2d79f9['body']['id'];}return db[_0x2f8b('0x41')][_0x2f8b('0x4c')]({'where':{'id':_0x2d79f9[_0x2f8b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bb257,null))[_0x2f8b('0x44')](saveUpdates(_0x2d79f9['body'],null))[_0x2f8b('0x44')](respondWithResult(_0x1bb257,null))[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x27')]=function(_0x3a25bb,_0x17b855){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3a25bb['params']['id']}})[_0x2f8b('0x44')](handleEntityNotFound(_0x17b855,null))[_0x2f8b('0x44')](removeEntity(_0x17b855,null))[_0x2f8b('0x46')](handleError(_0x17b855,null));};exports[_0x2f8b('0x4d')]=function(_0x49e047,_0x5ea07d){return db[_0x2f8b('0x41')][_0x2f8b('0x4d')]()[_0x2f8b('0x44')](respondWithResult(_0x5ea07d,null))[_0x2f8b('0x46')](handleError(_0x5ea07d,null));}; \ No newline at end of file +var _0x6c7b=['apply','reject','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','params','includeAll','include','find','catch','create','body','destroy','describe','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x39ab81,_0x458741){_0x39ab81=_0x39ab81-0x0;var _0x36fdbb=_0x6c7b[_0x39ab81];return _0x36fdbb;};'use strict';var emlformat=require(_0xb6c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c7('0x1'));var moment=require('moment');var BPromise=require(_0xb6c7('0x2'));var Mustache=require(_0xb6c7('0x3'));var util=require(_0xb6c7('0x4'));var path=require('path');var sox=require(_0xb6c7('0x5'));var csv=require(_0xb6c7('0x6'));var ejs=require(_0xb6c7('0x7'));var fs=require('fs');var fs_extra=require(_0xb6c7('0x8'));var _=require(_0xb6c7('0x9'));var squel=require('squel');var crypto=require(_0xb6c7('0xa'));var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x6'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6c7('0x11'));var logger=require(_0xb6c7('0x12'))(_0xb6c7('0x13'));var utils=require(_0xb6c7('0x14'));var config=require(_0xb6c7('0x15'));var licenseUtil=require(_0xb6c7('0x16'));var db=require(_0xb6c7('0x17'))['db'];function respondWithStatusCode(_0x50c2de,_0x9b32b7){_0x9b32b7=_0x9b32b7||0xcc;return function(_0xa858c5){if(_0xa858c5){return _0x50c2de[_0xb6c7('0x18')](_0x9b32b7);}return _0x50c2de[_0xb6c7('0x19')](_0x9b32b7)[_0xb6c7('0x1a')]();};}function respondWithResult(_0x383ac5,_0x147e4a){_0x147e4a=_0x147e4a||0xc8;return function(_0x561eb4){if(_0x561eb4){return _0x383ac5[_0xb6c7('0x19')](_0x147e4a)['json'](_0x561eb4);}};}function respondWithFilteredResult(_0x480d9a,_0x5d5428){return function(_0x19c145){if(_0x19c145){var _0x48b7ec=typeof _0x5d5428[_0xb6c7('0x1b')]===_0xb6c7('0x1c')&&typeof _0x5d5428[_0xb6c7('0x1d')]===_0xb6c7('0x1c');var _0x209659=_0x19c145[_0xb6c7('0x1e')];var _0x2c819d=_0x48b7ec?0x0:_0x5d5428[_0xb6c7('0x1b')];var _0x1a591f=_0x48b7ec?_0x19c145[_0xb6c7('0x1e')]:_0x5d5428[_0xb6c7('0x1b')]+_0x5d5428[_0xb6c7('0x1d')];var _0x3beafa;if(_0x1a591f>=_0x209659){_0x1a591f=_0x209659;_0x3beafa=0xc8;}else{_0x3beafa=0xce;}_0x480d9a['status'](_0x3beafa);return _0x480d9a[_0xb6c7('0x1f')](_0xb6c7('0x20'),_0x2c819d+'-'+_0x1a591f+'/'+_0x209659)['json'](_0x19c145);}return null;};}function patchUpdates(_0x25ca5d){return function(_0x5a1c0a){try{jsonpatch[_0xb6c7('0x21')](_0x5a1c0a,_0x25ca5d,!![]);}catch(_0x5b7ebf){return BPromise[_0xb6c7('0x22')](_0x5b7ebf);}return _0x5a1c0a['save']();};}function saveUpdates(_0x24c0b3,_0x146dd4){return function(_0x4a4788){if(_0x4a4788){return _0x4a4788[_0xb6c7('0x23')](_0x24c0b3)[_0xb6c7('0x24')](function(_0x2081a6){return _0x2081a6;});}return null;};}function removeEntity(_0x4232b6,_0xd33675){return function(_0x1ee45d){if(_0x1ee45d){return _0x1ee45d['destroy']()[_0xb6c7('0x24')](function(){_0x4232b6[_0xb6c7('0x19')](0xcc)[_0xb6c7('0x1a')]();});}};}function handleEntityNotFound(_0x418920,_0x5ed41e){return function(_0x1eb265){if(!_0x1eb265){_0x418920[_0xb6c7('0x18')](0x194);}return _0x1eb265;};}function handleError(_0x49909e,_0x1eee74){_0x1eee74=_0x1eee74||0x1f4;return function(_0x164801){logger[_0xb6c7('0x25')](_0x164801[_0xb6c7('0x26')]);if(_0x164801['name']){delete _0x164801[_0xb6c7('0x27')];}_0x49909e['status'](_0x1eee74)[_0xb6c7('0x28')](_0x164801);};}exports[_0xb6c7('0x29')]=function(_0x232f7f,_0x5f3be2){var _0x47acab={},_0x4f19da={},_0x438dc3={'count':0x0,'rows':[]};var _0xcd9464=_[_0xb6c7('0x2a')](db[_0xb6c7('0x2b')][_0xb6c7('0x2c')],function(_0x1b4180){return{'name':_0x1b4180[_0xb6c7('0x2d')],'type':_0x1b4180[_0xb6c7('0x2e')][_0xb6c7('0x2f')]};});_0x4f19da[_0xb6c7('0x30')]=_['map'](_0xcd9464,_0xb6c7('0x27'));_0x4f19da['query']=_[_0xb6c7('0x31')](_0x232f7f[_0xb6c7('0x32')]);_0x4f19da[_0xb6c7('0x33')]=_[_0xb6c7('0x34')](_0x4f19da[_0xb6c7('0x30')],_0x4f19da['query']);_0x47acab['attributes']=_['intersection'](_0x4f19da[_0xb6c7('0x30')],qs[_0xb6c7('0x35')](_0x232f7f['query'][_0xb6c7('0x35')]));_0x47acab[_0xb6c7('0x36')]=_0x47acab['attributes'][_0xb6c7('0x37')]?_0x47acab[_0xb6c7('0x36')]:_0x4f19da[_0xb6c7('0x30')];if(!_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x38')](_0xb6c7('0x39'))){_0x47acab['limit']=qs[_0xb6c7('0x1d')](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x1d')]);_0x47acab[_0xb6c7('0x1b')]=qs[_0xb6c7('0x1b')](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x1b')]);}_0x47acab['order']=qs['sort'](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x3a')]);_0x47acab[_0xb6c7('0x3b')]=qs[_0xb6c7('0x33')](_[_0xb6c7('0x3c')](_0x232f7f[_0xb6c7('0x32')],_0x4f19da[_0xb6c7('0x33')]),_0xcd9464);if(_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x3d')]){_0x47acab[_0xb6c7('0x3b')]=_['merge'](_0x47acab[_0xb6c7('0x3b')],{'$or':_['map'](_0xcd9464,function(_0x5836e9){if(_0x5836e9[_0xb6c7('0x2e')]!=='VIRTUAL'){var _0x3af5be={};_0x3af5be[_0x5836e9[_0xb6c7('0x27')]]={'$like':'%'+_0x232f7f['query'][_0xb6c7('0x3d')]+'%'};return _0x3af5be;}})});}_0x47acab=_[_0xb6c7('0x3e')]({},_0x47acab,_0x232f7f[_0xb6c7('0x3f')]);var _0x84861f={'where':_0x47acab[_0xb6c7('0x3b')]};return db['JscriptyAnswerReport']['count'](_0x84861f)[_0xb6c7('0x24')](function(_0xb575){_0x438dc3[_0xb6c7('0x1e')]=_0xb575;if(_0x232f7f[_0xb6c7('0x32')]['includeAll']){_0x47acab['include']=[{'all':!![]}];}return db[_0xb6c7('0x2b')][_0xb6c7('0x40')](_0x47acab);})[_0xb6c7('0x24')](function(_0x214d04){_0x438dc3[_0xb6c7('0x41')]=_0x214d04;return _0x438dc3;})['then'](respondWithFilteredResult(_0x5f3be2,_0x47acab))['catch'](handleError(_0x5f3be2,null));};exports['show']=function(_0x45369e,_0x80ee40){var _0x4462dc={'raw':!![],'where':{'id':_0x45369e[_0xb6c7('0x42')]['id']}},_0x5050c9={};_0x5050c9[_0xb6c7('0x30')]=_['keys'](db[_0xb6c7('0x2b')][_0xb6c7('0x2c')]);_0x5050c9[_0xb6c7('0x32')]=_[_0xb6c7('0x31')](_0x45369e[_0xb6c7('0x32')]);_0x5050c9['filters']=_[_0xb6c7('0x34')](_0x5050c9[_0xb6c7('0x30')],_0x5050c9[_0xb6c7('0x32')]);_0x4462dc['attributes']=_['intersection'](_0x5050c9[_0xb6c7('0x30')],qs[_0xb6c7('0x35')](_0x45369e[_0xb6c7('0x32')]['fields']));_0x4462dc['attributes']=_0x4462dc['attributes'][_0xb6c7('0x37')]?_0x4462dc[_0xb6c7('0x36')]:_0x5050c9[_0xb6c7('0x30')];if(_0x45369e[_0xb6c7('0x32')][_0xb6c7('0x43')]){_0x4462dc[_0xb6c7('0x44')]=[{'all':!![]}];}_0x4462dc=_[_0xb6c7('0x3e')]({},_0x4462dc,_0x45369e['options']);return db[_0xb6c7('0x2b')][_0xb6c7('0x45')](_0x4462dc)[_0xb6c7('0x24')](handleEntityNotFound(_0x80ee40,null))[_0xb6c7('0x24')](respondWithResult(_0x80ee40,null))[_0xb6c7('0x46')](handleError(_0x80ee40,null));};exports['create']=function(_0x33b9a2,_0x40bbff){return db[_0xb6c7('0x2b')][_0xb6c7('0x47')](_0x33b9a2[_0xb6c7('0x48')],{})[_0xb6c7('0x24')](respondWithResult(_0x40bbff,0xc9))['catch'](handleError(_0x40bbff,null));};exports[_0xb6c7('0x23')]=function(_0x141cd5,_0x2116cb){if(_0x141cd5[_0xb6c7('0x48')]['id']){delete _0x141cd5[_0xb6c7('0x48')]['id'];}return db[_0xb6c7('0x2b')][_0xb6c7('0x45')]({'where':{'id':_0x141cd5['params']['id']}})['then'](handleEntityNotFound(_0x2116cb,null))['then'](saveUpdates(_0x141cd5[_0xb6c7('0x48')],null))[_0xb6c7('0x24')](respondWithResult(_0x2116cb,null))[_0xb6c7('0x46')](handleError(_0x2116cb,null));};exports[_0xb6c7('0x49')]=function(_0x2278c0,_0x2002f8){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x2278c0[_0xb6c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x2002f8,null))[_0xb6c7('0x24')](removeEntity(_0x2002f8,null))[_0xb6c7('0x46')](handleError(_0x2002f8,null));};exports[_0xb6c7('0x4a')]=function(_0x210d50,_0x317a4b){return db['JscriptyAnswerReport'][_0xb6c7('0x4a')]()['then'](respondWithResult(_0x317a4b,null))[_0xb6c7('0x46')](handleError(_0x317a4b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0fc8a59..ef15bbd 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 _0x653b=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x302033,_0x20950c){var _0x5c00b4=function(_0x290c30){while(--_0x290c30){_0x302033['push'](_0x302033['shift']());}};_0x5c00b4(++_0x20950c);}(_0x653b,0xf4));var _0xb653=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x653b[_0x10dc60];return _0x47dec5;};'use strict';var _=require(_0xb653('0x0'));var util=require(_0xb653('0x1'));var logger=require(_0xb653('0x2'))(_0xb653('0x3'));var moment=require(_0xb653('0x4'));var BPromise=require('bluebird');var rp=require(_0xb653('0x5'));var fs=require('fs');var path=require(_0xb653('0x6'));var rimraf=require(_0xb653('0x7'));var config=require(_0xb653('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xb653('0x9')]=function(_0x1f64a1,_0x5e4459){return _0x1f64a1[_0xb653('0xa')](_0xb653('0xb'),attributes,{'tableName':_0xb653('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ed=['report_jscripty_answers','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x2403e7,_0x55d006){var _0x6cd7ee=function(_0x3c1024){while(--_0x3c1024){_0x2403e7['push'](_0x2403e7['shift']());}};_0x6cd7ee(++_0x55d006);}(_0xf2ed,0xe8));var _0xdf2e=function(_0x49693f,_0x4d994f){_0x49693f=_0x49693f-0x0;var _0x1b0f6e=_0xf2ed[_0x49693f];return _0x1b0f6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf2e('0x0'))(_0xdf2e('0x1'));var moment=require(_0xdf2e('0x2'));var BPromise=require(_0xdf2e('0x3'));var rp=require(_0xdf2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf2e('0x5'));var config=require(_0xdf2e('0x6'));var attributes=require(_0xdf2e('0x7'));module[_0xdf2e('0x8')]=function(_0x4e7fbc,_0x2847d6){return _0x4e7fbc['define'](_0xdf2e('0x9'),attributes,{'tableName':_0xdf2e('0xa'),'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 b244ae3..ff2d923 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 _0x25e1=['result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25e1,0x106));var _0x125e=function(_0x372c3e,_0x4ebb70){_0x372c3e=_0x372c3e-0x0;var _0x4b5b54=_0x25e1[_0x372c3e];return _0x4b5b54;};'use strict';var _=require('lodash');var util=require(_0x125e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x125e('0x1'));var db=require(_0x125e('0x2'))['db'];var utils=require(_0x125e('0x3'));var logger=require(_0x125e('0x4'))(_0x125e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x125e('0x6')][_0x125e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4017fe,_0x3383e4,_0x2b0d37){return new BPromise(function(_0x55375d,_0xb965aa){return client[_0x125e('0x8')](_0x4017fe,_0x2b0d37)['then'](function(_0xfe2cd){logger[_0x125e('0x9')](_0x125e('0xa'),_0x3383e4,_0x125e('0xb'));logger[_0x125e('0xc')](_0x125e('0xd'),_0x3383e4,_0x125e('0xb'),JSON[_0x125e('0xe')](_0xfe2cd));if(_0xfe2cd[_0x125e('0xf')]){if(_0xfe2cd[_0x125e('0xf')][_0x125e('0x10')]===0x1f4){logger[_0x125e('0xf')](_0x125e('0xa'),_0x3383e4,_0xfe2cd[_0x125e('0xf')][_0x125e('0x11')]);return _0xb965aa(_0xfe2cd[_0x125e('0xf')][_0x125e('0x11')]);}logger[_0x125e('0xf')](_0x125e('0xa'),_0x3383e4,_0xfe2cd['error'][_0x125e('0x11')]);return _0x55375d(_0xfe2cd[_0x125e('0xf')][_0x125e('0x11')]);}else{logger[_0x125e('0x9')](_0x125e('0xa'),_0x3383e4,_0x125e('0xb'));_0x55375d(_0xfe2cd[_0x125e('0x12')][_0x125e('0x11')]);}})[_0x125e('0x13')](function(_0x3e917d){logger[_0x125e('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3383e4,_0x3e917d);_0xb965aa(_0x3e917d);});});} \ No newline at end of file +var _0xbd37=['rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a0542,_0x227d40){var _0x31b313=function(_0x4fbd50){while(--_0x4fbd50){_0x2a0542['push'](_0x2a0542['shift']());}};_0x31b313(++_0x227d40);}(_0xbd37,0x13c));var _0x7bd3=function(_0xd88860,_0xe09771){_0xd88860=_0xd88860-0x0;var _0x4aac30=_0xbd37[_0xd88860];return _0x4aac30;};'use strict';var _=require(_0x7bd3('0x0'));var util=require(_0x7bd3('0x1'));var moment=require(_0x7bd3('0x2'));var BPromise=require(_0x7bd3('0x3'));var rs=require(_0x7bd3('0x4'));var fs=require('fs');var Redis=require(_0x7bd3('0x5'));var db=require(_0x7bd3('0x6'))['db'];var utils=require(_0x7bd3('0x7'));var logger=require(_0x7bd3('0x8'))(_0x7bd3('0x9'));var config=require(_0x7bd3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7bd3('0xb')][_0x7bd3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d257b,_0x2ead1a,_0x832dcf){return new BPromise(function(_0x5d3a93,_0xca8b49){return client[_0x7bd3('0xd')](_0x3d257b,_0x832dcf)[_0x7bd3('0xe')](function(_0xb68c80){logger[_0x7bd3('0xf')](_0x7bd3('0x10'),_0x2ead1a,'request\x20sent');logger[_0x7bd3('0x11')](_0x7bd3('0x12'),_0x2ead1a,_0x7bd3('0x13'),JSON[_0x7bd3('0x14')](_0xb68c80));if(_0xb68c80['error']){if(_0xb68c80[_0x7bd3('0x15')][_0x7bd3('0x16')]===0x1f4){logger[_0x7bd3('0x15')](_0x7bd3('0x10'),_0x2ead1a,_0xb68c80[_0x7bd3('0x15')]['message']);return _0xca8b49(_0xb68c80['error']['message']);}logger[_0x7bd3('0x15')](_0x7bd3('0x10'),_0x2ead1a,_0xb68c80[_0x7bd3('0x15')][_0x7bd3('0x17')]);return _0x5d3a93(_0xb68c80[_0x7bd3('0x15')][_0x7bd3('0x17')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2ead1a,_0x7bd3('0x13'));_0x5d3a93(_0xb68c80['result'][_0x7bd3('0x17')]);}})[_0x7bd3('0x18')](function(_0x51e61d){logger[_0x7bd3('0x15')](_0x7bd3('0x10'),_0x2ead1a,_0x51e61d);_0xca8b49(_0x51e61d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index cd81e63..36ad88b 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 _0x0cdb=['../../config/environment','./jscriptyProject.controller','index','/:id','isAuthenticated','show','get','/:id/sessions','getSessions','/:id/summary','30s','create','post','clone','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5b81a0,_0x1963a3){var _0x296231=function(_0x1fe245){while(--_0x1fe245){_0x5b81a0['push'](_0x5b81a0['shift']());}};_0x296231(++_0x1963a3);}(_0x0cdb,0x121));var _0xb0cd=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x0cdb[_0xe9c8e4];return _0x2037fa;};'use strict';var multer=require(_0xb0cd('0x0'));var util=require(_0xb0cd('0x1'));var path=require(_0xb0cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0cd('0x3'));var router=express[_0xb0cd('0x4')]();var fs_extra=require(_0xb0cd('0x5'));var auth=require(_0xb0cd('0x6'));var interaction=require(_0xb0cd('0x7'));var config=require(_0xb0cd('0x8'));var controller=require(_0xb0cd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0cd('0xa')]);router['get'](_0xb0cd('0xb'),auth[_0xb0cd('0xc')](),controller[_0xb0cd('0xd')]);router[_0xb0cd('0xe')](_0xb0cd('0xf'),auth[_0xb0cd('0xc')](),controller[_0xb0cd('0x10')]);router[_0xb0cd('0xe')]('/:id/answers',auth[_0xb0cd('0xc')](),controller['getAnswers']);router[_0xb0cd('0xe')](_0xb0cd('0x11'),auth[_0xb0cd('0xc')](),timeout(_0xb0cd('0x12')),controller['getSummary']);router['post']('/',auth[_0xb0cd('0xc')](),controller[_0xb0cd('0x13')]);router[_0xb0cd('0x14')]('/:id/clone',auth['isAuthenticated'](),controller[_0xb0cd('0x15')]);router[_0xb0cd('0x16')](_0xb0cd('0xb'),auth['isAuthenticated'](),controller[_0xb0cd('0x17')]);router[_0xb0cd('0x18')](_0xb0cd('0xb'),auth[_0xb0cd('0xc')](),controller[_0xb0cd('0x19')]);module[_0xb0cd('0x1a')]=router; \ No newline at end of file +var _0x2481=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete'];(function(_0x287c3a,_0x1b39e0){var _0x129cfd=function(_0x2b4d17){while(--_0x2b4d17){_0x287c3a['push'](_0x287c3a['shift']());}};_0x129cfd(++_0x1b39e0);}(_0x2481,0x187));var _0x1248=function(_0x249811,_0x162ca7){_0x249811=_0x249811-0x0;var _0x4eb652=_0x2481[_0x249811];return _0x4eb652;};'use strict';var multer=require(_0x1248('0x0'));var util=require(_0x1248('0x1'));var path=require('path');var timeout=require(_0x1248('0x2'));var express=require(_0x1248('0x3'));var router=express[_0x1248('0x4')]();var fs_extra=require(_0x1248('0x5'));var auth=require(_0x1248('0x6'));var interaction=require(_0x1248('0x7'));var config=require('../../config/environment');var controller=require(_0x1248('0x8'));router['get']('/',auth[_0x1248('0x9')](),controller[_0x1248('0xa')]);router[_0x1248('0xb')](_0x1248('0xc'),auth[_0x1248('0x9')](),controller['show']);router[_0x1248('0xb')]('/:id/sessions',auth[_0x1248('0x9')](),controller[_0x1248('0xd')]);router[_0x1248('0xb')](_0x1248('0xe'),auth[_0x1248('0x9')](),controller[_0x1248('0xf')]);router['get'](_0x1248('0x10'),auth[_0x1248('0x9')](),timeout(_0x1248('0x11')),controller[_0x1248('0x12')]);router[_0x1248('0x13')]('/',auth['isAuthenticated'](),controller[_0x1248('0x14')]);router[_0x1248('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0x1248('0x15')]);router[_0x1248('0x16')](_0x1248('0xc'),auth['isAuthenticated'](),controller[_0x1248('0x17')]);router[_0x1248('0x18')](_0x1248('0xc'),auth[_0x1248('0x9')](),controller[_0x1248('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 8f944da..2f8fc31 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 _0xdd6c=['setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','TEXT','long','isObjectLike'];(function(_0x42fe48,_0x446713){var _0x74f595=function(_0x4dcb07){while(--_0x4dcb07){_0x42fe48['push'](_0x42fe48['shift']());}};_0x74f595(++_0x446713);}(_0xdd6c,0x174));var _0xcdd6=function(_0x923027,_0x4f4f90){_0x923027=_0x923027-0x0;var _0x313339=_0xdd6c[_0x923027];return _0x313339;};'use strict';var Sequelize=require(_0xcdd6('0x0'));var _=require(_0xcdd6('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xcdd6('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xcdd6('0x2')]},'formData':{'type':Sequelize[_0xcdd6('0x3')](_0xcdd6('0x4')),'set':function(_0x9f12cd){if(_[_0xcdd6('0x5')](_0x9f12cd)){this[_0xcdd6('0x6')](_0xcdd6('0x7'),JSON[_0xcdd6('0x8')](_0x9f12cd));}else if(_['isString'](_0x9f12cd)){this[_0xcdd6('0x6')]('formData',_0x9f12cd);}else{this[_0xcdd6('0x6')](_0xcdd6('0x7'),util[_0xcdd6('0x9')](_0xcdd6('0xa'),this[_0xcdd6('0xb')]('name')||'',this[_0xcdd6('0xb')](_0xcdd6('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcdd6('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcdd6('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x74f9=['isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x74f9,0x1ea));var _0x974f=function(_0x3087e8,_0x3c8dbf){_0x3087e8=_0x3087e8-0x0;var _0x17440a=_0x74f9[_0x3087e8];return _0x17440a;};'use strict';var Sequelize=require(_0x974f('0x0'));var _=require(_0x974f('0x1'));var util=require(_0x974f('0x2'));module[_0x974f('0x3')]={'name':{'type':Sequelize[_0x974f('0x4')],'unique':_0x974f('0x5')},'description':{'type':Sequelize[_0x974f('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x2e96a9){if(_[_0x974f('0x6')](_0x2e96a9)){this[_0x974f('0x7')](_0x974f('0x8'),JSON[_0x974f('0x9')](_0x2e96a9));}else if(_[_0x974f('0xa')](_0x2e96a9)){this[_0x974f('0x7')]('formData',_0x2e96a9);}else{this[_0x974f('0x7')](_0x974f('0x8'),util[_0x974f('0xb')](_0x974f('0xc'),this[_0x974f('0xd')]('name')||'',this['getDataValue'](_0x974f('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x974f('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index adf483c..564df6c 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 _0xb982=['/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','options','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','createdAt','updatedAt','getSessions','JscriptySessionReport','length','ProjectId','findOne','findAll','number','fromCharCode','toString','indexOf','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now'];(function(_0x55db3e,_0x5efa08){var _0x43ff08=function(_0x538c8e){while(--_0x538c8e){_0x55db3e['push'](_0x55db3e['shift']());}};_0x43ff08(++_0x5efa08);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b98('0x0'));var jsonpatch=require(_0x2b98('0x1'));var rp=require(_0x2b98('0x2'));var moment=require(_0x2b98('0x3'));var BPromise=require(_0x2b98('0x4'));var Mustache=require(_0x2b98('0x5'));var util=require(_0x2b98('0x6'));var path=require(_0x2b98('0x7'));var sox=require(_0x2b98('0x8'));var csv=require(_0x2b98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b98('0xa'));var _=require(_0x2b98('0xb'));var squel=require(_0x2b98('0xc'));var crypto=require(_0x2b98('0xd'));var jsforce=require(_0x2b98('0xe'));var deskjs=require(_0x2b98('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2b98('0x10'));var Papa=require(_0x2b98('0x11'));var Redis=require('ioredis');var authService=require(_0x2b98('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b98('0x13'));var hardwareService=require(_0x2b98('0x14'));var logger=require(_0x2b98('0x15'))(_0x2b98('0x16'));var utils=require(_0x2b98('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b98('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145379,_0x2a2489){_0x2a2489=_0x2a2489||0xcc;return function(_0x675360){if(_0x675360){return _0x145379[_0x2b98('0x19')](_0x2a2489);}return _0x145379[_0x2b98('0x1a')](_0x2a2489)[_0x2b98('0x1b')]();};}function respondWithResult(_0x570e87,_0x29c259){_0x29c259=_0x29c259||0xc8;return function(_0x268fc3){if(_0x268fc3){return _0x570e87[_0x2b98('0x1a')](_0x29c259)[_0x2b98('0x1c')](_0x268fc3);}};}function respondWithFilteredResult(_0x2c6e3c,_0x196cc2){return function(_0x15e5c9){if(_0x15e5c9){var _0x4eab53=typeof _0x196cc2[_0x2b98('0x1d')]===_0x2b98('0x1e')&&typeof _0x196cc2['limit']===_0x2b98('0x1e');var _0x54d425=_0x15e5c9[_0x2b98('0x1f')];var _0x40426c=_0x4eab53?0x0:_0x196cc2[_0x2b98('0x1d')];var _0x50b886=_0x4eab53?_0x15e5c9['count']:_0x196cc2['offset']+_0x196cc2[_0x2b98('0x20')];var _0x3e380c;if(_0x50b886>=_0x54d425){_0x50b886=_0x54d425;_0x3e380c=0xc8;}else{_0x3e380c=0xce;}_0x2c6e3c['status'](_0x3e380c);return _0x2c6e3c['set'](_0x2b98('0x21'),_0x40426c+'-'+_0x50b886+'/'+_0x54d425)[_0x2b98('0x1c')](_0x15e5c9);}return null;};}function patchUpdates(_0x41c7de){return function(_0x5b75de){try{jsonpatch[_0x2b98('0x22')](_0x5b75de,_0x41c7de,!![]);}catch(_0xbff969){return BPromise[_0x2b98('0x23')](_0xbff969);}return _0x5b75de[_0x2b98('0x24')]();};}function saveUpdates(_0x3f5768,_0x349a8d){return function(_0x51db51){if(_0x51db51){return _0x51db51['update'](_0x3f5768)[_0x2b98('0x25')](function(_0x31225b){return _0x31225b;});}return null;};}function removeEntity(_0x373e34,_0x10e803){return function(_0x3bdfa3){if(_0x3bdfa3){return _0x3bdfa3[_0x2b98('0x26')]()[_0x2b98('0x25')](function(){var _0x4981ba=_0x3bdfa3[_0x2b98('0x27')]({'plain':!![]});var _0x1a1deb=_0x2b98('0x28');return db[_0x2b98('0x29')][_0x2b98('0x26')]({'where':{'type':_0x1a1deb,'resourceId':_0x4981ba['id']}})['then'](function(){return _0x3bdfa3;});})[_0x2b98('0x25')](function(){_0x373e34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27811d,_0x52a576){return function(_0x13cd9d){if(!_0x13cd9d){_0x27811d[_0x2b98('0x19')](0x194);}return _0x13cd9d;};}function handleError(_0x17b7db,_0x596c25){_0x596c25=_0x596c25||0x1f4;return function(_0x5467a4){logger[_0x2b98('0x2a')](_0x5467a4[_0x2b98('0x2b')]);if(_0x5467a4[_0x2b98('0x2c')]){delete _0x5467a4[_0x2b98('0x2c')];}_0x17b7db['status'](_0x596c25)['send'](_0x5467a4);};}exports[_0x2b98('0x2d')]=function(_0x4a40fc,_0x44b027){var _0x5e1941={},_0x53be37={},_0x3962ce={'count':0x0,'rows':[]};var _0x406df1=_[_0x2b98('0x2e')](db[_0x2b98('0x2f')]['rawAttributes'],function(_0x5ef881){return{'name':_0x5ef881[_0x2b98('0x30')],'type':_0x5ef881[_0x2b98('0x31')][_0x2b98('0x32')]};});_0x53be37[_0x2b98('0x33')]=_[_0x2b98('0x2e')](_0x406df1,_0x2b98('0x2c'));_0x53be37[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x4a40fc[_0x2b98('0x34')]);_0x53be37[_0x2b98('0x36')]=_['intersection'](_0x53be37[_0x2b98('0x33')],_0x53be37['query']);_0x5e1941[_0x2b98('0x37')]=_[_0x2b98('0x38')](_0x53be37[_0x2b98('0x33')],qs[_0x2b98('0x39')](_0x4a40fc[_0x2b98('0x34')][_0x2b98('0x39')]));_0x5e1941['attributes']=_0x5e1941[_0x2b98('0x37')]['length']?_0x5e1941[_0x2b98('0x37')]:_0x53be37[_0x2b98('0x33')];if(!_0x4a40fc[_0x2b98('0x34')][_0x2b98('0x3a')](_0x2b98('0x3b'))){_0x5e1941[_0x2b98('0x20')]=qs[_0x2b98('0x20')](_0x4a40fc[_0x2b98('0x34')]['limit']);_0x5e1941['offset']=qs[_0x2b98('0x1d')](_0x4a40fc[_0x2b98('0x34')][_0x2b98('0x1d')]);}_0x5e1941[_0x2b98('0x3c')]=qs[_0x2b98('0x3d')](_0x4a40fc[_0x2b98('0x34')]['sort']);_0x5e1941[_0x2b98('0x3e')]=qs[_0x2b98('0x36')](_[_0x2b98('0x3f')](_0x4a40fc[_0x2b98('0x34')],_0x53be37[_0x2b98('0x36')]),_0x406df1);if(_0x4a40fc['query'][_0x2b98('0x40')]){_0x5e1941[_0x2b98('0x3e')]=_[_0x2b98('0x41')](_0x5e1941['where'],{'$or':_[_0x2b98('0x2e')](_0x406df1,function(_0x362173){if(_0x362173[_0x2b98('0x31')]!==_0x2b98('0x42')){var _0x54e3d1={};_0x54e3d1[_0x362173[_0x2b98('0x2c')]]={'$like':'%'+_0x4a40fc['query'][_0x2b98('0x40')]+'%'};return _0x54e3d1;}})});}_0x5e1941=_[_0x2b98('0x41')]({},_0x5e1941,_0x4a40fc['options']);var _0x539971={'where':_0x5e1941[_0x2b98('0x3e')]};return db[_0x2b98('0x2f')][_0x2b98('0x1f')](_0x539971)[_0x2b98('0x25')](function(_0x140ba0){_0x3962ce[_0x2b98('0x1f')]=_0x140ba0;if(_0x4a40fc[_0x2b98('0x34')]['includeAll']){_0x5e1941[_0x2b98('0x43')]=[{'all':!![]}];}return db[_0x2b98('0x2f')]['findAll'](_0x5e1941);})['then'](function(_0xf68abc){_0x3962ce[_0x2b98('0x44')]=_0xf68abc;return _0x3962ce;})['then'](respondWithFilteredResult(_0x44b027,_0x5e1941))[_0x2b98('0x45')](handleError(_0x44b027,null));};exports[_0x2b98('0x46')]=function(_0x36e209,_0x3300b8){var _0x4e14a7={'raw':![],'where':{'id':_0x36e209[_0x2b98('0x47')]['id']}},_0x1c77da={};_0x1c77da[_0x2b98('0x33')]=_[_0x2b98('0x35')](db[_0x2b98('0x2f')][_0x2b98('0x48')]);_0x1c77da[_0x2b98('0x34')]=_['keys'](_0x36e209[_0x2b98('0x34')]);_0x1c77da[_0x2b98('0x36')]=_['intersection'](_0x1c77da[_0x2b98('0x33')],_0x1c77da[_0x2b98('0x34')]);_0x4e14a7['attributes']=_[_0x2b98('0x38')](_0x1c77da['model'],qs['fields'](_0x36e209[_0x2b98('0x34')][_0x2b98('0x39')]));_0x4e14a7[_0x2b98('0x37')]=_0x4e14a7[_0x2b98('0x37')]['length']?_0x4e14a7[_0x2b98('0x37')]:_0x1c77da['model'];if(_0x36e209[_0x2b98('0x34')][_0x2b98('0x49')]){_0x4e14a7[_0x2b98('0x43')]=[{'all':!![]}];}_0x4e14a7=_[_0x2b98('0x41')]({},_0x4e14a7,_0x36e209[_0x2b98('0x4a')]);return db[_0x2b98('0x2f')][_0x2b98('0x4b')](_0x4e14a7)[_0x2b98('0x25')](handleEntityNotFound(_0x3300b8,null))[_0x2b98('0x25')](respondWithResult(_0x3300b8,null))[_0x2b98('0x45')](handleError(_0x3300b8,null));};exports[_0x2b98('0x4c')]=function(_0x18d835,_0x6860c8){return db['JscriptyProject']['create'](_0x18d835[_0x2b98('0x4d')],{})[_0x2b98('0x25')](function(_0x729e42){var _0x4be284=_0x18d835[_0x2b98('0x4e')][_0x2b98('0x27')]({'plain':!![]});if(!_0x4be284)throw new Error(_0x2b98('0x4f'));if(_0x4be284[_0x2b98('0x50')]===_0x2b98('0x4e')){var _0x3524a3=_0x729e42['get']({'plain':!![]});var _0x4e9189=_0x2b98('0x28');return db[_0x2b98('0x51')][_0x2b98('0x4b')]({'where':{'name':_0x4e9189,'userProfileId':_0x4be284[_0x2b98('0x52')]},'raw':!![]})[_0x2b98('0x25')](function(_0x4fa6cd){if(_0x4fa6cd&&_0x4fa6cd[_0x2b98('0x53')]===0x0){return db[_0x2b98('0x29')][_0x2b98('0x4c')]({'name':_0x3524a3[_0x2b98('0x2c')],'resourceId':_0x3524a3['id'],'type':_0x4fa6cd[_0x2b98('0x2c')],'sectionId':_0x4fa6cd['id']},{})[_0x2b98('0x25')](function(){return _0x729e42;});}else{return _0x729e42;}})[_0x2b98('0x45')](function(_0x4a0fa7){logger['error'](_0x2b98('0x54'),_0x4a0fa7);throw _0x4a0fa7;});}return _0x729e42;})['then'](respondWithResult(_0x6860c8,0xc9))[_0x2b98('0x45')](handleError(_0x6860c8,null));};exports['clone']=function(_0x5ac826,_0x4f5a45){var _0x4b7df9={'where':{'id':_0x5ac826[_0x2b98('0x47')]['id']}},_0x2875b7={};_0x2875b7[_0x2b98('0x33')]=_['keys'](db['JscriptyProject'][_0x2b98('0x48')]);_0x4b7df9[_0x2b98('0x37')]=_[_0x2b98('0x38')](_0x2875b7[_0x2b98('0x33')],qs[_0x2b98('0x39')](_0x5ac826['query']['fields']));_0x4b7df9[_0x2b98('0x37')]=_0x4b7df9[_0x2b98('0x37')]['length']?_0x4b7df9[_0x2b98('0x37')]:_0x2875b7[_0x2b98('0x33')];if(_0x5ac826[_0x2b98('0x34')][_0x2b98('0x49')]){_0x4b7df9['include']=[{'all':!![]}];}_0x4b7df9=_[_0x2b98('0x41')]({},_0x4b7df9,_0x5ac826[_0x2b98('0x4a')]);return db[_0x2b98('0x2f')][_0x2b98('0x4b')](_0x4b7df9)[_0x2b98('0x25')](handleEntityNotFound(_0x4f5a45,null))['then'](function(_0x1e5b90){if(_0x1e5b90){var _0x1ede5f=_0x1e5b90[_0x2b98('0x27')]({'plain':!![]});_0x1ede5f=qs['omit'](_0x1ede5f,['id',_0x2b98('0x55'),_0x2b98('0x56')]);_0x5ac826['body']=_['omit'](_0x5ac826[_0x2b98('0x4d')],['id','createdAt',_0x2b98('0x56')]);return db[_0x2b98('0x2f')]['create'](_[_0x2b98('0x41')](_0x1ede5f,_0x5ac826[_0x2b98('0x4d')]),{'include':_0x5ac826[_0x2b98('0x34')][_0x2b98('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x4dee4f){var _0x4f884d=_0x5ac826[_0x2b98('0x4e')]['get']({'plain':!![]});if(!_0x4f884d)throw new Error(_0x2b98('0x4f'));if(_0x4f884d['role']===_0x2b98('0x4e')){var _0x2440c9=_0x4dee4f[_0x2b98('0x27')]({'plain':!![]});var _0x23fbdd=_0x2b98('0x28');return db[_0x2b98('0x51')]['find']({'where':{'name':_0x23fbdd,'userProfileId':_0x4f884d[_0x2b98('0x52')]},'raw':!![]})[_0x2b98('0x25')](function(_0x28fe2d){if(_0x28fe2d&&_0x28fe2d[_0x2b98('0x53')]===0x0){return db[_0x2b98('0x29')][_0x2b98('0x4c')]({'name':_0x2440c9['name'],'resourceId':_0x2440c9['id'],'type':_0x28fe2d[_0x2b98('0x2c')],'sectionId':_0x28fe2d['id']},{})[_0x2b98('0x25')](function(){return _0x4dee4f;});}else{return _0x4dee4f;}})[_0x2b98('0x45')](function(_0x57f840){logger[_0x2b98('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57f840);throw _0x57f840;});}return _0x4dee4f;});}})[_0x2b98('0x25')](respondWithResult(_0x4f5a45,0xc9))['catch'](handleError(_0x4f5a45,null));};exports['update']=function(_0x36624c,_0x3eb1dc){if(_0x36624c[_0x2b98('0x4d')]['id']){delete _0x36624c[_0x2b98('0x4d')]['id'];}return db[_0x2b98('0x2f')][_0x2b98('0x4b')]({'where':{'id':_0x36624c[_0x2b98('0x47')]['id']}})['then'](handleEntityNotFound(_0x3eb1dc,null))[_0x2b98('0x25')](saveUpdates(_0x36624c[_0x2b98('0x4d')],null))[_0x2b98('0x25')](respondWithResult(_0x3eb1dc,null))[_0x2b98('0x45')](handleError(_0x3eb1dc,null));};exports['destroy']=function(_0x52f7ce,_0x2221b0){return db[_0x2b98('0x2f')]['find']({'where':{'id':_0x52f7ce['params']['id']}})[_0x2b98('0x25')](handleEntityNotFound(_0x2221b0,null))[_0x2b98('0x25')](removeEntity(_0x2221b0,null))[_0x2b98('0x45')](handleError(_0x2221b0,null));};exports[_0x2b98('0x57')]=function(_0x1e072e,_0x3feea,_0x3ea623){var _0x1e04e9={'raw':!![],'where':{}};var _0x45a8ee={};var _0x501f8c={'count':0x0,'rows':[]};return db[_0x2b98('0x2f')]['findOne']({'where':{'id':_0x1e072e[_0x2b98('0x47')]['id']}})[_0x2b98('0x25')](handleEntityNotFound(_0x3feea,null))[_0x2b98('0x25')](function(_0x30f140){if(_0x30f140){_0x45a8ee['model']=_['keys'](db[_0x2b98('0x58')][_0x2b98('0x48')]);_0x45a8ee[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x1e072e[_0x2b98('0x34')]);_0x45a8ee['filters']=_[_0x2b98('0x38')](_0x45a8ee[_0x2b98('0x33')],_0x45a8ee[_0x2b98('0x34')]);_0x1e04e9['attributes']=_['intersection'](_0x45a8ee['model'],qs['fields'](_0x1e072e['query']['fields']));_0x1e04e9[_0x2b98('0x37')]=_0x1e04e9['attributes'][_0x2b98('0x59')]?_0x1e04e9[_0x2b98('0x37')]:_0x45a8ee[_0x2b98('0x33')];if(!_0x1e072e[_0x2b98('0x34')][_0x2b98('0x3a')](_0x2b98('0x3b'))){_0x1e04e9['limit']=qs['limit'](_0x1e072e[_0x2b98('0x34')][_0x2b98('0x20')]);_0x1e04e9[_0x2b98('0x1d')]=qs[_0x2b98('0x1d')](_0x1e072e[_0x2b98('0x34')][_0x2b98('0x1d')]);}_0x1e04e9[_0x2b98('0x3c')]=qs['sort'](_0x1e072e[_0x2b98('0x34')][_0x2b98('0x3d')]);_0x1e04e9[_0x2b98('0x3e')]=qs[_0x2b98('0x36')](_[_0x2b98('0x3f')](_0x1e072e[_0x2b98('0x34')],_0x45a8ee[_0x2b98('0x36')]));_0x1e04e9[_0x2b98('0x3e')][_0x2b98('0x5a')]=_0x30f140['id'];if(_0x1e072e[_0x2b98('0x34')][_0x2b98('0x40')]){_0x1e04e9['where']=_[_0x2b98('0x41')](_0x1e04e9[_0x2b98('0x3e')],{'$or':_[_0x2b98('0x2e')](_0x1e04e9[_0x2b98('0x37')],function(_0x1ad839){var _0x4bfb17={};_0x4bfb17[_0x1ad839]={'$like':'%'+_0x1e072e[_0x2b98('0x34')][_0x2b98('0x40')]+'%'};return _0x4bfb17;})});}_0x1e04e9=_[_0x2b98('0x41')]({},_0x1e04e9,_0x1e072e[_0x2b98('0x4a')]);return db[_0x2b98('0x58')][_0x2b98('0x1f')]({'where':_0x1e04e9[_0x2b98('0x3e')]})['then'](function(_0x1a33cf){_0x501f8c[_0x2b98('0x1f')]=_0x1a33cf;if(_0x1e072e[_0x2b98('0x34')]['includeAll']){_0x1e04e9[_0x2b98('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1e04e9);})['then'](function(_0x23a187){_0x501f8c[_0x2b98('0x44')]=_0x23a187;return _0x501f8c;});}})[_0x2b98('0x25')](respondWithFilteredResult(_0x3feea,_0x1e04e9))[_0x2b98('0x45')](handleError(_0x3feea,null));};exports['getAnswers']=function(_0x52eeeb,_0x3f1ab7,_0x3187be){var _0x3c873b={'raw':!![],'where':{}};var _0x2c834e={};var _0x1b7605={'count':0x0,'rows':[]};return db[_0x2b98('0x2f')][_0x2b98('0x5b')]({'where':{'id':_0x52eeeb[_0x2b98('0x47')]['id']}})[_0x2b98('0x25')](handleEntityNotFound(_0x3f1ab7,null))[_0x2b98('0x25')](function(_0x28675c){if(_0x28675c){_0x2c834e['model']=_['keys'](db['JscriptyAnswerReport'][_0x2b98('0x48')]);_0x2c834e['query']=_[_0x2b98('0x35')](_0x52eeeb[_0x2b98('0x34')]);_0x2c834e['filters']=_[_0x2b98('0x38')](_0x2c834e[_0x2b98('0x33')],_0x2c834e[_0x2b98('0x34')]);_0x3c873b[_0x2b98('0x37')]=_[_0x2b98('0x38')](_0x2c834e[_0x2b98('0x33')],qs[_0x2b98('0x39')](_0x52eeeb['query']['fields']));_0x3c873b[_0x2b98('0x37')]=_0x3c873b[_0x2b98('0x37')][_0x2b98('0x59')]?_0x3c873b[_0x2b98('0x37')]:_0x2c834e[_0x2b98('0x33')];if(!_0x52eeeb[_0x2b98('0x34')][_0x2b98('0x3a')](_0x2b98('0x3b'))){_0x3c873b['limit']=qs[_0x2b98('0x20')](_0x52eeeb[_0x2b98('0x34')]['limit']);_0x3c873b[_0x2b98('0x1d')]=qs[_0x2b98('0x1d')](_0x52eeeb[_0x2b98('0x34')][_0x2b98('0x1d')]);}_0x3c873b['order']=qs[_0x2b98('0x3d')](_0x52eeeb[_0x2b98('0x34')][_0x2b98('0x3d')]);_0x3c873b['where']=qs[_0x2b98('0x36')](_[_0x2b98('0x3f')](_0x52eeeb[_0x2b98('0x34')],_0x2c834e[_0x2b98('0x36')]));_0x3c873b[_0x2b98('0x3e')][_0x2b98('0x5a')]=_0x28675c['id'];if(_0x52eeeb[_0x2b98('0x34')][_0x2b98('0x40')]){_0x3c873b[_0x2b98('0x3e')]=_[_0x2b98('0x41')](_0x3c873b[_0x2b98('0x3e')],{'$or':_[_0x2b98('0x2e')](_0x3c873b[_0x2b98('0x37')],function(_0x48855f){var _0x9365d={};_0x9365d[_0x48855f]={'$like':'%'+_0x52eeeb[_0x2b98('0x34')][_0x2b98('0x40')]+'%'};return _0x9365d;})});}_0x3c873b=_[_0x2b98('0x41')]({},_0x3c873b,_0x52eeeb[_0x2b98('0x4a')]);return db['JscriptyAnswerReport'][_0x2b98('0x1f')]({'where':_0x3c873b['where']})['then'](function(_0x185866){_0x1b7605[_0x2b98('0x1f')]=_0x185866;if(_0x52eeeb[_0x2b98('0x34')]['includeAll']){_0x3c873b[_0x2b98('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2b98('0x5c')](_0x3c873b);})[_0x2b98('0x25')](function(_0x790cd8){_0x1b7605[_0x2b98('0x44')]=_0x790cd8;return _0x1b7605;});}})['then'](respondWithFilteredResult(_0x3f1ab7,_0x3c873b))[_0x2b98('0x45')](handleError(_0x3f1ab7,null));};function char(_0x47449e){return _0x2b98('0x5d')===typeof _0x47449e?String[_0x2b98('0x5e')][_0x2b98('0x22')](null,arguments):_0x47449e;}function needsEncapsulation(_0x3a2d15){return!!_0x3a2d15&&(_0x3a2d15[_0x2b98('0x5f')]()[_0x2b98('0x60')](char(0xd))>=0x0||_0x3a2d15[_0x2b98('0x5f')]()[_0x2b98('0x60')](char(0xa))>=0x0||_0x3a2d15[_0x2b98('0x5f')]()[_0x2b98('0x60')](char(0x2c))>=0x0||_0x3a2d15[_0x2b98('0x5f')]()[_0x2b98('0x60')](char(0x22))>=0x0);}function encapsulate(_0x33c00c){var _0x37d801=char(0x22),_0xf8c101='\x5c'+char(0x22),_0x39d146=_0x33c00c[_0x2b98('0x5f')]()['replace'](new RegExp(_0x37d801,'g'),_0xf8c101);return _0x37d801+_0x39d146+_0x37d801;}exports[_0x2b98('0x61')]=function(_0x3a4ad4,_0x392173,_0x4afa78){var _0x2979f4,_0x54688a;var _0x35387e={'where':{'ProjectId':_0x3a4ad4[_0x2b98('0x47')]['id']}};if(_0x3a4ad4[_0x2b98('0x34')][_0x2b98('0x62')]){_0x35387e[_0x2b98('0x3e')]['starttime']=JSON[_0x2b98('0x63')](_0x3a4ad4[_0x2b98('0x34')][_0x2b98('0x62')]);}return db[_0x2b98('0x58')]['findAll'](_0x35387e)[_0x2b98('0x25')](handleEntityNotFound(_0x392173,null))[_0x2b98('0x25')](function(_0xedc964){if(_0xedc964){_0x2979f4=_0xedc964;return db['JscriptyQuestionReport'][_0x2b98('0x5c')]({'where':{'SessionId':{'$in':_['map'](_0x2979f4,'id')},'ProjectId':_0x3a4ad4[_0x2b98('0x47')]['id']},'order':_0x2b98('0x64')});}})[_0x2b98('0x25')](handleEntityNotFound(_0x392173,null))[_0x2b98('0x25')](function(_0x3dc537){if(_0x3dc537){_0x54688a=_0x3dc537;var _0x4bf435={};for(var _0x2a386a=0x0,_0x2bf809=_0x54688a['length'];_0x2a386a<_0x2bf809;_0x2a386a++){if(!_0x4bf435['hasOwnProperty'](_0x54688a[_0x2a386a][_0x2b98('0x65')])){_0x4bf435[_0x54688a[_0x2a386a][_0x2b98('0x65')]]=needsEncapsulation(_0x54688a[_0x2a386a][_0x2b98('0x66')])?encapsulate(_0x54688a[_0x2a386a]['question']):_0x54688a[_0x2a386a][_0x2b98('0x66')];}}var _0x1115b7=[],_0x55afa1={};for(var _0x9d9e74=0x0,_0x4d61ad=_0x2979f4[_0x2b98('0x59')];_0x9d9e74<_0x4d61ad;_0x9d9e74++){_0x55afa1={'ProjectId':_0x3a4ad4['params']['id'],'SessionId':_0x2979f4[_0x9d9e74]['id'],'StartTime':moment(_0x2979f4[_0x9d9e74][_0x2b98('0x67')])[_0x2b98('0x68')](_0x2b98('0x69'))};for(var _0x39f0ac=0x0,_0x38e06f=_0x54688a['length'];_0x39f0ac<_0x38e06f;_0x39f0ac++){if(_0x54688a[_0x39f0ac][_0x2b98('0x6a')]==_0x2979f4[_0x9d9e74]['id']&&_0x4bf435[_0x2b98('0x3a')](_0x54688a[_0x39f0ac][_0x2b98('0x65')])){_0x55afa1[_0x4bf435[_0x54688a[_0x39f0ac][_0x2b98('0x65')]]]=_0x54688a[_0x39f0ac][_0x2b98('0x6b')];}}for(var _0x175773 in _0x4bf435){if(!_0x55afa1[_0x2b98('0x3a')](_0x4bf435[_0x175773])){_0x55afa1[_0x4bf435[_0x175773]]=null;}}_0x1115b7[_0x2b98('0x6c')](_0x55afa1);}return _0x1115b7;}})[_0x2b98('0x25')](function(_0x3bc4eb){if(!_['isEmpty'](_0x3bc4eb)){var _0x3ccbb9=toCsv(_0x3bc4eb);var _0xb0d7d3=Date[_0x2b98('0x6d')]();fs['writeFileSync'](util[_0x2b98('0x68')](_0x2b98('0x6e'),_0x3a4ad4[_0x2b98('0x47')]['id'],_0xb0d7d3),_0x3ccbb9);_0x392173['setHeader']('Content-disposition',_0x2b98('0x6f')+util[_0x2b98('0x68')](_0x2b98('0x70'),_0x3a4ad4[_0x2b98('0x47')]['id'],_0xb0d7d3));_0x392173['setHeader'](_0x2b98('0x71'),'text/csv');return _0x392173[_0x2b98('0x72')](util['format'](_0x2b98('0x6e'),_0x3a4ad4[_0x2b98('0x47')]['id'],_0xb0d7d3));}else{return _0x392173[_0x2b98('0x19')](0xcc);}})[_0x2b98('0x45')](handleError(_0x392173,null));}; \ No newline at end of file +var _0x48bc=['name','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','autoAssociation','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Projects','end','error','stack'];(function(_0x232084,_0x25c9a2){var _0x45a332=function(_0x18fe6f){while(--_0x18fe6f){_0x232084['push'](_0x232084['shift']());}};_0x45a332(++_0x25c9a2);}(_0x48bc,0x1b6));var _0xc48b=function(_0x9d1a55,_0x726434){_0x9d1a55=_0x9d1a55-0x0;var _0x43fe18=_0x48bc[_0x9d1a55];return _0x43fe18;};'use strict';var emlformat=require(_0xc48b('0x0'));var rimraf=require(_0xc48b('0x1'));var zipdir=require(_0xc48b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc48b('0x3'));var moment=require(_0xc48b('0x4'));var BPromise=require(_0xc48b('0x5'));var Mustache=require(_0xc48b('0x6'));var util=require(_0xc48b('0x7'));var path=require(_0xc48b('0x8'));var sox=require(_0xc48b('0x9'));var csv=require('to-csv');var ejs=require(_0xc48b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc48b('0xb'));var squel=require(_0xc48b('0xc'));var crypto=require('crypto');var jsforce=require(_0xc48b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc48b('0xe'));var querystring=require(_0xc48b('0xf'));var Papa=require('papaparse');var Redis=require(_0xc48b('0x10'));var authService=require(_0xc48b('0x11'));var qs=require(_0xc48b('0x12'));var as=require(_0xc48b('0x13'));var hardwareService=require(_0xc48b('0x14'));var logger=require(_0xc48b('0x15'))(_0xc48b('0x16'));var utils=require(_0xc48b('0x17'));var config=require(_0xc48b('0x18'));var licenseUtil=require(_0xc48b('0x19'));var db=require(_0xc48b('0x1a'))['db'];function respondWithStatusCode(_0x30ca23,_0x55afb2){_0x55afb2=_0x55afb2||0xcc;return function(_0x1f7855){if(_0x1f7855){return _0x30ca23[_0xc48b('0x1b')](_0x55afb2);}return _0x30ca23[_0xc48b('0x1c')](_0x55afb2)['end']();};}function respondWithResult(_0x4769ae,_0x33258b){_0x33258b=_0x33258b||0xc8;return function(_0x121778){if(_0x121778){return _0x4769ae[_0xc48b('0x1c')](_0x33258b)[_0xc48b('0x1d')](_0x121778);}};}function respondWithFilteredResult(_0x372dca,_0x2d148b){return function(_0x1ddcbb){if(_0x1ddcbb){var _0x55691c=typeof _0x2d148b[_0xc48b('0x1e')]==='undefined'&&typeof _0x2d148b['limit']===_0xc48b('0x1f');var _0x4ad2c0=_0x1ddcbb[_0xc48b('0x20')];var _0x54f94b=_0x55691c?0x0:_0x2d148b[_0xc48b('0x1e')];var _0x55d22a=_0x55691c?_0x1ddcbb[_0xc48b('0x20')]:_0x2d148b[_0xc48b('0x1e')]+_0x2d148b[_0xc48b('0x21')];var _0x52da11;if(_0x55d22a>=_0x4ad2c0){_0x55d22a=_0x4ad2c0;_0x52da11=0xc8;}else{_0x52da11=0xce;}_0x372dca['status'](_0x52da11);return _0x372dca[_0xc48b('0x22')]('Content-Range',_0x54f94b+'-'+_0x55d22a+'/'+_0x4ad2c0)[_0xc48b('0x1d')](_0x1ddcbb);}return null;};}function patchUpdates(_0x104a2f){return function(_0x34a480){try{jsonpatch[_0xc48b('0x23')](_0x34a480,_0x104a2f,!![]);}catch(_0x38799f){return BPromise[_0xc48b('0x24')](_0x38799f);}return _0x34a480[_0xc48b('0x25')]();};}function saveUpdates(_0x6627ba,_0x3743d3){return function(_0x5b00e0){if(_0x5b00e0){return _0x5b00e0[_0xc48b('0x26')](_0x6627ba)[_0xc48b('0x27')](function(_0x1acae5){return _0x1acae5;});}return null;};}function removeEntity(_0x14c789,_0x26b025){return function(_0x28dda3){if(_0x28dda3){return _0x28dda3[_0xc48b('0x28')]()[_0xc48b('0x27')](function(){var _0x215190=_0x28dda3[_0xc48b('0x29')]({'plain':!![]});var _0x464ed5=_0xc48b('0x2a');return db['UserProfileResource'][_0xc48b('0x28')]({'where':{'type':_0x464ed5,'resourceId':_0x215190['id']}})[_0xc48b('0x27')](function(){return _0x28dda3;});})[_0xc48b('0x27')](function(){_0x14c789[_0xc48b('0x1c')](0xcc)[_0xc48b('0x2b')]();});}};}function handleEntityNotFound(_0x2b53a3,_0x30e0a4){return function(_0x5659a3){if(!_0x5659a3){_0x2b53a3[_0xc48b('0x1b')](0x194);}return _0x5659a3;};}function handleError(_0x57fe66,_0x485441){_0x485441=_0x485441||0x1f4;return function(_0x49916e){logger[_0xc48b('0x2c')](_0x49916e[_0xc48b('0x2d')]);if(_0x49916e[_0xc48b('0x2e')]){delete _0x49916e[_0xc48b('0x2e')];}_0x57fe66[_0xc48b('0x1c')](_0x485441)['send'](_0x49916e);};}exports['index']=function(_0x3e1c5d,_0x23d7fe){var _0x596a17={},_0x31eaa0={},_0x2748b0={'count':0x0,'rows':[]};var _0xfdeaff=_[_0xc48b('0x2f')](db[_0xc48b('0x30')][_0xc48b('0x31')],function(_0x1acf39){return{'name':_0x1acf39[_0xc48b('0x32')],'type':_0x1acf39[_0xc48b('0x33')]['key']};});_0x31eaa0[_0xc48b('0x34')]=_[_0xc48b('0x2f')](_0xfdeaff,_0xc48b('0x2e'));_0x31eaa0[_0xc48b('0x35')]=_[_0xc48b('0x36')](_0x3e1c5d[_0xc48b('0x35')]);_0x31eaa0[_0xc48b('0x37')]=_[_0xc48b('0x38')](_0x31eaa0['model'],_0x31eaa0[_0xc48b('0x35')]);_0x596a17[_0xc48b('0x39')]=_[_0xc48b('0x38')](_0x31eaa0['model'],qs['fields'](_0x3e1c5d[_0xc48b('0x35')][_0xc48b('0x3a')]));_0x596a17[_0xc48b('0x39')]=_0x596a17[_0xc48b('0x39')]['length']?_0x596a17[_0xc48b('0x39')]:_0x31eaa0[_0xc48b('0x34')];if(!_0x3e1c5d[_0xc48b('0x35')][_0xc48b('0x3b')](_0xc48b('0x3c'))){_0x596a17['limit']=qs[_0xc48b('0x21')](_0x3e1c5d['query'][_0xc48b('0x21')]);_0x596a17[_0xc48b('0x1e')]=qs[_0xc48b('0x1e')](_0x3e1c5d['query'][_0xc48b('0x1e')]);}_0x596a17[_0xc48b('0x3d')]=qs[_0xc48b('0x3e')](_0x3e1c5d[_0xc48b('0x35')][_0xc48b('0x3e')]);_0x596a17[_0xc48b('0x3f')]=qs[_0xc48b('0x37')](_[_0xc48b('0x40')](_0x3e1c5d['query'],_0x31eaa0[_0xc48b('0x37')]),_0xfdeaff);if(_0x3e1c5d[_0xc48b('0x35')][_0xc48b('0x41')]){_0x596a17[_0xc48b('0x3f')]=_[_0xc48b('0x42')](_0x596a17[_0xc48b('0x3f')],{'$or':_['map'](_0xfdeaff,function(_0xd1bd84){if(_0xd1bd84[_0xc48b('0x33')]!==_0xc48b('0x43')){var _0xf6c2e7={};_0xf6c2e7[_0xd1bd84[_0xc48b('0x2e')]]={'$like':'%'+_0x3e1c5d['query'][_0xc48b('0x41')]+'%'};return _0xf6c2e7;}})});}_0x596a17=_[_0xc48b('0x42')]({},_0x596a17,_0x3e1c5d['options']);var _0x3b117c={'where':_0x596a17[_0xc48b('0x3f')]};return db['JscriptyProject'][_0xc48b('0x20')](_0x3b117c)[_0xc48b('0x27')](function(_0x3a4578){_0x2748b0[_0xc48b('0x20')]=_0x3a4578;if(_0x3e1c5d['query'][_0xc48b('0x44')]){_0x596a17[_0xc48b('0x45')]=[{'all':!![]}];}return db[_0xc48b('0x30')][_0xc48b('0x46')](_0x596a17);})[_0xc48b('0x27')](function(_0x149921){_0x2748b0[_0xc48b('0x47')]=_0x149921;return _0x2748b0;})[_0xc48b('0x27')](respondWithFilteredResult(_0x23d7fe,_0x596a17))[_0xc48b('0x48')](handleError(_0x23d7fe,null));};exports[_0xc48b('0x49')]=function(_0x5512eb,_0x3c73cf){var _0x494aba={'raw':![],'where':{'id':_0x5512eb[_0xc48b('0x4a')]['id']}},_0x318b00={};_0x318b00[_0xc48b('0x34')]=_[_0xc48b('0x36')](db[_0xc48b('0x30')]['rawAttributes']);_0x318b00[_0xc48b('0x35')]=_[_0xc48b('0x36')](_0x5512eb[_0xc48b('0x35')]);_0x318b00[_0xc48b('0x37')]=_[_0xc48b('0x38')](_0x318b00['model'],_0x318b00[_0xc48b('0x35')]);_0x494aba['attributes']=_[_0xc48b('0x38')](_0x318b00['model'],qs[_0xc48b('0x3a')](_0x5512eb[_0xc48b('0x35')][_0xc48b('0x3a')]));_0x494aba[_0xc48b('0x39')]=_0x494aba['attributes'][_0xc48b('0x4b')]?_0x494aba[_0xc48b('0x39')]:_0x318b00['model'];if(_0x5512eb['query'][_0xc48b('0x44')]){_0x494aba['include']=[{'all':!![]}];}_0x494aba=_[_0xc48b('0x42')]({},_0x494aba,_0x5512eb[_0xc48b('0x4c')]);return db['JscriptyProject']['find'](_0x494aba)[_0xc48b('0x27')](handleEntityNotFound(_0x3c73cf,null))[_0xc48b('0x27')](respondWithResult(_0x3c73cf,null))[_0xc48b('0x48')](handleError(_0x3c73cf,null));};exports[_0xc48b('0x4d')]=function(_0x1b78c6,_0x15e7c2){return db[_0xc48b('0x30')][_0xc48b('0x4d')](_0x1b78c6[_0xc48b('0x4e')],{})[_0xc48b('0x27')](function(_0x4477e3){var _0x356bec=_0x1b78c6[_0xc48b('0x4f')][_0xc48b('0x29')]({'plain':!![]});if(!_0x356bec)throw new Error(_0xc48b('0x50'));if(_0x356bec[_0xc48b('0x51')]===_0xc48b('0x4f')){var _0x3bafc1=_0x4477e3['get']({'plain':!![]});var _0x379308=_0xc48b('0x2a');return db[_0xc48b('0x52')]['find']({'where':{'name':_0x379308,'userProfileId':_0x356bec[_0xc48b('0x53')]},'raw':!![]})[_0xc48b('0x27')](function(_0x743c14){if(_0x743c14&&_0x743c14['autoAssociation']===0x0){return db[_0xc48b('0x54')][_0xc48b('0x4d')]({'name':_0x3bafc1[_0xc48b('0x2e')],'resourceId':_0x3bafc1['id'],'type':_0x743c14[_0xc48b('0x2e')],'sectionId':_0x743c14['id']},{})['then'](function(){return _0x4477e3;});}else{return _0x4477e3;}})[_0xc48b('0x48')](function(_0x131196){logger[_0xc48b('0x2c')](_0xc48b('0x55'),_0x131196);throw _0x131196;});}return _0x4477e3;})[_0xc48b('0x27')](respondWithResult(_0x15e7c2,0xc9))['catch'](handleError(_0x15e7c2,null));};exports[_0xc48b('0x56')]=function(_0x55ffbe,_0x2f8a2b){var _0xf24beb={'where':{'id':_0x55ffbe[_0xc48b('0x4a')]['id']}},_0x1227aa={};_0x1227aa[_0xc48b('0x34')]=_[_0xc48b('0x36')](db['JscriptyProject'][_0xc48b('0x31')]);_0xf24beb[_0xc48b('0x39')]=_['intersection'](_0x1227aa[_0xc48b('0x34')],qs[_0xc48b('0x3a')](_0x55ffbe[_0xc48b('0x35')][_0xc48b('0x3a')]));_0xf24beb['attributes']=_0xf24beb[_0xc48b('0x39')][_0xc48b('0x4b')]?_0xf24beb[_0xc48b('0x39')]:_0x1227aa['model'];if(_0x55ffbe[_0xc48b('0x35')]['includeAll']){_0xf24beb[_0xc48b('0x45')]=[{'all':!![]}];}_0xf24beb=_[_0xc48b('0x42')]({},_0xf24beb,_0x55ffbe[_0xc48b('0x4c')]);return db[_0xc48b('0x30')][_0xc48b('0x57')](_0xf24beb)[_0xc48b('0x27')](handleEntityNotFound(_0x2f8a2b,null))[_0xc48b('0x27')](function(_0x1049ab){if(_0x1049ab){var _0x5e5665=_0x1049ab[_0xc48b('0x29')]({'plain':!![]});_0x5e5665=qs[_0xc48b('0x58')](_0x5e5665,['id',_0xc48b('0x59'),'updatedAt']);_0x55ffbe['body']=_['omit'](_0x55ffbe[_0xc48b('0x4e')],['id',_0xc48b('0x59'),_0xc48b('0x5a')]);return db[_0xc48b('0x30')][_0xc48b('0x4d')](_[_0xc48b('0x42')](_0x5e5665,_0x55ffbe[_0xc48b('0x4e')]),{'include':_0x55ffbe[_0xc48b('0x35')][_0xc48b('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x1f6d5c){var _0x538945=_0x55ffbe[_0xc48b('0x4f')][_0xc48b('0x29')]({'plain':!![]});if(!_0x538945)throw new Error(_0xc48b('0x50'));if(_0x538945['role']===_0xc48b('0x4f')){var _0x1e1fd0=_0x1f6d5c[_0xc48b('0x29')]({'plain':!![]});var _0x39b88e=_0xc48b('0x2a');return db['UserProfileSection'][_0xc48b('0x57')]({'where':{'name':_0x39b88e,'userProfileId':_0x538945[_0xc48b('0x53')]},'raw':!![]})[_0xc48b('0x27')](function(_0x37d858){if(_0x37d858&&_0x37d858[_0xc48b('0x5b')]===0x0){return db[_0xc48b('0x54')][_0xc48b('0x4d')]({'name':_0x1e1fd0[_0xc48b('0x2e')],'resourceId':_0x1e1fd0['id'],'type':_0x37d858[_0xc48b('0x2e')],'sectionId':_0x37d858['id']},{})[_0xc48b('0x27')](function(){return _0x1f6d5c;});}else{return _0x1f6d5c;}})[_0xc48b('0x48')](function(_0x159f84){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x159f84);throw _0x159f84;});}return _0x1f6d5c;});}})['then'](respondWithResult(_0x2f8a2b,0xc9))[_0xc48b('0x48')](handleError(_0x2f8a2b,null));};exports[_0xc48b('0x26')]=function(_0x477195,_0x49544a){if(_0x477195['body']['id']){delete _0x477195['body']['id'];}return db[_0xc48b('0x30')]['find']({'where':{'id':_0x477195[_0xc48b('0x4a')]['id']}})[_0xc48b('0x27')](handleEntityNotFound(_0x49544a,null))[_0xc48b('0x27')](saveUpdates(_0x477195[_0xc48b('0x4e')],null))[_0xc48b('0x27')](respondWithResult(_0x49544a,null))['catch'](handleError(_0x49544a,null));};exports[_0xc48b('0x28')]=function(_0x2709a6,_0x2df9ed){return db['JscriptyProject']['find']({'where':{'id':_0x2709a6[_0xc48b('0x4a')]['id']}})[_0xc48b('0x27')](handleEntityNotFound(_0x2df9ed,null))[_0xc48b('0x27')](removeEntity(_0x2df9ed,null))[_0xc48b('0x48')](handleError(_0x2df9ed,null));};exports[_0xc48b('0x5c')]=function(_0x13cb3b,_0x58c0cb,_0x5a4ad6){var _0x580ac4={'raw':!![],'where':{}};var _0x10c339={};var _0x30dc79={'count':0x0,'rows':[]};return db[_0xc48b('0x30')][_0xc48b('0x5d')]({'where':{'id':_0x13cb3b[_0xc48b('0x4a')]['id']}})[_0xc48b('0x27')](handleEntityNotFound(_0x58c0cb,null))[_0xc48b('0x27')](function(_0x4f4b92){if(_0x4f4b92){_0x10c339['model']=_[_0xc48b('0x36')](db['JscriptySessionReport'][_0xc48b('0x31')]);_0x10c339[_0xc48b('0x35')]=_['keys'](_0x13cb3b[_0xc48b('0x35')]);_0x10c339[_0xc48b('0x37')]=_[_0xc48b('0x38')](_0x10c339['model'],_0x10c339[_0xc48b('0x35')]);_0x580ac4['attributes']=_[_0xc48b('0x38')](_0x10c339[_0xc48b('0x34')],qs[_0xc48b('0x3a')](_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x3a')]));_0x580ac4[_0xc48b('0x39')]=_0x580ac4['attributes'][_0xc48b('0x4b')]?_0x580ac4[_0xc48b('0x39')]:_0x10c339[_0xc48b('0x34')];if(!_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x3b')]('nolimit')){_0x580ac4[_0xc48b('0x21')]=qs[_0xc48b('0x21')](_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x21')]);_0x580ac4['offset']=qs[_0xc48b('0x1e')](_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x1e')]);}_0x580ac4[_0xc48b('0x3d')]=qs[_0xc48b('0x3e')](_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x3e')]);_0x580ac4['where']=qs[_0xc48b('0x37')](_[_0xc48b('0x40')](_0x13cb3b['query'],_0x10c339['filters']));_0x580ac4[_0xc48b('0x3f')][_0xc48b('0x5e')]=_0x4f4b92['id'];if(_0x13cb3b[_0xc48b('0x35')]['filter']){_0x580ac4[_0xc48b('0x3f')]=_[_0xc48b('0x42')](_0x580ac4[_0xc48b('0x3f')],{'$or':_[_0xc48b('0x2f')](_0x580ac4['attributes'],function(_0x34084f){var _0x442324={};_0x442324[_0x34084f]={'$like':'%'+_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x41')]+'%'};return _0x442324;})});}_0x580ac4=_['merge']({},_0x580ac4,_0x13cb3b[_0xc48b('0x4c')]);return db[_0xc48b('0x5f')][_0xc48b('0x20')]({'where':_0x580ac4['where']})[_0xc48b('0x27')](function(_0x81d7b){_0x30dc79[_0xc48b('0x20')]=_0x81d7b;if(_0x13cb3b[_0xc48b('0x35')][_0xc48b('0x44')]){_0x580ac4[_0xc48b('0x45')]=[{'all':!![]}];}return db[_0xc48b('0x5f')][_0xc48b('0x46')](_0x580ac4);})['then'](function(_0x3ce8d3){_0x30dc79[_0xc48b('0x47')]=_0x3ce8d3;return _0x30dc79;});}})[_0xc48b('0x27')](respondWithFilteredResult(_0x58c0cb,_0x580ac4))['catch'](handleError(_0x58c0cb,null));};exports[_0xc48b('0x60')]=function(_0x3b4a10,_0x5ad3ff,_0x464dd4){var _0x1c6747={'raw':!![],'where':{}};var _0xa79b4a={};var _0x53e057={'count':0x0,'rows':[]};return db[_0xc48b('0x30')]['findOne']({'where':{'id':_0x3b4a10[_0xc48b('0x4a')]['id']}})[_0xc48b('0x27')](handleEntityNotFound(_0x5ad3ff,null))[_0xc48b('0x27')](function(_0x411e21){if(_0x411e21){_0xa79b4a[_0xc48b('0x34')]=_[_0xc48b('0x36')](db[_0xc48b('0x61')][_0xc48b('0x31')]);_0xa79b4a[_0xc48b('0x35')]=_[_0xc48b('0x36')](_0x3b4a10[_0xc48b('0x35')]);_0xa79b4a[_0xc48b('0x37')]=_[_0xc48b('0x38')](_0xa79b4a[_0xc48b('0x34')],_0xa79b4a[_0xc48b('0x35')]);_0x1c6747[_0xc48b('0x39')]=_[_0xc48b('0x38')](_0xa79b4a[_0xc48b('0x34')],qs[_0xc48b('0x3a')](_0x3b4a10['query'][_0xc48b('0x3a')]));_0x1c6747[_0xc48b('0x39')]=_0x1c6747[_0xc48b('0x39')]['length']?_0x1c6747['attributes']:_0xa79b4a[_0xc48b('0x34')];if(!_0x3b4a10[_0xc48b('0x35')][_0xc48b('0x3b')](_0xc48b('0x3c'))){_0x1c6747[_0xc48b('0x21')]=qs['limit'](_0x3b4a10[_0xc48b('0x35')]['limit']);_0x1c6747[_0xc48b('0x1e')]=qs['offset'](_0x3b4a10[_0xc48b('0x35')]['offset']);}_0x1c6747[_0xc48b('0x3d')]=qs[_0xc48b('0x3e')](_0x3b4a10[_0xc48b('0x35')][_0xc48b('0x3e')]);_0x1c6747['where']=qs['filters'](_['pick'](_0x3b4a10['query'],_0xa79b4a['filters']));_0x1c6747['where'][_0xc48b('0x5e')]=_0x411e21['id'];if(_0x3b4a10[_0xc48b('0x35')][_0xc48b('0x41')]){_0x1c6747['where']=_[_0xc48b('0x42')](_0x1c6747[_0xc48b('0x3f')],{'$or':_[_0xc48b('0x2f')](_0x1c6747[_0xc48b('0x39')],function(_0x1fb77a){var _0xbbb508={};_0xbbb508[_0x1fb77a]={'$like':'%'+_0x3b4a10[_0xc48b('0x35')][_0xc48b('0x41')]+'%'};return _0xbbb508;})});}_0x1c6747=_['merge']({},_0x1c6747,_0x3b4a10[_0xc48b('0x4c')]);return db[_0xc48b('0x61')][_0xc48b('0x20')]({'where':_0x1c6747[_0xc48b('0x3f')]})[_0xc48b('0x27')](function(_0x37d8af){_0x53e057[_0xc48b('0x20')]=_0x37d8af;if(_0x3b4a10[_0xc48b('0x35')][_0xc48b('0x44')]){_0x1c6747[_0xc48b('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc48b('0x46')](_0x1c6747);})[_0xc48b('0x27')](function(_0x50b410){_0x53e057[_0xc48b('0x47')]=_0x50b410;return _0x53e057;});}})[_0xc48b('0x27')](respondWithFilteredResult(_0x5ad3ff,_0x1c6747))['catch'](handleError(_0x5ad3ff,null));};function char(_0x34d4d9){return _0xc48b('0x62')===typeof _0x34d4d9?String['fromCharCode'][_0xc48b('0x23')](null,arguments):_0x34d4d9;}function needsEncapsulation(_0x21f9e4){return!!_0x21f9e4&&(_0x21f9e4['toString']()['indexOf'](char(0xd))>=0x0||_0x21f9e4[_0xc48b('0x63')]()[_0xc48b('0x64')](char(0xa))>=0x0||_0x21f9e4['toString']()['indexOf'](char(0x2c))>=0x0||_0x21f9e4[_0xc48b('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0xaac21d){var _0x286ad1=char(0x22),_0x1634a4='\x5c'+char(0x22),_0x3d63f2=_0xaac21d[_0xc48b('0x63')]()[_0xc48b('0x65')](new RegExp(_0x286ad1,'g'),_0x1634a4);return _0x286ad1+_0x3d63f2+_0x286ad1;}exports['getSummary']=function(_0x45ba3b,_0x12377f,_0x3f6f9b){var _0x42e215,_0x34e97c;var _0x4fc722={'where':{'ProjectId':_0x45ba3b[_0xc48b('0x4a')]['id']}};if(_0x45ba3b['query'][_0xc48b('0x66')]){_0x4fc722['where'][_0xc48b('0x67')]=JSON['parse'](_0x45ba3b[_0xc48b('0x35')][_0xc48b('0x66')]);}return db[_0xc48b('0x5f')][_0xc48b('0x46')](_0x4fc722)[_0xc48b('0x27')](handleEntityNotFound(_0x12377f,null))[_0xc48b('0x27')](function(_0x13031a){if(_0x13031a){_0x42e215=_0x13031a;return db['JscriptyQuestionReport'][_0xc48b('0x46')]({'where':{'SessionId':{'$in':_[_0xc48b('0x2f')](_0x42e215,'id')},'ProjectId':_0x45ba3b[_0xc48b('0x4a')]['id']},'order':_0xc48b('0x68')});}})[_0xc48b('0x27')](handleEntityNotFound(_0x12377f,null))[_0xc48b('0x27')](function(_0x1f7e1c){if(_0x1f7e1c){_0x34e97c=_0x1f7e1c;var _0x3bdd89={};for(var _0x2e4225=0x0,_0x55ee0b=_0x34e97c[_0xc48b('0x4b')];_0x2e4225<_0x55ee0b;_0x2e4225++){if(!_0x3bdd89[_0xc48b('0x3b')](_0x34e97c[_0x2e4225][_0xc48b('0x69')])){_0x3bdd89[_0x34e97c[_0x2e4225][_0xc48b('0x69')]]=needsEncapsulation(_0x34e97c[_0x2e4225][_0xc48b('0x6a')])?encapsulate(_0x34e97c[_0x2e4225]['question']):_0x34e97c[_0x2e4225][_0xc48b('0x6a')];}}var _0x22c05a=[],_0x520b70={};for(var _0x13ebbc=0x0,_0x146fd5=_0x42e215[_0xc48b('0x4b')];_0x13ebbc<_0x146fd5;_0x13ebbc++){_0x520b70={'ProjectId':_0x45ba3b['params']['id'],'SessionId':_0x42e215[_0x13ebbc]['id'],'StartTime':moment(_0x42e215[_0x13ebbc][_0xc48b('0x67')])[_0xc48b('0x6b')](_0xc48b('0x6c'))};for(var _0xaa4cf9=0x0,_0x2fb7ae=_0x34e97c[_0xc48b('0x4b')];_0xaa4cf9<_0x2fb7ae;_0xaa4cf9++){if(_0x34e97c[_0xaa4cf9][_0xc48b('0x6d')]==_0x42e215[_0x13ebbc]['id']&&_0x3bdd89[_0xc48b('0x3b')](_0x34e97c[_0xaa4cf9]['questionId'])){_0x520b70[_0x3bdd89[_0x34e97c[_0xaa4cf9][_0xc48b('0x69')]]]=_0x34e97c[_0xaa4cf9][_0xc48b('0x6e')];}}for(var _0x4aac41 in _0x3bdd89){if(!_0x520b70[_0xc48b('0x3b')](_0x3bdd89[_0x4aac41])){_0x520b70[_0x3bdd89[_0x4aac41]]=null;}}_0x22c05a[_0xc48b('0x6f')](_0x520b70);}return _0x22c05a;}})[_0xc48b('0x27')](function(_0x4835d1){if(!_[_0xc48b('0x70')](_0x4835d1)){var _0x32bba3=toCsv(_0x4835d1);var _0x466b08=Date[_0xc48b('0x71')]();fs[_0xc48b('0x72')](util[_0xc48b('0x6b')](_0xc48b('0x73'),_0x45ba3b[_0xc48b('0x4a')]['id'],_0x466b08),_0x32bba3);_0x12377f[_0xc48b('0x74')]('Content-disposition',_0xc48b('0x75')+util[_0xc48b('0x6b')](_0xc48b('0x76'),_0x45ba3b[_0xc48b('0x4a')]['id'],_0x466b08));_0x12377f[_0xc48b('0x74')]('Content-type',_0xc48b('0x77'));return _0x12377f[_0xc48b('0x78')](util[_0xc48b('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x45ba3b[_0xc48b('0x4a')]['id'],_0x466b08));}else{return _0x12377f[_0xc48b('0x1b')](0xcc);}})['catch'](handleError(_0x12377f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 849b4ab..b376e24 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 _0x56e6=['exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x52deae,_0x2daa3e){var _0x312357=function(_0x3c7ff5){while(--_0x3c7ff5){_0x52deae['push'](_0x52deae['shift']());}};_0x312357(++_0x2daa3e);}(_0x56e6,0x6b));var _0x656e=function(_0x4cab1e,_0xfc5cde){_0x4cab1e=_0x4cab1e-0x0;var _0x1a8cd8=_0x56e6[_0x4cab1e];return _0x1a8cd8;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var logger=require(_0x656e('0x2'))(_0x656e('0x3'));var moment=require(_0x656e('0x4'));var BPromise=require(_0x656e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x656e('0x6'));var rimraf=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var attributes=require(_0x656e('0x9'));module[_0x656e('0xa')]=function(_0x3fef98,_0x81c232){return _0x3fef98['define'](_0x656e('0xb'),attributes,{'tableName':_0x656e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2a=['path','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b2a,0x127));var _0xa9b2=function(_0x1ded81,_0x45e9e8){_0x1ded81=_0x1ded81-0x0;var _0x1f82bd=_0x9b2a[_0x1ded81];return _0x1f82bd;};'use strict';var _=require(_0xa9b2('0x0'));var util=require('util');var logger=require(_0xa9b2('0x1'))(_0xa9b2('0x2'));var moment=require(_0xa9b2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9b2('0x4'));var fs=require('fs');var path=require(_0xa9b2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9b2('0x6'));module[_0xa9b2('0x7')]=function(_0x181a8f,_0xd7801e){return _0x181a8f['define'](_0xa9b2('0x8'),attributes,{'tableName':_0xa9b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index de2922d..25d8174 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x54f9f7,_0x2c5cf8){var _0x217da7=function(_0x139fcf){while(--_0x139fcf){_0x54f9f7['push'](_0x54f9f7['shift']());}};_0x217da7(++_0x2c5cf8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xcb91[_0x5581ba];return _0x1e927f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5a69ab,_0x610049){var _0x27f2f7=function(_0x452a0c){while(--_0x452a0c){_0x5a69ab['push'](_0x5a69ab['shift']());}};_0x27f2f7(++_0x610049);}(_0xf4eb,0xec));var _0xbf4e=function(_0x40f6d0,_0x168d32){_0x40f6d0=_0x40f6d0-0x0;var _0x22f14e=_0xf4eb[_0x40f6d0];return _0x22f14e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7c1ed62..e8a5dbe 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 _0x7724=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x53262f,_0x4cf7de){var _0x310142=function(_0x195ce5){while(--_0x195ce5){_0x53262f['push'](_0x53262f['shift']());}};_0x310142(++_0x4cf7de);}(_0x7724,0x180));var _0x4772=function(_0x2ad921,_0x3ec1d1){_0x2ad921=_0x2ad921-0x0;var _0x419042=_0x7724[_0x2ad921];return _0x419042;};'use strict';var multer=require(_0x4772('0x0'));var util=require(_0x4772('0x1'));var path=require(_0x4772('0x2'));var timeout=require(_0x4772('0x3'));var express=require(_0x4772('0x4'));var router=express[_0x4772('0x5')]();var fs_extra=require(_0x4772('0x6'));var auth=require(_0x4772('0x7'));var interaction=require(_0x4772('0x8'));var config=require(_0x4772('0x9'));var controller=require(_0x4772('0xa'));router[_0x4772('0xb')]('/',auth[_0x4772('0xc')](),controller[_0x4772('0xd')]);router[_0x4772('0xb')](_0x4772('0xe'),auth[_0x4772('0xc')](),controller['describe']);router['get'](_0x4772('0xf'),auth[_0x4772('0xc')](),controller[_0x4772('0x10')]);router[_0x4772('0x11')]('/',auth['isAuthenticated'](),controller[_0x4772('0x12')]);router[_0x4772('0x13')]('/:id',auth[_0x4772('0xc')](),controller[_0x4772('0x14')]);router[_0x4772('0x15')](_0x4772('0xf'),auth[_0x4772('0xc')](),controller[_0x4772('0x16')]);module[_0x4772('0x17')]=router; \ No newline at end of file +var _0xdf1e=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xdf1e,0x1ab));var _0xedf1=function(_0x52be3d,_0x46ce00){_0x52be3d=_0x52be3d-0x0;var _0x35a227=_0xdf1e[_0x52be3d];return _0x35a227;};'use strict';var multer=require(_0xedf1('0x0'));var util=require('util');var path=require(_0xedf1('0x1'));var timeout=require(_0xedf1('0x2'));var express=require(_0xedf1('0x3'));var router=express[_0xedf1('0x4')]();var fs_extra=require(_0xedf1('0x5'));var auth=require(_0xedf1('0x6'));var interaction=require(_0xedf1('0x7'));var config=require(_0xedf1('0x8'));var controller=require(_0xedf1('0x9'));router[_0xedf1('0xa')]('/',auth[_0xedf1('0xb')](),controller[_0xedf1('0xc')]);router[_0xedf1('0xa')]('/describe',auth[_0xedf1('0xb')](),controller[_0xedf1('0xd')]);router[_0xedf1('0xa')](_0xedf1('0xe'),auth[_0xedf1('0xb')](),controller[_0xedf1('0xf')]);router['post']('/',auth[_0xedf1('0xb')](),controller[_0xedf1('0x10')]);router[_0xedf1('0x11')](_0xedf1('0xe'),auth[_0xedf1('0xb')](),controller[_0xedf1('0x12')]);router[_0xedf1('0x13')]('/:id',auth[_0xedf1('0xb')](),controller[_0xedf1('0x14')]);module[_0xedf1('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f07beeb..6f15eeb 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x2afa0c,_0x5687eb){_0x2afa0c=_0x2afa0c-0x0;var _0xc41711=_0x7a54[_0x2afa0c];return _0xc41711;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x42ae3d,_0x511e9a){_0x42ae3d=_0x42ae3d-0x0;var _0x2c658d=_0x7a54[_0x42ae3d];return _0x2c658d;};'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 8077de1..1f91d8d 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 _0x7d20=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','end','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','length','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x7d20,0x86));var _0x07d2=function(_0x1f54f2,_0x3afbc1){_0x1f54f2=_0x1f54f2-0x0;var _0x4f3a96=_0x7d20[_0x1f54f2];return _0x4f3a96;};'use strict';var emlformat=require(_0x07d2('0x0'));var rimraf=require(_0x07d2('0x1'));var zipdir=require(_0x07d2('0x2'));var jsonpatch=require(_0x07d2('0x3'));var rp=require(_0x07d2('0x4'));var moment=require(_0x07d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x07d2('0x6'));var util=require(_0x07d2('0x7'));var path=require('path');var sox=require(_0x07d2('0x8'));var csv=require(_0x07d2('0x9'));var ejs=require(_0x07d2('0xa'));var fs=require('fs');var fs_extra=require(_0x07d2('0xb'));var _=require(_0x07d2('0xc'));var squel=require(_0x07d2('0xd'));var crypto=require(_0x07d2('0xe'));var jsforce=require(_0x07d2('0xf'));var deskjs=require(_0x07d2('0x10'));var toCsv=require(_0x07d2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x07d2('0x11'));var authService=require(_0x07d2('0x12'));var qs=require(_0x07d2('0x13'));var as=require(_0x07d2('0x14'));var hardwareService=require(_0x07d2('0x15'));var logger=require('../../config/logger')(_0x07d2('0x16'));var utils=require(_0x07d2('0x17'));var config=require(_0x07d2('0x18'));var licenseUtil=require(_0x07d2('0x19'));var db=require(_0x07d2('0x1a'))['db'];function respondWithStatusCode(_0x155a2f,_0x3cc6f0){_0x3cc6f0=_0x3cc6f0||0xcc;return function(_0x37b53d){if(_0x37b53d){return _0x155a2f['sendStatus'](_0x3cc6f0);}return _0x155a2f['status'](_0x3cc6f0)['end']();};}function respondWithResult(_0x55883d,_0x20c151){_0x20c151=_0x20c151||0xc8;return function(_0x350f9c){if(_0x350f9c){return _0x55883d[_0x07d2('0x1b')](_0x20c151)[_0x07d2('0x1c')](_0x350f9c);}};}function respondWithFilteredResult(_0x48e420,_0x348951){return function(_0x23c7bf){if(_0x23c7bf){var _0x3d733c=typeof _0x348951['offset']===_0x07d2('0x1d')&&typeof _0x348951[_0x07d2('0x1e')]===_0x07d2('0x1d');var _0x438e56=_0x23c7bf['count'];var _0x48deee=_0x3d733c?0x0:_0x348951[_0x07d2('0x1f')];var _0x294537=_0x3d733c?_0x23c7bf['count']:_0x348951[_0x07d2('0x1f')]+_0x348951['limit'];var _0x3095c7;if(_0x294537>=_0x438e56){_0x294537=_0x438e56;_0x3095c7=0xc8;}else{_0x3095c7=0xce;}_0x48e420[_0x07d2('0x1b')](_0x3095c7);return _0x48e420[_0x07d2('0x20')](_0x07d2('0x21'),_0x48deee+'-'+_0x294537+'/'+_0x438e56)[_0x07d2('0x1c')](_0x23c7bf);}return null;};}function patchUpdates(_0x2653f6){return function(_0x5d0cf3){try{jsonpatch['apply'](_0x5d0cf3,_0x2653f6,!![]);}catch(_0x18922c){return BPromise[_0x07d2('0x22')](_0x18922c);}return _0x5d0cf3['save']();};}function saveUpdates(_0x46ef40,_0x33f768){return function(_0x582811){if(_0x582811){return _0x582811[_0x07d2('0x23')](_0x46ef40)[_0x07d2('0x24')](function(_0x454755){return _0x454755;});}return null;};}function removeEntity(_0x5b2ddc,_0x210f43){return function(_0x2ab9ae){if(_0x2ab9ae){return _0x2ab9ae['destroy']()[_0x07d2('0x24')](function(){_0x5b2ddc[_0x07d2('0x1b')](0xcc)[_0x07d2('0x25')]();});}};}function handleEntityNotFound(_0x592084,_0x26a5e9){return function(_0x260d74){if(!_0x260d74){_0x592084['sendStatus'](0x194);}return _0x260d74;};}function handleError(_0x38de21,_0x9ffa8a){_0x9ffa8a=_0x9ffa8a||0x1f4;return function(_0x4050ab){logger[_0x07d2('0x26')](_0x4050ab['stack']);if(_0x4050ab[_0x07d2('0x27')]){delete _0x4050ab[_0x07d2('0x27')];}_0x38de21[_0x07d2('0x1b')](_0x9ffa8a)['send'](_0x4050ab);};}exports[_0x07d2('0x28')]=function(_0x2228bb,_0x125b71){var _0x516d6d={},_0x1fe244={},_0x5967a7={'count':0x0,'rows':[]};var _0x111987=_[_0x07d2('0x29')](db[_0x07d2('0x2a')][_0x07d2('0x2b')],function(_0xa74a84){return{'name':_0xa74a84[_0x07d2('0x2c')],'type':_0xa74a84['type'][_0x07d2('0x2d')]};});_0x1fe244['model']=_[_0x07d2('0x29')](_0x111987,_0x07d2('0x27'));_0x1fe244['query']=_[_0x07d2('0x2e')](_0x2228bb[_0x07d2('0x2f')]);_0x1fe244[_0x07d2('0x30')]=_['intersection'](_0x1fe244[_0x07d2('0x31')],_0x1fe244[_0x07d2('0x2f')]);_0x516d6d[_0x07d2('0x32')]=_[_0x07d2('0x33')](_0x1fe244[_0x07d2('0x31')],qs[_0x07d2('0x34')](_0x2228bb[_0x07d2('0x2f')]['fields']));_0x516d6d[_0x07d2('0x32')]=_0x516d6d[_0x07d2('0x32')]['length']?_0x516d6d['attributes']:_0x1fe244[_0x07d2('0x31')];if(!_0x2228bb[_0x07d2('0x2f')][_0x07d2('0x35')](_0x07d2('0x36'))){_0x516d6d[_0x07d2('0x1e')]=qs['limit'](_0x2228bb[_0x07d2('0x2f')][_0x07d2('0x1e')]);_0x516d6d[_0x07d2('0x1f')]=qs[_0x07d2('0x1f')](_0x2228bb[_0x07d2('0x2f')][_0x07d2('0x1f')]);}_0x516d6d[_0x07d2('0x37')]=qs[_0x07d2('0x38')](_0x2228bb[_0x07d2('0x2f')][_0x07d2('0x38')]);_0x516d6d['where']=qs['filters'](_['pick'](_0x2228bb[_0x07d2('0x2f')],_0x1fe244[_0x07d2('0x30')]),_0x111987);if(_0x2228bb['query'][_0x07d2('0x39')]){_0x516d6d[_0x07d2('0x3a')]=_[_0x07d2('0x3b')](_0x516d6d[_0x07d2('0x3a')],{'$or':_[_0x07d2('0x29')](_0x111987,function(_0x5eb08c){if(_0x5eb08c[_0x07d2('0x3c')]!==_0x07d2('0x3d')){var _0x194393={};_0x194393[_0x5eb08c[_0x07d2('0x27')]]={'$like':'%'+_0x2228bb[_0x07d2('0x2f')]['filter']+'%'};return _0x194393;}})});}_0x516d6d=_[_0x07d2('0x3b')]({},_0x516d6d,_0x2228bb[_0x07d2('0x3e')]);var _0x811f76={'where':_0x516d6d[_0x07d2('0x3a')]};return db[_0x07d2('0x2a')][_0x07d2('0x3f')](_0x811f76)[_0x07d2('0x24')](function(_0x15772e){_0x5967a7[_0x07d2('0x3f')]=_0x15772e;if(_0x2228bb[_0x07d2('0x2f')][_0x07d2('0x40')]){_0x516d6d[_0x07d2('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x07d2('0x42')](_0x516d6d);})[_0x07d2('0x24')](function(_0x2303d6){_0x5967a7['rows']=_0x2303d6;return _0x5967a7;})['then'](respondWithFilteredResult(_0x125b71,_0x516d6d))['catch'](handleError(_0x125b71,null));};exports[_0x07d2('0x43')]=function(_0x192a02,_0x28d76e){var _0x42ee4d={'raw':!![],'where':{'id':_0x192a02['params']['id']}},_0x230954={};_0x230954[_0x07d2('0x31')]=_[_0x07d2('0x2e')](db[_0x07d2('0x2a')][_0x07d2('0x2b')]);_0x230954[_0x07d2('0x2f')]=_['keys'](_0x192a02[_0x07d2('0x2f')]);_0x230954['filters']=_[_0x07d2('0x33')](_0x230954[_0x07d2('0x31')],_0x230954[_0x07d2('0x2f')]);_0x42ee4d[_0x07d2('0x32')]=_[_0x07d2('0x33')](_0x230954[_0x07d2('0x31')],qs[_0x07d2('0x34')](_0x192a02[_0x07d2('0x2f')][_0x07d2('0x34')]));_0x42ee4d['attributes']=_0x42ee4d['attributes'][_0x07d2('0x44')]?_0x42ee4d[_0x07d2('0x32')]:_0x230954[_0x07d2('0x31')];if(_0x192a02[_0x07d2('0x2f')][_0x07d2('0x40')]){_0x42ee4d['include']=[{'all':!![]}];}_0x42ee4d=_[_0x07d2('0x3b')]({},_0x42ee4d,_0x192a02['options']);return db[_0x07d2('0x2a')][_0x07d2('0x45')](_0x42ee4d)[_0x07d2('0x24')](handleEntityNotFound(_0x28d76e,null))['then'](respondWithResult(_0x28d76e,null))[_0x07d2('0x46')](handleError(_0x28d76e,null));};exports['create']=function(_0x33f5ba,_0x469ae8){return db[_0x07d2('0x2a')][_0x07d2('0x47')](_0x33f5ba['body'],{})[_0x07d2('0x24')](respondWithResult(_0x469ae8,0xc9))[_0x07d2('0x46')](handleError(_0x469ae8,null));};exports[_0x07d2('0x23')]=function(_0x38077e,_0x11218c){if(_0x38077e[_0x07d2('0x48')]['id']){delete _0x38077e[_0x07d2('0x48')]['id'];}return db[_0x07d2('0x2a')][_0x07d2('0x45')]({'where':{'id':_0x38077e[_0x07d2('0x49')]['id']}})[_0x07d2('0x24')](handleEntityNotFound(_0x11218c,null))[_0x07d2('0x24')](saveUpdates(_0x38077e['body'],null))[_0x07d2('0x24')](respondWithResult(_0x11218c,null))[_0x07d2('0x46')](handleError(_0x11218c,null));};exports[_0x07d2('0x4a')]=function(_0x38ae86,_0x2a6301){return db[_0x07d2('0x2a')]['find']({'where':{'id':_0x38ae86[_0x07d2('0x49')]['id']}})[_0x07d2('0x24')](handleEntityNotFound(_0x2a6301,null))['then'](removeEntity(_0x2a6301,null))['catch'](handleError(_0x2a6301,null));};exports['describe']=function(_0x4b5d51,_0x50eb79){return db[_0x07d2('0x2a')][_0x07d2('0x4b')]()[_0x07d2('0x24')](respondWithResult(_0x50eb79,null))[_0x07d2('0x46')](handleError(_0x50eb79,null));}; \ No newline at end of file +var _0xf4e1=['length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','filters','create','body','params','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','fieldName','key','model','map','intersection','query','attributes','fields'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0xf4e1,0xa8));var _0x1f4e=function(_0x186f92,_0x488507){_0x186f92=_0x186f92-0x0;var _0x2c400c=_0xf4e1[_0x186f92];return _0x2c400c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f4e('0x0'));var zipdir=require(_0x1f4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f4e('0x2'));var moment=require('moment');var BPromise=require(_0x1f4e('0x3'));var Mustache=require('mustache');var util=require(_0x1f4e('0x4'));var path=require(_0x1f4e('0x5'));var sox=require(_0x1f4e('0x6'));var csv=require(_0x1f4e('0x7'));var ejs=require(_0x1f4e('0x8'));var fs=require('fs');var fs_extra=require(_0x1f4e('0x9'));var _=require(_0x1f4e('0xa'));var squel=require(_0x1f4e('0xb'));var crypto=require(_0x1f4e('0xc'));var jsforce=require(_0x1f4e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1f4e('0x7'));var querystring=require(_0x1f4e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f4e('0xf'));var qs=require(_0x1f4e('0x10'));var as=require(_0x1f4e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1f4e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1f4e('0x13'));var db=require(_0x1f4e('0x14'))['db'];function respondWithStatusCode(_0x2bced1,_0x273584){_0x273584=_0x273584||0xcc;return function(_0x1d63d9){if(_0x1d63d9){return _0x2bced1[_0x1f4e('0x15')](_0x273584);}return _0x2bced1[_0x1f4e('0x16')](_0x273584)[_0x1f4e('0x17')]();};}function respondWithResult(_0x833a3f,_0x3cb002){_0x3cb002=_0x3cb002||0xc8;return function(_0x4b838a){if(_0x4b838a){return _0x833a3f[_0x1f4e('0x16')](_0x3cb002)[_0x1f4e('0x18')](_0x4b838a);}};}function respondWithFilteredResult(_0x37df37,_0x2575fa){return function(_0x10c6a4){if(_0x10c6a4){var _0x2c0ef2=typeof _0x2575fa[_0x1f4e('0x19')]==='undefined'&&typeof _0x2575fa[_0x1f4e('0x1a')]===_0x1f4e('0x1b');var _0x525ab9=_0x10c6a4[_0x1f4e('0x1c')];var _0x435cdd=_0x2c0ef2?0x0:_0x2575fa[_0x1f4e('0x19')];var _0x2394af=_0x2c0ef2?_0x10c6a4[_0x1f4e('0x1c')]:_0x2575fa[_0x1f4e('0x19')]+_0x2575fa[_0x1f4e('0x1a')];var _0x33cb13;if(_0x2394af>=_0x525ab9){_0x2394af=_0x525ab9;_0x33cb13=0xc8;}else{_0x33cb13=0xce;}_0x37df37[_0x1f4e('0x16')](_0x33cb13);return _0x37df37[_0x1f4e('0x1d')](_0x1f4e('0x1e'),_0x435cdd+'-'+_0x2394af+'/'+_0x525ab9)['json'](_0x10c6a4);}return null;};}function patchUpdates(_0x10bef3){return function(_0x26590b){try{jsonpatch[_0x1f4e('0x1f')](_0x26590b,_0x10bef3,!![]);}catch(_0x43f101){return BPromise[_0x1f4e('0x20')](_0x43f101);}return _0x26590b[_0x1f4e('0x21')]();};}function saveUpdates(_0x219808,_0x32745e){return function(_0x32846a){if(_0x32846a){return _0x32846a[_0x1f4e('0x22')](_0x219808)[_0x1f4e('0x23')](function(_0xe611b){return _0xe611b;});}return null;};}function removeEntity(_0x311337,_0x2a931d){return function(_0x4c1d18){if(_0x4c1d18){return _0x4c1d18[_0x1f4e('0x24')]()[_0x1f4e('0x23')](function(){_0x311337[_0x1f4e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430e7d,_0x3e24a3){return function(_0x2d97d4){if(!_0x2d97d4){_0x430e7d[_0x1f4e('0x15')](0x194);}return _0x2d97d4;};}function handleError(_0x1f35a3,_0x5e5773){_0x5e5773=_0x5e5773||0x1f4;return function(_0x4bb3f5){logger[_0x1f4e('0x25')](_0x4bb3f5[_0x1f4e('0x26')]);if(_0x4bb3f5[_0x1f4e('0x27')]){delete _0x4bb3f5['name'];}_0x1f35a3[_0x1f4e('0x16')](_0x5e5773)[_0x1f4e('0x28')](_0x4bb3f5);};}exports[_0x1f4e('0x29')]=function(_0x51cfc3,_0xaa588d){var _0x4c49cb={},_0x15254e={},_0x3e261f={'count':0x0,'rows':[]};var _0x4184bc=_['map'](db[_0x1f4e('0x2a')]['rawAttributes'],function(_0x1c68d9){return{'name':_0x1c68d9[_0x1f4e('0x2b')],'type':_0x1c68d9['type'][_0x1f4e('0x2c')]};});_0x15254e[_0x1f4e('0x2d')]=_[_0x1f4e('0x2e')](_0x4184bc,_0x1f4e('0x27'));_0x15254e['query']=_['keys'](_0x51cfc3['query']);_0x15254e['filters']=_[_0x1f4e('0x2f')](_0x15254e['model'],_0x15254e[_0x1f4e('0x30')]);_0x4c49cb[_0x1f4e('0x31')]=_[_0x1f4e('0x2f')](_0x15254e[_0x1f4e('0x2d')],qs['fields'](_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x32')]));_0x4c49cb[_0x1f4e('0x31')]=_0x4c49cb[_0x1f4e('0x31')][_0x1f4e('0x33')]?_0x4c49cb[_0x1f4e('0x31')]:_0x15254e[_0x1f4e('0x2d')];if(!_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x34')]('nolimit')){_0x4c49cb['limit']=qs[_0x1f4e('0x1a')](_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x1a')]);_0x4c49cb[_0x1f4e('0x19')]=qs[_0x1f4e('0x19')](_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x19')]);}_0x4c49cb[_0x1f4e('0x35')]=qs[_0x1f4e('0x36')](_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x36')]);_0x4c49cb[_0x1f4e('0x37')]=qs['filters'](_[_0x1f4e('0x38')](_0x51cfc3[_0x1f4e('0x30')],_0x15254e['filters']),_0x4184bc);if(_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x39')]){_0x4c49cb[_0x1f4e('0x37')]=_[_0x1f4e('0x3a')](_0x4c49cb[_0x1f4e('0x37')],{'$or':_[_0x1f4e('0x2e')](_0x4184bc,function(_0x46cedd){if(_0x46cedd[_0x1f4e('0x3b')]!==_0x1f4e('0x3c')){var _0x4d8b7d={};_0x4d8b7d[_0x46cedd['name']]={'$like':'%'+_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x39')]+'%'};return _0x4d8b7d;}})});}_0x4c49cb=_['merge']({},_0x4c49cb,_0x51cfc3['options']);var _0x516cc0={'where':_0x4c49cb['where']};return db['JscriptyQuestionReport']['count'](_0x516cc0)[_0x1f4e('0x23')](function(_0x23d3ce){_0x3e261f[_0x1f4e('0x1c')]=_0x23d3ce;if(_0x51cfc3[_0x1f4e('0x30')][_0x1f4e('0x3d')]){_0x4c49cb[_0x1f4e('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1f4e('0x3f')](_0x4c49cb);})[_0x1f4e('0x23')](function(_0x770eae){_0x3e261f[_0x1f4e('0x40')]=_0x770eae;return _0x3e261f;})[_0x1f4e('0x23')](respondWithFilteredResult(_0xaa588d,_0x4c49cb))[_0x1f4e('0x41')](handleError(_0xaa588d,null));};exports[_0x1f4e('0x42')]=function(_0x5864ca,_0x43e32b){var _0x2c64e7={'raw':!![],'where':{'id':_0x5864ca['params']['id']}},_0x271197={};_0x271197[_0x1f4e('0x2d')]=_[_0x1f4e('0x43')](db[_0x1f4e('0x2a')][_0x1f4e('0x44')]);_0x271197[_0x1f4e('0x30')]=_[_0x1f4e('0x43')](_0x5864ca['query']);_0x271197[_0x1f4e('0x45')]=_[_0x1f4e('0x2f')](_0x271197['model'],_0x271197[_0x1f4e('0x30')]);_0x2c64e7['attributes']=_['intersection'](_0x271197[_0x1f4e('0x2d')],qs[_0x1f4e('0x32')](_0x5864ca[_0x1f4e('0x30')][_0x1f4e('0x32')]));_0x2c64e7[_0x1f4e('0x31')]=_0x2c64e7[_0x1f4e('0x31')][_0x1f4e('0x33')]?_0x2c64e7[_0x1f4e('0x31')]:_0x271197[_0x1f4e('0x2d')];if(_0x5864ca[_0x1f4e('0x30')]['includeAll']){_0x2c64e7[_0x1f4e('0x3e')]=[{'all':!![]}];}_0x2c64e7=_[_0x1f4e('0x3a')]({},_0x2c64e7,_0x5864ca['options']);return db[_0x1f4e('0x2a')]['find'](_0x2c64e7)[_0x1f4e('0x23')](handleEntityNotFound(_0x43e32b,null))[_0x1f4e('0x23')](respondWithResult(_0x43e32b,null))[_0x1f4e('0x41')](handleError(_0x43e32b,null));};exports[_0x1f4e('0x46')]=function(_0x476843,_0xbffb52){return db['JscriptyQuestionReport'][_0x1f4e('0x46')](_0x476843[_0x1f4e('0x47')],{})[_0x1f4e('0x23')](respondWithResult(_0xbffb52,0xc9))[_0x1f4e('0x41')](handleError(_0xbffb52,null));};exports[_0x1f4e('0x22')]=function(_0x5a8a39,_0x453b7b){if(_0x5a8a39[_0x1f4e('0x47')]['id']){delete _0x5a8a39[_0x1f4e('0x47')]['id'];}return db[_0x1f4e('0x2a')]['find']({'where':{'id':_0x5a8a39[_0x1f4e('0x48')]['id']}})[_0x1f4e('0x23')](handleEntityNotFound(_0x453b7b,null))['then'](saveUpdates(_0x5a8a39[_0x1f4e('0x47')],null))[_0x1f4e('0x23')](respondWithResult(_0x453b7b,null))[_0x1f4e('0x41')](handleError(_0x453b7b,null));};exports[_0x1f4e('0x24')]=function(_0x1a995f,_0x36ff96){return db[_0x1f4e('0x2a')]['find']({'where':{'id':_0x1a995f[_0x1f4e('0x48')]['id']}})[_0x1f4e('0x23')](handleEntityNotFound(_0x36ff96,null))[_0x1f4e('0x23')](removeEntity(_0x36ff96,null))[_0x1f4e('0x41')](handleError(_0x36ff96,null));};exports['describe']=function(_0x202d6f,_0x2341b3){return db[_0x1f4e('0x2a')]['describe']()['then'](respondWithResult(_0x2341b3,null))['catch'](handleError(_0x2341b3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7cfc816..f26c359 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 _0x44be=['api','moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x2ad630,_0x182def){var _0x124a76=function(_0x2a1f3d){while(--_0x2a1f3d){_0x2ad630['push'](_0x2ad630['shift']());}};_0x124a76(++_0x182def);}(_0x44be,0xc3));var _0xe44b=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x44be[_0xa2c0a3];return _0x52c618;};'use strict';var _=require(_0xe44b('0x0'));var util=require(_0xe44b('0x1'));var logger=require(_0xe44b('0x2'))(_0xe44b('0x3'));var moment=require(_0xe44b('0x4'));var BPromise=require(_0xe44b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44b('0x6'));var rimraf=require('rimraf');var config=require(_0xe44b('0x7'));var attributes=require(_0xe44b('0x8'));module['exports']=function(_0x3be858,_0x546f36){return _0x3be858['define'](_0xe44b('0x9'),attributes,{'tableName':_0xe44b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73aa=['util','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash'];(function(_0xcf4260,_0xe48af6){var _0x5ad781=function(_0x4ab8c9){while(--_0x4ab8c9){_0xcf4260['push'](_0xcf4260['shift']());}};_0x5ad781(++_0xe48af6);}(_0x73aa,0x1cb));var _0xa73a=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x73aa[_0x215e65];return _0xa85842;};'use strict';var _=require(_0xa73a('0x0'));var util=require(_0xa73a('0x1'));var logger=require('../../config/logger')(_0xa73a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa73a('0x3'));var fs=require('fs');var path=require(_0xa73a('0x4'));var rimraf=require(_0xa73a('0x5'));var config=require(_0xa73a('0x6'));var attributes=require(_0xa73a('0x7'));module['exports']=function(_0x1d9324,_0x934774){return _0x1d9324[_0xa73a('0x8')](_0xa73a('0x9'),attributes,{'tableName':'report_jscripty_questions','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 21906e5..34c0eb1 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 _0xec14=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5e84dc,_0x54390e){var _0x9eef8d=function(_0x30ab7e){while(--_0x30ab7e){_0x5e84dc['push'](_0x5e84dc['shift']());}};_0x9eef8d(++_0x54390e);}(_0xec14,0x16e));var _0x4ec1=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xec14[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x4ec1('0x0'));var util=require(_0x4ec1('0x1'));var moment=require(_0x4ec1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ec1('0x3'))['db'];var utils=require(_0x4ec1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ec1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4ec1('0x6')][_0x4ec1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x494c50,_0x488738,_0x4b30d7){return new BPromise(function(_0x446118,_0x5e0529){return client[_0x4ec1('0x8')](_0x494c50,_0x4b30d7)[_0x4ec1('0x9')](function(_0x50ed9f){logger[_0x4ec1('0xa')](_0x4ec1('0xb'),_0x488738,_0x4ec1('0xc'));logger[_0x4ec1('0xd')](_0x4ec1('0xe'),_0x488738,_0x4ec1('0xc'),JSON[_0x4ec1('0xf')](_0x50ed9f));if(_0x50ed9f[_0x4ec1('0x10')]){if(_0x50ed9f[_0x4ec1('0x10')][_0x4ec1('0x11')]===0x1f4){logger[_0x4ec1('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x488738,_0x50ed9f[_0x4ec1('0x10')][_0x4ec1('0x12')]);return _0x5e0529(_0x50ed9f[_0x4ec1('0x10')]['message']);}logger[_0x4ec1('0x10')](_0x4ec1('0xb'),_0x488738,_0x50ed9f[_0x4ec1('0x10')][_0x4ec1('0x12')]);return _0x446118(_0x50ed9f['error']['message']);}else{logger['info'](_0x4ec1('0xb'),_0x488738,_0x4ec1('0xc'));_0x446118(_0x50ed9f['result']['message']);}})[_0x4ec1('0x13')](function(_0x351323){logger[_0x4ec1('0x10')](_0x4ec1('0xb'),_0x488738,_0x351323);_0x5e0529(_0x351323);});});} \ No newline at end of file +var _0x0d70=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1123de,_0x22cafe){var _0x23fef3=function(_0x2d958f){while(--_0x2d958f){_0x1123de['push'](_0x1123de['shift']());}};_0x23fef3(++_0x22cafe);}(_0x0d70,0x1b2));var _0x00d7=function(_0x35f5c9,_0x3267d6){_0x35f5c9=_0x35f5c9-0x0;var _0x463e96=_0x0d70[_0x35f5c9];return _0x463e96;};'use strict';var _=require(_0x00d7('0x0'));var util=require('util');var moment=require(_0x00d7('0x1'));var BPromise=require(_0x00d7('0x2'));var rs=require(_0x00d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00d7('0x4'))['db'];var utils=require(_0x00d7('0x5'));var logger=require(_0x00d7('0x6'))('rpc');var config=require(_0x00d7('0x7'));var jayson=require(_0x00d7('0x8'));var client=jayson[_0x00d7('0x9')][_0x00d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aecbc,_0x2ad0f7,_0x3a3243){return new BPromise(function(_0x5cd071,_0x173f6e){return client[_0x00d7('0xb')](_0x2aecbc,_0x3a3243)[_0x00d7('0xc')](function(_0xbe2efd){logger['info'](_0x00d7('0xd'),_0x2ad0f7,_0x00d7('0xe'));logger[_0x00d7('0xf')](_0x00d7('0x10'),_0x2ad0f7,'request\x20sent',JSON['stringify'](_0xbe2efd));if(_0xbe2efd[_0x00d7('0x11')]){if(_0xbe2efd[_0x00d7('0x11')][_0x00d7('0x12')]===0x1f4){logger[_0x00d7('0x11')](_0x00d7('0xd'),_0x2ad0f7,_0xbe2efd[_0x00d7('0x11')][_0x00d7('0x13')]);return _0x173f6e(_0xbe2efd[_0x00d7('0x11')][_0x00d7('0x13')]);}logger[_0x00d7('0x11')](_0x00d7('0xd'),_0x2ad0f7,_0xbe2efd['error'][_0x00d7('0x13')]);return _0x5cd071(_0xbe2efd[_0x00d7('0x11')]['message']);}else{logger[_0x00d7('0x14')](_0x00d7('0xd'),_0x2ad0f7,_0x00d7('0xe'));_0x5cd071(_0xbe2efd['result'][_0x00d7('0x13')]);}})[_0x00d7('0x15')](function(_0x325963){logger[_0x00d7('0x11')](_0x00d7('0xd'),_0x2ad0f7,_0x325963);_0x173f6e(_0x325963);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1da7d6e..92d0685 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 _0x51e8=['multer','path','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','show','/:id/questions','getQuestions','post','put','/:id','update','delete','destroy','exports'];(function(_0xcea864,_0x16fe4f){var _0x17939d=function(_0x425006){while(--_0x425006){_0xcea864['push'](_0xcea864['shift']());}};_0x17939d(++_0x16fe4f);}(_0x51e8,0x17a));var _0x851e=function(_0x3136d8,_0x44ae04){_0x3136d8=_0x3136d8-0x0;var _0x5cc6d2=_0x51e8[_0x3136d8];return _0x5cc6d2;};'use strict';var multer=require(_0x851e('0x0'));var util=require('util');var path=require(_0x851e('0x1'));var timeout=require('connect-timeout');var express=require(_0x851e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x851e('0x3'));var interaction=require(_0x851e('0x4'));var config=require('../../config/environment');var controller=require(_0x851e('0x5'));router[_0x851e('0x6')]('/',auth['isAuthenticated'](),controller[_0x851e('0x7')]);router[_0x851e('0x6')](_0x851e('0x8'),auth[_0x851e('0x9')](),controller[_0x851e('0xa')]);router['get']('/:id',auth[_0x851e('0x9')](),controller[_0x851e('0xb')]);router['get'](_0x851e('0xc'),auth[_0x851e('0x9')](),controller[_0x851e('0xd')]);router[_0x851e('0xe')]('/',auth[_0x851e('0x9')](),controller['create']);router[_0x851e('0xf')](_0x851e('0x10'),auth[_0x851e('0x9')](),controller[_0x851e('0x11')]);router[_0x851e('0x12')](_0x851e('0x10'),auth[_0x851e('0x9')](),controller[_0x851e('0x13')]);module[_0x851e('0x14')]=router; \ No newline at end of file +var _0x4aa1=['delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','create','update'];(function(_0x2e1581,_0x466b53){var _0xe6afee=function(_0x50e785){while(--_0x50e785){_0x2e1581['push'](_0x2e1581['shift']());}};_0xe6afee(++_0x466b53);}(_0x4aa1,0xda));var _0x14aa=function(_0x217772,_0x1ce29d){_0x217772=_0x217772-0x0;var _0xf15807=_0x4aa1[_0x217772];return _0xf15807;};'use strict';var multer=require('multer');var util=require(_0x14aa('0x0'));var path=require('path');var timeout=require(_0x14aa('0x1'));var express=require(_0x14aa('0x2'));var router=express[_0x14aa('0x3')]();var fs_extra=require(_0x14aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x14aa('0x5'));var config=require(_0x14aa('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x14aa('0x7')]('/',auth[_0x14aa('0x8')](),controller[_0x14aa('0x9')]);router[_0x14aa('0x7')](_0x14aa('0xa'),auth[_0x14aa('0x8')](),controller[_0x14aa('0xb')]);router['get'](_0x14aa('0xc'),auth[_0x14aa('0x8')](),controller['show']);router[_0x14aa('0x7')](_0x14aa('0xd'),auth[_0x14aa('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x14aa('0x8')](),controller[_0x14aa('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x14aa('0xf')]);router[_0x14aa('0x10')](_0x14aa('0xc'),auth[_0x14aa('0x8')](),controller['destroy']);module[_0x14aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 370810b..ed9286c 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 _0x75d9=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2e0f11,_0x601acc){var _0x18a49c=function(_0x1dc214){while(--_0x1dc214){_0x2e0f11['push'](_0x2e0f11['shift']());}};_0x18a49c(++_0x601acc);}(_0x75d9,0x162));var _0x975d=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0x75d9[_0x119629];return _0x49a771;};'use strict';var moment=require(_0x975d('0x0'));var Sequelize=require(_0x975d('0x1'));module[_0x975d('0x2')]={'starttime':{'type':Sequelize[_0x975d('0x3')],'set':function(_0xff3869){this[_0x975d('0x4')](_0x975d('0x5'),_0xff3869);this[_0x975d('0x4')](_0x975d('0x6'),moment()[_0x975d('0x7')](_0x975d('0x8')));}},'endtime':{'type':Sequelize[_0x975d('0x3')]},'membername':{'type':Sequelize[_0x975d('0x9')]},'projectname':{'type':Sequelize[_0x975d('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x975d('0x9')]},'calleridname':{'type':Sequelize[_0x975d('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x975d('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x4a9a=['endtime','DATE','STRING','BOOLEAN','sequelize','exports','setDataValue'];(function(_0x3c88c4,_0x18800f){var _0x4cc540=function(_0x480a1d){while(--_0x480a1d){_0x3c88c4['push'](_0x3c88c4['shift']());}};_0x4cc540(++_0x18800f);}(_0x4a9a,0x123));var _0xa4a9=function(_0x373958,_0x1c4f09){_0x373958=_0x373958-0x0;var _0xd72e8f=_0x4a9a[_0x373958];return _0xd72e8f;};'use strict';var moment=require('moment');var Sequelize=require(_0xa4a9('0x0'));module[_0xa4a9('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xa79956){this[_0xa4a9('0x2')]('starttime',_0xa79956);this[_0xa4a9('0x2')](_0xa4a9('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa4a9('0x4')]},'membername':{'type':Sequelize[_0xa4a9('0x5')]},'projectname':{'type':Sequelize[_0xa4a9('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa4a9('0x5')]},'completed':{'type':Sequelize[_0xa4a9('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8d3dd66..d4ed4ae 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 _0xaf69=['request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','describe','JscriptyQuestionReport','hasOwnProperty','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x607f5c,_0x5896bf){var _0x3d17b4=function(_0x147943){while(--_0x147943){_0x607f5c['push'](_0x607f5c['shift']());}};_0x3d17b4(++_0x5896bf);}(_0xaf69,0x13c));var _0x9af6=function(_0x58c7f0,_0x64c10f){_0x58c7f0=_0x58c7f0-0x0;var _0x557542=_0xaf69[_0x58c7f0];return _0x557542;};'use strict';var emlformat=require(_0x9af6('0x0'));var rimraf=require(_0x9af6('0x1'));var zipdir=require(_0x9af6('0x2'));var jsonpatch=require(_0x9af6('0x3'));var rp=require(_0x9af6('0x4'));var moment=require('moment');var BPromise=require(_0x9af6('0x5'));var Mustache=require(_0x9af6('0x6'));var util=require(_0x9af6('0x7'));var path=require('path');var sox=require(_0x9af6('0x8'));var csv=require('to-csv');var ejs=require(_0x9af6('0x9'));var fs=require('fs');var fs_extra=require(_0x9af6('0xa'));var _=require('lodash');var squel=require(_0x9af6('0xb'));var crypto=require(_0x9af6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9af6('0xd'));var toCsv=require(_0x9af6('0xe'));var querystring=require(_0x9af6('0xf'));var Papa=require(_0x9af6('0x10'));var Redis=require(_0x9af6('0x11'));var authService=require(_0x9af6('0x12'));var qs=require(_0x9af6('0x13'));var as=require(_0x9af6('0x14'));var hardwareService=require(_0x9af6('0x15'));var logger=require(_0x9af6('0x16'))(_0x9af6('0x17'));var utils=require(_0x9af6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9af6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2484eb,_0x5e178){_0x5e178=_0x5e178||0xcc;return function(_0x43f571){if(_0x43f571){return _0x2484eb[_0x9af6('0x1a')](_0x5e178);}return _0x2484eb['status'](_0x5e178)[_0x9af6('0x1b')]();};}function respondWithResult(_0x4cbd32,_0x49b2c3){_0x49b2c3=_0x49b2c3||0xc8;return function(_0x55d32b){if(_0x55d32b){return _0x4cbd32['status'](_0x49b2c3)[_0x9af6('0x1c')](_0x55d32b);}};}function respondWithFilteredResult(_0x514629,_0x3d6deb){return function(_0x450ba6){if(_0x450ba6){var _0x4a8875=typeof _0x3d6deb[_0x9af6('0x1d')]===_0x9af6('0x1e')&&typeof _0x3d6deb[_0x9af6('0x1f')]===_0x9af6('0x1e');var _0x256908=_0x450ba6[_0x9af6('0x20')];var _0x3c02f2=_0x4a8875?0x0:_0x3d6deb['offset'];var _0x4fcd4c=_0x4a8875?_0x450ba6[_0x9af6('0x20')]:_0x3d6deb[_0x9af6('0x1d')]+_0x3d6deb['limit'];var _0x3a8ea1;if(_0x4fcd4c>=_0x256908){_0x4fcd4c=_0x256908;_0x3a8ea1=0xc8;}else{_0x3a8ea1=0xce;}_0x514629[_0x9af6('0x21')](_0x3a8ea1);return _0x514629[_0x9af6('0x22')]('Content-Range',_0x3c02f2+'-'+_0x4fcd4c+'/'+_0x256908)[_0x9af6('0x1c')](_0x450ba6);}return null;};}function patchUpdates(_0x1e7601){return function(_0xfc9430){try{jsonpatch[_0x9af6('0x23')](_0xfc9430,_0x1e7601,!![]);}catch(_0x2cf978){return BPromise['reject'](_0x2cf978);}return _0xfc9430[_0x9af6('0x24')]();};}function saveUpdates(_0x505e44,_0x4c15fa){return function(_0x5064d8){if(_0x5064d8){return _0x5064d8[_0x9af6('0x25')](_0x505e44)['then'](function(_0x32b5d2){return _0x32b5d2;});}return null;};}function removeEntity(_0x3c0dc8,_0x570d40){return function(_0x4057c7){if(_0x4057c7){return _0x4057c7[_0x9af6('0x26')]()[_0x9af6('0x27')](function(){_0x3c0dc8[_0x9af6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121dee,_0x145b95){return function(_0x28d2d8){if(!_0x28d2d8){_0x121dee['sendStatus'](0x194);}return _0x28d2d8;};}function handleError(_0x5323ae,_0x307d77){_0x307d77=_0x307d77||0x1f4;return function(_0x446f26){logger[_0x9af6('0x28')](_0x446f26[_0x9af6('0x29')]);if(_0x446f26[_0x9af6('0x2a')]){delete _0x446f26['name'];}_0x5323ae[_0x9af6('0x21')](_0x307d77)[_0x9af6('0x2b')](_0x446f26);};}exports[_0x9af6('0x2c')]=function(_0x2d1377,_0x2fe26d){var _0x591640={},_0x5a024f={},_0x505162={'count':0x0,'rows':[]};var _0x1dbc90=_[_0x9af6('0x2d')](db[_0x9af6('0x2e')][_0x9af6('0x2f')],function(_0x175a04){return{'name':_0x175a04[_0x9af6('0x30')],'type':_0x175a04[_0x9af6('0x31')]['key']};});_0x5a024f['model']=_[_0x9af6('0x2d')](_0x1dbc90,_0x9af6('0x2a'));_0x5a024f[_0x9af6('0x32')]=_[_0x9af6('0x33')](_0x2d1377['query']);_0x5a024f[_0x9af6('0x34')]=_[_0x9af6('0x35')](_0x5a024f[_0x9af6('0x36')],_0x5a024f[_0x9af6('0x32')]);_0x591640['attributes']=_[_0x9af6('0x35')](_0x5a024f[_0x9af6('0x36')],qs[_0x9af6('0x37')](_0x2d1377['query'][_0x9af6('0x37')]));_0x591640[_0x9af6('0x38')]=_0x591640[_0x9af6('0x38')][_0x9af6('0x39')]?_0x591640[_0x9af6('0x38')]:_0x5a024f[_0x9af6('0x36')];if(!_0x2d1377[_0x9af6('0x32')]['hasOwnProperty']('nolimit')){_0x591640[_0x9af6('0x1f')]=qs[_0x9af6('0x1f')](_0x2d1377[_0x9af6('0x32')]['limit']);_0x591640[_0x9af6('0x1d')]=qs[_0x9af6('0x1d')](_0x2d1377[_0x9af6('0x32')][_0x9af6('0x1d')]);}_0x591640[_0x9af6('0x3a')]=qs[_0x9af6('0x3b')](_0x2d1377[_0x9af6('0x32')][_0x9af6('0x3b')]);_0x591640[_0x9af6('0x3c')]=qs['filters'](_[_0x9af6('0x3d')](_0x2d1377['query'],_0x5a024f['filters']),_0x1dbc90);if(_0x2d1377[_0x9af6('0x32')][_0x9af6('0x3e')]){_0x591640['where']=_[_0x9af6('0x3f')](_0x591640[_0x9af6('0x3c')],{'$or':_['map'](_0x1dbc90,function(_0x1b1b7d){if(_0x1b1b7d[_0x9af6('0x31')]!==_0x9af6('0x40')){var _0x229fe2={};_0x229fe2[_0x1b1b7d['name']]={'$like':'%'+_0x2d1377[_0x9af6('0x32')][_0x9af6('0x3e')]+'%'};return _0x229fe2;}})});}_0x591640=_[_0x9af6('0x3f')]({},_0x591640,_0x2d1377[_0x9af6('0x41')]);var _0x5b0b0a={'where':_0x591640[_0x9af6('0x3c')]};return db[_0x9af6('0x2e')]['count'](_0x5b0b0a)[_0x9af6('0x27')](function(_0xe5a24a){_0x505162[_0x9af6('0x20')]=_0xe5a24a;if(_0x2d1377[_0x9af6('0x32')]['includeAll']){_0x591640[_0x9af6('0x42')]=[{'all':!![]}];}return db[_0x9af6('0x2e')]['findAll'](_0x591640);})[_0x9af6('0x27')](function(_0x43c146){_0x505162[_0x9af6('0x43')]=_0x43c146;return _0x505162;})[_0x9af6('0x27')](respondWithFilteredResult(_0x2fe26d,_0x591640))[_0x9af6('0x44')](handleError(_0x2fe26d,null));};exports[_0x9af6('0x45')]=function(_0x453e75,_0x2e2d0e){var _0x390082={'raw':!![],'where':{'id':_0x453e75[_0x9af6('0x46')]['id']}},_0x3d0480={};_0x3d0480[_0x9af6('0x36')]=_[_0x9af6('0x33')](db[_0x9af6('0x2e')]['rawAttributes']);_0x3d0480[_0x9af6('0x32')]=_[_0x9af6('0x33')](_0x453e75[_0x9af6('0x32')]);_0x3d0480[_0x9af6('0x34')]=_['intersection'](_0x3d0480[_0x9af6('0x36')],_0x3d0480[_0x9af6('0x32')]);_0x390082[_0x9af6('0x38')]=_['intersection'](_0x3d0480[_0x9af6('0x36')],qs[_0x9af6('0x37')](_0x453e75['query'][_0x9af6('0x37')]));_0x390082['attributes']=_0x390082[_0x9af6('0x38')][_0x9af6('0x39')]?_0x390082[_0x9af6('0x38')]:_0x3d0480['model'];if(_0x453e75['query'][_0x9af6('0x47')]){_0x390082[_0x9af6('0x42')]=[{'all':!![]}];}_0x390082=_[_0x9af6('0x3f')]({},_0x390082,_0x453e75[_0x9af6('0x41')]);return db['JscriptySessionReport'][_0x9af6('0x48')](_0x390082)[_0x9af6('0x27')](handleEntityNotFound(_0x2e2d0e,null))['then'](respondWithResult(_0x2e2d0e,null))[_0x9af6('0x44')](handleError(_0x2e2d0e,null));};exports['create']=function(_0x2378e1,_0x23ba7f){return db[_0x9af6('0x2e')][_0x9af6('0x49')](_0x2378e1[_0x9af6('0x4a')],{})['then'](respondWithResult(_0x23ba7f,0xc9))[_0x9af6('0x44')](handleError(_0x23ba7f,null));};exports['update']=function(_0x599955,_0x3e1078){if(_0x599955[_0x9af6('0x4a')]['id']){delete _0x599955[_0x9af6('0x4a')]['id'];}return db[_0x9af6('0x2e')][_0x9af6('0x48')]({'where':{'id':_0x599955[_0x9af6('0x46')]['id']}})[_0x9af6('0x27')](handleEntityNotFound(_0x3e1078,null))['then'](saveUpdates(_0x599955[_0x9af6('0x4a')],null))[_0x9af6('0x27')](respondWithResult(_0x3e1078,null))[_0x9af6('0x44')](handleError(_0x3e1078,null));};exports['destroy']=function(_0x202ac2,_0x3817e1){return db[_0x9af6('0x2e')][_0x9af6('0x48')]({'where':{'id':_0x202ac2['params']['id']}})[_0x9af6('0x27')](handleEntityNotFound(_0x3817e1,null))[_0x9af6('0x27')](removeEntity(_0x3817e1,null))[_0x9af6('0x44')](handleError(_0x3817e1,null));};exports[_0x9af6('0x4b')]=function(_0x374260,_0x27e139){return db[_0x9af6('0x2e')][_0x9af6('0x4b')]()['then'](respondWithResult(_0x27e139,null))[_0x9af6('0x44')](handleError(_0x27e139,null));};exports['getQuestions']=function(_0x5aca61,_0x55677a,_0x557405){var _0x1e0c31={'raw':!![],'where':{}};var _0x3625a1={};var _0x29f804={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x5aca61['params']['id']}})[_0x9af6('0x27')](handleEntityNotFound(_0x55677a,null))[_0x9af6('0x27')](function(_0x5d5008){if(_0x5d5008){_0x3625a1['model']=_[_0x9af6('0x33')](db[_0x9af6('0x4c')]['rawAttributes']);_0x3625a1[_0x9af6('0x32')]=_['keys'](_0x5aca61[_0x9af6('0x32')]);_0x3625a1['filters']=_['intersection'](_0x3625a1[_0x9af6('0x36')],_0x3625a1[_0x9af6('0x32')]);_0x1e0c31['attributes']=_[_0x9af6('0x35')](_0x3625a1['model'],qs[_0x9af6('0x37')](_0x5aca61[_0x9af6('0x32')][_0x9af6('0x37')]));_0x1e0c31[_0x9af6('0x38')]=_0x1e0c31[_0x9af6('0x38')][_0x9af6('0x39')]?_0x1e0c31[_0x9af6('0x38')]:_0x3625a1[_0x9af6('0x36')];if(!_0x5aca61[_0x9af6('0x32')][_0x9af6('0x4d')]('nolimit')){_0x1e0c31[_0x9af6('0x1f')]=qs[_0x9af6('0x1f')](_0x5aca61[_0x9af6('0x32')][_0x9af6('0x1f')]);_0x1e0c31[_0x9af6('0x1d')]=qs[_0x9af6('0x1d')](_0x5aca61[_0x9af6('0x32')]['offset']);}_0x1e0c31['order']=qs[_0x9af6('0x3b')](_0x5aca61[_0x9af6('0x32')][_0x9af6('0x3b')]);_0x1e0c31[_0x9af6('0x3c')]=qs['filters'](_['pick'](_0x5aca61['query'],_0x3625a1[_0x9af6('0x34')]));_0x1e0c31[_0x9af6('0x3c')][_0x9af6('0x4e')]=_0x5d5008['id'];if(_0x5aca61['query'][_0x9af6('0x3e')]){_0x1e0c31[_0x9af6('0x3c')]=_[_0x9af6('0x3f')](_0x1e0c31[_0x9af6('0x3c')],{'$or':_[_0x9af6('0x2d')](_0x1e0c31[_0x9af6('0x38')],function(_0x4cc214){var _0x3bd16b={};_0x3bd16b[_0x4cc214]={'$like':'%'+_0x5aca61[_0x9af6('0x32')][_0x9af6('0x3e')]+'%'};return _0x3bd16b;})});}_0x1e0c31=_[_0x9af6('0x3f')]({},_0x1e0c31,_0x5aca61[_0x9af6('0x41')]);return db[_0x9af6('0x4c')]['count']({'where':_0x1e0c31[_0x9af6('0x3c')]})['then'](function(_0x91e180){_0x29f804[_0x9af6('0x20')]=_0x91e180;if(_0x5aca61[_0x9af6('0x32')][_0x9af6('0x47')]){_0x1e0c31[_0x9af6('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9af6('0x4f')](_0x1e0c31);})[_0x9af6('0x27')](function(_0x2c2108){_0x29f804[_0x9af6('0x43')]=_0x2c2108;return _0x29f804;});}})[_0x9af6('0x27')](respondWithFilteredResult(_0x55677a,_0x1e0c31))[_0x9af6('0x44')](handleError(_0x55677a,null));}; \ No newline at end of file +var _0xdf9b=['pick','merge','VIRTUAL','options','findAll','rows','show','keys','include','catch','create','body','find','params','describe','getQuestions','findOne','SessionId','filter','includeAll','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0xe69b7d,_0x1c68c7){var _0x181c88=function(_0x250a24){while(--_0x250a24){_0xe69b7d['push'](_0xe69b7d['shift']());}};_0x181c88(++_0x1c68c7);}(_0xdf9b,0x1af));var _0xbdf9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdf9b[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0xbdf9('0x0'));var rimraf=require(_0xbdf9('0x1'));var zipdir=require(_0xbdf9('0x2'));var jsonpatch=require(_0xbdf9('0x3'));var rp=require(_0xbdf9('0x4'));var moment=require(_0xbdf9('0x5'));var BPromise=require(_0xbdf9('0x6'));var Mustache=require(_0xbdf9('0x7'));var util=require(_0xbdf9('0x8'));var path=require(_0xbdf9('0x9'));var sox=require(_0xbdf9('0xa'));var csv=require(_0xbdf9('0xb'));var ejs=require(_0xbdf9('0xc'));var fs=require('fs');var fs_extra=require(_0xbdf9('0xd'));var _=require(_0xbdf9('0xe'));var squel=require(_0xbdf9('0xf'));var crypto=require(_0xbdf9('0x10'));var jsforce=require(_0xbdf9('0x11'));var deskjs=require(_0xbdf9('0x12'));var toCsv=require(_0xbdf9('0xb'));var querystring=require(_0xbdf9('0x13'));var Papa=require(_0xbdf9('0x14'));var Redis=require('ioredis');var authService=require(_0xbdf9('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xbdf9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbdf9('0x17'));var utils=require('../../config/utils');var config=require(_0xbdf9('0x18'));var licenseUtil=require(_0xbdf9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb9b3d,_0x37a0f7){_0x37a0f7=_0x37a0f7||0xcc;return function(_0x2697a3){if(_0x2697a3){return _0xeb9b3d[_0xbdf9('0x1a')](_0x37a0f7);}return _0xeb9b3d[_0xbdf9('0x1b')](_0x37a0f7)['end']();};}function respondWithResult(_0x5f23e8,_0x5edc93){_0x5edc93=_0x5edc93||0xc8;return function(_0x243a69){if(_0x243a69){return _0x5f23e8['status'](_0x5edc93)['json'](_0x243a69);}};}function respondWithFilteredResult(_0x5835fe,_0x309e3b){return function(_0xe365bf){if(_0xe365bf){var _0x3eff1e=typeof _0x309e3b[_0xbdf9('0x1c')]===_0xbdf9('0x1d')&&typeof _0x309e3b[_0xbdf9('0x1e')]===_0xbdf9('0x1d');var _0x3eebb5=_0xe365bf[_0xbdf9('0x1f')];var _0x43b1ed=_0x3eff1e?0x0:_0x309e3b[_0xbdf9('0x1c')];var _0x2070e8=_0x3eff1e?_0xe365bf[_0xbdf9('0x1f')]:_0x309e3b[_0xbdf9('0x1c')]+_0x309e3b['limit'];var _0x1c5bb9;if(_0x2070e8>=_0x3eebb5){_0x2070e8=_0x3eebb5;_0x1c5bb9=0xc8;}else{_0x1c5bb9=0xce;}_0x5835fe['status'](_0x1c5bb9);return _0x5835fe[_0xbdf9('0x20')]('Content-Range',_0x43b1ed+'-'+_0x2070e8+'/'+_0x3eebb5)[_0xbdf9('0x21')](_0xe365bf);}return null;};}function patchUpdates(_0x81ed7a){return function(_0x2735cc){try{jsonpatch['apply'](_0x2735cc,_0x81ed7a,!![]);}catch(_0x2f4e78){return BPromise[_0xbdf9('0x22')](_0x2f4e78);}return _0x2735cc[_0xbdf9('0x23')]();};}function saveUpdates(_0x18fcf6,_0x319d21){return function(_0x15c091){if(_0x15c091){return _0x15c091[_0xbdf9('0x24')](_0x18fcf6)[_0xbdf9('0x25')](function(_0x7bbd7e){return _0x7bbd7e;});}return null;};}function removeEntity(_0x5e98ae,_0x388366){return function(_0x251d67){if(_0x251d67){return _0x251d67[_0xbdf9('0x26')]()[_0xbdf9('0x25')](function(){_0x5e98ae['status'](0xcc)[_0xbdf9('0x27')]();});}};}function handleEntityNotFound(_0x1d665d,_0x46c405){return function(_0xacf47c){if(!_0xacf47c){_0x1d665d[_0xbdf9('0x1a')](0x194);}return _0xacf47c;};}function handleError(_0x208b20,_0x32cb7d){_0x32cb7d=_0x32cb7d||0x1f4;return function(_0x1f0182){logger[_0xbdf9('0x28')](_0x1f0182[_0xbdf9('0x29')]);if(_0x1f0182[_0xbdf9('0x2a')]){delete _0x1f0182[_0xbdf9('0x2a')];}_0x208b20[_0xbdf9('0x1b')](_0x32cb7d)['send'](_0x1f0182);};}exports[_0xbdf9('0x2b')]=function(_0x59789d,_0x3dfbe7){var _0x32a2e3={},_0x4ff7fe={},_0x25434b={'count':0x0,'rows':[]};var _0xcb955e=_[_0xbdf9('0x2c')](db[_0xbdf9('0x2d')][_0xbdf9('0x2e')],function(_0x4adff7){return{'name':_0x4adff7['fieldName'],'type':_0x4adff7[_0xbdf9('0x2f')][_0xbdf9('0x30')]};});_0x4ff7fe[_0xbdf9('0x31')]=_[_0xbdf9('0x2c')](_0xcb955e,_0xbdf9('0x2a'));_0x4ff7fe[_0xbdf9('0x32')]=_['keys'](_0x59789d[_0xbdf9('0x32')]);_0x4ff7fe['filters']=_[_0xbdf9('0x33')](_0x4ff7fe[_0xbdf9('0x31')],_0x4ff7fe[_0xbdf9('0x32')]);_0x32a2e3[_0xbdf9('0x34')]=_['intersection'](_0x4ff7fe['model'],qs[_0xbdf9('0x35')](_0x59789d[_0xbdf9('0x32')][_0xbdf9('0x35')]));_0x32a2e3[_0xbdf9('0x34')]=_0x32a2e3['attributes'][_0xbdf9('0x36')]?_0x32a2e3[_0xbdf9('0x34')]:_0x4ff7fe[_0xbdf9('0x31')];if(!_0x59789d[_0xbdf9('0x32')][_0xbdf9('0x37')](_0xbdf9('0x38'))){_0x32a2e3[_0xbdf9('0x1e')]=qs[_0xbdf9('0x1e')](_0x59789d[_0xbdf9('0x32')][_0xbdf9('0x1e')]);_0x32a2e3[_0xbdf9('0x1c')]=qs[_0xbdf9('0x1c')](_0x59789d[_0xbdf9('0x32')]['offset']);}_0x32a2e3[_0xbdf9('0x39')]=qs['sort'](_0x59789d[_0xbdf9('0x32')][_0xbdf9('0x3a')]);_0x32a2e3[_0xbdf9('0x3b')]=qs[_0xbdf9('0x3c')](_[_0xbdf9('0x3d')](_0x59789d['query'],_0x4ff7fe[_0xbdf9('0x3c')]),_0xcb955e);if(_0x59789d[_0xbdf9('0x32')]['filter']){_0x32a2e3[_0xbdf9('0x3b')]=_[_0xbdf9('0x3e')](_0x32a2e3['where'],{'$or':_[_0xbdf9('0x2c')](_0xcb955e,function(_0x584cfb){if(_0x584cfb[_0xbdf9('0x2f')]!==_0xbdf9('0x3f')){var _0x1a2946={};_0x1a2946[_0x584cfb[_0xbdf9('0x2a')]]={'$like':'%'+_0x59789d[_0xbdf9('0x32')]['filter']+'%'};return _0x1a2946;}})});}_0x32a2e3=_[_0xbdf9('0x3e')]({},_0x32a2e3,_0x59789d[_0xbdf9('0x40')]);var _0xe37353={'where':_0x32a2e3['where']};return db[_0xbdf9('0x2d')]['count'](_0xe37353)['then'](function(_0x4e038a){_0x25434b[_0xbdf9('0x1f')]=_0x4e038a;if(_0x59789d[_0xbdf9('0x32')]['includeAll']){_0x32a2e3['include']=[{'all':!![]}];}return db[_0xbdf9('0x2d')][_0xbdf9('0x41')](_0x32a2e3);})['then'](function(_0x5d3333){_0x25434b[_0xbdf9('0x42')]=_0x5d3333;return _0x25434b;})[_0xbdf9('0x25')](respondWithFilteredResult(_0x3dfbe7,_0x32a2e3))['catch'](handleError(_0x3dfbe7,null));};exports[_0xbdf9('0x43')]=function(_0x4f1ae2,_0x299065){var _0x5a5747={'raw':!![],'where':{'id':_0x4f1ae2['params']['id']}},_0x1b4fca={};_0x1b4fca[_0xbdf9('0x31')]=_[_0xbdf9('0x44')](db[_0xbdf9('0x2d')][_0xbdf9('0x2e')]);_0x1b4fca['query']=_[_0xbdf9('0x44')](_0x4f1ae2['query']);_0x1b4fca[_0xbdf9('0x3c')]=_[_0xbdf9('0x33')](_0x1b4fca[_0xbdf9('0x31')],_0x1b4fca['query']);_0x5a5747[_0xbdf9('0x34')]=_['intersection'](_0x1b4fca[_0xbdf9('0x31')],qs[_0xbdf9('0x35')](_0x4f1ae2['query'][_0xbdf9('0x35')]));_0x5a5747[_0xbdf9('0x34')]=_0x5a5747[_0xbdf9('0x34')][_0xbdf9('0x36')]?_0x5a5747['attributes']:_0x1b4fca[_0xbdf9('0x31')];if(_0x4f1ae2[_0xbdf9('0x32')]['includeAll']){_0x5a5747[_0xbdf9('0x45')]=[{'all':!![]}];}_0x5a5747=_[_0xbdf9('0x3e')]({},_0x5a5747,_0x4f1ae2[_0xbdf9('0x40')]);return db[_0xbdf9('0x2d')]['find'](_0x5a5747)[_0xbdf9('0x25')](handleEntityNotFound(_0x299065,null))['then'](respondWithResult(_0x299065,null))[_0xbdf9('0x46')](handleError(_0x299065,null));};exports[_0xbdf9('0x47')]=function(_0x370f6d,_0x1d817c){return db['JscriptySessionReport']['create'](_0x370f6d['body'],{})[_0xbdf9('0x25')](respondWithResult(_0x1d817c,0xc9))['catch'](handleError(_0x1d817c,null));};exports[_0xbdf9('0x24')]=function(_0x50950c,_0x8093b9){if(_0x50950c[_0xbdf9('0x48')]['id']){delete _0x50950c[_0xbdf9('0x48')]['id'];}return db[_0xbdf9('0x2d')][_0xbdf9('0x49')]({'where':{'id':_0x50950c['params']['id']}})['then'](handleEntityNotFound(_0x8093b9,null))['then'](saveUpdates(_0x50950c['body'],null))[_0xbdf9('0x25')](respondWithResult(_0x8093b9,null))[_0xbdf9('0x46')](handleError(_0x8093b9,null));};exports[_0xbdf9('0x26')]=function(_0xd2bba8,_0x3cd1c4){return db['JscriptySessionReport'][_0xbdf9('0x49')]({'where':{'id':_0xd2bba8[_0xbdf9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cd1c4,null))['then'](removeEntity(_0x3cd1c4,null))[_0xbdf9('0x46')](handleError(_0x3cd1c4,null));};exports[_0xbdf9('0x4b')]=function(_0x5acb10,_0x4ca1e1){return db[_0xbdf9('0x2d')][_0xbdf9('0x4b')]()['then'](respondWithResult(_0x4ca1e1,null))[_0xbdf9('0x46')](handleError(_0x4ca1e1,null));};exports[_0xbdf9('0x4c')]=function(_0x20e899,_0x321c04,_0x1d723d){var _0x611f9e={'raw':!![],'where':{}};var _0x536436={};var _0x32d2e2={'count':0x0,'rows':[]};return db[_0xbdf9('0x2d')][_0xbdf9('0x4d')]({'where':{'id':_0x20e899[_0xbdf9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x321c04,null))[_0xbdf9('0x25')](function(_0x5e1493){if(_0x5e1493){_0x536436['model']=_[_0xbdf9('0x44')](db['JscriptyQuestionReport']['rawAttributes']);_0x536436[_0xbdf9('0x32')]=_[_0xbdf9('0x44')](_0x20e899['query']);_0x536436[_0xbdf9('0x3c')]=_[_0xbdf9('0x33')](_0x536436[_0xbdf9('0x31')],_0x536436['query']);_0x611f9e[_0xbdf9('0x34')]=_[_0xbdf9('0x33')](_0x536436[_0xbdf9('0x31')],qs['fields'](_0x20e899['query'][_0xbdf9('0x35')]));_0x611f9e[_0xbdf9('0x34')]=_0x611f9e['attributes']['length']?_0x611f9e[_0xbdf9('0x34')]:_0x536436[_0xbdf9('0x31')];if(!_0x20e899['query']['hasOwnProperty'](_0xbdf9('0x38'))){_0x611f9e['limit']=qs[_0xbdf9('0x1e')](_0x20e899[_0xbdf9('0x32')][_0xbdf9('0x1e')]);_0x611f9e['offset']=qs['offset'](_0x20e899[_0xbdf9('0x32')]['offset']);}_0x611f9e[_0xbdf9('0x39')]=qs['sort'](_0x20e899['query']['sort']);_0x611f9e[_0xbdf9('0x3b')]=qs[_0xbdf9('0x3c')](_[_0xbdf9('0x3d')](_0x20e899[_0xbdf9('0x32')],_0x536436['filters']));_0x611f9e['where'][_0xbdf9('0x4e')]=_0x5e1493['id'];if(_0x20e899['query'][_0xbdf9('0x4f')]){_0x611f9e[_0xbdf9('0x3b')]=_[_0xbdf9('0x3e')](_0x611f9e[_0xbdf9('0x3b')],{'$or':_['map'](_0x611f9e[_0xbdf9('0x34')],function(_0x29314a){var _0xf54b88={};_0xf54b88[_0x29314a]={'$like':'%'+_0x20e899['query'][_0xbdf9('0x4f')]+'%'};return _0xf54b88;})});}_0x611f9e=_['merge']({},_0x611f9e,_0x20e899[_0xbdf9('0x40')]);return db['JscriptyQuestionReport'][_0xbdf9('0x1f')]({'where':_0x611f9e[_0xbdf9('0x3b')]})['then'](function(_0x185db4){_0x32d2e2[_0xbdf9('0x1f')]=_0x185db4;if(_0x20e899[_0xbdf9('0x32')][_0xbdf9('0x50')]){_0x611f9e[_0xbdf9('0x45')]=[{'all':!![]}];}return db[_0xbdf9('0x51')][_0xbdf9('0x41')](_0x611f9e);})[_0xbdf9('0x25')](function(_0x47c1b2){_0x32d2e2[_0xbdf9('0x42')]=_0x47c1b2;return _0x32d2e2;});}})['then'](respondWithFilteredResult(_0x321c04,_0x611f9e))['catch'](handleError(_0x321c04,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1c702c5..9cdb14c 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 _0x687b=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1f7928,_0xdafed0){var _0x498443=function(_0x2da729){while(--_0x2da729){_0x1f7928['push'](_0x1f7928['shift']());}};_0x498443(++_0xdafed0);}(_0x687b,0x14a));var _0xb687=function(_0x4a231f,_0x1989a6){_0x4a231f=_0x4a231f-0x0;var _0x7ea6bf=_0x687b[_0x4a231f];return _0x7ea6bf;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util'];(function(_0x19b5e1,_0x1fef0b){var _0x1e2908=function(_0x1e0ae1){while(--_0x1e0ae1){_0x19b5e1['push'](_0x19b5e1['shift']());}};_0x1e2908(++_0x1fef0b);}(_0x6f47,0xc7));var _0x76f4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6f47[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'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 7ebc01d..c5ade45 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 _0x583c=['../../config/environment','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x583c,0x12b));var _0xc583=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x583c[_0x4b5813];return _0x423465;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});} \ No newline at end of file +var _0x5430=['ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5430,0x10c));var _0x0543=function(_0x20c879,_0x55baf4){_0x20c879=_0x20c879-0x0;var _0x472d08=_0x5430[_0x20c879];return _0x472d08;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cb04683..68cb255 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 _0xd649=['index','put','/:id','isAuthenticated','get','/download_log_file','downloadLogFile','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller'];(function(_0x51eae6,_0x63fc75){var _0x300e87=function(_0x1c933b){while(--_0x1c933b){_0x51eae6['push'](_0x51eae6['shift']());}};_0x300e87(++_0x63fc75);}(_0xd649,0x161));var _0x9d64=function(_0x3dd574,_0x4d0901){_0x3dd574=_0x3dd574-0x0;var _0x378bc7=_0xd649[_0x3dd574];return _0x378bc7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9d64('0x0'));var express=require(_0x9d64('0x1'));var router=express[_0x9d64('0x2')]();var fs_extra=require(_0x9d64('0x3'));var auth=require(_0x9d64('0x4'));var interaction=require(_0x9d64('0x5'));var config=require('../../config/environment');var controller=require(_0x9d64('0x6'));router['get']('/',controller[_0x9d64('0x7')]);router[_0x9d64('0x8')](_0x9d64('0x9'),auth[_0x9d64('0xa')](),controller['update']);router[_0x9d64('0xb')](_0x9d64('0xc'),auth[_0x9d64('0xa')](),controller[_0x9d64('0xd')]);module[_0x9d64('0xe')]=router; \ No newline at end of file +var _0xcd97=['downloadLogFile','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','update'];(function(_0x192294,_0xa50f60){var _0x3a95fe=function(_0x266de9){while(--_0x266de9){_0x192294['push'](_0x192294['shift']());}};_0x3a95fe(++_0xa50f60);}(_0xcd97,0x189));var _0x7cd9=function(_0x4b5075,_0xee1fb9){_0x4b5075=_0x4b5075-0x0;var _0x234617=_0xcd97[_0x4b5075];return _0x234617;};'use strict';var multer=require(_0x7cd9('0x0'));var util=require('util');var path=require(_0x7cd9('0x1'));var timeout=require('connect-timeout');var express=require(_0x7cd9('0x2'));var router=express[_0x7cd9('0x3')]();var fs_extra=require(_0x7cd9('0x4'));var auth=require(_0x7cd9('0x5'));var interaction=require(_0x7cd9('0x6'));var config=require(_0x7cd9('0x7'));var controller=require(_0x7cd9('0x8'));router[_0x7cd9('0x9')]('/',controller[_0x7cd9('0xa')]);router['put'](_0x7cd9('0xb'),auth['isAuthenticated'](),controller[_0x7cd9('0xc')]);router['get']('/download_log_file',auth['isAuthenticated'](),controller[_0x7cd9('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 38a6af7..4f5e0e7 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 _0x21f5=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x5c351a,_0x23db34){var _0x190674=function(_0x4bbdef){while(--_0x4bbdef){_0x5c351a['push'](_0x5c351a['shift']());}};_0x190674(++_0x23db34);}(_0x21f5,0x170));var _0x521f=function(_0x2e8810,_0x1ba82a){_0x2e8810=_0x2e8810-0x0;var _0x2639bd=_0x21f5[_0x2e8810];return _0x2639bd;};'use strict';var Sequelize=require(_0x521f('0x0'));module[_0x521f('0x1')]={'license':{'type':Sequelize[_0x521f('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x521f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x521f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9a29=['TEXT','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a29,0xb3));var _0x99a2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a29[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x99a2('0x0'));module['exports']={'license':{'type':Sequelize[_0x99a2('0x1')]},'data1':{'type':Sequelize[_0x99a2('0x2')]},'data2':{'type':Sequelize[_0x99a2('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c42da86..4efbb8b 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 _0x23e4=['Content-Range','apply','reject','save','then','destroy','end','error','name','../../config/license/util','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','body','find','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3b2c8e,_0x53910b){var _0x3ebe3d=function(_0x57220b){while(--_0x57220b){_0x3b2c8e['push'](_0x3b2c8e['shift']());}};_0x3ebe3d(++_0x53910b);}(_0x23e4,0x75));var _0x423e=function(_0x4d61dd,_0x522d27){_0x4d61dd=_0x4d61dd-0x0;var _0x22a493=_0x23e4[_0x4d61dd];return _0x22a493;};'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(_0x423e('0x0'));var moment=require(_0x423e('0x1'));var BPromise=require(_0x423e('0x2'));var Mustache=require('mustache');var util=require(_0x423e('0x3'));var path=require(_0x423e('0x4'));var sox=require(_0x423e('0x5'));var csv=require(_0x423e('0x6'));var ejs=require(_0x423e('0x7'));var fs=require('fs');var fs_extra=require(_0x423e('0x8'));var _=require(_0x423e('0x9'));var squel=require(_0x423e('0xa'));var crypto=require('crypto');var jsforce=require(_0x423e('0xb'));var deskjs=require(_0x423e('0xc'));var toCsv=require(_0x423e('0x6'));var querystring=require(_0x423e('0xd'));var Papa=require(_0x423e('0xe'));var Redis=require(_0x423e('0xf'));var authService=require(_0x423e('0x10'));var qs=require(_0x423e('0x11'));var as=require(_0x423e('0x12'));var hardwareService=require(_0x423e('0x13'));var logger=require(_0x423e('0x14'))(_0x423e('0x15'));var utils=require(_0x423e('0x16'));var config=require(_0x423e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x423e('0x18'))['db'];function respondWithStatusCode(_0x1da043,_0x1ca891){_0x1ca891=_0x1ca891||0xcc;return function(_0x4ab98d){if(_0x4ab98d){return _0x1da043[_0x423e('0x19')](_0x1ca891);}return _0x1da043[_0x423e('0x1a')](_0x1ca891)['end']();};}function respondWithResult(_0x24b74c,_0x52396f){_0x52396f=_0x52396f||0xc8;return function(_0x5777a3){if(_0x5777a3){return _0x24b74c[_0x423e('0x1a')](_0x52396f)[_0x423e('0x1b')](_0x5777a3);}};}function respondWithFilteredResult(_0x20639e,_0x372753){return function(_0x97df3e){if(_0x97df3e){var _0x5a2c86=typeof _0x372753[_0x423e('0x1c')]===_0x423e('0x1d')&&typeof _0x372753[_0x423e('0x1e')]==='undefined';var _0x527bf4=_0x97df3e[_0x423e('0x1f')];var _0x29ed81=_0x5a2c86?0x0:_0x372753[_0x423e('0x1c')];var _0x45cbae=_0x5a2c86?_0x97df3e['count']:_0x372753['offset']+_0x372753[_0x423e('0x1e')];var _0x5f204a;if(_0x45cbae>=_0x527bf4){_0x45cbae=_0x527bf4;_0x5f204a=0xc8;}else{_0x5f204a=0xce;}_0x20639e[_0x423e('0x1a')](_0x5f204a);return _0x20639e[_0x423e('0x20')](_0x423e('0x21'),_0x29ed81+'-'+_0x45cbae+'/'+_0x527bf4)[_0x423e('0x1b')](_0x97df3e);}return null;};}function patchUpdates(_0x3c29e4){return function(_0x523ce3){try{jsonpatch[_0x423e('0x22')](_0x523ce3,_0x3c29e4,!![]);}catch(_0x4f5d55){return BPromise[_0x423e('0x23')](_0x4f5d55);}return _0x523ce3[_0x423e('0x24')]();};}function saveUpdates(_0x1ad711,_0x5d673b){return function(_0x1b1ede){if(_0x1b1ede){return _0x1b1ede['update'](_0x1ad711)[_0x423e('0x25')](function(_0x2926a7){return _0x2926a7;});}return null;};}function removeEntity(_0x552dc1,_0x10c5fb){return function(_0x432670){if(_0x432670){return _0x432670[_0x423e('0x26')]()['then'](function(){_0x552dc1[_0x423e('0x1a')](0xcc)[_0x423e('0x27')]();});}};}function handleEntityNotFound(_0x4ab77e,_0x1d3756){return function(_0x528a04){if(!_0x528a04){_0x4ab77e['sendStatus'](0x194);}return _0x528a04;};}function handleError(_0x2f05f6,_0x207129){_0x207129=_0x207129||0x1f4;return function(_0x4dcb6c){logger[_0x423e('0x28')](_0x4dcb6c['stack']);if(_0x4dcb6c['name']){delete _0x4dcb6c[_0x423e('0x29')];}_0x2f05f6[_0x423e('0x1a')](_0x207129)['send'](_0x4dcb6c);};}var utilLicense=require(_0x423e('0x2a'));exports['index']=function(_0x4d061e,_0x4bc6a7){var _0x8aa082={'raw':!![],'where':{'id':0x1}},_0xdae73f={};_0xdae73f[_0x423e('0x2b')]=_[_0x423e('0x2c')](db[_0x423e('0x2d')][_0x423e('0x2e')]);_0xdae73f[_0x423e('0x2f')]=_['keys'](_0x4d061e[_0x423e('0x2f')]);_0xdae73f[_0x423e('0x30')]=_[_0x423e('0x31')](_0xdae73f['model'],_0xdae73f[_0x423e('0x2f')]);_0x8aa082[_0x423e('0x32')]=_['intersection'](_0xdae73f[_0x423e('0x2b')],qs[_0x423e('0x33')](_0x4d061e['query'][_0x423e('0x33')]));_0x8aa082[_0x423e('0x32')]=_0x8aa082[_0x423e('0x32')][_0x423e('0x34')]?_0x8aa082['attributes']:_0xdae73f[_0x423e('0x2b')];_0x8aa082=_[_0x423e('0x35')]({},_0x8aa082,_0x4d061e[_0x423e('0x36')]);return utilLicense[_0x423e('0x37')](_0x8aa082)['then'](respondWithResult(_0x4bc6a7,null))['catch'](handleError(_0x4bc6a7,null));};exports['update']=function(_0x55bc16,_0x32631e){if(_0x55bc16[_0x423e('0x38')]['id']){delete _0x55bc16[_0x423e('0x38')]['id'];}return db[_0x423e('0x2d')][_0x423e('0x39')]({'where':{'id':_0x55bc16['params']['id']}})[_0x423e('0x25')](handleEntityNotFound(_0x32631e,null))['then'](function(_0xce3da8){var _0x495cf5=_0xce3da8[_0x423e('0x3a')]({'plain':!![]});return utilLicense[_0x423e('0x3b')](_0x495cf5,_0x55bc16[_0x423e('0x38')][_0x423e('0x3c')]);})[_0x423e('0x25')](function(_0x2da10c){if(!_0x2da10c[_0x423e('0x3d')]){return saveUpdates(_0x55bc16[_0x423e('0x38')],null);}return _0x2da10c;})[_0x423e('0x25')](respondWithResult(_0x32631e,null))[_0x423e('0x3e')](handleError(_0x32631e,null));};exports[_0x423e('0x3f')]=function(_0xc88ecc,_0x34d1f8){var _0x434737=_0x423e('0x40');var _0x4f3ca3=path[_0x423e('0x41')](_0x423e('0x42'),_0x423e('0x43'),_0x423e('0x44'),_0x434737);_0x34d1f8[_0x423e('0x45')](_0x423e('0x46'),_0x423e('0x47')+_0x434737);_0x34d1f8[_0x423e('0x20')](_0x423e('0x48'),_0x423e('0x49'));_0x34d1f8[_0x423e('0x4a')](_0x4f3ca3);}; \ No newline at end of file +var _0xba35=['then','sendStatus','error','stack','name','send','index','keys','query','filters','intersection','attributes','model','fields','length','merge','getLicense','catch','body','License','params','get','checkLicense','key','demo','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x5e5d68,_0x4eb8e6){var _0x3c55c2=function(_0x26c0fc){while(--_0x26c0fc){_0x5e5d68['push'](_0x5e5d68['shift']());}};_0x3c55c2(++_0x4eb8e6);}(_0xba35,0x190));var _0x5ba3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xba35[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x5ba3('0x0'));var rimraf=require(_0x5ba3('0x1'));var zipdir=require(_0x5ba3('0x2'));var jsonpatch=require(_0x5ba3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ba3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ba3('0x5'));var sox=require(_0x5ba3('0x6'));var csv=require(_0x5ba3('0x7'));var ejs=require(_0x5ba3('0x8'));var fs=require('fs');var fs_extra=require(_0x5ba3('0x9'));var _=require(_0x5ba3('0xa'));var squel=require(_0x5ba3('0xb'));var crypto=require(_0x5ba3('0xc'));var jsforce=require(_0x5ba3('0xd'));var deskjs=require(_0x5ba3('0xe'));var toCsv=require(_0x5ba3('0x7'));var querystring=require(_0x5ba3('0xf'));var Papa=require(_0x5ba3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ba3('0x11'));var as=require(_0x5ba3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ba3('0x13'))(_0x5ba3('0x14'));var utils=require(_0x5ba3('0x15'));var config=require(_0x5ba3('0x16'));var licenseUtil=require(_0x5ba3('0x17'));var db=require(_0x5ba3('0x18'))['db'];function respondWithStatusCode(_0x3c988a,_0x3306da){_0x3306da=_0x3306da||0xcc;return function(_0x53ebae){if(_0x53ebae){return _0x3c988a['sendStatus'](_0x3306da);}return _0x3c988a[_0x5ba3('0x19')](_0x3306da)[_0x5ba3('0x1a')]();};}function respondWithResult(_0x3a7491,_0x339932){_0x339932=_0x339932||0xc8;return function(_0x3a07a3){if(_0x3a07a3){return _0x3a7491[_0x5ba3('0x19')](_0x339932)[_0x5ba3('0x1b')](_0x3a07a3);}};}function respondWithFilteredResult(_0x9abfb0,_0x33ccd9){return function(_0x33be06){if(_0x33be06){var _0x171532=typeof _0x33ccd9['offset']===_0x5ba3('0x1c')&&typeof _0x33ccd9[_0x5ba3('0x1d')]===_0x5ba3('0x1c');var _0x1a1da0=_0x33be06[_0x5ba3('0x1e')];var _0x9e9344=_0x171532?0x0:_0x33ccd9[_0x5ba3('0x1f')];var _0x519645=_0x171532?_0x33be06[_0x5ba3('0x1e')]:_0x33ccd9['offset']+_0x33ccd9['limit'];var _0x44a43b;if(_0x519645>=_0x1a1da0){_0x519645=_0x1a1da0;_0x44a43b=0xc8;}else{_0x44a43b=0xce;}_0x9abfb0[_0x5ba3('0x19')](_0x44a43b);return _0x9abfb0[_0x5ba3('0x20')](_0x5ba3('0x21'),_0x9e9344+'-'+_0x519645+'/'+_0x1a1da0)[_0x5ba3('0x1b')](_0x33be06);}return null;};}function patchUpdates(_0x5781e3){return function(_0x25fb4a){try{jsonpatch[_0x5ba3('0x22')](_0x25fb4a,_0x5781e3,!![]);}catch(_0x58fceb){return BPromise[_0x5ba3('0x23')](_0x58fceb);}return _0x25fb4a[_0x5ba3('0x24')]();};}function saveUpdates(_0x134ccb,_0xe2f84){return function(_0x420d1b){if(_0x420d1b){return _0x420d1b[_0x5ba3('0x25')](_0x134ccb)['then'](function(_0x34d05e){return _0x34d05e;});}return null;};}function removeEntity(_0x13cbd4,_0x4f97e5){return function(_0x137915){if(_0x137915){return _0x137915['destroy']()[_0x5ba3('0x26')](function(){_0x13cbd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb634,_0x525401){return function(_0x226ca1){if(!_0x226ca1){_0x3eb634[_0x5ba3('0x27')](0x194);}return _0x226ca1;};}function handleError(_0x16b0b7,_0x5b97ac){_0x5b97ac=_0x5b97ac||0x1f4;return function(_0x5df95e){logger[_0x5ba3('0x28')](_0x5df95e[_0x5ba3('0x29')]);if(_0x5df95e[_0x5ba3('0x2a')]){delete _0x5df95e['name'];}_0x16b0b7[_0x5ba3('0x19')](_0x5b97ac)[_0x5ba3('0x2b')](_0x5df95e);};}var utilLicense=require(_0x5ba3('0x17'));exports[_0x5ba3('0x2c')]=function(_0x3770ff,_0x56d89f){var _0x1450c1={'raw':!![],'where':{'id':0x1}},_0x78e12f={};_0x78e12f['model']=_[_0x5ba3('0x2d')](db['License']['rawAttributes']);_0x78e12f[_0x5ba3('0x2e')]=_['keys'](_0x3770ff[_0x5ba3('0x2e')]);_0x78e12f[_0x5ba3('0x2f')]=_[_0x5ba3('0x30')](_0x78e12f['model'],_0x78e12f[_0x5ba3('0x2e')]);_0x1450c1[_0x5ba3('0x31')]=_['intersection'](_0x78e12f[_0x5ba3('0x32')],qs[_0x5ba3('0x33')](_0x3770ff['query'][_0x5ba3('0x33')]));_0x1450c1['attributes']=_0x1450c1[_0x5ba3('0x31')][_0x5ba3('0x34')]?_0x1450c1[_0x5ba3('0x31')]:_0x78e12f[_0x5ba3('0x32')];_0x1450c1=_[_0x5ba3('0x35')]({},_0x1450c1,_0x3770ff['options']);return utilLicense[_0x5ba3('0x36')](_0x1450c1)['then'](respondWithResult(_0x56d89f,null))[_0x5ba3('0x37')](handleError(_0x56d89f,null));};exports[_0x5ba3('0x25')]=function(_0x260e87,_0x48e7cc){if(_0x260e87['body']['id']){delete _0x260e87[_0x5ba3('0x38')]['id'];}return db[_0x5ba3('0x39')]['find']({'where':{'id':_0x260e87[_0x5ba3('0x3a')]['id']}})[_0x5ba3('0x26')](handleEntityNotFound(_0x48e7cc,null))[_0x5ba3('0x26')](function(_0x2b6239){var _0x5e42ea=_0x2b6239[_0x5ba3('0x3b')]({'plain':!![]});return utilLicense[_0x5ba3('0x3c')](_0x5e42ea,_0x260e87[_0x5ba3('0x38')][_0x5ba3('0x3d')]);})['then'](function(_0x499995){if(!_0x499995[_0x5ba3('0x3e')]){return saveUpdates(_0x260e87[_0x5ba3('0x38')],null);}return _0x499995;})['then'](respondWithResult(_0x48e7cc,null))[_0x5ba3('0x37')](handleError(_0x48e7cc,null));};exports['downloadLogFile']=function(_0x3b7cc9,_0x45177c){var _0x573320=_0x5ba3('0x3f');var _0x332d52=path[_0x5ba3('0x40')](_0x5ba3('0x41'),_0x5ba3('0x42'),'xcally',_0x573320);_0x45177c[_0x5ba3('0x43')](_0x5ba3('0x44'),_0x5ba3('0x45')+_0x573320);_0x45177c[_0x5ba3('0x20')](_0x5ba3('0x46'),_0x5ba3('0x47'));_0x45177c[_0x5ba3('0x48')](_0x332d52);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e1a8b8a..5716eae 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 _0xdafd=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4f342c,_0x577efc){var _0x33121b=function(_0x2324fd){while(--_0x2324fd){_0x4f342c['push'](_0x4f342c['shift']());}};_0x33121b(++_0x577efc);}(_0xdafd,0xc6));var _0xddaf=function(_0xa5883b,_0x2004d4){_0xa5883b=_0xa5883b-0x0;var _0x1c729c=_0xdafd[_0xa5883b];return _0x1c729c;};'use strict';var _=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var logger=require(_0xddaf('0x2'))(_0xddaf('0x3'));var moment=require(_0xddaf('0x4'));var BPromise=require('bluebird');var rp=require(_0xddaf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xddaf('0x6'));var attributes=require(_0xddaf('0x7'));module[_0xddaf('0x8')]=function(_0x1b9296,_0x5e5a28){return _0x1b9296[_0xddaf('0x9')](_0xddaf('0xa'),attributes,{'tableName':_0xddaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a01=['api','request-promise','path','../../config/environment','./license.attributes','exports','define','License','license','lodash','util'];(function(_0x37d0d6,_0x12eafb){var _0x149e2e=function(_0x190aa9){while(--_0x190aa9){_0x37d0d6['push'](_0x37d0d6['shift']());}};_0x149e2e(++_0x12eafb);}(_0x6a01,0x132));var _0x16a0=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0x6a01[_0x33c090];return _0x4081df;};'use strict';var _=require(_0x16a0('0x0'));var util=require(_0x16a0('0x1'));var logger=require('../../config/logger')(_0x16a0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16a0('0x3'));var fs=require('fs');var path=require(_0x16a0('0x4'));var rimraf=require('rimraf');var config=require(_0x16a0('0x5'));var attributes=require(_0x16a0('0x6'));module[_0x16a0('0x7')]=function(_0x188f09,_0x704a57){return _0x188f09[_0x16a0('0x8')](_0x16a0('0x9'),attributes,{'tableName':_0x16a0('0xa'),'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 37cef81..ab78c99 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 _0x2c87=['info','request\x20sent','stringify','error','message','License,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x11e81b,_0x318bf6){var _0x4fa137=function(_0x51b86e){while(--_0x51b86e){_0x11e81b['push'](_0x11e81b['shift']());}};_0x4fa137(++_0x318bf6);}(_0x2c87,0x194));var _0x72c8=function(_0x119ce7,_0x25eb16){_0x119ce7=_0x119ce7-0x0;var _0x30fc4a=_0x2c87[_0x119ce7];return _0x30fc4a;};'use strict';var _=require(_0x72c8('0x0'));var util=require('util');var moment=require(_0x72c8('0x1'));var BPromise=require(_0x72c8('0x2'));var rs=require(_0x72c8('0x3'));var fs=require('fs');var Redis=require(_0x72c8('0x4'));var db=require(_0x72c8('0x5'))['db'];var utils=require(_0x72c8('0x6'));var logger=require(_0x72c8('0x7'))(_0x72c8('0x8'));var config=require(_0x72c8('0x9'));var jayson=require(_0x72c8('0xa'));var client=jayson[_0x72c8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dfcb9,_0x49adb2,_0xeb7ed7){return new BPromise(function(_0x431b58,_0x34f184){return client[_0x72c8('0xc')](_0x4dfcb9,_0xeb7ed7)[_0x72c8('0xd')](function(_0x2038bc){logger[_0x72c8('0xe')]('License,\x20%s,\x20%s',_0x49adb2,_0x72c8('0xf'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x49adb2,_0x72c8('0xf'),JSON[_0x72c8('0x10')](_0x2038bc));if(_0x2038bc[_0x72c8('0x11')]){if(_0x2038bc['error']['code']===0x1f4){logger[_0x72c8('0x11')]('License,\x20%s,\x20%s',_0x49adb2,_0x2038bc[_0x72c8('0x11')][_0x72c8('0x12')]);return _0x34f184(_0x2038bc[_0x72c8('0x11')][_0x72c8('0x12')]);}logger[_0x72c8('0x11')](_0x72c8('0x13'),_0x49adb2,_0x2038bc[_0x72c8('0x11')][_0x72c8('0x12')]);return _0x431b58(_0x2038bc[_0x72c8('0x11')][_0x72c8('0x12')]);}else{logger[_0x72c8('0xe')](_0x72c8('0x13'),_0x49adb2,'request\x20sent');_0x431b58(_0x2038bc[_0x72c8('0x14')][_0x72c8('0x12')]);}})[_0x72c8('0x15')](function(_0x5e1801){logger[_0x72c8('0x11')](_0x72c8('0x13'),_0x49adb2,_0x5e1801);_0x34f184(_0x5e1801);});});} \ No newline at end of file +var _0xe48e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x541120,_0x4b85aa){var _0x3b9724=function(_0x3d432b){while(--_0x3d432b){_0x541120['push'](_0x541120['shift']());}};_0x3b9724(++_0x4b85aa);}(_0xe48e,0x128));var _0xee48=function(_0xe4467f,_0x5305c6){_0xe4467f=_0xe4467f-0x0;var _0x361832=_0xe48e[_0xe4467f];return _0x361832;};'use strict';var _=require(_0xee48('0x0'));var util=require(_0xee48('0x1'));var moment=require(_0xee48('0x2'));var BPromise=require(_0xee48('0x3'));var rs=require(_0xee48('0x4'));var fs=require('fs');var Redis=require(_0xee48('0x5'));var db=require(_0xee48('0x6'))['db'];var utils=require(_0xee48('0x7'));var logger=require(_0xee48('0x8'))(_0xee48('0x9'));var config=require(_0xee48('0xa'));var jayson=require(_0xee48('0xb'));var client=jayson[_0xee48('0xc')][_0xee48('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345777,_0x10ec31,_0x273a44){return new BPromise(function(_0x52bb18,_0x52d313){return client[_0xee48('0xe')](_0x345777,_0x273a44)['then'](function(_0x128815){logger['info'](_0xee48('0xf'),_0x10ec31,_0xee48('0x10'));logger[_0xee48('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x10ec31,_0xee48('0x10'),JSON[_0xee48('0x12')](_0x128815));if(_0x128815[_0xee48('0x13')]){if(_0x128815[_0xee48('0x13')][_0xee48('0x14')]===0x1f4){logger[_0xee48('0x13')](_0xee48('0xf'),_0x10ec31,_0x128815[_0xee48('0x13')]['message']);return _0x52d313(_0x128815[_0xee48('0x13')]['message']);}logger[_0xee48('0x13')](_0xee48('0xf'),_0x10ec31,_0x128815[_0xee48('0x13')][_0xee48('0x15')]);return _0x52bb18(_0x128815[_0xee48('0x13')][_0xee48('0x15')]);}else{logger[_0xee48('0x16')]('License,\x20%s,\x20%s',_0x10ec31,'request\x20sent');_0x52bb18(_0x128815[_0xee48('0x17')][_0xee48('0x15')]);}})[_0xee48('0x18')](function(_0x21dedb){logger['error'](_0xee48('0xf'),_0x10ec31,_0x21dedb);_0x52d313(_0x21dedb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c83fc34..0ae175e 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 _0x94ea=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','create','/:id/in_servers','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','util','path'];(function(_0x31040e,_0x40daa2){var _0x49bd76=function(_0xa0e8a8){while(--_0xa0e8a8){_0x31040e['push'](_0x31040e['shift']());}};_0x49bd76(++_0x40daa2);}(_0x94ea,0x87));var _0xa94e=function(_0xf87b7c,_0x32e519){_0xf87b7c=_0xf87b7c-0x0;var _0x17e2b2=_0x94ea[_0xf87b7c];return _0x17e2b2;};'use strict';var multer=require(_0xa94e('0x0'));var util=require(_0xa94e('0x1'));var path=require(_0xa94e('0x2'));var timeout=require(_0xa94e('0x3'));var express=require('express');var router=express[_0xa94e('0x4')]();var fs_extra=require(_0xa94e('0x5'));var auth=require(_0xa94e('0x6'));var interaction=require(_0xa94e('0x7'));var config=require('../../config/environment');var controller=require(_0xa94e('0x8'));router['get']('/',auth[_0xa94e('0x9')](),controller[_0xa94e('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa94e('0xb')]);router['get'](_0xa94e('0xc'),auth[_0xa94e('0x9')](),controller[_0xa94e('0xd')]);router[_0xa94e('0xe')](_0xa94e('0xf'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x10')]);router['get'](_0xa94e('0x11'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x12')]);router['get']('/:id/in_servers',auth[_0xa94e('0x9')](),controller[_0xa94e('0x13')]);router['get'](_0xa94e('0x14'),auth['isAuthenticated'](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0xa94e('0x9')](),controller[_0xa94e('0x15')]);router['get'](_0xa94e('0x16'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x17')]);router['get'](_0xa94e('0x18'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x19')]);router['get'](_0xa94e('0x1a'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x1b')]);router[_0xa94e('0xe')](_0xa94e('0x1c'),auth[_0xa94e('0x9')](),controller['getAgents']);router['post'](_0xa94e('0xf'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x1d')]);router[_0xa94e('0x1e')](_0xa94e('0x11'),auth[_0xa94e('0x9')](),controller['addAnswer']);router['post']('/',auth[_0xa94e('0x9')](),controller[_0xa94e('0x1f')]);router[_0xa94e('0x1e')](_0xa94e('0x20'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x21')]);router[_0xa94e('0x1e')](_0xa94e('0x14'),auth[_0xa94e('0x9')](),controller['addSmtp']);router[_0xa94e('0x1e')](_0xa94e('0x22'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x23')]);router[_0xa94e('0x1e')](_0xa94e('0x16'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x24')]);router[_0xa94e('0x1e')](_0xa94e('0x25'),auth['isAuthenticated'](),controller['send']);router[_0xa94e('0x1e')]('/:id/users',auth[_0xa94e('0x9')](),controller['addAgents']);router[_0xa94e('0x26')]('/:id',auth['isAuthenticated'](),controller[_0xa94e('0x27')]);router[_0xa94e('0x28')]('/:id/dispositions',auth[_0xa94e('0x9')](),controller[_0xa94e('0x29')]);router[_0xa94e('0x28')](_0xa94e('0x11'),auth['isAuthenticated'](),controller[_0xa94e('0x2a')]);router['delete'](_0xa94e('0x20'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x2b')]);router[_0xa94e('0x28')](_0xa94e('0x14'),auth[_0xa94e('0x9')](),controller[_0xa94e('0x2c')]);router[_0xa94e('0x28')](_0xa94e('0xc'),auth[_0xa94e('0x9')](),controller['destroy']);router['delete'](_0xa94e('0x1c'),auth[_0xa94e('0x9')](),controller['removeAgents']);module[_0xa94e('0x2d')]=router; \ No newline at end of file +var _0x92b0=['/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','/:id/dispositions','addDisposition','addAnswer','create','post','addImap','addSmtp','addInteraction','addApplications','send','put','update','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers'];(function(_0x1f1138,_0x4c34d9){var _0x19ed60=function(_0x4b270d){while(--_0x4b270d){_0x1f1138['push'](_0x1f1138['shift']());}};_0x19ed60(++_0x4c34d9);}(_0x92b0,0x103));var _0x092b=function(_0x3f4654,_0x22796d){_0x3f4654=_0x3f4654-0x0;var _0x6114b5=_0x92b0[_0x3f4654];return _0x6114b5;};'use strict';var multer=require(_0x092b('0x0'));var util=require(_0x092b('0x1'));var path=require(_0x092b('0x2'));var timeout=require(_0x092b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x092b('0x4'));var auth=require(_0x092b('0x5'));var interaction=require(_0x092b('0x6'));var config=require(_0x092b('0x7'));var controller=require(_0x092b('0x8'));router[_0x092b('0x9')]('/',auth[_0x092b('0xa')](),controller[_0x092b('0xb')]);router[_0x092b('0x9')](_0x092b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x092b('0x9')](_0x092b('0xd'),auth[_0x092b('0xa')](),controller[_0x092b('0xe')]);router['get']('/:id/dispositions',auth[_0x092b('0xa')](),controller['getDispositions']);router['get'](_0x092b('0xf'),auth[_0x092b('0xa')](),controller[_0x092b('0x10')]);router[_0x092b('0x9')](_0x092b('0x11'),auth[_0x092b('0xa')](),controller[_0x092b('0x12')]);router[_0x092b('0x9')](_0x092b('0x13'),auth[_0x092b('0xa')](),controller[_0x092b('0x14')]);router[_0x092b('0x9')](_0x092b('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x092b('0x9')](_0x092b('0x16'),auth[_0x092b('0xa')](),controller['getApplications']);router[_0x092b('0x9')](_0x092b('0x17'),auth[_0x092b('0xa')](),controller[_0x092b('0x18')]);router['get'](_0x092b('0x19'),auth[_0x092b('0xa')](),controller['verifySmtp']);router[_0x092b('0x9')](_0x092b('0x1a'),auth[_0x092b('0xa')](),controller[_0x092b('0x1b')]);router['post'](_0x092b('0x1c'),auth[_0x092b('0xa')](),controller[_0x092b('0x1d')]);router['post'](_0x092b('0xf'),auth[_0x092b('0xa')](),controller[_0x092b('0x1e')]);router['post']('/',auth[_0x092b('0xa')](),controller[_0x092b('0x1f')]);router[_0x092b('0x20')](_0x092b('0x11'),auth[_0x092b('0xa')](),controller[_0x092b('0x21')]);router['post'](_0x092b('0x13'),auth[_0x092b('0xa')](),controller[_0x092b('0x22')]);router[_0x092b('0x20')](_0x092b('0x15'),auth['isAuthenticated'](),controller[_0x092b('0x23')]);router[_0x092b('0x20')](_0x092b('0x16'),auth[_0x092b('0xa')](),controller[_0x092b('0x24')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x092b('0x25')]);router[_0x092b('0x20')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x092b('0x26')]('/:id',auth[_0x092b('0xa')](),controller[_0x092b('0x27')]);router[_0x092b('0x28')](_0x092b('0x1c'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x092b('0x28')](_0x092b('0xf'),auth[_0x092b('0xa')](),controller[_0x092b('0x29')]);router['delete'](_0x092b('0x11'),auth[_0x092b('0xa')](),controller['removeImap']);router['delete'](_0x092b('0x13'),auth[_0x092b('0xa')](),controller[_0x092b('0x2a')]);router[_0x092b('0x28')](_0x092b('0xd'),auth[_0x092b('0xa')](),controller[_0x092b('0x2b')]);router[_0x092b('0x28')](_0x092b('0x1a'),auth['isAuthenticated'](),controller[_0x092b('0x2c')]);module[_0x092b('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a497aab..389885f 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 _0xab6f=['TEXT','Arial,Helvetica,sans-serif','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x229dc9,_0x2e7ed6){var _0x3a78cc=function(_0x4e6a20){while(--_0x4e6a20){_0x229dc9['push'](_0x229dc9['shift']());}};_0x3a78cc(++_0x2e7ed6);}(_0xab6f,0x18b));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfab6('0x0'));module[_0xfab6('0x1')]={'description':{'type':Sequelize[_0xfab6('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xfab6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfab6('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xfab6('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfab6('0x2')],'allowNull':![],'defaultValue':_0xfab6('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfab6('0x4')],'defaultValue':function(){return _0xfab6('0x6');}},'notificationSound':{'type':Sequelize[_0xfab6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfab6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfab6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfab6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xfab6('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xfab6('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x32a768){if(!_0x32a768)this[_0xfab6('0x9')](_0xfab6('0xa'),null);this['setDataValue'](_0xfab6('0xb'),_0x32a768);}},'provider':{'type':Sequelize[_0xfab6('0xc')](_0xfab6('0xd'),_0xfab6('0xe'),_0xfab6('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xfab6('0x10')](_0xfab6('0x11')))return _0xfab6('0x12');return this[_0xfab6('0x10')](_0xfab6('0x11'));},'set':function(_0x54aa69){if(_0x54aa69===_0xfab6('0x12'))_0x54aa69=null;return this['setDataValue'](_0xfab6('0x11'),_0x54aa69);}}}; \ No newline at end of file +var _0x0d7f=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING'];(function(_0x20c835,_0x2da0a0){var _0xf25262=function(_0xe79c63){while(--_0xe79c63){_0x20c835['push'](_0x20c835['shift']());}};_0xf25262(++_0x2da0a0);}(_0x0d7f,0x1b2));var _0xf0d7=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x0d7f[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xf0d7('0x0'));module[_0xf0d7('0x1')]={'description':{'type':Sequelize[_0xf0d7('0x2')]},'name':{'type':Sequelize[_0xf0d7('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf0d7('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xf0d7('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xf0d7('0x4')]},'markAsUnread':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf0d7('0x5')},'fontSize':{'type':Sequelize[_0xf0d7('0x6')](0x2)[_0xf0d7('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xf0d7('0x4')],'defaultValue':function(){return _0xf0d7('0x8');}},'notificationSound':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf0d7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0d7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0d7('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf0d7('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf0d7('0x3')],'defaultValue':![],'comment':_0xf0d7('0xa'),'set':function(_0x47cd73){if(!_0x47cd73)this[_0xf0d7('0xb')](_0xf0d7('0xc'),null);this[_0xf0d7('0xb')](_0xf0d7('0xd'),_0x47cd73);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xf0d7('0xe'),'yahoo',_0xf0d7('0xf')),'defaultValue':null,'get':function(){if(!this[_0xf0d7('0x10')](_0xf0d7('0x11')))return _0xf0d7('0x12');return this['getDataValue'](_0xf0d7('0x11'));},'set':function(_0x3c2008){if(_0x3c2008==='custom')_0x3c2008=null;return this[_0xf0d7('0xb')](_0xf0d7('0x11'),_0x3c2008);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 149a1ed..401bbd5 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 _0x3b81=['bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','update','destroy','get','UserProfileResource','end','name','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','yahoo','user','username','password','pass','modernAuthentication','CloudProviderId','port','service','authentication','host','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','map','MailAccount','includeAll','include','rows','params','MailServerIn','length','options','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findAll','removeDispositions','addAnswer','findOne','CannedAnswer','nolimit','removeAnswers','ids','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','stack','send','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b81,0x183));var _0x13b8=function(_0xb1105c,_0x4e5b97){_0xb1105c=_0xb1105c-0x0;var _0x67a7e3=_0x3b81[_0xb1105c];return _0x67a7e3;};'use strict';var moment=require(_0x13b8('0x0'));var BPromise=require(_0x13b8('0x1'));var util=require(_0x13b8('0x2'));var path=require(_0x13b8('0x3'));var _=require(_0x13b8('0x4'));var juice=require('juice');var Redis=require(_0x13b8('0x5'));var qs=require(_0x13b8('0x6'));var logger=require(_0x13b8('0x7'))('api');var config=require(_0x13b8('0x8'));var db=require(_0x13b8('0x9'))['db'];config['redis']=_[_0x13b8('0xa')](config[_0x13b8('0xb')],{'host':_0x13b8('0xc'),'port':0x18eb});var socket=require(_0x13b8('0xd'))(new Redis(config[_0x13b8('0xb')]));require(_0x13b8('0xe'))[_0x13b8('0xf')](socket);var jayson=require(_0x13b8('0x10'));var client=jayson[_0x13b8('0x11')][_0x13b8('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x39e4d8,_0x4fae91,_0x23ade9,_0x48e45a){return new BPromise(function(_0x52c543,_0xe3b3ab){var _0x380f60=_0x48e45a||client;return _0x380f60['request'](_0x39e4d8,_0x23ade9)[_0x13b8('0x13')](function(_0x780a15){logger[_0x13b8('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fae91,_0x13b8('0x15'));logger['debug'](_0x13b8('0x16'),_0x4fae91,_0x13b8('0x15'),JSON['stringify'](_0x780a15));if(_0x780a15[_0x13b8('0x17')]){if(_0x780a15[_0x13b8('0x17')][_0x13b8('0x18')]===0x1f4){logger[_0x13b8('0x17')](_0x13b8('0x19'),_0x4fae91,_0x780a15[_0x13b8('0x17')][_0x13b8('0x1a')]);return _0xe3b3ab(_0x780a15[_0x13b8('0x17')][_0x13b8('0x1a')]);}logger[_0x13b8('0x17')](_0x13b8('0x19'),_0x4fae91,_0x780a15['error'][_0x13b8('0x1a')]);return _0x52c543(_0x780a15[_0x13b8('0x17')][_0x13b8('0x1a')]);}else{logger[_0x13b8('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fae91,_0x13b8('0x15'));_0x52c543(_0x780a15[_0x13b8('0x1b')][_0x13b8('0x1a')]);}})[_0x13b8('0x1c')](function(_0x179fcb){logger['error']('MailAccount,\x20%s,\x20%s',_0x4fae91,_0x179fcb);_0xe3b3ab(_0x179fcb);});});}function respondWithStatusCode(_0x536917,_0x4d6a56){_0x4d6a56=_0x4d6a56||0xcc;return function(_0xded3fc){if(_0xded3fc){return _0x536917[_0x13b8('0x1d')](_0x4d6a56);}return _0x536917['status'](_0x4d6a56)['end']();};}function respondWithResult(_0x352dcd,_0x195156){_0x195156=_0x195156||0xc8;return function(_0x4f0c27){if(_0x4f0c27){return _0x352dcd[_0x13b8('0x1e')](_0x195156)[_0x13b8('0x1f')](_0x4f0c27);}};}function respondWithFilteredResult(_0x475307,_0x4574b3){return function(_0x1559ab){if(_0x1559ab){var _0x50bd9d=typeof _0x4574b3[_0x13b8('0x20')]===_0x13b8('0x21')&&typeof _0x4574b3[_0x13b8('0x22')]===_0x13b8('0x21');var _0x97b9ac=_0x1559ab[_0x13b8('0x23')];var _0x3e016a=_0x50bd9d?0x0:_0x4574b3['offset'];var _0x379c2c=_0x50bd9d?_0x1559ab['count']:_0x4574b3[_0x13b8('0x20')]+_0x4574b3['limit'];var _0x1c2f5f;if(_0x379c2c>=_0x97b9ac){_0x379c2c=_0x97b9ac;_0x1c2f5f=0xc8;}else{_0x1c2f5f=0xce;}_0x475307[_0x13b8('0x1e')](_0x1c2f5f);return _0x475307['set']('Content-Range',_0x3e016a+'-'+_0x379c2c+'/'+_0x97b9ac)['json'](_0x1559ab);}return null;};}function saveUpdates(_0x27734b){return function(_0x478ac2){if(_0x478ac2){return _0x478ac2[_0x13b8('0x24')](_0x27734b)[_0x13b8('0x13')](function(_0x2e1b48){return _0x2e1b48;});}return null;};}function removeEntity(_0x23c45d){return function(_0x13d8fa){if(_0x13d8fa){return _0x13d8fa[_0x13b8('0x25')]()[_0x13b8('0x13')](function(){var _0x3796f8=_0x13d8fa[_0x13b8('0x26')]({'plain':!![]});var _0x2b8fb2='MailAccounts';return db[_0x13b8('0x27')]['destroy']({'where':{'type':_0x2b8fb2,'resourceId':_0x3796f8['id']}})['then'](function(){return _0x13d8fa;});})['then'](function(){_0x23c45d[_0x13b8('0x1e')](0xcc)[_0x13b8('0x28')]();});}};}function handleEntityNotFound(_0x50617f){return function(_0x293a9d){if(!_0x293a9d){_0x50617f[_0x13b8('0x1d')](0x194);}return _0x293a9d;};}function handleError(_0x1abcc7,_0x18d235){_0x18d235=_0x18d235||0x1f4;return function(_0x4b87c6){logger[_0x13b8('0x17')](_0x4b87c6['stack']);if(_0x4b87c6[_0x13b8('0x29')]){delete _0x4b87c6[_0x13b8('0x29')];}_0x1abcc7[_0x13b8('0x1e')](_0x18d235)['send'](_0x4b87c6);};}function getImapHost(_0x1f0e90){switch(_0x1f0e90){case'gmail':return _0x13b8('0x2a');case'yahoo':return _0x13b8('0x2b');case'hotmail':return _0x13b8('0x2c');case _0x13b8('0x2d'):return _0x13b8('0x2e');}throw new Error(_0x13b8('0x2f'),_0x1f0e90);}function getSmtpHost(_0x373a41){switch(_0x373a41){case _0x13b8('0x30'):return _0x13b8('0x31');case _0x13b8('0x32'):return'smtp.mail.yahoo.com';case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x13b8('0x2f'),_0x373a41);}function getAuthenticationOptions(_0x5dd3a5,_0x5b30ac){var _0x3b69a4={};var _0x4371ff={};if(_0x5dd3a5){_0x3b69a4[_0x13b8('0x33')]=_0x4371ff[_0x13b8('0x33')]=_0x5b30ac[_0x13b8('0x34')];_0x3b69a4[_0x13b8('0x35')]=_0x4371ff[_0x13b8('0x36')]=_0x5b30ac[_0x13b8('0x35')];if(_0x5b30ac[_0x13b8('0x37')]){_0x3b69a4[_0x13b8('0x37')]=_0x4371ff[_0x13b8('0x37')]=!![];_0x3b69a4[_0x13b8('0x38')]=_0x4371ff[_0x13b8('0x38')]=_0x5b30ac['CloudProviderId'];_0x3b69a4[_0x13b8('0x35')]=_0x4371ff[_0x13b8('0x36')]=null;}else{_0x3b69a4['CloudProviderId']=_0x4371ff[_0x13b8('0x38')]=null;}_0x3b69a4['host']=getImapHost(_0x5dd3a5);_0x3b69a4['port']=0x3e1;_0x4371ff['host']=getSmtpHost(_0x5dd3a5);_0x4371ff[_0x13b8('0x39')]=0x24b;_0x4371ff['secure']=![];_0x3b69a4[_0x13b8('0x3a')]=_0x4371ff[_0x13b8('0x3a')]=null;}else{if(_0x5b30ac[_0x13b8('0x3b')]){_0x3b69a4[_0x13b8('0x33')]=_0x4371ff[_0x13b8('0x33')]=_0x5b30ac[_0x13b8('0x34')];_0x3b69a4[_0x13b8('0x35')]=_0x4371ff[_0x13b8('0x36')]=_0x5b30ac[_0x13b8('0x35')];}else{_0x3b69a4[_0x13b8('0x3b')]=_0x4371ff[_0x13b8('0x3b')]=![];_0x3b69a4[_0x13b8('0x33')]=_0x4371ff['user']=null;_0x3b69a4[_0x13b8('0x35')]=_0x4371ff[_0x13b8('0x36')]=null;}_0x3b69a4[_0x13b8('0x3c')]=_0x5b30ac[_0x13b8('0x3d')][_0x13b8('0x3c')];_0x3b69a4[_0x13b8('0x39')]=_0x5b30ac[_0x13b8('0x3d')][_0x13b8('0x39')];_0x4371ff[_0x13b8('0x3c')]=_0x5b30ac[_0x13b8('0x3e')][_0x13b8('0x3c')];_0x4371ff[_0x13b8('0x39')]=_0x5b30ac['Smtp'][_0x13b8('0x39')];}return{'Imap':_0x3b69a4,'Smtp':_0x4371ff};}exports[_0x13b8('0x3f')]=function(_0x48a5ec,_0x4cc15e){var _0x429b08={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x13b8('0x40')],'as':'Smtp'},{'model':db[_0x13b8('0x41')],'as':_0x13b8('0x42')}]},_0x33edd4={},_0x36ff5a={'count':0x0,'rows':[]};var _0x139b1e=_['map'](db['MailAccount'][_0x13b8('0x43')],function(_0x231655){return{'name':_0x231655[_0x13b8('0x44')],'type':_0x231655[_0x13b8('0x45')][_0x13b8('0x46')]};});_0x33edd4[_0x13b8('0x47')]=_['map'](_0x139b1e,_0x13b8('0x29'));_0x33edd4[_0x13b8('0x48')]=_[_0x13b8('0x49')](_0x48a5ec[_0x13b8('0x48')]);_0x33edd4[_0x13b8('0x4a')]=_['intersection'](_0x33edd4[_0x13b8('0x47')],_0x33edd4['query']);_0x429b08['attributes']=_[_0x13b8('0x4b')](_0x33edd4['model'],qs[_0x13b8('0x4c')](_0x48a5ec[_0x13b8('0x48')]['fields']));_0x429b08[_0x13b8('0x4d')]=_0x429b08['attributes']['length']?_0x429b08[_0x13b8('0x4d')]:_0x33edd4[_0x13b8('0x47')];if(!_0x48a5ec[_0x13b8('0x48')][_0x13b8('0x4e')]('nolimit')){_0x429b08[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x48a5ec[_0x13b8('0x48')][_0x13b8('0x22')]);_0x429b08[_0x13b8('0x20')]=qs['offset'](_0x48a5ec[_0x13b8('0x48')]['offset']);}_0x429b08[_0x13b8('0x4f')]=qs['sort'](_0x48a5ec[_0x13b8('0x48')][_0x13b8('0x50')]);_0x429b08[_0x13b8('0x51')]=qs['filters'](_[_0x13b8('0x52')](_0x48a5ec['query'],_0x33edd4[_0x13b8('0x4a')]),_0x139b1e);if(_0x48a5ec['query'][_0x13b8('0x53')]){_0x429b08[_0x13b8('0x51')]=_[_0x13b8('0x54')](_0x429b08[_0x13b8('0x51')],{'$or':_[_0x13b8('0x55')](_0x139b1e,function(_0x291e57){if(_0x291e57['type']!=='VIRTUAL'){var _0x5d4fed={};_0x5d4fed[_0x291e57[_0x13b8('0x29')]]={'$like':'%'+_0x48a5ec[_0x13b8('0x48')]['filter']+'%'};return _0x5d4fed;}})});}_0x429b08=_[_0x13b8('0x54')]({},_0x429b08,_0x48a5ec['options']);var _0x3c217b={'where':_0x429b08[_0x13b8('0x51')]};return db[_0x13b8('0x56')][_0x13b8('0x23')](_0x3c217b)[_0x13b8('0x13')](function(_0x12e48f){_0x36ff5a[_0x13b8('0x23')]=_0x12e48f;if(_0x48a5ec['query'][_0x13b8('0x57')]){_0x429b08[_0x13b8('0x58')]=[{'all':!![]}];}return db[_0x13b8('0x56')]['findAll'](_0x429b08);})[_0x13b8('0x13')](function(_0x2d1ada){_0x36ff5a[_0x13b8('0x59')]=_0x2d1ada;return _0x36ff5a;})[_0x13b8('0x13')](respondWithFilteredResult(_0x4cc15e,_0x429b08))[_0x13b8('0x1c')](handleError(_0x4cc15e,null));};exports['show']=function(_0x442f73,_0x4999a3){var _0x4c3006={'raw':![],'where':{'id':_0x442f73[_0x13b8('0x5a')]['id']},'include':[{'model':db[_0x13b8('0x5b')],'as':_0x13b8('0x3d')},{'model':db[_0x13b8('0x40')],'as':_0x13b8('0x3e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2a71a4={};_0x2a71a4[_0x13b8('0x47')]=_[_0x13b8('0x49')](db[_0x13b8('0x56')][_0x13b8('0x43')]);_0x2a71a4['query']=_[_0x13b8('0x49')](_0x442f73[_0x13b8('0x48')]);_0x2a71a4[_0x13b8('0x4a')]=_[_0x13b8('0x4b')](_0x2a71a4['model'],_0x2a71a4[_0x13b8('0x48')]);_0x4c3006[_0x13b8('0x4d')]=_[_0x13b8('0x4b')](_0x2a71a4[_0x13b8('0x47')],qs[_0x13b8('0x4c')](_0x442f73['query']['fields']));_0x4c3006['attributes']=_0x4c3006[_0x13b8('0x4d')][_0x13b8('0x5c')]?_0x4c3006[_0x13b8('0x4d')]:_0x2a71a4[_0x13b8('0x47')];if(_0x442f73[_0x13b8('0x48')]['includeAll']){_0x4c3006[_0x13b8('0x58')]=[{'all':!![]}];}_0x4c3006=_[_0x13b8('0x54')]({},_0x4c3006,_0x442f73[_0x13b8('0x5d')]);return db['MailAccount'][_0x13b8('0x5e')](_0x4c3006)[_0x13b8('0x13')](handleEntityNotFound(_0x4999a3,null))[_0x13b8('0x13')](respondWithResult(_0x4999a3,null))[_0x13b8('0x1c')](handleError(_0x4999a3,null));};exports[_0x13b8('0x24')]=function(_0x2bb745,_0x227226){if(_0x2bb745[_0x13b8('0x5f')]['id']){delete _0x2bb745[_0x13b8('0x5f')]['id'];}var _0x2382bf=_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x60')]===_0x13b8('0x61')?null:_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x60')];var _0x2a462e=_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3d')]||{};var _0x3db4fd=_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3e')]||{};if(_0x2382bf){_0x2a462e[_0x13b8('0x3c')]=getImapHost(_0x2382bf);_0x2a462e[_0x13b8('0x39')]=0x3e1;_0x3db4fd[_0x13b8('0x3c')]=getSmtpHost(_0x2382bf);_0x3db4fd[_0x13b8('0x39')]=0x24b;_0x3db4fd[_0x13b8('0x62')]=![];}if(_0x3db4fd[_0x13b8('0x37')]){_0x3db4fd['secure']=![];}else{_0x3db4fd[_0x13b8('0x38')]=null;}if(!_0x2a462e[_0x13b8('0x37')])_0x2a462e['CloudProviderId']=null;_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3d')]=_0x2a462e;_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3e')]=_0x3db4fd;return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0x2bb745[_0x13b8('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x13b8('0x40')],'as':_0x13b8('0x3e')},{'model':db['Pause'],'as':_0x13b8('0x42')}]})[_0x13b8('0x13')](handleEntityNotFound(_0x227226,null))[_0x13b8('0x13')](function(_0x232c3e){if(!_0x232c3e)throw new Error(_0x13b8('0x63'));if(_0x232c3e[_0x13b8('0x3a')])delete _0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3d')];return _0x232c3e;})[_0x13b8('0x13')](saveUpdates(_0x2bb745[_0x13b8('0x5f')],null))[_0x13b8('0x13')](function(_0x358bb3){if(!_0x2bb745[_0x13b8('0x5f')]['Imap'])return _0x358bb3;return db['MailServerIn'][_0x13b8('0x24')](_0x2bb745[_0x13b8('0x5f')][_0x13b8('0x3d')],{'where':{'MailAccountId':_0x358bb3['id']}})[_0x13b8('0x13')](function(){return _0x358bb3;});})[_0x13b8('0x13')](function(_0x4122f5){if(!_0x2bb745['body'][_0x13b8('0x3e')])return _0x4122f5;return db[_0x13b8('0x40')][_0x13b8('0x24')](_0x2bb745[_0x13b8('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x4122f5['id']}})[_0x13b8('0x13')](function(){return _0x4122f5;});})[_0x13b8('0x13')](respondWithResult(_0x227226,null))[_0x13b8('0x1c')](handleError(_0x227226,null));};exports['describe']=function(_0x68e0cd,_0x2709b1){return db[_0x13b8('0x56')][_0x13b8('0x64')]()[_0x13b8('0x13')](respondWithResult(_0x2709b1,null))[_0x13b8('0x1c')](handleError(_0x2709b1,null));};exports[_0x13b8('0x65')]=function(_0x548ba6,_0x440913){if(_0x548ba6[_0x13b8('0x5f')]['id']){delete _0x548ba6[_0x13b8('0x5f')]['id'];}return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0x548ba6['params']['id']}})['then'](handleEntityNotFound(_0x440913,null))[_0x13b8('0x13')](function(_0x54d89f){if(_0x54d89f){_0x548ba6['body'][_0x13b8('0x66')]=_0x54d89f['id'];return db[_0x13b8('0x67')][_0x13b8('0x68')](_0x548ba6[_0x13b8('0x5f')]);}})[_0x13b8('0x13')](respondWithResult(_0x440913,null))[_0x13b8('0x1c')](handleError(_0x440913,null));};exports[_0x13b8('0x69')]=function(_0x51ba92,_0x1646e2){var _0x1f070={'raw':![],'where':{}};var _0xb0d9f7={};var _0xef8fb1={'count':0x0,'rows':[]};return db[_0x13b8('0x56')]['findOne']({'where':{'id':_0x51ba92['params']['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x1646e2,null))[_0x13b8('0x13')](function(_0x301e84){if(_0x301e84){_0xb0d9f7['model']=_[_0x13b8('0x49')](db[_0x13b8('0x67')]['rawAttributes']);_0xb0d9f7[_0x13b8('0x48')]=_[_0x13b8('0x49')](_0x51ba92['query']);_0xb0d9f7[_0x13b8('0x4a')]=_[_0x13b8('0x4b')](_0xb0d9f7[_0x13b8('0x47')],_0xb0d9f7[_0x13b8('0x48')]);_0x1f070['attributes']=_[_0x13b8('0x4b')](_0xb0d9f7['model'],qs[_0x13b8('0x4c')](_0x51ba92['query'][_0x13b8('0x4c')]));_0x1f070[_0x13b8('0x4d')]=_0x1f070[_0x13b8('0x4d')]['length']?_0x1f070['attributes']:_0xb0d9f7['model'];if(!_0x51ba92['query'][_0x13b8('0x4e')]('nolimit')){_0x1f070[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x51ba92[_0x13b8('0x48')][_0x13b8('0x22')]);_0x1f070[_0x13b8('0x20')]=qs[_0x13b8('0x20')](_0x51ba92['query'][_0x13b8('0x20')]);}_0x1f070[_0x13b8('0x4f')]=qs['sort'](_0x51ba92[_0x13b8('0x48')][_0x13b8('0x50')]);_0x1f070[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x51ba92[_0x13b8('0x48')],_0xb0d9f7['filters']));_0x1f070[_0x13b8('0x51')][_0x13b8('0x66')]=_0x301e84['id'];if(_0x51ba92[_0x13b8('0x48')]['filter']){_0x1f070[_0x13b8('0x51')]=_[_0x13b8('0x54')](_0x1f070['where'],{'$or':_[_0x13b8('0x55')](_0x1f070['attributes'],function(_0x282f14){var _0x16efe1={};_0x16efe1[_0x282f14]={'$like':'%'+_0x51ba92[_0x13b8('0x48')][_0x13b8('0x53')]+'%'};return _0x16efe1;})});}_0x1f070=_[_0x13b8('0x54')]({},_0x1f070,_0x51ba92[_0x13b8('0x5d')]);return db[_0x13b8('0x67')][_0x13b8('0x23')]({'where':_0x1f070[_0x13b8('0x51')]})[_0x13b8('0x13')](function(_0x52ddf5){_0xef8fb1['count']=_0x52ddf5;if(_0x51ba92[_0x13b8('0x48')][_0x13b8('0x57')]){_0x1f070[_0x13b8('0x58')]=[{'all':!![]}];}return db[_0x13b8('0x67')][_0x13b8('0x6a')](_0x1f070);})[_0x13b8('0x13')](function(_0x569f28){_0xef8fb1[_0x13b8('0x59')]=_0x569f28;return _0xef8fb1;});}})[_0x13b8('0x13')](respondWithFilteredResult(_0x1646e2,_0x1f070))['catch'](handleError(_0x1646e2,null));};exports['removeDispositions']=function(_0x1e0030,_0x44eef0){return db[_0x13b8('0x56')][_0x13b8('0x5e')]({'where':{'id':_0x1e0030[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x44eef0,null))['then'](function(_0x275602){if(_0x275602){return _0x275602[_0x13b8('0x6b')](_0x1e0030[_0x13b8('0x48')]['ids']);}})[_0x13b8('0x13')](respondWithStatusCode(_0x44eef0,null))['catch'](handleError(_0x44eef0,null));};exports[_0x13b8('0x6c')]=function(_0x272056,_0x1617da){if(_0x272056['body']['id']){delete _0x272056[_0x13b8('0x5f')]['id'];}return db[_0x13b8('0x56')][_0x13b8('0x5e')]({'where':{'id':_0x272056[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x1617da,null))['then'](function(_0xe55c7e){if(_0xe55c7e){_0x272056['body']['MailAccountId']=_0xe55c7e['id'];return db['CannedAnswer'][_0x13b8('0x68')](_0x272056['body']);}})['then'](respondWithResult(_0x1617da,null))[_0x13b8('0x1c')](handleError(_0x1617da,null));};exports['getAnswers']=function(_0x50ab57,_0x56ebc9){var _0xd027be={'raw':![],'where':{}};var _0x40d49c={};var _0x542714={'count':0x0,'rows':[]};return db[_0x13b8('0x56')][_0x13b8('0x6d')]({'where':{'id':_0x50ab57[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x56ebc9,null))[_0x13b8('0x13')](function(_0x5618fe){if(_0x5618fe){_0x40d49c[_0x13b8('0x47')]=_['keys'](db[_0x13b8('0x6e')][_0x13b8('0x43')]);_0x40d49c[_0x13b8('0x48')]=_[_0x13b8('0x49')](_0x50ab57[_0x13b8('0x48')]);_0x40d49c['filters']=_['intersection'](_0x40d49c[_0x13b8('0x47')],_0x40d49c[_0x13b8('0x48')]);_0xd027be[_0x13b8('0x4d')]=_[_0x13b8('0x4b')](_0x40d49c['model'],qs['fields'](_0x50ab57[_0x13b8('0x48')][_0x13b8('0x4c')]));_0xd027be['attributes']=_0xd027be[_0x13b8('0x4d')][_0x13b8('0x5c')]?_0xd027be['attributes']:_0x40d49c[_0x13b8('0x47')];if(!_0x50ab57[_0x13b8('0x48')][_0x13b8('0x4e')](_0x13b8('0x6f'))){_0xd027be['limit']=qs[_0x13b8('0x22')](_0x50ab57[_0x13b8('0x48')][_0x13b8('0x22')]);_0xd027be[_0x13b8('0x20')]=qs[_0x13b8('0x20')](_0x50ab57['query'][_0x13b8('0x20')]);}_0xd027be[_0x13b8('0x4f')]=qs['sort'](_0x50ab57[_0x13b8('0x48')][_0x13b8('0x50')]);_0xd027be[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x50ab57['query'],_0x40d49c['filters']));_0xd027be['where'][_0x13b8('0x66')]=_0x5618fe['id'];if(_0x50ab57[_0x13b8('0x48')][_0x13b8('0x53')]){_0xd027be['where']=_['merge'](_0xd027be[_0x13b8('0x51')],{'$or':_[_0x13b8('0x55')](_0xd027be[_0x13b8('0x4d')],function(_0x5d9550){var _0x2e8b51={};_0x2e8b51[_0x5d9550]={'$like':'%'+_0x50ab57[_0x13b8('0x48')]['filter']+'%'};return _0x2e8b51;})});}_0xd027be=_[_0x13b8('0x54')]({},_0xd027be,_0x50ab57[_0x13b8('0x5d')]);return db[_0x13b8('0x6e')]['count']({'where':_0xd027be['where']})['then'](function(_0x13fb68){_0x542714[_0x13b8('0x23')]=_0x13fb68;if(_0x50ab57[_0x13b8('0x48')]['includeAll']){_0xd027be[_0x13b8('0x58')]=[{'all':!![]}];}return db[_0x13b8('0x6e')][_0x13b8('0x6a')](_0xd027be);})[_0x13b8('0x13')](function(_0x378a28){_0x542714['rows']=_0x378a28;return _0x542714;});}})[_0x13b8('0x13')](respondWithFilteredResult(_0x56ebc9,_0xd027be))[_0x13b8('0x1c')](handleError(_0x56ebc9,null));};exports[_0x13b8('0x70')]=function(_0x42a6ed,_0x324d14){return db[_0x13b8('0x56')][_0x13b8('0x5e')]({'where':{'id':_0x42a6ed[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x324d14,null))[_0x13b8('0x13')](function(_0x51509c){if(_0x51509c){return _0x51509c[_0x13b8('0x70')](_0x42a6ed[_0x13b8('0x48')][_0x13b8('0x71')]);}})[_0x13b8('0x13')](respondWithStatusCode(_0x324d14,null))['catch'](handleError(_0x324d14,null));};exports[_0x13b8('0x68')]=function(_0x61f8ae,_0x1b212e){var _0x370256={'name':_0x61f8ae[_0x13b8('0x5f')][_0x13b8('0x29')],'key':_0x61f8ae[_0x13b8('0x5f')][_0x13b8('0x46')],'provider':_0x61f8ae[_0x13b8('0x5f')]['provider']===_0x13b8('0x61')?null:_0x61f8ae['body']['provider'],'email':_0x61f8ae[_0x13b8('0x5f')][_0x13b8('0x72')],'ListId':_0x61f8ae[_0x13b8('0x5f')]['ListId'],'active':!_[_0x13b8('0x73')](_0x61f8ae[_0x13b8('0x5f')][_0x13b8('0x74')])?_0x61f8ae['body'][_0x13b8('0x74')]:!![],'description':_0x61f8ae[_0x13b8('0x5f')][_0x13b8('0x75')]||null};var _0x38fe4b=getAuthenticationOptions(_0x370256[_0x13b8('0x60')],_0x61f8ae['body']);_0x370256[_0x13b8('0x3d')]=_0x38fe4b['Imap'];_0x370256[_0x13b8('0x3e')]=_0x38fe4b[_0x13b8('0x3e')];return db[_0x13b8('0x56')][_0x13b8('0x68')](_0x370256,{'include':[{'model':db[_0x13b8('0x40')],'as':_0x13b8('0x3e')},{'model':db['MailServerIn'],'as':_0x13b8('0x3d')}]})[_0x13b8('0x13')](function(_0x182e6b){var _0x206539=_0x61f8ae[_0x13b8('0x33')][_0x13b8('0x26')]({'plain':!![]});if(!_0x206539)throw new Error(_0x13b8('0x76'));if(_0x206539[_0x13b8('0x77')]===_0x13b8('0x33')){var _0xfee022=_0x182e6b[_0x13b8('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x13b8('0x5e')]({'where':{'name':_0x13b8('0x78'),'userProfileId':_0x206539['userProfileId']},'raw':!![]})['then'](function(_0x4d1e09){if(_0x4d1e09&&_0x4d1e09[_0x13b8('0x79')]===0x0){return db['UserProfileResource'][_0x13b8('0x68')]({'name':_0xfee022['name'],'resourceId':_0xfee022['id'],'type':_0x4d1e09[_0x13b8('0x29')],'sectionId':_0x4d1e09['id']},{})[_0x13b8('0x13')](function(){return _0x182e6b;});}else{return _0x182e6b;}})['catch'](function(_0x2fec94){logger[_0x13b8('0x17')](_0x13b8('0x7a'),_0x2fec94);throw _0x2fec94;});}return _0x182e6b;})['then'](respondWithResult(_0x1b212e,0xc9))[_0x13b8('0x1c')](handleError(_0x1b212e,null));};exports[_0x13b8('0x7b')]=function(_0x1c2d33,_0x46f88e){return db[_0x13b8('0x56')][_0x13b8('0x6d')]({'where':{'id':_0x1c2d33[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x46f88e,null))['then'](function(_0x4bbe72){if(_0x4bbe72){return _0x4bbe72['getImap']();}return null;})['then'](respondWithResult(_0x46f88e,null))[_0x13b8('0x1c')](handleError(_0x46f88e,null));};exports[_0x13b8('0x7c')]=function(_0x18c08e,_0x25e288){if(_0x18c08e[_0x13b8('0x5f')]['id']){delete _0x18c08e[_0x13b8('0x5f')]['id'];}return db[_0x13b8('0x56')]['find']({'where':{'id':_0x18c08e[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x25e288,null))[_0x13b8('0x13')](function(_0x32a108){if(_0x32a108){_0x18c08e[_0x13b8('0x5f')][_0x13b8('0x66')]=_0x32a108['id'];return db[_0x13b8('0x5b')][_0x13b8('0x68')](_0x18c08e[_0x13b8('0x5f')]);}})[_0x13b8('0x13')](respondWithResult(_0x25e288,null))[_0x13b8('0x1c')](handleError(_0x25e288,null));};exports[_0x13b8('0x7d')]=function(_0x5bc509,_0x1fbd38){return db[_0x13b8('0x56')][_0x13b8('0x6d')]({'where':{'id':_0x5bc509[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1fbd38,null))['then'](function(_0x1b3084){if(_0x1b3084){return _0x1b3084[_0x13b8('0x7e')](null);}return null;})[_0x13b8('0x13')](respondWithStatusCode(_0x1fbd38,null))[_0x13b8('0x1c')](handleError(_0x1fbd38,null));};exports[_0x13b8('0x7f')]=function(_0x117351,_0x1a1af3){return db['MailAccount'][_0x13b8('0x6d')]({'where':{'id':_0x117351[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x1a1af3,null))[_0x13b8('0x13')](function(_0x5019bf){if(_0x5019bf){return _0x5019bf[_0x13b8('0x7f')]();}return null;})[_0x13b8('0x13')](respondWithResult(_0x1a1af3,null))[_0x13b8('0x1c')](handleError(_0x1a1af3,null));};exports['addSmtp']=function(_0x746813,_0x2e9bd4){if(_0x746813[_0x13b8('0x5f')]['id']){delete _0x746813[_0x13b8('0x5f')]['id'];}return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0x746813[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x2e9bd4,null))[_0x13b8('0x13')](function(_0x3684c0){if(_0x3684c0){_0x746813[_0x13b8('0x5f')][_0x13b8('0x66')]=_0x3684c0['id'];return db[_0x13b8('0x40')][_0x13b8('0x68')](_0x746813[_0x13b8('0x5f')]);}})[_0x13b8('0x13')](respondWithResult(_0x2e9bd4,null))['catch'](handleError(_0x2e9bd4,null));};exports[_0x13b8('0x80')]=function(_0x276387,_0x3d3025){return db['MailAccount'][_0x13b8('0x6d')]({'where':{'id':_0x276387['params']['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x3d3025,null))[_0x13b8('0x13')](function(_0x9bb79b){if(_0x9bb79b){return _0x9bb79b[_0x13b8('0x81')](null);}return null;})[_0x13b8('0x13')](respondWithStatusCode(_0x3d3025,null))['catch'](handleError(_0x3d3025,null));};exports[_0x13b8('0x82')]=function(_0x2e86ce,_0x3b9ac8){return db['MailInteraction'][_0x13b8('0x5e')]({'where':{'id':_0x2e86ce[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3b9ac8,null))[_0x13b8('0x13')](function(_0x5e896f){if(_0x5e896f){return _0x5e896f['addInteraction'](_0x2e86ce[_0x13b8('0x5f')][_0x13b8('0x71')],_[_0x13b8('0x83')](_0x2e86ce[_0x13b8('0x5f')],[_0x13b8('0x71'),'id'])||{});}})[_0x13b8('0x13')](respondWithResult(_0x3b9ac8,null))[_0x13b8('0x1c')](handleError(_0x3b9ac8,null));};exports[_0x13b8('0x84')]=function(_0x1374a2,_0x1dccdb){var _0x286cd6={'raw':![],'where':{}};var _0x4a4b09={};var _0x17a166={'count':0x0,'rows':[]};return db['MailAccount'][_0x13b8('0x6d')]({'where':{'id':_0x1374a2[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1dccdb,null))[_0x13b8('0x13')](function(_0x1af870){if(_0x1af870){_0x4a4b09[_0x13b8('0x47')]=_[_0x13b8('0x49')](db['MailInteraction'][_0x13b8('0x43')]);_0x4a4b09['query']=_[_0x13b8('0x49')](_0x1374a2[_0x13b8('0x48')]);_0x4a4b09[_0x13b8('0x4a')]=_[_0x13b8('0x4b')](_0x4a4b09[_0x13b8('0x47')],_0x4a4b09['query']);_0x286cd6['attributes']=_[_0x13b8('0x4b')](_0x4a4b09[_0x13b8('0x47')],qs[_0x13b8('0x4c')](_0x1374a2[_0x13b8('0x48')][_0x13b8('0x4c')]));_0x286cd6['attributes']=_0x286cd6[_0x13b8('0x4d')]['length']?_0x286cd6[_0x13b8('0x4d')]:_0x4a4b09[_0x13b8('0x47')];if(!_0x1374a2['query'][_0x13b8('0x4e')](_0x13b8('0x6f'))){_0x286cd6[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x1374a2[_0x13b8('0x48')]['limit']);_0x286cd6[_0x13b8('0x20')]=qs[_0x13b8('0x20')](_0x1374a2[_0x13b8('0x48')][_0x13b8('0x20')]);}_0x286cd6[_0x13b8('0x4f')]=qs[_0x13b8('0x50')](_0x1374a2[_0x13b8('0x48')][_0x13b8('0x50')]);_0x286cd6[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x1374a2[_0x13b8('0x48')],_0x4a4b09['filters']));_0x286cd6['where']['MailAccountId']=_0x1af870['id'];if(_0x1374a2[_0x13b8('0x48')][_0x13b8('0x53')]){_0x286cd6['where']=_['merge'](_0x286cd6[_0x13b8('0x51')],{'$or':_['map'](_0x286cd6[_0x13b8('0x4d')],function(_0x14c2d8){var _0x1b4760={};_0x1b4760[_0x14c2d8]={'$like':'%'+_0x1374a2[_0x13b8('0x48')]['filter']+'%'};return _0x1b4760;})});}_0x286cd6=_[_0x13b8('0x54')]({},_0x286cd6,_0x1374a2['options']);return db[_0x13b8('0x85')]['count']({'where':_0x286cd6[_0x13b8('0x51')]})['then'](function(_0x1c1295){_0x17a166[_0x13b8('0x23')]=_0x1c1295;if(_0x1374a2[_0x13b8('0x48')]['includeAll']){_0x286cd6[_0x13b8('0x58')]=[{'model':db[_0x13b8('0x86')],'as':_0x13b8('0x87'),'required':![]},{'model':db[_0x13b8('0x88')],'as':_0x13b8('0x89'),'attributes':[_0x13b8('0x29'),_0x13b8('0x8a'),_0x13b8('0x8b')],'required':![]},{'model':db[_0x13b8('0x8c')],'as':_0x13b8('0x8d'),'attributes':['id',_0x13b8('0x29'),'color'],'where':_0x1374a2[_0x13b8('0x48')][_0x13b8('0x8e')]?{'id':_0x1374a2[_0x13b8('0x48')][_0x13b8('0x8e')]}:undefined,'required':_0x1374a2[_0x13b8('0x48')][_0x13b8('0x8e')]?!![]:![]}];}return db[_0x13b8('0x85')][_0x13b8('0x6a')](_0x286cd6);})[_0x13b8('0x13')](function(_0x5f2096){_0x17a166[_0x13b8('0x59')]=_0x5f2096;return _0x17a166;});}})[_0x13b8('0x13')](respondWithFilteredResult(_0x1dccdb,_0x286cd6))[_0x13b8('0x1c')](handleError(_0x1dccdb,null));};exports['addApplications']=function addApplications(_0x1fba83,_0x9a79c2){var _0x1da8ab=_0x1fba83['params']['id'];var _0x3108f8=_0x1fba83[_0x13b8('0x5f')];var _0x335ac4=0xc8;var _0xf873bd=null;return db[_0x13b8('0x8f')][_0x13b8('0x90')]({'isolationLevel':db[_0x13b8('0x8f')][_0x13b8('0x91')][_0x13b8('0x92')][_0x13b8('0x93')]},function(_0x58590a){return db[_0x13b8('0x56')]['findOne']({'where':{'id':_0x1da8ab},'transaction':_0x58590a})[_0x13b8('0x13')](function(_0x5b5007){if(_0x5b5007){return db[_0x13b8('0x94')]['destroy']({'where':{'MailAccountId':_0x1da8ab},'transaction':_0x58590a})[_0x13b8('0x13')](function(){var _0x47c793=_[_0x13b8('0x55')](_0x3108f8,function(_0x2d2b8a){_0x2d2b8a[_0x13b8('0x66')]=_0x1da8ab;return _0x2d2b8a;});return db['MailApplication'][_0x13b8('0x95')](_0x47c793,{'transaction':_0x58590a});});}else{_0x335ac4=0x194;_0xf873bd=[];}});})[_0x13b8('0x13')](function(){if(_0x335ac4!==0x194){return db['MailApplication'][_0x13b8('0x96')]({'where':{'MailAccountId':_0x1da8ab},'order':'priority'})[_0x13b8('0x13')](function(_0x4e3e40){_0xf873bd=_0x4e3e40;});}})[_0x13b8('0x1c')](function(_0x552753){_0x335ac4=0x1f4;logger[_0x13b8('0x17')](_0x552753[_0x13b8('0x97')]);if(_0x552753['name']){delete _0x552753[_0x13b8('0x29')];}_0xf873bd=_0x552753;})['finally'](function(){if(_0xf873bd===null){_0x9a79c2[_0x13b8('0x1d')](_0x335ac4);}else{if(_0x335ac4===0x1f4){_0x9a79c2['status'](_0x335ac4)[_0x13b8('0x98')](_0xf873bd);}else{_0x9a79c2[_0x13b8('0x1e')](_0x335ac4)['json'](_0xf873bd);}}});};exports['getApplications']=function(_0x2b9f00,_0x5554ed){var _0x51a02f={};var _0xd9da37={};var _0xf4e4fd;var _0x1b91c5;return db['MailAccount'][_0x13b8('0x6d')]({'where':{'id':_0x2b9f00[_0x13b8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5554ed,null))[_0x13b8('0x13')](function(_0x48679f){if(_0x48679f){_0xf4e4fd=_0x48679f;_0xd9da37[_0x13b8('0x47')]=_[_0x13b8('0x49')](db[_0x13b8('0x94')]['rawAttributes']);_0xd9da37['query']=_[_0x13b8('0x49')](_0x2b9f00[_0x13b8('0x48')]);_0xd9da37[_0x13b8('0x4a')]=_[_0x13b8('0x4b')](_0xd9da37[_0x13b8('0x47')],_0xd9da37['query']);_0x51a02f[_0x13b8('0x4d')]=_[_0x13b8('0x4b')](_0xd9da37['model'],qs[_0x13b8('0x4c')](_0x2b9f00[_0x13b8('0x48')][_0x13b8('0x4c')]));_0x51a02f[_0x13b8('0x4d')]=_0x51a02f[_0x13b8('0x4d')][_0x13b8('0x5c')]?_0x51a02f['attributes']:_0xd9da37['model'];_0x51a02f[_0x13b8('0x4f')]=qs[_0x13b8('0x50')](_0x2b9f00[_0x13b8('0x48')][_0x13b8('0x50')]);_0x51a02f[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x2b9f00['query'],_0xd9da37['filters']));if(_0x2b9f00[_0x13b8('0x48')]['filter']){_0x51a02f[_0x13b8('0x51')]=_[_0x13b8('0x54')](_0x51a02f[_0x13b8('0x51')],{'$or':_[_0x13b8('0x55')](_0x51a02f[_0x13b8('0x4d')],function(_0x197a58){var _0x3333a5={};_0x3333a5[_0x197a58]={'$like':'%'+_0x2b9f00[_0x13b8('0x48')][_0x13b8('0x53')]+'%'};return _0x3333a5;})});}_0x51a02f=_[_0x13b8('0x54')]({},_0x51a02f,_0x2b9f00[_0x13b8('0x5d')]);return _0xf4e4fd[_0x13b8('0x99')](_0x51a02f);}})[_0x13b8('0x13')](function(_0x5379b6){if(_0x5379b6){_0x1b91c5=_0x5379b6[_0x13b8('0x5c')];if(!_0x2b9f00[_0x13b8('0x48')][_0x13b8('0x4e')](_0x13b8('0x6f'))){_0x51a02f[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x2b9f00[_0x13b8('0x48')]['limit']);_0x51a02f[_0x13b8('0x20')]=qs[_0x13b8('0x20')](_0x2b9f00['query'][_0x13b8('0x20')]);}return _0xf4e4fd[_0x13b8('0x99')](_0x51a02f);}})['then'](function(_0x5c27ba){if(_0x5c27ba){return _0x5c27ba?{'count':_0x1b91c5,'rows':_0x5c27ba}:null;}})[_0x13b8('0x13')](respondWithResult(_0x5554ed,null))['catch'](handleError(_0x5554ed,null));};exports[_0x13b8('0x9a')]=function(_0x257896,_0x58659d){var _0x275d83={'raw':!![],'where':{}};var _0x3d8944={};var _0x8cf169={'count':0x0,'rows':[]};return db[_0x13b8('0x56')][_0x13b8('0x6d')]({'where':{'id':_0x257896['params']['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x58659d,null))[_0x13b8('0x13')](function(_0x1ac2b7){if(_0x1ac2b7){_0x3d8944[_0x13b8('0x47')]=_[_0x13b8('0x49')](db[_0x13b8('0x9b')][_0x13b8('0x43')]);_0x3d8944[_0x13b8('0x48')]=_[_0x13b8('0x49')](_0x257896[_0x13b8('0x48')]);_0x3d8944[_0x13b8('0x4a')]=_[_0x13b8('0x4b')](_0x3d8944['model'],_0x3d8944[_0x13b8('0x48')]);_0x275d83[_0x13b8('0x4d')]=_[_0x13b8('0x4b')](_0x3d8944[_0x13b8('0x47')],qs['fields'](_0x257896['query'][_0x13b8('0x4c')]));_0x275d83[_0x13b8('0x4d')]=_0x275d83['attributes'][_0x13b8('0x5c')]?_0x275d83['attributes']:_0x3d8944[_0x13b8('0x47')];if(!_0x257896[_0x13b8('0x48')][_0x13b8('0x4e')](_0x13b8('0x6f'))){_0x275d83[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x257896[_0x13b8('0x48')]['limit']);_0x275d83[_0x13b8('0x20')]=qs['offset'](_0x257896[_0x13b8('0x48')][_0x13b8('0x20')]);}_0x275d83[_0x13b8('0x4f')]=qs[_0x13b8('0x50')](_0x257896[_0x13b8('0x48')]['sort']);_0x275d83[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x257896[_0x13b8('0x48')],_0x3d8944[_0x13b8('0x4a')]));_0x275d83[_0x13b8('0x51')][_0x13b8('0x66')]=_0x1ac2b7['id'];if(_0x257896['query'][_0x13b8('0x53')]){_0x275d83[_0x13b8('0x51')]=_['merge'](_0x275d83[_0x13b8('0x51')],{'$or':_[_0x13b8('0x55')](_0x275d83[_0x13b8('0x4d')],function(_0x3ca1ea){var _0x29a8de={};_0x29a8de[_0x3ca1ea]={'$like':'%'+_0x257896['query']['filter']+'%'};return _0x29a8de;})});}if(_0x257896[_0x13b8('0x48')][_0x13b8('0x9c')]){var _0x4869c0=_0x257896[_0x13b8('0x48')][_0x13b8('0x9c')][_0x13b8('0x9d')](',');var _0x4e9186={};_0x4e9186[_0x4869c0[0x0]]={'$gte':moment(_0x4869c0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x275d83[_0x13b8('0x51')]=_[_0x13b8('0x54')](_0x275d83[_0x13b8('0x51')],_0x4e9186);}_0x275d83=_['merge']({},_0x275d83,_0x257896[_0x13b8('0x5d')]);return db[_0x13b8('0x9b')][_0x13b8('0x23')]({'where':_0x275d83['where']})[_0x13b8('0x13')](function(_0x369af5){_0x8cf169[_0x13b8('0x23')]=_0x369af5;if(_0x257896[_0x13b8('0x48')][_0x13b8('0x57')]){_0x275d83[_0x13b8('0x58')]=[{'all':!![]}];}return db[_0x13b8('0x9b')]['findAll'](_0x275d83);})[_0x13b8('0x13')](function(_0x497bcb){if(_0x257896['query'][_0x13b8('0x9e')]===_0x13b8('0x9f')){for(var _0x2ed2fa=0x0;_0x2ed2fa<_0x497bcb[_0x13b8('0x5c')];_0x2ed2fa++){_0x497bcb[_0x2ed2fa][_0x13b8('0x5f')]=juice(_0x497bcb[_0x2ed2fa][_0x13b8('0x5f')]);}}_0x8cf169[_0x13b8('0x59')]=_0x497bcb;return _0x8cf169;});}})[_0x13b8('0x13')](respondWithFilteredResult(_0x58659d,_0x275d83))['catch'](handleError(_0x58659d,null));};exports[_0x13b8('0x98')]=function(_0xd37c1c,_0x25c7dd){var _0x34fcb8,_0xb2456d={},_0x345c57;if(_0xd37c1c['body']['to']){_0x345c57=_0xd37c1c['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0xd37c1c[_0x13b8('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x13b8('0xa0'),'include':[{'model':db['CmContact'],'as':_0x13b8('0xa1'),'where':{'email':_0x345c57},'limit':0x1,'order':[[_0x13b8('0xa2'),_0x13b8('0xa3')]]}]},{'model':db[_0x13b8('0x40')],'as':_0x13b8('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x13b8('0xa4'),'raw':!![]}]}]})[_0x13b8('0x13')](handleEntityNotFound(_0x25c7dd,null))['then'](function(_0x2b7976){if(!_0x2b7976)return;_0x34fcb8=_0x2b7976;if(!_0x2b7976[_0x13b8('0x3e')])throw new Error(_0x13b8('0xa5'));if(_[_0x13b8('0x73')](_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xa6')])){_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xa6')]=util[_0x13b8('0xa7')](_0x13b8('0xa8'),_0x2b7976[_0x13b8('0x29')],_0x2b7976[_0x13b8('0x72')]||_0x2b7976[_0x13b8('0x3e')][_0x13b8('0x33')]);}if(_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xa9')]&&_0xd37c1c['body'][_0x13b8('0xa9')]['length']){for(var _0x22cd31=0x0;_0x22cd31<_0xd37c1c['body'][_0x13b8('0xa9')][_0x13b8('0x5c')];_0x22cd31+=0x1){_0xd37c1c[_0x13b8('0x5f')]['attachments'][_0x22cd31]={'filename':_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xa9')][_0x22cd31][_0x13b8('0x29')],'path':path[_0x13b8('0xaa')](config[_0x13b8('0xab')],_0x13b8('0xac'),_0xd37c1c[_0x13b8('0x5f')]['attachments'][_0x22cd31][_0x13b8('0xad')])};}}var _0x1184a5=_0x2b7976[_0x13b8('0xae')]();return respondWithRpcPromise(_0x13b8('0xaf'),_0x13b8('0xb0'),{'account':_0x1184a5,'message':_0xd37c1c[_0x13b8('0x5f')]});})[_0x13b8('0x13')](function(_0x4bcac7){if(!_0x4bcac7)return;_0xb2456d=_0x4bcac7;if(!_0x34fcb8[_0x13b8('0xa0')])throw new Error(_0x13b8('0xb1'));if(_0x34fcb8['List']['Contacts'][_0x13b8('0x5c')])return _0x34fcb8[_0x13b8('0xa0')][_0x13b8('0xa1')][0x0];return db[_0x13b8('0x86')][_0x13b8('0x68')](_[_0x13b8('0xa')](_0xd37c1c[_0x13b8('0x5f')],{'firstName':_0xd37c1c[_0x13b8('0x5f')]['to'],'email':_0xd37c1c['body']['to'],'phone':_0xd37c1c[_0x13b8('0x5f')]['to'],'ListId':_0x34fcb8[_0x13b8('0xb2')]}));})[_0x13b8('0x13')](function(_0x2e167b){if(!_0x2e167b)return;var _0x20fd82={'UserId':_0xd37c1c[_0x13b8('0x33')]['id'],'ContactId':_0x2e167b['id'],'MailAccountId':_0x34fcb8['id'],'inReplyTo':_0xb2456d[_0x13b8('0xb3')],'to':_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xa6')],'cc':_0xd37c1c[_0x13b8('0x5f')]['cc'],'subject':_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xb4')],'attach':_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x13b8('0xa7')](_0x13b8('0xb6')),'lastMsgDirection':'out','Messages':[_[_0x13b8('0x54')](_0xd37c1c[_0x13b8('0x5f')],{'messageId':_0xb2456d[_0x13b8('0xb3')],'sentAt':moment()[_0x13b8('0xa7')](_0x13b8('0xb6')),'read':!![],'MailAccountId':_0x34fcb8['id'],'UserId':_0xd37c1c['user']['id'],'ContactId':_0x2e167b['id']})]};if(_0xd37c1c[_0x13b8('0x5f')]['Interaction']){_0x20fd82=_[_0x13b8('0x54')](_0x20fd82,_0xd37c1c[_0x13b8('0x5f')][_0x13b8('0xb7')]);}return db['MailInteraction'][_0x13b8('0x68')](_0x20fd82,{'include':[{'model':db[_0x13b8('0x9b')],'as':_0x13b8('0xb8')}]});})[_0x13b8('0x13')](respondWithResult(_0x25c7dd,null))[_0x13b8('0x1c')](handleError(_0x25c7dd,null));};exports[_0x13b8('0xb9')]=function(_0x2378d6,_0xe0c040){return db[_0x13b8('0x56')][_0x13b8('0x5e')]({'where':{'id':_0x2378d6[_0x13b8('0x5a')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x13b8('0x3e'),'raw':!![],'include':[{'model':db[_0x13b8('0xa4')],'as':_0x13b8('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xe0c040,null))[_0x13b8('0x13')](function(_0x2d5e5b){if(!_0x2d5e5b[_0x13b8('0x3e')])return;var _0x32578d=_0x2d5e5b['getSmtpOptions']();return respondWithRpcPromise(_0x13b8('0xba'),'verifySmtp',{'account':_0x32578d});})['then'](respondWithResult(_0xe0c040,null))[_0x13b8('0x1c')](handleError(_0xe0c040,null));};exports['destroy']=function(_0x13482e,_0x3f8ffc){return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0x13482e['params']['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x3f8ffc,null))[_0x13b8('0x13')](function(_0xfd4ae1){if(_0xfd4ae1&&_0xfd4ae1[_0x13b8('0x3a')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xfd4ae1;})[_0x13b8('0x13')](removeEntity(_0x3f8ffc,null))['catch'](handleError(_0x3f8ffc,null));};exports[_0x13b8('0xbb')]=function(_0x365e7f,_0x44a057){return db[_0x13b8('0x56')][_0x13b8('0x5e')]({'where':{'id':_0x365e7f[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x44a057,null))[_0x13b8('0x13')](function(_0x156c99){if(_0x156c99){return _0x156c99[_0x13b8('0xbb')](_0x365e7f['body'][_0x13b8('0x71')],_['omit'](_0x365e7f['body'],[_0x13b8('0x71'),'id'])||{})['spread'](function(_0x5c48bd){for(var _0x7ba56c=0x0;_0x7ba56c<_0x365e7f[_0x13b8('0x5f')][_0x13b8('0x71')][_0x13b8('0x5c')];_0x7ba56c+=0x1){socket[_0x13b8('0xbc')](_0x13b8('0xbd'),{'UserId':Number(_0x365e7f[_0x13b8('0x5f')][_0x13b8('0x71')][_0x7ba56c]),'MailAccountId':Number(_0x365e7f['params']['id'])});}return _0x5c48bd;});}})[_0x13b8('0x13')](respondWithResult(_0x44a057,null))['catch'](handleError(_0x44a057,null));};exports[_0x13b8('0xbe')]=function(_0xa0608,_0xca6811){return db['MailAccount'][_0x13b8('0x5e')]({'where':{'id':_0xa0608[_0x13b8('0x5a')]['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0xca6811,null))[_0x13b8('0x13')](function(_0x3baffb){if(_0x3baffb){return _0x3baffb[_0x13b8('0xbe')](_0xa0608['query']['ids'])[_0x13b8('0x13')](function(){if(_[_0x13b8('0xbf')](_0xa0608['query'][_0x13b8('0x71')])){for(var _0x14f8da=0x0;_0x14f8da<_0xa0608['query'][_0x13b8('0x71')]['length'];_0x14f8da+=0x1){socket[_0x13b8('0xbc')](_0x13b8('0xc0'),{'UserId':Number(_0xa0608[_0x13b8('0x48')][_0x13b8('0x71')][_0x14f8da]),'MailAccountId':Number(_0xa0608[_0x13b8('0x5a')]['id'])});}}else{socket[_0x13b8('0xbc')](_0x13b8('0xc0'),{'UserId':Number(_0xa0608[_0x13b8('0x48')][_0x13b8('0x71')]),'MailAccountId':Number(_0xa0608[_0x13b8('0x5a')]['id'])});}});}})[_0x13b8('0x13')](respondWithStatusCode(_0xca6811,null))[_0x13b8('0x1c')](handleError(_0xca6811,null));};exports[_0x13b8('0xc1')]=function(_0x37c424,_0x59656a){var _0x1e703e={};var _0x21006f={};var _0x69d723;var _0x508db4;return db['MailAccount'][_0x13b8('0x6d')]({'where':{'id':_0x37c424['params']['id']}})[_0x13b8('0x13')](handleEntityNotFound(_0x59656a,null))['then'](function(_0x2322eb){if(_0x2322eb){_0x69d723=_0x2322eb;_0x21006f[_0x13b8('0x47')]=_[_0x13b8('0x49')](db[_0x13b8('0x88')]['rawAttributes']);_0x21006f[_0x13b8('0x48')]=_[_0x13b8('0x49')](_0x37c424[_0x13b8('0x48')]);_0x21006f['filters']=_['intersection'](_0x21006f['model'],_0x21006f[_0x13b8('0x48')]);_0x1e703e[_0x13b8('0x4d')]=_['intersection'](_0x21006f[_0x13b8('0x47')],qs[_0x13b8('0x4c')](_0x37c424[_0x13b8('0x48')][_0x13b8('0x4c')]));_0x1e703e[_0x13b8('0x4d')]=_0x1e703e[_0x13b8('0x4d')][_0x13b8('0x5c')]?_0x1e703e[_0x13b8('0x4d')]:_0x21006f[_0x13b8('0x47')];_0x1e703e[_0x13b8('0x4f')]=qs['sort'](_0x37c424['query'][_0x13b8('0x50')]);_0x1e703e[_0x13b8('0x51')]=qs[_0x13b8('0x4a')](_[_0x13b8('0x52')](_0x37c424[_0x13b8('0x48')],_0x21006f[_0x13b8('0x4a')]));if(_0x37c424['query'][_0x13b8('0x53')]){_0x1e703e[_0x13b8('0x51')]=_['merge'](_0x1e703e[_0x13b8('0x51')],{'$or':_[_0x13b8('0x55')](_0x1e703e['attributes'],function(_0x1165f6){var _0xe0f2c2={};_0xe0f2c2[_0x1165f6]={'$like':'%'+_0x37c424['query'][_0x13b8('0x53')]+'%'};return _0xe0f2c2;})});}_0x1e703e=_[_0x13b8('0x54')]({},_0x1e703e,_0x37c424[_0x13b8('0x5d')]);return _0x69d723[_0x13b8('0xc1')](_0x1e703e);}})[_0x13b8('0x13')](function(_0x256d35){if(_0x256d35){_0x508db4=_0x256d35[_0x13b8('0x5c')];if(!_0x37c424[_0x13b8('0x48')][_0x13b8('0x4e')](_0x13b8('0x6f'))){_0x1e703e[_0x13b8('0x22')]=qs[_0x13b8('0x22')](_0x37c424['query'][_0x13b8('0x22')]);_0x1e703e['offset']=qs[_0x13b8('0x20')](_0x37c424[_0x13b8('0x48')][_0x13b8('0x20')]);}return _0x69d723['getAgents'](_0x1e703e);}})[_0x13b8('0x13')](function(_0x2bd83a){if(_0x2bd83a){return _0x2bd83a?{'count':_0x508db4,'rows':_0x2bd83a}:null;}})[_0x13b8('0x13')](respondWithResult(_0x59656a,null))['catch'](handleError(_0x59656a,null));}; \ No newline at end of file +var _0x8a88=['filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','options','removeDispositions','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','findOne','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','CmContact','Contact','User','Owner','fullname','Tag','tag','sequelize','Transaction','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','send','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','MailAccounts','destroy','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','username','pass','password','modernAuthentication','CloudProviderId','host','port','service','authentication','user','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x2d8935,_0x2c9d2e){var _0x2c5156=function(_0x5ba97e){while(--_0x5ba97e){_0x2d8935['push'](_0x2d8935['shift']());}};_0x2c5156(++_0x2c9d2e);}(_0x8a88,0x11e));var _0x88a8=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0x8a88[_0x122633];return _0x2d02e5;};'use strict';var moment=require(_0x88a8('0x0'));var BPromise=require(_0x88a8('0x1'));var util=require('util');var path=require(_0x88a8('0x2'));var _=require(_0x88a8('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x88a8('0x4'));var logger=require(_0x88a8('0x5'))(_0x88a8('0x6'));var config=require('../../config/environment');var db=require(_0x88a8('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x88a8('0x8'),'port':0x18eb});var socket=require(_0x88a8('0x9'))(new Redis(config['redis']));require(_0x88a8('0xa'))[_0x88a8('0xb')](socket);var jayson=require(_0x88a8('0xc'));var client=jayson[_0x88a8('0xd')][_0x88a8('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x21baf0,_0x4531a6,_0x4412b7,_0x21123c){return new BPromise(function(_0xf8e87b,_0xa86145){var _0x4e5851=_0x21123c||client;return _0x4e5851[_0x88a8('0xf')](_0x21baf0,_0x4412b7)[_0x88a8('0x10')](function(_0x564ce9){logger[_0x88a8('0x11')](_0x88a8('0x12'),_0x4531a6,_0x88a8('0x13'));logger['debug'](_0x88a8('0x14'),_0x4531a6,_0x88a8('0x13'),JSON[_0x88a8('0x15')](_0x564ce9));if(_0x564ce9[_0x88a8('0x16')]){if(_0x564ce9[_0x88a8('0x16')]['code']===0x1f4){logger[_0x88a8('0x16')](_0x88a8('0x12'),_0x4531a6,_0x564ce9['error']['message']);return _0xa86145(_0x564ce9[_0x88a8('0x16')][_0x88a8('0x17')]);}logger[_0x88a8('0x16')](_0x88a8('0x12'),_0x4531a6,_0x564ce9[_0x88a8('0x16')][_0x88a8('0x17')]);return _0xf8e87b(_0x564ce9['error'][_0x88a8('0x17')]);}else{logger[_0x88a8('0x11')](_0x88a8('0x12'),_0x4531a6,'request\x20sent');_0xf8e87b(_0x564ce9[_0x88a8('0x18')][_0x88a8('0x17')]);}})['catch'](function(_0x316d35){logger[_0x88a8('0x16')](_0x88a8('0x12'),_0x4531a6,_0x316d35);_0xa86145(_0x316d35);});});}function respondWithStatusCode(_0x1aaf63,_0x575fe0){_0x575fe0=_0x575fe0||0xcc;return function(_0x1edc64){if(_0x1edc64){return _0x1aaf63[_0x88a8('0x19')](_0x575fe0);}return _0x1aaf63[_0x88a8('0x1a')](_0x575fe0)[_0x88a8('0x1b')]();};}function respondWithResult(_0x2a7143,_0x3414af){_0x3414af=_0x3414af||0xc8;return function(_0xe9ab79){if(_0xe9ab79){return _0x2a7143[_0x88a8('0x1a')](_0x3414af)[_0x88a8('0x1c')](_0xe9ab79);}};}function respondWithFilteredResult(_0x53637b,_0x40d6e1){return function(_0x5ad7f3){if(_0x5ad7f3){var _0x8c7e72=typeof _0x40d6e1[_0x88a8('0x1d')]===_0x88a8('0x1e')&&typeof _0x40d6e1[_0x88a8('0x1f')]===_0x88a8('0x1e');var _0x212d8b=_0x5ad7f3[_0x88a8('0x20')];var _0x5bdf95=_0x8c7e72?0x0:_0x40d6e1['offset'];var _0xfab5fc=_0x8c7e72?_0x5ad7f3[_0x88a8('0x20')]:_0x40d6e1[_0x88a8('0x1d')]+_0x40d6e1[_0x88a8('0x1f')];var _0x2ce84e;if(_0xfab5fc>=_0x212d8b){_0xfab5fc=_0x212d8b;_0x2ce84e=0xc8;}else{_0x2ce84e=0xce;}_0x53637b['status'](_0x2ce84e);return _0x53637b[_0x88a8('0x21')](_0x88a8('0x22'),_0x5bdf95+'-'+_0xfab5fc+'/'+_0x212d8b)[_0x88a8('0x1c')](_0x5ad7f3);}return null;};}function saveUpdates(_0x54e484){return function(_0x2ac1b2){if(_0x2ac1b2){return _0x2ac1b2[_0x88a8('0x23')](_0x54e484)[_0x88a8('0x10')](function(_0x507c3f){return _0x507c3f;});}return null;};}function removeEntity(_0x41d825){return function(_0x44c32b){if(_0x44c32b){return _0x44c32b['destroy']()['then'](function(){var _0x5b0e7a=_0x44c32b[_0x88a8('0x24')]({'plain':!![]});var _0x2f5d41=_0x88a8('0x25');return db['UserProfileResource'][_0x88a8('0x26')]({'where':{'type':_0x2f5d41,'resourceId':_0x5b0e7a['id']}})[_0x88a8('0x10')](function(){return _0x44c32b;});})[_0x88a8('0x10')](function(){_0x41d825[_0x88a8('0x1a')](0xcc)[_0x88a8('0x1b')]();});}};}function handleEntityNotFound(_0x3ceb35){return function(_0x3ea9a4){if(!_0x3ea9a4){_0x3ceb35[_0x88a8('0x19')](0x194);}return _0x3ea9a4;};}function handleError(_0x1219a3,_0x2c7146){_0x2c7146=_0x2c7146||0x1f4;return function(_0x3d0bef){logger[_0x88a8('0x16')](_0x3d0bef['stack']);if(_0x3d0bef[_0x88a8('0x27')]){delete _0x3d0bef[_0x88a8('0x27')];}_0x1219a3[_0x88a8('0x1a')](_0x2c7146)['send'](_0x3d0bef);};}function getImapHost(_0x1d40fb){switch(_0x1d40fb){case _0x88a8('0x28'):return _0x88a8('0x29');case _0x88a8('0x2a'):return'imap.mail.yahoo.com';case _0x88a8('0x2b'):return _0x88a8('0x2c');case _0x88a8('0x2d'):return _0x88a8('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x1d40fb);}function getSmtpHost(_0x4e93cc){switch(_0x4e93cc){case'gmail':return _0x88a8('0x2f');case _0x88a8('0x2a'):return'smtp.mail.yahoo.com';case _0x88a8('0x2b'):return _0x88a8('0x30');case _0x88a8('0x2d'):return'smtp.office365.com';}throw new Error(_0x88a8('0x31'),_0x4e93cc);}function getAuthenticationOptions(_0x206d97,_0x3227b3){var _0x408bea={};var _0x32511b={};if(_0x206d97){_0x408bea['user']=_0x32511b['user']=_0x3227b3[_0x88a8('0x32')];_0x408bea['password']=_0x32511b[_0x88a8('0x33')]=_0x3227b3[_0x88a8('0x34')];if(_0x3227b3['modernAuthentication']){_0x408bea[_0x88a8('0x35')]=_0x32511b[_0x88a8('0x35')]=!![];_0x408bea['CloudProviderId']=_0x32511b['CloudProviderId']=_0x3227b3[_0x88a8('0x36')];_0x408bea[_0x88a8('0x34')]=_0x32511b[_0x88a8('0x33')]=null;}else{_0x408bea['CloudProviderId']=_0x32511b[_0x88a8('0x36')]=null;}_0x408bea[_0x88a8('0x37')]=getImapHost(_0x206d97);_0x408bea[_0x88a8('0x38')]=0x3e1;_0x32511b[_0x88a8('0x37')]=getSmtpHost(_0x206d97);_0x32511b[_0x88a8('0x38')]=0x24b;_0x32511b['secure']=![];_0x408bea[_0x88a8('0x39')]=_0x32511b['service']=null;}else{if(_0x3227b3[_0x88a8('0x3a')]){_0x408bea['user']=_0x32511b['user']=_0x3227b3[_0x88a8('0x32')];_0x408bea['password']=_0x32511b[_0x88a8('0x33')]=_0x3227b3[_0x88a8('0x34')];}else{_0x408bea['authentication']=_0x32511b[_0x88a8('0x3a')]=![];_0x408bea[_0x88a8('0x3b')]=_0x32511b['user']=null;_0x408bea['password']=_0x32511b['pass']=null;}_0x408bea[_0x88a8('0x37')]=_0x3227b3[_0x88a8('0x3c')]['host'];_0x408bea[_0x88a8('0x38')]=_0x3227b3[_0x88a8('0x3c')][_0x88a8('0x38')];_0x32511b[_0x88a8('0x37')]=_0x3227b3[_0x88a8('0x3d')][_0x88a8('0x37')];_0x32511b[_0x88a8('0x38')]=_0x3227b3[_0x88a8('0x3d')][_0x88a8('0x38')];}return{'Imap':_0x408bea,'Smtp':_0x32511b};}exports[_0x88a8('0x3e')]=function(_0x25be36,_0x456796){var _0x581a20={'include':[{'model':db[_0x88a8('0x3f')],'as':_0x88a8('0x3c')},{'model':db[_0x88a8('0x40')],'as':_0x88a8('0x3d')},{'model':db[_0x88a8('0x41')],'as':_0x88a8('0x42')}]},_0x124f10={},_0x2d1f77={'count':0x0,'rows':[]};var _0x1ab379=_['map'](db[_0x88a8('0x43')][_0x88a8('0x44')],function(_0x5bf3c8){return{'name':_0x5bf3c8['fieldName'],'type':_0x5bf3c8[_0x88a8('0x45')]['key']};});_0x124f10[_0x88a8('0x46')]=_[_0x88a8('0x47')](_0x1ab379,'name');_0x124f10['query']=_[_0x88a8('0x48')](_0x25be36[_0x88a8('0x49')]);_0x124f10[_0x88a8('0x4a')]=_['intersection'](_0x124f10['model'],_0x124f10['query']);_0x581a20[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0x124f10[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0x25be36[_0x88a8('0x49')][_0x88a8('0x4d')]));_0x581a20[_0x88a8('0x4b')]=_0x581a20[_0x88a8('0x4b')][_0x88a8('0x4e')]?_0x581a20[_0x88a8('0x4b')]:_0x124f10[_0x88a8('0x46')];if(!_0x25be36['query'][_0x88a8('0x4f')](_0x88a8('0x50'))){_0x581a20[_0x88a8('0x1f')]=qs[_0x88a8('0x1f')](_0x25be36[_0x88a8('0x49')]['limit']);_0x581a20[_0x88a8('0x1d')]=qs[_0x88a8('0x1d')](_0x25be36[_0x88a8('0x49')][_0x88a8('0x1d')]);}_0x581a20[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0x25be36['query'][_0x88a8('0x52')]);_0x581a20['where']=qs['filters'](_[_0x88a8('0x53')](_0x25be36['query'],_0x124f10[_0x88a8('0x4a')]),_0x1ab379);if(_0x25be36[_0x88a8('0x49')][_0x88a8('0x54')]){_0x581a20[_0x88a8('0x55')]=_['merge'](_0x581a20['where'],{'$or':_[_0x88a8('0x47')](_0x1ab379,function(_0x200dd0){if(_0x200dd0[_0x88a8('0x45')]!==_0x88a8('0x56')){var _0x1af21b={};_0x1af21b[_0x200dd0[_0x88a8('0x27')]]={'$like':'%'+_0x25be36[_0x88a8('0x49')][_0x88a8('0x54')]+'%'};return _0x1af21b;}})});}_0x581a20=_[_0x88a8('0x57')]({},_0x581a20,_0x25be36['options']);var _0x52f44c={'where':_0x581a20[_0x88a8('0x55')]};return db[_0x88a8('0x43')][_0x88a8('0x20')](_0x52f44c)['then'](function(_0x52cc52){_0x2d1f77[_0x88a8('0x20')]=_0x52cc52;if(_0x25be36[_0x88a8('0x49')][_0x88a8('0x58')]){_0x581a20[_0x88a8('0x59')]=[{'all':!![]}];}return db[_0x88a8('0x43')][_0x88a8('0x5a')](_0x581a20);})['then'](function(_0x448dd5){_0x2d1f77[_0x88a8('0x5b')]=_0x448dd5;return _0x2d1f77;})[_0x88a8('0x10')](respondWithFilteredResult(_0x456796,_0x581a20))[_0x88a8('0x5c')](handleError(_0x456796,null));};exports[_0x88a8('0x5d')]=function(_0x18eea7,_0x5b392c){var _0x1215d4={'raw':![],'where':{'id':_0x18eea7[_0x88a8('0x5e')]['id']},'include':[{'model':db[_0x88a8('0x3f')],'as':_0x88a8('0x3c')},{'model':db[_0x88a8('0x40')],'as':'Smtp'},{'model':db[_0x88a8('0x41')],'as':_0x88a8('0x42')}]},_0xe93d7e={};_0xe93d7e[_0x88a8('0x46')]=_[_0x88a8('0x48')](db[_0x88a8('0x43')][_0x88a8('0x44')]);_0xe93d7e[_0x88a8('0x49')]=_[_0x88a8('0x48')](_0x18eea7['query']);_0xe93d7e[_0x88a8('0x4a')]=_[_0x88a8('0x4c')](_0xe93d7e[_0x88a8('0x46')],_0xe93d7e['query']);_0x1215d4[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0xe93d7e[_0x88a8('0x46')],qs['fields'](_0x18eea7[_0x88a8('0x49')][_0x88a8('0x4d')]));_0x1215d4[_0x88a8('0x4b')]=_0x1215d4[_0x88a8('0x4b')][_0x88a8('0x4e')]?_0x1215d4[_0x88a8('0x4b')]:_0xe93d7e[_0x88a8('0x46')];if(_0x18eea7['query'][_0x88a8('0x58')]){_0x1215d4[_0x88a8('0x59')]=[{'all':!![]}];}_0x1215d4=_[_0x88a8('0x57')]({},_0x1215d4,_0x18eea7['options']);return db[_0x88a8('0x43')][_0x88a8('0x5f')](_0x1215d4)[_0x88a8('0x10')](handleEntityNotFound(_0x5b392c,null))[_0x88a8('0x10')](respondWithResult(_0x5b392c,null))[_0x88a8('0x5c')](handleError(_0x5b392c,null));};exports[_0x88a8('0x23')]=function(_0x2aef83,_0x2c6515){if(_0x2aef83[_0x88a8('0x60')]['id']){delete _0x2aef83[_0x88a8('0x60')]['id'];}var _0x5485c5=_0x2aef83[_0x88a8('0x60')][_0x88a8('0x61')]===_0x88a8('0x62')?null:_0x2aef83[_0x88a8('0x60')][_0x88a8('0x61')];var _0x21dd80=_0x2aef83[_0x88a8('0x60')]['Imap']||{};var _0x439157=_0x2aef83['body'][_0x88a8('0x3d')]||{};if(_0x5485c5){_0x21dd80['host']=getImapHost(_0x5485c5);_0x21dd80[_0x88a8('0x38')]=0x3e1;_0x439157['host']=getSmtpHost(_0x5485c5);_0x439157[_0x88a8('0x38')]=0x24b;_0x439157['secure']=![];}if(_0x439157['modernAuthentication']){_0x439157[_0x88a8('0x63')]=![];}else{_0x439157[_0x88a8('0x36')]=null;}if(!_0x21dd80[_0x88a8('0x35')])_0x21dd80['CloudProviderId']=null;_0x2aef83[_0x88a8('0x60')][_0x88a8('0x3c')]=_0x21dd80;_0x2aef83[_0x88a8('0x60')]['Smtp']=_0x439157;return db['MailAccount'][_0x88a8('0x5f')]({'where':{'id':_0x2aef83[_0x88a8('0x5e')]['id']},'include':[{'model':db[_0x88a8('0x3f')],'as':_0x88a8('0x3c')},{'model':db[_0x88a8('0x40')],'as':_0x88a8('0x3d')},{'model':db[_0x88a8('0x41')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2c6515,null))['then'](function(_0x400a1b){if(!_0x400a1b)throw new Error(_0x88a8('0x64'));if(_0x400a1b['service'])delete _0x2aef83[_0x88a8('0x60')][_0x88a8('0x3c')];return _0x400a1b;})[_0x88a8('0x10')](saveUpdates(_0x2aef83[_0x88a8('0x60')],null))[_0x88a8('0x10')](function(_0x827f3f){if(!_0x2aef83[_0x88a8('0x60')][_0x88a8('0x3c')])return _0x827f3f;return db['MailServerIn'][_0x88a8('0x23')](_0x2aef83[_0x88a8('0x60')][_0x88a8('0x3c')],{'where':{'MailAccountId':_0x827f3f['id']}})[_0x88a8('0x10')](function(){return _0x827f3f;});})[_0x88a8('0x10')](function(_0xc73de8){if(!_0x2aef83[_0x88a8('0x60')][_0x88a8('0x3d')])return _0xc73de8;return db[_0x88a8('0x40')][_0x88a8('0x23')](_0x2aef83[_0x88a8('0x60')]['Smtp'],{'where':{'MailAccountId':_0xc73de8['id']}})['then'](function(){return _0xc73de8;});})[_0x88a8('0x10')](respondWithResult(_0x2c6515,null))[_0x88a8('0x5c')](handleError(_0x2c6515,null));};exports[_0x88a8('0x65')]=function(_0x43e739,_0x5d3c6c){return db[_0x88a8('0x43')][_0x88a8('0x65')]()[_0x88a8('0x10')](respondWithResult(_0x5d3c6c,null))['catch'](handleError(_0x5d3c6c,null));};exports[_0x88a8('0x66')]=function(_0x5ce246,_0x4f7d20){if(_0x5ce246[_0x88a8('0x60')]['id']){delete _0x5ce246[_0x88a8('0x60')]['id'];}return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x5ce246[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4f7d20,null))[_0x88a8('0x10')](function(_0x22818e){if(_0x22818e){_0x5ce246[_0x88a8('0x60')][_0x88a8('0x67')]=_0x22818e['id'];return db[_0x88a8('0x68')][_0x88a8('0x69')](_0x5ce246[_0x88a8('0x60')]);}})['then'](respondWithResult(_0x4f7d20,null))[_0x88a8('0x5c')](handleError(_0x4f7d20,null));};exports[_0x88a8('0x6a')]=function(_0x173adc,_0x3392d0){var _0x5c4f41={'raw':![],'where':{}};var _0x196f6f={};var _0x327cd0={'count':0x0,'rows':[]};return db[_0x88a8('0x43')]['findOne']({'where':{'id':_0x173adc[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x3392d0,null))[_0x88a8('0x10')](function(_0x1bd395){if(_0x1bd395){_0x196f6f[_0x88a8('0x46')]=_[_0x88a8('0x48')](db[_0x88a8('0x68')][_0x88a8('0x44')]);_0x196f6f[_0x88a8('0x49')]=_[_0x88a8('0x48')](_0x173adc['query']);_0x196f6f['filters']=_[_0x88a8('0x4c')](_0x196f6f[_0x88a8('0x46')],_0x196f6f[_0x88a8('0x49')]);_0x5c4f41[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0x196f6f[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0x173adc[_0x88a8('0x49')]['fields']));_0x5c4f41[_0x88a8('0x4b')]=_0x5c4f41['attributes'][_0x88a8('0x4e')]?_0x5c4f41[_0x88a8('0x4b')]:_0x196f6f[_0x88a8('0x46')];if(!_0x173adc[_0x88a8('0x49')][_0x88a8('0x4f')](_0x88a8('0x50'))){_0x5c4f41[_0x88a8('0x1f')]=qs[_0x88a8('0x1f')](_0x173adc['query']['limit']);_0x5c4f41[_0x88a8('0x1d')]=qs[_0x88a8('0x1d')](_0x173adc[_0x88a8('0x49')][_0x88a8('0x1d')]);}_0x5c4f41[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0x173adc[_0x88a8('0x49')][_0x88a8('0x52')]);_0x5c4f41[_0x88a8('0x55')]=qs[_0x88a8('0x4a')](_['pick'](_0x173adc[_0x88a8('0x49')],_0x196f6f[_0x88a8('0x4a')]));_0x5c4f41['where'][_0x88a8('0x67')]=_0x1bd395['id'];if(_0x173adc[_0x88a8('0x49')][_0x88a8('0x54')]){_0x5c4f41[_0x88a8('0x55')]=_[_0x88a8('0x57')](_0x5c4f41['where'],{'$or':_['map'](_0x5c4f41[_0x88a8('0x4b')],function(_0x4774be){var _0x5293aa={};_0x5293aa[_0x4774be]={'$like':'%'+_0x173adc[_0x88a8('0x49')][_0x88a8('0x54')]+'%'};return _0x5293aa;})});}_0x5c4f41=_[_0x88a8('0x57')]({},_0x5c4f41,_0x173adc[_0x88a8('0x6b')]);return db[_0x88a8('0x68')][_0x88a8('0x20')]({'where':_0x5c4f41[_0x88a8('0x55')]})[_0x88a8('0x10')](function(_0xe318e5){_0x327cd0[_0x88a8('0x20')]=_0xe318e5;if(_0x173adc['query'][_0x88a8('0x58')]){_0x5c4f41[_0x88a8('0x59')]=[{'all':!![]}];}return db[_0x88a8('0x68')]['findAll'](_0x5c4f41);})[_0x88a8('0x10')](function(_0x359224){_0x327cd0[_0x88a8('0x5b')]=_0x359224;return _0x327cd0;});}})[_0x88a8('0x10')](respondWithFilteredResult(_0x3392d0,_0x5c4f41))['catch'](handleError(_0x3392d0,null));};exports[_0x88a8('0x6c')]=function(_0x2045c0,_0x13ddf5){return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x2045c0[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x13ddf5,null))['then'](function(_0x1fec32){if(_0x1fec32){return _0x1fec32[_0x88a8('0x6c')](_0x2045c0['query']['ids']);}})[_0x88a8('0x10')](respondWithStatusCode(_0x13ddf5,null))[_0x88a8('0x5c')](handleError(_0x13ddf5,null));};exports['addAnswer']=function(_0x353baa,_0x4c898b){if(_0x353baa['body']['id']){delete _0x353baa['body']['id'];}return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x353baa[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4c898b,null))[_0x88a8('0x10')](function(_0x46778f){if(_0x46778f){_0x353baa['body'][_0x88a8('0x67')]=_0x46778f['id'];return db['CannedAnswer'][_0x88a8('0x69')](_0x353baa[_0x88a8('0x60')]);}})[_0x88a8('0x10')](respondWithResult(_0x4c898b,null))['catch'](handleError(_0x4c898b,null));};exports['getAnswers']=function(_0x20fdc0,_0x1c0aad){var _0x510426={'raw':![],'where':{}};var _0x2c9377={};var _0x43aa65={'count':0x0,'rows':[]};return db[_0x88a8('0x43')]['findOne']({'where':{'id':_0x20fdc0[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x1c0aad,null))[_0x88a8('0x10')](function(_0x3c6884){if(_0x3c6884){_0x2c9377[_0x88a8('0x46')]=_[_0x88a8('0x48')](db['CannedAnswer'][_0x88a8('0x44')]);_0x2c9377[_0x88a8('0x49')]=_[_0x88a8('0x48')](_0x20fdc0[_0x88a8('0x49')]);_0x2c9377[_0x88a8('0x4a')]=_['intersection'](_0x2c9377[_0x88a8('0x46')],_0x2c9377[_0x88a8('0x49')]);_0x510426[_0x88a8('0x4b')]=_['intersection'](_0x2c9377[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0x20fdc0['query'][_0x88a8('0x4d')]));_0x510426[_0x88a8('0x4b')]=_0x510426['attributes']['length']?_0x510426[_0x88a8('0x4b')]:_0x2c9377['model'];if(!_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x4f')](_0x88a8('0x50'))){_0x510426[_0x88a8('0x1f')]=qs['limit'](_0x20fdc0[_0x88a8('0x49')]['limit']);_0x510426[_0x88a8('0x1d')]=qs[_0x88a8('0x1d')](_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x1d')]);}_0x510426[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x52')]);_0x510426[_0x88a8('0x55')]=qs[_0x88a8('0x4a')](_['pick'](_0x20fdc0[_0x88a8('0x49')],_0x2c9377[_0x88a8('0x4a')]));_0x510426[_0x88a8('0x55')][_0x88a8('0x67')]=_0x3c6884['id'];if(_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x54')]){_0x510426['where']=_[_0x88a8('0x57')](_0x510426[_0x88a8('0x55')],{'$or':_[_0x88a8('0x47')](_0x510426[_0x88a8('0x4b')],function(_0x37f504){var _0x10389d={};_0x10389d[_0x37f504]={'$like':'%'+_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x54')]+'%'};return _0x10389d;})});}_0x510426=_[_0x88a8('0x57')]({},_0x510426,_0x20fdc0[_0x88a8('0x6b')]);return db['CannedAnswer'][_0x88a8('0x20')]({'where':_0x510426['where']})[_0x88a8('0x10')](function(_0x5c6d85){_0x43aa65[_0x88a8('0x20')]=_0x5c6d85;if(_0x20fdc0[_0x88a8('0x49')][_0x88a8('0x58')]){_0x510426[_0x88a8('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x88a8('0x5a')](_0x510426);})[_0x88a8('0x10')](function(_0x1f9fb7){_0x43aa65[_0x88a8('0x5b')]=_0x1f9fb7;return _0x43aa65;});}})[_0x88a8('0x10')](respondWithFilteredResult(_0x1c0aad,_0x510426))[_0x88a8('0x5c')](handleError(_0x1c0aad,null));};exports[_0x88a8('0x6d')]=function(_0x4820fc,_0x3ccb95){return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x4820fc[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ccb95,null))[_0x88a8('0x10')](function(_0x494359){if(_0x494359){return _0x494359['removeAnswers'](_0x4820fc[_0x88a8('0x49')]['ids']);}})[_0x88a8('0x10')](respondWithStatusCode(_0x3ccb95,null))['catch'](handleError(_0x3ccb95,null));};exports[_0x88a8('0x69')]=function(_0x47b1f8,_0xc8d119){var _0x523711={'name':_0x47b1f8[_0x88a8('0x60')]['name'],'key':_0x47b1f8['body']['key'],'provider':_0x47b1f8[_0x88a8('0x60')][_0x88a8('0x61')]===_0x88a8('0x62')?null:_0x47b1f8['body']['provider'],'email':_0x47b1f8[_0x88a8('0x60')][_0x88a8('0x6e')],'ListId':_0x47b1f8['body'][_0x88a8('0x6f')],'active':!_[_0x88a8('0x70')](_0x47b1f8[_0x88a8('0x60')][_0x88a8('0x71')])?_0x47b1f8[_0x88a8('0x60')]['active']:!![],'description':_0x47b1f8['body']['description']||null};var _0x48f7c9=getAuthenticationOptions(_0x523711[_0x88a8('0x61')],_0x47b1f8[_0x88a8('0x60')]);_0x523711[_0x88a8('0x3c')]=_0x48f7c9[_0x88a8('0x3c')];_0x523711[_0x88a8('0x3d')]=_0x48f7c9[_0x88a8('0x3d')];return db[_0x88a8('0x43')][_0x88a8('0x69')](_0x523711,{'include':[{'model':db[_0x88a8('0x40')],'as':_0x88a8('0x3d')},{'model':db[_0x88a8('0x3f')],'as':'Imap'}]})[_0x88a8('0x10')](function(_0x54e851){var _0x291d2a=_0x47b1f8['user'][_0x88a8('0x24')]({'plain':!![]});if(!_0x291d2a)throw new Error(_0x88a8('0x72'));if(_0x291d2a[_0x88a8('0x73')]===_0x88a8('0x3b')){var _0x22455a=_0x54e851[_0x88a8('0x24')]({'plain':!![]});return db[_0x88a8('0x74')][_0x88a8('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x291d2a[_0x88a8('0x75')]},'raw':!![]})['then'](function(_0x3b9442){if(_0x3b9442&&_0x3b9442[_0x88a8('0x76')]===0x0){return db[_0x88a8('0x77')][_0x88a8('0x69')]({'name':_0x22455a[_0x88a8('0x27')],'resourceId':_0x22455a['id'],'type':_0x3b9442[_0x88a8('0x27')],'sectionId':_0x3b9442['id']},{})['then'](function(){return _0x54e851;});}else{return _0x54e851;}})[_0x88a8('0x5c')](function(_0x1719f8){logger['error'](_0x88a8('0x78'),_0x1719f8);throw _0x1719f8;});}return _0x54e851;})[_0x88a8('0x10')](respondWithResult(_0xc8d119,0xc9))[_0x88a8('0x5c')](handleError(_0xc8d119,null));};exports['getImap']=function(_0x28e8d1,_0x501c5c){return db[_0x88a8('0x43')]['findOne']({'where':{'id':_0x28e8d1[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x501c5c,null))[_0x88a8('0x10')](function(_0xd29278){if(_0xd29278){return _0xd29278[_0x88a8('0x79')]();}return null;})[_0x88a8('0x10')](respondWithResult(_0x501c5c,null))[_0x88a8('0x5c')](handleError(_0x501c5c,null));};exports['addImap']=function(_0x2e37b3,_0x3cfb5e){if(_0x2e37b3[_0x88a8('0x60')]['id']){delete _0x2e37b3[_0x88a8('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2e37b3[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x3cfb5e,null))[_0x88a8('0x10')](function(_0x10a3c4){if(_0x10a3c4){_0x2e37b3[_0x88a8('0x60')][_0x88a8('0x67')]=_0x10a3c4['id'];return db[_0x88a8('0x3f')][_0x88a8('0x69')](_0x2e37b3[_0x88a8('0x60')]);}})[_0x88a8('0x10')](respondWithResult(_0x3cfb5e,null))['catch'](handleError(_0x3cfb5e,null));};exports[_0x88a8('0x7a')]=function(_0x56ce49,_0x1d3bbc){return db[_0x88a8('0x43')][_0x88a8('0x7b')]({'where':{'id':_0x56ce49[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d3bbc,null))['then'](function(_0x4ae06d){if(_0x4ae06d){return _0x4ae06d[_0x88a8('0x7c')](null);}return null;})[_0x88a8('0x10')](respondWithStatusCode(_0x1d3bbc,null))[_0x88a8('0x5c')](handleError(_0x1d3bbc,null));};exports[_0x88a8('0x7d')]=function(_0x3027c4,_0x5830ff){return db['MailAccount'][_0x88a8('0x7b')]({'where':{'id':_0x3027c4[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x5830ff,null))[_0x88a8('0x10')](function(_0x4e4138){if(_0x4e4138){return _0x4e4138['getSmtp']();}return null;})[_0x88a8('0x10')](respondWithResult(_0x5830ff,null))['catch'](handleError(_0x5830ff,null));};exports['addSmtp']=function(_0x265783,_0x2a518a){if(_0x265783[_0x88a8('0x60')]['id']){delete _0x265783[_0x88a8('0x60')]['id'];}return db['MailAccount'][_0x88a8('0x5f')]({'where':{'id':_0x265783['params']['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x2a518a,null))[_0x88a8('0x10')](function(_0x2e662d){if(_0x2e662d){_0x265783[_0x88a8('0x60')]['MailAccountId']=_0x2e662d['id'];return db[_0x88a8('0x40')]['create'](_0x265783['body']);}})[_0x88a8('0x10')](respondWithResult(_0x2a518a,null))[_0x88a8('0x5c')](handleError(_0x2a518a,null));};exports[_0x88a8('0x7e')]=function(_0x3a1bef,_0x4da4b4){return db['MailAccount']['findOne']({'where':{'id':_0x3a1bef['params']['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x4da4b4,null))[_0x88a8('0x10')](function(_0x4945a9){if(_0x4945a9){return _0x4945a9[_0x88a8('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x4da4b4,null))[_0x88a8('0x5c')](handleError(_0x4da4b4,null));};exports[_0x88a8('0x80')]=function(_0xb0029c,_0x599919){return db[_0x88a8('0x81')]['find']({'where':{'id':_0xb0029c[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x599919,null))[_0x88a8('0x10')](function(_0x18a1e9){if(_0x18a1e9){return _0x18a1e9[_0x88a8('0x80')](_0xb0029c[_0x88a8('0x60')][_0x88a8('0x82')],_[_0x88a8('0x83')](_0xb0029c[_0x88a8('0x60')],[_0x88a8('0x82'),'id'])||{});}})[_0x88a8('0x10')](respondWithResult(_0x599919,null))[_0x88a8('0x5c')](handleError(_0x599919,null));};exports['getInteractions']=function(_0x414b3d,_0x4a298c){var _0x207f12={'raw':![],'where':{}};var _0x1e2034={};var _0x36c7b5={'count':0x0,'rows':[]};return db[_0x88a8('0x43')]['findOne']({'where':{'id':_0x414b3d[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x4a298c,null))[_0x88a8('0x10')](function(_0x11b8c5){if(_0x11b8c5){_0x1e2034[_0x88a8('0x46')]=_[_0x88a8('0x48')](db['MailInteraction'][_0x88a8('0x44')]);_0x1e2034[_0x88a8('0x49')]=_['keys'](_0x414b3d[_0x88a8('0x49')]);_0x1e2034['filters']=_[_0x88a8('0x4c')](_0x1e2034['model'],_0x1e2034['query']);_0x207f12[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0x1e2034[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0x414b3d['query'][_0x88a8('0x4d')]));_0x207f12[_0x88a8('0x4b')]=_0x207f12['attributes'][_0x88a8('0x4e')]?_0x207f12[_0x88a8('0x4b')]:_0x1e2034[_0x88a8('0x46')];if(!_0x414b3d['query'][_0x88a8('0x4f')](_0x88a8('0x50'))){_0x207f12['limit']=qs[_0x88a8('0x1f')](_0x414b3d[_0x88a8('0x49')][_0x88a8('0x1f')]);_0x207f12[_0x88a8('0x1d')]=qs[_0x88a8('0x1d')](_0x414b3d['query'][_0x88a8('0x1d')]);}_0x207f12[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0x414b3d['query'][_0x88a8('0x52')]);_0x207f12[_0x88a8('0x55')]=qs[_0x88a8('0x4a')](_[_0x88a8('0x53')](_0x414b3d['query'],_0x1e2034[_0x88a8('0x4a')]));_0x207f12[_0x88a8('0x55')][_0x88a8('0x67')]=_0x11b8c5['id'];if(_0x414b3d[_0x88a8('0x49')][_0x88a8('0x54')]){_0x207f12[_0x88a8('0x55')]=_['merge'](_0x207f12[_0x88a8('0x55')],{'$or':_['map'](_0x207f12['attributes'],function(_0x2f8961){var _0x40ee60={};_0x40ee60[_0x2f8961]={'$like':'%'+_0x414b3d[_0x88a8('0x49')][_0x88a8('0x54')]+'%'};return _0x40ee60;})});}_0x207f12=_['merge']({},_0x207f12,_0x414b3d[_0x88a8('0x6b')]);return db[_0x88a8('0x81')][_0x88a8('0x20')]({'where':_0x207f12['where']})[_0x88a8('0x10')](function(_0x51a29a){_0x36c7b5[_0x88a8('0x20')]=_0x51a29a;if(_0x414b3d[_0x88a8('0x49')][_0x88a8('0x58')]){_0x207f12[_0x88a8('0x59')]=[{'model':db[_0x88a8('0x84')],'as':_0x88a8('0x85'),'required':![]},{'model':db[_0x88a8('0x86')],'as':_0x88a8('0x87'),'attributes':[_0x88a8('0x27'),_0x88a8('0x88'),'internal'],'required':![]},{'model':db[_0x88a8('0x89')],'as':'Tags','attributes':['id',_0x88a8('0x27'),'color'],'where':_0x414b3d[_0x88a8('0x49')][_0x88a8('0x8a')]?{'id':_0x414b3d[_0x88a8('0x49')][_0x88a8('0x8a')]}:undefined,'required':_0x414b3d['query']['tag']?!![]:![]}];}return db[_0x88a8('0x81')][_0x88a8('0x5a')](_0x207f12);})[_0x88a8('0x10')](function(_0x464a65){_0x36c7b5[_0x88a8('0x5b')]=_0x464a65;return _0x36c7b5;});}})[_0x88a8('0x10')](respondWithFilteredResult(_0x4a298c,_0x207f12))[_0x88a8('0x5c')](handleError(_0x4a298c,null));};exports['addApplications']=function addApplications(_0x41ac45,_0x44555f){var _0x33f7c1=_0x41ac45[_0x88a8('0x5e')]['id'];var _0x3b4fd8=_0x41ac45[_0x88a8('0x60')];var _0x2eaa33=0xc8;var _0x5ed95b=null;return db[_0x88a8('0x8b')]['transaction']({'isolationLevel':db[_0x88a8('0x8b')][_0x88a8('0x8c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3ddbb6){return db['MailAccount'][_0x88a8('0x7b')]({'where':{'id':_0x33f7c1},'transaction':_0x3ddbb6})[_0x88a8('0x10')](function(_0x2f54f2){if(_0x2f54f2){return db[_0x88a8('0x8d')][_0x88a8('0x26')]({'where':{'MailAccountId':_0x33f7c1},'transaction':_0x3ddbb6})[_0x88a8('0x10')](function(){var _0x3c6120=_[_0x88a8('0x47')](_0x3b4fd8,function(_0x43552d){_0x43552d['MailAccountId']=_0x33f7c1;return _0x43552d;});return db[_0x88a8('0x8d')][_0x88a8('0x8e')](_0x3c6120,{'transaction':_0x3ddbb6});});}else{_0x2eaa33=0x194;_0x5ed95b=[];}});})['then'](function(){if(_0x2eaa33!==0x194){return db[_0x88a8('0x8d')][_0x88a8('0x8f')]({'where':{'MailAccountId':_0x33f7c1},'order':'priority'})[_0x88a8('0x10')](function(_0x54ab6b){_0x5ed95b=_0x54ab6b;});}})[_0x88a8('0x5c')](function(_0x28afb8){_0x2eaa33=0x1f4;logger[_0x88a8('0x16')](_0x28afb8['stack']);if(_0x28afb8[_0x88a8('0x27')]){delete _0x28afb8[_0x88a8('0x27')];}_0x5ed95b=_0x28afb8;})[_0x88a8('0x90')](function(){if(_0x5ed95b===null){_0x44555f['sendStatus'](_0x2eaa33);}else{if(_0x2eaa33===0x1f4){_0x44555f[_0x88a8('0x1a')](_0x2eaa33)['send'](_0x5ed95b);}else{_0x44555f[_0x88a8('0x1a')](_0x2eaa33)[_0x88a8('0x1c')](_0x5ed95b);}}});};exports['getApplications']=function(_0x284ef0,_0x6a3345){var _0x4d3020={};var _0x301efc={};var _0x553f7c;var _0x5abbc9;return db[_0x88a8('0x43')][_0x88a8('0x7b')]({'where':{'id':_0x284ef0[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x6a3345,null))[_0x88a8('0x10')](function(_0x28ce73){if(_0x28ce73){_0x553f7c=_0x28ce73;_0x301efc[_0x88a8('0x46')]=_[_0x88a8('0x48')](db[_0x88a8('0x8d')][_0x88a8('0x44')]);_0x301efc[_0x88a8('0x49')]=_['keys'](_0x284ef0['query']);_0x301efc[_0x88a8('0x4a')]=_[_0x88a8('0x4c')](_0x301efc[_0x88a8('0x46')],_0x301efc[_0x88a8('0x49')]);_0x4d3020['attributes']=_['intersection'](_0x301efc[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0x284ef0['query'][_0x88a8('0x4d')]));_0x4d3020[_0x88a8('0x4b')]=_0x4d3020[_0x88a8('0x4b')][_0x88a8('0x4e')]?_0x4d3020[_0x88a8('0x4b')]:_0x301efc['model'];_0x4d3020['order']=qs[_0x88a8('0x52')](_0x284ef0[_0x88a8('0x49')]['sort']);_0x4d3020['where']=qs[_0x88a8('0x4a')](_[_0x88a8('0x53')](_0x284ef0[_0x88a8('0x49')],_0x301efc['filters']));if(_0x284ef0[_0x88a8('0x49')]['filter']){_0x4d3020[_0x88a8('0x55')]=_['merge'](_0x4d3020['where'],{'$or':_[_0x88a8('0x47')](_0x4d3020['attributes'],function(_0x307306){var _0x550837={};_0x550837[_0x307306]={'$like':'%'+_0x284ef0['query'][_0x88a8('0x54')]+'%'};return _0x550837;})});}_0x4d3020=_['merge']({},_0x4d3020,_0x284ef0[_0x88a8('0x6b')]);return _0x553f7c[_0x88a8('0x91')](_0x4d3020);}})[_0x88a8('0x10')](function(_0x1d2ac8){if(_0x1d2ac8){_0x5abbc9=_0x1d2ac8[_0x88a8('0x4e')];if(!_0x284ef0[_0x88a8('0x49')]['hasOwnProperty']('nolimit')){_0x4d3020[_0x88a8('0x1f')]=qs['limit'](_0x284ef0['query'][_0x88a8('0x1f')]);_0x4d3020['offset']=qs[_0x88a8('0x1d')](_0x284ef0[_0x88a8('0x49')][_0x88a8('0x1d')]);}return _0x553f7c[_0x88a8('0x91')](_0x4d3020);}})['then'](function(_0x4436f3){if(_0x4436f3){return _0x4436f3?{'count':_0x5abbc9,'rows':_0x4436f3}:null;}})[_0x88a8('0x10')](respondWithResult(_0x6a3345,null))['catch'](handleError(_0x6a3345,null));};exports['getMessages']=function(_0xa64e5f,_0x600ff8){var _0x4146c8={'raw':!![],'where':{}};var _0x5b8db2={};var _0x30a9a6={'count':0x0,'rows':[]};return db[_0x88a8('0x43')][_0x88a8('0x7b')]({'where':{'id':_0xa64e5f['params']['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x600ff8,null))[_0x88a8('0x10')](function(_0xc0f35a){if(_0xc0f35a){_0x5b8db2[_0x88a8('0x46')]=_['keys'](db['MailMessage'][_0x88a8('0x44')]);_0x5b8db2[_0x88a8('0x49')]=_[_0x88a8('0x48')](_0xa64e5f[_0x88a8('0x49')]);_0x5b8db2[_0x88a8('0x4a')]=_[_0x88a8('0x4c')](_0x5b8db2['model'],_0x5b8db2[_0x88a8('0x49')]);_0x4146c8[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0x5b8db2[_0x88a8('0x46')],qs[_0x88a8('0x4d')](_0xa64e5f['query'][_0x88a8('0x4d')]));_0x4146c8[_0x88a8('0x4b')]=_0x4146c8[_0x88a8('0x4b')]['length']?_0x4146c8[_0x88a8('0x4b')]:_0x5b8db2['model'];if(!_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x4f')]('nolimit')){_0x4146c8[_0x88a8('0x1f')]=qs[_0x88a8('0x1f')](_0xa64e5f['query'][_0x88a8('0x1f')]);_0x4146c8[_0x88a8('0x1d')]=qs[_0x88a8('0x1d')](_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x1d')]);}_0x4146c8[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x52')]);_0x4146c8[_0x88a8('0x55')]=qs[_0x88a8('0x4a')](_[_0x88a8('0x53')](_0xa64e5f[_0x88a8('0x49')],_0x5b8db2[_0x88a8('0x4a')]));_0x4146c8[_0x88a8('0x55')]['MailAccountId']=_0xc0f35a['id'];if(_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x54')]){_0x4146c8[_0x88a8('0x55')]=_[_0x88a8('0x57')](_0x4146c8[_0x88a8('0x55')],{'$or':_[_0x88a8('0x47')](_0x4146c8[_0x88a8('0x4b')],function(_0xc1164e){var _0x101269={};_0x101269[_0xc1164e]={'$like':'%'+_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x54')]+'%'};return _0x101269;})});}if(_0xa64e5f['query'][_0x88a8('0x92')]){var _0x50f9a9=_0xa64e5f[_0x88a8('0x49')]['$gte'][_0x88a8('0x93')](',');var _0x43fdd8={};_0x43fdd8[_0x50f9a9[0x0]]={'$gte':moment(_0x50f9a9[0x1])[_0x88a8('0x94')](_0x88a8('0x95'))};_0x4146c8[_0x88a8('0x55')]=_[_0x88a8('0x57')](_0x4146c8[_0x88a8('0x55')],_0x43fdd8);}_0x4146c8=_[_0x88a8('0x57')]({},_0x4146c8,_0xa64e5f[_0x88a8('0x6b')]);return db[_0x88a8('0x96')][_0x88a8('0x20')]({'where':_0x4146c8[_0x88a8('0x55')]})['then'](function(_0x5a3d73){_0x30a9a6[_0x88a8('0x20')]=_0x5a3d73;if(_0xa64e5f['query'][_0x88a8('0x58')]){_0x4146c8[_0x88a8('0x59')]=[{'all':!![]}];}return db['MailMessage'][_0x88a8('0x5a')](_0x4146c8);})[_0x88a8('0x10')](function(_0x544c29){if(_0xa64e5f[_0x88a8('0x49')][_0x88a8('0x97')]===_0x88a8('0x98')){for(var _0x515bfb=0x0;_0x515bfb<_0x544c29[_0x88a8('0x4e')];_0x515bfb++){_0x544c29[_0x515bfb]['body']=juice(_0x544c29[_0x515bfb][_0x88a8('0x60')]);}}_0x30a9a6[_0x88a8('0x5b')]=_0x544c29;return _0x30a9a6;});}})[_0x88a8('0x10')](respondWithFilteredResult(_0x600ff8,_0x4146c8))[_0x88a8('0x5c')](handleError(_0x600ff8,null));};exports[_0x88a8('0x99')]=function(_0x35234f,_0x4700ef){var _0x476b6a,_0x5605ed={},_0x39ea55;if(_0x35234f[_0x88a8('0x60')]['to']){_0x39ea55=_0x35234f['body']['to']['split'](',')[0x0];}return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x35234f['params']['id']},'include':[{'model':db[_0x88a8('0x9a')],'as':_0x88a8('0x9b'),'include':[{'model':db['CmContact'],'as':_0x88a8('0x9c'),'where':{'email':_0x39ea55},'limit':0x1,'order':[['updatedAt',_0x88a8('0x9d')]]}]},{'model':db[_0x88a8('0x40')],'as':_0x88a8('0x3d'),'raw':!![],'include':[{'model':db[_0x88a8('0x9e')],'as':_0x88a8('0x9e'),'raw':!![]}]}]})[_0x88a8('0x10')](handleEntityNotFound(_0x4700ef,null))['then'](function(_0x3b2e82){if(!_0x3b2e82)return;_0x476b6a=_0x3b2e82;if(!_0x3b2e82[_0x88a8('0x3d')])throw new Error(_0x88a8('0x9f'));if(_[_0x88a8('0x70')](_0x35234f[_0x88a8('0x60')][_0x88a8('0xa0')])){_0x35234f[_0x88a8('0x60')][_0x88a8('0xa0')]=util[_0x88a8('0x94')](_0x88a8('0xa1'),_0x3b2e82[_0x88a8('0x27')],_0x3b2e82[_0x88a8('0x6e')]||_0x3b2e82['Smtp']['user']);}if(_0x35234f[_0x88a8('0x60')]['attachments']&&_0x35234f[_0x88a8('0x60')][_0x88a8('0xa2')][_0x88a8('0x4e')]){for(var _0x1f905c=0x0;_0x1f905c<_0x35234f[_0x88a8('0x60')][_0x88a8('0xa2')]['length'];_0x1f905c+=0x1){_0x35234f['body']['attachments'][_0x1f905c]={'filename':_0x35234f[_0x88a8('0x60')][_0x88a8('0xa2')][_0x1f905c][_0x88a8('0x27')],'path':path['join'](config['root'],_0x88a8('0xa3'),_0x35234f[_0x88a8('0x60')][_0x88a8('0xa2')][_0x1f905c][_0x88a8('0xa4')])};}}var _0x4cb964=_0x3b2e82[_0x88a8('0xa5')]();return respondWithRpcPromise(_0x88a8('0xa6'),_0x88a8('0xa7'),{'account':_0x4cb964,'message':_0x35234f[_0x88a8('0x60')]});})[_0x88a8('0x10')](function(_0x424ce8){if(!_0x424ce8)return;_0x5605ed=_0x424ce8;if(!_0x476b6a[_0x88a8('0x9b')])throw new Error(_0x88a8('0xa8'));if(_0x476b6a[_0x88a8('0x9b')][_0x88a8('0x9c')][_0x88a8('0x4e')])return _0x476b6a[_0x88a8('0x9b')][_0x88a8('0x9c')][0x0];return db[_0x88a8('0x84')][_0x88a8('0x69')](_['defaults'](_0x35234f[_0x88a8('0x60')],{'firstName':_0x35234f[_0x88a8('0x60')]['to'],'email':_0x35234f[_0x88a8('0x60')]['to'],'phone':_0x35234f['body']['to'],'ListId':_0x476b6a[_0x88a8('0x6f')]}));})['then'](function(_0x3f0eb7){if(!_0x3f0eb7)return;var _0x165e15={'UserId':_0x35234f['user']['id'],'ContactId':_0x3f0eb7['id'],'MailAccountId':_0x476b6a['id'],'inReplyTo':_0x5605ed['messageId'],'to':_0x35234f['body'][_0x88a8('0xa0')],'cc':_0x35234f[_0x88a8('0x60')]['cc'],'subject':_0x35234f[_0x88a8('0x60')][_0x88a8('0xa9')],'attach':_0x35234f['body'][_0x88a8('0xaa')],'firstMsgDirection':_0x88a8('0xab'),'lastMsgAt':moment()[_0x88a8('0x94')](_0x88a8('0x95')),'lastMsgDirection':_0x88a8('0xab'),'Messages':[_[_0x88a8('0x57')](_0x35234f[_0x88a8('0x60')],{'messageId':_0x5605ed[_0x88a8('0xac')],'sentAt':moment()['format'](_0x88a8('0x95')),'read':!![],'MailAccountId':_0x476b6a['id'],'UserId':_0x35234f['user']['id'],'ContactId':_0x3f0eb7['id']})]};if(_0x35234f['body'][_0x88a8('0xad')]){_0x165e15=_[_0x88a8('0x57')](_0x165e15,_0x35234f[_0x88a8('0x60')][_0x88a8('0xad')]);}return db['MailInteraction'][_0x88a8('0x69')](_0x165e15,{'include':[{'model':db['MailMessage'],'as':_0x88a8('0xae')}]});})['then'](respondWithResult(_0x4700ef,null))[_0x88a8('0x5c')](handleError(_0x4700ef,null));};exports[_0x88a8('0xaf')]=function(_0x4eb7c5,_0x2fc15e){return db[_0x88a8('0x43')]['find']({'where':{'id':_0x4eb7c5['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x88a8('0x3d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x88a8('0x9e'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2fc15e,null))['then'](function(_0x168244){if(!_0x168244[_0x88a8('0x3d')])return;var _0x500ed8=_0x168244[_0x88a8('0xa5')]();return respondWithRpcPromise('VerifySmtp',_0x88a8('0xaf'),{'account':_0x500ed8});})[_0x88a8('0x10')](respondWithResult(_0x2fc15e,null))[_0x88a8('0x5c')](handleError(_0x2fc15e,null));};exports[_0x88a8('0x26')]=function(_0x3673e2,_0x17d49b){return db['MailAccount'][_0x88a8('0x5f')]({'where':{'id':_0x3673e2[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x17d49b,null))[_0x88a8('0x10')](function(_0x37ac82){if(_0x37ac82&&_0x37ac82[_0x88a8('0x39')]){throw new db['Sequelize'][(_0x88a8('0xb0'))](_0x88a8('0xb1'));}return _0x37ac82;})[_0x88a8('0x10')](removeEntity(_0x17d49b,null))[_0x88a8('0x5c')](handleError(_0x17d49b,null));};exports[_0x88a8('0xb2')]=function(_0x326030,_0x5a5e00){return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x326030['params']['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x5a5e00,null))[_0x88a8('0x10')](function(_0xf27ecd){if(_0xf27ecd){return _0xf27ecd['addAgents'](_0x326030[_0x88a8('0x60')]['ids'],_[_0x88a8('0x83')](_0x326030[_0x88a8('0x60')],[_0x88a8('0x82'),'id'])||{})[_0x88a8('0xb3')](function(_0x1f9055){for(var _0x5924a6=0x0;_0x5924a6<_0x326030[_0x88a8('0x60')]['ids'][_0x88a8('0x4e')];_0x5924a6+=0x1){socket[_0x88a8('0xb4')]('userMailAccount:save',{'UserId':Number(_0x326030[_0x88a8('0x60')][_0x88a8('0x82')][_0x5924a6]),'MailAccountId':Number(_0x326030[_0x88a8('0x5e')]['id'])});}return _0x1f9055;});}})['then'](respondWithResult(_0x5a5e00,null))[_0x88a8('0x5c')](handleError(_0x5a5e00,null));};exports[_0x88a8('0xb5')]=function(_0x6d2803,_0x40d1c6){return db[_0x88a8('0x43')][_0x88a8('0x5f')]({'where':{'id':_0x6d2803[_0x88a8('0x5e')]['id']}})[_0x88a8('0x10')](handleEntityNotFound(_0x40d1c6,null))[_0x88a8('0x10')](function(_0x9d626e){if(_0x9d626e){return _0x9d626e[_0x88a8('0xb5')](_0x6d2803['query'][_0x88a8('0x82')])[_0x88a8('0x10')](function(){if(_[_0x88a8('0xb6')](_0x6d2803[_0x88a8('0x49')][_0x88a8('0x82')])){for(var _0x10dbef=0x0;_0x10dbef<_0x6d2803[_0x88a8('0x49')][_0x88a8('0x82')]['length'];_0x10dbef+=0x1){socket[_0x88a8('0xb4')](_0x88a8('0xb7'),{'UserId':Number(_0x6d2803['query']['ids'][_0x10dbef]),'MailAccountId':Number(_0x6d2803[_0x88a8('0x5e')]['id'])});}}else{socket[_0x88a8('0xb4')](_0x88a8('0xb7'),{'UserId':Number(_0x6d2803[_0x88a8('0x49')][_0x88a8('0x82')]),'MailAccountId':Number(_0x6d2803[_0x88a8('0x5e')]['id'])});}});}})[_0x88a8('0x10')](respondWithStatusCode(_0x40d1c6,null))[_0x88a8('0x5c')](handleError(_0x40d1c6,null));};exports[_0x88a8('0xb8')]=function(_0x427155,_0xaca841){var _0x218d96={};var _0x3e124e={};var _0x2b7d51;var _0x3a63d;return db['MailAccount']['findOne']({'where':{'id':_0x427155[_0x88a8('0x5e')]['id']}})['then'](handleEntityNotFound(_0xaca841,null))[_0x88a8('0x10')](function(_0x3f3c0d){if(_0x3f3c0d){_0x2b7d51=_0x3f3c0d;_0x3e124e[_0x88a8('0x46')]=_[_0x88a8('0x48')](db['User'][_0x88a8('0x44')]);_0x3e124e[_0x88a8('0x49')]=_['keys'](_0x427155[_0x88a8('0x49')]);_0x3e124e[_0x88a8('0x4a')]=_[_0x88a8('0x4c')](_0x3e124e[_0x88a8('0x46')],_0x3e124e[_0x88a8('0x49')]);_0x218d96[_0x88a8('0x4b')]=_[_0x88a8('0x4c')](_0x3e124e[_0x88a8('0x46')],qs['fields'](_0x427155[_0x88a8('0x49')][_0x88a8('0x4d')]));_0x218d96[_0x88a8('0x4b')]=_0x218d96[_0x88a8('0x4b')][_0x88a8('0x4e')]?_0x218d96[_0x88a8('0x4b')]:_0x3e124e['model'];_0x218d96[_0x88a8('0x51')]=qs[_0x88a8('0x52')](_0x427155[_0x88a8('0x49')][_0x88a8('0x52')]);_0x218d96[_0x88a8('0x55')]=qs[_0x88a8('0x4a')](_[_0x88a8('0x53')](_0x427155[_0x88a8('0x49')],_0x3e124e['filters']));if(_0x427155[_0x88a8('0x49')][_0x88a8('0x54')]){_0x218d96['where']=_[_0x88a8('0x57')](_0x218d96[_0x88a8('0x55')],{'$or':_[_0x88a8('0x47')](_0x218d96['attributes'],function(_0x4d439b){var _0x3790ba={};_0x3790ba[_0x4d439b]={'$like':'%'+_0x427155['query'][_0x88a8('0x54')]+'%'};return _0x3790ba;})});}_0x218d96=_[_0x88a8('0x57')]({},_0x218d96,_0x427155[_0x88a8('0x6b')]);return _0x2b7d51[_0x88a8('0xb8')](_0x218d96);}})[_0x88a8('0x10')](function(_0x5b24d9){if(_0x5b24d9){_0x3a63d=_0x5b24d9[_0x88a8('0x4e')];if(!_0x427155[_0x88a8('0x49')][_0x88a8('0x4f')](_0x88a8('0x50'))){_0x218d96[_0x88a8('0x1f')]=qs[_0x88a8('0x1f')](_0x427155[_0x88a8('0x49')][_0x88a8('0x1f')]);_0x218d96['offset']=qs[_0x88a8('0x1d')](_0x427155['query'][_0x88a8('0x1d')]);}return _0x2b7d51[_0x88a8('0xb8')](_0x218d96);}})[_0x88a8('0x10')](function(_0x4d31c4){if(_0x4d31c4){return _0x4d31c4?{'count':_0x3a63d,'rows':_0x4d31c4}:null;}})[_0x88a8('0x10')](respondWithResult(_0xaca841,null))[_0x88a8('0x5c')](handleError(_0xaca841,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 336eeb4..a0da35e 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 _0xc82c=['save','update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc82c,0x125));var _0xcc82=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc82c[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0xcc82('0x0'));var MailAccount=require(_0xcc82('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcc82('0x2')](0x0);var events={'afterCreate':_0xcc82('0x3'),'afterUpdate':_0xcc82('0x4'),'afterDestroy':_0xcc82('0x5')};function emitEvent(_0xbe69ef){return function(_0x574cc9,_0x51717f,_0x5be0a2){MailAccountEvents[_0xcc82('0x6')](_0xbe69ef+':'+_0x574cc9['id'],_0x574cc9);MailAccountEvents[_0xcc82('0x6')](_0xbe69ef,_0x574cc9);_0x5be0a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xcc82('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xcef7=['update','emit','hook','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x764005,_0x1bcef7){var _0x2571bf=function(_0x1327c8){while(--_0x1327c8){_0x764005['push'](_0x764005['shift']());}};_0x2571bf(++_0x1bcef7);}(_0xcef7,0xe3));var _0x7cef=function(_0x311f46,_0x2765fc){_0x311f46=_0x311f46-0x0;var _0x5047f2=_0xcef7[_0x311f46];return _0x5047f2;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x7cef('0x0'))['db'][_0x7cef('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7cef('0x2')](0x0);var events={'afterCreate':_0x7cef('0x3'),'afterUpdate':_0x7cef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36948c){return function(_0x23f22f,_0x4da2ce,_0x5aaea3){MailAccountEvents[_0x7cef('0x5')](_0x36948c+':'+_0x23f22f['id'],_0x23f22f);MailAccountEvents[_0x7cef('0x5')](_0x36948c,_0x23f22f);_0x5aaea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x7cef('0x6')](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 7f3a41b..cfca198 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 _0x6971=['port','secure','modernAuthentication','CloudProvider','OAuth2','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','custom','service','provider','host','Smtp'];(function(_0x4329ad,_0x130811){var _0xfe8f61=function(_0x33f3d2){while(--_0x33f3d2){_0x4329ad['push'](_0x4329ad['shift']());}};_0xfe8f61(++_0x130811);}(_0x6971,0x87));var _0x1697=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0x6971[_0x3bc3b4];return _0x4c546b;};'use strict';var attributes=require(_0x1697('0x0'));module['exports']=function(_0xc45639){return _0xc45639[_0x1697('0x1')](_0x1697('0x2'),attributes,{'tableName':_0x1697('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5f293c=this;var _0xa73388={'id':_0x5f293c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5f293c['provider']!==_0x1697('0x4')){_0xa73388[_0x1697('0x5')]=_0x5f293c[_0x1697('0x6')];}else{_0xa73388[_0x1697('0x7')]=_0x5f293c[_0x1697('0x8')][_0x1697('0x7')];_0xa73388[_0x1697('0x9')]=_0x5f293c[_0x1697('0x8')][_0x1697('0x9')];_0xa73388[_0x1697('0xa')]=_0x5f293c[_0x1697('0x8')][_0x1697('0xa')];}if(_0x5f293c['Smtp']['authentication']){if(_0x5f293c['Smtp'][_0x1697('0xb')]){if(!_0x5f293c[_0x1697('0x8')][_0x1697('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xa73388['auth']={'type':_0x1697('0xd'),'user':_0x5f293c[_0x1697('0x8')]['user'],'accessToken':_0x5f293c[_0x1697('0x8')][_0x1697('0xc')]['data5']};}else{_0xa73388['auth']={'user':_0x5f293c[_0x1697('0x8')][_0x1697('0xe')],'pass':_0x5f293c[_0x1697('0x8')][_0x1697('0xf')]};}}return _0xa73388;}}});}; \ No newline at end of file +var _0x5cd9=['secure','Smtp','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','exports','define','MailAccount','mail_accounts','provider','service','host','port'];(function(_0x5bccb9,_0x1eb18f){var _0x531ac6=function(_0x3b4b02){while(--_0x3b4b02){_0x5bccb9['push'](_0x5bccb9['shift']());}};_0x531ac6(++_0x1eb18f);}(_0x5cd9,0x128));var _0x95cd=function(_0xf2dbdb,_0x1e4877){_0xf2dbdb=_0xf2dbdb-0x0;var _0x33662f=_0x5cd9[_0xf2dbdb];return _0x33662f;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x95cd('0x0')]=function(_0x2984e0){return _0x2984e0[_0x95cd('0x1')](_0x95cd('0x2'),attributes,{'tableName':_0x95cd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a3dfa=this;var _0x4ee1f5={'id':_0x4a3dfa['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a3dfa[_0x95cd('0x4')]!=='custom'){_0x4ee1f5[_0x95cd('0x5')]=_0x4a3dfa[_0x95cd('0x4')];}else{_0x4ee1f5[_0x95cd('0x6')]=_0x4a3dfa['Smtp'][_0x95cd('0x6')];_0x4ee1f5[_0x95cd('0x7')]=_0x4a3dfa['Smtp'][_0x95cd('0x7')];_0x4ee1f5[_0x95cd('0x8')]=_0x4a3dfa[_0x95cd('0x9')][_0x95cd('0x8')];}if(_0x4a3dfa[_0x95cd('0x9')]['authentication']){if(_0x4a3dfa[_0x95cd('0x9')][_0x95cd('0xa')]){if(!_0x4a3dfa[_0x95cd('0x9')][_0x95cd('0xb')])throw new Error(_0x95cd('0xc'));_0x4ee1f5[_0x95cd('0xd')]={'type':'OAuth2','user':_0x4a3dfa[_0x95cd('0x9')][_0x95cd('0xe')],'accessToken':_0x4a3dfa['Smtp'][_0x95cd('0xb')][_0x95cd('0xf')]};}else{_0x4ee1f5['auth']={'user':_0x4a3dfa['Smtp']['user'],'pass':_0x4a3dfa['Smtp']['pass']};}}return _0x4ee1f5;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9bb2747..2867f16 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 _0x1261=['Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','UserId','unshift','agent','*,*,*,*','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailAccount.socket','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MailAccount','options','where','attributes','limit','map','include','model','ShowMailAccount','find','setDataValue','getSmtpOptions','catch','difference','keys','CmContact','rawAttributes','createdAt','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','updatedAt','MailApplication','Applications','Smtp','CloudProvider','get','omit','smtpOptions','applications','priority','asc','autoclose','push','close','length','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','format','MailInteraction','Messages','inReplyTo'];(function(_0x3f63b5,_0x461236){var _0x577d84=function(_0x2d6eba){while(--_0x2d6eba){_0x3f63b5['push'](_0x3f63b5['shift']());}};_0x577d84(++_0x461236);}(_0x1261,0x144));var _0x1126=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x1261[_0x8abd64];return _0xd2511e;};'use strict';var _=require('lodash');var moment=require(_0x1126('0x0'));var BPromise=require(_0x1126('0x1'));var rs=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var db=require(_0x1126('0x4'))['db'];var logger=require(_0x1126('0x5'))(_0x1126('0x6'));var config=require(_0x1126('0x7'));var jayson=require(_0x1126('0x8'));var client=jayson[_0x1126('0x9')]['http']({'port':0x232c});config['redis']=_[_0x1126('0xa')](config[_0x1126('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1126('0xc'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xd'))[_0x1126('0xe')](socket);function respondWithRpcPromise(_0x2d9033,_0x59cfa1,_0x3f09ac){return new BPromise(function(_0x18dbe6,_0x167ef1){return client['request'](_0x2d9033,_0x3f09ac)[_0x1126('0xf')](function(_0x5d581b){logger['info'](_0x1126('0x10'),_0x59cfa1,'request\x20sent');logger[_0x1126('0x11')](_0x1126('0x12'),_0x59cfa1,_0x1126('0x13'),JSON[_0x1126('0x14')](_0x5d581b));if(_0x5d581b[_0x1126('0x15')]){if(_0x5d581b[_0x1126('0x15')][_0x1126('0x16')]===0x1f4){logger[_0x1126('0x15')](_0x1126('0x10'),_0x59cfa1,_0x5d581b['error']['message']);return _0x167ef1(_0x5d581b[_0x1126('0x15')][_0x1126('0x17')]);}logger[_0x1126('0x15')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x5d581b[_0x1126('0x15')]['message']);return _0x18dbe6(_0x5d581b[_0x1126('0x15')][_0x1126('0x17')]);}else{logger[_0x1126('0x18')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x1126('0x13'));_0x18dbe6(_0x5d581b[_0x1126('0x19')]['message']);}})['catch'](function(_0x22ae0b){logger[_0x1126('0x15')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x22ae0b);_0x167ef1(_0x22ae0b);});});}exports['GetMailAccount']=function(_0x4564c0){var _0x58b109=this;return new Promise(function(_0x22ed37,_0x1d6d19){return db[_0x1126('0x1a')]['findAll']({'raw':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4564c0[_0x1126('0x1b')]?_0x4564c0[_0x1126('0x1b')][_0x1126('0x1c')]||null:null,'attributes':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options'][_0x1126('0x1d')]||null:null,'limit':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options'][_0x1126('0x1e')]||null:null,'include':_0x4564c0['options']?_0x4564c0['options']['include']?_[_0x1126('0x1f')](_0x4564c0[_0x1126('0x1b')][_0x1126('0x20')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x21')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1d')],'include':_0x34bcf1[_0x1126('0x20')]?_[_0x1126('0x1f')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x21')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1d')],'include':_0x35eec3['include']?_['map'](_0x35eec3[_0x1126('0x20')],function(_0x39bf0e){return{'model':db[_0x39bf0e['model']],'as':_0x39bf0e['as'],'attributes':_0x39bf0e[_0x1126('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1126('0xf')](function(_0x4a334a){logger[_0x1126('0x18')]('GetMailAccount',_0x4564c0);logger[_0x1126('0x11')]('GetMailAccount',_0x4564c0,JSON[_0x1126('0x14')](_0x4a334a));_0x22ed37(_0x4a334a);})['catch'](function(_0x378f4d){logger['error']('GetMailAccount',_0x378f4d['message'],_0x4564c0);_0x1d6d19(_0x58b109[_0x1126('0x15')](0x1f4,_0x378f4d[_0x1126('0x17')]));});});};exports[_0x1126('0x22')]=function(_0x5b8bea){var _0x2a3055=this;return new Promise(function(_0x226afb,_0x56f7f8){return db[_0x1126('0x1a')][_0x1126('0x23')]({'raw':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5b8bea['options']?_0x5b8bea[_0x1126('0x1b')][_0x1126('0x1c')]||null:null,'attributes':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')]['attributes']||null:null,'include':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')][_0x1126('0x20')]?_[_0x1126('0x1f')](_0x5b8bea[_0x1126('0x1b')]['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x21')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1d')],'include':_0x2a0dfe[_0x1126('0x20')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x21')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes'],'include':_0x22827a[_0x1126('0x20')]?_[_0x1126('0x1f')](_0x22827a[_0x1126('0x20')],function(_0x5c08b9){return{'model':db[_0x5c08b9['model']],'as':_0x5c08b9['as'],'attributes':_0x5c08b9[_0x1126('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1126('0xf')](function(_0x3aa08f){if(_0x5b8bea[_0x1126('0x1b')]['smtp']===!![])_0x3aa08f[_0x1126('0x24')]('smtpOptions',_0x3aa08f[_0x1126('0x25')]());logger[_0x1126('0x18')](_0x1126('0x22'),_0x5b8bea);logger[_0x1126('0x11')](_0x1126('0x22'),_0x5b8bea,JSON['stringify'](_0x3aa08f));_0x226afb(_0x3aa08f);})[_0x1126('0x26')](function(_0x3ea9de){logger[_0x1126('0x15')](_0x1126('0x22'),_0x3ea9de[_0x1126('0x17')],_0x5b8bea);_0x56f7f8(_0x2a3055[_0x1126('0x15')](0x1f4,_0x3ea9de[_0x1126('0x17')]));});});};exports['NotifyMailAccount']=function(_0x1c8d8a){var _0x154c28=this;return new Promise(function(_0x227a6b,_0xf3a0bd){var _0xcf0483={'body':_0x1c8d8a['body'],'channel':'mail'};var _0x1c4f06=_[_0x1126('0x27')](_[_0x1126('0x28')](db[_0x1126('0x29')][_0x1126('0x2a')]),[_0x1126('0x2b'),'updatedAt','CompanyId','ListId']);var _0xb8054e=![];if(_0x1c8d8a['body']['id']){delete _0x1c8d8a[_0x1126('0x2c')]['id'];}if(_[_0x1126('0x2d')](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2e')])){return _0xf3a0bd(_0x154c28['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x1126('0x2d')](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2c')])||_0x1c8d8a['body'][_0x1126('0x2c')]===''){return _0xf3a0bd(_0x154c28['error'](0x1f4,_0x1126('0x2f')));}if(_['isNil'](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x30')])){return _0xf3a0bd(_0x154c28[_0x1126('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4f06));}if(!_[_0x1126('0x31')](_0x1c4f06,_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x30')])){return _0xf3a0bd(_0x154c28['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4f06));}var _0x4dd7f5={};_0x4dd7f5[_0x1c8d8a[_0x1126('0x2c')]['mapKey']]=_0x1c8d8a[_0x1126('0x2c')]['from'];return db[_0x1126('0x1a')][_0x1126('0x23')]({'where':{'id':_0x1c8d8a[_0x1126('0x32')]['id']},'include':[{'model':db[_0x1126('0x33')],'as':_0x1126('0x34'),'include':[{'model':db['CmContact'],'as':_0x1126('0x35'),'where':_0x4dd7f5,'limit':0x1,'order':[[_0x1126('0x36'),'DESC']]}]},{'model':db[_0x1126('0x37')],'as':_0x1126('0x38')},{'model':db['MailServerOut'],'as':_0x1126('0x39'),'include':[{'model':db[_0x1126('0x3a')],'as':'CloudProvider'}]}]})[_0x1126('0xf')](function(_0xbdde58){if(_0xbdde58&&_0xbdde58[_0x1126('0x34')]){var _0x59656d=_0xbdde58[_0x1126('0x3b')]({'plain':!![]});_0xcf0483[_0x1126('0x32')]=_[_0x1126('0x3c')](_0x59656d,[_0x1126('0x38'),_0x1126('0x34')]);_0xcf0483[_0x1126('0x32')][_0x1126('0x3d')]=_0xbdde58[_0x1126('0x25')]();_0xcf0483['applications']=_0x59656d[_0x1126('0x38')];_0xcf0483['list']=_0x59656d[_0x1126('0x34')];_0xcf0483[_0x1126('0x3e')]=_['orderBy'](_0xcf0483['applications'],[_0x1126('0x3f')],[_0x1126('0x40')]);if(_0xcf0483[_0x1126('0x32')]&&_0xcf0483['account'][_0x1126('0x41')]){_0xcf0483[_0x1126('0x3e')][_0x1126('0x42')]({'id':0x0,'priority':_0xcf0483[_0x1126('0x3e')]['length']+0x1,'app':_0x1126('0x43'),'appdata':_0x1126('0x41'),'interval':'*,*,*,*'});}if(_0xcf0483['account']['Applications']){delete _0xcf0483['account'][_0x1126('0x38')];}if(_0xcf0483[_0x1126('0x32')]['List']){delete _0xcf0483[_0x1126('0x32')][_0x1126('0x34')];}if(_0x59656d[_0x1126('0x34')][_0x1126('0x35')][_0x1126('0x44')]){return _0x59656d['List'][_0x1126('0x35')][0x0];}var _0x267592=_['defaults'](_0x1c8d8a[_0x1126('0x2c')],{'firstName':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2e')],'ListId':_0x59656d[_0x1126('0x45')]});_0x267592[_0x1c8d8a[_0x1126('0x2c')]['mapKey']]=_0x1c8d8a[_0x1126('0x2c')]['from'];return db[_0x1126('0x29')][_0x1126('0x46')](_0x267592);}else{throw new Error(_0x1126('0x47'));}})['then'](function(_0x427add){_0xcf0483[_0x1126('0x48')]=_0x427add;if(_0x427add){if(!_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x49')]){_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x49')]=rs[_0x1126('0x4a')]()+'\x20'+_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')];}var _0x26949c={'ContactId':_0x427add['id'],'MailAccountId':_0x1c8d8a[_0x1126('0x32')]['id'],'inReplyTo':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x49')],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')],'cc':_0x1c8d8a[_0x1126('0x2c')]['message']['cc'],'subject':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['subject'],'attach':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x4b')],'lastMsgAt':moment()[_0x1126('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x1126('0x4d')][_0x1126('0x23')]({'where':{'closed':![],'MailAccountId':_0x1c8d8a[_0x1126('0x32')]['id']},'include':[{'model':db['MailMessage'],'as':_0x1126('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x4f')]}}]})[_0x1126('0xf')](function(_0x1230e9){if(_0x1230e9){return[_0x1230e9,![]];}return db[_0x1126('0x4d')][_0x1126('0x46')](_0x26949c)[_0x1126('0xf')](function(_0x5036d4){return[_0x5036d4,!![]];});});}else{throw new Error(_0x1126('0x50'));}})[_0x1126('0x51')](function(_0x116867,_0xc39c36){if(_0x116867){_0xb8054e=_0xc39c36;if(!_0xc39c36){return _0x116867[_0x1126('0x52')]({'inReplyTo':_0x1c8d8a[_0x1126('0x2c')]['message']['messageId'],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['from'],'cc':_0x1c8d8a['body']['message']['cc'],'subject':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x53')],'attach':_0x116867[_0x1126('0x4b')]?_0x116867['attach']:_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x4b')],'substatus':null,'substatusAt':moment()[_0x1126('0x4c')](_0x1126('0x54')),'lastMsgAt':moment()[_0x1126('0x4c')](_0x1126('0x54')),'lastMsgDirection':'in'});}else{return _0x116867;}}})['then'](function(_0x339aa6){_0xcf0483[_0x1126('0x55')]=_0x339aa6[_0x1126('0x3b')]({'plain':!![]});_0xcf0483[_0x1126('0x55')][_0x1126('0x56')]=_0xb8054e;return db['MailMessage']['create']({'body':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2c')],'MailAccountId':_0x1c8d8a['account']['id'],'MailInteractionId':_0x339aa6['id'],'direction':'in','ContactId':_0xcf0483[_0x1126('0x48')]['id'],'messageId':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x49')],'from':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['to'],'cc':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['cc'],'subject':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['subject'],'attach':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x4b')],'Attachments':_0x1c8d8a['body']['message'][_0x1126('0x57')],'originTo':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x58')],'originCc':_0x1c8d8a['body']['message']['originCc'],'bcc':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x59')],'ChatWebsiteId':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x5a')]||null,'originChannel':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x5b')]||_0x1126('0x5c'),'ChatOfflineMessageId':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x5d')]||null},{'include':[{'model':db[_0x1126('0x5e')],'as':'Attachments'}]});})[_0x1126('0xf')](function(_0x57ece2){_0xcf0483[_0x1126('0x17')]=_0x57ece2;if(_0xcf0483[_0x1126('0x55')]['UserId']){return db[_0x1126('0x5f')][_0x1126('0x23')]({'attributes':['id','name'],'where':{'id':_0xcf0483[_0x1126('0x55')][_0x1126('0x60')]}})['then'](function(_0x561647){if(_0x561647){_0xcf0483[_0x1126('0x3e')][_0x1126('0x61')]({'id':0x0,'priority':0x0,'app':_0x1126('0x62'),'appdata':_0x561647['name']+','+(_0xcf0483['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1126('0x63')});}return respondWithRpcPromise('Start','startRouting',_0xcf0483);});}return respondWithRpcPromise(_0x1126('0x64'),'startRouting',_0xcf0483);})[_0x1126('0xf')](function(_0x288a0c){_0x227a6b(_0x288a0c);})['catch'](function(_0x133075){_0xf3a0bd(_0x154c28[_0x1126('0x15')](0x1f4,_0x133075[_0x1126('0x17')]));});});}; \ No newline at end of file +var _0x66fa=['ShowMailAccount','smtp','getSmtpOptions','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','Applications','MailServerOut','Smtp','List','get','omit','smtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch'];(function(_0xe37b5,_0x5ef854){var _0x2b09ab=function(_0x23ab27){while(--_0x23ab27){_0xe37b5['push'](_0xe37b5['shift']());}};_0x2b09ab(++_0x5ef854);}(_0x66fa,0x117));var _0xa66f=function(_0x72d6ab,_0x2cf665){_0x72d6ab=_0x72d6ab-0x0;var _0x5b7fe9=_0x66fa[_0x72d6ab];return _0x5b7fe9;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var logger=require(_0xa66f('0x5'))(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var jayson=require(_0xa66f('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0xa66f('0x9')]=_[_0xa66f('0xa')](config[_0xa66f('0x9')],{'host':_0xa66f('0xb'),'port':0x18eb});var socket=require(_0xa66f('0xc'))(new Redis(config['redis']));require(_0xa66f('0xd'))['register'](socket);function respondWithRpcPromise(_0x46c788,_0x597c7c,_0x101e10){return new BPromise(function(_0x53ca76,_0x52d802){return client['request'](_0x46c788,_0x101e10)[_0xa66f('0xe')](function(_0x825868){logger['info'](_0xa66f('0xf'),_0x597c7c,'request\x20sent');logger[_0xa66f('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x597c7c,_0xa66f('0x11'),JSON[_0xa66f('0x12')](_0x825868));if(_0x825868[_0xa66f('0x13')]){if(_0x825868['error']['code']===0x1f4){logger[_0xa66f('0x13')]('MailAccount,\x20%s,\x20%s',_0x597c7c,_0x825868['error']['message']);return _0x52d802(_0x825868[_0xa66f('0x13')][_0xa66f('0x14')]);}logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x825868[_0xa66f('0x13')]['message']);return _0x53ca76(_0x825868['error'][_0xa66f('0x14')]);}else{logger[_0xa66f('0x15')](_0xa66f('0xf'),_0x597c7c,_0xa66f('0x11'));_0x53ca76(_0x825868['result'][_0xa66f('0x14')]);}})['catch'](function(_0x4a28d4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x4a28d4);_0x52d802(_0x4a28d4);});});}exports[_0xa66f('0x16')]=function(_0x355ddc){var _0x2c5b76=this;return new Promise(function(_0x408bc7,_0x251f60){return db[_0xa66f('0x17')][_0xa66f('0x18')]({'raw':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x355ddc['options']?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'limit':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')]['limit']||null:null,'include':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x355ddc['options']['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x1c')],'include':_0xed98b9[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1f')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x1c')],'include':_0x4683c7[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x4683c7[_0xa66f('0x1d')],function(_0x1eb86a){return{'model':db[_0x1eb86a[_0xa66f('0x1f')]],'as':_0x1eb86a['as'],'attributes':_0x1eb86a[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xe')](function(_0x45f71c){logger[_0xa66f('0x15')](_0xa66f('0x16'),_0x355ddc);logger[_0xa66f('0x10')]('GetMailAccount',_0x355ddc,JSON['stringify'](_0x45f71c));_0x408bc7(_0x45f71c);})[_0xa66f('0x20')](function(_0x27ceae){logger['error'](_0xa66f('0x16'),_0x27ceae[_0xa66f('0x14')],_0x355ddc);_0x251f60(_0x2c5b76['error'](0x1f4,_0x27ceae[_0xa66f('0x14')]));});});};exports[_0xa66f('0x21')]=function(_0x9d78d5){var _0x2c2ace=this;return new Promise(function(_0x395623,_0x548add){return db[_0xa66f('0x17')]['find']({'raw':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'include':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1f')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1d')]?_['map'](_0x35ef27[_0xa66f('0x1d')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1f')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x1c')],'include':_0x46f6cc[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x46f6cc[_0xa66f('0x1d')],function(_0xcee582){return{'model':db[_0xcee582['model']],'as':_0xcee582['as'],'attributes':_0xcee582[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4477cf){if(_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x22')]===!![])_0x4477cf['setDataValue']('smtpOptions',_0x4477cf[_0xa66f('0x23')]());logger[_0xa66f('0x15')](_0xa66f('0x21'),_0x9d78d5);logger[_0xa66f('0x10')](_0xa66f('0x21'),_0x9d78d5,JSON['stringify'](_0x4477cf));_0x395623(_0x4477cf);})['catch'](function(_0x49b869){logger[_0xa66f('0x13')]('ShowMailAccount',_0x49b869['message'],_0x9d78d5);_0x548add(_0x2c2ace['error'](0x1f4,_0x49b869[_0xa66f('0x14')]));});});};exports['NotifyMailAccount']=function(_0x8965d3){var _0x17d942=this;return new Promise(function(_0x23a546,_0x1647a0){var _0xd65c5d={'body':_0x8965d3[_0xa66f('0x24')],'channel':_0xa66f('0x25')};var _0x261089=_[_0xa66f('0x26')](_[_0xa66f('0x27')](db[_0xa66f('0x28')][_0xa66f('0x29')]),[_0xa66f('0x2a'),_0xa66f('0x2b'),'CompanyId',_0xa66f('0x2c')]);var _0x25c2cb=![];if(_0x8965d3['body']['id']){delete _0x8965d3[_0xa66f('0x24')]['id'];}if(_['isNil'](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')])){return _0x1647a0(_0x17d942['error'](0x1f4,_0xa66f('0x2e')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')]['body'])||_0x8965d3[_0xa66f('0x24')]['body']===''){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x30')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x32')+_0x261089));}if(!_['includes'](_0x261089,_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x33')+_0x261089));}var _0x374e53={};_0x374e53[_0x8965d3['body']['mapKey']]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x17')][_0xa66f('0x34')]({'where':{'id':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x36')],'as':'List','include':[{'model':db[_0xa66f('0x28')],'as':_0xa66f('0x37'),'where':_0x374e53,'limit':0x1,'order':[[_0xa66f('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xa66f('0x38')},{'model':db[_0xa66f('0x39')],'as':_0xa66f('0x3a'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x19e7ce){if(_0x19e7ce&&_0x19e7ce[_0xa66f('0x3b')]){var _0x40d3b6=_0x19e7ce[_0xa66f('0x3c')]({'plain':!![]});_0xd65c5d[_0xa66f('0x35')]=_[_0xa66f('0x3d')](_0x40d3b6,[_0xa66f('0x38'),_0xa66f('0x3b')]);_0xd65c5d['account'][_0xa66f('0x3e')]=_0x19e7ce[_0xa66f('0x23')]();_0xd65c5d[_0xa66f('0x3f')]=_0x40d3b6[_0xa66f('0x38')];_0xd65c5d[_0xa66f('0x40')]=_0x40d3b6[_0xa66f('0x3b')];_0xd65c5d['applications']=_[_0xa66f('0x41')](_0xd65c5d[_0xa66f('0x3f')],[_0xa66f('0x42')],[_0xa66f('0x43')]);if(_0xd65c5d[_0xa66f('0x35')]&&_0xd65c5d['account'][_0xa66f('0x44')]){_0xd65c5d['applications'][_0xa66f('0x45')]({'id':0x0,'priority':_0xd65c5d['applications']['length']+0x1,'app':_0xa66f('0x46'),'appdata':_0xa66f('0x44'),'interval':_0xa66f('0x47')});}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x38')]){delete _0xd65c5d[_0xa66f('0x35')]['Applications'];}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')]){delete _0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')];}if(_0x40d3b6['List'][_0xa66f('0x37')]['length']){return _0x40d3b6[_0xa66f('0x3b')][_0xa66f('0x37')][0x0];}var _0x21482f=_[_0xa66f('0xa')](_0x8965d3[_0xa66f('0x24')],{'firstName':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')],'ListId':_0x40d3b6['ListId']});_0x21482f[_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')]]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x28')][_0xa66f('0x48')](_0x21482f);}else{throw new Error(_0xa66f('0x49'));}})[_0xa66f('0xe')](function(_0x350fce){_0xd65c5d['contact']=_0x350fce;if(_0x350fce){if(!_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')]){_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')]=rs[_0xa66f('0x4b')]()+'\x20'+_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x2d')];}var _0x11c89e={'ContactId':_0x350fce['id'],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'inReplyTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x4a')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3['body']['message'][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['attach'],'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'};return db[_0xa66f('0x4f')][_0xa66f('0x34')]({'where':{'closed':![],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x50')],'as':_0xa66f('0x51'),'attributes':[_0xa66f('0x4a')],'where':{'messageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x52')]}}]})[_0xa66f('0xe')](function(_0x235e4f){if(_0x235e4f){return[_0x235e4f,![]];}return db[_0xa66f('0x4f')][_0xa66f('0x48')](_0x11c89e)[_0xa66f('0xe')](function(_0x41ffa7){return[_0x41ffa7,!![]];});});}else{throw new Error(_0xa66f('0x53'));}})['spread'](function(_0x52f22d,_0x46327d){if(_0x52f22d){_0x25c2cb=_0x46327d;if(!_0x46327d){return _0x52f22d[_0xa66f('0x54')]({'inReplyTo':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')],'to':_0x8965d3['body'][_0xa66f('0x14')]['from'],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['subject'],'attach':_0x52f22d[_0xa66f('0x55')]?_0x52f22d[_0xa66f('0x55')]:_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x55')],'substatus':null,'substatusAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'});}else{return _0x52f22d;}}})[_0xa66f('0xe')](function(_0x290323){_0xd65c5d[_0xa66f('0x56')]=_0x290323['get']({'plain':!![]});_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x57')]=_0x25c2cb;return db[_0xa66f('0x50')][_0xa66f('0x48')]({'body':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x24')],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'MailInteractionId':_0x290323['id'],'direction':'in','ContactId':_0xd65c5d[_0xa66f('0x58')]['id'],'messageId':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')],'from':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['to'],'cc':_0x8965d3[_0xa66f('0x24')]['message']['cc'],'subject':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')]['message']['attach'],'Attachments':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x59')],'originTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5a')],'originCc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5b')],'bcc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5c')],'ChatWebsiteId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5d')]||null,'originChannel':_0x8965d3[_0xa66f('0x24')]['message']['originChannel']||_0xa66f('0x5e'),'ChatOfflineMessageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xa66f('0x60')}]});})['then'](function(_0x4feda0){_0xd65c5d['message']=_0x4feda0;if(_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]){return db[_0xa66f('0x62')][_0xa66f('0x34')]({'attributes':['id',_0xa66f('0x63')],'where':{'id':_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]}})[_0xa66f('0xe')](function(_0x1ee6e0){if(_0x1ee6e0){_0xd65c5d[_0xa66f('0x3f')][_0xa66f('0x64')]({'id':0x0,'priority':0x0,'app':_0xa66f('0x65'),'appdata':_0x1ee6e0[_0xa66f('0x63')]+','+(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x66')]||0xa),'interval':_0xa66f('0x47')});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);})['then'](function(_0xc4b32b){_0x23a546(_0xc4b32b);})[_0xa66f('0x20')](function(_0x2bb4e5){_0x1647a0(_0x17d942['error'](0x1f4,_0x2bb4e5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index d79bb13..7057e45 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 _0x5d2f=['register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5d2f,0x17d));var _0xf5d2=function(_0x1a6659,_0xcc8b76){_0x1a6659=_0x1a6659-0x0;var _0x53aeb8=_0x5d2f[_0x1a6659];return _0x53aeb8;};'use strict';var MailAccountEvents=require(_0xf5d2('0x0'));var events=['save',_0xf5d2('0x1'),_0xf5d2('0x2')];function createListener(_0x8ea6b4,_0x43b6f6){return function(_0x5315dd){_0x43b6f6[_0xf5d2('0x3')](_0x8ea6b4,_0x5315dd);};}function removeListener(_0x28e2bc,_0x4be8b4){return function(){MailAccountEvents['removeListener'](_0x28e2bc,_0x4be8b4);};}exports[_0xf5d2('0x4')]=function(_0x5dbbaa){for(var _0x3095ec=0x0,_0x39a4bd=events[_0xf5d2('0x5')];_0x3095ec<_0x39a4bd;_0x3095ec++){var _0x501b04=events[_0x3095ec];var _0x2268a9=createListener(_0xf5d2('0x6')+_0x501b04,_0x5dbbaa);MailAccountEvents['on'](_0x501b04,_0x2268a9);}}; \ No newline at end of file +var _0x19f6=['./mailAccount.events','save','remove','update','register','length'];(function(_0xe6c3eb,_0xd02de7){var _0x5017c1=function(_0x5a61b1){while(--_0x5a61b1){_0xe6c3eb['push'](_0xe6c3eb['shift']());}};_0x5017c1(++_0xd02de7);}(_0x19f6,0x1ce));var _0x619f=function(_0x492145,_0x29e885){_0x492145=_0x492145-0x0;var _0x2f8f7f=_0x19f6[_0x492145];return _0x2f8f7f;};'use strict';var MailAccountEvents=require(_0x619f('0x0'));var events=[_0x619f('0x1'),_0x619f('0x2'),_0x619f('0x3')];function createListener(_0x42084e,_0x103373){return function(_0x100761){_0x103373['emit'](_0x42084e,_0x100761);};}function removeListener(_0x128f4f,_0x2eb86d){return function(){MailAccountEvents['removeListener'](_0x128f4f,_0x2eb86d);};}exports[_0x619f('0x4')]=function(_0x59b1a6){for(var _0x38b131=0x0,_0xcbfda5=events[_0x619f('0x5')];_0x38b131<_0xcbfda5;_0x38b131++){var _0x3b344a=events[_0x38b131];var _0x23f114=createListener('mailAccount:'+_0x3b344a,_0x59b1a6);MailAccountEvents['on'](_0x3b344a,_0x23f114);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 69df7b0..b3b027f 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 _0xcf5f=['put','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x239e42,_0x39bc11){var _0x47af3d=function(_0x576992){while(--_0x576992){_0x239e42['push'](_0x239e42['shift']());}};_0x47af3d(++_0x39bc11);}(_0xcf5f,0x1a6));var _0xfcf5=function(_0xf10f7c,_0x2d154d){_0xf10f7c=_0xf10f7c-0x0;var _0x1eab66=_0xcf5f[_0xf10f7c];return _0x1eab66;};'use strict';var multer=require(_0xfcf5('0x0'));var util=require('util');var path=require(_0xfcf5('0x1'));var timeout=require(_0xfcf5('0x2'));var express=require(_0xfcf5('0x3'));var router=express[_0xfcf5('0x4')]();var fs_extra=require(_0xfcf5('0x5'));var auth=require(_0xfcf5('0x6'));var interaction=require(_0xfcf5('0x7'));var config=require(_0xfcf5('0x8'));var controller=require('./mailApplication.controller');router[_0xfcf5('0x9')](_0xfcf5('0xa'),auth[_0xfcf5('0xb')](),controller['show']);router[_0xfcf5('0xc')]('/:id',auth[_0xfcf5('0xb')](),controller['update']);router[_0xfcf5('0xd')](_0xfcf5('0xa'),auth[_0xfcf5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x024a=['isAuthenticated','show','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x024a,0x167));var _0xa024=function(_0x48c808,_0x30a390){_0x48c808=_0x48c808-0x0;var _0x129989=_0x024a[_0x48c808];return _0x129989;};'use strict';var multer=require(_0xa024('0x0'));var util=require(_0xa024('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa024('0x2'));var router=express[_0xa024('0x3')]();var fs_extra=require(_0xa024('0x4'));var auth=require(_0xa024('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa024('0x6'));var controller=require(_0xa024('0x7'));router[_0xa024('0x8')]('/:id',auth[_0xa024('0x9')](),controller[_0xa024('0xa')]);router[_0xa024('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa024('0xc')]);router[_0xa024('0xd')](_0xa024('0xe'),auth[_0xa024('0x9')](),controller['destroy']);module[_0xa024('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 59b6c6a..71dfffb 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 _0x7a08=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7a08,0xfb));var _0x87a0=function(_0x3c6741,_0x24c6f0){_0x3c6741=_0x3c6741-0x0;var _0x5d3310=_0x7a08[_0x3c6741];return _0x5d3310;};'use strict';var Sequelize=require(_0x87a0('0x0'));module[_0x87a0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x87a0('0x2')],'allowNull':![],'defaultValue':_0x87a0('0x3')},'appdata':{'type':Sequelize[_0x87a0('0x4')]()},'description':{'type':Sequelize[_0x87a0('0x2')]},'interval':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':_0x87a0('0x5')}}; \ No newline at end of file +var _0xce99=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x49154f,_0x8910ae){var _0x3c3154=function(_0x334d93){while(--_0x334d93){_0x49154f['push'](_0x49154f['shift']());}};_0x3c3154(++_0x8910ae);}(_0xce99,0xbd));var _0x9ce9=function(_0x4edbd5,_0x408497){_0x4edbd5=_0x4edbd5-0x0;var _0x4200f0=_0xce99[_0x4edbd5];return _0x4200f0;};'use strict';var Sequelize=require(_0x9ce9('0x0'));module[_0x9ce9('0x1')]={'priority':{'type':Sequelize[_0x9ce9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ce9('0x3')},'appdata':{'type':Sequelize[_0x9ce9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9ce9('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0dbb6e0..0f645f5 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xaa88[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0xaa88[_0x3877c1];return _0x59056a;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5053694..130aa4b 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 _0x7884=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x60dad1,_0x44a161){var _0x512282=function(_0x23cca7){while(--_0x23cca7){_0x60dad1['push'](_0x60dad1['shift']());}};_0x512282(++_0x44a161);}(_0x7884,0x1a8));var _0x4788=function(_0x2ee08e,_0x56db49){_0x2ee08e=_0x2ee08e-0x0;var _0x156d32=_0x7884[_0x2ee08e];return _0x156d32;};'use strict';var _=require(_0x4788('0x0'));var util=require(_0x4788('0x1'));var logger=require(_0x4788('0x2'))(_0x4788('0x3'));var moment=require(_0x4788('0x4'));var BPromise=require(_0x4788('0x5'));var rp=require(_0x4788('0x6'));var fs=require('fs');var path=require(_0x4788('0x7'));var rimraf=require(_0x4788('0x8'));var config=require(_0x4788('0x9'));var attributes=require(_0x4788('0xa'));module[_0x4788('0xb')]=function(_0x59a6d5,_0x5e373b){return _0x59a6d5[_0x4788('0xc')](_0x4788('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4788('0xe'),'collate':_0x4788('0xf')});}; \ No newline at end of file +var _0x75ba=['../../config/environment','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','rimraf'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x75ba,0x132));var _0xa75b=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x75ba[_0x1663ae];return _0x30ffb8;};'use strict';var _=require(_0xa75b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa75b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa75b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa75b('0x3'));var config=require(_0xa75b('0x4'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x4b4827,_0x552e23){return _0x4b4827[_0xa75b('0x5')](_0xa75b('0x6'),attributes,{'tableName':_0xa75b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa75b('0x8'),'collate':_0xa75b('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8b4d5ad..a2a766a 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 _0x7308=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailApplication','MailApplication','update','body','options','limit','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2c1129,_0xd15223){var _0x5047aa=function(_0x170101){while(--_0x170101){_0x2c1129['push'](_0x2c1129['shift']());}};_0x5047aa(++_0xd15223);}(_0x7308,0x176));var _0x8730=function(_0x5a48c7,_0x3c47d9){_0x5a48c7=_0x5a48c7-0x0;var _0x49725d=_0x7308[_0x5a48c7];return _0x49725d;};'use strict';var _=require(_0x8730('0x0'));var util=require('util');var moment=require(_0x8730('0x1'));var BPromise=require(_0x8730('0x2'));var rs=require(_0x8730('0x3'));var fs=require('fs');var Redis=require(_0x8730('0x4'));var db=require(_0x8730('0x5'))['db'];var utils=require(_0x8730('0x6'));var logger=require('../../config/logger')(_0x8730('0x7'));var config=require(_0x8730('0x8'));var jayson=require(_0x8730('0x9'));var client=jayson[_0x8730('0xa')][_0x8730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fffa,_0x5903f9,_0xcacbca){return new BPromise(function(_0x4e394b,_0x5dca83){return client[_0x8730('0xc')](_0x29fffa,_0xcacbca)['then'](function(_0x53812b){logger[_0x8730('0xd')](_0x8730('0xe'),_0x5903f9,_0x8730('0xf'));logger[_0x8730('0x10')](_0x8730('0x11'),_0x5903f9,_0x8730('0xf'),JSON[_0x8730('0x12')](_0x53812b));if(_0x53812b[_0x8730('0x13')]){if(_0x53812b[_0x8730('0x13')]['code']===0x1f4){logger[_0x8730('0x13')](_0x8730('0xe'),_0x5903f9,_0x53812b['error'][_0x8730('0x14')]);return _0x5dca83(_0x53812b[_0x8730('0x13')][_0x8730('0x14')]);}logger['error'](_0x8730('0xe'),_0x5903f9,_0x53812b['error'][_0x8730('0x14')]);return _0x4e394b(_0x53812b[_0x8730('0x13')]['message']);}else{logger[_0x8730('0xd')]('MailApplication,\x20%s,\x20%s',_0x5903f9,'request\x20sent');_0x4e394b(_0x53812b[_0x8730('0x15')][_0x8730('0x14')]);}})['catch'](function(_0x140334){logger[_0x8730('0x13')](_0x8730('0xe'),_0x5903f9,_0x140334);_0x5dca83(_0x140334);});});}exports[_0x8730('0x16')]=function(_0x5bc096){var _0x1c93a7=this;return new Promise(function(_0x4f169f,_0x49b862){return db[_0x8730('0x17')][_0x8730('0x18')](_0x5bc096[_0x8730('0x19')],{'raw':_0x5bc096['options']?_0x5bc096[_0x8730('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bc096[_0x8730('0x1a')]?_0x5bc096['options']['where']||null:null,'attributes':_0x5bc096[_0x8730('0x1a')]?_0x5bc096[_0x8730('0x1a')]['attributes']||null:null,'limit':_0x5bc096[_0x8730('0x1a')]?_0x5bc096['options'][_0x8730('0x1b')]||null:null})[_0x8730('0x1c')](function(_0x4fbcf1){logger[_0x8730('0xd')](_0x8730('0x16'),_0x5bc096);logger['debug'](_0x8730('0x16'),_0x5bc096,JSON[_0x8730('0x12')](_0x4fbcf1));_0x4f169f(_0x4fbcf1);})[_0x8730('0x1d')](function(_0x576e59){logger[_0x8730('0x13')]('UpdateMailApplication',_0x576e59['message'],_0x5bc096);_0x49b862(_0x1c93a7[_0x8730('0x13')](0x1f4,_0x576e59[_0x8730('0x14')]));});});}; \ No newline at end of file +var _0x7179=['message','request\x20sent','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0x7179,0x143));var _0x9717=function(_0x58778b,_0x534fea){_0x58778b=_0x58778b-0x0;var _0x59b81c=_0x7179[_0x58778b];return _0x59b81c;};'use strict';var _=require(_0x9717('0x0'));var util=require(_0x9717('0x1'));var moment=require(_0x9717('0x2'));var BPromise=require(_0x9717('0x3'));var rs=require(_0x9717('0x4'));var fs=require('fs');var Redis=require(_0x9717('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9717('0x6'));var logger=require(_0x9717('0x7'))('rpc');var config=require(_0x9717('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9717('0x9')][_0x9717('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8f25e7,_0x175a8e,_0x132832){return new BPromise(function(_0x563492,_0x2d0176){return client[_0x9717('0xb')](_0x8f25e7,_0x132832)['then'](function(_0x57f3c5){logger[_0x9717('0xc')](_0x9717('0xd'),_0x175a8e,'request\x20sent');logger[_0x9717('0xe')](_0x9717('0xf'),_0x175a8e,'request\x20sent',JSON[_0x9717('0x10')](_0x57f3c5));if(_0x57f3c5[_0x9717('0x11')]){if(_0x57f3c5[_0x9717('0x11')]['code']===0x1f4){logger[_0x9717('0x11')](_0x9717('0xd'),_0x175a8e,_0x57f3c5[_0x9717('0x11')][_0x9717('0x12')]);return _0x2d0176(_0x57f3c5[_0x9717('0x11')][_0x9717('0x12')]);}logger[_0x9717('0x11')](_0x9717('0xd'),_0x175a8e,_0x57f3c5['error']['message']);return _0x563492(_0x57f3c5[_0x9717('0x11')][_0x9717('0x12')]);}else{logger[_0x9717('0xc')](_0x9717('0xd'),_0x175a8e,_0x9717('0x13'));_0x563492(_0x57f3c5[_0x9717('0x14')][_0x9717('0x12')]);}})[_0x9717('0x15')](function(_0x333cd5){logger[_0x9717('0x11')](_0x9717('0xd'),_0x175a8e,_0x333cd5);_0x2d0176(_0x333cd5);});});}exports[_0x9717('0x16')]=function(_0x3f464b){var _0x5e20c7=this;return new Promise(function(_0x2db944,_0x40341e){return db[_0x9717('0x17')][_0x9717('0x18')](_0x3f464b[_0x9717('0x19')],{'raw':_0x3f464b[_0x9717('0x1a')]?_0x3f464b[_0x9717('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f464b[_0x9717('0x1a')]?_0x3f464b[_0x9717('0x1a')][_0x9717('0x1b')]||null:null,'attributes':_0x3f464b[_0x9717('0x1a')]?_0x3f464b[_0x9717('0x1a')][_0x9717('0x1c')]||null:null,'limit':_0x3f464b['options']?_0x3f464b[_0x9717('0x1a')][_0x9717('0x1d')]||null:null})[_0x9717('0x1e')](function(_0x2cc1cc){logger['info'](_0x9717('0x16'),_0x3f464b);logger[_0x9717('0xe')](_0x9717('0x16'),_0x3f464b,JSON[_0x9717('0x10')](_0x2cc1cc));_0x2db944(_0x2cc1cc);})[_0x9717('0x15')](function(_0x37458d){logger['error'](_0x9717('0x16'),_0x37458d[_0x9717('0x12')],_0x3f464b);_0x40341e(_0x5e20c7[_0x9717('0x11')](0x1f4,_0x37458d[_0x9717('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index cdd3fd7..5fb8475 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 _0x4652=['update','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','/describe','describe','get','/:id','/:id/messages','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked'];(function(_0x43b8ce,_0x24a531){var _0xc69b1c=function(_0x19376c){while(--_0x19376c){_0x43b8ce['push'](_0x43b8ce['shift']());}};_0xc69b1c(++_0x24a531);}(_0x4652,0x1d1));var _0x2465=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4652[_0x19950b];return _0x3c6b41;};'use strict';var express=require(_0x2465('0x0'));var router=express['Router']();var auth=require(_0x2465('0x1'));var interaction=require(_0x2465('0x2'));var controller=require(_0x2465('0x3'));router['get']('/',auth[_0x2465('0x4')](),controller['index']);router['get'](_0x2465('0x5'),auth[_0x2465('0x4')](),controller[_0x2465('0x6')]);router[_0x2465('0x7')](_0x2465('0x8'),auth[_0x2465('0x4')](),controller['show']);router['get'](_0x2465('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2465('0x7')]('/:id/download',auth[_0x2465('0x4')](),controller['download']);router[_0x2465('0xa')]('/',auth[_0x2465('0x4')](),controller[_0x2465('0xb')]);router['post'](_0x2465('0x9'),auth['isAuthenticated'](),controller[_0x2465('0xc')]);router['post'](_0x2465('0xd'),auth[_0x2465('0x4')](),interaction['tracked'](_0x2465('0xe'),_0x2465('0xf')),controller['addTags']);router[_0x2465('0x10')](_0x2465('0x8'),auth[_0x2465('0x4')](),interaction[_0x2465('0x11')](_0x2465('0xe'),'mailinteraction:update'),controller[_0x2465('0x12')]);router['delete'](_0x2465('0x8'),auth[_0x2465('0x4')](),interaction[_0x2465('0x11')](_0x2465('0xe'),_0x2465('0x13')),controller[_0x2465('0x14')]);router['delete'](_0x2465('0xd'),auth[_0x2465('0x4')](),controller[_0x2465('0x15')]);module[_0x2465('0x16')]=router; \ No newline at end of file +var _0xe963=['index','/describe','describe','get','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated'];(function(_0x2114e3,_0x2c3028){var _0x6bff25=function(_0x197a39){while(--_0x197a39){_0x2114e3['push'](_0x2114e3['shift']());}};_0x6bff25(++_0x2c3028);}(_0xe963,0x156));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x3e96('0x0'));var router=express[_0x3e96('0x1')]();var auth=require(_0x3e96('0x2'));var interaction=require(_0x3e96('0x3'));var controller=require(_0x3e96('0x4'));router['get']('/',auth[_0x3e96('0x5')](),controller[_0x3e96('0x6')]);router['get'](_0x3e96('0x7'),auth[_0x3e96('0x5')](),controller[_0x3e96('0x8')]);router[_0x3e96('0x9')](_0x3e96('0xa'),auth[_0x3e96('0x5')](),controller['show']);router[_0x3e96('0x9')](_0x3e96('0xb'),auth[_0x3e96('0x5')](),controller['getMessages']);router[_0x3e96('0x9')](_0x3e96('0xc'),auth[_0x3e96('0x5')](),controller[_0x3e96('0xd')]);router[_0x3e96('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e96('0xf')]);router[_0x3e96('0xe')](_0x3e96('0xb'),auth[_0x3e96('0x5')](),controller[_0x3e96('0x10')]);router[_0x3e96('0xe')](_0x3e96('0x11'),auth['isAuthenticated'](),interaction[_0x3e96('0x12')](_0x3e96('0x13'),_0x3e96('0x14')),controller[_0x3e96('0x15')]);router[_0x3e96('0x16')](_0x3e96('0xa'),auth[_0x3e96('0x5')](),interaction[_0x3e96('0x12')](_0x3e96('0x13'),_0x3e96('0x17')),controller[_0x3e96('0x18')]);router[_0x3e96('0x19')](_0x3e96('0xa'),auth['isAuthenticated'](),interaction[_0x3e96('0x12')]('mail',_0x3e96('0x1a')),controller[_0x3e96('0x1b')]);router[_0x3e96('0x19')](_0x3e96('0x11'),auth[_0x3e96('0x5')](),controller[_0x3e96('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ca3c742..d3eccd9 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 _0xe51f=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x464965,_0x3642b0){var _0x2ac380=function(_0x3e87e3){while(--_0x3e87e3){_0x464965['push'](_0x464965['shift']());}};_0x2ac380(++_0x3642b0);}(_0xe51f,0x19b));var _0xfe51=function(_0x279dc1,_0x5c1ee1){_0x279dc1=_0x279dc1-0x0;var _0x2e5484=_0xe51f[_0x279dc1];return _0x2e5484;};'use strict';var Sequelize=require(_0xfe51('0x0'));var iconv=require(_0xfe51('0x1'));module[_0xfe51('0x2')]={'closed':{'type':Sequelize[_0xfe51('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe51('0x4')]},'disposition':{'type':Sequelize[_0xfe51('0x5')]},'secondDisposition':{'type':Sequelize[_0xfe51('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xfe51('0x5')](0x1fe)},'to':{'type':Sequelize[_0xfe51('0x5')]},'cc':{'type':Sequelize[_0xfe51('0x6')](_0xfe51('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xfe51('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfe51('0x8')]('in',_0xfe51('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfe51('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfe51('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x503b=['out','sequelize','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x503b,0x179));var _0xb503=function(_0x3a4c94,_0x5bc45a){_0x3a4c94=_0x3a4c94-0x0;var _0x2e8406=_0x503b[_0x3a4c94];return _0x2e8406;};'use strict';var Sequelize=require(_0xb503('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xb503('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb503('0x2')]},'disposition':{'type':Sequelize[_0xb503('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb503('0x3')]},'cc':{'type':Sequelize[_0xb503('0x4')](_0xb503('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb503('0x2')]},'substatus':{'type':Sequelize[_0xb503('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb503('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb503('0x6')]('in',_0xb503('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb503('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb503('0x6')]('in',_0xb503('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb503('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4a5ffbf..c1e8453 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 _0x72e4=['filters','query','fields','attributes','length','includeAll','merge','find','create','body','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','keys','intersection','hasOwnProperty','sort','where','pick','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','inlineCss','rows','addTags','spread','Tag','findAll','name','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','push','Attachment','Messages','from','subject','mkdirSync','each','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','attachments','readFileSync','build','writeFileSync','unlinkSync','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','localhost','sendStatus','status','end','json','offset','limit','count','Content-Range','update','destroy','then','error','stack','send','index','MailInteraction','rawAttributes','key','getOptions','mail','user','catch','params','model'];(function(_0x3f7f2d,_0x56477b){var _0x189c2b=function(_0x5e6e8e){while(--_0x5e6e8e){_0x3f7f2d['push'](_0x3f7f2d['shift']());}};_0x189c2b(++_0x56477b);}(_0x72e4,0x1f1));var _0x472e=function(_0x28fc7d,_0x12333e){_0x28fc7d=_0x28fc7d-0x0;var _0x24ccc7=_0x72e4[_0x28fc7d];return _0x24ccc7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x472e('0x0'));var moment=require('moment');var BPromise=require(_0x472e('0x1'));var util=require('util');var path=require(_0x472e('0x2'));var fs=require('fs');var _=require(_0x472e('0x3'));var juice=require(_0x472e('0x4'));var Redis=require(_0x472e('0x5'));var interaction=require(_0x472e('0x6'));var qs=require(_0x472e('0x7'));var logger=require(_0x472e('0x8'))(_0x472e('0x9'));var config=require(_0x472e('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x472e('0xb'));config['redis']=_['defaults'](config[_0x472e('0xc')],{'host':_0x472e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x472e('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b2e53,_0x3e9e15){_0x3e9e15=_0x3e9e15||0xcc;return function(_0x45732c){if(_0x45732c){return _0x1b2e53[_0x472e('0xe')](_0x3e9e15);}return _0x1b2e53[_0x472e('0xf')](_0x3e9e15)[_0x472e('0x10')]();};}function respondWithResult(_0x196351,_0x4577af){_0x4577af=_0x4577af||0xc8;return function(_0x4e1db7){if(_0x4e1db7){return _0x196351[_0x472e('0xf')](_0x4577af)[_0x472e('0x11')](_0x4e1db7);}};}function respondWithFilteredResult(_0x1f8efa,_0x139171){return function(_0x509757){if(_0x509757){var _0x522c70=typeof _0x139171[_0x472e('0x12')]==='undefined'&&typeof _0x139171[_0x472e('0x13')]==='undefined';var _0x144ebb=_0x509757[_0x472e('0x14')];var _0x59d409=_0x522c70?0x0:_0x139171['offset'];var _0x1b797d=_0x522c70?_0x509757['count']:_0x139171[_0x472e('0x12')]+_0x139171['limit'];var _0x51e5f4;if(_0x1b797d>=_0x144ebb){_0x1b797d=_0x144ebb;_0x51e5f4=0xc8;}else{_0x51e5f4=0xce;}_0x1f8efa['status'](_0x51e5f4);return _0x1f8efa['set'](_0x472e('0x15'),_0x59d409+'-'+_0x1b797d+'/'+_0x144ebb)['json'](_0x509757);}return null;};}function saveUpdates(_0x50d0d8){return function(_0x6931e9){if(_0x6931e9){return _0x6931e9[_0x472e('0x16')](_0x50d0d8)['then'](function(_0x131999){return _0x131999;});}return null;};}function removeEntity(_0x33eba3){return function(_0x217b99){if(_0x217b99){return _0x217b99[_0x472e('0x17')]()[_0x472e('0x18')](function(){_0x33eba3[_0x472e('0xf')](0xcc)[_0x472e('0x10')]();});}};}function handleEntityNotFound(_0x304456){return function(_0x3af9f4){if(!_0x3af9f4){_0x304456[_0x472e('0xe')](0x194);}return _0x3af9f4;};}function handleError(_0x585d0f,_0x58f591){_0x58f591=_0x58f591||0x1f4;return function(_0x45f1cc){logger[_0x472e('0x19')](_0x45f1cc[_0x472e('0x1a')]);if(_0x45f1cc['name']){delete _0x45f1cc['name'];}_0x585d0f['status'](_0x58f591)[_0x472e('0x1b')](_0x45f1cc);};}exports[_0x472e('0x1c')]=function(_0x320d6c,_0x587544){var _0x188b57={};var _0x27df01=_['map'](db[_0x472e('0x1d')][_0x472e('0x1e')],function(_0x2af0be){return{'name':_0x2af0be['fieldName'],'type':_0x2af0be['type'][_0x472e('0x1f')]};});_0x188b57=qs[_0x472e('0x20')](_0x27df01,_0x320d6c);return interaction['findAll'](_0x472e('0x21'),_0x320d6c['query'],_0x320d6c[_0x472e('0x22')],_0x188b57,_0x27df01)[_0x472e('0x18')](respondWithFilteredResult(_0x587544,_0x188b57))[_0x472e('0x23')](handleError(_0x587544,null));};exports['show']=function(_0x54f34b,_0x3e3196){var _0x380dd6={'raw':![],'where':{'id':_0x54f34b[_0x472e('0x24')]['id']}},_0x21ec92={};_0x21ec92[_0x472e('0x25')]=_['keys'](db['MailInteraction'][_0x472e('0x1e')]);_0x21ec92['query']=_['keys'](_0x54f34b['query']);_0x21ec92[_0x472e('0x26')]=_['intersection'](_0x21ec92[_0x472e('0x25')],_0x21ec92[_0x472e('0x27')]);_0x380dd6['attributes']=_['intersection'](_0x21ec92['model'],qs[_0x472e('0x28')](_0x54f34b[_0x472e('0x27')][_0x472e('0x28')]));_0x380dd6[_0x472e('0x29')]=_0x380dd6[_0x472e('0x29')][_0x472e('0x2a')]?_0x380dd6[_0x472e('0x29')]:_0x21ec92[_0x472e('0x25')];if(_0x54f34b[_0x472e('0x27')][_0x472e('0x2b')]){_0x380dd6['include']=[{'all':!![]}];}_0x380dd6=_[_0x472e('0x2c')]({},_0x380dd6,_0x54f34b['options']);return db[_0x472e('0x1d')][_0x472e('0x2d')](_0x380dd6)[_0x472e('0x18')](handleEntityNotFound(_0x3e3196,null))[_0x472e('0x18')](respondWithResult(_0x3e3196,null))[_0x472e('0x23')](handleError(_0x3e3196,null));};exports['create']=function(_0x4599da,_0x13a36f){return db['MailInteraction'][_0x472e('0x2e')](_0x4599da[_0x472e('0x2f')],{})[_0x472e('0x18')](respondWithResult(_0x13a36f,0xc9))[_0x472e('0x23')](handleError(_0x13a36f,null));};exports[_0x472e('0x16')]=function(_0x11a649,_0x3c3232){if(_0x11a649[_0x472e('0x2f')]['id']){delete _0x11a649['body']['id'];}return db[_0x472e('0x1d')]['find']({'where':{'id':_0x11a649[_0x472e('0x24')]['id']}})[_0x472e('0x18')](handleEntityNotFound(_0x3c3232,null))[_0x472e('0x18')](saveUpdates(_0x11a649[_0x472e('0x2f')],null))['then'](respondWithResult(_0x3c3232,null))[_0x472e('0x23')](handleError(_0x3c3232,null));};exports[_0x472e('0x17')]=function(_0x5c6ab1,_0x5ae04b){return db[_0x472e('0x1d')][_0x472e('0x2d')]({'where':{'id':_0x5c6ab1['params']['id']}})['then'](handleEntityNotFound(_0x5ae04b,null))['then'](removeEntity(_0x5ae04b,null))[_0x472e('0x23')](handleError(_0x5ae04b,null));};exports[_0x472e('0x30')]=function(_0x28aa87,_0x1717a8){return db[_0x472e('0x1d')]['describe']()['then'](respondWithResult(_0x1717a8,null))[_0x472e('0x23')](handleError(_0x1717a8,null));};exports['addMessage']=function(_0x574947,_0x5babb3){return db[_0x472e('0x31')][_0x472e('0x2d')]({'where':{'id':_0x574947[_0x472e('0x24')]['id']}})[_0x472e('0x18')](handleEntityNotFound(_0x5babb3,null))[_0x472e('0x18')](function(_0x17f4bf){if(_0x17f4bf){return _0x17f4bf[_0x472e('0x32')](_0x574947[_0x472e('0x2f')][_0x472e('0x33')],_[_0x472e('0x34')](_0x574947['body'],[_0x472e('0x33'),'id'])||{});}})[_0x472e('0x18')](respondWithResult(_0x5babb3,null))[_0x472e('0x23')](handleError(_0x5babb3,null));};exports[_0x472e('0x35')]=function(_0x4c1128,_0x5ed9ff){var _0x21c35e={'raw':![],'where':{}};var _0x53c2b7={};var _0x41eb45={'count':0x0,'rows':[]};return db[_0x472e('0x1d')][_0x472e('0x36')]({'where':{'id':_0x4c1128[_0x472e('0x24')]['id']}})['then'](handleEntityNotFound(_0x5ed9ff,null))['then'](function(_0x740e80){if(_0x740e80){_0x53c2b7[_0x472e('0x25')]=_[_0x472e('0x37')](db[_0x472e('0x31')][_0x472e('0x1e')]);_0x53c2b7[_0x472e('0x27')]=_[_0x472e('0x37')](_0x4c1128[_0x472e('0x27')]);_0x53c2b7[_0x472e('0x26')]=_[_0x472e('0x38')](_0x53c2b7[_0x472e('0x25')],_0x53c2b7[_0x472e('0x27')]);_0x21c35e['attributes']=_[_0x472e('0x38')](_0x53c2b7[_0x472e('0x25')],qs[_0x472e('0x28')](_0x4c1128[_0x472e('0x27')][_0x472e('0x28')]));_0x21c35e['attributes']=_0x21c35e[_0x472e('0x29')][_0x472e('0x2a')]?_0x21c35e['attributes']:_0x53c2b7[_0x472e('0x25')];if(!_0x4c1128[_0x472e('0x27')][_0x472e('0x39')]('nolimit')){_0x21c35e['limit']=qs['limit'](_0x4c1128[_0x472e('0x27')][_0x472e('0x13')]);_0x21c35e['offset']=qs[_0x472e('0x12')](_0x4c1128[_0x472e('0x27')]['offset']);}_0x21c35e['order']=qs['sort'](_0x4c1128[_0x472e('0x27')][_0x472e('0x3a')]);_0x21c35e[_0x472e('0x3b')]=qs[_0x472e('0x26')](_[_0x472e('0x3c')](_0x4c1128[_0x472e('0x27')],_0x53c2b7[_0x472e('0x26')]));_0x21c35e[_0x472e('0x3b')]['MailInteractionId']=_0x740e80['id'];if(_0x4c1128[_0x472e('0x27')][_0x472e('0x3d')]){_0x21c35e[_0x472e('0x3b')]=_[_0x472e('0x2c')](_0x21c35e[_0x472e('0x3b')],{'$or':_[_0x472e('0x3e')](_0x21c35e[_0x472e('0x29')],function(_0x1f0cb8){var _0x900a70={};_0x900a70[_0x1f0cb8]={'$like':'%'+_0x4c1128[_0x472e('0x27')][_0x472e('0x3d')]+'%'};return _0x900a70;})});}if(_0x4c1128['query'][_0x472e('0x3f')]){var _0x28a4e3=_0x4c1128[_0x472e('0x27')][_0x472e('0x3f')][_0x472e('0x40')](',');var _0x7a97bd={};_0x7a97bd[_0x28a4e3[0x0]]={'$gte':moment(_0x28a4e3[0x1])[_0x472e('0x41')](_0x472e('0x42'))};_0x21c35e[_0x472e('0x3b')]=_['merge'](_0x21c35e[_0x472e('0x3b')],_0x7a97bd);}_0x21c35e=_[_0x472e('0x2c')]({},_0x21c35e,_0x4c1128[_0x472e('0x43')]);return db[_0x472e('0x31')][_0x472e('0x14')]({'where':_0x21c35e[_0x472e('0x3b')]})[_0x472e('0x18')](function(_0x2c12f3){_0x41eb45[_0x472e('0x14')]=_0x2c12f3;if(_0x4c1128[_0x472e('0x27')][_0x472e('0x2b')]){_0x21c35e[_0x472e('0x44')]=[{'all':!![]}];}return db[_0x472e('0x31')]['findAll'](_0x21c35e);})[_0x472e('0x18')](function(_0x259897){if(_0x4c1128[_0x472e('0x27')][_0x472e('0x45')]==='true'){for(var _0x540869=0x0;_0x540869<_0x259897[_0x472e('0x2a')];_0x540869++){_0x259897[_0x540869][_0x472e('0x2f')]=juice(_0x259897[_0x540869][_0x472e('0x2f')]);}}_0x41eb45[_0x472e('0x46')]=_0x259897;return _0x41eb45;});}})['then'](respondWithFilteredResult(_0x5ed9ff,_0x21c35e))[_0x472e('0x23')](handleError(_0x5ed9ff,null));};exports[_0x472e('0x47')]=function(_0x19c39a,_0x40df19){return db[_0x472e('0x1d')][_0x472e('0x2d')]({'where':{'id':_0x19c39a['params']['id']}})['then'](handleEntityNotFound(_0x40df19,null))[_0x472e('0x18')](function(_0x10ed1d){if(_0x10ed1d){return _0x10ed1d['setTags'](_0x19c39a[_0x472e('0x2f')][_0x472e('0x33')],_[_0x472e('0x34')](_0x19c39a['body'],['ids','id'])||{})[_0x472e('0x48')](function(){return db[_0x472e('0x49')][_0x472e('0x4a')]({'attributes':['id',_0x472e('0x4b'),'color'],'where':{'id':_0x19c39a[_0x472e('0x2f')][_0x472e('0x33')]}});})[_0x472e('0x18')](function(_0x36f229){socket[_0x472e('0x4c')](_0x472e('0x4d'),{'id':Number(_0x19c39a['params']['id']),'tags':_0x36f229||[]});return{'id':Number(_0x19c39a['params']['id']),'tags':_0x36f229||[]};});}})['then'](respondWithResult(_0x40df19,null))['catch'](handleError(_0x40df19,null));};exports[_0x472e('0x4e')]=function(_0x41aadf,_0x3386bb){return db['MailInteraction'][_0x472e('0x2d')]({'where':{'id':_0x41aadf['params']['id']}})[_0x472e('0x18')](handleEntityNotFound(_0x3386bb,null))[_0x472e('0x18')](function(_0x2a452d){if(_0x2a452d){return _0x2a452d['removeTags'](_0x41aadf[_0x472e('0x27')][_0x472e('0x33')]);}})[_0x472e('0x18')](respondWithStatusCode(_0x3386bb,null))[_0x472e('0x23')](handleError(_0x3386bb,null));};exports[_0x472e('0x4f')]=function(_0x4670ea,_0x345ab0){var _0x51ba8b=moment()[_0x472e('0x50')]()[_0x472e('0x51')]();var _0x3d03f6=path[_0x472e('0x52')](config[_0x472e('0x53')],_0x472e('0x54'),_0x472e('0x55'),_0x472e('0x56'));var _0x155ad0=path[_0x472e('0x52')](config[_0x472e('0x53')],'server',_0x472e('0x55'),'attachments');var _0x12c27b=path[_0x472e('0x52')](_0x3d03f6,_0x51ba8b);var _0x1a2d0a=util[_0x472e('0x41')]('transcript-%d-%s.zip',_0x4670ea['params']['id'],_0x51ba8b);var _0x539d51=path[_0x472e('0x52')](_0x3d03f6,_0x1a2d0a);var _0x24712c=[];if(_0x4670ea[_0x472e('0x27')]['attachments']){_0x24712c[_0x472e('0x57')]({'model':db[_0x472e('0x58')],'as':'Attachments','raw':!![]});}var _0x4fe699=[{'model':db[_0x472e('0x31')],'as':_0x472e('0x59'),'attributes':['id',_0x472e('0x2f'),_0x472e('0x5a'),'to','cc','bcc',_0x472e('0x5b'),'createdAt'],'where':{'secret':![]},'order':qs[_0x472e('0x3a')]('id'),'include':_0x24712c}];return db['MailInteraction']['find']({'where':{'id':_0x4670ea[_0x472e('0x24')]['id']},'include':_0x4fe699})['then'](handleEntityNotFound(_0x345ab0,null))[_0x472e('0x18')](function(_0x32c577){if(_0x32c577&&_0x32c577[_0x472e('0x59')]){var _0x1ee2b7=_0x32c577['get']({'plain':!![]});fs[_0x472e('0x5c')](_0x12c27b);return BPromise[_0x472e('0x5d')](_0x1ee2b7[_0x472e('0x59')],function(_0x108156,_0x4a4c4d){var _0x46dccf={'from':_0x108156['from'],'to':_0x108156['to']||'missing.recipient@your.company.com','subject':_0x108156['subject'],'html':htmlEntities[_0x472e('0x5e')](_0x108156['body']),'headers':{'Date':moment(_0x108156[_0x472e('0x5f')])[_0x472e('0x41')](_0x472e('0x60'))},'attachments':[]};if(_0x108156['cc']){_0x46dccf[_0x472e('0x61')]['Cc']=_0x108156['cc'];}if(_0x108156[_0x472e('0x62')]){_0x46dccf['headers'][_0x472e('0x63')]=_0x108156[_0x472e('0x62')];}return new BPromise(function(_0x11a08e,_0x45f3a4){if(_0x108156[_0x472e('0x64')]){for(var _0x385301=0x0;_0x385301<_0x108156['Attachments']['length'];_0x385301++){var _0x3e7079=_0x108156['Attachments'][_0x385301];var _0x251e1c=path[_0x472e('0x52')](_0x155ad0,_0x3e7079['basename']);if(fs[_0x472e('0x65')](_0x251e1c)){_0x46dccf[_0x472e('0x66')][_0x472e('0x57')]({'name':_0x3e7079[_0x472e('0x4b')],'contentType':_0x3e7079['type'],'data':fs[_0x472e('0x67')](_0x251e1c)});}}}emlformat[_0x472e('0x68')](_0x46dccf,function(_0x55cafc,_0x20d950){if(_0x55cafc)return _0x45f3a4(_0x55cafc);fs[_0x472e('0x69')](path[_0x472e('0x52')](_0x12c27b,util['format']('message%d.eml',_0x4a4c4d)),_0x20d950);return _0x11a08e(_0x20d950);});});})[_0x472e('0x18')](function(){return new BPromise(function(_0x2eb3ed,_0x355a77){zipdir(_0x12c27b,{'saveTo':_0x539d51},function(_0xf9af90,_0x100e75){if(_0xf9af90)return _0x355a77(_0xf9af90);return _0x2eb3ed(_0x100e75);});})[_0x472e('0x18')](function(){return new BPromise(function(_0x54acfa,_0x3000bf){rimraf(_0x12c27b,function(_0x541922){if(_0x541922)_0x3000bf(_0x541922);return _0x54acfa();});});})[_0x472e('0x18')](function(){return _0x345ab0[_0x472e('0x4f')](_0x539d51,_0x1a2d0a,function(_0x5ca8d3){if(!_0x5ca8d3)fs[_0x472e('0x6a')](_0x539d51);});});});}else{return _0x345ab0[_0x472e('0xe')](0xc8);}})[_0x472e('0x23')](handleError(_0x345ab0,null));}; \ No newline at end of file +var _0x94a5=['build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','update','then','destroy','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','$gte','split','format','inlineCss','rows','addTags','omit','color','mailInteractionTags:save','removeTags','unix','toString','join','server','tmp','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync'];(function(_0x24be63,_0x3e955b){var _0x3aac92=function(_0x2f6ce0){while(--_0x2f6ce0){_0x24be63['push'](_0x24be63['shift']());}};_0x3aac92(++_0x3e955b);}(_0x94a5,0x1af));var _0x594a=function(_0x1f6167,_0x1257d8){_0x1f6167=_0x1f6167-0x0;var _0xabbfe0=_0x94a5[_0x1f6167];return _0xabbfe0;};'use strict';var emlformat=require(_0x594a('0x0'));var rimraf=require(_0x594a('0x1'));var zipdir=require(_0x594a('0x2'));var moment=require(_0x594a('0x3'));var BPromise=require(_0x594a('0x4'));var util=require(_0x594a('0x5'));var path=require(_0x594a('0x6'));var fs=require('fs');var _=require(_0x594a('0x7'));var juice=require(_0x594a('0x8'));var Redis=require(_0x594a('0x9'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x594a('0xa'))(_0x594a('0xb'));var config=require(_0x594a('0xc'));var db=require(_0x594a('0xd'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0x594a('0xe')],{'host':_0x594a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x594a('0xe')]));require(_0x594a('0x10'))[_0x594a('0x11')](socket);function respondWithStatusCode(_0x1e4047,_0x31c5da){_0x31c5da=_0x31c5da||0xcc;return function(_0x4d1e20){if(_0x4d1e20){return _0x1e4047[_0x594a('0x12')](_0x31c5da);}return _0x1e4047[_0x594a('0x13')](_0x31c5da)[_0x594a('0x14')]();};}function respondWithResult(_0x146164,_0x48e52d){_0x48e52d=_0x48e52d||0xc8;return function(_0x1622a6){if(_0x1622a6){return _0x146164[_0x594a('0x13')](_0x48e52d)[_0x594a('0x15')](_0x1622a6);}};}function respondWithFilteredResult(_0x51552c,_0x2940f8){return function(_0x3e3711){if(_0x3e3711){var _0x44d1e9=typeof _0x2940f8[_0x594a('0x16')]==='undefined'&&typeof _0x2940f8[_0x594a('0x17')]==='undefined';var _0x360ecb=_0x3e3711[_0x594a('0x18')];var _0x416a79=_0x44d1e9?0x0:_0x2940f8[_0x594a('0x16')];var _0x113cb8=_0x44d1e9?_0x3e3711[_0x594a('0x18')]:_0x2940f8[_0x594a('0x16')]+_0x2940f8[_0x594a('0x17')];var _0x3a0239;if(_0x113cb8>=_0x360ecb){_0x113cb8=_0x360ecb;_0x3a0239=0xc8;}else{_0x3a0239=0xce;}_0x51552c[_0x594a('0x13')](_0x3a0239);return _0x51552c['set'](_0x594a('0x19'),_0x416a79+'-'+_0x113cb8+'/'+_0x360ecb)['json'](_0x3e3711);}return null;};}function saveUpdates(_0x4a7a13){return function(_0x1e582f){if(_0x1e582f){return _0x1e582f[_0x594a('0x1a')](_0x4a7a13)[_0x594a('0x1b')](function(_0x66184f){return _0x66184f;});}return null;};}function removeEntity(_0x53e63b){return function(_0x24e6de){if(_0x24e6de){return _0x24e6de[_0x594a('0x1c')]()['then'](function(){_0x53e63b[_0x594a('0x13')](0xcc)[_0x594a('0x14')]();});}};}function handleEntityNotFound(_0xe034c1){return function(_0x580edb){if(!_0x580edb){_0xe034c1[_0x594a('0x12')](0x194);}return _0x580edb;};}function handleError(_0x161f1a,_0x72d9b8){_0x72d9b8=_0x72d9b8||0x1f4;return function(_0x568683){logger['error'](_0x568683[_0x594a('0x1d')]);if(_0x568683[_0x594a('0x1e')]){delete _0x568683[_0x594a('0x1e')];}_0x161f1a[_0x594a('0x13')](_0x72d9b8)[_0x594a('0x1f')](_0x568683);};}exports[_0x594a('0x20')]=function(_0x3a0c77,_0x45f277){var _0x553a70={};var _0x3dfe5a=_['map'](db[_0x594a('0x21')][_0x594a('0x22')],function(_0x3a8824){return{'name':_0x3a8824[_0x594a('0x23')],'type':_0x3a8824[_0x594a('0x24')][_0x594a('0x25')]};});_0x553a70=qs[_0x594a('0x26')](_0x3dfe5a,_0x3a0c77);return interaction[_0x594a('0x27')]('mail',_0x3a0c77[_0x594a('0x28')],_0x3a0c77['user'],_0x553a70,_0x3dfe5a)['then'](respondWithFilteredResult(_0x45f277,_0x553a70))[_0x594a('0x29')](handleError(_0x45f277,null));};exports[_0x594a('0x2a')]=function(_0x54c98d,_0x253ac7){var _0x14523f={'raw':![],'where':{'id':_0x54c98d[_0x594a('0x2b')]['id']}},_0x19bf85={};_0x19bf85[_0x594a('0x2c')]=_[_0x594a('0x2d')](db[_0x594a('0x21')]['rawAttributes']);_0x19bf85['query']=_[_0x594a('0x2d')](_0x54c98d['query']);_0x19bf85['filters']=_[_0x594a('0x2e')](_0x19bf85[_0x594a('0x2c')],_0x19bf85[_0x594a('0x28')]);_0x14523f[_0x594a('0x2f')]=_['intersection'](_0x19bf85['model'],qs['fields'](_0x54c98d[_0x594a('0x28')][_0x594a('0x30')]));_0x14523f[_0x594a('0x2f')]=_0x14523f[_0x594a('0x2f')][_0x594a('0x31')]?_0x14523f[_0x594a('0x2f')]:_0x19bf85['model'];if(_0x54c98d[_0x594a('0x28')][_0x594a('0x32')]){_0x14523f[_0x594a('0x33')]=[{'all':!![]}];}_0x14523f=_[_0x594a('0x34')]({},_0x14523f,_0x54c98d[_0x594a('0x35')]);return db[_0x594a('0x21')][_0x594a('0x36')](_0x14523f)['then'](handleEntityNotFound(_0x253ac7,null))[_0x594a('0x1b')](respondWithResult(_0x253ac7,null))['catch'](handleError(_0x253ac7,null));};exports['create']=function(_0x598f56,_0x15c25b){return db['MailInteraction'][_0x594a('0x37')](_0x598f56[_0x594a('0x38')],{})[_0x594a('0x1b')](respondWithResult(_0x15c25b,0xc9))[_0x594a('0x29')](handleError(_0x15c25b,null));};exports['update']=function(_0x17aba2,_0x369edd){if(_0x17aba2[_0x594a('0x38')]['id']){delete _0x17aba2['body']['id'];}return db[_0x594a('0x21')][_0x594a('0x36')]({'where':{'id':_0x17aba2['params']['id']}})[_0x594a('0x1b')](handleEntityNotFound(_0x369edd,null))[_0x594a('0x1b')](saveUpdates(_0x17aba2[_0x594a('0x38')],null))[_0x594a('0x1b')](respondWithResult(_0x369edd,null))[_0x594a('0x29')](handleError(_0x369edd,null));};exports['destroy']=function(_0x1eb047,_0x5512f9){return db[_0x594a('0x21')]['find']({'where':{'id':_0x1eb047[_0x594a('0x2b')]['id']}})[_0x594a('0x1b')](handleEntityNotFound(_0x5512f9,null))['then'](removeEntity(_0x5512f9,null))[_0x594a('0x29')](handleError(_0x5512f9,null));};exports[_0x594a('0x39')]=function(_0x50a826,_0x220481){return db[_0x594a('0x21')][_0x594a('0x39')]()['then'](respondWithResult(_0x220481,null))['catch'](handleError(_0x220481,null));};exports[_0x594a('0x3a')]=function(_0x3b4d14,_0x139a35){return db[_0x594a('0x3b')][_0x594a('0x36')]({'where':{'id':_0x3b4d14[_0x594a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x139a35,null))[_0x594a('0x1b')](function(_0x5cfe69){if(_0x5cfe69){return _0x5cfe69[_0x594a('0x3a')](_0x3b4d14[_0x594a('0x38')][_0x594a('0x3c')],_['omit'](_0x3b4d14['body'],['ids','id'])||{});}})[_0x594a('0x1b')](respondWithResult(_0x139a35,null))[_0x594a('0x29')](handleError(_0x139a35,null));};exports['getMessages']=function(_0x5bb68d,_0x5bfca4){var _0x2060f1={'raw':![],'where':{}};var _0x11a45c={};var _0x399d0d={'count':0x0,'rows':[]};return db[_0x594a('0x21')][_0x594a('0x3d')]({'where':{'id':_0x5bb68d[_0x594a('0x2b')]['id']}})[_0x594a('0x1b')](handleEntityNotFound(_0x5bfca4,null))[_0x594a('0x1b')](function(_0x2c0476){if(_0x2c0476){_0x11a45c[_0x594a('0x2c')]=_[_0x594a('0x2d')](db[_0x594a('0x3b')]['rawAttributes']);_0x11a45c[_0x594a('0x28')]=_[_0x594a('0x2d')](_0x5bb68d[_0x594a('0x28')]);_0x11a45c[_0x594a('0x3e')]=_[_0x594a('0x2e')](_0x11a45c[_0x594a('0x2c')],_0x11a45c[_0x594a('0x28')]);_0x2060f1[_0x594a('0x2f')]=_['intersection'](_0x11a45c[_0x594a('0x2c')],qs[_0x594a('0x30')](_0x5bb68d['query'][_0x594a('0x30')]));_0x2060f1[_0x594a('0x2f')]=_0x2060f1['attributes']['length']?_0x2060f1['attributes']:_0x11a45c[_0x594a('0x2c')];if(!_0x5bb68d[_0x594a('0x28')][_0x594a('0x3f')](_0x594a('0x40'))){_0x2060f1['limit']=qs[_0x594a('0x17')](_0x5bb68d[_0x594a('0x28')]['limit']);_0x2060f1[_0x594a('0x16')]=qs[_0x594a('0x16')](_0x5bb68d[_0x594a('0x28')][_0x594a('0x16')]);}_0x2060f1[_0x594a('0x41')]=qs['sort'](_0x5bb68d['query'][_0x594a('0x42')]);_0x2060f1['where']=qs[_0x594a('0x3e')](_['pick'](_0x5bb68d[_0x594a('0x28')],_0x11a45c['filters']));_0x2060f1[_0x594a('0x43')][_0x594a('0x44')]=_0x2c0476['id'];if(_0x5bb68d[_0x594a('0x28')]['filter']){_0x2060f1[_0x594a('0x43')]=_['merge'](_0x2060f1[_0x594a('0x43')],{'$or':_['map'](_0x2060f1['attributes'],function(_0x546a60){var _0x5d6c47={};_0x5d6c47[_0x546a60]={'$like':'%'+_0x5bb68d[_0x594a('0x28')]['filter']+'%'};return _0x5d6c47;})});}if(_0x5bb68d[_0x594a('0x28')][_0x594a('0x45')]){var _0x5eecd2=_0x5bb68d[_0x594a('0x28')][_0x594a('0x45')][_0x594a('0x46')](',');var _0x598429={};_0x598429[_0x5eecd2[0x0]]={'$gte':moment(_0x5eecd2[0x1])[_0x594a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2060f1[_0x594a('0x43')]=_['merge'](_0x2060f1['where'],_0x598429);}_0x2060f1=_[_0x594a('0x34')]({},_0x2060f1,_0x5bb68d['options']);return db['MailMessage'][_0x594a('0x18')]({'where':_0x2060f1[_0x594a('0x43')]})[_0x594a('0x1b')](function(_0x402a02){_0x399d0d[_0x594a('0x18')]=_0x402a02;if(_0x5bb68d[_0x594a('0x28')]['includeAll']){_0x2060f1[_0x594a('0x33')]=[{'all':!![]}];}return db['MailMessage'][_0x594a('0x27')](_0x2060f1);})['then'](function(_0x4a4cde){if(_0x5bb68d['query'][_0x594a('0x48')]==='true'){for(var _0x4d9b90=0x0;_0x4d9b90<_0x4a4cde[_0x594a('0x31')];_0x4d9b90++){_0x4a4cde[_0x4d9b90][_0x594a('0x38')]=juice(_0x4a4cde[_0x4d9b90]['body']);}}_0x399d0d[_0x594a('0x49')]=_0x4a4cde;return _0x399d0d;});}})[_0x594a('0x1b')](respondWithFilteredResult(_0x5bfca4,_0x2060f1))[_0x594a('0x29')](handleError(_0x5bfca4,null));};exports[_0x594a('0x4a')]=function(_0x31d483,_0x535fa5){return db[_0x594a('0x21')][_0x594a('0x36')]({'where':{'id':_0x31d483[_0x594a('0x2b')]['id']}})[_0x594a('0x1b')](handleEntityNotFound(_0x535fa5,null))[_0x594a('0x1b')](function(_0x33b51e){if(_0x33b51e){return _0x33b51e['setTags'](_0x31d483['body'][_0x594a('0x3c')],_[_0x594a('0x4b')](_0x31d483['body'],[_0x594a('0x3c'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x594a('0x1e'),_0x594a('0x4c')],'where':{'id':_0x31d483['body'][_0x594a('0x3c')]}});})[_0x594a('0x1b')](function(_0x2f1e11){socket['emit'](_0x594a('0x4d'),{'id':Number(_0x31d483[_0x594a('0x2b')]['id']),'tags':_0x2f1e11||[]});return{'id':Number(_0x31d483[_0x594a('0x2b')]['id']),'tags':_0x2f1e11||[]};});}})[_0x594a('0x1b')](respondWithResult(_0x535fa5,null))[_0x594a('0x29')](handleError(_0x535fa5,null));};exports[_0x594a('0x4e')]=function(_0x3b4033,_0x39b215){return db['MailInteraction'][_0x594a('0x36')]({'where':{'id':_0x3b4033[_0x594a('0x2b')]['id']}})[_0x594a('0x1b')](handleEntityNotFound(_0x39b215,null))[_0x594a('0x1b')](function(_0x58d35f){if(_0x58d35f){return _0x58d35f[_0x594a('0x4e')](_0x3b4033[_0x594a('0x28')][_0x594a('0x3c')]);}})[_0x594a('0x1b')](respondWithStatusCode(_0x39b215,null))[_0x594a('0x29')](handleError(_0x39b215,null));};exports['download']=function(_0x390be1,_0x31f349){var _0x4e6f5f=moment()[_0x594a('0x4f')]()[_0x594a('0x50')]();var _0x3a4826=path[_0x594a('0x51')](config['root'],_0x594a('0x52'),'files',_0x594a('0x53'));var _0x19e860=path[_0x594a('0x51')](config['root'],_0x594a('0x52'),_0x594a('0x54'),_0x594a('0x55'));var _0x5e0603=path['join'](_0x3a4826,_0x4e6f5f);var _0x36658d=util['format'](_0x594a('0x56'),_0x390be1['params']['id'],_0x4e6f5f);var _0x285806=path['join'](_0x3a4826,_0x36658d);var _0x799b59=[];if(_0x390be1[_0x594a('0x28')][_0x594a('0x55')]){_0x799b59[_0x594a('0x57')]({'model':db[_0x594a('0x58')],'as':_0x594a('0x59'),'raw':!![]});}var _0x2957ab=[{'model':db['MailMessage'],'as':_0x594a('0x5a'),'attributes':['id',_0x594a('0x38'),_0x594a('0x5b'),'to','cc',_0x594a('0x5c'),_0x594a('0x5d'),_0x594a('0x5e')],'where':{'secret':![]},'order':qs[_0x594a('0x42')]('id'),'include':_0x799b59}];return db[_0x594a('0x21')][_0x594a('0x36')]({'where':{'id':_0x390be1[_0x594a('0x2b')]['id']},'include':_0x2957ab})[_0x594a('0x1b')](handleEntityNotFound(_0x31f349,null))[_0x594a('0x1b')](function(_0x5fc851){if(_0x5fc851&&_0x5fc851[_0x594a('0x5a')]){var _0x4fe43f=_0x5fc851[_0x594a('0x5f')]({'plain':!![]});fs[_0x594a('0x60')](_0x5e0603);return BPromise[_0x594a('0x61')](_0x4fe43f[_0x594a('0x5a')],function(_0x56dc82,_0x1ab7f1){var _0x956dc5={'from':_0x56dc82['from'],'to':_0x56dc82['to']||_0x594a('0x62'),'subject':_0x56dc82['subject'],'html':htmlEntities[_0x594a('0x63')](_0x56dc82[_0x594a('0x38')]),'headers':{'Date':moment(_0x56dc82[_0x594a('0x5e')])[_0x594a('0x47')](_0x594a('0x64'))},'attachments':[]};if(_0x56dc82['cc']){_0x956dc5[_0x594a('0x65')]['Cc']=_0x56dc82['cc'];}if(_0x56dc82[_0x594a('0x5c')]){_0x956dc5[_0x594a('0x65')]['Bcc']=_0x56dc82[_0x594a('0x5c')];}return new BPromise(function(_0x224e65,_0x5131da){if(_0x56dc82[_0x594a('0x59')]){for(var _0x3b9142=0x0;_0x3b9142<_0x56dc82[_0x594a('0x59')][_0x594a('0x31')];_0x3b9142++){var _0xd1a715=_0x56dc82['Attachments'][_0x3b9142];var _0x5d7591=path[_0x594a('0x51')](_0x19e860,_0xd1a715[_0x594a('0x66')]);if(fs[_0x594a('0x67')](_0x5d7591)){_0x956dc5[_0x594a('0x55')]['push']({'name':_0xd1a715[_0x594a('0x1e')],'contentType':_0xd1a715[_0x594a('0x24')],'data':fs['readFileSync'](_0x5d7591)});}}}emlformat[_0x594a('0x68')](_0x956dc5,function(_0x26140b,_0x59e8f1){if(_0x26140b)return _0x5131da(_0x26140b);fs[_0x594a('0x69')](path[_0x594a('0x51')](_0x5e0603,util[_0x594a('0x47')](_0x594a('0x6a'),_0x1ab7f1)),_0x59e8f1);return _0x224e65(_0x59e8f1);});});})[_0x594a('0x1b')](function(){return new BPromise(function(_0x1b7187,_0x35b988){zipdir(_0x5e0603,{'saveTo':_0x285806},function(_0x415ba2,_0x1abd59){if(_0x415ba2)return _0x35b988(_0x415ba2);return _0x1b7187(_0x1abd59);});})['then'](function(){return new BPromise(function(_0x1ade07,_0x148c32){rimraf(_0x5e0603,function(_0x387cb6){if(_0x387cb6)_0x148c32(_0x387cb6);return _0x1ade07();});});})[_0x594a('0x1b')](function(){return _0x31f349['download'](_0x285806,_0x36658d,function(_0xfb8eab){if(!_0xfb8eab)fs['unlinkSync'](_0x285806);});});});}else{return _0x31f349[_0x594a('0x12')](0xc8);}})[_0x594a('0x29')](handleError(_0x31f349,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 89bcfcc..d3f084f 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 _0xe52d=['MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x571684,_0x1d9662){var _0x590ad0=function(_0x226284){while(--_0x226284){_0x571684['push'](_0x571684['shift']());}};_0x590ad0(++_0x1d9662);}(_0xe52d,0x19e));var _0xde52=function(_0x4223b5,_0x4f2eec){_0x4223b5=_0x4223b5-0x0;var _0x420a62=_0xe52d[_0x4223b5];return _0x420a62;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xde52('0x0')];var MailMessage=require(_0xde52('0x1'))['db'][_0xde52('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xde52('0x3')](0x0);var events={'afterCreate':_0xde52('0x4'),'afterUpdate':_0xde52('0x5'),'afterDestroy':_0xde52('0x6')};function emitEvent(_0x526588){return function(_0x3fceb2,_0x4ef6f3,_0x81243f){_0x3fceb2[_0xde52('0x7')]({'attributes':['id'],'raw':!![]})[_0xde52('0x8')](function(_0x3f8f0d){_0x3fceb2[_0xde52('0x9')]('Users',_0x3f8f0d[_0xde52('0xa')](function(_0x337606){return{'id':_0x337606['id']};}));return MailMessage[_0xde52('0xb')]({'where':{'MailInteractionId':_0x3fceb2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde52('0x8')](function(_0x405ba4){_0x3fceb2[_0xde52('0x9')](_0xde52('0xc'),_0x405ba4[_0xde52('0xd')]);MailInteractionEvents[_0xde52('0xe')](_0x526588+':'+_0x3fceb2['id'],_0x3fceb2);MailInteractionEvents[_0xde52('0xe')](_0x526588,_0x3fceb2);_0x81243f(null);})[_0xde52('0xf')](_0x81243f(null));};}for(var e in events){if(events[_0xde52('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xde52('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xe700=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save','remove','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x3dc7cd,_0x2e6995){var _0x522c09=function(_0x47b10a){while(--_0x47b10a){_0x3dc7cd['push'](_0x3dc7cd['shift']());}};_0x522c09(++_0x2e6995);}(_0xe700,0x16a));var _0x0e70=function(_0x1b6cd0,_0x131a75){_0x1b6cd0=_0x1b6cd0-0x0;var _0x3b4e09=_0xe700[_0x1b6cd0];return _0x3b4e09;};'use strict';var EventEmitter=require(_0x0e70('0x0'));var MailInteraction=require(_0x0e70('0x1'))['db'][_0x0e70('0x2')];var MailMessage=require(_0x0e70('0x1'))['db'][_0x0e70('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e70('0x4'),'afterUpdate':'update','afterDestroy':_0x0e70('0x5')};function emitEvent(_0x2cc22e){return function(_0x49d2a1,_0x5465cc,_0xf3ba11){_0x49d2a1[_0x0e70('0x6')]({'attributes':['id'],'raw':!![]})[_0x0e70('0x7')](function(_0x65a900){_0x49d2a1['setDataValue'](_0x0e70('0x8'),_0x65a900[_0x0e70('0x9')](function(_0x1a1c77){return{'id':_0x1a1c77['id']};}));return MailMessage[_0x0e70('0xa')]({'where':{'MailInteractionId':_0x49d2a1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e70('0x7')](function(_0x138187){_0x49d2a1[_0x0e70('0xb')]('unreadMessages',_0x138187[_0x0e70('0xc')]);MailInteractionEvents[_0x0e70('0xd')](_0x2cc22e+':'+_0x49d2a1['id'],_0x49d2a1);MailInteractionEvents[_0x0e70('0xd')](_0x2cc22e,_0x49d2a1);_0xf3ba11(null);})['catch'](_0xf3ba11(null));};}for(var e in events){if(events[_0x0e70('0xe')](e)){var event=events[e];MailInteraction[_0x0e70('0xf')](e,emitEvent(event));}}module[_0x0e70('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f19ac62..2d0fb73 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 _0x481f=['changed','closedAt','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x72b74a,_0x2943bb){var _0x40fa90=function(_0x4f09e6){while(--_0x4f09e6){_0x72b74a['push'](_0x72b74a['shift']());}};_0x40fa90(++_0x2943bb);}(_0x481f,0x1a1));var _0xf481=function(_0xeac19a,_0x5ed949){_0xeac19a=_0xeac19a-0x0;var _0x1364df=_0x481f[_0xeac19a];return _0x1364df;};'use strict';var _=require(_0xf481('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf481('0x1'));var BPromise=require(_0xf481('0x2'));var rp=require(_0xf481('0x3'));var fs=require('fs');var path=require(_0xf481('0x4'));var rimraf=require(_0xf481('0x5'));var config=require(_0xf481('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xf481('0x7')]=function(_0x594392,_0x1eb235){return _0x594392[_0xf481('0x8')](_0xf481('0x9'),attributes,{'tableName':_0xf481('0xa'),'paranoid':![],'indexes':[{'name':_0xf481('0xb'),'fields':[_0xf481('0xc'),'to'],'type':_0xf481('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b6ec4,_0x2d73e6,_0x316971){if(_0x5b6ec4['substatus']){_0x5b6ec4[_0xf481('0xe')]=moment()[_0xf481('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5b6ec4[_0xf481('0x10')]){_0x5b6ec4['closedAt']=moment()[_0xf481('0xf')](_0xf481('0x11'));}_0x316971(null,_0x2d73e6);},'beforeUpdate':function(_0x287675,_0x2f3eee,_0x147abe){if(_0x287675[_0xf481('0x12')]('substatus')){_0x287675['substatusAt']=_0x287675['substatus']?moment()['format'](_0xf481('0x11')):null;}if(_0x287675[_0xf481('0x12')]('closed')){_0x287675[_0xf481('0x13')]=moment()[_0xf481('0xf')](_0xf481('0x11'));_0x287675[_0xf481('0x14')]=null;_0x287675[_0xf481('0xe')]=null;}_0x147abe(null,_0x287675);},'afterUpdate':function(_0x3d7bb5,_0x66928e,_0x25df8){var _0x18616d=_0x594392[_0xf481('0x15')];var _0x467daf=_0x3d7bb5[_0xf481('0x16')]({'plain':!![]});if(_0x467daf['closed']){return _0x18616d[_0xf481('0x17')][_0xf481('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x467daf['id']}})[_0xf481('0x19')](function(){_0x25df8();})[_0xf481('0x1a')](function(_0x24548c){_0x25df8(_0x24548c);});}else{_0x25df8();}}},'charset':_0xf481('0x1b'),'collate':_0xf481('0x1c')});}; \ No newline at end of file +var _0xd3fd=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd3fd,0xeb));var _0xdd3f=function(_0x54d3ac,_0x3def91){_0x54d3ac=_0x54d3ac-0x0;var _0x3997d0=_0xd3fd[_0x54d3ac];return _0x3997d0;};'use strict';var _=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var logger=require(_0xdd3f('0x2'))(_0xdd3f('0x3'));var moment=require(_0xdd3f('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd3f('0x5'));var fs=require('fs');var path=require(_0xdd3f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd3f('0x7'));module[_0xdd3f('0x8')]=function(_0x59f21f,_0x215d0d){return _0x59f21f['define']('MailInteraction',attributes,{'tableName':_0xdd3f('0x9'),'paranoid':![],'indexes':[{'name':_0xdd3f('0xa'),'fields':['subject','to'],'type':_0xdd3f('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53f5a8,_0x18f1d9,_0x4f7ef6){if(_0x53f5a8[_0xdd3f('0xc')]){_0x53f5a8[_0xdd3f('0xd')]=moment()[_0xdd3f('0xe')](_0xdd3f('0xf'));}if(_0x53f5a8[_0xdd3f('0x10')]){_0x53f5a8['closedAt']=moment()[_0xdd3f('0xe')](_0xdd3f('0xf'));}_0x4f7ef6(null,_0x18f1d9);},'beforeUpdate':function(_0x3d3c4a,_0x8eae4a,_0x4985c5){if(_0x3d3c4a[_0xdd3f('0x11')](_0xdd3f('0xc'))){_0x3d3c4a[_0xdd3f('0xd')]=_0x3d3c4a[_0xdd3f('0xc')]?moment()[_0xdd3f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3d3c4a[_0xdd3f('0x11')](_0xdd3f('0x10'))){_0x3d3c4a['closedAt']=moment()[_0xdd3f('0xe')](_0xdd3f('0xf'));_0x3d3c4a[_0xdd3f('0xc')]=null;_0x3d3c4a['substatusAt']=null;}_0x4985c5(null,_0x3d3c4a);},'afterUpdate':function(_0x169b02,_0x450240,_0x3971c6){var _0x3cd4a2=_0x59f21f[_0xdd3f('0x12')];var _0x5218b3=_0x169b02[_0xdd3f('0x13')]({'plain':!![]});if(_0x5218b3[_0xdd3f('0x10')]){return _0x3cd4a2[_0xdd3f('0x14')][_0xdd3f('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5218b3['id']}})[_0xdd3f('0x16')](function(){_0x3971c6();})[_0xdd3f('0x17')](function(_0x38d1f5){_0x3971c6(_0x38d1f5);});}else{_0x3971c6();}}},'charset':_0xdd3f('0x18'),'collate':_0xdd3f('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 1e6c03f..b860370 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 _0x6f46=['attributes','limit','then','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MailInteraction','body','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f46,0xb8));var _0x66f4=function(_0x4f8a60,_0x2726d3){_0x4f8a60=_0x4f8a60-0x0;var _0x1d28bf=_0x6f46[_0x4f8a60];return _0x1d28bf;};'use strict';var _=require(_0x66f4('0x0'));var util=require('util');var moment=require(_0x66f4('0x1'));var BPromise=require(_0x66f4('0x2'));var rs=require(_0x66f4('0x3'));var fs=require('fs');var Redis=require(_0x66f4('0x4'));var db=require(_0x66f4('0x5'))['db'];var utils=require(_0x66f4('0x6'));var logger=require(_0x66f4('0x7'))(_0x66f4('0x8'));var config=require(_0x66f4('0x9'));var jayson=require(_0x66f4('0xa'));var client=jayson[_0x66f4('0xb')]['http']({'port':0x232a});config['redis']=_[_0x66f4('0xc')](config[_0x66f4('0xd')],{'host':_0x66f4('0xe'),'port':0x18eb});var socket=require(_0x66f4('0xf'))(new Redis(config[_0x66f4('0xd')]));require(_0x66f4('0x10'))[_0x66f4('0x11')](socket);function respondWithRpcPromise(_0x549a15,_0x5d0db9,_0x209717){return new BPromise(function(_0x2dca11,_0x41c102){return client[_0x66f4('0x12')](_0x549a15,_0x209717)['then'](function(_0x2c67a4){logger['info'](_0x66f4('0x13'),_0x5d0db9,_0x66f4('0x14'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5d0db9,_0x66f4('0x14'),JSON[_0x66f4('0x15')](_0x2c67a4));if(_0x2c67a4[_0x66f4('0x16')]){if(_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x17')]===0x1f4){logger['error'](_0x66f4('0x13'),_0x5d0db9,_0x2c67a4['error'][_0x66f4('0x18')]);return _0x41c102(_0x2c67a4[_0x66f4('0x16')]['message']);}logger[_0x66f4('0x16')](_0x66f4('0x13'),_0x5d0db9,_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x18')]);return _0x2dca11(_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x18')]);}else{logger[_0x66f4('0x19')](_0x66f4('0x13'),_0x5d0db9,'request\x20sent');_0x2dca11(_0x2c67a4[_0x66f4('0x1a')][_0x66f4('0x18')]);}})['catch'](function(_0x55a208){logger[_0x66f4('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5d0db9,_0x55a208);_0x41c102(_0x55a208);});});}exports['UpdateMailInteraction']=function(_0x555832){var _0x18c5a0=this;return new Promise(function(_0x14de0e,_0x166487){return db[_0x66f4('0x1b')]['update'](_0x555832[_0x66f4('0x1c')],{'raw':_0x555832[_0x66f4('0x1d')]?_0x555832[_0x66f4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555832['options']?_0x555832[_0x66f4('0x1d')][_0x66f4('0x1e')]||null:null,'attributes':_0x555832['options']?_0x555832[_0x66f4('0x1d')][_0x66f4('0x1f')]||null:null,'limit':_0x555832[_0x66f4('0x1d')]?_0x555832['options'][_0x66f4('0x20')]||null:null})[_0x66f4('0x21')](function(_0x28e912){logger[_0x66f4('0x19')](_0x66f4('0x22'),_0x555832);logger[_0x66f4('0x23')](_0x66f4('0x22'),_0x555832,JSON['stringify'](_0x28e912));_0x14de0e(_0x28e912);})['catch'](function(_0x2904ec){logger['error'](_0x66f4('0x22'),_0x2904ec[_0x66f4('0x18')],_0x555832);_0x166487(_0x18c5a0[_0x66f4('0x16')](0x1f4,_0x2904ec[_0x66f4('0x18')]));});});};exports[_0x66f4('0x24')]=function(_0x1d877f){return new Promise(function(_0x2b6d71,_0x464a25){return db[_0x66f4('0x1b')][_0x66f4('0x25')]({'where':_0x1d877f['options']?_0x1d877f[_0x66f4('0x1d')][_0x66f4('0x1e')]||null:null})[_0x66f4('0x21')](function(_0x428b2b){if(_0x428b2b){return _0x428b2b[_0x66f4('0x26')](_0x1d877f[_0x66f4('0x1c')]['ids'],_['omit'](_0x1d877f['body'],[_0x66f4('0x27'),'id'])||{});}})[_0x66f4('0x28')](function(_0x2d09b0){logger[_0x66f4('0x19')](_0x66f4('0x29'),_0x1d877f);logger['debug'](_0x66f4('0x29'),_0x1d877f,JSON[_0x66f4('0x15')](_0x2d09b0));_0x2b6d71(_0x2d09b0);})[_0x66f4('0x2a')](function(_0x4652af){logger[_0x66f4('0x16')](_0x66f4('0x29'),_0x4652af[_0x66f4('0x18')],_0x1d877f);_0x464a25(_this[_0x66f4('0x16')](0x1f4,_0x4652af['message']));});});}; \ No newline at end of file +var _0x04e7=['request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailInteraction','options','raw','where','attributes','UpdateMailInteraction','debug','catch','AddTagsToMailInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x3aac59,_0x10ac33){var _0x43d251=function(_0x4d962c){while(--_0x4d962c){_0x3aac59['push'](_0x3aac59['shift']());}};_0x43d251(++_0x10ac33);}(_0x04e7,0x121));var _0x704e=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x04e7[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var moment=require(_0x704e('0x2'));var BPromise=require(_0x704e('0x3'));var rs=require(_0x704e('0x4'));var fs=require('fs');var Redis=require(_0x704e('0x5'));var db=require(_0x704e('0x6'))['db'];var utils=require(_0x704e('0x7'));var logger=require(_0x704e('0x8'))(_0x704e('0x9'));var config=require(_0x704e('0xa'));var jayson=require(_0x704e('0xb'));var client=jayson['client'][_0x704e('0xc')]({'port':0x232a});config[_0x704e('0xd')]=_[_0x704e('0xe')](config[_0x704e('0xd')],{'host':_0x704e('0xf'),'port':0x18eb});var socket=require(_0x704e('0x10'))(new Redis(config[_0x704e('0xd')]));require(_0x704e('0x11'))[_0x704e('0x12')](socket);function respondWithRpcPromise(_0xc0d178,_0x1a2f74,_0x458537){return new BPromise(function(_0x48dc9b,_0x3c80dd){return client[_0x704e('0x13')](_0xc0d178,_0x458537)[_0x704e('0x14')](function(_0x42c150){logger[_0x704e('0x15')](_0x704e('0x16'),_0x1a2f74,_0x704e('0x17'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1a2f74,_0x704e('0x17'),JSON[_0x704e('0x18')](_0x42c150));if(_0x42c150[_0x704e('0x19')]){if(_0x42c150[_0x704e('0x19')][_0x704e('0x1a')]===0x1f4){logger[_0x704e('0x19')](_0x704e('0x16'),_0x1a2f74,_0x42c150[_0x704e('0x19')]['message']);return _0x3c80dd(_0x42c150[_0x704e('0x19')][_0x704e('0x1b')]);}logger[_0x704e('0x19')]('MailInteraction,\x20%s,\x20%s',_0x1a2f74,_0x42c150[_0x704e('0x19')][_0x704e('0x1b')]);return _0x48dc9b(_0x42c150[_0x704e('0x19')]['message']);}else{logger[_0x704e('0x15')](_0x704e('0x16'),_0x1a2f74,_0x704e('0x17'));_0x48dc9b(_0x42c150[_0x704e('0x1c')][_0x704e('0x1b')]);}})['catch'](function(_0x333524){logger['error'](_0x704e('0x16'),_0x1a2f74,_0x333524);_0x3c80dd(_0x333524);});});}exports['UpdateMailInteraction']=function(_0x5e0542){var _0x5bd786=this;return new Promise(function(_0x295d5a,_0x361cb7){return db[_0x704e('0x1d')]['update'](_0x5e0542['body'],{'raw':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x20')]||null:null,'attributes':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x21')]||null:null,'limit':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')]['limit']||null:null})['then'](function(_0x2bb286){logger[_0x704e('0x15')](_0x704e('0x22'),_0x5e0542);logger[_0x704e('0x23')](_0x704e('0x22'),_0x5e0542,JSON[_0x704e('0x18')](_0x2bb286));_0x295d5a(_0x2bb286);})[_0x704e('0x24')](function(_0x88eb88){logger['error'](_0x704e('0x22'),_0x88eb88[_0x704e('0x1b')],_0x5e0542);_0x361cb7(_0x5bd786[_0x704e('0x19')](0x1f4,_0x88eb88['message']));});});};exports[_0x704e('0x25')]=function(_0x510a70){return new Promise(function(_0x24829b,_0x123e61){return db[_0x704e('0x1d')][_0x704e('0x26')]({'where':_0x510a70['options']?_0x510a70['options'][_0x704e('0x20')]||null:null})['then'](function(_0x4fc8a2){if(_0x4fc8a2){return _0x4fc8a2[_0x704e('0x27')](_0x510a70[_0x704e('0x28')][_0x704e('0x29')],_[_0x704e('0x2a')](_0x510a70[_0x704e('0x28')],['ids','id'])||{});}})['spread'](function(_0x29738d){logger['info']('AddTags',_0x510a70);logger[_0x704e('0x23')](_0x704e('0x2b'),_0x510a70,JSON[_0x704e('0x18')](_0x29738d));_0x24829b(_0x29738d);})[_0x704e('0x24')](function(_0x43ad9c){logger[_0x704e('0x19')](_0x704e('0x2b'),_0x43ad9c['message'],_0x510a70);_0x123e61(_this[_0x704e('0x19')](0x1f4,_0x43ad9c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e2c2700..896e2dd 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 _0x44c6=['remove','update','emit','length','./mailInteraction.events','save'];(function(_0xb77fe1,_0x39aa4d){var _0x350e00=function(_0x405131){while(--_0x405131){_0xb77fe1['push'](_0xb77fe1['shift']());}};_0x350e00(++_0x39aa4d);}(_0x44c6,0x184));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0x644c('0x0'));var events=[_0x644c('0x1'),_0x644c('0x2'),_0x644c('0x3')];function createListener(_0x546e5d,_0x262a5e){return function(_0x532b17){_0x262a5e[_0x644c('0x4')](_0x546e5d,_0x532b17);};}function removeListener(_0x58c73b,_0x14c866){return function(){MailInteractionEvents['removeListener'](_0x58c73b,_0x14c866);};}exports['register']=function(_0x47a0cf){for(var _0x4d2058=0x0,_0x31ca79=events[_0x644c('0x5')];_0x4d2058<_0x31ca79;_0x4d2058++){var _0x5d824d=events[_0x4d2058];var _0x309ff5=createListener('mailInteraction:'+_0x5d824d,_0x47a0cf);MailInteractionEvents['on'](_0x5d824d,_0x309ff5);}}; \ No newline at end of file +var _0xbcf1=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','update'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xbcf1,0x171));var _0x1bcf=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xbcf1[_0x391c55];return _0xa434e0;};'use strict';var MailInteractionEvents=require(_0x1bcf('0x0'));var events=['save','remove',_0x1bcf('0x1')];function createListener(_0x520ee1,_0x3a9347){return function(_0x1ea468){_0x3a9347[_0x1bcf('0x2')](_0x520ee1,_0x1ea468);};}function removeListener(_0x1e1a44,_0x30f57e){return function(){MailInteractionEvents[_0x1bcf('0x3')](_0x1e1a44,_0x30f57e);};}exports[_0x1bcf('0x4')]=function(_0x1fa241){for(var _0x353cf4=0x0,_0x331733=events[_0x1bcf('0x5')];_0x353cf4<_0x331733;_0x353cf4++){var _0x5bb184=events[_0x353cf4];var _0x5548a9=createListener(_0x1bcf('0x6')+_0x5bb184,_0x1fa241);MailInteractionEvents['on'](_0x5bb184,_0x5548a9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4b3cb0f..71b3237 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 _0x84ae=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','reject','delete','destroy','exports','multer','util','path'];(function(_0x26fa67,_0x16f166){var _0x1be5ef=function(_0x409ef4){while(--_0x409ef4){_0x26fa67['push'](_0x26fa67['shift']());}};_0x1be5ef(++_0x16f166);}(_0x84ae,0x101));var _0xe84a=function(_0x526b4c,_0x10f9be){_0x526b4c=_0x526b4c-0x0;var _0xb0fca0=_0x84ae[_0x526b4c];return _0xb0fca0;};'use strict';var multer=require(_0xe84a('0x0'));var util=require(_0xe84a('0x1'));var path=require(_0xe84a('0x2'));var timeout=require(_0xe84a('0x3'));var express=require(_0xe84a('0x4'));var router=express[_0xe84a('0x5')]();var fs_extra=require(_0xe84a('0x6'));var auth=require(_0xe84a('0x7'));var interaction=require(_0xe84a('0x8'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0xe84a('0x9')](),controller['index']);router[_0xe84a('0xa')](_0xe84a('0xb'),auth[_0xe84a('0x9')](),controller[_0xe84a('0xc')]);router['get'](_0xe84a('0xd'),auth[_0xe84a('0x9')](),controller[_0xe84a('0xe')]);router['get'](_0xe84a('0xf'),auth[_0xe84a('0x9')](),controller[_0xe84a('0x10')]);router[_0xe84a('0x11')]('/',auth[_0xe84a('0x9')](),interaction[_0xe84a('0x12')]('mail',_0xe84a('0x13')),controller[_0xe84a('0x14')]);router[_0xe84a('0x15')](_0xe84a('0xd'),auth[_0xe84a('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0xe84a('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0xe84a('0x9')](),controller[_0xe84a('0x16')]);router[_0xe84a('0x17')](_0xe84a('0xd'),auth[_0xe84a('0x9')](),controller[_0xe84a('0x18')]);module[_0xe84a('0x19')]=router; \ No newline at end of file +var _0xe5fb=['tracked','mail','mailmessage:create','create','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','show','/:id/download','download','post'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xe5fb,0xce));var _0xbe5f=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xe5fb[_0x18aaaf];return _0x52d892;};'use strict';var multer=require(_0xbe5f('0x0'));var util=require(_0xbe5f('0x1'));var path=require('path');var timeout=require(_0xbe5f('0x2'));var express=require(_0xbe5f('0x3'));var router=express[_0xbe5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5f('0x5'));var interaction=require(_0xbe5f('0x6'));var config=require(_0xbe5f('0x7'));var controller=require(_0xbe5f('0x8'));router[_0xbe5f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe5f('0xa')]);router[_0xbe5f('0x9')](_0xbe5f('0xb'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0xd')]);router[_0xbe5f('0x9')]('/:id',auth[_0xbe5f('0xc')](),controller[_0xbe5f('0xe')]);router[_0xbe5f('0x9')](_0xbe5f('0xf'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0x10')]);router[_0xbe5f('0x11')]('/',auth[_0xbe5f('0xc')](),interaction[_0xbe5f('0x12')](_0xbe5f('0x13'),_0xbe5f('0x14')),controller[_0xbe5f('0x15')]);router['put'](_0xbe5f('0x16'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0x17')]);router[_0xbe5f('0x18')](_0xbe5f('0x19'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0x1a')]);router[_0xbe5f('0x18')](_0xbe5f('0x1b'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0x1c')]);router[_0xbe5f('0x1d')](_0xbe5f('0x16'),auth[_0xbe5f('0xc')](),controller[_0xbe5f('0x1e')]);module[_0xbe5f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 77feb85..7d14892 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 _0xca97=['BOOLEAN','out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','long','medium'];(function(_0x173175,_0x3532f8){var _0x413017=function(_0x4cf11e){while(--_0x4cf11e){_0x173175['push'](_0x173175['shift']());}};_0x413017(++_0x3532f8);}(_0xca97,0x7e));var _0x7ca9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xca97[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7ca9('0x0'));var _=require(_0x7ca9('0x1'));module[_0x7ca9('0x2')]={'body':{'type':Sequelize[_0x7ca9('0x3')](_0x7ca9('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7ca9('0x3')](_0x7ca9('0x5'))},'read':{'type':Sequelize[_0x7ca9('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7ca9('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7ca9('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7ca9('0x8')]},'to':{'type':Sequelize[_0x7ca9('0x3')](_0x7ca9('0x4'))},'cc':{'type':Sequelize[_0x7ca9('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x7ca9('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x7ca9('0x9')]},'attach':{'type':Sequelize[_0x7ca9('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7ca9('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7ca9('0x9')]},'originTo':{'type':Sequelize[_0x7ca9('0x3')](_0x7ca9('0x4'))},'originCc':{'type':Sequelize[_0x7ca9('0x3')](_0x7ca9('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x7ca9('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x20b0=['Email','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x577f3d,_0x43ab79){var _0x3b11f6=function(_0x4f1a61){while(--_0x4f1a61){_0x577f3d['push'](_0x577f3d['shift']());}};_0x3b11f6(++_0x43ab79);}(_0x20b0,0xb5));var _0x020b=function(_0x1e937d,_0x1b8392){_0x1e937d=_0x1e937d-0x0;var _0x47454e=_0x20b0[_0x1e937d];return _0x47454e;};'use strict';var Sequelize=require(_0x020b('0x0'));var _=require(_0x020b('0x1'));module['exports']={'body':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x4'))},'read':{'type':Sequelize[_0x020b('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x020b('0x6')]('in',_0x020b('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x020b('0x8')]},'to':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x3'))},'cc':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x3'))},'bcc':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x020b('0x9')]},'attach':{'type':Sequelize[_0x020b('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x020b('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x020b('0x9')]},'originTo':{'type':Sequelize[_0x020b('0x2')]('long')},'originCc':{'type':Sequelize[_0x020b('0x2')](_0x020b('0x3'))},'originChannel':{'type':Sequelize[_0x020b('0x6')](_0x020b('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5537f27..06a4642 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 _0x8b62=['stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','options','MailMessage','includeAll','include','rows','show','params','rawAttributes','find','update','body','describe','direction','MailAccount','findOne','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','create','defaults','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','format','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','email','SIP/%s','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','./mailMessage.socket','client','http','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x37fc0c,_0x24063e){var _0x4f4f39=function(_0x46e897){while(--_0x46e897){_0x37fc0c['push'](_0x37fc0c['shift']());}};_0x4f4f39(++_0x24063e);}(_0x8b62,0x88));var _0x28b6=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x8b62[_0x1bc0ae];return _0x501104;};'use strict';var emlformat=require(_0x28b6('0x0'));var moment=require(_0x28b6('0x1'));var BPromise=require(_0x28b6('0x2'));var util=require(_0x28b6('0x3'));var path=require(_0x28b6('0x4'));var fs=require('fs');var _=require(_0x28b6('0x5'));var Redis=require(_0x28b6('0x6'));var htmlToText=require(_0x28b6('0x7'));var qs=require(_0x28b6('0x8'));var logger=require(_0x28b6('0x9'))(_0x28b6('0xa'));var interaction_log=require(_0x28b6('0x9'))(_0x28b6('0xb'));var config=require(_0x28b6('0xc'));var db=require(_0x28b6('0xd'))['db'];config[_0x28b6('0xe')]=_['defaults'](config['redis'],{'host':_0x28b6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28b6('0xe')]));var htmlEntities=require('html-entities');require(_0x28b6('0x10'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x28b6('0x11')][_0x28b6('0x12')]({'port':0x232c});var client9003=jayson[_0x28b6('0x11')][_0x28b6('0x12')]({'port':0x232b});var client9002=jayson[_0x28b6('0x11')][_0x28b6('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2da550,_0x23cd5e,_0xfc110c,_0x4163f7){return new BPromise(function(_0x17a01e,_0x45915b){var _0x5683ea=_0x4163f7||client;return _0x5683ea[_0x28b6('0x13')](_0x2da550,_0xfc110c)[_0x28b6('0x14')](function(_0x5061a1){logger[_0x28b6('0x15')]('MailMessage,\x20%s,\x20%s',_0x23cd5e,'request\x20sent');logger[_0x28b6('0x16')](_0x28b6('0x17'),_0x23cd5e,_0x28b6('0x18'),JSON[_0x28b6('0x19')](_0x5061a1));if(_0x5061a1['error']){if(_0x5061a1[_0x28b6('0x1a')][_0x28b6('0x1b')]===0x1f4){logger[_0x28b6('0x1a')](_0x28b6('0x1c'),_0x23cd5e,_0x5061a1[_0x28b6('0x1a')][_0x28b6('0x1d')]);return _0x45915b(_0x5061a1[_0x28b6('0x1a')][_0x28b6('0x1d')]);}logger[_0x28b6('0x1a')](_0x28b6('0x1c'),_0x23cd5e,_0x5061a1['error'][_0x28b6('0x1d')]);return _0x17a01e(_0x5061a1[_0x28b6('0x1a')][_0x28b6('0x1d')]);}else{logger[_0x28b6('0x15')]('MailMessage,\x20%s,\x20%s',_0x23cd5e,_0x28b6('0x18'));_0x17a01e(_0x5061a1[_0x28b6('0x1e')]['message']);}})[_0x28b6('0x1f')](function(_0x3e7b5d){logger[_0x28b6('0x1a')](_0x28b6('0x1c'),_0x23cd5e,_0x3e7b5d);_0x45915b(_0x3e7b5d);});});}function respondWithResult(_0x43a16e,_0x3b1372){_0x3b1372=_0x3b1372||0xc8;return function(_0xf43686){if(_0xf43686){return _0x43a16e['status'](_0x3b1372)[_0x28b6('0x20')](_0xf43686);}};}function respondWithFilteredResult(_0xc22b31,_0x4d7750){return function(_0x2c6571){if(_0x2c6571){var _0x1a85da=typeof _0x4d7750[_0x28b6('0x21')]===_0x28b6('0x22')&&typeof _0x4d7750[_0x28b6('0x23')]===_0x28b6('0x22');var _0x484c73=_0x2c6571[_0x28b6('0x24')];var _0x5c21d2=_0x1a85da?0x0:_0x4d7750[_0x28b6('0x21')];var _0x4260ee=_0x1a85da?_0x2c6571[_0x28b6('0x24')]:_0x4d7750[_0x28b6('0x21')]+_0x4d7750[_0x28b6('0x23')];var _0x4d5f71;if(_0x4260ee>=_0x484c73){_0x4260ee=_0x484c73;_0x4d5f71=0xc8;}else{_0x4d5f71=0xce;}_0xc22b31[_0x28b6('0x25')](_0x4d5f71);return _0xc22b31[_0x28b6('0x26')](_0x28b6('0x27'),_0x5c21d2+'-'+_0x4260ee+'/'+_0x484c73)[_0x28b6('0x20')](_0x2c6571);}return null;};}function saveUpdates(_0x3587e8){return function(_0x450dd6){if(_0x450dd6){return _0x450dd6['update'](_0x3587e8)['then'](function(_0x3152bd){return _0x3152bd;});}return null;};}function removeEntity(_0x570c60){return function(_0x37468e){if(_0x37468e){return _0x37468e[_0x28b6('0x28')]()[_0x28b6('0x14')](function(){_0x570c60[_0x28b6('0x25')](0xcc)[_0x28b6('0x29')]();});}};}function handleEntityNotFound(_0x167878){return function(_0x162ca1){if(!_0x162ca1){_0x167878[_0x28b6('0x2a')](0x194);}return _0x162ca1;};}function handleError(_0x249ce1,_0x5d3fb8){_0x5d3fb8=_0x5d3fb8||0x1f4;return function(_0x3229b5){logger[_0x28b6('0x1a')](_0x3229b5['stack']);if(_0x3229b5[_0x28b6('0x2b')]){delete _0x3229b5[_0x28b6('0x2b')];}_0x249ce1[_0x28b6('0x25')](_0x5d3fb8)[_0x28b6('0x2c')](_0x3229b5);};}exports['index']=function(_0x396e4c,_0x2c7879){var _0x57f1b1={},_0x38ce44={},_0x9aaabb={'count':0x0,'rows':[]};var _0x24f864=_[_0x28b6('0x2d')](db['MailMessage']['rawAttributes'],function(_0x4b8c81){return{'name':_0x4b8c81[_0x28b6('0x2e')],'type':_0x4b8c81[_0x28b6('0x2f')][_0x28b6('0x30')]};});_0x38ce44['model']=_[_0x28b6('0x2d')](_0x24f864,_0x28b6('0x2b'));_0x38ce44[_0x28b6('0x31')]=_[_0x28b6('0x32')](_0x396e4c['query']);_0x38ce44[_0x28b6('0x33')]=_[_0x28b6('0x34')](_0x38ce44['model'],_0x38ce44['query']);_0x57f1b1[_0x28b6('0x35')]=_['intersection'](_0x38ce44[_0x28b6('0x36')],qs[_0x28b6('0x37')](_0x396e4c[_0x28b6('0x31')][_0x28b6('0x37')]));_0x57f1b1['attributes']=_0x57f1b1[_0x28b6('0x35')][_0x28b6('0x38')]?_0x57f1b1[_0x28b6('0x35')]:_0x38ce44['model'];if(!_0x396e4c['query']['hasOwnProperty']('nolimit')){_0x57f1b1[_0x28b6('0x23')]=qs['limit'](_0x396e4c[_0x28b6('0x31')][_0x28b6('0x23')]);_0x57f1b1[_0x28b6('0x21')]=qs['offset'](_0x396e4c[_0x28b6('0x31')]['offset']);}_0x57f1b1[_0x28b6('0x39')]=qs[_0x28b6('0x3a')](_0x396e4c[_0x28b6('0x31')][_0x28b6('0x3a')]);_0x57f1b1[_0x28b6('0x3b')]=qs[_0x28b6('0x33')](_[_0x28b6('0x3c')](_0x396e4c[_0x28b6('0x31')],_0x38ce44[_0x28b6('0x33')]),_0x24f864);if(_0x396e4c[_0x28b6('0x31')][_0x28b6('0x3d')]){_0x57f1b1['where']=_[_0x28b6('0x3e')](_0x57f1b1[_0x28b6('0x3b')],{'$or':_[_0x28b6('0x2d')](_0x24f864,function(_0x697e8b){if(_0x697e8b[_0x28b6('0x2f')]!=='VIRTUAL'){var _0x27fc0d={};_0x27fc0d[_0x697e8b[_0x28b6('0x2b')]]={'$like':'%'+_0x396e4c[_0x28b6('0x31')][_0x28b6('0x3d')]+'%'};return _0x27fc0d;}})});}_0x57f1b1=_[_0x28b6('0x3e')]({},_0x57f1b1,_0x396e4c[_0x28b6('0x3f')]);var _0x3a84ac={'where':_0x57f1b1[_0x28b6('0x3b')]};return db[_0x28b6('0x40')][_0x28b6('0x24')](_0x3a84ac)['then'](function(_0x4a9d15){_0x9aaabb[_0x28b6('0x24')]=_0x4a9d15;if(_0x396e4c[_0x28b6('0x31')][_0x28b6('0x41')]){_0x57f1b1[_0x28b6('0x42')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x57f1b1);})['then'](function(_0x29353a){_0x9aaabb[_0x28b6('0x43')]=_0x29353a;return _0x9aaabb;})['then'](respondWithFilteredResult(_0x2c7879,_0x57f1b1))[_0x28b6('0x1f')](handleError(_0x2c7879,null));};exports[_0x28b6('0x44')]=function(_0xa995ef,_0x5330f1){var _0x1a6b98={'raw':!![],'where':{'id':_0xa995ef[_0x28b6('0x45')]['id']}},_0x3231e4={};_0x3231e4[_0x28b6('0x36')]=_['keys'](db[_0x28b6('0x40')][_0x28b6('0x46')]);_0x3231e4[_0x28b6('0x31')]=_[_0x28b6('0x32')](_0xa995ef[_0x28b6('0x31')]);_0x3231e4[_0x28b6('0x33')]=_['intersection'](_0x3231e4['model'],_0x3231e4[_0x28b6('0x31')]);_0x1a6b98[_0x28b6('0x35')]=_['intersection'](_0x3231e4[_0x28b6('0x36')],qs['fields'](_0xa995ef['query'][_0x28b6('0x37')]));_0x1a6b98[_0x28b6('0x35')]=_0x1a6b98[_0x28b6('0x35')][_0x28b6('0x38')]?_0x1a6b98['attributes']:_0x3231e4[_0x28b6('0x36')];if(_0xa995ef[_0x28b6('0x31')][_0x28b6('0x41')]){_0x1a6b98[_0x28b6('0x42')]=[{'all':!![]}];}_0x1a6b98=_['merge']({},_0x1a6b98,_0xa995ef['options']);return db[_0x28b6('0x40')][_0x28b6('0x47')](_0x1a6b98)[_0x28b6('0x14')](handleEntityNotFound(_0x5330f1,null))[_0x28b6('0x14')](respondWithResult(_0x5330f1,null))[_0x28b6('0x1f')](handleError(_0x5330f1,null));};exports[_0x28b6('0x48')]=function(_0x5012a5,_0x24a818){if(_0x5012a5['body']['id']){delete _0x5012a5[_0x28b6('0x49')]['id'];}return db[_0x28b6('0x40')][_0x28b6('0x47')]({'where':{'id':_0x5012a5[_0x28b6('0x45')]['id']}})['then'](handleEntityNotFound(_0x24a818,null))[_0x28b6('0x14')](saveUpdates(_0x5012a5[_0x28b6('0x49')],null))[_0x28b6('0x14')](respondWithResult(_0x24a818,null))['catch'](handleError(_0x24a818,null));};exports[_0x28b6('0x28')]=function(_0x3fcc54,_0x51db05){return db[_0x28b6('0x40')][_0x28b6('0x47')]({'where':{'id':_0x3fcc54[_0x28b6('0x45')]['id']}})['then'](handleEntityNotFound(_0x51db05,null))['then'](removeEntity(_0x51db05,null))[_0x28b6('0x1f')](handleError(_0x51db05,null));};exports['describe']=function(_0x23d8ce,_0x26eab8){return db[_0x28b6('0x40')][_0x28b6('0x4a')]()['then'](respondWithResult(_0x26eab8,null))[_0x28b6('0x1f')](handleError(_0x26eab8,null));};exports['create']=function(_0x4d9a00,_0x32e1cc){return db['MailMessage']['create'](_0x4d9a00['body'])[_0x28b6('0x14')](function(_0xa84087){if(_0xa84087){if(_0xa84087[_0x28b6('0x4b')]==='out'&&!_0xa84087['secret']){var _0x151d30,_0x11b868,_0xb7b501;if(_0x4d9a00[_0x28b6('0x49')]['to']){_0x11b868=_0x4d9a00[_0x28b6('0x49')]['to']['split'](',')[0x0];}return db[_0x28b6('0x4c')][_0x28b6('0x4d')]({'where':{'id':_0xa84087['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x28b6('0x4e'),'include':[{'model':db[_0x28b6('0x4f')],'as':_0x28b6('0x50'),'where':{'email':_0x11b868},'limit':0x1,'order':[[_0x28b6('0x51'),_0x28b6('0x52')]]}]},{'model':db[_0x28b6('0x53')],'as':_0x28b6('0x54'),'raw':!![],'include':[{'model':db[_0x28b6('0x55')],'as':'CloudProvider','raw':!![]}]}]})[_0x28b6('0x14')](function(_0x2b6294){_0x151d30=_0x2b6294;if(!_0x151d30||!_0x151d30[_0x28b6('0x54')])return;var _0x4246c7=_0x151d30[_0x28b6('0x56')]();if(_0x4d9a00[_0x28b6('0x49')]['attachments']&&_0x4d9a00[_0x28b6('0x49')][_0x28b6('0x57')][_0x28b6('0x38')]){for(var _0x55a5ff=0x0;_0x55a5ff<_0x4d9a00['body'][_0x28b6('0x57')][_0x28b6('0x38')];_0x55a5ff+=0x1){_0x4d9a00[_0x28b6('0x49')]['attachments'][_0x55a5ff]={'filename':_0x4d9a00['body'][_0x28b6('0x57')][_0x55a5ff][_0x28b6('0x2b')],'path':path[_0x28b6('0x58')](config[_0x28b6('0x59')],_0x28b6('0x5a'),_0x4d9a00[_0x28b6('0x49')][_0x28b6('0x57')][_0x55a5ff][_0x28b6('0x5b')])};}}_0xb7b501={'account':_0x4246c7,'message':_0x4d9a00[_0x28b6('0x49')]};return;})[_0x28b6('0x14')](function(){if(_0x151d30['List']){if(_0x151d30[_0x28b6('0x4e')][_0x28b6('0x50')]['length']){return _0x151d30[_0x28b6('0x4e')][_0x28b6('0x50')][0x0];}else{return db['CmContact'][_0x28b6('0x5c')](_[_0x28b6('0x5d')](_0x4d9a00[_0x28b6('0x49')],{'firstName':_0x4d9a00[_0x28b6('0x49')]['to'],'email':_0x4d9a00['body']['to'],'phone':_0x4d9a00[_0x28b6('0x49')]['to'],'ListId':_0x151d30['ListId']}));}}else{throw new Error(_0x28b6('0x5e'));}})[_0x28b6('0x14')](function(){if(_0xb7b501){return respondWithRpcPromise(_0x28b6('0x5f'),'sendMail',_0xb7b501,client9003)['then'](function(_0x24ac4c){return _0xa84087[_0x28b6('0x48')]({'read':!![],'messageId':_0x24ac4c[_0x28b6('0x60')],'sentAt':moment()['format'](_0x28b6('0x61'))});})[_0x28b6('0x1f')](function(_0x351897){logger[_0x28b6('0x1a')]('%s',JSON[_0x28b6('0x19')](_0x351897));return _0xa84087;});}return _0xa84087;});}return _0xa84087;}})[_0x28b6('0x14')](respondWithResult(_0x32e1cc,0xc9))[_0x28b6('0x1f')](handleError(_0x32e1cc,null));};exports[_0x28b6('0x62')]=function(_0x3e5352,_0x19f644){var _0x1ebdec={'agent':{},'channel':_0x28b6('0x63')};if(_0x3e5352['body']['id']){delete _0x3e5352['body']['id'];}_0x3e5352['body'][_0x28b6('0x64')]=!![];_0x3e5352[_0x28b6('0x49')][_0x28b6('0x65')]=moment()['format'](_0x28b6('0x61'));_0x3e5352[_0x28b6('0x49')][_0x28b6('0x66')]=_0x3e5352[_0x28b6('0x49')]['UserId']||_0x3e5352[_0x28b6('0x67')]['id'];_0x1ebdec[_0x28b6('0x68')]['id']=_0x3e5352[_0x28b6('0x49')][_0x28b6('0x66')];return db['MailMessage']['find']({'where':{'id':_0x3e5352['params']['id'],'UserId':null}})[_0x28b6('0x14')](handleEntityNotFound(_0x19f644,null))[_0x28b6('0x14')](saveUpdates(_0x3e5352[_0x28b6('0x49')],null))[_0x28b6('0x14')](function(_0x164a2f){if(_0x164a2f){_0x1ebdec['message']=_0x164a2f[_0x28b6('0x69')]({'plain':!![]});return db[_0x28b6('0x6a')][_0x28b6('0x47')]({'where':{'id':_0x164a2f[_0x28b6('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x19f644,null))[_0x28b6('0x14')](function(_0x31e21e){if(_0x31e21e){return _0x31e21e[_0x28b6('0x48')]({'UserId':_0x3e5352[_0x28b6('0x49')][_0x28b6('0x66')],'read1stAt':_[_0x28b6('0x6c')](_0x31e21e[_0x28b6('0x6d')])?moment()['format'](_0x28b6('0x61')):undefined});}return null;})[_0x28b6('0x14')](function(_0x26ddb0){if(_0x26ddb0){_0x1ebdec[_0x28b6('0x6e')]=_0x26ddb0['get']({'plain':!![]});interaction_log[_0x28b6('0x15')](_0x28b6('0x6f'),_0x3e5352[_0x28b6('0x67')]['id'],_0x3e5352[_0x28b6('0x67')][_0x28b6('0x2b')],_0x3e5352[_0x28b6('0x67')][_0x28b6('0x70')],_0x1ebdec['interaction']['id'],_0x3e5352[_0x28b6('0x49')]?JSON['stringify'](_0x3e5352['body']):_0x28b6('0x71'));return respondWithRpcPromise(_0x28b6('0x72'),_0x28b6('0x73'),_0x1ebdec);}return null;})[_0x28b6('0x14')](function(_0x321c89){var _0x194904=_0x28b6('0x74')+_0x321c89['message'][_0x28b6('0x75')];return db[_0x28b6('0x76')][_0x28b6('0x31')](_0x194904,{'type':db[_0x28b6('0x77')][_0x28b6('0x78')][_0x28b6('0x79')],'raw':!![]})[_0x28b6('0x14')](function(_0x457997){return _0x457997;});})[_0x28b6('0x14')](function(_0x2009ad){if(_0x2009ad){_0x1ebdec['message']['contact']=_0x2009ad[0x0];if(!_0x3e5352[_0x28b6('0x49')][_0x28b6('0x66')])return;return db[_0x28b6('0x7a')][_0x28b6('0x47')]({'where':{'id':_0x3e5352[_0x28b6('0x49')][_0x28b6('0x66')],'role':_0x28b6('0x68')},'attributes':['id',_0x28b6('0x2b'),_0x28b6('0x7b'),'email',_0x28b6('0x7c')],'raw':!![]});}return null;})[_0x28b6('0x14')](function(_0x301006){if(!_0x301006)return null;_0x1ebdec[_0x28b6('0x1d')][_0x28b6('0x68')]=_0x301006;return _0x1ebdec;})[_0x28b6('0x14')](function(_0x55b726){if(_0x55b726){if(_0x3e5352[_0x28b6('0x49')][_0x28b6('0x7d')]){_0x1ebdec[_0x28b6('0x1d')][_0x28b6('0x7e')]=util[_0x28b6('0x7f')]('SIP/%s',_0x3e5352[_0x28b6('0x67')][_0x28b6('0x2b')]);_0x1ebdec[_0x28b6('0x1d')][_0x28b6('0x80')]=_0x1ebdec[_0x28b6('0x80')];_0x1ebdec[_0x28b6('0x1d')]['motionChannel']=_0x1ebdec[_0x28b6('0x80')];_0x1ebdec[_0x28b6('0x1d')][_0x28b6('0x81')]=_0x28b6('0x62');_0x1ebdec['message'][_0x28b6('0x49')]=htmlToText[_0x28b6('0x82')](_0x1ebdec[_0x28b6('0x1d')][_0x28b6('0x49')]);return respondWithRpcPromise(_0x28b6('0x83'),_0x28b6('0x83'),{'event':_0x28b6('0x84'),'message':_0x1ebdec[_0x28b6('0x1d')]},client9002)[_0x28b6('0x14')](function(){return _0x1ebdec;});}return _0x1ebdec;}return null;})[_0x28b6('0x14')](respondWithResult(_0x19f644,null))[_0x28b6('0x1f')](handleError(_0x19f644,null));};exports[_0x28b6('0x85')]=function(_0x121711,_0x3077f5){var _0x37ef2c={'agent':{},'channel':'mail'};if(_0x121711[_0x28b6('0x49')]['id']){delete _0x121711['body']['id'];}_0x121711[_0x28b6('0x49')][_0x28b6('0x66')]=_0x121711['body']['UserId']||_0x121711[_0x28b6('0x67')]['id'];_0x37ef2c[_0x28b6('0x68')]['id']=_0x121711[_0x28b6('0x49')]['UserId'];return db['MailMessage'][_0x28b6('0x47')]({'where':{'id':_0x121711[_0x28b6('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3077f5,null))['then'](function(_0x2b9fd0){if(_0x2b9fd0){_0x37ef2c[_0x28b6('0x1d')]=_0x2b9fd0['get']({'plain':!![]});return db[_0x28b6('0x6a')][_0x28b6('0x47')]({'where':{'id':_0x2b9fd0[_0x28b6('0x6b')]}});}return null;})[_0x28b6('0x14')](handleEntityNotFound(_0x3077f5,null))[_0x28b6('0x14')](function(_0x43eb2c){if(_0x43eb2c){_0x37ef2c[_0x28b6('0x6e')]=_0x43eb2c[_0x28b6('0x69')]({'plain':!![]});interaction_log[_0x28b6('0x15')](_0x28b6('0x86'),_0x121711[_0x28b6('0x67')]['id'],_0x121711[_0x28b6('0x67')][_0x28b6('0x2b')],_0x121711[_0x28b6('0x67')][_0x28b6('0x70')],_0x37ef2c['interaction']['id'],_0x121711[_0x28b6('0x49')]?JSON[_0x28b6('0x19')](_0x121711[_0x28b6('0x49')]):_0x28b6('0x71'));return respondWithRpcPromise(_0x28b6('0x87'),_0x28b6('0x88'),_0x37ef2c);}return null;})[_0x28b6('0x14')](function(_0xdbff19){var _0x116401=_0x28b6('0x74')+_0xdbff19[_0x28b6('0x1d')]['ContactId'];return db[_0x28b6('0x76')][_0x28b6('0x31')](_0x116401,{'type':db['Sequelize'][_0x28b6('0x78')][_0x28b6('0x79')],'raw':!![]})[_0x28b6('0x14')](function(_0x2bbb22){return _0x2bbb22;});})['then'](function(_0x3ffd45){if(_0x3ffd45){_0x37ef2c[_0x28b6('0x1d')][_0x28b6('0x89')]=_0x3ffd45[0x0];if(!_0x121711[_0x28b6('0x49')][_0x28b6('0x66')])return;return db[_0x28b6('0x7a')][_0x28b6('0x47')]({'where':{'id':_0x121711['body'][_0x28b6('0x66')],'role':'agent'},'attributes':['id',_0x28b6('0x2b'),_0x28b6('0x7b'),_0x28b6('0x8a'),_0x28b6('0x7c')],'raw':!![]});}return null;})[_0x28b6('0x14')](function(_0x41ace4){if(!_0x41ace4)return null;_0x37ef2c[_0x28b6('0x1d')]['agent']=_0x41ace4;return _0x37ef2c;})[_0x28b6('0x14')](function(_0x3d614c){if(_0x3d614c){_0x3d614c[_0x28b6('0x1d')][_0x28b6('0x7e')]=util[_0x28b6('0x7f')](_0x28b6('0x8b'),_0x121711[_0x28b6('0x67')][_0x28b6('0x2b')]);_0x3d614c[_0x28b6('0x1d')]['channel']=_0x37ef2c[_0x28b6('0x80')];_0x3d614c['message'][_0x28b6('0x8c')]=_0x37ef2c[_0x28b6('0x80')];_0x3d614c['message']['event']='reject';_0x3d614c[_0x28b6('0x1d')][_0x28b6('0x49')]=htmlToText[_0x28b6('0x82')](_0x37ef2c[_0x28b6('0x1d')]['body']);respondWithRpcPromise(_0x28b6('0x83'),_0x28b6('0x83'),{'event':_0x28b6('0x8d'),'message':_0x3d614c['message']},client9002);return _0x37ef2c;}return null;})[_0x28b6('0x14')](respondWithResult(_0x3077f5,null))[_0x28b6('0x1f')](handleError(_0x3077f5,null));};exports[_0x28b6('0x8e')]=function(_0x157f79,_0x10f4eb){var _0x493184=moment()[_0x28b6('0x8f')]()[_0x28b6('0x90')]();var _0x4bdefa=path[_0x28b6('0x58')](config[_0x28b6('0x59')],_0x28b6('0x91'),_0x28b6('0x92'),_0x28b6('0x93'));var _0x37278f=path[_0x28b6('0x58')](config['root'],_0x28b6('0x91'),'files','attachments');var _0x2c80b9=util[_0x28b6('0x7f')](_0x28b6('0x94'),_0x493184);return db[_0x28b6('0x40')]['find']({'where':{'id':_0x157f79['params']['id']},'attributes':['id','body',_0x28b6('0x95'),'to','cc',_0x28b6('0x96'),_0x28b6('0x97'),_0x28b6('0x98')],'include':_0x157f79[_0x28b6('0x31')][_0x28b6('0x57')]?[{'model':db[_0x28b6('0x99')],'as':_0x28b6('0x9a')}]:undefined})[_0x28b6('0x14')](handleEntityNotFound(_0x10f4eb,null))['then'](function(_0x59cc42){if(_0x59cc42){var _0x1d5af6=_0x59cc42;var _0x1b6f2c={'from':_0x1d5af6['from'],'to':_0x1d5af6['to'],'subject':_0x1d5af6[_0x28b6('0x97')],'html':htmlEntities[_0x28b6('0x9b')](_0x1d5af6[_0x28b6('0x49')]),'headers':{'Date':moment(_0x1d5af6['createdAt'])['format'](_0x28b6('0x9c'))},'attachments':[]};if(_0x59cc42['cc']){_0x1b6f2c[_0x28b6('0x9d')]['Cc']=_0x59cc42['cc'];}if(_0x59cc42[_0x28b6('0x96')]){_0x1b6f2c[_0x28b6('0x9d')][_0x28b6('0x9e')]=_0x59cc42[_0x28b6('0x96')];}return new BPromise(function(_0x5bdcf5,_0x55f3c6){if(_0x59cc42['Attachments']){for(var _0x2549f9=0x0;_0x2549f9<_0x59cc42['Attachments'][_0x28b6('0x38')];_0x2549f9++){var _0x225ac3=_0x59cc42[_0x28b6('0x9a')][_0x2549f9];var _0x199bab=path['join'](_0x37278f,_0x225ac3[_0x28b6('0x5b')]);if(fs['existsSync'](_0x199bab)){_0x1b6f2c[_0x28b6('0x57')][_0x28b6('0x9f')]({'name':_0x225ac3[_0x28b6('0x2b')],'contentType':_0x225ac3[_0x28b6('0x2f')],'data':fs['readFileSync'](_0x199bab)});}}}emlformat['build'](_0x1b6f2c,function(_0x58e739,_0x38abf5){if(_0x58e739)return _0x55f3c6(_0x58e739);fs['writeFileSync'](path[_0x28b6('0x58')](_0x4bdefa,_0x2c80b9),_0x38abf5);return _0x5bdcf5(_0x38abf5);});});}})[_0x28b6('0x14')](function(_0x48a556){if(_0x48a556){return _0x10f4eb[_0x28b6('0x8e')](path[_0x28b6('0x58')](_0x4bdefa,_0x2c80b9),_0x2c80b9,function(_0x5a1bfb){if(!_0x5a1bfb)fs[_0x28b6('0xa0')](path['join'](_0x4bdefa,_0x2c80b9));});}})[_0x28b6('0x1f')](handleError(_0x10f4eb,null));}; \ No newline at end of file +var _0x6670=['then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','type','options','MailMessage','includeAll','include','rows','params','fields','find','body','describe','create','direction','secret','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','List','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','user','agent','get','isNil','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','MailInteraction','MailInteractionId','RejectMessage','rejectMessage','SELECT','SIP/%s','event','reject','toString','server','tmp','files','message-%s.eml','from','bcc','subject','createdAt','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','push','download','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','http','client','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x6670,0x109));var _0x0667=function(_0x21a2f7,_0x4d0833){_0x21a2f7=_0x21a2f7-0x0;var _0x3aa8=_0x6670[_0x21a2f7];return _0x3aa8;};'use strict';var emlformat=require(_0x0667('0x0'));var moment=require(_0x0667('0x1'));var BPromise=require(_0x0667('0x2'));var util=require('util');var path=require(_0x0667('0x3'));var fs=require('fs');var _=require(_0x0667('0x4'));var Redis=require(_0x0667('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x0667('0x6'));var logger=require(_0x0667('0x7'))('api');var interaction_log=require(_0x0667('0x7'))('mail-interactions');var config=require(_0x0667('0x8'));var db=require(_0x0667('0x9'))['db'];config[_0x0667('0xa')]=_[_0x0667('0xb')](config[_0x0667('0xa')],{'host':_0x0667('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0667('0xa')]));var htmlEntities=require(_0x0667('0xd'));require(_0x0667('0xe'))[_0x0667('0xf')](socket);var jayson=require(_0x0667('0x10'));var client=jayson['client'][_0x0667('0x11')]({'port':0x232c});var client9003=jayson[_0x0667('0x12')][_0x0667('0x11')]({'port':0x232b});var client9002=jayson['client'][_0x0667('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4a130b,_0x272e78,_0x411f68,_0x45b7cb){return new BPromise(function(_0xb29d18,_0x36fd26){var _0x45f20f=_0x45b7cb||client;return _0x45f20f['request'](_0x4a130b,_0x411f68)['then'](function(_0x31c315){logger[_0x0667('0x13')]('MailMessage,\x20%s,\x20%s',_0x272e78,_0x0667('0x14'));logger['debug'](_0x0667('0x15'),_0x272e78,'request\x20sent',JSON['stringify'](_0x31c315));if(_0x31c315[_0x0667('0x16')]){if(_0x31c315['error'][_0x0667('0x17')]===0x1f4){logger[_0x0667('0x16')](_0x0667('0x18'),_0x272e78,_0x31c315['error'][_0x0667('0x19')]);return _0x36fd26(_0x31c315['error'][_0x0667('0x19')]);}logger[_0x0667('0x16')](_0x0667('0x18'),_0x272e78,_0x31c315[_0x0667('0x16')][_0x0667('0x19')]);return _0xb29d18(_0x31c315['error']['message']);}else{logger[_0x0667('0x13')](_0x0667('0x18'),_0x272e78,_0x0667('0x14'));_0xb29d18(_0x31c315[_0x0667('0x1a')][_0x0667('0x19')]);}})[_0x0667('0x1b')](function(_0x1b6eef){logger[_0x0667('0x16')]('MailMessage,\x20%s,\x20%s',_0x272e78,_0x1b6eef);_0x36fd26(_0x1b6eef);});});}function respondWithResult(_0x23865f,_0xabb046){_0xabb046=_0xabb046||0xc8;return function(_0x4e873e){if(_0x4e873e){return _0x23865f['status'](_0xabb046)[_0x0667('0x1c')](_0x4e873e);}};}function respondWithFilteredResult(_0x3eb92c,_0x5dcfe7){return function(_0xcd60c5){if(_0xcd60c5){var _0x4eae63=typeof _0x5dcfe7[_0x0667('0x1d')]===_0x0667('0x1e')&&typeof _0x5dcfe7[_0x0667('0x1f')]==='undefined';var _0x340f09=_0xcd60c5[_0x0667('0x20')];var _0x7746d0=_0x4eae63?0x0:_0x5dcfe7['offset'];var _0x20e56e=_0x4eae63?_0xcd60c5[_0x0667('0x20')]:_0x5dcfe7['offset']+_0x5dcfe7[_0x0667('0x1f')];var _0x2aa3ae;if(_0x20e56e>=_0x340f09){_0x20e56e=_0x340f09;_0x2aa3ae=0xc8;}else{_0x2aa3ae=0xce;}_0x3eb92c[_0x0667('0x21')](_0x2aa3ae);return _0x3eb92c[_0x0667('0x22')](_0x0667('0x23'),_0x7746d0+'-'+_0x20e56e+'/'+_0x340f09)['json'](_0xcd60c5);}return null;};}function saveUpdates(_0x3de4af){return function(_0x51baee){if(_0x51baee){return _0x51baee[_0x0667('0x24')](_0x3de4af)[_0x0667('0x25')](function(_0x2d1e25){return _0x2d1e25;});}return null;};}function removeEntity(_0xf2c0d6){return function(_0x3f5bc2){if(_0x3f5bc2){return _0x3f5bc2[_0x0667('0x26')]()['then'](function(){_0xf2c0d6[_0x0667('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36f6ea){return function(_0xfc14aa){if(!_0xfc14aa){_0x36f6ea[_0x0667('0x27')](0x194);}return _0xfc14aa;};}function handleError(_0x1eccfe,_0x100010){_0x100010=_0x100010||0x1f4;return function(_0x219850){logger[_0x0667('0x16')](_0x219850[_0x0667('0x28')]);if(_0x219850[_0x0667('0x29')]){delete _0x219850['name'];}_0x1eccfe['status'](_0x100010)[_0x0667('0x2a')](_0x219850);};}exports[_0x0667('0x2b')]=function(_0x14ff5e,_0x2a6100){var _0x280b03={},_0x447a00={},_0x16f60a={'count':0x0,'rows':[]};var _0x154adc=_[_0x0667('0x2c')](db['MailMessage'][_0x0667('0x2d')],function(_0x3a7d93){return{'name':_0x3a7d93[_0x0667('0x2e')],'type':_0x3a7d93['type'][_0x0667('0x2f')]};});_0x447a00[_0x0667('0x30')]=_[_0x0667('0x2c')](_0x154adc,_0x0667('0x29'));_0x447a00[_0x0667('0x31')]=_[_0x0667('0x32')](_0x14ff5e[_0x0667('0x31')]);_0x447a00[_0x0667('0x33')]=_[_0x0667('0x34')](_0x447a00[_0x0667('0x30')],_0x447a00[_0x0667('0x31')]);_0x280b03[_0x0667('0x35')]=_[_0x0667('0x34')](_0x447a00[_0x0667('0x30')],qs['fields'](_0x14ff5e[_0x0667('0x31')]['fields']));_0x280b03[_0x0667('0x35')]=_0x280b03[_0x0667('0x35')][_0x0667('0x36')]?_0x280b03[_0x0667('0x35')]:_0x447a00[_0x0667('0x30')];if(!_0x14ff5e['query']['hasOwnProperty'](_0x0667('0x37'))){_0x280b03[_0x0667('0x1f')]=qs[_0x0667('0x1f')](_0x14ff5e['query']['limit']);_0x280b03[_0x0667('0x1d')]=qs[_0x0667('0x1d')](_0x14ff5e[_0x0667('0x31')][_0x0667('0x1d')]);}_0x280b03[_0x0667('0x38')]=qs[_0x0667('0x39')](_0x14ff5e[_0x0667('0x31')][_0x0667('0x39')]);_0x280b03[_0x0667('0x3a')]=qs[_0x0667('0x33')](_['pick'](_0x14ff5e['query'],_0x447a00[_0x0667('0x33')]),_0x154adc);if(_0x14ff5e['query'][_0x0667('0x3b')]){_0x280b03[_0x0667('0x3a')]=_[_0x0667('0x3c')](_0x280b03[_0x0667('0x3a')],{'$or':_[_0x0667('0x2c')](_0x154adc,function(_0x42cd1b){if(_0x42cd1b[_0x0667('0x3d')]!=='VIRTUAL'){var _0x3e8571={};_0x3e8571[_0x42cd1b[_0x0667('0x29')]]={'$like':'%'+_0x14ff5e[_0x0667('0x31')][_0x0667('0x3b')]+'%'};return _0x3e8571;}})});}_0x280b03=_[_0x0667('0x3c')]({},_0x280b03,_0x14ff5e[_0x0667('0x3e')]);var _0x27807d={'where':_0x280b03['where']};return db[_0x0667('0x3f')][_0x0667('0x20')](_0x27807d)[_0x0667('0x25')](function(_0x47d907){_0x16f60a[_0x0667('0x20')]=_0x47d907;if(_0x14ff5e[_0x0667('0x31')][_0x0667('0x40')]){_0x280b03[_0x0667('0x41')]=[{'all':!![]}];}return db[_0x0667('0x3f')]['findAll'](_0x280b03);})[_0x0667('0x25')](function(_0xb7d33b){_0x16f60a[_0x0667('0x42')]=_0xb7d33b;return _0x16f60a;})[_0x0667('0x25')](respondWithFilteredResult(_0x2a6100,_0x280b03))[_0x0667('0x1b')](handleError(_0x2a6100,null));};exports['show']=function(_0x1134bb,_0x4d2856){var _0x445201={'raw':!![],'where':{'id':_0x1134bb[_0x0667('0x43')]['id']}},_0x59325b={};_0x59325b[_0x0667('0x30')]=_[_0x0667('0x32')](db['MailMessage']['rawAttributes']);_0x59325b[_0x0667('0x31')]=_[_0x0667('0x32')](_0x1134bb['query']);_0x59325b[_0x0667('0x33')]=_[_0x0667('0x34')](_0x59325b[_0x0667('0x30')],_0x59325b[_0x0667('0x31')]);_0x445201[_0x0667('0x35')]=_['intersection'](_0x59325b[_0x0667('0x30')],qs[_0x0667('0x44')](_0x1134bb[_0x0667('0x31')]['fields']));_0x445201[_0x0667('0x35')]=_0x445201['attributes'][_0x0667('0x36')]?_0x445201[_0x0667('0x35')]:_0x59325b[_0x0667('0x30')];if(_0x1134bb['query'][_0x0667('0x40')]){_0x445201[_0x0667('0x41')]=[{'all':!![]}];}_0x445201=_[_0x0667('0x3c')]({},_0x445201,_0x1134bb[_0x0667('0x3e')]);return db['MailMessage'][_0x0667('0x45')](_0x445201)[_0x0667('0x25')](handleEntityNotFound(_0x4d2856,null))[_0x0667('0x25')](respondWithResult(_0x4d2856,null))[_0x0667('0x1b')](handleError(_0x4d2856,null));};exports['update']=function(_0x45a309,_0xea48f4){if(_0x45a309[_0x0667('0x46')]['id']){delete _0x45a309[_0x0667('0x46')]['id'];}return db[_0x0667('0x3f')][_0x0667('0x45')]({'where':{'id':_0x45a309[_0x0667('0x43')]['id']}})[_0x0667('0x25')](handleEntityNotFound(_0xea48f4,null))[_0x0667('0x25')](saveUpdates(_0x45a309[_0x0667('0x46')],null))[_0x0667('0x25')](respondWithResult(_0xea48f4,null))[_0x0667('0x1b')](handleError(_0xea48f4,null));};exports[_0x0667('0x26')]=function(_0x3d42b9,_0x4f405b){return db[_0x0667('0x3f')][_0x0667('0x45')]({'where':{'id':_0x3d42b9[_0x0667('0x43')]['id']}})[_0x0667('0x25')](handleEntityNotFound(_0x4f405b,null))[_0x0667('0x25')](removeEntity(_0x4f405b,null))[_0x0667('0x1b')](handleError(_0x4f405b,null));};exports[_0x0667('0x47')]=function(_0x3eeb82,_0x588250){return db[_0x0667('0x3f')][_0x0667('0x47')]()[_0x0667('0x25')](respondWithResult(_0x588250,null))[_0x0667('0x1b')](handleError(_0x588250,null));};exports[_0x0667('0x48')]=function(_0x221fa5,_0xf6a0e8){return db[_0x0667('0x3f')][_0x0667('0x48')](_0x221fa5[_0x0667('0x46')])['then'](function(_0x22b515){if(_0x22b515){if(_0x22b515[_0x0667('0x49')]==='out'&&!_0x22b515[_0x0667('0x4a')]){var _0x362c2d,_0x51c77a,_0x47b299;if(_0x221fa5[_0x0667('0x46')]['to']){_0x51c77a=_0x221fa5[_0x0667('0x46')]['to']['split'](',')[0x0];}return db[_0x0667('0x4b')][_0x0667('0x4c')]({'where':{'id':_0x22b515['MailAccountId']},'include':[{'model':db[_0x0667('0x4d')],'as':'List','include':[{'model':db[_0x0667('0x4e')],'as':_0x0667('0x4f'),'where':{'email':_0x51c77a},'limit':0x1,'order':[[_0x0667('0x50'),_0x0667('0x51')]]}]},{'model':db[_0x0667('0x52')],'as':_0x0667('0x53'),'raw':!![],'include':[{'model':db[_0x0667('0x54')],'as':_0x0667('0x54'),'raw':!![]}]}]})[_0x0667('0x25')](function(_0xd4c64f){_0x362c2d=_0xd4c64f;if(!_0x362c2d||!_0x362c2d[_0x0667('0x53')])return;var _0x16ba08=_0x362c2d['getSmtpOptions']();if(_0x221fa5[_0x0667('0x46')][_0x0667('0x55')]&&_0x221fa5['body'][_0x0667('0x55')][_0x0667('0x36')]){for(var _0x5a31c5=0x0;_0x5a31c5<_0x221fa5[_0x0667('0x46')][_0x0667('0x55')][_0x0667('0x36')];_0x5a31c5+=0x1){_0x221fa5[_0x0667('0x46')][_0x0667('0x55')][_0x5a31c5]={'filename':_0x221fa5[_0x0667('0x46')][_0x0667('0x55')][_0x5a31c5][_0x0667('0x29')],'path':path[_0x0667('0x56')](config[_0x0667('0x57')],_0x0667('0x58'),_0x221fa5[_0x0667('0x46')]['attachments'][_0x5a31c5]['basename'])};}}_0x47b299={'account':_0x16ba08,'message':_0x221fa5[_0x0667('0x46')]};return;})[_0x0667('0x25')](function(){if(_0x362c2d[_0x0667('0x59')]){if(_0x362c2d[_0x0667('0x59')][_0x0667('0x4f')]['length']){return _0x362c2d[_0x0667('0x59')][_0x0667('0x4f')][0x0];}else{return db['CmContact']['create'](_[_0x0667('0xb')](_0x221fa5['body'],{'firstName':_0x221fa5[_0x0667('0x46')]['to'],'email':_0x221fa5['body']['to'],'phone':_0x221fa5['body']['to'],'ListId':_0x362c2d[_0x0667('0x5a')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x0667('0x25')](function(){if(_0x47b299){return respondWithRpcPromise(_0x0667('0x5b'),_0x0667('0x5c'),_0x47b299,client9003)[_0x0667('0x25')](function(_0x5ee693){return _0x22b515[_0x0667('0x24')]({'read':!![],'messageId':_0x5ee693['messageId'],'sentAt':moment()[_0x0667('0x5d')](_0x0667('0x5e'))});})[_0x0667('0x1b')](function(_0x2ab9e5){logger['error']('%s',JSON[_0x0667('0x5f')](_0x2ab9e5));return _0x22b515;});}return _0x22b515;});}return _0x22b515;}})['then'](respondWithResult(_0xf6a0e8,0xc9))['catch'](handleError(_0xf6a0e8,null));};exports[_0x0667('0x60')]=function(_0x5157e5,_0x3647be){var _0x51390b={'agent':{},'channel':_0x0667('0x61')};if(_0x5157e5[_0x0667('0x46')]['id']){delete _0x5157e5[_0x0667('0x46')]['id'];}_0x5157e5[_0x0667('0x46')][_0x0667('0x62')]=!![];_0x5157e5[_0x0667('0x46')][_0x0667('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5157e5['body'][_0x0667('0x64')]=_0x5157e5[_0x0667('0x46')][_0x0667('0x64')]||_0x5157e5[_0x0667('0x65')]['id'];_0x51390b[_0x0667('0x66')]['id']=_0x5157e5[_0x0667('0x46')][_0x0667('0x64')];return db['MailMessage'][_0x0667('0x45')]({'where':{'id':_0x5157e5[_0x0667('0x43')]['id'],'UserId':null}})[_0x0667('0x25')](handleEntityNotFound(_0x3647be,null))[_0x0667('0x25')](saveUpdates(_0x5157e5[_0x0667('0x46')],null))[_0x0667('0x25')](function(_0x1d40af){if(_0x1d40af){_0x51390b[_0x0667('0x19')]=_0x1d40af[_0x0667('0x67')]({'plain':!![]});return db['MailInteraction'][_0x0667('0x45')]({'where':{'id':_0x1d40af['MailInteractionId']}});}return null;})[_0x0667('0x25')](handleEntityNotFound(_0x3647be,null))[_0x0667('0x25')](function(_0x26476f){if(_0x26476f){return _0x26476f[_0x0667('0x24')]({'UserId':_0x5157e5[_0x0667('0x46')][_0x0667('0x64')],'read1stAt':_[_0x0667('0x68')](_0x26476f['read1stAt'])?moment()[_0x0667('0x5d')](_0x0667('0x5e')):undefined});}return null;})['then'](function(_0x4efab1){if(_0x4efab1){_0x51390b['interaction']=_0x4efab1[_0x0667('0x67')]({'plain':!![]});interaction_log[_0x0667('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5157e5[_0x0667('0x65')]['id'],_0x5157e5[_0x0667('0x65')][_0x0667('0x29')],_0x5157e5[_0x0667('0x65')][_0x0667('0x69')],_0x51390b[_0x0667('0x6a')]['id'],_0x5157e5[_0x0667('0x46')]?JSON[_0x0667('0x5f')](_0x5157e5[_0x0667('0x46')]):_0x0667('0x6b'));return respondWithRpcPromise(_0x0667('0x6c'),_0x0667('0x6d'),_0x51390b);}return null;})[_0x0667('0x25')](function(_0x1bbad9){var _0x5c2007=_0x0667('0x6e')+_0x1bbad9[_0x0667('0x19')][_0x0667('0x6f')];return db[_0x0667('0x70')][_0x0667('0x31')](_0x5c2007,{'type':db[_0x0667('0x71')][_0x0667('0x72')]['SELECT'],'raw':!![]})[_0x0667('0x25')](function(_0x3e01bd){return _0x3e01bd;});})[_0x0667('0x25')](function(_0x56beac){if(_0x56beac){_0x51390b['message']['contact']=_0x56beac[0x0];if(!_0x5157e5[_0x0667('0x46')]['UserId'])return;return db[_0x0667('0x73')][_0x0667('0x45')]({'where':{'id':_0x5157e5[_0x0667('0x46')]['UserId'],'role':'agent'},'attributes':['id',_0x0667('0x29'),_0x0667('0x74'),_0x0667('0x75'),_0x0667('0x76')],'raw':!![]});}return null;})[_0x0667('0x25')](function(_0x1a025f){if(!_0x1a025f)return null;_0x51390b[_0x0667('0x19')]['agent']=_0x1a025f;return _0x51390b;})[_0x0667('0x25')](function(_0x1cd9e2){if(_0x1cd9e2){if(_0x5157e5[_0x0667('0x46')][_0x0667('0x77')]){_0x51390b[_0x0667('0x19')][_0x0667('0x78')]=util[_0x0667('0x5d')]('SIP/%s',_0x5157e5['user'][_0x0667('0x29')]);_0x51390b[_0x0667('0x19')]['channel']=_0x51390b[_0x0667('0x79')];_0x51390b[_0x0667('0x19')][_0x0667('0x7a')]=_0x51390b[_0x0667('0x79')];_0x51390b[_0x0667('0x19')]['event']=_0x0667('0x60');_0x51390b[_0x0667('0x19')][_0x0667('0x46')]=htmlToText[_0x0667('0x7b')](_0x51390b[_0x0667('0x19')][_0x0667('0x46')]);return respondWithRpcPromise(_0x0667('0x7c'),'EventManager',{'event':_0x0667('0x7d'),'message':_0x51390b[_0x0667('0x19')]},client9002)['then'](function(){return _0x51390b;});}return _0x51390b;}return null;})[_0x0667('0x25')](respondWithResult(_0x3647be,null))['catch'](handleError(_0x3647be,null));};exports['reject']=function(_0x1a1d51,_0xd5862c){var _0x8da843={'agent':{},'channel':_0x0667('0x61')};if(_0x1a1d51[_0x0667('0x46')]['id']){delete _0x1a1d51[_0x0667('0x46')]['id'];}_0x1a1d51[_0x0667('0x46')]['UserId']=_0x1a1d51[_0x0667('0x46')][_0x0667('0x64')]||_0x1a1d51[_0x0667('0x65')]['id'];_0x8da843[_0x0667('0x66')]['id']=_0x1a1d51[_0x0667('0x46')][_0x0667('0x64')];return db[_0x0667('0x3f')][_0x0667('0x45')]({'where':{'id':_0x1a1d51[_0x0667('0x43')]['id'],'UserId':null}})[_0x0667('0x25')](handleEntityNotFound(_0xd5862c,null))[_0x0667('0x25')](function(_0x5879be){if(_0x5879be){_0x8da843[_0x0667('0x19')]=_0x5879be[_0x0667('0x67')]({'plain':!![]});return db[_0x0667('0x7e')][_0x0667('0x45')]({'where':{'id':_0x5879be[_0x0667('0x7f')]}});}return null;})[_0x0667('0x25')](handleEntityNotFound(_0xd5862c,null))[_0x0667('0x25')](function(_0x126a62){if(_0x126a62){_0x8da843[_0x0667('0x6a')]=_0x126a62[_0x0667('0x67')]({'plain':!![]});interaction_log[_0x0667('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a1d51[_0x0667('0x65')]['id'],_0x1a1d51['user']['name'],_0x1a1d51['user'][_0x0667('0x69')],_0x8da843['interaction']['id'],_0x1a1d51['body']?JSON[_0x0667('0x5f')](_0x1a1d51[_0x0667('0x46')]):'null');return respondWithRpcPromise(_0x0667('0x80'),_0x0667('0x81'),_0x8da843);}return null;})['then'](function(_0x58b069){var _0x40d5fa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x58b069[_0x0667('0x19')][_0x0667('0x6f')];return db['sequelize'][_0x0667('0x31')](_0x40d5fa,{'type':db['Sequelize'][_0x0667('0x72')][_0x0667('0x82')],'raw':!![]})[_0x0667('0x25')](function(_0x13a676){return _0x13a676;});})['then'](function(_0x3fd1dc){if(_0x3fd1dc){_0x8da843[_0x0667('0x19')]['contact']=_0x3fd1dc[0x0];if(!_0x1a1d51[_0x0667('0x46')]['UserId'])return;return db['User'][_0x0667('0x45')]({'where':{'id':_0x1a1d51[_0x0667('0x46')]['UserId'],'role':'agent'},'attributes':['id',_0x0667('0x29'),_0x0667('0x74'),_0x0667('0x75'),'internal'],'raw':!![]});}return null;})[_0x0667('0x25')](function(_0x3a9e1e){if(!_0x3a9e1e)return null;_0x8da843[_0x0667('0x19')][_0x0667('0x66')]=_0x3a9e1e;return _0x8da843;})[_0x0667('0x25')](function(_0x49ee6c){if(_0x49ee6c){_0x49ee6c[_0x0667('0x19')][_0x0667('0x78')]=util['format'](_0x0667('0x83'),_0x1a1d51['user'][_0x0667('0x29')]);_0x49ee6c[_0x0667('0x19')][_0x0667('0x79')]=_0x8da843[_0x0667('0x79')];_0x49ee6c[_0x0667('0x19')][_0x0667('0x7a')]=_0x8da843['channel'];_0x49ee6c[_0x0667('0x19')][_0x0667('0x84')]=_0x0667('0x85');_0x49ee6c[_0x0667('0x19')][_0x0667('0x46')]=htmlToText[_0x0667('0x7b')](_0x8da843[_0x0667('0x19')]['body']);respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x49ee6c[_0x0667('0x19')]},client9002);return _0x8da843;}return null;})[_0x0667('0x25')](respondWithResult(_0xd5862c,null))['catch'](handleError(_0xd5862c,null));};exports['download']=function(_0x5bd4c5,_0x2e2be5){var _0x33eb21=moment()['unix']()[_0x0667('0x86')]();var _0x507e6d=path[_0x0667('0x56')](config[_0x0667('0x57')],_0x0667('0x87'),'files',_0x0667('0x88'));var _0xb3717c=path['join'](config[_0x0667('0x57')],_0x0667('0x87'),_0x0667('0x89'),'attachments');var _0x518039=util['format'](_0x0667('0x8a'),_0x33eb21);return db[_0x0667('0x3f')][_0x0667('0x45')]({'where':{'id':_0x5bd4c5[_0x0667('0x43')]['id']},'attributes':['id',_0x0667('0x46'),_0x0667('0x8b'),'to','cc',_0x0667('0x8c'),_0x0667('0x8d'),_0x0667('0x8e')],'include':_0x5bd4c5[_0x0667('0x31')][_0x0667('0x55')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x0667('0x25')](handleEntityNotFound(_0x2e2be5,null))[_0x0667('0x25')](function(_0x3e12a7){if(_0x3e12a7){var _0x3e0f75=_0x3e12a7;var _0x25a779={'from':_0x3e0f75[_0x0667('0x8b')],'to':_0x3e0f75['to'],'subject':_0x3e0f75[_0x0667('0x8d')],'html':htmlEntities[_0x0667('0x8f')](_0x3e0f75[_0x0667('0x46')]),'headers':{'Date':moment(_0x3e0f75[_0x0667('0x8e')])['format'](_0x0667('0x90'))},'attachments':[]};if(_0x3e12a7['cc']){_0x25a779[_0x0667('0x91')]['Cc']=_0x3e12a7['cc'];}if(_0x3e12a7[_0x0667('0x8c')]){_0x25a779['headers']['Bcc']=_0x3e12a7[_0x0667('0x8c')];}return new BPromise(function(_0x4e8792,_0x4cb1a2){if(_0x3e12a7['Attachments']){for(var _0x3cade8=0x0;_0x3cade8<_0x3e12a7[_0x0667('0x92')][_0x0667('0x36')];_0x3cade8++){var _0x40a829=_0x3e12a7[_0x0667('0x92')][_0x3cade8];var _0xdb9a91=path['join'](_0xb3717c,_0x40a829[_0x0667('0x93')]);if(fs[_0x0667('0x94')](_0xdb9a91)){_0x25a779[_0x0667('0x55')][_0x0667('0x95')]({'name':_0x40a829[_0x0667('0x29')],'contentType':_0x40a829[_0x0667('0x3d')],'data':fs['readFileSync'](_0xdb9a91)});}}}emlformat['build'](_0x25a779,function(_0x19988b,_0xbbfa6a){if(_0x19988b)return _0x4cb1a2(_0x19988b);fs['writeFileSync'](path[_0x0667('0x56')](_0x507e6d,_0x518039),_0xbbfa6a);return _0x4e8792(_0xbbfa6a);});});}})[_0x0667('0x25')](function(_0x42215e){if(_0x42215e){return _0x2e2be5[_0x0667('0x96')](path['join'](_0x507e6d,_0x518039),_0x518039,function(_0x112c0a){if(!_0x112c0a)fs['unlinkSync'](path[_0x0667('0x56')](_0x507e6d,_0x518039));});}})[_0x0667('0x1b')](handleError(_0x2e2be5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 519ed7d..1a8bf9d 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 _0x6c37=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','save','update'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0x6c37,0x1c6));var _0x76c3=function(_0x3637f4,_0x56f06e){_0x3637f4=_0x3637f4-0x0;var _0x1d4588=_0x6c37[_0x3637f4];return _0x1d4588;};'use strict';var EventEmitter=require(_0x76c3('0x0'));var MailMessage=require(_0x76c3('0x1'))['db'][_0x76c3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x76c3('0x3'),'afterUpdate':_0x76c3('0x4'),'afterDestroy':_0x76c3('0x5')};function emitEvent(_0x288a84){return function(_0x1e5ae9,_0x1e9b13,_0x5e88ee){MailMessageEvents[_0x76c3('0x6')](_0x288a84+':'+_0x1e5ae9['id'],_0x1e5ae9);MailMessageEvents[_0x76c3('0x6')](_0x288a84,_0x1e5ae9);_0x5e88ee(null);};}for(var e in events){if(events[_0x76c3('0x7')](e)){var event=events[e];MailMessage[_0x76c3('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x197d=['emit','hook','events','MailMessage','setMaxListeners','save','update','remove'];(function(_0x4e1409,_0x2eb61d){var _0x37b0c1=function(_0x569e9e){while(--_0x569e9e){_0x4e1409['push'](_0x4e1409['shift']());}};_0x37b0c1(++_0x2eb61d);}(_0x197d,0xfa));var _0xd197=function(_0x27cb01,_0x12c1a5){_0x27cb01=_0x27cb01-0x0;var _0x4a4a93=_0x197d[_0x27cb01];return _0x4a4a93;};'use strict';var EventEmitter=require(_0xd197('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xd197('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd197('0x2')](0x0);var events={'afterCreate':_0xd197('0x3'),'afterUpdate':_0xd197('0x4'),'afterDestroy':_0xd197('0x5')};function emitEvent(_0x5b2959){return function(_0x390845,_0x30899a,_0x5ce23a){MailMessageEvents[_0xd197('0x6')](_0x5b2959+':'+_0x390845['id'],_0x390845);MailMessageEvents[_0xd197('0x6')](_0x5b2959,_0x390845);_0x5ce23a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xd197('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 59cd486..3a49838 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 _0xd408=['bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update','catch','error','utf8mb4_unicode_ci','util','api','moment'];(function(_0x1eb41e,_0x17778c){var _0x5623d1=function(_0x5833a7){while(--_0x5833a7){_0x1eb41e['push'](_0x1eb41e['shift']());}};_0x5623d1(++_0x17778c);}(_0xd408,0x1af));var _0x8d40=function(_0x558e6b,_0x39d6a5){_0x558e6b=_0x558e6b-0x0;var _0x3f64ff=_0xd408[_0x558e6b];return _0x3f64ff;};'use strict';var _=require('lodash');var util=require(_0x8d40('0x0'));var logger=require('../../config/logger')(_0x8d40('0x1'));var moment=require(_0x8d40('0x2'));var BPromise=require(_0x8d40('0x3'));var rp=require(_0x8d40('0x4'));var htmlToText=require(_0x8d40('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d40('0x6'));var config=require(_0x8d40('0x7'));var attributes=require('./mailMessage.attributes');module[_0x8d40('0x8')]=function(_0x42d826,_0x1bbd4f){return _0x42d826['define'](_0x8d40('0x9'),attributes,{'tableName':_0x8d40('0xa'),'paranoid':![],'indexes':[{'name':_0x8d40('0xb'),'fields':[_0x8d40('0xb')]},{'name':_0x8d40('0xc'),'fields':[_0x8d40('0xd'),_0x8d40('0xe')],'type':_0x8d40('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ce668,_0x2d6d05,_0x26b34e){if(_0x1ce668[_0x8d40('0x10')]){_0x1ce668[_0x8d40('0xd')]=htmlToText[_0x8d40('0x11')](_0x1ce668[_0x8d40('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x26b34e(null,_0x2d6d05);},'afterCreate':function(_0x5b11e6,_0x3c4726,_0x2b8f29){var _0x1ddee5=_0x42d826[_0x8d40('0x12')];var _0x539cf2=_0x5b11e6[_0x8d40('0x13')]({'plain':!![]});if(_0x539cf2[_0x8d40('0x14')]['toLowerCase']()==='in'||_0x539cf2['direction'][_0x8d40('0x15')]()==='out'&&!_0x539cf2[_0x8d40('0x16')]&&!_[_0x8d40('0x17')](_0x539cf2[_0x8d40('0x18')])){_0x1ddee5['MailInteraction'][_0x8d40('0x19')]({'where':{'id':_0x539cf2['MailInteractionId']}})[_0x8d40('0x1a')](function(_0x4c741d){if(_0x4c741d){_0x4c741d[_0x8d40('0x1b')]({'lastMsgAt':_0x539cf2['createdAt'],'lastMsgDirection':_0x539cf2[_0x8d40('0x14')][_0x8d40('0x15')]()});}})[_0x8d40('0x1c')](function(_0x120954){console[_0x8d40('0x1d')](_0x120954);});}_0x2b8f29();}},'charset':'utf8mb4','collate':_0x8d40('0x1e')});}; \ No newline at end of file +var _0xc04f=['FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','subject'];(function(_0x4e3469,_0x2d1b31){var _0x2248dd=function(_0x5ca948){while(--_0x5ca948){_0x4e3469['push'](_0x4e3469['shift']());}};_0x2248dd(++_0x2d1b31);}(_0xc04f,0x16c));var _0xfc04=function(_0x29a578,_0x406599){_0x29a578=_0x29a578-0x0;var _0x1cebfe=_0xc04f[_0x29a578];return _0x1cebfe;};'use strict';var _=require(_0xfc04('0x0'));var util=require(_0xfc04('0x1'));var logger=require(_0xfc04('0x2'))('api');var moment=require(_0xfc04('0x3'));var BPromise=require(_0xfc04('0x4'));var rp=require(_0xfc04('0x5'));var htmlToText=require(_0xfc04('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfc04('0x7'));var attributes=require(_0xfc04('0x8'));module['exports']=function(_0x1e4439,_0x2dc0a6){return _0x1e4439['define'](_0xfc04('0x9'),attributes,{'tableName':_0xfc04('0xa'),'paranoid':![],'indexes':[{'name':_0xfc04('0xb'),'fields':[_0xfc04('0xb')]},{'name':'fti_mail_messages','fields':['plainBody',_0xfc04('0xc')],'type':_0xfc04('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49e5b6,_0x26542c,_0x5df52e){if(_0x49e5b6[_0xfc04('0xe')]){_0x49e5b6['plainBody']=htmlToText[_0xfc04('0xf')](_0x49e5b6[_0xfc04('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5df52e(null,_0x26542c);},'afterCreate':function(_0x579a1a,_0x118ece,_0x474ca3){var _0x26cfb9=_0x1e4439[_0xfc04('0x10')];var _0x5f14e0=_0x579a1a[_0xfc04('0x11')]({'plain':!![]});if(_0x5f14e0[_0xfc04('0x12')][_0xfc04('0x13')]()==='in'||_0x5f14e0['direction'][_0xfc04('0x13')]()===_0xfc04('0x14')&&!_0x5f14e0['secret']&&!_['isNil'](_0x5f14e0['UserId'])){_0x26cfb9['MailInteraction']['findOne']({'where':{'id':_0x5f14e0[_0xfc04('0x15')]}})[_0xfc04('0x16')](function(_0xdd6a41){if(_0xdd6a41){_0xdd6a41[_0xfc04('0x17')]({'lastMsgAt':_0x5f14e0[_0xfc04('0x18')],'lastMsgDirection':_0x5f14e0['direction'][_0xfc04('0x13')]()});}})[_0xfc04('0x19')](function(_0x17496c){console[_0xfc04('0x1a')](_0x17496c);});}_0x474ca3();}},'charset':_0xfc04('0x1b'),'collate':_0xfc04('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 88500d8..e1aa1e3 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 _0x282b=['MailMessage','body','options','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x5e9620,_0x22043a){var _0x1a5860=function(_0x1ae2b9){while(--_0x1ae2b9){_0x5e9620['push'](_0x5e9620['shift']());}};_0x1a5860(++_0x22043a);}(_0x282b,0xec));var _0xb282=function(_0x5fd035,_0x22d22e){_0x5fd035=_0x5fd035-0x0;var _0x3b19b4=_0x282b[_0x5fd035];return _0x3b19b4;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});config[_0xb282('0xb')]=_['defaults'](config['redis'],{'host':_0xb282('0xc'),'port':0x18eb});var socket=require(_0xb282('0xd'))(new Redis(config['redis']));require(_0xb282('0xe'))[_0xb282('0xf')](socket);function respondWithRpcPromise(_0x3435fc,_0x2d86ba,_0x56caf2){return new BPromise(function(_0x47e62e,_0x36b984){return client[_0xb282('0x10')](_0x3435fc,_0x56caf2)[_0xb282('0x11')](function(_0x1cbe28){logger[_0xb282('0x12')]('MailMessage,\x20%s,\x20%s',_0x2d86ba,'request\x20sent');logger[_0xb282('0x13')](_0xb282('0x14'),_0x2d86ba,_0xb282('0x15'),JSON[_0xb282('0x16')](_0x1cbe28));if(_0x1cbe28[_0xb282('0x17')]){if(_0x1cbe28['error'][_0xb282('0x18')]===0x1f4){logger['error'](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')]['message']);return _0x36b984(_0x1cbe28['error']['message']);}logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')][_0xb282('0x1a')]);return _0x47e62e(_0x1cbe28[_0xb282('0x17')]['message']);}else{logger[_0xb282('0x12')](_0xb282('0x19'),_0x2d86ba,_0xb282('0x15'));_0x47e62e(_0x1cbe28[_0xb282('0x1b')][_0xb282('0x1a')]);}})['catch'](function(_0x52e305){logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x52e305);_0x36b984(_0x52e305);});});}exports['CreateMailMessage']=function(_0x89543a){var _0x34b6c7=this;return new Promise(function(_0x2e3928,_0x438dbe){return db[_0xb282('0x1c')]['create'](_0x89543a[_0xb282('0x1d')],{'raw':_0x89543a[_0xb282('0x1e')]?_0x89543a[_0xb282('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb282('0x11')](function(_0x2a7ef8){logger[_0xb282('0x12')](_0xb282('0x1f'),_0x89543a);logger[_0xb282('0x13')]('CreateMailMessage',_0x89543a,JSON['stringify'](_0x2a7ef8));_0x2e3928(_0x2a7ef8);})[_0xb282('0x20')](function(_0x3c7f1f){logger['error']('CreateMailMessage',_0x3c7f1f[_0xb282('0x1a')],_0x89543a);_0x438dbe(_0x34b6c7[_0xb282('0x17')](0x1f4,_0x3c7f1f[_0xb282('0x1a')]));});});}; \ No newline at end of file +var _0x7880=['redis','defaults','localhost','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailMessage','create','body','options','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34b225,_0x5f0125){var _0x471f43=function(_0x2250a9){while(--_0x2250a9){_0x34b225['push'](_0x34b225['shift']());}};_0x471f43(++_0x5f0125);}(_0x7880,0x1f4));var _0x0788=function(_0x2a5160,_0x5f068d){_0x2a5160=_0x2a5160-0x0;var _0x2b42c5=_0x7880[_0x2a5160];return _0x2b42c5;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./mailMessage.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('MailMessage,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});}exports['CreateMailMessage']=function(_0x11ea01){var _0x5173d6=this;return new Promise(function(_0x7d0869,_0x48bc5f){return db[_0x0788('0x1b')][_0x0788('0x1c')](_0x11ea01[_0x0788('0x1d')],{'raw':_0x11ea01[_0x0788('0x1e')]?_0x11ea01[_0x0788('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2270d4){logger[_0x0788('0x11')](_0x0788('0x1f'),_0x11ea01);logger[_0x0788('0x14')]('CreateMailMessage',_0x11ea01,JSON['stringify'](_0x2270d4));_0x7d0869(_0x2270d4);})[_0x0788('0x1a')](function(_0x18cc33){logger[_0x0788('0x16')]('CreateMailMessage',_0x18cc33['message'],_0x11ea01);_0x48bc5f(_0x5173d6[_0x0788('0x16')](0x1f4,_0x18cc33[_0x0788('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ccfedc5..922e7a7 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 _0x2e3d=['mailMessage:','./mailMessage.events','update','register','length'];(function(_0x2c0e94,_0x1f2c9d){var _0x5db0be=function(_0x26ea02){while(--_0x26ea02){_0x2c0e94['push'](_0x2c0e94['shift']());}};_0x5db0be(++_0x1f2c9d);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x3b4142,_0x46fee4){_0x3b4142=_0x3b4142-0x0;var _0x4e9325=_0x2e3d[_0x3b4142];return _0x4e9325;};'use strict';var MailMessageEvents=require(_0xd2e3('0x0'));var events=['save','remove',_0xd2e3('0x1')];function createListener(_0x22ea7a,_0x32c465){return function(_0x2bf502){_0x32c465['emit'](_0x22ea7a,_0x2bf502);};}function removeListener(_0x5d4151,_0x21e04a){return function(){MailMessageEvents['removeListener'](_0x5d4151,_0x21e04a);};}exports[_0xd2e3('0x2')]=function(_0x2ba133){for(var _0x3beebf=0x0,_0x471fd0=events[_0xd2e3('0x3')];_0x3beebf<_0x471fd0;_0x3beebf++){var _0x1f4d8e=events[_0x3beebf];var _0x50dd17=createListener(_0xd2e3('0x4')+_0x1f4d8e,_0x2ba133);MailMessageEvents['on'](_0x1f4d8e,_0x50dd17);}}; \ No newline at end of file +var _0x7dc2=['update','emit','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x229118,_0x19d445){var _0x11f0e0=function(_0x55f391){while(--_0x55f391){_0x229118['push'](_0x229118['shift']());}};_0x11f0e0(++_0x19d445);}(_0x7dc2,0xeb));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var MailMessageEvents=require(_0x27dc('0x0'));var events=[_0x27dc('0x1'),_0x27dc('0x2'),_0x27dc('0x3')];function createListener(_0x4b88cf,_0x1c7e17){return function(_0x577933){_0x1c7e17[_0x27dc('0x4')](_0x4b88cf,_0x577933);};}function removeListener(_0x2e9340,_0x274bd3){return function(){MailMessageEvents['removeListener'](_0x2e9340,_0x274bd3);};}exports['register']=function(_0x1c7d69){for(var _0x140cf9=0x0,_0x18b976=events[_0x27dc('0x5')];_0x140cf9<_0x18b976;_0x140cf9++){var _0x565944=events[_0x140cf9];var _0x4fe150=createListener(_0x27dc('0x6')+_0x565944,_0x1c7d69);MailMessageEvents['on'](_0x565944,_0x4fe150);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c0eb289..5fb7acb 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 _0x8800=['addTeams','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x8800,0x7c));var _0x0880=function(_0xa93d5c,_0x1c9534){_0xa93d5c=_0xa93d5c-0x0;var _0xfdae22=_0x8800[_0xa93d5c];return _0xfdae22;};'use strict';var multer=require(_0x0880('0x0'));var util=require('util');var path=require(_0x0880('0x1'));var timeout=require(_0x0880('0x2'));var express=require(_0x0880('0x3'));var router=express[_0x0880('0x4')]();var fs_extra=require(_0x0880('0x5'));var auth=require(_0x0880('0x6'));var interaction=require(_0x0880('0x7'));var config=require(_0x0880('0x8'));var controller=require(_0x0880('0x9'));router[_0x0880('0xa')]('/',auth[_0x0880('0xb')](),controller['index']);router[_0x0880('0xa')](_0x0880('0xc'),auth[_0x0880('0xb')](),controller['describe']);router[_0x0880('0xa')]('/:id',auth[_0x0880('0xb')](),controller[_0x0880('0xd')]);router[_0x0880('0xa')](_0x0880('0xe'),auth[_0x0880('0xb')](),controller[_0x0880('0xf')]);router['get'](_0x0880('0x10'),auth[_0x0880('0xb')](),controller['getTeams']);router['get'](_0x0880('0x11'),auth[_0x0880('0xb')](),controller[_0x0880('0x12')]);router[_0x0880('0x13')]('/',auth[_0x0880('0xb')](),controller[_0x0880('0x14')]);router[_0x0880('0x13')](_0x0880('0x10'),auth[_0x0880('0xb')](),controller[_0x0880('0x15')]);router['post'](_0x0880('0x11'),auth[_0x0880('0xb')](),controller['addAgents']);router['put'](_0x0880('0x16'),auth[_0x0880('0xb')](),controller[_0x0880('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0880('0x18')]);router[_0x0880('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0880('0x1a')]);router[_0x0880('0x19')](_0x0880('0x11'),auth['isAuthenticated'](),controller[_0x0880('0x1b')]);module[_0x0880('0x1c')]=router; \ No newline at end of file +var _0xb14f=['/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams'];(function(_0x2a7833,_0x3243fe){var _0x1823ed=function(_0x315d7e){while(--_0x315d7e){_0x2a7833['push'](_0x2a7833['shift']());}};_0x1823ed(++_0x3243fe);}(_0xb14f,0x97));var _0xfb14=function(_0x2e98ba,_0x4e6cf4){_0x2e98ba=_0x2e98ba-0x0;var _0x70c229=_0xb14f[_0x2e98ba];return _0x70c229;};'use strict';var multer=require(_0xfb14('0x0'));var util=require('util');var path=require(_0xfb14('0x1'));var timeout=require(_0xfb14('0x2'));var express=require(_0xfb14('0x3'));var router=express[_0xfb14('0x4')]();var fs_extra=require(_0xfb14('0x5'));var auth=require(_0xfb14('0x6'));var interaction=require(_0xfb14('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xfb14('0x8')]('/',auth[_0xfb14('0x9')](),controller[_0xfb14('0xa')]);router[_0xfb14('0x8')](_0xfb14('0xb'),auth[_0xfb14('0x9')](),controller[_0xfb14('0xc')]);router[_0xfb14('0x8')]('/:id',auth[_0xfb14('0x9')](),controller[_0xfb14('0xd')]);router[_0xfb14('0x8')](_0xfb14('0xe'),auth[_0xfb14('0x9')](),controller['getMembers']);router['get'](_0xfb14('0xf'),auth[_0xfb14('0x9')](),controller[_0xfb14('0x10')]);router[_0xfb14('0x8')](_0xfb14('0x11'),auth[_0xfb14('0x9')](),controller[_0xfb14('0x12')]);router[_0xfb14('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xfb14('0x14')]);router[_0xfb14('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xfb14('0x15')]);router[_0xfb14('0x16')](_0xfb14('0x17'),auth[_0xfb14('0x9')](),controller[_0xfb14('0x18')]);router[_0xfb14('0x19')](_0xfb14('0x17'),auth['isAuthenticated'](),controller[_0xfb14('0x1a')]);router[_0xfb14('0x19')](_0xfb14('0xf'),auth[_0xfb14('0x9')](),controller['removeTeams']);router[_0xfb14('0x19')](_0xfb14('0x11'),auth[_0xfb14('0x9')](),controller[_0xfb14('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 252192a..1a85a9c 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 _0x902c=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x5a1e7c,_0x5d5682){var _0x491862=function(_0x446971){while(--_0x446971){_0x5a1e7c['push'](_0x5a1e7c['shift']());}};_0x491862(++_0x5d5682);}(_0x902c,0x6c));var _0xc902=function(_0x1e9975,_0x4af5fa){_0x1e9975=_0x1e9975-0x0;var _0x5924eb=_0x902c[_0x1e9975];return _0x5924eb;};'use strict';var Sequelize=require(_0xc902('0x0'));module[_0xc902('0x1')]={'name':{'type':Sequelize[_0xc902('0x2')],'unique':_0xc902('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc902('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc902('0x4')]('rrmemory',_0xc902('0x5'),_0xc902('0x6'))}}; \ No newline at end of file +var _0x5a56=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4c0380,_0xccf82a){var _0x2c5f65=function(_0x1210d5){while(--_0x1210d5){_0x4c0380['push'](_0x4c0380['shift']());}};_0x2c5f65(++_0xccf82a);}(_0x5a56,0x9e));var _0x65a5=function(_0x9533e1,_0x49e60c){_0x9533e1=_0x9533e1-0x0;var _0x3e6efd=_0x5a56[_0x9533e1];return _0x3e6efd;};'use strict';var Sequelize=require(_0x65a5('0x0'));module[_0x65a5('0x1')]={'name':{'type':Sequelize[_0x65a5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x65a5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x65a5('0x4')](_0x65a5('0x5'),_0x65a5('0x6'),_0x65a5('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b4dffc5..453db83 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 _0xb9a0=['end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','nolimit','order','where','pick','filter','merge','options','MailQueue','includeAll','rows','catch','show','keys','intersection','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','sort','MailQueueId','findAll','User','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','forEach','emit','userMailQueue:save','removeTeams','Team','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status'];(function(_0x3cd328,_0x527985){var _0x4cedca=function(_0x19fc94){while(--_0x19fc94){_0x3cd328['push'](_0x3cd328['shift']());}};_0x4cedca(++_0x527985);}(_0xb9a0,0x186));var _0x0b9a=function(_0x30772a,_0x341edc){_0x30772a=_0x30772a-0x0;var _0x1fda7c=_0xb9a0[_0x30772a];return _0x1fda7c;};'use strict';var emlformat=require(_0x0b9a('0x0'));var rimraf=require(_0x0b9a('0x1'));var zipdir=require(_0x0b9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b9a('0x3'));var moment=require(_0x0b9a('0x4'));var BPromise=require(_0x0b9a('0x5'));var Mustache=require(_0x0b9a('0x6'));var util=require(_0x0b9a('0x7'));var path=require(_0x0b9a('0x8'));var sox=require(_0x0b9a('0x9'));var csv=require('to-csv');var ejs=require(_0x0b9a('0xa'));var fs=require('fs');var fs_extra=require(_0x0b9a('0xb'));var _=require(_0x0b9a('0xc'));var squel=require(_0x0b9a('0xd'));var crypto=require(_0x0b9a('0xe'));var jsforce=require(_0x0b9a('0xf'));var deskjs=require(_0x0b9a('0x10'));var toCsv=require(_0x0b9a('0x11'));var querystring=require(_0x0b9a('0x12'));var Papa=require(_0x0b9a('0x13'));var Redis=require(_0x0b9a('0x14'));var authService=require(_0x0b9a('0x15'));var qs=require(_0x0b9a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b9a('0x17'));var logger=require('../../config/logger')(_0x0b9a('0x18'));var utils=require('../../config/utils');var config=require(_0x0b9a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0b9a('0x1a')]=_[_0x0b9a('0x1b')](config[_0x0b9a('0x1a')],{'host':_0x0b9a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b9a('0x1a')]));require(_0x0b9a('0x1d'))[_0x0b9a('0x1e')](socket);function respondWithStatusCode(_0x31adef,_0x1de36d){_0x1de36d=_0x1de36d||0xcc;return function(_0xcdef1c){if(_0xcdef1c){return _0x31adef[_0x0b9a('0x1f')](_0x1de36d);}return _0x31adef[_0x0b9a('0x20')](_0x1de36d)[_0x0b9a('0x21')]();};}function respondWithResult(_0x17dda7,_0x1b8380){_0x1b8380=_0x1b8380||0xc8;return function(_0x4fef3f){if(_0x4fef3f){return _0x17dda7[_0x0b9a('0x20')](_0x1b8380)[_0x0b9a('0x22')](_0x4fef3f);}};}function respondWithFilteredResult(_0xcaa5d0,_0x5f102b){return function(_0x3fb823){if(_0x3fb823){var _0x5f0fd9=typeof _0x5f102b['offset']===_0x0b9a('0x23')&&typeof _0x5f102b[_0x0b9a('0x24')]===_0x0b9a('0x23');var _0x3a2268=_0x3fb823[_0x0b9a('0x25')];var _0x180bdb=_0x5f0fd9?0x0:_0x5f102b[_0x0b9a('0x26')];var _0x1a2cd5=_0x5f0fd9?_0x3fb823['count']:_0x5f102b['offset']+_0x5f102b[_0x0b9a('0x24')];var _0x53b526;if(_0x1a2cd5>=_0x3a2268){_0x1a2cd5=_0x3a2268;_0x53b526=0xc8;}else{_0x53b526=0xce;}_0xcaa5d0[_0x0b9a('0x20')](_0x53b526);return _0xcaa5d0[_0x0b9a('0x27')](_0x0b9a('0x28'),_0x180bdb+'-'+_0x1a2cd5+'/'+_0x3a2268)[_0x0b9a('0x22')](_0x3fb823);}return null;};}function patchUpdates(_0x362b65){return function(_0xdb6a0b){try{jsonpatch[_0x0b9a('0x29')](_0xdb6a0b,_0x362b65,!![]);}catch(_0x1ae8d5){return BPromise['reject'](_0x1ae8d5);}return _0xdb6a0b[_0x0b9a('0x2a')]();};}function saveUpdates(_0xa5dd9e,_0x2b37dd){return function(_0x1f29ac){if(_0x1f29ac){return _0x1f29ac[_0x0b9a('0x2b')](_0xa5dd9e)[_0x0b9a('0x2c')](function(_0x535e40){return _0x535e40;});}return null;};}function removeEntity(_0x13eb99,_0x538287){return function(_0x4964b9){if(_0x4964b9){return _0x4964b9[_0x0b9a('0x2d')]()['then'](function(){var _0x2cca68=_0x4964b9[_0x0b9a('0x2e')]({'plain':!![]});var _0xcfe793='MailQueues';return db[_0x0b9a('0x2f')][_0x0b9a('0x2d')]({'where':{'type':_0xcfe793,'resourceId':_0x2cca68['id']}})[_0x0b9a('0x2c')](function(){return _0x4964b9;});})[_0x0b9a('0x2c')](function(){_0x13eb99[_0x0b9a('0x20')](0xcc)[_0x0b9a('0x21')]();});}};}function handleEntityNotFound(_0x4bd629,_0x3bfe08){return function(_0x21ebae){if(!_0x21ebae){_0x4bd629[_0x0b9a('0x1f')](0x194);}return _0x21ebae;};}function handleError(_0x3eaa74,_0x2effcf){_0x2effcf=_0x2effcf||0x1f4;return function(_0x890d1d){logger['error'](_0x890d1d[_0x0b9a('0x30')]);if(_0x890d1d[_0x0b9a('0x31')]){delete _0x890d1d[_0x0b9a('0x31')];}_0x3eaa74['status'](_0x2effcf)['send'](_0x890d1d);};}exports[_0x0b9a('0x32')]=function(_0x494052,_0x316f96){var _0x4ca09c={},_0xf1e1ff={},_0x5cf4e3={'count':0x0,'rows':[]};var _0xe39e5c=_['map'](db['MailQueue'][_0x0b9a('0x33')],function(_0x330fd6){return{'name':_0x330fd6[_0x0b9a('0x34')],'type':_0x330fd6[_0x0b9a('0x35')][_0x0b9a('0x36')]};});_0xf1e1ff[_0x0b9a('0x37')]=_[_0x0b9a('0x38')](_0xe39e5c,'name');_0xf1e1ff[_0x0b9a('0x39')]=_['keys'](_0x494052['query']);_0xf1e1ff[_0x0b9a('0x3a')]=_['intersection'](_0xf1e1ff[_0x0b9a('0x37')],_0xf1e1ff[_0x0b9a('0x39')]);_0x4ca09c[_0x0b9a('0x3b')]=_['intersection'](_0xf1e1ff[_0x0b9a('0x37')],qs['fields'](_0x494052['query']['fields']));_0x4ca09c[_0x0b9a('0x3b')]=_0x4ca09c[_0x0b9a('0x3b')]['length']?_0x4ca09c[_0x0b9a('0x3b')]:_0xf1e1ff[_0x0b9a('0x37')];if(!_0x494052['query']['hasOwnProperty'](_0x0b9a('0x3c'))){_0x4ca09c[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x494052['query'][_0x0b9a('0x24')]);_0x4ca09c[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x494052[_0x0b9a('0x39')][_0x0b9a('0x26')]);}_0x4ca09c[_0x0b9a('0x3d')]=qs['sort'](_0x494052[_0x0b9a('0x39')]['sort']);_0x4ca09c[_0x0b9a('0x3e')]=qs['filters'](_[_0x0b9a('0x3f')](_0x494052['query'],_0xf1e1ff[_0x0b9a('0x3a')]),_0xe39e5c);if(_0x494052[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x4ca09c['where']=_[_0x0b9a('0x41')](_0x4ca09c[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0xe39e5c,function(_0xd4c6c){if(_0xd4c6c['type']!=='VIRTUAL'){var _0x365ac4={};_0x365ac4[_0xd4c6c['name']]={'$like':'%'+_0x494052[_0x0b9a('0x39')]['filter']+'%'};return _0x365ac4;}})});}_0x4ca09c=_[_0x0b9a('0x41')]({},_0x4ca09c,_0x494052[_0x0b9a('0x42')]);var _0x174e0d={'where':_0x4ca09c[_0x0b9a('0x3e')]};return db[_0x0b9a('0x43')][_0x0b9a('0x25')](_0x174e0d)[_0x0b9a('0x2c')](function(_0x420702){_0x5cf4e3['count']=_0x420702;if(_0x494052['query'][_0x0b9a('0x44')]){_0x4ca09c['include']=[{'all':!![]}];}return db[_0x0b9a('0x43')]['findAll'](_0x4ca09c);})[_0x0b9a('0x2c')](function(_0x47da96){_0x5cf4e3[_0x0b9a('0x45')]=_0x47da96;return _0x5cf4e3;})['then'](respondWithFilteredResult(_0x316f96,_0x4ca09c))[_0x0b9a('0x46')](handleError(_0x316f96,null));};exports[_0x0b9a('0x47')]=function(_0x5ac4c7,_0x3b3b2d){var _0x2a5295={'raw':!![],'where':{'id':_0x5ac4c7['params']['id']}},_0x3e6e97={};_0x3e6e97[_0x0b9a('0x37')]=_[_0x0b9a('0x48')](db[_0x0b9a('0x43')][_0x0b9a('0x33')]);_0x3e6e97[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x5ac4c7[_0x0b9a('0x39')]);_0x3e6e97[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x3e6e97[_0x0b9a('0x37')],_0x3e6e97['query']);_0x2a5295['attributes']=_[_0x0b9a('0x49')](_0x3e6e97[_0x0b9a('0x37')],qs['fields'](_0x5ac4c7['query'][_0x0b9a('0x4a')]));_0x2a5295[_0x0b9a('0x3b')]=_0x2a5295[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x2a5295['attributes']:_0x3e6e97[_0x0b9a('0x37')];if(_0x5ac4c7[_0x0b9a('0x39')][_0x0b9a('0x44')]){_0x2a5295['include']=[{'all':!![]}];}_0x2a5295=_[_0x0b9a('0x41')]({},_0x2a5295,_0x5ac4c7[_0x0b9a('0x42')]);return db['MailQueue'][_0x0b9a('0x4c')](_0x2a5295)[_0x0b9a('0x2c')](handleEntityNotFound(_0x3b3b2d,null))[_0x0b9a('0x2c')](respondWithResult(_0x3b3b2d,null))[_0x0b9a('0x46')](handleError(_0x3b3b2d,null));};exports[_0x0b9a('0x4d')]=function(_0x2cc5cf,_0x271b4b){return db['MailQueue'][_0x0b9a('0x4d')](_0x2cc5cf[_0x0b9a('0x4e')],{})[_0x0b9a('0x2c')](function(_0x2e5760){var _0xa6ecf2=_0x2cc5cf[_0x0b9a('0x4f')][_0x0b9a('0x2e')]({'plain':!![]});if(!_0xa6ecf2)throw new Error(_0x0b9a('0x50'));if(_0xa6ecf2[_0x0b9a('0x51')]===_0x0b9a('0x4f')){var _0x37de41=_0x2e5760[_0x0b9a('0x2e')]({'plain':!![]});var _0x38d6c7='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x38d6c7,'userProfileId':_0xa6ecf2[_0x0b9a('0x52')]},'raw':!![]})[_0x0b9a('0x2c')](function(_0x59b7ac){if(_0x59b7ac&&_0x59b7ac[_0x0b9a('0x53')]===0x0){return db[_0x0b9a('0x2f')]['create']({'name':_0x37de41['name'],'resourceId':_0x37de41['id'],'type':_0x59b7ac[_0x0b9a('0x31')],'sectionId':_0x59b7ac['id']},{})[_0x0b9a('0x2c')](function(){return _0x2e5760;});}else{return _0x2e5760;}})[_0x0b9a('0x46')](function(_0xeec42a){logger[_0x0b9a('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeec42a);throw _0xeec42a;});}return _0x2e5760;})[_0x0b9a('0x2c')](respondWithResult(_0x271b4b,0xc9))[_0x0b9a('0x46')](handleError(_0x271b4b,null));};exports['update']=function(_0x29ee0a,_0x545269){if(_0x29ee0a[_0x0b9a('0x4e')]['id']){delete _0x29ee0a['body']['id'];}return db[_0x0b9a('0x43')]['find']({'where':{'id':_0x29ee0a[_0x0b9a('0x55')]['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x545269,null))[_0x0b9a('0x2c')](saveUpdates(_0x29ee0a[_0x0b9a('0x4e')],null))[_0x0b9a('0x2c')](respondWithResult(_0x545269,null))[_0x0b9a('0x46')](handleError(_0x545269,null));};exports[_0x0b9a('0x2d')]=function(_0x2ad30a,_0x1640a4){return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x2ad30a[_0x0b9a('0x55')]['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x1640a4,null))['then'](removeEntity(_0x1640a4,null))['catch'](handleError(_0x1640a4,null));};exports[_0x0b9a('0x56')]=function(_0xcacdae,_0x260409){return db[_0x0b9a('0x43')][_0x0b9a('0x56')]()[_0x0b9a('0x2c')](respondWithResult(_0x260409,null))[_0x0b9a('0x46')](handleError(_0x260409,null));};exports[_0x0b9a('0x57')]=function(_0x505837,_0x42d9d3,_0x4f0504){var _0x5654a3={'raw':!![],'where':{}},_0x5e2266={},_0x590b29;return db[_0x0b9a('0x43')][_0x0b9a('0x58')]({'where':{'id':_0x505837['params']['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x42d9d3,null))[_0x0b9a('0x2c')](function(_0x2d282c){if(_0x2d282c){_0x590b29=_0x2d282c[_0x0b9a('0x2e')]({'plain':!![]});_0x5e2266[_0x0b9a('0x37')]=_['keys'](db[_0x0b9a('0x59')][_0x0b9a('0x33')]);_0x5e2266[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x505837[_0x0b9a('0x39')]);_0x5e2266[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x5e2266[_0x0b9a('0x37')],_0x5e2266[_0x0b9a('0x39')]);_0x5654a3[_0x0b9a('0x3b')]=_[_0x0b9a('0x49')](_0x5e2266[_0x0b9a('0x37')],qs['fields'](_0x505837['query'][_0x0b9a('0x4a')]));_0x5654a3[_0x0b9a('0x3b')]=_0x5654a3[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x5654a3[_0x0b9a('0x3b')]:_0x5e2266[_0x0b9a('0x37')];if(!_0x505837[_0x0b9a('0x39')][_0x0b9a('0x5a')]('nolimit')){_0x5654a3[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x505837[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x5654a3[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x505837['query'][_0x0b9a('0x26')]);}_0x5654a3['order']=qs['sort'](_0x505837['query'][_0x0b9a('0x5b')]);_0x5654a3['where']=qs['filters'](_[_0x0b9a('0x3f')](_0x505837[_0x0b9a('0x39')],_0x5e2266[_0x0b9a('0x3a')]));_0x5654a3['where'][_0x0b9a('0x5c')]=_0x2d282c['id'];if(_0x505837[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x5654a3[_0x0b9a('0x3e')]=_[_0x0b9a('0x41')](_0x5654a3[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0x5654a3[_0x0b9a('0x3b')],function(_0x505e38){var _0x221cd1={};_0x221cd1[_0x505e38]={'$like':'%'+_0x505837[_0x0b9a('0x39')][_0x0b9a('0x40')]+'%'};return _0x221cd1;})});}_0x5654a3=_[_0x0b9a('0x41')]({},_0x5654a3,_0x505837[_0x0b9a('0x42')]);return db[_0x0b9a('0x59')][_0x0b9a('0x5d')](_0x5654a3);}})[_0x0b9a('0x2c')](function(_0x22500c){if(_0x22500c){return db[_0x0b9a('0x5e')]['findAndCountAll']({'where':{'id':_[_0x0b9a('0x38')](_0x22500c,_0x0b9a('0x5f')),'role':_0x0b9a('0x60')},'attributes':['id',_0x0b9a('0x31'),_0x0b9a('0x61'),'updatedAt',_0x0b9a('0x62')]});}})['then'](function(_0x4f23fd){if(_0x4f23fd){return{'count':_0x4f23fd[_0x0b9a('0x25')],'rows':_[_0x0b9a('0x38')](_0x4f23fd['rows'],function(_0x4265c7){return{'membername':_0x4265c7[_0x0b9a('0x31')],'UserId':_0x4265c7['id'],'queue_name':_0x590b29[_0x0b9a('0x31')],'MailQueueId':_0x590b29['id'],'interface':util[_0x0b9a('0x63')](_0x0b9a('0x64'),_0x0b9a('0x65'),_0x4265c7[_0x0b9a('0x31')]),'penalty':0x0,'paused':_0x4265c7[_0x0b9a('0x61')],'createdAt':_0x4265c7[_0x0b9a('0x62')],'updatedAt':_0x4265c7[_0x0b9a('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42d9d3,_0x5654a3))['catch'](handleError(_0x42d9d3,null));};exports[_0x0b9a('0x67')]=function(_0x4e8f1a,_0x36f96a,_0x52f9bf){var _0x37c94f={};var _0x122e4a={};var _0xce8c16;var _0x4d7d79;return db['MailQueue'][_0x0b9a('0x58')]({'where':{'id':_0x4e8f1a[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x36f96a,null))[_0x0b9a('0x2c')](function(_0xb5ae6e){if(_0xb5ae6e){_0xce8c16=_0xb5ae6e;_0x122e4a['model']=_[_0x0b9a('0x48')](db['Team'][_0x0b9a('0x33')]);_0x122e4a['query']=_[_0x0b9a('0x48')](_0x4e8f1a[_0x0b9a('0x39')]);_0x122e4a[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x122e4a[_0x0b9a('0x37')],_0x122e4a[_0x0b9a('0x39')]);_0x37c94f['attributes']=_[_0x0b9a('0x49')](_0x122e4a[_0x0b9a('0x37')],qs[_0x0b9a('0x4a')](_0x4e8f1a['query']['fields']));_0x37c94f[_0x0b9a('0x3b')]=_0x37c94f[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x37c94f['attributes']:_0x122e4a[_0x0b9a('0x37')];_0x37c94f[_0x0b9a('0x3d')]=qs[_0x0b9a('0x5b')](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x5b')]);_0x37c94f[_0x0b9a('0x3e')]=qs[_0x0b9a('0x3a')](_[_0x0b9a('0x3f')](_0x4e8f1a[_0x0b9a('0x39')],_0x122e4a[_0x0b9a('0x3a')]));if(_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x37c94f[_0x0b9a('0x3e')]=_[_0x0b9a('0x41')](_0x37c94f[_0x0b9a('0x3e')],{'$or':_['map'](_0x37c94f[_0x0b9a('0x3b')],function(_0x52a0b2){var _0x2cc2b8={};_0x2cc2b8[_0x52a0b2]={'$like':'%'+_0x4e8f1a[_0x0b9a('0x39')]['filter']+'%'};return _0x2cc2b8;})});}_0x37c94f=_[_0x0b9a('0x41')]({},_0x37c94f,_0x4e8f1a['options']);return _0xce8c16[_0x0b9a('0x67')](_0x37c94f);}})[_0x0b9a('0x2c')](function(_0x340468){if(_0x340468){_0x4d7d79=_0x340468[_0x0b9a('0x4b')];if(!_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x5a')]('nolimit')){_0x37c94f[_0x0b9a('0x24')]=qs['limit'](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x37c94f[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x26')]);}return _0xce8c16[_0x0b9a('0x67')](_0x37c94f);}})[_0x0b9a('0x2c')](function(_0x4d1936){if(_0x4d1936){return _0x4d1936?{'count':_0x4d7d79,'rows':_0x4d1936}:null;}})[_0x0b9a('0x2c')](respondWithResult(_0x36f96a,null))['catch'](handleError(_0x36f96a,null));};exports['addTeams']=function(_0x261b44,_0x485b02,_0xd71b96){var _0x2c03bc=_0x261b44[_0x0b9a('0x4e')][_0x0b9a('0x68')];return db['Team']['findAll']({'where':{'id':_0x2c03bc},'attributes':['id'],'include':[{'model':db[_0x0b9a('0x5e')],'as':_0x0b9a('0x69'),'attributes':['id',_0x0b9a('0x31'),_0x0b9a('0x6a'),_0x0b9a('0x6b'),'interface'],'raw':!![]}]})[_0x0b9a('0x2c')](function(_0x1c8305){if(_0x1c8305){var _0x4c4a98=_[_0x0b9a('0x6c')](_0x1c8305,function(_0x4b00e6){var _0x23885a=_0x4b00e6[_0x0b9a('0x2e')]({'plain':!![]});return _0x23885a[_0x0b9a('0x69')];});return db['MailQueue']['find']({'where':{'id':_0x261b44[_0x0b9a('0x55')]['id']}})['then'](function(_0x4abf43){return db[_0x0b9a('0x6d')][_0x0b9a('0x6e')](function(_0x41d03f){return _0x4abf43[_0x0b9a('0x6f')](_0x2c03bc,{'transaction':_0x41d03f})['then'](function(){return BPromise['each'](_0x4c4a98,function(_0x2c5096){return db[_0x0b9a('0x59')]['findOrCreate']({'where':{'UserId':_0x2c5096['id'],'MailQueueId':_0x261b44[_0x0b9a('0x55')]['id']},'transaction':_0x41d03f});});})[_0x0b9a('0x2c')](function(){_0x4c4a98[_0x0b9a('0x70')](function(_0x2996a8){socket[_0x0b9a('0x71')](_0x0b9a('0x72'),{'UserId':_0x2996a8['id'],'MailQueueId':_0x4abf43['id']});});});});});}})['then'](respondWithStatusCode(_0x485b02,null))[_0x0b9a('0x46')](handleError(_0x485b02,null));};exports[_0x0b9a('0x73')]=function(_0x109494,_0x52586d,_0x486961){return db[_0x0b9a('0x74')][_0x0b9a('0x5d')]({'where':{'id':_0x109494[_0x0b9a('0x39')][_0x0b9a('0x68')]},'attributes':['id'],'include':[{'model':db[_0x0b9a('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x52586d,null))[_0x0b9a('0x2c')](function(_0x4d1e7a){var _0x1b6609=_['map'](_0x4d1e7a,'id');var _0x30b4c7=[];var _0x1fde61=[];var _0x1a9b66=squel['select']();_0x1a9b66['field'](_0x0b9a('0x75'))[_0x0b9a('0x76')](_0x0b9a('0x77'),'tq')[_0x0b9a('0x78')](_0x0b9a('0x79'),'ut',_0x0b9a('0x7a'))[_0x0b9a('0x3e')](_0x0b9a('0x7b'),_0x109494[_0x0b9a('0x55')]['id']);for(var _0x451aad=0x0;_0x451aad<_0x4d1e7a[_0x0b9a('0x4b')];_0x451aad+=0x1){let _0x23b9d8=_0x4d1e7a[_0x451aad];for(var _0x1be50=0x0;_0x1be50<_0x23b9d8[_0x0b9a('0x69')][_0x0b9a('0x4b')];_0x1be50+=0x1){let _0x72535c=_0x23b9d8[_0x0b9a('0x69')][_0x1be50];var _0xe1ce37=_0x1a9b66['clone']();_0xe1ce37[_0x0b9a('0x3e')]('ut.UserId\x20=\x20?',_0x72535c['id']);_0x1fde61['push'](db[_0x0b9a('0x6d')][_0x0b9a('0x39')](_0xe1ce37[_0x0b9a('0x7c')](),{'type':db[_0x0b9a('0x6d')][_0x0b9a('0x7d')][_0x0b9a('0x7e')]})[_0x0b9a('0x2c')](function(_0x24ff88){if(_0x24ff88[_0x0b9a('0x4b')]===0x1){return _0x72535c['id'];}else{var _0x2cf263=_[_0x0b9a('0x7f')](_[_0x0b9a('0x38')](_0x24ff88,'TeamId'),function(_0x4eeacc){return _[_0x0b9a('0x80')](_0x1b6609,_0x4eeacc);});if(_0x2cf263){return _0x72535c['id'];}}}));}}return BPromise[_0x0b9a('0x81')](_0x1fde61)[_0x0b9a('0x2c')](function(_0x10fc0d){_0x30b4c7=_(_0x30b4c7)[_0x0b9a('0x82')](_0x10fc0d)[_0x0b9a('0x83')]()[_0x0b9a('0x84')]();return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x109494['params']['id']}})[_0x0b9a('0x2c')](function(_0x442d80){return db[_0x0b9a('0x6d')]['transaction'](function(_0x4cb737){return _0x442d80[_0x0b9a('0x73')](_0x109494[_0x0b9a('0x39')]['ids'],{'transaction':_0x4cb737})[_0x0b9a('0x2c')](function(){if(!_[_0x0b9a('0x85')](_0x30b4c7)){return _0x442d80[_0x0b9a('0x86')](_0x30b4c7,{'transaction':_0x4cb737});}})['then'](function(){_0x30b4c7[_0x0b9a('0x70')](function(_0x34e1ad){socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':_0x34e1ad,'MailQueueId':_0x442d80['id']});});});});});});})[_0x0b9a('0x2c')](respondWithStatusCode(_0x52586d,null))[_0x0b9a('0x46')](handleError(_0x52586d,null));};exports[_0x0b9a('0x88')]=function(_0x4c8b9c,_0x4d2b28,_0x1435cc){return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x4c8b9c['params']['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x4d2b28,null))[_0x0b9a('0x2c')](function(_0x1a9415){if(_0x1a9415){return _0x1a9415['addAgents'](_0x4c8b9c[_0x0b9a('0x4e')]['ids'],_[_0x0b9a('0x89')](_0x4c8b9c[_0x0b9a('0x4e')],[_0x0b9a('0x68'),'id'])||{})[_0x0b9a('0x8a')](function(_0x5f3ada){for(var _0x306b7a=0x0;_0x306b7a<_0x4c8b9c['body'][_0x0b9a('0x68')][_0x0b9a('0x4b')];_0x306b7a+=0x1){socket[_0x0b9a('0x71')](_0x0b9a('0x72'),{'UserId':Number(_0x4c8b9c[_0x0b9a('0x4e')][_0x0b9a('0x68')][_0x306b7a]),'MailQueueId':Number(_0x4c8b9c[_0x0b9a('0x55')]['id'])});}return _0x5f3ada;});}})[_0x0b9a('0x2c')](respondWithResult(_0x4d2b28,null))[_0x0b9a('0x46')](handleError(_0x4d2b28,null));};exports[_0x0b9a('0x86')]=function(_0xae102a,_0xc2e8f7,_0x42bd97){return db[_0x0b9a('0x43')]['find']({'where':{'id':_0xae102a[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0xc2e8f7,null))['then'](function(_0x2fb66e){if(_0x2fb66e){return _0x2fb66e['removeAgents'](_0xae102a[_0x0b9a('0x39')][_0x0b9a('0x68')])[_0x0b9a('0x2c')](function(){if(_[_0x0b9a('0x8b')](_0xae102a['query'][_0x0b9a('0x68')])){for(var _0x344755=0x0;_0x344755<_0xae102a[_0x0b9a('0x39')][_0x0b9a('0x68')][_0x0b9a('0x4b')];_0x344755+=0x1){socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':Number(_0xae102a[_0x0b9a('0x39')]['ids'][_0x344755]),'MailQueueId':Number(_0xae102a[_0x0b9a('0x55')]['id'])});}}else{socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':Number(_0xae102a['query']['ids']),'MailQueueId':Number(_0xae102a[_0x0b9a('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xc2e8f7,null))[_0x0b9a('0x46')](handleError(_0xc2e8f7,null));};exports[_0x0b9a('0x8c')]=function(_0x3d0d88,_0x459c8c,_0x14e7bc){var _0x2c88ee={};var _0x2ac188={};var _0x3540b0;var _0x2c85ca;return db[_0x0b9a('0x43')]['findOne']({'where':{'id':_0x3d0d88[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x459c8c,null))['then'](function(_0xf36bfa){if(_0xf36bfa){_0x3540b0=_0xf36bfa;_0x2ac188[_0x0b9a('0x37')]=_[_0x0b9a('0x48')](db[_0x0b9a('0x5e')][_0x0b9a('0x33')]);_0x2ac188[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x3d0d88[_0x0b9a('0x39')]);_0x2ac188[_0x0b9a('0x3a')]=_['intersection'](_0x2ac188[_0x0b9a('0x37')],_0x2ac188[_0x0b9a('0x39')]);_0x2c88ee[_0x0b9a('0x3b')]=_['intersection'](_0x2ac188[_0x0b9a('0x37')],qs[_0x0b9a('0x4a')](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x4a')]));_0x2c88ee[_0x0b9a('0x3b')]=_0x2c88ee['attributes'][_0x0b9a('0x4b')]?_0x2c88ee[_0x0b9a('0x3b')]:_0x2ac188[_0x0b9a('0x37')];_0x2c88ee['order']=qs[_0x0b9a('0x5b')](_0x3d0d88[_0x0b9a('0x39')]['sort']);_0x2c88ee[_0x0b9a('0x3e')]=qs[_0x0b9a('0x3a')](_[_0x0b9a('0x3f')](_0x3d0d88[_0x0b9a('0x39')],_0x2ac188[_0x0b9a('0x3a')]));if(_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x2c88ee['where']=_[_0x0b9a('0x41')](_0x2c88ee[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0x2c88ee['attributes'],function(_0x272532){var _0x73abf2={};_0x73abf2[_0x272532]={'$like':'%'+_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x40')]+'%'};return _0x73abf2;})});}_0x2c88ee=_[_0x0b9a('0x41')]({},_0x2c88ee,_0x3d0d88[_0x0b9a('0x42')]);return _0x3540b0[_0x0b9a('0x8c')](_0x2c88ee);}})[_0x0b9a('0x2c')](function(_0x308627){if(_0x308627){_0x2c85ca=_0x308627[_0x0b9a('0x4b')];if(!_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x5a')](_0x0b9a('0x3c'))){_0x2c88ee[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x2c88ee['offset']=qs['offset'](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x26')]);}return _0x3540b0[_0x0b9a('0x8c')](_0x2c88ee);}})[_0x0b9a('0x2c')](function(_0x24a1d6){if(_0x24a1d6){return _0x24a1d6?{'count':_0x2c85ca,'rows':_0x24a1d6}:null;}})[_0x0b9a('0x2c')](respondWithResult(_0x459c8c,null))['catch'](handleError(_0x459c8c,null));}; \ No newline at end of file +var _0x24ad=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','MailQueues','UserProfileResource','error','name','send','map','MailQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','destroy','describe','findOne','MailQueueId','UserMailQueue','User','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','eml-format','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x24ad,0xf2));var _0xd24a=function(_0x4044ab,_0x2c73a0){_0x4044ab=_0x4044ab-0x0;var _0x4f097b=_0x24ad[_0x4044ab];return _0x4f097b;};'use strict';var emlformat=require(_0xd24a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd24a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24a('0x2'));var moment=require(_0xd24a('0x3'));var BPromise=require(_0xd24a('0x4'));var Mustache=require(_0xd24a('0x5'));var util=require(_0xd24a('0x6'));var path=require(_0xd24a('0x7'));var sox=require(_0xd24a('0x8'));var csv=require('to-csv');var ejs=require(_0xd24a('0x9'));var fs=require('fs');var fs_extra=require(_0xd24a('0xa'));var _=require(_0xd24a('0xb'));var squel=require(_0xd24a('0xc'));var crypto=require(_0xd24a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd24a('0xe'));var querystring=require(_0xd24a('0xf'));var Papa=require(_0xd24a('0x10'));var Redis=require(_0xd24a('0x11'));var authService=require(_0xd24a('0x12'));var qs=require(_0xd24a('0x13'));var as=require(_0xd24a('0x14'));var hardwareService=require(_0xd24a('0x15'));var logger=require(_0xd24a('0x16'))(_0xd24a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd24a('0x18'));var db=require(_0xd24a('0x19'))['db'];config[_0xd24a('0x1a')]=_[_0xd24a('0x1b')](config[_0xd24a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd24a('0x1a')]));require('./mailQueue.socket')[_0xd24a('0x1c')](socket);function respondWithStatusCode(_0xed6b65,_0x250dc3){_0x250dc3=_0x250dc3||0xcc;return function(_0x4f651a){if(_0x4f651a){return _0xed6b65[_0xd24a('0x1d')](_0x250dc3);}return _0xed6b65[_0xd24a('0x1e')](_0x250dc3)[_0xd24a('0x1f')]();};}function respondWithResult(_0x2aefb6,_0x7d9f36){_0x7d9f36=_0x7d9f36||0xc8;return function(_0x4b9506){if(_0x4b9506){return _0x2aefb6['status'](_0x7d9f36)[_0xd24a('0x20')](_0x4b9506);}};}function respondWithFilteredResult(_0x8b236a,_0x5ad947){return function(_0x10cec0){if(_0x10cec0){var _0x13d562=typeof _0x5ad947['offset']===_0xd24a('0x21')&&typeof _0x5ad947[_0xd24a('0x22')]===_0xd24a('0x21');var _0x3b117b=_0x10cec0[_0xd24a('0x23')];var _0x2a0005=_0x13d562?0x0:_0x5ad947[_0xd24a('0x24')];var _0x9a4c45=_0x13d562?_0x10cec0[_0xd24a('0x23')]:_0x5ad947['offset']+_0x5ad947['limit'];var _0x336453;if(_0x9a4c45>=_0x3b117b){_0x9a4c45=_0x3b117b;_0x336453=0xc8;}else{_0x336453=0xce;}_0x8b236a[_0xd24a('0x1e')](_0x336453);return _0x8b236a[_0xd24a('0x25')](_0xd24a('0x26'),_0x2a0005+'-'+_0x9a4c45+'/'+_0x3b117b)['json'](_0x10cec0);}return null;};}function patchUpdates(_0x5767d1){return function(_0x13170a){try{jsonpatch[_0xd24a('0x27')](_0x13170a,_0x5767d1,!![]);}catch(_0xc87442){return BPromise['reject'](_0xc87442);}return _0x13170a[_0xd24a('0x28')]();};}function saveUpdates(_0x27c3d3,_0x774edc){return function(_0x3e8e35){if(_0x3e8e35){return _0x3e8e35[_0xd24a('0x29')](_0x27c3d3)[_0xd24a('0x2a')](function(_0x204f9d){return _0x204f9d;});}return null;};}function removeEntity(_0x1dfb72,_0x1e4250){return function(_0x423bce){if(_0x423bce){return _0x423bce['destroy']()['then'](function(){var _0x5d2f26=_0x423bce[_0xd24a('0x2b')]({'plain':!![]});var _0xea932e=_0xd24a('0x2c');return db[_0xd24a('0x2d')]['destroy']({'where':{'type':_0xea932e,'resourceId':_0x5d2f26['id']}})[_0xd24a('0x2a')](function(){return _0x423bce;});})['then'](function(){_0x1dfb72[_0xd24a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efba5,_0x5ba2b0){return function(_0x49a564){if(!_0x49a564){_0x5efba5[_0xd24a('0x1d')](0x194);}return _0x49a564;};}function handleError(_0x55cfcf,_0x1db5c5){_0x1db5c5=_0x1db5c5||0x1f4;return function(_0x3465ff){logger[_0xd24a('0x2e')](_0x3465ff['stack']);if(_0x3465ff[_0xd24a('0x2f')]){delete _0x3465ff[_0xd24a('0x2f')];}_0x55cfcf[_0xd24a('0x1e')](_0x1db5c5)[_0xd24a('0x30')](_0x3465ff);};}exports['index']=function(_0x317811,_0x15582f){var _0x373e45={},_0x345527={},_0xb3afdb={'count':0x0,'rows':[]};var _0x20ade8=_[_0xd24a('0x31')](db[_0xd24a('0x32')][_0xd24a('0x33')],function(_0x2bd265){return{'name':_0x2bd265['fieldName'],'type':_0x2bd265['type']['key']};});_0x345527[_0xd24a('0x34')]=_[_0xd24a('0x31')](_0x20ade8,_0xd24a('0x2f'));_0x345527[_0xd24a('0x35')]=_[_0xd24a('0x36')](_0x317811['query']);_0x345527[_0xd24a('0x37')]=_[_0xd24a('0x38')](_0x345527['model'],_0x345527[_0xd24a('0x35')]);_0x373e45[_0xd24a('0x39')]=_[_0xd24a('0x38')](_0x345527[_0xd24a('0x34')],qs[_0xd24a('0x3a')](_0x317811[_0xd24a('0x35')][_0xd24a('0x3a')]));_0x373e45[_0xd24a('0x39')]=_0x373e45[_0xd24a('0x39')]['length']?_0x373e45[_0xd24a('0x39')]:_0x345527[_0xd24a('0x34')];if(!_0x317811[_0xd24a('0x35')]['hasOwnProperty'](_0xd24a('0x3b'))){_0x373e45['limit']=qs[_0xd24a('0x22')](_0x317811[_0xd24a('0x35')]['limit']);_0x373e45[_0xd24a('0x24')]=qs[_0xd24a('0x24')](_0x317811[_0xd24a('0x35')][_0xd24a('0x24')]);}_0x373e45[_0xd24a('0x3c')]=qs[_0xd24a('0x3d')](_0x317811[_0xd24a('0x35')][_0xd24a('0x3d')]);_0x373e45[_0xd24a('0x3e')]=qs['filters'](_[_0xd24a('0x3f')](_0x317811['query'],_0x345527[_0xd24a('0x37')]),_0x20ade8);if(_0x317811[_0xd24a('0x35')][_0xd24a('0x40')]){_0x373e45[_0xd24a('0x3e')]=_[_0xd24a('0x41')](_0x373e45[_0xd24a('0x3e')],{'$or':_[_0xd24a('0x31')](_0x20ade8,function(_0x5d87c6){if(_0x5d87c6[_0xd24a('0x42')]!==_0xd24a('0x43')){var _0x209f99={};_0x209f99[_0x5d87c6[_0xd24a('0x2f')]]={'$like':'%'+_0x317811[_0xd24a('0x35')][_0xd24a('0x40')]+'%'};return _0x209f99;}})});}_0x373e45=_[_0xd24a('0x41')]({},_0x373e45,_0x317811[_0xd24a('0x44')]);var _0x613547={'where':_0x373e45['where']};return db[_0xd24a('0x32')][_0xd24a('0x23')](_0x613547)[_0xd24a('0x2a')](function(_0x2ee1d8){_0xb3afdb[_0xd24a('0x23')]=_0x2ee1d8;if(_0x317811[_0xd24a('0x35')][_0xd24a('0x45')]){_0x373e45['include']=[{'all':!![]}];}return db[_0xd24a('0x32')][_0xd24a('0x46')](_0x373e45);})[_0xd24a('0x2a')](function(_0x12a2e6){_0xb3afdb['rows']=_0x12a2e6;return _0xb3afdb;})[_0xd24a('0x2a')](respondWithFilteredResult(_0x15582f,_0x373e45))[_0xd24a('0x47')](handleError(_0x15582f,null));};exports['show']=function(_0x381dd3,_0x2589b6){var _0x62f2c1={'raw':!![],'where':{'id':_0x381dd3[_0xd24a('0x48')]['id']}},_0x27e38e={};_0x27e38e[_0xd24a('0x34')]=_['keys'](db['MailQueue'][_0xd24a('0x33')]);_0x27e38e[_0xd24a('0x35')]=_[_0xd24a('0x36')](_0x381dd3[_0xd24a('0x35')]);_0x27e38e[_0xd24a('0x37')]=_[_0xd24a('0x38')](_0x27e38e[_0xd24a('0x34')],_0x27e38e[_0xd24a('0x35')]);_0x62f2c1[_0xd24a('0x39')]=_['intersection'](_0x27e38e[_0xd24a('0x34')],qs['fields'](_0x381dd3['query']['fields']));_0x62f2c1['attributes']=_0x62f2c1[_0xd24a('0x39')][_0xd24a('0x49')]?_0x62f2c1[_0xd24a('0x39')]:_0x27e38e[_0xd24a('0x34')];if(_0x381dd3[_0xd24a('0x35')][_0xd24a('0x45')]){_0x62f2c1['include']=[{'all':!![]}];}_0x62f2c1=_[_0xd24a('0x41')]({},_0x62f2c1,_0x381dd3[_0xd24a('0x44')]);return db['MailQueue'][_0xd24a('0x4a')](_0x62f2c1)[_0xd24a('0x2a')](handleEntityNotFound(_0x2589b6,null))[_0xd24a('0x2a')](respondWithResult(_0x2589b6,null))[_0xd24a('0x47')](handleError(_0x2589b6,null));};exports[_0xd24a('0x4b')]=function(_0x5b101a,_0x7c8682){return db['MailQueue'][_0xd24a('0x4b')](_0x5b101a[_0xd24a('0x4c')],{})[_0xd24a('0x2a')](function(_0x39a9ca){var _0x2848fb=_0x5b101a['user'][_0xd24a('0x2b')]({'plain':!![]});if(!_0x2848fb)throw new Error(_0xd24a('0x4d'));if(_0x2848fb[_0xd24a('0x4e')]===_0xd24a('0x4f')){var _0x54ab0b=_0x39a9ca[_0xd24a('0x2b')]({'plain':!![]});var _0x454155=_0xd24a('0x2c');return db[_0xd24a('0x50')]['find']({'where':{'name':_0x454155,'userProfileId':_0x2848fb[_0xd24a('0x51')]},'raw':!![]})[_0xd24a('0x2a')](function(_0x5b48d9){if(_0x5b48d9&&_0x5b48d9['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x54ab0b[_0xd24a('0x2f')],'resourceId':_0x54ab0b['id'],'type':_0x5b48d9[_0xd24a('0x2f')],'sectionId':_0x5b48d9['id']},{})[_0xd24a('0x2a')](function(){return _0x39a9ca;});}else{return _0x39a9ca;}})[_0xd24a('0x47')](function(_0x3c47d9){logger[_0xd24a('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c47d9);throw _0x3c47d9;});}return _0x39a9ca;})[_0xd24a('0x2a')](respondWithResult(_0x7c8682,0xc9))[_0xd24a('0x47')](handleError(_0x7c8682,null));};exports[_0xd24a('0x29')]=function(_0x3fb0c1,_0x355216){if(_0x3fb0c1[_0xd24a('0x4c')]['id']){delete _0x3fb0c1[_0xd24a('0x4c')]['id'];}return db['MailQueue'][_0xd24a('0x4a')]({'where':{'id':_0x3fb0c1[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0x355216,null))[_0xd24a('0x2a')](saveUpdates(_0x3fb0c1['body'],null))[_0xd24a('0x2a')](respondWithResult(_0x355216,null))[_0xd24a('0x47')](handleError(_0x355216,null));};exports[_0xd24a('0x52')]=function(_0x4c9665,_0x46f542){return db[_0xd24a('0x32')][_0xd24a('0x4a')]({'where':{'id':_0x4c9665[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0x46f542,null))[_0xd24a('0x2a')](removeEntity(_0x46f542,null))['catch'](handleError(_0x46f542,null));};exports[_0xd24a('0x53')]=function(_0x5030d8,_0x27ac24){return db['MailQueue'][_0xd24a('0x53')]()[_0xd24a('0x2a')](respondWithResult(_0x27ac24,null))[_0xd24a('0x47')](handleError(_0x27ac24,null));};exports['getMembers']=function(_0x5e20c8,_0x5e34e2,_0x3d9012){var _0x3202c={'raw':!![],'where':{}},_0x5292cc={},_0x16ebec;return db['MailQueue'][_0xd24a('0x54')]({'where':{'id':_0x5e20c8[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0x5e34e2,null))[_0xd24a('0x2a')](function(_0x409609){if(_0x409609){_0x16ebec=_0x409609[_0xd24a('0x2b')]({'plain':!![]});_0x5292cc[_0xd24a('0x34')]=_[_0xd24a('0x36')](db['UserMailQueue'][_0xd24a('0x33')]);_0x5292cc[_0xd24a('0x35')]=_[_0xd24a('0x36')](_0x5e20c8[_0xd24a('0x35')]);_0x5292cc[_0xd24a('0x37')]=_[_0xd24a('0x38')](_0x5292cc[_0xd24a('0x34')],_0x5292cc[_0xd24a('0x35')]);_0x3202c['attributes']=_[_0xd24a('0x38')](_0x5292cc['model'],qs[_0xd24a('0x3a')](_0x5e20c8[_0xd24a('0x35')][_0xd24a('0x3a')]));_0x3202c[_0xd24a('0x39')]=_0x3202c[_0xd24a('0x39')]['length']?_0x3202c[_0xd24a('0x39')]:_0x5292cc[_0xd24a('0x34')];if(!_0x5e20c8[_0xd24a('0x35')]['hasOwnProperty']('nolimit')){_0x3202c[_0xd24a('0x22')]=qs[_0xd24a('0x22')](_0x5e20c8[_0xd24a('0x35')]['limit']);_0x3202c[_0xd24a('0x24')]=qs[_0xd24a('0x24')](_0x5e20c8[_0xd24a('0x35')][_0xd24a('0x24')]);}_0x3202c['order']=qs[_0xd24a('0x3d')](_0x5e20c8[_0xd24a('0x35')][_0xd24a('0x3d')]);_0x3202c[_0xd24a('0x3e')]=qs[_0xd24a('0x37')](_['pick'](_0x5e20c8['query'],_0x5292cc['filters']));_0x3202c[_0xd24a('0x3e')][_0xd24a('0x55')]=_0x409609['id'];if(_0x5e20c8['query'][_0xd24a('0x40')]){_0x3202c[_0xd24a('0x3e')]=_[_0xd24a('0x41')](_0x3202c[_0xd24a('0x3e')],{'$or':_[_0xd24a('0x31')](_0x3202c['attributes'],function(_0x283d47){var _0x4940ea={};_0x4940ea[_0x283d47]={'$like':'%'+_0x5e20c8['query']['filter']+'%'};return _0x4940ea;})});}_0x3202c=_[_0xd24a('0x41')]({},_0x3202c,_0x5e20c8[_0xd24a('0x44')]);return db[_0xd24a('0x56')][_0xd24a('0x46')](_0x3202c);}})[_0xd24a('0x2a')](function(_0x5d2707){if(_0x5d2707){return db[_0xd24a('0x57')]['findAndCountAll']({'where':{'id':_[_0xd24a('0x31')](_0x5d2707,_0xd24a('0x58')),'role':_0xd24a('0x59')},'attributes':['id','name',_0xd24a('0x5a'),_0xd24a('0x5b'),_0xd24a('0x5c')]});}})[_0xd24a('0x2a')](function(_0x5992c9){if(_0x5992c9){return{'count':_0x5992c9['count'],'rows':_[_0xd24a('0x31')](_0x5992c9[_0xd24a('0x5d')],function(_0x1f98ea){return{'membername':_0x1f98ea[_0xd24a('0x2f')],'UserId':_0x1f98ea['id'],'queue_name':_0x16ebec[_0xd24a('0x2f')],'MailQueueId':_0x16ebec['id'],'interface':util[_0xd24a('0x5e')](_0xd24a('0x5f'),_0xd24a('0x60'),_0x1f98ea[_0xd24a('0x2f')]),'penalty':0x0,'paused':_0x1f98ea[_0xd24a('0x5a')],'createdAt':_0x1f98ea[_0xd24a('0x5c')],'updatedAt':_0x1f98ea['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd24a('0x2a')](respondWithFilteredResult(_0x5e34e2,_0x3202c))[_0xd24a('0x47')](handleError(_0x5e34e2,null));};exports['getTeams']=function(_0x5c060d,_0x498934,_0x46d66a){var _0x383d79={};var _0x3c0a1c={};var _0x5e67c6;var _0x3b6a9a;return db[_0xd24a('0x32')][_0xd24a('0x54')]({'where':{'id':_0x5c060d[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0x498934,null))[_0xd24a('0x2a')](function(_0xe56ab){if(_0xe56ab){_0x5e67c6=_0xe56ab;_0x3c0a1c[_0xd24a('0x34')]=_[_0xd24a('0x36')](db['Team'][_0xd24a('0x33')]);_0x3c0a1c[_0xd24a('0x35')]=_[_0xd24a('0x36')](_0x5c060d[_0xd24a('0x35')]);_0x3c0a1c[_0xd24a('0x37')]=_[_0xd24a('0x38')](_0x3c0a1c[_0xd24a('0x34')],_0x3c0a1c[_0xd24a('0x35')]);_0x383d79[_0xd24a('0x39')]=_[_0xd24a('0x38')](_0x3c0a1c['model'],qs[_0xd24a('0x3a')](_0x5c060d[_0xd24a('0x35')][_0xd24a('0x3a')]));_0x383d79[_0xd24a('0x39')]=_0x383d79[_0xd24a('0x39')][_0xd24a('0x49')]?_0x383d79[_0xd24a('0x39')]:_0x3c0a1c['model'];_0x383d79[_0xd24a('0x3c')]=qs[_0xd24a('0x3d')](_0x5c060d[_0xd24a('0x35')]['sort']);_0x383d79[_0xd24a('0x3e')]=qs[_0xd24a('0x37')](_[_0xd24a('0x3f')](_0x5c060d[_0xd24a('0x35')],_0x3c0a1c['filters']));if(_0x5c060d[_0xd24a('0x35')][_0xd24a('0x40')]){_0x383d79['where']=_[_0xd24a('0x41')](_0x383d79[_0xd24a('0x3e')],{'$or':_[_0xd24a('0x31')](_0x383d79[_0xd24a('0x39')],function(_0x44833c){var _0xfc051f={};_0xfc051f[_0x44833c]={'$like':'%'+_0x5c060d['query'][_0xd24a('0x40')]+'%'};return _0xfc051f;})});}_0x383d79=_[_0xd24a('0x41')]({},_0x383d79,_0x5c060d[_0xd24a('0x44')]);return _0x5e67c6[_0xd24a('0x61')](_0x383d79);}})[_0xd24a('0x2a')](function(_0x4cc9cb){if(_0x4cc9cb){_0x3b6a9a=_0x4cc9cb[_0xd24a('0x49')];if(!_0x5c060d[_0xd24a('0x35')]['hasOwnProperty']('nolimit')){_0x383d79['limit']=qs['limit'](_0x5c060d[_0xd24a('0x35')][_0xd24a('0x22')]);_0x383d79[_0xd24a('0x24')]=qs['offset'](_0x5c060d[_0xd24a('0x35')]['offset']);}return _0x5e67c6[_0xd24a('0x61')](_0x383d79);}})[_0xd24a('0x2a')](function(_0x2604fa){if(_0x2604fa){return _0x2604fa?{'count':_0x3b6a9a,'rows':_0x2604fa}:null;}})[_0xd24a('0x2a')](respondWithResult(_0x498934,null))[_0xd24a('0x47')](handleError(_0x498934,null));};exports[_0xd24a('0x62')]=function(_0x42d603,_0x30828a,_0x429bf9){var _0x2b69dc=_0x42d603['body'][_0xd24a('0x63')];return db[_0xd24a('0x64')]['findAll']({'where':{'id':_0x2b69dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd24a('0x65'),'attributes':['id',_0xd24a('0x2f'),_0xd24a('0x66'),_0xd24a('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x35d309){if(_0x35d309){var _0x63a0b4=_[_0xd24a('0x68')](_0x35d309,function(_0x387895){var _0x13a5da=_0x387895[_0xd24a('0x2b')]({'plain':!![]});return _0x13a5da[_0xd24a('0x65')];});return db[_0xd24a('0x32')]['find']({'where':{'id':_0x42d603['params']['id']}})[_0xd24a('0x2a')](function(_0x2e9344){return db[_0xd24a('0x69')][_0xd24a('0x6a')](function(_0x15aa2a){return _0x2e9344[_0xd24a('0x62')](_0x2b69dc,{'transaction':_0x15aa2a})['then'](function(){return BPromise[_0xd24a('0x6b')](_0x63a0b4,function(_0x2dfae7){return db['UserMailQueue'][_0xd24a('0x6c')]({'where':{'UserId':_0x2dfae7['id'],'MailQueueId':_0x42d603[_0xd24a('0x48')]['id']},'transaction':_0x15aa2a});});})[_0xd24a('0x2a')](function(){_0x63a0b4[_0xd24a('0x6d')](function(_0x79bc99){socket[_0xd24a('0x6e')](_0xd24a('0x6f'),{'UserId':_0x79bc99['id'],'MailQueueId':_0x2e9344['id']});});});});});}})['then'](respondWithStatusCode(_0x30828a,null))[_0xd24a('0x47')](handleError(_0x30828a,null));};exports[_0xd24a('0x70')]=function(_0x110644,_0x156787,_0x4fcc0d){return db[_0xd24a('0x64')][_0xd24a('0x46')]({'where':{'id':_0x110644[_0xd24a('0x35')][_0xd24a('0x63')]},'attributes':['id'],'include':[{'model':db[_0xd24a('0x57')],'as':_0xd24a('0x65'),'attributes':['id'],'raw':!![]}]})[_0xd24a('0x2a')](handleEntityNotFound(_0x156787,null))[_0xd24a('0x2a')](function(_0x4d6578){var _0x37d9d4=_[_0xd24a('0x31')](_0x4d6578,'id');var _0x51fe44=[];var _0x38ae6b=[];var _0x553dd1=squel[_0xd24a('0x71')]();_0x553dd1['field']('tq.TeamId')[_0xd24a('0x72')](_0xd24a('0x73'),'tq')['join'](_0xd24a('0x74'),'ut',_0xd24a('0x75'))[_0xd24a('0x3e')](_0xd24a('0x76'),_0x110644[_0xd24a('0x48')]['id']);for(var _0x5a1559=0x0;_0x5a1559<_0x4d6578[_0xd24a('0x49')];_0x5a1559+=0x1){let _0x38e3b7=_0x4d6578[_0x5a1559];for(var _0x13bd65=0x0;_0x13bd65<_0x38e3b7[_0xd24a('0x65')][_0xd24a('0x49')];_0x13bd65+=0x1){let _0x1b1d72=_0x38e3b7['Agents'][_0x13bd65];var _0x5bc479=_0x553dd1[_0xd24a('0x77')]();_0x5bc479[_0xd24a('0x3e')](_0xd24a('0x78'),_0x1b1d72['id']);_0x38ae6b[_0xd24a('0x79')](db['sequelize'][_0xd24a('0x35')](_0x5bc479['toString'](),{'type':db[_0xd24a('0x69')][_0xd24a('0x7a')][_0xd24a('0x7b')]})[_0xd24a('0x2a')](function(_0x53d17f){if(_0x53d17f[_0xd24a('0x49')]===0x1){return _0x1b1d72['id'];}else{var _0x5fe3b=_[_0xd24a('0x7c')](_[_0xd24a('0x31')](_0x53d17f,_0xd24a('0x7d')),function(_0x493551){return _['includes'](_0x37d9d4,_0x493551);});if(_0x5fe3b){return _0x1b1d72['id'];}}}));}}return BPromise[_0xd24a('0x7e')](_0x38ae6b)['then'](function(_0x2374a9){_0x51fe44=_(_0x51fe44)['union'](_0x2374a9)[_0xd24a('0x7f')]()['value']();return db[_0xd24a('0x32')][_0xd24a('0x4a')]({'where':{'id':_0x110644[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](function(_0x2831f7){return db[_0xd24a('0x69')][_0xd24a('0x6a')](function(_0x1bb87d){return _0x2831f7[_0xd24a('0x70')](_0x110644[_0xd24a('0x35')][_0xd24a('0x63')],{'transaction':_0x1bb87d})[_0xd24a('0x2a')](function(){if(!_[_0xd24a('0x80')](_0x51fe44)){return _0x2831f7[_0xd24a('0x81')](_0x51fe44,{'transaction':_0x1bb87d});}})[_0xd24a('0x2a')](function(){_0x51fe44[_0xd24a('0x6d')](function(_0xe95033){socket[_0xd24a('0x6e')](_0xd24a('0x82'),{'UserId':_0xe95033,'MailQueueId':_0x2831f7['id']});});});});});});})[_0xd24a('0x2a')](respondWithStatusCode(_0x156787,null))[_0xd24a('0x47')](handleError(_0x156787,null));};exports[_0xd24a('0x83')]=function(_0x1dfe0f,_0xa8b755,_0x50beff){return db[_0xd24a('0x32')]['find']({'where':{'id':_0x1dfe0f[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0xa8b755,null))[_0xd24a('0x2a')](function(_0x152de9){if(_0x152de9){return _0x152de9['addAgents'](_0x1dfe0f['body'][_0xd24a('0x63')],_[_0xd24a('0x84')](_0x1dfe0f[_0xd24a('0x4c')],[_0xd24a('0x63'),'id'])||{})[_0xd24a('0x85')](function(_0x4b14fa){for(var _0x5bbce0=0x0;_0x5bbce0<_0x1dfe0f['body'][_0xd24a('0x63')][_0xd24a('0x49')];_0x5bbce0+=0x1){socket[_0xd24a('0x6e')](_0xd24a('0x6f'),{'UserId':Number(_0x1dfe0f['body'][_0xd24a('0x63')][_0x5bbce0]),'MailQueueId':Number(_0x1dfe0f[_0xd24a('0x48')]['id'])});}return _0x4b14fa;});}})[_0xd24a('0x2a')](respondWithResult(_0xa8b755,null))[_0xd24a('0x47')](handleError(_0xa8b755,null));};exports[_0xd24a('0x81')]=function(_0x3674de,_0xbe2d50,_0xf7f07a){return db[_0xd24a('0x32')]['find']({'where':{'id':_0x3674de['params']['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0xbe2d50,null))[_0xd24a('0x2a')](function(_0x30a0ff){if(_0x30a0ff){return _0x30a0ff[_0xd24a('0x81')](_0x3674de[_0xd24a('0x35')][_0xd24a('0x63')])[_0xd24a('0x2a')](function(){if(_[_0xd24a('0x86')](_0x3674de[_0xd24a('0x35')]['ids'])){for(var _0x195286=0x0;_0x195286<_0x3674de[_0xd24a('0x35')][_0xd24a('0x63')][_0xd24a('0x49')];_0x195286+=0x1){socket[_0xd24a('0x6e')](_0xd24a('0x82'),{'UserId':Number(_0x3674de[_0xd24a('0x35')][_0xd24a('0x63')][_0x195286]),'MailQueueId':Number(_0x3674de[_0xd24a('0x48')]['id'])});}}else{socket[_0xd24a('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x3674de['query'][_0xd24a('0x63')]),'MailQueueId':Number(_0x3674de['params']['id'])});}});}})[_0xd24a('0x2a')](respondWithStatusCode(_0xbe2d50,null))[_0xd24a('0x47')](handleError(_0xbe2d50,null));};exports[_0xd24a('0x87')]=function(_0xf4356d,_0x23c47c,_0x3800ab){var _0x5d9329={};var _0x217d13={};var _0x2fbaf4;var _0x5b6eca;return db[_0xd24a('0x32')]['findOne']({'where':{'id':_0xf4356d[_0xd24a('0x48')]['id']}})[_0xd24a('0x2a')](handleEntityNotFound(_0x23c47c,null))[_0xd24a('0x2a')](function(_0x2baf65){if(_0x2baf65){_0x2fbaf4=_0x2baf65;_0x217d13[_0xd24a('0x34')]=_['keys'](db[_0xd24a('0x57')][_0xd24a('0x33')]);_0x217d13[_0xd24a('0x35')]=_[_0xd24a('0x36')](_0xf4356d[_0xd24a('0x35')]);_0x217d13[_0xd24a('0x37')]=_[_0xd24a('0x38')](_0x217d13[_0xd24a('0x34')],_0x217d13[_0xd24a('0x35')]);_0x5d9329[_0xd24a('0x39')]=_['intersection'](_0x217d13[_0xd24a('0x34')],qs[_0xd24a('0x3a')](_0xf4356d[_0xd24a('0x35')][_0xd24a('0x3a')]));_0x5d9329[_0xd24a('0x39')]=_0x5d9329[_0xd24a('0x39')][_0xd24a('0x49')]?_0x5d9329['attributes']:_0x217d13['model'];_0x5d9329[_0xd24a('0x3c')]=qs[_0xd24a('0x3d')](_0xf4356d[_0xd24a('0x35')]['sort']);_0x5d9329['where']=qs['filters'](_[_0xd24a('0x3f')](_0xf4356d[_0xd24a('0x35')],_0x217d13['filters']));if(_0xf4356d[_0xd24a('0x35')][_0xd24a('0x40')]){_0x5d9329[_0xd24a('0x3e')]=_[_0xd24a('0x41')](_0x5d9329['where'],{'$or':_[_0xd24a('0x31')](_0x5d9329[_0xd24a('0x39')],function(_0x13e036){var _0x3a4f37={};_0x3a4f37[_0x13e036]={'$like':'%'+_0xf4356d[_0xd24a('0x35')][_0xd24a('0x40')]+'%'};return _0x3a4f37;})});}_0x5d9329=_[_0xd24a('0x41')]({},_0x5d9329,_0xf4356d[_0xd24a('0x44')]);return _0x2fbaf4['getAgents'](_0x5d9329);}})[_0xd24a('0x2a')](function(_0x4e26d0){if(_0x4e26d0){_0x5b6eca=_0x4e26d0[_0xd24a('0x49')];if(!_0xf4356d['query'][_0xd24a('0x88')](_0xd24a('0x3b'))){_0x5d9329[_0xd24a('0x22')]=qs[_0xd24a('0x22')](_0xf4356d[_0xd24a('0x35')][_0xd24a('0x22')]);_0x5d9329[_0xd24a('0x24')]=qs['offset'](_0xf4356d['query'][_0xd24a('0x24')]);}return _0x2fbaf4[_0xd24a('0x87')](_0x5d9329);}})[_0xd24a('0x2a')](function(_0x825246){if(_0x825246){return _0x825246?{'count':_0x5b6eca,'rows':_0x825246}:null;}})[_0xd24a('0x2a')](respondWithResult(_0x23c47c,null))['catch'](handleError(_0x23c47c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a1e4f0e..a782742 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 _0xe55e=['hook','exports','events','MailQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x9db372,_0x10da7d){var _0x325207=function(_0x40874b){while(--_0x40874b){_0x9db372['push'](_0x9db372['shift']());}};_0x325207(++_0x10da7d);}(_0xe55e,0x152));var _0xee55=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe55e[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xee55('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xee55('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xee55('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xee55('0x3')};function emitEvent(_0x305dac){return function(_0x16d678,_0xb22811,_0x1d4345){MailQueueEvents[_0xee55('0x4')](_0x305dac+':'+_0x16d678['id'],_0x16d678);MailQueueEvents[_0xee55('0x4')](_0x305dac,_0x16d678);_0x1d4345(null);};}for(var e in events){if(events[_0xee55('0x5')](e)){var event=events[e];MailQueue[_0xee55('0x6')](e,emitEvent(event));}}module[_0xee55('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x38a1=['update','remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x4b3d13,_0x1993d5){var _0xf64dd8=function(_0x2304ed){while(--_0x2304ed){_0x4b3d13['push'](_0x4b3d13['shift']());}};_0xf64dd8(++_0x1993d5);}(_0x38a1,0xc2));var _0x138a=function(_0x341884,_0x21949b){_0x341884=_0x341884-0x0;var _0x403902=_0x38a1[_0x341884];return _0x403902;};'use strict';var EventEmitter=require(_0x138a('0x0'));var MailQueue=require(_0x138a('0x1'))['db'][_0x138a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x138a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x138a('0x4'),'afterDestroy':_0x138a('0x5')};function emitEvent(_0x5228bb){return function(_0x4f88fc,_0x501376,_0x1b23a8){MailQueueEvents[_0x138a('0x6')](_0x5228bb+':'+_0x4f88fc['id'],_0x4f88fc);MailQueueEvents[_0x138a('0x6')](_0x5228bb,_0x4f88fc);_0x1b23a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x138a('0x7')](e,emitEvent(event));}}module[_0x138a('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 69fa90f..e15bfc7 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 _0xaf8d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./mailQueue.attributes','exports','MailQueue'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xaf8d,0x12c));var _0xdaf8=function(_0x3b8636,_0x8332ac){_0x3b8636=_0x3b8636-0x0;var _0x133de8=_0xaf8d[_0x3b8636];return _0x133de8;};'use strict';var _=require(_0xdaf8('0x0'));var util=require(_0xdaf8('0x1'));var logger=require(_0xdaf8('0x2'))(_0xdaf8('0x3'));var moment=require('moment');var BPromise=require(_0xdaf8('0x4'));var rp=require(_0xdaf8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf8('0x6'));var config=require('../../config/environment');var attributes=require(_0xdaf8('0x7'));module[_0xdaf8('0x8')]=function(_0x589ce6,_0x263a4f){return _0x589ce6['define'](_0xdaf8('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48f3=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x2cccf3,_0x22fbab){var _0x4198a8=function(_0x159c45){while(--_0x159c45){_0x2cccf3['push'](_0x2cccf3['shift']());}};_0x4198a8(++_0x22fbab);}(_0x48f3,0xfd));var _0x348f=function(_0x1e68f4,_0x424475){_0x1e68f4=_0x1e68f4-0x0;var _0x3c2e5=_0x48f3[_0x1e68f4];return _0x3c2e5;};'use strict';var _=require(_0x348f('0x0'));var util=require('util');var logger=require(_0x348f('0x1'))('api');var moment=require(_0x348f('0x2'));var BPromise=require(_0x348f('0x3'));var rp=require(_0x348f('0x4'));var fs=require('fs');var path=require(_0x348f('0x5'));var rimraf=require(_0x348f('0x6'));var config=require(_0x348f('0x7'));var attributes=require(_0x348f('0x8'));module[_0x348f('0x9')]=function(_0x3c0873,_0x3b3bf4){return _0x3c0873[_0x348f('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2e350ff..5c6fb4e 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 _0x8dae=['options','raw','where','attributes','limit','include','map','model','stringify','find','ShowMailQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8dae,0xa7));var _0xe8da=function(_0x5889d8,_0x166ae2){_0x5889d8=_0x5889d8-0x0;var _0x3e59ef=_0x8dae[_0x5889d8];return _0x3e59ef;};'use strict';var _=require(_0xe8da('0x0'));var util=require('util');var moment=require(_0xe8da('0x1'));var BPromise=require(_0xe8da('0x2'));var rs=require(_0xe8da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8da('0x4'));var logger=require(_0xe8da('0x5'))(_0xe8da('0x6'));var config=require('../../config/environment');var jayson=require(_0xe8da('0x7'));var client=jayson[_0xe8da('0x8')][_0xe8da('0x9')]({'port':0x232a});config[_0xe8da('0xa')]=_[_0xe8da('0xb')](config[_0xe8da('0xa')],{'host':_0xe8da('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8da('0xa')]));require('./mailQueue.socket')[_0xe8da('0xd')](socket);function respondWithRpcPromise(_0x41ae75,_0x456f8e,_0x4c7ad0){return new BPromise(function(_0x59aeed,_0x3fa960){return client[_0xe8da('0xe')](_0x41ae75,_0x4c7ad0)[_0xe8da('0xf')](function(_0x243352){logger[_0xe8da('0x10')]('MailQueue,\x20%s,\x20%s',_0x456f8e,'request\x20sent');logger[_0xe8da('0x11')](_0xe8da('0x12'),_0x456f8e,'request\x20sent',JSON['stringify'](_0x243352));if(_0x243352[_0xe8da('0x13')]){if(_0x243352['error']['code']===0x1f4){logger[_0xe8da('0x13')]('MailQueue,\x20%s,\x20%s',_0x456f8e,_0x243352[_0xe8da('0x13')]['message']);return _0x3fa960(_0x243352['error']['message']);}logger[_0xe8da('0x13')](_0xe8da('0x14'),_0x456f8e,_0x243352['error'][_0xe8da('0x15')]);return _0x59aeed(_0x243352['error'][_0xe8da('0x15')]);}else{logger['info'](_0xe8da('0x14'),_0x456f8e,_0xe8da('0x16'));_0x59aeed(_0x243352[_0xe8da('0x17')]['message']);}})[_0xe8da('0x18')](function(_0x52ff7f){logger['error']('MailQueue,\x20%s,\x20%s',_0x456f8e,_0x52ff7f);_0x3fa960(_0x52ff7f);});});}exports[_0xe8da('0x19')]=function(_0x563d9c){var _0x505015=this;return new Promise(function(_0x518e25,_0x31b214){return db[_0xe8da('0x1a')][_0xe8da('0x1b')]({'raw':_0x563d9c['options']?_0x563d9c[_0xe8da('0x1c')][_0xe8da('0x1d')]===undefined?!![]:![]:!![],'where':_0x563d9c[_0xe8da('0x1c')]?_0x563d9c[_0xe8da('0x1c')][_0xe8da('0x1e')]||null:null,'attributes':_0x563d9c[_0xe8da('0x1c')]?_0x563d9c[_0xe8da('0x1c')][_0xe8da('0x1f')]||null:null,'limit':_0x563d9c[_0xe8da('0x1c')]?_0x563d9c[_0xe8da('0x1c')][_0xe8da('0x20')]||null:null,'include':_0x563d9c[_0xe8da('0x1c')]?_0x563d9c['options'][_0xe8da('0x21')]?_['map'](_0x563d9c[_0xe8da('0x1c')][_0xe8da('0x21')],function(_0x26b290){return{'model':db[_0x26b290['model']],'as':_0x26b290['as'],'attributes':_0x26b290['attributes'],'include':_0x26b290[_0xe8da('0x21')]?_[_0xe8da('0x22')](_0x26b290[_0xe8da('0x21')],function(_0x2eedb0){return{'model':db[_0x2eedb0[_0xe8da('0x23')]],'as':_0x2eedb0['as'],'attributes':_0x2eedb0[_0xe8da('0x1f')],'include':_0x2eedb0[_0xe8da('0x21')]?_[_0xe8da('0x22')](_0x2eedb0[_0xe8da('0x21')],function(_0x485e10){return{'model':db[_0x485e10[_0xe8da('0x23')]],'as':_0x485e10['as'],'attributes':_0x485e10[_0xe8da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe8da('0xf')](function(_0x53fab9){logger[_0xe8da('0x10')](_0xe8da('0x19'),_0x563d9c);logger[_0xe8da('0x11')](_0xe8da('0x19'),_0x563d9c,JSON[_0xe8da('0x24')](_0x53fab9));_0x518e25(_0x53fab9);})[_0xe8da('0x18')](function(_0x364e42){logger[_0xe8da('0x13')]('GetMailQueue',_0x364e42[_0xe8da('0x15')],_0x563d9c);_0x31b214(_0x505015['error'](0x1f4,_0x364e42[_0xe8da('0x15')]));});});};exports['ShowMailQueue']=function(_0x3d2c81){var _0x59dc50=this;return new Promise(function(_0x821c51,_0x2549fc){return db['MailQueue'][_0xe8da('0x25')]({'raw':_0x3d2c81[_0xe8da('0x1c')]?_0x3d2c81[_0xe8da('0x1c')][_0xe8da('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d2c81['options']?_0x3d2c81[_0xe8da('0x1c')][_0xe8da('0x1e')]||null:null,'attributes':_0x3d2c81[_0xe8da('0x1c')]?_0x3d2c81[_0xe8da('0x1c')][_0xe8da('0x1f')]||null:null,'include':_0x3d2c81[_0xe8da('0x1c')]?_0x3d2c81['options'][_0xe8da('0x21')]?_[_0xe8da('0x22')](_0x3d2c81[_0xe8da('0x1c')]['include'],function(_0x3d644d){return{'model':db[_0x3d644d[_0xe8da('0x23')]],'as':_0x3d644d['as'],'attributes':_0x3d644d[_0xe8da('0x1f')],'include':_0x3d644d[_0xe8da('0x21')]?_[_0xe8da('0x22')](_0x3d644d[_0xe8da('0x21')],function(_0x200d24){return{'model':db[_0x200d24[_0xe8da('0x23')]],'as':_0x200d24['as'],'attributes':_0x200d24[_0xe8da('0x1f')],'include':_0x200d24[_0xe8da('0x21')]?_['map'](_0x200d24[_0xe8da('0x21')],function(_0x323791){return{'model':db[_0x323791['model']],'as':_0x323791['as'],'attributes':_0x323791['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x169382){logger[_0xe8da('0x10')](_0xe8da('0x26'),_0x3d2c81);logger[_0xe8da('0x11')]('ShowMailQueue',_0x3d2c81,JSON['stringify'](_0x169382));_0x821c51(_0x169382);})['catch'](function(_0x2b6dbe){logger[_0xe8da('0x13')]('ShowMailQueue',_0x2b6dbe[_0xe8da('0x15')],_0x3d2c81);_0x2549fc(_0x59dc50[_0xe8da('0x13')](0x1f4,_0x2b6dbe[_0xe8da('0x15')]));});});}; \ No newline at end of file +var _0x63a9=['../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetMailQueue','find','lodash','bluebird','randomstring','ioredis'];(function(_0x34b57c,_0x97c5c9){var _0x2ac76b=function(_0x57bd89){while(--_0x57bd89){_0x34b57c['push'](_0x34b57c['shift']());}};_0x2ac76b(++_0x97c5c9);}(_0x63a9,0xff));var _0x963a=function(_0x17924e,_0x514992){_0x17924e=_0x17924e-0x0;var _0x5008ce=_0x63a9[_0x17924e];return _0x5008ce;};'use strict';var _=require(_0x963a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x963a('0x1'));var rs=require(_0x963a('0x2'));var fs=require('fs');var Redis=require(_0x963a('0x3'));var db=require(_0x963a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x963a('0x5'));var config=require(_0x963a('0x6'));var jayson=require(_0x963a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x963a('0x8')]=_[_0x963a('0x9')](config['redis'],{'host':_0x963a('0xa'),'port':0x18eb});var socket=require(_0x963a('0xb'))(new Redis(config['redis']));require(_0x963a('0xc'))[_0x963a('0xd')](socket);function respondWithRpcPromise(_0xc44e88,_0x390de4,_0x2fb4c9){return new BPromise(function(_0x12138a,_0x54ba1b){return client[_0x963a('0xe')](_0xc44e88,_0x2fb4c9)[_0x963a('0xf')](function(_0x3a71fb){logger[_0x963a('0x10')](_0x963a('0x11'),_0x390de4,_0x963a('0x12'));logger[_0x963a('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x390de4,_0x963a('0x12'),JSON[_0x963a('0x14')](_0x3a71fb));if(_0x3a71fb[_0x963a('0x15')]){if(_0x3a71fb[_0x963a('0x15')]['code']===0x1f4){logger[_0x963a('0x15')]('MailQueue,\x20%s,\x20%s',_0x390de4,_0x3a71fb[_0x963a('0x15')][_0x963a('0x16')]);return _0x54ba1b(_0x3a71fb[_0x963a('0x15')][_0x963a('0x16')]);}logger[_0x963a('0x15')](_0x963a('0x11'),_0x390de4,_0x3a71fb[_0x963a('0x15')][_0x963a('0x16')]);return _0x12138a(_0x3a71fb['error'][_0x963a('0x16')]);}else{logger[_0x963a('0x10')](_0x963a('0x11'),_0x390de4,'request\x20sent');_0x12138a(_0x3a71fb[_0x963a('0x17')][_0x963a('0x16')]);}})[_0x963a('0x18')](function(_0x4fd7e1){logger['error'](_0x963a('0x11'),_0x390de4,_0x4fd7e1);_0x54ba1b(_0x4fd7e1);});});}exports['GetMailQueue']=function(_0x2c4704){var _0x5e79e8=this;return new Promise(function(_0x1101f3,_0x3dedd5){return db[_0x963a('0x19')][_0x963a('0x1a')]({'raw':_0x2c4704[_0x963a('0x1b')]?_0x2c4704[_0x963a('0x1b')][_0x963a('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c4704[_0x963a('0x1b')]?_0x2c4704[_0x963a('0x1b')][_0x963a('0x1d')]||null:null,'attributes':_0x2c4704[_0x963a('0x1b')]?_0x2c4704[_0x963a('0x1b')][_0x963a('0x1e')]||null:null,'limit':_0x2c4704['options']?_0x2c4704[_0x963a('0x1b')][_0x963a('0x1f')]||null:null,'include':_0x2c4704[_0x963a('0x1b')]?_0x2c4704[_0x963a('0x1b')][_0x963a('0x20')]?_['map'](_0x2c4704['options']['include'],function(_0x83fca6){return{'model':db[_0x83fca6[_0x963a('0x21')]],'as':_0x83fca6['as'],'attributes':_0x83fca6[_0x963a('0x1e')],'include':_0x83fca6[_0x963a('0x20')]?_['map'](_0x83fca6['include'],function(_0x5bf770){return{'model':db[_0x5bf770[_0x963a('0x21')]],'as':_0x5bf770['as'],'attributes':_0x5bf770['attributes'],'include':_0x5bf770[_0x963a('0x20')]?_[_0x963a('0x22')](_0x5bf770[_0x963a('0x20')],function(_0x4f8a62){return{'model':db[_0x4f8a62[_0x963a('0x21')]],'as':_0x4f8a62['as'],'attributes':_0x4f8a62[_0x963a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x963a('0xf')](function(_0x1b49d0){logger[_0x963a('0x10')](_0x963a('0x23'),_0x2c4704);logger['debug'](_0x963a('0x23'),_0x2c4704,JSON[_0x963a('0x14')](_0x1b49d0));_0x1101f3(_0x1b49d0);})[_0x963a('0x18')](function(_0x551803){logger[_0x963a('0x15')](_0x963a('0x23'),_0x551803['message'],_0x2c4704);_0x3dedd5(_0x5e79e8['error'](0x1f4,_0x551803[_0x963a('0x16')]));});});};exports['ShowMailQueue']=function(_0x5aae99){var _0x15ffbe=this;return new Promise(function(_0x3ace73,_0xa3e9cc){return db[_0x963a('0x19')][_0x963a('0x24')]({'raw':_0x5aae99[_0x963a('0x1b')]?_0x5aae99[_0x963a('0x1b')][_0x963a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5aae99[_0x963a('0x1b')]?_0x5aae99[_0x963a('0x1b')][_0x963a('0x1d')]||null:null,'attributes':_0x5aae99[_0x963a('0x1b')]?_0x5aae99['options'][_0x963a('0x1e')]||null:null,'include':_0x5aae99['options']?_0x5aae99[_0x963a('0x1b')][_0x963a('0x20')]?_[_0x963a('0x22')](_0x5aae99['options'][_0x963a('0x20')],function(_0x3268cb){return{'model':db[_0x3268cb['model']],'as':_0x3268cb['as'],'attributes':_0x3268cb[_0x963a('0x1e')],'include':_0x3268cb[_0x963a('0x20')]?_['map'](_0x3268cb[_0x963a('0x20')],function(_0x1f5853){return{'model':db[_0x1f5853[_0x963a('0x21')]],'as':_0x1f5853['as'],'attributes':_0x1f5853[_0x963a('0x1e')],'include':_0x1f5853['include']?_[_0x963a('0x22')](_0x1f5853[_0x963a('0x20')],function(_0x3a9bc4){return{'model':db[_0x3a9bc4['model']],'as':_0x3a9bc4['as'],'attributes':_0x3a9bc4[_0x963a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x963a('0xf')](function(_0xf5401e){logger[_0x963a('0x10')]('ShowMailQueue',_0x5aae99);logger[_0x963a('0x13')]('ShowMailQueue',_0x5aae99,JSON['stringify'](_0xf5401e));_0x3ace73(_0xf5401e);})[_0x963a('0x18')](function(_0x41a5d3){logger[_0x963a('0x15')]('ShowMailQueue',_0x41a5d3[_0x963a('0x16')],_0x5aae99);_0xa3e9cc(_0x15ffbe[_0x963a('0x15')](0x1f4,_0x41a5d3[_0x963a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6903032..9703a48 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 _0xff98=['length','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x525a40,_0x53234d){var _0x5bfa11=function(_0xd918b2){while(--_0xd918b2){_0x525a40['push'](_0x525a40['shift']());}};_0x5bfa11(++_0x53234d);}(_0xff98,0x1f1));var _0x8ff9=function(_0xaecb56,_0x2ddca9){_0xaecb56=_0xaecb56-0x0;var _0x356f84=_0xff98[_0xaecb56];return _0x356f84;};'use strict';var MailQueueEvents=require(_0x8ff9('0x0'));var events=[_0x8ff9('0x1'),_0x8ff9('0x2'),_0x8ff9('0x3')];function createListener(_0x26c33b,_0x3ba0c2){return function(_0x2a013d){_0x3ba0c2[_0x8ff9('0x4')](_0x26c33b,_0x2a013d);};}function removeListener(_0xfa4874,_0x916577){return function(){MailQueueEvents[_0x8ff9('0x5')](_0xfa4874,_0x916577);};}exports[_0x8ff9('0x6')]=function(_0x5c5496){for(var _0x5cba8a=0x0,_0x48c77c=events[_0x8ff9('0x7')];_0x5cba8a<_0x48c77c;_0x5cba8a++){var _0x44c0bc=events[_0x5cba8a];var _0x5f25f2=createListener('mailQueue:'+_0x44c0bc,_0x5c5496);MailQueueEvents['on'](_0x44c0bc,_0x5f25f2);}}; \ No newline at end of file +var _0x56be=['update','emit','register','./mailQueue.events','save','remove'];(function(_0x33c42e,_0x170930){var _0xfddb2b=function(_0x382a0e){while(--_0x382a0e){_0x33c42e['push'](_0x33c42e['shift']());}};_0xfddb2b(++_0x170930);}(_0x56be,0x1d7));var _0xe56b=function(_0x212ad5,_0x369a33){_0x212ad5=_0x212ad5-0x0;var _0x2b44d3=_0x56be[_0x212ad5];return _0x2b44d3;};'use strict';var MailQueueEvents=require(_0xe56b('0x0'));var events=[_0xe56b('0x1'),_0xe56b('0x2'),_0xe56b('0x3')];function createListener(_0x30b793,_0x3b71a3){return function(_0x3453e3){_0x3b71a3[_0xe56b('0x4')](_0x30b793,_0x3453e3);};}function removeListener(_0xfc288a,_0x3af191){return function(){MailQueueEvents['removeListener'](_0xfc288a,_0x3af191);};}exports[_0xe56b('0x5')]=function(_0x4ed841){for(var _0x10d25f=0x0,_0x22b0e5=events['length'];_0x10d25f<_0x22b0e5;_0x10d25f++){var _0x3a607f=events[_0x10d25f];var _0x43e0df=createListener('mailQueue:'+_0x3a607f,_0x4ed841);MailQueueEvents['on'](_0x3a607f,_0x43e0df);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 94e1537..fad5b27 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 _0xf4a2=['post','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4d423c,_0x439add){var _0xda3400=function(_0x218baa){while(--_0x218baa){_0x4d423c['push'](_0x4d423c['shift']());}};_0xda3400(++_0x439add);}(_0xf4a2,0x194));var _0x2f4a=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0xf4a2[_0xb7cb72];return _0x4b7570;};'use strict';var multer=require(_0x2f4a('0x0'));var util=require(_0x2f4a('0x1'));var path=require(_0x2f4a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f4a('0x3')]();var fs_extra=require(_0x2f4a('0x4'));var auth=require(_0x2f4a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f4a('0x6'));router[_0x2f4a('0x7')]('/',auth[_0x2f4a('0x8')](),controller[_0x2f4a('0x9')]);router[_0x2f4a('0x7')](_0x2f4a('0xa'),auth['isAuthenticated'](),controller[_0x2f4a('0xb')]);router['get'](_0x2f4a('0xc'),auth[_0x2f4a('0x8')](),controller[_0x2f4a('0xd')]);router[_0x2f4a('0xe')]('/',auth[_0x2f4a('0x8')](),controller['create']);router[_0x2f4a('0xf')]('/:id',auth[_0x2f4a('0x8')](),controller[_0x2f4a('0x10')]);router[_0x2f4a('0x11')](_0x2f4a('0xc'),auth['isAuthenticated'](),controller[_0x2f4a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc791=['describe','show','post','create','/:id','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xc791,0xab));var _0x1c79=function(_0x1256f7,_0x3e93fe){_0x1256f7=_0x1256f7-0x0;var _0x450597=_0xc791[_0x1256f7];return _0x450597;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c79('0x0'));var timeout=require('connect-timeout');var express=require(_0x1c79('0x1'));var router=express[_0x1c79('0x2')]();var fs_extra=require(_0x1c79('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1c79('0x4'));var config=require('../../config/environment');var controller=require(_0x1c79('0x5'));router[_0x1c79('0x6')]('/',auth[_0x1c79('0x7')](),controller[_0x1c79('0x8')]);router[_0x1c79('0x6')]('/describe',auth[_0x1c79('0x7')](),controller[_0x1c79('0x9')]);router[_0x1c79('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x1c79('0xa')]);router[_0x1c79('0xb')]('/',auth[_0x1c79('0x7')](),controller[_0x1c79('0xc')]);router['put'](_0x1c79('0xd'),auth[_0x1c79('0x7')](),controller[_0x1c79('0xe')]);router[_0x1c79('0xf')](_0x1c79('0xd'),auth[_0x1c79('0x7')](),controller[_0x1c79('0x10')]);module[_0x1c79('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2f0d7f9..c649201 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 _0x81a3=['sequelize','exports','STRING','DATE','moment'];(function(_0x45339a,_0x15494c){var _0x27d7db=function(_0x129fda){while(--_0x129fda){_0x45339a['push'](_0x45339a['shift']());}};_0x27d7db(++_0x15494c);}(_0x81a3,0x1e4));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x381a('0x0'));var Sequelize=require(_0x381a('0x1'));module[_0x381a('0x2')]={'uniqueid':{'type':Sequelize[_0x381a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x381a('0x3')]},'joinAt':{'type':Sequelize[_0x381a('0x4')]},'leaveAt':{'type':Sequelize[_0x381a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x381a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9fc8=['exports','STRING','DATE'];(function(_0x2dfb57,_0x40eb26){var _0x298c9a=function(_0x25d55b){while(--_0x25d55b){_0x2dfb57['push'](_0x2dfb57['shift']());}};_0x298c9a(++_0x40eb26);}(_0x9fc8,0x14d));var _0x89fc=function(_0x2f96c5,_0x2726b6){_0x2f96c5=_0x2f96c5-0x0;var _0x71bda1=_0x9fc8[_0x2f96c5];return _0x71bda1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x89fc('0x0')]={'uniqueid':{'type':Sequelize[_0x89fc('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x89fc('0x1')]},'joinAt':{'type':Sequelize[_0x89fc('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x89fc('0x2')]},'exitAt':{'type':Sequelize[_0x89fc('0x2')]},'reason':{'type':Sequelize[_0x89fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 706f06b..4eb07da 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x1359a7,_0x190ff8){var _0x4982fe=function(_0x2c86c9){while(--_0x2c86c9){_0x1359a7['push'](_0x1359a7['shift']());}};_0x4982fe(++_0x190ff8);}(_0x81c6,0x1d5));var _0x681c=function(_0x652b90,_0x52865b){_0x652b90=_0x652b90-0x0;var _0x523368=_0x81c6[_0x652b90];return _0x523368;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0x68b3=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xd7dcfe,_0x1da0d0){var _0x1c42eb=function(_0x4db5d4){while(--_0x4db5d4){_0xd7dcfe['push'](_0xd7dcfe['shift']());}};_0x1c42eb(++_0x1da0d0);}(_0x68b3,0x1d8));var _0x368b=function(_0x3e7ddc,_0x345684){_0x3e7ddc=_0x3e7ddc-0x0;var _0x423cd9=_0x68b3[_0x3e7ddc];return _0x423cd9;};'use strict';var emlformat=require(_0x368b('0x0'));var rimraf=require(_0x368b('0x1'));var zipdir=require(_0x368b('0x2'));var jsonpatch=require(_0x368b('0x3'));var rp=require(_0x368b('0x4'));var moment=require('moment');var BPromise=require(_0x368b('0x5'));var Mustache=require(_0x368b('0x6'));var util=require(_0x368b('0x7'));var path=require(_0x368b('0x8'));var sox=require('sox');var csv=require(_0x368b('0x9'));var ejs=require(_0x368b('0xa'));var fs=require('fs');var fs_extra=require(_0x368b('0xb'));var _=require(_0x368b('0xc'));var squel=require(_0x368b('0xd'));var crypto=require(_0x368b('0xe'));var jsforce=require(_0x368b('0xf'));var deskjs=require(_0x368b('0x10'));var toCsv=require(_0x368b('0x9'));var querystring=require(_0x368b('0x11'));var Papa=require(_0x368b('0x12'));var Redis=require('ioredis');var authService=require(_0x368b('0x13'));var qs=require(_0x368b('0x14'));var as=require(_0x368b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x368b('0x16'))(_0x368b('0x17'));var utils=require(_0x368b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x368b('0x19'));var db=require(_0x368b('0x1a'))['db'];function respondWithStatusCode(_0x514dc7,_0x109a90){_0x109a90=_0x109a90||0xcc;return function(_0x250697){if(_0x250697){return _0x514dc7[_0x368b('0x1b')](_0x109a90);}return _0x514dc7[_0x368b('0x1c')](_0x109a90)[_0x368b('0x1d')]();};}function respondWithResult(_0x4fffe5,_0x2b326c){_0x2b326c=_0x2b326c||0xc8;return function(_0x40faa0){if(_0x40faa0){return _0x4fffe5['status'](_0x2b326c)[_0x368b('0x1e')](_0x40faa0);}};}function respondWithFilteredResult(_0x2aabb9,_0x30c245){return function(_0x515350){if(_0x515350){var _0x220cd5=typeof _0x30c245[_0x368b('0x1f')]===_0x368b('0x20')&&typeof _0x30c245['limit']===_0x368b('0x20');var _0x1b9e65=_0x515350[_0x368b('0x21')];var _0x540f57=_0x220cd5?0x0:_0x30c245['offset'];var _0x3e2e9f=_0x220cd5?_0x515350[_0x368b('0x21')]:_0x30c245[_0x368b('0x1f')]+_0x30c245[_0x368b('0x22')];var _0x1a4f20;if(_0x3e2e9f>=_0x1b9e65){_0x3e2e9f=_0x1b9e65;_0x1a4f20=0xc8;}else{_0x1a4f20=0xce;}_0x2aabb9['status'](_0x1a4f20);return _0x2aabb9[_0x368b('0x23')](_0x368b('0x24'),_0x540f57+'-'+_0x3e2e9f+'/'+_0x1b9e65)[_0x368b('0x1e')](_0x515350);}return null;};}function patchUpdates(_0x1c927f){return function(_0x23da8f){try{jsonpatch[_0x368b('0x25')](_0x23da8f,_0x1c927f,!![]);}catch(_0x397185){return BPromise[_0x368b('0x26')](_0x397185);}return _0x23da8f['save']();};}function saveUpdates(_0x13e750,_0x2f08d9){return function(_0x18869a){if(_0x18869a){return _0x18869a[_0x368b('0x27')](_0x13e750)[_0x368b('0x28')](function(_0x4c2fca){return _0x4c2fca;});}return null;};}function removeEntity(_0x286641,_0x1ca429){return function(_0x3a22bd){if(_0x3a22bd){return _0x3a22bd[_0x368b('0x29')]()[_0x368b('0x28')](function(){_0x286641[_0x368b('0x1c')](0xcc)[_0x368b('0x1d')]();});}};}function handleEntityNotFound(_0x11ea2d,_0x3123c1){return function(_0x3f7f89){if(!_0x3f7f89){_0x11ea2d[_0x368b('0x1b')](0x194);}return _0x3f7f89;};}function handleError(_0x344d8a,_0xceec4b){_0xceec4b=_0xceec4b||0x1f4;return function(_0x376e61){logger[_0x368b('0x2a')](_0x376e61[_0x368b('0x2b')]);if(_0x376e61[_0x368b('0x2c')]){delete _0x376e61[_0x368b('0x2c')];}_0x344d8a[_0x368b('0x1c')](_0xceec4b)[_0x368b('0x2d')](_0x376e61);};}exports[_0x368b('0x2e')]=function(_0xc12627,_0x107d2f){var _0x3c80b5={},_0x5db0b4={},_0x4af77a={'count':0x0,'rows':[]};var _0x381324=_[_0x368b('0x2f')](db[_0x368b('0x30')][_0x368b('0x31')],function(_0x5d6ebf){return{'name':_0x5d6ebf[_0x368b('0x32')],'type':_0x5d6ebf[_0x368b('0x33')][_0x368b('0x34')]};});_0x5db0b4[_0x368b('0x35')]=_[_0x368b('0x2f')](_0x381324,'name');_0x5db0b4[_0x368b('0x36')]=_[_0x368b('0x37')](_0xc12627[_0x368b('0x36')]);_0x5db0b4[_0x368b('0x38')]=_['intersection'](_0x5db0b4['model'],_0x5db0b4['query']);_0x3c80b5[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x5db0b4[_0x368b('0x35')],qs[_0x368b('0x3b')](_0xc12627[_0x368b('0x36')]['fields']));_0x3c80b5[_0x368b('0x39')]=_0x3c80b5[_0x368b('0x39')]['length']?_0x3c80b5[_0x368b('0x39')]:_0x5db0b4[_0x368b('0x35')];if(!_0xc12627['query'][_0x368b('0x3c')](_0x368b('0x3d'))){_0x3c80b5['limit']=qs[_0x368b('0x22')](_0xc12627['query']['limit']);_0x3c80b5['offset']=qs[_0x368b('0x1f')](_0xc12627[_0x368b('0x36')][_0x368b('0x1f')]);}_0x3c80b5[_0x368b('0x3e')]=qs[_0x368b('0x3f')](_0xc12627[_0x368b('0x36')][_0x368b('0x3f')]);_0x3c80b5[_0x368b('0x40')]=qs[_0x368b('0x38')](_[_0x368b('0x41')](_0xc12627['query'],_0x5db0b4[_0x368b('0x38')]),_0x381324);if(_0xc12627[_0x368b('0x36')]['filter']){_0x3c80b5[_0x368b('0x40')]=_[_0x368b('0x42')](_0x3c80b5[_0x368b('0x40')],{'$or':_[_0x368b('0x2f')](_0x381324,function(_0x248b2b){if(_0x248b2b['type']!==_0x368b('0x43')){var _0x4287c6={};_0x4287c6[_0x248b2b[_0x368b('0x2c')]]={'$like':'%'+_0xc12627[_0x368b('0x36')]['filter']+'%'};return _0x4287c6;}})});}_0x3c80b5=_['merge']({},_0x3c80b5,_0xc12627[_0x368b('0x44')]);var _0x3d00f9={'where':_0x3c80b5[_0x368b('0x40')]};return db[_0x368b('0x30')][_0x368b('0x21')](_0x3d00f9)[_0x368b('0x28')](function(_0x1d990c){_0x4af77a[_0x368b('0x21')]=_0x1d990c;if(_0xc12627[_0x368b('0x36')][_0x368b('0x45')]){_0x3c80b5['include']=[{'all':!![]}];}return db[_0x368b('0x30')][_0x368b('0x46')](_0x3c80b5);})['then'](function(_0x25e713){_0x4af77a[_0x368b('0x47')]=_0x25e713;return _0x4af77a;})[_0x368b('0x28')](respondWithFilteredResult(_0x107d2f,_0x3c80b5))[_0x368b('0x48')](handleError(_0x107d2f,null));};exports['show']=function(_0x490eb6,_0x151711){var _0x4a0275={'raw':!![],'where':{'id':_0x490eb6[_0x368b('0x49')]['id']}},_0x91bb0b={};_0x91bb0b[_0x368b('0x35')]=_['keys'](db[_0x368b('0x30')][_0x368b('0x31')]);_0x91bb0b[_0x368b('0x36')]=_['keys'](_0x490eb6['query']);_0x91bb0b[_0x368b('0x38')]=_[_0x368b('0x3a')](_0x91bb0b['model'],_0x91bb0b[_0x368b('0x36')]);_0x4a0275[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x91bb0b[_0x368b('0x35')],qs[_0x368b('0x3b')](_0x490eb6[_0x368b('0x36')][_0x368b('0x3b')]));_0x4a0275[_0x368b('0x39')]=_0x4a0275[_0x368b('0x39')][_0x368b('0x4a')]?_0x4a0275[_0x368b('0x39')]:_0x91bb0b[_0x368b('0x35')];if(_0x490eb6[_0x368b('0x36')]['includeAll']){_0x4a0275[_0x368b('0x4b')]=[{'all':!![]}];}_0x4a0275=_[_0x368b('0x42')]({},_0x4a0275,_0x490eb6[_0x368b('0x44')]);return db[_0x368b('0x30')][_0x368b('0x4c')](_0x4a0275)['then'](handleEntityNotFound(_0x151711,null))['then'](respondWithResult(_0x151711,null))[_0x368b('0x48')](handleError(_0x151711,null));};exports[_0x368b('0x4d')]=function(_0x1c8755,_0x5a9d70){return db[_0x368b('0x30')][_0x368b('0x4d')](_0x1c8755[_0x368b('0x4e')],{})[_0x368b('0x28')](respondWithResult(_0x5a9d70,0xc9))[_0x368b('0x48')](handleError(_0x5a9d70,null));};exports[_0x368b('0x27')]=function(_0x8f35b,_0x1174fa){if(_0x8f35b[_0x368b('0x4e')]['id']){delete _0x8f35b[_0x368b('0x4e')]['id'];}return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x8f35b['params']['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x1174fa,null))['then'](saveUpdates(_0x8f35b[_0x368b('0x4e')],null))['then'](respondWithResult(_0x1174fa,null))[_0x368b('0x48')](handleError(_0x1174fa,null));};exports[_0x368b('0x29')]=function(_0x3b8a12,_0x458d9a){return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x3b8a12[_0x368b('0x49')]['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x458d9a,null))[_0x368b('0x28')](removeEntity(_0x458d9a,null))[_0x368b('0x48')](handleError(_0x458d9a,null));};exports[_0x368b('0x4f')]=function(_0x3898a8,_0x15078b){return db[_0x368b('0x30')]['describe']()[_0x368b('0x28')](respondWithResult(_0x15078b,null))[_0x368b('0x48')](handleError(_0x15078b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7ff73d9..caa1b4d 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 _0x8666=['bluebird','request-promise','path','rimraf','exports','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xc2bd61,_0x2f23f5){var _0x2307b1=function(_0x363d30){while(--_0x363d30){_0xc2bd61['push'](_0xc2bd61['shift']());}};_0x2307b1(++_0x2f23f5);}(_0x8666,0xeb));var _0x6866=function(_0x4c907e,_0x42b96e){_0x4c907e=_0x4c907e-0x0;var _0x55f581=_0x8666[_0x4c907e];return _0x55f581;};'use strict';var _=require(_0x6866('0x0'));var util=require(_0x6866('0x1'));var logger=require(_0x6866('0x2'))(_0x6866('0x3'));var moment=require(_0x6866('0x4'));var BPromise=require(_0x6866('0x5'));var rp=require(_0x6866('0x6'));var fs=require('fs');var path=require(_0x6866('0x7'));var rimraf=require(_0x6866('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x6866('0x9')]=function(_0x14e632,_0x29f59c){return _0x14e632['define']('MailQueueReport',attributes,{'tableName':_0x6866('0xa'),'paranoid':![],'indexes':[{'name':_0x6866('0xb'),'fields':[_0x6866('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30eb=['request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x276d9d,_0x63b221){var _0x19ba79=function(_0xed2143){while(--_0xed2143){_0x276d9d['push'](_0x276d9d['shift']());}};_0x19ba79(++_0x63b221);}(_0x30eb,0x7f));var _0xb30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb30e('0x0'));var util=require(_0xb30e('0x1'));var logger=require(_0xb30e('0x2'))(_0xb30e('0x3'));var moment=require('moment');var BPromise=require(_0xb30e('0x4'));var rp=require(_0xb30e('0x5'));var fs=require('fs');var path=require(_0xb30e('0x6'));var rimraf=require(_0xb30e('0x7'));var config=require('../../config/environment');var attributes=require(_0xb30e('0x8'));module[_0xb30e('0x9')]=function(_0x270bc7,_0x49d437){return _0x270bc7[_0xb30e('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb30e('0xb'),'fields':[_0xb30e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ac67028..5eba751 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1802f5,_0x3a4262){var _0x4186ad=function(_0x479f9f){while(--_0x479f9f){_0x1802f5['push'](_0x1802f5['shift']());}};_0x4186ad(++_0x3a4262);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x24bcc4,_0x226525){var _0x2e6411=function(_0x541b84){while(--_0x541b84){_0x24bcc4['push'](_0x24bcc4['shift']());}};_0x2e6411(++_0x226525);}(_0xdb28,0x106));var _0x8db2=function(_0x159903,_0xa945b3){_0x159903=_0x159903-0x0;var _0x11a724=_0xdb28[_0x159903];return _0x11a724;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9e52c6c..e3b445a 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(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x110dbf,_0x16a620){var _0x49e064=function(_0x7bc62e){while(--_0x7bc62e){_0x110dbf['push'](_0x110dbf['shift']());}};_0x49e064(++_0x16a620);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b391501..2634382 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 _0x222a=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0xdc0618,_0x146483){var _0x35bf35=function(_0x5eb072){while(--_0x5eb072){_0xdc0618['push'](_0xdc0618['shift']());}};_0x35bf35(++_0x146483);}(_0x222a,0xb3));var _0xa222=function(_0x477453,_0x22a6ef){_0x477453=_0x477453-0x0;var _0x30b96b=_0x222a[_0x477453];return _0x30b96b;};'use strict';var Sequelize=require(_0xa222('0x0'));module[_0xa222('0x1')]={'description':{'type':Sequelize[_0xa222('0x2')]},'host':{'type':Sequelize[_0xa222('0x2')]},'authentication':{'type':Sequelize[_0xa222('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa222('0x2')]},'port':{'type':Sequelize[_0xa222('0x4')]},'tls':{'type':Sequelize[_0xa222('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa222('0x5')},'connTimeout':{'type':Sequelize[_0xa222('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa222('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa222('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x598f=['INTEGER','sequelize','STRING','BOOLEAN','INBOX'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x598f,0x137));var _0xf598=function(_0x39e9ff,_0x1ced5f){_0x39e9ff=_0x39e9ff-0x0;var _0x5d64bd=_0x598f[_0x39e9ff];return _0x5d64bd;};'use strict';var Sequelize=require(_0xf598('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf598('0x1')]},'authentication':{'type':Sequelize[_0xf598('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf598('0x1')]},'password':{'type':Sequelize[_0xf598('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xf598('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf598('0x1')],'defaultValue':_0xf598('0x3')},'connTimeout':{'type':Sequelize[_0xf598('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xf598('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 94f7d58..8db67db 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 _0x7d11=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','moment','bluebird','path'];(function(_0x555791,_0x2f5aa5){var _0x2d2767=function(_0x40d3a0){while(--_0x40d3a0){_0x555791['push'](_0x555791['shift']());}};_0x2d2767(++_0x2f5aa5);}(_0x7d11,0x1a8));var _0x17d1=function(_0x2b27ed,_0x51a66a){_0x2b27ed=_0x2b27ed-0x0;var _0x879e81=_0x7d11[_0x2b27ed];return _0x879e81;};'use strict';var _=require(_0x17d1('0x0'));var util=require(_0x17d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x17d1('0x2'));var BPromise=require(_0x17d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17d1('0x4'));var rimraf=require(_0x17d1('0x5'));var config=require(_0x17d1('0x6'));var attributes=require(_0x17d1('0x7'));module[_0x17d1('0x8')]=function(_0x1e5c75,_0x35e48c){return _0x1e5c75[_0x17d1('0x9')]('MailServerIn',attributes,{'tableName':_0x17d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['../../config/logger','api','moment','bluebird','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd67b,0x1e3));var _0xbd67=function(_0x46c3ba,_0x4daf17){_0x46c3ba=_0x46c3ba-0x0;var _0x49abab=_0xd67b[_0x46c3ba];return _0x49abab;};'use strict';var _=require(_0xbd67('0x0'));var util=require('util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var moment=require(_0xbd67('0x3'));var BPromise=require(_0xbd67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd67('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd67('0x6'));module[_0xbd67('0x7')]=function(_0x2aed6a,_0xfbbd24){return _0x2aed6a[_0xbd67('0x8')](_0xbd67('0x9'),attributes,{'tableName':_0xbd67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e549ace..ad7c4b4 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 _0xc943=['info','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0xb8e51f,_0x4ae33a){var _0x25a902=function(_0x13b48f){while(--_0x13b48f){_0xb8e51f['push'](_0xb8e51f['shift']());}};_0x25a902(++_0x4ae33a);}(_0xc943,0x157));var _0x3c94=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0xc943[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0x3c94('0x0'));var util=require(_0x3c94('0x1'));var moment=require(_0x3c94('0x2'));var BPromise=require(_0x3c94('0x3'));var rs=require(_0x3c94('0x4'));var fs=require('fs');var Redis=require(_0x3c94('0x5'));var db=require(_0x3c94('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c94('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c94('0x8'));var client=jayson[_0x3c94('0x9')][_0x3c94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b8778,_0x7fb27f,_0x264920){return new BPromise(function(_0x555292,_0x1e711c){return client[_0x3c94('0xb')](_0x3b8778,_0x264920)[_0x3c94('0xc')](function(_0x534d7f){logger['info'](_0x3c94('0xd'),_0x7fb27f,'request\x20sent');logger[_0x3c94('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x7fb27f,_0x3c94('0xf'),JSON[_0x3c94('0x10')](_0x534d7f));if(_0x534d7f[_0x3c94('0x11')]){if(_0x534d7f[_0x3c94('0x11')][_0x3c94('0x12')]===0x1f4){logger['error'](_0x3c94('0xd'),_0x7fb27f,_0x534d7f[_0x3c94('0x11')]['message']);return _0x1e711c(_0x534d7f[_0x3c94('0x11')]['message']);}logger[_0x3c94('0x11')](_0x3c94('0xd'),_0x7fb27f,_0x534d7f[_0x3c94('0x11')][_0x3c94('0x13')]);return _0x555292(_0x534d7f['error'][_0x3c94('0x13')]);}else{logger[_0x3c94('0x14')](_0x3c94('0xd'),_0x7fb27f,_0x3c94('0xf'));_0x555292(_0x534d7f[_0x3c94('0x15')]['message']);}})[_0x3c94('0x16')](function(_0x32712f){logger['error'](_0x3c94('0xd'),_0x7fb27f,_0x32712f);_0x1e711c(_0x32712f);});});}exports[_0x3c94('0x17')]=function(_0x103a4c){var _0x51532e=this;return new Promise(function(_0x3ebc74,_0x3c8fe1){return db[_0x3c94('0x18')][_0x3c94('0x19')]({'raw':_0x103a4c[_0x3c94('0x1a')]?_0x103a4c['options'][_0x3c94('0x1b')]===undefined?!![]:![]:!![],'where':_0x103a4c[_0x3c94('0x1a')]?_0x103a4c[_0x3c94('0x1a')][_0x3c94('0x1c')]||null:null,'attributes':_0x103a4c[_0x3c94('0x1a')]?_0x103a4c[_0x3c94('0x1a')][_0x3c94('0x1d')]||null:null,'limit':_0x103a4c[_0x3c94('0x1a')]?_0x103a4c[_0x3c94('0x1a')]['limit']||null:null,'include':_0x103a4c[_0x3c94('0x1a')]?_0x103a4c[_0x3c94('0x1a')][_0x3c94('0x1e')]?_[_0x3c94('0x1f')](_0x103a4c[_0x3c94('0x1a')]['include'],function(_0x3db404){return{'model':db[_0x3db404[_0x3c94('0x20')]],'as':_0x3db404['as'],'attributes':_0x3db404[_0x3c94('0x1d')],'include':_0x3db404[_0x3c94('0x1e')]?_['map'](_0x3db404[_0x3c94('0x1e')],function(_0x588ce3){return{'model':db[_0x588ce3['model']],'as':_0x588ce3['as'],'attributes':_0x588ce3['attributes'],'include':_0x588ce3['include']?_['map'](_0x588ce3[_0x3c94('0x1e')],function(_0x3b955d){return{'model':db[_0x3b955d[_0x3c94('0x20')]],'as':_0x3b955d['as'],'attributes':_0x3b955d[_0x3c94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3c94('0xc')](function(_0x4553f1){logger['info'](_0x3c94('0x17'),_0x103a4c);logger[_0x3c94('0xe')]('GetMailServerIn',_0x103a4c,JSON['stringify'](_0x4553f1));_0x3ebc74(_0x4553f1);})[_0x3c94('0x16')](function(_0x1aea3b){logger[_0x3c94('0x11')](_0x3c94('0x17'),_0x1aea3b[_0x3c94('0x13')],_0x103a4c);_0x3c8fe1(_0x51532e[_0x3c94('0x11')](0x1f4,_0x1aea3b['message']));});});}; \ No newline at end of file +var _0xb945=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','stringify','lodash','moment','randomstring','../../config/utils'];(function(_0x226756,_0x2ccb88){var _0x3f2776=function(_0x493be6){while(--_0x493be6){_0x226756['push'](_0x226756['shift']());}};_0x3f2776(++_0x2ccb88);}(_0xb945,0x97));var _0x5b94=function(_0x515a4d,_0x537654){_0x515a4d=_0x515a4d-0x0;var _0x32f090=_0xb945[_0x515a4d];return _0x32f090;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var moment=require(_0x5b94('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b94('0x3'));var logger=require(_0x5b94('0x4'))(_0x5b94('0x5'));var config=require(_0x5b94('0x6'));var jayson=require(_0x5b94('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2db8d8,_0x2cfea8,_0x42bd69){return new BPromise(function(_0x186d22,_0x5d2448){return client[_0x5b94('0x8')](_0x2db8d8,_0x42bd69)['then'](function(_0x3e7695){logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,_0x5b94('0xb'));logger[_0x5b94('0xc')](_0x5b94('0xd'),_0x2cfea8,_0x5b94('0xb'),JSON['stringify'](_0x3e7695));if(_0x3e7695[_0x5b94('0xe')]){if(_0x3e7695['error'][_0x5b94('0xf')]===0x1f4){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')][_0x5b94('0x10')]);return _0x5d2448(_0x3e7695['error'][_0x5b94('0x10')]);}logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')]['message']);return _0x186d22(_0x3e7695[_0x5b94('0xe')]['message']);}else{logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,'request\x20sent');_0x186d22(_0x3e7695[_0x5b94('0x11')][_0x5b94('0x10')]);}})[_0x5b94('0x12')](function(_0x537c8e){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x537c8e);_0x5d2448(_0x537c8e);});});}exports['GetMailServerIn']=function(_0x2bb003){var _0x1171ac=this;return new Promise(function(_0x1b5874,_0x5f389e){return db[_0x5b94('0x13')][_0x5b94('0x14')]({'raw':_0x2bb003['options']?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x16')]===undefined?!![]:![]:!![],'where':_0x2bb003[_0x5b94('0x15')]?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x17')]||null:null,'attributes':_0x2bb003['options']?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x18')]||null:null,'limit':_0x2bb003['options']?_0x2bb003['options'][_0x5b94('0x19')]||null:null,'include':_0x2bb003[_0x5b94('0x15')]?_0x2bb003[_0x5b94('0x15')][_0x5b94('0x1a')]?_[_0x5b94('0x1b')](_0x2bb003[_0x5b94('0x15')][_0x5b94('0x1a')],function(_0x31d950){return{'model':db[_0x31d950[_0x5b94('0x1c')]],'as':_0x31d950['as'],'attributes':_0x31d950[_0x5b94('0x18')],'include':_0x31d950[_0x5b94('0x1a')]?_[_0x5b94('0x1b')](_0x31d950[_0x5b94('0x1a')],function(_0x1c8db6){return{'model':db[_0x1c8db6[_0x5b94('0x1c')]],'as':_0x1c8db6['as'],'attributes':_0x1c8db6[_0x5b94('0x18')],'include':_0x1c8db6['include']?_[_0x5b94('0x1b')](_0x1c8db6[_0x5b94('0x1a')],function(_0x344373){return{'model':db[_0x344373[_0x5b94('0x1c')]],'as':_0x344373['as'],'attributes':_0x344373[_0x5b94('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548ab5){logger[_0x5b94('0x9')](_0x5b94('0x1d'),_0x2bb003);logger[_0x5b94('0xc')]('GetMailServerIn',_0x2bb003,JSON[_0x5b94('0x1e')](_0x548ab5));_0x1b5874(_0x548ab5);})[_0x5b94('0x12')](function(_0x594aca){logger['error'](_0x5b94('0x1d'),_0x594aca[_0x5b94('0x10')],_0x2bb003);_0x5f389e(_0x1171ac[_0x5b94('0xe')](0x1f4,_0x594aca[_0x5b94('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f6d8ee1..6d3e6b2 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x57a365,_0x34b5e0){_0x57a365=_0x57a365-0x0;var _0x357ce8=_0x7a54[_0x57a365];return _0x357ce8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x1380a7,_0x4bfff0){_0x1380a7=_0x1380a7-0x0;var _0x4fc32a=_0x7a54[_0x1380a7];return _0x4fc32a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3646db5..c4f9164 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 _0x065e=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x40a94d,_0x19ac1c){var _0x55459f=function(_0x160eb2){while(--_0x160eb2){_0x40a94d['push'](_0x40a94d['shift']());}};_0x55459f(++_0x19ac1c);}(_0x065e,0x1a7));var _0xe065=function(_0x27f635,_0x123137){_0x27f635=_0x27f635-0x0;var _0x237126=_0x065e[_0x27f635];return _0x237126;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe065('0x1')]},'pass':{'type':Sequelize[_0xe065('0x1')]},'port':{'type':Sequelize[_0xe065('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xea28=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x348021,_0x24fc80){var _0x426682=function(_0x573730){while(--_0x573730){_0x348021['push'](_0x348021['shift']());}};_0x426682(++_0x24fc80);}(_0xea28,0x13a));var _0x8ea2=function(_0x327c69,_0x3e25a3){_0x327c69=_0x327c69-0x0;var _0x621e88=_0xea28[_0x327c69];return _0x621e88;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'description':{'type':Sequelize[_0x8ea2('0x2')]},'host':{'type':Sequelize[_0x8ea2('0x2')]},'user':{'type':Sequelize[_0x8ea2('0x2')]},'pass':{'type':Sequelize[_0x8ea2('0x2')]},'port':{'type':Sequelize[_0x8ea2('0x3')]},'secure':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8ea2('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 a418660..e0776d0 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 _0x96e0=['catch','show','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','stack','index','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','options','MailServerOut','includeAll','findAll'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x96e0,0xd0));var _0x096e=function(_0x57e453,_0xffa4ce){_0x57e453=_0x57e453-0x0;var _0x36b44e=_0x96e0[_0x57e453];return _0x36b44e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x096e('0x0'));var zipdir=require(_0x096e('0x1'));var jsonpatch=require(_0x096e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x096e('0x3'));var Mustache=require(_0x096e('0x4'));var util=require(_0x096e('0x5'));var path=require(_0x096e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x096e('0x7'));var _=require('lodash');var squel=require(_0x096e('0x8'));var crypto=require(_0x096e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x096e('0xa'));var toCsv=require(_0x096e('0xb'));var querystring=require('querystring');var Papa=require(_0x096e('0xc'));var Redis=require('ioredis');var authService=require(_0x096e('0xd'));var qs=require(_0x096e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x096e('0xf'));var logger=require(_0x096e('0x10'))('api');var utils=require(_0x096e('0x11'));var config=require(_0x096e('0x12'));var licenseUtil=require(_0x096e('0x13'));var db=require(_0x096e('0x14'))['db'];function respondWithStatusCode(_0x4f698e,_0x2d602e){_0x2d602e=_0x2d602e||0xcc;return function(_0x37adec){if(_0x37adec){return _0x4f698e['sendStatus'](_0x2d602e);}return _0x4f698e[_0x096e('0x15')](_0x2d602e)[_0x096e('0x16')]();};}function respondWithResult(_0x178ade,_0x5d774d){_0x5d774d=_0x5d774d||0xc8;return function(_0x3efd0e){if(_0x3efd0e){return _0x178ade[_0x096e('0x15')](_0x5d774d)[_0x096e('0x17')](_0x3efd0e);}};}function respondWithFilteredResult(_0x10bb72,_0xc4f22b){return function(_0x11b729){if(_0x11b729){var _0x38b491=typeof _0xc4f22b[_0x096e('0x18')]===_0x096e('0x19')&&typeof _0xc4f22b[_0x096e('0x1a')]==='undefined';var _0x3177c8=_0x11b729['count'];var _0x1675de=_0x38b491?0x0:_0xc4f22b['offset'];var _0x4c4daf=_0x38b491?_0x11b729[_0x096e('0x1b')]:_0xc4f22b['offset']+_0xc4f22b[_0x096e('0x1a')];var _0x3a1223;if(_0x4c4daf>=_0x3177c8){_0x4c4daf=_0x3177c8;_0x3a1223=0xc8;}else{_0x3a1223=0xce;}_0x10bb72[_0x096e('0x15')](_0x3a1223);return _0x10bb72[_0x096e('0x1c')]('Content-Range',_0x1675de+'-'+_0x4c4daf+'/'+_0x3177c8)[_0x096e('0x17')](_0x11b729);}return null;};}function patchUpdates(_0xd090c8){return function(_0xc70150){try{jsonpatch[_0x096e('0x1d')](_0xc70150,_0xd090c8,!![]);}catch(_0x102026){return BPromise[_0x096e('0x1e')](_0x102026);}return _0xc70150[_0x096e('0x1f')]();};}function saveUpdates(_0x3e6561,_0x10c327){return function(_0x193e86){if(_0x193e86){return _0x193e86[_0x096e('0x20')](_0x3e6561)[_0x096e('0x21')](function(_0x50bb4c){return _0x50bb4c;});}return null;};}function removeEntity(_0x106575,_0x3cf3d7){return function(_0x3dfaf8){if(_0x3dfaf8){return _0x3dfaf8['destroy']()[_0x096e('0x21')](function(){_0x106575[_0x096e('0x15')](0xcc)[_0x096e('0x16')]();});}};}function handleEntityNotFound(_0x59eff1,_0x281295){return function(_0x17e625){if(!_0x17e625){_0x59eff1[_0x096e('0x22')](0x194);}return _0x17e625;};}function handleError(_0x46bda8,_0x20d81d){_0x20d81d=_0x20d81d||0x1f4;return function(_0x43dc06){logger['error'](_0x43dc06[_0x096e('0x23')]);if(_0x43dc06['name']){delete _0x43dc06['name'];}_0x46bda8[_0x096e('0x15')](_0x20d81d)['send'](_0x43dc06);};}exports[_0x096e('0x24')]=function(_0xd522d,_0x5a487b){var _0x131a9e={},_0x158449={},_0x57892a={'count':0x0,'rows':[]};var _0x2eaf3f=_[_0x096e('0x25')](db['MailServerOut'][_0x096e('0x26')],function(_0xffb311){return{'name':_0xffb311[_0x096e('0x27')],'type':_0xffb311[_0x096e('0x28')]['key']};});_0x158449[_0x096e('0x29')]=_['map'](_0x2eaf3f,_0x096e('0x2a'));_0x158449[_0x096e('0x2b')]=_[_0x096e('0x2c')](_0xd522d[_0x096e('0x2b')]);_0x158449['filters']=_['intersection'](_0x158449[_0x096e('0x29')],_0x158449[_0x096e('0x2b')]);_0x131a9e['attributes']=_[_0x096e('0x2d')](_0x158449['model'],qs[_0x096e('0x2e')](_0xd522d[_0x096e('0x2b')][_0x096e('0x2e')]));_0x131a9e[_0x096e('0x2f')]=_0x131a9e[_0x096e('0x2f')][_0x096e('0x30')]?_0x131a9e[_0x096e('0x2f')]:_0x158449[_0x096e('0x29')];if(!_0xd522d[_0x096e('0x2b')][_0x096e('0x31')]('nolimit')){_0x131a9e[_0x096e('0x1a')]=qs['limit'](_0xd522d[_0x096e('0x2b')][_0x096e('0x1a')]);_0x131a9e[_0x096e('0x18')]=qs[_0x096e('0x18')](_0xd522d[_0x096e('0x2b')][_0x096e('0x18')]);}_0x131a9e[_0x096e('0x32')]=qs[_0x096e('0x33')](_0xd522d['query'][_0x096e('0x33')]);_0x131a9e[_0x096e('0x34')]=qs[_0x096e('0x35')](_['pick'](_0xd522d[_0x096e('0x2b')],_0x158449[_0x096e('0x35')]),_0x2eaf3f);if(_0xd522d[_0x096e('0x2b')]['filter']){_0x131a9e['where']=_[_0x096e('0x36')](_0x131a9e[_0x096e('0x34')],{'$or':_['map'](_0x2eaf3f,function(_0x70d567){if(_0x70d567['type']!==_0x096e('0x37')){var _0x55a5d9={};_0x55a5d9[_0x70d567[_0x096e('0x2a')]]={'$like':'%'+_0xd522d[_0x096e('0x2b')]['filter']+'%'};return _0x55a5d9;}})});}_0x131a9e=_[_0x096e('0x36')]({},_0x131a9e,_0xd522d[_0x096e('0x38')]);var _0x32e26f={'where':_0x131a9e['where']};return db[_0x096e('0x39')][_0x096e('0x1b')](_0x32e26f)[_0x096e('0x21')](function(_0xa4fca4){_0x57892a['count']=_0xa4fca4;if(_0xd522d[_0x096e('0x2b')][_0x096e('0x3a')]){_0x131a9e['include']=[{'all':!![]}];}return db[_0x096e('0x39')][_0x096e('0x3b')](_0x131a9e);})['then'](function(_0x1a306d){_0x57892a['rows']=_0x1a306d;return _0x57892a;})['then'](respondWithFilteredResult(_0x5a487b,_0x131a9e))[_0x096e('0x3c')](handleError(_0x5a487b,null));};exports[_0x096e('0x3d')]=function(_0x1663c7,_0x296390){var _0x734bbf={'raw':!![],'where':{'id':_0x1663c7['params']['id']}},_0x31872e={};_0x31872e[_0x096e('0x29')]=_['keys'](db[_0x096e('0x39')][_0x096e('0x26')]);_0x31872e['query']=_[_0x096e('0x2c')](_0x1663c7[_0x096e('0x2b')]);_0x31872e['filters']=_[_0x096e('0x2d')](_0x31872e[_0x096e('0x29')],_0x31872e[_0x096e('0x2b')]);_0x734bbf[_0x096e('0x2f')]=_[_0x096e('0x2d')](_0x31872e['model'],qs[_0x096e('0x2e')](_0x1663c7[_0x096e('0x2b')][_0x096e('0x2e')]));_0x734bbf[_0x096e('0x2f')]=_0x734bbf['attributes']['length']?_0x734bbf[_0x096e('0x2f')]:_0x31872e[_0x096e('0x29')];if(_0x1663c7[_0x096e('0x2b')][_0x096e('0x3a')]){_0x734bbf['include']=[{'all':!![]}];}_0x734bbf=_[_0x096e('0x36')]({},_0x734bbf,_0x1663c7[_0x096e('0x38')]);return db['MailServerOut']['find'](_0x734bbf)[_0x096e('0x21')](handleEntityNotFound(_0x296390,null))[_0x096e('0x21')](respondWithResult(_0x296390,null))['catch'](handleError(_0x296390,null));};exports[_0x096e('0x3e')]=function(_0x59f941,_0x483942){return db[_0x096e('0x39')][_0x096e('0x3e')](_0x59f941[_0x096e('0x3f')],{})[_0x096e('0x21')](respondWithResult(_0x483942,0xc9))['catch'](handleError(_0x483942,null));};exports[_0x096e('0x20')]=function(_0x5179c8,_0x4e7175){if(_0x5179c8['body']['id']){delete _0x5179c8['body']['id'];}return db[_0x096e('0x39')][_0x096e('0x40')]({'where':{'id':_0x5179c8[_0x096e('0x41')]['id']}})[_0x096e('0x21')](handleEntityNotFound(_0x4e7175,null))[_0x096e('0x21')](saveUpdates(_0x5179c8[_0x096e('0x3f')],null))[_0x096e('0x21')](respondWithResult(_0x4e7175,null))[_0x096e('0x3c')](handleError(_0x4e7175,null));};exports[_0x096e('0x42')]=function(_0x52351d,_0x5ad666){return db[_0x096e('0x39')][_0x096e('0x40')]({'where':{'id':_0x52351d[_0x096e('0x41')]['id']}})[_0x096e('0x21')](handleEntityNotFound(_0x5ad666,null))[_0x096e('0x21')](removeEntity(_0x5ad666,null))[_0x096e('0x3c')](handleError(_0x5ad666,null));}; \ No newline at end of file +var _0x50dd=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x50dd,0x8c));var _0xd50d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50dd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd50d('0x0'));var rimraf=require(_0xd50d('0x1'));var zipdir=require(_0xd50d('0x2'));var jsonpatch=require(_0xd50d('0x3'));var rp=require(_0xd50d('0x4'));var moment=require(_0xd50d('0x5'));var BPromise=require(_0xd50d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd50d('0x7'));var sox=require(_0xd50d('0x8'));var csv=require(_0xd50d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd50d('0xa'));var _=require(_0xd50d('0xb'));var squel=require(_0xd50d('0xc'));var crypto=require(_0xd50d('0xd'));var jsforce=require(_0xd50d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd50d('0xf'));var Papa=require(_0xd50d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd50d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd50d('0x12'));var logger=require(_0xd50d('0x13'))('api');var utils=require(_0xd50d('0x14'));var config=require(_0xd50d('0x15'));var licenseUtil=require(_0xd50d('0x16'));var db=require(_0xd50d('0x17'))['db'];function respondWithStatusCode(_0x51a5a7,_0x1993c8){_0x1993c8=_0x1993c8||0xcc;return function(_0x3cb147){if(_0x3cb147){return _0x51a5a7[_0xd50d('0x18')](_0x1993c8);}return _0x51a5a7['status'](_0x1993c8)[_0xd50d('0x19')]();};}function respondWithResult(_0x5406be,_0x486921){_0x486921=_0x486921||0xc8;return function(_0x4d3b51){if(_0x4d3b51){return _0x5406be[_0xd50d('0x1a')](_0x486921)[_0xd50d('0x1b')](_0x4d3b51);}};}function respondWithFilteredResult(_0x12a2c4,_0x519db6){return function(_0x4274e7){if(_0x4274e7){var _0x32385b=typeof _0x519db6[_0xd50d('0x1c')]===_0xd50d('0x1d')&&typeof _0x519db6['limit']==='undefined';var _0x28cb9b=_0x4274e7[_0xd50d('0x1e')];var _0xfd56b8=_0x32385b?0x0:_0x519db6[_0xd50d('0x1c')];var _0xb78f78=_0x32385b?_0x4274e7['count']:_0x519db6['offset']+_0x519db6['limit'];var _0x45b29c;if(_0xb78f78>=_0x28cb9b){_0xb78f78=_0x28cb9b;_0x45b29c=0xc8;}else{_0x45b29c=0xce;}_0x12a2c4[_0xd50d('0x1a')](_0x45b29c);return _0x12a2c4['set'](_0xd50d('0x1f'),_0xfd56b8+'-'+_0xb78f78+'/'+_0x28cb9b)[_0xd50d('0x1b')](_0x4274e7);}return null;};}function patchUpdates(_0x48434a){return function(_0x5d8743){try{jsonpatch[_0xd50d('0x20')](_0x5d8743,_0x48434a,!![]);}catch(_0x155746){return BPromise[_0xd50d('0x21')](_0x155746);}return _0x5d8743['save']();};}function saveUpdates(_0x3e889e,_0x255eba){return function(_0xc6c380){if(_0xc6c380){return _0xc6c380[_0xd50d('0x22')](_0x3e889e)[_0xd50d('0x23')](function(_0x414b14){return _0x414b14;});}return null;};}function removeEntity(_0x15cf83,_0x48a91d){return function(_0x6a8b06){if(_0x6a8b06){return _0x6a8b06['destroy']()['then'](function(){_0x15cf83[_0xd50d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc8d8,_0x1a76f5){return function(_0x2e00d1){if(!_0x2e00d1){_0x1bc8d8[_0xd50d('0x18')](0x194);}return _0x2e00d1;};}function handleError(_0x20b32b,_0x323198){_0x323198=_0x323198||0x1f4;return function(_0x3dd1d6){logger[_0xd50d('0x24')](_0x3dd1d6[_0xd50d('0x25')]);if(_0x3dd1d6[_0xd50d('0x26')]){delete _0x3dd1d6['name'];}_0x20b32b[_0xd50d('0x1a')](_0x323198)[_0xd50d('0x27')](_0x3dd1d6);};}exports[_0xd50d('0x28')]=function(_0x266f30,_0x349a22){var _0x1e29a2={},_0x1bffec={},_0x5d84bd={'count':0x0,'rows':[]};var _0x29ef61=_[_0xd50d('0x29')](db[_0xd50d('0x2a')][_0xd50d('0x2b')],function(_0xb2151d){return{'name':_0xb2151d[_0xd50d('0x2c')],'type':_0xb2151d['type'][_0xd50d('0x2d')]};});_0x1bffec['model']=_['map'](_0x29ef61,_0xd50d('0x26'));_0x1bffec[_0xd50d('0x2e')]=_[_0xd50d('0x2f')](_0x266f30['query']);_0x1bffec[_0xd50d('0x30')]=_[_0xd50d('0x31')](_0x1bffec[_0xd50d('0x32')],_0x1bffec[_0xd50d('0x2e')]);_0x1e29a2[_0xd50d('0x33')]=_[_0xd50d('0x31')](_0x1bffec[_0xd50d('0x32')],qs['fields'](_0x266f30[_0xd50d('0x2e')][_0xd50d('0x34')]));_0x1e29a2[_0xd50d('0x33')]=_0x1e29a2[_0xd50d('0x33')][_0xd50d('0x35')]?_0x1e29a2['attributes']:_0x1bffec['model'];if(!_0x266f30['query'][_0xd50d('0x36')](_0xd50d('0x37'))){_0x1e29a2['limit']=qs['limit'](_0x266f30[_0xd50d('0x2e')][_0xd50d('0x38')]);_0x1e29a2['offset']=qs[_0xd50d('0x1c')](_0x266f30[_0xd50d('0x2e')][_0xd50d('0x1c')]);}_0x1e29a2['order']=qs[_0xd50d('0x39')](_0x266f30[_0xd50d('0x2e')][_0xd50d('0x39')]);_0x1e29a2[_0xd50d('0x3a')]=qs[_0xd50d('0x30')](_[_0xd50d('0x3b')](_0x266f30[_0xd50d('0x2e')],_0x1bffec['filters']),_0x29ef61);if(_0x266f30[_0xd50d('0x2e')][_0xd50d('0x3c')]){_0x1e29a2[_0xd50d('0x3a')]=_[_0xd50d('0x3d')](_0x1e29a2[_0xd50d('0x3a')],{'$or':_['map'](_0x29ef61,function(_0x4f7c7e){if(_0x4f7c7e[_0xd50d('0x3e')]!==_0xd50d('0x3f')){var _0x28ab1a={};_0x28ab1a[_0x4f7c7e['name']]={'$like':'%'+_0x266f30[_0xd50d('0x2e')]['filter']+'%'};return _0x28ab1a;}})});}_0x1e29a2=_[_0xd50d('0x3d')]({},_0x1e29a2,_0x266f30[_0xd50d('0x40')]);var _0x27923c={'where':_0x1e29a2[_0xd50d('0x3a')]};return db['MailServerOut'][_0xd50d('0x1e')](_0x27923c)['then'](function(_0x739594){_0x5d84bd[_0xd50d('0x1e')]=_0x739594;if(_0x266f30[_0xd50d('0x2e')][_0xd50d('0x41')]){_0x1e29a2[_0xd50d('0x42')]=[{'all':!![]}];}return db[_0xd50d('0x2a')][_0xd50d('0x43')](_0x1e29a2);})[_0xd50d('0x23')](function(_0x4cef88){_0x5d84bd['rows']=_0x4cef88;return _0x5d84bd;})[_0xd50d('0x23')](respondWithFilteredResult(_0x349a22,_0x1e29a2))[_0xd50d('0x44')](handleError(_0x349a22,null));};exports[_0xd50d('0x45')]=function(_0x5647e8,_0x2072a6){var _0x1e0b4a={'raw':!![],'where':{'id':_0x5647e8['params']['id']}},_0x16ee54={};_0x16ee54[_0xd50d('0x32')]=_[_0xd50d('0x2f')](db[_0xd50d('0x2a')][_0xd50d('0x2b')]);_0x16ee54[_0xd50d('0x2e')]=_[_0xd50d('0x2f')](_0x5647e8[_0xd50d('0x2e')]);_0x16ee54[_0xd50d('0x30')]=_['intersection'](_0x16ee54['model'],_0x16ee54[_0xd50d('0x2e')]);_0x1e0b4a[_0xd50d('0x33')]=_[_0xd50d('0x31')](_0x16ee54[_0xd50d('0x32')],qs[_0xd50d('0x34')](_0x5647e8[_0xd50d('0x2e')][_0xd50d('0x34')]));_0x1e0b4a['attributes']=_0x1e0b4a['attributes'][_0xd50d('0x35')]?_0x1e0b4a[_0xd50d('0x33')]:_0x16ee54[_0xd50d('0x32')];if(_0x5647e8[_0xd50d('0x2e')]['includeAll']){_0x1e0b4a[_0xd50d('0x42')]=[{'all':!![]}];}_0x1e0b4a=_[_0xd50d('0x3d')]({},_0x1e0b4a,_0x5647e8[_0xd50d('0x40')]);return db[_0xd50d('0x2a')][_0xd50d('0x46')](_0x1e0b4a)['then'](handleEntityNotFound(_0x2072a6,null))[_0xd50d('0x23')](respondWithResult(_0x2072a6,null))['catch'](handleError(_0x2072a6,null));};exports[_0xd50d('0x47')]=function(_0x147e41,_0x464567){return db[_0xd50d('0x2a')]['create'](_0x147e41[_0xd50d('0x48')],{})['then'](respondWithResult(_0x464567,0xc9))[_0xd50d('0x44')](handleError(_0x464567,null));};exports[_0xd50d('0x22')]=function(_0x5c2da5,_0x1afa33){if(_0x5c2da5['body']['id']){delete _0x5c2da5['body']['id'];}return db['MailServerOut'][_0xd50d('0x46')]({'where':{'id':_0x5c2da5[_0xd50d('0x49')]['id']}})[_0xd50d('0x23')](handleEntityNotFound(_0x1afa33,null))[_0xd50d('0x23')](saveUpdates(_0x5c2da5[_0xd50d('0x48')],null))[_0xd50d('0x23')](respondWithResult(_0x1afa33,null))[_0xd50d('0x44')](handleError(_0x1afa33,null));};exports['destroy']=function(_0x37b669,_0x49ebfa){return db[_0xd50d('0x2a')]['find']({'where':{'id':_0x37b669[_0xd50d('0x49')]['id']}})[_0xd50d('0x23')](handleEntityNotFound(_0x49ebfa,null))[_0xd50d('0x23')](removeEntity(_0x49ebfa,null))['catch'](handleError(_0x49ebfa,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7ccf8e6..909a470 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 _0xf54f=['mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0xeeee36,_0x43b2ad){var _0x2c3e40=function(_0x44797d){while(--_0x44797d){_0xeeee36['push'](_0xeeee36['shift']());}};_0x2c3e40(++_0x43b2ad);}(_0xf54f,0xb7));var _0xff54=function(_0x542142,_0xf07991){_0x542142=_0x542142-0x0;var _0x4ec492=_0xf54f[_0x542142];return _0x4ec492;};'use strict';var _=require(_0xff54('0x0'));var util=require(_0xff54('0x1'));var logger=require(_0xff54('0x2'))('api');var moment=require(_0xff54('0x3'));var BPromise=require(_0xff54('0x4'));var rp=require(_0xff54('0x5'));var fs=require('fs');var path=require(_0xff54('0x6'));var rimraf=require('rimraf');var config=require(_0xff54('0x7'));var attributes=require(_0xff54('0x8'));module[_0xff54('0x9')]=function(_0x1140b0,_0x24873c){return _0x1140b0[_0xff54('0xa')](_0xff54('0xb'),attributes,{'tableName':_0xff54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb52c=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailServerOut.attributes','exports'];(function(_0x3348d8,_0x4e6c6b){var _0xf3aaaa=function(_0x3371af){while(--_0x3371af){_0x3348d8['push'](_0x3348d8['shift']());}};_0xf3aaaa(++_0x4e6c6b);}(_0xb52c,0x7b));var _0xcb52=function(_0x40f7de,_0x96b00b){_0x40f7de=_0x40f7de-0x0;var _0x18731=_0xb52c[_0x40f7de];return _0x18731;};'use strict';var _=require(_0xcb52('0x0'));var util=require(_0xcb52('0x1'));var logger=require(_0xcb52('0x2'))(_0xcb52('0x3'));var moment=require('moment');var BPromise=require(_0xcb52('0x4'));var rp=require(_0xcb52('0x5'));var fs=require('fs');var path=require(_0xcb52('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb52('0x7'));module[_0xcb52('0x8')]=function(_0x1b02ca,_0x33daec){return _0x1b02ca[_0xcb52('0x9')](_0xcb52('0xa'),attributes,{'tableName':_0xcb52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9e425d4..ffdecd7 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(_0x555034,_0x26eeb2){var _0xa14ab8=function(_0xbfcf1a){while(--_0xbfcf1a){_0x555034['push'](_0x555034['shift']());}};_0xa14ab8(++_0x26eeb2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x292604,_0x2e90f2){_0x292604=_0x292604-0x0;var _0x591012=_0x5f2f[_0x292604];return _0x591012;};'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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xadb5,0xad));var _0x5adb=function(_0x4117d3,_0x491ce1){_0x4117d3=_0x4117d3-0x0;var _0xa93565=_0xadb5[_0x4117d3];return _0xa93565;};'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']('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9d71fe4..d003234 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 _0x4253=['/describe','describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x452bac,_0x5ecf7f){var _0x5e0365=function(_0x2ee3f5){while(--_0x2ee3f5){_0x452bac['push'](_0x452bac['shift']());}};_0x5e0365(++_0x5ecf7f);}(_0x4253,0x7a));var _0x3425=function(_0x355842,_0x5010fd){_0x355842=_0x355842-0x0;var _0x4067de=_0x4253[_0x355842];return _0x4067de;};'use strict';var multer=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var path=require(_0x3425('0x2'));var timeout=require(_0x3425('0x3'));var express=require(_0x3425('0x4'));var router=express[_0x3425('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3425('0x6'));var config=require(_0x3425('0x7'));var controller=require('./mailSubstatus.controller');router[_0x3425('0x8')]('/',auth[_0x3425('0x9')](),controller[_0x3425('0xa')]);router[_0x3425('0x8')](_0x3425('0xb'),auth[_0x3425('0x9')](),controller[_0x3425('0xc')]);router[_0x3425('0x8')](_0x3425('0xd'),auth[_0x3425('0x9')](),controller[_0x3425('0xe')]);router[_0x3425('0xf')]('/',auth['isAuthenticated'](),controller[_0x3425('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3425('0x11')]);router[_0x3425('0x12')]('/:id',auth[_0x3425('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0ec2=['show','post','put','update','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x1bb37c,_0x33bb1a){var _0x4d95cf=function(_0x292275){while(--_0x292275){_0x1bb37c['push'](_0x1bb37c['shift']());}};_0x4d95cf(++_0x33bb1a);}(_0x0ec2,0x75));var _0x20ec=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0ec2[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x20ec('0x0'));var util=require(_0x20ec('0x1'));var path=require(_0x20ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x20ec('0x3'));var router=express['Router']();var fs_extra=require(_0x20ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20ec('0x5'));var config=require(_0x20ec('0x6'));var controller=require('./mailSubstatus.controller');router[_0x20ec('0x7')]('/',auth[_0x20ec('0x8')](),controller['index']);router['get']('/describe',auth[_0x20ec('0x8')](),controller[_0x20ec('0x9')]);router[_0x20ec('0x7')](_0x20ec('0xa'),auth[_0x20ec('0x8')](),controller[_0x20ec('0xb')]);router[_0x20ec('0xc')]('/',auth[_0x20ec('0x8')](),controller['create']);router[_0x20ec('0xd')]('/:id',auth[_0x20ec('0x8')](),controller[_0x20ec('0xe')]);router['delete'](_0x20ec('0xa'),auth['isAuthenticated'](),controller[_0x20ec('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3591cb2..402a0eb 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 _0x6657=['STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6657,0x17f));var _0x7665=function(_0x1a5fda,_0xf98f89){_0x1a5fda=_0x1a5fda-0x0;var _0x107d8e=_0x6657[_0x1a5fda];return _0x107d8e;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'unique':_0x7665('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7665('0x1')]}}; \ No newline at end of file +var _0x83d0=['exports','STRING','name','sequelize'];(function(_0x4c007b,_0x16de7e){var _0x79fb29=function(_0x17ab6d){while(--_0x17ab6d){_0x4c007b['push'](_0x4c007b['shift']());}};_0x79fb29(++_0x16de7e);}(_0x83d0,0xb7));var _0x083d=function(_0x3620a3,_0xeff783){_0x3620a3=_0x3620a3-0x0;var _0x4a955e=_0x83d0[_0x3620a3];return _0x4a955e;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize[_0x083d('0x2')],'unique':_0x083d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x083d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1479b44..b93ed60 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 _0x34cc=['sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit'];(function(_0x29744a,_0x142d76){var _0x38ab18=function(_0x212ca7){while(--_0x212ca7){_0x29744a['push'](_0x29744a['shift']());}};_0x38ab18(++_0x142d76);}(_0x34cc,0x198));var _0xc34c=function(_0x3858a1,_0x32161b){_0x3858a1=_0x3858a1-0x0;var _0x4264dc=_0x34cc[_0x3858a1];return _0x4264dc;};'use strict';var emlformat=require(_0xc34c('0x0'));var rimraf=require(_0xc34c('0x1'));var zipdir=require(_0xc34c('0x2'));var jsonpatch=require(_0xc34c('0x3'));var rp=require(_0xc34c('0x4'));var moment=require(_0xc34c('0x5'));var BPromise=require(_0xc34c('0x6'));var Mustache=require(_0xc34c('0x7'));var util=require(_0xc34c('0x8'));var path=require(_0xc34c('0x9'));var sox=require(_0xc34c('0xa'));var csv=require(_0xc34c('0xb'));var ejs=require(_0xc34c('0xc'));var fs=require('fs');var fs_extra=require(_0xc34c('0xd'));var _=require('lodash');var squel=require(_0xc34c('0xe'));var crypto=require('crypto');var jsforce=require(_0xc34c('0xf'));var deskjs=require(_0xc34c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc34c('0x11'));var Redis=require(_0xc34c('0x12'));var authService=require(_0xc34c('0x13'));var qs=require(_0xc34c('0x14'));var as=require(_0xc34c('0x15'));var hardwareService=require(_0xc34c('0x16'));var logger=require(_0xc34c('0x17'))(_0xc34c('0x18'));var utils=require(_0xc34c('0x19'));var config=require(_0xc34c('0x1a'));var licenseUtil=require(_0xc34c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c4c07,_0x2b57b0){_0x2b57b0=_0x2b57b0||0xcc;return function(_0x12d3eb){if(_0x12d3eb){return _0x1c4c07['sendStatus'](_0x2b57b0);}return _0x1c4c07[_0xc34c('0x1c')](_0x2b57b0)[_0xc34c('0x1d')]();};}function respondWithResult(_0x1c3039,_0x3bfc9a){_0x3bfc9a=_0x3bfc9a||0xc8;return function(_0x355941){if(_0x355941){return _0x1c3039[_0xc34c('0x1c')](_0x3bfc9a)[_0xc34c('0x1e')](_0x355941);}};}function respondWithFilteredResult(_0x4df531,_0x32b372){return function(_0x572666){if(_0x572666){var _0x35db54=typeof _0x32b372[_0xc34c('0x1f')]===_0xc34c('0x20')&&typeof _0x32b372[_0xc34c('0x21')]===_0xc34c('0x20');var _0x2ba442=_0x572666[_0xc34c('0x22')];var _0x4dcd77=_0x35db54?0x0:_0x32b372[_0xc34c('0x1f')];var _0x1b444d=_0x35db54?_0x572666[_0xc34c('0x22')]:_0x32b372['offset']+_0x32b372['limit'];var _0x20924b;if(_0x1b444d>=_0x2ba442){_0x1b444d=_0x2ba442;_0x20924b=0xc8;}else{_0x20924b=0xce;}_0x4df531[_0xc34c('0x1c')](_0x20924b);return _0x4df531[_0xc34c('0x23')](_0xc34c('0x24'),_0x4dcd77+'-'+_0x1b444d+'/'+_0x2ba442)[_0xc34c('0x1e')](_0x572666);}return null;};}function patchUpdates(_0x529e97){return function(_0x511c5b){try{jsonpatch['apply'](_0x511c5b,_0x529e97,!![]);}catch(_0x4140df){return BPromise[_0xc34c('0x25')](_0x4140df);}return _0x511c5b[_0xc34c('0x26')]();};}function saveUpdates(_0x402b42,_0x2dc923){return function(_0x125266){if(_0x125266){return _0x125266['update'](_0x402b42)[_0xc34c('0x27')](function(_0x4c158a){return _0x4c158a;});}return null;};}function removeEntity(_0x282ad6,_0x4a4da1){return function(_0x3cfde2){if(_0x3cfde2){return _0x3cfde2[_0xc34c('0x28')]()['then'](function(){_0x282ad6['status'](0xcc)[_0xc34c('0x1d')]();});}};}function handleEntityNotFound(_0xfe9c17,_0x265d35){return function(_0x51b649){if(!_0x51b649){_0xfe9c17[_0xc34c('0x29')](0x194);}return _0x51b649;};}function handleError(_0x145675,_0x25c9dd){_0x25c9dd=_0x25c9dd||0x1f4;return function(_0x2740a5){logger[_0xc34c('0x2a')](_0x2740a5[_0xc34c('0x2b')]);if(_0x2740a5[_0xc34c('0x2c')]){delete _0x2740a5[_0xc34c('0x2c')];}_0x145675[_0xc34c('0x1c')](_0x25c9dd)[_0xc34c('0x2d')](_0x2740a5);};}exports['index']=function(_0x46043d,_0x1223ef){var _0x1f1a10={},_0x5bc2d2={},_0xc405e1={'count':0x0,'rows':[]};var _0x51d908=_[_0xc34c('0x2e')](db[_0xc34c('0x2f')][_0xc34c('0x30')],function(_0x39396c){return{'name':_0x39396c[_0xc34c('0x31')],'type':_0x39396c[_0xc34c('0x32')][_0xc34c('0x33')]};});_0x5bc2d2[_0xc34c('0x34')]=_[_0xc34c('0x2e')](_0x51d908,_0xc34c('0x2c'));_0x5bc2d2['query']=_[_0xc34c('0x35')](_0x46043d[_0xc34c('0x36')]);_0x5bc2d2['filters']=_[_0xc34c('0x37')](_0x5bc2d2[_0xc34c('0x34')],_0x5bc2d2[_0xc34c('0x36')]);_0x1f1a10[_0xc34c('0x38')]=_[_0xc34c('0x37')](_0x5bc2d2[_0xc34c('0x34')],qs[_0xc34c('0x39')](_0x46043d['query'][_0xc34c('0x39')]));_0x1f1a10['attributes']=_0x1f1a10[_0xc34c('0x38')][_0xc34c('0x3a')]?_0x1f1a10[_0xc34c('0x38')]:_0x5bc2d2[_0xc34c('0x34')];if(!_0x46043d[_0xc34c('0x36')]['hasOwnProperty'](_0xc34c('0x3b'))){_0x1f1a10[_0xc34c('0x21')]=qs[_0xc34c('0x21')](_0x46043d['query'][_0xc34c('0x21')]);_0x1f1a10['offset']=qs[_0xc34c('0x1f')](_0x46043d['query'][_0xc34c('0x1f')]);}_0x1f1a10['order']=qs[_0xc34c('0x3c')](_0x46043d[_0xc34c('0x36')][_0xc34c('0x3c')]);_0x1f1a10[_0xc34c('0x3d')]=qs[_0xc34c('0x3e')](_[_0xc34c('0x3f')](_0x46043d[_0xc34c('0x36')],_0x5bc2d2['filters']),_0x51d908);if(_0x46043d[_0xc34c('0x36')][_0xc34c('0x40')]){_0x1f1a10['where']=_[_0xc34c('0x41')](_0x1f1a10[_0xc34c('0x3d')],{'$or':_['map'](_0x51d908,function(_0x1091a8){if(_0x1091a8[_0xc34c('0x32')]!==_0xc34c('0x42')){var _0x5bd368={};_0x5bd368[_0x1091a8[_0xc34c('0x2c')]]={'$like':'%'+_0x46043d[_0xc34c('0x36')][_0xc34c('0x40')]+'%'};return _0x5bd368;}})});}_0x1f1a10=_[_0xc34c('0x41')]({},_0x1f1a10,_0x46043d['options']);var _0x5b62aa={'where':_0x1f1a10['where']};return db[_0xc34c('0x2f')]['count'](_0x5b62aa)[_0xc34c('0x27')](function(_0x2dc3e9){_0xc405e1[_0xc34c('0x22')]=_0x2dc3e9;if(_0x46043d[_0xc34c('0x36')][_0xc34c('0x43')]){_0x1f1a10['include']=[{'all':!![]}];}return db[_0xc34c('0x2f')]['findAll'](_0x1f1a10);})[_0xc34c('0x27')](function(_0x435548){_0xc405e1[_0xc34c('0x44')]=_0x435548;return _0xc405e1;})[_0xc34c('0x27')](respondWithFilteredResult(_0x1223ef,_0x1f1a10))[_0xc34c('0x45')](handleError(_0x1223ef,null));};exports['show']=function(_0x1d823c,_0x546378){var _0x160293={'raw':!![],'where':{'id':_0x1d823c[_0xc34c('0x46')]['id']}},_0x2ca8a2={};_0x2ca8a2[_0xc34c('0x34')]=_['keys'](db[_0xc34c('0x2f')][_0xc34c('0x30')]);_0x2ca8a2[_0xc34c('0x36')]=_['keys'](_0x1d823c[_0xc34c('0x36')]);_0x2ca8a2[_0xc34c('0x3e')]=_[_0xc34c('0x37')](_0x2ca8a2[_0xc34c('0x34')],_0x2ca8a2[_0xc34c('0x36')]);_0x160293['attributes']=_['intersection'](_0x2ca8a2[_0xc34c('0x34')],qs[_0xc34c('0x39')](_0x1d823c[_0xc34c('0x36')]['fields']));_0x160293[_0xc34c('0x38')]=_0x160293[_0xc34c('0x38')]['length']?_0x160293['attributes']:_0x2ca8a2[_0xc34c('0x34')];if(_0x1d823c[_0xc34c('0x36')][_0xc34c('0x43')]){_0x160293[_0xc34c('0x47')]=[{'all':!![]}];}_0x160293=_[_0xc34c('0x41')]({},_0x160293,_0x1d823c[_0xc34c('0x48')]);return db[_0xc34c('0x2f')][_0xc34c('0x49')](_0x160293)[_0xc34c('0x27')](handleEntityNotFound(_0x546378,null))[_0xc34c('0x27')](respondWithResult(_0x546378,null))[_0xc34c('0x45')](handleError(_0x546378,null));};exports[_0xc34c('0x4a')]=function(_0x4974fc,_0x2bcd40){return db[_0xc34c('0x2f')][_0xc34c('0x4a')](_0x4974fc[_0xc34c('0x4b')],{})[_0xc34c('0x27')](respondWithResult(_0x2bcd40,0xc9))[_0xc34c('0x45')](handleError(_0x2bcd40,null));};exports[_0xc34c('0x4c')]=function(_0x33881a,_0x230b5e){if(_0x33881a[_0xc34c('0x4b')]['id']){delete _0x33881a[_0xc34c('0x4b')]['id'];}return db[_0xc34c('0x2f')][_0xc34c('0x49')]({'where':{'id':_0x33881a[_0xc34c('0x46')]['id']}})[_0xc34c('0x27')](handleEntityNotFound(_0x230b5e,null))['then'](saveUpdates(_0x33881a[_0xc34c('0x4b')],null))[_0xc34c('0x27')](respondWithResult(_0x230b5e,null))[_0xc34c('0x45')](handleError(_0x230b5e,null));};exports[_0xc34c('0x28')]=function(_0x2da651,_0x4aaf87){return db['MailSubstatus']['find']({'where':{'id':_0x2da651['params']['id']}})[_0xc34c('0x27')](handleEntityNotFound(_0x4aaf87,null))[_0xc34c('0x27')](removeEntity(_0x4aaf87,null))[_0xc34c('0x45')](handleError(_0x4aaf87,null));};exports[_0xc34c('0x4d')]=function(_0x55d421,_0x33ec36){return db[_0xc34c('0x2f')][_0xc34c('0x4d')]()[_0xc34c('0x27')](respondWithResult(_0x33ec36,null))[_0xc34c('0x45')](handleError(_0x33ec36,null));}; \ No newline at end of file +var _0x6e80=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','map','MailSubstatus','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','keys','fields','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1ff646,_0x3861c0){var _0x188b6f=function(_0x442b3b){while(--_0x442b3b){_0x1ff646['push'](_0x1ff646['shift']());}};_0x188b6f(++_0x3861c0);}(_0x6e80,0xff));var _0x06e8=function(_0x1e1871,_0x597122){_0x1e1871=_0x1e1871-0x0;var _0x1ae24b=_0x6e80[_0x1e1871];return _0x1ae24b;};'use strict';var emlformat=require(_0x06e8('0x0'));var rimraf=require(_0x06e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06e8('0x2'));var rp=require(_0x06e8('0x3'));var moment=require('moment');var BPromise=require(_0x06e8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06e8('0x5'));var sox=require(_0x06e8('0x6'));var csv=require('to-csv');var ejs=require(_0x06e8('0x7'));var fs=require('fs');var fs_extra=require(_0x06e8('0x8'));var _=require(_0x06e8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06e8('0xa'));var toCsv=require(_0x06e8('0xb'));var querystring=require(_0x06e8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06e8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x06e8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06e8('0xf'))(_0x06e8('0x10'));var utils=require('../../config/utils');var config=require(_0x06e8('0x11'));var licenseUtil=require(_0x06e8('0x12'));var db=require(_0x06e8('0x13'))['db'];function respondWithStatusCode(_0xa6e71b,_0x2e4fe0){_0x2e4fe0=_0x2e4fe0||0xcc;return function(_0x48d084){if(_0x48d084){return _0xa6e71b['sendStatus'](_0x2e4fe0);}return _0xa6e71b['status'](_0x2e4fe0)[_0x06e8('0x14')]();};}function respondWithResult(_0x56fcce,_0x98309){_0x98309=_0x98309||0xc8;return function(_0x5c140e){if(_0x5c140e){return _0x56fcce[_0x06e8('0x15')](_0x98309)[_0x06e8('0x16')](_0x5c140e);}};}function respondWithFilteredResult(_0x1f5299,_0x4d4d7d){return function(_0x5a6cf7){if(_0x5a6cf7){var _0x40b8e4=typeof _0x4d4d7d[_0x06e8('0x17')]===_0x06e8('0x18')&&typeof _0x4d4d7d[_0x06e8('0x19')]===_0x06e8('0x18');var _0x2e4136=_0x5a6cf7[_0x06e8('0x1a')];var _0x4b7cf7=_0x40b8e4?0x0:_0x4d4d7d[_0x06e8('0x17')];var _0x44a4e3=_0x40b8e4?_0x5a6cf7[_0x06e8('0x1a')]:_0x4d4d7d[_0x06e8('0x17')]+_0x4d4d7d[_0x06e8('0x19')];var _0x54300f;if(_0x44a4e3>=_0x2e4136){_0x44a4e3=_0x2e4136;_0x54300f=0xc8;}else{_0x54300f=0xce;}_0x1f5299[_0x06e8('0x15')](_0x54300f);return _0x1f5299[_0x06e8('0x1b')]('Content-Range',_0x4b7cf7+'-'+_0x44a4e3+'/'+_0x2e4136)[_0x06e8('0x16')](_0x5a6cf7);}return null;};}function patchUpdates(_0x46c8a9){return function(_0x313125){try{jsonpatch[_0x06e8('0x1c')](_0x313125,_0x46c8a9,!![]);}catch(_0xa55939){return BPromise[_0x06e8('0x1d')](_0xa55939);}return _0x313125['save']();};}function saveUpdates(_0x5b2b04,_0x417d73){return function(_0x325b8e){if(_0x325b8e){return _0x325b8e[_0x06e8('0x1e')](_0x5b2b04)['then'](function(_0xc0e284){return _0xc0e284;});}return null;};}function removeEntity(_0x2aebcf,_0x3275ae){return function(_0x3ce63a){if(_0x3ce63a){return _0x3ce63a[_0x06e8('0x1f')]()[_0x06e8('0x20')](function(){_0x2aebcf[_0x06e8('0x15')](0xcc)[_0x06e8('0x14')]();});}};}function handleEntityNotFound(_0x294273,_0x509517){return function(_0x110561){if(!_0x110561){_0x294273[_0x06e8('0x21')](0x194);}return _0x110561;};}function handleError(_0x52789d,_0x404b00){_0x404b00=_0x404b00||0x1f4;return function(_0x3de111){logger[_0x06e8('0x22')](_0x3de111[_0x06e8('0x23')]);if(_0x3de111[_0x06e8('0x24')]){delete _0x3de111[_0x06e8('0x24')];}_0x52789d[_0x06e8('0x15')](_0x404b00)[_0x06e8('0x25')](_0x3de111);};}exports['index']=function(_0x376eb4,_0x44f745){var _0x56fa0a={},_0x4cfd75={},_0x529191={'count':0x0,'rows':[]};var _0x119baf=_[_0x06e8('0x26')](db[_0x06e8('0x27')][_0x06e8('0x28')],function(_0x4c34bb){return{'name':_0x4c34bb['fieldName'],'type':_0x4c34bb['type'][_0x06e8('0x29')]};});_0x4cfd75[_0x06e8('0x2a')]=_['map'](_0x119baf,_0x06e8('0x24'));_0x4cfd75[_0x06e8('0x2b')]=_['keys'](_0x376eb4[_0x06e8('0x2b')]);_0x4cfd75[_0x06e8('0x2c')]=_[_0x06e8('0x2d')](_0x4cfd75[_0x06e8('0x2a')],_0x4cfd75[_0x06e8('0x2b')]);_0x56fa0a[_0x06e8('0x2e')]=_[_0x06e8('0x2d')](_0x4cfd75[_0x06e8('0x2a')],qs['fields'](_0x376eb4[_0x06e8('0x2b')]['fields']));_0x56fa0a['attributes']=_0x56fa0a['attributes'][_0x06e8('0x2f')]?_0x56fa0a[_0x06e8('0x2e')]:_0x4cfd75[_0x06e8('0x2a')];if(!_0x376eb4[_0x06e8('0x2b')][_0x06e8('0x30')]('nolimit')){_0x56fa0a[_0x06e8('0x19')]=qs['limit'](_0x376eb4['query'][_0x06e8('0x19')]);_0x56fa0a[_0x06e8('0x17')]=qs[_0x06e8('0x17')](_0x376eb4[_0x06e8('0x2b')]['offset']);}_0x56fa0a[_0x06e8('0x31')]=qs[_0x06e8('0x32')](_0x376eb4[_0x06e8('0x2b')]['sort']);_0x56fa0a[_0x06e8('0x33')]=qs['filters'](_['pick'](_0x376eb4[_0x06e8('0x2b')],_0x4cfd75[_0x06e8('0x2c')]),_0x119baf);if(_0x376eb4['query'][_0x06e8('0x34')]){_0x56fa0a[_0x06e8('0x33')]=_[_0x06e8('0x35')](_0x56fa0a[_0x06e8('0x33')],{'$or':_[_0x06e8('0x26')](_0x119baf,function(_0x185c34){if(_0x185c34[_0x06e8('0x36')]!==_0x06e8('0x37')){var _0x44b1ff={};_0x44b1ff[_0x185c34[_0x06e8('0x24')]]={'$like':'%'+_0x376eb4[_0x06e8('0x2b')][_0x06e8('0x34')]+'%'};return _0x44b1ff;}})});}_0x56fa0a=_[_0x06e8('0x35')]({},_0x56fa0a,_0x376eb4[_0x06e8('0x38')]);var _0x1b345a={'where':_0x56fa0a[_0x06e8('0x33')]};return db[_0x06e8('0x27')]['count'](_0x1b345a)['then'](function(_0x5ae017){_0x529191['count']=_0x5ae017;if(_0x376eb4['query'][_0x06e8('0x39')]){_0x56fa0a[_0x06e8('0x3a')]=[{'all':!![]}];}return db[_0x06e8('0x27')]['findAll'](_0x56fa0a);})[_0x06e8('0x20')](function(_0x42eb64){_0x529191[_0x06e8('0x3b')]=_0x42eb64;return _0x529191;})[_0x06e8('0x20')](respondWithFilteredResult(_0x44f745,_0x56fa0a))['catch'](handleError(_0x44f745,null));};exports['show']=function(_0x13ed15,_0x553f8e){var _0x325907={'raw':!![],'where':{'id':_0x13ed15[_0x06e8('0x3c')]['id']}},_0x3db9f1={};_0x3db9f1[_0x06e8('0x2a')]=_['keys'](db['MailSubstatus'][_0x06e8('0x28')]);_0x3db9f1[_0x06e8('0x2b')]=_[_0x06e8('0x3d')](_0x13ed15[_0x06e8('0x2b')]);_0x3db9f1[_0x06e8('0x2c')]=_[_0x06e8('0x2d')](_0x3db9f1[_0x06e8('0x2a')],_0x3db9f1[_0x06e8('0x2b')]);_0x325907[_0x06e8('0x2e')]=_['intersection'](_0x3db9f1[_0x06e8('0x2a')],qs[_0x06e8('0x3e')](_0x13ed15[_0x06e8('0x2b')][_0x06e8('0x3e')]));_0x325907[_0x06e8('0x2e')]=_0x325907[_0x06e8('0x2e')][_0x06e8('0x2f')]?_0x325907[_0x06e8('0x2e')]:_0x3db9f1[_0x06e8('0x2a')];if(_0x13ed15[_0x06e8('0x2b')]['includeAll']){_0x325907['include']=[{'all':!![]}];}_0x325907=_['merge']({},_0x325907,_0x13ed15[_0x06e8('0x38')]);return db['MailSubstatus'][_0x06e8('0x3f')](_0x325907)[_0x06e8('0x20')](handleEntityNotFound(_0x553f8e,null))[_0x06e8('0x20')](respondWithResult(_0x553f8e,null))['catch'](handleError(_0x553f8e,null));};exports['create']=function(_0xf30dda,_0x5bc475){return db[_0x06e8('0x27')][_0x06e8('0x40')](_0xf30dda[_0x06e8('0x41')],{})[_0x06e8('0x20')](respondWithResult(_0x5bc475,0xc9))[_0x06e8('0x42')](handleError(_0x5bc475,null));};exports[_0x06e8('0x1e')]=function(_0x2a8059,_0x42c783){if(_0x2a8059['body']['id']){delete _0x2a8059[_0x06e8('0x41')]['id'];}return db[_0x06e8('0x27')][_0x06e8('0x3f')]({'where':{'id':_0x2a8059[_0x06e8('0x3c')]['id']}})[_0x06e8('0x20')](handleEntityNotFound(_0x42c783,null))[_0x06e8('0x20')](saveUpdates(_0x2a8059[_0x06e8('0x41')],null))['then'](respondWithResult(_0x42c783,null))[_0x06e8('0x42')](handleError(_0x42c783,null));};exports[_0x06e8('0x1f')]=function(_0x25fdd3,_0x59b063){return db[_0x06e8('0x27')][_0x06e8('0x3f')]({'where':{'id':_0x25fdd3[_0x06e8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x59b063,null))['then'](removeEntity(_0x59b063,null))['catch'](handleError(_0x59b063,null));};exports[_0x06e8('0x43')]=function(_0x5c5961,_0xd4fdbe){return db[_0x06e8('0x27')][_0x06e8('0x43')]()[_0x06e8('0x20')](respondWithResult(_0xd4fdbe,null))[_0x06e8('0x42')](handleError(_0xd4fdbe,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e6e625c..27ce591 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 _0x719f=['hook','events','MailSubstatus','update','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x719f,0xd8));var _0xf719=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x719f[_0x454165];return _0x56db53;};'use strict';var EventEmitter=require(_0xf719('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xf719('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xf719('0x2')};function emitEvent(_0x2fdf74){return function(_0x5de8fc,_0x294c2b,_0x510401){MailSubstatusEvents[_0xf719('0x3')](_0x2fdf74+':'+_0x5de8fc['id'],_0x5de8fc);MailSubstatusEvents[_0xf719('0x3')](_0x2fdf74,_0x5de8fc);_0x510401(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xf719('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x939a=['update','emit','hasOwnProperty','hook','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x939a,0x1cb));var _0xa939=function(_0x1c3f09,_0x3e7a55){_0x1c3f09=_0x1c3f09-0x0;var _0x3c1f75=_0x939a[_0x1c3f09];return _0x3c1f75;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xa939('0x0'))['db'][_0xa939('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa939('0x2')](0x0);var events={'afterUpdate':_0xa939('0x3')};function emitEvent(_0x53372f){return function(_0x215e94,_0x8a9ae8,_0x5659dc){MailSubstatusEvents['emit'](_0x53372f+':'+_0x215e94['id'],_0x215e94);MailSubstatusEvents[_0xa939('0x4')](_0x53372f,_0x215e94);_0x5659dc(null);};}for(var e in events){if(events[_0xa939('0x5')](e)){var event=events[e];MailSubstatus[_0xa939('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2162bda..4ee339e 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 _0xd8a0=['mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x4dbe64,_0x3fe2c9){var _0x2e99e2=function(_0x258290){while(--_0x258290){_0x4dbe64['push'](_0x4dbe64['shift']());}};_0x2e99e2(++_0x3fe2c9);}(_0xd8a0,0x74));var _0x0d8a=function(_0x40d08e,_0x161760){_0x40d08e=_0x40d08e-0x0;var _0x319034=_0xd8a0[_0x40d08e];return _0x319034;};'use strict';var attributes=require(_0x0d8a('0x0'));module[_0x0d8a('0x1')]=function(_0x1dbc16){var _0x5630c0=_0x1dbc16['models'];return _0x1dbc16[_0x0d8a('0x2')](_0x0d8a('0x3'),attributes,{'tableName':_0x0d8a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3bb5cd,_0x39b7c2,_0x3a919a){return _0x5630c0[_0x0d8a('0x5')][_0x0d8a('0x6')]({'value':_0x3bb5cd['name']},{'where':{'field':_0x0d8a('0x7'),'value':_0x3bb5cd[_0x0d8a('0x8')][_0x0d8a('0x9')]}})[_0x0d8a('0xa')](function(){_0x3a919a();})[_0x0d8a('0xb')](function(_0x863b2a){_0x3a919a(_0x863b2a);});}}});}; \ No newline at end of file +var _0x0a2e=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0a2e,0xe1));var _0xe0a2=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x0a2e[_0x43a37c];return _0x5d1d40;};'use strict';var attributes=require(_0xe0a2('0x0'));module[_0xe0a2('0x1')]=function(_0x2141f0){var _0x31459f=_0x2141f0['models'];return _0x2141f0[_0xe0a2('0x2')](_0xe0a2('0x3'),attributes,{'tableName':_0xe0a2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2e9ab5,_0x5dd25b,_0x48900e){return _0x31459f[_0xe0a2('0x5')][_0xe0a2('0x6')]({'value':_0x2e9ab5[_0xe0a2('0x7')]},{'where':{'field':_0xe0a2('0x8'),'value':_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0x7')]}})[_0xe0a2('0xa')](function(){_0x48900e();})[_0xe0a2('0xb')](function(_0x1a9e69){_0x48900e(_0x1a9e69);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 6d1211c..28cbc0b 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 _0x1ade=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x1ade,0x14f));var _0xe1ad=function(_0x5acd71,_0xb727e9){_0x5acd71=_0x5acd71-0x0;var _0x482f24=_0x1ade[_0x5acd71];return _0x482f24;};'use strict';var _=require(_0xe1ad('0x0'));var util=require('util');var moment=require(_0xe1ad('0x1'));var BPromise=require(_0xe1ad('0x2'));var rs=require(_0xe1ad('0x3'));var fs=require('fs');var Redis=require(_0xe1ad('0x4'));var db=require(_0xe1ad('0x5'))['db'];var utils=require(_0xe1ad('0x6'));var logger=require('../../config/logger')(_0xe1ad('0x7'));var config=require(_0xe1ad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1ad('0x9')][_0xe1ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c26e,_0xb2bc2b,_0x424003){return new BPromise(function(_0x553e4d,_0x5c4588){return client[_0xe1ad('0xb')](_0x43c26e,_0x424003)[_0xe1ad('0xc')](function(_0x5a4245){logger[_0xe1ad('0xd')](_0xe1ad('0xe'),_0xb2bc2b,_0xe1ad('0xf'));logger[_0xe1ad('0x10')](_0xe1ad('0x11'),_0xb2bc2b,_0xe1ad('0xf'),JSON[_0xe1ad('0x12')](_0x5a4245));if(_0x5a4245[_0xe1ad('0x13')]){if(_0x5a4245[_0xe1ad('0x13')][_0xe1ad('0x14')]===0x1f4){logger[_0xe1ad('0x13')]('MailSubstatus,\x20%s,\x20%s',_0xb2bc2b,_0x5a4245[_0xe1ad('0x13')][_0xe1ad('0x15')]);return _0x5c4588(_0x5a4245['error'][_0xe1ad('0x15')]);}logger[_0xe1ad('0x13')]('MailSubstatus,\x20%s,\x20%s',_0xb2bc2b,_0x5a4245[_0xe1ad('0x13')][_0xe1ad('0x15')]);return _0x553e4d(_0x5a4245[_0xe1ad('0x13')][_0xe1ad('0x15')]);}else{logger['info'](_0xe1ad('0xe'),_0xb2bc2b,_0xe1ad('0xf'));_0x553e4d(_0x5a4245['result'][_0xe1ad('0x15')]);}})[_0xe1ad('0x16')](function(_0x1fdd61){logger[_0xe1ad('0x13')](_0xe1ad('0xe'),_0xb2bc2b,_0x1fdd61);_0x5c4588(_0x1fdd61);});});} \ No newline at end of file +var _0xb515=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x2cfc56,_0x106652){var _0x3f6186=function(_0x580c1a){while(--_0x580c1a){_0x2cfc56['push'](_0x2cfc56['shift']());}};_0x3f6186(++_0x106652);}(_0xb515,0x195));var _0x5b51=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xb515[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0x5b51('0x0'));var util=require(_0x5b51('0x1'));var moment=require(_0x5b51('0x2'));var BPromise=require(_0x5b51('0x3'));var rs=require(_0x5b51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b51('0x5'))['db'];var utils=require(_0x5b51('0x6'));var logger=require('../../config/logger')(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b51('0x9')][_0x5b51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51bac7,_0x4d49c9,_0x34b6f5){return new BPromise(function(_0xcb8b68,_0x1a6094){return client[_0x5b51('0xb')](_0x51bac7,_0x34b6f5)[_0x5b51('0xc')](function(_0x58efc5){logger[_0x5b51('0xd')](_0x5b51('0xe'),_0x4d49c9,_0x5b51('0xf'));logger[_0x5b51('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4d49c9,_0x5b51('0xf'),JSON[_0x5b51('0x11')](_0x58efc5));if(_0x58efc5[_0x5b51('0x12')]){if(_0x58efc5[_0x5b51('0x12')][_0x5b51('0x13')]===0x1f4){logger['error'](_0x5b51('0xe'),_0x4d49c9,_0x58efc5[_0x5b51('0x12')]['message']);return _0x1a6094(_0x58efc5['error']['message']);}logger[_0x5b51('0x12')](_0x5b51('0xe'),_0x4d49c9,_0x58efc5[_0x5b51('0x12')][_0x5b51('0x14')]);return _0xcb8b68(_0x58efc5[_0x5b51('0x12')]['message']);}else{logger['info'](_0x5b51('0xe'),_0x4d49c9,_0x5b51('0xf'));_0xcb8b68(_0x58efc5[_0x5b51('0x15')]['message']);}})['catch'](function(_0x391b61){logger[_0x5b51('0x12')](_0x5b51('0xe'),_0x4d49c9,_0x391b61);_0x1a6094(_0x391b61);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 474e66e..fa5a239 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 _0xe9c4=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','util','express','Router','fs-extra'];(function(_0x218e1c,_0x38d7b0){var _0x1b3dbd=function(_0x469fa2){while(--_0x469fa2){_0x218e1c['push'](_0x218e1c['shift']());}};_0x1b3dbd(++_0x38d7b0);}(_0xe9c4,0x84));var _0x4e9c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe9c4[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x4e9c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e9c('0x1'));var router=express[_0x4e9c('0x2')]();var fs_extra=require(_0x4e9c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4e9c('0x4'));var config=require(_0x4e9c('0x5'));var controller=require(_0x4e9c('0x6'));router['get']('/',auth[_0x4e9c('0x7')](),controller['index']);router['get']('/describe',auth[_0x4e9c('0x7')](),controller[_0x4e9c('0x8')]);router['get']('/:id',auth[_0x4e9c('0x7')](),controller[_0x4e9c('0x9')]);router['post']('/',auth[_0x4e9c('0x7')](),controller[_0x4e9c('0xa')]);router[_0x4e9c('0xb')](_0x4e9c('0xc'),auth[_0x4e9c('0x7')](),controller[_0x4e9c('0xd')]);router[_0x4e9c('0xe')](_0x4e9c('0xc'),auth['isAuthenticated'](),controller[_0x4e9c('0xf')]);module[_0x4e9c('0x10')]=router; \ No newline at end of file +var _0xf840=['show','post','create','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4d4d13,_0xba6db4){var _0x49b387=function(_0x13e777){while(--_0x13e777){_0x4d4d13['push'](_0x4d4d13['shift']());}};_0x49b387(++_0xba6db4);}(_0xf840,0x1aa));var _0x0f84=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xf840[_0x54ccd7];return _0x4e667b;};'use strict';var multer=require('multer');var util=require(_0x0f84('0x0'));var path=require(_0x0f84('0x1'));var timeout=require(_0x0f84('0x2'));var express=require(_0x0f84('0x3'));var router=express['Router']();var fs_extra=require(_0x0f84('0x4'));var auth=require(_0x0f84('0x5'));var interaction=require(_0x0f84('0x6'));var config=require(_0x0f84('0x7'));var controller=require(_0x0f84('0x8'));router[_0x0f84('0x9')]('/',auth[_0x0f84('0xa')](),controller[_0x0f84('0xb')]);router[_0x0f84('0x9')](_0x0f84('0xc'),auth[_0x0f84('0xa')](),controller[_0x0f84('0xd')]);router['get'](_0x0f84('0xe'),auth[_0x0f84('0xa')](),controller[_0x0f84('0xf')]);router[_0x0f84('0x10')]('/',auth[_0x0f84('0xa')](),controller[_0x0f84('0x11')]);router[_0x0f84('0x12')](_0x0f84('0xe'),auth[_0x0f84('0xa')](),controller['update']);router[_0x0f84('0x13')](_0x0f84('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f84('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 19bb8c0..533fd31 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1d3a5d,_0x17fc32){var _0x257078=function(_0x482f3a){while(--_0x482f3a){_0x1d3a5d['push'](_0x1d3a5d['shift']());}};_0x257078(++_0x17fc32);}(_0x54ef,0x112));var _0xf54e=function(_0x7d4f14,_0x4b154d){_0x7d4f14=_0x7d4f14-0x0;var _0x4c9035=_0x54ef[_0x7d4f14];return _0x4c9035;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2148e9,_0x293504){var _0x2ed6cb=function(_0x254b72){while(--_0x254b72){_0x2148e9['push'](_0x2148e9['shift']());}};_0x2ed6cb(++_0x293504);}(_0x70e0,0x17b));var _0x070e=function(_0x2abeb2,_0x7a71a7){_0x2abeb2=_0x2abeb2-0x0;var _0x55bd55=_0x70e0[_0x2abeb2];return _0x55bd55;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ee2ccd4..7a5c9b0 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 _0xc7b1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x15b163,_0xb788ce){var _0x1ca739=function(_0x5bd47f){while(--_0x5bd47f){_0x15b163['push'](_0x15b163['shift']());}};_0x1ca739(++_0xb788ce);}(_0xc7b1,0x17a));var _0x1c7b=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0xc7b1[_0x5b13c3];return _0x3d6780;};'use strict';var emlformat=require(_0x1c7b('0x0'));var rimraf=require(_0x1c7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c7b('0x2'));var moment=require(_0x1c7b('0x3'));var BPromise=require(_0x1c7b('0x4'));var Mustache=require(_0x1c7b('0x5'));var util=require(_0x1c7b('0x6'));var path=require(_0x1c7b('0x7'));var sox=require(_0x1c7b('0x8'));var csv=require(_0x1c7b('0x9'));var ejs=require(_0x1c7b('0xa'));var fs=require('fs');var fs_extra=require(_0x1c7b('0xb'));var _=require(_0x1c7b('0xc'));var squel=require(_0x1c7b('0xd'));var crypto=require(_0x1c7b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1c7b('0xf'));var toCsv=require(_0x1c7b('0x9'));var querystring=require(_0x1c7b('0x10'));var Papa=require(_0x1c7b('0x11'));var Redis=require(_0x1c7b('0x12'));var authService=require(_0x1c7b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1c7b('0x14'));var hardwareService=require(_0x1c7b('0x15'));var logger=require(_0x1c7b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1c7b('0x17'));var licenseUtil=require(_0x1c7b('0x18'));var db=require(_0x1c7b('0x19'))['db'];function respondWithStatusCode(_0x23225c,_0x59fb12){_0x59fb12=_0x59fb12||0xcc;return function(_0x92c5a8){if(_0x92c5a8){return _0x23225c[_0x1c7b('0x1a')](_0x59fb12);}return _0x23225c['status'](_0x59fb12)[_0x1c7b('0x1b')]();};}function respondWithResult(_0x1bb56f,_0x5c0004){_0x5c0004=_0x5c0004||0xc8;return function(_0x3fb7a3){if(_0x3fb7a3){return _0x1bb56f[_0x1c7b('0x1c')](_0x5c0004)['json'](_0x3fb7a3);}};}function respondWithFilteredResult(_0x1d273c,_0x59b82c){return function(_0x4bb423){if(_0x4bb423){var _0x5c2f06=typeof _0x59b82c[_0x1c7b('0x1d')]===_0x1c7b('0x1e')&&typeof _0x59b82c[_0x1c7b('0x1f')]==='undefined';var _0x1046a8=_0x4bb423['count'];var _0x2a0f5e=_0x5c2f06?0x0:_0x59b82c[_0x1c7b('0x1d')];var _0x3f1e36=_0x5c2f06?_0x4bb423[_0x1c7b('0x20')]:_0x59b82c[_0x1c7b('0x1d')]+_0x59b82c[_0x1c7b('0x1f')];var _0x5b808f;if(_0x3f1e36>=_0x1046a8){_0x3f1e36=_0x1046a8;_0x5b808f=0xc8;}else{_0x5b808f=0xce;}_0x1d273c[_0x1c7b('0x1c')](_0x5b808f);return _0x1d273c[_0x1c7b('0x21')]('Content-Range',_0x2a0f5e+'-'+_0x3f1e36+'/'+_0x1046a8)[_0x1c7b('0x22')](_0x4bb423);}return null;};}function patchUpdates(_0x50a7bf){return function(_0x41e06c){try{jsonpatch['apply'](_0x41e06c,_0x50a7bf,!![]);}catch(_0x3f3ad7){return BPromise[_0x1c7b('0x23')](_0x3f3ad7);}return _0x41e06c[_0x1c7b('0x24')]();};}function saveUpdates(_0x133a69,_0x49542e){return function(_0x9d08b1){if(_0x9d08b1){return _0x9d08b1[_0x1c7b('0x25')](_0x133a69)[_0x1c7b('0x26')](function(_0x1dc489){return _0x1dc489;});}return null;};}function removeEntity(_0x599f01,_0x35c82f){return function(_0x165675){if(_0x165675){return _0x165675[_0x1c7b('0x27')]()['then'](function(){_0x599f01[_0x1c7b('0x1c')](0xcc)[_0x1c7b('0x1b')]();});}};}function handleEntityNotFound(_0x201841,_0x5504a3){return function(_0x28e4f7){if(!_0x28e4f7){_0x201841['sendStatus'](0x194);}return _0x28e4f7;};}function handleError(_0x21cd89,_0x3fae94){_0x3fae94=_0x3fae94||0x1f4;return function(_0x44060f){logger[_0x1c7b('0x28')](_0x44060f[_0x1c7b('0x29')]);if(_0x44060f[_0x1c7b('0x2a')]){delete _0x44060f[_0x1c7b('0x2a')];}_0x21cd89[_0x1c7b('0x1c')](_0x3fae94)[_0x1c7b('0x2b')](_0x44060f);};}exports[_0x1c7b('0x2c')]=function(_0x23a541,_0x489635){var _0x508360={},_0x3d8937={},_0x49b041={'count':0x0,'rows':[]};var _0x205507=_[_0x1c7b('0x2d')](db[_0x1c7b('0x2e')][_0x1c7b('0x2f')],function(_0x281890){return{'name':_0x281890[_0x1c7b('0x30')],'type':_0x281890[_0x1c7b('0x31')][_0x1c7b('0x32')]};});_0x3d8937[_0x1c7b('0x33')]=_[_0x1c7b('0x2d')](_0x205507,_0x1c7b('0x2a'));_0x3d8937[_0x1c7b('0x34')]=_[_0x1c7b('0x35')](_0x23a541['query']);_0x3d8937[_0x1c7b('0x36')]=_[_0x1c7b('0x37')](_0x3d8937[_0x1c7b('0x33')],_0x3d8937['query']);_0x508360[_0x1c7b('0x38')]=_[_0x1c7b('0x37')](_0x3d8937[_0x1c7b('0x33')],qs[_0x1c7b('0x39')](_0x23a541[_0x1c7b('0x34')][_0x1c7b('0x39')]));_0x508360[_0x1c7b('0x38')]=_0x508360[_0x1c7b('0x38')][_0x1c7b('0x3a')]?_0x508360['attributes']:_0x3d8937[_0x1c7b('0x33')];if(!_0x23a541[_0x1c7b('0x34')][_0x1c7b('0x3b')](_0x1c7b('0x3c'))){_0x508360[_0x1c7b('0x1f')]=qs['limit'](_0x23a541['query'][_0x1c7b('0x1f')]);_0x508360[_0x1c7b('0x1d')]=qs[_0x1c7b('0x1d')](_0x23a541[_0x1c7b('0x34')][_0x1c7b('0x1d')]);}_0x508360[_0x1c7b('0x3d')]=qs[_0x1c7b('0x3e')](_0x23a541['query']['sort']);_0x508360['where']=qs[_0x1c7b('0x36')](_[_0x1c7b('0x3f')](_0x23a541[_0x1c7b('0x34')],_0x3d8937[_0x1c7b('0x36')]),_0x205507);if(_0x23a541['query'][_0x1c7b('0x40')]){_0x508360[_0x1c7b('0x41')]=_[_0x1c7b('0x42')](_0x508360[_0x1c7b('0x41')],{'$or':_[_0x1c7b('0x2d')](_0x205507,function(_0x51ec07){if(_0x51ec07[_0x1c7b('0x31')]!=='VIRTUAL'){var _0x2f694a={};_0x2f694a[_0x51ec07[_0x1c7b('0x2a')]]={'$like':'%'+_0x23a541['query'][_0x1c7b('0x40')]+'%'};return _0x2f694a;}})});}_0x508360=_[_0x1c7b('0x42')]({},_0x508360,_0x23a541[_0x1c7b('0x43')]);var _0x1cd9bb={'where':_0x508360[_0x1c7b('0x41')]};return db[_0x1c7b('0x2e')]['count'](_0x1cd9bb)[_0x1c7b('0x26')](function(_0x3acad7){_0x49b041[_0x1c7b('0x20')]=_0x3acad7;if(_0x23a541[_0x1c7b('0x34')][_0x1c7b('0x44')]){_0x508360[_0x1c7b('0x45')]=[{'all':!![]}];}return db[_0x1c7b('0x2e')][_0x1c7b('0x46')](_0x508360);})[_0x1c7b('0x26')](function(_0x11641){_0x49b041[_0x1c7b('0x47')]=_0x11641;return _0x49b041;})[_0x1c7b('0x26')](respondWithFilteredResult(_0x489635,_0x508360))[_0x1c7b('0x48')](handleError(_0x489635,null));};exports[_0x1c7b('0x49')]=function(_0x18dc03,_0x36b8e7){var _0x483ce6={'raw':!![],'where':{'id':_0x18dc03[_0x1c7b('0x4a')]['id']}},_0x2ece06={};_0x2ece06['model']=_[_0x1c7b('0x35')](db[_0x1c7b('0x2e')][_0x1c7b('0x2f')]);_0x2ece06[_0x1c7b('0x34')]=_[_0x1c7b('0x35')](_0x18dc03['query']);_0x2ece06[_0x1c7b('0x36')]=_['intersection'](_0x2ece06['model'],_0x2ece06[_0x1c7b('0x34')]);_0x483ce6['attributes']=_[_0x1c7b('0x37')](_0x2ece06[_0x1c7b('0x33')],qs['fields'](_0x18dc03[_0x1c7b('0x34')][_0x1c7b('0x39')]));_0x483ce6[_0x1c7b('0x38')]=_0x483ce6['attributes'][_0x1c7b('0x3a')]?_0x483ce6[_0x1c7b('0x38')]:_0x2ece06[_0x1c7b('0x33')];if(_0x18dc03[_0x1c7b('0x34')][_0x1c7b('0x44')]){_0x483ce6[_0x1c7b('0x45')]=[{'all':!![]}];}_0x483ce6=_[_0x1c7b('0x42')]({},_0x483ce6,_0x18dc03['options']);return db[_0x1c7b('0x2e')][_0x1c7b('0x4b')](_0x483ce6)['then'](handleEntityNotFound(_0x36b8e7,null))[_0x1c7b('0x26')](respondWithResult(_0x36b8e7,null))[_0x1c7b('0x48')](handleError(_0x36b8e7,null));};exports[_0x1c7b('0x4c')]=function(_0x1ffff1,_0x11316a){return db['MailTransferReport'][_0x1c7b('0x4c')](_0x1ffff1[_0x1c7b('0x4d')],{})[_0x1c7b('0x26')](respondWithResult(_0x11316a,0xc9))[_0x1c7b('0x48')](handleError(_0x11316a,null));};exports[_0x1c7b('0x25')]=function(_0x4db3a4,_0x5167a4){if(_0x4db3a4[_0x1c7b('0x4d')]['id']){delete _0x4db3a4[_0x1c7b('0x4d')]['id'];}return db[_0x1c7b('0x2e')][_0x1c7b('0x4b')]({'where':{'id':_0x4db3a4[_0x1c7b('0x4a')]['id']}})[_0x1c7b('0x26')](handleEntityNotFound(_0x5167a4,null))[_0x1c7b('0x26')](saveUpdates(_0x4db3a4[_0x1c7b('0x4d')],null))[_0x1c7b('0x26')](respondWithResult(_0x5167a4,null))[_0x1c7b('0x48')](handleError(_0x5167a4,null));};exports['destroy']=function(_0x108f58,_0x458350){return db[_0x1c7b('0x2e')][_0x1c7b('0x4b')]({'where':{'id':_0x108f58['params']['id']}})[_0x1c7b('0x26')](handleEntityNotFound(_0x458350,null))[_0x1c7b('0x26')](removeEntity(_0x458350,null))[_0x1c7b('0x48')](handleError(_0x458350,null));};exports[_0x1c7b('0x4e')]=function(_0x1f5a65,_0x1dfa7){return db[_0x1c7b('0x2e')][_0x1c7b('0x4e')]()[_0x1c7b('0x26')](respondWithResult(_0x1dfa7,null))[_0x1c7b('0x48')](handleError(_0x1dfa7,null));}; \ No newline at end of file +var _0x3921=['name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','stack'];(function(_0x1e2eac,_0x26dddf){var _0x7a4e81=function(_0x341ed5){while(--_0x341ed5){_0x1e2eac['push'](_0x1e2eac['shift']());}};_0x7a4e81(++_0x26dddf);}(_0x3921,0x1d8));var _0x1392=function(_0x2cfb4c,_0x3adc38){_0x2cfb4c=_0x2cfb4c-0x0;var _0x1bb169=_0x3921[_0x2cfb4c];return _0x1bb169;};'use strict';var emlformat=require(_0x1392('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1392('0x1'));var jsonpatch=require(_0x1392('0x2'));var rp=require('request-promise');var moment=require(_0x1392('0x3'));var BPromise=require(_0x1392('0x4'));var Mustache=require('mustache');var util=require(_0x1392('0x5'));var path=require(_0x1392('0x6'));var sox=require(_0x1392('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1392('0x8'));var _=require('lodash');var squel=require(_0x1392('0x9'));var crypto=require(_0x1392('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1392('0xb'));var toCsv=require(_0x1392('0xc'));var querystring=require(_0x1392('0xd'));var Papa=require(_0x1392('0xe'));var Redis=require(_0x1392('0xf'));var authService=require(_0x1392('0x10'));var qs=require(_0x1392('0x11'));var as=require(_0x1392('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1392('0x13'))(_0x1392('0x14'));var utils=require(_0x1392('0x15'));var config=require(_0x1392('0x16'));var licenseUtil=require(_0x1392('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57a7ab,_0x20c532){_0x20c532=_0x20c532||0xcc;return function(_0x231cb6){if(_0x231cb6){return _0x57a7ab[_0x1392('0x18')](_0x20c532);}return _0x57a7ab[_0x1392('0x19')](_0x20c532)[_0x1392('0x1a')]();};}function respondWithResult(_0xa49a55,_0x3d7279){_0x3d7279=_0x3d7279||0xc8;return function(_0x51467f){if(_0x51467f){return _0xa49a55[_0x1392('0x19')](_0x3d7279)[_0x1392('0x1b')](_0x51467f);}};}function respondWithFilteredResult(_0x49631c,_0x38679d){return function(_0xea9414){if(_0xea9414){var _0x5dad88=typeof _0x38679d['offset']===_0x1392('0x1c')&&typeof _0x38679d[_0x1392('0x1d')]==='undefined';var _0x1faa06=_0xea9414[_0x1392('0x1e')];var _0x1f2a4a=_0x5dad88?0x0:_0x38679d[_0x1392('0x1f')];var _0x43b86d=_0x5dad88?_0xea9414[_0x1392('0x1e')]:_0x38679d[_0x1392('0x1f')]+_0x38679d[_0x1392('0x1d')];var _0xea5c31;if(_0x43b86d>=_0x1faa06){_0x43b86d=_0x1faa06;_0xea5c31=0xc8;}else{_0xea5c31=0xce;}_0x49631c['status'](_0xea5c31);return _0x49631c[_0x1392('0x20')]('Content-Range',_0x1f2a4a+'-'+_0x43b86d+'/'+_0x1faa06)[_0x1392('0x1b')](_0xea9414);}return null;};}function patchUpdates(_0x3e50a4){return function(_0x59c240){try{jsonpatch['apply'](_0x59c240,_0x3e50a4,!![]);}catch(_0x2a9f2f){return BPromise[_0x1392('0x21')](_0x2a9f2f);}return _0x59c240[_0x1392('0x22')]();};}function saveUpdates(_0x21c2ce,_0x35562d){return function(_0x2440f0){if(_0x2440f0){return _0x2440f0[_0x1392('0x23')](_0x21c2ce)[_0x1392('0x24')](function(_0x14399b){return _0x14399b;});}return null;};}function removeEntity(_0x1d2501,_0x29f8a7){return function(_0x326037){if(_0x326037){return _0x326037[_0x1392('0x25')]()['then'](function(){_0x1d2501[_0x1392('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe38ec,_0x17e492){return function(_0x5cb26e){if(!_0x5cb26e){_0xbe38ec[_0x1392('0x18')](0x194);}return _0x5cb26e;};}function handleError(_0x5c671f,_0x495faf){_0x495faf=_0x495faf||0x1f4;return function(_0x61b22c){logger['error'](_0x61b22c[_0x1392('0x26')]);if(_0x61b22c[_0x1392('0x27')]){delete _0x61b22c[_0x1392('0x27')];}_0x5c671f['status'](_0x495faf)[_0x1392('0x28')](_0x61b22c);};}exports[_0x1392('0x29')]=function(_0x582f26,_0x53709b){var _0x434249={},_0x402cb6={},_0x3f01f5={'count':0x0,'rows':[]};var _0x351ea7=_[_0x1392('0x2a')](db[_0x1392('0x2b')][_0x1392('0x2c')],function(_0x4742b8){return{'name':_0x4742b8[_0x1392('0x2d')],'type':_0x4742b8[_0x1392('0x2e')][_0x1392('0x2f')]};});_0x402cb6[_0x1392('0x30')]=_[_0x1392('0x2a')](_0x351ea7,_0x1392('0x27'));_0x402cb6['query']=_['keys'](_0x582f26[_0x1392('0x31')]);_0x402cb6[_0x1392('0x32')]=_[_0x1392('0x33')](_0x402cb6[_0x1392('0x30')],_0x402cb6[_0x1392('0x31')]);_0x434249[_0x1392('0x34')]=_[_0x1392('0x33')](_0x402cb6['model'],qs['fields'](_0x582f26[_0x1392('0x31')][_0x1392('0x35')]));_0x434249[_0x1392('0x34')]=_0x434249[_0x1392('0x34')][_0x1392('0x36')]?_0x434249[_0x1392('0x34')]:_0x402cb6[_0x1392('0x30')];if(!_0x582f26['query'][_0x1392('0x37')](_0x1392('0x38'))){_0x434249[_0x1392('0x1d')]=qs[_0x1392('0x1d')](_0x582f26[_0x1392('0x31')][_0x1392('0x1d')]);_0x434249[_0x1392('0x1f')]=qs['offset'](_0x582f26['query']['offset']);}_0x434249['order']=qs['sort'](_0x582f26[_0x1392('0x31')]['sort']);_0x434249[_0x1392('0x39')]=qs[_0x1392('0x32')](_['pick'](_0x582f26['query'],_0x402cb6[_0x1392('0x32')]),_0x351ea7);if(_0x582f26[_0x1392('0x31')][_0x1392('0x3a')]){_0x434249[_0x1392('0x39')]=_['merge'](_0x434249[_0x1392('0x39')],{'$or':_[_0x1392('0x2a')](_0x351ea7,function(_0xc30201){if(_0xc30201[_0x1392('0x2e')]!==_0x1392('0x3b')){var _0x39e428={};_0x39e428[_0xc30201[_0x1392('0x27')]]={'$like':'%'+_0x582f26['query'][_0x1392('0x3a')]+'%'};return _0x39e428;}})});}_0x434249=_[_0x1392('0x3c')]({},_0x434249,_0x582f26[_0x1392('0x3d')]);var _0x82d9b2={'where':_0x434249[_0x1392('0x39')]};return db[_0x1392('0x2b')]['count'](_0x82d9b2)[_0x1392('0x24')](function(_0xafb8df){_0x3f01f5[_0x1392('0x1e')]=_0xafb8df;if(_0x582f26['query'][_0x1392('0x3e')]){_0x434249[_0x1392('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x1392('0x40')](_0x434249);})['then'](function(_0x309daa){_0x3f01f5[_0x1392('0x41')]=_0x309daa;return _0x3f01f5;})[_0x1392('0x24')](respondWithFilteredResult(_0x53709b,_0x434249))['catch'](handleError(_0x53709b,null));};exports['show']=function(_0x2f7cfc,_0x409858){var _0x44c15c={'raw':!![],'where':{'id':_0x2f7cfc[_0x1392('0x42')]['id']}},_0xc5e459={};_0xc5e459[_0x1392('0x30')]=_[_0x1392('0x43')](db[_0x1392('0x2b')][_0x1392('0x2c')]);_0xc5e459[_0x1392('0x31')]=_['keys'](_0x2f7cfc['query']);_0xc5e459['filters']=_[_0x1392('0x33')](_0xc5e459[_0x1392('0x30')],_0xc5e459[_0x1392('0x31')]);_0x44c15c[_0x1392('0x34')]=_[_0x1392('0x33')](_0xc5e459['model'],qs[_0x1392('0x35')](_0x2f7cfc[_0x1392('0x31')][_0x1392('0x35')]));_0x44c15c['attributes']=_0x44c15c[_0x1392('0x34')][_0x1392('0x36')]?_0x44c15c[_0x1392('0x34')]:_0xc5e459[_0x1392('0x30')];if(_0x2f7cfc[_0x1392('0x31')]['includeAll']){_0x44c15c[_0x1392('0x3f')]=[{'all':!![]}];}_0x44c15c=_['merge']({},_0x44c15c,_0x2f7cfc[_0x1392('0x3d')]);return db['MailTransferReport'][_0x1392('0x44')](_0x44c15c)[_0x1392('0x24')](handleEntityNotFound(_0x409858,null))['then'](respondWithResult(_0x409858,null))[_0x1392('0x45')](handleError(_0x409858,null));};exports['create']=function(_0x9ba032,_0x2a2c64){return db[_0x1392('0x2b')][_0x1392('0x46')](_0x9ba032[_0x1392('0x47')],{})[_0x1392('0x24')](respondWithResult(_0x2a2c64,0xc9))[_0x1392('0x45')](handleError(_0x2a2c64,null));};exports['update']=function(_0x39ed12,_0x14a383){if(_0x39ed12['body']['id']){delete _0x39ed12[_0x1392('0x47')]['id'];}return db[_0x1392('0x2b')][_0x1392('0x44')]({'where':{'id':_0x39ed12[_0x1392('0x42')]['id']}})[_0x1392('0x24')](handleEntityNotFound(_0x14a383,null))[_0x1392('0x24')](saveUpdates(_0x39ed12[_0x1392('0x47')],null))[_0x1392('0x24')](respondWithResult(_0x14a383,null))[_0x1392('0x45')](handleError(_0x14a383,null));};exports[_0x1392('0x25')]=function(_0x2da363,_0x764f22){return db[_0x1392('0x2b')][_0x1392('0x44')]({'where':{'id':_0x2da363[_0x1392('0x42')]['id']}})['then'](handleEntityNotFound(_0x764f22,null))[_0x1392('0x24')](removeEntity(_0x764f22,null))[_0x1392('0x45')](handleError(_0x764f22,null));};exports['describe']=function(_0x6df640,_0x2eb6a1){return db[_0x1392('0x2b')][_0x1392('0x48')]()[_0x1392('0x24')](respondWithResult(_0x2eb6a1,null))['catch'](handleError(_0x2eb6a1,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1a3ea7b..ddb2514 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 _0x252f=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x576e24,_0x5755bf){var _0xb814de=function(_0x27d4ae){while(--_0x27d4ae){_0x576e24['push'](_0x576e24['shift']());}};_0xb814de(++_0x5755bf);}(_0x252f,0x1e2));var _0xf252=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0x252f[_0x1e50fc];return _0x497f51;};'use strict';var _=require(_0xf252('0x0'));var util=require('util');var logger=require(_0xf252('0x1'))(_0xf252('0x2'));var moment=require(_0xf252('0x3'));var BPromise=require(_0xf252('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf252('0x5'));var rimraf=require(_0xf252('0x6'));var config=require(_0xf252('0x7'));var attributes=require(_0xf252('0x8'));module[_0xf252('0x9')]=function(_0x2bb2e8,_0x351b14){return _0x2bb2e8[_0xf252('0xa')](_0xf252('0xb'),attributes,{'tableName':_0xf252('0xc'),'paranoid':![],'indexes':[{'name':_0xf252('0xd'),'fields':[_0xf252('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe79a=['define','uniqueid','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xf72786,_0x1a0ddd){var _0x113f3e=function(_0x57337a){while(--_0x57337a){_0xf72786['push'](_0xf72786['shift']());}};_0x113f3e(++_0x1a0ddd);}(_0xe79a,0x70));var _0xae79=function(_0x5d9c08,_0x68d66e){_0x5d9c08=_0x5d9c08-0x0;var _0x3d07ae=_0xe79a[_0x5d9c08];return _0x3d07ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae79('0x0'))('api');var moment=require(_0xae79('0x1'));var BPromise=require(_0xae79('0x2'));var rp=require(_0xae79('0x3'));var fs=require('fs');var path=require(_0xae79('0x4'));var rimraf=require('rimraf');var config=require(_0xae79('0x5'));var attributes=require(_0xae79('0x6'));module[_0xae79('0x7')]=function(_0x590be7,_0x1a9185){return _0x590be7[_0xae79('0x8')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xae79('0x9'),'fields':[_0xae79('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 21abfb4..0598c81 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 _0xf063=['jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c1d8a,_0x1aba36){var _0xcfd31e=function(_0x4ee068){while(--_0x4ee068){_0x2c1d8a['push'](_0x2c1d8a['shift']());}};_0xcfd31e(++_0x1aba36);}(_0xf063,0x16d));var _0x3f06=function(_0x45ad76,_0xae5efc){_0x45ad76=_0x45ad76-0x0;var _0x584f8f=_0xf063[_0x45ad76];return _0x584f8f;};'use strict';var _=require(_0x3f06('0x0'));var util=require('util');var moment=require(_0x3f06('0x1'));var BPromise=require(_0x3f06('0x2'));var rs=require(_0x3f06('0x3'));var fs=require('fs');var Redis=require(_0x3f06('0x4'));var db=require(_0x3f06('0x5'))['db'];var utils=require(_0x3f06('0x6'));var logger=require(_0x3f06('0x7'))(_0x3f06('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f06('0x9'));var client=jayson['client'][_0x3f06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3af4f8,_0x4a9864,_0x47a6fd){return new BPromise(function(_0x152a91,_0x154961){return client[_0x3f06('0xb')](_0x3af4f8,_0x47a6fd)[_0x3f06('0xc')](function(_0x191706){logger[_0x3f06('0xd')](_0x3f06('0xe'),_0x4a9864,_0x3f06('0xf'));logger[_0x3f06('0x10')](_0x3f06('0x11'),_0x4a9864,_0x3f06('0xf'),JSON['stringify'](_0x191706));if(_0x191706[_0x3f06('0x12')]){if(_0x191706[_0x3f06('0x12')]['code']===0x1f4){logger[_0x3f06('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x4a9864,_0x191706[_0x3f06('0x12')][_0x3f06('0x13')]);return _0x154961(_0x191706[_0x3f06('0x12')]['message']);}logger[_0x3f06('0x12')](_0x3f06('0xe'),_0x4a9864,_0x191706[_0x3f06('0x12')][_0x3f06('0x13')]);return _0x152a91(_0x191706[_0x3f06('0x12')][_0x3f06('0x13')]);}else{logger[_0x3f06('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4a9864,_0x3f06('0xf'));_0x152a91(_0x191706[_0x3f06('0x14')][_0x3f06('0x13')]);}})[_0x3f06('0x15')](function(_0x2c46b){logger[_0x3f06('0x12')](_0x3f06('0xe'),_0x4a9864,_0x2c46b);_0x154961(_0x2c46b);});});} \ No newline at end of file +var _0xfe07=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfe07,0x153));var _0x7fe0=function(_0x5ef685,_0x14d91b){_0x5ef685=_0x5ef685-0x0;var _0x408629=_0xfe07[_0x5ef685];return _0x408629;};'use strict';var _=require(_0x7fe0('0x0'));var util=require('util');var moment=require(_0x7fe0('0x1'));var BPromise=require(_0x7fe0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fe0('0x3'));var db=require(_0x7fe0('0x4'))['db'];var utils=require(_0x7fe0('0x5'));var logger=require(_0x7fe0('0x6'))(_0x7fe0('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fe0('0x8'));var client=jayson[_0x7fe0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d4d5,_0xc6b0cc,_0x282c43){return new BPromise(function(_0x4b1b3a,_0x5679dd){return client[_0x7fe0('0xa')](_0x36d4d5,_0x282c43)[_0x7fe0('0xb')](function(_0x3d8b59){logger[_0x7fe0('0xc')](_0x7fe0('0xd'),_0xc6b0cc,'request\x20sent');logger[_0x7fe0('0xe')](_0x7fe0('0xf'),_0xc6b0cc,_0x7fe0('0x10'),JSON['stringify'](_0x3d8b59));if(_0x3d8b59[_0x7fe0('0x11')]){if(_0x3d8b59[_0x7fe0('0x11')][_0x7fe0('0x12')]===0x1f4){logger[_0x7fe0('0x11')](_0x7fe0('0xd'),_0xc6b0cc,_0x3d8b59[_0x7fe0('0x11')][_0x7fe0('0x13')]);return _0x5679dd(_0x3d8b59['error'][_0x7fe0('0x13')]);}logger[_0x7fe0('0x11')]('MailTransferReport,\x20%s,\x20%s',_0xc6b0cc,_0x3d8b59['error']['message']);return _0x4b1b3a(_0x3d8b59['error'][_0x7fe0('0x13')]);}else{logger[_0x7fe0('0xc')](_0x7fe0('0xd'),_0xc6b0cc,'request\x20sent');_0x4b1b3a(_0x3d8b59[_0x7fe0('0x14')][_0x7fe0('0x13')]);}})['catch'](function(_0x52ea36){logger[_0x7fe0('0x11')](_0x7fe0('0xd'),_0xc6b0cc,_0x52ea36);_0x5679dd(_0x52ea36);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6ade630..9bb94ec 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 _0xead8=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x584c5a,_0x33808a){var _0x5aa19a=function(_0x7a2250){while(--_0x7a2250){_0x584c5a['push'](_0x584c5a['shift']());}};_0x5aa19a(++_0x33808a);}(_0xead8,0x1e6));var _0x8ead=function(_0x592cea,_0x4e72f1){_0x592cea=_0x592cea-0x0;var _0x1e9cc6=_0xead8[_0x592cea];return _0x1e9cc6;};'use strict';var multer=require(_0x8ead('0x0'));var util=require(_0x8ead('0x1'));var path=require(_0x8ead('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ead('0x3'));var router=express[_0x8ead('0x4')]();var fs_extra=require(_0x8ead('0x5'));var auth=require(_0x8ead('0x6'));var interaction=require(_0x8ead('0x7'));var config=require(_0x8ead('0x8'));var controller=require('./memberReport.controller');router[_0x8ead('0x9')]('/',auth[_0x8ead('0xa')](),controller[_0x8ead('0xb')]);router[_0x8ead('0x9')](_0x8ead('0xc'),auth[_0x8ead('0xa')](),controller['describe']);router[_0x8ead('0x9')](_0x8ead('0xd'),auth[_0x8ead('0xa')](),controller[_0x8ead('0xe')]);router['post']('/',auth[_0x8ead('0xa')](),controller['create']);router[_0x8ead('0xf')](_0x8ead('0xd'),auth['isAuthenticated'](),controller[_0x8ead('0x10')]);router['delete'](_0x8ead('0xd'),auth[_0x8ead('0xa')](),controller[_0x8ead('0x11')]);module[_0x8ead('0x12')]=router; \ No newline at end of file +var _0xd265=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','update','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd265,0x13e));var _0x5d26=function(_0x1f7dd1,_0x1d68a8){_0x1f7dd1=_0x1f7dd1-0x0;var _0x66a2d4=_0xd265[_0x1f7dd1];return _0x66a2d4;};'use strict';var multer=require(_0x5d26('0x0'));var util=require(_0x5d26('0x1'));var path=require(_0x5d26('0x2'));var timeout=require(_0x5d26('0x3'));var express=require(_0x5d26('0x4'));var router=express[_0x5d26('0x5')]();var fs_extra=require(_0x5d26('0x6'));var auth=require(_0x5d26('0x7'));var interaction=require(_0x5d26('0x8'));var config=require(_0x5d26('0x9'));var controller=require(_0x5d26('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d26('0xb')]);router[_0x5d26('0xc')]('/describe',auth[_0x5d26('0xd')](),controller[_0x5d26('0xe')]);router['get'](_0x5d26('0xf'),auth[_0x5d26('0xd')](),controller['show']);router[_0x5d26('0x10')]('/',auth[_0x5d26('0xd')](),controller[_0x5d26('0x11')]);router[_0x5d26('0x12')](_0x5d26('0xf'),auth[_0x5d26('0xd')](),controller[_0x5d26('0x13')]);router['delete'](_0x5d26('0xf'),auth[_0x5d26('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a4039b5..84cf742 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 _0xb85a=['diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt'];(function(_0x51eb3b,_0x2800a5){var _0x534da7=function(_0x1c20f5){while(--_0x1c20f5){_0x51eb3b['push'](_0x51eb3b['shift']());}};_0x534da7(++_0x2800a5);}(_0xb85a,0x11a));var _0xab85=function(_0x2a609e,_0x24b643){_0x2a609e=_0x2a609e-0x0;var _0x258ea4=_0xb85a[_0x2a609e];return _0x258ea4;};'use strict';var Sequelize=require(_0xab85('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xab85('0x1')]},'interface':{'type':Sequelize[_0xab85('0x1')]},'type':{'type':Sequelize[_0xab85('0x1')],'defaultValue':_0xab85('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xab85('0x3')]},'enterAt':{'type':Sequelize[_0xab85('0x4')]},'exitAt':{'type':Sequelize[_0xab85('0x4')],'set':function(_0x349bc4){var _0x55d5db=moment(_0x349bc4);var _0x4b3b8d=moment(this['getDataValue'](_0xab85('0x5')));var _0x857c4b=_0x55d5db[_0xab85('0x6')](_0x4b3b8d,_0xab85('0x7'));this[_0xab85('0x8')](_0xab85('0x9'),_0x349bc4);this[_0xab85('0x8')](_0xab85('0xa'),_0x857c4b>=0x0?_0x857c4b:null);}},'data1':{'type':Sequelize[_0xab85('0x1')],'comment':_0xab85('0xb')},'data2':{'type':Sequelize[_0xab85('0x1')],'comment':_0xab85('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xab85('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xab85('0xe')},'data5':{'type':Sequelize[_0xab85('0x1')],'comment':_0xab85('0xf')},'role':{'type':Sequelize[_0xab85('0x1')]},'internal':{'type':Sequelize[_0xab85('0x3')]},'uniqueid':{'type':Sequelize[_0xab85('0x1')]}}; \ No newline at end of file +var _0x6376=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x6376,0x1b3));var _0x6637=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6376[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x6637('0x0'));var moment=require(_0x6637('0x1'));module['exports']={'channel':{'type':Sequelize[_0x6637('0x2')]},'membername':{'type':Sequelize[_0x6637('0x2')]},'interface':{'type':Sequelize[_0x6637('0x2')]},'type':{'type':Sequelize[_0x6637('0x2')],'defaultValue':_0x6637('0x3'),'comment':_0x6637('0x4')},'duration':{'type':Sequelize[_0x6637('0x5')]},'enterAt':{'type':Sequelize[_0x6637('0x6')]},'exitAt':{'type':Sequelize[_0x6637('0x6')],'set':function(_0x44cdff){var _0x1a4d6a=moment(_0x44cdff);var _0x5b54dc=moment(this[_0x6637('0x7')](_0x6637('0x8')));var _0x40129f=_0x1a4d6a[_0x6637('0x9')](_0x5b54dc,_0x6637('0xa'));this[_0x6637('0xb')](_0x6637('0xc'),_0x44cdff);this[_0x6637('0xb')](_0x6637('0xd'),_0x40129f>=0x0?_0x40129f:null);}},'data1':{'type':Sequelize[_0x6637('0x2')],'comment':_0x6637('0xe')},'data2':{'type':Sequelize[_0x6637('0x2')],'comment':_0x6637('0xf')},'data3':{'type':Sequelize[_0x6637('0x2')],'comment':_0x6637('0x10')},'data4':{'type':Sequelize[_0x6637('0x2')],'comment':_0x6637('0x11')},'data5':{'type':Sequelize['STRING'],'comment':_0x6637('0x12')},'role':{'type':Sequelize[_0x6637('0x2')]},'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 e9a05a1..8818f19 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x35f123,_0x4fa42e){var _0x35d6e4=function(_0x3992f9){while(--_0x3992f9){_0x35f123['push'](_0x35f123['shift']());}};_0x35d6e4(++_0x4fa42e);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,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(_0x26ddb3,_0x1e8676){var _0x227a81=function(_0x28de22){while(--_0x28de22){_0x26ddb3['push'](_0x26ddb3['shift']());}};_0x227a81(++_0x1e8676);}(_0x3e74,0x175));var _0x43e7=function(_0x1f61f8,_0x2d9531){_0x1f61f8=_0x1f61f8-0x0;var _0x4a4928=_0x3e74[_0x1f61f8];return _0x4a4928;};'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 e91466e..7a2ab8e 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 _0xa3ab=['request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b85c2,_0x50d623){var _0x48a40d=function(_0x7283d){while(--_0x7283d){_0x3b85c2['push'](_0x3b85c2['shift']());}};_0x48a40d(++_0x50d623);}(_0xa3ab,0x104));var _0xba3a=function(_0x35474e,_0x24ed27){_0x35474e=_0x35474e-0x0;var _0x43419b=_0xa3ab[_0x35474e];return _0x43419b;};'use strict';var _=require(_0xba3a('0x0'));var util=require(_0xba3a('0x1'));var logger=require(_0xba3a('0x2'))(_0xba3a('0x3'));var moment=require(_0xba3a('0x4'));var BPromise=require(_0xba3a('0x5'));var rp=require(_0xba3a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba3a('0x7'));var config=require(_0xba3a('0x8'));var attributes=require(_0xba3a('0x9'));module[_0xba3a('0xa')]=function(_0x24af40,_0x2e664d){return _0x24af40[_0xba3a('0xb')](_0xba3a('0xc'),attributes,{'tableName':_0xba3a('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bc1=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','util'];(function(_0x15106b,_0x4d96f6){var _0x521203=function(_0x4dbe23){while(--_0x4dbe23){_0x15106b['push'](_0x15106b['shift']());}};_0x521203(++_0x4d96f6);}(_0x5bc1,0xb5));var _0x15bc=function(_0x270323,_0x72160){_0x270323=_0x270323-0x0;var _0x48a027=_0x5bc1[_0x270323];return _0x48a027;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var logger=require(_0x15bc('0x1'))(_0x15bc('0x2'));var moment=require(_0x15bc('0x3'));var BPromise=require(_0x15bc('0x4'));var rp=require(_0x15bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bc('0x6'));var attributes=require(_0x15bc('0x7'));module[_0x15bc('0x8')]=function(_0x52766f,_0x109031){return _0x52766f['define'](_0x15bc('0x9'),attributes,{'tableName':_0x15bc('0xa'),'paranoid':![],'indexes':[{'name':_0x15bc('0xb'),'fields':[_0x15bc('0xc'),_0x15bc('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 8794eed..590038c 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 _0xd8a5=['UpdateMemberReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','body'];(function(_0x152453,_0x5b825d){var _0x7cf2fe=function(_0x276843){while(--_0x276843){_0x152453['push'](_0x152453['shift']());}};_0x7cf2fe(++_0x5b825d);}(_0xd8a5,0x160));var _0x5d8a=function(_0x171db7,_0x4f0bd8){_0x171db7=_0x171db7-0x0;var _0x1d1301=_0xd8a5[_0x171db7];return _0x1d1301;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var moment=require(_0x5d8a('0x1'));var BPromise=require(_0x5d8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d8a('0x3'));var db=require(_0x5d8a('0x4'))['db'];var utils=require(_0x5d8a('0x5'));var logger=require(_0x5d8a('0x6'))(_0x5d8a('0x7'));var config=require(_0x5d8a('0x8'));var jayson=require(_0x5d8a('0x9'));var client=jayson[_0x5d8a('0xa')][_0x5d8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ab34,_0x441fb9,_0x3514c5){return new BPromise(function(_0x32cd30,_0x579306){return client[_0x5d8a('0xc')](_0x46ab34,_0x3514c5)[_0x5d8a('0xd')](function(_0x46cbb2){logger[_0x5d8a('0xe')](_0x5d8a('0xf'),_0x441fb9,'request\x20sent');logger[_0x5d8a('0x10')](_0x5d8a('0x11'),_0x441fb9,_0x5d8a('0x12'),JSON[_0x5d8a('0x13')](_0x46cbb2));if(_0x46cbb2['error']){if(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x15')]===0x1f4){logger['error'](_0x5d8a('0xf'),_0x441fb9,_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);return _0x579306(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);}logger[_0x5d8a('0x14')](_0x5d8a('0xf'),_0x441fb9,_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);return _0x32cd30(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);}else{logger[_0x5d8a('0xe')]('MemberReport,\x20%s,\x20%s',_0x441fb9,'request\x20sent');_0x32cd30(_0x46cbb2[_0x5d8a('0x17')][_0x5d8a('0x16')]);}})['catch'](function(_0x3d3505){logger[_0x5d8a('0x14')](_0x5d8a('0xf'),_0x441fb9,_0x3d3505);_0x579306(_0x3d3505);});});}exports[_0x5d8a('0x18')]=function(_0x5eb748){var _0x16ff4e=this;return new Promise(function(_0x54ab16,_0xc67710){return db[_0x5d8a('0x19')][_0x5d8a('0x1a')]({'raw':_0x5eb748[_0x5d8a('0x1b')]?_0x5eb748[_0x5d8a('0x1b')][_0x5d8a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eb748[_0x5d8a('0x1b')]?_0x5eb748['options'][_0x5d8a('0x1d')]||null:null,'attributes':_0x5eb748[_0x5d8a('0x1b')]?_0x5eb748[_0x5d8a('0x1b')][_0x5d8a('0x1e')]||null:null,'limit':_0x5eb748['options']?_0x5eb748[_0x5d8a('0x1b')][_0x5d8a('0x1f')]||null:null,'include':_0x5eb748[_0x5d8a('0x1b')]?_0x5eb748['options'][_0x5d8a('0x20')]?_[_0x5d8a('0x21')](_0x5eb748[_0x5d8a('0x1b')][_0x5d8a('0x20')],function(_0x5d9f63){return{'model':db[_0x5d9f63[_0x5d8a('0x22')]],'as':_0x5d9f63['as'],'attributes':_0x5d9f63[_0x5d8a('0x1e')],'include':_0x5d9f63['include']?_[_0x5d8a('0x21')](_0x5d9f63['include'],function(_0x194b9e){return{'model':db[_0x194b9e[_0x5d8a('0x22')]],'as':_0x194b9e['as'],'attributes':_0x194b9e[_0x5d8a('0x1e')],'include':_0x194b9e['include']?_[_0x5d8a('0x21')](_0x194b9e[_0x5d8a('0x20')],function(_0x4cb5e2){return{'model':db[_0x4cb5e2['model']],'as':_0x4cb5e2['as'],'attributes':_0x4cb5e2[_0x5d8a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d8a('0xd')](function(_0x20fae2){logger['info'](_0x5d8a('0x18'),_0x5eb748);logger[_0x5d8a('0x10')]('GetMemberReport',_0x5eb748,JSON[_0x5d8a('0x13')](_0x20fae2));_0x54ab16(_0x20fae2);})[_0x5d8a('0x23')](function(_0x1be0ce){logger[_0x5d8a('0x14')](_0x5d8a('0x18'),_0x1be0ce['message'],_0x5eb748);_0xc67710(_0x16ff4e[_0x5d8a('0x14')](0x1f4,_0x1be0ce[_0x5d8a('0x16')]));});});};exports[_0x5d8a('0x24')]=function(_0x1b1d4b){var _0x2b10e6=this;return new Promise(function(_0x1e6ab5,_0x30b4ad){return db[_0x5d8a('0x19')]['create'](_0x1b1d4b[_0x5d8a('0x25')],{'raw':_0x1b1d4b[_0x5d8a('0x1b')]?_0x1b1d4b[_0x5d8a('0x1b')][_0x5d8a('0x1c')]===undefined?!![]:![]:!![]})[_0x5d8a('0xd')](function(_0x2c0761){logger[_0x5d8a('0xe')](_0x5d8a('0x24'),_0x1b1d4b);logger[_0x5d8a('0x10')](_0x5d8a('0x24'),_0x1b1d4b,JSON[_0x5d8a('0x13')](_0x2c0761));_0x1e6ab5(_0x2c0761);})[_0x5d8a('0x23')](function(_0x566af4){logger[_0x5d8a('0x14')](_0x5d8a('0x24'),_0x566af4[_0x5d8a('0x16')],_0x1b1d4b);_0x30b4ad(_0x2b10e6['error'](0x1f4,_0x566af4[_0x5d8a('0x16')]));});});};exports['UpdateMemberReport']=function(_0x104138){var _0x4b33b4=this;return new Promise(function(_0x5ce9d6,_0x440c35){return db['MemberReport']['update'](_0x104138[_0x5d8a('0x25')],{'raw':_0x104138[_0x5d8a('0x1b')]?_0x104138[_0x5d8a('0x1b')][_0x5d8a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x104138[_0x5d8a('0x1b')]?_0x104138[_0x5d8a('0x1b')][_0x5d8a('0x1d')]||null:null,'attributes':_0x104138[_0x5d8a('0x1b')]?_0x104138[_0x5d8a('0x1b')]['attributes']||null:null,'limit':_0x104138['options']?_0x104138['options'][_0x5d8a('0x1f')]||null:null})[_0x5d8a('0xd')](function(_0x13b61e){logger[_0x5d8a('0xe')]('UpdateMemberReport',_0x104138);logger['debug'](_0x5d8a('0x26'),_0x104138,JSON[_0x5d8a('0x13')](_0x13b61e));_0x5ce9d6(_0x13b61e);})[_0x5d8a('0x23')](function(_0x2a5293){logger[_0x5d8a('0x14')](_0x5d8a('0x26'),_0x2a5293[_0x5d8a('0x16')],_0x104138);_0x440c35(_0x4b33b4['error'](0x1f4,_0x2a5293['message']));});});}; \ No newline at end of file +var _0xc359=['ioredis','../../config/utils','rpc','jayson/promise','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','debug','CreateMemberReport','create','body','UpdateMemberReport','util','bluebird','randomstring'];(function(_0x4de452,_0x53a80f){var _0x2a80ee=function(_0x10080e){while(--_0x10080e){_0x4de452['push'](_0x4de452['shift']());}};_0x2a80ee(++_0x53a80f);}(_0xc359,0x1d9));var _0x9c35=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xc359[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d9d7,_0x4b61d6,_0x279ba9){return new BPromise(function(_0x2993da,_0x1ab745){return client[_0x9c35('0x7')](_0x53d9d7,_0x279ba9)[_0x9c35('0x8')](function(_0x2efae8){logger['info'](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4b61d6,'request\x20sent',JSON[_0x9c35('0xb')](_0x2efae8));if(_0x2efae8['error']){if(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xd')]===0x1f4){logger[_0x9c35('0xc')]('MemberReport,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x1ab745(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}logger[_0x9c35('0xc')]('MemberReport,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x2993da(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}else{logger[_0x9c35('0xf')](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));_0x2993da(_0x2efae8[_0x9c35('0x10')][_0x9c35('0xe')]);}})[_0x9c35('0x11')](function(_0x387dd7){logger[_0x9c35('0xc')](_0x9c35('0x9'),_0x4b61d6,_0x387dd7);_0x1ab745(_0x387dd7);});});}exports[_0x9c35('0x12')]=function(_0x26db4b){var _0x4cbeb6=this;return new Promise(function(_0x1d0227,_0x389ddb){return db[_0x9c35('0x13')][_0x9c35('0x14')]({'raw':_0x26db4b['options']?_0x26db4b[_0x9c35('0x15')][_0x9c35('0x16')]===undefined?!![]:![]:!![],'where':_0x26db4b[_0x9c35('0x15')]?_0x26db4b[_0x9c35('0x15')][_0x9c35('0x17')]||null:null,'attributes':_0x26db4b['options']?_0x26db4b[_0x9c35('0x15')]['attributes']||null:null,'limit':_0x26db4b[_0x9c35('0x15')]?_0x26db4b[_0x9c35('0x15')][_0x9c35('0x18')]||null:null,'include':_0x26db4b[_0x9c35('0x15')]?_0x26db4b[_0x9c35('0x15')][_0x9c35('0x19')]?_[_0x9c35('0x1a')](_0x26db4b['options']['include'],function(_0x1bc7e4){return{'model':db[_0x1bc7e4[_0x9c35('0x1b')]],'as':_0x1bc7e4['as'],'attributes':_0x1bc7e4[_0x9c35('0x1c')],'include':_0x1bc7e4[_0x9c35('0x19')]?_['map'](_0x1bc7e4[_0x9c35('0x19')],function(_0x578e00){return{'model':db[_0x578e00[_0x9c35('0x1b')]],'as':_0x578e00['as'],'attributes':_0x578e00['attributes'],'include':_0x578e00['include']?_[_0x9c35('0x1a')](_0x578e00[_0x9c35('0x19')],function(_0x2cba78){return{'model':db[_0x2cba78['model']],'as':_0x2cba78['as'],'attributes':_0x2cba78[_0x9c35('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16cc31){logger[_0x9c35('0xf')](_0x9c35('0x12'),_0x26db4b);logger[_0x9c35('0x1d')](_0x9c35('0x12'),_0x26db4b,JSON['stringify'](_0x16cc31));_0x1d0227(_0x16cc31);})[_0x9c35('0x11')](function(_0x16e8dd){logger['error'](_0x9c35('0x12'),_0x16e8dd[_0x9c35('0xe')],_0x26db4b);_0x389ddb(_0x4cbeb6[_0x9c35('0xc')](0x1f4,_0x16e8dd[_0x9c35('0xe')]));});});};exports[_0x9c35('0x1e')]=function(_0x4cb625){var _0x37379c=this;return new Promise(function(_0xd9c6b3,_0x2a7412){return db[_0x9c35('0x13')][_0x9c35('0x1f')](_0x4cb625[_0x9c35('0x20')],{'raw':_0x4cb625['options']?_0x4cb625[_0x9c35('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x9c35('0x8')](function(_0x2e3cd8){logger[_0x9c35('0xf')](_0x9c35('0x1e'),_0x4cb625);logger[_0x9c35('0x1d')]('CreateMemberReport',_0x4cb625,JSON[_0x9c35('0xb')](_0x2e3cd8));_0xd9c6b3(_0x2e3cd8);})[_0x9c35('0x11')](function(_0x4986a9){logger['error'](_0x9c35('0x1e'),_0x4986a9['message'],_0x4cb625);_0x2a7412(_0x37379c['error'](0x1f4,_0x4986a9['message']));});});};exports[_0x9c35('0x21')]=function(_0x2b5c69){var _0x2cc16a=this;return new Promise(function(_0x1ca5f1,_0x232e97){return db[_0x9c35('0x13')]['update'](_0x2b5c69[_0x9c35('0x20')],{'raw':_0x2b5c69[_0x9c35('0x15')]?_0x2b5c69[_0x9c35('0x15')][_0x9c35('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5c69['options']?_0x2b5c69[_0x9c35('0x15')][_0x9c35('0x17')]||null:null,'attributes':_0x2b5c69[_0x9c35('0x15')]?_0x2b5c69[_0x9c35('0x15')][_0x9c35('0x1c')]||null:null,'limit':_0x2b5c69[_0x9c35('0x15')]?_0x2b5c69[_0x9c35('0x15')]['limit']||null:null})['then'](function(_0x53df3e){logger[_0x9c35('0xf')]('UpdateMemberReport',_0x2b5c69);logger[_0x9c35('0x1d')]('UpdateMemberReport',_0x2b5c69,JSON['stringify'](_0x53df3e));_0x1ca5f1(_0x53df3e);})[_0x9c35('0x11')](function(_0x431df0){logger[_0x9c35('0xc')](_0x9c35('0x21'),_0x431df0[_0x9c35('0xe')],_0x2b5c69);_0x232e97(_0x2cc16a[_0x9c35('0xc')](0x1f4,_0x431df0[_0x9c35('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f6bcab5..5bf2eda 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 _0x2367=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x38819a,_0x26b4ab){var _0x144bc2=function(_0x279eec){while(--_0x279eec){_0x38819a['push'](_0x38819a['shift']());}};_0x144bc2(++_0x26b4ab);}(_0x2367,0x1b6));var _0x7236=function(_0x37a5b2,_0x12666d){_0x37a5b2=_0x37a5b2-0x0;var _0x14f3d1=_0x2367[_0x37a5b2];return _0x14f3d1;};'use strict';var multer=require(_0x7236('0x0'));var util=require(_0x7236('0x1'));var path=require(_0x7236('0x2'));var timeout=require(_0x7236('0x3'));var express=require(_0x7236('0x4'));var router=express['Router']();var fs_extra=require(_0x7236('0x5'));var auth=require(_0x7236('0x6'));var interaction=require(_0x7236('0x7'));var config=require(_0x7236('0x8'));var controller=require(_0x7236('0x9'));router['get']('/',controller[_0x7236('0xa')]);module[_0x7236('0xb')]=router; \ No newline at end of file +var _0x7596=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x305be9,_0x33d224){var _0x5b77b9=function(_0x263954){while(--_0x263954){_0x305be9['push'](_0x305be9['shift']());}};_0x5b77b9(++_0x33d224);}(_0x7596,0xa2));var _0x6759=function(_0x41f69d,_0xde8d57){_0x41f69d=_0x41f69d-0x0;var _0x1b163b=_0x7596[_0x41f69d];return _0x1b163b;};'use strict';var multer=require(_0x6759('0x0'));var util=require(_0x6759('0x1'));var path=require(_0x6759('0x2'));var timeout=require(_0x6759('0x3'));var express=require(_0x6759('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6759('0x5'));var interaction=require(_0x6759('0x6'));var config=require(_0x6759('0x7'));var controller=require(_0x6759('0x8'));router[_0x6759('0x9')]('/',controller[_0x6759('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9d14374..e6a5263 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 _0x6f40=['STRING','sequelize','exports'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x6f40,0x1cf));var _0x06f4=function(_0x1af25e,_0x35c029){_0x1af25e=_0x1af25e-0x0;var _0x15318e=_0x6f40[_0x1af25e];return _0x15318e;};'use strict';var Sequelize=require(_0x06f4('0x0'));module[_0x06f4('0x1')]={'version':{'type':Sequelize[_0x06f4('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xdf20=['sequelize','exports','STRING','version'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdf20,0x1a4));var _0x0df2=function(_0x1127e8,_0x1cd206){_0x1127e8=_0x1127e8-0x0;var _0x3e69f0=_0xdf20[_0x1127e8];return _0x3e69f0;};'use strict';var Sequelize=require(_0x0df2('0x0'));module[_0x0df2('0x1')]={'version':{'type':Sequelize[_0x0df2('0x2')],'unique':_0x0df2('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 0cd036f..6f9cf69 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 _0xe775=['findAll','rows','eml-format','rimraf','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../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','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x5b4365,_0x4d4a0b){var _0x4fdf3d=function(_0x34a439){while(--_0x34a439){_0x5b4365['push'](_0x5b4365['shift']());}};_0x4fdf3d(++_0x4d4a0b);}(_0xe775,0x151));var _0x5e77=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xe775[_0x1ee351];return _0x245aaf;};'use strict';var emlformat=require(_0x5e77('0x0'));var rimraf=require(_0x5e77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e77('0x2'));var BPromise=require(_0x5e77('0x3'));var Mustache=require('mustache');var util=require(_0x5e77('0x4'));var path=require('path');var sox=require(_0x5e77('0x5'));var csv=require(_0x5e77('0x6'));var ejs=require(_0x5e77('0x7'));var fs=require('fs');var fs_extra=require(_0x5e77('0x8'));var _=require('lodash');var squel=require(_0x5e77('0x9'));var crypto=require(_0x5e77('0xa'));var jsforce=require(_0x5e77('0xb'));var deskjs=require(_0x5e77('0xc'));var toCsv=require(_0x5e77('0x6'));var querystring=require(_0x5e77('0xd'));var Papa=require(_0x5e77('0xe'));var Redis=require(_0x5e77('0xf'));var authService=require(_0x5e77('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e77('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5e77('0x12'));var config=require(_0x5e77('0x13'));var licenseUtil=require(_0x5e77('0x14'));var db=require(_0x5e77('0x15'))['db'];function respondWithStatusCode(_0x56f0d0,_0x1a4d46){_0x1a4d46=_0x1a4d46||0xcc;return function(_0x29fc71){if(_0x29fc71){return _0x56f0d0['sendStatus'](_0x1a4d46);}return _0x56f0d0[_0x5e77('0x16')](_0x1a4d46)['end']();};}function respondWithResult(_0x3a57d2,_0x226238){_0x226238=_0x226238||0xc8;return function(_0x541f87){if(_0x541f87){return _0x3a57d2['status'](_0x226238)[_0x5e77('0x17')](_0x541f87);}};}function respondWithFilteredResult(_0x5952da,_0x12e55d){return function(_0x1e2ca3){if(_0x1e2ca3){var _0x2fc155=typeof _0x12e55d[_0x5e77('0x18')]===_0x5e77('0x19')&&typeof _0x12e55d[_0x5e77('0x1a')]===_0x5e77('0x19');var _0x40aeee=_0x1e2ca3['count'];var _0x442c4e=_0x2fc155?0x0:_0x12e55d[_0x5e77('0x18')];var _0x406384=_0x2fc155?_0x1e2ca3[_0x5e77('0x1b')]:_0x12e55d[_0x5e77('0x18')]+_0x12e55d['limit'];var _0x2f7380;if(_0x406384>=_0x40aeee){_0x406384=_0x40aeee;_0x2f7380=0xc8;}else{_0x2f7380=0xce;}_0x5952da[_0x5e77('0x16')](_0x2f7380);return _0x5952da[_0x5e77('0x1c')](_0x5e77('0x1d'),_0x442c4e+'-'+_0x406384+'/'+_0x40aeee)['json'](_0x1e2ca3);}return null;};}function patchUpdates(_0x2bee5c){return function(_0x2bdff8){try{jsonpatch[_0x5e77('0x1e')](_0x2bdff8,_0x2bee5c,!![]);}catch(_0xc0fdde){return BPromise[_0x5e77('0x1f')](_0xc0fdde);}return _0x2bdff8[_0x5e77('0x20')]();};}function saveUpdates(_0xf1bf16,_0x372815){return function(_0xa472d7){if(_0xa472d7){return _0xa472d7['update'](_0xf1bf16)['then'](function(_0x262da6){return _0x262da6;});}return null;};}function removeEntity(_0x45af31,_0x26bbd2){return function(_0x415dbd){if(_0x415dbd){return _0x415dbd['destroy']()[_0x5e77('0x21')](function(){_0x45af31[_0x5e77('0x16')](0xcc)[_0x5e77('0x22')]();});}};}function handleEntityNotFound(_0x32dabc,_0x10acec){return function(_0xcce841){if(!_0xcce841){_0x32dabc[_0x5e77('0x23')](0x194);}return _0xcce841;};}function handleError(_0x369f3,_0x335d88){_0x335d88=_0x335d88||0x1f4;return function(_0x40880b){logger[_0x5e77('0x24')](_0x40880b[_0x5e77('0x25')]);if(_0x40880b[_0x5e77('0x26')]){delete _0x40880b[_0x5e77('0x26')];}_0x369f3['status'](_0x335d88)[_0x5e77('0x27')](_0x40880b);};}exports[_0x5e77('0x28')]=function(_0x33400c,_0x9ab0e2){var _0x2753d1={},_0x55f788={},_0x52621c={'count':0x0,'rows':[]};var _0x1777d4=_[_0x5e77('0x29')](db[_0x5e77('0x2a')][_0x5e77('0x2b')],function(_0x285f22){return{'name':_0x285f22[_0x5e77('0x2c')],'type':_0x285f22[_0x5e77('0x2d')][_0x5e77('0x2e')]};});_0x55f788[_0x5e77('0x2f')]=_[_0x5e77('0x29')](_0x1777d4,_0x5e77('0x26'));_0x55f788[_0x5e77('0x30')]=_[_0x5e77('0x31')](_0x33400c[_0x5e77('0x30')]);_0x55f788[_0x5e77('0x32')]=_[_0x5e77('0x33')](_0x55f788['model'],_0x55f788[_0x5e77('0x30')]);_0x2753d1['attributes']=_[_0x5e77('0x33')](_0x55f788[_0x5e77('0x2f')],qs[_0x5e77('0x34')](_0x33400c[_0x5e77('0x30')][_0x5e77('0x34')]));_0x2753d1[_0x5e77('0x35')]=_0x2753d1[_0x5e77('0x35')][_0x5e77('0x36')]?_0x2753d1[_0x5e77('0x35')]:_0x55f788['model'];if(!_0x33400c['query']['hasOwnProperty'](_0x5e77('0x37'))){_0x2753d1['limit']=qs[_0x5e77('0x1a')](_0x33400c['query'][_0x5e77('0x1a')]);_0x2753d1[_0x5e77('0x18')]=qs[_0x5e77('0x18')](_0x33400c[_0x5e77('0x30')]['offset']);}_0x2753d1['order']=qs[_0x5e77('0x38')](_0x33400c[_0x5e77('0x30')]['sort']);_0x2753d1['where']=qs[_0x5e77('0x32')](_[_0x5e77('0x39')](_0x33400c[_0x5e77('0x30')],_0x55f788[_0x5e77('0x32')]),_0x1777d4);if(_0x33400c['query'][_0x5e77('0x3a')]){_0x2753d1[_0x5e77('0x3b')]=_[_0x5e77('0x3c')](_0x2753d1['where'],{'$or':_['map'](_0x1777d4,function(_0x4043cf){if(_0x4043cf[_0x5e77('0x2d')]!==_0x5e77('0x3d')){var _0x4f99fa={};_0x4f99fa[_0x4043cf[_0x5e77('0x26')]]={'$like':'%'+_0x33400c[_0x5e77('0x30')]['filter']+'%'};return _0x4f99fa;}})});}_0x2753d1=_[_0x5e77('0x3c')]({},_0x2753d1,_0x33400c[_0x5e77('0x3e')]);var _0x4e1cc7={'where':_0x2753d1[_0x5e77('0x3b')]};return db[_0x5e77('0x2a')]['count'](_0x4e1cc7)[_0x5e77('0x21')](function(_0x4f3dfa){_0x52621c['count']=_0x4f3dfa;if(_0x33400c[_0x5e77('0x30')][_0x5e77('0x3f')]){_0x2753d1[_0x5e77('0x40')]=[{'all':!![]}];}return db[_0x5e77('0x2a')][_0x5e77('0x41')](_0x2753d1);})[_0x5e77('0x21')](function(_0x4bb291){_0x52621c[_0x5e77('0x42')]=_0x4bb291;return _0x52621c;})[_0x5e77('0x21')](respondWithFilteredResult(_0x9ab0e2,_0x2753d1))['catch'](handleError(_0x9ab0e2,null));}; \ No newline at end of file +var _0x5d6f=['sort','where','filter','merge','type','VIRTUAL','includeAll','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','stack','name','index','Migration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x337fef,_0x4f4712){var _0x3147c8=function(_0x4fd91d){while(--_0x4fd91d){_0x337fef['push'](_0x337fef['shift']());}};_0x3147c8(++_0x4f4712);}(_0x5d6f,0x182));var _0xf5d6=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0x5d6f[_0xe1063b];return _0x3f79b1;};'use strict';var emlformat=require(_0xf5d6('0x0'));var rimraf=require(_0xf5d6('0x1'));var zipdir=require(_0xf5d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5d6('0x3'));var moment=require('moment');var BPromise=require(_0xf5d6('0x4'));var Mustache=require(_0xf5d6('0x5'));var util=require(_0xf5d6('0x6'));var path=require('path');var sox=require(_0xf5d6('0x7'));var csv=require(_0xf5d6('0x8'));var ejs=require(_0xf5d6('0x9'));var fs=require('fs');var fs_extra=require(_0xf5d6('0xa'));var _=require(_0xf5d6('0xb'));var squel=require(_0xf5d6('0xc'));var crypto=require('crypto');var jsforce=require(_0xf5d6('0xd'));var deskjs=require(_0xf5d6('0xe'));var toCsv=require(_0xf5d6('0x8'));var querystring=require(_0xf5d6('0xf'));var Papa=require(_0xf5d6('0x10'));var Redis=require(_0xf5d6('0x11'));var authService=require(_0xf5d6('0x12'));var qs=require(_0xf5d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5d6('0x14'));var utils=require(_0xf5d6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5d6('0x16'));var db=require(_0xf5d6('0x17'))['db'];function respondWithStatusCode(_0x755e30,_0x10fc67){_0x10fc67=_0x10fc67||0xcc;return function(_0x4625a7){if(_0x4625a7){return _0x755e30[_0xf5d6('0x18')](_0x10fc67);}return _0x755e30[_0xf5d6('0x19')](_0x10fc67)[_0xf5d6('0x1a')]();};}function respondWithResult(_0x30db02,_0x21f979){_0x21f979=_0x21f979||0xc8;return function(_0x135f7f){if(_0x135f7f){return _0x30db02[_0xf5d6('0x19')](_0x21f979)[_0xf5d6('0x1b')](_0x135f7f);}};}function respondWithFilteredResult(_0x477cb0,_0x1952b2){return function(_0x11a062){if(_0x11a062){var _0x2e6415=typeof _0x1952b2['offset']===_0xf5d6('0x1c')&&typeof _0x1952b2[_0xf5d6('0x1d')]===_0xf5d6('0x1c');var _0x26ac5b=_0x11a062[_0xf5d6('0x1e')];var _0x3ab08c=_0x2e6415?0x0:_0x1952b2[_0xf5d6('0x1f')];var _0x52ae9a=_0x2e6415?_0x11a062[_0xf5d6('0x1e')]:_0x1952b2[_0xf5d6('0x1f')]+_0x1952b2[_0xf5d6('0x1d')];var _0x4a7c6f;if(_0x52ae9a>=_0x26ac5b){_0x52ae9a=_0x26ac5b;_0x4a7c6f=0xc8;}else{_0x4a7c6f=0xce;}_0x477cb0[_0xf5d6('0x19')](_0x4a7c6f);return _0x477cb0[_0xf5d6('0x20')]('Content-Range',_0x3ab08c+'-'+_0x52ae9a+'/'+_0x26ac5b)[_0xf5d6('0x1b')](_0x11a062);}return null;};}function patchUpdates(_0x3d02ed){return function(_0x33577b){try{jsonpatch[_0xf5d6('0x21')](_0x33577b,_0x3d02ed,!![]);}catch(_0x432891){return BPromise['reject'](_0x432891);}return _0x33577b['save']();};}function saveUpdates(_0x2f6d22,_0x20948){return function(_0x12e480){if(_0x12e480){return _0x12e480[_0xf5d6('0x22')](_0x2f6d22)[_0xf5d6('0x23')](function(_0x2928de){return _0x2928de;});}return null;};}function removeEntity(_0x1d7e69,_0x4f2959){return function(_0x4b4b53){if(_0x4b4b53){return _0x4b4b53[_0xf5d6('0x24')]()[_0xf5d6('0x23')](function(){_0x1d7e69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9d00,_0x28e11b){return function(_0x55a667){if(!_0x55a667){_0x4f9d00[_0xf5d6('0x18')](0x194);}return _0x55a667;};}function handleError(_0x3ba12d,_0x264e5b){_0x264e5b=_0x264e5b||0x1f4;return function(_0x3ef2c5){logger[_0xf5d6('0x25')](_0x3ef2c5[_0xf5d6('0x26')]);if(_0x3ef2c5[_0xf5d6('0x27')]){delete _0x3ef2c5[_0xf5d6('0x27')];}_0x3ba12d['status'](_0x264e5b)['send'](_0x3ef2c5);};}exports[_0xf5d6('0x28')]=function(_0x499b24,_0x254485){var _0x79e70={},_0x134953={},_0x225d76={'count':0x0,'rows':[]};var _0x51a386=_['map'](db[_0xf5d6('0x29')][_0xf5d6('0x2a')],function(_0x33f770){return{'name':_0x33f770['fieldName'],'type':_0x33f770['type'][_0xf5d6('0x2b')]};});_0x134953[_0xf5d6('0x2c')]=_[_0xf5d6('0x2d')](_0x51a386,_0xf5d6('0x27'));_0x134953[_0xf5d6('0x2e')]=_[_0xf5d6('0x2f')](_0x499b24[_0xf5d6('0x2e')]);_0x134953[_0xf5d6('0x30')]=_[_0xf5d6('0x31')](_0x134953[_0xf5d6('0x2c')],_0x134953[_0xf5d6('0x2e')]);_0x79e70[_0xf5d6('0x32')]=_['intersection'](_0x134953[_0xf5d6('0x2c')],qs[_0xf5d6('0x33')](_0x499b24['query']['fields']));_0x79e70[_0xf5d6('0x32')]=_0x79e70[_0xf5d6('0x32')][_0xf5d6('0x34')]?_0x79e70['attributes']:_0x134953[_0xf5d6('0x2c')];if(!_0x499b24['query']['hasOwnProperty'](_0xf5d6('0x35'))){_0x79e70[_0xf5d6('0x1d')]=qs[_0xf5d6('0x1d')](_0x499b24[_0xf5d6('0x2e')][_0xf5d6('0x1d')]);_0x79e70[_0xf5d6('0x1f')]=qs[_0xf5d6('0x1f')](_0x499b24[_0xf5d6('0x2e')][_0xf5d6('0x1f')]);}_0x79e70[_0xf5d6('0x36')]=qs[_0xf5d6('0x37')](_0x499b24[_0xf5d6('0x2e')][_0xf5d6('0x37')]);_0x79e70[_0xf5d6('0x38')]=qs[_0xf5d6('0x30')](_['pick'](_0x499b24['query'],_0x134953['filters']),_0x51a386);if(_0x499b24['query'][_0xf5d6('0x39')]){_0x79e70[_0xf5d6('0x38')]=_[_0xf5d6('0x3a')](_0x79e70[_0xf5d6('0x38')],{'$or':_['map'](_0x51a386,function(_0x33a3f5){if(_0x33a3f5[_0xf5d6('0x3b')]!==_0xf5d6('0x3c')){var _0x5be7e5={};_0x5be7e5[_0x33a3f5[_0xf5d6('0x27')]]={'$like':'%'+_0x499b24[_0xf5d6('0x2e')]['filter']+'%'};return _0x5be7e5;}})});}_0x79e70=_[_0xf5d6('0x3a')]({},_0x79e70,_0x499b24['options']);var _0x21191f={'where':_0x79e70['where']};return db[_0xf5d6('0x29')][_0xf5d6('0x1e')](_0x21191f)[_0xf5d6('0x23')](function(_0x47ec61){_0x225d76[_0xf5d6('0x1e')]=_0x47ec61;if(_0x499b24[_0xf5d6('0x2e')][_0xf5d6('0x3d')]){_0x79e70['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x79e70);})[_0xf5d6('0x23')](function(_0x83220c){_0x225d76['rows']=_0x83220c;return _0x225d76;})[_0xf5d6('0x23')](respondWithFilteredResult(_0x254485,_0x79e70))[_0xf5d6('0x3e')](handleError(_0x254485,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bff8652..37b3e44 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 _0x8f10=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash'];(function(_0xcfa37a,_0x3183cd){var _0x1d696c=function(_0x451dfb){while(--_0x451dfb){_0xcfa37a['push'](_0xcfa37a['shift']());}};_0x1d696c(++_0x3183cd);}(_0x8f10,0x11f));var _0x08f1=function(_0x369501,_0x3d7c15){_0x369501=_0x369501-0x0;var _0x4e7589=_0x8f10[_0x369501];return _0x4e7589;};'use strict';var _=require(_0x08f1('0x0'));var util=require('util');var logger=require(_0x08f1('0x1'))(_0x08f1('0x2'));var moment=require(_0x08f1('0x3'));var BPromise=require(_0x08f1('0x4'));var rp=require(_0x08f1('0x5'));var fs=require('fs');var path=require(_0x08f1('0x6'));var rimraf=require('rimraf');var config=require(_0x08f1('0x7'));var attributes=require(_0x08f1('0x8'));module[_0x08f1('0x9')]=function(_0x59c557,_0x4d0c8c){return _0x59c557['define'](_0x08f1('0xa'),attributes,{'tableName':_0x08f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67cd=['rimraf','../../config/environment','define','Migration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x67cd,0x17a));var _0xd67c=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x67cd[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0xd67c('0x0'));var util=require(_0xd67c('0x1'));var logger=require(_0xd67c('0x2'))(_0xd67c('0x3'));var moment=require(_0xd67c('0x4'));var BPromise=require(_0xd67c('0x5'));var rp=require(_0xd67c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd67c('0x7'));var config=require(_0xd67c('0x8'));var attributes=require('./migration.attributes');module['exports']=function(_0x2a6c7a,_0x26800c){return _0x2a6c7a[_0xd67c('0x9')](_0xd67c('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 7be5d5f..a887586 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 _0x720e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x24f2ca,_0x4e4b65){var _0x2f6646=function(_0x40aa5a){while(--_0x40aa5a){_0x24f2ca['push'](_0x24f2ca['shift']());}};_0x2f6646(++_0x4e4b65);}(_0x720e,0x1cb));var _0xe720=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0x720e[_0x40bdbc];return _0xc603a8;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe720('0x4'));var logger=require(_0xe720('0x5'))(_0xe720('0x6'));var config=require(_0xe720('0x7'));var jayson=require(_0xe720('0x8'));var client=jayson[_0xe720('0x9')][_0xe720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffe24,_0x3e38ca,_0x19642d){return new BPromise(function(_0x4e715c,_0x4a3b70){return client['request'](_0x4ffe24,_0x19642d)[_0xe720('0xb')](function(_0x2e08e7){logger[_0xe720('0xc')]('Migration,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));logger[_0xe720('0xe')](_0xe720('0xf'),_0x3e38ca,_0xe720('0xd'),JSON[_0xe720('0x10')](_0x2e08e7));if(_0x2e08e7[_0xe720('0x11')]){if(_0x2e08e7['error']['code']===0x1f4){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);return _0x4a3b70(_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);}logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')]['message']);return _0x4e715c(_0x2e08e7['error'][_0xe720('0x13')]);}else{logger[_0xe720('0xc')]('Migration,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));_0x4e715c(_0x2e08e7[_0xe720('0x14')]['message']);}})[_0xe720('0x15')](function(_0x5ac1e2){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x5ac1e2);_0x4a3b70(_0x5ac1e2);});});} \ No newline at end of file +var _0x0713=['Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\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(_0x1ba825,_0x4ad5a4){var _0x696a92=function(_0x15477c){while(--_0x15477c){_0x1ba825['push'](_0x1ba825['shift']());}};_0x696a92(++_0x4ad5a4);}(_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')]('Migration,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Migration,\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')]('Migration,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f77167b..7758da9 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 _0x1b64=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated'];(function(_0x5f0817,_0x341051){var _0x321186=function(_0x1e2626){while(--_0x1e2626){_0x5f0817['push'](_0x5f0817['shift']());}};_0x321186(++_0x341051);}(_0x1b64,0x76));var _0x41b6=function(_0xbd33ba,_0x542bb3){_0xbd33ba=_0xbd33ba-0x0;var _0x28df81=_0x1b64[_0xbd33ba];return _0x28df81;};'use strict';var multer=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var path=require('path');var timeout=require(_0x41b6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x41b6('0x3'));var interaction=require(_0x41b6('0x4'));var config=require(_0x41b6('0x5'));var controller=require(_0x41b6('0x6'));router['get']('/',auth[_0x41b6('0x7')](),controller[_0x41b6('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x41b6('0x9')]);router[_0x41b6('0xa')]('/',auth[_0x41b6('0x7')](),controller[_0x41b6('0xb')]);router[_0x41b6('0xc')](_0x41b6('0xd'),auth['isAuthenticated'](),controller[_0x41b6('0xe')]);router[_0x41b6('0xf')](_0x41b6('0xd'),auth[_0x41b6('0x7')](),controller[_0x41b6('0x10')]);module[_0x41b6('0x11')]=router; \ No newline at end of file +var _0xa428=['/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x3f58f1,_0x81d0cb){var _0x39ed75=function(_0x51318b){while(--_0x51318b){_0x3f58f1['push'](_0x3f58f1['shift']());}};_0x39ed75(++_0x81d0cb);}(_0xa428,0xd8));var _0x8a42=function(_0x11220b,_0x5d76d9){_0x11220b=_0x11220b-0x0;var _0x55b881=_0xa428[_0x11220b];return _0x55b881;};'use strict';var multer=require(_0x8a42('0x0'));var util=require('util');var path=require(_0x8a42('0x1'));var timeout=require(_0x8a42('0x2'));var express=require(_0x8a42('0x3'));var router=express[_0x8a42('0x4')]();var fs_extra=require(_0x8a42('0x5'));var auth=require(_0x8a42('0x6'));var interaction=require(_0x8a42('0x7'));var config=require('../../config/environment');var controller=require(_0x8a42('0x8'));router[_0x8a42('0x9')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xb')]);router['get'](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['show']);router[_0x8a42('0xd')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xe')]);router[_0x8a42('0xf')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller[_0x8a42('0x10')]);router[_0x8a42('0x11')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['destroy']);module[_0x8a42('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6204801..d2fe9f0 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 _0xbf72=['turn','STRING','sequelize','ENUM','stun'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0xbf72,0xe8));var _0x2bf7=function(_0x2492c3,_0x58f945){_0x2492c3=_0x2492c3-0x0;var _0x3c5a98=_0xbf72[_0x2492c3];return _0x3c5a98;};'use strict';var Sequelize=require(_0x2bf7('0x0'));module['exports']={'type':{'type':Sequelize[_0x2bf7('0x1')]('localnet','externip',_0x2bf7('0x2'),_0x2bf7('0x3'))},'value':{'type':Sequelize[_0x2bf7('0x4')]},'username':{'type':Sequelize[_0x2bf7('0x4')]},'password':{'type':Sequelize[_0x2bf7('0x4')]}}; \ No newline at end of file +var _0x9b8c=['localnet','externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0x9b8c,0x85));var _0xc9b8=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x9b8c[_0x1a72b8];return _0x39f72d;};'use strict';var Sequelize=require(_0xc9b8('0x0'));module[_0xc9b8('0x1')]={'type':{'type':Sequelize[_0xc9b8('0x2')](_0xc9b8('0x3'),_0xc9b8('0x4'),_0xc9b8('0x5'),_0xc9b8('0x6'))},'value':{'type':Sequelize[_0xc9b8('0x7')]},'username':{'type':Sequelize[_0xc9b8('0x7')]},'password':{'type':Sequelize[_0xc9b8('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 314a2a7..1a562bc 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 _0xfc08=['error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','index','Network','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','show','params','length','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/network.ejs','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/turn_multiple.ejs','path','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22658d,_0x328f29){var _0x49a56b=function(_0x27b3a7){while(--_0x27b3a7){_0x22658d['push'](_0x22658d['shift']());}};_0x49a56b(++_0x328f29);}(_0xfc08,0xeb));var _0x8fc0=function(_0x169f36,_0x2c4cff){_0x169f36=_0x169f36-0x0;var _0x435bcd=_0xfc08[_0x169f36];return _0x435bcd;};'use strict';var util=require('util');var path=require(_0x8fc0('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8fc0('0x1'));var qs=require(_0x8fc0('0x2'));var logger=require('../../config/logger')(_0x8fc0('0x3'));var config=require(_0x8fc0('0x4'));var db=require(_0x8fc0('0x5'))['db'];var jayson=require(_0x8fc0('0x6'));var client=jayson[_0x8fc0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a17b,_0x372e9d,_0x3b59c6,_0x56a3b1){return new Promise(function(_0x1ac39c,_0x5d1b7a){var _0x3142f1=_0x56a3b1||client;return _0x3142f1['request'](_0x17a17b,_0x3b59c6)[_0x8fc0('0x8')](function(_0x58a8e7){logger['info'](_0x8fc0('0x9'),_0x372e9d,_0x8fc0('0xa'));logger[_0x8fc0('0xb')](_0x8fc0('0xc'),_0x372e9d,_0x8fc0('0xa'),JSON[_0x8fc0('0xd')](_0x58a8e7));if(_0x58a8e7['error']){if(_0x58a8e7[_0x8fc0('0xe')][_0x8fc0('0xf')]===0x1f4){logger[_0x8fc0('0xe')](_0x8fc0('0x9'),_0x372e9d,_0x58a8e7[_0x8fc0('0xe')][_0x8fc0('0x10')]);return _0x5d1b7a(_0x58a8e7[_0x8fc0('0xe')]['message']);}logger['error'](_0x8fc0('0x9'),_0x372e9d,_0x58a8e7[_0x8fc0('0xe')][_0x8fc0('0x10')]);return _0x1ac39c(_0x58a8e7['error'][_0x8fc0('0x10')]);}else{logger['info'](_0x8fc0('0x9'),_0x372e9d,_0x8fc0('0xa'));_0x1ac39c(_0x58a8e7[_0x8fc0('0x11')][_0x8fc0('0x10')]);}})[_0x8fc0('0x12')](function(_0x5b13c7){logger[_0x8fc0('0xe')](_0x8fc0('0x9'),_0x372e9d,_0x5b13c7);_0x5d1b7a(_0x5b13c7);});});}function respondWithResult(_0x4dfe3a,_0x1fdd30){_0x1fdd30=_0x1fdd30||0xc8;return function(_0x30f722){if(_0x30f722){return _0x4dfe3a[_0x8fc0('0x13')](_0x1fdd30)[_0x8fc0('0x14')](_0x30f722);}};}function respondWithFilteredResult(_0xc3d43e,_0x3ec385){return function(_0x55d0e5){if(_0x55d0e5){var _0x3c047a=typeof _0x3ec385[_0x8fc0('0x15')]===_0x8fc0('0x16')&&typeof _0x3ec385[_0x8fc0('0x17')]===_0x8fc0('0x16');var _0x1aa209=_0x55d0e5[_0x8fc0('0x18')];var _0x4b7e71=_0x3c047a?0x0:_0x3ec385[_0x8fc0('0x15')];var _0x57af38=_0x3c047a?_0x55d0e5[_0x8fc0('0x18')]:_0x3ec385[_0x8fc0('0x15')]+_0x3ec385[_0x8fc0('0x17')];var _0x366aa2;if(_0x57af38>=_0x1aa209){_0x57af38=_0x1aa209;_0x366aa2=0xc8;}else{_0x366aa2=0xce;}_0xc3d43e[_0x8fc0('0x13')](_0x366aa2);return _0xc3d43e[_0x8fc0('0x19')](_0x8fc0('0x1a'),_0x4b7e71+'-'+_0x57af38+'/'+_0x1aa209)[_0x8fc0('0x14')](_0x55d0e5);}return null;};}function saveUpdates(_0x3654e0){return function(_0xa052b4){if(_0xa052b4){return _0xa052b4[_0x8fc0('0x1b')](_0x3654e0)[_0x8fc0('0x8')](function(_0x5cf086){return _0x5cf086;});}return null;};}function removeEntity(_0x27062b){return function(_0x1b8de6){if(_0x1b8de6){return _0x1b8de6[_0x8fc0('0x1c')]()[_0x8fc0('0x8')](function(){_0x27062b['status'](0xcc)[_0x8fc0('0x1d')]();});}};}function handleEntityNotFound(_0xdbde73){return function(_0x2c0ad4){if(!_0x2c0ad4){_0xdbde73[_0x8fc0('0x1e')](0x194);}return _0x2c0ad4;};}function handleError(_0x102a9d,_0x4286d8){_0x4286d8=_0x4286d8||0x1f4;return function(_0x2198bb){logger[_0x8fc0('0xe')](_0x2198bb['stack']);if(_0x2198bb[_0x8fc0('0x1f')]){delete _0x2198bb['name'];}_0x102a9d[_0x8fc0('0x13')](_0x4286d8)['send'](_0x2198bb);};}exports[_0x8fc0('0x20')]=function(_0x109992,_0x51ab5d){var _0xc1617f={},_0x42e839={},_0x4b72be={'count':0x0,'rows':[]};var _0x82be92=_['map'](db[_0x8fc0('0x21')][_0x8fc0('0x22')],function(_0x11ddfd){return{'name':_0x11ddfd[_0x8fc0('0x23')],'type':_0x11ddfd[_0x8fc0('0x24')][_0x8fc0('0x25')]};});_0x42e839[_0x8fc0('0x26')]=_[_0x8fc0('0x27')](_0x82be92,'name');_0x42e839['query']=_[_0x8fc0('0x28')](_0x109992[_0x8fc0('0x29')]);_0x42e839['filters']=_[_0x8fc0('0x2a')](_0x42e839['model'],_0x42e839['query']);_0xc1617f['attributes']=_['intersection'](_0x42e839[_0x8fc0('0x26')],qs[_0x8fc0('0x2b')](_0x109992[_0x8fc0('0x29')][_0x8fc0('0x2b')]));_0xc1617f[_0x8fc0('0x2c')]=_0xc1617f['attributes']['length']?_0xc1617f[_0x8fc0('0x2c')]:_0x42e839[_0x8fc0('0x26')];if(!_0x109992['query'][_0x8fc0('0x2d')](_0x8fc0('0x2e'))){_0xc1617f[_0x8fc0('0x17')]=qs[_0x8fc0('0x17')](_0x109992[_0x8fc0('0x29')][_0x8fc0('0x17')]);_0xc1617f['offset']=qs[_0x8fc0('0x15')](_0x109992['query'][_0x8fc0('0x15')]);}_0xc1617f[_0x8fc0('0x2f')]=qs['sort'](_0x109992[_0x8fc0('0x29')][_0x8fc0('0x30')]);_0xc1617f['where']=qs['filters'](_['pick'](_0x109992[_0x8fc0('0x29')],_0x42e839[_0x8fc0('0x31')]),_0x82be92);if(_0x109992[_0x8fc0('0x29')][_0x8fc0('0x32')]){_0xc1617f[_0x8fc0('0x33')]=_['merge'](_0xc1617f[_0x8fc0('0x33')],{'$or':_[_0x8fc0('0x27')](_0x82be92,function(_0x42f9da){if(_0x42f9da[_0x8fc0('0x24')]!=='VIRTUAL'){var _0xe5d1b3={};_0xe5d1b3[_0x42f9da[_0x8fc0('0x1f')]]={'$like':'%'+_0x109992['query'][_0x8fc0('0x32')]+'%'};return _0xe5d1b3;}})});}_0xc1617f=_[_0x8fc0('0x34')]({},_0xc1617f,_0x109992[_0x8fc0('0x35')]);var _0x19d847={'where':_0xc1617f[_0x8fc0('0x33')]};return db['Network']['count'](_0x19d847)[_0x8fc0('0x8')](function(_0x2b802f){_0x4b72be[_0x8fc0('0x18')]=_0x2b802f;if(_0x109992[_0x8fc0('0x29')][_0x8fc0('0x36')]){_0xc1617f[_0x8fc0('0x37')]=[{'all':!![]}];}return db['Network'][_0x8fc0('0x38')](_0xc1617f);})['then'](function(_0x4e8970){_0x4b72be['rows']=_0x4e8970;return _0x4b72be;})[_0x8fc0('0x8')](respondWithFilteredResult(_0x51ab5d,_0xc1617f))[_0x8fc0('0x12')](handleError(_0x51ab5d,null));};exports[_0x8fc0('0x39')]=function(_0x211668,_0x81ae7){var _0x2d690c={'raw':!![],'where':{'id':_0x211668[_0x8fc0('0x3a')]['id']}},_0x39efff={};_0x39efff[_0x8fc0('0x26')]=_[_0x8fc0('0x28')](db[_0x8fc0('0x21')]['rawAttributes']);_0x39efff['query']=_['keys'](_0x211668[_0x8fc0('0x29')]);_0x39efff[_0x8fc0('0x31')]=_['intersection'](_0x39efff[_0x8fc0('0x26')],_0x39efff[_0x8fc0('0x29')]);_0x2d690c[_0x8fc0('0x2c')]=_['intersection'](_0x39efff[_0x8fc0('0x26')],qs['fields'](_0x211668[_0x8fc0('0x29')]['fields']));_0x2d690c['attributes']=_0x2d690c[_0x8fc0('0x2c')][_0x8fc0('0x3b')]?_0x2d690c[_0x8fc0('0x2c')]:_0x39efff[_0x8fc0('0x26')];if(_0x211668['query'][_0x8fc0('0x36')]){_0x2d690c['include']=[{'all':!![]}];}_0x2d690c=_[_0x8fc0('0x34')]({},_0x2d690c,_0x211668[_0x8fc0('0x35')]);return db[_0x8fc0('0x21')][_0x8fc0('0x3c')](_0x2d690c)[_0x8fc0('0x8')](handleEntityNotFound(_0x81ae7,null))[_0x8fc0('0x8')](respondWithResult(_0x81ae7,null))[_0x8fc0('0x12')](handleError(_0x81ae7,null));};exports[_0x8fc0('0x3d')]=function(_0x416f48,_0x468a45){var _0x490cd7;return db['Network'][_0x8fc0('0x3d')](_0x416f48[_0x8fc0('0x3e')],{'raw':!![]})[_0x8fc0('0x8')](function(_0x8509fe){_0x490cd7=_0x8509fe;return db[_0x8fc0('0x21')]['findAll']({'where':{'type':_0x416f48[_0x8fc0('0x3e')][_0x8fc0('0x24')]},'raw':!![]});})[_0x8fc0('0x8')](function(_0x146b29){if(_0x490cd7[_0x8fc0('0x24')][_0x8fc0('0x3f')]()==_0x8fc0('0x40')){var _0x146c07=fs['readFileSync'](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],_0x8fc0('0x43')),_0x8fc0('0x44'));var _0xbf73a7=ejs[_0x8fc0('0x45')](_0x146c07,{'networks':_0x146b29||[]});fs[_0x8fc0('0x46')](_0x8fc0('0x47'),_0xbf73a7);return respondWithRpcPromise(_0x8fc0('0x48'),_0x8fc0('0x3d'),{'module':_0x8fc0('0x49')});}else if(_0x490cd7[_0x8fc0('0x24')][_0x8fc0('0x3f')]()==_0x8fc0('0x4a')){var _0x1f812a=fs['readFileSync'](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],'server/files/templates/turn_multiple.ejs'),_0x8fc0('0x44'));var _0x418c9e=ejs[_0x8fc0('0x45')](_0x1f812a,{'networks':_0x146b29||[]});fs[_0x8fc0('0x46')]('/etc/asterisk/turn_xcally.conf',_0x418c9e);return respondWithRpcPromise(_0x8fc0('0x48'),_0x8fc0('0x3d'),{'module':_0x8fc0('0x49')});}else{var _0x3f1c2f=fs[_0x8fc0('0x4b')](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],_0x8fc0('0x4c')),_0x8fc0('0x44'));var _0x4af98d=ejs[_0x8fc0('0x45')](_0x3f1c2f,{'networks':_0x146b29||[]});fs[_0x8fc0('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x416f48[_0x8fc0('0x3e')]['type'][_0x8fc0('0x4d')]()),_0x4af98d);return respondWithRpcPromise(_0x8fc0('0x48'),_0x8fc0('0x3d'),{'module':_0x8fc0('0x4e')});}})[_0x8fc0('0x8')](function(){return _0x490cd7;})[_0x8fc0('0x8')](respondWithResult(_0x468a45,0xc9))['catch'](handleError(_0x468a45,null));};exports[_0x8fc0('0x1b')]=function(_0x1a20a0,_0x57ab1b){var _0x5bbce6;return db[_0x8fc0('0x21')][_0x8fc0('0x3c')]({'where':{'id':_0x1a20a0[_0x8fc0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x57ab1b,null))[_0x8fc0('0x8')](saveUpdates(_0x1a20a0[_0x8fc0('0x3e')],null))['then'](function(_0x289b63){if(_0x289b63){_0x5bbce6=_0x289b63;return db[_0x8fc0('0x21')]['findAll']({'where':{'type':_0x5bbce6['type']},'raw':!![]});}return null;})['then'](function(_0x4e6ea7){if(_0x5bbce6[_0x8fc0('0x24')][_0x8fc0('0x3f')]()==_0x8fc0('0x40')){var _0x20222f=fs[_0x8fc0('0x4b')](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],_0x8fc0('0x43')),_0x8fc0('0x44'));var _0x26feed=ejs[_0x8fc0('0x45')](_0x20222f,{'networks':_0x4e6ea7||[]});fs['writeFileSync'](_0x8fc0('0x47'),_0x26feed);return respondWithRpcPromise(_0x8fc0('0x48'),'update',{'module':_0x8fc0('0x49')});}else if(_0x5bbce6[_0x8fc0('0x24')][_0x8fc0('0x3f')]()==_0x8fc0('0x4a')){var _0x55bfae=fs[_0x8fc0('0x4b')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x173e59=ejs[_0x8fc0('0x45')](_0x55bfae,{'networks':_0x4e6ea7||[]});fs[_0x8fc0('0x46')](_0x8fc0('0x4f'),_0x173e59);return respondWithRpcPromise(_0x8fc0('0x48'),_0x8fc0('0x1b'),{'module':_0x8fc0('0x49')});}else{var _0x2010fe=fs[_0x8fc0('0x4b')](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],'server/files/templates/network.ejs'),_0x8fc0('0x44'));var _0x3b023e=ejs['render'](_0x2010fe,{'networks':_0x4e6ea7||[]});fs[_0x8fc0('0x46')](util[_0x8fc0('0x50')](_0x8fc0('0x51'),_0x1a20a0[_0x8fc0('0x3e')][_0x8fc0('0x24')][_0x8fc0('0x4d')]()),_0x3b023e);return respondWithRpcPromise(_0x8fc0('0x48'),'update',{'module':_0x8fc0('0x4e')});}})[_0x8fc0('0x8')](function(_0x3bffaf){if(_0x3bffaf){return _0x5bbce6;}return null;})[_0x8fc0('0x8')](respondWithResult(_0x57ab1b,null))[_0x8fc0('0x12')](handleError(_0x57ab1b,null));};exports[_0x8fc0('0x1c')]=function(_0x1e6681,_0x3a0d06){var _0x333ad8;return db[_0x8fc0('0x21')]['find']({'where':{'id':_0x1e6681['params']['id']}})['then'](function(_0x17761b){_0x333ad8=_0x17761b;return _0x17761b;})[_0x8fc0('0x8')](handleEntityNotFound(_0x3a0d06,null))['then'](removeEntity(_0x3a0d06,null))['then'](function(){if(_0x333ad8){return db[_0x8fc0('0x21')][_0x8fc0('0x38')]({'where':{'type':_0x333ad8[_0x8fc0('0x24')]},'raw':!![]});}})['then'](function(_0x588ab4){if(_0x333ad8[_0x8fc0('0x24')]['toUpperCase']()==_0x8fc0('0x40')){var _0x53b137=fs['readFileSync'](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],_0x8fc0('0x43')),_0x8fc0('0x44'));var _0x14c2cf=ejs['render'](_0x53b137,{'networks':_0x588ab4||[]});fs['writeFileSync'](_0x8fc0('0x47'),_0x14c2cf);return respondWithRpcPromise('Reload',_0x8fc0('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x333ad8[_0x8fc0('0x24')]['toUpperCase']()==_0x8fc0('0x4a')){var _0x1830cd=fs['readFileSync'](path[_0x8fc0('0x41')](config[_0x8fc0('0x42')],_0x8fc0('0x52')),_0x8fc0('0x44'));var _0x55db1=ejs[_0x8fc0('0x45')](_0x1830cd,{'networks':_0x588ab4||[]});fs[_0x8fc0('0x46')](_0x8fc0('0x4f'),_0x55db1);return respondWithRpcPromise(_0x8fc0('0x48'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x4cefdb=fs[_0x8fc0('0x4b')](path['join'](config[_0x8fc0('0x42')],_0x8fc0('0x4c')),'utf8');var _0x270b4d=ejs[_0x8fc0('0x45')](_0x4cefdb,{'networks':_0x588ab4||[]});fs[_0x8fc0('0x46')](util[_0x8fc0('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x333ad8[_0x8fc0('0x24')][_0x8fc0('0x4d')]()),_0x270b4d);return respondWithRpcPromise(_0x8fc0('0x48'),_0x8fc0('0x1c'),{'module':_0x8fc0('0x4e')});}})[_0x8fc0('0x12')](handleError(_0x3a0d06,null));}; \ No newline at end of file +var _0x8c3f=['join','root','server/files/templates/stun_multiple.ejs','utf8','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','toUpperCase','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','chan_sip.so','util','ejs','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','json','offset','undefined','limit','count','status','Content-Range','update','destroy','end','sendStatus','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','STUN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c3f,0x1b2));var _0xf8c3=function(_0x338db3,_0x443480){_0x338db3=_0x338db3-0x0;var _0x169184=_0x8c3f[_0x338db3];return _0x169184;};'use strict';var util=require(_0xf8c3('0x0'));var path=require('path');var ejs=require(_0xf8c3('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0xf8c3('0x2'));var logger=require('../../config/logger')(_0xf8c3('0x3'));var config=require(_0xf8c3('0x4'));var db=require(_0xf8c3('0x5'))['db'];var jayson=require(_0xf8c3('0x6'));var client=jayson[_0xf8c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb6d0cf,_0x585ae4,_0x16de1d,_0x390f13){return new Promise(function(_0x1ab90d,_0x1a7fe6){var _0x54dd70=_0x390f13||client;return _0x54dd70[_0xf8c3('0x8')](_0xb6d0cf,_0x16de1d)[_0xf8c3('0x9')](function(_0x102503){logger['info'](_0xf8c3('0xa'),_0x585ae4,_0xf8c3('0xb'));logger[_0xf8c3('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x585ae4,'request\x20sent',JSON[_0xf8c3('0xd')](_0x102503));if(_0x102503[_0xf8c3('0xe')]){if(_0x102503[_0xf8c3('0xe')][_0xf8c3('0xf')]===0x1f4){logger[_0xf8c3('0xe')]('Network,\x20%s,\x20%s',_0x585ae4,_0x102503['error'][_0xf8c3('0x10')]);return _0x1a7fe6(_0x102503[_0xf8c3('0xe')][_0xf8c3('0x10')]);}logger[_0xf8c3('0xe')](_0xf8c3('0xa'),_0x585ae4,_0x102503[_0xf8c3('0xe')][_0xf8c3('0x10')]);return _0x1ab90d(_0x102503[_0xf8c3('0xe')]['message']);}else{logger[_0xf8c3('0x11')]('Network,\x20%s,\x20%s',_0x585ae4,_0xf8c3('0xb'));_0x1ab90d(_0x102503[_0xf8c3('0x12')][_0xf8c3('0x10')]);}})[_0xf8c3('0x13')](function(_0x3b501b){logger['error']('Network,\x20%s,\x20%s',_0x585ae4,_0x3b501b);_0x1a7fe6(_0x3b501b);});});}function respondWithResult(_0x3c0008,_0x225a36){_0x225a36=_0x225a36||0xc8;return function(_0xcb79a4){if(_0xcb79a4){return _0x3c0008['status'](_0x225a36)[_0xf8c3('0x14')](_0xcb79a4);}};}function respondWithFilteredResult(_0x2882af,_0x42b51f){return function(_0x2e2cf2){if(_0x2e2cf2){var _0x23c02a=typeof _0x42b51f[_0xf8c3('0x15')]===_0xf8c3('0x16')&&typeof _0x42b51f[_0xf8c3('0x17')]===_0xf8c3('0x16');var _0x579e59=_0x2e2cf2['count'];var _0x3b1702=_0x23c02a?0x0:_0x42b51f[_0xf8c3('0x15')];var _0x5596d0=_0x23c02a?_0x2e2cf2[_0xf8c3('0x18')]:_0x42b51f[_0xf8c3('0x15')]+_0x42b51f[_0xf8c3('0x17')];var _0x559f3d;if(_0x5596d0>=_0x579e59){_0x5596d0=_0x579e59;_0x559f3d=0xc8;}else{_0x559f3d=0xce;}_0x2882af[_0xf8c3('0x19')](_0x559f3d);return _0x2882af['set'](_0xf8c3('0x1a'),_0x3b1702+'-'+_0x5596d0+'/'+_0x579e59)[_0xf8c3('0x14')](_0x2e2cf2);}return null;};}function saveUpdates(_0x1d512b){return function(_0x5722b0){if(_0x5722b0){return _0x5722b0[_0xf8c3('0x1b')](_0x1d512b)[_0xf8c3('0x9')](function(_0x3e5ef7){return _0x3e5ef7;});}return null;};}function removeEntity(_0x3f53ac){return function(_0x282443){if(_0x282443){return _0x282443[_0xf8c3('0x1c')]()[_0xf8c3('0x9')](function(){_0x3f53ac[_0xf8c3('0x19')](0xcc)[_0xf8c3('0x1d')]();});}};}function handleEntityNotFound(_0x112175){return function(_0x582440){if(!_0x582440){_0x112175[_0xf8c3('0x1e')](0x194);}return _0x582440;};}function handleError(_0xbc703b,_0x3ff315){_0x3ff315=_0x3ff315||0x1f4;return function(_0x288f47){logger['error'](_0x288f47['stack']);if(_0x288f47[_0xf8c3('0x1f')]){delete _0x288f47[_0xf8c3('0x1f')];}_0xbc703b[_0xf8c3('0x19')](_0x3ff315)[_0xf8c3('0x20')](_0x288f47);};}exports['index']=function(_0x3245db,_0x472a9b){var _0x1529e9={},_0x1a3f40={},_0x4069f6={'count':0x0,'rows':[]};var _0x53c162=_[_0xf8c3('0x21')](db[_0xf8c3('0x22')][_0xf8c3('0x23')],function(_0x259221){return{'name':_0x259221[_0xf8c3('0x24')],'type':_0x259221[_0xf8c3('0x25')][_0xf8c3('0x26')]};});_0x1a3f40[_0xf8c3('0x27')]=_[_0xf8c3('0x21')](_0x53c162,_0xf8c3('0x1f'));_0x1a3f40[_0xf8c3('0x28')]=_[_0xf8c3('0x29')](_0x3245db[_0xf8c3('0x28')]);_0x1a3f40[_0xf8c3('0x2a')]=_[_0xf8c3('0x2b')](_0x1a3f40[_0xf8c3('0x27')],_0x1a3f40[_0xf8c3('0x28')]);_0x1529e9['attributes']=_[_0xf8c3('0x2b')](_0x1a3f40[_0xf8c3('0x27')],qs['fields'](_0x3245db['query'][_0xf8c3('0x2c')]));_0x1529e9[_0xf8c3('0x2d')]=_0x1529e9[_0xf8c3('0x2d')][_0xf8c3('0x2e')]?_0x1529e9[_0xf8c3('0x2d')]:_0x1a3f40[_0xf8c3('0x27')];if(!_0x3245db['query']['hasOwnProperty'](_0xf8c3('0x2f'))){_0x1529e9[_0xf8c3('0x17')]=qs['limit'](_0x3245db[_0xf8c3('0x28')][_0xf8c3('0x17')]);_0x1529e9[_0xf8c3('0x15')]=qs['offset'](_0x3245db['query'][_0xf8c3('0x15')]);}_0x1529e9['order']=qs[_0xf8c3('0x30')](_0x3245db[_0xf8c3('0x28')][_0xf8c3('0x30')]);_0x1529e9[_0xf8c3('0x31')]=qs[_0xf8c3('0x2a')](_[_0xf8c3('0x32')](_0x3245db[_0xf8c3('0x28')],_0x1a3f40[_0xf8c3('0x2a')]),_0x53c162);if(_0x3245db[_0xf8c3('0x28')]['filter']){_0x1529e9[_0xf8c3('0x31')]=_[_0xf8c3('0x33')](_0x1529e9[_0xf8c3('0x31')],{'$or':_['map'](_0x53c162,function(_0x55a467){if(_0x55a467[_0xf8c3('0x25')]!=='VIRTUAL'){var _0x3badec={};_0x3badec[_0x55a467[_0xf8c3('0x1f')]]={'$like':'%'+_0x3245db[_0xf8c3('0x28')][_0xf8c3('0x34')]+'%'};return _0x3badec;}})});}_0x1529e9=_['merge']({},_0x1529e9,_0x3245db[_0xf8c3('0x35')]);var _0x48be35={'where':_0x1529e9[_0xf8c3('0x31')]};return db[_0xf8c3('0x22')]['count'](_0x48be35)[_0xf8c3('0x9')](function(_0x360795){_0x4069f6[_0xf8c3('0x18')]=_0x360795;if(_0x3245db[_0xf8c3('0x28')][_0xf8c3('0x36')]){_0x1529e9[_0xf8c3('0x37')]=[{'all':!![]}];}return db[_0xf8c3('0x22')][_0xf8c3('0x38')](_0x1529e9);})[_0xf8c3('0x9')](function(_0x33d32d){_0x4069f6[_0xf8c3('0x39')]=_0x33d32d;return _0x4069f6;})[_0xf8c3('0x9')](respondWithFilteredResult(_0x472a9b,_0x1529e9))[_0xf8c3('0x13')](handleError(_0x472a9b,null));};exports[_0xf8c3('0x3a')]=function(_0x698e06,_0x1b27af){var _0xf24222={'raw':!![],'where':{'id':_0x698e06[_0xf8c3('0x3b')]['id']}},_0x390545={};_0x390545[_0xf8c3('0x27')]=_[_0xf8c3('0x29')](db[_0xf8c3('0x22')]['rawAttributes']);_0x390545['query']=_[_0xf8c3('0x29')](_0x698e06['query']);_0x390545[_0xf8c3('0x2a')]=_[_0xf8c3('0x2b')](_0x390545[_0xf8c3('0x27')],_0x390545[_0xf8c3('0x28')]);_0xf24222[_0xf8c3('0x2d')]=_[_0xf8c3('0x2b')](_0x390545[_0xf8c3('0x27')],qs[_0xf8c3('0x2c')](_0x698e06[_0xf8c3('0x28')][_0xf8c3('0x2c')]));_0xf24222[_0xf8c3('0x2d')]=_0xf24222['attributes'][_0xf8c3('0x2e')]?_0xf24222['attributes']:_0x390545['model'];if(_0x698e06[_0xf8c3('0x28')][_0xf8c3('0x36')]){_0xf24222['include']=[{'all':!![]}];}_0xf24222=_[_0xf8c3('0x33')]({},_0xf24222,_0x698e06[_0xf8c3('0x35')]);return db[_0xf8c3('0x22')][_0xf8c3('0x3c')](_0xf24222)[_0xf8c3('0x9')](handleEntityNotFound(_0x1b27af,null))[_0xf8c3('0x9')](respondWithResult(_0x1b27af,null))[_0xf8c3('0x13')](handleError(_0x1b27af,null));};exports[_0xf8c3('0x3d')]=function(_0x1f8b26,_0x14359f){var _0xbd52ee;return db['Network'][_0xf8c3('0x3d')](_0x1f8b26['body'],{'raw':!![]})[_0xf8c3('0x9')](function(_0x9e3a1c){_0xbd52ee=_0x9e3a1c;return db[_0xf8c3('0x22')][_0xf8c3('0x38')]({'where':{'type':_0x1f8b26[_0xf8c3('0x3e')][_0xf8c3('0x25')]},'raw':!![]});})[_0xf8c3('0x9')](function(_0x4f235f){if(_0xbd52ee['type']['toUpperCase']()==_0xf8c3('0x3f')){var _0x51ee92=fs['readFileSync'](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],_0xf8c3('0x42')),_0xf8c3('0x43'));var _0x417fe4=ejs['render'](_0x51ee92,{'networks':_0x4f235f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x417fe4);return respondWithRpcPromise(_0xf8c3('0x44'),'create',{'module':_0xf8c3('0x45')});}else if(_0xbd52ee[_0xf8c3('0x25')]['toUpperCase']()==_0xf8c3('0x46')){var _0x574a49=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],_0xf8c3('0x48')),_0xf8c3('0x43'));var _0x3f46b5=ejs['render'](_0x574a49,{'networks':_0x4f235f||[]});fs[_0xf8c3('0x49')]('/etc/asterisk/turn_xcally.conf',_0x3f46b5);return respondWithRpcPromise('Reload',_0xf8c3('0x3d'),{'module':'res_stun_monitor.so'});}else{var _0xa4a72=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],_0xf8c3('0x4a')),_0xf8c3('0x43'));var _0x47700d=ejs[_0xf8c3('0x4b')](_0xa4a72,{'networks':_0x4f235f||[]});fs[_0xf8c3('0x49')](util[_0xf8c3('0x4c')](_0xf8c3('0x4d'),_0x1f8b26[_0xf8c3('0x3e')]['type'][_0xf8c3('0x4e')]()),_0x47700d);return respondWithRpcPromise(_0xf8c3('0x44'),_0xf8c3('0x3d'),{'module':'chan_sip.so'});}})['then'](function(){return _0xbd52ee;})[_0xf8c3('0x9')](respondWithResult(_0x14359f,0xc9))[_0xf8c3('0x13')](handleError(_0x14359f,null));};exports[_0xf8c3('0x1b')]=function(_0x12004d,_0x30ee73){var _0x52e242;return db['Network'][_0xf8c3('0x3c')]({'where':{'id':_0x12004d[_0xf8c3('0x3b')]['id']}})[_0xf8c3('0x9')](handleEntityNotFound(_0x30ee73,null))[_0xf8c3('0x9')](saveUpdates(_0x12004d[_0xf8c3('0x3e')],null))[_0xf8c3('0x9')](function(_0x31447b){if(_0x31447b){_0x52e242=_0x31447b;return db['Network'][_0xf8c3('0x38')]({'where':{'type':_0x52e242[_0xf8c3('0x25')]},'raw':!![]});}return null;})[_0xf8c3('0x9')](function(_0x29e512){if(_0x52e242[_0xf8c3('0x25')][_0xf8c3('0x4f')]()==_0xf8c3('0x3f')){var _0x2bcbea=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],'server/files/templates/stun_multiple.ejs'),_0xf8c3('0x43'));var _0x501fff=ejs[_0xf8c3('0x4b')](_0x2bcbea,{'networks':_0x29e512||[]});fs['writeFileSync'](_0xf8c3('0x50'),_0x501fff);return respondWithRpcPromise(_0xf8c3('0x44'),_0xf8c3('0x1b'),{'module':_0xf8c3('0x45')});}else if(_0x52e242[_0xf8c3('0x25')][_0xf8c3('0x4f')]()==_0xf8c3('0x46')){var _0x1370b8=fs[_0xf8c3('0x47')](path['join'](config['root'],_0xf8c3('0x48')),_0xf8c3('0x43'));var _0xf6589=ejs[_0xf8c3('0x4b')](_0x1370b8,{'networks':_0x29e512||[]});fs[_0xf8c3('0x49')](_0xf8c3('0x51'),_0xf6589);return respondWithRpcPromise(_0xf8c3('0x44'),_0xf8c3('0x1b'),{'module':_0xf8c3('0x45')});}else{var _0x542e99=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],'server/files/templates/network.ejs'),_0xf8c3('0x43'));var _0x1de09f=ejs[_0xf8c3('0x4b')](_0x542e99,{'networks':_0x29e512||[]});fs[_0xf8c3('0x49')](util[_0xf8c3('0x4c')](_0xf8c3('0x4d'),_0x12004d[_0xf8c3('0x3e')]['type'][_0xf8c3('0x4e')]()),_0x1de09f);return respondWithRpcPromise(_0xf8c3('0x44'),_0xf8c3('0x1b'),{'module':_0xf8c3('0x52')});}})[_0xf8c3('0x9')](function(_0x4a0e34){if(_0x4a0e34){return _0x52e242;}return null;})[_0xf8c3('0x9')](respondWithResult(_0x30ee73,null))[_0xf8c3('0x13')](handleError(_0x30ee73,null));};exports['destroy']=function(_0x559d41,_0x3d9ca2){var _0x3ed872;return db[_0xf8c3('0x22')][_0xf8c3('0x3c')]({'where':{'id':_0x559d41['params']['id']}})['then'](function(_0xcbebdd){_0x3ed872=_0xcbebdd;return _0xcbebdd;})[_0xf8c3('0x9')](handleEntityNotFound(_0x3d9ca2,null))[_0xf8c3('0x9')](removeEntity(_0x3d9ca2,null))[_0xf8c3('0x9')](function(){if(_0x3ed872){return db[_0xf8c3('0x22')][_0xf8c3('0x38')]({'where':{'type':_0x3ed872['type']},'raw':!![]});}})[_0xf8c3('0x9')](function(_0x4e9be7){if(_0x3ed872[_0xf8c3('0x25')][_0xf8c3('0x4f')]()==_0xf8c3('0x3f')){var _0x5093d6=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config[_0xf8c3('0x41')],_0xf8c3('0x42')),_0xf8c3('0x43'));var _0x3e7acb=ejs[_0xf8c3('0x4b')](_0x5093d6,{'networks':_0x4e9be7||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x3e7acb);return respondWithRpcPromise(_0xf8c3('0x44'),'destroy',{'module':_0xf8c3('0x45')});}else if(_0x3ed872[_0xf8c3('0x25')][_0xf8c3('0x4f')]()==_0xf8c3('0x46')){var _0xaf06ca=fs[_0xf8c3('0x47')](path[_0xf8c3('0x40')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xf8c3('0x43'));var _0x530e74=ejs[_0xf8c3('0x4b')](_0xaf06ca,{'networks':_0x4e9be7||[]});fs[_0xf8c3('0x49')](_0xf8c3('0x51'),_0x530e74);return respondWithRpcPromise('Reload',_0xf8c3('0x1c'),{'module':_0xf8c3('0x45')});}else{var _0xbc1ee3=fs[_0xf8c3('0x47')](path['join'](config[_0xf8c3('0x41')],_0xf8c3('0x4a')),_0xf8c3('0x43'));var _0x21b1cc=ejs[_0xf8c3('0x4b')](_0xbc1ee3,{'networks':_0x4e9be7||[]});fs['writeFileSync'](util[_0xf8c3('0x4c')](_0xf8c3('0x4d'),_0x3ed872[_0xf8c3('0x25')][_0xf8c3('0x4e')]()),_0x21b1cc);return respondWithRpcPromise(_0xf8c3('0x44'),_0xf8c3('0x1c'),{'module':_0xf8c3('0x52')});}})[_0xf8c3('0x13')](handleError(_0x3d9ca2,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6afc925..9903a4f 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 _0x2bb0=['exports','define','Network','lodash','util','../../config/logger','moment','path','../../config/environment','./network.attributes'];(function(_0x2588b4,_0x593e97){var _0x152c8f=function(_0x4776c7){while(--_0x4776c7){_0x2588b4['push'](_0x2588b4['shift']());}};_0x152c8f(++_0x593e97);}(_0x2bb0,0xf3));var _0x02bb=function(_0x373f5d,_0x54206e){_0x373f5d=_0x373f5d-0x0;var _0x3340f4=_0x2bb0[_0x373f5d];return _0x3340f4;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));module[_0x02bb('0x7')]=function(_0x390ff7,_0x43dbb7){return _0x390ff7[_0x02bb('0x8')](_0x02bb('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75b=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','api','moment','bluebird'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0xa75b,0x170));var _0xba75=function(_0x49d7b9,_0x492367){_0x49d7b9=_0x49d7b9-0x0;var _0x1aa44c=_0xa75b[_0x49d7b9];return _0x1aa44c;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 94a87b8..9391117 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x39ffda,_0x3b627b){_0x39ffda=_0x39ffda-0x0;var _0x3005dc=_0x7a54[_0x39ffda];return _0x3005dc;};'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(_0xac6244,_0x339e81){var _0x242371=function(_0x33d12b){while(--_0x33d12b){_0xac6244['push'](_0xac6244['shift']());}};_0x242371(++_0x339e81);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 9046b07..c08b831 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 _0xc750=['addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','update','delete','removeDispositions','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc750,0x13c));var _0x0c75=function(_0x555c9b,_0x55eaaf){_0x555c9b=_0x555c9b-0x0;var _0x1e946a=_0xc750[_0x555c9b];return _0x1e946a;};'use strict';var multer=require(_0x0c75('0x0'));var util=require('util');var path=require(_0x0c75('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c75('0x2'));var router=express[_0x0c75('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c75('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c75('0x5'));var controller=require(_0x0c75('0x6'));router[_0x0c75('0x7')]('/',auth[_0x0c75('0x8')](),controller[_0x0c75('0x9')]);router[_0x0c75('0x7')](_0x0c75('0xa'),auth[_0x0c75('0x8')](),controller[_0x0c75('0xb')]);router['get'](_0x0c75('0xc'),auth[_0x0c75('0x8')](),controller[_0x0c75('0xd')]);router[_0x0c75('0x7')](_0x0c75('0xe'),auth[_0x0c75('0x8')](),controller[_0x0c75('0xf')]);router[_0x0c75('0x7')](_0x0c75('0x10'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x11')]);router[_0x0c75('0x7')](_0x0c75('0x12'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x13')]);router['get'](_0x0c75('0x14'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x15')]);router['get'](_0x0c75('0x16'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x17')]);router[_0x0c75('0x18')]('/',auth[_0x0c75('0x8')](),controller[_0x0c75('0x19')]);router['post'](_0x0c75('0xe'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x1a')]);router[_0x0c75('0x18')](_0x0c75('0x10'),auth['isAuthenticated'](),controller[_0x0c75('0x1b')]);router[_0x0c75('0x18')]('/:id/notify',controller[_0x0c75('0x1c')]);router[_0x0c75('0x18')](_0x0c75('0x12'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x1d')]);router[_0x0c75('0x18')]('/:id/users',auth[_0x0c75('0x8')](),controller[_0x0c75('0x1e')]);router[_0x0c75('0x18')](_0x0c75('0x1f'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x20')]);router[_0x0c75('0x21')](_0x0c75('0xc'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x22')]);router[_0x0c75('0x23')](_0x0c75('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x0c75('0xe'),auth[_0x0c75('0x8')](),controller[_0x0c75('0x24')]);router[_0x0c75('0x23')](_0x0c75('0x10'),auth[_0x0c75('0x8')](),controller['removeAnswers']);router[_0x0c75('0x23')](_0x0c75('0x16'),auth[_0x0c75('0x8')](),controller['removeAgents']);module[_0x0c75('0x25')]=router; \ No newline at end of file +var _0xc535=['getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','put','delete','removeAnswers','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xc535,0x12d));var _0x5c53=function(_0x255e88,_0x628bbf){_0x255e88=_0x255e88-0x0;var _0x698773=_0xc535[_0x255e88];return _0x698773;};'use strict';var multer=require(_0x5c53('0x0'));var util=require(_0x5c53('0x1'));var path=require(_0x5c53('0x2'));var timeout=require(_0x5c53('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c53('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5c53('0x5'));var config=require(_0x5c53('0x6'));var controller=require(_0x5c53('0x7'));router[_0x5c53('0x8')]('/',auth[_0x5c53('0x9')](),controller[_0x5c53('0xa')]);router[_0x5c53('0x8')](_0x5c53('0xb'),auth['isAuthenticated'](),controller[_0x5c53('0xc')]);router[_0x5c53('0x8')](_0x5c53('0xd'),auth[_0x5c53('0x9')](),controller[_0x5c53('0xe')]);router[_0x5c53('0x8')](_0x5c53('0xf'),auth[_0x5c53('0x9')](),controller['getDispositions']);router[_0x5c53('0x8')](_0x5c53('0x10'),auth[_0x5c53('0x9')](),controller['getAnswers']);router[_0x5c53('0x8')](_0x5c53('0x11'),auth[_0x5c53('0x9')](),controller[_0x5c53('0x12')]);router[_0x5c53('0x8')]('/:id/interactions',auth[_0x5c53('0x9')](),controller[_0x5c53('0x13')]);router[_0x5c53('0x8')](_0x5c53('0x14'),auth['isAuthenticated'](),controller[_0x5c53('0x15')]);router[_0x5c53('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5c53('0x16')](_0x5c53('0xf'),auth[_0x5c53('0x9')](),controller[_0x5c53('0x17')]);router[_0x5c53('0x16')](_0x5c53('0x10'),auth['isAuthenticated'](),controller[_0x5c53('0x18')]);router[_0x5c53('0x16')]('/:id/notify',controller[_0x5c53('0x19')]);router[_0x5c53('0x16')](_0x5c53('0x11'),auth[_0x5c53('0x9')](),controller[_0x5c53('0x1a')]);router[_0x5c53('0x16')](_0x5c53('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x5c53('0x1b'),auth[_0x5c53('0x9')](),controller[_0x5c53('0x1c')]);router[_0x5c53('0x1d')](_0x5c53('0xd'),auth[_0x5c53('0x9')](),controller['update']);router[_0x5c53('0x1e')](_0x5c53('0xd'),auth[_0x5c53('0x9')](),controller['destroy']);router[_0x5c53('0x1e')](_0x5c53('0xf'),auth[_0x5c53('0x9')](),controller['removeDispositions']);router[_0x5c53('0x1e')](_0x5c53('0x10'),auth[_0x5c53('0x9')](),controller[_0x5c53('0x1f')]);router[_0x5c53('0x1e')](_0x5c53('0x14'),auth[_0x5c53('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 519d298..147b6e7 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 _0x6506=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate'];(function(_0x18e570,_0x50c8cd){var _0x233c7e=function(_0x20ecdc){while(--_0x20ecdc){_0x18e570['push'](_0x18e570['shift']());}};_0x233c7e(++_0x50c8cd);}(_0x6506,0xd8));var _0x6650=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x6506[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x6650('0x0')]={'name':{'type':Sequelize[_0x6650('0x1')],'unique':_0x6650('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6650('0x1')]},'token':{'type':Sequelize[_0x6650('0x1')],'defaultValue':function(){return rs[_0x6650('0x3')]();}},'replyUri':{'type':Sequelize[_0x6650('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6650('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6650('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6650('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6650('0x1')]},'queueTransfer':{'type':Sequelize[_0x6650('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6650('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6650('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6650('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6650('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6650('0x4')],'defaultValue':![],'comment':_0x6650('0x6'),'set':function(_0xa66b53){if(!_0xa66b53)this[_0x6650('0x7')](_0x6650('0x8'),null);this[_0x6650('0x7')](_0x6650('0x9'),_0xa66b53);}}}; \ No newline at end of file +var _0xc3c5=['exports','STRING','name','generate','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x2edf55,_0x5bb2ae){var _0x392f43=function(_0x1cfef1){while(--_0x1cfef1){_0x2edf55['push'](_0x2edf55['shift']());}};_0x392f43(++_0x5bb2ae);}(_0xc3c5,0x107));var _0x5c3c=function(_0x229ec3,_0x211539){_0x229ec3=_0x229ec3-0x0;var _0x367fb4=_0xc3c5[_0x229ec3];return _0x367fb4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5c3c('0x0'));module[_0x5c3c('0x1')]={'name':{'type':Sequelize[_0x5c3c('0x2')],'unique':_0x5c3c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5c3c('0x2')]},'token':{'type':Sequelize[_0x5c3c('0x2')],'defaultValue':function(){return rs[_0x5c3c('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5c3c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5c3c('0x5')],'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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5c3c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5c3c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5c3c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5c3c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5c3c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5c3c('0x7')],'defaultValue':![],'comment':_0x5c3c('0x9'),'set':function(_0x1977ce){if(!_0x1977ce)this['setDataValue'](_0x5c3c('0xa'),null);this['setDataValue'](_0x5c3c('0xb'),_0x1977ce);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index afe7966..d25b93d 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 _0x975f=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','User','Owner','fullname','internal','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','defaults','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','include','rows','show','params','Pause','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','ValidationError'];(function(_0x5ab24c,_0x774954){var _0xa07d01=function(_0xe0b61f){while(--_0xe0b61f){_0x5ab24c['push'](_0x5ab24c['shift']());}};_0xa07d01(++_0x774954);}(_0x975f,0x109));var _0xf975=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x975f[_0x3f00ee];return _0x18a07e;};'use strict';var emlformat=require(_0xf975('0x0'));var rimraf=require(_0xf975('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf975('0x2'));var moment=require(_0xf975('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf975('0x4'));var util=require(_0xf975('0x5'));var path=require(_0xf975('0x6'));var sox=require(_0xf975('0x7'));var csv=require('to-csv');var ejs=require(_0xf975('0x8'));var fs=require('fs');var fs_extra=require(_0xf975('0x9'));var _=require(_0xf975('0xa'));var squel=require(_0xf975('0xb'));var crypto=require('crypto');var jsforce=require(_0xf975('0xc'));var deskjs=require(_0xf975('0xd'));var toCsv=require(_0xf975('0xe'));var querystring=require('querystring');var Papa=require(_0xf975('0xf'));var Redis=require(_0xf975('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf975('0x11'));var as=require(_0xf975('0x12'));var hardwareService=require(_0xf975('0x13'));var logger=require(_0xf975('0x14'))(_0xf975('0x15'));var utils=require(_0xf975('0x16'));var config=require(_0xf975('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf975('0x18'))['db'];config[_0xf975('0x19')]=_['defaults'](config[_0xf975('0x19')],{'host':_0xf975('0x1a'),'port':0x18eb});var socket=require(_0xf975('0x1b'))(new Redis(config[_0xf975('0x19')]));require(_0xf975('0x1c'))[_0xf975('0x1d')](socket);var jayson=require(_0xf975('0x1e'));var client=jayson['client'][_0xf975('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x213df9,_0x168a76,_0x24b7dc,_0x3bcc62){return new BPromise(function(_0x300312,_0x244cca){var _0x2cffb6=_0x3bcc62||client;return _0x2cffb6['request'](_0x213df9,_0x24b7dc)['then'](function(_0xa3a4d6){logger[_0xf975('0x20')](_0xf975('0x21'),_0x168a76,_0xf975('0x22'));logger[_0xf975('0x23')](_0xf975('0x24'),_0x168a76,'request\x20sent',JSON[_0xf975('0x25')](_0xa3a4d6));if(_0xa3a4d6[_0xf975('0x26')]){if(_0xa3a4d6[_0xf975('0x26')][_0xf975('0x27')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x168a76,_0xa3a4d6[_0xf975('0x26')][_0xf975('0x28')]);return _0x244cca(_0xa3a4d6[_0xf975('0x26')][_0xf975('0x28')]);}logger[_0xf975('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x168a76,_0xa3a4d6[_0xf975('0x26')][_0xf975('0x28')]);return _0x300312(_0xa3a4d6[_0xf975('0x26')][_0xf975('0x28')]);}else{logger['info'](_0xf975('0x21'),_0x168a76,_0xf975('0x22'));_0x300312(_0xa3a4d6[_0xf975('0x29')][_0xf975('0x28')]);}})[_0xf975('0x2a')](function(_0x7f9aaa){logger['error'](_0xf975('0x21'),_0x168a76,_0x7f9aaa);_0x244cca(_0x7f9aaa);});});}function respondWithStatusCode(_0x2b3079,_0x5bfd59){_0x5bfd59=_0x5bfd59||0xcc;return function(_0x5202e5){if(_0x5202e5){return _0x2b3079[_0xf975('0x2b')](_0x5bfd59);}return _0x2b3079[_0xf975('0x2c')](_0x5bfd59)['end']();};}function respondWithResult(_0x225a06,_0x691fe2){_0x691fe2=_0x691fe2||0xc8;return function(_0x2fa338){if(_0x2fa338){return _0x225a06[_0xf975('0x2c')](_0x691fe2)[_0xf975('0x2d')](_0x2fa338);}};}function respondWithFilteredResult(_0x20345d,_0x3444a4){return function(_0x2be08b){if(_0x2be08b){var _0x2394de=typeof _0x3444a4[_0xf975('0x2e')]===_0xf975('0x2f')&&typeof _0x3444a4[_0xf975('0x30')]===_0xf975('0x2f');var _0x10b3a2=_0x2be08b['count'];var _0x5a1b4f=_0x2394de?0x0:_0x3444a4[_0xf975('0x2e')];var _0x22e90f=_0x2394de?_0x2be08b[_0xf975('0x31')]:_0x3444a4['offset']+_0x3444a4['limit'];var _0xeeb380;if(_0x22e90f>=_0x10b3a2){_0x22e90f=_0x10b3a2;_0xeeb380=0xc8;}else{_0xeeb380=0xce;}_0x20345d['status'](_0xeeb380);return _0x20345d[_0xf975('0x32')](_0xf975('0x33'),_0x5a1b4f+'-'+_0x22e90f+'/'+_0x10b3a2)[_0xf975('0x2d')](_0x2be08b);}return null;};}function patchUpdates(_0x57707f){return function(_0x2b34bf){try{jsonpatch[_0xf975('0x34')](_0x2b34bf,_0x57707f,!![]);}catch(_0x3c9f58){return BPromise[_0xf975('0x35')](_0x3c9f58);}return _0x2b34bf[_0xf975('0x36')]();};}function saveUpdates(_0x2f11df,_0x2cdbf4){return function(_0x2e6d33){if(_0x2e6d33){return _0x2e6d33[_0xf975('0x37')](_0x2f11df)[_0xf975('0x38')](function(_0x55558c){return _0x55558c;});}return null;};}function removeEntity(_0x3f1305,_0x16dbc4){return function(_0x38c2cf){if(_0x38c2cf){return _0x38c2cf[_0xf975('0x39')]()[_0xf975('0x38')](function(){var _0x11c485=_0x38c2cf['get']({'plain':!![]});var _0x223cf1='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x223cf1,'resourceId':_0x11c485['id']}})[_0xf975('0x38')](function(){return _0x38c2cf;});})['then'](function(){_0x3f1305[_0xf975('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bea08,_0x32112a){return function(_0x3bc449){if(!_0x3bc449){_0x1bea08[_0xf975('0x2b')](0x194);}return _0x3bc449;};}function handleError(_0x5e737b,_0x480e2f){_0x480e2f=_0x480e2f||0x1f4;return function(_0x165b07){logger[_0xf975('0x26')](_0x165b07[_0xf975('0x3a')]);if(_0x165b07['name']){delete _0x165b07['name'];}_0x5e737b[_0xf975('0x2c')](_0x480e2f)['send'](_0x165b07);};}exports[_0xf975('0x3b')]=function(_0x2844f8,_0x1575b4){var _0x322dc7={'include':[{'model':db['Pause'],'as':_0xf975('0x3c')}]},_0x116af1={},_0x3e1b1d={'count':0x0,'rows':[]};var _0x317f17=_[_0xf975('0x3d')](db[_0xf975('0x3e')][_0xf975('0x3f')],function(_0x562e28){return{'name':_0x562e28[_0xf975('0x40')],'type':_0x562e28[_0xf975('0x41')]['key']};});_0x116af1[_0xf975('0x42')]=_[_0xf975('0x3d')](_0x317f17,_0xf975('0x43'));_0x116af1['query']=_[_0xf975('0x44')](_0x2844f8[_0xf975('0x45')]);_0x116af1[_0xf975('0x46')]=_[_0xf975('0x47')](_0x116af1[_0xf975('0x42')],_0x116af1['query']);_0x322dc7[_0xf975('0x48')]=_[_0xf975('0x47')](_0x116af1[_0xf975('0x42')],qs[_0xf975('0x49')](_0x2844f8['query'][_0xf975('0x49')]));_0x322dc7[_0xf975('0x48')]=_0x322dc7['attributes'][_0xf975('0x4a')]?_0x322dc7[_0xf975('0x48')]:_0x116af1[_0xf975('0x42')];if(!_0x2844f8[_0xf975('0x45')][_0xf975('0x4b')]('nolimit')){_0x322dc7[_0xf975('0x30')]=qs[_0xf975('0x30')](_0x2844f8[_0xf975('0x45')][_0xf975('0x30')]);_0x322dc7['offset']=qs['offset'](_0x2844f8[_0xf975('0x45')][_0xf975('0x2e')]);}_0x322dc7[_0xf975('0x4c')]=qs['sort'](_0x2844f8[_0xf975('0x45')][_0xf975('0x4d')]);_0x322dc7[_0xf975('0x4e')]=qs[_0xf975('0x46')](_[_0xf975('0x4f')](_0x2844f8['query'],_0x116af1[_0xf975('0x46')]),_0x317f17);if(_0x2844f8[_0xf975('0x45')]['filter']){_0x322dc7[_0xf975('0x4e')]=_['merge'](_0x322dc7['where'],{'$or':_[_0xf975('0x3d')](_0x317f17,function(_0x5b4be2){if(_0x5b4be2[_0xf975('0x41')]!==_0xf975('0x50')){var _0x3dcf89={};_0x3dcf89[_0x5b4be2[_0xf975('0x43')]]={'$like':'%'+_0x2844f8[_0xf975('0x45')][_0xf975('0x51')]+'%'};return _0x3dcf89;}})});}_0x322dc7=_[_0xf975('0x52')]({},_0x322dc7,_0x2844f8[_0xf975('0x53')]);var _0x4a785c={'where':_0x322dc7[_0xf975('0x4e')]};return db['OpenchannelAccount'][_0xf975('0x31')](_0x4a785c)[_0xf975('0x38')](function(_0x28ffec){_0x3e1b1d[_0xf975('0x31')]=_0x28ffec;if(_0x2844f8[_0xf975('0x45')]['includeAll']){_0x322dc7[_0xf975('0x54')]=[{'all':!![]}];}return db[_0xf975('0x3e')]['findAll'](_0x322dc7);})[_0xf975('0x38')](function(_0x585263){_0x3e1b1d[_0xf975('0x55')]=_0x585263;return _0x3e1b1d;})[_0xf975('0x38')](respondWithFilteredResult(_0x1575b4,_0x322dc7))[_0xf975('0x2a')](handleError(_0x1575b4,null));};exports[_0xf975('0x56')]=function(_0x38acb4,_0x4b7dd3){var _0x5f4f87={'raw':![],'where':{'id':_0x38acb4[_0xf975('0x57')]['id']},'include':[{'model':db[_0xf975('0x58')],'as':'mandatoryDispositionPause'}]},_0x3ff660={};_0x3ff660[_0xf975('0x42')]=_[_0xf975('0x44')](db[_0xf975('0x3e')][_0xf975('0x3f')]);_0x3ff660[_0xf975('0x45')]=_[_0xf975('0x44')](_0x38acb4[_0xf975('0x45')]);_0x3ff660[_0xf975('0x46')]=_[_0xf975('0x47')](_0x3ff660[_0xf975('0x42')],_0x3ff660[_0xf975('0x45')]);_0x5f4f87['attributes']=_[_0xf975('0x47')](_0x3ff660[_0xf975('0x42')],qs[_0xf975('0x49')](_0x38acb4[_0xf975('0x45')][_0xf975('0x49')]));_0x5f4f87[_0xf975('0x48')]=_0x5f4f87[_0xf975('0x48')][_0xf975('0x4a')]?_0x5f4f87[_0xf975('0x48')]:_0x3ff660['model'];if(_0x38acb4[_0xf975('0x45')][_0xf975('0x59')]){_0x5f4f87[_0xf975('0x54')]=[{'all':!![]}];}_0x5f4f87=_[_0xf975('0x52')]({},_0x5f4f87,_0x38acb4[_0xf975('0x53')]);return db[_0xf975('0x3e')][_0xf975('0x5a')](_0x5f4f87)[_0xf975('0x38')](handleEntityNotFound(_0x4b7dd3,null))['then'](respondWithResult(_0x4b7dd3,null))[_0xf975('0x2a')](handleError(_0x4b7dd3,null));};exports[_0xf975('0x5b')]=function(_0x3f924c,_0x4b83dd){return db[_0xf975('0x3e')][_0xf975('0x5b')](_0x3f924c[_0xf975('0x5c')],{})[_0xf975('0x38')](function(_0x27b188){var _0xb87249=_0x3f924c[_0xf975('0x5d')][_0xf975('0x5e')]({'plain':!![]});if(!_0xb87249)throw new Error(_0xf975('0x5f'));if(_0xb87249[_0xf975('0x60')]===_0xf975('0x5d')){var _0xc9cd5f=_0x27b188[_0xf975('0x5e')]({'plain':!![]});var _0x1f7aa2=_0xf975('0x61');return db[_0xf975('0x62')]['find']({'where':{'name':_0x1f7aa2,'userProfileId':_0xb87249[_0xf975('0x63')]},'raw':!![]})[_0xf975('0x38')](function(_0x2e125c){if(_0x2e125c&&_0x2e125c[_0xf975('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0xc9cd5f['name'],'resourceId':_0xc9cd5f['id'],'type':_0x2e125c[_0xf975('0x43')],'sectionId':_0x2e125c['id']},{})[_0xf975('0x38')](function(){return _0x27b188;});}else{return _0x27b188;}})[_0xf975('0x2a')](function(_0x4994db){logger[_0xf975('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4994db);throw _0x4994db;});}return _0x27b188;})[_0xf975('0x38')](respondWithResult(_0x4b83dd,0xc9))['catch'](handleError(_0x4b83dd,null));};exports[_0xf975('0x37')]=function(_0x2196fb,_0x1610de){if(_0x2196fb[_0xf975('0x5c')]['id']){delete _0x2196fb[_0xf975('0x5c')]['id'];}return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0x2196fb[_0xf975('0x57')]['id']},'include':[{'model':db[_0xf975('0x58')],'as':'mandatoryDispositionPause'}]})[_0xf975('0x38')](handleEntityNotFound(_0x1610de,null))[_0xf975('0x38')](saveUpdates(_0x2196fb['body'],null))[_0xf975('0x38')](respondWithResult(_0x1610de,null))[_0xf975('0x2a')](handleError(_0x1610de,null));};exports[_0xf975('0x39')]=function(_0x551eff,_0x22aedd){return db[_0xf975('0x3e')]['find']({'where':{'id':_0x551eff[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x22aedd,null))['then'](removeEntity(_0x22aedd,null))[_0xf975('0x2a')](handleError(_0x22aedd,null));};exports[_0xf975('0x65')]=function(_0x27794b,_0x19123a){return db[_0xf975('0x3e')][_0xf975('0x65')]()[_0xf975('0x38')](respondWithResult(_0x19123a,null))[_0xf975('0x2a')](handleError(_0x19123a,null));};exports[_0xf975('0x66')]=function(_0x506cd4,_0x4da079,_0x2245b6){if(_0x506cd4['body']['id']){delete _0x506cd4[_0xf975('0x5c')]['id'];}return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0x506cd4[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x4da079,null))[_0xf975('0x38')](function(_0x40d200){if(_0x40d200){_0x506cd4['body'][_0xf975('0x67')]=_0x40d200['id'];return db[_0xf975('0x68')][_0xf975('0x5b')](_0x506cd4[_0xf975('0x5c')]);}})[_0xf975('0x38')](respondWithResult(_0x4da079,null))['catch'](handleError(_0x4da079,null));};exports[_0xf975('0x69')]=function(_0x3b7f6f,_0x5af05f,_0xbc4b93){var _0x438bb0={'raw':![],'where':{}};var _0x21ef7f={};var _0x5000dc={'count':0x0,'rows':[]};return db[_0xf975('0x3e')][_0xf975('0x6a')]({'where':{'id':_0x3b7f6f[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x5af05f,null))['then'](function(_0x5edfc9){if(_0x5edfc9){_0x21ef7f['model']=_[_0xf975('0x44')](db[_0xf975('0x68')][_0xf975('0x3f')]);_0x21ef7f[_0xf975('0x45')]=_[_0xf975('0x44')](_0x3b7f6f[_0xf975('0x45')]);_0x21ef7f['filters']=_[_0xf975('0x47')](_0x21ef7f[_0xf975('0x42')],_0x21ef7f[_0xf975('0x45')]);_0x438bb0[_0xf975('0x48')]=_['intersection'](_0x21ef7f['model'],qs[_0xf975('0x49')](_0x3b7f6f[_0xf975('0x45')][_0xf975('0x49')]));_0x438bb0[_0xf975('0x48')]=_0x438bb0[_0xf975('0x48')][_0xf975('0x4a')]?_0x438bb0[_0xf975('0x48')]:_0x21ef7f[_0xf975('0x42')];if(!_0x3b7f6f['query'][_0xf975('0x4b')](_0xf975('0x6b'))){_0x438bb0[_0xf975('0x30')]=qs[_0xf975('0x30')](_0x3b7f6f['query'][_0xf975('0x30')]);_0x438bb0[_0xf975('0x2e')]=qs[_0xf975('0x2e')](_0x3b7f6f['query'][_0xf975('0x2e')]);}_0x438bb0[_0xf975('0x4c')]=qs[_0xf975('0x4d')](_0x3b7f6f[_0xf975('0x45')][_0xf975('0x4d')]);_0x438bb0[_0xf975('0x4e')]=qs[_0xf975('0x46')](_[_0xf975('0x4f')](_0x3b7f6f[_0xf975('0x45')],_0x21ef7f[_0xf975('0x46')]));_0x438bb0['where'][_0xf975('0x67')]=_0x5edfc9['id'];if(_0x3b7f6f[_0xf975('0x45')]['filter']){_0x438bb0[_0xf975('0x4e')]=_[_0xf975('0x52')](_0x438bb0[_0xf975('0x4e')],{'$or':_[_0xf975('0x3d')](_0x438bb0['attributes'],function(_0x324a99){var _0x1bff8b={};_0x1bff8b[_0x324a99]={'$like':'%'+_0x3b7f6f[_0xf975('0x45')][_0xf975('0x51')]+'%'};return _0x1bff8b;})});}_0x438bb0=_[_0xf975('0x52')]({},_0x438bb0,_0x3b7f6f[_0xf975('0x53')]);return db[_0xf975('0x68')][_0xf975('0x31')]({'where':_0x438bb0[_0xf975('0x4e')]})['then'](function(_0x545a56){_0x5000dc[_0xf975('0x31')]=_0x545a56;if(_0x3b7f6f[_0xf975('0x45')][_0xf975('0x59')]){_0x438bb0[_0xf975('0x54')]=[{'all':!![]}];}return db[_0xf975('0x68')][_0xf975('0x6c')](_0x438bb0);})[_0xf975('0x38')](function(_0x3b8727){_0x5000dc[_0xf975('0x55')]=_0x3b8727;return _0x5000dc;});}})[_0xf975('0x38')](respondWithFilteredResult(_0x5af05f,_0x438bb0))['catch'](handleError(_0x5af05f,null));};exports[_0xf975('0x6d')]=function(_0x29e8bb,_0x534752,_0xaef4ef){return db[_0xf975('0x3e')]['find']({'where':{'id':_0x29e8bb['params']['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x534752,null))[_0xf975('0x38')](function(_0x1e1d5b){if(_0x1e1d5b){return _0x1e1d5b[_0xf975('0x6d')](_0x29e8bb[_0xf975('0x45')][_0xf975('0x6e')]);}})[_0xf975('0x38')](respondWithStatusCode(_0x534752,null))[_0xf975('0x2a')](handleError(_0x534752,null));};exports[_0xf975('0x6f')]=function(_0xab7e50,_0x5a3546,_0xe92a8b){if(_0xab7e50[_0xf975('0x5c')]['id']){delete _0xab7e50[_0xf975('0x5c')]['id'];}return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0xab7e50[_0xf975('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a3546,null))[_0xf975('0x38')](function(_0x5623ec){if(_0x5623ec){_0xab7e50['body'][_0xf975('0x67')]=_0x5623ec['id'];return db[_0xf975('0x70')]['create'](_0xab7e50[_0xf975('0x5c')]);}})[_0xf975('0x38')](respondWithResult(_0x5a3546,null))[_0xf975('0x2a')](handleError(_0x5a3546,null));};exports[_0xf975('0x71')]=function(_0x5365cb,_0x159703,_0xa361a4){var _0x2bcad5={'raw':![],'where':{}};var _0x392b8b={};var _0xb128b6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf975('0x6a')]({'where':{'id':_0x5365cb['params']['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x159703,null))['then'](function(_0x51285f){if(_0x51285f){_0x392b8b[_0xf975('0x42')]=_[_0xf975('0x44')](db[_0xf975('0x70')][_0xf975('0x3f')]);_0x392b8b['query']=_[_0xf975('0x44')](_0x5365cb[_0xf975('0x45')]);_0x392b8b[_0xf975('0x46')]=_[_0xf975('0x47')](_0x392b8b['model'],_0x392b8b[_0xf975('0x45')]);_0x2bcad5[_0xf975('0x48')]=_['intersection'](_0x392b8b['model'],qs['fields'](_0x5365cb[_0xf975('0x45')][_0xf975('0x49')]));_0x2bcad5['attributes']=_0x2bcad5[_0xf975('0x48')][_0xf975('0x4a')]?_0x2bcad5['attributes']:_0x392b8b['model'];if(!_0x5365cb['query'][_0xf975('0x4b')](_0xf975('0x6b'))){_0x2bcad5[_0xf975('0x30')]=qs[_0xf975('0x30')](_0x5365cb[_0xf975('0x45')]['limit']);_0x2bcad5[_0xf975('0x2e')]=qs[_0xf975('0x2e')](_0x5365cb[_0xf975('0x45')][_0xf975('0x2e')]);}_0x2bcad5[_0xf975('0x4c')]=qs[_0xf975('0x4d')](_0x5365cb[_0xf975('0x45')][_0xf975('0x4d')]);_0x2bcad5[_0xf975('0x4e')]=qs[_0xf975('0x46')](_[_0xf975('0x4f')](_0x5365cb[_0xf975('0x45')],_0x392b8b[_0xf975('0x46')]));_0x2bcad5[_0xf975('0x4e')][_0xf975('0x67')]=_0x51285f['id'];if(_0x5365cb[_0xf975('0x45')][_0xf975('0x51')]){_0x2bcad5[_0xf975('0x4e')]=_[_0xf975('0x52')](_0x2bcad5['where'],{'$or':_[_0xf975('0x3d')](_0x2bcad5[_0xf975('0x48')],function(_0x132a32){var _0x26a544={};_0x26a544[_0x132a32]={'$like':'%'+_0x5365cb[_0xf975('0x45')][_0xf975('0x51')]+'%'};return _0x26a544;})});}_0x2bcad5=_['merge']({},_0x2bcad5,_0x5365cb['options']);return db[_0xf975('0x70')][_0xf975('0x31')]({'where':_0x2bcad5[_0xf975('0x4e')]})['then'](function(_0x3e7f78){_0xb128b6[_0xf975('0x31')]=_0x3e7f78;if(_0x5365cb[_0xf975('0x45')][_0xf975('0x59')]){_0x2bcad5[_0xf975('0x54')]=[{'all':!![]}];}return db[_0xf975('0x70')][_0xf975('0x6c')](_0x2bcad5);})[_0xf975('0x38')](function(_0x323075){_0xb128b6[_0xf975('0x55')]=_0x323075;return _0xb128b6;});}})[_0xf975('0x38')](respondWithFilteredResult(_0x159703,_0x2bcad5))[_0xf975('0x2a')](handleError(_0x159703,null));};exports[_0xf975('0x72')]=function(_0x4b7bbe,_0x1c77b1,_0x25a574){return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0x4b7bbe[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x1c77b1,null))[_0xf975('0x38')](function(_0x4bf7c7){if(_0x4bf7c7){return _0x4bf7c7[_0xf975('0x72')](_0x4b7bbe['query'][_0xf975('0x6e')]);}})[_0xf975('0x38')](respondWithStatusCode(_0x1c77b1,null))[_0xf975('0x2a')](handleError(_0x1c77b1,null));};exports[_0xf975('0x73')]=function(_0x1977ff,_0x92c1f1,_0x48a8b3){var _0x381653={'body':_0x1977ff['body'],'channel':_0xf975('0x74')};var _0x2dd269=[];var _0x1b139a=[];var _0x1ac98b={};var _0x4d3ca2=![];return db[_0xf975('0x75')]['describe']()[_0xf975('0x38')](function(_0x1f32b5){if(!_0x1f32b5){throw new db['Sequelize']['ValidationError'](_0xf975('0x76'));}_0x2dd269=_[_0xf975('0x77')](_[_0xf975('0x44')](_0x1f32b5),[_0xf975('0x78'),_0xf975('0x79')]);_0x1b139a=_['difference'](_['keys'](_0x1f32b5),['createdAt',_0xf975('0x79'),_0xf975('0x7a'),_0xf975('0x7b')]);if(_0x1977ff['body']['id']){delete _0x1977ff[_0xf975('0x5c')]['id'];}if(_[_0xf975('0x7c')](_0x1977ff[_0xf975('0x5c')][_0xf975('0x7d')])){throw new db[(_0xf975('0x7e'))]['ValidationError'](_0xf975('0x7f'));}if(_[_0xf975('0x7c')](_0x1977ff[_0xf975('0x5c')][_0xf975('0x5c')])||_0x1977ff[_0xf975('0x5c')]['body']===''){throw new db[(_0xf975('0x7e'))][(_0xf975('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf975('0x7c')](_0x1977ff[_0xf975('0x5c')][_0xf975('0x81')])){throw new db[(_0xf975('0x7e'))][(_0xf975('0x80'))](_0xf975('0x82')+_0x1b139a);}if(!_['includes'](_0x1b139a,_0x1977ff[_0xf975('0x5c')][_0xf975('0x81')])){throw new db[(_0xf975('0x7e'))][(_0xf975('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b139a);}_0x1ac98b[_0x1977ff['body']['mapKey']]=_0x1977ff[_0xf975('0x5c')][_0xf975('0x7d')];})[_0xf975('0x38')](function(){return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0x1977ff[_0xf975('0x57')]['id']},'include':[{'model':db[_0xf975('0x83')],'as':_0xf975('0x84'),'include':[{'model':db['CmContact'],'as':_0xf975('0x85'),'where':_0x1ac98b,'limit':0x1,'order':[[_0xf975('0x79'),_0xf975('0x86')]]}]},{'model':db[_0xf975('0x87')],'as':'Applications'}]});})[_0xf975('0x38')](handleEntityNotFound(_0x92c1f1,null))[_0xf975('0x38')](function(_0x4bd52b){if(_0x4bd52b&&_0x4bd52b['List']){_0x381653[_0xf975('0x88')]=_0x4bd52b;_0x381653[_0xf975('0x89')]=_0x4bd52b[_0xf975('0x8a')];_0x381653[_0xf975('0x8b')]=_0x4bd52b[_0xf975('0x84')];_0x381653[_0xf975('0x89')]=_['orderBy'](_0x381653[_0xf975('0x89')],['priority'],[_0xf975('0x8c')]);if(_0x381653['account']['Applications']){delete _0x381653['account'][_0xf975('0x8a')];}if(_0x381653[_0xf975('0x88')][_0xf975('0x84')]&&_0x381653[_0xf975('0x88')][_0xf975('0x84')]['Contacts'][_0xf975('0x4a')]){return _0x381653['account'][_0xf975('0x84')]['Contacts'][0x0];}var _0x34396c=_['defaults'](_0x1977ff[_0xf975('0x5c')],{'firstName':_0x1977ff['body']['from'],'ListId':_0x4bd52b[_0xf975('0x7b')]});_0x34396c[_0x1977ff['body']['mapKey']]=_0x1977ff[_0xf975('0x5c')][_0xf975('0x7d')];return db[_0xf975('0x75')]['create'](_0x34396c,{'fields':_0x2dd269,'raw':!![]});}})[_0xf975('0x38')](handleEntityNotFound(_0x92c1f1,null))['then'](function(_0x440774){_0x381653[_0xf975('0x8d')]=_0x440774;if(_0x440774){var _0x5c292f={'ContactId':_0x440774['id'],'OpenchannelAccountId':_0x1977ff[_0xf975('0x57')]['id'],'from':(_0x440774[_0xf975('0x8e')]||'')+'\x20'+(_0x440774[_0xf975('0x8f')]||'')};var _0x1dec66={'OpenchannelAccountId':_0x1977ff[_0xf975('0x57')]['id'],'closed':![]};if(_0x1977ff[_0xf975('0x5c')]['threadId']){_0x1dec66[_0xf975('0x90')]=_0x1977ff[_0xf975('0x5c')]['threadId'];return db[_0xf975('0x91')][_0xf975('0x5a')]({'where':_0x1dec66})['then'](function(_0x280ce4){if(_0x280ce4){return[_0x280ce4,![]];}_0x5c292f[_0xf975('0x90')]=_0x1977ff[_0xf975('0x5c')][_0xf975('0x90')];_0x5c292f[_0xf975('0x92')]=_0x1977ff[_0xf975('0x5c')][_0xf975('0x92')];return db[_0xf975('0x91')]['create'](_0x5c292f)[_0xf975('0x38')](function(_0x139a21){return[_0x139a21,!![]];});});}else{_0x1dec66['threadId']=null;}_0x1dec66[_0xf975('0x93')]=_0x440774['id'];return db['OpenchannelInteraction'][_0xf975('0x5a')]({'where':_0x1dec66})[_0xf975('0x38')](function(_0x126615){if(_0x126615){return[_0x126615,![]];}return db[_0xf975('0x91')][_0xf975('0x5b')](_0x5c292f)['then'](function(_0x15b0e4){return[_0x15b0e4,!![]];});});}})[_0xf975('0x94')](function(_0x177648,_0x273b38){if(_0x177648){_0x4d3ca2=_0x273b38;if(!_0x273b38){var _0x2dec27={'from':(_0x381653['contact'][_0xf975('0x8e')]||'')+'\x20'+(_0x381653[_0xf975('0x8d')][_0xf975('0x8f')]||'')};if(_0x1977ff[_0xf975('0x5c')][_0xf975('0x90')]&&_0x1977ff[_0xf975('0x5c')]['messageId']&&_0x1977ff[_0xf975('0x5c')][_0xf975('0x90')]!=_0x1977ff[_0xf975('0x5c')]['messageId']){_0x2dec27[_0xf975('0x90')]=_0x1977ff[_0xf975('0x5c')][_0xf975('0x95')];}return _0x177648[_0xf975('0x37')](_0x2dec27);}else{return _0x177648;}}})[_0xf975('0x38')](function(_0x59af25){_0x381653[_0xf975('0x96')]=_0x59af25[_0xf975('0x5e')]({'plain':!![]});_0x381653[_0xf975('0x96')]['created']=_0x4d3ca2;if(_0x381653['interaction'][_0xf975('0x97')]){if(_0x381653[_0xf975('0x88')][_0xf975('0x98')]){_0x381653[_0xf975('0x89')][_0xf975('0x99')]({'id':0x0,'priority':_0x381653[_0xf975('0x89')][_0xf975('0x4a')]+0x1,'app':_0xf975('0x9a'),'appdata':_0xf975('0x9b'),'interval':_0xf975('0x9c')});}}return db[_0xf975('0x9d')][_0xf975('0x5b')]({'body':_0x1977ff['body'][_0xf975('0x5c')],'OpenchannelAccountId':_0x1977ff[_0xf975('0x57')]['id'],'OpenchannelInteractionId':_0x59af25['id'],'direction':'in','ContactId':_0x381653[_0xf975('0x8d')]['id'],'AttachmentId':_0x1977ff[_0xf975('0x5c')]['AttachmentId']});})[_0xf975('0x38')](function(_0x34d796){_0x381653['message']=_0x34d796;if(_0x381653[_0xf975('0x96')]['UserId']){return db['User'][_0xf975('0x5a')]({'attributes':['id','name'],'where':{'id':_0x381653[_0xf975('0x96')][_0xf975('0x9e')]}})['then'](function(_0x31decf){if(_0x31decf){_0x381653['applications'][_0xf975('0x9f')]({'id':0x0,'priority':0x0,'app':_0xf975('0xa0'),'appdata':_0x31decf[_0xf975('0x43')]+','+(_0x381653['account'][_0xf975('0xa1')]||0xa),'interval':_0xf975('0x9c')});_0x381653[_0xf975('0xa2')]=![];}return respondWithRpcPromise(_0xf975('0xa3'),_0xf975('0xa4'),_0x381653);});}return respondWithRpcPromise(_0xf975('0xa3'),_0xf975('0xa4'),_0x381653);})[_0xf975('0x38')](function(_0x466736){respondWithRpcPromise(_0xf975('0xa5'),_0xf975('0xa5'),{'event':_0xf975('0x73'),'message':_0x466736},client9002);return _0x466736;})[_0xf975('0x38')](respondWithResult(_0x92c1f1,null))['catch'](handleError(_0x92c1f1,null));};exports[_0xf975('0xa6')]=function(_0x2da67c,_0x223d1a){var _0xae28f4=_0x2da67c['params']['id'];var _0x1b75d9=_0x2da67c['body'];var _0x54f489=0xc8;var _0x1a55d8=null;return db[_0xf975('0xa7')][_0xf975('0xa8')]({'isolationLevel':db[_0xf975('0xa7')]['Transaction'][_0xf975('0xa9')][_0xf975('0xaa')]},function(_0x58584a){return db[_0xf975('0x3e')][_0xf975('0x6a')]({'where':{'id':_0xae28f4},'transaction':_0x58584a})[_0xf975('0x38')](function(_0x1686a7){if(_0x1686a7){return db[_0xf975('0x87')][_0xf975('0x39')]({'where':{'OpenchannelAccountId':_0xae28f4},'transaction':_0x58584a})[_0xf975('0x38')](function(){var _0x4284a5=_[_0xf975('0x3d')](_0x1b75d9,function(_0x4b7c93){_0x4b7c93[_0xf975('0x67')]=_0xae28f4;return _0x4b7c93;});return db[_0xf975('0x87')][_0xf975('0xab')](_0x4284a5,{'transaction':_0x58584a});});}else{_0x54f489=0x194;_0x1a55d8=[];}});})[_0xf975('0x38')](function(){if(_0x54f489!==0x194){return db[_0xf975('0x87')][_0xf975('0xac')]({'where':{'OpenchannelAccountId':_0xae28f4},'order':_0xf975('0xad')})[_0xf975('0x38')](function(_0x2748cf){_0x1a55d8=_0x2748cf;});}})[_0xf975('0x2a')](function(_0x34d324){_0x54f489=0x1f4;logger[_0xf975('0x26')](_0x34d324[_0xf975('0x3a')]);if(_0x34d324[_0xf975('0x43')]){delete _0x34d324[_0xf975('0x43')];}_0x1a55d8=_0x34d324;})[_0xf975('0xae')](function(){if(_0x1a55d8===null){_0x223d1a[_0xf975('0x2b')](_0x54f489);}else{if(_0x54f489===0x1f4){_0x223d1a[_0xf975('0x2c')](_0x54f489)[_0xf975('0xaf')](_0x1a55d8);}else{_0x223d1a['status'](_0x54f489)[_0xf975('0x2d')](_0x1a55d8);}}});};exports[_0xf975('0xb0')]=function(_0x21eb32,_0x226aae,_0x16cd1d){var _0x55af85={};var _0x2bc62e={};var _0x4efd45;var _0x452913;return db[_0xf975('0x3e')][_0xf975('0x6a')]({'where':{'id':_0x21eb32[_0xf975('0x57')]['id']}})['then'](handleEntityNotFound(_0x226aae,null))['then'](function(_0x3400e3){if(_0x3400e3){_0x4efd45=_0x3400e3;_0x2bc62e[_0xf975('0x42')]=_[_0xf975('0x44')](db['OpenchannelApplication'][_0xf975('0x3f')]);_0x2bc62e[_0xf975('0x45')]=_['keys'](_0x21eb32[_0xf975('0x45')]);_0x2bc62e[_0xf975('0x46')]=_[_0xf975('0x47')](_0x2bc62e[_0xf975('0x42')],_0x2bc62e[_0xf975('0x45')]);_0x55af85[_0xf975('0x48')]=_[_0xf975('0x47')](_0x2bc62e['model'],qs[_0xf975('0x49')](_0x21eb32[_0xf975('0x45')]['fields']));_0x55af85[_0xf975('0x48')]=_0x55af85[_0xf975('0x48')][_0xf975('0x4a')]?_0x55af85[_0xf975('0x48')]:_0x2bc62e[_0xf975('0x42')];_0x55af85['order']=qs['sort'](_0x21eb32[_0xf975('0x45')]['sort']);_0x55af85[_0xf975('0x4e')]=qs[_0xf975('0x46')](_['pick'](_0x21eb32[_0xf975('0x45')],_0x2bc62e['filters']));if(_0x21eb32[_0xf975('0x45')][_0xf975('0x51')]){_0x55af85[_0xf975('0x4e')]=_[_0xf975('0x52')](_0x55af85[_0xf975('0x4e')],{'$or':_[_0xf975('0x3d')](_0x55af85['attributes'],function(_0x2e162d){var _0x29cca1={};_0x29cca1[_0x2e162d]={'$like':'%'+_0x21eb32[_0xf975('0x45')][_0xf975('0x51')]+'%'};return _0x29cca1;})});}_0x55af85=_['merge']({},_0x55af85,_0x21eb32['options']);return _0x4efd45[_0xf975('0xb0')](_0x55af85);}})[_0xf975('0x38')](function(_0x4fbedf){if(_0x4fbedf){_0x452913=_0x4fbedf[_0xf975('0x4a')];if(!_0x21eb32[_0xf975('0x45')][_0xf975('0x4b')](_0xf975('0x6b'))){_0x55af85[_0xf975('0x30')]=qs[_0xf975('0x30')](_0x21eb32[_0xf975('0x45')]['limit']);_0x55af85[_0xf975('0x2e')]=qs[_0xf975('0x2e')](_0x21eb32[_0xf975('0x45')][_0xf975('0x2e')]);}return _0x4efd45['getApplications'](_0x55af85);}})[_0xf975('0x38')](function(_0x5c610a){if(_0x5c610a){return _0x5c610a?{'count':_0x452913,'rows':_0x5c610a}:null;}})[_0xf975('0x38')](respondWithResult(_0x226aae,null))[_0xf975('0x2a')](handleError(_0x226aae,null));};exports[_0xf975('0xb1')]=function(_0x2b107f,_0x5613ae,_0x4c3b72){var _0x5e58df={'raw':![],'where':{}};var _0x30535b={};var _0x369274={'count':0x0,'rows':[]};return db[_0xf975('0x3e')]['findOne']({'where':{'id':_0x2b107f[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x5613ae,null))[_0xf975('0x38')](function(_0x4fc350){if(_0x4fc350){_0x30535b[_0xf975('0x42')]=_['keys'](db[_0xf975('0x91')][_0xf975('0x3f')]);_0x30535b[_0xf975('0x45')]=_[_0xf975('0x44')](_0x2b107f[_0xf975('0x45')]);_0x30535b[_0xf975('0x46')]=_[_0xf975('0x47')](_0x30535b['model'],_0x30535b[_0xf975('0x45')]);_0x5e58df[_0xf975('0x48')]=_[_0xf975('0x47')](_0x30535b[_0xf975('0x42')],qs['fields'](_0x2b107f['query'][_0xf975('0x49')]));_0x5e58df[_0xf975('0x48')]=_0x5e58df[_0xf975('0x48')][_0xf975('0x4a')]?_0x5e58df[_0xf975('0x48')]:_0x30535b[_0xf975('0x42')];if(!_0x2b107f['query'][_0xf975('0x4b')]('nolimit')){_0x5e58df['limit']=qs['limit'](_0x2b107f['query'][_0xf975('0x30')]);_0x5e58df[_0xf975('0x2e')]=qs['offset'](_0x2b107f['query'][_0xf975('0x2e')]);}_0x5e58df['order']=qs['sort'](_0x2b107f['query'][_0xf975('0x4d')]);_0x5e58df[_0xf975('0x4e')]=qs[_0xf975('0x46')](_[_0xf975('0x4f')](_0x2b107f[_0xf975('0x45')],_0x30535b[_0xf975('0x46')]));_0x5e58df['where']['OpenchannelAccountId']=_0x4fc350['id'];if(_0x2b107f[_0xf975('0x45')][_0xf975('0x51')]){_0x5e58df[_0xf975('0x4e')]=_[_0xf975('0x52')](_0x5e58df['where'],{'$or':_['map'](_0x5e58df[_0xf975('0x48')],function(_0x3557a0){var _0x3bb529={};_0x3bb529[_0x3557a0]={'$like':'%'+_0x2b107f[_0xf975('0x45')]['filter']+'%'};return _0x3bb529;})});}_0x5e58df=_[_0xf975('0x52')]({},_0x5e58df,_0x2b107f[_0xf975('0x53')]);return db['OpenchannelInteraction']['count']({'where':_0x5e58df[_0xf975('0x4e')]})[_0xf975('0x38')](function(_0xfc8f0){_0x369274['count']=_0xfc8f0;if(_0x2b107f[_0xf975('0x45')][_0xf975('0x59')]){_0x5e58df[_0xf975('0x54')]=[{'model':db['CmContact'],'as':_0xf975('0xb2'),'required':![]},{'model':db[_0xf975('0xb3')],'as':_0xf975('0xb4'),'attributes':[_0xf975('0x43'),_0xf975('0xb5'),_0xf975('0xb6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf975('0x43'),_0xf975('0xb7')],'where':_0x2b107f[_0xf975('0x45')][_0xf975('0xb8')]?{'id':_0x2b107f['query'][_0xf975('0xb8')]}:undefined,'required':_0x2b107f[_0xf975('0x45')][_0xf975('0xb8')]?!![]:![]}];}return db[_0xf975('0x91')][_0xf975('0x6c')](_0x5e58df);})[_0xf975('0x38')](function(_0x46c1c7){_0x369274[_0xf975('0x55')]=_0x46c1c7;return _0x369274;});}})['then'](respondWithFilteredResult(_0x5613ae,_0x5e58df))['catch'](handleError(_0x5613ae,null));};exports[_0xf975('0xb9')]=function(_0xe1107f,_0x1c0ab5,_0x2ba6c6){return db[_0xf975('0x3e')]['find']({'where':{'id':_0xe1107f[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x1c0ab5,null))[_0xf975('0x38')](function(_0x42aa5b){if(_0x42aa5b){return _0x42aa5b['addAgents'](_0xe1107f[_0xf975('0x5c')]['ids'],_[_0xf975('0xba')](_0xe1107f[_0xf975('0x5c')],['ids','id'])||{})['spread'](function(_0x524829){for(var _0x29271b=0x0;_0x29271b<_0xe1107f['body'][_0xf975('0x6e')]['length'];_0x29271b+=0x1){socket[_0xf975('0xbb')](_0xf975('0xbc'),{'UserId':Number(_0xe1107f[_0xf975('0x5c')][_0xf975('0x6e')][_0x29271b]),'OpenchannelAccountId':Number(_0xe1107f[_0xf975('0x57')]['id'])});}return _0x524829;});}})['then'](respondWithResult(_0x1c0ab5,null))[_0xf975('0x2a')](handleError(_0x1c0ab5,null));};exports['removeAgents']=function(_0xbc0afc,_0x5a6c49,_0x4b0778){return db[_0xf975('0x3e')]['find']({'where':{'id':_0xbc0afc[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x5a6c49,null))[_0xf975('0x38')](function(_0x39415d){if(_0x39415d){return _0x39415d['removeAgents'](_0xbc0afc[_0xf975('0x45')][_0xf975('0x6e')])[_0xf975('0x38')](function(){if(_[_0xf975('0xbd')](_0xbc0afc[_0xf975('0x45')][_0xf975('0x6e')])){for(var _0xdaaf7d=0x0;_0xdaaf7d<_0xbc0afc[_0xf975('0x45')]['ids']['length'];_0xdaaf7d+=0x1){socket[_0xf975('0xbb')](_0xf975('0xbe'),{'UserId':Number(_0xbc0afc[_0xf975('0x45')][_0xf975('0x6e')][_0xdaaf7d]),'OpenchannelAccountId':Number(_0xbc0afc[_0xf975('0x57')]['id'])});}}else{socket[_0xf975('0xbb')](_0xf975('0xbe'),{'UserId':Number(_0xbc0afc[_0xf975('0x45')]['ids']),'OpenchannelAccountId':Number(_0xbc0afc[_0xf975('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a6c49,null))['catch'](handleError(_0x5a6c49,null));};exports['getAgents']=function(_0x530497,_0x2d80ba,_0x3ac22a){var _0x8fb612={};var _0x58be12={};var _0x3166f9;var _0x52787d;return db[_0xf975('0x3e')][_0xf975('0x6a')]({'where':{'id':_0x530497[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x2d80ba,null))['then'](function(_0x41e3ac){if(_0x41e3ac){_0x3166f9=_0x41e3ac;_0x58be12[_0xf975('0x42')]=_[_0xf975('0x44')](db['User'][_0xf975('0x3f')]);_0x58be12['query']=_[_0xf975('0x44')](_0x530497['query']);_0x58be12[_0xf975('0x46')]=_['intersection'](_0x58be12['model'],_0x58be12[_0xf975('0x45')]);_0x8fb612['attributes']=_[_0xf975('0x47')](_0x58be12[_0xf975('0x42')],qs['fields'](_0x530497[_0xf975('0x45')][_0xf975('0x49')]));_0x8fb612[_0xf975('0x48')]=_0x8fb612[_0xf975('0x48')][_0xf975('0x4a')]?_0x8fb612[_0xf975('0x48')]:_0x58be12[_0xf975('0x42')];_0x8fb612[_0xf975('0x4c')]=qs[_0xf975('0x4d')](_0x530497['query']['sort']);_0x8fb612[_0xf975('0x4e')]=qs[_0xf975('0x46')](_[_0xf975('0x4f')](_0x530497[_0xf975('0x45')],_0x58be12[_0xf975('0x46')]));if(_0x530497[_0xf975('0x45')][_0xf975('0x51')]){_0x8fb612[_0xf975('0x4e')]=_[_0xf975('0x52')](_0x8fb612[_0xf975('0x4e')],{'$or':_['map'](_0x8fb612[_0xf975('0x48')],function(_0x7fa04e){var _0x138796={};_0x138796[_0x7fa04e]={'$like':'%'+_0x530497['query'][_0xf975('0x51')]+'%'};return _0x138796;})});}_0x8fb612=_[_0xf975('0x52')]({},_0x8fb612,_0x530497[_0xf975('0x53')]);return _0x3166f9[_0xf975('0xbf')](_0x8fb612);}})[_0xf975('0x38')](function(_0x1a8186){if(_0x1a8186){_0x52787d=_0x1a8186[_0xf975('0x4a')];if(!_0x530497[_0xf975('0x45')]['hasOwnProperty'](_0xf975('0x6b'))){_0x8fb612[_0xf975('0x30')]=qs['limit'](_0x530497[_0xf975('0x45')][_0xf975('0x30')]);_0x8fb612[_0xf975('0x2e')]=qs[_0xf975('0x2e')](_0x530497[_0xf975('0x45')][_0xf975('0x2e')]);}return _0x3166f9[_0xf975('0xbf')](_0x8fb612);}})['then'](function(_0x118b31){if(_0x118b31){return _0x118b31?{'count':_0x52787d,'rows':_0x118b31}:null;}})[_0xf975('0x38')](respondWithResult(_0x2d80ba,null))['catch'](handleError(_0x2d80ba,null));};exports[_0xf975('0xaf')]=function(_0x270c30,_0x40187b,_0x3f0ac4){var _0x3a577b,_0x47707c,_0x171a21;if(_[_0xf975('0x7c')](_0x270c30[_0xf975('0x5c')][_0xf975('0x5c')])||_0x270c30[_0xf975('0x5c')]['body']===''){throw new db[(_0xf975('0x7e'))][(_0xf975('0x80'))](_0xf975('0xc0'));}if(_[_0xf975('0x7c')](_0x270c30[_0xf975('0x5c')]['to'])){}_0x3a577b=_0x270c30[_0xf975('0x5c')]['to'];return db[_0xf975('0x3e')][_0xf975('0x6a')]({'where':{'id':_0x270c30[_0xf975('0x57')]['id']}})[_0xf975('0x38')](handleEntityNotFound(_0x40187b,null))[_0xf975('0x38')](function(_0x346de4){if(_0x346de4){return db[_0xf975('0x3e')][_0xf975('0x5a')]({'where':{'id':_0x346de4['id']},'include':[{'model':db[_0xf975('0x83')],'as':_0xf975('0x84'),'include':[{'model':db[_0xf975('0x75')],'as':_0xf975('0x85'),'where':{[_0x346de4[_0xf975('0x81')]]:_0x3a577b},'limit':0x1,'order':[[_0xf975('0x79'),'DESC']]}]}]})[_0xf975('0x38')](handleEntityNotFound(_0x40187b,null))[_0xf975('0x38')](function(_0x421272){if(_0x421272&&_0x421272[_0xf975('0x84')]){_0x47707c=_0x421272[_0xf975('0x5e')]({'plain':!![]});if(_0x47707c['List']&&_0x47707c[_0xf975('0x84')]['Contacts']['length']){return _0x47707c[_0xf975('0x84')]['Contacts'][0x0];}return db[_0xf975('0x75')]['create'](_[_0xf975('0xc1')](_0x270c30['body'],{'firstName':_0x3a577b,[_0x421272['mapKey']]:_0x3a577b,'phone':_0x3a577b,'ListId':_0x47707c[_0xf975('0x7b')]}));}})[_0xf975('0x38')](handleEntityNotFound(_0x40187b,null))[_0xf975('0x38')](function(_0x53caa1){if(_0x53caa1){_0x171a21=_0x53caa1;return db[_0xf975('0x91')][_0xf975('0x5a')]({'where':{'ContactId':_0x171a21['id'],'closed':![],'OpenchannelAccountId':_0x47707c['id']}})[_0xf975('0x38')](function(_0x347de9){if(_0x347de9){return[_0x347de9,![]];}return db[_0xf975('0x91')][_0xf975('0x5b')]({'UserId':_0x270c30[_0xf975('0x5d')]['id'],'ContactId':_0x171a21['id'],'OpenchannelAccountId':_0x47707c['id'],'lastMsgDirection':_0xf975('0xc2'),'firstMsgDirection':_0xf975('0xc2'),'Messages':[_['merge'](_0x270c30[_0xf975('0x5c')],{'read':![],'body':_0x270c30['body'][_0xf975('0x5c')],'OpenchannelAccountId':_0x47707c['id'],'UserId':_0x270c30[_0xf975('0x5d')]['id'],'ContactId':_0x171a21['id']})]},{'include':[{'model':db[_0xf975('0x9d')],'as':'Messages'}]})[_0xf975('0x38')](function(_0x48c916){return[_0x48c916,!![]];});});}})[_0xf975('0x94')](function(_0x590659,_0x496a15){if(_0x496a15){return _0x590659;}return db[_0xf975('0x9d')][_0xf975('0x5b')](_[_0xf975('0x52')](_0x270c30['body'],{'read':![],'body':_0x270c30[_0xf975('0x5c')][_0xf975('0x5c')],'OpenchannelAccountId':_0x47707c['id'],'OpenchannelInteractionId':_0x590659['id'],'UserId':_0x270c30['user']['id'],'ContactId':_0x171a21['id']}))[_0xf975('0x38')](function(_0x277666){_0x590659['dataValues'][_0xf975('0xc3')]=[];_0x590659[_0xf975('0xc4')]['Messages']['push'](_0x277666['dataValues']);return _0x590659;});});}})['then'](respondWithResult(_0x40187b,null))[_0xf975('0x2a')](handleError(_0x40187b,null));}; \ No newline at end of file +var _0x403a=['User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','Pause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','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','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','account','CmContact','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId'];(function(_0xf938f9,_0x3b4ada){var _0x488b2d=function(_0xf01364){while(--_0xf01364){_0xf938f9['push'](_0xf938f9['shift']());}};_0x488b2d(++_0x3b4ada);}(_0x403a,0x19e));var _0xa403=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x403a[_0x11a55c];return _0x26c390;};'use strict';var emlformat=require(_0xa403('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa403('0x1'));var rp=require('request-promise');var moment=require(_0xa403('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa403('0x3'));var util=require(_0xa403('0x4'));var path=require(_0xa403('0x5'));var sox=require(_0xa403('0x6'));var csv=require(_0xa403('0x7'));var ejs=require(_0xa403('0x8'));var fs=require('fs');var fs_extra=require(_0xa403('0x9'));var _=require(_0xa403('0xa'));var squel=require(_0xa403('0xb'));var crypto=require(_0xa403('0xc'));var jsforce=require(_0xa403('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa403('0x7'));var querystring=require(_0xa403('0xe'));var Papa=require(_0xa403('0xf'));var Redis=require(_0xa403('0x10'));var authService=require(_0xa403('0x11'));var qs=require(_0xa403('0x12'));var as=require(_0xa403('0x13'));var hardwareService=require(_0xa403('0x14'));var logger=require(_0xa403('0x15'))(_0xa403('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa403('0x17'));var db=require(_0xa403('0x18'))['db'];config['redis']=_[_0xa403('0x19')](config[_0xa403('0x1a')],{'host':_0xa403('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa403('0x1a')]));require(_0xa403('0x1c'))[_0xa403('0x1d')](socket);var jayson=require(_0xa403('0x1e'));var client=jayson[_0xa403('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xa403('0x1f')][_0xa403('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x32b0e4,_0x3516ac,_0x161175,_0x5aa848){return new BPromise(function(_0x329b0a,_0x464e42){var _0x50049e=_0x5aa848||client;return _0x50049e['request'](_0x32b0e4,_0x161175)[_0xa403('0x21')](function(_0x3d4e03){logger[_0xa403('0x22')](_0xa403('0x23'),_0x3516ac,'request\x20sent');logger['debug'](_0xa403('0x24'),_0x3516ac,_0xa403('0x25'),JSON[_0xa403('0x26')](_0x3d4e03));if(_0x3d4e03[_0xa403('0x27')]){if(_0x3d4e03[_0xa403('0x27')][_0xa403('0x28')]===0x1f4){logger[_0xa403('0x27')](_0xa403('0x23'),_0x3516ac,_0x3d4e03[_0xa403('0x27')][_0xa403('0x29')]);return _0x464e42(_0x3d4e03[_0xa403('0x27')][_0xa403('0x29')]);}logger[_0xa403('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x3516ac,_0x3d4e03[_0xa403('0x27')][_0xa403('0x29')]);return _0x329b0a(_0x3d4e03[_0xa403('0x27')][_0xa403('0x29')]);}else{logger[_0xa403('0x22')](_0xa403('0x23'),_0x3516ac,_0xa403('0x25'));_0x329b0a(_0x3d4e03[_0xa403('0x2a')]['message']);}})[_0xa403('0x2b')](function(_0xf09996){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3516ac,_0xf09996);_0x464e42(_0xf09996);});});}function respondWithStatusCode(_0x1102a6,_0x4a8a1c){_0x4a8a1c=_0x4a8a1c||0xcc;return function(_0x5b8e16){if(_0x5b8e16){return _0x1102a6[_0xa403('0x2c')](_0x4a8a1c);}return _0x1102a6[_0xa403('0x2d')](_0x4a8a1c)[_0xa403('0x2e')]();};}function respondWithResult(_0x1fbd9c,_0x39b148){_0x39b148=_0x39b148||0xc8;return function(_0x37b853){if(_0x37b853){return _0x1fbd9c[_0xa403('0x2d')](_0x39b148)['json'](_0x37b853);}};}function respondWithFilteredResult(_0x92ec7e,_0x19500a){return function(_0x1ea022){if(_0x1ea022){var _0x19eb97=typeof _0x19500a[_0xa403('0x2f')]==='undefined'&&typeof _0x19500a[_0xa403('0x30')]===_0xa403('0x31');var _0x50a387=_0x1ea022[_0xa403('0x32')];var _0x360c0c=_0x19eb97?0x0:_0x19500a[_0xa403('0x2f')];var _0x577f41=_0x19eb97?_0x1ea022[_0xa403('0x32')]:_0x19500a[_0xa403('0x2f')]+_0x19500a[_0xa403('0x30')];var _0x13ec23;if(_0x577f41>=_0x50a387){_0x577f41=_0x50a387;_0x13ec23=0xc8;}else{_0x13ec23=0xce;}_0x92ec7e[_0xa403('0x2d')](_0x13ec23);return _0x92ec7e[_0xa403('0x33')](_0xa403('0x34'),_0x360c0c+'-'+_0x577f41+'/'+_0x50a387)['json'](_0x1ea022);}return null;};}function patchUpdates(_0x5e3f5b){return function(_0x50d8b0){try{jsonpatch[_0xa403('0x35')](_0x50d8b0,_0x5e3f5b,!![]);}catch(_0x35b1d5){return BPromise[_0xa403('0x36')](_0x35b1d5);}return _0x50d8b0[_0xa403('0x37')]();};}function saveUpdates(_0x48de0c,_0x4582e6){return function(_0x4487d0){if(_0x4487d0){return _0x4487d0[_0xa403('0x38')](_0x48de0c)[_0xa403('0x21')](function(_0x5a5bc6){return _0x5a5bc6;});}return null;};}function removeEntity(_0x16a476,_0x26f173){return function(_0x27e75e){if(_0x27e75e){return _0x27e75e[_0xa403('0x39')]()[_0xa403('0x21')](function(){var _0x511b47=_0x27e75e[_0xa403('0x3a')]({'plain':!![]});var _0x37c67e=_0xa403('0x3b');return db[_0xa403('0x3c')]['destroy']({'where':{'type':_0x37c67e,'resourceId':_0x511b47['id']}})[_0xa403('0x21')](function(){return _0x27e75e;});})['then'](function(){_0x16a476[_0xa403('0x2d')](0xcc)[_0xa403('0x2e')]();});}};}function handleEntityNotFound(_0x5e6a7e,_0x4c0beb){return function(_0x429c3a){if(!_0x429c3a){_0x5e6a7e[_0xa403('0x2c')](0x194);}return _0x429c3a;};}function handleError(_0x41b99a,_0x49a2ee){_0x49a2ee=_0x49a2ee||0x1f4;return function(_0xe9ef51){logger['error'](_0xe9ef51['stack']);if(_0xe9ef51[_0xa403('0x3d')]){delete _0xe9ef51['name'];}_0x41b99a[_0xa403('0x2d')](_0x49a2ee)[_0xa403('0x3e')](_0xe9ef51);};}exports[_0xa403('0x3f')]=function(_0x3f1330,_0x9d5d99){var _0x50b3c4={'include':[{'model':db['Pause'],'as':_0xa403('0x40')}]},_0x26781a={},_0x387552={'count':0x0,'rows':[]};var _0x628d1=_[_0xa403('0x41')](db[_0xa403('0x42')][_0xa403('0x43')],function(_0x5f6305){return{'name':_0x5f6305[_0xa403('0x44')],'type':_0x5f6305[_0xa403('0x45')][_0xa403('0x46')]};});_0x26781a[_0xa403('0x47')]=_[_0xa403('0x41')](_0x628d1,_0xa403('0x3d'));_0x26781a[_0xa403('0x48')]=_[_0xa403('0x49')](_0x3f1330[_0xa403('0x48')]);_0x26781a[_0xa403('0x4a')]=_[_0xa403('0x4b')](_0x26781a[_0xa403('0x47')],_0x26781a[_0xa403('0x48')]);_0x50b3c4[_0xa403('0x4c')]=_[_0xa403('0x4b')](_0x26781a[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x3f1330[_0xa403('0x48')][_0xa403('0x4d')]));_0x50b3c4[_0xa403('0x4c')]=_0x50b3c4[_0xa403('0x4c')][_0xa403('0x4e')]?_0x50b3c4[_0xa403('0x4c')]:_0x26781a[_0xa403('0x47')];if(!_0x3f1330[_0xa403('0x48')][_0xa403('0x4f')](_0xa403('0x50'))){_0x50b3c4['limit']=qs[_0xa403('0x30')](_0x3f1330[_0xa403('0x48')][_0xa403('0x30')]);_0x50b3c4[_0xa403('0x2f')]=qs[_0xa403('0x2f')](_0x3f1330[_0xa403('0x48')][_0xa403('0x2f')]);}_0x50b3c4[_0xa403('0x51')]=qs[_0xa403('0x52')](_0x3f1330[_0xa403('0x48')][_0xa403('0x52')]);_0x50b3c4[_0xa403('0x53')]=qs['filters'](_[_0xa403('0x54')](_0x3f1330[_0xa403('0x48')],_0x26781a[_0xa403('0x4a')]),_0x628d1);if(_0x3f1330[_0xa403('0x48')][_0xa403('0x55')]){_0x50b3c4[_0xa403('0x53')]=_[_0xa403('0x56')](_0x50b3c4[_0xa403('0x53')],{'$or':_[_0xa403('0x41')](_0x628d1,function(_0x41e1dc){if(_0x41e1dc[_0xa403('0x45')]!=='VIRTUAL'){var _0x16e6d6={};_0x16e6d6[_0x41e1dc['name']]={'$like':'%'+_0x3f1330[_0xa403('0x48')]['filter']+'%'};return _0x16e6d6;}})});}_0x50b3c4=_[_0xa403('0x56')]({},_0x50b3c4,_0x3f1330[_0xa403('0x57')]);var _0x2146a8={'where':_0x50b3c4[_0xa403('0x53')]};return db[_0xa403('0x42')]['count'](_0x2146a8)[_0xa403('0x21')](function(_0x230747){_0x387552['count']=_0x230747;if(_0x3f1330[_0xa403('0x48')]['includeAll']){_0x50b3c4[_0xa403('0x58')]=[{'all':!![]}];}return db[_0xa403('0x42')][_0xa403('0x59')](_0x50b3c4);})[_0xa403('0x21')](function(_0x4cb339){_0x387552[_0xa403('0x5a')]=_0x4cb339;return _0x387552;})[_0xa403('0x21')](respondWithFilteredResult(_0x9d5d99,_0x50b3c4))[_0xa403('0x2b')](handleError(_0x9d5d99,null));};exports[_0xa403('0x5b')]=function(_0x16622c,_0x107bd7){var _0x435454={'raw':![],'where':{'id':_0x16622c[_0xa403('0x5c')]['id']},'include':[{'model':db[_0xa403('0x5d')],'as':_0xa403('0x40')}]},_0x2131e3={};_0x2131e3[_0xa403('0x47')]=_['keys'](db['OpenchannelAccount'][_0xa403('0x43')]);_0x2131e3['query']=_[_0xa403('0x49')](_0x16622c[_0xa403('0x48')]);_0x2131e3[_0xa403('0x4a')]=_['intersection'](_0x2131e3[_0xa403('0x47')],_0x2131e3['query']);_0x435454[_0xa403('0x4c')]=_[_0xa403('0x4b')](_0x2131e3[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x16622c[_0xa403('0x48')][_0xa403('0x4d')]));_0x435454[_0xa403('0x4c')]=_0x435454['attributes'][_0xa403('0x4e')]?_0x435454['attributes']:_0x2131e3[_0xa403('0x47')];if(_0x16622c[_0xa403('0x48')][_0xa403('0x5e')]){_0x435454[_0xa403('0x58')]=[{'all':!![]}];}_0x435454=_[_0xa403('0x56')]({},_0x435454,_0x16622c[_0xa403('0x57')]);return db[_0xa403('0x42')][_0xa403('0x5f')](_0x435454)[_0xa403('0x21')](handleEntityNotFound(_0x107bd7,null))[_0xa403('0x21')](respondWithResult(_0x107bd7,null))[_0xa403('0x2b')](handleError(_0x107bd7,null));};exports[_0xa403('0x60')]=function(_0x556200,_0xdc4525){return db['OpenchannelAccount'][_0xa403('0x60')](_0x556200[_0xa403('0x61')],{})[_0xa403('0x21')](function(_0x7590fa){var _0x1563b0=_0x556200[_0xa403('0x62')][_0xa403('0x3a')]({'plain':!![]});if(!_0x1563b0)throw new Error(_0xa403('0x63'));if(_0x1563b0['role']==='user'){var _0x111dc7=_0x7590fa[_0xa403('0x3a')]({'plain':!![]});var _0x1c9dc6='OpenchannelAccounts';return db['UserProfileSection'][_0xa403('0x5f')]({'where':{'name':_0x1c9dc6,'userProfileId':_0x1563b0[_0xa403('0x64')]},'raw':!![]})['then'](function(_0x16aaf0){if(_0x16aaf0&&_0x16aaf0['autoAssociation']===0x0){return db[_0xa403('0x3c')]['create']({'name':_0x111dc7[_0xa403('0x3d')],'resourceId':_0x111dc7['id'],'type':_0x16aaf0[_0xa403('0x3d')],'sectionId':_0x16aaf0['id']},{})[_0xa403('0x21')](function(){return _0x7590fa;});}else{return _0x7590fa;}})[_0xa403('0x2b')](function(_0x49d93){logger[_0xa403('0x27')](_0xa403('0x65'),_0x49d93);throw _0x49d93;});}return _0x7590fa;})[_0xa403('0x21')](respondWithResult(_0xdc4525,0xc9))[_0xa403('0x2b')](handleError(_0xdc4525,null));};exports[_0xa403('0x38')]=function(_0x52d2f6,_0x4dd4ca){if(_0x52d2f6[_0xa403('0x61')]['id']){delete _0x52d2f6[_0xa403('0x61')]['id'];}return db[_0xa403('0x42')]['find']({'where':{'id':_0x52d2f6['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4dd4ca,null))[_0xa403('0x21')](saveUpdates(_0x52d2f6[_0xa403('0x61')],null))[_0xa403('0x21')](respondWithResult(_0x4dd4ca,null))['catch'](handleError(_0x4dd4ca,null));};exports['destroy']=function(_0x3bd2d1,_0x511c1f){return db[_0xa403('0x42')][_0xa403('0x5f')]({'where':{'id':_0x3bd2d1[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x511c1f,null))[_0xa403('0x21')](removeEntity(_0x511c1f,null))[_0xa403('0x2b')](handleError(_0x511c1f,null));};exports[_0xa403('0x66')]=function(_0xa57fca,_0x84def7){return db[_0xa403('0x42')][_0xa403('0x66')]()[_0xa403('0x21')](respondWithResult(_0x84def7,null))['catch'](handleError(_0x84def7,null));};exports[_0xa403('0x67')]=function(_0x79d7b1,_0x47703a,_0x4eccb3){if(_0x79d7b1[_0xa403('0x61')]['id']){delete _0x79d7b1['body']['id'];}return db[_0xa403('0x42')]['find']({'where':{'id':_0x79d7b1[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x47703a,null))['then'](function(_0x1054a8){if(_0x1054a8){_0x79d7b1[_0xa403('0x61')][_0xa403('0x68')]=_0x1054a8['id'];return db['Disposition'][_0xa403('0x60')](_0x79d7b1[_0xa403('0x61')]);}})['then'](respondWithResult(_0x47703a,null))[_0xa403('0x2b')](handleError(_0x47703a,null));};exports[_0xa403('0x69')]=function(_0x16d6a4,_0x30bbaf,_0x2d51ca){var _0x1e5a28={'raw':![],'where':{}};var _0x152e1c={};var _0x1fac7a={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x16d6a4[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x30bbaf,null))[_0xa403('0x21')](function(_0x2db173){if(_0x2db173){_0x152e1c['model']=_[_0xa403('0x49')](db[_0xa403('0x6a')][_0xa403('0x43')]);_0x152e1c[_0xa403('0x48')]=_[_0xa403('0x49')](_0x16d6a4[_0xa403('0x48')]);_0x152e1c[_0xa403('0x4a')]=_[_0xa403('0x4b')](_0x152e1c[_0xa403('0x47')],_0x152e1c[_0xa403('0x48')]);_0x1e5a28[_0xa403('0x4c')]=_[_0xa403('0x4b')](_0x152e1c[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x16d6a4[_0xa403('0x48')]['fields']));_0x1e5a28[_0xa403('0x4c')]=_0x1e5a28[_0xa403('0x4c')]['length']?_0x1e5a28[_0xa403('0x4c')]:_0x152e1c[_0xa403('0x47')];if(!_0x16d6a4[_0xa403('0x48')][_0xa403('0x4f')](_0xa403('0x50'))){_0x1e5a28[_0xa403('0x30')]=qs['limit'](_0x16d6a4[_0xa403('0x48')]['limit']);_0x1e5a28[_0xa403('0x2f')]=qs[_0xa403('0x2f')](_0x16d6a4[_0xa403('0x48')][_0xa403('0x2f')]);}_0x1e5a28['order']=qs['sort'](_0x16d6a4[_0xa403('0x48')][_0xa403('0x52')]);_0x1e5a28[_0xa403('0x53')]=qs[_0xa403('0x4a')](_['pick'](_0x16d6a4[_0xa403('0x48')],_0x152e1c['filters']));_0x1e5a28[_0xa403('0x53')][_0xa403('0x68')]=_0x2db173['id'];if(_0x16d6a4[_0xa403('0x48')][_0xa403('0x55')]){_0x1e5a28[_0xa403('0x53')]=_[_0xa403('0x56')](_0x1e5a28[_0xa403('0x53')],{'$or':_[_0xa403('0x41')](_0x1e5a28[_0xa403('0x4c')],function(_0x26935e){var _0x24c284={};_0x24c284[_0x26935e]={'$like':'%'+_0x16d6a4[_0xa403('0x48')][_0xa403('0x55')]+'%'};return _0x24c284;})});}_0x1e5a28=_[_0xa403('0x56')]({},_0x1e5a28,_0x16d6a4[_0xa403('0x57')]);return db[_0xa403('0x6a')][_0xa403('0x32')]({'where':_0x1e5a28['where']})['then'](function(_0x15ef4f){_0x1fac7a['count']=_0x15ef4f;if(_0x16d6a4[_0xa403('0x48')][_0xa403('0x5e')]){_0x1e5a28['include']=[{'all':!![]}];}return db['Disposition'][_0xa403('0x59')](_0x1e5a28);})[_0xa403('0x21')](function(_0x2a9b6f){_0x1fac7a[_0xa403('0x5a')]=_0x2a9b6f;return _0x1fac7a;});}})[_0xa403('0x21')](respondWithFilteredResult(_0x30bbaf,_0x1e5a28))[_0xa403('0x2b')](handleError(_0x30bbaf,null));};exports[_0xa403('0x6b')]=function(_0x5e5a0d,_0x1f7380,_0x4a025e){return db[_0xa403('0x42')]['find']({'where':{'id':_0x5e5a0d[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x1f7380,null))[_0xa403('0x21')](function(_0x4b10b3){if(_0x4b10b3){return _0x4b10b3[_0xa403('0x6b')](_0x5e5a0d[_0xa403('0x48')][_0xa403('0x6c')]);}})['then'](respondWithStatusCode(_0x1f7380,null))[_0xa403('0x2b')](handleError(_0x1f7380,null));};exports[_0xa403('0x6d')]=function(_0x169a52,_0x4cdce6,_0x1b2748){if(_0x169a52['body']['id']){delete _0x169a52[_0xa403('0x61')]['id'];}return db[_0xa403('0x42')][_0xa403('0x5f')]({'where':{'id':_0x169a52[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x4cdce6,null))['then'](function(_0x2196d7){if(_0x2196d7){_0x169a52[_0xa403('0x61')][_0xa403('0x68')]=_0x2196d7['id'];return db['CannedAnswer'][_0xa403('0x60')](_0x169a52[_0xa403('0x61')]);}})[_0xa403('0x21')](respondWithResult(_0x4cdce6,null))[_0xa403('0x2b')](handleError(_0x4cdce6,null));};exports[_0xa403('0x6e')]=function(_0x11d026,_0x364ee0,_0x4e7c55){var _0x2237d1={'raw':![],'where':{}};var _0x19f0fe={};var _0x143d60={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa403('0x6f')]({'where':{'id':_0x11d026[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x364ee0,null))[_0xa403('0x21')](function(_0x474b6f){if(_0x474b6f){_0x19f0fe[_0xa403('0x47')]=_[_0xa403('0x49')](db['CannedAnswer'][_0xa403('0x43')]);_0x19f0fe['query']=_[_0xa403('0x49')](_0x11d026[_0xa403('0x48')]);_0x19f0fe[_0xa403('0x4a')]=_[_0xa403('0x4b')](_0x19f0fe[_0xa403('0x47')],_0x19f0fe[_0xa403('0x48')]);_0x2237d1[_0xa403('0x4c')]=_[_0xa403('0x4b')](_0x19f0fe[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x11d026['query'][_0xa403('0x4d')]));_0x2237d1[_0xa403('0x4c')]=_0x2237d1[_0xa403('0x4c')]['length']?_0x2237d1[_0xa403('0x4c')]:_0x19f0fe['model'];if(!_0x11d026[_0xa403('0x48')]['hasOwnProperty'](_0xa403('0x50'))){_0x2237d1[_0xa403('0x30')]=qs['limit'](_0x11d026[_0xa403('0x48')][_0xa403('0x30')]);_0x2237d1[_0xa403('0x2f')]=qs[_0xa403('0x2f')](_0x11d026[_0xa403('0x48')][_0xa403('0x2f')]);}_0x2237d1[_0xa403('0x51')]=qs[_0xa403('0x52')](_0x11d026[_0xa403('0x48')][_0xa403('0x52')]);_0x2237d1['where']=qs[_0xa403('0x4a')](_['pick'](_0x11d026[_0xa403('0x48')],_0x19f0fe[_0xa403('0x4a')]));_0x2237d1[_0xa403('0x53')][_0xa403('0x68')]=_0x474b6f['id'];if(_0x11d026[_0xa403('0x48')][_0xa403('0x55')]){_0x2237d1[_0xa403('0x53')]=_[_0xa403('0x56')](_0x2237d1[_0xa403('0x53')],{'$or':_[_0xa403('0x41')](_0x2237d1[_0xa403('0x4c')],function(_0x5937a7){var _0x336d34={};_0x336d34[_0x5937a7]={'$like':'%'+_0x11d026[_0xa403('0x48')][_0xa403('0x55')]+'%'};return _0x336d34;})});}_0x2237d1=_['merge']({},_0x2237d1,_0x11d026[_0xa403('0x57')]);return db[_0xa403('0x70')][_0xa403('0x32')]({'where':_0x2237d1['where']})[_0xa403('0x21')](function(_0x70ae7f){_0x143d60[_0xa403('0x32')]=_0x70ae7f;if(_0x11d026[_0xa403('0x48')]['includeAll']){_0x2237d1[_0xa403('0x58')]=[{'all':!![]}];}return db[_0xa403('0x70')][_0xa403('0x59')](_0x2237d1);})[_0xa403('0x21')](function(_0x3a24c9){_0x143d60[_0xa403('0x5a')]=_0x3a24c9;return _0x143d60;});}})[_0xa403('0x21')](respondWithFilteredResult(_0x364ee0,_0x2237d1))[_0xa403('0x2b')](handleError(_0x364ee0,null));};exports[_0xa403('0x71')]=function(_0x5d561e,_0x13c5b7,_0x5ef00a){return db['OpenchannelAccount']['find']({'where':{'id':_0x5d561e[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x13c5b7,null))['then'](function(_0xf5b7db){if(_0xf5b7db){return _0xf5b7db[_0xa403('0x71')](_0x5d561e[_0xa403('0x48')][_0xa403('0x6c')]);}})[_0xa403('0x21')](respondWithStatusCode(_0x13c5b7,null))[_0xa403('0x2b')](handleError(_0x13c5b7,null));};exports[_0xa403('0x72')]=function(_0x397723,_0x40a678,_0xd9f72e){var _0x23c865={'body':_0x397723[_0xa403('0x61')],'channel':'openchannel'};var _0x500aef=[];var _0x4dc080=[];var _0x2e65ff={};var _0x1c029e=![];return db['CmContact'][_0xa403('0x66')]()['then'](function(_0x42f694){if(!_0x42f694){throw new db[(_0xa403('0x73'))]['ValidationError'](_0xa403('0x74'));}_0x500aef=_[_0xa403('0x75')](_[_0xa403('0x49')](_0x42f694),['createdAt',_0xa403('0x76')]);_0x4dc080=_[_0xa403('0x75')](_[_0xa403('0x49')](_0x42f694),[_0xa403('0x77'),_0xa403('0x76'),_0xa403('0x78'),_0xa403('0x79')]);if(_0x397723['body']['id']){delete _0x397723[_0xa403('0x61')]['id'];}if(_[_0xa403('0x7a')](_0x397723[_0xa403('0x61')][_0xa403('0x7b')])){throw new db[(_0xa403('0x73'))]['ValidationError'](_0xa403('0x7c'));}if(_[_0xa403('0x7a')](_0x397723[_0xa403('0x61')][_0xa403('0x61')])||_0x397723[_0xa403('0x61')]['body']===''){throw new db[(_0xa403('0x73'))][(_0xa403('0x7d'))](_0xa403('0x7e'));}if(_['isNil'](_0x397723[_0xa403('0x61')][_0xa403('0x7f')])){throw new db['Sequelize'][(_0xa403('0x7d'))](_0xa403('0x80')+_0x4dc080);}if(!_[_0xa403('0x81')](_0x4dc080,_0x397723['body'][_0xa403('0x7f')])){throw new db[(_0xa403('0x73'))][(_0xa403('0x7d'))](_0xa403('0x82')+_0x4dc080);}_0x2e65ff[_0x397723['body'][_0xa403('0x7f')]]=_0x397723[_0xa403('0x61')][_0xa403('0x7b')];})['then'](function(){return db[_0xa403('0x42')][_0xa403('0x5f')]({'where':{'id':_0x397723[_0xa403('0x5c')]['id']},'include':[{'model':db[_0xa403('0x83')],'as':_0xa403('0x84'),'include':[{'model':db['CmContact'],'as':_0xa403('0x85'),'where':_0x2e65ff,'limit':0x1,'order':[[_0xa403('0x76'),_0xa403('0x86')]]}]},{'model':db[_0xa403('0x87')],'as':_0xa403('0x88')}]});})['then'](handleEntityNotFound(_0x40a678,null))[_0xa403('0x21')](function(_0x1b1cd8){if(_0x1b1cd8&&_0x1b1cd8[_0xa403('0x84')]){_0x23c865['account']=_0x1b1cd8;_0x23c865[_0xa403('0x89')]=_0x1b1cd8[_0xa403('0x88')];_0x23c865[_0xa403('0x8a')]=_0x1b1cd8[_0xa403('0x84')];_0x23c865[_0xa403('0x89')]=_[_0xa403('0x8b')](_0x23c865[_0xa403('0x89')],[_0xa403('0x8c')],['asc']);if(_0x23c865[_0xa403('0x8d')][_0xa403('0x88')]){delete _0x23c865[_0xa403('0x8d')][_0xa403('0x88')];}if(_0x23c865[_0xa403('0x8d')][_0xa403('0x84')]&&_0x23c865['account'][_0xa403('0x84')]['Contacts'][_0xa403('0x4e')]){return _0x23c865[_0xa403('0x8d')][_0xa403('0x84')]['Contacts'][0x0];}var _0xecacaf=_[_0xa403('0x19')](_0x397723[_0xa403('0x61')],{'firstName':_0x397723['body'][_0xa403('0x7b')],'ListId':_0x1b1cd8[_0xa403('0x79')]});_0xecacaf[_0x397723['body'][_0xa403('0x7f')]]=_0x397723[_0xa403('0x61')]['from'];return db[_0xa403('0x8e')]['create'](_0xecacaf,{'fields':_0x500aef,'raw':!![]});}})['then'](handleEntityNotFound(_0x40a678,null))['then'](function(_0x29e07d){_0x23c865[_0xa403('0x8f')]=_0x29e07d;if(_0x29e07d){var _0x16c315={'ContactId':_0x29e07d['id'],'OpenchannelAccountId':_0x397723[_0xa403('0x5c')]['id'],'from':(_0x29e07d[_0xa403('0x90')]||'')+'\x20'+(_0x29e07d[_0xa403('0x91')]||'')};var _0x5ca8d={'OpenchannelAccountId':_0x397723[_0xa403('0x5c')]['id'],'closed':![]};if(_0x397723['body'][_0xa403('0x92')]){_0x5ca8d['threadId']=_0x397723[_0xa403('0x61')][_0xa403('0x92')];return db['OpenchannelInteraction'][_0xa403('0x5f')]({'where':_0x5ca8d})['then'](function(_0x4a608d){if(_0x4a608d){return[_0x4a608d,![]];}_0x16c315[_0xa403('0x92')]=_0x397723[_0xa403('0x61')][_0xa403('0x92')];_0x16c315[_0xa403('0x93')]=_0x397723['body']['externalUrl'];return db['OpenchannelInteraction'][_0xa403('0x60')](_0x16c315)[_0xa403('0x21')](function(_0x2bc41b){return[_0x2bc41b,!![]];});});}else{_0x5ca8d['threadId']=null;}_0x5ca8d[_0xa403('0x94')]=_0x29e07d['id'];return db[_0xa403('0x95')][_0xa403('0x5f')]({'where':_0x5ca8d})[_0xa403('0x21')](function(_0x3d0a9e){if(_0x3d0a9e){return[_0x3d0a9e,![]];}return db[_0xa403('0x95')][_0xa403('0x60')](_0x16c315)[_0xa403('0x21')](function(_0x375d87){return[_0x375d87,!![]];});});}})[_0xa403('0x96')](function(_0x3795ab,_0x1ae960){if(_0x3795ab){_0x1c029e=_0x1ae960;if(!_0x1ae960){var _0x3b17a9={'from':(_0x23c865[_0xa403('0x8f')][_0xa403('0x90')]||'')+'\x20'+(_0x23c865[_0xa403('0x8f')][_0xa403('0x91')]||'')};if(_0x397723['body'][_0xa403('0x92')]&&_0x397723[_0xa403('0x61')][_0xa403('0x97')]&&_0x397723[_0xa403('0x61')][_0xa403('0x92')]!=_0x397723[_0xa403('0x61')]['messageId']){_0x3b17a9[_0xa403('0x92')]=_0x397723[_0xa403('0x61')][_0xa403('0x97')];}return _0x3795ab[_0xa403('0x38')](_0x3b17a9);}else{return _0x3795ab;}}})[_0xa403('0x21')](function(_0x276f7e){_0x23c865['interaction']=_0x276f7e[_0xa403('0x3a')]({'plain':!![]});_0x23c865[_0xa403('0x98')][_0xa403('0x99')]=_0x1c029e;if(_0x23c865['interaction'][_0xa403('0x99')]){if(_0x23c865[_0xa403('0x8d')]['autoclose']){_0x23c865[_0xa403('0x89')][_0xa403('0x9a')]({'id':0x0,'priority':_0x23c865[_0xa403('0x89')][_0xa403('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xa403('0x9b')});}}return db[_0xa403('0x9c')][_0xa403('0x60')]({'body':_0x397723[_0xa403('0x61')][_0xa403('0x61')],'OpenchannelAccountId':_0x397723[_0xa403('0x5c')]['id'],'OpenchannelInteractionId':_0x276f7e['id'],'direction':'in','ContactId':_0x23c865[_0xa403('0x8f')]['id'],'AttachmentId':_0x397723[_0xa403('0x61')][_0xa403('0x9d')]});})[_0xa403('0x21')](function(_0x31da03){_0x23c865[_0xa403('0x29')]=_0x31da03;if(_0x23c865[_0xa403('0x98')][_0xa403('0x9e')]){return db[_0xa403('0x9f')][_0xa403('0x5f')]({'attributes':['id','name'],'where':{'id':_0x23c865[_0xa403('0x98')][_0xa403('0x9e')]}})[_0xa403('0x21')](function(_0x5b155f){if(_0x5b155f){_0x23c865[_0xa403('0x89')][_0xa403('0xa0')]({'id':0x0,'priority':0x0,'app':_0xa403('0xa1'),'appdata':_0x5b155f[_0xa403('0x3d')]+','+(_0x23c865[_0xa403('0x8d')][_0xa403('0xa2')]||0xa),'interval':_0xa403('0x9b')});_0x23c865[_0xa403('0xa3')]=![];}return respondWithRpcPromise(_0xa403('0xa4'),'startRouting',_0x23c865);});}return respondWithRpcPromise(_0xa403('0xa4'),_0xa403('0xa5'),_0x23c865);})['then'](function(_0xad749e){respondWithRpcPromise('EventManager',_0xa403('0xa6'),{'event':'notify','message':_0xad749e},client9002);return _0xad749e;})[_0xa403('0x21')](respondWithResult(_0x40a678,null))[_0xa403('0x2b')](handleError(_0x40a678,null));};exports[_0xa403('0xa7')]=function(_0x10a91b,_0x882ca7){var _0x41fb73=_0x10a91b[_0xa403('0x5c')]['id'];var _0x192866=_0x10a91b[_0xa403('0x61')];var _0x4b483b=0xc8;var _0x56c4b4=null;return db[_0xa403('0xa8')][_0xa403('0xa9')]({'isolationLevel':db[_0xa403('0xa8')]['Transaction'][_0xa403('0xaa')]['READ_COMMITTED']},function(_0x373761){return db[_0xa403('0x42')][_0xa403('0x6f')]({'where':{'id':_0x41fb73},'transaction':_0x373761})[_0xa403('0x21')](function(_0x2488d6){if(_0x2488d6){return db[_0xa403('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x41fb73},'transaction':_0x373761})[_0xa403('0x21')](function(){var _0x14bd8c=_[_0xa403('0x41')](_0x192866,function(_0x2c1185){_0x2c1185[_0xa403('0x68')]=_0x41fb73;return _0x2c1185;});return db['OpenchannelApplication'][_0xa403('0xab')](_0x14bd8c,{'transaction':_0x373761});});}else{_0x4b483b=0x194;_0x56c4b4=[];}});})[_0xa403('0x21')](function(){if(_0x4b483b!==0x194){return db[_0xa403('0x87')][_0xa403('0xac')]({'where':{'OpenchannelAccountId':_0x41fb73},'order':'priority'})['then'](function(_0x36508d){_0x56c4b4=_0x36508d;});}})[_0xa403('0x2b')](function(_0x4a56f8){_0x4b483b=0x1f4;logger['error'](_0x4a56f8[_0xa403('0xad')]);if(_0x4a56f8[_0xa403('0x3d')]){delete _0x4a56f8[_0xa403('0x3d')];}_0x56c4b4=_0x4a56f8;})['finally'](function(){if(_0x56c4b4===null){_0x882ca7['sendStatus'](_0x4b483b);}else{if(_0x4b483b===0x1f4){_0x882ca7[_0xa403('0x2d')](_0x4b483b)['send'](_0x56c4b4);}else{_0x882ca7['status'](_0x4b483b)['json'](_0x56c4b4);}}});};exports[_0xa403('0xae')]=function(_0x2862cc,_0x21b21b,_0x1c975e){var _0x419ed8={};var _0x4360d1={};var _0x53ff4a;var _0x59d49d;return db[_0xa403('0x42')][_0xa403('0x6f')]({'where':{'id':_0x2862cc[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x21b21b,null))[_0xa403('0x21')](function(_0x16080e){if(_0x16080e){_0x53ff4a=_0x16080e;_0x4360d1['model']=_[_0xa403('0x49')](db[_0xa403('0x87')][_0xa403('0x43')]);_0x4360d1['query']=_['keys'](_0x2862cc[_0xa403('0x48')]);_0x4360d1[_0xa403('0x4a')]=_[_0xa403('0x4b')](_0x4360d1[_0xa403('0x47')],_0x4360d1['query']);_0x419ed8[_0xa403('0x4c')]=_[_0xa403('0x4b')](_0x4360d1[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x2862cc['query'][_0xa403('0x4d')]));_0x419ed8[_0xa403('0x4c')]=_0x419ed8[_0xa403('0x4c')][_0xa403('0x4e')]?_0x419ed8[_0xa403('0x4c')]:_0x4360d1[_0xa403('0x47')];_0x419ed8[_0xa403('0x51')]=qs[_0xa403('0x52')](_0x2862cc[_0xa403('0x48')][_0xa403('0x52')]);_0x419ed8[_0xa403('0x53')]=qs[_0xa403('0x4a')](_[_0xa403('0x54')](_0x2862cc['query'],_0x4360d1[_0xa403('0x4a')]));if(_0x2862cc[_0xa403('0x48')][_0xa403('0x55')]){_0x419ed8[_0xa403('0x53')]=_[_0xa403('0x56')](_0x419ed8[_0xa403('0x53')],{'$or':_[_0xa403('0x41')](_0x419ed8[_0xa403('0x4c')],function(_0x9437a4){var _0x5ee705={};_0x5ee705[_0x9437a4]={'$like':'%'+_0x2862cc[_0xa403('0x48')][_0xa403('0x55')]+'%'};return _0x5ee705;})});}_0x419ed8=_[_0xa403('0x56')]({},_0x419ed8,_0x2862cc[_0xa403('0x57')]);return _0x53ff4a[_0xa403('0xae')](_0x419ed8);}})[_0xa403('0x21')](function(_0x76ba57){if(_0x76ba57){_0x59d49d=_0x76ba57['length'];if(!_0x2862cc[_0xa403('0x48')][_0xa403('0x4f')](_0xa403('0x50'))){_0x419ed8[_0xa403('0x30')]=qs[_0xa403('0x30')](_0x2862cc[_0xa403('0x48')][_0xa403('0x30')]);_0x419ed8[_0xa403('0x2f')]=qs[_0xa403('0x2f')](_0x2862cc[_0xa403('0x48')][_0xa403('0x2f')]);}return _0x53ff4a[_0xa403('0xae')](_0x419ed8);}})['then'](function(_0x4271fc){if(_0x4271fc){return _0x4271fc?{'count':_0x59d49d,'rows':_0x4271fc}:null;}})[_0xa403('0x21')](respondWithResult(_0x21b21b,null))['catch'](handleError(_0x21b21b,null));};exports[_0xa403('0xaf')]=function(_0x2d245e,_0x4c5623,_0x5c0c7d){var _0x410818={'raw':![],'where':{}};var _0x30fd13={};var _0x1e17cf={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2d245e[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x4c5623,null))['then'](function(_0x1e3607){if(_0x1e3607){_0x30fd13[_0xa403('0x47')]=_[_0xa403('0x49')](db['OpenchannelInteraction'][_0xa403('0x43')]);_0x30fd13[_0xa403('0x48')]=_[_0xa403('0x49')](_0x2d245e[_0xa403('0x48')]);_0x30fd13[_0xa403('0x4a')]=_['intersection'](_0x30fd13[_0xa403('0x47')],_0x30fd13[_0xa403('0x48')]);_0x410818[_0xa403('0x4c')]=_['intersection'](_0x30fd13[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x2d245e['query'][_0xa403('0x4d')]));_0x410818[_0xa403('0x4c')]=_0x410818['attributes']['length']?_0x410818[_0xa403('0x4c')]:_0x30fd13[_0xa403('0x47')];if(!_0x2d245e[_0xa403('0x48')]['hasOwnProperty'](_0xa403('0x50'))){_0x410818[_0xa403('0x30')]=qs['limit'](_0x2d245e[_0xa403('0x48')]['limit']);_0x410818['offset']=qs[_0xa403('0x2f')](_0x2d245e['query'][_0xa403('0x2f')]);}_0x410818[_0xa403('0x51')]=qs['sort'](_0x2d245e['query'][_0xa403('0x52')]);_0x410818['where']=qs['filters'](_[_0xa403('0x54')](_0x2d245e[_0xa403('0x48')],_0x30fd13['filters']));_0x410818[_0xa403('0x53')][_0xa403('0x68')]=_0x1e3607['id'];if(_0x2d245e[_0xa403('0x48')][_0xa403('0x55')]){_0x410818[_0xa403('0x53')]=_['merge'](_0x410818['where'],{'$or':_[_0xa403('0x41')](_0x410818[_0xa403('0x4c')],function(_0x423b9f){var _0x4a4748={};_0x4a4748[_0x423b9f]={'$like':'%'+_0x2d245e[_0xa403('0x48')]['filter']+'%'};return _0x4a4748;})});}_0x410818=_[_0xa403('0x56')]({},_0x410818,_0x2d245e['options']);return db['OpenchannelInteraction']['count']({'where':_0x410818[_0xa403('0x53')]})['then'](function(_0x4603d4){_0x1e17cf[_0xa403('0x32')]=_0x4603d4;if(_0x2d245e[_0xa403('0x48')][_0xa403('0x5e')]){_0x410818['include']=[{'model':db[_0xa403('0x8e')],'as':_0xa403('0xb0'),'required':![]},{'model':db['User'],'as':_0xa403('0xb1'),'attributes':[_0xa403('0x3d'),'fullname',_0xa403('0xb2')],'required':![]},{'model':db['Tag'],'as':_0xa403('0xb3'),'attributes':['id',_0xa403('0x3d'),_0xa403('0xb4')],'where':_0x2d245e[_0xa403('0x48')][_0xa403('0xb5')]?{'id':_0x2d245e[_0xa403('0x48')][_0xa403('0xb5')]}:undefined,'required':_0x2d245e[_0xa403('0x48')]['tag']?!![]:![]}];}return db[_0xa403('0x95')][_0xa403('0x59')](_0x410818);})['then'](function(_0x374b25){_0x1e17cf[_0xa403('0x5a')]=_0x374b25;return _0x1e17cf;});}})['then'](respondWithFilteredResult(_0x4c5623,_0x410818))[_0xa403('0x2b')](handleError(_0x4c5623,null));};exports['addAgents']=function(_0x3b1a26,_0x31c91d,_0x793844){return db[_0xa403('0x42')][_0xa403('0x5f')]({'where':{'id':_0x3b1a26[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x31c91d,null))[_0xa403('0x21')](function(_0x21989c){if(_0x21989c){return _0x21989c[_0xa403('0xb6')](_0x3b1a26[_0xa403('0x61')]['ids'],_[_0xa403('0xb7')](_0x3b1a26[_0xa403('0x61')],[_0xa403('0x6c'),'id'])||{})[_0xa403('0x96')](function(_0x4f630f){for(var _0x46a48f=0x0;_0x46a48f<_0x3b1a26['body']['ids']['length'];_0x46a48f+=0x1){socket[_0xa403('0xb8')](_0xa403('0xb9'),{'UserId':Number(_0x3b1a26[_0xa403('0x61')][_0xa403('0x6c')][_0x46a48f]),'OpenchannelAccountId':Number(_0x3b1a26[_0xa403('0x5c')]['id'])});}return _0x4f630f;});}})[_0xa403('0x21')](respondWithResult(_0x31c91d,null))['catch'](handleError(_0x31c91d,null));};exports[_0xa403('0xba')]=function(_0x4fd67b,_0x576bfd,_0x2de76d){return db[_0xa403('0x42')]['find']({'where':{'id':_0x4fd67b[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x576bfd,null))[_0xa403('0x21')](function(_0x37788a){if(_0x37788a){return _0x37788a[_0xa403('0xba')](_0x4fd67b[_0xa403('0x48')][_0xa403('0x6c')])[_0xa403('0x21')](function(){if(_['isArray'](_0x4fd67b['query']['ids'])){for(var _0x503cd9=0x0;_0x503cd9<_0x4fd67b[_0xa403('0x48')][_0xa403('0x6c')][_0xa403('0x4e')];_0x503cd9+=0x1){socket['emit'](_0xa403('0xbb'),{'UserId':Number(_0x4fd67b[_0xa403('0x48')][_0xa403('0x6c')][_0x503cd9]),'OpenchannelAccountId':Number(_0x4fd67b[_0xa403('0x5c')]['id'])});}}else{socket[_0xa403('0xb8')](_0xa403('0xbb'),{'UserId':Number(_0x4fd67b[_0xa403('0x48')][_0xa403('0x6c')]),'OpenchannelAccountId':Number(_0x4fd67b[_0xa403('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x576bfd,null))['catch'](handleError(_0x576bfd,null));};exports[_0xa403('0xbc')]=function(_0x3b1098,_0xd6c5b7,_0x505d57){var _0x39c07d={};var _0x18c27a={};var _0x39ea65;var _0x58d99c;return db[_0xa403('0x42')][_0xa403('0x6f')]({'where':{'id':_0x3b1098[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0xd6c5b7,null))[_0xa403('0x21')](function(_0x3cb2ee){if(_0x3cb2ee){_0x39ea65=_0x3cb2ee;_0x18c27a['model']=_[_0xa403('0x49')](db[_0xa403('0x9f')][_0xa403('0x43')]);_0x18c27a[_0xa403('0x48')]=_[_0xa403('0x49')](_0x3b1098[_0xa403('0x48')]);_0x18c27a[_0xa403('0x4a')]=_[_0xa403('0x4b')](_0x18c27a[_0xa403('0x47')],_0x18c27a[_0xa403('0x48')]);_0x39c07d[_0xa403('0x4c')]=_['intersection'](_0x18c27a[_0xa403('0x47')],qs[_0xa403('0x4d')](_0x3b1098[_0xa403('0x48')]['fields']));_0x39c07d['attributes']=_0x39c07d[_0xa403('0x4c')]['length']?_0x39c07d[_0xa403('0x4c')]:_0x18c27a[_0xa403('0x47')];_0x39c07d[_0xa403('0x51')]=qs['sort'](_0x3b1098[_0xa403('0x48')][_0xa403('0x52')]);_0x39c07d[_0xa403('0x53')]=qs[_0xa403('0x4a')](_[_0xa403('0x54')](_0x3b1098[_0xa403('0x48')],_0x18c27a[_0xa403('0x4a')]));if(_0x3b1098[_0xa403('0x48')]['filter']){_0x39c07d['where']=_[_0xa403('0x56')](_0x39c07d['where'],{'$or':_[_0xa403('0x41')](_0x39c07d[_0xa403('0x4c')],function(_0x50059d){var _0x59088f={};_0x59088f[_0x50059d]={'$like':'%'+_0x3b1098[_0xa403('0x48')]['filter']+'%'};return _0x59088f;})});}_0x39c07d=_[_0xa403('0x56')]({},_0x39c07d,_0x3b1098[_0xa403('0x57')]);return _0x39ea65[_0xa403('0xbc')](_0x39c07d);}})[_0xa403('0x21')](function(_0x254de6){if(_0x254de6){_0x58d99c=_0x254de6['length'];if(!_0x3b1098[_0xa403('0x48')][_0xa403('0x4f')](_0xa403('0x50'))){_0x39c07d['limit']=qs['limit'](_0x3b1098[_0xa403('0x48')]['limit']);_0x39c07d[_0xa403('0x2f')]=qs[_0xa403('0x2f')](_0x3b1098[_0xa403('0x48')][_0xa403('0x2f')]);}return _0x39ea65[_0xa403('0xbc')](_0x39c07d);}})[_0xa403('0x21')](function(_0x114663){if(_0x114663){return _0x114663?{'count':_0x58d99c,'rows':_0x114663}:null;}})[_0xa403('0x21')](respondWithResult(_0xd6c5b7,null))[_0xa403('0x2b')](handleError(_0xd6c5b7,null));};exports[_0xa403('0x3e')]=function(_0x58936b,_0x1902d5,_0x40e2ae){var _0x28c415,_0x239ff0,_0x5ddc29;if(_[_0xa403('0x7a')](_0x58936b[_0xa403('0x61')][_0xa403('0x61')])||_0x58936b[_0xa403('0x61')][_0xa403('0x61')]===''){throw new db[(_0xa403('0x73'))][(_0xa403('0x7d'))](_0xa403('0x7e'));}if(_['isNil'](_0x58936b[_0xa403('0x61')]['to'])){}_0x28c415=_0x58936b[_0xa403('0x61')]['to'];return db[_0xa403('0x42')][_0xa403('0x6f')]({'where':{'id':_0x58936b[_0xa403('0x5c')]['id']}})[_0xa403('0x21')](handleEntityNotFound(_0x1902d5,null))[_0xa403('0x21')](function(_0x46c2e9){if(_0x46c2e9){return db['OpenchannelAccount'][_0xa403('0x5f')]({'where':{'id':_0x46c2e9['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa403('0x8e')],'as':_0xa403('0x85'),'where':{[_0x46c2e9[_0xa403('0x7f')]]:_0x28c415},'limit':0x1,'order':[[_0xa403('0x76'),_0xa403('0x86')]]}]}]})[_0xa403('0x21')](handleEntityNotFound(_0x1902d5,null))[_0xa403('0x21')](function(_0x145d20){if(_0x145d20&&_0x145d20['List']){_0x239ff0=_0x145d20[_0xa403('0x3a')]({'plain':!![]});if(_0x239ff0[_0xa403('0x84')]&&_0x239ff0[_0xa403('0x84')][_0xa403('0x85')][_0xa403('0x4e')]){return _0x239ff0['List']['Contacts'][0x0];}return db['CmContact'][_0xa403('0x60')](_[_0xa403('0x19')](_0x58936b['body'],{'firstName':_0x28c415,[_0x145d20['mapKey']]:_0x28c415,'phone':_0x28c415,'ListId':_0x239ff0[_0xa403('0x79')]}));}})[_0xa403('0x21')](handleEntityNotFound(_0x1902d5,null))['then'](function(_0x639d49){if(_0x639d49){_0x5ddc29=_0x639d49;return db['OpenchannelInteraction'][_0xa403('0x5f')]({'where':{'ContactId':_0x5ddc29['id'],'closed':![],'OpenchannelAccountId':_0x239ff0['id']}})[_0xa403('0x21')](function(_0x4d35c6){if(_0x4d35c6){return[_0x4d35c6,![]];}return db[_0xa403('0x95')][_0xa403('0x60')]({'UserId':_0x58936b[_0xa403('0x62')]['id'],'ContactId':_0x5ddc29['id'],'OpenchannelAccountId':_0x239ff0['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0xa403('0x56')](_0x58936b[_0xa403('0x61')],{'read':![],'body':_0x58936b[_0xa403('0x61')][_0xa403('0x61')],'OpenchannelAccountId':_0x239ff0['id'],'UserId':_0x58936b['user']['id'],'ContactId':_0x5ddc29['id']})]},{'include':[{'model':db[_0xa403('0x9c')],'as':_0xa403('0xbd')}]})[_0xa403('0x21')](function(_0x3ac63a){return[_0x3ac63a,!![]];});});}})['spread'](function(_0x3c1887,_0x58aaa2){if(_0x58aaa2){return _0x3c1887;}return db[_0xa403('0x9c')]['create'](_[_0xa403('0x56')](_0x58936b[_0xa403('0x61')],{'read':![],'body':_0x58936b[_0xa403('0x61')][_0xa403('0x61')],'OpenchannelAccountId':_0x239ff0['id'],'OpenchannelInteractionId':_0x3c1887['id'],'UserId':_0x58936b[_0xa403('0x62')]['id'],'ContactId':_0x5ddc29['id']}))[_0xa403('0x21')](function(_0x258092){_0x3c1887[_0xa403('0xbe')][_0xa403('0xbd')]=[];_0x3c1887[_0xa403('0xbe')]['Messages']['push'](_0x258092[_0xa403('0xbe')]);return _0x3c1887;});});}})[_0xa403('0x21')](respondWithResult(_0x1902d5,null))[_0xa403('0x2b')](handleError(_0x1902d5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bd68a8c..0d9fe45 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x13328d,_0x8ec6df){var _0x34d2e3=function(_0x6e9197){while(--_0x6e9197){_0x13328d['push'](_0x13328d['shift']());}};_0x34d2e3(++_0x8ec6df);}(_0xac4a,0x13f));var _0xaac4=function(_0x455692,_0xe4a13c){_0x455692=_0x455692-0x0;var _0x3c5ec0=_0xac4a[_0x455692];return _0x3c5ec0;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x13f8a0,_0x5b1e09){var _0x2d345=function(_0x28d956){while(--_0x28d956){_0x13f8a0['push'](_0x13f8a0['shift']());}};_0x2d345(++_0x5b1e09);}(_0x9348,0x10d));var _0x8934=function(_0x4d19d6,_0x29e679){_0x4d19d6=_0x4d19d6-0x0;var _0x412c5f=_0x9348[_0x4d19d6];return _0x412c5f;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e7e5477..ba95e46 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(_0x255f8d,_0x41772e){var _0x45e939=function(_0x37dbcf){while(--_0x37dbcf){_0x255f8d['push'](_0x255f8d['shift']());}};_0x45e939(++_0x41772e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x3f8953,_0x1ebb5b){var _0x1ea776=function(_0x5133b1){while(--_0x5133b1){_0x3f8953['push'](_0x3f8953['shift']());}};_0x1ea776(++_0x1ebb5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 307298e..d8216ca 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 _0x8f59=['redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8f59,0x11d));var _0x98f5=function(_0x32a2c9,_0x27c01c){_0x32a2c9=_0x32a2c9-0x0;var _0x10d835=_0x8f59[_0x32a2c9];return _0x10d835;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./openchannelAccount.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});} \ No newline at end of file +var _0xa902=['client','http','redis','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4b54bf,_0xefb6c1){var _0x955030=function(_0x132ae9){while(--_0x132ae9){_0x4b54bf['push'](_0x4b54bf['shift']());}};_0x955030(++_0xefb6c1);}(_0xa902,0x8d));var _0x2a90=function(_0x20b938,_0x633da7){_0x20b938=_0x20b938-0x0;var _0x31ea0b=_0xa902[_0x20b938];return _0x31ea0b;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});config[_0x2a90('0xb')]=_['defaults'](config[_0x2a90('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a90('0xb')]));require(_0x2a90('0xc'))[_0x2a90('0xd')](socket);function respondWithRpcPromise(_0x2b0a20,_0x18a60e,_0x56550f){return new BPromise(function(_0x361571,_0x3dadc2){return client[_0x2a90('0xe')](_0x2b0a20,_0x56550f)[_0x2a90('0xf')](function(_0x541e22){logger[_0x2a90('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x2a90('0x11'));logger['debug'](_0x2a90('0x12'),_0x18a60e,'request\x20sent',JSON[_0x2a90('0x13')](_0x541e22));if(_0x541e22[_0x2a90('0x14')]){if(_0x541e22[_0x2a90('0x14')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x3dadc2(_0x541e22['error'][_0x2a90('0x15')]);}logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x361571(_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);}else{logger[_0x2a90('0x10')](_0x2a90('0x16'),_0x18a60e,'request\x20sent');_0x361571(_0x541e22[_0x2a90('0x17')][_0x2a90('0x15')]);}})[_0x2a90('0x18')](function(_0x52622c){logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x52622c);_0x3dadc2(_0x52622c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index cf329c9..6702206 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 _0x0e9f=['register','length','./openchannelAccount.events','save','emit','removeListener'];(function(_0x247bc9,_0x5dc4f3){var _0xe1dc5e=function(_0x49be01){while(--_0x49be01){_0x247bc9['push'](_0x247bc9['shift']());}};_0xe1dc5e(++_0x5dc4f3);}(_0x0e9f,0x116));var _0xf0e9=function(_0x2f9cb1,_0x458bb1){_0x2f9cb1=_0x2f9cb1-0x0;var _0x4b34d7=_0x0e9f[_0x2f9cb1];return _0x4b34d7;};'use strict';var OpenchannelAccountEvents=require(_0xf0e9('0x0'));var events=[_0xf0e9('0x1'),'remove','update'];function createListener(_0x15215f,_0x4c067c){return function(_0x4b7f25){_0x4c067c[_0xf0e9('0x2')](_0x15215f,_0x4b7f25);};}function removeListener(_0x559cad,_0x52a19d){return function(){OpenchannelAccountEvents[_0xf0e9('0x3')](_0x559cad,_0x52a19d);};}exports[_0xf0e9('0x4')]=function(_0x59ac7e){for(var _0x2322dc=0x0,_0x4a35a3=events[_0xf0e9('0x5')];_0x2322dc<_0x4a35a3;_0x2322dc++){var _0x2fa08f=events[_0x2322dc];var _0x106ba0=createListener('openchannelAccount:'+_0x2fa08f,_0x59ac7e);OpenchannelAccountEvents['on'](_0x2fa08f,_0x106ba0);}}; \ No newline at end of file +var _0x7b05=['length','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x7b05,0x91));var _0x57b0=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x7b05[_0x39bfb6];return _0x23fef9;};'use strict';var OpenchannelAccountEvents=require(_0x57b0('0x0'));var events=[_0x57b0('0x1'),_0x57b0('0x2'),_0x57b0('0x3')];function createListener(_0x522bee,_0x22febc){return function(_0x4f8992){_0x22febc[_0x57b0('0x4')](_0x522bee,_0x4f8992);};}function removeListener(_0x2be876,_0x24b7d6){return function(){OpenchannelAccountEvents[_0x57b0('0x5')](_0x2be876,_0x24b7d6);};}exports[_0x57b0('0x6')]=function(_0x5ce0f2){for(var _0x94ef9b=0x0,_0x4d8aae=events[_0x57b0('0x7')];_0x94ef9b<_0x4d8aae;_0x94ef9b++){var _0x289bea=events[_0x94ef9b];var _0x4c970f=createListener('openchannelAccount:'+_0x289bea,_0x5ce0f2);OpenchannelAccountEvents['on'](_0x289bea,_0x4c970f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 32ab1f4..53b8b2e 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 _0xe852=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x4a7b64,_0x16733c){var _0x500da6=function(_0x3454da){while(--_0x3454da){_0x4a7b64['push'](_0x4a7b64['shift']());}};_0x500da6(++_0x16733c);}(_0xe852,0xfd));var _0x2e85=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe852[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x2e85('0x0'));var util=require(_0x2e85('0x1'));var path=require(_0x2e85('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e85('0x4'));var interaction=require(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var controller=require(_0x2e85('0x7'));router[_0x2e85('0x8')]('/',auth[_0x2e85('0x9')](),controller[_0x2e85('0xa')]);router[_0x2e85('0x8')](_0x2e85('0xb'),auth[_0x2e85('0x9')](),controller[_0x2e85('0xc')]);router[_0x2e85('0xd')]('/',auth['isAuthenticated'](),controller[_0x2e85('0xe')]);router['put'](_0x2e85('0xb'),auth[_0x2e85('0x9')](),controller[_0x2e85('0xf')]);router[_0x2e85('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2e85('0x11')]=router; \ No newline at end of file +var _0xc359=['../../components/auth/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','Router','fs-extra'];(function(_0x1ec127,_0xb74c7e){var _0x36b6bd=function(_0x4b1e28){while(--_0x4b1e28){_0x1ec127['push'](_0x1ec127['shift']());}};_0x36b6bd(++_0xb74c7e);}(_0xc359,0x1e7));var _0x9c35=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0xc359[_0x2ee974];return _0x20c5fb;};'use strict';var multer=require('multer');var util=require(_0x9c35('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c35('0x1')]();var fs_extra=require(_0x9c35('0x2'));var auth=require(_0x9c35('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c35('0x4'));router[_0x9c35('0x5')]('/',auth[_0x9c35('0x6')](),controller[_0x9c35('0x7')]);router[_0x9c35('0x5')](_0x9c35('0x8'),auth['isAuthenticated'](),controller[_0x9c35('0x9')]);router['post']('/',auth[_0x9c35('0x6')](),controller['create']);router[_0x9c35('0xa')](_0x9c35('0x8'),auth[_0x9c35('0x6')](),controller[_0x9c35('0xb')]);router[_0x9c35('0xc')](_0x9c35('0x8'),auth[_0x9c35('0x6')](),controller['destroy']);module[_0x9c35('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 1b746cf..a75773d 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 _0x08cb=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1e3f33,_0xe8617c){var _0x1d83c3=function(_0x3f8cbc){while(--_0x3f8cbc){_0x1e3f33['push'](_0x1e3f33['shift']());}};_0x1d83c3(++_0xe8617c);}(_0x08cb,0x122));var _0xb08c=function(_0x547367,_0x4aa37a){_0x547367=_0x547367-0x0;var _0x2134f9=_0x08cb[_0x547367];return _0x2134f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb08c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb08c('0x1')],'allowNull':![],'defaultValue':_0xb08c('0x2')},'appdata':{'type':Sequelize[_0xb08c('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb08c('0x1')],'defaultValue':_0xb08c('0x4')}}; \ No newline at end of file +var _0x5609=['exports','STRING','noop','sequelize'];(function(_0x4a0f1b,_0x3da21e){var _0x545679=function(_0x436cf2){while(--_0x436cf2){_0x4a0f1b['push'](_0x4a0f1b['shift']());}};_0x545679(++_0x3da21e);}(_0x5609,0x18f));var _0x9560=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5609[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x9560('0x0'));module[_0x9560('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9560('0x2')],'allowNull':![],'defaultValue':_0x9560('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9560('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a9fbec6..b494e4f 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 _0x0839=['merge','filter','options','includeAll','include','OpenchannelApplication','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','where'];(function(_0x2ea05c,_0x5d3bec){var _0x28d6f3=function(_0x107893){while(--_0x107893){_0x2ea05c['push'](_0x2ea05c['shift']());}};_0x28d6f3(++_0x5d3bec);}(_0x0839,0x9a));var _0x9083=function(_0xef88b1,_0x218a07){_0xef88b1=_0xef88b1-0x0;var _0x25bf84=_0x0839[_0xef88b1];return _0x25bf84;};'use strict';var emlformat=require(_0x9083('0x0'));var rimraf=require(_0x9083('0x1'));var zipdir=require(_0x9083('0x2'));var jsonpatch=require(_0x9083('0x3'));var rp=require(_0x9083('0x4'));var moment=require(_0x9083('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9083('0x6'));var util=require(_0x9083('0x7'));var path=require('path');var sox=require(_0x9083('0x8'));var csv=require('to-csv');var ejs=require(_0x9083('0x9'));var fs=require('fs');var fs_extra=require(_0x9083('0xa'));var _=require(_0x9083('0xb'));var squel=require(_0x9083('0xc'));var crypto=require(_0x9083('0xd'));var jsforce=require(_0x9083('0xe'));var deskjs=require(_0x9083('0xf'));var toCsv=require(_0x9083('0x10'));var querystring=require(_0x9083('0x11'));var Papa=require('papaparse');var Redis=require(_0x9083('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9083('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9083('0x14'))(_0x9083('0x15'));var utils=require(_0x9083('0x16'));var config=require(_0x9083('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9083('0x18'))['db'];function respondWithStatusCode(_0x51ca36,_0x5bb47c){_0x5bb47c=_0x5bb47c||0xcc;return function(_0x22a3f1){if(_0x22a3f1){return _0x51ca36['sendStatus'](_0x5bb47c);}return _0x51ca36[_0x9083('0x19')](_0x5bb47c)[_0x9083('0x1a')]();};}function respondWithResult(_0x33ef30,_0x4b7994){_0x4b7994=_0x4b7994||0xc8;return function(_0x499141){if(_0x499141){return _0x33ef30[_0x9083('0x19')](_0x4b7994)[_0x9083('0x1b')](_0x499141);}};}function respondWithFilteredResult(_0x1b2c20,_0x506b2b){return function(_0x328ce8){if(_0x328ce8){var _0x5ea5a4=typeof _0x506b2b[_0x9083('0x1c')]===_0x9083('0x1d')&&typeof _0x506b2b[_0x9083('0x1e')]===_0x9083('0x1d');var _0x22e0f0=_0x328ce8[_0x9083('0x1f')];var _0x465c48=_0x5ea5a4?0x0:_0x506b2b[_0x9083('0x1c')];var _0x44e9f8=_0x5ea5a4?_0x328ce8[_0x9083('0x1f')]:_0x506b2b[_0x9083('0x1c')]+_0x506b2b[_0x9083('0x1e')];var _0x3735e2;if(_0x44e9f8>=_0x22e0f0){_0x44e9f8=_0x22e0f0;_0x3735e2=0xc8;}else{_0x3735e2=0xce;}_0x1b2c20[_0x9083('0x19')](_0x3735e2);return _0x1b2c20[_0x9083('0x20')](_0x9083('0x21'),_0x465c48+'-'+_0x44e9f8+'/'+_0x22e0f0)[_0x9083('0x1b')](_0x328ce8);}return null;};}function patchUpdates(_0x29341a){return function(_0x1a735d){try{jsonpatch['apply'](_0x1a735d,_0x29341a,!![]);}catch(_0x395bca){return BPromise['reject'](_0x395bca);}return _0x1a735d['save']();};}function saveUpdates(_0x3958ca,_0x46b890){return function(_0x522779){if(_0x522779){return _0x522779[_0x9083('0x22')](_0x3958ca)[_0x9083('0x23')](function(_0x491d82){return _0x491d82;});}return null;};}function removeEntity(_0x342f89,_0x4ca12e){return function(_0x379fb7){if(_0x379fb7){return _0x379fb7[_0x9083('0x24')]()[_0x9083('0x23')](function(){_0x342f89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdba7,_0x3fbf8f){return function(_0x64f8b3){if(!_0x64f8b3){_0x4fdba7[_0x9083('0x25')](0x194);}return _0x64f8b3;};}function handleError(_0xc43976,_0x571458){_0x571458=_0x571458||0x1f4;return function(_0x5270f0){logger['error'](_0x5270f0[_0x9083('0x26')]);if(_0x5270f0['name']){delete _0x5270f0[_0x9083('0x27')];}_0xc43976[_0x9083('0x19')](_0x571458)[_0x9083('0x28')](_0x5270f0);};}exports['index']=function(_0x2821f7,_0x2ea2ed){var _0x9ee4a7={},_0x4f4ecf={},_0x2c98c0={'count':0x0,'rows':[]};var _0x3b09db=_['map'](db['OpenchannelApplication'][_0x9083('0x29')],function(_0x495bd3){return{'name':_0x495bd3[_0x9083('0x2a')],'type':_0x495bd3[_0x9083('0x2b')][_0x9083('0x2c')]};});_0x4f4ecf[_0x9083('0x2d')]=_[_0x9083('0x2e')](_0x3b09db,_0x9083('0x27'));_0x4f4ecf[_0x9083('0x2f')]=_[_0x9083('0x30')](_0x2821f7[_0x9083('0x2f')]);_0x4f4ecf[_0x9083('0x31')]=_['intersection'](_0x4f4ecf[_0x9083('0x2d')],_0x4f4ecf[_0x9083('0x2f')]);_0x9ee4a7[_0x9083('0x32')]=_[_0x9083('0x33')](_0x4f4ecf[_0x9083('0x2d')],qs[_0x9083('0x34')](_0x2821f7[_0x9083('0x2f')]['fields']));_0x9ee4a7[_0x9083('0x32')]=_0x9ee4a7[_0x9083('0x32')][_0x9083('0x35')]?_0x9ee4a7[_0x9083('0x32')]:_0x4f4ecf[_0x9083('0x2d')];if(!_0x2821f7[_0x9083('0x2f')]['hasOwnProperty']('nolimit')){_0x9ee4a7[_0x9083('0x1e')]=qs[_0x9083('0x1e')](_0x2821f7[_0x9083('0x2f')]['limit']);_0x9ee4a7[_0x9083('0x1c')]=qs[_0x9083('0x1c')](_0x2821f7[_0x9083('0x2f')][_0x9083('0x1c')]);}_0x9ee4a7[_0x9083('0x36')]=qs['sort'](_0x2821f7['query']['sort']);_0x9ee4a7[_0x9083('0x37')]=qs['filters'](_['pick'](_0x2821f7[_0x9083('0x2f')],_0x4f4ecf['filters']),_0x3b09db);if(_0x2821f7[_0x9083('0x2f')]['filter']){_0x9ee4a7[_0x9083('0x37')]=_[_0x9083('0x38')](_0x9ee4a7['where'],{'$or':_[_0x9083('0x2e')](_0x3b09db,function(_0x2688aa){if(_0x2688aa['type']!=='VIRTUAL'){var _0x3fb3da={};_0x3fb3da[_0x2688aa[_0x9083('0x27')]]={'$like':'%'+_0x2821f7[_0x9083('0x2f')][_0x9083('0x39')]+'%'};return _0x3fb3da;}})});}_0x9ee4a7=_[_0x9083('0x38')]({},_0x9ee4a7,_0x2821f7[_0x9083('0x3a')]);var _0x411e93={'where':_0x9ee4a7[_0x9083('0x37')]};return db['OpenchannelApplication']['count'](_0x411e93)[_0x9083('0x23')](function(_0x591b36){_0x2c98c0[_0x9083('0x1f')]=_0x591b36;if(_0x2821f7[_0x9083('0x2f')][_0x9083('0x3b')]){_0x9ee4a7[_0x9083('0x3c')]=[{'all':!![]}];}return db[_0x9083('0x3d')][_0x9083('0x3e')](_0x9ee4a7);})[_0x9083('0x23')](function(_0x49ce89){_0x2c98c0[_0x9083('0x3f')]=_0x49ce89;return _0x2c98c0;})['then'](respondWithFilteredResult(_0x2ea2ed,_0x9ee4a7))[_0x9083('0x40')](handleError(_0x2ea2ed,null));};exports[_0x9083('0x41')]=function(_0x117d02,_0x4be8db){var _0x1c84b2={'raw':!![],'where':{'id':_0x117d02[_0x9083('0x42')]['id']}},_0x5ded12={};_0x5ded12[_0x9083('0x2d')]=_[_0x9083('0x30')](db[_0x9083('0x3d')][_0x9083('0x29')]);_0x5ded12[_0x9083('0x2f')]=_[_0x9083('0x30')](_0x117d02[_0x9083('0x2f')]);_0x5ded12[_0x9083('0x31')]=_[_0x9083('0x33')](_0x5ded12[_0x9083('0x2d')],_0x5ded12[_0x9083('0x2f')]);_0x1c84b2[_0x9083('0x32')]=_[_0x9083('0x33')](_0x5ded12[_0x9083('0x2d')],qs[_0x9083('0x34')](_0x117d02['query'][_0x9083('0x34')]));_0x1c84b2[_0x9083('0x32')]=_0x1c84b2[_0x9083('0x32')][_0x9083('0x35')]?_0x1c84b2[_0x9083('0x32')]:_0x5ded12[_0x9083('0x2d')];if(_0x117d02[_0x9083('0x2f')][_0x9083('0x3b')]){_0x1c84b2[_0x9083('0x3c')]=[{'all':!![]}];}_0x1c84b2=_[_0x9083('0x38')]({},_0x1c84b2,_0x117d02[_0x9083('0x3a')]);return db[_0x9083('0x3d')][_0x9083('0x43')](_0x1c84b2)[_0x9083('0x23')](handleEntityNotFound(_0x4be8db,null))[_0x9083('0x23')](respondWithResult(_0x4be8db,null))[_0x9083('0x40')](handleError(_0x4be8db,null));};exports['create']=function(_0x1017c1,_0x5c7df3){return db[_0x9083('0x3d')][_0x9083('0x44')](_0x1017c1[_0x9083('0x45')],{})['then'](respondWithResult(_0x5c7df3,0xc9))[_0x9083('0x40')](handleError(_0x5c7df3,null));};exports[_0x9083('0x22')]=function(_0x4760ac,_0x553569){if(_0x4760ac[_0x9083('0x45')]['id']){delete _0x4760ac['body']['id'];}return db[_0x9083('0x3d')][_0x9083('0x43')]({'where':{'id':_0x4760ac[_0x9083('0x42')]['id']}})['then'](handleEntityNotFound(_0x553569,null))[_0x9083('0x23')](saveUpdates(_0x4760ac[_0x9083('0x45')],null))[_0x9083('0x23')](respondWithResult(_0x553569,null))[_0x9083('0x40')](handleError(_0x553569,null));};exports[_0x9083('0x24')]=function(_0x5469e7,_0x36a2b3){return db[_0x9083('0x3d')][_0x9083('0x43')]({'where':{'id':_0x5469e7[_0x9083('0x42')]['id']}})[_0x9083('0x23')](handleEntityNotFound(_0x36a2b3,null))[_0x9083('0x23')](removeEntity(_0x36a2b3,null))[_0x9083('0x40')](handleError(_0x36a2b3,null));}; \ No newline at end of file +var _0xddf8=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','OpenchannelApplication','rawAttributes','key','map','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x132cbb,_0x4a7aeb){var _0x4bf1c7=function(_0x389066){while(--_0x389066){_0x132cbb['push'](_0x132cbb['shift']());}};_0x4bf1c7(++_0x4a7aeb);}(_0xddf8,0x108));var _0x8ddf=function(_0x30cfdd,_0x28b25c){_0x30cfdd=_0x30cfdd-0x0;var _0x428cc7=_0xddf8[_0x30cfdd];return _0x428cc7;};'use strict';var emlformat=require(_0x8ddf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ddf('0x1'));var jsonpatch=require(_0x8ddf('0x2'));var rp=require(_0x8ddf('0x3'));var moment=require(_0x8ddf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ddf('0x5'));var util=require(_0x8ddf('0x6'));var path=require('path');var sox=require(_0x8ddf('0x7'));var csv=require(_0x8ddf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ddf('0x9'));var squel=require('squel');var crypto=require(_0x8ddf('0xa'));var jsforce=require(_0x8ddf('0xb'));var deskjs=require(_0x8ddf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ddf('0xd'));var Papa=require(_0x8ddf('0xe'));var Redis=require(_0x8ddf('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ddf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ddf('0x11'))(_0x8ddf('0x12'));var utils=require(_0x8ddf('0x13'));var config=require(_0x8ddf('0x14'));var licenseUtil=require(_0x8ddf('0x15'));var db=require(_0x8ddf('0x16'))['db'];function respondWithStatusCode(_0x5eb51a,_0x287665){_0x287665=_0x287665||0xcc;return function(_0x5126e5){if(_0x5126e5){return _0x5eb51a[_0x8ddf('0x17')](_0x287665);}return _0x5eb51a['status'](_0x287665)[_0x8ddf('0x18')]();};}function respondWithResult(_0x2eae6e,_0x23c248){_0x23c248=_0x23c248||0xc8;return function(_0x64c116){if(_0x64c116){return _0x2eae6e[_0x8ddf('0x19')](_0x23c248)[_0x8ddf('0x1a')](_0x64c116);}};}function respondWithFilteredResult(_0x35a33f,_0x216ab9){return function(_0x270bfb){if(_0x270bfb){var _0x208e28=typeof _0x216ab9[_0x8ddf('0x1b')]===_0x8ddf('0x1c')&&typeof _0x216ab9[_0x8ddf('0x1d')]==='undefined';var _0x110145=_0x270bfb['count'];var _0x35fae7=_0x208e28?0x0:_0x216ab9[_0x8ddf('0x1b')];var _0x3a459f=_0x208e28?_0x270bfb[_0x8ddf('0x1e')]:_0x216ab9[_0x8ddf('0x1b')]+_0x216ab9[_0x8ddf('0x1d')];var _0x5aa9a7;if(_0x3a459f>=_0x110145){_0x3a459f=_0x110145;_0x5aa9a7=0xc8;}else{_0x5aa9a7=0xce;}_0x35a33f[_0x8ddf('0x19')](_0x5aa9a7);return _0x35a33f[_0x8ddf('0x1f')](_0x8ddf('0x20'),_0x35fae7+'-'+_0x3a459f+'/'+_0x110145)[_0x8ddf('0x1a')](_0x270bfb);}return null;};}function patchUpdates(_0x2f5141){return function(_0x34027a){try{jsonpatch[_0x8ddf('0x21')](_0x34027a,_0x2f5141,!![]);}catch(_0x376ae3){return BPromise[_0x8ddf('0x22')](_0x376ae3);}return _0x34027a[_0x8ddf('0x23')]();};}function saveUpdates(_0x52beda,_0x13551e){return function(_0x8e05f1){if(_0x8e05f1){return _0x8e05f1[_0x8ddf('0x24')](_0x52beda)[_0x8ddf('0x25')](function(_0x3a5eba){return _0x3a5eba;});}return null;};}function removeEntity(_0xf2fab3,_0x2704f2){return function(_0x59bc18){if(_0x59bc18){return _0x59bc18[_0x8ddf('0x26')]()['then'](function(){_0xf2fab3[_0x8ddf('0x19')](0xcc)[_0x8ddf('0x18')]();});}};}function handleEntityNotFound(_0x1ecaa7,_0x2c035e){return function(_0x4fb921){if(!_0x4fb921){_0x1ecaa7[_0x8ddf('0x17')](0x194);}return _0x4fb921;};}function handleError(_0x56f101,_0x2f5a85){_0x2f5a85=_0x2f5a85||0x1f4;return function(_0x5e32dc){logger[_0x8ddf('0x27')](_0x5e32dc[_0x8ddf('0x28')]);if(_0x5e32dc['name']){delete _0x5e32dc['name'];}_0x56f101[_0x8ddf('0x19')](_0x2f5a85)[_0x8ddf('0x29')](_0x5e32dc);};}exports['index']=function(_0x2d4318,_0x565bcc){var _0x3e5a0e={},_0x2166c3={},_0x306a0e={'count':0x0,'rows':[]};var _0x383083=_['map'](db[_0x8ddf('0x2a')][_0x8ddf('0x2b')],function(_0x98ec8b){return{'name':_0x98ec8b['fieldName'],'type':_0x98ec8b['type'][_0x8ddf('0x2c')]};});_0x2166c3['model']=_[_0x8ddf('0x2d')](_0x383083,_0x8ddf('0x2e'));_0x2166c3[_0x8ddf('0x2f')]=_[_0x8ddf('0x30')](_0x2d4318[_0x8ddf('0x2f')]);_0x2166c3['filters']=_[_0x8ddf('0x31')](_0x2166c3[_0x8ddf('0x32')],_0x2166c3[_0x8ddf('0x2f')]);_0x3e5a0e[_0x8ddf('0x33')]=_[_0x8ddf('0x31')](_0x2166c3[_0x8ddf('0x32')],qs[_0x8ddf('0x34')](_0x2d4318['query']['fields']));_0x3e5a0e['attributes']=_0x3e5a0e['attributes'][_0x8ddf('0x35')]?_0x3e5a0e[_0x8ddf('0x33')]:_0x2166c3['model'];if(!_0x2d4318[_0x8ddf('0x2f')][_0x8ddf('0x36')]('nolimit')){_0x3e5a0e[_0x8ddf('0x1d')]=qs[_0x8ddf('0x1d')](_0x2d4318[_0x8ddf('0x2f')]['limit']);_0x3e5a0e[_0x8ddf('0x1b')]=qs[_0x8ddf('0x1b')](_0x2d4318[_0x8ddf('0x2f')][_0x8ddf('0x1b')]);}_0x3e5a0e[_0x8ddf('0x37')]=qs['sort'](_0x2d4318['query'][_0x8ddf('0x38')]);_0x3e5a0e[_0x8ddf('0x39')]=qs['filters'](_['pick'](_0x2d4318[_0x8ddf('0x2f')],_0x2166c3[_0x8ddf('0x3a')]),_0x383083);if(_0x2d4318[_0x8ddf('0x2f')][_0x8ddf('0x3b')]){_0x3e5a0e['where']=_[_0x8ddf('0x3c')](_0x3e5a0e[_0x8ddf('0x39')],{'$or':_[_0x8ddf('0x2d')](_0x383083,function(_0x48559c){if(_0x48559c[_0x8ddf('0x3d')]!==_0x8ddf('0x3e')){var _0x568a30={};_0x568a30[_0x48559c[_0x8ddf('0x2e')]]={'$like':'%'+_0x2d4318['query'][_0x8ddf('0x3b')]+'%'};return _0x568a30;}})});}_0x3e5a0e=_['merge']({},_0x3e5a0e,_0x2d4318[_0x8ddf('0x3f')]);var _0x5da692={'where':_0x3e5a0e[_0x8ddf('0x39')]};return db[_0x8ddf('0x2a')][_0x8ddf('0x1e')](_0x5da692)[_0x8ddf('0x25')](function(_0x54e6f4){_0x306a0e[_0x8ddf('0x1e')]=_0x54e6f4;if(_0x2d4318['query'][_0x8ddf('0x40')]){_0x3e5a0e[_0x8ddf('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8ddf('0x42')](_0x3e5a0e);})[_0x8ddf('0x25')](function(_0x41e998){_0x306a0e[_0x8ddf('0x43')]=_0x41e998;return _0x306a0e;})[_0x8ddf('0x25')](respondWithFilteredResult(_0x565bcc,_0x3e5a0e))[_0x8ddf('0x44')](handleError(_0x565bcc,null));};exports['show']=function(_0x26b156,_0x478af9){var _0x1444a1={'raw':!![],'where':{'id':_0x26b156[_0x8ddf('0x45')]['id']}},_0x3cd7c3={};_0x3cd7c3[_0x8ddf('0x32')]=_[_0x8ddf('0x30')](db['OpenchannelApplication'][_0x8ddf('0x2b')]);_0x3cd7c3[_0x8ddf('0x2f')]=_[_0x8ddf('0x30')](_0x26b156[_0x8ddf('0x2f')]);_0x3cd7c3[_0x8ddf('0x3a')]=_[_0x8ddf('0x31')](_0x3cd7c3[_0x8ddf('0x32')],_0x3cd7c3[_0x8ddf('0x2f')]);_0x1444a1[_0x8ddf('0x33')]=_[_0x8ddf('0x31')](_0x3cd7c3[_0x8ddf('0x32')],qs[_0x8ddf('0x34')](_0x26b156['query']['fields']));_0x1444a1[_0x8ddf('0x33')]=_0x1444a1['attributes'][_0x8ddf('0x35')]?_0x1444a1[_0x8ddf('0x33')]:_0x3cd7c3[_0x8ddf('0x32')];if(_0x26b156[_0x8ddf('0x2f')][_0x8ddf('0x40')]){_0x1444a1['include']=[{'all':!![]}];}_0x1444a1=_['merge']({},_0x1444a1,_0x26b156['options']);return db[_0x8ddf('0x2a')][_0x8ddf('0x46')](_0x1444a1)['then'](handleEntityNotFound(_0x478af9,null))['then'](respondWithResult(_0x478af9,null))['catch'](handleError(_0x478af9,null));};exports[_0x8ddf('0x47')]=function(_0x87f2f6,_0x3f574a){return db['OpenchannelApplication'][_0x8ddf('0x47')](_0x87f2f6[_0x8ddf('0x48')],{})[_0x8ddf('0x25')](respondWithResult(_0x3f574a,0xc9))[_0x8ddf('0x44')](handleError(_0x3f574a,null));};exports[_0x8ddf('0x24')]=function(_0x1ae495,_0x924235){if(_0x1ae495[_0x8ddf('0x48')]['id']){delete _0x1ae495[_0x8ddf('0x48')]['id'];}return db['OpenchannelApplication'][_0x8ddf('0x46')]({'where':{'id':_0x1ae495[_0x8ddf('0x45')]['id']}})['then'](handleEntityNotFound(_0x924235,null))['then'](saveUpdates(_0x1ae495['body'],null))['then'](respondWithResult(_0x924235,null))['catch'](handleError(_0x924235,null));};exports[_0x8ddf('0x26')]=function(_0x334bc4,_0x335717){return db['OpenchannelApplication'][_0x8ddf('0x46')]({'where':{'id':_0x334bc4[_0x8ddf('0x45')]['id']}})['then'](handleEntityNotFound(_0x335717,null))[_0x8ddf('0x25')](removeEntity(_0x335717,null))[_0x8ddf('0x44')](handleError(_0x335717,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fe1e94c..710481a 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 _0x339f=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x339f,0x1e7));var _0xf339=function(_0x22b74f,_0xfac517){_0x22b74f=_0x22b74f-0x0;var _0x206049=_0x339f[_0x22b74f];return _0x206049;};'use strict';var _=require(_0xf339('0x0'));var util=require(_0xf339('0x1'));var logger=require(_0xf339('0x2'))(_0xf339('0x3'));var moment=require(_0xf339('0x4'));var BPromise=require('bluebird');var rp=require(_0xf339('0x5'));var fs=require('fs');var path=require(_0xf339('0x6'));var rimraf=require(_0xf339('0x7'));var config=require(_0xf339('0x8'));var attributes=require(_0xf339('0x9'));module[_0xf339('0xa')]=function(_0x52e1a0,_0x3885d6){return _0x52e1a0[_0xf339('0xb')](_0xf339('0xc'),attributes,{'tableName':_0xf339('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf339('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x15c2=['openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x15c2,0x112));var _0x215c=function(_0x51436a,_0x411693){_0x51436a=_0x51436a-0x0;var _0x1bc086=_0x15c2[_0x51436a];return _0x1bc086;};'use strict';var _=require(_0x215c('0x0'));var util=require(_0x215c('0x1'));var logger=require(_0x215c('0x2'))(_0x215c('0x3'));var moment=require(_0x215c('0x4'));var BPromise=require(_0x215c('0x5'));var rp=require(_0x215c('0x6'));var fs=require('fs');var path=require(_0x215c('0x7'));var rimraf=require(_0x215c('0x8'));var config=require(_0x215c('0x9'));var attributes=require(_0x215c('0xa'));module[_0x215c('0xb')]=function(_0x3eb4e7,_0x45e330){return _0x3eb4e7[_0x215c('0xc')](_0x215c('0xd'),attributes,{'tableName':_0x215c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x215c('0xf'),'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 9b87667..167a38b 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 _0x3122=['request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0xe4ee1e,_0xea8b9b){var _0x22f903=function(_0x423070){while(--_0x423070){_0xe4ee1e['push'](_0xe4ee1e['shift']());}};_0x22f903(++_0xea8b9b);}(_0x3122,0xe9));var _0x2312=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3122[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x2312('0x0'));var util=require(_0x2312('0x1'));var moment=require(_0x2312('0x2'));var BPromise=require(_0x2312('0x3'));var rs=require(_0x2312('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2312('0x5'))['db'];var utils=require(_0x2312('0x6'));var logger=require('../../config/logger')(_0x2312('0x7'));var config=require('../../config/environment');var jayson=require(_0x2312('0x8'));var client=jayson[_0x2312('0x9')][_0x2312('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c0a66,_0xca8e9d,_0x381700){return new BPromise(function(_0x2dc957,_0x503171){return client[_0x2312('0xb')](_0x8c0a66,_0x381700)[_0x2312('0xc')](function(_0x5c0aff){logger[_0x2312('0xd')](_0x2312('0xe'),_0xca8e9d,_0x2312('0xf'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xca8e9d,_0x2312('0xf'),JSON[_0x2312('0x10')](_0x5c0aff));if(_0x5c0aff[_0x2312('0x11')]){if(_0x5c0aff[_0x2312('0x11')][_0x2312('0x12')]===0x1f4){logger[_0x2312('0x11')](_0x2312('0xe'),_0xca8e9d,_0x5c0aff[_0x2312('0x11')][_0x2312('0x13')]);return _0x503171(_0x5c0aff[_0x2312('0x11')][_0x2312('0x13')]);}logger[_0x2312('0x11')](_0x2312('0xe'),_0xca8e9d,_0x5c0aff['error'][_0x2312('0x13')]);return _0x2dc957(_0x5c0aff['error']['message']);}else{logger[_0x2312('0xd')](_0x2312('0xe'),_0xca8e9d,'request\x20sent');_0x2dc957(_0x5c0aff[_0x2312('0x14')][_0x2312('0x13')]);}})['catch'](function(_0x2fcf9f){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xca8e9d,_0x2fcf9f);_0x503171(_0x2fcf9f);});});}exports[_0x2312('0x15')]=function(_0x307dd6){var _0xd8134b=this;return new Promise(function(_0x23d877,_0x5016dd){return db[_0x2312('0x16')][_0x2312('0x17')](_0x307dd6[_0x2312('0x18')],{'raw':_0x307dd6[_0x2312('0x19')]?_0x307dd6[_0x2312('0x19')][_0x2312('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307dd6['options']?_0x307dd6['options'][_0x2312('0x1b')]||null:null,'attributes':_0x307dd6['options']?_0x307dd6[_0x2312('0x19')][_0x2312('0x1c')]||null:null,'limit':_0x307dd6['options']?_0x307dd6[_0x2312('0x19')]['limit']||null:null})['then'](function(_0x59d84c){logger[_0x2312('0xd')](_0x2312('0x15'),_0x307dd6);logger[_0x2312('0x1d')](_0x2312('0x15'),_0x307dd6,JSON['stringify'](_0x59d84c));_0x23d877(_0x59d84c);})[_0x2312('0x1e')](function(_0x542dfa){logger[_0x2312('0x11')](_0x2312('0x15'),_0x542dfa[_0x2312('0x13')],_0x307dd6);_0x5016dd(_0xd8134b['error'](0x1f4,_0x542dfa['message']));});});}; \ No newline at end of file +var _0x0dca=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','then','util','moment','randomstring'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x0dca,0x176));var _0xa0dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0dca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xa0dc('0x0'));var moment=require(_0xa0dc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0dc('0x2'));var fs=require('fs');var Redis=require(_0xa0dc('0x3'));var db=require(_0xa0dc('0x4'))['db'];var utils=require(_0xa0dc('0x5'));var logger=require('../../config/logger')(_0xa0dc('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0dc('0x7'));var client=jayson[_0xa0dc('0x8')][_0xa0dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x250214,_0x510fa5,_0x2f2a45){return new BPromise(function(_0x5cc043,_0x4100eb){return client[_0xa0dc('0xa')](_0x250214,_0x2f2a45)['then'](function(_0x286aa5){logger[_0xa0dc('0xb')](_0xa0dc('0xc'),_0x510fa5,'request\x20sent');logger[_0xa0dc('0xd')](_0xa0dc('0xe'),_0x510fa5,'request\x20sent',JSON[_0xa0dc('0xf')](_0x286aa5));if(_0x286aa5[_0xa0dc('0x10')]){if(_0x286aa5[_0xa0dc('0x10')][_0xa0dc('0x11')]===0x1f4){logger[_0xa0dc('0x10')](_0xa0dc('0xc'),_0x510fa5,_0x286aa5['error'][_0xa0dc('0x12')]);return _0x4100eb(_0x286aa5['error'][_0xa0dc('0x12')]);}logger[_0xa0dc('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x510fa5,_0x286aa5[_0xa0dc('0x10')][_0xa0dc('0x12')]);return _0x5cc043(_0x286aa5[_0xa0dc('0x10')][_0xa0dc('0x12')]);}else{logger[_0xa0dc('0xb')](_0xa0dc('0xc'),_0x510fa5,_0xa0dc('0x13'));_0x5cc043(_0x286aa5[_0xa0dc('0x14')][_0xa0dc('0x12')]);}})[_0xa0dc('0x15')](function(_0xbeb8ec){logger['error'](_0xa0dc('0xc'),_0x510fa5,_0xbeb8ec);_0x4100eb(_0xbeb8ec);});});}exports[_0xa0dc('0x16')]=function(_0x3dc679){var _0x2ca159=this;return new Promise(function(_0x360baa,_0x39a9db){return db[_0xa0dc('0x17')][_0xa0dc('0x18')](_0x3dc679['body'],{'raw':_0x3dc679[_0xa0dc('0x19')]?_0x3dc679[_0xa0dc('0x19')][_0xa0dc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc679[_0xa0dc('0x19')]?_0x3dc679['options']['where']||null:null,'attributes':_0x3dc679[_0xa0dc('0x19')]?_0x3dc679['options'][_0xa0dc('0x1b')]||null:null,'limit':_0x3dc679['options']?_0x3dc679[_0xa0dc('0x19')]['limit']||null:null})[_0xa0dc('0x1c')](function(_0x5803b7){logger[_0xa0dc('0xb')](_0xa0dc('0x16'),_0x3dc679);logger[_0xa0dc('0xd')]('UpdateOpenchannelApplication',_0x3dc679,JSON[_0xa0dc('0xf')](_0x5803b7));_0x360baa(_0x5803b7);})[_0xa0dc('0x15')](function(_0x4c0092){logger[_0xa0dc('0x10')](_0xa0dc('0x16'),_0x4c0092[_0xa0dc('0x12')],_0x3dc679);_0x39a9db(_0x2ca159[_0xa0dc('0x10')](0x1f4,_0x4c0092['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4c424c1..dff2638 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 _0x6dd3=['openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0x1c1ce9,_0xf376b7){var _0x4d692e=function(_0x396adf){while(--_0x396adf){_0x1c1ce9['push'](_0x1c1ce9['shift']());}};_0x4d692e(++_0xf376b7);}(_0x6dd3,0x92));var _0x36dd=function(_0x5cc5b8,_0x4be1a8){_0x5cc5b8=_0x5cc5b8-0x0;var _0x3e3371=_0x6dd3[_0x5cc5b8];return _0x3e3371;};'use strict';var multer=require(_0x36dd('0x0'));var util=require(_0x36dd('0x1'));var path=require(_0x36dd('0x2'));var timeout=require(_0x36dd('0x3'));var express=require(_0x36dd('0x4'));var router=express['Router']();var fs_extra=require(_0x36dd('0x5'));var auth=require(_0x36dd('0x6'));var interaction=require(_0x36dd('0x7'));var config=require(_0x36dd('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x36dd('0x9')]('/',auth[_0x36dd('0xa')](),controller[_0x36dd('0xb')]);router[_0x36dd('0x9')](_0x36dd('0xc'),auth[_0x36dd('0xa')](),controller[_0x36dd('0xd')]);router[_0x36dd('0x9')](_0x36dd('0xe'),auth['isAuthenticated'](),controller[_0x36dd('0xf')]);router['get'](_0x36dd('0x10'),auth[_0x36dd('0xa')](),controller[_0x36dd('0x11')]);router[_0x36dd('0x9')](_0x36dd('0x12'),auth[_0x36dd('0xa')](),controller[_0x36dd('0x13')]);router['post']('/',auth[_0x36dd('0xa')](),controller[_0x36dd('0x14')]);router[_0x36dd('0x15')](_0x36dd('0x10'),auth[_0x36dd('0xa')](),controller[_0x36dd('0x16')]);router[_0x36dd('0x15')](_0x36dd('0x17'),auth[_0x36dd('0xa')](),interaction[_0x36dd('0x18')](_0x36dd('0x19'),_0x36dd('0x1a')),controller[_0x36dd('0x1b')]);router[_0x36dd('0x1c')](_0x36dd('0xe'),auth[_0x36dd('0xa')](),interaction[_0x36dd('0x18')](_0x36dd('0x19'),_0x36dd('0x1d')),controller[_0x36dd('0x1e')]);router[_0x36dd('0x1f')](_0x36dd('0xe'),auth[_0x36dd('0xa')](),interaction[_0x36dd('0x18')](_0x36dd('0x19'),_0x36dd('0x20')),controller[_0x36dd('0x21')]);router[_0x36dd('0x1f')](_0x36dd('0x17'),auth[_0x36dd('0xa')](),controller[_0x36dd('0x22')]);module['exports']=router; \ No newline at end of file +var _0xaa82=['put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','/describe','/:id','show','get','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x180b01,_0x16cd10){var _0x51fe8f=function(_0x3590b8){while(--_0x3590b8){_0x180b01['push'](_0x180b01['shift']());}};_0x51fe8f(++_0x16cd10);}(_0xaa82,0xf6));var _0x2aa8=function(_0x1a215a,_0x16476a){_0x1a215a=_0x1a215a-0x0;var _0x151fc9=_0xaa82[_0x1a215a];return _0x151fc9;};'use strict';var multer=require(_0x2aa8('0x0'));var util=require(_0x2aa8('0x1'));var path=require(_0x2aa8('0x2'));var timeout=require(_0x2aa8('0x3'));var express=require(_0x2aa8('0x4'));var router=express['Router']();var fs_extra=require(_0x2aa8('0x5'));var auth=require(_0x2aa8('0x6'));var interaction=require(_0x2aa8('0x7'));var config=require(_0x2aa8('0x8'));var controller=require(_0x2aa8('0x9'));router['get']('/',auth[_0x2aa8('0xa')](),controller['index']);router['get'](_0x2aa8('0xb'),auth[_0x2aa8('0xa')](),controller['describe']);router['get'](_0x2aa8('0xc'),auth[_0x2aa8('0xa')](),controller[_0x2aa8('0xd')]);router[_0x2aa8('0xe')](_0x2aa8('0xf'),auth[_0x2aa8('0xa')](),controller['getMessages']);router['get'](_0x2aa8('0x10'),auth[_0x2aa8('0xa')](),controller[_0x2aa8('0x11')]);router[_0x2aa8('0x12')]('/',auth[_0x2aa8('0xa')](),controller[_0x2aa8('0x13')]);router['post'](_0x2aa8('0xf'),auth[_0x2aa8('0xa')](),controller[_0x2aa8('0x14')]);router[_0x2aa8('0x12')](_0x2aa8('0x15'),auth['isAuthenticated'](),interaction[_0x2aa8('0x16')](_0x2aa8('0x17'),_0x2aa8('0x18')),controller[_0x2aa8('0x19')]);router[_0x2aa8('0x1a')](_0x2aa8('0xc'),auth[_0x2aa8('0xa')](),interaction[_0x2aa8('0x16')]('openchannel',_0x2aa8('0x1b')),controller[_0x2aa8('0x1c')]);router['delete'](_0x2aa8('0xc'),auth[_0x2aa8('0xa')](),interaction[_0x2aa8('0x16')](_0x2aa8('0x17'),_0x2aa8('0x1d')),controller[_0x2aa8('0x1e')]);router[_0x2aa8('0x1f')](_0x2aa8('0x15'),auth[_0x2aa8('0xa')](),controller[_0x2aa8('0x20')]);module[_0x2aa8('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d8f6e24..8e53d3b 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 _0xad95=['BOOLEAN','STRING','ENUM','out','sequelize','exports'];(function(_0x3c9f14,_0x23e08c){var _0x1b173c=function(_0x59c0b0){while(--_0x59c0b0){_0x3c9f14['push'](_0x3c9f14['shift']());}};_0x1b173c(++_0x23e08c);}(_0xad95,0x70));var _0x5ad9=function(_0x895d89,_0x1fd1f4){_0x895d89=_0x895d89-0x0;var _0x3951c0=_0xad95[_0x895d89];return _0x3951c0;};'use strict';var Sequelize=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'closed':{'type':Sequelize[_0x5ad9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5ad9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5ad9('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x5ad9('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5ad9('0x4')]('in',_0x5ad9('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5ad9('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5ad9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x795a=['exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x1699c1,_0x326739){var _0x3ab88a=function(_0x8ea000){while(--_0x8ea000){_0x1699c1['push'](_0x1699c1['shift']());}};_0x3ab88a(++_0x326739);}(_0x795a,0xa2));var _0xa795=function(_0x4feb30,_0x40d4cc){_0x4feb30=_0x4feb30-0x0;var _0x5476a4=_0x795a[_0x4feb30];return _0x5476a4;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'closed':{'type':Sequelize[_0xa795('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa795('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa795('0x2')]},'note':{'type':Sequelize[_0xa795('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xa795('0x2')]},'lastMsgAt':{'type':Sequelize[_0xa795('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa795('0x4')]('in',_0xa795('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa795('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xa795('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 0fc6dbb..cb03c3f 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 _0x4540=['count','offset','update','then','error','name','send','index','map','fieldName','type','key','getOptions','findAll','query','user','catch','show','from','params','model','keys','OpenchannelInteraction','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','destroy','describe','omit','ids','getMessages','OpenchannelMessage','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','files','tmp','root','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','toString','closed','closedAt','disposition','Private','Messages','existsSync','pipe','createWriteStream','basename','out','System','value','views','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','limit','undefined'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4540,0x1e7));var _0x0454=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4540[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x0454('0x0'));var zipdir=require(_0x0454('0x1'));var moment=require(_0x0454('0x2'));var util=require(_0x0454('0x3'));var path=require(_0x0454('0x4'));var ejs=require(_0x0454('0x5'));var fs=require('fs');var _=require(_0x0454('0x6'));var Redis=require(_0x0454('0x7'));var interaction=require(_0x0454('0x8'));var qs=require(_0x0454('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x0454('0xa'))('api');var config=require(_0x0454('0xb'));var db=require(_0x0454('0xc'))['db'];config['redis']=_[_0x0454('0xd')](config[_0x0454('0xe')],{'host':_0x0454('0xf'),'port':0x18eb});var socket=require(_0x0454('0x10'))(new Redis(config[_0x0454('0xe')]));require(_0x0454('0x11'))[_0x0454('0x12')](socket);function respondWithStatusCode(_0x58af21,_0x47631e){_0x47631e=_0x47631e||0xcc;return function(_0x5ecb8a){if(_0x5ecb8a){return _0x58af21[_0x0454('0x13')](_0x47631e);}return _0x58af21['status'](_0x47631e)[_0x0454('0x14')]();};}function respondWithResult(_0x13b42b,_0x571514){_0x571514=_0x571514||0xc8;return function(_0x1cae56){if(_0x1cae56){return _0x13b42b[_0x0454('0x15')](_0x571514)[_0x0454('0x16')](_0x1cae56);}};}function respondWithFilteredResult(_0x328c74,_0x32ec22){return function(_0x3f27b9){if(_0x3f27b9){var _0x1f2ccf=typeof _0x32ec22['offset']==='undefined'&&typeof _0x32ec22[_0x0454('0x17')]===_0x0454('0x18');var _0x161394=_0x3f27b9[_0x0454('0x19')];var _0x438e0b=_0x1f2ccf?0x0:_0x32ec22['offset'];var _0xa436c1=_0x1f2ccf?_0x3f27b9['count']:_0x32ec22[_0x0454('0x1a')]+_0x32ec22['limit'];var _0x475642;if(_0xa436c1>=_0x161394){_0xa436c1=_0x161394;_0x475642=0xc8;}else{_0x475642=0xce;}_0x328c74[_0x0454('0x15')](_0x475642);return _0x328c74['set']('Content-Range',_0x438e0b+'-'+_0xa436c1+'/'+_0x161394)[_0x0454('0x16')](_0x3f27b9);}return null;};}function saveUpdates(_0x1820eb){return function(_0x55e5d9){if(_0x55e5d9){return _0x55e5d9[_0x0454('0x1b')](_0x1820eb)[_0x0454('0x1c')](function(_0x2d1db1){return _0x2d1db1;});}return null;};}function removeEntity(_0x5359a5){return function(_0x329cb6){if(_0x329cb6){return _0x329cb6['destroy']()[_0x0454('0x1c')](function(){_0x5359a5[_0x0454('0x15')](0xcc)[_0x0454('0x14')]();});}};}function handleEntityNotFound(_0x1875b8){return function(_0x27e3bf){if(!_0x27e3bf){_0x1875b8[_0x0454('0x13')](0x194);}return _0x27e3bf;};}function handleError(_0x22c448,_0xe5f57f){_0xe5f57f=_0xe5f57f||0x1f4;return function(_0x42b454){logger[_0x0454('0x1d')](_0x42b454['stack']);if(_0x42b454[_0x0454('0x1e')]){delete _0x42b454[_0x0454('0x1e')];}_0x22c448[_0x0454('0x15')](_0xe5f57f)[_0x0454('0x1f')](_0x42b454);};}exports[_0x0454('0x20')]=function(_0x2fb339,_0x1aca7c){var _0x2bcebf={};var _0x4255af=_[_0x0454('0x21')](db['OpenchannelInteraction']['rawAttributes'],function(_0x28ad33){return{'name':_0x28ad33[_0x0454('0x22')],'type':_0x28ad33[_0x0454('0x23')][_0x0454('0x24')]};});_0x2bcebf=qs[_0x0454('0x25')](_0x4255af,_0x2fb339);return interaction[_0x0454('0x26')]('openchannel',_0x2fb339[_0x0454('0x27')],_0x2fb339[_0x0454('0x28')],_0x2bcebf,_0x4255af)[_0x0454('0x1c')](respondWithFilteredResult(_0x1aca7c,_0x2bcebf))[_0x0454('0x29')](handleError(_0x1aca7c,null));};exports[_0x0454('0x2a')]=function(_0x2dc4b8,_0x19add3){var _0x46148a={};if(_0x2dc4b8[_0x0454('0x27')][_0x0454('0x23')]&&_0x2dc4b8[_0x0454('0x27')][_0x0454('0x23')]===_0x0454('0x2b')){_0x46148a[_0x0454('0x2b')]=_0x2dc4b8[_0x0454('0x2c')]['id'];}else{_0x46148a['id']=_0x2dc4b8[_0x0454('0x2c')]['id'];}var _0x5abf3c={'raw':![],'where':_0x46148a},_0x3298e6={};_0x3298e6[_0x0454('0x2d')]=_[_0x0454('0x2e')](db[_0x0454('0x2f')][_0x0454('0x30')]);_0x3298e6['query']=_[_0x0454('0x2e')](_0x2dc4b8[_0x0454('0x27')]);_0x3298e6[_0x0454('0x31')]=_[_0x0454('0x32')](_0x3298e6[_0x0454('0x2d')],_0x3298e6['query']);_0x5abf3c['attributes']=_[_0x0454('0x32')](_0x3298e6[_0x0454('0x2d')],qs[_0x0454('0x33')](_0x2dc4b8['query'][_0x0454('0x33')]));_0x5abf3c[_0x0454('0x34')]=_0x5abf3c[_0x0454('0x34')][_0x0454('0x35')]?_0x5abf3c[_0x0454('0x34')]:_0x3298e6[_0x0454('0x2d')];if(_0x2dc4b8[_0x0454('0x27')][_0x0454('0x36')]){_0x5abf3c[_0x0454('0x37')]=[{'all':!![]}];}_0x5abf3c=_[_0x0454('0x38')]({},_0x5abf3c,_0x2dc4b8[_0x0454('0x39')]);return db['OpenchannelInteraction'][_0x0454('0x3a')](_0x5abf3c)[_0x0454('0x1c')](handleEntityNotFound(_0x19add3,null))['then'](respondWithResult(_0x19add3,null))['catch'](handleError(_0x19add3,null));};exports[_0x0454('0x3b')]=function(_0x5f1038,_0x95133f){return db[_0x0454('0x2f')][_0x0454('0x3b')](_0x5f1038[_0x0454('0x3c')],{})[_0x0454('0x1c')](respondWithResult(_0x95133f,0xc9))['catch'](handleError(_0x95133f,null));};exports['update']=function(_0x37a83f,_0x3634a5){if(_0x37a83f['body']['id']){delete _0x37a83f[_0x0454('0x3c')]['id'];}return db[_0x0454('0x2f')][_0x0454('0x3a')]({'where':{'id':_0x37a83f['params']['id']}})[_0x0454('0x1c')](handleEntityNotFound(_0x3634a5,null))['then'](saveUpdates(_0x37a83f['body'],null))[_0x0454('0x1c')](respondWithResult(_0x3634a5,null))[_0x0454('0x29')](handleError(_0x3634a5,null));};exports[_0x0454('0x3d')]=function(_0x4a6c01,_0x349689){return db[_0x0454('0x2f')][_0x0454('0x3a')]({'where':{'id':_0x4a6c01['params']['id']}})['then'](handleEntityNotFound(_0x349689,null))[_0x0454('0x1c')](removeEntity(_0x349689,null))[_0x0454('0x29')](handleError(_0x349689,null));};exports[_0x0454('0x3e')]=function(_0x27249c,_0x523a3e){return db[_0x0454('0x2f')]['describe']()['then'](respondWithResult(_0x523a3e,null))['catch'](handleError(_0x523a3e,null));};exports['addMessage']=function(_0x1607ec,_0x35f39f){return db['OpenchannelMessage'][_0x0454('0x3a')]({'where':{'id':_0x1607ec['params']['id']}})['then'](handleEntityNotFound(_0x35f39f,null))[_0x0454('0x1c')](function(_0x529a95){if(_0x529a95){return _0x529a95['addMessage'](_0x1607ec['body']['ids'],_[_0x0454('0x3f')](_0x1607ec[_0x0454('0x3c')],[_0x0454('0x40'),'id'])||{});}})[_0x0454('0x1c')](respondWithResult(_0x35f39f,null))[_0x0454('0x29')](handleError(_0x35f39f,null));};exports[_0x0454('0x41')]=function(_0x517191,_0x44ed0a){var _0x52c2f2={'raw':![],'where':{}};var _0x1e3f61={};var _0x5b4b66={'count':0x0,'rows':[]};return db[_0x0454('0x2f')]['findOne']({'where':{'id':_0x517191[_0x0454('0x2c')]['id']}})[_0x0454('0x1c')](handleEntityNotFound(_0x44ed0a,null))[_0x0454('0x1c')](function(_0x376b85){if(_0x376b85){_0x1e3f61[_0x0454('0x2d')]=_[_0x0454('0x2e')](db[_0x0454('0x42')]['rawAttributes']);_0x1e3f61[_0x0454('0x27')]=_[_0x0454('0x2e')](_0x517191[_0x0454('0x27')]);_0x1e3f61[_0x0454('0x31')]=_[_0x0454('0x32')](_0x1e3f61['model'],_0x1e3f61['query']);_0x52c2f2[_0x0454('0x34')]=_['intersection'](_0x1e3f61[_0x0454('0x2d')],qs['fields'](_0x517191[_0x0454('0x27')][_0x0454('0x33')]));_0x52c2f2[_0x0454('0x34')]=_0x52c2f2[_0x0454('0x34')][_0x0454('0x35')]?_0x52c2f2['attributes']:_0x1e3f61[_0x0454('0x2d')];if(!_0x517191[_0x0454('0x27')]['hasOwnProperty'](_0x0454('0x43'))){_0x52c2f2[_0x0454('0x17')]=qs[_0x0454('0x17')](_0x517191['query']['limit']);_0x52c2f2[_0x0454('0x1a')]=qs[_0x0454('0x1a')](_0x517191[_0x0454('0x27')]['offset']);}_0x52c2f2[_0x0454('0x44')]=qs[_0x0454('0x45')](_0x517191['query']['sort']);_0x52c2f2[_0x0454('0x46')]=qs[_0x0454('0x31')](_['pick'](_0x517191['query'],_0x1e3f61[_0x0454('0x31')]));_0x52c2f2[_0x0454('0x46')][_0x0454('0x47')]=_0x376b85['id'];if(_0x517191['query'][_0x0454('0x48')]){_0x52c2f2[_0x0454('0x46')]=_[_0x0454('0x38')](_0x52c2f2['where'],{'$or':_['map'](_0x52c2f2[_0x0454('0x34')],function(_0x3cf185){var _0x5f1eea={};_0x5f1eea[_0x3cf185]={'$like':'%'+_0x517191[_0x0454('0x27')]['filter']+'%'};return _0x5f1eea;})});}if(_0x517191[_0x0454('0x27')][_0x0454('0x49')]){var _0x23d6dd=_0x517191[_0x0454('0x27')][_0x0454('0x49')][_0x0454('0x4a')](',');var _0x561503={};_0x561503[_0x23d6dd[0x0]]={'$gte':moment(_0x23d6dd[0x1])[_0x0454('0x4b')](_0x0454('0x4c'))};_0x52c2f2['where']=_['merge'](_0x52c2f2[_0x0454('0x46')],_0x561503);}_0x52c2f2=_[_0x0454('0x38')]({},_0x52c2f2,_0x517191[_0x0454('0x39')]);return db[_0x0454('0x42')]['count']({'where':_0x52c2f2[_0x0454('0x46')]})[_0x0454('0x1c')](function(_0x4e0f2e){_0x5b4b66['count']=_0x4e0f2e;if(_0x517191['query']['includeAll']){_0x52c2f2[_0x0454('0x37')]=[{'all':!![]}];}return db[_0x0454('0x42')][_0x0454('0x26')](_0x52c2f2);})[_0x0454('0x1c')](function(_0x3de7b8){_0x5b4b66['rows']=_0x3de7b8;return _0x5b4b66;});}})[_0x0454('0x1c')](respondWithFilteredResult(_0x44ed0a,_0x52c2f2))[_0x0454('0x29')](handleError(_0x44ed0a,null));};exports[_0x0454('0x4d')]=function(_0x539c43,_0x3efc50){return db['OpenchannelInteraction']['find']({'where':{'id':_0x539c43['params']['id']}})[_0x0454('0x1c')](handleEntityNotFound(_0x3efc50,null))[_0x0454('0x1c')](function(_0x269511){if(_0x269511){return _0x269511[_0x0454('0x4e')](_0x539c43['body'][_0x0454('0x40')],_['omit'](_0x539c43[_0x0454('0x3c')],['ids','id'])||{})[_0x0454('0x4f')](function(){return db[_0x0454('0x50')][_0x0454('0x26')]({'attributes':['id','name',_0x0454('0x51')],'where':{'id':_0x539c43[_0x0454('0x3c')][_0x0454('0x40')]}});})['then'](function(_0x7b5623){socket[_0x0454('0x52')]('openchannelInteractionTags:save',{'id':Number(_0x539c43[_0x0454('0x2c')]['id']),'tags':_0x7b5623||[]});return{'id':Number(_0x539c43[_0x0454('0x2c')]['id']),'tags':_0x7b5623||[]};});}})[_0x0454('0x1c')](respondWithResult(_0x3efc50,null))[_0x0454('0x29')](handleError(_0x3efc50,null));};exports['removeTags']=function(_0x1e2d46,_0x3a62ff){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1e2d46[_0x0454('0x2c')]['id']}})[_0x0454('0x1c')](handleEntityNotFound(_0x3a62ff,null))[_0x0454('0x1c')](function(_0xbb238){if(_0xbb238){return _0xbb238[_0x0454('0x53')](_0x1e2d46[_0x0454('0x27')][_0x0454('0x40')]);}})[_0x0454('0x1c')](respondWithStatusCode(_0x3a62ff,null))[_0x0454('0x29')](handleError(_0x3a62ff,null));};exports[_0x0454('0x54')]=function(_0x24f37d,_0x1ccbd5){var _0x528bee=moment()[_0x0454('0x55')]()['toString']();var _0x317bb1=path[_0x0454('0x56')](config['root'],'server',_0x0454('0x57'),_0x0454('0x58'));var _0x38580a=path[_0x0454('0x56')](config[_0x0454('0x59')],_0x0454('0x5a'),_0x0454('0x57'),'attachments');var _0x239fdb=path[_0x0454('0x56')](_0x317bb1,_0x528bee);var _0x5724a1=util[_0x0454('0x4b')](_0x0454('0x5b'),_0x24f37d[_0x0454('0x2c')]['id'],_0x528bee);var _0x545828=path[_0x0454('0x56')](_0x317bb1,_0x5724a1);var _0x1ca11c=[];_0x1ca11c[_0x0454('0x5c')]({'model':db[_0x0454('0x5d')],'as':_0x0454('0x5d'),'attributes':['id',_0x0454('0x5e')],'raw':!![]});_0x1ca11c[_0x0454('0x5c')]({'model':db[_0x0454('0x5f')],'as':_0x0454('0x60'),'attributes':['id',_0x0454('0x61'),_0x0454('0x62')],'raw':!![]});if(_0x24f37d[_0x0454('0x27')]['attachments']){_0x1ca11c['push']({'model':db[_0x0454('0x63')],'as':_0x0454('0x63'),'raw':!![]});}var _0x575d8f=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x0454('0x3c'),_0x0454('0x64'),_0x0454('0x65'),_0x0454('0x66'),_0x0454('0x67')],'include':_0x1ca11c}];_0x575d8f[_0x0454('0x5c')]({'model':db[_0x0454('0x68')],'as':_0x0454('0x69'),'attributes':['id',_0x0454('0x1e')]});_0x575d8f[_0x0454('0x5c')]({'model':db[_0x0454('0x5d')],'as':_0x0454('0x6a'),'attributes':['id',_0x0454('0x5e')]});return db[_0x0454('0x2f')]['find']({'where':{'id':_0x24f37d[_0x0454('0x2c')]['id']},'include':_0x575d8f})[_0x0454('0x1c')](handleEntityNotFound(_0x1ccbd5,null))[_0x0454('0x1c')](function(_0x166510){if(_0x166510){var _0x46047d=_0x166510[_0x0454('0x6b')]({'plain':!![]});fs[_0x0454('0x6c')](_0x239fdb);var _0x25b57b={'channel':_0x0454('0x6d'),'account':_0x46047d[_0x0454('0x69')]['name'],'agent':_0x46047d[_0x0454('0x6a')]?_0x46047d[_0x0454('0x6a')][_0x0454('0x5e')]:_0x0454('0x6e'),'createdAt':moment(_0x46047d[_0x0454('0x64')])[_0x0454('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0454('0x6f')](),'closedAt':_0x46047d[_0x0454('0x70')]?moment(_0x46047d[_0x0454('0x71')])['format'](_0x0454('0x4c'))[_0x0454('0x6f')]():'','disposition':_0x46047d[_0x0454('0x72')],'visibility':_0x46047d['threadId']?'Public':_0x0454('0x73'),'messages':_(_0x46047d[_0x0454('0x74')])[_0x0454('0x48')]({'secret':![]})[_0x0454('0x21')](function(_0x1d581d){if(_0x1d581d[_0x0454('0x63')]){var _0x3bd989=path[_0x0454('0x56')](_0x38580a,_0x1d581d[_0x0454('0x63')]['basename']);if(fs[_0x0454('0x75')](_0x3bd989)){fs['createReadStream'](_0x3bd989)[_0x0454('0x76')](fs[_0x0454('0x77')](path['join'](_0x239fdb,_0x1d581d['Attachment'][_0x0454('0x78')])));}}return{'date':moment(_0x1d581d[_0x0454('0x64')])[_0x0454('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0454('0x6f')](),'sender':_0x1d581d[_0x0454('0x65')]===_0x0454('0x79')?_0x1d581d[_0x0454('0x5d')]?_0x1d581d[_0x0454('0x5d')][_0x0454('0x5e')]:_0x0454('0x7a'):_0x1d581d[_0x0454('0x60')]['firstName']+(_0x1d581d[_0x0454('0x60')][_0x0454('0x62')]?'\x20'+_0x1d581d[_0x0454('0x60')][_0x0454('0x62')]:''),'body':_0x1d581d[_0x0454('0x63')]?_0x1d581d['Attachment'][_0x0454('0x78')]:_0x1d581d['body'],'direction':_0x1d581d[_0x0454('0x65')]==='out'?'A':'C','secret':_0x1d581d[_0x0454('0x66')],'read':_0x1d581d[_0x0454('0x67')],'attachment':_0x1d581d['Attachment']};})[_0x0454('0x7b')]()};return ejs['renderFile'](path[_0x0454('0x56')](config[_0x0454('0x59')],'server',_0x0454('0x7c'),'downloadInteraction.ejs'),{'interaction':_0x25b57b})[_0x0454('0x1c')](function(_0x43b345){var _0x35435f=path[_0x0454('0x56')](_0x239fdb,_0x0454('0x7d')+_0x46047d['id']+'-'+_0x528bee+_0x0454('0x7e'));var _0x1fec28={'path':_0x35435f,'channel':'Openchannel','interactionId':_0x46047d['id']};return pdf[_0x0454('0x7f')](_0x43b345,_0x1fec28);})[_0x0454('0x1c')](function(){return new Promise(function(_0x333be5,_0x10b1e4){zipdir(_0x239fdb,{'saveTo':_0x545828},function(_0x69ff2,_0x35c142){if(_0x69ff2)return _0x10b1e4(_0x69ff2);return _0x333be5(_0x35c142);});})['then'](function(){return new Promise(function(_0x26643f,_0x57a99a){rimraf(_0x239fdb,function(_0x44ec20){if(_0x44ec20)_0x57a99a(_0x44ec20);return _0x26643f();});});})[_0x0454('0x1c')](function(){return _0x1ccbd5[_0x0454('0x54')](_0x545828,_0x5724a1,function(_0x45dd05){if(_0x45dd05){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x45dd05);}else{fs['unlinkSync'](_0x545828);}});});});}else{return _0x1ccbd5[_0x0454('0x13')](0xc8);}})[_0x0454('0x29')](handleError(_0x1ccbd5,null));}; \ No newline at end of file +var _0x5eea=['rows','addTags','setTags','ids','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','fullname','mkdirSync','Openchannel','closedAt','disposition','map','basename','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','stack','name','OpenchannelInteraction','type','key','getOptions','findAll','openchannel','query','user','catch','from','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','describe','addMessage','omit','getMessages','findOne','OpenchannelMessage','rawAttributes','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include'];(function(_0xf83277,_0x55487e){var _0x361e0e=function(_0xa2b602){while(--_0xa2b602){_0xf83277['push'](_0xf83277['shift']());}};_0x361e0e(++_0x55487e);}(_0x5eea,0x1a7));var _0xa5ee=function(_0x213ecd,_0x5aa5a2){_0x213ecd=_0x213ecd-0x0;var _0x3974c0=_0x5eea[_0x213ecd];return _0x3974c0;};'use strict';var rimraf=require(_0xa5ee('0x0'));var zipdir=require(_0xa5ee('0x1'));var moment=require('moment');var util=require(_0xa5ee('0x2'));var path=require(_0xa5ee('0x3'));var ejs=require(_0xa5ee('0x4'));var fs=require('fs');var _=require(_0xa5ee('0x5'));var Redis=require(_0xa5ee('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xa5ee('0x7'));var logger=require(_0xa5ee('0x8'))(_0xa5ee('0x9'));var config=require(_0xa5ee('0xa'));var db=require(_0xa5ee('0xb'))['db'];config['redis']=_[_0xa5ee('0xc')](config[_0xa5ee('0xd')],{'host':_0xa5ee('0xe'),'port':0x18eb});var socket=require(_0xa5ee('0xf'))(new Redis(config[_0xa5ee('0xd')]));require(_0xa5ee('0x10'))['register'](socket);function respondWithStatusCode(_0xd6cdd8,_0x505266){_0x505266=_0x505266||0xcc;return function(_0x5cbbac){if(_0x5cbbac){return _0xd6cdd8[_0xa5ee('0x11')](_0x505266);}return _0xd6cdd8[_0xa5ee('0x12')](_0x505266)[_0xa5ee('0x13')]();};}function respondWithResult(_0x45a186,_0x316aed){_0x316aed=_0x316aed||0xc8;return function(_0x5b4322){if(_0x5b4322){return _0x45a186[_0xa5ee('0x12')](_0x316aed)[_0xa5ee('0x14')](_0x5b4322);}};}function respondWithFilteredResult(_0x33f069,_0x976df5){return function(_0x4c0d58){if(_0x4c0d58){var _0x467468=typeof _0x976df5[_0xa5ee('0x15')]===_0xa5ee('0x16')&&typeof _0x976df5['limit']===_0xa5ee('0x16');var _0x3729cc=_0x4c0d58[_0xa5ee('0x17')];var _0x168d13=_0x467468?0x0:_0x976df5['offset'];var _0x382c76=_0x467468?_0x4c0d58[_0xa5ee('0x17')]:_0x976df5['offset']+_0x976df5[_0xa5ee('0x18')];var _0x3663bc;if(_0x382c76>=_0x3729cc){_0x382c76=_0x3729cc;_0x3663bc=0xc8;}else{_0x3663bc=0xce;}_0x33f069['status'](_0x3663bc);return _0x33f069[_0xa5ee('0x19')](_0xa5ee('0x1a'),_0x168d13+'-'+_0x382c76+'/'+_0x3729cc)[_0xa5ee('0x14')](_0x4c0d58);}return null;};}function saveUpdates(_0x358d18){return function(_0xa9a89d){if(_0xa9a89d){return _0xa9a89d[_0xa5ee('0x1b')](_0x358d18)['then'](function(_0x4d273f){return _0x4d273f;});}return null;};}function removeEntity(_0xe47ab9){return function(_0x57220f){if(_0x57220f){return _0x57220f['destroy']()[_0xa5ee('0x1c')](function(){_0xe47ab9[_0xa5ee('0x12')](0xcc)[_0xa5ee('0x13')]();});}};}function handleEntityNotFound(_0x5a0b90){return function(_0x5dcc17){if(!_0x5dcc17){_0x5a0b90[_0xa5ee('0x11')](0x194);}return _0x5dcc17;};}function handleError(_0x138ae6,_0x137b5f){_0x137b5f=_0x137b5f||0x1f4;return function(_0x3eb9d1){logger['error'](_0x3eb9d1[_0xa5ee('0x1d')]);if(_0x3eb9d1[_0xa5ee('0x1e')]){delete _0x3eb9d1[_0xa5ee('0x1e')];}_0x138ae6[_0xa5ee('0x12')](_0x137b5f)['send'](_0x3eb9d1);};}exports['index']=function(_0x508590,_0x1d06f6){var _0x3250b5={};var _0x447606=_['map'](db[_0xa5ee('0x1f')]['rawAttributes'],function(_0x52b5ef){return{'name':_0x52b5ef['fieldName'],'type':_0x52b5ef[_0xa5ee('0x20')][_0xa5ee('0x21')]};});_0x3250b5=qs[_0xa5ee('0x22')](_0x447606,_0x508590);return interaction[_0xa5ee('0x23')](_0xa5ee('0x24'),_0x508590[_0xa5ee('0x25')],_0x508590[_0xa5ee('0x26')],_0x3250b5,_0x447606)[_0xa5ee('0x1c')](respondWithFilteredResult(_0x1d06f6,_0x3250b5))[_0xa5ee('0x27')](handleError(_0x1d06f6,null));};exports['show']=function(_0xfbb30d,_0x121b19){var _0x4e7352={};if(_0xfbb30d[_0xa5ee('0x25')][_0xa5ee('0x20')]&&_0xfbb30d[_0xa5ee('0x25')][_0xa5ee('0x20')]===_0xa5ee('0x28')){_0x4e7352['from']=_0xfbb30d['params']['id'];}else{_0x4e7352['id']=_0xfbb30d[_0xa5ee('0x29')]['id'];}var _0x1bb45b={'raw':![],'where':_0x4e7352},_0xd5b981={};_0xd5b981[_0xa5ee('0x2a')]=_['keys'](db[_0xa5ee('0x1f')]['rawAttributes']);_0xd5b981[_0xa5ee('0x25')]=_[_0xa5ee('0x2b')](_0xfbb30d[_0xa5ee('0x25')]);_0xd5b981[_0xa5ee('0x2c')]=_[_0xa5ee('0x2d')](_0xd5b981[_0xa5ee('0x2a')],_0xd5b981[_0xa5ee('0x25')]);_0x1bb45b[_0xa5ee('0x2e')]=_[_0xa5ee('0x2d')](_0xd5b981[_0xa5ee('0x2a')],qs['fields'](_0xfbb30d[_0xa5ee('0x25')][_0xa5ee('0x2f')]));_0x1bb45b[_0xa5ee('0x2e')]=_0x1bb45b[_0xa5ee('0x2e')]['length']?_0x1bb45b['attributes']:_0xd5b981[_0xa5ee('0x2a')];if(_0xfbb30d[_0xa5ee('0x25')]['includeAll']){_0x1bb45b['include']=[{'all':!![]}];}_0x1bb45b=_[_0xa5ee('0x30')]({},_0x1bb45b,_0xfbb30d[_0xa5ee('0x31')]);return db[_0xa5ee('0x1f')][_0xa5ee('0x32')](_0x1bb45b)[_0xa5ee('0x1c')](handleEntityNotFound(_0x121b19,null))['then'](respondWithResult(_0x121b19,null))[_0xa5ee('0x27')](handleError(_0x121b19,null));};exports[_0xa5ee('0x33')]=function(_0x2c34ce,_0x1b0553){return db[_0xa5ee('0x1f')][_0xa5ee('0x33')](_0x2c34ce[_0xa5ee('0x34')],{})[_0xa5ee('0x1c')](respondWithResult(_0x1b0553,0xc9))['catch'](handleError(_0x1b0553,null));};exports[_0xa5ee('0x1b')]=function(_0x47c04d,_0x3d7c56){if(_0x47c04d[_0xa5ee('0x34')]['id']){delete _0x47c04d[_0xa5ee('0x34')]['id'];}return db['OpenchannelInteraction'][_0xa5ee('0x32')]({'where':{'id':_0x47c04d[_0xa5ee('0x29')]['id']}})[_0xa5ee('0x1c')](handleEntityNotFound(_0x3d7c56,null))['then'](saveUpdates(_0x47c04d[_0xa5ee('0x34')],null))[_0xa5ee('0x1c')](respondWithResult(_0x3d7c56,null))[_0xa5ee('0x27')](handleError(_0x3d7c56,null));};exports['destroy']=function(_0x50a4df,_0x16e702){return db[_0xa5ee('0x1f')][_0xa5ee('0x32')]({'where':{'id':_0x50a4df[_0xa5ee('0x29')]['id']}})[_0xa5ee('0x1c')](handleEntityNotFound(_0x16e702,null))[_0xa5ee('0x1c')](removeEntity(_0x16e702,null))['catch'](handleError(_0x16e702,null));};exports[_0xa5ee('0x35')]=function(_0x4e78c0,_0x2b79e6){return db['OpenchannelInteraction'][_0xa5ee('0x35')]()['then'](respondWithResult(_0x2b79e6,null))[_0xa5ee('0x27')](handleError(_0x2b79e6,null));};exports['addMessage']=function(_0x17c5cb,_0x511764){return db['OpenchannelMessage']['find']({'where':{'id':_0x17c5cb[_0xa5ee('0x29')]['id']}})['then'](handleEntityNotFound(_0x511764,null))[_0xa5ee('0x1c')](function(_0x337970){if(_0x337970){return _0x337970[_0xa5ee('0x36')](_0x17c5cb[_0xa5ee('0x34')]['ids'],_[_0xa5ee('0x37')](_0x17c5cb[_0xa5ee('0x34')],['ids','id'])||{});}})[_0xa5ee('0x1c')](respondWithResult(_0x511764,null))[_0xa5ee('0x27')](handleError(_0x511764,null));};exports[_0xa5ee('0x38')]=function(_0x561498,_0x15c8b6){var _0x586c28={'raw':![],'where':{}};var _0x537e63={};var _0x296702={'count':0x0,'rows':[]};return db[_0xa5ee('0x1f')][_0xa5ee('0x39')]({'where':{'id':_0x561498['params']['id']}})[_0xa5ee('0x1c')](handleEntityNotFound(_0x15c8b6,null))[_0xa5ee('0x1c')](function(_0x5a48d7){if(_0x5a48d7){_0x537e63[_0xa5ee('0x2a')]=_['keys'](db[_0xa5ee('0x3a')][_0xa5ee('0x3b')]);_0x537e63[_0xa5ee('0x25')]=_[_0xa5ee('0x2b')](_0x561498[_0xa5ee('0x25')]);_0x537e63[_0xa5ee('0x2c')]=_['intersection'](_0x537e63[_0xa5ee('0x2a')],_0x537e63[_0xa5ee('0x25')]);_0x586c28[_0xa5ee('0x2e')]=_[_0xa5ee('0x2d')](_0x537e63[_0xa5ee('0x2a')],qs[_0xa5ee('0x2f')](_0x561498[_0xa5ee('0x25')]['fields']));_0x586c28[_0xa5ee('0x2e')]=_0x586c28[_0xa5ee('0x2e')]['length']?_0x586c28[_0xa5ee('0x2e')]:_0x537e63[_0xa5ee('0x2a')];if(!_0x561498[_0xa5ee('0x25')][_0xa5ee('0x3c')](_0xa5ee('0x3d'))){_0x586c28[_0xa5ee('0x18')]=qs['limit'](_0x561498['query'][_0xa5ee('0x18')]);_0x586c28['offset']=qs[_0xa5ee('0x15')](_0x561498[_0xa5ee('0x25')][_0xa5ee('0x15')]);}_0x586c28['order']=qs['sort'](_0x561498[_0xa5ee('0x25')][_0xa5ee('0x3e')]);_0x586c28[_0xa5ee('0x3f')]=qs[_0xa5ee('0x2c')](_[_0xa5ee('0x40')](_0x561498[_0xa5ee('0x25')],_0x537e63['filters']));_0x586c28[_0xa5ee('0x3f')][_0xa5ee('0x41')]=_0x5a48d7['id'];if(_0x561498[_0xa5ee('0x25')][_0xa5ee('0x42')]){_0x586c28[_0xa5ee('0x3f')]=_[_0xa5ee('0x30')](_0x586c28[_0xa5ee('0x3f')],{'$or':_['map'](_0x586c28['attributes'],function(_0x2c5187){var _0x4a7fdf={};_0x4a7fdf[_0x2c5187]={'$like':'%'+_0x561498[_0xa5ee('0x25')][_0xa5ee('0x42')]+'%'};return _0x4a7fdf;})});}if(_0x561498[_0xa5ee('0x25')]['$gte']){var _0x50b9f5=_0x561498[_0xa5ee('0x25')][_0xa5ee('0x43')][_0xa5ee('0x44')](',');var _0x207da7={};_0x207da7[_0x50b9f5[0x0]]={'$gte':moment(_0x50b9f5[0x1])[_0xa5ee('0x45')](_0xa5ee('0x46'))};_0x586c28[_0xa5ee('0x3f')]=_['merge'](_0x586c28['where'],_0x207da7);}_0x586c28=_['merge']({},_0x586c28,_0x561498['options']);return db[_0xa5ee('0x3a')]['count']({'where':_0x586c28['where']})['then'](function(_0x4cf8dd){_0x296702['count']=_0x4cf8dd;if(_0x561498['query'][_0xa5ee('0x47')]){_0x586c28[_0xa5ee('0x48')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xa5ee('0x23')](_0x586c28);})[_0xa5ee('0x1c')](function(_0x32f558){_0x296702[_0xa5ee('0x49')]=_0x32f558;return _0x296702;});}})[_0xa5ee('0x1c')](respondWithFilteredResult(_0x15c8b6,_0x586c28))['catch'](handleError(_0x15c8b6,null));};exports[_0xa5ee('0x4a')]=function(_0x2e1c43,_0x72d14b){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2e1c43[_0xa5ee('0x29')]['id']}})[_0xa5ee('0x1c')](handleEntityNotFound(_0x72d14b,null))[_0xa5ee('0x1c')](function(_0x349fb0){if(_0x349fb0){return _0x349fb0[_0xa5ee('0x4b')](_0x2e1c43['body'][_0xa5ee('0x4c')],_[_0xa5ee('0x37')](_0x2e1c43[_0xa5ee('0x34')],[_0xa5ee('0x4c'),'id'])||{})[_0xa5ee('0x4d')](function(){return db[_0xa5ee('0x4e')]['findAll']({'attributes':['id',_0xa5ee('0x1e'),'color'],'where':{'id':_0x2e1c43[_0xa5ee('0x34')][_0xa5ee('0x4c')]}});})['then'](function(_0x362c24){socket[_0xa5ee('0x4f')](_0xa5ee('0x50'),{'id':Number(_0x2e1c43[_0xa5ee('0x29')]['id']),'tags':_0x362c24||[]});return{'id':Number(_0x2e1c43['params']['id']),'tags':_0x362c24||[]};});}})['then'](respondWithResult(_0x72d14b,null))['catch'](handleError(_0x72d14b,null));};exports[_0xa5ee('0x51')]=function(_0x28651d,_0x31ee7b){return db[_0xa5ee('0x1f')][_0xa5ee('0x32')]({'where':{'id':_0x28651d[_0xa5ee('0x29')]['id']}})['then'](handleEntityNotFound(_0x31ee7b,null))[_0xa5ee('0x1c')](function(_0x467aa3){if(_0x467aa3){return _0x467aa3[_0xa5ee('0x51')](_0x28651d[_0xa5ee('0x25')][_0xa5ee('0x4c')]);}})[_0xa5ee('0x1c')](respondWithStatusCode(_0x31ee7b,null))['catch'](handleError(_0x31ee7b,null));};exports[_0xa5ee('0x52')]=function(_0x3988c4,_0x557c78){var _0x52e764=moment()['unix']()[_0xa5ee('0x53')]();var _0x1006f8=path[_0xa5ee('0x54')](config[_0xa5ee('0x55')],_0xa5ee('0x56'),_0xa5ee('0x57'),_0xa5ee('0x58'));var _0x33dfa3=path[_0xa5ee('0x54')](config[_0xa5ee('0x55')],_0xa5ee('0x56'),_0xa5ee('0x57'),_0xa5ee('0x59'));var _0x1f15db=path['join'](_0x1006f8,_0x52e764);var _0x49ed1d=util['format'](_0xa5ee('0x5a'),_0x3988c4[_0xa5ee('0x29')]['id'],_0x52e764);var _0x383072=path[_0xa5ee('0x54')](_0x1006f8,_0x49ed1d);var _0x17b560=[];_0x17b560[_0xa5ee('0x5b')]({'model':db['User'],'as':_0xa5ee('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x17b560[_0xa5ee('0x5b')]({'model':db[_0xa5ee('0x5d')],'as':_0xa5ee('0x5e'),'attributes':['id',_0xa5ee('0x5f'),_0xa5ee('0x60')],'raw':!![]});if(_0x3988c4[_0xa5ee('0x25')]['attachments']){_0x17b560[_0xa5ee('0x5b')]({'model':db[_0xa5ee('0x61')],'as':_0xa5ee('0x61'),'raw':!![]});}var _0x228fe0=[{'model':db[_0xa5ee('0x3a')],'as':_0xa5ee('0x62'),'attributes':['id','body',_0xa5ee('0x63'),_0xa5ee('0x64'),_0xa5ee('0x65'),_0xa5ee('0x66')],'include':_0x17b560}];_0x228fe0[_0xa5ee('0x5b')]({'model':db[_0xa5ee('0x67')],'as':'Account','attributes':['id','name']});_0x228fe0['push']({'model':db[_0xa5ee('0x5c')],'as':_0xa5ee('0x68'),'attributes':['id',_0xa5ee('0x69')]});return db[_0xa5ee('0x1f')][_0xa5ee('0x32')]({'where':{'id':_0x3988c4[_0xa5ee('0x29')]['id']},'include':_0x228fe0})[_0xa5ee('0x1c')](handleEntityNotFound(_0x557c78,null))[_0xa5ee('0x1c')](function(_0x2e3073){if(_0x2e3073){var _0x293b07=_0x2e3073['get']({'plain':!![]});fs[_0xa5ee('0x6a')](_0x1f15db);var _0x5d749e={'channel':_0xa5ee('0x6b'),'account':_0x293b07['Account'][_0xa5ee('0x1e')],'agent':_0x293b07[_0xa5ee('0x68')]?_0x293b07[_0xa5ee('0x68')][_0xa5ee('0x69')]:'N.A.','createdAt':moment(_0x293b07[_0xa5ee('0x63')])[_0xa5ee('0x45')](_0xa5ee('0x46'))[_0xa5ee('0x53')](),'closedAt':_0x293b07['closed']?moment(_0x293b07[_0xa5ee('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa5ee('0x53')]():'','disposition':_0x293b07[_0xa5ee('0x6d')],'visibility':_0x293b07['threadId']?'Public':'Private','messages':_(_0x293b07[_0xa5ee('0x62')])['filter']({'secret':![]})[_0xa5ee('0x6e')](function(_0x51d53a){if(_0x51d53a['Attachment']){var _0x3a7ab8=path[_0xa5ee('0x54')](_0x33dfa3,_0x51d53a['Attachment'][_0xa5ee('0x6f')]);if(fs['existsSync'](_0x3a7ab8)){fs[_0xa5ee('0x70')](_0x3a7ab8)[_0xa5ee('0x71')](fs[_0xa5ee('0x72')](path['join'](_0x1f15db,_0x51d53a[_0xa5ee('0x61')]['basename'])));}}return{'date':moment(_0x51d53a[_0xa5ee('0x63')])[_0xa5ee('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa5ee('0x53')](),'sender':_0x51d53a[_0xa5ee('0x64')]===_0xa5ee('0x73')?_0x51d53a[_0xa5ee('0x5c')]?_0x51d53a[_0xa5ee('0x5c')][_0xa5ee('0x69')]:'System':_0x51d53a[_0xa5ee('0x5e')][_0xa5ee('0x5f')]+(_0x51d53a[_0xa5ee('0x5e')][_0xa5ee('0x60')]?'\x20'+_0x51d53a['Contact'][_0xa5ee('0x60')]:''),'body':_0x51d53a[_0xa5ee('0x61')]?_0x51d53a['Attachment'][_0xa5ee('0x6f')]:_0x51d53a[_0xa5ee('0x34')],'direction':_0x51d53a[_0xa5ee('0x64')]===_0xa5ee('0x73')?'A':'C','secret':_0x51d53a[_0xa5ee('0x65')],'read':_0x51d53a['read'],'attachment':_0x51d53a[_0xa5ee('0x61')]};})['value']()};return ejs[_0xa5ee('0x74')](path[_0xa5ee('0x54')](config[_0xa5ee('0x55')],'server',_0xa5ee('0x75'),_0xa5ee('0x76')),{'interaction':_0x5d749e})['then'](function(_0xc0db3b){var _0x1d1e8b=path['join'](_0x1f15db,_0xa5ee('0x77')+_0x293b07['id']+'-'+_0x52e764+'.pdf');var _0x4bc682={'path':_0x1d1e8b,'channel':_0xa5ee('0x6b'),'interactionId':_0x293b07['id']};return pdf[_0xa5ee('0x78')](_0xc0db3b,_0x4bc682);})[_0xa5ee('0x1c')](function(){return new Promise(function(_0x9e6ceb,_0x4ec526){zipdir(_0x1f15db,{'saveTo':_0x383072},function(_0x55713b,_0x29196e){if(_0x55713b)return _0x4ec526(_0x55713b);return _0x9e6ceb(_0x29196e);});})['then'](function(){return new Promise(function(_0x500c63,_0x42f172){rimraf(_0x1f15db,function(_0x5831d8){if(_0x5831d8)_0x42f172(_0x5831d8);return _0x500c63();});});})['then'](function(){return _0x557c78['download'](_0x383072,_0x49ed1d,function(_0x548c9a){if(_0x548c9a){logger[_0xa5ee('0x79')](_0xa5ee('0x7a'),_0x548c9a);}else{fs[_0xa5ee('0x7b')](_0x383072);}});});});}else{return _0x557c78[_0xa5ee('0x11')](0xc8);}})[_0xa5ee('0x27')](handleError(_0x557c78,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 4637db8..c9fe9fc 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 _0x761c=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x16aa70,_0x5b1f73){var _0x11875f=function(_0x18c7be){while(--_0x18c7be){_0x16aa70['push'](_0x16aa70['shift']());}};_0x11875f(++_0x5b1f73);}(_0x761c,0x13c));var _0xc761=function(_0xd82a14,_0x49b5c1){_0xd82a14=_0xd82a14-0x0;var _0x2d92ce=_0x761c[_0xd82a14];return _0x2d92ce;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xc761('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0xc761('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc761('0x2')](0x0);var events={'afterCreate':_0xc761('0x3'),'afterUpdate':_0xc761('0x4'),'afterDestroy':_0xc761('0x5')};function emitEvent(_0x1e0991){return function(_0x5293c5,_0x3526d8,_0x5c4b83){_0x5293c5[_0xc761('0x6')]({'attributes':['id'],'raw':!![]})[_0xc761('0x7')](function(_0x48393e){_0x5293c5[_0xc761('0x8')](_0xc761('0x9'),_0x48393e[_0xc761('0xa')](function(_0x3018a4){return{'id':_0x3018a4['id']};}));return OpenchannelMessage[_0xc761('0xb')]({'where':{'OpenchannelInteractionId':_0x5293c5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc761('0x7')](function(_0xe844da){_0x5293c5[_0xc761('0x8')](_0xc761('0xc'),_0xe844da[_0xc761('0xd')]);OpenchannelInteractionEvents[_0xc761('0xe')](_0x1e0991+':'+_0x5293c5['id'],_0x5293c5);OpenchannelInteractionEvents['emit'](_0x1e0991,_0x5293c5);_0x5c4b83(null);})[_0xc761('0xf')](_0x5c4b83(null));};}for(var e in events){if(events[_0xc761('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xc761('0x11')](e,emitEvent(event));}}module[_0xc761('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4a2b=['OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction'];(function(_0x3052c4,_0x332110){var _0x1afabc=function(_0x1cec37){while(--_0x1cec37){_0x3052c4['push'](_0x3052c4['shift']());}};_0x1afabc(++_0x332110);}(_0x4a2b,0x141));var _0xb4a2=function(_0x462753,_0x18db45){_0x462753=_0x462753-0x0;var _0x241048=_0x4a2b[_0x462753];return _0x241048;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xb4a2('0x0'))['db'][_0xb4a2('0x1')];var OpenchannelMessage=require(_0xb4a2('0x0'))['db'][_0xb4a2('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb4a2('0x3')](0x0);var events={'afterCreate':_0xb4a2('0x4'),'afterUpdate':_0xb4a2('0x5'),'afterDestroy':_0xb4a2('0x6')};function emitEvent(_0x1912c5){return function(_0x449357,_0x547934,_0x7316cf){_0x449357[_0xb4a2('0x7')]({'attributes':['id'],'raw':!![]})[_0xb4a2('0x8')](function(_0x5aeb47){_0x449357['setDataValue'](_0xb4a2('0x9'),_0x5aeb47[_0xb4a2('0xa')](function(_0x27eb24){return{'id':_0x27eb24['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x449357['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4a2('0x8')](function(_0x5d9932){_0x449357[_0xb4a2('0xb')](_0xb4a2('0xc'),_0x5d9932['length']);OpenchannelInteractionEvents[_0xb4a2('0xd')](_0x1912c5+':'+_0x449357['id'],_0x449357);OpenchannelInteractionEvents['emit'](_0x1912c5,_0x449357);_0x7316cf(null);})[_0xb4a2('0xe')](_0x7316cf(null));};}for(var e in events){if(events[_0xb4a2('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb4a2('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 50aa258..31bdb0b 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 _0x5649=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x46f8be,_0x331b1a){var _0x347de5=function(_0x29fe2d){while(--_0x29fe2d){_0x46f8be['push'](_0x46f8be['shift']());}};_0x347de5(++_0x331b1a);}(_0x5649,0xde));var _0x9564=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x5649[_0x214a25];return _0x405988;};'use strict';var _=require(_0x9564('0x0'));var util=require(_0x9564('0x1'));var logger=require(_0x9564('0x2'))(_0x9564('0x3'));var moment=require(_0x9564('0x4'));var BPromise=require(_0x9564('0x5'));var rp=require(_0x9564('0x6'));var fs=require('fs');var path=require(_0x9564('0x7'));var rimraf=require(_0x9564('0x8'));var config=require(_0x9564('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5a32e7,_0x243f95){return _0x5a32e7[_0x9564('0xa')](_0x9564('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9564('0xc'),'hooks':{'beforeUpdate':function(_0x4e6e65,_0x59e0c7,_0x2e815f){if(_0x4e6e65[_0x9564('0xd')]('closed')){_0x4e6e65['closedAt']=moment()[_0x9564('0xe')](_0x9564('0xf'));}_0x2e815f(null,_0x4e6e65);}}});}; \ No newline at end of file +var _0x9e33=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x9e33,0x144));var _0x39e3=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x9e33[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x39e3('0x0'));var util=require(_0x39e3('0x1'));var logger=require(_0x39e3('0x2'))(_0x39e3('0x3'));var moment=require(_0x39e3('0x4'));var BPromise=require(_0x39e3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x39e3('0x6'));var config=require(_0x39e3('0x7'));var attributes=require(_0x39e3('0x8'));module[_0x39e3('0x9')]=function(_0x436c94,_0x59a881){return _0x436c94['define'](_0x39e3('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x39e3('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x58ff92,_0x41c4c4,_0x1add3b){if(_0x58ff92['changed'](_0x39e3('0xc'))){_0x58ff92[_0x39e3('0xd')]=moment()['format'](_0x39e3('0xe'));}_0x1add3b(null,_0x58ff92);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8419aee..87686f8 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 _0x2bb2=['catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','body','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelInteraction','update','options','where','attributes','limit','debug'];(function(_0x316326,_0x34c0a6){var _0x5e12bc=function(_0x32c984){while(--_0x32c984){_0x316326['push'](_0x316326['shift']());}};_0x5e12bc(++_0x34c0a6);}(_0x2bb2,0xd2));var _0x22bb=function(_0x522d5a,_0x27d1ea){_0x522d5a=_0x522d5a-0x0;var _0x746e66=_0x2bb2[_0x522d5a];return _0x746e66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x22bb('0x0'));var BPromise=require(_0x22bb('0x1'));var rs=require(_0x22bb('0x2'));var fs=require('fs');var Redis=require(_0x22bb('0x3'));var db=require(_0x22bb('0x4'))['db'];var utils=require(_0x22bb('0x5'));var logger=require(_0x22bb('0x6'))(_0x22bb('0x7'));var config=require('../../config/environment');var jayson=require(_0x22bb('0x8'));var client=jayson['client'][_0x22bb('0x9')]({'port':0x232a});config[_0x22bb('0xa')]=_[_0x22bb('0xb')](config['redis'],{'host':_0x22bb('0xc'),'port':0x18eb});var socket=require(_0x22bb('0xd'))(new Redis(config[_0x22bb('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5d9f0d,_0x37c40d,_0x13a851){return new BPromise(function(_0x2d1cfd,_0x450d1c){return client[_0x22bb('0xe')](_0x5d9f0d,_0x13a851)[_0x22bb('0xf')](function(_0x1f3a72){logger[_0x22bb('0x10')](_0x22bb('0x11'),_0x37c40d,_0x22bb('0x12'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x37c40d,_0x22bb('0x12'),JSON[_0x22bb('0x13')](_0x1f3a72));if(_0x1f3a72[_0x22bb('0x14')]){if(_0x1f3a72['error'][_0x22bb('0x15')]===0x1f4){logger[_0x22bb('0x14')](_0x22bb('0x11'),_0x37c40d,_0x1f3a72[_0x22bb('0x14')][_0x22bb('0x16')]);return _0x450d1c(_0x1f3a72[_0x22bb('0x14')][_0x22bb('0x16')]);}logger['error'](_0x22bb('0x11'),_0x37c40d,_0x1f3a72[_0x22bb('0x14')][_0x22bb('0x16')]);return _0x2d1cfd(_0x1f3a72[_0x22bb('0x14')]['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x37c40d,'request\x20sent');_0x2d1cfd(_0x1f3a72['result']['message']);}})['catch'](function(_0x3e25ec){logger[_0x22bb('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x37c40d,_0x3e25ec);_0x450d1c(_0x3e25ec);});});}exports[_0x22bb('0x17')]=function(_0x531ef3){var _0x3bba2f=this;return new Promise(function(_0x11713e,_0x48a0d4){return db['OpenchannelInteraction'][_0x22bb('0x18')](_0x531ef3['body'],{'raw':_0x531ef3[_0x22bb('0x19')]?_0x531ef3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531ef3[_0x22bb('0x19')]?_0x531ef3[_0x22bb('0x19')][_0x22bb('0x1a')]||null:null,'attributes':_0x531ef3[_0x22bb('0x19')]?_0x531ef3[_0x22bb('0x19')][_0x22bb('0x1b')]||null:null,'limit':_0x531ef3[_0x22bb('0x19')]?_0x531ef3[_0x22bb('0x19')][_0x22bb('0x1c')]||null:null})['then'](function(_0x2b13d2){logger['info']('UpdateOpenchannelInteraction',_0x531ef3);logger[_0x22bb('0x1d')](_0x22bb('0x17'),_0x531ef3,JSON[_0x22bb('0x13')](_0x2b13d2));_0x11713e(_0x2b13d2);})[_0x22bb('0x1e')](function(_0x786f12){logger[_0x22bb('0x14')](_0x22bb('0x17'),_0x786f12[_0x22bb('0x16')],_0x531ef3);_0x48a0d4(_0x3bba2f[_0x22bb('0x14')](0x1f4,_0x786f12['message']));});});};exports[_0x22bb('0x1f')]=function(_0x177d37){return new Promise(function(_0x469274,_0x56530b){return db[_0x22bb('0x20')][_0x22bb('0x21')]({'where':_0x177d37[_0x22bb('0x19')]?_0x177d37['options']['where']||null:null})[_0x22bb('0xf')](function(_0x71129c){if(_0x71129c){return _0x71129c[_0x22bb('0x22')](_0x177d37['body'][_0x22bb('0x23')],_[_0x22bb('0x24')](_0x177d37[_0x22bb('0x25')],[_0x22bb('0x23'),'id'])||{});}})[_0x22bb('0x26')](function(_0x41385f){logger['info'](_0x22bb('0x27'),_0x177d37);logger['debug'](_0x22bb('0x27'),_0x177d37,JSON[_0x22bb('0x13')](_0x41385f));_0x469274(_0x41385f);})['catch'](function(_0x3cc1ed){logger[_0x22bb('0x14')](_0x22bb('0x27'),_0x3cc1ed[_0x22bb('0x16')],_0x177d37);_0x56530b(_this[_0x22bb('0x14')](0x1f4,_0x3cc1ed[_0x22bb('0x16')]));});});}; \ No newline at end of file +var _0xd41b=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x190154,_0x114d9f){var _0x8086e7=function(_0x7ae5bc){while(--_0x7ae5bc){_0x190154['push'](_0x190154['shift']());}};_0x8086e7(++_0x114d9f);}(_0xd41b,0x159));var _0xbd41=function(_0x3fd59e,_0x5cdb73){_0x3fd59e=_0x3fd59e-0x0;var _0x83a0a1=_0xd41b[_0x3fd59e];return _0x83a0a1;};'use strict';var _=require(_0xbd41('0x0'));var util=require(_0xbd41('0x1'));var moment=require(_0xbd41('0x2'));var BPromise=require(_0xbd41('0x3'));var rs=require(_0xbd41('0x4'));var fs=require('fs');var Redis=require(_0xbd41('0x5'));var db=require(_0xbd41('0x6'))['db'];var utils=require(_0xbd41('0x7'));var logger=require(_0xbd41('0x8'))(_0xbd41('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd41('0xa')]['http']({'port':0x232a});config[_0xbd41('0xb')]=_[_0xbd41('0xc')](config[_0xbd41('0xb')],{'host':_0xbd41('0xd'),'port':0x18eb});var socket=require(_0xbd41('0xe'))(new Redis(config[_0xbd41('0xb')]));require(_0xbd41('0xf'))[_0xbd41('0x10')](socket);function respondWithRpcPromise(_0x58980d,_0x284b43,_0xdb1853){return new BPromise(function(_0x22c03e,_0x16fbf5){return client['request'](_0x58980d,_0xdb1853)[_0xbd41('0x11')](function(_0x31f62a){logger[_0xbd41('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x284b43,_0xbd41('0x13'));logger['debug'](_0xbd41('0x14'),_0x284b43,_0xbd41('0x13'),JSON[_0xbd41('0x15')](_0x31f62a));if(_0x31f62a[_0xbd41('0x16')]){if(_0x31f62a['error']['code']===0x1f4){logger[_0xbd41('0x16')](_0xbd41('0x17'),_0x284b43,_0x31f62a[_0xbd41('0x16')][_0xbd41('0x18')]);return _0x16fbf5(_0x31f62a['error']['message']);}logger[_0xbd41('0x16')](_0xbd41('0x17'),_0x284b43,_0x31f62a[_0xbd41('0x16')][_0xbd41('0x18')]);return _0x22c03e(_0x31f62a[_0xbd41('0x16')][_0xbd41('0x18')]);}else{logger[_0xbd41('0x12')](_0xbd41('0x17'),_0x284b43,_0xbd41('0x13'));_0x22c03e(_0x31f62a[_0xbd41('0x19')]['message']);}})[_0xbd41('0x1a')](function(_0x2f5ceb){logger['error'](_0xbd41('0x17'),_0x284b43,_0x2f5ceb);_0x16fbf5(_0x2f5ceb);});});}exports[_0xbd41('0x1b')]=function(_0x57617e){var _0x25cde4=this;return new Promise(function(_0x2b211a,_0x37d2f3){return db[_0xbd41('0x1c')]['update'](_0x57617e[_0xbd41('0x1d')],{'raw':_0x57617e[_0xbd41('0x1e')]?_0x57617e[_0xbd41('0x1e')][_0xbd41('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57617e[_0xbd41('0x1e')]?_0x57617e[_0xbd41('0x1e')]['where']||null:null,'attributes':_0x57617e['options']?_0x57617e[_0xbd41('0x1e')][_0xbd41('0x20')]||null:null,'limit':_0x57617e[_0xbd41('0x1e')]?_0x57617e[_0xbd41('0x1e')][_0xbd41('0x21')]||null:null})[_0xbd41('0x11')](function(_0xed522){logger['info'](_0xbd41('0x1b'),_0x57617e);logger[_0xbd41('0x22')](_0xbd41('0x1b'),_0x57617e,JSON['stringify'](_0xed522));_0x2b211a(_0xed522);})[_0xbd41('0x1a')](function(_0x5a2bdb){logger[_0xbd41('0x16')](_0xbd41('0x1b'),_0x5a2bdb[_0xbd41('0x18')],_0x57617e);_0x37d2f3(_0x25cde4[_0xbd41('0x16')](0x1f4,_0x5a2bdb[_0xbd41('0x18')]));});});};exports[_0xbd41('0x23')]=function(_0x387710){return new Promise(function(_0x366fd4,_0x16042f){return db['OpenchannelInteraction'][_0xbd41('0x24')]({'where':_0x387710[_0xbd41('0x1e')]?_0x387710[_0xbd41('0x1e')]['where']||null:null})[_0xbd41('0x11')](function(_0x331372){if(_0x331372){return _0x331372[_0xbd41('0x25')](_0x387710['body']['ids'],_['omit'](_0x387710[_0xbd41('0x1d')],[_0xbd41('0x26'),'id'])||{});}})[_0xbd41('0x27')](function(_0xe0f1fc){logger[_0xbd41('0x12')](_0xbd41('0x28'),_0x387710);logger[_0xbd41('0x22')]('AddTags',_0x387710,JSON[_0xbd41('0x15')](_0xe0f1fc));_0x366fd4(_0xe0f1fc);})[_0xbd41('0x1a')](function(_0x1293ee){logger[_0xbd41('0x16')](_0xbd41('0x28'),_0x1293ee[_0xbd41('0x18')],_0x387710);_0x16042f(_this['error'](0x1f4,_0x1293ee[_0xbd41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 749aa7f..fa951ef 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 _0x39cb=['openchannelInteraction:','./openchannelInteraction.events','save','emit','removeListener','register','length'];(function(_0x41cf29,_0x216a99){var _0x566462=function(_0x31311a){while(--_0x31311a){_0x41cf29['push'](_0x41cf29['shift']());}};_0x566462(++_0x216a99);}(_0x39cb,0x14a));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var OpenchannelInteractionEvents=require(_0xb39c('0x0'));var events=[_0xb39c('0x1'),'remove','update'];function createListener(_0x490367,_0x6790c7){return function(_0x435314){_0x6790c7[_0xb39c('0x2')](_0x490367,_0x435314);};}function removeListener(_0x1535e3,_0x581790){return function(){OpenchannelInteractionEvents[_0xb39c('0x3')](_0x1535e3,_0x581790);};}exports[_0xb39c('0x4')]=function(_0x2158db){for(var _0x18eb8f=0x0,_0x3a5663=events[_0xb39c('0x5')];_0x18eb8f<_0x3a5663;_0x18eb8f++){var _0x36ed93=events[_0x18eb8f];var _0x1313a1=createListener(_0xb39c('0x6')+_0x36ed93,_0x2158db);OpenchannelInteractionEvents['on'](_0x36ed93,_0x1313a1);}}; \ No newline at end of file +var _0x6a8f=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x18f82b,_0x3ea7a0){var _0x5d8128=function(_0x16a009){while(--_0x16a009){_0x18f82b['push'](_0x18f82b['shift']());}};_0x5d8128(++_0x3ea7a0);}(_0x6a8f,0x89));var _0xf6a8=function(_0x2c00af,_0x5d5c83){_0x2c00af=_0x2c00af-0x0;var _0x592a13=_0x6a8f[_0x2c00af];return _0x592a13;};'use strict';var OpenchannelInteractionEvents=require(_0xf6a8('0x0'));var events=['save',_0xf6a8('0x1'),_0xf6a8('0x2')];function createListener(_0xa0dd01,_0x5d1a57){return function(_0x23888a){_0x5d1a57[_0xf6a8('0x3')](_0xa0dd01,_0x23888a);};}function removeListener(_0x8c3454,_0x44e560){return function(){OpenchannelInteractionEvents[_0xf6a8('0x4')](_0x8c3454,_0x44e560);};}exports[_0xf6a8('0x5')]=function(_0x4efafb){for(var _0x456782=0x0,_0x5a68f3=events[_0xf6a8('0x6')];_0x456782<_0x5a68f3;_0x456782++){var _0x36dc67=events[_0x456782];var _0x18dbd9=createListener(_0xf6a8('0x7')+_0x36dc67,_0x4efafb);OpenchannelInteractionEvents['on'](_0x36dc67,_0x18dbd9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 04ba422..2149b5c 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4e7cc3,_0x47ff4){var _0x42e46d=function(_0x43bd6e){while(--_0x43bd6e){_0x4e7cc3['push'](_0x4e7cc3['shift']());}};_0x42e46d(++_0x47ff4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xcb91[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x87c2ef,_0x4994d7){_0x87c2ef=_0x87c2ef-0x0;var _0x2081a9=_0x70e0[_0x87c2ef];return _0x2081a9;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f39805b..5678379 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 _0x3c2c=['out','DATE','sequelize','exports','TEXT','medium','ENUM'];(function(_0x40ae2a,_0x5dccac){var _0x3f7565=function(_0x2321c5){while(--_0x2321c5){_0x40ae2a['push'](_0x40ae2a['shift']());}};_0x3f7565(++_0x5dccac);}(_0x3c2c,0x160));var _0xc3c2=function(_0x2e75c4,_0x5f39c8){_0x2e75c4=_0x2e75c4-0x0;var _0xed86a7=_0x3c2c[_0x2e75c4];return _0xed86a7;};'use strict';var Sequelize=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]={'body':{'type':Sequelize[_0xc3c2('0x2')](_0xc3c2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc3c2('0x4')]('in',_0xc3c2('0x5')),'defaultValue':_0xc3c2('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc3c2('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc3c2('0x2')]}}; \ No newline at end of file +var _0x5b12=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5b12,0xa3));var _0x25b1=function(_0x3710e4,_0x16d6f5){_0x3710e4=_0x3710e4-0x0;var _0x2a7e34=_0x5b12[_0x3710e4];return _0x2a7e34;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'body':{'type':Sequelize[_0x25b1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x25b1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x25b1('0x4')]('in',_0x25b1('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x25b1('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index aab3189..1407fe5 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 _0xdedd=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize','QueryTypes','SELECT','event','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','catch','keys','includeAll','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','read','readAt','user','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xdedd,0x197));var _0xdded=function(_0x3aec4e,_0x2ac769){_0x3aec4e=_0x3aec4e-0x0;var _0x4fc328=_0xdedd[_0x3aec4e];return _0x4fc328;};'use strict';var emlformat=require(_0xdded('0x0'));var rimraf=require(_0xdded('0x1'));var zipdir=require(_0xdded('0x2'));var jsonpatch=require(_0xdded('0x3'));var rp=require(_0xdded('0x4'));var moment=require('moment');var BPromise=require(_0xdded('0x5'));var Mustache=require(_0xdded('0x6'));var util=require(_0xdded('0x7'));var path=require(_0xdded('0x8'));var sox=require(_0xdded('0x9'));var csv=require(_0xdded('0xa'));var ejs=require(_0xdded('0xb'));var fs=require('fs');var fs_extra=require(_0xdded('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdded('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdded('0xe'));var Papa=require(_0xdded('0xf'));var Redis=require(_0xdded('0x10'));var authService=require(_0xdded('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdded('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdded('0x13'))(_0xdded('0x14'));var utils=require(_0xdded('0x15'));var config=require(_0xdded('0x16'));var licenseUtil=require(_0xdded('0x17'));var db=require(_0xdded('0x18'))['db'];config[_0xdded('0x19')]=_[_0xdded('0x1a')](config[_0xdded('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdded('0x1b'))(new Redis(config[_0xdded('0x19')]));require('./openchannelMessage.socket')[_0xdded('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdded('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xdded('0x1d')][_0xdded('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x22ca73,_0x481ae4,_0x338383,_0xfb3f67){return new BPromise(function(_0x2ef523,_0x292813){var _0x1454e4=_0xfb3f67||client;return _0x1454e4[_0xdded('0x1f')](_0x22ca73,_0x338383)[_0xdded('0x20')](function(_0x436ee9){logger['info'](_0xdded('0x21'),_0x481ae4,_0xdded('0x22'));logger[_0xdded('0x23')](_0xdded('0x24'),_0x481ae4,_0xdded('0x22'),JSON[_0xdded('0x25')](_0x436ee9));if(_0x436ee9[_0xdded('0x26')]){if(_0x436ee9[_0xdded('0x26')][_0xdded('0x27')]===0x1f4){logger[_0xdded('0x26')](_0xdded('0x21'),_0x481ae4,_0x436ee9[_0xdded('0x26')][_0xdded('0x28')]);return _0x292813(_0x436ee9['error'][_0xdded('0x28')]);}logger[_0xdded('0x26')](_0xdded('0x21'),_0x481ae4,_0x436ee9[_0xdded('0x26')]['message']);return _0x2ef523(_0x436ee9[_0xdded('0x26')]['message']);}else{logger[_0xdded('0x29')](_0xdded('0x21'),_0x481ae4,_0xdded('0x22'));_0x2ef523(_0x436ee9[_0xdded('0x2a')][_0xdded('0x28')]);}})['catch'](function(_0x1c5025){logger[_0xdded('0x26')](_0xdded('0x21'),_0x481ae4,_0x1c5025);_0x292813(_0x1c5025);});});}function respondWithStatusCode(_0x14b1bd,_0x478235){_0x478235=_0x478235||0xcc;return function(_0x4bd5c9){if(_0x4bd5c9){return _0x14b1bd['sendStatus'](_0x478235);}return _0x14b1bd[_0xdded('0x2b')](_0x478235)[_0xdded('0x2c')]();};}function respondWithResult(_0xfb0379,_0x4358f6){_0x4358f6=_0x4358f6||0xc8;return function(_0xa87486){if(_0xa87486){return _0xfb0379['status'](_0x4358f6)[_0xdded('0x2d')](_0xa87486);}};}function respondWithFilteredResult(_0x10c128,_0x154a55){return function(_0x11e13a){if(_0x11e13a){var _0x560dca=typeof _0x154a55[_0xdded('0x2e')]==='undefined'&&typeof _0x154a55[_0xdded('0x2f')]===_0xdded('0x30');var _0x37f0f5=_0x11e13a[_0xdded('0x31')];var _0xf193a8=_0x560dca?0x0:_0x154a55[_0xdded('0x2e')];var _0xdf0051=_0x560dca?_0x11e13a['count']:_0x154a55[_0xdded('0x2e')]+_0x154a55[_0xdded('0x2f')];var _0x553860;if(_0xdf0051>=_0x37f0f5){_0xdf0051=_0x37f0f5;_0x553860=0xc8;}else{_0x553860=0xce;}_0x10c128[_0xdded('0x2b')](_0x553860);return _0x10c128[_0xdded('0x32')]('Content-Range',_0xf193a8+'-'+_0xdf0051+'/'+_0x37f0f5)['json'](_0x11e13a);}return null;};}function patchUpdates(_0x48ebde){return function(_0x594766){try{jsonpatch[_0xdded('0x33')](_0x594766,_0x48ebde,!![]);}catch(_0x39c41b){return BPromise[_0xdded('0x34')](_0x39c41b);}return _0x594766[_0xdded('0x35')]();};}function saveUpdates(_0x431907,_0x3e9982){return function(_0xbe653b){if(_0xbe653b){return _0xbe653b['update'](_0x431907)[_0xdded('0x20')](function(_0x166ab9){return _0x166ab9;});}return null;};}function removeEntity(_0x1f9d25,_0x161eb9){return function(_0x6f4412){if(_0x6f4412){return _0x6f4412[_0xdded('0x36')]()['then'](function(){_0x1f9d25[_0xdded('0x2b')](0xcc)[_0xdded('0x2c')]();});}};}function handleEntityNotFound(_0x32492c,_0x5847b0){return function(_0x17e026){if(!_0x17e026){_0x32492c[_0xdded('0x37')](0x194);}return _0x17e026;};}function handleError(_0x4c1842,_0x44d53c){_0x44d53c=_0x44d53c||0x1f4;return function(_0x2d9019){logger[_0xdded('0x26')](_0x2d9019[_0xdded('0x38')]);if(_0x2d9019[_0xdded('0x39')]){delete _0x2d9019[_0xdded('0x39')];}_0x4c1842[_0xdded('0x2b')](_0x44d53c)[_0xdded('0x3a')](_0x2d9019);};}exports[_0xdded('0x3b')]=function(_0x4242b5,_0x975447){var _0x1bb3a8={},_0x5111af={},_0x5afb23={'count':0x0,'rows':[]};var _0x731e22=_[_0xdded('0x3c')](db[_0xdded('0x3d')][_0xdded('0x3e')],function(_0x1e849a){return{'name':_0x1e849a[_0xdded('0x3f')],'type':_0x1e849a[_0xdded('0x40')][_0xdded('0x41')]};});_0x5111af[_0xdded('0x42')]=_[_0xdded('0x3c')](_0x731e22,_0xdded('0x39'));_0x5111af[_0xdded('0x43')]=_['keys'](_0x4242b5[_0xdded('0x43')]);_0x5111af['filters']=_[_0xdded('0x44')](_0x5111af['model'],_0x5111af[_0xdded('0x43')]);_0x1bb3a8[_0xdded('0x45')]=_['intersection'](_0x5111af[_0xdded('0x42')],qs['fields'](_0x4242b5[_0xdded('0x43')][_0xdded('0x46')]));_0x1bb3a8[_0xdded('0x45')]=_0x1bb3a8[_0xdded('0x45')][_0xdded('0x47')]?_0x1bb3a8[_0xdded('0x45')]:_0x5111af[_0xdded('0x42')];if(!_0x4242b5[_0xdded('0x43')]['hasOwnProperty'](_0xdded('0x48'))){_0x1bb3a8['limit']=qs['limit'](_0x4242b5[_0xdded('0x43')][_0xdded('0x2f')]);_0x1bb3a8['offset']=qs[_0xdded('0x2e')](_0x4242b5[_0xdded('0x43')][_0xdded('0x2e')]);}_0x1bb3a8[_0xdded('0x49')]=qs[_0xdded('0x4a')](_0x4242b5[_0xdded('0x43')][_0xdded('0x4a')]);_0x1bb3a8[_0xdded('0x4b')]=qs[_0xdded('0x4c')](_[_0xdded('0x4d')](_0x4242b5[_0xdded('0x43')],_0x5111af['filters']),_0x731e22);if(_0x4242b5[_0xdded('0x43')]['filter']){_0x1bb3a8[_0xdded('0x4b')]=_[_0xdded('0x4e')](_0x1bb3a8[_0xdded('0x4b')],{'$or':_[_0xdded('0x3c')](_0x731e22,function(_0x23d466){if(_0x23d466[_0xdded('0x40')]!==_0xdded('0x4f')){var _0x3cf0a8={};_0x3cf0a8[_0x23d466['name']]={'$like':'%'+_0x4242b5['query'][_0xdded('0x50')]+'%'};return _0x3cf0a8;}})});}_0x1bb3a8=_[_0xdded('0x4e')]({},_0x1bb3a8,_0x4242b5[_0xdded('0x51')]);var _0x788e16={'where':_0x1bb3a8['where']};return db[_0xdded('0x3d')]['count'](_0x788e16)[_0xdded('0x20')](function(_0x11d6eb){_0x5afb23[_0xdded('0x31')]=_0x11d6eb;if(_0x4242b5['query']['includeAll']){_0x1bb3a8[_0xdded('0x52')]=[{'all':!![]}];}return db[_0xdded('0x3d')][_0xdded('0x53')](_0x1bb3a8);})['then'](function(_0x409c0a){_0x5afb23['rows']=_0x409c0a;return _0x5afb23;})[_0xdded('0x20')](respondWithFilteredResult(_0x975447,_0x1bb3a8))[_0xdded('0x54')](handleError(_0x975447,null));};exports['show']=function(_0xa4aba0,_0x24af7e){var _0xa30a51={'raw':!![],'where':{'id':_0xa4aba0['params']['id']}},_0x417735={};_0x417735[_0xdded('0x42')]=_[_0xdded('0x55')](db[_0xdded('0x3d')][_0xdded('0x3e')]);_0x417735[_0xdded('0x43')]=_[_0xdded('0x55')](_0xa4aba0['query']);_0x417735[_0xdded('0x4c')]=_['intersection'](_0x417735[_0xdded('0x42')],_0x417735['query']);_0xa30a51[_0xdded('0x45')]=_[_0xdded('0x44')](_0x417735[_0xdded('0x42')],qs['fields'](_0xa4aba0[_0xdded('0x43')]['fields']));_0xa30a51[_0xdded('0x45')]=_0xa30a51[_0xdded('0x45')][_0xdded('0x47')]?_0xa30a51['attributes']:_0x417735['model'];if(_0xa4aba0[_0xdded('0x43')][_0xdded('0x56')]){_0xa30a51['include']=[{'all':!![]}];}_0xa30a51=_['merge']({},_0xa30a51,_0xa4aba0[_0xdded('0x51')]);return db[_0xdded('0x3d')][_0xdded('0x57')](_0xa30a51)[_0xdded('0x20')](handleEntityNotFound(_0x24af7e,null))[_0xdded('0x20')](respondWithResult(_0x24af7e,null))[_0xdded('0x54')](handleError(_0x24af7e,null));};exports[_0xdded('0x58')]=function(_0x41e285,_0x53fc40){return db[_0xdded('0x3d')][_0xdded('0x58')](_0x41e285[_0xdded('0x59')],{})[_0xdded('0x20')](respondWithResult(_0x53fc40,0xc9))[_0xdded('0x54')](handleError(_0x53fc40,null));};exports[_0xdded('0x5a')]=function(_0x62a824,_0x1ba388){if(_0x62a824[_0xdded('0x59')]['id']){delete _0x62a824['body']['id'];}return db[_0xdded('0x3d')][_0xdded('0x57')]({'where':{'id':_0x62a824[_0xdded('0x5b')]['id']}})[_0xdded('0x20')](handleEntityNotFound(_0x1ba388,null))[_0xdded('0x20')](saveUpdates(_0x62a824[_0xdded('0x59')],null))['then'](respondWithResult(_0x1ba388,null))[_0xdded('0x54')](handleError(_0x1ba388,null));};exports[_0xdded('0x36')]=function(_0x50240f,_0x4c5ebf){return db[_0xdded('0x3d')][_0xdded('0x57')]({'where':{'id':_0x50240f[_0xdded('0x5b')]['id']}})[_0xdded('0x20')](handleEntityNotFound(_0x4c5ebf,null))[_0xdded('0x20')](removeEntity(_0x4c5ebf,null))[_0xdded('0x54')](handleError(_0x4c5ebf,null));};exports[_0xdded('0x5c')]=function(_0x556bd0,_0x4c44c9){return db[_0xdded('0x3d')][_0xdded('0x5c')]()[_0xdded('0x20')](respondWithResult(_0x4c44c9,null))[_0xdded('0x54')](handleError(_0x4c44c9,null));};var interaction_log=require(_0xdded('0x13'))(_0xdded('0x5d'));exports[_0xdded('0x5e')]=function(_0x13d671,_0x24147b,_0x5336e6){var _0x423160={'agent':{},'channel':_0xdded('0x5f')};if(_0x13d671[_0xdded('0x59')]['id']){delete _0x13d671['body']['id'];}_0x13d671[_0xdded('0x59')][_0xdded('0x60')]=!![];_0x13d671[_0xdded('0x59')][_0xdded('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x13d671['body']['UserId']=_0x13d671[_0xdded('0x59')]['UserId']||_0x13d671[_0xdded('0x62')]['id'];_0x423160[_0xdded('0x63')]['id']=_0x13d671[_0xdded('0x59')][_0xdded('0x64')];return db[_0xdded('0x3d')][_0xdded('0x57')]({'where':{'id':_0x13d671[_0xdded('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24147b,null))[_0xdded('0x20')](saveUpdates(_0x13d671[_0xdded('0x59')],null))[_0xdded('0x20')](function(_0x2fb766){if(_0x2fb766){_0x423160[_0xdded('0x28')]=_0x2fb766[_0xdded('0x65')]({'plain':!![]});return db[_0xdded('0x66')][_0xdded('0x57')]({'where':{'id':_0x2fb766[_0xdded('0x67')]}});}return null;})[_0xdded('0x20')](handleEntityNotFound(_0x24147b,null))['then'](function(_0x14a0bd){if(_0x14a0bd){return _0x14a0bd['update']({'UserId':_0x13d671[_0xdded('0x59')][_0xdded('0x64')],'read1stAt':_['isNil'](_0x14a0bd['read1stAt'])?moment()['format'](_0xdded('0x68')):undefined});}return null;})[_0xdded('0x20')](function(_0x431f95){if(_0x431f95){_0x423160['interaction']=_0x431f95[_0xdded('0x65')]({'plain':!![]});interaction_log[_0xdded('0x29')](_0xdded('0x69'),_0x13d671[_0xdded('0x62')]['id'],_0x13d671[_0xdded('0x62')][_0xdded('0x39')],_0x13d671[_0xdded('0x62')][_0xdded('0x6a')],_0x423160[_0xdded('0x6b')]['id'],_0x13d671['body']?JSON[_0xdded('0x25')](_0x13d671[_0xdded('0x59')]):_0xdded('0x6c'));return respondWithRpcPromise(_0xdded('0x6d'),'acceptMessage',_0x423160);}return null;})[_0xdded('0x20')](function(_0x5296c7){var _0x27e537=_0xdded('0x6e')+_0x5296c7[_0xdded('0x28')]['ContactId'];return db['sequelize']['query'](_0x27e537,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xdded('0x20')](function(_0x170ef3){return _0x170ef3;});})[_0xdded('0x20')](function(_0x1a0603){if(_0x1a0603){_0x423160[_0xdded('0x28')][_0xdded('0x6f')]=_0x1a0603[0x0];if(!_0x13d671['body']['UserId'])return;return db[_0xdded('0x70')][_0xdded('0x57')]({'where':{'id':_0x13d671[_0xdded('0x59')][_0xdded('0x64')],'role':_0xdded('0x63')},'attributes':['id',_0xdded('0x39'),_0xdded('0x71'),_0xdded('0x72'),'internal'],'raw':!![]});}return null;})[_0xdded('0x20')](function(_0x58b181){if(!_0x58b181)return null;_0x423160['message'][_0xdded('0x63')]=_0x58b181;return _0x423160;})[_0xdded('0x20')](function(_0x5d3a60){if(_0x5d3a60){if(_0x13d671[_0xdded('0x59')]['manual']){_0x423160[_0xdded('0x28')][_0xdded('0x73')]=util[_0xdded('0x74')](_0xdded('0x75'),_0x13d671[_0xdded('0x62')][_0xdded('0x39')]);_0x423160[_0xdded('0x28')][_0xdded('0x76')]=_0x423160[_0xdded('0x76')];_0x423160[_0xdded('0x28')][_0xdded('0x77')]=_0x423160[_0xdded('0x76')];_0x423160['message']['event']=_0xdded('0x5e');return respondWithRpcPromise('EventManager',_0xdded('0x78'),{'event':_0xdded('0x79'),'message':_0x423160[_0xdded('0x28')]},client9002)[_0xdded('0x20')](function(){return _0x423160;});}return _0x423160;}return null;})['then'](respondWithResult(_0x24147b,null))[_0xdded('0x54')](handleError(_0x24147b,null));};var interaction_log=require(_0xdded('0x13'))(_0xdded('0x5d'));exports[_0xdded('0x34')]=function(_0x1fc775,_0x3a7189,_0x8744ca){var _0x58a868={'agent':{},'channel':'openchannel'};if(_0x1fc775[_0xdded('0x59')]['id']){delete _0x1fc775[_0xdded('0x59')]['id'];}_0x1fc775[_0xdded('0x59')][_0xdded('0x64')]=_0x1fc775[_0xdded('0x59')][_0xdded('0x64')]||_0x1fc775[_0xdded('0x62')]['id'];_0x58a868[_0xdded('0x63')]['id']=_0x1fc775[_0xdded('0x59')][_0xdded('0x64')];return db[_0xdded('0x3d')][_0xdded('0x57')]({'where':{'id':_0x1fc775[_0xdded('0x5b')]['id'],'UserId':null}})[_0xdded('0x20')](handleEntityNotFound(_0x3a7189,null))[_0xdded('0x20')](function(_0x2c1c69){if(_0x2c1c69){_0x58a868[_0xdded('0x28')]=_0x2c1c69[_0xdded('0x65')]({'plain':!![]});return db[_0xdded('0x66')][_0xdded('0x57')]({'where':{'id':_0x2c1c69[_0xdded('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3a7189,null))[_0xdded('0x20')](function(_0x211b42){if(_0x211b42){_0x58a868['interaction']=_0x211b42[_0xdded('0x65')]({'plain':!![]});interaction_log[_0xdded('0x29')](_0xdded('0x7a'),_0x1fc775[_0xdded('0x62')]['id'],_0x1fc775[_0xdded('0x62')][_0xdded('0x39')],_0x1fc775[_0xdded('0x62')][_0xdded('0x6a')],_0x58a868[_0xdded('0x6b')]['id'],_0x1fc775[_0xdded('0x59')]?JSON[_0xdded('0x25')](_0x1fc775[_0xdded('0x59')]):_0xdded('0x6c'));return respondWithRpcPromise(_0xdded('0x7b'),'rejectMessage',_0x58a868);}return null;})[_0xdded('0x20')](function(_0x45d43e){var _0x2f1dfa=_0xdded('0x6e')+_0x45d43e[_0xdded('0x28')]['ContactId'];return db[_0xdded('0x7c')][_0xdded('0x43')](_0x2f1dfa,{'type':db[_0xdded('0x7d')][_0xdded('0x7e')][_0xdded('0x7f')],'raw':!![]})['then'](function(_0x2c7c51){return _0x2c7c51;});})[_0xdded('0x20')](function(_0x271b4e){if(_0x271b4e){_0x58a868[_0xdded('0x28')][_0xdded('0x6f')]=_0x271b4e[0x0];if(!_0x1fc775[_0xdded('0x59')][_0xdded('0x64')])return;return db[_0xdded('0x70')]['find']({'where':{'id':_0x1fc775[_0xdded('0x59')][_0xdded('0x64')],'role':_0xdded('0x63')},'attributes':['id',_0xdded('0x39'),'fullname',_0xdded('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x49ffc7){if(!_0x49ffc7)return null;_0x58a868['message'][_0xdded('0x63')]=_0x49ffc7;return _0x58a868;})[_0xdded('0x20')](function(_0x541fee){if(_0x541fee){_0x541fee[_0xdded('0x28')]['interface']=util['format'](_0xdded('0x75'),_0x1fc775[_0xdded('0x62')]['name']);_0x541fee[_0xdded('0x28')][_0xdded('0x76')]=_0x58a868['channel'];_0x541fee[_0xdded('0x28')]['motionChannel']=_0x58a868[_0xdded('0x76')];_0x541fee[_0xdded('0x28')][_0xdded('0x80')]=_0xdded('0x34');respondWithRpcPromise(_0xdded('0x78'),_0xdded('0x78'),{'event':'rejectmessage','message':_0x541fee[_0xdded('0x28')]},client9002);return _0x58a868;}return null;})[_0xdded('0x20')](respondWithResult(_0x3a7189,null))['catch'](handleError(_0x3a7189,null));}; \ No newline at end of file +var _0xc977=['format','user','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','User','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','index','map','OpenchannelMessage','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','pick','filters','filter','where','merge','type','VIRTUAL','name','includeAll','include','rows','show','params','fields','options','body','destroy','find','describe','openchannel-interactions','openchannel','readAt'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc977,0x126));var _0x7c97=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xc977[_0x1f239e];return _0x826971;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c97('0x0'));var zipdir=require(_0x7c97('0x1'));var jsonpatch=require(_0x7c97('0x2'));var rp=require(_0x7c97('0x3'));var moment=require('moment');var BPromise=require(_0x7c97('0x4'));var Mustache=require(_0x7c97('0x5'));var util=require(_0x7c97('0x6'));var path=require(_0x7c97('0x7'));var sox=require(_0x7c97('0x8'));var csv=require(_0x7c97('0x9'));var ejs=require(_0x7c97('0xa'));var fs=require('fs');var fs_extra=require(_0x7c97('0xb'));var _=require(_0x7c97('0xc'));var squel=require(_0x7c97('0xd'));var crypto=require('crypto');var jsforce=require(_0x7c97('0xe'));var deskjs=require(_0x7c97('0xf'));var toCsv=require(_0x7c97('0x9'));var querystring=require(_0x7c97('0x10'));var Papa=require(_0x7c97('0x11'));var Redis=require('ioredis');var authService=require(_0x7c97('0x12'));var qs=require(_0x7c97('0x13'));var as=require(_0x7c97('0x14'));var hardwareService=require(_0x7c97('0x15'));var logger=require(_0x7c97('0x16'))('api');var utils=require(_0x7c97('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7c97('0x18')]=_[_0x7c97('0x19')](config[_0x7c97('0x18')],{'host':_0x7c97('0x1a'),'port':0x18eb});var socket=require(_0x7c97('0x1b'))(new Redis(config[_0x7c97('0x18')]));require(_0x7c97('0x1c'))[_0x7c97('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7c97('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x7c97('0x1e')][_0x7c97('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x39a89b,_0x44166b,_0x1f6e35,_0x8275d6){return new BPromise(function(_0x4b4539,_0x5bf55f){var _0x289812=_0x8275d6||client;return _0x289812[_0x7c97('0x20')](_0x39a89b,_0x1f6e35)['then'](function(_0x21cdae){logger[_0x7c97('0x21')](_0x7c97('0x22'),_0x44166b,_0x7c97('0x23'));logger['debug'](_0x7c97('0x24'),_0x44166b,'request\x20sent',JSON['stringify'](_0x21cdae));if(_0x21cdae[_0x7c97('0x25')]){if(_0x21cdae[_0x7c97('0x25')]['code']===0x1f4){logger[_0x7c97('0x25')](_0x7c97('0x22'),_0x44166b,_0x21cdae[_0x7c97('0x25')][_0x7c97('0x26')]);return _0x5bf55f(_0x21cdae[_0x7c97('0x25')][_0x7c97('0x26')]);}logger[_0x7c97('0x25')](_0x7c97('0x22'),_0x44166b,_0x21cdae[_0x7c97('0x25')][_0x7c97('0x26')]);return _0x4b4539(_0x21cdae[_0x7c97('0x25')][_0x7c97('0x26')]);}else{logger[_0x7c97('0x21')](_0x7c97('0x22'),_0x44166b,_0x7c97('0x23'));_0x4b4539(_0x21cdae[_0x7c97('0x27')][_0x7c97('0x26')]);}})[_0x7c97('0x28')](function(_0x30b071){logger[_0x7c97('0x25')](_0x7c97('0x22'),_0x44166b,_0x30b071);_0x5bf55f(_0x30b071);});});}function respondWithStatusCode(_0x1af40c,_0x370d3c){_0x370d3c=_0x370d3c||0xcc;return function(_0x3f643a){if(_0x3f643a){return _0x1af40c['sendStatus'](_0x370d3c);}return _0x1af40c[_0x7c97('0x29')](_0x370d3c)[_0x7c97('0x2a')]();};}function respondWithResult(_0x4f16de,_0x332d22){_0x332d22=_0x332d22||0xc8;return function(_0xd4f515){if(_0xd4f515){return _0x4f16de[_0x7c97('0x29')](_0x332d22)[_0x7c97('0x2b')](_0xd4f515);}};}function respondWithFilteredResult(_0x385a74,_0x672f38){return function(_0x3af6b5){if(_0x3af6b5){var _0xa58526=typeof _0x672f38[_0x7c97('0x2c')]===_0x7c97('0x2d')&&typeof _0x672f38[_0x7c97('0x2e')]===_0x7c97('0x2d');var _0x3a9c51=_0x3af6b5[_0x7c97('0x2f')];var _0x2e1c98=_0xa58526?0x0:_0x672f38[_0x7c97('0x2c')];var _0x592868=_0xa58526?_0x3af6b5[_0x7c97('0x2f')]:_0x672f38['offset']+_0x672f38[_0x7c97('0x2e')];var _0x500f46;if(_0x592868>=_0x3a9c51){_0x592868=_0x3a9c51;_0x500f46=0xc8;}else{_0x500f46=0xce;}_0x385a74[_0x7c97('0x29')](_0x500f46);return _0x385a74[_0x7c97('0x30')](_0x7c97('0x31'),_0x2e1c98+'-'+_0x592868+'/'+_0x3a9c51)[_0x7c97('0x2b')](_0x3af6b5);}return null;};}function patchUpdates(_0x1b6560){return function(_0x3d7bb4){try{jsonpatch[_0x7c97('0x32')](_0x3d7bb4,_0x1b6560,!![]);}catch(_0x1936a4){return BPromise[_0x7c97('0x33')](_0x1936a4);}return _0x3d7bb4[_0x7c97('0x34')]();};}function saveUpdates(_0x56b553,_0x54f00e){return function(_0x516cc2){if(_0x516cc2){return _0x516cc2[_0x7c97('0x35')](_0x56b553)[_0x7c97('0x36')](function(_0x71e6d8){return _0x71e6d8;});}return null;};}function removeEntity(_0x432ab2,_0xcb645e){return function(_0x3e7a26){if(_0x3e7a26){return _0x3e7a26['destroy']()[_0x7c97('0x36')](function(){_0x432ab2[_0x7c97('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56eed0,_0x34e387){return function(_0x56c5cf){if(!_0x56c5cf){_0x56eed0[_0x7c97('0x37')](0x194);}return _0x56c5cf;};}function handleError(_0x486384,_0x29b7d8){_0x29b7d8=_0x29b7d8||0x1f4;return function(_0x72b5cf){logger[_0x7c97('0x25')](_0x72b5cf[_0x7c97('0x38')]);if(_0x72b5cf['name']){delete _0x72b5cf['name'];}_0x486384[_0x7c97('0x29')](_0x29b7d8)[_0x7c97('0x39')](_0x72b5cf);};}exports[_0x7c97('0x3a')]=function(_0x5da85c,_0x20d4c4){var _0x28a667={},_0x342f5c={},_0x3203e7={'count':0x0,'rows':[]};var _0x155ef9=_[_0x7c97('0x3b')](db[_0x7c97('0x3c')][_0x7c97('0x3d')],function(_0x5e8820){return{'name':_0x5e8820['fieldName'],'type':_0x5e8820['type'][_0x7c97('0x3e')]};});_0x342f5c[_0x7c97('0x3f')]=_[_0x7c97('0x3b')](_0x155ef9,'name');_0x342f5c[_0x7c97('0x40')]=_[_0x7c97('0x41')](_0x5da85c[_0x7c97('0x40')]);_0x342f5c['filters']=_[_0x7c97('0x42')](_0x342f5c[_0x7c97('0x3f')],_0x342f5c[_0x7c97('0x40')]);_0x28a667[_0x7c97('0x43')]=_[_0x7c97('0x42')](_0x342f5c[_0x7c97('0x3f')],qs['fields'](_0x5da85c['query']['fields']));_0x28a667[_0x7c97('0x43')]=_0x28a667[_0x7c97('0x43')][_0x7c97('0x44')]?_0x28a667[_0x7c97('0x43')]:_0x342f5c[_0x7c97('0x3f')];if(!_0x5da85c[_0x7c97('0x40')][_0x7c97('0x45')]('nolimit')){_0x28a667[_0x7c97('0x2e')]=qs[_0x7c97('0x2e')](_0x5da85c[_0x7c97('0x40')][_0x7c97('0x2e')]);_0x28a667[_0x7c97('0x2c')]=qs[_0x7c97('0x2c')](_0x5da85c[_0x7c97('0x40')][_0x7c97('0x2c')]);}_0x28a667['order']=qs[_0x7c97('0x46')](_0x5da85c['query']['sort']);_0x28a667['where']=qs['filters'](_[_0x7c97('0x47')](_0x5da85c[_0x7c97('0x40')],_0x342f5c[_0x7c97('0x48')]),_0x155ef9);if(_0x5da85c[_0x7c97('0x40')][_0x7c97('0x49')]){_0x28a667[_0x7c97('0x4a')]=_[_0x7c97('0x4b')](_0x28a667['where'],{'$or':_[_0x7c97('0x3b')](_0x155ef9,function(_0x40858d){if(_0x40858d[_0x7c97('0x4c')]!==_0x7c97('0x4d')){var _0x1add9b={};_0x1add9b[_0x40858d[_0x7c97('0x4e')]]={'$like':'%'+_0x5da85c[_0x7c97('0x40')][_0x7c97('0x49')]+'%'};return _0x1add9b;}})});}_0x28a667=_[_0x7c97('0x4b')]({},_0x28a667,_0x5da85c['options']);var _0x200f1b={'where':_0x28a667[_0x7c97('0x4a')]};return db[_0x7c97('0x3c')][_0x7c97('0x2f')](_0x200f1b)['then'](function(_0x14a5d0){_0x3203e7[_0x7c97('0x2f')]=_0x14a5d0;if(_0x5da85c[_0x7c97('0x40')][_0x7c97('0x4f')]){_0x28a667[_0x7c97('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x28a667);})[_0x7c97('0x36')](function(_0x129899){_0x3203e7[_0x7c97('0x51')]=_0x129899;return _0x3203e7;})[_0x7c97('0x36')](respondWithFilteredResult(_0x20d4c4,_0x28a667))[_0x7c97('0x28')](handleError(_0x20d4c4,null));};exports[_0x7c97('0x52')]=function(_0x18d0c8,_0x20e648){var _0x51367a={'raw':!![],'where':{'id':_0x18d0c8[_0x7c97('0x53')]['id']}},_0x548ea0={};_0x548ea0[_0x7c97('0x3f')]=_['keys'](db['OpenchannelMessage'][_0x7c97('0x3d')]);_0x548ea0[_0x7c97('0x40')]=_[_0x7c97('0x41')](_0x18d0c8['query']);_0x548ea0[_0x7c97('0x48')]=_[_0x7c97('0x42')](_0x548ea0[_0x7c97('0x3f')],_0x548ea0['query']);_0x51367a[_0x7c97('0x43')]=_['intersection'](_0x548ea0['model'],qs[_0x7c97('0x54')](_0x18d0c8[_0x7c97('0x40')]['fields']));_0x51367a[_0x7c97('0x43')]=_0x51367a[_0x7c97('0x43')]['length']?_0x51367a['attributes']:_0x548ea0['model'];if(_0x18d0c8[_0x7c97('0x40')][_0x7c97('0x4f')]){_0x51367a[_0x7c97('0x50')]=[{'all':!![]}];}_0x51367a=_[_0x7c97('0x4b')]({},_0x51367a,_0x18d0c8[_0x7c97('0x55')]);return db[_0x7c97('0x3c')]['find'](_0x51367a)['then'](handleEntityNotFound(_0x20e648,null))[_0x7c97('0x36')](respondWithResult(_0x20e648,null))[_0x7c97('0x28')](handleError(_0x20e648,null));};exports['create']=function(_0xe5aa3b,_0x5ea7ae){return db[_0x7c97('0x3c')]['create'](_0xe5aa3b[_0x7c97('0x56')],{})[_0x7c97('0x36')](respondWithResult(_0x5ea7ae,0xc9))[_0x7c97('0x28')](handleError(_0x5ea7ae,null));};exports[_0x7c97('0x35')]=function(_0x2c6042,_0x14b38d){if(_0x2c6042[_0x7c97('0x56')]['id']){delete _0x2c6042[_0x7c97('0x56')]['id'];}return db[_0x7c97('0x3c')]['find']({'where':{'id':_0x2c6042[_0x7c97('0x53')]['id']}})[_0x7c97('0x36')](handleEntityNotFound(_0x14b38d,null))[_0x7c97('0x36')](saveUpdates(_0x2c6042[_0x7c97('0x56')],null))[_0x7c97('0x36')](respondWithResult(_0x14b38d,null))['catch'](handleError(_0x14b38d,null));};exports[_0x7c97('0x57')]=function(_0xcfed8c,_0x2e1278){return db[_0x7c97('0x3c')][_0x7c97('0x58')]({'where':{'id':_0xcfed8c[_0x7c97('0x53')]['id']}})[_0x7c97('0x36')](handleEntityNotFound(_0x2e1278,null))[_0x7c97('0x36')](removeEntity(_0x2e1278,null))[_0x7c97('0x28')](handleError(_0x2e1278,null));};exports[_0x7c97('0x59')]=function(_0x3f0167,_0x35e3c4){return db[_0x7c97('0x3c')][_0x7c97('0x59')]()['then'](respondWithResult(_0x35e3c4,null))[_0x7c97('0x28')](handleError(_0x35e3c4,null));};var interaction_log=require(_0x7c97('0x16'))(_0x7c97('0x5a'));exports['accept']=function(_0x799993,_0x5b8d4c,_0x482803){var _0x3ee703={'agent':{},'channel':_0x7c97('0x5b')};if(_0x799993[_0x7c97('0x56')]['id']){delete _0x799993[_0x7c97('0x56')]['id'];}_0x799993[_0x7c97('0x56')]['read']=!![];_0x799993[_0x7c97('0x56')][_0x7c97('0x5c')]=moment()[_0x7c97('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x799993['body']['UserId']=_0x799993[_0x7c97('0x56')]['UserId']||_0x799993[_0x7c97('0x5e')]['id'];_0x3ee703[_0x7c97('0x5f')]['id']=_0x799993['body'][_0x7c97('0x60')];return db['OpenchannelMessage'][_0x7c97('0x58')]({'where':{'id':_0x799993['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b8d4c,null))[_0x7c97('0x36')](saveUpdates(_0x799993[_0x7c97('0x56')],null))[_0x7c97('0x36')](function(_0x5ad0ba){if(_0x5ad0ba){_0x3ee703[_0x7c97('0x26')]=_0x5ad0ba[_0x7c97('0x61')]({'plain':!![]});return db[_0x7c97('0x62')]['find']({'where':{'id':_0x5ad0ba[_0x7c97('0x63')]}});}return null;})[_0x7c97('0x36')](handleEntityNotFound(_0x5b8d4c,null))[_0x7c97('0x36')](function(_0x3a73b){if(_0x3a73b){return _0x3a73b[_0x7c97('0x35')]({'UserId':_0x799993[_0x7c97('0x56')][_0x7c97('0x60')],'read1stAt':_['isNil'](_0x3a73b[_0x7c97('0x64')])?moment()[_0x7c97('0x5d')](_0x7c97('0x65')):undefined});}return null;})[_0x7c97('0x36')](function(_0x4c2b7c){if(_0x4c2b7c){_0x3ee703[_0x7c97('0x66')]=_0x4c2b7c[_0x7c97('0x61')]({'plain':!![]});interaction_log[_0x7c97('0x21')](_0x7c97('0x67'),_0x799993[_0x7c97('0x5e')]['id'],_0x799993[_0x7c97('0x5e')]['name'],_0x799993['user']['role'],_0x3ee703[_0x7c97('0x66')]['id'],_0x799993[_0x7c97('0x56')]?JSON[_0x7c97('0x68')](_0x799993[_0x7c97('0x56')]):_0x7c97('0x69'));return respondWithRpcPromise(_0x7c97('0x6a'),_0x7c97('0x6b'),_0x3ee703);}return null;})[_0x7c97('0x36')](function(_0x4222a9){var _0x56609d=_0x7c97('0x6c')+_0x4222a9['message'][_0x7c97('0x6d')];return db['sequelize'][_0x7c97('0x40')](_0x56609d,{'type':db[_0x7c97('0x6e')]['QueryTypes'][_0x7c97('0x6f')],'raw':!![]})['then'](function(_0x19695d){return _0x19695d;});})[_0x7c97('0x36')](function(_0x3096bd){if(_0x3096bd){_0x3ee703[_0x7c97('0x26')][_0x7c97('0x70')]=_0x3096bd[0x0];if(!_0x799993[_0x7c97('0x56')]['UserId'])return;return db['User'][_0x7c97('0x58')]({'where':{'id':_0x799993[_0x7c97('0x56')]['UserId'],'role':_0x7c97('0x5f')},'attributes':['id','name',_0x7c97('0x71'),_0x7c97('0x72'),_0x7c97('0x73')],'raw':!![]});}return null;})[_0x7c97('0x36')](function(_0x1cdbf5){if(!_0x1cdbf5)return null;_0x3ee703[_0x7c97('0x26')]['agent']=_0x1cdbf5;return _0x3ee703;})[_0x7c97('0x36')](function(_0x1c178a){if(_0x1c178a){if(_0x799993['body'][_0x7c97('0x74')]){_0x3ee703[_0x7c97('0x26')][_0x7c97('0x75')]=util['format'](_0x7c97('0x76'),_0x799993[_0x7c97('0x5e')]['name']);_0x3ee703[_0x7c97('0x26')][_0x7c97('0x77')]=_0x3ee703['channel'];_0x3ee703['message'][_0x7c97('0x78')]=_0x3ee703[_0x7c97('0x77')];_0x3ee703['message'][_0x7c97('0x79')]=_0x7c97('0x7a');return respondWithRpcPromise('EventManager',_0x7c97('0x7b'),{'event':'acceptmessage','message':_0x3ee703[_0x7c97('0x26')]},client9002)[_0x7c97('0x36')](function(){return _0x3ee703;});}return _0x3ee703;}return null;})['then'](respondWithResult(_0x5b8d4c,null))['catch'](handleError(_0x5b8d4c,null));};var interaction_log=require(_0x7c97('0x16'))(_0x7c97('0x5a'));exports[_0x7c97('0x33')]=function(_0x5851f4,_0x2bcd48,_0x3ff306){var _0x3d6316={'agent':{},'channel':_0x7c97('0x5b')};if(_0x5851f4[_0x7c97('0x56')]['id']){delete _0x5851f4[_0x7c97('0x56')]['id'];}_0x5851f4['body'][_0x7c97('0x60')]=_0x5851f4[_0x7c97('0x56')][_0x7c97('0x60')]||_0x5851f4[_0x7c97('0x5e')]['id'];_0x3d6316[_0x7c97('0x5f')]['id']=_0x5851f4[_0x7c97('0x56')][_0x7c97('0x60')];return db[_0x7c97('0x3c')][_0x7c97('0x58')]({'where':{'id':_0x5851f4[_0x7c97('0x53')]['id'],'UserId':null}})[_0x7c97('0x36')](handleEntityNotFound(_0x2bcd48,null))['then'](function(_0x21f86a){if(_0x21f86a){_0x3d6316[_0x7c97('0x26')]=_0x21f86a['get']({'plain':!![]});return db[_0x7c97('0x62')]['find']({'where':{'id':_0x21f86a[_0x7c97('0x63')]}});}return null;})[_0x7c97('0x36')](handleEntityNotFound(_0x2bcd48,null))[_0x7c97('0x36')](function(_0x35ebbd){if(_0x35ebbd){_0x3d6316[_0x7c97('0x66')]=_0x35ebbd['get']({'plain':!![]});interaction_log[_0x7c97('0x21')](_0x7c97('0x7c'),_0x5851f4[_0x7c97('0x5e')]['id'],_0x5851f4[_0x7c97('0x5e')][_0x7c97('0x4e')],_0x5851f4[_0x7c97('0x5e')]['role'],_0x3d6316[_0x7c97('0x66')]['id'],_0x5851f4[_0x7c97('0x56')]?JSON[_0x7c97('0x68')](_0x5851f4[_0x7c97('0x56')]):_0x7c97('0x69'));return respondWithRpcPromise(_0x7c97('0x7d'),'rejectMessage',_0x3d6316);}return null;})[_0x7c97('0x36')](function(_0x40364f){var _0x29c7f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40364f[_0x7c97('0x26')][_0x7c97('0x6d')];return db[_0x7c97('0x7e')]['query'](_0x29c7f2,{'type':db[_0x7c97('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x7c97('0x36')](function(_0x38e565){return _0x38e565;});})[_0x7c97('0x36')](function(_0x22e9e4){if(_0x22e9e4){_0x3d6316[_0x7c97('0x26')][_0x7c97('0x70')]=_0x22e9e4[0x0];if(!_0x5851f4['body'][_0x7c97('0x60')])return;return db[_0x7c97('0x7f')]['find']({'where':{'id':_0x5851f4[_0x7c97('0x56')][_0x7c97('0x60')],'role':_0x7c97('0x5f')},'attributes':['id','name',_0x7c97('0x71'),_0x7c97('0x72'),_0x7c97('0x73')],'raw':!![]});}return null;})[_0x7c97('0x36')](function(_0x510273){if(!_0x510273)return null;_0x3d6316[_0x7c97('0x26')][_0x7c97('0x5f')]=_0x510273;return _0x3d6316;})[_0x7c97('0x36')](function(_0x5cb417){if(_0x5cb417){_0x5cb417[_0x7c97('0x26')]['interface']=util[_0x7c97('0x5d')](_0x7c97('0x76'),_0x5851f4[_0x7c97('0x5e')]['name']);_0x5cb417[_0x7c97('0x26')][_0x7c97('0x77')]=_0x3d6316[_0x7c97('0x77')];_0x5cb417[_0x7c97('0x26')][_0x7c97('0x78')]=_0x3d6316[_0x7c97('0x77')];_0x5cb417[_0x7c97('0x26')][_0x7c97('0x79')]=_0x7c97('0x33');respondWithRpcPromise(_0x7c97('0x7b'),_0x7c97('0x7b'),{'event':_0x7c97('0x80'),'message':_0x5cb417[_0x7c97('0x26')]},client9002);return _0x3d6316;}return null;})['then'](respondWithResult(_0x2bcd48,null))[_0x7c97('0x28')](handleError(_0x2bcd48,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5248bcc..753bb09 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 _0x66cc=['save','emit','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3ea086,_0xb3893e){var _0x4976ae=function(_0x233ebd){while(--_0x233ebd){_0x3ea086['push'](_0x3ea086['shift']());}};_0x4976ae(++_0xb3893e);}(_0x66cc,0x117));var _0xc66c=function(_0x102d98,_0xeb450d){_0x102d98=_0x102d98-0x0;var _0x2749d8=_0x66cc[_0x102d98];return _0x2749d8;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc66c('0x0'))['db'][_0xc66c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc66c('0x2')](0x0);var events={'afterCreate':_0xc66c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb972e1){return function(_0x291a16,_0x30a7cc,_0x5e1c77){OpenchannelMessageEvents[_0xc66c('0x4')](_0xb972e1+':'+_0x291a16['id'],_0x291a16);OpenchannelMessageEvents[_0xc66c('0x4')](_0xb972e1,_0x291a16);_0x5e1c77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc66c('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8b93=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x563188,_0x157c4d){var _0x211dde=function(_0x175b4b){while(--_0x175b4b){_0x563188['push'](_0x563188['shift']());}};_0x211dde(++_0x157c4d);}(_0x8b93,0x151));var _0x38b9=function(_0x3af9a6,_0x31ce9d){_0x3af9a6=_0x3af9a6-0x0;var _0x47753b=_0x8b93[_0x3af9a6];return _0x47753b;};'use strict';var EventEmitter=require(_0x38b9('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x38b9('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x38b9('0x2')](0x0);var events={'afterCreate':_0x38b9('0x3'),'afterUpdate':_0x38b9('0x4'),'afterDestroy':_0x38b9('0x5')};function emitEvent(_0x8d2e41){return function(_0x3d07f4,_0x55930c,_0x471ae2){OpenchannelMessageEvents['emit'](_0x8d2e41+':'+_0x3d07f4['id'],_0x3d07f4);OpenchannelMessageEvents['emit'](_0x8d2e41,_0x3d07f4);_0x471ae2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x38b9('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 1fec369..d0d51a0 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 _0x040a=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','then','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x129839,_0x12aedb){var _0x36634f=function(_0x36f495){while(--_0x36f495){_0x129839['push'](_0x129839['shift']());}};_0x36634f(++_0x12aedb);}(_0x040a,0x13f));var _0xa040=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x040a[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0xa040('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa040('0x1'));var moment=require(_0xa040('0x2'));var BPromise=require('bluebird');var rp=require(_0xa040('0x3'));var fs=require('fs');var path=require(_0xa040('0x4'));var rimraf=require('rimraf');var config=require(_0xa040('0x5'));var attributes=require(_0xa040('0x6'));module[_0xa040('0x7')]=function(_0x58ac97,_0xdd23f5){return _0x58ac97[_0xa040('0x8')](_0xa040('0x9'),attributes,{'tableName':_0xa040('0xa'),'paranoid':![],'indexes':[{'name':_0xa040('0xb'),'fields':[_0xa040('0xc')],'type':_0xa040('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a9eab,_0xa07e9f,_0x238276){var _0x4b2f1d=_0x58ac97['models'];var _0x48a1da=_0x2a9eab[_0xa040('0xe')]({'plain':!![]});if(_0x48a1da[_0xa040('0xf')][_0xa040('0x10')]()==='in'||_0x48a1da[_0xa040('0xf')][_0xa040('0x10')]()===_0xa040('0x11')&&!_0x48a1da[_0xa040('0x12')]&&!_[_0xa040('0x13')](_0x48a1da[_0xa040('0x14')])){_0x4b2f1d['OpenchannelInteraction']['findOne']({'where':{'id':_0x48a1da[_0xa040('0x15')]}})['then'](function(_0x39a691){if(_0x39a691){_0x39a691[_0xa040('0x16')]({'lastMsgAt':_0x48a1da[_0xa040('0x17')],'lastMsgDirection':_0x48a1da[_0xa040('0xf')][_0xa040('0x10')]()});}})[_0xa040('0x18')](function(_0x31e0a1){console[_0xa040('0x19')](_0x31e0a1);});}if(_0x48a1da[_0xa040('0xf')]==='out'&&!_0x48a1da[_0xa040('0x12')]){var _0x4f2e42;_0x4b2f1d[_0xa040('0x1a')]['describe']()['then'](function(_0x2cbeae){return _0x4b2f1d['OpenchannelAccount'][_0xa040('0x1b')]({'where':{'id':_0x48a1da[_0xa040('0x1c')]},'include':[{'model':_0x4b2f1d[_0xa040('0x1d')],'as':_0xa040('0x1e'),'where':{'id':_0x48a1da[_0xa040('0x15')]},'limit':0x1,'include':[{'model':_0x4b2f1d[_0xa040('0x1a')],'as':_0xa040('0x1f'),'attributes':_[_0xa040('0x20')](_0x2cbeae)}]}]});})[_0xa040('0x21')](function(_0x50562b){_0x4f2e42=_0x50562b['get']({'plain':!![]});if(_0x4f2e42&&_0x4f2e42[_0xa040('0x22')]){logger[_0xa040('0x23')](_0xa040('0x24'),_0xa040('0x25'),util[_0xa040('0x26')](_0xa040('0x27'),_0x48a1da['id'],_0x4f2e42[_0xa040('0x22')]));if(_0x4f2e42[_0xa040('0x1e')]&&_0x4f2e42[_0xa040('0x1e')][_0xa040('0x28')]){_0x48a1da[_0xa040('0x29')]=_[_0xa040('0x2a')](_0x4f2e42['Interactions'][0x0],'Contact');_0x48a1da[_0xa040('0x1f')]=_0x4f2e42[_0xa040('0x1e')][0x0]['Contact'];}var _0xa07e9f={'method':_0xa040('0x2b'),'uri':encodeURI(_0x4f2e42[_0xa040('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xa07e9f[_0xa040('0x2c')]){case _0xa040('0x2d'):_0xa07e9f['qs']=_0x48a1da;break;case'POST':_0xa07e9f['body']=_0x48a1da;break;}return rp(_0xa07e9f)[_0xa040('0x21')](function(_0x4492ba){logger[_0xa040('0x23')](_0xa040('0x24'),_0xa040('0x25'),util[_0xa040('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x48a1da['id'],_0x4f2e42[_0xa040('0x22')]));if(_0x4492ba[_0xa040('0xc')][_0xa040('0x2e')]&&_0x4492ba[_0xa040('0xc')][_0xa040('0x2e')]!=_0x48a1da['Interaction'][_0xa040('0x2e')]){return _0x4b2f1d[_0xa040('0x1d')][_0xa040('0x16')]({'threadId':_0x4492ba[_0xa040('0xc')][_0xa040('0x2e')]},{'where':{'id':_0x48a1da[_0xa040('0x29')]['id']}});}else{return;}})[_0xa040('0x21')](function(){return _0x2a9eab['update']({'read':!![]});})[_0xa040('0x18')](function(_0x4a8e78){logger['error'](_0xa040('0x24'),'afterCreate',util[_0xa040('0x2f')](_0x4a8e78,{'showHidden':![],'depth':null}));_0x238276();});}else{_0x238276();}})[_0xa040('0x30')](function(){_0x238276();});}else{_0x238276();}}},'charset':_0xa040('0x31'),'collate':_0xa040('0x32')});}; \ No newline at end of file +var _0x383b=['./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','catch','error','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','afterCreate','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x5aa936,_0x42aad5){var _0x2a5776=function(_0x388bb2){while(--_0x388bb2){_0x5aa936['push'](_0x5aa936['shift']());}};_0x2a5776(++_0x42aad5);}(_0x383b,0xc4));var _0xb383=function(_0x5b19f5,_0x541ad8){_0x5b19f5=_0x5b19f5-0x0;var _0x5a1885=_0x383b[_0x5b19f5];return _0x5a1885;};'use strict';var _=require(_0xb383('0x0'));var util=require(_0xb383('0x1'));var logger=require(_0xb383('0x2'))(_0xb383('0x3'));var moment=require(_0xb383('0x4'));var BPromise=require(_0xb383('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb383('0x6'));var config=require(_0xb383('0x7'));var attributes=require(_0xb383('0x8'));module['exports']=function(_0x26d9e1,_0x1d66a9){return _0x26d9e1[_0xb383('0x9')](_0xb383('0xa'),attributes,{'tableName':_0xb383('0xb'),'paranoid':![],'indexes':[{'name':_0xb383('0xc'),'fields':[_0xb383('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53d312,_0x13f4b1,_0x112140){var _0x69ce5d=_0x26d9e1[_0xb383('0xe')];var _0x56c277=_0x53d312[_0xb383('0xf')]({'plain':!![]});if(_0x56c277['direction']['toLowerCase']()==='in'||_0x56c277[_0xb383('0x10')][_0xb383('0x11')]()===_0xb383('0x12')&&!_0x56c277[_0xb383('0x13')]&&!_[_0xb383('0x14')](_0x56c277['UserId'])){_0x69ce5d[_0xb383('0x15')][_0xb383('0x16')]({'where':{'id':_0x56c277[_0xb383('0x17')]}})['then'](function(_0xc093e2){if(_0xc093e2){_0xc093e2['update']({'lastMsgAt':_0x56c277['createdAt'],'lastMsgDirection':_0x56c277[_0xb383('0x10')][_0xb383('0x11')]()});}})[_0xb383('0x18')](function(_0x47818e){console[_0xb383('0x19')](_0x47818e);});}if(_0x56c277[_0xb383('0x10')]===_0xb383('0x12')&&!_0x56c277['secret']){var _0xacf061;_0x69ce5d['CmContact'][_0xb383('0x1a')]()[_0xb383('0x1b')](function(_0x49cd70){return _0x69ce5d[_0xb383('0x1c')][_0xb383('0x1d')]({'where':{'id':_0x56c277[_0xb383('0x1e')]},'include':[{'model':_0x69ce5d[_0xb383('0x15')],'as':_0xb383('0x1f'),'where':{'id':_0x56c277[_0xb383('0x17')]},'limit':0x1,'include':[{'model':_0x69ce5d[_0xb383('0x20')],'as':'Contact','attributes':_[_0xb383('0x21')](_0x49cd70)}]}]});})['then'](function(_0x2ef6a4){_0xacf061=_0x2ef6a4[_0xb383('0xf')]({'plain':!![]});if(_0xacf061&&_0xacf061[_0xb383('0x22')]){logger[_0xb383('0x23')](_0xb383('0x24'),'afterCreate',util[_0xb383('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x56c277['id'],_0xacf061['replyUri']));if(_0xacf061[_0xb383('0x1f')]&&_0xacf061['Interactions'][_0xb383('0x26')]){_0x56c277[_0xb383('0x27')]=_['omit'](_0xacf061[_0xb383('0x1f')][0x0],_0xb383('0x28'));_0x56c277['Contact']=_0xacf061[_0xb383('0x1f')][0x0][_0xb383('0x28')];}var _0x13f4b1={'method':_0xb383('0x29'),'uri':encodeURI(_0xacf061['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x13f4b1[_0xb383('0x2a')]){case _0xb383('0x2b'):_0x13f4b1['qs']=_0x56c277;break;case'POST':_0x13f4b1[_0xb383('0xd')]=_0x56c277;break;}return rp(_0x13f4b1)[_0xb383('0x1b')](function(_0x3ab5c9){logger[_0xb383('0x23')](_0xb383('0x24'),'afterCreate',util[_0xb383('0x25')](_0xb383('0x2c'),_0x56c277['id'],_0xacf061[_0xb383('0x22')]));if(_0x3ab5c9[_0xb383('0xd')][_0xb383('0x2d')]&&_0x3ab5c9[_0xb383('0xd')][_0xb383('0x2d')]!=_0x56c277[_0xb383('0x27')][_0xb383('0x2d')]){return _0x69ce5d[_0xb383('0x15')][_0xb383('0x2e')]({'threadId':_0x3ab5c9[_0xb383('0xd')][_0xb383('0x2d')]},{'where':{'id':_0x56c277['Interaction']['id']}});}else{return;}})[_0xb383('0x1b')](function(){return _0x53d312[_0xb383('0x2e')]({'read':!![]});})[_0xb383('0x18')](function(_0x347e65){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xb383('0x2f'),util[_0xb383('0x30')](_0x347e65,{'showHidden':![],'depth':null}));_0x112140();});}else{_0x112140();}})[_0xb383('0x31')](function(){_0x112140();});}else{_0x112140();}}},'charset':_0xb383('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4f3c312..6bcc9e1 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x25e988,_0x9f14e2){var _0x2088db=function(_0x2660a1){while(--_0x2660a1){_0x25e988['push'](_0x25e988['shift']());}};_0x2088db(++_0x9f14e2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x395f34,_0x13425d){var _0x1cd597=function(_0x19241f){while(--_0x19241f){_0x395f34['push'](_0x395f34['shift']());}};_0x1cd597(++_0x13425d);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1744cb6..96e4cff 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 _0x2b1b=['save','remove','removeListener','register','length','./openchannelMessage.events'];(function(_0x277e82,_0x114315){var _0x15f8a9=function(_0x2e3953){while(--_0x2e3953){_0x277e82['push'](_0x277e82['shift']());}};_0x15f8a9(++_0x114315);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x432de1,_0x429c47){_0x432de1=_0x432de1-0x0;var _0x3b5b24=_0x2b1b[_0x432de1];return _0x3b5b24;};'use strict';var OpenchannelMessageEvents=require(_0xb2b1('0x0'));var events=[_0xb2b1('0x1'),_0xb2b1('0x2'),'update'];function createListener(_0x42fd1e,_0x2c694e){return function(_0x19daec){_0x2c694e['emit'](_0x42fd1e,_0x19daec);};}function removeListener(_0x4a8aec,_0x285c84){return function(){OpenchannelMessageEvents[_0xb2b1('0x3')](_0x4a8aec,_0x285c84);};}exports[_0xb2b1('0x4')]=function(_0x59e8a1){for(var _0x508c11=0x0,_0x172f19=events[_0xb2b1('0x5')];_0x508c11<_0x172f19;_0x508c11++){var _0x2cf12c=events[_0x508c11];var _0x5cab4f=createListener('openchannelMessage:'+_0x2cf12c,_0x59e8a1);OpenchannelMessageEvents['on'](_0x2cf12c,_0x5cab4f);}}; \ No newline at end of file +var _0x3595=['emit','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x5ea1b2,_0x22473c){var _0xbb1a30=function(_0x2036a4){while(--_0x2036a4){_0x5ea1b2['push'](_0x5ea1b2['shift']());}};_0xbb1a30(++_0x22473c);}(_0x3595,0x147));var _0x5359=function(_0x38dcdb,_0x549f0e){_0x38dcdb=_0x38dcdb-0x0;var _0x3bb1e7=_0x3595[_0x38dcdb];return _0x3bb1e7;};'use strict';var OpenchannelMessageEvents=require(_0x5359('0x0'));var events=[_0x5359('0x1'),_0x5359('0x2'),'update'];function createListener(_0x18677f,_0x398ac6){return function(_0xcb2beb){_0x398ac6[_0x5359('0x3')](_0x18677f,_0xcb2beb);};}function removeListener(_0x1fa814,_0x125c76){return function(){OpenchannelMessageEvents['removeListener'](_0x1fa814,_0x125c76);};}exports['register']=function(_0x1cb891){for(var _0x24545a=0x0,_0x1b6f48=events[_0x5359('0x4')];_0x24545a<_0x1b6f48;_0x24545a++){var _0x39fcd8=events[_0x24545a];var _0x51b2fb=createListener(_0x5359('0x5')+_0x39fcd8,_0x1cb891);OpenchannelMessageEvents['on'](_0x39fcd8,_0x51b2fb);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2ef7847..df23271 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 _0x973d=['/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x520260,_0xd45dfe){var _0x3498e3=function(_0x12a4b4){while(--_0x12a4b4){_0x520260['push'](_0x520260['shift']());}};_0x3498e3(++_0xd45dfe);}(_0x973d,0x6c));var _0xd973=function(_0x386688,_0x29d853){_0x386688=_0x386688-0x0;var _0x139544=_0x973d[_0x386688];return _0x139544;};'use strict';var multer=require(_0xd973('0x0'));var util=require(_0xd973('0x1'));var path=require(_0xd973('0x2'));var timeout=require(_0xd973('0x3'));var express=require(_0xd973('0x4'));var router=express[_0xd973('0x5')]();var fs_extra=require(_0xd973('0x6'));var auth=require(_0xd973('0x7'));var interaction=require(_0xd973('0x8'));var config=require(_0xd973('0x9'));var controller=require(_0xd973('0xa'));router[_0xd973('0xb')]('/',auth[_0xd973('0xc')](),controller[_0xd973('0xd')]);router[_0xd973('0xb')](_0xd973('0xe'),auth[_0xd973('0xc')](),controller[_0xd973('0xf')]);router['get'](_0xd973('0x10'),auth[_0xd973('0xc')](),controller[_0xd973('0x11')]);router[_0xd973('0xb')](_0xd973('0x12'),auth['isAuthenticated'](),controller[_0xd973('0x13')]);router[_0xd973('0xb')](_0xd973('0x14'),auth[_0xd973('0xc')](),controller['getTeams']);router[_0xd973('0xb')](_0xd973('0x15'),auth['isAuthenticated'](),controller[_0xd973('0x16')]);router['post']('/',auth[_0xd973('0xc')](),controller[_0xd973('0x17')]);router[_0xd973('0x18')](_0xd973('0x14'),auth[_0xd973('0xc')](),controller[_0xd973('0x19')]);router[_0xd973('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xd973('0x1a')]);router[_0xd973('0x1b')](_0xd973('0x10'),auth['isAuthenticated'](),controller[_0xd973('0x1c')]);router[_0xd973('0x1d')](_0xd973('0x10'),auth[_0xd973('0xc')](),controller[_0xd973('0x1e')]);router[_0xd973('0x1d')](_0xd973('0x14'),auth[_0xd973('0xc')](),controller[_0xd973('0x1f')]);router[_0xd973('0x1d')](_0xd973('0x15'),auth[_0xd973('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x64ae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','/:id','destroy','removeTeams','removeAgents','connect-timeout','express','Router','fs-extra'];(function(_0x541f24,_0x2a6bb1){var _0x4febf9=function(_0x40e028){while(--_0x40e028){_0x541f24['push'](_0x541f24['shift']());}};_0x4febf9(++_0x2a6bb1);}(_0x64ae,0x11e));var _0xe64a=function(_0xc43ba7,_0x4b1a02){_0xc43ba7=_0xc43ba7-0x0;var _0x134b5b=_0x64ae[_0xc43ba7];return _0x134b5b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe64a('0x0'));var express=require(_0xe64a('0x1'));var router=express[_0xe64a('0x2')]();var fs_extra=require(_0xe64a('0x3'));var auth=require(_0xe64a('0x4'));var interaction=require(_0xe64a('0x5'));var config=require(_0xe64a('0x6'));var controller=require(_0xe64a('0x7'));router[_0xe64a('0x8')]('/',auth[_0xe64a('0x9')](),controller[_0xe64a('0xa')]);router[_0xe64a('0x8')](_0xe64a('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xe64a('0x9')](),controller[_0xe64a('0xc')]);router[_0xe64a('0x8')](_0xe64a('0xd'),auth['isAuthenticated'](),controller[_0xe64a('0xe')]);router[_0xe64a('0x8')](_0xe64a('0xf'),auth[_0xe64a('0x9')](),controller[_0xe64a('0x10')]);router[_0xe64a('0x8')](_0xe64a('0x11'),auth[_0xe64a('0x9')](),controller[_0xe64a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe64a('0x13')]);router[_0xe64a('0x14')](_0xe64a('0xf'),auth[_0xe64a('0x9')](),controller[_0xe64a('0x15')]);router[_0xe64a('0x14')](_0xe64a('0x11'),auth[_0xe64a('0x9')](),controller['addAgents']);router[_0xe64a('0x16')]('/:id',auth[_0xe64a('0x9')](),controller[_0xe64a('0x17')]);router[_0xe64a('0x18')](_0xe64a('0x19'),auth[_0xe64a('0x9')](),controller[_0xe64a('0x1a')]);router[_0xe64a('0x18')](_0xe64a('0xf'),auth['isAuthenticated'](),controller[_0xe64a('0x1b')]);router[_0xe64a('0x18')](_0xe64a('0x11'),auth[_0xe64a('0x9')](),controller[_0xe64a('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index cdb6eac..33dbaf5 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 _0x10bb=['roundrobin','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x16fc6f,_0x53075b){var _0x5c9664=function(_0xa940f0){while(--_0xa940f0){_0x16fc6f['push'](_0x16fc6f['shift']());}};_0x5c9664(++_0x53075b);}(_0x10bb,0x1ac));var _0xb10b=function(_0x12b5e9,_0x5a72c2){_0x12b5e9=_0x12b5e9-0x0;var _0x3c6f5f=_0x10bb[_0x12b5e9];return _0x3c6f5f;};'use strict';var Sequelize=require('sequelize');module[_0xb10b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb10b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb10b('0x2')]},'timeout':{'type':Sequelize[_0xb10b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb10b('0x4')]('rrmemory',_0xb10b('0x5'),_0xb10b('0x6'))}}; \ No newline at end of file +var _0x01a0=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2a8a76,_0x43bcef){var _0x298a58=function(_0x154682){while(--_0x154682){_0x2a8a76['push'](_0x2a8a76['shift']());}};_0x298a58(++_0x43bcef);}(_0x01a0,0xb0));var _0x001a=function(_0x3db7ad,_0x35667a){_0x3db7ad=_0x3db7ad-0x0;var _0x295dab=_0x01a0[_0x3db7ad];return _0x295dab;};'use strict';var Sequelize=require(_0x001a('0x0'));module[_0x001a('0x1')]={'name':{'type':Sequelize[_0x001a('0x2')],'unique':_0x001a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x001a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x001a('0x4')](_0x001a('0x5'),_0x001a('0x6'),_0x001a('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 10a012b..b5b2b91 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 _0xce95=['findAll','User','agent','openchannelPause','%s/%s','createdAt','updatedAt','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','Agents','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','OpenchannelQueue','rows','catch','show','params','find','create','body','role','UserProfileSection','autoAssociation','describe','findOne','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId'];(function(_0x322d61,_0x150f7d){var _0x1508fe=function(_0x5dbaaa){while(--_0x5dbaaa){_0x322d61['push'](_0x322d61['shift']());}};_0x1508fe(++_0x150f7d);}(_0xce95,0x13a));var _0x5ce9=function(_0x4f95dd,_0x55463e){_0x4f95dd=_0x4f95dd-0x0;var _0xeb497f=_0xce95[_0x4f95dd];return _0xeb497f;};'use strict';var emlformat=require(_0x5ce9('0x0'));var rimraf=require(_0x5ce9('0x1'));var zipdir=require(_0x5ce9('0x2'));var jsonpatch=require(_0x5ce9('0x3'));var rp=require(_0x5ce9('0x4'));var moment=require(_0x5ce9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5ce9('0x6'));var util=require(_0x5ce9('0x7'));var path=require(_0x5ce9('0x8'));var sox=require(_0x5ce9('0x9'));var csv=require(_0x5ce9('0xa'));var ejs=require(_0x5ce9('0xb'));var fs=require('fs');var fs_extra=require(_0x5ce9('0xc'));var _=require(_0x5ce9('0xd'));var squel=require(_0x5ce9('0xe'));var crypto=require(_0x5ce9('0xf'));var jsforce=require(_0x5ce9('0x10'));var deskjs=require(_0x5ce9('0x11'));var toCsv=require(_0x5ce9('0xa'));var querystring=require(_0x5ce9('0x12'));var Papa=require(_0x5ce9('0x13'));var Redis=require(_0x5ce9('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x5ce9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ce9('0x16'));var logger=require(_0x5ce9('0x17'))('api');var utils=require(_0x5ce9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5ce9('0x19'));var db=require(_0x5ce9('0x1a'))['db'];config[_0x5ce9('0x1b')]=_[_0x5ce9('0x1c')](config[_0x5ce9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ce9('0x1d'))(new Redis(config[_0x5ce9('0x1b')]));require(_0x5ce9('0x1e'))[_0x5ce9('0x1f')](socket);function respondWithStatusCode(_0x418804,_0x462c12){_0x462c12=_0x462c12||0xcc;return function(_0x40ac9d){if(_0x40ac9d){return _0x418804[_0x5ce9('0x20')](_0x462c12);}return _0x418804[_0x5ce9('0x21')](_0x462c12)[_0x5ce9('0x22')]();};}function respondWithResult(_0x48705a,_0x1cfabe){_0x1cfabe=_0x1cfabe||0xc8;return function(_0x3d5a25){if(_0x3d5a25){return _0x48705a[_0x5ce9('0x21')](_0x1cfabe)[_0x5ce9('0x23')](_0x3d5a25);}};}function respondWithFilteredResult(_0x501d13,_0xef1718){return function(_0x3c3f1b){if(_0x3c3f1b){var _0x5d3d17=typeof _0xef1718['offset']===_0x5ce9('0x24')&&typeof _0xef1718['limit']==='undefined';var _0x1c44fe=_0x3c3f1b[_0x5ce9('0x25')];var _0x5cc2a=_0x5d3d17?0x0:_0xef1718[_0x5ce9('0x26')];var _0x39cebb=_0x5d3d17?_0x3c3f1b['count']:_0xef1718[_0x5ce9('0x26')]+_0xef1718[_0x5ce9('0x27')];var _0x16db74;if(_0x39cebb>=_0x1c44fe){_0x39cebb=_0x1c44fe;_0x16db74=0xc8;}else{_0x16db74=0xce;}_0x501d13[_0x5ce9('0x21')](_0x16db74);return _0x501d13[_0x5ce9('0x28')](_0x5ce9('0x29'),_0x5cc2a+'-'+_0x39cebb+'/'+_0x1c44fe)['json'](_0x3c3f1b);}return null;};}function patchUpdates(_0x49cc5b){return function(_0x1d04fb){try{jsonpatch[_0x5ce9('0x2a')](_0x1d04fb,_0x49cc5b,!![]);}catch(_0x51070a){return BPromise[_0x5ce9('0x2b')](_0x51070a);}return _0x1d04fb[_0x5ce9('0x2c')]();};}function saveUpdates(_0x5420de,_0x28f1c9){return function(_0x3e7bb5){if(_0x3e7bb5){return _0x3e7bb5['update'](_0x5420de)[_0x5ce9('0x2d')](function(_0x5f5b36){return _0x5f5b36;});}return null;};}function removeEntity(_0x5840fd,_0x369171){return function(_0x5489d2){if(_0x5489d2){return _0x5489d2[_0x5ce9('0x2e')]()[_0x5ce9('0x2d')](function(){var _0x219c50=_0x5489d2[_0x5ce9('0x2f')]({'plain':!![]});var _0x41c5e2=_0x5ce9('0x30');return db[_0x5ce9('0x31')]['destroy']({'where':{'type':_0x41c5e2,'resourceId':_0x219c50['id']}})['then'](function(){return _0x5489d2;});})[_0x5ce9('0x2d')](function(){_0x5840fd[_0x5ce9('0x21')](0xcc)[_0x5ce9('0x22')]();});}};}function handleEntityNotFound(_0x284837,_0x491c93){return function(_0x52aa0d){if(!_0x52aa0d){_0x284837['sendStatus'](0x194);}return _0x52aa0d;};}function handleError(_0x4cbfb2,_0x18d2f1){_0x18d2f1=_0x18d2f1||0x1f4;return function(_0x4f3788){logger[_0x5ce9('0x32')](_0x4f3788['stack']);if(_0x4f3788[_0x5ce9('0x33')]){delete _0x4f3788[_0x5ce9('0x33')];}_0x4cbfb2[_0x5ce9('0x21')](_0x18d2f1)[_0x5ce9('0x34')](_0x4f3788);};}exports['index']=function(_0x5be6fc,_0x21cc1d){var _0x292adc={},_0x3813ae={},_0x1013d1={'count':0x0,'rows':[]};var _0x400ed2=_[_0x5ce9('0x35')](db['OpenchannelQueue'][_0x5ce9('0x36')],function(_0x14a45a){return{'name':_0x14a45a[_0x5ce9('0x37')],'type':_0x14a45a[_0x5ce9('0x38')]['key']};});_0x3813ae['model']=_[_0x5ce9('0x35')](_0x400ed2,_0x5ce9('0x33'));_0x3813ae[_0x5ce9('0x39')]=_[_0x5ce9('0x3a')](_0x5be6fc[_0x5ce9('0x39')]);_0x3813ae[_0x5ce9('0x3b')]=_[_0x5ce9('0x3c')](_0x3813ae['model'],_0x3813ae[_0x5ce9('0x39')]);_0x292adc['attributes']=_['intersection'](_0x3813ae[_0x5ce9('0x3d')],qs[_0x5ce9('0x3e')](_0x5be6fc['query'][_0x5ce9('0x3e')]));_0x292adc[_0x5ce9('0x3f')]=_0x292adc[_0x5ce9('0x3f')][_0x5ce9('0x40')]?_0x292adc[_0x5ce9('0x3f')]:_0x3813ae[_0x5ce9('0x3d')];if(!_0x5be6fc[_0x5ce9('0x39')][_0x5ce9('0x41')]('nolimit')){_0x292adc[_0x5ce9('0x27')]=qs[_0x5ce9('0x27')](_0x5be6fc[_0x5ce9('0x39')][_0x5ce9('0x27')]);_0x292adc[_0x5ce9('0x26')]=qs['offset'](_0x5be6fc[_0x5ce9('0x39')][_0x5ce9('0x26')]);}_0x292adc[_0x5ce9('0x42')]=qs[_0x5ce9('0x43')](_0x5be6fc['query']['sort']);_0x292adc[_0x5ce9('0x44')]=qs[_0x5ce9('0x3b')](_['pick'](_0x5be6fc[_0x5ce9('0x39')],_0x3813ae[_0x5ce9('0x3b')]),_0x400ed2);if(_0x5be6fc[_0x5ce9('0x39')][_0x5ce9('0x45')]){_0x292adc['where']=_[_0x5ce9('0x46')](_0x292adc[_0x5ce9('0x44')],{'$or':_['map'](_0x400ed2,function(_0x4c8473){if(_0x4c8473[_0x5ce9('0x38')]!=='VIRTUAL'){var _0x312138={};_0x312138[_0x4c8473[_0x5ce9('0x33')]]={'$like':'%'+_0x5be6fc[_0x5ce9('0x39')][_0x5ce9('0x45')]+'%'};return _0x312138;}})});}_0x292adc=_[_0x5ce9('0x46')]({},_0x292adc,_0x5be6fc[_0x5ce9('0x47')]);var _0x534519={'where':_0x292adc[_0x5ce9('0x44')]};return db['OpenchannelQueue'][_0x5ce9('0x25')](_0x534519)[_0x5ce9('0x2d')](function(_0x4fe1c1){_0x1013d1[_0x5ce9('0x25')]=_0x4fe1c1;if(_0x5be6fc['query'][_0x5ce9('0x48')]){_0x292adc[_0x5ce9('0x49')]=[{'all':!![]}];}return db[_0x5ce9('0x4a')]['findAll'](_0x292adc);})[_0x5ce9('0x2d')](function(_0x24b89){_0x1013d1[_0x5ce9('0x4b')]=_0x24b89;return _0x1013d1;})[_0x5ce9('0x2d')](respondWithFilteredResult(_0x21cc1d,_0x292adc))[_0x5ce9('0x4c')](handleError(_0x21cc1d,null));};exports[_0x5ce9('0x4d')]=function(_0x1f30da,_0x278faa){var _0x1f83fc={'raw':!![],'where':{'id':_0x1f30da[_0x5ce9('0x4e')]['id']}},_0x1ac00e={};_0x1ac00e[_0x5ce9('0x3d')]=_[_0x5ce9('0x3a')](db['OpenchannelQueue']['rawAttributes']);_0x1ac00e[_0x5ce9('0x39')]=_[_0x5ce9('0x3a')](_0x1f30da[_0x5ce9('0x39')]);_0x1ac00e[_0x5ce9('0x3b')]=_['intersection'](_0x1ac00e[_0x5ce9('0x3d')],_0x1ac00e[_0x5ce9('0x39')]);_0x1f83fc['attributes']=_[_0x5ce9('0x3c')](_0x1ac00e['model'],qs[_0x5ce9('0x3e')](_0x1f30da[_0x5ce9('0x39')][_0x5ce9('0x3e')]));_0x1f83fc['attributes']=_0x1f83fc[_0x5ce9('0x3f')]['length']?_0x1f83fc['attributes']:_0x1ac00e['model'];if(_0x1f30da['query']['includeAll']){_0x1f83fc['include']=[{'all':!![]}];}_0x1f83fc=_[_0x5ce9('0x46')]({},_0x1f83fc,_0x1f30da[_0x5ce9('0x47')]);return db['OpenchannelQueue'][_0x5ce9('0x4f')](_0x1f83fc)['then'](handleEntityNotFound(_0x278faa,null))[_0x5ce9('0x2d')](respondWithResult(_0x278faa,null))[_0x5ce9('0x4c')](handleError(_0x278faa,null));};exports[_0x5ce9('0x50')]=function(_0x580641,_0xe5fcc2){return db[_0x5ce9('0x4a')][_0x5ce9('0x50')](_0x580641[_0x5ce9('0x51')],{})[_0x5ce9('0x2d')](function(_0x48e44d){var _0x288969=_0x580641['user'][_0x5ce9('0x2f')]({'plain':!![]});if(!_0x288969)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x288969[_0x5ce9('0x52')]==='user'){var _0xe9846a=_0x48e44d[_0x5ce9('0x2f')]({'plain':!![]});var _0x264180=_0x5ce9('0x30');return db[_0x5ce9('0x53')][_0x5ce9('0x4f')]({'where':{'name':_0x264180,'userProfileId':_0x288969['userProfileId']},'raw':!![]})[_0x5ce9('0x2d')](function(_0x414d31){if(_0x414d31&&_0x414d31[_0x5ce9('0x54')]===0x0){return db[_0x5ce9('0x31')]['create']({'name':_0xe9846a[_0x5ce9('0x33')],'resourceId':_0xe9846a['id'],'type':_0x414d31['name'],'sectionId':_0x414d31['id']},{})[_0x5ce9('0x2d')](function(){return _0x48e44d;});}else{return _0x48e44d;}})[_0x5ce9('0x4c')](function(_0x22d3cb){logger[_0x5ce9('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22d3cb);throw _0x22d3cb;});}return _0x48e44d;})[_0x5ce9('0x2d')](respondWithResult(_0xe5fcc2,0xc9))['catch'](handleError(_0xe5fcc2,null));};exports['update']=function(_0x31f972,_0x25aef8){if(_0x31f972[_0x5ce9('0x51')]['id']){delete _0x31f972[_0x5ce9('0x51')]['id'];}return db['OpenchannelQueue'][_0x5ce9('0x4f')]({'where':{'id':_0x31f972[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x25aef8,null))[_0x5ce9('0x2d')](saveUpdates(_0x31f972[_0x5ce9('0x51')],null))[_0x5ce9('0x2d')](respondWithResult(_0x25aef8,null))['catch'](handleError(_0x25aef8,null));};exports[_0x5ce9('0x2e')]=function(_0x15eef7,_0x3dadee){return db[_0x5ce9('0x4a')]['find']({'where':{'id':_0x15eef7[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x3dadee,null))[_0x5ce9('0x2d')](removeEntity(_0x3dadee,null))[_0x5ce9('0x4c')](handleError(_0x3dadee,null));};exports[_0x5ce9('0x55')]=function(_0x1f8b4c,_0x254bd3){return db[_0x5ce9('0x4a')][_0x5ce9('0x55')]()[_0x5ce9('0x2d')](respondWithResult(_0x254bd3,null))[_0x5ce9('0x4c')](handleError(_0x254bd3,null));};exports['getMembers']=function(_0x2fcc59,_0x3f6973,_0x58ecdc){var _0x1898e7={'raw':!![],'where':{}},_0x5c5389={},_0x3e9057;return db[_0x5ce9('0x4a')][_0x5ce9('0x56')]({'where':{'id':_0x2fcc59[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x3f6973,null))[_0x5ce9('0x2d')](function(_0xc81b8d){if(_0xc81b8d){_0x3e9057=_0xc81b8d[_0x5ce9('0x2f')]({'plain':!![]});_0x5c5389[_0x5ce9('0x3d')]=_[_0x5ce9('0x3a')](db[_0x5ce9('0x57')][_0x5ce9('0x36')]);_0x5c5389[_0x5ce9('0x39')]=_[_0x5ce9('0x3a')](_0x2fcc59[_0x5ce9('0x39')]);_0x5c5389[_0x5ce9('0x3b')]=_[_0x5ce9('0x3c')](_0x5c5389[_0x5ce9('0x3d')],_0x5c5389[_0x5ce9('0x39')]);_0x1898e7['attributes']=_['intersection'](_0x5c5389[_0x5ce9('0x3d')],qs[_0x5ce9('0x3e')](_0x2fcc59[_0x5ce9('0x39')][_0x5ce9('0x3e')]));_0x1898e7[_0x5ce9('0x3f')]=_0x1898e7[_0x5ce9('0x3f')][_0x5ce9('0x40')]?_0x1898e7[_0x5ce9('0x3f')]:_0x5c5389[_0x5ce9('0x3d')];if(!_0x2fcc59[_0x5ce9('0x39')]['hasOwnProperty'](_0x5ce9('0x58'))){_0x1898e7[_0x5ce9('0x27')]=qs['limit'](_0x2fcc59[_0x5ce9('0x39')]['limit']);_0x1898e7['offset']=qs[_0x5ce9('0x26')](_0x2fcc59['query'][_0x5ce9('0x26')]);}_0x1898e7['order']=qs['sort'](_0x2fcc59[_0x5ce9('0x39')][_0x5ce9('0x43')]);_0x1898e7[_0x5ce9('0x44')]=qs[_0x5ce9('0x3b')](_[_0x5ce9('0x59')](_0x2fcc59['query'],_0x5c5389[_0x5ce9('0x3b')]));_0x1898e7[_0x5ce9('0x44')][_0x5ce9('0x5a')]=_0xc81b8d['id'];if(_0x2fcc59['query'][_0x5ce9('0x45')]){_0x1898e7[_0x5ce9('0x44')]=_[_0x5ce9('0x46')](_0x1898e7[_0x5ce9('0x44')],{'$or':_[_0x5ce9('0x35')](_0x1898e7['attributes'],function(_0x25ba10){var _0x21014f={};_0x21014f[_0x25ba10]={'$like':'%'+_0x2fcc59[_0x5ce9('0x39')][_0x5ce9('0x45')]+'%'};return _0x21014f;})});}_0x1898e7=_[_0x5ce9('0x46')]({},_0x1898e7,_0x2fcc59[_0x5ce9('0x47')]);return db['UserOpenchannelQueue'][_0x5ce9('0x5b')](_0x1898e7);}})[_0x5ce9('0x2d')](function(_0x5cbad1){if(_0x5cbad1){return db[_0x5ce9('0x5c')]['findAndCountAll']({'where':{'id':_[_0x5ce9('0x35')](_0x5cbad1,'UserId'),'role':_0x5ce9('0x5d')},'attributes':['id',_0x5ce9('0x33'),_0x5ce9('0x5e'),'updatedAt','createdAt']});}})[_0x5ce9('0x2d')](function(_0x2918fd){if(_0x2918fd){return{'count':_0x2918fd['count'],'rows':_[_0x5ce9('0x35')](_0x2918fd[_0x5ce9('0x4b')],function(_0x2d01d4){return{'membername':_0x2d01d4[_0x5ce9('0x33')],'UserId':_0x2d01d4['id'],'queue_name':_0x3e9057[_0x5ce9('0x33')],'OpenchannelQueueId':_0x3e9057['id'],'interface':util['format'](_0x5ce9('0x5f'),'SIP',_0x2d01d4[_0x5ce9('0x33')]),'penalty':0x0,'paused':_0x2d01d4[_0x5ce9('0x5e')],'createdAt':_0x2d01d4[_0x5ce9('0x60')],'updatedAt':_0x2d01d4[_0x5ce9('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ce9('0x2d')](respondWithFilteredResult(_0x3f6973,_0x1898e7))['catch'](handleError(_0x3f6973,null));};exports[_0x5ce9('0x62')]=function(_0x26b3f0,_0x5cc8d4,_0x29eb3a){var _0x2863e9={};var _0x24a470={};var _0x1b87e9;var _0x44a01a;return db[_0x5ce9('0x4a')][_0x5ce9('0x56')]({'where':{'id':_0x26b3f0[_0x5ce9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5cc8d4,null))[_0x5ce9('0x2d')](function(_0x115dcc){if(_0x115dcc){_0x1b87e9=_0x115dcc;_0x24a470[_0x5ce9('0x3d')]=_[_0x5ce9('0x3a')](db[_0x5ce9('0x63')]['rawAttributes']);_0x24a470['query']=_['keys'](_0x26b3f0[_0x5ce9('0x39')]);_0x24a470[_0x5ce9('0x3b')]=_[_0x5ce9('0x3c')](_0x24a470['model'],_0x24a470['query']);_0x2863e9[_0x5ce9('0x3f')]=_['intersection'](_0x24a470[_0x5ce9('0x3d')],qs['fields'](_0x26b3f0[_0x5ce9('0x39')]['fields']));_0x2863e9[_0x5ce9('0x3f')]=_0x2863e9[_0x5ce9('0x3f')][_0x5ce9('0x40')]?_0x2863e9[_0x5ce9('0x3f')]:_0x24a470[_0x5ce9('0x3d')];_0x2863e9[_0x5ce9('0x42')]=qs[_0x5ce9('0x43')](_0x26b3f0[_0x5ce9('0x39')][_0x5ce9('0x43')]);_0x2863e9[_0x5ce9('0x44')]=qs[_0x5ce9('0x3b')](_[_0x5ce9('0x59')](_0x26b3f0[_0x5ce9('0x39')],_0x24a470['filters']));if(_0x26b3f0[_0x5ce9('0x39')]['filter']){_0x2863e9[_0x5ce9('0x44')]=_[_0x5ce9('0x46')](_0x2863e9[_0x5ce9('0x44')],{'$or':_[_0x5ce9('0x35')](_0x2863e9[_0x5ce9('0x3f')],function(_0x30508d){var _0x278043={};_0x278043[_0x30508d]={'$like':'%'+_0x26b3f0[_0x5ce9('0x39')]['filter']+'%'};return _0x278043;})});}_0x2863e9=_['merge']({},_0x2863e9,_0x26b3f0[_0x5ce9('0x47')]);return _0x1b87e9[_0x5ce9('0x62')](_0x2863e9);}})[_0x5ce9('0x2d')](function(_0xa49b77){if(_0xa49b77){_0x44a01a=_0xa49b77[_0x5ce9('0x40')];if(!_0x26b3f0[_0x5ce9('0x39')]['hasOwnProperty']('nolimit')){_0x2863e9[_0x5ce9('0x27')]=qs[_0x5ce9('0x27')](_0x26b3f0[_0x5ce9('0x39')][_0x5ce9('0x27')]);_0x2863e9[_0x5ce9('0x26')]=qs[_0x5ce9('0x26')](_0x26b3f0[_0x5ce9('0x39')][_0x5ce9('0x26')]);}return _0x1b87e9[_0x5ce9('0x62')](_0x2863e9);}})['then'](function(_0x164e04){if(_0x164e04){return _0x164e04?{'count':_0x44a01a,'rows':_0x164e04}:null;}})[_0x5ce9('0x2d')](respondWithResult(_0x5cc8d4,null))[_0x5ce9('0x4c')](handleError(_0x5cc8d4,null));};exports[_0x5ce9('0x64')]=function(_0x31775c,_0x57f2da,_0x5754b7){var _0x9d345=_0x31775c[_0x5ce9('0x51')][_0x5ce9('0x65')];return db[_0x5ce9('0x63')][_0x5ce9('0x5b')]({'where':{'id':_0x9d345},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5ce9('0x33'),'online',_0x5ce9('0x66'),_0x5ce9('0x67')],'raw':!![]}]})[_0x5ce9('0x2d')](function(_0x4219bc){if(_0x4219bc){var _0x52493a=_[_0x5ce9('0x68')](_0x4219bc,function(_0x48cc04){var _0x264c3b=_0x48cc04[_0x5ce9('0x2f')]({'plain':!![]});return _0x264c3b['Agents'];});return db[_0x5ce9('0x4a')][_0x5ce9('0x4f')]({'where':{'id':_0x31775c['params']['id']}})[_0x5ce9('0x2d')](function(_0x419b49){return db[_0x5ce9('0x69')]['transaction'](function(_0x27a127){return _0x419b49[_0x5ce9('0x64')](_0x9d345,{'transaction':_0x27a127})[_0x5ce9('0x2d')](function(){return BPromise[_0x5ce9('0x6a')](_0x52493a,function(_0xd1edc1){return db[_0x5ce9('0x57')][_0x5ce9('0x6b')]({'where':{'UserId':_0xd1edc1['id'],'OpenchannelQueueId':_0x31775c[_0x5ce9('0x4e')]['id']},'transaction':_0x27a127});});})['then'](function(){_0x52493a['forEach'](function(_0x42cf8f){socket[_0x5ce9('0x6c')](_0x5ce9('0x6d'),{'UserId':_0x42cf8f['id'],'OpenchannelQueueId':_0x419b49['id']});});});});});}})[_0x5ce9('0x2d')](respondWithStatusCode(_0x57f2da,null))[_0x5ce9('0x4c')](handleError(_0x57f2da,null));};exports[_0x5ce9('0x6e')]=function(_0x2b2709,_0x22a5ec,_0x59802c){return db['Team'][_0x5ce9('0x5b')]({'where':{'id':_0x2b2709[_0x5ce9('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5ce9('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x22a5ec,null))[_0x5ce9('0x2d')](function(_0x2e57a5){var _0x1be7af=_[_0x5ce9('0x35')](_0x2e57a5,'id');var _0x545a05=[];var _0x5768e4=[];var _0x582a59=squel[_0x5ce9('0x70')]();_0x582a59['field'](_0x5ce9('0x71'))['from'](_0x5ce9('0x72'),'tq')[_0x5ce9('0x73')]('user_has_teams','ut',_0x5ce9('0x74'))[_0x5ce9('0x44')](_0x5ce9('0x75'),_0x2b2709[_0x5ce9('0x4e')]['id']);for(var _0x1e9bcc=0x0;_0x1e9bcc<_0x2e57a5[_0x5ce9('0x40')];_0x1e9bcc+=0x1){let _0x3e8f33=_0x2e57a5[_0x1e9bcc];for(var _0x36bd11=0x0;_0x36bd11<_0x3e8f33[_0x5ce9('0x6f')][_0x5ce9('0x40')];_0x36bd11+=0x1){let _0x44e67b=_0x3e8f33[_0x5ce9('0x6f')][_0x36bd11];var _0xedd5ff=_0x582a59[_0x5ce9('0x76')]();_0xedd5ff['where'](_0x5ce9('0x77'),_0x44e67b['id']);_0x5768e4['push'](db[_0x5ce9('0x69')]['query'](_0xedd5ff[_0x5ce9('0x78')](),{'type':db[_0x5ce9('0x69')][_0x5ce9('0x79')][_0x5ce9('0x7a')]})['then'](function(_0x47a3c9){if(_0x47a3c9[_0x5ce9('0x40')]===0x1){return _0x44e67b['id'];}else{var _0x4f208e=_[_0x5ce9('0x7b')](_[_0x5ce9('0x35')](_0x47a3c9,_0x5ce9('0x7c')),function(_0x38a42c){return _[_0x5ce9('0x7d')](_0x1be7af,_0x38a42c);});if(_0x4f208e){return _0x44e67b['id'];}}}));}}return BPromise[_0x5ce9('0x7e')](_0x5768e4)[_0x5ce9('0x2d')](function(_0x22a5b6){_0x545a05=_(_0x545a05)['union'](_0x22a5b6)['compact']()[_0x5ce9('0x7f')]();return db['OpenchannelQueue'][_0x5ce9('0x4f')]({'where':{'id':_0x2b2709[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](function(_0x54c584){return db[_0x5ce9('0x69')]['transaction'](function(_0xa22bca){return _0x54c584[_0x5ce9('0x6e')](_0x2b2709[_0x5ce9('0x39')][_0x5ce9('0x65')],{'transaction':_0xa22bca})[_0x5ce9('0x2d')](function(){if(!_[_0x5ce9('0x80')](_0x545a05)){return _0x54c584[_0x5ce9('0x81')](_0x545a05,{'transaction':_0xa22bca});}})['then'](function(){_0x545a05['forEach'](function(_0x60e839){socket[_0x5ce9('0x6c')](_0x5ce9('0x82'),{'UserId':_0x60e839,'OpenchannelQueueId':_0x54c584['id']});});});});});});})[_0x5ce9('0x2d')](respondWithStatusCode(_0x22a5ec,null))[_0x5ce9('0x4c')](handleError(_0x22a5ec,null));};exports[_0x5ce9('0x83')]=function(_0x19eabf,_0x489bb7,_0x587748){return db[_0x5ce9('0x4a')][_0x5ce9('0x4f')]({'where':{'id':_0x19eabf['params']['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x489bb7,null))[_0x5ce9('0x2d')](function(_0x22c3ef){if(_0x22c3ef){return _0x22c3ef[_0x5ce9('0x83')](_0x19eabf['body'][_0x5ce9('0x65')],_[_0x5ce9('0x84')](_0x19eabf[_0x5ce9('0x51')],[_0x5ce9('0x65'),'id'])||{})['spread'](function(_0x47f49c){for(var _0x20b67b=0x0;_0x20b67b<_0x19eabf[_0x5ce9('0x51')][_0x5ce9('0x65')][_0x5ce9('0x40')];_0x20b67b+=0x1){socket['emit'](_0x5ce9('0x6d'),{'UserId':Number(_0x19eabf[_0x5ce9('0x51')][_0x5ce9('0x65')][_0x20b67b]),'OpenchannelQueueId':Number(_0x19eabf['params']['id'])});}return _0x47f49c;});}})[_0x5ce9('0x2d')](respondWithResult(_0x489bb7,null))[_0x5ce9('0x4c')](handleError(_0x489bb7,null));};exports['removeAgents']=function(_0x58df6f,_0x582464,_0x1eb32b){return db['OpenchannelQueue'][_0x5ce9('0x4f')]({'where':{'id':_0x58df6f[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x582464,null))[_0x5ce9('0x2d')](function(_0x2f3469){if(_0x2f3469){return _0x2f3469[_0x5ce9('0x81')](_0x58df6f[_0x5ce9('0x39')][_0x5ce9('0x65')])['then'](function(){if(_[_0x5ce9('0x85')](_0x58df6f[_0x5ce9('0x39')][_0x5ce9('0x65')])){for(var _0x14d4ba=0x0;_0x14d4ba<_0x58df6f[_0x5ce9('0x39')][_0x5ce9('0x65')][_0x5ce9('0x40')];_0x14d4ba+=0x1){socket[_0x5ce9('0x6c')](_0x5ce9('0x82'),{'UserId':Number(_0x58df6f[_0x5ce9('0x39')][_0x5ce9('0x65')][_0x14d4ba]),'OpenchannelQueueId':Number(_0x58df6f[_0x5ce9('0x4e')]['id'])});}}else{socket[_0x5ce9('0x6c')](_0x5ce9('0x82'),{'UserId':Number(_0x58df6f[_0x5ce9('0x39')][_0x5ce9('0x65')]),'OpenchannelQueueId':Number(_0x58df6f[_0x5ce9('0x4e')]['id'])});}});}})[_0x5ce9('0x2d')](respondWithStatusCode(_0x582464,null))[_0x5ce9('0x4c')](handleError(_0x582464,null));};exports[_0x5ce9('0x86')]=function(_0x384e7c,_0x25df13,_0x4920d6){var _0xe1fdc={};var _0x72d0af={};var _0x528c57;var _0x377584;return db[_0x5ce9('0x4a')][_0x5ce9('0x56')]({'where':{'id':_0x384e7c[_0x5ce9('0x4e')]['id']}})[_0x5ce9('0x2d')](handleEntityNotFound(_0x25df13,null))[_0x5ce9('0x2d')](function(_0x428cf1){if(_0x428cf1){_0x528c57=_0x428cf1;_0x72d0af[_0x5ce9('0x3d')]=_[_0x5ce9('0x3a')](db[_0x5ce9('0x5c')][_0x5ce9('0x36')]);_0x72d0af[_0x5ce9('0x39')]=_['keys'](_0x384e7c[_0x5ce9('0x39')]);_0x72d0af[_0x5ce9('0x3b')]=_[_0x5ce9('0x3c')](_0x72d0af[_0x5ce9('0x3d')],_0x72d0af[_0x5ce9('0x39')]);_0xe1fdc[_0x5ce9('0x3f')]=_[_0x5ce9('0x3c')](_0x72d0af['model'],qs[_0x5ce9('0x3e')](_0x384e7c['query'][_0x5ce9('0x3e')]));_0xe1fdc[_0x5ce9('0x3f')]=_0xe1fdc[_0x5ce9('0x3f')][_0x5ce9('0x40')]?_0xe1fdc[_0x5ce9('0x3f')]:_0x72d0af[_0x5ce9('0x3d')];_0xe1fdc[_0x5ce9('0x42')]=qs[_0x5ce9('0x43')](_0x384e7c[_0x5ce9('0x39')][_0x5ce9('0x43')]);_0xe1fdc[_0x5ce9('0x44')]=qs[_0x5ce9('0x3b')](_[_0x5ce9('0x59')](_0x384e7c[_0x5ce9('0x39')],_0x72d0af['filters']));if(_0x384e7c[_0x5ce9('0x39')][_0x5ce9('0x45')]){_0xe1fdc[_0x5ce9('0x44')]=_[_0x5ce9('0x46')](_0xe1fdc[_0x5ce9('0x44')],{'$or':_['map'](_0xe1fdc[_0x5ce9('0x3f')],function(_0x54799f){var _0x46a9df={};_0x46a9df[_0x54799f]={'$like':'%'+_0x384e7c['query'][_0x5ce9('0x45')]+'%'};return _0x46a9df;})});}_0xe1fdc=_[_0x5ce9('0x46')]({},_0xe1fdc,_0x384e7c[_0x5ce9('0x47')]);return _0x528c57[_0x5ce9('0x86')](_0xe1fdc);}})['then'](function(_0x1fd65b){if(_0x1fd65b){_0x377584=_0x1fd65b[_0x5ce9('0x40')];if(!_0x384e7c[_0x5ce9('0x39')][_0x5ce9('0x41')](_0x5ce9('0x58'))){_0xe1fdc['limit']=qs[_0x5ce9('0x27')](_0x384e7c['query']['limit']);_0xe1fdc['offset']=qs[_0x5ce9('0x26')](_0x384e7c['query'][_0x5ce9('0x26')]);}return _0x528c57[_0x5ce9('0x86')](_0xe1fdc);}})[_0x5ce9('0x2d')](function(_0x5ece09){if(_0x5ece09){return _0x5ece09?{'count':_0x377584,'rows':_0x5ece09}:null;}})['then'](respondWithResult(_0x25df13,null))[_0x5ce9('0x4c')](handleError(_0x25df13,null));}; \ No newline at end of file +var _0xc1ea=['sendStatus','end','json','count','offset','limit','status','set','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','createdAt','format','updatedAt','Team','getTeams','addTeams','ids','Agents','interface','findOrCreate','forEach','userOpenchannelQueue:save','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xc1ea,0x65));var _0xac1e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc1ea[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac1e('0x0'));var zipdir=require(_0xac1e('0x1'));var jsonpatch=require(_0xac1e('0x2'));var rp=require('request-promise');var moment=require(_0xac1e('0x3'));var BPromise=require(_0xac1e('0x4'));var Mustache=require(_0xac1e('0x5'));var util=require(_0xac1e('0x6'));var path=require(_0xac1e('0x7'));var sox=require('sox');var csv=require(_0xac1e('0x8'));var ejs=require(_0xac1e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac1e('0xa'));var squel=require(_0xac1e('0xb'));var crypto=require(_0xac1e('0xc'));var jsforce=require(_0xac1e('0xd'));var deskjs=require(_0xac1e('0xe'));var toCsv=require(_0xac1e('0x8'));var querystring=require(_0xac1e('0xf'));var Papa=require(_0xac1e('0x10'));var Redis=require(_0xac1e('0x11'));var authService=require(_0xac1e('0x12'));var qs=require(_0xac1e('0x13'));var as=require(_0xac1e('0x14'));var hardwareService=require(_0xac1e('0x15'));var logger=require(_0xac1e('0x16'))(_0xac1e('0x17'));var utils=require(_0xac1e('0x18'));var config=require(_0xac1e('0x19'));var licenseUtil=require(_0xac1e('0x1a'));var db=require(_0xac1e('0x1b'))['db'];config[_0xac1e('0x1c')]=_[_0xac1e('0x1d')](config[_0xac1e('0x1c')],{'host':_0xac1e('0x1e'),'port':0x18eb});var socket=require(_0xac1e('0x1f'))(new Redis(config[_0xac1e('0x1c')]));require('./openchannelQueue.socket')[_0xac1e('0x20')](socket);function respondWithStatusCode(_0xc64d84,_0x19d470){_0x19d470=_0x19d470||0xcc;return function(_0x46354b){if(_0x46354b){return _0xc64d84[_0xac1e('0x21')](_0x19d470);}return _0xc64d84['status'](_0x19d470)[_0xac1e('0x22')]();};}function respondWithResult(_0x4e71a2,_0x5491f3){_0x5491f3=_0x5491f3||0xc8;return function(_0x29de53){if(_0x29de53){return _0x4e71a2['status'](_0x5491f3)[_0xac1e('0x23')](_0x29de53);}};}function respondWithFilteredResult(_0x7a3a94,_0x16d4e7){return function(_0x3d11b9){if(_0x3d11b9){var _0x8bb1a0=typeof _0x16d4e7['offset']==='undefined'&&typeof _0x16d4e7['limit']==='undefined';var _0x852402=_0x3d11b9[_0xac1e('0x24')];var _0x281165=_0x8bb1a0?0x0:_0x16d4e7[_0xac1e('0x25')];var _0x32563b=_0x8bb1a0?_0x3d11b9[_0xac1e('0x24')]:_0x16d4e7[_0xac1e('0x25')]+_0x16d4e7[_0xac1e('0x26')];var _0x2f4f2f;if(_0x32563b>=_0x852402){_0x32563b=_0x852402;_0x2f4f2f=0xc8;}else{_0x2f4f2f=0xce;}_0x7a3a94[_0xac1e('0x27')](_0x2f4f2f);return _0x7a3a94[_0xac1e('0x28')]('Content-Range',_0x281165+'-'+_0x32563b+'/'+_0x852402)[_0xac1e('0x23')](_0x3d11b9);}return null;};}function patchUpdates(_0x5146cc){return function(_0x5211ec){try{jsonpatch[_0xac1e('0x29')](_0x5211ec,_0x5146cc,!![]);}catch(_0x179e61){return BPromise[_0xac1e('0x2a')](_0x179e61);}return _0x5211ec['save']();};}function saveUpdates(_0x3340b9,_0x4dfac2){return function(_0x564f4c){if(_0x564f4c){return _0x564f4c[_0xac1e('0x2b')](_0x3340b9)[_0xac1e('0x2c')](function(_0xcbd547){return _0xcbd547;});}return null;};}function removeEntity(_0x545d1a,_0x5ce59b){return function(_0x53e032){if(_0x53e032){return _0x53e032['destroy']()[_0xac1e('0x2c')](function(){var _0x5738bb=_0x53e032[_0xac1e('0x2d')]({'plain':!![]});var _0x133690=_0xac1e('0x2e');return db[_0xac1e('0x2f')][_0xac1e('0x30')]({'where':{'type':_0x133690,'resourceId':_0x5738bb['id']}})[_0xac1e('0x2c')](function(){return _0x53e032;});})['then'](function(){_0x545d1a[_0xac1e('0x27')](0xcc)[_0xac1e('0x22')]();});}};}function handleEntityNotFound(_0x392bca,_0xe5a7f6){return function(_0x4f6fa7){if(!_0x4f6fa7){_0x392bca[_0xac1e('0x21')](0x194);}return _0x4f6fa7;};}function handleError(_0x367281,_0x5aacd8){_0x5aacd8=_0x5aacd8||0x1f4;return function(_0x206b09){logger['error'](_0x206b09['stack']);if(_0x206b09[_0xac1e('0x31')]){delete _0x206b09[_0xac1e('0x31')];}_0x367281[_0xac1e('0x27')](_0x5aacd8)[_0xac1e('0x32')](_0x206b09);};}exports[_0xac1e('0x33')]=function(_0x58bc8f,_0xb2e6f2){var _0xd6faa9={},_0xe02472={},_0x13afd0={'count':0x0,'rows':[]};var _0x36753f=_[_0xac1e('0x34')](db[_0xac1e('0x35')][_0xac1e('0x36')],function(_0x19e5fc){return{'name':_0x19e5fc['fieldName'],'type':_0x19e5fc[_0xac1e('0x37')][_0xac1e('0x38')]};});_0xe02472[_0xac1e('0x39')]=_[_0xac1e('0x34')](_0x36753f,_0xac1e('0x31'));_0xe02472['query']=_[_0xac1e('0x3a')](_0x58bc8f['query']);_0xe02472['filters']=_[_0xac1e('0x3b')](_0xe02472[_0xac1e('0x39')],_0xe02472[_0xac1e('0x3c')]);_0xd6faa9[_0xac1e('0x3d')]=_[_0xac1e('0x3b')](_0xe02472['model'],qs[_0xac1e('0x3e')](_0x58bc8f['query'][_0xac1e('0x3e')]));_0xd6faa9[_0xac1e('0x3d')]=_0xd6faa9[_0xac1e('0x3d')][_0xac1e('0x3f')]?_0xd6faa9[_0xac1e('0x3d')]:_0xe02472['model'];if(!_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x40')](_0xac1e('0x41'))){_0xd6faa9[_0xac1e('0x26')]=qs[_0xac1e('0x26')](_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x26')]);_0xd6faa9[_0xac1e('0x25')]=qs['offset'](_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x25')]);}_0xd6faa9[_0xac1e('0x42')]=qs[_0xac1e('0x43')](_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x43')]);_0xd6faa9[_0xac1e('0x44')]=qs[_0xac1e('0x45')](_[_0xac1e('0x46')](_0x58bc8f[_0xac1e('0x3c')],_0xe02472[_0xac1e('0x45')]),_0x36753f);if(_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x47')]){_0xd6faa9[_0xac1e('0x44')]=_[_0xac1e('0x48')](_0xd6faa9[_0xac1e('0x44')],{'$or':_[_0xac1e('0x34')](_0x36753f,function(_0x188ca9){if(_0x188ca9[_0xac1e('0x37')]!=='VIRTUAL'){var _0x12f51f={};_0x12f51f[_0x188ca9[_0xac1e('0x31')]]={'$like':'%'+_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x47')]+'%'};return _0x12f51f;}})});}_0xd6faa9=_[_0xac1e('0x48')]({},_0xd6faa9,_0x58bc8f[_0xac1e('0x49')]);var _0x12f8f0={'where':_0xd6faa9[_0xac1e('0x44')]};return db[_0xac1e('0x35')][_0xac1e('0x24')](_0x12f8f0)['then'](function(_0x18b732){_0x13afd0[_0xac1e('0x24')]=_0x18b732;if(_0x58bc8f[_0xac1e('0x3c')][_0xac1e('0x4a')]){_0xd6faa9[_0xac1e('0x4b')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xac1e('0x4c')](_0xd6faa9);})[_0xac1e('0x2c')](function(_0x11bd3c){_0x13afd0[_0xac1e('0x4d')]=_0x11bd3c;return _0x13afd0;})[_0xac1e('0x2c')](respondWithFilteredResult(_0xb2e6f2,_0xd6faa9))['catch'](handleError(_0xb2e6f2,null));};exports['show']=function(_0x30db8e,_0x1b1b9d){var _0x4f3ff5={'raw':!![],'where':{'id':_0x30db8e[_0xac1e('0x4e')]['id']}},_0xe62046={};_0xe62046[_0xac1e('0x39')]=_[_0xac1e('0x3a')](db[_0xac1e('0x35')][_0xac1e('0x36')]);_0xe62046[_0xac1e('0x3c')]=_[_0xac1e('0x3a')](_0x30db8e['query']);_0xe62046[_0xac1e('0x45')]=_[_0xac1e('0x3b')](_0xe62046[_0xac1e('0x39')],_0xe62046['query']);_0x4f3ff5['attributes']=_[_0xac1e('0x3b')](_0xe62046[_0xac1e('0x39')],qs[_0xac1e('0x3e')](_0x30db8e[_0xac1e('0x3c')][_0xac1e('0x3e')]));_0x4f3ff5['attributes']=_0x4f3ff5['attributes']['length']?_0x4f3ff5['attributes']:_0xe62046[_0xac1e('0x39')];if(_0x30db8e[_0xac1e('0x3c')][_0xac1e('0x4a')]){_0x4f3ff5[_0xac1e('0x4b')]=[{'all':!![]}];}_0x4f3ff5=_['merge']({},_0x4f3ff5,_0x30db8e[_0xac1e('0x49')]);return db[_0xac1e('0x35')][_0xac1e('0x4f')](_0x4f3ff5)['then'](handleEntityNotFound(_0x1b1b9d,null))['then'](respondWithResult(_0x1b1b9d,null))[_0xac1e('0x50')](handleError(_0x1b1b9d,null));};exports[_0xac1e('0x51')]=function(_0x2d8776,_0x597616){return db[_0xac1e('0x35')][_0xac1e('0x51')](_0x2d8776['body'],{})[_0xac1e('0x2c')](function(_0x33edd0){var _0x483ef6=_0x2d8776[_0xac1e('0x52')][_0xac1e('0x2d')]({'plain':!![]});if(!_0x483ef6)throw new Error(_0xac1e('0x53'));if(_0x483ef6['role']==='user'){var _0x426139=_0x33edd0[_0xac1e('0x2d')]({'plain':!![]});var _0x5b7310=_0xac1e('0x2e');return db[_0xac1e('0x54')][_0xac1e('0x4f')]({'where':{'name':_0x5b7310,'userProfileId':_0x483ef6['userProfileId']},'raw':!![]})[_0xac1e('0x2c')](function(_0x2d19bc){if(_0x2d19bc&&_0x2d19bc['autoAssociation']===0x0){return db[_0xac1e('0x2f')][_0xac1e('0x51')]({'name':_0x426139['name'],'resourceId':_0x426139['id'],'type':_0x2d19bc['name'],'sectionId':_0x2d19bc['id']},{})[_0xac1e('0x2c')](function(){return _0x33edd0;});}else{return _0x33edd0;}})[_0xac1e('0x50')](function(_0x3b4b0b){logger[_0xac1e('0x55')](_0xac1e('0x56'),_0x3b4b0b);throw _0x3b4b0b;});}return _0x33edd0;})[_0xac1e('0x2c')](respondWithResult(_0x597616,0xc9))[_0xac1e('0x50')](handleError(_0x597616,null));};exports['update']=function(_0x4c75cf,_0x1a6497){if(_0x4c75cf[_0xac1e('0x57')]['id']){delete _0x4c75cf[_0xac1e('0x57')]['id'];}return db[_0xac1e('0x35')][_0xac1e('0x4f')]({'where':{'id':_0x4c75cf['params']['id']}})[_0xac1e('0x2c')](handleEntityNotFound(_0x1a6497,null))[_0xac1e('0x2c')](saveUpdates(_0x4c75cf[_0xac1e('0x57')],null))[_0xac1e('0x2c')](respondWithResult(_0x1a6497,null))['catch'](handleError(_0x1a6497,null));};exports[_0xac1e('0x30')]=function(_0x5726d1,_0x4eab60){return db['OpenchannelQueue'][_0xac1e('0x4f')]({'where':{'id':_0x5726d1[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](handleEntityNotFound(_0x4eab60,null))[_0xac1e('0x2c')](removeEntity(_0x4eab60,null))[_0xac1e('0x50')](handleError(_0x4eab60,null));};exports[_0xac1e('0x58')]=function(_0x220273,_0x45100c){return db[_0xac1e('0x35')][_0xac1e('0x58')]()[_0xac1e('0x2c')](respondWithResult(_0x45100c,null))['catch'](handleError(_0x45100c,null));};exports['getMembers']=function(_0x22d8e4,_0x47097a,_0x5562c4){var _0x1d618f={'raw':!![],'where':{}},_0x384232={},_0x5166f9;return db[_0xac1e('0x35')][_0xac1e('0x59')]({'where':{'id':_0x22d8e4['params']['id']}})['then'](handleEntityNotFound(_0x47097a,null))[_0xac1e('0x2c')](function(_0x47c801){if(_0x47c801){_0x5166f9=_0x47c801[_0xac1e('0x2d')]({'plain':!![]});_0x384232['model']=_[_0xac1e('0x3a')](db[_0xac1e('0x5a')][_0xac1e('0x36')]);_0x384232['query']=_[_0xac1e('0x3a')](_0x22d8e4[_0xac1e('0x3c')]);_0x384232[_0xac1e('0x45')]=_[_0xac1e('0x3b')](_0x384232[_0xac1e('0x39')],_0x384232['query']);_0x1d618f[_0xac1e('0x3d')]=_[_0xac1e('0x3b')](_0x384232['model'],qs[_0xac1e('0x3e')](_0x22d8e4['query'][_0xac1e('0x3e')]));_0x1d618f[_0xac1e('0x3d')]=_0x1d618f[_0xac1e('0x3d')][_0xac1e('0x3f')]?_0x1d618f[_0xac1e('0x3d')]:_0x384232[_0xac1e('0x39')];if(!_0x22d8e4[_0xac1e('0x3c')][_0xac1e('0x40')](_0xac1e('0x41'))){_0x1d618f[_0xac1e('0x26')]=qs[_0xac1e('0x26')](_0x22d8e4[_0xac1e('0x3c')]['limit']);_0x1d618f['offset']=qs[_0xac1e('0x25')](_0x22d8e4[_0xac1e('0x3c')][_0xac1e('0x25')]);}_0x1d618f['order']=qs[_0xac1e('0x43')](_0x22d8e4[_0xac1e('0x3c')][_0xac1e('0x43')]);_0x1d618f[_0xac1e('0x44')]=qs[_0xac1e('0x45')](_[_0xac1e('0x46')](_0x22d8e4[_0xac1e('0x3c')],_0x384232['filters']));_0x1d618f[_0xac1e('0x44')]['OpenchannelQueueId']=_0x47c801['id'];if(_0x22d8e4[_0xac1e('0x3c')][_0xac1e('0x47')]){_0x1d618f[_0xac1e('0x44')]=_[_0xac1e('0x48')](_0x1d618f[_0xac1e('0x44')],{'$or':_[_0xac1e('0x34')](_0x1d618f[_0xac1e('0x3d')],function(_0x5b4013){var _0x2e44f2={};_0x2e44f2[_0x5b4013]={'$like':'%'+_0x22d8e4[_0xac1e('0x3c')]['filter']+'%'};return _0x2e44f2;})});}_0x1d618f=_['merge']({},_0x1d618f,_0x22d8e4[_0xac1e('0x49')]);return db['UserOpenchannelQueue'][_0xac1e('0x4c')](_0x1d618f);}})[_0xac1e('0x2c')](function(_0x458a60){if(_0x458a60){return db[_0xac1e('0x5b')][_0xac1e('0x5c')]({'where':{'id':_['map'](_0x458a60,'UserId'),'role':_0xac1e('0x5d')},'attributes':['id',_0xac1e('0x31'),_0xac1e('0x5e'),'updatedAt',_0xac1e('0x5f')]});}})['then'](function(_0x5263b4){if(_0x5263b4){return{'count':_0x5263b4[_0xac1e('0x24')],'rows':_['map'](_0x5263b4['rows'],function(_0x1390f9){return{'membername':_0x1390f9[_0xac1e('0x31')],'UserId':_0x1390f9['id'],'queue_name':_0x5166f9[_0xac1e('0x31')],'OpenchannelQueueId':_0x5166f9['id'],'interface':util[_0xac1e('0x60')]('%s/%s','SIP',_0x1390f9[_0xac1e('0x31')]),'penalty':0x0,'paused':_0x1390f9[_0xac1e('0x5e')],'createdAt':_0x1390f9[_0xac1e('0x5f')],'updatedAt':_0x1390f9[_0xac1e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47097a,_0x1d618f))[_0xac1e('0x50')](handleError(_0x47097a,null));};exports['getTeams']=function(_0x42e6eb,_0x5526d0,_0x5c24f9){var _0xac43fa={};var _0x416123={};var _0x5afbfc;var _0x124abe;return db[_0xac1e('0x35')][_0xac1e('0x59')]({'where':{'id':_0x42e6eb[_0xac1e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5526d0,null))[_0xac1e('0x2c')](function(_0x31bfd3){if(_0x31bfd3){_0x5afbfc=_0x31bfd3;_0x416123[_0xac1e('0x39')]=_[_0xac1e('0x3a')](db[_0xac1e('0x62')][_0xac1e('0x36')]);_0x416123['query']=_[_0xac1e('0x3a')](_0x42e6eb['query']);_0x416123[_0xac1e('0x45')]=_[_0xac1e('0x3b')](_0x416123[_0xac1e('0x39')],_0x416123[_0xac1e('0x3c')]);_0xac43fa['attributes']=_[_0xac1e('0x3b')](_0x416123[_0xac1e('0x39')],qs[_0xac1e('0x3e')](_0x42e6eb['query'][_0xac1e('0x3e')]));_0xac43fa[_0xac1e('0x3d')]=_0xac43fa[_0xac1e('0x3d')]['length']?_0xac43fa[_0xac1e('0x3d')]:_0x416123[_0xac1e('0x39')];_0xac43fa['order']=qs[_0xac1e('0x43')](_0x42e6eb[_0xac1e('0x3c')][_0xac1e('0x43')]);_0xac43fa[_0xac1e('0x44')]=qs[_0xac1e('0x45')](_[_0xac1e('0x46')](_0x42e6eb[_0xac1e('0x3c')],_0x416123['filters']));if(_0x42e6eb[_0xac1e('0x3c')][_0xac1e('0x47')]){_0xac43fa[_0xac1e('0x44')]=_['merge'](_0xac43fa[_0xac1e('0x44')],{'$or':_[_0xac1e('0x34')](_0xac43fa[_0xac1e('0x3d')],function(_0x560957){var _0x47d311={};_0x47d311[_0x560957]={'$like':'%'+_0x42e6eb['query']['filter']+'%'};return _0x47d311;})});}_0xac43fa=_['merge']({},_0xac43fa,_0x42e6eb[_0xac1e('0x49')]);return _0x5afbfc[_0xac1e('0x63')](_0xac43fa);}})['then'](function(_0x406e62){if(_0x406e62){_0x124abe=_0x406e62[_0xac1e('0x3f')];if(!_0x42e6eb[_0xac1e('0x3c')][_0xac1e('0x40')](_0xac1e('0x41'))){_0xac43fa['limit']=qs[_0xac1e('0x26')](_0x42e6eb[_0xac1e('0x3c')][_0xac1e('0x26')]);_0xac43fa[_0xac1e('0x25')]=qs['offset'](_0x42e6eb[_0xac1e('0x3c')][_0xac1e('0x25')]);}return _0x5afbfc[_0xac1e('0x63')](_0xac43fa);}})[_0xac1e('0x2c')](function(_0xd0e71f){if(_0xd0e71f){return _0xd0e71f?{'count':_0x124abe,'rows':_0xd0e71f}:null;}})[_0xac1e('0x2c')](respondWithResult(_0x5526d0,null))[_0xac1e('0x50')](handleError(_0x5526d0,null));};exports[_0xac1e('0x64')]=function(_0x4e0e57,_0x55eb21,_0x442cec){var _0x3227b4=_0x4e0e57[_0xac1e('0x57')][_0xac1e('0x65')];return db[_0xac1e('0x62')][_0xac1e('0x4c')]({'where':{'id':_0x3227b4},'attributes':['id'],'include':[{'model':db['User'],'as':_0xac1e('0x66'),'attributes':['id',_0xac1e('0x31'),'online','voicePause',_0xac1e('0x67')],'raw':!![]}]})[_0xac1e('0x2c')](function(_0x5db3e8){if(_0x5db3e8){var _0x187ce0=_['flatMap'](_0x5db3e8,function(_0x356b1e){var _0x2066e6=_0x356b1e['get']({'plain':!![]});return _0x2066e6[_0xac1e('0x66')];});return db[_0xac1e('0x35')][_0xac1e('0x4f')]({'where':{'id':_0x4e0e57[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](function(_0xcfb89f){return db['sequelize']['transaction'](function(_0x8264dd){return _0xcfb89f[_0xac1e('0x64')](_0x3227b4,{'transaction':_0x8264dd})[_0xac1e('0x2c')](function(){return BPromise['each'](_0x187ce0,function(_0x11643c){return db[_0xac1e('0x5a')][_0xac1e('0x68')]({'where':{'UserId':_0x11643c['id'],'OpenchannelQueueId':_0x4e0e57[_0xac1e('0x4e')]['id']},'transaction':_0x8264dd});});})[_0xac1e('0x2c')](function(){_0x187ce0[_0xac1e('0x69')](function(_0xa135e9){socket['emit'](_0xac1e('0x6a'),{'UserId':_0xa135e9['id'],'OpenchannelQueueId':_0xcfb89f['id']});});});});});}})['then'](respondWithStatusCode(_0x55eb21,null))[_0xac1e('0x50')](handleError(_0x55eb21,null));};exports['removeTeams']=function(_0xea18ad,_0x29aac0,_0x2fff86){return db[_0xac1e('0x62')]['findAll']({'where':{'id':_0xea18ad[_0xac1e('0x3c')][_0xac1e('0x65')]},'attributes':['id'],'include':[{'model':db[_0xac1e('0x5b')],'as':_0xac1e('0x66'),'attributes':['id'],'raw':!![]}]})[_0xac1e('0x2c')](handleEntityNotFound(_0x29aac0,null))['then'](function(_0xa07d18){var _0x3ca8aa=_[_0xac1e('0x34')](_0xa07d18,'id');var _0x4ffee1=[];var _0x3e7b21=[];var _0x58026d=squel['select']();_0x58026d[_0xac1e('0x6b')](_0xac1e('0x6c'))['from']('team_has_openchannel_queues','tq')['join'](_0xac1e('0x6d'),'ut',_0xac1e('0x6e'))['where'](_0xac1e('0x6f'),_0xea18ad[_0xac1e('0x4e')]['id']);for(var _0x1a5bc7=0x0;_0x1a5bc7<_0xa07d18[_0xac1e('0x3f')];_0x1a5bc7+=0x1){let _0x186f91=_0xa07d18[_0x1a5bc7];for(var _0x102aec=0x0;_0x102aec<_0x186f91[_0xac1e('0x66')][_0xac1e('0x3f')];_0x102aec+=0x1){let _0x1b62fa=_0x186f91[_0xac1e('0x66')][_0x102aec];var _0x5ccb90=_0x58026d[_0xac1e('0x70')]();_0x5ccb90[_0xac1e('0x44')](_0xac1e('0x71'),_0x1b62fa['id']);_0x3e7b21[_0xac1e('0x72')](db[_0xac1e('0x73')][_0xac1e('0x3c')](_0x5ccb90[_0xac1e('0x74')](),{'type':db[_0xac1e('0x73')][_0xac1e('0x75')]['SELECT']})['then'](function(_0x1493cf){if(_0x1493cf[_0xac1e('0x3f')]===0x1){return _0x1b62fa['id'];}else{var _0x20e361=_['every'](_['map'](_0x1493cf,_0xac1e('0x76')),function(_0x46032e){return _[_0xac1e('0x77')](_0x3ca8aa,_0x46032e);});if(_0x20e361){return _0x1b62fa['id'];}}}));}}return BPromise['all'](_0x3e7b21)[_0xac1e('0x2c')](function(_0x2d32fc){_0x4ffee1=_(_0x4ffee1)[_0xac1e('0x78')](_0x2d32fc)[_0xac1e('0x79')]()[_0xac1e('0x7a')]();return db[_0xac1e('0x35')][_0xac1e('0x4f')]({'where':{'id':_0xea18ad[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](function(_0x335fec){return db[_0xac1e('0x73')][_0xac1e('0x7b')](function(_0x4d6d01){return _0x335fec[_0xac1e('0x7c')](_0xea18ad[_0xac1e('0x3c')][_0xac1e('0x65')],{'transaction':_0x4d6d01})['then'](function(){if(!_[_0xac1e('0x7d')](_0x4ffee1)){return _0x335fec['removeAgents'](_0x4ffee1,{'transaction':_0x4d6d01});}})['then'](function(){_0x4ffee1['forEach'](function(_0x1d466a){socket[_0xac1e('0x7e')](_0xac1e('0x7f'),{'UserId':_0x1d466a,'OpenchannelQueueId':_0x335fec['id']});});});});});});})[_0xac1e('0x2c')](respondWithStatusCode(_0x29aac0,null))[_0xac1e('0x50')](handleError(_0x29aac0,null));};exports[_0xac1e('0x80')]=function(_0x33ecb5,_0x580692,_0x34ca37){return db[_0xac1e('0x35')][_0xac1e('0x4f')]({'where':{'id':_0x33ecb5[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](handleEntityNotFound(_0x580692,null))['then'](function(_0x5534e7){if(_0x5534e7){return _0x5534e7[_0xac1e('0x80')](_0x33ecb5[_0xac1e('0x57')]['ids'],_[_0xac1e('0x81')](_0x33ecb5[_0xac1e('0x57')],[_0xac1e('0x65'),'id'])||{})[_0xac1e('0x82')](function(_0x305c13){for(var _0x447043=0x0;_0x447043<_0x33ecb5[_0xac1e('0x57')][_0xac1e('0x65')][_0xac1e('0x3f')];_0x447043+=0x1){socket[_0xac1e('0x7e')](_0xac1e('0x6a'),{'UserId':Number(_0x33ecb5[_0xac1e('0x57')][_0xac1e('0x65')][_0x447043]),'OpenchannelQueueId':Number(_0x33ecb5[_0xac1e('0x4e')]['id'])});}return _0x305c13;});}})[_0xac1e('0x2c')](respondWithResult(_0x580692,null))['catch'](handleError(_0x580692,null));};exports[_0xac1e('0x83')]=function(_0x2e2fa7,_0x4da787,_0x1ebb9c){return db['OpenchannelQueue'][_0xac1e('0x4f')]({'where':{'id':_0x2e2fa7[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](handleEntityNotFound(_0x4da787,null))[_0xac1e('0x2c')](function(_0xeb2257){if(_0xeb2257){return _0xeb2257[_0xac1e('0x83')](_0x2e2fa7['query'][_0xac1e('0x65')])[_0xac1e('0x2c')](function(){if(_[_0xac1e('0x84')](_0x2e2fa7[_0xac1e('0x3c')][_0xac1e('0x65')])){for(var _0x5e6b96=0x0;_0x5e6b96<_0x2e2fa7[_0xac1e('0x3c')][_0xac1e('0x65')][_0xac1e('0x3f')];_0x5e6b96+=0x1){socket['emit'](_0xac1e('0x7f'),{'UserId':Number(_0x2e2fa7[_0xac1e('0x3c')][_0xac1e('0x65')][_0x5e6b96]),'OpenchannelQueueId':Number(_0x2e2fa7[_0xac1e('0x4e')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x2e2fa7[_0xac1e('0x3c')][_0xac1e('0x65')]),'OpenchannelQueueId':Number(_0x2e2fa7[_0xac1e('0x4e')]['id'])});}});}})[_0xac1e('0x2c')](respondWithStatusCode(_0x4da787,null))[_0xac1e('0x50')](handleError(_0x4da787,null));};exports[_0xac1e('0x85')]=function(_0x145ca,_0x5a22d4,_0x76cf04){var _0x3960e7={};var _0x9614e1={};var _0x1488e6;var _0x42554d;return db[_0xac1e('0x35')][_0xac1e('0x59')]({'where':{'id':_0x145ca[_0xac1e('0x4e')]['id']}})[_0xac1e('0x2c')](handleEntityNotFound(_0x5a22d4,null))[_0xac1e('0x2c')](function(_0x55bdbf){if(_0x55bdbf){_0x1488e6=_0x55bdbf;_0x9614e1[_0xac1e('0x39')]=_[_0xac1e('0x3a')](db[_0xac1e('0x5b')][_0xac1e('0x36')]);_0x9614e1[_0xac1e('0x3c')]=_[_0xac1e('0x3a')](_0x145ca[_0xac1e('0x3c')]);_0x9614e1[_0xac1e('0x45')]=_[_0xac1e('0x3b')](_0x9614e1[_0xac1e('0x39')],_0x9614e1[_0xac1e('0x3c')]);_0x3960e7[_0xac1e('0x3d')]=_[_0xac1e('0x3b')](_0x9614e1['model'],qs[_0xac1e('0x3e')](_0x145ca[_0xac1e('0x3c')][_0xac1e('0x3e')]));_0x3960e7['attributes']=_0x3960e7[_0xac1e('0x3d')][_0xac1e('0x3f')]?_0x3960e7[_0xac1e('0x3d')]:_0x9614e1[_0xac1e('0x39')];_0x3960e7[_0xac1e('0x42')]=qs[_0xac1e('0x43')](_0x145ca[_0xac1e('0x3c')][_0xac1e('0x43')]);_0x3960e7[_0xac1e('0x44')]=qs['filters'](_[_0xac1e('0x46')](_0x145ca['query'],_0x9614e1['filters']));if(_0x145ca['query'][_0xac1e('0x47')]){_0x3960e7['where']=_[_0xac1e('0x48')](_0x3960e7[_0xac1e('0x44')],{'$or':_[_0xac1e('0x34')](_0x3960e7['attributes'],function(_0x52cad6){var _0x34ff9c={};_0x34ff9c[_0x52cad6]={'$like':'%'+_0x145ca[_0xac1e('0x3c')][_0xac1e('0x47')]+'%'};return _0x34ff9c;})});}_0x3960e7=_[_0xac1e('0x48')]({},_0x3960e7,_0x145ca['options']);return _0x1488e6[_0xac1e('0x85')](_0x3960e7);}})['then'](function(_0x4402a8){if(_0x4402a8){_0x42554d=_0x4402a8[_0xac1e('0x3f')];if(!_0x145ca[_0xac1e('0x3c')][_0xac1e('0x40')](_0xac1e('0x41'))){_0x3960e7[_0xac1e('0x26')]=qs[_0xac1e('0x26')](_0x145ca[_0xac1e('0x3c')][_0xac1e('0x26')]);_0x3960e7['offset']=qs['offset'](_0x145ca[_0xac1e('0x3c')][_0xac1e('0x25')]);}return _0x1488e6[_0xac1e('0x85')](_0x3960e7);}})['then'](function(_0x5548a3){if(_0x5548a3){return _0x5548a3?{'count':_0x42554d,'rows':_0x5548a3}:null;}})['then'](respondWithResult(_0x5a22d4,null))[_0xac1e('0x50')](handleError(_0x5a22d4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 70ce264..748c4cd 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 _0x792a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x792a,0xea));var _0xa792=function(_0x1371b3,_0x5e7f27){_0x1371b3=_0x1371b3-0x0;var _0xe0ab03=_0x792a[_0x1371b3];return _0xe0ab03;};'use strict';var EventEmitter=require(_0xa792('0x0'));var OpenchannelQueue=require(_0xa792('0x1'))['db'][_0xa792('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa792('0x3')](0x0);var events={'afterCreate':_0xa792('0x4'),'afterUpdate':_0xa792('0x5'),'afterDestroy':_0xa792('0x6')};function emitEvent(_0x1b64c2){return function(_0x54a7b9,_0x564405,_0x461684){OpenchannelQueueEvents['emit'](_0x1b64c2+':'+_0x54a7b9['id'],_0x54a7b9);OpenchannelQueueEvents[_0xa792('0x7')](_0x1b64c2,_0x54a7b9);_0x461684(null);};}for(var e in events){if(events[_0xa792('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xa792('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1e5c=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x111a4a,_0x54d55c){var _0x1fa14a=function(_0x5a6556){while(--_0x5a6556){_0x111a4a['push'](_0x111a4a['shift']());}};_0x1fa14a(++_0x54d55c);}(_0x1e5c,0x1bb));var _0xc1e5=function(_0x394fe0,_0x3a033b){_0x394fe0=_0x394fe0-0x0;var _0x4cd1fc=_0x1e5c[_0x394fe0];return _0x4cd1fc;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc1e5('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc1e5('0x1')](0x0);var events={'afterCreate':_0xc1e5('0x2'),'afterUpdate':_0xc1e5('0x3'),'afterDestroy':_0xc1e5('0x4')};function emitEvent(_0x27097c){return function(_0x620f83,_0x46eadd,_0x397825){OpenchannelQueueEvents[_0xc1e5('0x5')](_0x27097c+':'+_0x620f83['id'],_0x620f83);OpenchannelQueueEvents[_0xc1e5('0x5')](_0x27097c,_0x620f83);_0x397825(null);};}for(var e in events){if(events[_0xc1e5('0x6')](e)){var event=events[e];OpenchannelQueue[_0xc1e5('0x7')](e,emitEvent(event));}}module[_0xc1e5('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 82a3750..92f92bb 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 _0x63ed=['exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x63ed,0xf1));var _0xd63e=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x63ed[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xd63e('0x0'));var util=require(_0xd63e('0x1'));var logger=require(_0xd63e('0x2'))(_0xd63e('0x3'));var moment=require(_0xd63e('0x4'));var BPromise=require(_0xd63e('0x5'));var rp=require(_0xd63e('0x6'));var fs=require('fs');var path=require(_0xd63e('0x7'));var rimraf=require(_0xd63e('0x8'));var config=require(_0xd63e('0x9'));var attributes=require(_0xd63e('0xa'));module[_0xd63e('0xb')]=function(_0x1e2121,_0x1f0887){return _0x1e2121['define'](_0xd63e('0xc'),attributes,{'tableName':_0xd63e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e2d=['request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x463b57,_0x3c5117){var _0x37530f=function(_0x1c9078){while(--_0x1c9078){_0x463b57['push'](_0x463b57['shift']());}};_0x37530f(++_0x3c5117);}(_0x2e2d,0xf7));var _0xd2e2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2e2d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd2e2('0x0'));var util=require('util');var logger=require(_0xd2e2('0x1'))(_0xd2e2('0x2'));var moment=require(_0xd2e2('0x3'));var BPromise=require(_0xd2e2('0x4'));var rp=require(_0xd2e2('0x5'));var fs=require('fs');var path=require(_0xd2e2('0x6'));var rimraf=require(_0xd2e2('0x7'));var config=require(_0xd2e2('0x8'));var attributes=require(_0xd2e2('0x9'));module[_0xd2e2('0xa')]=function(_0x34e6f3,_0x2f3caf){return _0x34e6f3[_0xd2e2('0xb')](_0xd2e2('0xc'),attributes,{'tableName':_0xd2e2('0xd'),'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 1fde901..f74a0b5 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 _0x3fdf=['findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x1da42f,_0x9980b8){var _0x2257b5=function(_0x59907c){while(--_0x59907c){_0x1da42f['push'](_0x1da42f['shift']());}};_0x2257b5(++_0x9980b8);}(_0x3fdf,0x107));var _0xf3fd=function(_0x1518c6,_0x479563){_0x1518c6=_0x1518c6-0x0;var _0x338cfe=_0x3fdf[_0x1518c6];return _0x338cfe;};'use strict';var _=require(_0xf3fd('0x0'));var util=require(_0xf3fd('0x1'));var moment=require(_0xf3fd('0x2'));var BPromise=require(_0xf3fd('0x3'));var rs=require(_0xf3fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3fd('0x5'))['db'];var utils=require(_0xf3fd('0x6'));var logger=require(_0xf3fd('0x7'))('rpc');var config=require(_0xf3fd('0x8'));var jayson=require(_0xf3fd('0x9'));var client=jayson['client'][_0xf3fd('0xa')]({'port':0x232a});config[_0xf3fd('0xb')]=_[_0xf3fd('0xc')](config[_0xf3fd('0xb')],{'host':_0xf3fd('0xd'),'port':0x18eb});var socket=require(_0xf3fd('0xe'))(new Redis(config[_0xf3fd('0xb')]));require(_0xf3fd('0xf'))[_0xf3fd('0x10')](socket);function respondWithRpcPromise(_0x18dc70,_0x3b5d86,_0x333baf){return new BPromise(function(_0x393713,_0x1aa734){return client[_0xf3fd('0x11')](_0x18dc70,_0x333baf)[_0xf3fd('0x12')](function(_0xcae9f8){logger[_0xf3fd('0x13')](_0xf3fd('0x14'),_0x3b5d86,'request\x20sent');logger[_0xf3fd('0x15')](_0xf3fd('0x16'),_0x3b5d86,_0xf3fd('0x17'),JSON['stringify'](_0xcae9f8));if(_0xcae9f8['error']){if(_0xcae9f8['error'][_0xf3fd('0x18')]===0x1f4){logger[_0xf3fd('0x19')](_0xf3fd('0x14'),_0x3b5d86,_0xcae9f8[_0xf3fd('0x19')][_0xf3fd('0x1a')]);return _0x1aa734(_0xcae9f8['error'][_0xf3fd('0x1a')]);}logger[_0xf3fd('0x19')](_0xf3fd('0x14'),_0x3b5d86,_0xcae9f8[_0xf3fd('0x19')][_0xf3fd('0x1a')]);return _0x393713(_0xcae9f8[_0xf3fd('0x19')]['message']);}else{logger[_0xf3fd('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x3b5d86,_0xf3fd('0x17'));_0x393713(_0xcae9f8[_0xf3fd('0x1b')][_0xf3fd('0x1a')]);}})[_0xf3fd('0x1c')](function(_0x30f308){logger['error'](_0xf3fd('0x14'),_0x3b5d86,_0x30f308);_0x1aa734(_0x30f308);});});}exports[_0xf3fd('0x1d')]=function(_0x594f19){var _0x59ef73=this;return new Promise(function(_0x321cd2,_0x20b7b3){return db[_0xf3fd('0x1e')][_0xf3fd('0x1f')]({'raw':_0x594f19[_0xf3fd('0x20')]?_0x594f19[_0xf3fd('0x20')][_0xf3fd('0x21')]===undefined?!![]:![]:!![],'where':_0x594f19['options']?_0x594f19[_0xf3fd('0x20')][_0xf3fd('0x22')]||null:null,'attributes':_0x594f19[_0xf3fd('0x20')]?_0x594f19[_0xf3fd('0x20')]['attributes']||null:null,'limit':_0x594f19[_0xf3fd('0x20')]?_0x594f19[_0xf3fd('0x20')][_0xf3fd('0x23')]||null:null,'include':_0x594f19[_0xf3fd('0x20')]?_0x594f19['options'][_0xf3fd('0x24')]?_[_0xf3fd('0x25')](_0x594f19[_0xf3fd('0x20')]['include'],function(_0x5b8a05){return{'model':db[_0x5b8a05[_0xf3fd('0x26')]],'as':_0x5b8a05['as'],'attributes':_0x5b8a05['attributes'],'include':_0x5b8a05[_0xf3fd('0x24')]?_['map'](_0x5b8a05['include'],function(_0xaecaf8){return{'model':db[_0xaecaf8[_0xf3fd('0x26')]],'as':_0xaecaf8['as'],'attributes':_0xaecaf8[_0xf3fd('0x27')],'include':_0xaecaf8['include']?_[_0xf3fd('0x25')](_0xaecaf8[_0xf3fd('0x24')],function(_0x598159){return{'model':db[_0x598159[_0xf3fd('0x26')]],'as':_0x598159['as'],'attributes':_0x598159['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x820d79){logger['info']('GetOpenchannelQueue',_0x594f19);logger[_0xf3fd('0x15')](_0xf3fd('0x1d'),_0x594f19,JSON[_0xf3fd('0x28')](_0x820d79));_0x321cd2(_0x820d79);})[_0xf3fd('0x1c')](function(_0x1431b8){logger[_0xf3fd('0x19')]('GetOpenchannelQueue',_0x1431b8[_0xf3fd('0x1a')],_0x594f19);_0x20b7b3(_0x59ef73[_0xf3fd('0x19')](0x1f4,_0x1431b8['message']));});});};exports['ShowOpenchannelQueue']=function(_0x15d451){var _0x32e605=this;return new Promise(function(_0x570467,_0x5753a3){return db[_0xf3fd('0x1e')]['find']({'raw':_0x15d451[_0xf3fd('0x20')]?_0x15d451[_0xf3fd('0x20')][_0xf3fd('0x21')]===undefined?!![]:![]:!![],'where':_0x15d451[_0xf3fd('0x20')]?_0x15d451['options'][_0xf3fd('0x22')]||null:null,'attributes':_0x15d451['options']?_0x15d451[_0xf3fd('0x20')][_0xf3fd('0x27')]||null:null,'include':_0x15d451['options']?_0x15d451[_0xf3fd('0x20')][_0xf3fd('0x24')]?_[_0xf3fd('0x25')](_0x15d451[_0xf3fd('0x20')][_0xf3fd('0x24')],function(_0x548b5d){return{'model':db[_0x548b5d[_0xf3fd('0x26')]],'as':_0x548b5d['as'],'attributes':_0x548b5d['attributes'],'include':_0x548b5d[_0xf3fd('0x24')]?_['map'](_0x548b5d[_0xf3fd('0x24')],function(_0x1ef40e){return{'model':db[_0x1ef40e[_0xf3fd('0x26')]],'as':_0x1ef40e['as'],'attributes':_0x1ef40e[_0xf3fd('0x27')],'include':_0x1ef40e[_0xf3fd('0x24')]?_[_0xf3fd('0x25')](_0x1ef40e[_0xf3fd('0x24')],function(_0x25f235){return{'model':db[_0x25f235['model']],'as':_0x25f235['as'],'attributes':_0x25f235[_0xf3fd('0x27')]};}):[]};}):[]};}):[]:[]})[_0xf3fd('0x12')](function(_0x33355c){logger['info']('ShowOpenchannelQueue',_0x15d451);logger[_0xf3fd('0x15')](_0xf3fd('0x29'),_0x15d451,JSON[_0xf3fd('0x28')](_0x33355c));_0x570467(_0x33355c);})[_0xf3fd('0x1c')](function(_0x34bb98){logger[_0xf3fd('0x19')](_0xf3fd('0x29'),_0x34bb98[_0xf3fd('0x1a')],_0x15d451);_0x5753a3(_0x32e605['error'](0x1f4,_0x34bb98[_0xf3fd('0x1a')]));});});}; \ No newline at end of file +var _0xe941=['stringify','error','code','message','info','result','catch','options','raw','attributes','limit','include','map','model','then','GetOpenchannelQueue','OpenchannelQueue','find','where','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x56170d,_0x31ae69){var _0x489470=function(_0x815bd0){while(--_0x815bd0){_0x56170d['push'](_0x56170d['shift']());}};_0x489470(++_0x31ae69);}(_0xe941,0x66));var _0x1e94=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe941[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x1e94('0x0'));var moment=require('moment');var BPromise=require(_0x1e94('0x1'));var rs=require(_0x1e94('0x2'));var fs=require('fs');var Redis=require(_0x1e94('0x3'));var db=require(_0x1e94('0x4'))['db'];var utils=require(_0x1e94('0x5'));var logger=require(_0x1e94('0x6'))(_0x1e94('0x7'));var config=require(_0x1e94('0x8'));var jayson=require(_0x1e94('0x9'));var client=jayson[_0x1e94('0xa')][_0x1e94('0xb')]({'port':0x232a});config[_0x1e94('0xc')]=_[_0x1e94('0xd')](config[_0x1e94('0xc')],{'host':_0x1e94('0xe'),'port':0x18eb});var socket=require(_0x1e94('0xf'))(new Redis(config[_0x1e94('0xc')]));require(_0x1e94('0x10'))[_0x1e94('0x11')](socket);function respondWithRpcPromise(_0x19cb75,_0x2f4ffe,_0x56af9f){return new BPromise(function(_0x4df57f,_0x324727){return client['request'](_0x19cb75,_0x56af9f)['then'](function(_0xfe2711){logger['info'](_0x1e94('0x12'),_0x2f4ffe,_0x1e94('0x13'));logger[_0x1e94('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2f4ffe,_0x1e94('0x13'),JSON[_0x1e94('0x15')](_0xfe2711));if(_0xfe2711[_0x1e94('0x16')]){if(_0xfe2711[_0x1e94('0x16')][_0x1e94('0x17')]===0x1f4){logger[_0x1e94('0x16')](_0x1e94('0x12'),_0x2f4ffe,_0xfe2711[_0x1e94('0x16')]['message']);return _0x324727(_0xfe2711[_0x1e94('0x16')][_0x1e94('0x18')]);}logger[_0x1e94('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f4ffe,_0xfe2711['error']['message']);return _0x4df57f(_0xfe2711['error']['message']);}else{logger[_0x1e94('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f4ffe,_0x1e94('0x13'));_0x4df57f(_0xfe2711[_0x1e94('0x1a')][_0x1e94('0x18')]);}})[_0x1e94('0x1b')](function(_0x2eeb08){logger[_0x1e94('0x16')](_0x1e94('0x12'),_0x2f4ffe,_0x2eeb08);_0x324727(_0x2eeb08);});});}exports['GetOpenchannelQueue']=function(_0x36b0b9){var _0x401ed6=this;return new Promise(function(_0x2114c0,_0x25307d){return db['OpenchannelQueue']['findAll']({'raw':_0x36b0b9[_0x1e94('0x1c')]?_0x36b0b9[_0x1e94('0x1c')][_0x1e94('0x1d')]===undefined?!![]:![]:!![],'where':_0x36b0b9[_0x1e94('0x1c')]?_0x36b0b9[_0x1e94('0x1c')]['where']||null:null,'attributes':_0x36b0b9[_0x1e94('0x1c')]?_0x36b0b9[_0x1e94('0x1c')][_0x1e94('0x1e')]||null:null,'limit':_0x36b0b9[_0x1e94('0x1c')]?_0x36b0b9[_0x1e94('0x1c')][_0x1e94('0x1f')]||null:null,'include':_0x36b0b9[_0x1e94('0x1c')]?_0x36b0b9[_0x1e94('0x1c')][_0x1e94('0x20')]?_[_0x1e94('0x21')](_0x36b0b9[_0x1e94('0x1c')][_0x1e94('0x20')],function(_0x3251da){return{'model':db[_0x3251da[_0x1e94('0x22')]],'as':_0x3251da['as'],'attributes':_0x3251da[_0x1e94('0x1e')],'include':_0x3251da[_0x1e94('0x20')]?_[_0x1e94('0x21')](_0x3251da[_0x1e94('0x20')],function(_0x47cab8){return{'model':db[_0x47cab8[_0x1e94('0x22')]],'as':_0x47cab8['as'],'attributes':_0x47cab8[_0x1e94('0x1e')],'include':_0x47cab8[_0x1e94('0x20')]?_['map'](_0x47cab8['include'],function(_0x45cae8){return{'model':db[_0x45cae8[_0x1e94('0x22')]],'as':_0x45cae8['as'],'attributes':_0x45cae8[_0x1e94('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e94('0x23')](function(_0x12a108){logger[_0x1e94('0x19')](_0x1e94('0x24'),_0x36b0b9);logger['debug'](_0x1e94('0x24'),_0x36b0b9,JSON[_0x1e94('0x15')](_0x12a108));_0x2114c0(_0x12a108);})[_0x1e94('0x1b')](function(_0xb822ef){logger[_0x1e94('0x16')]('GetOpenchannelQueue',_0xb822ef[_0x1e94('0x18')],_0x36b0b9);_0x25307d(_0x401ed6[_0x1e94('0x16')](0x1f4,_0xb822ef['message']));});});};exports['ShowOpenchannelQueue']=function(_0xae4fd1){var _0xeb6e2f=this;return new Promise(function(_0x337630,_0xe07bd6){return db[_0x1e94('0x25')][_0x1e94('0x26')]({'raw':_0xae4fd1[_0x1e94('0x1c')]?_0xae4fd1[_0x1e94('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xae4fd1['options']?_0xae4fd1['options'][_0x1e94('0x27')]||null:null,'attributes':_0xae4fd1['options']?_0xae4fd1[_0x1e94('0x1c')][_0x1e94('0x1e')]||null:null,'include':_0xae4fd1[_0x1e94('0x1c')]?_0xae4fd1[_0x1e94('0x1c')][_0x1e94('0x20')]?_[_0x1e94('0x21')](_0xae4fd1[_0x1e94('0x1c')][_0x1e94('0x20')],function(_0xbc4b3e){return{'model':db[_0xbc4b3e['model']],'as':_0xbc4b3e['as'],'attributes':_0xbc4b3e[_0x1e94('0x1e')],'include':_0xbc4b3e[_0x1e94('0x20')]?_[_0x1e94('0x21')](_0xbc4b3e[_0x1e94('0x20')],function(_0x275c3a){return{'model':db[_0x275c3a[_0x1e94('0x22')]],'as':_0x275c3a['as'],'attributes':_0x275c3a['attributes'],'include':_0x275c3a['include']?_[_0x1e94('0x21')](_0x275c3a['include'],function(_0x1108e1){return{'model':db[_0x1108e1['model']],'as':_0x1108e1['as'],'attributes':_0x1108e1[_0x1e94('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e94('0x23')](function(_0x2c482a){logger[_0x1e94('0x19')](_0x1e94('0x28'),_0xae4fd1);logger[_0x1e94('0x14')](_0x1e94('0x28'),_0xae4fd1,JSON[_0x1e94('0x15')](_0x2c482a));_0x337630(_0x2c482a);})[_0x1e94('0x1b')](function(_0x569dab){logger['error'](_0x1e94('0x28'),_0x569dab[_0x1e94('0x18')],_0xae4fd1);_0xe07bd6(_0xeb6e2f[_0x1e94('0x16')](0x1f4,_0x569dab[_0x1e94('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a8b3d97..ccd7b7c 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 _0xf8c7=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener'];(function(_0x41a793,_0x49d0e6){var _0x58a429=function(_0x48ec96){while(--_0x48ec96){_0x41a793['push'](_0x41a793['shift']());}};_0x58a429(++_0x49d0e6);}(_0xf8c7,0x72));var _0x7f8c=function(_0x4e2a81,_0x5a48ca){_0x4e2a81=_0x4e2a81-0x0;var _0x386471=_0xf8c7[_0x4e2a81];return _0x386471;};'use strict';var OpenchannelQueueEvents=require(_0x7f8c('0x0'));var events=[_0x7f8c('0x1'),'remove',_0x7f8c('0x2')];function createListener(_0x1f697b,_0x4db02b){return function(_0x2a5e0b){_0x4db02b[_0x7f8c('0x3')](_0x1f697b,_0x2a5e0b);};}function removeListener(_0x445207,_0x1b7fcb){return function(){OpenchannelQueueEvents[_0x7f8c('0x4')](_0x445207,_0x1b7fcb);};}exports['register']=function(_0x3d28af){for(var _0x4fc4a6=0x0,_0x3b3e32=events[_0x7f8c('0x5')];_0x4fc4a6<_0x3b3e32;_0x4fc4a6++){var _0x47f5fe=events[_0x4fc4a6];var _0x22e4d7=createListener(_0x7f8c('0x6')+_0x47f5fe,_0x3d28af);OpenchannelQueueEvents['on'](_0x47f5fe,_0x22e4d7);}}; \ No newline at end of file +var _0x02c6=['save','remove','update','emit','removeListener','length','./openchannelQueue.events'];(function(_0x391cea,_0x46bb62){var _0x169a6a=function(_0x3e9ffb){while(--_0x3e9ffb){_0x391cea['push'](_0x391cea['shift']());}};_0x169a6a(++_0x46bb62);}(_0x02c6,0x1a3));var _0x602c=function(_0x431f27,_0x152cc4){_0x431f27=_0x431f27-0x0;var _0x559a65=_0x02c6[_0x431f27];return _0x559a65;};'use strict';var OpenchannelQueueEvents=require(_0x602c('0x0'));var events=[_0x602c('0x1'),_0x602c('0x2'),_0x602c('0x3')];function createListener(_0x195534,_0x4211fb){return function(_0xfef544){_0x4211fb[_0x602c('0x4')](_0x195534,_0xfef544);};}function removeListener(_0x197528,_0x556898){return function(){OpenchannelQueueEvents[_0x602c('0x5')](_0x197528,_0x556898);};}exports['register']=function(_0x263cd3){for(var _0x9f5d5c=0x0,_0x4b8511=events[_0x602c('0x6')];_0x9f5d5c<_0x4b8511;_0x9f5d5c++){var _0x49b621=events[_0x9f5d5c];var _0x914682=createListener('openchannelQueue:'+_0x49b621,_0x263cd3);OpenchannelQueueEvents['on'](_0x49b621,_0x914682);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 47502d1..2f096f5 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 _0xcea5=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcea5,0x1e6));var _0x5cea=function(_0x269ef0,_0x2c1b3f){_0x269ef0=_0x269ef0-0x0;var _0xf4a624=_0xcea5[_0x269ef0];return _0xf4a624;};'use strict';var multer=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var path=require(_0x5cea('0x2'));var timeout=require('connect-timeout');var express=require(_0x5cea('0x3'));var router=express[_0x5cea('0x4')]();var fs_extra=require(_0x5cea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5cea('0x6'));var config=require(_0x5cea('0x7'));var controller=require(_0x5cea('0x8'));router[_0x5cea('0x9')]('/',auth[_0x5cea('0xa')](),controller[_0x5cea('0xb')]);router[_0x5cea('0x9')](_0x5cea('0xc'),auth[_0x5cea('0xa')](),controller['describe']);router[_0x5cea('0x9')](_0x5cea('0xd'),auth[_0x5cea('0xa')](),controller['show']);router[_0x5cea('0xe')]('/',auth[_0x5cea('0xa')](),controller[_0x5cea('0xf')]);router[_0x5cea('0x10')]('/:id',auth[_0x5cea('0xa')](),controller[_0x5cea('0x11')]);router[_0x5cea('0x12')](_0x5cea('0xd'),auth[_0x5cea('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x76b3=['/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','get'];(function(_0x117fbe,_0x38858d){var _0x1869ba=function(_0x48a2b9){while(--_0x48a2b9){_0x117fbe['push'](_0x117fbe['shift']());}};_0x1869ba(++_0x38858d);}(_0x76b3,0x171));var _0x376b=function(_0x4e1c6f,_0xfbcc97){_0x4e1c6f=_0x4e1c6f-0x0;var _0x32b6a7=_0x76b3[_0x4e1c6f];return _0x32b6a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x376b('0x0'));var timeout=require(_0x376b('0x1'));var express=require(_0x376b('0x2'));var router=express[_0x376b('0x3')]();var fs_extra=require(_0x376b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x376b('0x5'));var config=require('../../config/environment');var controller=require(_0x376b('0x6'));router['get']('/',auth[_0x376b('0x7')](),controller['index']);router[_0x376b('0x8')](_0x376b('0x9'),auth[_0x376b('0x7')](),controller[_0x376b('0xa')]);router[_0x376b('0x8')](_0x376b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x376b('0xc')]('/',auth['isAuthenticated'](),controller[_0x376b('0xd')]);router[_0x376b('0xe')](_0x376b('0xb'),auth['isAuthenticated'](),controller[_0x376b('0xf')]);router[_0x376b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x376b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 2710a62..85af396 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 _0x4af3=['sequelize','exports','DATE','STRING'];(function(_0x4a6156,_0x2b8ce6){var _0x12c1f6=function(_0x533b09){while(--_0x533b09){_0x4a6156['push'](_0x4a6156['shift']());}};_0x12c1f6(++_0x2b8ce6);}(_0x4af3,0x118));var _0x34af=function(_0x35741f,_0x1bfb4f){_0x35741f=_0x35741f-0x0;var _0x2cd2b7=_0x4af3[_0x35741f];return _0x2cd2b7;};'use strict';var moment=require('moment');var Sequelize=require(_0x34af('0x0'));module[_0x34af('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x34af('0x2')]},'acceptAt':{'type':Sequelize[_0x34af('0x2')]},'exitAt':{'type':Sequelize[_0x34af('0x2')]},'reason':{'type':Sequelize[_0x34af('0x3')]}}; \ No newline at end of file +var _0x97da=['DATE','exports','STRING'];(function(_0x8c0d17,_0x63fc33){var _0x2a98bb=function(_0x31cc76){while(--_0x31cc76){_0x8c0d17['push'](_0x8c0d17['shift']());}};_0x2a98bb(++_0x63fc33);}(_0x97da,0x17b));var _0xa97d=function(_0x28ba82,_0x10008d){_0x28ba82=_0x28ba82-0x0;var _0x45a523=_0x97da[_0x28ba82];return _0x45a523;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa97d('0x0')]={'uniqueid':{'type':Sequelize[_0xa97d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa97d('0x2')]},'acceptAt':{'type':Sequelize[_0xa97d('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa97d('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 92bdfd1..dcd9bfb 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 _0x72b8=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','merge','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x489f4e,_0x890cc8){var _0x5d7c48=function(_0x2df3e1){while(--_0x2df3e1){_0x489f4e['push'](_0x489f4e['shift']());}};_0x5d7c48(++_0x890cc8);}(_0x72b8,0xc9));var _0x872b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x72b8[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x872b('0x0'));var rimraf=require(_0x872b('0x1'));var zipdir=require(_0x872b('0x2'));var jsonpatch=require(_0x872b('0x3'));var rp=require(_0x872b('0x4'));var moment=require(_0x872b('0x5'));var BPromise=require(_0x872b('0x6'));var Mustache=require(_0x872b('0x7'));var util=require(_0x872b('0x8'));var path=require('path');var sox=require(_0x872b('0x9'));var csv=require(_0x872b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x872b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x872b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x872b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x872b('0xe'));var Papa=require('papaparse');var Redis=require(_0x872b('0xf'));var authService=require(_0x872b('0x10'));var qs=require(_0x872b('0x11'));var as=require(_0x872b('0x12'));var hardwareService=require(_0x872b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x872b('0x14'));var config=require(_0x872b('0x15'));var licenseUtil=require(_0x872b('0x16'));var db=require(_0x872b('0x17'))['db'];function respondWithStatusCode(_0x3bfa53,_0x40ca62){_0x40ca62=_0x40ca62||0xcc;return function(_0x4fc9f1){if(_0x4fc9f1){return _0x3bfa53[_0x872b('0x18')](_0x40ca62);}return _0x3bfa53['status'](_0x40ca62)[_0x872b('0x19')]();};}function respondWithResult(_0x25bbc5,_0x13c3b2){_0x13c3b2=_0x13c3b2||0xc8;return function(_0x2a49c1){if(_0x2a49c1){return _0x25bbc5[_0x872b('0x1a')](_0x13c3b2)[_0x872b('0x1b')](_0x2a49c1);}};}function respondWithFilteredResult(_0x9ea84e,_0x1feba7){return function(_0x48df83){if(_0x48df83){var _0x517607=typeof _0x1feba7[_0x872b('0x1c')]==='undefined'&&typeof _0x1feba7['limit']===_0x872b('0x1d');var _0x4e6e05=_0x48df83[_0x872b('0x1e')];var _0x21bdd9=_0x517607?0x0:_0x1feba7[_0x872b('0x1c')];var _0x5ec89d=_0x517607?_0x48df83[_0x872b('0x1e')]:_0x1feba7[_0x872b('0x1c')]+_0x1feba7[_0x872b('0x1f')];var _0x5728d2;if(_0x5ec89d>=_0x4e6e05){_0x5ec89d=_0x4e6e05;_0x5728d2=0xc8;}else{_0x5728d2=0xce;}_0x9ea84e[_0x872b('0x1a')](_0x5728d2);return _0x9ea84e[_0x872b('0x20')](_0x872b('0x21'),_0x21bdd9+'-'+_0x5ec89d+'/'+_0x4e6e05)[_0x872b('0x1b')](_0x48df83);}return null;};}function patchUpdates(_0xb227fa){return function(_0x13730e){try{jsonpatch['apply'](_0x13730e,_0xb227fa,!![]);}catch(_0x31a064){return BPromise[_0x872b('0x22')](_0x31a064);}return _0x13730e[_0x872b('0x23')]();};}function saveUpdates(_0x5685e5,_0x20d1e8){return function(_0x19596f){if(_0x19596f){return _0x19596f['update'](_0x5685e5)[_0x872b('0x24')](function(_0x2fbaa9){return _0x2fbaa9;});}return null;};}function removeEntity(_0x4448fb,_0x421faf){return function(_0x1ba03f){if(_0x1ba03f){return _0x1ba03f[_0x872b('0x25')]()[_0x872b('0x24')](function(){_0x4448fb[_0x872b('0x1a')](0xcc)[_0x872b('0x19')]();});}};}function handleEntityNotFound(_0x346c07,_0x181b18){return function(_0x108625){if(!_0x108625){_0x346c07[_0x872b('0x18')](0x194);}return _0x108625;};}function handleError(_0x4943be,_0x4755e8){_0x4755e8=_0x4755e8||0x1f4;return function(_0x3d7478){logger['error'](_0x3d7478[_0x872b('0x26')]);if(_0x3d7478[_0x872b('0x27')]){delete _0x3d7478['name'];}_0x4943be[_0x872b('0x1a')](_0x4755e8)[_0x872b('0x28')](_0x3d7478);};}exports[_0x872b('0x29')]=function(_0x26f7ad,_0x5af8e0){var _0x5d3a1e={},_0x45eee7={},_0x2d4adb={'count':0x0,'rows':[]};var _0x3e76e2=_[_0x872b('0x2a')](db[_0x872b('0x2b')]['rawAttributes'],function(_0x194074){return{'name':_0x194074[_0x872b('0x2c')],'type':_0x194074[_0x872b('0x2d')][_0x872b('0x2e')]};});_0x45eee7[_0x872b('0x2f')]=_[_0x872b('0x2a')](_0x3e76e2,_0x872b('0x27'));_0x45eee7['query']=_[_0x872b('0x30')](_0x26f7ad[_0x872b('0x31')]);_0x45eee7[_0x872b('0x32')]=_['intersection'](_0x45eee7['model'],_0x45eee7[_0x872b('0x31')]);_0x5d3a1e['attributes']=_[_0x872b('0x33')](_0x45eee7[_0x872b('0x2f')],qs[_0x872b('0x34')](_0x26f7ad[_0x872b('0x31')][_0x872b('0x34')]));_0x5d3a1e['attributes']=_0x5d3a1e[_0x872b('0x35')][_0x872b('0x36')]?_0x5d3a1e[_0x872b('0x35')]:_0x45eee7['model'];if(!_0x26f7ad['query'][_0x872b('0x37')](_0x872b('0x38'))){_0x5d3a1e['limit']=qs[_0x872b('0x1f')](_0x26f7ad[_0x872b('0x31')]['limit']);_0x5d3a1e[_0x872b('0x1c')]=qs[_0x872b('0x1c')](_0x26f7ad[_0x872b('0x31')][_0x872b('0x1c')]);}_0x5d3a1e[_0x872b('0x39')]=qs[_0x872b('0x3a')](_0x26f7ad[_0x872b('0x31')][_0x872b('0x3a')]);_0x5d3a1e[_0x872b('0x3b')]=qs[_0x872b('0x32')](_['pick'](_0x26f7ad[_0x872b('0x31')],_0x45eee7[_0x872b('0x32')]),_0x3e76e2);if(_0x26f7ad[_0x872b('0x31')][_0x872b('0x3c')]){_0x5d3a1e[_0x872b('0x3b')]=_['merge'](_0x5d3a1e[_0x872b('0x3b')],{'$or':_[_0x872b('0x2a')](_0x3e76e2,function(_0xe5e96b){if(_0xe5e96b['type']!==_0x872b('0x3d')){var _0x20e48d={};_0x20e48d[_0xe5e96b[_0x872b('0x27')]]={'$like':'%'+_0x26f7ad[_0x872b('0x31')][_0x872b('0x3c')]+'%'};return _0x20e48d;}})});}_0x5d3a1e=_['merge']({},_0x5d3a1e,_0x26f7ad[_0x872b('0x3e')]);var _0x12de68={'where':_0x5d3a1e[_0x872b('0x3b')]};return db[_0x872b('0x2b')][_0x872b('0x1e')](_0x12de68)['then'](function(_0x6cc45){_0x2d4adb[_0x872b('0x1e')]=_0x6cc45;if(_0x26f7ad['query'][_0x872b('0x3f')]){_0x5d3a1e['include']=[{'all':!![]}];}return db[_0x872b('0x2b')][_0x872b('0x40')](_0x5d3a1e);})[_0x872b('0x24')](function(_0x49fe97){_0x2d4adb[_0x872b('0x41')]=_0x49fe97;return _0x2d4adb;})['then'](respondWithFilteredResult(_0x5af8e0,_0x5d3a1e))['catch'](handleError(_0x5af8e0,null));};exports['show']=function(_0x32d9f7,_0x2d89b7){var _0x474f45={'raw':!![],'where':{'id':_0x32d9f7[_0x872b('0x42')]['id']}},_0x4ea346={};_0x4ea346[_0x872b('0x2f')]=_[_0x872b('0x30')](db['OpenchannelQueueReport'][_0x872b('0x43')]);_0x4ea346['query']=_['keys'](_0x32d9f7[_0x872b('0x31')]);_0x4ea346[_0x872b('0x32')]=_['intersection'](_0x4ea346['model'],_0x4ea346[_0x872b('0x31')]);_0x474f45[_0x872b('0x35')]=_[_0x872b('0x33')](_0x4ea346[_0x872b('0x2f')],qs['fields'](_0x32d9f7[_0x872b('0x31')][_0x872b('0x34')]));_0x474f45['attributes']=_0x474f45[_0x872b('0x35')][_0x872b('0x36')]?_0x474f45[_0x872b('0x35')]:_0x4ea346[_0x872b('0x2f')];if(_0x32d9f7['query'][_0x872b('0x3f')]){_0x474f45[_0x872b('0x44')]=[{'all':!![]}];}_0x474f45=_[_0x872b('0x45')]({},_0x474f45,_0x32d9f7[_0x872b('0x3e')]);return db['OpenchannelQueueReport'][_0x872b('0x46')](_0x474f45)[_0x872b('0x24')](handleEntityNotFound(_0x2d89b7,null))[_0x872b('0x24')](respondWithResult(_0x2d89b7,null))[_0x872b('0x47')](handleError(_0x2d89b7,null));};exports[_0x872b('0x48')]=function(_0x28234f,_0x49fa8b){return db[_0x872b('0x2b')][_0x872b('0x48')](_0x28234f[_0x872b('0x49')],{})[_0x872b('0x24')](respondWithResult(_0x49fa8b,0xc9))[_0x872b('0x47')](handleError(_0x49fa8b,null));};exports[_0x872b('0x4a')]=function(_0x33f920,_0x53dec4){if(_0x33f920[_0x872b('0x49')]['id']){delete _0x33f920['body']['id'];}return db[_0x872b('0x2b')]['find']({'where':{'id':_0x33f920[_0x872b('0x42')]['id']}})[_0x872b('0x24')](handleEntityNotFound(_0x53dec4,null))[_0x872b('0x24')](saveUpdates(_0x33f920['body'],null))['then'](respondWithResult(_0x53dec4,null))[_0x872b('0x47')](handleError(_0x53dec4,null));};exports[_0x872b('0x25')]=function(_0x466c24,_0x2066b3){return db['OpenchannelQueueReport'][_0x872b('0x46')]({'where':{'id':_0x466c24[_0x872b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2066b3,null))[_0x872b('0x24')](removeEntity(_0x2066b3,null))[_0x872b('0x47')](handleError(_0x2066b3,null));};exports[_0x872b('0x4b')]=function(_0x1e438b,_0x1707e1){return db[_0x872b('0x2b')]['describe']()[_0x872b('0x24')](respondWithResult(_0x1707e1,null))[_0x872b('0x47')](handleError(_0x1707e1,null));}; \ No newline at end of file +var _0x7a97=['limit','Content-Range','json','apply','save','update','then','sendStatus','error','stack','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','offset','undefined','count'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0x7a97,0x105));var _0x77a9=function(_0x5d9d70,_0x261a49){_0x5d9d70=_0x5d9d70-0x0;var _0x38c7e4=_0x7a97[_0x5d9d70];return _0x38c7e4;};'use strict';var emlformat=require(_0x77a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77a9('0x1'));var jsonpatch=require(_0x77a9('0x2'));var rp=require(_0x77a9('0x3'));var moment=require(_0x77a9('0x4'));var BPromise=require(_0x77a9('0x5'));var Mustache=require(_0x77a9('0x6'));var util=require(_0x77a9('0x7'));var path=require(_0x77a9('0x8'));var sox=require(_0x77a9('0x9'));var csv=require(_0x77a9('0xa'));var ejs=require(_0x77a9('0xb'));var fs=require('fs');var fs_extra=require(_0x77a9('0xc'));var _=require(_0x77a9('0xd'));var squel=require('squel');var crypto=require(_0x77a9('0xe'));var jsforce=require(_0x77a9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x77a9('0xa'));var querystring=require('querystring');var Papa=require(_0x77a9('0x10'));var Redis=require('ioredis');var authService=require(_0x77a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x77a9('0x12'));var hardwareService=require(_0x77a9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x77a9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x77a9('0x15'))['db'];function respondWithStatusCode(_0x28bb63,_0x3117be){_0x3117be=_0x3117be||0xcc;return function(_0x341fa0){if(_0x341fa0){return _0x28bb63['sendStatus'](_0x3117be);}return _0x28bb63[_0x77a9('0x16')](_0x3117be)[_0x77a9('0x17')]();};}function respondWithResult(_0x2024a9,_0x7d53bc){_0x7d53bc=_0x7d53bc||0xc8;return function(_0x4e4dd6){if(_0x4e4dd6){return _0x2024a9[_0x77a9('0x16')](_0x7d53bc)['json'](_0x4e4dd6);}};}function respondWithFilteredResult(_0x33ff27,_0x1b0847){return function(_0x270f81){if(_0x270f81){var _0xf67c1d=typeof _0x1b0847[_0x77a9('0x18')]===_0x77a9('0x19')&&typeof _0x1b0847['limit']===_0x77a9('0x19');var _0x37670c=_0x270f81[_0x77a9('0x1a')];var _0x473151=_0xf67c1d?0x0:_0x1b0847['offset'];var _0x2bb3ca=_0xf67c1d?_0x270f81['count']:_0x1b0847[_0x77a9('0x18')]+_0x1b0847[_0x77a9('0x1b')];var _0x4d8bbd;if(_0x2bb3ca>=_0x37670c){_0x2bb3ca=_0x37670c;_0x4d8bbd=0xc8;}else{_0x4d8bbd=0xce;}_0x33ff27['status'](_0x4d8bbd);return _0x33ff27['set'](_0x77a9('0x1c'),_0x473151+'-'+_0x2bb3ca+'/'+_0x37670c)[_0x77a9('0x1d')](_0x270f81);}return null;};}function patchUpdates(_0x5e247c){return function(_0x5dd26e){try{jsonpatch[_0x77a9('0x1e')](_0x5dd26e,_0x5e247c,!![]);}catch(_0x21ea5e){return BPromise['reject'](_0x21ea5e);}return _0x5dd26e[_0x77a9('0x1f')]();};}function saveUpdates(_0x29cd4b,_0x3997cc){return function(_0x55a601){if(_0x55a601){return _0x55a601[_0x77a9('0x20')](_0x29cd4b)[_0x77a9('0x21')](function(_0x452d02){return _0x452d02;});}return null;};}function removeEntity(_0x543931,_0xc12f58){return function(_0x5ffac0){if(_0x5ffac0){return _0x5ffac0['destroy']()['then'](function(){_0x543931[_0x77a9('0x16')](0xcc)[_0x77a9('0x17')]();});}};}function handleEntityNotFound(_0x4c2858,_0x212f63){return function(_0x1b9d4d){if(!_0x1b9d4d){_0x4c2858[_0x77a9('0x22')](0x194);}return _0x1b9d4d;};}function handleError(_0x3ce61c,_0x466ebc){_0x466ebc=_0x466ebc||0x1f4;return function(_0x418541){logger[_0x77a9('0x23')](_0x418541[_0x77a9('0x24')]);if(_0x418541['name']){delete _0x418541['name'];}_0x3ce61c[_0x77a9('0x16')](_0x466ebc)[_0x77a9('0x25')](_0x418541);};}exports['index']=function(_0x509360,_0x20218c){var _0x3fc8fa={},_0x5237dc={},_0x3d8201={'count':0x0,'rows':[]};var _0x91a7a6=_[_0x77a9('0x26')](db[_0x77a9('0x27')][_0x77a9('0x28')],function(_0x2b5ef3){return{'name':_0x2b5ef3[_0x77a9('0x29')],'type':_0x2b5ef3['type'][_0x77a9('0x2a')]};});_0x5237dc[_0x77a9('0x2b')]=_[_0x77a9('0x26')](_0x91a7a6,_0x77a9('0x2c'));_0x5237dc[_0x77a9('0x2d')]=_[_0x77a9('0x2e')](_0x509360[_0x77a9('0x2d')]);_0x5237dc[_0x77a9('0x2f')]=_[_0x77a9('0x30')](_0x5237dc[_0x77a9('0x2b')],_0x5237dc[_0x77a9('0x2d')]);_0x3fc8fa[_0x77a9('0x31')]=_['intersection'](_0x5237dc[_0x77a9('0x2b')],qs['fields'](_0x509360[_0x77a9('0x2d')][_0x77a9('0x32')]));_0x3fc8fa['attributes']=_0x3fc8fa[_0x77a9('0x31')][_0x77a9('0x33')]?_0x3fc8fa['attributes']:_0x5237dc[_0x77a9('0x2b')];if(!_0x509360[_0x77a9('0x2d')][_0x77a9('0x34')]('nolimit')){_0x3fc8fa['limit']=qs[_0x77a9('0x1b')](_0x509360[_0x77a9('0x2d')][_0x77a9('0x1b')]);_0x3fc8fa[_0x77a9('0x18')]=qs['offset'](_0x509360[_0x77a9('0x2d')][_0x77a9('0x18')]);}_0x3fc8fa[_0x77a9('0x35')]=qs['sort'](_0x509360[_0x77a9('0x2d')][_0x77a9('0x36')]);_0x3fc8fa[_0x77a9('0x37')]=qs[_0x77a9('0x2f')](_[_0x77a9('0x38')](_0x509360[_0x77a9('0x2d')],_0x5237dc[_0x77a9('0x2f')]),_0x91a7a6);if(_0x509360['query']['filter']){_0x3fc8fa[_0x77a9('0x37')]=_[_0x77a9('0x39')](_0x3fc8fa[_0x77a9('0x37')],{'$or':_[_0x77a9('0x26')](_0x91a7a6,function(_0x2c0f26){if(_0x2c0f26['type']!=='VIRTUAL'){var _0x3c9743={};_0x3c9743[_0x2c0f26[_0x77a9('0x2c')]]={'$like':'%'+_0x509360[_0x77a9('0x2d')][_0x77a9('0x3a')]+'%'};return _0x3c9743;}})});}_0x3fc8fa=_['merge']({},_0x3fc8fa,_0x509360[_0x77a9('0x3b')]);var _0x3f5764={'where':_0x3fc8fa[_0x77a9('0x37')]};return db[_0x77a9('0x27')][_0x77a9('0x1a')](_0x3f5764)[_0x77a9('0x21')](function(_0x5b64e1){_0x3d8201[_0x77a9('0x1a')]=_0x5b64e1;if(_0x509360['query'][_0x77a9('0x3c')]){_0x3fc8fa[_0x77a9('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x77a9('0x3e')](_0x3fc8fa);})[_0x77a9('0x21')](function(_0x684e40){_0x3d8201[_0x77a9('0x3f')]=_0x684e40;return _0x3d8201;})[_0x77a9('0x21')](respondWithFilteredResult(_0x20218c,_0x3fc8fa))[_0x77a9('0x40')](handleError(_0x20218c,null));};exports[_0x77a9('0x41')]=function(_0x37fc99,_0x53a501){var _0x771cb2={'raw':!![],'where':{'id':_0x37fc99[_0x77a9('0x42')]['id']}},_0x398457={};_0x398457[_0x77a9('0x2b')]=_['keys'](db['OpenchannelQueueReport'][_0x77a9('0x28')]);_0x398457[_0x77a9('0x2d')]=_['keys'](_0x37fc99[_0x77a9('0x2d')]);_0x398457['filters']=_[_0x77a9('0x30')](_0x398457[_0x77a9('0x2b')],_0x398457[_0x77a9('0x2d')]);_0x771cb2[_0x77a9('0x31')]=_[_0x77a9('0x30')](_0x398457[_0x77a9('0x2b')],qs[_0x77a9('0x32')](_0x37fc99['query'][_0x77a9('0x32')]));_0x771cb2[_0x77a9('0x31')]=_0x771cb2[_0x77a9('0x31')][_0x77a9('0x33')]?_0x771cb2[_0x77a9('0x31')]:_0x398457['model'];if(_0x37fc99[_0x77a9('0x2d')]['includeAll']){_0x771cb2[_0x77a9('0x3d')]=[{'all':!![]}];}_0x771cb2=_['merge']({},_0x771cb2,_0x37fc99[_0x77a9('0x3b')]);return db[_0x77a9('0x27')]['find'](_0x771cb2)[_0x77a9('0x21')](handleEntityNotFound(_0x53a501,null))[_0x77a9('0x21')](respondWithResult(_0x53a501,null))[_0x77a9('0x40')](handleError(_0x53a501,null));};exports[_0x77a9('0x43')]=function(_0x5b3bdb,_0x5bf32a){return db[_0x77a9('0x27')]['create'](_0x5b3bdb[_0x77a9('0x44')],{})['then'](respondWithResult(_0x5bf32a,0xc9))[_0x77a9('0x40')](handleError(_0x5bf32a,null));};exports[_0x77a9('0x20')]=function(_0x185551,_0x2ed1e6){if(_0x185551[_0x77a9('0x44')]['id']){delete _0x185551[_0x77a9('0x44')]['id'];}return db[_0x77a9('0x27')]['find']({'where':{'id':_0x185551[_0x77a9('0x42')]['id']}})[_0x77a9('0x21')](handleEntityNotFound(_0x2ed1e6,null))['then'](saveUpdates(_0x185551['body'],null))[_0x77a9('0x21')](respondWithResult(_0x2ed1e6,null))['catch'](handleError(_0x2ed1e6,null));};exports[_0x77a9('0x45')]=function(_0x19bac2,_0x3eeaa0){return db[_0x77a9('0x27')][_0x77a9('0x46')]({'where':{'id':_0x19bac2[_0x77a9('0x42')]['id']}})[_0x77a9('0x21')](handleEntityNotFound(_0x3eeaa0,null))[_0x77a9('0x21')](removeEntity(_0x3eeaa0,null))[_0x77a9('0x40')](handleError(_0x3eeaa0,null));};exports[_0x77a9('0x47')]=function(_0x534dd6,_0x576ee8){return db[_0x77a9('0x27')]['describe']()[_0x77a9('0x21')](respondWithResult(_0x576ee8,null))['catch'](handleError(_0x576ee8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1a202d2..cab77e0 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x4b9cfd,_0x5170c2){var _0xa953fd=function(_0x43fce6){while(--_0x43fce6){_0x4b9cfd['push'](_0x4b9cfd['shift']());}};_0xa953fd(++_0x5170c2);}(_0xe14b,0x93));var _0xbe14=function(_0x2dc557,_0x29503d){_0x2dc557=_0x2dc557-0x0;var _0x4d5bb2=_0xe14b[_0x2dc557];return _0x4d5bb2;};'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 +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x814b,0x1a2));var _0xb814=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x814b[_0x38080e];return _0x4e4c87;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5efedaf..84d201d 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 _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x14a0,0x8e));var _0x014a=function(_0x230c48,_0x509d75){_0x230c48=_0x230c48-0x0;var _0x3e41e9=_0x14a0[_0x230c48];return _0x3e41e9;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x9d5b=['message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','limit','info','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b6e66,_0x16d840){var _0x5c3326=function(_0x39eac1){while(--_0x39eac1){_0x2b6e66['push'](_0x2b6e66['shift']());}};_0x5c3326(++_0x16d840);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x264161,_0x12de7e){_0x264161=_0x264161-0x0;var _0x2af979=_0x9d5b[_0x264161];return _0x2af979;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5144c7,_0x1ddb78,_0x35cf2){return new BPromise(function(_0x4dc4be,_0x2d3f66){return client[_0xb9d5('0xb')](_0x5144c7,_0x35cf2)[_0xb9d5('0xc')](function(_0x94e766){logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));logger['debug'](_0xb9d5('0xf'),_0x1ddb78,_0xb9d5('0xe'),JSON[_0xb9d5('0x10')](_0x94e766));if(_0x94e766[_0xb9d5('0x11')]){if(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x12')]===0x1f4){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);return _0x2d3f66(_0x94e766[_0xb9d5('0x11')]['message']);}logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766['error'][_0xb9d5('0x13')]);return _0x4dc4be(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);}else{logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));_0x4dc4be(_0x94e766[_0xb9d5('0x14')][_0xb9d5('0x13')]);}})[_0xb9d5('0x15')](function(_0x321a77){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x321a77);_0x2d3f66(_0x321a77);});});}exports[_0xb9d5('0x16')]=function(_0x436002){var _0x248cb3=this;return new Promise(function(_0xf2c261,_0x2f8df6){return db[_0xb9d5('0x17')]['create'](_0x436002[_0xb9d5('0x18')],{'raw':_0x436002[_0xb9d5('0x19')]?_0x436002[_0xb9d5('0x19')][_0xb9d5('0x1a')]===undefined?!![]:![]:!![]})[_0xb9d5('0xc')](function(_0x457d69){logger['info'](_0xb9d5('0x16'),_0x436002);logger['debug'](_0xb9d5('0x16'),_0x436002,JSON[_0xb9d5('0x10')](_0x457d69));_0xf2c261(_0x457d69);})[_0xb9d5('0x15')](function(_0x13fc35){logger[_0xb9d5('0x11')](_0xb9d5('0x16'),_0x13fc35[_0xb9d5('0x13')],_0x436002);_0x2f8df6(_0x248cb3[_0xb9d5('0x11')](0x1f4,_0x13fc35['message']));});});};exports[_0xb9d5('0x1b')]=function(_0x30b06f){var _0x5508c6=this;return new Promise(function(_0x1c0b89,_0x25ebf2){return db[_0xb9d5('0x17')]['update'](_0x30b06f[_0xb9d5('0x18')],{'raw':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')][_0xb9d5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')][_0xb9d5('0x1c')]||null:null,'attributes':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')]['attributes']||null:null,'limit':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f['options'][_0xb9d5('0x1d')]||null:null})[_0xb9d5('0xc')](function(_0x1de8e6){logger[_0xb9d5('0x1e')](_0xb9d5('0x1b'),_0x30b06f);logger[_0xb9d5('0x1f')](_0xb9d5('0x1b'),_0x30b06f,JSON[_0xb9d5('0x10')](_0x1de8e6));_0x1c0b89(_0x1de8e6);})[_0xb9d5('0x15')](function(_0x385701){logger[_0xb9d5('0x11')](_0xb9d5('0x1b'),_0x385701[_0xb9d5('0x13')],_0x30b06f);_0x25ebf2(_0x5508c6[_0xb9d5('0x11')](0x1f4,_0x385701[_0xb9d5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0539cd5..0ef4fd5 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 _0x94f2=['connect-timeout','express','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94f2,0xed));var _0x294f=function(_0x17bcf4,_0x1b1b3e){_0x17bcf4=_0x17bcf4-0x0;var _0x31ce83=_0x94f2[_0x17bcf4];return _0x31ce83;};'use strict';var multer=require(_0x294f('0x0'));var util=require(_0x294f('0x1'));var path=require(_0x294f('0x2'));var timeout=require(_0x294f('0x3'));var express=require(_0x294f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x294f('0x5'));var config=require('../../config/environment');var controller=require(_0x294f('0x6'));router[_0x294f('0x7')]('/',auth[_0x294f('0x8')](),controller[_0x294f('0x9')]);router[_0x294f('0x7')](_0x294f('0xa'),auth['isAuthenticated'](),controller[_0x294f('0xb')]);router[_0x294f('0x7')]('/:id',auth[_0x294f('0x8')](),controller[_0x294f('0xc')]);router[_0x294f('0xd')]('/',auth[_0x294f('0x8')](),controller[_0x294f('0xe')]);router[_0x294f('0xf')](_0x294f('0x10'),auth[_0x294f('0x8')](),controller[_0x294f('0x11')]);router['delete']('/:id',auth[_0x294f('0x8')](),controller[_0x294f('0x12')]);module[_0x294f('0x13')]=router; \ No newline at end of file +var _0x5b48=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xbc4cd,_0x513d6c){var _0x5c2531=function(_0x39044a){while(--_0x39044a){_0xbc4cd['push'](_0xbc4cd['shift']());}};_0x5c2531(++_0x513d6c);}(_0x5b48,0x78));var _0x85b4=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0x5b48[_0x1c1509];return _0xf11b7;};'use strict';var multer=require(_0x85b4('0x0'));var util=require(_0x85b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85b4('0x2')]();var fs_extra=require(_0x85b4('0x3'));var auth=require(_0x85b4('0x4'));var interaction=require(_0x85b4('0x5'));var config=require(_0x85b4('0x6'));var controller=require(_0x85b4('0x7'));router[_0x85b4('0x8')]('/',auth[_0x85b4('0x9')](),controller[_0x85b4('0xa')]);router[_0x85b4('0x8')](_0x85b4('0xb'),auth[_0x85b4('0x9')](),controller[_0x85b4('0xc')]);router[_0x85b4('0x8')](_0x85b4('0xd'),auth[_0x85b4('0x9')](),controller[_0x85b4('0xe')]);router[_0x85b4('0xf')]('/',auth[_0x85b4('0x9')](),controller[_0x85b4('0x10')]);router[_0x85b4('0x11')](_0x85b4('0xd'),auth[_0x85b4('0x9')](),controller[_0x85b4('0x12')]);router[_0x85b4('0x13')](_0x85b4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x85b4('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c853847..792f4ad 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3dfdd5,_0x33ea06){var _0x279a48=function(_0x1d78bb){while(--_0x1d78bb){_0x3dfdd5['push'](_0x3dfdd5['shift']());}};_0x279a48(++_0x33ea06);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0xcb91[_0x210603];return _0x1bcb7d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x54c984,_0x5052e3){var _0x4c8d1c=function(_0x54828e){while(--_0x54828e){_0x54c984['push'](_0x54c984['shift']());}};_0x4c8d1c(++_0x5052e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 aa3d0da..cc3ce08 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 _0xfd06=['then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update'];(function(_0x48e9dc,_0x24310d){var _0x1afe7e=function(_0x3baf4a){while(--_0x3baf4a){_0x48e9dc['push'](_0x48e9dc['shift']());}};_0x1afe7e(++_0x24310d);}(_0xfd06,0x15a));var _0x6fd0=function(_0x508c11,_0x308545){_0x508c11=_0x508c11-0x0;var _0x438f65=_0xfd06[_0x508c11];return _0x438f65;};'use strict';var emlformat=require(_0x6fd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fd0('0x2'));var moment=require('moment');var BPromise=require(_0x6fd0('0x3'));var Mustache=require(_0x6fd0('0x4'));var util=require(_0x6fd0('0x5'));var path=require(_0x6fd0('0x6'));var sox=require(_0x6fd0('0x7'));var csv=require(_0x6fd0('0x8'));var ejs=require(_0x6fd0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fd0('0xa'));var squel=require(_0x6fd0('0xb'));var crypto=require(_0x6fd0('0xc'));var jsforce=require(_0x6fd0('0xd'));var deskjs=require(_0x6fd0('0xe'));var toCsv=require(_0x6fd0('0x8'));var querystring=require(_0x6fd0('0xf'));var Papa=require(_0x6fd0('0x10'));var Redis=require(_0x6fd0('0x11'));var authService=require(_0x6fd0('0x12'));var qs=require(_0x6fd0('0x13'));var as=require(_0x6fd0('0x14'));var hardwareService=require(_0x6fd0('0x15'));var logger=require(_0x6fd0('0x16'))(_0x6fd0('0x17'));var utils=require(_0x6fd0('0x18'));var config=require(_0x6fd0('0x19'));var licenseUtil=require(_0x6fd0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a517c,_0xb9fa7c){_0xb9fa7c=_0xb9fa7c||0xcc;return function(_0x55c068){if(_0x55c068){return _0x4a517c[_0x6fd0('0x1b')](_0xb9fa7c);}return _0x4a517c['status'](_0xb9fa7c)[_0x6fd0('0x1c')]();};}function respondWithResult(_0x5f49d0,_0x3a5cd1){_0x3a5cd1=_0x3a5cd1||0xc8;return function(_0x4c326e){if(_0x4c326e){return _0x5f49d0[_0x6fd0('0x1d')](_0x3a5cd1)[_0x6fd0('0x1e')](_0x4c326e);}};}function respondWithFilteredResult(_0x5d0b73,_0x2e1664){return function(_0x41024a){if(_0x41024a){var _0x2ebb86=typeof _0x2e1664[_0x6fd0('0x1f')]==='undefined'&&typeof _0x2e1664[_0x6fd0('0x20')]===_0x6fd0('0x21');var _0x5eeb08=_0x41024a['count'];var _0x564b2b=_0x2ebb86?0x0:_0x2e1664[_0x6fd0('0x1f')];var _0x15b448=_0x2ebb86?_0x41024a[_0x6fd0('0x22')]:_0x2e1664[_0x6fd0('0x1f')]+_0x2e1664['limit'];var _0x395c0e;if(_0x15b448>=_0x5eeb08){_0x15b448=_0x5eeb08;_0x395c0e=0xc8;}else{_0x395c0e=0xce;}_0x5d0b73[_0x6fd0('0x1d')](_0x395c0e);return _0x5d0b73['set'](_0x6fd0('0x23'),_0x564b2b+'-'+_0x15b448+'/'+_0x5eeb08)[_0x6fd0('0x1e')](_0x41024a);}return null;};}function patchUpdates(_0x1597ab){return function(_0x3e5576){try{jsonpatch[_0x6fd0('0x24')](_0x3e5576,_0x1597ab,!![]);}catch(_0x4699ef){return BPromise['reject'](_0x4699ef);}return _0x3e5576[_0x6fd0('0x25')]();};}function saveUpdates(_0x6bd12b,_0x5143d3){return function(_0x5cbd6a){if(_0x5cbd6a){return _0x5cbd6a[_0x6fd0('0x26')](_0x6bd12b)[_0x6fd0('0x27')](function(_0xf922cd){return _0xf922cd;});}return null;};}function removeEntity(_0x223e3a,_0x59a043){return function(_0x154cd3){if(_0x154cd3){return _0x154cd3[_0x6fd0('0x28')]()[_0x6fd0('0x27')](function(){_0x223e3a[_0x6fd0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48cbeb,_0x40736e){return function(_0x2fb1c7){if(!_0x2fb1c7){_0x48cbeb['sendStatus'](0x194);}return _0x2fb1c7;};}function handleError(_0x5adbec,_0x1d937a){_0x1d937a=_0x1d937a||0x1f4;return function(_0x3f854b){logger[_0x6fd0('0x29')](_0x3f854b[_0x6fd0('0x2a')]);if(_0x3f854b[_0x6fd0('0x2b')]){delete _0x3f854b[_0x6fd0('0x2b')];}_0x5adbec[_0x6fd0('0x1d')](_0x1d937a)['send'](_0x3f854b);};}exports[_0x6fd0('0x2c')]=function(_0x54de36,_0x24f97f){var _0x2d442e={},_0x25c4b7={},_0x33e966={'count':0x0,'rows':[]};var _0x3456fd=_[_0x6fd0('0x2d')](db[_0x6fd0('0x2e')][_0x6fd0('0x2f')],function(_0x52f9d0){return{'name':_0x52f9d0[_0x6fd0('0x30')],'type':_0x52f9d0[_0x6fd0('0x31')]['key']};});_0x25c4b7[_0x6fd0('0x32')]=_[_0x6fd0('0x2d')](_0x3456fd,_0x6fd0('0x2b'));_0x25c4b7['query']=_[_0x6fd0('0x33')](_0x54de36[_0x6fd0('0x34')]);_0x25c4b7['filters']=_[_0x6fd0('0x35')](_0x25c4b7[_0x6fd0('0x32')],_0x25c4b7[_0x6fd0('0x34')]);_0x2d442e[_0x6fd0('0x36')]=_['intersection'](_0x25c4b7[_0x6fd0('0x32')],qs['fields'](_0x54de36['query']['fields']));_0x2d442e['attributes']=_0x2d442e[_0x6fd0('0x36')]['length']?_0x2d442e[_0x6fd0('0x36')]:_0x25c4b7[_0x6fd0('0x32')];if(!_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x37')](_0x6fd0('0x38'))){_0x2d442e[_0x6fd0('0x20')]=qs[_0x6fd0('0x20')](_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x20')]);_0x2d442e[_0x6fd0('0x1f')]=qs[_0x6fd0('0x1f')](_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x1f')]);}_0x2d442e[_0x6fd0('0x39')]=qs[_0x6fd0('0x3a')](_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x3a')]);_0x2d442e[_0x6fd0('0x3b')]=qs[_0x6fd0('0x3c')](_[_0x6fd0('0x3d')](_0x54de36[_0x6fd0('0x34')],_0x25c4b7['filters']),_0x3456fd);if(_0x54de36['query'][_0x6fd0('0x3e')]){_0x2d442e['where']=_[_0x6fd0('0x3f')](_0x2d442e[_0x6fd0('0x3b')],{'$or':_[_0x6fd0('0x2d')](_0x3456fd,function(_0x1ac12a){if(_0x1ac12a[_0x6fd0('0x31')]!=='VIRTUAL'){var _0x55662b={};_0x55662b[_0x1ac12a['name']]={'$like':'%'+_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x3e')]+'%'};return _0x55662b;}})});}_0x2d442e=_[_0x6fd0('0x3f')]({},_0x2d442e,_0x54de36[_0x6fd0('0x40')]);var _0x55d75e={'where':_0x2d442e[_0x6fd0('0x3b')]};return db[_0x6fd0('0x2e')]['count'](_0x55d75e)['then'](function(_0x3478bd){_0x33e966[_0x6fd0('0x22')]=_0x3478bd;if(_0x54de36[_0x6fd0('0x34')][_0x6fd0('0x41')]){_0x2d442e[_0x6fd0('0x42')]=[{'all':!![]}];}return db[_0x6fd0('0x2e')][_0x6fd0('0x43')](_0x2d442e);})['then'](function(_0x56af78){_0x33e966[_0x6fd0('0x44')]=_0x56af78;return _0x33e966;})['then'](respondWithFilteredResult(_0x24f97f,_0x2d442e))['catch'](handleError(_0x24f97f,null));};exports[_0x6fd0('0x45')]=function(_0x285c03,_0x21914f){var _0x492f62={'raw':!![],'where':{'id':_0x285c03[_0x6fd0('0x46')]['id']}},_0x41b0a9={};_0x41b0a9['model']=_[_0x6fd0('0x33')](db['OpenchannelTransferReport'][_0x6fd0('0x2f')]);_0x41b0a9[_0x6fd0('0x34')]=_[_0x6fd0('0x33')](_0x285c03[_0x6fd0('0x34')]);_0x41b0a9[_0x6fd0('0x3c')]=_[_0x6fd0('0x35')](_0x41b0a9['model'],_0x41b0a9[_0x6fd0('0x34')]);_0x492f62[_0x6fd0('0x36')]=_['intersection'](_0x41b0a9[_0x6fd0('0x32')],qs[_0x6fd0('0x47')](_0x285c03['query']['fields']));_0x492f62['attributes']=_0x492f62[_0x6fd0('0x36')]['length']?_0x492f62[_0x6fd0('0x36')]:_0x41b0a9[_0x6fd0('0x32')];if(_0x285c03[_0x6fd0('0x34')][_0x6fd0('0x41')]){_0x492f62[_0x6fd0('0x42')]=[{'all':!![]}];}_0x492f62=_[_0x6fd0('0x3f')]({},_0x492f62,_0x285c03['options']);return db[_0x6fd0('0x2e')]['find'](_0x492f62)[_0x6fd0('0x27')](handleEntityNotFound(_0x21914f,null))[_0x6fd0('0x27')](respondWithResult(_0x21914f,null))[_0x6fd0('0x48')](handleError(_0x21914f,null));};exports[_0x6fd0('0x49')]=function(_0x39c055,_0x2aa52f){return db[_0x6fd0('0x2e')][_0x6fd0('0x49')](_0x39c055[_0x6fd0('0x4a')],{})['then'](respondWithResult(_0x2aa52f,0xc9))[_0x6fd0('0x48')](handleError(_0x2aa52f,null));};exports[_0x6fd0('0x26')]=function(_0x4edaf5,_0x375de5){if(_0x4edaf5[_0x6fd0('0x4a')]['id']){delete _0x4edaf5[_0x6fd0('0x4a')]['id'];}return db[_0x6fd0('0x2e')][_0x6fd0('0x4b')]({'where':{'id':_0x4edaf5[_0x6fd0('0x46')]['id']}})[_0x6fd0('0x27')](handleEntityNotFound(_0x375de5,null))[_0x6fd0('0x27')](saveUpdates(_0x4edaf5[_0x6fd0('0x4a')],null))[_0x6fd0('0x27')](respondWithResult(_0x375de5,null))[_0x6fd0('0x48')](handleError(_0x375de5,null));};exports['destroy']=function(_0x4ed6fd,_0x13c433){return db[_0x6fd0('0x2e')][_0x6fd0('0x4b')]({'where':{'id':_0x4ed6fd[_0x6fd0('0x46')]['id']}})['then'](handleEntityNotFound(_0x13c433,null))[_0x6fd0('0x27')](removeEntity(_0x13c433,null))['catch'](handleError(_0x13c433,null));};exports[_0x6fd0('0x4c')]=function(_0xc80123,_0x2c2d18){return db[_0x6fd0('0x2e')][_0x6fd0('0x4c')]()[_0x6fd0('0x27')](respondWithResult(_0x2c2d18,null))[_0x6fd0('0x48')](handleError(_0x2c2d18,null));}; \ No newline at end of file +var _0xb785=['query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields'];(function(_0x592f31,_0x142a36){var _0x426606=function(_0x4140c0){while(--_0x4140c0){_0x592f31['push'](_0x592f31['shift']());}};_0x426606(++_0x142a36);}(_0xb785,0x1df));var _0x5b78=function(_0x243a5f,_0x3257d5){_0x243a5f=_0x243a5f-0x0;var _0xb30ff6=_0xb785[_0x243a5f];return _0xb30ff6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b78('0x0'));var rp=require('request-promise');var moment=require(_0x5b78('0x1'));var BPromise=require(_0x5b78('0x2'));var Mustache=require(_0x5b78('0x3'));var util=require('util');var path=require(_0x5b78('0x4'));var sox=require(_0x5b78('0x5'));var csv=require(_0x5b78('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b78('0x7'));var _=require('lodash');var squel=require(_0x5b78('0x8'));var crypto=require(_0x5b78('0x9'));var jsforce=require(_0x5b78('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5b78('0x6'));var querystring=require(_0x5b78('0xb'));var Papa=require(_0x5b78('0xc'));var Redis=require('ioredis');var authService=require(_0x5b78('0xd'));var qs=require(_0x5b78('0xe'));var as=require(_0x5b78('0xf'));var hardwareService=require(_0x5b78('0x10'));var logger=require(_0x5b78('0x11'))(_0x5b78('0x12'));var utils=require('../../config/utils');var config=require(_0x5b78('0x13'));var licenseUtil=require(_0x5b78('0x14'));var db=require(_0x5b78('0x15'))['db'];function respondWithStatusCode(_0x2e614a,_0x43bbbe){_0x43bbbe=_0x43bbbe||0xcc;return function(_0x57cd4c){if(_0x57cd4c){return _0x2e614a[_0x5b78('0x16')](_0x43bbbe);}return _0x2e614a[_0x5b78('0x17')](_0x43bbbe)[_0x5b78('0x18')]();};}function respondWithResult(_0x5e044b,_0x2bee15){_0x2bee15=_0x2bee15||0xc8;return function(_0x5f2d03){if(_0x5f2d03){return _0x5e044b['status'](_0x2bee15)['json'](_0x5f2d03);}};}function respondWithFilteredResult(_0x35dd57,_0x228b60){return function(_0x5e83f9){if(_0x5e83f9){var _0x57b4bf=typeof _0x228b60['offset']===_0x5b78('0x19')&&typeof _0x228b60[_0x5b78('0x1a')]===_0x5b78('0x19');var _0x24059a=_0x5e83f9[_0x5b78('0x1b')];var _0x2afa5e=_0x57b4bf?0x0:_0x228b60['offset'];var _0x16d1dd=_0x57b4bf?_0x5e83f9[_0x5b78('0x1b')]:_0x228b60[_0x5b78('0x1c')]+_0x228b60[_0x5b78('0x1a')];var _0x59a425;if(_0x16d1dd>=_0x24059a){_0x16d1dd=_0x24059a;_0x59a425=0xc8;}else{_0x59a425=0xce;}_0x35dd57[_0x5b78('0x17')](_0x59a425);return _0x35dd57[_0x5b78('0x1d')](_0x5b78('0x1e'),_0x2afa5e+'-'+_0x16d1dd+'/'+_0x24059a)['json'](_0x5e83f9);}return null;};}function patchUpdates(_0x11cb80){return function(_0x246b12){try{jsonpatch[_0x5b78('0x1f')](_0x246b12,_0x11cb80,!![]);}catch(_0x2862a0){return BPromise[_0x5b78('0x20')](_0x2862a0);}return _0x246b12[_0x5b78('0x21')]();};}function saveUpdates(_0x3cea52,_0xbc5c77){return function(_0x575964){if(_0x575964){return _0x575964[_0x5b78('0x22')](_0x3cea52)[_0x5b78('0x23')](function(_0x42a2b2){return _0x42a2b2;});}return null;};}function removeEntity(_0x174c06,_0x3ff7e){return function(_0x188368){if(_0x188368){return _0x188368[_0x5b78('0x24')]()[_0x5b78('0x23')](function(){_0x174c06[_0x5b78('0x17')](0xcc)[_0x5b78('0x18')]();});}};}function handleEntityNotFound(_0x46b61d,_0x5231e2){return function(_0x572b38){if(!_0x572b38){_0x46b61d[_0x5b78('0x16')](0x194);}return _0x572b38;};}function handleError(_0x18a62a,_0x5e9b18){_0x5e9b18=_0x5e9b18||0x1f4;return function(_0x4e9d5c){logger[_0x5b78('0x25')](_0x4e9d5c[_0x5b78('0x26')]);if(_0x4e9d5c['name']){delete _0x4e9d5c[_0x5b78('0x27')];}_0x18a62a[_0x5b78('0x17')](_0x5e9b18)[_0x5b78('0x28')](_0x4e9d5c);};}exports[_0x5b78('0x29')]=function(_0x162817,_0x4aa37b){var _0x263d7d={},_0x3cae7d={},_0x465a13={'count':0x0,'rows':[]};var _0x280e74=_[_0x5b78('0x2a')](db[_0x5b78('0x2b')][_0x5b78('0x2c')],function(_0xb5f7df){return{'name':_0xb5f7df['fieldName'],'type':_0xb5f7df[_0x5b78('0x2d')][_0x5b78('0x2e')]};});_0x3cae7d[_0x5b78('0x2f')]=_[_0x5b78('0x2a')](_0x280e74,_0x5b78('0x27'));_0x3cae7d['query']=_[_0x5b78('0x30')](_0x162817['query']);_0x3cae7d[_0x5b78('0x31')]=_[_0x5b78('0x32')](_0x3cae7d[_0x5b78('0x2f')],_0x3cae7d['query']);_0x263d7d[_0x5b78('0x33')]=_[_0x5b78('0x32')](_0x3cae7d[_0x5b78('0x2f')],qs[_0x5b78('0x34')](_0x162817[_0x5b78('0x35')][_0x5b78('0x34')]));_0x263d7d[_0x5b78('0x33')]=_0x263d7d[_0x5b78('0x33')][_0x5b78('0x36')]?_0x263d7d[_0x5b78('0x33')]:_0x3cae7d['model'];if(!_0x162817[_0x5b78('0x35')][_0x5b78('0x37')](_0x5b78('0x38'))){_0x263d7d[_0x5b78('0x1a')]=qs[_0x5b78('0x1a')](_0x162817[_0x5b78('0x35')][_0x5b78('0x1a')]);_0x263d7d[_0x5b78('0x1c')]=qs[_0x5b78('0x1c')](_0x162817['query'][_0x5b78('0x1c')]);}_0x263d7d[_0x5b78('0x39')]=qs[_0x5b78('0x3a')](_0x162817[_0x5b78('0x35')][_0x5b78('0x3a')]);_0x263d7d[_0x5b78('0x3b')]=qs[_0x5b78('0x31')](_[_0x5b78('0x3c')](_0x162817[_0x5b78('0x35')],_0x3cae7d[_0x5b78('0x31')]),_0x280e74);if(_0x162817['query'][_0x5b78('0x3d')]){_0x263d7d[_0x5b78('0x3b')]=_[_0x5b78('0x3e')](_0x263d7d['where'],{'$or':_[_0x5b78('0x2a')](_0x280e74,function(_0x3a69da){if(_0x3a69da['type']!==_0x5b78('0x3f')){var _0x317045={};_0x317045[_0x3a69da[_0x5b78('0x27')]]={'$like':'%'+_0x162817[_0x5b78('0x35')][_0x5b78('0x3d')]+'%'};return _0x317045;}})});}_0x263d7d=_[_0x5b78('0x3e')]({},_0x263d7d,_0x162817[_0x5b78('0x40')]);var _0x4c6c5a={'where':_0x263d7d['where']};return db[_0x5b78('0x2b')][_0x5b78('0x1b')](_0x4c6c5a)[_0x5b78('0x23')](function(_0x2745c6){_0x465a13[_0x5b78('0x1b')]=_0x2745c6;if(_0x162817[_0x5b78('0x35')][_0x5b78('0x41')]){_0x263d7d['include']=[{'all':!![]}];}return db[_0x5b78('0x2b')][_0x5b78('0x42')](_0x263d7d);})[_0x5b78('0x23')](function(_0x359a0d){_0x465a13[_0x5b78('0x43')]=_0x359a0d;return _0x465a13;})[_0x5b78('0x23')](respondWithFilteredResult(_0x4aa37b,_0x263d7d))[_0x5b78('0x44')](handleError(_0x4aa37b,null));};exports[_0x5b78('0x45')]=function(_0x4c4d5c,_0x5225a2){var _0x1066ae={'raw':!![],'where':{'id':_0x4c4d5c['params']['id']}},_0x28ec8e={};_0x28ec8e[_0x5b78('0x2f')]=_[_0x5b78('0x30')](db[_0x5b78('0x2b')][_0x5b78('0x2c')]);_0x28ec8e[_0x5b78('0x35')]=_[_0x5b78('0x30')](_0x4c4d5c[_0x5b78('0x35')]);_0x28ec8e[_0x5b78('0x31')]=_['intersection'](_0x28ec8e[_0x5b78('0x2f')],_0x28ec8e[_0x5b78('0x35')]);_0x1066ae[_0x5b78('0x33')]=_[_0x5b78('0x32')](_0x28ec8e['model'],qs[_0x5b78('0x34')](_0x4c4d5c[_0x5b78('0x35')][_0x5b78('0x34')]));_0x1066ae['attributes']=_0x1066ae[_0x5b78('0x33')][_0x5b78('0x36')]?_0x1066ae[_0x5b78('0x33')]:_0x28ec8e['model'];if(_0x4c4d5c[_0x5b78('0x35')]['includeAll']){_0x1066ae[_0x5b78('0x46')]=[{'all':!![]}];}_0x1066ae=_['merge']({},_0x1066ae,_0x4c4d5c['options']);return db[_0x5b78('0x2b')][_0x5b78('0x47')](_0x1066ae)['then'](handleEntityNotFound(_0x5225a2,null))[_0x5b78('0x23')](respondWithResult(_0x5225a2,null))[_0x5b78('0x44')](handleError(_0x5225a2,null));};exports[_0x5b78('0x48')]=function(_0x3c6b68,_0x8c2178){return db[_0x5b78('0x2b')][_0x5b78('0x48')](_0x3c6b68['body'],{})[_0x5b78('0x23')](respondWithResult(_0x8c2178,0xc9))[_0x5b78('0x44')](handleError(_0x8c2178,null));};exports[_0x5b78('0x22')]=function(_0x6e1227,_0x32450c){if(_0x6e1227[_0x5b78('0x49')]['id']){delete _0x6e1227[_0x5b78('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x5b78('0x47')]({'where':{'id':_0x6e1227['params']['id']}})['then'](handleEntityNotFound(_0x32450c,null))['then'](saveUpdates(_0x6e1227['body'],null))['then'](respondWithResult(_0x32450c,null))[_0x5b78('0x44')](handleError(_0x32450c,null));};exports[_0x5b78('0x24')]=function(_0x281d02,_0x700a0a){return db['OpenchannelTransferReport'][_0x5b78('0x47')]({'where':{'id':_0x281d02[_0x5b78('0x4a')]['id']}})[_0x5b78('0x23')](handleEntityNotFound(_0x700a0a,null))[_0x5b78('0x23')](removeEntity(_0x700a0a,null))[_0x5b78('0x44')](handleError(_0x700a0a,null));};exports[_0x5b78('0x4b')]=function(_0x4aeb25,_0x138e43){return db[_0x5b78('0x2b')]['describe']()[_0x5b78('0x23')](respondWithResult(_0x138e43,null))['catch'](handleError(_0x138e43,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1e62549..93c4800 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 _0x1965=['../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b9dcb,_0x4e5d4f){var _0x408ab8=function(_0x55a1de){while(--_0x55a1de){_0x5b9dcb['push'](_0x5b9dcb['shift']());}};_0x408ab8(++_0x4e5d4f);}(_0x1965,0x87));var _0x5196=function(_0x29dd25,_0x10f1de){_0x29dd25=_0x29dd25-0x0;var _0x5c828b=_0x1965[_0x29dd25];return _0x5c828b;};'use strict';var _=require('lodash');var util=require(_0x5196('0x0'));var logger=require(_0x5196('0x1'))(_0x5196('0x2'));var moment=require(_0x5196('0x3'));var BPromise=require(_0x5196('0x4'));var rp=require(_0x5196('0x5'));var fs=require('fs');var path=require(_0x5196('0x6'));var rimraf=require(_0x5196('0x7'));var config=require(_0x5196('0x8'));var attributes=require(_0x5196('0x9'));module['exports']=function(_0x72b51,_0x263ff5){return _0x72b51['define'](_0x5196('0xa'),attributes,{'tableName':_0x5196('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5196('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x916d=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x4669b,_0x160fb5){var _0x22b501=function(_0x7f7f56){while(--_0x7f7f56){_0x4669b['push'](_0x4669b['shift']());}};_0x22b501(++_0x160fb5);}(_0x916d,0x179));var _0xd916=function(_0x4e78bc,_0x109906){_0x4e78bc=_0x4e78bc-0x0;var _0x284d86=_0x916d[_0x4e78bc];return _0x284d86;};'use strict';var _=require(_0xd916('0x0'));var util=require(_0xd916('0x1'));var logger=require(_0xd916('0x2'))(_0xd916('0x3'));var moment=require(_0xd916('0x4'));var BPromise=require(_0xd916('0x5'));var rp=require(_0xd916('0x6'));var fs=require('fs');var path=require(_0xd916('0x7'));var rimraf=require(_0xd916('0x8'));var config=require(_0xd916('0x9'));var attributes=require(_0xd916('0xa'));module[_0xd916('0xb')]=function(_0x161dea,_0x4e0e66){return _0x161dea[_0xd916('0xc')]('OpenchannelTransferReport',attributes,{'tableName':_0xd916('0xd'),'paranoid':![],'indexes':[{'name':_0xd916('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 138784a..3cce6af 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 _0xd13e=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f79b9,_0x2125ec){var _0xa9c64f=function(_0xccf001){while(--_0xccf001){_0x3f79b9['push'](_0x3f79b9['shift']());}};_0xa9c64f(++_0x2125ec);}(_0xd13e,0x193));var _0xed13=function(_0x11da35,_0x2f2409){_0x11da35=_0x11da35-0x0;var _0x154151=_0xd13e[_0x11da35];return _0x154151;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var moment=require(_0xed13('0x2'));var BPromise=require(_0xed13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed13('0x5'));var logger=require('../../config/logger')(_0xed13('0x6'));var config=require(_0xed13('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x95ff4c,_0x134929,_0xab0fff){return new BPromise(function(_0x3b3984,_0x369798){return client[_0xed13('0x8')](_0x95ff4c,_0xab0fff)[_0xed13('0x9')](function(_0x9bc191){logger[_0xed13('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x134929,_0xed13('0xb'));logger[_0xed13('0xc')](_0xed13('0xd'),_0x134929,_0xed13('0xb'),JSON[_0xed13('0xe')](_0x9bc191));if(_0x9bc191['error']){if(_0x9bc191[_0xed13('0xf')][_0xed13('0x10')]===0x1f4){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x9bc191[_0xed13('0xf')][_0xed13('0x12')]);return _0x369798(_0x9bc191['error'][_0xed13('0x12')]);}logger['error'](_0xed13('0x11'),_0x134929,_0x9bc191['error'][_0xed13('0x12')]);return _0x3b3984(_0x9bc191['error'][_0xed13('0x12')]);}else{logger['info'](_0xed13('0x11'),_0x134929,_0xed13('0xb'));_0x3b3984(_0x9bc191[_0xed13('0x13')][_0xed13('0x12')]);}})[_0xed13('0x14')](function(_0x1f8585){logger[_0xed13('0xf')](_0xed13('0x11'),_0x134929,_0x1f8585);_0x369798(_0x1f8585);});});} \ No newline at end of file +var _0xbd51=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x697439,_0x574b80){_0x697439=_0x697439-0x0;var _0x5dd6de=_0xbd51[_0x697439];return _0x5dd6de;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index eb45db2..cc20e5e 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 _0x2821=['index','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated'];(function(_0x2aec4f,_0x1fd2f3){var _0x49651b=function(_0x375929){while(--_0x375929){_0x2aec4f['push'](_0x2aec4f['shift']());}};_0x49651b(++_0x1fd2f3);}(_0x2821,0x87));var _0x1282=function(_0x3b50b2,_0x379ed4){_0x3b50b2=_0x3b50b2-0x0;var _0x43b7e4=_0x2821[_0x3b50b2];return _0x43b7e4;};'use strict';var multer=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var timeout=require(_0x1282('0x3'));var express=require(_0x1282('0x4'));var router=express[_0x1282('0x5')]();var fs_extra=require(_0x1282('0x6'));var auth=require(_0x1282('0x7'));var interaction=require(_0x1282('0x8'));var config=require(_0x1282('0x9'));var controller=require(_0x1282('0xa'));router['get']('/',auth[_0x1282('0xb')](),controller[_0x1282('0xc')]);router[_0x1282('0xd')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0xf')]);router[_0x1282('0x10')]('/',auth[_0x1282('0xb')](),controller['create']);router[_0x1282('0x11')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0x12')]);router[_0x1282('0x13')]('/:id',auth[_0x1282('0xb')](),controller[_0x1282('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe9a9=['index','/:id','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xe9a9,0xce));var _0x9e9a=function(_0x83f657,_0x5d84b7){_0x83f657=_0x83f657-0x0;var _0x612cd3=_0xe9a9[_0x83f657];return _0x612cd3;};'use strict';var multer=require(_0x9e9a('0x0'));var util=require(_0x9e9a('0x1'));var path=require(_0x9e9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e9a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9e9a('0x4'));var interaction=require(_0x9e9a('0x5'));var config=require(_0x9e9a('0x6'));var controller=require(_0x9e9a('0x7'));router[_0x9e9a('0x8')]('/',auth[_0x9e9a('0x9')](),controller[_0x9e9a('0xa')]);router['get'](_0x9e9a('0xb'),auth[_0x9e9a('0x9')](),controller['show']);router[_0x9e9a('0xc')]('/',auth[_0x9e9a('0x9')](),controller['create']);router[_0x9e9a('0xd')](_0x9e9a('0xb'),auth[_0x9e9a('0x9')](),controller[_0x9e9a('0xe')]);router[_0x9e9a('0xf')](_0x9e9a('0xb'),auth[_0x9e9a('0x9')](),controller[_0x9e9a('0x10')]);module[_0x9e9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 51e3d5d..7ca3449 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 _0x4885=['exports','STRING','sequelize'];(function(_0x4a320b,_0x50edc5){var _0x14bcf2=function(_0x876577){while(--_0x876577){_0x4a320b['push'](_0x4a320b['shift']());}};_0x14bcf2(++_0x50edc5);}(_0x4885,0xa7));var _0x5488=function(_0x7225bf,_0x69a214){_0x7225bf=_0x7225bf-0x0;var _0x5293ff=_0x4885[_0x7225bf];return _0x5293ff;};'use strict';var Sequelize=require(_0x5488('0x0'));module[_0x5488('0x1')]={'name':{'type':Sequelize[_0x5488('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b71=['sequelize','exports','name','STRING'];(function(_0x49359c,_0x37822d){var _0x13cc86=function(_0x117fb9){while(--_0x117fb9){_0x49359c['push'](_0x49359c['shift']());}};_0x13cc86(++_0x37822d);}(_0x6b71,0xa4));var _0x16b7=function(_0x68b90b,_0xb8b06a){_0x68b90b=_0x68b90b-0x0;var _0x5220ec=_0x6b71[_0x68b90b];return _0x5220ec;};'use strict';var Sequelize=require(_0x16b7('0x0'));module[_0x16b7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x16b7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x16b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 479e9fe..f2b9d7d 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 _0xd7ee=['../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','keys','query','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Pause','findAll','rows','catch','show','params','attributes','includeAll','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd7ee,0x94));var _0xed7e=function(_0xa8ccab,_0x4d7cae){_0xa8ccab=_0xa8ccab-0x0;var _0x570d5f=_0xd7ee[_0xa8ccab];return _0x570d5f;};'use strict';var emlformat=require(_0xed7e('0x0'));var rimraf=require(_0xed7e('0x1'));var zipdir=require(_0xed7e('0x2'));var jsonpatch=require(_0xed7e('0x3'));var rp=require(_0xed7e('0x4'));var moment=require(_0xed7e('0x5'));var BPromise=require(_0xed7e('0x6'));var Mustache=require(_0xed7e('0x7'));var util=require(_0xed7e('0x8'));var path=require('path');var sox=require(_0xed7e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed7e('0xa'));var _=require(_0xed7e('0xb'));var squel=require(_0xed7e('0xc'));var crypto=require(_0xed7e('0xd'));var jsforce=require(_0xed7e('0xe'));var deskjs=require(_0xed7e('0xf'));var toCsv=require(_0xed7e('0x10'));var querystring=require('querystring');var Papa=require(_0xed7e('0x11'));var Redis=require(_0xed7e('0x12'));var authService=require(_0xed7e('0x13'));var qs=require(_0xed7e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed7e('0x15'));var logger=require(_0xed7e('0x16'))('api');var utils=require(_0xed7e('0x17'));var config=require(_0xed7e('0x18'));var licenseUtil=require(_0xed7e('0x19'));var db=require(_0xed7e('0x1a'))['db'];function respondWithStatusCode(_0x101acd,_0x3fbb3a){_0x3fbb3a=_0x3fbb3a||0xcc;return function(_0x53ba07){if(_0x53ba07){return _0x101acd[_0xed7e('0x1b')](_0x3fbb3a);}return _0x101acd[_0xed7e('0x1c')](_0x3fbb3a)['end']();};}function respondWithResult(_0x5b5514,_0x4cad31){_0x4cad31=_0x4cad31||0xc8;return function(_0x4b7fa9){if(_0x4b7fa9){return _0x5b5514[_0xed7e('0x1c')](_0x4cad31)[_0xed7e('0x1d')](_0x4b7fa9);}};}function respondWithFilteredResult(_0x5e5abb,_0x37cccd){return function(_0x42eec3){if(_0x42eec3){var _0x33c242=typeof _0x37cccd['offset']===_0xed7e('0x1e')&&typeof _0x37cccd['limit']===_0xed7e('0x1e');var _0x19da0b=_0x42eec3[_0xed7e('0x1f')];var _0x59ad33=_0x33c242?0x0:_0x37cccd[_0xed7e('0x20')];var _0x4fee2c=_0x33c242?_0x42eec3[_0xed7e('0x1f')]:_0x37cccd['offset']+_0x37cccd[_0xed7e('0x21')];var _0x2ebcef;if(_0x4fee2c>=_0x19da0b){_0x4fee2c=_0x19da0b;_0x2ebcef=0xc8;}else{_0x2ebcef=0xce;}_0x5e5abb[_0xed7e('0x1c')](_0x2ebcef);return _0x5e5abb[_0xed7e('0x22')](_0xed7e('0x23'),_0x59ad33+'-'+_0x4fee2c+'/'+_0x19da0b)[_0xed7e('0x1d')](_0x42eec3);}return null;};}function patchUpdates(_0x397f09){return function(_0x1c1bff){try{jsonpatch[_0xed7e('0x24')](_0x1c1bff,_0x397f09,!![]);}catch(_0x3bb2c2){return BPromise[_0xed7e('0x25')](_0x3bb2c2);}return _0x1c1bff[_0xed7e('0x26')]();};}function saveUpdates(_0xaaca98,_0x1e491e){return function(_0x2eb7ec){if(_0x2eb7ec){return _0x2eb7ec[_0xed7e('0x27')](_0xaaca98)[_0xed7e('0x28')](function(_0x5432dc){return _0x5432dc;});}return null;};}function removeEntity(_0x5c5836,_0x24f771){return function(_0x5eba07){if(_0x5eba07){return _0x5eba07[_0xed7e('0x29')]()[_0xed7e('0x28')](function(){var _0x5a4145=_0x5eba07['get']({'plain':!![]});var _0x124cac='Pauses';return db[_0xed7e('0x2a')][_0xed7e('0x29')]({'where':{'type':_0x124cac,'resourceId':_0x5a4145['id']}})[_0xed7e('0x28')](function(){return _0x5eba07;});})['then'](function(){_0x5c5836['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39615d,_0x20d993){return function(_0x2d6a56){if(!_0x2d6a56){_0x39615d[_0xed7e('0x1b')](0x194);}return _0x2d6a56;};}function handleError(_0x29de9d,_0x860a11){_0x860a11=_0x860a11||0x1f4;return function(_0x51c0ef){logger[_0xed7e('0x2b')](_0x51c0ef[_0xed7e('0x2c')]);if(_0x51c0ef[_0xed7e('0x2d')]){delete _0x51c0ef['name'];}_0x29de9d[_0xed7e('0x1c')](_0x860a11)[_0xed7e('0x2e')](_0x51c0ef);};}exports[_0xed7e('0x2f')]=function(_0x4593a1,_0x221426){var _0x4eadbc={},_0x5ea4c4={},_0x331fdb={'count':0x0,'rows':[]};var _0x584dba=_['map'](db['Pause'][_0xed7e('0x30')],function(_0x1afb76){return{'name':_0x1afb76['fieldName'],'type':_0x1afb76[_0xed7e('0x31')][_0xed7e('0x32')]};});_0x5ea4c4['model']=_['map'](_0x584dba,_0xed7e('0x2d'));_0x5ea4c4['query']=_[_0xed7e('0x33')](_0x4593a1[_0xed7e('0x34')]);_0x5ea4c4[_0xed7e('0x35')]=_[_0xed7e('0x36')](_0x5ea4c4[_0xed7e('0x37')],_0x5ea4c4['query']);_0x4eadbc['attributes']=_[_0xed7e('0x36')](_0x5ea4c4['model'],qs[_0xed7e('0x38')](_0x4593a1['query']['fields']));_0x4eadbc['attributes']=_0x4eadbc['attributes'][_0xed7e('0x39')]?_0x4eadbc['attributes']:_0x5ea4c4[_0xed7e('0x37')];if(!_0x4593a1['query'][_0xed7e('0x3a')](_0xed7e('0x3b'))){_0x4eadbc['limit']=qs[_0xed7e('0x21')](_0x4593a1[_0xed7e('0x34')][_0xed7e('0x21')]);_0x4eadbc[_0xed7e('0x20')]=qs[_0xed7e('0x20')](_0x4593a1[_0xed7e('0x34')][_0xed7e('0x20')]);}_0x4eadbc[_0xed7e('0x3c')]=qs[_0xed7e('0x3d')](_0x4593a1[_0xed7e('0x34')]['sort']);_0x4eadbc['where']=qs['filters'](_[_0xed7e('0x3e')](_0x4593a1[_0xed7e('0x34')],_0x5ea4c4[_0xed7e('0x35')]),_0x584dba);if(_0x4593a1['query'][_0xed7e('0x3f')]){_0x4eadbc[_0xed7e('0x40')]=_[_0xed7e('0x41')](_0x4eadbc[_0xed7e('0x40')],{'$or':_['map'](_0x584dba,function(_0x2c5fea){if(_0x2c5fea[_0xed7e('0x31')]!==_0xed7e('0x42')){var _0x57d414={};_0x57d414[_0x2c5fea[_0xed7e('0x2d')]]={'$like':'%'+_0x4593a1[_0xed7e('0x34')]['filter']+'%'};return _0x57d414;}})});}_0x4eadbc=_['merge']({},_0x4eadbc,_0x4593a1['options']);var _0x5b1602={'where':_0x4eadbc[_0xed7e('0x40')]};return db[_0xed7e('0x43')][_0xed7e('0x1f')](_0x5b1602)['then'](function(_0x20548f){_0x331fdb['count']=_0x20548f;if(_0x4593a1[_0xed7e('0x34')]['includeAll']){_0x4eadbc['include']=[{'all':!![]}];}return db[_0xed7e('0x43')][_0xed7e('0x44')](_0x4eadbc);})[_0xed7e('0x28')](function(_0x1860ad){_0x331fdb[_0xed7e('0x45')]=_0x1860ad;return _0x331fdb;})['then'](respondWithFilteredResult(_0x221426,_0x4eadbc))[_0xed7e('0x46')](handleError(_0x221426,null));};exports[_0xed7e('0x47')]=function(_0x126c7e,_0x396733){var _0x43dee7={'raw':!![],'where':{'id':_0x126c7e[_0xed7e('0x48')]['id']}},_0xf2599b={};_0xf2599b['model']=_['keys'](db[_0xed7e('0x43')]['rawAttributes']);_0xf2599b['query']=_[_0xed7e('0x33')](_0x126c7e[_0xed7e('0x34')]);_0xf2599b[_0xed7e('0x35')]=_[_0xed7e('0x36')](_0xf2599b[_0xed7e('0x37')],_0xf2599b[_0xed7e('0x34')]);_0x43dee7[_0xed7e('0x49')]=_['intersection'](_0xf2599b[_0xed7e('0x37')],qs[_0xed7e('0x38')](_0x126c7e[_0xed7e('0x34')][_0xed7e('0x38')]));_0x43dee7[_0xed7e('0x49')]=_0x43dee7['attributes'][_0xed7e('0x39')]?_0x43dee7['attributes']:_0xf2599b[_0xed7e('0x37')];if(_0x126c7e[_0xed7e('0x34')][_0xed7e('0x4a')]){_0x43dee7[_0xed7e('0x4b')]=[{'all':!![]}];}_0x43dee7=_[_0xed7e('0x41')]({},_0x43dee7,_0x126c7e['options']);return db[_0xed7e('0x43')]['find'](_0x43dee7)[_0xed7e('0x28')](handleEntityNotFound(_0x396733,null))[_0xed7e('0x28')](respondWithResult(_0x396733,null))[_0xed7e('0x46')](handleError(_0x396733,null));};exports[_0xed7e('0x4c')]=function(_0x29bf64,_0x281334){return db[_0xed7e('0x43')][_0xed7e('0x4c')](_0x29bf64['body'],{})[_0xed7e('0x28')](function(_0x191ce1){var _0x317ff6=_0x29bf64[_0xed7e('0x4d')][_0xed7e('0x4e')]({'plain':!![]});if(!_0x317ff6)throw new Error(_0xed7e('0x4f'));if(_0x317ff6[_0xed7e('0x50')]==='user'){var _0x28aa25=_0x191ce1[_0xed7e('0x4e')]({'plain':!![]});var _0x328245=_0xed7e('0x51');return db[_0xed7e('0x52')][_0xed7e('0x53')]({'where':{'name':_0x328245,'userProfileId':_0x317ff6[_0xed7e('0x54')]},'raw':!![]})[_0xed7e('0x28')](function(_0x21d1f7){if(_0x21d1f7&&_0x21d1f7['autoAssociation']===0x0){return db['UserProfileResource'][_0xed7e('0x4c')]({'name':_0x28aa25[_0xed7e('0x2d')],'resourceId':_0x28aa25['id'],'type':_0x21d1f7[_0xed7e('0x2d')],'sectionId':_0x21d1f7['id']},{})[_0xed7e('0x28')](function(){return _0x191ce1;});}else{return _0x191ce1;}})[_0xed7e('0x46')](function(_0x32ac4b){logger[_0xed7e('0x2b')](_0xed7e('0x55'),_0x32ac4b);throw _0x32ac4b;});}return _0x191ce1;})[_0xed7e('0x28')](respondWithResult(_0x281334,0xc9))['catch'](handleError(_0x281334,null));};exports[_0xed7e('0x27')]=function(_0x3a5702,_0x3ab884){if(_0x3a5702[_0xed7e('0x56')]['id']){delete _0x3a5702[_0xed7e('0x56')]['id'];}return db['Pause']['find']({'where':{'id':_0x3a5702[_0xed7e('0x48')]['id']}})[_0xed7e('0x28')](handleEntityNotFound(_0x3ab884,null))[_0xed7e('0x28')](saveUpdates(_0x3a5702[_0xed7e('0x56')],null))[_0xed7e('0x28')](respondWithResult(_0x3ab884,null))['catch'](handleError(_0x3ab884,null));};exports[_0xed7e('0x29')]=function(_0x2d5b62,_0x488adf){return db[_0xed7e('0x43')][_0xed7e('0x53')]({'where':{'id':_0x2d5b62['params']['id']}})['then'](handleEntityNotFound(_0x488adf,null))['then'](removeEntity(_0x488adf,null))[_0xed7e('0x46')](handleError(_0x488adf,null));}; \ No newline at end of file +var _0xa387=['model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','rows','params','keys','include','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','Content-Range','json','apply','save','then','destroy','get','Pauses','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key'];(function(_0x742767,_0xfee16a){var _0xa89319=function(_0x2647dd){while(--_0x2647dd){_0x742767['push'](_0x742767['shift']());}};_0xa89319(++_0xfee16a);}(_0xa387,0x170));var _0x7a38=function(_0x5b8a65,_0x5f2d80){_0x5b8a65=_0x5b8a65-0x0;var _0x29d8e1=_0xa387[_0x5b8a65];return _0x29d8e1;};'use strict';var emlformat=require(_0x7a38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a38('0x1'));var jsonpatch=require(_0x7a38('0x2'));var rp=require(_0x7a38('0x3'));var moment=require(_0x7a38('0x4'));var BPromise=require(_0x7a38('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7a38('0x6'));var sox=require(_0x7a38('0x7'));var csv=require(_0x7a38('0x8'));var ejs=require(_0x7a38('0x9'));var fs=require('fs');var fs_extra=require(_0x7a38('0xa'));var _=require(_0x7a38('0xb'));var squel=require(_0x7a38('0xc'));var crypto=require(_0x7a38('0xd'));var jsforce=require(_0x7a38('0xe'));var deskjs=require(_0x7a38('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a38('0x10'));var Papa=require(_0x7a38('0x11'));var Redis=require(_0x7a38('0x12'));var authService=require(_0x7a38('0x13'));var qs=require(_0x7a38('0x14'));var as=require(_0x7a38('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a38('0x16'))(_0x7a38('0x17'));var utils=require(_0x7a38('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7a38('0x19'));var db=require(_0x7a38('0x1a'))['db'];function respondWithStatusCode(_0xaf510d,_0x853ce4){_0x853ce4=_0x853ce4||0xcc;return function(_0x3e9924){if(_0x3e9924){return _0xaf510d[_0x7a38('0x1b')](_0x853ce4);}return _0xaf510d['status'](_0x853ce4)[_0x7a38('0x1c')]();};}function respondWithResult(_0x30688c,_0x17b73c){_0x17b73c=_0x17b73c||0xc8;return function(_0x1ec03e){if(_0x1ec03e){return _0x30688c[_0x7a38('0x1d')](_0x17b73c)['json'](_0x1ec03e);}};}function respondWithFilteredResult(_0xcd7887,_0x591e95){return function(_0xc34902){if(_0xc34902){var _0x586259=typeof _0x591e95['offset']==='undefined'&&typeof _0x591e95[_0x7a38('0x1e')]===_0x7a38('0x1f');var _0x4c36cb=_0xc34902[_0x7a38('0x20')];var _0x50b8ad=_0x586259?0x0:_0x591e95[_0x7a38('0x21')];var _0x540684=_0x586259?_0xc34902[_0x7a38('0x20')]:_0x591e95[_0x7a38('0x21')]+_0x591e95[_0x7a38('0x1e')];var _0x2596d8;if(_0x540684>=_0x4c36cb){_0x540684=_0x4c36cb;_0x2596d8=0xc8;}else{_0x2596d8=0xce;}_0xcd7887[_0x7a38('0x1d')](_0x2596d8);return _0xcd7887['set'](_0x7a38('0x22'),_0x50b8ad+'-'+_0x540684+'/'+_0x4c36cb)[_0x7a38('0x23')](_0xc34902);}return null;};}function patchUpdates(_0x299695){return function(_0x3f7927){try{jsonpatch[_0x7a38('0x24')](_0x3f7927,_0x299695,!![]);}catch(_0x295225){return BPromise['reject'](_0x295225);}return _0x3f7927[_0x7a38('0x25')]();};}function saveUpdates(_0xd0a1bc,_0x5c152c){return function(_0x20e609){if(_0x20e609){return _0x20e609['update'](_0xd0a1bc)[_0x7a38('0x26')](function(_0x4ea2c7){return _0x4ea2c7;});}return null;};}function removeEntity(_0x1a0820,_0x17bb50){return function(_0x1c788d){if(_0x1c788d){return _0x1c788d[_0x7a38('0x27')]()['then'](function(){var _0x598e85=_0x1c788d[_0x7a38('0x28')]({'plain':!![]});var _0x24f9e6=_0x7a38('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x24f9e6,'resourceId':_0x598e85['id']}})[_0x7a38('0x26')](function(){return _0x1c788d;});})[_0x7a38('0x26')](function(){_0x1a0820[_0x7a38('0x1d')](0xcc)[_0x7a38('0x1c')]();});}};}function handleEntityNotFound(_0x45c9d0,_0x185f5f){return function(_0x3710ac){if(!_0x3710ac){_0x45c9d0[_0x7a38('0x1b')](0x194);}return _0x3710ac;};}function handleError(_0x48da50,_0x59b754){_0x59b754=_0x59b754||0x1f4;return function(_0x9c37d){logger[_0x7a38('0x2a')](_0x9c37d[_0x7a38('0x2b')]);if(_0x9c37d[_0x7a38('0x2c')]){delete _0x9c37d['name'];}_0x48da50['status'](_0x59b754)[_0x7a38('0x2d')](_0x9c37d);};}exports['index']=function(_0x1c3675,_0x2c175c){var _0x2c7701={},_0x32ab00={},_0xb240a3={'count':0x0,'rows':[]};var _0x112146=_[_0x7a38('0x2e')](db[_0x7a38('0x2f')][_0x7a38('0x30')],function(_0x24f42c){return{'name':_0x24f42c[_0x7a38('0x31')],'type':_0x24f42c[_0x7a38('0x32')][_0x7a38('0x33')]};});_0x32ab00[_0x7a38('0x34')]=_[_0x7a38('0x2e')](_0x112146,_0x7a38('0x2c'));_0x32ab00[_0x7a38('0x35')]=_['keys'](_0x1c3675[_0x7a38('0x35')]);_0x32ab00['filters']=_['intersection'](_0x32ab00['model'],_0x32ab00[_0x7a38('0x35')]);_0x2c7701[_0x7a38('0x36')]=_[_0x7a38('0x37')](_0x32ab00['model'],qs[_0x7a38('0x38')](_0x1c3675[_0x7a38('0x35')]['fields']));_0x2c7701[_0x7a38('0x36')]=_0x2c7701[_0x7a38('0x36')][_0x7a38('0x39')]?_0x2c7701[_0x7a38('0x36')]:_0x32ab00[_0x7a38('0x34')];if(!_0x1c3675[_0x7a38('0x35')][_0x7a38('0x3a')]('nolimit')){_0x2c7701[_0x7a38('0x1e')]=qs['limit'](_0x1c3675[_0x7a38('0x35')]['limit']);_0x2c7701[_0x7a38('0x21')]=qs[_0x7a38('0x21')](_0x1c3675[_0x7a38('0x35')][_0x7a38('0x21')]);}_0x2c7701[_0x7a38('0x3b')]=qs[_0x7a38('0x3c')](_0x1c3675[_0x7a38('0x35')][_0x7a38('0x3c')]);_0x2c7701['where']=qs[_0x7a38('0x3d')](_[_0x7a38('0x3e')](_0x1c3675[_0x7a38('0x35')],_0x32ab00[_0x7a38('0x3d')]),_0x112146);if(_0x1c3675['query'][_0x7a38('0x3f')]){_0x2c7701[_0x7a38('0x40')]=_[_0x7a38('0x41')](_0x2c7701[_0x7a38('0x40')],{'$or':_[_0x7a38('0x2e')](_0x112146,function(_0x4178a5){if(_0x4178a5[_0x7a38('0x32')]!==_0x7a38('0x42')){var _0x2515b5={};_0x2515b5[_0x4178a5['name']]={'$like':'%'+_0x1c3675['query'][_0x7a38('0x3f')]+'%'};return _0x2515b5;}})});}_0x2c7701=_[_0x7a38('0x41')]({},_0x2c7701,_0x1c3675['options']);var _0x14ee87={'where':_0x2c7701[_0x7a38('0x40')]};return db[_0x7a38('0x2f')][_0x7a38('0x20')](_0x14ee87)[_0x7a38('0x26')](function(_0x5c2466){_0xb240a3[_0x7a38('0x20')]=_0x5c2466;if(_0x1c3675['query'][_0x7a38('0x43')]){_0x2c7701['include']=[{'all':!![]}];}return db[_0x7a38('0x2f')]['findAll'](_0x2c7701);})[_0x7a38('0x26')](function(_0x2f5f27){_0xb240a3[_0x7a38('0x44')]=_0x2f5f27;return _0xb240a3;})['then'](respondWithFilteredResult(_0x2c175c,_0x2c7701))['catch'](handleError(_0x2c175c,null));};exports['show']=function(_0x7fb834,_0x43e965){var _0x245d73={'raw':!![],'where':{'id':_0x7fb834[_0x7a38('0x45')]['id']}},_0x4ceee0={};_0x4ceee0[_0x7a38('0x34')]=_[_0x7a38('0x46')](db['Pause']['rawAttributes']);_0x4ceee0[_0x7a38('0x35')]=_[_0x7a38('0x46')](_0x7fb834[_0x7a38('0x35')]);_0x4ceee0[_0x7a38('0x3d')]=_[_0x7a38('0x37')](_0x4ceee0[_0x7a38('0x34')],_0x4ceee0['query']);_0x245d73[_0x7a38('0x36')]=_['intersection'](_0x4ceee0[_0x7a38('0x34')],qs['fields'](_0x7fb834[_0x7a38('0x35')]['fields']));_0x245d73[_0x7a38('0x36')]=_0x245d73[_0x7a38('0x36')][_0x7a38('0x39')]?_0x245d73[_0x7a38('0x36')]:_0x4ceee0[_0x7a38('0x34')];if(_0x7fb834[_0x7a38('0x35')][_0x7a38('0x43')]){_0x245d73[_0x7a38('0x47')]=[{'all':!![]}];}_0x245d73=_[_0x7a38('0x41')]({},_0x245d73,_0x7fb834[_0x7a38('0x48')]);return db[_0x7a38('0x2f')]['find'](_0x245d73)[_0x7a38('0x26')](handleEntityNotFound(_0x43e965,null))['then'](respondWithResult(_0x43e965,null))[_0x7a38('0x49')](handleError(_0x43e965,null));};exports[_0x7a38('0x4a')]=function(_0x38d12c,_0x3a53c7){return db[_0x7a38('0x2f')][_0x7a38('0x4a')](_0x38d12c['body'],{})[_0x7a38('0x26')](function(_0x155fdc){var _0x50cb04=_0x38d12c[_0x7a38('0x4b')][_0x7a38('0x28')]({'plain':!![]});if(!_0x50cb04)throw new Error(_0x7a38('0x4c'));if(_0x50cb04[_0x7a38('0x4d')]===_0x7a38('0x4b')){var _0x46f92c=_0x155fdc[_0x7a38('0x28')]({'plain':!![]});var _0x4acfaa=_0x7a38('0x29');return db['UserProfileSection'][_0x7a38('0x4e')]({'where':{'name':_0x4acfaa,'userProfileId':_0x50cb04[_0x7a38('0x4f')]},'raw':!![]})[_0x7a38('0x26')](function(_0x5fdfb4){if(_0x5fdfb4&&_0x5fdfb4[_0x7a38('0x50')]===0x0){return db[_0x7a38('0x51')][_0x7a38('0x4a')]({'name':_0x46f92c[_0x7a38('0x2c')],'resourceId':_0x46f92c['id'],'type':_0x5fdfb4['name'],'sectionId':_0x5fdfb4['id']},{})[_0x7a38('0x26')](function(){return _0x155fdc;});}else{return _0x155fdc;}})[_0x7a38('0x49')](function(_0xc46f0f){logger['error'](_0x7a38('0x52'),_0xc46f0f);throw _0xc46f0f;});}return _0x155fdc;})[_0x7a38('0x26')](respondWithResult(_0x3a53c7,0xc9))[_0x7a38('0x49')](handleError(_0x3a53c7,null));};exports['update']=function(_0xf98c22,_0x106b2f){if(_0xf98c22[_0x7a38('0x53')]['id']){delete _0xf98c22[_0x7a38('0x53')]['id'];}return db[_0x7a38('0x2f')][_0x7a38('0x4e')]({'where':{'id':_0xf98c22[_0x7a38('0x45')]['id']}})['then'](handleEntityNotFound(_0x106b2f,null))['then'](saveUpdates(_0xf98c22[_0x7a38('0x53')],null))[_0x7a38('0x26')](respondWithResult(_0x106b2f,null))[_0x7a38('0x49')](handleError(_0x106b2f,null));};exports['destroy']=function(_0x245744,_0x2dec93){return db['Pause'][_0x7a38('0x4e')]({'where':{'id':_0x245744[_0x7a38('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dec93,null))[_0x7a38('0x26')](removeEntity(_0x2dec93,null))['catch'](handleError(_0x2dec93,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 691c131..7acc42b 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4fb153,_0x3b2b78){var _0x48653c=function(_0x162187){while(--_0x162187){_0x4fb153['push'](_0x4fb153['shift']());}};_0x48653c(++_0x3b2b78);}(_0x326f,0xd1));var _0xf326=function(_0x2496c0,_0x265379){_0x2496c0=_0x2496c0-0x0;var _0x5d7e42=_0x326f[_0x2496c0];return _0x5d7e42;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x15794e,_0x23524f){var _0x7e22d6=function(_0x2c4181){while(--_0x2c4181){_0x15794e['push'](_0x15794e['shift']());}};_0x7e22d6(++_0x23524f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5823eb,_0x7f2ac8){_0x5823eb=_0x5823eb-0x0;var _0x16ee8e=_0x8ef6[_0x5823eb];return _0x16ee8e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index cdfe06f..aea244d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x498aab,_0x3e7f0c){var _0x2a634d=function(_0x41d5f3){while(--_0x41d5f3){_0x498aab['push'](_0x498aab['shift']());}};_0x2a634d(++_0x3e7f0c);}(_0x7a54,0x106));var _0x47a5=function(_0x2e2f45,_0x27ea7b){_0x2e2f45=_0x2e2f45-0x0;var _0x1e567f=_0x7a54[_0x2e2f45];return _0x1e567f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x189c88,_0x594dd4){var _0x435f62=function(_0x266ab7){while(--_0x266ab7){_0x189c88['push'](_0x189c88['shift']());}};_0x435f62(++_0x594dd4);}(_0xb10b,0x12a));var _0xbb10=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0xb10b[_0x19ae7a];return _0x30d82e;};'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 74a24d3..5266d3b 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 _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x97cc12,_0x54d583){var _0x5a25d7=function(_0x46add6){while(--_0x46add6){_0x97cc12['push'](_0x97cc12['shift']());}};_0x5a25d7(++_0x54d583);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1fa529,_0x7f2b32){_0x1fa529=_0x1fa529-0x0;var _0x5bd5af=_0x4fdb[_0x1fa529];return _0x5bd5af;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file +var _0x6737=['diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','upload','webhookPost','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','index','/:id','show','get','download'];(function(_0x55d6ff,_0x379e7a){var _0x1fe90e=function(_0x3cb0b2){while(--_0x3cb0b2){_0x55d6ff['push'](_0x55d6ff['shift']());}};_0x1fe90e(++_0x379e7a);}(_0x6737,0xe2));var _0x7673=function(_0x39509c,_0x19de61){_0x39509c=_0x39509c-0x0;var _0x2415b3=_0x6737[_0x39509c];return _0x2415b3;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x7673('0xa'),auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id/download',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);var upload=multer({'storage':multer[_0x7673('0xe')]({'destination':function(_0x4d40ce,_0x49fcb2,_0x3ca258){_0x3ca258(null,path['join'](config[_0x7673('0xf')],_0x7673('0x10')));},'filename':function(_0x38090f,_0x451c87,_0x41d6bd){_0x451c87[_0x7673('0x11')]=_0x451c87[_0x7673('0x11')][_0x7673('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41d6bd(null,util[_0x7673('0x13')](_0x7673('0x14'),path['basename'](_0x451c87[_0x7673('0x11')],path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])),Date[_0x7673('0x16')](),path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])));}})});router[_0x7673('0x17')]('/',upload['single']('file'),controller[_0x7673('0x18')]);router[_0x7673('0x17')]('/webhook',controller[_0x7673('0x19')]);router[_0x7673('0x1a')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0x1b')]);router[_0x7673('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0x1c')]);module[_0x7673('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 04e0a0b..bd01ba4 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 _0x1391=['exports','STRING','script','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1391,0xcb));var _0x1139=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1391[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');module[_0x1139('0x0')]={'name':{'type':Sequelize[_0x1139('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0x1139('0x2'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1139('0x3')},'sidebar':{'type':Sequelize[_0x1139('0x4')]('adminOnly','agentOnly',_0x1139('0x5'),'never'),'defaultValue':'always','comment':_0x1139('0x6')},'icon':{'type':Sequelize[_0x1139('0x1')]},'adminUrl':{'type':Sequelize[_0x1139('0x1')]},'agentUrl':{'type':Sequelize[_0x1139('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1139('0x1')]}}; \ No newline at end of file +var _0xe7eb=['never','always','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x32b35f,_0x329497){var _0x4abc99=function(_0x5551b3){while(--_0x5551b3){_0x32b35f['push'](_0x32b35f['shift']());}};_0x4abc99(++_0x329497);}(_0xe7eb,0x16e));var _0xbe7e=function(_0x1e6e6d,_0x3e4068){_0x1e6e6d=_0x1e6e6d-0x0;var _0x2d5106=_0xe7eb[_0x1e6e6d];return _0x2d5106;};'use strict';var Sequelize=require(_0xbe7e('0x0'));module[_0xbe7e('0x1')]={'name':{'type':Sequelize[_0xbe7e('0x2')]},'type':{'type':Sequelize[_0xbe7e('0x3')](_0xbe7e('0x4'),_0xbe7e('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xbe7e('0x6')]},'path':{'type':Sequelize[_0xbe7e('0x2')],'comment':_0xbe7e('0x7')},'active':{'type':Sequelize[_0xbe7e('0x8')],'defaultValue':0x0,'comment':_0xbe7e('0x9')},'sidebar':{'type':Sequelize[_0xbe7e('0x3')](_0xbe7e('0xa'),_0xbe7e('0xb'),'always',_0xbe7e('0xc')),'defaultValue':_0xbe7e('0xd'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xbe7e('0x2')]},'scriptPath':{'type':Sequelize[_0xbe7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3d496b0..e8cd65d 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 _0x9c53=['count','offset','set','Content-Range','save','update','then','destroy','get','Plugins','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','filter','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit'];(function(_0x4324d2,_0x56d563){var _0x1439b3=function(_0x20b09a){while(--_0x20b09a){_0x4324d2['push'](_0x4324d2['shift']());}};_0x1439b3(++_0x56d563);}(_0x9c53,0x139));var _0x39c5=function(_0xf87248,_0x228bb4){_0xf87248=_0xf87248-0x0;var _0x3f7b81=_0x9c53[_0xf87248];return _0x3f7b81;};'use strict';var emlformat=require(_0x39c5('0x0'));var rimraf=require(_0x39c5('0x1'));var zipdir=require(_0x39c5('0x2'));var jsonpatch=require(_0x39c5('0x3'));var rp=require('request-promise');var moment=require(_0x39c5('0x4'));var BPromise=require(_0x39c5('0x5'));var Mustache=require(_0x39c5('0x6'));var util=require('util');var path=require(_0x39c5('0x7'));var sox=require(_0x39c5('0x8'));var csv=require(_0x39c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39c5('0xa'));var _=require(_0x39c5('0xb'));var squel=require(_0x39c5('0xc'));var crypto=require(_0x39c5('0xd'));var jsforce=require(_0x39c5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39c5('0x9'));var querystring=require(_0x39c5('0xf'));var Papa=require(_0x39c5('0x10'));var extract=require('extract-zip');var rimraf=require(_0x39c5('0x1'));var archiver=require('archiver');var Redis=require(_0x39c5('0x11'));var authService=require(_0x39c5('0x12'));var qs=require(_0x39c5('0x13'));var as=require(_0x39c5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c5('0x15'))(_0x39c5('0x16'));var utils=require(_0x39c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x39c5('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x39c5('0x19')](config[_0x39c5('0x1a')],{'host':_0x39c5('0x1b'),'port':0x18eb});var socket=require(_0x39c5('0x1c'))(new Redis(config[_0x39c5('0x1a')]));require(_0x39c5('0x1d'))[_0x39c5('0x1e')](socket);function respondWithStatusCode(_0x2aae5b,_0x36b62a){_0x36b62a=_0x36b62a||0xcc;return function(_0x55b31b){if(_0x55b31b){return _0x2aae5b[_0x39c5('0x1f')](_0x36b62a);}return _0x2aae5b[_0x39c5('0x20')](_0x36b62a)[_0x39c5('0x21')]();};}function respondWithResult(_0x34ae81,_0xa2239f){_0xa2239f=_0xa2239f||0xc8;return function(_0x18e31d){if(_0x18e31d){return _0x34ae81['status'](_0xa2239f)[_0x39c5('0x22')](_0x18e31d);}};}function respondWithFilteredResult(_0x12b40f,_0x4ddef4){return function(_0x9cf35e){if(_0x9cf35e){var _0x3a99dc=typeof _0x4ddef4['offset']===_0x39c5('0x23')&&typeof _0x4ddef4[_0x39c5('0x24')]==='undefined';var _0x23a230=_0x9cf35e[_0x39c5('0x25')];var _0x49dac6=_0x3a99dc?0x0:_0x4ddef4[_0x39c5('0x26')];var _0x403a1c=_0x3a99dc?_0x9cf35e[_0x39c5('0x25')]:_0x4ddef4['offset']+_0x4ddef4[_0x39c5('0x24')];var _0x136cd4;if(_0x403a1c>=_0x23a230){_0x403a1c=_0x23a230;_0x136cd4=0xc8;}else{_0x136cd4=0xce;}_0x12b40f['status'](_0x136cd4);return _0x12b40f[_0x39c5('0x27')](_0x39c5('0x28'),_0x49dac6+'-'+_0x403a1c+'/'+_0x23a230)[_0x39c5('0x22')](_0x9cf35e);}return null;};}function patchUpdates(_0x3f64e4){return function(_0x39208c){try{jsonpatch['apply'](_0x39208c,_0x3f64e4,!![]);}catch(_0x1ed3bd){return BPromise['reject'](_0x1ed3bd);}return _0x39208c[_0x39c5('0x29')]();};}function saveUpdates(_0x4fb2fc,_0x17c8aa){return function(_0x2a2989){if(_0x2a2989){return _0x2a2989[_0x39c5('0x2a')](_0x4fb2fc)[_0x39c5('0x2b')](function(_0x3d0c9b){return _0x3d0c9b;});}return null;};}function removeEntity(_0x3b6715,_0xa3f2dc){return function(_0x2c01e2){if(_0x2c01e2){return _0x2c01e2[_0x39c5('0x2c')]()[_0x39c5('0x2b')](function(){var _0x51d122=_0x2c01e2[_0x39c5('0x2d')]({'plain':!![]});var _0x16c1e0=_0x39c5('0x2e');return db[_0x39c5('0x2f')]['destroy']({'where':{'type':_0x16c1e0,'resourceId':_0x51d122['id']}})[_0x39c5('0x2b')](function(){return _0x2c01e2;});})[_0x39c5('0x2b')](function(){_0x3b6715['status'](0xcc)[_0x39c5('0x21')]();});}};}function handleEntityNotFound(_0x555b60,_0x484a26){return function(_0x4eec72){if(!_0x4eec72){_0x555b60[_0x39c5('0x1f')](0x194);}return _0x4eec72;};}function handleError(_0x3df6c2,_0x1219fd){_0x1219fd=_0x1219fd||0x1f4;return function(_0x108db1){logger['error'](_0x108db1[_0x39c5('0x30')]);if(_0x108db1[_0x39c5('0x31')]){delete _0x108db1[_0x39c5('0x31')];}_0x3df6c2[_0x39c5('0x20')](_0x1219fd)['send'](_0x108db1);};}exports[_0x39c5('0x32')]=function(_0x21eb6c,_0x3cca79){var _0x42b961={},_0x1116ee={},_0x47d6e0={'count':0x0,'rows':[]};var _0x36e368=_['map'](db['Plugin'][_0x39c5('0x33')],function(_0xdcd845){return{'name':_0xdcd845[_0x39c5('0x34')],'type':_0xdcd845[_0x39c5('0x35')]['key']};});_0x1116ee[_0x39c5('0x36')]=_[_0x39c5('0x37')](_0x36e368,_0x39c5('0x31'));_0x1116ee[_0x39c5('0x38')]=_[_0x39c5('0x39')](_0x21eb6c[_0x39c5('0x38')]);_0x1116ee['filters']=_[_0x39c5('0x3a')](_0x1116ee[_0x39c5('0x36')],_0x1116ee[_0x39c5('0x38')]);_0x42b961[_0x39c5('0x3b')]=_[_0x39c5('0x3a')](_0x1116ee['model'],qs['fields'](_0x21eb6c['query'][_0x39c5('0x3c')]));_0x42b961[_0x39c5('0x3b')]=_0x42b961[_0x39c5('0x3b')][_0x39c5('0x3d')]?_0x42b961[_0x39c5('0x3b')]:_0x1116ee[_0x39c5('0x36')];if(!_0x21eb6c[_0x39c5('0x38')][_0x39c5('0x3e')](_0x39c5('0x3f'))){_0x42b961[_0x39c5('0x24')]=qs['limit'](_0x21eb6c[_0x39c5('0x38')][_0x39c5('0x24')]);_0x42b961[_0x39c5('0x26')]=qs['offset'](_0x21eb6c[_0x39c5('0x38')]['offset']);}_0x42b961['order']=qs[_0x39c5('0x40')](_0x21eb6c['query'][_0x39c5('0x40')]);_0x42b961[_0x39c5('0x41')]=qs[_0x39c5('0x42')](_['pick'](_0x21eb6c[_0x39c5('0x38')],_0x1116ee[_0x39c5('0x42')]),_0x36e368);if(_0x21eb6c[_0x39c5('0x38')]['filter']){_0x42b961[_0x39c5('0x41')]=_['merge'](_0x42b961[_0x39c5('0x41')],{'$or':_[_0x39c5('0x37')](_0x36e368,function(_0x31fd8e){if(_0x31fd8e[_0x39c5('0x35')]!==_0x39c5('0x43')){var _0x1852c6={};_0x1852c6[_0x31fd8e[_0x39c5('0x31')]]={'$like':'%'+_0x21eb6c[_0x39c5('0x38')][_0x39c5('0x44')]+'%'};return _0x1852c6;}})});}_0x42b961=_[_0x39c5('0x45')]({},_0x42b961,_0x21eb6c[_0x39c5('0x46')]);var _0x2b7802={'where':_0x42b961[_0x39c5('0x41')]};return db[_0x39c5('0x47')][_0x39c5('0x25')](_0x2b7802)['then'](function(_0xdee016){_0x47d6e0['count']=_0xdee016;if(_0x21eb6c[_0x39c5('0x38')][_0x39c5('0x48')]){_0x42b961[_0x39c5('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x39c5('0x4a')](_0x42b961);})[_0x39c5('0x2b')](function(_0x3eaa55){_0x47d6e0[_0x39c5('0x4b')]=_0x3eaa55;return _0x47d6e0;})[_0x39c5('0x2b')](respondWithFilteredResult(_0x3cca79,_0x42b961))[_0x39c5('0x4c')](handleError(_0x3cca79,null));};exports[_0x39c5('0x4d')]=function(_0x1ee134,_0x591c7a){var _0x5bab4b={'raw':!![],'where':{'id':_0x1ee134[_0x39c5('0x4e')]['id']}},_0x915f3e={};_0x915f3e[_0x39c5('0x36')]=_[_0x39c5('0x39')](db[_0x39c5('0x47')][_0x39c5('0x33')]);_0x915f3e[_0x39c5('0x38')]=_[_0x39c5('0x39')](_0x1ee134[_0x39c5('0x38')]);_0x915f3e['filters']=_[_0x39c5('0x3a')](_0x915f3e[_0x39c5('0x36')],_0x915f3e[_0x39c5('0x38')]);_0x5bab4b[_0x39c5('0x3b')]=_['intersection'](_0x915f3e[_0x39c5('0x36')],qs[_0x39c5('0x3c')](_0x1ee134[_0x39c5('0x38')][_0x39c5('0x3c')]));_0x5bab4b[_0x39c5('0x3b')]=_0x5bab4b[_0x39c5('0x3b')][_0x39c5('0x3d')]?_0x5bab4b[_0x39c5('0x3b')]:_0x915f3e[_0x39c5('0x36')];if(_0x1ee134[_0x39c5('0x38')][_0x39c5('0x48')]){_0x5bab4b['include']=[{'all':!![]}];}_0x5bab4b=_[_0x39c5('0x45')]({},_0x5bab4b,_0x1ee134[_0x39c5('0x46')]);return db[_0x39c5('0x47')][_0x39c5('0x4f')](_0x5bab4b)[_0x39c5('0x2b')](handleEntityNotFound(_0x591c7a,null))[_0x39c5('0x2b')](respondWithResult(_0x591c7a,null))[_0x39c5('0x4c')](handleError(_0x591c7a,null));};exports[_0x39c5('0x50')]=function(_0x4676e4,_0x567cca,_0x10e6dc){return db[_0x39c5('0x47')][_0x39c5('0x4f')]({'where':{'id':_0x4676e4['params']['id']},'attributes':[_0x39c5('0x31'),_0x39c5('0x7')],'raw':!![]})[_0x39c5('0x2b')](handleEntityNotFound(_0x567cca,null))[_0x39c5('0x2b')](function(_0x56c455){if(_0x56c455){var _0xb456df=path[_0x39c5('0x51')](config[_0x39c5('0x52')],_0x39c5('0x53'),util['format'](_0x39c5('0x54'),path[_0x39c5('0x55')](_0x56c455[_0x39c5('0x7')])));var _0x22fb1a=fs[_0x39c5('0x56')](_0xb456df);var _0x635f55=archiver(_0x39c5('0x57'),{'zlib':{'level':0x9}});_0x635f55['on'](_0x39c5('0x58'),function(_0x8b50a7){if(_0x8b50a7['code']==='ENOENT'){logger[_0x39c5('0x59')](_0x8b50a7);}else{throw new db['Sequelize'][(_0x39c5('0x5a'))](_0x39c5('0x5b'));}});_0x635f55['on'](_0x39c5('0x59'),function(_0x1450b6){throw new db[(_0x39c5('0x5c'))][(_0x39c5('0x5a'))](_0x39c5('0x5b'));});_0x635f55[_0x39c5('0x5d')](_0x22fb1a);_0x635f55[_0x39c5('0x5e')](_0x39c5('0x5f'),{'cwd':path['join'](config[_0x39c5('0x52')],'server/files/plugins',path[_0x39c5('0x60')](_0x56c455['path'])),'ignore':[path[_0x39c5('0x51')](path[_0x39c5('0x55')](_0x56c455[_0x39c5('0x7')]),_0x39c5('0x61')),path[_0x39c5('0x51')](path[_0x39c5('0x55')](_0x56c455[_0x39c5('0x7')]),_0x39c5('0x62'))],'nodir':!![]})[_0x39c5('0x63')]();_0x22fb1a['on'](_0x39c5('0x64'),function(){if(!fs[_0x39c5('0x65')](_0xb456df)){throw new db[(_0x39c5('0x5c'))]['Error'](_0x39c5('0x66'));}return _0x567cca[_0x39c5('0x50')](_0xb456df,util['format'](_0x39c5('0x54'),path[_0x39c5('0x55')](_0x56c455[_0x39c5('0x7')])),function(_0x2dbd3f){if(_0x2dbd3f){throw new db[(_0x39c5('0x5c'))][(_0x39c5('0x5a'))](_0x39c5('0x67'));}fs[_0x39c5('0x68')](_0xb456df);logger['info'](_0x39c5('0x69'));logger[_0x39c5('0x6a')](_0x39c5('0x6b'));});});}return null;})[_0x39c5('0x4c')](handleError(_0x567cca,null));};exports[_0x39c5('0x6c')]=function(_0x1e38fc,_0x3d095a,_0x4e965b){var _0x934635=path[_0x39c5('0x55')](_0x1e38fc['file'][_0x39c5('0x6d')],path[_0x39c5('0x6e')](_0x1e38fc[_0x39c5('0x6f')][_0x39c5('0x6d')]));var _0xbf05c7=path[_0x39c5('0x51')](config[_0x39c5('0x52')],_0x39c5('0x53'),_0x1e38fc['file']['filename']);var _0x3f3a8b=path[_0x39c5('0x51')](config[_0x39c5('0x52')],_0x39c5('0x53'),_0x934635);logger[_0x39c5('0x6a')](_0x39c5('0x70'),_0xbf05c7);logger[_0x39c5('0x6a')](_0x39c5('0x71'),_0x3f3a8b);try{fs[_0x39c5('0x72')](_0xbf05c7,parseInt(_0x39c5('0x73'),0x8));extract(_0xbf05c7,{'dir':_0x3f3a8b},function(_0x48d812){if(_0x48d812){logger[_0x39c5('0x59')](_0x48d812);handleError(_0x48d812,!![]);};var _0x5102d6=fs[_0x39c5('0x74')](_0x3f3a8b);if(_0x5102d6['length']>0x1){removeReferences(_0xbf05c7,_0x3f3a8b);logger['error'](_0x39c5('0x75'));return _0x4e965b(new Error('Invalid\x20plugin\x20structure'));}var _0x51aa7d=fs[_0x39c5('0x76')](path[_0x39c5('0x51')](_0x3f3a8b,_0x5102d6[0x0]));if(_0x51aa7d[_0x39c5('0x77')]()){removeReferences(_0xbf05c7,_0x3f3a8b);logger[_0x39c5('0x59')](_0x39c5('0x75'));return _0x4e965b(new Error(_0x39c5('0x75')));}if(_0x51aa7d[_0x39c5('0x78')]()){var _0x1c41db=fs[_0x39c5('0x74')](path['join'](_0x3f3a8b,_0x5102d6[0x0]));if(_0x1c41db[_0x39c5('0x3d')]===0x0){removeReferences(_0xbf05c7,_0x3f3a8b);logger['error'](_0x39c5('0x75'));return _0x4e965b(new Error(_0x39c5('0x75')));}var _0x162bbc=_0x1c41db[_0x39c5('0x79')](function(_0x267e40){return _0x267e40===_0x39c5('0x7a');});if(!_0x162bbc){return _0x4e965b(new Error(_0x39c5('0x7b')));}var _0x294b3d=fs['readFileSync'](path['join'](_0x3f3a8b,_0x5102d6[0x0],_0x39c5('0x7a')));var _0x4714da=JSON['parse'](_0x294b3d);if('undefined'==typeof _0x4714da[_0x39c5('0x31')]){return _0x4e965b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x4714da[_0x39c5('0x35')]){return _0x4e965b(new Error(_0x39c5('0x7c')));}if('undefined'==typeof _0x4714da[_0x39c5('0x7d')]){return _0x4e965b(new Error(_0x39c5('0x7e')));}if(_0x39c5('0x23')==typeof _0x4714da[_0x39c5('0x7f')]){return _0x4e965b(new Error(_0x39c5('0x80')));}if(_0x4714da[_0x39c5('0x35')]===_0x39c5('0x81')){if(_0x39c5('0x23')==typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')]){return _0x4e965b(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')][_0x39c5('0x83')]&&_0x39c5('0x23')==typeof _0x4714da['parameters'][_0x39c5('0x82')][_0x39c5('0x84')]){return _0x4e965b(new Error(_0x39c5('0x85')));}}else if(_0x4714da[_0x39c5('0x35')]===_0x39c5('0x86')){if(_0x39c5('0x23')==typeof _0x4714da[_0x39c5('0x7f')]['scriptName']){return _0x4e965b(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x39c5('0x23')==typeof _0x4714da[_0x39c5('0x7f')]['scriptPath']){return _0x4e965b(new Error(_0x39c5('0x87')));}}else{return _0x4e965b(new Error(_0x39c5('0x88')));}var _0xda3528=_0x4714da[_0x39c5('0x31')];var _0x26b4d6=_0x4714da[_0x39c5('0x89')];var _0x32122f=_0x4714da[_0x39c5('0x35')];var _0x8cf245=_0x4714da[_0x39c5('0x8a')]?_0x4714da[_0x39c5('0x8a')]:_0x39c5('0x8b');var _0xed2f69=_0x4714da[_0x39c5('0x8c')]?_0x4714da[_0x39c5('0x8c')]:_0x39c5('0x8d');var _0x21b775='';var _0x5b91a3='';var _0x3164b3='';var _0x5be729='';var _0x71a034=_0x4714da[_0x39c5('0x7d')];if(_0x32122f===_0x39c5('0x81')){if(_0x39c5('0x23')!=typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')][_0x39c5('0x83')]){var _0x3dc5d9=_0x4714da['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x39c5('0x8e')](_0x3dc5d9)){_0x21b775=path[_0x39c5('0x51')]('plugins',_0x934635,_0x5102d6[0x0],_0x3dc5d9);}else{_0x21b775=_0x3dc5d9;}}else{logger[_0x39c5('0x6a')](_0x39c5('0x8f'));}if('undefined'!=typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')][_0x39c5('0x84')]){var _0x2288ec=_0x4714da[_0x39c5('0x7f')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x39c5('0x8e')](_0x2288ec)){_0x5b91a3=path[_0x39c5('0x51')](_0x39c5('0x90'),_0x934635,_0x5102d6[0x0],_0x2288ec);}else{_0x5b91a3=_0x2288ec;}}else{logger[_0x39c5('0x6a')](_0x39c5('0x91'));}}else if(_0x32122f===_0x39c5('0x86')){_0x3164b3=_0x4714da[_0x39c5('0x7f')]['scriptName'];_0x5be729=_0x4714da[_0x39c5('0x7f')][_0x39c5('0x92')];if(_0x39c5('0x23')!=typeof _0x4714da[_0x39c5('0x7f')]['views']){if(_0x39c5('0x23')!=typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')][_0x39c5('0x83')]){var _0x3dc5d9=_0x4714da['parameters'][_0x39c5('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x39c5('0x8e')](_0x3dc5d9)){_0x21b775=path['join']('plugins',_0x934635,_0x5102d6[0x0],_0x3dc5d9);}else{_0x21b775=_0x3dc5d9;}}if(_0x39c5('0x23')!=typeof _0x4714da[_0x39c5('0x7f')][_0x39c5('0x82')][_0x39c5('0x84')]){var _0x2288ec=_0x4714da[_0x39c5('0x7f')]['views'][_0x39c5('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2288ec)){_0x5b91a3=path[_0x39c5('0x51')](_0x39c5('0x90'),_0x934635,_0x5102d6[0x0],_0x2288ec);}else{_0x5b91a3=_0x2288ec;}}}}var _0x144a51={'name':_0xda3528,'description':_0x26b4d6,'path':path[_0x39c5('0x51')](_0x934635,_0x5102d6[0x0]),'type':_0x32122f,'sidebar':_0x8cf245,'icon':_0xed2f69,'adminUrl':_0x21b775,'agentUrl':_0x5b91a3,'scriptName':_0x3164b3,'scriptPath':_0x5be729,'version':_0x71a034};removeReferences(_0xbf05c7,null);return db[_0x39c5('0x47')][_0x39c5('0x93')](_0x144a51)[_0x39c5('0x2b')](function(_0x47d3ca){var _0x297895={'role':_0x1e38fc[_0x39c5('0x94')][_0x39c5('0x95')],'userProfileId':_0x1e38fc[_0x39c5('0x94')][_0x39c5('0x96')]};if(!_0x297895)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x297895['role']===_0x39c5('0x97')){var _0x3979b0=_0x47d3ca[_0x39c5('0x2d')]({'plain':!![]});return db[_0x39c5('0x98')][_0x39c5('0x4f')]({'where':{'name':_0x39c5('0x2e'),'userProfileId':_0x297895['userProfileId']},'raw':!![]})['then'](function(_0x1dd375){if(_0x1dd375&&_0x1dd375[_0x39c5('0x99')]===0x0){return db['UserProfileResource']['create']({'name':_0x3979b0[_0x39c5('0x31')],'resourceId':_0x3979b0['id'],'type':_0x1dd375['name'],'sectionId':_0x1dd375['id']},{})['then'](function(){return _0x47d3ca;});}else{return _0x47d3ca;}})[_0x39c5('0x4c')](function(_0x5eda0d){logger[_0x39c5('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eda0d);throw _0x5eda0d;});}return _0x47d3ca;})[_0x39c5('0x2b')](respondWithResult(_0x3d095a,null))[_0x39c5('0x4c')](handleError(_0x3d095a,null));}});}catch(_0x35a9af){_0x3d095a['status'](0x1f4)[_0x39c5('0x9a')](_0x35a9af);}};function removeReferences(_0x12c356,_0x35183d){try{if(_0x12c356){fs[_0x39c5('0x68')](_0x12c356);logger[_0x39c5('0x6a')](_0x39c5('0x9b'));}if(_0x35183d){rimraf(_0x35183d,function(){});logger[_0x39c5('0x6a')](_0x39c5('0x9c'));}}catch(_0x23112f){logger[_0x39c5('0x59')](_0x23112f);}}exports[_0x39c5('0x2a')]=function(_0x1a9177,_0x5cc6f3,_0x5b6f1e){return db['Plugin']['find']({'where':{'id':_0x1a9177['params']['id']}})[_0x39c5('0x2b')](handleEntityNotFound(_0x5cc6f3,null))[_0x39c5('0x2b')](saveUpdates(_0x1a9177[_0x39c5('0x94')],null))[_0x39c5('0x2b')](respondWithResult(_0x5cc6f3,null))['catch'](handleError(_0x5cc6f3,null));};exports[_0x39c5('0x9d')]=function(_0xc1182f,_0x2febba,_0xe65e65){return db[_0x39c5('0x47')]['find']({'where':{'id':_0xc1182f[_0x39c5('0x4e')]['id']}})[_0x39c5('0x2b')](function(_0x19b0ca){if(_0x19b0ca){return _0x19b0ca[_0x39c5('0x2c')]();}})['then'](function(_0x531613){rimraf(path[_0x39c5('0x51')](config['root'],'server/files/plugins',path['dirname'](_0x531613['path'])),function(){});return _0x531613;})[_0x39c5('0x2b')](handleEntityNotFound(_0x2febba,null))[_0x39c5('0x2b')](respondWithStatusCode(_0x2febba,null))[_0x39c5('0x4c')](handleError(_0x2febba,null));};exports[_0x39c5('0x9e')]=function(_0x5b6310,_0x2d312f,_0x658748){return BPromise[_0x39c5('0x9f')]()[_0x39c5('0x2b')](function(){if(!_0x5b6310[_0x39c5('0x38')][_0x39c5('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5b6310[_0x39c5('0x38')]['port']){throw new Error(_0x39c5('0xa0'));}var _0x479dc0=_0x5b6310[_0x39c5('0x38')][_0x39c5('0xa1')]?_0x5b6310[_0x39c5('0x38')][_0x39c5('0xa1')]+':'+_0x5b6310['query'][_0x39c5('0xa2')]:'http://localhost:'+_0x5b6310[_0x39c5('0x38')][_0x39c5('0xa2')];var _0xc57130=_0x5b6310[_0x39c5('0x38')][_0x39c5('0x22')]?_0x5b6310['query'][_0x39c5('0x22')]:!![];var _0x973414=_0x5b6310['query'][_0x39c5('0xa3')]?_0x5b6310[_0x39c5('0x38')][_0x39c5('0xa3')]:null;var _0x491493={'method':_0x5b6310[_0x39c5('0xa4')],'uri':util[_0x39c5('0xa5')](_0x39c5('0xa6'),_0x479dc0,_0x5b6310[_0x39c5('0x38')][_0x39c5('0x7')]),'json':_0xc57130,'resolveWithFullResponse':!![],'encoding':_0x973414,'qs':_0x5b6310[_0x39c5('0x38')]};if(_0x5b6310[_0x39c5('0xa7')]){_0x491493['headers']=_0x5b6310['headers'];if(_0x491493[_0x39c5('0xa7')]['content-length']){delete _0x491493[_0x39c5('0xa7')][_0x39c5('0xa8')];}}if(_0x491493[_0x39c5('0xa7')][_0x39c5('0xa9')]){delete _0x491493['headers'][_0x39c5('0xa9')];}return rp(_0x491493);})[_0x39c5('0x2b')](function(_0x2c4d56){if(_0x2c4d56){_0x2d312f[_0x39c5('0x27')](_0x2c4d56[_0x39c5('0xa7')]);logger[_0x39c5('0x6a')](_0x2c4d56[_0x39c5('0x94')]);if(_[_0x39c5('0xaa')](_0x5b6310[_0x39c5('0x38')][_0x39c5('0x7')],_0x39c5('0x50'))&&_0x2c4d56[_0x39c5('0xab')]==0x1f4){return _0x2d312f[_0x39c5('0x1f')](_0x2c4d56['statusCode']);}else{return _0x2d312f['status'](_0x2c4d56[_0x39c5('0xab')])[_0x39c5('0x9a')](_0x2c4d56[_0x39c5('0x94')]);}}else{return _0x2d312f[_0x39c5('0x1f')](0xc8);}})[_0x39c5('0x4c')](handleError(_0x2d312f,null));};exports[_0x39c5('0xac')]=function(_0x1d7b43,_0x5e32c3,_0x451956){return BPromise[_0x39c5('0x9f')]()['then'](function(){if(!_0x1d7b43[_0x39c5('0x38')][_0x39c5('0x7')]){throw new Error(_0x39c5('0xad'));}if(!_0x1d7b43[_0x39c5('0x38')]['port']){throw new Error(_0x39c5('0xa0'));}var _0x2865ad=_0x1d7b43[_0x39c5('0x38')][_0x39c5('0xa1')]?_0x1d7b43[_0x39c5('0x38')]['hostname']+':'+_0x1d7b43[_0x39c5('0x38')]['port']:_0x39c5('0xae')+_0x1d7b43[_0x39c5('0x38')][_0x39c5('0xa2')];var _0xaab473=_0x1d7b43[_0x39c5('0x38')]['json']?_0x1d7b43['query']['json']:!![];var _0xc05829=_0x1d7b43[_0x39c5('0x38')]['encoding']?_0x1d7b43[_0x39c5('0x38')][_0x39c5('0xa3')]:null;var _0x61662c={'method':_0x1d7b43[_0x39c5('0xa4')],'uri':util[_0x39c5('0xa5')](_0x39c5('0xa6'),_0x2865ad,_0x1d7b43['query'][_0x39c5('0x7')]),'json':_0xaab473,'resolveWithFullResponse':!![],'encoding':_0xc05829,'body':_0x1d7b43['body']};if(_0x1d7b43[_0x39c5('0xa7')]){_0x61662c[_0x39c5('0xa7')]=_0x1d7b43['headers'];if(_0x61662c[_0x39c5('0xa7')][_0x39c5('0xa8')]){delete _0x61662c[_0x39c5('0xa7')][_0x39c5('0xa8')];}}if(_0x61662c['headers']['content-type']){delete _0x61662c[_0x39c5('0xa7')]['content-type'];}return rp(_0x61662c);})[_0x39c5('0x2b')](function(_0x1e8ea9){if(_0x1e8ea9){_0x5e32c3[_0x39c5('0x27')](_0x1e8ea9[_0x39c5('0xa7')]);logger[_0x39c5('0x6a')](_0x1e8ea9['body']);return _0x5e32c3['status'](_0x1e8ea9['statusCode'])[_0x39c5('0x9a')](_0x1e8ea9[_0x39c5('0x94')]);}else{return _0x5e32c3[_0x39c5('0x1f')](0xc8);}})['catch'](handleError(_0x5e32c3,null));}; \ No newline at end of file +var _0x3e40=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','join','dirname','close','existsSync','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x3e40,0x1e7));var _0x03e4=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x3e40[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x03e4('0x0'));var rimraf=require(_0x03e4('0x1'));var zipdir=require(_0x03e4('0x2'));var jsonpatch=require(_0x03e4('0x3'));var rp=require(_0x03e4('0x4'));var moment=require(_0x03e4('0x5'));var BPromise=require(_0x03e4('0x6'));var Mustache=require(_0x03e4('0x7'));var util=require(_0x03e4('0x8'));var path=require(_0x03e4('0x9'));var sox=require(_0x03e4('0xa'));var csv=require('to-csv');var ejs=require(_0x03e4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x03e4('0xc'));var deskjs=require(_0x03e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03e4('0xe'));var extract=require('extract-zip');var rimraf=require(_0x03e4('0x1'));var archiver=require(_0x03e4('0xf'));var Redis=require(_0x03e4('0x10'));var authService=require(_0x03e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x03e4('0x12'));var hardwareService=require(_0x03e4('0x13'));var logger=require(_0x03e4('0x14'))(_0x03e4('0x15'));var utils=require(_0x03e4('0x16'));var config=require(_0x03e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x03e4('0x18'))['db'];config['redis']=_[_0x03e4('0x19')](config[_0x03e4('0x1a')],{'host':_0x03e4('0x1b'),'port':0x18eb});var socket=require(_0x03e4('0x1c'))(new Redis(config[_0x03e4('0x1a')]));require(_0x03e4('0x1d'))[_0x03e4('0x1e')](socket);function respondWithStatusCode(_0x328161,_0x1447f5){_0x1447f5=_0x1447f5||0xcc;return function(_0x4dbecf){if(_0x4dbecf){return _0x328161[_0x03e4('0x1f')](_0x1447f5);}return _0x328161[_0x03e4('0x20')](_0x1447f5)[_0x03e4('0x21')]();};}function respondWithResult(_0x3f9fd9,_0x5a53a3){_0x5a53a3=_0x5a53a3||0xc8;return function(_0x7b85cb){if(_0x7b85cb){return _0x3f9fd9[_0x03e4('0x20')](_0x5a53a3)[_0x03e4('0x22')](_0x7b85cb);}};}function respondWithFilteredResult(_0x52438b,_0x2a4fa5){return function(_0x579771){if(_0x579771){var _0x2e8ec4=typeof _0x2a4fa5[_0x03e4('0x23')]===_0x03e4('0x24')&&typeof _0x2a4fa5[_0x03e4('0x25')]===_0x03e4('0x24');var _0x3a4c82=_0x579771[_0x03e4('0x26')];var _0x49ac14=_0x2e8ec4?0x0:_0x2a4fa5[_0x03e4('0x23')];var _0x18e6ca=_0x2e8ec4?_0x579771['count']:_0x2a4fa5[_0x03e4('0x23')]+_0x2a4fa5[_0x03e4('0x25')];var _0x487d1c;if(_0x18e6ca>=_0x3a4c82){_0x18e6ca=_0x3a4c82;_0x487d1c=0xc8;}else{_0x487d1c=0xce;}_0x52438b[_0x03e4('0x20')](_0x487d1c);return _0x52438b[_0x03e4('0x27')](_0x03e4('0x28'),_0x49ac14+'-'+_0x18e6ca+'/'+_0x3a4c82)['json'](_0x579771);}return null;};}function patchUpdates(_0x3039ab){return function(_0x167a57){try{jsonpatch[_0x03e4('0x29')](_0x167a57,_0x3039ab,!![]);}catch(_0x51ebc8){return BPromise['reject'](_0x51ebc8);}return _0x167a57[_0x03e4('0x2a')]();};}function saveUpdates(_0xb0b920,_0x11d583){return function(_0x8122f9){if(_0x8122f9){return _0x8122f9[_0x03e4('0x2b')](_0xb0b920)['then'](function(_0x215684){return _0x215684;});}return null;};}function removeEntity(_0xa1cad0,_0x5d0345){return function(_0x143fee){if(_0x143fee){return _0x143fee[_0x03e4('0x2c')]()[_0x03e4('0x2d')](function(){var _0x21127c=_0x143fee[_0x03e4('0x2e')]({'plain':!![]});var _0x1aa073=_0x03e4('0x2f');return db[_0x03e4('0x30')][_0x03e4('0x2c')]({'where':{'type':_0x1aa073,'resourceId':_0x21127c['id']}})[_0x03e4('0x2d')](function(){return _0x143fee;});})[_0x03e4('0x2d')](function(){_0xa1cad0[_0x03e4('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc02d,_0x41a0b5){return function(_0x30a7cc){if(!_0x30a7cc){_0x3fc02d[_0x03e4('0x1f')](0x194);}return _0x30a7cc;};}function handleError(_0x188a1b,_0x594f53){_0x594f53=_0x594f53||0x1f4;return function(_0x324c33){logger[_0x03e4('0x31')](_0x324c33[_0x03e4('0x32')]);if(_0x324c33[_0x03e4('0x33')]){delete _0x324c33[_0x03e4('0x33')];}_0x188a1b[_0x03e4('0x20')](_0x594f53)[_0x03e4('0x34')](_0x324c33);};}exports[_0x03e4('0x35')]=function(_0x417fc3,_0x3f1750){var _0x36b0e7={},_0x552f91={},_0x3ab507={'count':0x0,'rows':[]};var _0x5d6f49=_['map'](db[_0x03e4('0x36')][_0x03e4('0x37')],function(_0x1004a7){return{'name':_0x1004a7[_0x03e4('0x38')],'type':_0x1004a7[_0x03e4('0x39')]['key']};});_0x552f91['model']=_[_0x03e4('0x3a')](_0x5d6f49,_0x03e4('0x33'));_0x552f91['query']=_[_0x03e4('0x3b')](_0x417fc3[_0x03e4('0x3c')]);_0x552f91[_0x03e4('0x3d')]=_[_0x03e4('0x3e')](_0x552f91[_0x03e4('0x3f')],_0x552f91['query']);_0x36b0e7[_0x03e4('0x40')]=_[_0x03e4('0x3e')](_0x552f91[_0x03e4('0x3f')],qs[_0x03e4('0x41')](_0x417fc3[_0x03e4('0x3c')]['fields']));_0x36b0e7['attributes']=_0x36b0e7[_0x03e4('0x40')][_0x03e4('0x42')]?_0x36b0e7['attributes']:_0x552f91[_0x03e4('0x3f')];if(!_0x417fc3[_0x03e4('0x3c')][_0x03e4('0x43')](_0x03e4('0x44'))){_0x36b0e7[_0x03e4('0x25')]=qs[_0x03e4('0x25')](_0x417fc3['query'][_0x03e4('0x25')]);_0x36b0e7[_0x03e4('0x23')]=qs[_0x03e4('0x23')](_0x417fc3['query'][_0x03e4('0x23')]);}_0x36b0e7[_0x03e4('0x45')]=qs['sort'](_0x417fc3[_0x03e4('0x3c')]['sort']);_0x36b0e7[_0x03e4('0x46')]=qs[_0x03e4('0x3d')](_[_0x03e4('0x47')](_0x417fc3[_0x03e4('0x3c')],_0x552f91[_0x03e4('0x3d')]),_0x5d6f49);if(_0x417fc3[_0x03e4('0x3c')][_0x03e4('0x48')]){_0x36b0e7['where']=_['merge'](_0x36b0e7[_0x03e4('0x46')],{'$or':_[_0x03e4('0x3a')](_0x5d6f49,function(_0x3181d7){if(_0x3181d7[_0x03e4('0x39')]!==_0x03e4('0x49')){var _0x13a8d7={};_0x13a8d7[_0x3181d7['name']]={'$like':'%'+_0x417fc3['query'][_0x03e4('0x48')]+'%'};return _0x13a8d7;}})});}_0x36b0e7=_['merge']({},_0x36b0e7,_0x417fc3['options']);var _0x3c0944={'where':_0x36b0e7[_0x03e4('0x46')]};return db[_0x03e4('0x36')][_0x03e4('0x26')](_0x3c0944)[_0x03e4('0x2d')](function(_0x2c6fdc){_0x3ab507[_0x03e4('0x26')]=_0x2c6fdc;if(_0x417fc3[_0x03e4('0x3c')][_0x03e4('0x4a')]){_0x36b0e7['include']=[{'all':!![]}];}return db[_0x03e4('0x36')][_0x03e4('0x4b')](_0x36b0e7);})[_0x03e4('0x2d')](function(_0x55e79b){_0x3ab507[_0x03e4('0x4c')]=_0x55e79b;return _0x3ab507;})[_0x03e4('0x2d')](respondWithFilteredResult(_0x3f1750,_0x36b0e7))[_0x03e4('0x4d')](handleError(_0x3f1750,null));};exports[_0x03e4('0x4e')]=function(_0x35d465,_0x372e02){var _0x517304={'raw':!![],'where':{'id':_0x35d465[_0x03e4('0x4f')]['id']}},_0x2937bf={};_0x2937bf[_0x03e4('0x3f')]=_[_0x03e4('0x3b')](db[_0x03e4('0x36')][_0x03e4('0x37')]);_0x2937bf[_0x03e4('0x3c')]=_[_0x03e4('0x3b')](_0x35d465[_0x03e4('0x3c')]);_0x2937bf[_0x03e4('0x3d')]=_[_0x03e4('0x3e')](_0x2937bf[_0x03e4('0x3f')],_0x2937bf[_0x03e4('0x3c')]);_0x517304[_0x03e4('0x40')]=_[_0x03e4('0x3e')](_0x2937bf[_0x03e4('0x3f')],qs[_0x03e4('0x41')](_0x35d465[_0x03e4('0x3c')][_0x03e4('0x41')]));_0x517304['attributes']=_0x517304['attributes']['length']?_0x517304[_0x03e4('0x40')]:_0x2937bf[_0x03e4('0x3f')];if(_0x35d465[_0x03e4('0x3c')][_0x03e4('0x4a')]){_0x517304[_0x03e4('0x50')]=[{'all':!![]}];}_0x517304=_[_0x03e4('0x51')]({},_0x517304,_0x35d465['options']);return db[_0x03e4('0x36')][_0x03e4('0x52')](_0x517304)['then'](handleEntityNotFound(_0x372e02,null))[_0x03e4('0x2d')](respondWithResult(_0x372e02,null))[_0x03e4('0x4d')](handleError(_0x372e02,null));};exports[_0x03e4('0x53')]=function(_0x1f065b,_0x122bf2,_0x1c116f){return db['Plugin'][_0x03e4('0x52')]({'where':{'id':_0x1f065b[_0x03e4('0x4f')]['id']},'attributes':[_0x03e4('0x33'),_0x03e4('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x122bf2,null))[_0x03e4('0x2d')](function(_0x285ba1){if(_0x285ba1){var _0x464386=path['join'](config[_0x03e4('0x54')],_0x03e4('0x55'),util[_0x03e4('0x56')](_0x03e4('0x57'),path[_0x03e4('0x58')](_0x285ba1[_0x03e4('0x9')])));var _0x553fef=fs[_0x03e4('0x59')](_0x464386);var _0x57899c=archiver('zip',{'zlib':{'level':0x9}});_0x57899c['on'](_0x03e4('0x5a'),function(_0x43d2f1){if(_0x43d2f1[_0x03e4('0x5b')]==='ENOENT'){logger[_0x03e4('0x31')](_0x43d2f1);}else{throw new db['Sequelize'][(_0x03e4('0x5c'))](_0x03e4('0x5d'));}});_0x57899c['on'](_0x03e4('0x31'),function(_0x5b4b02){throw new db[(_0x03e4('0x5e'))][(_0x03e4('0x5c'))](_0x03e4('0x5d'));});_0x57899c[_0x03e4('0x5f')](_0x553fef);_0x57899c[_0x03e4('0x60')](_0x03e4('0x61'),{'cwd':path[_0x03e4('0x62')](config[_0x03e4('0x54')],_0x03e4('0x55'),path[_0x03e4('0x63')](_0x285ba1[_0x03e4('0x9')])),'ignore':[path[_0x03e4('0x62')](path[_0x03e4('0x58')](_0x285ba1[_0x03e4('0x9')]),'node_modules/**/*'),path[_0x03e4('0x62')](path[_0x03e4('0x58')](_0x285ba1[_0x03e4('0x9')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x553fef['on'](_0x03e4('0x64'),function(){if(!fs[_0x03e4('0x65')](_0x464386)){throw new db[(_0x03e4('0x5e'))][(_0x03e4('0x5c'))]('Plugin\x20not\x20found');}return _0x122bf2[_0x03e4('0x53')](_0x464386,util[_0x03e4('0x56')](_0x03e4('0x57'),path[_0x03e4('0x58')](_0x285ba1[_0x03e4('0x9')])),function(_0x50b6e8){if(_0x50b6e8){throw new db[(_0x03e4('0x5e'))][(_0x03e4('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x03e4('0x66')](_0x464386);logger[_0x03e4('0x67')](_0x03e4('0x68'));logger[_0x03e4('0x67')](_0x03e4('0x69'));});});}return null;})['catch'](handleError(_0x122bf2,null));};exports[_0x03e4('0x6a')]=function(_0x390909,_0xf20e4a,_0x547a79){var _0x15a3e7=path[_0x03e4('0x58')](_0x390909[_0x03e4('0x6b')][_0x03e4('0x6c')],path[_0x03e4('0x6d')](_0x390909[_0x03e4('0x6b')][_0x03e4('0x6c')]));var _0xcf35fa=path[_0x03e4('0x62')](config[_0x03e4('0x54')],_0x03e4('0x55'),_0x390909[_0x03e4('0x6b')][_0x03e4('0x6c')]);var _0x1ee7b3=path['join'](config[_0x03e4('0x54')],'server/files/plugins',_0x15a3e7);logger[_0x03e4('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0xcf35fa);logger['info'](_0x03e4('0x6e'),_0x1ee7b3);try{fs['chmodSync'](_0xcf35fa,parseInt(_0x03e4('0x6f'),0x8));extract(_0xcf35fa,{'dir':_0x1ee7b3},function(_0x50e7c7){if(_0x50e7c7){logger[_0x03e4('0x31')](_0x50e7c7);handleError(_0x50e7c7,!![]);};var _0x6670b8=fs['readdirSync'](_0x1ee7b3);if(_0x6670b8[_0x03e4('0x42')]>0x1){removeReferences(_0xcf35fa,_0x1ee7b3);logger[_0x03e4('0x31')](_0x03e4('0x70'));return _0x547a79(new Error('Invalid\x20plugin\x20structure'));}var _0x3e91da=fs[_0x03e4('0x71')](path['join'](_0x1ee7b3,_0x6670b8[0x0]));if(_0x3e91da[_0x03e4('0x72')]()){removeReferences(_0xcf35fa,_0x1ee7b3);logger[_0x03e4('0x31')](_0x03e4('0x70'));return _0x547a79(new Error('Invalid\x20plugin\x20structure'));}if(_0x3e91da[_0x03e4('0x73')]()){var _0x5cb6ab=fs['readdirSync'](path['join'](_0x1ee7b3,_0x6670b8[0x0]));if(_0x5cb6ab[_0x03e4('0x42')]===0x0){removeReferences(_0xcf35fa,_0x1ee7b3);logger[_0x03e4('0x31')]('Invalid\x20plugin\x20structure');return _0x547a79(new Error(_0x03e4('0x70')));}var _0x5a7de8=_0x5cb6ab[_0x03e4('0x74')](function(_0x15483a){return _0x15483a==='manifest.json';});if(!_0x5a7de8){return _0x547a79(new Error(_0x03e4('0x75')));}var _0x34b86a=fs[_0x03e4('0x76')](path[_0x03e4('0x62')](_0x1ee7b3,_0x6670b8[0x0],_0x03e4('0x77')));var _0x45f6be=JSON[_0x03e4('0x78')](_0x34b86a);if('undefined'==typeof _0x45f6be[_0x03e4('0x33')]){return _0x547a79(new Error(_0x03e4('0x79')));}if(_0x03e4('0x24')==typeof _0x45f6be['type']){return _0x547a79(new Error(_0x03e4('0x7a')));}if(_0x03e4('0x24')==typeof _0x45f6be[_0x03e4('0x7b')]){return _0x547a79(new Error(_0x03e4('0x7c')));}if(_0x03e4('0x24')==typeof _0x45f6be[_0x03e4('0x7d')]){return _0x547a79(new Error(_0x03e4('0x7e')));}if(_0x45f6be[_0x03e4('0x39')]===_0x03e4('0x7f')){if('undefined'==typeof _0x45f6be['parameters'][_0x03e4('0x80')]){return _0x547a79(new Error(_0x03e4('0x81')));}if('undefined'==typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')][_0x03e4('0x82')]&&_0x03e4('0x24')==typeof _0x45f6be[_0x03e4('0x7d')]['views'][_0x03e4('0x83')]){return _0x547a79(new Error(_0x03e4('0x84')));}}else if(_0x45f6be[_0x03e4('0x39')]===_0x03e4('0x85')){if('undefined'==typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x86')]){return _0x547a79(new Error(_0x03e4('0x87')));}if(_0x03e4('0x24')==typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x88')]){return _0x547a79(new Error(_0x03e4('0x89')));}}else{return _0x547a79(new Error(_0x03e4('0x8a')));}var _0x15b441=_0x45f6be[_0x03e4('0x33')];var _0x254a99=_0x45f6be[_0x03e4('0x8b')];var _0xdd3dfb=_0x45f6be[_0x03e4('0x39')];var _0x27102b=_0x45f6be['sidebar']?_0x45f6be[_0x03e4('0x8c')]:_0x03e4('0x8d');var _0x59167a=_0x45f6be['icon']?_0x45f6be[_0x03e4('0x8e')]:_0x03e4('0x8f');var _0x3cc15d='';var _0x228b1b='';var _0x23dcd1='';var _0x3aa72d='';var _0x258c75=_0x45f6be['version'];if(_0xdd3dfb===_0x03e4('0x7f')){if('undefined'!=typeof _0x45f6be[_0x03e4('0x7d')]['views'][_0x03e4('0x82')]){var _0x27fd5e=_0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x27fd5e)){_0x3cc15d=path[_0x03e4('0x62')]('plugins',_0x15a3e7,_0x6670b8[0x0],_0x27fd5e);}else{_0x3cc15d=_0x27fd5e;}}else{logger[_0x03e4('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x03e4('0x24')!=typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')][_0x03e4('0x83')]){var _0x71ab13=_0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x03e4('0x90')](_0x71ab13)){_0x228b1b=path['join'](_0x03e4('0x91'),_0x15a3e7,_0x6670b8[0x0],_0x71ab13);}else{_0x228b1b=_0x71ab13;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xdd3dfb===_0x03e4('0x85')){_0x23dcd1=_0x45f6be[_0x03e4('0x7d')][_0x03e4('0x86')];_0x3aa72d=_0x45f6be[_0x03e4('0x7d')][_0x03e4('0x88')];if(_0x03e4('0x24')!=typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')]){if(_0x03e4('0x24')!=typeof _0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')][_0x03e4('0x82')]){var _0x27fd5e=_0x45f6be[_0x03e4('0x7d')][_0x03e4('0x80')][_0x03e4('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x27fd5e)){_0x3cc15d=path[_0x03e4('0x62')]('plugins',_0x15a3e7,_0x6670b8[0x0],_0x27fd5e);}else{_0x3cc15d=_0x27fd5e;}}if(_0x03e4('0x24')!=typeof _0x45f6be['parameters'][_0x03e4('0x80')][_0x03e4('0x83')]){var _0x71ab13=_0x45f6be['parameters'][_0x03e4('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x71ab13)){_0x228b1b=path['join'](_0x03e4('0x91'),_0x15a3e7,_0x6670b8[0x0],_0x71ab13);}else{_0x228b1b=_0x71ab13;}}}}var _0xeddaaf={'name':_0x15b441,'description':_0x254a99,'path':path['join'](_0x15a3e7,_0x6670b8[0x0]),'type':_0xdd3dfb,'sidebar':_0x27102b,'icon':_0x59167a,'adminUrl':_0x3cc15d,'agentUrl':_0x228b1b,'scriptName':_0x23dcd1,'scriptPath':_0x3aa72d,'version':_0x258c75};removeReferences(_0xcf35fa,null);return db[_0x03e4('0x36')][_0x03e4('0x92')](_0xeddaaf)[_0x03e4('0x2d')](function(_0x2dcf89){var _0x541e1c={'role':_0x390909['body'][_0x03e4('0x93')],'userProfileId':_0x390909['body']['userProfileId']};if(!_0x541e1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x541e1c[_0x03e4('0x93')]==='user'){var _0x309fd0=_0x2dcf89['get']({'plain':!![]});return db[_0x03e4('0x94')][_0x03e4('0x52')]({'where':{'name':_0x03e4('0x2f'),'userProfileId':_0x541e1c[_0x03e4('0x95')]},'raw':!![]})['then'](function(_0x218189){if(_0x218189&&_0x218189[_0x03e4('0x96')]===0x0){return db[_0x03e4('0x30')][_0x03e4('0x92')]({'name':_0x309fd0[_0x03e4('0x33')],'resourceId':_0x309fd0['id'],'type':_0x218189['name'],'sectionId':_0x218189['id']},{})['then'](function(){return _0x2dcf89;});}else{return _0x2dcf89;}})['catch'](function(_0x417e50){logger[_0x03e4('0x31')](_0x03e4('0x97'),_0x417e50);throw _0x417e50;});}return _0x2dcf89;})[_0x03e4('0x2d')](respondWithResult(_0xf20e4a,null))['catch'](handleError(_0xf20e4a,null));}});}catch(_0x3d0698){_0xf20e4a[_0x03e4('0x20')](0x1f4)[_0x03e4('0x34')](_0x3d0698);}};function removeReferences(_0x1a9b21,_0x23a577){try{if(_0x1a9b21){fs[_0x03e4('0x66')](_0x1a9b21);logger[_0x03e4('0x67')](_0x03e4('0x98'));}if(_0x23a577){rimraf(_0x23a577,function(){});logger[_0x03e4('0x67')](_0x03e4('0x99'));}}catch(_0x298438){logger['error'](_0x298438);}}exports[_0x03e4('0x2b')]=function(_0x418db3,_0x89076d,_0x5edc7a){return db['Plugin'][_0x03e4('0x52')]({'where':{'id':_0x418db3['params']['id']}})[_0x03e4('0x2d')](handleEntityNotFound(_0x89076d,null))[_0x03e4('0x2d')](saveUpdates(_0x418db3[_0x03e4('0x9a')],null))[_0x03e4('0x2d')](respondWithResult(_0x89076d,null))[_0x03e4('0x4d')](handleError(_0x89076d,null));};exports['delete']=function(_0x45ecb2,_0x1dd7e1,_0x3db092){return db[_0x03e4('0x36')][_0x03e4('0x52')]({'where':{'id':_0x45ecb2['params']['id']}})[_0x03e4('0x2d')](function(_0x5480bb){if(_0x5480bb){return _0x5480bb[_0x03e4('0x2c')]();}})[_0x03e4('0x2d')](function(_0x170187){rimraf(path[_0x03e4('0x62')](config['root'],_0x03e4('0x55'),path[_0x03e4('0x63')](_0x170187['path'])),function(){});return _0x170187;})[_0x03e4('0x2d')](handleEntityNotFound(_0x1dd7e1,null))[_0x03e4('0x2d')](respondWithStatusCode(_0x1dd7e1,null))['catch'](handleError(_0x1dd7e1,null));};exports[_0x03e4('0x9b')]=function(_0x22400f,_0x528779,_0x312333){return BPromise[_0x03e4('0x9c')]()[_0x03e4('0x2d')](function(){if(!_0x22400f['query']['path']){throw new Error(_0x03e4('0x9d'));}if(!_0x22400f[_0x03e4('0x3c')][_0x03e4('0x9e')]){throw new Error(_0x03e4('0x9f'));}var _0x15d8bf=_0x22400f[_0x03e4('0x3c')][_0x03e4('0xa0')]?_0x22400f[_0x03e4('0x3c')][_0x03e4('0xa0')]+':'+_0x22400f[_0x03e4('0x3c')][_0x03e4('0x9e')]:_0x03e4('0xa1')+_0x22400f[_0x03e4('0x3c')][_0x03e4('0x9e')];var _0x4e8db5=_0x22400f[_0x03e4('0x3c')]['json']?_0x22400f[_0x03e4('0x3c')][_0x03e4('0x22')]:!![];var _0x3c140e=_0x22400f[_0x03e4('0x3c')][_0x03e4('0xa2')]?_0x22400f[_0x03e4('0x3c')][_0x03e4('0xa2')]:null;var _0x461cb5={'method':_0x22400f[_0x03e4('0xa3')],'uri':util[_0x03e4('0x56')](_0x03e4('0xa4'),_0x15d8bf,_0x22400f['query'][_0x03e4('0x9')]),'json':_0x4e8db5,'resolveWithFullResponse':!![],'encoding':_0x3c140e,'qs':_0x22400f[_0x03e4('0x3c')]};if(_0x22400f['headers']){_0x461cb5['headers']=_0x22400f[_0x03e4('0xa5')];if(_0x461cb5['headers'][_0x03e4('0xa6')]){delete _0x461cb5[_0x03e4('0xa5')][_0x03e4('0xa6')];}}if(_0x461cb5['headers'][_0x03e4('0xa7')]){delete _0x461cb5[_0x03e4('0xa5')]['content-type'];}return rp(_0x461cb5);})[_0x03e4('0x2d')](function(_0x19964c){if(_0x19964c){_0x528779['set'](_0x19964c['headers']);logger[_0x03e4('0x67')](_0x19964c['body']);if(_['endsWith'](_0x22400f['query']['path'],_0x03e4('0x53'))&&_0x19964c[_0x03e4('0xa8')]==0x1f4){return _0x528779['sendStatus'](_0x19964c['statusCode']);}else{return _0x528779[_0x03e4('0x20')](_0x19964c['statusCode'])[_0x03e4('0x34')](_0x19964c[_0x03e4('0x9a')]);}}else{return _0x528779['sendStatus'](0xc8);}})[_0x03e4('0x4d')](handleError(_0x528779,null));};exports[_0x03e4('0xa9')]=function(_0x208b71,_0x24621b,_0x121fc9){return BPromise[_0x03e4('0x9c')]()['then'](function(){if(!_0x208b71[_0x03e4('0x3c')][_0x03e4('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x208b71[_0x03e4('0x3c')]['port']){throw new Error(_0x03e4('0x9f'));}var _0x557b6b=_0x208b71[_0x03e4('0x3c')][_0x03e4('0xa0')]?_0x208b71['query'][_0x03e4('0xa0')]+':'+_0x208b71['query'][_0x03e4('0x9e')]:_0x03e4('0xa1')+_0x208b71[_0x03e4('0x3c')][_0x03e4('0x9e')];var _0x3302c6=_0x208b71[_0x03e4('0x3c')]['json']?_0x208b71[_0x03e4('0x3c')]['json']:!![];var _0x3073ff=_0x208b71[_0x03e4('0x3c')][_0x03e4('0xa2')]?_0x208b71[_0x03e4('0x3c')]['encoding']:null;var _0x378c07={'method':_0x208b71[_0x03e4('0xa3')],'uri':util[_0x03e4('0x56')](_0x03e4('0xa4'),_0x557b6b,_0x208b71[_0x03e4('0x3c')][_0x03e4('0x9')]),'json':_0x3302c6,'resolveWithFullResponse':!![],'encoding':_0x3073ff,'body':_0x208b71['body']};if(_0x208b71[_0x03e4('0xa5')]){_0x378c07['headers']=_0x208b71[_0x03e4('0xa5')];if(_0x378c07['headers'][_0x03e4('0xa6')]){delete _0x378c07[_0x03e4('0xa5')][_0x03e4('0xa6')];}}if(_0x378c07[_0x03e4('0xa5')][_0x03e4('0xa7')]){delete _0x378c07['headers']['content-type'];}return rp(_0x378c07);})['then'](function(_0x4902d4){if(_0x4902d4){_0x24621b[_0x03e4('0x27')](_0x4902d4[_0x03e4('0xa5')]);logger[_0x03e4('0x67')](_0x4902d4['body']);return _0x24621b[_0x03e4('0x20')](_0x4902d4['statusCode'])['send'](_0x4902d4[_0x03e4('0x9a')]);}else{return _0x24621b[_0x03e4('0x1f')](0xc8);}})[_0x03e4('0x4d')](handleError(_0x24621b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9f7244c..dc91ac9 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 _0x7412=['setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x4fdbda,_0x23641a){var _0xddf5b6=function(_0xd4a955){while(--_0xd4a955){_0x4fdbda['push'](_0x4fdbda['shift']());}};_0xddf5b6(++_0x23641a);}(_0x7412,0x161));var _0x2741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7412[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x2741('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2741('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2741('0x2'),'afterDestroy':'remove'};function emitEvent(_0x51d3c5){return function(_0x509ce6,_0x552836,_0x521b65){PluginEvents['emit'](_0x51d3c5+':'+_0x509ce6['id'],_0x509ce6);PluginEvents[_0x2741('0x3')](_0x51d3c5,_0x509ce6);_0x521b65(null);};}for(var e in events){if(events[_0x2741('0x4')](e)){var event=events[e];Plugin[_0x2741('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x2070=['save','remove','emit','exports','Plugin','setMaxListeners'];(function(_0x589fb1,_0x5d8fb5){var _0x12195c=function(_0x2f9a9c){while(--_0x2f9a9c){_0x589fb1['push'](_0x589fb1['shift']());}};_0x12195c(++_0x5d8fb5);}(_0x2070,0x1a2));var _0x0207=function(_0x500da4,_0xd1c1cf){_0x500da4=_0x500da4-0x0;var _0x41e6a5=_0x2070[_0x500da4];return _0x41e6a5;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x0207('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x0207('0x1')](0x0);var events={'afterCreate':_0x0207('0x2'),'afterUpdate':'update','afterDestroy':_0x0207('0x3')};function emitEvent(_0x2727d9){return function(_0x5e3420,_0x118abc,_0x43c3b6){PluginEvents['emit'](_0x2727d9+':'+_0x5e3420['id'],_0x5e3420);PluginEvents[_0x0207('0x4')](_0x2727d9,_0x5e3420);_0x43c3b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0207('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index dc35607..12ce09f 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 _0xd2cf=['./plugin.attributes','Plugin','plugins','lodash','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2cf,0x162));var _0xfd2c=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0xd2cf[_0x390733];return _0x33beb9;};'use strict';var _=require(_0xfd2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfd2c('0x1'));var moment=require(_0xfd2c('0x2'));var BPromise=require(_0xfd2c('0x3'));var rp=require(_0xfd2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd2c('0x5'));var attributes=require(_0xfd2c('0x6'));module['exports']=function(_0xc8701b,_0xe68477){return _0xc8701b['define'](_0xfd2c('0x7'),attributes,{'tableName':_0xfd2c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c32=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x8c32,0x130));var _0x28c3=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8c32[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var logger=require(_0x28c3('0x2'))(_0x28c3('0x3'));var moment=require(_0x28c3('0x4'));var BPromise=require(_0x28c3('0x5'));var rp=require(_0x28c3('0x6'));var fs=require('fs');var path=require(_0x28c3('0x7'));var rimraf=require(_0x28c3('0x8'));var config=require(_0x28c3('0x9'));var attributes=require(_0x28c3('0xa'));module[_0x28c3('0xb')]=function(_0x537b4f,_0x2861c9){return _0x537b4f[_0x28c3('0xc')](_0x28c3('0xd'),attributes,{'tableName':_0x28c3('0xe'),'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 3f9d348..243cb76 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 _0x61b0=['options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x61b0,0x18f));var _0x061b=function(_0x4a13a8,_0x8a055){_0x4a13a8=_0x4a13a8-0x0;var _0x19a75a=_0x61b0[_0x4a13a8];return _0x19a75a;};'use strict';var _=require(_0x061b('0x0'));var util=require('util');var moment=require(_0x061b('0x1'));var BPromise=require(_0x061b('0x2'));var rs=require(_0x061b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x061b('0x4'))['db'];var utils=require(_0x061b('0x5'));var logger=require(_0x061b('0x6'))(_0x061b('0x7'));var config=require('../../config/environment');var jayson=require(_0x061b('0x8'));var client=jayson[_0x061b('0x9')][_0x061b('0xa')]({'port':0x232a});config[_0x061b('0xb')]=_[_0x061b('0xc')](config[_0x061b('0xb')],{'host':_0x061b('0xd'),'port':0x18eb});var socket=require(_0x061b('0xe'))(new Redis(config[_0x061b('0xb')]));require(_0x061b('0xf'))[_0x061b('0x10')](socket);function respondWithRpcPromise(_0xbc9658,_0x1f18a8,_0xe89709){return new BPromise(function(_0x2202b8,_0x288176){return client[_0x061b('0x11')](_0xbc9658,_0xe89709)[_0x061b('0x12')](function(_0x2b2927){logger[_0x061b('0x13')](_0x061b('0x14'),_0x1f18a8,_0x061b('0x15'));logger[_0x061b('0x16')](_0x061b('0x17'),_0x1f18a8,'request\x20sent',JSON['stringify'](_0x2b2927));if(_0x2b2927[_0x061b('0x18')]){if(_0x2b2927[_0x061b('0x18')][_0x061b('0x19')]===0x1f4){logger[_0x061b('0x18')]('Plugin,\x20%s,\x20%s',_0x1f18a8,_0x2b2927[_0x061b('0x18')][_0x061b('0x1a')]);return _0x288176(_0x2b2927[_0x061b('0x18')][_0x061b('0x1a')]);}logger[_0x061b('0x18')]('Plugin,\x20%s,\x20%s',_0x1f18a8,_0x2b2927['error'][_0x061b('0x1a')]);return _0x2202b8(_0x2b2927['error'][_0x061b('0x1a')]);}else{logger['info'](_0x061b('0x14'),_0x1f18a8,'request\x20sent');_0x2202b8(_0x2b2927[_0x061b('0x1b')][_0x061b('0x1a')]);}})[_0x061b('0x1c')](function(_0x2e3d3a){logger['error']('Plugin,\x20%s,\x20%s',_0x1f18a8,_0x2e3d3a);_0x288176(_0x2e3d3a);});});}exports[_0x061b('0x1d')]=function(_0x74dfb){var _0x4e8890=this;return new Promise(function(_0x122690,_0xd95d1f){return db[_0x061b('0x1e')][_0x061b('0x1f')](_0x74dfb[_0x061b('0x20')],{'raw':_0x74dfb[_0x061b('0x21')]?_0x74dfb['options'][_0x061b('0x22')]===undefined?!![]:![]:!![]})[_0x061b('0x12')](function(_0x173fef){logger[_0x061b('0x13')](_0x061b('0x1d'),_0x74dfb);logger[_0x061b('0x16')]('CreatePlugin',_0x74dfb,JSON[_0x061b('0x23')](_0x173fef));_0x122690(_0x173fef);})[_0x061b('0x1c')](function(_0x5486fe){logger['error'](_0x061b('0x1d'),_0x5486fe[_0x061b('0x1a')],_0x74dfb);_0xd95d1f(_0x4e8890[_0x061b('0x18')](0x1f4,_0x5486fe[_0x061b('0x1a')]));});});}; \ No newline at end of file +var _0x35c8=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','register','request','then','info','request\x20sent','debug','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body','options','CreatePlugin','lodash','util','moment','bluebird'];(function(_0x1d162e,_0x4a3f18){var _0x57dacf=function(_0x541774){while(--_0x541774){_0x1d162e['push'](_0x1d162e['shift']());}};_0x57dacf(++_0x4a3f18);}(_0x35c8,0xdc));var _0x835c=function(_0x383ba3,_0x217fdc){_0x383ba3=_0x383ba3-0x0;var _0x438a98=_0x35c8[_0x383ba3];return _0x438a98;};'use strict';var _=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var moment=require(_0x835c('0x2'));var BPromise=require(_0x835c('0x3'));var rs=require(_0x835c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x835c('0x5'))['db'];var utils=require(_0x835c('0x6'));var logger=require('../../config/logger')(_0x835c('0x7'));var config=require(_0x835c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x835c('0x9')]['http']({'port':0x232a});config[_0x835c('0xa')]=_[_0x835c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x835c('0xa')]));require('./plugin.socket')[_0x835c('0xc')](socket);function respondWithRpcPromise(_0x80aeb7,_0x184d96,_0x3580dc){return new BPromise(function(_0x15ccd1,_0x4d9285){return client[_0x835c('0xd')](_0x80aeb7,_0x3580dc)[_0x835c('0xe')](function(_0x4d4bc6){logger[_0x835c('0xf')]('Plugin,\x20%s,\x20%s',_0x184d96,_0x835c('0x10'));logger[_0x835c('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x184d96,'request\x20sent',JSON['stringify'](_0x4d4bc6));if(_0x4d4bc6[_0x835c('0x12')]){if(_0x4d4bc6[_0x835c('0x12')][_0x835c('0x13')]===0x1f4){logger[_0x835c('0x12')](_0x835c('0x14'),_0x184d96,_0x4d4bc6[_0x835c('0x12')][_0x835c('0x15')]);return _0x4d9285(_0x4d4bc6[_0x835c('0x12')]['message']);}logger[_0x835c('0x12')](_0x835c('0x14'),_0x184d96,_0x4d4bc6['error']['message']);return _0x15ccd1(_0x4d4bc6[_0x835c('0x12')][_0x835c('0x15')]);}else{logger[_0x835c('0xf')](_0x835c('0x14'),_0x184d96,_0x835c('0x10'));_0x15ccd1(_0x4d4bc6['result'][_0x835c('0x15')]);}})[_0x835c('0x16')](function(_0x3e7af7){logger[_0x835c('0x12')](_0x835c('0x14'),_0x184d96,_0x3e7af7);_0x4d9285(_0x3e7af7);});});}exports['CreatePlugin']=function(_0x587a22){var _0x5e1ea8=this;return new Promise(function(_0x49e279,_0x369a3c){return db[_0x835c('0x17')][_0x835c('0x18')](_0x587a22[_0x835c('0x19')],{'raw':_0x587a22[_0x835c('0x1a')]?_0x587a22[_0x835c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xf05fdc){logger[_0x835c('0xf')](_0x835c('0x1b'),_0x587a22);logger['debug'](_0x835c('0x1b'),_0x587a22,JSON['stringify'](_0xf05fdc));_0x49e279(_0xf05fdc);})['catch'](function(_0x5e8f90){logger[_0x835c('0x12')](_0x835c('0x1b'),_0x5e8f90[_0x835c('0x15')],_0x587a22);_0x369a3c(_0x5e1ea8[_0x835c('0x12')](0x1f4,_0x5e8f90[_0x835c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index aef40c4..48428fc 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 _0x52f3=['./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x52f3,0x1b8));var _0x352f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x52f3[_0x19e35c];return _0x3e1fe8;};'use strict';var PluginEvents=require(_0x352f('0x0'));var events=[_0x352f('0x1'),_0x352f('0x2'),_0x352f('0x3')];function createListener(_0x15d2ff,_0x4f2f12){return function(_0x26f92b){_0x4f2f12[_0x352f('0x4')](_0x15d2ff,_0x26f92b);};}function removeListener(_0x279422,_0x4e8bda){return function(){PluginEvents[_0x352f('0x5')](_0x279422,_0x4e8bda);};}exports[_0x352f('0x6')]=function(_0x1652cf){for(var _0x1e140c=0x0,_0x76e3c2=events[_0x352f('0x7')];_0x1e140c<_0x76e3c2;_0x1e140c++){var _0x32af1d=events[_0x1e140c];var _0x56381b=createListener('plugin:'+_0x32af1d,_0x1652cf);PluginEvents['on'](_0x32af1d,_0x56381b);}}; \ No newline at end of file +var _0xc717=['register','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x10d028,_0x46e656){var _0xa4f430=function(_0x278d49){while(--_0x278d49){_0x10d028['push'](_0x10d028['shift']());}};_0xa4f430(++_0x46e656);}(_0xc717,0xb2));var _0x7c71=function(_0x1fab69,_0x279ffd){_0x1fab69=_0x1fab69-0x0;var _0x1d8b67=_0xc717[_0x1fab69];return _0x1d8b67;};'use strict';var PluginEvents=require(_0x7c71('0x0'));var events=[_0x7c71('0x1'),_0x7c71('0x2'),_0x7c71('0x3')];function createListener(_0x575d86,_0xd7b5cc){return function(_0x383aeb){_0xd7b5cc[_0x7c71('0x4')](_0x575d86,_0x383aeb);};}function removeListener(_0x514fa8,_0x4551ba){return function(){PluginEvents[_0x7c71('0x5')](_0x514fa8,_0x4551ba);};}exports[_0x7c71('0x6')]=function(_0x58d8e3){for(var _0x55b489=0x0,_0x194d4f=events['length'];_0x55b489<_0x194d4f;_0x55b489++){var _0x62903b=events[_0x55b489];var _0x45e0fe=createListener(_0x7c71('0x7')+_0x62903b,_0x58d8e3);PluginEvents['on'](_0x62903b,_0x45e0fe);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f40ca23..845751c 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(_0x4ef451,_0x1c9d5b){var _0x20237d=function(_0x3dba7c){while(--_0x3dba7c){_0x4ef451['push'](_0x4ef451['shift']());}};_0x20237d(++_0x1c9d5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x8adb57,_0x41ef77){var _0x2cafe8=function(_0x1e3bf6){while(--_0x1e3bf6){_0x8adb57['push'](_0x8adb57['shift']());}};_0x2cafe8(++_0x41ef77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 5f26b63..de0ecbe 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 _0x4483=['error','stack','name','send','npm\x20install','info','list','express','motion2','length','then','catch','show','describe','body','script','join','../../files/plugins','chdir','dirname','start','dump','update','restart','stop','hasOwnProperty','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x371317,_0x29d571){var _0x4f4ad9=function(_0x227d5e){while(--_0x227d5e){_0x371317['push'](_0x371317['shift']());}};_0x4f4ad9(++_0x29d571);}(_0x4483,0x1a3));var _0x3448=function(_0xe63d33,_0x204fef){_0xe63d33=_0xe63d33-0x0;var _0x4f4bb0=_0x4483[_0xe63d33];return _0x4f4bb0;};'use strict';var _=require(_0x3448('0x0'));var pm2=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var path=require(_0x3448('0x3'));var exec=require(_0x3448('0x4'))[_0x3448('0x5')];var BPromise=require(_0x3448('0x6'));function handleEntityNotFound(_0xef1a93,_0x5f5163){return function(_0xeb5b8){if(!_0xeb5b8){_0xef1a93[_0x3448('0x7')](0x194);;}return _0xeb5b8;};}function respondWithResult(_0x1b05db,_0xd3606d){_0xd3606d=_0xd3606d||0xc8;return function(_0x1bb7e5){if(_0x1bb7e5){return _0x1b05db[_0x3448('0x8')](_0xd3606d)[_0x3448('0x9')](_0x1bb7e5);}return null;};}function handleError(_0x34b926,_0x5923ee){_0x5923ee=_0x5923ee||0x1f4;return function(_0x5c82c6){logger[_0x3448('0xa')](_0x5c82c6[_0x3448('0xb')]);if(_0x5c82c6[_0x3448('0xc')]){delete _0x5c82c6[_0x3448('0xc')];}_0x34b926[_0x3448('0x8')](_0x5923ee)[_0x3448('0xd')](_0x5c82c6);};}function execChildProcess(){return new BPromise(function(_0x2bdf02,_0x32cd61){exec(_0x3448('0xe'),function(_0x35bb7b,_0x2a6048,_0x481a6f){logger['info'](_0x2a6048);logger[_0x3448('0xf')](_0x481a6f);if(_0x35bb7b){logger[_0x3448('0xa')](_0x35bb7b);return _0x32cd61(_0x35bb7b);}return _0x2bdf02(_0x2a6048);});});}exports['index']=function(_0x2661e1,_0xdfb89d){return pm2[_0x3448('0x10')]()['then'](function(_0x14104c){if(_0x14104c){var _0x2952a6=_['reject'](_0x14104c,function(_0x2387a3){return _0x2387a3[_0x3448('0xc')]===_0x3448('0x11')||_0x2387a3['name']===_0x3448('0x12');});return{'rows':_0x2952a6,'count':_0x2952a6[_0x3448('0x13')]};}return null;})[_0x3448('0x14')](respondWithResult(_0xdfb89d,null))[_0x3448('0x15')](handleError(_0xdfb89d,null));};exports[_0x3448('0x16')]=function(_0x1b2081,_0x247d1a){return pm2[_0x3448('0x17')](_0x1b2081['params']['id'])[_0x3448('0x14')](respondWithResult(_0x247d1a,null))['then'](handleEntityNotFound(_0x247d1a,null))['catch'](handleError(_0x247d1a,null));};exports['create']=function(_0x1e9774,_0x278736){if(_0x1e9774[_0x3448('0x18')]['name']&&_0x1e9774[_0x3448('0x18')][_0x3448('0x19')]){var _0x317de6=path[_0x3448('0x1a')](__dirname,_0x3448('0x1b'),_0x1e9774[_0x3448('0x18')]['script']);var _0x54c7ee=process['cwd']();process[_0x3448('0x1c')](path[_0x3448('0x1d')](_0x317de6));return execChildProcess()['then'](function(_0x5b1f7c){process[_0x3448('0x1c')](_0x54c7ee);return pm2[_0x3448('0x1e')]({'name':_0x1e9774[_0x3448('0x18')][_0x3448('0xc')],'script':_0x317de6});})[_0x3448('0x14')](function(_0x566ff5){pm2[_0x3448('0x1f')]();return _0x566ff5[0x0];})[_0x3448('0x14')](respondWithResult(_0x278736,0xc9))[_0x3448('0x15')](handleError(_0x278736,null));}else{return _0x278736[_0x3448('0x8')](0x1f4)[_0x3448('0xd')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x3448('0x20')]=function(_0x393081,_0x52c163){if(_0x393081[_0x3448('0x18')]['id']){delete _0x393081[_0x3448('0x18')]['id'];}var _0x310912={'online':_0x3448('0x21'),'stopped':_0x3448('0x22')};if(_0x310912[_0x3448('0x23')](_0x393081[_0x3448('0x18')][_0x3448('0x8')])){return pm2[_0x310912[_0x393081['body'][_0x3448('0x8')]]](_0x393081[_0x3448('0x24')]['id'])[_0x3448('0x14')](respondWithResult(_0x52c163,0xc8))['catch'](handleError(_0x52c163,null));}else{return _0x52c163[_0x3448('0x8')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x52fb48,_0xff6513){if(_0x52fb48['body']['id']){delete _0x52fb48['body']['id'];}if(_0x52fb48[_0x3448('0x24')]['id']){return pm2[_0x3448('0x25')](_0x52fb48[_0x3448('0x24')]['id'])[_0x3448('0x14')](function(_0x4f4f32){pm2[_0x3448('0x1f')]();return _0x4f4f32[0x0];})[_0x3448('0x14')](respondWithResult(_0xff6513,null))[_0x3448('0x15')](handleError(_0xff6513,null));}else{return _0xff6513['status'](0x1f4)[_0x3448('0xd')]({'message':_0x3448('0x26')});}}; \ No newline at end of file +var _0xa75b=['motion2','length','catch','show','describe','params','create','body','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','delete','lodash','api','path','child_process','exec','bluebird','sendStatus','status','stack','name','send','npm\x20install','info','error','then','reject','express'];(function(_0x30b336,_0x97cb1e){var _0x5d7c83=function(_0x355bd2){while(--_0x355bd2){_0x30b336['push'](_0x30b336['shift']());}};_0x5d7c83(++_0x97cb1e);}(_0xa75b,0x170));var _0xba75=function(_0x539e9c,_0x3d87c1){_0x539e9c=_0x539e9c-0x0;var _0x1d8d82=_0xa75b[_0x539e9c];return _0x1d8d82;};'use strict';var _=require(_0xba75('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xba75('0x1'));var path=require(_0xba75('0x2'));var exec=require(_0xba75('0x3'))[_0xba75('0x4')];var BPromise=require(_0xba75('0x5'));function handleEntityNotFound(_0x336606,_0x152269){return function(_0x398bd5){if(!_0x398bd5){_0x336606[_0xba75('0x6')](0x194);;}return _0x398bd5;};}function respondWithResult(_0x41afc9,_0x2baa28){_0x2baa28=_0x2baa28||0xc8;return function(_0x238a33){if(_0x238a33){return _0x41afc9[_0xba75('0x7')](_0x2baa28)['json'](_0x238a33);}return null;};}function handleError(_0x4b842d,_0x731cae){_0x731cae=_0x731cae||0x1f4;return function(_0x52669f){logger['error'](_0x52669f[_0xba75('0x8')]);if(_0x52669f['name']){delete _0x52669f[_0xba75('0x9')];}_0x4b842d[_0xba75('0x7')](_0x731cae)[_0xba75('0xa')](_0x52669f);};}function execChildProcess(){return new BPromise(function(_0x141931,_0x13f60f){exec(_0xba75('0xb'),function(_0xb5afb8,_0x2538eb,_0x1824e2){logger[_0xba75('0xc')](_0x2538eb);logger[_0xba75('0xc')](_0x1824e2);if(_0xb5afb8){logger[_0xba75('0xd')](_0xb5afb8);return _0x13f60f(_0xb5afb8);}return _0x141931(_0x2538eb);});});}exports['index']=function(_0x55553a,_0x38a6db){return pm2['list']()[_0xba75('0xe')](function(_0x2df615){if(_0x2df615){var _0xa27f76=_[_0xba75('0xf')](_0x2df615,function(_0x4c4a0b){return _0x4c4a0b[_0xba75('0x9')]===_0xba75('0x10')||_0x4c4a0b[_0xba75('0x9')]===_0xba75('0x11');});return{'rows':_0xa27f76,'count':_0xa27f76[_0xba75('0x12')]};}return null;})['then'](respondWithResult(_0x38a6db,null))[_0xba75('0x13')](handleError(_0x38a6db,null));};exports[_0xba75('0x14')]=function(_0x14bd83,_0x47be93){return pm2[_0xba75('0x15')](_0x14bd83[_0xba75('0x16')]['id'])[_0xba75('0xe')](respondWithResult(_0x47be93,null))[_0xba75('0xe')](handleEntityNotFound(_0x47be93,null))[_0xba75('0x13')](handleError(_0x47be93,null));};exports[_0xba75('0x17')]=function(_0x5811cb,_0x23c2ec){if(_0x5811cb[_0xba75('0x18')]['name']&&_0x5811cb['body'][_0xba75('0x19')]){var _0x31bc33=path['join'](__dirname,'../../files/plugins',_0x5811cb[_0xba75('0x18')]['script']);var _0x1b8a36=process[_0xba75('0x1a')]();process[_0xba75('0x1b')](path['dirname'](_0x31bc33));return execChildProcess()[_0xba75('0xe')](function(_0x221d5e){process[_0xba75('0x1b')](_0x1b8a36);return pm2[_0xba75('0x1c')]({'name':_0x5811cb[_0xba75('0x18')][_0xba75('0x9')],'script':_0x31bc33});})['then'](function(_0x246c48){pm2[_0xba75('0x1d')]();return _0x246c48[0x0];})[_0xba75('0xe')](respondWithResult(_0x23c2ec,0xc9))[_0xba75('0x13')](handleError(_0x23c2ec,null));}else{return _0x23c2ec[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':_0xba75('0x1e')});}};exports[_0xba75('0x1f')]=function(_0x35c571,_0x155c74){if(_0x35c571['body']['id']){delete _0x35c571['body']['id'];}var _0x4e1987={'online':_0xba75('0x20'),'stopped':'stop'};if(_0x4e1987[_0xba75('0x21')](_0x35c571['body'][_0xba75('0x7')])){return pm2[_0x4e1987[_0x35c571[_0xba75('0x18')][_0xba75('0x7')]]](_0x35c571['params']['id'])[_0xba75('0xe')](respondWithResult(_0x155c74,0xc8))[_0xba75('0x13')](handleError(_0x155c74,null));}else{return _0x155c74[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x200715,_0x481a04){if(_0x200715[_0xba75('0x18')]['id']){delete _0x200715[_0xba75('0x18')]['id'];}if(_0x200715[_0xba75('0x16')]['id']){return pm2[_0xba75('0x22')](_0x200715['params']['id'])[_0xba75('0xe')](function(_0x222d98){pm2['dump']();return _0x222d98[0x0];})[_0xba75('0xe')](respondWithResult(_0x481a04,null))[_0xba75('0x13')](handleError(_0x481a04,null));}else{return _0x481a04[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7a77727..ebb2209 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 _0x58f8=['./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','express','Router'];(function(_0x16aa6a,_0x1abf40){var _0x29efb8=function(_0x438742){while(--_0x438742){_0x16aa6a['push'](_0x16aa6a['shift']());}};_0x29efb8(++_0x1abf40);}(_0x58f8,0x176));var _0x858f=function(_0x10c01c,_0x478347){_0x10c01c=_0x10c01c-0x0;var _0xc27b25=_0x58f8[_0x10c01c];return _0xc27b25;};'use strict';var express=require(_0x858f('0x0'));var router=express[_0x858f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x858f('0x2'));router[_0x858f('0x3')](_0x858f('0x4'),auth[_0x858f('0x5')](),controller[_0x858f('0x6')]);router[_0x858f('0x3')](_0x858f('0x7'),auth[_0x858f('0x5')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x02ee=['getQueues','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','isAuthenticated'];(function(_0x139064,_0x46dedd){var _0x3a4df6=function(_0x5de337){while(--_0x5de337){_0x139064['push'](_0x139064['shift']());}};_0x3a4df6(++_0x46dedd);}(_0x02ee,0xa9));var _0xe02e=function(_0x18f68a,_0x117752){_0x18f68a=_0x18f68a-0x0;var _0x414162=_0x02ee[_0x18f68a];return _0x414162;};'use strict';var express=require('express');var router=express[_0xe02e('0x0')]();var auth=require(_0xe02e('0x1'));var controller=require(_0xe02e('0x2'));router[_0xe02e('0x3')](_0xe02e('0x4'),auth['isAuthenticated'](),controller[_0xe02e('0x5')]);router['get']('/queues',auth[_0xe02e('0x6')](),controller[_0xe02e('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index dfabc58..eef9376 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 _0x0fd9=['agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','merge','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','count','find','filterAgentAttributes','globalStatus','pause','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','key','outbound','dialActive','voice','QueueCampaigns','Queues','name','filter','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','limit','offset','status','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','resolve','channel','isValidChannel','format','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','role'];(function(_0x19e7ef,_0x1af362){var _0x54a234=function(_0x17306b){while(--_0x17306b){_0x19e7ef['push'](_0x19e7ef['shift']());}};_0x54a234(++_0x1af362);}(_0x0fd9,0xd4));var _0x90fd=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x0fd9[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0x90fd('0x0'));var util=require('util');var rta=require(_0x90fd('0x1'));var rtq=require(_0x90fd('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x90fd('0x3'));var db=require(_0x90fd('0x4'))['db'];var APIBadRequestError=require(_0x90fd('0x5'))[_0x90fd('0x6')];var APIHandleError=require('../../errors/api')[_0x90fd('0x7')];function respondWithFilteredResult(_0x347c83,_0x252004){return function(_0x112be9){if(_0x112be9){var _0x38dd33=typeof _0x252004['offset']===_0x90fd('0x8')&&typeof _0x252004[_0x90fd('0x9')]==='undefined';var _0x1fcd64=_0x112be9['count'];var _0x24f2d6=_0x38dd33?0x0:_0x252004[_0x90fd('0xa')];var _0x144f0f=_0x38dd33?_0x112be9['count']:_0x252004[_0x90fd('0xa')]+_0x252004[_0x90fd('0x9')];var _0x2b78de;if(_0x144f0f>=_0x1fcd64){_0x144f0f=_0x1fcd64;_0x2b78de=0xc8;}else{_0x2b78de=0xce;}_0x347c83[_0x90fd('0xb')](_0x2b78de);return _0x347c83['set'](_0x90fd('0xc'),_0x24f2d6+'-'+_0x144f0f+'/'+_0x1fcd64)[_0x90fd('0xd')](_0x112be9);}return null;};}exports[_0x90fd('0xe')]=function(_0x32091b,_0x44bfbf){var _0x238782={'count':0x0,'rows':[]};var _0x4e1cd2={};var _0x8255a;var _0x303ec0=utils[_0x90fd('0xf')]();var _0x32236c;var _0x4265f0;var _0x1218d8=_0x32091b[_0x90fd('0x10')][_0x90fd('0x11')];var _0x2c16c1=_0x32091b[_0x90fd('0x10')][_0x90fd('0x12')];var _0x11d212=_0x32091b[_0x90fd('0x10')][_0x90fd('0x13')];var _0x51e835=_0x2c16c1==='pause'||_0x2c16c1==='*pause'?!![]:![];var _0x3e9112=[];var _0x31d174;var _0x500aec;Promise[_0x90fd('0x14')]()['then'](function(){if(_0x32091b['query'][_0x90fd('0x15')]){if(!utils[_0x90fd('0x16')](_0x32091b[_0x90fd('0x10')]['channel'])){throw new APIBadRequestError(util[_0x90fd('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x32091b['query'][_0x90fd('0x15')]));}_0x8255a=_0x32091b[_0x90fd('0x10')]['channel'][_0x90fd('0x18')]();}if(!_0x32091b[_0x90fd('0x10')]['sort']||!_0x32091b[_0x90fd('0x10')][_0x90fd('0x19')][_0x90fd('0x1a')]('globalStatus')){_0x32091b[_0x90fd('0x10')]['sort']=rta[_0x90fd('0x1b')](_0x32091b[_0x90fd('0x10')][_0x90fd('0x19')]);return;}var _0x46b8eb=rta[_0x90fd('0x1c')](_0x32091b[_0x90fd('0x10')][_0x90fd('0x19')]);_0x32091b['query'][_0x90fd('0x19')]=_0x46b8eb[_0x90fd('0x1d')][_0x90fd('0x1e')](',');_0x31d174=_0x46b8eb[_0x90fd('0x1f')];})[_0x90fd('0x20')](function(){if(!_0x1218d8){return[];}return rta[_0x90fd('0x21')](_0x1218d8,_0x8255a);})[_0x90fd('0x20')](function(_0x399f33){_0x3e9112=_0x399f33;return rta[_0x90fd('0x22')]();})[_0x90fd('0x20')](function(_0x3c5aca){_0x4265f0=_0x3c5aca[_0x90fd('0x23')];if((!_0x2c16c1||_0x51e835)&&!_0x31d174){return _0x3e9112;}if(_0x31d174&&!_0x2c16c1){return rta['getSortedAgentsIdsByStatus'](_0x4265f0,_0x3e9112,_0x31d174);}else{return rta[_0x90fd('0x24')](_0x4265f0,_0x3e9112,_0x2c16c1);}})[_0x90fd('0x20')](function(_0x1889d1){_0x3e9112=_0x1889d1;var _0x4efa54=![];if(_0x3e9112[_0x90fd('0x25')]===0x0){if(_0x1218d8||_0x2c16c1){_0x4efa54=!![];}if(_0x51e835){_0x4efa54=![];}}if(_0x4efa54){return _0x238782;}var _0x13b3cb=_[_0x90fd('0x26')](db['User'][_0x90fd('0x27')],function(_0x477dc0){return{'name':_0x477dc0[_0x90fd('0x28')],'type':_0x477dc0[_0x90fd('0x29')]['key']};});_0x32091b[_0x90fd('0x10')][_0x90fd('0x2a')]=_0x90fd('0x2b');_0x32091b[_0x90fd('0x10')]['online']=!![];_0x4e1cd2=qs[_0x90fd('0x2c')](_0x13b3cb,_0x32091b);_0x4e1cd2[_0x90fd('0x2d')]=!![];var _0x2de1b2=[];if(_0x3e9112[_0x90fd('0x25')]>0x0){_0x2de1b2[_0x90fd('0x2e')]({'id':{'$in':_0x3e9112}});if(_0x31d174&&!_0x2c16c1){_0x500aec=[db[_0x90fd('0x2f')][_0x90fd('0x30')](_0x90fd('0x31')+_0x3e9112+')')];_0x4e1cd2[_0x90fd('0x1f')]=_0x500aec;}}if(_0x51e835){_0x303ec0[_0x90fd('0x32')](function(_0x2e4d72){var _0x224b18=!![];if(_0x2c16c1===_0x90fd('0x33')&&_0x8255a!==_0x2e4d72){_0x224b18=![];}_0x2de1b2['push']({[_0x2e4d72+'Pause']:_0x224b18});});if(_0x11d212){_0x2de1b2[_0x90fd('0x2e')]({'pauseType':_0x11d212});}}else if(_0x2c16c1){_0x303ec0[_0x90fd('0x32')](function(_0xed2d72){_0x2de1b2[_0x90fd('0x2e')]({[_0xed2d72+_0x90fd('0x34')]:![]});});}_0x4e1cd2['where']=_[_0x90fd('0x35')](_0x4e1cd2[_0x90fd('0x36')],{'$and':_0x2de1b2});if(_0x32091b[_0x90fd('0x37')]['role']===_0x90fd('0x37')){var _0xe9f08d={'params':{'id':_0x32091b['user'][_0x90fd('0x38')]},'query':{'section':_0x90fd('0x39'),'role':_0x90fd('0x2b'),'online':!![],'raw':!![],'ids':_0x3e9112,'customSorting':_0x500aec}};if(_0x51e835){_0xe9f08d[_0x90fd('0x10')][_0x90fd('0x3a')]=_0x2de1b2;}_0xe9f08d['query']=Object[_0x90fd('0x3b')](_0xe9f08d['query'],_0x32091b[_0x90fd('0x10')]);delete _0xe9f08d[_0x90fd('0x10')]['id'];return db[_0x90fd('0x3c')][_0x90fd('0x3d')](_0xe9f08d);}return db[_0x90fd('0x3e')][_0x90fd('0x3f')](_0x4e1cd2);})[_0x90fd('0x20')](function(_0x1c23ea){_0x238782[_0x90fd('0x40')]=_0x1c23ea[_0x90fd('0x40')];_0x32236c=_0x1c23ea[_0x90fd('0x23')];return _0x32236c[_0x90fd('0x26')](function(_0x4edc32){var _0x4fb7a1=_[_0x90fd('0x41')](_0x4265f0,['id',_0x4edc32['id']]);if(_0x4fb7a1){var _0x164d8d=rta[_0x90fd('0x42')](_0x4fb7a1);_[_0x90fd('0x35')](_0x4edc32,_0x164d8d);}_0x4edc32[_0x90fd('0x43')]=rta['getAgentStatus'](_0x4edc32);if(_0x4edc32[_0x90fd('0x43')][_0x90fd('0x1a')](_0x90fd('0x44'))){_0x303ec0[_0x90fd('0x32')](function(_0xd9afe6){if(_0x4edc32[_0xd9afe6+_0x90fd('0x34')]){_0x4edc32[_0xd9afe6+_0x90fd('0x45')]=_0x90fd('0x44');}});}return _0x4edc32;});})[_0x90fd('0x20')](function(_0x26018a){if(!_0x31d174||_0x500aec){return _0x26018a;}return rta[_0x90fd('0x46')](_0x26018a,_0x31d174);})['then'](function(_0x52aff9){var _0x6377e0=null;if(_0x32091b['query'][_0x90fd('0x1d')]){var _0x1ecc0a=_0x32091b[_0x90fd('0x10')][_0x90fd('0x1d')]['split'](',');_0x6377e0=_0x52aff9[_0x90fd('0x26')](function(_0x2b39cb){return _[_0x90fd('0x47')](_0x2b39cb,_0x1ecc0a);});}_0x238782[_0x90fd('0x23')]=_0x6377e0||_0x52aff9;return _0x238782;})[_0x90fd('0x20')](respondWithFilteredResult(_0x44bfbf,_0x4e1cd2))[_0x90fd('0x48')](APIHandleError(_0x44bfbf));};exports[_0x90fd('0x49')]=function(_0x59e6af,_0x2792f4){var _0x21862b={'count':0x0,'rows':[]};var _0x53d868={};var _0x67257f;var _0x2904cd;var _0x5bb66f;Promise[_0x90fd('0x14')]()['then'](function(){if(_0x59e6af[_0x90fd('0x10')][_0x90fd('0x15')]){if(!utils[_0x90fd('0x16')](_0x59e6af[_0x90fd('0x10')][_0x90fd('0x15')])){throw new APIBadRequestError(util[_0x90fd('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x59e6af[_0x90fd('0x10')]['channel']));}_0x67257f=_0x59e6af[_0x90fd('0x10')]['channel'][_0x90fd('0x18')]();}var _0x10d609=_[_0x90fd('0x4a')](_0x67257f)+_0x90fd('0x4b');var _0x222360=_['map'](db[_0x10d609]['rawAttributes'],function(_0x553412){return{'name':_0x553412[_0x90fd('0x28')],'type':_0x553412[_0x90fd('0x29')][_0x90fd('0x4c')]};});if(!_0x59e6af[_0x90fd('0x10')]['fields']){var _0x374277=['id','name'];if(_0x67257f==='voice'){_0x374277[_0x90fd('0x2e')](_0x90fd('0x29'));if(_0x59e6af['query']['type']===_0x90fd('0x4d')){_0x374277[_0x90fd('0x2e')]([_0x90fd('0x4e'),'dialMethod']);}}_0x59e6af['query'][_0x90fd('0x1d')]=_0x374277['join'](',');}_0x53d868=qs[_0x90fd('0x2c')](_0x222360,_0x59e6af);if(_0x59e6af[_0x90fd('0x37')]['role']===_0x90fd('0x37')){var _0x5c01b4={'params':{'id':_0x59e6af[_0x90fd('0x37')]['userProfileId']},'query':{'section':_0x67257f===_0x90fd('0x4f')&&_0x59e6af[_0x90fd('0x10')][_0x90fd('0x29')]===_0x90fd('0x4d')?_0x90fd('0x50'):_[_0x90fd('0x4a')](_0x67257f)+_0x90fd('0x51'),'type':_0x59e6af['query'][_0x90fd('0x29')],'nolimit':!![],'sort':_0x90fd('0x52'),'filter':_0x59e6af['query'][_0x90fd('0x53')]}};return db[_0x90fd('0x3c')][_0x90fd('0x3d')](_0x5c01b4);}return db[_0x10d609][_0x90fd('0x3f')](_0x53d868);})['then'](function(_0x1c4662){_0x21862b[_0x90fd('0x40')]=_0x1c4662[_0x90fd('0x40')];_0x2904cd=_0x1c4662[_0x90fd('0x23')];return rtq['getRealtimeQueues'](_0x59e6af,_0x67257f);})[_0x90fd('0x20')](function(_0x51e934){_0x5bb66f=_0x51e934[_0x90fd('0x23')];return rtq[_0x90fd('0x54')](_0x2904cd,_0x5bb66f,_0x67257f,_0x59e6af['query'][_0x90fd('0x29')]);})['then'](function(_0x4d47fa){_0x21862b[_0x90fd('0x23')]=_0x4d47fa;return _0x21862b;})[_0x90fd('0x20')](respondWithFilteredResult(_0x2792f4,_0x53d868))[_0x90fd('0x48')](APIHandleError(_0x2792f4));}; \ No newline at end of file +var _0xb749=['getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','order','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','online','getOptions','raw','push','FIELD(id,','forEach','Pause','where','merge','user','Agents','assign','UserProfile','findAndCountAll','rows','find','getAgentStatus','fields','pick','catch','getQueues','isValidChannel','startCase','Queue','rawAttributes','name','voice','outbound','dialActive','dialMethod','userProfileId','Queues','filter','getResources'];(function(_0x345844,_0x270a86){var _0x20dde1=function(_0x56ed20){while(--_0x56ed20){_0x345844['push'](_0x345844['shift']());}};_0x20dde1(++_0x270a86);}(_0xb749,0xa4));var _0x9b74=function(_0x2f9a58,_0x2fa88c){_0x2f9a58=_0x2f9a58-0x0;var _0x5ad5ff=_0xb749[_0x2f9a58];return _0x5ad5ff;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x9b74('0x0'));var rtq=require(_0x9b74('0x1'));var qs=require(_0x9b74('0x2'));var utils=require(_0x9b74('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x9b74('0x4'))[_0x9b74('0x5')];var APIHandleError=require('../../errors/api')[_0x9b74('0x6')];function respondWithFilteredResult(_0x3386a1,_0xd41bad){return function(_0x58ac91){if(_0x58ac91){var _0x312b6e=typeof _0xd41bad[_0x9b74('0x7')]===_0x9b74('0x8')&&typeof _0xd41bad[_0x9b74('0x9')]===_0x9b74('0x8');var _0x4efc88=_0x58ac91[_0x9b74('0xa')];var _0x3dcc5d=_0x312b6e?0x0:_0xd41bad[_0x9b74('0x7')];var _0x4aaf5e=_0x312b6e?_0x58ac91[_0x9b74('0xa')]:_0xd41bad[_0x9b74('0x7')]+_0xd41bad['limit'];var _0x4cbae8;if(_0x4aaf5e>=_0x4efc88){_0x4aaf5e=_0x4efc88;_0x4cbae8=0xc8;}else{_0x4cbae8=0xce;}_0x3386a1[_0x9b74('0xb')](_0x4cbae8);return _0x3386a1[_0x9b74('0xc')]('Content-Range',_0x3dcc5d+'-'+_0x4aaf5e+'/'+_0x4efc88)[_0x9b74('0xd')](_0x58ac91);}return null;};}exports[_0x9b74('0xe')]=function(_0x16b315,_0x487ce7){var _0x3395e1={'count':0x0,'rows':[]};var _0x432d48={};var _0x1e095a;var _0x2e122c=utils[_0x9b74('0xf')]();var _0x41734c;var _0x190d4b;var _0x3c5970=_0x16b315[_0x9b74('0x10')][_0x9b74('0x11')];var _0x3093ca=_0x16b315[_0x9b74('0x10')][_0x9b74('0x12')];var _0x275edd=_0x16b315[_0x9b74('0x10')][_0x9b74('0x13')];var _0x7357b2=_0x3093ca===_0x9b74('0x14')||_0x3093ca===_0x9b74('0x15')?!![]:![];var _0x27143d=[];var _0x1fa150;var _0x14f78c;Promise[_0x9b74('0x16')]()[_0x9b74('0x17')](function(){if(_0x16b315[_0x9b74('0x10')]['channel']){if(!utils['isValidChannel'](_0x16b315[_0x9b74('0x10')]['channel'])){throw new APIBadRequestError(util[_0x9b74('0x18')](_0x9b74('0x19'),_0x16b315[_0x9b74('0x10')][_0x9b74('0x1a')]));}_0x1e095a=_0x16b315['query'][_0x9b74('0x1a')][_0x9b74('0x1b')]();}if(!_0x16b315[_0x9b74('0x10')][_0x9b74('0x1c')]||!_0x16b315[_0x9b74('0x10')]['sort'][_0x9b74('0x1d')](_0x9b74('0x1e'))){_0x16b315[_0x9b74('0x10')][_0x9b74('0x1c')]=rta[_0x9b74('0x1f')](_0x16b315['query'][_0x9b74('0x1c')]);return;}var _0x2a430f=rta[_0x9b74('0x20')](_0x16b315[_0x9b74('0x10')]['sort']);_0x16b315[_0x9b74('0x10')][_0x9b74('0x1c')]=_0x2a430f['fields']['join'](',');_0x1fa150=_0x2a430f[_0x9b74('0x21')];})[_0x9b74('0x17')](function(){if(!_0x3c5970){return[];}return rta['getAgentIdsByQueues'](_0x3c5970,_0x1e095a);})[_0x9b74('0x17')](function(_0x3f8bf6){_0x27143d=_0x3f8bf6;return rta[_0x9b74('0x22')]();})[_0x9b74('0x17')](function(_0x26c530){_0x190d4b=_0x26c530['rows'];if((!_0x3093ca||_0x7357b2)&&!_0x1fa150){return _0x27143d;}if(_0x1fa150&&!_0x3093ca){return rta[_0x9b74('0x23')](_0x190d4b,_0x27143d,_0x1fa150);}else{return rta[_0x9b74('0x24')](_0x190d4b,_0x27143d,_0x3093ca);}})[_0x9b74('0x17')](function(_0x439496){_0x27143d=_0x439496;var _0x446d31=![];if(_0x27143d[_0x9b74('0x25')]===0x0){if(_0x3c5970||_0x3093ca){_0x446d31=!![];}if(_0x7357b2){_0x446d31=![];}}if(_0x446d31){return _0x3395e1;}var _0x5428ab=_[_0x9b74('0x26')](db[_0x9b74('0x27')]['rawAttributes'],function(_0x3241f6){return{'name':_0x3241f6[_0x9b74('0x28')],'type':_0x3241f6[_0x9b74('0x29')][_0x9b74('0x2a')]};});_0x16b315['query'][_0x9b74('0x2b')]=_0x9b74('0x2c');_0x16b315['query'][_0x9b74('0x2d')]=!![];_0x432d48=qs[_0x9b74('0x2e')](_0x5428ab,_0x16b315);_0x432d48[_0x9b74('0x2f')]=!![];var _0x3d5f90=[];if(_0x27143d[_0x9b74('0x25')]>0x0){_0x3d5f90[_0x9b74('0x30')]({'id':{'$in':_0x27143d}});if(_0x1fa150&&!_0x3093ca){_0x14f78c=[db['sequelize']['literal'](_0x9b74('0x31')+_0x27143d+')')];_0x432d48[_0x9b74('0x21')]=_0x14f78c;}}if(_0x7357b2){_0x2e122c['forEach'](function(_0x2f5a79){var _0x43b862=!![];if(_0x3093ca===_0x9b74('0x15')&&_0x1e095a!==_0x2f5a79){_0x43b862=![];}_0x3d5f90[_0x9b74('0x30')]({[_0x2f5a79+'Pause']:_0x43b862});});if(_0x275edd){_0x3d5f90['push']({'pauseType':_0x275edd});}}else if(_0x3093ca){_0x2e122c[_0x9b74('0x32')](function(_0x1d38bf){_0x3d5f90['push']({[_0x1d38bf+_0x9b74('0x33')]:![]});});}_0x432d48[_0x9b74('0x34')]=_[_0x9b74('0x35')](_0x432d48[_0x9b74('0x34')],{'$and':_0x3d5f90});if(_0x16b315['user'][_0x9b74('0x2b')]===_0x9b74('0x36')){var _0x191441={'params':{'id':_0x16b315['user']['userProfileId']},'query':{'section':_0x9b74('0x37'),'role':'agent','online':!![],'raw':!![],'ids':_0x27143d,'customSorting':_0x14f78c}};if(_0x7357b2){_0x191441[_0x9b74('0x10')]['extraQueryConditions']=_0x3d5f90;}_0x191441['query']=Object[_0x9b74('0x38')](_0x191441[_0x9b74('0x10')],_0x16b315[_0x9b74('0x10')]);delete _0x191441['query']['id'];return db[_0x9b74('0x39')]['getResources'](_0x191441);}return db[_0x9b74('0x27')][_0x9b74('0x3a')](_0x432d48);})['then'](function(_0x562136){_0x3395e1['count']=_0x562136[_0x9b74('0xa')];_0x41734c=_0x562136[_0x9b74('0x3b')];return _0x41734c['map'](function(_0xf0be3a){var _0x4d2a6d=_[_0x9b74('0x3c')](_0x190d4b,['id',_0xf0be3a['id']]);if(_0x4d2a6d){var _0x56a2c1=rta['filterAgentAttributes'](_0x4d2a6d);_['merge'](_0xf0be3a,_0x56a2c1);}_0xf0be3a[_0x9b74('0x1e')]=rta[_0x9b74('0x3d')](_0xf0be3a);if(_0xf0be3a[_0x9b74('0x1e')]['includes'](_0x9b74('0x14'))){_0x2e122c[_0x9b74('0x32')](function(_0x769de6){if(_0xf0be3a[_0x769de6+_0x9b74('0x33')]){_0xf0be3a[_0x769de6+'Status']=_0x9b74('0x14');}});}return _0xf0be3a;});})['then'](function(_0x261325){if(!_0x1fa150||_0x14f78c){return _0x261325;}return rta['sortAgentsByStatus'](_0x261325,_0x1fa150);})[_0x9b74('0x17')](function(_0x5c1c59){var _0x2a2629=null;if(_0x16b315[_0x9b74('0x10')][_0x9b74('0x3e')]){var _0x512c03=_0x16b315['query'][_0x9b74('0x3e')]['split'](',');_0x2a2629=_0x5c1c59[_0x9b74('0x26')](function(_0x2fd675){return _[_0x9b74('0x3f')](_0x2fd675,_0x512c03);});}_0x3395e1['rows']=_0x2a2629||_0x5c1c59;return _0x3395e1;})[_0x9b74('0x17')](respondWithFilteredResult(_0x487ce7,_0x432d48))[_0x9b74('0x40')](APIHandleError(_0x487ce7));};exports[_0x9b74('0x41')]=function(_0x44b734,_0x21deff){var _0x53160e={'count':0x0,'rows':[]};var _0x5b8461={};var _0x440937;var _0x121619;var _0x406bea;Promise[_0x9b74('0x16')]()[_0x9b74('0x17')](function(){if(_0x44b734['query']['channel']){if(!utils[_0x9b74('0x42')](_0x44b734[_0x9b74('0x10')][_0x9b74('0x1a')])){throw new APIBadRequestError(util[_0x9b74('0x18')](_0x9b74('0x19'),_0x44b734[_0x9b74('0x10')][_0x9b74('0x1a')]));}_0x440937=_0x44b734[_0x9b74('0x10')][_0x9b74('0x1a')]['toLowerCase']();}var _0x53e9da=_[_0x9b74('0x43')](_0x440937)+_0x9b74('0x44');var _0x2ece09=_[_0x9b74('0x26')](db[_0x53e9da][_0x9b74('0x45')],function(_0xccf474){return{'name':_0xccf474[_0x9b74('0x28')],'type':_0xccf474[_0x9b74('0x29')][_0x9b74('0x2a')]};});if(!_0x44b734[_0x9b74('0x10')][_0x9b74('0x3e')]){var _0x15be1e=['id',_0x9b74('0x46')];if(_0x440937===_0x9b74('0x47')){_0x15be1e[_0x9b74('0x30')](_0x9b74('0x29'));if(_0x44b734[_0x9b74('0x10')]['type']===_0x9b74('0x48')){_0x15be1e[_0x9b74('0x30')]([_0x9b74('0x49'),_0x9b74('0x4a')]);}}_0x44b734[_0x9b74('0x10')][_0x9b74('0x3e')]=_0x15be1e['join'](',');}_0x5b8461=qs[_0x9b74('0x2e')](_0x2ece09,_0x44b734);if(_0x44b734[_0x9b74('0x36')][_0x9b74('0x2b')]==='user'){var _0x11b043={'params':{'id':_0x44b734[_0x9b74('0x36')][_0x9b74('0x4b')]},'query':{'section':_0x440937===_0x9b74('0x47')&&_0x44b734['query'][_0x9b74('0x29')]===_0x9b74('0x48')?'QueueCampaigns':_[_0x9b74('0x43')](_0x440937)+_0x9b74('0x4c'),'type':_0x44b734[_0x9b74('0x10')]['type'],'nolimit':!![],'sort':_0x9b74('0x46'),'filter':_0x44b734[_0x9b74('0x10')][_0x9b74('0x4d')]}};return db[_0x9b74('0x39')][_0x9b74('0x4e')](_0x11b043);}return db[_0x53e9da][_0x9b74('0x3a')](_0x5b8461);})[_0x9b74('0x17')](function(_0x8d69c0){_0x53160e[_0x9b74('0xa')]=_0x8d69c0[_0x9b74('0xa')];_0x121619=_0x8d69c0['rows'];return rtq[_0x9b74('0x4f')](_0x44b734,_0x440937);})[_0x9b74('0x17')](function(_0x30ef35){_0x406bea=_0x30ef35['rows'];return rtq[_0x9b74('0x50')](_0x121619,_0x406bea,_0x440937,_0x44b734[_0x9b74('0x10')][_0x9b74('0x29')]);})[_0x9b74('0x17')](function(_0x47d348){_0x53160e[_0x9b74('0x3b')]=_0x47d348;return _0x53160e;})[_0x9b74('0x17')](respondWithFilteredResult(_0x21deff,_0x5b8461))[_0x9b74('0x40')](APIHandleError(_0x21deff));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 3e325c1..90e2777 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11be8d,_0x182be2){var _0x560f37=function(_0x15a951){while(--_0x15a951){_0x11be8d['push'](_0x11be8d['shift']());}};_0x560f37(++_0x182be2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4d23a5,_0x130c31){var _0x2cc5f7=function(_0x2e5adb){while(--_0x2e5adb){_0x4d23a5['push'](_0x4d23a5['shift']());}};_0x2cc5f7(++_0x130c31);}(_0x70e0,0x17b));var _0x070e=function(_0x414044,_0x5da5a1){_0x414044=_0x414044-0x0;var _0x5d944e=_0x70e0[_0x414044];return _0x5d944e;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 94a563b..c541b5d 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 _0xc029=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x50ca08,_0x87cdfd){var _0x16143b=function(_0x35d50e){while(--_0x35d50e){_0x50ca08['push'](_0x50ca08['shift']());}};_0x16143b(++_0x87cdfd);}(_0xc029,0x1df));var _0x9c02=function(_0x23c827,_0x37332a){_0x23c827=_0x23c827-0x0;var _0x3d7f1f=_0xc029[_0x23c827];return _0x3d7f1f;};'use strict';var Sequelize=require(_0x9c02('0x0'));module[_0x9c02('0x1')]={'state':{'type':Sequelize[_0x9c02('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9c02('0x3')]},'scheduledat':{'type':Sequelize[_0x9c02('0x4')]},'uniqueid':{'type':Sequelize[_0x9c02('0x3')]},'starttime':{'type':Sequelize[_0x9c02('0x4')]},'responsetime':{'type':Sequelize[_0x9c02('0x4')]},'ringtime':{'type':Sequelize[_0x9c02('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9c02('0x3')]},'campaigntype':{'type':Sequelize[_0x9c02('0x3')]},'membername':{'type':Sequelize[_0x9c02('0x3')]}}; \ No newline at end of file +var _0x7f3f=['sequelize','exports','STRING','DATE'];(function(_0x33da1c,_0x32284c){var _0x382dee=function(_0x3c8bb6){while(--_0x3c8bb6){_0x33da1c['push'](_0x33da1c['shift']());}};_0x382dee(++_0x32284c);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x7f3f[_0x10d670];return _0x20d6f8;};'use strict';var Sequelize=require(_0xf7f3('0x0'));module[_0xf7f3('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf7f3('0x2')]},'scheduledat':{'type':Sequelize[_0xf7f3('0x3')]},'uniqueid':{'type':Sequelize[_0xf7f3('0x2')]},'starttime':{'type':Sequelize[_0xf7f3('0x3')]},'responsetime':{'type':Sequelize[_0xf7f3('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf7f3('0x2')]},'campaigntype':{'type':Sequelize[_0xf7f3('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 38d271c..86a0ff5 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 _0xc31b=['moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x563ccc,_0x3f10a9){var _0x174990=function(_0x5d3178){while(--_0x5d3178){_0x563ccc['push'](_0x563ccc['shift']());}};_0x174990(++_0x3f10a9);}(_0xc31b,0xec));var _0xbc31=function(_0x83e719,_0x3cdcf2){_0x83e719=_0x83e719-0x0;var _0x3848d3=_0xc31b[_0x83e719];return _0x3848d3;};'use strict';var _=require(_0xbc31('0x0'));var util=require(_0xbc31('0x1'));var logger=require(_0xbc31('0x2'))(_0xbc31('0x3'));var moment=require(_0xbc31('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc31('0x5'));var rimraf=require(_0xbc31('0x6'));var config=require(_0xbc31('0x7'));var attributes=require(_0xbc31('0x8'));module[_0xbc31('0x9')]=function(_0x533686,_0xedf9bf){return _0x533686['define'](_0xbc31('0xa'),attributes,{'tableName':_0xbc31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd301=['api','moment','request-promise','path','rimraf','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x3635b1,_0x275e6b){var _0x30c29a=function(_0x1525e5){while(--_0x1525e5){_0x3635b1['push'](_0x3635b1['shift']());}};_0x30c29a(++_0x275e6b);}(_0xd301,0xbd));var _0x1d30=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0xd301[_0x24679e];return _0x291f21;};'use strict';var _=require(_0x1d30('0x0'));var util=require(_0x1d30('0x1'));var logger=require(_0x1d30('0x2'))(_0x1d30('0x3'));var moment=require(_0x1d30('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d30('0x5'));var fs=require('fs');var path=require(_0x1d30('0x6'));var rimraf=require(_0x1d30('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x1d30('0x8')]=function(_0x39074d,_0x1d77d6){return _0x39074d[_0x1d30('0x9')](_0x1d30('0xa'),attributes,{'tableName':_0x1d30('0xb'),'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 aa39d0e..abd09b3 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 _0xf4d3=['options','raw','then','util','bluebird','randomstring','ioredis','../../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','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x2f43f4,_0x2428b1){var _0x4f4223=function(_0x5b4c1a){while(--_0x5b4c1a){_0x2f43f4['push'](_0x2f43f4['shift']());}};_0x4f4223(++_0x2428b1);}(_0xf4d3,0x147));var _0x3f4d=function(_0x573a1e,_0x1cae49){_0x573a1e=_0x573a1e-0x0;var _0x147333=_0xf4d3[_0x573a1e];return _0x147333;};'use strict';var _=require('lodash');var util=require(_0x3f4d('0x0'));var moment=require('moment');var BPromise=require(_0x3f4d('0x1'));var rs=require(_0x3f4d('0x2'));var fs=require('fs');var Redis=require(_0x3f4d('0x3'));var db=require(_0x3f4d('0x4'))['db'];var utils=require(_0x3f4d('0x5'));var logger=require(_0x3f4d('0x6'))(_0x3f4d('0x7'));var config=require(_0x3f4d('0x8'));var jayson=require(_0x3f4d('0x9'));var client=jayson[_0x3f4d('0xa')][_0x3f4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x388359,_0x4acb5c,_0x298391){return new BPromise(function(_0x529e47,_0x24703b){return client['request'](_0x388359,_0x298391)['then'](function(_0x152acc){logger[_0x3f4d('0xc')](_0x3f4d('0xd'),_0x4acb5c,_0x3f4d('0xe'));logger[_0x3f4d('0xf')](_0x3f4d('0x10'),_0x4acb5c,_0x3f4d('0xe'),JSON['stringify'](_0x152acc));if(_0x152acc[_0x3f4d('0x11')]){if(_0x152acc['error'][_0x3f4d('0x12')]===0x1f4){logger[_0x3f4d('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4acb5c,_0x152acc['error']['message']);return _0x24703b(_0x152acc[_0x3f4d('0x11')][_0x3f4d('0x13')]);}logger[_0x3f4d('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4acb5c,_0x152acc[_0x3f4d('0x11')]['message']);return _0x529e47(_0x152acc[_0x3f4d('0x11')][_0x3f4d('0x13')]);}else{logger[_0x3f4d('0xc')](_0x3f4d('0xd'),_0x4acb5c,_0x3f4d('0xe'));_0x529e47(_0x152acc['result'][_0x3f4d('0x13')]);}})[_0x3f4d('0x14')](function(_0x90e6f7){logger[_0x3f4d('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4acb5c,_0x90e6f7);_0x24703b(_0x90e6f7);});});}exports[_0x3f4d('0x15')]=function(_0x2f8d1c){var _0x3cb0d6=this;return new Promise(function(_0x451cf5,_0x8cdc21){return db[_0x3f4d('0x16')][_0x3f4d('0x17')](_0x2f8d1c['body'],{'raw':_0x2f8d1c[_0x3f4d('0x18')]?_0x2f8d1c[_0x3f4d('0x18')][_0x3f4d('0x19')]===undefined?!![]:![]:!![]})[_0x3f4d('0x1a')](function(_0x46d20a){logger[_0x3f4d('0xc')]('CreateReportAgentPreview',_0x2f8d1c);logger['debug'](_0x3f4d('0x15'),_0x2f8d1c,JSON['stringify'](_0x46d20a));_0x451cf5(_0x46d20a);})[_0x3f4d('0x14')](function(_0x500e51){logger['error'](_0x3f4d('0x15'),_0x500e51[_0x3f4d('0x13')],_0x2f8d1c);_0x8cdc21(_0x3cb0d6[_0x3f4d('0x11')](0x1f4,_0x500e51[_0x3f4d('0x13')]));});});}; \ No newline at end of file +var _0x5da3=['error','code','message','result','catch','create','body','options','CreateReportAgentPreview','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5da3,0xe2));var _0x35da=function(_0x22ddef,_0xff7777){_0x22ddef=_0x22ddef-0x0;var _0x108590=_0x5da3[_0x22ddef];return _0x108590;};'use strict';var _=require(_0x35da('0x0'));var util=require(_0x35da('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35da('0x2'));var fs=require('fs');var Redis=require(_0x35da('0x3'));var db=require(_0x35da('0x4'))['db'];var utils=require(_0x35da('0x5'));var logger=require('../../config/logger')(_0x35da('0x6'));var config=require(_0x35da('0x7'));var jayson=require(_0x35da('0x8'));var client=jayson[_0x35da('0x9')][_0x35da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21e062,_0x251730,_0x54ab90){return new BPromise(function(_0x13642c,_0x1e8fb0){return client['request'](_0x21e062,_0x54ab90)[_0x35da('0xb')](function(_0x4bfe34){logger[_0x35da('0xc')](_0x35da('0xd'),_0x251730,'request\x20sent');logger[_0x35da('0xe')](_0x35da('0xf'),_0x251730,_0x35da('0x10'),JSON['stringify'](_0x4bfe34));if(_0x4bfe34['error']){if(_0x4bfe34[_0x35da('0x11')][_0x35da('0x12')]===0x1f4){logger[_0x35da('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x251730,_0x4bfe34[_0x35da('0x11')]['message']);return _0x1e8fb0(_0x4bfe34['error']['message']);}logger['error'](_0x35da('0xd'),_0x251730,_0x4bfe34[_0x35da('0x11')][_0x35da('0x13')]);return _0x13642c(_0x4bfe34[_0x35da('0x11')][_0x35da('0x13')]);}else{logger[_0x35da('0xc')](_0x35da('0xd'),_0x251730,'request\x20sent');_0x13642c(_0x4bfe34[_0x35da('0x14')]['message']);}})[_0x35da('0x15')](function(_0x5a02a8){logger[_0x35da('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x251730,_0x5a02a8);_0x1e8fb0(_0x5a02a8);});});}exports['CreateReportAgentPreview']=function(_0x334d54){var _0x2efc63=this;return new Promise(function(_0x1b579d,_0x3cc966){return db['ReportAgentPreview'][_0x35da('0x16')](_0x334d54[_0x35da('0x17')],{'raw':_0x334d54[_0x35da('0x18')]?_0x334d54['options']['raw']===undefined?!![]:![]:!![]})[_0x35da('0xb')](function(_0x27d0e1){logger['info'](_0x35da('0x19'),_0x334d54);logger[_0x35da('0xe')](_0x35da('0x19'),_0x334d54,JSON[_0x35da('0x1a')](_0x27d0e1));_0x1b579d(_0x27d0e1);})[_0x35da('0x15')](function(_0x2c2a89){logger[_0x35da('0x11')](_0x35da('0x19'),_0x2c2a89[_0x35da('0x13')],_0x334d54);_0x3cc966(_0x2efc63[_0x35da('0x11')](0x1f4,_0x2c2a89[_0x35da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a2854b3..fab012d 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 _0x1a35=['voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor'];(function(_0x8924ca,_0x27dd93){var _0x2f47ee=function(_0x40657d){while(--_0x40657d){_0x8924ca['push'](_0x8924ca['shift']());}};_0x2f47ee(++_0x27dd93);}(_0x1a35,0x1a3));var _0x51a3=function(_0x5a22df,_0x3a47fd){_0x5a22df=_0x5a22df-0x0;var _0x23052c=_0x1a35[_0x5a22df];return _0x23052c;};'use strict';var multer=require(_0x51a3('0x0'));var util=require(_0x51a3('0x1'));var path=require('path');var express=require(_0x51a3('0x2'));var router=express[_0x51a3('0x3')]();var auth=require(_0x51a3('0x4'));var controller=require(_0x51a3('0x5'));router['get'](_0x51a3('0x6'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x8')]);router[_0x51a3('0x9')](_0x51a3('0xa'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x51a3('0x9')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x51a3('0x7')](),controller[_0x51a3('0xb')]);router[_0x51a3('0x9')](_0x51a3('0xc'),auth[_0x51a3('0x7')](),controller[_0x51a3('0xd')]);router['get'](_0x51a3('0xe'),auth[_0x51a3('0x7')](),controller[_0x51a3('0xf')]);router[_0x51a3('0x9')](_0x51a3('0x10'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x11')]);router['get'](_0x51a3('0x12'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x13')]);router['get'](_0x51a3('0x14'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x15')]);router[_0x51a3('0x9')](_0x51a3('0x16'),auth['isAuthenticated'](),controller[_0x51a3('0x17')]);router['get'](_0x51a3('0x18'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x19')]);router[_0x51a3('0x9')](_0x51a3('0x1a'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x1b')]);router[_0x51a3('0x9')](_0x51a3('0x1c'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x1d')]);router[_0x51a3('0x9')]('/voice/queues/channels',auth[_0x51a3('0x7')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x51a3('0x7')](),controller[_0x51a3('0x1e')]);router[_0x51a3('0x9')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x51a3('0x7')](),controller[_0x51a3('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x51a3('0x20')]);router[_0x51a3('0x9')](_0x51a3('0x21'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x22')]);router[_0x51a3('0x23')](_0x51a3('0x21'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x24')]);router[_0x51a3('0x9')](_0x51a3('0x25'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x26')]);router[_0x51a3('0x9')](_0x51a3('0x27'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x28')]);router[_0x51a3('0x9')](_0x51a3('0x29'),auth[_0x51a3('0x7')](),controller['agents']);router['put'](_0x51a3('0x2a'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x2b')]);router['get'](_0x51a3('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0x51a3('0x9')](_0x51a3('0x2d'),auth['isAuthenticated'](),controller[_0x51a3('0x2e')]);router[_0x51a3('0x9')](_0x51a3('0x2f'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x30')]);router[_0x51a3('0x9')](_0x51a3('0x31'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x32')]);router[_0x51a3('0x9')](_0x51a3('0x33'),auth[_0x51a3('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x51a3('0x9')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x51a3('0x34')]);router['get'](_0x51a3('0x35'),auth['isAuthenticated'](),controller[_0x51a3('0x36')]);router[_0x51a3('0x9')](_0x51a3('0x37'),auth['isAuthenticated'](),controller[_0x51a3('0x38')]);router['get'](_0x51a3('0x39'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x3a')]);router[_0x51a3('0x9')](_0x51a3('0x3b'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x3c')]);router[_0x51a3('0x9')](_0x51a3('0x3d'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x3e')]);router[_0x51a3('0x3f')](_0x51a3('0x40'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x41')](_0x51a3('0x42')));router[_0x51a3('0x9')]('/mail/queues/:id',auth[_0x51a3('0x7')](),controller[_0x51a3('0x43')]);router[_0x51a3('0x3f')](_0x51a3('0x44'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x41')](_0x51a3('0x45')));router['get'](_0x51a3('0x46'),auth[_0x51a3('0x7')](),controller['showChatQueues']);router[_0x51a3('0x3f')](_0x51a3('0x47'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x41')](_0x51a3('0x48')));router['get'](_0x51a3('0x49'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x4a')]);router[_0x51a3('0x3f')](_0x51a3('0x4b'),auth['isAuthenticated'](),controller['queueNotify'](_0x51a3('0x4c')));router[_0x51a3('0x9')]('/openchannel/queues/:id',auth[_0x51a3('0x7')](),controller[_0x51a3('0x4d')]);router[_0x51a3('0x3f')](_0x51a3('0x4e'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x41')](_0x51a3('0x4f')));router[_0x51a3('0x3f')]('/whatsapp/queues/:id/notify',auth[_0x51a3('0x7')](),controller[_0x51a3('0x41')](_0x51a3('0x50')));router[_0x51a3('0x9')]('/sms/queues/:id',auth[_0x51a3('0x7')](),controller[_0x51a3('0x51')]);router[_0x51a3('0x9')](_0x51a3('0x52'),auth[_0x51a3('0x7')](),controller['showWhatsappQueues']);router[_0x51a3('0x3f')](_0x51a3('0x53'),auth[_0x51a3('0x7')](),controller[_0x51a3('0x54')]);module[_0x51a3('0x55')]=router; \ No newline at end of file +var _0x1255=['voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','/outbound','/outbound/channels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','fax','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x1255,0x1b7));var _0x5125=function(_0x1cae7c,_0x54ad1f){_0x1cae7c=_0x1cae7c-0x0;var _0x6f95df=_0x1255[_0x1cae7c];return _0x6f95df;};'use strict';var multer=require(_0x5125('0x0'));var util=require(_0x5125('0x1'));var path=require(_0x5125('0x2'));var express=require(_0x5125('0x3'));var router=express[_0x5125('0x4')]();var auth=require(_0x5125('0x5'));var controller=require(_0x5125('0x6'));router[_0x5125('0x7')]('/voice/channels',auth[_0x5125('0x8')](),controller[_0x5125('0x9')]);router[_0x5125('0x7')](_0x5125('0xa'),auth[_0x5125('0x8')](),controller[_0x5125('0xb')]);router['get'](_0x5125('0xc'),auth[_0x5125('0x8')](),controller[_0x5125('0xd')]);router['get'](_0x5125('0xe'),auth['isAuthenticated'](),controller[_0x5125('0xf')]);router[_0x5125('0x7')](_0x5125('0x10'),auth[_0x5125('0x8')](),controller[_0x5125('0x11')]);router[_0x5125('0x7')](_0x5125('0x12'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x5125('0x7')](_0x5125('0x13'),auth[_0x5125('0x8')](),controller['mailAccounts']);router['get'](_0x5125('0x14'),auth[_0x5125('0x8')](),controller[_0x5125('0x15')]);router[_0x5125('0x7')](_0x5125('0x16'),auth['isAuthenticated'](),controller[_0x5125('0x17')]);router['get'](_0x5125('0x18'),auth[_0x5125('0x8')](),controller['whatsappQueues']);router[_0x5125('0x7')](_0x5125('0x19'),auth[_0x5125('0x8')](),controller['faxQueues']);router[_0x5125('0x7')]('/voice/queues/preview/:id',auth[_0x5125('0x8')](),controller['voiceQueuesPreview']);router[_0x5125('0x7')]('/voice/queues/channels',auth[_0x5125('0x8')](),controller[_0x5125('0x1a')]);router['get'](_0x5125('0x1b'),auth['isAuthenticated'](),controller[_0x5125('0x1c')]);router[_0x5125('0x7')](_0x5125('0x1d'),auth['isAuthenticated'](),controller[_0x5125('0x1e')]);router[_0x5125('0x7')](_0x5125('0x1f'),auth[_0x5125('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x5125('0x7')](_0x5125('0x20'),auth['isAuthenticated'](),controller[_0x5125('0x21')]);router[_0x5125('0x22')](_0x5125('0x20'),auth[_0x5125('0x8')](),controller['updateVoiceQueue']);router[_0x5125('0x7')](_0x5125('0x23'),auth[_0x5125('0x8')](),controller['outbound']);router['get'](_0x5125('0x24'),auth[_0x5125('0x8')](),controller['outboundChannels']);router[_0x5125('0x7')](_0x5125('0x25'),auth[_0x5125('0x8')](),controller['agents']);router[_0x5125('0x22')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x5125('0x26')]);router['get'](_0x5125('0x27'),auth[_0x5125('0x8')](),controller[_0x5125('0x28')]);router[_0x5125('0x7')](_0x5125('0x29'),auth[_0x5125('0x8')](),controller[_0x5125('0x2a')]);router['get']('/campaigns',auth[_0x5125('0x8')](),controller[_0x5125('0x2b')]);router[_0x5125('0x7')]('/fax/accounts',auth[_0x5125('0x8')](),controller['faxAccounts']);router[_0x5125('0x7')](_0x5125('0x2c'),auth['isAuthenticated'](),controller[_0x5125('0x2d')]);router[_0x5125('0x7')]('/mail/queues/waitinginteractions',auth[_0x5125('0x8')](),controller[_0x5125('0x2e')]);router[_0x5125('0x7')](_0x5125('0x2f'),auth['isAuthenticated'](),controller[_0x5125('0x30')]);router[_0x5125('0x7')](_0x5125('0x31'),auth[_0x5125('0x8')](),controller[_0x5125('0x32')]);router[_0x5125('0x7')]('/sms/queues/waitinginteractions',auth[_0x5125('0x8')](),controller[_0x5125('0x33')]);router[_0x5125('0x7')](_0x5125('0x34'),auth[_0x5125('0x8')](),controller[_0x5125('0x35')]);router['get'](_0x5125('0x36'),auth[_0x5125('0x8')](),controller[_0x5125('0x37')]);router[_0x5125('0x38')](_0x5125('0x39'),auth[_0x5125('0x8')](),controller['queueNotify']('mail'));router['get'](_0x5125('0x3a'),auth[_0x5125('0x8')](),controller[_0x5125('0x3b')]);router[_0x5125('0x38')]('/chat/queues/:id/notify',auth[_0x5125('0x8')](),controller[_0x5125('0x3c')](_0x5125('0x3d')));router['get'](_0x5125('0x3e'),auth[_0x5125('0x8')](),controller['showChatQueues']);router[_0x5125('0x38')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x5125('0x3c')](_0x5125('0x3f')));router['get']('/fax/queues/:id',auth[_0x5125('0x8')](),controller['showFaxQueues']);router['post'](_0x5125('0x40'),auth[_0x5125('0x8')](),controller[_0x5125('0x3c')]('openchannel'));router[_0x5125('0x7')]('/openchannel/queues/:id',auth[_0x5125('0x8')](),controller[_0x5125('0x41')]);router['post'](_0x5125('0x42'),auth[_0x5125('0x8')](),controller[_0x5125('0x3c')]('sms'));router[_0x5125('0x38')](_0x5125('0x43'),auth['isAuthenticated'](),controller[_0x5125('0x3c')](_0x5125('0x44')));router[_0x5125('0x7')](_0x5125('0x45'),auth[_0x5125('0x8')](),controller[_0x5125('0x46')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x5125('0x47')]);router[_0x5125('0x38')](_0x5125('0x48'),auth[_0x5125('0x8')](),controller[_0x5125('0x49')]);module[_0x5125('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 45663ec..a7aaaa7 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 _0x5075=['api','client','http','then','error','message','result','status','json','name','send','isNil','rows','find','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','queue','InteractionId','From','QueueId','TransferReport','create','Start','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Agent\x20not\x20found','MessageId','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0x5075,0x73));var _0x5507=function(_0x35655f,_0x23dfc3){_0x35655f=_0x35655f-0x0;var _0x1f2ae8=_0x5075[_0x35655f];return _0x1f2ae8;};'use strict';var BPromise=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var _=require(_0x5507('0x2'));var util=require(_0x5507('0x3'));var db=require(_0x5507('0x4'))['db'];var logger=require(_0x5507('0x5'))(_0x5507('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x5507('0x7')][_0x5507('0x8')]({'port':0x232a});var mailClient=jayson[_0x5507('0x7')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x5507('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x773559,_0x4c2d6d,_0x42c232){return new BPromise(function(_0x7cc84c,_0xbf4b50){var _0x504e05=_0x42c232?_0x42c232:amiClient;return _0x504e05['request'](_0x773559,_0x4c2d6d)[_0x5507('0x9')](function(_0x441bdc){if(_0x441bdc[_0x5507('0xa')]){if(_0x441bdc[_0x5507('0xa')]['code']===0x1f4){return _0xbf4b50(_0x441bdc[_0x5507('0xa')][_0x5507('0xb')]);}return _0x7cc84c(_0x441bdc['error'][_0x5507('0xb')]);}else{_0x7cc84c(_0x441bdc[_0x5507('0xc')]);}})['catch'](function(_0x37a1de){_0xbf4b50(_0x37a1de);});});}function respondWithResult(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xc8;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0xd')](_0x32c872)[_0x5507('0xe')](_0x267f27);}return _0x2a2ea0['sendStatus'](0x194);};}function handleError(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0x1f4;return function(_0xc828e5){logger[_0x5507('0xa')](_0xc828e5['stack']);if(_0xc828e5[_0x5507('0xf')]){delete _0xc828e5[_0x5507('0xf')];}_0x9cc3f9[_0x5507('0xd')](_0x2b7c43)[_0x5507('0x10')](_0xc828e5);};}function findById(_0xa6e4b3){return function(_0x2ede34){if(!_[_0x5507('0x11')](_0xa6e4b3)&&!_[_0x5507('0x11')](_0x2ede34)&&!_[_0x5507('0x11')](_0x2ede34[_0x5507('0x12')])){return _[_0x5507('0x13')](_0x2ede34[_0x5507('0x12')],function(_0x3822dd){return _0x3822dd['id']==_0xa6e4b3;});}return null;};}exports['voiceChannels']=function(_0x14dab0,_0x276a81){return respondWithRpcPromise(_0x5507('0x14'),_0x14dab0[_0x5507('0x15')])['then'](respondWithResult(_0x276a81,null))[_0x5507('0x16')](handleError(_0x276a81,null));};exports[_0x5507('0x17')]=function(_0x1a54b0,_0x3ca1f7){return respondWithRpcPromise(_0x5507('0x18'),_[_0x5507('0x19')](_0x1a54b0['query'],_0x1a54b0[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x3ca1f7,null))[_0x5507('0x16')](handleError(_0x3ca1f7,null));};exports[_0x5507('0x1b')]=function(_0x141d22,_0x2de482){return respondWithRpcPromise(_0x5507('0x1c'),_[_0x5507('0x19')](_0x141d22[_0x5507('0x15')],_0x141d22[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x2de482,null))[_0x5507('0x16')](handleError(_0x2de482,null));};exports[_0x5507('0x1d')]=function(_0x2ee6ed,_0x1a2203){return respondWithRpcPromise('VoiceQueues',_0x2ee6ed[_0x5507('0x15')])['then'](respondWithResult(_0x1a2203,null))[_0x5507('0x16')](handleError(_0x1a2203,null));};exports['showVoiceQueues']=function(_0xa66a01,_0x24668b){return respondWithRpcPromise('VoiceQueues',_0xa66a01['query'])[_0x5507('0x9')](findById(_0xa66a01[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x24668b,null))[_0x5507('0x16')](handleError(_0x24668b,null));};exports[_0x5507('0x1e')]=function(_0x85d383,_0x38f4d9){return respondWithRpcPromise(_0x5507('0x1f'),_[_0x5507('0x19')](_0x85d383['body'],_0x85d383[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x38f4d9,null))[_0x5507('0x16')](handleError(_0x38f4d9,null));};exports[_0x5507('0x20')]=function(_0x29dd58,_0x495bbe){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x5507('0x19')](_0x29dd58[_0x5507('0x15')],_0x29dd58[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x495bbe,null))['catch'](handleError(_0x495bbe,null));};exports[_0x5507('0x21')]=function(_0x13b6e5,_0xab91bc){return respondWithRpcPromise(_0x5507('0x22'),_0x13b6e5[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xab91bc,null))[_0x5507('0x16')](handleError(_0xab91bc,null));};exports[_0x5507('0x23')]=function(_0x5ede36,_0xf61ba7){return respondWithRpcPromise(_0x5507('0x24'),_[_0x5507('0x19')](_0x5ede36['query'],_0x5ede36['params']))[_0x5507('0x9')](respondWithResult(_0xf61ba7,null))[_0x5507('0x16')](handleError(_0xf61ba7,null));};exports[_0x5507('0x25')]=function(_0x17d01c,_0x143d97){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x17d01c[_0x5507('0x15')],_0x17d01c[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x143d97,null))[_0x5507('0x16')](handleError(_0x143d97,null));};exports['voiceQueuesChannelRedirect']=function(_0x54e4bd,_0x23ea7c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x5507('0x19')](_0x54e4bd[_0x5507('0x15')],_0x54e4bd[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x23ea7c,null))[_0x5507('0x16')](handleError(_0x23ea7c,null));};exports[_0x5507('0x26')]=function(_0x1c8506,_0x2b962d){return respondWithRpcPromise(_0x5507('0x27'),_0x1c8506[_0x5507('0x15')])['then'](respondWithResult(_0x2b962d,null))['catch'](handleError(_0x2b962d,null));};exports['outboundChannels']=function(_0x570eee,_0x526022){return respondWithRpcPromise(_0x5507('0x28'),_0x570eee[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x526022,null))[_0x5507('0x16')](handleError(_0x526022,null));};exports[_0x5507('0x29')]=function(_0xbef058,_0x101de3){var _0xbc9f93;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058[_0x5507('0x15')])[_0x5507('0x9')](function(_0x2db0b2){_0xbc9f93=_0x2db0b2;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058['query'],routingClient);})['then'](function(_0x50eb32){return _[_0x5507('0x19')]({},_0x50eb32,_0xbc9f93);})[_0x5507('0x9')](respondWithResult(_0x101de3,null))[_0x5507('0x16')](handleError(_0x101de3,null));};exports[_0x5507('0x2b')]=function(_0xcd4df5,_0x17d7db){if(_0xcd4df5[_0x5507('0x2c')]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]&&_0xcd4df5[_0x5507('0x2e')]&&_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')]){for(var _0x24d7b5 in _0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]){if(_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x5507('0x2f')](_0x24d7b5)){db[_0x5507('0x30')]['findAll']({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xcd4df5['body'][_0x5507('0x2d')][_0x24d7b5]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x5507('0x31')]?{'$notIn':_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5]}:{'$ne':null}}})[_0x5507('0x9')](function(_0x39ac17){var _0x1dfc9c=moment()['format'](_0x5507('0x32'));for(var _0x33022e=0x0,_0xadea4c=_0x39ac17[_0x5507('0x31')];_0x33022e<_0xadea4c;_0x33022e+=0x1){_0x39ac17[_0x33022e][_0x5507('0x33')]({'exitAt':_0x1dfc9c});}});for(var _0x48d72b=0x0;_0x48d72b<_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5][_0x5507('0x31')];_0x48d72b+=0x1){db[_0x5507('0x30')][_0x5507('0x34')]({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':_0x5507('0x35'),'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b],'exitAt':null},'defaults':{'channel':_0x24d7b5,'membername':_0xcd4df5['user'][_0x5507('0xf')],'interface':_[_0x5507('0x11')](_0xcd4df5['user']['interface'])?util['format'](_0x5507('0x36'),_0xcd4df5['user'][_0x5507('0xf')]):_0xcd4df5['user'][_0x5507('0x37')],'type':'INTERACTION','enterAt':moment()['format'](_0x5507('0x32')),'role':_0x5507('0x38'),'internal':_0xcd4df5[_0x5507('0x2e')][_0x5507('0x39')],'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xcd4df5[_0x5507('0x1a')]['id'],'capacity':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x3a')]},routingClient)['then'](respondWithResult(_0x17d7db,null))[_0x5507('0x16')](handleError(_0x17d7db,null));};exports[_0x5507('0x3b')]=function(_0x505e71,_0x2e0cfc){return respondWithRpcPromise(_0x5507('0x3c'),_0x505e71[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x2e0cfc,null))[_0x5507('0x16')](handleError(_0x2e0cfc,null));};exports[_0x5507('0x3d')]=function(_0x245456,_0x1bb575){return respondWithRpcPromise('Trunks',_0x245456['query'])[_0x5507('0x9')](respondWithResult(_0x1bb575,null))[_0x5507('0x16')](handleError(_0x1bb575,null));};exports[_0x5507('0x3e')]=function(_0x1b34c8,_0xce851d){return respondWithRpcPromise(_0x5507('0x3f'),_0x1b34c8[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xce851d,null))[_0x5507('0x16')](handleError(_0xce851d,null));};exports[_0x5507('0x40')]=function(_0x40cda2,_0x13dc8b){return respondWithRpcPromise(_0x5507('0x41'),_0x40cda2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x13dc8b,null))[_0x5507('0x16')](handleError(_0x13dc8b,null));};exports['showChatQueues']=function(_0x3f47af,_0x56e0cd){return respondWithRpcPromise('ChatQueues',_0x3f47af[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x3f47af[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x56e0cd,null))['catch'](handleError(_0x56e0cd,null));};exports[_0x5507('0x42')]=function(_0x2f41a9,_0x314d4e){return respondWithRpcPromise(_0x5507('0x43'),_0x2f41a9[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x314d4e,null))['catch'](handleError(_0x314d4e,null));};exports[_0x5507('0x44')]=function(_0x46e589,_0x3a2f9f){return respondWithRpcPromise('MailQueues',_0x46e589['query'],routingClient)[_0x5507('0x9')](findById(_0x46e589['params']['id']))[_0x5507('0x9')](respondWithResult(_0x3a2f9f,null))[_0x5507('0x16')](handleError(_0x3a2f9f,null));};exports['mailAccounts']=function(_0x3e796d,_0x1b622f){return respondWithRpcPromise(_0x5507('0x45'),_0x3e796d[_0x5507('0x15')],mailClient)[_0x5507('0x9')](respondWithResult(_0x1b622f,null))[_0x5507('0x16')](handleError(_0x1b622f,null));};exports[_0x5507('0x46')]=function(_0x2928f2,_0x737d39){return respondWithRpcPromise(_0x5507('0x47'),_0x2928f2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x737d39,null))['catch'](handleError(_0x737d39,null));};exports[_0x5507('0x48')]=function(_0x2e904b,_0x219e34){return respondWithRpcPromise(_0x5507('0x47'),_0x2e904b[_0x5507('0x15')],routingClient)['then'](findById(_0x2e904b[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x219e34,null))[_0x5507('0x16')](handleError(_0x219e34,null));};exports[_0x5507('0x49')]=function(_0x241733,_0x54c009){return respondWithRpcPromise(_0x5507('0x4a'),_0x241733[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x54c009,null))['catch'](handleError(_0x54c009,null));};exports[_0x5507('0x4b')]=function(_0x5cfdb0,_0x3dca7d){return respondWithRpcPromise('SmsQueues',_0x5cfdb0['query'],routingClient)[_0x5507('0x9')](findById(_0x5cfdb0[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x3dca7d,null))[_0x5507('0x16')](handleError(_0x3dca7d,null));};exports[_0x5507('0x4c')]=function(_0x31cc0d,_0x4bf567){return respondWithRpcPromise('WhatsappQueues',_0x31cc0d[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4bf567,null))[_0x5507('0x16')](handleError(_0x4bf567,null));};exports[_0x5507('0x4d')]=function(_0x5e3e73,_0x388faa){return respondWithRpcPromise(_0x5507('0x4e'),_0x5e3e73[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x5e3e73[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x388faa,null))[_0x5507('0x16')](handleError(_0x388faa,null));};exports['faxQueues']=function(_0x3802dd,_0xfdbbe5){return respondWithRpcPromise(_0x5507('0x4f'),_0x3802dd['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xfdbbe5,null))['catch'](handleError(_0xfdbbe5,null));};exports['showFaxQueues']=function(_0x55c257,_0x1fef49){return respondWithRpcPromise(_0x5507('0x4f'),_0x55c257[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x55c257[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x1fef49,null))[_0x5507('0x16')](handleError(_0x1fef49,null));};exports['faxAccounts']=function(_0x1812d7,_0x48ed80){return respondWithRpcPromise(_0x5507('0x50'),_0x1812d7[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x48ed80,null))[_0x5507('0x16')](handleError(_0x48ed80,null));};exports[_0x5507('0x51')]=function(_0x120108,_0x4423a8){return respondWithRpcPromise(_0x5507('0x52'),_0x120108[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4423a8,null))[_0x5507('0x16')](handleError(_0x4423a8,null));};exports['mailQueuesWaitingInteractions']=function(_0x94b11c,_0xbb0a62){return respondWithRpcPromise(_0x5507('0x53'),_0x94b11c['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xbb0a62,null))[_0x5507('0x16')](handleError(_0xbb0a62,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x26e777,_0x5815fb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x26e777[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x5815fb,null))[_0x5507('0x16')](handleError(_0x5815fb,null));};exports[_0x5507('0x54')]=function(_0xfb59be,_0xda51d5){return respondWithRpcPromise(_0x5507('0x55'),_0xfb59be[_0x5507('0x15')],routingClient)['then'](function(_0x43fccf){if(_0xfb59be[_0x5507('0x15')][_0x5507('0x56')]!==undefined){var _0x75aa3c=_(_0x43fccf[_0x5507('0x12')])[_0x5507('0x57')]([_0xfb59be[_0x5507('0x15')][_0x5507('0x56')],_0xfb59be[_0x5507('0x1a')]['id']])[_0x5507('0x58')](_0x5507('0x59'))[_0x5507('0x5a')]()['value']();return _0x43fccf[_0x5507('0x12')][_0x5507('0x57')](function(_0x10f066){return _0x75aa3c[_0x5507('0x5b')](_0x10f066[_0x5507('0x59')])>-0x1;});}else{return _0x43fccf[_0x5507('0x12')]['filter'](function(_0x1dad83){return _0x1dad83['queue_id']===parseInt(_0xfb59be[_0x5507('0x1a')]['id']);});}})['then'](respondWithResult(_0xda51d5,null))['catch'](handleError(_0xda51d5,null));};exports[_0x5507('0x5c')]=function(_0x20274e,_0x2979b1){return respondWithRpcPromise(_0x5507('0x5d'),_0x20274e[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x2979b1,null))[_0x5507('0x16')](handleError(_0x2979b1,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x410c16,_0x471142){return respondWithRpcPromise(_0x5507('0x5e'),_0x410c16[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x471142,null))[_0x5507('0x16')](handleError(_0x471142,null));};exports[_0x5507('0x5f')]=function(_0x42bef4,_0x5a8a1b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x42bef4[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x5a8a1b,null))[_0x5507('0x16')](handleError(_0x5a8a1b,null));};exports[_0x5507('0x60')]=function(_0x77a772){return function(_0x26f796,_0x3d7e21){var _0x10b62e,_0x18bed6;var _0x27265e=_[_0x5507('0x61')](_0x77a772);var _0x160e54=_0x77a772==='chat'?_0x5507('0x62'):_0x5507('0x63');return db[_0x27265e+_0x5507('0x64')][_0x5507('0x65')]({'raw':!![],'where':{'id':_0x26f796[_0x5507('0x1a')]['id']}})[_0x5507('0x9')](function(_0x33717e){if(_['isNil'](_0x33717e)){throw new Error(_0x27265e+_0x5507('0x66'));}_0x10b62e=_0x33717e;return db[_0x27265e+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x26f796[_0x5507('0x2c')]['messageId']},'include':[{'model':db[_0x27265e+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x27265e+_0x160e54],'as':_0x5507('0x63')}]});})[_0x5507('0x9')](function(_0x1a5d2e){if(_[_0x5507('0x11')](_0x1a5d2e)){throw new Error(_0x27265e+_0x5507('0x69'));}_0x18bed6=_0x1a5d2e;return _0x1a5d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x38144b={'uniqueid':_0x77a772+'.'+_0x18bed6['id']+'.'+_0x18bed6[_0x5507('0x68')]['id'],'FromUserId':_0x26f796[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a')};_0x38144b[_0x27265e+'MessageId']=_0x18bed6['id'];_0x38144b[_0x27265e+_0x5507('0x6b')]=_0x18bed6[_0x5507('0x68')]['id'];_0x38144b[_0x5507('0x6c')+_0x27265e+_0x160e54+'Id']=_0x18bed6[_0x5507('0x63')]['id'];_0x38144b['To'+_0x27265e+_0x5507('0x6d')]=_0x10b62e['id'];return db[_0x27265e+_0x5507('0x6e')][_0x5507('0x6f')](_0x38144b);})[_0x5507('0x9')](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x77a772,'interaction':_0x18bed6[_0x5507('0x68')],'message':_0x18bed6,'account':_0x18bed6[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5507('0x6a'),'appdata':_0x10b62e[_0x5507('0xf')]+','+(_0x18bed6['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x3d7e21,null))[_0x5507('0x16')](handleError(_0x3d7e21,null));};};exports[_0x5507('0x71')]=function(_0x3b04a7,_0x1e913a){var _0x4e1578,_0x2339c7;if(_[_0x5507('0x11')](_0x3b04a7[_0x5507('0x2c')]['channel'])){throw new Error(_0x5507('0x72'));}var _0x5808d9=_0x3b04a7['body'][_0x5507('0x73')];var _0x58b56c=_[_0x5507('0x61')](_0x5808d9);var _0x5c6043=_0x5808d9===_0x5507('0x74')?_0x5507('0x62'):_0x5507('0x63');return db['User']['findOne']({'raw':!![],'where':{'id':_0x3b04a7[_0x5507('0x1a')]['id'],'role':_0x5507('0x38')}})[_0x5507('0x9')](function(_0x51bec0){if(_[_0x5507('0x11')](_0x51bec0)){throw new Error(_0x5507('0x75'));}_0x4e1578=_0x51bec0;return db[_0x58b56c+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x3b04a7['body']['messageId']},'include':[{'model':db[_0x58b56c+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x58b56c+_0x5c6043],'as':'Account'}]});})[_0x5507('0x9')](function(_0x13c0f5){if(_[_0x5507('0x11')](_0x13c0f5)){throw new Error(_0x58b56c+_0x5507('0x69'));}_0x2339c7=_0x13c0f5;return _0x13c0f5['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x3a2b0f={'uniqueid':_0x5808d9+'.'+_0x2339c7['id']+'.'+_0x2339c7['Interaction']['id'],'FromUserId':_0x3b04a7[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a'),'ToUserId':_0x4e1578['id']};_0x3a2b0f[_0x58b56c+_0x5507('0x76')]=_0x2339c7['id'];_0x3a2b0f[_0x58b56c+'InteractionId']=_0x2339c7[_0x5507('0x68')]['id'];_0x3a2b0f[_0x5507('0x6c')+_0x58b56c+_0x5c6043+'Id']=_0x2339c7['Account']['id'];return db[_0x58b56c+_0x5507('0x6e')][_0x5507('0x6f')](_0x3a2b0f);})['then'](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x5808d9,'interaction':_0x2339c7[_0x5507('0x68')],'message':_0x2339c7,'account':_0x2339c7[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4e1578[_0x5507('0xf')]+','+(_0x2339c7[_0x5507('0x63')][_0x5507('0x77')]||0x12c),'interval':_0x5507('0x78')}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x1e913a,null))[_0x5507('0x16')](handleError(_0x1e913a,null));}; \ No newline at end of file +var _0xf2ca=['voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','Message','TransferReport','create','Start','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x31f7c5,_0x3bf428){_0x31f7c5=_0x31f7c5-0x0;var _0x19fabc=_0xf2ca[_0x31f7c5];return _0x19fabc;};'use strict';var BPromise=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var _=require(_0xaf2c('0x2'));var util=require('util');var db=require(_0xaf2c('0x3'))['db'];var logger=require(_0xaf2c('0x4'))(_0xaf2c('0x5'));var jayson=require(_0xaf2c('0x6'));var amiClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xaf2c('0x8')]({'port':0x232b});var routingClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){var _0x2a011d=_0x37fedd?_0x37fedd:amiClient;return _0x2a011d['request'](_0x1f9531,_0x58351f)[_0xaf2c('0x9')](function(_0x4a0064){if(_0x4a0064[_0xaf2c('0xa')]){if(_0x4a0064[_0xaf2c('0xa')][_0xaf2c('0xb')]===0x1f4){return _0x4a7397(_0x4a0064[_0xaf2c('0xa')]['message']);}return _0x3c0421(_0x4a0064['error'][_0xaf2c('0xc')]);}else{_0x3c0421(_0x4a0064[_0xaf2c('0xd')]);}})[_0xaf2c('0xe')](function(_0xd56a5d){_0x4a7397(_0xd56a5d);});});}function respondWithResult(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xc8;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0xf')](_0x59a59b)[_0xaf2c('0x10')](_0x590126);}return _0x285dac[_0xaf2c('0x11')](0x194);};}function handleError(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0x1f4;return function(_0x152c73){logger[_0xaf2c('0xa')](_0x152c73[_0xaf2c('0x12')]);if(_0x152c73[_0xaf2c('0x13')]){delete _0x152c73[_0xaf2c('0x13')];}_0x18a8a5[_0xaf2c('0xf')](_0x293ca6)[_0xaf2c('0x14')](_0x152c73);};}function findById(_0x26bf7b){return function(_0x3432e4){if(!_[_0xaf2c('0x15')](_0x26bf7b)&&!_['isNil'](_0x3432e4)&&!_[_0xaf2c('0x15')](_0x3432e4['rows'])){return _[_0xaf2c('0x16')](_0x3432e4[_0xaf2c('0x17')],function(_0x1d544a){return _0x1d544a['id']==_0x26bf7b;});}return null;};}exports['voiceChannels']=function(_0x28ae7b,_0x297bcd){return respondWithRpcPromise(_0xaf2c('0x18'),_0x28ae7b[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x297bcd,null))[_0xaf2c('0xe')](handleError(_0x297bcd,null));};exports['voiceChannelMixMonitor']=function(_0x35e712,_0x164bcb){return respondWithRpcPromise(_0xaf2c('0x1a'),_[_0xaf2c('0x1b')](_0x35e712[_0xaf2c('0x19')],_0x35e712['params']))[_0xaf2c('0x9')](respondWithResult(_0x164bcb,null))[_0xaf2c('0xe')](handleError(_0x164bcb,null));};exports[_0xaf2c('0x1c')]=function(_0x4be6ed,_0x59b113){return respondWithRpcPromise(_0xaf2c('0x1d'),_[_0xaf2c('0x1b')](_0x4be6ed[_0xaf2c('0x19')],_0x4be6ed[_0xaf2c('0x1e')]))['then'](respondWithResult(_0x59b113,null))[_0xaf2c('0xe')](handleError(_0x59b113,null));};exports[_0xaf2c('0x1f')]=function(_0x3a0145,_0x3c1ae6){return respondWithRpcPromise(_0xaf2c('0x20'),_0x3a0145[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x3c1ae6,null))['catch'](handleError(_0x3c1ae6,null));};exports[_0xaf2c('0x21')]=function(_0x2051be,_0x36f37c){return respondWithRpcPromise(_0xaf2c('0x20'),_0x2051be['query'])[_0xaf2c('0x9')](findById(_0x2051be['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x36f37c,null))[_0xaf2c('0xe')](handleError(_0x36f37c,null));};exports[_0xaf2c('0x22')]=function(_0x5d685a,_0x2747bb){return respondWithRpcPromise(_0xaf2c('0x23'),_[_0xaf2c('0x1b')](_0x5d685a['body'],_0x5d685a[_0xaf2c('0x1e')]))[_0xaf2c('0x9')](respondWithResult(_0x2747bb,null))[_0xaf2c('0xe')](handleError(_0x2747bb,null));};exports[_0xaf2c('0x24')]=function(_0x59d858,_0x3da072){return respondWithRpcPromise(_0xaf2c('0x25'),_[_0xaf2c('0x1b')](_0x59d858['query'],_0x59d858['params']))[_0xaf2c('0x9')](respondWithResult(_0x3da072,null))['catch'](handleError(_0x3da072,null));};exports[_0xaf2c('0x26')]=function(_0x5e7247,_0x337cea){return respondWithRpcPromise(_0xaf2c('0x27'),_0x5e7247['query'])[_0xaf2c('0x9')](respondWithResult(_0x337cea,null))[_0xaf2c('0xe')](handleError(_0x337cea,null));};exports['voiceQueuesChannel']=function(_0x13ced2,_0xbec302){return respondWithRpcPromise(_0xaf2c('0x28'),_[_0xaf2c('0x1b')](_0x13ced2[_0xaf2c('0x19')],_0x13ced2[_0xaf2c('0x1e')]))['then'](respondWithResult(_0xbec302,null))[_0xaf2c('0xe')](handleError(_0xbec302,null));};exports['voiceQueuesChannelHangup']=function(_0x321f7c,_0x514bff){return respondWithRpcPromise(_0xaf2c('0x29'),_['merge'](_0x321f7c[_0xaf2c('0x19')],_0x321f7c['params']))[_0xaf2c('0x9')](respondWithResult(_0x514bff,null))['catch'](handleError(_0x514bff,null));};exports[_0xaf2c('0x2a')]=function(_0x356402,_0x1a6929){return respondWithRpcPromise(_0xaf2c('0x2b'),_[_0xaf2c('0x1b')](_0x356402['query'],_0x356402['params']))[_0xaf2c('0x9')](respondWithResult(_0x1a6929,null))[_0xaf2c('0xe')](handleError(_0x1a6929,null));};exports[_0xaf2c('0x2c')]=function(_0xa44813,_0x4eeecf){return respondWithRpcPromise(_0xaf2c('0x2d'),_0xa44813['query'])[_0xaf2c('0x9')](respondWithResult(_0x4eeecf,null))[_0xaf2c('0xe')](handleError(_0x4eeecf,null));};exports['outboundChannels']=function(_0x36081a,_0x24668d){return respondWithRpcPromise(_0xaf2c('0x2e'),_0x36081a[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x24668d,null))[_0xaf2c('0xe')](handleError(_0x24668d,null));};exports[_0xaf2c('0x2f')]=function(_0x310d3b,_0x296ca8){var _0x106eb9;return respondWithRpcPromise(_0xaf2c('0x30'),_0x310d3b[_0xaf2c('0x19')])[_0xaf2c('0x9')](function(_0x4b524d){_0x106eb9=_0x4b524d;return respondWithRpcPromise('Agents',_0x310d3b['query'],routingClient);})[_0xaf2c('0x9')](function(_0x3cb075){return _[_0xaf2c('0x1b')]({},_0x3cb075,_0x106eb9);})[_0xaf2c('0x9')](respondWithResult(_0x296ca8,null))[_0xaf2c('0xe')](handleError(_0x296ca8,null));};exports[_0xaf2c('0x31')]=function(_0x51c441,_0x1d58bd){if(_0x51c441[_0xaf2c('0x32')]&&_0x51c441[_0xaf2c('0x32')]['interaction']&&_0x51c441['user']&&_0x51c441[_0xaf2c('0x33')]['name']){for(var _0x181787 in _0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')]){if(_0x51c441[_0xaf2c('0x32')]['interaction'][_0xaf2c('0x35')](_0x181787)){db['MemberReport'][_0xaf2c('0x36')]({'where':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')]['name'],'type':_0xaf2c('0x37'),'exitAt':null,'uniqueid':_0x51c441['body'][_0xaf2c('0x34')][_0x181787]&&_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')]?{'$notIn':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787]}:{'$ne':null}}})[_0xaf2c('0x9')](function(_0x16b469){var _0x922b9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18e62b=0x0,_0x4d0977=_0x16b469['length'];_0x18e62b<_0x4d0977;_0x18e62b+=0x1){_0x16b469[_0x18e62b]['updateAttributes']({'exitAt':_0x922b9});}});for(var _0x11a90a=0x0;_0x11a90a<_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')];_0x11a90a+=0x1){db['MemberReport'][_0xaf2c('0x39')]({'where':{'channel':_0x181787,'membername':_0x51c441['user'][_0xaf2c('0x13')],'type':'INTERACTION','uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a],'exitAt':null},'defaults':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x13')],'interface':_[_0xaf2c('0x15')](_0x51c441['user'][_0xaf2c('0x3a')])?util[_0xaf2c('0x3b')]('SIP/%s',_0x51c441['user'][_0xaf2c('0x13')]):_0x51c441['user'][_0xaf2c('0x3a')],'type':_0xaf2c('0x37'),'enterAt':moment()[_0xaf2c('0x3b')](_0xaf2c('0x3c')),'role':_0xaf2c('0x3d'),'internal':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x3e')],'uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a]}});}}}}return respondWithRpcPromise(_0xaf2c('0x3f'),{'id':_0x51c441[_0xaf2c('0x1e')]['id'],'capacity':_0x51c441['body'][_0xaf2c('0x40')]},routingClient)[_0xaf2c('0x9')](respondWithResult(_0x1d58bd,null))['catch'](handleError(_0x1d58bd,null));};exports['telephones']=function(_0x56d7ce,_0x7ddca0){return respondWithRpcPromise(_0xaf2c('0x41'),_0x56d7ce['query'])[_0xaf2c('0x9')](respondWithResult(_0x7ddca0,null))[_0xaf2c('0xe')](handleError(_0x7ddca0,null));};exports[_0xaf2c('0x42')]=function(_0x3085e5,_0x265748){return respondWithRpcPromise(_0xaf2c('0x43'),_0x3085e5[_0xaf2c('0x19')])['then'](respondWithResult(_0x265748,null))[_0xaf2c('0xe')](handleError(_0x265748,null));};exports[_0xaf2c('0x44')]=function(_0x5771e5,_0x245797){return respondWithRpcPromise(_0xaf2c('0x45'),_0x5771e5[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x245797,null))[_0xaf2c('0xe')](handleError(_0x245797,null));};exports[_0xaf2c('0x46')]=function(_0x332340,_0x15a335){return respondWithRpcPromise(_0xaf2c('0x47'),_0x332340[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x15a335,null))[_0xaf2c('0xe')](handleError(_0x15a335,null));};exports[_0xaf2c('0x48')]=function(_0x2356a0,_0x297a22){return respondWithRpcPromise(_0xaf2c('0x47'),_0x2356a0[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x2356a0[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x297a22,null))['catch'](handleError(_0x297a22,null));};exports[_0xaf2c('0x49')]=function(_0x3ac79c,_0xfe5928){return respondWithRpcPromise('MailQueues',_0x3ac79c[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0xfe5928,null))[_0xaf2c('0xe')](handleError(_0xfe5928,null));};exports[_0xaf2c('0x4a')]=function(_0xb3ad9,_0x45918b){return respondWithRpcPromise(_0xaf2c('0x4b'),_0xb3ad9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xb3ad9[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x45918b,null))['catch'](handleError(_0x45918b,null));};exports[_0xaf2c('0x4c')]=function(_0x400dcd,_0x262937){return respondWithRpcPromise(_0xaf2c('0x4d'),_0x400dcd[_0xaf2c('0x19')],mailClient)['then'](respondWithResult(_0x262937,null))[_0xaf2c('0xe')](handleError(_0x262937,null));};exports[_0xaf2c('0x4e')]=function(_0x506000,_0x33aa67){return respondWithRpcPromise(_0xaf2c('0x4f'),_0x506000['query'],routingClient)['then'](respondWithResult(_0x33aa67,null))[_0xaf2c('0xe')](handleError(_0x33aa67,null));};exports[_0xaf2c('0x50')]=function(_0xc83d19,_0x39c5d2){return respondWithRpcPromise('OpenchannelQueues',_0xc83d19[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xc83d19['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x39c5d2,null))['catch'](handleError(_0x39c5d2,null));};exports[_0xaf2c('0x51')]=function(_0xe6a251,_0x16e9f4){return respondWithRpcPromise(_0xaf2c('0x52'),_0xe6a251[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x16e9f4,null))[_0xaf2c('0xe')](handleError(_0x16e9f4,null));};exports[_0xaf2c('0x53')]=function(_0x1520ec,_0xc27601){return respondWithRpcPromise('SmsQueues',_0x1520ec[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1520ec[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0xc27601,null))[_0xaf2c('0xe')](handleError(_0xc27601,null));};exports['whatsappQueues']=function(_0xbfb776,_0x28b09f){return respondWithRpcPromise(_0xaf2c('0x54'),_0xbfb776[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x28b09f,null))['catch'](handleError(_0x28b09f,null));};exports['showWhatsappQueues']=function(_0x1166c9,_0x1ead61){return respondWithRpcPromise('WhatsappQueues',_0x1166c9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1166c9[_0xaf2c('0x1e')]['id']))['then'](respondWithResult(_0x1ead61,null))[_0xaf2c('0xe')](handleError(_0x1ead61,null));};exports[_0xaf2c('0x55')]=function(_0x18dcde,_0x2aae3a){return respondWithRpcPromise('FaxQueues',_0x18dcde[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x2aae3a,null))[_0xaf2c('0xe')](handleError(_0x2aae3a,null));};exports[_0xaf2c('0x56')]=function(_0x20c120,_0x1ecf97){return respondWithRpcPromise(_0xaf2c('0x57'),_0x20c120[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x20c120[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x1ecf97,null))['catch'](handleError(_0x1ecf97,null));};exports[_0xaf2c('0x58')]=function(_0x5d965c,_0x1a0795){return respondWithRpcPromise(_0xaf2c('0x59'),_0x5d965c['query'])[_0xaf2c('0x9')](respondWithResult(_0x1a0795,null))['catch'](handleError(_0x1a0795,null));};exports['chatQueuesWaitingInteractions']=function(_0x316333,_0x1d73ef){return respondWithRpcPromise(_0xaf2c('0x5a'),_0x316333['query'],routingClient)['then'](respondWithResult(_0x1d73ef,null))['catch'](handleError(_0x1d73ef,null));};exports[_0xaf2c('0x5b')]=function(_0x3e972c,_0x517f8d){return respondWithRpcPromise(_0xaf2c('0x5c'),_0x3e972c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x517f8d,null))[_0xaf2c('0xe')](handleError(_0x517f8d,null));};exports[_0xaf2c('0x5d')]=function(_0x44303c,_0x4be47b){return respondWithRpcPromise(_0xaf2c('0x5e'),_0x44303c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x4be47b,null))['catch'](handleError(_0x4be47b,null));};exports[_0xaf2c('0x5f')]=function(_0x3c53ff,_0x37ee02){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3c53ff[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](function(_0x433f9e){if(_0x3c53ff[_0xaf2c('0x19')]['type']!==undefined){var _0x286a40=_(_0x433f9e[_0xaf2c('0x17')])[_0xaf2c('0x60')]([_0x3c53ff['query']['type'],_0x3c53ff[_0xaf2c('0x1e')]['id']])[_0xaf2c('0x61')]('queue_id')[_0xaf2c('0x62')]()[_0xaf2c('0x63')]();return _0x433f9e['rows'][_0xaf2c('0x60')](function(_0x31cf3e){return _0x286a40[_0xaf2c('0x64')](_0x31cf3e[_0xaf2c('0x65')])>-0x1;});}else{return _0x433f9e[_0xaf2c('0x17')]['filter'](function(_0x5831c9){return _0x5831c9[_0xaf2c('0x65')]===parseInt(_0x3c53ff[_0xaf2c('0x1e')]['id']);});}})[_0xaf2c('0x9')](respondWithResult(_0x37ee02,null))['catch'](handleError(_0x37ee02,null));};exports[_0xaf2c('0x66')]=function(_0x467a36,_0x3d8471){return respondWithRpcPromise(_0xaf2c('0x67'),_0x467a36[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x3d8471,null))[_0xaf2c('0xe')](handleError(_0x3d8471,null));};exports[_0xaf2c('0x68')]=function(_0x154f69,_0x1ef61f){return respondWithRpcPromise(_0xaf2c('0x69'),_0x154f69[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x1ef61f,null))[_0xaf2c('0xe')](handleError(_0x1ef61f,null));};exports[_0xaf2c('0x6a')]=function(_0x483774,_0x5beb89){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x483774[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x5beb89,null))[_0xaf2c('0xe')](handleError(_0x5beb89,null));};exports[_0xaf2c('0x6b')]=function(_0x499bbe){return function(_0x19fbd5,_0x2d7ca5){var _0x2b57d2,_0x430567;var _0x4ddf95=_[_0xaf2c('0x6c')](_0x499bbe);var _0x23aeac=_0x499bbe===_0xaf2c('0x6d')?_0xaf2c('0x6e'):_0xaf2c('0x6f');return db[_0x4ddf95+'Queue'][_0xaf2c('0x70')]({'raw':!![],'where':{'id':_0x19fbd5[_0xaf2c('0x1e')]['id']}})['then'](function(_0x516193){if(_[_0xaf2c('0x15')](_0x516193)){throw new Error(_0x4ddf95+_0xaf2c('0x71'));}_0x2b57d2=_0x516193;return db[_0x4ddf95+'Message'][_0xaf2c('0x70')]({'where':{'id':_0x19fbd5[_0xaf2c('0x32')][_0xaf2c('0x72')]},'include':[{'model':db[_0x4ddf95+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x4ddf95+_0x23aeac],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0x43c174){if(_['isNil'](_0x43c174)){throw new Error(_0x4ddf95+_0xaf2c('0x74'));}_0x430567=_0x43c174;return _0x43c174['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xaf2c('0x9')](function(){var _0x7724cc={'uniqueid':_0x499bbe+'.'+_0x430567['id']+'.'+_0x430567['Interaction']['id'],'FromUserId':_0x19fbd5['user']['id'],'type':_0xaf2c('0x75')};_0x7724cc[_0x4ddf95+_0xaf2c('0x76')]=_0x430567['id'];_0x7724cc[_0x4ddf95+_0xaf2c('0x77')]=_0x430567['Interaction']['id'];_0x7724cc[_0xaf2c('0x78')+_0x4ddf95+_0x23aeac+'Id']=_0x430567[_0xaf2c('0x6f')]['id'];_0x7724cc['To'+_0x4ddf95+_0xaf2c('0x79')]=_0x2b57d2['id'];return db[_0x4ddf95+'TransferReport']['create'](_0x7724cc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x499bbe,'interaction':_0x430567[_0xaf2c('0x73')],'message':_0x430567,'account':_0x430567[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x75'),'appdata':_0x2b57d2[_0xaf2c('0x13')]+','+(_0x430567[_0xaf2c('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})[_0xaf2c('0x9')](respondWithResult(_0x2d7ca5,null))['catch'](handleError(_0x2d7ca5,null));};};exports[_0xaf2c('0x7b')]=function(_0x4a3a61,_0x31f1d3){var _0x25d49c,_0x1e403a;if(_[_0xaf2c('0x15')](_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x47b971=_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')];var _0x1bc548=_[_0xaf2c('0x6c')](_0x47b971);var _0x118e78=_0x47b971===_0xaf2c('0x6d')?'Website':'Account';return db[_0xaf2c('0x7d')]['findOne']({'raw':!![],'where':{'id':_0x4a3a61[_0xaf2c('0x1e')]['id'],'role':'agent'}})[_0xaf2c('0x9')](function(_0x639b4b){if(_['isNil'](_0x639b4b)){throw new Error(_0xaf2c('0x7e'));}_0x25d49c=_0x639b4b;return db[_0x1bc548+_0xaf2c('0x7f')][_0xaf2c('0x70')]({'where':{'id':_0x4a3a61['body'][_0xaf2c('0x72')]},'include':[{'model':db[_0x1bc548+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x1bc548+_0x118e78],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0xb311e1){if(_['isNil'](_0xb311e1)){throw new Error(_0x1bc548+'\x20Message\x20not\x20found');}_0x1e403a=_0xb311e1;return _0xb311e1['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2db412={'uniqueid':_0x47b971+'.'+_0x1e403a['id']+'.'+_0x1e403a['Interaction']['id'],'FromUserId':_0x4a3a61[_0xaf2c('0x33')]['id'],'type':'queue','ToUserId':_0x25d49c['id']};_0x2db412[_0x1bc548+'MessageId']=_0x1e403a['id'];_0x2db412[_0x1bc548+_0xaf2c('0x77')]=_0x1e403a[_0xaf2c('0x73')]['id'];_0x2db412['From'+_0x1bc548+_0x118e78+'Id']=_0x1e403a[_0xaf2c('0x6f')]['id'];return db[_0x1bc548+_0xaf2c('0x80')][_0xaf2c('0x81')](_0x2db412);})[_0xaf2c('0x9')](function(){return respondWithRpcPromise(_0xaf2c('0x82'),{'channel':_0x47b971,'interaction':_0x1e403a[_0xaf2c('0x73')],'message':_0x1e403a,'account':_0x1e403a[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x3d'),'appdata':_0x25d49c[_0xaf2c('0x13')]+','+(_0x1e403a[_0xaf2c('0x6f')]['agentTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})['then'](respondWithResult(_0x31f1d3,null))[_0xaf2c('0xe')](handleError(_0x31f1d3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 151b8f5..f536b50 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 _0x9766=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post','put'];(function(_0x238c49,_0xddc0e0){var _0x3e8297=function(_0x441167){while(--_0x441167){_0x238c49['push'](_0x238c49['shift']());}};_0x3e8297(++_0xddc0e0);}(_0x9766,0x16b));var _0x6976=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x9766[_0x2e3545];return _0xcf18f;};'use strict';var multer=require(_0x6976('0x0'));var util=require(_0x6976('0x1'));var path=require(_0x6976('0x2'));var timeout=require('connect-timeout');var express=require(_0x6976('0x3'));var router=express[_0x6976('0x4')]();var fs_extra=require(_0x6976('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6976('0x6'));var config=require(_0x6976('0x7'));var controller=require(_0x6976('0x8'));router['get']('/',auth[_0x6976('0x9')](),controller[_0x6976('0xa')]);router[_0x6976('0xb')](_0x6976('0xc'),auth[_0x6976('0x9')](),controller['show']);router[_0x6976('0xb')](_0x6976('0xd'),auth[_0x6976('0x9')](),controller[_0x6976('0xe')]);router[_0x6976('0xf')]('/',auth[_0x6976('0x9')](),controller['create']);router[_0x6976('0x10')](_0x6976('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6976('0x11')](_0x6976('0xc'),auth[_0x6976('0x9')](),controller[_0x6976('0x12')]);module[_0x6976('0x13')]=router; \ No newline at end of file +var _0x5354=['put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0x5354,0x1e5));var _0x4535=function(_0xce7269,_0x54321a){_0xce7269=_0xce7269-0x0;var _0x16581e=_0x5354[_0xce7269];return _0x16581e;};'use strict';var multer=require('multer');var util=require(_0x4535('0x0'));var path=require(_0x4535('0x1'));var timeout=require(_0x4535('0x2'));var express=require(_0x4535('0x3'));var router=express['Router']();var fs_extra=require(_0x4535('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4535('0x5'));var config=require(_0x4535('0x6'));var controller=require(_0x4535('0x7'));router[_0x4535('0x8')]('/',auth[_0x4535('0x9')](),controller[_0x4535('0xa')]);router['get'](_0x4535('0xb'),auth['isAuthenticated'](),controller[_0x4535('0xc')]);router[_0x4535('0x8')]('/:id/run',auth[_0x4535('0x9')](),controller['run']);router[_0x4535('0xd')]('/',auth[_0x4535('0x9')](),controller[_0x4535('0xe')]);router[_0x4535('0xf')](_0x4535('0xb'),auth[_0x4535('0x9')](),controller[_0x4535('0x10')]);router[_0x4535('0x11')]('/:id',auth[_0x4535('0x9')](),controller[_0x4535('0x12')]);module[_0x4535('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 9d13fcc..19aa487 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 _0x5066=['months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x20fa95,_0x35eae2){var _0x85e264=function(_0x586654){while(--_0x586654){_0x20fa95['push'](_0x20fa95['shift']());}};_0x85e264(++_0x35eae2);}(_0x5066,0x64));var _0x6506=function(_0x388da2,_0x571cad){_0x388da2=_0x388da2-0x0;var _0x2b1a45=_0x5066[_0x388da2];return _0x2b1a45;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6506('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6506('0x0')]},'active':{'type':Sequelize[_0x6506('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6506('0x0')],'allowNull':![],'defaultValue':_0x6506('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x6506('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6506('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6506('0x5')](_0x6506('0x6'),_0x6506('0x7'),_0x6506('0x8'),_0x6506('0x9'),_0x6506('0xa'),_0x6506('0xb'),_0x6506('0xc')),'allowNull':![],'defaultValue':_0x6506('0xa')},'output':{'type':Sequelize['ENUM'](_0x6506('0xd'),_0x6506('0xe'),_0x6506('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x6506('0x10'),'default'),'allowNull':![],'defaultValue':_0x6506('0x10')},'sendMail':{'type':Sequelize[_0x6506('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x6506('0x0')]},'cc':{'type':Sequelize[_0x6506('0x11')]},'bcc':{'type':Sequelize[_0x6506('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x6506('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0aa3=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','minutes','csv','xlsx','custom','TEXT','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0aa3,0x1eb));var _0x30aa=function(_0x5270f4,_0x1236ef){_0x5270f4=_0x5270f4-0x0;var _0x8319aa=_0x0aa3[_0x5270f4];return _0x8319aa;};'use strict';var Sequelize=require(_0x30aa('0x0'));module[_0x30aa('0x1')]={'name':{'type':Sequelize[_0x30aa('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x30aa('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x30aa('0x2')],'allowNull':![],'defaultValue':_0x30aa('0x4')},'startAt':{'type':Sequelize[_0x30aa('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x30aa('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x30aa('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x30aa('0x7')](_0x30aa('0x8'),_0x30aa('0x9'),_0x30aa('0xa'),'weeks',_0x30aa('0xb'),'hours',_0x30aa('0xc')),'allowNull':![],'defaultValue':_0x30aa('0xb')},'output':{'type':Sequelize['ENUM'](_0x30aa('0xd'),'pdf',_0x30aa('0xe')),'allowNull':![],'defaultValue':_0x30aa('0xd')},'type':{'type':Sequelize[_0x30aa('0x7')]('custom','default'),'allowNull':![],'defaultValue':_0x30aa('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x30aa('0x10')]},'bcc':{'type':Sequelize[_0x30aa('0x10')]},'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 587dfe3..a6ef620 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 _0x1ce7=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','type','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','catch','show','keys','rawAttributes','attributes','merge','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','params','eml-format','rimraf','zip-dir','moment','mustache','util','sox'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1ce7,0x189));var _0x71ce=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x1ce7[_0x33dcf7];return _0x542d4e;};'use strict';var emlformat=require(_0x71ce('0x0'));var rimraf=require(_0x71ce('0x1'));var zipdir=require(_0x71ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71ce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71ce('0x4'));var util=require(_0x71ce('0x5'));var path=require('path');var sox=require(_0x71ce('0x6'));var csv=require(_0x71ce('0x7'));var ejs=require(_0x71ce('0x8'));var fs=require('fs');var fs_extra=require(_0x71ce('0x9'));var _=require('lodash');var squel=require(_0x71ce('0xa'));var crypto=require(_0x71ce('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x71ce('0xc'));var toCsv=require('to-csv');var querystring=require(_0x71ce('0xd'));var Papa=require(_0x71ce('0xe'));var Redis=require(_0x71ce('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71ce('0x10'));var as=require(_0x71ce('0x11'));var hardwareService=require(_0x71ce('0x12'));var logger=require('../../config/logger')(_0x71ce('0x13'));var utils=require(_0x71ce('0x14'));var config=require(_0x71ce('0x15'));var licenseUtil=require(_0x71ce('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22aadf,_0x45a21a){_0x45a21a=_0x45a21a||0xcc;return function(_0x1b3f7c){if(_0x1b3f7c){return _0x22aadf['sendStatus'](_0x45a21a);}return _0x22aadf[_0x71ce('0x17')](_0x45a21a)['end']();};}function respondWithResult(_0x31e014,_0x14f56f){_0x14f56f=_0x14f56f||0xc8;return function(_0x4dc713){if(_0x4dc713){return _0x31e014[_0x71ce('0x17')](_0x14f56f)[_0x71ce('0x18')](_0x4dc713);}};}function respondWithFilteredResult(_0x6f52aa,_0xd58e0f){return function(_0xe6c73c){if(_0xe6c73c){var _0x404aba=typeof _0xd58e0f[_0x71ce('0x19')]===_0x71ce('0x1a')&&typeof _0xd58e0f[_0x71ce('0x1b')]===_0x71ce('0x1a');var _0x3fb664=_0xe6c73c[_0x71ce('0x1c')];var _0x535d61=_0x404aba?0x0:_0xd58e0f[_0x71ce('0x19')];var _0x139849=_0x404aba?_0xe6c73c['count']:_0xd58e0f['offset']+_0xd58e0f[_0x71ce('0x1b')];var _0x419499;if(_0x139849>=_0x3fb664){_0x139849=_0x3fb664;_0x419499=0xc8;}else{_0x419499=0xce;}_0x6f52aa[_0x71ce('0x17')](_0x419499);return _0x6f52aa['set'](_0x71ce('0x1d'),_0x535d61+'-'+_0x139849+'/'+_0x3fb664)['json'](_0xe6c73c);}return null;};}function patchUpdates(_0x56a727){return function(_0x3a8f33){try{jsonpatch['apply'](_0x3a8f33,_0x56a727,!![]);}catch(_0xbb1300){return BPromise[_0x71ce('0x1e')](_0xbb1300);}return _0x3a8f33[_0x71ce('0x1f')]();};}function saveUpdates(_0x566d0e,_0x2a3d10){return function(_0x272ff7){if(_0x272ff7){return _0x272ff7[_0x71ce('0x20')](_0x566d0e)['then'](function(_0xb2442b){return _0xb2442b;});}return null;};}function removeEntity(_0x2d52bf,_0x5db77a){return function(_0x1fc280){if(_0x1fc280){return _0x1fc280[_0x71ce('0x21')]()[_0x71ce('0x22')](function(){var _0x4fb752=_0x1fc280['get']({'plain':!![]});var _0x3570de=_0x71ce('0x23');return db[_0x71ce('0x24')][_0x71ce('0x21')]({'where':{'type':_0x3570de,'resourceId':_0x4fb752['id']}})[_0x71ce('0x22')](function(){return _0x1fc280;});})[_0x71ce('0x22')](function(){_0x2d52bf[_0x71ce('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3198f1,_0x224893){return function(_0x5d7b11){if(!_0x5d7b11){_0x3198f1[_0x71ce('0x25')](0x194);}return _0x5d7b11;};}function handleError(_0x4b5904,_0x5c3a9d){_0x5c3a9d=_0x5c3a9d||0x1f4;return function(_0x22262b){logger[_0x71ce('0x26')](_0x22262b[_0x71ce('0x27')]);if(_0x22262b['name']){delete _0x22262b[_0x71ce('0x28')];}_0x4b5904[_0x71ce('0x17')](_0x5c3a9d)[_0x71ce('0x29')](_0x22262b);};}exports[_0x71ce('0x2a')]=function(_0x5df5d4,_0xd6f363){var _0x43603d={},_0x3ee152={},_0x5713ed={'count':0x0,'rows':[]};var _0x1a32a5=_[_0x71ce('0x2b')](db[_0x71ce('0x2c')]['rawAttributes'],function(_0x52b553){return{'name':_0x52b553['fieldName'],'type':_0x52b553[_0x71ce('0x2d')][_0x71ce('0x2e')]};});_0x3ee152[_0x71ce('0x2f')]=_[_0x71ce('0x2b')](_0x1a32a5,_0x71ce('0x28'));_0x3ee152[_0x71ce('0x30')]=_['keys'](_0x5df5d4[_0x71ce('0x30')]);_0x3ee152[_0x71ce('0x31')]=_[_0x71ce('0x32')](_0x3ee152[_0x71ce('0x2f')],_0x3ee152[_0x71ce('0x30')]);_0x43603d['attributes']=_[_0x71ce('0x32')](_0x3ee152[_0x71ce('0x2f')],qs[_0x71ce('0x33')](_0x5df5d4['query']['fields']));_0x43603d['attributes']=_0x43603d['attributes'][_0x71ce('0x34')]?_0x43603d['attributes']:_0x3ee152[_0x71ce('0x2f')];if(!_0x5df5d4[_0x71ce('0x30')][_0x71ce('0x35')](_0x71ce('0x36'))){_0x43603d['limit']=qs['limit'](_0x5df5d4[_0x71ce('0x30')][_0x71ce('0x1b')]);_0x43603d[_0x71ce('0x19')]=qs[_0x71ce('0x19')](_0x5df5d4[_0x71ce('0x30')][_0x71ce('0x19')]);}_0x43603d[_0x71ce('0x37')]=qs[_0x71ce('0x38')](_0x5df5d4['query'][_0x71ce('0x38')]);_0x43603d[_0x71ce('0x39')]=qs[_0x71ce('0x31')](_[_0x71ce('0x3a')](_0x5df5d4[_0x71ce('0x30')],_0x3ee152['filters']),_0x1a32a5);if(_0x5df5d4[_0x71ce('0x30')][_0x71ce('0x3b')]){_0x43603d[_0x71ce('0x39')]=_['merge'](_0x43603d[_0x71ce('0x39')],{'$or':_[_0x71ce('0x2b')](_0x1a32a5,function(_0x1b3e26){if(_0x1b3e26[_0x71ce('0x2d')]!=='VIRTUAL'){var _0x53ce71={};_0x53ce71[_0x1b3e26[_0x71ce('0x28')]]={'$like':'%'+_0x5df5d4[_0x71ce('0x30')][_0x71ce('0x3b')]+'%'};return _0x53ce71;}})});}_0x43603d=_['merge']({},_0x43603d,_0x5df5d4[_0x71ce('0x3c')]);var _0x529e17={'where':_0x43603d[_0x71ce('0x39')]};return db[_0x71ce('0x2c')][_0x71ce('0x1c')](_0x529e17)[_0x71ce('0x22')](function(_0x3a7b95){_0x5713ed[_0x71ce('0x1c')]=_0x3a7b95;if(_0x5df5d4[_0x71ce('0x30')]['includeAll']){_0x43603d[_0x71ce('0x3d')]=[{'all':!![]}];}return db[_0x71ce('0x2c')][_0x71ce('0x3e')](_0x43603d);})[_0x71ce('0x22')](function(_0x52c629){_0x5713ed['rows']=_0x52c629;return _0x5713ed;})[_0x71ce('0x22')](respondWithFilteredResult(_0xd6f363,_0x43603d))[_0x71ce('0x3f')](handleError(_0xd6f363,null));};exports[_0x71ce('0x40')]=function(_0x3c5b02,_0x528dec){var _0xdac81a={'raw':![],'where':{'id':_0x3c5b02['params']['id']}},_0xf73e69={};_0xf73e69[_0x71ce('0x2f')]=_[_0x71ce('0x41')](db[_0x71ce('0x2c')][_0x71ce('0x42')]);_0xf73e69['query']=_[_0x71ce('0x41')](_0x3c5b02[_0x71ce('0x30')]);_0xf73e69['filters']=_[_0x71ce('0x32')](_0xf73e69[_0x71ce('0x2f')],_0xf73e69[_0x71ce('0x30')]);_0xdac81a[_0x71ce('0x43')]=_['intersection'](_0xf73e69[_0x71ce('0x2f')],qs[_0x71ce('0x33')](_0x3c5b02[_0x71ce('0x30')][_0x71ce('0x33')]));_0xdac81a[_0x71ce('0x43')]=_0xdac81a[_0x71ce('0x43')][_0x71ce('0x34')]?_0xdac81a[_0x71ce('0x43')]:_0xf73e69[_0x71ce('0x2f')];if(_0x3c5b02[_0x71ce('0x30')]['includeAll']){_0xdac81a[_0x71ce('0x3d')]=[{'all':!![]}];}_0xdac81a=_[_0x71ce('0x44')]({},_0xdac81a,_0x3c5b02[_0x71ce('0x3c')]);return db['Schedule'][_0x71ce('0x45')](_0xdac81a)[_0x71ce('0x22')](handleEntityNotFound(_0x528dec,null))['then'](respondWithResult(_0x528dec,null))[_0x71ce('0x3f')](handleError(_0x528dec,null));};exports['create']=function(_0x55ce12,_0xd94de7){return db[_0x71ce('0x2c')]['create'](_0x55ce12[_0x71ce('0x46')],{})[_0x71ce('0x22')](function(_0x5cc034){var _0x1e7d5a=_0x55ce12[_0x71ce('0x47')][_0x71ce('0x48')]({'plain':!![]});if(!_0x1e7d5a)throw new Error(_0x71ce('0x49'));if(_0x1e7d5a[_0x71ce('0x4a')]===_0x71ce('0x47')){var _0x207362=_0x5cc034[_0x71ce('0x48')]({'plain':!![]});var _0x2a38fa=_0x71ce('0x23');return db[_0x71ce('0x4b')][_0x71ce('0x45')]({'where':{'name':_0x2a38fa,'userProfileId':_0x1e7d5a[_0x71ce('0x4c')]},'raw':!![]})[_0x71ce('0x22')](function(_0x3aad54){if(_0x3aad54&&_0x3aad54[_0x71ce('0x4d')]===0x0){return db[_0x71ce('0x24')]['create']({'name':_0x207362[_0x71ce('0x28')],'resourceId':_0x207362['id'],'type':_0x3aad54[_0x71ce('0x28')],'sectionId':_0x3aad54['id']},{})[_0x71ce('0x22')](function(){return _0x5cc034;});}else{return _0x5cc034;}})[_0x71ce('0x3f')](function(_0x3220fb){logger[_0x71ce('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3220fb);throw _0x3220fb;});}return _0x5cc034;})['then'](respondWithResult(_0xd94de7,0xc9))['catch'](handleError(_0xd94de7,null));};exports[_0x71ce('0x20')]=function(_0x3eeb5a,_0x15fbcb){if(_0x3eeb5a[_0x71ce('0x46')]['id']){delete _0x3eeb5a['body']['id'];}return db[_0x71ce('0x2c')][_0x71ce('0x45')]({'where':{'id':_0x3eeb5a['params']['id']}})[_0x71ce('0x22')](handleEntityNotFound(_0x15fbcb,null))['then'](saveUpdates(_0x3eeb5a[_0x71ce('0x46')],null))[_0x71ce('0x22')](respondWithResult(_0x15fbcb,null))[_0x71ce('0x3f')](handleError(_0x15fbcb,null));};exports['destroy']=function(_0x261c20,_0x184dce){return db[_0x71ce('0x2c')][_0x71ce('0x45')]({'where':{'id':_0x261c20['params']['id']}})[_0x71ce('0x22')](handleEntityNotFound(_0x184dce,null))[_0x71ce('0x22')](removeEntity(_0x184dce,null))[_0x71ce('0x3f')](handleError(_0x184dce,null));};exports['run']=function(_0x505952,_0x307ceb,_0xc62e50){var _0x279de1=require(_0x71ce('0x4e'));return db[_0x71ce('0x2c')][_0x71ce('0x45')]({'where':{'id':_0x505952['params']['id']},'raw':!![]})[_0x71ce('0x22')](handleEntityNotFound(_0x307ceb,null))[_0x71ce('0x22')](function(){_0x279de1['run'](_0x505952[_0x71ce('0x4f')]['id']);})[_0x71ce('0x22')](respondWithStatusCode(_0x307ceb,null))[_0x71ce('0x3f')](handleError(_0x307ceb,null));}; \ No newline at end of file +var _0x6db8=['set','Content-Range','json','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','status','end','error','stack','send','Schedule','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','name','filter','includeAll','catch','params','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','undefined','limit','count'];(function(_0x11858c,_0x18c2ec){var _0x556bd6=function(_0x480820){while(--_0x480820){_0x11858c['push'](_0x11858c['shift']());}};_0x556bd6(++_0x18c2ec);}(_0x6db8,0x87));var _0x86db=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x6db8[_0x2d8d69];return _0x39ae22;};'use strict';var emlformat=require(_0x86db('0x0'));var rimraf=require(_0x86db('0x1'));var zipdir=require(_0x86db('0x2'));var jsonpatch=require(_0x86db('0x3'));var rp=require(_0x86db('0x4'));var moment=require(_0x86db('0x5'));var BPromise=require(_0x86db('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86db('0x7'));var sox=require(_0x86db('0x8'));var csv=require(_0x86db('0x9'));var ejs=require(_0x86db('0xa'));var fs=require('fs');var fs_extra=require(_0x86db('0xb'));var _=require(_0x86db('0xc'));var squel=require(_0x86db('0xd'));var crypto=require(_0x86db('0xe'));var jsforce=require(_0x86db('0xf'));var deskjs=require(_0x86db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x86db('0x11'));var Papa=require(_0x86db('0x12'));var Redis=require(_0x86db('0x13'));var authService=require(_0x86db('0x14'));var qs=require(_0x86db('0x15'));var as=require(_0x86db('0x16'));var hardwareService=require(_0x86db('0x17'));var logger=require(_0x86db('0x18'))('api');var utils=require(_0x86db('0x19'));var config=require(_0x86db('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x86db('0x1b'))['db'];function respondWithStatusCode(_0x5a6005,_0x3da8a1){_0x3da8a1=_0x3da8a1||0xcc;return function(_0x14800e){if(_0x14800e){return _0x5a6005[_0x86db('0x1c')](_0x3da8a1);}return _0x5a6005['status'](_0x3da8a1)['end']();};}function respondWithResult(_0x3c770f,_0x59c38a){_0x59c38a=_0x59c38a||0xc8;return function(_0x4d4f5b){if(_0x4d4f5b){return _0x3c770f['status'](_0x59c38a)['json'](_0x4d4f5b);}};}function respondWithFilteredResult(_0x52f00b,_0x1c35a8){return function(_0x56ec11){if(_0x56ec11){var _0x5df8bb=typeof _0x1c35a8[_0x86db('0x1d')]===_0x86db('0x1e')&&typeof _0x1c35a8[_0x86db('0x1f')]===_0x86db('0x1e');var _0x5c4de7=_0x56ec11[_0x86db('0x20')];var _0x1b873b=_0x5df8bb?0x0:_0x1c35a8[_0x86db('0x1d')];var _0x3c5bca=_0x5df8bb?_0x56ec11['count']:_0x1c35a8['offset']+_0x1c35a8['limit'];var _0x21c19d;if(_0x3c5bca>=_0x5c4de7){_0x3c5bca=_0x5c4de7;_0x21c19d=0xc8;}else{_0x21c19d=0xce;}_0x52f00b['status'](_0x21c19d);return _0x52f00b[_0x86db('0x21')](_0x86db('0x22'),_0x1b873b+'-'+_0x3c5bca+'/'+_0x5c4de7)[_0x86db('0x23')](_0x56ec11);}return null;};}function patchUpdates(_0x1df943){return function(_0x3bb5d5){try{jsonpatch[_0x86db('0x24')](_0x3bb5d5,_0x1df943,!![]);}catch(_0x2d3664){return BPromise[_0x86db('0x25')](_0x2d3664);}return _0x3bb5d5[_0x86db('0x26')]();};}function saveUpdates(_0x4710dd,_0x6a203b){return function(_0x3c4a01){if(_0x3c4a01){return _0x3c4a01['update'](_0x4710dd)['then'](function(_0x27ea80){return _0x27ea80;});}return null;};}function removeEntity(_0x4505c6,_0x3bf1aa){return function(_0x3bdef9){if(_0x3bdef9){return _0x3bdef9['destroy']()[_0x86db('0x27')](function(){var _0x9a04a5=_0x3bdef9[_0x86db('0x28')]({'plain':!![]});var _0x43fb08=_0x86db('0x29');return db[_0x86db('0x2a')][_0x86db('0x2b')]({'where':{'type':_0x43fb08,'resourceId':_0x9a04a5['id']}})[_0x86db('0x27')](function(){return _0x3bdef9;});})[_0x86db('0x27')](function(){_0x4505c6[_0x86db('0x2c')](0xcc)[_0x86db('0x2d')]();});}};}function handleEntityNotFound(_0x2a528b,_0x12e244){return function(_0x2c44b4){if(!_0x2c44b4){_0x2a528b['sendStatus'](0x194);}return _0x2c44b4;};}function handleError(_0x272114,_0x23d32d){_0x23d32d=_0x23d32d||0x1f4;return function(_0x30db6a){logger[_0x86db('0x2e')](_0x30db6a[_0x86db('0x2f')]);if(_0x30db6a['name']){delete _0x30db6a['name'];}_0x272114['status'](_0x23d32d)[_0x86db('0x30')](_0x30db6a);};}exports['index']=function(_0x433b3b,_0x4b1680){var _0x74eb17={},_0x30c6a7={},_0x2e7013={'count':0x0,'rows':[]};var _0xae3c84=_['map'](db[_0x86db('0x31')]['rawAttributes'],function(_0x1586d5){return{'name':_0x1586d5[_0x86db('0x32')],'type':_0x1586d5[_0x86db('0x33')][_0x86db('0x34')]};});_0x30c6a7[_0x86db('0x35')]=_[_0x86db('0x36')](_0xae3c84,'name');_0x30c6a7['query']=_[_0x86db('0x37')](_0x433b3b[_0x86db('0x38')]);_0x30c6a7['filters']=_[_0x86db('0x39')](_0x30c6a7[_0x86db('0x35')],_0x30c6a7[_0x86db('0x38')]);_0x74eb17[_0x86db('0x3a')]=_[_0x86db('0x39')](_0x30c6a7[_0x86db('0x35')],qs[_0x86db('0x3b')](_0x433b3b[_0x86db('0x38')]['fields']));_0x74eb17[_0x86db('0x3a')]=_0x74eb17[_0x86db('0x3a')][_0x86db('0x3c')]?_0x74eb17[_0x86db('0x3a')]:_0x30c6a7[_0x86db('0x35')];if(!_0x433b3b[_0x86db('0x38')][_0x86db('0x3d')](_0x86db('0x3e'))){_0x74eb17[_0x86db('0x1f')]=qs[_0x86db('0x1f')](_0x433b3b['query'][_0x86db('0x1f')]);_0x74eb17[_0x86db('0x1d')]=qs['offset'](_0x433b3b[_0x86db('0x38')]['offset']);}_0x74eb17['order']=qs[_0x86db('0x3f')](_0x433b3b[_0x86db('0x38')][_0x86db('0x3f')]);_0x74eb17[_0x86db('0x40')]=qs['filters'](_[_0x86db('0x41')](_0x433b3b[_0x86db('0x38')],_0x30c6a7[_0x86db('0x42')]),_0xae3c84);if(_0x433b3b['query']['filter']){_0x74eb17[_0x86db('0x40')]=_[_0x86db('0x43')](_0x74eb17[_0x86db('0x40')],{'$or':_[_0x86db('0x36')](_0xae3c84,function(_0x43dcc8){if(_0x43dcc8[_0x86db('0x33')]!=='VIRTUAL'){var _0x58c6dd={};_0x58c6dd[_0x43dcc8[_0x86db('0x44')]]={'$like':'%'+_0x433b3b['query'][_0x86db('0x45')]+'%'};return _0x58c6dd;}})});}_0x74eb17=_[_0x86db('0x43')]({},_0x74eb17,_0x433b3b['options']);var _0x2776d9={'where':_0x74eb17['where']};return db[_0x86db('0x31')][_0x86db('0x20')](_0x2776d9)[_0x86db('0x27')](function(_0x54fffc){_0x2e7013[_0x86db('0x20')]=_0x54fffc;if(_0x433b3b[_0x86db('0x38')][_0x86db('0x46')]){_0x74eb17['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x74eb17);})[_0x86db('0x27')](function(_0x56f7f7){_0x2e7013['rows']=_0x56f7f7;return _0x2e7013;})['then'](respondWithFilteredResult(_0x4b1680,_0x74eb17))[_0x86db('0x47')](handleError(_0x4b1680,null));};exports['show']=function(_0x24caf7,_0xf0673a){var _0x4e4447={'raw':![],'where':{'id':_0x24caf7[_0x86db('0x48')]['id']}},_0x1561e2={};_0x1561e2[_0x86db('0x35')]=_[_0x86db('0x37')](db[_0x86db('0x31')]['rawAttributes']);_0x1561e2['query']=_[_0x86db('0x37')](_0x24caf7[_0x86db('0x38')]);_0x1561e2['filters']=_[_0x86db('0x39')](_0x1561e2[_0x86db('0x35')],_0x1561e2['query']);_0x4e4447[_0x86db('0x3a')]=_[_0x86db('0x39')](_0x1561e2['model'],qs[_0x86db('0x3b')](_0x24caf7[_0x86db('0x38')][_0x86db('0x3b')]));_0x4e4447[_0x86db('0x3a')]=_0x4e4447['attributes'][_0x86db('0x3c')]?_0x4e4447[_0x86db('0x3a')]:_0x1561e2[_0x86db('0x35')];if(_0x24caf7[_0x86db('0x38')][_0x86db('0x46')]){_0x4e4447['include']=[{'all':!![]}];}_0x4e4447=_[_0x86db('0x43')]({},_0x4e4447,_0x24caf7['options']);return db[_0x86db('0x31')][_0x86db('0x49')](_0x4e4447)['then'](handleEntityNotFound(_0xf0673a,null))[_0x86db('0x27')](respondWithResult(_0xf0673a,null))[_0x86db('0x47')](handleError(_0xf0673a,null));};exports[_0x86db('0x4a')]=function(_0x5dea71,_0x159767){return db[_0x86db('0x31')][_0x86db('0x4a')](_0x5dea71[_0x86db('0x4b')],{})[_0x86db('0x27')](function(_0x458280){var _0x47bc0d=_0x5dea71[_0x86db('0x4c')][_0x86db('0x28')]({'plain':!![]});if(!_0x47bc0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47bc0d[_0x86db('0x4d')]===_0x86db('0x4c')){var _0x4c6aa6=_0x458280['get']({'plain':!![]});var _0x18d636=_0x86db('0x29');return db[_0x86db('0x4e')][_0x86db('0x49')]({'where':{'name':_0x18d636,'userProfileId':_0x47bc0d['userProfileId']},'raw':!![]})[_0x86db('0x27')](function(_0x4486f3){if(_0x4486f3&&_0x4486f3[_0x86db('0x4f')]===0x0){return db['UserProfileResource'][_0x86db('0x4a')]({'name':_0x4c6aa6['name'],'resourceId':_0x4c6aa6['id'],'type':_0x4486f3[_0x86db('0x44')],'sectionId':_0x4486f3['id']},{})[_0x86db('0x27')](function(){return _0x458280;});}else{return _0x458280;}})[_0x86db('0x47')](function(_0x3357dd){logger[_0x86db('0x2e')](_0x86db('0x50'),_0x3357dd);throw _0x3357dd;});}return _0x458280;})[_0x86db('0x27')](respondWithResult(_0x159767,0xc9))['catch'](handleError(_0x159767,null));};exports[_0x86db('0x51')]=function(_0x30d6f7,_0x1660b4){if(_0x30d6f7[_0x86db('0x4b')]['id']){delete _0x30d6f7[_0x86db('0x4b')]['id'];}return db[_0x86db('0x31')]['find']({'where':{'id':_0x30d6f7[_0x86db('0x48')]['id']}})[_0x86db('0x27')](handleEntityNotFound(_0x1660b4,null))[_0x86db('0x27')](saveUpdates(_0x30d6f7['body'],null))['then'](respondWithResult(_0x1660b4,null))['catch'](handleError(_0x1660b4,null));};exports[_0x86db('0x2b')]=function(_0x38c8b2,_0x451a13){return db['Schedule'][_0x86db('0x49')]({'where':{'id':_0x38c8b2['params']['id']}})['then'](handleEntityNotFound(_0x451a13,null))[_0x86db('0x27')](removeEntity(_0x451a13,null))['catch'](handleError(_0x451a13,null));};exports[_0x86db('0x52')]=function(_0x2db006,_0x54a163,_0x33311b){var _0x5373cd=require(_0x86db('0x53'));return db[_0x86db('0x31')][_0x86db('0x49')]({'where':{'id':_0x2db006[_0x86db('0x48')]['id']},'raw':!![]})[_0x86db('0x27')](handleEntityNotFound(_0x54a163,null))[_0x86db('0x27')](function(){_0x5373cd[_0x86db('0x52')](_0x2db006[_0x86db('0x48')]['id']);})[_0x86db('0x27')](respondWithStatusCode(_0x54a163,null))[_0x86db('0x47')](handleError(_0x54a163,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7d3d7d7..83f25a2 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 _0x5985=['./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x40712b,_0x38d36b){var _0x696eef=function(_0x4ce61f){while(--_0x4ce61f){_0x40712b['push'](_0x40712b['shift']());}};_0x696eef(++_0x38d36b);}(_0x5985,0x10c));var _0x5598=function(_0x55ce54,_0x53f644){_0x55ce54=_0x55ce54-0x0;var _0x2b26de=_0x5985[_0x55ce54];return _0x2b26de;};'use strict';var _=require(_0x5598('0x0'));var util=require(_0x5598('0x1'));var logger=require(_0x5598('0x2'))('api');var moment=require(_0x5598('0x3'));var BPromise=require(_0x5598('0x4'));var rp=require(_0x5598('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5598('0x6'));var config=require(_0x5598('0x7'));var attributes=require(_0x5598('0x8'));module[_0x5598('0x9')]=function(_0x2abf9b,_0x71f679){return _0x2abf9b[_0x5598('0xa')]('Schedule',attributes,{'tableName':_0x5598('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa93a=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x4e281a,_0x365198){var _0x535aad=function(_0x1b08fc){while(--_0x1b08fc){_0x4e281a['push'](_0x4e281a['shift']());}};_0x535aad(++_0x365198);}(_0xa93a,0xea));var _0xaa93=function(_0x452b9c,_0xbe125e){_0x452b9c=_0x452b9c-0x0;var _0x8f16fc=_0xa93a[_0x452b9c];return _0x8f16fc;};'use strict';var _=require(_0xaa93('0x0'));var util=require(_0xaa93('0x1'));var logger=require('../../config/logger')(_0xaa93('0x2'));var moment=require(_0xaa93('0x3'));var BPromise=require(_0xaa93('0x4'));var rp=require(_0xaa93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa93('0x6'));var config=require(_0xaa93('0x7'));var attributes=require(_0xaa93('0x8'));module[_0xaa93('0x9')]=function(_0x1b1c3f,_0x1eceef){return _0x1b1c3f[_0xaa93('0xa')](_0xaa93('0xb'),attributes,{'tableName':_0xaa93('0xc'),'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 70ec5ee..1043ffa 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 _0x2770=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x2770,0x182));var _0x0277=function(_0x4e7b37,_0x33b1fa){_0x4e7b37=_0x4e7b37-0x0;var _0x20b707=_0x2770[_0x4e7b37];return _0x20b707;};'use strict';var _=require(_0x0277('0x0'));var util=require(_0x0277('0x1'));var moment=require(_0x0277('0x2'));var BPromise=require(_0x0277('0x3'));var rs=require(_0x0277('0x4'));var fs=require('fs');var Redis=require(_0x0277('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0277('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0277('0x7'));var jayson=require(_0x0277('0x8'));var client=jayson[_0x0277('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c48a9,_0x540942,_0x1c34ac){return new BPromise(function(_0x4492c6,_0x5d0be1){return client[_0x0277('0xa')](_0x2c48a9,_0x1c34ac)[_0x0277('0xb')](function(_0x5da644){logger[_0x0277('0xc')](_0x0277('0xd'),_0x540942,_0x0277('0xe'));logger[_0x0277('0xf')](_0x0277('0x10'),_0x540942,_0x0277('0xe'),JSON[_0x0277('0x11')](_0x5da644));if(_0x5da644[_0x0277('0x12')]){if(_0x5da644[_0x0277('0x12')][_0x0277('0x13')]===0x1f4){logger[_0x0277('0x12')](_0x0277('0xd'),_0x540942,_0x5da644['error']['message']);return _0x5d0be1(_0x5da644[_0x0277('0x12')]['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x540942,_0x5da644['error'][_0x0277('0x14')]);return _0x4492c6(_0x5da644[_0x0277('0x12')][_0x0277('0x14')]);}else{logger[_0x0277('0xc')](_0x0277('0xd'),_0x540942,_0x0277('0xe'));_0x4492c6(_0x5da644['result']['message']);}})[_0x0277('0x15')](function(_0x51486f){logger[_0x0277('0x12')](_0x0277('0xd'),_0x540942,_0x51486f);_0x5d0be1(_0x51486f);});});} \ No newline at end of file +var _0x4e3a=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/environment','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x17c59e,_0x4c6dcc){var _0x891216=function(_0x3cd9d0){while(--_0x3cd9d0){_0x17c59e['push'](_0x17c59e['shift']());}};_0x891216(++_0x4c6dcc);}(_0x4e3a,0x70));var _0xa4e3=function(_0x522e32,_0x440e6d){_0x522e32=_0x522e32-0x0;var _0x216842=_0x4e3a[_0x522e32];return _0x216842;};'use strict';var _=require(_0xa4e3('0x0'));var util=require(_0xa4e3('0x1'));var moment=require(_0xa4e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4e3('0x3'));var fs=require('fs');var Redis=require(_0xa4e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa4e3('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2d23a7,_0x47f260,_0x31175f){return new BPromise(function(_0x443b25,_0x23343d){return client[_0xa4e3('0x7')](_0x2d23a7,_0x31175f)['then'](function(_0x51435f){logger[_0xa4e3('0x8')](_0xa4e3('0x9'),_0x47f260,'request\x20sent');logger['debug'](_0xa4e3('0xa'),_0x47f260,_0xa4e3('0xb'),JSON[_0xa4e3('0xc')](_0x51435f));if(_0x51435f[_0xa4e3('0xd')]){if(_0x51435f[_0xa4e3('0xd')][_0xa4e3('0xe')]===0x1f4){logger[_0xa4e3('0xd')]('Schedule,\x20%s,\x20%s',_0x47f260,_0x51435f['error'][_0xa4e3('0xf')]);return _0x23343d(_0x51435f[_0xa4e3('0xd')][_0xa4e3('0xf')]);}logger[_0xa4e3('0xd')](_0xa4e3('0x9'),_0x47f260,_0x51435f[_0xa4e3('0xd')]['message']);return _0x443b25(_0x51435f['error'][_0xa4e3('0xf')]);}else{logger[_0xa4e3('0x8')](_0xa4e3('0x9'),_0x47f260,_0xa4e3('0xb'));_0x443b25(_0x51435f[_0xa4e3('0x10')]['message']);}})[_0xa4e3('0x11')](function(_0x414f06){logger[_0xa4e3('0xd')]('Schedule,\x20%s,\x20%s',_0x47f260,_0x414f06);_0x23343d(_0x414f06);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 69f17d0..6fd47a5 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 _0x0709=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','create','put','delete','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0709,0x111));var _0x9070=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x0709[_0x1314d4];return _0x584ba5;};'use strict';var multer=require(_0x9070('0x0'));var util=require(_0x9070('0x1'));var path=require(_0x9070('0x2'));var timeout=require('connect-timeout');var express=require(_0x9070('0x3'));var router=express[_0x9070('0x4')]();var fs_extra=require(_0x9070('0x5'));var auth=require(_0x9070('0x6'));var interaction=require(_0x9070('0x7'));var config=require('../../config/environment');var controller=require(_0x9070('0x8'));router[_0x9070('0x9')]('/',auth[_0x9070('0xa')](),controller['index']);router[_0x9070('0x9')](_0x9070('0xb'),auth[_0x9070('0xa')](),controller[_0x9070('0xc')]);router['get'](_0x9070('0xd'),auth[_0x9070('0xa')](),controller[_0x9070('0xe')]);router[_0x9070('0x9')](_0x9070('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x9070('0x10')]('/',auth[_0x9070('0xa')](),controller[_0x9070('0x11')]);router[_0x9070('0x12')](_0x9070('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9070('0x13')](_0x9070('0xd'),auth[_0x9070('0xa')](),controller['destroy']);module[_0x9070('0x14')]=router; \ No newline at end of file +var _0xb65c=['describe','/:id','show','/:id/download','download','post','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0xb65c,0x16e));var _0xcb65=function(_0x43bed9,_0x26adca){_0x43bed9=_0x43bed9-0x0;var _0x27b03d=_0xb65c[_0x43bed9];return _0x27b03d;};'use strict';var multer=require(_0xcb65('0x0'));var util=require(_0xcb65('0x1'));var path=require('path');var timeout=require(_0xcb65('0x2'));var express=require(_0xcb65('0x3'));var router=express[_0xcb65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb65('0x5'));var interaction=require(_0xcb65('0x6'));var config=require('../../config/environment');var controller=require(_0xcb65('0x7'));router[_0xcb65('0x8')]('/',auth[_0xcb65('0x9')](),controller[_0xcb65('0xa')]);router['get'](_0xcb65('0xb'),auth['isAuthenticated'](),controller[_0xcb65('0xc')]);router[_0xcb65('0x8')](_0xcb65('0xd'),auth[_0xcb65('0x9')](),controller[_0xcb65('0xe')]);router[_0xcb65('0x8')](_0xcb65('0xf'),auth[_0xcb65('0x9')](),controller[_0xcb65('0x10')]);router[_0xcb65('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb65('0x12')](_0xcb65('0xd'),auth[_0xcb65('0x9')](),controller[_0xcb65('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcb65('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4522f77..90fedad 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 _0xdf5d=['closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xdf5d,0x126));var _0xddf5=function(_0x492be3,_0x32f4f9){_0x492be3=_0x492be3-0x0;var _0x570167=_0xdf5d[_0x492be3];return _0x570167;};'use strict';var Sequelize=require(_0xddf5('0x0'));var moment=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var config=require(_0xddf5('0x3'));module[_0xddf5('0x4')]={'format':{'type':Sequelize[_0xddf5('0x5')],'get':function(){return this[_0xddf5('0x6')](_0xddf5('0x7'))?path['extname'](this[_0xddf5('0x6')](_0xddf5('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xddf5('0x8')]},'channel':{'type':Sequelize[_0xddf5('0x8')]},'value':{'type':Sequelize[_0xddf5('0x8')],'set':function(_0x228fd4){var _0xf3a209=_0x228fd4[_0xddf5('0x9')](/\\/g,'/');this[_0xddf5('0xa')](_0xddf5('0x7'),_0xf3a209);}},'rating':{'type':Sequelize[_0xddf5('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xddf5('0xb')],'set':function(_0x36b306){this[_0xddf5('0xa')](_0xddf5('0xc'),moment()[_0xddf5('0xd')](_0x36b306,'ms'));this['setDataValue'](_0xddf5('0xe'),moment());this[_0xddf5('0xa')](_0xddf5('0xf'),_0x36b306);}},'startedAt':{'type':Sequelize[_0xddf5('0x10')],'get':function(){return moment(this[_0xddf5('0x6')](_0xddf5('0xc')))[_0xddf5('0x11')](_0xddf5('0x12'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xddf5('0x6')](_0xddf5('0xe')))[_0xddf5('0x11')](_0xddf5('0x12'))[_0xddf5('0x13')]();}},'createdAt':{'type':Sequelize[_0xddf5('0x10')],'get':function(){return moment(this[_0xddf5('0x6')](_0xddf5('0x14')))['format'](_0xddf5('0x12'))[_0xddf5('0x13')]();}},'updatedAt':{'type':Sequelize[_0xddf5('0x10')],'get':function(){return moment(this[_0xddf5('0x6')](_0xddf5('0x15')))['format'](_0xddf5('0x12'))['toString']();}}}; \ No newline at end of file +var _0x565e=['updatedAt','sequelize','path','../../config/environment','exports','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','MM-DD-YYYY\x20HH:mm','format','createdAt','toString'];(function(_0x35ce07,_0x4e95b6){var _0xc93785=function(_0x118740){while(--_0x118740){_0x35ce07['push'](_0x35ce07['shift']());}};_0xc93785(++_0x4e95b6);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe565('0x0'));var moment=require('moment');var path=require(_0xe565('0x1'));var config=require(_0xe565('0x2'));module[_0xe565('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xe565('0x4'))?path[_0xe565('0x5')](this[_0xe565('0x6')](_0xe565('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xe565('0x7')]},'channel':{'type':Sequelize[_0xe565('0x7')]},'value':{'type':Sequelize[_0xe565('0x7')],'set':function(_0x1a9d48){var _0x470daf=_0x1a9d48[_0xe565('0x8')](/\\/g,'/');this[_0xe565('0x9')](_0xe565('0x4'),_0x470daf);}},'rating':{'type':Sequelize[_0xe565('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe565('0xa')],'set':function(_0x1d3d48){this[_0xe565('0x9')]('startedAt',moment()[_0xe565('0xb')](_0x1d3d48,'ms'));this[_0xe565('0x9')](_0xe565('0xc'),moment());this['setDataValue'](_0xe565('0xd'),_0x1d3d48);}},'startedAt':{'type':Sequelize[_0xe565('0xe')],'get':function(){return moment(this[_0xe565('0x6')](_0xe565('0xf')))['format'](_0xe565('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xe565('0xe')],'get':function(){return moment(this['getDataValue'](_0xe565('0xc')))[_0xe565('0x11')](_0xe565('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xe565('0xe')],'get':function(){return moment(this[_0xe565('0x6')](_0xe565('0x12')))[_0xe565('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xe565('0x13')]();}},'updatedAt':{'type':Sequelize[_0xe565('0xe')],'get':function(){return moment(this[_0xe565('0x6')](_0xe565('0x14')))[_0xe565('0x11')](_0xe565('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2bbec0f..d3e2b10 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 _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6aa7,0x178));var _0x76aa=function(_0x29a6a5,_0x344a74){_0x29a6a5=_0x29a6a5-0x0;var _0x5b5b15=_0x6aa7[_0x29a6a5];return _0x5b5b15;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file +var _0x5636=['rawAttributes','fieldName','type','key','model','differenceBy','map','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','rows','catch','show','find','create','body','duration','createdAt','closedAt','value','describe','uniqueid','params','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index'];(function(_0x4ce299,_0x41f85f){var _0x57e096=function(_0x12be7f){while(--_0x12be7f){_0x4ce299['push'](_0x4ce299['shift']());}};_0x57e096(++_0x41f85f);}(_0x5636,0x102));var _0x6563=function(_0x315170,_0x3557aa){_0x315170=_0x315170-0x0;var _0x336d88=_0x5636[_0x315170];return _0x336d88;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}exports[_0x6563('0x26')]=function(_0x118d31,_0x17326c){var _0x2a1550={},_0x3eb23b={},_0x4b4d3b={'count':0x0,'rows':[]};var _0x3c8bd1=_['map'](db['ScreenRecording'][_0x6563('0x27')],function(_0x35af37){return{'name':_0x35af37[_0x6563('0x28')],'type':_0x35af37[_0x6563('0x29')][_0x6563('0x2a')]};});_0x3eb23b[_0x6563('0x2b')]=_[_0x6563('0x2c')](_[_0x6563('0x2d')](_0x3c8bd1,_0x6563('0x25')),[_0x6563('0x2e')]);_0x3eb23b['query']=_[_0x6563('0x2f')](_0x118d31[_0x6563('0x30')]);_0x3eb23b[_0x6563('0x31')]=_[_0x6563('0x32')](_0x3eb23b[_0x6563('0x2b')],_0x3eb23b[_0x6563('0x30')]);_0x2a1550[_0x6563('0x33')]=_['intersection'](_0x3eb23b[_0x6563('0x2b')],qs[_0x6563('0x34')](_0x118d31[_0x6563('0x30')][_0x6563('0x34')]));_0x2a1550[_0x6563('0x33')]=_0x2a1550[_0x6563('0x33')]['length']?_0x2a1550[_0x6563('0x33')]:_0x3eb23b[_0x6563('0x2b')];if(!_0x118d31[_0x6563('0x30')][_0x6563('0x35')](_0x6563('0x36'))){_0x2a1550[_0x6563('0x1c')]=qs[_0x6563('0x1c')](_0x118d31['query'][_0x6563('0x1c')]);_0x2a1550[_0x6563('0x1a')]=qs['offset'](_0x118d31[_0x6563('0x30')][_0x6563('0x1a')]);}_0x2a1550['order']=qs['sort'](_0x118d31[_0x6563('0x30')][_0x6563('0x37')]);_0x2a1550[_0x6563('0x38')]=qs[_0x6563('0x31')](_['pick'](_0x118d31[_0x6563('0x30')],_0x3eb23b[_0x6563('0x31')]),_0x3c8bd1);if(_0x118d31['query'][_0x6563('0x39')]){_0x2a1550[_0x6563('0x38')]=_[_0x6563('0x3a')](_0x2a1550[_0x6563('0x38')],{'$or':_[_0x6563('0x2d')](_0x3c8bd1,function(_0x1f6341){if(_0x1f6341[_0x6563('0x29')]!==_0x6563('0x3b')){var _0x2e4177={};_0x2e4177[_0x1f6341['name']]={'$like':'%'+_0x118d31[_0x6563('0x30')][_0x6563('0x39')]+'%'};return _0x2e4177;}})});}_0x2a1550=_[_0x6563('0x3a')]({},_0x2a1550,_0x118d31[_0x6563('0x3c')]);var _0x5ebe88={'where':_0x2a1550['where']};return db[_0x6563('0x3d')][_0x6563('0x3e')](_0x5ebe88)[_0x6563('0x22')](function(_0x5db29d){_0x4b4d3b[_0x6563('0x3e')]=_0x5db29d;if(_0x118d31['query'][_0x6563('0x3f')]){_0x2a1550[_0x6563('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6563('0x41')](_0x2a1550);})[_0x6563('0x22')](function(_0xea186){_0x4b4d3b[_0x6563('0x42')]=_0xea186;return _0x4b4d3b;})[_0x6563('0x22')](respondWithFilteredResult(_0x17326c,_0x2a1550))[_0x6563('0x43')](handleError(_0x17326c,null));};exports[_0x6563('0x44')]=function(_0x32932f,_0xd30789){var _0xfc7eb1={'raw':![],'where':{'id':_0x32932f['params']['id']}},_0x2acb52={};_0x2acb52['model']=_[_0x6563('0x2f')](db[_0x6563('0x3d')][_0x6563('0x27')]);_0x2acb52[_0x6563('0x30')]=_[_0x6563('0x2f')](_0x32932f[_0x6563('0x30')]);_0x2acb52[_0x6563('0x31')]=_['intersection'](_0x2acb52[_0x6563('0x2b')],_0x2acb52[_0x6563('0x30')]);_0xfc7eb1[_0x6563('0x33')]=_[_0x6563('0x32')](_0x2acb52['model'],qs[_0x6563('0x34')](_0x32932f[_0x6563('0x30')][_0x6563('0x34')]));_0xfc7eb1[_0x6563('0x33')]=_0xfc7eb1[_0x6563('0x33')]['length']?_0xfc7eb1['attributes']:_0x2acb52[_0x6563('0x2b')];if(_0x32932f[_0x6563('0x30')][_0x6563('0x3f')]){_0xfc7eb1['include']=[{'all':!![]}];}_0xfc7eb1=_[_0x6563('0x3a')]({},_0xfc7eb1,_0x32932f[_0x6563('0x3c')]);return db[_0x6563('0x3d')][_0x6563('0x45')](_0xfc7eb1)['then'](handleEntityNotFound(_0xd30789,null))[_0x6563('0x22')](respondWithResult(_0xd30789,null))[_0x6563('0x43')](handleError(_0xd30789,null));};exports[_0x6563('0x46')]=function(_0x55e927,_0x35b0ce){return db['ScreenRecording'][_0x6563('0x46')](_0x55e927['body'],{})['then'](respondWithResult(_0x35b0ce,0xc9))[_0x6563('0x43')](handleError(_0x35b0ce,null));};exports[_0x6563('0x21')]=function(_0x2ebab0,_0xb84325){if(_0x2ebab0[_0x6563('0x47')]['id']){delete _0x2ebab0[_0x6563('0x47')]['id'];}delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x48')];delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x49')];delete _0x2ebab0['body'][_0x6563('0x4a')];delete _0x2ebab0['body'][_0x6563('0x4b')];return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x2ebab0['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xb84325,null))[_0x6563('0x22')](saveUpdates(_0x2ebab0['body'],null))[_0x6563('0x22')](respondWithResult(_0xb84325,null))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x4c')]=function(_0x3883f3,_0xbd920a){return db['ScreenRecording'][_0x6563('0x4c')]()['then'](respondWithResult(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['download']=function(_0xd2ed6b,_0x5992c8,_0x55e002){var _0x5c8274=require('../../components/encryptor');var _0x270667=![];var _0x5ade56={};if(_0xd2ed6b[_0x6563('0x30')]['type']&&_0xd2ed6b[_0x6563('0x30')][_0x6563('0x29')]===_0x6563('0x4d')){_0x5ade56[_0x6563('0x4d')]=_0xd2ed6b[_0x6563('0x4e')]['id'];}else{_0x5ade56['id']=_0xd2ed6b[_0x6563('0x4e')]['id'];}return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':_0x5ade56,'attributes':['id',_0x6563('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x5992c8,null))[_0x6563('0x22')](function(_0x28b1c6){if(_0x28b1c6){var _0x97ee3=path[_0x6563('0x4f')](config[_0x6563('0x50')],_0x6563('0x51'),_0x28b1c6[_0x6563('0x4b')]);var _0x32c715=util[_0x6563('0x2e')](_0x6563('0x52'),_0x97ee3);if(fs[_0x6563('0x53')](_0x32c715)){_0x270667=!![];return _0x5c8274['decryptFile'](_0x32c715,_0x97ee3,config[_0x6563('0x54')][_0x6563('0x55')])[_0x6563('0x22')](function(){return _0x28b1c6;});}return _0x28b1c6;}})[_0x6563('0x22')](function(_0x46c26c){if(_0x46c26c){var _0x3c06ac=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x46c26c[_0x6563('0x4b')]);if(!fs['existsSync'](_0x3c06ac)){throw new db[(_0x6563('0x56'))][(_0x6563('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x46c26c['filename']){return _0x5992c8[_0x6563('0x58')](_0x3c06ac,_0x46c26c[_0x6563('0x59')]+path[_0x6563('0x5a')](_0x3c06ac),function(){if(_0x270667){fs[_0x6563('0x5b')](_0x3c06ac);}});}else{return _0x5992c8['download'](_0x3c06ac,function(_0x2a3df0){if(_0x270667){fs['unlink'](_0x3c06ac);}});}}})[_0x6563('0x43')](function(_0x29aecb){if(_0x29aecb['message']==='ScreenRecording\x20not\x20found'){_0x5992c8[_0x6563('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x5992c8,null);}});};exports[_0x6563('0x23')]=function(_0x49d6a5,_0x356010){return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x49d6a5[_0x6563('0x4e')]['id']}})['then'](function(_0x83d5c){if(_[_0x6563('0x5c')](_0x83d5c)){throw new ReferenceError(_0x6563('0x5d'));}return _0x83d5c;})[_0x6563('0x22')](function(_0x3ffb7f){var _0x2d4694=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x3ffb7f['value']);logger[_0x6563('0x5e')](_0x6563('0x5f'),_0x2d4694);if(!_['isNil'](_0x3ffb7f['value'])&&fs['existsSync'](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+_0x6563('0x61'));fs[_0x6563('0x62')](_0x2d4694);}_0x2d4694=_0x2d4694+'.cypher';if(!_[_0x6563('0x5c')](_0x3ffb7f[_0x6563('0x4b')])&&fs[_0x6563('0x53')](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d4694);}return _0x3ffb7f;})[_0x6563('0x22')](function(_0x1d7b5d){if(!_0x1d7b5d)throw new InternalError();return _0x1d7b5d[_0x6563('0x23')]();})['then'](function(){_0x356010[_0x6563('0x18')](0xcc)['end']();})[_0x6563('0x43')](handleError(_0x356010,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b2332c6..b871275 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 _0x2a1d=['ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x1a22e9,_0x5a2229){var _0x5dafe9=function(_0x5b560f){while(--_0x5b560f){_0x1a22e9['push'](_0x1a22e9['shift']());}};_0x5dafe9(++_0x5a2229);}(_0x2a1d,0x153));var _0xd2a1=function(_0x199044,_0x4310b9){_0x199044=_0x199044-0x0;var _0x5377b0=_0x2a1d[_0x199044];return _0x5377b0;};'use strict';var _=require(_0xd2a1('0x0'));var util=require(_0xd2a1('0x1'));var logger=require('../../config/logger')(_0xd2a1('0x2'));var moment=require(_0xd2a1('0x3'));var BPromise=require(_0xd2a1('0x4'));var rp=require(_0xd2a1('0x5'));var fs=require('fs');var path=require(_0xd2a1('0x6'));var rimraf=require('rimraf');var config=require(_0xd2a1('0x7'));var attributes=require(_0xd2a1('0x8'));module[_0xd2a1('0x9')]=function(_0x310c01,_0x36ca51){return _0x310c01[_0xd2a1('0xa')](_0xd2a1('0xb'),attributes,{'tableName':_0xd2a1('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xd2a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe583=['path','rimraf','./screenRecording.attributes','exports','ScreenRecording','interactionid','util','bluebird','request-promise'];(function(_0x5718f5,_0x368c3f){var _0x30ccfe=function(_0x1a1665){while(--_0x1a1665){_0x5718f5['push'](_0x5718f5['shift']());}};_0x30ccfe(++_0x368c3f);}(_0xe583,0x126));var _0x3e58=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xe583[_0x163040];return _0x364667;};'use strict';var _=require('lodash');var util=require(_0x3e58('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e58('0x1'));var rp=require(_0x3e58('0x2'));var fs=require('fs');var path=require(_0x3e58('0x3'));var rimraf=require(_0x3e58('0x4'));var config=require('../../config/environment');var attributes=require(_0x3e58('0x5'));module[_0x3e58('0x6')]=function(_0x281921,_0xdd2b67){return _0x281921['define'](_0x3e58('0x7'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x3e58('0x8'),'fields':[_0x3e58('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6ee30db..fd00471 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 _0x8cf9=['jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5353ee,_0x1dfb79){var _0x55476c=function(_0x11ba69){while(--_0x11ba69){_0x5353ee['push'](_0x5353ee['shift']());}};_0x55476c(++_0x1dfb79);}(_0x8cf9,0x17f));var _0x98cf=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8cf9[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x98cf('0x0'));var util=require(_0x98cf('0x1'));var moment=require(_0x98cf('0x2'));var BPromise=require(_0x98cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98cf('0x5'));var logger=require('../../config/logger')(_0x98cf('0x6'));var config=require(_0x98cf('0x7'));var jayson=require(_0x98cf('0x8'));var client=jayson[_0x98cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ff2b2,_0x2d9bd6,_0x883e1f){return new BPromise(function(_0x35c7dc,_0x583e65){return client[_0x98cf('0xa')](_0x1ff2b2,_0x883e1f)[_0x98cf('0xb')](function(_0x4466e8){logger[_0x98cf('0xc')](_0x98cf('0xd'),_0x2d9bd6,_0x98cf('0xe'));logger[_0x98cf('0xf')](_0x98cf('0x10'),_0x2d9bd6,'request\x20sent',JSON[_0x98cf('0x11')](_0x4466e8));if(_0x4466e8[_0x98cf('0x12')]){if(_0x4466e8['error'][_0x98cf('0x13')]===0x1f4){logger[_0x98cf('0x12')](_0x98cf('0xd'),_0x2d9bd6,_0x4466e8[_0x98cf('0x12')][_0x98cf('0x14')]);return _0x583e65(_0x4466e8[_0x98cf('0x12')][_0x98cf('0x14')]);}logger[_0x98cf('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x2d9bd6,_0x4466e8[_0x98cf('0x12')][_0x98cf('0x14')]);return _0x35c7dc(_0x4466e8[_0x98cf('0x12')][_0x98cf('0x14')]);}else{logger[_0x98cf('0xc')](_0x98cf('0xd'),_0x2d9bd6,_0x98cf('0xe'));_0x35c7dc(_0x4466e8[_0x98cf('0x15')]['message']);}})[_0x98cf('0x16')](function(_0x58616d){logger[_0x98cf('0x12')](_0x98cf('0xd'),_0x2d9bd6,_0x58616d);_0x583e65(_0x58616d);});});} \ No newline at end of file +var _0x64c2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x288f98,_0x54c12f){var _0x2ba872=function(_0x3f4fe2){while(--_0x3f4fe2){_0x288f98['push'](_0x288f98['shift']());}};_0x2ba872(++_0x54c12f);}(_0x64c2,0x1c8));var _0x264c=function(_0x35b8ca,_0x2a64bf){_0x35b8ca=_0x35b8ca-0x0;var _0x1cfb9b=_0x64c2[_0x35b8ca];return _0x1cfb9b;};'use strict';var _=require(_0x264c('0x0'));var util=require(_0x264c('0x1'));var moment=require(_0x264c('0x2'));var BPromise=require(_0x264c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x264c('0x4'));var logger=require(_0x264c('0x5'))(_0x264c('0x6'));var config=require(_0x264c('0x7'));var jayson=require(_0x264c('0x8'));var client=jayson[_0x264c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5132c9,_0xb246a1,_0x6577bd){return new BPromise(function(_0x10213b,_0x4ba494){return client[_0x264c('0xa')](_0x5132c9,_0x6577bd)['then'](function(_0x1ebf33){logger[_0x264c('0xb')](_0x264c('0xc'),_0xb246a1,_0x264c('0xd'));logger['debug'](_0x264c('0xe'),_0xb246a1,_0x264c('0xd'),JSON[_0x264c('0xf')](_0x1ebf33));if(_0x1ebf33[_0x264c('0x10')]){if(_0x1ebf33[_0x264c('0x10')]['code']===0x1f4){logger[_0x264c('0x10')](_0x264c('0xc'),_0xb246a1,_0x1ebf33['error'][_0x264c('0x11')]);return _0x4ba494(_0x1ebf33['error'][_0x264c('0x11')]);}logger[_0x264c('0x10')](_0x264c('0xc'),_0xb246a1,_0x1ebf33['error']['message']);return _0x10213b(_0x1ebf33['error']['message']);}else{logger['info'](_0x264c('0xc'),_0xb246a1,_0x264c('0xd'));_0x10213b(_0x1ebf33[_0x264c('0x12')][_0x264c('0x11')]);}})[_0x264c('0x13')](function(_0x48c49e){logger[_0x264c('0x10')](_0x264c('0xc'),_0xb246a1,_0x48c49e);_0x4ba494(_0x48c49e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4654a90..27ea1cb 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 _0xb864=['fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/favicon','getFavicon','diskStorage','join','root','format','originalname','post','single','file','addLogo','server/files/images/logos/','%s%s','logologin','extname','addLogoLogin','preferred','/:id/preferred','addFavicon','put','/:id','update','multer','util','connect-timeout','express'];(function(_0x39e92b,_0x27a01b){var _0x217f02=function(_0x104a99){while(--_0x104a99){_0x39e92b['push'](_0x39e92b['shift']());}};_0x217f02(++_0x27a01b);}(_0xb864,0x164));var _0x4b86=function(_0x2a2572,_0x9e3b09){_0x2a2572=_0x2a2572-0x0;var _0x3a3cc3=_0xb864[_0x2a2572];return _0x3a3cc3;};'use strict';var multer=require(_0x4b86('0x0'));var util=require(_0x4b86('0x1'));var path=require('path');var timeout=require(_0x4b86('0x2'));var express=require(_0x4b86('0x3'));var router=express['Router']();var fs_extra=require(_0x4b86('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4b86('0x5'));var config=require(_0x4b86('0x6'));var controller=require(_0x4b86('0x7'));router[_0x4b86('0x8')]('/',auth[_0x4b86('0x9')](),controller[_0x4b86('0xa')]);router[_0x4b86('0x8')]('/now',controller[_0x4b86('0xb')]);router[_0x4b86('0x8')]('/:id',controller[_0x4b86('0xc')]);router[_0x4b86('0x8')](_0x4b86('0xd'),controller[_0x4b86('0xe')]);router['get'](_0x4b86('0xf'),controller[_0x4b86('0x10')]);router[_0x4b86('0x8')](_0x4b86('0x11'),controller['gdpr']);router[_0x4b86('0x8')]('/:id/preferred',controller['getPreferred']);router[_0x4b86('0x8')](_0x4b86('0x12'),controller[_0x4b86('0x13')]);var upload=multer({'storage':multer[_0x4b86('0x14')]({'destination':function(_0xb71095,_0x1ae0d4,_0x2f38d9){_0x2f38d9(null,path[_0x4b86('0x15')](config[_0x4b86('0x16')],'server/files/images/logos/'));},'filename':function(_0x40641a,_0x448129,_0x7379ff){_0x7379ff(null,util[_0x4b86('0x17')]('%s%s','logo',path['extname'](_0x448129[_0x4b86('0x18')])));}})});router[_0x4b86('0x19')](_0x4b86('0xd'),upload[_0x4b86('0x1a')](_0x4b86('0x1b')),controller[_0x4b86('0x1c')]);var upload=multer({'storage':multer[_0x4b86('0x14')]({'destination':function(_0x1d2eac,_0x1708d2,_0x309332){_0x309332(null,path[_0x4b86('0x15')](config[_0x4b86('0x16')],_0x4b86('0x1d')));},'filename':function(_0x2f991a,_0x4db908,_0x454346){_0x454346(null,util[_0x4b86('0x17')](_0x4b86('0x1e'),_0x4b86('0x1f'),path[_0x4b86('0x20')](_0x4db908[_0x4b86('0x18')])));}})});router['post'](_0x4b86('0xf'),upload['single'](_0x4b86('0x1b')),controller[_0x4b86('0x21')]);var upload=multer({'storage':multer[_0x4b86('0x14')]({'destination':function(_0x51bac2,_0x2fe2ef,_0x2d9d68){_0x2d9d68(null,path['join'](config[_0x4b86('0x16')],_0x4b86('0x1d')));},'filename':function(_0x2dac94,_0x2f134e,_0x111d2f){_0x111d2f(null,util[_0x4b86('0x17')](_0x4b86('0x1e'),_0x4b86('0x22'),path[_0x4b86('0x20')](_0x2f134e[_0x4b86('0x18')])));}})});router[_0x4b86('0x19')](_0x4b86('0x23'),upload[_0x4b86('0x1a')](_0x4b86('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x4b86('0x14')]({'destination':function(_0x294426,_0x36cf63,_0x526889){_0x526889(null,path[_0x4b86('0x15')](config[_0x4b86('0x16')],_0x4b86('0x1d')));},'filename':function(_0x3358fc,_0x2a64d1,_0x2542e6){_0x2542e6(null,util[_0x4b86('0x17')](_0x4b86('0x1e'),'favicon',path[_0x4b86('0x20')](_0x2a64d1['originalname'])));}})});router[_0x4b86('0x19')](_0x4b86('0x12'),upload[_0x4b86('0x1a')](_0x4b86('0x1b')),controller[_0x4b86('0x24')]);router[_0x4b86('0x25')](_0x4b86('0x26'),auth[_0x4b86('0x9')](),controller[_0x4b86('0x27')]);module['exports']=router; \ No newline at end of file +var _0xcf45=['index','get','/:id','show','/:id/logo','getLogo','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','extname','originalname','post','single','file','addLogo','server/files/images/logos/','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcf45,0x10b));var _0x5cf4=function(_0x226439,_0x5903de){_0x226439=_0x226439-0x0;var _0x39c31e=_0xcf45[_0x226439];return _0x39c31e;};'use strict';var multer=require('multer');var util=require(_0x5cf4('0x0'));var path=require(_0x5cf4('0x1'));var timeout=require(_0x5cf4('0x2'));var express=require(_0x5cf4('0x3'));var router=express['Router']();var fs_extra=require(_0x5cf4('0x4'));var auth=require(_0x5cf4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5cf4('0x6')]);router[_0x5cf4('0x7')]('/now',controller['getDate']);router['get'](_0x5cf4('0x8'),controller[_0x5cf4('0x9')]);router['get'](_0x5cf4('0xa'),controller[_0x5cf4('0xb')]);router[_0x5cf4('0x7')]('/:id/logo_login',controller['getLogoLogin']);router[_0x5cf4('0x7')]('/:id/gdpr',controller['gdpr']);router[_0x5cf4('0x7')](_0x5cf4('0xc'),controller[_0x5cf4('0xd')]);router['get']('/:id/favicon',controller[_0x5cf4('0xe')]);var upload=multer({'storage':multer[_0x5cf4('0xf')]({'destination':function(_0x4d7281,_0x36bd97,_0x246f97){_0x246f97(null,path[_0x5cf4('0x10')](config[_0x5cf4('0x11')],'server/files/images/logos/'));},'filename':function(_0x502b48,_0x31e2be,_0x46b470){_0x46b470(null,util[_0x5cf4('0x12')](_0x5cf4('0x13'),'logo',path[_0x5cf4('0x14')](_0x31e2be[_0x5cf4('0x15')])));}})});router[_0x5cf4('0x16')](_0x5cf4('0xa'),upload[_0x5cf4('0x17')](_0x5cf4('0x18')),controller[_0x5cf4('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34af52,_0x526301,_0x438437){_0x438437(null,path[_0x5cf4('0x10')](config['root'],_0x5cf4('0x1a')));},'filename':function(_0x4b4d80,_0x1ea4ee,_0x38f2f0){_0x38f2f0(null,util[_0x5cf4('0x12')](_0x5cf4('0x13'),_0x5cf4('0x1b'),path[_0x5cf4('0x14')](_0x1ea4ee['originalname'])));}})});router[_0x5cf4('0x16')](_0x5cf4('0x1c'),upload[_0x5cf4('0x17')](_0x5cf4('0x18')),controller[_0x5cf4('0x1d')]);var upload=multer({'storage':multer[_0x5cf4('0xf')]({'destination':function(_0x2d05,_0x21b198,_0x22e3d7){_0x22e3d7(null,path[_0x5cf4('0x10')](config[_0x5cf4('0x11')],_0x5cf4('0x1a')));},'filename':function(_0x17ddb5,_0x1bb956,_0x30d5e7){_0x30d5e7(null,util['format'](_0x5cf4('0x13'),_0x5cf4('0x1e'),path['extname'](_0x1bb956[_0x5cf4('0x15')])));}})});router[_0x5cf4('0x16')](_0x5cf4('0xc'),upload['single'](_0x5cf4('0x18')),controller[_0x5cf4('0x1f')]);var upload=multer({'storage':multer[_0x5cf4('0xf')]({'destination':function(_0x1ae1ef,_0x23764b,_0x2f43ca){_0x2f43ca(null,path[_0x5cf4('0x10')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2c81d2,_0x19f280,_0x2bc7f3){_0x2bc7f3(null,util[_0x5cf4('0x12')]('%s%s',_0x5cf4('0x20'),path[_0x5cf4('0x14')](_0x19f280[_0x5cf4('0x15')])));}})});router[_0x5cf4('0x16')](_0x5cf4('0x21'),upload[_0x5cf4('0x17')](_0x5cf4('0x18')),controller[_0x5cf4('0x22')]);router[_0x5cf4('0x23')](_0x5cf4('0x8'),auth[_0x5cf4('0x24')](),controller[_0x5cf4('0x25')]);module[_0x5cf4('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3362472..52ad18c 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x497e13,_0x576e85){var _0x120a38=function(_0x53dfff){while(--_0x53dfff){_0x497e13['push'](_0x497e13['shift']());}};_0x120a38(++_0x576e85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x421d1e,_0x35f7fe){var _0xb2c1ed=function(_0x4a5aa5){while(--_0x4a5aa5){_0x421d1e['push'](_0x421d1e['shift']());}};_0xb2c1ed(++_0x35f7fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 37970a0..cb175df 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 _0xde50=['result','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','Setting','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','params','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','\x20not\x20found','download','getLogoLogin','custom','default_loginLogo.svg','ValidationError','addPreferred','getPreferred','server/files/images/logos','defaultLoginLogo','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x17730a,_0x362127){var _0x485db1=function(_0x144233){while(--_0x144233){_0x17730a['push'](_0x17730a['shift']());}};_0x485db1(++_0x362127);}(_0xde50,0x140));var _0x0de5=function(_0x278561,_0x3423a4){_0x278561=_0x278561-0x0;var _0x303ac6=_0xde50[_0x278561];return _0x303ac6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0de5('0x0'));var jsonpatch=require(_0x0de5('0x1'));var rp=require(_0x0de5('0x2'));var moment=require(_0x0de5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0de5('0x4'));var util=require('util');var path=require(_0x0de5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0de5('0x6'));var _=require(_0x0de5('0x7'));var squel=require(_0x0de5('0x8'));var crypto=require('crypto');var jsforce=require(_0x0de5('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0de5('0xa'));var Redis=require(_0x0de5('0xb'));var authService=require(_0x0de5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0de5('0xd'));var hardwareService=require(_0x0de5('0xe'));var logger=require('../../config/logger')(_0x0de5('0xf'));var utils=require(_0x0de5('0x10'));var config=require(_0x0de5('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x0de5('0x12'));var client=jayson[_0x0de5('0x13')][_0x0de5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x14bf51,_0x2dddc0,_0x5ba869,_0xee8dcb){return new BPromise(function(_0x5eaad2,_0x544703){var _0x2b71cd=_0xee8dcb||client;return _0x2b71cd[_0x0de5('0x15')](_0x14bf51,_0x5ba869)[_0x0de5('0x16')](function(_0x92fe6d){logger[_0x0de5('0x17')](_0x0de5('0x18'),_0x2dddc0,'request\x20sent');logger[_0x0de5('0x19')](_0x0de5('0x1a'),_0x2dddc0,_0x0de5('0x1b'),JSON[_0x0de5('0x1c')](_0x92fe6d));if(_0x92fe6d[_0x0de5('0x1d')]){if(_0x92fe6d[_0x0de5('0x1d')]['code']===0x1f4){logger[_0x0de5('0x1d')]('Setting,\x20%s,\x20%s',_0x2dddc0,_0x92fe6d[_0x0de5('0x1d')][_0x0de5('0x1e')]);return _0x544703(_0x92fe6d[_0x0de5('0x1d')][_0x0de5('0x1e')]);}logger['error'](_0x0de5('0x18'),_0x2dddc0,_0x92fe6d['error'][_0x0de5('0x1e')]);return _0x5eaad2(_0x92fe6d[_0x0de5('0x1d')][_0x0de5('0x1e')]);}else{logger['info'](_0x0de5('0x18'),_0x2dddc0,_0x0de5('0x1b'));_0x5eaad2(_0x92fe6d[_0x0de5('0x1f')][_0x0de5('0x1e')]);}})['catch'](function(_0x4645f7){logger['error'](_0x0de5('0x18'),_0x2dddc0,_0x4645f7);_0x544703(_0x4645f7);});});}function respondWithStatusCode(_0xf979a0,_0x3bf543){_0x3bf543=_0x3bf543||0xcc;return function(_0x2bacf4){if(_0x2bacf4){return _0xf979a0['sendStatus'](_0x3bf543);}return _0xf979a0['status'](_0x3bf543)[_0x0de5('0x20')]();};}function respondWithResult(_0x565f03,_0x378089){_0x378089=_0x378089||0xc8;return function(_0x4b9d30){if(_0x4b9d30){return _0x565f03[_0x0de5('0x21')](_0x378089)[_0x0de5('0x22')](_0x4b9d30);}};}function respondWithFilteredResult(_0x169cfc,_0x473e1c){return function(_0x3b8981){if(_0x3b8981){var _0x4a1eaa=typeof _0x473e1c[_0x0de5('0x23')]===_0x0de5('0x24')&&typeof _0x473e1c[_0x0de5('0x25')]===_0x0de5('0x24');var _0x46cb47=_0x3b8981[_0x0de5('0x26')];var _0x4c8444=_0x4a1eaa?0x0:_0x473e1c[_0x0de5('0x23')];var _0x4b52bb=_0x4a1eaa?_0x3b8981['count']:_0x473e1c[_0x0de5('0x23')]+_0x473e1c['limit'];var _0x5213a6;if(_0x4b52bb>=_0x46cb47){_0x4b52bb=_0x46cb47;_0x5213a6=0xc8;}else{_0x5213a6=0xce;}_0x169cfc[_0x0de5('0x21')](_0x5213a6);return _0x169cfc[_0x0de5('0x27')](_0x0de5('0x28'),_0x4c8444+'-'+_0x4b52bb+'/'+_0x46cb47)['json'](_0x3b8981);}return null;};}function patchUpdates(_0xbefe67){return function(_0x50a222){try{jsonpatch[_0x0de5('0x29')](_0x50a222,_0xbefe67,!![]);}catch(_0x2e9128){return BPromise[_0x0de5('0x2a')](_0x2e9128);}return _0x50a222[_0x0de5('0x2b')]();};}function saveUpdates(_0x4e460c,_0x5a4045){return function(_0x190da7){if(_0x190da7){return _0x190da7[_0x0de5('0x2c')](_0x4e460c)[_0x0de5('0x16')](function(_0x192dd6){return _0x192dd6;});}return null;};}function removeEntity(_0x431e7a,_0x55d210){return function(_0x3b7edb){if(_0x3b7edb){return _0x3b7edb[_0x0de5('0x2d')]()['then'](function(){_0x431e7a['status'](0xcc)[_0x0de5('0x20')]();});}};}function handleEntityNotFound(_0x115336,_0x3a8f77){return function(_0x43b8eb){if(!_0x43b8eb){_0x115336[_0x0de5('0x2e')](0x194);}return _0x43b8eb;};}function handleError(_0x29effb,_0x1441ce){_0x1441ce=_0x1441ce||0x1f4;return function(_0x53a9ee){logger[_0x0de5('0x1d')](_0x53a9ee[_0x0de5('0x2f')]);if(_0x53a9ee['name']){delete _0x53a9ee[_0x0de5('0x30')];}_0x29effb[_0x0de5('0x21')](_0x1441ce)[_0x0de5('0x31')](_0x53a9ee);};}exports[_0x0de5('0x32')]=function(_0x25b3ef,_0x7e038){var _0x411840={},_0x128bb8={},_0x570415={'count':0x0,'rows':[]};var _0x2e5739=_['map'](db[_0x0de5('0x33')]['rawAttributes'],function(_0x379312){return{'name':_0x379312[_0x0de5('0x34')],'type':_0x379312[_0x0de5('0x35')]['key']};});_0x128bb8[_0x0de5('0x36')]=_[_0x0de5('0x37')](_0x2e5739,_0x0de5('0x30'));_0x128bb8[_0x0de5('0x38')]=_[_0x0de5('0x39')](_0x25b3ef['query']);_0x128bb8[_0x0de5('0x3a')]=_['intersection'](_0x128bb8['model'],_0x128bb8['query']);_0x411840[_0x0de5('0x3b')]=_[_0x0de5('0x3c')](_0x128bb8[_0x0de5('0x36')],qs[_0x0de5('0x3d')](_0x25b3ef[_0x0de5('0x38')]['fields']));_0x411840['attributes']=_0x411840[_0x0de5('0x3b')][_0x0de5('0x3e')]?_0x411840[_0x0de5('0x3b')]:_0x128bb8[_0x0de5('0x36')];if(!_0x25b3ef[_0x0de5('0x38')]['hasOwnProperty'](_0x0de5('0x3f'))){_0x411840[_0x0de5('0x25')]=qs[_0x0de5('0x25')](_0x25b3ef[_0x0de5('0x38')][_0x0de5('0x25')]);_0x411840[_0x0de5('0x23')]=qs[_0x0de5('0x23')](_0x25b3ef[_0x0de5('0x38')][_0x0de5('0x23')]);}_0x411840[_0x0de5('0x40')]=qs[_0x0de5('0x41')](_0x25b3ef[_0x0de5('0x38')][_0x0de5('0x41')]);_0x411840['where']=qs[_0x0de5('0x3a')](_[_0x0de5('0x42')](_0x25b3ef[_0x0de5('0x38')],_0x128bb8['filters']),_0x2e5739);if(_0x25b3ef['query']['filter']){_0x411840[_0x0de5('0x43')]=_[_0x0de5('0x44')](_0x411840['where'],{'$or':_[_0x0de5('0x37')](_0x2e5739,function(_0x438fed){if(_0x438fed[_0x0de5('0x35')]!=='VIRTUAL'){var _0x370fe7={};_0x370fe7[_0x438fed[_0x0de5('0x30')]]={'$like':'%'+_0x25b3ef[_0x0de5('0x38')][_0x0de5('0x45')]+'%'};return _0x370fe7;}})});}_0x411840=_[_0x0de5('0x44')]({},_0x411840,_0x25b3ef[_0x0de5('0x46')]);var _0x1717e6={'where':_0x411840[_0x0de5('0x43')]};return db[_0x0de5('0x33')][_0x0de5('0x26')](_0x1717e6)[_0x0de5('0x16')](function(_0x154d2f){_0x570415[_0x0de5('0x26')]=_0x154d2f;if(_0x25b3ef[_0x0de5('0x38')][_0x0de5('0x47')]){_0x411840[_0x0de5('0x48')]=[{'all':!![]}];}return db[_0x0de5('0x33')][_0x0de5('0x49')](_0x411840);})[_0x0de5('0x16')](function(_0x552271){_0x570415['rows']=_0x552271;return _0x570415;})[_0x0de5('0x16')](respondWithFilteredResult(_0x7e038,_0x411840))[_0x0de5('0x4a')](handleError(_0x7e038,null));};exports['show']=function(_0x32a131,_0x5b1a16){var _0xc138c4={'raw':![],'where':{'id':_0x32a131[_0x0de5('0x4b')]['id']}},_0x4fbd4d={};_0x4fbd4d[_0x0de5('0x36')]=_['keys'](db[_0x0de5('0x33')]['rawAttributes']);_0x4fbd4d[_0x0de5('0x38')]=_[_0x0de5('0x39')](_0x32a131['query']);_0x4fbd4d[_0x0de5('0x3a')]=_['intersection'](_0x4fbd4d[_0x0de5('0x36')],_0x4fbd4d[_0x0de5('0x38')]);_0xc138c4[_0x0de5('0x3b')]=_[_0x0de5('0x3c')](_0x4fbd4d[_0x0de5('0x36')],qs[_0x0de5('0x3d')](_0x32a131['query']['fields']));_0xc138c4[_0x0de5('0x3b')]=_0xc138c4['attributes'][_0x0de5('0x3e')]?_0xc138c4[_0x0de5('0x3b')]:_0x4fbd4d[_0x0de5('0x36')];if(_0x32a131[_0x0de5('0x38')][_0x0de5('0x47')]){_0xc138c4['include']=[{'all':!![]}];}_0xc138c4=_[_0x0de5('0x44')]({},_0xc138c4,_0x32a131[_0x0de5('0x46')]);return db['Setting'][_0x0de5('0x4c')](_0xc138c4)['then'](handleEntityNotFound(_0x5b1a16,null))[_0x0de5('0x16')](respondWithResult(_0x5b1a16,null))[_0x0de5('0x4a')](handleError(_0x5b1a16,null));};exports[_0x0de5('0x2c')]=function(_0x515b79,_0x20fe4b){if(_0x515b79[_0x0de5('0x4d')]['id']){delete _0x515b79[_0x0de5('0x4d')]['id'];}return db['Setting'][_0x0de5('0x4c')]({'where':{'id':_0x515b79[_0x0de5('0x4b')]['id']}})[_0x0de5('0x16')](handleEntityNotFound(_0x20fe4b,null))[_0x0de5('0x16')](saveUpdates(_0x515b79[_0x0de5('0x4d')],null))[_0x0de5('0x16')](respondWithResult(_0x20fe4b,null))['catch'](handleError(_0x20fe4b,null));};exports[_0x0de5('0x4e')]=function(_0x2b9081,_0x146f1c,_0x1fec1d){if(_0x2b9081[_0x0de5('0x4f')]&&_0x2b9081[_0x0de5('0x4f')][_0x0de5('0x50')]){_0x2b9081[_0x0de5('0x4d')][_0x0de5('0x51')]=_0x2b9081[_0x0de5('0x4f')]['filename'];}return db['Setting'][_0x0de5('0x4c')]({'where':{'id':_0x2b9081[_0x0de5('0x4b')]['id']}})[_0x0de5('0x16')](handleEntityNotFound(_0x146f1c,null))[_0x0de5('0x16')](saveUpdates(_0x2b9081['body'],null))['then'](respondWithResult(_0x146f1c,null))['catch'](handleError(_0x146f1c,null));};exports[_0x0de5('0x52')]=function(_0x296fd4,_0x2d2362,_0x2b460d){if(_0x296fd4['file']&&_0x296fd4['file'][_0x0de5('0x50')]){_0x296fd4[_0x0de5('0x4d')][_0x0de5('0x53')]=_0x296fd4[_0x0de5('0x4f')][_0x0de5('0x50')];}return db[_0x0de5('0x33')][_0x0de5('0x4c')]({'where':{'id':_0x296fd4[_0x0de5('0x4b')]['id']}})[_0x0de5('0x16')](handleEntityNotFound(_0x2d2362,null))[_0x0de5('0x16')](saveUpdates(_0x296fd4[_0x0de5('0x4d')],null))[_0x0de5('0x16')](respondWithResult(_0x2d2362,null))[_0x0de5('0x4a')](handleError(_0x2d2362,null));};var utilLicense=require(_0x0de5('0x54'));exports[_0x0de5('0x55')]=function(_0x2b51b8,_0x372fc3,_0x4b76c3){var _0x485462='server/files/images/logos';var _0x3841ef={'custom':![]};return utilLicense[_0x0de5('0x56')]()[_0x0de5('0x16')](function(_0x2156b0){if(_0x2156b0){_0x3841ef=_0x2156b0;}return db[_0x0de5('0x33')]['find']({'where':{'id':_0x2b51b8[_0x0de5('0x4b')]['id']},'attributes':[_0x0de5('0x51'),_0x0de5('0x53'),_0x0de5('0x57'),_0x0de5('0x58'),_0x0de5('0x59'),'defaultLoginLogo',_0x0de5('0x5a'),_0x0de5('0x5b')],'raw':!![]});})[_0x0de5('0x16')](handleEntityNotFound(_0x372fc3,null))[_0x0de5('0x16')](function(_0x4e64bc){if(_0x4e64bc){var _0x5c1475=_0x4e64bc[_0x0de5('0x51')]&&fs['existsSync'](path['join'](config[_0x0de5('0x5c')],_0x485462,_[_0x0de5('0x5d')](_0x4e64bc[_0x0de5('0x51')])))?path['join'](config[_0x0de5('0x5c')],_0x485462,_['toLower'](_0x4e64bc['logo'])):path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x485462,_[_0x0de5('0x5d')](_0x0de5('0x5f')));var _0x5a6c2e=_0x0de5('0x60')+_[_0x0de5('0x61')]('logo');if(_0x4e64bc[_0x5a6c2e]||!_0x3841ef['custom']){_0x5c1475=path['join'](config['root'],_0x485462,_[_0x0de5('0x5d')](_0x0de5('0x5f')));}if(!fs[_0x0de5('0x62')](_0x5c1475)){throw new db[(_0x0de5('0x63'))]['ValidationError'](_[_0x0de5('0x61')](_0x0de5('0x51'))+_0x0de5('0x64'));}return _0x372fc3[_0x0de5('0x65')](_0x5c1475);}})[_0x0de5('0x4a')](handleError(_0x372fc3,null));};var utilLicense=require(_0x0de5('0x54'));exports[_0x0de5('0x66')]=function(_0x5ce826,_0x1f345e,_0x579ea5){var _0x3991ed='server/files/images/logos';var _0x2691e1={'custom':![]};return utilLicense['getLicense']()[_0x0de5('0x16')](function(_0x345907){if(_0x345907){_0x2691e1=_0x345907;}return db['Setting'][_0x0de5('0x4c')]({'where':{'id':_0x5ce826[_0x0de5('0x4b')]['id']},'attributes':[_0x0de5('0x51'),_0x0de5('0x53'),'preferred',_0x0de5('0x58'),_0x0de5('0x59'),'defaultLoginLogo',_0x0de5('0x5a'),_0x0de5('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x1f345e,null))['then'](function(_0x285df1){if(_0x285df1){var _0x2cee8b=_0x285df1['loginLogo']&&fs[_0x0de5('0x62')](path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x3991ed,_[_0x0de5('0x5d')](_0x285df1[_0x0de5('0x53')])))?path['join'](config['root'],_0x3991ed,_['toLower'](_0x285df1[_0x0de5('0x53')])):path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x3991ed,_[_0x0de5('0x5d')]('default_loginLogo.svg'));var _0x39dce6='default'+_[_0x0de5('0x61')](_0x0de5('0x53'));if(_0x285df1[_0x39dce6]||!_0x2691e1[_0x0de5('0x67')]){_0x2cee8b=path[_0x0de5('0x5e')](config['root'],_0x3991ed,_[_0x0de5('0x5d')](_0x0de5('0x68')));}if(!fs[_0x0de5('0x62')](_0x2cee8b)){throw new db['Sequelize'][(_0x0de5('0x69'))](_['upperFirst'](_0x0de5('0x53'))+_0x0de5('0x64'));}return _0x1f345e[_0x0de5('0x65')](_0x2cee8b);}})['catch'](handleError(_0x1f345e,null));};exports['gdpr']=function(_0x21e93c,_0x2d749a){return db['Setting'][_0x0de5('0x4c')]({'where':{'id':_0x21e93c[_0x0de5('0x4b')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x2d749a,null))[_0x0de5('0x4a')](handleError(_0x2d749a,null));};exports[_0x0de5('0x6a')]=function(_0x267aa6,_0x1f2d34,_0x323d77){if(_0x267aa6[_0x0de5('0x4f')]&&_0x267aa6['file'][_0x0de5('0x50')]){_0x267aa6[_0x0de5('0x4d')][_0x0de5('0x57')]=_0x267aa6[_0x0de5('0x4f')][_0x0de5('0x50')];}return db[_0x0de5('0x33')]['find']({'where':{'id':_0x267aa6[_0x0de5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f2d34,null))['then'](saveUpdates(_0x267aa6['body'],null))[_0x0de5('0x16')](respondWithResult(_0x1f2d34,null))['catch'](handleError(_0x1f2d34,null));};var utilLicense=require(_0x0de5('0x54'));exports[_0x0de5('0x6b')]=function(_0x2f2cb9,_0x513768,_0x253dfe){var _0x165955=_0x0de5('0x6c');var _0x2512a9={'custom':![]};return utilLicense[_0x0de5('0x56')]()[_0x0de5('0x16')](function(_0x181ba5){if(_0x181ba5){_0x2512a9=_0x181ba5;}return db[_0x0de5('0x33')][_0x0de5('0x4c')]({'where':{'id':_0x2f2cb9['params']['id']},'attributes':['logo','loginLogo','preferred',_0x0de5('0x58'),'defaultLogo',_0x0de5('0x6d'),'defaultPreferred',_0x0de5('0x5b')],'raw':!![]});})[_0x0de5('0x16')](handleEntityNotFound(_0x513768,null))['then'](function(_0x4aef4f){if(_0x4aef4f){var _0x23d4f4=_0x4aef4f[_0x0de5('0x57')]&&fs['existsSync'](path['join'](config[_0x0de5('0x5c')],_0x165955,_['toLower'](_0x4aef4f[_0x0de5('0x57')])))?path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x165955,_[_0x0de5('0x5d')](_0x4aef4f['preferred'])):path['join'](config['root'],_0x165955,_['toLower'](_0x0de5('0x6e')));var _0x595d50='default'+_[_0x0de5('0x61')](_0x0de5('0x57'));if(_0x4aef4f[_0x595d50]||!_0x2512a9[_0x0de5('0x67')]||!_0x2512a9['preferred']){_0x23d4f4=path['join'](config[_0x0de5('0x5c')],_0x165955,_[_0x0de5('0x5d')](_0x0de5('0x6e')));}if(!fs[_0x0de5('0x62')](_0x23d4f4)){throw new db[(_0x0de5('0x63'))]['ValidationError'](_['upperFirst'](_0x0de5('0x57'))+'\x20not\x20found');}return _0x513768[_0x0de5('0x65')](_0x23d4f4);}})[_0x0de5('0x4a')](handleError(_0x513768,null));};exports['addFavicon']=function(_0x5b1b1b,_0xb75e53,_0x5cd672){if(_0x5b1b1b['file']&&_0x5b1b1b[_0x0de5('0x4f')][_0x0de5('0x50')]){_0x5b1b1b[_0x0de5('0x4d')]['favicon']=_0x5b1b1b[_0x0de5('0x4f')][_0x0de5('0x50')];}return db[_0x0de5('0x33')][_0x0de5('0x4c')]({'where':{'id':_0x5b1b1b[_0x0de5('0x4b')]['id']}})[_0x0de5('0x16')](handleEntityNotFound(_0xb75e53,null))['then'](saveUpdates(_0x5b1b1b['body'],null))[_0x0de5('0x16')](respondWithResult(_0xb75e53,null))[_0x0de5('0x4a')](handleError(_0xb75e53,null));};var utilLicense=require(_0x0de5('0x54'));exports[_0x0de5('0x6f')]=function(_0x3a1e86,_0x2e4b11,_0x372423){var _0x2a5b35=_0x0de5('0x6c');var _0x2841ff={'custom':![]};return utilLicense[_0x0de5('0x56')]()[_0x0de5('0x16')](function(_0x26f802){if(_0x26f802){_0x2841ff=_0x26f802;}return db[_0x0de5('0x33')][_0x0de5('0x4c')]({'where':{'id':_0x3a1e86['params']['id']},'attributes':[_0x0de5('0x51'),_0x0de5('0x53'),_0x0de5('0x57'),_0x0de5('0x58'),_0x0de5('0x59'),_0x0de5('0x6d'),_0x0de5('0x5a'),_0x0de5('0x5b')],'raw':!![]});})[_0x0de5('0x16')](handleEntityNotFound(_0x2e4b11,null))[_0x0de5('0x16')](function(_0xa32547){if(_0xa32547){var _0x294b6b=_0xa32547[_0x0de5('0x58')]&&fs[_0x0de5('0x62')](path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x2a5b35,_[_0x0de5('0x5d')](_0xa32547[_0x0de5('0x58')])))?path['join'](config[_0x0de5('0x5c')],_0x2a5b35,_[_0x0de5('0x5d')](_0xa32547[_0x0de5('0x58')])):path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x2a5b35,_[_0x0de5('0x5d')](_0x0de5('0x70')));var _0x118cee=_0x0de5('0x60')+_['upperFirst'](_0x0de5('0x58'));if(_0xa32547[_0x118cee]||!_0x2841ff[_0x0de5('0x67')]){_0x294b6b=path[_0x0de5('0x5e')](config[_0x0de5('0x5c')],_0x2a5b35,_[_0x0de5('0x5d')]('default_favicon.ico'));}if(!fs[_0x0de5('0x62')](_0x294b6b)){throw new db['Sequelize'][(_0x0de5('0x69'))](_[_0x0de5('0x61')](_0x0de5('0x58'))+_0x0de5('0x64'));}return _0x2e4b11[_0x0de5('0x65')](_0x294b6b);}})[_0x0de5('0x4a')](handleError(_0x2e4b11,null));};exports[_0x0de5('0x71')]=function(_0x5ab7cd,_0x188391){var _0xd63a75={'offset':moment()[_0x0de5('0x72')]()};_0xd63a75['now']=moment()['utcOffset'](_0xd63a75[_0x0de5('0x23')])[_0x0de5('0x73')](_0x0de5('0x74'));return _0x188391[_0x0de5('0x21')](0xc8)[_0x0de5('0x31')](_0xd63a75);}; \ No newline at end of file +var _0xb620=['includeAll','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','custom','existsSync','Sequelize','ValidationError','download','preferred','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','default_preferred.png','\x20not\x20found','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','Setting','include','findAll','rows','catch','show','params'];(function(_0xd20b19,_0x467e87){var _0x99a02e=function(_0x2b9b43){while(--_0x2b9b43){_0xd20b19['push'](_0xd20b19['shift']());}};_0x99a02e(++_0x467e87);}(_0xb620,0x1a0));var _0x0b62=function(_0x2169bf,_0x44ab27){_0x2169bf=_0x2169bf-0x0;var _0x591b74=_0xb620[_0x2169bf];return _0x591b74;};'use strict';var emlformat=require(_0x0b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b62('0x1'));var jsonpatch=require(_0x0b62('0x2'));var rp=require('request-promise');var moment=require(_0x0b62('0x3'));var BPromise=require(_0x0b62('0x4'));var Mustache=require(_0x0b62('0x5'));var util=require(_0x0b62('0x6'));var path=require(_0x0b62('0x7'));var sox=require(_0x0b62('0x8'));var csv=require('to-csv');var ejs=require(_0x0b62('0x9'));var fs=require('fs');var fs_extra=require(_0x0b62('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b62('0xb'));var jsforce=require(_0x0b62('0xc'));var deskjs=require(_0x0b62('0xd'));var toCsv=require(_0x0b62('0xe'));var querystring=require(_0x0b62('0xf'));var Papa=require('papaparse');var Redis=require(_0x0b62('0x10'));var authService=require(_0x0b62('0x11'));var qs=require(_0x0b62('0x12'));var as=require(_0x0b62('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b62('0x14'))(_0x0b62('0x15'));var utils=require(_0x0b62('0x16'));var config=require(_0x0b62('0x17'));var licenseUtil=require(_0x0b62('0x18'));var db=require(_0x0b62('0x19'))['db'];var jayson=require(_0x0b62('0x1a'));var client=jayson[_0x0b62('0x1b')][_0x0b62('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3312ef,_0x5cd66d,_0x29b567,_0x25c09c){return new BPromise(function(_0x58181f,_0x9c20e5){var _0xf8f5df=_0x25c09c||client;return _0xf8f5df['request'](_0x3312ef,_0x29b567)['then'](function(_0x4a8df6){logger[_0x0b62('0x1d')](_0x0b62('0x1e'),_0x5cd66d,'request\x20sent');logger[_0x0b62('0x1f')](_0x0b62('0x20'),_0x5cd66d,'request\x20sent',JSON[_0x0b62('0x21')](_0x4a8df6));if(_0x4a8df6[_0x0b62('0x22')]){if(_0x4a8df6['error'][_0x0b62('0x23')]===0x1f4){logger[_0x0b62('0x22')]('Setting,\x20%s,\x20%s',_0x5cd66d,_0x4a8df6['error'][_0x0b62('0x24')]);return _0x9c20e5(_0x4a8df6[_0x0b62('0x22')]['message']);}logger[_0x0b62('0x22')]('Setting,\x20%s,\x20%s',_0x5cd66d,_0x4a8df6[_0x0b62('0x22')][_0x0b62('0x24')]);return _0x58181f(_0x4a8df6[_0x0b62('0x22')][_0x0b62('0x24')]);}else{logger['info'](_0x0b62('0x1e'),_0x5cd66d,_0x0b62('0x25'));_0x58181f(_0x4a8df6['result'][_0x0b62('0x24')]);}})['catch'](function(_0x4b75f6){logger[_0x0b62('0x22')](_0x0b62('0x1e'),_0x5cd66d,_0x4b75f6);_0x9c20e5(_0x4b75f6);});});}function respondWithStatusCode(_0x20940e,_0x2285ef){_0x2285ef=_0x2285ef||0xcc;return function(_0x45d0f7){if(_0x45d0f7){return _0x20940e[_0x0b62('0x26')](_0x2285ef);}return _0x20940e['status'](_0x2285ef)[_0x0b62('0x27')]();};}function respondWithResult(_0x279456,_0xe047cf){_0xe047cf=_0xe047cf||0xc8;return function(_0x389256){if(_0x389256){return _0x279456[_0x0b62('0x28')](_0xe047cf)[_0x0b62('0x29')](_0x389256);}};}function respondWithFilteredResult(_0x441ea6,_0x5d483d){return function(_0x280b78){if(_0x280b78){var _0x3f94cc=typeof _0x5d483d[_0x0b62('0x2a')]==='undefined'&&typeof _0x5d483d['limit']===_0x0b62('0x2b');var _0x20e43d=_0x280b78[_0x0b62('0x2c')];var _0x5f4820=_0x3f94cc?0x0:_0x5d483d[_0x0b62('0x2a')];var _0x2434c5=_0x3f94cc?_0x280b78[_0x0b62('0x2c')]:_0x5d483d[_0x0b62('0x2a')]+_0x5d483d['limit'];var _0x44bd5a;if(_0x2434c5>=_0x20e43d){_0x2434c5=_0x20e43d;_0x44bd5a=0xc8;}else{_0x44bd5a=0xce;}_0x441ea6[_0x0b62('0x28')](_0x44bd5a);return _0x441ea6['set'](_0x0b62('0x2d'),_0x5f4820+'-'+_0x2434c5+'/'+_0x20e43d)[_0x0b62('0x29')](_0x280b78);}return null;};}function patchUpdates(_0x2acf84){return function(_0x460b8e){try{jsonpatch[_0x0b62('0x2e')](_0x460b8e,_0x2acf84,!![]);}catch(_0x9e2b87){return BPromise[_0x0b62('0x2f')](_0x9e2b87);}return _0x460b8e[_0x0b62('0x30')]();};}function saveUpdates(_0x3d8435,_0x39dbf5){return function(_0x4958b3){if(_0x4958b3){return _0x4958b3[_0x0b62('0x31')](_0x3d8435)[_0x0b62('0x32')](function(_0x1ab358){return _0x1ab358;});}return null;};}function removeEntity(_0x5afbf6,_0x53d9c5){return function(_0x48876f){if(_0x48876f){return _0x48876f[_0x0b62('0x33')]()[_0x0b62('0x32')](function(){_0x5afbf6[_0x0b62('0x28')](0xcc)[_0x0b62('0x27')]();});}};}function handleEntityNotFound(_0x3d29c4,_0x39c480){return function(_0x32893b){if(!_0x32893b){_0x3d29c4[_0x0b62('0x26')](0x194);}return _0x32893b;};}function handleError(_0x22cedb,_0x33e732){_0x33e732=_0x33e732||0x1f4;return function(_0xef4a){logger['error'](_0xef4a[_0x0b62('0x34')]);if(_0xef4a[_0x0b62('0x35')]){delete _0xef4a[_0x0b62('0x35')];}_0x22cedb['status'](_0x33e732)[_0x0b62('0x36')](_0xef4a);};}exports[_0x0b62('0x37')]=function(_0x5270ef,_0xeaea0a){var _0x5cb4de={},_0x5aa3bf={},_0x187cd8={'count':0x0,'rows':[]};var _0x5d653b=_[_0x0b62('0x38')](db['Setting'][_0x0b62('0x39')],function(_0x217b16){return{'name':_0x217b16[_0x0b62('0x3a')],'type':_0x217b16[_0x0b62('0x3b')][_0x0b62('0x3c')]};});_0x5aa3bf[_0x0b62('0x3d')]=_['map'](_0x5d653b,_0x0b62('0x35'));_0x5aa3bf['query']=_[_0x0b62('0x3e')](_0x5270ef['query']);_0x5aa3bf[_0x0b62('0x3f')]=_[_0x0b62('0x40')](_0x5aa3bf[_0x0b62('0x3d')],_0x5aa3bf['query']);_0x5cb4de[_0x0b62('0x41')]=_[_0x0b62('0x40')](_0x5aa3bf[_0x0b62('0x3d')],qs[_0x0b62('0x42')](_0x5270ef[_0x0b62('0x43')][_0x0b62('0x42')]));_0x5cb4de[_0x0b62('0x41')]=_0x5cb4de['attributes']['length']?_0x5cb4de[_0x0b62('0x41')]:_0x5aa3bf[_0x0b62('0x3d')];if(!_0x5270ef[_0x0b62('0x43')][_0x0b62('0x44')](_0x0b62('0x45'))){_0x5cb4de[_0x0b62('0x46')]=qs['limit'](_0x5270ef[_0x0b62('0x43')][_0x0b62('0x46')]);_0x5cb4de['offset']=qs[_0x0b62('0x2a')](_0x5270ef[_0x0b62('0x43')][_0x0b62('0x2a')]);}_0x5cb4de['order']=qs[_0x0b62('0x47')](_0x5270ef[_0x0b62('0x43')][_0x0b62('0x47')]);_0x5cb4de[_0x0b62('0x48')]=qs[_0x0b62('0x3f')](_['pick'](_0x5270ef[_0x0b62('0x43')],_0x5aa3bf[_0x0b62('0x3f')]),_0x5d653b);if(_0x5270ef['query']['filter']){_0x5cb4de[_0x0b62('0x48')]=_[_0x0b62('0x49')](_0x5cb4de[_0x0b62('0x48')],{'$or':_[_0x0b62('0x38')](_0x5d653b,function(_0x3b6d4f){if(_0x3b6d4f[_0x0b62('0x3b')]!==_0x0b62('0x4a')){var _0x4c1b4c={};_0x4c1b4c[_0x3b6d4f[_0x0b62('0x35')]]={'$like':'%'+_0x5270ef[_0x0b62('0x43')][_0x0b62('0x4b')]+'%'};return _0x4c1b4c;}})});}_0x5cb4de=_[_0x0b62('0x49')]({},_0x5cb4de,_0x5270ef[_0x0b62('0x4c')]);var _0x1913e7={'where':_0x5cb4de['where']};return db[_0x0b62('0x4d')][_0x0b62('0x2c')](_0x1913e7)[_0x0b62('0x32')](function(_0x30097c){_0x187cd8[_0x0b62('0x2c')]=_0x30097c;if(_0x5270ef[_0x0b62('0x43')]['includeAll']){_0x5cb4de[_0x0b62('0x4e')]=[{'all':!![]}];}return db[_0x0b62('0x4d')][_0x0b62('0x4f')](_0x5cb4de);})[_0x0b62('0x32')](function(_0x3a54b5){_0x187cd8[_0x0b62('0x50')]=_0x3a54b5;return _0x187cd8;})[_0x0b62('0x32')](respondWithFilteredResult(_0xeaea0a,_0x5cb4de))[_0x0b62('0x51')](handleError(_0xeaea0a,null));};exports[_0x0b62('0x52')]=function(_0x48c193,_0x42c579){var _0x1d1198={'raw':![],'where':{'id':_0x48c193[_0x0b62('0x53')]['id']}},_0x34ff51={};_0x34ff51[_0x0b62('0x3d')]=_['keys'](db[_0x0b62('0x4d')][_0x0b62('0x39')]);_0x34ff51[_0x0b62('0x43')]=_['keys'](_0x48c193['query']);_0x34ff51[_0x0b62('0x3f')]=_['intersection'](_0x34ff51[_0x0b62('0x3d')],_0x34ff51[_0x0b62('0x43')]);_0x1d1198[_0x0b62('0x41')]=_[_0x0b62('0x40')](_0x34ff51[_0x0b62('0x3d')],qs[_0x0b62('0x42')](_0x48c193['query'][_0x0b62('0x42')]));_0x1d1198[_0x0b62('0x41')]=_0x1d1198['attributes']['length']?_0x1d1198[_0x0b62('0x41')]:_0x34ff51[_0x0b62('0x3d')];if(_0x48c193[_0x0b62('0x43')][_0x0b62('0x54')]){_0x1d1198[_0x0b62('0x4e')]=[{'all':!![]}];}_0x1d1198=_[_0x0b62('0x49')]({},_0x1d1198,_0x48c193[_0x0b62('0x4c')]);return db[_0x0b62('0x4d')][_0x0b62('0x55')](_0x1d1198)[_0x0b62('0x32')](handleEntityNotFound(_0x42c579,null))[_0x0b62('0x32')](respondWithResult(_0x42c579,null))[_0x0b62('0x51')](handleError(_0x42c579,null));};exports[_0x0b62('0x31')]=function(_0x339d81,_0x2e3cf5){if(_0x339d81['body']['id']){delete _0x339d81[_0x0b62('0x56')]['id'];}return db['Setting'][_0x0b62('0x55')]({'where':{'id':_0x339d81[_0x0b62('0x53')]['id']}})[_0x0b62('0x32')](handleEntityNotFound(_0x2e3cf5,null))[_0x0b62('0x32')](saveUpdates(_0x339d81['body'],null))[_0x0b62('0x32')](respondWithResult(_0x2e3cf5,null))['catch'](handleError(_0x2e3cf5,null));};exports[_0x0b62('0x57')]=function(_0x141165,_0x4c1ec8,_0x1f1166){if(_0x141165[_0x0b62('0x58')]&&_0x141165[_0x0b62('0x58')][_0x0b62('0x59')]){_0x141165['body']['logo']=_0x141165[_0x0b62('0x58')]['filename'];}return db['Setting']['find']({'where':{'id':_0x141165[_0x0b62('0x53')]['id']}})[_0x0b62('0x32')](handleEntityNotFound(_0x4c1ec8,null))[_0x0b62('0x32')](saveUpdates(_0x141165[_0x0b62('0x56')],null))['then'](respondWithResult(_0x4c1ec8,null))[_0x0b62('0x51')](handleError(_0x4c1ec8,null));};exports[_0x0b62('0x5a')]=function(_0x290c61,_0x5320fd,_0x35d6bf){if(_0x290c61['file']&&_0x290c61[_0x0b62('0x58')][_0x0b62('0x59')]){_0x290c61['body'][_0x0b62('0x5b')]=_0x290c61[_0x0b62('0x58')][_0x0b62('0x59')];}return db[_0x0b62('0x4d')][_0x0b62('0x55')]({'where':{'id':_0x290c61['params']['id']}})[_0x0b62('0x32')](handleEntityNotFound(_0x5320fd,null))[_0x0b62('0x32')](saveUpdates(_0x290c61[_0x0b62('0x56')],null))[_0x0b62('0x32')](respondWithResult(_0x5320fd,null))[_0x0b62('0x51')](handleError(_0x5320fd,null));};var utilLicense=require('../../config/license/util');exports[_0x0b62('0x5c')]=function(_0x45802e,_0x32e064,_0x9d8960){var _0x39ccf5='server/files/images/logos';var _0x3b2db5={'custom':![]};return utilLicense[_0x0b62('0x5d')]()[_0x0b62('0x32')](function(_0x17ff6f){if(_0x17ff6f){_0x3b2db5=_0x17ff6f;}return db[_0x0b62('0x4d')][_0x0b62('0x55')]({'where':{'id':_0x45802e[_0x0b62('0x53')]['id']},'attributes':[_0x0b62('0x5e'),_0x0b62('0x5b'),'preferred',_0x0b62('0x5f'),_0x0b62('0x60'),'defaultLoginLogo',_0x0b62('0x61'),_0x0b62('0x62')],'raw':!![]});})[_0x0b62('0x32')](handleEntityNotFound(_0x32e064,null))['then'](function(_0x170973){if(_0x170973){var _0x1d0124=_0x170973[_0x0b62('0x5e')]&&fs['existsSync'](path[_0x0b62('0x63')](config['root'],_0x39ccf5,_['toLower'](_0x170973[_0x0b62('0x5e')])))?path['join'](config[_0x0b62('0x64')],_0x39ccf5,_[_0x0b62('0x65')](_0x170973['logo'])):path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x39ccf5,_['toLower']('default_logo.svg'));var _0x4c1a7a=_0x0b62('0x66')+_[_0x0b62('0x67')](_0x0b62('0x5e'));if(_0x170973[_0x4c1a7a]||!_0x3b2db5[_0x0b62('0x68')]){_0x1d0124=path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x39ccf5,_['toLower']('default_logo.svg'));}if(!fs[_0x0b62('0x69')](_0x1d0124)){throw new db[(_0x0b62('0x6a'))][(_0x0b62('0x6b'))](_[_0x0b62('0x67')]('logo')+'\x20not\x20found');}return _0x32e064[_0x0b62('0x6c')](_0x1d0124);}})[_0x0b62('0x51')](handleError(_0x32e064,null));};var utilLicense=require(_0x0b62('0x18'));exports['getLogoLogin']=function(_0x14fd59,_0x25fd60,_0x5ab29f){var _0x144780='server/files/images/logos';var _0x5adb39={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5c56d2){if(_0x5c56d2){_0x5adb39=_0x5c56d2;}return db[_0x0b62('0x4d')][_0x0b62('0x55')]({'where':{'id':_0x14fd59[_0x0b62('0x53')]['id']},'attributes':[_0x0b62('0x5e'),_0x0b62('0x5b'),_0x0b62('0x6d'),_0x0b62('0x5f'),_0x0b62('0x60'),_0x0b62('0x6e'),_0x0b62('0x61'),_0x0b62('0x62')],'raw':!![]});})[_0x0b62('0x32')](handleEntityNotFound(_0x25fd60,null))[_0x0b62('0x32')](function(_0x215bef){if(_0x215bef){var _0x366fb1=_0x215bef[_0x0b62('0x5b')]&&fs[_0x0b62('0x69')](path['join'](config[_0x0b62('0x64')],_0x144780,_['toLower'](_0x215bef[_0x0b62('0x5b')])))?path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x144780,_[_0x0b62('0x65')](_0x215bef[_0x0b62('0x5b')])):path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x144780,_[_0x0b62('0x65')](_0x0b62('0x6f')));var _0x5ed899=_0x0b62('0x66')+_[_0x0b62('0x67')]('loginLogo');if(_0x215bef[_0x5ed899]||!_0x5adb39[_0x0b62('0x68')]){_0x366fb1=path[_0x0b62('0x63')](config['root'],_0x144780,_[_0x0b62('0x65')](_0x0b62('0x6f')));}if(!fs[_0x0b62('0x69')](_0x366fb1)){throw new db['Sequelize'][(_0x0b62('0x6b'))](_[_0x0b62('0x67')](_0x0b62('0x5b'))+'\x20not\x20found');}return _0x25fd60[_0x0b62('0x6c')](_0x366fb1);}})[_0x0b62('0x51')](handleError(_0x25fd60,null));};exports[_0x0b62('0x70')]=function(_0x3c6e1a,_0x576e91){return db[_0x0b62('0x4d')]['find']({'where':{'id':_0x3c6e1a['params']['id']},'attributes':[_0x0b62('0x71')]})[_0x0b62('0x32')](respondWithResult(_0x576e91,null))[_0x0b62('0x51')](handleError(_0x576e91,null));};exports[_0x0b62('0x72')]=function(_0x5268ac,_0x571730,_0x37f83a){if(_0x5268ac[_0x0b62('0x58')]&&_0x5268ac[_0x0b62('0x58')][_0x0b62('0x59')]){_0x5268ac[_0x0b62('0x56')][_0x0b62('0x6d')]=_0x5268ac[_0x0b62('0x58')][_0x0b62('0x59')];}return db[_0x0b62('0x4d')]['find']({'where':{'id':_0x5268ac['params']['id']}})['then'](handleEntityNotFound(_0x571730,null))['then'](saveUpdates(_0x5268ac[_0x0b62('0x56')],null))[_0x0b62('0x32')](respondWithResult(_0x571730,null))['catch'](handleError(_0x571730,null));};var utilLicense=require(_0x0b62('0x18'));exports[_0x0b62('0x73')]=function(_0x258620,_0x1166c8,_0x1699d0){var _0xc833d1=_0x0b62('0x74');var _0x1d6582={'custom':![]};return utilLicense[_0x0b62('0x5d')]()[_0x0b62('0x32')](function(_0x5da4ef){if(_0x5da4ef){_0x1d6582=_0x5da4ef;}return db['Setting'][_0x0b62('0x55')]({'where':{'id':_0x258620[_0x0b62('0x53')]['id']},'attributes':['logo',_0x0b62('0x5b'),_0x0b62('0x6d'),_0x0b62('0x5f'),_0x0b62('0x60'),_0x0b62('0x6e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0b62('0x32')](handleEntityNotFound(_0x1166c8,null))[_0x0b62('0x32')](function(_0x5586a1){if(_0x5586a1){var _0x5afaad=_0x5586a1['preferred']&&fs[_0x0b62('0x69')](path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0xc833d1,_['toLower'](_0x5586a1[_0x0b62('0x6d')])))?path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0xc833d1,_['toLower'](_0x5586a1[_0x0b62('0x6d')])):path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0xc833d1,_[_0x0b62('0x65')](_0x0b62('0x75')));var _0x10f959='default'+_['upperFirst'](_0x0b62('0x6d'));if(_0x5586a1[_0x10f959]||!_0x1d6582[_0x0b62('0x68')]||!_0x1d6582['preferred']){_0x5afaad=path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0xc833d1,_['toLower']('default_preferred.png'));}if(!fs[_0x0b62('0x69')](_0x5afaad)){throw new db[(_0x0b62('0x6a'))]['ValidationError'](_[_0x0b62('0x67')](_0x0b62('0x6d'))+_0x0b62('0x76'));}return _0x1166c8[_0x0b62('0x6c')](_0x5afaad);}})[_0x0b62('0x51')](handleError(_0x1166c8,null));};exports['addFavicon']=function(_0x32ba68,_0x19132c,_0x4be992){if(_0x32ba68[_0x0b62('0x58')]&&_0x32ba68[_0x0b62('0x58')][_0x0b62('0x59')]){_0x32ba68[_0x0b62('0x56')][_0x0b62('0x5f')]=_0x32ba68['file'][_0x0b62('0x59')];}return db[_0x0b62('0x4d')][_0x0b62('0x55')]({'where':{'id':_0x32ba68[_0x0b62('0x53')]['id']}})[_0x0b62('0x32')](handleEntityNotFound(_0x19132c,null))[_0x0b62('0x32')](saveUpdates(_0x32ba68[_0x0b62('0x56')],null))[_0x0b62('0x32')](respondWithResult(_0x19132c,null))[_0x0b62('0x51')](handleError(_0x19132c,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2feb4a,_0x43425b,_0x39a833){var _0x39c083='server/files/images/logos';var _0x35157c={'custom':![]};return utilLicense['getLicense']()[_0x0b62('0x32')](function(_0x117d86){if(_0x117d86){_0x35157c=_0x117d86;}return db[_0x0b62('0x4d')][_0x0b62('0x55')]({'where':{'id':_0x2feb4a[_0x0b62('0x53')]['id']},'attributes':[_0x0b62('0x5e'),_0x0b62('0x5b'),_0x0b62('0x6d'),'favicon',_0x0b62('0x60'),_0x0b62('0x6e'),_0x0b62('0x61'),_0x0b62('0x62')],'raw':!![]});})[_0x0b62('0x32')](handleEntityNotFound(_0x43425b,null))[_0x0b62('0x32')](function(_0x9f57ae){if(_0x9f57ae){var _0x21cc40=_0x9f57ae[_0x0b62('0x5f')]&&fs[_0x0b62('0x69')](path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x39c083,_[_0x0b62('0x65')](_0x9f57ae['favicon'])))?path['join'](config[_0x0b62('0x64')],_0x39c083,_[_0x0b62('0x65')](_0x9f57ae[_0x0b62('0x5f')])):path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x39c083,_[_0x0b62('0x65')](_0x0b62('0x77')));var _0x375337=_0x0b62('0x66')+_[_0x0b62('0x67')](_0x0b62('0x5f'));if(_0x9f57ae[_0x375337]||!_0x35157c[_0x0b62('0x68')]){_0x21cc40=path[_0x0b62('0x63')](config[_0x0b62('0x64')],_0x39c083,_[_0x0b62('0x65')]('default_favicon.ico'));}if(!fs[_0x0b62('0x69')](_0x21cc40)){throw new db[(_0x0b62('0x6a'))][(_0x0b62('0x6b'))](_[_0x0b62('0x67')](_0x0b62('0x5f'))+_0x0b62('0x76'));}return _0x43425b['download'](_0x21cc40);}})[_0x0b62('0x51')](handleError(_0x43425b,null));};exports[_0x0b62('0x78')]=function(_0x75d38f,_0x46413d){var _0x171ff3={'offset':moment()[_0x0b62('0x79')]()};_0x171ff3[_0x0b62('0x7a')]=moment()[_0x0b62('0x79')](_0x171ff3[_0x0b62('0x2a')])[_0x0b62('0x7b')](_0x0b62('0x7c'));return _0x46413d[_0x0b62('0x28')](0xc8)['send'](_0x171ff3);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f80290c..2b32686 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x45cb89,_0x99520e){var _0x5948c1=function(_0x4c81c3){while(--_0x4c81c3){_0x45cb89['push'](_0x45cb89['shift']());}};_0x5948c1(++_0x99520e);}(_0x3e74,0x175));var _0x43e7=function(_0x3e73a2,_0xdb8d30){_0x3e73a2=_0x3e73a2-0x0;var _0x22919a=_0x3e74[_0x3e73a2];return _0x22919a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4c4bf4,_0xc59962){var _0x2218ea=function(_0x30436a){while(--_0x30436a){_0x4c4bf4['push'](_0x4c4bf4['shift']());}};_0x2218ea(++_0xc59962);}(_0xedd9,0xfc));var _0x9edd=function(_0x55ad61,_0x1dc045){_0x55ad61=_0x55ad61-0x0;var _0x437a13=_0xedd9[_0x55ad61];return _0x437a13;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3eb5704..96a211c 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 _0x23ae=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Setting','find','options','raw','where','attributes','include','map','model','ShowSetting','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3884a2,_0x1d0292){var _0x35567e=function(_0x3d5416){while(--_0x3d5416){_0x3884a2['push'](_0x3884a2['shift']());}};_0x35567e(++_0x1d0292);}(_0x23ae,0x172));var _0xe23a=function(_0x97db75,_0x3abdb8){_0x97db75=_0x97db75-0x0;var _0x259a53=_0x23ae[_0x97db75];return _0x259a53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe23a('0x0'));var BPromise=require('bluebird');var rs=require(_0xe23a('0x1'));var fs=require('fs');var Redis=require(_0xe23a('0x2'));var db=require(_0xe23a('0x3'))['db'];var utils=require(_0xe23a('0x4'));var logger=require(_0xe23a('0x5'))(_0xe23a('0x6'));var config=require(_0xe23a('0x7'));var jayson=require(_0xe23a('0x8'));var client=jayson[_0xe23a('0x9')][_0xe23a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e9966,_0x9426a8,_0x103b01){return new BPromise(function(_0xe390bb,_0x580723){return client[_0xe23a('0xb')](_0x5e9966,_0x103b01)[_0xe23a('0xc')](function(_0x37d313){logger[_0xe23a('0xd')](_0xe23a('0xe'),_0x9426a8,'request\x20sent');logger[_0xe23a('0xf')](_0xe23a('0x10'),_0x9426a8,_0xe23a('0x11'),JSON[_0xe23a('0x12')](_0x37d313));if(_0x37d313[_0xe23a('0x13')]){if(_0x37d313[_0xe23a('0x13')][_0xe23a('0x14')]===0x1f4){logger['error'](_0xe23a('0xe'),_0x9426a8,_0x37d313[_0xe23a('0x13')][_0xe23a('0x15')]);return _0x580723(_0x37d313[_0xe23a('0x13')][_0xe23a('0x15')]);}logger['error'](_0xe23a('0xe'),_0x9426a8,_0x37d313[_0xe23a('0x13')][_0xe23a('0x15')]);return _0xe390bb(_0x37d313[_0xe23a('0x13')]['message']);}else{logger[_0xe23a('0xd')](_0xe23a('0xe'),_0x9426a8,'request\x20sent');_0xe390bb(_0x37d313[_0xe23a('0x16')][_0xe23a('0x15')]);}})[_0xe23a('0x17')](function(_0x2f36a0){logger[_0xe23a('0x13')]('Setting,\x20%s,\x20%s',_0x9426a8,_0x2f36a0);_0x580723(_0x2f36a0);});});}exports['ShowSetting']=function(_0x2fe0d7){var _0x239747=this;return new Promise(function(_0x3c05db,_0x1271f6){return db[_0xe23a('0x18')][_0xe23a('0x19')]({'raw':_0x2fe0d7[_0xe23a('0x1a')]?_0x2fe0d7[_0xe23a('0x1a')][_0xe23a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fe0d7[_0xe23a('0x1a')]?_0x2fe0d7[_0xe23a('0x1a')][_0xe23a('0x1c')]||null:null,'attributes':_0x2fe0d7[_0xe23a('0x1a')]?_0x2fe0d7[_0xe23a('0x1a')][_0xe23a('0x1d')]||null:null,'include':_0x2fe0d7[_0xe23a('0x1a')]?_0x2fe0d7[_0xe23a('0x1a')][_0xe23a('0x1e')]?_[_0xe23a('0x1f')](_0x2fe0d7[_0xe23a('0x1a')][_0xe23a('0x1e')],function(_0x1bfd16){return{'model':db[_0x1bfd16[_0xe23a('0x20')]],'as':_0x1bfd16['as'],'attributes':_0x1bfd16['attributes'],'include':_0x1bfd16[_0xe23a('0x1e')]?_[_0xe23a('0x1f')](_0x1bfd16['include'],function(_0x1d6932){return{'model':db[_0x1d6932[_0xe23a('0x20')]],'as':_0x1d6932['as'],'attributes':_0x1d6932[_0xe23a('0x1d')],'include':_0x1d6932[_0xe23a('0x1e')]?_[_0xe23a('0x1f')](_0x1d6932['include'],function(_0x16676f){return{'model':db[_0x16676f[_0xe23a('0x20')]],'as':_0x16676f['as'],'attributes':_0x16676f[_0xe23a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2129b9){logger[_0xe23a('0xd')](_0xe23a('0x21'),_0x2fe0d7);logger[_0xe23a('0xf')](_0xe23a('0x21'),_0x2fe0d7,JSON[_0xe23a('0x12')](_0x2129b9));_0x3c05db(_0x2129b9);})['catch'](function(_0xe3ae10){logger['error']('ShowSetting',_0xe3ae10[_0xe23a('0x15')],_0x2fe0d7);_0x1271f6(_0x239747[_0xe23a('0x13')](0x1f4,_0xe3ae10[_0xe23a('0x15')]));});});}; \ No newline at end of file +var _0xedd9=['client','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','Setting','find','options','raw','include','model','map','attributes','ShowSetting','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xdbc0da,_0x376234){var _0x54157f=function(_0x533506){while(--_0x533506){_0xdbc0da['push'](_0xdbc0da['shift']());}};_0x54157f(++_0x376234);}(_0xedd9,0x170));var _0x9edd=function(_0x14e3c4,_0x1036d4){_0x14e3c4=_0x14e3c4-0x0;var _0x3c90f6=_0xedd9[_0x14e3c4];return _0x3c90f6;};'use strict';var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9edd('0x2'));var fs=require('fs');var Redis=require(_0x9edd('0x3'));var db=require(_0x9edd('0x4'))['db'];var utils=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))('rpc');var config=require(_0x9edd('0x7'));var jayson=require(_0x9edd('0x8'));var client=jayson[_0x9edd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5df212,_0x54e3dc,_0x42ce77){return new BPromise(function(_0x2793e9,_0x586904){return client[_0x9edd('0xa')](_0x5df212,_0x42ce77)[_0x9edd('0xb')](function(_0x2060e8){logger[_0x9edd('0xc')](_0x9edd('0xd'),_0x54e3dc,'request\x20sent');logger[_0x9edd('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x54e3dc,_0x9edd('0xf'),JSON[_0x9edd('0x10')](_0x2060e8));if(_0x2060e8[_0x9edd('0x11')]){if(_0x2060e8[_0x9edd('0x11')]['code']===0x1f4){logger[_0x9edd('0x11')](_0x9edd('0xd'),_0x54e3dc,_0x2060e8[_0x9edd('0x11')][_0x9edd('0x12')]);return _0x586904(_0x2060e8[_0x9edd('0x11')]['message']);}logger[_0x9edd('0x11')](_0x9edd('0xd'),_0x54e3dc,_0x2060e8[_0x9edd('0x11')][_0x9edd('0x12')]);return _0x2793e9(_0x2060e8[_0x9edd('0x11')][_0x9edd('0x12')]);}else{logger['info'](_0x9edd('0xd'),_0x54e3dc,_0x9edd('0xf'));_0x2793e9(_0x2060e8[_0x9edd('0x13')][_0x9edd('0x12')]);}})['catch'](function(_0x34da53){logger[_0x9edd('0x11')](_0x9edd('0xd'),_0x54e3dc,_0x34da53);_0x586904(_0x34da53);});});}exports['ShowSetting']=function(_0xa3e307){var _0x46a117=this;return new Promise(function(_0x1c3b4f,_0x508ea4){return db[_0x9edd('0x14')][_0x9edd('0x15')]({'raw':_0xa3e307[_0x9edd('0x16')]?_0xa3e307['options'][_0x9edd('0x17')]===undefined?!![]:![]:!![],'where':_0xa3e307['options']?_0xa3e307[_0x9edd('0x16')]['where']||null:null,'attributes':_0xa3e307[_0x9edd('0x16')]?_0xa3e307[_0x9edd('0x16')]['attributes']||null:null,'include':_0xa3e307[_0x9edd('0x16')]?_0xa3e307[_0x9edd('0x16')][_0x9edd('0x18')]?_['map'](_0xa3e307[_0x9edd('0x16')][_0x9edd('0x18')],function(_0x208330){return{'model':db[_0x208330[_0x9edd('0x19')]],'as':_0x208330['as'],'attributes':_0x208330['attributes'],'include':_0x208330['include']?_[_0x9edd('0x1a')](_0x208330[_0x9edd('0x18')],function(_0x11d173){return{'model':db[_0x11d173[_0x9edd('0x19')]],'as':_0x11d173['as'],'attributes':_0x11d173['attributes'],'include':_0x11d173[_0x9edd('0x18')]?_[_0x9edd('0x1a')](_0x11d173[_0x9edd('0x18')],function(_0x2e96b5){return{'model':db[_0x2e96b5[_0x9edd('0x19')]],'as':_0x2e96b5['as'],'attributes':_0x2e96b5[_0x9edd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9edd('0xb')](function(_0xd54645){logger[_0x9edd('0xc')](_0x9edd('0x1c'),_0xa3e307);logger[_0x9edd('0xe')](_0x9edd('0x1c'),_0xa3e307,JSON['stringify'](_0xd54645));_0x1c3b4f(_0xd54645);})['catch'](function(_0x412421){logger['error'](_0x9edd('0x1c'),_0x412421[_0x9edd('0x12')],_0xa3e307);_0x508ea4(_0x46a117[_0x9edd('0x11')](0x1f4,_0x412421[_0x9edd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e72dc11..71e5172 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7217,0x19e));var _0x7721=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7217[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x67bb05,_0x20c289){var _0x2a80c9=function(_0x3dc7d9){while(--_0x3dc7d9){_0x67bb05['push'](_0x67bb05['shift']());}};_0x2a80c9(++_0x20c289);}(_0xabce,0x103));var _0xeabc=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xabce[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 5b6c9b2..993b91e 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 _0x9524=['sequelize','exports','STRING','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x9524,0x1c8));var _0x4952=function(_0x19b3b5,_0x4756ff){_0x19b3b5=_0x19b3b5-0x0;var _0x5693fa=_0x9524[_0x19b3b5];return _0x5693fa;};'use strict';var Sequelize=require(_0x4952('0x0'));var rs=require('randomstring');module[_0x4952('0x1')]={'name':{'type':Sequelize[_0x4952('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4952('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4952('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4952('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4952('0x2')]},'type':{'type':Sequelize['ENUM']('twilio','skebby',_0x4952('0x3'),_0x4952('0x4'),_0x4952('0x5'),_0x4952('0x6'),_0x4952('0x7'),_0x4952('0x8'),_0x4952('0x9'),_0x4952('0xa'))},'accountSid':{'type':Sequelize[_0x4952('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4952('0x2')]},'smsMethod':{'type':Sequelize[_0x4952('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x4952('0x2')]},'applicationId':{'type':Sequelize[_0x4952('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x4952('0x2')]},'deliveryReport':{'type':Sequelize[_0x4952('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x4952('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4952('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4952('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4952('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4952('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4952('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4952('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4952('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4952('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4952('0xe')],'comment':_0x4952('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4952('0x10'),'set':function(_0x92a3c5){if(!_0x92a3c5)this['setDataValue'](_0x4952('0x11'),null);this['setDataValue'](_0x4952('0x12'),_0x92a3c5);}}}; \ No newline at end of file +var _0x77dd=['sequelize','randomstring','STRING','twilio','skebby','connectel','plivo','csc','infobip','ENUM','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x15d8f6,_0x558054){var _0x5867a8=function(_0x315b9a){while(--_0x315b9a){_0x15d8f6['push'](_0x15d8f6['shift']());}};_0x5867a8(++_0x558054);}(_0x77dd,0x186));var _0xd77d=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x77dd[_0x587fb5];return _0x551105;};'use strict';var Sequelize=require(_0xd77d('0x0'));var rs=require(_0xd77d('0x1'));module['exports']={'name':{'type':Sequelize[_0xd77d('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd77d('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd77d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd77d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xd77d('0x3'),_0xd77d('0x4'),_0xd77d('0x5'),'clicksend',_0xd77d('0x6'),'clickatell','bandwidth',_0xd77d('0x7'),_0xd77d('0x8'),'intelepeer')},'accountSid':{'type':Sequelize[_0xd77d('0x2')]},'authId':{'type':Sequelize[_0xd77d('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xd77d('0x9')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd77d('0x2')]},'password':{'type':Sequelize[_0xd77d('0x2')]},'apiKey':{'type':Sequelize[_0xd77d('0x2')]},'applicationId':{'type':Sequelize[_0xd77d('0x2')]},'accountId':{'type':Sequelize[_0xd77d('0x2')]},'senderString':{'type':Sequelize[_0xd77d('0x2')]},'deliveryReport':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0xd77d('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd77d('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd77d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd77d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd77d('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd77d('0xa')],'defaultValue':![],'comment':_0xd77d('0xd'),'set':function(_0x39e2ea){if(!_0x39e2ea)this['setDataValue'](_0xd77d('0xe'),null);this['setDataValue']('mandatoryDisposition',_0x39e2ea);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4301e4b..fa0a4dc 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 _0xe341=['ListId','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','userSmsAccount:save','removeAgents','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','SmsAccounts','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','sender','text','connectel','clicksend','message_id','Text','messageId','MessageUUID','infobip','results','clickatell','fromNumber','bandwidth','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0xe341,0x13a));var _0x1e34=function(_0x2cb619,_0x2349e8){_0x2cb619=_0x2cb619-0x0;var _0x15d973=_0xe341[_0x2cb619];return _0x15d973;};'use strict';var emlformat=require(_0x1e34('0x0'));var rimraf=require(_0x1e34('0x1'));var zipdir=require(_0x1e34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e34('0x3'));var BPromise=require(_0x1e34('0x4'));var Mustache=require('mustache');var util=require(_0x1e34('0x5'));var path=require(_0x1e34('0x6'));var sox=require(_0x1e34('0x7'));var csv=require(_0x1e34('0x8'));var ejs=require(_0x1e34('0x9'));var fs=require('fs');var fs_extra=require(_0x1e34('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e34('0xb'));var jsforce=require(_0x1e34('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e34('0x8'));var querystring=require(_0x1e34('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e34('0xe'));var authService=require(_0x1e34('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1e34('0x10'));var hardwareService=require(_0x1e34('0x11'));var logger=require(_0x1e34('0x12'))(_0x1e34('0x13'));var utils=require(_0x1e34('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e34('0x15'));var db=require(_0x1e34('0x16'))['db'];config[_0x1e34('0x17')]=_[_0x1e34('0x18')](config['redis'],{'host':_0x1e34('0x19'),'port':0x18eb});var socket=require(_0x1e34('0x1a'))(new Redis(config['redis']));require(_0x1e34('0x1b'))[_0x1e34('0x1c')](socket);var jayson=require(_0x1e34('0x1d'));var client=jayson[_0x1e34('0x1e')][_0x1e34('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x725a43,_0x3e5ddb,_0xae88fb,_0x34f8af){return new BPromise(function(_0x43f694,_0x24cc1f){var _0x38c8d0=_0x34f8af||client;return _0x38c8d0[_0x1e34('0x20')](_0x725a43,_0xae88fb)['then'](function(_0x36d212){logger['info'](_0x1e34('0x21'),_0x3e5ddb,'request\x20sent');logger['debug'](_0x1e34('0x22'),_0x3e5ddb,_0x1e34('0x23'),JSON['stringify'](_0x36d212));if(_0x36d212['error']){if(_0x36d212['error'][_0x1e34('0x24')]===0x1f4){logger[_0x1e34('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3e5ddb,_0x36d212['error']['message']);return _0x24cc1f(_0x36d212[_0x1e34('0x25')][_0x1e34('0x26')]);}logger[_0x1e34('0x25')](_0x1e34('0x21'),_0x3e5ddb,_0x36d212[_0x1e34('0x25')][_0x1e34('0x26')]);return _0x43f694(_0x36d212['error'][_0x1e34('0x26')]);}else{logger[_0x1e34('0x27')](_0x1e34('0x21'),_0x3e5ddb,_0x1e34('0x23'));_0x43f694(_0x36d212[_0x1e34('0x28')][_0x1e34('0x26')]);}})['catch'](function(_0x556fed){logger[_0x1e34('0x25')](_0x1e34('0x21'),_0x3e5ddb,_0x556fed);_0x24cc1f(_0x556fed);});});}function respondWithStatusCode(_0x3265de,_0x41644d){_0x41644d=_0x41644d||0xcc;return function(_0x31704a){if(_0x31704a){return _0x3265de[_0x1e34('0x29')](_0x41644d);}return _0x3265de['status'](_0x41644d)[_0x1e34('0x2a')]();};}function respondWithResult(_0x16df9a,_0x392071){_0x392071=_0x392071||0xc8;return function(_0x40457c){if(_0x40457c){return _0x16df9a[_0x1e34('0x2b')](_0x392071)[_0x1e34('0x2c')](_0x40457c);}};}function respondWithFilteredResult(_0x410e24,_0x2a33d7){return function(_0x463afe){if(_0x463afe){var _0x105094=typeof _0x2a33d7[_0x1e34('0x2d')]===_0x1e34('0x2e')&&typeof _0x2a33d7[_0x1e34('0x2f')]===_0x1e34('0x2e');var _0x3923a0=_0x463afe[_0x1e34('0x30')];var _0x1154c6=_0x105094?0x0:_0x2a33d7[_0x1e34('0x2d')];var _0x3cdb4b=_0x105094?_0x463afe['count']:_0x2a33d7['offset']+_0x2a33d7[_0x1e34('0x2f')];var _0x3ef1b6;if(_0x3cdb4b>=_0x3923a0){_0x3cdb4b=_0x3923a0;_0x3ef1b6=0xc8;}else{_0x3ef1b6=0xce;}_0x410e24[_0x1e34('0x2b')](_0x3ef1b6);return _0x410e24[_0x1e34('0x31')](_0x1e34('0x32'),_0x1154c6+'-'+_0x3cdb4b+'/'+_0x3923a0)['json'](_0x463afe);}return null;};}function patchUpdates(_0x172741){return function(_0x374529){try{jsonpatch[_0x1e34('0x33')](_0x374529,_0x172741,!![]);}catch(_0x1ca51d){return BPromise[_0x1e34('0x34')](_0x1ca51d);}return _0x374529[_0x1e34('0x35')]();};}function saveUpdates(_0x20f7f7,_0x442e77){return function(_0x11f820){if(_0x11f820){return _0x11f820['update'](_0x20f7f7)[_0x1e34('0x36')](function(_0x4ee999){return _0x4ee999;});}return null;};}function removeEntity(_0x4d0c00,_0x4675ce){return function(_0x1500f0){if(_0x1500f0){return _0x1500f0['destroy']()[_0x1e34('0x36')](function(){var _0x26ce51=_0x1500f0[_0x1e34('0x37')]({'plain':!![]});var _0x2d6e68=_0x1e34('0x38');return db[_0x1e34('0x39')][_0x1e34('0x3a')]({'where':{'type':_0x2d6e68,'resourceId':_0x26ce51['id']}})[_0x1e34('0x36')](function(){return _0x1500f0;});})['then'](function(){_0x4d0c00[_0x1e34('0x2b')](0xcc)[_0x1e34('0x2a')]();});}};}function handleEntityNotFound(_0x522bae,_0x57fec6){return function(_0x14ec7b){if(!_0x14ec7b){_0x522bae[_0x1e34('0x29')](0x194);}return _0x14ec7b;};}function handleError(_0x53a35f,_0xa6a35d){_0xa6a35d=_0xa6a35d||0x1f4;return function(_0x524604){logger['error'](_0x524604['stack']);if(_0x524604[_0x1e34('0x3b')]){delete _0x524604[_0x1e34('0x3b')];}_0x53a35f['status'](_0xa6a35d)[_0x1e34('0x3c')](_0x524604);};}exports[_0x1e34('0x3d')]=function(_0x1bdab6,_0x460ec2){var _0xf74ac3={'include':[{'model':db[_0x1e34('0x3e')],'as':_0x1e34('0x3f')}]},_0x1fb630={},_0x1f51f6={'count':0x0,'rows':[]};var _0x22e231=_[_0x1e34('0x40')](db[_0x1e34('0x41')][_0x1e34('0x42')],function(_0xb316cb){return{'name':_0xb316cb[_0x1e34('0x43')],'type':_0xb316cb['type'][_0x1e34('0x44')]};});_0x1fb630[_0x1e34('0x45')]=_['map'](_0x22e231,_0x1e34('0x3b'));_0x1fb630[_0x1e34('0x46')]=_[_0x1e34('0x47')](_0x1bdab6[_0x1e34('0x46')]);_0x1fb630[_0x1e34('0x48')]=_['intersection'](_0x1fb630[_0x1e34('0x45')],_0x1fb630['query']);_0xf74ac3[_0x1e34('0x49')]=_['intersection'](_0x1fb630[_0x1e34('0x45')],qs['fields'](_0x1bdab6['query'][_0x1e34('0x4a')]));_0xf74ac3[_0x1e34('0x49')]=_0xf74ac3['attributes'][_0x1e34('0x4b')]?_0xf74ac3['attributes']:_0x1fb630[_0x1e34('0x45')];if(!_0x1bdab6[_0x1e34('0x46')][_0x1e34('0x4c')](_0x1e34('0x4d'))){_0xf74ac3[_0x1e34('0x2f')]=qs[_0x1e34('0x2f')](_0x1bdab6['query'][_0x1e34('0x2f')]);_0xf74ac3[_0x1e34('0x2d')]=qs[_0x1e34('0x2d')](_0x1bdab6[_0x1e34('0x46')][_0x1e34('0x2d')]);}_0xf74ac3[_0x1e34('0x4e')]=qs[_0x1e34('0x4f')](_0x1bdab6['query'][_0x1e34('0x4f')]);_0xf74ac3[_0x1e34('0x50')]=qs[_0x1e34('0x48')](_[_0x1e34('0x51')](_0x1bdab6[_0x1e34('0x46')],_0x1fb630[_0x1e34('0x48')]),_0x22e231);if(_0x1bdab6[_0x1e34('0x46')]['filter']){_0xf74ac3[_0x1e34('0x50')]=_[_0x1e34('0x52')](_0xf74ac3[_0x1e34('0x50')],{'$or':_[_0x1e34('0x40')](_0x22e231,function(_0xa847fe){if(_0xa847fe[_0x1e34('0x53')]!==_0x1e34('0x54')){var _0x593740={};_0x593740[_0xa847fe[_0x1e34('0x3b')]]={'$like':'%'+_0x1bdab6[_0x1e34('0x46')][_0x1e34('0x55')]+'%'};return _0x593740;}})});}_0xf74ac3=_[_0x1e34('0x52')]({},_0xf74ac3,_0x1bdab6['options']);var _0x2cf2c7={'where':_0xf74ac3[_0x1e34('0x50')]};return db[_0x1e34('0x41')]['count'](_0x2cf2c7)[_0x1e34('0x36')](function(_0x3a5f4b){_0x1f51f6[_0x1e34('0x30')]=_0x3a5f4b;if(_0x1bdab6[_0x1e34('0x46')][_0x1e34('0x56')]){_0xf74ac3[_0x1e34('0x57')]=[{'all':!![]}];}return db[_0x1e34('0x41')][_0x1e34('0x58')](_0xf74ac3);})[_0x1e34('0x36')](function(_0x42a8cb){_0x1f51f6[_0x1e34('0x59')]=_0x42a8cb;return _0x1f51f6;})[_0x1e34('0x36')](respondWithFilteredResult(_0x460ec2,_0xf74ac3))[_0x1e34('0x5a')](handleError(_0x460ec2,null));};exports[_0x1e34('0x5b')]=function(_0x4aa7eb,_0x4382a8){var _0x828f82={'raw':![],'where':{'id':_0x4aa7eb['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x14233e={};_0x14233e['model']=_[_0x1e34('0x47')](db[_0x1e34('0x41')][_0x1e34('0x42')]);_0x14233e['query']=_[_0x1e34('0x47')](_0x4aa7eb[_0x1e34('0x46')]);_0x14233e['filters']=_[_0x1e34('0x5c')](_0x14233e[_0x1e34('0x45')],_0x14233e['query']);_0x828f82[_0x1e34('0x49')]=_[_0x1e34('0x5c')](_0x14233e[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x4aa7eb[_0x1e34('0x46')][_0x1e34('0x4a')]));_0x828f82['attributes']=_0x828f82[_0x1e34('0x49')]['length']?_0x828f82[_0x1e34('0x49')]:_0x14233e[_0x1e34('0x45')];if(_0x4aa7eb[_0x1e34('0x46')][_0x1e34('0x56')]){_0x828f82[_0x1e34('0x57')]=[{'all':!![]}];}_0x828f82=_[_0x1e34('0x52')]({},_0x828f82,_0x4aa7eb[_0x1e34('0x5d')]);return db[_0x1e34('0x41')]['find'](_0x828f82)['then'](handleEntityNotFound(_0x4382a8,null))[_0x1e34('0x36')](respondWithResult(_0x4382a8,null))[_0x1e34('0x5a')](handleError(_0x4382a8,null));};exports[_0x1e34('0x5e')]=function(_0x4ceaaf,_0x5a1c2e){return db[_0x1e34('0x41')]['create'](_0x4ceaaf[_0x1e34('0x5f')],{})['then'](function(_0x3dbe49){var _0x546351=_0x4ceaaf[_0x1e34('0x60')][_0x1e34('0x37')]({'plain':!![]});if(!_0x546351)throw new Error(_0x1e34('0x61'));if(_0x546351[_0x1e34('0x62')]===_0x1e34('0x60')){var _0x295507=_0x3dbe49[_0x1e34('0x37')]({'plain':!![]});var _0x352bd7=_0x1e34('0x38');return db['UserProfileSection'][_0x1e34('0x63')]({'where':{'name':_0x352bd7,'userProfileId':_0x546351[_0x1e34('0x64')]},'raw':!![]})[_0x1e34('0x36')](function(_0x1dba91){if(_0x1dba91&&_0x1dba91[_0x1e34('0x65')]===0x0){return db[_0x1e34('0x39')][_0x1e34('0x5e')]({'name':_0x295507[_0x1e34('0x3b')],'resourceId':_0x295507['id'],'type':_0x1dba91[_0x1e34('0x3b')],'sectionId':_0x1dba91['id']},{})['then'](function(){return _0x3dbe49;});}else{return _0x3dbe49;}})[_0x1e34('0x5a')](function(_0x30c403){logger[_0x1e34('0x25')](_0x1e34('0x66'),_0x30c403);throw _0x30c403;});}return _0x3dbe49;})['then'](respondWithResult(_0x5a1c2e,0xc9))['catch'](handleError(_0x5a1c2e,null));};exports[_0x1e34('0x67')]=function(_0x407201,_0x4bcaa7){if(_0x407201['body']['id']){delete _0x407201[_0x1e34('0x5f')]['id'];}return db['SmsAccount'][_0x1e34('0x63')]({'where':{'id':_0x407201[_0x1e34('0x68')]['id']},'include':[{'model':db[_0x1e34('0x3e')],'as':_0x1e34('0x3f')}]})['then'](handleEntityNotFound(_0x4bcaa7,null))[_0x1e34('0x36')](saveUpdates(_0x407201['body'],null))[_0x1e34('0x36')](respondWithResult(_0x4bcaa7,null))[_0x1e34('0x5a')](handleError(_0x4bcaa7,null));};exports[_0x1e34('0x3a')]=function(_0xc28bd9,_0x31fe65){return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0xc28bd9[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x31fe65,null))[_0x1e34('0x36')](removeEntity(_0x31fe65,null))['catch'](handleError(_0x31fe65,null));};exports[_0x1e34('0x69')]=function(_0x5d7af3,_0x1f67e5){return db[_0x1e34('0x41')][_0x1e34('0x69')]()[_0x1e34('0x36')](respondWithResult(_0x1f67e5,null))[_0x1e34('0x5a')](handleError(_0x1f67e5,null));};exports[_0x1e34('0x6a')]=function(_0x13d30b,_0x4ed3c4,_0x560f37){if(_0x13d30b[_0x1e34('0x5f')]['id']){delete _0x13d30b[_0x1e34('0x5f')]['id'];}return db[_0x1e34('0x41')]['find']({'where':{'id':_0x13d30b[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x4ed3c4,null))[_0x1e34('0x36')](function(_0x401ee3){if(_0x401ee3){_0x13d30b[_0x1e34('0x5f')][_0x1e34('0x6b')]=_0x401ee3['id'];return db[_0x1e34('0x6c')][_0x1e34('0x5e')](_0x13d30b['body']);}})['then'](respondWithResult(_0x4ed3c4,null))[_0x1e34('0x5a')](handleError(_0x4ed3c4,null));};exports[_0x1e34('0x6d')]=function(_0x1667a2,_0x2d2b66,_0x34cfe3){var _0x15561f={'raw':![],'where':{}};var _0x481581={};var _0x5166b2={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1e34('0x6e')]({'where':{'id':_0x1667a2['params']['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x2d2b66,null))[_0x1e34('0x36')](function(_0x403683){if(_0x403683){_0x481581['model']=_[_0x1e34('0x47')](db[_0x1e34('0x6c')][_0x1e34('0x42')]);_0x481581[_0x1e34('0x46')]=_[_0x1e34('0x47')](_0x1667a2['query']);_0x481581[_0x1e34('0x48')]=_['intersection'](_0x481581[_0x1e34('0x45')],_0x481581[_0x1e34('0x46')]);_0x15561f[_0x1e34('0x49')]=_['intersection'](_0x481581[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x1667a2[_0x1e34('0x46')][_0x1e34('0x4a')]));_0x15561f['attributes']=_0x15561f[_0x1e34('0x49')][_0x1e34('0x4b')]?_0x15561f[_0x1e34('0x49')]:_0x481581['model'];if(!_0x1667a2[_0x1e34('0x46')]['hasOwnProperty'](_0x1e34('0x4d'))){_0x15561f[_0x1e34('0x2f')]=qs[_0x1e34('0x2f')](_0x1667a2['query'][_0x1e34('0x2f')]);_0x15561f['offset']=qs[_0x1e34('0x2d')](_0x1667a2[_0x1e34('0x46')]['offset']);}_0x15561f[_0x1e34('0x4e')]=qs['sort'](_0x1667a2[_0x1e34('0x46')][_0x1e34('0x4f')]);_0x15561f[_0x1e34('0x50')]=qs[_0x1e34('0x48')](_['pick'](_0x1667a2[_0x1e34('0x46')],_0x481581[_0x1e34('0x48')]));_0x15561f['where']['SmsAccountId']=_0x403683['id'];if(_0x1667a2[_0x1e34('0x46')][_0x1e34('0x55')]){_0x15561f[_0x1e34('0x50')]=_[_0x1e34('0x52')](_0x15561f[_0x1e34('0x50')],{'$or':_[_0x1e34('0x40')](_0x15561f[_0x1e34('0x49')],function(_0x8fdd19){var _0x3e99ac={};_0x3e99ac[_0x8fdd19]={'$like':'%'+_0x1667a2[_0x1e34('0x46')][_0x1e34('0x55')]+'%'};return _0x3e99ac;})});}_0x15561f=_[_0x1e34('0x52')]({},_0x15561f,_0x1667a2['options']);return db[_0x1e34('0x6c')]['count']({'where':_0x15561f[_0x1e34('0x50')]})[_0x1e34('0x36')](function(_0x3a826a){_0x5166b2[_0x1e34('0x30')]=_0x3a826a;if(_0x1667a2[_0x1e34('0x46')][_0x1e34('0x56')]){_0x15561f['include']=[{'all':!![]}];}return db[_0x1e34('0x6c')][_0x1e34('0x58')](_0x15561f);})[_0x1e34('0x36')](function(_0x4bc258){_0x5166b2[_0x1e34('0x59')]=_0x4bc258;return _0x5166b2;});}})[_0x1e34('0x36')](respondWithFilteredResult(_0x2d2b66,_0x15561f))[_0x1e34('0x5a')](handleError(_0x2d2b66,null));};exports['removeDispositions']=function(_0x3372f3,_0x5cf68b,_0x1bffb1){return db['SmsAccount'][_0x1e34('0x63')]({'where':{'id':_0x3372f3[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x5cf68b,null))[_0x1e34('0x36')](function(_0x29357b){if(_0x29357b){return _0x29357b[_0x1e34('0x6f')](_0x3372f3[_0x1e34('0x46')][_0x1e34('0x70')]);}})[_0x1e34('0x36')](respondWithStatusCode(_0x5cf68b,null))[_0x1e34('0x5a')](handleError(_0x5cf68b,null));};exports['addAnswer']=function(_0x708885,_0x3f6f7d,_0x4f38e5){if(_0x708885['body']['id']){delete _0x708885[_0x1e34('0x5f')]['id'];}return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x708885[_0x1e34('0x68')]['id']}})['then'](handleEntityNotFound(_0x3f6f7d,null))[_0x1e34('0x36')](function(_0x1ec478){if(_0x1ec478){_0x708885[_0x1e34('0x5f')][_0x1e34('0x6b')]=_0x1ec478['id'];return db[_0x1e34('0x71')][_0x1e34('0x5e')](_0x708885[_0x1e34('0x5f')]);}})[_0x1e34('0x36')](respondWithResult(_0x3f6f7d,null))['catch'](handleError(_0x3f6f7d,null));};exports[_0x1e34('0x72')]=function(_0x382a52,_0x46c213,_0x525139){var _0x4171a7={'raw':![],'where':{}};var _0x2f4d34={};var _0x134426={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1e34('0x6e')]({'where':{'id':_0x382a52[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x46c213,null))[_0x1e34('0x36')](function(_0x9cf948){if(_0x9cf948){_0x2f4d34[_0x1e34('0x45')]=_[_0x1e34('0x47')](db[_0x1e34('0x71')][_0x1e34('0x42')]);_0x2f4d34[_0x1e34('0x46')]=_[_0x1e34('0x47')](_0x382a52[_0x1e34('0x46')]);_0x2f4d34[_0x1e34('0x48')]=_[_0x1e34('0x5c')](_0x2f4d34[_0x1e34('0x45')],_0x2f4d34[_0x1e34('0x46')]);_0x4171a7[_0x1e34('0x49')]=_['intersection'](_0x2f4d34[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x382a52[_0x1e34('0x46')]['fields']));_0x4171a7[_0x1e34('0x49')]=_0x4171a7['attributes']['length']?_0x4171a7[_0x1e34('0x49')]:_0x2f4d34[_0x1e34('0x45')];if(!_0x382a52[_0x1e34('0x46')]['hasOwnProperty'](_0x1e34('0x4d'))){_0x4171a7[_0x1e34('0x2f')]=qs[_0x1e34('0x2f')](_0x382a52[_0x1e34('0x46')][_0x1e34('0x2f')]);_0x4171a7['offset']=qs[_0x1e34('0x2d')](_0x382a52[_0x1e34('0x46')][_0x1e34('0x2d')]);}_0x4171a7[_0x1e34('0x4e')]=qs[_0x1e34('0x4f')](_0x382a52[_0x1e34('0x46')][_0x1e34('0x4f')]);_0x4171a7[_0x1e34('0x50')]=qs[_0x1e34('0x48')](_['pick'](_0x382a52[_0x1e34('0x46')],_0x2f4d34[_0x1e34('0x48')]));_0x4171a7[_0x1e34('0x50')][_0x1e34('0x6b')]=_0x9cf948['id'];if(_0x382a52['query'][_0x1e34('0x55')]){_0x4171a7['where']=_[_0x1e34('0x52')](_0x4171a7[_0x1e34('0x50')],{'$or':_[_0x1e34('0x40')](_0x4171a7[_0x1e34('0x49')],function(_0x3f9c33){var _0x14e896={};_0x14e896[_0x3f9c33]={'$like':'%'+_0x382a52[_0x1e34('0x46')][_0x1e34('0x55')]+'%'};return _0x14e896;})});}_0x4171a7=_[_0x1e34('0x52')]({},_0x4171a7,_0x382a52[_0x1e34('0x5d')]);return db[_0x1e34('0x71')][_0x1e34('0x30')]({'where':_0x4171a7[_0x1e34('0x50')]})[_0x1e34('0x36')](function(_0x446b11){_0x134426[_0x1e34('0x30')]=_0x446b11;if(_0x382a52[_0x1e34('0x46')][_0x1e34('0x56')]){_0x4171a7['include']=[{'all':!![]}];}return db[_0x1e34('0x71')][_0x1e34('0x58')](_0x4171a7);})[_0x1e34('0x36')](function(_0x16f850){_0x134426['rows']=_0x16f850;return _0x134426;});}})[_0x1e34('0x36')](respondWithFilteredResult(_0x46c213,_0x4171a7))[_0x1e34('0x5a')](handleError(_0x46c213,null));};exports['removeAnswers']=function(_0x3cfec5,_0x461f3e,_0x3b9adb){return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x3cfec5[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x461f3e,null))[_0x1e34('0x36')](function(_0x4c5699){if(_0x4c5699){return _0x4c5699[_0x1e34('0x73')](_0x3cfec5[_0x1e34('0x46')][_0x1e34('0x70')]);}})[_0x1e34('0x36')](respondWithStatusCode(_0x461f3e,null))[_0x1e34('0x5a')](handleError(_0x461f3e,null));};exports[_0x1e34('0x74')]=function(_0x562a5f,_0x3b3f3d,_0x54ebce){var _0x568150={'channel':'sms'};var _0x288ba8=[];var _0x505383=[];var _0x5e7ca7={};return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x562a5f['params']['id']},'include':[{'model':db[_0x1e34('0x75')],'as':'Applications'}]})[_0x1e34('0x36')](handleEntityNotFound(_0x3b3f3d,null))[_0x1e34('0x36')](function(_0x32bea9){_0x568150[_0x1e34('0x76')]=_0x32bea9;_0x568150[_0x1e34('0x77')]=_[_0x1e34('0x78')](_0x32bea9[_0x1e34('0x79')],[_0x1e34('0x7a')],[_0x1e34('0x7b')]);if(_0x568150[_0x1e34('0x76')][_0x1e34('0x79')]){delete _0x568150[_0x1e34('0x76')]['Applications'];}return db[_0x1e34('0x7c')][_0x1e34('0x69')]();})[_0x1e34('0x36')](function(_0x3ce71e){if(!_0x3ce71e){throw new db['Sequelize'][(_0x1e34('0x7d'))](_0x1e34('0x7e'));}_0x288ba8=_[_0x1e34('0x7f')](_[_0x1e34('0x47')](_0x3ce71e),['createdAt',_0x1e34('0x80')]);_0x505383=_['difference'](_['keys'](_0x3ce71e),[_0x1e34('0x81'),_0x1e34('0x80'),_0x1e34('0x82'),'ListId']);_0x568150[_0x1e34('0x5f')]={'mapKey':_0x1e34('0x83')};if(_0x568150[_0x1e34('0x76')]['type']){switch(_0x568150['account']['type']){case _0x1e34('0x84'):_0x568150['body'][_0x1e34('0x85')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x86')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x87')];_0x568150['body']['messageId']=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x88')];break;case'skebby':_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]='+'+_0x562a5f['body'][_0x1e34('0x89')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f['body'][_0x1e34('0x8a')];break;case _0x1e34('0x8b'):_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x85')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f['body'][_0x1e34('0x26')];break;case _0x1e34('0x8c'):_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f['body'][_0x1e34('0x85')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x5f')];_0x568150[_0x1e34('0x5f')]['messageId']=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x8d')];break;case'plivo':_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x86')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x8e')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x8f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x90')];break;case _0x1e34('0x91'):_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]='+'+_0x562a5f[_0x1e34('0x5f')]['results'][0x0][_0x1e34('0x85')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')]['results'][0x0][_0x1e34('0x8a')];_0x568150['body'][_0x1e34('0x8f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x92')][0x0][_0x1e34('0x8f')];break;case'csc':_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f[_0x1e34('0x5f')]['originatingAddress'];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')]['segmentedMessage'][_0x1e34('0x26')];break;case _0x1e34('0x93'):_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f['body'][_0x1e34('0x94')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f['body'][_0x1e34('0x8a')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x8f')]=_0x562a5f['body']['replyMessageId'];break;case _0x1e34('0x95'):_0x568150[_0x1e34('0x5f')][_0x1e34('0x8f')]=_0x562a5f[_0x1e34('0x5f')][0x0]['message']['id'];_0x568150[_0x1e34('0x5f')]['from']=_0x562a5f['body'][0x0]['message'][_0x1e34('0x85')];_0x568150['body'][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')][0x0]['message'][_0x1e34('0x8a')];break;case'intelepeer':_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')]=_0x562a5f['body'][_0x1e34('0x85')];_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')]=_0x562a5f[_0x1e34('0x5f')]['message'];_0x568150[_0x1e34('0x5f')][_0x1e34('0x8f')]=_0x562a5f[_0x1e34('0x5f')][_0x1e34('0x96')];break;}}if(_0x568150[_0x1e34('0x5f')]['id']){delete _0x568150[_0x1e34('0x5f')]['id'];}if(_['isNil'](_0x568150['body']['from'])){throw new db[(_0x1e34('0x97'))][(_0x1e34('0x7d'))](_0x1e34('0x98'));}if(_[_0x1e34('0x99')](_0x568150[_0x1e34('0x5f')][_0x1e34('0x5f')])||_0x568150['body'][_0x1e34('0x5f')]===''){throw new db[(_0x1e34('0x97'))][(_0x1e34('0x7d'))](_0x1e34('0x9a'));}if(_[_0x1e34('0x99')](_0x568150[_0x1e34('0x5f')][_0x1e34('0x9b')])){throw new db[(_0x1e34('0x97'))][(_0x1e34('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x505383);}if(!_[_0x1e34('0x9c')](_0x505383,_0x568150[_0x1e34('0x5f')]['mapKey'])){throw new db[(_0x1e34('0x97'))][(_0x1e34('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x505383);}_0x5e7ca7[_0x568150['body'][_0x1e34('0x9b')]]=_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')];return db[_0x1e34('0x9d')][_0x1e34('0x63')]({'where':{'id':_0x568150['account'][_0x1e34('0x9e')]},'include':[{'model':db[_0x1e34('0x7c')],'as':_0x1e34('0x9f'),'where':_0x5e7ca7,'limit':0x1,'order':[[_0x1e34('0x80'),_0x1e34('0xa0')]]}]});})[_0x1e34('0x36')](handleEntityNotFound(_0x3b3f3d,null))[_0x1e34('0x36')](function(_0x930433){if(_0x930433){_0x568150[_0x1e34('0xa1')]=_[_0x1e34('0xa2')](_0x930433,[_0x1e34('0x9f')]);if(_0x930433['Contacts'][_0x1e34('0x4b')]){return _0x930433['Contacts'][0x0];}var _0x28bc3a=_[_0x1e34('0x18')](_0x568150[_0x1e34('0x5f')],{'firstName':_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')],'ListId':_0x930433['id']});_0x28bc3a[_0x568150[_0x1e34('0x5f')][_0x1e34('0x9b')]]=_0x568150[_0x1e34('0x5f')][_0x1e34('0x85')];return db['CmContact'][_0x1e34('0x5e')](_0x28bc3a,{'fields':_0x288ba8,'raw':!![]});}})[_0x1e34('0x36')](handleEntityNotFound(_0x3b3f3d,null))[_0x1e34('0x36')](function(_0x5e496d){if(_0x5e496d){_0x568150['contact']=_0x5e496d;var _0x120327={'ContactId':_0x5e496d['id'],'phone':_0x568150[_0x1e34('0x5f')]['from'],'SmsAccountId':_0x562a5f[_0x1e34('0x68')]['id']};var _0x3ff851={'ContactId':_0x5e496d['id'],'SmsAccountId':_0x562a5f[_0x1e34('0x68')]['id'],'closed':![]};return db[_0x1e34('0xa3')]['find']({'where':_0x3ff851})['then'](function(_0x25881a){if(_0x25881a){return[_0x25881a,![]];}return db[_0x1e34('0xa3')][_0x1e34('0x5e')](_0x120327)[_0x1e34('0x36')](function(_0x19f420){return[_0x19f420,!![]];});});}})[_0x1e34('0xa4')](function(_0xe809e7,_0x502698){_0x568150['interaction']=_0xe809e7[_0x1e34('0x37')]({'plain':!![]});_0x568150[_0x1e34('0xa5')][_0x1e34('0xa6')]=![];if(_0x502698){if(_0x568150['account'][_0x1e34('0xa7')]){_0x568150[_0x1e34('0x77')][_0x1e34('0xa8')]({'id':0x0,'priority':_0x568150[_0x1e34('0x77')][_0x1e34('0x4b')]+0x1,'app':_0x1e34('0xa9'),'appdata':_0x1e34('0xaa'),'interval':_0x1e34('0xab')});}_0x568150[_0x1e34('0xa5')][_0x1e34('0xa6')]=!![];}return db[_0x1e34('0xac')][_0x1e34('0x5e')]({'phone':_0x568150[_0x1e34('0x5f')]['from'],'messageId':_0x568150[_0x1e34('0x5f')]['messageId'],'body':_0x568150['body'][_0x1e34('0x5f')],'SmsAccountId':_0x562a5f[_0x1e34('0x68')]['id'],'SmsInteractionId':_0xe809e7['id'],'direction':'in','ContactId':_0xe809e7[_0x1e34('0xad')],'AttachmentId':_0x568150[_0x1e34('0x5f')][_0x1e34('0xae')]});})[_0x1e34('0x36')](function(_0x4f7423){_0x568150[_0x1e34('0x26')]=_0x4f7423;if(_0x568150['interaction'][_0x1e34('0xaf')]){return db[_0x1e34('0xb0')]['find']({'attributes':['id',_0x1e34('0x3b')],'where':{'id':_0x568150[_0x1e34('0xa5')][_0x1e34('0xaf')]}})[_0x1e34('0x36')](function(_0x25b724){if(_0x25b724){_0x568150[_0x1e34('0x77')][_0x1e34('0xb1')]({'id':0x0,'priority':0x0,'app':_0x1e34('0xb2'),'appdata':_0x25b724[_0x1e34('0x3b')]+','+(_0x568150['account'][_0x1e34('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1e34('0xb4'),_0x1e34('0xb5'),_0x568150);});}return respondWithRpcPromise(_0x1e34('0xb4'),_0x1e34('0xb5'),_0x568150);})[_0x1e34('0x36')](function(_0x3a04f9){if(_0x3a04f9){var _0x501f2e=0xc8;var _0x1019c2=_0x1e34('0xb6');logger[_0x1e34('0x27')](_0x1e34('0x22'),_0x1019c2,_0x501f2e,_0x1e34('0xb7'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1019c2,_0x501f2e,_0x1e34('0xb7'),JSON[_0x1e34('0xb8')](_0x3a04f9));if(_0x568150[_0x1e34('0x76')][_0x1e34('0x53')]===_0x1e34('0x84')){return _0x3b3f3d[_0x1e34('0x2b')](_0x501f2e)['set'](_0x1e34('0xb9'),_0x1e34('0xba'))[_0x1e34('0x3c')](_0x1e34('0xbb'));}else{return _0x3b3f3d[_0x1e34('0x2b')](_0x501f2e)['json'](_0x3a04f9);}}})[_0x1e34('0x5a')](handleError(_0x3b3f3d,null));};exports[_0x1e34('0xbc')]=function(_0x29b4ae,_0x40789e){var _0x1a1726=_0x29b4ae[_0x1e34('0x68')]['id'];var _0x4c392c=_0x29b4ae['body'];var _0x701720=0xc8;var _0x5b396a=null;return db['sequelize'][_0x1e34('0xbd')]({'isolationLevel':db[_0x1e34('0xbe')][_0x1e34('0xbf')][_0x1e34('0xc0')][_0x1e34('0xc1')]},function(_0x4d05f7){return db[_0x1e34('0x41')][_0x1e34('0x6e')]({'where':{'id':_0x1a1726},'transaction':_0x4d05f7})[_0x1e34('0x36')](function(_0x3688e9){if(_0x3688e9){return db[_0x1e34('0x75')][_0x1e34('0x3a')]({'where':{'SmsAccountId':_0x1a1726},'transaction':_0x4d05f7})[_0x1e34('0x36')](function(){var _0x2ea9f3=_[_0x1e34('0x40')](_0x4c392c,function(_0x328bcf){_0x328bcf['SmsAccountId']=_0x1a1726;return _0x328bcf;});return db[_0x1e34('0x75')][_0x1e34('0xc2')](_0x2ea9f3,{'transaction':_0x4d05f7});});}else{_0x701720=0x194;_0x5b396a=[];}});})[_0x1e34('0x36')](function(){if(_0x701720!==0x194){return db[_0x1e34('0x75')][_0x1e34('0xc3')]({'where':{'SmsAccountId':_0x1a1726},'order':_0x1e34('0x7a')})[_0x1e34('0x36')](function(_0x202517){_0x5b396a=_0x202517;});}})['catch'](function(_0x3b3192){_0x701720=0x1f4;logger[_0x1e34('0x25')](_0x3b3192['stack']);if(_0x3b3192[_0x1e34('0x3b')]){delete _0x3b3192[_0x1e34('0x3b')];}_0x5b396a=_0x3b3192;})['finally'](function(){if(_0x5b396a===null){_0x40789e[_0x1e34('0x29')](_0x701720);}else{if(_0x701720===0x1f4){_0x40789e['status'](_0x701720)[_0x1e34('0x3c')](_0x5b396a);}else{_0x40789e[_0x1e34('0x2b')](_0x701720)['json'](_0x5b396a);}}});};exports[_0x1e34('0xc4')]=function(_0x68386c,_0x5c6286,_0x591957){var _0x39e647={};var _0x94f3d2={};var _0x178529;var _0x4aa18b;return db[_0x1e34('0x41')]['findOne']({'where':{'id':_0x68386c[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x5c6286,null))['then'](function(_0x2968d4){if(_0x2968d4){_0x178529=_0x2968d4;_0x94f3d2[_0x1e34('0x45')]=_[_0x1e34('0x47')](db[_0x1e34('0x75')][_0x1e34('0x42')]);_0x94f3d2[_0x1e34('0x46')]=_['keys'](_0x68386c[_0x1e34('0x46')]);_0x94f3d2[_0x1e34('0x48')]=_[_0x1e34('0x5c')](_0x94f3d2[_0x1e34('0x45')],_0x94f3d2[_0x1e34('0x46')]);_0x39e647['attributes']=_[_0x1e34('0x5c')](_0x94f3d2[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x68386c['query'][_0x1e34('0x4a')]));_0x39e647[_0x1e34('0x49')]=_0x39e647[_0x1e34('0x49')][_0x1e34('0x4b')]?_0x39e647[_0x1e34('0x49')]:_0x94f3d2[_0x1e34('0x45')];_0x39e647[_0x1e34('0x4e')]=qs[_0x1e34('0x4f')](_0x68386c[_0x1e34('0x46')][_0x1e34('0x4f')]);_0x39e647[_0x1e34('0x50')]=qs[_0x1e34('0x48')](_['pick'](_0x68386c[_0x1e34('0x46')],_0x94f3d2[_0x1e34('0x48')]));if(_0x68386c[_0x1e34('0x46')][_0x1e34('0x55')]){_0x39e647[_0x1e34('0x50')]=_[_0x1e34('0x52')](_0x39e647[_0x1e34('0x50')],{'$or':_['map'](_0x39e647['attributes'],function(_0x4a8b4f){var _0x209c56={};_0x209c56[_0x4a8b4f]={'$like':'%'+_0x68386c[_0x1e34('0x46')][_0x1e34('0x55')]+'%'};return _0x209c56;})});}_0x39e647=_[_0x1e34('0x52')]({},_0x39e647,_0x68386c[_0x1e34('0x5d')]);return _0x178529[_0x1e34('0xc4')](_0x39e647);}})['then'](function(_0x1e12ee){if(_0x1e12ee){_0x4aa18b=_0x1e12ee['length'];if(!_0x68386c[_0x1e34('0x46')]['hasOwnProperty']('nolimit')){_0x39e647[_0x1e34('0x2f')]=qs[_0x1e34('0x2f')](_0x68386c[_0x1e34('0x46')]['limit']);_0x39e647[_0x1e34('0x2d')]=qs[_0x1e34('0x2d')](_0x68386c[_0x1e34('0x46')][_0x1e34('0x2d')]);}return _0x178529[_0x1e34('0xc4')](_0x39e647);}})[_0x1e34('0x36')](function(_0x2a54e4){if(_0x2a54e4){return _0x2a54e4?{'count':_0x4aa18b,'rows':_0x2a54e4}:null;}})[_0x1e34('0x36')](respondWithResult(_0x5c6286,null))[_0x1e34('0x5a')](handleError(_0x5c6286,null));};exports[_0x1e34('0xc5')]=function(_0x806387,_0xe4d682,_0x29cb6f){var _0x2b50ce={'raw':![],'where':{}};var _0x3855f6={};var _0x4ae4be={'count':0x0,'rows':[]};return db[_0x1e34('0x41')][_0x1e34('0x6e')]({'where':{'id':_0x806387['params']['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0xe4d682,null))['then'](function(_0x3caa62){if(_0x3caa62){_0x3855f6[_0x1e34('0x45')]=_[_0x1e34('0x47')](db['SmsInteraction'][_0x1e34('0x42')]);_0x3855f6['query']=_[_0x1e34('0x47')](_0x806387[_0x1e34('0x46')]);_0x3855f6[_0x1e34('0x48')]=_[_0x1e34('0x5c')](_0x3855f6[_0x1e34('0x45')],_0x3855f6['query']);_0x2b50ce[_0x1e34('0x49')]=_[_0x1e34('0x5c')](_0x3855f6[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x806387[_0x1e34('0x46')][_0x1e34('0x4a')]));_0x2b50ce[_0x1e34('0x49')]=_0x2b50ce['attributes'][_0x1e34('0x4b')]?_0x2b50ce[_0x1e34('0x49')]:_0x3855f6[_0x1e34('0x45')];if(!_0x806387[_0x1e34('0x46')][_0x1e34('0x4c')](_0x1e34('0x4d'))){_0x2b50ce[_0x1e34('0x2f')]=qs['limit'](_0x806387[_0x1e34('0x46')][_0x1e34('0x2f')]);_0x2b50ce[_0x1e34('0x2d')]=qs[_0x1e34('0x2d')](_0x806387['query'][_0x1e34('0x2d')]);}_0x2b50ce[_0x1e34('0x4e')]=qs['sort'](_0x806387['query']['sort']);_0x2b50ce['where']=qs['filters'](_[_0x1e34('0x51')](_0x806387[_0x1e34('0x46')],_0x3855f6[_0x1e34('0x48')]));_0x2b50ce[_0x1e34('0x50')]['SmsAccountId']=_0x3caa62['id'];if(_0x806387[_0x1e34('0x46')]['filter']){_0x2b50ce['where']=_[_0x1e34('0x52')](_0x2b50ce[_0x1e34('0x50')],{'$or':_['map'](_0x2b50ce['attributes'],function(_0x516b15){var _0x986453={};_0x986453[_0x516b15]={'$like':'%'+_0x806387[_0x1e34('0x46')]['filter']+'%'};return _0x986453;})});}_0x2b50ce=_[_0x1e34('0x52')]({},_0x2b50ce,_0x806387[_0x1e34('0x5d')]);return db['SmsInteraction'][_0x1e34('0x30')]({'where':_0x2b50ce[_0x1e34('0x50')]})[_0x1e34('0x36')](function(_0x240b1e){_0x4ae4be[_0x1e34('0x30')]=_0x240b1e;if(_0x806387['query'][_0x1e34('0x56')]){_0x2b50ce['include']=[{'model':db['CmContact'],'as':_0x1e34('0xc6'),'required':![]},{'model':db[_0x1e34('0xb0')],'as':_0x1e34('0xc7'),'attributes':[_0x1e34('0x3b'),_0x1e34('0xc8'),'internal'],'required':![]},{'model':db[_0x1e34('0xc9')],'as':'Tags','attributes':['id',_0x1e34('0x3b'),_0x1e34('0xca')],'where':_0x806387[_0x1e34('0x46')][_0x1e34('0xcb')]?{'id':_0x806387[_0x1e34('0x46')][_0x1e34('0xcb')]}:undefined,'required':_0x806387[_0x1e34('0x46')][_0x1e34('0xcb')]?!![]:![]}];}return db[_0x1e34('0xa3')][_0x1e34('0x58')](_0x2b50ce);})[_0x1e34('0x36')](function(_0x1df7b7){_0x4ae4be['rows']=_0x1df7b7;return _0x4ae4be;});}})[_0x1e34('0x36')](respondWithFilteredResult(_0xe4d682,_0x2b50ce))[_0x1e34('0x5a')](handleError(_0xe4d682,null));};exports[_0x1e34('0x3c')]=function(_0x1f8029,_0x3f8f8b,_0xb0c91){var _0xd8a5a8,_0x570e3d,_0x32f400;if(_[_0x1e34('0x99')](_0x1f8029[_0x1e34('0x5f')][_0x1e34('0x5f')])||_0x1f8029[_0x1e34('0x5f')][_0x1e34('0x5f')]===''){throw new db[(_0x1e34('0x97'))]['ValidationError'](_0x1e34('0x9a'));}if(_[_0x1e34('0x99')](_0x1f8029[_0x1e34('0x5f')]['to'])){throw new db['Sequelize'][(_0x1e34('0x7d'))](_0x1e34('0xcc'));}_0xd8a5a8=_0x1f8029[_0x1e34('0x5f')]['to'];return db[_0x1e34('0x41')]['find']({'where':{'id':_0x1f8029[_0x1e34('0x68')]['id']},'include':[{'model':db[_0x1e34('0x9d')],'as':'List','include':[{'model':db[_0x1e34('0x7c')],'as':_0x1e34('0x9f'),'where':{'mobile':_0xd8a5a8},'limit':0x1,'order':[[_0x1e34('0x80'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3f8f8b,null))[_0x1e34('0x36')](function(_0x239ae2){if(_0x239ae2&&_0x239ae2[_0x1e34('0xcd')]){_0x570e3d=_0x239ae2[_0x1e34('0x37')]({'plain':!![]});if(_0x570e3d[_0x1e34('0xcd')]&&_0x570e3d[_0x1e34('0xcd')]['Contacts'][_0x1e34('0x4b')]){return _0x570e3d[_0x1e34('0xcd')][_0x1e34('0x9f')][0x0];}return db[_0x1e34('0x7c')][_0x1e34('0x5e')](_['defaults'](_0x1f8029[_0x1e34('0x5f')],{'firstName':_0xd8a5a8,'mobile':_0xd8a5a8,'phone':_0xd8a5a8,'ListId':_0x570e3d[_0x1e34('0x9e')]}));}})[_0x1e34('0x36')](handleEntityNotFound(_0x3f8f8b,null))['then'](function(_0x57082d){if(_0x57082d){_0x32f400=_0x57082d;return db['SmsInteraction'][_0x1e34('0x63')]({'where':{'ContactId':_0x32f400['id'],'closed':![],'SmsAccountId':_0x570e3d['id']}})[_0x1e34('0x36')](function(_0x58bec4){if(_0x58bec4){return[_0x58bec4,![]];}return db[_0x1e34('0xa3')][_0x1e34('0x5e')]({'UserId':_0x1f8029[_0x1e34('0x60')]['id'],'ContactId':_0x32f400['id'],'SmsAccountId':_0x570e3d['id'],'phone':_0xd8a5a8,'firstMsgDirection':_0x1e34('0xce'),'Messages':[_[_0x1e34('0x52')](_0x1f8029[_0x1e34('0x5f')],{'read':![],'body':_0x1f8029[_0x1e34('0x5f')][_0x1e34('0x5f')],'phone':_0xd8a5a8,'SmsAccountId':_0x570e3d['id'],'UserId':_0x1f8029[_0x1e34('0x60')]['id'],'ContactId':_0x32f400['id']})]},{'include':[{'model':db[_0x1e34('0xac')],'as':_0x1e34('0xcf')}]})['then'](function(_0xb30c44){return[_0xb30c44,!![]];});});}})[_0x1e34('0xa4')](function(_0x4e7c1e,_0x5aced0){if(_0x5aced0){return _0x4e7c1e;}return db[_0x1e34('0xac')][_0x1e34('0x5e')](_[_0x1e34('0x52')](_0x1f8029['body'],{'read':![],'body':_0x1f8029[_0x1e34('0x5f')][_0x1e34('0x5f')],'phone':_0xd8a5a8,'SmsAccountId':_0x570e3d['id'],'SmsInteractionId':_0x4e7c1e['id'],'UserId':_0x1f8029[_0x1e34('0x60')]['id'],'ContactId':_0x32f400['id']}))[_0x1e34('0x36')](function(_0x4ec76e){_0x4e7c1e['dataValues']['Messages']=[];_0x4e7c1e[_0x1e34('0xd0')][_0x1e34('0xcf')][_0x1e34('0xa8')](_0x4ec76e[_0x1e34('0xd0')]);return _0x4e7c1e;});})['then'](respondWithResult(_0x3f8f8b,null))['catch'](handleError(_0x3f8f8b,null));};exports[_0x1e34('0x2b')]=function(_0x3e8073,_0x3285bb,_0x5dcc46){if(_0x3e8073[_0x1e34('0x5f')]['id']){delete _0x3e8073['body']['id'];}var _0x591433,_0x30b575,_0x1807bb;return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x3e8073[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x3285bb,null))[_0x1e34('0x36')](function(_0x2b41a1){if(_0x2b41a1){_0x1807bb=_0x2b41a1;logger[_0x1e34('0xd1')](_0x1e34('0x22'),_0x1e34('0x2b'),_0x1e34('0xd2'),_0x2b41a1[_0x1e34('0x53')],util[_0x1e34('0xd3')](_0x3e8073[_0x1e34('0x5f')],{'showHidden':![],'depth':null}));switch(_0x2b41a1[_0x1e34('0x53')]){case _0x1e34('0xd4'):if(_0x3e8073['body'][_0x1e34('0xd5')]&&_0x3e8073['body'][_0x1e34('0x2b')]){_0x30b575=_0x3e8073['body'][_0x1e34('0x2b')];return db['SmsMessage'][_0x1e34('0x63')]({'where':{'messageId':_0x3e8073[_0x1e34('0x5f')][_0x1e34('0xd5')]}});}break;case _0x1e34('0x8b'):if(_0x3e8073[_0x1e34('0x5f')][_0x1e34('0xd6')]&&_0x3e8073[_0x1e34('0x5f')][_0x1e34('0xd7')]){_0x30b575=_0x3e8073[_0x1e34('0x5f')][_0x1e34('0xd7')];return db['SmsMessage'][_0x1e34('0x63')]({'where':{'messageId':_0x3e8073['body'][_0x1e34('0xd6')]}});}break;case _0x1e34('0x8c'):if(_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x8d')]&&_0x3e8073[_0x1e34('0x5f')]['status_code']){_0x30b575=_0x3e8073['body'][_0x1e34('0xd8')];return db[_0x1e34('0xac')]['find']({'where':{'messageId':_0x3e8073[_0x1e34('0x5f')]['message_id']}});}break;case _0x1e34('0x91'):var _0xd2dca=_0x3e8073[_0x1e34('0x5f')]['results'][0x0];if(_0xd2dca[_0x1e34('0x8f')]&&_0xd2dca[_0x1e34('0x2b')][_0x1e34('0xd9')]===_0x1e34('0xda')){_0x30b575=_0xd2dca['status'][_0x1e34('0xd9')];return db[_0x1e34('0xac')][_0x1e34('0x63')]({'where':{'messageId':_0xd2dca[_0x1e34('0x8f')]}});}break;case _0x1e34('0x93'):if(_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x8f')]&&_0x3e8073['body'][_0x1e34('0x2b')]){_0x30b575=_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x2b')];return db[_0x1e34('0xac')][_0x1e34('0x63')]({'where':{'messageId':_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x8f')]}});}break;case _0x1e34('0x95'):if(_0x3e8073[_0x1e34('0x5f')][0x0][_0x1e34('0x26')]['id']){_0x30b575=_0x3e8073['body'][0x0]['type'];return db[_0x1e34('0xac')][_0x1e34('0x63')]({'where':{'messageId':_0x3e8073['body'][0x0][_0x1e34('0x26')]['id']}});}break;case'intelepeer':if(_0x3e8073['body'][_0x1e34('0xdb')]&&_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x2b')]){_0x30b575=_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x2b')];return db['SmsMessage'][_0x1e34('0x63')]({'where':{'messageId':_0x3e8073['body'][_0x1e34('0xdb')]}});}break;}}})[_0x1e34('0x36')](handleEntityNotFound(_0x3285bb,null))[_0x1e34('0x36')](function(_0x2d2524){if(_0x2d2524){_0x591433=_0x2d2524;switch(_0x1807bb['type']){case'skebby':if(_0x30b575===_0x1e34('0xda')){return _0x591433[_0x1e34('0x67')]({'read':!![]});}else{logger['error'](_0x1e34('0x22'),_0x1e34('0x2b'),'skebby',util['inspect'](_0x3e8073['body'],{'showHidden':![],'depth':null}));}break;case _0x1e34('0x8b'):if(_0x30b575==='1'){return _0x591433[_0x1e34('0x67')]({'read':!![]});}else{logger[_0x1e34('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1e34('0x2b'),'skebby',util['inspect'](_0x3e8073[_0x1e34('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1e34('0x8c'):if(!_0x3e8073[_0x1e34('0x5f')][_0x1e34('0xdc')]&&_0x30b575>=0xc8&&_0x30b575<=0xce){return _0x591433['update']({'read':!![]});}else{logger[_0x1e34('0x25')](_0x1e34('0x22'),'status',_0x1e34('0x8c'),util[_0x1e34('0xd3')](_0x3e8073[_0x1e34('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1e34('0x91'):var _0x12f8d4=_0x3e8073[_0x1e34('0x5f')][_0x1e34('0x92')][0x0];if(_0x12f8d4[_0x1e34('0x2b')]['groupName']===_0x1e34('0xda')){return _0x591433[_0x1e34('0x67')]({'read':!![]});}else{logger[_0x1e34('0x25')](_0x1e34('0x22'),'status',_0x1e34('0x91'),util[_0x1e34('0xd3')](_0x3e8073['body'],{'showHidden':![],'depth':null}));}break;case _0x1e34('0x93'):if(_0x30b575==_0x1e34('0xdd')||_0x30b575==_0x1e34('0xde')){return _0x591433[_0x1e34('0x67')]({'read':!![]});}else{logger['error'](_0x1e34('0x22'),_0x1e34('0x2b'),_0x1e34('0x93'),util['inspect'](_0x3e8073['body'],{'showHidden':![],'depth':null}));}break;case _0x1e34('0x95'):if(_0x30b575==_0x1e34('0xdf')){return _0x591433[_0x1e34('0x67')]({'read':!![]});}else{logger[_0x1e34('0x25')](_0x1e34('0x22'),_0x1e34('0x2b'),'bandwidth',util[_0x1e34('0xd3')](_0x3e8073[_0x1e34('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1e34('0xe0'):if(_0x30b575===_0x1e34('0xe1')||_0x30b575===_0x1e34('0xe2')){return _0x591433['update']({'read':!![]});}else{logger[_0x1e34('0x25')](_0x1e34('0x22'),_0x1e34('0x2b'),_0x1e34('0xe0'),util[_0x1e34('0xd3')](_0x3e8073[_0x1e34('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x591433;}})[_0x1e34('0x36')](respondWithResult(_0x3285bb,null))['catch'](handleError(_0x3285bb,null));};exports[_0x1e34('0xe3')]=function(_0x9a3c28,_0x316417,_0x25e68b){var _0x480bfd,_0x2b44e5,_0x365e29;return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x9a3c28[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x316417,null))['then'](function(_0x2f2ca0){if(_0x2f2ca0){_0x365e29=_0x2f2ca0;logger[_0x1e34('0xd1')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1e34('0x2b'),_0x1e34('0xd2'),_0x2f2ca0[_0x1e34('0x53')],util[_0x1e34('0xd3')](_0x9a3c28['query'],{'showHidden':![],'depth':null}));switch(_0x2f2ca0[_0x1e34('0x53')]){case _0x1e34('0xe4'):if(_0x9a3c28['query'][_0x1e34('0xe5')]&&_0x9a3c28[_0x1e34('0x46')][_0x1e34('0xe6')]){_0x2b44e5=_0x9a3c28[_0x1e34('0x46')][_0x1e34('0xe6')];return db[_0x1e34('0xac')][_0x1e34('0x63')]({'where':{'messageId':_0x9a3c28['query'][_0x1e34('0xe5')]}});}break;}}})[_0x1e34('0x36')](handleEntityNotFound(_0x316417,null))[_0x1e34('0x36')](function(_0x3155b0){if(_0x3155b0){_0x480bfd=_0x3155b0;switch(_0x365e29[_0x1e34('0x53')]){case'csc':if(_0x2b44e5==='2'||_0x2b44e5==='6'){return _0x480bfd['update']({'read':!![]});}else{logger[_0x1e34('0x25')](_0x1e34('0x22'),_0x1e34('0x2b'),_0x1e34('0xe4'),util[_0x1e34('0xd3')](_0x9a3c28[_0x1e34('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x480bfd;}})[_0x1e34('0x36')](respondWithResult(_0x316417,null))['catch'](handleError(_0x316417,null));};exports['addAgents']=function(_0x55475d,_0x3f64b8,_0x418820){return db[_0x1e34('0x41')][_0x1e34('0x63')]({'where':{'id':_0x55475d[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x3f64b8,null))[_0x1e34('0x36')](function(_0x4eb69f){if(_0x4eb69f){return _0x4eb69f['addAgents'](_0x55475d[_0x1e34('0x5f')][_0x1e34('0x70')],_[_0x1e34('0xa2')](_0x55475d['body'],[_0x1e34('0x70'),'id'])||{})[_0x1e34('0xa4')](function(_0x2ee0d9){for(var _0x3496a6=0x0;_0x3496a6<_0x55475d[_0x1e34('0x5f')][_0x1e34('0x70')]['length'];_0x3496a6+=0x1){socket['emit'](_0x1e34('0xe7'),{'UserId':Number(_0x55475d[_0x1e34('0x5f')]['ids'][_0x3496a6]),'SmsAccountId':Number(_0x55475d[_0x1e34('0x68')]['id'])});}return _0x2ee0d9;});}})[_0x1e34('0x36')](respondWithResult(_0x3f64b8,null))['catch'](handleError(_0x3f64b8,null));};exports[_0x1e34('0xe8')]=function(_0x4f97d2,_0x2d8897,_0x3cd4f1){return db[_0x1e34('0x41')]['find']({'where':{'id':_0x4f97d2[_0x1e34('0x68')]['id']}})[_0x1e34('0x36')](handleEntityNotFound(_0x2d8897,null))[_0x1e34('0x36')](function(_0x40e464){if(_0x40e464){return _0x40e464[_0x1e34('0xe8')](_0x4f97d2[_0x1e34('0x46')][_0x1e34('0x70')])['then'](function(){if(_['isArray'](_0x4f97d2[_0x1e34('0x46')][_0x1e34('0x70')])){for(var _0x42b868=0x0;_0x42b868<_0x4f97d2[_0x1e34('0x46')][_0x1e34('0x70')][_0x1e34('0x4b')];_0x42b868+=0x1){socket['emit'](_0x1e34('0xe9'),{'UserId':Number(_0x4f97d2[_0x1e34('0x46')]['ids'][_0x42b868]),'SmsAccountId':Number(_0x4f97d2[_0x1e34('0x68')]['id'])});}}else{socket[_0x1e34('0xea')](_0x1e34('0xe9'),{'UserId':Number(_0x4f97d2[_0x1e34('0x46')][_0x1e34('0x70')]),'SmsAccountId':Number(_0x4f97d2[_0x1e34('0x68')]['id'])});}});}})[_0x1e34('0x36')](respondWithStatusCode(_0x2d8897,null))[_0x1e34('0x5a')](handleError(_0x2d8897,null));};exports[_0x1e34('0xeb')]=function(_0x187f13,_0x4f149c,_0x49f66d){var _0x745bb={};var _0x20958a={};var _0x2df3b9;var _0x24c36d;return db[_0x1e34('0x41')][_0x1e34('0x6e')]({'where':{'id':_0x187f13[_0x1e34('0x68')]['id']}})['then'](handleEntityNotFound(_0x4f149c,null))[_0x1e34('0x36')](function(_0x24fbf9){if(_0x24fbf9){_0x2df3b9=_0x24fbf9;_0x20958a[_0x1e34('0x45')]=_['keys'](db[_0x1e34('0xb0')]['rawAttributes']);_0x20958a[_0x1e34('0x46')]=_[_0x1e34('0x47')](_0x187f13['query']);_0x20958a[_0x1e34('0x48')]=_[_0x1e34('0x5c')](_0x20958a[_0x1e34('0x45')],_0x20958a['query']);_0x745bb['attributes']=_[_0x1e34('0x5c')](_0x20958a[_0x1e34('0x45')],qs[_0x1e34('0x4a')](_0x187f13['query'][_0x1e34('0x4a')]));_0x745bb[_0x1e34('0x49')]=_0x745bb[_0x1e34('0x49')][_0x1e34('0x4b')]?_0x745bb[_0x1e34('0x49')]:_0x20958a['model'];_0x745bb['order']=qs['sort'](_0x187f13['query'][_0x1e34('0x4f')]);_0x745bb[_0x1e34('0x50')]=qs['filters'](_[_0x1e34('0x51')](_0x187f13['query'],_0x20958a[_0x1e34('0x48')]));if(_0x187f13['query']['filter']){_0x745bb[_0x1e34('0x50')]=_[_0x1e34('0x52')](_0x745bb[_0x1e34('0x50')],{'$or':_[_0x1e34('0x40')](_0x745bb[_0x1e34('0x49')],function(_0x1c49eb){var _0x57a501={};_0x57a501[_0x1c49eb]={'$like':'%'+_0x187f13[_0x1e34('0x46')][_0x1e34('0x55')]+'%'};return _0x57a501;})});}_0x745bb=_[_0x1e34('0x52')]({},_0x745bb,_0x187f13['options']);return _0x2df3b9['getAgents'](_0x745bb);}})[_0x1e34('0x36')](function(_0x1ce04d){if(_0x1ce04d){_0x24c36d=_0x1ce04d['length'];if(!_0x187f13[_0x1e34('0x46')][_0x1e34('0x4c')](_0x1e34('0x4d'))){_0x745bb[_0x1e34('0x2f')]=qs['limit'](_0x187f13[_0x1e34('0x46')]['limit']);_0x745bb[_0x1e34('0x2d')]=qs['offset'](_0x187f13['query'][_0x1e34('0x2d')]);}return _0x2df3b9['getAgents'](_0x745bb);}})['then'](function(_0x517eb6){if(_0x517eb6){return _0x517eb6?{'count':_0x24c36d,'rows':_0x517eb6}:null;}})[_0x1e34('0x36')](respondWithResult(_0x4f149c,null))[_0x1e34('0x5a')](handleError(_0x4f149c,null));}; \ No newline at end of file +var _0xdd16=['getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','http','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','offset','count','set','Content-Range','save','update','then','destroy','get','SmsAccounts','UserProfileResource','end','name','send','SmsAccount','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','includeAll','findAll','show','params','Pause','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','SmsAccountId','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','fields','order','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','MessageSid','skebby','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','close','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','json','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','List','ListId','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','intelepeer','statusGet','state','csc','addAgents','emit','removeAgents','isArray'];(function(_0x3ac4cf,_0x3cfd64){var _0x45db11=function(_0x382511){while(--_0x382511){_0x3ac4cf['push'](_0x3ac4cf['shift']());}};_0x45db11(++_0x3cfd64);}(_0xdd16,0xe0));var _0x6dd1=function(_0x2e79a3,_0x5a3479){_0x2e79a3=_0x2e79a3-0x0;var _0x20d48a=_0xdd16[_0x2e79a3];return _0x20d48a;};'use strict';var emlformat=require(_0x6dd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dd1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dd1('0x2'));var moment=require(_0x6dd1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6dd1('0x4'));var util=require(_0x6dd1('0x5'));var path=require('path');var sox=require(_0x6dd1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dd1('0x7'));var _=require(_0x6dd1('0x8'));var squel=require('squel');var crypto=require(_0x6dd1('0x9'));var jsforce=require(_0x6dd1('0xa'));var deskjs=require(_0x6dd1('0xb'));var toCsv=require(_0x6dd1('0xc'));var querystring=require(_0x6dd1('0xd'));var Papa=require('papaparse');var Redis=require(_0x6dd1('0xe'));var authService=require(_0x6dd1('0xf'));var qs=require(_0x6dd1('0x10'));var as=require(_0x6dd1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dd1('0x12'))(_0x6dd1('0x13'));var utils=require(_0x6dd1('0x14'));var config=require(_0x6dd1('0x15'));var licenseUtil=require(_0x6dd1('0x16'));var db=require('../../mysqldb')['db'];config[_0x6dd1('0x17')]=_[_0x6dd1('0x18')](config[_0x6dd1('0x17')],{'host':_0x6dd1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6dd1('0x17')]));require(_0x6dd1('0x1a'))['register'](socket);var jayson=require(_0x6dd1('0x1b'));var client=jayson[_0x6dd1('0x1c')][_0x6dd1('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x18d053,_0x580806,_0xc702ec,_0x539b46){return new BPromise(function(_0xd968c1,_0x246bb8){var _0xdd01dc=_0x539b46||client;return _0xdd01dc['request'](_0x18d053,_0xc702ec)['then'](function(_0x1fb4d8){logger['info'](_0x6dd1('0x1e'),_0x580806,_0x6dd1('0x1f'));logger[_0x6dd1('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x580806,_0x6dd1('0x1f'),JSON[_0x6dd1('0x21')](_0x1fb4d8));if(_0x1fb4d8[_0x6dd1('0x22')]){if(_0x1fb4d8['error'][_0x6dd1('0x23')]===0x1f4){logger[_0x6dd1('0x22')](_0x6dd1('0x1e'),_0x580806,_0x1fb4d8[_0x6dd1('0x22')][_0x6dd1('0x24')]);return _0x246bb8(_0x1fb4d8['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x580806,_0x1fb4d8[_0x6dd1('0x22')][_0x6dd1('0x24')]);return _0xd968c1(_0x1fb4d8[_0x6dd1('0x22')][_0x6dd1('0x24')]);}else{logger[_0x6dd1('0x25')](_0x6dd1('0x1e'),_0x580806,_0x6dd1('0x1f'));_0xd968c1(_0x1fb4d8[_0x6dd1('0x26')][_0x6dd1('0x24')]);}})[_0x6dd1('0x27')](function(_0x230884){logger[_0x6dd1('0x22')](_0x6dd1('0x1e'),_0x580806,_0x230884);_0x246bb8(_0x230884);});});}function respondWithStatusCode(_0xabc5dc,_0x1466d2){_0x1466d2=_0x1466d2||0xcc;return function(_0x4ef8bd){if(_0x4ef8bd){return _0xabc5dc[_0x6dd1('0x28')](_0x1466d2);}return _0xabc5dc[_0x6dd1('0x29')](_0x1466d2)['end']();};}function respondWithResult(_0x51bcd9,_0x2148a4){_0x2148a4=_0x2148a4||0xc8;return function(_0x5c3121){if(_0x5c3121){return _0x51bcd9[_0x6dd1('0x29')](_0x2148a4)['json'](_0x5c3121);}};}function respondWithFilteredResult(_0x420682,_0x31feb1){return function(_0x51e299){if(_0x51e299){var _0x50e023=typeof _0x31feb1[_0x6dd1('0x2a')]==='undefined'&&typeof _0x31feb1['limit']==='undefined';var _0x132349=_0x51e299[_0x6dd1('0x2b')];var _0x475049=_0x50e023?0x0:_0x31feb1[_0x6dd1('0x2a')];var _0x2eb5cc=_0x50e023?_0x51e299['count']:_0x31feb1[_0x6dd1('0x2a')]+_0x31feb1['limit'];var _0x30622a;if(_0x2eb5cc>=_0x132349){_0x2eb5cc=_0x132349;_0x30622a=0xc8;}else{_0x30622a=0xce;}_0x420682[_0x6dd1('0x29')](_0x30622a);return _0x420682[_0x6dd1('0x2c')](_0x6dd1('0x2d'),_0x475049+'-'+_0x2eb5cc+'/'+_0x132349)['json'](_0x51e299);}return null;};}function patchUpdates(_0x4d2645){return function(_0x3bfa42){try{jsonpatch['apply'](_0x3bfa42,_0x4d2645,!![]);}catch(_0xe51e51){return BPromise['reject'](_0xe51e51);}return _0x3bfa42[_0x6dd1('0x2e')]();};}function saveUpdates(_0xc1bd14,_0x4fd80d){return function(_0x50a3ae){if(_0x50a3ae){return _0x50a3ae[_0x6dd1('0x2f')](_0xc1bd14)[_0x6dd1('0x30')](function(_0x2ff268){return _0x2ff268;});}return null;};}function removeEntity(_0xd42f61,_0x3d6283){return function(_0x13d124){if(_0x13d124){return _0x13d124[_0x6dd1('0x31')]()['then'](function(){var _0x4b7d60=_0x13d124[_0x6dd1('0x32')]({'plain':!![]});var _0x69fff5=_0x6dd1('0x33');return db[_0x6dd1('0x34')][_0x6dd1('0x31')]({'where':{'type':_0x69fff5,'resourceId':_0x4b7d60['id']}})[_0x6dd1('0x30')](function(){return _0x13d124;});})['then'](function(){_0xd42f61[_0x6dd1('0x29')](0xcc)[_0x6dd1('0x35')]();});}};}function handleEntityNotFound(_0xe6fa7c,_0x614c4c){return function(_0x52add5){if(!_0x52add5){_0xe6fa7c[_0x6dd1('0x28')](0x194);}return _0x52add5;};}function handleError(_0x22b7a0,_0x58525d){_0x58525d=_0x58525d||0x1f4;return function(_0x85e1bf){logger[_0x6dd1('0x22')](_0x85e1bf['stack']);if(_0x85e1bf['name']){delete _0x85e1bf[_0x6dd1('0x36')];}_0x22b7a0[_0x6dd1('0x29')](_0x58525d)[_0x6dd1('0x37')](_0x85e1bf);};}exports['index']=function(_0x3b92c1,_0x5c66b7){var _0x286259={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4b51fc={},_0x1cfa45={'count':0x0,'rows':[]};var _0x16615a=_['map'](db[_0x6dd1('0x38')][_0x6dd1('0x39')],function(_0x24a337){return{'name':_0x24a337[_0x6dd1('0x3a')],'type':_0x24a337[_0x6dd1('0x3b')][_0x6dd1('0x3c')]};});_0x4b51fc['model']=_[_0x6dd1('0x3d')](_0x16615a,_0x6dd1('0x36'));_0x4b51fc['query']=_[_0x6dd1('0x3e')](_0x3b92c1[_0x6dd1('0x3f')]);_0x4b51fc[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x4b51fc[_0x6dd1('0x42')],_0x4b51fc[_0x6dd1('0x3f')]);_0x286259[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x4b51fc[_0x6dd1('0x42')],qs['fields'](_0x3b92c1[_0x6dd1('0x3f')]['fields']));_0x286259[_0x6dd1('0x43')]=_0x286259['attributes'][_0x6dd1('0x44')]?_0x286259[_0x6dd1('0x43')]:_0x4b51fc[_0x6dd1('0x42')];if(!_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x45')](_0x6dd1('0x46'))){_0x286259['limit']=qs[_0x6dd1('0x47')](_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x47')]);_0x286259[_0x6dd1('0x2a')]=qs[_0x6dd1('0x2a')](_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x2a')]);}_0x286259['order']=qs[_0x6dd1('0x48')](_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x48')]);_0x286259['where']=qs[_0x6dd1('0x40')](_[_0x6dd1('0x49')](_0x3b92c1[_0x6dd1('0x3f')],_0x4b51fc[_0x6dd1('0x40')]),_0x16615a);if(_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x4a')]){_0x286259['where']=_[_0x6dd1('0x4b')](_0x286259['where'],{'$or':_[_0x6dd1('0x3d')](_0x16615a,function(_0xc0e6ab){if(_0xc0e6ab['type']!=='VIRTUAL'){var _0x412320={};_0x412320[_0xc0e6ab['name']]={'$like':'%'+_0x3b92c1['query'][_0x6dd1('0x4a')]+'%'};return _0x412320;}})});}_0x286259=_[_0x6dd1('0x4b')]({},_0x286259,_0x3b92c1['options']);var _0x58d723={'where':_0x286259[_0x6dd1('0x4c')]};return db[_0x6dd1('0x38')][_0x6dd1('0x2b')](_0x58d723)['then'](function(_0x9601d3){_0x1cfa45[_0x6dd1('0x2b')]=_0x9601d3;if(_0x3b92c1[_0x6dd1('0x3f')][_0x6dd1('0x4d')]){_0x286259['include']=[{'all':!![]}];}return db[_0x6dd1('0x38')][_0x6dd1('0x4e')](_0x286259);})[_0x6dd1('0x30')](function(_0x213a52){_0x1cfa45['rows']=_0x213a52;return _0x1cfa45;})[_0x6dd1('0x30')](respondWithFilteredResult(_0x5c66b7,_0x286259))[_0x6dd1('0x27')](handleError(_0x5c66b7,null));};exports[_0x6dd1('0x4f')]=function(_0x5be8e7,_0x99ce3a){var _0x4276eb={'raw':![],'where':{'id':_0x5be8e7[_0x6dd1('0x50')]['id']},'include':[{'model':db[_0x6dd1('0x51')],'as':'mandatoryDispositionPause'}]},_0x33fb62={};_0x33fb62[_0x6dd1('0x42')]=_[_0x6dd1('0x3e')](db['SmsAccount']['rawAttributes']);_0x33fb62[_0x6dd1('0x3f')]=_[_0x6dd1('0x3e')](_0x5be8e7[_0x6dd1('0x3f')]);_0x33fb62[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x33fb62[_0x6dd1('0x42')],_0x33fb62[_0x6dd1('0x3f')]);_0x4276eb[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x33fb62[_0x6dd1('0x42')],qs['fields'](_0x5be8e7[_0x6dd1('0x3f')]['fields']));_0x4276eb[_0x6dd1('0x43')]=_0x4276eb[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x4276eb['attributes']:_0x33fb62[_0x6dd1('0x42')];if(_0x5be8e7[_0x6dd1('0x3f')][_0x6dd1('0x4d')]){_0x4276eb[_0x6dd1('0x52')]=[{'all':!![]}];}_0x4276eb=_[_0x6dd1('0x4b')]({},_0x4276eb,_0x5be8e7[_0x6dd1('0x53')]);return db[_0x6dd1('0x38')]['find'](_0x4276eb)[_0x6dd1('0x30')](handleEntityNotFound(_0x99ce3a,null))['then'](respondWithResult(_0x99ce3a,null))[_0x6dd1('0x27')](handleError(_0x99ce3a,null));};exports[_0x6dd1('0x54')]=function(_0x579099,_0x30a799){return db[_0x6dd1('0x38')]['create'](_0x579099['body'],{})[_0x6dd1('0x30')](function(_0x43e275){var _0x257dad=_0x579099[_0x6dd1('0x55')][_0x6dd1('0x32')]({'plain':!![]});if(!_0x257dad)throw new Error(_0x6dd1('0x56'));if(_0x257dad[_0x6dd1('0x57')]===_0x6dd1('0x55')){var _0x3d243c=_0x43e275[_0x6dd1('0x32')]({'plain':!![]});var _0x3b69b2=_0x6dd1('0x33');return db['UserProfileSection'][_0x6dd1('0x58')]({'where':{'name':_0x3b69b2,'userProfileId':_0x257dad[_0x6dd1('0x59')]},'raw':!![]})[_0x6dd1('0x30')](function(_0x11acd5){if(_0x11acd5&&_0x11acd5[_0x6dd1('0x5a')]===0x0){return db[_0x6dd1('0x34')][_0x6dd1('0x54')]({'name':_0x3d243c['name'],'resourceId':_0x3d243c['id'],'type':_0x11acd5[_0x6dd1('0x36')],'sectionId':_0x11acd5['id']},{})[_0x6dd1('0x30')](function(){return _0x43e275;});}else{return _0x43e275;}})[_0x6dd1('0x27')](function(_0x3a2150){logger[_0x6dd1('0x22')](_0x6dd1('0x5b'),_0x3a2150);throw _0x3a2150;});}return _0x43e275;})[_0x6dd1('0x30')](respondWithResult(_0x30a799,0xc9))[_0x6dd1('0x27')](handleError(_0x30a799,null));};exports[_0x6dd1('0x2f')]=function(_0x2a38f0,_0x53e581){if(_0x2a38f0[_0x6dd1('0x5c')]['id']){delete _0x2a38f0[_0x6dd1('0x5c')]['id'];}return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x2a38f0['params']['id']},'include':[{'model':db[_0x6dd1('0x51')],'as':_0x6dd1('0x5d')}]})[_0x6dd1('0x30')](handleEntityNotFound(_0x53e581,null))[_0x6dd1('0x30')](saveUpdates(_0x2a38f0[_0x6dd1('0x5c')],null))[_0x6dd1('0x30')](respondWithResult(_0x53e581,null))[_0x6dd1('0x27')](handleError(_0x53e581,null));};exports[_0x6dd1('0x31')]=function(_0xea2a29,_0x4b85e6){return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0xea2a29[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x4b85e6,null))[_0x6dd1('0x30')](removeEntity(_0x4b85e6,null))[_0x6dd1('0x27')](handleError(_0x4b85e6,null));};exports['describe']=function(_0x5d68e3,_0x203692){return db['SmsAccount'][_0x6dd1('0x5e')]()[_0x6dd1('0x30')](respondWithResult(_0x203692,null))[_0x6dd1('0x27')](handleError(_0x203692,null));};exports[_0x6dd1('0x5f')]=function(_0xf51da6,_0x4a1f31,_0xfabd9e){if(_0xf51da6[_0x6dd1('0x5c')]['id']){delete _0xf51da6[_0x6dd1('0x5c')]['id'];}return db['SmsAccount'][_0x6dd1('0x58')]({'where':{'id':_0xf51da6[_0x6dd1('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a1f31,null))['then'](function(_0x19ceb2){if(_0x19ceb2){_0xf51da6[_0x6dd1('0x5c')][_0x6dd1('0x60')]=_0x19ceb2['id'];return db[_0x6dd1('0x61')][_0x6dd1('0x54')](_0xf51da6['body']);}})[_0x6dd1('0x30')](respondWithResult(_0x4a1f31,null))['catch'](handleError(_0x4a1f31,null));};exports['getDispositions']=function(_0x52349f,_0x3feeaf,_0x50470f){var _0x5ea012={'raw':![],'where':{}};var _0x6f517d={};var _0xeecebf={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6dd1('0x62')]({'where':{'id':_0x52349f[_0x6dd1('0x50')]['id']}})['then'](handleEntityNotFound(_0x3feeaf,null))[_0x6dd1('0x30')](function(_0x4f77a4){if(_0x4f77a4){_0x6f517d[_0x6dd1('0x42')]=_[_0x6dd1('0x3e')](db[_0x6dd1('0x61')][_0x6dd1('0x39')]);_0x6f517d[_0x6dd1('0x3f')]=_['keys'](_0x52349f[_0x6dd1('0x3f')]);_0x6f517d[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x6f517d[_0x6dd1('0x42')],_0x6f517d[_0x6dd1('0x3f')]);_0x5ea012[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x6f517d[_0x6dd1('0x42')],qs['fields'](_0x52349f[_0x6dd1('0x3f')]['fields']));_0x5ea012[_0x6dd1('0x43')]=_0x5ea012[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x5ea012[_0x6dd1('0x43')]:_0x6f517d[_0x6dd1('0x42')];if(!_0x52349f[_0x6dd1('0x3f')][_0x6dd1('0x45')](_0x6dd1('0x46'))){_0x5ea012[_0x6dd1('0x47')]=qs[_0x6dd1('0x47')](_0x52349f['query'][_0x6dd1('0x47')]);_0x5ea012[_0x6dd1('0x2a')]=qs[_0x6dd1('0x2a')](_0x52349f[_0x6dd1('0x3f')][_0x6dd1('0x2a')]);}_0x5ea012['order']=qs['sort'](_0x52349f[_0x6dd1('0x3f')][_0x6dd1('0x48')]);_0x5ea012[_0x6dd1('0x4c')]=qs[_0x6dd1('0x40')](_[_0x6dd1('0x49')](_0x52349f['query'],_0x6f517d[_0x6dd1('0x40')]));_0x5ea012['where'][_0x6dd1('0x60')]=_0x4f77a4['id'];if(_0x52349f[_0x6dd1('0x3f')][_0x6dd1('0x4a')]){_0x5ea012['where']=_[_0x6dd1('0x4b')](_0x5ea012[_0x6dd1('0x4c')],{'$or':_[_0x6dd1('0x3d')](_0x5ea012[_0x6dd1('0x43')],function(_0x25e614){var _0x1e5b4a={};_0x1e5b4a[_0x25e614]={'$like':'%'+_0x52349f[_0x6dd1('0x3f')][_0x6dd1('0x4a')]+'%'};return _0x1e5b4a;})});}_0x5ea012=_[_0x6dd1('0x4b')]({},_0x5ea012,_0x52349f[_0x6dd1('0x53')]);return db[_0x6dd1('0x61')][_0x6dd1('0x2b')]({'where':_0x5ea012['where']})['then'](function(_0x5e16b2){_0xeecebf[_0x6dd1('0x2b')]=_0x5e16b2;if(_0x52349f[_0x6dd1('0x3f')]['includeAll']){_0x5ea012['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5ea012);})['then'](function(_0x221886){_0xeecebf[_0x6dd1('0x63')]=_0x221886;return _0xeecebf;});}})[_0x6dd1('0x30')](respondWithFilteredResult(_0x3feeaf,_0x5ea012))[_0x6dd1('0x27')](handleError(_0x3feeaf,null));};exports[_0x6dd1('0x64')]=function(_0x1018a0,_0x587bcd,_0x1a986c){return db[_0x6dd1('0x38')]['find']({'where':{'id':_0x1018a0[_0x6dd1('0x50')]['id']}})['then'](handleEntityNotFound(_0x587bcd,null))[_0x6dd1('0x30')](function(_0x4dbf8f){if(_0x4dbf8f){return _0x4dbf8f[_0x6dd1('0x64')](_0x1018a0[_0x6dd1('0x3f')][_0x6dd1('0x65')]);}})[_0x6dd1('0x30')](respondWithStatusCode(_0x587bcd,null))[_0x6dd1('0x27')](handleError(_0x587bcd,null));};exports[_0x6dd1('0x66')]=function(_0x64f32e,_0x49a6a8,_0x27771b){if(_0x64f32e['body']['id']){delete _0x64f32e[_0x6dd1('0x5c')]['id'];}return db['SmsAccount'][_0x6dd1('0x58')]({'where':{'id':_0x64f32e[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x49a6a8,null))['then'](function(_0x1c846a){if(_0x1c846a){_0x64f32e[_0x6dd1('0x5c')]['SmsAccountId']=_0x1c846a['id'];return db[_0x6dd1('0x67')][_0x6dd1('0x54')](_0x64f32e[_0x6dd1('0x5c')]);}})['then'](respondWithResult(_0x49a6a8,null))[_0x6dd1('0x27')](handleError(_0x49a6a8,null));};exports[_0x6dd1('0x68')]=function(_0x4f2f4d,_0x50f302,_0x268cd6){var _0x466faa={'raw':![],'where':{}};var _0x3489bf={};var _0x463e9b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6dd1('0x62')]({'where':{'id':_0x4f2f4d[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x50f302,null))[_0x6dd1('0x30')](function(_0xade58f){if(_0xade58f){_0x3489bf['model']=_[_0x6dd1('0x3e')](db[_0x6dd1('0x67')][_0x6dd1('0x39')]);_0x3489bf[_0x6dd1('0x3f')]=_[_0x6dd1('0x3e')](_0x4f2f4d['query']);_0x3489bf[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x3489bf['model'],_0x3489bf[_0x6dd1('0x3f')]);_0x466faa[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x3489bf[_0x6dd1('0x42')],qs[_0x6dd1('0x69')](_0x4f2f4d[_0x6dd1('0x3f')]['fields']));_0x466faa[_0x6dd1('0x43')]=_0x466faa[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x466faa[_0x6dd1('0x43')]:_0x3489bf[_0x6dd1('0x42')];if(!_0x4f2f4d[_0x6dd1('0x3f')][_0x6dd1('0x45')](_0x6dd1('0x46'))){_0x466faa[_0x6dd1('0x47')]=qs[_0x6dd1('0x47')](_0x4f2f4d[_0x6dd1('0x3f')][_0x6dd1('0x47')]);_0x466faa[_0x6dd1('0x2a')]=qs[_0x6dd1('0x2a')](_0x4f2f4d[_0x6dd1('0x3f')][_0x6dd1('0x2a')]);}_0x466faa[_0x6dd1('0x6a')]=qs[_0x6dd1('0x48')](_0x4f2f4d[_0x6dd1('0x3f')]['sort']);_0x466faa[_0x6dd1('0x4c')]=qs[_0x6dd1('0x40')](_[_0x6dd1('0x49')](_0x4f2f4d[_0x6dd1('0x3f')],_0x3489bf[_0x6dd1('0x40')]));_0x466faa[_0x6dd1('0x4c')][_0x6dd1('0x60')]=_0xade58f['id'];if(_0x4f2f4d[_0x6dd1('0x3f')]['filter']){_0x466faa[_0x6dd1('0x4c')]=_[_0x6dd1('0x4b')](_0x466faa[_0x6dd1('0x4c')],{'$or':_['map'](_0x466faa[_0x6dd1('0x43')],function(_0x36557c){var _0x2b2e03={};_0x2b2e03[_0x36557c]={'$like':'%'+_0x4f2f4d['query']['filter']+'%'};return _0x2b2e03;})});}_0x466faa=_['merge']({},_0x466faa,_0x4f2f4d[_0x6dd1('0x53')]);return db[_0x6dd1('0x67')]['count']({'where':_0x466faa[_0x6dd1('0x4c')]})['then'](function(_0x22c4ce){_0x463e9b['count']=_0x22c4ce;if(_0x4f2f4d['query'][_0x6dd1('0x4d')]){_0x466faa[_0x6dd1('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x466faa);})[_0x6dd1('0x30')](function(_0x3ab46e){_0x463e9b[_0x6dd1('0x63')]=_0x3ab46e;return _0x463e9b;});}})[_0x6dd1('0x30')](respondWithFilteredResult(_0x50f302,_0x466faa))[_0x6dd1('0x27')](handleError(_0x50f302,null));};exports[_0x6dd1('0x6b')]=function(_0x53009b,_0x560d95,_0x5cc744){return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x53009b['params']['id']}})['then'](handleEntityNotFound(_0x560d95,null))['then'](function(_0x538542){if(_0x538542){return _0x538542[_0x6dd1('0x6b')](_0x53009b[_0x6dd1('0x3f')][_0x6dd1('0x65')]);}})[_0x6dd1('0x30')](respondWithStatusCode(_0x560d95,null))['catch'](handleError(_0x560d95,null));};exports[_0x6dd1('0x6c')]=function(_0x1a4adb,_0x3176d0,_0x58006c){var _0x4d6dcf={'channel':_0x6dd1('0x6d')};var _0x3f9cb5=[];var _0x1af8c5=[];var _0x33b3b4={};return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x1a4adb[_0x6dd1('0x50')]['id']},'include':[{'model':db[_0x6dd1('0x6e')],'as':_0x6dd1('0x6f')}]})['then'](handleEntityNotFound(_0x3176d0,null))[_0x6dd1('0x30')](function(_0x40256b){_0x4d6dcf[_0x6dd1('0x70')]=_0x40256b;_0x4d6dcf[_0x6dd1('0x71')]=_['orderBy'](_0x40256b[_0x6dd1('0x6f')],[_0x6dd1('0x72')],[_0x6dd1('0x73')]);if(_0x4d6dcf[_0x6dd1('0x70')][_0x6dd1('0x6f')]){delete _0x4d6dcf[_0x6dd1('0x70')]['Applications'];}return db['CmContact'][_0x6dd1('0x5e')]();})[_0x6dd1('0x30')](function(_0x26b290){if(!_0x26b290){throw new db[(_0x6dd1('0x74'))]['ValidationError'](_0x6dd1('0x75'));}_0x3f9cb5=_[_0x6dd1('0x76')](_[_0x6dd1('0x3e')](_0x26b290),['createdAt',_0x6dd1('0x77')]);_0x1af8c5=_[_0x6dd1('0x76')](_[_0x6dd1('0x3e')](_0x26b290),[_0x6dd1('0x78'),_0x6dd1('0x77'),_0x6dd1('0x79'),'ListId']);_0x4d6dcf['body']={'mapKey':_0x6dd1('0x7a')};if(_0x4d6dcf[_0x6dd1('0x70')]['type']){switch(_0x4d6dcf['account'][_0x6dd1('0x3b')]){case _0x6dd1('0x7b'):_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')]['From'];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x5c')]=_0x1a4adb[_0x6dd1('0x5c')]['Body'];_0x4d6dcf['body']['messageId']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x7d')];break;case _0x6dd1('0x7e'):_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]='+'+_0x1a4adb[_0x6dd1('0x5c')]['sender'];_0x4d6dcf['body'][_0x6dd1('0x5c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x7f')];break;case _0x6dd1('0x80'):_0x4d6dcf['body'][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x7c')];_0x4d6dcf[_0x6dd1('0x5c')]['body']=_0x1a4adb[_0x6dd1('0x5c')]['message'];break;case _0x6dd1('0x81'):_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')]['from'];_0x4d6dcf['body']['body']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x5c')];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x82')]=_0x1a4adb['body'][_0x6dd1('0x83')];break;case _0x6dd1('0x84'):_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')]['From'];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x5c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x85')];_0x4d6dcf[_0x6dd1('0x5c')]['messageId']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x86')];break;case _0x6dd1('0x87'):_0x4d6dcf[_0x6dd1('0x5c')]['from']='+'+_0x1a4adb['body'][_0x6dd1('0x88')][0x0][_0x6dd1('0x7c')];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x5c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x88')][0x0][_0x6dd1('0x7f')];_0x4d6dcf['body'][_0x6dd1('0x82')]=_0x1a4adb[_0x6dd1('0x5c')]['results'][0x0][_0x6dd1('0x82')];break;case'csc':_0x4d6dcf[_0x6dd1('0x5c')]['from']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x89')];_0x4d6dcf['body']['body']=_0x1a4adb['body'][_0x6dd1('0x8a')][_0x6dd1('0x24')];break;case _0x6dd1('0x8b'):_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x8c')];_0x4d6dcf['body']['body']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x7f')];_0x4d6dcf['body'][_0x6dd1('0x82')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x8d')];break;case _0x6dd1('0x8e'):_0x4d6dcf[_0x6dd1('0x5c')]['messageId']=_0x1a4adb[_0x6dd1('0x5c')][0x0][_0x6dd1('0x24')]['id'];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')][0x0][_0x6dd1('0x24')][_0x6dd1('0x7c')];_0x4d6dcf[_0x6dd1('0x5c')]['body']=_0x1a4adb[_0x6dd1('0x5c')][0x0][_0x6dd1('0x24')]['text'];break;case'intelepeer':_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x7c')];_0x4d6dcf[_0x6dd1('0x5c')]['body']=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x24')];_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x82')]=_0x1a4adb[_0x6dd1('0x5c')][_0x6dd1('0x8f')];break;}}if(_0x4d6dcf[_0x6dd1('0x5c')]['id']){delete _0x4d6dcf[_0x6dd1('0x5c')]['id'];}if(_[_0x6dd1('0x90')](_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')])){throw new db[(_0x6dd1('0x74'))]['ValidationError'](_0x6dd1('0x91'));}if(_['isNil'](_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x5c')])||_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x5c')]===''){throw new db['Sequelize'][(_0x6dd1('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6dd1('0x90')](_0x4d6dcf[_0x6dd1('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x6dd1('0x92'))](_0x6dd1('0x93')+_0x1af8c5);}if(!_[_0x6dd1('0x94')](_0x1af8c5,_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x95')])){throw new db[(_0x6dd1('0x74'))][(_0x6dd1('0x92'))](_0x6dd1('0x96')+_0x1af8c5);}_0x33b3b4[_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x95')]]=_0x4d6dcf['body'][_0x6dd1('0x7c')];return db[_0x6dd1('0x97')][_0x6dd1('0x58')]({'where':{'id':_0x4d6dcf['account']['ListId']},'include':[{'model':db[_0x6dd1('0x98')],'as':_0x6dd1('0x99'),'where':_0x33b3b4,'limit':0x1,'order':[[_0x6dd1('0x77'),_0x6dd1('0x9a')]]}]});})[_0x6dd1('0x30')](handleEntityNotFound(_0x3176d0,null))[_0x6dd1('0x30')](function(_0x189aa3){if(_0x189aa3){_0x4d6dcf[_0x6dd1('0x9b')]=_[_0x6dd1('0x9c')](_0x189aa3,[_0x6dd1('0x99')]);if(_0x189aa3[_0x6dd1('0x99')][_0x6dd1('0x44')]){return _0x189aa3[_0x6dd1('0x99')][0x0];}var _0x30c9f1=_['defaults'](_0x4d6dcf[_0x6dd1('0x5c')],{'firstName':_0x4d6dcf['body'][_0x6dd1('0x7c')],'ListId':_0x189aa3['id']});_0x30c9f1[_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x95')]]=_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')];return db[_0x6dd1('0x98')]['create'](_0x30c9f1,{'fields':_0x3f9cb5,'raw':!![]});}})['then'](handleEntityNotFound(_0x3176d0,null))[_0x6dd1('0x30')](function(_0x429875){if(_0x429875){_0x4d6dcf['contact']=_0x429875;var _0x418768={'ContactId':_0x429875['id'],'phone':_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x7c')],'SmsAccountId':_0x1a4adb[_0x6dd1('0x50')]['id']};var _0x442aee={'ContactId':_0x429875['id'],'SmsAccountId':_0x1a4adb[_0x6dd1('0x50')]['id'],'closed':![]};return db[_0x6dd1('0x9d')][_0x6dd1('0x58')]({'where':_0x442aee})[_0x6dd1('0x30')](function(_0x4032b2){if(_0x4032b2){return[_0x4032b2,![]];}return db[_0x6dd1('0x9d')][_0x6dd1('0x54')](_0x418768)['then'](function(_0x23d2d4){return[_0x23d2d4,!![]];});});}})[_0x6dd1('0x9e')](function(_0x354e10,_0x53915e){_0x4d6dcf['interaction']=_0x354e10[_0x6dd1('0x32')]({'plain':!![]});_0x4d6dcf[_0x6dd1('0x9f')][_0x6dd1('0xa0')]=![];if(_0x53915e){if(_0x4d6dcf[_0x6dd1('0x70')][_0x6dd1('0xa1')]){_0x4d6dcf['applications']['push']({'id':0x0,'priority':_0x4d6dcf[_0x6dd1('0x71')][_0x6dd1('0x44')]+0x1,'app':_0x6dd1('0xa2'),'appdata':'unmanaged','interval':_0x6dd1('0xa3')});}_0x4d6dcf[_0x6dd1('0x9f')][_0x6dd1('0xa0')]=!![];}return db[_0x6dd1('0xa4')]['create']({'phone':_0x4d6dcf[_0x6dd1('0x5c')]['from'],'messageId':_0x4d6dcf[_0x6dd1('0x5c')][_0x6dd1('0x82')],'body':_0x4d6dcf[_0x6dd1('0x5c')]['body'],'SmsAccountId':_0x1a4adb[_0x6dd1('0x50')]['id'],'SmsInteractionId':_0x354e10['id'],'direction':'in','ContactId':_0x354e10[_0x6dd1('0xa5')],'AttachmentId':_0x4d6dcf['body']['AttachmentId']});})['then'](function(_0x4aaed9){_0x4d6dcf['message']=_0x4aaed9;if(_0x4d6dcf[_0x6dd1('0x9f')][_0x6dd1('0xa6')]){return db[_0x6dd1('0xa7')][_0x6dd1('0x58')]({'attributes':['id',_0x6dd1('0x36')],'where':{'id':_0x4d6dcf[_0x6dd1('0x9f')][_0x6dd1('0xa6')]}})['then'](function(_0xd31dbd){if(_0xd31dbd){_0x4d6dcf['applications'][_0x6dd1('0xa8')]({'id':0x0,'priority':0x0,'app':_0x6dd1('0xa9'),'appdata':_0xd31dbd[_0x6dd1('0x36')]+','+(_0x4d6dcf[_0x6dd1('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0x6dd1('0xa3')});}return respondWithRpcPromise(_0x6dd1('0xaa'),_0x6dd1('0xab'),_0x4d6dcf);});}return respondWithRpcPromise(_0x6dd1('0xaa'),_0x6dd1('0xab'),_0x4d6dcf);})[_0x6dd1('0x30')](function(_0x54898b){if(_0x54898b){var _0x45c5b4=0xc8;var _0x3f6d83='receiveMessage';logger[_0x6dd1('0x25')](_0x6dd1('0xac'),_0x3f6d83,_0x45c5b4,_0x6dd1('0xad'));logger[_0x6dd1('0x20')](_0x6dd1('0xae'),_0x3f6d83,_0x45c5b4,'entity\x20found',JSON['stringify'](_0x54898b));if(_0x4d6dcf[_0x6dd1('0x70')][_0x6dd1('0x3b')]==='twilio'){return _0x3176d0[_0x6dd1('0x29')](_0x45c5b4)['set'](_0x6dd1('0xaf'),_0x6dd1('0xb0'))[_0x6dd1('0x37')](_0x6dd1('0xb1'));}else{return _0x3176d0[_0x6dd1('0x29')](_0x45c5b4)['json'](_0x54898b);}}})['catch'](handleError(_0x3176d0,null));};exports[_0x6dd1('0xb2')]=function(_0x53f3fc,_0x1c677e){var _0x2b30c5=_0x53f3fc[_0x6dd1('0x50')]['id'];var _0x350b68=_0x53f3fc[_0x6dd1('0x5c')];var _0x89566c=0xc8;var _0x578827=null;return db[_0x6dd1('0xb3')]['transaction']({'isolationLevel':db[_0x6dd1('0xb3')][_0x6dd1('0xb4')][_0x6dd1('0xb5')][_0x6dd1('0xb6')]},function(_0x321d7d){return db[_0x6dd1('0x38')]['findOne']({'where':{'id':_0x2b30c5},'transaction':_0x321d7d})[_0x6dd1('0x30')](function(_0x3e0d46){if(_0x3e0d46){return db[_0x6dd1('0x6e')][_0x6dd1('0x31')]({'where':{'SmsAccountId':_0x2b30c5},'transaction':_0x321d7d})['then'](function(){var _0x2f6e56=_[_0x6dd1('0x3d')](_0x350b68,function(_0x110f9e){_0x110f9e[_0x6dd1('0x60')]=_0x2b30c5;return _0x110f9e;});return db[_0x6dd1('0x6e')]['bulkCreate'](_0x2f6e56,{'transaction':_0x321d7d});});}else{_0x89566c=0x194;_0x578827=[];}});})[_0x6dd1('0x30')](function(){if(_0x89566c!==0x194){return db[_0x6dd1('0x6e')][_0x6dd1('0xb7')]({'where':{'SmsAccountId':_0x2b30c5},'order':_0x6dd1('0x72')})[_0x6dd1('0x30')](function(_0x349432){_0x578827=_0x349432;});}})['catch'](function(_0x574086){_0x89566c=0x1f4;logger[_0x6dd1('0x22')](_0x574086[_0x6dd1('0xb8')]);if(_0x574086['name']){delete _0x574086[_0x6dd1('0x36')];}_0x578827=_0x574086;})[_0x6dd1('0xb9')](function(){if(_0x578827===null){_0x1c677e[_0x6dd1('0x28')](_0x89566c);}else{if(_0x89566c===0x1f4){_0x1c677e[_0x6dd1('0x29')](_0x89566c)[_0x6dd1('0x37')](_0x578827);}else{_0x1c677e[_0x6dd1('0x29')](_0x89566c)[_0x6dd1('0xba')](_0x578827);}}});};exports[_0x6dd1('0xbb')]=function(_0x3324dd,_0xcb7744,_0x4398d6){var _0x56faef={};var _0x42f6ad={};var _0x415773;var _0xf63c73;return db['SmsAccount']['findOne']({'where':{'id':_0x3324dd[_0x6dd1('0x50')]['id']}})['then'](handleEntityNotFound(_0xcb7744,null))[_0x6dd1('0x30')](function(_0x2546f0){if(_0x2546f0){_0x415773=_0x2546f0;_0x42f6ad[_0x6dd1('0x42')]=_[_0x6dd1('0x3e')](db[_0x6dd1('0x6e')][_0x6dd1('0x39')]);_0x42f6ad[_0x6dd1('0x3f')]=_[_0x6dd1('0x3e')](_0x3324dd[_0x6dd1('0x3f')]);_0x42f6ad[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x42f6ad[_0x6dd1('0x42')],_0x42f6ad[_0x6dd1('0x3f')]);_0x56faef[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x42f6ad['model'],qs['fields'](_0x3324dd[_0x6dd1('0x3f')]['fields']));_0x56faef[_0x6dd1('0x43')]=_0x56faef[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x56faef['attributes']:_0x42f6ad[_0x6dd1('0x42')];_0x56faef[_0x6dd1('0x6a')]=qs['sort'](_0x3324dd[_0x6dd1('0x3f')][_0x6dd1('0x48')]);_0x56faef[_0x6dd1('0x4c')]=qs['filters'](_['pick'](_0x3324dd[_0x6dd1('0x3f')],_0x42f6ad['filters']));if(_0x3324dd['query'][_0x6dd1('0x4a')]){_0x56faef[_0x6dd1('0x4c')]=_[_0x6dd1('0x4b')](_0x56faef[_0x6dd1('0x4c')],{'$or':_[_0x6dd1('0x3d')](_0x56faef[_0x6dd1('0x43')],function(_0x405f4f){var _0x269191={};_0x269191[_0x405f4f]={'$like':'%'+_0x3324dd[_0x6dd1('0x3f')][_0x6dd1('0x4a')]+'%'};return _0x269191;})});}_0x56faef=_[_0x6dd1('0x4b')]({},_0x56faef,_0x3324dd[_0x6dd1('0x53')]);return _0x415773[_0x6dd1('0xbb')](_0x56faef);}})[_0x6dd1('0x30')](function(_0xd7e2df){if(_0xd7e2df){_0xf63c73=_0xd7e2df[_0x6dd1('0x44')];if(!_0x3324dd[_0x6dd1('0x3f')][_0x6dd1('0x45')]('nolimit')){_0x56faef[_0x6dd1('0x47')]=qs[_0x6dd1('0x47')](_0x3324dd[_0x6dd1('0x3f')]['limit']);_0x56faef['offset']=qs['offset'](_0x3324dd[_0x6dd1('0x3f')]['offset']);}return _0x415773[_0x6dd1('0xbb')](_0x56faef);}})['then'](function(_0x2da570){if(_0x2da570){return _0x2da570?{'count':_0xf63c73,'rows':_0x2da570}:null;}})[_0x6dd1('0x30')](respondWithResult(_0xcb7744,null))[_0x6dd1('0x27')](handleError(_0xcb7744,null));};exports['getInteractions']=function(_0x39056f,_0x3465b3,_0xc4b6b1){var _0x40b9c3={'raw':![],'where':{}};var _0x3ceb34={};var _0x5ccbc8={'count':0x0,'rows':[]};return db[_0x6dd1('0x38')][_0x6dd1('0x62')]({'where':{'id':_0x39056f['params']['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x3465b3,null))[_0x6dd1('0x30')](function(_0x58671d){if(_0x58671d){_0x3ceb34[_0x6dd1('0x42')]=_['keys'](db[_0x6dd1('0x9d')]['rawAttributes']);_0x3ceb34[_0x6dd1('0x3f')]=_[_0x6dd1('0x3e')](_0x39056f['query']);_0x3ceb34[_0x6dd1('0x40')]=_[_0x6dd1('0x41')](_0x3ceb34[_0x6dd1('0x42')],_0x3ceb34[_0x6dd1('0x3f')]);_0x40b9c3[_0x6dd1('0x43')]=_['intersection'](_0x3ceb34[_0x6dd1('0x42')],qs[_0x6dd1('0x69')](_0x39056f['query'][_0x6dd1('0x69')]));_0x40b9c3['attributes']=_0x40b9c3[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x40b9c3[_0x6dd1('0x43')]:_0x3ceb34[_0x6dd1('0x42')];if(!_0x39056f[_0x6dd1('0x3f')]['hasOwnProperty'](_0x6dd1('0x46'))){_0x40b9c3[_0x6dd1('0x47')]=qs[_0x6dd1('0x47')](_0x39056f[_0x6dd1('0x3f')][_0x6dd1('0x47')]);_0x40b9c3['offset']=qs['offset'](_0x39056f[_0x6dd1('0x3f')]['offset']);}_0x40b9c3[_0x6dd1('0x6a')]=qs[_0x6dd1('0x48')](_0x39056f['query'][_0x6dd1('0x48')]);_0x40b9c3['where']=qs[_0x6dd1('0x40')](_[_0x6dd1('0x49')](_0x39056f[_0x6dd1('0x3f')],_0x3ceb34[_0x6dd1('0x40')]));_0x40b9c3[_0x6dd1('0x4c')][_0x6dd1('0x60')]=_0x58671d['id'];if(_0x39056f['query'][_0x6dd1('0x4a')]){_0x40b9c3[_0x6dd1('0x4c')]=_[_0x6dd1('0x4b')](_0x40b9c3[_0x6dd1('0x4c')],{'$or':_[_0x6dd1('0x3d')](_0x40b9c3[_0x6dd1('0x43')],function(_0x52e4b6){var _0x180f99={};_0x180f99[_0x52e4b6]={'$like':'%'+_0x39056f[_0x6dd1('0x3f')][_0x6dd1('0x4a')]+'%'};return _0x180f99;})});}_0x40b9c3=_[_0x6dd1('0x4b')]({},_0x40b9c3,_0x39056f[_0x6dd1('0x53')]);return db[_0x6dd1('0x9d')]['count']({'where':_0x40b9c3[_0x6dd1('0x4c')]})[_0x6dd1('0x30')](function(_0x429232){_0x5ccbc8[_0x6dd1('0x2b')]=_0x429232;if(_0x39056f[_0x6dd1('0x3f')]['includeAll']){_0x40b9c3[_0x6dd1('0x52')]=[{'model':db[_0x6dd1('0x98')],'as':_0x6dd1('0xbc'),'required':![]},{'model':db['User'],'as':_0x6dd1('0xbd'),'attributes':[_0x6dd1('0x36'),_0x6dd1('0xbe'),_0x6dd1('0xbf')],'required':![]},{'model':db['Tag'],'as':_0x6dd1('0xc0'),'attributes':['id',_0x6dd1('0x36'),_0x6dd1('0xc1')],'where':_0x39056f[_0x6dd1('0x3f')][_0x6dd1('0xc2')]?{'id':_0x39056f[_0x6dd1('0x3f')]['tag']}:undefined,'required':_0x39056f['query']['tag']?!![]:![]}];}return db[_0x6dd1('0x9d')][_0x6dd1('0x4e')](_0x40b9c3);})[_0x6dd1('0x30')](function(_0x25c97e){_0x5ccbc8[_0x6dd1('0x63')]=_0x25c97e;return _0x5ccbc8;});}})['then'](respondWithFilteredResult(_0x3465b3,_0x40b9c3))[_0x6dd1('0x27')](handleError(_0x3465b3,null));};exports['send']=function(_0x47377c,_0x552806,_0x194a72){var _0x9c91e5,_0x3f224c,_0x103e04;if(_[_0x6dd1('0x90')](_0x47377c[_0x6dd1('0x5c')]['body'])||_0x47377c['body']['body']===''){throw new db[(_0x6dd1('0x74'))][(_0x6dd1('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6dd1('0x90')](_0x47377c[_0x6dd1('0x5c')]['to'])){throw new db[(_0x6dd1('0x74'))][(_0x6dd1('0x92'))]('to\x20is\x20mandatory');}_0x9c91e5=_0x47377c[_0x6dd1('0x5c')]['to'];return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x47377c[_0x6dd1('0x50')]['id']},'include':[{'model':db[_0x6dd1('0x97')],'as':'List','include':[{'model':db[_0x6dd1('0x98')],'as':_0x6dd1('0x99'),'where':{'mobile':_0x9c91e5},'limit':0x1,'order':[[_0x6dd1('0x77'),'DESC']]}]}]})[_0x6dd1('0x30')](handleEntityNotFound(_0x552806,null))[_0x6dd1('0x30')](function(_0x52957e){if(_0x52957e&&_0x52957e['List']){_0x3f224c=_0x52957e[_0x6dd1('0x32')]({'plain':!![]});if(_0x3f224c[_0x6dd1('0xc3')]&&_0x3f224c['List']['Contacts'][_0x6dd1('0x44')]){return _0x3f224c['List'][_0x6dd1('0x99')][0x0];}return db['CmContact'][_0x6dd1('0x54')](_[_0x6dd1('0x18')](_0x47377c[_0x6dd1('0x5c')],{'firstName':_0x9c91e5,'mobile':_0x9c91e5,'phone':_0x9c91e5,'ListId':_0x3f224c[_0x6dd1('0xc4')]}));}})[_0x6dd1('0x30')](handleEntityNotFound(_0x552806,null))[_0x6dd1('0x30')](function(_0x1c5ab8){if(_0x1c5ab8){_0x103e04=_0x1c5ab8;return db[_0x6dd1('0x9d')][_0x6dd1('0x58')]({'where':{'ContactId':_0x103e04['id'],'closed':![],'SmsAccountId':_0x3f224c['id']}})['then'](function(_0x4a3283){if(_0x4a3283){return[_0x4a3283,![]];}return db[_0x6dd1('0x9d')][_0x6dd1('0x54')]({'UserId':_0x47377c[_0x6dd1('0x55')]['id'],'ContactId':_0x103e04['id'],'SmsAccountId':_0x3f224c['id'],'phone':_0x9c91e5,'firstMsgDirection':_0x6dd1('0xc5'),'Messages':[_[_0x6dd1('0x4b')](_0x47377c[_0x6dd1('0x5c')],{'read':![],'body':_0x47377c[_0x6dd1('0x5c')]['body'],'phone':_0x9c91e5,'SmsAccountId':_0x3f224c['id'],'UserId':_0x47377c['user']['id'],'ContactId':_0x103e04['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6dd1('0xc6')}]})[_0x6dd1('0x30')](function(_0x40c1ef){return[_0x40c1ef,!![]];});});}})[_0x6dd1('0x9e')](function(_0x45aca7,_0x2babb3){if(_0x2babb3){return _0x45aca7;}return db[_0x6dd1('0xa4')][_0x6dd1('0x54')](_[_0x6dd1('0x4b')](_0x47377c[_0x6dd1('0x5c')],{'read':![],'body':_0x47377c[_0x6dd1('0x5c')][_0x6dd1('0x5c')],'phone':_0x9c91e5,'SmsAccountId':_0x3f224c['id'],'SmsInteractionId':_0x45aca7['id'],'UserId':_0x47377c[_0x6dd1('0x55')]['id'],'ContactId':_0x103e04['id']}))[_0x6dd1('0x30')](function(_0x3bf9be){_0x45aca7[_0x6dd1('0xc7')][_0x6dd1('0xc6')]=[];_0x45aca7[_0x6dd1('0xc7')][_0x6dd1('0xc6')][_0x6dd1('0xc8')](_0x3bf9be[_0x6dd1('0xc7')]);return _0x45aca7;});})[_0x6dd1('0x30')](respondWithResult(_0x552806,null))[_0x6dd1('0x27')](handleError(_0x552806,null));};exports['status']=function(_0x49ae7c,_0x5df4b1,_0x1ce274){if(_0x49ae7c[_0x6dd1('0x5c')]['id']){delete _0x49ae7c[_0x6dd1('0x5c')]['id'];}var _0x262695,_0xbb0c19,_0x3ec28f;return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x49ae7c[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x5df4b1,null))[_0x6dd1('0x30')](function(_0x4ecfe0){if(_0x4ecfe0){_0x3ec28f=_0x4ecfe0;logger[_0x6dd1('0x20')](_0x6dd1('0xac'),_0x6dd1('0x29'),_0x6dd1('0xc9'),_0x4ecfe0[_0x6dd1('0x3b')],util['inspect'](_0x49ae7c['body'],{'showHidden':![],'depth':null}));switch(_0x4ecfe0[_0x6dd1('0x3b')]){case _0x6dd1('0x7e'):if(_0x49ae7c[_0x6dd1('0x5c')]['skebby_dispatch_id']&&_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0x29')]){_0xbb0c19=_0x49ae7c['body'][_0x6dd1('0x29')];return db['SmsMessage'][_0x6dd1('0x58')]({'where':{'messageId':_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0xca')]}});}break;case'connectel':if(_0x49ae7c['body'][_0x6dd1('0xcb')]&&_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0xcc')]){_0xbb0c19=_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0xcc')];return db[_0x6dd1('0xa4')][_0x6dd1('0x58')]({'where':{'messageId':_0x49ae7c['body'][_0x6dd1('0xcb')]}});}break;case _0x6dd1('0x81'):if(_0x49ae7c['body']['message_id']&&_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0xcd')]){_0xbb0c19=_0x49ae7c['body']['status_code'];return db['SmsMessage'][_0x6dd1('0x58')]({'where':{'messageId':_0x49ae7c['body'][_0x6dd1('0x83')]}});}break;case _0x6dd1('0x87'):var _0x4f4968=_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0x88')][0x0];if(_0x4f4968[_0x6dd1('0x82')]&&_0x4f4968[_0x6dd1('0x29')][_0x6dd1('0xce')]===_0x6dd1('0xcf')){_0xbb0c19=_0x4f4968[_0x6dd1('0x29')][_0x6dd1('0xce')];return db[_0x6dd1('0xa4')]['find']({'where':{'messageId':_0x4f4968[_0x6dd1('0x82')]}});}break;case'clickatell':if(_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0x82')]&&_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0x29')]){_0xbb0c19=_0x49ae7c['body']['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0x82')]}});}break;case _0x6dd1('0x8e'):if(_0x49ae7c[_0x6dd1('0x5c')][0x0][_0x6dd1('0x24')]['id']){_0xbb0c19=_0x49ae7c[_0x6dd1('0x5c')][0x0]['type'];return db[_0x6dd1('0xa4')][_0x6dd1('0x58')]({'where':{'messageId':_0x49ae7c[_0x6dd1('0x5c')][0x0][_0x6dd1('0x24')]['id']}});}break;case'intelepeer':if(_0x49ae7c[_0x6dd1('0x5c')]['redif']&&_0x49ae7c['body']['status']){_0xbb0c19=_0x49ae7c[_0x6dd1('0x5c')]['status'];return db[_0x6dd1('0xa4')][_0x6dd1('0x58')]({'where':{'messageId':_0x49ae7c[_0x6dd1('0x5c')][_0x6dd1('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x5df4b1,null))['then'](function(_0x148074){if(_0x148074){_0x262695=_0x148074;switch(_0x3ec28f['type']){case'skebby':if(_0xbb0c19===_0x6dd1('0xcf')){return _0x262695['update']({'read':!![]});}else{logger['error'](_0x6dd1('0xac'),_0x6dd1('0x29'),_0x6dd1('0x7e'),util[_0x6dd1('0xd1')](_0x49ae7c[_0x6dd1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6dd1('0x80'):if(_0xbb0c19==='1'){return _0x262695[_0x6dd1('0x2f')]({'read':!![]});}else{logger['error'](_0x6dd1('0xac'),'status',_0x6dd1('0x7e'),util['inspect'](_0x49ae7c[_0x6dd1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6dd1('0x81'):if(!_0x49ae7c[_0x6dd1('0x5c')]['error_code']&&_0xbb0c19>=0xc8&&_0xbb0c19<=0xce){return _0x262695[_0x6dd1('0x2f')]({'read':!![]});}else{logger[_0x6dd1('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6dd1('0x81'),util[_0x6dd1('0xd1')](_0x49ae7c[_0x6dd1('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4a5d5c=_0x49ae7c['body']['results'][0x0];if(_0x4a5d5c[_0x6dd1('0x29')][_0x6dd1('0xce')]===_0x6dd1('0xcf')){return _0x262695[_0x6dd1('0x2f')]({'read':!![]});}else{logger[_0x6dd1('0x22')](_0x6dd1('0xac'),_0x6dd1('0x29'),'infobip',util[_0x6dd1('0xd1')](_0x49ae7c[_0x6dd1('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6dd1('0x8b'):if(_0xbb0c19==_0x6dd1('0xd2')||_0xbb0c19==_0x6dd1('0xd3')){return _0x262695['update']({'read':!![]});}else{logger['error'](_0x6dd1('0xac'),_0x6dd1('0x29'),_0x6dd1('0x8b'),util[_0x6dd1('0xd1')](_0x49ae7c['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xbb0c19==_0x6dd1('0xd4')){return _0x262695['update']({'read':!![]});}else{logger[_0x6dd1('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6dd1('0x29'),_0x6dd1('0x8e'),util['inspect'](_0x49ae7c[_0x6dd1('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xbb0c19==='DELIVRD'||_0xbb0c19===_0x6dd1('0xd5')){return _0x262695['update']({'read':!![]});}else{logger[_0x6dd1('0x22')](_0x6dd1('0xac'),'status',_0x6dd1('0xd6'),util['inspect'](_0x49ae7c['body'],{'showHidden':![],'depth':null}));}break;}return _0x262695;}})['then'](respondWithResult(_0x5df4b1,null))['catch'](handleError(_0x5df4b1,null));};exports[_0x6dd1('0xd7')]=function(_0x37ac01,_0x6cd477,_0x57b2fe){var _0x247f46,_0x2909ad,_0x344394;return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x37ac01['params']['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x6cd477,null))[_0x6dd1('0x30')](function(_0x1bb55b){if(_0x1bb55b){_0x344394=_0x1bb55b;logger[_0x6dd1('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6dd1('0x29'),'received\x20delivery\x20report\x20from',_0x1bb55b[_0x6dd1('0x3b')],util[_0x6dd1('0xd1')](_0x37ac01[_0x6dd1('0x3f')],{'showHidden':![],'depth':null}));switch(_0x1bb55b[_0x6dd1('0x3b')]){case'csc':if(_0x37ac01['query']['message-id']&&_0x37ac01[_0x6dd1('0x3f')]['state']){_0x2909ad=_0x37ac01['query'][_0x6dd1('0xd8')];return db[_0x6dd1('0xa4')][_0x6dd1('0x58')]({'where':{'messageId':_0x37ac01[_0x6dd1('0x3f')]['message-id']}});}break;}}})[_0x6dd1('0x30')](handleEntityNotFound(_0x6cd477,null))[_0x6dd1('0x30')](function(_0x5a9a10){if(_0x5a9a10){_0x247f46=_0x5a9a10;switch(_0x344394['type']){case _0x6dd1('0xd9'):if(_0x2909ad==='2'||_0x2909ad==='6'){return _0x247f46[_0x6dd1('0x2f')]({'read':!![]});}else{logger[_0x6dd1('0x22')](_0x6dd1('0xac'),'status',_0x6dd1('0xd9'),util[_0x6dd1('0xd1')](_0x37ac01['query'],{'showHidden':![],'depth':null}));};break;}return _0x247f46;}})[_0x6dd1('0x30')](respondWithResult(_0x6cd477,null))['catch'](handleError(_0x6cd477,null));};exports[_0x6dd1('0xda')]=function(_0x43c11c,_0xc4f0e2,_0x4438fc){return db[_0x6dd1('0x38')][_0x6dd1('0x58')]({'where':{'id':_0x43c11c[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0xc4f0e2,null))[_0x6dd1('0x30')](function(_0x19d118){if(_0x19d118){return _0x19d118['addAgents'](_0x43c11c['body'][_0x6dd1('0x65')],_['omit'](_0x43c11c[_0x6dd1('0x5c')],[_0x6dd1('0x65'),'id'])||{})[_0x6dd1('0x9e')](function(_0x178929){for(var _0x220df8=0x0;_0x220df8<_0x43c11c[_0x6dd1('0x5c')][_0x6dd1('0x65')][_0x6dd1('0x44')];_0x220df8+=0x1){socket[_0x6dd1('0xdb')]('userSmsAccount:save',{'UserId':Number(_0x43c11c[_0x6dd1('0x5c')]['ids'][_0x220df8]),'SmsAccountId':Number(_0x43c11c[_0x6dd1('0x50')]['id'])});}return _0x178929;});}})[_0x6dd1('0x30')](respondWithResult(_0xc4f0e2,null))['catch'](handleError(_0xc4f0e2,null));};exports[_0x6dd1('0xdc')]=function(_0x11f598,_0x1be1f0,_0x2f8469){return db[_0x6dd1('0x38')]['find']({'where':{'id':_0x11f598[_0x6dd1('0x50')]['id']}})[_0x6dd1('0x30')](handleEntityNotFound(_0x1be1f0,null))[_0x6dd1('0x30')](function(_0x3293e5){if(_0x3293e5){return _0x3293e5[_0x6dd1('0xdc')](_0x11f598[_0x6dd1('0x3f')]['ids'])[_0x6dd1('0x30')](function(){if(_[_0x6dd1('0xdd')](_0x11f598[_0x6dd1('0x3f')][_0x6dd1('0x65')])){for(var _0x3b0375=0x0;_0x3b0375<_0x11f598[_0x6dd1('0x3f')][_0x6dd1('0x65')]['length'];_0x3b0375+=0x1){socket[_0x6dd1('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x11f598[_0x6dd1('0x3f')][_0x6dd1('0x65')][_0x3b0375]),'SmsAccountId':Number(_0x11f598[_0x6dd1('0x50')]['id'])});}}else{socket[_0x6dd1('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x11f598[_0x6dd1('0x3f')]['ids']),'SmsAccountId':Number(_0x11f598[_0x6dd1('0x50')]['id'])});}});}})[_0x6dd1('0x30')](respondWithStatusCode(_0x1be1f0,null))['catch'](handleError(_0x1be1f0,null));};exports[_0x6dd1('0xde')]=function(_0x2b2988,_0x24ca56,_0x13abc2){var _0x5a9a5e={};var _0x329970={};var _0x346db1;var _0x5e8fc0;return db[_0x6dd1('0x38')][_0x6dd1('0x62')]({'where':{'id':_0x2b2988[_0x6dd1('0x50')]['id']}})['then'](handleEntityNotFound(_0x24ca56,null))[_0x6dd1('0x30')](function(_0x5a63e0){if(_0x5a63e0){_0x346db1=_0x5a63e0;_0x329970[_0x6dd1('0x42')]=_[_0x6dd1('0x3e')](db['User']['rawAttributes']);_0x329970['query']=_[_0x6dd1('0x3e')](_0x2b2988['query']);_0x329970['filters']=_['intersection'](_0x329970[_0x6dd1('0x42')],_0x329970['query']);_0x5a9a5e[_0x6dd1('0x43')]=_[_0x6dd1('0x41')](_0x329970[_0x6dd1('0x42')],qs[_0x6dd1('0x69')](_0x2b2988[_0x6dd1('0x3f')][_0x6dd1('0x69')]));_0x5a9a5e[_0x6dd1('0x43')]=_0x5a9a5e[_0x6dd1('0x43')][_0x6dd1('0x44')]?_0x5a9a5e[_0x6dd1('0x43')]:_0x329970['model'];_0x5a9a5e['order']=qs[_0x6dd1('0x48')](_0x2b2988[_0x6dd1('0x3f')][_0x6dd1('0x48')]);_0x5a9a5e[_0x6dd1('0x4c')]=qs[_0x6dd1('0x40')](_[_0x6dd1('0x49')](_0x2b2988[_0x6dd1('0x3f')],_0x329970['filters']));if(_0x2b2988[_0x6dd1('0x3f')]['filter']){_0x5a9a5e[_0x6dd1('0x4c')]=_[_0x6dd1('0x4b')](_0x5a9a5e[_0x6dd1('0x4c')],{'$or':_[_0x6dd1('0x3d')](_0x5a9a5e[_0x6dd1('0x43')],function(_0x2a77e4){var _0x4bfde2={};_0x4bfde2[_0x2a77e4]={'$like':'%'+_0x2b2988[_0x6dd1('0x3f')][_0x6dd1('0x4a')]+'%'};return _0x4bfde2;})});}_0x5a9a5e=_[_0x6dd1('0x4b')]({},_0x5a9a5e,_0x2b2988[_0x6dd1('0x53')]);return _0x346db1[_0x6dd1('0xde')](_0x5a9a5e);}})[_0x6dd1('0x30')](function(_0x6afbaa){if(_0x6afbaa){_0x5e8fc0=_0x6afbaa['length'];if(!_0x2b2988['query']['hasOwnProperty']('nolimit')){_0x5a9a5e[_0x6dd1('0x47')]=qs[_0x6dd1('0x47')](_0x2b2988[_0x6dd1('0x3f')][_0x6dd1('0x47')]);_0x5a9a5e[_0x6dd1('0x2a')]=qs['offset'](_0x2b2988[_0x6dd1('0x3f')][_0x6dd1('0x2a')]);}return _0x346db1[_0x6dd1('0xde')](_0x5a9a5e);}})['then'](function(_0x3dc34c){if(_0x3dc34c){return _0x3dc34c?{'count':_0x5e8fc0,'rows':_0x3dc34c}:null;}})[_0x6dd1('0x30')](respondWithResult(_0x24ca56,null))[_0x6dd1('0x27')](handleError(_0x24ca56,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4809c7e..af6e9d8 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 _0xbdc3=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x226bdd,_0x5bca05){var _0x48a9cd=function(_0x5c2931){while(--_0x5c2931){_0x226bdd['push'](_0x226bdd['shift']());}};_0x48a9cd(++_0x5bca05);}(_0xbdc3,0x1e4));var _0x3bdc=function(_0x35b844,_0xa0503a){_0x35b844=_0x35b844-0x0;var _0x13a663=_0xbdc3[_0x35b844];return _0x13a663;};'use strict';var EventEmitter=require(_0x3bdc('0x0'));var SmsAccount=require(_0x3bdc('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3bdc('0x2')](0x0);var events={'afterCreate':_0x3bdc('0x3'),'afterUpdate':_0x3bdc('0x4'),'afterDestroy':_0x3bdc('0x5')};function emitEvent(_0x53fe75){return function(_0x6a6059,_0x162b6b,_0x2163ab){SmsAccountEvents['emit'](_0x53fe75+':'+_0x6a6059['id'],_0x6a6059);SmsAccountEvents[_0x3bdc('0x6')](_0x53fe75,_0x6a6059);_0x2163ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3bdc('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x44df=['exports','SmsAccount','setMaxListeners','update','remove','emit','hook'];(function(_0xcfabeb,_0x5d7c51){var _0x39ecb4=function(_0x14dd74){while(--_0x14dd74){_0xcfabeb['push'](_0xcfabeb['shift']());}};_0x39ecb4(++_0x5d7c51);}(_0x44df,0x94));var _0xf44d=function(_0x33aac9,_0x3c18d1){_0x33aac9=_0x33aac9-0x0;var _0x126bfe=_0x44df[_0x33aac9];return _0x126bfe;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xf44d('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf44d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf44d('0x2'),'afterDestroy':_0xf44d('0x3')};function emitEvent(_0x558d27){return function(_0x30f374,_0x417799,_0x441dc8){SmsAccountEvents['emit'](_0x558d27+':'+_0x30f374['id'],_0x30f374);SmsAccountEvents[_0xf44d('0x4')](_0x558d27,_0x30f374);_0x441dc8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xf44d('0x5')](e,emitEvent(event));}}module[_0xf44d('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c32e5ae..9d0f215 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 _0x935a=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','util','../../config/logger'];(function(_0x16a599,_0x3a4fa6){var _0x3cab08=function(_0x2dd046){while(--_0x2dd046){_0x16a599['push'](_0x16a599['shift']());}};_0x3cab08(++_0x3a4fa6);}(_0x935a,0x1c1));var _0xa935=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x935a[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0xa935('0x0'));var logger=require(_0xa935('0x1'))(_0xa935('0x2'));var moment=require(_0xa935('0x3'));var BPromise=require(_0xa935('0x4'));var rp=require(_0xa935('0x5'));var fs=require('fs');var path=require(_0xa935('0x6'));var rimraf=require('rimraf');var config=require(_0xa935('0x7'));var attributes=require(_0xa935('0x8'));module['exports']=function(_0x50e8bf,_0x7bdc3e){return _0x50e8bf[_0xa935('0x9')](_0xa935('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed06=['SmsAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0xed06,0xf3));var _0x6ed0=function(_0x354425,_0x3264c7){_0x354425=_0x354425-0x0;var _0x30b484=_0xed06[_0x354425];return _0x30b484;};'use strict';var _=require(_0x6ed0('0x0'));var util=require('util');var logger=require(_0x6ed0('0x1'))(_0x6ed0('0x2'));var moment=require(_0x6ed0('0x3'));var BPromise=require(_0x6ed0('0x4'));var rp=require(_0x6ed0('0x5'));var fs=require('fs');var path=require(_0x6ed0('0x6'));var rimraf=require(_0x6ed0('0x7'));var config=require(_0x6ed0('0x8'));var attributes=require('./smsAccount.attributes');module[_0x6ed0('0x9')]=function(_0xb592c5,_0x1bdb7f){return _0xb592c5['define'](_0x6ed0('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d52072f..94b894e 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 _0x6500=['redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x291bf5,_0x21c92f){var _0x4e4a14=function(_0x1a6ab5){while(--_0x1a6ab5){_0x291bf5['push'](_0x291bf5['shift']());}};_0x4e4a14(++_0x21c92f);}(_0x6500,0x1bd));var _0x0650=function(_0x8c27e4,_0x33ed1f){_0x8c27e4=_0x8c27e4-0x0;var _0x15b5a0=_0x6500[_0x8c27e4];return _0x15b5a0;};'use strict';var _=require(_0x0650('0x0'));var util=require('util');var moment=require(_0x0650('0x1'));var BPromise=require(_0x0650('0x2'));var rs=require(_0x0650('0x3'));var fs=require('fs');var Redis=require(_0x0650('0x4'));var db=require(_0x0650('0x5'))['db'];var utils=require(_0x0650('0x6'));var logger=require(_0x0650('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0650('0x8'));var client=jayson[_0x0650('0x9')][_0x0650('0xa')]({'port':0x232a});config[_0x0650('0xb')]=_[_0x0650('0xc')](config[_0x0650('0xb')],{'host':_0x0650('0xd'),'port':0x18eb});var socket=require(_0x0650('0xe'))(new Redis(config[_0x0650('0xb')]));require(_0x0650('0xf'))[_0x0650('0x10')](socket);function respondWithRpcPromise(_0xc7d139,_0x488230,_0x42a723){return new BPromise(function(_0x216922,_0x1fb85c){return client['request'](_0xc7d139,_0x42a723)[_0x0650('0x11')](function(_0x180305){logger[_0x0650('0x12')](_0x0650('0x13'),_0x488230,'request\x20sent');logger[_0x0650('0x14')](_0x0650('0x15'),_0x488230,_0x0650('0x16'),JSON[_0x0650('0x17')](_0x180305));if(_0x180305['error']){if(_0x180305[_0x0650('0x18')][_0x0650('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x488230,_0x180305[_0x0650('0x18')]['message']);return _0x1fb85c(_0x180305['error'][_0x0650('0x1a')]);}logger['error'](_0x0650('0x13'),_0x488230,_0x180305[_0x0650('0x18')]['message']);return _0x216922(_0x180305[_0x0650('0x18')][_0x0650('0x1a')]);}else{logger[_0x0650('0x12')](_0x0650('0x13'),_0x488230,_0x0650('0x16'));_0x216922(_0x180305[_0x0650('0x1b')][_0x0650('0x1a')]);}})['catch'](function(_0x4dbde4){logger[_0x0650('0x18')](_0x0650('0x13'),_0x488230,_0x4dbde4);_0x1fb85c(_0x4dbde4);});});}exports['ShowSmsAccount']=function(_0x36a216){var _0x3ae70f=this;return new Promise(function(_0x144892,_0x10b3b4){return db[_0x0650('0x1c')]['find']({'raw':_0x36a216[_0x0650('0x1d')]?_0x36a216[_0x0650('0x1d')][_0x0650('0x1e')]===undefined?!![]:![]:!![],'where':_0x36a216[_0x0650('0x1d')]?_0x36a216[_0x0650('0x1d')][_0x0650('0x1f')]||null:null,'attributes':_0x36a216[_0x0650('0x1d')]?_0x36a216[_0x0650('0x1d')][_0x0650('0x20')]||null:null,'include':_0x36a216[_0x0650('0x1d')]?_0x36a216[_0x0650('0x1d')][_0x0650('0x21')]?_[_0x0650('0x22')](_0x36a216[_0x0650('0x1d')][_0x0650('0x21')],function(_0x2b30c6){return{'model':db[_0x2b30c6[_0x0650('0x23')]],'as':_0x2b30c6['as'],'attributes':_0x2b30c6[_0x0650('0x20')],'include':_0x2b30c6[_0x0650('0x21')]?_['map'](_0x2b30c6[_0x0650('0x21')],function(_0x2b2a74){return{'model':db[_0x2b2a74[_0x0650('0x23')]],'as':_0x2b2a74['as'],'attributes':_0x2b2a74[_0x0650('0x20')],'include':_0x2b2a74[_0x0650('0x21')]?_['map'](_0x2b2a74['include'],function(_0x1ab0be){return{'model':db[_0x1ab0be[_0x0650('0x23')]],'as':_0x1ab0be['as'],'attributes':_0x1ab0be[_0x0650('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0650('0x11')](function(_0x4a3f63){logger[_0x0650('0x12')](_0x0650('0x24'),_0x36a216);logger['debug'](_0x0650('0x24'),_0x36a216,JSON[_0x0650('0x17')](_0x4a3f63));_0x144892(_0x4a3f63);})[_0x0650('0x25')](function(_0x24ed11){logger[_0x0650('0x18')](_0x0650('0x24'),_0x24ed11['message'],_0x36a216);_0x10b3b4(_0x3ae70f[_0x0650('0x18')](0x1f4,_0x24ed11[_0x0650('0x1a')]));});});}; \ No newline at end of file +var _0xe0b4=['where','attributes','include','map','model','then','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsAccount.socket','register','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','ShowSmsAccount','SmsAccount','find','options'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xe0b4,0x141));var _0x4e0b=function(_0x4e78e9,_0x5d50a1){_0x4e78e9=_0x4e78e9-0x0;var _0x50f4b9=_0xe0b4[_0x4e78e9];return _0x50f4b9;};'use strict';var _=require(_0x4e0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4e0b('0x1'));var rs=require(_0x4e0b('0x2'));var fs=require('fs');var Redis=require(_0x4e0b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e0b('0x4'));var logger=require(_0x4e0b('0x5'))(_0x4e0b('0x6'));var config=require(_0x4e0b('0x7'));var jayson=require(_0x4e0b('0x8'));var client=jayson[_0x4e0b('0x9')][_0x4e0b('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4e0b('0xb')],{'host':_0x4e0b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e0b('0xb')]));require(_0x4e0b('0xd'))[_0x4e0b('0xe')](socket);function respondWithRpcPromise(_0x398cfe,_0xf7c1a9,_0x33fa05){return new BPromise(function(_0x1f4ca4,_0x244129){return client[_0x4e0b('0xf')](_0x398cfe,_0x33fa05)['then'](function(_0x3d5364){logger[_0x4e0b('0x10')]('SmsAccount,\x20%s,\x20%s',_0xf7c1a9,'request\x20sent');logger[_0x4e0b('0x11')](_0x4e0b('0x12'),_0xf7c1a9,_0x4e0b('0x13'),JSON[_0x4e0b('0x14')](_0x3d5364));if(_0x3d5364[_0x4e0b('0x15')]){if(_0x3d5364['error'][_0x4e0b('0x16')]===0x1f4){logger[_0x4e0b('0x15')](_0x4e0b('0x17'),_0xf7c1a9,_0x3d5364[_0x4e0b('0x15')][_0x4e0b('0x18')]);return _0x244129(_0x3d5364[_0x4e0b('0x15')][_0x4e0b('0x18')]);}logger['error'](_0x4e0b('0x17'),_0xf7c1a9,_0x3d5364[_0x4e0b('0x15')][_0x4e0b('0x18')]);return _0x1f4ca4(_0x3d5364[_0x4e0b('0x15')][_0x4e0b('0x18')]);}else{logger[_0x4e0b('0x10')](_0x4e0b('0x17'),_0xf7c1a9,'request\x20sent');_0x1f4ca4(_0x3d5364['result'][_0x4e0b('0x18')]);}})['catch'](function(_0x53ab3a){logger['error'](_0x4e0b('0x17'),_0xf7c1a9,_0x53ab3a);_0x244129(_0x53ab3a);});});}exports[_0x4e0b('0x19')]=function(_0x1d5cb2){var _0x1a846c=this;return new Promise(function(_0xae9243,_0x24e4e4){return db[_0x4e0b('0x1a')][_0x4e0b('0x1b')]({'raw':_0x1d5cb2[_0x4e0b('0x1c')]?_0x1d5cb2[_0x4e0b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1d5cb2[_0x4e0b('0x1c')]?_0x1d5cb2[_0x4e0b('0x1c')][_0x4e0b('0x1d')]||null:null,'attributes':_0x1d5cb2[_0x4e0b('0x1c')]?_0x1d5cb2[_0x4e0b('0x1c')][_0x4e0b('0x1e')]||null:null,'include':_0x1d5cb2[_0x4e0b('0x1c')]?_0x1d5cb2[_0x4e0b('0x1c')][_0x4e0b('0x1f')]?_[_0x4e0b('0x20')](_0x1d5cb2[_0x4e0b('0x1c')][_0x4e0b('0x1f')],function(_0x3c9de1){return{'model':db[_0x3c9de1[_0x4e0b('0x21')]],'as':_0x3c9de1['as'],'attributes':_0x3c9de1[_0x4e0b('0x1e')],'include':_0x3c9de1['include']?_[_0x4e0b('0x20')](_0x3c9de1[_0x4e0b('0x1f')],function(_0x5968a7){return{'model':db[_0x5968a7['model']],'as':_0x5968a7['as'],'attributes':_0x5968a7[_0x4e0b('0x1e')],'include':_0x5968a7[_0x4e0b('0x1f')]?_[_0x4e0b('0x20')](_0x5968a7[_0x4e0b('0x1f')],function(_0x1dbc2f){return{'model':db[_0x1dbc2f['model']],'as':_0x1dbc2f['as'],'attributes':_0x1dbc2f[_0x4e0b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4e0b('0x22')](function(_0xa6e481){logger[_0x4e0b('0x10')](_0x4e0b('0x19'),_0x1d5cb2);logger[_0x4e0b('0x11')]('ShowSmsAccount',_0x1d5cb2,JSON[_0x4e0b('0x14')](_0xa6e481));_0xae9243(_0xa6e481);})['catch'](function(_0x4edfe8){logger[_0x4e0b('0x15')](_0x4e0b('0x19'),_0x4edfe8[_0x4e0b('0x18')],_0x1d5cb2);_0x24e4e4(_0x1a846c[_0x4e0b('0x15')](0x1f4,_0x4edfe8[_0x4e0b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 52767d6..1d5d996 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 0c34db4..06477cf 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x240dfc,_0x2a59f8){var _0x1ef836=function(_0x20db70){while(--_0x20db70){_0x240dfc['push'](_0x240dfc['shift']());}};_0x1ef836(++_0x2a59f8);}(_0x55ca,0x126));var _0xa55c=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x55ca[_0x1f7839];return _0x36b42e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x203b59,_0x516612){var _0x159f80=function(_0x5ec7c){while(--_0x5ec7c){_0x203b59['push'](_0x203b59['shift']());}};_0x159f80(++_0x516612);}(_0xedd9,0xfc));var _0x9edd=function(_0x19df49,_0x3d27f3){_0x19df49=_0x19df49-0x0;var _0x4f6c97=_0xedd9[_0x19df49];return _0x4f6c97;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d567d51..0e4b480 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 _0x98e2=['STRING','*,*,*,*','exports','noop','TEXT'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x98e2,0x1a6));var _0x298e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x298e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x298e('0x1')},'appdata':{'type':Sequelize[_0x298e('0x2')]()},'description':{'type':Sequelize[_0x298e('0x3')]},'interval':{'type':Sequelize[_0x298e('0x3')],'defaultValue':_0x298e('0x4')}}; \ No newline at end of file +var _0xdc41=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xdc41,0x8f));var _0x1dc4=function(_0x33f4d3,_0xdb169e){_0x33f4d3=_0x33f4d3-0x0;var _0x299432=_0xdc41[_0x33f4d3];return _0x299432;};'use strict';var Sequelize=require(_0x1dc4('0x0'));module[_0x1dc4('0x1')]={'priority':{'type':Sequelize[_0x1dc4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1dc4('0x3')],'allowNull':![],'defaultValue':_0x1dc4('0x4')},'appdata':{'type':Sequelize[_0x1dc4('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1dc4('0x3')],'defaultValue':_0x1dc4('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 851a38e..ab8592c 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 _0x584e=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x584e,0x121));var _0xe584=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x584e[_0xef4ef0];return _0x39b60b;};'use strict';var emlformat=require(_0xe584('0x0'));var rimraf=require(_0xe584('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe584('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe584('0x3'));var Mustache=require(_0xe584('0x4'));var util=require(_0xe584('0x5'));var path=require(_0xe584('0x6'));var sox=require('sox');var csv=require(_0xe584('0x7'));var ejs=require(_0xe584('0x8'));var fs=require('fs');var fs_extra=require(_0xe584('0x9'));var _=require(_0xe584('0xa'));var squel=require(_0xe584('0xb'));var crypto=require(_0xe584('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe584('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe584('0xe'));var Papa=require('papaparse');var Redis=require(_0xe584('0xf'));var authService=require(_0xe584('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe584('0x11'));var hardwareService=require(_0xe584('0x12'));var logger=require('../../config/logger')(_0xe584('0x13'));var utils=require('../../config/utils');var config=require(_0xe584('0x14'));var licenseUtil=require(_0xe584('0x15'));var db=require(_0xe584('0x16'))['db'];function respondWithStatusCode(_0x3a4905,_0x255eec){_0x255eec=_0x255eec||0xcc;return function(_0x393c5c){if(_0x393c5c){return _0x3a4905[_0xe584('0x17')](_0x255eec);}return _0x3a4905[_0xe584('0x18')](_0x255eec)['end']();};}function respondWithResult(_0x253fc0,_0x4752ab){_0x4752ab=_0x4752ab||0xc8;return function(_0x4bb24b){if(_0x4bb24b){return _0x253fc0[_0xe584('0x18')](_0x4752ab)['json'](_0x4bb24b);}};}function respondWithFilteredResult(_0x39ba5f,_0x1deb97){return function(_0x46edee){if(_0x46edee){var _0x1e99e5=typeof _0x1deb97[_0xe584('0x19')]===_0xe584('0x1a')&&typeof _0x1deb97[_0xe584('0x1b')]==='undefined';var _0x5616f2=_0x46edee[_0xe584('0x1c')];var _0x567d7f=_0x1e99e5?0x0:_0x1deb97['offset'];var _0x157e02=_0x1e99e5?_0x46edee[_0xe584('0x1c')]:_0x1deb97[_0xe584('0x19')]+_0x1deb97[_0xe584('0x1b')];var _0x478ef7;if(_0x157e02>=_0x5616f2){_0x157e02=_0x5616f2;_0x478ef7=0xc8;}else{_0x478ef7=0xce;}_0x39ba5f['status'](_0x478ef7);return _0x39ba5f[_0xe584('0x1d')](_0xe584('0x1e'),_0x567d7f+'-'+_0x157e02+'/'+_0x5616f2)[_0xe584('0x1f')](_0x46edee);}return null;};}function patchUpdates(_0x3dca75){return function(_0x3eefca){try{jsonpatch[_0xe584('0x20')](_0x3eefca,_0x3dca75,!![]);}catch(_0x28b010){return BPromise[_0xe584('0x21')](_0x28b010);}return _0x3eefca[_0xe584('0x22')]();};}function saveUpdates(_0x5088c7,_0x10f537){return function(_0x55f2fc){if(_0x55f2fc){return _0x55f2fc[_0xe584('0x23')](_0x5088c7)['then'](function(_0x5da6a8){return _0x5da6a8;});}return null;};}function removeEntity(_0x49d774,_0x164d5a){return function(_0x3fa58b){if(_0x3fa58b){return _0x3fa58b[_0xe584('0x24')]()[_0xe584('0x25')](function(){_0x49d774[_0xe584('0x18')](0xcc)[_0xe584('0x26')]();});}};}function handleEntityNotFound(_0xf2ba96,_0x473889){return function(_0x40f861){if(!_0x40f861){_0xf2ba96[_0xe584('0x17')](0x194);}return _0x40f861;};}function handleError(_0x1f1c65,_0x44cf75){_0x44cf75=_0x44cf75||0x1f4;return function(_0x1481d6){logger['error'](_0x1481d6[_0xe584('0x27')]);if(_0x1481d6[_0xe584('0x28')]){delete _0x1481d6['name'];}_0x1f1c65[_0xe584('0x18')](_0x44cf75)[_0xe584('0x29')](_0x1481d6);};}exports[_0xe584('0x2a')]=function(_0x479ddb,_0x1e0dd0){var _0x272b12={},_0x587338={},_0x31e110={'count':0x0,'rows':[]};var _0x53b8a1=_[_0xe584('0x2b')](db[_0xe584('0x2c')][_0xe584('0x2d')],function(_0x333faa){return{'name':_0x333faa[_0xe584('0x2e')],'type':_0x333faa[_0xe584('0x2f')]['key']};});_0x587338['model']=_[_0xe584('0x2b')](_0x53b8a1,_0xe584('0x28'));_0x587338[_0xe584('0x30')]=_['keys'](_0x479ddb[_0xe584('0x30')]);_0x587338[_0xe584('0x31')]=_['intersection'](_0x587338[_0xe584('0x32')],_0x587338[_0xe584('0x30')]);_0x272b12[_0xe584('0x33')]=_[_0xe584('0x34')](_0x587338[_0xe584('0x32')],qs[_0xe584('0x35')](_0x479ddb[_0xe584('0x30')][_0xe584('0x35')]));_0x272b12[_0xe584('0x33')]=_0x272b12[_0xe584('0x33')][_0xe584('0x36')]?_0x272b12[_0xe584('0x33')]:_0x587338[_0xe584('0x32')];if(!_0x479ddb[_0xe584('0x30')]['hasOwnProperty'](_0xe584('0x37'))){_0x272b12[_0xe584('0x1b')]=qs[_0xe584('0x1b')](_0x479ddb['query'][_0xe584('0x1b')]);_0x272b12[_0xe584('0x19')]=qs[_0xe584('0x19')](_0x479ddb[_0xe584('0x30')][_0xe584('0x19')]);}_0x272b12['order']=qs[_0xe584('0x38')](_0x479ddb[_0xe584('0x30')][_0xe584('0x38')]);_0x272b12[_0xe584('0x39')]=qs[_0xe584('0x31')](_[_0xe584('0x3a')](_0x479ddb[_0xe584('0x30')],_0x587338['filters']),_0x53b8a1);if(_0x479ddb[_0xe584('0x30')][_0xe584('0x3b')]){_0x272b12[_0xe584('0x39')]=_[_0xe584('0x3c')](_0x272b12[_0xe584('0x39')],{'$or':_[_0xe584('0x2b')](_0x53b8a1,function(_0x4b4b7a){if(_0x4b4b7a[_0xe584('0x2f')]!==_0xe584('0x3d')){var _0x52ccbf={};_0x52ccbf[_0x4b4b7a[_0xe584('0x28')]]={'$like':'%'+_0x479ddb[_0xe584('0x30')][_0xe584('0x3b')]+'%'};return _0x52ccbf;}})});}_0x272b12=_[_0xe584('0x3c')]({},_0x272b12,_0x479ddb[_0xe584('0x3e')]);var _0x463701={'where':_0x272b12[_0xe584('0x39')]};return db[_0xe584('0x2c')][_0xe584('0x1c')](_0x463701)[_0xe584('0x25')](function(_0x5c9001){_0x31e110[_0xe584('0x1c')]=_0x5c9001;if(_0x479ddb[_0xe584('0x30')][_0xe584('0x3f')]){_0x272b12[_0xe584('0x40')]=[{'all':!![]}];}return db[_0xe584('0x2c')][_0xe584('0x41')](_0x272b12);})[_0xe584('0x25')](function(_0x1a0c4a){_0x31e110[_0xe584('0x42')]=_0x1a0c4a;return _0x31e110;})['then'](respondWithFilteredResult(_0x1e0dd0,_0x272b12))[_0xe584('0x43')](handleError(_0x1e0dd0,null));};exports[_0xe584('0x44')]=function(_0x4ff41a,_0x179957){var _0x5f1e82={'raw':!![],'where':{'id':_0x4ff41a[_0xe584('0x45')]['id']}},_0x94d760={};_0x94d760[_0xe584('0x32')]=_['keys'](db[_0xe584('0x2c')][_0xe584('0x2d')]);_0x94d760[_0xe584('0x30')]=_['keys'](_0x4ff41a[_0xe584('0x30')]);_0x94d760['filters']=_[_0xe584('0x34')](_0x94d760[_0xe584('0x32')],_0x94d760[_0xe584('0x30')]);_0x5f1e82['attributes']=_[_0xe584('0x34')](_0x94d760['model'],qs[_0xe584('0x35')](_0x4ff41a[_0xe584('0x30')][_0xe584('0x35')]));_0x5f1e82[_0xe584('0x33')]=_0x5f1e82[_0xe584('0x33')][_0xe584('0x36')]?_0x5f1e82[_0xe584('0x33')]:_0x94d760[_0xe584('0x32')];if(_0x4ff41a['query'][_0xe584('0x3f')]){_0x5f1e82[_0xe584('0x40')]=[{'all':!![]}];}_0x5f1e82=_[_0xe584('0x3c')]({},_0x5f1e82,_0x4ff41a[_0xe584('0x3e')]);return db[_0xe584('0x2c')][_0xe584('0x46')](_0x5f1e82)[_0xe584('0x25')](handleEntityNotFound(_0x179957,null))['then'](respondWithResult(_0x179957,null))['catch'](handleError(_0x179957,null));};exports[_0xe584('0x47')]=function(_0x1a36c2,_0x8c06e5){return db['SmsApplication'][_0xe584('0x47')](_0x1a36c2[_0xe584('0x48')],{})[_0xe584('0x25')](respondWithResult(_0x8c06e5,0xc9))[_0xe584('0x43')](handleError(_0x8c06e5,null));};exports['update']=function(_0x49533b,_0x4b0b00){if(_0x49533b[_0xe584('0x48')]['id']){delete _0x49533b['body']['id'];}return db['SmsApplication'][_0xe584('0x46')]({'where':{'id':_0x49533b[_0xe584('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b0b00,null))[_0xe584('0x25')](saveUpdates(_0x49533b['body'],null))[_0xe584('0x25')](respondWithResult(_0x4b0b00,null))[_0xe584('0x43')](handleError(_0x4b0b00,null));};exports[_0xe584('0x24')]=function(_0x587998,_0x16d0a5){return db[_0xe584('0x2c')][_0xe584('0x46')]({'where':{'id':_0x587998[_0xe584('0x45')]['id']}})[_0xe584('0x25')](handleEntityNotFound(_0x16d0a5,null))[_0xe584('0x25')](removeEntity(_0x16d0a5,null))['catch'](handleError(_0x16d0a5,null));}; \ No newline at end of file +var _0x8304=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','name','index','map','SmsApplication','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8304,0x162));var _0x4830=function(_0x18cf7f,_0x241535){_0x18cf7f=_0x18cf7f-0x0;var _0x5cc184=_0x8304[_0x18cf7f];return _0x5cc184;};'use strict';var emlformat=require(_0x4830('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4830('0x1'));var jsonpatch=require(_0x4830('0x2'));var rp=require(_0x4830('0x3'));var moment=require('moment');var BPromise=require(_0x4830('0x4'));var Mustache=require(_0x4830('0x5'));var util=require(_0x4830('0x6'));var path=require(_0x4830('0x7'));var sox=require('sox');var csv=require(_0x4830('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4830('0x9'));var _=require(_0x4830('0xa'));var squel=require(_0x4830('0xb'));var crypto=require(_0x4830('0xc'));var jsforce=require(_0x4830('0xd'));var deskjs=require(_0x4830('0xe'));var toCsv=require(_0x4830('0x8'));var querystring=require('querystring');var Papa=require(_0x4830('0xf'));var Redis=require(_0x4830('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4830('0x11'));var hardwareService=require(_0x4830('0x12'));var logger=require(_0x4830('0x13'))(_0x4830('0x14'));var utils=require('../../config/utils');var config=require(_0x4830('0x15'));var licenseUtil=require(_0x4830('0x16'));var db=require(_0x4830('0x17'))['db'];function respondWithStatusCode(_0xec9383,_0x177fee){_0x177fee=_0x177fee||0xcc;return function(_0x76d288){if(_0x76d288){return _0xec9383[_0x4830('0x18')](_0x177fee);}return _0xec9383[_0x4830('0x19')](_0x177fee)[_0x4830('0x1a')]();};}function respondWithResult(_0x3998ea,_0x5e492d){_0x5e492d=_0x5e492d||0xc8;return function(_0x1d25b4){if(_0x1d25b4){return _0x3998ea[_0x4830('0x19')](_0x5e492d)[_0x4830('0x1b')](_0x1d25b4);}};}function respondWithFilteredResult(_0x4a7143,_0x46295b){return function(_0xcf31ac){if(_0xcf31ac){var _0x14119a=typeof _0x46295b[_0x4830('0x1c')]==='undefined'&&typeof _0x46295b['limit']===_0x4830('0x1d');var _0x11a2aa=_0xcf31ac['count'];var _0x11b10e=_0x14119a?0x0:_0x46295b[_0x4830('0x1c')];var _0x61d7b6=_0x14119a?_0xcf31ac[_0x4830('0x1e')]:_0x46295b[_0x4830('0x1c')]+_0x46295b['limit'];var _0xe5b74;if(_0x61d7b6>=_0x11a2aa){_0x61d7b6=_0x11a2aa;_0xe5b74=0xc8;}else{_0xe5b74=0xce;}_0x4a7143[_0x4830('0x19')](_0xe5b74);return _0x4a7143[_0x4830('0x1f')](_0x4830('0x20'),_0x11b10e+'-'+_0x61d7b6+'/'+_0x11a2aa)['json'](_0xcf31ac);}return null;};}function patchUpdates(_0x241f3b){return function(_0x28e6be){try{jsonpatch['apply'](_0x28e6be,_0x241f3b,!![]);}catch(_0x28db63){return BPromise['reject'](_0x28db63);}return _0x28e6be[_0x4830('0x21')]();};}function saveUpdates(_0x622ccb,_0x4c417b){return function(_0x1489d1){if(_0x1489d1){return _0x1489d1[_0x4830('0x22')](_0x622ccb)[_0x4830('0x23')](function(_0x3cd419){return _0x3cd419;});}return null;};}function removeEntity(_0x105189,_0x26e207){return function(_0x4a08c0){if(_0x4a08c0){return _0x4a08c0['destroy']()['then'](function(){_0x105189[_0x4830('0x19')](0xcc)[_0x4830('0x1a')]();});}};}function handleEntityNotFound(_0x2d97cc,_0x575cb5){return function(_0x187422){if(!_0x187422){_0x2d97cc[_0x4830('0x18')](0x194);}return _0x187422;};}function handleError(_0x47de9d,_0xd69e6d){_0xd69e6d=_0xd69e6d||0x1f4;return function(_0xe5a086){logger['error'](_0xe5a086['stack']);if(_0xe5a086[_0x4830('0x24')]){delete _0xe5a086[_0x4830('0x24')];}_0x47de9d['status'](_0xd69e6d)['send'](_0xe5a086);};}exports[_0x4830('0x25')]=function(_0x5a9eaf,_0x2ddce){var _0x6734e2={},_0x34ade1={},_0x38254a={'count':0x0,'rows':[]};var _0x3d2267=_[_0x4830('0x26')](db[_0x4830('0x27')][_0x4830('0x28')],function(_0x1c4671){return{'name':_0x1c4671['fieldName'],'type':_0x1c4671[_0x4830('0x29')][_0x4830('0x2a')]};});_0x34ade1['model']=_[_0x4830('0x26')](_0x3d2267,_0x4830('0x24'));_0x34ade1[_0x4830('0x2b')]=_[_0x4830('0x2c')](_0x5a9eaf[_0x4830('0x2b')]);_0x34ade1['filters']=_[_0x4830('0x2d')](_0x34ade1['model'],_0x34ade1[_0x4830('0x2b')]);_0x6734e2[_0x4830('0x2e')]=_[_0x4830('0x2d')](_0x34ade1['model'],qs[_0x4830('0x2f')](_0x5a9eaf[_0x4830('0x2b')][_0x4830('0x2f')]));_0x6734e2[_0x4830('0x2e')]=_0x6734e2[_0x4830('0x2e')][_0x4830('0x30')]?_0x6734e2[_0x4830('0x2e')]:_0x34ade1[_0x4830('0x31')];if(!_0x5a9eaf['query'][_0x4830('0x32')]('nolimit')){_0x6734e2[_0x4830('0x33')]=qs[_0x4830('0x33')](_0x5a9eaf[_0x4830('0x2b')]['limit']);_0x6734e2['offset']=qs[_0x4830('0x1c')](_0x5a9eaf['query'][_0x4830('0x1c')]);}_0x6734e2[_0x4830('0x34')]=qs[_0x4830('0x35')](_0x5a9eaf[_0x4830('0x2b')]['sort']);_0x6734e2[_0x4830('0x36')]=qs[_0x4830('0x37')](_[_0x4830('0x38')](_0x5a9eaf[_0x4830('0x2b')],_0x34ade1[_0x4830('0x37')]),_0x3d2267);if(_0x5a9eaf[_0x4830('0x2b')][_0x4830('0x39')]){_0x6734e2[_0x4830('0x36')]=_[_0x4830('0x3a')](_0x6734e2['where'],{'$or':_[_0x4830('0x26')](_0x3d2267,function(_0x43c2f0){if(_0x43c2f0[_0x4830('0x29')]!==_0x4830('0x3b')){var _0x46d48a={};_0x46d48a[_0x43c2f0[_0x4830('0x24')]]={'$like':'%'+_0x5a9eaf[_0x4830('0x2b')]['filter']+'%'};return _0x46d48a;}})});}_0x6734e2=_[_0x4830('0x3a')]({},_0x6734e2,_0x5a9eaf[_0x4830('0x3c')]);var _0x6a70e4={'where':_0x6734e2[_0x4830('0x36')]};return db[_0x4830('0x27')][_0x4830('0x1e')](_0x6a70e4)[_0x4830('0x23')](function(_0x4438b2){_0x38254a[_0x4830('0x1e')]=_0x4438b2;if(_0x5a9eaf[_0x4830('0x2b')]['includeAll']){_0x6734e2[_0x4830('0x3d')]=[{'all':!![]}];}return db[_0x4830('0x27')][_0x4830('0x3e')](_0x6734e2);})['then'](function(_0x1386c2){_0x38254a[_0x4830('0x3f')]=_0x1386c2;return _0x38254a;})[_0x4830('0x23')](respondWithFilteredResult(_0x2ddce,_0x6734e2))[_0x4830('0x40')](handleError(_0x2ddce,null));};exports[_0x4830('0x41')]=function(_0x48078f,_0x5ed141){var _0x26005e={'raw':!![],'where':{'id':_0x48078f[_0x4830('0x42')]['id']}},_0x222af5={};_0x222af5[_0x4830('0x31')]=_[_0x4830('0x2c')](db[_0x4830('0x27')]['rawAttributes']);_0x222af5[_0x4830('0x2b')]=_[_0x4830('0x2c')](_0x48078f['query']);_0x222af5[_0x4830('0x37')]=_[_0x4830('0x2d')](_0x222af5[_0x4830('0x31')],_0x222af5[_0x4830('0x2b')]);_0x26005e[_0x4830('0x2e')]=_[_0x4830('0x2d')](_0x222af5[_0x4830('0x31')],qs['fields'](_0x48078f['query'][_0x4830('0x2f')]));_0x26005e[_0x4830('0x2e')]=_0x26005e['attributes'][_0x4830('0x30')]?_0x26005e[_0x4830('0x2e')]:_0x222af5[_0x4830('0x31')];if(_0x48078f[_0x4830('0x2b')][_0x4830('0x43')]){_0x26005e[_0x4830('0x3d')]=[{'all':!![]}];}_0x26005e=_['merge']({},_0x26005e,_0x48078f[_0x4830('0x3c')]);return db['SmsApplication'][_0x4830('0x44')](_0x26005e)[_0x4830('0x23')](handleEntityNotFound(_0x5ed141,null))[_0x4830('0x23')](respondWithResult(_0x5ed141,null))[_0x4830('0x40')](handleError(_0x5ed141,null));};exports[_0x4830('0x45')]=function(_0x3b2c12,_0x11d6e9){return db[_0x4830('0x27')]['create'](_0x3b2c12[_0x4830('0x46')],{})[_0x4830('0x23')](respondWithResult(_0x11d6e9,0xc9))['catch'](handleError(_0x11d6e9,null));};exports[_0x4830('0x22')]=function(_0x17630d,_0x30d5a3){if(_0x17630d[_0x4830('0x46')]['id']){delete _0x17630d[_0x4830('0x46')]['id'];}return db[_0x4830('0x27')][_0x4830('0x44')]({'where':{'id':_0x17630d[_0x4830('0x42')]['id']}})[_0x4830('0x23')](handleEntityNotFound(_0x30d5a3,null))[_0x4830('0x23')](saveUpdates(_0x17630d[_0x4830('0x46')],null))[_0x4830('0x23')](respondWithResult(_0x30d5a3,null))[_0x4830('0x40')](handleError(_0x30d5a3,null));};exports[_0x4830('0x47')]=function(_0x5888df,_0x440dd8){return db[_0x4830('0x27')][_0x4830('0x44')]({'where':{'id':_0x5888df['params']['id']}})[_0x4830('0x23')](handleEntityNotFound(_0x440dd8,null))[_0x4830('0x23')](removeEntity(_0x440dd8,null))[_0x4830('0x40')](handleError(_0x440dd8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c9877c7..8e5403e 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 _0xd46b=['exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x31be80,_0x45da37){var _0x25cdb6=function(_0x24caca){while(--_0x24caca){_0x31be80['push'](_0x31be80['shift']());}};_0x25cdb6(++_0x45da37);}(_0xd46b,0xe1));var _0xbd46=function(_0x15503e,_0x2ce699){_0x15503e=_0x15503e-0x0;var _0x271c52=_0xd46b[_0x15503e];return _0x271c52;};'use strict';var _=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var logger=require('../../config/logger')(_0xbd46('0x2'));var moment=require(_0xbd46('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd46('0x4'));var fs=require('fs');var path=require(_0xbd46('0x5'));var rimraf=require(_0xbd46('0x6'));var config=require(_0xbd46('0x7'));var attributes=require(_0xbd46('0x8'));module[_0xbd46('0x9')]=function(_0x531346,_0x3e7bf8){return _0x531346['define']('SmsApplication',attributes,{'tableName':_0xbd46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd46('0xb'),'collate':_0xbd46('0xc')});}; \ No newline at end of file +var _0x06ca=['exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','./smsApplication.attributes'];(function(_0x501316,_0x558175){var _0x3d0f1d=function(_0x122dd5){while(--_0x122dd5){_0x501316['push'](_0x501316['shift']());}};_0x3d0f1d(++_0x558175);}(_0x06ca,0xad));var _0xa06c=function(_0x48e6d6,_0x146763){_0x48e6d6=_0x48e6d6-0x0;var _0x239c71=_0x06ca[_0x48e6d6];return _0x239c71;};'use strict';var _=require(_0xa06c('0x0'));var util=require(_0xa06c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa06c('0x2'));var BPromise=require(_0xa06c('0x3'));var rp=require(_0xa06c('0x4'));var fs=require('fs');var path=require(_0xa06c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa06c('0x6'));module[_0xa06c('0x7')]=function(_0x351d6a,_0x479954){return _0x351d6a[_0xa06c('0x8')]('SmsApplication',attributes,{'tableName':_0xa06c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa06c('0xa'),'collate':_0xa06c('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4d21168..84ebc40 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 _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x89fd66,_0x5e423c){var _0x444b18=function(_0x3e7a3a){while(--_0x3e7a3a){_0x89fd66['push'](_0x89fd66['shift']());}};_0x444b18(++_0x5e423c);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a9a[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file +var _0xf7f7=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x541388,_0x54f7be){var _0x46e650=function(_0x41b986){while(--_0x41b986){_0x541388['push'](_0x541388['shift']());}};_0x46e650(++_0x54f7be);}(_0xf7f7,0x192));var _0x7f7f=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xf7f7[_0x55c1f0];return _0x1530fa;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var moment=require(_0x7f7f('0x2'));var BPromise=require(_0x7f7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f7f('0x4'))['db'];var utils=require(_0x7f7f('0x5'));var logger=require(_0x7f7f('0x6'))(_0x7f7f('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f7f('0x8'));var client=jayson[_0x7f7f('0x9')][_0x7f7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce9ad,_0x5c40ac,_0x2cb854){return new BPromise(function(_0x58ac2b,_0xebd8af){return client['request'](_0x2ce9ad,_0x2cb854)[_0x7f7f('0xb')](function(_0x4e5cc7){logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));logger['debug'](_0x7f7f('0xf'),_0x5c40ac,_0x7f7f('0xe'),JSON[_0x7f7f('0x10')](_0x4e5cc7));if(_0x4e5cc7['error']){if(_0x4e5cc7['error']['code']===0x1f4){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0xebd8af(_0x4e5cc7['error']['message']);}logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0x58ac2b(_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);}else{logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));_0x58ac2b(_0x4e5cc7[_0x7f7f('0x13')][_0x7f7f('0x12')]);}})[_0x7f7f('0x14')](function(_0x175970){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x175970);_0xebd8af(_0x175970);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 828df77..74d96f9 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 _0x955f=['fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x234824,_0x9a91c0){var _0x2fce0f=function(_0x3e49d9){while(--_0x3e49d9){_0x234824['push'](_0x234824['shift']());}};_0x2fce0f(++_0x9a91c0);}(_0x955f,0x1eb));var _0xf955=function(_0x24e80b,_0x348bdc){_0x24e80b=_0x24e80b-0x0;var _0xb04d0c=_0x955f[_0x24e80b];return _0xb04d0c;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./smsInteraction.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getMessages']);router[_0xf955('0x7')]('/:id/download',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/',auth['isAuthenticated'](),controller[_0xf955('0x10')]);router['post'](_0xf955('0xd'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);router[_0xf955('0xf')](_0xf955('0x12'),auth[_0xf955('0x8')](),interaction[_0xf955('0x13')](_0xf955('0x14'),_0xf955('0x15')),controller[_0xf955('0x16')]);router[_0xf955('0x17')](_0xf955('0xb'),auth['isAuthenticated'](),interaction[_0xf955('0x13')]('sms',_0xf955('0x18')),controller[_0xf955('0x19')]);router[_0xf955('0x1a')](_0xf955('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf955('0x14'),_0xf955('0x1b')),controller[_0xf955('0x1c')]);router['delete'](_0xf955('0x12'),auth[_0xf955('0x8')](),controller[_0xf955('0x1d')]);module[_0xf955('0x1e')]=router; \ No newline at end of file +var _0xd4a2=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','sms','addTags','put','update','tracked','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0xeeb498,_0x2b4d1b){var _0x3b555a=function(_0x5c9a55){while(--_0x5c9a55){_0xeeb498['push'](_0xeeb498['shift']());}};_0x3b555a(++_0x2b4d1b);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1cc387,_0x50639b){_0x1cc387=_0x1cc387-0x0;var _0x29a434=_0xd4a2[_0x1cc387];return _0x29a434;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x10')]);router[_0x2d4a('0x11')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x12')]);router[_0x2d4a('0x11')](_0x2d4a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:addtags'),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:update'),controller[_0x2d4a('0x17')]);router['delete'](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction[_0x2d4a('0x18')](_0x2d4a('0x14'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0x2d4a('0x13'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x19')]);module[_0x2d4a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 78418e1..a089a0b 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 _0xed5f=['DATE','ENUM','out','moment','exports','BOOLEAN','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xed5f,0x1e6));var _0xfed5=function(_0x2e7c9a,_0x325e95){_0x2e7c9a=_0x2e7c9a-0x0;var _0x4592c1=_0xed5f[_0x2e7c9a];return _0x4592c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfed5('0x0'));module[_0xfed5('0x1')]={'closed':{'type':Sequelize[_0xfed5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfed5('0x3')]},'secondDisposition':{'type':Sequelize[_0xfed5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfed5('0x3')]},'note':{'type':Sequelize[_0xfed5('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfed5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8558=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0xe36a93,_0x146ba2){var _0x33cc72=function(_0x594ca3){while(--_0x594ca3){_0xe36a93['push'](_0xe36a93['shift']());}};_0x33cc72(++_0x146ba2);}(_0x8558,0x103));var _0x8855=function(_0x12ad13,_0x367be1){_0x12ad13=_0x12ad13-0x0;var _0x4d5c76=_0x8558[_0x12ad13];return _0x4d5c76;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8855('0x0'));module[_0x8855('0x1')]={'closed':{'type':Sequelize[_0x8855('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8855('0x3')]},'disposition':{'type':Sequelize[_0x8855('0x4')]},'secondDisposition':{'type':Sequelize[_0x8855('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8855('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8855('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8855('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8855('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8855('0x5')]('in',_0x8855('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8855('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 25db267..aa1f75b 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 _0x51d0=['sms','query','user','catch','params','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','update','addMessage','SmsMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','User','fullname','push','Contact','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','closed','closedAt','disposition','out','System','firstName','read','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll'];(function(_0x2536ff,_0x2f4300){var _0x52e7c6=function(_0x4a0a9f){while(--_0x4a0a9f){_0x2536ff['push'](_0x2536ff['shift']());}};_0x52e7c6(++_0x2f4300);}(_0x51d0,0xcd));var _0x051d=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x51d0[_0x2aa0e7];return _0x1472c0;};'use strict';var rimraf=require(_0x051d('0x0'));var zipdir=require(_0x051d('0x1'));var moment=require(_0x051d('0x2'));var BPromise=require(_0x051d('0x3'));var util=require(_0x051d('0x4'));var path=require(_0x051d('0x5'));var ejs=require(_0x051d('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x051d('0x7'));var qs=require(_0x051d('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0x051d('0x9'));var db=require(_0x051d('0xa'))['db'];config[_0x051d('0xb')]=_[_0x051d('0xc')](config[_0x051d('0xb')],{'host':_0x051d('0xd'),'port':0x18eb});var socket=require(_0x051d('0xe'))(new Redis(config[_0x051d('0xb')]));require(_0x051d('0xf'))[_0x051d('0x10')](socket);function respondWithStatusCode(_0x43994a,_0x32009e){_0x32009e=_0x32009e||0xcc;return function(_0x44ee54){if(_0x44ee54){return _0x43994a[_0x051d('0x11')](_0x32009e);}return _0x43994a[_0x051d('0x12')](_0x32009e)[_0x051d('0x13')]();};}function respondWithResult(_0x1a1ed1,_0x105cf4){_0x105cf4=_0x105cf4||0xc8;return function(_0x5c0bcf){if(_0x5c0bcf){return _0x1a1ed1['status'](_0x105cf4)[_0x051d('0x14')](_0x5c0bcf);}};}function respondWithFilteredResult(_0xda9a46,_0x31c8dd){return function(_0x4c5256){if(_0x4c5256){var _0x47eddc=typeof _0x31c8dd[_0x051d('0x15')]===_0x051d('0x16')&&typeof _0x31c8dd['limit']===_0x051d('0x16');var _0x97705a=_0x4c5256['count'];var _0x3aeaa5=_0x47eddc?0x0:_0x31c8dd[_0x051d('0x15')];var _0x44e0bd=_0x47eddc?_0x4c5256[_0x051d('0x17')]:_0x31c8dd[_0x051d('0x15')]+_0x31c8dd[_0x051d('0x18')];var _0x50a1ed;if(_0x44e0bd>=_0x97705a){_0x44e0bd=_0x97705a;_0x50a1ed=0xc8;}else{_0x50a1ed=0xce;}_0xda9a46[_0x051d('0x12')](_0x50a1ed);return _0xda9a46[_0x051d('0x19')](_0x051d('0x1a'),_0x3aeaa5+'-'+_0x44e0bd+'/'+_0x97705a)[_0x051d('0x14')](_0x4c5256);}return null;};}function saveUpdates(_0x54f465){return function(_0x365a67){if(_0x365a67){return _0x365a67['update'](_0x54f465)['then'](function(_0x2c4bfd){return _0x2c4bfd;});}return null;};}function removeEntity(_0x25c3cf){return function(_0x568d43){if(_0x568d43){return _0x568d43[_0x051d('0x1b')]()[_0x051d('0x1c')](function(){_0x25c3cf[_0x051d('0x12')](0xcc)[_0x051d('0x13')]();});}};}function handleEntityNotFound(_0x408a04){return function(_0x57b900){if(!_0x57b900){_0x408a04[_0x051d('0x11')](0x194);}return _0x57b900;};}function handleError(_0x2e50a6,_0x1d2db0){_0x1d2db0=_0x1d2db0||0x1f4;return function(_0x4efd28){logger[_0x051d('0x1d')](_0x4efd28[_0x051d('0x1e')]);if(_0x4efd28[_0x051d('0x1f')]){delete _0x4efd28[_0x051d('0x1f')];}_0x2e50a6[_0x051d('0x12')](_0x1d2db0)[_0x051d('0x20')](_0x4efd28);};}exports[_0x051d('0x21')]=function(_0x39cce0,_0x2df2e3){var _0x330916={};var _0x1f7b83=_[_0x051d('0x22')](db[_0x051d('0x23')][_0x051d('0x24')],function(_0x1e07f4){return{'name':_0x1e07f4[_0x051d('0x25')],'type':_0x1e07f4[_0x051d('0x26')]['key']};});_0x330916=qs[_0x051d('0x27')](_0x1f7b83,_0x39cce0);return interaction[_0x051d('0x28')](_0x051d('0x29'),_0x39cce0[_0x051d('0x2a')],_0x39cce0[_0x051d('0x2b')],_0x330916,_0x1f7b83)[_0x051d('0x1c')](respondWithFilteredResult(_0x2df2e3,_0x330916))[_0x051d('0x2c')](handleError(_0x2df2e3,null));};exports['show']=function(_0x283ccf,_0x5d7943){var _0x499f39={'raw':![],'where':{'id':_0x283ccf[_0x051d('0x2d')]['id']}},_0x1e3014={};_0x1e3014[_0x051d('0x2e')]=_['keys'](db[_0x051d('0x23')][_0x051d('0x24')]);_0x1e3014[_0x051d('0x2a')]=_[_0x051d('0x2f')](_0x283ccf[_0x051d('0x2a')]);_0x1e3014[_0x051d('0x30')]=_['intersection'](_0x1e3014[_0x051d('0x2e')],_0x1e3014[_0x051d('0x2a')]);_0x499f39['attributes']=_[_0x051d('0x31')](_0x1e3014['model'],qs[_0x051d('0x32')](_0x283ccf[_0x051d('0x2a')]['fields']));_0x499f39['attributes']=_0x499f39[_0x051d('0x33')]['length']?_0x499f39[_0x051d('0x33')]:_0x1e3014[_0x051d('0x2e')];if(_0x283ccf[_0x051d('0x2a')][_0x051d('0x34')]){_0x499f39[_0x051d('0x35')]=[{'all':!![]}];}_0x499f39=_[_0x051d('0x36')]({},_0x499f39,_0x283ccf[_0x051d('0x37')]);return db[_0x051d('0x23')][_0x051d('0x38')](_0x499f39)[_0x051d('0x1c')](handleEntityNotFound(_0x5d7943,null))[_0x051d('0x1c')](respondWithResult(_0x5d7943,null))[_0x051d('0x2c')](handleError(_0x5d7943,null));};exports['create']=function(_0x8007b0,_0x107630){return db[_0x051d('0x23')][_0x051d('0x39')](_0x8007b0[_0x051d('0x3a')],{})[_0x051d('0x1c')](respondWithResult(_0x107630,0xc9))[_0x051d('0x2c')](handleError(_0x107630,null));};exports[_0x051d('0x3b')]=function(_0x303fce,_0x1bb49a){if(_0x303fce[_0x051d('0x3a')]['id']){delete _0x303fce[_0x051d('0x3a')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x303fce[_0x051d('0x2d')]['id']}})[_0x051d('0x1c')](handleEntityNotFound(_0x1bb49a,null))[_0x051d('0x1c')](saveUpdates(_0x303fce[_0x051d('0x3a')],null))['then'](respondWithResult(_0x1bb49a,null))[_0x051d('0x2c')](handleError(_0x1bb49a,null));};exports[_0x051d('0x1b')]=function(_0x5f313d,_0x3742a2){return db[_0x051d('0x23')]['find']({'where':{'id':_0x5f313d['params']['id']}})['then'](handleEntityNotFound(_0x3742a2,null))[_0x051d('0x1c')](removeEntity(_0x3742a2,null))[_0x051d('0x2c')](handleError(_0x3742a2,null));};exports['describe']=function(_0x18ba98,_0x2e498c){return db[_0x051d('0x23')]['describe']()[_0x051d('0x1c')](respondWithResult(_0x2e498c,null))['catch'](handleError(_0x2e498c,null));};exports[_0x051d('0x3c')]=function(_0x53423b,_0x5279d5){return db[_0x051d('0x3d')]['find']({'where':{'id':_0x53423b[_0x051d('0x2d')]['id']}})[_0x051d('0x1c')](handleEntityNotFound(_0x5279d5,null))['then'](function(_0x5829ef){if(_0x5829ef){return _0x5829ef['addMessage'](_0x53423b[_0x051d('0x3a')][_0x051d('0x3e')],_[_0x051d('0x3f')](_0x53423b[_0x051d('0x3a')],[_0x051d('0x3e'),'id'])||{});}})[_0x051d('0x1c')](respondWithResult(_0x5279d5,null))['catch'](handleError(_0x5279d5,null));};exports[_0x051d('0x40')]=function(_0x2af984,_0x37758d){var _0x3eb440={'raw':![],'where':{}};var _0x4596d4={};var _0x56869c={'count':0x0,'rows':[]};return db[_0x051d('0x23')][_0x051d('0x41')]({'where':{'id':_0x2af984[_0x051d('0x2d')]['id']}})[_0x051d('0x1c')](handleEntityNotFound(_0x37758d,null))['then'](function(_0x38dfe8){if(_0x38dfe8){_0x4596d4[_0x051d('0x2e')]=_[_0x051d('0x2f')](db['SmsMessage'][_0x051d('0x24')]);_0x4596d4[_0x051d('0x2a')]=_[_0x051d('0x2f')](_0x2af984[_0x051d('0x2a')]);_0x4596d4[_0x051d('0x30')]=_['intersection'](_0x4596d4[_0x051d('0x2e')],_0x4596d4['query']);_0x3eb440[_0x051d('0x33')]=_[_0x051d('0x31')](_0x4596d4[_0x051d('0x2e')],qs[_0x051d('0x32')](_0x2af984[_0x051d('0x2a')]['fields']));_0x3eb440[_0x051d('0x33')]=_0x3eb440[_0x051d('0x33')][_0x051d('0x42')]?_0x3eb440[_0x051d('0x33')]:_0x4596d4[_0x051d('0x2e')];if(!_0x2af984[_0x051d('0x2a')][_0x051d('0x43')](_0x051d('0x44'))){_0x3eb440[_0x051d('0x18')]=qs[_0x051d('0x18')](_0x2af984['query'][_0x051d('0x18')]);_0x3eb440[_0x051d('0x15')]=qs['offset'](_0x2af984[_0x051d('0x2a')][_0x051d('0x15')]);}_0x3eb440[_0x051d('0x45')]=qs[_0x051d('0x46')](_0x2af984['query']['sort']);_0x3eb440[_0x051d('0x47')]=qs[_0x051d('0x30')](_['pick'](_0x2af984['query'],_0x4596d4[_0x051d('0x30')]));_0x3eb440[_0x051d('0x47')][_0x051d('0x48')]=_0x38dfe8['id'];if(_0x2af984['query']['filter']){_0x3eb440[_0x051d('0x47')]=_['merge'](_0x3eb440[_0x051d('0x47')],{'$or':_[_0x051d('0x22')](_0x3eb440[_0x051d('0x33')],function(_0x32a62a){var _0x5ea0d9={};_0x5ea0d9[_0x32a62a]={'$like':'%'+_0x2af984[_0x051d('0x2a')][_0x051d('0x49')]+'%'};return _0x5ea0d9;})});}if(_0x2af984['query'][_0x051d('0x4a')]){var _0x1a7ffc=_0x2af984[_0x051d('0x2a')][_0x051d('0x4a')][_0x051d('0x4b')](',');var _0x5c4a86={};_0x5c4a86[_0x1a7ffc[0x0]]={'$gte':moment(_0x1a7ffc[0x1])[_0x051d('0x4c')](_0x051d('0x4d'))};_0x3eb440[_0x051d('0x47')]=_[_0x051d('0x36')](_0x3eb440[_0x051d('0x47')],_0x5c4a86);}_0x3eb440=_[_0x051d('0x36')]({},_0x3eb440,_0x2af984[_0x051d('0x37')]);return db['SmsMessage'][_0x051d('0x17')]({'where':_0x3eb440[_0x051d('0x47')]})['then'](function(_0x2c0b6a){_0x56869c[_0x051d('0x17')]=_0x2c0b6a;if(_0x2af984[_0x051d('0x2a')][_0x051d('0x34')]){_0x3eb440['include']=[{'all':!![]}];}return db['SmsMessage'][_0x051d('0x28')](_0x3eb440);})[_0x051d('0x1c')](function(_0xb3392a){_0x56869c[_0x051d('0x4e')]=_0xb3392a;return _0x56869c;});}})['then'](respondWithFilteredResult(_0x37758d,_0x3eb440))[_0x051d('0x2c')](handleError(_0x37758d,null));};exports[_0x051d('0x4f')]=function(_0x2fd23f,_0x3f8659){return db['SmsInteraction'][_0x051d('0x38')]({'where':{'id':_0x2fd23f[_0x051d('0x2d')]['id']}})[_0x051d('0x1c')](handleEntityNotFound(_0x3f8659,null))[_0x051d('0x1c')](function(_0xf1dbcc){if(_0xf1dbcc){return _0xf1dbcc[_0x051d('0x50')](_0x2fd23f['body'][_0x051d('0x3e')],_['omit'](_0x2fd23f[_0x051d('0x3a')],['ids','id'])||{})[_0x051d('0x51')](function(){return db['Tag']['findAll']({'attributes':['id',_0x051d('0x1f'),_0x051d('0x52')],'where':{'id':_0x2fd23f['body'][_0x051d('0x3e')]}});})[_0x051d('0x1c')](function(_0xf3c87e){socket[_0x051d('0x53')](_0x051d('0x54'),{'id':Number(_0x2fd23f[_0x051d('0x2d')]['id']),'tags':_0xf3c87e||[]});return{'id':Number(_0x2fd23f[_0x051d('0x2d')]['id']),'tags':_0xf3c87e||[]};});}})[_0x051d('0x1c')](respondWithResult(_0x3f8659,null))[_0x051d('0x2c')](handleError(_0x3f8659,null));};exports['removeTags']=function(_0x1ed4d7,_0x34d73d){return db[_0x051d('0x23')][_0x051d('0x38')]({'where':{'id':_0x1ed4d7[_0x051d('0x2d')]['id']}})[_0x051d('0x1c')](handleEntityNotFound(_0x34d73d,null))['then'](function(_0x1f5bdf){if(_0x1f5bdf){return _0x1f5bdf[_0x051d('0x55')](_0x1ed4d7['query']['ids']);}})[_0x051d('0x1c')](respondWithStatusCode(_0x34d73d,null))[_0x051d('0x2c')](handleError(_0x34d73d,null));};exports[_0x051d('0x56')]=function(_0x35b12d,_0x2d4eb0){var _0x5d3a45=moment()[_0x051d('0x57')]()[_0x051d('0x58')]();var _0x5c7db4=path[_0x051d('0x59')](config[_0x051d('0x5a')],_0x051d('0x5b'),'files',_0x051d('0x5c'));var _0x59bcf8=path['join'](_0x5c7db4,_0x5d3a45);var _0x491545=util[_0x051d('0x4c')](_0x051d('0x5d'),_0x35b12d[_0x051d('0x2d')]['id'],_0x5d3a45);var _0x110dc3=path['join'](_0x5c7db4,_0x491545);var _0x58d690=[];_0x58d690['push']({'model':db[_0x051d('0x5e')],'as':_0x051d('0x5e'),'attributes':['id',_0x051d('0x5f')],'raw':!![]});_0x58d690[_0x051d('0x60')]({'model':db['CmContact'],'as':_0x051d('0x61'),'attributes':['id','firstName',_0x051d('0x62')],'raw':!![]});var _0x4d426a=[{'model':db[_0x051d('0x3d')],'as':_0x051d('0x63'),'attributes':['id',_0x051d('0x3a'),_0x051d('0x64'),_0x051d('0x65'),_0x051d('0x66'),'read'],'include':_0x58d690}];_0x4d426a['push']({'model':db[_0x051d('0x67')],'as':_0x051d('0x68'),'attributes':['id',_0x051d('0x1f')]});_0x4d426a[_0x051d('0x60')]({'model':db[_0x051d('0x5e')],'as':_0x051d('0x69'),'attributes':['id',_0x051d('0x5f')]});return db[_0x051d('0x23')][_0x051d('0x38')]({'where':{'id':_0x35b12d[_0x051d('0x2d')]['id']},'include':_0x4d426a})[_0x051d('0x1c')](handleEntityNotFound(_0x2d4eb0,null))[_0x051d('0x1c')](function(_0x5e2501){if(_0x5e2501){var _0x16fdb1=_0x5e2501[_0x051d('0x6a')]({'plain':!![]});fs[_0x051d('0x6b')](_0x59bcf8);var _0x483b16={'channel':_0x051d('0x6c'),'account':_0x16fdb1['Account'][_0x051d('0x1f')],'agent':_0x16fdb1[_0x051d('0x69')]?_0x16fdb1[_0x051d('0x69')][_0x051d('0x5f')]:'N.A.','createdAt':moment(_0x16fdb1[_0x051d('0x64')])[_0x051d('0x4c')](_0x051d('0x4d'))[_0x051d('0x58')](),'closedAt':_0x16fdb1[_0x051d('0x6d')]?moment(_0x16fdb1[_0x051d('0x6e')])[_0x051d('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x051d('0x58')]():'','disposition':_0x16fdb1[_0x051d('0x6f')],'messages':_(_0x16fdb1[_0x051d('0x63')])[_0x051d('0x49')]({'secret':![]})[_0x051d('0x22')](function(_0x98c140){return{'date':moment(_0x98c140[_0x051d('0x64')])['format'](_0x051d('0x4d'))[_0x051d('0x58')](),'sender':_0x98c140[_0x051d('0x65')]===_0x051d('0x70')?_0x98c140['User']?_0x98c140['User'][_0x051d('0x5f')]:_0x051d('0x71'):_0x98c140[_0x051d('0x61')][_0x051d('0x72')]+(_0x98c140[_0x051d('0x61')][_0x051d('0x62')]?'\x20'+_0x98c140['Contact'][_0x051d('0x62')]:''),'body':_0x98c140[_0x051d('0x3a')],'direction':_0x98c140[_0x051d('0x65')]===_0x051d('0x70')?'A':'C','secret':_0x98c140[_0x051d('0x66')],'read':_0x98c140[_0x051d('0x73')]};})['value']()};return ejs[_0x051d('0x74')](path[_0x051d('0x59')](config[_0x051d('0x5a')],'server','views',_0x051d('0x75')),{'interaction':_0x483b16})[_0x051d('0x1c')](function(_0x40bf39){var _0x4eb5e7=path[_0x051d('0x59')](_0x59bcf8,_0x051d('0x76')+_0x16fdb1['id']+'-'+_0x5d3a45+'.pdf');var _0x356b37={'path':_0x4eb5e7,'channel':_0x051d('0x6c'),'interactionId':_0x16fdb1['id']};return pdf[_0x051d('0x77')](_0x40bf39,_0x356b37);})[_0x051d('0x1c')](function(){return new BPromise(function(_0x15c71e,_0xf2f19d){zipdir(_0x59bcf8,{'saveTo':_0x110dc3},function(_0x16ac7d,_0x48dc01){if(_0x16ac7d)return _0xf2f19d(_0x16ac7d);return _0x15c71e(_0x48dc01);});})[_0x051d('0x1c')](function(){return new BPromise(function(_0x4587a0,_0x38fed9){rimraf(_0x59bcf8,function(_0x1a4756){if(_0x1a4756)_0x38fed9(_0x1a4756);return _0x4587a0();});});})[_0x051d('0x1c')](function(){return _0x2d4eb0[_0x051d('0x56')](_0x110dc3,_0x491545,function(_0x22adcc){if(_0x22adcc){console[_0x051d('0x78')](_0x051d('0x79'),_0x22adcc);}else{fs[_0x051d('0x7a')](_0x110dc3);}});});});}else{return _0x2d4eb0[_0x051d('0x11')](0xc8);}})['catch'](handleError(_0x2d4eb0,null));}; \ No newline at end of file +var _0x854d=['Messages','createdAt','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','disposition','out','Contact','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','update','then','destroy','end','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','sms','catch','show','params','model','keys','query','filters','intersection','attributes','fields','merge','options','find','create','body','describe','addMessage','ids','getMessages','SmsMessage','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','omit','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','push','User','fullname','CmContact','firstName'];(function(_0x52e04e,_0x24c11a){var _0x46a0e0=function(_0x56b0a1){while(--_0x56b0a1){_0x52e04e['push'](_0x52e04e['shift']());}};_0x46a0e0(++_0x24c11a);}(_0x854d,0x100));var _0xd854=function(_0x533ef1,_0x4c37a6){_0x533ef1=_0x533ef1-0x0;var _0x555ec3=_0x854d[_0x533ef1];return _0x555ec3;};'use strict';var rimraf=require(_0xd854('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xd854('0x1'));var path=require('path');var ejs=require(_0xd854('0x2'));var fs=require('fs');var _=require(_0xd854('0x3'));var Redis=require(_0xd854('0x4'));var interaction=require(_0xd854('0x5'));var qs=require(_0xd854('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0xd854('0x7'))(_0xd854('0x8'));var config=require(_0xd854('0x9'));var db=require(_0xd854('0xa'))['db'];config['redis']=_[_0xd854('0xb')](config[_0xd854('0xc')],{'host':_0xd854('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd854('0xc')]));require(_0xd854('0xe'))[_0xd854('0xf')](socket);function respondWithStatusCode(_0x492a87,_0x39b202){_0x39b202=_0x39b202||0xcc;return function(_0x2d31ef){if(_0x2d31ef){return _0x492a87[_0xd854('0x10')](_0x39b202);}return _0x492a87[_0xd854('0x11')](_0x39b202)['end']();};}function respondWithResult(_0x5cb952,_0x387738){_0x387738=_0x387738||0xc8;return function(_0x12a823){if(_0x12a823){return _0x5cb952[_0xd854('0x11')](_0x387738)[_0xd854('0x12')](_0x12a823);}};}function respondWithFilteredResult(_0x3f6556,_0x4eeed6){return function(_0x5893d8){if(_0x5893d8){var _0x383d49=typeof _0x4eeed6[_0xd854('0x13')]==='undefined'&&typeof _0x4eeed6[_0xd854('0x14')]===_0xd854('0x15');var _0x6721df=_0x5893d8[_0xd854('0x16')];var _0x56d2ff=_0x383d49?0x0:_0x4eeed6[_0xd854('0x13')];var _0x72b21a=_0x383d49?_0x5893d8[_0xd854('0x16')]:_0x4eeed6[_0xd854('0x13')]+_0x4eeed6[_0xd854('0x14')];var _0x315970;if(_0x72b21a>=_0x6721df){_0x72b21a=_0x6721df;_0x315970=0xc8;}else{_0x315970=0xce;}_0x3f6556['status'](_0x315970);return _0x3f6556[_0xd854('0x17')]('Content-Range',_0x56d2ff+'-'+_0x72b21a+'/'+_0x6721df)[_0xd854('0x12')](_0x5893d8);}return null;};}function saveUpdates(_0x3d4eeb){return function(_0x4ae62e){if(_0x4ae62e){return _0x4ae62e[_0xd854('0x18')](_0x3d4eeb)[_0xd854('0x19')](function(_0xf523bf){return _0xf523bf;});}return null;};}function removeEntity(_0x46a5a5){return function(_0x499885){if(_0x499885){return _0x499885[_0xd854('0x1a')]()[_0xd854('0x19')](function(){_0x46a5a5[_0xd854('0x11')](0xcc)[_0xd854('0x1b')]();});}};}function handleEntityNotFound(_0x5e07db){return function(_0x454940){if(!_0x454940){_0x5e07db['sendStatus'](0x194);}return _0x454940;};}function handleError(_0x20393c,_0x1bb9cb){_0x1bb9cb=_0x1bb9cb||0x1f4;return function(_0x5e709f){logger['error'](_0x5e709f[_0xd854('0x1c')]);if(_0x5e709f[_0xd854('0x1d')]){delete _0x5e709f[_0xd854('0x1d')];}_0x20393c[_0xd854('0x11')](_0x1bb9cb)['send'](_0x5e709f);};}exports[_0xd854('0x1e')]=function(_0x504f02,_0x23ea9d){var _0x37a3f7={};var _0x57e3d2=_[_0xd854('0x1f')](db[_0xd854('0x20')][_0xd854('0x21')],function(_0x4f0070){return{'name':_0x4f0070[_0xd854('0x22')],'type':_0x4f0070[_0xd854('0x23')]['key']};});_0x37a3f7=qs['getOptions'](_0x57e3d2,_0x504f02);return interaction['findAll'](_0xd854('0x24'),_0x504f02['query'],_0x504f02['user'],_0x37a3f7,_0x57e3d2)[_0xd854('0x19')](respondWithFilteredResult(_0x23ea9d,_0x37a3f7))[_0xd854('0x25')](handleError(_0x23ea9d,null));};exports[_0xd854('0x26')]=function(_0x21b7fa,_0x348e6e){var _0x4d1606={'raw':![],'where':{'id':_0x21b7fa[_0xd854('0x27')]['id']}},_0x59eb6a={};_0x59eb6a[_0xd854('0x28')]=_[_0xd854('0x29')](db[_0xd854('0x20')][_0xd854('0x21')]);_0x59eb6a[_0xd854('0x2a')]=_[_0xd854('0x29')](_0x21b7fa[_0xd854('0x2a')]);_0x59eb6a[_0xd854('0x2b')]=_[_0xd854('0x2c')](_0x59eb6a[_0xd854('0x28')],_0x59eb6a[_0xd854('0x2a')]);_0x4d1606[_0xd854('0x2d')]=_[_0xd854('0x2c')](_0x59eb6a[_0xd854('0x28')],qs[_0xd854('0x2e')](_0x21b7fa[_0xd854('0x2a')][_0xd854('0x2e')]));_0x4d1606[_0xd854('0x2d')]=_0x4d1606[_0xd854('0x2d')]['length']?_0x4d1606[_0xd854('0x2d')]:_0x59eb6a[_0xd854('0x28')];if(_0x21b7fa[_0xd854('0x2a')]['includeAll']){_0x4d1606['include']=[{'all':!![]}];}_0x4d1606=_[_0xd854('0x2f')]({},_0x4d1606,_0x21b7fa[_0xd854('0x30')]);return db['SmsInteraction'][_0xd854('0x31')](_0x4d1606)[_0xd854('0x19')](handleEntityNotFound(_0x348e6e,null))[_0xd854('0x19')](respondWithResult(_0x348e6e,null))['catch'](handleError(_0x348e6e,null));};exports[_0xd854('0x32')]=function(_0x3f3d6c,_0x4f1b51){return db['SmsInteraction'][_0xd854('0x32')](_0x3f3d6c['body'],{})['then'](respondWithResult(_0x4f1b51,0xc9))[_0xd854('0x25')](handleError(_0x4f1b51,null));};exports[_0xd854('0x18')]=function(_0x31a3d4,_0x328979){if(_0x31a3d4[_0xd854('0x33')]['id']){delete _0x31a3d4[_0xd854('0x33')]['id'];}return db['SmsInteraction'][_0xd854('0x31')]({'where':{'id':_0x31a3d4[_0xd854('0x27')]['id']}})['then'](handleEntityNotFound(_0x328979,null))[_0xd854('0x19')](saveUpdates(_0x31a3d4['body'],null))[_0xd854('0x19')](respondWithResult(_0x328979,null))['catch'](handleError(_0x328979,null));};exports['destroy']=function(_0x500b0f,_0x39a74a){return db['SmsInteraction'][_0xd854('0x31')]({'where':{'id':_0x500b0f[_0xd854('0x27')]['id']}})[_0xd854('0x19')](handleEntityNotFound(_0x39a74a,null))['then'](removeEntity(_0x39a74a,null))[_0xd854('0x25')](handleError(_0x39a74a,null));};exports[_0xd854('0x34')]=function(_0x3f8c0a,_0x1c44f6){return db[_0xd854('0x20')][_0xd854('0x34')]()[_0xd854('0x19')](respondWithResult(_0x1c44f6,null))[_0xd854('0x25')](handleError(_0x1c44f6,null));};exports['addMessage']=function(_0x5deaa6,_0x5cb0f5){return db['SmsMessage']['find']({'where':{'id':_0x5deaa6[_0xd854('0x27')]['id']}})[_0xd854('0x19')](handleEntityNotFound(_0x5cb0f5,null))[_0xd854('0x19')](function(_0x3938bc){if(_0x3938bc){return _0x3938bc[_0xd854('0x35')](_0x5deaa6[_0xd854('0x33')][_0xd854('0x36')],_['omit'](_0x5deaa6[_0xd854('0x33')],[_0xd854('0x36'),'id'])||{});}})[_0xd854('0x19')](respondWithResult(_0x5cb0f5,null))['catch'](handleError(_0x5cb0f5,null));};exports[_0xd854('0x37')]=function(_0x15e0c5,_0x32016a){var _0x566ab3={'raw':![],'where':{}};var _0xb0d4b1={};var _0x218dec={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x15e0c5[_0xd854('0x27')]['id']}})['then'](handleEntityNotFound(_0x32016a,null))[_0xd854('0x19')](function(_0x38314a){if(_0x38314a){_0xb0d4b1[_0xd854('0x28')]=_[_0xd854('0x29')](db[_0xd854('0x38')][_0xd854('0x21')]);_0xb0d4b1[_0xd854('0x2a')]=_['keys'](_0x15e0c5[_0xd854('0x2a')]);_0xb0d4b1[_0xd854('0x2b')]=_['intersection'](_0xb0d4b1['model'],_0xb0d4b1[_0xd854('0x2a')]);_0x566ab3[_0xd854('0x2d')]=_[_0xd854('0x2c')](_0xb0d4b1[_0xd854('0x28')],qs['fields'](_0x15e0c5['query']['fields']));_0x566ab3[_0xd854('0x2d')]=_0x566ab3['attributes']['length']?_0x566ab3[_0xd854('0x2d')]:_0xb0d4b1['model'];if(!_0x15e0c5['query'][_0xd854('0x39')](_0xd854('0x3a'))){_0x566ab3[_0xd854('0x14')]=qs[_0xd854('0x14')](_0x15e0c5[_0xd854('0x2a')][_0xd854('0x14')]);_0x566ab3[_0xd854('0x13')]=qs[_0xd854('0x13')](_0x15e0c5[_0xd854('0x2a')][_0xd854('0x13')]);}_0x566ab3['order']=qs[_0xd854('0x3b')](_0x15e0c5['query']['sort']);_0x566ab3[_0xd854('0x3c')]=qs['filters'](_['pick'](_0x15e0c5[_0xd854('0x2a')],_0xb0d4b1['filters']));_0x566ab3[_0xd854('0x3c')][_0xd854('0x3d')]=_0x38314a['id'];if(_0x15e0c5['query'][_0xd854('0x3e')]){_0x566ab3['where']=_[_0xd854('0x2f')](_0x566ab3['where'],{'$or':_[_0xd854('0x1f')](_0x566ab3['attributes'],function(_0x51e722){var _0x3258e5={};_0x3258e5[_0x51e722]={'$like':'%'+_0x15e0c5[_0xd854('0x2a')][_0xd854('0x3e')]+'%'};return _0x3258e5;})});}if(_0x15e0c5[_0xd854('0x2a')][_0xd854('0x3f')]){var _0x5848c6=_0x15e0c5[_0xd854('0x2a')][_0xd854('0x3f')]['split'](',');var _0x44631f={};_0x44631f[_0x5848c6[0x0]]={'$gte':moment(_0x5848c6[0x1])[_0xd854('0x40')](_0xd854('0x41'))};_0x566ab3[_0xd854('0x3c')]=_['merge'](_0x566ab3[_0xd854('0x3c')],_0x44631f);}_0x566ab3=_[_0xd854('0x2f')]({},_0x566ab3,_0x15e0c5[_0xd854('0x30')]);return db[_0xd854('0x38')][_0xd854('0x16')]({'where':_0x566ab3[_0xd854('0x3c')]})['then'](function(_0x47556b){_0x218dec[_0xd854('0x16')]=_0x47556b;if(_0x15e0c5[_0xd854('0x2a')]['includeAll']){_0x566ab3[_0xd854('0x42')]=[{'all':!![]}];}return db[_0xd854('0x38')][_0xd854('0x43')](_0x566ab3);})[_0xd854('0x19')](function(_0x531a1e){_0x218dec[_0xd854('0x44')]=_0x531a1e;return _0x218dec;});}})[_0xd854('0x19')](respondWithFilteredResult(_0x32016a,_0x566ab3))[_0xd854('0x25')](handleError(_0x32016a,null));};exports[_0xd854('0x45')]=function(_0x3c3f21,_0x537677){return db['SmsInteraction'][_0xd854('0x31')]({'where':{'id':_0x3c3f21[_0xd854('0x27')]['id']}})['then'](handleEntityNotFound(_0x537677,null))[_0xd854('0x19')](function(_0x558a67){if(_0x558a67){return _0x558a67[_0xd854('0x46')](_0x3c3f21[_0xd854('0x33')][_0xd854('0x36')],_[_0xd854('0x47')](_0x3c3f21[_0xd854('0x33')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd854('0x48')],'where':{'id':_0x3c3f21[_0xd854('0x33')][_0xd854('0x36')]}});})[_0xd854('0x19')](function(_0x49ca8a){socket[_0xd854('0x49')](_0xd854('0x4a'),{'id':Number(_0x3c3f21['params']['id']),'tags':_0x49ca8a||[]});return{'id':Number(_0x3c3f21[_0xd854('0x27')]['id']),'tags':_0x49ca8a||[]};});}})['then'](respondWithResult(_0x537677,null))[_0xd854('0x25')](handleError(_0x537677,null));};exports[_0xd854('0x4b')]=function(_0xbc2b49,_0x323d61){return db['SmsInteraction'][_0xd854('0x31')]({'where':{'id':_0xbc2b49['params']['id']}})[_0xd854('0x19')](handleEntityNotFound(_0x323d61,null))[_0xd854('0x19')](function(_0xa7fbb4){if(_0xa7fbb4){return _0xa7fbb4[_0xd854('0x4b')](_0xbc2b49[_0xd854('0x2a')][_0xd854('0x36')]);}})['then'](respondWithStatusCode(_0x323d61,null))[_0xd854('0x25')](handleError(_0x323d61,null));};exports[_0xd854('0x4c')]=function(_0x4e2249,_0x3719dc){var _0x2aefbc=moment()[_0xd854('0x4d')]()[_0xd854('0x4e')]();var _0x41a078=path['join'](config[_0xd854('0x4f')],_0xd854('0x50'),_0xd854('0x51'),_0xd854('0x52'));var _0x2bd3e4=path[_0xd854('0x53')](_0x41a078,_0x2aefbc);var _0x442d2d=util[_0xd854('0x40')]('transcript-%d-%s.zip',_0x4e2249[_0xd854('0x27')]['id'],_0x2aefbc);var _0x44ebb7=path['join'](_0x41a078,_0x442d2d);var _0xe08a76=[];_0xe08a76[_0xd854('0x54')]({'model':db[_0xd854('0x55')],'as':_0xd854('0x55'),'attributes':['id',_0xd854('0x56')],'raw':!![]});_0xe08a76['push']({'model':db[_0xd854('0x57')],'as':'Contact','attributes':['id',_0xd854('0x58'),'lastName'],'raw':!![]});var _0x21d09f=[{'model':db[_0xd854('0x38')],'as':_0xd854('0x59'),'attributes':['id','body',_0xd854('0x5a'),_0xd854('0x5b'),_0xd854('0x5c'),_0xd854('0x5d')],'include':_0xe08a76}];_0x21d09f['push']({'model':db[_0xd854('0x5e')],'as':_0xd854('0x5f'),'attributes':['id','name']});_0x21d09f['push']({'model':db[_0xd854('0x55')],'as':'Owner','attributes':['id',_0xd854('0x56')]});return db[_0xd854('0x20')][_0xd854('0x31')]({'where':{'id':_0x4e2249['params']['id']},'include':_0x21d09f})[_0xd854('0x19')](handleEntityNotFound(_0x3719dc,null))[_0xd854('0x19')](function(_0x3ee9d3){if(_0x3ee9d3){var _0x4a2d9f=_0x3ee9d3[_0xd854('0x60')]({'plain':!![]});fs[_0xd854('0x61')](_0x2bd3e4);var _0x54d51a={'channel':_0xd854('0x62'),'account':_0x4a2d9f[_0xd854('0x5f')][_0xd854('0x1d')],'agent':_0x4a2d9f[_0xd854('0x63')]?_0x4a2d9f['Owner']['fullname']:_0xd854('0x64'),'createdAt':moment(_0x4a2d9f[_0xd854('0x5a')])['format'](_0xd854('0x41'))['toString'](),'closedAt':_0x4a2d9f[_0xd854('0x65')]?moment(_0x4a2d9f[_0xd854('0x66')])['format'](_0xd854('0x41'))[_0xd854('0x4e')]():'','disposition':_0x4a2d9f[_0xd854('0x67')],'messages':_(_0x4a2d9f[_0xd854('0x59')])[_0xd854('0x3e')]({'secret':![]})['map'](function(_0x5fbcee){return{'date':moment(_0x5fbcee[_0xd854('0x5a')])['format'](_0xd854('0x41'))[_0xd854('0x4e')](),'sender':_0x5fbcee[_0xd854('0x5b')]===_0xd854('0x68')?_0x5fbcee[_0xd854('0x55')]?_0x5fbcee[_0xd854('0x55')]['fullname']:'System':_0x5fbcee[_0xd854('0x69')][_0xd854('0x58')]+(_0x5fbcee[_0xd854('0x69')][_0xd854('0x6a')]?'\x20'+_0x5fbcee['Contact'][_0xd854('0x6a')]:''),'body':_0x5fbcee[_0xd854('0x33')],'direction':_0x5fbcee[_0xd854('0x5b')]===_0xd854('0x68')?'A':'C','secret':_0x5fbcee[_0xd854('0x5c')],'read':_0x5fbcee['read']};})['value']()};return ejs[_0xd854('0x6b')](path[_0xd854('0x53')](config['root'],_0xd854('0x50'),_0xd854('0x6c'),_0xd854('0x6d')),{'interaction':_0x54d51a})[_0xd854('0x19')](function(_0x15f660){var _0x27880a=path[_0xd854('0x53')](_0x2bd3e4,_0xd854('0x6e')+_0x4a2d9f['id']+'-'+_0x2aefbc+_0xd854('0x6f'));var _0x2a9472={'path':_0x27880a,'channel':_0xd854('0x62'),'interactionId':_0x4a2d9f['id']};return pdf['createPdfFromHTML'](_0x15f660,_0x2a9472);})[_0xd854('0x19')](function(){return new BPromise(function(_0x2f06d3,_0x5aa4c9){zipdir(_0x2bd3e4,{'saveTo':_0x44ebb7},function(_0x563e56,_0x4dc16c){if(_0x563e56)return _0x5aa4c9(_0x563e56);return _0x2f06d3(_0x4dc16c);});})[_0xd854('0x19')](function(){return new BPromise(function(_0x267c6d,_0x225e34){rimraf(_0x2bd3e4,function(_0x2f4693){if(_0x2f4693)_0x225e34(_0x2f4693);return _0x267c6d();});});})[_0xd854('0x19')](function(){return _0x3719dc['download'](_0x44ebb7,_0x442d2d,function(_0xce2ff1){if(_0xce2ff1){console[_0xd854('0x70')](_0xd854('0x71'),_0xce2ff1);}else{fs[_0xd854('0x72')](_0x44ebb7);}});});});}else{return _0x3719dc[_0xd854('0x10')](0xc8);}})[_0xd854('0x25')](handleError(_0x3719dc,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6d1285c..d480eda 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 _0x47c5=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x47c5,0x165));var _0x547c=function(_0x457ef8,_0x1a19ae){_0x457ef8=_0x457ef8-0x0;var _0x596c56=_0x47c5[_0x457ef8];return _0x596c56;};'use strict';var EventEmitter=require(_0x547c('0x0'));var SmsInteraction=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var SmsMessage=require(_0x547c('0x1'))['db'][_0x547c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x547c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x547c('0x5'),'afterDestroy':_0x547c('0x6')};function emitEvent(_0x5b48c9){return function(_0x3e827e,_0x468220,_0x51ab7f){_0x3e827e[_0x547c('0x7')]({'attributes':['id'],'raw':!![]})[_0x547c('0x8')](function(_0x381f2e){_0x3e827e[_0x547c('0x9')](_0x547c('0xa'),_0x381f2e[_0x547c('0xb')](function(_0x3e2279){return{'id':_0x3e2279['id']};}));return SmsMessage[_0x547c('0xc')]({'where':{'SmsInteractionId':_0x3e827e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x547c('0x8')](function(_0x44a581){_0x3e827e[_0x547c('0x9')](_0x547c('0xd'),_0x44a581[_0x547c('0xe')]);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9+':'+_0x3e827e['id'],_0x3e827e);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9,_0x3e827e);_0x51ab7f(null);})[_0x547c('0x10')](_0x51ab7f(null));};}for(var e in events){if(events[_0x547c('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x547c('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0xc2c7=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then'];(function(_0x38fa4f,_0x5f301a){var _0x1b0692=function(_0x31c338){while(--_0x31c338){_0x38fa4f['push'](_0x38fa4f['shift']());}};_0x1b0692(++_0x5f301a);}(_0xc2c7,0x134));var _0x7c2c=function(_0x33c365,_0x2f56db){_0x33c365=_0x33c365-0x0;var _0x4621de=_0xc2c7[_0x33c365];return _0x4621de;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x1')];var SmsMessage=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7c2c('0x3')](0x0);var events={'afterCreate':_0x7c2c('0x4'),'afterUpdate':_0x7c2c('0x5'),'afterDestroy':_0x7c2c('0x6')};function emitEvent(_0x4bbc14){return function(_0x59f346,_0x31dc4e,_0x42ecc9){_0x59f346[_0x7c2c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4abe93){_0x59f346['setDataValue'](_0x7c2c('0x8'),_0x4abe93[_0x7c2c('0x9')](function(_0x3e668f){return{'id':_0x3e668f['id']};}));return SmsMessage[_0x7c2c('0xa')]({'where':{'SmsInteractionId':_0x59f346['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2c('0xb')](function(_0x57b107){_0x59f346[_0x7c2c('0xc')](_0x7c2c('0xd'),_0x57b107[_0x7c2c('0xe')]);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14+':'+_0x59f346['id'],_0x59f346);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14,_0x59f346);_0x42ecc9(null);})[_0x7c2c('0x10')](_0x42ecc9(null));};}for(var e in events){if(events[_0x7c2c('0x11')](e)){var event=events[e];SmsInteraction[_0x7c2c('0x12')](e,emitEvent(event));}}module[_0x7c2c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c6b7f2e..daac218 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 _0x66f3=['changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions'];(function(_0x28e877,_0x30767a){var _0x1f52cd=function(_0x1b053c){while(--_0x1b053c){_0x28e877['push'](_0x28e877['shift']());}};_0x1f52cd(++_0x30767a);}(_0x66f3,0x1ac));var _0x366f=function(_0x2a0099,_0x4cf712){_0x2a0099=_0x2a0099-0x0;var _0x2d4237=_0x66f3[_0x2a0099];return _0x2d4237;};'use strict';var _=require(_0x366f('0x0'));var util=require(_0x366f('0x1'));var logger=require(_0x366f('0x2'))(_0x366f('0x3'));var moment=require(_0x366f('0x4'));var BPromise=require(_0x366f('0x5'));var rp=require(_0x366f('0x6'));var fs=require('fs');var path=require(_0x366f('0x7'));var rimraf=require(_0x366f('0x8'));var config=require(_0x366f('0x9'));var attributes=require('./smsInteraction.attributes');module[_0x366f('0xa')]=function(_0x45bfe3,_0x22ab41){return _0x45bfe3[_0x366f('0xb')](_0x366f('0xc'),attributes,{'tableName':_0x366f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f11b7,_0x1f364f,_0x48cd1b){if(_0x2f11b7[_0x366f('0xe')]('closed')){_0x2f11b7['closedAt']=moment()[_0x366f('0xf')](_0x366f('0x10'));}_0x48cd1b(null,_0x2f11b7);}}});}; \ No newline at end of file +var _0xb8f8=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x4973b7,_0x463138){var _0x40fb49=function(_0x1b9c32){while(--_0x1b9c32){_0x4973b7['push'](_0x4973b7['shift']());}};_0x40fb49(++_0x463138);}(_0xb8f8,0x155));var _0x8b8f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8f8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8b8f('0x0'));var util=require('util');var logger=require(_0x8b8f('0x1'))(_0x8b8f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b8f('0x3'));var rimraf=require(_0x8b8f('0x4'));var config=require(_0x8b8f('0x5'));var attributes=require(_0x8b8f('0x6'));module[_0x8b8f('0x7')]=function(_0x2250b4,_0xbedd1e){return _0x2250b4[_0x8b8f('0x8')](_0x8b8f('0x9'),attributes,{'tableName':_0x8b8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xec7444,_0x3f7abc,_0x408940){if(_0xec7444[_0x8b8f('0xb')](_0x8b8f('0xc'))){_0xec7444[_0x8b8f('0xd')]=moment()[_0x8b8f('0xe')](_0x8b8f('0xf'));}_0x408940(null,_0xec7444);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 432b002..4e4aaaa 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 _0x2577=['then','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','where','limit'];(function(_0x4f570c,_0xca2743){var _0x73ac01=function(_0x3fdd00){while(--_0x3fdd00){_0x4f570c['push'](_0x4f570c['shift']());}};_0x73ac01(++_0xca2743);}(_0x2577,0x12f));var _0x7257=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0x2577[_0x1ec8f9];return _0x17cd3d;};'use strict';var _=require(_0x7257('0x0'));var util=require('util');var moment=require(_0x7257('0x1'));var BPromise=require(_0x7257('0x2'));var rs=require(_0x7257('0x3'));var fs=require('fs');var Redis=require(_0x7257('0x4'));var db=require(_0x7257('0x5'))['db'];var utils=require(_0x7257('0x6'));var logger=require(_0x7257('0x7'))('rpc');var config=require(_0x7257('0x8'));var jayson=require(_0x7257('0x9'));var client=jayson['client'][_0x7257('0xa')]({'port':0x232a});config[_0x7257('0xb')]=_[_0x7257('0xc')](config[_0x7257('0xb')],{'host':_0x7257('0xd'),'port':0x18eb});var socket=require(_0x7257('0xe'))(new Redis(config[_0x7257('0xb')]));require(_0x7257('0xf'))['register'](socket);function respondWithRpcPromise(_0x32c059,_0x112b6d,_0x28aa0c){return new BPromise(function(_0x3d428f,_0xbe08a4){return client[_0x7257('0x10')](_0x32c059,_0x28aa0c)['then'](function(_0x286c37){logger[_0x7257('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x112b6d,_0x7257('0x12'));logger[_0x7257('0x13')](_0x7257('0x14'),_0x112b6d,_0x7257('0x12'),JSON['stringify'](_0x286c37));if(_0x286c37['error']){if(_0x286c37[_0x7257('0x15')][_0x7257('0x16')]===0x1f4){logger[_0x7257('0x15')](_0x7257('0x17'),_0x112b6d,_0x286c37[_0x7257('0x15')][_0x7257('0x18')]);return _0xbe08a4(_0x286c37[_0x7257('0x15')][_0x7257('0x18')]);}logger[_0x7257('0x15')](_0x7257('0x17'),_0x112b6d,_0x286c37[_0x7257('0x15')][_0x7257('0x18')]);return _0x3d428f(_0x286c37[_0x7257('0x15')]['message']);}else{logger['info'](_0x7257('0x17'),_0x112b6d,_0x7257('0x12'));_0x3d428f(_0x286c37[_0x7257('0x19')]['message']);}})[_0x7257('0x1a')](function(_0x36e628){logger[_0x7257('0x15')](_0x7257('0x17'),_0x112b6d,_0x36e628);_0xbe08a4(_0x36e628);});});}exports[_0x7257('0x1b')]=function(_0x2b5df2){var _0x4b284d=this;return new Promise(function(_0x10aad3,_0x48ce8d){return db[_0x7257('0x1c')]['update'](_0x2b5df2[_0x7257('0x1d')],{'raw':_0x2b5df2[_0x7257('0x1e')]?_0x2b5df2[_0x7257('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5df2[_0x7257('0x1e')]?_0x2b5df2['options'][_0x7257('0x1f')]||null:null,'attributes':_0x2b5df2[_0x7257('0x1e')]?_0x2b5df2['options']['attributes']||null:null,'limit':_0x2b5df2[_0x7257('0x1e')]?_0x2b5df2['options'][_0x7257('0x20')]||null:null})[_0x7257('0x21')](function(_0x1b064f){logger[_0x7257('0x11')](_0x7257('0x1b'),_0x2b5df2);logger[_0x7257('0x13')]('UpdateSmsInteraction',_0x2b5df2,JSON[_0x7257('0x22')](_0x1b064f));_0x10aad3(_0x1b064f);})['catch'](function(_0x5c9053){logger['error']('UpdateSmsInteraction',_0x5c9053[_0x7257('0x18')],_0x2b5df2);_0x48ce8d(_0x4b284d[_0x7257('0x15')](0x1f4,_0x5c9053[_0x7257('0x18')]));});});};exports[_0x7257('0x23')]=function(_0x49c90c){return new Promise(function(_0x4219b1,_0x7d1e26){return db['SmsInteraction'][_0x7257('0x24')]({'where':_0x49c90c['options']?_0x49c90c[_0x7257('0x1e')][_0x7257('0x1f')]||null:null})[_0x7257('0x21')](function(_0x56f296){if(_0x56f296){return _0x56f296[_0x7257('0x25')](_0x49c90c[_0x7257('0x1d')][_0x7257('0x26')],_[_0x7257('0x27')](_0x49c90c[_0x7257('0x1d')],[_0x7257('0x26'),'id'])||{});}})[_0x7257('0x28')](function(_0x2eb10a){logger['info'](_0x7257('0x29'),_0x49c90c);logger[_0x7257('0x13')](_0x7257('0x29'),_0x49c90c,JSON['stringify'](_0x2eb10a));_0x4219b1(_0x2eb10a);})[_0x7257('0x1a')](function(_0x47bcc9){logger[_0x7257('0x15')](_0x7257('0x29'),_0x47bcc9[_0x7257('0x18')],_0x49c90c);_0x7d1e26(_this[_0x7257('0x15')](0x1f4,_0x47bcc9[_0x7257('0x18')]));});});}; \ No newline at end of file +var _0x0cdf=['options','raw','where','attributes','limit','SmsInteraction','find','addTags','ids','omit','body','debug','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','update'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x0cdf,0x1bb));var _0xf0cd=function(_0x21f089,_0x5ebacd){_0x21f089=_0x21f089-0x0;var _0x59c5e7=_0x0cdf[_0x21f089];return _0x59c5e7;};'use strict';var _=require('lodash');var util=require(_0xf0cd('0x0'));var moment=require(_0xf0cd('0x1'));var BPromise=require(_0xf0cd('0x2'));var rs=require(_0xf0cd('0x3'));var fs=require('fs');var Redis=require(_0xf0cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0cd('0x5'));var logger=require('../../config/logger')(_0xf0cd('0x6'));var config=require(_0xf0cd('0x7'));var jayson=require(_0xf0cd('0x8'));var client=jayson[_0xf0cd('0x9')][_0xf0cd('0xa')]({'port':0x232a});config[_0xf0cd('0xb')]=_[_0xf0cd('0xc')](config[_0xf0cd('0xb')],{'host':_0xf0cd('0xd'),'port':0x18eb});var socket=require(_0xf0cd('0xe'))(new Redis(config[_0xf0cd('0xb')]));require('./smsInteraction.socket')[_0xf0cd('0xf')](socket);function respondWithRpcPromise(_0x8978ec,_0x4e735f,_0x24501a){return new BPromise(function(_0xde81d2,_0xf524bb){return client[_0xf0cd('0x10')](_0x8978ec,_0x24501a)[_0xf0cd('0x11')](function(_0x4a4835){logger[_0xf0cd('0x12')](_0xf0cd('0x13'),_0x4e735f,_0xf0cd('0x14'));logger['debug'](_0xf0cd('0x15'),_0x4e735f,_0xf0cd('0x14'),JSON[_0xf0cd('0x16')](_0x4a4835));if(_0x4a4835[_0xf0cd('0x17')]){if(_0x4a4835[_0xf0cd('0x17')][_0xf0cd('0x18')]===0x1f4){logger['error'](_0xf0cd('0x13'),_0x4e735f,_0x4a4835[_0xf0cd('0x17')][_0xf0cd('0x19')]);return _0xf524bb(_0x4a4835[_0xf0cd('0x17')]['message']);}logger['error'](_0xf0cd('0x13'),_0x4e735f,_0x4a4835[_0xf0cd('0x17')][_0xf0cd('0x19')]);return _0xde81d2(_0x4a4835[_0xf0cd('0x17')][_0xf0cd('0x19')]);}else{logger[_0xf0cd('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4e735f,_0xf0cd('0x14'));_0xde81d2(_0x4a4835[_0xf0cd('0x1a')][_0xf0cd('0x19')]);}})[_0xf0cd('0x1b')](function(_0xaea055){logger[_0xf0cd('0x17')](_0xf0cd('0x13'),_0x4e735f,_0xaea055);_0xf524bb(_0xaea055);});});}exports[_0xf0cd('0x1c')]=function(_0x4f0cc5){var _0x2dec50=this;return new Promise(function(_0x17b586,_0x3022b6){return db['SmsInteraction'][_0xf0cd('0x1d')](_0x4f0cc5['body'],{'raw':_0x4f0cc5['options']?_0x4f0cc5[_0xf0cd('0x1e')][_0xf0cd('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0cc5[_0xf0cd('0x1e')]?_0x4f0cc5['options'][_0xf0cd('0x20')]||null:null,'attributes':_0x4f0cc5[_0xf0cd('0x1e')]?_0x4f0cc5[_0xf0cd('0x1e')][_0xf0cd('0x21')]||null:null,'limit':_0x4f0cc5[_0xf0cd('0x1e')]?_0x4f0cc5['options'][_0xf0cd('0x22')]||null:null})[_0xf0cd('0x11')](function(_0x266431){logger['info'](_0xf0cd('0x1c'),_0x4f0cc5);logger['debug'](_0xf0cd('0x1c'),_0x4f0cc5,JSON[_0xf0cd('0x16')](_0x266431));_0x17b586(_0x266431);})['catch'](function(_0x491537){logger[_0xf0cd('0x17')](_0xf0cd('0x1c'),_0x491537['message'],_0x4f0cc5);_0x3022b6(_0x2dec50[_0xf0cd('0x17')](0x1f4,_0x491537[_0xf0cd('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x415972){return new Promise(function(_0x369f4d,_0x3f41fb){return db[_0xf0cd('0x23')][_0xf0cd('0x24')]({'where':_0x415972[_0xf0cd('0x1e')]?_0x415972['options'][_0xf0cd('0x20')]||null:null})[_0xf0cd('0x11')](function(_0x41c732){if(_0x41c732){return _0x41c732[_0xf0cd('0x25')](_0x415972['body'][_0xf0cd('0x26')],_[_0xf0cd('0x27')](_0x415972[_0xf0cd('0x28')],[_0xf0cd('0x26'),'id'])||{});}})['spread'](function(_0x3f927d){logger[_0xf0cd('0x12')]('AddTags',_0x415972);logger[_0xf0cd('0x29')](_0xf0cd('0x2a'),_0x415972,JSON['stringify'](_0x3f927d));_0x369f4d(_0x3f927d);})[_0xf0cd('0x1b')](function(_0x2c11c4){logger[_0xf0cd('0x17')]('AddTags',_0x2c11c4['message'],_0x415972);_0x3f41fb(_this[_0xf0cd('0x17')](0x1f4,_0x2c11c4[_0xf0cd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index bfb8aa1..7d2cfc2 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 _0xbc86=['remove','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x55040e,_0x410a14){var _0x360e2b=function(_0x689e24){while(--_0x689e24){_0x55040e['push'](_0x55040e['shift']());}};_0x360e2b(++_0x410a14);}(_0xbc86,0x67));var _0x6bc8=function(_0x36f3fd,_0xa6e78b){_0x36f3fd=_0x36f3fd-0x0;var _0x1eecf4=_0xbc86[_0x36f3fd];return _0x1eecf4;};'use strict';var SmsInteractionEvents=require(_0x6bc8('0x0'));var events=[_0x6bc8('0x1'),_0x6bc8('0x2'),'update'];function createListener(_0x164283,_0x52da9a){return function(_0x81aae9){_0x52da9a[_0x6bc8('0x3')](_0x164283,_0x81aae9);};}function removeListener(_0x25ac98,_0x5ab2a2){return function(){SmsInteractionEvents['removeListener'](_0x25ac98,_0x5ab2a2);};}exports[_0x6bc8('0x4')]=function(_0x105887){for(var _0x30afa5=0x0,_0x566238=events[_0x6bc8('0x5')];_0x30afa5<_0x566238;_0x30afa5++){var _0x57aba7=events[_0x30afa5];var _0x3651de=createListener(_0x6bc8('0x6')+_0x57aba7,_0x105887);SmsInteractionEvents['on'](_0x57aba7,_0x3651de);}}; \ No newline at end of file +var _0xbc6a=['emit','register','length','smsInteraction:','save','update'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xbc6a,0xdc));var _0xabc6=function(_0x561b09,_0x2adaad){_0x561b09=_0x561b09-0x0;var _0x2c7e28=_0xbc6a[_0x561b09];return _0x2c7e28;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xabc6('0x0'),'remove',_0xabc6('0x1')];function createListener(_0x492a76,_0x583891){return function(_0x44b63a){_0x583891[_0xabc6('0x2')](_0x492a76,_0x44b63a);};}function removeListener(_0x6dc5b,_0x3eb874){return function(){SmsInteractionEvents['removeListener'](_0x6dc5b,_0x3eb874);};}exports[_0xabc6('0x3')]=function(_0x35cc08){for(var _0x3962e5=0x0,_0x275fa1=events[_0xabc6('0x4')];_0x3962e5<_0x275fa1;_0x3962e5++){var _0x184a93=events[_0x3962e5];var _0x54f7e2=createListener(_0xabc6('0x5')+_0x184a93,_0x35cc08);SmsInteractionEvents['on'](_0x184a93,_0x54f7e2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8b1fd64..48963af 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 _0xf31f=['smsmessage:create','status','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms'];(function(_0x38ed4b,_0x16fac2){var _0x58bf18=function(_0x5e3e8f){while(--_0x5e3e8f){_0x38ed4b['push'](_0x38ed4b['shift']());}};_0x58bf18(++_0x16fac2);}(_0xf31f,0x95));var _0xff31=function(_0x26621d,_0x27a653){_0x26621d=_0x26621d-0x0;var _0x452d95=_0xf31f[_0x26621d];return _0x452d95;};'use strict';var multer=require(_0xff31('0x0'));var util=require(_0xff31('0x1'));var path=require(_0xff31('0x2'));var timeout=require(_0xff31('0x3'));var express=require(_0xff31('0x4'));var router=express[_0xff31('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xff31('0x6'));var interaction=require(_0xff31('0x7'));var config=require(_0xff31('0x8'));var controller=require(_0xff31('0x9'));router[_0xff31('0xa')]('/',auth[_0xff31('0xb')](),controller['index']);router[_0xff31('0xa')](_0xff31('0xc'),auth[_0xff31('0xb')](),controller[_0xff31('0xd')]);router[_0xff31('0xa')](_0xff31('0xe'),auth[_0xff31('0xb')](),controller[_0xff31('0xf')]);router[_0xff31('0x10')]('/',auth['isAuthenticated'](),interaction[_0xff31('0x11')](_0xff31('0x12'),_0xff31('0x13')),controller['create']);router[_0xff31('0x10')]('/:id/status',controller[_0xff31('0x14')]);router[_0xff31('0x15')](_0xff31('0xe'),auth[_0xff31('0xb')](),controller[_0xff31('0x16')]);router[_0xff31('0x15')](_0xff31('0x17'),auth[_0xff31('0xb')](),controller[_0xff31('0x18')]);router[_0xff31('0x15')]('/:id/reject',auth[_0xff31('0xb')](),controller[_0xff31('0x19')]);router[_0xff31('0x1a')](_0xff31('0xe'),auth[_0xff31('0xb')](),controller[_0xff31('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x7e7b=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x7e7b,0x133));var _0xb7e7=function(_0x37155c,_0x49251c){_0x37155c=_0x37155c-0x0;var _0x237ef1=_0x7e7b[_0x37155c];return _0x237ef1;};'use strict';var multer=require(_0xb7e7('0x0'));var util=require(_0xb7e7('0x1'));var path=require('path');var timeout=require(_0xb7e7('0x2'));var express=require(_0xb7e7('0x3'));var router=express[_0xb7e7('0x4')]();var fs_extra=require(_0xb7e7('0x5'));var auth=require(_0xb7e7('0x6'));var interaction=require(_0xb7e7('0x7'));var config=require(_0xb7e7('0x8'));var controller=require(_0xb7e7('0x9'));router[_0xb7e7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb7e7('0xa')](_0xb7e7('0xb'),auth[_0xb7e7('0xc')](),controller['describe']);router['get'](_0xb7e7('0xd'),auth['isAuthenticated'](),controller[_0xb7e7('0xe')]);router[_0xb7e7('0xf')]('/',auth[_0xb7e7('0xc')](),interaction[_0xb7e7('0x10')]('sms','smsmessage:create'),controller['create']);router[_0xb7e7('0xf')](_0xb7e7('0x11'),controller[_0xb7e7('0x12')]);router['put'](_0xb7e7('0xd'),auth[_0xb7e7('0xc')](),controller[_0xb7e7('0x13')]);router[_0xb7e7('0x14')](_0xb7e7('0x15'),auth[_0xb7e7('0xc')](),controller[_0xb7e7('0x16')]);router['put'](_0xb7e7('0x17'),auth['isAuthenticated'](),controller[_0xb7e7('0x18')]);router[_0xb7e7('0x19')](_0xb7e7('0xd'),auth[_0xb7e7('0xc')](),controller[_0xb7e7('0x1a')]);module[_0xb7e7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index cc0ff2b..961a962 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 _0xf8b5=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x46e6f6,_0x1718c5){var _0x2af4ae=function(_0x5d0b10){while(--_0x5d0b10){_0x46e6f6['push'](_0x46e6f6['shift']());}};_0x2af4ae(++_0x1718c5);}(_0xf8b5,0x1c4));var _0x5f8b=function(_0x5e58e5,_0x483feb){_0x5e58e5=_0x5e58e5-0x0;var _0x33e6e4=_0xf8b5[_0x5e58e5];return _0x33e6e4;};'use strict';var Sequelize=require(_0x5f8b('0x0'));module[_0x5f8b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5f8b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5f8b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5f8b('0x4')]('in',_0x5f8b('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5f8b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5f8b('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5f8b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5f8b('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac21=['STRING','exports','TEXT','BOOLEAN','out'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xac21,0x1af));var _0x1ac2=function(_0x4bded6,_0x3a7a20){_0x4bded6=_0x4bded6-0x0;var _0x3d89aa=_0xac21[_0x4bded6];return _0x3d89aa;};'use strict';var Sequelize=require('sequelize');module[_0x1ac2('0x0')]={'body':{'type':Sequelize[_0x1ac2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1ac2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1ac2('0x3')),'defaultValue':_0x1ac2('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1ac2('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1ac2('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1ac2('0x4')]},'providerResponse':{'type':Sequelize[_0x1ac2('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index bbf21fe..0902e4c 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 _0xbb3e=['intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','find','create','body','destroy','../../config/logger','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','motionChannel','channel','event','accept','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','User','internal','interface','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','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','limit','undefined','offset','count','set','Content-Range','save','update','sendStatus','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x29cd52,_0x88b52b){var _0x5218bc=function(_0x455b4f){while(--_0x455b4f){_0x29cd52['push'](_0x29cd52['shift']());}};_0x5218bc(++_0x88b52b);}(_0xbb3e,0x181));var _0xebb3=function(_0x4bf9d2,_0x5a47a9){_0x4bf9d2=_0x4bf9d2-0x0;var _0x5aaf21=_0xbb3e[_0x4bf9d2];return _0x5aaf21;};'use strict';var emlformat=require(_0xebb3('0x0'));var rimraf=require(_0xebb3('0x1'));var zipdir=require(_0xebb3('0x2'));var jsonpatch=require(_0xebb3('0x3'));var rp=require('request-promise');var moment=require(_0xebb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xebb3('0x5'));var util=require(_0xebb3('0x6'));var path=require(_0xebb3('0x7'));var sox=require(_0xebb3('0x8'));var csv=require(_0xebb3('0x9'));var ejs=require(_0xebb3('0xa'));var fs=require('fs');var fs_extra=require(_0xebb3('0xb'));var _=require(_0xebb3('0xc'));var squel=require(_0xebb3('0xd'));var crypto=require(_0xebb3('0xe'));var jsforce=require(_0xebb3('0xf'));var deskjs=require(_0xebb3('0x10'));var toCsv=require(_0xebb3('0x9'));var querystring=require(_0xebb3('0x11'));var Papa=require(_0xebb3('0x12'));var Redis=require(_0xebb3('0x13'));var authService=require(_0xebb3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xebb3('0x15'));var hardwareService=require(_0xebb3('0x16'));var logger=require('../../config/logger')(_0xebb3('0x17'));var utils=require(_0xebb3('0x18'));var config=require(_0xebb3('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xebb3('0x1a')]=_[_0xebb3('0x1b')](config[_0xebb3('0x1a')],{'host':_0xebb3('0x1c'),'port':0x18eb});var socket=require(_0xebb3('0x1d'))(new Redis(config[_0xebb3('0x1a')]));require(_0xebb3('0x1e'))[_0xebb3('0x1f')](socket);var jayson=require(_0xebb3('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xebb3('0x21')][_0xebb3('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x50f75e,_0x56f7b0,_0x422f0e,_0x5cddae){return new BPromise(function(_0x11aedb,_0x19178a){var _0x563aa3=_0x5cddae||client;return _0x563aa3[_0xebb3('0x23')](_0x50f75e,_0x422f0e)[_0xebb3('0x24')](function(_0xd6d026){logger[_0xebb3('0x25')](_0xebb3('0x26'),_0x56f7b0,_0xebb3('0x27'));logger[_0xebb3('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x56f7b0,'request\x20sent',JSON[_0xebb3('0x29')](_0xd6d026));if(_0xd6d026[_0xebb3('0x2a')]){if(_0xd6d026['error']['code']===0x1f4){logger['error'](_0xebb3('0x26'),_0x56f7b0,_0xd6d026[_0xebb3('0x2a')]['message']);return _0x19178a(_0xd6d026[_0xebb3('0x2a')][_0xebb3('0x2b')]);}logger[_0xebb3('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x56f7b0,_0xd6d026['error'][_0xebb3('0x2b')]);return _0x11aedb(_0xd6d026[_0xebb3('0x2a')][_0xebb3('0x2b')]);}else{logger[_0xebb3('0x25')](_0xebb3('0x26'),_0x56f7b0,_0xebb3('0x27'));_0x11aedb(_0xd6d026[_0xebb3('0x2c')]['message']);}})[_0xebb3('0x2d')](function(_0x58e794){logger[_0xebb3('0x2a')](_0xebb3('0x26'),_0x56f7b0,_0x58e794);_0x19178a(_0x58e794);});});}function respondWithStatusCode(_0x556e29,_0x32d87){_0x32d87=_0x32d87||0xcc;return function(_0x172c4e){if(_0x172c4e){return _0x556e29['sendStatus'](_0x32d87);}return _0x556e29[_0xebb3('0x2e')](_0x32d87)[_0xebb3('0x2f')]();};}function respondWithResult(_0x3a3b87,_0x364b80){_0x364b80=_0x364b80||0xc8;return function(_0x189eda){if(_0x189eda){return _0x3a3b87['status'](_0x364b80)[_0xebb3('0x30')](_0x189eda);}};}function respondWithFilteredResult(_0x211670,_0x185b62){return function(_0x445dc8){if(_0x445dc8){var _0x397ad3=typeof _0x185b62['offset']==='undefined'&&typeof _0x185b62[_0xebb3('0x31')]===_0xebb3('0x32');var _0x5865eb=_0x445dc8['count'];var _0x243f7c=_0x397ad3?0x0:_0x185b62[_0xebb3('0x33')];var _0xdf0f2a=_0x397ad3?_0x445dc8[_0xebb3('0x34')]:_0x185b62['offset']+_0x185b62[_0xebb3('0x31')];var _0x43d20c;if(_0xdf0f2a>=_0x5865eb){_0xdf0f2a=_0x5865eb;_0x43d20c=0xc8;}else{_0x43d20c=0xce;}_0x211670['status'](_0x43d20c);return _0x211670[_0xebb3('0x35')](_0xebb3('0x36'),_0x243f7c+'-'+_0xdf0f2a+'/'+_0x5865eb)[_0xebb3('0x30')](_0x445dc8);}return null;};}function patchUpdates(_0x55bb2a){return function(_0x46ffa1){try{jsonpatch['apply'](_0x46ffa1,_0x55bb2a,!![]);}catch(_0x987744){return BPromise['reject'](_0x987744);}return _0x46ffa1[_0xebb3('0x37')]();};}function saveUpdates(_0x4c0611,_0x107bc3){return function(_0x1f10cb){if(_0x1f10cb){return _0x1f10cb[_0xebb3('0x38')](_0x4c0611)[_0xebb3('0x24')](function(_0x172bdf){return _0x172bdf;});}return null;};}function removeEntity(_0x167e7c,_0x2a9c1f){return function(_0x51ab2c){if(_0x51ab2c){return _0x51ab2c['destroy']()[_0xebb3('0x24')](function(){_0x167e7c['status'](0xcc)[_0xebb3('0x2f')]();});}};}function handleEntityNotFound(_0x474c2e,_0x3a8937){return function(_0x2e89f3){if(!_0x2e89f3){_0x474c2e[_0xebb3('0x39')](0x194);}return _0x2e89f3;};}function handleError(_0x2e7545,_0x308a07){_0x308a07=_0x308a07||0x1f4;return function(_0x4b3b63){logger['error'](_0x4b3b63[_0xebb3('0x3a')]);if(_0x4b3b63['name']){delete _0x4b3b63[_0xebb3('0x3b')];}_0x2e7545[_0xebb3('0x2e')](_0x308a07)[_0xebb3('0x3c')](_0x4b3b63);};}exports['index']=function(_0x5b93ce,_0x21d82a){var _0x3f66bd={},_0x2c0ce7={},_0x144a1d={'count':0x0,'rows':[]};var _0x37446b=_['map'](db[_0xebb3('0x3d')][_0xebb3('0x3e')],function(_0x37250a){return{'name':_0x37250a[_0xebb3('0x3f')],'type':_0x37250a[_0xebb3('0x40')][_0xebb3('0x41')]};});_0x2c0ce7[_0xebb3('0x42')]=_[_0xebb3('0x43')](_0x37446b,'name');_0x2c0ce7[_0xebb3('0x44')]=_[_0xebb3('0x45')](_0x5b93ce[_0xebb3('0x44')]);_0x2c0ce7[_0xebb3('0x46')]=_[_0xebb3('0x47')](_0x2c0ce7[_0xebb3('0x42')],_0x2c0ce7[_0xebb3('0x44')]);_0x3f66bd['attributes']=_['intersection'](_0x2c0ce7[_0xebb3('0x42')],qs['fields'](_0x5b93ce['query'][_0xebb3('0x48')]));_0x3f66bd[_0xebb3('0x49')]=_0x3f66bd['attributes']['length']?_0x3f66bd['attributes']:_0x2c0ce7[_0xebb3('0x42')];if(!_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x4a')](_0xebb3('0x4b'))){_0x3f66bd[_0xebb3('0x31')]=qs[_0xebb3('0x31')](_0x5b93ce['query']['limit']);_0x3f66bd['offset']=qs[_0xebb3('0x33')](_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x33')]);}_0x3f66bd[_0xebb3('0x4c')]=qs[_0xebb3('0x4d')](_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x4d')]);_0x3f66bd['where']=qs[_0xebb3('0x46')](_['pick'](_0x5b93ce[_0xebb3('0x44')],_0x2c0ce7['filters']),_0x37446b);if(_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x4e')]){_0x3f66bd[_0xebb3('0x4f')]=_['merge'](_0x3f66bd[_0xebb3('0x4f')],{'$or':_[_0xebb3('0x43')](_0x37446b,function(_0x333b88){if(_0x333b88['type']!==_0xebb3('0x50')){var _0xfa178={};_0xfa178[_0x333b88[_0xebb3('0x3b')]]={'$like':'%'+_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x4e')]+'%'};return _0xfa178;}})});}_0x3f66bd=_[_0xebb3('0x51')]({},_0x3f66bd,_0x5b93ce[_0xebb3('0x52')]);var _0x5829cc={'where':_0x3f66bd[_0xebb3('0x4f')]};return db['SmsMessage']['count'](_0x5829cc)[_0xebb3('0x24')](function(_0x3d72a5){_0x144a1d['count']=_0x3d72a5;if(_0x5b93ce[_0xebb3('0x44')][_0xebb3('0x53')]){_0x3f66bd[_0xebb3('0x54')]=[{'all':!![]}];}return db[_0xebb3('0x3d')][_0xebb3('0x55')](_0x3f66bd);})[_0xebb3('0x24')](function(_0x54d961){_0x144a1d[_0xebb3('0x56')]=_0x54d961;return _0x144a1d;})[_0xebb3('0x24')](respondWithFilteredResult(_0x21d82a,_0x3f66bd))['catch'](handleError(_0x21d82a,null));};exports['show']=function(_0x1990ca,_0x705f3e){var _0x4a2edc={'raw':!![],'where':{'id':_0x1990ca[_0xebb3('0x57')]['id']}},_0x333fc7={};_0x333fc7[_0xebb3('0x42')]=_[_0xebb3('0x45')](db[_0xebb3('0x3d')]['rawAttributes']);_0x333fc7[_0xebb3('0x44')]=_['keys'](_0x1990ca[_0xebb3('0x44')]);_0x333fc7[_0xebb3('0x46')]=_[_0xebb3('0x47')](_0x333fc7[_0xebb3('0x42')],_0x333fc7[_0xebb3('0x44')]);_0x4a2edc[_0xebb3('0x49')]=_[_0xebb3('0x47')](_0x333fc7['model'],qs[_0xebb3('0x48')](_0x1990ca[_0xebb3('0x44')]['fields']));_0x4a2edc[_0xebb3('0x49')]=_0x4a2edc['attributes'][_0xebb3('0x58')]?_0x4a2edc[_0xebb3('0x49')]:_0x333fc7['model'];if(_0x1990ca[_0xebb3('0x44')]['includeAll']){_0x4a2edc[_0xebb3('0x54')]=[{'all':!![]}];}_0x4a2edc=_['merge']({},_0x4a2edc,_0x1990ca[_0xebb3('0x52')]);return db['SmsMessage'][_0xebb3('0x59')](_0x4a2edc)['then'](handleEntityNotFound(_0x705f3e,null))['then'](respondWithResult(_0x705f3e,null))[_0xebb3('0x2d')](handleError(_0x705f3e,null));};exports[_0xebb3('0x5a')]=function(_0x4c9e36,_0x102a5c){return db['SmsMessage'][_0xebb3('0x5a')](_0x4c9e36[_0xebb3('0x5b')],{})['then'](respondWithResult(_0x102a5c,0xc9))['catch'](handleError(_0x102a5c,null));};exports[_0xebb3('0x38')]=function(_0x45468e,_0x336ecb){if(_0x45468e[_0xebb3('0x5b')]['id']){delete _0x45468e[_0xebb3('0x5b')]['id'];}return db[_0xebb3('0x3d')][_0xebb3('0x59')]({'where':{'id':_0x45468e['params']['id']}})[_0xebb3('0x24')](handleEntityNotFound(_0x336ecb,null))[_0xebb3('0x24')](saveUpdates(_0x45468e[_0xebb3('0x5b')],null))[_0xebb3('0x24')](respondWithResult(_0x336ecb,null))[_0xebb3('0x2d')](handleError(_0x336ecb,null));};exports[_0xebb3('0x5c')]=function(_0x32f8a0,_0x4914e5){return db[_0xebb3('0x3d')][_0xebb3('0x59')]({'where':{'id':_0x32f8a0['params']['id']}})[_0xebb3('0x24')](handleEntityNotFound(_0x4914e5,null))[_0xebb3('0x24')](removeEntity(_0x4914e5,null))[_0xebb3('0x2d')](handleError(_0x4914e5,null));};exports['describe']=function(_0x5bdb63,_0x4ce2a8){return db[_0xebb3('0x3d')]['describe']()[_0xebb3('0x24')](respondWithResult(_0x4ce2a8,null))[_0xebb3('0x2d')](handleError(_0x4ce2a8,null));};var interaction_log=require(_0xebb3('0x5d'))(_0xebb3('0x5e'));exports['accept']=function(_0x47ffd4,_0x527d3b,_0x3d9fc7){var _0x45edad={'agent':{},'channel':_0xebb3('0x5f')};if(_0x47ffd4[_0xebb3('0x5b')]['id']){delete _0x47ffd4[_0xebb3('0x5b')]['id'];}_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x60')]=!![];_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x61')]=moment()[_0xebb3('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x47ffd4[_0xebb3('0x5b')]['UserId']=_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x63')]||_0x47ffd4[_0xebb3('0x64')]['id'];_0x45edad[_0xebb3('0x65')]['id']=_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x63')];return db[_0xebb3('0x3d')]['find']({'where':{'id':_0x47ffd4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x527d3b,null))[_0xebb3('0x24')](saveUpdates(_0x47ffd4[_0xebb3('0x5b')],null))[_0xebb3('0x24')](function(_0xc659ad){if(_0xc659ad){_0x45edad[_0xebb3('0x2b')]=_0xc659ad[_0xebb3('0x66')]({'plain':!![]});return db[_0xebb3('0x67')][_0xebb3('0x59')]({'where':{'id':_0xc659ad[_0xebb3('0x68')]}});}return null;})[_0xebb3('0x24')](handleEntityNotFound(_0x527d3b,null))[_0xebb3('0x24')](function(_0xe02018){if(_0xe02018){return _0xe02018[_0xebb3('0x38')]({'UserId':_0x47ffd4['body']['UserId'],'read1stAt':_['isNil'](_0xe02018[_0xebb3('0x69')])?moment()[_0xebb3('0x62')](_0xebb3('0x6a')):undefined});}return null;})[_0xebb3('0x24')](function(_0x4ccc5a){if(_0x4ccc5a){_0x45edad[_0xebb3('0x6b')]=_0x4ccc5a[_0xebb3('0x66')]({'plain':!![]});interaction_log[_0xebb3('0x25')](_0xebb3('0x6c'),_0x47ffd4[_0xebb3('0x64')]['id'],_0x47ffd4[_0xebb3('0x64')][_0xebb3('0x3b')],_0x47ffd4[_0xebb3('0x64')]['role'],_0x45edad['interaction']['id'],_0x47ffd4[_0xebb3('0x5b')]?JSON[_0xebb3('0x29')](_0x47ffd4[_0xebb3('0x5b')]):'null');return respondWithRpcPromise(_0xebb3('0x6d'),_0xebb3('0x6e'),_0x45edad);}return null;})['then'](function(_0x170335){var _0x117302='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x170335[_0xebb3('0x2b')][_0xebb3('0x6f')];return db[_0xebb3('0x70')][_0xebb3('0x44')](_0x117302,{'type':db[_0xebb3('0x71')][_0xebb3('0x72')][_0xebb3('0x73')],'raw':!![]})['then'](function(_0x2c13ca){return _0x2c13ca;});})['then'](function(_0x5a1eed){if(_0x5a1eed){_0x45edad[_0xebb3('0x2b')][_0xebb3('0x74')]=_0x5a1eed[0x0];if(!_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x63')])return;return db['User'][_0xebb3('0x59')]({'where':{'id':_0x47ffd4[_0xebb3('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0xebb3('0x3b'),_0xebb3('0x75'),_0xebb3('0x76'),'internal'],'raw':!![]});}return null;})[_0xebb3('0x24')](function(_0x4a1298){if(!_0x4a1298)return null;_0x45edad[_0xebb3('0x2b')][_0xebb3('0x65')]=_0x4a1298;return _0x45edad;})[_0xebb3('0x24')](function(_0x3a5554){if(_0x3a5554){if(_0x47ffd4[_0xebb3('0x5b')][_0xebb3('0x77')]){_0x45edad[_0xebb3('0x2b')]['interface']=util[_0xebb3('0x62')]('SIP/%s',_0x47ffd4['user']['name']);_0x45edad['message']['channel']=_0x45edad['channel'];_0x45edad[_0xebb3('0x2b')][_0xebb3('0x78')]=_0x45edad[_0xebb3('0x79')];_0x45edad['message'][_0xebb3('0x7a')]=_0xebb3('0x7b');return respondWithRpcPromise(_0xebb3('0x7c'),_0xebb3('0x7c'),{'event':_0xebb3('0x7d'),'message':_0x45edad['message']},client9002)[_0xebb3('0x24')](function(){return _0x45edad;});}return _0x45edad;}return null;})['then'](respondWithResult(_0x527d3b,null))['catch'](handleError(_0x527d3b,null));};var interaction_log=require(_0xebb3('0x5d'))(_0xebb3('0x5e'));exports[_0xebb3('0x7e')]=function(_0x1b01c6,_0x4c2f36,_0x51098d){var _0x797b99={'agent':{},'channel':'sms'};if(_0x1b01c6['body']['id']){delete _0x1b01c6[_0xebb3('0x5b')]['id'];}_0x1b01c6['body'][_0xebb3('0x63')]=_0x1b01c6[_0xebb3('0x5b')][_0xebb3('0x63')]||_0x1b01c6[_0xebb3('0x64')]['id'];_0x797b99['agent']['id']=_0x1b01c6[_0xebb3('0x5b')][_0xebb3('0x63')];return db[_0xebb3('0x3d')][_0xebb3('0x59')]({'where':{'id':_0x1b01c6['params']['id'],'UserId':null}})[_0xebb3('0x24')](handleEntityNotFound(_0x4c2f36,null))[_0xebb3('0x24')](function(_0x18f345){if(_0x18f345){_0x797b99[_0xebb3('0x2b')]=_0x18f345[_0xebb3('0x66')]({'plain':!![]});return db[_0xebb3('0x67')]['find']({'where':{'id':_0x18f345[_0xebb3('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x4c2f36,null))[_0xebb3('0x24')](function(_0x555f1d){if(_0x555f1d){_0x797b99['interaction']=_0x555f1d['get']({'plain':!![]});interaction_log[_0xebb3('0x25')](_0xebb3('0x7f'),_0x1b01c6[_0xebb3('0x64')]['id'],_0x1b01c6[_0xebb3('0x64')][_0xebb3('0x3b')],_0x1b01c6[_0xebb3('0x64')][_0xebb3('0x80')],_0x797b99[_0xebb3('0x6b')]['id'],_0x1b01c6[_0xebb3('0x5b')]?JSON[_0xebb3('0x29')](_0x1b01c6[_0xebb3('0x5b')]):_0xebb3('0x81'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x797b99);}return null;})[_0xebb3('0x24')](function(_0x52b876){var _0x877b1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52b876[_0xebb3('0x2b')]['ContactId'];return db['sequelize']['query'](_0x877b1,{'type':db[_0xebb3('0x71')][_0xebb3('0x72')][_0xebb3('0x73')],'raw':!![]})['then'](function(_0x5b2153){return _0x5b2153;});})[_0xebb3('0x24')](function(_0x2b7c15){if(_0x2b7c15){_0x797b99[_0xebb3('0x2b')][_0xebb3('0x74')]=_0x2b7c15[0x0];if(!_0x1b01c6[_0xebb3('0x5b')]['UserId'])return;return db[_0xebb3('0x82')][_0xebb3('0x59')]({'where':{'id':_0x1b01c6[_0xebb3('0x5b')][_0xebb3('0x63')],'role':'agent'},'attributes':['id',_0xebb3('0x3b'),_0xebb3('0x75'),_0xebb3('0x76'),_0xebb3('0x83')],'raw':!![]});}return null;})[_0xebb3('0x24')](function(_0x2f786e){if(!_0x2f786e)return null;_0x797b99['message'][_0xebb3('0x65')]=_0x2f786e;return _0x797b99;})[_0xebb3('0x24')](function(_0x1f5b03){if(_0x1f5b03){_0x1f5b03[_0xebb3('0x2b')][_0xebb3('0x84')]=util[_0xebb3('0x62')]('SIP/%s',_0x1b01c6['user'][_0xebb3('0x3b')]);_0x1f5b03[_0xebb3('0x2b')][_0xebb3('0x79')]=_0x797b99['channel'];_0x1f5b03[_0xebb3('0x2b')][_0xebb3('0x78')]=_0x797b99[_0xebb3('0x79')];_0x1f5b03[_0xebb3('0x2b')]['event']=_0xebb3('0x7e');respondWithRpcPromise('EventManager',_0xebb3('0x7c'),{'event':_0xebb3('0x85'),'message':_0x1f5b03['message']},client9002);return _0x797b99;}return null;})[_0xebb3('0x24')](respondWithResult(_0x4c2f36,null))[_0xebb3('0x2d')](handleError(_0x4c2f36,null));};exports[_0xebb3('0x2e')]=function(_0x2f6573,_0x5e2a50,_0x2dac5a){if(_0x2f6573[_0xebb3('0x5b')]['id']){delete _0x2f6573[_0xebb3('0x5b')]['id'];}var _0xc04b31;return db['SmsMessage'][_0xebb3('0x59')]({'where':{'id':_0x2f6573['params']['id']}})[_0xebb3('0x24')](handleEntityNotFound(_0x5e2a50,null))[_0xebb3('0x24')](function(_0x4e1c13){if(_0x4e1c13){_0xc04b31=_0x4e1c13;return db[_0xebb3('0x86')][_0xebb3('0x59')]({'where':{'id':_0x4e1c13[_0xebb3('0x87')]}});}})['then'](handleEntityNotFound(_0x5e2a50,null))['then'](function(_0x478edc){if(_0x478edc){logger[_0xebb3('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xebb3('0x2e'),_0xebb3('0x88'),_0x478edc[_0xebb3('0x40')],util[_0xebb3('0x89')](_0x2f6573[_0xebb3('0x5b')],{'showHidden':![],'depth':null}));switch(_0x478edc['type']){case _0xebb3('0x8a'):if(_0x2f6573['body'][_0xebb3('0x8b')]&&_0x2f6573[_0xebb3('0x5b')][_0xebb3('0x8b')]===_0xc04b31[_0xebb3('0x8c')]){return _0xc04b31[_0xebb3('0x38')]({'read':!![]});}else{logger[_0xebb3('0x2a')](_0xebb3('0x8d'),_0xebb3('0x2e'),_0xebb3('0x8a'),util[_0xebb3('0x89')](_0x2f6573['body'],{'showHidden':![],'depth':null}));}break;case _0xebb3('0x8e'):if(_0x2f6573[_0xebb3('0x5b')][_0xebb3('0x8f')]&&_0x2f6573[_0xebb3('0x5b')][_0xebb3('0x8f')]===_0xc04b31[_0xebb3('0x8c')]&&_[_0xebb3('0x90')]([_0xebb3('0x91'),_0xebb3('0x92')],_0x2f6573[_0xebb3('0x5b')][_0xebb3('0x93')])>=0x0){return _0xc04b31[_0xebb3('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xebb3('0x2e'),_0xebb3('0x94'),util[_0xebb3('0x89')](_0x2f6573[_0xebb3('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x16307a=_0x2f6573['body'][_0xebb3('0x95')][0x0];if(_0x16307a[_0xebb3('0x2e')]['groupName']===_0xebb3('0x96')){return _0xc04b31['update']({'read':!![]});}else{logger[_0xebb3('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xebb3('0x2e'),_0xebb3('0x97'),util['inspect'](_0x2f6573[_0xebb3('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0xc04b31;}})[_0xebb3('0x24')](respondWithResult(_0x5e2a50,null))['catch'](handleError(_0x5e2a50,null));}; \ No newline at end of file +var _0xccde=['sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','DELIVERED','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','includeAll','findAll','rows','params','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','[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'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xccde,0x1e1));var _0xeccd=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xccde[_0x3d34da];return _0xcf6af8;};'use strict';var emlformat=require(_0xeccd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeccd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeccd('0x2'));var moment=require(_0xeccd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeccd('0x4'));var path=require(_0xeccd('0x5'));var sox=require(_0xeccd('0x6'));var csv=require(_0xeccd('0x7'));var ejs=require(_0xeccd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeccd('0x9'));var squel=require(_0xeccd('0xa'));var crypto=require(_0xeccd('0xb'));var jsforce=require(_0xeccd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeccd('0x7'));var querystring=require(_0xeccd('0xd'));var Papa=require(_0xeccd('0xe'));var Redis=require(_0xeccd('0xf'));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(_0xeccd('0x10'))(_0xeccd('0x11'));var utils=require(_0xeccd('0x12'));var config=require(_0xeccd('0x13'));var licenseUtil=require(_0xeccd('0x14'));var db=require('../../mysqldb')['db'];config[_0xeccd('0x15')]=_[_0xeccd('0x16')](config[_0xeccd('0x15')],{'host':_0xeccd('0x17'),'port':0x18eb});var socket=require(_0xeccd('0x18'))(new Redis(config[_0xeccd('0x15')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xeccd('0x19'));var client=jayson[_0xeccd('0x1a')][_0xeccd('0x1b')]({'port':0x232c});var client9002=jayson[_0xeccd('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2500e0,_0x3dc35f,_0x496061,_0x53f4d8){return new BPromise(function(_0x42e47e,_0x3238fb){var _0x2e96f3=_0x53f4d8||client;return _0x2e96f3[_0xeccd('0x1c')](_0x2500e0,_0x496061)[_0xeccd('0x1d')](function(_0x360d25){logger[_0xeccd('0x1e')](_0xeccd('0x1f'),_0x3dc35f,'request\x20sent');logger[_0xeccd('0x20')](_0xeccd('0x21'),_0x3dc35f,_0xeccd('0x22'),JSON[_0xeccd('0x23')](_0x360d25));if(_0x360d25[_0xeccd('0x24')]){if(_0x360d25[_0xeccd('0x24')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3dc35f,_0x360d25[_0xeccd('0x24')]['message']);return _0x3238fb(_0x360d25[_0xeccd('0x24')][_0xeccd('0x25')]);}logger['error'](_0xeccd('0x1f'),_0x3dc35f,_0x360d25['error'][_0xeccd('0x25')]);return _0x42e47e(_0x360d25[_0xeccd('0x24')][_0xeccd('0x25')]);}else{logger[_0xeccd('0x1e')](_0xeccd('0x1f'),_0x3dc35f,'request\x20sent');_0x42e47e(_0x360d25[_0xeccd('0x26')]['message']);}})[_0xeccd('0x27')](function(_0x244d22){logger[_0xeccd('0x24')](_0xeccd('0x1f'),_0x3dc35f,_0x244d22);_0x3238fb(_0x244d22);});});}function respondWithStatusCode(_0x50857a,_0x16a8e0){_0x16a8e0=_0x16a8e0||0xcc;return function(_0xec1466){if(_0xec1466){return _0x50857a[_0xeccd('0x28')](_0x16a8e0);}return _0x50857a[_0xeccd('0x29')](_0x16a8e0)['end']();};}function respondWithResult(_0x71dda5,_0x4240df){_0x4240df=_0x4240df||0xc8;return function(_0x3e42e8){if(_0x3e42e8){return _0x71dda5[_0xeccd('0x29')](_0x4240df)[_0xeccd('0x2a')](_0x3e42e8);}};}function respondWithFilteredResult(_0x1c0a3f,_0x2ea699){return function(_0x33af3a){if(_0x33af3a){var _0x283cd7=typeof _0x2ea699['offset']===_0xeccd('0x2b')&&typeof _0x2ea699['limit']===_0xeccd('0x2b');var _0x1817b7=_0x33af3a[_0xeccd('0x2c')];var _0x28d25a=_0x283cd7?0x0:_0x2ea699[_0xeccd('0x2d')];var _0x46dabd=_0x283cd7?_0x33af3a[_0xeccd('0x2c')]:_0x2ea699[_0xeccd('0x2d')]+_0x2ea699[_0xeccd('0x2e')];var _0x2fdc7b;if(_0x46dabd>=_0x1817b7){_0x46dabd=_0x1817b7;_0x2fdc7b=0xc8;}else{_0x2fdc7b=0xce;}_0x1c0a3f[_0xeccd('0x29')](_0x2fdc7b);return _0x1c0a3f[_0xeccd('0x2f')](_0xeccd('0x30'),_0x28d25a+'-'+_0x46dabd+'/'+_0x1817b7)[_0xeccd('0x2a')](_0x33af3a);}return null;};}function patchUpdates(_0x5ef5c6){return function(_0x100bea){try{jsonpatch[_0xeccd('0x31')](_0x100bea,_0x5ef5c6,!![]);}catch(_0x49b4d1){return BPromise[_0xeccd('0x32')](_0x49b4d1);}return _0x100bea[_0xeccd('0x33')]();};}function saveUpdates(_0x5de32a,_0x5465b5){return function(_0xf44803){if(_0xf44803){return _0xf44803[_0xeccd('0x34')](_0x5de32a)[_0xeccd('0x1d')](function(_0x2a5778){return _0x2a5778;});}return null;};}function removeEntity(_0xa96585,_0x37e189){return function(_0x3ebedd){if(_0x3ebedd){return _0x3ebedd[_0xeccd('0x35')]()['then'](function(){_0xa96585['status'](0xcc)[_0xeccd('0x36')]();});}};}function handleEntityNotFound(_0x41f71d,_0x234765){return function(_0x13a30e){if(!_0x13a30e){_0x41f71d[_0xeccd('0x28')](0x194);}return _0x13a30e;};}function handleError(_0x3f2652,_0x3b5e30){_0x3b5e30=_0x3b5e30||0x1f4;return function(_0x348f42){logger[_0xeccd('0x24')](_0x348f42[_0xeccd('0x37')]);if(_0x348f42[_0xeccd('0x38')]){delete _0x348f42[_0xeccd('0x38')];}_0x3f2652['status'](_0x3b5e30)[_0xeccd('0x39')](_0x348f42);};}exports['index']=function(_0x3cf322,_0x22f1a4){var _0x337172={},_0x55f5c3={},_0x1bfebb={'count':0x0,'rows':[]};var _0xcbd51d=_['map'](db['SmsMessage'][_0xeccd('0x3a')],function(_0x4093a3){return{'name':_0x4093a3[_0xeccd('0x3b')],'type':_0x4093a3['type'][_0xeccd('0x3c')]};});_0x55f5c3['model']=_[_0xeccd('0x3d')](_0xcbd51d,'name');_0x55f5c3[_0xeccd('0x3e')]=_[_0xeccd('0x3f')](_0x3cf322[_0xeccd('0x3e')]);_0x55f5c3[_0xeccd('0x40')]=_['intersection'](_0x55f5c3['model'],_0x55f5c3[_0xeccd('0x3e')]);_0x337172['attributes']=_[_0xeccd('0x41')](_0x55f5c3[_0xeccd('0x42')],qs['fields'](_0x3cf322['query'][_0xeccd('0x43')]));_0x337172[_0xeccd('0x44')]=_0x337172['attributes'][_0xeccd('0x45')]?_0x337172[_0xeccd('0x44')]:_0x55f5c3[_0xeccd('0x42')];if(!_0x3cf322[_0xeccd('0x3e')][_0xeccd('0x46')](_0xeccd('0x47'))){_0x337172['limit']=qs[_0xeccd('0x2e')](_0x3cf322['query'][_0xeccd('0x2e')]);_0x337172[_0xeccd('0x2d')]=qs['offset'](_0x3cf322[_0xeccd('0x3e')]['offset']);}_0x337172[_0xeccd('0x48')]=qs[_0xeccd('0x49')](_0x3cf322[_0xeccd('0x3e')]['sort']);_0x337172[_0xeccd('0x4a')]=qs[_0xeccd('0x40')](_[_0xeccd('0x4b')](_0x3cf322[_0xeccd('0x3e')],_0x55f5c3['filters']),_0xcbd51d);if(_0x3cf322['query'][_0xeccd('0x4c')]){_0x337172[_0xeccd('0x4a')]=_[_0xeccd('0x4d')](_0x337172[_0xeccd('0x4a')],{'$or':_[_0xeccd('0x3d')](_0xcbd51d,function(_0x27248b){if(_0x27248b[_0xeccd('0x4e')]!==_0xeccd('0x4f')){var _0x448399={};_0x448399[_0x27248b['name']]={'$like':'%'+_0x3cf322['query'][_0xeccd('0x4c')]+'%'};return _0x448399;}})});}_0x337172=_[_0xeccd('0x4d')]({},_0x337172,_0x3cf322[_0xeccd('0x50')]);var _0x3a0c01={'where':_0x337172[_0xeccd('0x4a')]};return db[_0xeccd('0x51')][_0xeccd('0x2c')](_0x3a0c01)[_0xeccd('0x1d')](function(_0x5b78be){_0x1bfebb['count']=_0x5b78be;if(_0x3cf322['query'][_0xeccd('0x52')]){_0x337172['include']=[{'all':!![]}];}return db[_0xeccd('0x51')][_0xeccd('0x53')](_0x337172);})['then'](function(_0x3efb54){_0x1bfebb[_0xeccd('0x54')]=_0x3efb54;return _0x1bfebb;})[_0xeccd('0x1d')](respondWithFilteredResult(_0x22f1a4,_0x337172))[_0xeccd('0x27')](handleError(_0x22f1a4,null));};exports['show']=function(_0x2fef72,_0x5cdef1){var _0x61657e={'raw':!![],'where':{'id':_0x2fef72[_0xeccd('0x55')]['id']}},_0x20d093={};_0x20d093[_0xeccd('0x42')]=_[_0xeccd('0x3f')](db['SmsMessage'][_0xeccd('0x3a')]);_0x20d093[_0xeccd('0x3e')]=_['keys'](_0x2fef72['query']);_0x20d093[_0xeccd('0x40')]=_['intersection'](_0x20d093[_0xeccd('0x42')],_0x20d093['query']);_0x61657e[_0xeccd('0x44')]=_[_0xeccd('0x41')](_0x20d093[_0xeccd('0x42')],qs['fields'](_0x2fef72['query'][_0xeccd('0x43')]));_0x61657e['attributes']=_0x61657e[_0xeccd('0x44')]['length']?_0x61657e['attributes']:_0x20d093[_0xeccd('0x42')];if(_0x2fef72[_0xeccd('0x3e')][_0xeccd('0x52')]){_0x61657e['include']=[{'all':!![]}];}_0x61657e=_[_0xeccd('0x4d')]({},_0x61657e,_0x2fef72['options']);return db[_0xeccd('0x51')]['find'](_0x61657e)[_0xeccd('0x1d')](handleEntityNotFound(_0x5cdef1,null))[_0xeccd('0x1d')](respondWithResult(_0x5cdef1,null))['catch'](handleError(_0x5cdef1,null));};exports[_0xeccd('0x56')]=function(_0x703a8d,_0x2761aa){return db[_0xeccd('0x51')][_0xeccd('0x56')](_0x703a8d[_0xeccd('0x57')],{})[_0xeccd('0x1d')](respondWithResult(_0x2761aa,0xc9))[_0xeccd('0x27')](handleError(_0x2761aa,null));};exports[_0xeccd('0x34')]=function(_0x45ea1c,_0x12b02e){if(_0x45ea1c[_0xeccd('0x57')]['id']){delete _0x45ea1c[_0xeccd('0x57')]['id'];}return db['SmsMessage'][_0xeccd('0x58')]({'where':{'id':_0x45ea1c[_0xeccd('0x55')]['id']}})[_0xeccd('0x1d')](handleEntityNotFound(_0x12b02e,null))[_0xeccd('0x1d')](saveUpdates(_0x45ea1c[_0xeccd('0x57')],null))['then'](respondWithResult(_0x12b02e,null))[_0xeccd('0x27')](handleError(_0x12b02e,null));};exports[_0xeccd('0x35')]=function(_0x557cbb,_0x61bda){return db[_0xeccd('0x51')][_0xeccd('0x58')]({'where':{'id':_0x557cbb['params']['id']}})[_0xeccd('0x1d')](handleEntityNotFound(_0x61bda,null))[_0xeccd('0x1d')](removeEntity(_0x61bda,null))['catch'](handleError(_0x61bda,null));};exports[_0xeccd('0x59')]=function(_0x1f3354,_0x426efd){return db['SmsMessage'][_0xeccd('0x59')]()['then'](respondWithResult(_0x426efd,null))['catch'](handleError(_0x426efd,null));};var interaction_log=require(_0xeccd('0x10'))(_0xeccd('0x5a'));exports[_0xeccd('0x5b')]=function(_0xccc921,_0x4f2ff7,_0x29dea4){var _0x2ba183={'agent':{},'channel':_0xeccd('0x5c')};if(_0xccc921[_0xeccd('0x57')]['id']){delete _0xccc921[_0xeccd('0x57')]['id'];}_0xccc921[_0xeccd('0x57')][_0xeccd('0x5d')]=!![];_0xccc921['body'][_0xeccd('0x5e')]=moment()[_0xeccd('0x5f')](_0xeccd('0x60'));_0xccc921[_0xeccd('0x57')][_0xeccd('0x61')]=_0xccc921[_0xeccd('0x57')][_0xeccd('0x61')]||_0xccc921[_0xeccd('0x62')]['id'];_0x2ba183[_0xeccd('0x63')]['id']=_0xccc921['body'][_0xeccd('0x61')];return db[_0xeccd('0x51')][_0xeccd('0x58')]({'where':{'id':_0xccc921[_0xeccd('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f2ff7,null))['then'](saveUpdates(_0xccc921[_0xeccd('0x57')],null))[_0xeccd('0x1d')](function(_0x41cea0){if(_0x41cea0){_0x2ba183[_0xeccd('0x25')]=_0x41cea0['get']({'plain':!![]});return db[_0xeccd('0x64')][_0xeccd('0x58')]({'where':{'id':_0x41cea0[_0xeccd('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4f2ff7,null))[_0xeccd('0x1d')](function(_0x2f4d27){if(_0x2f4d27){return _0x2f4d27[_0xeccd('0x34')]({'UserId':_0xccc921[_0xeccd('0x57')][_0xeccd('0x61')],'read1stAt':_[_0xeccd('0x66')](_0x2f4d27[_0xeccd('0x67')])?moment()[_0xeccd('0x5f')](_0xeccd('0x60')):undefined});}return null;})[_0xeccd('0x1d')](function(_0x567726){if(_0x567726){_0x2ba183['interaction']=_0x567726['get']({'plain':!![]});interaction_log[_0xeccd('0x1e')](_0xeccd('0x68'),_0xccc921['user']['id'],_0xccc921[_0xeccd('0x62')][_0xeccd('0x38')],_0xccc921[_0xeccd('0x62')][_0xeccd('0x69')],_0x2ba183['interaction']['id'],_0xccc921['body']?JSON[_0xeccd('0x23')](_0xccc921['body']):_0xeccd('0x6a'));return respondWithRpcPromise(_0xeccd('0x6b'),_0xeccd('0x6c'),_0x2ba183);}return null;})[_0xeccd('0x1d')](function(_0x4f77b6){var _0x1acc87=_0xeccd('0x6d')+_0x4f77b6['message'][_0xeccd('0x6e')];return db[_0xeccd('0x6f')][_0xeccd('0x3e')](_0x1acc87,{'type':db[_0xeccd('0x70')][_0xeccd('0x71')][_0xeccd('0x72')],'raw':!![]})[_0xeccd('0x1d')](function(_0x511332){return _0x511332;});})[_0xeccd('0x1d')](function(_0xdcedec){if(_0xdcedec){_0x2ba183[_0xeccd('0x25')]['contact']=_0xdcedec[0x0];if(!_0xccc921['body']['UserId'])return;return db[_0xeccd('0x73')][_0xeccd('0x58')]({'where':{'id':_0xccc921['body'][_0xeccd('0x61')],'role':_0xeccd('0x63')},'attributes':['id',_0xeccd('0x38'),_0xeccd('0x74'),_0xeccd('0x75'),_0xeccd('0x76')],'raw':!![]});}return null;})['then'](function(_0x3f8b4b){if(!_0x3f8b4b)return null;_0x2ba183[_0xeccd('0x25')][_0xeccd('0x63')]=_0x3f8b4b;return _0x2ba183;})['then'](function(_0x12d8ec){if(_0x12d8ec){if(_0xccc921[_0xeccd('0x57')][_0xeccd('0x77')]){_0x2ba183[_0xeccd('0x25')][_0xeccd('0x78')]=util[_0xeccd('0x5f')](_0xeccd('0x79'),_0xccc921[_0xeccd('0x62')][_0xeccd('0x38')]);_0x2ba183['message'][_0xeccd('0x7a')]=_0x2ba183['channel'];_0x2ba183[_0xeccd('0x25')][_0xeccd('0x7b')]=_0x2ba183['channel'];_0x2ba183['message'][_0xeccd('0x7c')]='accept';return respondWithRpcPromise('EventManager',_0xeccd('0x7d'),{'event':_0xeccd('0x7e'),'message':_0x2ba183['message']},client9002)[_0xeccd('0x1d')](function(){return _0x2ba183;});}return _0x2ba183;}return null;})['then'](respondWithResult(_0x4f2ff7,null))[_0xeccd('0x27')](handleError(_0x4f2ff7,null));};var interaction_log=require('../../config/logger')(_0xeccd('0x5a'));exports[_0xeccd('0x32')]=function(_0x23b9d3,_0x44b2ef,_0x594be1){var _0x31f4ba={'agent':{},'channel':_0xeccd('0x5c')};if(_0x23b9d3[_0xeccd('0x57')]['id']){delete _0x23b9d3[_0xeccd('0x57')]['id'];}_0x23b9d3[_0xeccd('0x57')][_0xeccd('0x61')]=_0x23b9d3['body'][_0xeccd('0x61')]||_0x23b9d3['user']['id'];_0x31f4ba[_0xeccd('0x63')]['id']=_0x23b9d3[_0xeccd('0x57')]['UserId'];return db['SmsMessage'][_0xeccd('0x58')]({'where':{'id':_0x23b9d3[_0xeccd('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44b2ef,null))[_0xeccd('0x1d')](function(_0x271d0b){if(_0x271d0b){_0x31f4ba[_0xeccd('0x25')]=_0x271d0b[_0xeccd('0x7f')]({'plain':!![]});return db[_0xeccd('0x64')]['find']({'where':{'id':_0x271d0b[_0xeccd('0x65')]}});}return null;})[_0xeccd('0x1d')](handleEntityNotFound(_0x44b2ef,null))[_0xeccd('0x1d')](function(_0x10daa1){if(_0x10daa1){_0x31f4ba[_0xeccd('0x80')]=_0x10daa1['get']({'plain':!![]});interaction_log[_0xeccd('0x1e')](_0xeccd('0x81'),_0x23b9d3[_0xeccd('0x62')]['id'],_0x23b9d3['user'][_0xeccd('0x38')],_0x23b9d3[_0xeccd('0x62')][_0xeccd('0x69')],_0x31f4ba[_0xeccd('0x80')]['id'],_0x23b9d3[_0xeccd('0x57')]?JSON['stringify'](_0x23b9d3[_0xeccd('0x57')]):_0xeccd('0x6a'));return respondWithRpcPromise(_0xeccd('0x82'),_0xeccd('0x83'),_0x31f4ba);}return null;})['then'](function(_0x4f822d){var _0x6d0e91='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f822d[_0xeccd('0x25')][_0xeccd('0x6e')];return db[_0xeccd('0x6f')]['query'](_0x6d0e91,{'type':db[_0xeccd('0x70')]['QueryTypes'][_0xeccd('0x72')],'raw':!![]})[_0xeccd('0x1d')](function(_0x423f76){return _0x423f76;});})[_0xeccd('0x1d')](function(_0x5e621e){if(_0x5e621e){_0x31f4ba['message'][_0xeccd('0x84')]=_0x5e621e[0x0];if(!_0x23b9d3[_0xeccd('0x57')][_0xeccd('0x61')])return;return db[_0xeccd('0x73')]['find']({'where':{'id':_0x23b9d3[_0xeccd('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0xeccd('0x38'),_0xeccd('0x74'),'email',_0xeccd('0x76')],'raw':!![]});}return null;})[_0xeccd('0x1d')](function(_0x1f59ae){if(!_0x1f59ae)return null;_0x31f4ba['message']['agent']=_0x1f59ae;return _0x31f4ba;})[_0xeccd('0x1d')](function(_0x3811da){if(_0x3811da){_0x3811da['message'][_0xeccd('0x78')]=util[_0xeccd('0x5f')](_0xeccd('0x79'),_0x23b9d3[_0xeccd('0x62')][_0xeccd('0x38')]);_0x3811da[_0xeccd('0x25')]['channel']=_0x31f4ba['channel'];_0x3811da[_0xeccd('0x25')][_0xeccd('0x7b')]=_0x31f4ba[_0xeccd('0x7a')];_0x3811da[_0xeccd('0x25')][_0xeccd('0x7c')]=_0xeccd('0x32');respondWithRpcPromise(_0xeccd('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x3811da[_0xeccd('0x25')]},client9002);return _0x31f4ba;}return null;})[_0xeccd('0x1d')](respondWithResult(_0x44b2ef,null))[_0xeccd('0x27')](handleError(_0x44b2ef,null));};exports[_0xeccd('0x29')]=function(_0xb9b064,_0x3b27b1,_0x3c7c04){if(_0xb9b064[_0xeccd('0x57')]['id']){delete _0xb9b064[_0xeccd('0x57')]['id'];}var _0x188447;return db[_0xeccd('0x51')][_0xeccd('0x58')]({'where':{'id':_0xb9b064[_0xeccd('0x55')]['id']}})[_0xeccd('0x1d')](handleEntityNotFound(_0x3b27b1,null))[_0xeccd('0x1d')](function(_0x3e75e0){if(_0x3e75e0){_0x188447=_0x3e75e0;return db['SmsAccount'][_0xeccd('0x58')]({'where':{'id':_0x3e75e0[_0xeccd('0x85')]}});}})['then'](handleEntityNotFound(_0x3b27b1,null))[_0xeccd('0x1d')](function(_0x1d899a){if(_0x1d899a){logger[_0xeccd('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeccd('0x29'),_0xeccd('0x86'),_0x1d899a[_0xeccd('0x4e')],util[_0xeccd('0x87')](_0xb9b064[_0xeccd('0x57')],{'showHidden':![],'depth':null}));switch(_0x1d899a[_0xeccd('0x4e')]){case _0xeccd('0x88'):if(_0xb9b064[_0xeccd('0x57')][_0xeccd('0x89')]&&_0xb9b064[_0xeccd('0x57')][_0xeccd('0x89')]===_0x188447[_0xeccd('0x8a')]){return _0x188447[_0xeccd('0x34')]({'read':!![]});}else{logger['error'](_0xeccd('0x8b'),_0xeccd('0x29'),_0xeccd('0x88'),util['inspect'](_0xb9b064[_0xeccd('0x57')],{'showHidden':![],'depth':null}));}break;case _0xeccd('0x8c'):if(_0xb9b064[_0xeccd('0x57')][_0xeccd('0x8d')]&&_0xb9b064[_0xeccd('0x57')]['MessageUUID']===_0x188447[_0xeccd('0x8a')]&&_[_0xeccd('0x8e')]([_0xeccd('0x8f'),_0xeccd('0x90')],_0xb9b064[_0xeccd('0x57')][_0xeccd('0x91')])>=0x0){return _0x188447[_0xeccd('0x34')]({'read':!![]});}else{logger[_0xeccd('0x24')](_0xeccd('0x8b'),_0xeccd('0x29'),'plivio',util[_0xeccd('0x87')](_0xb9b064[_0xeccd('0x57')],{'showHidden':![],'depth':null}));}break;case _0xeccd('0x92'):var _0x53b708=_0xb9b064[_0xeccd('0x57')]['results'][0x0];if(_0x53b708['status']['groupName']===_0xeccd('0x93')){return _0x188447[_0xeccd('0x34')]({'read':!![]});}else{logger[_0xeccd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeccd('0x29'),_0xeccd('0x92'),util[_0xeccd('0x87')](_0xb9b064[_0xeccd('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x188447;}})[_0xeccd('0x1d')](respondWithResult(_0x3b27b1,null))[_0xeccd('0x27')](handleError(_0x3b27b1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1d09d0e..6804572 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 _0x7664=['exports','events','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x181a86,_0x2a04e2){var _0x5a7b71=function(_0x5cfd33){while(--_0x5cfd33){_0x181a86['push'](_0x181a86['shift']());}};_0x5a7b71(++_0x2a04e2);}(_0x7664,0x106));var _0x4766=function(_0x477086,_0x3ac0f9){_0x477086=_0x477086-0x0;var _0x519aab=_0x7664[_0x477086];return _0x519aab;};'use strict';var EventEmitter=require(_0x4766('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x4766('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4766('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4766('0x3'),'afterDestroy':_0x4766('0x4')};function emitEvent(_0x5098e8){return function(_0x2a330a,_0x14df6a,_0x4be276){SmsMessageEvents['emit'](_0x5098e8+':'+_0x2a330a['id'],_0x2a330a);SmsMessageEvents[_0x4766('0x5')](_0x5098e8,_0x2a330a);_0x4be276(null);};}for(var e in events){if(events[_0x4766('0x6')](e)){var event=events[e];SmsMessage[_0x4766('0x7')](e,emitEvent(event));}}module[_0x4766('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xdb2c=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x42a7e5,_0x1b5ee9){var _0xab94df=function(_0xe48957){while(--_0xe48957){_0x42a7e5['push'](_0x42a7e5['shift']());}};_0xab94df(++_0x1b5ee9);}(_0xdb2c,0x137));var _0xcdb2=function(_0x4837c8,_0x12d470){_0x4837c8=_0x4837c8-0x0;var _0x367891=_0xdb2c[_0x4837c8];return _0x367891;};'use strict';var EventEmitter=require(_0xcdb2('0x0'));var SmsMessage=require(_0xcdb2('0x1'))['db'][_0xcdb2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcdb2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x678f96){return function(_0x450de9,_0x5579d4,_0x18886b){SmsMessageEvents[_0xcdb2('0x4')](_0x678f96+':'+_0x450de9['id'],_0x450de9);SmsMessageEvents[_0xcdb2('0x4')](_0x678f96,_0x450de9);_0x18886b(null);};}for(var e in events){if(events[_0xcdb2('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xcdb2('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6c0d371..e112622 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 _0xe395=['toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','error','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','sort','length','apiKey','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','csc','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction'];(function(_0x1cbfa4,_0x719ed9){var _0x122f90=function(_0x1ccc9e){while(--_0x1ccc9e){_0x1cbfa4['push'](_0x1cbfa4['shift']());}};_0x122f90(++_0x719ed9);}(_0xe395,0xeb));var _0x5e39=function(_0x12bc86,_0x4dd078){_0x12bc86=_0x12bc86-0x0;var _0x5e9535=_0xe395[_0x12bc86];return _0x5e9535;};'use strict';var _=require(_0x5e39('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5e39('0x1'));var moment=require(_0x5e39('0x2'));var BPromise=require(_0x5e39('0x3'));var rp=require(_0x5e39('0x4'));var fs=require('fs');var path=require(_0x5e39('0x5'));var rimraf=require(_0x5e39('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e39('0x7'));module['exports']=function(_0x1957ff,_0x3eebc2){return _0x1957ff['define'](_0x5e39('0x8'),attributes,{'tableName':_0x5e39('0x9'),'paranoid':![],'indexes':[{'name':_0x5e39('0xa'),'fields':['messageId']},{'name':_0x5e39('0xb'),'fields':['body'],'type':_0x5e39('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34b059,_0x5336cd,_0xb6f0d2){var _0x37c1dc=_0x1957ff['models'];var _0x36ec4a=_0x34b059[_0x5e39('0xd')]({'plain':!![]});if(_0x36ec4a[_0x5e39('0xe')][_0x5e39('0xf')]()==='in'||_0x36ec4a[_0x5e39('0xe')][_0x5e39('0xf')]()===_0x5e39('0x10')&&!_0x36ec4a[_0x5e39('0x11')]&&!_[_0x5e39('0x12')](_0x36ec4a[_0x5e39('0x13')])&&!_[_0x5e39('0x12')](_0x36ec4a[_0x5e39('0x14')])){_0x37c1dc[_0x5e39('0x15')][_0x5e39('0x16')]({'where':{'id':_0x36ec4a[_0x5e39('0x14')]}})[_0x5e39('0x17')](function(_0x56998e){if(_0x56998e){_0x56998e[_0x5e39('0x18')]({'lastMsgAt':_0x36ec4a['createdAt'],'lastMsgDirection':_0x36ec4a[_0x5e39('0xe')][_0x5e39('0xf')]()});}})[_0x5e39('0x19')](function(_0x3a5189){console['error'](_0x3a5189);});}if(_0x36ec4a[_0x5e39('0xe')]==='out'&&!_0x36ec4a['secret']){var _0x248f74;_0x37c1dc[_0x5e39('0x1a')][_0x5e39('0x1b')]({'where':{'id':_0x36ec4a[_0x5e39('0x1c')]},'raw':!![]})['then'](function(_0x20b2f5){_0x248f74=_0x20b2f5;if(_0x248f74&&_0x248f74['type']){switch(_0x248f74[_0x5e39('0x1d')]){case _0x5e39('0x1e'):var _0xb363aa=require('twilio');if(_0x248f74[_0x5e39('0x1f')]&&_0x248f74[_0x5e39('0x20')]&&_0x248f74[_0x5e39('0x21')]){var _0x16eabe=new _0xb363aa(_0x248f74[_0x5e39('0x1f')],_0x248f74[_0x5e39('0x20')]);_0x16eabe[_0x5e39('0x22')][_0x5e39('0x23')]({'body':_0x36ec4a[_0x5e39('0x24')],'to':_0x36ec4a['phone'],'from':_0x248f74[_0x5e39('0x21')],'statusCallback':_0x248f74[_0x5e39('0x25')]+_0x5e39('0x26')+_0x36ec4a['id']+_0x5e39('0x27')+_0x248f74[_0x5e39('0x28')]})[_0x5e39('0x17')](function(_0x1eb9d4){if(_0x1eb9d4[_0x5e39('0x29')]){return _0x34b059[_0x5e39('0x18')]({'messageId':_0x1eb9d4[_0x5e39('0x29')]});}})[_0x5e39('0x19')](function(_0x362a53){logger[_0x5e39('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5e39('0x1e'),util[_0x5e39('0x2b')](_0x362a53,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x1e'),_0x5e39('0x2e'));}break;case'skebby':var _0x1ed996=_0x5e39('0x2f');if(_0x248f74[_0x5e39('0x30')]&&_0x248f74['password']){var _0x4d93c3={'recipient':[_0x36ec4a[_0x5e39('0x21')]],'message':_0x36ec4a[_0x5e39('0x24')],'message_type':_0x248f74['smsMethod']};if(_0x248f74[_0x5e39('0x31')]&&_0x248f74[_0x5e39('0x31')]!=='SI'){_0x4d93c3[_0x5e39('0x32')]=_0x248f74[_0x5e39('0x21')];}var _0x11de15={'url':_0x1ed996+_0x5e39('0x33')+_0x248f74['username']+_0x5e39('0x34')+_0x248f74[_0x5e39('0x35')],'method':'GET'};rp(_0x11de15)['then'](function(_0xb18e5c){var _0x2e87ef=_0xb18e5c['split'](';');var _0x2ea87f={'user_key':_0x2e87ef[0x0],'session_key':_0x2e87ef[0x1]};_0x11de15={'url':_0x1ed996+'sms','method':_0x5e39('0x36'),'headers':{'user_key':_0x2ea87f[_0x5e39('0x37')],'Session_key':_0x2ea87f[_0x5e39('0x38')]},'json':!![],'body':_0x4d93c3};return rp(_0x11de15);})[_0x5e39('0x17')](function(_0x363d53){if(_0x363d53[_0x5e39('0x39')]>=0x1){var _0x358496={'messageId':_0x363d53[_0x5e39('0x3a')]};if(_0x248f74['smsMethod']!=='GP'||!_0x248f74[_0x5e39('0x3b')]){_0x358496[_0x5e39('0x3c')]=!![];}return _0x34b059[_0x5e39('0x18')](_0x358496);}else{return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),'afterCreate',_0x5e39('0x3d'),util['inspect'](_0x363d53,{'showHidden':![],'depth':null}));}})[_0x5e39('0x19')](function(_0x8fc803){return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x3d'),util[_0x5e39('0x2b')](_0x8fc803,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x3d'),_0x5e39('0x3e'));}break;case _0x5e39('0x3f'):if(_0x248f74[_0x5e39('0x20')]){var _0x218b6f={'recipient':_0x36ec4a['phone'],'message':_0x36ec4a[_0x5e39('0x24')],'sender':_0x248f74[_0x5e39('0x40')]||_0x248f74[_0x5e39('0x21')],'authorization':_0x248f74[_0x5e39('0x20')]};var _0x5336cd={'method':_0x5e39('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x218b6f,'json':!![]};rp(_0x5336cd)['then'](function(_0x491baf){var _0x530263={'messageId':_0x491baf[_0x5e39('0x41')]};if(!_0x248f74[_0x5e39('0x3b')]){_0x530263[_0x5e39('0x3c')]=!![];}return _0x34b059['update'](_0x530263);})[_0x5e39('0x19')](function(_0x18ab64){logger[_0x5e39('0x2a')](_0x5e39('0x2c'),'afterCreate',_0x5e39('0x3f'),util[_0x5e39('0x2b')](_0x18ab64,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x3f'),_0x5e39('0x42'));}break;case _0x5e39('0x43'):if(_0x248f74[_0x5e39('0x30')]&&_0x248f74['password']){var _0x218b6f={'messages':[{'source':_0x5e39('0x44'),'to':_0x36ec4a[_0x5e39('0x21')],'body':_0x36ec4a['body'],'from':_0x248f74['senderString']||_0x248f74['phone']}]};var _0x2b2d94=util[_0x5e39('0x45')](_0x5e39('0x46'),_0x248f74[_0x5e39('0x30')],_0x248f74[_0x5e39('0x35')]);var _0x5336cd={'method':'POST','uri':_0x5e39('0x47'),'body':_0x218b6f,'headers':{'Authorization':util[_0x5e39('0x45')](_0x5e39('0x48'),new Buffer(_0x2b2d94)[_0x5e39('0x49')](_0x5e39('0x4a')))},'json':!![]};rp(_0x5336cd)[_0x5e39('0x17')](function(_0x3947d8){if(_0x3947d8['http_code']>=0xc8&&_0x3947d8[_0x5e39('0x4b')]<=0xce){if(_0x3947d8[_0x5e39('0x4c')]&&_0x3947d8[_0x5e39('0x4c')]['queued_count']>0x0){var _0x2ae970=_['head'](_0x3947d8[_0x5e39('0x4c')]['messages']);var _0x34e4c1={'messageId':_0x2ae970[_0x5e39('0x4d')]};if(!_0x248f74[_0x5e39('0x3b')]){_0x34e4c1[_0x5e39('0x3c')]=!![];}return _0x34b059['update'](_0x34e4c1);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e39('0x2d'),_0x5e39('0x4e'),util[_0x5e39('0x2b')](_0x3947d8,{'showHidden':![],'depth':null}));}}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x4e'),util[_0x5e39('0x2b')](_0x3947d8,{'showHidden':![],'depth':null}));}})['catch'](function(_0xfccd56){logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x4e'),util[_0x5e39('0x2b')](_0xfccd56,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),'afterCreate',_0x5e39('0x4e'),_0x5e39('0x3e'));}break;case _0x5e39('0x4f'):if(_0x248f74[_0x5e39('0x50')]&&_0x248f74[_0x5e39('0x20')]){var _0x218b6f={'dst':_0x36ec4a['phone'],'text':_0x36ec4a[_0x5e39('0x24')],'src':_0x248f74[_0x5e39('0x40')]||_0x248f74[_0x5e39('0x21')],'url':_0x248f74[_0x5e39('0x25')]+_0x5e39('0x26')+_0x36ec4a['id']+_0x5e39('0x27')+_0x248f74[_0x5e39('0x28')]};var _0x2b2d94=util[_0x5e39('0x45')](_0x5e39('0x46'),_0x248f74[_0x5e39('0x50')],_0x248f74[_0x5e39('0x20')]);var _0x5336cd={'method':_0x5e39('0x36'),'uri':util[_0x5e39('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x248f74[_0x5e39('0x50')]),'body':_0x218b6f,'headers':{'Authorization':util[_0x5e39('0x45')](_0x5e39('0x48'),new Buffer(_0x2b2d94)[_0x5e39('0x49')]('base64'))},'json':!![]};rp(_0x5336cd)[_0x5e39('0x17')](function(_0x5c3548){var _0x70c48c={'messageId':_0x5c3548[_0x5e39('0x51')][0x0]};return _0x34b059[_0x5e39('0x18')](_0x70c48c);})['catch'](function(_0x3c0dea){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e39('0x2d'),_0x5e39('0x4f'),util['inspect'](_0x3c0dea,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x4f'),_0x5e39('0x52'));}break;case'infobip':if(_0x248f74[_0x5e39('0x30')]&&_0x248f74['password']){if(_0x248f74[_0x5e39('0x53')]){var _0x3be0cb={'method':'POST','uri':_0x248f74[_0x5e39('0x53')]+_0x5e39('0x54'),'body':{'username':_0x248f74[_0x5e39('0x30')],'password':_0x248f74[_0x5e39('0x35')]},'json':!![]};return rp(_0x3be0cb)[_0x5e39('0x17')](function(_0x44f104){var _0x8aa26d={'method':_0x5e39('0x36'),'uri':_0x248f74[_0x5e39('0x53')]+_0x5e39('0x55'),'body':{'messages':[{'from':_0x248f74[_0x5e39('0x21')],'destinations':[{'to':_0x36ec4a[_0x5e39('0x21')]}],'text':_0x36ec4a['body'],'notifyUrl':_0x248f74['remote']+'/api/sms/messages/'+_0x36ec4a['id']+_0x5e39('0x27')+_0x248f74[_0x5e39('0x28')],'notifyContentType':'application/json','callbackData':_0x248f74[_0x5e39('0x21')]+';'+_0x36ec4a['body']}]},'headers':{'Authorization':_0x5e39('0x56')+_0x44f104['token']},'json':!![]};return rp(_0x8aa26d)['then'](function(_0x2a20e5){if(_0x2a20e5[_0x5e39('0x22')]){var _0x32bcd3={'messageId':_0x2a20e5[_0x5e39('0x22')][0x0]['messageId']};if(!_0x248f74['deliveryReport']){_0x32bcd3[_0x5e39('0x3c')]=!![];}return _0x34b059[_0x5e39('0x18')](_0x32bcd3);}else{return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x57'),util[_0x5e39('0x2b')](_0x2a20e5,{'showHidden':![],'depth':null}));}});})[_0x5e39('0x19')](function(_0x44999e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e39('0x2d'),_0x5e39('0x57'),util[_0x5e39('0x2b')](_0x44999e,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x57'),_0x5e39('0x58'));}}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x3d5f98=require(_0x5e39('0x59'));if(_0x248f74['apiKey']){var _0xaf90f9={};_0xaf90f9[_0x5e39('0x5a')]=_0x248f74[_0x5e39('0x30')];_0xaf90f9[_0x5e39('0x21')]=_0x36ec4a[_0x5e39('0x21')];_0xaf90f9[_0x5e39('0x32')]=_0x248f74[_0x5e39('0x21')];_0xaf90f9[_0x5e39('0x5b')]=_0x36ec4a['body'];_0xaf90f9[_0x5e39('0x5c')]=+new Date();var _0x162bc6='';var _0x20208b='';var _0x4b111a=Object['keys'](_0xaf90f9);_0x4b111a[_0x5e39('0x5d')]();for(var _0x15d708=0x0;_0x15d708<_0x4b111a[_0x5e39('0x5e')];_0x15d708++){if(_0x162bc6!=''){_0x162bc6+='&';}_0x162bc6+=_0x4b111a[_0x15d708]+'='+encodeURIComponent(_0xaf90f9[_0x4b111a[_0x15d708]]);_0x20208b+=_0xaf90f9[_0x4b111a[_0x15d708]];}_0x20208b+=_0x248f74[_0x5e39('0x5f')];_0x20208b=_0x3d5f98[_0x5e39('0x60')](_0x5e39('0x61'))[_0x5e39('0x18')](_0x20208b)[_0x5e39('0x62')](_0x5e39('0x63'));if(_0x162bc6!==''){_0x162bc6+='&';}_0x162bc6+=_0x5e39('0x64')+_0x20208b;var _0x11de15={'method':_0x5e39('0x65'),'uri':_0x248f74['baseUrl']+_0x5e39('0x66')+_0x162bc6,'json':!![]};return rp(_0x11de15)[_0x5e39('0x17')](function(_0x1d1be3){var _0xa71d57=Object[_0x5e39('0x67')](_0x1d1be3);if(_0x1d1be3[_0xa71d57[0x0]][_0x5e39('0x2a')]&&parseInt(_0x1d1be3[_0xa71d57[0x0]][_0x5e39('0x2a')])===0x0){var _0x5d60d7={'messageId':_0x1d1be3[_0xa71d57[0x0]]['id_sms']};if(!_0x248f74[_0x5e39('0x3b')]){_0x5d60d7[_0x5e39('0x3c')]=!![];}return _0x34b059['update'](_0x5d60d7);}else{return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x68'),util[_0x5e39('0x2b')](_0x1d1be3[_0x5e39('0x2a')],{'showHidden':![],'depth':null}));}})[_0x5e39('0x19')](function(_0x5c9ec4){return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x68'),util[_0x5e39('0x2b')](_0x5c9ec4,{'showHidden':![],'depth':null}));});}else{logger[_0x5e39('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x248f74['apiKey']){var _0x159f40={'method':_0x5e39('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x248f74[_0x5e39('0x5f')]},'body':{'content':_0x36ec4a[_0x5e39('0x24')],'to':[_0x36ec4a[_0x5e39('0x21')]],'from':_0x248f74[_0x5e39('0x21')],'binary':![],'clientMessageId':_0x5e39('0x69'),'charset':_0x5e39('0x6a')},'json':!![]};rp(_0x159f40)['then'](function(_0x492de4){if(!_0x492de4['error']){var _0xd84581={'messageId':_0x492de4[_0x5e39('0x22')][0x0][_0x5e39('0x6b')]};if(!_0x248f74['deliveryReport']){_0xd84581[_0x5e39('0x3c')]=!![];}return _0x34b059[_0x5e39('0x18')](_0xd84581);}else{return logger[_0x5e39('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5e39('0x6c'),util[_0x5e39('0x2b')](_0x492de4[_0x5e39('0x2a')],{'showHidden':![],'depth':null}));}})[_0x5e39('0x19')](function(_0x50dd75){return logger[_0x5e39('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x5e39('0x2b')](_0x50dd75,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5e39('0x2c'),'afterCreate',_0x5e39('0x6c'),_0x5e39('0x6d'));}break;case'bandwidth':if(_0x248f74[_0x5e39('0x30')]&&_0x248f74[_0x5e39('0x35')]){var _0x2b2d94=util[_0x5e39('0x45')](_0x5e39('0x46'),_0x248f74[_0x5e39('0x30')],_0x248f74['password']);var _0x5336cd={'method':_0x5e39('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x248f74[_0x5e39('0x6e')]+_0x5e39('0x6f'),'body':{'to':[_0x36ec4a[_0x5e39('0x21')]],'text':_0x36ec4a['body'],'from':_0x248f74[_0x5e39('0x21')],'applicationId':_0x248f74[_0x5e39('0x70')]},'headers':{'Authorization':util['format'](_0x5e39('0x48'),new Buffer(_0x2b2d94)['toString'](_0x5e39('0x4a')))},'json':!![]};rp(_0x5336cd)[_0x5e39('0x17')](function(_0x43e643){if(_0x43e643['id']){var _0x5a2c39={'messageId':_0x43e643['id']};return _0x34b059[_0x5e39('0x18')](_0x5a2c39);}else{logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x71'),util[_0x5e39('0x2b')](_0x43e643,{'showHidden':![],'depth':null}));}})[_0x5e39('0x19')](function(_0x5ce61e){logger['error'](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x71'),util[_0x5e39('0x2b')](_0x5ce61e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x71'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5e39('0x72'):if(_0x248f74[_0x5e39('0x5f')]){var _0x2a1a23={};var _0x11de15={'method':_0x5e39('0x36'),'uri':_0x5e39('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x248f74[_0x5e39('0x5f')],'Content-Type':_0x5e39('0x74')},'body':{'from':_0x248f74[_0x5e39('0x21')],'to':_0x36ec4a[_0x5e39('0x21')],'text':_0x36ec4a[_0x5e39('0x24')]},'json':!![]};return rp(_0x11de15)['then'](function(_0x1daa21){if(_0x1daa21[_0x5e39('0x75')]==0xca){_0x2a1a23['message']=_0x1daa21;var _0x266be7={'method':_0x5e39('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x248f74[_0x5e39('0x5f')],'Content-Type':'application/json'},'body':{'refid':_0x2a1a23[_0x5e39('0x76')][_0x5e39('0x77')]},'json':!![]};return rp(_0x266be7)[_0x5e39('0x17')](function(_0xbabca1){_0x2a1a23[_0x5e39('0x78')]=_0xbabca1;var _0x2c1a3a={'messageId':_0x2a1a23[_0x5e39('0x76')][_0x5e39('0x77')],'read':!![]};return _0x34b059[_0x5e39('0x18')](_0x2c1a3a);});}else{return logger[_0x5e39('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e39('0x2d'),_0x5e39('0x72'),util[_0x5e39('0x2b')](_0x1daa21,{'showHidden':![],'depth':null}));}})[_0x5e39('0x19')](function(_0x4b09dd){return logger['error'](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x72'),util[_0x5e39('0x2b')](_0x4b09dd,{'showHidden':![],'depth':null}));});}else{return logger[_0x5e39('0x2a')](_0x5e39('0x2c'),_0x5e39('0x2d'),_0x5e39('0x72'),_0x5e39('0x79'));}break;}}})[_0x5e39('0x7a')](function(){_0xb6f0d2();});}else{_0xb6f0d2();}}},'charset':_0x5e39('0x7b'),'collate':_0x5e39('0x7c')});}; \ No newline at end of file +var _0x647c=['/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','bandwidth','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','FULLTEXT','direction','toLowerCase','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','out','secret','SmsAccount','find','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','update','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','md5','signature='];(function(_0x1009f9,_0x5d476d){var _0x1f3d90=function(_0x36a83b){while(--_0x36a83b){_0x1009f9['push'](_0x1009f9['shift']());}};_0x1f3d90(++_0x5d476d);}(_0x647c,0x183));var _0xc647=function(_0x299721,_0x2f27c4){_0x299721=_0x299721-0x0;var _0x50a594=_0x647c[_0x299721];return _0x50a594;};'use strict';var _=require('lodash');var util=require(_0xc647('0x0'));var logger=require(_0xc647('0x1'))('api');var moment=require(_0xc647('0x2'));var BPromise=require('bluebird');var rp=require(_0xc647('0x3'));var fs=require('fs');var path=require(_0xc647('0x4'));var rimraf=require(_0xc647('0x5'));var config=require(_0xc647('0x6'));var attributes=require('./smsMessage.attributes');module[_0xc647('0x7')]=function(_0x38bb48,_0x307dba){return _0x38bb48[_0xc647('0x8')](_0xc647('0x9'),attributes,{'tableName':_0xc647('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc647('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':_0xc647('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7a51fe,_0x18f0fc,_0x1633d8){var _0xc47503=_0x38bb48['models'];var _0x3006e2=_0x7a51fe['get']({'plain':!![]});if(_0x3006e2[_0xc647('0xd')][_0xc647('0xe')]()==='in'||_0x3006e2[_0xc647('0xd')][_0xc647('0xe')]()==='out'&&!_0x3006e2['secret']&&!_['isNil'](_0x3006e2[_0xc647('0xf')])&&!_[_0xc647('0x10')](_0x3006e2[_0xc647('0x11')])){_0xc47503[_0xc647('0x12')][_0xc647('0x13')]({'where':{'id':_0x3006e2[_0xc647('0x11')]}})[_0xc647('0x14')](function(_0x3b16a7){if(_0x3b16a7){_0x3b16a7['update']({'lastMsgAt':_0x3006e2[_0xc647('0x15')],'lastMsgDirection':_0x3006e2[_0xc647('0xd')][_0xc647('0xe')]()});}})[_0xc647('0x16')](function(_0x24e77a){console['error'](_0x24e77a);});}if(_0x3006e2['direction']===_0xc647('0x17')&&!_0x3006e2[_0xc647('0x18')]){var _0x20b790;_0xc47503[_0xc647('0x19')][_0xc647('0x1a')]({'where':{'id':_0x3006e2['SmsAccountId']},'raw':!![]})[_0xc647('0x14')](function(_0x43ebf6){_0x20b790=_0x43ebf6;if(_0x20b790&&_0x20b790['type']){switch(_0x20b790['type']){case _0xc647('0x1b'):var _0x4779f4=require(_0xc647('0x1b'));if(_0x20b790[_0xc647('0x1c')]&&_0x20b790[_0xc647('0x1d')]&&_0x20b790[_0xc647('0x1e')]){var _0x48e4ab=new _0x4779f4(_0x20b790[_0xc647('0x1c')],_0x20b790[_0xc647('0x1d')]);_0x48e4ab[_0xc647('0x1f')][_0xc647('0x20')]({'body':_0x3006e2['body'],'to':_0x3006e2[_0xc647('0x1e')],'from':_0x20b790[_0xc647('0x1e')],'statusCallback':_0x20b790['remote']+_0xc647('0x21')+_0x3006e2['id']+_0xc647('0x22')+_0x20b790[_0xc647('0x23')]})['then'](function(_0x3e744c){if(_0x3e744c['sid']){return _0x7a51fe[_0xc647('0x24')]({'messageId':_0x3e744c[_0xc647('0x25')]});}})[_0xc647('0x16')](function(_0xeca616){logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),'twilio',util[_0xc647('0x29')](_0xeca616,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),'twilio',_0xc647('0x2a'));}break;case _0xc647('0x2b'):var _0x401f85=_0xc647('0x2c');if(_0x20b790[_0xc647('0x2d')]&&_0x20b790[_0xc647('0x2e')]){var _0x385d20={'recipient':[_0x3006e2[_0xc647('0x1e')]],'message':_0x3006e2[_0xc647('0x2f')],'message_type':_0x20b790[_0xc647('0x30')]};if(_0x20b790[_0xc647('0x30')]&&_0x20b790[_0xc647('0x30')]!=='SI'){_0x385d20[_0xc647('0x31')]=_0x20b790['phone'];}var _0x4922d4={'url':_0x401f85+_0xc647('0x32')+_0x20b790[_0xc647('0x2d')]+'&password='+_0x20b790[_0xc647('0x2e')],'method':_0xc647('0x33')};rp(_0x4922d4)[_0xc647('0x14')](function(_0x49de2d){var _0x2072e4=_0x49de2d[_0xc647('0x34')](';');var _0x31e33e={'user_key':_0x2072e4[0x0],'session_key':_0x2072e4[0x1]};_0x4922d4={'url':_0x401f85+_0xc647('0x35'),'method':_0xc647('0x36'),'headers':{'user_key':_0x31e33e[_0xc647('0x37')],'Session_key':_0x31e33e['session_key']},'json':!![],'body':_0x385d20};return rp(_0x4922d4);})[_0xc647('0x14')](function(_0x452edd){if(_0x452edd[_0xc647('0x38')]>=0x1){var _0x4778a1={'messageId':_0x452edd[_0xc647('0x39')]};if(_0x20b790[_0xc647('0x30')]!=='GP'||!_0x20b790[_0xc647('0x3a')]){_0x4778a1['read']=!![];}return _0x7a51fe[_0xc647('0x24')](_0x4778a1);}else{return logger['error'](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x2b'),util[_0xc647('0x29')](_0x452edd,{'showHidden':![],'depth':null}));}})[_0xc647('0x16')](function(_0x74a2cc){return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x2b'),util[_0xc647('0x29')](_0x74a2cc,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')](_0xc647('0x27'),'afterCreate',_0xc647('0x2b'),_0xc647('0x3b'));}break;case _0xc647('0x3c'):if(_0x20b790[_0xc647('0x1d')]){var _0xb2554={'recipient':_0x3006e2['phone'],'message':_0x3006e2[_0xc647('0x2f')],'sender':_0x20b790[_0xc647('0x3d')]||_0x20b790[_0xc647('0x1e')],'authorization':_0x20b790[_0xc647('0x1d')]};var _0x18f0fc={'method':'POST','uri':_0xc647('0x3e'),'body':_0xb2554,'json':!![]};rp(_0x18f0fc)[_0xc647('0x14')](function(_0x53b52a){var _0x432b05={'messageId':_0x53b52a[_0xc647('0x3f')]};if(!_0x20b790[_0xc647('0x3a')]){_0x432b05[_0xc647('0x40')]=!![];}return _0x7a51fe[_0xc647('0x24')](_0x432b05);})[_0xc647('0x16')](function(_0x287941){logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),'connectel',util[_0xc647('0x29')](_0x287941,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')](_0xc647('0x27'),'afterCreate',_0xc647('0x3c'),_0xc647('0x41'));}break;case'clicksend':if(_0x20b790[_0xc647('0x2d')]&&_0x20b790['password']){var _0xb2554={'messages':[{'source':_0xc647('0x42'),'to':_0x3006e2[_0xc647('0x1e')],'body':_0x3006e2[_0xc647('0x2f')],'from':_0x20b790['senderString']||_0x20b790['phone']}]};var _0x287bd2=util[_0xc647('0x43')]('%s:%s',_0x20b790[_0xc647('0x2d')],_0x20b790['password']);var _0x18f0fc={'method':_0xc647('0x36'),'uri':_0xc647('0x44'),'body':_0xb2554,'headers':{'Authorization':util[_0xc647('0x43')]('Basic\x20%s',new Buffer(_0x287bd2)[_0xc647('0x45')](_0xc647('0x46')))},'json':!![]};rp(_0x18f0fc)[_0xc647('0x14')](function(_0x2425df){if(_0x2425df['http_code']>=0xc8&&_0x2425df[_0xc647('0x47')]<=0xce){if(_0x2425df[_0xc647('0x48')]&&_0x2425df[_0xc647('0x48')][_0xc647('0x49')]>0x0){var _0x432efa=_[_0xc647('0x4a')](_0x2425df['data'][_0xc647('0x1f')]);var _0x493930={'messageId':_0x432efa[_0xc647('0x4b')]};if(!_0x20b790[_0xc647('0x3a')]){_0x493930[_0xc647('0x40')]=!![];}return _0x7a51fe[_0xc647('0x24')](_0x493930);}else{logger[_0xc647('0x26')](_0xc647('0x27'),'afterCreate','clickSend',util[_0xc647('0x29')](_0x2425df,{'showHidden':![],'depth':null}));}}else{logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),'clickSend',util[_0xc647('0x29')](_0x2425df,{'showHidden':![],'depth':null}));}})[_0xc647('0x16')](function(_0x2fb33c){logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),'clickSend',util['inspect'](_0x2fb33c,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')](_0xc647('0x27'),'afterCreate',_0xc647('0x4c'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x20b790[_0xc647('0x4d')]&&_0x20b790[_0xc647('0x1d')]){var _0xb2554={'dst':_0x3006e2[_0xc647('0x1e')],'text':_0x3006e2[_0xc647('0x2f')],'src':_0x20b790[_0xc647('0x3d')]||_0x20b790[_0xc647('0x1e')],'url':_0x20b790[_0xc647('0x4e')]+_0xc647('0x21')+_0x3006e2['id']+_0xc647('0x22')+_0x20b790[_0xc647('0x23')]};var _0x287bd2=util[_0xc647('0x43')](_0xc647('0x4f'),_0x20b790[_0xc647('0x4d')],_0x20b790[_0xc647('0x1d')]);var _0x18f0fc={'method':_0xc647('0x36'),'uri':util[_0xc647('0x43')](_0xc647('0x50'),_0x20b790[_0xc647('0x4d')]),'body':_0xb2554,'headers':{'Authorization':util[_0xc647('0x43')](_0xc647('0x51'),new Buffer(_0x287bd2)[_0xc647('0x45')]('base64'))},'json':!![]};rp(_0x18f0fc)['then'](function(_0x1c11ee){var _0xc5e5b3={'messageId':_0x1c11ee[_0xc647('0x52')][0x0]};return _0x7a51fe[_0xc647('0x24')](_0xc5e5b3);})[_0xc647('0x16')](function(_0x11f87c){logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x53'),util[_0xc647('0x29')](_0x11f87c,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x53'),_0xc647('0x54'));}break;case'infobip':if(_0x20b790[_0xc647('0x2d')]&&_0x20b790[_0xc647('0x2e')]){if(_0x20b790[_0xc647('0x55')]){var _0x54271b={'method':_0xc647('0x36'),'uri':_0x20b790[_0xc647('0x55')]+_0xc647('0x56'),'body':{'username':_0x20b790[_0xc647('0x2d')],'password':_0x20b790[_0xc647('0x2e')]},'json':!![]};return rp(_0x54271b)['then'](function(_0x58f37c){var _0x17d7fc={'method':_0xc647('0x36'),'uri':_0x20b790[_0xc647('0x55')]+_0xc647('0x57'),'body':{'messages':[{'from':_0x20b790[_0xc647('0x1e')],'destinations':[{'to':_0x3006e2[_0xc647('0x1e')]}],'text':_0x3006e2[_0xc647('0x2f')],'notifyUrl':_0x20b790[_0xc647('0x4e')]+_0xc647('0x21')+_0x3006e2['id']+'/status?token='+_0x20b790[_0xc647('0x23')],'notifyContentType':_0xc647('0x58'),'callbackData':_0x20b790[_0xc647('0x1e')]+';'+_0x3006e2[_0xc647('0x2f')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x58f37c[_0xc647('0x23')]},'json':!![]};return rp(_0x17d7fc)[_0xc647('0x14')](function(_0x561edd){if(_0x561edd[_0xc647('0x1f')]){var _0x5f0c7a={'messageId':_0x561edd[_0xc647('0x1f')][0x0]['messageId']};if(!_0x20b790[_0xc647('0x3a')]){_0x5f0c7a[_0xc647('0x40')]=!![];}return _0x7a51fe['update'](_0x5f0c7a);}else{return logger['error'](_0xc647('0x27'),_0xc647('0x28'),'infobip',util['inspect'](_0x561edd,{'showHidden':![],'depth':null}));}});})[_0xc647('0x16')](function(_0x2d551c){return logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),'infobip',util['inspect'](_0x2d551c,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),_0xc647('0x59'),_0xc647('0x5a'));}}else{logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x59'),_0xc647('0x3b'));}break;case _0xc647('0x5b'):var _0xf224e7=require(_0xc647('0x5c'));if(_0x20b790[_0xc647('0x5d')]){var _0x307679={};_0x307679[_0xc647('0x5e')]=_0x20b790['username'];_0x307679[_0xc647('0x1e')]=_0x3006e2[_0xc647('0x1e')];_0x307679[_0xc647('0x31')]=_0x20b790[_0xc647('0x1e')];_0x307679[_0xc647('0x5f')]=_0x3006e2['body'];_0x307679['timestamp']=+new Date();var _0x5a362a='';var _0x3d4f33='';var _0x3ffed6=Object[_0xc647('0x60')](_0x307679);_0x3ffed6[_0xc647('0x61')]();for(var _0x448ff1=0x0;_0x448ff1<_0x3ffed6[_0xc647('0x62')];_0x448ff1++){if(_0x5a362a!=''){_0x5a362a+='&';}_0x5a362a+=_0x3ffed6[_0x448ff1]+'='+encodeURIComponent(_0x307679[_0x3ffed6[_0x448ff1]]);_0x3d4f33+=_0x307679[_0x3ffed6[_0x448ff1]];}_0x3d4f33+=_0x20b790[_0xc647('0x5d')];_0x3d4f33=_0xf224e7['createHash'](_0xc647('0x63'))[_0xc647('0x24')](_0x3d4f33)['digest']('hex');if(_0x5a362a!==''){_0x5a362a+='&';}_0x5a362a+=_0xc647('0x64')+_0x3d4f33;var _0x4922d4={'method':_0xc647('0x33'),'uri':_0x20b790[_0xc647('0x55')]+_0xc647('0x65')+_0x5a362a,'json':!![]};return rp(_0x4922d4)[_0xc647('0x14')](function(_0x4af741){var _0x2e10a9=Object['keys'](_0x4af741);if(_0x4af741[_0x2e10a9[0x0]]['error']&&parseInt(_0x4af741[_0x2e10a9[0x0]][_0xc647('0x26')])===0x0){var _0x112fd8={'messageId':_0x4af741[_0x2e10a9[0x0]][_0xc647('0x66')]};if(!_0x20b790['deliveryReport']){_0x112fd8['read']=!![];}return _0x7a51fe['update'](_0x112fd8);}else{return logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc647('0x5b'),util[_0xc647('0x29')](_0x4af741[_0xc647('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x48c6a1){return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x5b'),util['inspect'](_0x48c6a1,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),_0xc647('0x5b'),_0xc647('0x67'));}break;case'clickatell':if(_0x20b790[_0xc647('0x5d')]){var _0x1fc23e={'method':_0xc647('0x36'),'uri':_0xc647('0x68'),'headers':{'Authorization':_0x20b790[_0xc647('0x5d')]},'body':{'content':_0x3006e2[_0xc647('0x2f')],'to':[_0x3006e2[_0xc647('0x1e')]],'from':_0x20b790[_0xc647('0x1e')],'binary':![],'clientMessageId':_0xc647('0x69'),'charset':_0xc647('0x6a')},'json':!![]};rp(_0x1fc23e)['then'](function(_0x3fe850){if(!_0x3fe850[_0xc647('0x26')]){var _0x18f3b4={'messageId':_0x3fe850[_0xc647('0x1f')][0x0]['apiMessageId']};if(!_0x20b790[_0xc647('0x3a')]){_0x18f3b4[_0xc647('0x40')]=!![];}return _0x7a51fe['update'](_0x18f3b4);}else{return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x6b'),util[_0xc647('0x29')](_0x3fe850[_0xc647('0x26')],{'showHidden':![],'depth':null}));}})[_0xc647('0x16')](function(_0x296a14){return logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),_0xc647('0x6b'),util[_0xc647('0x29')](_0x296a14,{'showHidden':![],'depth':null}));});}else{logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0xc647('0x6c'):if(_0x20b790[_0xc647('0x2d')]&&_0x20b790[_0xc647('0x2e')]){var _0x287bd2=util['format']('%s:%s',_0x20b790[_0xc647('0x2d')],_0x20b790[_0xc647('0x2e')]);var _0x18f0fc={'method':_0xc647('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x20b790[_0xc647('0x6d')]+'/messages','body':{'to':[_0x3006e2[_0xc647('0x1e')]],'text':_0x3006e2[_0xc647('0x2f')],'from':_0x20b790[_0xc647('0x1e')],'applicationId':_0x20b790[_0xc647('0x6e')]},'headers':{'Authorization':util[_0xc647('0x43')](_0xc647('0x51'),new Buffer(_0x287bd2)['toString']('base64'))},'json':!![]};rp(_0x18f0fc)[_0xc647('0x14')](function(_0x3e7574){if(_0x3e7574['id']){var _0x2609e2={'messageId':_0x3e7574['id']};return _0x7a51fe[_0xc647('0x24')](_0x2609e2);}else{logger[_0xc647('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),_0xc647('0x6c'),util['inspect'](_0x3e7574,{'showHidden':![],'depth':null}));}})[_0xc647('0x16')](function(_0x3e68ed){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc647('0x28'),'bandwidth',util[_0xc647('0x29')](_0x3e68ed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x6c'),_0xc647('0x3b'));}break;case _0xc647('0x6f'):if(_0x20b790[_0xc647('0x5d')]){var _0x4a2ede={};var _0x4922d4={'method':_0xc647('0x36'),'uri':_0xc647('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x20b790[_0xc647('0x5d')],'Content-Type':_0xc647('0x58')},'body':{'from':_0x20b790[_0xc647('0x1e')],'to':_0x3006e2[_0xc647('0x1e')],'text':_0x3006e2[_0xc647('0x2f')]},'json':!![]};return rp(_0x4922d4)[_0xc647('0x14')](function(_0x4ae6c0){if(_0x4ae6c0[_0xc647('0x71')]==0xca){_0x4a2ede[_0xc647('0x72')]=_0x4ae6c0;var _0x830f5c={'method':_0xc647('0x36'),'uri':_0xc647('0x73'),'headers':{'Authorization':_0xc647('0x74')+_0x20b790[_0xc647('0x5d')],'Content-Type':_0xc647('0x58')},'body':{'refid':_0x4a2ede[_0xc647('0x72')][_0xc647('0x75')]},'json':!![]};return rp(_0x830f5c)[_0xc647('0x14')](function(_0x3622bd){_0x4a2ede[_0xc647('0x76')]=_0x3622bd;var _0x4fafa2={'messageId':_0x4a2ede['message']['refid'],'read':!![]};return _0x7a51fe[_0xc647('0x24')](_0x4fafa2);});}else{return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),'intelepeer',util[_0xc647('0x29')](_0x4ae6c0,{'showHidden':![],'depth':null}));}})[_0xc647('0x16')](function(_0x13f97b){return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x6f'),util[_0xc647('0x29')](_0x13f97b,{'showHidden':![],'depth':null}));});}else{return logger[_0xc647('0x26')](_0xc647('0x27'),_0xc647('0x28'),_0xc647('0x6f'),'Token\x20not\x20received');}break;}}})[_0xc647('0x77')](function(){_0x1633d8();});}else{_0x1633d8();}}},'charset':_0xc647('0x78'),'collate':_0xc647('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fafcc92..9752fb7 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 _0x6860=['localhost','socket.io-emitter','redis','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6860,0xf6));var _0x0686=function(_0x10c695,_0x1cdc0c){_0x10c695=_0x10c695-0x0;var _0x290a16=_0x6860[_0x10c695];return _0x290a16;};'use strict';var _=require(_0x0686('0x0'));var util=require(_0x0686('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0686('0x2'));var fs=require('fs');var Redis=require(_0x0686('0x3'));var db=require(_0x0686('0x4'))['db'];var utils=require(_0x0686('0x5'));var logger=require(_0x0686('0x6'))('rpc');var config=require(_0x0686('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0686('0x8')]({'port':0x232a});config['redis']=_[_0x0686('0x9')](config['redis'],{'host':_0x0686('0xa'),'port':0x18eb});var socket=require(_0x0686('0xb'))(new Redis(config[_0x0686('0xc')]));require(_0x0686('0xd'))[_0x0686('0xe')](socket);function respondWithRpcPromise(_0x86635e,_0x5fcbef,_0x86bcff){return new BPromise(function(_0xb32436,_0x39eb9c){return client[_0x0686('0xf')](_0x86635e,_0x86bcff)[_0x0686('0x10')](function(_0x36943f){logger['info'](_0x0686('0x11'),_0x5fcbef,'request\x20sent');logger[_0x0686('0x12')](_0x0686('0x13'),_0x5fcbef,_0x0686('0x14'),JSON[_0x0686('0x15')](_0x36943f));if(_0x36943f[_0x0686('0x16')]){if(_0x36943f[_0x0686('0x16')][_0x0686('0x17')]===0x1f4){logger[_0x0686('0x16')](_0x0686('0x11'),_0x5fcbef,_0x36943f['error'][_0x0686('0x18')]);return _0x39eb9c(_0x36943f[_0x0686('0x16')][_0x0686('0x18')]);}logger[_0x0686('0x16')](_0x0686('0x11'),_0x5fcbef,_0x36943f[_0x0686('0x16')][_0x0686('0x18')]);return _0xb32436(_0x36943f[_0x0686('0x16')][_0x0686('0x18')]);}else{logger[_0x0686('0x19')](_0x0686('0x11'),_0x5fcbef,_0x0686('0x14'));_0xb32436(_0x36943f[_0x0686('0x1a')][_0x0686('0x18')]);}})[_0x0686('0x1b')](function(_0x39cabb){logger['error'](_0x0686('0x11'),_0x5fcbef,_0x39cabb);_0x39eb9c(_0x39cabb);});});}exports[_0x0686('0x1c')]=function(_0x26a753){var _0x3073fb=this;return new Promise(function(_0x34a703,_0x5a6cb7){return db[_0x0686('0x1d')][_0x0686('0x1e')](_0x26a753[_0x0686('0x1f')],{'raw':_0x26a753['options']?_0x26a753['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4e3b26){logger[_0x0686('0x19')]('CreateSmsMessage',_0x26a753);logger[_0x0686('0x12')](_0x0686('0x1c'),_0x26a753,JSON[_0x0686('0x15')](_0x4e3b26));_0x34a703(_0x4e3b26);})[_0x0686('0x1b')](function(_0x698710){logger[_0x0686('0x16')](_0x0686('0x1c'),_0x698710[_0x0686('0x18')],_0x26a753);_0x5a6cb7(_0x3073fb[_0x0686('0x16')](0x1f4,_0x698710[_0x0686('0x18')]));});});}; \ No newline at end of file +var _0x476b=['create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage'];(function(_0x2c1eae,_0x24a74f){var _0x1d3494=function(_0x53aeae){while(--_0x53aeae){_0x2c1eae['push'](_0x2c1eae['shift']());}};_0x1d3494(++_0x24a74f);}(_0x476b,0x183));var _0xb476=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x476b[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xb476('0x0'));var util=require(_0xb476('0x1'));var moment=require(_0xb476('0x2'));var BPromise=require(_0xb476('0x3'));var rs=require(_0xb476('0x4'));var fs=require('fs');var Redis=require(_0xb476('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb476('0x6'));var logger=require(_0xb476('0x7'))('rpc');var config=require(_0xb476('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb476('0x9')]({'port':0x232a});config['redis']=_[_0xb476('0xa')](config[_0xb476('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb476('0xc'))(new Redis(config['redis']));require(_0xb476('0xd'))[_0xb476('0xe')](socket);function respondWithRpcPromise(_0x43f487,_0x42d479,_0x2c58d4){return new BPromise(function(_0x93e7b5,_0x11215c){return client[_0xb476('0xf')](_0x43f487,_0x2c58d4)[_0xb476('0x10')](function(_0x3538d2){logger[_0xb476('0x11')]('SmsMessage,\x20%s,\x20%s',_0x42d479,_0xb476('0x12'));logger[_0xb476('0x13')](_0xb476('0x14'),_0x42d479,'request\x20sent',JSON[_0xb476('0x15')](_0x3538d2));if(_0x3538d2['error']){if(_0x3538d2[_0xb476('0x16')][_0xb476('0x17')]===0x1f4){logger[_0xb476('0x16')](_0xb476('0x18'),_0x42d479,_0x3538d2['error'][_0xb476('0x19')]);return _0x11215c(_0x3538d2['error'][_0xb476('0x19')]);}logger[_0xb476('0x16')](_0xb476('0x18'),_0x42d479,_0x3538d2[_0xb476('0x16')]['message']);return _0x93e7b5(_0x3538d2[_0xb476('0x16')][_0xb476('0x19')]);}else{logger['info'](_0xb476('0x18'),_0x42d479,_0xb476('0x12'));_0x93e7b5(_0x3538d2[_0xb476('0x1a')][_0xb476('0x19')]);}})[_0xb476('0x1b')](function(_0x39adb4){logger['error'](_0xb476('0x18'),_0x42d479,_0x39adb4);_0x11215c(_0x39adb4);});});}exports[_0xb476('0x1c')]=function(_0x13226d){var _0x512e31=this;return new Promise(function(_0x457390,_0x243d3d){return db['SmsMessage'][_0xb476('0x1d')](_0x13226d[_0xb476('0x1e')],{'raw':_0x13226d[_0xb476('0x1f')]?_0x13226d[_0xb476('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb476('0x10')](function(_0x353dbb){logger[_0xb476('0x11')]('CreateSmsMessage',_0x13226d);logger[_0xb476('0x13')]('CreateSmsMessage',_0x13226d,JSON['stringify'](_0x353dbb));_0x457390(_0x353dbb);})[_0xb476('0x1b')](function(_0x26fd6b){logger[_0xb476('0x16')](_0xb476('0x1c'),_0x26fd6b['message'],_0x13226d);_0x243d3d(_0x512e31[_0xb476('0x16')](0x1f4,_0x26fd6b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8c51cb3..ff4a859 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 _0x3379=['register','length','smsMessage:','./smsMessage.events','save','emit'];(function(_0x2c0bba,_0x5dc334){var _0x49e804=function(_0xff6fb2){while(--_0xff6fb2){_0x2c0bba['push'](_0x2c0bba['shift']());}};_0x49e804(++_0x5dc334);}(_0x3379,0x10b));var _0x9337=function(_0x5f1f85,_0x1323fe){_0x5f1f85=_0x5f1f85-0x0;var _0x59fe47=_0x3379[_0x5f1f85];return _0x59fe47;};'use strict';var SmsMessageEvents=require(_0x9337('0x0'));var events=[_0x9337('0x1'),'remove','update'];function createListener(_0x2800f9,_0x49d63f){return function(_0x54d184){_0x49d63f[_0x9337('0x2')](_0x2800f9,_0x54d184);};}function removeListener(_0x251541,_0x4a5179){return function(){SmsMessageEvents['removeListener'](_0x251541,_0x4a5179);};}exports[_0x9337('0x3')]=function(_0x35b220){for(var _0x2c66dd=0x0,_0x56cb54=events[_0x9337('0x4')];_0x2c66dd<_0x56cb54;_0x2c66dd++){var _0x302487=events[_0x2c66dd];var _0x3e6580=createListener(_0x9337('0x5')+_0x302487,_0x35b220);SmsMessageEvents['on'](_0x302487,_0x3e6580);}}; \ No newline at end of file +var _0xc939=['length','smsMessage:','./smsMessage.events','emit','removeListener','register'];(function(_0x135f97,_0x31ec06){var _0x4cb8ab=function(_0x37325f){while(--_0x37325f){_0x135f97['push'](_0x135f97['shift']());}};_0x4cb8ab(++_0x31ec06);}(_0xc939,0x1e2));var _0x9c93=function(_0x3b87f3,_0x403f97){_0x3b87f3=_0x3b87f3-0x0;var _0x38eff4=_0xc939[_0x3b87f3];return _0x38eff4;};'use strict';var SmsMessageEvents=require(_0x9c93('0x0'));var events=['save','remove','update'];function createListener(_0x1688d3,_0xb3a5ba){return function(_0x32f9b1){_0xb3a5ba[_0x9c93('0x1')](_0x1688d3,_0x32f9b1);};}function removeListener(_0xc403a2,_0x1b5fee){return function(){SmsMessageEvents[_0x9c93('0x2')](_0xc403a2,_0x1b5fee);};}exports[_0x9c93('0x3')]=function(_0x2ecd06){for(var _0x280003=0x0,_0x4ad342=events[_0x9c93('0x4')];_0x280003<_0x4ad342;_0x280003++){var _0x268c9f=events[_0x280003];var _0x578882=createListener(_0x9c93('0x5')+_0x268c9f,_0x2ecd06);SmsMessageEvents['on'](_0x268c9f,_0x578882);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c5b9f3f..9a56475 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 _0x4da3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x19d4ad,_0x2a7c03){var _0x11c5bc=function(_0x43a6df){while(--_0x43a6df){_0x19d4ad['push'](_0x19d4ad['shift']());}};_0x11c5bc(++_0x2a7c03);}(_0x4da3,0xa8));var _0x34da=function(_0x4f8bc5,_0x13b0de){_0x4f8bc5=_0x4f8bc5-0x0;var _0x12a750=_0x4da3[_0x4f8bc5];return _0x12a750;};'use strict';var multer=require(_0x34da('0x0'));var util=require(_0x34da('0x1'));var path=require(_0x34da('0x2'));var timeout=require(_0x34da('0x3'));var express=require('express');var router=express[_0x34da('0x4')]();var fs_extra=require(_0x34da('0x5'));var auth=require(_0x34da('0x6'));var interaction=require(_0x34da('0x7'));var config=require(_0x34da('0x8'));var controller=require('./smsQueue.controller');router[_0x34da('0x9')]('/',auth[_0x34da('0xa')](),controller['index']);router[_0x34da('0x9')](_0x34da('0xb'),auth[_0x34da('0xa')](),controller[_0x34da('0xc')]);router[_0x34da('0x9')](_0x34da('0xd'),auth[_0x34da('0xa')](),controller['show']);router['get'](_0x34da('0xe'),auth[_0x34da('0xa')](),controller[_0x34da('0xf')]);router[_0x34da('0x9')](_0x34da('0x10'),auth[_0x34da('0xa')](),controller['getTeams']);router[_0x34da('0x9')]('/:id/users',auth[_0x34da('0xa')](),controller[_0x34da('0x11')]);router[_0x34da('0x12')]('/',auth['isAuthenticated'](),controller[_0x34da('0x13')]);router[_0x34da('0x12')](_0x34da('0x10'),auth[_0x34da('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0x34da('0xa')](),controller[_0x34da('0x14')]);router[_0x34da('0x15')](_0x34da('0xd'),auth[_0x34da('0xa')](),controller['update']);router[_0x34da('0x16')](_0x34da('0xd'),auth[_0x34da('0xa')](),controller[_0x34da('0x17')]);router['delete'](_0x34da('0x10'),auth[_0x34da('0xa')](),controller[_0x34da('0x18')]);router[_0x34da('0x16')]('/:id/users',auth[_0x34da('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x0f15=['/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers'];(function(_0x59b602,_0x350b2b){var _0x499c51=function(_0x48cb77){while(--_0x48cb77){_0x59b602['push'](_0x59b602['shift']());}};_0x499c51(++_0x350b2b);}(_0x0f15,0x1f1));var _0x50f1=function(_0x56857c,_0x4868cb){_0x56857c=_0x56857c-0x0;var _0x4027e7=_0x0f15[_0x56857c];return _0x4027e7;};'use strict';var multer=require(_0x50f1('0x0'));var util=require(_0x50f1('0x1'));var path=require(_0x50f1('0x2'));var timeout=require(_0x50f1('0x3'));var express=require(_0x50f1('0x4'));var router=express['Router']();var fs_extra=require(_0x50f1('0x5'));var auth=require(_0x50f1('0x6'));var interaction=require(_0x50f1('0x7'));var config=require(_0x50f1('0x8'));var controller=require(_0x50f1('0x9'));router[_0x50f1('0xa')]('/',auth[_0x50f1('0xb')](),controller[_0x50f1('0xc')]);router[_0x50f1('0xa')](_0x50f1('0xd'),auth[_0x50f1('0xb')](),controller[_0x50f1('0xe')]);router[_0x50f1('0xa')]('/:id',auth[_0x50f1('0xb')](),controller['show']);router['get']('/:id/members',auth[_0x50f1('0xb')](),controller[_0x50f1('0xf')]);router['get'](_0x50f1('0x10'),auth[_0x50f1('0xb')](),controller[_0x50f1('0x11')]);router[_0x50f1('0xa')]('/:id/users',auth[_0x50f1('0xb')](),controller[_0x50f1('0x12')]);router[_0x50f1('0x13')]('/',auth[_0x50f1('0xb')](),controller['create']);router['post'](_0x50f1('0x10'),auth[_0x50f1('0xb')](),controller['addTeams']);router[_0x50f1('0x13')](_0x50f1('0x14'),auth[_0x50f1('0xb')](),controller[_0x50f1('0x15')]);router[_0x50f1('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x50f1('0x17')]);router[_0x50f1('0x18')]('/:id',auth[_0x50f1('0xb')](),controller[_0x50f1('0x19')]);router[_0x50f1('0x18')](_0x50f1('0x10'),auth[_0x50f1('0xb')](),controller['removeTeams']);router[_0x50f1('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x50f1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 85f6352..b453453 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 _0xde14=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x4db1a6,_0x255276){var _0x2796a8=function(_0x39d010){while(--_0x39d010){_0x4db1a6['push'](_0x4db1a6['shift']());}};_0x2796a8(++_0x255276);}(_0xde14,0xc0));var _0x4de1=function(_0x1d334e,_0x2567ad){_0x1d334e=_0x1d334e-0x0;var _0x261783=_0xde14[_0x1d334e];return _0x261783;};'use strict';var Sequelize=require('sequelize');module[_0x4de1('0x0')]={'name':{'type':Sequelize[_0x4de1('0x1')],'unique':_0x4de1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4de1('0x1')]},'timeout':{'type':Sequelize[_0x4de1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4de1('0x4')](_0x4de1('0x5'),_0x4de1('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x5fc2=['beepall','roundrobin','STRING','name','INTEGER','rrmemory'];(function(_0x175af9,_0x3511d1){var _0x50521b=function(_0x2b3f82){while(--_0x2b3f82){_0x175af9['push'](_0x175af9['shift']());}};_0x50521b(++_0x3511d1);}(_0x5fc2,0x14c));var _0x25fc=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0x5fc2[_0x3f288d];return _0x5e8468;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x25fc('0x0')],'unique':_0x25fc('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x25fc('0x0')]},'timeout':{'type':Sequelize[_0x25fc('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x25fc('0x3'),_0x25fc('0x4'),_0x25fc('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8857af0..8d3bddc 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 _0xd1f8=['../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','SmsQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsQueue','includeAll','include','findAll','rows','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x289227,_0x17e9c9){var _0x415bbd=function(_0x4c02ec){while(--_0x4c02ec){_0x289227['push'](_0x289227['shift']());}};_0x415bbd(++_0x17e9c9);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xd1f8[_0x3b16e1];return _0x311d1b;};'use strict';var emlformat=require(_0x8d1f('0x0'));var rimraf=require(_0x8d1f('0x1'));var zipdir=require(_0x8d1f('0x2'));var jsonpatch=require(_0x8d1f('0x3'));var rp=require('request-promise');var moment=require(_0x8d1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d1f('0x5'));var util=require('util');var path=require(_0x8d1f('0x6'));var sox=require('sox');var csv=require(_0x8d1f('0x7'));var ejs=require(_0x8d1f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d1f('0x9'));var squel=require(_0x8d1f('0xa'));var crypto=require(_0x8d1f('0xb'));var jsforce=require(_0x8d1f('0xc'));var deskjs=require(_0x8d1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d1f('0xe'));var Papa=require(_0x8d1f('0xf'));var Redis=require('ioredis');var authService=require(_0x8d1f('0x10'));var qs=require(_0x8d1f('0x11'));var as=require(_0x8d1f('0x12'));var hardwareService=require(_0x8d1f('0x13'));var logger=require(_0x8d1f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8d1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d1f('0x16'))['db'];config[_0x8d1f('0x17')]=_['defaults'](config[_0x8d1f('0x17')],{'host':_0x8d1f('0x18'),'port':0x18eb});var socket=require(_0x8d1f('0x19'))(new Redis(config['redis']));require(_0x8d1f('0x1a'))[_0x8d1f('0x1b')](socket);function respondWithStatusCode(_0x443511,_0x2657f2){_0x2657f2=_0x2657f2||0xcc;return function(_0x63f46a){if(_0x63f46a){return _0x443511[_0x8d1f('0x1c')](_0x2657f2);}return _0x443511[_0x8d1f('0x1d')](_0x2657f2)[_0x8d1f('0x1e')]();};}function respondWithResult(_0x2463c9,_0x2422d0){_0x2422d0=_0x2422d0||0xc8;return function(_0x19dabf){if(_0x19dabf){return _0x2463c9[_0x8d1f('0x1d')](_0x2422d0)[_0x8d1f('0x1f')](_0x19dabf);}};}function respondWithFilteredResult(_0x2036ee,_0x3b33c9){return function(_0xb5c2e5){if(_0xb5c2e5){var _0x3fc761=typeof _0x3b33c9['offset']==='undefined'&&typeof _0x3b33c9[_0x8d1f('0x20')]===_0x8d1f('0x21');var _0x1cb538=_0xb5c2e5[_0x8d1f('0x22')];var _0x224b46=_0x3fc761?0x0:_0x3b33c9[_0x8d1f('0x23')];var _0x59bd2f=_0x3fc761?_0xb5c2e5[_0x8d1f('0x22')]:_0x3b33c9[_0x8d1f('0x23')]+_0x3b33c9[_0x8d1f('0x20')];var _0x9ce15f;if(_0x59bd2f>=_0x1cb538){_0x59bd2f=_0x1cb538;_0x9ce15f=0xc8;}else{_0x9ce15f=0xce;}_0x2036ee['status'](_0x9ce15f);return _0x2036ee['set'](_0x8d1f('0x24'),_0x224b46+'-'+_0x59bd2f+'/'+_0x1cb538)[_0x8d1f('0x1f')](_0xb5c2e5);}return null;};}function patchUpdates(_0x5175a5){return function(_0xc7f18e){try{jsonpatch['apply'](_0xc7f18e,_0x5175a5,!![]);}catch(_0x285e7f){return BPromise[_0x8d1f('0x25')](_0x285e7f);}return _0xc7f18e[_0x8d1f('0x26')]();};}function saveUpdates(_0x2279b9,_0x396636){return function(_0x41f46c){if(_0x41f46c){return _0x41f46c[_0x8d1f('0x27')](_0x2279b9)[_0x8d1f('0x28')](function(_0x296d0c){return _0x296d0c;});}return null;};}function removeEntity(_0x4ba072,_0x24c04a){return function(_0x213321){if(_0x213321){return _0x213321['destroy']()[_0x8d1f('0x28')](function(){var _0x860eda=_0x213321['get']({'plain':!![]});var _0x1425a3=_0x8d1f('0x29');return db[_0x8d1f('0x2a')]['destroy']({'where':{'type':_0x1425a3,'resourceId':_0x860eda['id']}})[_0x8d1f('0x28')](function(){return _0x213321;});})[_0x8d1f('0x28')](function(){_0x4ba072[_0x8d1f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c15de,_0x564920){return function(_0x4c60bb){if(!_0x4c60bb){_0x3c15de[_0x8d1f('0x1c')](0x194);}return _0x4c60bb;};}function handleError(_0x40a58c,_0xf92fd0){_0xf92fd0=_0xf92fd0||0x1f4;return function(_0x10829d){logger[_0x8d1f('0x2b')](_0x10829d[_0x8d1f('0x2c')]);if(_0x10829d[_0x8d1f('0x2d')]){delete _0x10829d[_0x8d1f('0x2d')];}_0x40a58c['status'](_0xf92fd0)[_0x8d1f('0x2e')](_0x10829d);};}exports[_0x8d1f('0x2f')]=function(_0x2f6003,_0x381547){var _0x1b8af6={},_0x3b0d09={},_0x5023f7={'count':0x0,'rows':[]};var _0x340e44=_[_0x8d1f('0x30')](db['SmsQueue'][_0x8d1f('0x31')],function(_0x444227){return{'name':_0x444227['fieldName'],'type':_0x444227['type']['key']};});_0x3b0d09[_0x8d1f('0x32')]=_[_0x8d1f('0x30')](_0x340e44,_0x8d1f('0x2d'));_0x3b0d09[_0x8d1f('0x33')]=_[_0x8d1f('0x34')](_0x2f6003[_0x8d1f('0x33')]);_0x3b0d09[_0x8d1f('0x35')]=_[_0x8d1f('0x36')](_0x3b0d09['model'],_0x3b0d09['query']);_0x1b8af6['attributes']=_[_0x8d1f('0x36')](_0x3b0d09[_0x8d1f('0x32')],qs[_0x8d1f('0x37')](_0x2f6003[_0x8d1f('0x33')][_0x8d1f('0x37')]));_0x1b8af6[_0x8d1f('0x38')]=_0x1b8af6['attributes'][_0x8d1f('0x39')]?_0x1b8af6['attributes']:_0x3b0d09[_0x8d1f('0x32')];if(!_0x2f6003[_0x8d1f('0x33')]['hasOwnProperty']('nolimit')){_0x1b8af6[_0x8d1f('0x20')]=qs[_0x8d1f('0x20')](_0x2f6003[_0x8d1f('0x33')][_0x8d1f('0x20')]);_0x1b8af6[_0x8d1f('0x23')]=qs[_0x8d1f('0x23')](_0x2f6003['query'][_0x8d1f('0x23')]);}_0x1b8af6[_0x8d1f('0x3a')]=qs[_0x8d1f('0x3b')](_0x2f6003[_0x8d1f('0x33')][_0x8d1f('0x3b')]);_0x1b8af6[_0x8d1f('0x3c')]=qs[_0x8d1f('0x35')](_[_0x8d1f('0x3d')](_0x2f6003[_0x8d1f('0x33')],_0x3b0d09[_0x8d1f('0x35')]),_0x340e44);if(_0x2f6003[_0x8d1f('0x33')]['filter']){_0x1b8af6[_0x8d1f('0x3c')]=_[_0x8d1f('0x3e')](_0x1b8af6[_0x8d1f('0x3c')],{'$or':_['map'](_0x340e44,function(_0x52a3e5){if(_0x52a3e5['type']!==_0x8d1f('0x3f')){var _0x1a83b2={};_0x1a83b2[_0x52a3e5['name']]={'$like':'%'+_0x2f6003[_0x8d1f('0x33')][_0x8d1f('0x40')]+'%'};return _0x1a83b2;}})});}_0x1b8af6=_[_0x8d1f('0x3e')]({},_0x1b8af6,_0x2f6003[_0x8d1f('0x41')]);var _0x2ab0b5={'where':_0x1b8af6[_0x8d1f('0x3c')]};return db[_0x8d1f('0x42')][_0x8d1f('0x22')](_0x2ab0b5)[_0x8d1f('0x28')](function(_0x2d891e){_0x5023f7[_0x8d1f('0x22')]=_0x2d891e;if(_0x2f6003['query'][_0x8d1f('0x43')]){_0x1b8af6[_0x8d1f('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0x8d1f('0x45')](_0x1b8af6);})[_0x8d1f('0x28')](function(_0x134cf7){_0x5023f7[_0x8d1f('0x46')]=_0x134cf7;return _0x5023f7;})['then'](respondWithFilteredResult(_0x381547,_0x1b8af6))['catch'](handleError(_0x381547,null));};exports['show']=function(_0x51d714,_0x15fd79){var _0x42eee4={'raw':!![],'where':{'id':_0x51d714[_0x8d1f('0x47')]['id']}},_0x581805={};_0x581805['model']=_['keys'](db['SmsQueue'][_0x8d1f('0x31')]);_0x581805[_0x8d1f('0x33')]=_[_0x8d1f('0x34')](_0x51d714[_0x8d1f('0x33')]);_0x581805['filters']=_[_0x8d1f('0x36')](_0x581805['model'],_0x581805['query']);_0x42eee4[_0x8d1f('0x38')]=_[_0x8d1f('0x36')](_0x581805[_0x8d1f('0x32')],qs[_0x8d1f('0x37')](_0x51d714[_0x8d1f('0x33')][_0x8d1f('0x37')]));_0x42eee4[_0x8d1f('0x38')]=_0x42eee4[_0x8d1f('0x38')][_0x8d1f('0x39')]?_0x42eee4['attributes']:_0x581805[_0x8d1f('0x32')];if(_0x51d714[_0x8d1f('0x33')][_0x8d1f('0x43')]){_0x42eee4[_0x8d1f('0x44')]=[{'all':!![]}];}_0x42eee4=_[_0x8d1f('0x3e')]({},_0x42eee4,_0x51d714[_0x8d1f('0x41')]);return db[_0x8d1f('0x42')][_0x8d1f('0x48')](_0x42eee4)[_0x8d1f('0x28')](handleEntityNotFound(_0x15fd79,null))[_0x8d1f('0x28')](respondWithResult(_0x15fd79,null))[_0x8d1f('0x49')](handleError(_0x15fd79,null));};exports[_0x8d1f('0x4a')]=function(_0x4027d6,_0x28114d){return db[_0x8d1f('0x42')][_0x8d1f('0x4a')](_0x4027d6['body'],{})[_0x8d1f('0x28')](function(_0xe7e4e3){var _0x200685=_0x4027d6[_0x8d1f('0x4b')][_0x8d1f('0x4c')]({'plain':!![]});if(!_0x200685)throw new Error(_0x8d1f('0x4d'));if(_0x200685[_0x8d1f('0x4e')]===_0x8d1f('0x4b')){var _0x7603e0=_0xe7e4e3[_0x8d1f('0x4c')]({'plain':!![]});var _0x28a141=_0x8d1f('0x29');return db[_0x8d1f('0x4f')]['find']({'where':{'name':_0x28a141,'userProfileId':_0x200685[_0x8d1f('0x50')]},'raw':!![]})[_0x8d1f('0x28')](function(_0x2bc876){if(_0x2bc876&&_0x2bc876[_0x8d1f('0x51')]===0x0){return db[_0x8d1f('0x2a')]['create']({'name':_0x7603e0[_0x8d1f('0x2d')],'resourceId':_0x7603e0['id'],'type':_0x2bc876[_0x8d1f('0x2d')],'sectionId':_0x2bc876['id']},{})[_0x8d1f('0x28')](function(){return _0xe7e4e3;});}else{return _0xe7e4e3;}})[_0x8d1f('0x49')](function(_0x5d1e71){logger[_0x8d1f('0x2b')](_0x8d1f('0x52'),_0x5d1e71);throw _0x5d1e71;});}return _0xe7e4e3;})[_0x8d1f('0x28')](respondWithResult(_0x28114d,0xc9))['catch'](handleError(_0x28114d,null));};exports['update']=function(_0x205bc8,_0x829e32){if(_0x205bc8[_0x8d1f('0x53')]['id']){delete _0x205bc8[_0x8d1f('0x53')]['id'];}return db[_0x8d1f('0x42')]['find']({'where':{'id':_0x205bc8[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x829e32,null))['then'](saveUpdates(_0x205bc8[_0x8d1f('0x53')],null))[_0x8d1f('0x28')](respondWithResult(_0x829e32,null))[_0x8d1f('0x49')](handleError(_0x829e32,null));};exports[_0x8d1f('0x54')]=function(_0x23b2a9,_0x50b3ce){return db[_0x8d1f('0x42')][_0x8d1f('0x48')]({'where':{'id':_0x23b2a9[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x50b3ce,null))[_0x8d1f('0x28')](removeEntity(_0x50b3ce,null))[_0x8d1f('0x49')](handleError(_0x50b3ce,null));};exports[_0x8d1f('0x55')]=function(_0x673b2,_0x490b34){return db[_0x8d1f('0x42')][_0x8d1f('0x55')]()[_0x8d1f('0x28')](respondWithResult(_0x490b34,null))[_0x8d1f('0x49')](handleError(_0x490b34,null));};exports[_0x8d1f('0x56')]=function(_0x313f25,_0x519586,_0x4a54c4){var _0x16c1ae={'raw':!![],'where':{}},_0x470407={},_0x411841;return db[_0x8d1f('0x42')][_0x8d1f('0x57')]({'where':{'id':_0x313f25[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x519586,null))[_0x8d1f('0x28')](function(_0x467beb){if(_0x467beb){_0x411841=_0x467beb[_0x8d1f('0x4c')]({'plain':!![]});_0x470407['model']=_[_0x8d1f('0x34')](db[_0x8d1f('0x58')][_0x8d1f('0x31')]);_0x470407['query']=_[_0x8d1f('0x34')](_0x313f25[_0x8d1f('0x33')]);_0x470407[_0x8d1f('0x35')]=_[_0x8d1f('0x36')](_0x470407[_0x8d1f('0x32')],_0x470407['query']);_0x16c1ae[_0x8d1f('0x38')]=_[_0x8d1f('0x36')](_0x470407[_0x8d1f('0x32')],qs[_0x8d1f('0x37')](_0x313f25[_0x8d1f('0x33')][_0x8d1f('0x37')]));_0x16c1ae[_0x8d1f('0x38')]=_0x16c1ae['attributes'][_0x8d1f('0x39')]?_0x16c1ae['attributes']:_0x470407[_0x8d1f('0x32')];if(!_0x313f25['query'][_0x8d1f('0x59')]('nolimit')){_0x16c1ae[_0x8d1f('0x20')]=qs[_0x8d1f('0x20')](_0x313f25['query'][_0x8d1f('0x20')]);_0x16c1ae[_0x8d1f('0x23')]=qs[_0x8d1f('0x23')](_0x313f25[_0x8d1f('0x33')][_0x8d1f('0x23')]);}_0x16c1ae[_0x8d1f('0x3a')]=qs[_0x8d1f('0x3b')](_0x313f25[_0x8d1f('0x33')][_0x8d1f('0x3b')]);_0x16c1ae[_0x8d1f('0x3c')]=qs[_0x8d1f('0x35')](_[_0x8d1f('0x3d')](_0x313f25[_0x8d1f('0x33')],_0x470407[_0x8d1f('0x35')]));_0x16c1ae[_0x8d1f('0x3c')][_0x8d1f('0x5a')]=_0x467beb['id'];if(_0x313f25[_0x8d1f('0x33')]['filter']){_0x16c1ae[_0x8d1f('0x3c')]=_['merge'](_0x16c1ae[_0x8d1f('0x3c')],{'$or':_[_0x8d1f('0x30')](_0x16c1ae[_0x8d1f('0x38')],function(_0x456a66){var _0x1091b7={};_0x1091b7[_0x456a66]={'$like':'%'+_0x313f25[_0x8d1f('0x33')]['filter']+'%'};return _0x1091b7;})});}_0x16c1ae=_[_0x8d1f('0x3e')]({},_0x16c1ae,_0x313f25['options']);return db[_0x8d1f('0x58')][_0x8d1f('0x45')](_0x16c1ae);}})[_0x8d1f('0x28')](function(_0x34404a){if(_0x34404a){return db[_0x8d1f('0x5b')][_0x8d1f('0x5c')]({'where':{'id':_['map'](_0x34404a,_0x8d1f('0x5d')),'role':_0x8d1f('0x5e')},'attributes':['id',_0x8d1f('0x2d'),'smsPause',_0x8d1f('0x5f'),_0x8d1f('0x60')]});}})['then'](function(_0x398ab5){if(_0x398ab5){return{'count':_0x398ab5[_0x8d1f('0x22')],'rows':_[_0x8d1f('0x30')](_0x398ab5['rows'],function(_0x31c658){return{'membername':_0x31c658[_0x8d1f('0x2d')],'UserId':_0x31c658['id'],'queue_name':_0x411841['name'],'SmsQueueId':_0x411841['id'],'interface':util[_0x8d1f('0x61')](_0x8d1f('0x62'),_0x8d1f('0x63'),_0x31c658[_0x8d1f('0x2d')]),'penalty':0x0,'paused':_0x31c658[_0x8d1f('0x64')],'createdAt':_0x31c658[_0x8d1f('0x60')],'updatedAt':_0x31c658['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x519586,_0x16c1ae))[_0x8d1f('0x49')](handleError(_0x519586,null));};exports[_0x8d1f('0x65')]=function(_0x39dae9,_0x516dd9,_0x2cedde){var _0x30de4c={};var _0x27f919={};var _0x352cce;var _0x2a46b2;return db[_0x8d1f('0x42')][_0x8d1f('0x57')]({'where':{'id':_0x39dae9[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x516dd9,null))[_0x8d1f('0x28')](function(_0x5cdf92){if(_0x5cdf92){_0x352cce=_0x5cdf92;_0x27f919['model']=_[_0x8d1f('0x34')](db[_0x8d1f('0x66')][_0x8d1f('0x31')]);_0x27f919[_0x8d1f('0x33')]=_[_0x8d1f('0x34')](_0x39dae9['query']);_0x27f919[_0x8d1f('0x35')]=_[_0x8d1f('0x36')](_0x27f919['model'],_0x27f919['query']);_0x30de4c['attributes']=_[_0x8d1f('0x36')](_0x27f919[_0x8d1f('0x32')],qs['fields'](_0x39dae9[_0x8d1f('0x33')][_0x8d1f('0x37')]));_0x30de4c[_0x8d1f('0x38')]=_0x30de4c[_0x8d1f('0x38')][_0x8d1f('0x39')]?_0x30de4c[_0x8d1f('0x38')]:_0x27f919[_0x8d1f('0x32')];_0x30de4c['order']=qs[_0x8d1f('0x3b')](_0x39dae9[_0x8d1f('0x33')][_0x8d1f('0x3b')]);_0x30de4c[_0x8d1f('0x3c')]=qs[_0x8d1f('0x35')](_[_0x8d1f('0x3d')](_0x39dae9[_0x8d1f('0x33')],_0x27f919['filters']));if(_0x39dae9[_0x8d1f('0x33')][_0x8d1f('0x40')]){_0x30de4c['where']=_[_0x8d1f('0x3e')](_0x30de4c[_0x8d1f('0x3c')],{'$or':_[_0x8d1f('0x30')](_0x30de4c['attributes'],function(_0x104f15){var _0x513102={};_0x513102[_0x104f15]={'$like':'%'+_0x39dae9[_0x8d1f('0x33')]['filter']+'%'};return _0x513102;})});}_0x30de4c=_[_0x8d1f('0x3e')]({},_0x30de4c,_0x39dae9[_0x8d1f('0x41')]);return _0x352cce[_0x8d1f('0x65')](_0x30de4c);}})[_0x8d1f('0x28')](function(_0x40aba3){if(_0x40aba3){_0x2a46b2=_0x40aba3[_0x8d1f('0x39')];if(!_0x39dae9['query'][_0x8d1f('0x59')](_0x8d1f('0x67'))){_0x30de4c['limit']=qs[_0x8d1f('0x20')](_0x39dae9[_0x8d1f('0x33')]['limit']);_0x30de4c['offset']=qs[_0x8d1f('0x23')](_0x39dae9['query'][_0x8d1f('0x23')]);}return _0x352cce[_0x8d1f('0x65')](_0x30de4c);}})[_0x8d1f('0x28')](function(_0x14d022){if(_0x14d022){return _0x14d022?{'count':_0x2a46b2,'rows':_0x14d022}:null;}})[_0x8d1f('0x28')](respondWithResult(_0x516dd9,null))[_0x8d1f('0x49')](handleError(_0x516dd9,null));};exports[_0x8d1f('0x68')]=function(_0x4755c4,_0x4b3f5e,_0x4e9691){var _0x31b7ae=_0x4755c4[_0x8d1f('0x53')]['ids'];return db['Team'][_0x8d1f('0x45')]({'where':{'id':_0x31b7ae},'attributes':['id'],'include':[{'model':db[_0x8d1f('0x5b')],'as':_0x8d1f('0x69'),'attributes':['id',_0x8d1f('0x2d'),_0x8d1f('0x6a'),_0x8d1f('0x6b'),_0x8d1f('0x6c')],'raw':!![]}]})[_0x8d1f('0x28')](function(_0x24b0d2){if(_0x24b0d2){var _0x49a8b3=_['flatMap'](_0x24b0d2,function(_0x50e0b8){var _0x523baa=_0x50e0b8[_0x8d1f('0x4c')]({'plain':!![]});return _0x523baa[_0x8d1f('0x69')];});return db[_0x8d1f('0x42')]['find']({'where':{'id':_0x4755c4[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](function(_0x33d717){return db[_0x8d1f('0x6d')]['transaction'](function(_0x11f42f){return _0x33d717[_0x8d1f('0x68')](_0x31b7ae,{'transaction':_0x11f42f})['then'](function(){return BPromise[_0x8d1f('0x6e')](_0x49a8b3,function(_0x11a01b){return db[_0x8d1f('0x58')]['findOrCreate']({'where':{'UserId':_0x11a01b['id'],'SmsQueueId':_0x4755c4[_0x8d1f('0x47')]['id']},'transaction':_0x11f42f});});})[_0x8d1f('0x28')](function(){_0x49a8b3[_0x8d1f('0x6f')](function(_0x304d81){socket['emit'](_0x8d1f('0x70'),{'UserId':_0x304d81['id'],'SmsQueueId':_0x33d717['id']});});});});});}})[_0x8d1f('0x28')](respondWithStatusCode(_0x4b3f5e,null))[_0x8d1f('0x49')](handleError(_0x4b3f5e,null));};exports[_0x8d1f('0x71')]=function(_0x21347f,_0x58f7d7,_0x1f31ab){return db[_0x8d1f('0x66')][_0x8d1f('0x45')]({'where':{'id':_0x21347f[_0x8d1f('0x33')][_0x8d1f('0x72')]},'attributes':['id'],'include':[{'model':db[_0x8d1f('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58f7d7,null))[_0x8d1f('0x28')](function(_0x2dbaba){var _0x259d10=_['map'](_0x2dbaba,'id');var _0x3173b9=[];var _0x4e30e2=[];var _0x273ae3=squel[_0x8d1f('0x73')]();_0x273ae3[_0x8d1f('0x74')](_0x8d1f('0x75'))['from'](_0x8d1f('0x76'),'tq')[_0x8d1f('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8d1f('0x3c')](_0x8d1f('0x78'),_0x21347f[_0x8d1f('0x47')]['id']);for(var _0x4ce2c6=0x0;_0x4ce2c6<_0x2dbaba[_0x8d1f('0x39')];_0x4ce2c6+=0x1){let _0x46e8f1=_0x2dbaba[_0x4ce2c6];for(var _0x22ae46=0x0;_0x22ae46<_0x46e8f1[_0x8d1f('0x69')][_0x8d1f('0x39')];_0x22ae46+=0x1){let _0x3c2a55=_0x46e8f1[_0x8d1f('0x69')][_0x22ae46];var _0xa5ff87=_0x273ae3[_0x8d1f('0x79')]();_0xa5ff87[_0x8d1f('0x3c')]('ut.UserId\x20=\x20?',_0x3c2a55['id']);_0x4e30e2['push'](db[_0x8d1f('0x6d')]['query'](_0xa5ff87[_0x8d1f('0x7a')](),{'type':db['sequelize'][_0x8d1f('0x7b')][_0x8d1f('0x7c')]})[_0x8d1f('0x28')](function(_0x1f9af9){if(_0x1f9af9[_0x8d1f('0x39')]===0x1){return _0x3c2a55['id'];}else{var _0xe457ac=_[_0x8d1f('0x7d')](_[_0x8d1f('0x30')](_0x1f9af9,_0x8d1f('0x7e')),function(_0x55e81e){return _[_0x8d1f('0x7f')](_0x259d10,_0x55e81e);});if(_0xe457ac){return _0x3c2a55['id'];}}}));}}return BPromise[_0x8d1f('0x80')](_0x4e30e2)[_0x8d1f('0x28')](function(_0x5640cf){_0x3173b9=_(_0x3173b9)[_0x8d1f('0x81')](_0x5640cf)['compact']()[_0x8d1f('0x82')]();return db[_0x8d1f('0x42')][_0x8d1f('0x48')]({'where':{'id':_0x21347f[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](function(_0x2e2a94){return db[_0x8d1f('0x6d')][_0x8d1f('0x83')](function(_0xde0da2){return _0x2e2a94['removeTeams'](_0x21347f[_0x8d1f('0x33')][_0x8d1f('0x72')],{'transaction':_0xde0da2})['then'](function(){if(!_[_0x8d1f('0x84')](_0x3173b9)){return _0x2e2a94['removeAgents'](_0x3173b9,{'transaction':_0xde0da2});}})['then'](function(){_0x3173b9[_0x8d1f('0x6f')](function(_0xc0171){socket[_0x8d1f('0x85')](_0x8d1f('0x86'),{'UserId':_0xc0171,'SmsQueueId':_0x2e2a94['id']});});});});});});})[_0x8d1f('0x28')](respondWithStatusCode(_0x58f7d7,null))[_0x8d1f('0x49')](handleError(_0x58f7d7,null));};exports[_0x8d1f('0x87')]=function(_0x3536b7,_0x2361d5,_0x428ea7){return db[_0x8d1f('0x42')][_0x8d1f('0x48')]({'where':{'id':_0x3536b7['params']['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x2361d5,null))[_0x8d1f('0x28')](function(_0x2cca9f){if(_0x2cca9f){return _0x2cca9f[_0x8d1f('0x87')](_0x3536b7['body'][_0x8d1f('0x72')],_[_0x8d1f('0x88')](_0x3536b7[_0x8d1f('0x53')],[_0x8d1f('0x72'),'id'])||{})['spread'](function(_0x543d44){for(var _0x55b7e7=0x0;_0x55b7e7<_0x3536b7[_0x8d1f('0x53')][_0x8d1f('0x72')][_0x8d1f('0x39')];_0x55b7e7+=0x1){socket['emit'](_0x8d1f('0x70'),{'UserId':Number(_0x3536b7['body']['ids'][_0x55b7e7]),'SmsQueueId':Number(_0x3536b7[_0x8d1f('0x47')]['id'])});}return _0x543d44;});}})['then'](respondWithResult(_0x2361d5,null))[_0x8d1f('0x49')](handleError(_0x2361d5,null));};exports[_0x8d1f('0x89')]=function(_0x5359e0,_0x160a3d,_0x331fdc){return db['SmsQueue']['find']({'where':{'id':_0x5359e0[_0x8d1f('0x47')]['id']}})[_0x8d1f('0x28')](handleEntityNotFound(_0x160a3d,null))[_0x8d1f('0x28')](function(_0x25ebbf){if(_0x25ebbf){return _0x25ebbf[_0x8d1f('0x89')](_0x5359e0[_0x8d1f('0x33')][_0x8d1f('0x72')])['then'](function(){if(_['isArray'](_0x5359e0[_0x8d1f('0x33')][_0x8d1f('0x72')])){for(var _0x213c35=0x0;_0x213c35<_0x5359e0[_0x8d1f('0x33')][_0x8d1f('0x72')][_0x8d1f('0x39')];_0x213c35+=0x1){socket['emit'](_0x8d1f('0x86'),{'UserId':Number(_0x5359e0['query'][_0x8d1f('0x72')][_0x213c35]),'SmsQueueId':Number(_0x5359e0['params']['id'])});}}else{socket[_0x8d1f('0x85')](_0x8d1f('0x86'),{'UserId':Number(_0x5359e0[_0x8d1f('0x33')][_0x8d1f('0x72')]),'SmsQueueId':Number(_0x5359e0['params']['id'])});}});}})[_0x8d1f('0x28')](respondWithStatusCode(_0x160a3d,null))[_0x8d1f('0x49')](handleError(_0x160a3d,null));};exports[_0x8d1f('0x8a')]=function(_0x4c9c10,_0x4196dc,_0x49ebdd){var _0x4eb591={};var _0x39ddd0={};var _0x4a57e1;var _0x7dc603;return db[_0x8d1f('0x42')][_0x8d1f('0x57')]({'where':{'id':_0x4c9c10[_0x8d1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4196dc,null))['then'](function(_0x2d8fd5){if(_0x2d8fd5){_0x4a57e1=_0x2d8fd5;_0x39ddd0[_0x8d1f('0x32')]=_[_0x8d1f('0x34')](db[_0x8d1f('0x5b')][_0x8d1f('0x31')]);_0x39ddd0[_0x8d1f('0x33')]=_[_0x8d1f('0x34')](_0x4c9c10[_0x8d1f('0x33')]);_0x39ddd0[_0x8d1f('0x35')]=_[_0x8d1f('0x36')](_0x39ddd0[_0x8d1f('0x32')],_0x39ddd0[_0x8d1f('0x33')]);_0x4eb591[_0x8d1f('0x38')]=_[_0x8d1f('0x36')](_0x39ddd0['model'],qs[_0x8d1f('0x37')](_0x4c9c10[_0x8d1f('0x33')][_0x8d1f('0x37')]));_0x4eb591['attributes']=_0x4eb591[_0x8d1f('0x38')][_0x8d1f('0x39')]?_0x4eb591[_0x8d1f('0x38')]:_0x39ddd0['model'];_0x4eb591[_0x8d1f('0x3a')]=qs[_0x8d1f('0x3b')](_0x4c9c10[_0x8d1f('0x33')]['sort']);_0x4eb591[_0x8d1f('0x3c')]=qs['filters'](_['pick'](_0x4c9c10[_0x8d1f('0x33')],_0x39ddd0[_0x8d1f('0x35')]));if(_0x4c9c10[_0x8d1f('0x33')][_0x8d1f('0x40')]){_0x4eb591['where']=_['merge'](_0x4eb591['where'],{'$or':_['map'](_0x4eb591[_0x8d1f('0x38')],function(_0x41623d){var _0x2ed21b={};_0x2ed21b[_0x41623d]={'$like':'%'+_0x4c9c10['query'][_0x8d1f('0x40')]+'%'};return _0x2ed21b;})});}_0x4eb591=_[_0x8d1f('0x3e')]({},_0x4eb591,_0x4c9c10[_0x8d1f('0x41')]);return _0x4a57e1[_0x8d1f('0x8a')](_0x4eb591);}})['then'](function(_0x4f4226){if(_0x4f4226){_0x7dc603=_0x4f4226['length'];if(!_0x4c9c10['query'][_0x8d1f('0x59')](_0x8d1f('0x67'))){_0x4eb591['limit']=qs[_0x8d1f('0x20')](_0x4c9c10[_0x8d1f('0x33')][_0x8d1f('0x20')]);_0x4eb591[_0x8d1f('0x23')]=qs[_0x8d1f('0x23')](_0x4c9c10[_0x8d1f('0x33')][_0x8d1f('0x23')]);}return _0x4a57e1[_0x8d1f('0x8a')](_0x4eb591);}})[_0x8d1f('0x28')](function(_0x223bf5){if(_0x223bf5){return _0x223bf5?{'count':_0x7dc603,'rows':_0x223bf5}:null;}})[_0x8d1f('0x28')](respondWithResult(_0x4196dc,null))[_0x8d1f('0x49')](handleError(_0x4196dc,null));}; \ No newline at end of file +var _0x3bd1=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsQueue.socket','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','map','SmsQueue','rawAttributes','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','findAll','Agents','select','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x3bd1,0x111));var _0x13bd=function(_0x50ccbf,_0x230498){_0x50ccbf=_0x50ccbf-0x0;var _0x1843da=_0x3bd1[_0x50ccbf];return _0x1843da;};'use strict';var emlformat=require(_0x13bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13bd('0x1'));var jsonpatch=require(_0x13bd('0x2'));var rp=require(_0x13bd('0x3'));var moment=require(_0x13bd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13bd('0x5'));var util=require(_0x13bd('0x6'));var path=require(_0x13bd('0x7'));var sox=require(_0x13bd('0x8'));var csv=require('to-csv');var ejs=require(_0x13bd('0x9'));var fs=require('fs');var fs_extra=require(_0x13bd('0xa'));var _=require(_0x13bd('0xb'));var squel=require(_0x13bd('0xc'));var crypto=require(_0x13bd('0xd'));var jsforce=require(_0x13bd('0xe'));var deskjs=require(_0x13bd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x13bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x13bd('0x11'));var authService=require(_0x13bd('0x12'));var qs=require(_0x13bd('0x13'));var as=require(_0x13bd('0x14'));var hardwareService=require(_0x13bd('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x13bd('0x16'));var licenseUtil=require(_0x13bd('0x17'));var db=require(_0x13bd('0x18'))['db'];config['redis']=_[_0x13bd('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x13bd('0x1a'))(new Redis(config[_0x13bd('0x1b')]));require(_0x13bd('0x1c'))['register'](socket);function respondWithStatusCode(_0x563265,_0x442e54){_0x442e54=_0x442e54||0xcc;return function(_0x13a701){if(_0x13a701){return _0x563265['sendStatus'](_0x442e54);}return _0x563265[_0x13bd('0x1d')](_0x442e54)['end']();};}function respondWithResult(_0x1bbf24,_0x4a2e95){_0x4a2e95=_0x4a2e95||0xc8;return function(_0x4b3502){if(_0x4b3502){return _0x1bbf24[_0x13bd('0x1d')](_0x4a2e95)[_0x13bd('0x1e')](_0x4b3502);}};}function respondWithFilteredResult(_0x3f016c,_0x233bd5){return function(_0x32202a){if(_0x32202a){var _0x289230=typeof _0x233bd5['offset']==='undefined'&&typeof _0x233bd5[_0x13bd('0x1f')]===_0x13bd('0x20');var _0xdf2ebf=_0x32202a[_0x13bd('0x21')];var _0x3f59a7=_0x289230?0x0:_0x233bd5[_0x13bd('0x22')];var _0x5abb45=_0x289230?_0x32202a[_0x13bd('0x21')]:_0x233bd5[_0x13bd('0x22')]+_0x233bd5[_0x13bd('0x1f')];var _0x24bf38;if(_0x5abb45>=_0xdf2ebf){_0x5abb45=_0xdf2ebf;_0x24bf38=0xc8;}else{_0x24bf38=0xce;}_0x3f016c[_0x13bd('0x1d')](_0x24bf38);return _0x3f016c[_0x13bd('0x23')]('Content-Range',_0x3f59a7+'-'+_0x5abb45+'/'+_0xdf2ebf)['json'](_0x32202a);}return null;};}function patchUpdates(_0x385834){return function(_0x5e6131){try{jsonpatch[_0x13bd('0x24')](_0x5e6131,_0x385834,!![]);}catch(_0x202c89){return BPromise[_0x13bd('0x25')](_0x202c89);}return _0x5e6131[_0x13bd('0x26')]();};}function saveUpdates(_0xf2a9f9,_0x42648b){return function(_0x61d3fb){if(_0x61d3fb){return _0x61d3fb[_0x13bd('0x27')](_0xf2a9f9)[_0x13bd('0x28')](function(_0x870ff1){return _0x870ff1;});}return null;};}function removeEntity(_0x19926c,_0x317157){return function(_0x1795c4){if(_0x1795c4){return _0x1795c4[_0x13bd('0x29')]()[_0x13bd('0x28')](function(){var _0x72457e=_0x1795c4[_0x13bd('0x2a')]({'plain':!![]});var _0x264e7f='SmsQueues';return db[_0x13bd('0x2b')][_0x13bd('0x29')]({'where':{'type':_0x264e7f,'resourceId':_0x72457e['id']}})['then'](function(){return _0x1795c4;});})['then'](function(){_0x19926c[_0x13bd('0x1d')](0xcc)[_0x13bd('0x2c')]();});}};}function handleEntityNotFound(_0x1e9ef3,_0x2356bc){return function(_0x42da42){if(!_0x42da42){_0x1e9ef3[_0x13bd('0x2d')](0x194);}return _0x42da42;};}function handleError(_0x5c42cf,_0x6b45eb){_0x6b45eb=_0x6b45eb||0x1f4;return function(_0x10570a){logger['error'](_0x10570a[_0x13bd('0x2e')]);if(_0x10570a[_0x13bd('0x2f')]){delete _0x10570a['name'];}_0x5c42cf[_0x13bd('0x1d')](_0x6b45eb)['send'](_0x10570a);};}exports['index']=function(_0x25c468,_0x38118a){var _0x22d9c7={},_0x7f6c2f={},_0x3e5bd7={'count':0x0,'rows':[]};var _0x7e01c8=_[_0x13bd('0x30')](db[_0x13bd('0x31')][_0x13bd('0x32')],function(_0x4bc5c3){return{'name':_0x4bc5c3['fieldName'],'type':_0x4bc5c3['type'][_0x13bd('0x33')]};});_0x7f6c2f['model']=_[_0x13bd('0x30')](_0x7e01c8,_0x13bd('0x2f'));_0x7f6c2f[_0x13bd('0x34')]=_['keys'](_0x25c468[_0x13bd('0x34')]);_0x7f6c2f['filters']=_[_0x13bd('0x35')](_0x7f6c2f[_0x13bd('0x36')],_0x7f6c2f[_0x13bd('0x34')]);_0x22d9c7[_0x13bd('0x37')]=_[_0x13bd('0x35')](_0x7f6c2f[_0x13bd('0x36')],qs[_0x13bd('0x38')](_0x25c468[_0x13bd('0x34')][_0x13bd('0x38')]));_0x22d9c7[_0x13bd('0x37')]=_0x22d9c7[_0x13bd('0x37')][_0x13bd('0x39')]?_0x22d9c7['attributes']:_0x7f6c2f[_0x13bd('0x36')];if(!_0x25c468[_0x13bd('0x34')][_0x13bd('0x3a')](_0x13bd('0x3b'))){_0x22d9c7['limit']=qs[_0x13bd('0x1f')](_0x25c468[_0x13bd('0x34')][_0x13bd('0x1f')]);_0x22d9c7[_0x13bd('0x22')]=qs[_0x13bd('0x22')](_0x25c468['query'][_0x13bd('0x22')]);}_0x22d9c7[_0x13bd('0x3c')]=qs[_0x13bd('0x3d')](_0x25c468['query']['sort']);_0x22d9c7[_0x13bd('0x3e')]=qs[_0x13bd('0x3f')](_[_0x13bd('0x40')](_0x25c468[_0x13bd('0x34')],_0x7f6c2f[_0x13bd('0x3f')]),_0x7e01c8);if(_0x25c468[_0x13bd('0x34')][_0x13bd('0x41')]){_0x22d9c7[_0x13bd('0x3e')]=_[_0x13bd('0x42')](_0x22d9c7[_0x13bd('0x3e')],{'$or':_['map'](_0x7e01c8,function(_0x9fb9d8){if(_0x9fb9d8[_0x13bd('0x43')]!==_0x13bd('0x44')){var _0x4cdd1b={};_0x4cdd1b[_0x9fb9d8[_0x13bd('0x2f')]]={'$like':'%'+_0x25c468[_0x13bd('0x34')][_0x13bd('0x41')]+'%'};return _0x4cdd1b;}})});}_0x22d9c7=_[_0x13bd('0x42')]({},_0x22d9c7,_0x25c468[_0x13bd('0x45')]);var _0xe23833={'where':_0x22d9c7[_0x13bd('0x3e')]};return db[_0x13bd('0x31')]['count'](_0xe23833)[_0x13bd('0x28')](function(_0x1ba5b4){_0x3e5bd7[_0x13bd('0x21')]=_0x1ba5b4;if(_0x25c468['query'][_0x13bd('0x46')]){_0x22d9c7['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x22d9c7);})[_0x13bd('0x28')](function(_0xc43d71){_0x3e5bd7[_0x13bd('0x47')]=_0xc43d71;return _0x3e5bd7;})['then'](respondWithFilteredResult(_0x38118a,_0x22d9c7))[_0x13bd('0x48')](handleError(_0x38118a,null));};exports[_0x13bd('0x49')]=function(_0x488d2c,_0x17a21b){var _0x4fc1b4={'raw':!![],'where':{'id':_0x488d2c[_0x13bd('0x4a')]['id']}},_0x2dc46c={};_0x2dc46c[_0x13bd('0x36')]=_[_0x13bd('0x4b')](db[_0x13bd('0x31')][_0x13bd('0x32')]);_0x2dc46c[_0x13bd('0x34')]=_[_0x13bd('0x4b')](_0x488d2c[_0x13bd('0x34')]);_0x2dc46c[_0x13bd('0x3f')]=_[_0x13bd('0x35')](_0x2dc46c[_0x13bd('0x36')],_0x2dc46c[_0x13bd('0x34')]);_0x4fc1b4[_0x13bd('0x37')]=_[_0x13bd('0x35')](_0x2dc46c[_0x13bd('0x36')],qs[_0x13bd('0x38')](_0x488d2c[_0x13bd('0x34')]['fields']));_0x4fc1b4[_0x13bd('0x37')]=_0x4fc1b4['attributes'][_0x13bd('0x39')]?_0x4fc1b4[_0x13bd('0x37')]:_0x2dc46c[_0x13bd('0x36')];if(_0x488d2c[_0x13bd('0x34')][_0x13bd('0x46')]){_0x4fc1b4[_0x13bd('0x4c')]=[{'all':!![]}];}_0x4fc1b4=_[_0x13bd('0x42')]({},_0x4fc1b4,_0x488d2c[_0x13bd('0x45')]);return db[_0x13bd('0x31')][_0x13bd('0x4d')](_0x4fc1b4)['then'](handleEntityNotFound(_0x17a21b,null))[_0x13bd('0x28')](respondWithResult(_0x17a21b,null))[_0x13bd('0x48')](handleError(_0x17a21b,null));};exports[_0x13bd('0x4e')]=function(_0xdc0c08,_0x1bfe83){return db[_0x13bd('0x31')][_0x13bd('0x4e')](_0xdc0c08['body'],{})[_0x13bd('0x28')](function(_0x13eb08){var _0x35fea1=_0xdc0c08['user'][_0x13bd('0x2a')]({'plain':!![]});if(!_0x35fea1)throw new Error(_0x13bd('0x4f'));if(_0x35fea1[_0x13bd('0x50')]==='user'){var _0x2e9ea5=_0x13eb08['get']({'plain':!![]});var _0x204f90=_0x13bd('0x51');return db[_0x13bd('0x52')]['find']({'where':{'name':_0x204f90,'userProfileId':_0x35fea1[_0x13bd('0x53')]},'raw':!![]})[_0x13bd('0x28')](function(_0x48f9e7){if(_0x48f9e7&&_0x48f9e7[_0x13bd('0x54')]===0x0){return db[_0x13bd('0x2b')][_0x13bd('0x4e')]({'name':_0x2e9ea5[_0x13bd('0x2f')],'resourceId':_0x2e9ea5['id'],'type':_0x48f9e7[_0x13bd('0x2f')],'sectionId':_0x48f9e7['id']},{})[_0x13bd('0x28')](function(){return _0x13eb08;});}else{return _0x13eb08;}})[_0x13bd('0x48')](function(_0x42b02b){logger[_0x13bd('0x55')](_0x13bd('0x56'),_0x42b02b);throw _0x42b02b;});}return _0x13eb08;})[_0x13bd('0x28')](respondWithResult(_0x1bfe83,0xc9))[_0x13bd('0x48')](handleError(_0x1bfe83,null));};exports[_0x13bd('0x27')]=function(_0x39fb6e,_0x30452b){if(_0x39fb6e[_0x13bd('0x57')]['id']){delete _0x39fb6e[_0x13bd('0x57')]['id'];}return db['SmsQueue'][_0x13bd('0x4d')]({'where':{'id':_0x39fb6e['params']['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x30452b,null))['then'](saveUpdates(_0x39fb6e[_0x13bd('0x57')],null))[_0x13bd('0x28')](respondWithResult(_0x30452b,null))['catch'](handleError(_0x30452b,null));};exports[_0x13bd('0x29')]=function(_0x38694a,_0x147a35){return db['SmsQueue']['find']({'where':{'id':_0x38694a[_0x13bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x147a35,null))[_0x13bd('0x28')](removeEntity(_0x147a35,null))[_0x13bd('0x48')](handleError(_0x147a35,null));};exports['describe']=function(_0x35447f,_0x2ea6f2){return db[_0x13bd('0x31')][_0x13bd('0x58')]()['then'](respondWithResult(_0x2ea6f2,null))[_0x13bd('0x48')](handleError(_0x2ea6f2,null));};exports[_0x13bd('0x59')]=function(_0x2271b1,_0x59636d,_0x414ecc){var _0x355dee={'raw':!![],'where':{}},_0x299550={},_0x1b61ee;return db[_0x13bd('0x31')][_0x13bd('0x5a')]({'where':{'id':_0x2271b1[_0x13bd('0x4a')]['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x59636d,null))[_0x13bd('0x28')](function(_0x1d7f19){if(_0x1d7f19){_0x1b61ee=_0x1d7f19[_0x13bd('0x2a')]({'plain':!![]});_0x299550['model']=_[_0x13bd('0x4b')](db[_0x13bd('0x5b')][_0x13bd('0x32')]);_0x299550['query']=_[_0x13bd('0x4b')](_0x2271b1[_0x13bd('0x34')]);_0x299550['filters']=_[_0x13bd('0x35')](_0x299550[_0x13bd('0x36')],_0x299550[_0x13bd('0x34')]);_0x355dee[_0x13bd('0x37')]=_[_0x13bd('0x35')](_0x299550[_0x13bd('0x36')],qs[_0x13bd('0x38')](_0x2271b1[_0x13bd('0x34')][_0x13bd('0x38')]));_0x355dee[_0x13bd('0x37')]=_0x355dee['attributes']['length']?_0x355dee[_0x13bd('0x37')]:_0x299550[_0x13bd('0x36')];if(!_0x2271b1[_0x13bd('0x34')]['hasOwnProperty'](_0x13bd('0x3b'))){_0x355dee['limit']=qs[_0x13bd('0x1f')](_0x2271b1['query'][_0x13bd('0x1f')]);_0x355dee[_0x13bd('0x22')]=qs[_0x13bd('0x22')](_0x2271b1[_0x13bd('0x34')][_0x13bd('0x22')]);}_0x355dee[_0x13bd('0x3c')]=qs[_0x13bd('0x3d')](_0x2271b1[_0x13bd('0x34')][_0x13bd('0x3d')]);_0x355dee[_0x13bd('0x3e')]=qs['filters'](_[_0x13bd('0x40')](_0x2271b1[_0x13bd('0x34')],_0x299550[_0x13bd('0x3f')]));_0x355dee['where']['SmsQueueId']=_0x1d7f19['id'];if(_0x2271b1['query'][_0x13bd('0x41')]){_0x355dee[_0x13bd('0x3e')]=_[_0x13bd('0x42')](_0x355dee[_0x13bd('0x3e')],{'$or':_[_0x13bd('0x30')](_0x355dee['attributes'],function(_0x19956e){var _0x4a7d8a={};_0x4a7d8a[_0x19956e]={'$like':'%'+_0x2271b1[_0x13bd('0x34')]['filter']+'%'};return _0x4a7d8a;})});}_0x355dee=_[_0x13bd('0x42')]({},_0x355dee,_0x2271b1['options']);return db[_0x13bd('0x5b')]['findAll'](_0x355dee);}})[_0x13bd('0x28')](function(_0x31acab){if(_0x31acab){return db[_0x13bd('0x5c')][_0x13bd('0x5d')]({'where':{'id':_[_0x13bd('0x30')](_0x31acab,_0x13bd('0x5e')),'role':'agent'},'attributes':['id',_0x13bd('0x2f'),_0x13bd('0x5f'),_0x13bd('0x60'),_0x13bd('0x61')]});}})[_0x13bd('0x28')](function(_0x2b7477){if(_0x2b7477){return{'count':_0x2b7477[_0x13bd('0x21')],'rows':_['map'](_0x2b7477[_0x13bd('0x47')],function(_0x1eae71){return{'membername':_0x1eae71['name'],'UserId':_0x1eae71['id'],'queue_name':_0x1b61ee[_0x13bd('0x2f')],'SmsQueueId':_0x1b61ee['id'],'interface':util[_0x13bd('0x62')]('%s/%s',_0x13bd('0x63'),_0x1eae71[_0x13bd('0x2f')]),'penalty':0x0,'paused':_0x1eae71['smsPause'],'createdAt':_0x1eae71['createdAt'],'updatedAt':_0x1eae71[_0x13bd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x59636d,_0x355dee))[_0x13bd('0x48')](handleError(_0x59636d,null));};exports['getTeams']=function(_0x23b16a,_0x1a93d6,_0x436ee8){var _0x17403b={};var _0x44621b={};var _0x1045a7;var _0x5dd348;return db[_0x13bd('0x31')]['findOne']({'where':{'id':_0x23b16a['params']['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x1a93d6,null))[_0x13bd('0x28')](function(_0x2b8798){if(_0x2b8798){_0x1045a7=_0x2b8798;_0x44621b['model']=_[_0x13bd('0x4b')](db[_0x13bd('0x64')][_0x13bd('0x32')]);_0x44621b[_0x13bd('0x34')]=_['keys'](_0x23b16a[_0x13bd('0x34')]);_0x44621b[_0x13bd('0x3f')]=_[_0x13bd('0x35')](_0x44621b[_0x13bd('0x36')],_0x44621b[_0x13bd('0x34')]);_0x17403b['attributes']=_[_0x13bd('0x35')](_0x44621b[_0x13bd('0x36')],qs[_0x13bd('0x38')](_0x23b16a[_0x13bd('0x34')][_0x13bd('0x38')]));_0x17403b[_0x13bd('0x37')]=_0x17403b[_0x13bd('0x37')][_0x13bd('0x39')]?_0x17403b[_0x13bd('0x37')]:_0x44621b[_0x13bd('0x36')];_0x17403b['order']=qs[_0x13bd('0x3d')](_0x23b16a[_0x13bd('0x34')][_0x13bd('0x3d')]);_0x17403b[_0x13bd('0x3e')]=qs[_0x13bd('0x3f')](_[_0x13bd('0x40')](_0x23b16a[_0x13bd('0x34')],_0x44621b[_0x13bd('0x3f')]));if(_0x23b16a[_0x13bd('0x34')][_0x13bd('0x41')]){_0x17403b['where']=_[_0x13bd('0x42')](_0x17403b[_0x13bd('0x3e')],{'$or':_[_0x13bd('0x30')](_0x17403b['attributes'],function(_0x1e1892){var _0x228ae0={};_0x228ae0[_0x1e1892]={'$like':'%'+_0x23b16a[_0x13bd('0x34')][_0x13bd('0x41')]+'%'};return _0x228ae0;})});}_0x17403b=_[_0x13bd('0x42')]({},_0x17403b,_0x23b16a[_0x13bd('0x45')]);return _0x1045a7[_0x13bd('0x65')](_0x17403b);}})['then'](function(_0x3dbb55){if(_0x3dbb55){_0x5dd348=_0x3dbb55[_0x13bd('0x39')];if(!_0x23b16a['query'][_0x13bd('0x3a')](_0x13bd('0x3b'))){_0x17403b[_0x13bd('0x1f')]=qs[_0x13bd('0x1f')](_0x23b16a['query'][_0x13bd('0x1f')]);_0x17403b[_0x13bd('0x22')]=qs[_0x13bd('0x22')](_0x23b16a[_0x13bd('0x34')][_0x13bd('0x22')]);}return _0x1045a7['getTeams'](_0x17403b);}})[_0x13bd('0x28')](function(_0x1e8d16){if(_0x1e8d16){return _0x1e8d16?{'count':_0x5dd348,'rows':_0x1e8d16}:null;}})[_0x13bd('0x28')](respondWithResult(_0x1a93d6,null))[_0x13bd('0x48')](handleError(_0x1a93d6,null));};exports[_0x13bd('0x66')]=function(_0x2d2c75,_0x158755,_0x58ebc6){var _0x17007e=_0x2d2c75[_0x13bd('0x57')][_0x13bd('0x67')];return db['Team']['findAll']({'where':{'id':_0x17007e},'attributes':['id'],'include':[{'model':db[_0x13bd('0x5c')],'as':'Agents','attributes':['id',_0x13bd('0x2f'),_0x13bd('0x68'),_0x13bd('0x69'),_0x13bd('0x6a')],'raw':!![]}]})[_0x13bd('0x28')](function(_0x58fb92){if(_0x58fb92){var _0x1cf1e1=_[_0x13bd('0x6b')](_0x58fb92,function(_0x1b0392){var _0x170de1=_0x1b0392[_0x13bd('0x2a')]({'plain':!![]});return _0x170de1['Agents'];});return db[_0x13bd('0x31')][_0x13bd('0x4d')]({'where':{'id':_0x2d2c75[_0x13bd('0x4a')]['id']}})[_0x13bd('0x28')](function(_0x3d626c){return db[_0x13bd('0x6c')][_0x13bd('0x6d')](function(_0x5cfaf4){return _0x3d626c['addTeams'](_0x17007e,{'transaction':_0x5cfaf4})['then'](function(){return BPromise['each'](_0x1cf1e1,function(_0x28dbe7){return db[_0x13bd('0x5b')][_0x13bd('0x6e')]({'where':{'UserId':_0x28dbe7['id'],'SmsQueueId':_0x2d2c75[_0x13bd('0x4a')]['id']},'transaction':_0x5cfaf4});});})[_0x13bd('0x28')](function(){_0x1cf1e1[_0x13bd('0x6f')](function(_0x4d7af0){socket[_0x13bd('0x70')]('userSmsQueue:save',{'UserId':_0x4d7af0['id'],'SmsQueueId':_0x3d626c['id']});});});});});}})['then'](respondWithStatusCode(_0x158755,null))[_0x13bd('0x48')](handleError(_0x158755,null));};exports[_0x13bd('0x71')]=function(_0x549464,_0x4299ab,_0x1ec2ff){return db[_0x13bd('0x64')][_0x13bd('0x72')]({'where':{'id':_0x549464[_0x13bd('0x34')][_0x13bd('0x67')]},'attributes':['id'],'include':[{'model':db[_0x13bd('0x5c')],'as':_0x13bd('0x73'),'attributes':['id'],'raw':!![]}]})[_0x13bd('0x28')](handleEntityNotFound(_0x4299ab,null))[_0x13bd('0x28')](function(_0x2a5bb7){var _0x24c49e=_[_0x13bd('0x30')](_0x2a5bb7,'id');var _0x2b76de=[];var _0x70a4fd=[];var _0x5569ec=squel[_0x13bd('0x74')]();_0x5569ec['field'](_0x13bd('0x75'))[_0x13bd('0x76')](_0x13bd('0x77'),'tq')[_0x13bd('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x13bd('0x3e')](_0x13bd('0x79'),_0x549464['params']['id']);for(var _0x10df66=0x0;_0x10df66<_0x2a5bb7[_0x13bd('0x39')];_0x10df66+=0x1){let _0x24ff1c=_0x2a5bb7[_0x10df66];for(var _0x2e2f83=0x0;_0x2e2f83<_0x24ff1c[_0x13bd('0x73')][_0x13bd('0x39')];_0x2e2f83+=0x1){let _0x7097eb=_0x24ff1c[_0x13bd('0x73')][_0x2e2f83];var _0xf6bdf1=_0x5569ec[_0x13bd('0x7a')]();_0xf6bdf1[_0x13bd('0x3e')](_0x13bd('0x7b'),_0x7097eb['id']);_0x70a4fd['push'](db['sequelize'][_0x13bd('0x34')](_0xf6bdf1['toString'](),{'type':db['sequelize'][_0x13bd('0x7c')][_0x13bd('0x7d')]})[_0x13bd('0x28')](function(_0x2ba475){if(_0x2ba475[_0x13bd('0x39')]===0x1){return _0x7097eb['id'];}else{var _0xfde764=_[_0x13bd('0x7e')](_[_0x13bd('0x30')](_0x2ba475,_0x13bd('0x7f')),function(_0x123d0b){return _[_0x13bd('0x80')](_0x24c49e,_0x123d0b);});if(_0xfde764){return _0x7097eb['id'];}}}));}}return BPromise[_0x13bd('0x81')](_0x70a4fd)[_0x13bd('0x28')](function(_0x2cd584){_0x2b76de=_(_0x2b76de)[_0x13bd('0x82')](_0x2cd584)[_0x13bd('0x83')]()[_0x13bd('0x84')]();return db['SmsQueue'][_0x13bd('0x4d')]({'where':{'id':_0x549464[_0x13bd('0x4a')]['id']}})[_0x13bd('0x28')](function(_0x121719){return db['sequelize'][_0x13bd('0x6d')](function(_0x3e4b04){return _0x121719['removeTeams'](_0x549464['query'][_0x13bd('0x67')],{'transaction':_0x3e4b04})[_0x13bd('0x28')](function(){if(!_[_0x13bd('0x85')](_0x2b76de)){return _0x121719[_0x13bd('0x86')](_0x2b76de,{'transaction':_0x3e4b04});}})[_0x13bd('0x28')](function(){_0x2b76de[_0x13bd('0x6f')](function(_0x39b58b){socket['emit']('userSmsQueue:remove',{'UserId':_0x39b58b,'SmsQueueId':_0x121719['id']});});});});});});})[_0x13bd('0x28')](respondWithStatusCode(_0x4299ab,null))[_0x13bd('0x48')](handleError(_0x4299ab,null));};exports['addAgents']=function(_0x26fd2d,_0x39f385,_0x521f68){return db[_0x13bd('0x31')]['find']({'where':{'id':_0x26fd2d['params']['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x39f385,null))[_0x13bd('0x28')](function(_0x4307b5){if(_0x4307b5){return _0x4307b5[_0x13bd('0x87')](_0x26fd2d[_0x13bd('0x57')][_0x13bd('0x67')],_[_0x13bd('0x88')](_0x26fd2d[_0x13bd('0x57')],[_0x13bd('0x67'),'id'])||{})[_0x13bd('0x89')](function(_0x2a6f49){for(var _0x496257=0x0;_0x496257<_0x26fd2d[_0x13bd('0x57')]['ids']['length'];_0x496257+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x26fd2d[_0x13bd('0x57')]['ids'][_0x496257]),'SmsQueueId':Number(_0x26fd2d[_0x13bd('0x4a')]['id'])});}return _0x2a6f49;});}})[_0x13bd('0x28')](respondWithResult(_0x39f385,null))['catch'](handleError(_0x39f385,null));};exports[_0x13bd('0x86')]=function(_0x1f6d6c,_0x5b5c67,_0x861f18){return db[_0x13bd('0x31')][_0x13bd('0x4d')]({'where':{'id':_0x1f6d6c[_0x13bd('0x4a')]['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x5b5c67,null))[_0x13bd('0x28')](function(_0x26a317){if(_0x26a317){return _0x26a317[_0x13bd('0x86')](_0x1f6d6c['query'][_0x13bd('0x67')])['then'](function(){if(_[_0x13bd('0x8a')](_0x1f6d6c[_0x13bd('0x34')][_0x13bd('0x67')])){for(var _0x1316d3=0x0;_0x1316d3<_0x1f6d6c[_0x13bd('0x34')][_0x13bd('0x67')][_0x13bd('0x39')];_0x1316d3+=0x1){socket[_0x13bd('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x1f6d6c[_0x13bd('0x34')][_0x13bd('0x67')][_0x1316d3]),'SmsQueueId':Number(_0x1f6d6c[_0x13bd('0x4a')]['id'])});}}else{socket[_0x13bd('0x70')](_0x13bd('0x8b'),{'UserId':Number(_0x1f6d6c[_0x13bd('0x34')]['ids']),'SmsQueueId':Number(_0x1f6d6c[_0x13bd('0x4a')]['id'])});}});}})[_0x13bd('0x28')](respondWithStatusCode(_0x5b5c67,null))['catch'](handleError(_0x5b5c67,null));};exports['getAgents']=function(_0x2a4194,_0x2e637e,_0x43565a){var _0x1fcd16={};var _0x59c34c={};var _0x4b1483;var _0x90be5e;return db[_0x13bd('0x31')][_0x13bd('0x5a')]({'where':{'id':_0x2a4194['params']['id']}})[_0x13bd('0x28')](handleEntityNotFound(_0x2e637e,null))[_0x13bd('0x28')](function(_0x5c43c6){if(_0x5c43c6){_0x4b1483=_0x5c43c6;_0x59c34c[_0x13bd('0x36')]=_[_0x13bd('0x4b')](db[_0x13bd('0x5c')]['rawAttributes']);_0x59c34c[_0x13bd('0x34')]=_['keys'](_0x2a4194['query']);_0x59c34c[_0x13bd('0x3f')]=_[_0x13bd('0x35')](_0x59c34c[_0x13bd('0x36')],_0x59c34c[_0x13bd('0x34')]);_0x1fcd16[_0x13bd('0x37')]=_['intersection'](_0x59c34c[_0x13bd('0x36')],qs[_0x13bd('0x38')](_0x2a4194[_0x13bd('0x34')][_0x13bd('0x38')]));_0x1fcd16[_0x13bd('0x37')]=_0x1fcd16[_0x13bd('0x37')]['length']?_0x1fcd16[_0x13bd('0x37')]:_0x59c34c[_0x13bd('0x36')];_0x1fcd16['order']=qs[_0x13bd('0x3d')](_0x2a4194[_0x13bd('0x34')]['sort']);_0x1fcd16[_0x13bd('0x3e')]=qs[_0x13bd('0x3f')](_['pick'](_0x2a4194[_0x13bd('0x34')],_0x59c34c[_0x13bd('0x3f')]));if(_0x2a4194[_0x13bd('0x34')]['filter']){_0x1fcd16[_0x13bd('0x3e')]=_[_0x13bd('0x42')](_0x1fcd16[_0x13bd('0x3e')],{'$or':_[_0x13bd('0x30')](_0x1fcd16[_0x13bd('0x37')],function(_0x2f78a4){var _0x30210f={};_0x30210f[_0x2f78a4]={'$like':'%'+_0x2a4194[_0x13bd('0x34')][_0x13bd('0x41')]+'%'};return _0x30210f;})});}_0x1fcd16=_[_0x13bd('0x42')]({},_0x1fcd16,_0x2a4194[_0x13bd('0x45')]);return _0x4b1483[_0x13bd('0x8c')](_0x1fcd16);}})['then'](function(_0x510da3){if(_0x510da3){_0x90be5e=_0x510da3[_0x13bd('0x39')];if(!_0x2a4194[_0x13bd('0x34')][_0x13bd('0x3a')](_0x13bd('0x3b'))){_0x1fcd16[_0x13bd('0x1f')]=qs['limit'](_0x2a4194[_0x13bd('0x34')][_0x13bd('0x1f')]);_0x1fcd16[_0x13bd('0x22')]=qs[_0x13bd('0x22')](_0x2a4194['query'][_0x13bd('0x22')]);}return _0x4b1483['getAgents'](_0x1fcd16);}})['then'](function(_0x1b9383){if(_0x1b9383){return _0x1b9383?{'count':_0x90be5e,'rows':_0x1b9383}:null;}})['then'](respondWithResult(_0x2e637e,null))[_0x13bd('0x48')](handleError(_0x2e637e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3b4de17..6028856 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 _0xf265=['../../mysqldb','SmsQueue','save','update','remove','emit','hook','events'];(function(_0xd28892,_0x1bec51){var _0x4aef1d=function(_0x9ec899){while(--_0x9ec899){_0xd28892['push'](_0xd28892['shift']());}};_0x4aef1d(++_0x1bec51);}(_0xf265,0x1d7));var _0x5f26=function(_0x375c0b,_0x567d67){_0x375c0b=_0x375c0b-0x0;var _0x4c4bec=_0xf265[_0x375c0b];return _0x4c4bec;};'use strict';var EventEmitter=require(_0x5f26('0x0'));var SmsQueue=require(_0x5f26('0x1'))['db'][_0x5f26('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5f26('0x3'),'afterUpdate':_0x5f26('0x4'),'afterDestroy':_0x5f26('0x5')};function emitEvent(_0x50df17){return function(_0x18a44a,_0x32333f,_0x5b726a){SmsQueueEvents[_0x5f26('0x6')](_0x50df17+':'+_0x18a44a['id'],_0x18a44a);SmsQueueEvents[_0x5f26('0x6')](_0x50df17,_0x18a44a);_0x5b726a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x5f26('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x50b8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x572c56,_0x236455){var _0x542491=function(_0xa44c66){while(--_0xa44c66){_0x572c56['push'](_0x572c56['shift']());}};_0x542491(++_0x236455);}(_0x50b8,0x178));var _0x850b=function(_0x3b1269,_0x310864){_0x3b1269=_0x3b1269-0x0;var _0x438a03=_0x50b8[_0x3b1269];return _0x438a03;};'use strict';var EventEmitter=require(_0x850b('0x0'));var SmsQueue=require(_0x850b('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x850b('0x2')](0x0);var events={'afterCreate':_0x850b('0x3'),'afterUpdate':_0x850b('0x4'),'afterDestroy':_0x850b('0x5')};function emitEvent(_0x224c5e){return function(_0x89da70,_0x221c0d,_0x401498){SmsQueueEvents[_0x850b('0x6')](_0x224c5e+':'+_0x89da70['id'],_0x89da70);SmsQueueEvents[_0x850b('0x6')](_0x224c5e,_0x89da70);_0x401498(null);};}for(var e in events){if(events[_0x850b('0x7')](e)){var event=events[e];SmsQueue[_0x850b('0x8')](e,emitEvent(event));}}module[_0x850b('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3068e19..1861447 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 _0xb4b8=['rimraf','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x49826c,_0x4c4e3b){var _0x2ba354=function(_0x18a180){while(--_0x18a180){_0x49826c['push'](_0x49826c['shift']());}};_0x2ba354(++_0x4c4e3b);}(_0xb4b8,0x1c8));var _0x8b4b=function(_0x2648f3,_0x5552f5){_0x2648f3=_0x2648f3-0x0;var _0x4d6a54=_0xb4b8[_0x2648f3];return _0x4d6a54;};'use strict';var _=require(_0x8b4b('0x0'));var util=require(_0x8b4b('0x1'));var logger=require(_0x8b4b('0x2'))('api');var moment=require(_0x8b4b('0x3'));var BPromise=require(_0x8b4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b4b('0x5'));var rimraf=require(_0x8b4b('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b4b('0x7'));module[_0x8b4b('0x8')]=function(_0x214660,_0x387ef9){return _0x214660[_0x8b4b('0x9')]('SmsQueue',attributes,{'tableName':_0x8b4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf255=['util','../../config/logger','api','path','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash'];(function(_0x5628cb,_0x3b863f){var _0x571777=function(_0x515a11){while(--_0x515a11){_0x5628cb['push'](_0x5628cb['shift']());}};_0x571777(++_0x3b863f);}(_0xf255,0xa1));var _0x5f25=function(_0x3be9c7,_0x10c8db){_0x3be9c7=_0x3be9c7-0x0;var _0x2bd45c=_0xf255[_0x3be9c7];return _0x2bd45c;};'use strict';var _=require(_0x5f25('0x0'));var util=require(_0x5f25('0x1'));var logger=require(_0x5f25('0x2'))(_0x5f25('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f25('0x4'));var rimraf=require('rimraf');var config=require(_0x5f25('0x5'));var attributes=require(_0x5f25('0x6'));module['exports']=function(_0x170972,_0x355fad){return _0x170972[_0x5f25('0x7')]('SmsQueue',attributes,{'tableName':_0x5f25('0x8'),'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 0e09a01..17c5fa7 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 _0x53e6=['attributes','limit','map','include','model','GetSmsQueue','SmsQueue','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','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','result','catch','options','raw','where'];(function(_0x4289bf,_0x36a20e){var _0x520703=function(_0x3318fc){while(--_0x3318fc){_0x4289bf['push'](_0x4289bf['shift']());}};_0x520703(++_0x36a20e);}(_0x53e6,0xe5));var _0x653e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53e6[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x653e('0x0'));var util=require(_0x653e('0x1'));var moment=require(_0x653e('0x2'));var BPromise=require(_0x653e('0x3'));var rs=require(_0x653e('0x4'));var fs=require('fs');var Redis=require(_0x653e('0x5'));var db=require(_0x653e('0x6'))['db'];var utils=require(_0x653e('0x7'));var logger=require(_0x653e('0x8'))(_0x653e('0x9'));var config=require(_0x653e('0xa'));var jayson=require(_0x653e('0xb'));var client=jayson[_0x653e('0xc')]['http']({'port':0x232a});config[_0x653e('0xd')]=_[_0x653e('0xe')](config[_0x653e('0xd')],{'host':_0x653e('0xf'),'port':0x18eb});var socket=require(_0x653e('0x10'))(new Redis(config[_0x653e('0xd')]));require(_0x653e('0x11'))[_0x653e('0x12')](socket);function respondWithRpcPromise(_0x39e32e,_0x544ccb,_0x538e23){return new BPromise(function(_0x31454f,_0x232c08){return client[_0x653e('0x13')](_0x39e32e,_0x538e23)[_0x653e('0x14')](function(_0x2852ed){logger[_0x653e('0x15')]('SmsQueue,\x20%s,\x20%s',_0x544ccb,_0x653e('0x16'));logger[_0x653e('0x17')](_0x653e('0x18'),_0x544ccb,_0x653e('0x16'),JSON[_0x653e('0x19')](_0x2852ed));if(_0x2852ed[_0x653e('0x1a')]){if(_0x2852ed['error'][_0x653e('0x1b')]===0x1f4){logger[_0x653e('0x1a')](_0x653e('0x1c'),_0x544ccb,_0x2852ed[_0x653e('0x1a')][_0x653e('0x1d')]);return _0x232c08(_0x2852ed[_0x653e('0x1a')][_0x653e('0x1d')]);}logger[_0x653e('0x1a')](_0x653e('0x1c'),_0x544ccb,_0x2852ed[_0x653e('0x1a')]['message']);return _0x31454f(_0x2852ed[_0x653e('0x1a')][_0x653e('0x1d')]);}else{logger[_0x653e('0x15')](_0x653e('0x1c'),_0x544ccb,_0x653e('0x16'));_0x31454f(_0x2852ed[_0x653e('0x1e')][_0x653e('0x1d')]);}})[_0x653e('0x1f')](function(_0x15506c){logger[_0x653e('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x544ccb,_0x15506c);_0x232c08(_0x15506c);});});}exports['GetSmsQueue']=function(_0x9f270){var _0x1a8bf8=this;return new Promise(function(_0x31fe38,_0x5353a3){return db['SmsQueue']['findAll']({'raw':_0x9f270[_0x653e('0x20')]?_0x9f270[_0x653e('0x20')][_0x653e('0x21')]===undefined?!![]:![]:!![],'where':_0x9f270['options']?_0x9f270[_0x653e('0x20')][_0x653e('0x22')]||null:null,'attributes':_0x9f270[_0x653e('0x20')]?_0x9f270['options'][_0x653e('0x23')]||null:null,'limit':_0x9f270[_0x653e('0x20')]?_0x9f270[_0x653e('0x20')][_0x653e('0x24')]||null:null,'include':_0x9f270[_0x653e('0x20')]?_0x9f270['options']['include']?_[_0x653e('0x25')](_0x9f270[_0x653e('0x20')][_0x653e('0x26')],function(_0x44afd0){return{'model':db[_0x44afd0[_0x653e('0x27')]],'as':_0x44afd0['as'],'attributes':_0x44afd0[_0x653e('0x23')],'include':_0x44afd0[_0x653e('0x26')]?_[_0x653e('0x25')](_0x44afd0['include'],function(_0x48ef17){return{'model':db[_0x48ef17[_0x653e('0x27')]],'as':_0x48ef17['as'],'attributes':_0x48ef17[_0x653e('0x23')],'include':_0x48ef17[_0x653e('0x26')]?_['map'](_0x48ef17[_0x653e('0x26')],function(_0x54a961){return{'model':db[_0x54a961[_0x653e('0x27')]],'as':_0x54a961['as'],'attributes':_0x54a961[_0x653e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x653e('0x14')](function(_0x1576cb){logger[_0x653e('0x15')](_0x653e('0x28'),_0x9f270);logger[_0x653e('0x17')](_0x653e('0x28'),_0x9f270,JSON['stringify'](_0x1576cb));_0x31fe38(_0x1576cb);})[_0x653e('0x1f')](function(_0x3878e1){logger[_0x653e('0x1a')](_0x653e('0x28'),_0x3878e1[_0x653e('0x1d')],_0x9f270);_0x5353a3(_0x1a8bf8[_0x653e('0x1a')](0x1f4,_0x3878e1[_0x653e('0x1d')]));});});};exports['ShowSmsQueue']=function(_0x39eb05){var _0x5e92a0=this;return new Promise(function(_0x51affe,_0x5ea69c){return db[_0x653e('0x29')][_0x653e('0x2a')]({'raw':_0x39eb05[_0x653e('0x20')]?_0x39eb05[_0x653e('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x39eb05[_0x653e('0x20')]?_0x39eb05[_0x653e('0x20')][_0x653e('0x22')]||null:null,'attributes':_0x39eb05[_0x653e('0x20')]?_0x39eb05[_0x653e('0x20')][_0x653e('0x23')]||null:null,'include':_0x39eb05[_0x653e('0x20')]?_0x39eb05[_0x653e('0x20')][_0x653e('0x26')]?_[_0x653e('0x25')](_0x39eb05[_0x653e('0x20')][_0x653e('0x26')],function(_0x4427f7){return{'model':db[_0x4427f7[_0x653e('0x27')]],'as':_0x4427f7['as'],'attributes':_0x4427f7[_0x653e('0x23')],'include':_0x4427f7[_0x653e('0x26')]?_[_0x653e('0x25')](_0x4427f7['include'],function(_0x3b177f){return{'model':db[_0x3b177f[_0x653e('0x27')]],'as':_0x3b177f['as'],'attributes':_0x3b177f[_0x653e('0x23')],'include':_0x3b177f[_0x653e('0x26')]?_[_0x653e('0x25')](_0x3b177f[_0x653e('0x26')],function(_0x4fe0a6){return{'model':db[_0x4fe0a6[_0x653e('0x27')]],'as':_0x4fe0a6['as'],'attributes':_0x4fe0a6[_0x653e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x387849){logger[_0x653e('0x15')](_0x653e('0x2b'),_0x39eb05);logger[_0x653e('0x17')]('ShowSmsQueue',_0x39eb05,JSON[_0x653e('0x19')](_0x387849));_0x51affe(_0x387849);})[_0x653e('0x1f')](function(_0x36fa6b){logger[_0x653e('0x1a')](_0x653e('0x2b'),_0x36fa6b['message'],_0x39eb05);_0x5ea69c(_0x5e92a0[_0x653e('0x1a')](0x1f4,_0x36fa6b['message']));});});}; \ No newline at end of file +var _0x2fc1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x14594a,_0x399bde){var _0x238ea0=function(_0x3fb821){while(--_0x3fb821){_0x14594a['push'](_0x14594a['shift']());}};_0x238ea0(++_0x399bde);}(_0x2fc1,0xc8));var _0x12fc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fc1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x12fc('0x0'));var util=require('util');var moment=require(_0x12fc('0x1'));var BPromise=require(_0x12fc('0x2'));var rs=require(_0x12fc('0x3'));var fs=require('fs');var Redis=require(_0x12fc('0x4'));var db=require(_0x12fc('0x5'))['db'];var utils=require(_0x12fc('0x6'));var logger=require(_0x12fc('0x7'))(_0x12fc('0x8'));var config=require(_0x12fc('0x9'));var jayson=require(_0x12fc('0xa'));var client=jayson[_0x12fc('0xb')][_0x12fc('0xc')]({'port':0x232a});config[_0x12fc('0xd')]=_[_0x12fc('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x12fc('0xf'))(new Redis(config[_0x12fc('0xd')]));require(_0x12fc('0x10'))[_0x12fc('0x11')](socket);function respondWithRpcPromise(_0x4ca896,_0x2548e3,_0x2e4503){return new BPromise(function(_0x437c05,_0x4f6dcf){return client['request'](_0x4ca896,_0x2e4503)[_0x12fc('0x12')](function(_0x5f47c2){logger[_0x12fc('0x13')](_0x12fc('0x14'),_0x2548e3,_0x12fc('0x15'));logger[_0x12fc('0x16')](_0x12fc('0x17'),_0x2548e3,'request\x20sent',JSON[_0x12fc('0x18')](_0x5f47c2));if(_0x5f47c2[_0x12fc('0x19')]){if(_0x5f47c2['error'][_0x12fc('0x1a')]===0x1f4){logger[_0x12fc('0x19')](_0x12fc('0x14'),_0x2548e3,_0x5f47c2[_0x12fc('0x19')]['message']);return _0x4f6dcf(_0x5f47c2[_0x12fc('0x19')][_0x12fc('0x1b')]);}logger[_0x12fc('0x19')](_0x12fc('0x14'),_0x2548e3,_0x5f47c2[_0x12fc('0x19')][_0x12fc('0x1b')]);return _0x437c05(_0x5f47c2[_0x12fc('0x19')][_0x12fc('0x1b')]);}else{logger[_0x12fc('0x13')](_0x12fc('0x14'),_0x2548e3,'request\x20sent');_0x437c05(_0x5f47c2['result']['message']);}})[_0x12fc('0x1c')](function(_0x4a853a){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2548e3,_0x4a853a);_0x4f6dcf(_0x4a853a);});});}exports[_0x12fc('0x1d')]=function(_0x4fa48b){var _0xdec7e4=this;return new Promise(function(_0x2c030f,_0x13ae63){return db[_0x12fc('0x1e')][_0x12fc('0x1f')]({'raw':_0x4fa48b['options']?_0x4fa48b[_0x12fc('0x20')][_0x12fc('0x21')]===undefined?!![]:![]:!![],'where':_0x4fa48b[_0x12fc('0x20')]?_0x4fa48b[_0x12fc('0x20')]['where']||null:null,'attributes':_0x4fa48b[_0x12fc('0x20')]?_0x4fa48b[_0x12fc('0x20')][_0x12fc('0x22')]||null:null,'limit':_0x4fa48b[_0x12fc('0x20')]?_0x4fa48b[_0x12fc('0x20')][_0x12fc('0x23')]||null:null,'include':_0x4fa48b[_0x12fc('0x20')]?_0x4fa48b[_0x12fc('0x20')]['include']?_[_0x12fc('0x24')](_0x4fa48b[_0x12fc('0x20')][_0x12fc('0x25')],function(_0xaa4004){return{'model':db[_0xaa4004[_0x12fc('0x26')]],'as':_0xaa4004['as'],'attributes':_0xaa4004[_0x12fc('0x22')],'include':_0xaa4004['include']?_[_0x12fc('0x24')](_0xaa4004[_0x12fc('0x25')],function(_0x51666d){return{'model':db[_0x51666d['model']],'as':_0x51666d['as'],'attributes':_0x51666d[_0x12fc('0x22')],'include':_0x51666d[_0x12fc('0x25')]?_[_0x12fc('0x24')](_0x51666d['include'],function(_0x420394){return{'model':db[_0x420394['model']],'as':_0x420394['as'],'attributes':_0x420394['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37a585){logger[_0x12fc('0x13')]('GetSmsQueue',_0x4fa48b);logger[_0x12fc('0x16')](_0x12fc('0x1d'),_0x4fa48b,JSON[_0x12fc('0x18')](_0x37a585));_0x2c030f(_0x37a585);})[_0x12fc('0x1c')](function(_0xbcc3e1){logger['error'](_0x12fc('0x1d'),_0xbcc3e1['message'],_0x4fa48b);_0x13ae63(_0xdec7e4[_0x12fc('0x19')](0x1f4,_0xbcc3e1[_0x12fc('0x1b')]));});});};exports[_0x12fc('0x27')]=function(_0x64fb0a){var _0x4c2267=this;return new Promise(function(_0x54112c,_0x4ffa6d){return db[_0x12fc('0x1e')][_0x12fc('0x28')]({'raw':_0x64fb0a[_0x12fc('0x20')]?_0x64fb0a['options']['raw']===undefined?!![]:![]:!![],'where':_0x64fb0a['options']?_0x64fb0a['options']['where']||null:null,'attributes':_0x64fb0a[_0x12fc('0x20')]?_0x64fb0a[_0x12fc('0x20')]['attributes']||null:null,'include':_0x64fb0a[_0x12fc('0x20')]?_0x64fb0a[_0x12fc('0x20')]['include']?_[_0x12fc('0x24')](_0x64fb0a[_0x12fc('0x20')]['include'],function(_0x18f22b){return{'model':db[_0x18f22b[_0x12fc('0x26')]],'as':_0x18f22b['as'],'attributes':_0x18f22b['attributes'],'include':_0x18f22b['include']?_[_0x12fc('0x24')](_0x18f22b[_0x12fc('0x25')],function(_0x2aa621){return{'model':db[_0x2aa621['model']],'as':_0x2aa621['as'],'attributes':_0x2aa621[_0x12fc('0x22')],'include':_0x2aa621['include']?_['map'](_0x2aa621[_0x12fc('0x25')],function(_0x48df2a){return{'model':db[_0x48df2a[_0x12fc('0x26')]],'as':_0x48df2a['as'],'attributes':_0x48df2a[_0x12fc('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37cfcf){logger['info'](_0x12fc('0x27'),_0x64fb0a);logger['debug'](_0x12fc('0x27'),_0x64fb0a,JSON[_0x12fc('0x18')](_0x37cfcf));_0x54112c(_0x37cfcf);})[_0x12fc('0x1c')](function(_0x20d6aa){logger[_0x12fc('0x19')](_0x12fc('0x27'),_0x20d6aa[_0x12fc('0x1b')],_0x64fb0a);_0x4ffa6d(_0x4c2267[_0x12fc('0x19')](0x1f4,_0x20d6aa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f766ee2..ed1a8c8 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 _0x5893=['emit','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5893,0xf4));var _0x3589=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5893[_0x4565bf];return _0x5610ba;};'use strict';var SmsQueueEvents=require(_0x3589('0x0'));var events=[_0x3589('0x1'),_0x3589('0x2'),_0x3589('0x3')];function createListener(_0x5d581c,_0x2cc685){return function(_0xa15702){_0x2cc685[_0x3589('0x4')](_0x5d581c,_0xa15702);};}function removeListener(_0x17b2f2,_0x392f69){return function(){SmsQueueEvents['removeListener'](_0x17b2f2,_0x392f69);};}exports[_0x3589('0x5')]=function(_0xf8c969){for(var _0x14ef4a=0x0,_0xa57997=events[_0x3589('0x6')];_0x14ef4a<_0xa57997;_0x14ef4a++){var _0x2f979d=events[_0x14ef4a];var _0x5a3474=createListener(_0x3589('0x7')+_0x2f979d,_0xf8c969);SmsQueueEvents['on'](_0x2f979d,_0x5a3474);}}; \ No newline at end of file +var _0xd773=['removeListener','length','emit'];(function(_0x4fe73b,_0x3a167f){var _0x4edd2f=function(_0x45f88b){while(--_0x45f88b){_0x4fe73b['push'](_0x4fe73b['shift']());}};_0x4edd2f(++_0x3a167f);}(_0xd773,0xf5));var _0x3d77=function(_0x4554dc,_0x228131){_0x4554dc=_0x4554dc-0x0;var _0x1fcd85=_0xd773[_0x4554dc];return _0x1fcd85;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x1c038a,_0x1f656a){return function(_0x5381dc){_0x1f656a[_0x3d77('0x0')](_0x1c038a,_0x5381dc);};}function removeListener(_0x276ce6,_0x58edda){return function(){SmsQueueEvents[_0x3d77('0x1')](_0x276ce6,_0x58edda);};}exports['register']=function(_0x2f3e02){for(var _0x938e05=0x0,_0x5d1998=events[_0x3d77('0x2')];_0x938e05<_0x5d1998;_0x938e05++){var _0x12c901=events[_0x938e05];var _0xce1e91=createListener('smsQueue:'+_0x12c901,_0x2f3e02);SmsQueueEvents['on'](_0x12c901,_0xce1e91);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8984b69..9788fb6 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 _0xd2bb=['../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2fa2d0,_0x46e330){var _0x3198d8=function(_0x1ad373){while(--_0x1ad373){_0x2fa2d0['push'](_0x2fa2d0['shift']());}};_0x3198d8(++_0x46e330);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x413029,_0x4c8388){_0x413029=_0x413029-0x0;var _0x3c47d9=_0xd2bb[_0x413029];return _0x3c47d9;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0x8')](_0xbd2b('0xd'),auth['isAuthenticated'](),controller[_0xbd2b('0xe')]);router['post']('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['put'](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);router[_0xbd2b('0x11')](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x12')]);module[_0xbd2b('0x13')]=router; \ No newline at end of file +var _0x4965=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x54044f,_0x287473){var _0x1ad1ef=function(_0x3bf5cb){while(--_0x3bf5cb){_0x54044f['push'](_0x54044f['shift']());}};_0x1ad1ef(++_0x287473);}(_0x4965,0x66));var _0x5496=function(_0x4a1315,_0x58b7d5){_0x4a1315=_0x4a1315-0x0;var _0x16125a=_0x4965[_0x4a1315];return _0x16125a;};'use strict';var multer=require(_0x5496('0x0'));var util=require(_0x5496('0x1'));var path=require(_0x5496('0x2'));var timeout=require(_0x5496('0x3'));var express=require('express');var router=express[_0x5496('0x4')]();var fs_extra=require(_0x5496('0x5'));var auth=require(_0x5496('0x6'));var interaction=require(_0x5496('0x7'));var config=require(_0x5496('0x8'));var controller=require('./smsQueueReport.controller');router[_0x5496('0x9')]('/',auth['isAuthenticated'](),controller[_0x5496('0xa')]);router['get'](_0x5496('0xb'),auth['isAuthenticated'](),controller[_0x5496('0xc')]);router[_0x5496('0x9')](_0x5496('0xd'),auth[_0x5496('0xe')](),controller['show']);router[_0x5496('0xf')]('/',auth['isAuthenticated'](),controller[_0x5496('0x10')]);router[_0x5496('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5496('0x12')]);router['delete']('/:id',auth[_0x5496('0xe')](),controller[_0x5496('0x13')]);module[_0x5496('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 49802cb..c3d835c 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 _0x90e3=['sequelize','exports','STRING','DATE','moment'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x90e3,0x9a));var _0x390e=function(_0x537b3c,_0x12aff2){_0x537b3c=_0x537b3c-0x0;var _0x3d9d55=_0x90e3[_0x537b3c];return _0x3d9d55;};'use strict';var moment=require(_0x390e('0x0'));var Sequelize=require(_0x390e('0x1'));module[_0x390e('0x2')]={'uniqueid':{'type':Sequelize[_0x390e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x390e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x390e('0x4')]},'exitAt':{'type':Sequelize[_0x390e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa39b=['exports','STRING','DATE','moment','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa39b,0xee));var _0xba39=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa39b[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xba39('0x0'));var Sequelize=require(_0xba39('0x1'));module[_0xba39('0x2')]={'uniqueid':{'type':Sequelize[_0xba39('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xba39('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xba39('0x4')]},'exitAt':{'type':Sequelize[_0xba39('0x4')]},'reason':{'type':Sequelize[_0xba39('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 99c7f3a..85d01c4 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 _0x16c7=['limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','index','map','SmsQueueReport','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','catch','merge','options','create','body','find','params','describe','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x4f134d,_0x8f0662){var _0x3a93d2=function(_0x292c4c){while(--_0x292c4c){_0x4f134d['push'](_0x4f134d['shift']());}};_0x3a93d2(++_0x8f0662);}(_0x16c7,0x80));var _0x716c=function(_0x1e217e,_0x391520){_0x1e217e=_0x1e217e-0x0;var _0x5c9d7b=_0x16c7[_0x1e217e];return _0x5c9d7b;};'use strict';var emlformat=require(_0x716c('0x0'));var rimraf=require(_0x716c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716c('0x2'));var rp=require(_0x716c('0x3'));var moment=require(_0x716c('0x4'));var BPromise=require(_0x716c('0x5'));var Mustache=require(_0x716c('0x6'));var util=require(_0x716c('0x7'));var path=require(_0x716c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x716c('0x9'));var fs=require('fs');var fs_extra=require(_0x716c('0xa'));var _=require(_0x716c('0xb'));var squel=require(_0x716c('0xc'));var crypto=require(_0x716c('0xd'));var jsforce=require(_0x716c('0xe'));var deskjs=require(_0x716c('0xf'));var toCsv=require(_0x716c('0x10'));var querystring=require(_0x716c('0x11'));var Papa=require(_0x716c('0x12'));var Redis=require(_0x716c('0x13'));var authService=require(_0x716c('0x14'));var qs=require(_0x716c('0x15'));var as=require(_0x716c('0x16'));var hardwareService=require(_0x716c('0x17'));var logger=require(_0x716c('0x18'))(_0x716c('0x19'));var utils=require(_0x716c('0x1a'));var config=require(_0x716c('0x1b'));var licenseUtil=require(_0x716c('0x1c'));var db=require(_0x716c('0x1d'))['db'];function respondWithStatusCode(_0x4e608d,_0x3dd84){_0x3dd84=_0x3dd84||0xcc;return function(_0x2a33c6){if(_0x2a33c6){return _0x4e608d['sendStatus'](_0x3dd84);}return _0x4e608d[_0x716c('0x1e')](_0x3dd84)['end']();};}function respondWithResult(_0x33f55f,_0x295ac2){_0x295ac2=_0x295ac2||0xc8;return function(_0x5b61fe){if(_0x5b61fe){return _0x33f55f[_0x716c('0x1e')](_0x295ac2)[_0x716c('0x1f')](_0x5b61fe);}};}function respondWithFilteredResult(_0x6c41fa,_0x9b1be2){return function(_0x16615a){if(_0x16615a){var _0x1b1a66=typeof _0x9b1be2['offset']==='undefined'&&typeof _0x9b1be2[_0x716c('0x20')]===_0x716c('0x21');var _0x334854=_0x16615a['count'];var _0x38d6f5=_0x1b1a66?0x0:_0x9b1be2[_0x716c('0x22')];var _0x409a63=_0x1b1a66?_0x16615a[_0x716c('0x23')]:_0x9b1be2[_0x716c('0x22')]+_0x9b1be2[_0x716c('0x20')];var _0x1baae3;if(_0x409a63>=_0x334854){_0x409a63=_0x334854;_0x1baae3=0xc8;}else{_0x1baae3=0xce;}_0x6c41fa[_0x716c('0x1e')](_0x1baae3);return _0x6c41fa[_0x716c('0x24')](_0x716c('0x25'),_0x38d6f5+'-'+_0x409a63+'/'+_0x334854)['json'](_0x16615a);}return null;};}function patchUpdates(_0x48c0fa){return function(_0x3b4394){try{jsonpatch[_0x716c('0x26')](_0x3b4394,_0x48c0fa,!![]);}catch(_0x548b0e){return BPromise[_0x716c('0x27')](_0x548b0e);}return _0x3b4394[_0x716c('0x28')]();};}function saveUpdates(_0x482576,_0x4d5d38){return function(_0x88eab3){if(_0x88eab3){return _0x88eab3[_0x716c('0x29')](_0x482576)[_0x716c('0x2a')](function(_0x44a5cb){return _0x44a5cb;});}return null;};}function removeEntity(_0x10d215,_0x3d27f3){return function(_0x29c9f7){if(_0x29c9f7){return _0x29c9f7[_0x716c('0x2b')]()[_0x716c('0x2a')](function(){_0x10d215[_0x716c('0x1e')](0xcc)[_0x716c('0x2c')]();});}};}function handleEntityNotFound(_0x128a7b,_0x16cc14){return function(_0x450a5a){if(!_0x450a5a){_0x128a7b[_0x716c('0x2d')](0x194);}return _0x450a5a;};}function handleError(_0x230809,_0x2ada0d){_0x2ada0d=_0x2ada0d||0x1f4;return function(_0x544055){logger[_0x716c('0x2e')](_0x544055[_0x716c('0x2f')]);if(_0x544055['name']){delete _0x544055['name'];}_0x230809[_0x716c('0x1e')](_0x2ada0d)['send'](_0x544055);};}exports[_0x716c('0x30')]=function(_0x2c81af,_0xc7292d){var _0x7cc450={},_0x38dd8a={},_0x2d1f70={'count':0x0,'rows':[]};var _0x3d9fe4=_[_0x716c('0x31')](db[_0x716c('0x32')]['rawAttributes'],function(_0x217c11){return{'name':_0x217c11[_0x716c('0x33')],'type':_0x217c11['type'][_0x716c('0x34')]};});_0x38dd8a['model']=_[_0x716c('0x31')](_0x3d9fe4,_0x716c('0x35'));_0x38dd8a[_0x716c('0x36')]=_[_0x716c('0x37')](_0x2c81af['query']);_0x38dd8a[_0x716c('0x38')]=_['intersection'](_0x38dd8a[_0x716c('0x39')],_0x38dd8a[_0x716c('0x36')]);_0x7cc450[_0x716c('0x3a')]=_[_0x716c('0x3b')](_0x38dd8a[_0x716c('0x39')],qs[_0x716c('0x3c')](_0x2c81af['query'][_0x716c('0x3c')]));_0x7cc450['attributes']=_0x7cc450[_0x716c('0x3a')]['length']?_0x7cc450['attributes']:_0x38dd8a['model'];if(!_0x2c81af['query'][_0x716c('0x3d')](_0x716c('0x3e'))){_0x7cc450['limit']=qs['limit'](_0x2c81af[_0x716c('0x36')][_0x716c('0x20')]);_0x7cc450['offset']=qs[_0x716c('0x22')](_0x2c81af[_0x716c('0x36')]['offset']);}_0x7cc450[_0x716c('0x3f')]=qs['sort'](_0x2c81af[_0x716c('0x36')][_0x716c('0x40')]);_0x7cc450[_0x716c('0x41')]=qs['filters'](_[_0x716c('0x42')](_0x2c81af['query'],_0x38dd8a[_0x716c('0x38')]),_0x3d9fe4);if(_0x2c81af[_0x716c('0x36')][_0x716c('0x43')]){_0x7cc450[_0x716c('0x41')]=_['merge'](_0x7cc450[_0x716c('0x41')],{'$or':_['map'](_0x3d9fe4,function(_0x114919){if(_0x114919['type']!==_0x716c('0x44')){var _0x42d992={};_0x42d992[_0x114919[_0x716c('0x35')]]={'$like':'%'+_0x2c81af[_0x716c('0x36')][_0x716c('0x43')]+'%'};return _0x42d992;}})});}_0x7cc450=_['merge']({},_0x7cc450,_0x2c81af['options']);var _0x236307={'where':_0x7cc450[_0x716c('0x41')]};return db['SmsQueueReport']['count'](_0x236307)[_0x716c('0x2a')](function(_0x59c94d){_0x2d1f70[_0x716c('0x23')]=_0x59c94d;if(_0x2c81af[_0x716c('0x36')][_0x716c('0x45')]){_0x7cc450[_0x716c('0x46')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x7cc450);})[_0x716c('0x2a')](function(_0x1e698c){_0x2d1f70[_0x716c('0x47')]=_0x1e698c;return _0x2d1f70;})[_0x716c('0x2a')](respondWithFilteredResult(_0xc7292d,_0x7cc450))[_0x716c('0x48')](handleError(_0xc7292d,null));};exports['show']=function(_0x271e78,_0x2f6e84){var _0x26cf42={'raw':!![],'where':{'id':_0x271e78['params']['id']}},_0xf26bb9={};_0xf26bb9[_0x716c('0x39')]=_[_0x716c('0x37')](db[_0x716c('0x32')]['rawAttributes']);_0xf26bb9[_0x716c('0x36')]=_['keys'](_0x271e78[_0x716c('0x36')]);_0xf26bb9[_0x716c('0x38')]=_[_0x716c('0x3b')](_0xf26bb9[_0x716c('0x39')],_0xf26bb9['query']);_0x26cf42[_0x716c('0x3a')]=_['intersection'](_0xf26bb9[_0x716c('0x39')],qs[_0x716c('0x3c')](_0x271e78[_0x716c('0x36')][_0x716c('0x3c')]));_0x26cf42[_0x716c('0x3a')]=_0x26cf42[_0x716c('0x3a')]['length']?_0x26cf42[_0x716c('0x3a')]:_0xf26bb9['model'];if(_0x271e78[_0x716c('0x36')][_0x716c('0x45')]){_0x26cf42[_0x716c('0x46')]=[{'all':!![]}];}_0x26cf42=_[_0x716c('0x49')]({},_0x26cf42,_0x271e78[_0x716c('0x4a')]);return db['SmsQueueReport']['find'](_0x26cf42)[_0x716c('0x2a')](handleEntityNotFound(_0x2f6e84,null))[_0x716c('0x2a')](respondWithResult(_0x2f6e84,null))[_0x716c('0x48')](handleError(_0x2f6e84,null));};exports['create']=function(_0x23de59,_0x29c4af){return db[_0x716c('0x32')][_0x716c('0x4b')](_0x23de59[_0x716c('0x4c')],{})[_0x716c('0x2a')](respondWithResult(_0x29c4af,0xc9))[_0x716c('0x48')](handleError(_0x29c4af,null));};exports[_0x716c('0x29')]=function(_0x57ed0c,_0x1f3264){if(_0x57ed0c[_0x716c('0x4c')]['id']){delete _0x57ed0c[_0x716c('0x4c')]['id'];}return db[_0x716c('0x32')][_0x716c('0x4d')]({'where':{'id':_0x57ed0c['params']['id']}})[_0x716c('0x2a')](handleEntityNotFound(_0x1f3264,null))['then'](saveUpdates(_0x57ed0c[_0x716c('0x4c')],null))[_0x716c('0x2a')](respondWithResult(_0x1f3264,null))[_0x716c('0x48')](handleError(_0x1f3264,null));};exports[_0x716c('0x2b')]=function(_0x2055b1,_0x44db84){return db[_0x716c('0x32')][_0x716c('0x4d')]({'where':{'id':_0x2055b1[_0x716c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44db84,null))[_0x716c('0x2a')](removeEntity(_0x44db84,null))[_0x716c('0x48')](handleError(_0x44db84,null));};exports[_0x716c('0x4f')]=function(_0x5a9519,_0x113e1b){return db[_0x716c('0x32')][_0x716c('0x4f')]()['then'](respondWithResult(_0x113e1b,null))[_0x716c('0x48')](handleError(_0x113e1b,null));}; \ No newline at end of file +var _0xb1f3=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','SmsQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel'];(function(_0x1f6acd,_0x95357e){var _0x2fba91=function(_0x501e36){while(--_0x501e36){_0x1f6acd['push'](_0x1f6acd['shift']());}};_0x2fba91(++_0x95357e);}(_0xb1f3,0xc1));var _0x3b1f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1f3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3b1f('0x0'));var rimraf=require(_0x3b1f('0x1'));var zipdir=require(_0x3b1f('0x2'));var jsonpatch=require(_0x3b1f('0x3'));var rp=require('request-promise');var moment=require(_0x3b1f('0x4'));var BPromise=require(_0x3b1f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b1f('0x6'));var sox=require('sox');var csv=require(_0x3b1f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b1f('0x8'));var _=require(_0x3b1f('0x9'));var squel=require(_0x3b1f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b1f('0xb'));var toCsv=require(_0x3b1f('0x7'));var querystring=require(_0x3b1f('0xc'));var Papa=require('papaparse');var Redis=require(_0x3b1f('0xd'));var authService=require(_0x3b1f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3b1f('0xf'));var hardwareService=require(_0x3b1f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3b1f('0x11'));var config=require(_0x3b1f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b1f('0x13'))['db'];function respondWithStatusCode(_0x281ff3,_0x19a2a6){_0x19a2a6=_0x19a2a6||0xcc;return function(_0x371c82){if(_0x371c82){return _0x281ff3['sendStatus'](_0x19a2a6);}return _0x281ff3[_0x3b1f('0x14')](_0x19a2a6)['end']();};}function respondWithResult(_0x558dfc,_0x28e13b){_0x28e13b=_0x28e13b||0xc8;return function(_0x543d1c){if(_0x543d1c){return _0x558dfc[_0x3b1f('0x14')](_0x28e13b)[_0x3b1f('0x15')](_0x543d1c);}};}function respondWithFilteredResult(_0x34b8cb,_0x242ceb){return function(_0x115ce0){if(_0x115ce0){var _0x3dce15=typeof _0x242ceb[_0x3b1f('0x16')]==='undefined'&&typeof _0x242ceb[_0x3b1f('0x17')]===_0x3b1f('0x18');var _0x19c53b=_0x115ce0[_0x3b1f('0x19')];var _0x4397ac=_0x3dce15?0x0:_0x242ceb[_0x3b1f('0x16')];var _0x387363=_0x3dce15?_0x115ce0[_0x3b1f('0x19')]:_0x242ceb[_0x3b1f('0x16')]+_0x242ceb[_0x3b1f('0x17')];var _0x57914d;if(_0x387363>=_0x19c53b){_0x387363=_0x19c53b;_0x57914d=0xc8;}else{_0x57914d=0xce;}_0x34b8cb[_0x3b1f('0x14')](_0x57914d);return _0x34b8cb[_0x3b1f('0x1a')](_0x3b1f('0x1b'),_0x4397ac+'-'+_0x387363+'/'+_0x19c53b)[_0x3b1f('0x15')](_0x115ce0);}return null;};}function patchUpdates(_0x4cdf07){return function(_0x4b73d9){try{jsonpatch[_0x3b1f('0x1c')](_0x4b73d9,_0x4cdf07,!![]);}catch(_0x58c54f){return BPromise['reject'](_0x58c54f);}return _0x4b73d9[_0x3b1f('0x1d')]();};}function saveUpdates(_0x478658,_0x2bd91c){return function(_0x143459){if(_0x143459){return _0x143459['update'](_0x478658)[_0x3b1f('0x1e')](function(_0x298e00){return _0x298e00;});}return null;};}function removeEntity(_0x25e897,_0x346629){return function(_0x4d5275){if(_0x4d5275){return _0x4d5275[_0x3b1f('0x1f')]()['then'](function(){_0x25e897[_0x3b1f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539e78,_0x17eb1a){return function(_0x2a4f98){if(!_0x2a4f98){_0x539e78[_0x3b1f('0x20')](0x194);}return _0x2a4f98;};}function handleError(_0x53a489,_0x1b6c2c){_0x1b6c2c=_0x1b6c2c||0x1f4;return function(_0x31a5c3){logger['error'](_0x31a5c3[_0x3b1f('0x21')]);if(_0x31a5c3[_0x3b1f('0x22')]){delete _0x31a5c3['name'];}_0x53a489[_0x3b1f('0x14')](_0x1b6c2c)[_0x3b1f('0x23')](_0x31a5c3);};}exports[_0x3b1f('0x24')]=function(_0x28b688,_0x527688){var _0x265697={},_0x5297d9={},_0x441ec4={'count':0x0,'rows':[]};var _0x111785=_['map'](db['SmsQueueReport'][_0x3b1f('0x25')],function(_0x231161){return{'name':_0x231161['fieldName'],'type':_0x231161['type'][_0x3b1f('0x26')]};});_0x5297d9[_0x3b1f('0x27')]=_[_0x3b1f('0x28')](_0x111785,_0x3b1f('0x22'));_0x5297d9[_0x3b1f('0x29')]=_['keys'](_0x28b688[_0x3b1f('0x29')]);_0x5297d9[_0x3b1f('0x2a')]=_[_0x3b1f('0x2b')](_0x5297d9[_0x3b1f('0x27')],_0x5297d9[_0x3b1f('0x29')]);_0x265697[_0x3b1f('0x2c')]=_[_0x3b1f('0x2b')](_0x5297d9[_0x3b1f('0x27')],qs['fields'](_0x28b688['query'][_0x3b1f('0x2d')]));_0x265697[_0x3b1f('0x2c')]=_0x265697['attributes'][_0x3b1f('0x2e')]?_0x265697['attributes']:_0x5297d9[_0x3b1f('0x27')];if(!_0x28b688['query'][_0x3b1f('0x2f')](_0x3b1f('0x30'))){_0x265697[_0x3b1f('0x17')]=qs[_0x3b1f('0x17')](_0x28b688['query'][_0x3b1f('0x17')]);_0x265697[_0x3b1f('0x16')]=qs[_0x3b1f('0x16')](_0x28b688['query'][_0x3b1f('0x16')]);}_0x265697[_0x3b1f('0x31')]=qs[_0x3b1f('0x32')](_0x28b688['query'][_0x3b1f('0x32')]);_0x265697['where']=qs[_0x3b1f('0x2a')](_[_0x3b1f('0x33')](_0x28b688[_0x3b1f('0x29')],_0x5297d9['filters']),_0x111785);if(_0x28b688['query'][_0x3b1f('0x34')]){_0x265697['where']=_[_0x3b1f('0x35')](_0x265697[_0x3b1f('0x36')],{'$or':_[_0x3b1f('0x28')](_0x111785,function(_0x39ba77){if(_0x39ba77['type']!=='VIRTUAL'){var _0x189f0c={};_0x189f0c[_0x39ba77[_0x3b1f('0x22')]]={'$like':'%'+_0x28b688[_0x3b1f('0x29')]['filter']+'%'};return _0x189f0c;}})});}_0x265697=_[_0x3b1f('0x35')]({},_0x265697,_0x28b688[_0x3b1f('0x37')]);var _0x1a4b86={'where':_0x265697[_0x3b1f('0x36')]};return db[_0x3b1f('0x38')]['count'](_0x1a4b86)['then'](function(_0x4fb112){_0x441ec4[_0x3b1f('0x19')]=_0x4fb112;if(_0x28b688['query'][_0x3b1f('0x39')]){_0x265697[_0x3b1f('0x3a')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x3b1f('0x3b')](_0x265697);})[_0x3b1f('0x1e')](function(_0x36ccd0){_0x441ec4[_0x3b1f('0x3c')]=_0x36ccd0;return _0x441ec4;})['then'](respondWithFilteredResult(_0x527688,_0x265697))['catch'](handleError(_0x527688,null));};exports[_0x3b1f('0x3d')]=function(_0xa922c4,_0x318651){var _0x3599e7={'raw':!![],'where':{'id':_0xa922c4[_0x3b1f('0x3e')]['id']}},_0x5de738={};_0x5de738[_0x3b1f('0x27')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x5de738[_0x3b1f('0x29')]=_['keys'](_0xa922c4[_0x3b1f('0x29')]);_0x5de738[_0x3b1f('0x2a')]=_[_0x3b1f('0x2b')](_0x5de738[_0x3b1f('0x27')],_0x5de738[_0x3b1f('0x29')]);_0x3599e7[_0x3b1f('0x2c')]=_[_0x3b1f('0x2b')](_0x5de738[_0x3b1f('0x27')],qs[_0x3b1f('0x2d')](_0xa922c4[_0x3b1f('0x29')][_0x3b1f('0x2d')]));_0x3599e7[_0x3b1f('0x2c')]=_0x3599e7['attributes'][_0x3b1f('0x2e')]?_0x3599e7['attributes']:_0x5de738[_0x3b1f('0x27')];if(_0xa922c4[_0x3b1f('0x29')][_0x3b1f('0x39')]){_0x3599e7[_0x3b1f('0x3a')]=[{'all':!![]}];}_0x3599e7=_['merge']({},_0x3599e7,_0xa922c4[_0x3b1f('0x37')]);return db[_0x3b1f('0x38')][_0x3b1f('0x3f')](_0x3599e7)[_0x3b1f('0x1e')](handleEntityNotFound(_0x318651,null))[_0x3b1f('0x1e')](respondWithResult(_0x318651,null))[_0x3b1f('0x40')](handleError(_0x318651,null));};exports['create']=function(_0xe597e6,_0x5719c0){return db[_0x3b1f('0x38')][_0x3b1f('0x41')](_0xe597e6[_0x3b1f('0x42')],{})[_0x3b1f('0x1e')](respondWithResult(_0x5719c0,0xc9))['catch'](handleError(_0x5719c0,null));};exports['update']=function(_0x26a14a,_0x1310a2){if(_0x26a14a[_0x3b1f('0x42')]['id']){delete _0x26a14a[_0x3b1f('0x42')]['id'];}return db['SmsQueueReport'][_0x3b1f('0x3f')]({'where':{'id':_0x26a14a[_0x3b1f('0x3e')]['id']}})[_0x3b1f('0x1e')](handleEntityNotFound(_0x1310a2,null))[_0x3b1f('0x1e')](saveUpdates(_0x26a14a['body'],null))[_0x3b1f('0x1e')](respondWithResult(_0x1310a2,null))[_0x3b1f('0x40')](handleError(_0x1310a2,null));};exports[_0x3b1f('0x1f')]=function(_0x340b57,_0x599c70){return db[_0x3b1f('0x38')][_0x3b1f('0x3f')]({'where':{'id':_0x340b57[_0x3b1f('0x3e')]['id']}})[_0x3b1f('0x1e')](handleEntityNotFound(_0x599c70,null))['then'](removeEntity(_0x599c70,null))[_0x3b1f('0x40')](handleError(_0x599c70,null));};exports[_0x3b1f('0x43')]=function(_0x3fe7d3,_0x573a6a){return db['SmsQueueReport'][_0x3b1f('0x43')]()[_0x3b1f('0x1e')](respondWithResult(_0x573a6a,null))[_0x3b1f('0x40')](handleError(_0x573a6a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 044ca44..dc6fc64 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x40b5e3,_0x3ea22a){var _0x43b462=function(_0x5c507c){while(--_0x5c507c){_0x40b5e3['push'](_0x40b5e3['shift']());}};_0x43b462(++_0x3ea22a);}(_0x70e0,0x17b));var _0x070e=function(_0x2c2b60,_0x6ee94b){_0x2c2b60=_0x2c2b60-0x0;var _0x14e575=_0x70e0[_0x2c2b60];return _0x14e575;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x16d578,_0x3cbca3){var _0x3c0177=function(_0x57032a){while(--_0x57032a){_0x16d578['push'](_0x16d578['shift']());}};_0x3c0177(++_0x3cbca3);}(_0xe706,0xa3));var _0x6e70=function(_0x10b4d3,_0x12e69b){_0x10b4d3=_0x10b4d3-0x0;var _0x12615b=_0xe706[_0x10b4d3];return _0x12615b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1b4f8a6..6642e5b 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 _0x359f=['message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','create','options','raw','then','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','debug','stringify','error','code'];(function(_0x1db95a,_0x7cc40f){var _0x3bdc00=function(_0x266b3a){while(--_0x266b3a){_0x1db95a['push'](_0x1db95a['shift']());}};_0x3bdc00(++_0x7cc40f);}(_0x359f,0xda));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf359('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf359('0x1'));var fs=require('fs');var Redis=require(_0xf359('0x2'));var db=require(_0xf359('0x3'))['db'];var utils=require(_0xf359('0x4'));var logger=require(_0xf359('0x5'))(_0xf359('0x6'));var config=require(_0xf359('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xab2dd9,_0x3b8fea,_0xc698eb){return new BPromise(function(_0x1f197e,_0x53bbeb){return client['request'](_0xab2dd9,_0xc698eb)['then'](function(_0x314f48){logger[_0xf359('0x8')]('SmsQueueReport,\x20%s,\x20%s',_0x3b8fea,_0xf359('0x9'));logger[_0xf359('0xa')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3b8fea,'request\x20sent',JSON[_0xf359('0xb')](_0x314f48));if(_0x314f48['error']){if(_0x314f48[_0xf359('0xc')][_0xf359('0xd')]===0x1f4){logger[_0xf359('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x3b8fea,_0x314f48[_0xf359('0xc')][_0xf359('0xe')]);return _0x53bbeb(_0x314f48[_0xf359('0xc')][_0xf359('0xe')]);}logger['error'](_0xf359('0xf'),_0x3b8fea,_0x314f48[_0xf359('0xc')][_0xf359('0xe')]);return _0x1f197e(_0x314f48[_0xf359('0xc')][_0xf359('0xe')]);}else{logger[_0xf359('0x8')](_0xf359('0xf'),_0x3b8fea,'request\x20sent');_0x1f197e(_0x314f48[_0xf359('0x10')][_0xf359('0xe')]);}})[_0xf359('0x11')](function(_0xe272e){logger['error'](_0xf359('0xf'),_0x3b8fea,_0xe272e);_0x53bbeb(_0xe272e);});});}exports[_0xf359('0x12')]=function(_0x216306){var _0x2768aa=this;return new Promise(function(_0x239ed7,_0x199a65){return db['SmsQueueReport'][_0xf359('0x13')](_0x216306['body'],{'raw':_0x216306[_0xf359('0x14')]?_0x216306[_0xf359('0x14')][_0xf359('0x15')]===undefined?!![]:![]:!![]})[_0xf359('0x16')](function(_0x60826d){logger[_0xf359('0x8')](_0xf359('0x12'),_0x216306);logger['debug'](_0xf359('0x12'),_0x216306,JSON[_0xf359('0xb')](_0x60826d));_0x239ed7(_0x60826d);})['catch'](function(_0x1efb0b){logger[_0xf359('0xc')](_0xf359('0x12'),_0x1efb0b[_0xf359('0xe')],_0x216306);_0x199a65(_0x2768aa['error'](0x1f4,_0x1efb0b['message']));});});};exports[_0xf359('0x17')]=function(_0x4521e3){var _0x4de3dd=this;return new Promise(function(_0xa0e44b,_0x195b11){return db['SmsQueueReport'][_0xf359('0x18')](_0x4521e3[_0xf359('0x19')],{'raw':_0x4521e3[_0xf359('0x14')]?_0x4521e3[_0xf359('0x14')][_0xf359('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4521e3[_0xf359('0x14')]?_0x4521e3[_0xf359('0x14')][_0xf359('0x1a')]||null:null,'attributes':_0x4521e3[_0xf359('0x14')]?_0x4521e3[_0xf359('0x14')][_0xf359('0x1b')]||null:null,'limit':_0x4521e3['options']?_0x4521e3[_0xf359('0x14')][_0xf359('0x1c')]||null:null})[_0xf359('0x16')](function(_0x3fb649){logger[_0xf359('0x8')](_0xf359('0x17'),_0x4521e3);logger[_0xf359('0xa')](_0xf359('0x17'),_0x4521e3,JSON[_0xf359('0xb')](_0x3fb649));_0xa0e44b(_0x3fb649);})[_0xf359('0x11')](function(_0x33d5b6){logger['error'](_0xf359('0x17'),_0x33d5b6['message'],_0x4521e3);_0x195b11(_0x4de3dd['error'](0x1f4,_0x33d5b6[_0xf359('0xe')]));});});}; \ No newline at end of file +var _0xdbf9=['jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSmsQueueReport','SmsQueueReport','body','then','UpdateSmsQueueReport','update','options','raw','where','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xdbf9,0x1e8));var _0x9dbf=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdbf9[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x9dbf('0x0'));var util=require('util');var moment=require(_0x9dbf('0x1'));var BPromise=require('bluebird');var rs=require(_0x9dbf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dbf('0x3'))['db'];var utils=require(_0x9dbf('0x4'));var logger=require(_0x9dbf('0x5'))(_0x9dbf('0x6'));var config=require(_0x9dbf('0x7'));var jayson=require(_0x9dbf('0x8'));var client=jayson[_0x9dbf('0x9')][_0x9dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x128e95,_0x45ff42,_0x1c9acc){return new BPromise(function(_0x457fe8,_0x32ed57){return client['request'](_0x128e95,_0x1c9acc)['then'](function(_0x1d9be3){logger[_0x9dbf('0xb')](_0x9dbf('0xc'),_0x45ff42,_0x9dbf('0xd'));logger[_0x9dbf('0xe')](_0x9dbf('0xf'),_0x45ff42,_0x9dbf('0xd'),JSON[_0x9dbf('0x10')](_0x1d9be3));if(_0x1d9be3['error']){if(_0x1d9be3[_0x9dbf('0x11')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x45ff42,_0x1d9be3['error'][_0x9dbf('0x12')]);return _0x32ed57(_0x1d9be3[_0x9dbf('0x11')]['message']);}logger['error'](_0x9dbf('0xc'),_0x45ff42,_0x1d9be3[_0x9dbf('0x11')][_0x9dbf('0x12')]);return _0x457fe8(_0x1d9be3[_0x9dbf('0x11')][_0x9dbf('0x12')]);}else{logger[_0x9dbf('0xb')](_0x9dbf('0xc'),_0x45ff42,_0x9dbf('0xd'));_0x457fe8(_0x1d9be3['result'][_0x9dbf('0x12')]);}})[_0x9dbf('0x13')](function(_0x5128b2){logger[_0x9dbf('0x11')](_0x9dbf('0xc'),_0x45ff42,_0x5128b2);_0x32ed57(_0x5128b2);});});}exports[_0x9dbf('0x14')]=function(_0x358889){var _0x31f1e0=this;return new Promise(function(_0x2374aa,_0xc16fac){return db[_0x9dbf('0x15')]['create'](_0x358889[_0x9dbf('0x16')],{'raw':_0x358889['options']?_0x358889['options']['raw']===undefined?!![]:![]:!![]})[_0x9dbf('0x17')](function(_0x109dee){logger[_0x9dbf('0xb')](_0x9dbf('0x14'),_0x358889);logger[_0x9dbf('0xe')](_0x9dbf('0x14'),_0x358889,JSON[_0x9dbf('0x10')](_0x109dee));_0x2374aa(_0x109dee);})[_0x9dbf('0x13')](function(_0x55a250){logger[_0x9dbf('0x11')](_0x9dbf('0x14'),_0x55a250[_0x9dbf('0x12')],_0x358889);_0xc16fac(_0x31f1e0[_0x9dbf('0x11')](0x1f4,_0x55a250['message']));});});};exports[_0x9dbf('0x18')]=function(_0x546897){var _0x3b384e=this;return new Promise(function(_0x18eec8,_0x534abf){return db[_0x9dbf('0x15')][_0x9dbf('0x19')](_0x546897['body'],{'raw':_0x546897[_0x9dbf('0x1a')]?_0x546897[_0x9dbf('0x1a')][_0x9dbf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546897[_0x9dbf('0x1a')]?_0x546897['options'][_0x9dbf('0x1c')]||null:null,'attributes':_0x546897[_0x9dbf('0x1a')]?_0x546897[_0x9dbf('0x1a')][_0x9dbf('0x1d')]||null:null,'limit':_0x546897[_0x9dbf('0x1a')]?_0x546897[_0x9dbf('0x1a')][_0x9dbf('0x1e')]||null:null})['then'](function(_0x2a048c){logger[_0x9dbf('0xb')]('UpdateSmsQueueReport',_0x546897);logger[_0x9dbf('0xe')](_0x9dbf('0x18'),_0x546897,JSON[_0x9dbf('0x10')](_0x2a048c));_0x18eec8(_0x2a048c);})[_0x9dbf('0x13')](function(_0x5cbbaa){logger[_0x9dbf('0x11')](_0x9dbf('0x18'),_0x5cbbaa[_0x9dbf('0x12')],_0x546897);_0x534abf(_0x3b384e['error'](0x1f4,_0x5cbbaa[_0x9dbf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 657e956..31032d0 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 _0x06f4=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe','put','delete','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x5038d4,_0x4ff6c1){var _0x14f3f3=function(_0x5926d3){while(--_0x5926d3){_0x5038d4['push'](_0x5038d4['shift']());}};_0x14f3f3(++_0x4ff6c1);}(_0x06f4,0x136));var _0x406f=function(_0x5d5a7e,_0xd43770){_0x5d5a7e=_0x5d5a7e-0x0;var _0xf31553=_0x06f4[_0x5d5a7e];return _0xf31553;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/describe',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller['show']);router['post']('/',auth[_0x406f('0x8')](),controller['create']);router[_0x406f('0xa')]('/:id',auth[_0x406f('0x8')](),controller['update']);router[_0x406f('0xb')](_0x406f('0xc'),auth['isAuthenticated'](),controller[_0x406f('0xd')]);module[_0x406f('0xe')]=router; \ No newline at end of file +var _0x61a5=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x61a5,0xf0));var _0x561a=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x61a5[_0x40b2ed];return _0x18397d;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./smsTransferReport.controller');router[_0x561a('0x8')]('/',auth[_0x561a('0x9')](),controller[_0x561a('0xa')]);router[_0x561a('0x8')](_0x561a('0xb'),auth[_0x561a('0x9')](),controller[_0x561a('0xc')]);router['get'](_0x561a('0xd'),auth['isAuthenticated'](),controller[_0x561a('0xe')]);router[_0x561a('0xf')]('/',auth['isAuthenticated'](),controller[_0x561a('0x10')]);router[_0x561a('0x11')]('/:id',auth[_0x561a('0x9')](),controller['update']);router[_0x561a('0x12')](_0x561a('0xd'),auth[_0x561a('0x9')](),controller[_0x561a('0x13')]);module[_0x561a('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 85174f8..e4e3dde 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4a01c4,_0x27f91c){var _0xab0a55=function(_0x98f4b7){while(--_0x98f4b7){_0x4a01c4['push'](_0x4a01c4['shift']());}};_0xab0a55(++_0x27f91c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'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(_0xf5c7bf,_0x3a157d){var _0x1425e6=function(_0x1124f1){while(--_0x1124f1){_0xf5c7bf['push'](_0xf5c7bf['shift']());}};_0x1425e6(++_0x3a157d);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 17e47ba..80b33a1 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 _0x3129=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','SmsTransferReport','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','name','filter','options','findAll','catch','rawAttributes','includeAll','create','body','find','params','describe','eml-format','zip-dir'];(function(_0x55c198,_0x33efa0){var _0x225c1b=function(_0x20342c){while(--_0x20342c){_0x55c198['push'](_0x55c198['shift']());}};_0x225c1b(++_0x33efa0);}(_0x3129,0x14d));var _0x9312=function(_0x2c4178,_0x5802a5){_0x2c4178=_0x2c4178-0x0;var _0x46ed28=_0x3129[_0x2c4178];return _0x46ed28;};'use strict';var emlformat=require(_0x9312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9312('0x1'));var jsonpatch=require(_0x9312('0x2'));var rp=require(_0x9312('0x3'));var moment=require(_0x9312('0x4'));var BPromise=require(_0x9312('0x5'));var Mustache=require(_0x9312('0x6'));var util=require(_0x9312('0x7'));var path=require(_0x9312('0x8'));var sox=require(_0x9312('0x9'));var csv=require(_0x9312('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9312('0xb'));var squel=require('squel');var crypto=require(_0x9312('0xc'));var jsforce=require(_0x9312('0xd'));var deskjs=require(_0x9312('0xe'));var toCsv=require(_0x9312('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9312('0xf'));var qs=require(_0x9312('0x10'));var as=require(_0x9312('0x11'));var hardwareService=require(_0x9312('0x12'));var logger=require(_0x9312('0x13'))(_0x9312('0x14'));var utils=require(_0x9312('0x15'));var config=require(_0x9312('0x16'));var licenseUtil=require(_0x9312('0x17'));var db=require(_0x9312('0x18'))['db'];function respondWithStatusCode(_0x50a9ed,_0x51c879){_0x51c879=_0x51c879||0xcc;return function(_0x4fb1f2){if(_0x4fb1f2){return _0x50a9ed[_0x9312('0x19')](_0x51c879);}return _0x50a9ed['status'](_0x51c879)[_0x9312('0x1a')]();};}function respondWithResult(_0x49e02c,_0x2356d6){_0x2356d6=_0x2356d6||0xc8;return function(_0x1e3917){if(_0x1e3917){return _0x49e02c[_0x9312('0x1b')](_0x2356d6)['json'](_0x1e3917);}};}function respondWithFilteredResult(_0x520a28,_0x350d21){return function(_0x183178){if(_0x183178){var _0x156867=typeof _0x350d21[_0x9312('0x1c')]===_0x9312('0x1d')&&typeof _0x350d21[_0x9312('0x1e')]===_0x9312('0x1d');var _0x8949e0=_0x183178[_0x9312('0x1f')];var _0x103d58=_0x156867?0x0:_0x350d21[_0x9312('0x1c')];var _0x52e1ec=_0x156867?_0x183178[_0x9312('0x1f')]:_0x350d21[_0x9312('0x1c')]+_0x350d21[_0x9312('0x1e')];var _0x30fe36;if(_0x52e1ec>=_0x8949e0){_0x52e1ec=_0x8949e0;_0x30fe36=0xc8;}else{_0x30fe36=0xce;}_0x520a28['status'](_0x30fe36);return _0x520a28[_0x9312('0x20')](_0x9312('0x21'),_0x103d58+'-'+_0x52e1ec+'/'+_0x8949e0)['json'](_0x183178);}return null;};}function patchUpdates(_0x391103){return function(_0x12517d){try{jsonpatch[_0x9312('0x22')](_0x12517d,_0x391103,!![]);}catch(_0x125abc){return BPromise['reject'](_0x125abc);}return _0x12517d[_0x9312('0x23')]();};}function saveUpdates(_0x47732f,_0x9f6a87){return function(_0x2a31bd){if(_0x2a31bd){return _0x2a31bd[_0x9312('0x24')](_0x47732f)['then'](function(_0x1af39d){return _0x1af39d;});}return null;};}function removeEntity(_0x323730,_0x16496f){return function(_0xfe934d){if(_0xfe934d){return _0xfe934d['destroy']()[_0x9312('0x25')](function(){_0x323730[_0x9312('0x1b')](0xcc)[_0x9312('0x1a')]();});}};}function handleEntityNotFound(_0x280cdd,_0x5d179d){return function(_0x3e7b11){if(!_0x3e7b11){_0x280cdd[_0x9312('0x19')](0x194);}return _0x3e7b11;};}function handleError(_0x1603d8,_0x41b92f){_0x41b92f=_0x41b92f||0x1f4;return function(_0x2d4d3d){logger['error'](_0x2d4d3d[_0x9312('0x26')]);if(_0x2d4d3d['name']){delete _0x2d4d3d['name'];}_0x1603d8[_0x9312('0x1b')](_0x41b92f)['send'](_0x2d4d3d);};}exports['index']=function(_0x56cfa3,_0xc0f1b4){var _0xe76010={},_0x387a54={},_0x565204={'count':0x0,'rows':[]};var _0x2e70ea=_['map'](db[_0x9312('0x27')]['rawAttributes'],function(_0x17ae34){return{'name':_0x17ae34['fieldName'],'type':_0x17ae34[_0x9312('0x28')]['key']};});_0x387a54[_0x9312('0x29')]=_['map'](_0x2e70ea,'name');_0x387a54[_0x9312('0x2a')]=_[_0x9312('0x2b')](_0x56cfa3[_0x9312('0x2a')]);_0x387a54['filters']=_[_0x9312('0x2c')](_0x387a54[_0x9312('0x29')],_0x387a54[_0x9312('0x2a')]);_0xe76010[_0x9312('0x2d')]=_[_0x9312('0x2c')](_0x387a54[_0x9312('0x29')],qs[_0x9312('0x2e')](_0x56cfa3[_0x9312('0x2a')][_0x9312('0x2e')]));_0xe76010[_0x9312('0x2d')]=_0xe76010[_0x9312('0x2d')][_0x9312('0x2f')]?_0xe76010['attributes']:_0x387a54[_0x9312('0x29')];if(!_0x56cfa3[_0x9312('0x2a')][_0x9312('0x30')](_0x9312('0x31'))){_0xe76010[_0x9312('0x1e')]=qs['limit'](_0x56cfa3[_0x9312('0x2a')][_0x9312('0x1e')]);_0xe76010['offset']=qs[_0x9312('0x1c')](_0x56cfa3[_0x9312('0x2a')][_0x9312('0x1c')]);}_0xe76010[_0x9312('0x32')]=qs[_0x9312('0x33')](_0x56cfa3[_0x9312('0x2a')][_0x9312('0x33')]);_0xe76010[_0x9312('0x34')]=qs['filters'](_['pick'](_0x56cfa3['query'],_0x387a54[_0x9312('0x35')]),_0x2e70ea);if(_0x56cfa3[_0x9312('0x2a')]['filter']){_0xe76010[_0x9312('0x34')]=_[_0x9312('0x36')](_0xe76010[_0x9312('0x34')],{'$or':_['map'](_0x2e70ea,function(_0x4aa406){if(_0x4aa406[_0x9312('0x28')]!=='VIRTUAL'){var _0x24486e={};_0x24486e[_0x4aa406[_0x9312('0x37')]]={'$like':'%'+_0x56cfa3[_0x9312('0x2a')][_0x9312('0x38')]+'%'};return _0x24486e;}})});}_0xe76010=_[_0x9312('0x36')]({},_0xe76010,_0x56cfa3[_0x9312('0x39')]);var _0x464812={'where':_0xe76010[_0x9312('0x34')]};return db[_0x9312('0x27')]['count'](_0x464812)['then'](function(_0x27bd27){_0x565204[_0x9312('0x1f')]=_0x27bd27;if(_0x56cfa3['query']['includeAll']){_0xe76010['include']=[{'all':!![]}];}return db[_0x9312('0x27')][_0x9312('0x3a')](_0xe76010);})[_0x9312('0x25')](function(_0x3e268f){_0x565204['rows']=_0x3e268f;return _0x565204;})[_0x9312('0x25')](respondWithFilteredResult(_0xc0f1b4,_0xe76010))[_0x9312('0x3b')](handleError(_0xc0f1b4,null));};exports['show']=function(_0x24e45e,_0x25853a){var _0x1f0cfb={'raw':!![],'where':{'id':_0x24e45e['params']['id']}},_0x3aea68={};_0x3aea68['model']=_['keys'](db[_0x9312('0x27')][_0x9312('0x3c')]);_0x3aea68[_0x9312('0x2a')]=_[_0x9312('0x2b')](_0x24e45e[_0x9312('0x2a')]);_0x3aea68['filters']=_[_0x9312('0x2c')](_0x3aea68[_0x9312('0x29')],_0x3aea68['query']);_0x1f0cfb[_0x9312('0x2d')]=_[_0x9312('0x2c')](_0x3aea68['model'],qs[_0x9312('0x2e')](_0x24e45e[_0x9312('0x2a')][_0x9312('0x2e')]));_0x1f0cfb[_0x9312('0x2d')]=_0x1f0cfb['attributes'][_0x9312('0x2f')]?_0x1f0cfb[_0x9312('0x2d')]:_0x3aea68[_0x9312('0x29')];if(_0x24e45e[_0x9312('0x2a')][_0x9312('0x3d')]){_0x1f0cfb['include']=[{'all':!![]}];}_0x1f0cfb=_[_0x9312('0x36')]({},_0x1f0cfb,_0x24e45e[_0x9312('0x39')]);return db['SmsTransferReport']['find'](_0x1f0cfb)['then'](handleEntityNotFound(_0x25853a,null))[_0x9312('0x25')](respondWithResult(_0x25853a,null))[_0x9312('0x3b')](handleError(_0x25853a,null));};exports[_0x9312('0x3e')]=function(_0xd27ecc,_0x1490a7){return db[_0x9312('0x27')][_0x9312('0x3e')](_0xd27ecc[_0x9312('0x3f')],{})[_0x9312('0x25')](respondWithResult(_0x1490a7,0xc9))[_0x9312('0x3b')](handleError(_0x1490a7,null));};exports['update']=function(_0x35b8d9,_0x13840c){if(_0x35b8d9[_0x9312('0x3f')]['id']){delete _0x35b8d9['body']['id'];}return db[_0x9312('0x27')][_0x9312('0x40')]({'where':{'id':_0x35b8d9[_0x9312('0x41')]['id']}})['then'](handleEntityNotFound(_0x13840c,null))['then'](saveUpdates(_0x35b8d9['body'],null))[_0x9312('0x25')](respondWithResult(_0x13840c,null))['catch'](handleError(_0x13840c,null));};exports['destroy']=function(_0x368daf,_0x31c217){return db[_0x9312('0x27')][_0x9312('0x40')]({'where':{'id':_0x368daf[_0x9312('0x41')]['id']}})[_0x9312('0x25')](handleEntityNotFound(_0x31c217,null))[_0x9312('0x25')](removeEntity(_0x31c217,null))['catch'](handleError(_0x31c217,null));};exports[_0x9312('0x42')]=function(_0x4e16d6,_0x52eb78){return db[_0x9312('0x27')][_0x9312('0x42')]()[_0x9312('0x25')](respondWithResult(_0x52eb78,null))['catch'](handleError(_0x52eb78,null));}; \ No newline at end of file +var _0xf06f=['destroy','end','error','name','send','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf06f,0xfd));var _0xff06=function(_0xafe1a7,_0x34d19a){_0xafe1a7=_0xafe1a7-0x0;var _0x1543f6=_0xf06f[_0xafe1a7];return _0x1543f6;};'use strict';var emlformat=require(_0xff06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff06('0x1'));var jsonpatch=require(_0xff06('0x2'));var rp=require('request-promise');var moment=require(_0xff06('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xff06('0x4'));var util=require('util');var path=require(_0xff06('0x5'));var sox=require(_0xff06('0x6'));var csv=require(_0xff06('0x7'));var ejs=require(_0xff06('0x8'));var fs=require('fs');var fs_extra=require(_0xff06('0x9'));var _=require('lodash');var squel=require(_0xff06('0xa'));var crypto=require(_0xff06('0xb'));var jsforce=require(_0xff06('0xc'));var deskjs=require(_0xff06('0xd'));var toCsv=require(_0xff06('0x7'));var querystring=require('querystring');var Papa=require(_0xff06('0xe'));var Redis=require(_0xff06('0xf'));var authService=require(_0xff06('0x10'));var qs=require(_0xff06('0x11'));var as=require(_0xff06('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff06('0x13'))(_0xff06('0x14'));var utils=require('../../config/utils');var config=require(_0xff06('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb4161,_0x2e5ee8){_0x2e5ee8=_0x2e5ee8||0xcc;return function(_0x415cfe){if(_0x415cfe){return _0xfb4161[_0xff06('0x16')](_0x2e5ee8);}return _0xfb4161[_0xff06('0x17')](_0x2e5ee8)['end']();};}function respondWithResult(_0x4c7b13,_0x149344){_0x149344=_0x149344||0xc8;return function(_0x538728){if(_0x538728){return _0x4c7b13['status'](_0x149344)[_0xff06('0x18')](_0x538728);}};}function respondWithFilteredResult(_0x5eda11,_0x10b744){return function(_0x4fe2e8){if(_0x4fe2e8){var _0x4d9bea=typeof _0x10b744['offset']==='undefined'&&typeof _0x10b744[_0xff06('0x19')]===_0xff06('0x1a');var _0x7b9714=_0x4fe2e8['count'];var _0x304b20=_0x4d9bea?0x0:_0x10b744[_0xff06('0x1b')];var _0xb624f0=_0x4d9bea?_0x4fe2e8[_0xff06('0x1c')]:_0x10b744['offset']+_0x10b744[_0xff06('0x19')];var _0x21cf78;if(_0xb624f0>=_0x7b9714){_0xb624f0=_0x7b9714;_0x21cf78=0xc8;}else{_0x21cf78=0xce;}_0x5eda11[_0xff06('0x17')](_0x21cf78);return _0x5eda11['set'](_0xff06('0x1d'),_0x304b20+'-'+_0xb624f0+'/'+_0x7b9714)[_0xff06('0x18')](_0x4fe2e8);}return null;};}function patchUpdates(_0x31e9c4){return function(_0x1fd9b4){try{jsonpatch[_0xff06('0x1e')](_0x1fd9b4,_0x31e9c4,!![]);}catch(_0x5a46a3){return BPromise[_0xff06('0x1f')](_0x5a46a3);}return _0x1fd9b4[_0xff06('0x20')]();};}function saveUpdates(_0x12e539,_0x59db1e){return function(_0x188007){if(_0x188007){return _0x188007[_0xff06('0x21')](_0x12e539)[_0xff06('0x22')](function(_0xc63446){return _0xc63446;});}return null;};}function removeEntity(_0xb51244,_0x45fdb0){return function(_0x3fac02){if(_0x3fac02){return _0x3fac02[_0xff06('0x23')]()[_0xff06('0x22')](function(){_0xb51244['status'](0xcc)[_0xff06('0x24')]();});}};}function handleEntityNotFound(_0x4fddb3,_0x472871){return function(_0xceda5e){if(!_0xceda5e){_0x4fddb3[_0xff06('0x16')](0x194);}return _0xceda5e;};}function handleError(_0x187c4f,_0x20c0c4){_0x20c0c4=_0x20c0c4||0x1f4;return function(_0x13a768){logger[_0xff06('0x25')](_0x13a768['stack']);if(_0x13a768[_0xff06('0x26')]){delete _0x13a768[_0xff06('0x26')];}_0x187c4f[_0xff06('0x17')](_0x20c0c4)[_0xff06('0x27')](_0x13a768);};}exports['index']=function(_0x573837,_0xc415ad){var _0x129bcc={},_0x22529c={},_0x18d959={'count':0x0,'rows':[]};var _0x2e0359=_[_0xff06('0x28')](db[_0xff06('0x29')][_0xff06('0x2a')],function(_0x53a74a){return{'name':_0x53a74a['fieldName'],'type':_0x53a74a[_0xff06('0x2b')][_0xff06('0x2c')]};});_0x22529c[_0xff06('0x2d')]=_['map'](_0x2e0359,_0xff06('0x26'));_0x22529c[_0xff06('0x2e')]=_['keys'](_0x573837[_0xff06('0x2e')]);_0x22529c[_0xff06('0x2f')]=_[_0xff06('0x30')](_0x22529c[_0xff06('0x2d')],_0x22529c[_0xff06('0x2e')]);_0x129bcc[_0xff06('0x31')]=_[_0xff06('0x30')](_0x22529c[_0xff06('0x2d')],qs[_0xff06('0x32')](_0x573837['query']['fields']));_0x129bcc[_0xff06('0x31')]=_0x129bcc[_0xff06('0x31')][_0xff06('0x33')]?_0x129bcc[_0xff06('0x31')]:_0x22529c[_0xff06('0x2d')];if(!_0x573837[_0xff06('0x2e')][_0xff06('0x34')](_0xff06('0x35'))){_0x129bcc[_0xff06('0x19')]=qs[_0xff06('0x19')](_0x573837[_0xff06('0x2e')][_0xff06('0x19')]);_0x129bcc[_0xff06('0x1b')]=qs[_0xff06('0x1b')](_0x573837[_0xff06('0x2e')][_0xff06('0x1b')]);}_0x129bcc['order']=qs[_0xff06('0x36')](_0x573837[_0xff06('0x2e')][_0xff06('0x36')]);_0x129bcc[_0xff06('0x37')]=qs['filters'](_[_0xff06('0x38')](_0x573837[_0xff06('0x2e')],_0x22529c[_0xff06('0x2f')]),_0x2e0359);if(_0x573837[_0xff06('0x2e')]['filter']){_0x129bcc[_0xff06('0x37')]=_['merge'](_0x129bcc[_0xff06('0x37')],{'$or':_[_0xff06('0x28')](_0x2e0359,function(_0x52f87c){if(_0x52f87c[_0xff06('0x2b')]!==_0xff06('0x39')){var _0x145d9d={};_0x145d9d[_0x52f87c[_0xff06('0x26')]]={'$like':'%'+_0x573837[_0xff06('0x2e')][_0xff06('0x3a')]+'%'};return _0x145d9d;}})});}_0x129bcc=_[_0xff06('0x3b')]({},_0x129bcc,_0x573837['options']);var _0x219a05={'where':_0x129bcc[_0xff06('0x37')]};return db[_0xff06('0x29')][_0xff06('0x1c')](_0x219a05)[_0xff06('0x22')](function(_0x41c37d){_0x18d959[_0xff06('0x1c')]=_0x41c37d;if(_0x573837['query'][_0xff06('0x3c')]){_0x129bcc[_0xff06('0x3d')]=[{'all':!![]}];}return db[_0xff06('0x29')][_0xff06('0x3e')](_0x129bcc);})[_0xff06('0x22')](function(_0x55a891){_0x18d959[_0xff06('0x3f')]=_0x55a891;return _0x18d959;})[_0xff06('0x22')](respondWithFilteredResult(_0xc415ad,_0x129bcc))['catch'](handleError(_0xc415ad,null));};exports[_0xff06('0x40')]=function(_0x366b22,_0x560e5f){var _0x5d1991={'raw':!![],'where':{'id':_0x366b22['params']['id']}},_0x14e049={};_0x14e049[_0xff06('0x2d')]=_[_0xff06('0x41')](db[_0xff06('0x29')]['rawAttributes']);_0x14e049[_0xff06('0x2e')]=_['keys'](_0x366b22[_0xff06('0x2e')]);_0x14e049['filters']=_[_0xff06('0x30')](_0x14e049['model'],_0x14e049['query']);_0x5d1991[_0xff06('0x31')]=_[_0xff06('0x30')](_0x14e049[_0xff06('0x2d')],qs[_0xff06('0x32')](_0x366b22['query'][_0xff06('0x32')]));_0x5d1991[_0xff06('0x31')]=_0x5d1991[_0xff06('0x31')]['length']?_0x5d1991[_0xff06('0x31')]:_0x14e049[_0xff06('0x2d')];if(_0x366b22[_0xff06('0x2e')][_0xff06('0x3c')]){_0x5d1991[_0xff06('0x3d')]=[{'all':!![]}];}_0x5d1991=_['merge']({},_0x5d1991,_0x366b22['options']);return db[_0xff06('0x29')][_0xff06('0x42')](_0x5d1991)[_0xff06('0x22')](handleEntityNotFound(_0x560e5f,null))[_0xff06('0x22')](respondWithResult(_0x560e5f,null))[_0xff06('0x43')](handleError(_0x560e5f,null));};exports[_0xff06('0x44')]=function(_0xcc35e9,_0x538b3a){return db[_0xff06('0x29')][_0xff06('0x44')](_0xcc35e9['body'],{})[_0xff06('0x22')](respondWithResult(_0x538b3a,0xc9))[_0xff06('0x43')](handleError(_0x538b3a,null));};exports[_0xff06('0x21')]=function(_0x2366a1,_0x5c409c){if(_0x2366a1[_0xff06('0x45')]['id']){delete _0x2366a1[_0xff06('0x45')]['id'];}return db[_0xff06('0x29')][_0xff06('0x42')]({'where':{'id':_0x2366a1[_0xff06('0x46')]['id']}})[_0xff06('0x22')](handleEntityNotFound(_0x5c409c,null))[_0xff06('0x22')](saveUpdates(_0x2366a1[_0xff06('0x45')],null))[_0xff06('0x22')](respondWithResult(_0x5c409c,null))[_0xff06('0x43')](handleError(_0x5c409c,null));};exports['destroy']=function(_0x100864,_0x251572){return db['SmsTransferReport'][_0xff06('0x42')]({'where':{'id':_0x100864[_0xff06('0x46')]['id']}})['then'](handleEntityNotFound(_0x251572,null))[_0xff06('0x22')](removeEntity(_0x251572,null))[_0xff06('0x43')](handleError(_0x251572,null));};exports[_0xff06('0x47')]=function(_0x3ff497,_0x424359){return db[_0xff06('0x29')][_0xff06('0x47')]()[_0xff06('0x22')](respondWithResult(_0x424359,null))[_0xff06('0x43')](handleError(_0x424359,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6cee465..83deb6f 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 _0x20a2=['rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','api','moment','bluebird','request-promise','path'];(function(_0x59e946,_0x4901a4){var _0x14bc15=function(_0x48e6f7){while(--_0x48e6f7){_0x59e946['push'](_0x59e946['shift']());}};_0x14bc15(++_0x4901a4);}(_0x20a2,0x102));var _0x220a=function(_0x21001b,_0x3ff1a8){_0x21001b=_0x21001b-0x0;var _0x665a00=_0x20a2[_0x21001b];return _0x665a00;};'use strict';var _=require(_0x220a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x220a('0x1'));var moment=require(_0x220a('0x2'));var BPromise=require(_0x220a('0x3'));var rp=require(_0x220a('0x4'));var fs=require('fs');var path=require(_0x220a('0x5'));var rimraf=require(_0x220a('0x6'));var config=require('../../config/environment');var attributes=require(_0x220a('0x7'));module[_0x220a('0x8')]=function(_0x1ccdf4,_0x1a69f8){return _0x1ccdf4[_0x220a('0x9')](_0x220a('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x220a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba33=['define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x33b1d2,_0x5b0715){var _0x2cd103=function(_0x347ed3){while(--_0x347ed3){_0x33b1d2['push'](_0x33b1d2['shift']());}};_0x2cd103(++_0x5b0715);}(_0xba33,0xf1));var _0x3ba3=function(_0x5d4f74,_0x37b594){_0x5d4f74=_0x5d4f74-0x0;var _0x41e760=_0xba33[_0x5d4f74];return _0x41e760;};'use strict';var _=require(_0x3ba3('0x0'));var util=require(_0x3ba3('0x1'));var logger=require(_0x3ba3('0x2'))(_0x3ba3('0x3'));var moment=require('moment');var BPromise=require(_0x3ba3('0x4'));var rp=require(_0x3ba3('0x5'));var fs=require('fs');var path=require(_0x3ba3('0x6'));var rimraf=require(_0x3ba3('0x7'));var config=require(_0x3ba3('0x8'));var attributes=require(_0x3ba3('0x9'));module[_0x3ba3('0xa')]=function(_0xd24f52,_0xe9e300){return _0xd24f52[_0x3ba3('0xb')](_0x3ba3('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x3ba3('0xd'),'fields':[_0x3ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3fe5deb..784d39d 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 _0x09f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x09f4,0xe4));var _0x409f=function(_0x107d0,_0x2c5573){_0x107d0=_0x107d0-0x0;var _0x5d3287=_0x09f4[_0x107d0];return _0x5d3287;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x409f('0x0'));var BPromise=require(_0x409f('0x1'));var rs=require(_0x409f('0x2'));var fs=require('fs');var Redis=require(_0x409f('0x3'));var db=require(_0x409f('0x4'))['db'];var utils=require(_0x409f('0x5'));var logger=require(_0x409f('0x6'))(_0x409f('0x7'));var config=require(_0x409f('0x8'));var jayson=require(_0x409f('0x9'));var client=jayson[_0x409f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5af790,_0x1c7495,_0x3f446f){return new BPromise(function(_0x2d4972,_0x2439b9){return client[_0x409f('0xb')](_0x5af790,_0x3f446f)[_0x409f('0xc')](function(_0x4649b9){logger[_0x409f('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x1c7495,_0x409f('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1c7495,_0x409f('0xe'),JSON[_0x409f('0xf')](_0x4649b9));if(_0x4649b9[_0x409f('0x10')]){if(_0x4649b9['error']['code']===0x1f4){logger[_0x409f('0x10')](_0x409f('0x11'),_0x1c7495,_0x4649b9[_0x409f('0x10')][_0x409f('0x12')]);return _0x2439b9(_0x4649b9[_0x409f('0x10')][_0x409f('0x12')]);}logger[_0x409f('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x1c7495,_0x4649b9[_0x409f('0x10')]['message']);return _0x2d4972(_0x4649b9[_0x409f('0x10')][_0x409f('0x12')]);}else{logger['info'](_0x409f('0x11'),_0x1c7495,_0x409f('0xe'));_0x2d4972(_0x4649b9[_0x409f('0x13')][_0x409f('0x12')]);}})[_0x409f('0x14')](function(_0x51a486){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1c7495,_0x51a486);_0x2439b9(_0x51a486);});});} \ No newline at end of file +var _0x1247=['debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1585f3,_0x164882){var _0x3664ff=function(_0x537b17){while(--_0x537b17){_0x1585f3['push'](_0x1585f3['shift']());}};_0x3664ff(++_0x164882);}(_0x1247,0xb6));var _0x7124=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x1247[_0x104a84];return _0x4973ff;};'use strict';var _=require(_0x7124('0x0'));var util=require(_0x7124('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7124('0x2'));var fs=require('fs');var Redis=require(_0x7124('0x3'));var db=require(_0x7124('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7124('0x5'))(_0x7124('0x6'));var config=require(_0x7124('0x7'));var jayson=require(_0x7124('0x8'));var client=jayson[_0x7124('0x9')][_0x7124('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x396f11,_0x633c56,_0x29d7b2){return new BPromise(function(_0x3b5a48,_0x5a2636){return client[_0x7124('0xb')](_0x396f11,_0x29d7b2)[_0x7124('0xc')](function(_0x3614bf){logger[_0x7124('0xd')](_0x7124('0xe'),_0x633c56,_0x7124('0xf'));logger[_0x7124('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x633c56,_0x7124('0xf'),JSON['stringify'](_0x3614bf));if(_0x3614bf[_0x7124('0x11')]){if(_0x3614bf[_0x7124('0x11')][_0x7124('0x12')]===0x1f4){logger[_0x7124('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x633c56,_0x3614bf[_0x7124('0x11')][_0x7124('0x13')]);return _0x5a2636(_0x3614bf['error']['message']);}logger[_0x7124('0x11')](_0x7124('0xe'),_0x633c56,_0x3614bf[_0x7124('0x11')][_0x7124('0x13')]);return _0x3b5a48(_0x3614bf[_0x7124('0x11')][_0x7124('0x13')]);}else{logger[_0x7124('0xd')](_0x7124('0xe'),_0x633c56,_0x7124('0xf'));_0x3b5a48(_0x3614bf[_0x7124('0x14')][_0x7124('0x13')]);}})[_0x7124('0x15')](function(_0x2f4ff7){logger[_0x7124('0x11')](_0x7124('0xe'),_0x633c56,_0x2f4ff7);_0x5a2636(_0x2f4ff7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7ac7ecb..06594f4 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 _0xab8c=['isAuthenticated','index','show','download','join','root','originalname','format','%s-%s%s','basename','extname','single','create','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xab8c,0x18b));var _0xcab8=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0xab8c[_0x571714];return _0x599a14;};'use strict';var multer=require(_0xcab8('0x0'));var util=require('util');var path=require(_0xcab8('0x1'));var timeout=require(_0xcab8('0x2'));var express=require(_0xcab8('0x3'));var router=express[_0xcab8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcab8('0x5'));var interaction=require(_0xcab8('0x6'));var config=require(_0xcab8('0x7'));var controller=require(_0xcab8('0x8'));router[_0xcab8('0x9')]('/',auth[_0xcab8('0xa')](),controller[_0xcab8('0xb')]);router['get']('/:id',auth[_0xcab8('0xa')](),controller[_0xcab8('0xc')]);router[_0xcab8('0x9')]('/:id/download',auth[_0xcab8('0xa')](),controller[_0xcab8('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cab3a,_0xc6ed10,_0x1b0665){_0x1b0665(null,path[_0xcab8('0xe')](config[_0xcab8('0xf')],'server/files/sounds/original/'));},'filename':function(_0x4ce19d,_0x15ec1f,_0x33e458){_0x15ec1f[_0xcab8('0x10')]=_0x15ec1f[_0xcab8('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e458(null,util[_0xcab8('0x11')](_0xcab8('0x12'),path[_0xcab8('0x13')](_0x15ec1f[_0xcab8('0x10')],path[_0xcab8('0x14')](_0x15ec1f[_0xcab8('0x10')])),Date['now'](),path['extname'](_0x15ec1f[_0xcab8('0x10')])));}})});router['post']('/',upload[_0xcab8('0x15')]('file'),controller[_0xcab8('0x16')]);router['put'](_0xcab8('0x17'),auth['isAuthenticated'](),controller[_0xcab8('0x18')]);router[_0xcab8('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xcab8('0x19')]);module[_0xcab8('0x1a')]=router; \ No newline at end of file +var _0x3f58=['get','isAuthenticated','index','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0x3f58,0xb8));var _0x83f5=function(_0x2b53c7,_0x1a88ca){_0x2b53c7=_0x2b53c7-0x0;var _0x56ec2b=_0x3f58[_0x2b53c7];return _0x56ec2b;};'use strict';var multer=require(_0x83f5('0x0'));var util=require('util');var path=require(_0x83f5('0x1'));var timeout=require(_0x83f5('0x2'));var express=require(_0x83f5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x83f5('0x4'));var interaction=require(_0x83f5('0x5'));var config=require(_0x83f5('0x6'));var controller=require(_0x83f5('0x7'));router[_0x83f5('0x8')]('/',auth[_0x83f5('0x9')](),controller[_0x83f5('0xa')]);router[_0x83f5('0x8')]('/:id',auth[_0x83f5('0x9')](),controller['show']);router['get'](_0x83f5('0xb'),auth[_0x83f5('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x83f5('0xc')]({'destination':function(_0x1a615d,_0x4e4b62,_0x410729){_0x410729(null,path[_0x83f5('0xd')](config[_0x83f5('0xe')],_0x83f5('0xf')));},'filename':function(_0x3db3bf,_0x97064,_0x576c15){_0x97064[_0x83f5('0x10')]=_0x97064[_0x83f5('0x10')][_0x83f5('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x576c15(null,util[_0x83f5('0x12')](_0x83f5('0x13'),path[_0x83f5('0x14')](_0x97064[_0x83f5('0x10')],path[_0x83f5('0x15')](_0x97064['originalname'])),Date[_0x83f5('0x16')](),path[_0x83f5('0x15')](_0x97064[_0x83f5('0x10')])));}})});router[_0x83f5('0x17')]('/',upload[_0x83f5('0x18')](_0x83f5('0x19')),controller[_0x83f5('0x1a')]);router[_0x83f5('0x1b')](_0x83f5('0x1c'),auth[_0x83f5('0x9')](),controller[_0x83f5('0x1d')]);router[_0x83f5('0x1e')](_0x83f5('0x1c'),auth['isAuthenticated'](),controller[_0x83f5('0x1e')]);module[_0x83f5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index abfc9eb..29ac1b5 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 _0xff81=['BIGINT','INTEGER','STRING','name','FLOAT'];(function(_0x12fb3b,_0x3c03de){var _0x11f138=function(_0x41966a){while(--_0x41966a){_0x12fb3b['push'](_0x12fb3b['shift']());}};_0x11f138(++_0x3c03de);}(_0xff81,0xe8));var _0x1ff8=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xff81[_0x4f4c53];return _0x568ff1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ff8('0x0')],'unique':_0x1ff8('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1ff8('0x0')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x1ff8('0x0')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1ff8('0x2')]},'original_sampleCount':{'type':Sequelize[_0x1ff8('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x1ff8('0x3')]},'original_sampleRate':{'type':Sequelize[_0x1ff8('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x1ff8('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x1ff8('0x3')]},'converted_channelCount':{'type':Sequelize[_0x1ff8('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1ff8('0x4')]}}; \ No newline at end of file +var _0x6da9=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x3df5e5,_0x4766ea){var _0x3d3352=function(_0x12aa2b){while(--_0x12aa2b){_0x3df5e5['push'](_0x3df5e5['shift']());}};_0x3d3352(++_0x4766ea);}(_0x6da9,0x1e0));var _0x96da=function(_0x51fb8d,_0x10e397){_0x51fb8d=_0x51fb8d-0x0;var _0x249560=_0x6da9[_0x51fb8d];return _0x249560;};'use strict';var Sequelize=require(_0x96da('0x0'));module['exports']={'name':{'type':Sequelize[_0x96da('0x1')],'unique':_0x96da('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x96da('0x1')]},'display_name':{'type':Sequelize[_0x96da('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x96da('0x1')]},'original_duration':{'type':Sequelize[_0x96da('0x3')]},'original_sampleCount':{'type':Sequelize[_0x96da('0x4')]},'original_channelCount':{'type':Sequelize[_0x96da('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x96da('0x5')]},'converted_format':{'type':Sequelize[_0x96da('0x1')]},'converted_duration':{'type':Sequelize[_0x96da('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x96da('0x4')]},'converted_channelCount':{'type':Sequelize[_0x96da('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x96da('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 35b46c9..84f1aee 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 _0x7107=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','Sound','includeAll','include','catch','show','keys','rawAttributes','find','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','substring','wav','filename','server/files/sounds/converted','info','transcode','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','params','pick','delete','server/files/sounds/original','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4b5325,_0x5bc67f){var _0x3d8fe5=function(_0x5c0b5e){while(--_0x5c0b5e){_0x4b5325['push'](_0x4b5325['shift']());}};_0x3d8fe5(++_0x5bc67f);}(_0x7107,0xe9));var _0x7710=function(_0x1ff7f5,_0xf0e2e7){_0x1ff7f5=_0x1ff7f5-0x0;var _0x31cbc5=_0x7107[_0x1ff7f5];return _0x31cbc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7710('0x0'));var zipdir=require(_0x7710('0x1'));var jsonpatch=require(_0x7710('0x2'));var rp=require('request-promise');var moment=require(_0x7710('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7710('0x4'));var util=require(_0x7710('0x5'));var path=require(_0x7710('0x6'));var sox=require(_0x7710('0x7'));var csv=require(_0x7710('0x8'));var ejs=require(_0x7710('0x9'));var fs=require('fs');var fs_extra=require(_0x7710('0xa'));var _=require('lodash');var squel=require(_0x7710('0xb'));var crypto=require(_0x7710('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7710('0xd'));var toCsv=require(_0x7710('0x8'));var querystring=require(_0x7710('0xe'));var Papa=require(_0x7710('0xf'));var Redis=require(_0x7710('0x10'));var authService=require(_0x7710('0x11'));var qs=require(_0x7710('0x12'));var as=require(_0x7710('0x13'));var hardwareService=require(_0x7710('0x14'));var logger=require(_0x7710('0x15'))(_0x7710('0x16'));var utils=require(_0x7710('0x17'));var config=require(_0x7710('0x18'));var licenseUtil=require(_0x7710('0x19'));var db=require(_0x7710('0x1a'))['db'];function respondWithStatusCode(_0x3b4557,_0x5f167e){_0x5f167e=_0x5f167e||0xcc;return function(_0xee0f42){if(_0xee0f42){return _0x3b4557[_0x7710('0x1b')](_0x5f167e);}return _0x3b4557['status'](_0x5f167e)[_0x7710('0x1c')]();};}function respondWithResult(_0x5269a8,_0xb3566e){_0xb3566e=_0xb3566e||0xc8;return function(_0x129ce0){if(_0x129ce0){return _0x5269a8[_0x7710('0x1d')](_0xb3566e)[_0x7710('0x1e')](_0x129ce0);}};}function respondWithFilteredResult(_0x217446,_0x2101bb){return function(_0x10eee5){if(_0x10eee5){var _0x311267=typeof _0x2101bb[_0x7710('0x1f')]===_0x7710('0x20')&&typeof _0x2101bb[_0x7710('0x21')]===_0x7710('0x20');var _0x4762dd=_0x10eee5[_0x7710('0x22')];var _0x139765=_0x311267?0x0:_0x2101bb[_0x7710('0x1f')];var _0x49f030=_0x311267?_0x10eee5[_0x7710('0x22')]:_0x2101bb[_0x7710('0x1f')]+_0x2101bb['limit'];var _0x31b4c3;if(_0x49f030>=_0x4762dd){_0x49f030=_0x4762dd;_0x31b4c3=0xc8;}else{_0x31b4c3=0xce;}_0x217446[_0x7710('0x1d')](_0x31b4c3);return _0x217446[_0x7710('0x23')](_0x7710('0x24'),_0x139765+'-'+_0x49f030+'/'+_0x4762dd)[_0x7710('0x1e')](_0x10eee5);}return null;};}function patchUpdates(_0x3f740b){return function(_0x3b29f5){try{jsonpatch[_0x7710('0x25')](_0x3b29f5,_0x3f740b,!![]);}catch(_0x4f7d22){return BPromise[_0x7710('0x26')](_0x4f7d22);}return _0x3b29f5[_0x7710('0x27')]();};}function saveUpdates(_0xfe61af,_0x236ce1){return function(_0x136205){if(_0x136205){return _0x136205[_0x7710('0x28')](_0xfe61af)[_0x7710('0x29')](function(_0x47b687){return _0x47b687;});}return null;};}function removeEntity(_0xff2349,_0x15928e){return function(_0xab5d84){if(_0xab5d84){return _0xab5d84[_0x7710('0x2a')]()['then'](function(){var _0x39be92=_0xab5d84[_0x7710('0x2b')]({'plain':!![]});var _0x28a2f1='Sounds';return db[_0x7710('0x2c')]['destroy']({'where':{'type':_0x28a2f1,'resourceId':_0x39be92['id']}})[_0x7710('0x29')](function(){return _0xab5d84;});})[_0x7710('0x29')](function(){_0xff2349[_0x7710('0x1d')](0xcc)[_0x7710('0x1c')]();});}};}function handleEntityNotFound(_0x4f7dcb,_0x46b642){return function(_0x4386bb){if(!_0x4386bb){_0x4f7dcb[_0x7710('0x1b')](0x194);}return _0x4386bb;};}function handleError(_0x5ab698,_0x25de1c){_0x25de1c=_0x25de1c||0x1f4;return function(_0x373937){logger[_0x7710('0x2d')](_0x373937[_0x7710('0x2e')]);if(_0x373937[_0x7710('0x2f')]){delete _0x373937[_0x7710('0x2f')];}_0x5ab698['status'](_0x25de1c)['send'](_0x373937);};}exports[_0x7710('0x30')]=function(_0x4a0f83,_0x28a97d){var _0x3fa1ab={},_0x1fdb33={},_0x21a2e6={'count':0x0,'rows':[]};var _0xb21ae2=_[_0x7710('0x31')](db['Sound']['rawAttributes'],function(_0x1a2784){return{'name':_0x1a2784['fieldName'],'type':_0x1a2784[_0x7710('0x32')][_0x7710('0x33')]};});_0x1fdb33[_0x7710('0x34')]=_[_0x7710('0x31')](_0xb21ae2,_0x7710('0x2f'));_0x1fdb33['query']=_['keys'](_0x4a0f83[_0x7710('0x35')]);_0x1fdb33['filters']=_[_0x7710('0x36')](_0x1fdb33[_0x7710('0x34')],_0x1fdb33[_0x7710('0x35')]);_0x3fa1ab[_0x7710('0x37')]=_[_0x7710('0x36')](_0x1fdb33[_0x7710('0x34')],qs['fields'](_0x4a0f83[_0x7710('0x35')][_0x7710('0x38')]));_0x3fa1ab[_0x7710('0x37')]=_0x3fa1ab[_0x7710('0x37')][_0x7710('0x39')]?_0x3fa1ab['attributes']:_0x1fdb33[_0x7710('0x34')];if(!_0x4a0f83['query'][_0x7710('0x3a')](_0x7710('0x3b'))){_0x3fa1ab[_0x7710('0x21')]=qs[_0x7710('0x21')](_0x4a0f83[_0x7710('0x35')]['limit']);_0x3fa1ab[_0x7710('0x1f')]=qs['offset'](_0x4a0f83['query'][_0x7710('0x1f')]);}_0x3fa1ab['order']=qs[_0x7710('0x3c')](_0x4a0f83[_0x7710('0x35')][_0x7710('0x3c')]);_0x3fa1ab[_0x7710('0x3d')]=qs[_0x7710('0x3e')](_['pick'](_0x4a0f83[_0x7710('0x35')],_0x1fdb33[_0x7710('0x3e')]),_0xb21ae2);if(_0x4a0f83[_0x7710('0x35')][_0x7710('0x3f')]){_0x3fa1ab['where']=_['merge'](_0x3fa1ab[_0x7710('0x3d')],{'$or':_[_0x7710('0x31')](_0xb21ae2,function(_0x38e222){if(_0x38e222[_0x7710('0x32')]!==_0x7710('0x40')){var _0x3045c5={};_0x3045c5[_0x38e222[_0x7710('0x2f')]]={'$like':'%'+_0x4a0f83[_0x7710('0x35')][_0x7710('0x3f')]+'%'};return _0x3045c5;}})});}_0x3fa1ab=_[_0x7710('0x41')]({},_0x3fa1ab,_0x4a0f83[_0x7710('0x42')]);var _0xb26cef={'where':_0x3fa1ab[_0x7710('0x3d')]};return db[_0x7710('0x43')][_0x7710('0x22')](_0xb26cef)[_0x7710('0x29')](function(_0x3324d2){_0x21a2e6[_0x7710('0x22')]=_0x3324d2;if(_0x4a0f83[_0x7710('0x35')][_0x7710('0x44')]){_0x3fa1ab[_0x7710('0x45')]=[{'all':!![]}];}return db[_0x7710('0x43')]['findAll'](_0x3fa1ab);})[_0x7710('0x29')](function(_0x49b557){_0x21a2e6['rows']=_0x49b557;return _0x21a2e6;})[_0x7710('0x29')](respondWithFilteredResult(_0x28a97d,_0x3fa1ab))[_0x7710('0x46')](handleError(_0x28a97d,null));};exports[_0x7710('0x47')]=function(_0x576959,_0x342b46){var _0x56ea68={'raw':!![],'where':{'id':_0x576959['params']['id']}},_0x110311={};_0x110311[_0x7710('0x34')]=_[_0x7710('0x48')](db['Sound'][_0x7710('0x49')]);_0x110311[_0x7710('0x35')]=_['keys'](_0x576959['query']);_0x110311[_0x7710('0x3e')]=_[_0x7710('0x36')](_0x110311['model'],_0x110311[_0x7710('0x35')]);_0x56ea68[_0x7710('0x37')]=_[_0x7710('0x36')](_0x110311[_0x7710('0x34')],qs[_0x7710('0x38')](_0x576959['query'][_0x7710('0x38')]));_0x56ea68[_0x7710('0x37')]=_0x56ea68['attributes'][_0x7710('0x39')]?_0x56ea68[_0x7710('0x37')]:_0x110311['model'];if(_0x576959[_0x7710('0x35')][_0x7710('0x44')]){_0x56ea68[_0x7710('0x45')]=[{'all':!![]}];}_0x56ea68=_[_0x7710('0x41')]({},_0x56ea68,_0x576959[_0x7710('0x42')]);return db[_0x7710('0x43')][_0x7710('0x4a')](_0x56ea68)['then'](handleEntityNotFound(_0x342b46,null))[_0x7710('0x29')](respondWithResult(_0x342b46,null))[_0x7710('0x46')](handleError(_0x342b46,null));};exports[_0x7710('0x4b')]=function(_0x12e01b,_0x8d2153,_0x29d58c){return db[_0x7710('0x43')]['find']({'where':{'id':_0x12e01b['params']['id']},'attributes':[_0x7710('0x2f'),_0x7710('0x4c'),_0x7710('0x4d')],'raw':!![]})[_0x7710('0x29')](handleEntityNotFound(_0x8d2153,null))[_0x7710('0x29')](function(_0x4e0452){if(_0x4e0452){if(!fs[_0x7710('0x4e')](path[_0x7710('0x4f')](config[_0x7710('0x50')],'server/files/sounds/converted',_0x4e0452[_0x7710('0x4c')]+'.'+_0x4e0452[_0x7710('0x4d')]))){throw new db[(_0x7710('0x51'))][(_0x7710('0x52'))](_0x7710('0x53'));}return _0x8d2153['download'](path[_0x7710('0x4f')](config['root'],'server/files/sounds/converted',util[_0x7710('0x54')](_0x7710('0x55'),_0x4e0452[_0x7710('0x4c')],_0x4e0452['converted_format'])),util['format'](_0x7710('0x55'),_0x4e0452[_0x7710('0x2f')],_0x4e0452[_0x7710('0x4d')]));}return null;})[_0x7710('0x46')](handleError(_0x8d2153,null));};exports[_0x7710('0x56')]=function(_0x210e10,_0x370964,_0x2a3f20){var _0x245740={'name':path[_0x7710('0x57')](_0x210e10[_0x7710('0x58')][_0x7710('0x59')],path['extname'](_0x210e10[_0x7710('0x58')][_0x7710('0x59')])),'save_name':path[_0x7710('0x57')](_0x210e10[_0x7710('0x58')]['filename'],path[_0x7710('0x5a')](_0x210e10[_0x7710('0x58')]['filename'])),'original_format':path[_0x7710('0x5a')](_0x210e10[_0x7710('0x58')][_0x7710('0x59')])[_0x7710('0x5b')](0x1),'converted_format':_0x7710('0x5c')};var _0x229c2e=path['join'](config[_0x7710('0x50')],'server/files/sounds/original',_0x210e10['file'][_0x7710('0x5d')]);var _0x200a0c=path[_0x7710('0x4f')](config[_0x7710('0x50')],_0x7710('0x5e'),util[_0x7710('0x54')](_0x7710('0x55'),path[_0x7710('0x57')](_0x210e10['file'][_0x7710('0x5d')],path[_0x7710('0x5a')](_0x210e10['file'][_0x7710('0x5d')])),_0x245740[_0x7710('0x4d')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x229c2e);logger[_0x7710('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x200a0c);try{fs['chmodSync'](_0x229c2e,parseInt('0777',0x8));var _0x42123d=sox[_0x7710('0x60')](_0x229c2e,_0x200a0c,{'sampleRate':0x1f40,'format':_0x7710('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42123d['on'](_0x7710('0x2d'),function(_0x5c2ae9){fs[_0x7710('0x61')](_0x229c2e);_0x370964[_0x7710('0x1d')](0x1f4)[_0x7710('0x62')](_0x5c2ae9);});_0x42123d['on'](_0x7710('0x63'),function(_0x10472d){_0x245740['original_duration']=isNaN(_0x10472d[_0x7710('0x64')])?null:_0x10472d[_0x7710('0x64')]*0x3e8;_0x245740[_0x7710('0x65')]=isNaN(_0x10472d[_0x7710('0x66')])?null:_0x10472d['sampleCount'];_0x245740[_0x7710('0x67')]=isNaN(_0x10472d[_0x7710('0x68')])?null:_0x10472d[_0x7710('0x68')];_0x245740[_0x7710('0x69')]=isNaN(_0x10472d[_0x7710('0x6a')])?null:_0x10472d[_0x7710('0x6a')];_0x245740['original_sampleRate']=isNaN(_0x10472d[_0x7710('0x6b')])?null:_0x10472d['sampleRate'];});_0x42123d['on'](_0x7710('0x6c'),function(_0x60a8fd){_0x245740[_0x7710('0x6d')]=isNaN(_0x60a8fd[_0x7710('0x64')])?null:_0x60a8fd[_0x7710('0x64')]*0x3e8;_0x245740[_0x7710('0x6e')]=isNaN(_0x60a8fd[_0x7710('0x66')])?null:_0x60a8fd['sampleCount'];_0x245740[_0x7710('0x6f')]=isNaN(_0x60a8fd[_0x7710('0x68')])?null:_0x60a8fd[_0x7710('0x68')];_0x245740[_0x7710('0x70')]=isNaN(_0x60a8fd[_0x7710('0x6a')])?null:_0x60a8fd[_0x7710('0x6a')];_0x245740[_0x7710('0x71')]=isNaN(_0x60a8fd[_0x7710('0x6b')])?null:_0x60a8fd[_0x7710('0x6b')];});_0x42123d['on'](_0x7710('0x1c'),function(){fs['chmodSync'](_0x200a0c,parseInt(_0x7710('0x72'),0x8));return db[_0x7710('0x43')][_0x7710('0x56')](_0x245740)[_0x7710('0x29')](function(_0x18f084){var _0x3a346a={'role':_0x210e10[_0x7710('0x73')][_0x7710('0x74')],'userProfileId':_0x210e10['body'][_0x7710('0x75')]};if(!_0x3a346a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a346a[_0x7710('0x74')]===_0x7710('0x76')){var _0x56d6da=_0x18f084[_0x7710('0x2b')]({'plain':!![]});return db[_0x7710('0x77')][_0x7710('0x4a')]({'where':{'name':_0x7710('0x78'),'userProfileId':_0x3a346a[_0x7710('0x75')]},'raw':!![]})['then'](function(_0x134208){if(_0x134208&&_0x134208[_0x7710('0x79')]===0x0){return db[_0x7710('0x2c')]['create']({'name':_0x56d6da[_0x7710('0x2f')],'resourceId':_0x56d6da['id'],'type':_0x134208[_0x7710('0x2f')],'sectionId':_0x134208['id']},{})[_0x7710('0x29')](function(){return _0x18f084;});}else{return _0x18f084;}})['catch'](function(_0x41a561){logger[_0x7710('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41a561);throw _0x41a561;});}return _0x18f084;})[_0x7710('0x29')](respondWithResult(_0x370964,null))[_0x7710('0x46')](handleError(_0x370964,null));});_0x42123d['start']();}catch(_0x44423f){_0x370964[_0x7710('0x1d')](0x1f4)[_0x7710('0x62')](_0x44423f);}};exports[_0x7710('0x28')]=function(_0x4dd76b,_0xabe1d5,_0xd35c4a){return db['Sound']['find']({'where':{'id':_0x4dd76b[_0x7710('0x7a')]['id']}})['then'](handleEntityNotFound(_0xabe1d5,null))[_0x7710('0x29')](saveUpdates(_[_0x7710('0x7b')](_0x4dd76b[_0x7710('0x73')],[_0x7710('0x2f'),'description']),null))[_0x7710('0x29')](respondWithResult(_0xabe1d5,null))[_0x7710('0x46')](handleError(_0xabe1d5,null));};exports[_0x7710('0x7c')]=function(_0x495272,_0x2108a1,_0x412c58){return db[_0x7710('0x43')][_0x7710('0x4a')]({'where':{'id':_0x495272[_0x7710('0x7a')]['id']}})[_0x7710('0x29')](function(_0xe16a8f){if(_0xe16a8f){return _0xe16a8f[_0x7710('0x2a')]();}})[_0x7710('0x29')](function(_0x3852f5){var _0x279229=path[_0x7710('0x4f')](config[_0x7710('0x50')],_0x7710('0x7d'),util['format'](_0x7710('0x55'),_0x3852f5[_0x7710('0x4c')],_0x3852f5['original_format']));var _0x2c97b5=path[_0x7710('0x4f')](config[_0x7710('0x50')],'server/files/sounds/converted',util[_0x7710('0x54')]('%s.%s',_0x3852f5[_0x7710('0x4c')],_0x3852f5['converted_format']));fs[_0x7710('0x61')](_0x279229);fs[_0x7710('0x61')](_0x2c97b5);return _0x3852f5;})[_0x7710('0x29')](function(_0x52cb32){if(_0x52cb32){return _0x2108a1[_0x7710('0x1d')](0xcc)[_0x7710('0x1c')]();}})[_0x7710('0x29')](handleEntityNotFound(_0x2108a1,null))[_0x7710('0x46')](handleError(_0x2108a1,null));}; \ No newline at end of file +var _0xbd3b=['update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','type','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','include','rows','catch','keys','rawAttributes','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','userProfileId','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x260ea6,_0x3d1eb2){var _0x156964=function(_0x32748a){while(--_0x32748a){_0x260ea6['push'](_0x260ea6['shift']());}};_0x156964(++_0x3d1eb2);}(_0xbd3b,0xd2));var _0xbbd3=function(_0x5227ab,_0x514da4){_0x5227ab=_0x5227ab-0x0;var _0x3dc702=_0xbd3b[_0x5227ab];return _0x3dc702;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbd3('0x0'));var zipdir=require(_0xbbd3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbd3('0x2'));var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var Mustache=require(_0xbbd3('0x5'));var util=require('util');var path=require(_0xbbd3('0x6'));var sox=require(_0xbbd3('0x7'));var csv=require(_0xbbd3('0x8'));var ejs=require(_0xbbd3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbd3('0xa'));var squel=require(_0xbbd3('0xb'));var crypto=require(_0xbbd3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbd3('0xd'));var toCsv=require(_0xbbd3('0x8'));var querystring=require(_0xbbd3('0xe'));var Papa=require(_0xbbd3('0xf'));var Redis=require(_0xbbd3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbbd3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbd3('0x12'))(_0xbbd3('0x13'));var utils=require(_0xbbd3('0x14'));var config=require(_0xbbd3('0x15'));var licenseUtil=require(_0xbbd3('0x16'));var db=require(_0xbbd3('0x17'))['db'];function respondWithStatusCode(_0x391c2b,_0x4b25a7){_0x4b25a7=_0x4b25a7||0xcc;return function(_0x3b183a){if(_0x3b183a){return _0x391c2b[_0xbbd3('0x18')](_0x4b25a7);}return _0x391c2b[_0xbbd3('0x19')](_0x4b25a7)[_0xbbd3('0x1a')]();};}function respondWithResult(_0x273623,_0x578080){_0x578080=_0x578080||0xc8;return function(_0xecc6e9){if(_0xecc6e9){return _0x273623[_0xbbd3('0x19')](_0x578080)[_0xbbd3('0x1b')](_0xecc6e9);}};}function respondWithFilteredResult(_0x44d0a0,_0x48770c){return function(_0x1c8fa2){if(_0x1c8fa2){var _0x2de813=typeof _0x48770c[_0xbbd3('0x1c')]===_0xbbd3('0x1d')&&typeof _0x48770c[_0xbbd3('0x1e')]===_0xbbd3('0x1d');var _0x2c15b2=_0x1c8fa2[_0xbbd3('0x1f')];var _0x3c8b8d=_0x2de813?0x0:_0x48770c[_0xbbd3('0x1c')];var _0x9dc614=_0x2de813?_0x1c8fa2[_0xbbd3('0x1f')]:_0x48770c['offset']+_0x48770c[_0xbbd3('0x1e')];var _0x2185df;if(_0x9dc614>=_0x2c15b2){_0x9dc614=_0x2c15b2;_0x2185df=0xc8;}else{_0x2185df=0xce;}_0x44d0a0[_0xbbd3('0x19')](_0x2185df);return _0x44d0a0[_0xbbd3('0x20')](_0xbbd3('0x21'),_0x3c8b8d+'-'+_0x9dc614+'/'+_0x2c15b2)[_0xbbd3('0x1b')](_0x1c8fa2);}return null;};}function patchUpdates(_0x162924){return function(_0x3413d4){try{jsonpatch['apply'](_0x3413d4,_0x162924,!![]);}catch(_0x1f8af8){return BPromise[_0xbbd3('0x22')](_0x1f8af8);}return _0x3413d4[_0xbbd3('0x23')]();};}function saveUpdates(_0x1c8dc3,_0x4b47ad){return function(_0x41d370){if(_0x41d370){return _0x41d370[_0xbbd3('0x24')](_0x1c8dc3)[_0xbbd3('0x25')](function(_0x4b420e){return _0x4b420e;});}return null;};}function removeEntity(_0x4e139c,_0x471d2d){return function(_0x5620f7){if(_0x5620f7){return _0x5620f7[_0xbbd3('0x26')]()[_0xbbd3('0x25')](function(){var _0x39db16=_0x5620f7[_0xbbd3('0x27')]({'plain':!![]});var _0x1f1259=_0xbbd3('0x28');return db[_0xbbd3('0x29')][_0xbbd3('0x26')]({'where':{'type':_0x1f1259,'resourceId':_0x39db16['id']}})[_0xbbd3('0x25')](function(){return _0x5620f7;});})[_0xbbd3('0x25')](function(){_0x4e139c[_0xbbd3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2af7,_0x48c3d0){return function(_0x3f5d2c){if(!_0x3f5d2c){_0x4b2af7['sendStatus'](0x194);}return _0x3f5d2c;};}function handleError(_0x477e34,_0x4a0ac7){_0x4a0ac7=_0x4a0ac7||0x1f4;return function(_0x4c6de6){logger[_0xbbd3('0x2a')](_0x4c6de6[_0xbbd3('0x2b')]);if(_0x4c6de6[_0xbbd3('0x2c')]){delete _0x4c6de6['name'];}_0x477e34[_0xbbd3('0x19')](_0x4a0ac7)[_0xbbd3('0x2d')](_0x4c6de6);};}exports['index']=function(_0x314ade,_0x3da8fd){var _0x98a39e={},_0x28b498={},_0x1e1ed1={'count':0x0,'rows':[]};var _0x12750d=_[_0xbbd3('0x2e')](db[_0xbbd3('0x2f')]['rawAttributes'],function(_0x4c7710){return{'name':_0x4c7710['fieldName'],'type':_0x4c7710[_0xbbd3('0x30')]['key']};});_0x28b498[_0xbbd3('0x31')]=_[_0xbbd3('0x2e')](_0x12750d,_0xbbd3('0x2c'));_0x28b498['query']=_['keys'](_0x314ade['query']);_0x28b498['filters']=_[_0xbbd3('0x32')](_0x28b498['model'],_0x28b498['query']);_0x98a39e['attributes']=_[_0xbbd3('0x32')](_0x28b498['model'],qs[_0xbbd3('0x33')](_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x33')]));_0x98a39e[_0xbbd3('0x35')]=_0x98a39e[_0xbbd3('0x35')][_0xbbd3('0x36')]?_0x98a39e[_0xbbd3('0x35')]:_0x28b498[_0xbbd3('0x31')];if(!_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x37')](_0xbbd3('0x38'))){_0x98a39e[_0xbbd3('0x1e')]=qs[_0xbbd3('0x1e')](_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x1e')]);_0x98a39e[_0xbbd3('0x1c')]=qs[_0xbbd3('0x1c')](_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x1c')]);}_0x98a39e[_0xbbd3('0x39')]=qs[_0xbbd3('0x3a')](_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x3a')]);_0x98a39e['where']=qs[_0xbbd3('0x3b')](_[_0xbbd3('0x3c')](_0x314ade['query'],_0x28b498[_0xbbd3('0x3b')]),_0x12750d);if(_0x314ade['query'][_0xbbd3('0x3d')]){_0x98a39e['where']=_[_0xbbd3('0x3e')](_0x98a39e['where'],{'$or':_[_0xbbd3('0x2e')](_0x12750d,function(_0x1a762e){if(_0x1a762e[_0xbbd3('0x30')]!==_0xbbd3('0x3f')){var _0x431bee={};_0x431bee[_0x1a762e[_0xbbd3('0x2c')]]={'$like':'%'+_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x3d')]+'%'};return _0x431bee;}})});}_0x98a39e=_[_0xbbd3('0x3e')]({},_0x98a39e,_0x314ade['options']);var _0x22ad88={'where':_0x98a39e[_0xbbd3('0x40')]};return db['Sound'][_0xbbd3('0x1f')](_0x22ad88)[_0xbbd3('0x25')](function(_0x323fb3){_0x1e1ed1[_0xbbd3('0x1f')]=_0x323fb3;if(_0x314ade[_0xbbd3('0x34')][_0xbbd3('0x41')]){_0x98a39e[_0xbbd3('0x42')]=[{'all':!![]}];}return db[_0xbbd3('0x2f')]['findAll'](_0x98a39e);})[_0xbbd3('0x25')](function(_0x456e40){_0x1e1ed1[_0xbbd3('0x43')]=_0x456e40;return _0x1e1ed1;})[_0xbbd3('0x25')](respondWithFilteredResult(_0x3da8fd,_0x98a39e))[_0xbbd3('0x44')](handleError(_0x3da8fd,null));};exports['show']=function(_0x133350,_0x19633b){var _0x345b9f={'raw':!![],'where':{'id':_0x133350['params']['id']}},_0x594c54={};_0x594c54[_0xbbd3('0x31')]=_[_0xbbd3('0x45')](db['Sound'][_0xbbd3('0x46')]);_0x594c54['query']=_[_0xbbd3('0x45')](_0x133350['query']);_0x594c54[_0xbbd3('0x3b')]=_[_0xbbd3('0x32')](_0x594c54[_0xbbd3('0x31')],_0x594c54[_0xbbd3('0x34')]);_0x345b9f[_0xbbd3('0x35')]=_[_0xbbd3('0x32')](_0x594c54[_0xbbd3('0x31')],qs[_0xbbd3('0x33')](_0x133350[_0xbbd3('0x34')][_0xbbd3('0x33')]));_0x345b9f['attributes']=_0x345b9f[_0xbbd3('0x35')]['length']?_0x345b9f['attributes']:_0x594c54['model'];if(_0x133350[_0xbbd3('0x34')][_0xbbd3('0x41')]){_0x345b9f[_0xbbd3('0x42')]=[{'all':!![]}];}_0x345b9f=_[_0xbbd3('0x3e')]({},_0x345b9f,_0x133350['options']);return db[_0xbbd3('0x2f')][_0xbbd3('0x47')](_0x345b9f)[_0xbbd3('0x25')](handleEntityNotFound(_0x19633b,null))[_0xbbd3('0x25')](respondWithResult(_0x19633b,null))[_0xbbd3('0x44')](handleError(_0x19633b,null));};exports[_0xbbd3('0x48')]=function(_0xc8497f,_0x12578e,_0x59769c){return db[_0xbbd3('0x2f')]['find']({'where':{'id':_0xc8497f[_0xbbd3('0x49')]['id']},'attributes':[_0xbbd3('0x2c'),_0xbbd3('0x4a'),_0xbbd3('0x4b')],'raw':!![]})[_0xbbd3('0x25')](handleEntityNotFound(_0x12578e,null))[_0xbbd3('0x25')](function(_0xe7dcca){if(_0xe7dcca){if(!fs[_0xbbd3('0x4c')](path[_0xbbd3('0x4d')](config[_0xbbd3('0x4e')],_0xbbd3('0x4f'),_0xe7dcca[_0xbbd3('0x4a')]+'.'+_0xe7dcca['converted_format']))){throw new db[(_0xbbd3('0x50'))][(_0xbbd3('0x51'))](_0xbbd3('0x52'));}return _0x12578e[_0xbbd3('0x48')](path['join'](config[_0xbbd3('0x4e')],'server/files/sounds/converted',util[_0xbbd3('0x53')]('%s.%s',_0xe7dcca[_0xbbd3('0x4a')],_0xe7dcca[_0xbbd3('0x4b')])),util['format'](_0xbbd3('0x54'),_0xe7dcca['name'],_0xe7dcca[_0xbbd3('0x4b')]));}return null;})[_0xbbd3('0x44')](handleError(_0x12578e,null));};exports['create']=function(_0x4bbdb3,_0x18cda9,_0x3ff294){var _0x145e26={'name':path[_0xbbd3('0x55')](_0x4bbdb3[_0xbbd3('0x56')][_0xbbd3('0x57')],path[_0xbbd3('0x58')](_0x4bbdb3['file'][_0xbbd3('0x57')])),'save_name':path['basename'](_0x4bbdb3[_0xbbd3('0x56')]['filename'],path['extname'](_0x4bbdb3[_0xbbd3('0x56')][_0xbbd3('0x59')])),'original_format':path['extname'](_0x4bbdb3[_0xbbd3('0x56')][_0xbbd3('0x57')])[_0xbbd3('0x5a')](0x1),'converted_format':_0xbbd3('0x5b')};var _0x2efcf0=path[_0xbbd3('0x4d')](config['root'],_0xbbd3('0x5c'),_0x4bbdb3[_0xbbd3('0x56')][_0xbbd3('0x59')]);var _0x1e8135=path['join'](config[_0xbbd3('0x4e')],_0xbbd3('0x4f'),util[_0xbbd3('0x53')]('%s.%s',path['basename'](_0x4bbdb3['file'][_0xbbd3('0x59')],path['extname'](_0x4bbdb3[_0xbbd3('0x56')][_0xbbd3('0x59')])),_0x145e26[_0xbbd3('0x4b')]));logger['info'](_0xbbd3('0x5d'),_0x2efcf0);logger[_0xbbd3('0x5e')](_0xbbd3('0x5f'),_0x1e8135);try{fs[_0xbbd3('0x60')](_0x2efcf0,parseInt(_0xbbd3('0x61'),0x8));var _0x41d3ba=sox[_0xbbd3('0x62')](_0x2efcf0,_0x1e8135,{'sampleRate':0x1f40,'format':_0xbbd3('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x41d3ba['on']('error',function(_0x3d0051){fs['unlinkSync'](_0x2efcf0);_0x18cda9[_0xbbd3('0x19')](0x1f4)[_0xbbd3('0x2d')](_0x3d0051);});_0x41d3ba['on']('src',function(_0x395e6b){_0x145e26['original_duration']=isNaN(_0x395e6b['duration'])?null:_0x395e6b[_0xbbd3('0x63')]*0x3e8;_0x145e26[_0xbbd3('0x64')]=isNaN(_0x395e6b[_0xbbd3('0x65')])?null:_0x395e6b[_0xbbd3('0x65')];_0x145e26[_0xbbd3('0x66')]=isNaN(_0x395e6b[_0xbbd3('0x67')])?null:_0x395e6b['channelCount'];_0x145e26['original_bitRate']=isNaN(_0x395e6b['bitRate'])?null:_0x395e6b['bitRate'];_0x145e26[_0xbbd3('0x68')]=isNaN(_0x395e6b[_0xbbd3('0x69')])?null:_0x395e6b[_0xbbd3('0x69')];});_0x41d3ba['on'](_0xbbd3('0x6a'),function(_0x15dc4c){_0x145e26[_0xbbd3('0x6b')]=isNaN(_0x15dc4c['duration'])?null:_0x15dc4c[_0xbbd3('0x63')]*0x3e8;_0x145e26[_0xbbd3('0x6c')]=isNaN(_0x15dc4c[_0xbbd3('0x65')])?null:_0x15dc4c[_0xbbd3('0x65')];_0x145e26[_0xbbd3('0x6d')]=isNaN(_0x15dc4c[_0xbbd3('0x67')])?null:_0x15dc4c[_0xbbd3('0x67')];_0x145e26[_0xbbd3('0x6e')]=isNaN(_0x15dc4c['bitRate'])?null:_0x15dc4c['bitRate'];_0x145e26[_0xbbd3('0x6f')]=isNaN(_0x15dc4c[_0xbbd3('0x69')])?null:_0x15dc4c[_0xbbd3('0x69')];});_0x41d3ba['on'](_0xbbd3('0x1a'),function(){fs[_0xbbd3('0x60')](_0x1e8135,parseInt(_0xbbd3('0x61'),0x8));return db[_0xbbd3('0x2f')][_0xbbd3('0x70')](_0x145e26)['then'](function(_0x570f6c){var _0x168e41={'role':_0x4bbdb3[_0xbbd3('0x71')]['role'],'userProfileId':_0x4bbdb3['body'][_0xbbd3('0x72')]};if(!_0x168e41)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x168e41[_0xbbd3('0x73')]==='user'){var _0x187443=_0x570f6c[_0xbbd3('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xbbd3('0x28'),'userProfileId':_0x168e41['userProfileId']},'raw':!![]})[_0xbbd3('0x25')](function(_0x38241c){if(_0x38241c&&_0x38241c[_0xbbd3('0x74')]===0x0){return db[_0xbbd3('0x29')][_0xbbd3('0x70')]({'name':_0x187443[_0xbbd3('0x2c')],'resourceId':_0x187443['id'],'type':_0x38241c[_0xbbd3('0x2c')],'sectionId':_0x38241c['id']},{})[_0xbbd3('0x25')](function(){return _0x570f6c;});}else{return _0x570f6c;}})['catch'](function(_0x1a95ab){logger[_0xbbd3('0x2a')](_0xbbd3('0x75'),_0x1a95ab);throw _0x1a95ab;});}return _0x570f6c;})[_0xbbd3('0x25')](respondWithResult(_0x18cda9,null))[_0xbbd3('0x44')](handleError(_0x18cda9,null));});_0x41d3ba[_0xbbd3('0x76')]();}catch(_0x2799c8){_0x18cda9[_0xbbd3('0x19')](0x1f4)['send'](_0x2799c8);}};exports[_0xbbd3('0x24')]=function(_0x4850b6,_0x424a33,_0x51056a){return db[_0xbbd3('0x2f')][_0xbbd3('0x47')]({'where':{'id':_0x4850b6[_0xbbd3('0x49')]['id']}})[_0xbbd3('0x25')](handleEntityNotFound(_0x424a33,null))[_0xbbd3('0x25')](saveUpdates(_[_0xbbd3('0x3c')](_0x4850b6['body'],['name',_0xbbd3('0x77')]),null))[_0xbbd3('0x25')](respondWithResult(_0x424a33,null))[_0xbbd3('0x44')](handleError(_0x424a33,null));};exports[_0xbbd3('0x78')]=function(_0x3d73a9,_0x58d981,_0x2166be){return db[_0xbbd3('0x2f')][_0xbbd3('0x47')]({'where':{'id':_0x3d73a9[_0xbbd3('0x49')]['id']}})[_0xbbd3('0x25')](function(_0xbb8266){if(_0xbb8266){return _0xbb8266[_0xbbd3('0x26')]();}})[_0xbbd3('0x25')](function(_0x2f2fd6){var _0x28f894=path[_0xbbd3('0x4d')](config[_0xbbd3('0x4e')],_0xbbd3('0x5c'),util[_0xbbd3('0x53')](_0xbbd3('0x54'),_0x2f2fd6[_0xbbd3('0x4a')],_0x2f2fd6[_0xbbd3('0x79')]));var _0x51928d=path['join'](config[_0xbbd3('0x4e')],_0xbbd3('0x4f'),util[_0xbbd3('0x53')]('%s.%s',_0x2f2fd6[_0xbbd3('0x4a')],_0x2f2fd6[_0xbbd3('0x4b')]));fs[_0xbbd3('0x7a')](_0x28f894);fs[_0xbbd3('0x7a')](_0x51928d);return _0x2f2fd6;})[_0xbbd3('0x25')](function(_0x49d2e5){if(_0x49d2e5){return _0x58d981[_0xbbd3('0x19')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x58d981,null))[_0xbbd3('0x44')](handleError(_0x58d981,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 84e2a3e..105003b 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 _0x4016=['util','api','moment','bluebird','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x456066,_0x44930c){var _0x5a069a=function(_0x2ed314){while(--_0x2ed314){_0x456066['push'](_0x456066['shift']());}};_0x5a069a(++_0x44930c);}(_0x4016,0x18b));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6401('0x0'));var util=require(_0x6401('0x1'));var logger=require('../../config/logger')(_0x6401('0x2'));var moment=require(_0x6401('0x3'));var BPromise=require(_0x6401('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6401('0x5'));var config=require(_0x6401('0x6'));var attributes=require(_0x6401('0x7'));module[_0x6401('0x8')]=function(_0x52fec5,_0xa1168e){return _0x52fec5['define'](_0x6401('0x9'),attributes,{'tableName':_0x6401('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad14=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x8cb1f9,_0xd1ae98){var _0x19b00e=function(_0x204f0b){while(--_0x204f0b){_0x8cb1f9['push'](_0x8cb1f9['shift']());}};_0x19b00e(++_0xd1ae98);}(_0xad14,0xe4));var _0x4ad1=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0xad14[_0x171520];return _0x3cc729;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var logger=require(_0x4ad1('0x2'))(_0x4ad1('0x3'));var moment=require(_0x4ad1('0x4'));var BPromise=require(_0x4ad1('0x5'));var rp=require(_0x4ad1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ad1('0x7'));var config=require(_0x4ad1('0x8'));var attributes=require(_0x4ad1('0x9'));module[_0x4ad1('0xa')]=function(_0x1c83dc,_0x4d82e3){return _0x1c83dc[_0x4ad1('0xb')](_0x4ad1('0xc'),attributes,{'tableName':_0x4ad1('0xd'),'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 5c5bf7a..f798f2c 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 _0xadde=['request\x20sent','stringify','error','code','message','result','catch','options','raw','attributes','model','include','map','ShowSound','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xadde,0x176));var _0xeadd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xeadd('0x0'));var moment=require(_0xeadd('0x1'));var BPromise=require(_0xeadd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeadd('0x3'));var db=require(_0xeadd('0x4'))['db'];var utils=require(_0xeadd('0x5'));var logger=require(_0xeadd('0x6'))(_0xeadd('0x7'));var config=require(_0xeadd('0x8'));var jayson=require(_0xeadd('0x9'));var client=jayson[_0xeadd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bcfb3,_0x1c19ac,_0x47cbaa){return new BPromise(function(_0x5ad5e2,_0x7aadf8){return client[_0xeadd('0xb')](_0x2bcfb3,_0x47cbaa)[_0xeadd('0xc')](function(_0x31f1c9){logger['info'](_0xeadd('0xd'),_0x1c19ac,'request\x20sent');logger[_0xeadd('0xe')](_0xeadd('0xf'),_0x1c19ac,_0xeadd('0x10'),JSON[_0xeadd('0x11')](_0x31f1c9));if(_0x31f1c9[_0xeadd('0x12')]){if(_0x31f1c9[_0xeadd('0x12')][_0xeadd('0x13')]===0x1f4){logger[_0xeadd('0x12')](_0xeadd('0xd'),_0x1c19ac,_0x31f1c9[_0xeadd('0x12')][_0xeadd('0x14')]);return _0x7aadf8(_0x31f1c9[_0xeadd('0x12')]['message']);}logger[_0xeadd('0x12')]('Sound,\x20%s,\x20%s',_0x1c19ac,_0x31f1c9[_0xeadd('0x12')][_0xeadd('0x14')]);return _0x5ad5e2(_0x31f1c9[_0xeadd('0x12')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x1c19ac,'request\x20sent');_0x5ad5e2(_0x31f1c9[_0xeadd('0x15')]['message']);}})[_0xeadd('0x16')](function(_0x31c363){logger[_0xeadd('0x12')](_0xeadd('0xd'),_0x1c19ac,_0x31c363);_0x7aadf8(_0x31c363);});});}exports['ShowSound']=function(_0x1051a7){var _0x352fe8=this;return new Promise(function(_0x54977f,_0x278e0a){return db['Sound']['find']({'raw':_0x1051a7[_0xeadd('0x17')]?_0x1051a7[_0xeadd('0x17')][_0xeadd('0x18')]===undefined?!![]:![]:!![],'where':_0x1051a7[_0xeadd('0x17')]?_0x1051a7[_0xeadd('0x17')]['where']||null:null,'attributes':_0x1051a7[_0xeadd('0x17')]?_0x1051a7[_0xeadd('0x17')][_0xeadd('0x19')]||null:null,'include':_0x1051a7[_0xeadd('0x17')]?_0x1051a7[_0xeadd('0x17')]['include']?_['map'](_0x1051a7[_0xeadd('0x17')]['include'],function(_0x459b6a){return{'model':db[_0x459b6a[_0xeadd('0x1a')]],'as':_0x459b6a['as'],'attributes':_0x459b6a[_0xeadd('0x19')],'include':_0x459b6a[_0xeadd('0x1b')]?_[_0xeadd('0x1c')](_0x459b6a[_0xeadd('0x1b')],function(_0x23c7ba){return{'model':db[_0x23c7ba['model']],'as':_0x23c7ba['as'],'attributes':_0x23c7ba[_0xeadd('0x19')],'include':_0x23c7ba[_0xeadd('0x1b')]?_[_0xeadd('0x1c')](_0x23c7ba[_0xeadd('0x1b')],function(_0x34e9a5){return{'model':db[_0x34e9a5[_0xeadd('0x1a')]],'as':_0x34e9a5['as'],'attributes':_0x34e9a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xeadd('0xc')](function(_0x233216){logger['info']('ShowSound',_0x1051a7);logger[_0xeadd('0xe')](_0xeadd('0x1d'),_0x1051a7,JSON[_0xeadd('0x11')](_0x233216));_0x54977f(_0x233216);})[_0xeadd('0x16')](function(_0x5b3e27){logger[_0xeadd('0x12')](_0xeadd('0x1d'),_0x5b3e27[_0xeadd('0x14')],_0x1051a7);_0x278e0a(_0x352fe8[_0xeadd('0x12')](0x1f4,_0x5b3e27[_0xeadd('0x14')]));});});}; \ No newline at end of file +var _0x5aed=['where','include','map','attributes','model','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','ShowSound','Sound','find','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5aed,0x1b7));var _0xd5ae=function(_0x3fd6b2,_0x21d327){_0x3fd6b2=_0x3fd6b2-0x0;var _0x10e8e7=_0x5aed[_0x3fd6b2];return _0x10e8e7;};'use strict';var _=require(_0xd5ae('0x0'));var util=require(_0xd5ae('0x1'));var moment=require(_0xd5ae('0x2'));var BPromise=require(_0xd5ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5ae('0x5'));var logger=require(_0xd5ae('0x6'))(_0xd5ae('0x7'));var config=require(_0xd5ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd5ae('0x9')][_0xd5ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6b6b,_0x21fa22,_0xd105d5){return new BPromise(function(_0x35f642,_0x5801b0){return client[_0xd5ae('0xb')](_0x4b6b6b,_0xd105d5)[_0xd5ae('0xc')](function(_0x4ff587){logger[_0xd5ae('0xd')](_0xd5ae('0xe'),_0x21fa22,'request\x20sent');logger[_0xd5ae('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x21fa22,_0xd5ae('0x10'),JSON[_0xd5ae('0x11')](_0x4ff587));if(_0x4ff587[_0xd5ae('0x12')]){if(_0x4ff587[_0xd5ae('0x12')]['code']===0x1f4){logger['error'](_0xd5ae('0xe'),_0x21fa22,_0x4ff587['error'][_0xd5ae('0x13')]);return _0x5801b0(_0x4ff587['error'][_0xd5ae('0x13')]);}logger[_0xd5ae('0x12')](_0xd5ae('0xe'),_0x21fa22,_0x4ff587[_0xd5ae('0x12')][_0xd5ae('0x13')]);return _0x35f642(_0x4ff587[_0xd5ae('0x12')][_0xd5ae('0x13')]);}else{logger['info'](_0xd5ae('0xe'),_0x21fa22,'request\x20sent');_0x35f642(_0x4ff587[_0xd5ae('0x14')][_0xd5ae('0x13')]);}})[_0xd5ae('0x15')](function(_0x14ffa7){logger['error'](_0xd5ae('0xe'),_0x21fa22,_0x14ffa7);_0x5801b0(_0x14ffa7);});});}exports[_0xd5ae('0x16')]=function(_0xcf1e9d){var _0x9f8774=this;return new Promise(function(_0x22c9e1,_0x53d161){return db[_0xd5ae('0x17')][_0xd5ae('0x18')]({'raw':_0xcf1e9d['options']?_0xcf1e9d['options']['raw']===undefined?!![]:![]:!![],'where':_0xcf1e9d[_0xd5ae('0x19')]?_0xcf1e9d[_0xd5ae('0x19')][_0xd5ae('0x1a')]||null:null,'attributes':_0xcf1e9d[_0xd5ae('0x19')]?_0xcf1e9d[_0xd5ae('0x19')]['attributes']||null:null,'include':_0xcf1e9d[_0xd5ae('0x19')]?_0xcf1e9d[_0xd5ae('0x19')][_0xd5ae('0x1b')]?_[_0xd5ae('0x1c')](_0xcf1e9d['options'][_0xd5ae('0x1b')],function(_0x5e6c6c){return{'model':db[_0x5e6c6c['model']],'as':_0x5e6c6c['as'],'attributes':_0x5e6c6c[_0xd5ae('0x1d')],'include':_0x5e6c6c[_0xd5ae('0x1b')]?_[_0xd5ae('0x1c')](_0x5e6c6c['include'],function(_0x538f7e){return{'model':db[_0x538f7e[_0xd5ae('0x1e')]],'as':_0x538f7e['as'],'attributes':_0x538f7e[_0xd5ae('0x1d')],'include':_0x538f7e[_0xd5ae('0x1b')]?_[_0xd5ae('0x1c')](_0x538f7e[_0xd5ae('0x1b')],function(_0xec81a6){return{'model':db[_0xec81a6['model']],'as':_0xec81a6['as'],'attributes':_0xec81a6[_0xd5ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd5ae('0xc')](function(_0x14d69c){logger[_0xd5ae('0xd')]('ShowSound',_0xcf1e9d);logger[_0xd5ae('0xf')]('ShowSound',_0xcf1e9d,JSON['stringify'](_0x14d69c));_0x22c9e1(_0x14d69c);})[_0xd5ae('0x15')](function(_0xbfeb39){logger[_0xd5ae('0x12')](_0xd5ae('0x16'),_0xbfeb39[_0xd5ae('0x13')],_0xcf1e9d);_0x53d161(_0x9f8774[_0xd5ae('0x12')](0x1f4,_0xbfeb39[_0xd5ae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index baaccd9..022d8b8 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0x4fc2,0x111));var _0x24fc=function(_0xbf99dd,_0x255ca3){_0xbf99dd=_0xbf99dd-0x0;var _0x3f173d=_0x4fc2[_0xbf99dd];return _0x3f173d;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x26a1dc,_0x380fb3){var _0x529678=function(_0x2c8c14){while(--_0x2c8c14){_0x26a1dc['push'](_0x26a1dc['shift']());}};_0x529678(++_0x380fb3);}(_0xda2d,0x102));var _0xdda2=function(_0x34cae5,_0x4fff67){_0x34cae5=_0x34cae5-0x0;var _0xa74aca=_0xda2d[_0x34cae5];return _0xa74aca;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ef1ef62..780bc99 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 _0x9fbb=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x9fbb,0x16b));var _0xb9fb=function(_0x5deb46,_0x2faf48){_0x5deb46=_0x5deb46-0x0;var _0x283e38=_0x9fbb[_0x5deb46];return _0x283e38;};'use strict';var Sequelize=require(_0xb9fb('0x0'));module[_0xb9fb('0x1')]={'uniqueid':{'type':Sequelize[_0xb9fb('0x2')]},'body':{'type':Sequelize[_0xb9fb('0x3')](_0xb9fb('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xb9fb('0x5')]('in',_0xb9fb('0x6')),'defaultValue':_0xb9fb('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb9fb('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x00fc=['sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x00fc,0x1a4));var _0xc00f=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x00fc[_0x21d0c3];return _0x4df18e;};'use strict';var Sequelize=require(_0xc00f('0x0'));module[_0xc00f('0x1')]={'uniqueid':{'type':Sequelize[_0xc00f('0x2')]},'body':{'type':Sequelize[_0xc00f('0x3')](_0xc00f('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xc00f('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc00f('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 47d26cf..9109e4f 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 _0x17bb=['merge','where','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','sort','pick','filter'];(function(_0x3c1d25,_0x2ae2e6){var _0xf5747f=function(_0x4e16e1){while(--_0x4e16e1){_0x3c1d25['push'](_0x3c1d25['shift']());}};_0xf5747f(++_0x2ae2e6);}(_0x17bb,0x188));var _0xb17b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x17bb[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xb17b('0x0'));var rimraf=require(_0xb17b('0x1'));var zipdir=require(_0xb17b('0x2'));var jsonpatch=require(_0xb17b('0x3'));var rp=require(_0xb17b('0x4'));var moment=require(_0xb17b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb17b('0x6'));var util=require(_0xb17b('0x7'));var path=require(_0xb17b('0x8'));var sox=require(_0xb17b('0x9'));var csv=require('to-csv');var ejs=require(_0xb17b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb17b('0xb'));var squel=require(_0xb17b('0xc'));var crypto=require(_0xb17b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb17b('0xe'));var toCsv=require(_0xb17b('0xf'));var querystring=require(_0xb17b('0x10'));var Papa=require(_0xb17b('0x11'));var Redis=require(_0xb17b('0x12'));var authService=require(_0xb17b('0x13'));var qs=require(_0xb17b('0x14'));var as=require(_0xb17b('0x15'));var hardwareService=require(_0xb17b('0x16'));var logger=require('../../config/logger')(_0xb17b('0x17'));var utils=require('../../config/utils');var config=require(_0xb17b('0x18'));var licenseUtil=require(_0xb17b('0x19'));var db=require(_0xb17b('0x1a'))['db'];function respondWithStatusCode(_0x5ce3a2,_0x52aad7){_0x52aad7=_0x52aad7||0xcc;return function(_0x28707d){if(_0x28707d){return _0x5ce3a2[_0xb17b('0x1b')](_0x52aad7);}return _0x5ce3a2[_0xb17b('0x1c')](_0x52aad7)[_0xb17b('0x1d')]();};}function respondWithResult(_0x1e8d03,_0x4a1490){_0x4a1490=_0x4a1490||0xc8;return function(_0x4abbf2){if(_0x4abbf2){return _0x1e8d03['status'](_0x4a1490)['json'](_0x4abbf2);}};}function respondWithFilteredResult(_0x4b3086,_0x1a8345){return function(_0x518482){if(_0x518482){var _0x428426=typeof _0x1a8345['offset']===_0xb17b('0x1e')&&typeof _0x1a8345[_0xb17b('0x1f')]===_0xb17b('0x1e');var _0x2ffc42=_0x518482['count'];var _0x44f63b=_0x428426?0x0:_0x1a8345[_0xb17b('0x20')];var _0x393657=_0x428426?_0x518482[_0xb17b('0x21')]:_0x1a8345[_0xb17b('0x20')]+_0x1a8345[_0xb17b('0x1f')];var _0x3008e9;if(_0x393657>=_0x2ffc42){_0x393657=_0x2ffc42;_0x3008e9=0xc8;}else{_0x3008e9=0xce;}_0x4b3086[_0xb17b('0x1c')](_0x3008e9);return _0x4b3086[_0xb17b('0x22')](_0xb17b('0x23'),_0x44f63b+'-'+_0x393657+'/'+_0x2ffc42)[_0xb17b('0x24')](_0x518482);}return null;};}function patchUpdates(_0x852753){return function(_0x5e5a81){try{jsonpatch[_0xb17b('0x25')](_0x5e5a81,_0x852753,!![]);}catch(_0x55def7){return BPromise[_0xb17b('0x26')](_0x55def7);}return _0x5e5a81['save']();};}function saveUpdates(_0x12898f,_0xc8558c){return function(_0x477293){if(_0x477293){return _0x477293[_0xb17b('0x27')](_0x12898f)['then'](function(_0x14604e){return _0x14604e;});}return null;};}function removeEntity(_0x205e39,_0x28efa1){return function(_0x433bd7){if(_0x433bd7){return _0x433bd7[_0xb17b('0x28')]()[_0xb17b('0x29')](function(){_0x205e39[_0xb17b('0x1c')](0xcc)[_0xb17b('0x1d')]();});}};}function handleEntityNotFound(_0x35f25b,_0x2da0bf){return function(_0x1f6124){if(!_0x1f6124){_0x35f25b['sendStatus'](0x194);}return _0x1f6124;};}function handleError(_0x3879fb,_0x2387ea){_0x2387ea=_0x2387ea||0x1f4;return function(_0x4ddf27){logger[_0xb17b('0x2a')](_0x4ddf27[_0xb17b('0x2b')]);if(_0x4ddf27['name']){delete _0x4ddf27[_0xb17b('0x2c')];}_0x3879fb['status'](_0x2387ea)[_0xb17b('0x2d')](_0x4ddf27);};}exports['index']=function(_0x425fb4,_0x33d0b2){var _0x50ec97={},_0xf45626={},_0x53ac71={'count':0x0,'rows':[]};var _0x2fa548=_[_0xb17b('0x2e')](db[_0xb17b('0x2f')][_0xb17b('0x30')],function(_0x38e1c7){return{'name':_0x38e1c7[_0xb17b('0x31')],'type':_0x38e1c7[_0xb17b('0x32')][_0xb17b('0x33')]};});_0xf45626[_0xb17b('0x34')]=_['map'](_0x2fa548,_0xb17b('0x2c'));_0xf45626['query']=_[_0xb17b('0x35')](_0x425fb4['query']);_0xf45626[_0xb17b('0x36')]=_[_0xb17b('0x37')](_0xf45626[_0xb17b('0x34')],_0xf45626[_0xb17b('0x38')]);_0x50ec97['attributes']=_['intersection'](_0xf45626[_0xb17b('0x34')],qs[_0xb17b('0x39')](_0x425fb4['query'][_0xb17b('0x39')]));_0x50ec97[_0xb17b('0x3a')]=_0x50ec97[_0xb17b('0x3a')][_0xb17b('0x3b')]?_0x50ec97[_0xb17b('0x3a')]:_0xf45626[_0xb17b('0x34')];if(!_0x425fb4['query']['hasOwnProperty'](_0xb17b('0x3c'))){_0x50ec97[_0xb17b('0x1f')]=qs['limit'](_0x425fb4[_0xb17b('0x38')]['limit']);_0x50ec97[_0xb17b('0x20')]=qs[_0xb17b('0x20')](_0x425fb4['query'][_0xb17b('0x20')]);}_0x50ec97['order']=qs[_0xb17b('0x3d')](_0x425fb4[_0xb17b('0x38')][_0xb17b('0x3d')]);_0x50ec97['where']=qs['filters'](_[_0xb17b('0x3e')](_0x425fb4[_0xb17b('0x38')],_0xf45626[_0xb17b('0x36')]),_0x2fa548);if(_0x425fb4[_0xb17b('0x38')][_0xb17b('0x3f')]){_0x50ec97['where']=_[_0xb17b('0x40')](_0x50ec97[_0xb17b('0x41')],{'$or':_[_0xb17b('0x2e')](_0x2fa548,function(_0x44a647){if(_0x44a647['type']!==_0xb17b('0x42')){var _0x1bf04c={};_0x1bf04c[_0x44a647['name']]={'$like':'%'+_0x425fb4['query']['filter']+'%'};return _0x1bf04c;}})});}_0x50ec97=_[_0xb17b('0x40')]({},_0x50ec97,_0x425fb4[_0xb17b('0x43')]);var _0x26ea61={'where':_0x50ec97[_0xb17b('0x41')]};return db[_0xb17b('0x2f')][_0xb17b('0x21')](_0x26ea61)[_0xb17b('0x29')](function(_0x381988){_0x53ac71['count']=_0x381988;if(_0x425fb4['query'][_0xb17b('0x44')]){_0x50ec97['include']=[{'all':!![]}];}return db[_0xb17b('0x2f')]['findAll'](_0x50ec97);})[_0xb17b('0x29')](function(_0x4ddd77){_0x53ac71[_0xb17b('0x45')]=_0x4ddd77;return _0x53ac71;})[_0xb17b('0x29')](respondWithFilteredResult(_0x33d0b2,_0x50ec97))[_0xb17b('0x46')](handleError(_0x33d0b2,null));};exports['show']=function(_0x3a87f2,_0x494b29){var _0x4a2756={'raw':!![],'where':{'id':_0x3a87f2['params']['id']}},_0x12d899={};_0x12d899['model']=_[_0xb17b('0x35')](db[_0xb17b('0x2f')][_0xb17b('0x30')]);_0x12d899[_0xb17b('0x38')]=_[_0xb17b('0x35')](_0x3a87f2[_0xb17b('0x38')]);_0x12d899['filters']=_[_0xb17b('0x37')](_0x12d899['model'],_0x12d899[_0xb17b('0x38')]);_0x4a2756[_0xb17b('0x3a')]=_['intersection'](_0x12d899[_0xb17b('0x34')],qs[_0xb17b('0x39')](_0x3a87f2[_0xb17b('0x38')][_0xb17b('0x39')]));_0x4a2756[_0xb17b('0x3a')]=_0x4a2756['attributes'][_0xb17b('0x3b')]?_0x4a2756['attributes']:_0x12d899[_0xb17b('0x34')];if(_0x3a87f2[_0xb17b('0x38')][_0xb17b('0x44')]){_0x4a2756[_0xb17b('0x47')]=[{'all':!![]}];}_0x4a2756=_['merge']({},_0x4a2756,_0x3a87f2['options']);return db[_0xb17b('0x2f')][_0xb17b('0x48')](_0x4a2756)['then'](handleEntityNotFound(_0x494b29,null))[_0xb17b('0x29')](respondWithResult(_0x494b29,null))[_0xb17b('0x46')](handleError(_0x494b29,null));};exports[_0xb17b('0x49')]=function(_0xf03e9e,_0x5f28f4){return db['SquareMessage']['create'](_0xf03e9e[_0xb17b('0x4a')],{})[_0xb17b('0x29')](respondWithResult(_0x5f28f4,0xc9))['catch'](handleError(_0x5f28f4,null));};exports[_0xb17b('0x27')]=function(_0x46fd3c,_0x2c4c51){if(_0x46fd3c[_0xb17b('0x4a')]['id']){delete _0x46fd3c[_0xb17b('0x4a')]['id'];}return db[_0xb17b('0x2f')][_0xb17b('0x48')]({'where':{'id':_0x46fd3c[_0xb17b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c4c51,null))['then'](saveUpdates(_0x46fd3c[_0xb17b('0x4a')],null))['then'](respondWithResult(_0x2c4c51,null))[_0xb17b('0x46')](handleError(_0x2c4c51,null));};exports[_0xb17b('0x28')]=function(_0x3e4238,_0x58dfa1){return db[_0xb17b('0x2f')][_0xb17b('0x48')]({'where':{'id':_0x3e4238['params']['id']}})[_0xb17b('0x29')](handleEntityNotFound(_0x58dfa1,null))[_0xb17b('0x29')](removeEntity(_0x58dfa1,null))[_0xb17b('0x46')](handleError(_0x58dfa1,null));}; \ No newline at end of file +var _0xe510=['then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','SquareMessage','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','save','update'];(function(_0x1c206c,_0x30bdcf){var _0x188aaa=function(_0x49ff11){while(--_0x49ff11){_0x1c206c['push'](_0x1c206c['shift']());}};_0x188aaa(++_0x30bdcf);}(_0xe510,0x10a));var _0x0e51=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe510[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x0e51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e51('0x1'));var jsonpatch=require(_0x0e51('0x2'));var rp=require(_0x0e51('0x3'));var moment=require(_0x0e51('0x4'));var BPromise=require(_0x0e51('0x5'));var Mustache=require(_0x0e51('0x6'));var util=require(_0x0e51('0x7'));var path=require(_0x0e51('0x8'));var sox=require('sox');var csv=require(_0x0e51('0x9'));var ejs=require(_0x0e51('0xa'));var fs=require('fs');var fs_extra=require(_0x0e51('0xb'));var _=require('lodash');var squel=require(_0x0e51('0xc'));var crypto=require(_0x0e51('0xd'));var jsforce=require(_0x0e51('0xe'));var deskjs=require(_0x0e51('0xf'));var toCsv=require(_0x0e51('0x9'));var querystring=require('querystring');var Papa=require(_0x0e51('0x10'));var Redis=require(_0x0e51('0x11'));var authService=require(_0x0e51('0x12'));var qs=require(_0x0e51('0x13'));var as=require(_0x0e51('0x14'));var hardwareService=require(_0x0e51('0x15'));var logger=require('../../config/logger')(_0x0e51('0x16'));var utils=require(_0x0e51('0x17'));var config=require(_0x0e51('0x18'));var licenseUtil=require(_0x0e51('0x19'));var db=require(_0x0e51('0x1a'))['db'];function respondWithStatusCode(_0x311d83,_0x46a0c4){_0x46a0c4=_0x46a0c4||0xcc;return function(_0x5c5162){if(_0x5c5162){return _0x311d83[_0x0e51('0x1b')](_0x46a0c4);}return _0x311d83[_0x0e51('0x1c')](_0x46a0c4)[_0x0e51('0x1d')]();};}function respondWithResult(_0xd6cd08,_0x3cf4ba){_0x3cf4ba=_0x3cf4ba||0xc8;return function(_0x46043b){if(_0x46043b){return _0xd6cd08[_0x0e51('0x1c')](_0x3cf4ba)['json'](_0x46043b);}};}function respondWithFilteredResult(_0x3970f4,_0x14f6a1){return function(_0x24136e){if(_0x24136e){var _0xdef08f=typeof _0x14f6a1[_0x0e51('0x1e')]===_0x0e51('0x1f')&&typeof _0x14f6a1['limit']===_0x0e51('0x1f');var _0x169b40=_0x24136e['count'];var _0x4bb0fb=_0xdef08f?0x0:_0x14f6a1[_0x0e51('0x1e')];var _0x4989a4=_0xdef08f?_0x24136e[_0x0e51('0x20')]:_0x14f6a1[_0x0e51('0x1e')]+_0x14f6a1[_0x0e51('0x21')];var _0x465067;if(_0x4989a4>=_0x169b40){_0x4989a4=_0x169b40;_0x465067=0xc8;}else{_0x465067=0xce;}_0x3970f4[_0x0e51('0x1c')](_0x465067);return _0x3970f4['set'](_0x0e51('0x22'),_0x4bb0fb+'-'+_0x4989a4+'/'+_0x169b40)[_0x0e51('0x23')](_0x24136e);}return null;};}function patchUpdates(_0x39cd8a){return function(_0x13db15){try{jsonpatch['apply'](_0x13db15,_0x39cd8a,!![]);}catch(_0x5ef3d2){return BPromise['reject'](_0x5ef3d2);}return _0x13db15[_0x0e51('0x24')]();};}function saveUpdates(_0x48ab6c,_0x5747cc){return function(_0x41551c){if(_0x41551c){return _0x41551c[_0x0e51('0x25')](_0x48ab6c)[_0x0e51('0x26')](function(_0x4e3899){return _0x4e3899;});}return null;};}function removeEntity(_0x2587e7,_0x20215d){return function(_0x57ea7f){if(_0x57ea7f){return _0x57ea7f[_0x0e51('0x27')]()['then'](function(){_0x2587e7['status'](0xcc)[_0x0e51('0x1d')]();});}};}function handleEntityNotFound(_0xe663d2,_0x555548){return function(_0x4cf46b){if(!_0x4cf46b){_0xe663d2['sendStatus'](0x194);}return _0x4cf46b;};}function handleError(_0x7b8ced,_0x452433){_0x452433=_0x452433||0x1f4;return function(_0x5bf72b){logger[_0x0e51('0x28')](_0x5bf72b[_0x0e51('0x29')]);if(_0x5bf72b['name']){delete _0x5bf72b[_0x0e51('0x2a')];}_0x7b8ced[_0x0e51('0x1c')](_0x452433)['send'](_0x5bf72b);};}exports[_0x0e51('0x2b')]=function(_0x14ba45,_0x79e002){var _0x8dd1c0={},_0x1b1f68={},_0x3be5c5={'count':0x0,'rows':[]};var _0x21f526=_['map'](db['SquareMessage'][_0x0e51('0x2c')],function(_0x8500a4){return{'name':_0x8500a4[_0x0e51('0x2d')],'type':_0x8500a4[_0x0e51('0x2e')][_0x0e51('0x2f')]};});_0x1b1f68[_0x0e51('0x30')]=_['map'](_0x21f526,_0x0e51('0x2a'));_0x1b1f68['query']=_['keys'](_0x14ba45[_0x0e51('0x31')]);_0x1b1f68['filters']=_[_0x0e51('0x32')](_0x1b1f68['model'],_0x1b1f68[_0x0e51('0x31')]);_0x8dd1c0['attributes']=_[_0x0e51('0x32')](_0x1b1f68[_0x0e51('0x30')],qs['fields'](_0x14ba45[_0x0e51('0x31')][_0x0e51('0x33')]));_0x8dd1c0[_0x0e51('0x34')]=_0x8dd1c0['attributes'][_0x0e51('0x35')]?_0x8dd1c0['attributes']:_0x1b1f68[_0x0e51('0x30')];if(!_0x14ba45[_0x0e51('0x31')][_0x0e51('0x36')](_0x0e51('0x37'))){_0x8dd1c0['limit']=qs[_0x0e51('0x21')](_0x14ba45[_0x0e51('0x31')][_0x0e51('0x21')]);_0x8dd1c0[_0x0e51('0x1e')]=qs[_0x0e51('0x1e')](_0x14ba45[_0x0e51('0x31')]['offset']);}_0x8dd1c0[_0x0e51('0x38')]=qs[_0x0e51('0x39')](_0x14ba45[_0x0e51('0x31')]['sort']);_0x8dd1c0['where']=qs[_0x0e51('0x3a')](_[_0x0e51('0x3b')](_0x14ba45[_0x0e51('0x31')],_0x1b1f68[_0x0e51('0x3a')]),_0x21f526);if(_0x14ba45[_0x0e51('0x31')][_0x0e51('0x3c')]){_0x8dd1c0[_0x0e51('0x3d')]=_[_0x0e51('0x3e')](_0x8dd1c0[_0x0e51('0x3d')],{'$or':_[_0x0e51('0x3f')](_0x21f526,function(_0x14e3b5){if(_0x14e3b5[_0x0e51('0x2e')]!==_0x0e51('0x40')){var _0x2bf7e3={};_0x2bf7e3[_0x14e3b5[_0x0e51('0x2a')]]={'$like':'%'+_0x14ba45['query'][_0x0e51('0x3c')]+'%'};return _0x2bf7e3;}})});}_0x8dd1c0=_[_0x0e51('0x3e')]({},_0x8dd1c0,_0x14ba45[_0x0e51('0x41')]);var _0xe97d0={'where':_0x8dd1c0[_0x0e51('0x3d')]};return db[_0x0e51('0x42')]['count'](_0xe97d0)[_0x0e51('0x26')](function(_0x5b4795){_0x3be5c5[_0x0e51('0x20')]=_0x5b4795;if(_0x14ba45[_0x0e51('0x31')]['includeAll']){_0x8dd1c0[_0x0e51('0x43')]=[{'all':!![]}];}return db[_0x0e51('0x42')][_0x0e51('0x44')](_0x8dd1c0);})[_0x0e51('0x26')](function(_0x4ec274){_0x3be5c5[_0x0e51('0x45')]=_0x4ec274;return _0x3be5c5;})[_0x0e51('0x26')](respondWithFilteredResult(_0x79e002,_0x8dd1c0))[_0x0e51('0x46')](handleError(_0x79e002,null));};exports['show']=function(_0x1ddbeb,_0x18d434){var _0x333b8b={'raw':!![],'where':{'id':_0x1ddbeb[_0x0e51('0x47')]['id']}},_0x4f5ee0={};_0x4f5ee0[_0x0e51('0x30')]=_['keys'](db['SquareMessage'][_0x0e51('0x2c')]);_0x4f5ee0['query']=_['keys'](_0x1ddbeb['query']);_0x4f5ee0[_0x0e51('0x3a')]=_[_0x0e51('0x32')](_0x4f5ee0[_0x0e51('0x30')],_0x4f5ee0[_0x0e51('0x31')]);_0x333b8b['attributes']=_[_0x0e51('0x32')](_0x4f5ee0[_0x0e51('0x30')],qs[_0x0e51('0x33')](_0x1ddbeb['query'][_0x0e51('0x33')]));_0x333b8b[_0x0e51('0x34')]=_0x333b8b[_0x0e51('0x34')]['length']?_0x333b8b['attributes']:_0x4f5ee0[_0x0e51('0x30')];if(_0x1ddbeb[_0x0e51('0x31')][_0x0e51('0x48')]){_0x333b8b[_0x0e51('0x43')]=[{'all':!![]}];}_0x333b8b=_[_0x0e51('0x3e')]({},_0x333b8b,_0x1ddbeb[_0x0e51('0x41')]);return db[_0x0e51('0x42')][_0x0e51('0x49')](_0x333b8b)['then'](handleEntityNotFound(_0x18d434,null))[_0x0e51('0x26')](respondWithResult(_0x18d434,null))['catch'](handleError(_0x18d434,null));};exports[_0x0e51('0x4a')]=function(_0x4972a6,_0x1170bc){return db[_0x0e51('0x42')][_0x0e51('0x4a')](_0x4972a6[_0x0e51('0x4b')],{})[_0x0e51('0x26')](respondWithResult(_0x1170bc,0xc9))[_0x0e51('0x46')](handleError(_0x1170bc,null));};exports['update']=function(_0x44fd60,_0x20cb46){if(_0x44fd60[_0x0e51('0x4b')]['id']){delete _0x44fd60[_0x0e51('0x4b')]['id'];}return db['SquareMessage'][_0x0e51('0x49')]({'where':{'id':_0x44fd60[_0x0e51('0x47')]['id']}})[_0x0e51('0x26')](handleEntityNotFound(_0x20cb46,null))['then'](saveUpdates(_0x44fd60[_0x0e51('0x4b')],null))[_0x0e51('0x26')](respondWithResult(_0x20cb46,null))[_0x0e51('0x46')](handleError(_0x20cb46,null));};exports[_0x0e51('0x27')]=function(_0x561cc0,_0x36c9ef){return db[_0x0e51('0x42')][_0x0e51('0x49')]({'where':{'id':_0x561cc0['params']['id']}})[_0x0e51('0x26')](handleEntityNotFound(_0x36c9ef,null))[_0x0e51('0x26')](removeEntity(_0x36c9ef,null))[_0x0e51('0x46')](handleError(_0x36c9ef,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 14c76ce..fe1d68b 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 _0x8b95=['square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define'];(function(_0x844968,_0x49ca08){var _0x3cbaff=function(_0x4402cf){while(--_0x4402cf){_0x844968['push'](_0x844968['shift']());}};_0x3cbaff(++_0x49ca08);}(_0x8b95,0x1cf));var _0x58b9=function(_0x5a3acc,_0x57a5cf){_0x5a3acc=_0x5a3acc-0x0;var _0x39b71c=_0x8b95[_0x5a3acc];return _0x39b71c;};'use strict';var _=require(_0x58b9('0x0'));var util=require('util');var logger=require(_0x58b9('0x1'))('api');var moment=require(_0x58b9('0x2'));var BPromise=require(_0x58b9('0x3'));var rp=require(_0x58b9('0x4'));var fs=require('fs');var path=require(_0x58b9('0x5'));var rimraf=require(_0x58b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x58b9('0x7'));module[_0x58b9('0x8')]=function(_0x5ca198,_0x3a50d2){return _0x5ca198[_0x58b9('0x9')]('SquareMessage',attributes,{'tableName':_0x58b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x827c=['square_messages','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage'];(function(_0x105542,_0x344e41){var _0x3942e0=function(_0x565a9d){while(--_0x565a9d){_0x105542['push'](_0x105542['shift']());}};_0x3942e0(++_0x344e41);}(_0x827c,0xa9));var _0xc827=function(_0x25be71,_0x5451f4){_0x25be71=_0x25be71-0x0;var _0x43e806=_0x827c[_0x25be71];return _0x43e806;};'use strict';var _=require(_0xc827('0x0'));var util=require(_0xc827('0x1'));var logger=require(_0xc827('0x2'))(_0xc827('0x3'));var moment=require('moment');var BPromise=require(_0xc827('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc827('0x5'));var rimraf=require(_0xc827('0x6'));var config=require(_0xc827('0x7'));var attributes=require(_0xc827('0x8'));module['exports']=function(_0x5248e9,_0x2f3aa4){return _0x5248e9[_0xc827('0x9')](_0xc827('0xa'),attributes,{'tableName':_0xc827('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index ea698fb..0fbb3c3 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 _0xc75a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','then','util','bluebird','randomstring'];(function(_0x1d291d,_0x17314a){var _0x44cc4e=function(_0x38d29f){while(--_0x38d29f){_0x1d291d['push'](_0x1d291d['shift']());}};_0x44cc4e(++_0x17314a);}(_0xc75a,0x101));var _0xac75=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xc75a[_0x92713a];return _0x1893e1;};'use strict';var _=require('lodash');var util=require(_0xac75('0x0'));var moment=require('moment');var BPromise=require(_0xac75('0x1'));var rs=require(_0xac75('0x2'));var fs=require('fs');var Redis=require(_0xac75('0x3'));var db=require(_0xac75('0x4'))['db'];var utils=require(_0xac75('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac75('0x6'));var jayson=require(_0xac75('0x7'));var client=jayson[_0xac75('0x8')][_0xac75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdaafb0,_0x2891cc,_0xeaab87){return new BPromise(function(_0x1edadd,_0x2c5385){return client[_0xac75('0xa')](_0xdaafb0,_0xeaab87)['then'](function(_0xc2711c){logger[_0xac75('0xb')](_0xac75('0xc'),_0x2891cc,_0xac75('0xd'));logger[_0xac75('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2891cc,_0xac75('0xd'),JSON[_0xac75('0xf')](_0xc2711c));if(_0xc2711c['error']){if(_0xc2711c[_0xac75('0x10')]['code']===0x1f4){logger[_0xac75('0x10')](_0xac75('0xc'),_0x2891cc,_0xc2711c[_0xac75('0x10')][_0xac75('0x11')]);return _0x2c5385(_0xc2711c[_0xac75('0x10')]['message']);}logger['error'](_0xac75('0xc'),_0x2891cc,_0xc2711c[_0xac75('0x10')][_0xac75('0x11')]);return _0x1edadd(_0xc2711c[_0xac75('0x10')][_0xac75('0x11')]);}else{logger[_0xac75('0xb')]('SquareMessage,\x20%s,\x20%s',_0x2891cc,'request\x20sent');_0x1edadd(_0xc2711c[_0xac75('0x12')][_0xac75('0x11')]);}})['catch'](function(_0x24d43d){logger[_0xac75('0x10')](_0xac75('0xc'),_0x2891cc,_0x24d43d);_0x2c5385(_0x24d43d);});});}exports[_0xac75('0x13')]=function(_0x32b070){var _0x3552b5=this;return new Promise(function(_0x5a4f67,_0x47e037){return db[_0xac75('0x14')][_0xac75('0x15')](_0x32b070[_0xac75('0x16')],{'raw':_0x32b070[_0xac75('0x17')]?_0x32b070[_0xac75('0x17')][_0xac75('0x18')]===undefined?!![]:![]:!![]})[_0xac75('0x19')](function(_0x358565){logger[_0xac75('0xb')](_0xac75('0x13'),_0x32b070);logger['debug'](_0xac75('0x13'),_0x32b070,JSON['stringify'](_0x358565));_0x5a4f67(_0x358565);})['catch'](function(_0x171c02){logger[_0xac75('0x10')](_0xac75('0x13'),_0x171c02[_0xac75('0x11')],_0x32b070);_0x47e037(_0x3552b5[_0xac75('0x10')](0x1f4,_0x171c02[_0xac75('0x11')]));});});}; \ No newline at end of file +var _0x1499=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','catch','CreateSquareMessage','SquareMessage','create'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x1499,0x12c));var _0x9149=function(_0x1b43e8,_0x310d45){_0x1b43e8=_0x1b43e8-0x0;var _0x511b48=_0x1499[_0x1b43e8];return _0x511b48;};'use strict';var _=require(_0x9149('0x0'));var util=require(_0x9149('0x1'));var moment=require(_0x9149('0x2'));var BPromise=require(_0x9149('0x3'));var rs=require(_0x9149('0x4'));var fs=require('fs');var Redis=require(_0x9149('0x5'));var db=require(_0x9149('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9149('0x7'))('rpc');var config=require(_0x9149('0x8'));var jayson=require(_0x9149('0x9'));var client=jayson['client'][_0x9149('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d4833,_0xd5ac7f,_0x48878e){return new BPromise(function(_0x4935ac,_0xc97fb4){return client['request'](_0x2d4833,_0x48878e)[_0x9149('0xb')](function(_0x20a219){logger['info']('SquareMessage,\x20%s,\x20%s',_0xd5ac7f,_0x9149('0xc'));logger[_0x9149('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0xd5ac7f,_0x9149('0xc'),JSON['stringify'](_0x20a219));if(_0x20a219['error']){if(_0x20a219[_0x9149('0xe')][_0x9149('0xf')]===0x1f4){logger[_0x9149('0xe')](_0x9149('0x10'),_0xd5ac7f,_0x20a219['error'][_0x9149('0x11')]);return _0xc97fb4(_0x20a219['error'][_0x9149('0x11')]);}logger[_0x9149('0xe')]('SquareMessage,\x20%s,\x20%s',_0xd5ac7f,_0x20a219[_0x9149('0xe')]['message']);return _0x4935ac(_0x20a219[_0x9149('0xe')][_0x9149('0x11')]);}else{logger[_0x9149('0x12')](_0x9149('0x10'),_0xd5ac7f,'request\x20sent');_0x4935ac(_0x20a219[_0x9149('0x13')]['message']);}})[_0x9149('0x14')](function(_0x2f8238){logger[_0x9149('0xe')](_0x9149('0x10'),_0xd5ac7f,_0x2f8238);_0xc97fb4(_0x2f8238);});});}exports[_0x9149('0x15')]=function(_0x410f78){var _0x532879=this;return new Promise(function(_0x331e22,_0x38999f){return db[_0x9149('0x16')][_0x9149('0x17')](_0x410f78['body'],{'raw':_0x410f78[_0x9149('0x18')]?_0x410f78[_0x9149('0x18')][_0x9149('0x19')]===undefined?!![]:![]:!![]})[_0x9149('0xb')](function(_0x1d6479){logger[_0x9149('0x12')](_0x9149('0x15'),_0x410f78);logger[_0x9149('0xd')](_0x9149('0x15'),_0x410f78,JSON[_0x9149('0x1a')](_0x1d6479));_0x331e22(_0x1d6479);})[_0x9149('0x14')](function(_0x41fc46){logger[_0x9149('0xe')](_0x9149('0x15'),_0x41fc46['message'],_0x410f78);_0x38999f(_0x532879['error'](0x1f4,_0x41fc46[_0x9149('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a097a4b..88b2111 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 _0x8639=['delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','show','/:id/test','15s','test','post','create','put','update'];(function(_0x21ea4e,_0x4ecbff){var _0x49f43d=function(_0x56740d){while(--_0x56740d){_0x21ea4e['push'](_0x21ea4e['shift']());}};_0x49f43d(++_0x4ecbff);}(_0x8639,0xc8));var _0x9863=function(_0x2cf887,_0x3ff497){_0x2cf887=_0x2cf887-0x0;var _0x197ecc=_0x8639[_0x2cf887];return _0x197ecc;};'use strict';var multer=require('multer');var util=require(_0x9863('0x0'));var path=require(_0x9863('0x1'));var timeout=require(_0x9863('0x2'));var express=require(_0x9863('0x3'));var router=express['Router']();var fs_extra=require(_0x9863('0x4'));var auth=require(_0x9863('0x5'));var interaction=require(_0x9863('0x6'));var config=require(_0x9863('0x7'));var controller=require(_0x9863('0x8'));router['get']('/',auth[_0x9863('0x9')](),controller['index']);router[_0x9863('0xa')](_0x9863('0xb'),auth[_0x9863('0x9')](),controller[_0x9863('0xc')]);router[_0x9863('0xa')](_0x9863('0xd'),auth['isAuthenticated'](),timeout(_0x9863('0xe')),controller[_0x9863('0xf')]);router[_0x9863('0x10')]('/',auth[_0x9863('0x9')](),controller[_0x9863('0x11')]);router[_0x9863('0x12')](_0x9863('0xb'),auth[_0x9863('0x9')](),controller[_0x9863('0x13')]);router[_0x9863('0x14')](_0x9863('0xb'),auth[_0x9863('0x9')](),controller[_0x9863('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd52a=['create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','post'];(function(_0x388679,_0x502313){var _0x3392fa=function(_0x39dfda){while(--_0x39dfda){_0x388679['push'](_0x388679['shift']());}};_0x3392fa(++_0x502313);}(_0xd52a,0x1e8));var _0xad52=function(_0x4d419c,_0x1efb11){_0x4d419c=_0x4d419c-0x0;var _0x5d538a=_0xd52a[_0x4d419c];return _0x5d538a;};'use strict';var multer=require(_0xad52('0x0'));var util=require(_0xad52('0x1'));var path=require(_0xad52('0x2'));var timeout=require(_0xad52('0x3'));var express=require(_0xad52('0x4'));var router=express[_0xad52('0x5')]();var fs_extra=require(_0xad52('0x6'));var auth=require(_0xad52('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xad52('0x8'));var controller=require(_0xad52('0x9'));router[_0xad52('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xad52('0xa')](_0xad52('0xb'),auth[_0xad52('0xc')](),controller[_0xad52('0xd')]);router[_0xad52('0xa')](_0xad52('0xe'),auth['isAuthenticated'](),timeout(_0xad52('0xf')),controller[_0xad52('0x10')]);router[_0xad52('0x11')]('/',auth[_0xad52('0xc')](),controller[_0xad52('0x12')]);router[_0xad52('0x13')](_0xad52('0xb'),auth[_0xad52('0xc')](),controller['update']);router[_0xad52('0x14')](_0xad52('0xb'),auth[_0xad52('0xc')](),controller['destroy']);module[_0xad52('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f9e77eb..de620d9 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 _0x4f8d=['name','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4f8d,0x1c5));var _0xd4f8=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x4f8d[_0x5951e8];return _0x20a1f5;};'use strict';var Sequelize=require(_0xd4f8('0x0'));module[_0xd4f8('0x1')]={'name':{'type':Sequelize[_0xd4f8('0x2')],'unique':_0xd4f8('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd4f8('0x2')]}}; \ No newline at end of file +var _0x8b77=['STRING','name','sequelize'];(function(_0x3cfa5c,_0x53d28a){var _0x207006=function(_0x1cce0e){while(--_0x1cce0e){_0x3cfa5c['push'](_0x3cfa5c['shift']());}};_0x207006(++_0x53d28a);}(_0x8b77,0x13a));var _0x78b7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8b77[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x78b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x78b7('0x1')],'unique':_0x78b7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x78b7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 494ae4f..2a354f9 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 _0x857f=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','openSync','closeSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','ODBC','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','create','UserProfileSection','find','autoAssociation','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x857f,0x160));var _0xf857=function(_0x20d7b2,_0x1cd564){_0x20d7b2=_0x20d7b2-0x0;var _0x483991=_0x857f[_0x20d7b2];return _0x483991;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf857('0x0'));var zipdir=require(_0xf857('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf857('0x2'));var moment=require(_0xf857('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf857('0x4'));var util=require(_0xf857('0x5'));var path=require(_0xf857('0x6'));var sox=require(_0xf857('0x7'));var csv=require(_0xf857('0x8'));var ejs=require(_0xf857('0x9'));var fs=require('fs');var fs_extra=require(_0xf857('0xa'));var _=require('lodash');var squel=require(_0xf857('0xb'));var crypto=require(_0xf857('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf857('0xd'));var toCsv=require(_0xf857('0x8'));var querystring=require(_0xf857('0xe'));var Papa=require(_0xf857('0xf'));var Redis=require(_0xf857('0x10'));var authService=require(_0xf857('0x11'));var qs=require(_0xf857('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf857('0x13'));var logger=require(_0xf857('0x14'))(_0xf857('0x15'));var utils=require(_0xf857('0x16'));var config=require(_0xf857('0x17'));var licenseUtil=require(_0xf857('0x18'));var db=require(_0xf857('0x19'))['db'];function respondWithStatusCode(_0xffe11e,_0x46ad07){_0x46ad07=_0x46ad07||0xcc;return function(_0xa07695){if(_0xa07695){return _0xffe11e[_0xf857('0x1a')](_0x46ad07);}return _0xffe11e['status'](_0x46ad07)[_0xf857('0x1b')]();};}function respondWithResult(_0x25faf1,_0x15e62f){_0x15e62f=_0x15e62f||0xc8;return function(_0x31123b){if(_0x31123b){return _0x25faf1[_0xf857('0x1c')](_0x15e62f)[_0xf857('0x1d')](_0x31123b);}};}function respondWithFilteredResult(_0x19f42e,_0x6f9ff3){return function(_0x7e3517){if(_0x7e3517){var _0xef84c5=typeof _0x6f9ff3[_0xf857('0x1e')]===_0xf857('0x1f')&&typeof _0x6f9ff3[_0xf857('0x20')]===_0xf857('0x1f');var _0x4061c7=_0x7e3517['count'];var _0x28a49a=_0xef84c5?0x0:_0x6f9ff3['offset'];var _0x20baaa=_0xef84c5?_0x7e3517[_0xf857('0x21')]:_0x6f9ff3[_0xf857('0x1e')]+_0x6f9ff3[_0xf857('0x20')];var _0x5cea09;if(_0x20baaa>=_0x4061c7){_0x20baaa=_0x4061c7;_0x5cea09=0xc8;}else{_0x5cea09=0xce;}_0x19f42e['status'](_0x5cea09);return _0x19f42e[_0xf857('0x22')]('Content-Range',_0x28a49a+'-'+_0x20baaa+'/'+_0x4061c7)[_0xf857('0x1d')](_0x7e3517);}return null;};}function patchUpdates(_0x352fe4){return function(_0x4efba7){try{jsonpatch[_0xf857('0x23')](_0x4efba7,_0x352fe4,!![]);}catch(_0x4a6dcd){return BPromise[_0xf857('0x24')](_0x4a6dcd);}return _0x4efba7[_0xf857('0x25')]();};}function saveUpdates(_0x38a46a,_0xf09354){return function(_0x190fe8){if(_0x190fe8){return _0x190fe8['update'](_0x38a46a)[_0xf857('0x26')](function(_0x257dde){return _0x257dde;});}return null;};}function removeEntity(_0x539466,_0x24e32c){return function(_0x48e214){if(_0x48e214){return _0x48e214[_0xf857('0x27')]()[_0xf857('0x26')](function(){var _0x206f80=_0x48e214[_0xf857('0x28')]({'plain':!![]});var _0x331028=_0xf857('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x331028,'resourceId':_0x206f80['id']}})[_0xf857('0x26')](function(){return _0x48e214;});})[_0xf857('0x26')](function(){_0x539466['status'](0xcc)[_0xf857('0x1b')]();});}};}function handleEntityNotFound(_0x269131,_0x1c7548){return function(_0x5656f3){if(!_0x5656f3){_0x269131['sendStatus'](0x194);}return _0x5656f3;};}function handleError(_0x5ad367,_0x959418){_0x959418=_0x959418||0x1f4;return function(_0x4339cd){logger[_0xf857('0x2a')](_0x4339cd[_0xf857('0x2b')]);if(_0x4339cd[_0xf857('0x2c')]){delete _0x4339cd['name'];}_0x5ad367['status'](_0x959418)[_0xf857('0x2d')](_0x4339cd);};}exports['index']=function(_0x397854,_0x40e30c){var _0x16164d={},_0x13c8a6={},_0x3419e4={'count':0x0,'rows':[]};var _0x1834b9=_['map'](db[_0xf857('0x2e')][_0xf857('0x2f')],function(_0x1bc56f){return{'name':_0x1bc56f[_0xf857('0x30')],'type':_0x1bc56f[_0xf857('0x31')]['key']};});_0x13c8a6[_0xf857('0x32')]=_[_0xf857('0x33')](_0x1834b9,_0xf857('0x2c'));_0x13c8a6[_0xf857('0x34')]=_['keys'](_0x397854[_0xf857('0x34')]);_0x13c8a6[_0xf857('0x35')]=_[_0xf857('0x36')](_0x13c8a6[_0xf857('0x32')],_0x13c8a6[_0xf857('0x34')]);_0x16164d[_0xf857('0x37')]=_[_0xf857('0x36')](_0x13c8a6['model'],qs['fields'](_0x397854['query'][_0xf857('0x38')]));_0x16164d[_0xf857('0x37')]=_0x16164d['attributes'][_0xf857('0x39')]?_0x16164d['attributes']:_0x13c8a6[_0xf857('0x32')];if(!_0x397854[_0xf857('0x34')][_0xf857('0x3a')]('nolimit')){_0x16164d['limit']=qs[_0xf857('0x20')](_0x397854[_0xf857('0x34')][_0xf857('0x20')]);_0x16164d['offset']=qs[_0xf857('0x1e')](_0x397854[_0xf857('0x34')][_0xf857('0x1e')]);}_0x16164d['order']=qs['sort'](_0x397854[_0xf857('0x34')][_0xf857('0x3b')]);_0x16164d[_0xf857('0x3c')]=qs[_0xf857('0x35')](_[_0xf857('0x3d')](_0x397854[_0xf857('0x34')],_0x13c8a6[_0xf857('0x35')]),_0x1834b9);if(_0x397854['query'][_0xf857('0x3e')]){_0x16164d[_0xf857('0x3c')]=_['merge'](_0x16164d['where'],{'$or':_[_0xf857('0x33')](_0x1834b9,function(_0x5138f5){if(_0x5138f5[_0xf857('0x31')]!==_0xf857('0x3f')){var _0x9a658f={};_0x9a658f[_0x5138f5[_0xf857('0x2c')]]={'$like':'%'+_0x397854['query']['filter']+'%'};return _0x9a658f;}})});}_0x16164d=_[_0xf857('0x40')]({},_0x16164d,_0x397854[_0xf857('0x41')]);var _0x4fe4cf={'where':_0x16164d[_0xf857('0x3c')]};return db['SquareOdbc'][_0xf857('0x21')](_0x4fe4cf)[_0xf857('0x26')](function(_0x563f9e){_0x3419e4[_0xf857('0x21')]=_0x563f9e;if(_0x397854[_0xf857('0x34')][_0xf857('0x42')]){_0x16164d[_0xf857('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf857('0x44')](_0x16164d);})[_0xf857('0x26')](function(_0x341333){_0x3419e4[_0xf857('0x45')]=_0x341333;return _0x3419e4;})['then'](respondWithFilteredResult(_0x40e30c,_0x16164d))['catch'](handleError(_0x40e30c,null));};exports[_0xf857('0x46')]=function(_0x1b6542,_0x432e1b){var _0x4f6e9c={'raw':!![],'where':{'id':_0x1b6542[_0xf857('0x47')]['id']}},_0x374bdd={};_0x374bdd['model']=_[_0xf857('0x48')](db[_0xf857('0x2e')]['rawAttributes']);_0x374bdd[_0xf857('0x34')]=_[_0xf857('0x48')](_0x1b6542[_0xf857('0x34')]);_0x374bdd[_0xf857('0x35')]=_[_0xf857('0x36')](_0x374bdd[_0xf857('0x32')],_0x374bdd[_0xf857('0x34')]);_0x4f6e9c[_0xf857('0x37')]=_[_0xf857('0x36')](_0x374bdd['model'],qs['fields'](_0x1b6542[_0xf857('0x34')]['fields']));_0x4f6e9c[_0xf857('0x37')]=_0x4f6e9c['attributes']['length']?_0x4f6e9c['attributes']:_0x374bdd[_0xf857('0x32')];if(_0x1b6542[_0xf857('0x34')][_0xf857('0x42')]){_0x4f6e9c[_0xf857('0x43')]=[{'all':!![]}];}_0x4f6e9c=_[_0xf857('0x40')]({},_0x4f6e9c,_0x1b6542[_0xf857('0x41')]);return db[_0xf857('0x2e')]['find'](_0x4f6e9c)[_0xf857('0x26')](handleEntityNotFound(_0x432e1b,null))[_0xf857('0x26')](respondWithResult(_0x432e1b,null))['catch'](handleError(_0x432e1b,null));};exports[_0xf857('0x49')]=function(_0x559fe7,_0x5cf5a7){return db[_0xf857('0x2e')][_0xf857('0x49')](_0x559fe7['body'],{})[_0xf857('0x26')](function(_0x192c91){var _0x18998e=_0x559fe7['user'][_0xf857('0x28')]({'plain':!![]});if(!_0x18998e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18998e['role']==='user'){var _0x2bdbc7=_0x192c91[_0xf857('0x28')]({'plain':!![]});var _0x511f1a=_0xf857('0x29');return db[_0xf857('0x4a')][_0xf857('0x4b')]({'where':{'name':_0x511f1a,'userProfileId':_0x18998e['userProfileId']},'raw':!![]})['then'](function(_0x413fa7){if(_0x413fa7&&_0x413fa7[_0xf857('0x4c')]===0x0){return db[_0xf857('0x4d')]['create']({'name':_0x2bdbc7[_0xf857('0x2c')],'resourceId':_0x2bdbc7['id'],'type':_0x413fa7[_0xf857('0x2c')],'sectionId':_0x413fa7['id']},{})[_0xf857('0x26')](function(){return _0x192c91;});}else{return _0x192c91;}})[_0xf857('0x4e')](function(_0x417d71){logger[_0xf857('0x2a')](_0xf857('0x4f'),_0x417d71);throw _0x417d71;});}return _0x192c91;})[_0xf857('0x26')](respondWithResult(_0x5cf5a7,0xc9))[_0xf857('0x4e')](handleError(_0x5cf5a7,null));};exports[_0xf857('0x50')]=function(_0x38ca0b,_0xd19b8){if(_0x38ca0b['body']['id']){delete _0x38ca0b[_0xf857('0x51')]['id'];}return db[_0xf857('0x2e')][_0xf857('0x4b')]({'where':{'id':_0x38ca0b[_0xf857('0x47')]['id']}})[_0xf857('0x26')](handleEntityNotFound(_0xd19b8,null))['then'](saveUpdates(_0x38ca0b[_0xf857('0x51')],null))['then'](respondWithResult(_0xd19b8,null))[_0xf857('0x4e')](handleError(_0xd19b8,null));};exports['destroy']=function(_0x212fac,_0x575e8c){return db[_0xf857('0x2e')]['find']({'where':{'id':_0x212fac['params']['id']}})['then'](handleEntityNotFound(_0x575e8c,null))['then'](removeEntity(_0x575e8c,null))['catch'](handleError(_0x575e8c,null));};exports[_0xf857('0x52')]=function(_0x4e3bd7,_0x4e33f5,_0xed4310){var _0x34c40f;return db[_0xf857('0x2e')][_0xf857('0x4b')]({'where':{'id':_0x4e3bd7['params']['id']},'attributes':['id',_0xf857('0x53')]})[_0xf857('0x26')](handleEntityNotFound(_0x4e33f5,null))[_0xf857('0x26')](function(_0x50b412){if(_0x50b412){var _0x5d690f=require('odbc')();_0x5d690f[_0xf857('0x54')](_0x50b412[_0xf857('0x53')]);_0x5d690f[_0xf857('0x55')]();return _0x50b412;}})['then'](respondWithResult(_0x4e33f5,null))['catch'](handleError(_0x4e33f5,null));}; \ No newline at end of file +var _0x0c15=['model','map','query','keys','filters','intersection','attributes','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','closeSync','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key'];(function(_0x178a9c,_0x562a28){var _0x3fd933=function(_0x37a0e2){while(--_0x37a0e2){_0x178a9c['push'](_0x178a9c['shift']());}};_0x3fd933(++_0x562a28);}(_0x0c15,0x126));var _0x50c1=function(_0x9f53ac,_0x3786bd){_0x9f53ac=_0x9f53ac-0x0;var _0x54d3c0=_0x0c15[_0x9f53ac];return _0x54d3c0;};'use strict';var emlformat=require(_0x50c1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50c1('0x1'));var rp=require(_0x50c1('0x2'));var moment=require(_0x50c1('0x3'));var BPromise=require(_0x50c1('0x4'));var Mustache=require('mustache');var util=require(_0x50c1('0x5'));var path=require(_0x50c1('0x6'));var sox=require(_0x50c1('0x7'));var csv=require(_0x50c1('0x8'));var ejs=require(_0x50c1('0x9'));var fs=require('fs');var fs_extra=require(_0x50c1('0xa'));var _=require(_0x50c1('0xb'));var squel=require('squel');var crypto=require(_0x50c1('0xc'));var jsforce=require(_0x50c1('0xd'));var deskjs=require(_0x50c1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x50c1('0xf'));var Papa=require(_0x50c1('0x10'));var Redis=require('ioredis');var authService=require(_0x50c1('0x11'));var qs=require(_0x50c1('0x12'));var as=require(_0x50c1('0x13'));var hardwareService=require(_0x50c1('0x14'));var logger=require(_0x50c1('0x15'))(_0x50c1('0x16'));var utils=require(_0x50c1('0x17'));var config=require(_0x50c1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529d5c,_0x1f0138){_0x1f0138=_0x1f0138||0xcc;return function(_0x55a14c){if(_0x55a14c){return _0x529d5c[_0x50c1('0x19')](_0x1f0138);}return _0x529d5c[_0x50c1('0x1a')](_0x1f0138)[_0x50c1('0x1b')]();};}function respondWithResult(_0x31a299,_0x43984d){_0x43984d=_0x43984d||0xc8;return function(_0x374891){if(_0x374891){return _0x31a299[_0x50c1('0x1a')](_0x43984d)[_0x50c1('0x1c')](_0x374891);}};}function respondWithFilteredResult(_0x5001a4,_0x50f497){return function(_0x23219f){if(_0x23219f){var _0x500fbd=typeof _0x50f497[_0x50c1('0x1d')]===_0x50c1('0x1e')&&typeof _0x50f497[_0x50c1('0x1f')]==='undefined';var _0x1d74ee=_0x23219f['count'];var _0x2188d8=_0x500fbd?0x0:_0x50f497[_0x50c1('0x1d')];var _0x234997=_0x500fbd?_0x23219f['count']:_0x50f497[_0x50c1('0x1d')]+_0x50f497[_0x50c1('0x1f')];var _0x3b6dfd;if(_0x234997>=_0x1d74ee){_0x234997=_0x1d74ee;_0x3b6dfd=0xc8;}else{_0x3b6dfd=0xce;}_0x5001a4[_0x50c1('0x1a')](_0x3b6dfd);return _0x5001a4[_0x50c1('0x20')](_0x50c1('0x21'),_0x2188d8+'-'+_0x234997+'/'+_0x1d74ee)[_0x50c1('0x1c')](_0x23219f);}return null;};}function patchUpdates(_0x5cb9bf){return function(_0x270ccd){try{jsonpatch[_0x50c1('0x22')](_0x270ccd,_0x5cb9bf,!![]);}catch(_0x1707c8){return BPromise['reject'](_0x1707c8);}return _0x270ccd[_0x50c1('0x23')]();};}function saveUpdates(_0x25d7bc,_0x3bf4dc){return function(_0x5ddd38){if(_0x5ddd38){return _0x5ddd38[_0x50c1('0x24')](_0x25d7bc)[_0x50c1('0x25')](function(_0x5292e4){return _0x5292e4;});}return null;};}function removeEntity(_0x3e020d,_0x8226cd){return function(_0x4b7c5f){if(_0x4b7c5f){return _0x4b7c5f['destroy']()[_0x50c1('0x25')](function(){var _0x5f5db6=_0x4b7c5f[_0x50c1('0x26')]({'plain':!![]});var _0x4415a4='ODBC';return db[_0x50c1('0x27')][_0x50c1('0x28')]({'where':{'type':_0x4415a4,'resourceId':_0x5f5db6['id']}})['then'](function(){return _0x4b7c5f;});})[_0x50c1('0x25')](function(){_0x3e020d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x571a97,_0x77a0fa){return function(_0x5d5281){if(!_0x5d5281){_0x571a97[_0x50c1('0x19')](0x194);}return _0x5d5281;};}function handleError(_0x4ad9f8,_0x462f95){_0x462f95=_0x462f95||0x1f4;return function(_0x27f85b){logger['error'](_0x27f85b[_0x50c1('0x29')]);if(_0x27f85b[_0x50c1('0x2a')]){delete _0x27f85b[_0x50c1('0x2a')];}_0x4ad9f8['status'](_0x462f95)[_0x50c1('0x2b')](_0x27f85b);};}exports[_0x50c1('0x2c')]=function(_0x1f650e,_0x3d1472){var _0x2f201b={},_0x32176d={},_0x3b8993={'count':0x0,'rows':[]};var _0x11cf1d=_['map'](db[_0x50c1('0x2d')][_0x50c1('0x2e')],function(_0x4fdd6c){return{'name':_0x4fdd6c[_0x50c1('0x2f')],'type':_0x4fdd6c[_0x50c1('0x30')][_0x50c1('0x31')]};});_0x32176d[_0x50c1('0x32')]=_[_0x50c1('0x33')](_0x11cf1d,_0x50c1('0x2a'));_0x32176d[_0x50c1('0x34')]=_[_0x50c1('0x35')](_0x1f650e[_0x50c1('0x34')]);_0x32176d[_0x50c1('0x36')]=_[_0x50c1('0x37')](_0x32176d[_0x50c1('0x32')],_0x32176d[_0x50c1('0x34')]);_0x2f201b[_0x50c1('0x38')]=_[_0x50c1('0x37')](_0x32176d['model'],qs['fields'](_0x1f650e[_0x50c1('0x34')]['fields']));_0x2f201b[_0x50c1('0x38')]=_0x2f201b[_0x50c1('0x38')]['length']?_0x2f201b[_0x50c1('0x38')]:_0x32176d[_0x50c1('0x32')];if(!_0x1f650e[_0x50c1('0x34')]['hasOwnProperty'](_0x50c1('0x39'))){_0x2f201b[_0x50c1('0x1f')]=qs['limit'](_0x1f650e[_0x50c1('0x34')]['limit']);_0x2f201b[_0x50c1('0x1d')]=qs['offset'](_0x1f650e[_0x50c1('0x34')]['offset']);}_0x2f201b['order']=qs[_0x50c1('0x3a')](_0x1f650e[_0x50c1('0x34')][_0x50c1('0x3a')]);_0x2f201b['where']=qs[_0x50c1('0x36')](_['pick'](_0x1f650e[_0x50c1('0x34')],_0x32176d[_0x50c1('0x36')]),_0x11cf1d);if(_0x1f650e[_0x50c1('0x34')][_0x50c1('0x3b')]){_0x2f201b[_0x50c1('0x3c')]=_[_0x50c1('0x3d')](_0x2f201b[_0x50c1('0x3c')],{'$or':_[_0x50c1('0x33')](_0x11cf1d,function(_0x30ec71){if(_0x30ec71[_0x50c1('0x30')]!==_0x50c1('0x3e')){var _0x326d64={};_0x326d64[_0x30ec71[_0x50c1('0x2a')]]={'$like':'%'+_0x1f650e[_0x50c1('0x34')]['filter']+'%'};return _0x326d64;}})});}_0x2f201b=_[_0x50c1('0x3d')]({},_0x2f201b,_0x1f650e[_0x50c1('0x3f')]);var _0x528c56={'where':_0x2f201b[_0x50c1('0x3c')]};return db[_0x50c1('0x2d')][_0x50c1('0x40')](_0x528c56)[_0x50c1('0x25')](function(_0x1812ca){_0x3b8993['count']=_0x1812ca;if(_0x1f650e[_0x50c1('0x34')][_0x50c1('0x41')]){_0x2f201b[_0x50c1('0x42')]=[{'all':!![]}];}return db[_0x50c1('0x2d')]['findAll'](_0x2f201b);})[_0x50c1('0x25')](function(_0x29d3f1){_0x3b8993[_0x50c1('0x43')]=_0x29d3f1;return _0x3b8993;})[_0x50c1('0x25')](respondWithFilteredResult(_0x3d1472,_0x2f201b))[_0x50c1('0x44')](handleError(_0x3d1472,null));};exports['show']=function(_0x26ca45,_0x277e4c){var _0x366981={'raw':!![],'where':{'id':_0x26ca45[_0x50c1('0x45')]['id']}},_0x2734b1={};_0x2734b1[_0x50c1('0x32')]=_[_0x50c1('0x35')](db[_0x50c1('0x2d')][_0x50c1('0x2e')]);_0x2734b1[_0x50c1('0x34')]=_[_0x50c1('0x35')](_0x26ca45[_0x50c1('0x34')]);_0x2734b1[_0x50c1('0x36')]=_[_0x50c1('0x37')](_0x2734b1[_0x50c1('0x32')],_0x2734b1[_0x50c1('0x34')]);_0x366981[_0x50c1('0x38')]=_[_0x50c1('0x37')](_0x2734b1[_0x50c1('0x32')],qs[_0x50c1('0x46')](_0x26ca45[_0x50c1('0x34')][_0x50c1('0x46')]));_0x366981[_0x50c1('0x38')]=_0x366981['attributes'][_0x50c1('0x47')]?_0x366981[_0x50c1('0x38')]:_0x2734b1[_0x50c1('0x32')];if(_0x26ca45[_0x50c1('0x34')][_0x50c1('0x41')]){_0x366981[_0x50c1('0x42')]=[{'all':!![]}];}_0x366981=_[_0x50c1('0x3d')]({},_0x366981,_0x26ca45['options']);return db[_0x50c1('0x2d')][_0x50c1('0x48')](_0x366981)['then'](handleEntityNotFound(_0x277e4c,null))[_0x50c1('0x25')](respondWithResult(_0x277e4c,null))[_0x50c1('0x44')](handleError(_0x277e4c,null));};exports[_0x50c1('0x49')]=function(_0x597e94,_0xec34e){return db[_0x50c1('0x2d')][_0x50c1('0x49')](_0x597e94[_0x50c1('0x4a')],{})[_0x50c1('0x25')](function(_0x43007a){var _0xb6d1c1=_0x597e94[_0x50c1('0x4b')][_0x50c1('0x26')]({'plain':!![]});if(!_0xb6d1c1)throw new Error(_0x50c1('0x4c'));if(_0xb6d1c1[_0x50c1('0x4d')]===_0x50c1('0x4b')){var _0x2a1711=_0x43007a[_0x50c1('0x26')]({'plain':!![]});var _0x173ea8=_0x50c1('0x4e');return db[_0x50c1('0x4f')]['find']({'where':{'name':_0x173ea8,'userProfileId':_0xb6d1c1[_0x50c1('0x50')]},'raw':!![]})[_0x50c1('0x25')](function(_0x383e50){if(_0x383e50&&_0x383e50[_0x50c1('0x51')]===0x0){return db['UserProfileResource'][_0x50c1('0x49')]({'name':_0x2a1711[_0x50c1('0x2a')],'resourceId':_0x2a1711['id'],'type':_0x383e50[_0x50c1('0x2a')],'sectionId':_0x383e50['id']},{})[_0x50c1('0x25')](function(){return _0x43007a;});}else{return _0x43007a;}})[_0x50c1('0x44')](function(_0x2b758b){logger['error'](_0x50c1('0x52'),_0x2b758b);throw _0x2b758b;});}return _0x43007a;})[_0x50c1('0x25')](respondWithResult(_0xec34e,0xc9))[_0x50c1('0x44')](handleError(_0xec34e,null));};exports[_0x50c1('0x24')]=function(_0x2b6107,_0x3412d0){if(_0x2b6107[_0x50c1('0x4a')]['id']){delete _0x2b6107[_0x50c1('0x4a')]['id'];}return db[_0x50c1('0x2d')][_0x50c1('0x48')]({'where':{'id':_0x2b6107['params']['id']}})[_0x50c1('0x25')](handleEntityNotFound(_0x3412d0,null))[_0x50c1('0x25')](saveUpdates(_0x2b6107[_0x50c1('0x4a')],null))[_0x50c1('0x25')](respondWithResult(_0x3412d0,null))[_0x50c1('0x44')](handleError(_0x3412d0,null));};exports[_0x50c1('0x28')]=function(_0xe07d93,_0x29d0a2){return db[_0x50c1('0x2d')][_0x50c1('0x48')]({'where':{'id':_0xe07d93['params']['id']}})[_0x50c1('0x25')](handleEntityNotFound(_0x29d0a2,null))[_0x50c1('0x25')](removeEntity(_0x29d0a2,null))[_0x50c1('0x44')](handleError(_0x29d0a2,null));};exports[_0x50c1('0x53')]=function(_0xaa9627,_0x4fc6b1,_0x10b2a6){var _0x2fd9ac;return db[_0x50c1('0x2d')][_0x50c1('0x48')]({'where':{'id':_0xaa9627[_0x50c1('0x45')]['id']},'attributes':['id',_0x50c1('0x54')]})[_0x50c1('0x25')](handleEntityNotFound(_0x4fc6b1,null))[_0x50c1('0x25')](function(_0x2f9556){if(_0x2f9556){var _0x5b9dd0=require('odbc')();_0x5b9dd0['openSync'](_0x2f9556[_0x50c1('0x54')]);_0x5b9dd0[_0x50c1('0x55')]();return _0x2f9556;}})[_0x50c1('0x25')](respondWithResult(_0x4fc6b1,null))['catch'](handleError(_0x4fc6b1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 14c1512..c775855 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 _0x1268=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash','../../config/logger','api','moment'];(function(_0x291a1c,_0x1a80e8){var _0x2ab97b=function(_0x1dce45){while(--_0x1dce45){_0x291a1c['push'](_0x291a1c['shift']());}};_0x2ab97b(++_0x1a80e8);}(_0x1268,0x151));var _0x8126=function(_0x4d0ac6,_0x239202){_0x4d0ac6=_0x4d0ac6-0x0;var _0x49dd4b=_0x1268[_0x4d0ac6];return _0x49dd4b;};'use strict';var _=require(_0x8126('0x0'));var util=require('util');var logger=require(_0x8126('0x1'))(_0x8126('0x2'));var moment=require(_0x8126('0x3'));var BPromise=require(_0x8126('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8126('0x5'));var rimraf=require(_0x8126('0x6'));var config=require(_0x8126('0x7'));var attributes=require(_0x8126('0x8'));module[_0x8126('0x9')]=function(_0x547b7e,_0x5d3372){return _0x547b7e['define'](_0x8126('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4021=['../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x34e46d,_0x5df86a){var _0x1cc6aa=function(_0x5a22f7){while(--_0x5a22f7){_0x34e46d['push'](_0x34e46d['shift']());}};_0x1cc6aa(++_0x5df86a);}(_0x4021,0xb9));var _0x1402=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x4021[_0xdd2348];return _0x2e0a02;};'use strict';var _=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var logger=require('../../config/logger')(_0x1402('0x2'));var moment=require(_0x1402('0x3'));var BPromise=require(_0x1402('0x4'));var rp=require(_0x1402('0x5'));var fs=require('fs');var path=require(_0x1402('0x6'));var rimraf=require('rimraf');var config=require(_0x1402('0x7'));var attributes=require(_0x1402('0x8'));module['exports']=function(_0x31371d,_0x1a7738){return _0x31371d[_0x1402('0x9')](_0x1402('0xa'),attributes,{'tableName':_0x1402('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9b526a8..febd15c 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 _0xd935=['where','attributes','include','map','model','info','ShowSquareOdbc','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','options','raw'];(function(_0x189776,_0x59e106){var _0x87428c=function(_0x1c0a54){while(--_0x1c0a54){_0x189776['push'](_0x189776['shift']());}};_0x87428c(++_0x59e106);}(_0xd935,0x173));var _0x5d93=function(_0x5c6c8a,_0x16e6a0){_0x5c6c8a=_0x5c6c8a-0x0;var _0x9926e0=_0xd935[_0x5c6c8a];return _0x9926e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5d93('0x0'));var rs=require(_0x5d93('0x1'));var fs=require('fs');var Redis=require(_0x5d93('0x2'));var db=require(_0x5d93('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d93('0x4'))(_0x5d93('0x5'));var config=require(_0x5d93('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5d93('0x7')][_0x5d93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cb263,_0x32d7bc,_0x523292){return new BPromise(function(_0xe3b4a8,_0x4b9ee4){return client['request'](_0x1cb263,_0x523292)[_0x5d93('0x9')](function(_0x335102){logger['info'](_0x5d93('0xa'),_0x32d7bc,_0x5d93('0xb'));logger[_0x5d93('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x32d7bc,'request\x20sent',JSON['stringify'](_0x335102));if(_0x335102['error']){if(_0x335102['error']['code']===0x1f4){logger[_0x5d93('0xd')](_0x5d93('0xa'),_0x32d7bc,_0x335102[_0x5d93('0xd')][_0x5d93('0xe')]);return _0x4b9ee4(_0x335102['error'][_0x5d93('0xe')]);}logger['error'](_0x5d93('0xa'),_0x32d7bc,_0x335102['error']['message']);return _0xe3b4a8(_0x335102[_0x5d93('0xd')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x32d7bc,_0x5d93('0xb'));_0xe3b4a8(_0x335102[_0x5d93('0xf')][_0x5d93('0xe')]);}})[_0x5d93('0x10')](function(_0x487141){logger[_0x5d93('0xd')](_0x5d93('0xa'),_0x32d7bc,_0x487141);_0x4b9ee4(_0x487141);});});}exports['ShowSquareOdbc']=function(_0x1fc441){var _0x25dea8=this;return new Promise(function(_0x178068,_0x2fa89d){return db['SquareOdbc']['find']({'raw':_0x1fc441['options']?_0x1fc441[_0x5d93('0x11')][_0x5d93('0x12')]===undefined?!![]:![]:!![],'where':_0x1fc441[_0x5d93('0x11')]?_0x1fc441[_0x5d93('0x11')][_0x5d93('0x13')]||null:null,'attributes':_0x1fc441[_0x5d93('0x11')]?_0x1fc441[_0x5d93('0x11')][_0x5d93('0x14')]||null:null,'include':_0x1fc441[_0x5d93('0x11')]?_0x1fc441[_0x5d93('0x11')][_0x5d93('0x15')]?_[_0x5d93('0x16')](_0x1fc441[_0x5d93('0x11')][_0x5d93('0x15')],function(_0x3e0ab3){return{'model':db[_0x3e0ab3['model']],'as':_0x3e0ab3['as'],'attributes':_0x3e0ab3[_0x5d93('0x14')],'include':_0x3e0ab3[_0x5d93('0x15')]?_[_0x5d93('0x16')](_0x3e0ab3[_0x5d93('0x15')],function(_0x1587d4){return{'model':db[_0x1587d4[_0x5d93('0x17')]],'as':_0x1587d4['as'],'attributes':_0x1587d4['attributes'],'include':_0x1587d4[_0x5d93('0x15')]?_['map'](_0x1587d4[_0x5d93('0x15')],function(_0x245cce){return{'model':db[_0x245cce['model']],'as':_0x245cce['as'],'attributes':_0x245cce[_0x5d93('0x14')]};}):[]};}):[]};}):[]:[]})[_0x5d93('0x9')](function(_0x38b228){logger[_0x5d93('0x18')]('ShowSquareOdbc',_0x1fc441);logger[_0x5d93('0xc')](_0x5d93('0x19'),_0x1fc441,JSON['stringify'](_0x38b228));_0x178068(_0x38b228);})[_0x5d93('0x10')](function(_0x2cd5d7){logger[_0x5d93('0xd')](_0x5d93('0x19'),_0x2cd5d7['message'],_0x1fc441);_0x2fa89d(_0x25dea8[_0x5d93('0xd')](0x1f4,_0x2cd5d7[_0x5d93('0xe')]));});});}; \ No newline at end of file +var _0x3e33=['SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3e33,0x121));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x33e3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33e3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33e3('0x2'))['db'];var utils=require(_0x33e3('0x3'));var logger=require(_0x33e3('0x4'))('rpc');var config=require(_0x33e3('0x5'));var jayson=require(_0x33e3('0x6'));var client=jayson[_0x33e3('0x7')][_0x33e3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41c446,_0x3fc25c,_0x2d9448){return new BPromise(function(_0x3d521a,_0x4abec3){return client['request'](_0x41c446,_0x2d9448)[_0x33e3('0x9')](function(_0x15407c){logger[_0x33e3('0xa')](_0x33e3('0xb'),_0x3fc25c,'request\x20sent');logger[_0x33e3('0xc')](_0x33e3('0xd'),_0x3fc25c,_0x33e3('0xe'),JSON[_0x33e3('0xf')](_0x15407c));if(_0x15407c['error']){if(_0x15407c[_0x33e3('0x10')][_0x33e3('0x11')]===0x1f4){logger[_0x33e3('0x10')](_0x33e3('0xb'),_0x3fc25c,_0x15407c[_0x33e3('0x10')][_0x33e3('0x12')]);return _0x4abec3(_0x15407c[_0x33e3('0x10')]['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3fc25c,_0x15407c[_0x33e3('0x10')][_0x33e3('0x12')]);return _0x3d521a(_0x15407c[_0x33e3('0x10')][_0x33e3('0x12')]);}else{logger[_0x33e3('0xa')](_0x33e3('0xb'),_0x3fc25c,_0x33e3('0xe'));_0x3d521a(_0x15407c[_0x33e3('0x13')][_0x33e3('0x12')]);}})[_0x33e3('0x14')](function(_0x1fb4fb){logger[_0x33e3('0x10')](_0x33e3('0xb'),_0x3fc25c,_0x1fb4fb);_0x4abec3(_0x1fb4fb);});});}exports[_0x33e3('0x15')]=function(_0x25eb9f){var _0x62b6a3=this;return new Promise(function(_0x2ca7a5,_0x18652c){return db[_0x33e3('0x16')]['find']({'raw':_0x25eb9f[_0x33e3('0x17')]?_0x25eb9f[_0x33e3('0x17')][_0x33e3('0x18')]===undefined?!![]:![]:!![],'where':_0x25eb9f[_0x33e3('0x17')]?_0x25eb9f[_0x33e3('0x17')][_0x33e3('0x19')]||null:null,'attributes':_0x25eb9f[_0x33e3('0x17')]?_0x25eb9f[_0x33e3('0x17')][_0x33e3('0x1a')]||null:null,'include':_0x25eb9f[_0x33e3('0x17')]?_0x25eb9f['options'][_0x33e3('0x1b')]?_[_0x33e3('0x1c')](_0x25eb9f['options'][_0x33e3('0x1b')],function(_0x4ab50f){return{'model':db[_0x4ab50f['model']],'as':_0x4ab50f['as'],'attributes':_0x4ab50f[_0x33e3('0x1a')],'include':_0x4ab50f['include']?_[_0x33e3('0x1c')](_0x4ab50f[_0x33e3('0x1b')],function(_0x2def02){return{'model':db[_0x2def02['model']],'as':_0x2def02['as'],'attributes':_0x2def02[_0x33e3('0x1a')],'include':_0x2def02['include']?_[_0x33e3('0x1c')](_0x2def02[_0x33e3('0x1b')],function(_0x155970){return{'model':db[_0x155970[_0x33e3('0x1d')]],'as':_0x155970['as'],'attributes':_0x155970[_0x33e3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x33e3('0x9')](function(_0x4b0f1d){logger['info'](_0x33e3('0x15'),_0x25eb9f);logger[_0x33e3('0xc')](_0x33e3('0x15'),_0x25eb9f,JSON[_0x33e3('0xf')](_0x4b0f1d));_0x2ca7a5(_0x4b0f1d);})['catch'](function(_0x130cb7){logger['error'](_0x33e3('0x15'),_0x130cb7['message'],_0x25eb9f);_0x18652c(_0x62b6a3[_0x33e3('0x10')](0x1f4,_0x130cb7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 57a46b2..e762e72 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 _0xd376=['util','path','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','post','create','update','destroy','exports'];(function(_0x123cc2,_0x55ff71){var _0x134ba7=function(_0x7ab44){while(--_0x7ab44){_0x123cc2['push'](_0x123cc2['shift']());}};_0x134ba7(++_0x55ff71);}(_0xd376,0xe0));var _0x6d37=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xd376[_0x5bb4e8];return _0x2a86f2;};'use strict';var multer=require('multer');var util=require(_0x6d37('0x0'));var path=require(_0x6d37('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d37('0x2'));var router=express[_0x6d37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6d37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6d37('0x5'));var controller=require(_0x6d37('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6d37('0x7')](_0x6d37('0x8'),auth[_0x6d37('0x9')](),controller[_0x6d37('0xa')]);router[_0x6d37('0xb')]('/',auth[_0x6d37('0x9')](),controller[_0x6d37('0xc')]);router['put'](_0x6d37('0x8'),auth['isAuthenticated'](),controller[_0x6d37('0xd')]);router['delete']('/:id',auth[_0x6d37('0x9')](),controller[_0x6d37('0xe')]);module[_0x6d37('0xf')]=router; \ No newline at end of file +var _0xac13=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3c4c13,_0x4f4776){var _0x91c448=function(_0x2c6334){while(--_0x2c6334){_0x3c4c13['push'](_0x3c4c13['shift']());}};_0x91c448(++_0x4f4776);}(_0xac13,0xd4));var _0x3ac1=function(_0x53c83a,_0x2a441b){_0x53c83a=_0x53c83a-0x0;var _0x390792=_0xac13[_0x53c83a];return _0x390792;};'use strict';var multer=require('multer');var util=require(_0x3ac1('0x0'));var path=require(_0x3ac1('0x1'));var timeout=require(_0x3ac1('0x2'));var express=require(_0x3ac1('0x3'));var router=express[_0x3ac1('0x4')]();var fs_extra=require(_0x3ac1('0x5'));var auth=require(_0x3ac1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3ac1('0x7'));var controller=require('./squareProject.controller');router[_0x3ac1('0x8')]('/',auth[_0x3ac1('0x9')](),controller[_0x3ac1('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ac1('0xb')]);router[_0x3ac1('0xc')]('/',auth[_0x3ac1('0x9')](),controller[_0x3ac1('0xd')]);router[_0x3ac1('0xe')](_0x3ac1('0xf'),auth[_0x3ac1('0x9')](),controller['update']);router[_0x3ac1('0x10')](_0x3ac1('0xf'),auth[_0x3ac1('0x9')](),controller[_0x3ac1('0x11')]);module[_0x3ac1('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ad49911..5da2bde 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 _0x7e70=['name','TEXT','BLOB','getDataValue','preproduction','utf8','production','toString','DATE','exports','STRING'];(function(_0x139f40,_0x3eb0a7){var _0xfc85b0=function(_0x4d69d7){while(--_0x4d69d7){_0x139f40['push'](_0x139f40['shift']());}};_0xfc85b0(++_0x3eb0a7);}(_0x7e70,0x98));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x07e7('0x0')]={'name':{'type':Sequelize[_0x07e7('0x1')],'unique':_0x07e7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x07e7('0x1')]},'notes':{'type':Sequelize[_0x07e7('0x3')]},'preproduction':{'type':Sequelize[_0x07e7('0x4')]('long'),'get':function(){if(this[_0x07e7('0x5')](_0x07e7('0x6'))){return this[_0x07e7('0x5')](_0x07e7('0x6'))['toString'](_0x07e7('0x7'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x07e7('0x5')](_0x07e7('0x8'))){return this['getDataValue']('production')[_0x07e7('0x9')](_0x07e7('0x7'));}}},'savedAt':{'type':Sequelize[_0x07e7('0xa')]},'publishedAt':{'type':Sequelize[_0x07e7('0xa')]}}; \ No newline at end of file +var _0x62fd=['DATE','sequelize','STRING','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x250bf4,_0x227956){var _0x3fe077=function(_0x4658e7){while(--_0x4658e7){_0x250bf4['push'](_0x250bf4['shift']());}};_0x3fe077(++_0x227956);}(_0x62fd,0x14b));var _0xd62f=function(_0x5bea1f,_0x2dadf0){_0x5bea1f=_0x5bea1f-0x0;var _0x47152a=_0x62fd[_0x5bea1f];return _0x47152a;};'use strict';var Sequelize=require(_0xd62f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd62f('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd62f('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xd62f('0x2')](_0xd62f('0x3')),'get':function(){if(this[_0xd62f('0x4')](_0xd62f('0x5'))){return this['getDataValue'](_0xd62f('0x5'))[_0xd62f('0x6')](_0xd62f('0x7'));}}},'production':{'type':Sequelize[_0xd62f('0x2')](_0xd62f('0x3')),'get':function(){if(this[_0xd62f('0x4')](_0xd62f('0x8'))){return this[_0xd62f('0x4')](_0xd62f('0x8'))[_0xd62f('0x6')](_0xd62f('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd62f('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 9aba200..3b2a4a8 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 _0x1fe3=['filter','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','agi','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','SquareProjects','UserProfileResource','destroy','publish','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0xbb4c6f,_0x4cc9d2){var _0x4cc20c=function(_0x27b31f){while(--_0x27b31f){_0xbb4c6f['push'](_0xbb4c6f['shift']());}};_0x4cc20c(++_0x4cc9d2);}(_0x1fe3,0x1d0));var _0x31fe=function(_0x3b9060,_0x5edc5a){_0x3b9060=_0x3b9060-0x0;var _0x59c748=_0x1fe3[_0x3b9060];return _0x59c748;};'use strict';var _=require(_0x31fe('0x0'));var Redis=require(_0x31fe('0x1'));var qs=require(_0x31fe('0x2'));var logger=require(_0x31fe('0x3'))(_0x31fe('0x4'));var config=require(_0x31fe('0x5'));var db=require(_0x31fe('0x6'))['db'];config[_0x31fe('0x7')]=_[_0x31fe('0x8')](config[_0x31fe('0x7')],{'host':_0x31fe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31fe('0x7')]));require(_0x31fe('0xa'))[_0x31fe('0xb')](socket);function respondWithResult(_0x15743a,_0x3d31c1){_0x3d31c1=_0x3d31c1||0xc8;return function(_0x451d5e){if(_0x451d5e){return _0x15743a[_0x31fe('0xc')](_0x3d31c1)[_0x31fe('0xd')](_0x451d5e);}};}function respondWithFilteredResult(_0x13e1ca,_0x5bf25a){return function(_0x5dac68){if(_0x5dac68){var _0x521ac2=typeof _0x5bf25a[_0x31fe('0xe')]===_0x31fe('0xf')&&typeof _0x5bf25a[_0x31fe('0x10')]===_0x31fe('0xf');var _0x5b4da9=_0x5dac68[_0x31fe('0x11')];var _0x3f2739=_0x521ac2?0x0:_0x5bf25a[_0x31fe('0xe')];var _0x29b888=_0x521ac2?_0x5dac68['count']:_0x5bf25a[_0x31fe('0xe')]+_0x5bf25a[_0x31fe('0x10')];var _0x3f7891;if(_0x29b888>=_0x5b4da9){_0x29b888=_0x5b4da9;_0x3f7891=0xc8;}else{_0x3f7891=0xce;}_0x13e1ca[_0x31fe('0xc')](_0x3f7891);return _0x13e1ca[_0x31fe('0x12')](_0x31fe('0x13'),_0x3f2739+'-'+_0x29b888+'/'+_0x5b4da9)[_0x31fe('0xd')](_0x5dac68);}return null;};}function saveUpdates(_0x19f9af){return function(_0x39b405){if(_0x39b405){return _0x39b405['update'](_0x19f9af)['then'](function(_0x440d59){return _0x440d59;});}return null;};}function removeEntity(_0x5d01e){return function(_0x4eeaa1){if(_0x4eeaa1){return _0x4eeaa1['destroy']()[_0x31fe('0x14')](function(){var _0x5117bc=_0x4eeaa1['get']({'plain':!![]});var _0x239b55=_0x31fe('0x15');return db[_0x31fe('0x16')][_0x31fe('0x17')]({'where':{'type':_0x239b55,'resourceId':_0x5117bc['id']}})[_0x31fe('0x14')](function(){return _0x4eeaa1;});})[_0x31fe('0x14')](function(){var _0x3017d2=new Redis(config[_0x31fe('0x7')]);_0x3017d2[_0x31fe('0x18')]('agi',JSON[_0x31fe('0x19')]({'id':_0x4eeaa1['id'],'deleted':!![]}));})['then'](function(){_0x5d01e[_0x31fe('0xc')](0xcc)[_0x31fe('0x1a')]();});}};}function handleEntityNotFound(_0x4aaf3e){return function(_0x38a3ad){if(!_0x38a3ad){_0x4aaf3e[_0x31fe('0x1b')](0x194);}return _0x38a3ad;};}function handleError(_0xce982d,_0x28e11d){_0x28e11d=_0x28e11d||0x1f4;return function(_0x3190a6){logger[_0x31fe('0x1c')](_0x3190a6[_0x31fe('0x1d')]);if(_0x3190a6[_0x31fe('0x1e')]){delete _0x3190a6['name'];}_0xce982d[_0x31fe('0xc')](_0x28e11d)[_0x31fe('0x1f')](_0x3190a6);};}exports[_0x31fe('0x20')]=function(_0x5e8a42,_0x16d0e1){var _0x54d401={},_0x5ca4c7={},_0x4fe1ea={'count':0x0,'rows':[]};var _0x3e9135=_[_0x31fe('0x21')](db[_0x31fe('0x22')][_0x31fe('0x23')],function(_0x2677e4){return{'name':_0x2677e4[_0x31fe('0x24')],'type':_0x2677e4['type'][_0x31fe('0x25')]};});_0x5ca4c7[_0x31fe('0x26')]=_[_0x31fe('0x21')](_0x3e9135,'name');_0x5ca4c7[_0x31fe('0x27')]=_[_0x31fe('0x28')](_0x5e8a42[_0x31fe('0x27')]);_0x5ca4c7[_0x31fe('0x29')]=_['intersection'](_0x5ca4c7['model'],_0x5ca4c7['query']);_0x54d401[_0x31fe('0x2a')]=_[_0x31fe('0x2b')](_0x5ca4c7[_0x31fe('0x26')],qs[_0x31fe('0x2c')](_0x5e8a42[_0x31fe('0x27')][_0x31fe('0x2c')]));_0x54d401[_0x31fe('0x2a')]=_0x54d401[_0x31fe('0x2a')][_0x31fe('0x2d')]?_0x54d401[_0x31fe('0x2a')]:_0x5ca4c7[_0x31fe('0x26')];if(!_0x5e8a42['query'][_0x31fe('0x2e')](_0x31fe('0x2f'))){_0x54d401[_0x31fe('0x10')]=qs[_0x31fe('0x10')](_0x5e8a42['query'][_0x31fe('0x10')]);_0x54d401['offset']=qs['offset'](_0x5e8a42[_0x31fe('0x27')]['offset']);}_0x54d401[_0x31fe('0x30')]=qs[_0x31fe('0x31')](_0x5e8a42['query'][_0x31fe('0x31')]);_0x54d401[_0x31fe('0x32')]=qs[_0x31fe('0x29')](_[_0x31fe('0x33')](_0x5e8a42[_0x31fe('0x27')],_0x5ca4c7[_0x31fe('0x29')]),_0x3e9135);if(_0x5e8a42['query']['filter']){_0x54d401[_0x31fe('0x32')]=_[_0x31fe('0x34')](_0x54d401['where'],{'$or':_[_0x31fe('0x21')](_0x3e9135,function(_0x16ea0c){if(_0x16ea0c['type']!==_0x31fe('0x35')){var _0x5a6a51={};_0x5a6a51[_0x16ea0c[_0x31fe('0x1e')]]={'$like':'%'+_0x5e8a42[_0x31fe('0x27')][_0x31fe('0x36')]+'%'};return _0x5a6a51;}})});}_0x54d401=_[_0x31fe('0x34')]({},_0x54d401,_0x5e8a42[_0x31fe('0x37')]);var _0x3c0d14={'where':_0x54d401[_0x31fe('0x32')]};return db['SquareProject'][_0x31fe('0x11')](_0x3c0d14)[_0x31fe('0x14')](function(_0x3050b6){_0x4fe1ea[_0x31fe('0x11')]=_0x3050b6;if(_0x5e8a42[_0x31fe('0x27')][_0x31fe('0x38')]){_0x54d401['include']=[{'all':!![]}];}return db[_0x31fe('0x22')][_0x31fe('0x39')](_0x54d401);})[_0x31fe('0x14')](function(_0x4d8c4d){_0x4fe1ea[_0x31fe('0x3a')]=_0x4d8c4d;return _0x4fe1ea;})['then'](respondWithFilteredResult(_0x16d0e1,_0x54d401))[_0x31fe('0x3b')](handleError(_0x16d0e1,null));};exports[_0x31fe('0x3c')]=function(_0x3f4f99,_0x4bbda7){var _0x34e78b={'raw':![],'where':{'id':_0x3f4f99['params']['id']}},_0xdf6678={};_0xdf6678[_0x31fe('0x26')]=_['keys'](db['SquareProject'][_0x31fe('0x23')]);_0xdf6678[_0x31fe('0x27')]=_[_0x31fe('0x28')](_0x3f4f99[_0x31fe('0x27')]);_0xdf6678['filters']=_[_0x31fe('0x2b')](_0xdf6678[_0x31fe('0x26')],_0xdf6678[_0x31fe('0x27')]);_0x34e78b[_0x31fe('0x2a')]=_['intersection'](_0xdf6678['model'],qs[_0x31fe('0x2c')](_0x3f4f99['query'][_0x31fe('0x2c')]));_0x34e78b['attributes']=_0x34e78b[_0x31fe('0x2a')][_0x31fe('0x2d')]?_0x34e78b[_0x31fe('0x2a')]:_0xdf6678[_0x31fe('0x26')];if(_0x3f4f99[_0x31fe('0x27')][_0x31fe('0x38')]){_0x34e78b[_0x31fe('0x3d')]=[{'all':!![]}];}_0x34e78b=_[_0x31fe('0x34')]({},_0x34e78b,_0x3f4f99[_0x31fe('0x37')]);return db['SquareProject'][_0x31fe('0x3e')](_0x34e78b)[_0x31fe('0x14')](handleEntityNotFound(_0x4bbda7,null))[_0x31fe('0x14')](respondWithResult(_0x4bbda7,null))[_0x31fe('0x3b')](handleError(_0x4bbda7,null));};exports[_0x31fe('0x3f')]=function(_0x3cf93f,_0x6de29c){return db['SquareProject'][_0x31fe('0x3f')](_0x3cf93f[_0x31fe('0x40')],{})[_0x31fe('0x14')](function(_0x26eb1d){var _0x5bd3c7=_0x3cf93f[_0x31fe('0x41')][_0x31fe('0x42')]({'plain':!![]});if(!_0x5bd3c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bd3c7['role']===_0x31fe('0x41')){var _0x711c18=_0x26eb1d[_0x31fe('0x42')]({'plain':!![]});var _0x371216=_0x31fe('0x15');return db[_0x31fe('0x43')][_0x31fe('0x3e')]({'where':{'name':_0x371216,'userProfileId':_0x5bd3c7[_0x31fe('0x44')]},'raw':!![]})[_0x31fe('0x14')](function(_0x153395){if(_0x153395&&_0x153395[_0x31fe('0x45')]===0x0){return db['UserProfileResource'][_0x31fe('0x3f')]({'name':_0x711c18[_0x31fe('0x1e')],'resourceId':_0x711c18['id'],'type':_0x153395[_0x31fe('0x1e')],'sectionId':_0x153395['id']},{})[_0x31fe('0x14')](function(){return _0x26eb1d;});}else{return _0x26eb1d;}})[_0x31fe('0x3b')](function(_0x30e44f){logger[_0x31fe('0x1c')](_0x31fe('0x46'),_0x30e44f);throw _0x30e44f;});}return _0x26eb1d;})[_0x31fe('0x14')](respondWithResult(_0x6de29c,0xc9))[_0x31fe('0x3b')](handleError(_0x6de29c,null));};exports[_0x31fe('0x47')]=function(_0x379bff,_0x638cb1){if(_0x379bff['body']['id']){delete _0x379bff[_0x31fe('0x40')]['id'];}return db[_0x31fe('0x22')][_0x31fe('0x3e')]({'where':{'id':_0x379bff[_0x31fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x638cb1,null))['then'](saveUpdates(_0x379bff[_0x31fe('0x40')],null))[_0x31fe('0x14')](function(_0x3737bf){if(!_0x3737bf)return;var _0x39a3ed=_0x3737bf[_0x31fe('0x42')]({'plain':!![]});return _0x39a3ed;})[_0x31fe('0x14')](function(_0x93c597){var _0x305114=new Redis(config[_0x31fe('0x7')]);_0x305114[_0x31fe('0x18')](_0x31fe('0x49'),JSON[_0x31fe('0x19')](_['pick'](_0x93c597,['id',_0x31fe('0x1e'),'production'])));return _0x93c597;})[_0x31fe('0x14')](respondWithResult(_0x638cb1,null))[_0x31fe('0x3b')](handleError(_0x638cb1,null));};exports[_0x31fe('0x17')]=function(_0x127352,_0x506b78){return db[_0x31fe('0x22')][_0x31fe('0x3e')]({'where':{'id':_0x127352['params']['id']}})[_0x31fe('0x14')](handleEntityNotFound(_0x506b78,null))['then'](removeEntity(_0x506b78,null))[_0x31fe('0x3b')](handleError(_0x506b78,null));}; \ No newline at end of file +var _0x4504=['filter','merge','options','SquareProject','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','status','offset','undefined','count','limit','set','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x4504,0x118));var _0x4450=function(_0x3f98d2,_0xe27967){_0x3f98d2=_0x3f98d2-0x0;var _0x1b1ccc=_0x4504[_0x3f98d2];return _0x1b1ccc;};'use strict';var _=require(_0x4450('0x0'));var Redis=require(_0x4450('0x1'));var qs=require(_0x4450('0x2'));var logger=require(_0x4450('0x3'))(_0x4450('0x4'));var config=require('../../config/environment');var db=require(_0x4450('0x5'))['db'];config['redis']=_[_0x4450('0x6')](config[_0x4450('0x7')],{'host':_0x4450('0x8'),'port':0x18eb});var socket=require(_0x4450('0x9'))(new Redis(config[_0x4450('0x7')]));require(_0x4450('0xa'))['register'](socket);function respondWithResult(_0x2a8a67,_0xfb9a58){_0xfb9a58=_0xfb9a58||0xc8;return function(_0x24ebd6){if(_0x24ebd6){return _0x2a8a67[_0x4450('0xb')](_0xfb9a58)['json'](_0x24ebd6);}};}function respondWithFilteredResult(_0xa98d31,_0x4f2638){return function(_0x2159df){if(_0x2159df){var _0x3d92ab=typeof _0x4f2638[_0x4450('0xc')]==='undefined'&&typeof _0x4f2638['limit']===_0x4450('0xd');var _0x7316bf=_0x2159df[_0x4450('0xe')];var _0x5afae4=_0x3d92ab?0x0:_0x4f2638[_0x4450('0xc')];var _0x228959=_0x3d92ab?_0x2159df[_0x4450('0xe')]:_0x4f2638[_0x4450('0xc')]+_0x4f2638[_0x4450('0xf')];var _0x474403;if(_0x228959>=_0x7316bf){_0x228959=_0x7316bf;_0x474403=0xc8;}else{_0x474403=0xce;}_0xa98d31[_0x4450('0xb')](_0x474403);return _0xa98d31[_0x4450('0x10')]('Content-Range',_0x5afae4+'-'+_0x228959+'/'+_0x7316bf)['json'](_0x2159df);}return null;};}function saveUpdates(_0x179f0d){return function(_0x5d66f1){if(_0x5d66f1){return _0x5d66f1[_0x4450('0x11')](_0x179f0d)[_0x4450('0x12')](function(_0x5c797f){return _0x5c797f;});}return null;};}function removeEntity(_0x2d2c94){return function(_0x3c853e){if(_0x3c853e){return _0x3c853e[_0x4450('0x13')]()['then'](function(){var _0x349c6d=_0x3c853e[_0x4450('0x14')]({'plain':!![]});var _0x5dc50b=_0x4450('0x15');return db[_0x4450('0x16')][_0x4450('0x13')]({'where':{'type':_0x5dc50b,'resourceId':_0x349c6d['id']}})['then'](function(){return _0x3c853e;});})['then'](function(){var _0x13e826=new Redis(config[_0x4450('0x7')]);_0x13e826[_0x4450('0x17')](_0x4450('0x18'),JSON[_0x4450('0x19')]({'id':_0x3c853e['id'],'deleted':!![]}));})[_0x4450('0x12')](function(){_0x2d2c94[_0x4450('0xb')](0xcc)[_0x4450('0x1a')]();});}};}function handleEntityNotFound(_0x526b8a){return function(_0x3fb361){if(!_0x3fb361){_0x526b8a[_0x4450('0x1b')](0x194);}return _0x3fb361;};}function handleError(_0x40bbf7,_0x2692bb){_0x2692bb=_0x2692bb||0x1f4;return function(_0x17aaba){logger['error'](_0x17aaba[_0x4450('0x1c')]);if(_0x17aaba[_0x4450('0x1d')]){delete _0x17aaba['name'];}_0x40bbf7['status'](_0x2692bb)['send'](_0x17aaba);};}exports[_0x4450('0x1e')]=function(_0x390e1f,_0x294c82){var _0x5f48e9={},_0x41b9f0={},_0x14d80e={'count':0x0,'rows':[]};var _0x627a2d=_['map'](db['SquareProject'][_0x4450('0x1f')],function(_0x148148){return{'name':_0x148148[_0x4450('0x20')],'type':_0x148148[_0x4450('0x21')][_0x4450('0x22')]};});_0x41b9f0['model']=_[_0x4450('0x23')](_0x627a2d,_0x4450('0x1d'));_0x41b9f0[_0x4450('0x24')]=_[_0x4450('0x25')](_0x390e1f[_0x4450('0x24')]);_0x41b9f0[_0x4450('0x26')]=_[_0x4450('0x27')](_0x41b9f0[_0x4450('0x28')],_0x41b9f0[_0x4450('0x24')]);_0x5f48e9[_0x4450('0x29')]=_['intersection'](_0x41b9f0['model'],qs['fields'](_0x390e1f[_0x4450('0x24')][_0x4450('0x2a')]));_0x5f48e9[_0x4450('0x29')]=_0x5f48e9[_0x4450('0x29')][_0x4450('0x2b')]?_0x5f48e9['attributes']:_0x41b9f0[_0x4450('0x28')];if(!_0x390e1f['query'][_0x4450('0x2c')]('nolimit')){_0x5f48e9[_0x4450('0xf')]=qs[_0x4450('0xf')](_0x390e1f[_0x4450('0x24')]['limit']);_0x5f48e9[_0x4450('0xc')]=qs['offset'](_0x390e1f[_0x4450('0x24')][_0x4450('0xc')]);}_0x5f48e9[_0x4450('0x2d')]=qs[_0x4450('0x2e')](_0x390e1f[_0x4450('0x24')]['sort']);_0x5f48e9[_0x4450('0x2f')]=qs[_0x4450('0x26')](_[_0x4450('0x30')](_0x390e1f[_0x4450('0x24')],_0x41b9f0[_0x4450('0x26')]),_0x627a2d);if(_0x390e1f[_0x4450('0x24')]['filter']){_0x5f48e9[_0x4450('0x2f')]=_['merge'](_0x5f48e9[_0x4450('0x2f')],{'$or':_['map'](_0x627a2d,function(_0x406f86){if(_0x406f86[_0x4450('0x21')]!==_0x4450('0x31')){var _0x145181={};_0x145181[_0x406f86[_0x4450('0x1d')]]={'$like':'%'+_0x390e1f[_0x4450('0x24')][_0x4450('0x32')]+'%'};return _0x145181;}})});}_0x5f48e9=_[_0x4450('0x33')]({},_0x5f48e9,_0x390e1f[_0x4450('0x34')]);var _0x838279={'where':_0x5f48e9[_0x4450('0x2f')]};return db[_0x4450('0x35')][_0x4450('0xe')](_0x838279)[_0x4450('0x12')](function(_0x4dd328){_0x14d80e[_0x4450('0xe')]=_0x4dd328;if(_0x390e1f['query'][_0x4450('0x36')]){_0x5f48e9[_0x4450('0x37')]=[{'all':!![]}];}return db['SquareProject'][_0x4450('0x38')](_0x5f48e9);})[_0x4450('0x12')](function(_0x54ca32){_0x14d80e['rows']=_0x54ca32;return _0x14d80e;})['then'](respondWithFilteredResult(_0x294c82,_0x5f48e9))[_0x4450('0x39')](handleError(_0x294c82,null));};exports['show']=function(_0x23c4d4,_0xd9d219){var _0x570e75={'raw':![],'where':{'id':_0x23c4d4[_0x4450('0x3a')]['id']}},_0x4e290b={};_0x4e290b[_0x4450('0x28')]=_['keys'](db[_0x4450('0x35')]['rawAttributes']);_0x4e290b['query']=_[_0x4450('0x25')](_0x23c4d4[_0x4450('0x24')]);_0x4e290b[_0x4450('0x26')]=_[_0x4450('0x27')](_0x4e290b[_0x4450('0x28')],_0x4e290b[_0x4450('0x24')]);_0x570e75[_0x4450('0x29')]=_['intersection'](_0x4e290b[_0x4450('0x28')],qs[_0x4450('0x2a')](_0x23c4d4['query'][_0x4450('0x2a')]));_0x570e75[_0x4450('0x29')]=_0x570e75[_0x4450('0x29')][_0x4450('0x2b')]?_0x570e75[_0x4450('0x29')]:_0x4e290b['model'];if(_0x23c4d4[_0x4450('0x24')][_0x4450('0x36')]){_0x570e75[_0x4450('0x37')]=[{'all':!![]}];}_0x570e75=_[_0x4450('0x33')]({},_0x570e75,_0x23c4d4['options']);return db[_0x4450('0x35')][_0x4450('0x3b')](_0x570e75)[_0x4450('0x12')](handleEntityNotFound(_0xd9d219,null))[_0x4450('0x12')](respondWithResult(_0xd9d219,null))['catch'](handleError(_0xd9d219,null));};exports[_0x4450('0x3c')]=function(_0x48997f,_0x440899){return db['SquareProject']['create'](_0x48997f[_0x4450('0x3d')],{})[_0x4450('0x12')](function(_0x500a31){var _0xbd85cb=_0x48997f[_0x4450('0x3e')][_0x4450('0x14')]({'plain':!![]});if(!_0xbd85cb)throw new Error(_0x4450('0x3f'));if(_0xbd85cb['role']===_0x4450('0x3e')){var _0xb0816f=_0x500a31[_0x4450('0x14')]({'plain':!![]});var _0x1fe21e=_0x4450('0x15');return db['UserProfileSection'][_0x4450('0x3b')]({'where':{'name':_0x1fe21e,'userProfileId':_0xbd85cb[_0x4450('0x40')]},'raw':!![]})[_0x4450('0x12')](function(_0x2c3b12){if(_0x2c3b12&&_0x2c3b12['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xb0816f[_0x4450('0x1d')],'resourceId':_0xb0816f['id'],'type':_0x2c3b12[_0x4450('0x1d')],'sectionId':_0x2c3b12['id']},{})[_0x4450('0x12')](function(){return _0x500a31;});}else{return _0x500a31;}})[_0x4450('0x39')](function(_0x2ca9d9){logger['error'](_0x4450('0x41'),_0x2ca9d9);throw _0x2ca9d9;});}return _0x500a31;})[_0x4450('0x12')](respondWithResult(_0x440899,0xc9))[_0x4450('0x39')](handleError(_0x440899,null));};exports['update']=function(_0x38d252,_0x518d70){if(_0x38d252['body']['id']){delete _0x38d252[_0x4450('0x3d')]['id'];}return db[_0x4450('0x35')][_0x4450('0x3b')]({'where':{'id':_0x38d252[_0x4450('0x3a')]['id']}})[_0x4450('0x12')](handleEntityNotFound(_0x518d70,null))[_0x4450('0x12')](saveUpdates(_0x38d252['body'],null))[_0x4450('0x12')](function(_0x212ce2){if(!_0x212ce2)return;var _0x52d0f8=_0x212ce2[_0x4450('0x14')]({'plain':!![]});return _0x52d0f8;})['then'](function(_0x4ce243){var _0x4c5c0a=new Redis(config[_0x4450('0x7')]);_0x4c5c0a[_0x4450('0x17')](_0x4450('0x18'),JSON[_0x4450('0x19')](_[_0x4450('0x30')](_0x4ce243,['id','name','production'])));return _0x4ce243;})['then'](respondWithResult(_0x518d70,null))[_0x4450('0x39')](handleError(_0x518d70,null));};exports[_0x4450('0x13')]=function(_0x1e6647,_0x43ea1d){return db[_0x4450('0x35')]['find']({'where':{'id':_0x1e6647[_0x4450('0x3a')]['id']}})['then'](handleEntityNotFound(_0x43ea1d,null))[_0x4450('0x12')](removeEntity(_0x43ea1d,null))[_0x4450('0x39')](handleError(_0x43ea1d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 47d5849..6465128 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 _0xb273=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4723a1,_0x27bd38){var _0x444a66=function(_0x26c1b0){while(--_0x26c1b0){_0x4723a1['push'](_0x4723a1['shift']());}};_0x444a66(++_0x27bd38);}(_0xb273,0x1cb));var _0x3b27=function(_0x231a61,_0x4816fa){_0x231a61=_0x231a61-0x0;var _0x39c4aa=_0xb273[_0x231a61];return _0x39c4aa;};'use strict';var EventEmitter=require(_0x3b27('0x0'));var SquareProject=require(_0x3b27('0x1'))['db'][_0x3b27('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3b27('0x3')](0x0);var events={'afterCreate':_0x3b27('0x4'),'afterUpdate':'update','afterDestroy':_0x3b27('0x5')};function emitEvent(_0xf5283c){return function(_0x49d3b2,_0x48b46a,_0x4a0219){SquareProjectEvents[_0x3b27('0x6')](_0xf5283c+':'+_0x49d3b2['id'],_0x49d3b2);SquareProjectEvents[_0x3b27('0x6')](_0xf5283c,_0x49d3b2);_0x4a0219(null);};}for(var e in events){if(events[_0x3b27('0x7')](e)){var event=events[e];SquareProject[_0x3b27('0x8')](e,emitEvent(event));}}module[_0x3b27('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xa262=['save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xa262,0x109));var _0x2a26=function(_0x1ad881,_0x469348){_0x1ad881=_0x1ad881-0x0;var _0x18cd94=_0xa262[_0x1ad881];return _0x18cd94;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x2a26('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a26('0x1'),'afterUpdate':_0x2a26('0x2'),'afterDestroy':_0x2a26('0x3')};function emitEvent(_0x160e4){return function(_0xe0f160,_0xf64ce8,_0x2debc5){SquareProjectEvents[_0x2a26('0x4')](_0x160e4+':'+_0xe0f160['id'],_0xe0f160);SquareProjectEvents[_0x2a26('0x4')](_0x160e4,_0xe0f160);_0x2debc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x2a26('0x5')](e,emitEvent(event));}}module[_0x2a26('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 37c1775..9b49a92 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 _0x783e=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./squareProject.attributes','exports','define','SquareProject','changed','savedAt'];(function(_0x32fa77,_0x53f5f6){var _0x35fdd8=function(_0x406433){while(--_0x406433){_0x32fa77['push'](_0x32fa77['shift']());}};_0x35fdd8(++_0x53f5f6);}(_0x783e,0xe1));var _0xe783=function(_0x31fefb,_0x1f9eec){_0x31fefb=_0x31fefb-0x0;var _0x18403d=_0x783e[_0x31fefb];return _0x18403d;};'use strict';var _=require(_0xe783('0x0'));var util=require(_0xe783('0x1'));var logger=require(_0xe783('0x2'))('api');var moment=require(_0xe783('0x3'));var BPromise=require(_0xe783('0x4'));var rp=require(_0xe783('0x5'));var fs=require('fs');var path=require(_0xe783('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe783('0x7'));module[_0xe783('0x8')]=function(_0x298dd2,_0x543b99){return _0x298dd2[_0xe783('0x9')](_0xe783('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x156a3b,_0x386da8,_0x4c0745){if(_0x156a3b[_0xe783('0xb')]('preproduction')){_0x156a3b[_0xe783('0xc')]=moment()[_0xe783('0xd')](_0xe783('0xe'));}if(_0x156a3b[_0xe783('0xb')](_0xe783('0xf'))){_0x156a3b[_0xe783('0x10')]=moment()[_0xe783('0xd')](_0xe783('0xe'));}_0x4c0745(null,_0x156a3b);}}});}; \ No newline at end of file +var _0x034b=['SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define'];(function(_0x1e909d,_0x4a8f3d){var _0x4762cd=function(_0x30cc4e){while(--_0x30cc4e){_0x1e909d['push'](_0x1e909d['shift']());}};_0x4762cd(++_0x4a8f3d);}(_0x034b,0x171));var _0xb034=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x034b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb034('0x0'));var util=require(_0xb034('0x1'));var logger=require(_0xb034('0x2'))(_0xb034('0x3'));var moment=require(_0xb034('0x4'));var BPromise=require(_0xb034('0x5'));var rp=require(_0xb034('0x6'));var fs=require('fs');var path=require(_0xb034('0x7'));var rimraf=require('rimraf');var config=require(_0xb034('0x8'));var attributes=require(_0xb034('0x9'));module['exports']=function(_0x188b92,_0x4d82b6){return _0x188b92[_0xb034('0xa')](_0xb034('0xb'),attributes,{'tableName':_0xb034('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41f071,_0x33fc64,_0x206399){if(_0x41f071[_0xb034('0xd')](_0xb034('0xe'))){_0x41f071['savedAt']=moment()[_0xb034('0xf')](_0xb034('0x10'));}if(_0x41f071['changed'](_0xb034('0x11'))){_0x41f071[_0xb034('0x12')]=moment()[_0xb034('0xf')](_0xb034('0x10'));}_0x206399(null,_0x41f071);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f3a305b..962cabb 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 _0x0ae5=['ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','include','map','model','then','info','debug','stringify','error','message','ShowSquareProject','find','catch'];(function(_0x533ec3,_0xd62d7d){var _0x28d6d8=function(_0x2ee5db){while(--_0x2ee5db){_0x533ec3['push'](_0x533ec3['shift']());}};_0x28d6d8(++_0xd62d7d);}(_0x0ae5,0x15f));var _0x50ae=function(_0x21dd37,_0x3067ac){_0x21dd37=_0x21dd37-0x0;var _0x306a7c=_0x0ae5[_0x21dd37];return _0x306a7c;};'use strict';var _=require('lodash');var Redis=require(_0x50ae('0x0'));var db=require(_0x50ae('0x1'))['db'];var logger=require(_0x50ae('0x2'))('rpc');var config=require(_0x50ae('0x3'));config[_0x50ae('0x4')]=_[_0x50ae('0x5')](config['redis'],{'host':_0x50ae('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50ae('0x4')]));require(_0x50ae('0x7'))[_0x50ae('0x8')](socket);exports[_0x50ae('0x9')]=function(_0x2584ba){var _0x3ce559=this;return new Promise(function(_0x1ebb49,_0x33c862){return db[_0x50ae('0xa')]['findAll']({'raw':_0x2584ba[_0x50ae('0xb')]?_0x2584ba['options'][_0x50ae('0xc')]===undefined?!![]:![]:!![],'where':_0x2584ba['options']?_0x2584ba[_0x50ae('0xb')][_0x50ae('0xd')]||null:null,'attributes':_0x2584ba[_0x50ae('0xb')]?_0x2584ba[_0x50ae('0xb')][_0x50ae('0xe')]||null:null,'limit':_0x2584ba[_0x50ae('0xb')]?_0x2584ba['options']['limit']||null:null,'include':_0x2584ba[_0x50ae('0xb')]?_0x2584ba[_0x50ae('0xb')][_0x50ae('0xf')]?_[_0x50ae('0x10')](_0x2584ba[_0x50ae('0xb')][_0x50ae('0xf')],function(_0x5a18b7){return{'model':db[_0x5a18b7[_0x50ae('0x11')]],'as':_0x5a18b7['as'],'attributes':_0x5a18b7[_0x50ae('0xe')],'include':_0x5a18b7[_0x50ae('0xf')]?_['map'](_0x5a18b7['include'],function(_0x1988bd){return{'model':db[_0x1988bd[_0x50ae('0x11')]],'as':_0x1988bd['as'],'attributes':_0x1988bd['attributes'],'include':_0x1988bd[_0x50ae('0xf')]?_[_0x50ae('0x10')](_0x1988bd[_0x50ae('0xf')],function(_0x3e64f5){return{'model':db[_0x3e64f5[_0x50ae('0x11')]],'as':_0x3e64f5['as'],'attributes':_0x3e64f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x50ae('0x12')](function(_0x21c707){logger[_0x50ae('0x13')](_0x50ae('0x9'),_0x2584ba);logger[_0x50ae('0x14')]('GetSquareProjects',_0x2584ba,JSON[_0x50ae('0x15')](_0x21c707));_0x1ebb49(_0x21c707);})['catch'](function(_0x19a70f){logger[_0x50ae('0x16')](_0x50ae('0x9'),_0x19a70f[_0x50ae('0x17')],_0x2584ba);_0x33c862(_0x3ce559[_0x50ae('0x16')](0x1f4,_0x19a70f[_0x50ae('0x17')]));});});};exports[_0x50ae('0x18')]=function(_0x4b0759){var _0x2ddfd3=this;return new Promise(function(_0x86bb7f,_0x188e39){return db[_0x50ae('0xa')][_0x50ae('0x19')]({'raw':_0x4b0759[_0x50ae('0xb')]?_0x4b0759['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b0759[_0x50ae('0xb')]?_0x4b0759['options'][_0x50ae('0xd')]||null:null,'attributes':_0x4b0759[_0x50ae('0xb')]?_0x4b0759['options'][_0x50ae('0xe')]||null:null,'include':_0x4b0759[_0x50ae('0xb')]?_0x4b0759['options'][_0x50ae('0xf')]?_['map'](_0x4b0759[_0x50ae('0xb')][_0x50ae('0xf')],function(_0x412a99){return{'model':db[_0x412a99[_0x50ae('0x11')]],'as':_0x412a99['as'],'attributes':_0x412a99[_0x50ae('0xe')],'include':_0x412a99[_0x50ae('0xf')]?_['map'](_0x412a99[_0x50ae('0xf')],function(_0x11f8bc){return{'model':db[_0x11f8bc[_0x50ae('0x11')]],'as':_0x11f8bc['as'],'attributes':_0x11f8bc[_0x50ae('0xe')],'include':_0x11f8bc[_0x50ae('0xf')]?_['map'](_0x11f8bc[_0x50ae('0xf')],function(_0x684656){return{'model':db[_0x684656[_0x50ae('0x11')]],'as':_0x684656['as'],'attributes':_0x684656[_0x50ae('0xe')]};}):[]};}):[]};}):[]:[]})[_0x50ae('0x12')](function(_0x554eac){logger['info'](_0x50ae('0x18'),_0x4b0759);logger[_0x50ae('0x14')](_0x50ae('0x18'),_0x4b0759,JSON['stringify'](_0x554eac));_0x86bb7f(_0x554eac);})[_0x50ae('0x1a')](function(_0x53b27a){logger[_0x50ae('0x16')](_0x50ae('0x18'),_0x53b27a['message'],_0x4b0759);_0x188e39(_0x2ddfd3['error'](0x1f4,_0x53b27a[_0x50ae('0x17')]));});});}; \ No newline at end of file +var _0xc479=['register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','message','ShowSquareProject','find','catch','error','ioredis','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x56ab11,_0x14cba4){var _0x5f3bba=function(_0x35041b){while(--_0x35041b){_0x56ab11['push'](_0x56ab11['shift']());}};_0x5f3bba(++_0x14cba4);}(_0xc479,0xfd));var _0x9c47=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0xc479[_0x17158c];return _0x734f31;};'use strict';var _=require('lodash');var Redis=require(_0x9c47('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x9c47('0x1'))(_0x9c47('0x2'));var config=require(_0x9c47('0x3'));config[_0x9c47('0x4')]=_['defaults'](config[_0x9c47('0x4')],{'host':_0x9c47('0x5'),'port':0x18eb});var socket=require(_0x9c47('0x6'))(new Redis(config[_0x9c47('0x4')]));require(_0x9c47('0x7'))[_0x9c47('0x8')](socket);exports[_0x9c47('0x9')]=function(_0x23e372){var _0x3c6406=this;return new Promise(function(_0x2e9369,_0x5d1d56){return db[_0x9c47('0xa')][_0x9c47('0xb')]({'raw':_0x23e372[_0x9c47('0xc')]?_0x23e372[_0x9c47('0xc')][_0x9c47('0xd')]===undefined?!![]:![]:!![],'where':_0x23e372['options']?_0x23e372[_0x9c47('0xc')][_0x9c47('0xe')]||null:null,'attributes':_0x23e372[_0x9c47('0xc')]?_0x23e372[_0x9c47('0xc')][_0x9c47('0xf')]||null:null,'limit':_0x23e372[_0x9c47('0xc')]?_0x23e372[_0x9c47('0xc')][_0x9c47('0x10')]||null:null,'include':_0x23e372[_0x9c47('0xc')]?_0x23e372[_0x9c47('0xc')][_0x9c47('0x11')]?_[_0x9c47('0x12')](_0x23e372[_0x9c47('0xc')]['include'],function(_0x1fc224){return{'model':db[_0x1fc224[_0x9c47('0x13')]],'as':_0x1fc224['as'],'attributes':_0x1fc224[_0x9c47('0xf')],'include':_0x1fc224[_0x9c47('0x11')]?_[_0x9c47('0x12')](_0x1fc224[_0x9c47('0x11')],function(_0x38cc6c){return{'model':db[_0x38cc6c[_0x9c47('0x13')]],'as':_0x38cc6c['as'],'attributes':_0x38cc6c['attributes'],'include':_0x38cc6c['include']?_['map'](_0x38cc6c['include'],function(_0x44d093){return{'model':db[_0x44d093[_0x9c47('0x13')]],'as':_0x44d093['as'],'attributes':_0x44d093[_0x9c47('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9c47('0x14')](function(_0x5435f5){logger[_0x9c47('0x15')](_0x9c47('0x9'),_0x23e372);logger[_0x9c47('0x16')](_0x9c47('0x9'),_0x23e372,JSON[_0x9c47('0x17')](_0x5435f5));_0x2e9369(_0x5435f5);})['catch'](function(_0xb679c3){logger['error']('GetSquareProjects',_0xb679c3[_0x9c47('0x18')],_0x23e372);_0x5d1d56(_0x3c6406['error'](0x1f4,_0xb679c3[_0x9c47('0x18')]));});});};exports[_0x9c47('0x19')]=function(_0x166e5a){var _0x13e092=this;return new Promise(function(_0x18b110,_0x46bddd){return db[_0x9c47('0xa')][_0x9c47('0x1a')]({'raw':_0x166e5a['options']?_0x166e5a[_0x9c47('0xc')][_0x9c47('0xd')]===undefined?!![]:![]:!![],'where':_0x166e5a['options']?_0x166e5a['options']['where']||null:null,'attributes':_0x166e5a[_0x9c47('0xc')]?_0x166e5a[_0x9c47('0xc')][_0x9c47('0xf')]||null:null,'include':_0x166e5a[_0x9c47('0xc')]?_0x166e5a['options'][_0x9c47('0x11')]?_[_0x9c47('0x12')](_0x166e5a[_0x9c47('0xc')][_0x9c47('0x11')],function(_0x548d21){return{'model':db[_0x548d21[_0x9c47('0x13')]],'as':_0x548d21['as'],'attributes':_0x548d21[_0x9c47('0xf')],'include':_0x548d21[_0x9c47('0x11')]?_['map'](_0x548d21[_0x9c47('0x11')],function(_0x6c2a40){return{'model':db[_0x6c2a40['model']],'as':_0x6c2a40['as'],'attributes':_0x6c2a40['attributes'],'include':_0x6c2a40[_0x9c47('0x11')]?_[_0x9c47('0x12')](_0x6c2a40[_0x9c47('0x11')],function(_0x27c08d){return{'model':db[_0x27c08d[_0x9c47('0x13')]],'as':_0x27c08d['as'],'attributes':_0x27c08d[_0x9c47('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x481048){logger[_0x9c47('0x15')](_0x9c47('0x19'),_0x166e5a);logger[_0x9c47('0x16')](_0x9c47('0x19'),_0x166e5a,JSON[_0x9c47('0x17')](_0x481048));_0x18b110(_0x481048);})[_0x9c47('0x1b')](function(_0xb528b3){logger[_0x9c47('0x1c')](_0x9c47('0x19'),_0xb528b3['message'],_0x166e5a);_0x46bddd(_0x13e092[_0x9c47('0x1c')](0x1f4,_0xb528b3[_0x9c47('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 47d6b6d..8f5d060 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 _0x89dd=['remove','update','removeListener','register','./squareProject.events','save'];(function(_0x5d343c,_0x127456){var _0x2b71f2=function(_0x31bdea){while(--_0x31bdea){_0x5d343c['push'](_0x5d343c['shift']());}};_0x2b71f2(++_0x127456);}(_0x89dd,0xf4));var _0xd89d=function(_0x5052f5,_0x2ea798){_0x5052f5=_0x5052f5-0x0;var _0x35ca66=_0x89dd[_0x5052f5];return _0x35ca66;};'use strict';var SquareProjectEvents=require(_0xd89d('0x0'));var events=[_0xd89d('0x1'),_0xd89d('0x2'),_0xd89d('0x3')];function createListener(_0x1cd614,_0x35ea95){return function(_0x1762b7){_0x35ea95['emit'](_0x1cd614,_0x1762b7);};}function removeListener(_0x2d9cfb,_0xd87a57){return function(){SquareProjectEvents[_0xd89d('0x4')](_0x2d9cfb,_0xd87a57);};}exports[_0xd89d('0x5')]=function(_0x4487c2){for(var _0x57bb1f=0x0,_0x2f93f5=events['length'];_0x57bb1f<_0x2f93f5;_0x57bb1f++){var _0x28e3ce=events[_0x57bb1f];var _0x2f9762=createListener('squareProject:'+_0x28e3ce,_0x4487c2);SquareProjectEvents['on'](_0x28e3ce,_0x2f9762);}}; \ No newline at end of file +var _0xf941=['save','update','emit','removeListener','register','length','squareProject:'];(function(_0x5ce14b,_0x204cab){var _0x29c5fc=function(_0xe0f36a){while(--_0xe0f36a){_0x5ce14b['push'](_0x5ce14b['shift']());}};_0x29c5fc(++_0x204cab);}(_0xf941,0x1b9));var _0x1f94=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf941[_0x2dafbe];return _0x58a45a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x1f94('0x0'),'remove',_0x1f94('0x1')];function createListener(_0x16359b,_0x42ba40){return function(_0x26de92){_0x42ba40[_0x1f94('0x2')](_0x16359b,_0x26de92);};}function removeListener(_0x5e35b8,_0x3f9d30){return function(){SquareProjectEvents[_0x1f94('0x3')](_0x5e35b8,_0x3f9d30);};}exports[_0x1f94('0x4')]=function(_0x3dc4a3){for(var _0x44e3d3=0x0,_0x44e4e5=events[_0x1f94('0x5')];_0x44e3d3<_0x44e4e5;_0x44e3d3++){var _0x55902f=events[_0x44e3d3];var _0x42a76e=createListener(_0x1f94('0x6')+_0x55902f,_0x3dc4a3);SquareProjectEvents['on'](_0x55902f,_0x42a76e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 53938de..d52e356 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x9fdade,_0x5ab8f2){var _0x3a84bd=function(_0x6dbbff){while(--_0x6dbbff){_0x9fdade['push'](_0x9fdade['shift']());}};_0x3a84bd(++_0x5ab8f2);}(_0x1261,0x144));var _0x1126=function(_0x27b0c4,_0xaf6d02){_0x27b0c4=_0x27b0c4-0x0;var _0xcb87b2=_0x1261[_0x27b0c4];return _0xcb87b2;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x3253a5,_0x5bd57a){var _0x5985ec=function(_0x3e9400){while(--_0x3e9400){_0x3253a5['push'](_0x3253a5['shift']());}};_0x5985ec(++_0x5bd57a);}(_0x814b,0x1a2));var _0xb814=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0x814b[_0x18daeb];return _0x425a30;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9994f64..e3ecedc 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 _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x559996,_0x20d22f){var _0x58c759=function(_0x538a4d){while(--_0x538a4d){_0x559996['push'](_0x559996['shift']());}};_0x58c759(++_0x20d22f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2576d3,_0x4fb6ee){_0x2576d3=_0x2576d3-0x0;var _0x18fcff=_0xb4c7[_0x2576d3];return _0x18fcff;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file +var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x23c326,_0x24b601){var _0x41175d=function(_0x80d566){while(--_0x80d566){_0x23c326['push'](_0x23c326['shift']());}};_0x41175d(++_0x24b601);}(_0x5d17,0x114));var _0x75d1=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x5d17[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index fbafee1..24a4944 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 _0x8d88=['save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','body','find','params','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x8d88,0xe9));var _0x88d8=function(_0x304fc0,_0x350911){_0x304fc0=_0x304fc0-0x0;var _0x9c5be4=_0x8d88[_0x304fc0];return _0x9c5be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x88d8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88d8('0x1'));var moment=require(_0x88d8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x88d8('0x3'));var util=require('util');var path=require(_0x88d8('0x4'));var sox=require(_0x88d8('0x5'));var csv=require(_0x88d8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88d8('0x7'));var _=require('lodash');var squel=require(_0x88d8('0x8'));var crypto=require('crypto');var jsforce=require(_0x88d8('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x88d8('0xa'));var Redis=require(_0x88d8('0xb'));var authService=require(_0x88d8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x88d8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88d8('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x88d8('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x88d8('0x10'))['db'];function respondWithStatusCode(_0x59b2bc,_0x4cdf20){_0x4cdf20=_0x4cdf20||0xcc;return function(_0x896bea){if(_0x896bea){return _0x59b2bc[_0x88d8('0x11')](_0x4cdf20);}return _0x59b2bc[_0x88d8('0x12')](_0x4cdf20)[_0x88d8('0x13')]();};}function respondWithResult(_0xeb80b,_0x191c40){_0x191c40=_0x191c40||0xc8;return function(_0x3a5955){if(_0x3a5955){return _0xeb80b[_0x88d8('0x12')](_0x191c40)['json'](_0x3a5955);}};}function respondWithFilteredResult(_0x2b7bb7,_0x275b9d){return function(_0x19c453){if(_0x19c453){var _0x3dcaad=typeof _0x275b9d[_0x88d8('0x14')]===_0x88d8('0x15')&&typeof _0x275b9d[_0x88d8('0x16')]===_0x88d8('0x15');var _0x37299f=_0x19c453[_0x88d8('0x17')];var _0x3a86d9=_0x3dcaad?0x0:_0x275b9d[_0x88d8('0x14')];var _0x13350c=_0x3dcaad?_0x19c453[_0x88d8('0x17')]:_0x275b9d[_0x88d8('0x14')]+_0x275b9d['limit'];var _0x26b0db;if(_0x13350c>=_0x37299f){_0x13350c=_0x37299f;_0x26b0db=0xc8;}else{_0x26b0db=0xce;}_0x2b7bb7[_0x88d8('0x12')](_0x26b0db);return _0x2b7bb7['set'](_0x88d8('0x18'),_0x3a86d9+'-'+_0x13350c+'/'+_0x37299f)[_0x88d8('0x19')](_0x19c453);}return null;};}function patchUpdates(_0x4d33e0){return function(_0x570718){try{jsonpatch[_0x88d8('0x1a')](_0x570718,_0x4d33e0,!![]);}catch(_0x3a8941){return BPromise[_0x88d8('0x1b')](_0x3a8941);}return _0x570718[_0x88d8('0x1c')]();};}function saveUpdates(_0x1e7f2f,_0x50f6f2){return function(_0x178ff9){if(_0x178ff9){return _0x178ff9[_0x88d8('0x1d')](_0x1e7f2f)[_0x88d8('0x1e')](function(_0x7dd57){return _0x7dd57;});}return null;};}function removeEntity(_0x488116,_0x527f17){return function(_0x1389bf){if(_0x1389bf){return _0x1389bf[_0x88d8('0x1f')]()[_0x88d8('0x1e')](function(){_0x488116[_0x88d8('0x12')](0xcc)[_0x88d8('0x13')]();});}};}function handleEntityNotFound(_0xb39254,_0x9a4980){return function(_0x2a41d4){if(!_0x2a41d4){_0xb39254[_0x88d8('0x11')](0x194);}return _0x2a41d4;};}function handleError(_0x505a61,_0x308e19){_0x308e19=_0x308e19||0x1f4;return function(_0x2f9b97){logger[_0x88d8('0x20')](_0x2f9b97['stack']);if(_0x2f9b97[_0x88d8('0x21')]){delete _0x2f9b97[_0x88d8('0x21')];}_0x505a61[_0x88d8('0x12')](_0x308e19)[_0x88d8('0x22')](_0x2f9b97);};}exports[_0x88d8('0x23')]=function(_0x44ddf3,_0x201c7a){var _0x4aca48={},_0x5d63d1={},_0x434e70={'count':0x0,'rows':[]};var _0x3dd5de=_[_0x88d8('0x24')](db['SquareRecording'][_0x88d8('0x25')],function(_0xc43bd8){return{'name':_0xc43bd8[_0x88d8('0x26')],'type':_0xc43bd8[_0x88d8('0x27')][_0x88d8('0x28')]};});_0x5d63d1[_0x88d8('0x29')]=_[_0x88d8('0x24')](_0x3dd5de,_0x88d8('0x21'));_0x5d63d1[_0x88d8('0x2a')]=_[_0x88d8('0x2b')](_0x44ddf3['query']);_0x5d63d1['filters']=_[_0x88d8('0x2c')](_0x5d63d1[_0x88d8('0x29')],_0x5d63d1[_0x88d8('0x2a')]);_0x4aca48[_0x88d8('0x2d')]=_[_0x88d8('0x2c')](_0x5d63d1['model'],qs[_0x88d8('0x2e')](_0x44ddf3['query'][_0x88d8('0x2e')]));_0x4aca48['attributes']=_0x4aca48[_0x88d8('0x2d')][_0x88d8('0x2f')]?_0x4aca48['attributes']:_0x5d63d1['model'];if(!_0x44ddf3['query']['hasOwnProperty'](_0x88d8('0x30'))){_0x4aca48[_0x88d8('0x16')]=qs['limit'](_0x44ddf3[_0x88d8('0x2a')]['limit']);_0x4aca48[_0x88d8('0x14')]=qs[_0x88d8('0x14')](_0x44ddf3[_0x88d8('0x2a')][_0x88d8('0x14')]);}_0x4aca48['order']=qs[_0x88d8('0x31')](_0x44ddf3[_0x88d8('0x2a')]['sort']);_0x4aca48[_0x88d8('0x32')]=qs[_0x88d8('0x33')](_[_0x88d8('0x34')](_0x44ddf3['query'],_0x5d63d1[_0x88d8('0x33')]),_0x3dd5de);if(_0x44ddf3['query'][_0x88d8('0x35')]){_0x4aca48[_0x88d8('0x32')]=_[_0x88d8('0x36')](_0x4aca48[_0x88d8('0x32')],{'$or':_['map'](_0x3dd5de,function(_0x4109df){if(_0x4109df['type']!==_0x88d8('0x37')){var _0x162fce={};_0x162fce[_0x4109df['name']]={'$like':'%'+_0x44ddf3[_0x88d8('0x2a')][_0x88d8('0x35')]+'%'};return _0x162fce;}})});}_0x4aca48=_[_0x88d8('0x36')]({},_0x4aca48,_0x44ddf3[_0x88d8('0x38')]);var _0x14cec5={'where':_0x4aca48[_0x88d8('0x32')]};return db[_0x88d8('0x39')]['count'](_0x14cec5)[_0x88d8('0x1e')](function(_0x3ce7bc){_0x434e70[_0x88d8('0x17')]=_0x3ce7bc;if(_0x44ddf3[_0x88d8('0x2a')][_0x88d8('0x3a')]){_0x4aca48[_0x88d8('0x3b')]=[{'all':!![]}];}return db[_0x88d8('0x39')][_0x88d8('0x3c')](_0x4aca48);})['then'](function(_0x9f290d){_0x434e70[_0x88d8('0x3d')]=_0x9f290d;return _0x434e70;})[_0x88d8('0x1e')](respondWithFilteredResult(_0x201c7a,_0x4aca48))[_0x88d8('0x3e')](handleError(_0x201c7a,null));};exports[_0x88d8('0x3f')]=function(_0x4b5478,_0x31a34b){var _0x2cc154={'raw':!![],'where':{'id':_0x4b5478['params']['id']}},_0x18dccd={};_0x18dccd[_0x88d8('0x29')]=_['keys'](db[_0x88d8('0x39')]['rawAttributes']);_0x18dccd[_0x88d8('0x2a')]=_[_0x88d8('0x2b')](_0x4b5478[_0x88d8('0x2a')]);_0x18dccd[_0x88d8('0x33')]=_['intersection'](_0x18dccd[_0x88d8('0x29')],_0x18dccd[_0x88d8('0x2a')]);_0x2cc154[_0x88d8('0x2d')]=_[_0x88d8('0x2c')](_0x18dccd['model'],qs['fields'](_0x4b5478[_0x88d8('0x2a')][_0x88d8('0x2e')]));_0x2cc154[_0x88d8('0x2d')]=_0x2cc154['attributes'][_0x88d8('0x2f')]?_0x2cc154[_0x88d8('0x2d')]:_0x18dccd['model'];if(_0x4b5478[_0x88d8('0x2a')][_0x88d8('0x3a')]){_0x2cc154[_0x88d8('0x3b')]=[{'all':!![]}];}_0x2cc154=_[_0x88d8('0x36')]({},_0x2cc154,_0x4b5478['options']);return db['SquareRecording']['find'](_0x2cc154)['then'](handleEntityNotFound(_0x31a34b,null))['then'](respondWithResult(_0x31a34b,null))['catch'](handleError(_0x31a34b,null));};exports['create']=function(_0x2093e5,_0x14e5ed){return db[_0x88d8('0x39')]['create'](_0x2093e5[_0x88d8('0x40')],{})[_0x88d8('0x1e')](respondWithResult(_0x14e5ed,0xc9))[_0x88d8('0x3e')](handleError(_0x14e5ed,null));};exports[_0x88d8('0x1d')]=function(_0x32779b,_0xc70763){if(_0x32779b['body']['id']){delete _0x32779b[_0x88d8('0x40')]['id'];}return db[_0x88d8('0x39')][_0x88d8('0x41')]({'where':{'id':_0x32779b[_0x88d8('0x42')]['id']}})['then'](handleEntityNotFound(_0xc70763,null))[_0x88d8('0x1e')](saveUpdates(_0x32779b[_0x88d8('0x40')],null))[_0x88d8('0x1e')](respondWithResult(_0xc70763,null))[_0x88d8('0x3e')](handleError(_0xc70763,null));};exports[_0x88d8('0x43')]=function(_0x43737f,_0x2274f5,_0x3a2fdc){var _0x475562=require(_0x88d8('0x44'));var _0x5ac5d9=![];var _0x14753e={};if(_0x43737f[_0x88d8('0x2a')][_0x88d8('0x27')]&&_0x43737f['query'][_0x88d8('0x27')]===_0x88d8('0x45')){_0x14753e[_0x88d8('0x45')]=_0x43737f['params']['id'];}else{_0x14753e['id']=_0x43737f['params']['id'];}return db[_0x88d8('0x39')]['find']({'where':_0x14753e,'attributes':['id',_0x88d8('0x46'),'filename'],'raw':!![]})[_0x88d8('0x1e')](handleEntityNotFound(_0x2274f5,null))[_0x88d8('0x1e')](function(_0x271100){if(_0x271100){var _0x599989=_0x271100[_0x88d8('0x46')];var _0x2e9f9a=util[_0x88d8('0x47')]('%s.cypher',_0x599989);if(fs[_0x88d8('0x48')](_0x2e9f9a)){_0x5ac5d9=!![];return _0x475562[_0x88d8('0x49')](_0x2e9f9a,_0x599989,config[_0x88d8('0x4a')]['recording'])['then'](function(){return _0x271100;});}return _0x271100;}})[_0x88d8('0x1e')](function(_0x3b0644){if(_0x3b0644){var _0x25caeb=_0x3b0644[_0x88d8('0x46')];if(!fs['existsSync'](_0x25caeb)){throw new db['Sequelize'][(_0x88d8('0x4b'))](_0x88d8('0x4c'));}if(_0x3b0644[_0x88d8('0x4d')]){return _0x2274f5[_0x88d8('0x43')](_0x25caeb,_0x3b0644[_0x88d8('0x4d')]+path['extname'](_0x25caeb),function(){if(_0x5ac5d9){fs[_0x88d8('0x4e')](_0x25caeb);}});}else{return _0x2274f5[_0x88d8('0x43')](_0x25caeb,function(_0x4cbdcf){if(_0x5ac5d9){fs[_0x88d8('0x4e')](_0x25caeb);}});}}})[_0x88d8('0x3e')](function(_0x2f9e58){if(_0x2f9e58['message']===_0x88d8('0x4c')){_0x2274f5[_0x88d8('0x12')](0x194)[_0x88d8('0x22')](_0x88d8('0x4f'));}else{return handleError(_0x2274f5,null);}});};exports['destroy']=function(_0x3cd2a1,_0xc57aba){return db[_0x88d8('0x39')][_0x88d8('0x41')]({'where':{'id':_0x3cd2a1[_0x88d8('0x42')]['id']}})[_0x88d8('0x1e')](function(_0x462a0d){if(_[_0x88d8('0x50')](_0x462a0d)){throw new ReferenceError(_0x88d8('0x51'));}return _0x462a0d;})[_0x88d8('0x1e')](function(_0x141bb9){var _0xc1bc7a=_0x141bb9[_0x88d8('0x46')];logger['info'](_0x88d8('0x52'),_0xc1bc7a);if(!_[_0x88d8('0x50')](_0x141bb9[_0x88d8('0x46')])&&fs[_0x88d8('0x48')](_0xc1bc7a)){logger[_0x88d8('0x53')](_0x88d8('0x54')+_0xc1bc7a+_0x88d8('0x55'));fs[_0x88d8('0x56')](_0xc1bc7a);}_0xc1bc7a=_0xc1bc7a+'.cypher';if(!_[_0x88d8('0x50')](_0x141bb9[_0x88d8('0x46')])&&fs[_0x88d8('0x48')](_0xc1bc7a)){logger[_0x88d8('0x53')](_0x88d8('0x54')+_0xc1bc7a+_0x88d8('0x55'));fs[_0x88d8('0x56')](_0xc1bc7a);}return _0x141bb9;})[_0x88d8('0x1e')](function(_0x486ad2){if(!_0x486ad2)throw new InternalError();return _0x486ad2[_0x88d8('0x1f')]();})['then'](function(){_0xc57aba[_0x88d8('0x12')](0xcc)['end']();})[_0x88d8('0x3e')](handleError(_0xc57aba,null));}; \ No newline at end of file +var _0x1829=['format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','sendStatus','name','send','index','map','SquareRecording','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1829,0x1a7));var _0x9182=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x1829[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x9182('0x0'));var rimraf=require(_0x9182('0x1'));var zipdir=require(_0x9182('0x2'));var jsonpatch=require(_0x9182('0x3'));var rp=require(_0x9182('0x4'));var moment=require(_0x9182('0x5'));var BPromise=require(_0x9182('0x6'));var Mustache=require(_0x9182('0x7'));var util=require('util');var path=require(_0x9182('0x8'));var sox=require(_0x9182('0x9'));var csv=require(_0x9182('0xa'));var ejs=require(_0x9182('0xb'));var fs=require('fs');var fs_extra=require(_0x9182('0xc'));var _=require(_0x9182('0xd'));var squel=require(_0x9182('0xe'));var crypto=require(_0x9182('0xf'));var jsforce=require(_0x9182('0x10'));var deskjs=require(_0x9182('0x11'));var toCsv=require(_0x9182('0xa'));var querystring=require(_0x9182('0x12'));var Papa=require(_0x9182('0x13'));var Redis=require(_0x9182('0x14'));var authService=require(_0x9182('0x15'));var qs=require(_0x9182('0x16'));var as=require(_0x9182('0x17'));var hardwareService=require(_0x9182('0x18'));var logger=require(_0x9182('0x19'))(_0x9182('0x1a'));var utils=require(_0x9182('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x9182('0x1c'));var db=require(_0x9182('0x1d'))['db'];function respondWithStatusCode(_0x4cc54e,_0x2bf7c3){_0x2bf7c3=_0x2bf7c3||0xcc;return function(_0x5db72d){if(_0x5db72d){return _0x4cc54e['sendStatus'](_0x2bf7c3);}return _0x4cc54e[_0x9182('0x1e')](_0x2bf7c3)[_0x9182('0x1f')]();};}function respondWithResult(_0x58ae92,_0x2bb3dc){_0x2bb3dc=_0x2bb3dc||0xc8;return function(_0x4ccc99){if(_0x4ccc99){return _0x58ae92[_0x9182('0x1e')](_0x2bb3dc)[_0x9182('0x20')](_0x4ccc99);}};}function respondWithFilteredResult(_0x1a02d8,_0x475f3e){return function(_0x253667){if(_0x253667){var _0x35d210=typeof _0x475f3e[_0x9182('0x21')]==='undefined'&&typeof _0x475f3e[_0x9182('0x22')]===_0x9182('0x23');var _0x4c8db8=_0x253667['count'];var _0x10e6cc=_0x35d210?0x0:_0x475f3e[_0x9182('0x21')];var _0x1ec617=_0x35d210?_0x253667[_0x9182('0x24')]:_0x475f3e[_0x9182('0x21')]+_0x475f3e[_0x9182('0x22')];var _0xc0445d;if(_0x1ec617>=_0x4c8db8){_0x1ec617=_0x4c8db8;_0xc0445d=0xc8;}else{_0xc0445d=0xce;}_0x1a02d8[_0x9182('0x1e')](_0xc0445d);return _0x1a02d8[_0x9182('0x25')]('Content-Range',_0x10e6cc+'-'+_0x1ec617+'/'+_0x4c8db8)['json'](_0x253667);}return null;};}function patchUpdates(_0x2daefd){return function(_0x52004f){try{jsonpatch[_0x9182('0x26')](_0x52004f,_0x2daefd,!![]);}catch(_0x25068a){return BPromise[_0x9182('0x27')](_0x25068a);}return _0x52004f[_0x9182('0x28')]();};}function saveUpdates(_0x146bc9,_0x979dba){return function(_0x145949){if(_0x145949){return _0x145949[_0x9182('0x29')](_0x146bc9)['then'](function(_0xd05313){return _0xd05313;});}return null;};}function removeEntity(_0x4828a6,_0xe70efc){return function(_0x1f7ce9){if(_0x1f7ce9){return _0x1f7ce9[_0x9182('0x2a')]()[_0x9182('0x2b')](function(){_0x4828a6[_0x9182('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd5037,_0x37fe62){return function(_0x5d9f00){if(!_0x5d9f00){_0xfd5037[_0x9182('0x2c')](0x194);}return _0x5d9f00;};}function handleError(_0x206e34,_0x4fbf8f){_0x4fbf8f=_0x4fbf8f||0x1f4;return function(_0x1e33fe){logger['error'](_0x1e33fe['stack']);if(_0x1e33fe[_0x9182('0x2d')]){delete _0x1e33fe[_0x9182('0x2d')];}_0x206e34[_0x9182('0x1e')](_0x4fbf8f)[_0x9182('0x2e')](_0x1e33fe);};}exports[_0x9182('0x2f')]=function(_0x56607d,_0x3dcbb9){var _0x17b3ea={},_0x55aa8c={},_0x5d8b9e={'count':0x0,'rows':[]};var _0x51457a=_[_0x9182('0x30')](db[_0x9182('0x31')]['rawAttributes'],function(_0x127328){return{'name':_0x127328[_0x9182('0x32')],'type':_0x127328[_0x9182('0x33')]['key']};});_0x55aa8c[_0x9182('0x34')]=_['map'](_0x51457a,_0x9182('0x2d'));_0x55aa8c['query']=_[_0x9182('0x35')](_0x56607d[_0x9182('0x36')]);_0x55aa8c[_0x9182('0x37')]=_[_0x9182('0x38')](_0x55aa8c['model'],_0x55aa8c[_0x9182('0x36')]);_0x17b3ea[_0x9182('0x39')]=_['intersection'](_0x55aa8c[_0x9182('0x34')],qs[_0x9182('0x3a')](_0x56607d[_0x9182('0x36')]['fields']));_0x17b3ea[_0x9182('0x39')]=_0x17b3ea[_0x9182('0x39')][_0x9182('0x3b')]?_0x17b3ea[_0x9182('0x39')]:_0x55aa8c[_0x9182('0x34')];if(!_0x56607d[_0x9182('0x36')][_0x9182('0x3c')](_0x9182('0x3d'))){_0x17b3ea['limit']=qs[_0x9182('0x22')](_0x56607d[_0x9182('0x36')][_0x9182('0x22')]);_0x17b3ea['offset']=qs[_0x9182('0x21')](_0x56607d[_0x9182('0x36')][_0x9182('0x21')]);}_0x17b3ea[_0x9182('0x3e')]=qs[_0x9182('0x3f')](_0x56607d['query'][_0x9182('0x3f')]);_0x17b3ea[_0x9182('0x40')]=qs[_0x9182('0x37')](_['pick'](_0x56607d['query'],_0x55aa8c['filters']),_0x51457a);if(_0x56607d[_0x9182('0x36')][_0x9182('0x41')]){_0x17b3ea['where']=_[_0x9182('0x42')](_0x17b3ea[_0x9182('0x40')],{'$or':_[_0x9182('0x30')](_0x51457a,function(_0x3b6e92){if(_0x3b6e92[_0x9182('0x33')]!==_0x9182('0x43')){var _0x2915fa={};_0x2915fa[_0x3b6e92[_0x9182('0x2d')]]={'$like':'%'+_0x56607d[_0x9182('0x36')][_0x9182('0x41')]+'%'};return _0x2915fa;}})});}_0x17b3ea=_[_0x9182('0x42')]({},_0x17b3ea,_0x56607d[_0x9182('0x44')]);var _0x9157fb={'where':_0x17b3ea[_0x9182('0x40')]};return db[_0x9182('0x31')][_0x9182('0x24')](_0x9157fb)[_0x9182('0x2b')](function(_0xa152ca){_0x5d8b9e[_0x9182('0x24')]=_0xa152ca;if(_0x56607d['query'][_0x9182('0x45')]){_0x17b3ea[_0x9182('0x46')]=[{'all':!![]}];}return db[_0x9182('0x31')][_0x9182('0x47')](_0x17b3ea);})[_0x9182('0x2b')](function(_0x2b9d1e){_0x5d8b9e['rows']=_0x2b9d1e;return _0x5d8b9e;})[_0x9182('0x2b')](respondWithFilteredResult(_0x3dcbb9,_0x17b3ea))['catch'](handleError(_0x3dcbb9,null));};exports[_0x9182('0x48')]=function(_0x4ca32f,_0x294c9b){var _0x19cb6a={'raw':!![],'where':{'id':_0x4ca32f[_0x9182('0x49')]['id']}},_0x40469b={};_0x40469b['model']=_['keys'](db[_0x9182('0x31')]['rawAttributes']);_0x40469b[_0x9182('0x36')]=_[_0x9182('0x35')](_0x4ca32f[_0x9182('0x36')]);_0x40469b[_0x9182('0x37')]=_[_0x9182('0x38')](_0x40469b[_0x9182('0x34')],_0x40469b['query']);_0x19cb6a[_0x9182('0x39')]=_[_0x9182('0x38')](_0x40469b[_0x9182('0x34')],qs['fields'](_0x4ca32f[_0x9182('0x36')][_0x9182('0x3a')]));_0x19cb6a[_0x9182('0x39')]=_0x19cb6a['attributes']['length']?_0x19cb6a[_0x9182('0x39')]:_0x40469b['model'];if(_0x4ca32f[_0x9182('0x36')][_0x9182('0x45')]){_0x19cb6a[_0x9182('0x46')]=[{'all':!![]}];}_0x19cb6a=_[_0x9182('0x42')]({},_0x19cb6a,_0x4ca32f[_0x9182('0x44')]);return db[_0x9182('0x31')][_0x9182('0x4a')](_0x19cb6a)[_0x9182('0x2b')](handleEntityNotFound(_0x294c9b,null))[_0x9182('0x2b')](respondWithResult(_0x294c9b,null))[_0x9182('0x4b')](handleError(_0x294c9b,null));};exports[_0x9182('0x4c')]=function(_0x3740d9,_0x276145){return db[_0x9182('0x31')]['create'](_0x3740d9[_0x9182('0x4d')],{})['then'](respondWithResult(_0x276145,0xc9))['catch'](handleError(_0x276145,null));};exports['update']=function(_0xe99a89,_0x1f00da){if(_0xe99a89[_0x9182('0x4d')]['id']){delete _0xe99a89['body']['id'];}return db[_0x9182('0x31')][_0x9182('0x4a')]({'where':{'id':_0xe99a89[_0x9182('0x49')]['id']}})[_0x9182('0x2b')](handleEntityNotFound(_0x1f00da,null))[_0x9182('0x2b')](saveUpdates(_0xe99a89[_0x9182('0x4d')],null))['then'](respondWithResult(_0x1f00da,null))[_0x9182('0x4b')](handleError(_0x1f00da,null));};exports['download']=function(_0x3f801f,_0x2307f2,_0xc59d15){var _0x25637b=require(_0x9182('0x4e'));var _0x3e8980=![];var _0x1ac41a={};if(_0x3f801f[_0x9182('0x36')][_0x9182('0x33')]&&_0x3f801f[_0x9182('0x36')][_0x9182('0x33')]===_0x9182('0x4f')){_0x1ac41a['uniqueid']=_0x3f801f[_0x9182('0x49')]['id'];}else{_0x1ac41a['id']=_0x3f801f[_0x9182('0x49')]['id'];}return db[_0x9182('0x31')]['find']({'where':_0x1ac41a,'attributes':['id',_0x9182('0x50'),_0x9182('0x51')],'raw':!![]})[_0x9182('0x2b')](handleEntityNotFound(_0x2307f2,null))[_0x9182('0x2b')](function(_0xc0037f){if(_0xc0037f){var _0x5d83d4=_0xc0037f[_0x9182('0x50')];var _0x5e5aa4=util[_0x9182('0x52')](_0x9182('0x53'),_0x5d83d4);if(fs['existsSync'](_0x5e5aa4)){_0x3e8980=!![];return _0x25637b[_0x9182('0x54')](_0x5e5aa4,_0x5d83d4,config['secrets'][_0x9182('0x55')])[_0x9182('0x2b')](function(){return _0xc0037f;});}return _0xc0037f;}})[_0x9182('0x2b')](function(_0x58cd1e){if(_0x58cd1e){var _0x1e63d5=_0x58cd1e[_0x9182('0x50')];if(!fs[_0x9182('0x56')](_0x1e63d5)){throw new db[(_0x9182('0x57'))][(_0x9182('0x58'))]('SquareRecording\x20not\x20found');}if(_0x58cd1e[_0x9182('0x51')]){return _0x2307f2[_0x9182('0x59')](_0x1e63d5,_0x58cd1e[_0x9182('0x51')]+path[_0x9182('0x5a')](_0x1e63d5),function(){if(_0x3e8980){fs[_0x9182('0x5b')](_0x1e63d5);}});}else{return _0x2307f2[_0x9182('0x59')](_0x1e63d5,function(_0x263bda){if(_0x3e8980){fs[_0x9182('0x5b')](_0x1e63d5);}});}}})[_0x9182('0x4b')](function(_0x40f0f3){if(_0x40f0f3[_0x9182('0x5c')]===_0x9182('0x5d')){_0x2307f2[_0x9182('0x1e')](0x194)[_0x9182('0x2e')](_0x9182('0x5e'));}else{return handleError(_0x2307f2,null);}});};exports[_0x9182('0x2a')]=function(_0x296985,_0x8e2a3d){return db[_0x9182('0x31')][_0x9182('0x4a')]({'where':{'id':_0x296985['params']['id']}})[_0x9182('0x2b')](function(_0xae6ed3){if(_[_0x9182('0x5f')](_0xae6ed3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xae6ed3;})[_0x9182('0x2b')](function(_0x1e6260){var _0x14ace1=_0x1e6260[_0x9182('0x50')];logger[_0x9182('0x60')](_0x9182('0x61'),_0x14ace1);if(!_['isNil'](_0x1e6260[_0x9182('0x50')])&&fs[_0x9182('0x56')](_0x14ace1)){logger[_0x9182('0x60')](_0x9182('0x62')+_0x14ace1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x14ace1);}_0x14ace1=_0x14ace1+_0x9182('0x63');if(!_['isNil'](_0x1e6260['savePath'])&&fs[_0x9182('0x56')](_0x14ace1)){logger[_0x9182('0x60')](_0x9182('0x62')+_0x14ace1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9182('0x64')](_0x14ace1);}return _0x1e6260;})[_0x9182('0x2b')](function(_0x2414d7){if(!_0x2414d7)throw new InternalError();return _0x2414d7[_0x9182('0x2a')]();})[_0x9182('0x2b')](function(){_0x8e2a3d['status'](0xcc)[_0x9182('0x1f')]();})['catch'](handleError(_0x8e2a3d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 72866e1..5e34cbd 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 _0xa786=['exports','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x4934d3,_0x2304d7){var _0x43437a=function(_0x49d86a){while(--_0x49d86a){_0x4934d3['push'](_0x4934d3['shift']());}};_0x43437a(++_0x2304d7);}(_0xa786,0x71));var _0x6a78=function(_0x109a1a,_0x3adc7d){_0x109a1a=_0x109a1a-0x0;var _0x20310e=_0xa786[_0x109a1a];return _0x20310e;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var logger=require(_0x6a78('0x2'))('api');var moment=require(_0x6a78('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a78('0x4'));var rimraf=require(_0x6a78('0x5'));var config=require(_0x6a78('0x6'));var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0x112e35,_0x386861){return _0x112e35['define'](_0x6a78('0x9'),attributes,{'tableName':_0x6a78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfc=['exports','define','SquareRecording','square_recordings','util','../../config/logger','api','bluebird','path','../../config/environment','./squareRecording.attributes'];(function(_0x31f7e3,_0x236b6e){var _0x1414e9=function(_0x269558){while(--_0x269558){_0x31f7e3['push'](_0x31f7e3['shift']());}};_0x1414e9(++_0x236b6e);}(_0x6bfc,0x159));var _0xc6bf=function(_0x5d1b4c,_0x18aa4a){_0x5d1b4c=_0x5d1b4c-0x0;var _0x43eadf=_0x6bfc[_0x5d1b4c];return _0x43eadf;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var logger=require(_0xc6bf('0x1'))(_0xc6bf('0x2'));var moment=require('moment');var BPromise=require(_0xc6bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc6bf('0x5'));var attributes=require(_0xc6bf('0x6'));module[_0xc6bf('0x7')]=function(_0x4a999e,_0x27a5d9){return _0x4a999e[_0xc6bf('0x8')](_0xc6bf('0x9'),attributes,{'tableName':_0xc6bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ba51119..ee1d4dc 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 _0x9fc3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','body','options','raw'];(function(_0x2e0d61,_0x5d41f0){var _0x38387b=function(_0x38a1fb){while(--_0x38a1fb){_0x2e0d61['push'](_0x2e0d61['shift']());}};_0x38387b(++_0x5d41f0);}(_0x9fc3,0x1dc));var _0x39fc=function(_0xc22b98,_0x41cd8c){_0xc22b98=_0xc22b98-0x0;var _0x6a8f9d=_0x9fc3[_0xc22b98];return _0x6a8f9d;};'use strict';var _=require(_0x39fc('0x0'));var util=require(_0x39fc('0x1'));var moment=require(_0x39fc('0x2'));var BPromise=require(_0x39fc('0x3'));var rs=require(_0x39fc('0x4'));var fs=require('fs');var Redis=require(_0x39fc('0x5'));var db=require(_0x39fc('0x6'))['db'];var utils=require(_0x39fc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x39fc('0x8'));var jayson=require(_0x39fc('0x9'));var client=jayson[_0x39fc('0xa')][_0x39fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ae63,_0x4ceaf2,_0x140fcc){return new BPromise(function(_0x36ae2f,_0x338cbd){return client[_0x39fc('0xc')](_0x13ae63,_0x140fcc)[_0x39fc('0xd')](function(_0x2ba533){logger['info'](_0x39fc('0xe'),_0x4ceaf2,'request\x20sent');logger[_0x39fc('0xf')](_0x39fc('0x10'),_0x4ceaf2,'request\x20sent',JSON[_0x39fc('0x11')](_0x2ba533));if(_0x2ba533[_0x39fc('0x12')]){if(_0x2ba533[_0x39fc('0x12')]['code']===0x1f4){logger[_0x39fc('0x12')](_0x39fc('0xe'),_0x4ceaf2,_0x2ba533['error'][_0x39fc('0x13')]);return _0x338cbd(_0x2ba533[_0x39fc('0x12')][_0x39fc('0x13')]);}logger['error'](_0x39fc('0xe'),_0x4ceaf2,_0x2ba533[_0x39fc('0x12')][_0x39fc('0x13')]);return _0x36ae2f(_0x2ba533[_0x39fc('0x12')][_0x39fc('0x13')]);}else{logger['info'](_0x39fc('0xe'),_0x4ceaf2,_0x39fc('0x14'));_0x36ae2f(_0x2ba533[_0x39fc('0x15')][_0x39fc('0x13')]);}})[_0x39fc('0x16')](function(_0x806cca){logger['error'](_0x39fc('0xe'),_0x4ceaf2,_0x806cca);_0x338cbd(_0x806cca);});});}exports[_0x39fc('0x17')]=function(_0x71f62b){var _0x4b13ad=this;return new Promise(function(_0x4ba9c6,_0x3a0648){return db[_0x39fc('0x18')]['create'](_0x71f62b[_0x39fc('0x19')],{'raw':_0x71f62b[_0x39fc('0x1a')]?_0x71f62b[_0x39fc('0x1a')][_0x39fc('0x1b')]===undefined?!![]:![]:!![]})[_0x39fc('0xd')](function(_0xde2e52){logger['info'](_0x39fc('0x17'),_0x71f62b);logger[_0x39fc('0xf')]('CreateSquareRecording',_0x71f62b,JSON[_0x39fc('0x11')](_0xde2e52));_0x4ba9c6(_0xde2e52);})['catch'](function(_0x104f3e){logger['error'](_0x39fc('0x17'),_0x104f3e[_0x39fc('0x13')],_0x71f62b);_0x3a0648(_0x4b13ad[_0x39fc('0x12')](0x1f4,_0x104f3e[_0x39fc('0x13')]));});});}; \ No newline at end of file +var _0x011e=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x011e,0x8f));var _0xe011=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x011e[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xe011('0x0'));var util=require(_0xe011('0x1'));var moment=require(_0xe011('0x2'));var BPromise=require('bluebird');var rs=require(_0xe011('0x3'));var fs=require('fs');var Redis=require(_0xe011('0x4'));var db=require(_0xe011('0x5'))['db'];var utils=require(_0xe011('0x6'));var logger=require(_0xe011('0x7'))('rpc');var config=require(_0xe011('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe011('0x9')][_0xe011('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16ea39,_0x3e7f22,_0xf2b5dd){return new BPromise(function(_0x481ae4,_0x15e08f){return client[_0xe011('0xb')](_0x16ea39,_0xf2b5dd)[_0xe011('0xc')](function(_0x2d06e7){logger[_0xe011('0xd')]('SquareRecording,\x20%s,\x20%s',_0x3e7f22,_0xe011('0xe'));logger['debug'](_0xe011('0xf'),_0x3e7f22,_0xe011('0xe'),JSON[_0xe011('0x10')](_0x2d06e7));if(_0x2d06e7['error']){if(_0x2d06e7[_0xe011('0x11')][_0xe011('0x12')]===0x1f4){logger['error'](_0xe011('0x13'),_0x3e7f22,_0x2d06e7[_0xe011('0x11')][_0xe011('0x14')]);return _0x15e08f(_0x2d06e7[_0xe011('0x11')][_0xe011('0x14')]);}logger[_0xe011('0x11')](_0xe011('0x13'),_0x3e7f22,_0x2d06e7[_0xe011('0x11')][_0xe011('0x14')]);return _0x481ae4(_0x2d06e7['error']['message']);}else{logger[_0xe011('0xd')](_0xe011('0x13'),_0x3e7f22,_0xe011('0xe'));_0x481ae4(_0x2d06e7[_0xe011('0x15')][_0xe011('0x14')]);}})[_0xe011('0x16')](function(_0xd25937){logger[_0xe011('0x11')](_0xe011('0x13'),_0x3e7f22,_0xd25937);_0x15e08f(_0xd25937);});});}exports['CreateSquareRecording']=function(_0x5a3f61){var _0x41d78b=this;return new Promise(function(_0x52a205,_0x518bba){return db[_0xe011('0x17')][_0xe011('0x18')](_0x5a3f61[_0xe011('0x19')],{'raw':_0x5a3f61[_0xe011('0x1a')]?_0x5a3f61['options'][_0xe011('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x351cc7){logger[_0xe011('0xd')]('CreateSquareRecording',_0x5a3f61);logger['debug']('CreateSquareRecording',_0x5a3f61,JSON[_0xe011('0x10')](_0x351cc7));_0x52a205(_0x351cc7);})[_0xe011('0x16')](function(_0x19c2ae){logger[_0xe011('0x11')](_0xe011('0x1c'),_0x19c2ae[_0xe011('0x14')],_0x5a3f61);_0x518bba(_0x41d78b[_0xe011('0x11')](0x1f4,_0x19c2ae[_0xe011('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 842310f..8e57d2b 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(_0x5b959e,_0x28debf){var _0x11df5a=function(_0x1bcd63){while(--_0x1bcd63){_0x5b959e['push'](_0x5b959e['shift']());}};_0x11df5a(++_0x28debf);}(_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('./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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2059a4a..c266ae7 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 _0x111b=['STRING','DATE','BOOLEAN','exports'];(function(_0x2636ad,_0x1e1e2c){var _0x45bcda=function(_0x173bcc){while(--_0x173bcc){_0x2636ad['push'](_0x2636ad['shift']());}};_0x45bcda(++_0x1e1e2c);}(_0x111b,0x15f));var _0xb111=function(_0x4f79b8,_0x3f14f5){_0x4f79b8=_0x4f79b8-0x0;var _0x458dfe=_0x111b[_0x4f79b8];return _0x458dfe;};'use strict';var Sequelize=require('sequelize');module[_0xb111('0x0')]={'network':{'type':Sequelize[_0xb111('0x1')]},'network_script':{'type':Sequelize[_0xb111('0x1')]},'request':{'type':Sequelize[_0xb111('0x1')]},'channel':{'type':Sequelize[_0xb111('0x1')]},'language':{'type':Sequelize[_0xb111('0x1')]},'type':{'type':Sequelize[_0xb111('0x1')]},'uniqueid':{'type':Sequelize[_0xb111('0x1')]},'version':{'type':Sequelize[_0xb111('0x1')]},'callerid':{'type':Sequelize[_0xb111('0x1')]},'calleridname':{'type':Sequelize[_0xb111('0x1')]},'callingpres':{'type':Sequelize[_0xb111('0x1')]},'callingani2':{'type':Sequelize[_0xb111('0x1')]},'callington':{'type':Sequelize[_0xb111('0x1')]},'callingtns':{'type':Sequelize[_0xb111('0x1')]},'dnid':{'type':Sequelize[_0xb111('0x1')]},'rdnis':{'type':Sequelize[_0xb111('0x1')]},'context':{'type':Sequelize[_0xb111('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb111('0x1')]},'enhanced':{'type':Sequelize[_0xb111('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb111('0x1')]},'joinAt':{'type':Sequelize[_0xb111('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb111('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b9a=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x1bccda,_0x1009e2){var _0x486285=function(_0x3a9e43){while(--_0x3a9e43){_0x1bccda['push'](_0x1bccda['shift']());}};_0x486285(++_0x1009e2);}(_0x5b9a,0x138));var _0xa5b9=function(_0x6a04b5,_0x17ad77){_0x6a04b5=_0x6a04b5-0x0;var _0xf90b67=_0x5b9a[_0x6a04b5];return _0xf90b67;};'use strict';var Sequelize=require(_0xa5b9('0x0'));module[_0xa5b9('0x1')]={'network':{'type':Sequelize[_0xa5b9('0x2')]},'network_script':{'type':Sequelize[_0xa5b9('0x2')]},'request':{'type':Sequelize[_0xa5b9('0x2')]},'channel':{'type':Sequelize[_0xa5b9('0x2')]},'language':{'type':Sequelize[_0xa5b9('0x2')]},'type':{'type':Sequelize[_0xa5b9('0x2')]},'uniqueid':{'type':Sequelize[_0xa5b9('0x2')]},'version':{'type':Sequelize[_0xa5b9('0x2')]},'callerid':{'type':Sequelize[_0xa5b9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa5b9('0x2')]},'callingani2':{'type':Sequelize[_0xa5b9('0x2')]},'callington':{'type':Sequelize[_0xa5b9('0x2')]},'callingtns':{'type':Sequelize[_0xa5b9('0x2')]},'dnid':{'type':Sequelize[_0xa5b9('0x2')]},'rdnis':{'type':Sequelize[_0xa5b9('0x2')]},'context':{'type':Sequelize[_0xa5b9('0x2')]},'extension':{'type':Sequelize[_0xa5b9('0x2')]},'priority':{'type':Sequelize[_0xa5b9('0x2')]},'enhanced':{'type':Sequelize[_0xa5b9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xa5b9('0x2')]},'project_name':{'type':Sequelize[_0xa5b9('0x2')]},'joinAt':{'type':Sequelize[_0xa5b9('0x3')]},'leaveAt':{'type':Sequelize[_0xa5b9('0x3')]},'bot':{'type':Sequelize[_0xa5b9('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 b543fd4..7447324 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 _0x3d9c=['intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','rows','catch','show','params','length','find','create','body','update','describe','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','send','index','map','SquareReport','rawAttributes','fieldName','key','name','query','keys','filters'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x3d9c,0x170));var _0xc3d9=function(_0x14760d,_0x7741a4){_0x14760d=_0x14760d-0x0;var _0x437635=_0x3d9c[_0x14760d];return _0x437635;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3d9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3d9('0x1'));var moment=require('moment');var BPromise=require(_0xc3d9('0x2'));var Mustache=require('mustache');var util=require(_0xc3d9('0x3'));var path=require(_0xc3d9('0x4'));var sox=require(_0xc3d9('0x5'));var csv=require(_0xc3d9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3d9('0x7'));var _=require('lodash');var squel=require(_0xc3d9('0x8'));var crypto=require(_0xc3d9('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3d9('0x6'));var querystring=require(_0xc3d9('0xa'));var Papa=require(_0xc3d9('0xb'));var Redis=require(_0xc3d9('0xc'));var authService=require(_0xc3d9('0xd'));var qs=require(_0xc3d9('0xe'));var as=require(_0xc3d9('0xf'));var hardwareService=require(_0xc3d9('0x10'));var logger=require(_0xc3d9('0x11'))(_0xc3d9('0x12'));var utils=require('../../config/utils');var config=require(_0xc3d9('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x524623,_0x49227b){_0x49227b=_0x49227b||0xcc;return function(_0x46774f){if(_0x46774f){return _0x524623[_0xc3d9('0x14')](_0x49227b);}return _0x524623[_0xc3d9('0x15')](_0x49227b)[_0xc3d9('0x16')]();};}function respondWithResult(_0x41e693,_0x4bb11d){_0x4bb11d=_0x4bb11d||0xc8;return function(_0x12db51){if(_0x12db51){return _0x41e693[_0xc3d9('0x15')](_0x4bb11d)[_0xc3d9('0x17')](_0x12db51);}};}function respondWithFilteredResult(_0x4ff527,_0x544639){return function(_0xc48490){if(_0xc48490){var _0x4245f5=typeof _0x544639[_0xc3d9('0x18')]===_0xc3d9('0x19')&&typeof _0x544639[_0xc3d9('0x1a')]===_0xc3d9('0x19');var _0x3ea910=_0xc48490[_0xc3d9('0x1b')];var _0x377980=_0x4245f5?0x0:_0x544639['offset'];var _0x512898=_0x4245f5?_0xc48490['count']:_0x544639[_0xc3d9('0x18')]+_0x544639['limit'];var _0x4e5768;if(_0x512898>=_0x3ea910){_0x512898=_0x3ea910;_0x4e5768=0xc8;}else{_0x4e5768=0xce;}_0x4ff527[_0xc3d9('0x15')](_0x4e5768);return _0x4ff527['set'](_0xc3d9('0x1c'),_0x377980+'-'+_0x512898+'/'+_0x3ea910)['json'](_0xc48490);}return null;};}function patchUpdates(_0x24fd54){return function(_0x61df77){try{jsonpatch['apply'](_0x61df77,_0x24fd54,!![]);}catch(_0x4e5994){return BPromise[_0xc3d9('0x1d')](_0x4e5994);}return _0x61df77[_0xc3d9('0x1e')]();};}function saveUpdates(_0x578153,_0x5b4f7f){return function(_0x2c858b){if(_0x2c858b){return _0x2c858b['update'](_0x578153)[_0xc3d9('0x1f')](function(_0x436b2e){return _0x436b2e;});}return null;};}function removeEntity(_0x351c73,_0x308e1b){return function(_0x1ae84d){if(_0x1ae84d){return _0x1ae84d[_0xc3d9('0x20')]()[_0xc3d9('0x1f')](function(){_0x351c73[_0xc3d9('0x15')](0xcc)[_0xc3d9('0x16')]();});}};}function handleEntityNotFound(_0x15cff8,_0x46b284){return function(_0x51b380){if(!_0x51b380){_0x15cff8[_0xc3d9('0x14')](0x194);}return _0x51b380;};}function handleError(_0x3533fb,_0x1c25ff){_0x1c25ff=_0x1c25ff||0x1f4;return function(_0x4fec49){logger[_0xc3d9('0x21')](_0x4fec49[_0xc3d9('0x22')]);if(_0x4fec49['name']){delete _0x4fec49['name'];}_0x3533fb[_0xc3d9('0x15')](_0x1c25ff)[_0xc3d9('0x23')](_0x4fec49);};}exports[_0xc3d9('0x24')]=function(_0x6227ab,_0x5d39e4){var _0x2f7164={},_0x755f3d={},_0x323ce7={'count':0x0,'rows':[]};var _0x103711=_[_0xc3d9('0x25')](db[_0xc3d9('0x26')][_0xc3d9('0x27')],function(_0x630c4c){return{'name':_0x630c4c[_0xc3d9('0x28')],'type':_0x630c4c['type'][_0xc3d9('0x29')]};});_0x755f3d['model']=_[_0xc3d9('0x25')](_0x103711,_0xc3d9('0x2a'));_0x755f3d[_0xc3d9('0x2b')]=_[_0xc3d9('0x2c')](_0x6227ab['query']);_0x755f3d[_0xc3d9('0x2d')]=_[_0xc3d9('0x2e')](_0x755f3d[_0xc3d9('0x2f')],_0x755f3d['query']);_0x2f7164[_0xc3d9('0x30')]=_['intersection'](_0x755f3d[_0xc3d9('0x2f')],qs['fields'](_0x6227ab['query'][_0xc3d9('0x31')]));_0x2f7164['attributes']=_0x2f7164[_0xc3d9('0x30')]['length']?_0x2f7164[_0xc3d9('0x30')]:_0x755f3d[_0xc3d9('0x2f')];if(!_0x6227ab[_0xc3d9('0x2b')][_0xc3d9('0x32')](_0xc3d9('0x33'))){_0x2f7164[_0xc3d9('0x1a')]=qs[_0xc3d9('0x1a')](_0x6227ab['query'][_0xc3d9('0x1a')]);_0x2f7164[_0xc3d9('0x18')]=qs[_0xc3d9('0x18')](_0x6227ab[_0xc3d9('0x2b')]['offset']);}_0x2f7164[_0xc3d9('0x34')]=qs[_0xc3d9('0x35')](_0x6227ab[_0xc3d9('0x2b')][_0xc3d9('0x35')]);_0x2f7164[_0xc3d9('0x36')]=qs['filters'](_['pick'](_0x6227ab['query'],_0x755f3d['filters']),_0x103711);if(_0x6227ab[_0xc3d9('0x2b')][_0xc3d9('0x37')]){_0x2f7164[_0xc3d9('0x36')]=_['merge'](_0x2f7164[_0xc3d9('0x36')],{'$or':_['map'](_0x103711,function(_0x16ffbf){if(_0x16ffbf['type']!==_0xc3d9('0x38')){var _0xd79ebc={};_0xd79ebc[_0x16ffbf[_0xc3d9('0x2a')]]={'$like':'%'+_0x6227ab[_0xc3d9('0x2b')]['filter']+'%'};return _0xd79ebc;}})});}_0x2f7164=_['merge']({},_0x2f7164,_0x6227ab[_0xc3d9('0x39')]);var _0x5b6d09={'where':_0x2f7164[_0xc3d9('0x36')]};return db['SquareReport'][_0xc3d9('0x1b')](_0x5b6d09)[_0xc3d9('0x1f')](function(_0x4c0948){_0x323ce7['count']=_0x4c0948;if(_0x6227ab[_0xc3d9('0x2b')][_0xc3d9('0x3a')]){_0x2f7164['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x2f7164);})[_0xc3d9('0x1f')](function(_0x2a4b9c){_0x323ce7[_0xc3d9('0x3b')]=_0x2a4b9c;return _0x323ce7;})[_0xc3d9('0x1f')](respondWithFilteredResult(_0x5d39e4,_0x2f7164))[_0xc3d9('0x3c')](handleError(_0x5d39e4,null));};exports[_0xc3d9('0x3d')]=function(_0x50bf18,_0x528c70){var _0x6a0485={'raw':!![],'where':{'id':_0x50bf18[_0xc3d9('0x3e')]['id']}},_0x3a30f6={};_0x3a30f6[_0xc3d9('0x2f')]=_['keys'](db[_0xc3d9('0x26')]['rawAttributes']);_0x3a30f6[_0xc3d9('0x2b')]=_[_0xc3d9('0x2c')](_0x50bf18['query']);_0x3a30f6[_0xc3d9('0x2d')]=_[_0xc3d9('0x2e')](_0x3a30f6['model'],_0x3a30f6[_0xc3d9('0x2b')]);_0x6a0485[_0xc3d9('0x30')]=_[_0xc3d9('0x2e')](_0x3a30f6[_0xc3d9('0x2f')],qs[_0xc3d9('0x31')](_0x50bf18[_0xc3d9('0x2b')][_0xc3d9('0x31')]));_0x6a0485[_0xc3d9('0x30')]=_0x6a0485['attributes'][_0xc3d9('0x3f')]?_0x6a0485[_0xc3d9('0x30')]:_0x3a30f6[_0xc3d9('0x2f')];if(_0x50bf18['query'][_0xc3d9('0x3a')]){_0x6a0485['include']=[{'all':!![]}];}_0x6a0485=_['merge']({},_0x6a0485,_0x50bf18[_0xc3d9('0x39')]);return db[_0xc3d9('0x26')][_0xc3d9('0x40')](_0x6a0485)[_0xc3d9('0x1f')](handleEntityNotFound(_0x528c70,null))[_0xc3d9('0x1f')](respondWithResult(_0x528c70,null))[_0xc3d9('0x3c')](handleError(_0x528c70,null));};exports[_0xc3d9('0x41')]=function(_0x1bafb9,_0x1b662e){return db[_0xc3d9('0x26')][_0xc3d9('0x41')](_0x1bafb9[_0xc3d9('0x42')],{})['then'](respondWithResult(_0x1b662e,0xc9))[_0xc3d9('0x3c')](handleError(_0x1b662e,null));};exports[_0xc3d9('0x43')]=function(_0x27d8ab,_0x5ed3a9){if(_0x27d8ab[_0xc3d9('0x42')]['id']){delete _0x27d8ab[_0xc3d9('0x42')]['id'];}return db[_0xc3d9('0x26')][_0xc3d9('0x40')]({'where':{'id':_0x27d8ab[_0xc3d9('0x3e')]['id']}})[_0xc3d9('0x1f')](handleEntityNotFound(_0x5ed3a9,null))[_0xc3d9('0x1f')](saveUpdates(_0x27d8ab[_0xc3d9('0x42')],null))[_0xc3d9('0x1f')](respondWithResult(_0x5ed3a9,null))[_0xc3d9('0x3c')](handleError(_0x5ed3a9,null));};exports[_0xc3d9('0x20')]=function(_0x2ca34d,_0x1d9889){return db[_0xc3d9('0x26')][_0xc3d9('0x40')]({'where':{'id':_0x2ca34d[_0xc3d9('0x3e')]['id']}})[_0xc3d9('0x1f')](handleEntityNotFound(_0x1d9889,null))['then'](removeEntity(_0x1d9889,null))['catch'](handleError(_0x1d9889,null));};exports[_0xc3d9('0x44')]=function(_0x2ff3b4,_0x2d1f3d){return db[_0xc3d9('0x26')][_0xc3d9('0x44')]()[_0xc3d9('0x1f')](respondWithResult(_0x2d1f3d,null))[_0xc3d9('0x3c')](handleError(_0x2d1f3d,null));}; \ No newline at end of file +var _0xc009=['include','rows','catch','show','params','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','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/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','SquareReport','includeAll'];(function(_0x163268,_0x24c75d){var _0x5dda3b=function(_0x196d81){while(--_0x196d81){_0x163268['push'](_0x163268['shift']());}};_0x5dda3b(++_0x24c75d);}(_0xc009,0xe9));var _0x9c00=function(_0x294b7a,_0x51b167){_0x294b7a=_0x294b7a-0x0;var _0x30d2a3=_0xc009[_0x294b7a];return _0x30d2a3;};'use strict';var emlformat=require(_0x9c00('0x0'));var rimraf=require(_0x9c00('0x1'));var zipdir=require(_0x9c00('0x2'));var jsonpatch=require(_0x9c00('0x3'));var rp=require('request-promise');var moment=require(_0x9c00('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c00('0x5'));var util=require(_0x9c00('0x6'));var path=require('path');var sox=require(_0x9c00('0x7'));var csv=require(_0x9c00('0x8'));var ejs=require(_0x9c00('0x9'));var fs=require('fs');var fs_extra=require(_0x9c00('0xa'));var _=require(_0x9c00('0xb'));var squel=require(_0x9c00('0xc'));var crypto=require(_0x9c00('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9c00('0xe'));var toCsv=require(_0x9c00('0x8'));var querystring=require('querystring');var Papa=require(_0x9c00('0xf'));var Redis=require('ioredis');var authService=require(_0x9c00('0x10'));var qs=require(_0x9c00('0x11'));var as=require(_0x9c00('0x12'));var hardwareService=require(_0x9c00('0x13'));var logger=require(_0x9c00('0x14'))(_0x9c00('0x15'));var utils=require(_0x9c00('0x16'));var config=require(_0x9c00('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dbd08,_0x251d9d){_0x251d9d=_0x251d9d||0xcc;return function(_0x7d16ff){if(_0x7d16ff){return _0x5dbd08[_0x9c00('0x18')](_0x251d9d);}return _0x5dbd08[_0x9c00('0x19')](_0x251d9d)[_0x9c00('0x1a')]();};}function respondWithResult(_0x1109b6,_0x21380b){_0x21380b=_0x21380b||0xc8;return function(_0x304e26){if(_0x304e26){return _0x1109b6[_0x9c00('0x19')](_0x21380b)[_0x9c00('0x1b')](_0x304e26);}};}function respondWithFilteredResult(_0x24a67e,_0x4c4906){return function(_0xe268bb){if(_0xe268bb){var _0x5cad80=typeof _0x4c4906[_0x9c00('0x1c')]===_0x9c00('0x1d')&&typeof _0x4c4906[_0x9c00('0x1e')]===_0x9c00('0x1d');var _0x3d73a4=_0xe268bb[_0x9c00('0x1f')];var _0x3d942d=_0x5cad80?0x0:_0x4c4906[_0x9c00('0x1c')];var _0x597d15=_0x5cad80?_0xe268bb[_0x9c00('0x1f')]:_0x4c4906['offset']+_0x4c4906[_0x9c00('0x1e')];var _0x14fd3f;if(_0x597d15>=_0x3d73a4){_0x597d15=_0x3d73a4;_0x14fd3f=0xc8;}else{_0x14fd3f=0xce;}_0x24a67e[_0x9c00('0x19')](_0x14fd3f);return _0x24a67e[_0x9c00('0x20')](_0x9c00('0x21'),_0x3d942d+'-'+_0x597d15+'/'+_0x3d73a4)['json'](_0xe268bb);}return null;};}function patchUpdates(_0x15f6aa){return function(_0x57b067){try{jsonpatch['apply'](_0x57b067,_0x15f6aa,!![]);}catch(_0xc2bf69){return BPromise['reject'](_0xc2bf69);}return _0x57b067[_0x9c00('0x22')]();};}function saveUpdates(_0x4941d9,_0x2e8ab4){return function(_0x23f4aa){if(_0x23f4aa){return _0x23f4aa['update'](_0x4941d9)[_0x9c00('0x23')](function(_0x3168e9){return _0x3168e9;});}return null;};}function removeEntity(_0x5ad767,_0x1ed4c){return function(_0x359b46){if(_0x359b46){return _0x359b46[_0x9c00('0x24')]()[_0x9c00('0x23')](function(){_0x5ad767[_0x9c00('0x19')](0xcc)[_0x9c00('0x1a')]();});}};}function handleEntityNotFound(_0x43254f,_0x2cf4bb){return function(_0x40c5c5){if(!_0x40c5c5){_0x43254f[_0x9c00('0x18')](0x194);}return _0x40c5c5;};}function handleError(_0x3a5792,_0x4e4b1c){_0x4e4b1c=_0x4e4b1c||0x1f4;return function(_0x3f11bb){logger[_0x9c00('0x25')](_0x3f11bb[_0x9c00('0x26')]);if(_0x3f11bb[_0x9c00('0x27')]){delete _0x3f11bb[_0x9c00('0x27')];}_0x3a5792[_0x9c00('0x19')](_0x4e4b1c)[_0x9c00('0x28')](_0x3f11bb);};}exports[_0x9c00('0x29')]=function(_0x25e60c,_0x910fe5){var _0xe41d27={},_0x1df075={},_0xb9b374={'count':0x0,'rows':[]};var _0x4bd682=_['map'](db['SquareReport'][_0x9c00('0x2a')],function(_0xee7859){return{'name':_0xee7859['fieldName'],'type':_0xee7859['type'][_0x9c00('0x2b')]};});_0x1df075[_0x9c00('0x2c')]=_['map'](_0x4bd682,_0x9c00('0x27'));_0x1df075[_0x9c00('0x2d')]=_[_0x9c00('0x2e')](_0x25e60c['query']);_0x1df075[_0x9c00('0x2f')]=_[_0x9c00('0x30')](_0x1df075[_0x9c00('0x2c')],_0x1df075[_0x9c00('0x2d')]);_0xe41d27[_0x9c00('0x31')]=_[_0x9c00('0x30')](_0x1df075[_0x9c00('0x2c')],qs[_0x9c00('0x32')](_0x25e60c[_0x9c00('0x2d')]['fields']));_0xe41d27['attributes']=_0xe41d27[_0x9c00('0x31')][_0x9c00('0x33')]?_0xe41d27[_0x9c00('0x31')]:_0x1df075['model'];if(!_0x25e60c[_0x9c00('0x2d')][_0x9c00('0x34')](_0x9c00('0x35'))){_0xe41d27['limit']=qs[_0x9c00('0x1e')](_0x25e60c[_0x9c00('0x2d')][_0x9c00('0x1e')]);_0xe41d27[_0x9c00('0x1c')]=qs[_0x9c00('0x1c')](_0x25e60c[_0x9c00('0x2d')][_0x9c00('0x1c')]);}_0xe41d27['order']=qs[_0x9c00('0x36')](_0x25e60c[_0x9c00('0x2d')][_0x9c00('0x36')]);_0xe41d27[_0x9c00('0x37')]=qs[_0x9c00('0x2f')](_[_0x9c00('0x38')](_0x25e60c[_0x9c00('0x2d')],_0x1df075[_0x9c00('0x2f')]),_0x4bd682);if(_0x25e60c[_0x9c00('0x2d')][_0x9c00('0x39')]){_0xe41d27['where']=_[_0x9c00('0x3a')](_0xe41d27[_0x9c00('0x37')],{'$or':_[_0x9c00('0x3b')](_0x4bd682,function(_0x5591fb){if(_0x5591fb[_0x9c00('0x3c')]!=='VIRTUAL'){var _0x17e92d={};_0x17e92d[_0x5591fb[_0x9c00('0x27')]]={'$like':'%'+_0x25e60c['query']['filter']+'%'};return _0x17e92d;}})});}_0xe41d27=_[_0x9c00('0x3a')]({},_0xe41d27,_0x25e60c['options']);var _0x840fee={'where':_0xe41d27[_0x9c00('0x37')]};return db[_0x9c00('0x3d')]['count'](_0x840fee)[_0x9c00('0x23')](function(_0x4691c3){_0xb9b374[_0x9c00('0x1f')]=_0x4691c3;if(_0x25e60c['query'][_0x9c00('0x3e')]){_0xe41d27[_0x9c00('0x3f')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0xe41d27);})[_0x9c00('0x23')](function(_0x2ed5d3){_0xb9b374[_0x9c00('0x40')]=_0x2ed5d3;return _0xb9b374;})[_0x9c00('0x23')](respondWithFilteredResult(_0x910fe5,_0xe41d27))[_0x9c00('0x41')](handleError(_0x910fe5,null));};exports[_0x9c00('0x42')]=function(_0x4a484f,_0x2aa148){var _0x20eeca={'raw':!![],'where':{'id':_0x4a484f[_0x9c00('0x43')]['id']}},_0x3f5ff8={};_0x3f5ff8[_0x9c00('0x2c')]=_[_0x9c00('0x2e')](db[_0x9c00('0x3d')][_0x9c00('0x2a')]);_0x3f5ff8[_0x9c00('0x2d')]=_[_0x9c00('0x2e')](_0x4a484f[_0x9c00('0x2d')]);_0x3f5ff8['filters']=_[_0x9c00('0x30')](_0x3f5ff8[_0x9c00('0x2c')],_0x3f5ff8['query']);_0x20eeca['attributes']=_['intersection'](_0x3f5ff8['model'],qs[_0x9c00('0x32')](_0x4a484f[_0x9c00('0x2d')]['fields']));_0x20eeca[_0x9c00('0x31')]=_0x20eeca[_0x9c00('0x31')][_0x9c00('0x33')]?_0x20eeca[_0x9c00('0x31')]:_0x3f5ff8[_0x9c00('0x2c')];if(_0x4a484f[_0x9c00('0x2d')][_0x9c00('0x3e')]){_0x20eeca[_0x9c00('0x3f')]=[{'all':!![]}];}_0x20eeca=_[_0x9c00('0x3a')]({},_0x20eeca,_0x4a484f[_0x9c00('0x44')]);return db[_0x9c00('0x3d')]['find'](_0x20eeca)[_0x9c00('0x23')](handleEntityNotFound(_0x2aa148,null))[_0x9c00('0x23')](respondWithResult(_0x2aa148,null))[_0x9c00('0x41')](handleError(_0x2aa148,null));};exports[_0x9c00('0x45')]=function(_0x56097b,_0x1249db){return db[_0x9c00('0x3d')][_0x9c00('0x45')](_0x56097b[_0x9c00('0x46')],{})[_0x9c00('0x23')](respondWithResult(_0x1249db,0xc9))['catch'](handleError(_0x1249db,null));};exports[_0x9c00('0x47')]=function(_0x29abf4,_0x228974){if(_0x29abf4[_0x9c00('0x46')]['id']){delete _0x29abf4['body']['id'];}return db[_0x9c00('0x3d')][_0x9c00('0x48')]({'where':{'id':_0x29abf4[_0x9c00('0x43')]['id']}})[_0x9c00('0x23')](handleEntityNotFound(_0x228974,null))[_0x9c00('0x23')](saveUpdates(_0x29abf4[_0x9c00('0x46')],null))[_0x9c00('0x23')](respondWithResult(_0x228974,null))[_0x9c00('0x41')](handleError(_0x228974,null));};exports['destroy']=function(_0x432b65,_0x392cf8){return db[_0x9c00('0x3d')][_0x9c00('0x48')]({'where':{'id':_0x432b65[_0x9c00('0x43')]['id']}})['then'](handleEntityNotFound(_0x392cf8,null))[_0x9c00('0x23')](removeEntity(_0x392cf8,null))[_0x9c00('0x41')](handleError(_0x392cf8,null));};exports['describe']=function(_0x107042,_0x4f050b){return db[_0x9c00('0x3d')][_0x9c00('0x49')]()['then'](respondWithResult(_0x4f050b,null))[_0x9c00('0x41')](handleError(_0x4f050b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 345755f..21756b3 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 _0x706e=['lodash','util','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x706e,0x1f4));var _0xe706=function(_0x2c18b4,_0x2e2582){_0x2c18b4=_0x2c18b4-0x0;var _0x44c098=_0x706e[_0x2c18b4];return _0x44c098;};'use strict';var _=require(_0xe706('0x0'));var util=require(_0xe706('0x1'));var logger=require('../../config/logger')('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(_0xe706('0x2'));var config=require('../../config/environment');var attributes=require(_0xe706('0x3'));module['exports']=function(_0x379d70,_0x289067){return _0x379d70[_0xe706('0x4')](_0xe706('0x5'),attributes,{'tableName':_0xe706('0x6'),'paranoid':![],'indexes':[{'name':_0xe706('0x7'),'fields':[_0xe706('0x8'),_0xe706('0x9')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a67=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger'];(function(_0x49dc9b,_0x4d4164){var _0x4618f2=function(_0x41757a){while(--_0x41757a){_0x49dc9b['push'](_0x49dc9b['shift']());}};_0x4618f2(++_0x4d4164);}(_0x0a67,0x1ee));var _0x70a6=function(_0x11cbff,_0x7b7128){_0x11cbff=_0x11cbff-0x0;var _0x3a90d9=_0x0a67[_0x11cbff];return _0x3a90d9;};'use strict';var _=require('lodash');var util=require(_0x70a6('0x0'));var logger=require(_0x70a6('0x1'))(_0x70a6('0x2'));var moment=require(_0x70a6('0x3'));var BPromise=require(_0x70a6('0x4'));var rp=require(_0x70a6('0x5'));var fs=require('fs');var path=require(_0x70a6('0x6'));var rimraf=require(_0x70a6('0x7'));var config=require(_0x70a6('0x8'));var attributes=require(_0x70a6('0x9'));module[_0x70a6('0xa')]=function(_0x5daa4d,_0x4fa417){return _0x5daa4d[_0x70a6('0xb')]('SquareReport',attributes,{'tableName':_0x70a6('0xc'),'paranoid':![],'indexes':[{'name':_0x70a6('0xd'),'fields':[_0x70a6('0xe'),'project_name']},{'name':_0x70a6('0xf'),'fields':[_0x70a6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 78f5771..62df6be 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 _0x1185=['message','result','create','body','options','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','raw','where','attributes','limit','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x1185,0xda));var _0x5118=function(_0x478ee6,_0x2ea2cd){_0x478ee6=_0x478ee6-0x0;var _0x3d0481=_0x1185[_0x478ee6];return _0x3d0481;};'use strict';var _=require('lodash');var util=require(_0x5118('0x0'));var moment=require(_0x5118('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5118('0x2'))['db'];var utils=require(_0x5118('0x3'));var logger=require(_0x5118('0x4'))(_0x5118('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5118('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc0c1,_0x5ead7a,_0x18496d){return new BPromise(function(_0x41e926,_0x554cb4){return client[_0x5118('0x7')](_0x1bc0c1,_0x18496d)['then'](function(_0x37ab2e){logger[_0x5118('0x8')](_0x5118('0x9'),_0x5ead7a,_0x5118('0xa'));logger[_0x5118('0xb')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5ead7a,_0x5118('0xa'),JSON[_0x5118('0xc')](_0x37ab2e));if(_0x37ab2e[_0x5118('0xd')]){if(_0x37ab2e['error']['code']===0x1f4){logger[_0x5118('0xd')]('SquareReport,\x20%s,\x20%s',_0x5ead7a,_0x37ab2e['error'][_0x5118('0xe')]);return _0x554cb4(_0x37ab2e[_0x5118('0xd')][_0x5118('0xe')]);}logger[_0x5118('0xd')](_0x5118('0x9'),_0x5ead7a,_0x37ab2e[_0x5118('0xd')]['message']);return _0x41e926(_0x37ab2e['error'][_0x5118('0xe')]);}else{logger[_0x5118('0x8')](_0x5118('0x9'),_0x5ead7a,_0x5118('0xa'));_0x41e926(_0x37ab2e[_0x5118('0xf')][_0x5118('0xe')]);}})['catch'](function(_0x1cc28f){logger['error']('SquareReport,\x20%s,\x20%s',_0x5ead7a,_0x1cc28f);_0x554cb4(_0x1cc28f);});});}exports['CreateSquareReport']=function(_0x148568){var _0x4ce9d0=this;return new Promise(function(_0x21327f,_0x214717){return db['SquareReport'][_0x5118('0x10')](_0x148568[_0x5118('0x11')],{'raw':_0x148568['options']?_0x148568[_0x5118('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x5118('0x13')](function(_0x676e81){logger[_0x5118('0x8')]('CreateSquareReport',_0x148568);logger['debug'](_0x5118('0x14'),_0x148568,JSON[_0x5118('0xc')](_0x676e81));_0x21327f(_0x676e81);})['catch'](function(_0x1f6352){logger[_0x5118('0xd')](_0x5118('0x14'),_0x1f6352[_0x5118('0xe')],_0x148568);_0x214717(_0x4ce9d0['error'](0x1f4,_0x1f6352[_0x5118('0xe')]));});});};exports[_0x5118('0x15')]=function(_0x3bedda){var _0xcf412c=this;return new Promise(function(_0x3e4110,_0x335125){return db[_0x5118('0x16')][_0x5118('0x17')](_0x3bedda[_0x5118('0x11')],{'raw':_0x3bedda['options']?_0x3bedda['options'][_0x5118('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bedda['options']?_0x3bedda[_0x5118('0x12')][_0x5118('0x19')]||null:null,'attributes':_0x3bedda[_0x5118('0x12')]?_0x3bedda[_0x5118('0x12')][_0x5118('0x1a')]||null:null,'limit':_0x3bedda[_0x5118('0x12')]?_0x3bedda[_0x5118('0x12')][_0x5118('0x1b')]||null:null})[_0x5118('0x13')](function(_0x45e4b6){logger[_0x5118('0x8')](_0x5118('0x15'),_0x3bedda);logger['debug']('UpdateSquareReport',_0x3bedda,JSON[_0x5118('0xc')](_0x45e4b6));_0x3e4110(_0x45e4b6);})[_0x5118('0x1c')](function(_0x60c9e0){logger[_0x5118('0xd')](_0x5118('0x15'),_0x60c9e0[_0x5118('0xe')],_0x3bedda);_0x335125(_0xcf412c['error'](0x1f4,_0x60c9e0[_0x5118('0xe')]));});});}; \ No newline at end of file +var _0x3ceb=['raw','then','UpdateSquareReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','body','options'];(function(_0x519e33,_0x49b004){var _0x164575=function(_0x388bcb){while(--_0x388bcb){_0x519e33['push'](_0x519e33['shift']());}};_0x164575(++_0x49b004);}(_0x3ceb,0x18c));var _0xb3ce=function(_0x192a29,_0x2fbc9c){_0x192a29=_0x192a29-0x0;var _0x3701e3=_0x3ceb[_0x192a29];return _0x3701e3;};'use strict';var _=require('lodash');var util=require(_0xb3ce('0x0'));var moment=require(_0xb3ce('0x1'));var BPromise=require(_0xb3ce('0x2'));var rs=require(_0xb3ce('0x3'));var fs=require('fs');var Redis=require(_0xb3ce('0x4'));var db=require(_0xb3ce('0x5'))['db'];var utils=require(_0xb3ce('0x6'));var logger=require(_0xb3ce('0x7'))('rpc');var config=require(_0xb3ce('0x8'));var jayson=require(_0xb3ce('0x9'));var client=jayson[_0xb3ce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b3791,_0x47531b,_0x3b9670){return new BPromise(function(_0x5c19ce,_0x4f831b){return client['request'](_0x2b3791,_0x3b9670)['then'](function(_0x2ead70){logger[_0xb3ce('0xb')]('SquareReport,\x20%s,\x20%s',_0x47531b,_0xb3ce('0xc'));logger[_0xb3ce('0xd')](_0xb3ce('0xe'),_0x47531b,_0xb3ce('0xc'),JSON[_0xb3ce('0xf')](_0x2ead70));if(_0x2ead70['error']){if(_0x2ead70['error']['code']===0x1f4){logger[_0xb3ce('0x10')](_0xb3ce('0x11'),_0x47531b,_0x2ead70[_0xb3ce('0x10')][_0xb3ce('0x12')]);return _0x4f831b(_0x2ead70[_0xb3ce('0x10')][_0xb3ce('0x12')]);}logger[_0xb3ce('0x10')](_0xb3ce('0x11'),_0x47531b,_0x2ead70[_0xb3ce('0x10')][_0xb3ce('0x12')]);return _0x5c19ce(_0x2ead70[_0xb3ce('0x10')][_0xb3ce('0x12')]);}else{logger[_0xb3ce('0xb')]('SquareReport,\x20%s,\x20%s',_0x47531b,_0xb3ce('0xc'));_0x5c19ce(_0x2ead70['result'][_0xb3ce('0x12')]);}})[_0xb3ce('0x13')](function(_0x32813b){logger[_0xb3ce('0x10')]('SquareReport,\x20%s,\x20%s',_0x47531b,_0x32813b);_0x4f831b(_0x32813b);});});}exports[_0xb3ce('0x14')]=function(_0x37e6f0){var _0x533fc8=this;return new Promise(function(_0x252dab,_0x185ec6){return db[_0xb3ce('0x15')]['create'](_0x37e6f0[_0xb3ce('0x16')],{'raw':_0x37e6f0['options']?_0x37e6f0[_0xb3ce('0x17')][_0xb3ce('0x18')]===undefined?!![]:![]:!![]})[_0xb3ce('0x19')](function(_0x5f3be2){logger['info'](_0xb3ce('0x14'),_0x37e6f0);logger[_0xb3ce('0xd')](_0xb3ce('0x14'),_0x37e6f0,JSON[_0xb3ce('0xf')](_0x5f3be2));_0x252dab(_0x5f3be2);})[_0xb3ce('0x13')](function(_0x31dd16){logger[_0xb3ce('0x10')](_0xb3ce('0x14'),_0x31dd16[_0xb3ce('0x12')],_0x37e6f0);_0x185ec6(_0x533fc8['error'](0x1f4,_0x31dd16[_0xb3ce('0x12')]));});});};exports[_0xb3ce('0x1a')]=function(_0x282405){var _0x3a5d40=this;return new Promise(function(_0x257759,_0x4064dd){return db['SquareReport'][_0xb3ce('0x1b')](_0x282405['body'],{'raw':_0x282405[_0xb3ce('0x17')]?_0x282405['options'][_0xb3ce('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x282405[_0xb3ce('0x17')]?_0x282405[_0xb3ce('0x17')][_0xb3ce('0x1c')]||null:null,'attributes':_0x282405[_0xb3ce('0x17')]?_0x282405[_0xb3ce('0x17')]['attributes']||null:null,'limit':_0x282405[_0xb3ce('0x17')]?_0x282405[_0xb3ce('0x17')][_0xb3ce('0x1d')]||null:null})[_0xb3ce('0x19')](function(_0xa42f21){logger[_0xb3ce('0xb')]('UpdateSquareReport',_0x282405);logger[_0xb3ce('0xd')](_0xb3ce('0x1a'),_0x282405,JSON['stringify'](_0xa42f21));_0x257759(_0xa42f21);})[_0xb3ce('0x13')](function(_0x1f3a71){logger[_0xb3ce('0x10')]('UpdateSquareReport',_0x1f3a71[_0xb3ce('0x12')],_0x282405);_0x4064dd(_0x3a5d40[_0xb3ce('0x10')](0x1f4,_0x1f3a71['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b32c8a6..c113da4 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 _0x0e66=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','./squareReportDetail.controller'];(function(_0x567d41,_0x4f5365){var _0x4a0e06=function(_0x3b9494){while(--_0x3b9494){_0x567d41['push'](_0x567d41['shift']());}};_0x4a0e06(++_0x4f5365);}(_0x0e66,0x19a));var _0x60e6=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0x0e66[_0x5d9867];return _0x7d2118;};'use strict';var multer=require(_0x60e6('0x0'));var util=require('util');var path=require(_0x60e6('0x1'));var timeout=require(_0x60e6('0x2'));var express=require(_0x60e6('0x3'));var router=express[_0x60e6('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(_0x60e6('0x5'));router[_0x60e6('0x6')]('/',auth[_0x60e6('0x7')](),controller[_0x60e6('0x8')]);router['get']('/describe',auth[_0x60e6('0x7')](),controller['describe']);router[_0x60e6('0x6')](_0x60e6('0x9'),auth[_0x60e6('0x7')](),controller[_0x60e6('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x60e6('0xb')]);router[_0x60e6('0xc')](_0x60e6('0x9'),auth['isAuthenticated'](),controller[_0x60e6('0xd')]);router['delete'](_0x60e6('0x9'),auth[_0x60e6('0x7')](),controller[_0x60e6('0xe')]);module[_0x60e6('0xf')]=router; \ No newline at end of file +var _0xb0e3=['/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xb0e3,0x92));var _0x3b0e=function(_0x1f66df,_0x13a11c){_0x1f66df=_0x1f66df-0x0;var _0x11449a=_0xb0e3[_0x1f66df];return _0x11449a;};'use strict';var multer=require('multer');var util=require(_0x3b0e('0x0'));var path=require('path');var timeout=require(_0x3b0e('0x1'));var express=require(_0x3b0e('0x2'));var router=express['Router']();var fs_extra=require(_0x3b0e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3b0e('0x4'));var config=require('../../config/environment');var controller=require(_0x3b0e('0x5'));router[_0x3b0e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3b0e('0x6')](_0x3b0e('0x7'),auth[_0x3b0e('0x8')](),controller[_0x3b0e('0x9')]);router[_0x3b0e('0x6')](_0x3b0e('0xa'),auth[_0x3b0e('0x8')](),controller[_0x3b0e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b0e('0xc')]);router[_0x3b0e('0xd')](_0x3b0e('0xa'),auth[_0x3b0e('0x8')](),controller[_0x3b0e('0xe')]);router[_0x3b0e('0xf')](_0x3b0e('0xa'),auth[_0x3b0e('0x8')](),controller[_0x3b0e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e3f2b9d..0a2958d 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 _0x5d16=['STRING'];(function(_0x528ad3,_0x53a1f7){var _0x43b7c5=function(_0x283f21){while(--_0x283f21){_0x528ad3['push'](_0x528ad3['shift']());}};_0x43b7c5(++_0x53a1f7);}(_0x5d16,0xb7));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x65d1('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x65d1('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x65d1('0x0')]},'callerid':{'type':Sequelize[_0x65d1('0x0')]}}; \ No newline at end of file +var _0xc69d=['TEXT','sequelize','exports','STRING'];(function(_0x2f96b1,_0x4987cb){var _0x2710f2=function(_0x5ed5a9){while(--_0x5ed5a9){_0x2f96b1['push'](_0x2f96b1['shift']());}};_0x2710f2(++_0x4987cb);}(_0xc69d,0x1e9));var _0xdc69=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xc69d[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require(_0xdc69('0x0'));module[_0xdc69('0x1')]={'uniqueid':{'type':Sequelize[_0xdc69('0x2')]},'node':{'type':Sequelize[_0xdc69('0x2')]},'application':{'type':Sequelize[_0xdc69('0x2')]},'data':{'type':Sequelize[_0xdc69('0x3')]},'project_name':{'type':Sequelize[_0xdc69('0x2')]},'callerid':{'type':Sequelize[_0xdc69('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cdb519c..e7c50f8 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 _0xc0fa=['fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes'];(function(_0x2ddd42,_0x39be46){var _0x189dc1=function(_0xab9aac){while(--_0xab9aac){_0x2ddd42['push'](_0x2ddd42['shift']());}};_0x189dc1(++_0x39be46);}(_0xc0fa,0xfa));var _0xac0f=function(_0x5597a0,_0x35c11e){_0x5597a0=_0x5597a0-0x0;var _0x2fc8d6=_0xc0fa[_0x5597a0];return _0x2fc8d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac0f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac0f('0x1'));var rp=require(_0xac0f('0x2'));var moment=require(_0xac0f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac0f('0x4'));var util=require(_0xac0f('0x5'));var path=require(_0xac0f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac0f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac0f('0x8'));var crypto=require(_0xac0f('0x9'));var jsforce=require(_0xac0f('0xa'));var deskjs=require(_0xac0f('0xb'));var toCsv=require(_0xac0f('0xc'));var querystring=require('querystring');var Papa=require(_0xac0f('0xd'));var Redis=require(_0xac0f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xac0f('0xf'));var as=require(_0xac0f('0x10'));var hardwareService=require(_0xac0f('0x11'));var logger=require('../../config/logger')(_0xac0f('0x12'));var utils=require(_0xac0f('0x13'));var config=require(_0xac0f('0x14'));var licenseUtil=require(_0xac0f('0x15'));var db=require(_0xac0f('0x16'))['db'];function respondWithStatusCode(_0xa63ccb,_0x52d8af){_0x52d8af=_0x52d8af||0xcc;return function(_0x56e7d8){if(_0x56e7d8){return _0xa63ccb[_0xac0f('0x17')](_0x52d8af);}return _0xa63ccb[_0xac0f('0x18')](_0x52d8af)[_0xac0f('0x19')]();};}function respondWithResult(_0x11ca7e,_0x57bee0){_0x57bee0=_0x57bee0||0xc8;return function(_0x272d88){if(_0x272d88){return _0x11ca7e[_0xac0f('0x18')](_0x57bee0)[_0xac0f('0x1a')](_0x272d88);}};}function respondWithFilteredResult(_0x5f11f5,_0x5c7a7a){return function(_0x55d255){if(_0x55d255){var _0x84a96=typeof _0x5c7a7a[_0xac0f('0x1b')]===_0xac0f('0x1c')&&typeof _0x5c7a7a[_0xac0f('0x1d')]==='undefined';var _0x53b082=_0x55d255[_0xac0f('0x1e')];var _0x34a206=_0x84a96?0x0:_0x5c7a7a[_0xac0f('0x1b')];var _0x2c505c=_0x84a96?_0x55d255['count']:_0x5c7a7a['offset']+_0x5c7a7a['limit'];var _0x1db450;if(_0x2c505c>=_0x53b082){_0x2c505c=_0x53b082;_0x1db450=0xc8;}else{_0x1db450=0xce;}_0x5f11f5[_0xac0f('0x18')](_0x1db450);return _0x5f11f5[_0xac0f('0x1f')](_0xac0f('0x20'),_0x34a206+'-'+_0x2c505c+'/'+_0x53b082)[_0xac0f('0x1a')](_0x55d255);}return null;};}function patchUpdates(_0x12d935){return function(_0x44d12f){try{jsonpatch[_0xac0f('0x21')](_0x44d12f,_0x12d935,!![]);}catch(_0x30e868){return BPromise[_0xac0f('0x22')](_0x30e868);}return _0x44d12f[_0xac0f('0x23')]();};}function saveUpdates(_0x20e002,_0x478517){return function(_0x946075){if(_0x946075){return _0x946075[_0xac0f('0x24')](_0x20e002)[_0xac0f('0x25')](function(_0xf107f4){return _0xf107f4;});}return null;};}function removeEntity(_0x1f3b98,_0x501251){return function(_0x1dabe2){if(_0x1dabe2){return _0x1dabe2[_0xac0f('0x26')]()[_0xac0f('0x25')](function(){_0x1f3b98[_0xac0f('0x18')](0xcc)[_0xac0f('0x19')]();});}};}function handleEntityNotFound(_0x3b98cc,_0x4e327d){return function(_0x317720){if(!_0x317720){_0x3b98cc[_0xac0f('0x17')](0x194);}return _0x317720;};}function handleError(_0x1b429b,_0x30dd53){_0x30dd53=_0x30dd53||0x1f4;return function(_0x2a613a){logger[_0xac0f('0x27')](_0x2a613a[_0xac0f('0x28')]);if(_0x2a613a[_0xac0f('0x29')]){delete _0x2a613a[_0xac0f('0x29')];}_0x1b429b['status'](_0x30dd53)['send'](_0x2a613a);};}exports[_0xac0f('0x2a')]=function(_0x265740,_0x432734){var _0x554b09={},_0x112728={},_0x1e2235={'count':0x0,'rows':[]};var _0x490324=_[_0xac0f('0x2b')](db[_0xac0f('0x2c')][_0xac0f('0x2d')],function(_0x49ba87){return{'name':_0x49ba87[_0xac0f('0x2e')],'type':_0x49ba87[_0xac0f('0x2f')][_0xac0f('0x30')]};});_0x112728[_0xac0f('0x31')]=_[_0xac0f('0x2b')](_0x490324,_0xac0f('0x29'));_0x112728['query']=_[_0xac0f('0x32')](_0x265740[_0xac0f('0x33')]);_0x112728['filters']=_[_0xac0f('0x34')](_0x112728[_0xac0f('0x31')],_0x112728[_0xac0f('0x33')]);_0x554b09[_0xac0f('0x35')]=_[_0xac0f('0x34')](_0x112728[_0xac0f('0x31')],qs['fields'](_0x265740[_0xac0f('0x33')][_0xac0f('0x36')]));_0x554b09[_0xac0f('0x35')]=_0x554b09[_0xac0f('0x35')][_0xac0f('0x37')]?_0x554b09['attributes']:_0x112728[_0xac0f('0x31')];if(!_0x265740[_0xac0f('0x33')][_0xac0f('0x38')]('nolimit')){_0x554b09[_0xac0f('0x1d')]=qs['limit'](_0x265740[_0xac0f('0x33')][_0xac0f('0x1d')]);_0x554b09[_0xac0f('0x1b')]=qs[_0xac0f('0x1b')](_0x265740[_0xac0f('0x33')][_0xac0f('0x1b')]);}_0x554b09[_0xac0f('0x39')]=qs[_0xac0f('0x3a')](_0x265740[_0xac0f('0x33')][_0xac0f('0x3a')]);_0x554b09[_0xac0f('0x3b')]=qs['filters'](_['pick'](_0x265740[_0xac0f('0x33')],_0x112728[_0xac0f('0x3c')]),_0x490324);if(_0x265740[_0xac0f('0x33')][_0xac0f('0x3d')]){_0x554b09[_0xac0f('0x3b')]=_[_0xac0f('0x3e')](_0x554b09[_0xac0f('0x3b')],{'$or':_[_0xac0f('0x2b')](_0x490324,function(_0x4e3ac6){if(_0x4e3ac6[_0xac0f('0x2f')]!==_0xac0f('0x3f')){var _0x321e4d={};_0x321e4d[_0x4e3ac6[_0xac0f('0x29')]]={'$like':'%'+_0x265740[_0xac0f('0x33')][_0xac0f('0x3d')]+'%'};return _0x321e4d;}})});}_0x554b09=_[_0xac0f('0x3e')]({},_0x554b09,_0x265740[_0xac0f('0x40')]);var _0x1f9ee2={'where':_0x554b09[_0xac0f('0x3b')]};return db[_0xac0f('0x2c')][_0xac0f('0x1e')](_0x1f9ee2)[_0xac0f('0x25')](function(_0x179642){_0x1e2235['count']=_0x179642;if(_0x265740['query'][_0xac0f('0x41')]){_0x554b09[_0xac0f('0x42')]=[{'all':!![]}];}return db[_0xac0f('0x2c')]['findAll'](_0x554b09);})[_0xac0f('0x25')](function(_0x17530c){_0x1e2235[_0xac0f('0x43')]=_0x17530c;return _0x1e2235;})[_0xac0f('0x25')](respondWithFilteredResult(_0x432734,_0x554b09))[_0xac0f('0x44')](handleError(_0x432734,null));};exports['show']=function(_0x3b33bf,_0x53c8ec){var _0x3265e0={'raw':!![],'where':{'id':_0x3b33bf[_0xac0f('0x45')]['id']}},_0x8e57ca={};_0x8e57ca['model']=_[_0xac0f('0x32')](db[_0xac0f('0x2c')][_0xac0f('0x2d')]);_0x8e57ca['query']=_['keys'](_0x3b33bf[_0xac0f('0x33')]);_0x8e57ca[_0xac0f('0x3c')]=_[_0xac0f('0x34')](_0x8e57ca[_0xac0f('0x31')],_0x8e57ca[_0xac0f('0x33')]);_0x3265e0['attributes']=_['intersection'](_0x8e57ca[_0xac0f('0x31')],qs[_0xac0f('0x36')](_0x3b33bf['query']['fields']));_0x3265e0['attributes']=_0x3265e0[_0xac0f('0x35')][_0xac0f('0x37')]?_0x3265e0[_0xac0f('0x35')]:_0x8e57ca['model'];if(_0x3b33bf[_0xac0f('0x33')]['includeAll']){_0x3265e0['include']=[{'all':!![]}];}_0x3265e0=_[_0xac0f('0x3e')]({},_0x3265e0,_0x3b33bf['options']);return db['SquareDetailsReport'][_0xac0f('0x46')](_0x3265e0)[_0xac0f('0x25')](handleEntityNotFound(_0x53c8ec,null))[_0xac0f('0x25')](respondWithResult(_0x53c8ec,null))[_0xac0f('0x44')](handleError(_0x53c8ec,null));};exports[_0xac0f('0x47')]=function(_0x38268e,_0x1e6564){return db['SquareDetailsReport']['create'](_0x38268e['body'],{})['then'](respondWithResult(_0x1e6564,0xc9))['catch'](handleError(_0x1e6564,null));};exports[_0xac0f('0x24')]=function(_0x50ca86,_0x56e43b){if(_0x50ca86['body']['id']){delete _0x50ca86[_0xac0f('0x48')]['id'];}return db[_0xac0f('0x2c')]['find']({'where':{'id':_0x50ca86[_0xac0f('0x45')]['id']}})[_0xac0f('0x25')](handleEntityNotFound(_0x56e43b,null))[_0xac0f('0x25')](saveUpdates(_0x50ca86[_0xac0f('0x48')],null))[_0xac0f('0x25')](respondWithResult(_0x56e43b,null))['catch'](handleError(_0x56e43b,null));};exports['destroy']=function(_0x520e05,_0x2e21a3){return db['SquareDetailsReport'][_0xac0f('0x46')]({'where':{'id':_0x520e05[_0xac0f('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e21a3,null))['then'](removeEntity(_0x2e21a3,null))['catch'](handleError(_0x2e21a3,null));};exports[_0xac0f('0x49')]=function(_0x4073af,_0x58c43c){return db[_0xac0f('0x2c')][_0xac0f('0x49')]()['then'](respondWithResult(_0x58c43c,null))['catch'](handleError(_0x58c43c,null));}; \ No newline at end of file +var _0x3c73=['options','findAll','catch','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','name','index','SquareDetailsReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL'];(function(_0x441819,_0x5b8d0a){var _0x478882=function(_0x369786){while(--_0x369786){_0x441819['push'](_0x441819['shift']());}};_0x478882(++_0x5b8d0a);}(_0x3c73,0x171));var _0x33c7=function(_0x5e16dd,_0x1e28dc){_0x5e16dd=_0x5e16dd-0x0;var _0x1e653c=_0x3c73[_0x5e16dd];return _0x1e653c;};'use strict';var emlformat=require(_0x33c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33c7('0x1'));var jsonpatch=require(_0x33c7('0x2'));var rp=require(_0x33c7('0x3'));var moment=require('moment');var BPromise=require(_0x33c7('0x4'));var Mustache=require('mustache');var util=require(_0x33c7('0x5'));var path=require(_0x33c7('0x6'));var sox=require(_0x33c7('0x7'));var csv=require(_0x33c7('0x8'));var ejs=require(_0x33c7('0x9'));var fs=require('fs');var fs_extra=require(_0x33c7('0xa'));var _=require(_0x33c7('0xb'));var squel=require(_0x33c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x33c7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x33c7('0x8'));var querystring=require(_0x33c7('0xe'));var Papa=require(_0x33c7('0xf'));var Redis=require(_0x33c7('0x10'));var authService=require(_0x33c7('0x11'));var qs=require(_0x33c7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33c7('0x13'));var logger=require(_0x33c7('0x14'))(_0x33c7('0x15'));var utils=require(_0x33c7('0x16'));var config=require(_0x33c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33c7('0x18'))['db'];function respondWithStatusCode(_0x5169c5,_0x1c0b6c){_0x1c0b6c=_0x1c0b6c||0xcc;return function(_0x4f9c34){if(_0x4f9c34){return _0x5169c5[_0x33c7('0x19')](_0x1c0b6c);}return _0x5169c5[_0x33c7('0x1a')](_0x1c0b6c)[_0x33c7('0x1b')]();};}function respondWithResult(_0x14f3f0,_0x2c8030){_0x2c8030=_0x2c8030||0xc8;return function(_0x3e43ad){if(_0x3e43ad){return _0x14f3f0[_0x33c7('0x1a')](_0x2c8030)[_0x33c7('0x1c')](_0x3e43ad);}};}function respondWithFilteredResult(_0x201e37,_0x302751){return function(_0x75de2c){if(_0x75de2c){var _0x121bfe=typeof _0x302751['offset']===_0x33c7('0x1d')&&typeof _0x302751[_0x33c7('0x1e')]===_0x33c7('0x1d');var _0x39425a=_0x75de2c[_0x33c7('0x1f')];var _0x133b33=_0x121bfe?0x0:_0x302751[_0x33c7('0x20')];var _0x47e636=_0x121bfe?_0x75de2c[_0x33c7('0x1f')]:_0x302751[_0x33c7('0x20')]+_0x302751[_0x33c7('0x1e')];var _0x5259d4;if(_0x47e636>=_0x39425a){_0x47e636=_0x39425a;_0x5259d4=0xc8;}else{_0x5259d4=0xce;}_0x201e37[_0x33c7('0x1a')](_0x5259d4);return _0x201e37[_0x33c7('0x21')]('Content-Range',_0x133b33+'-'+_0x47e636+'/'+_0x39425a)['json'](_0x75de2c);}return null;};}function patchUpdates(_0xfdd293){return function(_0x568791){try{jsonpatch[_0x33c7('0x22')](_0x568791,_0xfdd293,!![]);}catch(_0x167747){return BPromise['reject'](_0x167747);}return _0x568791['save']();};}function saveUpdates(_0x4297f9,_0x539a44){return function(_0x56637c){if(_0x56637c){return _0x56637c[_0x33c7('0x23')](_0x4297f9)[_0x33c7('0x24')](function(_0x68b2a2){return _0x68b2a2;});}return null;};}function removeEntity(_0x2dbccf,_0x27476d){return function(_0xd96cd7){if(_0xd96cd7){return _0xd96cd7[_0x33c7('0x25')]()[_0x33c7('0x24')](function(){_0x2dbccf[_0x33c7('0x1a')](0xcc)[_0x33c7('0x1b')]();});}};}function handleEntityNotFound(_0x312dcd,_0x4f2df8){return function(_0x2478a5){if(!_0x2478a5){_0x312dcd['sendStatus'](0x194);}return _0x2478a5;};}function handleError(_0x42e163,_0x3f254b){_0x3f254b=_0x3f254b||0x1f4;return function(_0x3f3b81){logger[_0x33c7('0x26')](_0x3f3b81['stack']);if(_0x3f3b81[_0x33c7('0x27')]){delete _0x3f3b81[_0x33c7('0x27')];}_0x42e163[_0x33c7('0x1a')](_0x3f254b)['send'](_0x3f3b81);};}exports[_0x33c7('0x28')]=function(_0x319eaa,_0x2c357a){var _0x40bbca={},_0x17e83c={},_0x274f92={'count':0x0,'rows':[]};var _0x2e581e=_['map'](db[_0x33c7('0x29')][_0x33c7('0x2a')],function(_0x1a8c3f){return{'name':_0x1a8c3f[_0x33c7('0x2b')],'type':_0x1a8c3f['type'][_0x33c7('0x2c')]};});_0x17e83c[_0x33c7('0x2d')]=_['map'](_0x2e581e,_0x33c7('0x27'));_0x17e83c[_0x33c7('0x2e')]=_['keys'](_0x319eaa[_0x33c7('0x2e')]);_0x17e83c[_0x33c7('0x2f')]=_[_0x33c7('0x30')](_0x17e83c['model'],_0x17e83c['query']);_0x40bbca['attributes']=_[_0x33c7('0x30')](_0x17e83c[_0x33c7('0x2d')],qs[_0x33c7('0x31')](_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x31')]));_0x40bbca[_0x33c7('0x32')]=_0x40bbca[_0x33c7('0x32')][_0x33c7('0x33')]?_0x40bbca[_0x33c7('0x32')]:_0x17e83c[_0x33c7('0x2d')];if(!_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x34')](_0x33c7('0x35'))){_0x40bbca[_0x33c7('0x1e')]=qs[_0x33c7('0x1e')](_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x1e')]);_0x40bbca[_0x33c7('0x20')]=qs[_0x33c7('0x20')](_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x20')]);}_0x40bbca[_0x33c7('0x36')]=qs['sort'](_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x37')]);_0x40bbca[_0x33c7('0x38')]=qs['filters'](_[_0x33c7('0x39')](_0x319eaa[_0x33c7('0x2e')],_0x17e83c['filters']),_0x2e581e);if(_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x3a')]){_0x40bbca[_0x33c7('0x38')]=_[_0x33c7('0x3b')](_0x40bbca['where'],{'$or':_[_0x33c7('0x3c')](_0x2e581e,function(_0x22ca64){if(_0x22ca64[_0x33c7('0x3d')]!==_0x33c7('0x3e')){var _0x4f55ca={};_0x4f55ca[_0x22ca64['name']]={'$like':'%'+_0x319eaa[_0x33c7('0x2e')][_0x33c7('0x3a')]+'%'};return _0x4f55ca;}})});}_0x40bbca=_[_0x33c7('0x3b')]({},_0x40bbca,_0x319eaa[_0x33c7('0x3f')]);var _0x5af5bd={'where':_0x40bbca['where']};return db[_0x33c7('0x29')][_0x33c7('0x1f')](_0x5af5bd)['then'](function(_0x324f98){_0x274f92[_0x33c7('0x1f')]=_0x324f98;if(_0x319eaa['query']['includeAll']){_0x40bbca['include']=[{'all':!![]}];}return db[_0x33c7('0x29')][_0x33c7('0x40')](_0x40bbca);})['then'](function(_0x457f81){_0x274f92['rows']=_0x457f81;return _0x274f92;})[_0x33c7('0x24')](respondWithFilteredResult(_0x2c357a,_0x40bbca))[_0x33c7('0x41')](handleError(_0x2c357a,null));};exports['show']=function(_0x4e1a84,_0x3ab1a3){var _0x2aa638={'raw':!![],'where':{'id':_0x4e1a84[_0x33c7('0x42')]['id']}},_0x842077={};_0x842077[_0x33c7('0x2d')]=_['keys'](db[_0x33c7('0x29')][_0x33c7('0x2a')]);_0x842077[_0x33c7('0x2e')]=_['keys'](_0x4e1a84[_0x33c7('0x2e')]);_0x842077[_0x33c7('0x2f')]=_[_0x33c7('0x30')](_0x842077[_0x33c7('0x2d')],_0x842077[_0x33c7('0x2e')]);_0x2aa638[_0x33c7('0x32')]=_['intersection'](_0x842077[_0x33c7('0x2d')],qs[_0x33c7('0x31')](_0x4e1a84[_0x33c7('0x2e')]['fields']));_0x2aa638['attributes']=_0x2aa638['attributes'][_0x33c7('0x33')]?_0x2aa638[_0x33c7('0x32')]:_0x842077[_0x33c7('0x2d')];if(_0x4e1a84[_0x33c7('0x2e')]['includeAll']){_0x2aa638[_0x33c7('0x43')]=[{'all':!![]}];}_0x2aa638=_[_0x33c7('0x3b')]({},_0x2aa638,_0x4e1a84[_0x33c7('0x3f')]);return db[_0x33c7('0x29')]['find'](_0x2aa638)[_0x33c7('0x24')](handleEntityNotFound(_0x3ab1a3,null))[_0x33c7('0x24')](respondWithResult(_0x3ab1a3,null))[_0x33c7('0x41')](handleError(_0x3ab1a3,null));};exports[_0x33c7('0x44')]=function(_0x1b4200,_0x9210c7){return db[_0x33c7('0x29')][_0x33c7('0x44')](_0x1b4200[_0x33c7('0x45')],{})['then'](respondWithResult(_0x9210c7,0xc9))[_0x33c7('0x41')](handleError(_0x9210c7,null));};exports['update']=function(_0x7336b4,_0x2ef2e5){if(_0x7336b4['body']['id']){delete _0x7336b4[_0x33c7('0x45')]['id'];}return db['SquareDetailsReport'][_0x33c7('0x46')]({'where':{'id':_0x7336b4[_0x33c7('0x42')]['id']}})[_0x33c7('0x24')](handleEntityNotFound(_0x2ef2e5,null))[_0x33c7('0x24')](saveUpdates(_0x7336b4[_0x33c7('0x45')],null))[_0x33c7('0x24')](respondWithResult(_0x2ef2e5,null))[_0x33c7('0x41')](handleError(_0x2ef2e5,null));};exports[_0x33c7('0x25')]=function(_0x58f08d,_0x4ac51d){return db[_0x33c7('0x29')][_0x33c7('0x46')]({'where':{'id':_0x58f08d[_0x33c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ac51d,null))[_0x33c7('0x24')](removeEntity(_0x4ac51d,null))[_0x33c7('0x41')](handleError(_0x4ac51d,null));};exports[_0x33c7('0x47')]=function(_0x5bf87c,_0x26a07c){return db[_0x33c7('0x29')][_0x33c7('0x47')]()[_0x33c7('0x24')](respondWithResult(_0x26a07c,null))[_0x33c7('0x41')](handleError(_0x26a07c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3e3c457..cd81223 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 _0x950d=['report_square_details','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4239bd,_0x1f310b){var _0x21f061=function(_0xbe0bca){while(--_0xbe0bca){_0x4239bd['push'](_0x4239bd['shift']());}};_0x21f061(++_0x1f310b);}(_0x950d,0x9b));var _0xd950=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x950d[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xd950('0x0'));var logger=require(_0xd950('0x1'))('api');var moment=require(_0xd950('0x2'));var BPromise=require(_0xd950('0x3'));var rp=require(_0xd950('0x4'));var fs=require('fs');var path=require(_0xd950('0x5'));var rimraf=require(_0xd950('0x6'));var config=require(_0xd950('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xd950('0x8')]=function(_0x1e0ab0,_0x376053){return _0x1e0ab0[_0xd950('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xd950('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b98=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x101d0d,_0x1523f9){var _0x26a185=function(_0x13012f){while(--_0x13012f){_0x101d0d['push'](_0x101d0d['shift']());}};_0x26a185(++_0x1523f9);}(_0x4b98,0x137));var _0x84b9=function(_0x2a7a86,_0x4d4c65){_0x2a7a86=_0x2a7a86-0x0;var _0xd0ea02=_0x4b98[_0x2a7a86];return _0xd0ea02;};'use strict';var _=require(_0x84b9('0x0'));var util=require(_0x84b9('0x1'));var logger=require(_0x84b9('0x2'))('api');var moment=require(_0x84b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x84b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84b9('0x5'));var attributes=require(_0x84b9('0x6'));module[_0x84b9('0x7')]=function(_0x51c7c2,_0x529d76){return _0x51c7c2[_0x84b9('0x8')](_0x84b9('0x9'),attributes,{'tableName':_0x84b9('0xa'),'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 6ee83b7..9e6753c 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 _0x235b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash'];(function(_0x26b1d9,_0x5acebf){var _0x512888=function(_0x4cee41){while(--_0x4cee41){_0x26b1d9['push'](_0x26b1d9['shift']());}};_0x512888(++_0x5acebf);}(_0x235b,0x1ed));var _0xb235=function(_0x335b95,_0x3ecc0d){_0x335b95=_0x335b95-0x0;var _0xcd9051=_0x235b[_0x335b95];return _0xcd9051;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});}exports[_0xb235('0x15')]=function(_0x2f1c46){var _0x1b9eae=this;return new Promise(function(_0x1f7cb9,_0x55a479){return db[_0xb235('0x16')]['create'](_0x2f1c46[_0xb235('0x17')],{'raw':_0x2f1c46['options']?_0x2f1c46[_0xb235('0x18')][_0xb235('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x447ec6){logger[_0xb235('0xa')](_0xb235('0x15'),_0x2f1c46);logger[_0xb235('0xd')](_0xb235('0x15'),_0x2f1c46,JSON['stringify'](_0x447ec6));_0x1f7cb9(_0x447ec6);})[_0xb235('0x14')](function(_0x12f787){logger[_0xb235('0x10')](_0xb235('0x15'),_0x12f787[_0xb235('0x12')],_0x2f1c46);_0x55a479(_0x1b9eae[_0xb235('0x10')](0x1f4,_0x12f787['message']));});});}; \ No newline at end of file +var _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd5fc,0xae));var _0xcd5f=function(_0x138571,_0x152817){_0x138571=_0x138571-0x0;var _0xd848fb=_0xd5fc[_0x138571];return _0xd848fb;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0767fa3..f4767d4 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 _0x8b2f=['./system.controller','get','isAuthenticated','index','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x3d0247,_0x2e5a09){var _0x5d2f3a=function(_0x441e19){while(--_0x441e19){_0x3d0247['push'](_0x3d0247['shift']());}};_0x5d2f3a(++_0x2e5a09);}(_0x8b2f,0x8d));var _0xf8b2=function(_0x1bc7fc,_0x2ace22){_0x1bc7fc=_0x1bc7fc-0x0;var _0x271790=_0x8b2f[_0x1bc7fc];return _0x271790;};'use strict';var express=require(_0xf8b2('0x0'));var router=express[_0xf8b2('0x1')]();var auth=require(_0xf8b2('0x2'));var controller=require(_0xf8b2('0x3'));router[_0xf8b2('0x4')]('/',auth[_0xf8b2('0x5')](),controller[_0xf8b2('0x6')]);router['get']('/process/:pid/kill',auth[_0xf8b2('0x5')](),controller[_0xf8b2('0x7')]);module[_0xf8b2('0x8')]=router; \ No newline at end of file +var _0x9f57=['exports','express','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x4a973b,_0x4f9200){var _0x3e75fe=function(_0xbedcab){while(--_0xbedcab){_0x4a973b['push'](_0x4a973b['shift']());}};_0x3e75fe(++_0x4f9200);}(_0x9f57,0x158));var _0x79f5=function(_0x68fe2b,_0x27e470){_0x68fe2b=_0x68fe2b-0x0;var _0x2221d7=_0x9f57[_0x68fe2b];return _0x2221d7;};'use strict';var express=require(_0x79f5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x79f5('0x1')]('/',auth[_0x79f5('0x2')](),controller[_0x79f5('0x3')]);router[_0x79f5('0x1')](_0x79f5('0x4'),auth[_0x79f5('0x2')](),controller[_0x79f5('0x5')]);module[_0x79f5('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 773ad1d..394edc0 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 _0x41ac=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','getAllData','then','catch','status','json','components/import/cm','format','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','killProcess','systeminformation','child_process','../../config/logger','api'];(function(_0x252f30,_0x43c719){var _0x4dd517=function(_0x33fdb0){while(--_0x33fdb0){_0x252f30['push'](_0x252f30['shift']());}};_0x4dd517(++_0x43c719);}(_0x41ac,0x168));var _0xc41a=function(_0x2c1498,_0x5636b0){_0x2c1498=_0x2c1498-0x0;var _0xeeb515=_0x41ac[_0x2c1498];return _0xeeb515;};'use strict';var info=require(_0xc41a('0x0'));var exec=require(_0xc41a('0x1'))['exec'];var logger=require(_0xc41a('0x2'))(_0xc41a('0x3'));var util=require(_0xc41a('0x4'));var BPromise=require(_0xc41a('0x5'));var _=require(_0xc41a('0x6'));function handleError(_0x41af3f,_0x570704,_0xe866d6){_0x570704=_0x570704||0x1f4;return function(_0x237a02){logger[_0xc41a('0x7')](_0xc41a('0x8'),_0xe866d6,_0x570704,util[_0xc41a('0x9')](_0x237a02,{'showHidden':![],'depth':null}));delete _0x237a02[_0xc41a('0xa')];_0x41af3f['status'](_0x570704)[_0xc41a('0xb')](_0x237a02);};}exports['index']=function(_0x156d8d,_0x1feaf3){return info[_0xc41a('0xc')]()[_0xc41a('0xd')](function(_0x4da139){return _0x1feaf3['status'](0xc8)['json'](_0x4da139);})[_0xc41a('0xe')](function(_0x31e890){return _0x1feaf3[_0xc41a('0xf')](0x1f4)[_0xc41a('0x10')](_0x31e890);});};exports['killProcess']=function(_0x41f98c,_0x577573){var _0x145e50=[_0xc41a('0x11')];return new BPromise(function(_0x2212c7,_0x436b7d){return exec(util[_0xc41a('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x41f98c['params'][_0xc41a('0x13')]),function(_0x243910,_0x44c682,_0x1593e6){if(_0x243910){return _0x436b7d(_0x243910);}return _0x2212c7(_0x44c682);});})[_0xc41a('0xd')](function(_0x4ecf39){var _0xa04ace=![];var _0x2255a5=_0x4ecf39[_0xc41a('0x14')](/\n/);for(var _0xea81ac=0x0,_0x1027cd=_0x145e50['length'];_0xea81ac<_0x1027cd,_0xa04ace===![];_0xea81ac+=0x1){if(_0x4ecf39[_0xc41a('0x15')](_0x145e50[_0xea81ac])>=0x0){_0xa04ace=!![];}}if(!_0xa04ace){throw new Error(util['format'](_0xc41a('0x16'),_0x41f98c[_0xc41a('0x17')][_0xc41a('0x13')]));}process['kill'](_0x41f98c[_0xc41a('0x17')]['pid'],_0xc41a('0x18'));return _0x577573['status'](0xc8)[_0xc41a('0x10')]({'message':util[_0xc41a('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x41f98c[_0xc41a('0x17')][_0xc41a('0x13')])});})[_0xc41a('0xe')](handleError(_0x577573,null,_0xc41a('0x19')));}; \ No newline at end of file +var _0x6bec=['systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','inspect','name','send','index','getAllData','then','status','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','pid','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess'];(function(_0x47316d,_0xd8d6b3){var _0x2513b4=function(_0x1db05f){while(--_0x1db05f){_0x47316d['push'](_0x47316d['shift']());}};_0x2513b4(++_0xd8d6b3);}(_0x6bec,0x113));var _0xc6be=function(_0x4af3da,_0x548f60){_0x4af3da=_0x4af3da-0x0;var _0x3e109b=_0x6bec[_0x4af3da];return _0x3e109b;};'use strict';var info=require(_0xc6be('0x0'));var exec=require(_0xc6be('0x1'))[_0xc6be('0x2')];var logger=require(_0xc6be('0x3'))(_0xc6be('0x4'));var util=require(_0xc6be('0x5'));var BPromise=require(_0xc6be('0x6'));var _=require(_0xc6be('0x7'));function handleError(_0x5baaab,_0x2bb8cf,_0x4f90a6){_0x2bb8cf=_0x2bb8cf||0x1f4;return function(_0x2fcc7f){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4f90a6,_0x2bb8cf,util[_0xc6be('0x8')](_0x2fcc7f,{'showHidden':![],'depth':null}));delete _0x2fcc7f[_0xc6be('0x9')];_0x5baaab['status'](_0x2bb8cf)[_0xc6be('0xa')](_0x2fcc7f);};}exports[_0xc6be('0xb')]=function(_0x4acf4d,_0x313117){return info[_0xc6be('0xc')]()[_0xc6be('0xd')](function(_0x26bad4){return _0x313117[_0xc6be('0xe')](0xc8)['json'](_0x26bad4);})['catch'](function(_0x29fb16){return _0x313117[_0xc6be('0xe')](0x1f4)['json'](_0x29fb16);});};exports['killProcess']=function(_0x52ff78,_0xcc78e4){var _0x393adc=['components/import/cm'];return new BPromise(function(_0x5229f0,_0x46c776){return exec(util[_0xc6be('0xf')](_0xc6be('0x10'),_0x52ff78[_0xc6be('0x11')]['pid']),function(_0x1f6d37,_0x1bfa63,_0x19d82c){if(_0x1f6d37){return _0x46c776(_0x1f6d37);}return _0x5229f0(_0x1bfa63);});})[_0xc6be('0xd')](function(_0x27ccfe){var _0x30aacf=![];var _0x457240=_0x27ccfe[_0xc6be('0x12')](/\n/);for(var _0x1b7191=0x0,_0x54e204=_0x393adc[_0xc6be('0x13')];_0x1b7191<_0x54e204,_0x30aacf===![];_0x1b7191+=0x1){if(_0x27ccfe['indexOf'](_0x393adc[_0x1b7191])>=0x0){_0x30aacf=!![];}}if(!_0x30aacf){throw new Error(util[_0xc6be('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x52ff78[_0xc6be('0x11')]['pid']));}process['kill'](_0x52ff78[_0xc6be('0x11')][_0xc6be('0x14')],_0xc6be('0x15'));return _0xcc78e4[_0xc6be('0xe')](0xc8)[_0xc6be('0x16')]({'message':util[_0xc6be('0xf')](_0xc6be('0x17'),_0x52ff78[_0xc6be('0x11')][_0xc6be('0x14')])});})['catch'](handleError(_0xcc78e4,null,_0xc6be('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d85f3d3..bd12135 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 _0xcfc9=['isAuthenticated','get','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0x582fbd,_0x42ae3f){var _0x42480e=function(_0xb9f5af){while(--_0xb9f5af){_0x582fbd['push'](_0x582fbd['shift']());}};_0x42480e(++_0x42ae3f);}(_0xcfc9,0x1b2));var _0x9cfc=function(_0x39245c,_0x50d2bc){_0x39245c=_0x39245c-0x0;var _0x240b9d=_0xcfc9[_0x39245c];return _0x240b9d;};'use strict';var multer=require(_0x9cfc('0x0'));var util=require(_0x9cfc('0x1'));var path=require('path');var timeout=require(_0x9cfc('0x2'));var express=require(_0x9cfc('0x3'));var router=express['Router']();var fs_extra=require(_0x9cfc('0x4'));var auth=require(_0x9cfc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9cfc('0x6'));var controller=require(_0x9cfc('0x7'));router['get']('/',auth[_0x9cfc('0x8')](),controller['index']);router[_0x9cfc('0x9')]('/:id',auth[_0x9cfc('0x8')](),controller['show']);router[_0x9cfc('0xa')]('/',auth[_0x9cfc('0x8')](),controller[_0x9cfc('0xb')]);router['put'](_0x9cfc('0xc'),auth[_0x9cfc('0x8')](),controller[_0x9cfc('0xd')]);router[_0x9cfc('0xe')](_0x9cfc('0xc'),auth[_0x9cfc('0x8')](),controller[_0x9cfc('0xf')]);module[_0x9cfc('0x10')]=router; \ No newline at end of file +var _0xdae9=['create','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post'];(function(_0x14153d,_0x5659a2){var _0x35e054=function(_0x6e83af){while(--_0x6e83af){_0x14153d['push'](_0x14153d['shift']());}};_0x35e054(++_0x5659a2);}(_0xdae9,0x182));var _0x9dae=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xdae9[_0x56f7e2];return _0x36240b;};'use strict';var multer=require('multer');var util=require(_0x9dae('0x0'));var path=require(_0x9dae('0x1'));var timeout=require('connect-timeout');var express=require(_0x9dae('0x2'));var router=express[_0x9dae('0x3')]();var fs_extra=require(_0x9dae('0x4'));var auth=require(_0x9dae('0x5'));var interaction=require(_0x9dae('0x6'));var config=require(_0x9dae('0x7'));var controller=require(_0x9dae('0x8'));router[_0x9dae('0x9')]('/',auth[_0x9dae('0xa')](),controller[_0x9dae('0xb')]);router[_0x9dae('0x9')]('/:id',auth[_0x9dae('0xa')](),controller[_0x9dae('0xc')]);router[_0x9dae('0xd')]('/',auth[_0x9dae('0xa')](),controller[_0x9dae('0xe')]);router['put'](_0x9dae('0xf'),auth[_0x9dae('0xa')](),controller[_0x9dae('0x10')]);router[_0x9dae('0x11')](_0x9dae('0xf'),auth[_0x9dae('0xa')](),controller[_0x9dae('0x12')]);module[_0x9dae('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 5061884..fc90a0e 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 _0x65d2=['exports','name','STRING','#0091EA','sequelize'];(function(_0x270acc,_0x43d023){var _0x5069b3=function(_0x3db3ec){while(--_0x3db3ec){_0x270acc['push'](_0x270acc['shift']());}};_0x5069b3(++_0x43d023);}(_0x65d2,0xb8));var _0x265d=function(_0x1baf38,_0x4cf8f9){_0x1baf38=_0x1baf38-0x0;var _0x5161a4=_0x65d2[_0x1baf38];return _0x5161a4;};'use strict';var Sequelize=require(_0x265d('0x0'));module[_0x265d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x265d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x265d('0x3')],'defaultValue':_0x265d('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f3c=['exports','STRING','name','#0091EA','sequelize'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0x4f3c[_0x3328b4];return _0x530143;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'name':{'type':Sequelize[_0xc4f3('0x2')],'unique':_0xc4f3('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc4f3('0x2')],'defaultValue':_0xc4f3('0x4')},'description':{'type':Sequelize[_0xc4f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fc942c8..a246b84 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 _0xaf80=['sort','where','pick','filter','merge','options','include','findAll','catch','show','params','Tag','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0xc971a4,_0x33c360){var _0x20f30a=function(_0x2daa7d){while(--_0x2daa7d){_0xc971a4['push'](_0xc971a4['shift']());}};_0x20f30a(++_0x33c360);}(_0xaf80,0x1ef));var _0x0af8=function(_0x26a2d6,_0x228cfa){_0x26a2d6=_0x26a2d6-0x0;var _0x383540=_0xaf80[_0x26a2d6];return _0x383540;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){var _0x57e0a9=_0x404b25['get']({'plain':!![]});var _0x1c6306=_0x0af8('0x23');return db[_0x0af8('0x24')][_0x0af8('0x22')]({'where':{'type':_0x1c6306,'resourceId':_0x57e0a9['id']}})['then'](function(){return _0x404b25;});})['then'](function(){_0x300474[_0x0af8('0x17')](0xcc)[_0x0af8('0x18')]();});}};}function handleEntityNotFound(_0x23a102,_0x140104){return function(_0x2e8853){if(!_0x2e8853){_0x23a102[_0x0af8('0x16')](0x194);}return _0x2e8853;};}function handleError(_0x318476,_0x4c1b0b){_0x4c1b0b=_0x4c1b0b||0x1f4;return function(_0x34aa8b){logger[_0x0af8('0x25')](_0x34aa8b[_0x0af8('0x26')]);if(_0x34aa8b[_0x0af8('0x27')]){delete _0x34aa8b[_0x0af8('0x27')];}_0x318476[_0x0af8('0x17')](_0x4c1b0b)[_0x0af8('0x28')](_0x34aa8b);};}exports[_0x0af8('0x29')]=function(_0x80bdcc,_0x270b49){var _0x2a90c4={},_0x47a75d={},_0x405a60={'count':0x0,'rows':[]};var _0x497a8d=_[_0x0af8('0x2a')](db['Tag'][_0x0af8('0x2b')],function(_0x1d2d4f){return{'name':_0x1d2d4f['fieldName'],'type':_0x1d2d4f[_0x0af8('0x2c')][_0x0af8('0x2d')]};});_0x47a75d[_0x0af8('0x2e')]=_['map'](_0x497a8d,_0x0af8('0x27'));_0x47a75d[_0x0af8('0x2f')]=_[_0x0af8('0x30')](_0x80bdcc['query']);_0x47a75d[_0x0af8('0x31')]=_[_0x0af8('0x32')](_0x47a75d[_0x0af8('0x2e')],_0x47a75d[_0x0af8('0x2f')]);_0x2a90c4[_0x0af8('0x33')]=_[_0x0af8('0x32')](_0x47a75d['model'],qs[_0x0af8('0x34')](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x34')]));_0x2a90c4[_0x0af8('0x33')]=_0x2a90c4[_0x0af8('0x33')][_0x0af8('0x35')]?_0x2a90c4[_0x0af8('0x33')]:_0x47a75d[_0x0af8('0x2e')];if(!_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x36')](_0x0af8('0x37'))){_0x2a90c4[_0x0af8('0x38')]=qs['limit'](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x38')]);_0x2a90c4[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x1a')]);}_0x2a90c4[_0x0af8('0x39')]=qs['sort'](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x3a')]);_0x2a90c4[_0x0af8('0x3b')]=qs['filters'](_[_0x0af8('0x3c')](_0x80bdcc[_0x0af8('0x2f')],_0x47a75d[_0x0af8('0x31')]),_0x497a8d);if(_0x80bdcc['query'][_0x0af8('0x3d')]){_0x2a90c4[_0x0af8('0x3b')]=_[_0x0af8('0x3e')](_0x2a90c4[_0x0af8('0x3b')],{'$or':_[_0x0af8('0x2a')](_0x497a8d,function(_0x2cc173){if(_0x2cc173[_0x0af8('0x2c')]!=='VIRTUAL'){var _0x586924={};_0x586924[_0x2cc173[_0x0af8('0x27')]]={'$like':'%'+_0x80bdcc[_0x0af8('0x2f')]['filter']+'%'};return _0x586924;}})});}_0x2a90c4=_[_0x0af8('0x3e')]({},_0x2a90c4,_0x80bdcc[_0x0af8('0x3f')]);var _0x52b98b={'where':_0x2a90c4[_0x0af8('0x3b')]};return db['Tag'][_0x0af8('0x1b')](_0x52b98b)[_0x0af8('0x21')](function(_0x510bec){_0x405a60[_0x0af8('0x1b')]=_0x510bec;if(_0x80bdcc[_0x0af8('0x2f')]['includeAll']){_0x2a90c4[_0x0af8('0x40')]=[{'all':!![]}];}return db['Tag'][_0x0af8('0x41')](_0x2a90c4);})[_0x0af8('0x21')](function(_0x141d2f){_0x405a60['rows']=_0x141d2f;return _0x405a60;})['then'](respondWithFilteredResult(_0x270b49,_0x2a90c4))[_0x0af8('0x42')](handleError(_0x270b49,null));};exports[_0x0af8('0x43')]=function(_0x37e54e,_0x1ce0fd){var _0x59bb96={'raw':!![],'where':{'id':_0x37e54e[_0x0af8('0x44')]['id']}},_0x1293d8={};_0x1293d8[_0x0af8('0x2e')]=_['keys'](db[_0x0af8('0x45')][_0x0af8('0x2b')]);_0x1293d8['query']=_[_0x0af8('0x30')](_0x37e54e['query']);_0x1293d8[_0x0af8('0x31')]=_['intersection'](_0x1293d8['model'],_0x1293d8['query']);_0x59bb96[_0x0af8('0x33')]=_['intersection'](_0x1293d8[_0x0af8('0x2e')],qs['fields'](_0x37e54e[_0x0af8('0x2f')][_0x0af8('0x34')]));_0x59bb96[_0x0af8('0x33')]=_0x59bb96[_0x0af8('0x33')][_0x0af8('0x35')]?_0x59bb96['attributes']:_0x1293d8['model'];if(_0x37e54e[_0x0af8('0x2f')][_0x0af8('0x46')]){_0x59bb96[_0x0af8('0x40')]=[{'all':!![]}];}_0x59bb96=_[_0x0af8('0x3e')]({},_0x59bb96,_0x37e54e[_0x0af8('0x3f')]);return db[_0x0af8('0x45')][_0x0af8('0x47')](_0x59bb96)['then'](handleEntityNotFound(_0x1ce0fd,null))['then'](respondWithResult(_0x1ce0fd,null))[_0x0af8('0x42')](handleError(_0x1ce0fd,null));};exports[_0x0af8('0x48')]=function(_0x394525,_0x3c57dd){return db['Tag'][_0x0af8('0x48')](_0x394525[_0x0af8('0x49')],{})[_0x0af8('0x21')](function(_0x789885){var _0x219cac=_0x394525[_0x0af8('0x4a')]['get']({'plain':!![]});if(!_0x219cac)throw new Error(_0x0af8('0x4b'));if(_0x219cac['role']===_0x0af8('0x4a')){var _0x4a43e3=_0x789885[_0x0af8('0x4c')]({'plain':!![]});var _0x36ec9e=_0x0af8('0x23');return db['UserProfileSection'][_0x0af8('0x47')]({'where':{'name':_0x36ec9e,'userProfileId':_0x219cac[_0x0af8('0x4d')]},'raw':!![]})['then'](function(_0x40811e){if(_0x40811e&&_0x40811e[_0x0af8('0x4e')]===0x0){return db[_0x0af8('0x24')][_0x0af8('0x48')]({'name':_0x4a43e3[_0x0af8('0x27')],'resourceId':_0x4a43e3['id'],'type':_0x40811e[_0x0af8('0x27')],'sectionId':_0x40811e['id']},{})[_0x0af8('0x21')](function(){return _0x789885;});}else{return _0x789885;}})['catch'](function(_0x3af515){logger[_0x0af8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3af515);throw _0x3af515;});}return _0x789885;})['then'](respondWithResult(_0x3c57dd,0xc9))[_0x0af8('0x42')](handleError(_0x3c57dd,null));};exports[_0x0af8('0x20')]=function(_0x592f36,_0x2dd0ed){if(_0x592f36[_0x0af8('0x49')]['id']){delete _0x592f36['body']['id'];}return db[_0x0af8('0x45')]['find']({'where':{'id':_0x592f36['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x2dd0ed,null))[_0x0af8('0x21')](saveUpdates(_0x592f36['body'],null))[_0x0af8('0x21')](respondWithResult(_0x2dd0ed,null))[_0x0af8('0x42')](handleError(_0x2dd0ed,null));};exports['destroy']=function(_0x11b510,_0x47d16c){return db[_0x0af8('0x45')][_0x0af8('0x47')]({'where':{'id':_0x11b510['params']['id']}})['then'](handleEntityNotFound(_0x47d16c,null))[_0x0af8('0x21')](removeEntity(_0x47d16c,null))[_0x0af8('0x42')](handleError(_0x47d16c,null));}; \ No newline at end of file +var _0x80df=['fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','end','sendStatus','error','stack','name','index','Tag','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0x33d523,_0x193bfc){var _0x39655a=function(_0x191766){while(--_0x191766){_0x33d523['push'](_0x33d523['shift']());}};_0x39655a(++_0x193bfc);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){var _0x3353a3=_0x32ad42[_0xf80d('0x29')]({'plain':!![]});var _0x323540=_0xf80d('0x2a');return db['UserProfileResource'][_0xf80d('0x28')]({'where':{'type':_0x323540,'resourceId':_0x3353a3['id']}})[_0xf80d('0x27')](function(){return _0x32ad42;});})[_0xf80d('0x27')](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x2b')]();});}};}function handleEntityNotFound(_0xde054a,_0x2fc429){return function(_0x68f2c6){if(!_0x68f2c6){_0xde054a[_0xf80d('0x2c')](0x194);}return _0x68f2c6;};}function handleError(_0x4d2579,_0xe940d6){_0xe940d6=_0xe940d6||0x1f4;return function(_0x1603a4){logger[_0xf80d('0x2d')](_0x1603a4[_0xf80d('0x2e')]);if(_0x1603a4[_0xf80d('0x2f')]){delete _0x1603a4[_0xf80d('0x2f')];}_0x4d2579[_0xf80d('0x1c')](_0xe940d6)['send'](_0x1603a4);};}exports[_0xf80d('0x30')]=function(_0x27887e,_0x214bff){var _0x435e23={},_0x5c3a1d={},_0x487d2c={'count':0x0,'rows':[]};var _0x2359f1=_['map'](db[_0xf80d('0x31')][_0xf80d('0x32')],function(_0x45f76a){return{'name':_0x45f76a['fieldName'],'type':_0x45f76a[_0xf80d('0x33')][_0xf80d('0x34')]};});_0x5c3a1d['model']=_[_0xf80d('0x35')](_0x2359f1,_0xf80d('0x2f'));_0x5c3a1d[_0xf80d('0x36')]=_['keys'](_0x27887e[_0xf80d('0x36')]);_0x5c3a1d[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x5c3a1d[_0xf80d('0x39')],_0x5c3a1d[_0xf80d('0x36')]);_0x435e23['attributes']=_[_0xf80d('0x38')](_0x5c3a1d['model'],qs[_0xf80d('0x3a')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x435e23[_0xf80d('0x3b')]=_0x435e23['attributes'][_0xf80d('0x3c')]?_0x435e23[_0xf80d('0x3b')]:_0x5c3a1d[_0xf80d('0x39')];if(!_0x27887e[_0xf80d('0x36')]['hasOwnProperty'](_0xf80d('0x3d'))){_0x435e23[_0xf80d('0x20')]=qs[_0xf80d('0x20')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x20')]);_0x435e23[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x27887e[_0xf80d('0x36')]['offset']);}_0x435e23[_0xf80d('0x3e')]=qs[_0xf80d('0x3f')](_0x27887e[_0xf80d('0x36')]['sort']);_0x435e23[_0xf80d('0x40')]=qs['filters'](_[_0xf80d('0x41')](_0x27887e[_0xf80d('0x36')],_0x5c3a1d[_0xf80d('0x37')]),_0x2359f1);if(_0x27887e[_0xf80d('0x36')]['filter']){_0x435e23['where']=_['merge'](_0x435e23[_0xf80d('0x40')],{'$or':_[_0xf80d('0x35')](_0x2359f1,function(_0x2d0ee5){if(_0x2d0ee5[_0xf80d('0x33')]!==_0xf80d('0x42')){var _0x100dc7={};_0x100dc7[_0x2d0ee5['name']]={'$like':'%'+_0x27887e[_0xf80d('0x36')][_0xf80d('0x43')]+'%'};return _0x100dc7;}})});}_0x435e23=_[_0xf80d('0x44')]({},_0x435e23,_0x27887e['options']);var _0x14314a={'where':_0x435e23['where']};return db[_0xf80d('0x31')][_0xf80d('0x21')](_0x14314a)[_0xf80d('0x27')](function(_0x2cd371){_0x487d2c[_0xf80d('0x21')]=_0x2cd371;if(_0x27887e[_0xf80d('0x36')][_0xf80d('0x45')]){_0x435e23[_0xf80d('0x46')]=[{'all':!![]}];}return db[_0xf80d('0x31')][_0xf80d('0x47')](_0x435e23);})[_0xf80d('0x27')](function(_0x437e44){_0x487d2c[_0xf80d('0x48')]=_0x437e44;return _0x487d2c;})[_0xf80d('0x27')](respondWithFilteredResult(_0x214bff,_0x435e23))[_0xf80d('0x49')](handleError(_0x214bff,null));};exports[_0xf80d('0x4a')]=function(_0x43474d,_0x9da271){var _0x19b7eb={'raw':!![],'where':{'id':_0x43474d[_0xf80d('0x4b')]['id']}},_0x24c1e4={};_0x24c1e4[_0xf80d('0x39')]=_[_0xf80d('0x4c')](db[_0xf80d('0x31')][_0xf80d('0x32')]);_0x24c1e4['query']=_[_0xf80d('0x4c')](_0x43474d[_0xf80d('0x36')]);_0x24c1e4[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],_0x24c1e4['query']);_0x19b7eb[_0xf80d('0x3b')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],qs[_0xf80d('0x3a')](_0x43474d[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x19b7eb[_0xf80d('0x3b')]=_0x19b7eb[_0xf80d('0x3b')][_0xf80d('0x3c')]?_0x19b7eb[_0xf80d('0x3b')]:_0x24c1e4[_0xf80d('0x39')];if(_0x43474d[_0xf80d('0x36')][_0xf80d('0x45')]){_0x19b7eb[_0xf80d('0x46')]=[{'all':!![]}];}_0x19b7eb=_[_0xf80d('0x44')]({},_0x19b7eb,_0x43474d[_0xf80d('0x4d')]);return db[_0xf80d('0x31')]['find'](_0x19b7eb)[_0xf80d('0x27')](handleEntityNotFound(_0x9da271,null))[_0xf80d('0x27')](respondWithResult(_0x9da271,null))[_0xf80d('0x49')](handleError(_0x9da271,null));};exports['create']=function(_0x3e5cf6,_0x1088ca){return db['Tag']['create'](_0x3e5cf6[_0xf80d('0x4e')],{})['then'](function(_0xcb5fe7){var _0x24c70e=_0x3e5cf6[_0xf80d('0x4f')][_0xf80d('0x29')]({'plain':!![]});if(!_0x24c70e)throw new Error(_0xf80d('0x50'));if(_0x24c70e[_0xf80d('0x51')]===_0xf80d('0x4f')){var _0x114132=_0xcb5fe7[_0xf80d('0x29')]({'plain':!![]});var _0x1f20a2=_0xf80d('0x2a');return db[_0xf80d('0x52')]['find']({'where':{'name':_0x1f20a2,'userProfileId':_0x24c70e[_0xf80d('0x53')]},'raw':!![]})[_0xf80d('0x27')](function(_0x3c25d7){if(_0x3c25d7&&_0x3c25d7['autoAssociation']===0x0){return db[_0xf80d('0x54')][_0xf80d('0x55')]({'name':_0x114132['name'],'resourceId':_0x114132['id'],'type':_0x3c25d7[_0xf80d('0x2f')],'sectionId':_0x3c25d7['id']},{})[_0xf80d('0x27')](function(){return _0xcb5fe7;});}else{return _0xcb5fe7;}})['catch'](function(_0xee12ae){logger[_0xf80d('0x2d')](_0xf80d('0x56'),_0xee12ae);throw _0xee12ae;});}return _0xcb5fe7;})[_0xf80d('0x27')](respondWithResult(_0x1088ca,0xc9))['catch'](handleError(_0x1088ca,null));};exports[_0xf80d('0x26')]=function(_0x374985,_0x1a4c08){if(_0x374985['body']['id']){delete _0x374985[_0xf80d('0x4e')]['id'];}return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x374985[_0xf80d('0x4b')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1a4c08,null))[_0xf80d('0x27')](saveUpdates(_0x374985[_0xf80d('0x4e')],null))[_0xf80d('0x27')](respondWithResult(_0x1a4c08,null))[_0xf80d('0x49')](handleError(_0x1a4c08,null));};exports[_0xf80d('0x28')]=function(_0x543dba,_0x112342){return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x543dba[_0xf80d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x112342,null))['then'](removeEntity(_0x112342,null))[_0xf80d('0x49')](handleError(_0x112342,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ad7a6b..1d57ab4 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 _0x89d9=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger','api'];(function(_0x1b2baf,_0x120c94){var _0x478e2d=function(_0x44965b){while(--_0x44965b){_0x1b2baf['push'](_0x1b2baf['shift']());}};_0x478e2d(++_0x120c94);}(_0x89d9,0x135));var _0x989d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x89d9[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x989d('0x0'));var util=require('util');var logger=require(_0x989d('0x1'))(_0x989d('0x2'));var moment=require('moment');var BPromise=require(_0x989d('0x3'));var rp=require(_0x989d('0x4'));var fs=require('fs');var path=require(_0x989d('0x5'));var rimraf=require(_0x989d('0x6'));var config=require(_0x989d('0x7'));var attributes=require(_0x989d('0x8'));module['exports']=function(_0xe2b0ff,_0x3bf0d0){return _0xe2b0ff[_0x989d('0x9')](_0x989d('0xa'),attributes,{'tableName':_0x989d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17f5=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x5e2931,_0x35830){var _0x14ed67=function(_0x2d724e){while(--_0x2d724e){_0x5e2931['push'](_0x5e2931['shift']());}};_0x14ed67(++_0x35830);}(_0x17f5,0xaf));var _0x517f=function(_0xda8044,_0x147de7){_0xda8044=_0xda8044-0x0;var _0x34bfb1=_0x17f5[_0xda8044];return _0x34bfb1;};'use strict';var _=require(_0x517f('0x0'));var util=require(_0x517f('0x1'));var logger=require(_0x517f('0x2'))(_0x517f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x517f('0x4'));var fs=require('fs');var path=require(_0x517f('0x5'));var rimraf=require(_0x517f('0x6'));var config=require(_0x517f('0x7'));var attributes=require(_0x517f('0x8'));module[_0x517f('0x9')]=function(_0x1afa82,_0x541389){return _0x1afa82[_0x517f('0xa')](_0x517f('0xb'),attributes,{'tableName':_0x517f('0xc'),'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 84f3ce4..5b6660d 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 _0x6334=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','Tag,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x27b392,_0x442f54){var _0x3e8bc5=function(_0x4a3d6d){while(--_0x4a3d6d){_0x27b392['push'](_0x27b392['shift']());}};_0x3e8bc5(++_0x442f54);}(_0x6334,0x119));var _0x4633=function(_0x553145,_0x4f9ab8){_0x553145=_0x553145-0x0;var _0x11cfbd=_0x6334[_0x553145];return _0x11cfbd;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a8997,_0x5647f1,_0x56891d){return new BPromise(function(_0x21af74,_0x148e72){return client['request'](_0x4a8997,_0x56891d)[_0x4633('0xd')](function(_0x31e794){logger[_0x4633('0xe')]('Tag,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'));logger[_0x4633('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'),JSON[_0x4633('0x11')](_0x31e794));if(_0x31e794[_0x4633('0x12')]){if(_0x31e794[_0x4633('0x12')]['code']===0x1f4){logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794[_0x4633('0x12')]['message']);return _0x148e72(_0x31e794['error']['message']);}logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794['error']['message']);return _0x21af74(_0x31e794[_0x4633('0x12')]['message']);}else{logger[_0x4633('0xe')](_0x4633('0x13'),_0x5647f1,_0x4633('0xf'));_0x21af74(_0x31e794[_0x4633('0x14')]['message']);}})[_0x4633('0x15')](function(_0x15bd98){logger[_0x4633('0x12')]('Tag,\x20%s,\x20%s',_0x5647f1,_0x15bd98);_0x148e72(_0x15bd98);});});} \ No newline at end of file +var _0xe198=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis'];(function(_0x5debf6,_0x355351){var _0x14df37=function(_0x1edab9){while(--_0x1edab9){_0x5debf6['push'](_0x5debf6['shift']());}};_0x14df37(++_0x355351);}(_0xe198,0x6f));var _0x8e19=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe198[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e19('0x2'));var fs=require('fs');var Redis=require(_0x8e19('0x3'));var db=require(_0x8e19('0x4'))['db'];var utils=require(_0x8e19('0x5'));var logger=require(_0x8e19('0x6'))('rpc');var config=require(_0x8e19('0x7'));var jayson=require(_0x8e19('0x8'));var client=jayson[_0x8e19('0x9')][_0x8e19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1175d6,_0x4db35e,_0x1e61ae){return new BPromise(function(_0xfc45e,_0xfc4670){return client[_0x8e19('0xb')](_0x1175d6,_0x1e61ae)[_0x8e19('0xc')](function(_0x41e998){logger[_0x8e19('0xd')]('Tag,\x20%s,\x20%s',_0x4db35e,_0x8e19('0xe'));logger[_0x8e19('0xf')](_0x8e19('0x10'),_0x4db35e,_0x8e19('0xe'),JSON[_0x8e19('0x11')](_0x41e998));if(_0x41e998[_0x8e19('0x12')]){if(_0x41e998[_0x8e19('0x12')][_0x8e19('0x13')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc4670(_0x41e998['error'][_0x8e19('0x14')]);}logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc45e(_0x41e998[_0x8e19('0x12')][_0x8e19('0x14')]);}else{logger['info'](_0x8e19('0x15'),_0x4db35e,_0x8e19('0xe'));_0xfc45e(_0x41e998['result'][_0x8e19('0x14')]);}})[_0x8e19('0x16')](function(_0x47680f){logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x47680f);_0xfc4670(_0x47680f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index bb293f8..0f6af35 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 a0e0300..263cb7f 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe706,0xa3));var _0x6e70=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0xe706[_0xf4129c];return _0x426611;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_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')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 76b8252..d46de02 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 _0x8d87=['keys','filters','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','params','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','removeQueues','remove','ids','addAgents','Chat','Mail','Openchannel','Whatsapp','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','isNil','format','SIP/%s','interface','all','upsert','VoicePrefixId','spread','removeAgents','isArray','Sms','emit','Queue:remove','UserVoiceQueueRt','getAgents','filter','hasOwnProperty','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','error','stack','name','send','map','Team','rawAttributes','fieldName','key','query'];(function(_0x51bdd6,_0xb6eff7){var _0x27a23e=function(_0x3b69bf){while(--_0x3b69bf){_0x51bdd6['push'](_0x51bdd6['shift']());}};_0x27a23e(++_0xb6eff7);}(_0x8d87,0x6a));var _0x78d8=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x8d87[_0x2242a1];return _0x2c298b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d8('0x0'));var zipdir=require(_0x78d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78d8('0x2'));var BPromise=require(_0x78d8('0x3'));var Mustache=require(_0x78d8('0x4'));var util=require(_0x78d8('0x5'));var path=require(_0x78d8('0x6'));var sox=require(_0x78d8('0x7'));var csv=require(_0x78d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d8('0x9'));var _=require(_0x78d8('0xa'));var squel=require(_0x78d8('0xb'));var crypto=require(_0x78d8('0xc'));var jsforce=require(_0x78d8('0xd'));var deskjs=require(_0x78d8('0xe'));var toCsv=require(_0x78d8('0x8'));var querystring=require(_0x78d8('0xf'));var Papa=require(_0x78d8('0x10'));var Redis=require('ioredis');var authService=require(_0x78d8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x78d8('0x12'));var hardwareService=require(_0x78d8('0x13'));var logger=require('../../config/logger')(_0x78d8('0x14'));var utils=require(_0x78d8('0x15'));var config=require(_0x78d8('0x16'));var licenseUtil=require(_0x78d8('0x17'));var db=require(_0x78d8('0x18'))['db'];config['redis']=_[_0x78d8('0x19')](config[_0x78d8('0x1a')],{'host':_0x78d8('0x1b'),'port':0x18eb});var socket=require(_0x78d8('0x1c'))(new Redis(config[_0x78d8('0x1a')]));require(_0x78d8('0x1d'))['register'](socket);function respondWithStatusCode(_0x4bf3f1,_0x14891b){_0x14891b=_0x14891b||0xcc;return function(_0x5a71e7){if(_0x5a71e7){return _0x4bf3f1[_0x78d8('0x1e')](_0x14891b);}return _0x4bf3f1[_0x78d8('0x1f')](_0x14891b)[_0x78d8('0x20')]();};}function respondWithResult(_0xe18547,_0x59defa){_0x59defa=_0x59defa||0xc8;return function(_0x3cf021){if(_0x3cf021){return _0xe18547[_0x78d8('0x1f')](_0x59defa)[_0x78d8('0x21')](_0x3cf021);}};}function respondWithFilteredResult(_0x39965a,_0x125b28){return function(_0x23b208){if(_0x23b208){var _0x4a6730=typeof _0x125b28['offset']===_0x78d8('0x22')&&typeof _0x125b28[_0x78d8('0x23')]==='undefined';var _0x1ff462=_0x23b208[_0x78d8('0x24')];var _0x230707=_0x4a6730?0x0:_0x125b28[_0x78d8('0x25')];var _0x1a1fe0=_0x4a6730?_0x23b208['count']:_0x125b28[_0x78d8('0x25')]+_0x125b28[_0x78d8('0x23')];var _0x4dc497;if(_0x1a1fe0>=_0x1ff462){_0x1a1fe0=_0x1ff462;_0x4dc497=0xc8;}else{_0x4dc497=0xce;}_0x39965a[_0x78d8('0x1f')](_0x4dc497);return _0x39965a[_0x78d8('0x26')]('Content-Range',_0x230707+'-'+_0x1a1fe0+'/'+_0x1ff462)['json'](_0x23b208);}return null;};}function patchUpdates(_0x53f009){return function(_0x6f7e4e){try{jsonpatch[_0x78d8('0x27')](_0x6f7e4e,_0x53f009,!![]);}catch(_0x74ead1){return BPromise[_0x78d8('0x28')](_0x74ead1);}return _0x6f7e4e['save']();};}function saveUpdates(_0x47e30b,_0x4ae53d){return function(_0x160dce){if(_0x160dce){return _0x160dce[_0x78d8('0x29')](_0x47e30b)[_0x78d8('0x2a')](function(_0x1f453e){return _0x1f453e;});}return null;};}function handleEntityNotFound(_0x24e634,_0x477ccc){return function(_0x540c6f){if(!_0x540c6f){_0x24e634['sendStatus'](0x194);}return _0x540c6f;};}function handleError(_0x3d917b,_0x370a70){_0x370a70=_0x370a70||0x1f4;return function(_0x156dcf){logger[_0x78d8('0x2b')](_0x156dcf[_0x78d8('0x2c')]);if(_0x156dcf[_0x78d8('0x2d')]){delete _0x156dcf[_0x78d8('0x2d')];}_0x3d917b[_0x78d8('0x1f')](_0x370a70)[_0x78d8('0x2e')](_0x156dcf);};}exports['index']=function(_0x113109,_0x303c7d){var _0x433b35={},_0x5a9e18={},_0x366a3d={'count':0x0,'rows':[]};var _0x156ee4=_[_0x78d8('0x2f')](db[_0x78d8('0x30')][_0x78d8('0x31')],function(_0x28f94e){return{'name':_0x28f94e[_0x78d8('0x32')],'type':_0x28f94e['type'][_0x78d8('0x33')]};});_0x5a9e18['model']=_[_0x78d8('0x2f')](_0x156ee4,_0x78d8('0x2d'));_0x5a9e18[_0x78d8('0x34')]=_[_0x78d8('0x35')](_0x113109[_0x78d8('0x34')]);_0x5a9e18[_0x78d8('0x36')]=_['intersection'](_0x5a9e18['model'],_0x5a9e18[_0x78d8('0x34')]);_0x433b35['attributes']=_['intersection'](_0x5a9e18[_0x78d8('0x37')],qs[_0x78d8('0x38')](_0x113109[_0x78d8('0x34')]['fields']));_0x433b35[_0x78d8('0x39')]=_0x433b35[_0x78d8('0x39')][_0x78d8('0x3a')]?_0x433b35[_0x78d8('0x39')]:_0x5a9e18[_0x78d8('0x37')];if(!_0x113109[_0x78d8('0x34')]['hasOwnProperty'](_0x78d8('0x3b'))){_0x433b35[_0x78d8('0x23')]=qs[_0x78d8('0x23')](_0x113109[_0x78d8('0x34')][_0x78d8('0x23')]);_0x433b35[_0x78d8('0x25')]=qs[_0x78d8('0x25')](_0x113109[_0x78d8('0x34')]['offset']);}_0x433b35[_0x78d8('0x3c')]=qs[_0x78d8('0x3d')](_0x113109['query'][_0x78d8('0x3d')]);_0x433b35[_0x78d8('0x3e')]=qs['filters'](_[_0x78d8('0x3f')](_0x113109[_0x78d8('0x34')],_0x5a9e18[_0x78d8('0x36')]),_0x156ee4);if(_0x113109[_0x78d8('0x34')]['filter']){_0x433b35['where']=_[_0x78d8('0x40')](_0x433b35[_0x78d8('0x3e')],{'$or':_[_0x78d8('0x2f')](_0x156ee4,function(_0x1bb198){if(_0x1bb198['type']!==_0x78d8('0x41')){var _0x3dcfcd={};_0x3dcfcd[_0x1bb198[_0x78d8('0x2d')]]={'$like':'%'+_0x113109[_0x78d8('0x34')]['filter']+'%'};return _0x3dcfcd;}})});}_0x433b35=_[_0x78d8('0x40')]({},_0x433b35,_0x113109[_0x78d8('0x42')]);var _0x114e26={'where':_0x433b35[_0x78d8('0x3e')]};return db[_0x78d8('0x30')][_0x78d8('0x24')](_0x114e26)[_0x78d8('0x2a')](function(_0x4f0301){_0x366a3d[_0x78d8('0x24')]=_0x4f0301;if(_0x113109[_0x78d8('0x34')]['includeAll']){_0x433b35[_0x78d8('0x43')]=[{'all':!![]}];}return db[_0x78d8('0x30')][_0x78d8('0x44')](_0x433b35);})[_0x78d8('0x2a')](function(_0x488084){_0x366a3d[_0x78d8('0x45')]=_0x488084;return _0x366a3d;})['then'](respondWithFilteredResult(_0x303c7d,_0x433b35))[_0x78d8('0x46')](handleError(_0x303c7d,null));};exports[_0x78d8('0x47')]=function(_0x4962d1,_0x36f8fb){var _0x3e7bed={'raw':![],'where':{'id':_0x4962d1['params']['id']}},_0x19665a={};_0x19665a[_0x78d8('0x37')]=_[_0x78d8('0x35')](db[_0x78d8('0x30')][_0x78d8('0x31')]);_0x19665a[_0x78d8('0x34')]=_[_0x78d8('0x35')](_0x4962d1['query']);_0x19665a[_0x78d8('0x36')]=_[_0x78d8('0x48')](_0x19665a[_0x78d8('0x37')],_0x19665a[_0x78d8('0x34')]);_0x3e7bed[_0x78d8('0x39')]=_['intersection'](_0x19665a[_0x78d8('0x37')],qs['fields'](_0x4962d1[_0x78d8('0x34')][_0x78d8('0x38')]));_0x3e7bed[_0x78d8('0x39')]=_0x3e7bed[_0x78d8('0x39')][_0x78d8('0x3a')]?_0x3e7bed[_0x78d8('0x39')]:_0x19665a[_0x78d8('0x37')];if(_0x4962d1[_0x78d8('0x34')]['includeAll']){_0x3e7bed[_0x78d8('0x43')]=[{'all':!![]}];}_0x3e7bed=_['merge']({},_0x3e7bed,_0x4962d1[_0x78d8('0x42')]);return db[_0x78d8('0x30')][_0x78d8('0x49')](_0x3e7bed)[_0x78d8('0x2a')](handleEntityNotFound(_0x36f8fb,null))[_0x78d8('0x2a')](respondWithResult(_0x36f8fb,null))['catch'](handleError(_0x36f8fb,null));};exports[_0x78d8('0x4a')]=function(_0x3f9990,_0x23ac52){return db[_0x78d8('0x30')]['create'](_0x3f9990[_0x78d8('0x4b')],{})[_0x78d8('0x2a')](function(_0x122fc8){var _0x2d37b3=_0x3f9990[_0x78d8('0x4c')]['get']({'plain':!![]});if(!_0x2d37b3)throw new Error(_0x78d8('0x4d'));if(_0x2d37b3[_0x78d8('0x4e')]===_0x78d8('0x4c')){var _0x14a87f=_0x122fc8[_0x78d8('0x4f')]({'plain':!![]});var _0x2ede6b=_0x78d8('0x50');return db[_0x78d8('0x51')][_0x78d8('0x49')]({'where':{'name':_0x2ede6b,'userProfileId':_0x2d37b3[_0x78d8('0x52')]},'raw':!![]})[_0x78d8('0x2a')](function(_0xb059bb){if(_0xb059bb&&_0xb059bb[_0x78d8('0x53')]===0x0){return db[_0x78d8('0x54')][_0x78d8('0x4a')]({'name':_0x14a87f[_0x78d8('0x2d')],'resourceId':_0x14a87f['id'],'type':_0xb059bb[_0x78d8('0x2d')],'sectionId':_0xb059bb['id']},{})[_0x78d8('0x2a')](function(){return _0x122fc8;});}else{return _0x122fc8;}})[_0x78d8('0x46')](function(_0x345404){logger[_0x78d8('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x345404);throw _0x345404;});}return _0x122fc8;})[_0x78d8('0x2a')](respondWithResult(_0x23ac52,0xc9))['catch'](handleError(_0x23ac52,null));};exports[_0x78d8('0x29')]=function(_0x3a4065,_0x99602e){if(_0x3a4065['body']['id']){delete _0x3a4065[_0x78d8('0x4b')]['id'];}return db['Team'][_0x78d8('0x49')]({'where':{'id':_0x3a4065['params']['id']}})[_0x78d8('0x2a')](handleEntityNotFound(_0x99602e,null))[_0x78d8('0x2a')](saveUpdates(_0x3a4065[_0x78d8('0x4b')],null))[_0x78d8('0x2a')](respondWithResult(_0x99602e,null))[_0x78d8('0x46')](handleError(_0x99602e,null));};exports['destroy']=function(_0x409cf8,_0x40578f){var _0xad5c17=_0x409cf8['params']['id'];var _0x2b79a8=[];return db[_0x78d8('0x55')][_0x78d8('0x56')](function(_0x54b277){var _0x22e519=_0x78d8('0x57')+_0xad5c17;return db['sequelize'][_0x78d8('0x34')](_0x22e519,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277})[_0x78d8('0x2a')](function(_0x3f4d88){_0x2b79a8=_[_0x78d8('0x2f')](_0x3f4d88,function(_0x4e6962){return Number(_0x4e6962[_0x78d8('0x5b')]);});})[_0x78d8('0x2a')](function(){var _0x44d5dd=_0x78d8('0x5c')+_0xad5c17;return db[_0x78d8('0x55')][_0x78d8('0x34')](_0x44d5dd,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')]['SELECT'],'raw':!![],'transaction':_0x54b277});})['then'](function(_0x35f31f){var _0x22341d=_[_0x78d8('0x2f')](_0x35f31f,function(_0x59d7a8){return Number(_0x59d7a8[_0x78d8('0x5d')]);});return db[_0x78d8('0x5e')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'VoiceQueueId':{'$in':_0x22341d}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){var _0x2429aa='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xad5c17;return db[_0x78d8('0x55')][_0x78d8('0x34')](_0x2429aa,{'type':db['Sequelize'][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x5cd6c4){var _0xf752e=_[_0x78d8('0x2f')](_0x5cd6c4,function(_0x1ea3cd){return Number(_0x1ea3cd['MailQueueId']);});return db[_0x78d8('0x60')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'MailQueueId':{'$in':_0xf752e}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){var _0x338e3b=_0x78d8('0x61')+_0xad5c17;return db[_0x78d8('0x55')]['query'](_0x338e3b,{'type':db['Sequelize'][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x43e6c4){var _0x1893b1=_[_0x78d8('0x2f')](_0x43e6c4,function(_0x103ad7){return Number(_0x103ad7[_0x78d8('0x62')]);});return db['UserSmsQueue'][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'SmsQueueId':{'$in':_0x1893b1}},'transaction':_0x54b277});})['then'](function(){var _0x2baad0=_0x78d8('0x63')+_0xad5c17;return db[_0x78d8('0x55')][_0x78d8('0x34')](_0x2baad0,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x2bd438){var _0x1f9489=_['map'](_0x2bd438,function(_0x4f70d9){return Number(_0x4f70d9[_0x78d8('0x64')]);});return db['UserChatQueue'][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'ChatQueueId':{'$in':_0x1f9489}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){var _0x571179=_0x78d8('0x65')+_0xad5c17;return db[_0x78d8('0x55')][_0x78d8('0x34')](_0x571179,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x5d2a03){var _0x4fae98=_[_0x78d8('0x2f')](_0x5d2a03,function(_0xc63eeb){return Number(_0xc63eeb[_0x78d8('0x66')]);});return db[_0x78d8('0x67')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'FaxQueueId':{'$in':_0x4fae98}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){var _0x1b7d99=_0x78d8('0x68')+_0xad5c17;return db['sequelize'][_0x78d8('0x34')](_0x1b7d99,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x3de69d){var _0x480a8d=_[_0x78d8('0x2f')](_0x3de69d,function(_0x572630){return Number(_0x572630[_0x78d8('0x69')]);});return db[_0x78d8('0x6a')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'OpenchannelQueueId':{'$in':_0x480a8d}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){var _0x3fe5eb='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xad5c17;return db[_0x78d8('0x55')]['query'](_0x3fe5eb,{'type':db[_0x78d8('0x58')][_0x78d8('0x59')][_0x78d8('0x5a')],'raw':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x47e60b){var _0x32e479=_[_0x78d8('0x2f')](_0x47e60b,function(_0x4d70c5){return Number(_0x4d70c5[_0x78d8('0x6b')]);});return db[_0x78d8('0x6c')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'WhatsappQueueId':{'$in':_0x32e479}},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){return db[_0x78d8('0x6d')][_0x78d8('0x49')]({'where':{'TeamId':_0xad5c17}});})[_0x78d8('0x2a')](function(_0xb61555){if(_0xb61555===null){return;}return db[_0x78d8('0x6e')][_0x78d8('0x5f')]({'where':{'UserId':{'$in':_0x2b79a8},'VoicePrefixId':_0xb61555['VoicePrefixId']},'transaction':_0x54b277});})[_0x78d8('0x2a')](function(){return db[_0x78d8('0x30')][_0x78d8('0x5f')]({'where':{'id':_0xad5c17},'cascade':!![],'transaction':_0x54b277});})[_0x78d8('0x2a')](function(_0x19e3d6){if(_0x19e3d6===0x0){_0x40578f[_0x78d8('0x1e')](0x194);}else{return db[_0x78d8('0x54')]['destroy']({'where':{'type':_0x78d8('0x50'),'resourceId':_0xad5c17},'cascade':!![],'transaction':_0x54b277})[_0x78d8('0x2a')](function(){_0x40578f[_0x78d8('0x1f')](0xcc)[_0x78d8('0x20')]();});}})[_0x78d8('0x46')](function(_0x221e32){_0x40578f[_0x78d8('0x1f')](0x1f4)[_0x78d8('0x2e')](_0x221e32);});});};exports[_0x78d8('0x6f')]=function(_0x1d9073,_0x87d3e3,_0x556ccd){return db['Team'][_0x78d8('0x70')]({'where':{'id':_0x1d9073[_0x78d8('0x71')]['id']}})[_0x78d8('0x2a')](handleEntityNotFound(_0x87d3e3,null))[_0x78d8('0x2a')](function(_0x4c4785){if(!_0x1d9073[_0x78d8('0x34')][_0x78d8('0x72')]||!utils[_0x78d8('0x73')](_0x1d9073[_0x78d8('0x34')][_0x78d8('0x72')])){throw new db[(_0x78d8('0x58'))][(_0x78d8('0x74'))](_0x78d8('0x75'));}var _0x416142={};var _0x634934={};_0x634934[_0x78d8('0x37')]=_['keys'](db[_[_0x78d8('0x76')](_0x1d9073[_0x78d8('0x34')][_0x78d8('0x72')][_0x78d8('0x77')]())+_0x78d8('0x78')][_0x78d8('0x31')]);_0x634934[_0x78d8('0x34')]=_[_0x78d8('0x35')](_0x1d9073[_0x78d8('0x34')]);_0x634934['filters']=_[_0x78d8('0x48')](_0x634934[_0x78d8('0x37')],_0x634934['query']);_0x416142[_0x78d8('0x39')]=_[_0x78d8('0x48')](_0x634934[_0x78d8('0x37')],qs[_0x78d8('0x38')](_0x1d9073[_0x78d8('0x34')][_0x78d8('0x38')]));_0x416142[_0x78d8('0x39')]=_0x416142[_0x78d8('0x39')][_0x78d8('0x3a')]?_0x416142['attributes']:_0x634934[_0x78d8('0x37')];_0x416142[_0x78d8('0x23')]=qs[_0x78d8('0x23')](_0x1d9073['query'][_0x78d8('0x23')]);_0x416142['offset']=qs[_0x78d8('0x25')](_0x1d9073[_0x78d8('0x34')][_0x78d8('0x25')]);_0x416142[_0x78d8('0x3c')]=qs[_0x78d8('0x3d')](_0x1d9073[_0x78d8('0x34')][_0x78d8('0x3d')]);_0x416142[_0x78d8('0x3e')]=qs['filters'](_[_0x78d8('0x3f')](_0x1d9073[_0x78d8('0x34')],_0x634934[_0x78d8('0x36')]));_0x416142=_[_0x78d8('0x40')]({},_0x416142,_0x1d9073[_0x78d8('0x42')]);return _0x4c4785[_0x78d8('0x4f')+_[_0x78d8('0x76')](_0x1d9073[_0x78d8('0x34')]['channel'][_0x78d8('0x77')]())+'Queues'](_0x416142);})[_0x78d8('0x2a')](respondWithResult(_0x87d3e3,null))[_0x78d8('0x46')](handleError(_0x87d3e3,null));};exports[_0x78d8('0x79')]=function(_0xf8d15c,_0x3a2ec7,_0x161a68){return db['Team'][_0x78d8('0x70')]({'where':{'id':_0xf8d15c[_0x78d8('0x71')]['id']}})[_0x78d8('0x2a')](function(_0xa479c0){if(_0xa479c0){if(!_0xf8d15c[_0x78d8('0x4b')][_0x78d8('0x72')]||!utils['isValidChannel'](_0xf8d15c[_0x78d8('0x4b')]['channel'])){throw new db[(_0x78d8('0x58'))][(_0x78d8('0x74'))](_0x78d8('0x75'));}return _0xa479c0[_0x78d8('0x7a')+_[_0x78d8('0x76')](_0xf8d15c['body'][_0x78d8('0x72')]['toLowerCase']())+_0x78d8('0x7b')](_0xf8d15c[_0x78d8('0x4b')]['ids']);}return null;})['then'](handleEntityNotFound(_0x3a2ec7,null))[_0x78d8('0x2a')](respondWithStatusCode(_0x3a2ec7,null))['catch'](handleError(_0x3a2ec7,null));};exports[_0x78d8('0x7c')]=function(_0x33b532,_0x25bb29,_0x3b20b0){return db[_0x78d8('0x30')][_0x78d8('0x70')]({'where':{'id':_0x33b532['params']['id']}})[_0x78d8('0x2a')](function(_0x3ce6d1){if(_0x3ce6d1){if(!_0x33b532['query'][_0x78d8('0x72')]||!utils[_0x78d8('0x73')](_0x33b532[_0x78d8('0x34')]['channel'])){throw new db[(_0x78d8('0x58'))][(_0x78d8('0x74'))](_0x78d8('0x75'));}return _0x3ce6d1[_0x78d8('0x7d')+_['capitalize'](_0x33b532[_0x78d8('0x34')][_0x78d8('0x72')][_0x78d8('0x77')]())+_0x78d8('0x7b')](_0x33b532[_0x78d8('0x34')][_0x78d8('0x7e')]);}return null;})[_0x78d8('0x2a')](handleEntityNotFound(_0x25bb29,null))[_0x78d8('0x2a')](respondWithStatusCode(_0x25bb29,null))[_0x78d8('0x46')](handleError(_0x25bb29,null));};exports[_0x78d8('0x7f')]=function(_0x297016,_0x47dcd9){var _0x5e71be=_['isArray'](_0x297016[_0x78d8('0x4b')]['ids'])?_0x297016[_0x78d8('0x4b')][_0x78d8('0x7e')]:[_0x297016[_0x78d8('0x4b')]['ids']];var _0x46cab3=_0x297016[_0x78d8('0x71')]['id'];return db[_0x78d8('0x30')][_0x78d8('0x49')]({'where':{'id':_0x46cab3}})[_0x78d8('0x2a')](handleEntityNotFound(_0x47dcd9,null))[_0x78d8('0x2a')](function(_0x47e200){if(_0x47e200){var _0x174561=['Voice',_0x78d8('0x80'),_0x78d8('0x81'),'Sms','Fax',_0x78d8('0x82'),_0x78d8('0x83')];return db[_0x78d8('0x55')]['transaction'](function(_0x3508da){var _0x3931c2=_[_0x78d8('0x2f')](_0x174561,function(_0x44e95e){var _0x5dfc6b={'attributes':['id','name']};if(_0x44e95e===_0x78d8('0x84')){_0x5dfc6b[_0x78d8('0x85')]={'attributes':[_0x78d8('0x86')]};}return _0x47e200[_0x78d8('0x4f')+_0x44e95e+_0x78d8('0x7b')](_0x5dfc6b)[_0x78d8('0x2a')](function(_0x37828e){var _0x28baba=_['map'](_0x37828e,function(_0x1aab33){var _0x121881=_['map'](_0x5e71be,function(_0x4c7c4e){var _0x29be09={'where':{'UserId':_0x4c7c4e,[_0x44e95e+_0x78d8('0x87')]:_0x1aab33['id']},'transaction':_0x3508da};if(_0x44e95e===_0x78d8('0x84')){_0x29be09['defaults']={'penalty':_0x1aab33[_0x78d8('0x88')][_0x78d8('0x86')]};}return db[_0x78d8('0x89')+_0x44e95e+_0x78d8('0x78')][_0x78d8('0x8a')](_0x29be09)[_0x78d8('0x2a')](function(){socket['emit'](_0x78d8('0x4c')+_0x44e95e+_0x78d8('0x8b'),{'UserId':_0x4c7c4e,[_0x44e95e+_0x78d8('0x87')]:_0x1aab33['id']});if(_0x44e95e!=='Voice'){return;}return db[_0x78d8('0x89')][_0x78d8('0x44')]({'where':{'id':_0x5e71be,'online':0x1},'attributes':['id',_0x78d8('0x2d'),_0x78d8('0x8c'),_0x78d8('0x8d'),'interface'],'raw':!![]})[_0x78d8('0x2a')](function(_0x347118){var _0x228717=_[_0x78d8('0x2f')](_0x347118,function(_0x428170){return db['UserVoiceQueueRt']['upsert']({'membername':_0x428170[_0x78d8('0x2d')],'UserId':_0x428170['id'],'queue_name':_0x1aab33[_0x78d8('0x2d')],'VoiceQueueId':_0x1aab33['id'],'interface':_[_0x78d8('0x8e')](_0x428170['interface'])?util[_0x78d8('0x8f')](_0x78d8('0x90'),_0x428170[_0x78d8('0x2d')]):_0x428170[_0x78d8('0x91')],'paused':_0x428170['voicePause']||![],'penalty':_0x1aab33[_0x78d8('0x88')][_0x78d8('0x86')]},{'transaction':_0x3508da});});return Promise[_0x78d8('0x92')](_0x228717);});});});return Promise[_0x78d8('0x92')](_0x121881);});return Promise[_0x78d8('0x92')](_0x28baba);})['then'](function(){return db[_0x78d8('0x6d')][_0x78d8('0x70')]({'where':{'teamId':_0x46cab3}})[_0x78d8('0x2a')](function(_0xe6cb22){if(_0xe6cb22){var _0x3c766e=_[_0x78d8('0x2f')](_0x5e71be,function(_0x4a9b9e){db[_0x78d8('0x6e')][_0x78d8('0x93')]({'UserId':_0x4a9b9e,'VoicePrefixId':_0xe6cb22[_0x78d8('0x94')]});});return Promise[_0x78d8('0x92')](_0x3c766e);}});});});return Promise['all'](_0x3931c2)[_0x78d8('0x2a')](function(){return _0x47e200[_0x78d8('0x7f')](_0x5e71be,{'transaction':_0x3508da})[_0x78d8('0x95')](function(_0x1daa30){return _0x1daa30;});});});}})[_0x78d8('0x2a')](respondWithResult(_0x47dcd9,null))['catch'](handleError(_0x47dcd9,null));};exports[_0x78d8('0x96')]=function(_0x2eb523,_0x129ea6){var _0x4ac907=_[_0x78d8('0x97')](_0x2eb523[_0x78d8('0x34')]['ids'])?_0x2eb523[_0x78d8('0x34')]['ids']:[_0x2eb523[_0x78d8('0x34')][_0x78d8('0x7e')]];var _0x47f982=_0x2eb523['params']['id'];return db[_0x78d8('0x30')][_0x78d8('0x49')]({'where':{'id':_0x47f982}})['then'](handleEntityNotFound(_0x129ea6,null))['then'](function(_0x23fb91){if(_0x23fb91){var _0xf73409=[_0x78d8('0x84'),_0x78d8('0x80'),_0x78d8('0x81'),_0x78d8('0x98'),'Fax',_0x78d8('0x82'),_0x78d8('0x83')];return db[_0x78d8('0x55')][_0x78d8('0x56')](function(_0x127a8a){var _0x2ee760=_[_0x78d8('0x2f')](_0xf73409,function(_0x172e9f){var _0x351779={'attributes':['id','name']};return _0x23fb91[_0x78d8('0x4f')+_0x172e9f+_0x78d8('0x7b')](_0x351779)[_0x78d8('0x2a')](function(_0x29968b){var _0x6893c3=_[_0x78d8('0x2f')](_0x29968b,function(_0x182ebf){return _0x182ebf[_0x78d8('0x96')](_0x4ac907,{'transaction':_0x127a8a})['then'](function(){var _0x3cb24f=_['map'](_0x4ac907,function(_0x54c1d3){socket[_0x78d8('0x99')](_0x78d8('0x4c')+_0x172e9f+_0x78d8('0x9a'),{'UserId':Number(_0x54c1d3),[_0x172e9f+'QueueId']:_0x182ebf['id']});if(_0x172e9f!=='Voice'){return;}return db[_0x78d8('0x9b')][_0x78d8('0x5f')]({'where':{'VoiceQueueId':_0x182ebf['id'],'UserId':_0x54c1d3},'transaction':_0x127a8a});});return Promise[_0x78d8('0x92')](_0x3cb24f);});});return Promise[_0x78d8('0x92')](_0x6893c3);});});return Promise[_0x78d8('0x92')](_0x2ee760)[_0x78d8('0x2a')](function(){return _0x23fb91[_0x78d8('0x96')](_0x4ac907,{'transaction':_0x127a8a});})[_0x78d8('0x2a')](function(){return db[_0x78d8('0x6d')][_0x78d8('0x70')]({'where':{'teamId':_0x47f982}})[_0x78d8('0x2a')](function(_0x2518d3){if(_0x2518d3){var _0x3d9200=_['map'](_0x4ac907,function(_0x5a4e85){db[_0x78d8('0x6e')][_0x78d8('0x5f')]({'where':{'UserId':_0x5a4e85,'VoicePrefixId':_0x2518d3[_0x78d8('0x94')]}});});return Promise[_0x78d8('0x92')](_0x3d9200);}});});});}})[_0x78d8('0x2a')](respondWithStatusCode(_0x129ea6,null))[_0x78d8('0x46')](handleError(_0x129ea6,null));};exports[_0x78d8('0x9c')]=function(_0x1fcdc3,_0x4d2271,_0xfa522a){var _0x22ce1b={};var _0x37b2ea={};var _0x563bbf;var _0x6513fe;return db['Team'][_0x78d8('0x70')]({'where':{'id':_0x1fcdc3['params']['id']}})['then'](handleEntityNotFound(_0x4d2271,null))[_0x78d8('0x2a')](function(_0xc9e78b){if(_0xc9e78b){_0x563bbf=_0xc9e78b;_0x37b2ea[_0x78d8('0x37')]=_[_0x78d8('0x35')](db[_0x78d8('0x89')]['rawAttributes']);_0x37b2ea['query']=_['keys'](_0x1fcdc3[_0x78d8('0x34')]);_0x37b2ea[_0x78d8('0x36')]=_[_0x78d8('0x48')](_0x37b2ea[_0x78d8('0x37')],_0x37b2ea[_0x78d8('0x34')]);_0x22ce1b['attributes']=_[_0x78d8('0x48')](_0x37b2ea[_0x78d8('0x37')],qs[_0x78d8('0x38')](_0x1fcdc3[_0x78d8('0x34')]['fields']));_0x22ce1b[_0x78d8('0x39')]=_0x22ce1b[_0x78d8('0x39')][_0x78d8('0x3a')]?_0x22ce1b[_0x78d8('0x39')]:_0x37b2ea[_0x78d8('0x37')];_0x22ce1b['order']=qs[_0x78d8('0x3d')](_0x1fcdc3[_0x78d8('0x34')]['sort']);_0x22ce1b[_0x78d8('0x3e')]=qs[_0x78d8('0x36')](_[_0x78d8('0x3f')](_0x1fcdc3[_0x78d8('0x34')],_0x37b2ea[_0x78d8('0x36')]));if(_0x1fcdc3['query']['filter']){_0x22ce1b['where']=_[_0x78d8('0x40')](_0x22ce1b['where'],{'$or':_[_0x78d8('0x2f')](_0x22ce1b[_0x78d8('0x39')],function(_0x1f7bd8){var _0x398520={};_0x398520[_0x1f7bd8]={'$like':'%'+_0x1fcdc3[_0x78d8('0x34')][_0x78d8('0x9d')]+'%'};return _0x398520;})});}_0x22ce1b=_[_0x78d8('0x40')]({},_0x22ce1b,_0x1fcdc3[_0x78d8('0x42')]);return _0x563bbf[_0x78d8('0x9c')](_0x22ce1b);}})[_0x78d8('0x2a')](function(_0x5d19ef){if(_0x5d19ef){_0x6513fe=_0x5d19ef[_0x78d8('0x3a')];if(!_0x1fcdc3['query'][_0x78d8('0x9e')](_0x78d8('0x3b'))){_0x22ce1b[_0x78d8('0x23')]=qs['limit'](_0x1fcdc3[_0x78d8('0x34')][_0x78d8('0x23')]);_0x22ce1b[_0x78d8('0x25')]=qs[_0x78d8('0x25')](_0x1fcdc3[_0x78d8('0x34')][_0x78d8('0x25')]);}return _0x563bbf['getAgents'](_0x22ce1b);}})[_0x78d8('0x2a')](function(_0x150408){if(_0x150408){return _0x150408?{'count':_0x6513fe,'rows':_0x150408}:null;}})[_0x78d8('0x2a')](respondWithResult(_0x4d2271,null))['catch'](handleError(_0x4d2271,null));}; \ No newline at end of file +var _0xcaec=['getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','Team','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','destroy','sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','VoicePrefixId','status','end','send','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','addAgents','removeAgents','Chat','Sms'];(function(_0x330de2,_0x1f76d4){var _0x1be24d=function(_0x1c1553){while(--_0x1c1553){_0x330de2['push'](_0x330de2['shift']());}};_0x1be24d(++_0x1f76d4);}(_0xcaec,0x9c));var _0xccae=function(_0x415b7a,_0x28b713){_0x415b7a=_0x415b7a-0x0;var _0x46ba25=_0xcaec[_0x415b7a];return _0x46ba25;};'use strict';var emlformat=require(_0xccae('0x0'));var rimraf=require(_0xccae('0x1'));var zipdir=require(_0xccae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccae('0x3'));var moment=require(_0xccae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccae('0x5'));var util=require('util');var path=require(_0xccae('0x6'));var sox=require('sox');var csv=require(_0xccae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccae('0x8'));var _=require(_0xccae('0x9'));var squel=require(_0xccae('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xccae('0xb'));var toCsv=require(_0xccae('0x7'));var querystring=require(_0xccae('0xc'));var Papa=require(_0xccae('0xd'));var Redis=require('ioredis');var authService=require(_0xccae('0xe'));var qs=require(_0xccae('0xf'));var as=require(_0xccae('0x10'));var hardwareService=require(_0xccae('0x11'));var logger=require(_0xccae('0x12'))(_0xccae('0x13'));var utils=require(_0xccae('0x14'));var config=require(_0xccae('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xccae('0x16'))['db'];config['redis']=_[_0xccae('0x17')](config[_0xccae('0x18')],{'host':_0xccae('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xccae('0x18')]));require(_0xccae('0x1a'))[_0xccae('0x1b')](socket);function respondWithStatusCode(_0x967028,_0x127cb0){_0x127cb0=_0x127cb0||0xcc;return function(_0x5bbd5f){if(_0x5bbd5f){return _0x967028[_0xccae('0x1c')](_0x127cb0);}return _0x967028['status'](_0x127cb0)['end']();};}function respondWithResult(_0x5760e3,_0x157ae1){_0x157ae1=_0x157ae1||0xc8;return function(_0x325963){if(_0x325963){return _0x5760e3['status'](_0x157ae1)['json'](_0x325963);}};}function respondWithFilteredResult(_0xc9b2bb,_0x4bf0fd){return function(_0x598200){if(_0x598200){var _0x4e16e9=typeof _0x4bf0fd[_0xccae('0x1d')]===_0xccae('0x1e')&&typeof _0x4bf0fd[_0xccae('0x1f')]===_0xccae('0x1e');var _0x5a7907=_0x598200[_0xccae('0x20')];var _0x54e87c=_0x4e16e9?0x0:_0x4bf0fd['offset'];var _0x55d6c3=_0x4e16e9?_0x598200[_0xccae('0x20')]:_0x4bf0fd[_0xccae('0x1d')]+_0x4bf0fd['limit'];var _0x22e9af;if(_0x55d6c3>=_0x5a7907){_0x55d6c3=_0x5a7907;_0x22e9af=0xc8;}else{_0x22e9af=0xce;}_0xc9b2bb['status'](_0x22e9af);return _0xc9b2bb[_0xccae('0x21')](_0xccae('0x22'),_0x54e87c+'-'+_0x55d6c3+'/'+_0x5a7907)[_0xccae('0x23')](_0x598200);}return null;};}function patchUpdates(_0x46f9a8){return function(_0x118503){try{jsonpatch[_0xccae('0x24')](_0x118503,_0x46f9a8,!![]);}catch(_0x57468c){return BPromise[_0xccae('0x25')](_0x57468c);}return _0x118503[_0xccae('0x26')]();};}function saveUpdates(_0x2f7df4,_0x2a16a9){return function(_0x3cfa2a){if(_0x3cfa2a){return _0x3cfa2a['update'](_0x2f7df4)[_0xccae('0x27')](function(_0x29b483){return _0x29b483;});}return null;};}function handleEntityNotFound(_0x489161,_0x56de09){return function(_0x1c8c9a){if(!_0x1c8c9a){_0x489161['sendStatus'](0x194);}return _0x1c8c9a;};}function handleError(_0x1fb33f,_0x28a2d2){_0x28a2d2=_0x28a2d2||0x1f4;return function(_0x842cbf){logger[_0xccae('0x28')](_0x842cbf[_0xccae('0x29')]);if(_0x842cbf[_0xccae('0x2a')]){delete _0x842cbf[_0xccae('0x2a')];}_0x1fb33f['status'](_0x28a2d2)['send'](_0x842cbf);};}exports[_0xccae('0x2b')]=function(_0x4e4c51,_0x4628f2){var _0x53518f={},_0x26e85f={},_0x245075={'count':0x0,'rows':[]};var _0x588823=_[_0xccae('0x2c')](db[_0xccae('0x2d')][_0xccae('0x2e')],function(_0x41f997){return{'name':_0x41f997[_0xccae('0x2f')],'type':_0x41f997[_0xccae('0x30')]['key']};});_0x26e85f[_0xccae('0x31')]=_[_0xccae('0x2c')](_0x588823,_0xccae('0x2a'));_0x26e85f[_0xccae('0x32')]=_[_0xccae('0x33')](_0x4e4c51[_0xccae('0x32')]);_0x26e85f[_0xccae('0x34')]=_[_0xccae('0x35')](_0x26e85f[_0xccae('0x31')],_0x26e85f[_0xccae('0x32')]);_0x53518f[_0xccae('0x36')]=_['intersection'](_0x26e85f['model'],qs[_0xccae('0x37')](_0x4e4c51['query']['fields']));_0x53518f[_0xccae('0x36')]=_0x53518f['attributes'][_0xccae('0x38')]?_0x53518f[_0xccae('0x36')]:_0x26e85f[_0xccae('0x31')];if(!_0x4e4c51[_0xccae('0x32')][_0xccae('0x39')](_0xccae('0x3a'))){_0x53518f[_0xccae('0x1f')]=qs['limit'](_0x4e4c51[_0xccae('0x32')][_0xccae('0x1f')]);_0x53518f['offset']=qs['offset'](_0x4e4c51[_0xccae('0x32')]['offset']);}_0x53518f[_0xccae('0x3b')]=qs[_0xccae('0x3c')](_0x4e4c51[_0xccae('0x32')][_0xccae('0x3c')]);_0x53518f[_0xccae('0x3d')]=qs[_0xccae('0x34')](_[_0xccae('0x3e')](_0x4e4c51[_0xccae('0x32')],_0x26e85f[_0xccae('0x34')]),_0x588823);if(_0x4e4c51[_0xccae('0x32')][_0xccae('0x3f')]){_0x53518f[_0xccae('0x3d')]=_[_0xccae('0x40')](_0x53518f[_0xccae('0x3d')],{'$or':_[_0xccae('0x2c')](_0x588823,function(_0x39f7d9){if(_0x39f7d9['type']!==_0xccae('0x41')){var _0x59492f={};_0x59492f[_0x39f7d9['name']]={'$like':'%'+_0x4e4c51[_0xccae('0x32')][_0xccae('0x3f')]+'%'};return _0x59492f;}})});}_0x53518f=_[_0xccae('0x40')]({},_0x53518f,_0x4e4c51['options']);var _0x3cce4b={'where':_0x53518f[_0xccae('0x3d')]};return db[_0xccae('0x2d')][_0xccae('0x20')](_0x3cce4b)[_0xccae('0x27')](function(_0x3cc503){_0x245075[_0xccae('0x20')]=_0x3cc503;if(_0x4e4c51[_0xccae('0x32')]['includeAll']){_0x53518f[_0xccae('0x42')]=[{'all':!![]}];}return db[_0xccae('0x2d')][_0xccae('0x43')](_0x53518f);})[_0xccae('0x27')](function(_0x54566d){_0x245075[_0xccae('0x44')]=_0x54566d;return _0x245075;})[_0xccae('0x27')](respondWithFilteredResult(_0x4628f2,_0x53518f))[_0xccae('0x45')](handleError(_0x4628f2,null));};exports[_0xccae('0x46')]=function(_0x1abc03,_0x8ff200){var _0x2b8fc0={'raw':![],'where':{'id':_0x1abc03[_0xccae('0x47')]['id']}},_0x50bf41={};_0x50bf41['model']=_[_0xccae('0x33')](db[_0xccae('0x2d')][_0xccae('0x2e')]);_0x50bf41[_0xccae('0x32')]=_['keys'](_0x1abc03[_0xccae('0x32')]);_0x50bf41[_0xccae('0x34')]=_[_0xccae('0x35')](_0x50bf41[_0xccae('0x31')],_0x50bf41[_0xccae('0x32')]);_0x2b8fc0[_0xccae('0x36')]=_['intersection'](_0x50bf41[_0xccae('0x31')],qs[_0xccae('0x37')](_0x1abc03[_0xccae('0x32')][_0xccae('0x37')]));_0x2b8fc0['attributes']=_0x2b8fc0[_0xccae('0x36')][_0xccae('0x38')]?_0x2b8fc0[_0xccae('0x36')]:_0x50bf41[_0xccae('0x31')];if(_0x1abc03['query'][_0xccae('0x48')]){_0x2b8fc0[_0xccae('0x42')]=[{'all':!![]}];}_0x2b8fc0=_[_0xccae('0x40')]({},_0x2b8fc0,_0x1abc03[_0xccae('0x49')]);return db[_0xccae('0x2d')]['find'](_0x2b8fc0)['then'](handleEntityNotFound(_0x8ff200,null))[_0xccae('0x27')](respondWithResult(_0x8ff200,null))['catch'](handleError(_0x8ff200,null));};exports[_0xccae('0x4a')]=function(_0x124e95,_0x2f09b3){return db[_0xccae('0x2d')][_0xccae('0x4a')](_0x124e95['body'],{})[_0xccae('0x27')](function(_0x199ce9){var _0x503519=_0x124e95[_0xccae('0x4b')][_0xccae('0x4c')]({'plain':!![]});if(!_0x503519)throw new Error(_0xccae('0x4d'));if(_0x503519[_0xccae('0x4e')]===_0xccae('0x4b')){var _0x741b1e=_0x199ce9[_0xccae('0x4c')]({'plain':!![]});var _0x58ac9d=_0xccae('0x4f');return db[_0xccae('0x50')]['find']({'where':{'name':_0x58ac9d,'userProfileId':_0x503519['userProfileId']},'raw':!![]})['then'](function(_0x3b1c93){if(_0x3b1c93&&_0x3b1c93[_0xccae('0x51')]===0x0){return db[_0xccae('0x52')][_0xccae('0x4a')]({'name':_0x741b1e['name'],'resourceId':_0x741b1e['id'],'type':_0x3b1c93[_0xccae('0x2a')],'sectionId':_0x3b1c93['id']},{})[_0xccae('0x27')](function(){return _0x199ce9;});}else{return _0x199ce9;}})[_0xccae('0x45')](function(_0x17c15d){logger[_0xccae('0x28')](_0xccae('0x53'),_0x17c15d);throw _0x17c15d;});}return _0x199ce9;})[_0xccae('0x27')](respondWithResult(_0x2f09b3,0xc9))[_0xccae('0x45')](handleError(_0x2f09b3,null));};exports[_0xccae('0x54')]=function(_0x529cf3,_0x4d3ec5){if(_0x529cf3[_0xccae('0x55')]['id']){delete _0x529cf3[_0xccae('0x55')]['id'];}return db['Team'][_0xccae('0x56')]({'where':{'id':_0x529cf3[_0xccae('0x47')]['id']}})[_0xccae('0x27')](handleEntityNotFound(_0x4d3ec5,null))[_0xccae('0x27')](saveUpdates(_0x529cf3[_0xccae('0x55')],null))[_0xccae('0x27')](respondWithResult(_0x4d3ec5,null))[_0xccae('0x45')](handleError(_0x4d3ec5,null));};exports[_0xccae('0x57')]=function(_0x3166ea,_0x198965){var _0x10383f=_0x3166ea[_0xccae('0x47')]['id'];var _0x3a34ec=[];return db['sequelize']['transaction'](function(_0x3c9fdf){var _0x51e556='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x10383f;return db[_0xccae('0x58')][_0xccae('0x32')](_0x51e556,{'type':db['Sequelize'][_0xccae('0x59')][_0xccae('0x5a')],'raw':!![],'transaction':_0x3c9fdf})[_0xccae('0x27')](function(_0x3ac3ee){_0x3a34ec=_[_0xccae('0x2c')](_0x3ac3ee,function(_0x43eff1){return Number(_0x43eff1[_0xccae('0x5b')]);});})['then'](function(){var _0x59a0a7=_0xccae('0x5c')+_0x10383f;return db['sequelize'][_0xccae('0x32')](_0x59a0a7,{'type':db['Sequelize'][_0xccae('0x59')][_0xccae('0x5a')],'raw':!![],'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(_0x140517){var _0x27c4bc=_['map'](_0x140517,function(_0x4204f5){return Number(_0x4204f5[_0xccae('0x5d')]);});return db[_0xccae('0x5e')][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'VoiceQueueId':{'$in':_0x27c4bc}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0x412cf9=_0xccae('0x5f')+_0x10383f;return db[_0xccae('0x58')][_0xccae('0x32')](_0x412cf9,{'type':db[_0xccae('0x60')][_0xccae('0x59')]['SELECT'],'raw':!![],'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(_0x36405d){var _0x29b470=_['map'](_0x36405d,function(_0x41b927){return Number(_0x41b927['MailQueueId']);});return db['UserMailQueue'][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'MailQueueId':{'$in':_0x29b470}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0x4ab199=_0xccae('0x61')+_0x10383f;return db['sequelize'][_0xccae('0x32')](_0x4ab199,{'type':db['Sequelize'][_0xccae('0x59')][_0xccae('0x5a')],'raw':!![],'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(_0x3d6249){var _0x46d162=_[_0xccae('0x2c')](_0x3d6249,function(_0x157dba){return Number(_0x157dba[_0xccae('0x62')]);});return db[_0xccae('0x63')]['destroy']({'where':{'UserId':{'$in':_0x3a34ec},'SmsQueueId':{'$in':_0x46d162}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0xaa002b=_0xccae('0x64')+_0x10383f;return db[_0xccae('0x58')][_0xccae('0x32')](_0xaa002b,{'type':db[_0xccae('0x60')][_0xccae('0x59')][_0xccae('0x5a')],'raw':!![],'transaction':_0x3c9fdf});})['then'](function(_0x1778b3){var _0x4f2a01=_[_0xccae('0x2c')](_0x1778b3,function(_0x159da9){return Number(_0x159da9[_0xccae('0x65')]);});return db[_0xccae('0x66')][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'ChatQueueId':{'$in':_0x4f2a01}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0x4e43f9='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10383f;return db['sequelize'][_0xccae('0x32')](_0x4e43f9,{'type':db[_0xccae('0x60')][_0xccae('0x59')]['SELECT'],'raw':!![],'transaction':_0x3c9fdf});})['then'](function(_0x205532){var _0x28ac56=_[_0xccae('0x2c')](_0x205532,function(_0x11963b){return Number(_0x11963b[_0xccae('0x67')]);});return db[_0xccae('0x68')][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'FaxQueueId':{'$in':_0x28ac56}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0x18ab28=_0xccae('0x69')+_0x10383f;return db[_0xccae('0x58')][_0xccae('0x32')](_0x18ab28,{'type':db[_0xccae('0x60')][_0xccae('0x59')]['SELECT'],'raw':!![],'transaction':_0x3c9fdf});})['then'](function(_0x5bd625){var _0x449d2=_[_0xccae('0x2c')](_0x5bd625,function(_0x272b8b){return Number(_0x272b8b[_0xccae('0x6a')]);});return db['UserOpenchannelQueue'][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'OpenchannelQueueId':{'$in':_0x449d2}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){var _0x2f08d1=_0xccae('0x6b')+_0x10383f;return db[_0xccae('0x58')][_0xccae('0x32')](_0x2f08d1,{'type':db[_0xccae('0x60')][_0xccae('0x59')][_0xccae('0x5a')],'raw':!![],'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(_0x9721d4){var _0x17fb2c=_[_0xccae('0x2c')](_0x9721d4,function(_0x17d128){return Number(_0x17d128['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xccae('0x57')]({'where':{'UserId':{'$in':_0x3a34ec},'WhatsappQueueId':{'$in':_0x17fb2c}},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){return db[_0xccae('0x6c')]['find']({'where':{'TeamId':_0x10383f}});})['then'](function(_0x230306){if(_0x230306===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x3a34ec},'VoicePrefixId':_0x230306[_0xccae('0x6d')]},'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(){return db['Team'][_0xccae('0x57')]({'where':{'id':_0x10383f},'cascade':!![],'transaction':_0x3c9fdf});})[_0xccae('0x27')](function(_0x54b686){if(_0x54b686===0x0){_0x198965[_0xccae('0x1c')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':'Teams','resourceId':_0x10383f},'cascade':!![],'transaction':_0x3c9fdf})[_0xccae('0x27')](function(){_0x198965[_0xccae('0x6e')](0xcc)[_0xccae('0x6f')]();});}})[_0xccae('0x45')](function(_0x4bb655){_0x198965['status'](0x1f4)[_0xccae('0x70')](_0x4bb655);});});};exports[_0xccae('0x71')]=function(_0x25bb4d,_0x3d3c53,_0x3da336){return db[_0xccae('0x2d')][_0xccae('0x72')]({'where':{'id':_0x25bb4d[_0xccae('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d3c53,null))[_0xccae('0x27')](function(_0x36ddc8){if(!_0x25bb4d['query']['channel']||!utils[_0xccae('0x73')](_0x25bb4d[_0xccae('0x32')][_0xccae('0x74')])){throw new db[(_0xccae('0x60'))][(_0xccae('0x75'))](_0xccae('0x76'));}var _0x463046={};var _0x548da3={};_0x548da3['model']=_[_0xccae('0x33')](db[_['capitalize'](_0x25bb4d[_0xccae('0x32')][_0xccae('0x74')][_0xccae('0x77')]())+_0xccae('0x78')][_0xccae('0x2e')]);_0x548da3[_0xccae('0x32')]=_[_0xccae('0x33')](_0x25bb4d[_0xccae('0x32')]);_0x548da3[_0xccae('0x34')]=_[_0xccae('0x35')](_0x548da3['model'],_0x548da3[_0xccae('0x32')]);_0x463046['attributes']=_[_0xccae('0x35')](_0x548da3[_0xccae('0x31')],qs[_0xccae('0x37')](_0x25bb4d['query']['fields']));_0x463046['attributes']=_0x463046[_0xccae('0x36')]['length']?_0x463046[_0xccae('0x36')]:_0x548da3[_0xccae('0x31')];_0x463046[_0xccae('0x1f')]=qs[_0xccae('0x1f')](_0x25bb4d[_0xccae('0x32')][_0xccae('0x1f')]);_0x463046[_0xccae('0x1d')]=qs[_0xccae('0x1d')](_0x25bb4d['query'][_0xccae('0x1d')]);_0x463046[_0xccae('0x3b')]=qs[_0xccae('0x3c')](_0x25bb4d[_0xccae('0x32')][_0xccae('0x3c')]);_0x463046[_0xccae('0x3d')]=qs[_0xccae('0x34')](_[_0xccae('0x3e')](_0x25bb4d[_0xccae('0x32')],_0x548da3['filters']));_0x463046=_[_0xccae('0x40')]({},_0x463046,_0x25bb4d[_0xccae('0x49')]);return _0x36ddc8[_0xccae('0x4c')+_['capitalize'](_0x25bb4d['query'][_0xccae('0x74')][_0xccae('0x77')]())+_0xccae('0x79')](_0x463046);})[_0xccae('0x27')](respondWithResult(_0x3d3c53,null))[_0xccae('0x45')](handleError(_0x3d3c53,null));};exports[_0xccae('0x7a')]=function(_0xa870bf,_0x529a6a,_0x300cef){return db[_0xccae('0x2d')][_0xccae('0x72')]({'where':{'id':_0xa870bf['params']['id']}})[_0xccae('0x27')](function(_0x12b16c){if(_0x12b16c){if(!_0xa870bf['body'][_0xccae('0x74')]||!utils['isValidChannel'](_0xa870bf[_0xccae('0x55')]['channel'])){throw new db[(_0xccae('0x60'))]['ValidationError'](_0xccae('0x76'));}return _0x12b16c[_0xccae('0x7b')+_['capitalize'](_0xa870bf[_0xccae('0x55')][_0xccae('0x74')]['toLowerCase']())+_0xccae('0x79')](_0xa870bf[_0xccae('0x55')][_0xccae('0x7c')]);}return null;})[_0xccae('0x27')](handleEntityNotFound(_0x529a6a,null))[_0xccae('0x27')](respondWithStatusCode(_0x529a6a,null))[_0xccae('0x45')](handleError(_0x529a6a,null));};exports[_0xccae('0x7d')]=function(_0x24b952,_0x4c7047,_0x3e5c1){return db['Team']['findOne']({'where':{'id':_0x24b952[_0xccae('0x47')]['id']}})[_0xccae('0x27')](function(_0x3b238f){if(_0x3b238f){if(!_0x24b952['query'][_0xccae('0x74')]||!utils[_0xccae('0x73')](_0x24b952[_0xccae('0x32')][_0xccae('0x74')])){throw new db[(_0xccae('0x60'))][(_0xccae('0x75'))](_0xccae('0x76'));}return _0x3b238f[_0xccae('0x7e')+_['capitalize'](_0x24b952[_0xccae('0x32')][_0xccae('0x74')]['toLowerCase']())+_0xccae('0x79')](_0x24b952[_0xccae('0x32')][_0xccae('0x7c')]);}return null;})[_0xccae('0x27')](handleEntityNotFound(_0x4c7047,null))[_0xccae('0x27')](respondWithStatusCode(_0x4c7047,null))[_0xccae('0x45')](handleError(_0x4c7047,null));};exports['addAgents']=function(_0x4b7d52,_0x4824b9){var _0x31ae56=_[_0xccae('0x7f')](_0x4b7d52[_0xccae('0x55')]['ids'])?_0x4b7d52[_0xccae('0x55')]['ids']:[_0x4b7d52[_0xccae('0x55')][_0xccae('0x7c')]];var _0x393fae=_0x4b7d52['params']['id'];return db[_0xccae('0x2d')][_0xccae('0x56')]({'where':{'id':_0x393fae}})[_0xccae('0x27')](handleEntityNotFound(_0x4824b9,null))[_0xccae('0x27')](function(_0x541d7f){if(_0x541d7f){var _0x54723a=[_0xccae('0x80'),'Chat',_0xccae('0x81'),'Sms',_0xccae('0x82'),_0xccae('0x83'),_0xccae('0x84')];return db[_0xccae('0x58')]['transaction'](function(_0x1600f5){var _0x594788=_[_0xccae('0x2c')](_0x54723a,function(_0xd6a32d){var _0x14f1ef={'attributes':['id',_0xccae('0x2a')]};if(_0xd6a32d===_0xccae('0x80')){_0x14f1ef[_0xccae('0x85')]={'attributes':[_0xccae('0x86')]};}return _0x541d7f[_0xccae('0x4c')+_0xd6a32d+_0xccae('0x79')](_0x14f1ef)[_0xccae('0x27')](function(_0x2ba270){var _0x46d231=_[_0xccae('0x2c')](_0x2ba270,function(_0xfaa172){var _0x2f07c0=_[_0xccae('0x2c')](_0x31ae56,function(_0x48e83c){var _0x553cb3={'where':{'UserId':_0x48e83c,[_0xd6a32d+'QueueId']:_0xfaa172['id']},'transaction':_0x1600f5};if(_0xd6a32d==='Voice'){_0x553cb3[_0xccae('0x17')]={'penalty':_0xfaa172[_0xccae('0x87')][_0xccae('0x86')]};}return db[_0xccae('0x88')+_0xd6a32d+_0xccae('0x78')][_0xccae('0x89')](_0x553cb3)['then'](function(){socket[_0xccae('0x8a')](_0xccae('0x4b')+_0xd6a32d+_0xccae('0x8b'),{'UserId':_0x48e83c,[_0xd6a32d+_0xccae('0x8c')]:_0xfaa172['id']});if(_0xd6a32d!=='Voice'){return;}return db[_0xccae('0x88')]['findAll']({'where':{'id':_0x31ae56,'online':0x1},'attributes':['id','name',_0xccae('0x8d'),_0xccae('0x8e'),'interface'],'raw':!![]})[_0xccae('0x27')](function(_0x3e7313){var _0x31f22d=_[_0xccae('0x2c')](_0x3e7313,function(_0x3462fe){return db[_0xccae('0x8f')][_0xccae('0x90')]({'membername':_0x3462fe['name'],'UserId':_0x3462fe['id'],'queue_name':_0xfaa172[_0xccae('0x2a')],'VoiceQueueId':_0xfaa172['id'],'interface':_[_0xccae('0x91')](_0x3462fe[_0xccae('0x92')])?util[_0xccae('0x93')](_0xccae('0x94'),_0x3462fe['name']):_0x3462fe[_0xccae('0x92')],'paused':_0x3462fe[_0xccae('0x8e')]||![],'penalty':_0xfaa172[_0xccae('0x87')][_0xccae('0x86')]},{'transaction':_0x1600f5});});return Promise['all'](_0x31f22d);});});});return Promise[_0xccae('0x95')](_0x2f07c0);});return Promise[_0xccae('0x95')](_0x46d231);})[_0xccae('0x27')](function(){return db[_0xccae('0x6c')]['findOne']({'where':{'teamId':_0x393fae}})[_0xccae('0x27')](function(_0x5dd851){if(_0x5dd851){var _0x279644=_[_0xccae('0x2c')](_0x31ae56,function(_0x1aa62a){db['UserVoicePrefix'][_0xccae('0x90')]({'UserId':_0x1aa62a,'VoicePrefixId':_0x5dd851[_0xccae('0x6d')]});});return Promise[_0xccae('0x95')](_0x279644);}});});});return Promise[_0xccae('0x95')](_0x594788)[_0xccae('0x27')](function(){return _0x541d7f[_0xccae('0x96')](_0x31ae56,{'transaction':_0x1600f5})['spread'](function(_0x5a1237){return _0x5a1237;});});});}})[_0xccae('0x27')](respondWithResult(_0x4824b9,null))[_0xccae('0x45')](handleError(_0x4824b9,null));};exports[_0xccae('0x97')]=function(_0x56d3c3,_0x16f743){var _0x1b6fcf=_['isArray'](_0x56d3c3[_0xccae('0x32')][_0xccae('0x7c')])?_0x56d3c3[_0xccae('0x32')][_0xccae('0x7c')]:[_0x56d3c3[_0xccae('0x32')][_0xccae('0x7c')]];var _0x30df29=_0x56d3c3[_0xccae('0x47')]['id'];return db['Team'][_0xccae('0x56')]({'where':{'id':_0x30df29}})['then'](handleEntityNotFound(_0x16f743,null))[_0xccae('0x27')](function(_0xaf9c0f){if(_0xaf9c0f){var _0x450967=[_0xccae('0x80'),_0xccae('0x98'),_0xccae('0x81'),_0xccae('0x99'),_0xccae('0x82'),'Openchannel','Whatsapp'];return db['sequelize']['transaction'](function(_0x18a0b5){var _0x4d90e5=_['map'](_0x450967,function(_0x260aa9){var _0x1c6fd7={'attributes':['id','name']};return _0xaf9c0f[_0xccae('0x4c')+_0x260aa9+_0xccae('0x79')](_0x1c6fd7)[_0xccae('0x27')](function(_0x42f7ed){var _0x1a4023=_[_0xccae('0x2c')](_0x42f7ed,function(_0x1c8268){return _0x1c8268[_0xccae('0x97')](_0x1b6fcf,{'transaction':_0x18a0b5})[_0xccae('0x27')](function(){var _0x2d80c8=_[_0xccae('0x2c')](_0x1b6fcf,function(_0x1066a5){socket['emit']('user'+_0x260aa9+'Queue:remove',{'UserId':Number(_0x1066a5),[_0x260aa9+_0xccae('0x8c')]:_0x1c8268['id']});if(_0x260aa9!==_0xccae('0x80')){return;}return db[_0xccae('0x8f')][_0xccae('0x57')]({'where':{'VoiceQueueId':_0x1c8268['id'],'UserId':_0x1066a5},'transaction':_0x18a0b5});});return Promise[_0xccae('0x95')](_0x2d80c8);});});return Promise[_0xccae('0x95')](_0x1a4023);});});return Promise[_0xccae('0x95')](_0x4d90e5)[_0xccae('0x27')](function(){return _0xaf9c0f['removeAgents'](_0x1b6fcf,{'transaction':_0x18a0b5});})['then'](function(){return db[_0xccae('0x6c')][_0xccae('0x72')]({'where':{'teamId':_0x30df29}})[_0xccae('0x27')](function(_0x54d216){if(_0x54d216){var _0x2dc550=_[_0xccae('0x2c')](_0x1b6fcf,function(_0x54445a){db['UserVoicePrefix'][_0xccae('0x57')]({'where':{'UserId':_0x54445a,'VoicePrefixId':_0x54d216[_0xccae('0x6d')]}});});return Promise[_0xccae('0x95')](_0x2dc550);}});});});}})['then'](respondWithStatusCode(_0x16f743,null))[_0xccae('0x45')](handleError(_0x16f743,null));};exports['getAgents']=function(_0x3eeb6e,_0xbf4081,_0x266684){var _0xc184a={};var _0x34af8e={};var _0x30c358;var _0x445df7;return db[_0xccae('0x2d')][_0xccae('0x72')]({'where':{'id':_0x3eeb6e[_0xccae('0x47')]['id']}})[_0xccae('0x27')](handleEntityNotFound(_0xbf4081,null))['then'](function(_0x44f6f5){if(_0x44f6f5){_0x30c358=_0x44f6f5;_0x34af8e['model']=_['keys'](db[_0xccae('0x88')][_0xccae('0x2e')]);_0x34af8e[_0xccae('0x32')]=_[_0xccae('0x33')](_0x3eeb6e[_0xccae('0x32')]);_0x34af8e['filters']=_[_0xccae('0x35')](_0x34af8e[_0xccae('0x31')],_0x34af8e[_0xccae('0x32')]);_0xc184a[_0xccae('0x36')]=_[_0xccae('0x35')](_0x34af8e['model'],qs[_0xccae('0x37')](_0x3eeb6e[_0xccae('0x32')]['fields']));_0xc184a[_0xccae('0x36')]=_0xc184a[_0xccae('0x36')][_0xccae('0x38')]?_0xc184a[_0xccae('0x36')]:_0x34af8e['model'];_0xc184a[_0xccae('0x3b')]=qs[_0xccae('0x3c')](_0x3eeb6e['query']['sort']);_0xc184a['where']=qs['filters'](_[_0xccae('0x3e')](_0x3eeb6e[_0xccae('0x32')],_0x34af8e[_0xccae('0x34')]));if(_0x3eeb6e['query'][_0xccae('0x3f')]){_0xc184a[_0xccae('0x3d')]=_[_0xccae('0x40')](_0xc184a[_0xccae('0x3d')],{'$or':_['map'](_0xc184a[_0xccae('0x36')],function(_0x5dd613){var _0x1dc8b2={};_0x1dc8b2[_0x5dd613]={'$like':'%'+_0x3eeb6e['query'][_0xccae('0x3f')]+'%'};return _0x1dc8b2;})});}_0xc184a=_['merge']({},_0xc184a,_0x3eeb6e['options']);return _0x30c358[_0xccae('0x9a')](_0xc184a);}})[_0xccae('0x27')](function(_0x51444d){if(_0x51444d){_0x445df7=_0x51444d[_0xccae('0x38')];if(!_0x3eeb6e['query']['hasOwnProperty'](_0xccae('0x3a'))){_0xc184a[_0xccae('0x1f')]=qs[_0xccae('0x1f')](_0x3eeb6e['query'][_0xccae('0x1f')]);_0xc184a[_0xccae('0x1d')]=qs[_0xccae('0x1d')](_0x3eeb6e['query'][_0xccae('0x1d')]);}return _0x30c358[_0xccae('0x9a')](_0xc184a);}})['then'](function(_0x56759a){if(_0x56759a){return _0x56759a?{'count':_0x445df7,'rows':_0x56759a}:null;}})['then'](respondWithResult(_0xbf4081,null))['catch'](handleError(_0xbf4081,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9e7e96f..b5aded1 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 _0x7b9c=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x238e36,_0x2881eb){var _0x187167=function(_0x1bbfd1){while(--_0x1bbfd1){_0x238e36['push'](_0x238e36['shift']());}};_0x187167(++_0x2881eb);}(_0x7b9c,0x186));var _0xc7b9=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0x7b9c[_0xe45b6d];return _0x4d6f47;};'use strict';var EventEmitter=require(_0xc7b9('0x0'));var Team=require(_0xc7b9('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc7b9('0x2')](0x0);var events={'afterCreate':_0xc7b9('0x3'),'afterUpdate':_0xc7b9('0x4'),'afterDestroy':_0xc7b9('0x5')};function emitEvent(_0x59de34){return function(_0x2fef9c,_0x1eca64,_0x39c880){TeamEvents[_0xc7b9('0x6')](_0x59de34+':'+_0x2fef9c['id'],_0x2fef9c);TeamEvents[_0xc7b9('0x6')](_0x59de34,_0x2fef9c);_0x39c880(null);};}for(var e in events){if(events[_0xc7b9('0x7')](e)){var event=events[e];Team[_0xc7b9('0x8')](e,emitEvent(event));}}module[_0xc7b9('0x9')]=TeamEvents; \ No newline at end of file +var _0x42c1=['hook','exports','events','../../mysqldb','Team','save','remove','emit','hasOwnProperty'];(function(_0x58b635,_0xc76a6b){var _0x552de0=function(_0x58af37){while(--_0x58af37){_0x58b635['push'](_0x58b635['shift']());}};_0x552de0(++_0xc76a6b);}(_0x42c1,0x89));var _0x142c=function(_0x5a37fa,_0x43d3c8){_0x5a37fa=_0x5a37fa-0x0;var _0x4bccfd=_0x42c1[_0x5a37fa];return _0x4bccfd;};'use strict';var EventEmitter=require(_0x142c('0x0'));var Team=require(_0x142c('0x1'))['db'][_0x142c('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x142c('0x3'),'afterUpdate':'update','afterDestroy':_0x142c('0x4')};function emitEvent(_0x36d99e){return function(_0x58c663,_0xace442,_0x40a657){TeamEvents[_0x142c('0x5')](_0x36d99e+':'+_0x58c663['id'],_0x58c663);TeamEvents[_0x142c('0x5')](_0x36d99e,_0x58c663);_0x40a657(null);};}for(var e in events){if(events[_0x142c('0x6')](e)){var event=events[e];Team[_0x142c('0x7')](e,emitEvent(event));}}module[_0x142c('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2e766fa..e6c375a 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 _0x2e94=['setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Mail','Sms','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x2e94,0xd3));var _0x42e9=function(_0x5f2435,_0xdd0fc){_0x5f2435=_0x5f2435-0x0;var _0x5378e1=_0x2e94[_0x5f2435];return _0x5378e1;};'use strict';var _=require(_0x42e9('0x0'));var attributes=require(_0x42e9('0x1'));function getQueuesByChannel(_0x261161,_0x4b0059){var _0x235921=_0x42e9('0x2')+_0x4b0059+'Queues';return _0x261161[_0x235921]()[_0x42e9('0x3')](function(_0x2c0588){return _[_0x42e9('0x4')](_0x2c0588,function(_0x189571){_0x189571[_0x42e9('0x5')](_0x42e9('0x6'),_0x4b0059);return _0x189571;});})[_0x42e9('0x7')](function(_0x32cb7a){throw _0x32cb7a;});}module[_0x42e9('0x8')]=function(_0x143ff8){return _0x143ff8['define'](_0x42e9('0x9'),attributes,{'tableName':_0x42e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x218893=this;var _0x4c7ab4=[_0x42e9('0xb'),_0x42e9('0xc'),_0x42e9('0xd'),'Openchannel',_0x42e9('0xe'),'Voice',_0x42e9('0xf')];return Promise[_0x42e9('0x10')]()['then'](function(){var _0x40ec60=_[_0x42e9('0x4')](_0x4c7ab4,function(_0x32ef9e){return getQueuesByChannel(_0x218893,_0x32ef9e);});return Promise[_0x42e9('0x11')](_0x40ec60);})[_0x42e9('0x7')](function(_0x57eb92){throw _0x57eb92;});}}});}; \ No newline at end of file +var _0x18aa=['Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports','define','Team','teams','Chat','Fax','Mail'];(function(_0x3b8a4b,_0x178436){var _0x1d23bd=function(_0x2345aa){while(--_0x2345aa){_0x3b8a4b['push'](_0x3b8a4b['shift']());}};_0x1d23bd(++_0x178436);}(_0x18aa,0x76));var _0xa18a=function(_0x4beab6,_0x435c41){_0x4beab6=_0x4beab6-0x0;var _0x1afbf9=_0x18aa[_0x4beab6];return _0x1afbf9;};'use strict';var _=require(_0xa18a('0x0'));var attributes=require(_0xa18a('0x1'));function getQueuesByChannel(_0x3c7051,_0x202242){var _0x17840e=_0xa18a('0x2')+_0x202242+_0xa18a('0x3');return _0x3c7051[_0x17840e]()[_0xa18a('0x4')](function(_0x2f3697){return _[_0xa18a('0x5')](_0x2f3697,function(_0x5036f5){_0x5036f5['setDataValue'](_0xa18a('0x6'),_0x202242);return _0x5036f5;});})[_0xa18a('0x7')](function(_0x2104fa){throw _0x2104fa;});}module[_0xa18a('0x8')]=function(_0x1904a2){return _0x1904a2[_0xa18a('0x9')](_0xa18a('0xa'),attributes,{'tableName':_0xa18a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x9d263b=this;var _0x7cec92=[_0xa18a('0xc'),_0xa18a('0xd'),_0xa18a('0xe'),'Openchannel','Sms',_0xa18a('0xf'),_0xa18a('0x10')];return Promise[_0xa18a('0x11')]()[_0xa18a('0x4')](function(){var _0x2b8990=_[_0xa18a('0x5')](_0x7cec92,function(_0x573fc7){return getQueuesByChannel(_0x9d263b,_0x573fc7);});return Promise[_0xa18a('0x12')](_0x2b8990);})[_0xa18a('0x7')](function(_0x198bbe){throw _0x198bbe;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b5871bf..1adbbec 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 _0x6047=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xe6a17,_0x560ff8){var _0x4f9e2c=function(_0x487fcf){while(--_0x487fcf){_0xe6a17['push'](_0xe6a17['shift']());}};_0x4f9e2c(++_0x560ff8);}(_0x6047,0x14b));var _0x7604=function(_0x5a64cd,_0x58bd28){_0x5a64cd=_0x5a64cd-0x0;var _0x41439c=_0x6047[_0x5a64cd];return _0x41439c;};'use strict';var _=require('lodash');var util=require(_0x7604('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7604('0x1'));var fs=require('fs');var Redis=require(_0x7604('0x2'));var db=require(_0x7604('0x3'))['db'];var utils=require(_0x7604('0x4'));var logger=require(_0x7604('0x5'))('rpc');var config=require(_0x7604('0x6'));var jayson=require(_0x7604('0x7'));var client=jayson[_0x7604('0x8')][_0x7604('0x9')]({'port':0x232a});config[_0x7604('0xa')]=_['defaults'](config[_0x7604('0xa')],{'host':_0x7604('0xb'),'port':0x18eb});var socket=require(_0x7604('0xc'))(new Redis(config[_0x7604('0xa')]));require(_0x7604('0xd'))[_0x7604('0xe')](socket);function respondWithRpcPromise(_0x44f44a,_0x2d2237,_0x167c04){return new BPromise(function(_0x3ce0a1,_0x24fafe){return client[_0x7604('0xf')](_0x44f44a,_0x167c04)[_0x7604('0x10')](function(_0x546af4){logger[_0x7604('0x11')](_0x7604('0x12'),_0x2d2237,_0x7604('0x13'));logger[_0x7604('0x14')](_0x7604('0x15'),_0x2d2237,'request\x20sent',JSON[_0x7604('0x16')](_0x546af4));if(_0x546af4[_0x7604('0x17')]){if(_0x546af4[_0x7604('0x17')]['code']===0x1f4){logger[_0x7604('0x17')](_0x7604('0x12'),_0x2d2237,_0x546af4[_0x7604('0x17')]['message']);return _0x24fafe(_0x546af4[_0x7604('0x17')][_0x7604('0x18')]);}logger['error'](_0x7604('0x12'),_0x2d2237,_0x546af4[_0x7604('0x17')][_0x7604('0x18')]);return _0x3ce0a1(_0x546af4[_0x7604('0x17')]['message']);}else{logger[_0x7604('0x11')](_0x7604('0x12'),_0x2d2237,'request\x20sent');_0x3ce0a1(_0x546af4['result']['message']);}})[_0x7604('0x19')](function(_0x4e2310){logger[_0x7604('0x17')]('Team,\x20%s,\x20%s',_0x2d2237,_0x4e2310);_0x24fafe(_0x4e2310);});});} \ No newline at end of file +var _0x7645=['redis','./team.socket','register','request','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','Team,\x20%s,\x20%s','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x7645,0x12d));var _0x5764=function(_0x521b1d,_0xfa68de){_0x521b1d=_0x521b1d-0x0;var _0x58abb9=_0x7645[_0x521b1d];return _0x58abb9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5764('0x0'));var BPromise=require(_0x5764('0x1'));var rs=require(_0x5764('0x2'));var fs=require('fs');var Redis=require(_0x5764('0x3'));var db=require(_0x5764('0x4'))['db'];var utils=require(_0x5764('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5764('0x6'));var jayson=require(_0x5764('0x7'));var client=jayson[_0x5764('0x8')][_0x5764('0x9')]({'port':0x232a});config['redis']=_[_0x5764('0xa')](config[_0x5764('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5764('0xb')]));require(_0x5764('0xc'))[_0x5764('0xd')](socket);function respondWithRpcPromise(_0x5f6e9c,_0x431deb,_0x68b73c){return new BPromise(function(_0x3c0a16,_0x5cf3bb){return client[_0x5764('0xe')](_0x5f6e9c,_0x68b73c)[_0x5764('0xf')](function(_0xe40930){logger['info']('Team,\x20%s,\x20%s',_0x431deb,_0x5764('0x10'));logger[_0x5764('0x11')](_0x5764('0x12'),_0x431deb,_0x5764('0x10'),JSON['stringify'](_0xe40930));if(_0xe40930[_0x5764('0x13')]){if(_0xe40930[_0x5764('0x13')]['code']===0x1f4){logger[_0x5764('0x13')]('Team,\x20%s,\x20%s',_0x431deb,_0xe40930[_0x5764('0x13')][_0x5764('0x14')]);return _0x5cf3bb(_0xe40930[_0x5764('0x13')][_0x5764('0x14')]);}logger['error'](_0x5764('0x15'),_0x431deb,_0xe40930['error'][_0x5764('0x14')]);return _0x3c0a16(_0xe40930['error'][_0x5764('0x14')]);}else{logger[_0x5764('0x16')](_0x5764('0x15'),_0x431deb,_0x5764('0x10'));_0x3c0a16(_0xe40930[_0x5764('0x17')][_0x5764('0x14')]);}})['catch'](function(_0x1d6137){logger[_0x5764('0x13')]('Team,\x20%s,\x20%s',_0x431deb,_0x1d6137);_0x5cf3bb(_0x1d6137);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0ad9256..d60dc9d 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 _0x3611=['emit','register','./team.events','update'];(function(_0x1c63b3,_0x597bc6){var _0x2f686e=function(_0x5e631a){while(--_0x5e631a){_0x1c63b3['push'](_0x1c63b3['shift']());}};_0x2f686e(++_0x597bc6);}(_0x3611,0x136));var _0x1361=function(_0x1dee55,_0x35fd64){_0x1dee55=_0x1dee55-0x0;var _0x2bb967=_0x3611[_0x1dee55];return _0x2bb967;};'use strict';var TeamEvents=require(_0x1361('0x0'));var events=['save','remove',_0x1361('0x1')];function createListener(_0x5aa6e6,_0x4da3ac){return function(_0x185d8b){_0x4da3ac[_0x1361('0x2')](_0x5aa6e6,_0x185d8b);};}function removeListener(_0x25db42,_0x383a70){return function(){TeamEvents['removeListener'](_0x25db42,_0x383a70);};}exports[_0x1361('0x3')]=function(_0x304832){for(var _0x5aa5dc=0x0,_0x216d22=events['length'];_0x5aa5dc<_0x216d22;_0x5aa5dc++){var _0x2af7c4=events[_0x5aa5dc];var _0x49cfad=createListener('team:'+_0x2af7c4,_0x304832);TeamEvents['on'](_0x2af7c4,_0x49cfad);}}; \ No newline at end of file +var _0xa496=['register','team:','./team.events','save','emit','removeListener'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xa496,0xf8));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x6a49('0x0'));var events=[_0x6a49('0x1'),'remove','update'];function createListener(_0x562fd0,_0x5dc311){return function(_0x5247ea){_0x5dc311[_0x6a49('0x2')](_0x562fd0,_0x5247ea);};}function removeListener(_0x4deb7c,_0x2e5c58){return function(){TeamEvents[_0x6a49('0x3')](_0x4deb7c,_0x2e5c58);};}exports[_0x6a49('0x4')]=function(_0x55f94b){for(var _0x479d75=0x0,_0x183a2a=events['length'];_0x479d75<_0x183a2a;_0x479d75++){var _0x4a5aa9=events[_0x479d75];var _0x517255=createListener(_0x6a49('0x5')+_0x4a5aa9,_0x55f94b);TeamEvents['on'](_0x4a5aa9,_0x517255);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 34f3684..add1cd7 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 _0x6482=['exports','INTEGER'];(function(_0x4dd71c,_0x23a24e){var _0x8e4e36=function(_0x5c0e){while(--_0x5c0e){_0x4dd71c['push'](_0x4dd71c['shift']());}};_0x8e4e36(++_0x23a24e);}(_0x6482,0xb0));var _0x2648=function(_0x5c7353,_0x34de45){_0x5c7353=_0x5c7353-0x0;var _0x24bfea=_0x6482[_0x5c7353];return _0x24bfea;};'use strict';var Sequelize=require('sequelize');module[_0x2648('0x0')]={'TeamId':{'type':Sequelize[_0x2648('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x2648('0x1')]}}; \ No newline at end of file +var _0x8aef=['INTEGER','sequelize'];(function(_0x76d100,_0x20e645){var _0x5d9d0c=function(_0x14a7d9){while(--_0x14a7d9){_0x76d100['push'](_0x76d100['shift']());}};_0x5d9d0c(++_0x20e645);}(_0x8aef,0x189));var _0xf8ae=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8aef[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xf8ae('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xf8ae('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 1864aa9..6765be2 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 _0x574d=['moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x2b4b93,_0x13deea){var _0x1aeb3d=function(_0x87afb4){while(--_0x87afb4){_0x2b4b93['push'](_0x2b4b93['shift']());}};_0x1aeb3d(++_0x13deea);}(_0x574d,0xc0));var _0xd574=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x574d[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var logger=require(_0xd574('0x2'))(_0xd574('0x3'));var moment=require(_0xd574('0x4'));var BPromise=require(_0xd574('0x5'));var rp=require(_0xd574('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd574('0x7'));var config=require(_0xd574('0x8'));var attributes=require(_0xd574('0x9'));module[_0xd574('0xa')]=function(_0x56ecee,_0x16a152){return _0x56ecee[_0xd574('0xb')](_0xd574('0xc'),attributes,{'tableName':_0xd574('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x566f=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x58050d,_0x538a8d){var _0x27ca39=function(_0x2043fb){while(--_0x2043fb){_0x58050d['push'](_0x58050d['shift']());}};_0x27ca39(++_0x538a8d);}(_0x566f,0x124));var _0xf566=function(_0x5db4be,_0x22545c){_0x5db4be=_0x5db4be-0x0;var _0x42133c=_0x566f[_0x5db4be];return _0x42133c;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var logger=require(_0xf566('0x2'))(_0xf566('0x3'));var moment=require(_0xf566('0x4'));var BPromise=require(_0xf566('0x5'));var rp=require(_0xf566('0x6'));var fs=require('fs');var path=require(_0xf566('0x7'));var rimraf=require('rimraf');var config=require(_0xf566('0x8'));var attributes=require(_0xf566('0x9'));module[_0xf566('0xa')]=function(_0x117398,_0x5898ea){return _0x117398[_0xf566('0xb')](_0xf566('0xc'),attributes,{'tableName':_0xf566('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 871e4c6..7ae9051 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xd8403a,_0x567163){var _0x3a52ac=function(_0x3dfb0d){while(--_0x3dfb0d){_0xd8403a['push'](_0xd8403a['shift']());}};_0x3a52ac(++_0x567163);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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(_0x10b362,_0xf4ec1a){var _0x175288=function(_0x50ab5e){while(--_0x50ab5e){_0x10b362['push'](_0x10b362['shift']());}};_0x175288(++_0xf4ec1a);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0b16d0f..dbbe0ae 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 _0x9d36=['exports','INTEGER','sequelize'];(function(_0x3d0fb4,_0x4e5464){var _0xea699f=function(_0x3f863d){while(--_0x3f863d){_0x3d0fb4['push'](_0x3d0fb4['shift']());}};_0xea699f(++_0x4e5464);}(_0x9d36,0x68));var _0x69d3=function(_0x4c03e1,_0x2f049f){_0x4c03e1=_0x4c03e1-0x0;var _0x1798db=_0x9d36[_0x4c03e1];return _0x1798db;};'use strict';var Sequelize=require(_0x69d3('0x0'));module[_0x69d3('0x1')]={'penalty':{'type':Sequelize[_0x69d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd19=['sequelize','exports','INTEGER'];(function(_0x582e18,_0x4fd856){var _0x445d03=function(_0x112957){while(--_0x112957){_0x582e18['push'](_0x582e18['shift']());}};_0x445d03(++_0x4fd856);}(_0xbd19,0x9c));var _0x9bd1=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xbd19[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]={'penalty':{'type':Sequelize[_0x9bd1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 308f2b9..7c7298a 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 _0xad8a=['path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5428f5,_0x363285){var _0xf745ce=function(_0x16dbe2){while(--_0x16dbe2){_0x5428f5['push'](_0x5428f5['shift']());}};_0xf745ce(++_0x363285);}(_0xad8a,0xb0));var _0xaad8=function(_0x545a4a,_0x5b39a3){_0x545a4a=_0x545a4a-0x0;var _0xc3f5d2=_0xad8a[_0x545a4a];return _0xc3f5d2;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var logger=require(_0xaad8('0x2'))(_0xaad8('0x3'));var moment=require(_0xaad8('0x4'));var BPromise=require('bluebird');var rp=require(_0xaad8('0x5'));var fs=require('fs');var path=require(_0xaad8('0x6'));var rimraf=require(_0xaad8('0x7'));var config=require('../../config/environment');var attributes=require(_0xaad8('0x8'));module[_0xaad8('0x9')]=function(_0x22c799,_0xeb5d15){return _0x22c799[_0xaad8('0xa')](_0xaad8('0xb'),attributes,{'tableName':_0xaad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ddd=['exports','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x1d64c2,_0x12fd66){var _0x4ccd83=function(_0x3f7f52){while(--_0x3f7f52){_0x1d64c2['push'](_0x1d64c2['shift']());}};_0x4ccd83(++_0x12fd66);}(_0x6ddd,0xae));var _0xd6dd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6ddd[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6dd('0x0'))(_0xd6dd('0x1'));var moment=require(_0xd6dd('0x2'));var BPromise=require(_0xd6dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6dd('0x4'));var rimraf=require('rimraf');var config=require(_0xd6dd('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0xd6dd('0x6')]=function(_0x27439a,_0x47005f){return _0x27439a['define'](_0xd6dd('0x7'),attributes,{'tableName':_0xd6dd('0x8'),'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 54a4c1a..0d58cb1 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 _0x43f7=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x227c55,_0x49db56){var _0x49e02b=function(_0x5bdd70){while(--_0x5bdd70){_0x227c55['push'](_0x227c55['shift']());}};_0x49e02b(++_0x49db56);}(_0x43f7,0x8e));var _0x743f=function(_0xf5c182,_0x3eefa7){_0xf5c182=_0xf5c182-0x0;var _0x2416d0=_0x43f7[_0xf5c182];return _0x2416d0;};'use strict';var _=require(_0x743f('0x0'));var util=require(_0x743f('0x1'));var moment=require(_0x743f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x743f('0x3'))['db'];var utils=require(_0x743f('0x4'));var logger=require(_0x743f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x743f('0x6'));var client=jayson[_0x743f('0x7')][_0x743f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ff159,_0x79ce26,_0x62b4f9){return new BPromise(function(_0x528da9,_0x192dbc){return client[_0x743f('0x9')](_0x4ff159,_0x62b4f9)[_0x743f('0xa')](function(_0x235712){logger[_0x743f('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x79ce26,_0x743f('0xc'));logger[_0x743f('0xd')](_0x743f('0xe'),_0x79ce26,'request\x20sent',JSON[_0x743f('0xf')](_0x235712));if(_0x235712[_0x743f('0x10')]){if(_0x235712['error'][_0x743f('0x11')]===0x1f4){logger[_0x743f('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x79ce26,_0x235712[_0x743f('0x10')][_0x743f('0x12')]);return _0x192dbc(_0x235712[_0x743f('0x10')][_0x743f('0x12')]);}logger[_0x743f('0x10')](_0x743f('0x13'),_0x79ce26,_0x235712[_0x743f('0x10')]['message']);return _0x528da9(_0x235712[_0x743f('0x10')][_0x743f('0x12')]);}else{logger[_0x743f('0xb')](_0x743f('0x13'),_0x79ce26,_0x743f('0xc'));_0x528da9(_0x235712[_0x743f('0x14')][_0x743f('0x12')]);}})[_0x743f('0x15')](function(_0x2fdfd1){logger[_0x743f('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x79ce26,_0x2fdfd1);_0x192dbc(_0x2fdfd1);});});} \ No newline at end of file +var _0xd3ee=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1e9292,_0xcb4da9){var _0x148b89=function(_0x221f11){while(--_0x221f11){_0x1e9292['push'](_0x1e9292['shift']());}};_0x148b89(++_0xcb4da9);}(_0xd3ee,0x1b2));var _0xed3e=function(_0x2f1d10,_0x49296b){_0x2f1d10=_0x2f1d10-0x0;var _0x23e49b=_0xd3ee[_0x2f1d10];return _0x23e49b;};'use strict';var _=require(_0xed3e('0x0'));var util=require(_0xed3e('0x1'));var moment=require('moment');var BPromise=require(_0xed3e('0x2'));var rs=require(_0xed3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed3e('0x4'))['db'];var utils=require(_0xed3e('0x5'));var logger=require('../../config/logger')(_0xed3e('0x6'));var config=require(_0xed3e('0x7'));var jayson=require(_0xed3e('0x8'));var client=jayson[_0xed3e('0x9')][_0xed3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x453cdf,_0x779d31,_0x4cfd49){return new BPromise(function(_0x359fe3,_0x219e22){return client['request'](_0x453cdf,_0x4cfd49)[_0xed3e('0xb')](function(_0x270bb7){logger[_0xed3e('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x779d31,_0xed3e('0xd'));logger[_0xed3e('0xe')](_0xed3e('0xf'),_0x779d31,'request\x20sent',JSON['stringify'](_0x270bb7));if(_0x270bb7[_0xed3e('0x10')]){if(_0x270bb7[_0xed3e('0x10')][_0xed3e('0x11')]===0x1f4){logger[_0xed3e('0x10')](_0xed3e('0x12'),_0x779d31,_0x270bb7['error'][_0xed3e('0x13')]);return _0x219e22(_0x270bb7[_0xed3e('0x10')][_0xed3e('0x13')]);}logger[_0xed3e('0x10')](_0xed3e('0x12'),_0x779d31,_0x270bb7[_0xed3e('0x10')][_0xed3e('0x13')]);return _0x359fe3(_0x270bb7['error'][_0xed3e('0x13')]);}else{logger[_0xed3e('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x779d31,'request\x20sent');_0x359fe3(_0x270bb7[_0xed3e('0x14')][_0xed3e('0x13')]);}})[_0xed3e('0x15')](function(_0x276731){logger[_0xed3e('0x10')](_0xed3e('0x12'),_0x779d31,_0x276731);_0x219e22(_0x276731);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 29dd708..defafef 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 _0xd142=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','update','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4310b2,_0x5a8c78){var _0x383734=function(_0x4bedf0){while(--_0x4bedf0){_0x4310b2['push'](_0x4310b2['shift']());}};_0x383734(++_0x5a8c78);}(_0xd142,0x11a));var _0x2d14=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0xd142[_0xd5584e];return _0xdc594e;};'use strict';var multer=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var path=require(_0x2d14('0x2'));var timeout=require(_0x2d14('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d14('0x4'));var auth=require(_0x2d14('0x5'));var interaction=require(_0x2d14('0x6'));var config=require(_0x2d14('0x7'));var controller=require(_0x2d14('0x8'));router[_0x2d14('0x9')]('/',auth[_0x2d14('0xa')](),controller[_0x2d14('0xb')]);router[_0x2d14('0x9')](_0x2d14('0xc'),auth[_0x2d14('0xa')](),controller[_0x2d14('0xd')]);router['post']('/',auth[_0x2d14('0xa')](),controller[_0x2d14('0xe')]);router['put'](_0x2d14('0xc'),auth[_0x2d14('0xa')](),controller[_0x2d14('0xf')]);router['delete'](_0x2d14('0xc'),auth[_0x2d14('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd7d5=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./template.controller','get'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x113301,_0x187fec){_0x113301=_0x113301-0x0;var _0x4481f1=_0xd7d5[_0x113301];return _0x4481f1;};'use strict';var multer=require(_0x5d7d('0x0'));var util=require(_0x5d7d('0x1'));var path=require(_0x5d7d('0x2'));var timeout=require(_0x5d7d('0x3'));var express=require(_0x5d7d('0x4'));var router=express[_0x5d7d('0x5')]();var fs_extra=require(_0x5d7d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5d7d('0x7'));var config=require('../../config/environment');var controller=require(_0x5d7d('0x8'));router[_0x5d7d('0x9')]('/',auth[_0x5d7d('0xa')](),controller[_0x5d7d('0xb')]);router[_0x5d7d('0x9')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0xd')]);router[_0x5d7d('0xe')]('/',auth[_0x5d7d('0xa')](),controller['create']);router[_0x5d7d('0xf')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0x10')]);router[_0x5d7d('0x11')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0x12')]);module[_0x5d7d('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 59b3667..2dc4410 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 _0x8ec2=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ec2,0x123));var _0x28ec=function(_0x5ba5c7,_0x1caf61){_0x5ba5c7=_0x5ba5c7-0x0;var _0x574a48=_0x8ec2[_0x5ba5c7];return _0x574a48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x28ec('0x0')]},'description':{'type':Sequelize[_0x28ec('0x0')]},'html':{'type':Sequelize[_0x28ec('0x1')]}}; \ No newline at end of file +var _0x1431=['STRING','TEXT','sequelize','exports'];(function(_0x5f18a1,_0x5aa5e5){var _0xf65dd6=function(_0x4be977){while(--_0x4be977){_0x5f18a1['push'](_0x5f18a1['shift']());}};_0xf65dd6(++_0x5aa5e5);}(_0x1431,0xd2));var _0x1143=function(_0x137bc2,_0x439fdb){_0x137bc2=_0x137bc2-0x0;var _0x15f809=_0x1431[_0x137bc2];return _0x15f809;};'use strict';var Sequelize=require(_0x1143('0x0'));module[_0x1143('0x1')]={'name':{'type':Sequelize[_0x1143('0x2')]},'description':{'type':Sequelize[_0x1143('0x2')]},'html':{'type':Sequelize[_0x1143('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index eb5e9a9..651e96a 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 _0xe91a=['type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','Templates','UserProfileResource','end','stack','name','Template','fieldName'];(function(_0x2c81aa,_0x44b52b){var _0x4b0b3e=function(_0x317f06){while(--_0x317f06){_0x2c81aa['push'](_0x2c81aa['shift']());}};_0x4b0b3e(++_0x44b52b);}(_0xe91a,0x11a));var _0xae91=function(_0xaf7ed2,_0xf6f0c4){_0xaf7ed2=_0xaf7ed2-0x0;var _0x2904f4=_0xe91a[_0xaf7ed2];return _0x2904f4;};'use strict';var emlformat=require(_0xae91('0x0'));var rimraf=require(_0xae91('0x1'));var zipdir=require(_0xae91('0x2'));var jsonpatch=require(_0xae91('0x3'));var rp=require(_0xae91('0x4'));var moment=require(_0xae91('0x5'));var BPromise=require(_0xae91('0x6'));var Mustache=require(_0xae91('0x7'));var util=require(_0xae91('0x8'));var path=require(_0xae91('0x9'));var sox=require(_0xae91('0xa'));var csv=require(_0xae91('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae91('0xc'));var squel=require(_0xae91('0xd'));var crypto=require('crypto');var jsforce=require(_0xae91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xae91('0xb'));var querystring=require(_0xae91('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae91('0x10'));var as=require(_0xae91('0x11'));var hardwareService=require(_0xae91('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xae91('0x13'));var config=require(_0xae91('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x895618,_0x4aa62a){_0x4aa62a=_0x4aa62a||0xcc;return function(_0x24f570){if(_0x24f570){return _0x895618[_0xae91('0x15')](_0x4aa62a);}return _0x895618[_0xae91('0x16')](_0x4aa62a)['end']();};}function respondWithResult(_0x6e1f56,_0x28a1fa){_0x28a1fa=_0x28a1fa||0xc8;return function(_0x4dedc3){if(_0x4dedc3){return _0x6e1f56[_0xae91('0x16')](_0x28a1fa)[_0xae91('0x17')](_0x4dedc3);}};}function respondWithFilteredResult(_0x49c253,_0x17ad90){return function(_0xc09205){if(_0xc09205){var _0x3212d0=typeof _0x17ad90[_0xae91('0x18')]===_0xae91('0x19')&&typeof _0x17ad90['limit']==='undefined';var _0x511838=_0xc09205['count'];var _0x4cc943=_0x3212d0?0x0:_0x17ad90[_0xae91('0x18')];var _0x315811=_0x3212d0?_0xc09205[_0xae91('0x1a')]:_0x17ad90[_0xae91('0x18')]+_0x17ad90[_0xae91('0x1b')];var _0x504a94;if(_0x315811>=_0x511838){_0x315811=_0x511838;_0x504a94=0xc8;}else{_0x504a94=0xce;}_0x49c253[_0xae91('0x16')](_0x504a94);return _0x49c253[_0xae91('0x1c')]('Content-Range',_0x4cc943+'-'+_0x315811+'/'+_0x511838)[_0xae91('0x17')](_0xc09205);}return null;};}function patchUpdates(_0xe19b86){return function(_0x3b53d2){try{jsonpatch[_0xae91('0x1d')](_0x3b53d2,_0xe19b86,!![]);}catch(_0x352a03){return BPromise[_0xae91('0x1e')](_0x352a03);}return _0x3b53d2[_0xae91('0x1f')]();};}function saveUpdates(_0x41712a,_0x34592e){return function(_0x2dd9f0){if(_0x2dd9f0){return _0x2dd9f0['update'](_0x41712a)[_0xae91('0x20')](function(_0x2ba526){return _0x2ba526;});}return null;};}function removeEntity(_0x15aed1,_0x2b69b1){return function(_0x58ffcc){if(_0x58ffcc){return _0x58ffcc[_0xae91('0x21')]()['then'](function(){var _0x4996bf=_0x58ffcc[_0xae91('0x22')]({'plain':!![]});var _0xe5c97d=_0xae91('0x23');return db[_0xae91('0x24')][_0xae91('0x21')]({'where':{'type':_0xe5c97d,'resourceId':_0x4996bf['id']}})['then'](function(){return _0x58ffcc;});})[_0xae91('0x20')](function(){_0x15aed1[_0xae91('0x16')](0xcc)[_0xae91('0x25')]();});}};}function handleEntityNotFound(_0x15279a,_0x650ada){return function(_0x1b91cc){if(!_0x1b91cc){_0x15279a[_0xae91('0x15')](0x194);}return _0x1b91cc;};}function handleError(_0x5c52d2,_0x11c003){_0x11c003=_0x11c003||0x1f4;return function(_0x1cf218){logger['error'](_0x1cf218[_0xae91('0x26')]);if(_0x1cf218[_0xae91('0x27')]){delete _0x1cf218['name'];}_0x5c52d2['status'](_0x11c003)['send'](_0x1cf218);};}exports['index']=function(_0x25e1b4,_0xa5121a){var _0x327fa6={},_0x4de2e2={},_0x2abc49={'count':0x0,'rows':[]};var _0x451ef5=_['map'](db[_0xae91('0x28')]['rawAttributes'],function(_0x3b8df7){return{'name':_0x3b8df7[_0xae91('0x29')],'type':_0x3b8df7[_0xae91('0x2a')][_0xae91('0x2b')]};});_0x4de2e2['model']=_[_0xae91('0x2c')](_0x451ef5,_0xae91('0x27'));_0x4de2e2[_0xae91('0x2d')]=_['keys'](_0x25e1b4['query']);_0x4de2e2['filters']=_[_0xae91('0x2e')](_0x4de2e2[_0xae91('0x2f')],_0x4de2e2[_0xae91('0x2d')]);_0x327fa6[_0xae91('0x30')]=_[_0xae91('0x2e')](_0x4de2e2[_0xae91('0x2f')],qs[_0xae91('0x31')](_0x25e1b4[_0xae91('0x2d')][_0xae91('0x31')]));_0x327fa6[_0xae91('0x30')]=_0x327fa6[_0xae91('0x30')]['length']?_0x327fa6['attributes']:_0x4de2e2[_0xae91('0x2f')];if(!_0x25e1b4[_0xae91('0x2d')][_0xae91('0x32')](_0xae91('0x33'))){_0x327fa6[_0xae91('0x1b')]=qs[_0xae91('0x1b')](_0x25e1b4['query'][_0xae91('0x1b')]);_0x327fa6[_0xae91('0x18')]=qs[_0xae91('0x18')](_0x25e1b4[_0xae91('0x2d')][_0xae91('0x18')]);}_0x327fa6[_0xae91('0x34')]=qs[_0xae91('0x35')](_0x25e1b4[_0xae91('0x2d')][_0xae91('0x35')]);_0x327fa6[_0xae91('0x36')]=qs[_0xae91('0x37')](_['pick'](_0x25e1b4['query'],_0x4de2e2[_0xae91('0x37')]),_0x451ef5);if(_0x25e1b4[_0xae91('0x2d')][_0xae91('0x38')]){_0x327fa6['where']=_[_0xae91('0x39')](_0x327fa6[_0xae91('0x36')],{'$or':_['map'](_0x451ef5,function(_0x12e684){if(_0x12e684[_0xae91('0x2a')]!=='VIRTUAL'){var _0x52c1a5={};_0x52c1a5[_0x12e684[_0xae91('0x27')]]={'$like':'%'+_0x25e1b4[_0xae91('0x2d')][_0xae91('0x38')]+'%'};return _0x52c1a5;}})});}_0x327fa6=_['merge']({},_0x327fa6,_0x25e1b4['options']);var _0x5a3dc0={'where':_0x327fa6['where']};return db['Template']['count'](_0x5a3dc0)[_0xae91('0x20')](function(_0x1cba26){_0x2abc49['count']=_0x1cba26;if(_0x25e1b4[_0xae91('0x2d')][_0xae91('0x3a')]){_0x327fa6[_0xae91('0x3b')]=[{'all':!![]}];}return db['Template'][_0xae91('0x3c')](_0x327fa6);})[_0xae91('0x20')](function(_0x5dc29d){_0x2abc49[_0xae91('0x3d')]=_0x5dc29d;return _0x2abc49;})[_0xae91('0x20')](respondWithFilteredResult(_0xa5121a,_0x327fa6))[_0xae91('0x3e')](handleError(_0xa5121a,null));};exports[_0xae91('0x3f')]=function(_0x50f02f,_0x12b3c6){var _0x2ebb9c={'raw':!![],'where':{'id':_0x50f02f[_0xae91('0x40')]['id']}},_0x5cd73a={};_0x5cd73a[_0xae91('0x2f')]=_[_0xae91('0x41')](db['Template'][_0xae91('0x42')]);_0x5cd73a[_0xae91('0x2d')]=_[_0xae91('0x41')](_0x50f02f[_0xae91('0x2d')]);_0x5cd73a[_0xae91('0x37')]=_[_0xae91('0x2e')](_0x5cd73a[_0xae91('0x2f')],_0x5cd73a[_0xae91('0x2d')]);_0x2ebb9c['attributes']=_[_0xae91('0x2e')](_0x5cd73a[_0xae91('0x2f')],qs[_0xae91('0x31')](_0x50f02f['query'][_0xae91('0x31')]));_0x2ebb9c[_0xae91('0x30')]=_0x2ebb9c[_0xae91('0x30')][_0xae91('0x43')]?_0x2ebb9c[_0xae91('0x30')]:_0x5cd73a[_0xae91('0x2f')];if(_0x50f02f[_0xae91('0x2d')]['includeAll']){_0x2ebb9c[_0xae91('0x3b')]=[{'all':!![]}];}_0x2ebb9c=_[_0xae91('0x39')]({},_0x2ebb9c,_0x50f02f[_0xae91('0x44')]);return db[_0xae91('0x28')][_0xae91('0x45')](_0x2ebb9c)[_0xae91('0x20')](handleEntityNotFound(_0x12b3c6,null))['then'](respondWithResult(_0x12b3c6,null))[_0xae91('0x3e')](handleError(_0x12b3c6,null));};exports[_0xae91('0x46')]=function(_0x56f182,_0xf3ced2){return db[_0xae91('0x28')][_0xae91('0x46')](_0x56f182[_0xae91('0x47')],{})[_0xae91('0x20')](function(_0x4c6209){var _0x3883cc=_0x56f182[_0xae91('0x48')][_0xae91('0x22')]({'plain':!![]});if(!_0x3883cc)throw new Error(_0xae91('0x49'));if(_0x3883cc[_0xae91('0x4a')]===_0xae91('0x48')){var _0x1be2d5=_0x4c6209[_0xae91('0x22')]({'plain':!![]});var _0xd8c449=_0xae91('0x23');return db[_0xae91('0x4b')]['find']({'where':{'name':_0xd8c449,'userProfileId':_0x3883cc[_0xae91('0x4c')]},'raw':!![]})['then'](function(_0x49a124){if(_0x49a124&&_0x49a124[_0xae91('0x4d')]===0x0){return db[_0xae91('0x24')][_0xae91('0x46')]({'name':_0x1be2d5[_0xae91('0x27')],'resourceId':_0x1be2d5['id'],'type':_0x49a124[_0xae91('0x27')],'sectionId':_0x49a124['id']},{})[_0xae91('0x20')](function(){return _0x4c6209;});}else{return _0x4c6209;}})['catch'](function(_0x5c2bc5){logger[_0xae91('0x4e')](_0xae91('0x4f'),_0x5c2bc5);throw _0x5c2bc5;});}return _0x4c6209;})['then'](respondWithResult(_0xf3ced2,0xc9))['catch'](handleError(_0xf3ced2,null));};exports[_0xae91('0x50')]=function(_0x2d6f20,_0x3a1c8b){if(_0x2d6f20[_0xae91('0x47')]['id']){delete _0x2d6f20[_0xae91('0x47')]['id'];}return db['Template']['find']({'where':{'id':_0x2d6f20[_0xae91('0x40')]['id']}})[_0xae91('0x20')](handleEntityNotFound(_0x3a1c8b,null))[_0xae91('0x20')](saveUpdates(_0x2d6f20['body'],null))[_0xae91('0x20')](respondWithResult(_0x3a1c8b,null))[_0xae91('0x3e')](handleError(_0x3a1c8b,null));};exports['destroy']=function(_0xf92d29,_0x1887bf){return db['Template'][_0xae91('0x45')]({'where':{'id':_0xf92d29['params']['id']}})[_0xae91('0x20')](handleEntityNotFound(_0x1887bf,null))['then'](removeEntity(_0x1887bf,null))[_0xae91('0x3e')](handleError(_0x1887bf,null));}; \ No newline at end of file +var _0x0b60=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','get','user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x0b60,0x8b));var _0x00b6=function(_0x40f5d4,_0x5c7478){_0x40f5d4=_0x40f5d4-0x0;var _0x4408b9=_0x0b60[_0x40f5d4];return _0x4408b9;};'use strict';var emlformat=require(_0x00b6('0x0'));var rimraf=require(_0x00b6('0x1'));var zipdir=require(_0x00b6('0x2'));var jsonpatch=require(_0x00b6('0x3'));var rp=require(_0x00b6('0x4'));var moment=require('moment');var BPromise=require(_0x00b6('0x5'));var Mustache=require(_0x00b6('0x6'));var util=require(_0x00b6('0x7'));var path=require(_0x00b6('0x8'));var sox=require(_0x00b6('0x9'));var csv=require('to-csv');var ejs=require(_0x00b6('0xa'));var fs=require('fs');var fs_extra=require(_0x00b6('0xb'));var _=require('lodash');var squel=require(_0x00b6('0xc'));var crypto=require(_0x00b6('0xd'));var jsforce=require(_0x00b6('0xe'));var deskjs=require(_0x00b6('0xf'));var toCsv=require(_0x00b6('0x10'));var querystring=require(_0x00b6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00b6('0x13'));var logger=require(_0x00b6('0x14'))(_0x00b6('0x15'));var utils=require(_0x00b6('0x16'));var config=require(_0x00b6('0x17'));var licenseUtil=require(_0x00b6('0x18'));var db=require(_0x00b6('0x19'))['db'];function respondWithStatusCode(_0x19d816,_0x4d134f){_0x4d134f=_0x4d134f||0xcc;return function(_0x48a34a){if(_0x48a34a){return _0x19d816[_0x00b6('0x1a')](_0x4d134f);}return _0x19d816[_0x00b6('0x1b')](_0x4d134f)['end']();};}function respondWithResult(_0x23c930,_0x164013){_0x164013=_0x164013||0xc8;return function(_0x4b5750){if(_0x4b5750){return _0x23c930[_0x00b6('0x1b')](_0x164013)[_0x00b6('0x1c')](_0x4b5750);}};}function respondWithFilteredResult(_0x4b4046,_0x15759f){return function(_0x3fa3c3){if(_0x3fa3c3){var _0x1393b3=typeof _0x15759f[_0x00b6('0x1d')]===_0x00b6('0x1e')&&typeof _0x15759f[_0x00b6('0x1f')]===_0x00b6('0x1e');var _0x45bc2c=_0x3fa3c3[_0x00b6('0x20')];var _0x5247fc=_0x1393b3?0x0:_0x15759f[_0x00b6('0x1d')];var _0x26d082=_0x1393b3?_0x3fa3c3[_0x00b6('0x20')]:_0x15759f['offset']+_0x15759f['limit'];var _0x54afc0;if(_0x26d082>=_0x45bc2c){_0x26d082=_0x45bc2c;_0x54afc0=0xc8;}else{_0x54afc0=0xce;}_0x4b4046[_0x00b6('0x1b')](_0x54afc0);return _0x4b4046[_0x00b6('0x21')](_0x00b6('0x22'),_0x5247fc+'-'+_0x26d082+'/'+_0x45bc2c)[_0x00b6('0x1c')](_0x3fa3c3);}return null;};}function patchUpdates(_0x29c07b){return function(_0x377b65){try{jsonpatch[_0x00b6('0x23')](_0x377b65,_0x29c07b,!![]);}catch(_0x5765a6){return BPromise[_0x00b6('0x24')](_0x5765a6);}return _0x377b65[_0x00b6('0x25')]();};}function saveUpdates(_0x1e395d,_0x14628e){return function(_0x26e039){if(_0x26e039){return _0x26e039[_0x00b6('0x26')](_0x1e395d)[_0x00b6('0x27')](function(_0x3b66f6){return _0x3b66f6;});}return null;};}function removeEntity(_0x27bd87,_0x5ecc07){return function(_0xc529f4){if(_0xc529f4){return _0xc529f4[_0x00b6('0x28')]()[_0x00b6('0x27')](function(){var _0x5895c7=_0xc529f4['get']({'plain':!![]});var _0x58dec4=_0x00b6('0x29');return db[_0x00b6('0x2a')][_0x00b6('0x28')]({'where':{'type':_0x58dec4,'resourceId':_0x5895c7['id']}})[_0x00b6('0x27')](function(){return _0xc529f4;});})[_0x00b6('0x27')](function(){_0x27bd87[_0x00b6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b347,_0x4775d4){return function(_0x4fbaca){if(!_0x4fbaca){_0x41b347['sendStatus'](0x194);}return _0x4fbaca;};}function handleError(_0x7d0945,_0x5080fe){_0x5080fe=_0x5080fe||0x1f4;return function(_0x3f8c42){logger[_0x00b6('0x2b')](_0x3f8c42[_0x00b6('0x2c')]);if(_0x3f8c42['name']){delete _0x3f8c42[_0x00b6('0x2d')];}_0x7d0945[_0x00b6('0x1b')](_0x5080fe)[_0x00b6('0x2e')](_0x3f8c42);};}exports[_0x00b6('0x2f')]=function(_0x500a79,_0xb39b8a){var _0xffc37={},_0x70f0e6={},_0x260771={'count':0x0,'rows':[]};var _0x32e97e=_[_0x00b6('0x30')](db[_0x00b6('0x31')][_0x00b6('0x32')],function(_0x1a5d82){return{'name':_0x1a5d82['fieldName'],'type':_0x1a5d82[_0x00b6('0x33')][_0x00b6('0x34')]};});_0x70f0e6['model']=_['map'](_0x32e97e,'name');_0x70f0e6[_0x00b6('0x35')]=_[_0x00b6('0x36')](_0x500a79[_0x00b6('0x35')]);_0x70f0e6[_0x00b6('0x37')]=_[_0x00b6('0x38')](_0x70f0e6[_0x00b6('0x39')],_0x70f0e6['query']);_0xffc37[_0x00b6('0x3a')]=_[_0x00b6('0x38')](_0x70f0e6[_0x00b6('0x39')],qs[_0x00b6('0x3b')](_0x500a79['query']['fields']));_0xffc37[_0x00b6('0x3a')]=_0xffc37[_0x00b6('0x3a')][_0x00b6('0x3c')]?_0xffc37['attributes']:_0x70f0e6[_0x00b6('0x39')];if(!_0x500a79['query']['hasOwnProperty'](_0x00b6('0x3d'))){_0xffc37[_0x00b6('0x1f')]=qs[_0x00b6('0x1f')](_0x500a79[_0x00b6('0x35')][_0x00b6('0x1f')]);_0xffc37[_0x00b6('0x1d')]=qs[_0x00b6('0x1d')](_0x500a79[_0x00b6('0x35')]['offset']);}_0xffc37['order']=qs[_0x00b6('0x3e')](_0x500a79[_0x00b6('0x35')][_0x00b6('0x3e')]);_0xffc37[_0x00b6('0x3f')]=qs[_0x00b6('0x37')](_[_0x00b6('0x40')](_0x500a79[_0x00b6('0x35')],_0x70f0e6[_0x00b6('0x37')]),_0x32e97e);if(_0x500a79['query'][_0x00b6('0x41')]){_0xffc37[_0x00b6('0x3f')]=_[_0x00b6('0x42')](_0xffc37[_0x00b6('0x3f')],{'$or':_[_0x00b6('0x30')](_0x32e97e,function(_0x563848){if(_0x563848[_0x00b6('0x33')]!=='VIRTUAL'){var _0x425863={};_0x425863[_0x563848[_0x00b6('0x2d')]]={'$like':'%'+_0x500a79[_0x00b6('0x35')][_0x00b6('0x41')]+'%'};return _0x425863;}})});}_0xffc37=_[_0x00b6('0x42')]({},_0xffc37,_0x500a79[_0x00b6('0x43')]);var _0x45ea5f={'where':_0xffc37[_0x00b6('0x3f')]};return db[_0x00b6('0x31')][_0x00b6('0x20')](_0x45ea5f)[_0x00b6('0x27')](function(_0x5df4d7){_0x260771[_0x00b6('0x20')]=_0x5df4d7;if(_0x500a79[_0x00b6('0x35')]['includeAll']){_0xffc37[_0x00b6('0x44')]=[{'all':!![]}];}return db[_0x00b6('0x31')][_0x00b6('0x45')](_0xffc37);})[_0x00b6('0x27')](function(_0x257d97){_0x260771['rows']=_0x257d97;return _0x260771;})['then'](respondWithFilteredResult(_0xb39b8a,_0xffc37))[_0x00b6('0x46')](handleError(_0xb39b8a,null));};exports[_0x00b6('0x47')]=function(_0x47f3e9,_0x518d21){var _0x4f24e3={'raw':!![],'where':{'id':_0x47f3e9[_0x00b6('0x48')]['id']}},_0x3fbda6={};_0x3fbda6[_0x00b6('0x39')]=_['keys'](db[_0x00b6('0x31')][_0x00b6('0x32')]);_0x3fbda6['query']=_[_0x00b6('0x36')](_0x47f3e9['query']);_0x3fbda6[_0x00b6('0x37')]=_[_0x00b6('0x38')](_0x3fbda6[_0x00b6('0x39')],_0x3fbda6[_0x00b6('0x35')]);_0x4f24e3[_0x00b6('0x3a')]=_[_0x00b6('0x38')](_0x3fbda6[_0x00b6('0x39')],qs[_0x00b6('0x3b')](_0x47f3e9[_0x00b6('0x35')][_0x00b6('0x3b')]));_0x4f24e3[_0x00b6('0x3a')]=_0x4f24e3['attributes'][_0x00b6('0x3c')]?_0x4f24e3[_0x00b6('0x3a')]:_0x3fbda6[_0x00b6('0x39')];if(_0x47f3e9[_0x00b6('0x35')][_0x00b6('0x49')]){_0x4f24e3['include']=[{'all':!![]}];}_0x4f24e3=_[_0x00b6('0x42')]({},_0x4f24e3,_0x47f3e9['options']);return db[_0x00b6('0x31')][_0x00b6('0x4a')](_0x4f24e3)[_0x00b6('0x27')](handleEntityNotFound(_0x518d21,null))[_0x00b6('0x27')](respondWithResult(_0x518d21,null))['catch'](handleError(_0x518d21,null));};exports[_0x00b6('0x4b')]=function(_0x3e0ba4,_0x22f6e5){return db['Template'][_0x00b6('0x4b')](_0x3e0ba4[_0x00b6('0x4c')],{})[_0x00b6('0x27')](function(_0x436133){var _0x106769=_0x3e0ba4['user'][_0x00b6('0x4d')]({'plain':!![]});if(!_0x106769)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106769['role']===_0x00b6('0x4e')){var _0x3b0c95=_0x436133[_0x00b6('0x4d')]({'plain':!![]});var _0x376f34=_0x00b6('0x29');return db['UserProfileSection'][_0x00b6('0x4a')]({'where':{'name':_0x376f34,'userProfileId':_0x106769[_0x00b6('0x4f')]},'raw':!![]})['then'](function(_0xfa85de){if(_0xfa85de&&_0xfa85de[_0x00b6('0x50')]===0x0){return db['UserProfileResource'][_0x00b6('0x4b')]({'name':_0x3b0c95[_0x00b6('0x2d')],'resourceId':_0x3b0c95['id'],'type':_0xfa85de[_0x00b6('0x2d')],'sectionId':_0xfa85de['id']},{})[_0x00b6('0x27')](function(){return _0x436133;});}else{return _0x436133;}})[_0x00b6('0x46')](function(_0x4cb17b){logger[_0x00b6('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cb17b);throw _0x4cb17b;});}return _0x436133;})[_0x00b6('0x27')](respondWithResult(_0x22f6e5,0xc9))[_0x00b6('0x46')](handleError(_0x22f6e5,null));};exports[_0x00b6('0x26')]=function(_0x2a8108,_0x171ead){if(_0x2a8108['body']['id']){delete _0x2a8108[_0x00b6('0x4c')]['id'];}return db[_0x00b6('0x31')]['find']({'where':{'id':_0x2a8108[_0x00b6('0x48')]['id']}})[_0x00b6('0x27')](handleEntityNotFound(_0x171ead,null))[_0x00b6('0x27')](saveUpdates(_0x2a8108[_0x00b6('0x4c')],null))[_0x00b6('0x27')](respondWithResult(_0x171ead,null))[_0x00b6('0x46')](handleError(_0x171ead,null));};exports[_0x00b6('0x28')]=function(_0x53acf5,_0x863377){return db['Template']['find']({'where':{'id':_0x53acf5[_0x00b6('0x48')]['id']}})[_0x00b6('0x27')](handleEntityNotFound(_0x863377,null))[_0x00b6('0x27')](removeEntity(_0x863377,null))['catch'](handleError(_0x863377,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e7001dd..7814ae8 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 _0x9032=['api','path','rimraf','../../config/environment','define','Template','tools_templates','util','../../config/logger'];(function(_0x28ee85,_0x1f10b6){var _0x213145=function(_0x4902d5){while(--_0x4902d5){_0x28ee85['push'](_0x28ee85['shift']());}};_0x213145(++_0x1f10b6);}(_0x9032,0x103));var _0x2903=function(_0x36b1b9,_0x1e8915){_0x36b1b9=_0x36b1b9-0x0;var _0x418f43=_0x9032[_0x36b1b9];return _0x418f43;};'use strict';var _=require('lodash');var util=require(_0x2903('0x0'));var logger=require(_0x2903('0x1'))(_0x2903('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2903('0x3'));var rimraf=require(_0x2903('0x4'));var config=require(_0x2903('0x5'));var attributes=require('./template.attributes');module['exports']=function(_0x4a54ab,_0x5c785b){return _0x4a54ab[_0x2903('0x6')](_0x2903('0x7'),attributes,{'tableName':_0x2903('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x272b=['exports','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x1f7da6,_0x392342){var _0x461614=function(_0x302c6d){while(--_0x302c6d){_0x1f7da6['push'](_0x1f7da6['shift']());}};_0x461614(++_0x392342);}(_0x272b,0x9e));var _0xb272=function(_0x4b1cd7,_0x27b641){_0x4b1cd7=_0x4b1cd7-0x0;var _0x400e61=_0x272b[_0x4b1cd7];return _0x400e61;};'use strict';var _=require(_0xb272('0x0'));var util=require(_0xb272('0x1'));var logger=require(_0xb272('0x2'))(_0xb272('0x3'));var moment=require('moment');var BPromise=require(_0xb272('0x4'));var rp=require(_0xb272('0x5'));var fs=require('fs');var path=require(_0xb272('0x6'));var rimraf=require(_0xb272('0x7'));var config=require(_0xb272('0x8'));var attributes=require(_0xb272('0x9'));module[_0xb272('0xa')]=function(_0x426a44,_0x304bcd){return _0x426a44[_0xb272('0xb')](_0xb272('0xc'),attributes,{'tableName':_0xb272('0xd'),'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 05fb830..39c4dfc 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 _0x2df1=['model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','Template','options','attributes','map','include'];(function(_0x4c0819,_0xa6abe4){var _0x9fcae=function(_0x4247f9){while(--_0x4247f9){_0x4c0819['push'](_0x4c0819['shift']());}};_0x9fcae(++_0xa6abe4);}(_0x2df1,0x1ee));var _0x12df=function(_0x5295d1,_0x3fee78){_0x5295d1=_0x5295d1-0x0;var _0x147504=_0x2df1[_0x5295d1];return _0x147504;};'use strict';var _=require(_0x12df('0x0'));var util=require(_0x12df('0x1'));var moment=require(_0x12df('0x2'));var BPromise=require(_0x12df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12df('0x4'));var db=require(_0x12df('0x5'))['db'];var utils=require(_0x12df('0x6'));var logger=require(_0x12df('0x7'))(_0x12df('0x8'));var config=require(_0x12df('0x9'));var jayson=require(_0x12df('0xa'));var client=jayson[_0x12df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33d959,_0x5aac1c,_0x23df07){return new BPromise(function(_0x1609bb,_0x628bb){return client['request'](_0x33d959,_0x23df07)[_0x12df('0xc')](function(_0x3a582b){logger['info']('Template,\x20%s,\x20%s',_0x5aac1c,_0x12df('0xd'));logger[_0x12df('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x5aac1c,_0x12df('0xd'),JSON[_0x12df('0xf')](_0x3a582b));if(_0x3a582b[_0x12df('0x10')]){if(_0x3a582b['error'][_0x12df('0x11')]===0x1f4){logger[_0x12df('0x10')](_0x12df('0x12'),_0x5aac1c,_0x3a582b[_0x12df('0x10')]['message']);return _0x628bb(_0x3a582b[_0x12df('0x10')][_0x12df('0x13')]);}logger[_0x12df('0x10')]('Template,\x20%s,\x20%s',_0x5aac1c,_0x3a582b[_0x12df('0x10')][_0x12df('0x13')]);return _0x1609bb(_0x3a582b[_0x12df('0x10')][_0x12df('0x13')]);}else{logger[_0x12df('0x14')](_0x12df('0x12'),_0x5aac1c,'request\x20sent');_0x1609bb(_0x3a582b[_0x12df('0x15')][_0x12df('0x13')]);}})['catch'](function(_0xd247){logger[_0x12df('0x10')](_0x12df('0x12'),_0x5aac1c,_0xd247);_0x628bb(_0xd247);});});}exports[_0x12df('0x16')]=function(_0x123f01){var _0x5a843b=this;return new Promise(function(_0x649642,_0x264bf0){return db[_0x12df('0x17')]['findAll']({'raw':_0x123f01[_0x12df('0x18')]?_0x123f01[_0x12df('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x123f01[_0x12df('0x18')]?_0x123f01[_0x12df('0x18')]['where']||null:null,'attributes':_0x123f01[_0x12df('0x18')]?_0x123f01[_0x12df('0x18')][_0x12df('0x19')]||null:null,'limit':_0x123f01[_0x12df('0x18')]?_0x123f01[_0x12df('0x18')]['limit']||null:null,'include':_0x123f01[_0x12df('0x18')]?_0x123f01['options']['include']?_[_0x12df('0x1a')](_0x123f01[_0x12df('0x18')][_0x12df('0x1b')],function(_0x40bbe0){return{'model':db[_0x40bbe0[_0x12df('0x1c')]],'as':_0x40bbe0['as'],'attributes':_0x40bbe0[_0x12df('0x19')],'include':_0x40bbe0[_0x12df('0x1b')]?_[_0x12df('0x1a')](_0x40bbe0[_0x12df('0x1b')],function(_0x4bd4f1){return{'model':db[_0x4bd4f1[_0x12df('0x1c')]],'as':_0x4bd4f1['as'],'attributes':_0x4bd4f1[_0x12df('0x19')],'include':_0x4bd4f1[_0x12df('0x1b')]?_[_0x12df('0x1a')](_0x4bd4f1[_0x12df('0x1b')],function(_0x3acc03){return{'model':db[_0x3acc03[_0x12df('0x1c')]],'as':_0x3acc03['as'],'attributes':_0x3acc03['attributes']};}):[]};}):[]};}):[]:[]})[_0x12df('0xc')](function(_0x4dae2f){logger['info'](_0x12df('0x16'),_0x123f01);logger['debug'](_0x12df('0x16'),_0x123f01,JSON[_0x12df('0xf')](_0x4dae2f));_0x649642(_0x4dae2f);})['catch'](function(_0x4961c2){logger['error'](_0x12df('0x16'),_0x4961c2[_0x12df('0x13')],_0x123f01);_0x264bf0(_0x5a843b['error'](0x1f4,_0x4961c2['message']));});});}; \ No newline at end of file +var _0x9dd6=['include','map','model','attributes','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','where','limit'];(function(_0x499e14,_0x1874c9){var _0x5a7f64=function(_0x17b622){while(--_0x17b622){_0x499e14['push'](_0x499e14['shift']());}};_0x5a7f64(++_0x1874c9);}(_0x9dd6,0x144));var _0x69dd=function(_0x21a4b2,_0x388c29){_0x21a4b2=_0x21a4b2-0x0;var _0x26146d=_0x9dd6[_0x21a4b2];return _0x26146d;};'use strict';var _=require(_0x69dd('0x0'));var util=require(_0x69dd('0x1'));var moment=require(_0x69dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69dd('0x4'));var logger=require('../../config/logger')(_0x69dd('0x5'));var config=require(_0x69dd('0x6'));var jayson=require(_0x69dd('0x7'));var client=jayson[_0x69dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bac57,_0x1340ae,_0x4ccf60){return new BPromise(function(_0x358489,_0x13a29d){return client[_0x69dd('0x9')](_0x3bac57,_0x4ccf60)[_0x69dd('0xa')](function(_0x191c37){logger[_0x69dd('0xb')]('Template,\x20%s,\x20%s',_0x1340ae,_0x69dd('0xc'));logger[_0x69dd('0xd')](_0x69dd('0xe'),_0x1340ae,_0x69dd('0xc'),JSON[_0x69dd('0xf')](_0x191c37));if(_0x191c37[_0x69dd('0x10')]){if(_0x191c37['error'][_0x69dd('0x11')]===0x1f4){logger['error'](_0x69dd('0x12'),_0x1340ae,_0x191c37['error'][_0x69dd('0x13')]);return _0x13a29d(_0x191c37[_0x69dd('0x10')]['message']);}logger[_0x69dd('0x10')](_0x69dd('0x12'),_0x1340ae,_0x191c37[_0x69dd('0x10')][_0x69dd('0x13')]);return _0x358489(_0x191c37[_0x69dd('0x10')][_0x69dd('0x13')]);}else{logger['info'](_0x69dd('0x12'),_0x1340ae,'request\x20sent');_0x358489(_0x191c37[_0x69dd('0x14')][_0x69dd('0x13')]);}})[_0x69dd('0x15')](function(_0x2e5f39){logger['error'](_0x69dd('0x12'),_0x1340ae,_0x2e5f39);_0x13a29d(_0x2e5f39);});});}exports[_0x69dd('0x16')]=function(_0x17c468){var _0x211516=this;return new Promise(function(_0xf29383,_0x176bc5){return db[_0x69dd('0x17')][_0x69dd('0x18')]({'raw':_0x17c468['options']?_0x17c468[_0x69dd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x17c468[_0x69dd('0x19')]?_0x17c468[_0x69dd('0x19')][_0x69dd('0x1a')]||null:null,'attributes':_0x17c468[_0x69dd('0x19')]?_0x17c468['options']['attributes']||null:null,'limit':_0x17c468[_0x69dd('0x19')]?_0x17c468[_0x69dd('0x19')][_0x69dd('0x1b')]||null:null,'include':_0x17c468[_0x69dd('0x19')]?_0x17c468[_0x69dd('0x19')][_0x69dd('0x1c')]?_[_0x69dd('0x1d')](_0x17c468[_0x69dd('0x19')][_0x69dd('0x1c')],function(_0xaa630a){return{'model':db[_0xaa630a[_0x69dd('0x1e')]],'as':_0xaa630a['as'],'attributes':_0xaa630a[_0x69dd('0x1f')],'include':_0xaa630a[_0x69dd('0x1c')]?_[_0x69dd('0x1d')](_0xaa630a[_0x69dd('0x1c')],function(_0xc9c7e5){return{'model':db[_0xc9c7e5[_0x69dd('0x1e')]],'as':_0xc9c7e5['as'],'attributes':_0xc9c7e5[_0x69dd('0x1f')],'include':_0xc9c7e5[_0x69dd('0x1c')]?_[_0x69dd('0x1d')](_0xc9c7e5[_0x69dd('0x1c')],function(_0x10d059){return{'model':db[_0x10d059[_0x69dd('0x1e')]],'as':_0x10d059['as'],'attributes':_0x10d059[_0x69dd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x69dd('0xa')](function(_0x5cc972){logger[_0x69dd('0xb')]('GetTemplate',_0x17c468);logger[_0x69dd('0xd')]('GetTemplate',_0x17c468,JSON[_0x69dd('0xf')](_0x5cc972));_0xf29383(_0x5cc972);})[_0x69dd('0x15')](function(_0x44958c){logger[_0x69dd('0x10')](_0x69dd('0x16'),_0x44958c[_0x69dd('0x13')],_0x17c468);_0x176bc5(_0x211516[_0x69dd('0x10')](0x1f4,_0x44958c[_0x69dd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 82a83d3..66c6ea4 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 _0xdf2b=['addAllCondition','addAnyCondition','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf2b,0x125));var _0xbdf2=function(_0x598b84,_0xb4c5ff){_0x598b84=_0x598b84-0x0;var _0x47478e=_0xdf2b[_0x598b84];return _0x47478e;};'use strict';var multer=require('multer');var util=require(_0xbdf2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbdf2('0x1'));var router=express['Router']();var fs_extra=require(_0xbdf2('0x2'));var auth=require(_0xbdf2('0x3'));var interaction=require(_0xbdf2('0x4'));var config=require(_0xbdf2('0x5'));var controller=require(_0xbdf2('0x6'));router[_0xbdf2('0x7')]('/',auth[_0xbdf2('0x8')](),controller['index']);router[_0xbdf2('0x7')](_0xbdf2('0x9'),auth['isAuthenticated'](),controller[_0xbdf2('0xa')]);router[_0xbdf2('0x7')](_0xbdf2('0xb'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0xc')]);router[_0xbdf2('0x7')](_0xbdf2('0xd'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0xe')]);router[_0xbdf2('0x7')](_0xbdf2('0xf'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x10')]);router[_0xbdf2('0x11')]('/',auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x12')]);router['post'](_0xbdf2('0xb'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x13')]);router['post'](_0xbdf2('0xd'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x14')]);router[_0xbdf2('0x11')](_0xbdf2('0xf'),auth[_0xbdf2('0x8')](),controller['addAction']);router[_0xbdf2('0x15')](_0xbdf2('0x9'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x16')]);router[_0xbdf2('0x17')](_0xbdf2('0x9'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x18')]);module[_0xbdf2('0x19')]=router; \ No newline at end of file +var _0x63da=['isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x63da,0x147));var _0xa63d=function(_0x48b63d,_0x3bfc25){_0x48b63d=_0x48b63d-0x0;var _0x51bea9=_0x63da[_0x48b63d];return _0x51bea9;};'use strict';var multer=require(_0xa63d('0x0'));var util=require(_0xa63d('0x1'));var path=require(_0xa63d('0x2'));var timeout=require('connect-timeout');var express=require(_0xa63d('0x3'));var router=express[_0xa63d('0x4')]();var fs_extra=require(_0xa63d('0x5'));var auth=require(_0xa63d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa63d('0x7'));var controller=require(_0xa63d('0x8'));router['get']('/',auth[_0xa63d('0x9')](),controller[_0xa63d('0xa')]);router[_0xa63d('0xb')](_0xa63d('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa63d('0xd'),auth['isAuthenticated'](),controller[_0xa63d('0xe')]);router[_0xa63d('0xb')](_0xa63d('0xf'),auth[_0xa63d('0x9')](),controller[_0xa63d('0x10')]);router[_0xa63d('0xb')](_0xa63d('0x11'),auth[_0xa63d('0x9')](),controller['getActions']);router[_0xa63d('0x12')]('/',auth['isAuthenticated'](),controller[_0xa63d('0x13')]);router[_0xa63d('0x12')](_0xa63d('0xd'),auth[_0xa63d('0x9')](),controller[_0xa63d('0x14')]);router[_0xa63d('0x12')](_0xa63d('0xf'),auth[_0xa63d('0x9')](),controller[_0xa63d('0x15')]);router[_0xa63d('0x12')]('/:id/actions',auth[_0xa63d('0x9')](),controller[_0xa63d('0x16')]);router[_0xa63d('0x17')]('/:id',auth[_0xa63d('0x9')](),controller[_0xa63d('0x18')]);router[_0xa63d('0x19')](_0xa63d('0xc'),auth[_0xa63d('0x9')](),controller[_0xa63d('0x1a')]);module[_0xa63d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a64f220..e227e4b 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 _0x7b99=['sequelize','exports','STRING'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x7b99,0x12c));var _0x97b9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7b99[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x97b9('0x0'));module[_0x97b9('0x1')]={'name':{'type':Sequelize[_0x97b9('0x2')]},'channel':{'type':Sequelize[_0x97b9('0x2')]},'description':{'type':Sequelize[_0x97b9('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc199=['BOOLEAN','sequelize','exports','STRING'];(function(_0x463f8d,_0x4c33ef){var _0x23c1dc=function(_0x5de27d){while(--_0x5de27d){_0x463f8d['push'](_0x463f8d['shift']());}};_0x23c1dc(++_0x4c33ef);}(_0xc199,0x13d));var _0x9c19=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc199[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x9c19('0x0'));module[_0x9c19('0x1')]={'name':{'type':Sequelize[_0x9c19('0x2')]},'channel':{'type':Sequelize[_0x9c19('0x2')]},'description':{'type':Sequelize[_0x9c19('0x2')]},'status':{'type':Sequelize[_0x9c19('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 0e4ed78..5ad3624 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 _0x0981=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','index','Trigger','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x353f3b,_0x3b472b){var _0x3d838b=function(_0x3b7b27){while(--_0x3b7b27){_0x353f3b['push'](_0x353f3b['shift']());}};_0x3d838b(++_0x3b472b);}(_0x0981,0x1ae));var _0x1098=function(_0x3863dc,_0x32f571){_0x3863dc=_0x3863dc-0x0;var _0x327071=_0x0981[_0x3863dc];return _0x327071;};'use strict';var emlformat=require(_0x1098('0x0'));var rimraf=require(_0x1098('0x1'));var zipdir=require(_0x1098('0x2'));var jsonpatch=require(_0x1098('0x3'));var rp=require(_0x1098('0x4'));var moment=require(_0x1098('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1098('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1098('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1098('0x8'));var jsforce=require(_0x1098('0x9'));var deskjs=require(_0x1098('0xa'));var toCsv=require(_0x1098('0xb'));var querystring=require(_0x1098('0xc'));var Papa=require(_0x1098('0xd'));var Redis=require(_0x1098('0xe'));var authService=require(_0x1098('0xf'));var qs=require(_0x1098('0x10'));var as=require(_0x1098('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1098('0x12'))(_0x1098('0x13'));var utils=require(_0x1098('0x14'));var config=require(_0x1098('0x15'));var licenseUtil=require(_0x1098('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373f3a,_0x494e54){_0x494e54=_0x494e54||0xcc;return function(_0x1e2d9c){if(_0x1e2d9c){return _0x373f3a[_0x1098('0x17')](_0x494e54);}return _0x373f3a[_0x1098('0x18')](_0x494e54)[_0x1098('0x19')]();};}function respondWithResult(_0x3c79af,_0x42a4c){_0x42a4c=_0x42a4c||0xc8;return function(_0x8a33ea){if(_0x8a33ea){return _0x3c79af[_0x1098('0x18')](_0x42a4c)[_0x1098('0x1a')](_0x8a33ea);}};}function respondWithFilteredResult(_0x2cb50f,_0x54749f){return function(_0x5b6967){if(_0x5b6967){var _0x931e55=typeof _0x54749f[_0x1098('0x1b')]===_0x1098('0x1c')&&typeof _0x54749f[_0x1098('0x1d')]==='undefined';var _0x182f0d=_0x5b6967[_0x1098('0x1e')];var _0x4240a2=_0x931e55?0x0:_0x54749f[_0x1098('0x1b')];var _0x4884c4=_0x931e55?_0x5b6967[_0x1098('0x1e')]:_0x54749f[_0x1098('0x1b')]+_0x54749f[_0x1098('0x1d')];var _0x4fb155;if(_0x4884c4>=_0x182f0d){_0x4884c4=_0x182f0d;_0x4fb155=0xc8;}else{_0x4fb155=0xce;}_0x2cb50f['status'](_0x4fb155);return _0x2cb50f[_0x1098('0x1f')](_0x1098('0x20'),_0x4240a2+'-'+_0x4884c4+'/'+_0x182f0d)[_0x1098('0x1a')](_0x5b6967);}return null;};}function patchUpdates(_0x9c1d22){return function(_0x2842b2){try{jsonpatch[_0x1098('0x21')](_0x2842b2,_0x9c1d22,!![]);}catch(_0xa51157){return BPromise['reject'](_0xa51157);}return _0x2842b2[_0x1098('0x22')]();};}function saveUpdates(_0x5bb766,_0x5d2e4f){return function(_0x144e15){if(_0x144e15){return _0x144e15[_0x1098('0x23')](_0x5bb766)[_0x1098('0x24')](function(_0x3bd472){return _0x3bd472;});}return null;};}function removeEntity(_0x9c2789,_0x1879b2){return function(_0x4a6ab8){if(_0x4a6ab8){return _0x4a6ab8[_0x1098('0x25')]()['then'](function(){var _0x49c1eb=_0x4a6ab8[_0x1098('0x26')]({'plain':!![]});var _0x44ab5b=_0x1098('0x27');return db[_0x1098('0x28')][_0x1098('0x25')]({'where':{'type':_0x44ab5b,'resourceId':_0x49c1eb['id']}})[_0x1098('0x24')](function(){return _0x4a6ab8;});})['then'](function(){_0x9c2789[_0x1098('0x18')](0xcc)[_0x1098('0x19')]();});}};}function handleEntityNotFound(_0x347f24,_0x16af0b){return function(_0x2e1866){if(!_0x2e1866){_0x347f24[_0x1098('0x17')](0x194);}return _0x2e1866;};}function handleError(_0x4ba3e9,_0x5b34d8){_0x5b34d8=_0x5b34d8||0x1f4;return function(_0x247f7d){logger[_0x1098('0x29')](_0x247f7d['stack']);if(_0x247f7d['name']){delete _0x247f7d[_0x1098('0x2a')];}_0x4ba3e9['status'](_0x5b34d8)['send'](_0x247f7d);};}exports[_0x1098('0x2b')]=function(_0x704a47,_0x53d202){var _0x183ade={},_0x273d82={},_0x1e5e54={'count':0x0,'rows':[]};var _0x3ebe79=_['map'](db[_0x1098('0x2c')][_0x1098('0x2d')],function(_0x46e46a){return{'name':_0x46e46a[_0x1098('0x2e')],'type':_0x46e46a[_0x1098('0x2f')]['key']};});_0x273d82[_0x1098('0x30')]=_['map'](_0x3ebe79,_0x1098('0x2a'));_0x273d82['query']=_[_0x1098('0x31')](_0x704a47[_0x1098('0x32')]);_0x273d82[_0x1098('0x33')]=_[_0x1098('0x34')](_0x273d82[_0x1098('0x30')],_0x273d82['query']);_0x183ade[_0x1098('0x35')]=_[_0x1098('0x34')](_0x273d82[_0x1098('0x30')],qs[_0x1098('0x36')](_0x704a47[_0x1098('0x32')][_0x1098('0x36')]));_0x183ade['attributes']=_0x183ade[_0x1098('0x35')][_0x1098('0x37')]?_0x183ade[_0x1098('0x35')]:_0x273d82[_0x1098('0x30')];if(!_0x704a47[_0x1098('0x32')][_0x1098('0x38')]('nolimit')){_0x183ade[_0x1098('0x1d')]=qs[_0x1098('0x1d')](_0x704a47['query'][_0x1098('0x1d')]);_0x183ade[_0x1098('0x1b')]=qs[_0x1098('0x1b')](_0x704a47[_0x1098('0x32')][_0x1098('0x1b')]);}_0x183ade[_0x1098('0x39')]=qs[_0x1098('0x3a')](_0x704a47['query'][_0x1098('0x3a')]);_0x183ade[_0x1098('0x3b')]=qs['filters'](_[_0x1098('0x3c')](_0x704a47[_0x1098('0x32')],_0x273d82[_0x1098('0x33')]),_0x3ebe79);if(_0x704a47[_0x1098('0x32')][_0x1098('0x3d')]){_0x183ade[_0x1098('0x3b')]=_[_0x1098('0x3e')](_0x183ade[_0x1098('0x3b')],{'$or':_[_0x1098('0x3f')](_0x3ebe79,function(_0x2d4f74){if(_0x2d4f74[_0x1098('0x2f')]!==_0x1098('0x40')){var _0x2b3ff4={};_0x2b3ff4[_0x2d4f74[_0x1098('0x2a')]]={'$like':'%'+_0x704a47[_0x1098('0x32')][_0x1098('0x3d')]+'%'};return _0x2b3ff4;}})});}_0x183ade=_[_0x1098('0x3e')]({},_0x183ade,_0x704a47[_0x1098('0x41')]);var _0x3dcee4={'where':_0x183ade[_0x1098('0x3b')]};return db[_0x1098('0x2c')][_0x1098('0x1e')](_0x3dcee4)[_0x1098('0x24')](function(_0x5bf52d){_0x1e5e54[_0x1098('0x1e')]=_0x5bf52d;if(_0x704a47[_0x1098('0x32')][_0x1098('0x42')]){_0x183ade[_0x1098('0x43')]=[{'all':!![]}];}return db[_0x1098('0x2c')][_0x1098('0x44')](_0x183ade);})[_0x1098('0x24')](function(_0x53c477){_0x1e5e54['rows']=_0x53c477;return _0x1e5e54;})['then'](respondWithFilteredResult(_0x53d202,_0x183ade))[_0x1098('0x45')](handleError(_0x53d202,null));};exports[_0x1098('0x46')]=function(_0xdf4281,_0x14e2fb){var _0x371fb7={'raw':![],'where':{'id':_0xdf4281[_0x1098('0x47')]['id']}},_0x21687b={};_0x21687b['model']=_[_0x1098('0x31')](db[_0x1098('0x2c')][_0x1098('0x2d')]);_0x21687b[_0x1098('0x32')]=_['keys'](_0xdf4281[_0x1098('0x32')]);_0x21687b[_0x1098('0x33')]=_[_0x1098('0x34')](_0x21687b[_0x1098('0x30')],_0x21687b['query']);_0x371fb7[_0x1098('0x35')]=_[_0x1098('0x34')](_0x21687b['model'],qs[_0x1098('0x36')](_0xdf4281['query']['fields']));_0x371fb7[_0x1098('0x35')]=_0x371fb7[_0x1098('0x35')]['length']?_0x371fb7['attributes']:_0x21687b['model'];if(_0xdf4281[_0x1098('0x32')][_0x1098('0x42')]){_0x371fb7[_0x1098('0x43')]=[{'all':!![]}];}_0x371fb7=_[_0x1098('0x3e')]({},_0x371fb7,_0xdf4281[_0x1098('0x41')]);return db['Trigger'][_0x1098('0x48')](_0x371fb7)['then'](handleEntityNotFound(_0x14e2fb,null))['then'](respondWithResult(_0x14e2fb,null))[_0x1098('0x45')](handleError(_0x14e2fb,null));};exports['create']=function(_0x4e72a1,_0x54126d){return db[_0x1098('0x2c')][_0x1098('0x49')](_0x4e72a1['body'],{})[_0x1098('0x24')](function(_0x557deb){var _0xe671c8=_0x4e72a1[_0x1098('0x4a')][_0x1098('0x26')]({'plain':!![]});if(!_0xe671c8)throw new Error(_0x1098('0x4b'));if(_0xe671c8[_0x1098('0x4c')]===_0x1098('0x4a')){var _0x5a6318=_0x557deb[_0x1098('0x26')]({'plain':!![]});var _0x311165=_0x1098('0x27');return db[_0x1098('0x4d')][_0x1098('0x48')]({'where':{'name':_0x311165,'userProfileId':_0xe671c8['userProfileId']},'raw':!![]})[_0x1098('0x24')](function(_0x307b67){if(_0x307b67&&_0x307b67[_0x1098('0x4e')]===0x0){return db[_0x1098('0x28')]['create']({'name':_0x5a6318[_0x1098('0x2a')],'resourceId':_0x5a6318['id'],'type':_0x307b67[_0x1098('0x2a')],'sectionId':_0x307b67['id']},{})[_0x1098('0x24')](function(){return _0x557deb;});}else{return _0x557deb;}})['catch'](function(_0x166fed){logger[_0x1098('0x29')](_0x1098('0x4f'),_0x166fed);throw _0x166fed;});}return _0x557deb;})[_0x1098('0x24')](respondWithResult(_0x54126d,0xc9))[_0x1098('0x45')](handleError(_0x54126d,null));};exports['update']=function(_0x328de3,_0x4b2b36){if(_0x328de3['body']['id']){delete _0x328de3[_0x1098('0x50')]['id'];}return db[_0x1098('0x2c')][_0x1098('0x48')]({'where':{'id':_0x328de3[_0x1098('0x47')]['id']}})[_0x1098('0x24')](handleEntityNotFound(_0x4b2b36,null))[_0x1098('0x24')](saveUpdates(_0x328de3['body'],null))[_0x1098('0x24')](respondWithResult(_0x4b2b36,null))['catch'](handleError(_0x4b2b36,null));};exports[_0x1098('0x25')]=function(_0x2feda1,_0x22a528){return db['Trigger'][_0x1098('0x48')]({'where':{'id':_0x2feda1['params']['id']}})['then'](handleEntityNotFound(_0x22a528,null))[_0x1098('0x24')](removeEntity(_0x22a528,null))['catch'](handleError(_0x22a528,null));};exports[_0x1098('0x51')]=function(_0x58f614,_0x238aba,_0x58ee95){if(_0x58f614[_0x1098('0x50')]['id']){delete _0x58f614[_0x1098('0x50')]['id'];}return db['Trigger'][_0x1098('0x48')]({'where':{'id':_0x58f614['params']['id']}})['then'](handleEntityNotFound(_0x238aba,null))['then'](function(_0x1e892d){if(_0x1e892d){_0x58f614['body']['TriggerAllId']=_0x1e892d['id'];return db[_0x1098('0x52')]['create'](_0x58f614['body']);}})[_0x1098('0x24')](respondWithResult(_0x238aba,null))['catch'](handleError(_0x238aba,null));};exports[_0x1098('0x53')]=function(_0xdbe131,_0x510d7c,_0x4b32ef){if(_0xdbe131[_0x1098('0x50')]['id']){delete _0xdbe131[_0x1098('0x50')]['id'];}return db[_0x1098('0x2c')][_0x1098('0x48')]({'where':{'id':_0xdbe131['params']['id']}})[_0x1098('0x24')](handleEntityNotFound(_0x510d7c,null))['then'](function(_0x28fde4){if(_0x28fde4){_0xdbe131[_0x1098('0x50')]['TriggerAnyId']=_0x28fde4['id'];return db[_0x1098('0x52')][_0x1098('0x49')](_0xdbe131['body']);}})[_0x1098('0x24')](respondWithResult(_0x510d7c,null))[_0x1098('0x45')](handleError(_0x510d7c,null));};exports[_0x1098('0x54')]=function(_0x458a79,_0x2716c5,_0x2fffa2){var _0x18f119={};var _0x162931={};var _0x1342d2;var _0x532f36;return db[_0x1098('0x2c')][_0x1098('0x55')]({'where':{'id':_0x458a79[_0x1098('0x47')]['id']}})[_0x1098('0x24')](handleEntityNotFound(_0x2716c5,null))[_0x1098('0x24')](function(_0x25c11c){if(_0x25c11c){_0x1342d2=_0x25c11c;_0x162931[_0x1098('0x30')]=_[_0x1098('0x31')](db[_0x1098('0x52')]['rawAttributes']);_0x162931[_0x1098('0x32')]=_[_0x1098('0x31')](_0x458a79['query']);_0x162931[_0x1098('0x33')]=_[_0x1098('0x34')](_0x162931[_0x1098('0x30')],_0x162931[_0x1098('0x32')]);_0x18f119[_0x1098('0x35')]=_['intersection'](_0x162931['model'],qs[_0x1098('0x36')](_0x458a79[_0x1098('0x32')][_0x1098('0x36')]));_0x18f119[_0x1098('0x35')]=_0x18f119[_0x1098('0x35')][_0x1098('0x37')]?_0x18f119['attributes']:_0x162931['model'];_0x18f119['order']=qs[_0x1098('0x3a')](_0x458a79['query'][_0x1098('0x3a')]);_0x18f119[_0x1098('0x3b')]=qs[_0x1098('0x33')](_['pick'](_0x458a79[_0x1098('0x32')],_0x162931[_0x1098('0x33')]));if(_0x458a79[_0x1098('0x32')]['filter']){_0x18f119[_0x1098('0x3b')]=_[_0x1098('0x3e')](_0x18f119[_0x1098('0x3b')],{'$or':_[_0x1098('0x3f')](_0x18f119[_0x1098('0x35')],function(_0xda5c1a){var _0xa1b71e={};_0xa1b71e[_0xda5c1a]={'$like':'%'+_0x458a79[_0x1098('0x32')]['filter']+'%'};return _0xa1b71e;})});}_0x18f119=_[_0x1098('0x3e')]({},_0x18f119,_0x458a79[_0x1098('0x41')]);return _0x1342d2[_0x1098('0x54')](_0x18f119);}})['then'](function(_0x23eb45){if(_0x23eb45){_0x532f36=_0x23eb45[_0x1098('0x37')];if(!_0x458a79[_0x1098('0x32')][_0x1098('0x38')]('nolimit')){_0x18f119[_0x1098('0x1d')]=qs[_0x1098('0x1d')](_0x458a79[_0x1098('0x32')][_0x1098('0x1d')]);_0x18f119['offset']=qs[_0x1098('0x1b')](_0x458a79['query']['offset']);}return _0x1342d2[_0x1098('0x54')](_0x18f119);}})[_0x1098('0x24')](function(_0x2e8511){if(_0x2e8511){return _0x2e8511?{'count':_0x532f36,'rows':_0x2e8511}:null;}})['then'](respondWithResult(_0x2716c5,null))[_0x1098('0x45')](handleError(_0x2716c5,null));};exports['getAnyConditions']=function(_0x3dfadb,_0x7ba438,_0x51e5b4){var _0x372ca6={};var _0x38a35a={};var _0x14b4e9;var _0xde7d8;return db[_0x1098('0x2c')][_0x1098('0x55')]({'where':{'id':_0x3dfadb[_0x1098('0x47')]['id']}})[_0x1098('0x24')](handleEntityNotFound(_0x7ba438,null))['then'](function(_0x1251bc){if(_0x1251bc){_0x14b4e9=_0x1251bc;_0x38a35a[_0x1098('0x30')]=_[_0x1098('0x31')](db['Condition'][_0x1098('0x2d')]);_0x38a35a[_0x1098('0x32')]=_[_0x1098('0x31')](_0x3dfadb[_0x1098('0x32')]);_0x38a35a[_0x1098('0x33')]=_['intersection'](_0x38a35a[_0x1098('0x30')],_0x38a35a[_0x1098('0x32')]);_0x372ca6[_0x1098('0x35')]=_[_0x1098('0x34')](_0x38a35a['model'],qs[_0x1098('0x36')](_0x3dfadb[_0x1098('0x32')][_0x1098('0x36')]));_0x372ca6[_0x1098('0x35')]=_0x372ca6['attributes']['length']?_0x372ca6['attributes']:_0x38a35a[_0x1098('0x30')];_0x372ca6['order']=qs[_0x1098('0x3a')](_0x3dfadb[_0x1098('0x32')][_0x1098('0x3a')]);_0x372ca6[_0x1098('0x3b')]=qs[_0x1098('0x33')](_[_0x1098('0x3c')](_0x3dfadb['query'],_0x38a35a[_0x1098('0x33')]));if(_0x3dfadb['query'][_0x1098('0x3d')]){_0x372ca6[_0x1098('0x3b')]=_[_0x1098('0x3e')](_0x372ca6[_0x1098('0x3b')],{'$or':_['map'](_0x372ca6[_0x1098('0x35')],function(_0x1fa542){var _0x3d77bb={};_0x3d77bb[_0x1fa542]={'$like':'%'+_0x3dfadb[_0x1098('0x32')][_0x1098('0x3d')]+'%'};return _0x3d77bb;})});}_0x372ca6=_[_0x1098('0x3e')]({},_0x372ca6,_0x3dfadb[_0x1098('0x41')]);return _0x14b4e9[_0x1098('0x56')](_0x372ca6);}})[_0x1098('0x24')](function(_0x2042ba){if(_0x2042ba){_0xde7d8=_0x2042ba[_0x1098('0x37')];if(!_0x3dfadb['query'][_0x1098('0x38')]('nolimit')){_0x372ca6[_0x1098('0x1d')]=qs[_0x1098('0x1d')](_0x3dfadb[_0x1098('0x32')][_0x1098('0x1d')]);_0x372ca6[_0x1098('0x1b')]=qs[_0x1098('0x1b')](_0x3dfadb[_0x1098('0x32')]['offset']);}return _0x14b4e9[_0x1098('0x56')](_0x372ca6);}})['then'](function(_0x44378d){if(_0x44378d){return _0x44378d?{'count':_0xde7d8,'rows':_0x44378d}:null;}})[_0x1098('0x24')](respondWithResult(_0x7ba438,null))[_0x1098('0x45')](handleError(_0x7ba438,null));};exports[_0x1098('0x57')]=function(_0x4dfd9f,_0x861079,_0x4cca81){if(_0x4dfd9f[_0x1098('0x50')]['id']){delete _0x4dfd9f[_0x1098('0x50')]['id'];}return db[_0x1098('0x2c')][_0x1098('0x48')]({'where':{'id':_0x4dfd9f['params']['id']}})['then'](handleEntityNotFound(_0x861079,null))[_0x1098('0x24')](function(_0x52d905){if(_0x52d905){_0x4dfd9f[_0x1098('0x50')][_0x1098('0x58')]=_0x52d905['id'];return db[_0x1098('0x59')][_0x1098('0x49')](_0x4dfd9f[_0x1098('0x50')]);}})['then'](respondWithResult(_0x861079,null))[_0x1098('0x45')](handleError(_0x861079,null));};exports[_0x1098('0x5a')]=function(_0x41055d,_0x409502,_0x511bab){var _0x409014={};var _0x56072f={};var _0x2a4e04;var _0x54f0d2;return db[_0x1098('0x2c')][_0x1098('0x55')]({'where':{'id':_0x41055d['params']['id']}})['then'](handleEntityNotFound(_0x409502,null))['then'](function(_0x3e88fa){if(_0x3e88fa){_0x2a4e04=_0x3e88fa;_0x56072f[_0x1098('0x30')]=_[_0x1098('0x31')](db[_0x1098('0x59')]['rawAttributes']);_0x56072f['query']=_[_0x1098('0x31')](_0x41055d[_0x1098('0x32')]);_0x56072f[_0x1098('0x33')]=_[_0x1098('0x34')](_0x56072f[_0x1098('0x30')],_0x56072f[_0x1098('0x32')]);_0x409014[_0x1098('0x35')]=_[_0x1098('0x34')](_0x56072f['model'],qs[_0x1098('0x36')](_0x41055d[_0x1098('0x32')][_0x1098('0x36')]));_0x409014[_0x1098('0x35')]=_0x409014[_0x1098('0x35')][_0x1098('0x37')]?_0x409014[_0x1098('0x35')]:_0x56072f['model'];_0x409014[_0x1098('0x39')]=qs[_0x1098('0x3a')](_0x41055d[_0x1098('0x32')][_0x1098('0x3a')]);_0x409014[_0x1098('0x3b')]=qs['filters'](_['pick'](_0x41055d['query'],_0x56072f[_0x1098('0x33')]));if(_0x41055d[_0x1098('0x32')][_0x1098('0x3d')]){_0x409014['where']=_['merge'](_0x409014[_0x1098('0x3b')],{'$or':_[_0x1098('0x3f')](_0x409014['attributes'],function(_0xe0db78){var _0x31410b={};_0x31410b[_0xe0db78]={'$like':'%'+_0x41055d[_0x1098('0x32')][_0x1098('0x3d')]+'%'};return _0x31410b;})});}_0x409014=_[_0x1098('0x3e')]({},_0x409014,_0x41055d[_0x1098('0x41')]);return _0x2a4e04[_0x1098('0x5a')](_0x409014);}})['then'](function(_0x3c1ffc){if(_0x3c1ffc){_0x54f0d2=_0x3c1ffc[_0x1098('0x37')];if(!_0x41055d['query'][_0x1098('0x38')]('nolimit')){_0x409014['limit']=qs[_0x1098('0x1d')](_0x41055d[_0x1098('0x32')][_0x1098('0x1d')]);_0x409014[_0x1098('0x1b')]=qs[_0x1098('0x1b')](_0x41055d[_0x1098('0x32')][_0x1098('0x1b')]);}return _0x2a4e04['getActions'](_0x409014);}})[_0x1098('0x24')](function(_0x2a59fc){if(_0x2a59fc){return _0x2a59fc?{'count':_0x54f0d2,'rows':_0x2a59fc}:null;}})['then'](respondWithResult(_0x409502,null))[_0x1098('0x45')](handleError(_0x409502,null));}; \ No newline at end of file +var _0x511c=['order','options','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','end','sendStatus','error','stack','name','index','Trigger','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','getAllConditions'];(function(_0x230971,_0x2985dc){var _0x536c90=function(_0x24eab7){while(--_0x24eab7){_0x230971['push'](_0x230971['shift']());}};_0x536c90(++_0x2985dc);}(_0x511c,0x1ec));var _0xc511=function(_0x3cb260,_0x329d33){_0x3cb260=_0x3cb260-0x0;var _0xa99a90=_0x511c[_0x3cb260];return _0xa99a90;};'use strict';var emlformat=require(_0xc511('0x0'));var rimraf=require(_0xc511('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc511('0x2'));var rp=require('request-promise');var moment=require(_0xc511('0x3'));var BPromise=require(_0xc511('0x4'));var Mustache=require(_0xc511('0x5'));var util=require(_0xc511('0x6'));var path=require(_0xc511('0x7'));var sox=require(_0xc511('0x8'));var csv=require(_0xc511('0x9'));var ejs=require(_0xc511('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc511('0xb'));var squel=require(_0xc511('0xc'));var crypto=require(_0xc511('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc511('0xe'));var toCsv=require(_0xc511('0x9'));var querystring=require(_0xc511('0xf'));var Papa=require(_0xc511('0x10'));var Redis=require(_0xc511('0x11'));var authService=require(_0xc511('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc511('0x13'));var hardwareService=require(_0xc511('0x14'));var logger=require(_0xc511('0x15'))(_0xc511('0x16'));var utils=require(_0xc511('0x17'));var config=require(_0xc511('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc511('0x19'))['db'];function respondWithStatusCode(_0x263859,_0x5f14dd){_0x5f14dd=_0x5f14dd||0xcc;return function(_0x146767){if(_0x146767){return _0x263859['sendStatus'](_0x5f14dd);}return _0x263859[_0xc511('0x1a')](_0x5f14dd)['end']();};}function respondWithResult(_0x22aadc,_0xa2d32b){_0xa2d32b=_0xa2d32b||0xc8;return function(_0x3d3c3b){if(_0x3d3c3b){return _0x22aadc['status'](_0xa2d32b)[_0xc511('0x1b')](_0x3d3c3b);}};}function respondWithFilteredResult(_0x1e8d75,_0x5e019b){return function(_0x5cf57c){if(_0x5cf57c){var _0x550ee6=typeof _0x5e019b[_0xc511('0x1c')]===_0xc511('0x1d')&&typeof _0x5e019b[_0xc511('0x1e')]===_0xc511('0x1d');var _0x4998d8=_0x5cf57c[_0xc511('0x1f')];var _0x4f3b39=_0x550ee6?0x0:_0x5e019b[_0xc511('0x1c')];var _0x17a69f=_0x550ee6?_0x5cf57c[_0xc511('0x1f')]:_0x5e019b[_0xc511('0x1c')]+_0x5e019b[_0xc511('0x1e')];var _0x5c33fc;if(_0x17a69f>=_0x4998d8){_0x17a69f=_0x4998d8;_0x5c33fc=0xc8;}else{_0x5c33fc=0xce;}_0x1e8d75['status'](_0x5c33fc);return _0x1e8d75[_0xc511('0x20')](_0xc511('0x21'),_0x4f3b39+'-'+_0x17a69f+'/'+_0x4998d8)[_0xc511('0x1b')](_0x5cf57c);}return null;};}function patchUpdates(_0x43df06){return function(_0xd1a7f2){try{jsonpatch[_0xc511('0x22')](_0xd1a7f2,_0x43df06,!![]);}catch(_0x3683dd){return BPromise['reject'](_0x3683dd);}return _0xd1a7f2[_0xc511('0x23')]();};}function saveUpdates(_0x1f78d9,_0x2dacbc){return function(_0x49f1eb){if(_0x49f1eb){return _0x49f1eb[_0xc511('0x24')](_0x1f78d9)[_0xc511('0x25')](function(_0x50f48a){return _0x50f48a;});}return null;};}function removeEntity(_0x3b91cc,_0x26db7a){return function(_0x49646b){if(_0x49646b){return _0x49646b[_0xc511('0x26')]()[_0xc511('0x25')](function(){var _0x40c2a9=_0x49646b[_0xc511('0x27')]({'plain':!![]});var _0x1431d8=_0xc511('0x28');return db[_0xc511('0x29')][_0xc511('0x26')]({'where':{'type':_0x1431d8,'resourceId':_0x40c2a9['id']}})['then'](function(){return _0x49646b;});})[_0xc511('0x25')](function(){_0x3b91cc['status'](0xcc)[_0xc511('0x2a')]();});}};}function handleEntityNotFound(_0x49d895,_0x56e465){return function(_0x579d8d){if(!_0x579d8d){_0x49d895[_0xc511('0x2b')](0x194);}return _0x579d8d;};}function handleError(_0x31217f,_0x4783b8){_0x4783b8=_0x4783b8||0x1f4;return function(_0x41f2c3){logger[_0xc511('0x2c')](_0x41f2c3[_0xc511('0x2d')]);if(_0x41f2c3[_0xc511('0x2e')]){delete _0x41f2c3[_0xc511('0x2e')];}_0x31217f['status'](_0x4783b8)['send'](_0x41f2c3);};}exports[_0xc511('0x2f')]=function(_0x64584b,_0x5d0ecc){var _0x36643e={},_0x22cae4={},_0x46623b={'count':0x0,'rows':[]};var _0x2cb888=_['map'](db[_0xc511('0x30')][_0xc511('0x31')],function(_0x28291e){return{'name':_0x28291e[_0xc511('0x32')],'type':_0x28291e[_0xc511('0x33')][_0xc511('0x34')]};});_0x22cae4[_0xc511('0x35')]=_[_0xc511('0x36')](_0x2cb888,_0xc511('0x2e'));_0x22cae4['query']=_[_0xc511('0x37')](_0x64584b[_0xc511('0x38')]);_0x22cae4[_0xc511('0x39')]=_[_0xc511('0x3a')](_0x22cae4[_0xc511('0x35')],_0x22cae4['query']);_0x36643e[_0xc511('0x3b')]=_[_0xc511('0x3a')](_0x22cae4[_0xc511('0x35')],qs[_0xc511('0x3c')](_0x64584b[_0xc511('0x38')][_0xc511('0x3c')]));_0x36643e[_0xc511('0x3b')]=_0x36643e['attributes'][_0xc511('0x3d')]?_0x36643e[_0xc511('0x3b')]:_0x22cae4[_0xc511('0x35')];if(!_0x64584b[_0xc511('0x38')][_0xc511('0x3e')](_0xc511('0x3f'))){_0x36643e[_0xc511('0x1e')]=qs[_0xc511('0x1e')](_0x64584b[_0xc511('0x38')][_0xc511('0x1e')]);_0x36643e[_0xc511('0x1c')]=qs[_0xc511('0x1c')](_0x64584b[_0xc511('0x38')][_0xc511('0x1c')]);}_0x36643e['order']=qs[_0xc511('0x40')](_0x64584b[_0xc511('0x38')][_0xc511('0x40')]);_0x36643e[_0xc511('0x41')]=qs[_0xc511('0x39')](_[_0xc511('0x42')](_0x64584b[_0xc511('0x38')],_0x22cae4[_0xc511('0x39')]),_0x2cb888);if(_0x64584b['query']['filter']){_0x36643e['where']=_[_0xc511('0x43')](_0x36643e['where'],{'$or':_[_0xc511('0x36')](_0x2cb888,function(_0x3a7e4f){if(_0x3a7e4f[_0xc511('0x33')]!==_0xc511('0x44')){var _0x4d15ea={};_0x4d15ea[_0x3a7e4f[_0xc511('0x2e')]]={'$like':'%'+_0x64584b[_0xc511('0x38')][_0xc511('0x45')]+'%'};return _0x4d15ea;}})});}_0x36643e=_[_0xc511('0x43')]({},_0x36643e,_0x64584b['options']);var _0x35176d={'where':_0x36643e[_0xc511('0x41')]};return db['Trigger'][_0xc511('0x1f')](_0x35176d)[_0xc511('0x25')](function(_0x559029){_0x46623b[_0xc511('0x1f')]=_0x559029;if(_0x64584b[_0xc511('0x38')][_0xc511('0x46')]){_0x36643e[_0xc511('0x47')]=[{'all':!![]}];}return db[_0xc511('0x30')][_0xc511('0x48')](_0x36643e);})[_0xc511('0x25')](function(_0x52bdbe){_0x46623b[_0xc511('0x49')]=_0x52bdbe;return _0x46623b;})[_0xc511('0x25')](respondWithFilteredResult(_0x5d0ecc,_0x36643e))[_0xc511('0x4a')](handleError(_0x5d0ecc,null));};exports[_0xc511('0x4b')]=function(_0x522c5c,_0x430781){var _0x282f35={'raw':![],'where':{'id':_0x522c5c[_0xc511('0x4c')]['id']}},_0x25f77f={};_0x25f77f[_0xc511('0x35')]=_['keys'](db[_0xc511('0x30')]['rawAttributes']);_0x25f77f[_0xc511('0x38')]=_[_0xc511('0x37')](_0x522c5c['query']);_0x25f77f[_0xc511('0x39')]=_[_0xc511('0x3a')](_0x25f77f['model'],_0x25f77f[_0xc511('0x38')]);_0x282f35[_0xc511('0x3b')]=_[_0xc511('0x3a')](_0x25f77f[_0xc511('0x35')],qs['fields'](_0x522c5c['query'][_0xc511('0x3c')]));_0x282f35['attributes']=_0x282f35[_0xc511('0x3b')][_0xc511('0x3d')]?_0x282f35[_0xc511('0x3b')]:_0x25f77f[_0xc511('0x35')];if(_0x522c5c[_0xc511('0x38')][_0xc511('0x46')]){_0x282f35[_0xc511('0x47')]=[{'all':!![]}];}_0x282f35=_[_0xc511('0x43')]({},_0x282f35,_0x522c5c['options']);return db[_0xc511('0x30')][_0xc511('0x4d')](_0x282f35)[_0xc511('0x25')](handleEntityNotFound(_0x430781,null))[_0xc511('0x25')](respondWithResult(_0x430781,null))[_0xc511('0x4a')](handleError(_0x430781,null));};exports[_0xc511('0x4e')]=function(_0x2707b5,_0x1f3fb9){return db[_0xc511('0x30')]['create'](_0x2707b5[_0xc511('0x4f')],{})[_0xc511('0x25')](function(_0x46b8f6){var _0x1dcae4=_0x2707b5[_0xc511('0x50')][_0xc511('0x27')]({'plain':!![]});if(!_0x1dcae4)throw new Error(_0xc511('0x51'));if(_0x1dcae4[_0xc511('0x52')]==='user'){var _0xcf42f8=_0x46b8f6['get']({'plain':!![]});var _0x5d71ee=_0xc511('0x28');return db[_0xc511('0x53')]['find']({'where':{'name':_0x5d71ee,'userProfileId':_0x1dcae4['userProfileId']},'raw':!![]})['then'](function(_0x4cf417){if(_0x4cf417&&_0x4cf417[_0xc511('0x54')]===0x0){return db[_0xc511('0x29')][_0xc511('0x4e')]({'name':_0xcf42f8[_0xc511('0x2e')],'resourceId':_0xcf42f8['id'],'type':_0x4cf417['name'],'sectionId':_0x4cf417['id']},{})[_0xc511('0x25')](function(){return _0x46b8f6;});}else{return _0x46b8f6;}})[_0xc511('0x4a')](function(_0x24af94){logger[_0xc511('0x2c')](_0xc511('0x55'),_0x24af94);throw _0x24af94;});}return _0x46b8f6;})[_0xc511('0x25')](respondWithResult(_0x1f3fb9,0xc9))['catch'](handleError(_0x1f3fb9,null));};exports[_0xc511('0x24')]=function(_0x191915,_0x3a41e4){if(_0x191915[_0xc511('0x4f')]['id']){delete _0x191915[_0xc511('0x4f')]['id'];}return db[_0xc511('0x30')][_0xc511('0x4d')]({'where':{'id':_0x191915[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x3a41e4,null))['then'](saveUpdates(_0x191915['body'],null))[_0xc511('0x25')](respondWithResult(_0x3a41e4,null))['catch'](handleError(_0x3a41e4,null));};exports[_0xc511('0x26')]=function(_0x483a11,_0x1735f6){return db[_0xc511('0x30')]['find']({'where':{'id':_0x483a11['params']['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x1735f6,null))[_0xc511('0x25')](removeEntity(_0x1735f6,null))[_0xc511('0x4a')](handleError(_0x1735f6,null));};exports['addAllCondition']=function(_0x29d857,_0xfcdbf7,_0x4ec8d6){if(_0x29d857[_0xc511('0x4f')]['id']){delete _0x29d857['body']['id'];}return db[_0xc511('0x30')][_0xc511('0x4d')]({'where':{'id':_0x29d857[_0xc511('0x4c')]['id']}})['then'](handleEntityNotFound(_0xfcdbf7,null))[_0xc511('0x25')](function(_0x44ae70){if(_0x44ae70){_0x29d857['body'][_0xc511('0x56')]=_0x44ae70['id'];return db[_0xc511('0x57')]['create'](_0x29d857[_0xc511('0x4f')]);}})[_0xc511('0x25')](respondWithResult(_0xfcdbf7,null))['catch'](handleError(_0xfcdbf7,null));};exports[_0xc511('0x58')]=function(_0xb0eccf,_0x318582,_0x2194e2){if(_0xb0eccf[_0xc511('0x4f')]['id']){delete _0xb0eccf[_0xc511('0x4f')]['id'];}return db[_0xc511('0x30')][_0xc511('0x4d')]({'where':{'id':_0xb0eccf[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x318582,null))[_0xc511('0x25')](function(_0x4122f2){if(_0x4122f2){_0xb0eccf[_0xc511('0x4f')]['TriggerAnyId']=_0x4122f2['id'];return db[_0xc511('0x57')][_0xc511('0x4e')](_0xb0eccf[_0xc511('0x4f')]);}})[_0xc511('0x25')](respondWithResult(_0x318582,null))[_0xc511('0x4a')](handleError(_0x318582,null));};exports[_0xc511('0x59')]=function(_0x134fc1,_0x156c77,_0x4ad3cc){var _0x219ac6={};var _0x12e706={};var _0x5ed43c;var _0x444eec;return db[_0xc511('0x30')]['findOne']({'where':{'id':_0x134fc1[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x156c77,null))[_0xc511('0x25')](function(_0x332644){if(_0x332644){_0x5ed43c=_0x332644;_0x12e706[_0xc511('0x35')]=_[_0xc511('0x37')](db['Condition'][_0xc511('0x31')]);_0x12e706[_0xc511('0x38')]=_['keys'](_0x134fc1[_0xc511('0x38')]);_0x12e706[_0xc511('0x39')]=_[_0xc511('0x3a')](_0x12e706[_0xc511('0x35')],_0x12e706['query']);_0x219ac6[_0xc511('0x3b')]=_[_0xc511('0x3a')](_0x12e706['model'],qs[_0xc511('0x3c')](_0x134fc1['query'][_0xc511('0x3c')]));_0x219ac6['attributes']=_0x219ac6['attributes'][_0xc511('0x3d')]?_0x219ac6[_0xc511('0x3b')]:_0x12e706[_0xc511('0x35')];_0x219ac6[_0xc511('0x5a')]=qs[_0xc511('0x40')](_0x134fc1[_0xc511('0x38')][_0xc511('0x40')]);_0x219ac6[_0xc511('0x41')]=qs[_0xc511('0x39')](_[_0xc511('0x42')](_0x134fc1[_0xc511('0x38')],_0x12e706[_0xc511('0x39')]));if(_0x134fc1[_0xc511('0x38')][_0xc511('0x45')]){_0x219ac6['where']=_[_0xc511('0x43')](_0x219ac6[_0xc511('0x41')],{'$or':_['map'](_0x219ac6[_0xc511('0x3b')],function(_0x7c1344){var _0x2c6359={};_0x2c6359[_0x7c1344]={'$like':'%'+_0x134fc1[_0xc511('0x38')]['filter']+'%'};return _0x2c6359;})});}_0x219ac6=_[_0xc511('0x43')]({},_0x219ac6,_0x134fc1[_0xc511('0x5b')]);return _0x5ed43c['getAllConditions'](_0x219ac6);}})[_0xc511('0x25')](function(_0x40b680){if(_0x40b680){_0x444eec=_0x40b680['length'];if(!_0x134fc1[_0xc511('0x38')]['hasOwnProperty'](_0xc511('0x3f'))){_0x219ac6['limit']=qs[_0xc511('0x1e')](_0x134fc1[_0xc511('0x38')][_0xc511('0x1e')]);_0x219ac6[_0xc511('0x1c')]=qs['offset'](_0x134fc1['query'][_0xc511('0x1c')]);}return _0x5ed43c[_0xc511('0x59')](_0x219ac6);}})['then'](function(_0x43ff09){if(_0x43ff09){return _0x43ff09?{'count':_0x444eec,'rows':_0x43ff09}:null;}})[_0xc511('0x25')](respondWithResult(_0x156c77,null))[_0xc511('0x4a')](handleError(_0x156c77,null));};exports['getAnyConditions']=function(_0x2a343a,_0x17ca29,_0x50b0ca){var _0x21bb3f={};var _0x37901c={};var _0x2218b8;var _0x5e8156;return db[_0xc511('0x30')][_0xc511('0x5c')]({'where':{'id':_0x2a343a[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x17ca29,null))[_0xc511('0x25')](function(_0x29fb43){if(_0x29fb43){_0x2218b8=_0x29fb43;_0x37901c[_0xc511('0x35')]=_[_0xc511('0x37')](db[_0xc511('0x57')][_0xc511('0x31')]);_0x37901c[_0xc511('0x38')]=_[_0xc511('0x37')](_0x2a343a['query']);_0x37901c['filters']=_[_0xc511('0x3a')](_0x37901c[_0xc511('0x35')],_0x37901c[_0xc511('0x38')]);_0x21bb3f[_0xc511('0x3b')]=_['intersection'](_0x37901c[_0xc511('0x35')],qs[_0xc511('0x3c')](_0x2a343a[_0xc511('0x38')][_0xc511('0x3c')]));_0x21bb3f[_0xc511('0x3b')]=_0x21bb3f[_0xc511('0x3b')]['length']?_0x21bb3f[_0xc511('0x3b')]:_0x37901c[_0xc511('0x35')];_0x21bb3f[_0xc511('0x5a')]=qs[_0xc511('0x40')](_0x2a343a[_0xc511('0x38')]['sort']);_0x21bb3f[_0xc511('0x41')]=qs['filters'](_[_0xc511('0x42')](_0x2a343a['query'],_0x37901c[_0xc511('0x39')]));if(_0x2a343a['query'][_0xc511('0x45')]){_0x21bb3f[_0xc511('0x41')]=_[_0xc511('0x43')](_0x21bb3f[_0xc511('0x41')],{'$or':_[_0xc511('0x36')](_0x21bb3f[_0xc511('0x3b')],function(_0x4a8ec6){var _0x1721de={};_0x1721de[_0x4a8ec6]={'$like':'%'+_0x2a343a[_0xc511('0x38')][_0xc511('0x45')]+'%'};return _0x1721de;})});}_0x21bb3f=_[_0xc511('0x43')]({},_0x21bb3f,_0x2a343a['options']);return _0x2218b8['getAnyConditions'](_0x21bb3f);}})[_0xc511('0x25')](function(_0x1d360a){if(_0x1d360a){_0x5e8156=_0x1d360a['length'];if(!_0x2a343a[_0xc511('0x38')][_0xc511('0x3e')](_0xc511('0x3f'))){_0x21bb3f[_0xc511('0x1e')]=qs[_0xc511('0x1e')](_0x2a343a[_0xc511('0x38')][_0xc511('0x1e')]);_0x21bb3f['offset']=qs[_0xc511('0x1c')](_0x2a343a[_0xc511('0x38')][_0xc511('0x1c')]);}return _0x2218b8[_0xc511('0x5d')](_0x21bb3f);}})['then'](function(_0x304fd4){if(_0x304fd4){return _0x304fd4?{'count':_0x5e8156,'rows':_0x304fd4}:null;}})['then'](respondWithResult(_0x17ca29,null))['catch'](handleError(_0x17ca29,null));};exports['addAction']=function(_0x3d3868,_0x1b9438,_0x2f5bee){if(_0x3d3868[_0xc511('0x4f')]['id']){delete _0x3d3868[_0xc511('0x4f')]['id'];}return db[_0xc511('0x30')][_0xc511('0x4d')]({'where':{'id':_0x3d3868[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x1b9438,null))[_0xc511('0x25')](function(_0x2cb41b){if(_0x2cb41b){_0x3d3868[_0xc511('0x4f')][_0xc511('0x5e')]=_0x2cb41b['id'];return db[_0xc511('0x5f')][_0xc511('0x4e')](_0x3d3868[_0xc511('0x4f')]);}})[_0xc511('0x25')](respondWithResult(_0x1b9438,null))[_0xc511('0x4a')](handleError(_0x1b9438,null));};exports[_0xc511('0x60')]=function(_0x54262e,_0x1ff230,_0x14660a){var _0x49d61a={};var _0x295451={};var _0x39c7f9;var _0x4a4c05;return db[_0xc511('0x30')][_0xc511('0x5c')]({'where':{'id':_0x54262e[_0xc511('0x4c')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x1ff230,null))[_0xc511('0x25')](function(_0x3b2df6){if(_0x3b2df6){_0x39c7f9=_0x3b2df6;_0x295451[_0xc511('0x35')]=_[_0xc511('0x37')](db[_0xc511('0x5f')][_0xc511('0x31')]);_0x295451[_0xc511('0x38')]=_[_0xc511('0x37')](_0x54262e[_0xc511('0x38')]);_0x295451['filters']=_[_0xc511('0x3a')](_0x295451['model'],_0x295451[_0xc511('0x38')]);_0x49d61a['attributes']=_[_0xc511('0x3a')](_0x295451[_0xc511('0x35')],qs[_0xc511('0x3c')](_0x54262e[_0xc511('0x38')][_0xc511('0x3c')]));_0x49d61a[_0xc511('0x3b')]=_0x49d61a[_0xc511('0x3b')]['length']?_0x49d61a[_0xc511('0x3b')]:_0x295451['model'];_0x49d61a[_0xc511('0x5a')]=qs['sort'](_0x54262e['query'][_0xc511('0x40')]);_0x49d61a[_0xc511('0x41')]=qs[_0xc511('0x39')](_['pick'](_0x54262e[_0xc511('0x38')],_0x295451[_0xc511('0x39')]));if(_0x54262e[_0xc511('0x38')][_0xc511('0x45')]){_0x49d61a[_0xc511('0x41')]=_[_0xc511('0x43')](_0x49d61a[_0xc511('0x41')],{'$or':_[_0xc511('0x36')](_0x49d61a[_0xc511('0x3b')],function(_0x48930a){var _0x569f2f={};_0x569f2f[_0x48930a]={'$like':'%'+_0x54262e[_0xc511('0x38')][_0xc511('0x45')]+'%'};return _0x569f2f;})});}_0x49d61a=_[_0xc511('0x43')]({},_0x49d61a,_0x54262e[_0xc511('0x5b')]);return _0x39c7f9[_0xc511('0x60')](_0x49d61a);}})[_0xc511('0x25')](function(_0x4f3d30){if(_0x4f3d30){_0x4a4c05=_0x4f3d30['length'];if(!_0x54262e[_0xc511('0x38')][_0xc511('0x3e')](_0xc511('0x3f'))){_0x49d61a[_0xc511('0x1e')]=qs[_0xc511('0x1e')](_0x54262e[_0xc511('0x38')][_0xc511('0x1e')]);_0x49d61a[_0xc511('0x1c')]=qs['offset'](_0x54262e[_0xc511('0x38')]['offset']);}return _0x39c7f9[_0xc511('0x60')](_0x49d61a);}})[_0xc511('0x25')](function(_0x1d3bd4){if(_0x1d3bd4){return _0x1d3bd4?{'count':_0x4a4c05,'rows':_0x1d3bd4}:null;}})[_0xc511('0x25')](respondWithResult(_0x1ff230,null))[_0xc511('0x4a')](handleError(_0x1ff230,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 56abdde..c8acfbb 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 _0x6c96=['api','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','lodash','../../config/logger'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0x6c96,0x1c1));var _0x66c9=function(_0x5dee38,_0x1ea9fb){_0x5dee38=_0x5dee38-0x0;var _0x394441=_0x6c96[_0x5dee38];return _0x394441;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var logger=require(_0x66c9('0x1'))(_0x66c9('0x2'));var moment=require('moment');var BPromise=require(_0x66c9('0x3'));var rp=require(_0x66c9('0x4'));var fs=require('fs');var path=require(_0x66c9('0x5'));var rimraf=require(_0x66c9('0x6'));var config=require(_0x66c9('0x7'));var attributes=require(_0x66c9('0x8'));module[_0x66c9('0x9')]=function(_0x55b24d,_0x1c8b59){return _0x55b24d['define'](_0x66c9('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe48=['tools_triggers','lodash','util','../../config/logger','api','moment','path','rimraf','./trigger.attributes','exports','define','Trigger'];(function(_0x4f528e,_0x80c98d){var _0x4006aa=function(_0x3220c2){while(--_0x3220c2){_0x4f528e['push'](_0x4f528e['shift']());}};_0x4006aa(++_0x80c98d);}(_0xbe48,0x121));var _0x8be4=function(_0x5eb16e,_0x5a1c26){_0x5eb16e=_0x5eb16e-0x0;var _0x3f3011=_0xbe48[_0x5eb16e];return _0x3f3011;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var logger=require(_0x8be4('0x2'))(_0x8be4('0x3'));var moment=require(_0x8be4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be4('0x5'));var rimraf=require(_0x8be4('0x6'));var config=require('../../config/environment');var attributes=require(_0x8be4('0x7'));module[_0x8be4('0x8')]=function(_0x286baa,_0x2312e8){return _0x286baa[_0x8be4('0x9')](_0x8be4('0xa'),attributes,{'tableName':_0x8be4('0xb'),'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 8281bc6..cf83cd6 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 _0xad2b=['message','catch','GetTrigger','Trigger','options','raw','attributes','limit','map','include','model','ShowTrigger','where','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x30ba3e,_0x4e8994){var _0x43cfae=function(_0x1604f5){while(--_0x1604f5){_0x30ba3e['push'](_0x30ba3e['shift']());}};_0x43cfae(++_0x4e8994);}(_0xad2b,0x16d));var _0xbad2=function(_0x2cc842,_0x4f889f){_0x2cc842=_0x2cc842-0x0;var _0xa1cb6f=_0xad2b[_0x2cc842];return _0xa1cb6f;};'use strict';var _=require(_0xbad2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbad2('0x1'));var rs=require(_0xbad2('0x2'));var fs=require('fs');var Redis=require(_0xbad2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbad2('0x4'));var logger=require(_0xbad2('0x5'))(_0xbad2('0x6'));var config=require(_0xbad2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbad2('0x8')][_0xbad2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f91e9,_0x475115,_0x48d1e6){return new BPromise(function(_0x454270,_0x4aee02){return client[_0xbad2('0xa')](_0x4f91e9,_0x48d1e6)[_0xbad2('0xb')](function(_0x5ba9b3){logger[_0xbad2('0xc')](_0xbad2('0xd'),_0x475115,'request\x20sent');logger[_0xbad2('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x475115,_0xbad2('0xf'),JSON[_0xbad2('0x10')](_0x5ba9b3));if(_0x5ba9b3[_0xbad2('0x11')]){if(_0x5ba9b3['error'][_0xbad2('0x12')]===0x1f4){logger['error'](_0xbad2('0xd'),_0x475115,_0x5ba9b3[_0xbad2('0x11')][_0xbad2('0x13')]);return _0x4aee02(_0x5ba9b3[_0xbad2('0x11')][_0xbad2('0x13')]);}logger['error'](_0xbad2('0xd'),_0x475115,_0x5ba9b3['error'][_0xbad2('0x13')]);return _0x454270(_0x5ba9b3[_0xbad2('0x11')][_0xbad2('0x13')]);}else{logger['info'](_0xbad2('0xd'),_0x475115,'request\x20sent');_0x454270(_0x5ba9b3['result'][_0xbad2('0x13')]);}})[_0xbad2('0x14')](function(_0x3b2bc5){logger[_0xbad2('0x11')](_0xbad2('0xd'),_0x475115,_0x3b2bc5);_0x4aee02(_0x3b2bc5);});});}exports[_0xbad2('0x15')]=function(_0x16efd3){var _0x2e4159=this;return new Promise(function(_0x221538,_0x1cda45){return db[_0xbad2('0x16')]['findAll']({'raw':_0x16efd3[_0xbad2('0x17')]?_0x16efd3[_0xbad2('0x17')][_0xbad2('0x18')]===undefined?!![]:![]:!![],'where':_0x16efd3[_0xbad2('0x17')]?_0x16efd3[_0xbad2('0x17')]['where']||null:null,'attributes':_0x16efd3[_0xbad2('0x17')]?_0x16efd3[_0xbad2('0x17')][_0xbad2('0x19')]||null:null,'limit':_0x16efd3[_0xbad2('0x17')]?_0x16efd3[_0xbad2('0x17')][_0xbad2('0x1a')]||null:null,'include':_0x16efd3[_0xbad2('0x17')]?_0x16efd3[_0xbad2('0x17')]['include']?_[_0xbad2('0x1b')](_0x16efd3[_0xbad2('0x17')][_0xbad2('0x1c')],function(_0x327d85){return{'model':db[_0x327d85[_0xbad2('0x1d')]],'as':_0x327d85['as'],'attributes':_0x327d85[_0xbad2('0x19')],'include':_0x327d85['include']?_[_0xbad2('0x1b')](_0x327d85[_0xbad2('0x1c')],function(_0x35dfd1){return{'model':db[_0x35dfd1[_0xbad2('0x1d')]],'as':_0x35dfd1['as'],'attributes':_0x35dfd1[_0xbad2('0x19')],'include':_0x35dfd1['include']?_[_0xbad2('0x1b')](_0x35dfd1[_0xbad2('0x1c')],function(_0x3033fd){return{'model':db[_0x3033fd[_0xbad2('0x1d')]],'as':_0x3033fd['as'],'attributes':_0x3033fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xbad2('0xb')](function(_0xea90fa){logger['info'](_0xbad2('0x15'),_0x16efd3);logger['debug'](_0xbad2('0x15'),_0x16efd3,JSON[_0xbad2('0x10')](_0xea90fa));_0x221538(_0xea90fa);})[_0xbad2('0x14')](function(_0x3b2a1d){logger['error'](_0xbad2('0x15'),_0x3b2a1d[_0xbad2('0x13')],_0x16efd3);_0x1cda45(_0x2e4159[_0xbad2('0x11')](0x1f4,_0x3b2a1d['message']));});});};exports[_0xbad2('0x1e')]=function(_0x269d2d){var _0x437c9a=this;return new Promise(function(_0x50e6f9,_0x4b8aa4){return db[_0xbad2('0x16')]['find']({'raw':_0x269d2d[_0xbad2('0x17')]?_0x269d2d['options'][_0xbad2('0x18')]===undefined?!![]:![]:!![],'where':_0x269d2d[_0xbad2('0x17')]?_0x269d2d[_0xbad2('0x17')][_0xbad2('0x1f')]||null:null,'attributes':_0x269d2d[_0xbad2('0x17')]?_0x269d2d[_0xbad2('0x17')][_0xbad2('0x19')]||null:null,'include':_0x269d2d[_0xbad2('0x17')]?_0x269d2d[_0xbad2('0x17')][_0xbad2('0x1c')]?_[_0xbad2('0x1b')](_0x269d2d[_0xbad2('0x17')][_0xbad2('0x1c')],function(_0xa6be76){return{'model':db[_0xa6be76['model']],'as':_0xa6be76['as'],'attributes':_0xa6be76[_0xbad2('0x19')],'include':_0xa6be76[_0xbad2('0x1c')]?_['map'](_0xa6be76[_0xbad2('0x1c')],function(_0x43666f){return{'model':db[_0x43666f[_0xbad2('0x1d')]],'as':_0x43666f['as'],'attributes':_0x43666f[_0xbad2('0x19')],'include':_0x43666f[_0xbad2('0x1c')]?_[_0xbad2('0x1b')](_0x43666f[_0xbad2('0x1c')],function(_0x23a105){return{'model':db[_0x23a105[_0xbad2('0x1d')]],'as':_0x23a105['as'],'attributes':_0x23a105[_0xbad2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbad2('0xb')](function(_0x9d920a){logger['info'](_0xbad2('0x1e'),_0x269d2d);logger[_0xbad2('0xe')]('ShowTrigger',_0x269d2d,JSON[_0xbad2('0x10')](_0x9d920a));_0x50e6f9(_0x9d920a);})[_0xbad2('0x14')](function(_0x2c05de){logger[_0xbad2('0x11')](_0xbad2('0x1e'),_0x2c05de['message'],_0x269d2d);_0x4b8aa4(_0x437c9a[_0xbad2('0x11')](0x1f4,_0x2c05de[_0xbad2('0x13')]));});});}; \ No newline at end of file +var _0x369e=['error','code','message','result','catch','Trigger','findAll','options','attributes','limit','map','include','model','GetTrigger','stringify','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2fbc46,_0x13e597){var _0xb827f2=function(_0xd0b50b){while(--_0xd0b50b){_0x2fbc46['push'](_0x2fbc46['shift']());}};_0xb827f2(++_0x13e597);}(_0x369e,0x17a));var _0xe369=function(_0x475a83,_0x44135e){_0x475a83=_0x475a83-0x0;var _0x1a866b=_0x369e[_0x475a83];return _0x1a866b;};'use strict';var _=require(_0xe369('0x0'));var util=require(_0xe369('0x1'));var moment=require(_0xe369('0x2'));var BPromise=require(_0xe369('0x3'));var rs=require(_0xe369('0x4'));var fs=require('fs');var Redis=require(_0xe369('0x5'));var db=require(_0xe369('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe369('0x7'))('rpc');var config=require(_0xe369('0x8'));var jayson=require(_0xe369('0x9'));var client=jayson[_0xe369('0xa')][_0xe369('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31916c,_0x17acb8,_0xfcad7b){return new BPromise(function(_0x2d80be,_0x225017){return client[_0xe369('0xc')](_0x31916c,_0xfcad7b)[_0xe369('0xd')](function(_0x4fe6cf){logger[_0xe369('0xe')](_0xe369('0xf'),_0x17acb8,_0xe369('0x10'));logger[_0xe369('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x17acb8,_0xe369('0x10'),JSON['stringify'](_0x4fe6cf));if(_0x4fe6cf[_0xe369('0x12')]){if(_0x4fe6cf[_0xe369('0x12')][_0xe369('0x13')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x17acb8,_0x4fe6cf['error'][_0xe369('0x14')]);return _0x225017(_0x4fe6cf[_0xe369('0x12')][_0xe369('0x14')]);}logger[_0xe369('0x12')](_0xe369('0xf'),_0x17acb8,_0x4fe6cf['error'][_0xe369('0x14')]);return _0x2d80be(_0x4fe6cf['error'][_0xe369('0x14')]);}else{logger[_0xe369('0xe')](_0xe369('0xf'),_0x17acb8,_0xe369('0x10'));_0x2d80be(_0x4fe6cf[_0xe369('0x15')][_0xe369('0x14')]);}})[_0xe369('0x16')](function(_0x3772a9){logger['error'](_0xe369('0xf'),_0x17acb8,_0x3772a9);_0x225017(_0x3772a9);});});}exports['GetTrigger']=function(_0x17ddc8){var _0x56d7d4=this;return new Promise(function(_0x40be18,_0x1ac8a0){return db[_0xe369('0x17')][_0xe369('0x18')]({'raw':_0x17ddc8['options']?_0x17ddc8[_0xe369('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x17ddc8[_0xe369('0x19')]?_0x17ddc8['options']['where']||null:null,'attributes':_0x17ddc8[_0xe369('0x19')]?_0x17ddc8[_0xe369('0x19')][_0xe369('0x1a')]||null:null,'limit':_0x17ddc8['options']?_0x17ddc8[_0xe369('0x19')][_0xe369('0x1b')]||null:null,'include':_0x17ddc8[_0xe369('0x19')]?_0x17ddc8[_0xe369('0x19')]['include']?_[_0xe369('0x1c')](_0x17ddc8[_0xe369('0x19')][_0xe369('0x1d')],function(_0x4197f9){return{'model':db[_0x4197f9['model']],'as':_0x4197f9['as'],'attributes':_0x4197f9[_0xe369('0x1a')],'include':_0x4197f9[_0xe369('0x1d')]?_[_0xe369('0x1c')](_0x4197f9[_0xe369('0x1d')],function(_0x5bfee4){return{'model':db[_0x5bfee4['model']],'as':_0x5bfee4['as'],'attributes':_0x5bfee4['attributes'],'include':_0x5bfee4[_0xe369('0x1d')]?_[_0xe369('0x1c')](_0x5bfee4[_0xe369('0x1d')],function(_0x5024ea){return{'model':db[_0x5024ea[_0xe369('0x1e')]],'as':_0x5024ea['as'],'attributes':_0x5024ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x194525){logger[_0xe369('0xe')](_0xe369('0x1f'),_0x17ddc8);logger[_0xe369('0x11')]('GetTrigger',_0x17ddc8,JSON[_0xe369('0x20')](_0x194525));_0x40be18(_0x194525);})[_0xe369('0x16')](function(_0x2ab862){logger[_0xe369('0x12')](_0xe369('0x1f'),_0x2ab862[_0xe369('0x14')],_0x17ddc8);_0x1ac8a0(_0x56d7d4['error'](0x1f4,_0x2ab862[_0xe369('0x14')]));});});};exports[_0xe369('0x21')]=function(_0x52ae42){var _0x5c5e91=this;return new Promise(function(_0x366f14,_0x429dc7){return db[_0xe369('0x17')][_0xe369('0x22')]({'raw':_0x52ae42[_0xe369('0x19')]?_0x52ae42[_0xe369('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x52ae42[_0xe369('0x19')]?_0x52ae42[_0xe369('0x19')][_0xe369('0x23')]||null:null,'attributes':_0x52ae42['options']?_0x52ae42[_0xe369('0x19')][_0xe369('0x1a')]||null:null,'include':_0x52ae42[_0xe369('0x19')]?_0x52ae42[_0xe369('0x19')]['include']?_[_0xe369('0x1c')](_0x52ae42[_0xe369('0x19')]['include'],function(_0x463ce4){return{'model':db[_0x463ce4[_0xe369('0x1e')]],'as':_0x463ce4['as'],'attributes':_0x463ce4[_0xe369('0x1a')],'include':_0x463ce4[_0xe369('0x1d')]?_['map'](_0x463ce4[_0xe369('0x1d')],function(_0x1eb048){return{'model':db[_0x1eb048[_0xe369('0x1e')]],'as':_0x1eb048['as'],'attributes':_0x1eb048[_0xe369('0x1a')],'include':_0x1eb048['include']?_[_0xe369('0x1c')](_0x1eb048[_0xe369('0x1d')],function(_0x422a19){return{'model':db[_0x422a19[_0xe369('0x1e')]],'as':_0x422a19['as'],'attributes':_0x422a19[_0xe369('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe369('0xd')](function(_0x5dbf49){logger[_0xe369('0xe')](_0xe369('0x21'),_0x52ae42);logger[_0xe369('0x11')](_0xe369('0x21'),_0x52ae42,JSON[_0xe369('0x20')](_0x5dbf49));_0x366f14(_0x5dbf49);})[_0xe369('0x16')](function(_0x42a4c6){logger[_0xe369('0x12')](_0xe369('0x21'),_0x42a4c6[_0xe369('0x14')],_0x52ae42);_0x429dc7(_0x5c5e91[_0xe369('0x12')](0x1f4,_0x42a4c6['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f47235a..cbeb44e 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 _0x337d=['../../components/auth/service','get','isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x5938cb,_0x45cbc1){var _0xcfa0ee=function(_0x57ba2f){while(--_0x57ba2f){_0x5938cb['push'](_0x5938cb['shift']());}};_0xcfa0ee(++_0x45cbc1);}(_0x337d,0xfb));var _0xd337=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x337d[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xd337('0x0'));var util=require(_0xd337('0x1'));var path=require('path');var timeout=require(_0xd337('0x2'));var express=require(_0xd337('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd337('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xd337('0x5')]('/',auth[_0xd337('0x6')](),controller[_0xd337('0x7')]);router['get']('/:id',auth[_0xd337('0x6')](),controller[_0xd337('0x8')]);router[_0xd337('0x9')](_0xd337('0xa'),auth[_0xd337('0x6')](),controller[_0xd337('0xb')]);router[_0xd337('0x9')]('/',auth[_0xd337('0x6')](),controller[_0xd337('0xc')]);router['put'](_0xd337('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd337('0xe')](_0xd337('0xd'),auth[_0xd337('0x6')](),controller[_0xd337('0xf')]);module[_0xd337('0x10')]=router; \ No newline at end of file +var _0x65fb=['index','/:id','show','post','clone','create','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3dddcc,_0x45807f){var _0x53b8a4=function(_0xac2a8){while(--_0xac2a8){_0x3dddcc['push'](_0x3dddcc['shift']());}};_0x53b8a4(++_0x45807f);}(_0x65fb,0x185));var _0xb65f=function(_0x4f750b,_0x4e3e43){_0x4f750b=_0x4f750b-0x0;var _0x918b39=_0x65fb[_0x4f750b];return _0x918b39;};'use strict';var multer=require(_0xb65f('0x0'));var util=require('util');var path=require(_0xb65f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb65f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb65f('0x3'));var config=require(_0xb65f('0x4'));var controller=require('./trunk.controller');router[_0xb65f('0x5')]('/',auth[_0xb65f('0x6')](),controller[_0xb65f('0x7')]);router[_0xb65f('0x5')](_0xb65f('0x8'),auth[_0xb65f('0x6')](),controller[_0xb65f('0x9')]);router[_0xb65f('0xa')]('/:id/clone',auth[_0xb65f('0x6')](),controller[_0xb65f('0xb')]);router[_0xb65f('0xa')]('/',auth[_0xb65f('0x6')](),controller[_0xb65f('0xc')]);router[_0xb65f('0xd')](_0xb65f('0x8'),auth[_0xb65f('0x6')](),controller[_0xb65f('0xe')]);router[_0xb65f('0xf')]('/:id',auth[_0xb65f('0x6')](),controller[_0xb65f('0x10')]);module[_0xb65f('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b92b975..8f8510d 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 _0xd28c=['active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate'];(function(_0x5c70f1,_0x4448ce){var _0x29734b=function(_0x7cfbcc){while(--_0x7cfbcc){_0x5c70f1['push'](_0x5c70f1['shift']());}};_0x29734b(++_0x4448ce);}(_0xd28c,0x11e));var _0xcd28=function(_0x5245b6,_0x121a28){_0x5245b6=_0x5245b6-0x0;var _0x4db3af=_0xd28c[_0x5245b6];return _0x4db3af;};'use strict';var Sequelize=require(_0xcd28('0x0'));module[_0xcd28('0x1')]={'name':{'type':Sequelize[_0xcd28('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcd28('0x3'),'user',_0xcd28('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xcd28('0x2')],'allowNull':![],'defaultValue':_0xcd28('0x5')},'callingpres':{'type':Sequelize[_0xcd28('0x6')]('ALLOWED_NOT_SCREENED',_0xcd28('0x7'),_0xcd28('0x8'),_0xcd28('0x9'),_0xcd28('0xa'),_0xcd28('0xb'),_0xcd28('0xc'),_0xcd28('0xd'))},'deny':{'type':Sequelize[_0xcd28('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xcd28('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xcd28('0x2')]},'transport':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0xe'),'set':function(_0x1e1595){this['setDataValue']('transport',_0x1e1595?_0x1e1595[_0xcd28('0xf')](','):null);},'get':function(){return this[_0xcd28('0x10')]('transport')?this[_0xcd28('0x10')](_0xcd28('0x11'))[_0xcd28('0x12')](','):null;},'comment':_0xcd28('0x13')},'dtmfmode':{'type':Sequelize[_0xcd28('0x6')]('rfc2833',_0xcd28('0x14'),_0xcd28('0x15'),'inband',_0xcd28('0x16')),'defaultValue':_0xcd28('0x17')},'directmedia':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no',_0xcd28('0x19'),_0xcd28('0x1a'),_0xcd28('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xcd28('0x2')]},'nat':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0x1c'),'set':function(_0x388851){this[_0xcd28('0x1d')](_0xcd28('0x1e'),_0x388851?_0x388851[_0xcd28('0xf')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0xcd28('0x1e'))[_0xcd28('0x12')](','):null;},'comment':_0xcd28('0x1f')},'callgroup':{'type':Sequelize[_0xcd28('0x2')]},'namedcallgroup':{'type':Sequelize[_0xcd28('0x2')]},'pickupgroup':{'type':Sequelize[_0xcd28('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcd28('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0x20')},'allow':{'type':Sequelize[_0xcd28('0x2')],'allowNull':![],'defaultValue':_0xcd28('0x21'),'set':function(_0x275817){this[_0xcd28('0x1d')]('allow',_0x275817?_0x275817[_0xcd28('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcd28('0x10')](_0xcd28('0x22'))?this[_0xcd28('0x10')]('allow')[_0xcd28('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xcd28('0x6')]('yes','no')},'insecure':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0x23'),'set':function(_0x4877e2){this['setDataValue'](_0xcd28('0x24'),_0x4877e2?_0x4877e2['join'](','):null);},'get':function(){return this[_0xcd28('0x10')](_0xcd28('0x24'))?this[_0xcd28('0x10')](_0xcd28('0x24'))[_0xcd28('0x12')](','):null;},'comment':_0xcd28('0x25')},'trustrpid':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no',_0xcd28('0x26'))},'promiscredir':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'accountcode':{'type':Sequelize[_0xcd28('0x27')](0xb)},'setvar':{'type':Sequelize[_0xcd28('0x2')]},'callerid':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xcd28('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xcd28('0x2')]},'template':{'type':Sequelize[_0xcd28('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no',_0xcd28('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd28('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcd28('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0xcd28('0x2')]},'session_timers':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x2a'),_0xcd28('0x2b'),_0xcd28('0x2c'))},'session_expires':{'type':Sequelize[_0xcd28('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xcd28('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x2d'),_0xcd28('0x2e')),'defaultValue':_0xcd28('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0xcd28('0x2')]},'regexten':{'type':Sequelize[_0xcd28('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xcd28('0x2')]},'port':{'type':Sequelize[_0xcd28('0x27')](0x5)},'qualify':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no'),'defaultValue':_0xcd28('0x18')},'keepalive':{'type':Sequelize[_0xcd28('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xcd28('0x2')]},'defaultuser':{'type':Sequelize[_0xcd28('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcd28('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no',_0xcd28('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcd28('0x2')]},'callbackextension':{'type':Sequelize[_0xcd28('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xcd28('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xcd28('0x2')]},'contactdeny':{'type':Sequelize[_0xcd28('0x2')]},'contactacl':{'type':Sequelize[_0xcd28('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xcd28('0x2')]},'use_q850_reason':{'type':Sequelize[_0xcd28('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'force_avp':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'icesupport':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no',_0xcd28('0x30'),_0xcd28('0x31'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xcd28('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xcd28('0x2')]},'dtlscipher':{'type':Sequelize[_0xcd28('0x2')]},'dtlscafile':{'type':Sequelize[_0xcd28('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xcd28('0x32'),_0xcd28('0x33'),_0xcd28('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcd28('0x2')]},'usereqphone':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcd28('0x2')]},'recordofffeature':{'type':Sequelize[_0xcd28('0x2')]},'call_limit':{'type':Sequelize[_0xcd28('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcd28('0x6')](_0xcd28('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no')},'vmexten':{'type':Sequelize[_0xcd28('0x2')]},'mohinterpret':{'type':Sequelize[_0xcd28('0x2')]},'mohsuggest':{'type':Sequelize[_0xcd28('0x2')]},'parkinglot':{'type':Sequelize[_0xcd28('0x2')]},'description':{'type':Sequelize[_0xcd28('0x2')]},'host':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':_0xcd28('0x35')},'canreinvite':{'type':Sequelize['ENUM'](_0xcd28('0x18'),'no',_0xcd28('0x19'),_0xcd28('0x1a'),_0xcd28('0x36')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcd28('0x2')]},'otherFields':{'type':Sequelize[_0xcd28('0x2')]},'active':{'type':Sequelize[_0xcd28('0x37')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcd28('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe649=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe649,0x95));var _0x9e64=function(_0x4c97e2,_0x1549a5){_0x4c97e2=_0x4c97e2-0x0;var _0x57a577=_0xe649[_0x4c97e2];return _0x57a577;};'use strict';var Sequelize=require(_0x9e64('0x0'));module[_0x9e64('0x1')]={'name':{'type':Sequelize[_0x9e64('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x4'),_0x9e64('0x5'),_0x9e64('0x6')),'allowNull':![],'defaultValue':_0x9e64('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x7'),_0x9e64('0x8'),_0x9e64('0x9'),_0x9e64('0xa'),_0x9e64('0xb'),_0x9e64('0xc'),_0x9e64('0xd'),_0x9e64('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x9e64('0x2')]},'secret':{'type':Sequelize[_0x9e64('0x2')]},'md5secret':{'type':Sequelize[_0x9e64('0x2')]},'remotesecret':{'type':Sequelize[_0x9e64('0x2')]},'transport':{'type':Sequelize[_0x9e64('0x2')],'defaultValue':_0x9e64('0xf'),'set':function(_0x1ca045){this[_0x9e64('0x10')](_0x9e64('0x11'),_0x1ca045?_0x1ca045[_0x9e64('0x12')](','):null);},'get':function(){return this[_0x9e64('0x13')]('transport')?this[_0x9e64('0x13')](_0x9e64('0x11'))[_0x9e64('0x14')](','):null;},'comment':_0x9e64('0x15')},'dtmfmode':{'type':Sequelize[_0x9e64('0x3')]('rfc2833',_0x9e64('0x16'),_0x9e64('0x17'),_0x9e64('0x18'),_0x9e64('0x19')),'defaultValue':_0x9e64('0x1a')},'directmedia':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no',_0x9e64('0x1c'),_0x9e64('0x1d'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9e64('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9e64('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x9e64('0x1e'),'set':function(_0x1f6ed2){this[_0x9e64('0x10')](_0x9e64('0x1f'),_0x1f6ed2?_0x1f6ed2[_0x9e64('0x12')](','):null);},'get':function(){return this[_0x9e64('0x13')](_0x9e64('0x1f'))?this[_0x9e64('0x13')](_0x9e64('0x1f'))[_0x9e64('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9e64('0x2')]},'pickupgroup':{'type':Sequelize[_0x9e64('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9e64('0x2')]},'language':{'type':Sequelize[_0x9e64('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9e64('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9e64('0x2')],'defaultValue':_0x9e64('0x20')},'allow':{'type':Sequelize[_0x9e64('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5b1f22){this[_0x9e64('0x10')]('allow',_0x5b1f22?_0x5b1f22[_0x9e64('0x12')](';'):_0x9e64('0x21'));},'get':function(){return this[_0x9e64('0x13')](_0x9e64('0x22'))?this[_0x9e64('0x13')](_0x9e64('0x22'))[_0x9e64('0x14')](';'):null;},'comment':_0x9e64('0x23')},'autoframing':{'type':Sequelize[_0x9e64('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x9e64('0x24'),'set':function(_0x32262d){this[_0x9e64('0x10')]('insecure',_0x32262d?_0x32262d[_0x9e64('0x12')](','):null);},'get':function(){return this[_0x9e64('0x13')](_0x9e64('0x25'))?this['getDataValue']('insecure')[_0x9e64('0x14')](','):null;},'comment':_0x9e64('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0x9e64('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9e64('0x3')]('yes','no',_0x9e64('0x27'))},'promiscredir':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x9e64('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x9e64('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no'),'defaultValue':_0x9e64('0x1b')},'busylevel':{'type':Sequelize[_0x9e64('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x9e64('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x9e64('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x9e64('0x2')]},'videosupport':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9e64('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x9e64('0x2')]},'session_timers':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x2a'),_0x9e64('0x2b'),_0x9e64('0x2c'))},'session_expires':{'type':Sequelize[_0x9e64('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x9e64('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x2d'),_0x9e64('0x2e')),'defaultValue':_0x9e64('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x9e64('0x2')]},'regexten':{'type':Sequelize[_0x9e64('0x2')]},'fromdomain':{'type':Sequelize[_0x9e64('0x2')]},'fromuser':{'type':Sequelize[_0x9e64('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x9e64('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x9e64('0x29')](0xb)},'defaultip':{'type':Sequelize[_0x9e64('0x2')]},'defaultuser':{'type':Sequelize[_0x9e64('0x2')]},'rtptimeout':{'type':Sequelize[_0x9e64('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9e64('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x9e64('0x3')]('yes','no',_0x9e64('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x9e64('0x29')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x9e64('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0x9e64('0x2')]},'contactdeny':{'type':Sequelize[_0x9e64('0x2')]},'contactacl':{'type':Sequelize[_0x9e64('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x9e64('0x2')]},'maxforwards':{'type':Sequelize[_0x9e64('0x29')](0xb)},'encryption':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x9e64('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x9e64('0x3')]('yes','no',_0x9e64('0x30'),_0x9e64('0x31'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x9e64('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x9e64('0x2')]},'dtlscafile':{'type':Sequelize[_0x9e64('0x2')]},'dtlscapath':{'type':Sequelize[_0x9e64('0x2')]},'dtlssetup':{'type':Sequelize[_0x9e64('0x3')]('active',_0x9e64('0x32'),_0x9e64('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9e64('0x2')]},'usereqphone':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9e64('0x2')]},'recordofffeature':{'type':Sequelize[_0x9e64('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9e64('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9e64('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x9e64('0x2')]},'mohinterpret':{'type':Sequelize[_0x9e64('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9e64('0x2')]},'host':{'type':Sequelize[_0x9e64('0x2')],'defaultValue':_0x9e64('0x34')},'canreinvite':{'type':Sequelize[_0x9e64('0x3')](_0x9e64('0x1b'),'no',_0x9e64('0x1c'),'update',_0x9e64('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9e64('0x2')]},'otherFields':{'type':Sequelize[_0x9e64('0x2')]},'active':{'type':Sequelize[_0x9e64('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9e64('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 863081b..0a6ed99 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 _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x1c3566,_0x568c57){var _0xd622f=function(_0x4ce932){while(--_0x4ce932){_0x1c3566['push'](_0x1c3566['shift']());}};_0xd622f(++_0x568c57);}(_0xa41a,0x6b));var _0xaa41=function(_0x76d358,_0x36dc53){_0x76d358=_0x76d358-0x0;var _0x23c0b3=_0xa41a[_0x76d358];return _0x23c0b3;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file +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(_0x308ca4,_0x57770b){var _0x4086a9=function(_0x31014b){while(--_0x31014b){_0x308ca4['push'](_0x308ca4['shift']());}};_0x4086a9(++_0x57770b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3ff00b,_0x1ef96c){_0x3ff00b=_0x3ff00b-0x0;var _0x31a9e6=_0x9bde[_0x3ff00b];return _0x31a9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c21eca9..a20621d 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 _0xd585=['exports','Trunk','tools_trunks','util','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x4e18a,_0x2d220a){var _0x56cc08=function(_0x1a5e7e){while(--_0x1a5e7e){_0x4e18a['push'](_0x4e18a['shift']());}};_0x56cc08(++_0x2d220a);}(_0xd585,0xad));var _0x5d58=function(_0x9aad16,_0x3b6ce6){_0x9aad16=_0x9aad16-0x0;var _0x45aa70=_0xd585[_0x9aad16];return _0x45aa70;};'use strict';var _=require('lodash');var util=require(_0x5d58('0x0'));var logger=require('../../config/logger')(_0x5d58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d58('0x2'));var fs=require('fs');var path=require(_0x5d58('0x3'));var rimraf=require(_0x5d58('0x4'));var config=require(_0x5d58('0x5'));var attributes=require(_0x5d58('0x6'));module[_0x5d58('0x7')]=function(_0x208b1c,_0x2f5108){return _0x208b1c['define'](_0x5d58('0x8'),attributes,{'tableName':_0x5d58('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf35c=['./trunk.attributes','exports','Trunk','tools_trunks','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x186872,_0x50a406){var _0x2f440d=function(_0x41691d){while(--_0x41691d){_0x186872['push'](_0x186872['shift']());}};_0x2f440d(++_0x50a406);}(_0xf35c,0x122));var _0xcf35=function(_0x40b1c8,_0x2a941e){_0x40b1c8=_0x40b1c8-0x0;var _0x1e54a9=_0xf35c[_0x40b1c8];return _0x1e54a9;};'use strict';var _=require('lodash');var util=require(_0xcf35('0x0'));var logger=require('../../config/logger')(_0xcf35('0x1'));var moment=require(_0xcf35('0x2'));var BPromise=require(_0xcf35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf35('0x4'));var rimraf=require(_0xcf35('0x5'));var config=require(_0xcf35('0x6'));var attributes=require(_0xcf35('0x7'));module[_0xcf35('0x8')]=function(_0xe27b06,_0x3225b3){return _0xe27b06['define'](_0xcf35('0x9'),attributes,{'tableName':_0xcf35('0xa'),'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 83257a5..cd82d2f 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 _0xbebf=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','findAll','raw','options','where','limit','map','model','attributes','include','then','GetTrunk','stringify','ShowTrunk'];(function(_0x31688a,_0x588c7d){var _0xc7b088=function(_0x3ed4c8){while(--_0x3ed4c8){_0x31688a['push'](_0x31688a['shift']());}};_0xc7b088(++_0x588c7d);}(_0xbebf,0xcd));var _0xfbeb=function(_0x46334e,_0x51af24){_0x46334e=_0x46334e-0x0;var _0x19e1ff=_0xbebf[_0x46334e];return _0x19e1ff;};'use strict';var _=require(_0xfbeb('0x0'));var util=require(_0xfbeb('0x1'));var moment=require(_0xfbeb('0x2'));var BPromise=require(_0xfbeb('0x3'));var rs=require(_0xfbeb('0x4'));var fs=require('fs');var Redis=require(_0xfbeb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbeb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfbeb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfbeb('0x8')][_0xfbeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1138a7,_0x280d83,_0x5765b9){return new BPromise(function(_0x2b6b61,_0x24ea46){return client[_0xfbeb('0xa')](_0x1138a7,_0x5765b9)['then'](function(_0x12fd0f){logger[_0xfbeb('0xb')](_0xfbeb('0xc'),_0x280d83,'request\x20sent');logger[_0xfbeb('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x280d83,_0xfbeb('0xe'),JSON['stringify'](_0x12fd0f));if(_0x12fd0f[_0xfbeb('0xf')]){if(_0x12fd0f[_0xfbeb('0xf')][_0xfbeb('0x10')]===0x1f4){logger['error'](_0xfbeb('0xc'),_0x280d83,_0x12fd0f[_0xfbeb('0xf')][_0xfbeb('0x11')]);return _0x24ea46(_0x12fd0f['error']['message']);}logger['error'](_0xfbeb('0xc'),_0x280d83,_0x12fd0f['error'][_0xfbeb('0x11')]);return _0x2b6b61(_0x12fd0f[_0xfbeb('0xf')][_0xfbeb('0x11')]);}else{logger[_0xfbeb('0xb')](_0xfbeb('0xc'),_0x280d83,'request\x20sent');_0x2b6b61(_0x12fd0f[_0xfbeb('0x12')][_0xfbeb('0x11')]);}})[_0xfbeb('0x13')](function(_0xfaad4d){logger[_0xfbeb('0xf')]('Trunk,\x20%s,\x20%s',_0x280d83,_0xfaad4d);_0x24ea46(_0xfaad4d);});});}exports['GetTrunk']=function(_0x13708a){var _0x3cd343=this;return new Promise(function(_0x351b22,_0xefe7b4){return db['Trunk'][_0xfbeb('0x14')]({'raw':_0x13708a['options']?_0x13708a['options'][_0xfbeb('0x15')]===undefined?!![]:![]:!![],'where':_0x13708a[_0xfbeb('0x16')]?_0x13708a[_0xfbeb('0x16')][_0xfbeb('0x17')]||null:null,'attributes':_0x13708a['options']?_0x13708a[_0xfbeb('0x16')]['attributes']||null:null,'limit':_0x13708a[_0xfbeb('0x16')]?_0x13708a[_0xfbeb('0x16')][_0xfbeb('0x18')]||null:null,'include':_0x13708a[_0xfbeb('0x16')]?_0x13708a[_0xfbeb('0x16')]['include']?_[_0xfbeb('0x19')](_0x13708a[_0xfbeb('0x16')]['include'],function(_0x31e930){return{'model':db[_0x31e930['model']],'as':_0x31e930['as'],'attributes':_0x31e930['attributes'],'include':_0x31e930['include']?_[_0xfbeb('0x19')](_0x31e930['include'],function(_0x11607f){return{'model':db[_0x11607f[_0xfbeb('0x1a')]],'as':_0x11607f['as'],'attributes':_0x11607f[_0xfbeb('0x1b')],'include':_0x11607f[_0xfbeb('0x1c')]?_[_0xfbeb('0x19')](_0x11607f[_0xfbeb('0x1c')],function(_0x39d3ec){return{'model':db[_0x39d3ec[_0xfbeb('0x1a')]],'as':_0x39d3ec['as'],'attributes':_0x39d3ec[_0xfbeb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbeb('0x1d')](function(_0x2b9dc1){logger['info']('GetTrunk',_0x13708a);logger[_0xfbeb('0xd')](_0xfbeb('0x1e'),_0x13708a,JSON[_0xfbeb('0x1f')](_0x2b9dc1));_0x351b22(_0x2b9dc1);})['catch'](function(_0x31b693){logger['error'](_0xfbeb('0x1e'),_0x31b693[_0xfbeb('0x11')],_0x13708a);_0xefe7b4(_0x3cd343[_0xfbeb('0xf')](0x1f4,_0x31b693[_0xfbeb('0x11')]));});});};exports[_0xfbeb('0x20')]=function(_0x21ccf4){var _0xcece06=this;return new Promise(function(_0x5c6391,_0x1eb18f){return db['Trunk'][_0xfbeb('0x21')]({'raw':_0x21ccf4[_0xfbeb('0x16')]?_0x21ccf4['options']['raw']===undefined?!![]:![]:!![],'where':_0x21ccf4[_0xfbeb('0x16')]?_0x21ccf4[_0xfbeb('0x16')]['where']||null:null,'attributes':_0x21ccf4[_0xfbeb('0x16')]?_0x21ccf4[_0xfbeb('0x16')]['attributes']||null:null,'include':_0x21ccf4[_0xfbeb('0x16')]?_0x21ccf4[_0xfbeb('0x16')][_0xfbeb('0x1c')]?_[_0xfbeb('0x19')](_0x21ccf4[_0xfbeb('0x16')][_0xfbeb('0x1c')],function(_0x33c09e){return{'model':db[_0x33c09e[_0xfbeb('0x1a')]],'as':_0x33c09e['as'],'attributes':_0x33c09e[_0xfbeb('0x1b')],'include':_0x33c09e['include']?_[_0xfbeb('0x19')](_0x33c09e[_0xfbeb('0x1c')],function(_0x55f6b6){return{'model':db[_0x55f6b6['model']],'as':_0x55f6b6['as'],'attributes':_0x55f6b6[_0xfbeb('0x1b')],'include':_0x55f6b6[_0xfbeb('0x1c')]?_[_0xfbeb('0x19')](_0x55f6b6[_0xfbeb('0x1c')],function(_0xe05a7f){return{'model':db[_0xe05a7f['model']],'as':_0xe05a7f['as'],'attributes':_0xe05a7f[_0xfbeb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x101fff){logger[_0xfbeb('0xb')](_0xfbeb('0x20'),_0x21ccf4);logger['debug'](_0xfbeb('0x20'),_0x21ccf4,JSON[_0xfbeb('0x1f')](_0x101fff));_0x5c6391(_0x101fff);})[_0xfbeb('0x13')](function(_0x140a36){logger[_0xfbeb('0xf')](_0xfbeb('0x20'),_0x140a36[_0xfbeb('0x11')],_0x21ccf4);_0x1eb18f(_0xcece06[_0xfbeb('0xf')](0x1f4,_0x140a36[_0xfbeb('0x11')]));});});}; \ No newline at end of file +var _0x007d=['map','model','info','catch','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTrunk','Trunk','findAll','options','raw','where','attributes','include'];(function(_0x442233,_0x38c4f1){var _0x2a0807=function(_0x343f73){while(--_0x343f73){_0x442233['push'](_0x442233['shift']());}};_0x2a0807(++_0x38c4f1);}(_0x007d,0xc5));var _0xd007=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x007d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd007('0x0'));var util=require(_0xd007('0x1'));var moment=require(_0xd007('0x2'));var BPromise=require(_0xd007('0x3'));var rs=require(_0xd007('0x4'));var fs=require('fs');var Redis=require(_0xd007('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd007('0x6'));var logger=require('../../config/logger')(_0xd007('0x7'));var config=require(_0xd007('0x8'));var jayson=require(_0xd007('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x239318,_0x4cdedc,_0x20ca9e){return new BPromise(function(_0x4f86a8,_0x4611fe){return client['request'](_0x239318,_0x20ca9e)[_0xd007('0xa')](function(_0x5f1199){logger['info'](_0xd007('0xb'),_0x4cdedc,'request\x20sent');logger[_0xd007('0xc')](_0xd007('0xd'),_0x4cdedc,_0xd007('0xe'),JSON[_0xd007('0xf')](_0x5f1199));if(_0x5f1199[_0xd007('0x10')]){if(_0x5f1199['error'][_0xd007('0x11')]===0x1f4){logger[_0xd007('0x10')](_0xd007('0xb'),_0x4cdedc,_0x5f1199[_0xd007('0x10')][_0xd007('0x12')]);return _0x4611fe(_0x5f1199[_0xd007('0x10')][_0xd007('0x12')]);}logger[_0xd007('0x10')]('Trunk,\x20%s,\x20%s',_0x4cdedc,_0x5f1199[_0xd007('0x10')][_0xd007('0x12')]);return _0x4f86a8(_0x5f1199[_0xd007('0x10')][_0xd007('0x12')]);}else{logger['info'](_0xd007('0xb'),_0x4cdedc,_0xd007('0xe'));_0x4f86a8(_0x5f1199['result'][_0xd007('0x12')]);}})['catch'](function(_0x4a5939){logger[_0xd007('0x10')]('Trunk,\x20%s,\x20%s',_0x4cdedc,_0x4a5939);_0x4611fe(_0x4a5939);});});}exports[_0xd007('0x13')]=function(_0x41b709){var _0x2de9f2=this;return new Promise(function(_0x2220d0,_0x2619a3){return db[_0xd007('0x14')][_0xd007('0x15')]({'raw':_0x41b709[_0xd007('0x16')]?_0x41b709[_0xd007('0x16')][_0xd007('0x17')]===undefined?!![]:![]:!![],'where':_0x41b709[_0xd007('0x16')]?_0x41b709[_0xd007('0x16')][_0xd007('0x18')]||null:null,'attributes':_0x41b709[_0xd007('0x16')]?_0x41b709[_0xd007('0x16')][_0xd007('0x19')]||null:null,'limit':_0x41b709[_0xd007('0x16')]?_0x41b709[_0xd007('0x16')]['limit']||null:null,'include':_0x41b709['options']?_0x41b709[_0xd007('0x16')][_0xd007('0x1a')]?_[_0xd007('0x1b')](_0x41b709['options'][_0xd007('0x1a')],function(_0x494150){return{'model':db[_0x494150[_0xd007('0x1c')]],'as':_0x494150['as'],'attributes':_0x494150[_0xd007('0x19')],'include':_0x494150[_0xd007('0x1a')]?_[_0xd007('0x1b')](_0x494150[_0xd007('0x1a')],function(_0x2a6a68){return{'model':db[_0x2a6a68['model']],'as':_0x2a6a68['as'],'attributes':_0x2a6a68['attributes'],'include':_0x2a6a68[_0xd007('0x1a')]?_[_0xd007('0x1b')](_0x2a6a68[_0xd007('0x1a')],function(_0x44d216){return{'model':db[_0x44d216[_0xd007('0x1c')]],'as':_0x44d216['as'],'attributes':_0x44d216[_0xd007('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd007('0xa')](function(_0x50ab2e){logger[_0xd007('0x1d')](_0xd007('0x13'),_0x41b709);logger[_0xd007('0xc')](_0xd007('0x13'),_0x41b709,JSON['stringify'](_0x50ab2e));_0x2220d0(_0x50ab2e);})[_0xd007('0x1e')](function(_0x2aa7cf){logger[_0xd007('0x10')]('GetTrunk',_0x2aa7cf[_0xd007('0x12')],_0x41b709);_0x2619a3(_0x2de9f2['error'](0x1f4,_0x2aa7cf[_0xd007('0x12')]));});});};exports['ShowTrunk']=function(_0x50e336){var _0x4194ca=this;return new Promise(function(_0x191244,_0x4d9817){return db[_0xd007('0x14')]['find']({'raw':_0x50e336[_0xd007('0x16')]?_0x50e336[_0xd007('0x16')][_0xd007('0x17')]===undefined?!![]:![]:!![],'where':_0x50e336[_0xd007('0x16')]?_0x50e336[_0xd007('0x16')][_0xd007('0x18')]||null:null,'attributes':_0x50e336[_0xd007('0x16')]?_0x50e336[_0xd007('0x16')]['attributes']||null:null,'include':_0x50e336[_0xd007('0x16')]?_0x50e336[_0xd007('0x16')][_0xd007('0x1a')]?_['map'](_0x50e336['options']['include'],function(_0x2a8ff4){return{'model':db[_0x2a8ff4[_0xd007('0x1c')]],'as':_0x2a8ff4['as'],'attributes':_0x2a8ff4['attributes'],'include':_0x2a8ff4[_0xd007('0x1a')]?_['map'](_0x2a8ff4[_0xd007('0x1a')],function(_0x18af65){return{'model':db[_0x18af65['model']],'as':_0x18af65['as'],'attributes':_0x18af65['attributes'],'include':_0x18af65['include']?_['map'](_0x18af65[_0xd007('0x1a')],function(_0xe5fa05){return{'model':db[_0xe5fa05['model']],'as':_0xe5fa05['as'],'attributes':_0xe5fa05['attributes']};}):[]};}):[]};}):[]:[]})[_0xd007('0xa')](function(_0x5903e8){logger[_0xd007('0x1d')]('ShowTrunk',_0x50e336);logger[_0xd007('0xc')]('ShowTrunk',_0x50e336,JSON[_0xd007('0xf')](_0x5903e8));_0x191244(_0x5903e8);})['catch'](function(_0x225390){logger[_0xd007('0x10')](_0xd007('0x1f'),_0x225390[_0xd007('0x12')],_0x50e336);_0x4d9817(_0x4194ca[_0xd007('0x10')](0x1f4,_0x225390[_0xd007('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 61307b0..5bdd0e5 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 _0x58db=['exports','express','Router','../../components/auth/service','put','/:id','update'];(function(_0x15301f,_0x468db2){var _0x1180a2=function(_0x3f378c){while(--_0x3f378c){_0x15301f['push'](_0x15301f['shift']());}};_0x1180a2(++_0x468db2);}(_0x58db,0xbe));var _0xb58d=function(_0x109864,_0x44d549){_0x109864=_0x109864-0x0;var _0x2cb228=_0x58db[_0x109864];return _0x2cb228;};'use strict';var express=require(_0xb58d('0x0'));var router=express[_0xb58d('0x1')]();var auth=require(_0xb58d('0x2'));var controller=require('./user-setting.controller');router[_0xb58d('0x3')](_0xb58d('0x4'),auth['isAuthenticated'](),controller[_0xb58d('0x5')]);module[_0xb58d('0x6')]=router; \ No newline at end of file +var _0x9a18=['isAuthenticated','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0xe29e17,_0x535f1b){var _0x105196=function(_0xc618){while(--_0xc618){_0xe29e17['push'](_0xe29e17['shift']());}};_0x105196(++_0x535f1b);}(_0x9a18,0x1de));var _0x89a1=function(_0x630d2f,_0x128b44){_0x630d2f=_0x630d2f-0x0;var _0xb91bef=_0x9a18[_0x630d2f];return _0xb91bef;};'use strict';var express=require(_0x89a1('0x0'));var router=express[_0x89a1('0x1')]();var auth=require(_0x89a1('0x2'));var controller=require(_0x89a1('0x3'));router[_0x89a1('0x4')]('/:id',auth[_0x89a1('0x5')](),controller['update']);module[_0x89a1('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index f5d7a6e..5388209 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 _0x8e89=['error','warning','info','debug','exports','BOOLEAN','TEXT','INTEGER','UserId','sequelize'];(function(_0x479123,_0x1624de){var _0x3691d4=function(_0x2ebfb4){while(--_0x2ebfb4){_0x479123['push'](_0x479123['shift']());}};_0x3691d4(++_0x1624de);}(_0x8e89,0x10d));var _0x98e8=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x8e89[_0x2f62aa];return _0x1a341f;};'use strict';var Sequelize=require(_0x98e8('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x98e8('0x1'),_0x98e8('0x2'),_0x98e8('0x3'),_0x98e8('0x4')];module[_0x98e8('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x98e8('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x98e8('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x98e8('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x98e8('0x8')],'unique':_0x98e8('0x9')}}; \ No newline at end of file +var _0xf93c=['debug','exports','ENUM','TEXT','INTEGER','UserId','error','warning','info'];(function(_0x3f64c8,_0x3b08c2){var _0x53e555=function(_0x414431){while(--_0x414431){_0x3f64c8['push'](_0x3f64c8['shift']());}};_0x53e555(++_0x3b08c2);}(_0xf93c,0x11d));var _0xcf93=function(_0x19034d,_0x12b137){_0x19034d=_0x19034d-0x0;var _0x53baf6=_0xf93c[_0x19034d];return _0x53baf6;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xcf93('0x0'),_0xcf93('0x1'),_0xcf93('0x2'),_0xcf93('0x3')];module[_0xcf93('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xcf93('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcf93('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcf93('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcf93('0x7')],'unique':_0xcf93('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 4d5d5fb..80bb5f1 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 _0x0e35=['error','stack','name','status','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','update','then','sendStatus'];(function(_0x3d86f5,_0x257914){var _0x2d6881=function(_0x2d912e){while(--_0x2d912e){_0x3d86f5['push'](_0x3d86f5['shift']());}};_0x2d6881(++_0x257914);}(_0x0e35,0xc2));var _0x50e3=function(_0x47aaec,_0x17e6a6){_0x47aaec=_0x47aaec-0x0;var _0x5da089=_0x0e35[_0x47aaec];return _0x5da089;};'use strict';var _=require(_0x50e3('0x0'));var Redis=require(_0x50e3('0x1'));var logger=require(_0x50e3('0x2'))(_0x50e3('0x3'));var config=require(_0x50e3('0x4'));var db=require(_0x50e3('0x5'))['db'];var socket=require(_0x50e3('0x6'))(new Redis(config[_0x50e3('0x7')]));require(_0x50e3('0x8'))[_0x50e3('0x9')](socket);config['redis']=_[_0x50e3('0xa')](config[_0x50e3('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5defe6,_0x2ac084){_0x2ac084=_0x2ac084||0xc8;return function(_0x1ed6ec){if(_0x1ed6ec){return _0x5defe6['status'](_0x2ac084)['json'](_0x1ed6ec);}};}function saveUpdates(_0x35c16c){return function(_0x39e754){if(_0x39e754){return _0x39e754[_0x50e3('0xb')](_0x35c16c)[_0x50e3('0xc')](function(_0x3dbc46){return _0x3dbc46;});}return null;};}function handleEntityNotFound(_0x1deed0){return function(_0x2bf7a7){if(!_0x2bf7a7){_0x1deed0[_0x50e3('0xd')](0x194);}return _0x2bf7a7;};}function handleError(_0x2d43c5,_0x35b58b){_0x35b58b=_0x35b58b||0x1f4;return function(_0x3b2e32){logger[_0x50e3('0xe')](_0x3b2e32[_0x50e3('0xf')]);if(_0x3b2e32['name']){delete _0x3b2e32[_0x50e3('0x10')];}_0x2d43c5[_0x50e3('0x11')](_0x35b58b)[_0x50e3('0x12')](_0x3b2e32);};}exports[_0x50e3('0xb')]=function(_0x52b56a,_0x104858){if(_0x52b56a[_0x50e3('0x13')]['role']!==_0x50e3('0x14'))throw new Error(_0x50e3('0x15'));if(isNaN(Number(_0x52b56a[_0x50e3('0x16')]['id'])))throw new Error(_0x50e3('0x17'));return db[_0x50e3('0x18')]['find']({'where':{'id':_0x52b56a[_0x50e3('0x16')]['id']}})['then'](handleEntityNotFound(_0x104858,null))[_0x50e3('0xc')](saveUpdates(_0x52b56a[_0x50e3('0x19')],null))[_0x50e3('0xc')](respondWithResult(_0x104858,null))['catch'](handleError(_0x104858,null));}; \ No newline at end of file +var _0xa991=['error','name','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','update','then','sendStatus'];(function(_0x5bcf68,_0x1f65ba){var _0x10da1e=function(_0x36f71e){while(--_0x36f71e){_0x5bcf68['push'](_0x5bcf68['shift']());}};_0x10da1e(++_0x1f65ba);}(_0xa991,0x143));var _0x1a99=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa991[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x1a99('0x0'));var Redis=require('ioredis');var logger=require(_0x1a99('0x1'))(_0x1a99('0x2'));var config=require(_0x1a99('0x3'));var db=require(_0x1a99('0x4'))['db'];var socket=require(_0x1a99('0x5'))(new Redis(config['redis']));require(_0x1a99('0x6'))[_0x1a99('0x7')](socket);config[_0x1a99('0x8')]=_[_0x1a99('0x9')](config[_0x1a99('0x8')],{'host':_0x1a99('0xa'),'port':0x18eb});function respondWithResult(_0xbaf427,_0x50e382){_0x50e382=_0x50e382||0xc8;return function(_0x8e29c6){if(_0x8e29c6){return _0xbaf427['status'](_0x50e382)[_0x1a99('0xb')](_0x8e29c6);}};}function saveUpdates(_0x43fb13){return function(_0x36f9b2){if(_0x36f9b2){return _0x36f9b2[_0x1a99('0xc')](_0x43fb13)[_0x1a99('0xd')](function(_0x1ba9b2){return _0x1ba9b2;});}return null;};}function handleEntityNotFound(_0x48f59b){return function(_0x22016d){if(!_0x22016d){_0x48f59b[_0x1a99('0xe')](0x194);}return _0x22016d;};}function handleError(_0x2c83e2,_0x50220b){_0x50220b=_0x50220b||0x1f4;return function(_0x33260c){logger[_0x1a99('0xf')](_0x33260c['stack']);if(_0x33260c[_0x1a99('0x10')]){delete _0x33260c['name'];}_0x2c83e2['status'](_0x50220b)[_0x1a99('0x11')](_0x33260c);};}exports[_0x1a99('0xc')]=function(_0x9840cb,_0x53349a){if(_0x9840cb['user'][_0x1a99('0x12')]!==_0x1a99('0x13'))throw new Error(_0x1a99('0x14'));if(isNaN(Number(_0x9840cb[_0x1a99('0x15')]['id'])))throw new Error(_0x1a99('0x16'));return db['UserSetting'][_0x1a99('0x17')]({'where':{'id':_0x9840cb['params']['id']}})[_0x1a99('0xd')](handleEntityNotFound(_0x53349a,null))[_0x1a99('0xd')](saveUpdates(_0x9840cb[_0x1a99('0x18')],null))[_0x1a99('0xd')](respondWithResult(_0x53349a,null))[_0x1a99('0x19')](handleError(_0x53349a,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 2d98dc6..c85f356 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 _0x8449=['../../mysqldb','UserSetting','setMaxListeners','emit','hook','exports','events'];(function(_0x3957dc,_0x525687){var _0x107bc4=function(_0x59ab60){while(--_0x59ab60){_0x3957dc['push'](_0x3957dc['shift']());}};_0x107bc4(++_0x525687);}(_0x8449,0xa7));var _0x9844=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8449[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0x9844('0x0'));var UserSetting=require(_0x9844('0x1'))['db'][_0x9844('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9844('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c3f0d){return function(_0x2d229c,_0x4217e6,_0x309820){UserSettingEvents[_0x9844('0x4')](_0x1c3f0d+':'+_0x2d229c['id'],_0x2d229c);UserSettingEvents[_0x9844('0x4')](_0x1c3f0d,_0x2d229c);_0x309820(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x9844('0x5')](e,emitEvent(event));}}module[_0x9844('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xcee7=['hasOwnProperty','hook','UserSetting','setMaxListeners','update','remove','emit'];(function(_0x1a64ca,_0x50e048){var _0x273250=function(_0x2cf2fd){while(--_0x2cf2fd){_0x1a64ca['push'](_0x1a64ca['shift']());}};_0x273250(++_0x50e048);}(_0xcee7,0x191));var _0x7cee=function(_0x282e91,_0x534f58){_0x282e91=_0x282e91-0x0;var _0x320649=_0xcee7[_0x282e91];return _0x320649;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x7cee('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7cee('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cee('0x2'),'afterDestroy':_0x7cee('0x3')};function emitEvent(_0x86149b){return function(_0x530672,_0x600704,_0x55d634){UserSettingEvents[_0x7cee('0x4')](_0x86149b+':'+_0x530672['id'],_0x530672);UserSettingEvents['emit'](_0x86149b,_0x530672);_0x55d634(null);};}for(var e in events){if(events[_0x7cee('0x5')](e)){var event=events[e];UserSetting[_0x7cee('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 075864f..affb7fb 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 _0xd8b0=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x4c71fa,_0x14b8f7){var _0x46621e=function(_0xcc58b2){while(--_0xcc58b2){_0x4c71fa['push'](_0x4c71fa['shift']());}};_0x46621e(++_0x14b8f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3){return _0x5a55a3['define']('UserSetting',attributes,{'tableName':_0x0d8b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9b89){if(!_0x5b9b89[_0x0d8b('0x3')])_0x5b9b89[_0x0d8b('0x4')]=null;else if(_0x5b9b89[_0x0d8b('0x4')]===null)_0x5b9b89['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x9f3e=['UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x5b8ee1,_0x3f8e13){_0x5b8ee1=_0x5b8ee1-0x0;var _0x1000c5=_0x9f3e[_0x5b8ee1];return _0x1000c5;};'use strict';var attributes=require(_0xe9f3('0x0'));module[_0xe9f3('0x1')]=function(_0x28c509){return _0x28c509[_0xe9f3('0x2')](_0xe9f3('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x597538){if(!_0x597538['clientSideLoggingEnabled'])_0x597538[_0xe9f3('0x4')]=null;else if(_0x597538['clientSideLoggingEnabledSince']===null)_0x597538[_0xe9f3('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index a49a0de..63d40d5 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 _0x04b6=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x4cf13e,_0x542d0b){var _0x192f90=function(_0x57e7ce){while(--_0x57e7ce){_0x4cf13e['push'](_0x4cf13e['shift']());}};_0x192f90(++_0x542d0b);}(_0x04b6,0x1b3));var _0x604b=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x04b6[_0x3c8e9a];return _0x2d4c57;};'use strict';var UserSettingEvents=require(_0x604b('0x0'));var events=[_0x604b('0x1'),_0x604b('0x2'),'update'];function createListener(_0x2d78c3,_0x4b882f){return function(_0x51fcb3){_0x4b882f[_0x604b('0x3')](_0x2d78c3,_0x51fcb3);if(_0x2d78c3===_0x604b('0x4')){_0x4b882f[_0x604b('0x3')](_0x604b('0x5')+_0x51fcb3[_0x604b('0x6')],_0x51fcb3);}};}exports[_0x604b('0x7')]=function(_0x2923ca){for(var _0x30e208=0x0,_0x1ffd19=events[_0x604b('0x8')];_0x30e208<_0x1ffd19;_0x30e208++){var _0x1d122b=events[_0x30e208];var _0x448d28=createListener(_0x604b('0x9')+_0x1d122b,_0x2923ca);UserSettingEvents['on'](_0x1d122b,_0x448d28);}}; \ No newline at end of file +var _0x2c3e=['length','user-setting:','./user-setting.events','user-setting:update','emit','user-setting:update:user-','UserId','register'];(function(_0x53d224,_0x1c280e){var _0x3656b9=function(_0x3d9a7e){while(--_0x3d9a7e){_0x53d224['push'](_0x53d224['shift']());}};_0x3656b9(++_0x1c280e);}(_0x2c3e,0x1da));var _0xe2c3=function(_0xa5bd5b,_0x5294d9){_0xa5bd5b=_0xa5bd5b-0x0;var _0x340535=_0x2c3e[_0xa5bd5b];return _0x340535;};'use strict';var UserSettingEvents=require(_0xe2c3('0x0'));var events=['save','remove','update'];function createListener(_0x332ab5,_0x396d93){return function(_0x1d3648){_0x396d93['emit'](_0x332ab5,_0x1d3648);if(_0x332ab5===_0xe2c3('0x1')){_0x396d93[_0xe2c3('0x2')](_0xe2c3('0x3')+_0x1d3648[_0xe2c3('0x4')],_0x1d3648);}};}exports[_0xe2c3('0x5')]=function(_0x3ab39e){for(var _0x49c849=0x0,_0x31a8ad=events[_0xe2c3('0x6')];_0x49c849<_0x31a8ad;_0x49c849++){var _0x385db2=events[_0x49c849];var _0x47d42f=createListener(_0xe2c3('0x7')+_0x385db2,_0x3ab39e);UserSettingEvents['on'](_0x385db2,_0x47d42f);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 926e973..93a88db 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 _0x1ebd=['getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./user.controller','get','index','/describe','describe','/whoami','isAuthenticated','whoami','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups'];(function(_0x53958e,_0x3e2158){var _0x31098f=function(_0x54e155){while(--_0x54e155){_0x53958e['push'](_0x53958e['shift']());}};_0x31098f(++_0x3e2158);}(_0x1ebd,0x64));var _0xd1eb=function(_0x568af7,_0x431f2d){_0x568af7=_0x568af7-0x0;var _0x31f41c=_0x1ebd[_0x568af7];return _0x31f41c;};'use strict';var multer=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var path=require(_0xd1eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1eb('0x3'));var router=express[_0xd1eb('0x4')]();var fs_extra=require(_0xd1eb('0x5'));var auth=require(_0xd1eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1eb('0x7'));router[_0xd1eb('0x8')]('/',auth['isAuthenticated'](),controller[_0xd1eb('0x9')]);router[_0xd1eb('0x8')](_0xd1eb('0xa'),auth['isAuthenticated'](),controller[_0xd1eb('0xb')]);router[_0xd1eb('0x8')](_0xd1eb('0xc'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0xe')]);router[_0xd1eb('0x8')]('/presence',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0xf')]);router[_0xd1eb('0x8')]('/:id',auth[_0xd1eb('0xd')](),controller['show']);router[_0xd1eb('0x8')](_0xd1eb('0x10'),controller[_0xd1eb('0x11')]);router[_0xd1eb('0x8')](_0xd1eb('0x12'),auth['isAuthenticated'](),controller[_0xd1eb('0x13')]);router[_0xd1eb('0x8')](_0xd1eb('0x14'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x15')]);router[_0xd1eb('0x8')](_0xd1eb('0x16'),auth[_0xd1eb('0xd')](),controller['getQueues']);router[_0xd1eb('0x8')](_0xd1eb('0x17'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x18')]);router[_0xd1eb('0x8')](_0xd1eb('0x19'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x1a')]);router[_0xd1eb('0x8')](_0xd1eb('0x1b'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x1c')]);router[_0xd1eb('0x8')](_0xd1eb('0x1d'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x1e')]);router[_0xd1eb('0x8')](_0xd1eb('0x1f'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x20')]);router[_0xd1eb('0x8')]('/:id/openchannel/interactions',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x21')]);router['get'](_0xd1eb('0x22'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x23')]);router['get'](_0xd1eb('0x24'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x25')]);router[_0xd1eb('0x8')](_0xd1eb('0x26'),auth[_0xd1eb('0xd')](),controller['getFaxInteractions']);router[_0xd1eb('0x8')](_0xd1eb('0x27'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x28')]);router[_0xd1eb('0x8')]('/:id/teams',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x29')]);router[_0xd1eb('0x8')](_0xd1eb('0x2a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x2b')]);router[_0xd1eb('0x8')](_0xd1eb('0x2c'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x2d')]);router['get']('/:id/prefixes',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x2e')]);router[_0xd1eb('0x8')](_0xd1eb('0x2f'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xd1eb('0x8')](_0xd1eb('0x30'),auth['isAuthenticated'](),controller[_0xd1eb('0x31')]);router[_0xd1eb('0x8')](_0xd1eb('0x32'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x33')]);router[_0xd1eb('0x8')]('/:id/sms_accounts',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x34')]);router[_0xd1eb('0x8')](_0xd1eb('0x35'),auth['isAuthenticated'](),controller[_0xd1eb('0x36')]);router[_0xd1eb('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xd1eb('0x37')]);router['get'](_0xd1eb('0x38'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x39')]);router[_0xd1eb('0x8')](_0xd1eb('0x3a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x3b')]);router['post'](_0xd1eb('0x14'),auth['isAuthenticated'](),controller[_0xd1eb('0x3c')]);router[_0xd1eb('0x3d')]('/',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x3e')]);router['post'](_0xd1eb('0x3f'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x40')]);router[_0xd1eb('0x3d')](_0xd1eb('0x16'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x41')]);var upload=multer({'storage':multer[_0xd1eb('0x42')]({'destination':function(_0x53887c,_0x7e681f,_0x1aeada){_0x1aeada(null,path[_0xd1eb('0x43')](config[_0xd1eb('0x44')],_0xd1eb('0x45')));},'filename':function(_0x3eadef,_0x49a4e1,_0x51c497){_0x51c497(null,util[_0xd1eb('0x46')](_0xd1eb('0x47'),Date[_0xd1eb('0x48')](),_0x49a4e1[_0xd1eb('0x49')]));}})});router['post'](_0xd1eb('0x10'),upload[_0xd1eb('0x4a')](_0xd1eb('0x4b')),controller[_0xd1eb('0x4c')]);router[_0xd1eb('0x3d')](_0xd1eb('0x4d'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x4e')]);router[_0xd1eb('0x3d')](_0xd1eb('0x4f'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x50')]);router[_0xd1eb('0x3d')](_0xd1eb('0x51'),auth['isAuthenticated'](),controller[_0xd1eb('0x52')]);router['post'](_0xd1eb('0x53'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x54')]);router[_0xd1eb('0x3d')](_0xd1eb('0x55'),auth['isAuthenticated'](),controller[_0xd1eb('0x56')]);router[_0xd1eb('0x3d')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xd1eb('0x57')]);router[_0xd1eb('0x3d')](_0xd1eb('0x58'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x59')]);router['post'](_0xd1eb('0x5a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x5b')]);router[_0xd1eb('0x3d')]('/:id/sms_interactions',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x5c')]);router['post']('/:id/openchannel_interactions',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x5d')]);router['post'](_0xd1eb('0x5e'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x5f')]);router[_0xd1eb('0x3d')](_0xd1eb('0x2f'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x60')]);router[_0xd1eb('0x3d')](_0xd1eb('0x30'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x61')]);router[_0xd1eb('0x3d')](_0xd1eb('0x32'),auth['isAuthenticated'](),controller[_0xd1eb('0x62')]);router['post'](_0xd1eb('0x63'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x64')]);router[_0xd1eb('0x3d')](_0xd1eb('0x35'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x65')]);router['post'](_0xd1eb('0x66'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x67')]);router[_0xd1eb('0x3d')](_0xd1eb('0x3a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x68')]);router[_0xd1eb('0x69')](_0xd1eb('0x6a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x6b')]);router['put'](_0xd1eb('0x6c'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x6d')]);router[_0xd1eb('0x6e')](_0xd1eb('0x16'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x6f')]);router[_0xd1eb('0x6e')](_0xd1eb('0x55'),auth[_0xd1eb('0xd')](),controller['removeTeams']);router[_0xd1eb('0x6e')](_0xd1eb('0x6a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x70')]);router[_0xd1eb('0x6e')](_0xd1eb('0x71'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xd1eb('0x6e')]('/:id/mail_interactions',auth[_0xd1eb('0xd')](),controller['removeMailInteractions']);router[_0xd1eb('0x6e')](_0xd1eb('0x5a'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x72')]);router[_0xd1eb('0x6e')](_0xd1eb('0x73'),auth[_0xd1eb('0xd')](),controller['removeSmsInteractions']);router[_0xd1eb('0x6e')](_0xd1eb('0x74'),auth['isAuthenticated'](),controller[_0xd1eb('0x75')]);router[_0xd1eb('0x6e')](_0xd1eb('0x5e'),auth['isAuthenticated'](),controller[_0xd1eb('0x76')]);router[_0xd1eb('0x6e')](_0xd1eb('0x2f'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x77')]);router[_0xd1eb('0x6e')](_0xd1eb('0x30'),auth['isAuthenticated'](),controller[_0xd1eb('0x78')]);router[_0xd1eb('0x6e')]('/:id/openchannel_accounts',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x79')]);router[_0xd1eb('0x6e')]('/:id/sms_accounts',auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x7a')]);router['delete'](_0xd1eb('0x35'),auth['isAuthenticated'](),controller[_0xd1eb('0x7b')]);router['delete'](_0xd1eb('0x66'),auth[_0xd1eb('0xd')](),controller[_0xd1eb('0x7c')]);router[_0xd1eb('0x6e')](_0xd1eb('0x3a'),auth[_0xd1eb('0xd')](),controller['removeApiKey']);module[_0xd1eb('0x7d')]=router; \ No newline at end of file +var _0xe58a=['originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/sms_interactions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','express','../../components/auth/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','create','diskStorage','join','root','server/files/images/','%s-%s','now'];(function(_0x2f49b3,_0x5bf5a6){var _0x5b0f5c=function(_0x2b4e1d){while(--_0x2b4e1d){_0x2f49b3['push'](_0x2f49b3['shift']());}};_0x5b0f5c(++_0x5bf5a6);}(_0xe58a,0x9f));var _0xae58=function(_0x2512da,_0x1d6274){_0x2512da=_0x2512da-0x0;var _0x56354c=_0xe58a[_0x2512da];return _0x56354c;};'use strict';var multer=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var path=require(_0xae58('0x2'));var timeout=require('connect-timeout');var express=require(_0xae58('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xae58('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae58('0x5'));router['get']('/',auth[_0xae58('0x6')](),controller[_0xae58('0x7')]);router[_0xae58('0x8')](_0xae58('0x9'),auth[_0xae58('0x6')](),controller[_0xae58('0xa')]);router[_0xae58('0x8')](_0xae58('0xb'),auth[_0xae58('0x6')](),controller[_0xae58('0xc')]);router['get'](_0xae58('0xd'),auth[_0xae58('0x6')](),controller[_0xae58('0xe')]);router[_0xae58('0x8')](_0xae58('0xf'),auth['isAuthenticated'](),controller[_0xae58('0x10')]);router[_0xae58('0x8')]('/:id/avatar',controller[_0xae58('0x11')]);router['get'](_0xae58('0x12'),auth[_0xae58('0x6')](),controller[_0xae58('0x13')]);router[_0xae58('0x8')]('/:id/contacts',auth[_0xae58('0x6')](),controller['getContacts']);router['get'](_0xae58('0x14'),auth[_0xae58('0x6')](),controller[_0xae58('0x15')]);router[_0xae58('0x8')]('/:id/queues_rt',auth[_0xae58('0x6')](),controller[_0xae58('0x16')]);router[_0xae58('0x8')](_0xae58('0x17'),auth['isAuthenticated'](),controller['getGroups']);router[_0xae58('0x8')](_0xae58('0x18'),auth[_0xae58('0x6')](),controller[_0xae58('0x19')]);router[_0xae58('0x8')]('/:id/screen_recordings',auth[_0xae58('0x6')](),controller[_0xae58('0x1a')]);router[_0xae58('0x8')](_0xae58('0x1b'),auth[_0xae58('0x6')](),controller[_0xae58('0x1c')]);router[_0xae58('0x8')](_0xae58('0x1d'),auth[_0xae58('0x6')](),controller['getOpenchannelInteractions']);router['get'](_0xae58('0x1e'),auth['isAuthenticated'](),controller[_0xae58('0x1f')]);router['get'](_0xae58('0x20'),auth[_0xae58('0x6')](),controller[_0xae58('0x21')]);router[_0xae58('0x8')](_0xae58('0x22'),auth['isAuthenticated'](),controller[_0xae58('0x23')]);router[_0xae58('0x8')](_0xae58('0x24'),auth[_0xae58('0x6')](),controller['getWhatsappInteractions']);router[_0xae58('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xae58('0x25')]);router['get'](_0xae58('0x26'),auth['isAuthenticated'](),controller[_0xae58('0x27')]);router[_0xae58('0x8')](_0xae58('0x28'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xae58('0x6')](),controller['getVoicePrefixes']);router['get'](_0xae58('0x29'),auth[_0xae58('0x6')](),controller[_0xae58('0x2a')]);router[_0xae58('0x8')](_0xae58('0x2b'),auth['isAuthenticated'](),controller[_0xae58('0x2c')]);router[_0xae58('0x8')](_0xae58('0x2d'),auth[_0xae58('0x6')](),controller[_0xae58('0x2e')]);router[_0xae58('0x8')](_0xae58('0x2f'),auth[_0xae58('0x6')](),controller[_0xae58('0x30')]);router[_0xae58('0x8')](_0xae58('0x31'),auth[_0xae58('0x6')](),controller['getChatWebsites']);router[_0xae58('0x8')](_0xae58('0x32'),auth[_0xae58('0x6')](),controller[_0xae58('0x33')]);router[_0xae58('0x8')]('/:id/scheduled_calls',auth[_0xae58('0x6')](),controller[_0xae58('0x34')]);router['get'](_0xae58('0x35'),auth[_0xae58('0x6')](),controller[_0xae58('0x36')]);router[_0xae58('0x37')]('/:id/contacts',auth[_0xae58('0x6')](),controller['addContacts']);router[_0xae58('0x37')]('/',auth[_0xae58('0x6')](),controller[_0xae58('0x38')]);router[_0xae58('0x37')]('/create_many',auth[_0xae58('0x6')](),controller['bulkCreate']);router[_0xae58('0x37')](_0xae58('0x14'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xae58('0x39')]({'destination':function(_0x3ef46a,_0x5bdc34,_0xa1edab){_0xa1edab(null,path[_0xae58('0x3a')](config[_0xae58('0x3b')],_0xae58('0x3c')));},'filename':function(_0x3fb39a,_0x4c9c05,_0x70f765){_0x70f765(null,util['format'](_0xae58('0x3d'),Date[_0xae58('0x3e')](),_0x4c9c05[_0xae58('0x3f')]));}})});router[_0xae58('0x37')](_0xae58('0x40'),upload[_0xae58('0x41')](_0xae58('0x42')),controller[_0xae58('0x43')]);router[_0xae58('0x37')](_0xae58('0x44'),auth[_0xae58('0x6')](),controller[_0xae58('0x45')]);router[_0xae58('0x37')](_0xae58('0x46'),auth[_0xae58('0x6')](),controller[_0xae58('0x47')]);router[_0xae58('0x37')](_0xae58('0x48'),auth['isAuthenticated'](),controller[_0xae58('0x49')]);router['post'](_0xae58('0x4a'),auth[_0xae58('0x6')](),controller['unpause']);router[_0xae58('0x37')](_0xae58('0x4b'),auth[_0xae58('0x6')](),controller[_0xae58('0x4c')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xae58('0x37')](_0xae58('0x4d'),auth['isAuthenticated'](),controller[_0xae58('0x4e')]);router['post'](_0xae58('0x4f'),auth[_0xae58('0x6')](),controller[_0xae58('0x50')]);router[_0xae58('0x37')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xae58('0x51')]);router['post'](_0xae58('0x52'),auth[_0xae58('0x6')](),controller['addOpenchannelInteractions']);router[_0xae58('0x37')](_0xae58('0x53'),auth[_0xae58('0x6')](),controller[_0xae58('0x54')]);router[_0xae58('0x37')](_0xae58('0x29'),auth[_0xae58('0x6')](),controller[_0xae58('0x55')]);router['post'](_0xae58('0x2b'),auth[_0xae58('0x6')](),controller[_0xae58('0x56')]);router[_0xae58('0x37')](_0xae58('0x2d'),auth[_0xae58('0x6')](),controller[_0xae58('0x57')]);router[_0xae58('0x37')](_0xae58('0x2f'),auth[_0xae58('0x6')](),controller[_0xae58('0x58')]);router[_0xae58('0x37')](_0xae58('0x31'),auth[_0xae58('0x6')](),controller[_0xae58('0x59')]);router['post'](_0xae58('0x32'),auth['isAuthenticated'](),controller[_0xae58('0x5a')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller[_0xae58('0x5b')]);router[_0xae58('0x5c')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xae58('0x5c')](_0xae58('0x5d'),auth[_0xae58('0x6')](),controller[_0xae58('0x5e')]);router['delete'](_0xae58('0x14'),auth[_0xae58('0x6')](),controller[_0xae58('0x5f')]);router[_0xae58('0x60')](_0xae58('0x4b'),auth[_0xae58('0x6')](),controller[_0xae58('0x61')]);router[_0xae58('0x60')](_0xae58('0xf'),auth[_0xae58('0x6')](),controller[_0xae58('0x62')]);router['delete'](_0xae58('0x63'),auth[_0xae58('0x6')](),controller[_0xae58('0x64')]);router[_0xae58('0x60')](_0xae58('0x4d'),auth[_0xae58('0x6')](),controller['removeMailInteractions']);router['delete'](_0xae58('0x4f'),auth[_0xae58('0x6')](),controller['removeFaxInteractions']);router['delete'](_0xae58('0x65'),auth['isAuthenticated'](),controller[_0xae58('0x66')]);router[_0xae58('0x60')]('/:id/openchannel_interactions',auth[_0xae58('0x6')](),controller['removeOpenchannelInteractions']);router[_0xae58('0x60')]('/:id/whatsapp_interactions',auth[_0xae58('0x6')](),controller['removeWhatsappInteractions']);router[_0xae58('0x60')](_0xae58('0x29'),auth[_0xae58('0x6')](),controller[_0xae58('0x67')]);router['delete']('/:id/mail_accounts',auth[_0xae58('0x6')](),controller[_0xae58('0x68')]);router[_0xae58('0x60')]('/:id/openchannel_accounts',auth[_0xae58('0x6')](),controller[_0xae58('0x69')]);router[_0xae58('0x60')](_0xae58('0x2f'),auth[_0xae58('0x6')](),controller[_0xae58('0x6a')]);router[_0xae58('0x60')](_0xae58('0x31'),auth[_0xae58('0x6')](),controller[_0xae58('0x6b')]);router[_0xae58('0x60')](_0xae58('0x32'),auth[_0xae58('0x6')](),controller[_0xae58('0x6c')]);router['delete']('/:id/api_key',auth[_0xae58('0x6')](),controller[_0xae58('0x6d')]);module[_0xae58('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9f5555c..9dbbd4d 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 _0x008c=['all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','wss','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x57d86c,_0x16e660){var _0x46eeaf=function(_0x36af27){while(--_0x36af27){_0x57d86c['push'](_0x57d86c['shift']());}};_0x46eeaf(++_0x16e660);}(_0x008c,0x188));var _0xc008=function(_0x51733c,_0x448082){_0x51733c=_0x51733c-0x0;var _0x5f50f9=_0x008c[_0x51733c];return _0x5f50f9;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));module[_0xc008('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc008('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47063f){this[_0xc008('0x6')](_0xc008('0x5'),_0x47063f);this[_0xc008('0x6')](_0xc008('0x7'),_0x47063f);},'comment':_0xc008('0x8')},'fullname':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'set':function(_0x9c8cb2){this['setDataValue'](_0xc008('0xa'),_0x9c8cb2);this['setDataValue'](_0xc008('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x9c8cb2,this[_0xc008('0xc')](_0xc008('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1eacfa){if(_0x1eacfa){this[_0xc008('0x6')]('email',_0x1eacfa[_0xc008('0xe')]());}}},'role':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x10'),_0xc008('0x11'),_0xc008('0x12'),_0xc008('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25e13f){this[_0xc008('0x6')](_0xc008('0xd'),_0x25e13f);this[_0xc008('0x6')](_0xc008('0x15'),_0x25e13f);this['setDataValue']('callerid',util['format'](_0xc008('0x16'),this[_0xc008('0xc')](_0xc008('0xa')),_0x25e13f));}},'salt':{'type':Sequelize[_0xc008('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc008('0x9')]},'city':{'type':Sequelize[_0xc008('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc008('0x18')]},'chatCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc008('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x19')},'ipaddr':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xc008('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x1a'),_0xc008('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xc008('0x1a')},'context':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x1b')},'callingpres':{'type':Sequelize[_0xc008('0xf')]('ALLOWED_NOT_SCREENED',_0xc008('0x1c'),_0xc008('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc008('0x1e'),_0xc008('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x20'),'set':function(_0x2b862d){this[_0xc008('0x6')](_0xc008('0x21'),_0x2b862d?_0x2b862d['join'](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x21'))?this['getDataValue'](_0xc008('0x21'))[_0xc008('0x22')](','):null;},'comment':_0xc008('0x23')},'dtmfmode':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x24'),_0xc008('0x25'),_0xc008('0x26'),_0xc008('0x27'),_0xc008('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x2a'),_0xc008('0x2b'),_0xc008('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x399b64){this[_0xc008('0x6')]('nat',_0x399b64?_0x399b64[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x2e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xc008('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc008('0x9')]},'pickupgroup':{'type':Sequelize[_0xc008('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xc008('0x9')]},'language':{'type':Sequelize[_0xc008('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc008('0x9')]},'disallow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x30')},'allow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x31'),'set':function(_0x387dfd){this[_0xc008('0x6')](_0xc008('0x32'),_0x387dfd?_0x387dfd[_0xc008('0x2d')](';'):_0xc008('0x31'));},'get':function(){return this['getDataValue'](_0xc008('0x32'))?this[_0xc008('0xc')](_0xc008('0x32'))[_0xc008('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'set':function(_0x36e7ae){this[_0xc008('0x6')]('insecure',_0x36e7ae?_0x36e7ae[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x33'))?this[_0xc008('0xc')](_0xc008('0x33'))['split'](','):null;},'comment':_0xc008('0x34')},'trustrpid':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xc008('0x37'),_0xc008('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x39'),_0xc008('0x3a')),'allowNull':!![],'defaultValue':_0xc008('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x3b'),_0xc008('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x3d'),'passive',_0xc008('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc008('0xf')]('yes','no',_0xc008('0x2a'),'update',_0xc008('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc008('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xc008('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc008('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x375e71){this['setDataValue']('showWebBar',_0x375e71);var _0x37ce5e=this[_0xc008('0x41')]({'plain':!![]});switch(_0x375e71){case 0x0:case 0x1:var _0x56e755=_0x37ce5e[_0xc008('0x21')]?_[_0xc008('0x42')](_0x37ce5e[_0xc008('0x21')])?_0x37ce5e[_0xc008('0x21')][_0xc008('0x2d')]():_0x37ce5e[_0xc008('0x21')]:_0xc008('0x20');if(_0x56e755==='wss'){_0x56e755=_0xc008('0x20');}this[_0xc008('0x6')](_0xc008('0x21'),_0x56e755);this[_0xc008('0x6')](_0xc008('0x43'),'no');this[_0xc008('0x6')](_0xc008('0x44'),null);this[_0xc008('0x6')](_0xc008('0x45'),null);this[_0xc008('0x6')](_0xc008('0x46'),null);this[_0xc008('0x6')](_0xc008('0x47'),null);this[_0xc008('0x6')]('dtlsverify',null);this[_0xc008('0x6')](_0xc008('0x48'),null);this[_0xc008('0x6')]('dtlscertfile',null);this[_0xc008('0x6')](_0xc008('0x49'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc008('0x6')](_0xc008('0x21'),_0xc008('0x4a'));this[_0xc008('0x6')](_0xc008('0x43'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x44'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x45'),'yes');this[_0xc008('0x6')](_0xc008('0x46'),_0xc008('0x29'));this[_0xc008('0x6')]('dtlsenable',_0xc008('0x29'));this['setDataValue'](_0xc008('0x4b'),'no');this[_0xc008('0x6')](_0xc008('0x48'),'actpass');this[_0xc008('0x6')](_0xc008('0x4c'),_0x37ce5e[_0xc008('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0xc008('0x6')]('dtlsprivatekey',_0x37ce5e[_0xc008('0x49')]||_0xc008('0x4d'));this[_0xc008('0x6')](_0xc008('0x4e'),_0xc008('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3c30db){this[_0xc008('0x6')]('permissions',_0x3c30db?_0x3c30db[_0xc008('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xc008('0x4f'))?_['map'](this[_0xc008('0xc')]('permissions')[_0xc008('0x22')](','),function(_0x103d75){return parseInt(_0x103d75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc008('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc008('0x50')],'get':function(){return this[_0xc008('0xc')](_0xc008('0x51'))?this[_0xc008('0xc')](_0xc008('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc008('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3b2669){if(typeof _0x3b2669===_0xc008('0x52')){var _0x2edb8e=_0x3b2669==='1'?!![]:_0x3b2669==='0'?![]:_0x3b2669===_0xc008('0x53')?!![]:_0x3b2669===_0xc008('0x54')?![]:![];this[_0xc008('0x6')](_0xc008('0x55'),_0x2edb8e);}else{this['setDataValue']('screenrecording',_0x3b2669);}}},'blocked':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3104cd){this[_0xc008('0x6')]('blocked',_0x3104cd);if(_0x3104cd===!![]){this[_0xc008('0x6')](_0xc008('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0xc008('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc008('0x14')](0x5)[_0xc008('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ff66021..54fb61f 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 _0x463c=['107','111','114','115','create','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','findAll','isEmpty','compact','changePassword','newPassword','ValidationError','authenticate','oldPassword','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Unauthorized','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','emit','Queue:save','voice','get','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','destroy','userpic','file','join','server/files/images/logos/default_profile.png','existsSync','root','download','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','CmContact','intersection','order','sort','filters','hasOwnProperty','CmList','List','Tag','Tags','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','pick','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','sequelize','transaction','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','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','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','getScheduledCalls','$and','$or','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','CmHopper','lastName','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','flatten','col','toString','asc','desc','substring','uniqBy','result','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','socket.io-emitter','redis','./user.socket','defaults','localhost','client','http','request','then','info','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','request\x20sent','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','role','agent','userNotification:recalc:','admin','Users','user','Agents','Telephones','telephone','filter','map','value','includes','name','stack','send','index','User','rawAttributes','fieldName','type','key','getOptions','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','rows','length','chat','dataValues','sms','fax','mail','whatsapp','all','show','params','model','keys','salt','fields','merge','options','find','openTabs','openchannel','body','describe','addContacts','ids','Setting','findById','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)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','110','104','105','106'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0x463c,0x115));var _0xc463=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x463c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc463('0x0'));var util=require(_0xc463('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xc463('0x2'));var squel=require('squel');var jayson=require(_0xc463('0x3'));var Redis=require(_0xc463('0x4'));var authService=require(_0xc463('0x5'));var qs=require(_0xc463('0x6'));var logger=require(_0xc463('0x7'))(_0xc463('0x8'));var utils=require(_0xc463('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0xc463('0xa'));var APIBadRequestError=require(_0xc463('0xb'))[_0xc463('0xc')];var APINotFoundError=require(_0xc463('0xb'))[_0xc463('0xd')];var APIHandleError=require(_0xc463('0xb'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0xc463('0xe'))(new Redis(config[_0xc463('0xf')]));require(_0xc463('0x10'))['register'](socket);config[_0xc463('0xf')]=_[_0xc463('0x11')](config[_0xc463('0xf')],{'host':_0xc463('0x12'),'port':0x18eb});var amiClient=jayson[_0xc463('0x13')][_0xc463('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x6695f1,_0x3c0288,_0x17324c,_0x4e886f){return new Promise(function(_0x96ae6,_0x568107){var _0x2db38e=_0x4e886f||amiClient;return _0x2db38e[_0xc463('0x15')](_0x6695f1,_0x17324c)[_0xc463('0x16')](function(_0x495a84){logger[_0xc463('0x17')]('User,\x20%s,\x20%s',_0x3c0288,'request\x20sent');logger[_0xc463('0x18')](_0xc463('0x19'),_0x3c0288,'request\x20sent',JSON[_0xc463('0x1a')](_0x495a84));if(_0x495a84[_0xc463('0x1b')]){if(_0x495a84[_0xc463('0x1b')][_0xc463('0x1c')]===0x1f4){logger[_0xc463('0x1b')]('User,\x20%s,\x20%s',_0x3c0288,_0x495a84[_0xc463('0x1b')]['message']);return _0x568107(_0x495a84[_0xc463('0x1b')][_0xc463('0x1d')]);}logger[_0xc463('0x1b')](_0xc463('0x1e'),_0x3c0288,_0x495a84[_0xc463('0x1b')][_0xc463('0x1d')]);return _0x96ae6(_0x495a84[_0xc463('0x1b')][_0xc463('0x1d')]);}else{logger['info'](_0xc463('0x1e'),_0x3c0288,_0xc463('0x1f'));_0x96ae6(_0x495a84['result'][_0xc463('0x1d')]);}})[_0xc463('0x20')](function(_0x276888){logger['error']('User,\x20%s,\x20%s',_0x3c0288,_0x276888);_0x568107(_0x276888);});});}function respondWithStatusCode(_0x835c8e,_0x209626){_0x209626=_0x209626||0xcc;return function(_0x3871d3){if(_0x3871d3){return _0x835c8e[_0xc463('0x21')](_0x209626);}return _0x835c8e[_0xc463('0x22')](_0x209626)[_0xc463('0x23')]();};}function respondWithResult(_0xb92bbc,_0x33c7b1){_0x33c7b1=_0x33c7b1||0xc8;return function(_0x286632){if(_0x286632){return _0xb92bbc[_0xc463('0x22')](_0x33c7b1)['json'](_0x286632);}};}function respondWithFilteredResult(_0x4c2291,_0x362489){return function(_0x4c7f9d){if(_0x4c7f9d){var _0x5064d8=typeof _0x362489[_0xc463('0x24')]===_0xc463('0x25')&&typeof _0x362489[_0xc463('0x26')]==='undefined';var _0x87ac11=_0x4c7f9d[_0xc463('0x27')];var _0x4bb6d4=_0x5064d8?0x0:_0x362489['offset'];var _0x5794d9=_0x5064d8?_0x4c7f9d['count']:_0x362489['offset']+_0x362489[_0xc463('0x26')];var _0x14693b;if(_0x5794d9>=_0x87ac11){_0x5794d9=_0x87ac11;_0x14693b=0xc8;}else{_0x14693b=0xce;}_0x4c2291[_0xc463('0x22')](_0x14693b);return _0x4c2291[_0xc463('0x28')](_0xc463('0x29'),_0x4bb6d4+'-'+_0x5794d9+'/'+_0x87ac11)[_0xc463('0x2a')](_0x4c7f9d);}return null;};}function saveUpdates(_0x2370f5){return function(_0x605ded){if(_0x605ded){return _0x605ded[_0xc463('0x2b')](_0x2370f5)[_0xc463('0x16')](function(_0xdb6a65){if(_0xdb6a65[_0xc463('0x2c')]===_0xc463('0x2d')){socket['emit'](_0xc463('0x2e')+_0xdb6a65['id'],_0xdb6a65);}return _0xdb6a65;});}return null;};}function removeEntity(_0x31e350){return function(_0x209123){if(_0x209123){return _0x209123['destroy']()[_0xc463('0x16')](function(){var _0xb416d5=_0x209123['get']({'plain':!![]});if(_0xb416d5['role']===_0xc463('0x2f'))return;var _0x5bc71d=[{'name':_0xc463('0x30'),'value':_0xc463('0x31'),'ignore':!![]},{'name':_0xc463('0x32'),'value':_0xc463('0x2d'),'ignore':![]},{'name':_0xc463('0x33'),'value':_0xc463('0x34'),'ignore':![]}];var _0x207549=_(_0x5bc71d)[_0xc463('0x35')]('ignore')[_0xc463('0x36')](_0xc463('0x37'))[_0xc463('0x37')]();if(_[_0xc463('0x38')](_0x207549,_0xb416d5[_0xc463('0x2c')])){return;}var _0x5b751f=_['find'](_0x5bc71d,[_0xc463('0x37'),_0xb416d5[_0xc463('0x2c')]])[_0xc463('0x39')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5b751f,'resourceId':_0xb416d5['id']}})['then'](function(){return _0x209123;});})[_0xc463('0x16')](function(){_0x31e350['status'](0xcc)[_0xc463('0x23')]();});}};}function handleEntityNotFound(_0x371adb){return function(_0x26813f){if(!_0x26813f){_0x371adb['sendStatus'](0x194);}return _0x26813f;};}function handleError(_0x9089,_0x1e79ea){_0x1e79ea=_0x1e79ea||0x1f4;return function(_0x483c59){logger[_0xc463('0x1b')](_0x483c59[_0xc463('0x3a')]);if(_0x483c59[_0xc463('0x39')]){delete _0x483c59[_0xc463('0x39')];}_0x9089['status'](_0x1e79ea)[_0xc463('0x3b')](_0x483c59);};}exports[_0xc463('0x3c')]=function(_0x2fa597,_0xd39ac){var _0x371cdb={},_0x1b0fe7={'count':0x0,'rows':[]};var _0x9b9490=_(db[_0xc463('0x3d')][_0xc463('0x3e')])[_0xc463('0x36')](function(_0x55dee0){return{'name':_0x55dee0[_0xc463('0x3f')],'type':_0x55dee0[_0xc463('0x40')][_0xc463('0x41')]};})[_0xc463('0x35')](function(_0x192916){return!_['includes'](['password','salt'],_0x192916[_0xc463('0x39')]);})[_0xc463('0x37')]();_0x371cdb=qs[_0xc463('0x42')](_0x9b9490,_0x2fa597);var _0x58fb02={'where':_0x371cdb[_0xc463('0x43')]};return db[_0xc463('0x3d')][_0xc463('0x27')](_0x58fb02)[_0xc463('0x16')](function(_0x1be86d){_0x1b0fe7[_0xc463('0x27')]=_0x1be86d;if(_0x2fa597['query'][_0xc463('0x44')]){_0x371cdb[_0xc463('0x45')]=[{'all':!![]}];}if(_0x2fa597[_0xc463('0x46')][_0xc463('0x47')]===_0xc463('0x48')){_0x371cdb[_0xc463('0x45')]=[{'model':db[_0xc463('0x49')],'as':_0xc463('0x47')}];}if(!_[_0xc463('0x38')](_0x371cdb[_0xc463('0x4a')],'id')){_0x371cdb[_0xc463('0x4a')][_0xc463('0x4b')]('id');}return db[_0xc463('0x3d')]['findAll'](_0x371cdb);})[_0xc463('0x16')](function(_0x18f7b1){_0x1b0fe7[_0xc463('0x4c')]=_0x18f7b1;if(_0x2fa597['query']['openTabs']===_0xc463('0x48')){var _0x4d4a02=[];for(var _0x4d09a6=0x0;_0x4d09a6<_0x1b0fe7[_0xc463('0x4c')][_0xc463('0x4d')];_0x4d09a6++){_0x4d4a02[_0xc463('0x4b')](get_open_tabs(_0xc463('0x4e'),_0x1b0fe7[_0xc463('0x4c')][_0x4d09a6][_0xc463('0x4f')]));_0x4d4a02[_0xc463('0x4b')](get_open_tabs(_0xc463('0x50'),_0x1b0fe7[_0xc463('0x4c')][_0x4d09a6][_0xc463('0x4f')]));_0x4d4a02[_0xc463('0x4b')](get_open_tabs(_0xc463('0x51'),_0x1b0fe7[_0xc463('0x4c')][_0x4d09a6][_0xc463('0x4f')]));_0x4d4a02[_0xc463('0x4b')](get_open_tabs(_0xc463('0x52'),_0x1b0fe7['rows'][_0x4d09a6]['dataValues']));_0x4d4a02[_0xc463('0x4b')](get_open_tabs('openchannel',_0x1b0fe7['rows'][_0x4d09a6][_0xc463('0x4f')]));_0x4d4a02['push'](get_open_tabs(_0xc463('0x53'),_0x1b0fe7[_0xc463('0x4c')][_0x4d09a6][_0xc463('0x4f')]));}return Promise[_0xc463('0x54')](_0x4d4a02)[_0xc463('0x16')](function(){return _0x1b0fe7;});}else{return _0x1b0fe7;}})[_0xc463('0x16')](respondWithFilteredResult(_0xd39ac,_0x371cdb))['catch'](handleError(_0xd39ac,null));};exports[_0xc463('0x55')]=function(_0x458737,_0x210cbb){var _0x1d1648={'raw':![],'where':{'id':_0x458737[_0xc463('0x56')]['id']}},_0x5a0f3b={};_0x5a0f3b[_0xc463('0x57')]=_['differenceBy'](_[_0xc463('0x58')](db[_0xc463('0x3d')][_0xc463('0x3e')]),['password',_0xc463('0x59')]);_0x5a0f3b[_0xc463('0x46')]=_[_0xc463('0x58')](_0x458737[_0xc463('0x46')]);_0x5a0f3b['filters']=_['intersection'](_0x5a0f3b[_0xc463('0x57')],_0x5a0f3b['query']);_0x1d1648[_0xc463('0x4a')]=_['intersection'](_0x5a0f3b[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x458737[_0xc463('0x46')]['fields']));_0x1d1648[_0xc463('0x4a')]=_0x1d1648[_0xc463('0x4a')][_0xc463('0x4d')]?_0x1d1648['attributes']:_0x5a0f3b[_0xc463('0x57')];if(_0x458737['query']['includeAll']){_0x1d1648[_0xc463('0x45')]=[{'all':!![]}];}if(_0x458737[_0xc463('0x46')][_0xc463('0x47')]==='true'){_0x1d1648[_0xc463('0x45')]=[{'model':db[_0xc463('0x49')],'as':_0xc463('0x47')}];}_0x1d1648=_[_0xc463('0x5b')]({},_0x1d1648,_0x458737[_0xc463('0x5c')]);if(!_[_0xc463('0x38')](_0x1d1648[_0xc463('0x4a')],'id')){_0x1d1648[_0xc463('0x4a')][_0xc463('0x4b')]('id');}return db[_0xc463('0x3d')][_0xc463('0x5d')](_0x1d1648)['then'](handleEntityNotFound(_0x210cbb,null))[_0xc463('0x16')](function(_0x5d05b8){var _0x4f33da=[];values=_0x5d05b8;if(_0x458737[_0xc463('0x46')][_0xc463('0x5e')]==='true'){_0x4f33da[_0xc463('0x4b')](get_open_tabs('chat',_0x5d05b8[_0xc463('0x4f')]));_0x4f33da[_0xc463('0x4b')](get_open_tabs('sms',_0x5d05b8[_0xc463('0x4f')]));_0x4f33da['push'](get_open_tabs(_0xc463('0x5f'),_0x5d05b8['dataValues']));_0x4f33da['push'](get_open_tabs(_0xc463('0x53'),_0x5d05b8[_0xc463('0x4f')]));_0x4f33da[_0xc463('0x4b')](get_open_tabs('fax',_0x5d05b8[_0xc463('0x4f')]));_0x4f33da[_0xc463('0x4b')](get_open_tabs('mail',_0x5d05b8['dataValues']));return Promise[_0xc463('0x54')](_0x4f33da);}else{return values;}})[_0xc463('0x16')](function(){return values;})[_0xc463('0x16')](respondWithResult(_0x210cbb,null))[_0xc463('0x20')](handleError(_0x210cbb,null));};exports['update']=function(_0x4a8cc7,_0x2818d5){if(_0x4a8cc7['body']['id']){delete _0x4a8cc7['body']['id'];}delete _0x4a8cc7[_0xc463('0x60')][_0xc463('0x2c')];return db['User']['find']({'where':{'id':_0x4a8cc7['params']['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x2818d5,null))[_0xc463('0x16')](saveUpdates(_0x4a8cc7['body'],null))[_0xc463('0x16')](respondWithResult(_0x2818d5,null))[_0xc463('0x20')](handleError(_0x2818d5,null));};exports[_0xc463('0x61')]=function(_0x265b95,_0x3f8372){return db['User'][_0xc463('0x61')]()['then'](respondWithResult(_0x3f8372,null))[_0xc463('0x20')](handleError(_0x3f8372,null));};exports[_0xc463('0x62')]=function(_0xc28cf4,_0x18fd57){return db[_0xc463('0x3d')]['find']({'where':{'id':_0xc28cf4[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x18fd57,null))[_0xc463('0x16')](function(_0x547bf7){if(_0x547bf7){return _0x547bf7['addContacts'](_0xc28cf4[_0xc463('0x60')][_0xc463('0x63')],_['omit'](_0xc28cf4['body'],[_0xc463('0x63'),'id'])||{});}})[_0xc463('0x16')](respondWithResult(_0x18fd57,null))[_0xc463('0x20')](handleError(_0x18fd57,null));};function validateUser(_0x3fe405){return new Promise(function(_0x2972eb,_0x4a5d07){if(_0x3fe405['internal'])return _0x2972eb(_0x3fe405);return db[_0xc463('0x64')][_0xc463('0x65')](0x1)[_0xc463('0x16')](function(_0x457107){if(_0x457107['securePassword'])authService['validatePasswordPattern'](_0x3fe405['password']);db['User'][_0xc463('0x66')](_0xc463('0x67'))[_0xc463('0x16')](function(_0x35d35d){if(_[_0xc463('0x68')](_0x35d35d)){_0x3fe405[_0xc463('0x67')]=_0x457107[_0xc463('0x69')]||0x1;return;}if(_[_0xc463('0x68')](_0x457107[_0xc463('0x69')])||_0x457107[_0xc463('0x69')]===_0x35d35d){_0x3fe405[_0xc463('0x67')]=_0x35d35d+0x1;return;}if(_0x457107['min_internal']>_0x35d35d){_0x3fe405[_0xc463('0x67')]=_0x457107['min_internal'];return;}return db['sequelize']['query'](_0xc463('0x6a'),{'type':db['sequelize'][_0xc463('0x6b')][_0xc463('0x6c')]})[_0xc463('0x16')](function(_0x268d17){if(_0x268d17&&_0x268d17[_0xc463('0x4d')]){for(var _0x3d6367=0x0,_0x35870c=_0x268d17[_0xc463('0x4d')];_0x3d6367<_0x35870c&&_[_0xc463('0x68')](_0x3fe405[_0xc463('0x67')]);_0x3d6367++){if(_0x457107[_0xc463('0x69')]<=_0x268d17[_0x3d6367][_0xc463('0x6d')]){_0x3fe405[_0xc463('0x67')]=_0x268d17[_0x3d6367][_0xc463('0x6d')];}else if(_0x457107[_0xc463('0x69')]>_0x268d17[_0x3d6367][_0xc463('0x6d')]&&_0x457107[_0xc463('0x69')]<=_0x268d17[_0x3d6367]['to']){_0x3fe405[_0xc463('0x67')]=_0x457107[_0xc463('0x69')];}}}if(_[_0xc463('0x68')](_0x3fe405[_0xc463('0x67')])){_0x3fe405['internal']=_0x35d35d+0x1;}return _0x2972eb(_0x3fe405);});});})['catch'](function(_0x382ce4){_0x4a5d07(_0x382ce4);});});}function updateUser(_0x59650b){return new Promise(function(_0x2452c4,_0x78f56e){try{if(_0x59650b[_0xc463('0x6e')]){_0x59650b[_0xc463('0x6f')]=_0x59650b[_0xc463('0x67')];_0x59650b[_0xc463('0x70')]={'mailbox':_0x59650b[_0xc463('0x67')],'password':_0x59650b['password'],'fullname':_0x59650b[_0xc463('0x71')],'email':_0x59650b[_0xc463('0x72')]};}if(_0x59650b['role']===_0xc463('0x2d')){if(!_0x59650b[_0xc463('0x73')])_0x59650b[_0xc463('0x73')]=[_0xc463('0x74'),_0xc463('0x75'),_0xc463('0x76'),'113',_0xc463('0x77'),_0xc463('0x78'),_0xc463('0x79'),_0xc463('0x7a'),_0xc463('0x7b'),'108','109','100',_0xc463('0x7c'),_0xc463('0x7d'),_0xc463('0x7e')];}_0x2452c4(_0x59650b);}catch(_0x320a34){_0x78f56e(_0x320a34);}});}exports[_0xc463('0x7f')]=function(_0x50497a,_0x24b4da){if(_0x50497a[_0xc463('0x31')]['role']===_0xc463('0x2d'))throw new Error('Unauthorized');if(_0x50497a['body']['role']==='user'&&_0x50497a[_0xc463('0x31')][_0xc463('0x2c')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x50497a[_0xc463('0x60')][_0xc463('0x2c')]==='admin'&&_0x50497a[_0xc463('0x31')]['role']!==_0xc463('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xc463('0x80')]([_0x50497a[_0xc463('0x60')]])[_0xc463('0x16')](function(){return validateUser(_0x50497a[_0xc463('0x60')]);})[_0xc463('0x16')](function(_0x1db67b){return updateUser(_0x1db67b)[_0xc463('0x16')](function(_0x2027d6){if(_0x2027d6[_0xc463('0x2c')]===_0xc463('0x2f')){_0x2027d6[_0xc463('0x81')]=_0x50497a['user'][_0xc463('0x81')];delete _0x2027d6[_0xc463('0x82')];}return _0x2027d6;});})[_0xc463('0x16')](function(_0x3eefc4){return db[_0xc463('0x3d')][_0xc463('0x7f')](_0x3eefc4,{'include':[{'model':db[_0xc463('0x70')],'as':_0xc463('0x70')}]});})[_0xc463('0x16')](function(_0x152422){if(_0x50497a['body'][_0xc463('0x2c')]===_0xc463('0x31'))return _0x152422;if(_0x50497a[_0xc463('0x31')][_0xc463('0x2c')]!=='user')return _0x152422;return db[_0xc463('0x83')][_0xc463('0x5d')]({'where':{'name':_0x152422[_0xc463('0x2c')]===_0xc463('0x2d')?_0xc463('0x32'):_0xc463('0x33'),'userProfileId':_0x50497a[_0xc463('0x31')][_0xc463('0x82')]},'raw':!![]})[_0xc463('0x16')](function(_0x228150){if(!_0x228150||_0x228150[_0xc463('0x84')]!=0x0)return _0x152422;return db[_0xc463('0x85')][_0xc463('0x7f')]({'name':_0x152422[_0xc463('0x39')],'resourceId':_0x152422['id'],'type':_0x228150[_0xc463('0x39')],'sectionId':_0x228150['id']},{})[_0xc463('0x16')](function(){return _0x152422;});})[_0xc463('0x20')](function(_0x3e630c){logger[_0xc463('0x1b')](_0xc463('0x86'),_0x3e630c);throw _0x3e630c;});})[_0xc463('0x16')](respondWithResult(_0x24b4da,0xc9))[_0xc463('0x20')](handleError(_0x24b4da,null));};exports['bulkCreate']=function(_0x270bc9,_0x3d3034){var _0x5c0042=_0x270bc9[_0xc463('0x60')];var _0x1d8804=[];if(_0x270bc9[_0xc463('0x31')][_0xc463('0x2c')]===_0xc463('0x2d'))throw new Error('Unauthorized');if(_['some'](_0x5c0042,[_0xc463('0x2c'),'user'])&&_0x270bc9[_0xc463('0x31')][_0xc463('0x2c')]!==_0xc463('0x2f')){throw new Error(_0xc463('0x87'));}if(_[_0xc463('0x88')](_0x5c0042,[_0xc463('0x2c'),_0xc463('0x2f')])&&_0x270bc9[_0xc463('0x31')]['role']!==_0xc463('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xc463('0x80')](_0x5c0042)[_0xc463('0x16')](function(){return validateUser(_0x5c0042[0x0]);})[_0xc463('0x16')](function(){for(var _0x9f9c78=0x1;_0x9f9c78<_0x5c0042[_0xc463('0x4d')];_0x9f9c78++){var _0x10f90d=_0x5c0042[_0x9f9c78-0x1]['internal'];if(!_0x5c0042[_0x9f9c78][_0xc463('0x67')])_0x5c0042[_0x9f9c78][_0xc463('0x67')]=_0x10f90d+0x1;_0x1d8804[_0xc463('0x4b')](validateUser(_0x5c0042[_0x9f9c78]));}return Promise[_0xc463('0x54')](_0x1d8804);})[_0xc463('0x16')](function(){_0x1d8804=[];for(var _0x2a33f0=0x0;_0x2a33f0<_0x5c0042[_0xc463('0x4d')];_0x2a33f0++){_0x1d8804['push'](updateUser(_0x5c0042[_0x2a33f0]));}return Promise[_0xc463('0x54')](_0x1d8804);})[_0xc463('0x16')](function(){_0x1d8804=_0x5c0042['map'](function(_0x5931ec){return db['User']['create'](_0x5931ec,{'include':[{'model':db[_0xc463('0x70')],'as':_0xc463('0x70')}]})[_0xc463('0x16')](function(_0x1dbb61){_0x5931ec['id']=_0x1dbb61['id'];return _0x5931ec;});});return Promise[_0xc463('0x54')](_0x1d8804);})['then'](function(_0x1612f4){if(_0x270bc9['body'][_0xc463('0x2c')]===_0xc463('0x31'))return _0x1612f4;if(_0x270bc9[_0xc463('0x31')][_0xc463('0x2c')]!==_0xc463('0x31'))return _0x1612f4;var _0x44cd85=_['some'](_0x1612f4,function(_0x5af933){return _0x5af933[_0xc463('0x2c')]===_0xc463('0x2d')||_0x5af933[_0xc463('0x2c')]===_0xc463('0x34');});if(!_0x44cd85)return _0x1612f4;return db[_0xc463('0x83')][_0xc463('0x89')]({'where':{'name':{'$or':[_0xc463('0x32'),_0xc463('0x33')]},'userProfileId':_0x270bc9[_0xc463('0x31')][_0xc463('0x82')]},'raw':!![]})[_0xc463('0x16')](function(_0x463dea){if(_[_0xc463('0x8a')](_0x463dea)||!_['some'](_0x463dea,['autoAssociation',0x0]))return _0x1612f4;_0x1d8804=[];var _0x4e6eec=_(_0x463dea)['map'](function(_0xafe4fa){if(_0xafe4fa[_0xc463('0x84')]===0x1)return;return _0xafe4fa[_0xc463('0x39')]===_0xc463('0x32')?_0xc463('0x2d'):_0xc463('0x34');})[_0xc463('0x8b')]()[_0xc463('0x37')]();for(var _0x4fc0c1=0x0;_0x4fc0c1<_0x1612f4[_0xc463('0x4d')];_0x4fc0c1++){if(!_['includes'](_0x4e6eec,_0x1612f4[_0x4fc0c1][_0xc463('0x2c')]))return;var _0x2c4c14=_0x1612f4[_0x4fc0c1][_0xc463('0x2c')]===_0xc463('0x2d')?_0xc463('0x32'):_0xc463('0x33');_0x1d8804[_0xc463('0x4b')](db[_0xc463('0x85')][_0xc463('0x7f')]({'name':_0x1612f4[_0x4fc0c1]['name'],'resourceId':_0x1612f4[_0x4fc0c1]['id'],'type':_0x2c4c14,'sectionId':_[_0xc463('0x5d')](_0x463dea,['name',_0x2c4c14])['id']},{}));}return Promise['all'](_0x1d8804);});})['then'](respondWithResult(_0x3d3034,0xc9))[_0xc463('0x20')](handleError(_0x3d3034,null));};exports[_0xc463('0x8c')]=function(_0x54623d,_0x466930){if(_0x54623d[_0xc463('0x60')]['id']){delete _0x54623d[_0xc463('0x60')]['id'];}return db[_0xc463('0x3d')][_0xc463('0x5d')]({'where':{'id':_0x54623d[_0xc463('0x56')]['id']}})[_0xc463('0x16')](function(_0x51cd31){if(!_0x51cd31)return null;if(_0x51cd31['id']===_0x54623d['user']['id']){if(!_0x54623d['body']['oldPassword']||!_0x54623d[_0xc463('0x60')][_0xc463('0x8d')]){throw new db['Sequelize'][(_0xc463('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x51cd31[_0xc463('0x8f')](_0x54623d['body'][_0xc463('0x90')])){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))]('Wrong\x20credentials');}if(_0x54623d[_0xc463('0x60')][_0xc463('0x90')]===_0x54623d['body']['newPassword']){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0x92'));}}else if(_0x54623d[_0xc463('0x31')][_0xc463('0x2c')]===_0xc463('0x2f')){if(!_0x54623d[_0xc463('0x60')][_0xc463('0x8d')]){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x54623d[_0xc463('0x31')]['role']==='user'){if(!_0x54623d[_0xc463('0x60')][_0xc463('0x8d')]){throw new db['Sequelize'][(_0xc463('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x51cd31[_0xc463('0x2c')]!=='agent'){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0x93'));}}else{throw new db[(_0xc463('0x91'))]['ValidationError'](_0xc463('0x93'));}return _0x51cd31;})[_0xc463('0x16')](handleEntityNotFound(_0x466930,null))[_0xc463('0x16')](function(_0x4d2733){return db[_0xc463('0x64')][_0xc463('0x94')]({'attributes':['id',_0xc463('0x95'),_0xc463('0x96'),_0xc463('0x97')]})[_0xc463('0x16')](function(_0x5eb0c6){if(_0x5eb0c6[_0xc463('0x95')])authService[_0xc463('0x98')](_0x54623d[_0xc463('0x60')][_0xc463('0x8d')]);if(!_0x5eb0c6[_0xc463('0x96')]||!_0x4d2733[_0xc463('0x99')])return _0x4d2733;authService[_0xc463('0x9a')](_0x54623d['body'][_0xc463('0x8d')],_0x4d2733[_0xc463('0x99')],_0x5eb0c6[_0xc463('0x97')]);return _0x4d2733;})[_0xc463('0x16')](saveUpdates({'password':_0x54623d[_0xc463('0x60')][_0xc463('0x8d')],'passwordResetAt':_0x54623d['user']['id']==_0x54623d[_0xc463('0x56')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x54623d[_0xc463('0x60')]['newPassword'],_0x4d2733[_0xc463('0x99')])},null));})[_0xc463('0x16')](respondWithResult(_0x466930,null))[_0xc463('0x20')](handleError(_0x466930,null));};exports[_0xc463('0x9b')]=function(_0x1811e4,_0x599b4f){var _0x450f35=_0x1811e4['body'][_0xc463('0x9c')];return db[_0xc463('0x3d')]['find']({'where':{'id':_0x1811e4[_0xc463('0x56')]['id']},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c'),_0xc463('0x9d'),_0xc463('0x9e'),'voicePause',_0xc463('0x9f')]})[_0xc463('0x16')](handleEntityNotFound(_0x599b4f,null))['then'](function(_0xe204fa){if(_0xe204fa){if(!utils[_0xc463('0xa0')](_0x450f35)){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0xa1'));}return _0xe204fa[_0xc463('0xa2')+_[_0xc463('0xa3')](_0x450f35['toLowerCase']())+_0xc463('0xa4')](_0x1811e4['body'][_0xc463('0x63')],{'penalty':_0x1811e4[_0xc463('0x60')][_0xc463('0xa5')]||0x0})[_0xc463('0xa6')](function(_0x5c93fd){for(var _0x37c13c=0x0;_0x37c13c<_0x1811e4['body'][_0xc463('0x63')][_0xc463('0x4d')];_0x37c13c+=0x1){var _0x54a7de={'UserId':Number(_0x1811e4[_0xc463('0x56')]['id'])};_0x54a7de[_[_0xc463('0xa3')](_0x450f35[_0xc463('0xa7')]())+_0xc463('0xa8')]=Number(_0x1811e4[_0xc463('0x60')][_0xc463('0x63')][_0x37c13c]);socket[_0xc463('0xa9')](_0xc463('0x31')+_[_0xc463('0xa3')](_0x450f35[_0xc463('0xa7')]())+_0xc463('0xaa'),_0x54a7de);}return _0x5c93fd;})[_0xc463('0x16')](function(){if(_0x450f35===_0xc463('0xab')){return db['VoiceQueue'][_0xc463('0x89')]({'where':{'id':_0x1811e4[_0xc463('0x60')][_0xc463('0x63')]||[]},'raw':!![],'attributes':['id',_0xc463('0x39')]});}})[_0xc463('0x16')](function(_0x2d750b){var _0x7816a3=_0xe204fa[_0xc463('0xac')]({'plain':!![]});var _0x32fb02=[];if(_0x450f35===_0xc463('0xab')&&_0x7816a3['role']===_0xc463('0x2d')&&_0x7816a3['online']){for(let _0x388521=0x0;_0x388521<_0x2d750b[_0xc463('0x4d')];_0x388521+=0x1){_0x32fb02[_0xc463('0x4b')]({'membername':_0x7816a3[_0xc463('0x39')],'UserId':_0x7816a3['id'],'queue_name':_0x2d750b[_0x388521][_0xc463('0x39')],'VoiceQueueId':_0x2d750b[_0x388521]['id'],'interface':_[_0xc463('0x68')](_0x7816a3[_0xc463('0x9f')])?util['format'](_0xc463('0xad'),_0x7816a3['name']):_0x7816a3[_0xc463('0x9f')],'paused':_0x7816a3['voicePause']||![],'penalty':_0x1811e4['body'][_0xc463('0xa5')]||0x0});}return Promise['all'](_0x32fb02['map'](function(_0x36b834){return db[_0xc463('0xae')][_0xc463('0xaf')](_0x36b834);}));}return _0xe204fa;});}})[_0xc463('0x16')](respondWithStatusCode(_0x599b4f,null))[_0xc463('0x20')](handleError(_0x599b4f,null));};exports[_0xc463('0xb0')]=function(_0x3301be,_0x3ef640){var _0x25d9fd,_0x2dd438;return db[_0xc463('0x3d')]['find']({'where':{'id':_0x3301be[_0xc463('0x56')]['id']},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c')]})['then'](handleEntityNotFound(_0x3ef640,null))[_0xc463('0x16')](function(_0x4dae5b){if(_0x4dae5b){_0x25d9fd=_0x4dae5b;if(!_0x3301be[_0xc463('0x46')][_0xc463('0x9c')]||!utils['isValidChannel'](_0x3301be['query']['channel'])){throw new db[(_0xc463('0x91'))]['ValidationError'](_0xc463('0xa1'));}return _0x4dae5b[_0xc463('0xb1')+_[_0xc463('0xa3')](_0x3301be[_0xc463('0x46')][_0xc463('0x9c')][_0xc463('0xa7')]())+_0xc463('0xa4')](_0x3301be[_0xc463('0x46')][_0xc463('0x63')]);}})[_0xc463('0x16')](function(_0x2c9bde){if(_[_0xc463('0xb2')](_0x3301be[_0xc463('0x46')]['ids'])){for(var _0x3fd95e=0x0;_0x3fd95e<_0x3301be[_0xc463('0x46')][_0xc463('0x63')]['length'];_0x3fd95e+=0x1){_0x2dd438={'UserId':Number(_0x3301be[_0xc463('0x56')]['id'])};_0x2dd438[_[_0xc463('0xa3')](_0x3301be['query']['channel'][_0xc463('0xa7')]())+'QueueId']=Number(_0x3301be['query']['ids'][_0x3fd95e]);socket[_0xc463('0xa9')](_0xc463('0x31')+_['capitalize'](_0x3301be['query'][_0xc463('0x9c')][_0xc463('0xa7')]())+_0xc463('0xb3'),_0x2dd438);}}else{_0x2dd438={'UserId':Number(_0x3301be['params']['id'])};_0x2dd438[_[_0xc463('0xa3')](_0x3301be[_0xc463('0x46')][_0xc463('0x9c')][_0xc463('0xa7')]())+_0xc463('0xa8')]=Number(_0x3301be[_0xc463('0x46')][_0xc463('0x63')]);socket[_0xc463('0xa9')](_0xc463('0x31')+_['capitalize'](_0x3301be['query']['channel']['toLowerCase']())+'Queue:remove',_0x2dd438);}return _0x2c9bde;})[_0xc463('0x16')](function(){if(_0x3301be[_0xc463('0x46')][_0xc463('0x9c')]===_0xc463('0xab')){return db['UserVoiceQueueRt'][_0xc463('0xb4')]({'where':{'UserId':_0x3301be[_0xc463('0x56')]['id'],'VoiceQueueId':_0x3301be[_0xc463('0x46')][_0xc463('0x63')]},'individualHooks':!![]})['then'](function(){return _0x25d9fd;});}return _0x25d9fd;})[_0xc463('0x16')](respondWithStatusCode(_0x3ef640,null))[_0xc463('0x20')](handleError(_0x3ef640,null));};exports['addAvatar']=function(_0x136541,_0x157357){_0x136541[_0xc463('0x60')][_0xc463('0xb5')]=_0x136541[_0xc463('0xb6')]['filename'];return db[_0xc463('0x3d')][_0xc463('0x5d')]({'where':{'id':_0x136541[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x157357,null))['then'](saveUpdates(_0x136541[_0xc463('0x60')],null))[_0xc463('0x16')](respondWithResult(_0x157357,null))['catch'](handleError(_0x157357,null));};exports['getAvatar']=function(_0x250091,_0x72a685){var _0x3d1716=path[_0xc463('0xb7')](config['root'],_0xc463('0xb8'));return db[_0xc463('0x3d')]['find']({'where':{'id':_0x250091[_0xc463('0x56')]['id']},'attributes':['id',_0xc463('0xb5')],'raw':!![]})[_0xc463('0x16')](handleEntityNotFound(_0x72a685,null))['then'](function(_0x530778){if(_0x530778){if(_['isNil'](_0x530778['userpic'])){return _0x72a685['download'](_0x3d1716);}else{if(!fs[_0xc463('0xb9')](path[_0xc463('0xb7')](config[_0xc463('0xba')],'server/files/images/',_0x530778['userpic']))){return _0x72a685[_0xc463('0xbb')](_0x3d1716);}return _0x72a685[_0xc463('0xbb')](path['join'](config[_0xc463('0xba')],_0xc463('0xbc'),_0x530778[_0xc463('0xb5')]));}}})[_0xc463('0x20')](handleError(_0x72a685,null));};exports[_0xc463('0xbd')]=function(_0x32af9c,_0x405ffd){return db[_0xc463('0x3d')]['find']({'where':{'id':_0x32af9c['params']['id']},'attributes':['id']})[_0xc463('0x16')](handleEntityNotFound(_0x405ffd,null))['then'](function(_0x21b420){var _0x5512ba=[];values=_0x21b420['dataValues'];_0x5512ba['push'](get_open_tabs(_0xc463('0x4e'),_0x21b420[_0xc463('0x4f')]));_0x5512ba[_0xc463('0x4b')](get_open_tabs(_0xc463('0x50'),_0x21b420[_0xc463('0x4f')]));_0x5512ba['push'](get_open_tabs('openchannel',_0x21b420[_0xc463('0x4f')]));_0x5512ba[_0xc463('0x4b')](get_open_tabs(_0xc463('0x53'),_0x21b420['dataValues']));_0x5512ba['push'](get_open_tabs(_0xc463('0x51'),_0x21b420[_0xc463('0x4f')]));_0x5512ba[_0xc463('0x4b')](get_open_tabs(_0xc463('0x52'),_0x21b420['dataValues']));return Promise[_0xc463('0x54')](_0x5512ba);})[_0xc463('0x16')](function(_0x124963){if(_0x124963){var _0x1dcac0=_[_0xc463('0x36')](values['ChatOpenTabs'],function(_0x3b5f99){return{'channel':_0xc463('0xbe'),'id':_0x3b5f99['id'],'createdAt':_0x3b5f99[_0xc463('0xbf')]};});var _0x5dcc12=_[_0xc463('0x36')](values[_0xc463('0xc0')],function(_0x274591){return{'channel':_0xc463('0xc1'),'id':_0x274591['id'],'createdAt':_0x274591[_0xc463('0xbf')]};});var _0xd6d0f2=_['map'](values['OpenchannelOpenTabs'],function(_0x463fe9){return{'channel':_0xc463('0xc2'),'id':_0x463fe9['id'],'createdAt':_0x463fe9[_0xc463('0xbf')]};});var _0x4e9aa6=_[_0xc463('0x36')](values['MailOpenTabs'],function(_0x2eea53){return{'channel':_0xc463('0xc3'),'id':_0x2eea53['id'],'createdAt':_0x2eea53[_0xc463('0xbf')]};});var _0x4826e9=_[_0xc463('0x36')](values[_0xc463('0xc4')],function(_0x719626){return{'channel':_0xc463('0xc5'),'id':_0x719626['id'],'createdAt':_0x719626['createdAt']};});var _0xac2046=_[_0xc463('0x36')](values['WhatsappOpenTabs'],function(_0x39314b){return{'channel':_0xc463('0xc6'),'id':_0x39314b['id'],'createdAt':_0x39314b['createdAt']};});var _0x2d9dfa=_[_0xc463('0xc7')](_0x1dcac0,_0x5dcc12,_0xd6d0f2,_0x4e9aa6,_0x4826e9,_0xac2046);var _0x4a1b23={'count':_0x2d9dfa[_0xc463('0x4d')],'rows':_0x2d9dfa};return _0x4a1b23;}else return null;})[_0xc463('0x16')](respondWithResult(_0x405ffd,null))['catch'](handleError(_0x405ffd,null));};exports[_0xc463('0xc8')]=function(_0x3a1336,_0x26642c){var _0x3e2b6f={};var _0x1cc001={};var _0x4a46c;var _0x467593;return db[_0xc463('0x3d')]['findOne']({'where':{'id':_0x3a1336[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x26642c,null))[_0xc463('0x16')](function(_0x5c5ec4){if(_0x5c5ec4){_0x4a46c=_0x5c5ec4;_0x1cc001['model']=_[_0xc463('0x58')](db[_0xc463('0xc9')][_0xc463('0x3e')]);_0x1cc001[_0xc463('0x46')]=_[_0xc463('0x58')](_0x3a1336[_0xc463('0x46')]);_0x1cc001['filters']=_['intersection'](_0x1cc001[_0xc463('0x57')],_0x1cc001[_0xc463('0x46')]);_0x3e2b6f[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x1cc001[_0xc463('0x57')],qs['fields'](_0x3a1336['query']['fields']));_0x3e2b6f[_0xc463('0x4a')]=_0x3e2b6f[_0xc463('0x4a')][_0xc463('0x4d')]?_0x3e2b6f[_0xc463('0x4a')]:_0x1cc001[_0xc463('0x57')];_0x3e2b6f[_0xc463('0xcb')]=qs['sort'](_0x3a1336[_0xc463('0x46')][_0xc463('0xcc')]);_0x3e2b6f['where']=qs[_0xc463('0xcd')](_['pick'](_0x3a1336[_0xc463('0x46')],_0x1cc001[_0xc463('0xcd')]));if(_0x3a1336[_0xc463('0x46')][_0xc463('0x35')]){_0x3e2b6f[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x3e2b6f[_0xc463('0x43')],{'$or':_[_0xc463('0x36')](_0x3e2b6f[_0xc463('0x4a')],function(_0x439a43){var _0x3d0bca={};_0x3d0bca[_0x439a43]={'$like':'%'+_0x3a1336[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x3d0bca;})});}_0x3e2b6f=_[_0xc463('0x5b')]({},_0x3e2b6f,_0x3a1336[_0xc463('0x5c')]);return _0x4a46c[_0xc463('0xc8')](_0x3e2b6f);}})[_0xc463('0x16')](function(_0x534900){if(_0x534900){_0x467593=_0x534900[_0xc463('0x4d')];if(_0x3a1336[_0xc463('0x46')][_0xc463('0xce')]('includeAll')){_0x3e2b6f['include']=[{'model':db[_0xc463('0xcf')],'as':_0xc463('0xd0'),'required':![]},{'model':db[_0xc463('0xd1')],'as':_0xc463('0xd2'),'attributes':['id',_0xc463('0x39'),'color'],'where':_0x3a1336['query']['tag']?{'id':_0x3a1336[_0xc463('0x46')][_0xc463('0xd3')]}:undefined,'required':_0x3a1336['query'][_0xc463('0xd3')]?!![]:![]}];}if(!_0x3a1336[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x3e2b6f[_0xc463('0x26')]=qs['limit'](_0x3a1336[_0xc463('0x46')][_0xc463('0x26')]);_0x3e2b6f[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x3a1336['query'][_0xc463('0x24')]);}return _0x4a46c[_0xc463('0xc8')](_0x3e2b6f);}})['then'](function(_0x5d8f18){if(_0x5d8f18){return _0x5d8f18?{'count':_0x467593,'rows':_0x5d8f18}:null;}})[_0xc463('0x16')](respondWithResult(_0x26642c,null))[_0xc463('0x20')](handleError(_0x26642c,null));};exports[_0xc463('0xd5')]=function(_0x2e412e,_0x1c602b){var _0x1a2276;var _0x2f3160={};var _0x48f9c3;return db[_0xc463('0x3d')]['findOne']({'where':{'id':_0x2e412e[_0xc463('0x56')]['id']},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c')]})[_0xc463('0x16')](handleEntityNotFound(_0x1c602b,null))[_0xc463('0x16')](function(_0x4cc35c){if(!utils['isValidChannel'](_0x2e412e['query'][_0xc463('0x9c')])){throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0xa1'));}_0x1a2276=_0x4cc35c;var _0x438e2c={};_0x438e2c[_0xc463('0x57')]=_[_0xc463('0x58')](db[_['capitalize'](_0x2e412e[_0xc463('0x46')]['channel'])+_0xc463('0xd6')]['rawAttributes']);_0x438e2c[_0xc463('0x46')]=_[_0xc463('0x58')](_0x2e412e[_0xc463('0x46')]);_0x438e2c['filters']=_[_0xc463('0xca')](_0x438e2c[_0xc463('0x57')],_0x438e2c[_0xc463('0x46')]);_0x2f3160[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x438e2c[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x2e412e[_0xc463('0x46')][_0xc463('0x5a')]));_0x2f3160[_0xc463('0x4a')]=_0x2f3160[_0xc463('0x4a')][_0xc463('0x4d')]?_0x2f3160['attributes']:_0x438e2c['model'];_0x2f3160[_0xc463('0xcb')]=qs['sort'](_0x2e412e[_0xc463('0x46')]['sort']);_0x2f3160[_0xc463('0x43')]=qs[_0xc463('0xcd')](_['pick'](_0x2e412e[_0xc463('0x46')],_0x438e2c[_0xc463('0xcd')]));if(_0x2e412e[_0xc463('0x46')][_0xc463('0x35')]){_0x2f3160[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x2f3160[_0xc463('0x43')],{'$or':_['map'](_0x2f3160[_0xc463('0x4a')],function(_0x3b641f){var _0x2bda57={};_0x2bda57[_0x3b641f]={'$like':'%'+_0x2e412e[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x2bda57;})});}_0x2f3160=_[_0xc463('0x5b')]({},_0x2f3160,_0x2e412e[_0xc463('0x5c')]);switch(_0x1a2276[_0xc463('0x2c')]){case _0xc463('0x2f'):return db[_[_0xc463('0xa3')](_0x2e412e['query'][_0xc463('0x9c')])+'Queue'][_0xc463('0x89')](_0x2f3160);case _0xc463('0x31'):case _0xc463('0x2d'):return _0x1a2276[_0xc463('0xac')+_[_0xc463('0xa3')](_0x2e412e['query'][_0xc463('0x9c')])+_0xc463('0xa4')](_0x2f3160);default:throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0xd7'));}})['then'](function(_0x18c6f6){_0x48f9c3=_0x18c6f6[_0xc463('0x4d')];if(!_0x2e412e[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x2f3160['limit']=qs['limit'](_0x2e412e[_0xc463('0x46')][_0xc463('0x26')]);_0x2f3160[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x2e412e[_0xc463('0x46')][_0xc463('0x24')]);}switch(_0x1a2276[_0xc463('0x2c')]){case _0xc463('0x2f'):return db[_[_0xc463('0xa3')](_0x2e412e[_0xc463('0x46')][_0xc463('0x9c')])+_0xc463('0xd6')]['findAll'](_0x2f3160);case'user':case _0xc463('0x2d'):return _0x1a2276[_0xc463('0xac')+_[_0xc463('0xa3')](_0x2e412e['query']['channel'])+_0xc463('0xa4')](_0x2f3160);}})[_0xc463('0x16')](function(_0x20933b){return{'count':_0x48f9c3,'rows':_0x20933b};})['then'](respondWithResult(_0x1c602b,null))['catch'](handleError(_0x1c602b,null));};exports[_0xc463('0xd8')]=function(_0x3745fd,_0x2d587d){var _0x73e074={};var _0x111f93={};var _0x53737c;var _0x9e5d6f;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x3745fd[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x2d587d,null))['then'](function(_0x167fca){if(_0x167fca){_0x53737c=_0x167fca;_0x111f93[_0xc463('0x57')]=_[_0xc463('0x58')](db['UserVoiceQueueRt'][_0xc463('0x3e')]);_0x111f93[_0xc463('0x46')]=_[_0xc463('0x58')](_0x3745fd[_0xc463('0x46')]);_0x111f93[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x111f93[_0xc463('0x57')],_0x111f93[_0xc463('0x46')]);_0x73e074[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x111f93[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x3745fd[_0xc463('0x46')][_0xc463('0x5a')]));_0x73e074['attributes']=_0x73e074['attributes'][_0xc463('0x4d')]?_0x73e074['attributes']:_0x111f93['model'];_0x73e074[_0xc463('0xcb')]=qs['sort'](_0x3745fd['query'][_0xc463('0xcc')]);_0x73e074[_0xc463('0x43')]=qs[_0xc463('0xcd')](_['pick'](_0x3745fd['query'],_0x111f93['filters']));if(_0x3745fd[_0xc463('0x46')][_0xc463('0x35')]){_0x73e074[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x73e074['where'],{'$or':_[_0xc463('0x36')](_0x73e074[_0xc463('0x4a')],function(_0x2763c3){var _0x67e4bd={};_0x67e4bd[_0x2763c3]={'$like':'%'+_0x3745fd['query'][_0xc463('0x35')]+'%'};return _0x67e4bd;})});}_0x73e074=_[_0xc463('0x5b')]({},_0x73e074,_0x3745fd['options']);return _0x53737c['getVoiceQueuesRt'](_0x73e074);}})[_0xc463('0x16')](function(_0xa9cbe8){if(_0xa9cbe8){_0x9e5d6f=_0xa9cbe8[_0xc463('0x4d')];if(!_0x3745fd[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x73e074[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x3745fd[_0xc463('0x46')][_0xc463('0x26')]);_0x73e074[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x3745fd[_0xc463('0x46')][_0xc463('0x24')]);}return _0x53737c[_0xc463('0xd8')](_0x73e074);}})['then'](function(_0xbb3606){if(_0xbb3606){return _0xbb3606?{'count':_0x9e5d6f,'rows':_0xbb3606}:null;}})['then'](respondWithResult(_0x2d587d,null))[_0xc463('0x20')](handleError(_0x2d587d,null));};exports[_0xc463('0xd9')]=function(_0x22bc5a,_0x59e7a4){var _0x3fef31={};var _0x2a3f88={};var _0x5a20ce;var _0xe3beb4;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x22bc5a[_0xc463('0x56')]['id']}})['then'](handleEntityNotFound(_0x59e7a4,null))['then'](function(_0x5864b2){if(_0x5864b2){_0x5a20ce=_0x5864b2;_0x2a3f88[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xda')][_0xc463('0x3e')]);_0x2a3f88[_0xc463('0x46')]=_[_0xc463('0x58')](_0x22bc5a['query']);_0x2a3f88[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x2a3f88[_0xc463('0x57')],_0x2a3f88[_0xc463('0x46')]);_0x3fef31[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x2a3f88[_0xc463('0x57')],qs['fields'](_0x22bc5a[_0xc463('0x46')]['fields']));_0x3fef31[_0xc463('0x4a')]=_0x3fef31[_0xc463('0x4a')][_0xc463('0x4d')]?_0x3fef31['attributes']:_0x2a3f88['model'];_0x3fef31[_0xc463('0xcb')]=qs['sort'](_0x22bc5a[_0xc463('0x46')][_0xc463('0xcc')]);_0x3fef31[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x22bc5a[_0xc463('0x46')],_0x2a3f88[_0xc463('0xcd')]));if(_0x22bc5a['query'][_0xc463('0x35')]){_0x3fef31['where']=_[_0xc463('0x5b')](_0x3fef31[_0xc463('0x43')],{'$or':_['map'](_0x3fef31[_0xc463('0x4a')],function(_0x438d24){var _0x11d194={};_0x11d194[_0x438d24]={'$like':'%'+_0x22bc5a[_0xc463('0x46')]['filter']+'%'};return _0x11d194;})});}_0x3fef31=_[_0xc463('0x5b')]({},_0x3fef31,_0x22bc5a['options']);return _0x5a20ce['getGroups'](_0x3fef31);}})['then'](function(_0x354d0e){if(_0x354d0e){_0xe3beb4=_0x354d0e[_0xc463('0x4d')];if(!_0x22bc5a[_0xc463('0x46')]['hasOwnProperty'](_0xc463('0xd4'))){_0x3fef31[_0xc463('0x26')]=qs['limit'](_0x22bc5a[_0xc463('0x46')][_0xc463('0x26')]);_0x3fef31['offset']=qs['offset'](_0x22bc5a[_0xc463('0x46')][_0xc463('0x24')]);}return _0x5a20ce[_0xc463('0xd9')](_0x3fef31);}})[_0xc463('0x16')](function(_0x36a5d7){if(_0x36a5d7){return _0x36a5d7?{'count':_0xe3beb4,'rows':_0x36a5d7}:null;}})[_0xc463('0x16')](respondWithResult(_0x59e7a4,null))[_0xc463('0x20')](handleError(_0x59e7a4,null));};exports[_0xc463('0xdc')]=function(_0x55b518,_0x2feafe){var _0x5ef5cd={'raw':!![],'where':{}};var _0x1a160c={};var _0x491f22={'count':0x0,'rows':[]};return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x55b518['params']['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x2feafe,null))['then'](function(_0x188dcb){if(_0x188dcb){_0x1a160c[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xdd')][_0xc463('0x3e')]);_0x1a160c[_0xc463('0x46')]=_['keys'](_0x55b518[_0xc463('0x46')]);_0x1a160c['filters']=_['intersection'](_0x1a160c[_0xc463('0x57')],_0x1a160c['query']);_0x5ef5cd[_0xc463('0x4a')]=_['intersection'](_0x1a160c[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x55b518[_0xc463('0x46')][_0xc463('0x5a')]));_0x5ef5cd[_0xc463('0x4a')]=_0x5ef5cd['attributes'][_0xc463('0x4d')]?_0x5ef5cd[_0xc463('0x4a')]:_0x1a160c[_0xc463('0x57')];if(!_0x55b518[_0xc463('0x46')]['hasOwnProperty']('nolimit')){_0x5ef5cd[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x55b518[_0xc463('0x46')][_0xc463('0x26')]);_0x5ef5cd[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x55b518['query']['offset']);}_0x5ef5cd[_0xc463('0xcb')]=qs['sort'](_0x55b518['query'][_0xc463('0xcc')]);_0x5ef5cd[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x55b518[_0xc463('0x46')],_0x1a160c['filters']));_0x5ef5cd['where'][_0xc463('0xde')]=_0x188dcb['id'];if(_0x55b518[_0xc463('0x46')]['filter']){_0x5ef5cd[_0xc463('0x43')]=_['merge'](_0x5ef5cd[_0xc463('0x43')],{'$or':_['map'](_0x5ef5cd[_0xc463('0x4a')],function(_0x47134a){var _0x6574ab={};_0x6574ab[_0x47134a]={'$like':'%'+_0x55b518[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x6574ab;})});}_0x5ef5cd=_[_0xc463('0x5b')]({},_0x5ef5cd,_0x55b518[_0xc463('0x5c')]);return db[_0xc463('0xdd')][_0xc463('0x27')]({'where':_0x5ef5cd['where']})['then'](function(_0x175d5d){_0x491f22[_0xc463('0x27')]=_0x175d5d;if(_0x55b518[_0xc463('0x46')][_0xc463('0x44')]){_0x5ef5cd['include']=[{'all':!![]}];}return db[_0xc463('0xdd')][_0xc463('0x89')](_0x5ef5cd);})['then'](function(_0x10e108){_0x491f22[_0xc463('0x4c')]=_0x10e108;return _0x491f22;});}})[_0xc463('0x16')](respondWithFilteredResult(_0x2feafe,_0x5ef5cd))['catch'](handleError(_0x2feafe,null));};exports[_0xc463('0xdf')]=function(_0x55c944,_0x40fc3d){var _0x442d28={'raw':!![],'where':{}};var _0x4fd6b3={};var _0x130195={'count':0x0,'rows':[]};return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x55c944[_0xc463('0x56')]['id']}})['then'](handleEntityNotFound(_0x40fc3d,null))[_0xc463('0x16')](function(_0x5872e3){if(_0x5872e3){_0x4fd6b3[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xe0')]['rawAttributes']);_0x4fd6b3[_0xc463('0x46')]=_[_0xc463('0x58')](_0x55c944[_0xc463('0x46')]);_0x4fd6b3[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x4fd6b3['model'],_0x4fd6b3[_0xc463('0x46')]);_0x442d28[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x4fd6b3[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x55c944['query'][_0xc463('0x5a')]));_0x442d28[_0xc463('0x4a')]=_0x442d28['attributes']['length']?_0x442d28['attributes']:_0x4fd6b3[_0xc463('0x57')];if(!_0x55c944[_0xc463('0x46')]['hasOwnProperty']('nolimit')){_0x442d28[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x55c944['query'][_0xc463('0x26')]);_0x442d28['offset']=qs[_0xc463('0x24')](_0x55c944[_0xc463('0x46')][_0xc463('0x24')]);}_0x442d28[_0xc463('0xcb')]=qs['sort'](_0x55c944[_0xc463('0x46')][_0xc463('0xcc')]);_0x442d28[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x55c944['query'],_0x4fd6b3[_0xc463('0xcd')]));_0x442d28[_0xc463('0x43')][_0xc463('0xde')]=_0x5872e3['id'];if(_0x55c944[_0xc463('0x46')][_0xc463('0x35')]){_0x442d28[_0xc463('0x43')]=_['merge'](_0x442d28[_0xc463('0x43')],{'$or':_['map'](_0x442d28[_0xc463('0x4a')],function(_0x4842bd){var _0x4fc61a={};_0x4fc61a[_0x4842bd]={'$like':'%'+_0x55c944[_0xc463('0x46')]['filter']+'%'};return _0x4fc61a;})});}_0x442d28=_['merge']({},_0x442d28,_0x55c944['options']);return db[_0xc463('0xe0')]['count']({'where':_0x442d28[_0xc463('0x43')]})[_0xc463('0x16')](function(_0x43ea06){_0x130195['count']=_0x43ea06;if(_0x55c944[_0xc463('0x46')][_0xc463('0x44')]){_0x442d28[_0xc463('0x45')]=[{'all':!![]}];}return db[_0xc463('0xe0')][_0xc463('0x89')](_0x442d28);})['then'](function(_0x3a796e){_0x130195[_0xc463('0x4c')]=_0x3a796e;return _0x130195;});}})[_0xc463('0x16')](respondWithFilteredResult(_0x40fc3d,_0x442d28))[_0xc463('0x20')](handleError(_0x40fc3d,null));};exports[_0xc463('0xe1')]=function(_0x5f068a,_0x223b0d){var _0x13f909={};var _0x8b63dc={};var _0x390339;var _0x4c74a8;return db[_0xc463('0x3d')]['findOne']({'where':{'id':_0x5f068a['params']['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x223b0d,null))[_0xc463('0x16')](function(_0x1b1143){if(_0x1b1143){_0x390339=_0x1b1143;_0x8b63dc['model']=_[_0xc463('0x58')](db[_0xc463('0xe2')][_0xc463('0x3e')]);_0x8b63dc[_0xc463('0x46')]=_[_0xc463('0x58')](_0x5f068a['query']);_0x8b63dc[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x8b63dc[_0xc463('0x57')],_0x8b63dc[_0xc463('0x46')]);_0x13f909[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x8b63dc[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x5f068a[_0xc463('0x46')][_0xc463('0x5a')]));_0x13f909['attributes']=_0x13f909[_0xc463('0x4a')][_0xc463('0x4d')]?_0x13f909[_0xc463('0x4a')]:_0x8b63dc['model'];_0x13f909[_0xc463('0xcb')]=qs[_0xc463('0xcc')](_0x5f068a[_0xc463('0x46')][_0xc463('0xcc')]);_0x13f909[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x5f068a[_0xc463('0x46')],_0x8b63dc[_0xc463('0xcd')]));if(_0x5f068a['query']['filter']){_0x13f909[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x13f909[_0xc463('0x43')],{'$or':_[_0xc463('0x36')](_0x13f909[_0xc463('0x4a')],function(_0x12c407){var _0x3a4e95={};_0x3a4e95[_0x12c407]={'$like':'%'+_0x5f068a['query'][_0xc463('0x35')]+'%'};return _0x3a4e95;})});}_0x13f909=_[_0xc463('0x5b')]({},_0x13f909,_0x5f068a[_0xc463('0x5c')]);return _0x390339[_0xc463('0xe1')](_0x13f909);}})['then'](function(_0x57b49a){if(_0x57b49a){_0x4c74a8=_0x57b49a['length'];if(!_0x5f068a[_0xc463('0x46')]['hasOwnProperty'](_0xc463('0xd4'))){_0x13f909[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x5f068a[_0xc463('0x46')][_0xc463('0x26')]);_0x13f909[_0xc463('0x24')]=qs['offset'](_0x5f068a[_0xc463('0x46')][_0xc463('0x24')]);}return _0x390339[_0xc463('0xe1')](_0x13f909);}})[_0xc463('0x16')](function(_0x568723){if(_0x568723){return _0x568723?{'count':_0x4c74a8,'rows':_0x568723}:null;}})['then'](respondWithResult(_0x223b0d,null))[_0xc463('0x20')](handleError(_0x223b0d,null));};exports['getOpenchannelInteractions']=function(_0xd1feac,_0x456b61){var _0x2310e0={};var _0x4da4a4={};var _0x368623;var _0x59f96f;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0xd1feac[_0xc463('0x56')]['id']}})['then'](handleEntityNotFound(_0x456b61,null))['then'](function(_0x526b9d){if(_0x526b9d){_0x368623=_0x526b9d;_0x4da4a4['model']=_['keys'](db[_0xc463('0xe3')][_0xc463('0x3e')]);_0x4da4a4['query']=_[_0xc463('0x58')](_0xd1feac[_0xc463('0x46')]);_0x4da4a4[_0xc463('0xcd')]=_['intersection'](_0x4da4a4[_0xc463('0x57')],_0x4da4a4[_0xc463('0x46')]);_0x2310e0[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x4da4a4[_0xc463('0x57')],qs[_0xc463('0x5a')](_0xd1feac[_0xc463('0x46')][_0xc463('0x5a')]));_0x2310e0[_0xc463('0x4a')]=_0x2310e0[_0xc463('0x4a')][_0xc463('0x4d')]?_0x2310e0[_0xc463('0x4a')]:_0x4da4a4[_0xc463('0x57')];_0x2310e0[_0xc463('0xcb')]=qs[_0xc463('0xcc')](_0xd1feac[_0xc463('0x46')][_0xc463('0xcc')]);_0x2310e0[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0xd1feac['query'],_0x4da4a4['filters']));if(_0xd1feac['query'][_0xc463('0x35')]){_0x2310e0[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x2310e0['where'],{'$or':_['map'](_0x2310e0[_0xc463('0x4a')],function(_0x55c391){var _0x597645={};_0x597645[_0x55c391]={'$like':'%'+_0xd1feac[_0xc463('0x46')]['filter']+'%'};return _0x597645;})});}_0x2310e0=_[_0xc463('0x5b')]({},_0x2310e0,_0xd1feac[_0xc463('0x5c')]);return _0x368623[_0xc463('0xe4')](_0x2310e0);}})[_0xc463('0x16')](function(_0x38f413){if(_0x38f413){_0x59f96f=_0x38f413['length'];if(!_0xd1feac[_0xc463('0x46')][_0xc463('0xce')]('nolimit')){_0x2310e0['limit']=qs[_0xc463('0x26')](_0xd1feac['query']['limit']);_0x2310e0[_0xc463('0x24')]=qs[_0xc463('0x24')](_0xd1feac[_0xc463('0x46')][_0xc463('0x24')]);}return _0x368623['getOpenchannelInteractions'](_0x2310e0);}})['then'](function(_0x51d406){if(_0x51d406){return _0x51d406?{'count':_0x59f96f,'rows':_0x51d406}:null;}})[_0xc463('0x16')](respondWithResult(_0x456b61,null))[_0xc463('0x20')](handleError(_0x456b61,null));};exports[_0xc463('0xe5')]=function(_0x48696c,_0x29ba41){var _0x1e1974={'raw':!![],'where':{}};var _0x11e107={};var _0x1d494c={'count':0x0,'rows':[]};return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x48696c[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x29ba41,null))[_0xc463('0x16')](function(_0x349771){if(_0x349771){_0x11e107[_0xc463('0x57')]=_['keys'](db[_0xc463('0xe6')][_0xc463('0x3e')]);_0x11e107['query']=_['keys'](_0x48696c[_0xc463('0x46')]);_0x11e107[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x11e107[_0xc463('0x57')],_0x11e107[_0xc463('0x46')]);_0x1e1974[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x11e107[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x48696c[_0xc463('0x46')][_0xc463('0x5a')]));_0x1e1974['attributes']=_0x1e1974[_0xc463('0x4a')][_0xc463('0x4d')]?_0x1e1974[_0xc463('0x4a')]:_0x11e107[_0xc463('0x57')];if(!_0x48696c[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x1e1974['limit']=qs[_0xc463('0x26')](_0x48696c[_0xc463('0x46')][_0xc463('0x26')]);_0x1e1974[_0xc463('0x24')]=qs['offset'](_0x48696c[_0xc463('0x46')][_0xc463('0x24')]);}_0x1e1974[_0xc463('0xcb')]=qs[_0xc463('0xcc')](_0x48696c[_0xc463('0x46')][_0xc463('0xcc')]);_0x1e1974['where']=qs['filters'](_['pick'](_0x48696c[_0xc463('0x46')],_0x11e107[_0xc463('0xcd')]));_0x1e1974[_0xc463('0x43')][_0xc463('0xde')]=_0x349771['id'];if(_0x48696c[_0xc463('0x46')][_0xc463('0x35')]){_0x1e1974['where']=_['merge'](_0x1e1974[_0xc463('0x43')],{'$or':_['map'](_0x1e1974[_0xc463('0x4a')],function(_0x1efd11){var _0x3abc59={};_0x3abc59[_0x1efd11]={'$like':'%'+_0x48696c['query']['filter']+'%'};return _0x3abc59;})});}_0x1e1974=_[_0xc463('0x5b')]({},_0x1e1974,_0x48696c[_0xc463('0x5c')]);return db[_0xc463('0xe6')][_0xc463('0x27')]({'where':_0x1e1974[_0xc463('0x43')]})[_0xc463('0x16')](function(_0x51199e){_0x1d494c[_0xc463('0x27')]=_0x51199e;if(_0x48696c['query'][_0xc463('0x44')]){_0x1e1974['include']=[{'all':!![]}];}return db[_0xc463('0xe6')][_0xc463('0x89')](_0x1e1974);})[_0xc463('0x16')](function(_0x546ea3){_0x1d494c[_0xc463('0x4c')]=_0x546ea3;return _0x1d494c;});}})[_0xc463('0x16')](respondWithFilteredResult(_0x29ba41,_0x1e1974))[_0xc463('0x20')](handleError(_0x29ba41,null));};exports[_0xc463('0xe7')]=function(_0x86d1b1,_0x5a4d27){var _0x389757={};var _0x4422c1={};var _0x4b57bb;var _0x38b90a;return db[_0xc463('0x3d')]['findOne']({'where':{'id':_0x86d1b1[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x5a4d27,null))[_0xc463('0x16')](function(_0x43370f){if(_0x43370f){_0x4b57bb=_0x43370f;_0x4422c1[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xe8')][_0xc463('0x3e')]);_0x4422c1['query']=_[_0xc463('0x58')](_0x86d1b1[_0xc463('0x46')]);_0x4422c1[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x4422c1[_0xc463('0x57')],_0x4422c1[_0xc463('0x46')]);_0x389757[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x4422c1['model'],qs[_0xc463('0x5a')](_0x86d1b1['query'][_0xc463('0x5a')]));_0x389757[_0xc463('0x4a')]=_0x389757[_0xc463('0x4a')][_0xc463('0x4d')]?_0x389757[_0xc463('0x4a')]:_0x4422c1[_0xc463('0x57')];_0x389757[_0xc463('0xcb')]=qs['sort'](_0x86d1b1['query']['sort']);_0x389757['where']=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x86d1b1[_0xc463('0x46')],_0x4422c1[_0xc463('0xcd')]));if(_0x86d1b1[_0xc463('0x46')]['filter']){_0x389757[_0xc463('0x43')]=_['merge'](_0x389757['where'],{'$or':_[_0xc463('0x36')](_0x389757[_0xc463('0x4a')],function(_0x19c1d0){var _0x534af2={};_0x534af2[_0x19c1d0]={'$like':'%'+_0x86d1b1[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x534af2;})});}_0x389757=_['merge']({},_0x389757,_0x86d1b1[_0xc463('0x5c')]);return _0x4b57bb[_0xc463('0xe7')](_0x389757);}})[_0xc463('0x16')](function(_0x375be3){if(_0x375be3){_0x38b90a=_0x375be3[_0xc463('0x4d')];if(!_0x86d1b1[_0xc463('0x46')]['hasOwnProperty'](_0xc463('0xd4'))){_0x389757[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x86d1b1[_0xc463('0x46')]['limit']);_0x389757[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x86d1b1[_0xc463('0x46')][_0xc463('0x24')]);}return _0x4b57bb['getSmsInteractions'](_0x389757);}})[_0xc463('0x16')](function(_0x76a577){if(_0x76a577){return _0x76a577?{'count':_0x38b90a,'rows':_0x76a577}:null;}})[_0xc463('0x16')](respondWithResult(_0x5a4d27,null))[_0xc463('0x20')](handleError(_0x5a4d27,null));};exports[_0xc463('0xe9')]=function(_0x5a0c6e,_0xa26603){var _0x57e6b5={};var _0x175e88={};var _0x1c191e;var _0x5f2591;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x5a0c6e['params']['id']}})[_0xc463('0x16')](handleEntityNotFound(_0xa26603,null))[_0xc463('0x16')](function(_0x3bd2fe){if(_0x3bd2fe){_0x1c191e=_0x3bd2fe;_0x175e88[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xea')][_0xc463('0x3e')]);_0x175e88[_0xc463('0x46')]=_[_0xc463('0x58')](_0x5a0c6e[_0xc463('0x46')]);_0x175e88[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x175e88[_0xc463('0x57')],_0x175e88[_0xc463('0x46')]);_0x57e6b5[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x175e88['model'],qs[_0xc463('0x5a')](_0x5a0c6e[_0xc463('0x46')][_0xc463('0x5a')]));_0x57e6b5[_0xc463('0x4a')]=_0x57e6b5['attributes']['length']?_0x57e6b5[_0xc463('0x4a')]:_0x175e88[_0xc463('0x57')];_0x57e6b5[_0xc463('0xcb')]=qs['sort'](_0x5a0c6e['query'][_0xc463('0xcc')]);_0x57e6b5[_0xc463('0x43')]=qs['filters'](_[_0xc463('0xdb')](_0x5a0c6e[_0xc463('0x46')],_0x175e88[_0xc463('0xcd')]));if(_0x5a0c6e[_0xc463('0x46')][_0xc463('0x35')]){_0x57e6b5[_0xc463('0x43')]=_['merge'](_0x57e6b5[_0xc463('0x43')],{'$or':_['map'](_0x57e6b5[_0xc463('0x4a')],function(_0x23a1e2){var _0x307f82={};_0x307f82[_0x23a1e2]={'$like':'%'+_0x5a0c6e[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x307f82;})});}_0x57e6b5=_[_0xc463('0x5b')]({},_0x57e6b5,_0x5a0c6e[_0xc463('0x5c')]);return _0x1c191e[_0xc463('0xe9')](_0x57e6b5);}})[_0xc463('0x16')](function(_0x190a1a){if(_0x190a1a){_0x5f2591=_0x190a1a[_0xc463('0x4d')];if(!_0x5a0c6e[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x57e6b5[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x5a0c6e[_0xc463('0x46')][_0xc463('0x26')]);_0x57e6b5[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x5a0c6e[_0xc463('0x46')]['offset']);}return _0x1c191e[_0xc463('0xe9')](_0x57e6b5);}})[_0xc463('0x16')](function(_0x2c23b5){if(_0x2c23b5){return _0x2c23b5?{'count':_0x5f2591,'rows':_0x2c23b5}:null;}})[_0xc463('0x16')](respondWithResult(_0xa26603,null))['catch'](handleError(_0xa26603,null));};exports[_0xc463('0xeb')]=function(_0x442a33,_0x2413bb){var _0x284c38={};var _0x345a5b={};var _0xedd031;var _0x33ba74;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x442a33[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x2413bb,null))[_0xc463('0x16')](function(_0x55fe35){if(_0x55fe35){_0xedd031=_0x55fe35;_0x345a5b['model']=_['keys'](db[_0xc463('0xec')][_0xc463('0x3e')]);_0x345a5b[_0xc463('0x46')]=_['keys'](_0x442a33[_0xc463('0x46')]);_0x345a5b[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x345a5b[_0xc463('0x57')],_0x345a5b[_0xc463('0x46')]);_0x284c38[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x345a5b[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x442a33[_0xc463('0x46')][_0xc463('0x5a')]));_0x284c38[_0xc463('0x4a')]=_0x284c38['attributes'][_0xc463('0x4d')]?_0x284c38[_0xc463('0x4a')]:_0x345a5b[_0xc463('0x57')];_0x284c38[_0xc463('0xcb')]=qs[_0xc463('0xcc')](_0x442a33[_0xc463('0x46')][_0xc463('0xcc')]);_0x284c38[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x442a33['query'],_0x345a5b['filters']));if(_0x442a33[_0xc463('0x46')]['filter']){_0x284c38[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x284c38['where'],{'$or':_[_0xc463('0x36')](_0x284c38[_0xc463('0x4a')],function(_0x7446dc){var _0x51b474={};_0x51b474[_0x7446dc]={'$like':'%'+_0x442a33[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x51b474;})});}_0x284c38=_['merge']({},_0x284c38,_0x442a33[_0xc463('0x5c')]);return _0xedd031['getWhatsappInteractions'](_0x284c38);}})[_0xc463('0x16')](function(_0x243f3d){if(_0x243f3d){_0x33ba74=_0x243f3d['length'];if(!_0x442a33[_0xc463('0x46')][_0xc463('0xce')]('nolimit')){_0x284c38['limit']=qs[_0xc463('0x26')](_0x442a33['query'][_0xc463('0x26')]);_0x284c38[_0xc463('0x24')]=qs[_0xc463('0x24')](_0x442a33['query'][_0xc463('0x24')]);}return _0xedd031[_0xc463('0xeb')](_0x284c38);}})[_0xc463('0x16')](function(_0x1c3c84){if(_0x1c3c84){return _0x1c3c84?{'count':_0x33ba74,'rows':_0x1c3c84}:null;}})['then'](respondWithResult(_0x2413bb,null))['catch'](handleError(_0x2413bb,null));};exports[_0xc463('0xed')]=function(_0x9e34cf,_0x2204d7,_0x3d06cf){var _0x88e84e;var _0x19852c;var _0x1ac338;var _0x4e539f=!_['isNil'](_0x9e34cf[_0xc463('0x56')]['id'])?_0x9e34cf[_0xc463('0x56')]['id']:!_[_0xc463('0x68')](_0x9e34cf[_0xc463('0x31')]['id'])?_0x9e34cf[_0xc463('0x31')]['id']:null;return db[_0xc463('0x3d')]['find']({'where':{'id':_0x4e539f,'role':{'$or':[_0xc463('0x2f'),_0xc463('0x31'),_0xc463('0x2d')]}},'attributes':['id',_0xc463('0x39'),_0xc463('0xee'),_0xc463('0xef'),_0xc463('0x2c'),_0xc463('0x67'),_0xc463('0x9e')]})[_0xc463('0x16')](function(_0x41a921){if(_0x41a921){if(_0x41a921[_0xc463('0x2c')]===_0xc463('0x2d')){_0x88e84e=_0x41a921;if(_0x9e34cf[_0xc463('0x60')][_0xc463('0x9f')]){_0x1ac338=util[_0xc463('0xf0')](_0xc463('0xf1'),_0x88e84e[_0x9e34cf[_0xc463('0x60')][_0xc463('0x9f')]]);}else if(_0x9e34cf[_0xc463('0x60')][_0xc463('0xf2')]){_0x1ac338=util[_0xc463('0xf0')]('SIP/%s',_0x9e34cf[_0xc463('0x60')][_0xc463('0xf2')]);}else{_0x1ac338=util[_0xc463('0xf0')](_0xc463('0xad'),_0x88e84e[_0xc463('0x39')]);}socket['to'](util[_0xc463('0xf0')](_0xc463('0xf3'),_0x88e84e[_0xc463('0x39')]))[_0xc463('0xa9')](_0xc463('0xf4'),{'user':{'id':_0x88e84e['id'],'name':_0x88e84e[_0xc463('0x39')]},'ip':_0x9e34cf[_0xc463('0xf5')][_0xc463('0xf6')]||_0x9e34cf['connection']['remoteAddress']||_0x9e34cf[_0xc463('0xf7')][_0xc463('0xf8')]||_0x9e34cf[_0xc463('0xf9')][_0xc463('0xf7')][_0xc463('0xf8')]});return db[_0xc463('0xae')][_0xc463('0xb4')]({'where':{'membername':_0x88e84e['name']},'individualHooks':!![]});}}else{throw new db[(_0xc463('0x91'))][(_0xc463('0x8e'))](_0xc463('0xfa'));}})[_0xc463('0x16')](function(){if(_0x88e84e){return _0x88e84e[_0xc463('0xfb')]({'raw':!![]});}})[_0xc463('0x16')](function(_0x4179f4){if(_0x88e84e){if(_0x4179f4){_0x19852c=_0x4179f4;if(_0x19852c['length']){var _0x34ee85=_0x19852c[_0xc463('0x36')](function(_0x218e71){var _0x4a6d0a={'membername':_0x88e84e[_0xc463('0x39')],'UserId':_0x88e84e['id'],'queue_name':_0x218e71[_0xc463('0x39')],'VoiceQueueId':_0x218e71['id'],'interface':_0x1ac338,'paused':_0x88e84e[_0xc463('0x9e')]||![],'penalty':_0x218e71[_0xc463('0xfc')]||0x0};return db[_0xc463('0xae')][_0xc463('0xaf')](_0x4a6d0a);});return Promise[_0xc463('0x54')](_0x34ee85);}}}})[_0xc463('0x16')](function(){if(_0x88e84e){return db[_0xc463('0xfd')][_0xc463('0x89')]({'where':{'membername':_0x88e84e[_0xc463('0x39')],'exitAt':null}});}})[_0xc463('0x16')](function(_0x234fe5){if(_0x88e84e){var _0x23f4f6=[];_0x234fe5[_0xc463('0xfe')](function(_0x50b5e2){_0x23f4f6[_0xc463('0x4b')](_0x50b5e2['update']({'exitAt':moment()[_0xc463('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x23f4f6);}})['then'](function(){if(_0x88e84e){var _0x470dcf=[];var _0x36dcb9=[];var _0x46f5d9=utils['getChannels']();var _0x2d8af8={'membername':_0x88e84e[_0xc463('0x39')],'interface':_0x1ac338,'enterAt':moment()[_0xc463('0xf0')](_0xc463('0xff')),'role':_0x88e84e[_0xc463('0x2c')],'internal':_0x88e84e['internal']};_0x46f5d9[_0xc463('0xfe')](function(_0x7291c1){_0x470dcf[_0xc463('0x4b')](_['merge']({'channel':_0x7291c1,'type':'LOGIN','data1':_0x9e34cf[_0xc463('0x60')]['device'],'data2':_0x1ac338},_0x2d8af8));if(_0x88e84e[_0xc463('0x9e')]){_0x36dcb9[_0xc463('0x4b')](_[_0xc463('0x5b')]({'channel':_0x7291c1,'type':_0xc463('0x100'),'data1':_0xc463('0x101')},_0x2d8af8));}});return db['MemberReport'][_0xc463('0x102')](_0x470dcf[_0xc463('0xc7')](_0x36dcb9),{'individualHooks':!![]});}})[_0xc463('0x16')](function(){if(_0x88e84e){return _0x88e84e[_0xc463('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xc463('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x88e84e[_0xc463('0x9e')]||![],'mailPause':_0x88e84e[_0xc463('0x9e')]||![],'chatPause':_0x88e84e['loginInPause']||![],'faxPause':_0x88e84e['loginInPause']||![],'smsPause':_0x88e84e[_0xc463('0x9e')]||![],'openchannelPause':_0x88e84e[_0xc463('0x9e')]||![],'whatsappPause':_0x88e84e[_0xc463('0x9e')]||![],'pauseType':_0x88e84e[_0xc463('0x9e')]?'LOGININPAUSE':null,'interface':_0x1ac338,'lastPauseAt':moment()[_0xc463('0xf0')](_0xc463('0xff'))});}})[_0xc463('0x16')](function(_0x1cb94c){if(_0x9e34cf[_0xc463('0x103')]){return _0x3d06cf();}else{return Promise[_0xc463('0x104')](_0x1cb94c)[_0xc463('0x16')](respondWithResult(_0x2204d7,null));}})[_0xc463('0x20')](handleError(_0x2204d7,null));};exports[_0xc463('0x105')]=function(_0x24e805,_0x149639){var _0x1dd37a;return db[_0xc463('0x3d')][_0xc463('0x5d')]({'where':{'id':_0x24e805[_0xc463('0x56')]['id'],'role':_0xc463('0x2d')},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c')]})[_0xc463('0x16')](handleEntityNotFound(_0x149639,null))['then'](function(_0x21df6c){if(_0x21df6c){_0x1dd37a=_0x21df6c;return db[_0xc463('0xae')]['destroy']({'where':{'membername':_0x1dd37a['name']},'individualHooks':!![]});}})['then'](function(){return db[_0xc463('0xfd')]['findAll']({'where':{'membername':_0x1dd37a['name'],'exitAt':null}});})[_0xc463('0x16')](function(_0x5cd618){var _0x12e7fd=[];_0x5cd618['forEach'](function(_0x5799f3){_0x12e7fd[_0xc463('0x4b')](_0x5799f3[_0xc463('0x2b')]({'exitAt':moment()[_0xc463('0xf0')](_0xc463('0xff'))}));});return Promise['all'](_0x12e7fd);})[_0xc463('0x16')](function(){return _0x1dd37a['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc463('0x16')](respondWithResult(_0x149639,null))[_0xc463('0x20')](handleError(_0x149639,null));};exports[_0xc463('0x106')]=function(_0x41152e,_0x5cca0f){var _0x4affb1;return db[_0xc463('0xae')][_0xc463('0x2b')]({'paused':0x1},{'where':{'UserId':_0x41152e[_0xc463('0x56')]['id']},'individualHooks':!![]})[_0xc463('0x16')](function(){return db['User'][_0xc463('0x5d')]({'where':{'id':_0x41152e[_0xc463('0x56')]['id'],'role':_0xc463('0x2d')},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c'),'internal',_0xc463('0x9f'),_0xc463('0x9d')]});})['then'](handleEntityNotFound(_0x5cca0f,null))[_0xc463('0x16')](function(_0x57e445){if(_0x57e445){_0x4affb1=_0x57e445;return respondWithRpcPromise(_0xc463('0x107'),_0xc463('0x106'),{'id':_0x4affb1['id'],'name':_0x4affb1[_0xc463('0x39')],'pause':!![]});}})[_0xc463('0x16')](function(){if(_0x4affb1){return db['MemberReport'][_0xc463('0x89')]({'where':{'membername':_0x4affb1['name'],'type':_0xc463('0x100'),'exitAt':null}});}})[_0xc463('0x16')](function(_0x176afd){if(_0x176afd[_0xc463('0x4d')]){var _0x5bae2f=moment()['format'](_0xc463('0xff'));for(var _0x42d5c9=0x0,_0x698f3b=_0x176afd['length'];_0x42d5c9<_0x698f3b;_0x42d5c9++){_0x176afd[_0x42d5c9][_0xc463('0x108')]({'exitAt':_0x5bae2f});}}})[_0xc463('0x16')](function(){var _0x3be030=[];var _0x18fad0=utils['getChannels']();_0x18fad0['forEach'](function(_0x28a47b){_0x3be030[_0xc463('0x4b')]({'channel':_0x28a47b,'membername':_0x4affb1[_0xc463('0x39')],'interface':_[_0xc463('0x68')](_0x4affb1[_0xc463('0x9f')])?util['format']('SIP/%s',_0x4affb1[_0xc463('0x39')]):_0x4affb1['interface'],'type':_0xc463('0x100'),'enterAt':moment()['format'](_0xc463('0xff')),'data1':_0x41152e['body'][_0xc463('0x40')]||'DEFAULT\x20PAUSE','role':_0x4affb1[_0xc463('0x2c')],'internal':_0x4affb1[_0xc463('0x67')]});});return db[_0xc463('0xfd')]['bulkCreate'](_0x3be030,{'individualHooks':!![]});})[_0xc463('0x16')](function(){return _0x4affb1['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x41152e[_0xc463('0x60')][_0xc463('0x40')]||_0xc463('0x109'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x5cca0f,null))[_0xc463('0x20')](handleError(_0x5cca0f,null));};exports[_0xc463('0x10a')]=function(_0x27e3e5,_0x48e4db){if(_0x27e3e5[_0xc463('0x60')][_0xc463('0x9c')]&&!utils[_0xc463('0xa0')](_0x27e3e5[_0xc463('0x60')]['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x27e3e5['body'][_0xc463('0x9c')]));}return db[_0xc463('0x3d')][_0xc463('0x5d')]({'where':{'id':_0x27e3e5[_0xc463('0x56')]['id']},'attributes':['id',_0xc463('0x39'),_0xc463('0x2c'),_0xc463('0x67'),_0xc463('0x9f'),_0xc463('0x9d'),_0xc463('0x10b'),_0xc463('0x10c'),'chatPause',_0xc463('0x10d'),_0xc463('0x10e'),_0xc463('0x10f'),_0xc463('0x110'),_0xc463('0x111'),_0xc463('0x112')]})['then'](function(_0x4000a6){if(!_0x4000a6){throw new APINotFoundError(util[_0xc463('0xf0')](_0xc463('0x113'),_0x27e3e5['params']['id']));}return _0x4000a6['unpause'](_0x27e3e5[_0xc463('0x60')]['channel']);})[_0xc463('0x16')](respondWithResult(_0x48e4db,null))[_0xc463('0x20')](APIHandleError(_0x48e4db));};exports['getTeams']=function(_0x59db78,_0x49195c){var _0x16cdbd={};var _0x1b23ef={};var _0xa93f34;var _0xa400a8;return db['User'][_0xc463('0x94')]({'where':{'id':_0x59db78[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x49195c,null))[_0xc463('0x16')](function(_0x17dfe6){if(_0x17dfe6){_0xa93f34=_0x17dfe6;_0x1b23ef[_0xc463('0x57')]=_['keys'](db[_0xc463('0x114')][_0xc463('0x3e')]);_0x1b23ef[_0xc463('0x46')]=_[_0xc463('0x58')](_0x59db78[_0xc463('0x46')]);_0x1b23ef[_0xc463('0xcd')]=_['intersection'](_0x1b23ef[_0xc463('0x57')],_0x1b23ef['query']);_0x16cdbd[_0xc463('0x4a')]=_[_0xc463('0xca')](_0x1b23ef['model'],qs[_0xc463('0x5a')](_0x59db78[_0xc463('0x46')]['fields']));_0x16cdbd['attributes']=_0x16cdbd[_0xc463('0x4a')][_0xc463('0x4d')]?_0x16cdbd[_0xc463('0x4a')]:_0x1b23ef['model'];_0x16cdbd[_0xc463('0xcb')]=qs[_0xc463('0xcc')](_0x59db78['query'][_0xc463('0xcc')]);_0x16cdbd[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x59db78[_0xc463('0x46')],_0x1b23ef[_0xc463('0xcd')]));if(_0x59db78[_0xc463('0x46')][_0xc463('0x35')]){_0x16cdbd[_0xc463('0x43')]=_['merge'](_0x16cdbd[_0xc463('0x43')],{'$or':_[_0xc463('0x36')](_0x16cdbd[_0xc463('0x4a')],function(_0x1b02ef){var _0x1422dd={};_0x1422dd[_0x1b02ef]={'$like':'%'+_0x59db78['query'][_0xc463('0x35')]+'%'};return _0x1422dd;})});}_0x16cdbd=_[_0xc463('0x5b')]({},_0x16cdbd,_0x59db78[_0xc463('0x5c')]);return _0xa93f34[_0xc463('0x115')](_0x16cdbd);}})[_0xc463('0x16')](function(_0x39f2f7){if(_0x39f2f7){_0xa400a8=_0x39f2f7[_0xc463('0x4d')];if(!_0x59db78[_0xc463('0x46')][_0xc463('0xce')](_0xc463('0xd4'))){_0x16cdbd[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x59db78[_0xc463('0x46')][_0xc463('0x26')]);_0x16cdbd['offset']=qs[_0xc463('0x24')](_0x59db78[_0xc463('0x46')][_0xc463('0x24')]);}return _0xa93f34[_0xc463('0x115')](_0x16cdbd);}})[_0xc463('0x16')](function(_0x856932){if(_0x856932){return _0x856932?{'count':_0xa400a8,'rows':_0x856932}:null;}})[_0xc463('0x16')](respondWithResult(_0x49195c,null))[_0xc463('0x20')](handleError(_0x49195c,null));};exports[_0xc463('0x116')]=function(_0x7f6118,_0x3bbf6f){var _0x320db8=_0x7f6118['params']['id'];var _0x5371a5=_0x7f6118[_0xc463('0x60')]?_0x7f6118[_0xc463('0x60')][_0xc463('0x63')]:null;var _0x42a250=[];return Promise['resolve']()['then'](function(){if(!_0x5371a5)throw new APIBadRequestError(_0xc463('0x117'));})[_0xc463('0x16')](function(){return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x320db8}});})['then'](function(_0x3e598b){if(!_0x3e598b)throw new APINotFoundError(util['format'](_0xc463('0x113'),_0x7f6118[_0xc463('0x56')]['id']));return db[_0xc463('0x118')][_0xc463('0x119')](function(_0x46a5ad){return _0x3e598b[_0xc463('0x116')](_0x5371a5,{'transaction':_0x46a5ad})['then'](function(){return db[_0xc463('0x114')][_0xc463('0x89')]({'where':{'id':{'$in':_0x5371a5}}});})[_0xc463('0x16')](function(_0x1a4957){var _0x4bc0d3=_[_0xc463('0x36')](_0x1a4957,function(_0x16eace){return _0x16eace[_0xc463('0x11a')]();});return Promise[_0xc463('0x54')](_0x4bc0d3);})[_0xc463('0x16')](function(_0x5e6089){_0x42a250=_[_0xc463('0x11b')](_0x5e6089);var _0x1f275e=_['map'](_0x42a250,function(_0xa988cc){return _0xa988cc['addAgent'](_0x3e598b['id'],{'transaction':_0x46a5ad});});return Promise[_0xc463('0x54')](_0x1f275e);})[_0xc463('0x16')](function(){if(!_0x3e598b[_0xc463('0x9d')])return;var _0x267faa=_[_0xc463('0x35')](_0x42a250,function(_0x2facaf){return _0x2facaf[_0xc463('0x11c')](_0xc463('0x9c'))===_0xc463('0x11d');});var _0x39b996=_['map'](_0x267faa,function(_0xbbe869){return db[_0xc463('0xae')]['upsert']({'membername':_0x3e598b[_0xc463('0x39')],'UserId':_0x3e598b['id'],'queue_name':_0xbbe869[_0xc463('0x39')],'VoiceQueueId':_0xbbe869['id'],'interface':_['isNil'](_0x3e598b[_0xc463('0x9f')])?util[_0xc463('0xf0')](_0xc463('0xad'),_0x3e598b[_0xc463('0x39')]):_0x3e598b['interface'],'paused':_0x3e598b['voicePause']||![],'penalty':_0x3e598b[_0xc463('0xa5')]},{'transaction':_0x46a5ad});});return Promise['all'](_0x39b996);})[_0xc463('0x16')](function(){return db[_0xc463('0x11e')][_0xc463('0x89')]({'where':{'teamId':{'$in':_0x5371a5}}});})[_0xc463('0x16')](function(_0x136856){var _0x532138=_[_0xc463('0x36')](_0x136856,function(_0x6d0e84){return db[_0xc463('0x11f')][_0xc463('0x7f')]({'UserId':_0x3e598b['id'],'VoicePrefixId':_0x6d0e84[_0xc463('0x120')]},{'transaction':_0x46a5ad});});return Promise[_0xc463('0x54')](_0x532138);});});})[_0xc463('0x16')](function(){for(var _0x48da41=0x0;_0x48da41<_0x42a250[_0xc463('0x4d')];_0x48da41++){var _0x22e276=_0x42a250[_0x48da41]['getDataValue'](_0xc463('0x9c'));var _0x6359d3=_0x22e276+_0xc463('0xa8');socket[_0xc463('0xa9')](_0xc463('0x31')+_0x22e276+_0xc463('0xaa'),{'UserId':_0x320db8,['queueField']:_0x42a250[_0x48da41]['id']});}})[_0xc463('0x16')](respondWithStatusCode(_0x3bbf6f,null))[_0xc463('0x20')](APIHandleError(_0x3bbf6f));};exports[_0xc463('0x121')]=function(_0x250b4d,_0x20a341){var _0x235a8b=_0x250b4d[_0xc463('0x56')]['id'];var _0x348497=null;if(_0x250b4d[_0xc463('0x46')][_0xc463('0x63')]){_0x348497=_[_0xc463('0xb2')](_0x250b4d[_0xc463('0x46')][_0xc463('0x63')])?_0x250b4d[_0xc463('0x46')][_0xc463('0x63')]:[_0x250b4d['query'][_0xc463('0x63')]];}var _0x735fc2=[];return Promise[_0xc463('0x104')]()[_0xc463('0x16')](function(){if(!_0x348497)throw new APIBadRequestError(_0xc463('0x122'));})[_0xc463('0x16')](function(){return db['User']['findOne']({'where':{'id':_0x235a8b}});})[_0xc463('0x16')](function(_0x4f7018){if(!_0x4f7018)throw new APINotFoundError(util[_0xc463('0xf0')](_0xc463('0x113'),_0x250b4d['params']['id']));return db[_0xc463('0x118')][_0xc463('0x119')](function(_0x5ce4ef){return _0x4f7018[_0xc463('0x121')](_0x348497,{'transaction':_0x5ce4ef})[_0xc463('0x16')](function(){return db[_0xc463('0x114')][_0xc463('0x89')]({'where':{'id':{'$in':_0x348497}}});})[_0xc463('0x16')](function(_0x3658a7){var _0x8ffad4=_[_0xc463('0x36')](_0x3658a7,function(_0x16528d){return _0x16528d['getAssociatedQueues']();});return Promise['all'](_0x8ffad4);})[_0xc463('0x16')](function(_0x2cc011){_0x735fc2=_[_0xc463('0x11b')](_0x2cc011);var _0x41ed65=_['map'](_0x735fc2,function(_0x9434a9){return _0x9434a9[_0xc463('0x123')](_0x4f7018['id'],{'transaction':_0x5ce4ef});});return Promise[_0xc463('0x54')](_0x41ed65);})[_0xc463('0x16')](function(){if(!_0x4f7018[_0xc463('0x9d')])return;var _0x2912e5=_['filter'](_0x735fc2,function(_0x45b835){return _0x45b835['getDataValue'](_0xc463('0x9c'))===_0xc463('0x11d');});var _0x49c1bc=_['map'](_0x2912e5,function(_0x2c1850){return db[_0xc463('0xae')][_0xc463('0xb4')]({'where':{'VoiceQueueId':_0x2c1850['id'],'UserId':_0x4f7018['id']},'transaction':_0x5ce4ef});});return Promise['all'](_0x49c1bc);})[_0xc463('0x16')](function(){return db['TeamVoicePrefix'][_0xc463('0x89')]({'where':{'teamId':{'$in':_0x348497}}});})[_0xc463('0x16')](function(_0x339274){var _0x3a8350=_[_0xc463('0x36')](_0x339274,function(_0x31107c){return db[_0xc463('0x11f')][_0xc463('0xb4')]({'where':{'UserId':_0x4f7018['id'],'VoicePrefixId':_0x31107c[_0xc463('0x120')]}},{'transaction':_0x5ce4ef});});return Promise['all'](_0x3a8350);});});})['then'](function(){for(var _0x155f8b=0x0;_0x155f8b<_0x735fc2[_0xc463('0x4d')];_0x155f8b++){var _0x19c160=_0x735fc2[_0x155f8b][_0xc463('0x11c')]('channel');var _0x5dff26=_0x19c160+'QueueId';socket[_0xc463('0xa9')](_0xc463('0x31')+_0x19c160+_0xc463('0xb3'),{'UserId':_0x235a8b,['queueField']:_0x735fc2[_0x155f8b]['id']});}})['then'](respondWithStatusCode(_0x20a341,null))['catch'](APIHandleError(_0x20a341));};exports['getLists']=function(_0x321aca,_0x2bb0b0){var _0x446c70={};var _0x16c144={};var _0x3d0219;var _0x952592;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x321aca['params']['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x2bb0b0,null))[_0xc463('0x16')](function(_0x4553a2){if(_0x4553a2){_0x3d0219=_0x4553a2;_0x16c144[_0xc463('0x57')]=_[_0xc463('0x58')](db[_0xc463('0xcf')][_0xc463('0x3e')]);_0x16c144[_0xc463('0x46')]=_[_0xc463('0x58')](_0x321aca[_0xc463('0x46')]);_0x16c144['filters']=_[_0xc463('0xca')](_0x16c144[_0xc463('0x57')],_0x16c144[_0xc463('0x46')]);_0x446c70['attributes']=_[_0xc463('0xca')](_0x16c144['model'],qs[_0xc463('0x5a')](_0x321aca[_0xc463('0x46')]['fields']));_0x446c70['attributes']=_0x446c70[_0xc463('0x4a')][_0xc463('0x4d')]?_0x446c70[_0xc463('0x4a')]:_0x16c144[_0xc463('0x57')];_0x446c70[_0xc463('0xcb')]=qs['sort'](_0x321aca[_0xc463('0x46')][_0xc463('0xcc')]);_0x446c70[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x321aca[_0xc463('0x46')],_0x16c144[_0xc463('0xcd')]));if(_0x321aca['query'][_0xc463('0x35')]){_0x446c70['where']=_[_0xc463('0x5b')](_0x446c70[_0xc463('0x43')],{'$or':_['map'](_0x446c70['attributes'],function(_0x4f1454){var _0x38fafd={};_0x38fafd[_0x4f1454]={'$like':'%'+_0x321aca[_0xc463('0x46')][_0xc463('0x35')]+'%'};return _0x38fafd;})});}_0x446c70=_[_0xc463('0x5b')]({},_0x446c70,_0x321aca[_0xc463('0x5c')]);return _0x3d0219[_0xc463('0x124')](_0x446c70);}})[_0xc463('0x16')](function(_0x352de1){if(_0x352de1){_0x952592=_0x352de1[_0xc463('0x4d')];if(!_0x321aca[_0xc463('0x46')]['hasOwnProperty'](_0xc463('0xd4'))){_0x446c70[_0xc463('0x26')]=qs[_0xc463('0x26')](_0x321aca[_0xc463('0x46')][_0xc463('0x26')]);_0x446c70['offset']=qs[_0xc463('0x24')](_0x321aca[_0xc463('0x46')][_0xc463('0x24')]);}return _0x3d0219['getLists'](_0x446c70);}})[_0xc463('0x16')](function(_0x3b427b){if(_0x3b427b){return _0x3b427b?{'count':_0x952592,'rows':_0x3b427b}:null;}})['then'](respondWithResult(_0x2bb0b0,null))[_0xc463('0x20')](handleError(_0x2bb0b0,null));};exports[_0xc463('0x125')]=function(_0x1f83e8,_0x24de0f){var _0x1bf4e2={};var _0x3e70ed={};var _0x2f178d;return db[_0xc463('0x3d')][_0xc463('0x94')]({'where':{'id':_0x1f83e8[_0xc463('0x56')]['id']}})[_0xc463('0x16')](handleEntityNotFound(_0x24de0f,null))['then'](function(_0x1d53c4){if(_0x1d53c4){_0x2f178d=_0x1d53c4;_0x3e70ed[_0xc463('0x57')]=_['keys'](db['User'][_0xc463('0x3e')]);_0x3e70ed[_0xc463('0x46')]=_[_0xc463('0x58')](_0x1f83e8[_0xc463('0x46')]);_0x3e70ed[_0xc463('0xcd')]=_[_0xc463('0xca')](_0x3e70ed[_0xc463('0x57')],_0x3e70ed[_0xc463('0x46')]);_0x1bf4e2['attributes']=_[_0xc463('0xca')](_0x3e70ed[_0xc463('0x57')],qs[_0xc463('0x5a')](_0x1f83e8[_0xc463('0x46')][_0xc463('0x5a')]));_0x1bf4e2['attributes']=_0x1bf4e2[_0xc463('0x4a')]['length']?_0x1bf4e2['attributes']:_0x3e70ed[_0xc463('0x57')];_0x1bf4e2['order']=qs[_0xc463('0xcc')](_0x1f83e8[_0xc463('0x46')][_0xc463('0xcc')]);_0x1bf4e2[_0xc463('0x43')]=qs[_0xc463('0xcd')](_[_0xc463('0xdb')](_0x1f83e8[_0xc463('0x46')],_0x3e70ed[_0xc463('0xcd')]));if(_0x1f83e8[_0xc463('0x46')][_0xc463('0x35')]){_0x1bf4e2[_0xc463('0x43')]=_[_0xc463('0x5b')](_0x1bf4e2[_0xc463('0x43')],{'$or':_[_0xc463('0x36')](_0x1bf4e2[_0xc463('0x4a')],function(_0x4d51ac){var _0x357056={};_0x357056[_0x4d51ac]={'$like':'%'+_0x1f83e8['query']['filter']+'%'};return _0x357056;})});}_0x1bf4e2[_0xc463('0x57')]=db[_0xc463('0x3d')];_0x1bf4e2['as']=_0xc463('0x32');_0x1bf4e2=_['merge']({},_0x1bf4e2,_0x1f83e8[_0xc463('0x5c')]);return _0x2f178d[_0xc463('0xfb')]({'include':[_0x1bf4e2]});}})['then'](function(_0x198fd0){if(_0x198fd0){var _0x54bde7={},_0x33f171=[];for(var _0x4a980c=0x0;_0x4a980c<_0x198fd0[_0xc463('0x4d')];_0x4a980c+=0x1){for(var _0x5cec0c=0x0,_0x2fcf7a;_0x5cec0c<_0x198fd0[_0x4a980c][_0xc463('0x32')][_0xc463('0x4d')];_0x5cec0c+=0x1){_0x2fcf7a=_0x198fd0[_0x4a980c]['Agents'][_0x5cec0c][_0xc463('0xac')]({'plain':!![]});_0x54bde7[_0x2fcf7a['id']]=_0x2fcf7a;}}_0x54bde7=_[_0xc463('0x126')](_0x54bde7);for(var _0x17413a=qs[_0xc463('0x24')](_0x1f83e8['query'][_0xc463('0x24')]);_0x17413a<_0x54bde7[_0xc463('0x4d')]&&_0x33f171[_0xc463('0x4d')]=_0x51c62c){_0x4e37c8=_0x51c62c;_0x1ac5b0=0xc8;}else{_0x1ac5b0=0xce;}_0x5f0029[_0x2c23('0x23')](_0x1ac5b0);return _0x5f0029[_0x2c23('0x2a')](_0x2c23('0x2b'),_0xd79fee+'-'+_0x4e37c8+'/'+_0x51c62c)[_0x2c23('0x25')](_0x406e01);}return null;};}function saveUpdates(_0x4d9d6d){return function(_0x34aa7d){if(_0x34aa7d){return _0x34aa7d['update'](_0x4d9d6d)[_0x2c23('0x19')](function(_0x1ca026){if(_0x1ca026[_0x2c23('0x2c')]==='agent'){socket['emit'](_0x2c23('0x2d')+_0x1ca026['id'],_0x1ca026);}return _0x1ca026;});}return null;};}function removeEntity(_0x226a57){return function(_0x5b21c0){if(_0x5b21c0){return _0x5b21c0[_0x2c23('0x2e')]()[_0x2c23('0x19')](function(){var _0x53fd05=_0x5b21c0[_0x2c23('0x2f')]({'plain':!![]});if(_0x53fd05[_0x2c23('0x2c')]===_0x2c23('0x30'))return;var _0x2c356f=[{'name':_0x2c23('0x31'),'value':_0x2c23('0x32'),'ignore':!![]},{'name':_0x2c23('0x33'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x2c23('0x34'),'ignore':![]}];var _0x3f161a=_(_0x2c356f)[_0x2c23('0x35')](_0x2c23('0x36'))[_0x2c23('0x37')](_0x2c23('0x38'))['value']();if(_[_0x2c23('0x39')](_0x3f161a,_0x53fd05[_0x2c23('0x2c')])){return;}var _0x55a0f6=_[_0x2c23('0x3a')](_0x2c356f,[_0x2c23('0x38'),_0x53fd05[_0x2c23('0x2c')]])[_0x2c23('0x3b')];return db[_0x2c23('0x3c')][_0x2c23('0x2e')]({'where':{'type':_0x55a0f6,'resourceId':_0x53fd05['id']}})[_0x2c23('0x19')](function(){return _0x5b21c0;});})[_0x2c23('0x19')](function(){_0x226a57[_0x2c23('0x23')](0xcc)[_0x2c23('0x24')]();});}};}function handleEntityNotFound(_0x95d341){return function(_0x26bdc7){if(!_0x26bdc7){_0x95d341[_0x2c23('0x22')](0x194);}return _0x26bdc7;};}function handleError(_0x43c60c,_0x4c6c04){_0x4c6c04=_0x4c6c04||0x1f4;return function(_0x54c6d1){logger[_0x2c23('0x1f')](_0x54c6d1[_0x2c23('0x3d')]);if(_0x54c6d1[_0x2c23('0x3b')]){delete _0x54c6d1[_0x2c23('0x3b')];}_0x43c60c[_0x2c23('0x23')](_0x4c6c04)[_0x2c23('0x3e')](_0x54c6d1);};}exports[_0x2c23('0x3f')]=function(_0x420f3a,_0x3c91c5){var _0x3e2645={},_0x14d227={'count':0x0,'rows':[]};var _0x4c907d=_(db['User'][_0x2c23('0x40')])[_0x2c23('0x37')](function(_0x406256){return{'name':_0x406256[_0x2c23('0x41')],'type':_0x406256[_0x2c23('0x42')]['key']};})[_0x2c23('0x35')](function(_0x1e9fc0){return!_[_0x2c23('0x39')]([_0x2c23('0x43'),_0x2c23('0x44')],_0x1e9fc0[_0x2c23('0x3b')]);})[_0x2c23('0x38')]();_0x3e2645=qs[_0x2c23('0x45')](_0x4c907d,_0x420f3a);var _0x1d6ded={'where':_0x3e2645['where']};return db[_0x2c23('0x46')][_0x2c23('0x29')](_0x1d6ded)[_0x2c23('0x19')](function(_0x43aaa3){_0x14d227[_0x2c23('0x29')]=_0x43aaa3;if(_0x420f3a['query'][_0x2c23('0x47')]){_0x3e2645['include']=[{'all':!![]}];}if(_0x420f3a[_0x2c23('0x48')][_0x2c23('0x49')]===_0x2c23('0x4a')){_0x3e2645[_0x2c23('0x4b')]=[{'model':db['UserSetting'],'as':_0x2c23('0x49')}];}if(!_[_0x2c23('0x39')](_0x3e2645[_0x2c23('0x4c')],'id')){_0x3e2645['attributes'][_0x2c23('0x4d')]('id');}return db['User'][_0x2c23('0x4e')](_0x3e2645);})[_0x2c23('0x19')](function(_0x4d70f0){_0x14d227[_0x2c23('0x4f')]=_0x4d70f0;if(_0x420f3a['query'][_0x2c23('0x50')]===_0x2c23('0x4a')){var _0x391677=[];for(var _0x41bee0=0x0;_0x41bee0<_0x14d227['rows'][_0x2c23('0x51')];_0x41bee0++){_0x391677[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x52'),_0x14d227['rows'][_0x41bee0][_0x2c23('0x53')]));_0x391677['push'](get_open_tabs(_0x2c23('0x54'),_0x14d227[_0x2c23('0x4f')][_0x41bee0][_0x2c23('0x53')]));_0x391677[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x55'),_0x14d227[_0x2c23('0x4f')][_0x41bee0]['dataValues']));_0x391677['push'](get_open_tabs('mail',_0x14d227['rows'][_0x41bee0]['dataValues']));_0x391677[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x56'),_0x14d227[_0x2c23('0x4f')][_0x41bee0][_0x2c23('0x53')]));_0x391677['push'](get_open_tabs(_0x2c23('0x57'),_0x14d227['rows'][_0x41bee0][_0x2c23('0x53')]));}return Promise[_0x2c23('0x58')](_0x391677)[_0x2c23('0x19')](function(){return _0x14d227;});}else{return _0x14d227;}})[_0x2c23('0x19')](respondWithFilteredResult(_0x3c91c5,_0x3e2645))[_0x2c23('0x59')](handleError(_0x3c91c5,null));};exports[_0x2c23('0x5a')]=function(_0x3279c5,_0x4f8d8e){var _0xf589be={'raw':![],'where':{'id':_0x3279c5[_0x2c23('0x5b')]['id']}},_0x4d8c55={};_0x4d8c55[_0x2c23('0x5c')]=_[_0x2c23('0x5d')](_[_0x2c23('0x5e')](db[_0x2c23('0x46')][_0x2c23('0x40')]),['password',_0x2c23('0x44')]);_0x4d8c55[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x3279c5[_0x2c23('0x48')]);_0x4d8c55[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x4d8c55[_0x2c23('0x5c')],_0x4d8c55['query']);_0xf589be[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x4d8c55[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x3279c5['query'][_0x2c23('0x61')]));_0xf589be[_0x2c23('0x4c')]=_0xf589be['attributes'][_0x2c23('0x51')]?_0xf589be[_0x2c23('0x4c')]:_0x4d8c55[_0x2c23('0x5c')];if(_0x3279c5[_0x2c23('0x48')][_0x2c23('0x47')]){_0xf589be['include']=[{'all':!![]}];}if(_0x3279c5['query'][_0x2c23('0x49')]===_0x2c23('0x4a')){_0xf589be[_0x2c23('0x4b')]=[{'model':db[_0x2c23('0x62')],'as':'userSetting'}];}_0xf589be=_[_0x2c23('0x63')]({},_0xf589be,_0x3279c5[_0x2c23('0x64')]);if(!_[_0x2c23('0x39')](_0xf589be[_0x2c23('0x4c')],'id')){_0xf589be[_0x2c23('0x4c')][_0x2c23('0x4d')]('id');}return db[_0x2c23('0x46')][_0x2c23('0x3a')](_0xf589be)[_0x2c23('0x19')](handleEntityNotFound(_0x4f8d8e,null))[_0x2c23('0x19')](function(_0x4598f7){var _0x4749aa=[];values=_0x4598f7;if(_0x3279c5[_0x2c23('0x48')][_0x2c23('0x50')]===_0x2c23('0x4a')){_0x4749aa[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x52'),_0x4598f7[_0x2c23('0x53')]));_0x4749aa[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x54'),_0x4598f7[_0x2c23('0x53')]));_0x4749aa[_0x2c23('0x4d')](get_open_tabs('openchannel',_0x4598f7[_0x2c23('0x53')]));_0x4749aa['push'](get_open_tabs('whatsapp',_0x4598f7['dataValues']));_0x4749aa[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x55'),_0x4598f7['dataValues']));_0x4749aa[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x65'),_0x4598f7[_0x2c23('0x53')]));return Promise[_0x2c23('0x58')](_0x4749aa);}else{return values;}})['then'](function(){return values;})[_0x2c23('0x19')](respondWithResult(_0x4f8d8e,null))['catch'](handleError(_0x4f8d8e,null));};exports['update']=function(_0x27dbcc,_0x4cee4b){if(_0x27dbcc['body']['id']){delete _0x27dbcc[_0x2c23('0x66')]['id'];}delete _0x27dbcc[_0x2c23('0x66')][_0x2c23('0x2c')];return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x27dbcc[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x4cee4b,null))[_0x2c23('0x19')](saveUpdates(_0x27dbcc[_0x2c23('0x66')],null))[_0x2c23('0x19')](respondWithResult(_0x4cee4b,null))[_0x2c23('0x59')](handleError(_0x4cee4b,null));};exports['describe']=function(_0x5e8235,_0x327640){return db[_0x2c23('0x46')][_0x2c23('0x67')]()[_0x2c23('0x19')](respondWithResult(_0x327640,null))[_0x2c23('0x59')](handleError(_0x327640,null));};exports[_0x2c23('0x68')]=function(_0x35f652,_0x1c4c3c){return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x35f652['params']['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x1c4c3c,null))[_0x2c23('0x19')](function(_0x403c14){if(_0x403c14){return _0x403c14[_0x2c23('0x68')](_0x35f652['body']['ids'],_[_0x2c23('0x69')](_0x35f652[_0x2c23('0x66')],[_0x2c23('0x6a'),'id'])||{});}})[_0x2c23('0x19')](respondWithResult(_0x1c4c3c,null))[_0x2c23('0x59')](handleError(_0x1c4c3c,null));};function validateUser(_0x24e4f6){return new Promise(function(_0x11e210,_0x445db0){if(_0x24e4f6['internal'])return _0x11e210(_0x24e4f6);return db[_0x2c23('0x6b')]['findById'](0x1)[_0x2c23('0x19')](function(_0x344177){if(_0x344177[_0x2c23('0x6c')])authService[_0x2c23('0x6d')](_0x24e4f6['password']);db[_0x2c23('0x46')][_0x2c23('0x6e')](_0x2c23('0x6f'))[_0x2c23('0x19')](function(_0x161fbf){if(_[_0x2c23('0x70')](_0x161fbf)){_0x24e4f6['internal']=_0x344177[_0x2c23('0x71')]||0x1;return;}if(_[_0x2c23('0x70')](_0x344177[_0x2c23('0x71')])||_0x344177[_0x2c23('0x71')]===_0x161fbf){_0x24e4f6[_0x2c23('0x6f')]=_0x161fbf+0x1;return;}if(_0x344177[_0x2c23('0x71')]>_0x161fbf){_0x24e4f6[_0x2c23('0x6f')]=_0x344177['min_internal'];return;}return db['sequelize'][_0x2c23('0x48')](_0x2c23('0x72'),{'type':db[_0x2c23('0x73')][_0x2c23('0x74')][_0x2c23('0x75')]})[_0x2c23('0x19')](function(_0x4def4d){if(_0x4def4d&&_0x4def4d[_0x2c23('0x51')]){for(var _0x1fd6f7=0x0,_0x11a3fb=_0x4def4d[_0x2c23('0x51')];_0x1fd6f7<_0x11a3fb&&_[_0x2c23('0x70')](_0x24e4f6[_0x2c23('0x6f')]);_0x1fd6f7++){if(_0x344177['min_internal']<=_0x4def4d[_0x1fd6f7][_0x2c23('0x76')]){_0x24e4f6['internal']=_0x4def4d[_0x1fd6f7][_0x2c23('0x76')];}else if(_0x344177[_0x2c23('0x71')]>_0x4def4d[_0x1fd6f7]['from']&&_0x344177[_0x2c23('0x71')]<=_0x4def4d[_0x1fd6f7]['to']){_0x24e4f6['internal']=_0x344177[_0x2c23('0x71')];}}}if(_[_0x2c23('0x70')](_0x24e4f6[_0x2c23('0x6f')])){_0x24e4f6[_0x2c23('0x6f')]=_0x161fbf+0x1;}return _0x11e210(_0x24e4f6);});});})['catch'](function(_0x27379e){_0x445db0(_0x27379e);});});}function updateUser(_0x1ef03f){return new Promise(function(_0x352190,_0x157813){try{if(_0x1ef03f[_0x2c23('0x77')]){_0x1ef03f[_0x2c23('0x78')]=_0x1ef03f[_0x2c23('0x6f')];_0x1ef03f['VoiceMail']={'mailbox':_0x1ef03f[_0x2c23('0x6f')],'password':_0x1ef03f[_0x2c23('0x43')],'fullname':_0x1ef03f[_0x2c23('0x79')],'email':_0x1ef03f[_0x2c23('0x7a')]};}if(_0x1ef03f[_0x2c23('0x2c')]==='agent'){if(!_0x1ef03f['permissions'])_0x1ef03f['permissions']=[_0x2c23('0x7b'),_0x2c23('0x7c'),_0x2c23('0x7d'),'113',_0x2c23('0x7e'),'104',_0x2c23('0x7f'),'106',_0x2c23('0x80'),_0x2c23('0x81'),_0x2c23('0x82'),_0x2c23('0x83'),_0x2c23('0x84'),'114','115'];}_0x352190(_0x1ef03f);}catch(_0x4ab0b2){_0x157813(_0x4ab0b2);}});}exports[_0x2c23('0x85')]=function(_0xaa555c,_0x5b281b){if(_0xaa555c[_0x2c23('0x32')][_0x2c23('0x2c')]===_0x2c23('0x86'))throw new Error(_0x2c23('0x87'));if(_0xaa555c[_0x2c23('0x66')][_0x2c23('0x2c')]===_0x2c23('0x32')&&_0xaa555c['user'][_0x2c23('0x2c')]!==_0x2c23('0x30')){throw new Error(_0x2c23('0x88'));}if(_0xaa555c[_0x2c23('0x66')][_0x2c23('0x2c')]===_0x2c23('0x30')&&_0xaa555c[_0x2c23('0x32')][_0x2c23('0x2c')]!=='admin'){throw new Error(_0x2c23('0x89'));}return licenseUtil['checkUserLimits']([_0xaa555c[_0x2c23('0x66')]])[_0x2c23('0x19')](function(){return validateUser(_0xaa555c['body']);})['then'](function(_0x192335){return updateUser(_0x192335)[_0x2c23('0x19')](function(_0x37ba59){if(_0x37ba59[_0x2c23('0x2c')]===_0x2c23('0x30')){_0x37ba59['settingsEnabled']=_0xaa555c['user'][_0x2c23('0x8a')];delete _0x37ba59[_0x2c23('0x8b')];}return _0x37ba59;});})['then'](function(_0x34401d){return db[_0x2c23('0x46')]['create'](_0x34401d,{'include':[{'model':db[_0x2c23('0x8c')],'as':_0x2c23('0x8c')}]});})['then'](function(_0x2f9755){if(_0xaa555c['body']['role']==='user')return _0x2f9755;if(_0xaa555c['user'][_0x2c23('0x2c')]!==_0x2c23('0x32'))return _0x2f9755;return db[_0x2c23('0x8d')][_0x2c23('0x3a')]({'where':{'name':_0x2f9755[_0x2c23('0x2c')]===_0x2c23('0x86')?_0x2c23('0x33'):_0x2c23('0x8e'),'userProfileId':_0xaa555c[_0x2c23('0x32')][_0x2c23('0x8b')]},'raw':!![]})['then'](function(_0x5c859b){if(!_0x5c859b||_0x5c859b[_0x2c23('0x8f')]!=0x0)return _0x2f9755;return db[_0x2c23('0x3c')][_0x2c23('0x85')]({'name':_0x2f9755[_0x2c23('0x3b')],'resourceId':_0x2f9755['id'],'type':_0x5c859b[_0x2c23('0x3b')],'sectionId':_0x5c859b['id']},{})[_0x2c23('0x19')](function(){return _0x2f9755;});})[_0x2c23('0x59')](function(_0x379277){logger[_0x2c23('0x1f')](_0x2c23('0x90'),_0x379277);throw _0x379277;});})[_0x2c23('0x19')](respondWithResult(_0x5b281b,0xc9))[_0x2c23('0x59')](handleError(_0x5b281b,null));};exports[_0x2c23('0x91')]=function(_0x2ba0c6,_0x588f28){var _0x4516af=_0x2ba0c6[_0x2c23('0x66')];var _0x24bc6b=[];if(_0x2ba0c6[_0x2c23('0x32')]['role']===_0x2c23('0x86'))throw new Error(_0x2c23('0x87'));if(_[_0x2c23('0x92')](_0x4516af,[_0x2c23('0x2c'),_0x2c23('0x32')])&&_0x2ba0c6[_0x2c23('0x32')][_0x2c23('0x2c')]!==_0x2c23('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2c23('0x92')](_0x4516af,[_0x2c23('0x2c'),'admin'])&&_0x2ba0c6[_0x2c23('0x32')][_0x2c23('0x2c')]!==_0x2c23('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x2c23('0x93')](_0x4516af)[_0x2c23('0x19')](function(){return validateUser(_0x4516af[0x0]);})[_0x2c23('0x19')](function(){for(var _0xd830a2=0x1;_0xd830a2<_0x4516af['length'];_0xd830a2++){var _0x34e0e4=_0x4516af[_0xd830a2-0x1][_0x2c23('0x6f')];if(!_0x4516af[_0xd830a2][_0x2c23('0x6f')])_0x4516af[_0xd830a2][_0x2c23('0x6f')]=_0x34e0e4+0x1;_0x24bc6b[_0x2c23('0x4d')](validateUser(_0x4516af[_0xd830a2]));}return Promise[_0x2c23('0x58')](_0x24bc6b);})[_0x2c23('0x19')](function(){_0x24bc6b=[];for(var _0x4e5113=0x0;_0x4e5113<_0x4516af[_0x2c23('0x51')];_0x4e5113++){_0x24bc6b[_0x2c23('0x4d')](updateUser(_0x4516af[_0x4e5113]));}return Promise[_0x2c23('0x58')](_0x24bc6b);})[_0x2c23('0x19')](function(){_0x24bc6b=_0x4516af[_0x2c23('0x37')](function(_0x542e7){return db[_0x2c23('0x46')]['create'](_0x542e7,{'include':[{'model':db['VoiceMail'],'as':_0x2c23('0x8c')}]})['then'](function(_0xe01b14){_0x542e7['id']=_0xe01b14['id'];return _0x542e7;});});return Promise[_0x2c23('0x58')](_0x24bc6b);})[_0x2c23('0x19')](function(_0x578f88){if(_0x2ba0c6[_0x2c23('0x66')]['role']===_0x2c23('0x32'))return _0x578f88;if(_0x2ba0c6['user']['role']!==_0x2c23('0x32'))return _0x578f88;var _0x35abd1=_[_0x2c23('0x92')](_0x578f88,function(_0x2f6a7f){return _0x2f6a7f['role']===_0x2c23('0x86')||_0x2f6a7f[_0x2c23('0x2c')]===_0x2c23('0x34');});if(!_0x35abd1)return _0x578f88;return db[_0x2c23('0x8d')][_0x2c23('0x4e')]({'where':{'name':{'$or':[_0x2c23('0x33'),_0x2c23('0x8e')]},'userProfileId':_0x2ba0c6[_0x2c23('0x32')][_0x2c23('0x8b')]},'raw':!![]})[_0x2c23('0x19')](function(_0x488b85){if(_[_0x2c23('0x94')](_0x488b85)||!_[_0x2c23('0x92')](_0x488b85,[_0x2c23('0x8f'),0x0]))return _0x578f88;_0x24bc6b=[];var _0x5156cd=_(_0x488b85)[_0x2c23('0x37')](function(_0x5c8626){if(_0x5c8626[_0x2c23('0x8f')]===0x1)return;return _0x5c8626[_0x2c23('0x3b')]===_0x2c23('0x33')?_0x2c23('0x86'):_0x2c23('0x34');})['compact']()[_0x2c23('0x38')]();for(var _0x1abc3a=0x0;_0x1abc3a<_0x578f88[_0x2c23('0x51')];_0x1abc3a++){if(!_['includes'](_0x5156cd,_0x578f88[_0x1abc3a][_0x2c23('0x2c')]))return;var _0x296f8a=_0x578f88[_0x1abc3a][_0x2c23('0x2c')]===_0x2c23('0x86')?_0x2c23('0x33'):_0x2c23('0x8e');_0x24bc6b[_0x2c23('0x4d')](db[_0x2c23('0x3c')][_0x2c23('0x85')]({'name':_0x578f88[_0x1abc3a][_0x2c23('0x3b')],'resourceId':_0x578f88[_0x1abc3a]['id'],'type':_0x296f8a,'sectionId':_['find'](_0x488b85,[_0x2c23('0x3b'),_0x296f8a])['id']},{}));}return Promise['all'](_0x24bc6b);});})[_0x2c23('0x19')](respondWithResult(_0x588f28,0xc9))[_0x2c23('0x59')](handleError(_0x588f28,null));};exports['changePassword']=function(_0x4b6ae9,_0x5d2c57){if(_0x4b6ae9['body']['id']){delete _0x4b6ae9[_0x2c23('0x66')]['id'];}return db[_0x2c23('0x46')]['find']({'where':{'id':_0x4b6ae9[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](function(_0x3b9206){if(!_0x3b9206)return null;if(_0x3b9206['id']===_0x4b6ae9[_0x2c23('0x32')]['id']){if(!_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x95')]||!_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')]){throw new db['Sequelize'][(_0x2c23('0x97'))](_0x2c23('0x98'));}if(!_0x3b9206[_0x2c23('0x99')](_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x95')])){throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))](_0x2c23('0x9b'));}if(_0x4b6ae9[_0x2c23('0x66')]['oldPassword']===_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')]){throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4b6ae9[_0x2c23('0x32')][_0x2c23('0x2c')]===_0x2c23('0x30')){if(!_0x4b6ae9['body'][_0x2c23('0x96')]){throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))](_0x2c23('0x9c'));}}else if(_0x4b6ae9[_0x2c23('0x32')]['role']===_0x2c23('0x32')){if(!_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')]){throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))](_0x2c23('0x9c'));}if(_0x3b9206[_0x2c23('0x2c')]!==_0x2c23('0x86')){throw new db[(_0x2c23('0x9a'))]['ValidationError'](_0x2c23('0x87'));}}else{throw new db['Sequelize'][(_0x2c23('0x97'))](_0x2c23('0x87'));}return _0x3b9206;})[_0x2c23('0x19')](handleEntityNotFound(_0x5d2c57,null))[_0x2c23('0x19')](function(_0x599f7c){return db[_0x2c23('0x6b')]['findOne']({'attributes':['id',_0x2c23('0x6c'),_0x2c23('0x9d'),_0x2c23('0x9e')]})['then'](function(_0x1bdd05){if(_0x1bdd05[_0x2c23('0x6c')])authService[_0x2c23('0x6d')](_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')]);if(!_0x1bdd05[_0x2c23('0x9d')]||!_0x599f7c['previousPasswords'])return _0x599f7c;authService['validatePasswordHistory'](_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')],_0x599f7c['previousPasswords'],_0x1bdd05[_0x2c23('0x9e')]);return _0x599f7c;})['then'](saveUpdates({'password':_0x4b6ae9['body']['newPassword'],'passwordResetAt':_0x4b6ae9['user']['id']==_0x4b6ae9[_0x2c23('0x5b')]['id']?moment():null,'previousPasswords':authService[_0x2c23('0x9f')](_0x4b6ae9[_0x2c23('0x66')][_0x2c23('0x96')],_0x599f7c['previousPasswords'])},null));})['then'](respondWithResult(_0x5d2c57,null))[_0x2c23('0x59')](handleError(_0x5d2c57,null));};exports['addQueues']=function(_0x361cd4,_0x3646c4){var _0x5e79f2=_0x361cd4[_0x2c23('0x66')][_0x2c23('0xa0')];return db['User'][_0x2c23('0x3a')]({'where':{'id':_0x361cd4[_0x2c23('0x5b')]['id']},'attributes':['id','name',_0x2c23('0x2c'),'online',_0x2c23('0xa1'),'voicePause','interface']})['then'](handleEntityNotFound(_0x3646c4,null))['then'](function(_0x343e72){if(_0x343e72){if(!utils['isValidChannel'](_0x5e79f2)){throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))](_0x2c23('0xa2'));}return _0x343e72[_0x2c23('0xa3')+_[_0x2c23('0xa4')](_0x5e79f2[_0x2c23('0xa5')]())+_0x2c23('0xa6')](_0x361cd4[_0x2c23('0x66')]['ids'],{'penalty':_0x361cd4[_0x2c23('0x66')]['penalty']||0x0})[_0x2c23('0xa7')](function(_0x28acbc){for(var _0x4c6b53=0x0;_0x4c6b53<_0x361cd4['body'][_0x2c23('0x6a')][_0x2c23('0x51')];_0x4c6b53+=0x1){var _0x28c937={'UserId':Number(_0x361cd4[_0x2c23('0x5b')]['id'])};_0x28c937[_[_0x2c23('0xa4')](_0x5e79f2[_0x2c23('0xa5')]())+_0x2c23('0xa8')]=Number(_0x361cd4['body'][_0x2c23('0x6a')][_0x4c6b53]);socket[_0x2c23('0xa9')](_0x2c23('0x32')+_['capitalize'](_0x5e79f2[_0x2c23('0xa5')]())+_0x2c23('0xaa'),_0x28c937);}return _0x28acbc;})[_0x2c23('0x19')](function(){if(_0x5e79f2===_0x2c23('0xab')){return db[_0x2c23('0xac')]['findAll']({'where':{'id':_0x361cd4[_0x2c23('0x66')]['ids']||[]},'raw':!![],'attributes':['id',_0x2c23('0x3b')]});}})[_0x2c23('0x19')](function(_0x4a6e73){var _0x2f9c6d=_0x343e72['get']({'plain':!![]});var _0x207f05=[];if(_0x5e79f2===_0x2c23('0xab')&&_0x2f9c6d['role']===_0x2c23('0x86')&&_0x2f9c6d[_0x2c23('0xad')]){for(let _0x59da8f=0x0;_0x59da8f<_0x4a6e73[_0x2c23('0x51')];_0x59da8f+=0x1){_0x207f05[_0x2c23('0x4d')]({'membername':_0x2f9c6d[_0x2c23('0x3b')],'UserId':_0x2f9c6d['id'],'queue_name':_0x4a6e73[_0x59da8f][_0x2c23('0x3b')],'VoiceQueueId':_0x4a6e73[_0x59da8f]['id'],'interface':_[_0x2c23('0x70')](_0x2f9c6d[_0x2c23('0xae')])?util['format'](_0x2c23('0xaf'),_0x2f9c6d[_0x2c23('0x3b')]):_0x2f9c6d['interface'],'paused':_0x2f9c6d[_0x2c23('0xb0')]||![],'penalty':_0x361cd4[_0x2c23('0x66')][_0x2c23('0xb1')]||0x0});}return Promise['all'](_0x207f05['map'](function(_0x2f8d5a){return db[_0x2c23('0xb2')][_0x2c23('0xb3')](_0x2f8d5a);}));}return _0x343e72;});}})[_0x2c23('0x19')](respondWithStatusCode(_0x3646c4,null))[_0x2c23('0x59')](handleError(_0x3646c4,null));};exports[_0x2c23('0xb4')]=function(_0x4a2b44,_0x338328){var _0x27bde9,_0x2613a0;return db['User'][_0x2c23('0x3a')]({'where':{'id':_0x4a2b44['params']['id']},'attributes':['id',_0x2c23('0x3b'),_0x2c23('0x2c')]})[_0x2c23('0x19')](handleEntityNotFound(_0x338328,null))[_0x2c23('0x19')](function(_0x5f3ae5){if(_0x5f3ae5){_0x27bde9=_0x5f3ae5;if(!_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')]||!utils[_0x2c23('0xb5')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')])){throw new db['Sequelize'][(_0x2c23('0x97'))](_0x2c23('0xa2'));}return _0x5f3ae5[_0x2c23('0xb6')+_[_0x2c23('0xa4')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')]['toLowerCase']())+_0x2c23('0xa6')](_0x4a2b44[_0x2c23('0x48')]['ids']);}})[_0x2c23('0x19')](function(_0x1d93fb){if(_[_0x2c23('0xb7')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0x6a')])){for(var _0x22a88e=0x0;_0x22a88e<_0x4a2b44['query'][_0x2c23('0x6a')][_0x2c23('0x51')];_0x22a88e+=0x1){_0x2613a0={'UserId':Number(_0x4a2b44['params']['id'])};_0x2613a0[_['capitalize'](_0x4a2b44['query'][_0x2c23('0xa0')][_0x2c23('0xa5')]())+_0x2c23('0xa8')]=Number(_0x4a2b44[_0x2c23('0x48')][_0x2c23('0x6a')][_0x22a88e]);socket[_0x2c23('0xa9')](_0x2c23('0x32')+_[_0x2c23('0xa4')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')]['toLowerCase']())+_0x2c23('0xb8'),_0x2613a0);}}else{_0x2613a0={'UserId':Number(_0x4a2b44[_0x2c23('0x5b')]['id'])};_0x2613a0[_[_0x2c23('0xa4')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')]['toLowerCase']())+_0x2c23('0xa8')]=Number(_0x4a2b44[_0x2c23('0x48')][_0x2c23('0x6a')]);socket[_0x2c23('0xa9')]('user'+_[_0x2c23('0xa4')](_0x4a2b44[_0x2c23('0x48')][_0x2c23('0xa0')][_0x2c23('0xa5')]())+_0x2c23('0xb8'),_0x2613a0);}return _0x1d93fb;})[_0x2c23('0x19')](function(){if(_0x4a2b44['query'][_0x2c23('0xa0')]===_0x2c23('0xab')){return db['UserVoiceQueueRt'][_0x2c23('0x2e')]({'where':{'UserId':_0x4a2b44[_0x2c23('0x5b')]['id'],'VoiceQueueId':_0x4a2b44[_0x2c23('0x48')][_0x2c23('0x6a')]},'individualHooks':!![]})[_0x2c23('0x19')](function(){return _0x27bde9;});}return _0x27bde9;})[_0x2c23('0x19')](respondWithStatusCode(_0x338328,null))['catch'](handleError(_0x338328,null));};exports[_0x2c23('0xb9')]=function(_0x1031a8,_0x91e805){_0x1031a8[_0x2c23('0x66')][_0x2c23('0xba')]=_0x1031a8[_0x2c23('0xbb')][_0x2c23('0xbc')];return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x1031a8['params']['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x91e805,null))[_0x2c23('0x19')](saveUpdates(_0x1031a8['body'],null))['then'](respondWithResult(_0x91e805,null))[_0x2c23('0x59')](handleError(_0x91e805,null));};exports[_0x2c23('0xbd')]=function(_0xd50917,_0x15330f){var _0x538353=path[_0x2c23('0xbe')](config[_0x2c23('0xbf')],_0x2c23('0xc0'));return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0xd50917[_0x2c23('0x5b')]['id']},'attributes':['id',_0x2c23('0xba')],'raw':!![]})[_0x2c23('0x19')](handleEntityNotFound(_0x15330f,null))[_0x2c23('0x19')](function(_0x7b0cf1){if(_0x7b0cf1){if(_[_0x2c23('0x70')](_0x7b0cf1[_0x2c23('0xba')])){return _0x15330f[_0x2c23('0xc1')](_0x538353);}else{if(!fs['existsSync'](path['join'](config[_0x2c23('0xbf')],_0x2c23('0xc2'),_0x7b0cf1['userpic']))){return _0x15330f['download'](_0x538353);}return _0x15330f[_0x2c23('0xc1')](path['join'](config['root'],_0x2c23('0xc2'),_0x7b0cf1['userpic']));}}})['catch'](handleError(_0x15330f,null));};exports[_0x2c23('0xc3')]=function(_0x497a2d,_0x48b2fe){return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x497a2d['params']['id']},'attributes':['id']})[_0x2c23('0x19')](handleEntityNotFound(_0x48b2fe,null))[_0x2c23('0x19')](function(_0x453529){var _0x8a6788=[];values=_0x453529[_0x2c23('0x53')];_0x8a6788[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x52'),_0x453529[_0x2c23('0x53')]));_0x8a6788[_0x2c23('0x4d')](get_open_tabs('sms',_0x453529['dataValues']));_0x8a6788[_0x2c23('0x4d')](get_open_tabs('openchannel',_0x453529[_0x2c23('0x53')]));_0x8a6788[_0x2c23('0x4d')](get_open_tabs('whatsapp',_0x453529[_0x2c23('0x53')]));_0x8a6788[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x55'),_0x453529[_0x2c23('0x53')]));_0x8a6788[_0x2c23('0x4d')](get_open_tabs(_0x2c23('0x65'),_0x453529[_0x2c23('0x53')]));return Promise[_0x2c23('0x58')](_0x8a6788);})[_0x2c23('0x19')](function(_0x25ed32){if(_0x25ed32){var _0x2df7ec=_[_0x2c23('0x37')](values[_0x2c23('0xc4')],function(_0x919d0b){return{'channel':'CHAT','id':_0x919d0b['id'],'createdAt':_0x919d0b[_0x2c23('0xc5')]};});var _0x4dd580=_[_0x2c23('0x37')](values[_0x2c23('0xc6')],function(_0x442fce){return{'channel':_0x2c23('0xc7'),'id':_0x442fce['id'],'createdAt':_0x442fce[_0x2c23('0xc5')]};});var _0x47a4b5=_[_0x2c23('0x37')](values['OpenchannelOpenTabs'],function(_0x1a2f1d){return{'channel':_0x2c23('0xc8'),'id':_0x1a2f1d['id'],'createdAt':_0x1a2f1d['createdAt']};});var _0x86b14a=_[_0x2c23('0x37')](values[_0x2c23('0xc9')],function(_0x95efa2){return{'channel':_0x2c23('0xca'),'id':_0x95efa2['id'],'createdAt':_0x95efa2['createdAt']};});var _0x470631=_[_0x2c23('0x37')](values[_0x2c23('0xcb')],function(_0x315128){return{'channel':'SMS','id':_0x315128['id'],'createdAt':_0x315128[_0x2c23('0xc5')]};});var _0x54cd41=_['map'](values[_0x2c23('0xcc')],function(_0x20df32){return{'channel':_0x2c23('0xcd'),'id':_0x20df32['id'],'createdAt':_0x20df32[_0x2c23('0xc5')]};});var _0x44b8f0=_['concat'](_0x2df7ec,_0x4dd580,_0x47a4b5,_0x86b14a,_0x470631,_0x54cd41);var _0x552400={'count':_0x44b8f0[_0x2c23('0x51')],'rows':_0x44b8f0};return _0x552400;}else return null;})[_0x2c23('0x19')](respondWithResult(_0x48b2fe,null))[_0x2c23('0x59')](handleError(_0x48b2fe,null));};exports[_0x2c23('0xce')]=function(_0x5008e0,_0x2e8755){var _0x49c609={};var _0x4b861e={};var _0x502883;var _0x3a6c4f;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x5008e0[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x2e8755,null))[_0x2c23('0x19')](function(_0x4481af){if(_0x4481af){_0x502883=_0x4481af;_0x4b861e['model']=_[_0x2c23('0x5e')](db[_0x2c23('0xd0')][_0x2c23('0x40')]);_0x4b861e['query']=_[_0x2c23('0x5e')](_0x5008e0['query']);_0x4b861e[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x4b861e['model'],_0x4b861e[_0x2c23('0x48')]);_0x49c609[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x4b861e[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x5008e0[_0x2c23('0x48')]['fields']));_0x49c609['attributes']=_0x49c609['attributes'][_0x2c23('0x51')]?_0x49c609[_0x2c23('0x4c')]:_0x4b861e[_0x2c23('0x5c')];_0x49c609[_0x2c23('0xd1')]=qs['sort'](_0x5008e0['query'][_0x2c23('0xd2')]);_0x49c609[_0x2c23('0xd3')]=qs['filters'](_[_0x2c23('0xd4')](_0x5008e0['query'],_0x4b861e['filters']));if(_0x5008e0[_0x2c23('0x48')]['filter']){_0x49c609[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x49c609[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x49c609[_0x2c23('0x4c')],function(_0x419ae4){var _0x3eb144={};_0x3eb144[_0x419ae4]={'$like':'%'+_0x5008e0['query'][_0x2c23('0x35')]+'%'};return _0x3eb144;})});}_0x49c609=_['merge']({},_0x49c609,_0x5008e0[_0x2c23('0x64')]);return _0x502883[_0x2c23('0xce')](_0x49c609);}})['then'](function(_0x5b4594){if(_0x5b4594){_0x3a6c4f=_0x5b4594[_0x2c23('0x51')];if(_0x5008e0['query'][_0x2c23('0xd5')]('includeAll')){_0x49c609[_0x2c23('0x4b')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x2c23('0xd6')],'as':_0x2c23('0xd7'),'attributes':['id',_0x2c23('0x3b'),_0x2c23('0xd8')],'where':_0x5008e0[_0x2c23('0x48')][_0x2c23('0xd9')]?{'id':_0x5008e0[_0x2c23('0x48')]['tag']}:undefined,'required':_0x5008e0['query'][_0x2c23('0xd9')]?!![]:![]}];}if(!_0x5008e0[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x49c609[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x5008e0[_0x2c23('0x48')][_0x2c23('0x28')]);_0x49c609[_0x2c23('0x26')]=qs[_0x2c23('0x26')](_0x5008e0['query'][_0x2c23('0x26')]);}return _0x502883[_0x2c23('0xce')](_0x49c609);}})[_0x2c23('0x19')](function(_0xa96f99){if(_0xa96f99){return _0xa96f99?{'count':_0x3a6c4f,'rows':_0xa96f99}:null;}})[_0x2c23('0x19')](respondWithResult(_0x2e8755,null))[_0x2c23('0x59')](handleError(_0x2e8755,null));};exports[_0x2c23('0xdb')]=function(_0x148612,_0x5dc92f){var _0xb9a9f9;var _0x43f551={};var _0x1905fc;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x148612['params']['id']},'attributes':['id',_0x2c23('0x3b'),_0x2c23('0x2c')]})[_0x2c23('0x19')](handleEntityNotFound(_0x5dc92f,null))['then'](function(_0x3a3254){if(!utils[_0x2c23('0xb5')](_0x148612[_0x2c23('0x48')][_0x2c23('0xa0')])){throw new db['Sequelize']['ValidationError'](_0x2c23('0xa2'));}_0xb9a9f9=_0x3a3254;var _0xb97968={};_0xb97968[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_[_0x2c23('0xa4')](_0x148612[_0x2c23('0x48')][_0x2c23('0xa0')])+_0x2c23('0xdc')]['rawAttributes']);_0xb97968[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x148612[_0x2c23('0x48')]);_0xb97968['filters']=_[_0x2c23('0x60')](_0xb97968[_0x2c23('0x5c')],_0xb97968[_0x2c23('0x48')]);_0x43f551['attributes']=_[_0x2c23('0x60')](_0xb97968[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x148612[_0x2c23('0x48')][_0x2c23('0x61')]));_0x43f551[_0x2c23('0x4c')]=_0x43f551['attributes'][_0x2c23('0x51')]?_0x43f551[_0x2c23('0x4c')]:_0xb97968[_0x2c23('0x5c')];_0x43f551[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x148612[_0x2c23('0x48')][_0x2c23('0xd2')]);_0x43f551[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_['pick'](_0x148612['query'],_0xb97968[_0x2c23('0x5f')]));if(_0x148612[_0x2c23('0x48')]['filter']){_0x43f551[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x43f551[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x43f551[_0x2c23('0x4c')],function(_0x4106e9){var _0x43b9aa={};_0x43b9aa[_0x4106e9]={'$like':'%'+_0x148612[_0x2c23('0x48')][_0x2c23('0x35')]+'%'};return _0x43b9aa;})});}_0x43f551=_[_0x2c23('0x63')]({},_0x43f551,_0x148612[_0x2c23('0x64')]);switch(_0xb9a9f9[_0x2c23('0x2c')]){case _0x2c23('0x30'):return db[_[_0x2c23('0xa4')](_0x148612[_0x2c23('0x48')][_0x2c23('0xa0')])+_0x2c23('0xdc')][_0x2c23('0x4e')](_0x43f551);case'user':case'agent':return _0xb9a9f9[_0x2c23('0x2f')+_[_0x2c23('0xa4')](_0x148612[_0x2c23('0x48')][_0x2c23('0xa0')])+_0x2c23('0xa6')](_0x43f551);default:throw new db['Sequelize']['ValidationError'](_0x2c23('0xdd'));}})['then'](function(_0x4609f8){_0x1905fc=_0x4609f8['length'];if(!_0x148612['query'][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x43f551[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x148612[_0x2c23('0x48')][_0x2c23('0x28')]);_0x43f551[_0x2c23('0x26')]=qs[_0x2c23('0x26')](_0x148612['query'][_0x2c23('0x26')]);}switch(_0xb9a9f9[_0x2c23('0x2c')]){case _0x2c23('0x30'):return db[_[_0x2c23('0xa4')](_0x148612[_0x2c23('0x48')][_0x2c23('0xa0')])+_0x2c23('0xdc')][_0x2c23('0x4e')](_0x43f551);case'user':case'agent':return _0xb9a9f9[_0x2c23('0x2f')+_[_0x2c23('0xa4')](_0x148612[_0x2c23('0x48')]['channel'])+_0x2c23('0xa6')](_0x43f551);}})[_0x2c23('0x19')](function(_0x27688c){return{'count':_0x1905fc,'rows':_0x27688c};})[_0x2c23('0x19')](respondWithResult(_0x5dc92f,null))['catch'](handleError(_0x5dc92f,null));};exports[_0x2c23('0xde')]=function(_0x31a2ca,_0x41daee){var _0x59726a={};var _0x7996de={};var _0x14046b;var _0x502139;return db['User']['findOne']({'where':{'id':_0x31a2ca[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x41daee,null))['then'](function(_0x594e59){if(_0x594e59){_0x14046b=_0x594e59;_0x7996de[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0xb2')]['rawAttributes']);_0x7996de[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x31a2ca['query']);_0x7996de[_0x2c23('0x5f')]=_['intersection'](_0x7996de[_0x2c23('0x5c')],_0x7996de[_0x2c23('0x48')]);_0x59726a[_0x2c23('0x4c')]=_['intersection'](_0x7996de[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x31a2ca[_0x2c23('0x48')][_0x2c23('0x61')]));_0x59726a[_0x2c23('0x4c')]=_0x59726a['attributes'][_0x2c23('0x51')]?_0x59726a['attributes']:_0x7996de['model'];_0x59726a[_0x2c23('0xd1')]=qs['sort'](_0x31a2ca['query'][_0x2c23('0xd2')]);_0x59726a['where']=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x31a2ca[_0x2c23('0x48')],_0x7996de[_0x2c23('0x5f')]));if(_0x31a2ca[_0x2c23('0x48')]['filter']){_0x59726a['where']=_[_0x2c23('0x63')](_0x59726a[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x59726a[_0x2c23('0x4c')],function(_0x1f482e){var _0x42e820={};_0x42e820[_0x1f482e]={'$like':'%'+_0x31a2ca['query'][_0x2c23('0x35')]+'%'};return _0x42e820;})});}_0x59726a=_[_0x2c23('0x63')]({},_0x59726a,_0x31a2ca[_0x2c23('0x64')]);return _0x14046b[_0x2c23('0xde')](_0x59726a);}})['then'](function(_0xadcb7f){if(_0xadcb7f){_0x502139=_0xadcb7f['length'];if(!_0x31a2ca['query'][_0x2c23('0xd5')]('nolimit')){_0x59726a[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x31a2ca[_0x2c23('0x48')][_0x2c23('0x28')]);_0x59726a[_0x2c23('0x26')]=qs[_0x2c23('0x26')](_0x31a2ca['query'][_0x2c23('0x26')]);}return _0x14046b[_0x2c23('0xde')](_0x59726a);}})[_0x2c23('0x19')](function(_0xc7de7f){if(_0xc7de7f){return _0xc7de7f?{'count':_0x502139,'rows':_0xc7de7f}:null;}})[_0x2c23('0x19')](respondWithResult(_0x41daee,null))[_0x2c23('0x59')](handleError(_0x41daee,null));};exports[_0x2c23('0xdf')]=function(_0x34aef9,_0x424f26){var _0x427d83={};var _0x4ef0c4={};var _0x13ef19;var _0x1511ec;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x34aef9[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x424f26,null))[_0x2c23('0x19')](function(_0x1a4476){if(_0x1a4476){_0x13ef19=_0x1a4476;_0x4ef0c4[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0xe0')]['rawAttributes']);_0x4ef0c4['query']=_[_0x2c23('0x5e')](_0x34aef9[_0x2c23('0x48')]);_0x4ef0c4['filters']=_[_0x2c23('0x60')](_0x4ef0c4[_0x2c23('0x5c')],_0x4ef0c4['query']);_0x427d83['attributes']=_[_0x2c23('0x60')](_0x4ef0c4[_0x2c23('0x5c')],qs['fields'](_0x34aef9[_0x2c23('0x48')][_0x2c23('0x61')]));_0x427d83[_0x2c23('0x4c')]=_0x427d83[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x427d83[_0x2c23('0x4c')]:_0x4ef0c4['model'];_0x427d83[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x34aef9[_0x2c23('0x48')][_0x2c23('0xd2')]);_0x427d83[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x34aef9[_0x2c23('0x48')],_0x4ef0c4[_0x2c23('0x5f')]));if(_0x34aef9['query'][_0x2c23('0x35')]){_0x427d83[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x427d83[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x427d83[_0x2c23('0x4c')],function(_0x46a83e){var _0x3d71ce={};_0x3d71ce[_0x46a83e]={'$like':'%'+_0x34aef9[_0x2c23('0x48')][_0x2c23('0x35')]+'%'};return _0x3d71ce;})});}_0x427d83=_[_0x2c23('0x63')]({},_0x427d83,_0x34aef9[_0x2c23('0x64')]);return _0x13ef19[_0x2c23('0xdf')](_0x427d83);}})[_0x2c23('0x19')](function(_0x20bf5f){if(_0x20bf5f){_0x1511ec=_0x20bf5f[_0x2c23('0x51')];if(!_0x34aef9[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x427d83[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x34aef9[_0x2c23('0x48')]['limit']);_0x427d83['offset']=qs[_0x2c23('0x26')](_0x34aef9['query'][_0x2c23('0x26')]);}return _0x13ef19['getGroups'](_0x427d83);}})[_0x2c23('0x19')](function(_0x206a6b){if(_0x206a6b){return _0x206a6b?{'count':_0x1511ec,'rows':_0x206a6b}:null;}})[_0x2c23('0x19')](respondWithResult(_0x424f26,null))[_0x2c23('0x59')](handleError(_0x424f26,null));};exports['getRecordings']=function(_0x29419e,_0x5f5656){var _0xc0c79d={'raw':!![],'where':{}};var _0x56ef18={};var _0xfea08f={'count':0x0,'rows':[]};return db[_0x2c23('0x46')]['findOne']({'where':{'id':_0x29419e[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x5f5656,null))['then'](function(_0xf308ce){if(_0xf308ce){_0x56ef18[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0xe1')]['rawAttributes']);_0x56ef18[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x29419e['query']);_0x56ef18[_0x2c23('0x5f')]=_['intersection'](_0x56ef18[_0x2c23('0x5c')],_0x56ef18['query']);_0xc0c79d['attributes']=_[_0x2c23('0x60')](_0x56ef18[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x29419e['query'][_0x2c23('0x61')]));_0xc0c79d['attributes']=_0xc0c79d['attributes'][_0x2c23('0x51')]?_0xc0c79d['attributes']:_0x56ef18[_0x2c23('0x5c')];if(!_0x29419e[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0xc0c79d[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x29419e[_0x2c23('0x48')][_0x2c23('0x28')]);_0xc0c79d[_0x2c23('0x26')]=qs['offset'](_0x29419e[_0x2c23('0x48')][_0x2c23('0x26')]);}_0xc0c79d[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x29419e[_0x2c23('0x48')]['sort']);_0xc0c79d['where']=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x29419e[_0x2c23('0x48')],_0x56ef18[_0x2c23('0x5f')]));_0xc0c79d[_0x2c23('0xd3')]['UserId']=_0xf308ce['id'];if(_0x29419e[_0x2c23('0x48')][_0x2c23('0x35')]){_0xc0c79d[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0xc0c79d[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0xc0c79d['attributes'],function(_0x4a6f16){var _0x43793b={};_0x43793b[_0x4a6f16]={'$like':'%'+_0x29419e['query'][_0x2c23('0x35')]+'%'};return _0x43793b;})});}_0xc0c79d=_[_0x2c23('0x63')]({},_0xc0c79d,_0x29419e[_0x2c23('0x64')]);return db[_0x2c23('0xe1')]['count']({'where':_0xc0c79d['where']})[_0x2c23('0x19')](function(_0x25d72f){_0xfea08f[_0x2c23('0x29')]=_0x25d72f;if(_0x29419e[_0x2c23('0x48')][_0x2c23('0x47')]){_0xc0c79d[_0x2c23('0x4b')]=[{'all':!![]}];}return db[_0x2c23('0xe1')][_0x2c23('0x4e')](_0xc0c79d);})['then'](function(_0x10513d){_0xfea08f[_0x2c23('0x4f')]=_0x10513d;return _0xfea08f;});}})[_0x2c23('0x19')](respondWithFilteredResult(_0x5f5656,_0xc0c79d))[_0x2c23('0x59')](handleError(_0x5f5656,null));};exports[_0x2c23('0xe2')]=function(_0x5d24ac,_0x1c6904){var _0x121da5={'raw':!![],'where':{}};var _0x3b3788={};var _0x143c67={'count':0x0,'rows':[]};return db[_0x2c23('0x46')]['findOne']({'where':{'id':_0x5d24ac[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x1c6904,null))['then'](function(_0x434316){if(_0x434316){_0x3b3788[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db['ScreenRecording'][_0x2c23('0x40')]);_0x3b3788[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x5d24ac[_0x2c23('0x48')]);_0x3b3788[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x3b3788[_0x2c23('0x5c')],_0x3b3788['query']);_0x121da5[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x3b3788[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x5d24ac['query'][_0x2c23('0x61')]));_0x121da5['attributes']=_0x121da5['attributes']['length']?_0x121da5[_0x2c23('0x4c')]:_0x3b3788['model'];if(!_0x5d24ac[_0x2c23('0x48')]['hasOwnProperty']('nolimit')){_0x121da5[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x5d24ac[_0x2c23('0x48')]['limit']);_0x121da5[_0x2c23('0x26')]=qs[_0x2c23('0x26')](_0x5d24ac[_0x2c23('0x48')][_0x2c23('0x26')]);}_0x121da5[_0x2c23('0xd1')]=qs['sort'](_0x5d24ac[_0x2c23('0x48')]['sort']);_0x121da5[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x5d24ac[_0x2c23('0x48')],_0x3b3788[_0x2c23('0x5f')]));_0x121da5[_0x2c23('0xd3')][_0x2c23('0xe3')]=_0x434316['id'];if(_0x5d24ac[_0x2c23('0x48')][_0x2c23('0x35')]){_0x121da5[_0x2c23('0xd3')]=_['merge'](_0x121da5[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x121da5['attributes'],function(_0x2461d6){var _0x2265ad={};_0x2265ad[_0x2461d6]={'$like':'%'+_0x5d24ac['query'][_0x2c23('0x35')]+'%'};return _0x2265ad;})});}_0x121da5=_['merge']({},_0x121da5,_0x5d24ac[_0x2c23('0x64')]);return db[_0x2c23('0xe4')]['count']({'where':_0x121da5[_0x2c23('0xd3')]})['then'](function(_0x2253d9){_0x143c67[_0x2c23('0x29')]=_0x2253d9;if(_0x5d24ac[_0x2c23('0x48')]['includeAll']){_0x121da5[_0x2c23('0x4b')]=[{'all':!![]}];}return db[_0x2c23('0xe4')]['findAll'](_0x121da5);})[_0x2c23('0x19')](function(_0x2e5d57){_0x143c67['rows']=_0x2e5d57;return _0x143c67;});}})[_0x2c23('0x19')](respondWithFilteredResult(_0x1c6904,_0x121da5))[_0x2c23('0x59')](handleError(_0x1c6904,null));};exports[_0x2c23('0xe5')]=function(_0x19f982,_0x244984){var _0x2d940a={};var _0x5d6fc7={};var _0x5b849c;var _0x90c3eb;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x19f982[_0x2c23('0x5b')]['id']}})['then'](handleEntityNotFound(_0x244984,null))[_0x2c23('0x19')](function(_0x31359e){if(_0x31359e){_0x5b849c=_0x31359e;_0x5d6fc7[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0xe6')]['rawAttributes']);_0x5d6fc7[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x19f982[_0x2c23('0x48')]);_0x5d6fc7[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x5d6fc7[_0x2c23('0x5c')],_0x5d6fc7[_0x2c23('0x48')]);_0x2d940a[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x5d6fc7[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x19f982[_0x2c23('0x48')][_0x2c23('0x61')]));_0x2d940a[_0x2c23('0x4c')]=_0x2d940a[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x2d940a['attributes']:_0x5d6fc7[_0x2c23('0x5c')];_0x2d940a['order']=qs['sort'](_0x19f982[_0x2c23('0x48')][_0x2c23('0xd2')]);_0x2d940a['where']=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x19f982['query'],_0x5d6fc7[_0x2c23('0x5f')]));if(_0x19f982[_0x2c23('0x48')]['filter']){_0x2d940a[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x2d940a[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x2d940a[_0x2c23('0x4c')],function(_0x1225e1){var _0x32068e={};_0x32068e[_0x1225e1]={'$like':'%'+_0x19f982['query'][_0x2c23('0x35')]+'%'};return _0x32068e;})});}_0x2d940a=_[_0x2c23('0x63')]({},_0x2d940a,_0x19f982[_0x2c23('0x64')]);return _0x5b849c[_0x2c23('0xe5')](_0x2d940a);}})['then'](function(_0x2023cd){if(_0x2023cd){_0x90c3eb=_0x2023cd['length'];if(!_0x19f982[_0x2c23('0x48')]['hasOwnProperty'](_0x2c23('0xda'))){_0x2d940a[_0x2c23('0x28')]=qs['limit'](_0x19f982[_0x2c23('0x48')][_0x2c23('0x28')]);_0x2d940a[_0x2c23('0x26')]=qs['offset'](_0x19f982['query']['offset']);}return _0x5b849c[_0x2c23('0xe5')](_0x2d940a);}})['then'](function(_0x375772){if(_0x375772){return _0x375772?{'count':_0x90c3eb,'rows':_0x375772}:null;}})[_0x2c23('0x19')](respondWithResult(_0x244984,null))[_0x2c23('0x59')](handleError(_0x244984,null));};exports[_0x2c23('0xe7')]=function(_0x4b10fe,_0x2437e8){var _0x28e900={};var _0x1ae01f={};var _0x3521df;var _0x4f78ef;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x4b10fe[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x2437e8,null))[_0x2c23('0x19')](function(_0x539c2b){if(_0x539c2b){_0x3521df=_0x539c2b;_0x1ae01f[_0x2c23('0x5c')]=_['keys'](db[_0x2c23('0xe8')][_0x2c23('0x40')]);_0x1ae01f[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x4b10fe['query']);_0x1ae01f['filters']=_[_0x2c23('0x60')](_0x1ae01f['model'],_0x1ae01f[_0x2c23('0x48')]);_0x28e900[_0x2c23('0x4c')]=_['intersection'](_0x1ae01f[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x4b10fe['query'][_0x2c23('0x61')]));_0x28e900[_0x2c23('0x4c')]=_0x28e900['attributes'][_0x2c23('0x51')]?_0x28e900[_0x2c23('0x4c')]:_0x1ae01f['model'];_0x28e900[_0x2c23('0xd1')]=qs['sort'](_0x4b10fe['query'][_0x2c23('0xd2')]);_0x28e900[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x4b10fe[_0x2c23('0x48')],_0x1ae01f[_0x2c23('0x5f')]));if(_0x4b10fe[_0x2c23('0x48')][_0x2c23('0x35')]){_0x28e900[_0x2c23('0xd3')]=_['merge'](_0x28e900[_0x2c23('0xd3')],{'$or':_['map'](_0x28e900['attributes'],function(_0x4d6f55){var _0xa56a64={};_0xa56a64[_0x4d6f55]={'$like':'%'+_0x4b10fe[_0x2c23('0x48')]['filter']+'%'};return _0xa56a64;})});}_0x28e900=_[_0x2c23('0x63')]({},_0x28e900,_0x4b10fe[_0x2c23('0x64')]);return _0x3521df[_0x2c23('0xe7')](_0x28e900);}})['then'](function(_0x2a3acb){if(_0x2a3acb){_0x4f78ef=_0x2a3acb[_0x2c23('0x51')];if(!_0x4b10fe[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x28e900[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x4b10fe[_0x2c23('0x48')][_0x2c23('0x28')]);_0x28e900['offset']=qs[_0x2c23('0x26')](_0x4b10fe[_0x2c23('0x48')]['offset']);}return _0x3521df[_0x2c23('0xe7')](_0x28e900);}})['then'](function(_0x583095){if(_0x583095){return _0x583095?{'count':_0x4f78ef,'rows':_0x583095}:null;}})['then'](respondWithResult(_0x2437e8,null))['catch'](handleError(_0x2437e8,null));};exports['getMailInteractions']=function(_0x3506d2,_0x50b48f){var _0x29b388={'raw':!![],'where':{}};var _0x633b73={};var _0x4deaca={'count':0x0,'rows':[]};return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x3506d2[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x50b48f,null))[_0x2c23('0x19')](function(_0x528896){if(_0x528896){_0x633b73[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db['MailInteraction'][_0x2c23('0x40')]);_0x633b73[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x3506d2[_0x2c23('0x48')]);_0x633b73[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x633b73[_0x2c23('0x5c')],_0x633b73[_0x2c23('0x48')]);_0x29b388[_0x2c23('0x4c')]=_['intersection'](_0x633b73[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x3506d2[_0x2c23('0x48')]['fields']));_0x29b388[_0x2c23('0x4c')]=_0x29b388[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x29b388[_0x2c23('0x4c')]:_0x633b73['model'];if(!_0x3506d2[_0x2c23('0x48')]['hasOwnProperty'](_0x2c23('0xda'))){_0x29b388[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x3506d2[_0x2c23('0x48')][_0x2c23('0x28')]);_0x29b388['offset']=qs['offset'](_0x3506d2['query']['offset']);}_0x29b388[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x3506d2['query']['sort']);_0x29b388[_0x2c23('0xd3')]=qs['filters'](_[_0x2c23('0xd4')](_0x3506d2[_0x2c23('0x48')],_0x633b73[_0x2c23('0x5f')]));_0x29b388[_0x2c23('0xd3')][_0x2c23('0xe3')]=_0x528896['id'];if(_0x3506d2[_0x2c23('0x48')][_0x2c23('0x35')]){_0x29b388[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x29b388['where'],{'$or':_[_0x2c23('0x37')](_0x29b388['attributes'],function(_0x216443){var _0x5a85d2={};_0x5a85d2[_0x216443]={'$like':'%'+_0x3506d2[_0x2c23('0x48')][_0x2c23('0x35')]+'%'};return _0x5a85d2;})});}_0x29b388=_[_0x2c23('0x63')]({},_0x29b388,_0x3506d2['options']);return db[_0x2c23('0xe9')][_0x2c23('0x29')]({'where':_0x29b388['where']})[_0x2c23('0x19')](function(_0x988d41){_0x4deaca[_0x2c23('0x29')]=_0x988d41;if(_0x3506d2[_0x2c23('0x48')][_0x2c23('0x47')]){_0x29b388['include']=[{'all':!![]}];}return db[_0x2c23('0xe9')]['findAll'](_0x29b388);})[_0x2c23('0x19')](function(_0x196878){_0x4deaca[_0x2c23('0x4f')]=_0x196878;return _0x4deaca;});}})['then'](respondWithFilteredResult(_0x50b48f,_0x29b388))[_0x2c23('0x59')](handleError(_0x50b48f,null));};exports[_0x2c23('0xea')]=function(_0x54d961,_0x44148a){var _0x158a4f={};var _0x273299={};var _0x57e81a;var _0x1abfe8;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x54d961['params']['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x44148a,null))[_0x2c23('0x19')](function(_0x3dd7f6){if(_0x3dd7f6){_0x57e81a=_0x3dd7f6;_0x273299[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db['SmsInteraction']['rawAttributes']);_0x273299['query']=_[_0x2c23('0x5e')](_0x54d961[_0x2c23('0x48')]);_0x273299[_0x2c23('0x5f')]=_['intersection'](_0x273299[_0x2c23('0x5c')],_0x273299['query']);_0x158a4f[_0x2c23('0x4c')]=_['intersection'](_0x273299[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x54d961[_0x2c23('0x48')][_0x2c23('0x61')]));_0x158a4f[_0x2c23('0x4c')]=_0x158a4f[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x158a4f['attributes']:_0x273299['model'];_0x158a4f['order']=qs[_0x2c23('0xd2')](_0x54d961[_0x2c23('0x48')]['sort']);_0x158a4f[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x54d961[_0x2c23('0x48')],_0x273299[_0x2c23('0x5f')]));if(_0x54d961[_0x2c23('0x48')]['filter']){_0x158a4f[_0x2c23('0xd3')]=_['merge'](_0x158a4f[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x158a4f[_0x2c23('0x4c')],function(_0x3baa33){var _0x59ea25={};_0x59ea25[_0x3baa33]={'$like':'%'+_0x54d961[_0x2c23('0x48')]['filter']+'%'};return _0x59ea25;})});}_0x158a4f=_[_0x2c23('0x63')]({},_0x158a4f,_0x54d961[_0x2c23('0x64')]);return _0x57e81a[_0x2c23('0xea')](_0x158a4f);}})[_0x2c23('0x19')](function(_0x5e6327){if(_0x5e6327){_0x1abfe8=_0x5e6327[_0x2c23('0x51')];if(!_0x54d961[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x158a4f['limit']=qs[_0x2c23('0x28')](_0x54d961[_0x2c23('0x48')][_0x2c23('0x28')]);_0x158a4f[_0x2c23('0x26')]=qs['offset'](_0x54d961[_0x2c23('0x48')][_0x2c23('0x26')]);}return _0x57e81a[_0x2c23('0xea')](_0x158a4f);}})[_0x2c23('0x19')](function(_0x44f636){if(_0x44f636){return _0x44f636?{'count':_0x1abfe8,'rows':_0x44f636}:null;}})['then'](respondWithResult(_0x44148a,null))[_0x2c23('0x59')](handleError(_0x44148a,null));};exports[_0x2c23('0xeb')]=function(_0x21e7a7,_0x2763b6){var _0x7df798={};var _0x3e37e7={};var _0x4ad497;var _0x1fbf97;return db[_0x2c23('0x46')]['findOne']({'where':{'id':_0x21e7a7['params']['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x2763b6,null))[_0x2c23('0x19')](function(_0x319c55){if(_0x319c55){_0x4ad497=_0x319c55;_0x3e37e7[_0x2c23('0x5c')]=_['keys'](db[_0x2c23('0xec')][_0x2c23('0x40')]);_0x3e37e7[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x21e7a7['query']);_0x3e37e7[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x3e37e7[_0x2c23('0x5c')],_0x3e37e7[_0x2c23('0x48')]);_0x7df798[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x3e37e7[_0x2c23('0x5c')],qs['fields'](_0x21e7a7[_0x2c23('0x48')][_0x2c23('0x61')]));_0x7df798['attributes']=_0x7df798[_0x2c23('0x4c')]['length']?_0x7df798[_0x2c23('0x4c')]:_0x3e37e7[_0x2c23('0x5c')];_0x7df798[_0x2c23('0xd1')]=qs['sort'](_0x21e7a7[_0x2c23('0x48')][_0x2c23('0xd2')]);_0x7df798[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x21e7a7[_0x2c23('0x48')],_0x3e37e7[_0x2c23('0x5f')]));if(_0x21e7a7[_0x2c23('0x48')][_0x2c23('0x35')]){_0x7df798[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x7df798[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0x7df798['attributes'],function(_0x1c7e60){var _0x3b5b58={};_0x3b5b58[_0x1c7e60]={'$like':'%'+_0x21e7a7['query']['filter']+'%'};return _0x3b5b58;})});}_0x7df798=_['merge']({},_0x7df798,_0x21e7a7[_0x2c23('0x64')]);return _0x4ad497[_0x2c23('0xeb')](_0x7df798);}})[_0x2c23('0x19')](function(_0x2b654a){if(_0x2b654a){_0x1fbf97=_0x2b654a[_0x2c23('0x51')];if(!_0x21e7a7[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x7df798[_0x2c23('0x28')]=qs['limit'](_0x21e7a7[_0x2c23('0x48')][_0x2c23('0x28')]);_0x7df798[_0x2c23('0x26')]=qs['offset'](_0x21e7a7['query'][_0x2c23('0x26')]);}return _0x4ad497[_0x2c23('0xeb')](_0x7df798);}})[_0x2c23('0x19')](function(_0x3ee29f){if(_0x3ee29f){return _0x3ee29f?{'count':_0x1fbf97,'rows':_0x3ee29f}:null;}})[_0x2c23('0x19')](respondWithResult(_0x2763b6,null))[_0x2c23('0x59')](handleError(_0x2763b6,null));};exports['getWhatsappInteractions']=function(_0x3ea3fd,_0x59929a){var _0xb2e85d={};var _0x223c9b={};var _0x1c0085;var _0xb66e36;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x3ea3fd[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x59929a,null))[_0x2c23('0x19')](function(_0x32e301){if(_0x32e301){_0x1c0085=_0x32e301;_0x223c9b[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0xed')][_0x2c23('0x40')]);_0x223c9b[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x3ea3fd['query']);_0x223c9b[_0x2c23('0x5f')]=_['intersection'](_0x223c9b['model'],_0x223c9b[_0x2c23('0x48')]);_0xb2e85d[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x223c9b['model'],qs[_0x2c23('0x61')](_0x3ea3fd['query'][_0x2c23('0x61')]));_0xb2e85d[_0x2c23('0x4c')]=_0xb2e85d[_0x2c23('0x4c')][_0x2c23('0x51')]?_0xb2e85d[_0x2c23('0x4c')]:_0x223c9b[_0x2c23('0x5c')];_0xb2e85d[_0x2c23('0xd1')]=qs['sort'](_0x3ea3fd[_0x2c23('0x48')][_0x2c23('0xd2')]);_0xb2e85d[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0x3ea3fd[_0x2c23('0x48')],_0x223c9b['filters']));if(_0x3ea3fd[_0x2c23('0x48')][_0x2c23('0x35')]){_0xb2e85d[_0x2c23('0xd3')]=_['merge'](_0xb2e85d[_0x2c23('0xd3')],{'$or':_[_0x2c23('0x37')](_0xb2e85d['attributes'],function(_0x48ae50){var _0x1e9dbb={};_0x1e9dbb[_0x48ae50]={'$like':'%'+_0x3ea3fd['query'][_0x2c23('0x35')]+'%'};return _0x1e9dbb;})});}_0xb2e85d=_[_0x2c23('0x63')]({},_0xb2e85d,_0x3ea3fd[_0x2c23('0x64')]);return _0x1c0085[_0x2c23('0xee')](_0xb2e85d);}})[_0x2c23('0x19')](function(_0x587967){if(_0x587967){_0xb66e36=_0x587967['length'];if(!_0x3ea3fd[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0xb2e85d[_0x2c23('0x28')]=qs['limit'](_0x3ea3fd['query'][_0x2c23('0x28')]);_0xb2e85d['offset']=qs[_0x2c23('0x26')](_0x3ea3fd[_0x2c23('0x48')][_0x2c23('0x26')]);}return _0x1c0085[_0x2c23('0xee')](_0xb2e85d);}})[_0x2c23('0x19')](function(_0x4aa5d9){if(_0x4aa5d9){return _0x4aa5d9?{'count':_0xb66e36,'rows':_0x4aa5d9}:null;}})[_0x2c23('0x19')](respondWithResult(_0x59929a,null))['catch'](handleError(_0x59929a,null));};exports[_0x2c23('0xef')]=function(_0x3e4614,_0x35fa3e,_0x5a4f0f){var _0x202744;var _0x283f64;var _0x419811;var _0x16706f=!_[_0x2c23('0x70')](_0x3e4614[_0x2c23('0x5b')]['id'])?_0x3e4614[_0x2c23('0x5b')]['id']:!_[_0x2c23('0x70')](_0x3e4614[_0x2c23('0x32')]['id'])?_0x3e4614[_0x2c23('0x32')]['id']:null;return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x16706f,'role':{'$or':[_0x2c23('0x30'),'user','agent']}},'attributes':['id',_0x2c23('0x3b'),'phone',_0x2c23('0xf0'),_0x2c23('0x2c'),_0x2c23('0x6f'),_0x2c23('0xa1')]})['then'](function(_0x7c3fb3){if(_0x7c3fb3){if(_0x7c3fb3[_0x2c23('0x2c')]==='agent'){_0x202744=_0x7c3fb3;if(_0x3e4614[_0x2c23('0x66')][_0x2c23('0xae')]){_0x419811=util['format'](_0x2c23('0xf1'),_0x202744[_0x3e4614['body'][_0x2c23('0xae')]]);}else if(_0x3e4614[_0x2c23('0x66')]['intrf']){_0x419811=util['format']('SIP/%s',_0x3e4614['body'][_0x2c23('0xf2')]);}else{_0x419811=util[_0x2c23('0xf3')]('SIP/%s',_0x202744[_0x2c23('0x3b')]);}socket['to'](util[_0x2c23('0xf3')](_0x2c23('0xf4'),_0x202744['name']))[_0x2c23('0xa9')](_0x2c23('0xf5'),{'user':{'id':_0x202744['id'],'name':_0x202744[_0x2c23('0x3b')]},'ip':_0x3e4614['headers'][_0x2c23('0xf6')]||_0x3e4614[_0x2c23('0xf7')][_0x2c23('0xf8')]||_0x3e4614[_0x2c23('0xf9')]['remoteAddress']||_0x3e4614['connection'][_0x2c23('0xf9')][_0x2c23('0xf8')]});return db[_0x2c23('0xb2')][_0x2c23('0x2e')]({'where':{'membername':_0x202744['name']},'individualHooks':!![]});}}else{throw new db[(_0x2c23('0x9a'))][(_0x2c23('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x202744){return _0x202744[_0x2c23('0xfa')]({'raw':!![]});}})[_0x2c23('0x19')](function(_0x25e02b){if(_0x202744){if(_0x25e02b){_0x283f64=_0x25e02b;if(_0x283f64[_0x2c23('0x51')]){var _0x4526ad=_0x283f64[_0x2c23('0x37')](function(_0x1708e1){var _0x470a2b={'membername':_0x202744[_0x2c23('0x3b')],'UserId':_0x202744['id'],'queue_name':_0x1708e1[_0x2c23('0x3b')],'VoiceQueueId':_0x1708e1['id'],'interface':_0x419811,'paused':_0x202744['loginInPause']||![],'penalty':_0x1708e1[_0x2c23('0xfb')]||0x0};return db[_0x2c23('0xb2')]['upsert'](_0x470a2b);});return Promise[_0x2c23('0x58')](_0x4526ad);}}}})[_0x2c23('0x19')](function(){if(_0x202744){return db[_0x2c23('0xfc')][_0x2c23('0x4e')]({'where':{'membername':_0x202744[_0x2c23('0x3b')],'exitAt':null}});}})[_0x2c23('0x19')](function(_0x4fedff){if(_0x202744){var _0x554d87=[];_0x4fedff[_0x2c23('0xfd')](function(_0x26f135){_0x554d87[_0x2c23('0x4d')](_0x26f135['update']({'exitAt':moment()[_0x2c23('0xf3')](_0x2c23('0xfe'))}));});return Promise['all'](_0x554d87);}})[_0x2c23('0x19')](function(){if(_0x202744){var _0x2797a8=[];var _0x1cae36=[];var _0x44c317=utils['getChannels']();var _0x306bb8={'membername':_0x202744[_0x2c23('0x3b')],'interface':_0x419811,'enterAt':moment()['format'](_0x2c23('0xfe')),'role':_0x202744[_0x2c23('0x2c')],'internal':_0x202744['internal']};_0x44c317['forEach'](function(_0x465246){_0x2797a8[_0x2c23('0x4d')](_[_0x2c23('0x63')]({'channel':_0x465246,'type':_0x2c23('0xff'),'data1':_0x3e4614['body'][_0x2c23('0x100')],'data2':_0x419811},_0x306bb8));if(_0x202744[_0x2c23('0xa1')]){_0x1cae36[_0x2c23('0x4d')](_[_0x2c23('0x63')]({'channel':_0x465246,'type':_0x2c23('0x101'),'data1':'LOGININPAUSE'},_0x306bb8));}});return db[_0x2c23('0xfc')][_0x2c23('0x91')](_0x2797a8[_0x2c23('0x102')](_0x1cae36),{'individualHooks':!![]});}})[_0x2c23('0x19')](function(){if(_0x202744){return _0x202744['update']({'online':!![],'lastLoginAt':moment()['format'](_0x2c23('0xfe')),'voicePause':_0x202744['loginInPause']||![],'mailPause':_0x202744[_0x2c23('0xa1')]||![],'chatPause':_0x202744[_0x2c23('0xa1')]||![],'faxPause':_0x202744[_0x2c23('0xa1')]||![],'smsPause':_0x202744['loginInPause']||![],'openchannelPause':_0x202744[_0x2c23('0xa1')]||![],'whatsappPause':_0x202744[_0x2c23('0xa1')]||![],'pauseType':_0x202744[_0x2c23('0xa1')]?_0x2c23('0x103'):null,'interface':_0x419811,'lastPauseAt':moment()[_0x2c23('0xf3')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x2c23('0x19')](function(_0xb7531d){if(_0x3e4614[_0x2c23('0x104')]){return _0x5a4f0f();}else{return Promise['resolve'](_0xb7531d)[_0x2c23('0x19')](respondWithResult(_0x35fa3e,null));}})[_0x2c23('0x59')](handleError(_0x35fa3e,null));};exports[_0x2c23('0x105')]=function(_0x353720,_0x4a69d4){var _0x15a6c6;return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x353720['params']['id'],'role':_0x2c23('0x86')},'attributes':['id',_0x2c23('0x3b'),'role']})[_0x2c23('0x19')](handleEntityNotFound(_0x4a69d4,null))[_0x2c23('0x19')](function(_0x3424a6){if(_0x3424a6){_0x15a6c6=_0x3424a6;return db[_0x2c23('0xb2')]['destroy']({'where':{'membername':_0x15a6c6['name']},'individualHooks':!![]});}})[_0x2c23('0x19')](function(){return db[_0x2c23('0xfc')][_0x2c23('0x4e')]({'where':{'membername':_0x15a6c6['name'],'exitAt':null}});})['then'](function(_0x3dcbf7){var _0x2b1a5a=[];_0x3dcbf7[_0x2c23('0xfd')](function(_0x4fc843){_0x2b1a5a[_0x2c23('0x4d')](_0x4fc843[_0x2c23('0x106')]({'exitAt':moment()['format'](_0x2c23('0xfe'))}));});return Promise[_0x2c23('0x58')](_0x2b1a5a);})[_0x2c23('0x19')](function(){return _0x15a6c6[_0x2c23('0x106')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2c23('0x19')](respondWithResult(_0x4a69d4,null))[_0x2c23('0x59')](handleError(_0x4a69d4,null));};exports[_0x2c23('0x107')]=function(_0x2cb9cd,_0x3817ae){var _0x2853ff;return db['UserVoiceQueueRt'][_0x2c23('0x106')]({'paused':0x1},{'where':{'UserId':_0x2cb9cd['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x2cb9cd[_0x2c23('0x5b')]['id'],'role':_0x2c23('0x86')},'attributes':['id',_0x2c23('0x3b'),'role',_0x2c23('0x6f'),_0x2c23('0xae'),_0x2c23('0xad')]});})[_0x2c23('0x19')](handleEntityNotFound(_0x3817ae,null))[_0x2c23('0x19')](function(_0x183aa4){if(_0x183aa4){_0x2853ff=_0x183aa4;return respondWithRpcPromise(_0x2c23('0x108'),'pause',{'id':_0x2853ff['id'],'name':_0x2853ff['name'],'pause':!![]});}})[_0x2c23('0x19')](function(){if(_0x2853ff){return db['MemberReport'][_0x2c23('0x4e')]({'where':{'membername':_0x2853ff['name'],'type':_0x2c23('0x101'),'exitAt':null}});}})[_0x2c23('0x19')](function(_0x351f7a){if(_0x351f7a[_0x2c23('0x51')]){var _0x56819d=moment()[_0x2c23('0xf3')](_0x2c23('0xfe'));for(var _0x1b6263=0x0,_0x1426aa=_0x351f7a['length'];_0x1b6263<_0x1426aa;_0x1b6263++){_0x351f7a[_0x1b6263][_0x2c23('0x109')]({'exitAt':_0x56819d});}}})['then'](function(){var _0x40330e=[];var _0x170aee=utils[_0x2c23('0x10a')]();_0x170aee[_0x2c23('0xfd')](function(_0x4f5e9e){_0x40330e['push']({'channel':_0x4f5e9e,'membername':_0x2853ff[_0x2c23('0x3b')],'interface':_[_0x2c23('0x70')](_0x2853ff['interface'])?util[_0x2c23('0xf3')](_0x2c23('0xaf'),_0x2853ff['name']):_0x2853ff[_0x2c23('0xae')],'type':_0x2c23('0x101'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2cb9cd[_0x2c23('0x66')][_0x2c23('0x42')]||_0x2c23('0x10b'),'role':_0x2853ff[_0x2c23('0x2c')],'internal':_0x2853ff['internal']});});return db[_0x2c23('0xfc')][_0x2c23('0x91')](_0x40330e,{'individualHooks':!![]});})[_0x2c23('0x19')](function(){return _0x2853ff[_0x2c23('0x106')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2cb9cd['body'][_0x2c23('0x42')]||_0x2c23('0x10b'),'lastPauseAt':moment()[_0x2c23('0xf3')](_0x2c23('0xfe'))});})['then'](respondWithResult(_0x3817ae,null))[_0x2c23('0x59')](handleError(_0x3817ae,null));};exports[_0x2c23('0x10c')]=function(_0x554225,_0x5a1120){if(_0x554225[_0x2c23('0x66')][_0x2c23('0xa0')]&&!utils[_0x2c23('0xb5')](_0x554225['body'][_0x2c23('0xa0')])){throw new APIBadRequestError(util['format'](_0x2c23('0x10d'),_0x554225[_0x2c23('0x66')][_0x2c23('0xa0')]));}return db[_0x2c23('0x46')][_0x2c23('0x3a')]({'where':{'id':_0x554225[_0x2c23('0x5b')]['id']},'attributes':['id',_0x2c23('0x3b'),_0x2c23('0x2c'),_0x2c23('0x6f'),_0x2c23('0xae'),'online','voicePause',_0x2c23('0x10e'),_0x2c23('0x10f'),'faxPause',_0x2c23('0x110'),_0x2c23('0x111'),_0x2c23('0x112'),_0x2c23('0x113'),'lastPauseAt']})[_0x2c23('0x19')](function(_0x16e79b){if(!_0x16e79b){throw new APINotFoundError(util['format'](_0x2c23('0x114'),_0x554225[_0x2c23('0x5b')]['id']));}return _0x16e79b[_0x2c23('0x10c')](_0x554225[_0x2c23('0x66')][_0x2c23('0xa0')]);})['then'](respondWithResult(_0x5a1120,null))['catch'](APIHandleError(_0x5a1120));};exports[_0x2c23('0x115')]=function(_0x57881b,_0x3e26ba){var _0x1eb021={};var _0x3b872a={};var _0x2f2fc4;var _0xc4808;return db['User']['findOne']({'where':{'id':_0x57881b[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x3e26ba,null))['then'](function(_0x46ba53){if(_0x46ba53){_0x2f2fc4=_0x46ba53;_0x3b872a[_0x2c23('0x5c')]=_[_0x2c23('0x5e')](db[_0x2c23('0x116')][_0x2c23('0x40')]);_0x3b872a[_0x2c23('0x48')]=_[_0x2c23('0x5e')](_0x57881b[_0x2c23('0x48')]);_0x3b872a['filters']=_[_0x2c23('0x60')](_0x3b872a['model'],_0x3b872a['query']);_0x1eb021[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x3b872a[_0x2c23('0x5c')],qs[_0x2c23('0x61')](_0x57881b[_0x2c23('0x48')][_0x2c23('0x61')]));_0x1eb021[_0x2c23('0x4c')]=_0x1eb021[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x1eb021[_0x2c23('0x4c')]:_0x3b872a['model'];_0x1eb021[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x57881b['query'][_0x2c23('0xd2')]);_0x1eb021[_0x2c23('0xd3')]=qs[_0x2c23('0x5f')](_['pick'](_0x57881b[_0x2c23('0x48')],_0x3b872a[_0x2c23('0x5f')]));if(_0x57881b[_0x2c23('0x48')]['filter']){_0x1eb021['where']=_[_0x2c23('0x63')](_0x1eb021['where'],{'$or':_[_0x2c23('0x37')](_0x1eb021['attributes'],function(_0x85ccf2){var _0x1d0ae8={};_0x1d0ae8[_0x85ccf2]={'$like':'%'+_0x57881b[_0x2c23('0x48')]['filter']+'%'};return _0x1d0ae8;})});}_0x1eb021=_[_0x2c23('0x63')]({},_0x1eb021,_0x57881b['options']);return _0x2f2fc4['getTeams'](_0x1eb021);}})['then'](function(_0x189649){if(_0x189649){_0xc4808=_0x189649['length'];if(!_0x57881b[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x1eb021[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0x57881b[_0x2c23('0x48')]['limit']);_0x1eb021[_0x2c23('0x26')]=qs['offset'](_0x57881b['query'][_0x2c23('0x26')]);}return _0x2f2fc4[_0x2c23('0x115')](_0x1eb021);}})['then'](function(_0x295f50){if(_0x295f50){return _0x295f50?{'count':_0xc4808,'rows':_0x295f50}:null;}})['then'](respondWithResult(_0x3e26ba,null))[_0x2c23('0x59')](handleError(_0x3e26ba,null));};exports['addTeams']=function(_0xdf98c6,_0x5b6adb){var _0x2d5f29=_0xdf98c6['params']['id'];var _0x5a2d98=_0xdf98c6[_0x2c23('0x66')]?_0xdf98c6[_0x2c23('0x66')][_0x2c23('0x6a')]:null;var _0x3faaa2=[];return Promise[_0x2c23('0x117')]()[_0x2c23('0x19')](function(){if(!_0x5a2d98)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2c23('0x19')](function(){return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x2d5f29}});})[_0x2c23('0x19')](function(_0x5f0794){if(!_0x5f0794)throw new APINotFoundError(util[_0x2c23('0xf3')](_0x2c23('0x114'),_0xdf98c6[_0x2c23('0x5b')]['id']));return db[_0x2c23('0x73')][_0x2c23('0x118')](function(_0x2e6ac9){return _0x5f0794['addTeams'](_0x5a2d98,{'transaction':_0x2e6ac9})[_0x2c23('0x19')](function(){return db[_0x2c23('0x116')]['findAll']({'where':{'id':{'$in':_0x5a2d98}}});})['then'](function(_0xc5ecc4){var _0x429330=_[_0x2c23('0x37')](_0xc5ecc4,function(_0x3f5fb2){return _0x3f5fb2[_0x2c23('0x119')]();});return Promise[_0x2c23('0x58')](_0x429330);})['then'](function(_0xd1dac1){_0x3faaa2=_[_0x2c23('0x11a')](_0xd1dac1);var _0x5b4f9e=_[_0x2c23('0x37')](_0x3faaa2,function(_0x19b36b){return _0x19b36b[_0x2c23('0x11b')](_0x5f0794['id'],{'transaction':_0x2e6ac9});});return Promise[_0x2c23('0x58')](_0x5b4f9e);})['then'](function(){if(!_0x5f0794[_0x2c23('0xad')])return;var _0x3c3f19=_[_0x2c23('0x35')](_0x3faaa2,function(_0x307ea4){return _0x307ea4[_0x2c23('0x11c')]('channel')==='Voice';});var _0x163786=_['map'](_0x3c3f19,function(_0x356f3d){return db['UserVoiceQueueRt'][_0x2c23('0xb3')]({'membername':_0x5f0794[_0x2c23('0x3b')],'UserId':_0x5f0794['id'],'queue_name':_0x356f3d['name'],'VoiceQueueId':_0x356f3d['id'],'interface':_[_0x2c23('0x70')](_0x5f0794['interface'])?util[_0x2c23('0xf3')](_0x2c23('0xaf'),_0x5f0794[_0x2c23('0x3b')]):_0x5f0794[_0x2c23('0xae')],'paused':_0x5f0794['voicePause']||![],'penalty':_0x5f0794[_0x2c23('0xb1')]},{'transaction':_0x2e6ac9});});return Promise[_0x2c23('0x58')](_0x163786);})[_0x2c23('0x19')](function(){return db['TeamVoicePrefix'][_0x2c23('0x4e')]({'where':{'teamId':{'$in':_0x5a2d98}}});})[_0x2c23('0x19')](function(_0x502a6f){var _0x2f559b=_['map'](_0x502a6f,function(_0x22fcfa){return db[_0x2c23('0x11d')][_0x2c23('0x85')]({'UserId':_0x5f0794['id'],'VoicePrefixId':_0x22fcfa[_0x2c23('0x11e')]},{'transaction':_0x2e6ac9});});return Promise[_0x2c23('0x58')](_0x2f559b);});});})[_0x2c23('0x19')](function(){for(var _0x51fccd=0x0;_0x51fccd<_0x3faaa2['length'];_0x51fccd++){var _0x16f948=_0x3faaa2[_0x51fccd]['getDataValue']('channel');var _0x344c18=_0x16f948+_0x2c23('0xa8');socket[_0x2c23('0xa9')](_0x2c23('0x32')+_0x16f948+_0x2c23('0xaa'),{'UserId':_0x2d5f29,['queueField']:_0x3faaa2[_0x51fccd]['id']});}})[_0x2c23('0x19')](respondWithStatusCode(_0x5b6adb,null))[_0x2c23('0x59')](APIHandleError(_0x5b6adb));};exports[_0x2c23('0x11f')]=function(_0x2be5e,_0x1362ec){var _0x4d805d=_0x2be5e[_0x2c23('0x5b')]['id'];var _0xe602a3=null;if(_0x2be5e['query'][_0x2c23('0x6a')]){_0xe602a3=_[_0x2c23('0xb7')](_0x2be5e[_0x2c23('0x48')][_0x2c23('0x6a')])?_0x2be5e['query'][_0x2c23('0x6a')]:[_0x2be5e[_0x2c23('0x48')][_0x2c23('0x6a')]];}var _0x5eb061=[];return Promise[_0x2c23('0x117')]()[_0x2c23('0x19')](function(){if(!_0xe602a3)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2c23('0x19')](function(){return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0x4d805d}});})[_0x2c23('0x19')](function(_0x36c274){if(!_0x36c274)throw new APINotFoundError(util[_0x2c23('0xf3')](_0x2c23('0x114'),_0x2be5e[_0x2c23('0x5b')]['id']));return db[_0x2c23('0x73')][_0x2c23('0x118')](function(_0x2fdc72){return _0x36c274[_0x2c23('0x11f')](_0xe602a3,{'transaction':_0x2fdc72})[_0x2c23('0x19')](function(){return db[_0x2c23('0x116')][_0x2c23('0x4e')]({'where':{'id':{'$in':_0xe602a3}}});})[_0x2c23('0x19')](function(_0x5bc2e3){var _0x5326e4=_[_0x2c23('0x37')](_0x5bc2e3,function(_0x271044){return _0x271044[_0x2c23('0x119')]();});return Promise[_0x2c23('0x58')](_0x5326e4);})[_0x2c23('0x19')](function(_0xeeb51a){_0x5eb061=_[_0x2c23('0x11a')](_0xeeb51a);var _0x3ee5e7=_[_0x2c23('0x37')](_0x5eb061,function(_0x5ce24f){return _0x5ce24f[_0x2c23('0x120')](_0x36c274['id'],{'transaction':_0x2fdc72});});return Promise[_0x2c23('0x58')](_0x3ee5e7);})[_0x2c23('0x19')](function(){if(!_0x36c274[_0x2c23('0xad')])return;var _0x595504=_[_0x2c23('0x35')](_0x5eb061,function(_0x7b5454){return _0x7b5454['getDataValue']('channel')===_0x2c23('0x121');});var _0x319395=_['map'](_0x595504,function(_0x3ba9fa){return db[_0x2c23('0xb2')]['destroy']({'where':{'VoiceQueueId':_0x3ba9fa['id'],'UserId':_0x36c274['id']},'transaction':_0x2fdc72});});return Promise[_0x2c23('0x58')](_0x319395);})[_0x2c23('0x19')](function(){return db[_0x2c23('0x122')][_0x2c23('0x4e')]({'where':{'teamId':{'$in':_0xe602a3}}});})[_0x2c23('0x19')](function(_0x51e4d9){var _0x5697d6=_[_0x2c23('0x37')](_0x51e4d9,function(_0xa7e0f4){return db[_0x2c23('0x11d')]['destroy']({'where':{'UserId':_0x36c274['id'],'VoicePrefixId':_0xa7e0f4[_0x2c23('0x11e')]}},{'transaction':_0x2fdc72});});return Promise[_0x2c23('0x58')](_0x5697d6);});});})[_0x2c23('0x19')](function(){for(var _0x499740=0x0;_0x499740<_0x5eb061[_0x2c23('0x51')];_0x499740++){var _0x27e641=_0x5eb061[_0x499740][_0x2c23('0x11c')](_0x2c23('0xa0'));var _0x3b9003=_0x27e641+_0x2c23('0xa8');socket['emit']('user'+_0x27e641+'Queue:remove',{'UserId':_0x4d805d,['queueField']:_0x5eb061[_0x499740]['id']});}})['then'](respondWithStatusCode(_0x1362ec,null))['catch'](APIHandleError(_0x1362ec));};exports['getLists']=function(_0xa1900c,_0x3ebb47){var _0x439af3={};var _0x4c8eaf={};var _0x22fb79;var _0xc17646;return db[_0x2c23('0x46')][_0x2c23('0xcf')]({'where':{'id':_0xa1900c[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x3ebb47,null))['then'](function(_0x5eb353){if(_0x5eb353){_0x22fb79=_0x5eb353;_0x4c8eaf['model']=_[_0x2c23('0x5e')](db[_0x2c23('0x123')][_0x2c23('0x40')]);_0x4c8eaf['query']=_[_0x2c23('0x5e')](_0xa1900c[_0x2c23('0x48')]);_0x4c8eaf[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x4c8eaf[_0x2c23('0x5c')],_0x4c8eaf[_0x2c23('0x48')]);_0x439af3[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x4c8eaf['model'],qs[_0x2c23('0x61')](_0xa1900c['query'][_0x2c23('0x61')]));_0x439af3['attributes']=_0x439af3[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x439af3[_0x2c23('0x4c')]:_0x4c8eaf[_0x2c23('0x5c')];_0x439af3[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0xa1900c['query'][_0x2c23('0xd2')]);_0x439af3['where']=qs[_0x2c23('0x5f')](_[_0x2c23('0xd4')](_0xa1900c[_0x2c23('0x48')],_0x4c8eaf[_0x2c23('0x5f')]));if(_0xa1900c['query'][_0x2c23('0x35')]){_0x439af3['where']=_[_0x2c23('0x63')](_0x439af3[_0x2c23('0xd3')],{'$or':_['map'](_0x439af3[_0x2c23('0x4c')],function(_0x21c242){var _0x46c1af={};_0x46c1af[_0x21c242]={'$like':'%'+_0xa1900c[_0x2c23('0x48')][_0x2c23('0x35')]+'%'};return _0x46c1af;})});}_0x439af3=_[_0x2c23('0x63')]({},_0x439af3,_0xa1900c['options']);return _0x22fb79[_0x2c23('0x124')](_0x439af3);}})[_0x2c23('0x19')](function(_0x531be0){if(_0x531be0){_0xc17646=_0x531be0[_0x2c23('0x51')];if(!_0xa1900c[_0x2c23('0x48')][_0x2c23('0xd5')](_0x2c23('0xda'))){_0x439af3[_0x2c23('0x28')]=qs[_0x2c23('0x28')](_0xa1900c['query'][_0x2c23('0x28')]);_0x439af3[_0x2c23('0x26')]=qs[_0x2c23('0x26')](_0xa1900c[_0x2c23('0x48')][_0x2c23('0x26')]);}return _0x22fb79[_0x2c23('0x124')](_0x439af3);}})['then'](function(_0x35c821){if(_0x35c821){return _0x35c821?{'count':_0xc17646,'rows':_0x35c821}:null;}})['then'](respondWithResult(_0x3ebb47,null))[_0x2c23('0x59')](handleError(_0x3ebb47,null));};exports[_0x2c23('0x125')]=function(_0x3e6e8c,_0x4ec93b){var _0x300aa4={};var _0x379051={};var _0x1547c5;return db['User'][_0x2c23('0xcf')]({'where':{'id':_0x3e6e8c[_0x2c23('0x5b')]['id']}})[_0x2c23('0x19')](handleEntityNotFound(_0x4ec93b,null))[_0x2c23('0x19')](function(_0x10479b){if(_0x10479b){_0x1547c5=_0x10479b;_0x379051['model']=_[_0x2c23('0x5e')](db[_0x2c23('0x46')]['rawAttributes']);_0x379051[_0x2c23('0x48')]=_['keys'](_0x3e6e8c[_0x2c23('0x48')]);_0x379051[_0x2c23('0x5f')]=_[_0x2c23('0x60')](_0x379051['model'],_0x379051[_0x2c23('0x48')]);_0x300aa4[_0x2c23('0x4c')]=_[_0x2c23('0x60')](_0x379051['model'],qs[_0x2c23('0x61')](_0x3e6e8c[_0x2c23('0x48')][_0x2c23('0x61')]));_0x300aa4[_0x2c23('0x4c')]=_0x300aa4[_0x2c23('0x4c')][_0x2c23('0x51')]?_0x300aa4['attributes']:_0x379051[_0x2c23('0x5c')];_0x300aa4[_0x2c23('0xd1')]=qs[_0x2c23('0xd2')](_0x3e6e8c[_0x2c23('0x48')][_0x2c23('0xd2')]);_0x300aa4['where']=qs[_0x2c23('0x5f')](_['pick'](_0x3e6e8c[_0x2c23('0x48')],_0x379051[_0x2c23('0x5f')]));if(_0x3e6e8c['query'][_0x2c23('0x35')]){_0x300aa4[_0x2c23('0xd3')]=_[_0x2c23('0x63')](_0x300aa4['where'],{'$or':_[_0x2c23('0x37')](_0x300aa4['attributes'],function(_0x5ed7de){var _0x46ea0f={};_0x46ea0f[_0x5ed7de]={'$like':'%'+_0x3e6e8c[_0x2c23('0x48')][_0x2c23('0x35')]+'%'};return _0x46ea0f;})});}_0x300aa4[_0x2c23('0x5c')]=db[_0x2c23('0x46')];_0x300aa4['as']=_0x2c23('0x33');_0x300aa4=_[_0x2c23('0x63')]({},_0x300aa4,_0x3e6e8c[_0x2c23('0x64')]);return _0x1547c5[_0x2c23('0xfa')]({'include':[_0x300aa4]});}})[_0x2c23('0x19')](function(_0xc50a73){if(_0xc50a73){var _0x351db7={},_0x52b9d7=[];for(var _0x5a30bc=0x0;_0x5a30bc<_0xc50a73[_0x2c23('0x51')];_0x5a30bc+=0x1){for(var _0x4b48da=0x0,_0x584d3a;_0x4b48da<_0xc50a73[_0x5a30bc][_0x2c23('0x33')][_0x2c23('0x51')];_0x4b48da+=0x1){_0x584d3a=_0xc50a73[_0x5a30bc]['Agents'][_0x4b48da][_0x2c23('0x2f')]({'plain':!![]});_0x351db7[_0x584d3a['id']]=_0x584d3a;}}_0x351db7=_[_0x2c23('0x126')](_0x351db7);for(var _0x59a6b9=qs[_0x2c23('0x26')](_0x3e6e8c[_0x2c23('0x48')][_0x2c23('0x26')]);_0x59a6b9<_0x351db7[_0x2c23('0x51')]&&_0x52b9d7[_0x2c23('0x51')]=_0x1e9381[_0xbe4f('0x50')]){throw new Error(_0xbe4f('0x51'));}})[_0xbe4f('0x18')](function(){if(_0x3bbe90){return db[_0xbe4f('0x47')][_0xbe4f('0x48')]({'where':{'membername':_0x3bbe90[_0xbe4f('0x21')]},'individualHooks':!![]});}})[_0xbe4f('0x18')](function(){if(_0x3bbe90){return _0x3bbe90[_0xbe4f('0x52')]({'raw':!![]});}})[_0xbe4f('0x18')](function(_0x2f0e58){if(_0x3bbe90){if(_0x2f0e58){var _0x2c6458=[];_0x59fc57=_0x2f0e58;if(_0x59fc57[_0xbe4f('0x28')]){for(var _0x2291eb=0x0;_0x2291eb<_0x59fc57[_0xbe4f('0x28')];_0x2291eb++){_0x2c6458[_0xbe4f('0x2b')](db[_0xbe4f('0x47')]['upsert']({'membername':_0x3bbe90['name'],'UserId':_0x3bbe90['id'],'queue_name':_0x59fc57[_0x2291eb][_0xbe4f('0x21')],'VoiceQueueId':_0x59fc57[_0x2291eb]['id'],'interface':_0x561cf7,'paused':_0x3bbe90[_0xbe4f('0x4d')]||![],'penalty':_0x59fc57[_0x2291eb][_0xbe4f('0x53')]||0x0}));}return BPromise[_0xbe4f('0x49')](_0x2c6458);}}}})[_0xbe4f('0x18')](function(){if(_0x3bbe90){return db[_0xbe4f('0x32')][_0xbe4f('0x10')]({'where':{'membername':_0x3bbe90[_0xbe4f('0x21')],'exitAt':null}});}})['then'](function(_0x5ad08a){if(_0x3bbe90){if(_0x5ad08a&&_0x5ad08a[_0xbe4f('0x28')]){var _0x3c4466=[];_0x5ad08a[_0xbe4f('0x2a')](function(_0x4b3086){_0x3c4466[_0xbe4f('0x2b')](_0x4b3086[_0xbe4f('0x34')]({'exitAt':moment()[_0xbe4f('0x25')](_0xbe4f('0x35'))}));});return BPromise['all'](_0x3c4466);}}})[_0xbe4f('0x18')](function(){if(_0x3bbe90){var _0x2a2a05=[];var _0x563532=[];var _0x39e4bb=utils[_0xbe4f('0x29')]();var _0x409dc3={'membername':_0x3bbe90[_0xbe4f('0x21')],'interface':_0x561cf7,'enterAt':moment()[_0xbe4f('0x25')](_0xbe4f('0x35')),'role':_0x3bbe90[_0xbe4f('0x22')],'internal':_0x3bbe90[_0xbe4f('0x23')]};_0x39e4bb['forEach'](function(_0x4d1fbd){_0x2a2a05['push'](_[_0xbe4f('0x54')]({'channel':_0x4d1fbd,'type':'LOGIN','data1':_0xbe4f('0x55'),'data2':_0x561cf7},_0x409dc3));if(_0x3bbe90[_0xbe4f('0x4d')]){_0x563532[_0xbe4f('0x2b')](_['merge']({'channel':_0x4d1fbd,'type':_0xbe4f('0x27'),'data1':'LOGININPAUSE'},_0x409dc3));}});return db[_0xbe4f('0x32')][_0xbe4f('0x33')](_0x2a2a05[_0xbe4f('0x56')](_0x563532),{'individualHooks':!![]});}})[_0xbe4f('0x18')](function(){if(_0x3bbe90){return _0x3bbe90['update']({'online':!![],'lastLoginAt':moment()[_0xbe4f('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3bbe90['loginInPause']||![],'mailPause':_0x3bbe90[_0xbe4f('0x4d')]||![],'chatPause':_0x3bbe90[_0xbe4f('0x4d')]||![],'faxPause':_0x3bbe90[_0xbe4f('0x4d')]||![],'smsPause':_0x3bbe90[_0xbe4f('0x4d')]||![],'openchannelPause':_0x3bbe90[_0xbe4f('0x4d')]||![],'pauseType':_0x3bbe90[_0xbe4f('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xbe4f('0x35')),'interface':_0x561cf7});}})[_0xbe4f('0x18')](function(_0x2ced79){_0x20dae5(_0x2ced79);})['catch'](function(_0x41e455){_0x445df7(_0x39a34a[_0xbe4f('0x1b')](0x1f4,_0x41e455[_0xbe4f('0x1c')]));});});}; \ No newline at end of file +var _0x78ab=['smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','forEach','all','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','where','attributes','limit','map','include','model','info','GetUser','debug','stringify','catch','error','message','ShowUser','find','raw','then','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause'];(function(_0x489e60,_0x9db44){var _0x91b943=function(_0x5f471a){while(--_0x5f471a){_0x489e60['push'](_0x489e60['shift']());}};_0x91b943(++_0x9db44);}(_0x78ab,0x1d5));var _0xb78a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x78ab[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xb78a('0x0'));var util=require(_0xb78a('0x1'));var moment=require(_0xb78a('0x2'));var BPromise=require(_0xb78a('0x3'));var Redis=require(_0xb78a('0x4'));var db=require(_0xb78a('0x5'))['db'];var utils=require(_0xb78a('0x6'));var logger=require(_0xb78a('0x7'))('rpc');var config=require(_0xb78a('0x8'));config[_0xb78a('0x9')]=_[_0xb78a('0xa')](config[_0xb78a('0x9')],{'host':_0xb78a('0xb'),'port':0x18eb});var socket=require(_0xb78a('0xc'))(new Redis(config[_0xb78a('0x9')]));require(_0xb78a('0xd'))[_0xb78a('0xe')](socket);exports['GetUser']=function(_0x587997){var _0x10038d=this;return new Promise(function(_0x2d9938,_0x38e7a7){return db[_0xb78a('0xf')][_0xb78a('0x10')]({'raw':_0x587997[_0xb78a('0x11')]?_0x587997[_0xb78a('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x587997[_0xb78a('0x11')]?_0x587997[_0xb78a('0x11')][_0xb78a('0x12')]||null:null,'attributes':_0x587997[_0xb78a('0x11')]?_0x587997[_0xb78a('0x11')][_0xb78a('0x13')]||null:null,'limit':_0x587997[_0xb78a('0x11')]?_0x587997[_0xb78a('0x11')][_0xb78a('0x14')]||null:null,'include':_0x587997[_0xb78a('0x11')]?_0x587997[_0xb78a('0x11')]['include']?_[_0xb78a('0x15')](_0x587997['options'][_0xb78a('0x16')],function(_0xbfe104){return{'model':db[_0xbfe104[_0xb78a('0x17')]],'as':_0xbfe104['as'],'attributes':_0xbfe104[_0xb78a('0x13')],'include':_0xbfe104[_0xb78a('0x16')]?_[_0xb78a('0x15')](_0xbfe104['include'],function(_0x2590d9){return{'model':db[_0x2590d9[_0xb78a('0x17')]],'as':_0x2590d9['as'],'attributes':_0x2590d9[_0xb78a('0x13')],'include':_0x2590d9[_0xb78a('0x16')]?_['map'](_0x2590d9[_0xb78a('0x16')],function(_0x5feede){return{'model':db[_0x5feede['model']],'as':_0x5feede['as'],'attributes':_0x5feede[_0xb78a('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1860ac){logger[_0xb78a('0x18')](_0xb78a('0x19'),_0x587997);logger[_0xb78a('0x1a')](_0xb78a('0x19'),_0x587997,JSON[_0xb78a('0x1b')](_0x1860ac));_0x2d9938(_0x1860ac);})[_0xb78a('0x1c')](function(_0x3d397f){logger['error'](_0xb78a('0x19'),_0x3d397f['message'],_0x587997);_0x38e7a7(_0x10038d[_0xb78a('0x1d')](0x1f4,_0x3d397f[_0xb78a('0x1e')]));});});};exports[_0xb78a('0x1f')]=function(_0x3ae43a){var _0x544453=this;return new Promise(function(_0x36db25,_0x2d91f3){return db[_0xb78a('0xf')][_0xb78a('0x20')]({'raw':_0x3ae43a[_0xb78a('0x11')]?_0x3ae43a['options'][_0xb78a('0x21')]===undefined?!![]:![]:!![],'where':_0x3ae43a[_0xb78a('0x11')]?_0x3ae43a['options']['where']||null:null,'attributes':_0x3ae43a['options']?_0x3ae43a[_0xb78a('0x11')][_0xb78a('0x13')]||null:null,'include':_0x3ae43a[_0xb78a('0x11')]?_0x3ae43a['options'][_0xb78a('0x16')]?_[_0xb78a('0x15')](_0x3ae43a[_0xb78a('0x11')][_0xb78a('0x16')],function(_0x5892d8){return{'model':db[_0x5892d8[_0xb78a('0x17')]],'as':_0x5892d8['as'],'attributes':_0x5892d8['attributes'],'include':_0x5892d8[_0xb78a('0x16')]?_[_0xb78a('0x15')](_0x5892d8[_0xb78a('0x16')],function(_0x363b51){return{'model':db[_0x363b51[_0xb78a('0x17')]],'as':_0x363b51['as'],'attributes':_0x363b51[_0xb78a('0x13')],'include':_0x363b51[_0xb78a('0x16')]?_['map'](_0x363b51[_0xb78a('0x16')],function(_0x140910){return{'model':db[_0x140910[_0xb78a('0x17')]],'as':_0x140910['as'],'attributes':_0x140910[_0xb78a('0x13')]};}):[]};}):[]};}):[]:[]})[_0xb78a('0x22')](function(_0x507998){logger[_0xb78a('0x18')](_0xb78a('0x1f'),_0x3ae43a);logger[_0xb78a('0x1a')](_0xb78a('0x1f'),_0x3ae43a,JSON[_0xb78a('0x1b')](_0x507998));_0x36db25(_0x507998);})[_0xb78a('0x1c')](function(_0x2947cb){logger['error'](_0xb78a('0x1f'),_0x2947cb[_0xb78a('0x1e')],_0x3ae43a);_0x2d91f3(_0x544453[_0xb78a('0x1d')](0x1f4,_0x2947cb[_0xb78a('0x1e')]));});});};exports[_0xb78a('0x23')]=function(_0x2ceeda){var _0x3366a5;return db[_0xb78a('0xf')][_0xb78a('0x20')]({'where':_0x2ceeda['options'][_0xb78a('0x12')]||{},'attributes':['id',_0xb78a('0x24'),_0xb78a('0x25'),_0xb78a('0x26'),_0xb78a('0x27')]})[_0xb78a('0x22')](function(_0xcd9367){if(!_0xcd9367){throw new Error(util[_0xb78a('0x28')](_0xb78a('0x29'),_0x2ceeda[_0xb78a('0x2a')]['id']));}_0x3366a5=_0xcd9367;return db[_0xb78a('0x2b')][_0xb78a('0x2c')]({'paused':0x1},{'where':{'UserId':_0x3366a5['id']},'individualHooks':!![]});})[_0xb78a('0x22')](function(){return db[_0xb78a('0x2d')][_0xb78a('0x10')]({'where':{'membername':_0x3366a5[_0xb78a('0x24')],'type':_0xb78a('0x2e'),'exitAt':null}});})['then'](function(_0x3943cf){if(_0x3943cf&&_0x3943cf[_0xb78a('0x2f')]){var _0x512067=moment()['format'](_0xb78a('0x30'));for(var _0x2e8998=0x0,_0xd6720b=_0x3943cf['length'];_0x2e8998<_0xd6720b;_0x2e8998++){_0x3943cf[_0x2e8998][_0xb78a('0x31')]({'exitAt':_0x512067});}}})[_0xb78a('0x22')](function(){var _0x255301=[];var _0x3a0487=utils[_0xb78a('0x32')]();_0x3a0487['forEach'](function(_0x1b6a0e){_0x255301[_0xb78a('0x33')]({'channel':_0x1b6a0e,'membername':_0x3366a5[_0xb78a('0x24')],'interface':_[_0xb78a('0x34')](_0x3366a5[_0xb78a('0x27')])?util[_0xb78a('0x28')](_0xb78a('0x35'),_0x3366a5[_0xb78a('0x24')]):_0x3366a5[_0xb78a('0x27')],'type':_0xb78a('0x2e'),'enterAt':moment()[_0xb78a('0x28')](_0xb78a('0x30')),'data1':_0x2ceeda[_0xb78a('0x36')][_0xb78a('0x37')]||_0xb78a('0x38'),'role':_0x3366a5[_0xb78a('0x25')],'internal':_0x3366a5[_0xb78a('0x26')],'uniqueid':_0x2ceeda[_0xb78a('0x36')][_0xb78a('0x39')]||null});});return db[_0xb78a('0x2d')][_0xb78a('0x3a')](_0x255301,{'individualHooks':!![]});})[_0xb78a('0x22')](function(){return _0x3366a5[_0xb78a('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2ceeda[_0xb78a('0x36')][_0xb78a('0x37')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb78a('0x28')](_0xb78a('0x30'))});})['catch'](function(_0xd38c26){throw _0xd38c26;});};exports[_0xb78a('0x3b')]=function(_0x26d2fe){return Promise[_0xb78a('0x3c')]()[_0xb78a('0x22')](function(){if(_0x26d2fe[_0xb78a('0x36')]['channel']&&!utils[_0xb78a('0x3d')](_0x26d2fe[_0xb78a('0x36')][_0xb78a('0x3e')])){throw new Error(util[_0xb78a('0x28')](_0xb78a('0x3f'),_0x26d2fe[_0xb78a('0x36')][_0xb78a('0x3e')]));}return db['User'][_0xb78a('0x40')]({'where':_0x26d2fe[_0xb78a('0x11')]['where']||{},'attributes':['id','name',_0xb78a('0x25'),'internal',_0xb78a('0x27'),_0xb78a('0x41'),_0xb78a('0x42'),_0xb78a('0x43'),_0xb78a('0x44'),_0xb78a('0x45'),_0xb78a('0x46'),_0xb78a('0x47'),_0xb78a('0x48'),_0xb78a('0x49'),'lastPauseAt']});})[_0xb78a('0x22')](function(_0x2f634a){if(!_0x2f634a){throw new Error(util[_0xb78a('0x28')](_0xb78a('0x29'),_0x26d2fe[_0xb78a('0x2a')]['id']));}return _0x2f634a[_0xb78a('0x4a')](_0x26d2fe[_0xb78a('0x36')][_0xb78a('0x3e')],_0xb78a('0x4b'));})[_0xb78a('0x1c')](function(_0x5a2c0d){throw _0x5a2c0d;});};exports[_0xb78a('0x4c')]=function(_0x1c6cac){var _0x487632=this;return new Promise(function(_0x1ebc06,_0x3e8ffa){var _0x447c48;return db[_0xb78a('0xf')][_0xb78a('0x40')]({'where':_0x1c6cac[_0xb78a('0x11')][_0xb78a('0x12')]||{},'attributes':['id',_0xb78a('0x24')]})[_0xb78a('0x22')](function(_0x1c45ad){if(_0x1c45ad){_0x447c48=_0x1c45ad;return db[_0xb78a('0x2b')]['destroy']({'where':{'membername':_0x447c48['name']},'individualHooks':!![]});}})['then'](function(){if(_0x447c48){return db[_0xb78a('0x2d')]['findAll']({'where':{'membername':_0x447c48[_0xb78a('0x24')],'exitAt':null}});}})['then'](function(_0x280c45){if(_0x447c48){if(_0x280c45&&_0x280c45[_0xb78a('0x2f')]){var _0x1a1b15=[];_0x280c45[_0xb78a('0x4d')](function(_0x5b33f3){_0x1a1b15[_0xb78a('0x33')](_0x5b33f3[_0xb78a('0x2c')]({'exitAt':moment()[_0xb78a('0x28')](_0xb78a('0x30'))}));});return BPromise[_0xb78a('0x4e')](_0x1a1b15);}}})[_0xb78a('0x22')](function(){if(_0x447c48){return _0x447c48['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xb78a('0x22')](function(_0x205950){_0x1ebc06(_0x205950);})[_0xb78a('0x1c')](function(_0x530a1b){_0x3e8ffa(_0x487632[_0xb78a('0x1d')](0x1f4,_0x530a1b['message']));});});};exports['LoginUser']=function(_0x3ec456){var _0x265c36=this;return new Promise(function(_0x75b672,_0x12f4ac){var _0x43dcc1;var _0xd7dbf6;var _0x3df498;var _0x272036;return db['User'][_0xb78a('0x40')]({'where':_0x3ec456[_0xb78a('0x11')][_0xb78a('0x12')]||{},'attributes':['id',_0xb78a('0x24'),_0xb78a('0x25'),'mobile','phone',_0xb78a('0x26'),_0xb78a('0x4f'),_0xb78a('0x27')]})['then'](function(_0x50b443){if(_0x50b443){_0x43dcc1=_0x50b443;_0x272036=_0x3ec456['body'][_0xb78a('0x27')]?_0x3ec456[_0xb78a('0x36')][_0xb78a('0x27')]:util[_0xb78a('0x28')](_0xb78a('0x35'),_0x43dcc1[_0xb78a('0x24')]);return db[_0xb78a('0xf')][_0xb78a('0x50')]({'where':{'role':_0xb78a('0x51'),'online':!![],'id':{'$ne':_0x43dcc1['id']}}});}})[_0xb78a('0x22')](function(_0x4a95e4){if(_0x4a95e4){_0x3df498=_0x4a95e4;return require('../../config/license/util')[_0xb78a('0x52')]();}})[_0xb78a('0x22')](function(_0x431cbd){if(_0x431cbd&&_0x431cbd['agents']&&_0x3df498>=_0x431cbd[_0xb78a('0x53')]){throw new Error(_0xb78a('0x54'));}})[_0xb78a('0x22')](function(){if(_0x43dcc1){return db[_0xb78a('0x2b')]['destroy']({'where':{'membername':_0x43dcc1[_0xb78a('0x24')]},'individualHooks':!![]});}})['then'](function(){if(_0x43dcc1){return _0x43dcc1[_0xb78a('0x55')]({'raw':!![]});}})[_0xb78a('0x22')](function(_0x61407b){if(_0x43dcc1){if(_0x61407b){var _0x3aa23c=[];_0xd7dbf6=_0x61407b;if(_0xd7dbf6[_0xb78a('0x2f')]){for(var _0x3b7747=0x0;_0x3b7747<_0xd7dbf6[_0xb78a('0x2f')];_0x3b7747++){_0x3aa23c[_0xb78a('0x33')](db[_0xb78a('0x2b')]['upsert']({'membername':_0x43dcc1[_0xb78a('0x24')],'UserId':_0x43dcc1['id'],'queue_name':_0xd7dbf6[_0x3b7747][_0xb78a('0x24')],'VoiceQueueId':_0xd7dbf6[_0x3b7747]['id'],'interface':_0x272036,'paused':_0x43dcc1['loginInPause']||![],'penalty':_0xd7dbf6[_0x3b7747][_0xb78a('0x56')]||0x0}));}return BPromise[_0xb78a('0x4e')](_0x3aa23c);}}}})['then'](function(){if(_0x43dcc1){return db[_0xb78a('0x2d')][_0xb78a('0x10')]({'where':{'membername':_0x43dcc1['name'],'exitAt':null}});}})[_0xb78a('0x22')](function(_0x347f5e){if(_0x43dcc1){if(_0x347f5e&&_0x347f5e[_0xb78a('0x2f')]){var _0x46d97c=[];_0x347f5e[_0xb78a('0x4d')](function(_0x4b2433){_0x46d97c[_0xb78a('0x33')](_0x4b2433[_0xb78a('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb78a('0x4e')](_0x46d97c);}}})[_0xb78a('0x22')](function(){if(_0x43dcc1){var _0x1c572f=[];var _0x2d7be1=[];var _0x46f666=utils[_0xb78a('0x32')]();var _0x1ec0bb={'membername':_0x43dcc1[_0xb78a('0x24')],'interface':_0x272036,'enterAt':moment()[_0xb78a('0x28')](_0xb78a('0x30')),'role':_0x43dcc1[_0xb78a('0x25')],'internal':_0x43dcc1[_0xb78a('0x26')]};_0x46f666[_0xb78a('0x4d')](function(_0x135787){_0x1c572f[_0xb78a('0x33')](_[_0xb78a('0x57')]({'channel':_0x135787,'type':'LOGIN','data1':_0xb78a('0x58'),'data2':_0x272036},_0x1ec0bb));if(_0x43dcc1[_0xb78a('0x4f')]){_0x2d7be1['push'](_[_0xb78a('0x57')]({'channel':_0x135787,'type':_0xb78a('0x2e'),'data1':_0xb78a('0x59')},_0x1ec0bb));}});return db['MemberReport'][_0xb78a('0x3a')](_0x1c572f['concat'](_0x2d7be1),{'individualHooks':!![]});}})[_0xb78a('0x22')](function(){if(_0x43dcc1){return _0x43dcc1[_0xb78a('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xb78a('0x28')](_0xb78a('0x30')),'voicePause':_0x43dcc1[_0xb78a('0x4f')]||![],'mailPause':_0x43dcc1[_0xb78a('0x4f')]||![],'chatPause':_0x43dcc1[_0xb78a('0x4f')]||![],'faxPause':_0x43dcc1['loginInPause']||![],'smsPause':_0x43dcc1[_0xb78a('0x4f')]||![],'openchannelPause':_0x43dcc1[_0xb78a('0x4f')]||![],'pauseType':_0x43dcc1[_0xb78a('0x4f')]?_0xb78a('0x59'):null,'lastPauseAt':moment()[_0xb78a('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x272036});}})['then'](function(_0x27e7d8){_0x75b672(_0x27e7d8);})[_0xb78a('0x1c')](function(_0x52a8b5){_0x12f4ac(_0x265c36[_0xb78a('0x1d')](0x1f4,_0x52a8b5[_0xb78a('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a0c64e3..c042b70 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 _0xb5af=['./user.events','emit','register','length','user:'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xb5af,0x1ea));var _0xfb5a=function(_0x31e264,_0x17235e){_0x31e264=_0x31e264-0x0;var _0x367f9b=_0xb5af[_0x31e264];return _0x367f9b;};'use strict';var UserEvents=require(_0xfb5a('0x0'));var events=['save','remove','update'];function createListener(_0x5e9823,_0x5be92e){return function(_0x38f8ac){_0x5be92e[_0xfb5a('0x1')](_0x5e9823,_0x38f8ac);};}function removeListener(_0x4d3769,_0x52c298){return function(){UserEvents['removeListener'](_0x4d3769,_0x52c298);};}exports[_0xfb5a('0x2')]=function(_0x13eb23){for(var _0x3c2a5d=0x0,_0x58d13a=events[_0xfb5a('0x3')];_0x3c2a5d<_0x58d13a;_0x3c2a5d++){var _0x3a7271=events[_0x3c2a5d];var _0x5595b6=createListener(_0xfb5a('0x4')+_0x3a7271,_0x13eb23);UserEvents['on'](_0x3a7271,_0x5595b6);}}; \ No newline at end of file +var _0xd242=['emit','register','user:','./user.events','remove','update'];(function(_0x9a9cc7,_0x3778d2){var _0x1ca6f6=function(_0x28e10a){while(--_0x28e10a){_0x9a9cc7['push'](_0x9a9cc7['shift']());}};_0x1ca6f6(++_0x3778d2);}(_0xd242,0xdb));var _0x2d24=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xd242[_0x421e36];return _0x20b3e3;};'use strict';var UserEvents=require(_0x2d24('0x0'));var events=['save',_0x2d24('0x1'),_0x2d24('0x2')];function createListener(_0x538e89,_0x3c46e1){return function(_0x547c88){_0x3c46e1[_0x2d24('0x3')](_0x538e89,_0x547c88);};}function removeListener(_0x2ca4c6,_0x25f410){return function(){UserEvents['removeListener'](_0x2ca4c6,_0x25f410);};}exports[_0x2d24('0x4')]=function(_0x315967){for(var _0x5adc10=0x0,_0xc78b2=events['length'];_0x5adc10<_0xc78b2;_0x5adc10++){var _0x4ef60a=events[_0x5adc10];var _0x573f19=createListener(_0x2d24('0x5')+_0x4ef60a,_0x315967);UserEvents['on'](_0x4ef60a,_0x573f19);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0f130b8..7160544 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x220828,_0x3296a3){var _0x38e4f1=function(_0x5c436e){while(--_0x5c436e){_0x220828['push'](_0x220828['shift']());}};_0x38e4f1(++_0x3296a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0xcb91[_0xad57ee];return _0x3eaea9;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1b65fa,_0x525365){var _0x2e3e6b=function(_0x2affef){while(--_0x2affef){_0x1b65fa['push'](_0x1b65fa['shift']());}};_0x2e3e6b(++_0x525365);}(_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 9edd3c9..5365d14 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 _0xc01b=['exports','INTEGER','sequelize'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc01b,0x74));var _0xbc01=function(_0x474e3e,_0x101580){_0x474e3e=_0x474e3e-0x0;var _0x3f9ac9=_0xc01b[_0x474e3e];return _0x3f9ac9;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'penalty':{'type':Sequelize[_0xbc01('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe660=['exports','INTEGER'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xe660,0xde));var _0x0e66=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0xe660[_0x409fb8];return _0x278270;};'use strict';var Sequelize=require('sequelize');module[_0x0e66('0x0')]={'penalty':{'type':Sequelize[_0x0e66('0x1')],'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 0a583c8..a5cebb9 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 _0x03a0=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x3eb420,_0x37df83){var _0x46b831=function(_0x5b0923){while(--_0x5b0923){_0x3eb420['push'](_0x3eb420['shift']());}};_0x46b831(++_0x37df83);}(_0x03a0,0x110));var _0x003a=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x03a0[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x003a('0x0'));var util=require(_0x003a('0x1'));var logger=require(_0x003a('0x2'))(_0x003a('0x3'));var moment=require(_0x003a('0x4'));var BPromise=require('bluebird');var rp=require(_0x003a('0x5'));var fs=require('fs');var path=require(_0x003a('0x6'));var rimraf=require(_0x003a('0x7'));var config=require(_0x003a('0x8'));var attributes=require(_0x003a('0x9'));module[_0x003a('0xa')]=function(_0x1dab9c,_0x4e414b){return _0x1dab9c['define'](_0x003a('0xb'),attributes,{'tableName':_0x003a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafbe=['UserChatQueue','user_has_chat_queues','lodash','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3ef1a3,_0x3f0b11){var _0x6d8b5b=function(_0x18f8de){while(--_0x18f8de){_0x3ef1a3['push'](_0x3ef1a3['shift']());}};_0x6d8b5b(++_0x3f0b11);}(_0xafbe,0x1b0));var _0xeafb=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xafbe[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0xeafb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeafb('0x1'));var BPromise=require(_0xeafb('0x2'));var rp=require(_0xeafb('0x3'));var fs=require('fs');var path=require(_0xeafb('0x4'));var rimraf=require('rimraf');var config=require(_0xeafb('0x5'));var attributes=require('./userChatQueue.attributes');module[_0xeafb('0x6')]=function(_0x22aadd,_0x4939b5){return _0x22aadd[_0xeafb('0x7')](_0xeafb('0x8'),attributes,{'tableName':_0xeafb('0x9'),'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 f2dcbc9..be7e00d 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 _0x3c04=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5c7eef,_0x5cfbdb){var _0xd9ddba=function(_0xcff233){while(--_0xcff233){_0x5c7eef['push'](_0x5c7eef['shift']());}};_0xd9ddba(++_0x5cfbdb);}(_0x3c04,0x18f));var _0x43c0=function(_0x9d71c4,_0x4ffd6){_0x9d71c4=_0x9d71c4-0x0;var _0x586dc8=_0x3c04[_0x9d71c4];return _0x586dc8;};'use strict';var _=require(_0x43c0('0x0'));var util=require('util');var moment=require(_0x43c0('0x1'));var BPromise=require(_0x43c0('0x2'));var rs=require(_0x43c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43c0('0x4'));var logger=require(_0x43c0('0x5'))(_0x43c0('0x6'));var config=require('../../config/environment');var jayson=require(_0x43c0('0x7'));var client=jayson[_0x43c0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9366,_0x2fd28f,_0x4b6e1f){return new BPromise(function(_0x203b59,_0xff490){return client['request'](_0x2c9366,_0x4b6e1f)['then'](function(_0x1a97ad){logger['info'](_0x43c0('0x9'),_0x2fd28f,_0x43c0('0xa'));logger[_0x43c0('0xb')](_0x43c0('0xc'),_0x2fd28f,_0x43c0('0xa'),JSON[_0x43c0('0xd')](_0x1a97ad));if(_0x1a97ad['error']){if(_0x1a97ad[_0x43c0('0xe')][_0x43c0('0xf')]===0x1f4){logger[_0x43c0('0xe')](_0x43c0('0x9'),_0x2fd28f,_0x1a97ad[_0x43c0('0xe')][_0x43c0('0x10')]);return _0xff490(_0x1a97ad[_0x43c0('0xe')][_0x43c0('0x10')]);}logger['error'](_0x43c0('0x9'),_0x2fd28f,_0x1a97ad[_0x43c0('0xe')][_0x43c0('0x10')]);return _0x203b59(_0x1a97ad[_0x43c0('0xe')]['message']);}else{logger[_0x43c0('0x11')](_0x43c0('0x9'),_0x2fd28f,_0x43c0('0xa'));_0x203b59(_0x1a97ad[_0x43c0('0x12')][_0x43c0('0x10')]);}})[_0x43c0('0x13')](function(_0x3adbfb){logger[_0x43c0('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2fd28f,_0x3adbfb);_0xff490(_0x3adbfb);});});} \ No newline at end of file +var _0x5756=['UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info'];(function(_0x169d7f,_0x129afd){var _0x28e8c=function(_0x3918cd){while(--_0x3918cd){_0x169d7f['push'](_0x169d7f['shift']());}};_0x28e8c(++_0x129afd);}(_0x5756,0x81));var _0x6575=function(_0x586ad1,_0x3d4897){_0x586ad1=_0x586ad1-0x0;var _0x15005e=_0x5756[_0x586ad1];return _0x15005e;};'use strict';var _=require(_0x6575('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6575('0x1'));var fs=require('fs');var Redis=require(_0x6575('0x2'));var db=require(_0x6575('0x3'))['db'];var utils=require(_0x6575('0x4'));var logger=require(_0x6575('0x5'))(_0x6575('0x6'));var config=require(_0x6575('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55422a,_0x2cb59e,_0x7ae591){return new BPromise(function(_0x161672,_0x50a0d5){return client[_0x6575('0x8')](_0x55422a,_0x7ae591)[_0x6575('0x9')](function(_0x27bb78){logger[_0x6575('0xa')](_0x6575('0xb'),_0x2cb59e,'request\x20sent');logger[_0x6575('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2cb59e,_0x6575('0xd'),JSON[_0x6575('0xe')](_0x27bb78));if(_0x27bb78[_0x6575('0xf')]){if(_0x27bb78[_0x6575('0xf')][_0x6575('0x10')]===0x1f4){logger[_0x6575('0xf')](_0x6575('0xb'),_0x2cb59e,_0x27bb78['error'][_0x6575('0x11')]);return _0x50a0d5(_0x27bb78[_0x6575('0xf')][_0x6575('0x11')]);}logger[_0x6575('0xf')](_0x6575('0xb'),_0x2cb59e,_0x27bb78['error']['message']);return _0x161672(_0x27bb78[_0x6575('0xf')]['message']);}else{logger[_0x6575('0xa')](_0x6575('0xb'),_0x2cb59e,_0x6575('0xd'));_0x161672(_0x27bb78[_0x6575('0x12')][_0x6575('0x11')]);}})[_0x6575('0x13')](function(_0x21229a){logger[_0x6575('0xf')](_0x6575('0xb'),_0x2cb59e,_0x21229a);_0x50a0d5(_0x21229a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 35e145b..6c30435 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(_0x50e571,_0x4bc9b4){var _0x516533=function(_0x5020d9){while(--_0x5020d9){_0x50e571['push'](_0x50e571['shift']());}};_0x516533(++_0x4bc9b4);}(_0x70e0,0x17b));var _0x070e=function(_0x471cf7,_0x3b276d){_0x471cf7=_0x471cf7-0x0;var _0x72ef2b=_0x70e0[_0x471cf7];return _0x72ef2b;};'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(_0xb2002e,_0x36e95e){var _0x493b5a=function(_0x734c04){while(--_0x734c04){_0xb2002e['push'](_0xb2002e['shift']());}};_0x493b5a(++_0x36e95e);}(_0xe706,0xa3));var _0x6e70=function(_0x58d90a,_0x1a2ea6){_0x58d90a=_0x58d90a-0x0;var _0x3938a9=_0xe706[_0x58d90a];return _0x3938a9;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 60cf4a5..84fe9e3 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 _0x989e=['INTEGER','sequelize','exports'];(function(_0x1f7a32,_0x398729){var _0x2800e7=function(_0x40572a){while(--_0x40572a){_0x1f7a32['push'](_0x1f7a32['shift']());}};_0x2800e7(++_0x398729);}(_0x989e,0x178));var _0xe989=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x989e[_0x30f030];return _0xf7614f;};'use strict';var Sequelize=require(_0xe989('0x0'));module[_0xe989('0x1')]={'penalty':{'type':Sequelize[_0xe989('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe989('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b29=['INTEGER','STRING','sequelize','exports'];(function(_0x56a2a7,_0x43d5a9){var _0x46e4e4=function(_0x1515ca){while(--_0x1515ca){_0x56a2a7['push'](_0x56a2a7['shift']());}};_0x46e4e4(++_0x43d5a9);}(_0x5b29,0xde));var _0x95b2=function(_0x5cb89a,_0x3fcb3e){_0x5cb89a=_0x5cb89a-0x0;var _0x21bb4e=_0x5b29[_0x5cb89a];return _0x21bb4e;};'use strict';var Sequelize=require(_0x95b2('0x0'));module[_0x95b2('0x1')]={'penalty':{'type':Sequelize[_0x95b2('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x95b2('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x95b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e34dc12..3efccc9 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 _0xd79e=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','UserFaxQueue'];(function(_0x1822eb,_0x425130){var _0x1c53b1=function(_0x3943f9){while(--_0x3943f9){_0x1822eb['push'](_0x1822eb['shift']());}};_0x1c53b1(++_0x425130);}(_0xd79e,0x85));var _0xed79=function(_0x48b492,_0x1c5091){_0x48b492=_0x48b492-0x0;var _0x5eb0f1=_0xd79e[_0x48b492];return _0x5eb0f1;};'use strict';var _=require(_0xed79('0x0'));var util=require(_0xed79('0x1'));var logger=require(_0xed79('0x2'))(_0xed79('0x3'));var moment=require('moment');var BPromise=require(_0xed79('0x4'));var rp=require(_0xed79('0x5'));var fs=require('fs');var path=require(_0xed79('0x6'));var rimraf=require('rimraf');var config=require(_0xed79('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0xed79('0x8')]=function(_0x3eabfa,_0x3dad27){return _0x3eabfa[_0xed79('0x9')](_0xed79('0xa'),attributes,{'tableName':_0xed79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf191=['path','rimraf','../../config/environment','exports','UserFaxQueue','lodash','../../config/logger','bluebird','request-promise'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xf191,0x137));var _0x1f19=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0xf191[_0x10e653];return _0x328dfd;};'use strict';var _=require(_0x1f19('0x0'));var util=require('util');var logger=require(_0x1f19('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1f19('0x2'));var rp=require(_0x1f19('0x3'));var fs=require('fs');var path=require(_0x1f19('0x4'));var rimraf=require(_0x1f19('0x5'));var config=require(_0x1f19('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x1f19('0x7')]=function(_0x3c6767,_0x2cdaa1){return _0x3c6767['define'](_0x1f19('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 5e6b73f..dad1292 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 _0xbba7=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa33f90,_0x294a96){var _0x3e2ce6=function(_0x66c153){while(--_0x66c153){_0xa33f90['push'](_0xa33f90['shift']());}};_0x3e2ce6(++_0x294a96);}(_0xbba7,0x11b));var _0x7bba=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0xbba7[_0x25f805];return _0xf6628f;};'use strict';var _=require('lodash');var util=require(_0x7bba('0x0'));var moment=require(_0x7bba('0x1'));var BPromise=require('bluebird');var rs=require(_0x7bba('0x2'));var fs=require('fs');var Redis=require(_0x7bba('0x3'));var db=require(_0x7bba('0x4'))['db'];var utils=require(_0x7bba('0x5'));var logger=require(_0x7bba('0x6'))(_0x7bba('0x7'));var config=require(_0x7bba('0x8'));var jayson=require(_0x7bba('0x9'));var client=jayson[_0x7bba('0xa')][_0x7bba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5082ce,_0x57d874,_0x20cdfb){return new BPromise(function(_0x13382b,_0x456051){return client[_0x7bba('0xc')](_0x5082ce,_0x20cdfb)[_0x7bba('0xd')](function(_0x3c60cd){logger[_0x7bba('0xe')](_0x7bba('0xf'),_0x57d874,_0x7bba('0x10'));logger['debug'](_0x7bba('0x11'),_0x57d874,_0x7bba('0x10'),JSON[_0x7bba('0x12')](_0x3c60cd));if(_0x3c60cd[_0x7bba('0x13')]){if(_0x3c60cd['error']['code']===0x1f4){logger[_0x7bba('0x13')](_0x7bba('0xf'),_0x57d874,_0x3c60cd['error'][_0x7bba('0x14')]);return _0x456051(_0x3c60cd[_0x7bba('0x13')]['message']);}logger[_0x7bba('0x13')](_0x7bba('0xf'),_0x57d874,_0x3c60cd[_0x7bba('0x13')]['message']);return _0x13382b(_0x3c60cd[_0x7bba('0x13')][_0x7bba('0x14')]);}else{logger[_0x7bba('0xe')](_0x7bba('0xf'),_0x57d874,_0x7bba('0x10'));_0x13382b(_0x3c60cd['result']['message']);}})['catch'](function(_0x16a7de){logger[_0x7bba('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x57d874,_0x16a7de);_0x456051(_0x16a7de);});});} \ No newline at end of file +var _0x79f5=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x79f5,0x149));var _0x579f=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x79f5[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x579f('0x0'));var util=require(_0x579f('0x1'));var moment=require(_0x579f('0x2'));var BPromise=require(_0x579f('0x3'));var rs=require(_0x579f('0x4'));var fs=require('fs');var Redis=require(_0x579f('0x5'));var db=require(_0x579f('0x6'))['db'];var utils=require(_0x579f('0x7'));var logger=require(_0x579f('0x8'))(_0x579f('0x9'));var config=require(_0x579f('0xa'));var jayson=require(_0x579f('0xb'));var client=jayson[_0x579f('0xc')][_0x579f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x210993,_0x5f2ead,_0x29ee7f){return new BPromise(function(_0x3f402f,_0x2ef911){return client[_0x579f('0xe')](_0x210993,_0x29ee7f)['then'](function(_0x425932){logger[_0x579f('0xf')](_0x579f('0x10'),_0x5f2ead,_0x579f('0x11'));logger[_0x579f('0x12')](_0x579f('0x13'),_0x5f2ead,_0x579f('0x11'),JSON[_0x579f('0x14')](_0x425932));if(_0x425932[_0x579f('0x15')]){if(_0x425932[_0x579f('0x15')][_0x579f('0x16')]===0x1f4){logger['error'](_0x579f('0x10'),_0x5f2ead,_0x425932[_0x579f('0x15')][_0x579f('0x17')]);return _0x2ef911(_0x425932[_0x579f('0x15')]['message']);}logger['error'](_0x579f('0x10'),_0x5f2ead,_0x425932[_0x579f('0x15')]['message']);return _0x3f402f(_0x425932[_0x579f('0x15')][_0x579f('0x17')]);}else{logger['info'](_0x579f('0x10'),_0x5f2ead,'request\x20sent');_0x3f402f(_0x425932[_0x579f('0x18')][_0x579f('0x17')]);}})[_0x579f('0x19')](function(_0x137ca7){logger[_0x579f('0x15')](_0x579f('0x10'),_0x5f2ead,_0x137ca7);_0x2ef911(_0x137ca7);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0c08b25..1a6e34d 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d3ece,_0x3fb359){var _0x1ba5d2=function(_0xaa2729){while(--_0xaa2729){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x1ba5d2(++_0x3fb359);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x401d4e,_0x2f6357){var _0x382ee1=function(_0x46190b){while(--_0x46190b){_0x401d4e['push'](_0x401d4e['shift']());}};_0x382ee1(++_0x2f6357);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 503fde0..291a3d8 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 _0x08e9=['exports','INTEGER','sequelize'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0x08e9,0xd1));var _0x908e=function(_0x1fb212,_0x1d84e7){_0x1fb212=_0x1fb212-0x0;var _0x262fa3=_0x08e9[_0x1fb212];return _0x262fa3;};'use strict';var Sequelize=require(_0x908e('0x0'));module[_0x908e('0x1')]={'penalty':{'type':Sequelize[_0x908e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3733=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3733,0x93));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3373('0x0'));module[_0x3373('0x1')]={'penalty':{'type':Sequelize[_0x3373('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c0fdbce..4cadaa2 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 _0x015a=['api','request-promise','path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x015a,0x121));var _0xa015=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x015a[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xa015('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa015('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa015('0x2'));var fs=require('fs');var path=require(_0xa015('0x3'));var rimraf=require(_0xa015('0x4'));var config=require(_0xa015('0x5'));var attributes=require('./userMailQueue.attributes');module[_0xa015('0x6')]=function(_0x56e578,_0x20a4b3){return _0x56e578[_0xa015('0x7')](_0xa015('0x8'),attributes,{'tableName':_0xa015('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3054=['../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x211576,_0xcc41af){var _0x3ce235=function(_0x28bd8a){while(--_0x28bd8a){_0x211576['push'](_0x211576['shift']());}};_0x3ce235(++_0xcc41af);}(_0x3054,0xe1));var _0x4305=function(_0x7741c5,_0xb93b29){_0x7741c5=_0x7741c5-0x0;var _0x2a3ba9=_0x3054[_0x7741c5];return _0x2a3ba9;};'use strict';var _=require('lodash');var util=require(_0x4305('0x0'));var logger=require('../../config/logger')(_0x4305('0x1'));var moment=require(_0x4305('0x2'));var BPromise=require(_0x4305('0x3'));var rp=require(_0x4305('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4305('0x5'));var config=require(_0x4305('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x4305('0x7')]=function(_0x28da70,_0x5d8a2d){return _0x28da70[_0x4305('0x8')](_0x4305('0x9'),attributes,{'tableName':_0x4305('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index a91736d..0c1d131 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0x008c[_0x593f03];return _0x178299;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x1f9af0,_0x44f3b7){var _0x455abc=function(_0xb92601){while(--_0xb92601){_0x1f9af0['push'](_0x1f9af0['shift']());}};_0x455abc(++_0x44f3b7);}(_0x4b84,0x1cc));var _0x44b8=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4b84[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f9c8594..b90660a 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 _0xb8bd=['isAuthenticated','sendUserNotification','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x3238c3,_0x515430){var _0x13239a=function(_0x147e20){while(--_0x147e20){_0x3238c3['push'](_0x3238c3['shift']());}};_0x13239a(++_0x515430);}(_0xb8bd,0xc3));var _0xdb8b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb8bd[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xdb8b('0x0'));var path=require('path');var timeout=require(_0xdb8b('0x1'));var express=require(_0xdb8b('0x2'));var router=express[_0xdb8b('0x3')]();var fs_extra=require(_0xdb8b('0x4'));var auth=require(_0xdb8b('0x5'));var interaction=require(_0xdb8b('0x6'));var config=require('../../config/environment');var controller=require(_0xdb8b('0x7'));router[_0xdb8b('0x8')]('/',auth[_0xdb8b('0x9')](),controller[_0xdb8b('0xa')]);module[_0xdb8b('0xb')]=router; \ No newline at end of file +var _0x4077=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1967b8,_0x2ce618){var _0xeacbb7=function(_0x4e5c73){while(--_0x4e5c73){_0x1967b8['push'](_0x1967b8['shift']());}};_0xeacbb7(++_0x2ce618);}(_0x4077,0x162));var _0x7407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4077[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7407('0x0'));var util=require(_0x7407('0x1'));var path=require(_0x7407('0x2'));var timeout=require(_0x7407('0x3'));var express=require(_0x7407('0x4'));var router=express[_0x7407('0x5')]();var fs_extra=require(_0x7407('0x6'));var auth=require(_0x7407('0x7'));var interaction=require(_0x7407('0x8'));var config=require(_0x7407('0x9'));var controller=require(_0x7407('0xa'));router[_0x7407('0xb')]('/',auth[_0x7407('0xc')](),controller[_0x7407('0xd')]);module[_0x7407('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ce88545..a810609 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 _0xad6f=['sequelize','exports','TEXT','STRING'];(function(_0x5c7ec1,_0x3080e1){var _0x59cfdf=function(_0x73c901){while(--_0x73c901){_0x5c7ec1['push'](_0x5c7ec1['shift']());}};_0x59cfdf(++_0x3080e1);}(_0xad6f,0x118));var _0xfad6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xad6f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xfad6('0x0'));module[_0xfad6('0x1')]={'body':{'type':Sequelize[_0xfad6('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfad6('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfad6('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xe6b6=['sequelize','exports','STRING','BOOLEAN'];(function(_0x36083a,_0x44a550){var _0x1c30c4=function(_0x20cb84){while(--_0x20cb84){_0x36083a['push'](_0x36083a['shift']());}};_0x1c30c4(++_0x44a550);}(_0xe6b6,0x138));var _0x6e6b=function(_0x3e8af6,_0x522298){_0x3e8af6=_0x3e8af6-0x0;var _0x163323=_0xe6b6[_0x3e8af6];return _0x163323;};'use strict';var Sequelize=require(_0x6e6b('0x0'));module[_0x6e6b('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6e6b('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x6e6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 79f73b9..9f2386c 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 _0x315e=['emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','ids','queue','Queue','push','all','union','map','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','update','then','destroy','error','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sequelize','transaction','create','forEach','recipient'];(function(_0x3b6c94,_0x4d757e){var _0xc40f81=function(_0x22db84){while(--_0x22db84){_0x3b6c94['push'](_0x3b6c94['shift']());}};_0xc40f81(++_0x4d757e);}(_0x315e,0x134));var _0xe315=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x315e[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe315('0x0'));var zipdir=require(_0xe315('0x1'));var jsonpatch=require(_0xe315('0x2'));var rp=require(_0xe315('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe315('0x4'));var util=require('util');var path=require(_0xe315('0x5'));var sox=require(_0xe315('0x6'));var csv=require(_0xe315('0x7'));var ejs=require(_0xe315('0x8'));var fs=require('fs');var fs_extra=require(_0xe315('0x9'));var _=require('lodash');var squel=require(_0xe315('0xa'));var crypto=require(_0xe315('0xb'));var jsforce=require(_0xe315('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe315('0x7'));var querystring=require(_0xe315('0xd'));var Papa=require('papaparse');var Redis=require(_0xe315('0xe'));var authService=require(_0xe315('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe315('0x10'));var hardwareService=require(_0xe315('0x11'));var logger=require(_0xe315('0x12'))(_0xe315('0x13'));var utils=require(_0xe315('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe315('0x15'));var db=require('../../mysqldb')['db'];config[_0xe315('0x16')]=_[_0xe315('0x17')](config[_0xe315('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe315('0x18'))(new Redis(config[_0xe315('0x16')]));require(_0xe315('0x19'))[_0xe315('0x1a')](socket);function respondWithStatusCode(_0x5546ad,_0x5a1f01){_0x5a1f01=_0x5a1f01||0xcc;return function(_0x69314){if(_0x69314){return _0x5546ad[_0xe315('0x1b')](_0x5a1f01);}return _0x5546ad[_0xe315('0x1c')](_0x5a1f01)[_0xe315('0x1d')]();};}function respondWithResult(_0x434847,_0x28ea62){_0x28ea62=_0x28ea62||0xc8;return function(_0x2b8cb5){if(_0x2b8cb5){return _0x434847['status'](_0x28ea62)[_0xe315('0x1e')](_0x2b8cb5);}};}function respondWithFilteredResult(_0x1ef752,_0x325ca0){return function(_0x45b1ff){if(_0x45b1ff){var _0xf35ce4=typeof _0x325ca0['offset']===_0xe315('0x1f')&&typeof _0x325ca0[_0xe315('0x20')]==='undefined';var _0x176b88=_0x45b1ff['count'];var _0x16c883=_0xf35ce4?0x0:_0x325ca0[_0xe315('0x21')];var _0x25c785=_0xf35ce4?_0x45b1ff[_0xe315('0x22')]:_0x325ca0[_0xe315('0x21')]+_0x325ca0[_0xe315('0x20')];var _0xa81162;if(_0x25c785>=_0x176b88){_0x25c785=_0x176b88;_0xa81162=0xc8;}else{_0xa81162=0xce;}_0x1ef752[_0xe315('0x1c')](_0xa81162);return _0x1ef752[_0xe315('0x23')]('Content-Range',_0x16c883+'-'+_0x25c785+'/'+_0x176b88)[_0xe315('0x1e')](_0x45b1ff);}return null;};}function patchUpdates(_0x3749c7){return function(_0x31750d){try{jsonpatch[_0xe315('0x24')](_0x31750d,_0x3749c7,!![]);}catch(_0x267a33){return BPromise['reject'](_0x267a33);}return _0x31750d['save']();};}function saveUpdates(_0x59a98b,_0x25f26a){return function(_0x1d4330){if(_0x1d4330){return _0x1d4330[_0xe315('0x25')](_0x59a98b)[_0xe315('0x26')](function(_0x232cff){return _0x232cff;});}return null;};}function removeEntity(_0xb620c2,_0x47c06a){return function(_0x1e097a){if(_0x1e097a){return _0x1e097a[_0xe315('0x27')]()[_0xe315('0x26')](function(){_0xb620c2[_0xe315('0x1c')](0xcc)[_0xe315('0x1d')]();});}};}function handleEntityNotFound(_0x4d3c58,_0x2fb983){return function(_0x103f58){if(!_0x103f58){_0x4d3c58[_0xe315('0x1b')](0x194);}return _0x103f58;};}function handleError(_0x525097,_0x22536e){_0x22536e=_0x22536e||0x1f4;return function(_0x3bec67){logger[_0xe315('0x28')](_0x3bec67['stack']);if(_0x3bec67['name']){delete _0x3bec67['name'];}_0x525097[_0xe315('0x1c')](_0x22536e)[_0xe315('0x29')](_0x3bec67);};}exports[_0xe315('0x2a')]=function(_0x5bb8bf,_0x5b590e,_0x471e04){if(!_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x2c')](_0xe315('0x2d'))&&!_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x2c')]('TemplateId')){throw new db[(_0xe315('0x2e'))]['ValidationError'](_0xe315('0x2f'));}else{if(_0x5bb8bf['body'][_0xe315('0x2c')](_0xe315('0x30'))&&!_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x2c')](_0xe315('0x31'))){throw new db[(_0xe315('0x2e'))][(_0xe315('0x32'))](_0xe315('0x33'));}if(!_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x2c')](_0xe315('0x34'))){throw new db[(_0xe315('0x2e'))][(_0xe315('0x32'))](_0xe315('0x35'));}else{try{var _0x215ff1=JSON[_0xe315('0x36')](_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x34')]);}catch(_0x526123){logger['error'](_0x526123);throw new db[(_0xe315('0x2e'))][(_0xe315('0x32'))](_0xe315('0x37'));}var _0x214003=[_0xe315('0x38'),_0xe315('0x39'),_0xe315('0x3a'),_0xe315('0x3b'),_0xe315('0x3c'),_0xe315('0x3d'),_0xe315('0x3e'),_0xe315('0x3f'),_0xe315('0x40')];if(_[_0xe315('0x41')](_0x215ff1,function(_0x449b3a){return!_[_0xe315('0x42')](_0x214003,_0x449b3a[_0xe315('0x43')][_0xe315('0x44')]());})){throw new db['Sequelize'][(_0xe315('0x32'))](_0xe315('0x45'));}}}var _0x269f0d={};_0x269f0d[_0xe315('0x46')]=_0x5bb8bf['body'][_0xe315('0x2c')](_0xe315('0x46'))?_0x5bb8bf[_0xe315('0x2b')]['senderName']:_0x5bb8bf['user']['fullname'];_0x269f0d['recipientsDescription']=_['isEmpty'](_0x5bb8bf[_0xe315('0x2b')][_0xe315('0x47')])?null:_0x5bb8bf[_0xe315('0x2b')]['recipientsDescription'];_0x269f0d[_0xe315('0x48')]=_0x5bb8bf[_0xe315('0x2b')]['beep']||![];_0x269f0d[_0xe315('0x49')]=_0x5bb8bf[_0xe315('0x40')]['id'];return getContent(_0x5bb8bf['body'])['then'](function(_0x3fba9b){_0x269f0d[_0xe315('0x2b')]=_0x3fba9b;return getRecipients(_0x215ff1);})['then'](function(_0x5925da){_0x269f0d[_0xe315('0x4a')]=_['sortBy'](_0x5925da)['join'](',');return db[_0xe315('0x4b')][_0xe315('0x4c')](function(_0x364ad9){return db['UserNotification'][_0xe315('0x4d')](_0x269f0d,{'raw':!![],'transaction':_0x364ad9})[_0xe315('0x26')](function(_0x1aab0c){var _0x59dfa5={'sender':_0x269f0d[_0xe315('0x46')],'description':_0x269f0d[_0xe315('0x47')],'content':_0x269f0d['body'],'beep':_0x269f0d[_0xe315('0x48')]};_0x5925da[_0xe315('0x4e')](function(_0x42bbd3){_0x59dfa5[_0xe315('0x4f')]=_0x42bbd3;socket[_0xe315('0x50')](_0xe315('0x51'),_0x59dfa5);});return _0x1aab0c;});});})[_0xe315('0x26')](respondWithResult(_0x5b590e,0xc9))[_0xe315('0x52')](handleError(_0x5b590e,null));};function getContent(_0x28adac){return new BPromise(function(_0x2a4541,_0x3eb876){if(_0x28adac['text']){_0x2a4541(_0x28adac[_0xe315('0x2d')]);return;}return db[_0xe315('0x53')][_0xe315('0x54')]({'attributes':['html'],'where':{'id':_0x28adac['TemplateId']},'raw':!![]})['then'](function(_0x596d51){if(!_0x596d51)throw new db[(_0xe315('0x2e'))][(_0xe315('0x32'))](_0xe315('0x55'));var _0x47d6eb=Mustache[_0xe315('0x56')](_0x596d51[_0xe315('0x57')],_0x28adac[_0xe315('0x31')]);_0x2a4541(_0x47d6eb);})[_0xe315('0x52')](function(_0xbb36a7){_0x3eb876(_0xbb36a7);});});}function getRecipients(_0xbd0a90){return new BPromise(function(_0x1bb344,_0x32cd8c){var _0x50ffc6=[];var _0x376113=[];_0xbd0a90[_0xe315('0x4e')](function(_0x49eb15){var _0x247cfb=_[_0xe315('0x58')](_0x49eb15[_0xe315('0x43')][_0xe315('0x44')]());if(_0x247cfb===_0xe315('0x59')){_0x50ffc6=_['union'](_0x50ffc6,_0x49eb15[_0xe315('0x5a')]);}else{if(_[_0xe315('0x42')](_0x247cfb,_0xe315('0x5b')))_0x247cfb=_0x247cfb['replace'](_0xe315('0x5b'),_0xe315('0x5c'));_0x49eb15[_0xe315('0x5a')][_0xe315('0x4e')](function(_0x5b633d){_0x376113[_0xe315('0x5d')](getAgents(_0x247cfb,_0x5b633d));});}});return BPromise[_0xe315('0x5e')](_0x376113)[_0xe315('0x26')](function(_0x3f4df5){_0x50ffc6=_[_0xe315('0x5f')](_0x50ffc6,_['flatten'](_0x3f4df5));_0x1bb344(_0x50ffc6);})[_0xe315('0x52')](function(_0x461baa){_0x32cd8c(_0x461baa);});});}function getAgents(_0x330de5,_0xccde97){return new BPromise(function(_0x8d6158,_0x393f1a){return db[_0x330de5][_0xe315('0x54')]({'where':{'id':_0xccde97}})[_0xe315('0x26')](function(_0x4814af){return _0x4814af['getAgents']({'attributes':['id'],'raw':!![]})[_0xe315('0x26')](function(_0x54d1b8){var _0x159b76=_[_0xe315('0x60')](_0x54d1b8,'id');_0x8d6158(_0x159b76);});})[_0xe315('0x52')](function(_0x509894){_0x393f1a(_0x509894);});});} \ No newline at end of file +var _0x73a4=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','ids','includes','queue','Queue','push','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','sendUserNotification','body','text','TemplateId','ValidationError','hasOwnProperty','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','Template'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x73a4,0x178));var _0x473a=function(_0x373c4c,_0x5dccbf){_0x373c4c=_0x373c4c-0x0;var _0x2f37d9=_0x73a4[_0x373c4c];return _0x2f37d9;};'use strict';var emlformat=require(_0x473a('0x0'));var rimraf=require(_0x473a('0x1'));var zipdir=require(_0x473a('0x2'));var jsonpatch=require(_0x473a('0x3'));var rp=require(_0x473a('0x4'));var moment=require(_0x473a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x473a('0x6'));var util=require(_0x473a('0x7'));var path=require('path');var sox=require(_0x473a('0x8'));var csv=require(_0x473a('0x9'));var ejs=require(_0x473a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x473a('0xb'));var crypto=require(_0x473a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x473a('0x9'));var querystring=require(_0x473a('0xd'));var Papa=require('papaparse');var Redis=require(_0x473a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x473a('0xf'));var hardwareService=require(_0x473a('0x10'));var logger=require('../../config/logger')(_0x473a('0x11'));var utils=require('../../config/utils');var config=require(_0x473a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x473a('0x13'))['db'];config[_0x473a('0x14')]=_['defaults'](config[_0x473a('0x14')],{'host':_0x473a('0x15'),'port':0x18eb});var socket=require(_0x473a('0x16'))(new Redis(config[_0x473a('0x14')]));require(_0x473a('0x17'))[_0x473a('0x18')](socket);function respondWithStatusCode(_0x2c92ea,_0x8a6e92){_0x8a6e92=_0x8a6e92||0xcc;return function(_0x4b295b){if(_0x4b295b){return _0x2c92ea['sendStatus'](_0x8a6e92);}return _0x2c92ea[_0x473a('0x19')](_0x8a6e92)[_0x473a('0x1a')]();};}function respondWithResult(_0x4b76ec,_0x236360){_0x236360=_0x236360||0xc8;return function(_0x21a9eb){if(_0x21a9eb){return _0x4b76ec[_0x473a('0x19')](_0x236360)['json'](_0x21a9eb);}};}function respondWithFilteredResult(_0x64c1fa,_0x1e12e7){return function(_0x4b95fb){if(_0x4b95fb){var _0x5beaab=typeof _0x1e12e7[_0x473a('0x1b')]===_0x473a('0x1c')&&typeof _0x1e12e7['limit']===_0x473a('0x1c');var _0x21fa3b=_0x4b95fb['count'];var _0x115c4f=_0x5beaab?0x0:_0x1e12e7[_0x473a('0x1b')];var _0x553a39=_0x5beaab?_0x4b95fb[_0x473a('0x1d')]:_0x1e12e7[_0x473a('0x1b')]+_0x1e12e7[_0x473a('0x1e')];var _0x4f62a1;if(_0x553a39>=_0x21fa3b){_0x553a39=_0x21fa3b;_0x4f62a1=0xc8;}else{_0x4f62a1=0xce;}_0x64c1fa[_0x473a('0x19')](_0x4f62a1);return _0x64c1fa[_0x473a('0x1f')]('Content-Range',_0x115c4f+'-'+_0x553a39+'/'+_0x21fa3b)['json'](_0x4b95fb);}return null;};}function patchUpdates(_0x4a71ae){return function(_0x4ec1d9){try{jsonpatch[_0x473a('0x20')](_0x4ec1d9,_0x4a71ae,!![]);}catch(_0x4a73ef){return BPromise[_0x473a('0x21')](_0x4a73ef);}return _0x4ec1d9[_0x473a('0x22')]();};}function saveUpdates(_0x3e0a8f,_0x371160){return function(_0x3e3f2b){if(_0x3e3f2b){return _0x3e3f2b[_0x473a('0x23')](_0x3e0a8f)[_0x473a('0x24')](function(_0x417ded){return _0x417ded;});}return null;};}function removeEntity(_0x38ebc4,_0x366752){return function(_0x274252){if(_0x274252){return _0x274252['destroy']()[_0x473a('0x24')](function(){_0x38ebc4['status'](0xcc)[_0x473a('0x1a')]();});}};}function handleEntityNotFound(_0x12dafd,_0x6a820e){return function(_0x426263){if(!_0x426263){_0x12dafd[_0x473a('0x25')](0x194);}return _0x426263;};}function handleError(_0x398891,_0x48059d){_0x48059d=_0x48059d||0x1f4;return function(_0xa619db){logger[_0x473a('0x26')](_0xa619db[_0x473a('0x27')]);if(_0xa619db[_0x473a('0x28')]){delete _0xa619db['name'];}_0x398891[_0x473a('0x19')](_0x48059d)['send'](_0xa619db);};}exports[_0x473a('0x29')]=function(_0x5a4c81,_0x4de1fe,_0x2c9b50){if(!_0x5a4c81[_0x473a('0x2a')]['hasOwnProperty'](_0x473a('0x2b'))&&!_0x5a4c81[_0x473a('0x2a')]['hasOwnProperty'](_0x473a('0x2c'))){throw new db['Sequelize'][(_0x473a('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5a4c81[_0x473a('0x2a')][_0x473a('0x2e')](_0x473a('0x2c'))&&!_0x5a4c81['body'][_0x473a('0x2e')](_0x473a('0x2f'))){throw new db[(_0x473a('0x30'))][(_0x473a('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5a4c81[_0x473a('0x2a')]['hasOwnProperty'](_0x473a('0x31'))){throw new db['Sequelize'][(_0x473a('0x2d'))](_0x473a('0x32'));}else{try{var _0x4eac4c=JSON['parse'](_0x5a4c81[_0x473a('0x2a')][_0x473a('0x31')]);}catch(_0x2edb73){logger['error'](_0x2edb73);throw new db['Sequelize']['ValidationError'](_0x473a('0x33'));}var _0x52c9e2=['chatqueue',_0x473a('0x34'),_0x473a('0x35'),_0x473a('0x36'),_0x473a('0x37'),'voicequeue',_0x473a('0x38'),'team',_0x473a('0x39')];if(_[_0x473a('0x3a')](_0x4eac4c,function(_0x2c21ee){return!_['includes'](_0x52c9e2,_0x2c21ee[_0x473a('0x3b')][_0x473a('0x3c')]());})){throw new db['Sequelize'][(_0x473a('0x2d'))](_0x473a('0x3d'));}}}var _0x3f22b5={};_0x3f22b5[_0x473a('0x3e')]=_0x5a4c81[_0x473a('0x2a')][_0x473a('0x2e')](_0x473a('0x3e'))?_0x5a4c81[_0x473a('0x2a')][_0x473a('0x3e')]:_0x5a4c81['user'][_0x473a('0x3f')];_0x3f22b5[_0x473a('0x40')]=_['isEmpty'](_0x5a4c81[_0x473a('0x2a')][_0x473a('0x40')])?null:_0x5a4c81[_0x473a('0x2a')][_0x473a('0x40')];_0x3f22b5[_0x473a('0x41')]=_0x5a4c81[_0x473a('0x2a')][_0x473a('0x41')]||![];_0x3f22b5[_0x473a('0x42')]=_0x5a4c81[_0x473a('0x39')]['id'];return getContent(_0x5a4c81[_0x473a('0x2a')])[_0x473a('0x24')](function(_0x4cc44b){_0x3f22b5['body']=_0x4cc44b;return getRecipients(_0x4eac4c);})[_0x473a('0x24')](function(_0x71c6){_0x3f22b5[_0x473a('0x43')]=_[_0x473a('0x44')](_0x71c6)[_0x473a('0x45')](',');return db[_0x473a('0x46')][_0x473a('0x47')](function(_0x1e688d){return db[_0x473a('0x48')][_0x473a('0x49')](_0x3f22b5,{'raw':!![],'transaction':_0x1e688d})[_0x473a('0x24')](function(_0x154c15){var _0x814f44={'sender':_0x3f22b5['senderName'],'description':_0x3f22b5['recipientsDescription'],'content':_0x3f22b5[_0x473a('0x2a')],'beep':_0x3f22b5[_0x473a('0x41')]};_0x71c6[_0x473a('0x4a')](function(_0x1f2114){_0x814f44[_0x473a('0x4b')]=_0x1f2114;socket['emit'](_0x473a('0x4c'),_0x814f44);});return _0x154c15;});});})[_0x473a('0x24')](respondWithResult(_0x4de1fe,0xc9))[_0x473a('0x4d')](handleError(_0x4de1fe,null));};function getContent(_0x5162a3){return new BPromise(function(_0x18c36f,_0x41494d){if(_0x5162a3[_0x473a('0x2b')]){_0x18c36f(_0x5162a3[_0x473a('0x2b')]);return;}return db[_0x473a('0x4e')][_0x473a('0x4f')]({'attributes':[_0x473a('0x50')],'where':{'id':_0x5162a3['TemplateId']},'raw':!![]})[_0x473a('0x24')](function(_0x4c754a){if(!_0x4c754a)throw new db[(_0x473a('0x30'))][(_0x473a('0x2d'))](_0x473a('0x51'));var _0x3be345=Mustache[_0x473a('0x52')](_0x4c754a[_0x473a('0x50')],_0x5162a3[_0x473a('0x2f')]);_0x18c36f(_0x3be345);})[_0x473a('0x4d')](function(_0x225437){_0x41494d(_0x225437);});});}function getRecipients(_0x50d2ee){return new BPromise(function(_0x591ba2,_0x424cbb){var _0x1a1edb=[];var _0x681ea=[];_0x50d2ee[_0x473a('0x4a')](function(_0x491730){var _0x121f1c=_['startCase'](_0x491730['model'][_0x473a('0x3c')]());if(_0x121f1c==='User'){_0x1a1edb=_[_0x473a('0x53')](_0x1a1edb,_0x491730[_0x473a('0x54')]);}else{if(_[_0x473a('0x55')](_0x121f1c,_0x473a('0x56')))_0x121f1c=_0x121f1c['replace'](_0x473a('0x56'),_0x473a('0x57'));_0x491730[_0x473a('0x54')][_0x473a('0x4a')](function(_0x9a50ff){_0x681ea[_0x473a('0x58')](getAgents(_0x121f1c,_0x9a50ff));});}});return BPromise['all'](_0x681ea)[_0x473a('0x24')](function(_0x30dc0f){_0x1a1edb=_[_0x473a('0x53')](_0x1a1edb,_['flatten'](_0x30dc0f));_0x591ba2(_0x1a1edb);})[_0x473a('0x4d')](function(_0x223f57){_0x424cbb(_0x223f57);});});}function getAgents(_0xaee892,_0x438600){return new BPromise(function(_0x49590c,_0x44a04c){return db[_0xaee892]['findOne']({'where':{'id':_0x438600}})[_0x473a('0x24')](function(_0x215a1e){return _0x215a1e[_0x473a('0x59')]({'attributes':['id'],'raw':!![]})[_0x473a('0x24')](function(_0x2dd909){var _0x942ce3=_[_0x473a('0x5a')](_0x2dd909,'id');_0x49590c(_0x942ce3);});})['catch'](function(_0x13a5a1){_0x44a04c(_0x13a5a1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9c37edb..1438162 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 _0x7ecb=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7ecb,0x11c));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xb7ec('0x0'));var UserNotification=require(_0xb7ec('0x1'))['db'][_0xb7ec('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb7ec('0x3')](0x0);var events={'afterCreate':_0xb7ec('0x4'),'afterUpdate':_0xb7ec('0x5'),'afterDestroy':_0xb7ec('0x6')};function emitEvent(_0x3101d5){return function(_0x1fe5b2,_0x34f1d7,_0x48f512){UserNotificationEvents[_0xb7ec('0x7')](_0x3101d5+':'+_0x1fe5b2['id'],_0x1fe5b2);UserNotificationEvents[_0xb7ec('0x7')](_0x3101d5,_0x1fe5b2);_0x48f512(null);};}for(var e in events){if(events[_0xb7ec('0x8')](e)){var event=events[e];UserNotification[_0xb7ec('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xe742=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x3f7d30,_0x288d25){var _0x220b4b=function(_0x4806fe){while(--_0x4806fe){_0x3f7d30['push'](_0x3f7d30['shift']());}};_0x220b4b(++_0x288d25);}(_0xe742,0x180));var _0x2e74=function(_0xb384c6,_0x2c832a){_0xb384c6=_0xb384c6-0x0;var _0x53d1b2=_0xe742[_0xb384c6];return _0x53d1b2;};'use strict';var EventEmitter=require(_0x2e74('0x0'));var UserNotification=require(_0x2e74('0x1'))['db'][_0x2e74('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e74('0x3'),'afterUpdate':'update','afterDestroy':_0x2e74('0x4')};function emitEvent(_0x2502dc){return function(_0x1d516b,_0x1a8ecd,_0x19d076){UserNotificationEvents['emit'](_0x2502dc+':'+_0x1d516b['id'],_0x1d516b);UserNotificationEvents[_0x2e74('0x5')](_0x2502dc,_0x1d516b);_0x19d076(null);};}for(var e in events){if(events[_0x2e74('0x6')](e)){var event=events[e];UserNotification[_0x2e74('0x7')](e,emitEvent(event));}}module[_0x2e74('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 258aa43..b84c241 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 _0x947a=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x2e3ffb,_0x244a7b){var _0x1426b3=function(_0x515a16){while(--_0x515a16){_0x2e3ffb['push'](_0x2e3ffb['shift']());}};_0x1426b3(++_0x244a7b);}(_0x947a,0x94));var _0xa947=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x947a[_0x1b6311];return _0x25aab6;};'use strict';var _=require(_0xa947('0x0'));var util=require(_0xa947('0x1'));var logger=require('../../config/logger')(_0xa947('0x2'));var moment=require(_0xa947('0x3'));var BPromise=require(_0xa947('0x4'));var rp=require(_0xa947('0x5'));var fs=require('fs');var path=require(_0xa947('0x6'));var rimraf=require(_0xa947('0x7'));var config=require(_0xa947('0x8'));var attributes=require(_0xa947('0x9'));module[_0xa947('0xa')]=function(_0x4131a6,_0x31aae9){return _0x4131a6[_0xa947('0xb')](_0xa947('0xc'),attributes,{'tableName':_0xa947('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa947('0xe'),'collate':_0xa947('0xf')});}; \ No newline at end of file +var _0x3cf5=['bluebird','rimraf','./userNotification.attributes','exports','userNotifications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x79e805,_0x17a8ed){var _0x4da84d=function(_0x13e90f){while(--_0x13e90f){_0x79e805['push'](_0x79e805['shift']());}};_0x4da84d(++_0x17a8ed);}(_0x3cf5,0xa6));var _0x53cf=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x3cf5[_0xdd0313];return _0x2bd7e8;};'use strict';var _=require(_0x53cf('0x0'));var util=require(_0x53cf('0x1'));var logger=require('../../config/logger')(_0x53cf('0x2'));var moment=require(_0x53cf('0x3'));var BPromise=require(_0x53cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x53cf('0x5'));var config=require('../../config/environment');var attributes=require(_0x53cf('0x6'));module[_0x53cf('0x7')]=function(_0xfa6f5c,_0x496a44){return _0xfa6f5c['define']('UserNotification',attributes,{'tableName':_0x53cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x53cf('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5608a19..5f845f5 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 _0xf7f2=['http','redis','socket.io-emitter','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client'];(function(_0x3c5ba7,_0x4c3372){var _0x2c88cc=function(_0x1eceda){while(--_0x1eceda){_0x3c5ba7['push'](_0x3c5ba7['shift']());}};_0x2c88cc(++_0x4c3372);}(_0xf7f2,0xdf));var _0x2f7f=function(_0x58ee61,_0x41f78f){_0x58ee61=_0x58ee61-0x0;var _0x1b8825=_0xf7f2[_0x58ee61];return _0x1b8825;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2f7f('0x0'));var BPromise=require(_0x2f7f('0x1'));var rs=require(_0x2f7f('0x2'));var fs=require('fs');var Redis=require(_0x2f7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f7f('0x4'));var logger=require(_0x2f7f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2f7f('0x6')][_0x2f7f('0x7')]({'port':0x232a});config[_0x2f7f('0x8')]=_['defaults'](config[_0x2f7f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f7f('0x9'))(new Redis(config['redis']));require(_0x2f7f('0xa'))['register'](socket);function respondWithRpcPromise(_0x31b479,_0x64723c,_0x564d38){return new BPromise(function(_0x179636,_0x53da97){return client[_0x2f7f('0xb')](_0x31b479,_0x564d38)[_0x2f7f('0xc')](function(_0x1c42b5){logger['info'](_0x2f7f('0xd'),_0x64723c,_0x2f7f('0xe'));logger[_0x2f7f('0xf')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x64723c,'request\x20sent',JSON[_0x2f7f('0x10')](_0x1c42b5));if(_0x1c42b5[_0x2f7f('0x11')]){if(_0x1c42b5[_0x2f7f('0x11')][_0x2f7f('0x12')]===0x1f4){logger['error'](_0x2f7f('0xd'),_0x64723c,_0x1c42b5['error'][_0x2f7f('0x13')]);return _0x53da97(_0x1c42b5[_0x2f7f('0x11')][_0x2f7f('0x13')]);}logger[_0x2f7f('0x11')]('UserNotification,\x20%s,\x20%s',_0x64723c,_0x1c42b5[_0x2f7f('0x11')][_0x2f7f('0x13')]);return _0x179636(_0x1c42b5[_0x2f7f('0x11')][_0x2f7f('0x13')]);}else{logger[_0x2f7f('0x14')](_0x2f7f('0xd'),_0x64723c,_0x2f7f('0xe'));_0x179636(_0x1c42b5[_0x2f7f('0x15')]['message']);}})[_0x2f7f('0x16')](function(_0x28a54a){logger[_0x2f7f('0x11')](_0x2f7f('0xd'),_0x64723c,_0x28a54a);_0x53da97(_0x28a54a);});});} \ No newline at end of file +var _0x11cd=['defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis'];(function(_0x58081a,_0x28e071){var _0x2af223=function(_0x16389a){while(--_0x16389a){_0x58081a['push'](_0x58081a['shift']());}};_0x2af223(++_0x28e071);}(_0x11cd,0x147));var _0xd11c=function(_0xadf8a1,_0x5c73b8){_0xadf8a1=_0xadf8a1-0x0;var _0x35b1e8=_0x11cd[_0xadf8a1];return _0x35b1e8;};'use strict';var _=require('lodash');var util=require(_0xd11c('0x0'));var moment=require(_0xd11c('0x1'));var BPromise=require('bluebird');var rs=require(_0xd11c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd11c('0x3'))['db'];var utils=require(_0xd11c('0x4'));var logger=require(_0xd11c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd11c('0x6'));var client=jayson['client'][_0xd11c('0x7')]({'port':0x232a});config[_0xd11c('0x8')]=_[_0xd11c('0x9')](config[_0xd11c('0x8')],{'host':_0xd11c('0xa'),'port':0x18eb});var socket=require(_0xd11c('0xb'))(new Redis(config[_0xd11c('0x8')]));require('./userNotification.socket')[_0xd11c('0xc')](socket);function respondWithRpcPromise(_0x7c363b,_0xa8a9d6,_0x5c124d){return new BPromise(function(_0x1ed8e1,_0x2df057){return client[_0xd11c('0xd')](_0x7c363b,_0x5c124d)[_0xd11c('0xe')](function(_0x2b70dc){logger[_0xd11c('0xf')](_0xd11c('0x10'),_0xa8a9d6,_0xd11c('0x11'));logger[_0xd11c('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xa8a9d6,'request\x20sent',JSON[_0xd11c('0x13')](_0x2b70dc));if(_0x2b70dc[_0xd11c('0x14')]){if(_0x2b70dc['error'][_0xd11c('0x15')]===0x1f4){logger[_0xd11c('0x14')](_0xd11c('0x10'),_0xa8a9d6,_0x2b70dc[_0xd11c('0x14')][_0xd11c('0x16')]);return _0x2df057(_0x2b70dc['error'][_0xd11c('0x16')]);}logger['error'](_0xd11c('0x10'),_0xa8a9d6,_0x2b70dc[_0xd11c('0x14')][_0xd11c('0x16')]);return _0x1ed8e1(_0x2b70dc[_0xd11c('0x14')][_0xd11c('0x16')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0xa8a9d6,_0xd11c('0x11'));_0x1ed8e1(_0x2b70dc[_0xd11c('0x17')][_0xd11c('0x16')]);}})['catch'](function(_0x1eb37d){logger[_0xd11c('0x14')](_0xd11c('0x10'),_0xa8a9d6,_0x1eb37d);_0x2df057(_0x1eb37d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 920defe..0765d99 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 _0xc38c=['removeListener','userNotification:','./userNotification.events'];(function(_0x5827ac,_0x461219){var _0x152430=function(_0x2cd93f){while(--_0x2cd93f){_0x5827ac['push'](_0x5827ac['shift']());}};_0x152430(++_0x461219);}(_0xc38c,0x74));var _0xcc38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc38c[_0x14add3];return _0x4a174f;};'use strict';var UserNotificationEvents=require(_0xcc38('0x0'));var events=['save','remove','update'];function createListener(_0x27c035,_0x328162){return function(_0x2a85b6){_0x328162['emit'](_0x27c035,_0x2a85b6);};}function removeListener(_0x14bb72,_0x102526){return function(){UserNotificationEvents[_0xcc38('0x1')](_0x14bb72,_0x102526);};}exports['register']=function(_0x271294){for(var _0x2ffb56=0x0,_0x3ef723=events['length'];_0x2ffb56<_0x3ef723;_0x2ffb56++){var _0x25a4db=events[_0x2ffb56];var _0x74efd5=createListener(_0xcc38('0x2')+_0x25a4db,_0x271294);UserNotificationEvents['on'](_0x25a4db,_0x74efd5);}}; \ No newline at end of file +var _0x171b=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x171b,0xb2));var _0xb171=function(_0x113a33,_0x25a399){_0x113a33=_0x113a33-0x0;var _0x56007d=_0x171b[_0x113a33];return _0x56007d;};'use strict';var UserNotificationEvents=require(_0xb171('0x0'));var events=[_0xb171('0x1'),_0xb171('0x2'),_0xb171('0x3')];function createListener(_0x5839d1,_0xe9b624){return function(_0x1d88a4){_0xe9b624[_0xb171('0x4')](_0x5839d1,_0x1d88a4);};}function removeListener(_0x150bbe,_0x367d50){return function(){UserNotificationEvents[_0xb171('0x5')](_0x150bbe,_0x367d50);};}exports[_0xb171('0x6')]=function(_0x566544){for(var _0x556477=0x0,_0x4235fa=events[_0xb171('0x7')];_0x556477<_0x4235fa;_0x556477++){var _0x40a48c=events[_0x556477];var _0xe62979=createListener(_0xb171('0x8')+_0x40a48c,_0x566544);UserNotificationEvents['on'](_0x40a48c,_0xe62979);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9f6359e..23facb0 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b6231,_0x36a636){var _0x12e931=function(_0x4155f9){while(--_0x4155f9){_0x5b6231['push'](_0x5b6231['shift']());}};_0x12e931(++_0x36a636);}(_0x70e0,0x17b));var _0x070e=function(_0x39fad0,_0x3dfd95){_0x39fad0=_0x39fad0-0x0;var _0x1cfdcf=_0x70e0[_0x39fad0];return _0x1cfdcf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5113cf,_0x2b873e){var _0xc52e1d=function(_0x1c9de5){while(--_0x1c9de5){_0x5113cf['push'](_0x5113cf['shift']());}};_0xc52e1d(++_0x2b873e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xcb91[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 61917ab..c10e9c6 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 _0x68c2=['exports','INTEGER'];(function(_0x10c934,_0x5547b9){var _0x393c15=function(_0x1e9862){while(--_0x1e9862){_0x10c934['push'](_0x10c934['shift']());}};_0x393c15(++_0x5547b9);}(_0x68c2,0x1e8));var _0x268c=function(_0x5049e1,_0x4ac87a){_0x5049e1=_0x5049e1-0x0;var _0x37f162=_0x68c2[_0x5049e1];return _0x37f162;};'use strict';var Sequelize=require('sequelize');module[_0x268c('0x0')]={'penalty':{'type':Sequelize[_0x268c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa33b=['sequelize','exports','INTEGER'];(function(_0x24aed3,_0x3b2d85){var _0x4e83f3=function(_0x57c7d0){while(--_0x57c7d0){_0x24aed3['push'](_0x24aed3['shift']());}};_0x4e83f3(++_0x3b2d85);}(_0xa33b,0xd2));var _0xba33=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa33b[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xba33('0x0'));module[_0xba33('0x1')]={'penalty':{'type':Sequelize[_0xba33('0x2')],'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 c197c8d..965ad25 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 _0x6423=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0xc78be5,_0x4f4025){var _0x4a1c72=function(_0x39cd97){while(--_0x39cd97){_0xc78be5['push'](_0xc78be5['shift']());}};_0x4a1c72(++_0x4f4025);}(_0x6423,0x1c7));var _0x3642=function(_0x180cc6,_0x2b2052){_0x180cc6=_0x180cc6-0x0;var _0x491b18=_0x6423[_0x180cc6];return _0x491b18;};'use strict';var _=require(_0x3642('0x0'));var util=require(_0x3642('0x1'));var logger=require(_0x3642('0x2'))(_0x3642('0x3'));var moment=require(_0x3642('0x4'));var BPromise=require(_0x3642('0x5'));var rp=require(_0x3642('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3642('0x7'));var config=require(_0x3642('0x8'));var attributes=require(_0x3642('0x9'));module[_0x3642('0xa')]=function(_0x297653,_0x4abc67){return _0x297653[_0x3642('0xb')](_0x3642('0xc'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x159b=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x5c107d,_0x155dbe){var _0x3eaf06=function(_0x348dd6){while(--_0x348dd6){_0x5c107d['push'](_0x5c107d['shift']());}};_0x3eaf06(++_0x155dbe);}(_0x159b,0xd4));var _0xb159=function(_0x44e511,_0x2401ed){_0x44e511=_0x44e511-0x0;var _0x2a5d9f=_0x159b[_0x44e511];return _0x2a5d9f;};'use strict';var _=require(_0xb159('0x0'));var util=require('util');var logger=require(_0xb159('0x1'))(_0xb159('0x2'));var moment=require('moment');var BPromise=require(_0xb159('0x3'));var rp=require(_0xb159('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb159('0x5'));var config=require(_0xb159('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb159('0x7')]=function(_0x4b4c06,_0x59db32){return _0x4b4c06[_0xb159('0x8')](_0xb159('0x9'),attributes,{'tableName':_0xb159('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 3b25c98..093c0de 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 _0x727b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x30141b,_0x2c5fdf){var _0x10eb90=function(_0x5f56c3){while(--_0x5f56c3){_0x30141b['push'](_0x30141b['shift']());}};_0x10eb90(++_0x2c5fdf);}(_0x727b,0xbe));var _0xb727=function(_0x587676,_0x218efa){_0x587676=_0x587676-0x0;var _0x3fa282=_0x727b[_0x587676];return _0x3fa282;};'use strict';var _=require(_0xb727('0x0'));var util=require(_0xb727('0x1'));var moment=require(_0xb727('0x2'));var BPromise=require(_0xb727('0x3'));var rs=require(_0xb727('0x4'));var fs=require('fs');var Redis=require(_0xb727('0x5'));var db=require(_0xb727('0x6'))['db'];var utils=require(_0xb727('0x7'));var logger=require(_0xb727('0x8'))(_0xb727('0x9'));var config=require('../../config/environment');var jayson=require(_0xb727('0xa'));var client=jayson[_0xb727('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37882a,_0x5b1f53,_0x3e8bd7){return new BPromise(function(_0x47e2a1,_0x4ad6b4){return client[_0xb727('0xc')](_0x37882a,_0x3e8bd7)[_0xb727('0xd')](function(_0x66d232){logger[_0xb727('0xe')](_0xb727('0xf'),_0x5b1f53,_0xb727('0x10'));logger[_0xb727('0x11')](_0xb727('0x12'),_0x5b1f53,_0xb727('0x10'),JSON[_0xb727('0x13')](_0x66d232));if(_0x66d232[_0xb727('0x14')]){if(_0x66d232[_0xb727('0x14')]['code']===0x1f4){logger[_0xb727('0x14')](_0xb727('0xf'),_0x5b1f53,_0x66d232['error'][_0xb727('0x15')]);return _0x4ad6b4(_0x66d232[_0xb727('0x14')]['message']);}logger['error'](_0xb727('0xf'),_0x5b1f53,_0x66d232[_0xb727('0x14')][_0xb727('0x15')]);return _0x47e2a1(_0x66d232[_0xb727('0x14')]['message']);}else{logger[_0xb727('0xe')](_0xb727('0xf'),_0x5b1f53,_0xb727('0x10'));_0x47e2a1(_0x66d232[_0xb727('0x16')][_0xb727('0x15')]);}})[_0xb727('0x17')](function(_0x30b6ba){logger[_0xb727('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b1f53,_0x30b6ba);_0x4ad6b4(_0x30b6ba);});});} \ No newline at end of file +var _0x6f59=['util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x31f6f4,_0x2f4cd1){var _0x184806=function(_0xcbe4e3){while(--_0xcbe4e3){_0x31f6f4['push'](_0x31f6f4['shift']());}};_0x184806(++_0x2f4cd1);}(_0x6f59,0x99));var _0x96f5=function(_0x5d6197,_0x4598c4){_0x5d6197=_0x5d6197-0x0;var _0x4f46ed=_0x6f59[_0x5d6197];return _0x4f46ed;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var moment=require(_0x96f5('0x2'));var BPromise=require(_0x96f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96f5('0x4'));var logger=require(_0x96f5('0x5'))('rpc');var config=require(_0x96f5('0x6'));var jayson=require(_0x96f5('0x7'));var client=jayson[_0x96f5('0x8')][_0x96f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2405,_0x4f4be9,_0x14e944){return new BPromise(function(_0x333ffa,_0x45b68d){return client[_0x96f5('0xa')](_0x2b2405,_0x14e944)['then'](function(_0x45f8bb){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f4be9,_0x96f5('0xb'));logger[_0x96f5('0xc')](_0x96f5('0xd'),_0x4f4be9,_0x96f5('0xb'),JSON[_0x96f5('0xe')](_0x45f8bb));if(_0x45f8bb[_0x96f5('0xf')]){if(_0x45f8bb[_0x96f5('0xf')][_0x96f5('0x10')]===0x1f4){logger[_0x96f5('0xf')](_0x96f5('0x11'),_0x4f4be9,_0x45f8bb[_0x96f5('0xf')][_0x96f5('0x12')]);return _0x45b68d(_0x45f8bb[_0x96f5('0xf')][_0x96f5('0x12')]);}logger[_0x96f5('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f4be9,_0x45f8bb[_0x96f5('0xf')]['message']);return _0x333ffa(_0x45f8bb[_0x96f5('0xf')][_0x96f5('0x12')]);}else{logger[_0x96f5('0x13')](_0x96f5('0x11'),_0x4f4be9,_0x96f5('0xb'));_0x333ffa(_0x45f8bb[_0x96f5('0x14')]['message']);}})[_0x96f5('0x15')](function(_0x16771e){logger[_0x96f5('0xf')](_0x96f5('0x11'),_0x4f4be9,_0x16771e);_0x45b68d(_0x16771e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 46db863..cad2039 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 _0x5503=['addResources','put','update','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfile.controller','get','describe','/:id','isAuthenticated','/:id/sections','getSections','create','clone','post'];(function(_0x10a414,_0x8a42c0){var _0x4a54aa=function(_0x5bf091){while(--_0x5bf091){_0x10a414['push'](_0x10a414['shift']());}};_0x4a54aa(++_0x8a42c0);}(_0x5503,0x7e));var _0x3550=function(_0x5ce52b,_0x2a19de){_0x5ce52b=_0x5ce52b-0x0;var _0x147ed5=_0x5503[_0x5ce52b];return _0x147ed5;};'use strict';var multer=require(_0x3550('0x0'));var util=require(_0x3550('0x1'));var path=require(_0x3550('0x2'));var timeout=require(_0x3550('0x3'));var express=require(_0x3550('0x4'));var router=express[_0x3550('0x5')]();var fs_extra=require(_0x3550('0x6'));var auth=require(_0x3550('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3550('0x8'));router[_0x3550('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3550('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3550('0xa')]);router[_0x3550('0x9')](_0x3550('0xb'),auth[_0x3550('0xc')](),controller['show']);router[_0x3550('0x9')](_0x3550('0xd'),auth[_0x3550('0xc')](),controller[_0x3550('0xe')]);router[_0x3550('0x9')]('/:id/resources',auth[_0x3550('0xc')](),controller['getResources']);router['post']('/',auth[_0x3550('0xc')](),controller[_0x3550('0xf')]);router['post']('/:id/clone',auth[_0x3550('0xc')](),controller[_0x3550('0x10')]);router[_0x3550('0x11')]('/:id/sections',auth[_0x3550('0xc')](),controller['addSections']);router['post']('/:id/resources',auth[_0x3550('0xc')](),controller[_0x3550('0x12')]);router[_0x3550('0x13')]('/:id',auth[_0x3550('0xc')](),controller[_0x3550('0x14')]);router['delete'](_0x3550('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sections',auth[_0x3550('0xc')](),controller['removeSections']);router['delete'](_0x3550('0x15'),auth[_0x3550('0xc')](),controller[_0x3550('0x16')]);module[_0x3550('0x17')]=router; \ No newline at end of file +var _0x5b66=['/:id/clone','addSections','put','destroy','removeSections','delete','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5b66,0x1c1));var _0x65b6=function(_0x1566a4,_0x3d4ca6){_0x1566a4=_0x1566a4-0x0;var _0x3b7384=_0x5b66[_0x1566a4];return _0x3b7384;};'use strict';var multer=require('multer');var util=require(_0x65b6('0x0'));var path=require(_0x65b6('0x1'));var timeout=require(_0x65b6('0x2'));var express=require(_0x65b6('0x3'));var router=express[_0x65b6('0x4')]();var fs_extra=require(_0x65b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x65b6('0x6'));var config=require('../../config/environment');var controller=require(_0x65b6('0x7'));router[_0x65b6('0x8')]('/',auth[_0x65b6('0x9')](),controller['index']);router[_0x65b6('0x8')]('/describe',auth[_0x65b6('0x9')](),controller[_0x65b6('0xa')]);router[_0x65b6('0x8')](_0x65b6('0xb'),auth[_0x65b6('0x9')](),controller[_0x65b6('0xc')]);router[_0x65b6('0x8')](_0x65b6('0xd'),auth['isAuthenticated'](),controller[_0x65b6('0xe')]);router[_0x65b6('0x8')](_0x65b6('0xf'),auth[_0x65b6('0x9')](),controller[_0x65b6('0x10')]);router[_0x65b6('0x11')]('/',auth[_0x65b6('0x9')](),controller[_0x65b6('0x12')]);router[_0x65b6('0x11')](_0x65b6('0x13'),auth[_0x65b6('0x9')](),controller['clone']);router[_0x65b6('0x11')](_0x65b6('0xd'),auth[_0x65b6('0x9')](),controller[_0x65b6('0x14')]);router['post']('/:id/resources',auth[_0x65b6('0x9')](),controller['addResources']);router[_0x65b6('0x15')](_0x65b6('0xb'),auth[_0x65b6('0x9')](),controller['update']);router['delete']('/:id',auth[_0x65b6('0x9')](),controller[_0x65b6('0x16')]);router['delete'](_0x65b6('0xd'),auth[_0x65b6('0x9')](),controller[_0x65b6('0x17')]);router[_0x65b6('0x18')](_0x65b6('0xf'),auth[_0x65b6('0x9')](),controller[_0x65b6('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a23ce05..df2f19d 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 _0x92f1=['sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x312a65,_0x203742){var _0x27a4af=function(_0x36e81d){while(--_0x36e81d){_0x312a65['push'](_0x312a65['shift']());}};_0x27a4af(++_0x203742);}(_0x92f1,0x14a));var _0x192f=function(_0xf0198a,_0x4338d0){_0xf0198a=_0xf0198a-0x0;var _0x5349b3=_0x92f1[_0xf0198a];return _0x5349b3;};'use strict';var Sequelize=require(_0x192f('0x0'));module[_0x192f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x192f('0x2')},'crudPermissions':{'type':Sequelize[_0x192f('0x3')],'set':function(_0x3276b9){this[_0x192f('0x4')](_0x192f('0x5'),_0x3276b9?_0x3276b9[_0x192f('0x6')](''):[]);},'get':function(){return this[_0x192f('0x7')](_0x192f('0x5'))?this['getDataValue']('crudPermissions')[_0x192f('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x192f('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x192f('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x192f('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x68ae=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','STRING','name'];(function(_0x319a54,_0x518cb9){var _0x2a2caf=function(_0x4d3a75){while(--_0x4d3a75){_0x319a54['push'](_0x319a54['shift']());}};_0x2a2caf(++_0x518cb9);}(_0x68ae,0x7e));var _0xe68a=function(_0x1da364,_0x3db784){_0x1da364=_0x1da364-0x0;var _0x19bb71=_0x68ae[_0x1da364];return _0x19bb71;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe68a('0x0')],'allowNull':![],'unique':_0xe68a('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37f4ab){this[_0xe68a('0x2')](_0xe68a('0x3'),_0x37f4ab?_0x37f4ab[_0xe68a('0x4')](''):[]);},'get':function(){return this[_0xe68a('0x5')](_0xe68a('0x3'))?this[_0xe68a('0x5')](_0xe68a('0x3'))[_0xe68a('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe68a('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe68a('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3c523cc..e6b8f2b 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 _0xe298=['Content-Range','reject','update','then','destroy','end','error','stack','name','index','map','UserProfile','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','find','catch','create','body','clone','params','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sectionId','removeSections','ids','getSections','filter','enabled','isEmpty','includes','subsections','concat','push','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','json','limit','undefined','count','offset','status','set'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0xe298,0xba));var _0x8e29=function(_0xe44297,_0x21b8ca){_0xe44297=_0xe44297-0x0;var _0x365f26=_0xe298[_0xe44297];return _0x365f26;};'use strict';var emlformat=require(_0x8e29('0x0'));var rimraf=require(_0x8e29('0x1'));var zipdir=require(_0x8e29('0x2'));var jsonpatch=require(_0x8e29('0x3'));var rp=require('request-promise');var moment=require(_0x8e29('0x4'));var BPromise=require(_0x8e29('0x5'));var Mustache=require(_0x8e29('0x6'));var util=require(_0x8e29('0x7'));var path=require(_0x8e29('0x8'));var sox=require(_0x8e29('0x9'));var csv=require(_0x8e29('0xa'));var ejs=require(_0x8e29('0xb'));var fs=require('fs');var fs_extra=require(_0x8e29('0xc'));var _=require('lodash');var squel=require(_0x8e29('0xd'));var crypto=require(_0x8e29('0xe'));var jsforce=require(_0x8e29('0xf'));var deskjs=require(_0x8e29('0x10'));var toCsv=require(_0x8e29('0xa'));var querystring=require(_0x8e29('0x11'));var Papa=require(_0x8e29('0x12'));var Redis=require(_0x8e29('0x13'));var authService=require(_0x8e29('0x14'));var qs=require(_0x8e29('0x15'));var as=require(_0x8e29('0x16'));var hardwareService=require(_0x8e29('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8e29('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8e29('0x19'));var db=require(_0x8e29('0x1a'))['db'];config[_0x8e29('0x1b')]=_[_0x8e29('0x1c')](config[_0x8e29('0x1b')],{'host':_0x8e29('0x1d'),'port':0x18eb});var socket=require(_0x8e29('0x1e'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x417e1c,_0x21e629){_0x21e629=_0x21e629||0xcc;return function(_0x349fa7){if(_0x349fa7){return _0x417e1c['sendStatus'](_0x21e629);}return _0x417e1c['status'](_0x21e629)['end']();};}function respondWithResult(_0x6969ee,_0xf08050){_0xf08050=_0xf08050||0xc8;return function(_0x1dc7cf){if(_0x1dc7cf){return _0x6969ee['status'](_0xf08050)[_0x8e29('0x1f')](_0x1dc7cf);}};}function respondWithFilteredResult(_0x213e2f,_0x18474e){return function(_0x4d0fcb){if(_0x4d0fcb){var _0x2c0264=typeof _0x18474e['offset']==='undefined'&&typeof _0x18474e[_0x8e29('0x20')]===_0x8e29('0x21');var _0x36f58e=_0x4d0fcb[_0x8e29('0x22')];var _0x3b95e5=_0x2c0264?0x0:_0x18474e['offset'];var _0x2ace25=_0x2c0264?_0x4d0fcb[_0x8e29('0x22')]:_0x18474e[_0x8e29('0x23')]+_0x18474e[_0x8e29('0x20')];var _0x2727d2;if(_0x2ace25>=_0x36f58e){_0x2ace25=_0x36f58e;_0x2727d2=0xc8;}else{_0x2727d2=0xce;}_0x213e2f[_0x8e29('0x24')](_0x2727d2);return _0x213e2f[_0x8e29('0x25')](_0x8e29('0x26'),_0x3b95e5+'-'+_0x2ace25+'/'+_0x36f58e)[_0x8e29('0x1f')](_0x4d0fcb);}return null;};}function patchUpdates(_0x16fe6e){return function(_0x5aee33){try{jsonpatch['apply'](_0x5aee33,_0x16fe6e,!![]);}catch(_0x11b70c){return BPromise[_0x8e29('0x27')](_0x11b70c);}return _0x5aee33['save']();};}function saveUpdates(_0x2a5242,_0x3fe966){return function(_0x5d71bb){if(_0x5d71bb){return _0x5d71bb[_0x8e29('0x28')](_0x2a5242)[_0x8e29('0x29')](function(_0x10a5fc){return _0x10a5fc;});}return null;};}function removeEntity(_0x2ccfa9,_0x200398){return function(_0x214fc9){if(_0x214fc9){return _0x214fc9[_0x8e29('0x2a')]()[_0x8e29('0x29')](function(){_0x2ccfa9[_0x8e29('0x24')](0xcc)[_0x8e29('0x2b')]();});}};}function handleEntityNotFound(_0x4a8680,_0x40dce9){return function(_0x1be320){if(!_0x1be320){_0x4a8680['sendStatus'](0x194);}return _0x1be320;};}function handleError(_0x2f4aa4,_0x49404a){_0x49404a=_0x49404a||0x1f4;return function(_0x465d32){logger[_0x8e29('0x2c')](_0x465d32[_0x8e29('0x2d')]);if(_0x465d32[_0x8e29('0x2e')]){delete _0x465d32['name'];}_0x2f4aa4['status'](_0x49404a)['send'](_0x465d32);};}exports[_0x8e29('0x2f')]=function(_0x2289c0,_0x2fa3c9){var _0x1d204c={},_0x8f570={},_0x3fb13d={'count':0x0,'rows':[]};var _0x28588b=_[_0x8e29('0x30')](db[_0x8e29('0x31')][_0x8e29('0x32')],function(_0x23caf8){return{'name':_0x23caf8['fieldName'],'type':_0x23caf8[_0x8e29('0x33')]['key']};});_0x8f570[_0x8e29('0x34')]=_[_0x8e29('0x30')](_0x28588b,_0x8e29('0x2e'));_0x8f570[_0x8e29('0x35')]=_[_0x8e29('0x36')](_0x2289c0[_0x8e29('0x35')]);_0x8f570[_0x8e29('0x37')]=_[_0x8e29('0x38')](_0x8f570[_0x8e29('0x34')],_0x8f570[_0x8e29('0x35')]);_0x1d204c['attributes']=_['intersection'](_0x8f570[_0x8e29('0x34')],qs[_0x8e29('0x39')](_0x2289c0['query'][_0x8e29('0x39')]));_0x1d204c[_0x8e29('0x3a')]=_0x1d204c[_0x8e29('0x3a')][_0x8e29('0x3b')]?_0x1d204c[_0x8e29('0x3a')]:_0x8f570['model'];if(!_0x2289c0[_0x8e29('0x35')]['hasOwnProperty'](_0x8e29('0x3c'))){_0x1d204c['limit']=qs[_0x8e29('0x20')](_0x2289c0[_0x8e29('0x35')][_0x8e29('0x20')]);_0x1d204c[_0x8e29('0x23')]=qs['offset'](_0x2289c0[_0x8e29('0x35')][_0x8e29('0x23')]);}_0x1d204c[_0x8e29('0x3d')]=qs['sort'](_0x2289c0[_0x8e29('0x35')][_0x8e29('0x3e')]);_0x1d204c[_0x8e29('0x3f')]=qs[_0x8e29('0x37')](_[_0x8e29('0x40')](_0x2289c0['query'],_0x8f570[_0x8e29('0x37')]),_0x28588b);if(_0x2289c0['query']['filter']){_0x1d204c[_0x8e29('0x3f')]=_[_0x8e29('0x41')](_0x1d204c[_0x8e29('0x3f')],{'$or':_['map'](_0x28588b,function(_0x2615a3){if(_0x2615a3[_0x8e29('0x33')]!=='VIRTUAL'){var _0x51afc2={};_0x51afc2[_0x2615a3['name']]={'$like':'%'+_0x2289c0['query']['filter']+'%'};return _0x51afc2;}})});}_0x1d204c=_[_0x8e29('0x41')]({},_0x1d204c,_0x2289c0[_0x8e29('0x42')]);var _0x44d95d={'where':_0x1d204c[_0x8e29('0x3f')]};return db[_0x8e29('0x31')][_0x8e29('0x22')](_0x44d95d)[_0x8e29('0x29')](function(_0x4948ad){_0x3fb13d[_0x8e29('0x22')]=_0x4948ad;if(_0x2289c0[_0x8e29('0x35')][_0x8e29('0x43')]){_0x1d204c[_0x8e29('0x44')]=[{'all':!![]}];}return db[_0x8e29('0x31')][_0x8e29('0x45')](_0x1d204c);})[_0x8e29('0x29')](function(_0x5e0546){_0x3fb13d[_0x8e29('0x46')]=_0x5e0546;return _0x3fb13d;})['then'](respondWithFilteredResult(_0x2fa3c9,_0x1d204c))['catch'](handleError(_0x2fa3c9,null));};exports['show']=function(_0x4eb761,_0x54f6d2){var _0xb33b5c={'raw':![],'where':{'id':_0x4eb761['params']['id']}},_0x5db1e1={};_0x5db1e1[_0x8e29('0x34')]=_[_0x8e29('0x36')](db[_0x8e29('0x31')]['rawAttributes']);_0x5db1e1['query']=_['keys'](_0x4eb761[_0x8e29('0x35')]);_0x5db1e1[_0x8e29('0x37')]=_[_0x8e29('0x38')](_0x5db1e1[_0x8e29('0x34')],_0x5db1e1[_0x8e29('0x35')]);_0xb33b5c[_0x8e29('0x3a')]=_[_0x8e29('0x38')](_0x5db1e1[_0x8e29('0x34')],qs['fields'](_0x4eb761[_0x8e29('0x35')][_0x8e29('0x39')]));_0xb33b5c['attributes']=_0xb33b5c[_0x8e29('0x3a')][_0x8e29('0x3b')]?_0xb33b5c['attributes']:_0x5db1e1[_0x8e29('0x34')];if(_0x4eb761[_0x8e29('0x35')]['includeAll']){_0xb33b5c[_0x8e29('0x44')]=[{'all':!![]}];}_0xb33b5c=_['merge']({},_0xb33b5c,_0x4eb761[_0x8e29('0x42')]);return db[_0x8e29('0x31')][_0x8e29('0x47')](_0xb33b5c)[_0x8e29('0x29')](handleEntityNotFound(_0x54f6d2,null))[_0x8e29('0x29')](respondWithResult(_0x54f6d2,null))[_0x8e29('0x48')](handleError(_0x54f6d2,null));};exports[_0x8e29('0x49')]=function(_0xfefad2,_0x4395ad){return db[_0x8e29('0x31')][_0x8e29('0x49')](_0xfefad2[_0x8e29('0x4a')],{})[_0x8e29('0x29')](respondWithResult(_0x4395ad,0xc9))[_0x8e29('0x48')](handleError(_0x4395ad,null));};exports[_0x8e29('0x4b')]=function(_0x25ea78,_0x4f5a76){var _0x5e0b09={'where':{'id':_0x25ea78[_0x8e29('0x4c')]['id']}},_0x7e11aa={};_0x7e11aa[_0x8e29('0x34')]=_[_0x8e29('0x36')](db['UserProfile'][_0x8e29('0x32')]);_0x5e0b09['attributes']=_[_0x8e29('0x38')](_0x7e11aa['model'],qs[_0x8e29('0x39')](_0x25ea78[_0x8e29('0x35')][_0x8e29('0x39')]));_0x5e0b09[_0x8e29('0x3a')]=_0x5e0b09['attributes'][_0x8e29('0x3b')]?_0x5e0b09['attributes']:_0x7e11aa[_0x8e29('0x34')];if(_0x25ea78[_0x8e29('0x35')][_0x8e29('0x43')]){_0x5e0b09[_0x8e29('0x44')]=[{'all':!![]}];}_0x5e0b09=_[_0x8e29('0x41')]({},_0x5e0b09,_0x25ea78['options']);return db[_0x8e29('0x31')][_0x8e29('0x47')](_0x5e0b09)[_0x8e29('0x29')](handleEntityNotFound(_0x4f5a76,null))['then'](function(_0x1ab5ff){if(_0x1ab5ff){var _0x3f12d5=_0x1ab5ff['get']({'plain':!![]});_0x3f12d5=qs[_0x8e29('0x4d')](_0x3f12d5,['id',_0x8e29('0x4e'),_0x8e29('0x4f'),'crudPermissions']);_0x25ea78[_0x8e29('0x4a')]=_[_0x8e29('0x4d')](_0x25ea78[_0x8e29('0x4a')],['id',_0x8e29('0x4e'),_0x8e29('0x4f')]);return db[_0x8e29('0x50')][_0x8e29('0x51')](function(_0x546076){return db[_0x8e29('0x31')][_0x8e29('0x49')](_[_0x8e29('0x41')](_0x3f12d5,_0x25ea78[_0x8e29('0x4a')]),{'include':_0x25ea78['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x546076})[_0x8e29('0x29')](function(_0x19dc02){var _0x28b20d=_0x19dc02[_0x8e29('0x52')]({'plain':!![]});return db[_0x8e29('0x53')][_0x8e29('0x45')]({'where':{'userProfileId':_0x25ea78[_0x8e29('0x4c')]['id']},'raw':!![]})[_0x8e29('0x29')](function(_0x25879b){if(_0x25879b){return BPromise[_0x8e29('0x54')](_0x25879b,function(_0x977d57){return new BPromise(function(_0x39efaa,_0x299a82){if(_0x977d57['autoAssociation']===null||_0x977d57[_0x8e29('0x55')]===0x1)_0x39efaa(null);return db[_0x8e29('0x56')][_0x8e29('0x45')]({'where':{'sectionId':_0x977d57['id']},'raw':!![]})[_0x8e29('0x29')](function(_0x37e2cf){var _0x36184a=_[_0x8e29('0x30')](_0x37e2cf,function(_0x43af15){return qs['omit'](_0x43af15,['id',_0x8e29('0x4e'),_0x8e29('0x4f'),'sectionId']);});_0x39efaa(_0x36184a);})[_0x8e29('0x48')](function(_0x1bfd10){_0x299a82(_0x1bfd10);});})[_0x8e29('0x29')](function(_0x10fb08){var _0x551d0e=qs[_0x8e29('0x4d')](_0x977d57,['id',_0x8e29('0x4e'),_0x8e29('0x4f')]);_0x551d0e[_0x8e29('0x57')]=_0x28b20d['id'];if(_0x10fb08)_0x551d0e[_0x8e29('0x58')]=_0x10fb08;return _0x551d0e;})[_0x8e29('0x29')](function(_0x1802d9){return db[_0x8e29('0x53')]['create'](_0x1802d9,{'include':[{'model':db[_0x8e29('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x546076});});})[_0x8e29('0x29')](function(){return _0x28b20d;});}});});});}})[_0x8e29('0x29')](respondWithResult(_0x4f5a76,0xc9))['catch'](handleError(_0x4f5a76,null));};exports[_0x8e29('0x28')]=function(_0x2551fd,_0x646406){if(_0x2551fd[_0x8e29('0x4a')]['id']){delete _0x2551fd[_0x8e29('0x4a')]['id'];}return db[_0x8e29('0x31')][_0x8e29('0x47')]({'where':{'id':_0x2551fd['params']['id']}})[_0x8e29('0x29')](handleEntityNotFound(_0x646406,null))[_0x8e29('0x29')](saveUpdates(_0x2551fd[_0x8e29('0x4a')],null))['then'](respondWithResult(_0x646406,null))[_0x8e29('0x48')](handleError(_0x646406,null));};exports[_0x8e29('0x2a')]=function(_0x3af9a4,_0x2b292c){return db[_0x8e29('0x31')]['find']({'where':{'id':_0x3af9a4[_0x8e29('0x4c')]['id']}})[_0x8e29('0x29')](handleEntityNotFound(_0x2b292c,null))['then'](removeEntity(_0x2b292c,null))[_0x8e29('0x48')](handleError(_0x2b292c,null));};exports['describe']=function(_0x30919b,_0x13b8e5){return db[_0x8e29('0x31')][_0x8e29('0x59')]()[_0x8e29('0x29')](respondWithResult(_0x13b8e5,null))[_0x8e29('0x48')](handleError(_0x13b8e5,null));};exports[_0x8e29('0x5a')]=function(_0x3c22c6,_0x18b680){var _0x1c2860=_0x3c22c6[_0x8e29('0x4a')];return db[_0x8e29('0x31')][_0x8e29('0x47')]({'where':{'id':_0x3c22c6[_0x8e29('0x4c')]['id']}})[_0x8e29('0x29')](handleEntityNotFound(_0x18b680,null))[_0x8e29('0x29')](function(_0x276a5f){if(_0x276a5f){return db[_0x8e29('0x50')][_0x8e29('0x51')](function(_0x45c52b){return db[_0x8e29('0x53')][_0x8e29('0x2a')]({'where':{'userProfileId':_0x3c22c6[_0x8e29('0x4c')]['id'],'sectionId':_[_0x8e29('0x30')](_0x1c2860,function(_0x5495ac){return _0x5495ac[_0x8e29('0x5b')];})},'transaction':_0x45c52b})[_0x8e29('0x29')](function(){var _0x51e03d=_[_0x8e29('0x30')](_0x1c2860,function(_0x200a7f){_0x200a7f[_0x8e29('0x57')]=_0x3c22c6[_0x8e29('0x4c')]['id'];return _0x200a7f;});var _0x5ab6ff=[];return BPromise[_0x8e29('0x54')](_0x51e03d,function(_0x3c3270){return db[_0x8e29('0x53')][_0x8e29('0x49')](_0x3c3270,{'include':[{'model':db[_0x8e29('0x56')],'as':_0x8e29('0x58')}],'raw':!![],'transaction':_0x45c52b})[_0x8e29('0x29')](function(_0x83cac3){_0x5ab6ff['push'](_0x83cac3[_0x8e29('0x52')]({'plain':!![]}));});})[_0x8e29('0x29')](function(){return _0x5ab6ff;});});});}})[_0x8e29('0x29')](function(_0x1fa22f){return _0x1fa22f;})['then'](respondWithResult(_0x18b680,null))[_0x8e29('0x48')](handleError(_0x18b680,null));};exports[_0x8e29('0x5c')]=function(_0x1a41c4,_0x50e5b4){var _0x1fef1f;return db[_0x8e29('0x31')][_0x8e29('0x47')]({'where':{'id':_0x1a41c4[_0x8e29('0x4c')]['id']},'attributes':['id',_0x8e29('0x2e')]})[_0x8e29('0x29')](handleEntityNotFound(_0x50e5b4,null))[_0x8e29('0x29')](function(_0x163900){if(_0x163900){_0x1fef1f=_0x163900;return db[_0x8e29('0x53')][_0x8e29('0x2a')]({'where':{'userProfileId':_0x1a41c4[_0x8e29('0x4c')]['id'],'sectionId':_0x1a41c4['query'][_0x8e29('0x5d')]}});}})[_0x8e29('0x29')](function(){return _0x1fef1f;})['then'](respondWithStatusCode(_0x50e5b4,null))[_0x8e29('0x48')](handleError(_0x50e5b4,null));};exports[_0x8e29('0x5e')]=function(_0x3d4a08,_0x32f319){var _0x3cad7e=[];var _0x505d5f=[];return db['UserProfileSection'][_0x8e29('0x45')]({'where':{'userProfileId':_0x3d4a08[_0x8e29('0x4c')]['id']},'raw':!![]})['then'](function(_0x1dea64){_0x3cad7e=_[_0x8e29('0x5f')](_0x1dea64,function(_0x448c0a){return _0x448c0a[_0x8e29('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x448c0a[_0x8e29('0x5b')]);});if(!_[_0x8e29('0x61')](_0x3cad7e)){return _[_0x8e29('0x30')](_0x3cad7e,function(_0x59fd64){return _0x59fd64[_0x8e29('0x5b')];});}else{return;}})[_0x8e29('0x29')](function(_0x33f883){if(_0x33f883)_0x505d5f=_0x33f883;if(_[_0x8e29('0x62')](_0x505d5f,0x64)){var _0x1f610e=_[_0x8e29('0x47')](_0x3cad7e,{'sectionId':0x64});return hasDefaultDashboard(_0x1f610e)[_0x8e29('0x29')](function(_0x4c23cc){return _[_0x8e29('0x30')](_0x3cad7e,function(_0x4e1166){if(_0x4e1166[_0x8e29('0x5b')]===0x64){_0x4e1166[_0x8e29('0x63')]=_0x4c23cc;}return _0x4e1166;});});}else{return;}})['then'](function(_0x4380e7){if(_0x4380e7)_0x3cad7e=_0x4380e7;if(_[_0x8e29('0x62')](_0x505d5f,0x3eb)){var _0x491aa4=_[_0x8e29('0x47')](_0x3cad7e,{'sectionId':0x3eb});return getCustomDashboards(_0x491aa4)[_0x8e29('0x29')](function(_0x53208a){return _[_0x8e29('0x30')](_0x3cad7e,function(_0x351393){if(_0x491aa4[_0x8e29('0x60')]){if(_0x351393[_0x8e29('0x5b')]===0x3eb){_0x351393['subsections']=_0x53208a;}}else{if(_0x351393['sectionId']===0x64){if(!_0x351393[_0x8e29('0x63')]){_0x351393[_0x8e29('0x63')]=[];}_0x351393['subsections']=_0x351393['subsections'][_0x8e29('0x64')](_0x53208a);}}return _0x351393;});});}else{return;}})[_0x8e29('0x29')](function(_0x54f82f){if(_0x54f82f)_0x3cad7e=_0x54f82f;if(_[_0x8e29('0x62')](_0x505d5f,0x709)){var _0x3f5b55=_[_0x8e29('0x47')](_0x3cad7e,{'sectionId':0x709});return getPlugins(_0x3f5b55)[_0x8e29('0x29')](function(_0x48d93e){if(_0x3f5b55['enabled']){return _[_0x8e29('0x30')](_0x3cad7e,function(_0x110b4d){if(_0x110b4d['sectionId']===0x709){_0x110b4d[_0x8e29('0x63')]=_0x48d93e;}return _0x110b4d;});}else{var _0x39dbdb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x48d93e};var _0x4ccfff=_['map'](_0x3cad7e);_0x4ccfff[_0x8e29('0x65')](_0x39dbdb);return _0x4ccfff;}});}else{return;}})[_0x8e29('0x29')](function(_0x9c7815){if(_0x9c7815)_0x3cad7e=_0x9c7815;return _[_0x8e29('0x5f')](_0x3cad7e,[_0x8e29('0x60'),0x1]);})[_0x8e29('0x29')](respondWithResult(_0x32f319,null))[_0x8e29('0x48')](handleError(_0x32f319,null));};function hasDefaultDashboard(_0x19fce0){var _0x1c1b1c=[0x65];return new BPromise(function(_0x1a6c69,_0x471658){try{if(_0x19fce0[_0x8e29('0x55')]){_0x1a6c69(_0x1c1b1c);}else{return db[_0x8e29('0x56')]['findOne']({'where':{'sectionId':_0x19fce0['id']},'raw':!![]})[_0x8e29('0x29')](function(_0x4f34e4){_0x4f34e4?_0x1a6c69(_0x1c1b1c):_0x1a6c69();});}}catch(_0x5712a9){_0x471658(_0x5712a9);}});}function getCustomDashboards(_0x585a58){var _0x2b1c6c=[];return new BPromise(function(_0x443c8f,_0x5cfe57){try{if(_0x585a58[_0x8e29('0x55')]){return db[_0x8e29('0x66')][_0x8e29('0x45')]({'raw':!![]})[_0x8e29('0x29')](function(_0x335c5c){_0x335c5c[_0x8e29('0x67')](function(_0xa11a54){_0x2b1c6c[_0x8e29('0x65')](_0xa11a54['id']+0x1869f);});_0x443c8f(_0x2b1c6c);});}else{return db[_0x8e29('0x56')][_0x8e29('0x45')]({'where':{'sectionId':_0x585a58['id']},'raw':!![]})[_0x8e29('0x29')](function(_0x11f65b){_0x11f65b['forEach'](function(_0x31bfc4){_0x2b1c6c[_0x8e29('0x65')](_0x31bfc4[_0x8e29('0x68')]+0x1869f);});_0x443c8f(_0x2b1c6c);});}}catch(_0x118ea2){_0x5cfe57(_0x118ea2);}});}function getPlugins(_0x2e53bd){var _0x136bc8=[];return new BPromise(function(_0x527adf,_0x1c60b2){try{if(_0x2e53bd[_0x8e29('0x55')]){return db[_0x8e29('0x69')][_0x8e29('0x45')]({'raw':!![]})['then'](function(_0x23712d){_0x23712d[_0x8e29('0x67')](function(_0xfc8792){_0x136bc8['push'](_0xfc8792['id']+0x15b38);});_0x527adf(_0x136bc8);});}else{return db[_0x8e29('0x56')][_0x8e29('0x45')]({'where':{'sectionId':_0x2e53bd['id']},'raw':!![]})[_0x8e29('0x29')](function(_0x2a3d7a){_0x2a3d7a[_0x8e29('0x67')](function(_0x2f1573){_0x136bc8[_0x8e29('0x65')](_0x2f1573['resourceId']+0x15b38);});_0x527adf(_0x136bc8);});}}catch(_0x35e6b1){_0x1c60b2(_0x35e6b1);}});}exports['addResources']=function(_0x4437a4,_0x2b2d33){return db['UserProfile'][_0x8e29('0x47')]({'where':{'id':_0x4437a4[_0x8e29('0x4c')]['id']}})[_0x8e29('0x29')](handleEntityNotFound(_0x2b2d33,null))['then'](function(_0x9f2393){if(_0x9f2393){return db[_0x8e29('0x50')][_0x8e29('0x51')](function(_0x1ba93d){return db[_0x8e29('0x53')][_0x8e29('0x45')]({'where':{'userProfileId':_0x4437a4[_0x8e29('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3689e2){if(_0x3689e2){return db[_0x8e29('0x53')][_0x8e29('0x2a')]({'where':{'userProfileId':_0x4437a4[_0x8e29('0x4c')]['id'],'id':_[_0x8e29('0x30')](_0x3689e2,function(_0x1ac5ec){return _0x1ac5ec['id'];})},'transaction':_0x1ba93d});}})[_0x8e29('0x29')](function(_0x3adad7){var _0x506c6e=_[_0x8e29('0x30')](_0x4437a4[_0x8e29('0x4a')],function(_0x5a1843){_0x5a1843[_0x8e29('0x57')]=_0x4437a4['params']['id'];return _0x5a1843;});return db['UserProfileSection'][_0x8e29('0x6a')](_0x506c6e,{'raw':!![],'transaction':_0x1ba93d});})[_0x8e29('0x29')](function(_0x2edf56){var _0x27252b=_['filter'](_[_0x8e29('0x30')](_0x2edf56,function(_0x421d4f){return _0x421d4f[_0x8e29('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x27252b){return db['UserProfileSection'][_0x8e29('0x45')]({'where':{'userProfileId':_0x4437a4[_0x8e29('0x4c')]['id'],'sectionId':_['map'](_0x27252b,function(_0x3b0c17){return _0x3b0c17[_0x8e29('0x5b')];})},'attributes':['id',_0x8e29('0x5b')],'raw':!![]})['then'](function(_0x5523da){var _0x545465=_[_0x8e29('0x30')](_0x4437a4['body'],function(_0x47b514){_0x47b514[_0x8e29('0x57')]=_0x4437a4[_0x8e29('0x4c')]['id'];return _0x47b514;});return db[_0x8e29('0x56')]['bulkCreate'](_0x545465,{'raw':!![],'transaction':_0x1ba93d});});}})[_0x8e29('0x48')](handleError(_0x2b2d33,null));});}})[_0x8e29('0x29')](function(_0x2b68ac){var _0x2463d1=_[_0x8e29('0x30')](_0x2b68ac,function(_0x2972f5){return _0x2972f5[_0x8e29('0x52')]({'plain':!![]});});})[_0x8e29('0x29')](respondWithResult(_0x2b2d33,null))[_0x8e29('0x48')](handleError(_0x2b2d33,null));};exports['removeResources']=function(_0x501d30,_0x359a70,_0x261851){return db[_0x8e29('0x31')][_0x8e29('0x47')]({'where':{'id':_0x501d30[_0x8e29('0x4c')]['id']}})[_0x8e29('0x29')](handleEntityNotFound(_0x359a70,null))['then'](function(_0x5d1b3d){if(_0x5d1b3d){return _0x5d1b3d[_0x8e29('0x6b')](_0x501d30[_0x8e29('0x35')][_0x8e29('0x5d')]);}})[_0x8e29('0x29')](respondWithStatusCode(_0x359a70,null))[_0x8e29('0x48')](handleError(_0x359a70,null));};exports[_0x8e29('0x6c')]=function(_0x1f9ca7,_0x2b8866){var _0x3d91f7={};if(!_0x1f9ca7[_0x8e29('0x35')][_0x8e29('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x1f9ca7['query'][_0x8e29('0x6e')]('nolimit')){_0x3d91f7[_0x8e29('0x20')]=qs[_0x8e29('0x20')](_0x1f9ca7[_0x8e29('0x35')]['limit']);_0x3d91f7[_0x8e29('0x23')]=qs[_0x8e29('0x23')](_0x1f9ca7[_0x8e29('0x35')][_0x8e29('0x23')]);}return db[_0x8e29('0x31')]['find']({'where':{'id':_0x1f9ca7[_0x8e29('0x4c')]['id']}})[_0x8e29('0x29')](function(_0x5731b5){if(!_0x5731b5)throw new Error(_0x8e29('0x6f')+_0x1f9ca7['params']['id']);return db[_0x8e29('0x31')][_0x8e29('0x6c')](_0x1f9ca7);})['then'](respondWithFilteredResult(_0x2b8866,_0x3d91f7))[_0x8e29('0x48')](handleError(_0x2b8866,null));}; \ No newline at end of file +var _0xa0cc=['includeAll','include','findAll','rows','catch','show','params','keys','body','clone','rawAttributes','length','find','get','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','create','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','addSections','sectionId','userProfileId','enabled','subsections','concat','includes','push','filter','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','UserProfile','type','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','merge','options'];(function(_0x698cb3,_0x477937){var _0x40777e=function(_0x30712c){while(--_0x30712c){_0x698cb3['push'](_0x698cb3['shift']());}};_0x40777e(++_0x477937);}(_0xa0cc,0xa0));var _0xca0c=function(_0x46426e,_0x153d67){_0x46426e=_0x46426e-0x0;var _0x51c4dc=_0xa0cc[_0x46426e];return _0x51c4dc;};'use strict';var emlformat=require(_0xca0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca0c('0x1'));var jsonpatch=require(_0xca0c('0x2'));var rp=require(_0xca0c('0x3'));var moment=require(_0xca0c('0x4'));var BPromise=require(_0xca0c('0x5'));var Mustache=require(_0xca0c('0x6'));var util=require(_0xca0c('0x7'));var path=require('path');var sox=require(_0xca0c('0x8'));var csv=require(_0xca0c('0x9'));var ejs=require(_0xca0c('0xa'));var fs=require('fs');var fs_extra=require(_0xca0c('0xb'));var _=require(_0xca0c('0xc'));var squel=require(_0xca0c('0xd'));var crypto=require(_0xca0c('0xe'));var jsforce=require(_0xca0c('0xf'));var deskjs=require(_0xca0c('0x10'));var toCsv=require(_0xca0c('0x9'));var querystring=require(_0xca0c('0x11'));var Papa=require(_0xca0c('0x12'));var Redis=require(_0xca0c('0x13'));var authService=require(_0xca0c('0x14'));var qs=require(_0xca0c('0x15'));var as=require(_0xca0c('0x16'));var hardwareService=require(_0xca0c('0x17'));var logger=require('../../config/logger')(_0xca0c('0x18'));var utils=require('../../config/utils');var config=require(_0xca0c('0x19'));var licenseUtil=require(_0xca0c('0x1a'));var db=require(_0xca0c('0x1b'))['db'];config[_0xca0c('0x1c')]=_[_0xca0c('0x1d')](config[_0xca0c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xca0c('0x1e'))(new Redis(config[_0xca0c('0x1c')]));require(_0xca0c('0x1f'))[_0xca0c('0x20')](socket);function respondWithStatusCode(_0x4a14bd,_0x33798d){_0x33798d=_0x33798d||0xcc;return function(_0x229d31){if(_0x229d31){return _0x4a14bd[_0xca0c('0x21')](_0x33798d);}return _0x4a14bd[_0xca0c('0x22')](_0x33798d)[_0xca0c('0x23')]();};}function respondWithResult(_0x433b82,_0xc801c6){_0xc801c6=_0xc801c6||0xc8;return function(_0x223cbe){if(_0x223cbe){return _0x433b82['status'](_0xc801c6)['json'](_0x223cbe);}};}function respondWithFilteredResult(_0x400a4b,_0x5bb6c9){return function(_0x390ec1){if(_0x390ec1){var _0x1edc6c=typeof _0x5bb6c9[_0xca0c('0x24')]===_0xca0c('0x25')&&typeof _0x5bb6c9[_0xca0c('0x26')]===_0xca0c('0x25');var _0x25f8b8=_0x390ec1['count'];var _0x1a9fed=_0x1edc6c?0x0:_0x5bb6c9['offset'];var _0x56ecde=_0x1edc6c?_0x390ec1[_0xca0c('0x27')]:_0x5bb6c9['offset']+_0x5bb6c9[_0xca0c('0x26')];var _0x1387eb;if(_0x56ecde>=_0x25f8b8){_0x56ecde=_0x25f8b8;_0x1387eb=0xc8;}else{_0x1387eb=0xce;}_0x400a4b[_0xca0c('0x22')](_0x1387eb);return _0x400a4b[_0xca0c('0x28')](_0xca0c('0x29'),_0x1a9fed+'-'+_0x56ecde+'/'+_0x25f8b8)['json'](_0x390ec1);}return null;};}function patchUpdates(_0xd07a55){return function(_0x2444cd){try{jsonpatch['apply'](_0x2444cd,_0xd07a55,!![]);}catch(_0x158a9f){return BPromise[_0xca0c('0x2a')](_0x158a9f);}return _0x2444cd['save']();};}function saveUpdates(_0x4d1aea,_0x448345){return function(_0x9c7cf2){if(_0x9c7cf2){return _0x9c7cf2[_0xca0c('0x2b')](_0x4d1aea)[_0xca0c('0x2c')](function(_0x5dc0bf){return _0x5dc0bf;});}return null;};}function removeEntity(_0x41189b,_0x5a02a9){return function(_0x474dc9){if(_0x474dc9){return _0x474dc9[_0xca0c('0x2d')]()['then'](function(){_0x41189b[_0xca0c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9f95,_0x1e7528){return function(_0x176958){if(!_0x176958){_0x4d9f95[_0xca0c('0x21')](0x194);}return _0x176958;};}function handleError(_0x2ce924,_0x552c1d){_0x552c1d=_0x552c1d||0x1f4;return function(_0x3c4d83){logger[_0xca0c('0x2e')](_0x3c4d83[_0xca0c('0x2f')]);if(_0x3c4d83[_0xca0c('0x30')]){delete _0x3c4d83[_0xca0c('0x30')];}_0x2ce924[_0xca0c('0x22')](_0x552c1d)[_0xca0c('0x31')](_0x3c4d83);};}exports[_0xca0c('0x32')]=function(_0xe2dbcb,_0x238bed){var _0x3134d2={},_0x3cfc83={},_0x48048a={'count':0x0,'rows':[]};var _0x175fdc=_['map'](db[_0xca0c('0x33')]['rawAttributes'],function(_0x3f1208){return{'name':_0x3f1208['fieldName'],'type':_0x3f1208[_0xca0c('0x34')]['key']};});_0x3cfc83[_0xca0c('0x35')]=_[_0xca0c('0x36')](_0x175fdc,_0xca0c('0x30'));_0x3cfc83['query']=_['keys'](_0xe2dbcb[_0xca0c('0x37')]);_0x3cfc83['filters']=_[_0xca0c('0x38')](_0x3cfc83[_0xca0c('0x35')],_0x3cfc83['query']);_0x3134d2[_0xca0c('0x39')]=_[_0xca0c('0x38')](_0x3cfc83[_0xca0c('0x35')],qs[_0xca0c('0x3a')](_0xe2dbcb[_0xca0c('0x37')][_0xca0c('0x3a')]));_0x3134d2[_0xca0c('0x39')]=_0x3134d2[_0xca0c('0x39')]['length']?_0x3134d2[_0xca0c('0x39')]:_0x3cfc83[_0xca0c('0x35')];if(!_0xe2dbcb[_0xca0c('0x37')][_0xca0c('0x3b')](_0xca0c('0x3c'))){_0x3134d2[_0xca0c('0x26')]=qs[_0xca0c('0x26')](_0xe2dbcb[_0xca0c('0x37')]['limit']);_0x3134d2[_0xca0c('0x24')]=qs[_0xca0c('0x24')](_0xe2dbcb['query'][_0xca0c('0x24')]);}_0x3134d2[_0xca0c('0x3d')]=qs['sort'](_0xe2dbcb[_0xca0c('0x37')]['sort']);_0x3134d2[_0xca0c('0x3e')]=qs[_0xca0c('0x3f')](_[_0xca0c('0x40')](_0xe2dbcb[_0xca0c('0x37')],_0x3cfc83[_0xca0c('0x3f')]),_0x175fdc);if(_0xe2dbcb[_0xca0c('0x37')]['filter']){_0x3134d2['where']=_['merge'](_0x3134d2[_0xca0c('0x3e')],{'$or':_[_0xca0c('0x36')](_0x175fdc,function(_0x138648){if(_0x138648[_0xca0c('0x34')]!==_0xca0c('0x41')){var _0x25a284={};_0x25a284[_0x138648['name']]={'$like':'%'+_0xe2dbcb['query']['filter']+'%'};return _0x25a284;}})});}_0x3134d2=_[_0xca0c('0x42')]({},_0x3134d2,_0xe2dbcb[_0xca0c('0x43')]);var _0x23c232={'where':_0x3134d2['where']};return db[_0xca0c('0x33')]['count'](_0x23c232)[_0xca0c('0x2c')](function(_0x10c6d0){_0x48048a[_0xca0c('0x27')]=_0x10c6d0;if(_0xe2dbcb['query'][_0xca0c('0x44')]){_0x3134d2[_0xca0c('0x45')]=[{'all':!![]}];}return db[_0xca0c('0x33')][_0xca0c('0x46')](_0x3134d2);})[_0xca0c('0x2c')](function(_0x30c397){_0x48048a[_0xca0c('0x47')]=_0x30c397;return _0x48048a;})[_0xca0c('0x2c')](respondWithFilteredResult(_0x238bed,_0x3134d2))[_0xca0c('0x48')](handleError(_0x238bed,null));};exports[_0xca0c('0x49')]=function(_0x2cc02e,_0x253527){var _0x10d94d={'raw':![],'where':{'id':_0x2cc02e[_0xca0c('0x4a')]['id']}},_0x48db9a={};_0x48db9a[_0xca0c('0x35')]=_['keys'](db['UserProfile']['rawAttributes']);_0x48db9a[_0xca0c('0x37')]=_[_0xca0c('0x4b')](_0x2cc02e[_0xca0c('0x37')]);_0x48db9a[_0xca0c('0x3f')]=_[_0xca0c('0x38')](_0x48db9a[_0xca0c('0x35')],_0x48db9a[_0xca0c('0x37')]);_0x10d94d[_0xca0c('0x39')]=_[_0xca0c('0x38')](_0x48db9a[_0xca0c('0x35')],qs['fields'](_0x2cc02e[_0xca0c('0x37')]['fields']));_0x10d94d[_0xca0c('0x39')]=_0x10d94d[_0xca0c('0x39')]['length']?_0x10d94d[_0xca0c('0x39')]:_0x48db9a['model'];if(_0x2cc02e[_0xca0c('0x37')][_0xca0c('0x44')]){_0x10d94d[_0xca0c('0x45')]=[{'all':!![]}];}_0x10d94d=_['merge']({},_0x10d94d,_0x2cc02e[_0xca0c('0x43')]);return db[_0xca0c('0x33')]['find'](_0x10d94d)[_0xca0c('0x2c')](handleEntityNotFound(_0x253527,null))[_0xca0c('0x2c')](respondWithResult(_0x253527,null))[_0xca0c('0x48')](handleError(_0x253527,null));};exports['create']=function(_0xbc6b67,_0x10e3a5){return db[_0xca0c('0x33')]['create'](_0xbc6b67[_0xca0c('0x4c')],{})[_0xca0c('0x2c')](respondWithResult(_0x10e3a5,0xc9))[_0xca0c('0x48')](handleError(_0x10e3a5,null));};exports[_0xca0c('0x4d')]=function(_0x1ba776,_0x3129f8){var _0x5de59c={'where':{'id':_0x1ba776[_0xca0c('0x4a')]['id']}},_0x280cf2={};_0x280cf2[_0xca0c('0x35')]=_[_0xca0c('0x4b')](db[_0xca0c('0x33')][_0xca0c('0x4e')]);_0x5de59c[_0xca0c('0x39')]=_['intersection'](_0x280cf2[_0xca0c('0x35')],qs['fields'](_0x1ba776[_0xca0c('0x37')][_0xca0c('0x3a')]));_0x5de59c['attributes']=_0x5de59c['attributes'][_0xca0c('0x4f')]?_0x5de59c[_0xca0c('0x39')]:_0x280cf2[_0xca0c('0x35')];if(_0x1ba776[_0xca0c('0x37')][_0xca0c('0x44')]){_0x5de59c[_0xca0c('0x45')]=[{'all':!![]}];}_0x5de59c=_[_0xca0c('0x42')]({},_0x5de59c,_0x1ba776[_0xca0c('0x43')]);return db[_0xca0c('0x33')][_0xca0c('0x50')](_0x5de59c)[_0xca0c('0x2c')](handleEntityNotFound(_0x3129f8,null))[_0xca0c('0x2c')](function(_0xa47ccf){if(_0xa47ccf){var _0x5d076c=_0xa47ccf[_0xca0c('0x51')]({'plain':!![]});_0x5d076c=qs['omit'](_0x5d076c,['id','createdAt',_0xca0c('0x52'),_0xca0c('0x53')]);_0x1ba776[_0xca0c('0x4c')]=_[_0xca0c('0x54')](_0x1ba776['body'],['id',_0xca0c('0x55'),_0xca0c('0x52')]);return db[_0xca0c('0x56')][_0xca0c('0x57')](function(_0x272522){return db[_0xca0c('0x33')][_0xca0c('0x58')](_['merge'](_0x5d076c,_0x1ba776['body']),{'include':_0x1ba776['query'][_0xca0c('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x272522})[_0xca0c('0x2c')](function(_0x47736a){var _0x13234e=_0x47736a[_0xca0c('0x51')]({'plain':!![]});return db[_0xca0c('0x59')][_0xca0c('0x46')]({'where':{'userProfileId':_0x1ba776[_0xca0c('0x4a')]['id']},'raw':!![]})[_0xca0c('0x2c')](function(_0x2f096b){if(_0x2f096b){return BPromise[_0xca0c('0x5a')](_0x2f096b,function(_0x4be9d2){return new BPromise(function(_0x273652,_0x5798c6){if(_0x4be9d2['autoAssociation']===null||_0x4be9d2[_0xca0c('0x5b')]===0x1)_0x273652(null);return db[_0xca0c('0x5c')][_0xca0c('0x46')]({'where':{'sectionId':_0x4be9d2['id']},'raw':!![]})[_0xca0c('0x2c')](function(_0x237b88){var _0xb02416=_[_0xca0c('0x36')](_0x237b88,function(_0x477c6a){return qs['omit'](_0x477c6a,['id',_0xca0c('0x55'),_0xca0c('0x52'),'sectionId']);});_0x273652(_0xb02416);})[_0xca0c('0x48')](function(_0x394c13){_0x5798c6(_0x394c13);});})[_0xca0c('0x2c')](function(_0x353ba7){var _0x10f303=qs[_0xca0c('0x54')](_0x4be9d2,['id',_0xca0c('0x55'),_0xca0c('0x52')]);_0x10f303['userProfileId']=_0x13234e['id'];if(_0x353ba7)_0x10f303[_0xca0c('0x5d')]=_0x353ba7;return _0x10f303;})[_0xca0c('0x2c')](function(_0x1d5973){return db[_0xca0c('0x59')][_0xca0c('0x58')](_0x1d5973,{'include':[{'model':db['UserProfileResource'],'as':_0xca0c('0x5d')}],'raw':!![],'transaction':_0x272522});});})[_0xca0c('0x2c')](function(){return _0x13234e;});}});});});}})['then'](respondWithResult(_0x3129f8,0xc9))[_0xca0c('0x48')](handleError(_0x3129f8,null));};exports['update']=function(_0x44804a,_0x4d5a63){if(_0x44804a['body']['id']){delete _0x44804a[_0xca0c('0x4c')]['id'];}return db[_0xca0c('0x33')]['find']({'where':{'id':_0x44804a[_0xca0c('0x4a')]['id']}})[_0xca0c('0x2c')](handleEntityNotFound(_0x4d5a63,null))[_0xca0c('0x2c')](saveUpdates(_0x44804a[_0xca0c('0x4c')],null))[_0xca0c('0x2c')](respondWithResult(_0x4d5a63,null))[_0xca0c('0x48')](handleError(_0x4d5a63,null));};exports[_0xca0c('0x2d')]=function(_0x4dfd2f,_0x3fb66d){return db[_0xca0c('0x33')][_0xca0c('0x50')]({'where':{'id':_0x4dfd2f['params']['id']}})[_0xca0c('0x2c')](handleEntityNotFound(_0x3fb66d,null))['then'](removeEntity(_0x3fb66d,null))[_0xca0c('0x48')](handleError(_0x3fb66d,null));};exports['describe']=function(_0xc566ff,_0x4d21af){return db[_0xca0c('0x33')]['describe']()['then'](respondWithResult(_0x4d21af,null))[_0xca0c('0x48')](handleError(_0x4d21af,null));};exports[_0xca0c('0x5e')]=function(_0x20913a,_0x680033){var _0x1db2e4=_0x20913a[_0xca0c('0x4c')];return db['UserProfile'][_0xca0c('0x50')]({'where':{'id':_0x20913a[_0xca0c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x680033,null))[_0xca0c('0x2c')](function(_0x30e6c4){if(_0x30e6c4){return db['sequelize'][_0xca0c('0x57')](function(_0x119a88){return db[_0xca0c('0x59')][_0xca0c('0x2d')]({'where':{'userProfileId':_0x20913a[_0xca0c('0x4a')]['id'],'sectionId':_[_0xca0c('0x36')](_0x1db2e4,function(_0x161771){return _0x161771[_0xca0c('0x5f')];})},'transaction':_0x119a88})[_0xca0c('0x2c')](function(){var _0x4091e2=_[_0xca0c('0x36')](_0x1db2e4,function(_0x13f8f8){_0x13f8f8[_0xca0c('0x60')]=_0x20913a[_0xca0c('0x4a')]['id'];return _0x13f8f8;});var _0x366968=[];return BPromise[_0xca0c('0x5a')](_0x4091e2,function(_0x198d37){return db[_0xca0c('0x59')]['create'](_0x198d37,{'include':[{'model':db[_0xca0c('0x5c')],'as':_0xca0c('0x5d')}],'raw':!![],'transaction':_0x119a88})[_0xca0c('0x2c')](function(_0x311772){_0x366968['push'](_0x311772[_0xca0c('0x51')]({'plain':!![]}));});})['then'](function(){return _0x366968;});});});}})[_0xca0c('0x2c')](function(_0x34ba9a){return _0x34ba9a;})[_0xca0c('0x2c')](respondWithResult(_0x680033,null))[_0xca0c('0x48')](handleError(_0x680033,null));};exports['removeSections']=function(_0x3dd666,_0x152118){var _0x3ec3fc;return db[_0xca0c('0x33')]['find']({'where':{'id':_0x3dd666[_0xca0c('0x4a')]['id']},'attributes':['id',_0xca0c('0x30')]})['then'](handleEntityNotFound(_0x152118,null))[_0xca0c('0x2c')](function(_0x57c82b){if(_0x57c82b){_0x3ec3fc=_0x57c82b;return db[_0xca0c('0x59')][_0xca0c('0x2d')]({'where':{'userProfileId':_0x3dd666[_0xca0c('0x4a')]['id'],'sectionId':_0x3dd666[_0xca0c('0x37')]['ids']}});}})[_0xca0c('0x2c')](function(){return _0x3ec3fc;})[_0xca0c('0x2c')](respondWithStatusCode(_0x152118,null))[_0xca0c('0x48')](handleError(_0x152118,null));};exports['getSections']=function(_0xa7c51e,_0xde2f3e){var _0x3da433=[];var _0x1d1121=[];return db[_0xca0c('0x59')]['findAll']({'where':{'userProfileId':_0xa7c51e[_0xca0c('0x4a')]['id']},'raw':!![]})[_0xca0c('0x2c')](function(_0x1bcfd5){_0x3da433=_['filter'](_0x1bcfd5,function(_0x320e4e){return _0x320e4e[_0xca0c('0x61')]===0x1||_['includes']([0x3eb,0x709],_0x320e4e[_0xca0c('0x5f')]);});if(!_['isEmpty'](_0x3da433)){return _[_0xca0c('0x36')](_0x3da433,function(_0x3f84b8){return _0x3f84b8[_0xca0c('0x5f')];});}else{return;}})[_0xca0c('0x2c')](function(_0x2feef7){if(_0x2feef7)_0x1d1121=_0x2feef7;if(_['includes'](_0x1d1121,0x64)){var _0x2bb37b=_['find'](_0x3da433,{'sectionId':0x64});return hasDefaultDashboard(_0x2bb37b)[_0xca0c('0x2c')](function(_0x40689e){return _[_0xca0c('0x36')](_0x3da433,function(_0x4faa73){if(_0x4faa73['sectionId']===0x64){_0x4faa73[_0xca0c('0x62')]=_0x40689e;}return _0x4faa73;});});}else{return;}})[_0xca0c('0x2c')](function(_0x382c82){if(_0x382c82)_0x3da433=_0x382c82;if(_['includes'](_0x1d1121,0x3eb)){var _0x4d208d=_[_0xca0c('0x50')](_0x3da433,{'sectionId':0x3eb});return getCustomDashboards(_0x4d208d)[_0xca0c('0x2c')](function(_0x1b8feb){return _[_0xca0c('0x36')](_0x3da433,function(_0x27bc41){if(_0x4d208d['enabled']){if(_0x27bc41[_0xca0c('0x5f')]===0x3eb){_0x27bc41[_0xca0c('0x62')]=_0x1b8feb;}}else{if(_0x27bc41[_0xca0c('0x5f')]===0x64){if(!_0x27bc41[_0xca0c('0x62')]){_0x27bc41[_0xca0c('0x62')]=[];}_0x27bc41['subsections']=_0x27bc41[_0xca0c('0x62')][_0xca0c('0x63')](_0x1b8feb);}}return _0x27bc41;});});}else{return;}})[_0xca0c('0x2c')](function(_0x439ffe){if(_0x439ffe)_0x3da433=_0x439ffe;if(_[_0xca0c('0x64')](_0x1d1121,0x709)){var _0x1e16af=_[_0xca0c('0x50')](_0x3da433,{'sectionId':0x709});return getPlugins(_0x1e16af)['then'](function(_0x51f33c){if(_0x1e16af[_0xca0c('0x61')]){return _['map'](_0x3da433,function(_0x905add){if(_0x905add[_0xca0c('0x5f')]===0x709){_0x905add[_0xca0c('0x62')]=_0x51f33c;}return _0x905add;});}else{var _0x91e271={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51f33c};var _0x2491d1=_[_0xca0c('0x36')](_0x3da433);_0x2491d1[_0xca0c('0x65')](_0x91e271);return _0x2491d1;}});}else{return;}})[_0xca0c('0x2c')](function(_0x2d50f1){if(_0x2d50f1)_0x3da433=_0x2d50f1;return _[_0xca0c('0x66')](_0x3da433,['enabled',0x1]);})[_0xca0c('0x2c')](respondWithResult(_0xde2f3e,null))['catch'](handleError(_0xde2f3e,null));};function hasDefaultDashboard(_0x379aad){var _0x4b0c50=[0x65];return new BPromise(function(_0x40ca6f,_0x49b07c){try{if(_0x379aad['autoAssociation']){_0x40ca6f(_0x4b0c50);}else{return db['UserProfileResource'][_0xca0c('0x67')]({'where':{'sectionId':_0x379aad['id']},'raw':!![]})[_0xca0c('0x2c')](function(_0x4cabaa){_0x4cabaa?_0x40ca6f(_0x4b0c50):_0x40ca6f();});}}catch(_0x3e8259){_0x49b07c(_0x3e8259);}});}function getCustomDashboards(_0x171aa9){var _0x155d4b=[];return new BPromise(function(_0x5f1f0a,_0x2cfdae){try{if(_0x171aa9[_0xca0c('0x5b')]){return db['Dashboard'][_0xca0c('0x46')]({'raw':!![]})[_0xca0c('0x2c')](function(_0x52b492){_0x52b492['forEach'](function(_0x9b8518){_0x155d4b[_0xca0c('0x65')](_0x9b8518['id']+0x1869f);});_0x5f1f0a(_0x155d4b);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x171aa9['id']},'raw':!![]})['then'](function(_0x3f9271){_0x3f9271[_0xca0c('0x68')](function(_0x4a7df0){_0x155d4b['push'](_0x4a7df0[_0xca0c('0x69')]+0x1869f);});_0x5f1f0a(_0x155d4b);});}}catch(_0x5d2a7e){_0x2cfdae(_0x5d2a7e);}});}function getPlugins(_0x597544){var _0x47a1bd=[];return new BPromise(function(_0xecca43,_0x5df186){try{if(_0x597544[_0xca0c('0x5b')]){return db[_0xca0c('0x6a')]['findAll']({'raw':!![]})[_0xca0c('0x2c')](function(_0x5b3525){_0x5b3525[_0xca0c('0x68')](function(_0x3f865a){_0x47a1bd[_0xca0c('0x65')](_0x3f865a['id']+0x15b38);});_0xecca43(_0x47a1bd);});}else{return db['UserProfileResource'][_0xca0c('0x46')]({'where':{'sectionId':_0x597544['id']},'raw':!![]})[_0xca0c('0x2c')](function(_0x4b963c){_0x4b963c['forEach'](function(_0x1c6069){_0x47a1bd[_0xca0c('0x65')](_0x1c6069['resourceId']+0x15b38);});_0xecca43(_0x47a1bd);});}}catch(_0x1e82fa){_0x5df186(_0x1e82fa);}});}exports[_0xca0c('0x6b')]=function(_0x2212d2,_0xd21060){return db[_0xca0c('0x33')][_0xca0c('0x50')]({'where':{'id':_0x2212d2[_0xca0c('0x4a')]['id']}})[_0xca0c('0x2c')](handleEntityNotFound(_0xd21060,null))[_0xca0c('0x2c')](function(_0x43355a){if(_0x43355a){return db[_0xca0c('0x56')][_0xca0c('0x57')](function(_0x5cfb6d){return db[_0xca0c('0x59')][_0xca0c('0x46')]({'where':{'userProfileId':_0x2212d2[_0xca0c('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xca0c('0x2c')](function(_0x3628fd){if(_0x3628fd){return db[_0xca0c('0x59')]['destroy']({'where':{'userProfileId':_0x2212d2[_0xca0c('0x4a')]['id'],'id':_['map'](_0x3628fd,function(_0x1b3438){return _0x1b3438['id'];})},'transaction':_0x5cfb6d});}})[_0xca0c('0x2c')](function(_0x19a677){var _0x45c9f1=_[_0xca0c('0x36')](_0x2212d2[_0xca0c('0x4c')],function(_0x41f45b){_0x41f45b['userProfileId']=_0x2212d2['params']['id'];return _0x41f45b;});return db[_0xca0c('0x59')]['bulkCreate'](_0x45c9f1,{'raw':!![],'transaction':_0x5cfb6d});})[_0xca0c('0x2c')](function(_0x316e9b){var _0x3aeeb9=_[_0xca0c('0x66')](_['map'](_0x316e9b,function(_0x43d7d1){return _0x43d7d1['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3aeeb9){return db[_0xca0c('0x59')][_0xca0c('0x46')]({'where':{'userProfileId':_0x2212d2[_0xca0c('0x4a')]['id'],'sectionId':_[_0xca0c('0x36')](_0x3aeeb9,function(_0x3fe642){return _0x3fe642[_0xca0c('0x5f')];})},'attributes':['id',_0xca0c('0x5f')],'raw':!![]})[_0xca0c('0x2c')](function(_0x300a90){var _0x4e17e2=_[_0xca0c('0x36')](_0x2212d2[_0xca0c('0x4c')],function(_0x32382a){_0x32382a['userProfileId']=_0x2212d2['params']['id'];return _0x32382a;});return db[_0xca0c('0x5c')][_0xca0c('0x6c')](_0x4e17e2,{'raw':!![],'transaction':_0x5cfb6d});});}})[_0xca0c('0x48')](handleError(_0xd21060,null));});}})[_0xca0c('0x2c')](function(_0x2dd0d1){var _0x5cb43e=_[_0xca0c('0x36')](_0x2dd0d1,function(_0x3e562f){return _0x3e562f[_0xca0c('0x51')]({'plain':!![]});});})[_0xca0c('0x2c')](respondWithResult(_0xd21060,null))[_0xca0c('0x48')](handleError(_0xd21060,null));};exports[_0xca0c('0x6d')]=function(_0x428c6a,_0x589bbe,_0x477c69){return db['UserProfile'][_0xca0c('0x50')]({'where':{'id':_0x428c6a['params']['id']}})[_0xca0c('0x2c')](handleEntityNotFound(_0x589bbe,null))['then'](function(_0xb9240c){if(_0xb9240c){return _0xb9240c['removeResources'](_0x428c6a[_0xca0c('0x37')]['ids']);}})[_0xca0c('0x2c')](respondWithStatusCode(_0x589bbe,null))[_0xca0c('0x48')](handleError(_0x589bbe,null));};exports[_0xca0c('0x6e')]=function(_0x5a5c88,_0x15ba79){var _0x331af1={};if(!_0x5a5c88['query'][_0xca0c('0x6f')])throw new Error(_0xca0c('0x70'));if(!_0x5a5c88['query']['hasOwnProperty'](_0xca0c('0x3c'))){_0x331af1['limit']=qs['limit'](_0x5a5c88[_0xca0c('0x37')][_0xca0c('0x26')]);_0x331af1['offset']=qs[_0xca0c('0x24')](_0x5a5c88[_0xca0c('0x37')][_0xca0c('0x24')]);}return db[_0xca0c('0x33')][_0xca0c('0x50')]({'where':{'id':_0x5a5c88[_0xca0c('0x4a')]['id']}})['then'](function(_0x57fc8e){if(!_0x57fc8e)throw new Error(_0xca0c('0x71')+_0x5a5c88[_0xca0c('0x4a')]['id']);return db['UserProfile'][_0xca0c('0x6e')](_0x5a5c88);})[_0xca0c('0x2c')](respondWithFilteredResult(_0x15ba79,_0x331af1))['catch'](handleError(_0x15ba79,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5fc8baf..79c6c6d 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 _0xa064=['hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','emit'];(function(_0x4fce53,_0x142ecc){var _0x3220ba=function(_0x5b2dd2){while(--_0x5b2dd2){_0x4fce53['push'](_0x4fce53['shift']());}};_0x3220ba(++_0x142ecc);}(_0xa064,0x192));var _0x4a06=function(_0x6e9a01,_0x41ab36){_0x6e9a01=_0x6e9a01-0x0;var _0x238469=_0xa064[_0x6e9a01];return _0x238469;};'use strict';var EventEmitter=require(_0x4a06('0x0'));var UserProfile=require(_0x4a06('0x1'))['db'][_0x4a06('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4a06('0x3')](0x0);var events={'afterCreate':_0x4a06('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e300a){return function(_0x4add79,_0x390fdc,_0x475a0d){UserProfileEvents['emit'](_0x2e300a+':'+_0x4add79['id'],_0x4add79);UserProfileEvents[_0x4a06('0x5')](_0x2e300a,_0x4add79);_0x475a0d(null);};}for(var e in events){if(events[_0x4a06('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4a06('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x49fe=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x502ded,_0x4a1b01){var _0x520085=function(_0x4b89d1){while(--_0x4b89d1){_0x502ded['push'](_0x502ded['shift']());}};_0x520085(++_0x4a1b01);}(_0x49fe,0x75));var _0xe49f=function(_0x2d7b00,_0x2ad27a){_0x2d7b00=_0x2d7b00-0x0;var _0x20bd96=_0x49fe[_0x2d7b00];return _0x20bd96;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe49f('0x1'),'afterUpdate':_0xe49f('0x2'),'afterDestroy':_0xe49f('0x3')};function emitEvent(_0xb99c7){return function(_0x1cac40,_0x2db0ec,_0x1235f4){UserProfileEvents[_0xe49f('0x4')](_0xb99c7+':'+_0x1cac40['id'],_0x1cac40);UserProfileEvents[_0xe49f('0x4')](_0xb99c7,_0x1cac40);_0x1235f4(null);};}for(var e in events){if(events[_0xe49f('0x5')](e)){var event=events[e];UserProfile[_0xe49f('0x6')](e,emitEvent(event));}}module[_0xe49f('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 524e512..c626e95 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 _0x397e=['ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','admin','user','Telephones','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','scheduler','sounds','Tag','templates','Template','triggers','trunks','Trunk','variables','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','ui.','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','push','model','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','CmContact','parentSections','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x397e,0x151));var _0xe397=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0x397e[_0x119d13];return _0x333c35;};'use strict';var _=require(_0xe397('0x0'));var attributes=require(_0xe397('0x1'));var qs=require(_0xe397('0x2'));var squel=require('squel');module['exports']=function(_0x500450){var _0x905eba=_0x500450[_0xe397('0x3')];function _0x49e059(_0x4c627d,_0x8b6ffc){return new Promise(function(_0xc42d01,_0x37e23c){if(!_0x8b6ffc)return _0xc42d01(null);var _0x94cc3e=_0x8b6ffc['filter']?{[_0x8b6ffc[_0xe397('0x4')][_0xe397('0x5')]]:_0x8b6ffc[_0xe397('0x4')][_0xe397('0x6')]}:undefined;return _0x905eba[_0x4c627d][_0xe397('0x7')]({'where':_0x94cc3e,'raw':!![]})[_0xe397('0x8')](function(_0x210cf5){_0x8b6ffc[_0xe397('0x9')]=_[_0xe397('0xa')](_0x210cf5,'id');_0xc42d01(_0x8b6ffc);})[_0xe397('0xb')](function(_0x3de0ac){_0x37e23c(_0x3de0ac);});});}function _0x2b33bb(_0x54ddaf,_0x4cb860){return new Promise(function(_0x167566,_0x2e3b07){var _0x4b088d=_0x54ddaf[_0xe397('0x4')]?{[_0x54ddaf['filter']['field']]:_0x54ddaf['filter'][_0xe397('0x6')]}:undefined;return _0x905eba[_0x54ddaf['model']][_0xe397('0x7')]({'where':_0x4b088d,'raw':!![]})[_0xe397('0x8')](function(_0x2b3b15){_0x4cb860[_0xe397('0x9')]=_[_0xe397('0xa')](_0x2b3b15,function(_0x3f0cad){return _0x3f0cad[_0xe397('0xc')];});_0x167566(_0x4cb860);})['catch'](function(_0x36a6b5){_0x2e3b07(_0x36a6b5);});});}function _0x3b5991(_0xa10f1d,_0x51f6d7,_0x40495c){if(!_0x51f6d7)return Promise[_0xe397('0xd')](null);return new Promise(function(_0x46fa42,_0x237ef7){return _0x905eba[_0xe397('0xe')][_0xe397('0x7')]({'where':{'sectionId':_0x51f6d7['id']},'raw':!![]})[_0xe397('0x8')](function(_0x4b7348){if(_0xa10f1d[_0xe397('0x5')]&&_0xa10f1d[_0xe397('0x5')]!=='id'){_0x51f6d7[_0xe397('0x9')]=_[_0xe397('0xa')](_0x4b7348,function(_0x418240){return _0x418240[_0xa10f1d['field']];});}else{if(_0x40495c===_0xe397('0xf')){_0x51f6d7['associatedResources']=_[_0xe397('0xa')](_0x4b7348,function(_0x5442e7){return{'id':_0x5442e7[_0xe397('0x10')],'type':_0x5442e7[_0xe397('0x11')]};});}else{_0x51f6d7['associatedResources']=_[_0xe397('0xa')](_0x4b7348,function(_0x1357f0){return _0x1357f0[_0xe397('0x10')];});}}_0x46fa42(_0x51f6d7);})['catch'](function(_0x1f9b5f){_0x237ef7(_0x1f9b5f);});});}function _0x3a5418(_0x2f1c8e,_0x3a03fa){var _0x36cd2b={'parentSections':[]};switch(_0x2f1c8e[_0xe397('0x12')]()){case _0xe397('0x13'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x15');break;case'odbc':_0x36cd2b[_0xe397('0x14')]='SquareOdbc';break;case'squarerecordings':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x16');_0x36cd2b['parentSections']=[{'name':_0xe397('0x17'),'field':_0xe397('0xc'),'foreignKey':_0xe397('0x18')}];break;case'projects':_0x36cd2b['childModel']=_0xe397('0x19');break;case _0xe397('0x1a'):_0x36cd2b['childModel']=_0xe397('0x1b');_0x36cd2b[_0xe397('0x1c')]=[{'name':'Lists','field':'id','foreignKey':_0xe397('0x1d')}];break;case'lists':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x1e');break;case'companies':_0x36cd2b['childModel']=_0xe397('0x1f');break;case _0xe397('0x20'):_0x36cd2b['childModel']=_0xe397('0x21');break;case _0xe397('0x22'):_0x36cd2b['childModel']=_0xe397('0x23');break;case _0xe397('0x24'):_0x36cd2b['childModel']=_0xe397('0x25');break;case _0xe397('0x26'):_0x36cd2b['childModel']=_0xe397('0x27');break;case _0xe397('0x28'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x29');break;case'inboundroutes':case _0xe397('0x2a'):case'outboundroutes':_0x36cd2b['childModel']='VoiceExtension';break;case _0xe397('0x2b'):_0x36cd2b['childModel']=_0xe397('0x2c');break;case _0xe397('0x2d'):_0x36cd2b['childModel']=_0xe397('0x2e');break;case _0xe397('0x2f'):_0x36cd2b['childModel']=_0xe397('0x30');_0x36cd2b[_0xe397('0x1c')]=[{'name':_0xe397('0x31'),'field':_0xe397('0xc'),'foreignKey':'membername','model':_0xe397('0x32'),'filter':{'field':_0xe397('0x33'),'value':[_0xe397('0x34')]}},{'name':'Telephones','field':_0xe397('0xc'),'foreignKey':'membername','model':_0xe397('0x32'),'filter':{'field':'role','value':[_0xe397('0x35')]}},{'name':_0xe397('0x36'),'field':_0xe397('0xc'),'foreignKey':_0xe397('0x37'),'model':_0xe397('0x38'),'filter':{'field':_0xe397('0x11'),'value':[_0xe397('0x39')]}},{'name':_0xe397('0x3a'),'field':_0xe397('0xc'),'foreignKey':'queue','model':_0xe397('0x38'),'filter':{'field':_0xe397('0x11'),'value':[_0xe397('0x3b')]}}];break;case _0xe397('0x3c'):_0x36cd2b['childModel']=_0xe397('0x3d');break;case'chanspies':_0x36cd2b[_0xe397('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x3e');break;case _0xe397('0x3f'):_0x36cd2b['childModel']=_0xe397('0x40');break;case _0xe397('0x41'):_0x36cd2b[_0xe397('0x14')]='MailQueue';break;case _0xe397('0x42'):_0x36cd2b['childModel']=_0xe397('0x43');break;case'mailsubstatuses':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x44');break;case'openchannelqueues':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x45');break;case _0xe397('0x46'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x47');break;case'smsqueues':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x48');break;case _0xe397('0x49'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x4a');break;case _0xe397('0x4b'):_0x36cd2b['childModel']=_0xe397('0x4c');break;case'whatsappaccounts':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x4d');break;case _0xe397('0x4e'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x4f');break;case _0xe397('0x50'):case _0xe397('0x51'):_0x36cd2b['childModel']=_0xe397('0x38');if(_0x3a03fa){_0x36cd2b['parentSections']=[{'name':_0xe397('0x36')},{'name':_0xe397('0x3a')}];}break;case _0xe397('0x52'):case'agents':case _0xe397('0x53'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x32');if(_0x3a03fa){_0x36cd2b[_0xe397('0x1c')]=[{'name':'Users','filter':{'field':_0xe397('0x33'),'value':[_0xe397('0x54'),_0xe397('0x55')]},'ignore':!![]},{'name':_0xe397('0x31')},{'name':_0xe397('0x56')}];}break;case'zendeskaccounts':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x57');break;case _0xe397('0x58'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x59');break;case'freshdeskaccounts':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x5a');break;case _0xe397('0x5b'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x5c');break;case'deskaccounts':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x5d');break;case _0xe397('0x5e'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x5f');break;case'vtigeraccounts':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x32');break;case _0xe397('0x60'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x61');break;case'dispositions':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x62');break;case _0xe397('0x63'):_0x36cd2b[_0xe397('0x14')]='Dashboard';break;case _0xe397('0x64'):_0x36cd2b['childModel']=_0xe397('0x65');break;case _0xe397('0x66'):_0x36cd2b[_0xe397('0x14')]='Pause';break;case _0xe397('0x67'):_0x36cd2b['childModel']='Schedule';break;case _0xe397('0x68'):_0x36cd2b[_0xe397('0x14')]='Sound';break;case'tags':_0x36cd2b[_0xe397('0x14')]=_0xe397('0x69');break;case _0xe397('0x6a'):_0x36cd2b['childModel']=_0xe397('0x6b');break;case _0xe397('0x6c'):_0x36cd2b['childModel']='Trigger';break;case _0xe397('0x6d'):_0x36cd2b[_0xe397('0x14')]=_0xe397('0x6e');break;case _0xe397('0x6f'):_0x36cd2b[_0xe397('0x14')]='Variable';break;case _0xe397('0x70'):_0x36cd2b[_0xe397('0x14')]='Plugin';break;case _0xe397('0x71'):_0x36cd2b[_0xe397('0x14')]='AnalyticExtractedReport';_0x36cd2b[_0xe397('0x1c')]=[{'name':_0xe397('0x72'),'field':'id','foreignKey':_0xe397('0x73')}];break;case _0xe397('0x74'):_0x36cd2b['childModel']=_0xe397('0x75');break;}return _0x36cd2b;}function _0x542da9(_0xa4ea14,_0xf24397){var _0x35e616=_0xa4ea14[_0xe397('0x76')](0x0)['toUpperCase']()+_0xa4ea14[_0xe397('0x77')](0x1);var _0x46802b={'type':_0x905eba['Sequelize'][_0xe397('0x78')][_0xe397('0x79')],'raw':!![]};return new Promise(function(_0x199f96,_0x247bc8){var _0x4668b6=squel['select']()['field'](_0xe397('0x7a')+_0x35e616+'InteractionId','id')[_0xe397('0x5')](_0xe397('0x7b'))[_0xe397('0x7c')]('user_has_'+_0xa4ea14+_0xe397('0x7d'),'ui')[_0xe397('0x7e')](_0xe397('0x7f'),_0xf24397['id']);return _0x905eba[_0xe397('0x80')][_0xe397('0x81')](_0x4668b6[_0xe397('0x82')](),_0x46802b)[_0xe397('0x8')](function(_0x1338c0){_0xf24397[_0x35e616+'OpenTabs']=_0x1338c0;_0x199f96(_0x1338c0);})['catch'](function(_0x43678d){_0x247bc8(_0x43678d);});});}return _0x500450[_0xe397('0x83')](_0xe397('0x84'),attributes,{'tableName':_0xe397('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x599dde){var _0x19d86e={'raw':_0x599dde[_0xe397('0x81')]['raw'],'where':{}};var _0x189c83={};var _0x34114b={'count':0x0,'rows':[]};var _0x1d5064=_0x599dde[_0xe397('0x81')][_0xe397('0x86')];var _0x523078=_0x599dde[_0xe397('0x81')][_0xe397('0x87')]||![];var _0x177a76=_0x3a5418(_0x1d5064,_0x523078);if(!_0x177a76[_0xe397('0x14')])throw new Error(_0xe397('0x88')+_0x1d5064+'\x27');var _0x386c1e=[{'name':_0x1d5064}];if(!_[_0xe397('0x89')](_0x177a76[_0xe397('0x1c')]))_0x386c1e=_0x177a76[_0xe397('0x1c')];var _0x454517=[];for(var _0x43fa26=0x0;_0x43fa26<_0x386c1e[_0xe397('0x8a')];_0x43fa26++){_0x454517['push'](_0x905eba[_0xe397('0x8b')][_0xe397('0x8c')]({'where':{'userProfileId':_0x599dde[_0xe397('0x8d')]['id'],'name':_0x386c1e[_0x43fa26][_0xe397('0xc')]},'raw':!![]}));}return Promise[_0xe397('0x8e')](_0x454517)[_0xe397('0x8')](function(_0xdf0cd1){var _0x491adc=_[_0xe397('0x4')](_0xdf0cd1,function(_0x348199){return _0x348199?_0x348199:undefined;});var _0x2d8991=_[_0xe397('0x4')](_0x386c1e,['ignore',!![]]);var _0x1c280f=_[_0xe397('0x89')](_0x491adc)&&_[_0xe397('0x89')](_0x2d8991)?null:_['union'](_0x2d8991,_0x491adc);if(!_0x1c280f)return null;var _0x32f7fe=[];for(var _0x48a657=0x0;_0x48a657<_0x1c280f[_0xe397('0x8a')];_0x48a657++){var _0x434f6e=_['find'](_0x386c1e,function(_0x5dedf1){return _0x1c280f[_0x48a657]?_0x5dedf1['name']===_0x1c280f[_0x48a657][_0xe397('0xc')]:null;});if(_0x434f6e){if(_0x1c280f[_0x48a657][_0xe397('0x8f')]){_0x32f7fe[_0xe397('0x90')](_0x49e059(_0x177a76['childModel'],_0x1c280f[_0x48a657]));}else{if(!_0x1c280f[_0x48a657]['autoAssociation']){_0x32f7fe['push'](_0x3b5991(_0x434f6e,_0x1c280f[_0x48a657],_0x177a76[_0xe397('0x14')]));}else{if(_0x434f6e[_0xe397('0x91')]){_0x32f7fe[_0xe397('0x90')](_0x2b33bb(_0x434f6e,_0x1c280f[_0x48a657]));}}}}}return Promise['all'](_0x32f7fe);})['then'](function(_0x2e1eb1){var _0x1e5094=_0x2e1eb1;var _0x437942=null;if(_0x1e5094){_0x437942=_0x1e5094['length']===0x1?_0x1e5094[0x0]:null;}if(!_0x437942&&!_0x1e5094)return _0x34114b;var _0x5c9a52=_0x905eba[_0x177a76['childModel']][_0xe397('0x92')];_0x189c83[_0xe397('0x91')]=_[_0xe397('0x93')](_0x5c9a52);_0x189c83[_0xe397('0x81')]=_[_0xe397('0x93')](_0x599dde[_0xe397('0x81')]);_0x189c83[_0xe397('0x94')]=_['intersection'](_0x189c83['model'],_0x189c83[_0xe397('0x81')]);_0x19d86e[_0xe397('0x95')]=_[_0xe397('0x96')](_0x189c83[_0xe397('0x91')],qs[_0xe397('0x97')](_0x599dde[_0xe397('0x81')]['fields']));_0x19d86e['attributes']=_0x19d86e[_0xe397('0x95')]['length']?_0x19d86e['attributes']:_0x189c83['model'];if(!_0x599dde[_0xe397('0x81')][_0xe397('0x98')](_0xe397('0x99'))){_0x19d86e[_0xe397('0x9a')]=qs[_0xe397('0x9a')](_0x599dde[_0xe397('0x81')][_0xe397('0x9a')]);_0x19d86e['offset']=qs['offset'](_0x599dde[_0xe397('0x81')][_0xe397('0x9b')]);}_0x19d86e[_0xe397('0x9c')]=qs[_0xe397('0x9d')](_0x599dde[_0xe397('0x81')]['sort']);_0x19d86e['where']=qs[_0xe397('0x94')](_[_0xe397('0x9e')](_0x599dde[_0xe397('0x81')],_0x189c83[_0xe397('0x94')]));if(_0x599dde[_0xe397('0x81')][_0xe397('0x4')]){_0x19d86e[_0xe397('0x7e')]=_[_0xe397('0x9f')](_0x19d86e[_0xe397('0x7e')],{'$or':_[_0xe397('0xa')](_0x5c9a52,function(_0x4f9cb5){if(_0x4f9cb5[_0xe397('0x11')][_0xe397('0xa0')]!==_0xe397('0xa1')){var _0x5f583d={};_0x5f583d[_0x4f9cb5[_0xe397('0x5')]]={'$like':'%'+_0x599dde['query'][_0xe397('0x4')]+'%'};return _0x5f583d;}})});}var _0x1c0c39=[];var _0x896fb3=null;var _0xda9ee7={};if(_0x437942){_0x896fb3=_[_0xe397('0x8c')](_0x386c1e,['name',_0x437942[_0xe397('0xc')]]);if(_0x896fb3[_0xe397('0x5')]){_0xda9ee7={};if(_0x177a76['childModel']===_0xe397('0xf')){_0xda9ee7[_0x896fb3[_0xe397('0xa2')]]=_['map'](_0x437942[_0xe397('0x9')],'id');}else{_0xda9ee7[_0x896fb3[_0xe397('0xa2')]]=_0x437942[_0xe397('0x9')];}_0x1c0c39[_0xe397('0x90')](_0xda9ee7);}else{_0x19d86e[_0xe397('0x7e')]['id']=_0x437942[_0xe397('0x9')];}}else{for(var _0x43d2ec=0x0;_0x43d2ec<_0x1e5094['length'];_0x43d2ec++){_0x896fb3=_[_0xe397('0x8c')](_0x386c1e,[_0xe397('0xc'),_0x1e5094[_0x43d2ec][_0xe397('0xc')]]);if(_0x896fb3[_0xe397('0x5')]){_0xda9ee7={};_0xda9ee7[_0x896fb3[_0xe397('0xa2')]]=_0x1e5094[_0x43d2ec][_0xe397('0x9')];_0x1c0c39['push'](_0xda9ee7);}else{if(!_0x19d86e[_0xe397('0x7e')]['id'])_0x19d86e[_0xe397('0x7e')]['id']=[];_0x1e5094[_0x43d2ec][_0xe397('0x9')][_0xe397('0xa3')](function(_0x5a5728){_0x19d86e[_0xe397('0x7e')]['id']['push'](_0x5a5728);});}}}if(!_[_0xe397('0x89')](_0x1c0c39)){_0x19d86e[_0xe397('0x7e')]=_['merge'](_0x19d86e[_0xe397('0x7e')],{'$and':{'$or':_0x1c0c39}});}_0x19d86e=_[_0xe397('0x9f')]({},_0x19d86e,_0x599dde[_0xe397('0xa4')]);if(_0x437942&&!_0x437942[_0xe397('0xa5')]&&_0x177a76[_0xe397('0x14')]===_0xe397('0xf')){if(_0x599dde[_0xe397('0x81')][_0xe397('0xa6')]){_0x19d86e[_0xe397('0xa7')]=[{'all':!![]}];}return _0x905eba[_0x177a76[_0xe397('0x14')]][_0xe397('0x7')](_0x19d86e)[_0xe397('0x8')](function(_0xa2d2d7){var _0x40db84=[];_0xa2d2d7[_0xe397('0xa3')](function(_0x14e6dd){var _0x9d6695;switch(_0x14e6dd['reportType']){case'default':_0x9d6695=_[_0xe397('0x8c')](_0x437942['associatedResources'],function(_0x182c0a){return _0x182c0a['id']===_0x14e6dd[_0xe397('0x73')]&&_0x182c0a[_0xe397('0x11')]===_0xe397('0xa8');});break;case _0xe397('0xa9'):_0x9d6695=_['find'](_0x437942['associatedResources'],function(_0x22b886){return _0x22b886['id']===_0x14e6dd['reportId']&&_0x22b886[_0xe397('0x11')]==='CustomReports';});break;}if(_0x9d6695)_0x40db84['push'](_0x14e6dd);});_0x34114b[_0xe397('0xaa')]=_0x40db84[_0xe397('0x8a')];_0x34114b[_0xe397('0xab')]=_0x40db84;return _0x34114b;});}else{if(!_[_0xe397('0x89')](_0x599dde['query'][_0xe397('0xac')])){_0x19d86e['where']['id']=_0x19d86e[_0xe397('0x7e')]['id']?_[_0xe397('0x96')](_0x19d86e['where']['id'],_0x599dde['query']['ids']):_0x599dde[_0xe397('0x81')][_0xe397('0xac')];if(_0x599dde[_0xe397('0x81')][_0xe397('0xad')]){_0x19d86e['order']=_0x599dde[_0xe397('0x81')][_0xe397('0xad')];}}if(_0x599dde['query'][_0xe397('0xae')]){_0x19d86e[_0xe397('0x7e')]=_[_0xe397('0x9f')](_0x19d86e['where'],{'$and':_0x599dde[_0xe397('0x81')][_0xe397('0xae')]});}return _0x905eba[_0x177a76[_0xe397('0x14')]][_0xe397('0xaa')]({'where':_0x19d86e[_0xe397('0x7e')]})[_0xe397('0x8')](function(_0xc9b908){_0x34114b[_0xe397('0xaa')]=_0xc9b908;if(_0x599dde[_0xe397('0x81')][_0xe397('0xa6')]){if(_0x177a76['childModel']===_0xe397('0x1b')){_0x19d86e[_0xe397('0xa7')]=[{'model':_0x905eba[_0xe397('0x69')],'as':_0xe397('0xaf'),'attributes':['id',_0xe397('0xc'),_0xe397('0xb0')],'required':_0x599dde[_0xe397('0x81')][_0xe397('0xb1')]?!![]:![]},{'model':_0x905eba[_0xe397('0x69')],'as':_0xe397('0xb2'),'attributes':['id',_0xe397('0xc'),_0xe397('0xb0')],'through':_0x599dde[_0xe397('0x81')][_0xe397('0xb1')]?{'attributes':[],'where':{'TagId':_0x599dde['query']['tag']||undefined}}:{},'required':_0x599dde[_0xe397('0x81')][_0xe397('0xb1')]?!![]:![]}];}else{_0x19d86e[_0xe397('0xa7')]=[{'all':!![]}];}}return _0x905eba[_0x177a76[_0xe397('0x14')]]['findAll'](_0x19d86e);})[_0xe397('0x8')](function(_0x323352){_0x34114b['rows']=_0x323352;if(_0x1d5064===_0xe397('0x31')&&_0x599dde[_0xe397('0x81')][_0xe397('0xb3')]===_0xe397('0xb4')){var _0x5a17b6=[];for(var _0x1ae212=0x0;_0x1ae212<_0x34114b[_0xe397('0xab')][_0xe397('0x8a')];_0x1ae212++){_0x5a17b6[_0xe397('0x90')](_0x542da9('chat',_0x34114b[_0xe397('0xab')][_0x1ae212][_0xe397('0xb5')]));_0x5a17b6[_0xe397('0x90')](_0x542da9(_0xe397('0xb6'),_0x34114b['rows'][_0x1ae212][_0xe397('0xb5')]));_0x5a17b6[_0xe397('0x90')](_0x542da9(_0xe397('0xb7'),_0x34114b[_0xe397('0xab')][_0x1ae212][_0xe397('0xb5')]));_0x5a17b6[_0xe397('0x90')](_0x542da9(_0xe397('0xb8'),_0x34114b['rows'][_0x1ae212][_0xe397('0xb5')]));_0x5a17b6[_0xe397('0x90')](_0x542da9(_0xe397('0xb9'),_0x34114b[_0xe397('0xab')][_0x1ae212][_0xe397('0xb5')]));_0x5a17b6[_0xe397('0x90')](_0x542da9(_0xe397('0xba'),_0x34114b['rows'][_0x1ae212][_0xe397('0xb5')]));}return Promise[_0xe397('0x8e')](_0x5a17b6)[_0xe397('0x8')](function(){return _0x34114b;});}return _0x34114b;});}});}}});}; \ No newline at end of file +var _0xeadf=['agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','cannedanswers','CannedAnswer','Disposition','intervals','Interval','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','slice','QueryTypes','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','user_profiles','query','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','isEmpty','find','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','CustomReports','count','rows','ids','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','fax','mail','openchannel','whatsapp','all','lodash','../../components/parsers/qs','squel','models','filter','value','then','map','catch','field','model','findAll','associatedResources','name','resolve','UserProfileResource','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0xeadf,0x13b));var _0xfead=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xeadf[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0xfead('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xfead('0x1'));var squel=require(_0xfead('0x2'));module['exports']=function(_0x193648){var _0x447469=_0x193648[_0xfead('0x3')];function _0x13c71c(_0x3a0322,_0x3dd362){return new Promise(function(_0xeac593,_0xfe1f03){if(!_0x3dd362)return _0xeac593(null);var _0x4d8344=_0x3dd362[_0xfead('0x4')]?{[_0x3dd362[_0xfead('0x4')]['field']]:_0x3dd362['filter'][_0xfead('0x5')]}:undefined;return _0x447469[_0x3a0322]['findAll']({'where':_0x4d8344,'raw':!![]})[_0xfead('0x6')](function(_0x2f8fe7){_0x3dd362['associatedResources']=_[_0xfead('0x7')](_0x2f8fe7,'id');_0xeac593(_0x3dd362);})[_0xfead('0x8')](function(_0x1ca3ce){_0xfe1f03(_0x1ca3ce);});});}function _0x12907f(_0xc28088,_0x5eb6db){return new Promise(function(_0x4ad4a5,_0xa4eb69){var _0x22bc20=_0xc28088[_0xfead('0x4')]?{[_0xc28088[_0xfead('0x4')][_0xfead('0x9')]]:_0xc28088['filter']['value']}:undefined;return _0x447469[_0xc28088[_0xfead('0xa')]][_0xfead('0xb')]({'where':_0x22bc20,'raw':!![]})[_0xfead('0x6')](function(_0x17c289){_0x5eb6db[_0xfead('0xc')]=_[_0xfead('0x7')](_0x17c289,function(_0x328996){return _0x328996[_0xfead('0xd')];});_0x4ad4a5(_0x5eb6db);})[_0xfead('0x8')](function(_0x55c87c){_0xa4eb69(_0x55c87c);});});}function _0x382d41(_0x420a73,_0x3f1b5d,_0x9c6ca0){if(!_0x3f1b5d)return Promise[_0xfead('0xe')](null);return new Promise(function(_0x37f7a5,_0x24bbce){return _0x447469[_0xfead('0xf')][_0xfead('0xb')]({'where':{'sectionId':_0x3f1b5d['id']},'raw':!![]})[_0xfead('0x6')](function(_0x568ec6){if(_0x420a73[_0xfead('0x9')]&&_0x420a73[_0xfead('0x9')]!=='id'){_0x3f1b5d[_0xfead('0xc')]=_[_0xfead('0x7')](_0x568ec6,function(_0x268ce5){return _0x268ce5[_0x420a73[_0xfead('0x9')]];});}else{if(_0x9c6ca0==='AnalyticExtractedReport'){_0x3f1b5d[_0xfead('0xc')]=_['map'](_0x568ec6,function(_0x4c8c8a){return{'id':_0x4c8c8a['resourceId'],'type':_0x4c8c8a['type']};});}else{_0x3f1b5d[_0xfead('0xc')]=_[_0xfead('0x7')](_0x568ec6,function(_0x2ea269){return _0x2ea269['resourceId'];});}}_0x37f7a5(_0x3f1b5d);})[_0xfead('0x8')](function(_0x782d4f){_0x24bbce(_0x782d4f);});});}function _0x19b528(_0x233691,_0x29770f){var _0x415398={'parentSections':[]};switch(_0x233691[_0xfead('0x10')]()){case _0xfead('0x11'):_0x415398[_0xfead('0x12')]=_0xfead('0x13');break;case _0xfead('0x14'):_0x415398[_0xfead('0x12')]='SquareOdbc';break;case'squarerecordings':_0x415398['childModel']=_0xfead('0x15');_0x415398[_0xfead('0x16')]=[{'name':_0xfead('0x17'),'field':_0xfead('0xd'),'foreignKey':_0xfead('0x18')}];break;case _0xfead('0x19'):_0x415398['childModel']=_0xfead('0x1a');break;case _0xfead('0x1b'):_0x415398[_0xfead('0x12')]=_0xfead('0x1c');_0x415398[_0xfead('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x415398[_0xfead('0x12')]=_0xfead('0x1d');break;case _0xfead('0x1e'):_0x415398[_0xfead('0x12')]='CmCompany';break;case _0xfead('0x1f'):_0x415398[_0xfead('0x12')]=_0xfead('0x20');break;case _0xfead('0x21'):_0x415398[_0xfead('0x12')]=_0xfead('0x22');break;case _0xfead('0x23'):_0x415398['childModel']='ChatWebsite';break;case _0xfead('0x24'):_0x415398[_0xfead('0x12')]='FaxQueue';break;case _0xfead('0x25'):_0x415398['childModel']='FaxAccount';break;case _0xfead('0x26'):case _0xfead('0x27'):case _0xfead('0x28'):_0x415398[_0xfead('0x12')]=_0xfead('0x29');break;case _0xfead('0x2a'):_0x415398['childModel']=_0xfead('0x2b');break;case _0xfead('0x2c'):_0x415398['childModel']=_0xfead('0x2d');break;case _0xfead('0x2e'):_0x415398[_0xfead('0x12')]=_0xfead('0x2f');_0x415398[_0xfead('0x16')]=[{'name':_0xfead('0x30'),'field':'name','foreignKey':'membername','model':_0xfead('0x31'),'filter':{'field':_0xfead('0x32'),'value':[_0xfead('0x33')]}},{'name':_0xfead('0x34'),'field':_0xfead('0xd'),'foreignKey':_0xfead('0x35'),'model':_0xfead('0x31'),'filter':{'field':_0xfead('0x32'),'value':[_0xfead('0x36')]}},{'name':_0xfead('0x37'),'field':_0xfead('0xd'),'foreignKey':_0xfead('0x38'),'model':_0xfead('0x39'),'filter':{'field':_0xfead('0x3a'),'value':[_0xfead('0x3b')]}},{'name':_0xfead('0x3c'),'field':_0xfead('0xd'),'foreignKey':'queue','model':_0xfead('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case _0xfead('0x3d'):_0x415398[_0xfead('0x12')]='VoiceMusicOnHold';break;case _0xfead('0x3e'):_0x415398[_0xfead('0x12')]=_0xfead('0x3f');break;case _0xfead('0x40'):_0x415398[_0xfead('0x12')]='VoicePrefix';break;case _0xfead('0x41'):_0x415398[_0xfead('0x12')]=_0xfead('0x42');break;case _0xfead('0x43'):_0x415398[_0xfead('0x12')]=_0xfead('0x44');break;case _0xfead('0x45'):_0x415398[_0xfead('0x12')]=_0xfead('0x46');break;case _0xfead('0x47'):_0x415398[_0xfead('0x12')]=_0xfead('0x48');break;case _0xfead('0x49'):_0x415398['childModel']=_0xfead('0x4a');break;case _0xfead('0x4b'):_0x415398[_0xfead('0x12')]='OpenchannelAccount';break;case _0xfead('0x4c'):_0x415398[_0xfead('0x12')]=_0xfead('0x4d');break;case'smsaccounts':_0x415398[_0xfead('0x12')]=_0xfead('0x4e');break;case _0xfead('0x4f'):_0x415398[_0xfead('0x12')]='WhatsappQueue';break;case'whatsappaccounts':_0x415398[_0xfead('0x12')]=_0xfead('0x50');break;case _0xfead('0x51'):_0x415398['childModel']=_0xfead('0x52');break;case _0xfead('0x53'):case _0xfead('0x54'):_0x415398[_0xfead('0x12')]=_0xfead('0x39');if(_0x29770f){_0x415398[_0xfead('0x16')]=[{'name':'VoiceQueues'},{'name':_0xfead('0x3c')}];}break;case _0xfead('0x55'):case _0xfead('0x56'):case _0xfead('0x57'):_0x415398[_0xfead('0x12')]=_0xfead('0x31');if(_0x29770f){_0x415398['parentSections']=[{'name':'Users','filter':{'field':_0xfead('0x32'),'value':['admin',_0xfead('0x58')]},'ignore':!![]},{'name':_0xfead('0x30')},{'name':_0xfead('0x34')}];}break;case _0xfead('0x59'):_0x415398[_0xfead('0x12')]='ZendeskAccount';break;case _0xfead('0x5a'):_0x415398['childModel']=_0xfead('0x5b');break;case _0xfead('0x5c'):_0x415398[_0xfead('0x12')]='FreshdeskAccount';break;case _0xfead('0x5d'):_0x415398['childModel']=_0xfead('0x5e');break;case'deskaccounts':_0x415398[_0xfead('0x12')]='DeskAccount';break;case _0xfead('0x5f'):_0x415398[_0xfead('0x12')]='ZohoAccount';break;case'vtigeraccounts':_0x415398[_0xfead('0x12')]=_0xfead('0x31');break;case _0xfead('0x60'):_0x415398[_0xfead('0x12')]=_0xfead('0x61');break;case'dispositions':_0x415398[_0xfead('0x12')]=_0xfead('0x62');break;case'customdashboards':_0x415398[_0xfead('0x12')]='Dashboard';break;case _0xfead('0x63'):_0x415398[_0xfead('0x12')]=_0xfead('0x64');break;case'pauses':_0x415398[_0xfead('0x12')]='Pause';break;case _0xfead('0x65'):_0x415398[_0xfead('0x12')]=_0xfead('0x66');break;case'sounds':_0x415398[_0xfead('0x12')]=_0xfead('0x67');break;case _0xfead('0x68'):_0x415398[_0xfead('0x12')]=_0xfead('0x69');break;case _0xfead('0x6a'):_0x415398['childModel']=_0xfead('0x6b');break;case _0xfead('0x6c'):_0x415398[_0xfead('0x12')]=_0xfead('0x6d');break;case _0xfead('0x6e'):_0x415398[_0xfead('0x12')]=_0xfead('0x6f');break;case'variables':_0x415398[_0xfead('0x12')]=_0xfead('0x70');break;case _0xfead('0x71'):_0x415398[_0xfead('0x12')]=_0xfead('0x72');break;case _0xfead('0x73'):_0x415398[_0xfead('0x12')]=_0xfead('0x74');_0x415398['parentSections']=[{'name':_0xfead('0x75'),'field':'id','foreignKey':_0xfead('0x76')}];break;case _0xfead('0x77'):_0x415398[_0xfead('0x12')]=_0xfead('0x78');break;}return _0x415398;}function _0x2edf9d(_0x3a1946,_0x5b6d83){var _0x5c435f=_0x3a1946['charAt'](0x0)['toUpperCase']()+_0x3a1946[_0xfead('0x79')](0x1);var _0x12c582={'type':_0x447469['Sequelize'][_0xfead('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x5d5b9a,_0xb6502e){var _0x492f52=squel['select']()['field']('ui.'+_0x5c435f+'InteractionId','id')[_0xfead('0x9')](_0xfead('0x7b'))[_0xfead('0x7c')](_0xfead('0x7d')+_0x3a1946+_0xfead('0x7e'),'ui')[_0xfead('0x7f')](_0xfead('0x80'),_0x5b6d83['id']);return _0x447469[_0xfead('0x81')]['query'](_0x492f52[_0xfead('0x82')](),_0x12c582)[_0xfead('0x6')](function(_0x18a624){_0x5b6d83[_0x5c435f+_0xfead('0x83')]=_0x18a624;_0x5d5b9a(_0x18a624);})[_0xfead('0x8')](function(_0x2a5b0c){_0xb6502e(_0x2a5b0c);});});}return _0x193648[_0xfead('0x84')]('UserProfile',attributes,{'tableName':_0xfead('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3f02be){var _0x16dc14={'raw':_0x3f02be[_0xfead('0x86')]['raw'],'where':{}};var _0x57ba41={};var _0x13fedd={'count':0x0,'rows':[]};var _0x68235a=_0x3f02be[_0xfead('0x86')]['section'];var _0x264b0a=_0x3f02be['query']['mergeResources']||![];var _0x197bc5=_0x19b528(_0x68235a,_0x264b0a);if(!_0x197bc5[_0xfead('0x12')])throw new Error(_0xfead('0x87')+_0x68235a+'\x27');var _0x1ee8a6=[{'name':_0x68235a}];if(!_['isEmpty'](_0x197bc5[_0xfead('0x16')]))_0x1ee8a6=_0x197bc5[_0xfead('0x16')];var _0x4077fa=[];for(var _0xf943e9=0x0;_0xf943e9<_0x1ee8a6[_0xfead('0x88')];_0xf943e9++){_0x4077fa[_0xfead('0x89')](_0x447469[_0xfead('0x8a')]['find']({'where':{'userProfileId':_0x3f02be[_0xfead('0x8b')]['id'],'name':_0x1ee8a6[_0xf943e9]['name']},'raw':!![]}));}return Promise['all'](_0x4077fa)[_0xfead('0x6')](function(_0xe8765e){var _0x4fcc60=_[_0xfead('0x4')](_0xe8765e,function(_0x1b29c9){return _0x1b29c9?_0x1b29c9:undefined;});var _0x2aeaf9=_[_0xfead('0x4')](_0x1ee8a6,['ignore',!![]]);var _0x193b28=_[_0xfead('0x8c')](_0x4fcc60)&&_[_0xfead('0x8c')](_0x2aeaf9)?null:_['union'](_0x2aeaf9,_0x4fcc60);if(!_0x193b28)return null;var _0x3722b8=[];for(var _0x21af21=0x0;_0x21af21<_0x193b28[_0xfead('0x88')];_0x21af21++){var _0x32dd29=_[_0xfead('0x8d')](_0x1ee8a6,function(_0x2916c6){return _0x193b28[_0x21af21]?_0x2916c6[_0xfead('0xd')]===_0x193b28[_0x21af21][_0xfead('0xd')]:null;});if(_0x32dd29){if(_0x193b28[_0x21af21][_0xfead('0x8e')]){_0x3722b8[_0xfead('0x89')](_0x13c71c(_0x197bc5[_0xfead('0x12')],_0x193b28[_0x21af21]));}else{if(!_0x193b28[_0x21af21][_0xfead('0x8f')]){_0x3722b8[_0xfead('0x89')](_0x382d41(_0x32dd29,_0x193b28[_0x21af21],_0x197bc5[_0xfead('0x12')]));}else{if(_0x32dd29[_0xfead('0xa')]){_0x3722b8[_0xfead('0x89')](_0x12907f(_0x32dd29,_0x193b28[_0x21af21]));}}}}}return Promise['all'](_0x3722b8);})[_0xfead('0x6')](function(_0x1f872e){var _0x425b1d=_0x1f872e;var _0x179465=null;if(_0x425b1d){_0x179465=_0x425b1d[_0xfead('0x88')]===0x1?_0x425b1d[0x0]:null;}if(!_0x179465&&!_0x425b1d)return _0x13fedd;var _0x29c1b8=_0x447469[_0x197bc5[_0xfead('0x12')]][_0xfead('0x90')];_0x57ba41[_0xfead('0xa')]=_[_0xfead('0x91')](_0x29c1b8);_0x57ba41[_0xfead('0x86')]=_['keys'](_0x3f02be[_0xfead('0x86')]);_0x57ba41[_0xfead('0x92')]=_[_0xfead('0x93')](_0x57ba41[_0xfead('0xa')],_0x57ba41[_0xfead('0x86')]);_0x16dc14[_0xfead('0x94')]=_[_0xfead('0x93')](_0x57ba41[_0xfead('0xa')],qs['fields'](_0x3f02be['query'][_0xfead('0x95')]));_0x16dc14['attributes']=_0x16dc14[_0xfead('0x94')]['length']?_0x16dc14[_0xfead('0x94')]:_0x57ba41[_0xfead('0xa')];if(!_0x3f02be[_0xfead('0x86')][_0xfead('0x96')](_0xfead('0x97'))){_0x16dc14[_0xfead('0x98')]=qs[_0xfead('0x98')](_0x3f02be['query'][_0xfead('0x98')]);_0x16dc14['offset']=qs[_0xfead('0x99')](_0x3f02be['query']['offset']);}_0x16dc14[_0xfead('0x9a')]=qs[_0xfead('0x9b')](_0x3f02be[_0xfead('0x86')][_0xfead('0x9b')]);_0x16dc14[_0xfead('0x7f')]=qs[_0xfead('0x92')](_[_0xfead('0x9c')](_0x3f02be[_0xfead('0x86')],_0x57ba41['filters']));if(_0x3f02be[_0xfead('0x86')]['filter']){_0x16dc14[_0xfead('0x7f')]=_[_0xfead('0x9d')](_0x16dc14['where'],{'$or':_[_0xfead('0x7')](_0x29c1b8,function(_0xc60f56){if(_0xc60f56['type'][_0xfead('0x9e')]!=='VIRTUAL'){var _0x3258f7={};_0x3258f7[_0xc60f56['field']]={'$like':'%'+_0x3f02be['query'][_0xfead('0x4')]+'%'};return _0x3258f7;}})});}var _0x2a1d68=[];var _0xf0e266=null;var _0x147215={};if(_0x179465){_0xf0e266=_[_0xfead('0x8d')](_0x1ee8a6,[_0xfead('0xd'),_0x179465['name']]);if(_0xf0e266[_0xfead('0x9')]){_0x147215={};if(_0x197bc5[_0xfead('0x12')]==='AnalyticExtractedReport'){_0x147215[_0xf0e266[_0xfead('0x9f')]]=_['map'](_0x179465['associatedResources'],'id');}else{_0x147215[_0xf0e266[_0xfead('0x9f')]]=_0x179465[_0xfead('0xc')];}_0x2a1d68[_0xfead('0x89')](_0x147215);}else{_0x16dc14['where']['id']=_0x179465[_0xfead('0xc')];}}else{for(var _0x308b55=0x0;_0x308b55<_0x425b1d[_0xfead('0x88')];_0x308b55++){_0xf0e266=_[_0xfead('0x8d')](_0x1ee8a6,['name',_0x425b1d[_0x308b55][_0xfead('0xd')]]);if(_0xf0e266[_0xfead('0x9')]){_0x147215={};_0x147215[_0xf0e266[_0xfead('0x9f')]]=_0x425b1d[_0x308b55][_0xfead('0xc')];_0x2a1d68['push'](_0x147215);}else{if(!_0x16dc14[_0xfead('0x7f')]['id'])_0x16dc14[_0xfead('0x7f')]['id']=[];_0x425b1d[_0x308b55][_0xfead('0xc')][_0xfead('0xa0')](function(_0x43bb5c){_0x16dc14['where']['id'][_0xfead('0x89')](_0x43bb5c);});}}}if(!_['isEmpty'](_0x2a1d68)){_0x16dc14[_0xfead('0x7f')]=_['merge'](_0x16dc14[_0xfead('0x7f')],{'$and':{'$or':_0x2a1d68}});}_0x16dc14=_[_0xfead('0x9d')]({},_0x16dc14,_0x3f02be[_0xfead('0xa1')]);if(_0x179465&&!_0x179465['autoAssociation']&&_0x197bc5[_0xfead('0x12')]===_0xfead('0x74')){if(_0x3f02be[_0xfead('0x86')][_0xfead('0xa2')]){_0x16dc14[_0xfead('0xa3')]=[{'all':!![]}];}return _0x447469[_0x197bc5[_0xfead('0x12')]][_0xfead('0xb')](_0x16dc14)['then'](function(_0x82a5d6){var _0x9b93ab=[];_0x82a5d6[_0xfead('0xa0')](function(_0x380909){var _0x5e81ae;switch(_0x380909[_0xfead('0xa4')]){case _0xfead('0xa5'):_0x5e81ae=_[_0xfead('0x8d')](_0x179465[_0xfead('0xc')],function(_0x5d55b8){return _0x5d55b8['id']===_0x380909[_0xfead('0x76')]&&_0x5d55b8[_0xfead('0x3a')]==='DefaultReports';});break;case'custom':_0x5e81ae=_[_0xfead('0x8d')](_0x179465['associatedResources'],function(_0x42be80){return _0x42be80['id']===_0x380909['reportId']&&_0x42be80['type']===_0xfead('0xa6');});break;}if(_0x5e81ae)_0x9b93ab[_0xfead('0x89')](_0x380909);});_0x13fedd[_0xfead('0xa7')]=_0x9b93ab[_0xfead('0x88')];_0x13fedd[_0xfead('0xa8')]=_0x9b93ab;return _0x13fedd;});}else{if(!_[_0xfead('0x8c')](_0x3f02be['query'][_0xfead('0xa9')])){_0x16dc14[_0xfead('0x7f')]['id']=_0x16dc14[_0xfead('0x7f')]['id']?_[_0xfead('0x93')](_0x16dc14[_0xfead('0x7f')]['id'],_0x3f02be['query'][_0xfead('0xa9')]):_0x3f02be[_0xfead('0x86')][_0xfead('0xa9')];if(_0x3f02be['query']['customSorting']){_0x16dc14['order']=_0x3f02be[_0xfead('0x86')]['customSorting'];}}if(_0x3f02be[_0xfead('0x86')]['extraQueryConditions']){_0x16dc14[_0xfead('0x7f')]=_[_0xfead('0x9d')](_0x16dc14['where'],{'$and':_0x3f02be['query'][_0xfead('0xaa')]});}return _0x447469[_0x197bc5[_0xfead('0x12')]]['count']({'where':_0x16dc14[_0xfead('0x7f')]})[_0xfead('0x6')](function(_0x3b2600){_0x13fedd[_0xfead('0xa7')]=_0x3b2600;if(_0x3f02be[_0xfead('0x86')][_0xfead('0xa2')]){if(_0x197bc5[_0xfead('0x12')]===_0xfead('0x1c')){_0x16dc14[_0xfead('0xa3')]=[{'model':_0x447469[_0xfead('0x69')],'as':_0xfead('0xab'),'attributes':['id',_0xfead('0xd'),_0xfead('0xac')],'required':_0x3f02be[_0xfead('0x86')][_0xfead('0xad')]?!![]:![]},{'model':_0x447469[_0xfead('0x69')],'as':_0xfead('0xae'),'attributes':['id',_0xfead('0xd'),_0xfead('0xac')],'through':_0x3f02be[_0xfead('0x86')][_0xfead('0xad')]?{'attributes':[],'where':{'TagId':_0x3f02be['query']['tag']||undefined}}:{},'required':_0x3f02be[_0xfead('0x86')][_0xfead('0xad')]?!![]:![]}];}else{_0x16dc14[_0xfead('0xa3')]=[{'all':!![]}];}}return _0x447469[_0x197bc5[_0xfead('0x12')]][_0xfead('0xb')](_0x16dc14);})[_0xfead('0x6')](function(_0x114be0){_0x13fedd[_0xfead('0xa8')]=_0x114be0;if(_0x68235a==='Agents'&&_0x3f02be[_0xfead('0x86')][_0xfead('0xaf')]===_0xfead('0xb0')){var _0x13085e=[];for(var _0x87e023=0x0;_0x87e023<_0x13fedd[_0xfead('0xa8')][_0xfead('0x88')];_0x87e023++){_0x13085e['push'](_0x2edf9d('chat',_0x13fedd[_0xfead('0xa8')][_0x87e023][_0xfead('0xb1')]));_0x13085e[_0xfead('0x89')](_0x2edf9d('sms',_0x13fedd['rows'][_0x87e023][_0xfead('0xb1')]));_0x13085e[_0xfead('0x89')](_0x2edf9d(_0xfead('0xb2'),_0x13fedd[_0xfead('0xa8')][_0x87e023][_0xfead('0xb1')]));_0x13085e[_0xfead('0x89')](_0x2edf9d(_0xfead('0xb3'),_0x13fedd[_0xfead('0xa8')][_0x87e023][_0xfead('0xb1')]));_0x13085e[_0xfead('0x89')](_0x2edf9d(_0xfead('0xb4'),_0x13fedd['rows'][_0x87e023][_0xfead('0xb1')]));_0x13085e['push'](_0x2edf9d(_0xfead('0xb5'),_0x13fedd['rows'][_0x87e023][_0xfead('0xb1')]));}return Promise[_0xfead('0xb6')](_0x13085e)['then'](function(){return _0x13fedd;});}return _0x13fedd;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2392c1b..0411780 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 _0x3837=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','ioredis'];(function(_0x2bf2e2,_0x1e4951){var _0x443dd4=function(_0x4c5091){while(--_0x4c5091){_0x2bf2e2['push'](_0x2bf2e2['shift']());}};_0x443dd4(++_0x1e4951);}(_0x3837,0x1d1));var _0x7383=function(_0x523a59,_0x137d9c){_0x523a59=_0x523a59-0x0;var _0xecfbc5=_0x3837[_0x523a59];return _0xecfbc5;};'use strict';var _=require('lodash');var util=require(_0x7383('0x0'));var moment=require('moment');var BPromise=require(_0x7383('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7383('0x2'));var db=require(_0x7383('0x3'))['db'];var utils=require(_0x7383('0x4'));var logger=require(_0x7383('0x5'))(_0x7383('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7383('0x7')][_0x7383('0x8')]({'port':0x232a});config[_0x7383('0x9')]=_[_0x7383('0xa')](config[_0x7383('0x9')],{'host':_0x7383('0xb'),'port':0x18eb});var socket=require(_0x7383('0xc'))(new Redis(config['redis']));require(_0x7383('0xd'))[_0x7383('0xe')](socket);function respondWithRpcPromise(_0x257254,_0x1316ec,_0x3d2d47){return new BPromise(function(_0x2dcdc9,_0x19f134){return client['request'](_0x257254,_0x3d2d47)[_0x7383('0xf')](function(_0x5ba02f){logger[_0x7383('0x10')](_0x7383('0x11'),_0x1316ec,_0x7383('0x12'));logger[_0x7383('0x13')](_0x7383('0x14'),_0x1316ec,_0x7383('0x12'),JSON[_0x7383('0x15')](_0x5ba02f));if(_0x5ba02f[_0x7383('0x16')]){if(_0x5ba02f[_0x7383('0x16')]['code']===0x1f4){logger[_0x7383('0x16')](_0x7383('0x11'),_0x1316ec,_0x5ba02f[_0x7383('0x16')][_0x7383('0x17')]);return _0x19f134(_0x5ba02f['error']['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x1316ec,_0x5ba02f[_0x7383('0x16')][_0x7383('0x17')]);return _0x2dcdc9(_0x5ba02f[_0x7383('0x16')][_0x7383('0x17')]);}else{logger[_0x7383('0x10')]('UserProfile,\x20%s,\x20%s',_0x1316ec,_0x7383('0x12'));_0x2dcdc9(_0x5ba02f[_0x7383('0x18')][_0x7383('0x17')]);}})[_0x7383('0x19')](function(_0x251702){logger[_0x7383('0x16')](_0x7383('0x11'),_0x1316ec,_0x251702);_0x19f134(_0x251702);});});} \ No newline at end of file +var _0x307e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','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','catch','lodash','util'];(function(_0x22688c,_0x5e3d59){var _0x18c630=function(_0x371926){while(--_0x371926){_0x22688c['push'](_0x22688c['shift']());}};_0x18c630(++_0x5e3d59);}(_0x307e,0xc9));var _0xe307=function(_0x822c47,_0x3f7297){_0x822c47=_0x822c47-0x0;var _0xa371da=_0x307e[_0x822c47];return _0xa371da;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rs=require(_0xe307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require('../../config/logger')(_0xe307('0x7'));var config=require('../../config/environment');var jayson=require(_0xe307('0x8'));var client=jayson[_0xe307('0x9')][_0xe307('0xa')]({'port':0x232a});config['redis']=_[_0xe307('0xb')](config[_0xe307('0xc')],{'host':_0xe307('0xd'),'port':0x18eb});var socket=require(_0xe307('0xe'))(new Redis(config[_0xe307('0xc')]));require(_0xe307('0xf'))[_0xe307('0x10')](socket);function respondWithRpcPromise(_0x3ab559,_0x231b98,_0x393a82){return new BPromise(function(_0x217f0a,_0x4219b1){return client[_0xe307('0x11')](_0x3ab559,_0x393a82)[_0xe307('0x12')](function(_0xc521b8){logger[_0xe307('0x13')](_0xe307('0x14'),_0x231b98,_0xe307('0x15'));logger[_0xe307('0x16')](_0xe307('0x17'),_0x231b98,'request\x20sent',JSON[_0xe307('0x18')](_0xc521b8));if(_0xc521b8[_0xe307('0x19')]){if(_0xc521b8['error'][_0xe307('0x1a')]===0x1f4){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x4219b1(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}logger['error'](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x217f0a(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x231b98,_0xe307('0x15'));_0x217f0a(_0xc521b8['result'][_0xe307('0x1b')]);}})[_0xe307('0x1c')](function(_0xe8354d){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xe8354d);_0x4219b1(_0xe8354d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 147d66c..37597dd 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 _0xcce3=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0xb8105,_0x3e3adb){var _0x24768c=function(_0x128b9c){while(--_0x128b9c){_0xb8105['push'](_0xb8105['shift']());}};_0x24768c(++_0x3e3adb);}(_0xcce3,0x1a2));var _0x3cce=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0xcce3[_0x2730da];return _0xfe9991;};'use strict';var UserProfileEvents=require(_0x3cce('0x0'));var events=[_0x3cce('0x1'),_0x3cce('0x2'),_0x3cce('0x3')];function createListener(_0x581d1b,_0x285786){return function(_0x5b34bd){_0x285786[_0x3cce('0x4')](_0x581d1b,_0x5b34bd);};}function removeListener(_0x5e3962,_0x3b02b4){return function(){UserProfileEvents[_0x3cce('0x5')](_0x5e3962,_0x3b02b4);};}exports[_0x3cce('0x6')]=function(_0x31e9cd){for(var _0xf1ab05=0x0,_0x41c3e8=events[_0x3cce('0x7')];_0xf1ab05<_0x41c3e8;_0xf1ab05++){var _0x5075ee=events[_0xf1ab05];var _0x3ed790=createListener(_0x3cce('0x8')+_0x5075ee,_0x31e9cd);UserProfileEvents['on'](_0x5075ee,_0x3ed790);}}; \ No newline at end of file +var _0xd79f=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd79f,0x106));var _0xfd79=function(_0x441eec,_0x76e475){_0x441eec=_0x441eec-0x0;var _0x21ef76=_0xd79f[_0x441eec];return _0x21ef76;};'use strict';var UserProfileEvents=require(_0xfd79('0x0'));var events=[_0xfd79('0x1'),_0xfd79('0x2'),_0xfd79('0x3')];function createListener(_0x3c2356,_0x2cb69f){return function(_0x53bc81){_0x2cb69f[_0xfd79('0x4')](_0x3c2356,_0x53bc81);};}function removeListener(_0x2f747a,_0x5a7f8e){return function(){UserProfileEvents[_0xfd79('0x5')](_0x2f747a,_0x5a7f8e);};}exports['register']=function(_0x5248b7){for(var _0x494b05=0x0,_0x5b3e5e=events[_0xfd79('0x6')];_0x494b05<_0x5b3e5e;_0x494b05++){var _0x2003a5=events[_0x494b05];var _0x1507aa=createListener(_0xfd79('0x7')+_0x2003a5,_0x5248b7);UserProfileEvents['on'](_0x2003a5,_0x1507aa);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6adbc75..d138cf1 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 _0x1471=['index','/describe','isAuthenticated','post','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2b6ce8,_0x2e2f73){var _0x53bf71=function(_0x396b53){while(--_0x396b53){_0x2b6ce8['push'](_0x2b6ce8['shift']());}};_0x53bf71(++_0x2e2f73);}(_0x1471,0x13a));var _0x1147=function(_0x588f46,_0x31c571){_0x588f46=_0x588f46-0x0;var _0x400e9c=_0x1471[_0x588f46];return _0x400e9c;};'use strict';var multer=require(_0x1147('0x0'));var util=require(_0x1147('0x1'));var path=require(_0x1147('0x2'));var timeout=require(_0x1147('0x3'));var express=require('express');var router=express[_0x1147('0x4')]();var fs_extra=require(_0x1147('0x5'));var auth=require(_0x1147('0x6'));var interaction=require(_0x1147('0x7'));var config=require(_0x1147('0x8'));var controller=require('./userProfileResource.controller');router[_0x1147('0x9')]('/',auth['isAuthenticated'](),controller[_0x1147('0xa')]);router['get'](_0x1147('0xb'),auth[_0x1147('0xc')](),controller['describe']);router[_0x1147('0x9')]('/:id',auth[_0x1147('0xc')](),controller['show']);router[_0x1147('0xd')]('/',auth[_0x1147('0xc')](),controller['create']);router[_0x1147('0xe')](_0x1147('0xf'),auth[_0x1147('0xc')](),controller[_0x1147('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1147('0x11')]=router; \ No newline at end of file +var _0xf855=['isAuthenticated','describe','/:id','show','create','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xf855,0x147));var _0x5f85=function(_0x28f8be,_0x3e8433){_0x28f8be=_0x28f8be-0x0;var _0xe4430f=_0xf855[_0x28f8be];return _0xe4430f;};'use strict';var multer=require(_0x5f85('0x0'));var util=require(_0x5f85('0x1'));var path=require(_0x5f85('0x2'));var timeout=require(_0x5f85('0x3'));var express=require(_0x5f85('0x4'));var router=express['Router']();var fs_extra=require(_0x5f85('0x5'));var auth=require(_0x5f85('0x6'));var interaction=require(_0x5f85('0x7'));var config=require(_0x5f85('0x8'));var controller=require(_0x5f85('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f85('0xa')]);router[_0x5f85('0xb')](_0x5f85('0xc'),auth[_0x5f85('0xd')](),controller[_0x5f85('0xe')]);router[_0x5f85('0xb')](_0x5f85('0xf'),auth[_0x5f85('0xd')](),controller[_0x5f85('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f85('0x11')]);router[_0x5f85('0x12')](_0x5f85('0xf'),auth[_0x5f85('0xd')](),controller['update']);router[_0x5f85('0x13')](_0x5f85('0xf'),auth['isAuthenticated'](),controller['destroy']);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 959b540..fcbcd7c 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 _0xd441=['STRING','INTEGER','sequelize','exports'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xd441,0x142));var _0x1d44=function(_0x38be57,_0x433fa8){_0x38be57=_0x38be57-0x0;var _0x2a8895=_0xd441[_0x38be57];return _0x2a8895;};'use strict';var Sequelize=require(_0x1d44('0x0'));module[_0x1d44('0x1')]={'name':{'type':Sequelize[_0x1d44('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1d44('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2e0b=['INTEGER','sequelize','exports','STRING'];(function(_0x16998e,_0x3d2543){var _0x2c22e9=function(_0x3dc2f2){while(--_0x3dc2f2){_0x16998e['push'](_0x16998e['shift']());}};_0x2c22e9(++_0x3d2543);}(_0x2e0b,0x121));var _0xb2e0=function(_0x59625f,_0x3b2c76){_0x59625f=_0x59625f-0x0;var _0x498e1e=_0x2e0b[_0x59625f];return _0x498e1e;};'use strict';var Sequelize=require(_0xb2e0('0x0'));module[_0xb2e0('0x1')]={'name':{'type':Sequelize[_0xb2e0('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb2e0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb2e0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ded26a9..e10d10d 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 _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x5e99ae,_0x37d21f){var _0x286019=function(_0x38b46c){while(--_0x38b46c){_0x5e99ae['push'](_0x5e99ae['shift']());}};_0x286019(++_0x37d21f);}(_0xdb28,0x106));var _0x8db2=function(_0x495ca6,_0xc38fad){_0x495ca6=_0x495ca6-0x0;var _0x88844=_0xdb28[_0x495ca6];return _0x88844;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file +var _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x3bdb10,_0x3e2928){var _0x2761f6=function(_0x55b6db){while(--_0x55b6db){_0x3bdb10['push'](_0x3bdb10['shift']());}};_0x2761f6(++_0x3e2928);}(_0x9582,0x95));var _0x2958=function(_0x2d3b4b,_0x4cc483){_0x2d3b4b=_0x2d3b4b-0x0;var _0x3b1a65=_0x9582[_0x2d3b4b];return _0x3b1a65;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 755259d..70a9b84 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 _0xd6c8=['define','UserProfileResource','compositeIndex','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xd6c8,0x6b));var _0x8d6c=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xd6c8[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0x8d6c('0x0'));var util=require(_0x8d6c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8d6c('0x2'));var BPromise=require(_0x8d6c('0x3'));var rp=require(_0x8d6c('0x4'));var fs=require('fs');var path=require(_0x8d6c('0x5'));var rimraf=require(_0x8d6c('0x6'));var config=require(_0x8d6c('0x7'));var attributes=require(_0x8d6c('0x8'));module[_0x8d6c('0x9')]=function(_0x347703,_0x5e19c2){return _0x347703[_0x8d6c('0xa')](_0x8d6c('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x8d6c('0xc'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1713=['rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x1713,0x1cb));var _0x3171=function(_0xbe961f,_0x3bd1dc){_0xbe961f=_0xbe961f-0x0;var _0x5235b3=_0x1713[_0xbe961f];return _0x5235b3;};'use strict';var _=require(_0x3171('0x0'));var util=require(_0x3171('0x1'));var logger=require(_0x3171('0x2'))('api');var moment=require(_0x3171('0x3'));var BPromise=require('bluebird');var rp=require(_0x3171('0x4'));var fs=require('fs');var path=require(_0x3171('0x5'));var rimraf=require(_0x3171('0x6'));var config=require(_0x3171('0x7'));var attributes=require(_0x3171('0x8'));module['exports']=function(_0x3a3a48,_0x3f56fd){return _0x3a3a48[_0x3171('0x9')](_0x3171('0xa'),attributes,{'tableName':_0x3171('0xb'),'paranoid':![],'indexes':[{'name':_0x3171('0xc'),'fields':[_0x3171('0xd'),_0x3171('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6606a72..33f2813 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 _0xe229=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash'];(function(_0x36a5b4,_0x20a935){var _0x4e33fc=function(_0x2f563f){while(--_0x2f563f){_0x36a5b4['push'](_0x36a5b4['shift']());}};_0x4e33fc(++_0x20a935);}(_0xe229,0x107));var _0x9e22=function(_0x4a73b1,_0x5333e6){_0x4a73b1=_0x4a73b1-0x0;var _0x5e9f78=_0xe229[_0x4a73b1];return _0x5e9f78;};'use strict';var _=require(_0x9e22('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e22('0x1'));var rs=require(_0x9e22('0x2'));var fs=require('fs');var Redis=require(_0x9e22('0x3'));var db=require(_0x9e22('0x4'))['db'];var utils=require(_0x9e22('0x5'));var logger=require(_0x9e22('0x6'))(_0x9e22('0x7'));var config=require(_0x9e22('0x8'));var jayson=require(_0x9e22('0x9'));var client=jayson[_0x9e22('0xa')][_0x9e22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551084,_0x227dad,_0x124b0a){return new BPromise(function(_0x306099,_0x5abc9b){return client[_0x9e22('0xc')](_0x551084,_0x124b0a)[_0x9e22('0xd')](function(_0x566fe0){logger[_0x9e22('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x227dad,_0x9e22('0xf'));logger[_0x9e22('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x227dad,_0x9e22('0xf'),JSON[_0x9e22('0x11')](_0x566fe0));if(_0x566fe0[_0x9e22('0x12')]){if(_0x566fe0[_0x9e22('0x12')][_0x9e22('0x13')]===0x1f4){logger[_0x9e22('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x227dad,_0x566fe0[_0x9e22('0x12')]['message']);return _0x5abc9b(_0x566fe0[_0x9e22('0x12')][_0x9e22('0x14')]);}logger['error'](_0x9e22('0x15'),_0x227dad,_0x566fe0[_0x9e22('0x12')][_0x9e22('0x14')]);return _0x306099(_0x566fe0[_0x9e22('0x12')][_0x9e22('0x14')]);}else{logger[_0x9e22('0xe')](_0x9e22('0x15'),_0x227dad,_0x9e22('0xf'));_0x306099(_0x566fe0[_0x9e22('0x16')][_0x9e22('0x14')]);}})[_0x9e22('0x17')](function(_0x47d193){logger[_0x9e22('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x227dad,_0x47d193);_0x5abc9b(_0x47d193);});});} \ No newline at end of file +var _0x074b=['client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x584761,_0x154a1a){var _0x46b797=function(_0x2d1428){while(--_0x2d1428){_0x584761['push'](_0x584761['shift']());}};_0x46b797(++_0x154a1a);}(_0x074b,0x125));var _0xb074=function(_0x1718d0,_0x3fa02b){_0x1718d0=_0x1718d0-0x0;var _0x2d5071=_0x074b[_0x1718d0];return _0x2d5071;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb074('0x0'));var BPromise=require('bluebird');var rs=require(_0xb074('0x1'));var fs=require('fs');var Redis=require(_0xb074('0x2'));var db=require(_0xb074('0x3'))['db'];var utils=require(_0xb074('0x4'));var logger=require(_0xb074('0x5'))(_0xb074('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb074('0x7')][_0xb074('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x459235,_0x178c18,_0x285bc2){return new BPromise(function(_0x543c8c,_0x50bdd0){return client['request'](_0x459235,_0x285bc2)[_0xb074('0x9')](function(_0x2a4bfc){logger[_0xb074('0xa')](_0xb074('0xb'),_0x178c18,'request\x20sent');logger[_0xb074('0xc')](_0xb074('0xd'),_0x178c18,_0xb074('0xe'),JSON['stringify'](_0x2a4bfc));if(_0x2a4bfc['error']){if(_0x2a4bfc[_0xb074('0xf')][_0xb074('0x10')]===0x1f4){logger[_0xb074('0xf')](_0xb074('0xb'),_0x178c18,_0x2a4bfc[_0xb074('0xf')][_0xb074('0x11')]);return _0x50bdd0(_0x2a4bfc[_0xb074('0xf')]['message']);}logger['error'](_0xb074('0xb'),_0x178c18,_0x2a4bfc[_0xb074('0xf')][_0xb074('0x11')]);return _0x543c8c(_0x2a4bfc[_0xb074('0xf')]['message']);}else{logger[_0xb074('0xa')](_0xb074('0xb'),_0x178c18,'request\x20sent');_0x543c8c(_0x2a4bfc[_0xb074('0x12')][_0xb074('0x11')]);}})[_0xb074('0x13')](function(_0x24828a){logger[_0xb074('0xf')](_0xb074('0xb'),_0x178c18,_0x24828a);_0x50bdd0(_0x24828a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ff8fd80..c0a0df4 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 _0x6edb=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','delete','exports'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x6edb,0xf7));var _0xb6ed=function(_0x8a8a5,_0x440238){_0x8a8a5=_0x8a8a5-0x0;var _0x2e4ab9=_0x6edb[_0x8a8a5];return _0x2e4ab9;};'use strict';var multer=require(_0xb6ed('0x0'));var util=require(_0xb6ed('0x1'));var path=require(_0xb6ed('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6ed('0x3'));var router=express[_0xb6ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6ed('0x5'));var interaction=require(_0xb6ed('0x6'));var config=require(_0xb6ed('0x7'));var controller=require(_0xb6ed('0x8'));router[_0xb6ed('0x9')]('/',auth['isAuthenticated'](),controller[_0xb6ed('0xa')]);router[_0xb6ed('0x9')](_0xb6ed('0xb'),auth[_0xb6ed('0xc')](),controller[_0xb6ed('0xd')]);router[_0xb6ed('0x9')](_0xb6ed('0xe'),auth[_0xb6ed('0xc')](),controller['show']);router[_0xb6ed('0xf')]('/',auth['isAuthenticated'](),controller[_0xb6ed('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb6ed('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb6ed('0x12')]=router; \ No newline at end of file +var _0xc5ff=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x534d07,_0x588703){var _0x325b8b=function(_0x689dd3){while(--_0x689dd3){_0x534d07['push'](_0x534d07['shift']());}};_0x325b8b(++_0x588703);}(_0xc5ff,0x66));var _0xfc5f=function(_0x1707bd,_0x34f26e){_0x1707bd=_0x1707bd-0x0;var _0x19f5fc=_0xc5ff[_0x1707bd];return _0x19f5fc;};'use strict';var multer=require('multer');var util=require(_0xfc5f('0x0'));var path=require(_0xfc5f('0x1'));var timeout=require(_0xfc5f('0x2'));var express=require(_0xfc5f('0x3'));var router=express[_0xfc5f('0x4')]();var fs_extra=require(_0xfc5f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc5f('0x6'));var config=require(_0xfc5f('0x7'));var controller=require(_0xfc5f('0x8'));router[_0xfc5f('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc5f('0xa')]);router['get'](_0xfc5f('0xb'),auth[_0xfc5f('0xc')](),controller['describe']);router[_0xfc5f('0x9')](_0xfc5f('0xd'),auth[_0xfc5f('0xc')](),controller[_0xfc5f('0xe')]);router[_0xfc5f('0xf')]('/',auth[_0xfc5f('0xc')](),controller[_0xfc5f('0x10')]);router[_0xfc5f('0x11')](_0xfc5f('0xd'),auth[_0xfc5f('0xc')](),controller[_0xfc5f('0x12')]);router[_0xfc5f('0x13')](_0xfc5f('0xd'),auth[_0xfc5f('0xc')](),controller['destroy']);module[_0xfc5f('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 34352f0..6cee40b 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 _0x282b=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x2ef976,_0x55100b){var _0x444c31=function(_0x598293){while(--_0x598293){_0x2ef976['push'](_0x2ef976['shift']());}};_0x444c31(++_0x55100b);}(_0x282b,0xec));var _0xb282=function(_0x3ec901,_0x1ceb6f){_0x3ec901=_0x3ec901-0x0;var _0x2098cc=_0x282b[_0x3ec901];return _0x2098cc;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'name':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb282('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb282('0x2')],'set':function(_0x5cadd7){this[_0xb282('0x4')](_0xb282('0x5'),_0x5cadd7?_0x5cadd7[_0xb282('0x6')](''):[]);},'get':function(){return this[_0xb282('0x7')](_0xb282('0x5'))?this[_0xb282('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0xe1e3=['getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x4a29f1,_0x23e312){var _0xe71461=function(_0x552bff){while(--_0x552bff){_0x4a29f1['push'](_0x4a29f1['shift']());}};_0xe71461(++_0x23e312);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xe33311,_0x5e8c5b){_0xe33311=_0xe33311-0x0;var _0x517dce=_0xe1e3[_0xe33311];return _0x517dce;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3e1e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3e1e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3bacc){this[_0x3e1e('0x4')](_0x3e1e('0x5'),_0x3bacc?_0x3bacc[_0x3e1e('0x6')](''):[]);},'get':function(){return this[_0x3e1e('0x7')](_0x3e1e('0x5'))?this['getDataValue'](_0x3e1e('0x5'))[_0x3e1e('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 54242fc..2cc85bd 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 _0x7672=['reject','save','update','destroy','then','stack','name','index','map','UserProfileSection','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','includeAll','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x7e9b4,_0xa1ddc3){var _0x2dadfb=function(_0x415381){while(--_0x415381){_0x7e9b4['push'](_0x7e9b4['shift']());}};_0x2dadfb(++_0xa1ddc3);}(_0x7672,0xb8));var _0x2767=function(_0x48c0cc,_0x91510b){_0x48c0cc=_0x48c0cc-0x0;var _0x3f3825=_0x7672[_0x48c0cc];return _0x3f3825;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2767('0x0'));var zipdir=require(_0x2767('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2767('0x2'));var moment=require(_0x2767('0x3'));var BPromise=require(_0x2767('0x4'));var Mustache=require(_0x2767('0x5'));var util=require(_0x2767('0x6'));var path=require('path');var sox=require(_0x2767('0x7'));var csv=require(_0x2767('0x8'));var ejs=require(_0x2767('0x9'));var fs=require('fs');var fs_extra=require(_0x2767('0xa'));var _=require(_0x2767('0xb'));var squel=require(_0x2767('0xc'));var crypto=require(_0x2767('0xd'));var jsforce=require(_0x2767('0xe'));var deskjs=require(_0x2767('0xf'));var toCsv=require(_0x2767('0x8'));var querystring=require(_0x2767('0x10'));var Papa=require(_0x2767('0x11'));var Redis=require(_0x2767('0x12'));var authService=require(_0x2767('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2767('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2767('0x15'));var utils=require(_0x2767('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2767('0x17'))['db'];function respondWithStatusCode(_0x422c58,_0x4f0ae5){_0x4f0ae5=_0x4f0ae5||0xcc;return function(_0x32da31){if(_0x32da31){return _0x422c58[_0x2767('0x18')](_0x4f0ae5);}return _0x422c58[_0x2767('0x19')](_0x4f0ae5)[_0x2767('0x1a')]();};}function respondWithResult(_0x221fe2,_0x5c744b){_0x5c744b=_0x5c744b||0xc8;return function(_0xbe930b){if(_0xbe930b){return _0x221fe2['status'](_0x5c744b)[_0x2767('0x1b')](_0xbe930b);}};}function respondWithFilteredResult(_0x16da00,_0x333efd){return function(_0x287b6d){if(_0x287b6d){var _0x4d9745=typeof _0x333efd[_0x2767('0x1c')]===_0x2767('0x1d')&&typeof _0x333efd[_0x2767('0x1e')]===_0x2767('0x1d');var _0x2cebbe=_0x287b6d[_0x2767('0x1f')];var _0x123e67=_0x4d9745?0x0:_0x333efd['offset'];var _0xaa780b=_0x4d9745?_0x287b6d[_0x2767('0x1f')]:_0x333efd['offset']+_0x333efd[_0x2767('0x1e')];var _0x4d6b88;if(_0xaa780b>=_0x2cebbe){_0xaa780b=_0x2cebbe;_0x4d6b88=0xc8;}else{_0x4d6b88=0xce;}_0x16da00['status'](_0x4d6b88);return _0x16da00[_0x2767('0x20')](_0x2767('0x21'),_0x123e67+'-'+_0xaa780b+'/'+_0x2cebbe)[_0x2767('0x1b')](_0x287b6d);}return null;};}function patchUpdates(_0x2a8eb4){return function(_0x53fcdb){try{jsonpatch[_0x2767('0x22')](_0x53fcdb,_0x2a8eb4,!![]);}catch(_0x5bacd6){return BPromise[_0x2767('0x23')](_0x5bacd6);}return _0x53fcdb[_0x2767('0x24')]();};}function saveUpdates(_0x1a9a6a,_0x57116e){return function(_0x2b75c6){if(_0x2b75c6){return _0x2b75c6[_0x2767('0x25')](_0x1a9a6a)['then'](function(_0xd9820e){return _0xd9820e;});}return null;};}function removeEntity(_0x48c57e,_0x31f733){return function(_0x3ec749){if(_0x3ec749){return _0x3ec749[_0x2767('0x26')]()[_0x2767('0x27')](function(){_0x48c57e['status'](0xcc)[_0x2767('0x1a')]();});}};}function handleEntityNotFound(_0x407ac7,_0x338d0f){return function(_0x27c772){if(!_0x27c772){_0x407ac7[_0x2767('0x18')](0x194);}return _0x27c772;};}function handleError(_0x499bc9,_0x4ff172){_0x4ff172=_0x4ff172||0x1f4;return function(_0x38ffa5){logger['error'](_0x38ffa5[_0x2767('0x28')]);if(_0x38ffa5[_0x2767('0x29')]){delete _0x38ffa5[_0x2767('0x29')];}_0x499bc9[_0x2767('0x19')](_0x4ff172)['send'](_0x38ffa5);};}exports[_0x2767('0x2a')]=function(_0x5adc37,_0x409fd2){var _0x4a3ec8={},_0x3ab64a={},_0x1e039d={'count':0x0,'rows':[]};var _0x276644=_[_0x2767('0x2b')](db[_0x2767('0x2c')][_0x2767('0x2d')],function(_0x449526){return{'name':_0x449526['fieldName'],'type':_0x449526[_0x2767('0x2e')][_0x2767('0x2f')]};});_0x3ab64a[_0x2767('0x30')]=_[_0x2767('0x2b')](_0x276644,_0x2767('0x29'));_0x3ab64a['query']=_[_0x2767('0x31')](_0x5adc37[_0x2767('0x32')]);_0x3ab64a['filters']=_[_0x2767('0x33')](_0x3ab64a[_0x2767('0x30')],_0x3ab64a[_0x2767('0x32')]);_0x4a3ec8[_0x2767('0x34')]=_['intersection'](_0x3ab64a[_0x2767('0x30')],qs[_0x2767('0x35')](_0x5adc37['query'][_0x2767('0x35')]));_0x4a3ec8['attributes']=_0x4a3ec8['attributes'][_0x2767('0x36')]?_0x4a3ec8[_0x2767('0x34')]:_0x3ab64a['model'];if(!_0x5adc37[_0x2767('0x32')][_0x2767('0x37')](_0x2767('0x38'))){_0x4a3ec8[_0x2767('0x1e')]=qs[_0x2767('0x1e')](_0x5adc37[_0x2767('0x32')]['limit']);_0x4a3ec8[_0x2767('0x1c')]=qs[_0x2767('0x1c')](_0x5adc37[_0x2767('0x32')][_0x2767('0x1c')]);}_0x4a3ec8[_0x2767('0x39')]=qs[_0x2767('0x3a')](_0x5adc37[_0x2767('0x32')][_0x2767('0x3a')]);_0x4a3ec8[_0x2767('0x3b')]=qs['filters'](_[_0x2767('0x3c')](_0x5adc37[_0x2767('0x32')],_0x3ab64a[_0x2767('0x3d')]),_0x276644);if(_0x5adc37[_0x2767('0x32')]['filter']){_0x4a3ec8[_0x2767('0x3b')]=_[_0x2767('0x3e')](_0x4a3ec8[_0x2767('0x3b')],{'$or':_[_0x2767('0x2b')](_0x276644,function(_0x1757dd){if(_0x1757dd[_0x2767('0x2e')]!=='VIRTUAL'){var _0x22bb46={};_0x22bb46[_0x1757dd['name']]={'$like':'%'+_0x5adc37['query']['filter']+'%'};return _0x22bb46;}})});}_0x4a3ec8=_[_0x2767('0x3e')]({},_0x4a3ec8,_0x5adc37['options']);var _0x26fbe8={'where':_0x4a3ec8[_0x2767('0x3b')]};return db[_0x2767('0x2c')][_0x2767('0x1f')](_0x26fbe8)['then'](function(_0x14b7f7){_0x1e039d[_0x2767('0x1f')]=_0x14b7f7;if(_0x5adc37['query'][_0x2767('0x3f')]){_0x4a3ec8['include']=[{'all':!![]}];}return db[_0x2767('0x2c')][_0x2767('0x40')](_0x4a3ec8);})[_0x2767('0x27')](function(_0x5128fa){_0x1e039d[_0x2767('0x41')]=_0x5128fa;return _0x1e039d;})[_0x2767('0x27')](respondWithFilteredResult(_0x409fd2,_0x4a3ec8))[_0x2767('0x42')](handleError(_0x409fd2,null));};exports[_0x2767('0x43')]=function(_0x52b162,_0x5a34ac){var _0x36b96a={'raw':![],'where':{'id':_0x52b162[_0x2767('0x44')]['id']}},_0x432254={};_0x432254[_0x2767('0x30')]=_[_0x2767('0x31')](db['UserProfileSection'][_0x2767('0x2d')]);_0x432254['query']=_[_0x2767('0x31')](_0x52b162[_0x2767('0x32')]);_0x432254['filters']=_[_0x2767('0x33')](_0x432254[_0x2767('0x30')],_0x432254[_0x2767('0x32')]);_0x36b96a[_0x2767('0x34')]=_[_0x2767('0x33')](_0x432254[_0x2767('0x30')],qs[_0x2767('0x35')](_0x52b162[_0x2767('0x32')][_0x2767('0x35')]));_0x36b96a[_0x2767('0x34')]=_0x36b96a['attributes'][_0x2767('0x36')]?_0x36b96a['attributes']:_0x432254['model'];if(_0x52b162['query'][_0x2767('0x3f')]){_0x36b96a['include']=[{'all':!![]}];}_0x36b96a=_['merge']({},_0x36b96a,_0x52b162['options']);return db[_0x2767('0x2c')]['find'](_0x36b96a)[_0x2767('0x27')](handleEntityNotFound(_0x5a34ac,null))['then'](respondWithResult(_0x5a34ac,null))['catch'](handleError(_0x5a34ac,null));};exports['create']=function(_0x225fc6,_0x2271da){return db['UserProfileSection'][_0x2767('0x45')](_0x225fc6[_0x2767('0x46')],{})[_0x2767('0x27')](respondWithResult(_0x2271da,0xc9))[_0x2767('0x42')](handleError(_0x2271da,null));};exports['update']=function(_0x119270,_0x21d437){if(_0x119270[_0x2767('0x46')]['id']){delete _0x119270[_0x2767('0x46')]['id'];}return db['UserProfileSection'][_0x2767('0x47')]({'where':{'id':_0x119270[_0x2767('0x44')]['id']}})[_0x2767('0x27')](handleEntityNotFound(_0x21d437,null))[_0x2767('0x27')](saveUpdates(_0x119270['body'],null))[_0x2767('0x27')](respondWithResult(_0x21d437,null))[_0x2767('0x42')](handleError(_0x21d437,null));};exports[_0x2767('0x26')]=function(_0x38e6df,_0x57e104){return db[_0x2767('0x2c')][_0x2767('0x47')]({'where':{'id':_0x38e6df['params']['id']}})[_0x2767('0x27')](handleEntityNotFound(_0x57e104,null))[_0x2767('0x27')](removeEntity(_0x57e104,null))['catch'](handleError(_0x57e104,null));};exports[_0x2767('0x48')]=function(_0x31f4da,_0x5f5340){return db[_0x2767('0x2c')]['describe']()['then'](respondWithResult(_0x5f5340,null))[_0x2767('0x42')](handleError(_0x5f5340,null));}; \ No newline at end of file +var _0x57d7=['order','sort','where','pick','merge','VIRTUAL','count','include','findAll','rows','params','fields','length','includeAll','options','find','catch','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x57d7,0x12c));var _0x757d=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x57d7[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x757d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x757d('0x1'));var rp=require('request-promise');var moment=require(_0x757d('0x2'));var BPromise=require(_0x757d('0x3'));var Mustache=require(_0x757d('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x757d('0x5'));var ejs=require(_0x757d('0x6'));var fs=require('fs');var fs_extra=require(_0x757d('0x7'));var _=require(_0x757d('0x8'));var squel=require('squel');var crypto=require(_0x757d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x757d('0xa'));var toCsv=require(_0x757d('0x5'));var querystring=require('querystring');var Papa=require(_0x757d('0xb'));var Redis=require(_0x757d('0xc'));var authService=require(_0x757d('0xd'));var qs=require(_0x757d('0xe'));var as=require(_0x757d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x757d('0x10'))(_0x757d('0x11'));var utils=require('../../config/utils');var config=require(_0x757d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x757d('0x13'))['db'];function respondWithStatusCode(_0x23f9fe,_0x3af977){_0x3af977=_0x3af977||0xcc;return function(_0x5500a2){if(_0x5500a2){return _0x23f9fe[_0x757d('0x14')](_0x3af977);}return _0x23f9fe[_0x757d('0x15')](_0x3af977)[_0x757d('0x16')]();};}function respondWithResult(_0x7e9f6b,_0x1e79bf){_0x1e79bf=_0x1e79bf||0xc8;return function(_0x508ed5){if(_0x508ed5){return _0x7e9f6b[_0x757d('0x15')](_0x1e79bf)[_0x757d('0x17')](_0x508ed5);}};}function respondWithFilteredResult(_0x1b6aa1,_0x3d08b9){return function(_0x51fbfc){if(_0x51fbfc){var _0x4abde5=typeof _0x3d08b9[_0x757d('0x18')]===_0x757d('0x19')&&typeof _0x3d08b9[_0x757d('0x1a')]===_0x757d('0x19');var _0x3081f3=_0x51fbfc['count'];var _0x227c86=_0x4abde5?0x0:_0x3d08b9[_0x757d('0x18')];var _0x182685=_0x4abde5?_0x51fbfc['count']:_0x3d08b9[_0x757d('0x18')]+_0x3d08b9['limit'];var _0x5f843;if(_0x182685>=_0x3081f3){_0x182685=_0x3081f3;_0x5f843=0xc8;}else{_0x5f843=0xce;}_0x1b6aa1[_0x757d('0x15')](_0x5f843);return _0x1b6aa1[_0x757d('0x1b')](_0x757d('0x1c'),_0x227c86+'-'+_0x182685+'/'+_0x3081f3)[_0x757d('0x17')](_0x51fbfc);}return null;};}function patchUpdates(_0x3e25ff){return function(_0x4308bf){try{jsonpatch['apply'](_0x4308bf,_0x3e25ff,!![]);}catch(_0x5a7afe){return BPromise[_0x757d('0x1d')](_0x5a7afe);}return _0x4308bf[_0x757d('0x1e')]();};}function saveUpdates(_0x5d838d,_0x18fca7){return function(_0x43d7d1){if(_0x43d7d1){return _0x43d7d1[_0x757d('0x1f')](_0x5d838d)[_0x757d('0x20')](function(_0x26e23b){return _0x26e23b;});}return null;};}function removeEntity(_0x44bfbe,_0x208735){return function(_0x144646){if(_0x144646){return _0x144646[_0x757d('0x21')]()[_0x757d('0x20')](function(){_0x44bfbe[_0x757d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c109d,_0x1863bd){return function(_0x47d04b){if(!_0x47d04b){_0x3c109d[_0x757d('0x14')](0x194);}return _0x47d04b;};}function handleError(_0x50e4bb,_0x169842){_0x169842=_0x169842||0x1f4;return function(_0x30477c){logger['error'](_0x30477c[_0x757d('0x22')]);if(_0x30477c['name']){delete _0x30477c[_0x757d('0x23')];}_0x50e4bb['status'](_0x169842)[_0x757d('0x24')](_0x30477c);};}exports['index']=function(_0x3fdc98,_0x5a3ffe){var _0x4e6642={},_0x5a1a1e={},_0x37dfd3={'count':0x0,'rows':[]};var _0x1f1266=_[_0x757d('0x25')](db[_0x757d('0x26')][_0x757d('0x27')],function(_0x1587a4){return{'name':_0x1587a4[_0x757d('0x28')],'type':_0x1587a4[_0x757d('0x29')]['key']};});_0x5a1a1e[_0x757d('0x2a')]=_[_0x757d('0x25')](_0x1f1266,_0x757d('0x23'));_0x5a1a1e['query']=_[_0x757d('0x2b')](_0x3fdc98[_0x757d('0x2c')]);_0x5a1a1e[_0x757d('0x2d')]=_[_0x757d('0x2e')](_0x5a1a1e[_0x757d('0x2a')],_0x5a1a1e[_0x757d('0x2c')]);_0x4e6642[_0x757d('0x2f')]=_[_0x757d('0x2e')](_0x5a1a1e[_0x757d('0x2a')],qs['fields'](_0x3fdc98[_0x757d('0x2c')]['fields']));_0x4e6642[_0x757d('0x2f')]=_0x4e6642[_0x757d('0x2f')]['length']?_0x4e6642['attributes']:_0x5a1a1e[_0x757d('0x2a')];if(!_0x3fdc98[_0x757d('0x2c')][_0x757d('0x30')](_0x757d('0x31'))){_0x4e6642['limit']=qs[_0x757d('0x1a')](_0x3fdc98[_0x757d('0x2c')][_0x757d('0x1a')]);_0x4e6642[_0x757d('0x18')]=qs[_0x757d('0x18')](_0x3fdc98['query'][_0x757d('0x18')]);}_0x4e6642[_0x757d('0x32')]=qs[_0x757d('0x33')](_0x3fdc98[_0x757d('0x2c')][_0x757d('0x33')]);_0x4e6642[_0x757d('0x34')]=qs[_0x757d('0x2d')](_[_0x757d('0x35')](_0x3fdc98['query'],_0x5a1a1e[_0x757d('0x2d')]),_0x1f1266);if(_0x3fdc98[_0x757d('0x2c')]['filter']){_0x4e6642[_0x757d('0x34')]=_[_0x757d('0x36')](_0x4e6642[_0x757d('0x34')],{'$or':_[_0x757d('0x25')](_0x1f1266,function(_0x365599){if(_0x365599[_0x757d('0x29')]!==_0x757d('0x37')){var _0x39375b={};_0x39375b[_0x365599[_0x757d('0x23')]]={'$like':'%'+_0x3fdc98[_0x757d('0x2c')]['filter']+'%'};return _0x39375b;}})});}_0x4e6642=_[_0x757d('0x36')]({},_0x4e6642,_0x3fdc98['options']);var _0x5924ef={'where':_0x4e6642[_0x757d('0x34')]};return db[_0x757d('0x26')][_0x757d('0x38')](_0x5924ef)[_0x757d('0x20')](function(_0x1cb54d){_0x37dfd3[_0x757d('0x38')]=_0x1cb54d;if(_0x3fdc98[_0x757d('0x2c')]['includeAll']){_0x4e6642[_0x757d('0x39')]=[{'all':!![]}];}return db['UserProfileSection'][_0x757d('0x3a')](_0x4e6642);})[_0x757d('0x20')](function(_0x4d3d55){_0x37dfd3[_0x757d('0x3b')]=_0x4d3d55;return _0x37dfd3;})[_0x757d('0x20')](respondWithFilteredResult(_0x5a3ffe,_0x4e6642))['catch'](handleError(_0x5a3ffe,null));};exports['show']=function(_0xec3320,_0x5ed58d){var _0x33de05={'raw':![],'where':{'id':_0xec3320[_0x757d('0x3c')]['id']}},_0xad1b7d={};_0xad1b7d['model']=_[_0x757d('0x2b')](db['UserProfileSection'][_0x757d('0x27')]);_0xad1b7d[_0x757d('0x2c')]=_['keys'](_0xec3320['query']);_0xad1b7d['filters']=_[_0x757d('0x2e')](_0xad1b7d[_0x757d('0x2a')],_0xad1b7d[_0x757d('0x2c')]);_0x33de05[_0x757d('0x2f')]=_[_0x757d('0x2e')](_0xad1b7d[_0x757d('0x2a')],qs[_0x757d('0x3d')](_0xec3320['query'][_0x757d('0x3d')]));_0x33de05[_0x757d('0x2f')]=_0x33de05[_0x757d('0x2f')][_0x757d('0x3e')]?_0x33de05[_0x757d('0x2f')]:_0xad1b7d['model'];if(_0xec3320['query'][_0x757d('0x3f')]){_0x33de05[_0x757d('0x39')]=[{'all':!![]}];}_0x33de05=_[_0x757d('0x36')]({},_0x33de05,_0xec3320[_0x757d('0x40')]);return db[_0x757d('0x26')][_0x757d('0x41')](_0x33de05)['then'](handleEntityNotFound(_0x5ed58d,null))[_0x757d('0x20')](respondWithResult(_0x5ed58d,null))[_0x757d('0x42')](handleError(_0x5ed58d,null));};exports[_0x757d('0x43')]=function(_0x1a67fe,_0x4b8bde){return db[_0x757d('0x26')]['create'](_0x1a67fe['body'],{})[_0x757d('0x20')](respondWithResult(_0x4b8bde,0xc9))[_0x757d('0x42')](handleError(_0x4b8bde,null));};exports['update']=function(_0x489af1,_0x5c7fdd){if(_0x489af1[_0x757d('0x44')]['id']){delete _0x489af1[_0x757d('0x44')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x489af1[_0x757d('0x3c')]['id']}})[_0x757d('0x20')](handleEntityNotFound(_0x5c7fdd,null))[_0x757d('0x20')](saveUpdates(_0x489af1[_0x757d('0x44')],null))[_0x757d('0x20')](respondWithResult(_0x5c7fdd,null))['catch'](handleError(_0x5c7fdd,null));};exports[_0x757d('0x21')]=function(_0x4a8033,_0xefffe4){return db[_0x757d('0x26')]['find']({'where':{'id':_0x4a8033[_0x757d('0x3c')]['id']}})['then'](handleEntityNotFound(_0xefffe4,null))[_0x757d('0x20')](removeEntity(_0xefffe4,null))[_0x757d('0x42')](handleError(_0xefffe4,null));};exports[_0x757d('0x45')]=function(_0x595eac,_0x2a0cd0){return db[_0x757d('0x26')]['describe']()['then'](respondWithResult(_0x2a0cd0,null))['catch'](handleError(_0x2a0cd0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 38e4f02..706bb15 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 _0x00b1=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x205099,_0x5e7a4b){var _0x14c1fd=function(_0x5b3249){while(--_0x5b3249){_0x205099['push'](_0x205099['shift']());}};_0x14c1fd(++_0x5e7a4b);}(_0x00b1,0xd9));var _0x100b=function(_0x4c5965,_0x132239){_0x4c5965=_0x4c5965-0x0;var _0x155d60=_0x00b1[_0x4c5965];return _0x155d60;};'use strict';var _=require('lodash');var util=require(_0x100b('0x0'));var logger=require(_0x100b('0x1'))(_0x100b('0x2'));var moment=require(_0x100b('0x3'));var BPromise=require(_0x100b('0x4'));var rp=require(_0x100b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x100b('0x6'));var config=require(_0x100b('0x7'));var attributes=require(_0x100b('0x8'));module[_0x100b('0x9')]=function(_0x4aef61,_0x17f9d1){return _0x4aef61[_0x100b('0xa')](_0x100b('0xb'),attributes,{'tableName':_0x100b('0xc'),'paranoid':![],'indexes':[{'name':_0x100b('0xd'),'fields':[_0x100b('0xe'),_0x100b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x780c=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','bluebird','path','../../config/environment'];(function(_0x20aeb8,_0x53ca6d){var _0x55d92c=function(_0x1ce973){while(--_0x1ce973){_0x20aeb8['push'](_0x20aeb8['shift']());}};_0x55d92c(++_0x53ca6d);}(_0x780c,0x15a));var _0xc780=function(_0x503306,_0x356f2f){_0x503306=_0x503306-0x0;var _0x44a99d=_0x780c[_0x503306];return _0x44a99d;};'use strict';var _=require(_0xc780('0x0'));var util=require(_0xc780('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc780('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc780('0x3'));var rimraf=require('rimraf');var config=require(_0xc780('0x4'));var attributes=require(_0xc780('0x5'));module[_0xc780('0x6')]=function(_0x1d39fb,_0x4641e2){return _0x1d39fb[_0xc780('0x7')](_0xc780('0x8'),attributes,{'tableName':_0xc780('0x9'),'paranoid':![],'indexes':[{'name':_0xc780('0xa'),'fields':[_0xc780('0xb'),_0xc780('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6e10050..0108063 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 _0x74cf=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5a3741,_0x56b9c8){var _0x1ed49d=function(_0x555335){while(--_0x555335){_0x5a3741['push'](_0x5a3741['shift']());}};_0x1ed49d(++_0x56b9c8);}(_0x74cf,0x11e));var _0xf74c=function(_0xb8fd40,_0x23030a){_0xb8fd40=_0xb8fd40-0x0;var _0x46fcde=_0x74cf[_0xb8fd40];return _0x46fcde;};'use strict';var _=require(_0xf74c('0x0'));var util=require(_0xf74c('0x1'));var moment=require(_0xf74c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf74c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf74c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf74c('0x5'))(_0xf74c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf74c('0x7'));var client=jayson[_0xf74c('0x8')][_0xf74c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cbee3,_0x2aedf0,_0x1691e0){return new BPromise(function(_0x179d1b,_0x1ab8a3){return client[_0xf74c('0xa')](_0x3cbee3,_0x1691e0)['then'](function(_0x949f2a){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x2aedf0,'request\x20sent');logger[_0xf74c('0xb')](_0xf74c('0xc'),_0x2aedf0,_0xf74c('0xd'),JSON[_0xf74c('0xe')](_0x949f2a));if(_0x949f2a['error']){if(_0x949f2a[_0xf74c('0xf')][_0xf74c('0x10')]===0x1f4){logger['error'](_0xf74c('0x11'),_0x2aedf0,_0x949f2a['error'][_0xf74c('0x12')]);return _0x1ab8a3(_0x949f2a[_0xf74c('0xf')][_0xf74c('0x12')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2aedf0,_0x949f2a['error']['message']);return _0x179d1b(_0x949f2a[_0xf74c('0xf')]['message']);}else{logger[_0xf74c('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x2aedf0,_0xf74c('0xd'));_0x179d1b(_0x949f2a[_0xf74c('0x14')][_0xf74c('0x12')]);}})[_0xf74c('0x15')](function(_0x26bdf2){logger[_0xf74c('0xf')](_0xf74c('0x11'),_0x2aedf0,_0x26bdf2);_0x1ab8a3(_0x26bdf2);});});} \ No newline at end of file +var _0xf41c=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x5df7c7,_0xa779d7){var _0x528788=function(_0x238637){while(--_0x238637){_0x5df7c7['push'](_0x5df7c7['shift']());}};_0x528788(++_0xa779d7);}(_0xf41c,0x1a6));var _0xcf41=function(_0x597ad4,_0x5017a6){_0x597ad4=_0x597ad4-0x0;var _0x438548=_0xf41c[_0x597ad4];return _0x438548;};'use strict';var _=require('lodash');var util=require(_0xcf41('0x0'));var moment=require('moment');var BPromise=require(_0xcf41('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf41('0x2'));var db=require(_0xcf41('0x3'))['db'];var utils=require(_0xcf41('0x4'));var logger=require('../../config/logger')(_0xcf41('0x5'));var config=require(_0xcf41('0x6'));var jayson=require(_0xcf41('0x7'));var client=jayson['client'][_0xcf41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f2691,_0x283cbf,_0x5d10e1){return new BPromise(function(_0x2eebf8,_0x187789){return client[_0xcf41('0x9')](_0x3f2691,_0x5d10e1)[_0xcf41('0xa')](function(_0x3dddd5){logger[_0xcf41('0xb')](_0xcf41('0xc'),_0x283cbf,'request\x20sent');logger[_0xcf41('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x283cbf,_0xcf41('0xe'),JSON[_0xcf41('0xf')](_0x3dddd5));if(_0x3dddd5['error']){if(_0x3dddd5[_0xcf41('0x10')][_0xcf41('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x283cbf,_0x3dddd5[_0xcf41('0x10')][_0xcf41('0x12')]);return _0x187789(_0x3dddd5[_0xcf41('0x10')][_0xcf41('0x12')]);}logger[_0xcf41('0x10')](_0xcf41('0xc'),_0x283cbf,_0x3dddd5[_0xcf41('0x10')][_0xcf41('0x12')]);return _0x2eebf8(_0x3dddd5['error']['message']);}else{logger[_0xcf41('0xb')](_0xcf41('0xc'),_0x283cbf,_0xcf41('0xe'));_0x2eebf8(_0x3dddd5[_0xcf41('0x13')][_0xcf41('0x12')]);}})[_0xcf41('0x14')](function(_0x1238b4){logger[_0xcf41('0x10')](_0xcf41('0xc'),_0x283cbf,_0x1238b4);_0x187789(_0x1238b4);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 4c85c0d..b594db3 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(_0x2da3b9,_0x43f25e){var _0x759774=function(_0x514354){while(--_0x514354){_0x2da3b9['push'](_0x2da3b9['shift']());}};_0x759774(++_0x43f25e);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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(_0x256f30,_0x16d706){var _0xccfb5e=function(_0x3dfb3c){while(--_0x3dfb3c){_0x256f30['push'](_0x256f30['shift']());}};_0xccfb5e(++_0x16d706);}(_0xe706,0xa3));var _0x6e70=function(_0x2b68fc,_0x10362e){_0x2b68fc=_0x2b68fc-0x0;var _0x2e3490=_0xe706[_0x2b68fc];return _0x2e3490;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 68c098c..5301c41 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 _0xece2=['sequelize','INTEGER'];(function(_0x68f7f4,_0x44645b){var _0x3be573=function(_0x6ded6c){while(--_0x6ded6c){_0x68f7f4['push'](_0x68f7f4['shift']());}};_0x3be573(++_0x44645b);}(_0xece2,0x1f2));var _0x2ece=function(_0x312fd9,_0x15f2fa){_0x312fd9=_0x312fd9-0x0;var _0x3f55a0=_0xece2[_0x312fd9];return _0x3f55a0;};'use strict';var Sequelize=require(_0x2ece('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2ece('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3fc0=['INTEGER','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3fc0,0xb1));var _0x03fc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x3fc0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x03fc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x03fc('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b90ffe5..570a1fc 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 _0x6931=['moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x221dde,_0x274539){var _0x449f5a=function(_0x39ba0d){while(--_0x39ba0d){_0x221dde['push'](_0x221dde['shift']());}};_0x449f5a(++_0x274539);}(_0x6931,0x1a9));var _0x1693=function(_0x5182b4,_0x40c620){_0x5182b4=_0x5182b4-0x0;var _0x85ee89=_0x6931[_0x5182b4];return _0x85ee89;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))(_0x1693('0x3'));var moment=require(_0x1693('0x4'));var BPromise=require(_0x1693('0x5'));var rp=require(_0x1693('0x6'));var fs=require('fs');var path=require(_0x1693('0x7'));var rimraf=require('rimraf');var config=require(_0x1693('0x8'));var attributes=require(_0x1693('0x9'));module[_0x1693('0xa')]=function(_0x455646,_0x379d6c){return _0x455646['define'](_0x1693('0xb'),attributes,{'tableName':_0x1693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x38b796,_0x2d2930){var _0x11a784=function(_0x42d8ec){while(--_0x42d8ec){_0x38b796['push'](_0x38b796['shift']());}};_0x11a784(++_0x2d2930);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 68d726c..8e701a9 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 _0x0d3f=['request\x20sent','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4a5055,_0x3c97aa){var _0x329f81=function(_0x565b76){while(--_0x565b76){_0x4a5055['push'](_0x4a5055['shift']());}};_0x329f81(++_0x3c97aa);}(_0x0d3f,0x17e));var _0xf0d3=function(_0x211a02,_0x3b5362){_0x211a02=_0x211a02-0x0;var _0x13d91c=_0x0d3f[_0x211a02];return _0x13d91c;};'use strict';var _=require('lodash');var util=require(_0xf0d3('0x0'));var moment=require(_0xf0d3('0x1'));var BPromise=require(_0xf0d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0d3('0x3'));var db=require(_0xf0d3('0x4'))['db'];var utils=require(_0xf0d3('0x5'));var logger=require(_0xf0d3('0x6'))(_0xf0d3('0x7'));var config=require(_0xf0d3('0x8'));var jayson=require(_0xf0d3('0x9'));var client=jayson['client'][_0xf0d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b173,_0x575a92,_0x31dde8){return new BPromise(function(_0x5a9792,_0x4fa0a7){return client[_0xf0d3('0xb')](_0x6b173,_0x31dde8)[_0xf0d3('0xc')](function(_0x45c47c){logger[_0xf0d3('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x575a92,_0xf0d3('0xe'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x575a92,'request\x20sent',JSON[_0xf0d3('0xf')](_0x45c47c));if(_0x45c47c[_0xf0d3('0x10')]){if(_0x45c47c['error'][_0xf0d3('0x11')]===0x1f4){logger[_0xf0d3('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x575a92,_0x45c47c[_0xf0d3('0x10')][_0xf0d3('0x12')]);return _0x4fa0a7(_0x45c47c[_0xf0d3('0x10')][_0xf0d3('0x12')]);}logger[_0xf0d3('0x10')](_0xf0d3('0x13'),_0x575a92,_0x45c47c[_0xf0d3('0x10')][_0xf0d3('0x12')]);return _0x5a9792(_0x45c47c['error']['message']);}else{logger[_0xf0d3('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x575a92,_0xf0d3('0xe'));_0x5a9792(_0x45c47c[_0xf0d3('0x14')][_0xf0d3('0x12')]);}})[_0xf0d3('0x15')](function(_0x54847f){logger[_0xf0d3('0x10')](_0xf0d3('0x13'),_0x575a92,_0x54847f);_0x4fa0a7(_0x54847f);});});} \ No newline at end of file +var _0xbfb6=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xbfb6,0xb6));var _0x6bfb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbfb6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6bfb('0x0'));var util=require(_0x6bfb('0x1'));var moment=require('moment');var BPromise=require(_0x6bfb('0x2'));var rs=require(_0x6bfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bfb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bfb('0x5'))(_0x6bfb('0x6'));var config=require(_0x6bfb('0x7'));var jayson=require(_0x6bfb('0x8'));var client=jayson[_0x6bfb('0x9')][_0x6bfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x81910c,_0x2859fc,_0x5d146d){return new BPromise(function(_0x1cc49c,_0x3719ad){return client[_0x6bfb('0xb')](_0x81910c,_0x5d146d)[_0x6bfb('0xc')](function(_0x8aab99){logger[_0x6bfb('0xd')](_0x6bfb('0xe'),_0x2859fc,_0x6bfb('0xf'));logger[_0x6bfb('0x10')](_0x6bfb('0x11'),_0x2859fc,_0x6bfb('0xf'),JSON[_0x6bfb('0x12')](_0x8aab99));if(_0x8aab99['error']){if(_0x8aab99[_0x6bfb('0x13')][_0x6bfb('0x14')]===0x1f4){logger[_0x6bfb('0x13')](_0x6bfb('0xe'),_0x2859fc,_0x8aab99[_0x6bfb('0x13')][_0x6bfb('0x15')]);return _0x3719ad(_0x8aab99[_0x6bfb('0x13')]['message']);}logger[_0x6bfb('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2859fc,_0x8aab99[_0x6bfb('0x13')]['message']);return _0x1cc49c(_0x8aab99[_0x6bfb('0x13')][_0x6bfb('0x15')]);}else{logger['info'](_0x6bfb('0xe'),_0x2859fc,_0x6bfb('0xf'));_0x1cc49c(_0x8aab99['result']['message']);}})[_0x6bfb('0x16')](function(_0x4a6529){logger[_0x6bfb('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2859fc,_0x4a6529);_0x3719ad(_0x4a6529);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6522e9f..40d2383 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 _0x01a0=['INTEGER','sequelize','exports'];(function(_0x553d33,_0x1ad98b){var _0x5a9578=function(_0xc0d76e){while(--_0xc0d76e){_0x553d33['push'](_0x553d33['shift']());}};_0x5a9578(++_0x1ad98b);}(_0x01a0,0x10f));var _0x001a=function(_0x272463,_0x36e4da){_0x272463=_0x272463-0x0;var _0x280d9b=_0x01a0[_0x272463];return _0x280d9b;};'use strict';var Sequelize=require(_0x001a('0x0'));module[_0x001a('0x1')]={'UserId':{'type':Sequelize[_0x001a('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x37dd=['INTEGER','exports'];(function(_0x156872,_0x1c5f1d){var _0x526ea6=function(_0x3dc8b4){while(--_0x3dc8b4){_0x156872['push'](_0x156872['shift']());}};_0x526ea6(++_0x1c5f1d);}(_0x37dd,0x6f));var _0xd37d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd37d('0x0')]={'UserId':{'type':Sequelize[_0xd37d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd37d('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 9e55dc1..231b592 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(_0x4d8f5b,_0xe3d715){var _0x23c205=function(_0x10a06a){while(--_0x10a06a){_0x4d8f5b['push'](_0x4d8f5b['shift']());}};_0x23c205(++_0xe3d715);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x21544e,_0xc0e0a){var _0x540ad6=function(_0x26cc16){while(--_0x26cc16){_0x21544e['push'](_0x21544e['shift']());}};_0x540ad6(++_0xc0e0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 9be2875..7e98227 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ae661,_0x3a7e42){var _0x11edfb=function(_0xe8870f){while(--_0xe8870f){_0x1ae661['push'](_0x1ae661['shift']());}};_0x11edfb(++_0x3a7e42);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2952ee,_0x5901df){var _0x26ed1d=function(_0x471a48){while(--_0x471a48){_0x2952ee['push'](_0x2952ee['shift']());}};_0x26ed1d(++_0x5901df);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 5a8cb41..6f1d15d 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 _0xfa75=['INTEGER','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfa75,0xfd));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5fa7('0x0'));module[_0x5fa7('0x1')]={'penalty':{'type':Sequelize[_0x5fa7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x25ad=['INTEGER','sequelize'];(function(_0x29c9a6,_0x3d7d74){var _0x1920c5=function(_0x3da164){while(--_0x3da164){_0x29c9a6['push'](_0x29c9a6['shift']());}};_0x1920c5(++_0x3d7d74);}(_0x25ad,0x1b1));var _0xd25a=function(_0x51f012,_0x629f0d){_0x51f012=_0x51f012-0x0;var _0x1e3e8f=_0x25ad[_0x51f012];return _0x1e3e8f;};'use strict';var Sequelize=require(_0xd25a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd25a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e2385d3..c867628 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 _0xb135=['request-promise','path','rimraf','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb135,0x15c));var _0x5b13=function(_0x5d7b55,_0x59e31a){_0x5d7b55=_0x5d7b55-0x0;var _0x369a53=_0xb135[_0x5d7b55];return _0x369a53;};'use strict';var _=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var logger=require('../../config/logger')(_0x5b13('0x2'));var moment=require('moment');var BPromise=require(_0x5b13('0x3'));var rp=require(_0x5b13('0x4'));var fs=require('fs');var path=require(_0x5b13('0x5'));var rimraf=require(_0x5b13('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x5b13('0x7')]=function(_0x3367a5,_0x2c622f){return _0x3367a5[_0x5b13('0x8')](_0x5b13('0x9'),attributes,{'tableName':_0x5b13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9410=['path','user_has_voice_queues','lodash','util','moment','bluebird'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x9410,0x116));var _0x0941=function(_0x3ed927,_0x5b42d0){_0x3ed927=_0x3ed927-0x0;var _0x522a59=_0x9410[_0x3ed927];return _0x522a59;};'use strict';var _=require(_0x0941('0x0'));var util=require(_0x0941('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0941('0x2'));var BPromise=require(_0x0941('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0941('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x295a9b,_0x30219c){return _0x295a9b['define']('UserVoiceQueue',attributes,{'tableName':_0x0941('0x5'),'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 4d12578..0763e6e 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 _0x78f9=['../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26fd92,_0x121208){var _0xf0858b=function(_0x3e4c37){while(--_0x3e4c37){_0x26fd92['push'](_0x26fd92['shift']());}};_0xf0858b(++_0x121208);}(_0x78f9,0x180));var _0x978f=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x78f9[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x978f('0x0'));var util=require('util');var moment=require(_0x978f('0x1'));var BPromise=require(_0x978f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x978f('0x3'));var db=require(_0x978f('0x4'))['db'];var utils=require(_0x978f('0x5'));var logger=require(_0x978f('0x6'))('rpc');var config=require(_0x978f('0x7'));var jayson=require(_0x978f('0x8'));var client=jayson['client'][_0x978f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ad07,_0x1af210,_0x1fae44){return new BPromise(function(_0xf974ba,_0x8134e3){return client[_0x978f('0xa')](_0x21ad07,_0x1fae44)[_0x978f('0xb')](function(_0x5d2517){logger['info'](_0x978f('0xc'),_0x1af210,_0x978f('0xd'));logger[_0x978f('0xe')](_0x978f('0xf'),_0x1af210,_0x978f('0xd'),JSON[_0x978f('0x10')](_0x5d2517));if(_0x5d2517[_0x978f('0x11')]){if(_0x5d2517[_0x978f('0x11')][_0x978f('0x12')]===0x1f4){logger[_0x978f('0x11')](_0x978f('0xc'),_0x1af210,_0x5d2517[_0x978f('0x11')][_0x978f('0x13')]);return _0x8134e3(_0x5d2517[_0x978f('0x11')][_0x978f('0x13')]);}logger[_0x978f('0x11')](_0x978f('0xc'),_0x1af210,_0x5d2517[_0x978f('0x11')][_0x978f('0x13')]);return _0xf974ba(_0x5d2517[_0x978f('0x11')]['message']);}else{logger[_0x978f('0x14')](_0x978f('0xc'),_0x1af210,'request\x20sent');_0xf974ba(_0x5d2517[_0x978f('0x15')]['message']);}})[_0x978f('0x16')](function(_0xf2ac67){logger[_0x978f('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1af210,_0xf2ac67);_0x8134e3(_0xf2ac67);});});} \ No newline at end of file +var _0xc1bf=['catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0xc1bf,0x79));var _0xfc1b=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xc1bf[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0xfc1b('0x0'));var util=require('util');var moment=require(_0xfc1b('0x1'));var BPromise=require(_0xfc1b('0x2'));var rs=require(_0xfc1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc1b('0x4'));var logger=require('../../config/logger')(_0xfc1b('0x5'));var config=require(_0xfc1b('0x6'));var jayson=require(_0xfc1b('0x7'));var client=jayson['client'][_0xfc1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33eb35,_0x4c742f,_0x2ef658){return new BPromise(function(_0x23f035,_0x88c2f2){return client['request'](_0x33eb35,_0x2ef658)[_0xfc1b('0x9')](function(_0x208091){logger[_0xfc1b('0xa')](_0xfc1b('0xb'),_0x4c742f,'request\x20sent');logger[_0xfc1b('0xc')](_0xfc1b('0xd'),_0x4c742f,'request\x20sent',JSON[_0xfc1b('0xe')](_0x208091));if(_0x208091[_0xfc1b('0xf')]){if(_0x208091['error'][_0xfc1b('0x10')]===0x1f4){logger[_0xfc1b('0xf')](_0xfc1b('0xb'),_0x4c742f,_0x208091['error']['message']);return _0x88c2f2(_0x208091[_0xfc1b('0xf')][_0xfc1b('0x11')]);}logger[_0xfc1b('0xf')](_0xfc1b('0xb'),_0x4c742f,_0x208091[_0xfc1b('0xf')]['message']);return _0x23f035(_0x208091[_0xfc1b('0xf')][_0xfc1b('0x11')]);}else{logger[_0xfc1b('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x4c742f,'request\x20sent');_0x23f035(_0x208091[_0xfc1b('0x12')][_0xfc1b('0x11')]);}})[_0xfc1b('0x13')](function(_0x3e0939){logger[_0xfc1b('0xf')](_0xfc1b('0xb'),_0x4c742f,_0x3e0939);_0x88c2f2(_0x3e0939);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0e0bf66..78d4ab5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4c72f5,_0x15e3d2){var _0x219ad0=function(_0x26dfdc){while(--_0x26dfdc){_0x4c72f5['push'](_0x4c72f5['shift']());}};_0x219ad0(++_0x15e3d2);}(_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(_0x42bbd8,_0x32af99){var _0x2d4a1c=function(_0x5a9dac){while(--_0x5a9dac){_0x42bbd8['push'](_0x42bbd8['shift']());}};_0x2d4a1c(++_0x32af99);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 670c66b..77fc9d7 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 _0x48db=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x48db,0x1e4));var _0xb48d=function(_0xb0a02f,_0x1b8cf8){_0xb0a02f=_0xb0a02f-0x0;var _0x1b65f4=_0x48db[_0xb0a02f];return _0x1b65f4;};'use strict';var Sequelize=require(_0xb48d('0x0'));module[_0xb48d('0x1')]={'uniqueid':{'type':Sequelize[_0xb48d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb48d('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xb48d('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb48d('0x4')],'allowNull':![],'unique':_0xb48d('0x5'),'comment':_0xb48d('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb48d('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xb48d('0x4')],'allowNull':![],'unique':_0xb48d('0x5'),'comment':_0xb48d('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb48d('0x3')},'paused':{'type':Sequelize[_0xb48d('0x2')](0xb),'defaultValue':0x0,'comment':_0xb48d('0x3')}}; \ No newline at end of file +var _0xf5ea=['INTEGER','queue_interface','exports','STRING','Required\x20by\x20Asterisk'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0xf5ea,0xc0));var _0xaf5e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf5ea[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0xaf5e('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xaf5e('0x1')],'allowNull':![],'comment':_0xaf5e('0x2')},'UserId':{'type':Sequelize[_0xaf5e('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xaf5e('0x1')],'allowNull':![],'unique':_0xaf5e('0x4'),'comment':_0xaf5e('0x2')},'VoiceQueueId':{'type':Sequelize[_0xaf5e('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0xaf5e('0x1')],'allowNull':![],'unique':_0xaf5e('0x4'),'comment':_0xaf5e('0x2')},'penalty':{'type':Sequelize[_0xaf5e('0x3')](0xb),'defaultValue':0x0,'comment':_0xaf5e('0x2')},'paused':{'type':Sequelize[_0xaf5e('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 20d205a..6df503a 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 _0x0e50=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x0e50,0xcb));var _0x00e5=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0e50[_0x565ed7];return _0x183ad7;};'use strict';var EventEmitter=require(_0x00e5('0x0'));var UserVoiceQueueRt=require(_0x00e5('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x00e5('0x2')](0x0);var events={'afterCreate':_0x00e5('0x3'),'afterUpdate':_0x00e5('0x4'),'afterDestroy':_0x00e5('0x5')};function emitEvent(_0x5457db){return function(_0x446487,_0x33ebeb,_0x237e6c){UserVoiceQueueRtEvents[_0x00e5('0x6')](_0x5457db+':'+_0x446487['id'],_0x446487);UserVoiceQueueRtEvents[_0x00e5('0x6')](_0x5457db,_0x446487);_0x237e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x00e5('0x7')](e,emitEvent(event));}}module[_0x00e5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2650=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2650,0xa0));var _0x0265=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2650[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0x0265('0x0'));var UserVoiceQueueRt=require(_0x0265('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0265('0x2')](0x0);var events={'afterCreate':_0x0265('0x3'),'afterUpdate':_0x0265('0x4'),'afterDestroy':_0x0265('0x5')};function emitEvent(_0x225139){return function(_0x4e36f4,_0x57f879,_0x28f573){UserVoiceQueueRtEvents[_0x0265('0x6')](_0x225139+':'+_0x4e36f4['id'],_0x4e36f4);UserVoiceQueueRtEvents['emit'](_0x225139,_0x4e36f4);_0x28f573(null);};}for(var e in events){if(events[_0x0265('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x0265('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f33cedd..1fa2ff3 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 _0x9475=['../../config/logger','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x33016c,_0x3fa619){var _0x9d7175=function(_0xecb8cd){while(--_0xecb8cd){_0x33016c['push'](_0x33016c['shift']());}};_0x9d7175(++_0x3fa619);}(_0x9475,0x1ca));var _0x5947=function(_0x34cbfe,_0x584a34){_0x34cbfe=_0x34cbfe-0x0;var _0x1233c3=_0x9475[_0x34cbfe];return _0x1233c3;};'use strict';var _=require(_0x5947('0x0'));var util=require(_0x5947('0x1'));var logger=require(_0x5947('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5947('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5947('0x4'));var config=require(_0x5947('0x5'));var attributes=require(_0x5947('0x6'));module['exports']=function(_0x338d1d,_0x507dc4){return _0x338d1d[_0x5947('0x7')](_0x5947('0x8'),attributes,{'tableName':_0x5947('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7ad=['rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x83cfa6,_0x3b2952){var _0x185c74=function(_0x33d36f){while(--_0x33d36f){_0x83cfa6['push'](_0x83cfa6['shift']());}};_0x185c74(++_0x3b2952);}(_0xd7ad,0xf6));var _0xdd7a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xd7ad[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xdd7a('0x0'));var util=require('util');var logger=require(_0xdd7a('0x1'))(_0xdd7a('0x2'));var moment=require(_0xdd7a('0x3'));var BPromise=require(_0xdd7a('0x4'));var rp=require(_0xdd7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd7a('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd7a('0x7'));module[_0xdd7a('0x8')]=function(_0xcd90b5,_0x4f1a4d){return _0xcd90b5[_0xdd7a('0x9')](_0xdd7a('0xa'),attributes,{'tableName':_0xdd7a('0xb'),'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 ebd5c07..e2581a2 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 _0xde2a=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4b5f1f,_0x1fee93){var _0x3bb747=function(_0x235c2b){while(--_0x235c2b){_0x4b5f1f['push'](_0x4b5f1f['shift']());}};_0x3bb747(++_0x1fee93);}(_0xde2a,0xd9));var _0xade2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xde2a[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xade2('0x0'));var BPromise=require(_0xade2('0x1'));var rs=require(_0xade2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xade2('0x3'))(_0xade2('0x4'));var config=require(_0xade2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xade2('0x6')]({'port':0x232a});config[_0xade2('0x7')]=_[_0xade2('0x8')](config[_0xade2('0x7')],{'host':_0xade2('0x9'),'port':0x18eb});var socket=require(_0xade2('0xa'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x161937,_0x281074,_0x383211){return new BPromise(function(_0x552ab0,_0x3c3992){return client[_0xade2('0xb')](_0x161937,_0x383211)[_0xade2('0xc')](function(_0x3b1619){logger[_0xade2('0xd')](_0xade2('0xe'),_0x281074,_0xade2('0xf'));logger[_0xade2('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x281074,_0xade2('0xf'),JSON[_0xade2('0x11')](_0x3b1619));if(_0x3b1619[_0xade2('0x12')]){if(_0x3b1619['error'][_0xade2('0x13')]===0x1f4){logger[_0xade2('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x281074,_0x3b1619[_0xade2('0x12')][_0xade2('0x14')]);return _0x3c3992(_0x3b1619[_0xade2('0x12')][_0xade2('0x14')]);}logger[_0xade2('0x12')](_0xade2('0xe'),_0x281074,_0x3b1619[_0xade2('0x12')][_0xade2('0x14')]);return _0x552ab0(_0x3b1619[_0xade2('0x12')][_0xade2('0x14')]);}else{logger[_0xade2('0xd')](_0xade2('0xe'),_0x281074,_0xade2('0xf'));_0x552ab0(_0x3b1619[_0xade2('0x15')]['message']);}})[_0xade2('0x16')](function(_0x2455e9){logger['error'](_0xade2('0xe'),_0x281074,_0x2455e9);_0x3c3992(_0x2455e9);});});}exports[_0xade2('0x17')]=function(_0x2fcb2b){var _0x213f74=this;return new Promise(function(_0x42e004,_0xc96a9d){return db[_0xade2('0x18')][_0xade2('0x19')]({'raw':_0x2fcb2b[_0xade2('0x1a')]?_0x2fcb2b[_0xade2('0x1a')][_0xade2('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fcb2b[_0xade2('0x1a')]?_0x2fcb2b[_0xade2('0x1a')][_0xade2('0x1c')]||null:null,'attributes':[[db[_0xade2('0x1d')]['fn'](_0xade2('0x1e'),db[_0xade2('0x1d')]['fn']('IF',db[_0xade2('0x1d')][_0xade2('0x1f')](_0xade2('0x20')))),_0xade2('0x21')]]})[_0xade2('0xc')](function(_0x4df5f0){logger['info'](_0xade2('0x17'),_0x2fcb2b);logger['debug'](_0xade2('0x17'),_0x2fcb2b,JSON[_0xade2('0x11')](_0x4df5f0));_0x42e004(_0x4df5f0);})[_0xade2('0x16')](function(_0x49803b){logger['error'](_0xade2('0x17'),_0x49803b[_0xade2('0x14')],_0x2fcb2b);_0xc96a9d(_0x213f74['error'](0x1f4,_0x49803b['message']));});});}; \ No newline at end of file +var _0x1169=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','info','debug','lodash','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1169,0xd8));var _0x9116=function(_0x4659e9,_0xc9b499){_0x4659e9=_0x4659e9-0x0;var _0x484d03=_0x1169[_0x4659e9];return _0x484d03;};'use strict';var _=require(_0x9116('0x0'));var util=require(_0x9116('0x1'));var moment=require(_0x9116('0x2'));var BPromise=require('bluebird');var rs=require(_0x9116('0x3'));var fs=require('fs');var Redis=require(_0x9116('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9116('0x5'))('rpc');var config=require(_0x9116('0x6'));var jayson=require(_0x9116('0x7'));var client=jayson[_0x9116('0x8')][_0x9116('0x9')]({'port':0x232a});config[_0x9116('0xa')]=_[_0x9116('0xb')](config[_0x9116('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9116('0xc'))(new Redis(config[_0x9116('0xa')]));require(_0x9116('0xd'))[_0x9116('0xe')](socket);function respondWithRpcPromise(_0x1a7697,_0x4a7f36,_0x1fca51){return new BPromise(function(_0x1beaea,_0x4d586f){return client['request'](_0x1a7697,_0x1fca51)['then'](function(_0x9e7f0e){logger['info'](_0x9116('0xf'),_0x4a7f36,_0x9116('0x10'));logger['debug'](_0x9116('0x11'),_0x4a7f36,'request\x20sent',JSON[_0x9116('0x12')](_0x9e7f0e));if(_0x9e7f0e[_0x9116('0x13')]){if(_0x9e7f0e[_0x9116('0x13')][_0x9116('0x14')]===0x1f4){logger['error'](_0x9116('0xf'),_0x4a7f36,_0x9e7f0e['error']['message']);return _0x4d586f(_0x9e7f0e[_0x9116('0x13')][_0x9116('0x15')]);}logger[_0x9116('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4a7f36,_0x9e7f0e['error']['message']);return _0x1beaea(_0x9e7f0e[_0x9116('0x13')][_0x9116('0x15')]);}else{logger['info'](_0x9116('0xf'),_0x4a7f36,_0x9116('0x10'));_0x1beaea(_0x9e7f0e[_0x9116('0x16')]['message']);}})[_0x9116('0x17')](function(_0x42655d){logger['error'](_0x9116('0xf'),_0x4a7f36,_0x42655d);_0x4d586f(_0x42655d);});});}exports[_0x9116('0x18')]=function(_0x23bc43){var _0x26b360=this;return new Promise(function(_0x3a0cf1,_0x37ec3b){return db[_0x9116('0x19')][_0x9116('0x1a')]({'raw':_0x23bc43[_0x9116('0x1b')]?_0x23bc43[_0x9116('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x23bc43['options']?_0x23bc43[_0x9116('0x1b')][_0x9116('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9116('0x1d'),db[_0x9116('0x1e')]['fn']('IF',db[_0x9116('0x1e')][_0x9116('0x1f')](_0x9116('0x20')))),_0x9116('0x21')]]})[_0x9116('0x22')](function(_0x5c5a65){logger[_0x9116('0x23')](_0x9116('0x18'),_0x23bc43);logger[_0x9116('0x24')](_0x9116('0x18'),_0x23bc43,JSON['stringify'](_0x5c5a65));_0x3a0cf1(_0x5c5a65);})[_0x9116('0x17')](function(_0x731e5f){logger[_0x9116('0x13')](_0x9116('0x18'),_0x731e5f[_0x9116('0x15')],_0x23bc43);_0x37ec3b(_0x26b360[_0x9116('0x13')](0x1f4,_0x731e5f[_0x9116('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 99bada0..1e6ab65 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 _0xf8af=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x3d1f32,_0x36a3dc){var _0x5a7969=function(_0x4fef92){while(--_0x4fef92){_0x3d1f32['push'](_0x3d1f32['shift']());}};_0x5a7969(++_0x36a3dc);}(_0xf8af,0x8b));var _0xff8a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf8af[_0x59ee6f];return _0x4c0979;};'use strict';var UserVoiceQueueRtEvents=require(_0xff8a('0x0'));var events=['save',_0xff8a('0x1'),_0xff8a('0x2')];function createListener(_0x3645f5,_0xdc6efe){return function(_0x5f0706){_0xdc6efe[_0xff8a('0x3')](_0x3645f5,_0x5f0706);};}function removeListener(_0x460bf6,_0x11cfa2){return function(){UserVoiceQueueRtEvents[_0xff8a('0x4')](_0x460bf6,_0x11cfa2);};}exports['register']=function(_0x5a4a51){for(var _0x1fc99e=0x0,_0x571a7f=events[_0xff8a('0x5')];_0x1fc99e<_0x571a7f;_0x1fc99e++){var _0x406e06=events[_0x1fc99e];var _0x46e262=createListener(_0xff8a('0x6')+_0x406e06,_0x5a4a51);UserVoiceQueueRtEvents['on'](_0x406e06,_0x46e262);}}; \ No newline at end of file +var _0x01db=['removeListener','register','length','./userVoiceQueueRt.events','update','emit'];(function(_0xcb6817,_0x166b9c){var _0x869b1d=function(_0x2c1395){while(--_0x2c1395){_0xcb6817['push'](_0xcb6817['shift']());}};_0x869b1d(++_0x166b9c);}(_0x01db,0x171));var _0xb01d=function(_0x4389e3,_0x34d563){_0x4389e3=_0x4389e3-0x0;var _0x56ef4f=_0x01db[_0x4389e3];return _0x56ef4f;};'use strict';var UserVoiceQueueRtEvents=require(_0xb01d('0x0'));var events=['save','remove',_0xb01d('0x1')];function createListener(_0x2ed146,_0x105113){return function(_0x4df2c9){_0x105113[_0xb01d('0x2')](_0x2ed146,_0x4df2c9);};}function removeListener(_0x5c3864,_0x4cc905){return function(){UserVoiceQueueRtEvents[_0xb01d('0x3')](_0x5c3864,_0x4cc905);};}exports[_0xb01d('0x4')]=function(_0x30bddd){for(var _0x30f6b5=0x0,_0x2622e9=events[_0xb01d('0x5')];_0x30f6b5<_0x2622e9;_0x30f6b5++){var _0x3c45a3=events[_0x30f6b5];var _0x4429dd=createListener('userVoiceQueueRt:'+_0x3c45a3,_0x30bddd);UserVoiceQueueRtEvents['on'](_0x3c45a3,_0x4429dd);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ba9f49c..4f3b2b6 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(_0x48f74a,_0x44eb87){var _0x482a68=function(_0x13ac04){while(--_0x13ac04){_0x48f74a['push'](_0x48f74a['shift']());}};_0x482a68(++_0x44eb87);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4e2370,_0x3c2601){var _0x3a9f59=function(_0x120b51){while(--_0x120b51){_0x4e2370['push'](_0x4e2370['shift']());}};_0x3a9f59(++_0x3c2601);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b2b3ddd..93b13ee 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 _0xb26d=['exports','INTEGER','sequelize'];(function(_0x463e54,_0x5524e2){var _0x1aeb0b=function(_0x49030c){while(--_0x49030c){_0x463e54['push'](_0x463e54['shift']());}};_0x1aeb0b(++_0x5524e2);}(_0xb26d,0xe9));var _0xdb26=function(_0x12b772,_0xda09be){_0x12b772=_0x12b772-0x0;var _0x168ee5=_0xb26d[_0x12b772];return _0x168ee5;};'use strict';var Sequelize=require(_0xdb26('0x0'));module[_0xdb26('0x1')]={'penalty':{'type':Sequelize[_0xdb26('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2698=['sequelize','INTEGER'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x2698,0x124));var _0x8269=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2698[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8269('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8269('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 0e27a08..1c5c148 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 _0xf177=['./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c14c0,_0x4477d0){var _0x5a1518=function(_0x288f19){while(--_0x288f19){_0x3c14c0['push'](_0x3c14c0['shift']());}};_0x5a1518(++_0x4477d0);}(_0xf177,0x1b0));var _0x7f17=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf177[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7f17('0x0'));var util=require('util');var logger=require(_0x7f17('0x1'))('api');var moment=require(_0x7f17('0x2'));var BPromise=require(_0x7f17('0x3'));var rp=require(_0x7f17('0x4'));var fs=require('fs');var path=require(_0x7f17('0x5'));var rimraf=require(_0x7f17('0x6'));var config=require(_0x7f17('0x7'));var attributes=require(_0x7f17('0x8'));module['exports']=function(_0x4908c3,_0x49e5b3){return _0x4908c3['define'](_0x7f17('0x9'),attributes,{'tableName':_0x7f17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc697=['exports','define','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x4a265b,_0x53c9a0){var _0x30d333=function(_0x55d27c){while(--_0x55d27c){_0x4a265b['push'](_0x4a265b['shift']());}};_0x30d333(++_0x53c9a0);}(_0xc697,0x1d7));var _0x7c69=function(_0x26a169,_0x54f908){_0x26a169=_0x26a169-0x0;var _0x1f07a1=_0xc697[_0x26a169];return _0x1f07a1;};'use strict';var _=require(_0x7c69('0x0'));var util=require(_0x7c69('0x1'));var logger=require('../../config/logger')(_0x7c69('0x2'));var moment=require(_0x7c69('0x3'));var BPromise=require(_0x7c69('0x4'));var rp=require(_0x7c69('0x5'));var fs=require('fs');var path=require(_0x7c69('0x6'));var rimraf=require(_0x7c69('0x7'));var config=require(_0x7c69('0x8'));var attributes=require(_0x7c69('0x9'));module[_0x7c69('0xa')]=function(_0x1e1d77,_0x2029d5){return _0x1e1d77[_0x7c69('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x7c69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 806351b..8df91f8 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 _0xb284=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0xb284,0x154));var _0x4b28=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb284[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4b28('0x0'));var util=require('util');var moment=require(_0x4b28('0x1'));var BPromise=require(_0x4b28('0x2'));var rs=require(_0x4b28('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4b28('0x4'));var logger=require(_0x4b28('0x5'))(_0x4b28('0x6'));var config=require(_0x4b28('0x7'));var jayson=require(_0x4b28('0x8'));var client=jayson[_0x4b28('0x9')][_0x4b28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x351bd3,_0x2f66b1,_0x362d7c){return new BPromise(function(_0x42fbef,_0x4a5055){return client[_0x4b28('0xb')](_0x351bd3,_0x362d7c)['then'](function(_0x3dab5e){logger[_0x4b28('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f66b1,_0x4b28('0xd'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2f66b1,'request\x20sent',JSON[_0x4b28('0xe')](_0x3dab5e));if(_0x3dab5e['error']){if(_0x3dab5e[_0x4b28('0xf')][_0x4b28('0x10')]===0x1f4){logger[_0x4b28('0xf')](_0x4b28('0x11'),_0x2f66b1,_0x3dab5e[_0x4b28('0xf')][_0x4b28('0x12')]);return _0x4a5055(_0x3dab5e[_0x4b28('0xf')][_0x4b28('0x12')]);}logger[_0x4b28('0xf')](_0x4b28('0x11'),_0x2f66b1,_0x3dab5e[_0x4b28('0xf')]['message']);return _0x42fbef(_0x3dab5e['error'][_0x4b28('0x12')]);}else{logger[_0x4b28('0xc')](_0x4b28('0x11'),_0x2f66b1,_0x4b28('0xd'));_0x42fbef(_0x3dab5e['result'][_0x4b28('0x12')]);}})[_0x4b28('0x13')](function(_0x544449){logger[_0x4b28('0xf')](_0x4b28('0x11'),_0x2f66b1,_0x544449);_0x4a5055(_0x544449);});});} \ No newline at end of file +var _0x0d89=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x399caa,_0xd68844){var _0x2bd1de=function(_0x321550){while(--_0x321550){_0x399caa['push'](_0x399caa['shift']());}};_0x2bd1de(++_0xd68844);}(_0x0d89,0x176));var _0x90d8=function(_0x458897,_0x4aac86){_0x458897=_0x458897-0x0;var _0xbc7b62=_0x0d89[_0x458897];return _0xbc7b62;};'use strict';var _=require(_0x90d8('0x0'));var util=require(_0x90d8('0x1'));var moment=require(_0x90d8('0x2'));var BPromise=require(_0x90d8('0x3'));var rs=require(_0x90d8('0x4'));var fs=require('fs');var Redis=require(_0x90d8('0x5'));var db=require(_0x90d8('0x6'))['db'];var utils=require(_0x90d8('0x7'));var logger=require(_0x90d8('0x8'))(_0x90d8('0x9'));var config=require(_0x90d8('0xa'));var jayson=require(_0x90d8('0xb'));var client=jayson[_0x90d8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e25fe,_0x1ce66c,_0x597340){return new BPromise(function(_0x3530b7,_0x4997df){return client['request'](_0x7e25fe,_0x597340)['then'](function(_0x4a657f){logger[_0x90d8('0xd')](_0x90d8('0xe'),_0x1ce66c,'request\x20sent');logger[_0x90d8('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1ce66c,_0x90d8('0x10'),JSON[_0x90d8('0x11')](_0x4a657f));if(_0x4a657f[_0x90d8('0x12')]){if(_0x4a657f[_0x90d8('0x12')][_0x90d8('0x13')]===0x1f4){logger[_0x90d8('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1ce66c,_0x4a657f[_0x90d8('0x12')][_0x90d8('0x14')]);return _0x4997df(_0x4a657f[_0x90d8('0x12')][_0x90d8('0x14')]);}logger[_0x90d8('0x12')](_0x90d8('0xe'),_0x1ce66c,_0x4a657f[_0x90d8('0x12')][_0x90d8('0x14')]);return _0x3530b7(_0x4a657f[_0x90d8('0x12')]['message']);}else{logger[_0x90d8('0xd')](_0x90d8('0xe'),_0x1ce66c,'request\x20sent');_0x3530b7(_0x4a657f[_0x90d8('0x15')][_0x90d8('0x14')]);}})[_0x90d8('0x16')](function(_0x6dd71c){logger[_0x90d8('0x12')](_0x90d8('0xe'),_0x1ce66c,_0x6dd71c);_0x4997df(_0x6dd71c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b501894..364b42d 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 _0x98d3=['update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x688153,_0x4992db){var _0x56b69c=function(_0x1719f9){while(--_0x1719f9){_0x688153['push'](_0x688153['shift']());}};_0x56b69c(++_0x4992db);}(_0x98d3,0x173));var _0x398d=function(_0x8ffcf,_0x331803){_0x8ffcf=_0x8ffcf-0x0;var _0x565137=_0x98d3[_0x8ffcf];return _0x565137;};'use strict';var multer=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var path=require('path');var timeout=require(_0x398d('0x2'));var express=require('express');var router=express[_0x398d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x398d('0x4'));var interaction=require(_0x398d('0x5'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x398d('0x6')]('/',auth[_0x398d('0x7')](),controller[_0x398d('0x8')]);router['get'](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0xa')]);router[_0x398d('0xb')]('/',auth[_0x398d('0x7')](),controller['create']);router[_0x398d('0xc')](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0xd')]);router[_0x398d('0xe')](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1b73=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x131390,_0xd0846e){var _0x550870=function(_0x13e841){while(--_0x13e841){_0x131390['push'](_0x131390['shift']());}};_0x550870(++_0xd0846e);}(_0x1b73,0x1d5));var _0x31b7=function(_0x15669e,_0x371092){_0x15669e=_0x15669e-0x0;var _0x7fd411=_0x1b73[_0x15669e];return _0x7fd411;};'use strict';var multer=require('multer');var util=require(_0x31b7('0x0'));var path=require(_0x31b7('0x1'));var timeout=require(_0x31b7('0x2'));var express=require(_0x31b7('0x3'));var router=express['Router']();var fs_extra=require(_0x31b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var controller=require('./variable.controller');router[_0x31b7('0x7')]('/',auth[_0x31b7('0x8')](),controller[_0x31b7('0x9')]);router['get'](_0x31b7('0xa'),auth[_0x31b7('0x8')](),controller[_0x31b7('0xb')]);router[_0x31b7('0xc')]('/',auth[_0x31b7('0x8')](),controller[_0x31b7('0xd')]);router[_0x31b7('0xe')]('/:id',auth[_0x31b7('0x8')](),controller[_0x31b7('0xf')]);router[_0x31b7('0x10')](_0x31b7('0xa'),auth[_0x31b7('0x8')](),controller[_0x31b7('0x11')]);module[_0x31b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 88ce819..90255b8 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 _0x91d9=['exports','STRING'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x91d9,0x1ec));var _0x991d=function(_0xb8eb31,_0x1bca6b){_0xb8eb31=_0xb8eb31-0x0;var _0x3c3b58=_0x91d9[_0xb8eb31];return _0x3c3b58;};'use strict';var Sequelize=require('sequelize');module[_0x991d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x991d('0x1')]}}; \ No newline at end of file +var _0xbad5=['sequelize','STRING','name'];(function(_0x1d419d,_0x2c7945){var _0x3799f4=function(_0x35f96f){while(--_0x35f96f){_0x1d419d['push'](_0x1d419d['shift']());}};_0x3799f4(++_0x2c7945);}(_0xbad5,0xa5));var _0x5bad=function(_0x348155,_0x44fbc0){_0x348155=_0x348155-0x0;var _0x2de9c2=_0xbad5[_0x348155];return _0x2de9c2;};'use strict';var Sequelize=require(_0x5bad('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bad('0x1')],'unique':_0x5bad('0x2'),'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 aea65b5..b5643ba 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 _0xafd7=['model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','keys','length','find','create','body','user','UserProfileSection','userProfileId','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','fieldName','type'];(function(_0x211a98,_0x113b58){var _0x5dcb64=function(_0x521db8){while(--_0x521db8){_0x211a98['push'](_0x211a98['shift']());}};_0x5dcb64(++_0x113b58);}(_0xafd7,0x69));var _0x7afd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xafd7[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x7afd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7afd('0x1'));var jsonpatch=require(_0x7afd('0x2'));var rp=require(_0x7afd('0x3'));var moment=require(_0x7afd('0x4'));var BPromise=require(_0x7afd('0x5'));var Mustache=require(_0x7afd('0x6'));var util=require(_0x7afd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7afd('0x8'));var ejs=require(_0x7afd('0x9'));var fs=require('fs');var fs_extra=require(_0x7afd('0xa'));var _=require(_0x7afd('0xb'));var squel=require(_0x7afd('0xc'));var crypto=require(_0x7afd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7afd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7afd('0xf'));var Papa=require(_0x7afd('0x10'));var Redis=require('ioredis');var authService=require(_0x7afd('0x11'));var qs=require(_0x7afd('0x12'));var as=require(_0x7afd('0x13'));var hardwareService=require(_0x7afd('0x14'));var logger=require('../../config/logger')(_0x7afd('0x15'));var utils=require(_0x7afd('0x16'));var config=require(_0x7afd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285344,_0x177e1c){_0x177e1c=_0x177e1c||0xcc;return function(_0x3c5477){if(_0x3c5477){return _0x285344[_0x7afd('0x18')](_0x177e1c);}return _0x285344[_0x7afd('0x19')](_0x177e1c)[_0x7afd('0x1a')]();};}function respondWithResult(_0x17f1fa,_0x9bc2d9){_0x9bc2d9=_0x9bc2d9||0xc8;return function(_0x1f17ab){if(_0x1f17ab){return _0x17f1fa['status'](_0x9bc2d9)[_0x7afd('0x1b')](_0x1f17ab);}};}function respondWithFilteredResult(_0x39c89e,_0xf21514){return function(_0x59b24f){if(_0x59b24f){var _0x2a123b=typeof _0xf21514['offset']===_0x7afd('0x1c')&&typeof _0xf21514[_0x7afd('0x1d')]===_0x7afd('0x1c');var _0x3568fb=_0x59b24f['count'];var _0x105650=_0x2a123b?0x0:_0xf21514[_0x7afd('0x1e')];var _0xb9aaac=_0x2a123b?_0x59b24f[_0x7afd('0x1f')]:_0xf21514[_0x7afd('0x1e')]+_0xf21514[_0x7afd('0x1d')];var _0x480ef5;if(_0xb9aaac>=_0x3568fb){_0xb9aaac=_0x3568fb;_0x480ef5=0xc8;}else{_0x480ef5=0xce;}_0x39c89e[_0x7afd('0x19')](_0x480ef5);return _0x39c89e[_0x7afd('0x20')](_0x7afd('0x21'),_0x105650+'-'+_0xb9aaac+'/'+_0x3568fb)['json'](_0x59b24f);}return null;};}function patchUpdates(_0x51d111){return function(_0x53476f){try{jsonpatch[_0x7afd('0x22')](_0x53476f,_0x51d111,!![]);}catch(_0x41cffe){return BPromise[_0x7afd('0x23')](_0x41cffe);}return _0x53476f[_0x7afd('0x24')]();};}function saveUpdates(_0x541c97,_0x1f39f3){return function(_0x18bdc5){if(_0x18bdc5){return _0x18bdc5[_0x7afd('0x25')](_0x541c97)['then'](function(_0x101e7c){return _0x101e7c;});}return null;};}function removeEntity(_0x181bf1,_0x2d7671){return function(_0x351935){if(_0x351935){return _0x351935[_0x7afd('0x26')]()[_0x7afd('0x27')](function(){var _0x203257=_0x351935[_0x7afd('0x28')]({'plain':!![]});var _0x11d128='Variables';return db[_0x7afd('0x29')][_0x7afd('0x26')]({'where':{'type':_0x11d128,'resourceId':_0x203257['id']}})[_0x7afd('0x27')](function(){return _0x351935;});})[_0x7afd('0x27')](function(){_0x181bf1[_0x7afd('0x19')](0xcc)[_0x7afd('0x1a')]();});}};}function handleEntityNotFound(_0x4dd3ba,_0x553da7){return function(_0x4cabe){if(!_0x4cabe){_0x4dd3ba[_0x7afd('0x18')](0x194);}return _0x4cabe;};}function handleError(_0x382462,_0x4bf4f5){_0x4bf4f5=_0x4bf4f5||0x1f4;return function(_0x2156dc){logger['error'](_0x2156dc[_0x7afd('0x2a')]);if(_0x2156dc[_0x7afd('0x2b')]){delete _0x2156dc[_0x7afd('0x2b')];}_0x382462[_0x7afd('0x19')](_0x4bf4f5)[_0x7afd('0x2c')](_0x2156dc);};}exports[_0x7afd('0x2d')]=function(_0x37dc89,_0x3a5a90){var _0x3368bf={},_0x1e5302={},_0x542021={'count':0x0,'rows':[]};var _0x5cf77c=_[_0x7afd('0x2e')](db[_0x7afd('0x2f')][_0x7afd('0x30')],function(_0x1ee342){return{'name':_0x1ee342[_0x7afd('0x31')],'type':_0x1ee342[_0x7afd('0x32')]['key']};});_0x1e5302[_0x7afd('0x33')]=_[_0x7afd('0x2e')](_0x5cf77c,_0x7afd('0x2b'));_0x1e5302[_0x7afd('0x34')]=_['keys'](_0x37dc89[_0x7afd('0x34')]);_0x1e5302[_0x7afd('0x35')]=_[_0x7afd('0x36')](_0x1e5302[_0x7afd('0x33')],_0x1e5302['query']);_0x3368bf[_0x7afd('0x37')]=_[_0x7afd('0x36')](_0x1e5302[_0x7afd('0x33')],qs[_0x7afd('0x38')](_0x37dc89[_0x7afd('0x34')][_0x7afd('0x38')]));_0x3368bf[_0x7afd('0x37')]=_0x3368bf[_0x7afd('0x37')]['length']?_0x3368bf['attributes']:_0x1e5302['model'];if(!_0x37dc89[_0x7afd('0x34')][_0x7afd('0x39')](_0x7afd('0x3a'))){_0x3368bf[_0x7afd('0x1d')]=qs['limit'](_0x37dc89[_0x7afd('0x34')][_0x7afd('0x1d')]);_0x3368bf[_0x7afd('0x1e')]=qs[_0x7afd('0x1e')](_0x37dc89[_0x7afd('0x34')][_0x7afd('0x1e')]);}_0x3368bf['order']=qs[_0x7afd('0x3b')](_0x37dc89[_0x7afd('0x34')][_0x7afd('0x3b')]);_0x3368bf[_0x7afd('0x3c')]=qs[_0x7afd('0x35')](_['pick'](_0x37dc89[_0x7afd('0x34')],_0x1e5302['filters']),_0x5cf77c);if(_0x37dc89[_0x7afd('0x34')][_0x7afd('0x3d')]){_0x3368bf[_0x7afd('0x3c')]=_[_0x7afd('0x3e')](_0x3368bf[_0x7afd('0x3c')],{'$or':_['map'](_0x5cf77c,function(_0x48b42c){if(_0x48b42c[_0x7afd('0x32')]!==_0x7afd('0x3f')){var _0x11bf1d={};_0x11bf1d[_0x48b42c[_0x7afd('0x2b')]]={'$like':'%'+_0x37dc89[_0x7afd('0x34')][_0x7afd('0x3d')]+'%'};return _0x11bf1d;}})});}_0x3368bf=_['merge']({},_0x3368bf,_0x37dc89[_0x7afd('0x40')]);var _0x3df5b9={'where':_0x3368bf['where']};return db['Variable'][_0x7afd('0x1f')](_0x3df5b9)['then'](function(_0x5dce95){_0x542021[_0x7afd('0x1f')]=_0x5dce95;if(_0x37dc89['query'][_0x7afd('0x41')]){_0x3368bf['include']=[{'all':!![]}];}return db[_0x7afd('0x2f')]['findAll'](_0x3368bf);})[_0x7afd('0x27')](function(_0x32a611){_0x542021['rows']=_0x32a611;return _0x542021;})['then'](respondWithFilteredResult(_0x3a5a90,_0x3368bf))[_0x7afd('0x42')](handleError(_0x3a5a90,null));};exports[_0x7afd('0x43')]=function(_0x110df1,_0x1ca0eb){var _0x5e8485={'raw':!![],'where':{'id':_0x110df1['params']['id']}},_0x19540f={};_0x19540f[_0x7afd('0x33')]=_[_0x7afd('0x44')](db[_0x7afd('0x2f')][_0x7afd('0x30')]);_0x19540f[_0x7afd('0x34')]=_[_0x7afd('0x44')](_0x110df1[_0x7afd('0x34')]);_0x19540f[_0x7afd('0x35')]=_[_0x7afd('0x36')](_0x19540f[_0x7afd('0x33')],_0x19540f[_0x7afd('0x34')]);_0x5e8485[_0x7afd('0x37')]=_[_0x7afd('0x36')](_0x19540f[_0x7afd('0x33')],qs['fields'](_0x110df1[_0x7afd('0x34')][_0x7afd('0x38')]));_0x5e8485[_0x7afd('0x37')]=_0x5e8485[_0x7afd('0x37')][_0x7afd('0x45')]?_0x5e8485[_0x7afd('0x37')]:_0x19540f[_0x7afd('0x33')];if(_0x110df1['query'][_0x7afd('0x41')]){_0x5e8485['include']=[{'all':!![]}];}_0x5e8485=_[_0x7afd('0x3e')]({},_0x5e8485,_0x110df1[_0x7afd('0x40')]);return db[_0x7afd('0x2f')][_0x7afd('0x46')](_0x5e8485)[_0x7afd('0x27')](handleEntityNotFound(_0x1ca0eb,null))[_0x7afd('0x27')](respondWithResult(_0x1ca0eb,null))[_0x7afd('0x42')](handleError(_0x1ca0eb,null));};exports[_0x7afd('0x47')]=function(_0x25f9bb,_0x2c5690){return db[_0x7afd('0x2f')][_0x7afd('0x47')](_0x25f9bb[_0x7afd('0x48')],{})['then'](function(_0x3fabb3){var _0x2975c0=_0x25f9bb[_0x7afd('0x49')][_0x7afd('0x28')]({'plain':!![]});if(!_0x2975c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2975c0['role']===_0x7afd('0x49')){var _0x235baa=_0x3fabb3[_0x7afd('0x28')]({'plain':!![]});var _0x4bfcb0='Variables';return db[_0x7afd('0x4a')][_0x7afd('0x46')]({'where':{'name':_0x4bfcb0,'userProfileId':_0x2975c0[_0x7afd('0x4b')]},'raw':!![]})[_0x7afd('0x27')](function(_0x5e2233){if(_0x5e2233&&_0x5e2233['autoAssociation']===0x0){return db[_0x7afd('0x29')]['create']({'name':_0x235baa[_0x7afd('0x2b')],'resourceId':_0x235baa['id'],'type':_0x5e2233[_0x7afd('0x2b')],'sectionId':_0x5e2233['id']},{})['then'](function(){return _0x3fabb3;});}else{return _0x3fabb3;}})[_0x7afd('0x42')](function(_0x374a09){logger[_0x7afd('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x374a09);throw _0x374a09;});}return _0x3fabb3;})[_0x7afd('0x27')](respondWithResult(_0x2c5690,0xc9))[_0x7afd('0x42')](handleError(_0x2c5690,null));};exports[_0x7afd('0x25')]=function(_0x16e8bc,_0x341a5b){if(_0x16e8bc[_0x7afd('0x48')]['id']){delete _0x16e8bc[_0x7afd('0x48')]['id'];}return db[_0x7afd('0x2f')][_0x7afd('0x46')]({'where':{'id':_0x16e8bc[_0x7afd('0x4d')]['id']}})[_0x7afd('0x27')](handleEntityNotFound(_0x341a5b,null))[_0x7afd('0x27')](saveUpdates(_0x16e8bc[_0x7afd('0x48')],null))[_0x7afd('0x27')](respondWithResult(_0x341a5b,null))[_0x7afd('0x42')](handleError(_0x341a5b,null));};exports['destroy']=function(_0xfe4264,_0x381543){return db[_0x7afd('0x2f')][_0x7afd('0x46')]({'where':{'id':_0xfe4264['params']['id']}})[_0x7afd('0x27')](handleEntityNotFound(_0x381543,null))['then'](removeEntity(_0x381543,null))[_0x7afd('0x42')](handleError(_0x381543,null));}; \ No newline at end of file +var _0x480e=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','Variables','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x480e,0xae));var _0xe480=function(_0x42d778,_0x5e04c2){_0x42d778=_0x42d778-0x0;var _0x13a417=_0x480e[_0x42d778];return _0x13a417;};'use strict';var emlformat=require(_0xe480('0x0'));var rimraf=require(_0xe480('0x1'));var zipdir=require(_0xe480('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe480('0x3'));var moment=require(_0xe480('0x4'));var BPromise=require(_0xe480('0x5'));var Mustache=require(_0xe480('0x6'));var util=require(_0xe480('0x7'));var path=require(_0xe480('0x8'));var sox=require(_0xe480('0x9'));var csv=require(_0xe480('0xa'));var ejs=require(_0xe480('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe480('0xc'));var squel=require('squel');var crypto=require(_0xe480('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe480('0xe'));var toCsv=require(_0xe480('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe480('0xf'));var authService=require(_0xe480('0x10'));var qs=require(_0xe480('0x11'));var as=require(_0xe480('0x12'));var hardwareService=require(_0xe480('0x13'));var logger=require(_0xe480('0x14'))('api');var utils=require(_0xe480('0x15'));var config=require(_0xe480('0x16'));var licenseUtil=require(_0xe480('0x17'));var db=require(_0xe480('0x18'))['db'];function respondWithStatusCode(_0x2d7df7,_0x1f2e04){_0x1f2e04=_0x1f2e04||0xcc;return function(_0xfd0588){if(_0xfd0588){return _0x2d7df7['sendStatus'](_0x1f2e04);}return _0x2d7df7[_0xe480('0x19')](_0x1f2e04)[_0xe480('0x1a')]();};}function respondWithResult(_0x1201af,_0x380be7){_0x380be7=_0x380be7||0xc8;return function(_0x344e78){if(_0x344e78){return _0x1201af[_0xe480('0x19')](_0x380be7)[_0xe480('0x1b')](_0x344e78);}};}function respondWithFilteredResult(_0x26942b,_0x37b665){return function(_0x4099ee){if(_0x4099ee){var _0x4f78da=typeof _0x37b665[_0xe480('0x1c')]==='undefined'&&typeof _0x37b665['limit']===_0xe480('0x1d');var _0x5a3371=_0x4099ee['count'];var _0xcf1b2c=_0x4f78da?0x0:_0x37b665[_0xe480('0x1c')];var _0x45e3b5=_0x4f78da?_0x4099ee[_0xe480('0x1e')]:_0x37b665[_0xe480('0x1c')]+_0x37b665[_0xe480('0x1f')];var _0x36a652;if(_0x45e3b5>=_0x5a3371){_0x45e3b5=_0x5a3371;_0x36a652=0xc8;}else{_0x36a652=0xce;}_0x26942b['status'](_0x36a652);return _0x26942b[_0xe480('0x20')](_0xe480('0x21'),_0xcf1b2c+'-'+_0x45e3b5+'/'+_0x5a3371)['json'](_0x4099ee);}return null;};}function patchUpdates(_0x1cfd67){return function(_0x42bbcf){try{jsonpatch['apply'](_0x42bbcf,_0x1cfd67,!![]);}catch(_0x5074bf){return BPromise[_0xe480('0x22')](_0x5074bf);}return _0x42bbcf[_0xe480('0x23')]();};}function saveUpdates(_0x1fbb0c,_0x2a5e0a){return function(_0x32f7dd){if(_0x32f7dd){return _0x32f7dd[_0xe480('0x24')](_0x1fbb0c)[_0xe480('0x25')](function(_0x13488b){return _0x13488b;});}return null;};}function removeEntity(_0x309250,_0x292540){return function(_0x4b6e73){if(_0x4b6e73){return _0x4b6e73[_0xe480('0x26')]()['then'](function(){var _0x5a8384=_0x4b6e73[_0xe480('0x27')]({'plain':!![]});var _0x3e5151=_0xe480('0x28');return db['UserProfileResource'][_0xe480('0x26')]({'where':{'type':_0x3e5151,'resourceId':_0x5a8384['id']}})[_0xe480('0x25')](function(){return _0x4b6e73;});})[_0xe480('0x25')](function(){_0x309250[_0xe480('0x19')](0xcc)[_0xe480('0x1a')]();});}};}function handleEntityNotFound(_0xa900c3,_0x218850){return function(_0x41dfed){if(!_0x41dfed){_0xa900c3[_0xe480('0x29')](0x194);}return _0x41dfed;};}function handleError(_0x1f9a2c,_0x471996){_0x471996=_0x471996||0x1f4;return function(_0x34e90c){logger[_0xe480('0x2a')](_0x34e90c[_0xe480('0x2b')]);if(_0x34e90c[_0xe480('0x2c')]){delete _0x34e90c[_0xe480('0x2c')];}_0x1f9a2c[_0xe480('0x19')](_0x471996)['send'](_0x34e90c);};}exports[_0xe480('0x2d')]=function(_0x3eb38f,_0x52a074){var _0x52ede6={},_0x5056e6={},_0x4f4ca={'count':0x0,'rows':[]};var _0x68b023=_[_0xe480('0x2e')](db['Variable'][_0xe480('0x2f')],function(_0x53a11){return{'name':_0x53a11[_0xe480('0x30')],'type':_0x53a11[_0xe480('0x31')][_0xe480('0x32')]};});_0x5056e6[_0xe480('0x33')]=_[_0xe480('0x2e')](_0x68b023,_0xe480('0x2c'));_0x5056e6[_0xe480('0x34')]=_[_0xe480('0x35')](_0x3eb38f[_0xe480('0x34')]);_0x5056e6[_0xe480('0x36')]=_['intersection'](_0x5056e6[_0xe480('0x33')],_0x5056e6[_0xe480('0x34')]);_0x52ede6[_0xe480('0x37')]=_[_0xe480('0x38')](_0x5056e6[_0xe480('0x33')],qs[_0xe480('0x39')](_0x3eb38f[_0xe480('0x34')][_0xe480('0x39')]));_0x52ede6[_0xe480('0x37')]=_0x52ede6[_0xe480('0x37')][_0xe480('0x3a')]?_0x52ede6[_0xe480('0x37')]:_0x5056e6['model'];if(!_0x3eb38f[_0xe480('0x34')][_0xe480('0x3b')](_0xe480('0x3c'))){_0x52ede6['limit']=qs[_0xe480('0x1f')](_0x3eb38f[_0xe480('0x34')][_0xe480('0x1f')]);_0x52ede6[_0xe480('0x1c')]=qs[_0xe480('0x1c')](_0x3eb38f[_0xe480('0x34')][_0xe480('0x1c')]);}_0x52ede6[_0xe480('0x3d')]=qs['sort'](_0x3eb38f['query'][_0xe480('0x3e')]);_0x52ede6[_0xe480('0x3f')]=qs[_0xe480('0x36')](_[_0xe480('0x40')](_0x3eb38f[_0xe480('0x34')],_0x5056e6['filters']),_0x68b023);if(_0x3eb38f['query'][_0xe480('0x41')]){_0x52ede6[_0xe480('0x3f')]=_[_0xe480('0x42')](_0x52ede6[_0xe480('0x3f')],{'$or':_[_0xe480('0x2e')](_0x68b023,function(_0x1ecf5d){if(_0x1ecf5d[_0xe480('0x31')]!==_0xe480('0x43')){var _0x2c6519={};_0x2c6519[_0x1ecf5d[_0xe480('0x2c')]]={'$like':'%'+_0x3eb38f[_0xe480('0x34')][_0xe480('0x41')]+'%'};return _0x2c6519;}})});}_0x52ede6=_['merge']({},_0x52ede6,_0x3eb38f[_0xe480('0x44')]);var _0x14477d={'where':_0x52ede6[_0xe480('0x3f')]};return db[_0xe480('0x45')][_0xe480('0x1e')](_0x14477d)['then'](function(_0x4854d8){_0x4f4ca['count']=_0x4854d8;if(_0x3eb38f[_0xe480('0x34')][_0xe480('0x46')]){_0x52ede6[_0xe480('0x47')]=[{'all':!![]}];}return db[_0xe480('0x45')][_0xe480('0x48')](_0x52ede6);})['then'](function(_0x51edc1){_0x4f4ca[_0xe480('0x49')]=_0x51edc1;return _0x4f4ca;})[_0xe480('0x25')](respondWithFilteredResult(_0x52a074,_0x52ede6))[_0xe480('0x4a')](handleError(_0x52a074,null));};exports[_0xe480('0x4b')]=function(_0x33f408,_0x5aff87){var _0x2d2735={'raw':!![],'where':{'id':_0x33f408[_0xe480('0x4c')]['id']}},_0x736298={};_0x736298[_0xe480('0x33')]=_[_0xe480('0x35')](db[_0xe480('0x45')]['rawAttributes']);_0x736298[_0xe480('0x34')]=_[_0xe480('0x35')](_0x33f408[_0xe480('0x34')]);_0x736298['filters']=_[_0xe480('0x38')](_0x736298[_0xe480('0x33')],_0x736298[_0xe480('0x34')]);_0x2d2735[_0xe480('0x37')]=_[_0xe480('0x38')](_0x736298[_0xe480('0x33')],qs[_0xe480('0x39')](_0x33f408[_0xe480('0x34')][_0xe480('0x39')]));_0x2d2735[_0xe480('0x37')]=_0x2d2735['attributes'][_0xe480('0x3a')]?_0x2d2735[_0xe480('0x37')]:_0x736298[_0xe480('0x33')];if(_0x33f408['query'][_0xe480('0x46')]){_0x2d2735['include']=[{'all':!![]}];}_0x2d2735=_[_0xe480('0x42')]({},_0x2d2735,_0x33f408[_0xe480('0x44')]);return db[_0xe480('0x45')]['find'](_0x2d2735)[_0xe480('0x25')](handleEntityNotFound(_0x5aff87,null))['then'](respondWithResult(_0x5aff87,null))[_0xe480('0x4a')](handleError(_0x5aff87,null));};exports[_0xe480('0x4d')]=function(_0x529ed7,_0x19965c){return db[_0xe480('0x45')][_0xe480('0x4d')](_0x529ed7['body'],{})[_0xe480('0x25')](function(_0x2f2a56){var _0x4982eb=_0x529ed7[_0xe480('0x4e')][_0xe480('0x27')]({'plain':!![]});if(!_0x4982eb)throw new Error(_0xe480('0x4f'));if(_0x4982eb[_0xe480('0x50')]==='user'){var _0x3fe94b=_0x2f2a56[_0xe480('0x27')]({'plain':!![]});var _0x7a21e4=_0xe480('0x28');return db[_0xe480('0x51')][_0xe480('0x52')]({'where':{'name':_0x7a21e4,'userProfileId':_0x4982eb[_0xe480('0x53')]},'raw':!![]})[_0xe480('0x25')](function(_0x16f33c){if(_0x16f33c&&_0x16f33c[_0xe480('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fe94b['name'],'resourceId':_0x3fe94b['id'],'type':_0x16f33c[_0xe480('0x2c')],'sectionId':_0x16f33c['id']},{})[_0xe480('0x25')](function(){return _0x2f2a56;});}else{return _0x2f2a56;}})[_0xe480('0x4a')](function(_0x1665db){logger[_0xe480('0x2a')](_0xe480('0x55'),_0x1665db);throw _0x1665db;});}return _0x2f2a56;})[_0xe480('0x25')](respondWithResult(_0x19965c,0xc9))['catch'](handleError(_0x19965c,null));};exports[_0xe480('0x24')]=function(_0x23f15d,_0x1d5016){if(_0x23f15d[_0xe480('0x56')]['id']){delete _0x23f15d[_0xe480('0x56')]['id'];}return db[_0xe480('0x45')][_0xe480('0x52')]({'where':{'id':_0x23f15d['params']['id']}})['then'](handleEntityNotFound(_0x1d5016,null))[_0xe480('0x25')](saveUpdates(_0x23f15d[_0xe480('0x56')],null))[_0xe480('0x25')](respondWithResult(_0x1d5016,null))[_0xe480('0x4a')](handleError(_0x1d5016,null));};exports[_0xe480('0x26')]=function(_0x2e9cfa,_0xdbe7cc){return db[_0xe480('0x45')][_0xe480('0x52')]({'where':{'id':_0x2e9cfa['params']['id']}})[_0xe480('0x25')](handleEntityNotFound(_0xdbe7cc,null))[_0xe480('0x25')](removeEntity(_0xdbe7cc,null))[_0xe480('0x4a')](handleError(_0xdbe7cc,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a3a827c..fec521c 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 _0x2d10=['./variable.attributes','exports','Variable','tools_variables','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b872d,_0x2cdcfe){var _0x264a6a=function(_0xca73aa){while(--_0xca73aa){_0x1b872d['push'](_0x1b872d['shift']());}};_0x264a6a(++_0x2cdcfe);}(_0x2d10,0xfb));var _0x02d1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2d10[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x02d1('0x0'));var util=require(_0x02d1('0x1'));var logger=require('../../config/logger')(_0x02d1('0x2'));var moment=require(_0x02d1('0x3'));var BPromise=require(_0x02d1('0x4'));var rp=require(_0x02d1('0x5'));var fs=require('fs');var path=require(_0x02d1('0x6'));var rimraf=require(_0x02d1('0x7'));var config=require(_0x02d1('0x8'));var attributes=require(_0x02d1('0x9'));module[_0x02d1('0xa')]=function(_0x175e0f,_0x508cf0){return _0x175e0f['define'](_0x02d1('0xb'),attributes,{'tableName':_0x02d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70fb=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3de378,_0xa87504){var _0x55d7df=function(_0x18b103){while(--_0x18b103){_0x3de378['push'](_0x3de378['shift']());}};_0x55d7df(++_0xa87504);}(_0x70fb,0x159));var _0xb70f=function(_0x443242,_0x4d9878){_0x443242=_0x443242-0x0;var _0x2c7479=_0x70fb[_0x443242];return _0x2c7479;};'use strict';var _=require(_0xb70f('0x0'));var util=require(_0xb70f('0x1'));var logger=require(_0xb70f('0x2'))(_0xb70f('0x3'));var moment=require(_0xb70f('0x4'));var BPromise=require(_0xb70f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb70f('0x6'));var config=require(_0xb70f('0x7'));var attributes=require(_0xb70f('0x8'));module[_0xb70f('0x9')]=function(_0x5f3e90,_0x43d6b1){return _0x5f3e90[_0xb70f('0xa')](_0xb70f('0xb'),attributes,{'tableName':_0xb70f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 8d31432..ba27fd7 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x4f9a1f,_0x2d4991){_0x4f9a1f=_0x4f9a1f-0x0;var _0x146975=_0x326f[_0x4f9a1f];return _0x146975;};'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')]('Variable,\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')]('Variable,\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')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e03c9,_0x1d584e){_0x1e03c9=_0x1e03c9-0x0;var _0x5ac0f8=_0xa41a[_0x1e03c9];return _0x5ac0f8;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 91ccbc0..259450e 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 _0x2fc4=['isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x277bc0,_0x1c4627){var _0x54e11b=function(_0x242230){while(--_0x242230){_0x277bc0['push'](_0x277bc0['shift']());}};_0x54e11b(++_0x1c4627);}(_0x2fc4,0xbf));var _0x42fc=function(_0x3d895c,_0x58414b){_0x3d895c=_0x3d895c-0x0;var _0x1f0448=_0x2fc4[_0x3d895c];return _0x1f0448;};'use strict';var express=require(_0x42fc('0x0'));var router=express[_0x42fc('0x1')]();var auth=require(_0x42fc('0x2'));var controller=require('./version.controller');router[_0x42fc('0x3')]('/',controller['index']);router[_0x42fc('0x3')]('/fetch',auth[_0x42fc('0x4')](),auth[_0x42fc('0x5')](),controller[_0x42fc('0x6')]);router[_0x42fc('0x3')](_0x42fc('0x7'),auth['isAuthenticated'](),auth[_0x42fc('0x5')](),controller[_0x42fc('0x8')]);router[_0x42fc('0x3')]('/pull',auth[_0x42fc('0x4')](),auth[_0x42fc('0x5')](),controller[_0x42fc('0x9')]);router['get'](_0x42fc('0xa'),auth[_0x42fc('0x4')](),controller[_0x42fc('0xb')]);router[_0x42fc('0x3')](_0x42fc('0xc'),controller[_0x42fc('0xd')]);module[_0x42fc('0xe')]=router; \ No newline at end of file +var _0xddd4=['exports','Router','../../components/auth/service','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','migrations'];(function(_0x250a8b,_0x223f0c){var _0x5e588d=function(_0x663b8){while(--_0x663b8){_0x250a8b['push'](_0x250a8b['shift']());}};_0x5e588d(++_0x223f0c);}(_0xddd4,0xc5));var _0x4ddd=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xddd4[_0x29d915];return _0x160f86;};'use strict';var express=require('express');var router=express[_0x4ddd('0x0')]();var auth=require(_0x4ddd('0x1'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0x4ddd('0x2')](_0x4ddd('0x3'),auth[_0x4ddd('0x4')](),auth[_0x4ddd('0x5')](),controller[_0x4ddd('0x6')]);router[_0x4ddd('0x2')](_0x4ddd('0x7'),auth[_0x4ddd('0x4')](),auth[_0x4ddd('0x5')](),controller[_0x4ddd('0x8')]);router[_0x4ddd('0x2')]('/pull',auth['isAuthenticated'](),auth[_0x4ddd('0x5')](),controller[_0x4ddd('0x9')]);router['get'](_0x4ddd('0xa'),auth[_0x4ddd('0x4')](),controller[_0x4ddd('0xb')]);router[_0x4ddd('0x2')]('/migrations',controller[_0x4ddd('0xc')]);module[_0x4ddd('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 58b1730..2338cf3 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 _0xb44f=['--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','length','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','compare-versions','child_process','../../config/environment','../../config/logger','update','simple-git','root','exports','version','query','latest','fetch','tags','2.0.0','status','origin','info','git\x20fetch','json','git\x20fetch\x20origin\x20master'];(function(_0x4072d2,_0x5f5a6c){var _0x5cdc52=function(_0x592800){while(--_0x592800){_0x4072d2['push'](_0x4072d2['shift']());}};_0x5cdc52(++_0x5f5a6c);}(_0xb44f,0x7d));var _0xfb44=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb44f[_0x618414];return _0x21c19a;};'use strict';var Umzug=require('umzug');var path=require(_0xfb44('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xfb44('0x1'))(module,'version');var compareVersions=require(_0xfb44('0x2'));var exec=require(_0xfb44('0x3'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xfb44('0x4'));var pm2=require('../../config/pm2');var logger=require(_0xfb44('0x5'))(_0xfb44('0x6'));var git=require(_0xfb44('0x7'))(config[_0xfb44('0x8')]);exports['index']=function(_0x3ebd73,_0x27bf9e){var _0x2ee5ab={'current':module[_0xfb44('0x9')][_0xfb44('0xa')],'phonebar':0x2};if(_0x3ebd73[_0xfb44('0xb')]&&_0x3ebd73[_0xfb44('0xb')][_0xfb44('0xc')]){return git[_0xfb44('0xd')]()[_0xfb44('0xe')](function(_0x3a5588,_0x1379ac){_0x2ee5ab['latest']=(_0x3a5588?module[_0xfb44('0x9')]['version']:_0x1379ac[_0xfb44('0xc')])||_0xfb44('0xf');return _0x27bf9e[_0xfb44('0x10')](0xc8)['json'](_0x2ee5ab);});}else{return _0x27bf9e[_0xfb44('0x10')](0xc8)['json'](_0x2ee5ab);}};exports[_0xfb44('0xd')]=function(_0x1fe99e,_0x18c595){return git[_0xfb44('0xd')]([_0xfb44('0x11'),'master'],function(_0x3b69c8){if(_0x3b69c8){logger['error'](_0x3b69c8);return _0x18c595[_0xfb44('0x10')](0x1f4)['json'](_0x3b69c8);}logger[_0xfb44('0x12')](_0xfb44('0x13'));return _0x18c595[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':_0xfb44('0x15')});});};exports['reset']=function(_0x3c98f6,_0x28b39b){return git['reset']([_0xfb44('0x16'),_0xfb44('0x17')],function(_0x3e7142){if(_0x3e7142){logger[_0xfb44('0x18')](_0x3e7142);return _0x28b39b[_0xfb44('0x10')](0x1f4)['json'](_0x3e7142);}logger['info'](_0xfb44('0x19'));return _0x28b39b[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':_0xfb44('0x1a')});});};exports[_0xfb44('0x1b')]=function(_0x283693,_0xb8fa28){exec(_0xfb44('0x1c'),function(_0x2dc949,_0xa69805,_0x31a323){logger['info'](_0xa69805);logger[_0xfb44('0x12')](_0x31a323);if(_0x2dc949){logger[_0xfb44('0x18')](_0x2dc949);return _0xb8fa28['status'](0x1f4)[_0xfb44('0x14')](_0x2dc949);}return _0xb8fa28['status'](0xc8)['json']({'output':_0xa69805});});};exports[_0xfb44('0x1d')]=function(_0x27ecb6,_0x1e9410){return pm2[_0xfb44('0x1d')]('motion2')[_0xfb44('0x1e')](function(_0x435992){logger[_0xfb44('0x12')]('pm2\x20restart\x20motion\x20%s',_0x435992);return _0x1e9410[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':_0xfb44('0x1f')});})[_0xfb44('0x20')](function(_0x53c1fe){logger[_0xfb44('0x18')](_0x53c1fe);return _0x1e9410[_0xfb44('0x10')](0x1f4)[_0xfb44('0x14')](_0x53c1fe);});};exports[_0xfb44('0x21')]=function(_0x1b72f5,_0x3bb96c){var _0x31328e=fs[_0xfb44('0x22')](path[_0xfb44('0x23')](config['root'],'server',_0xfb44('0x21')));var _0x451ca2=[];for(var _0x4f51c3=0x0;_0x4f51c3<_0x31328e['length'];_0x4f51c3++){var _0x5a8ea8=_0x31328e[_0x4f51c3][_0xfb44('0x24')](_0xfb44('0x25'),'');if(compareVersions(module[_0xfb44('0x9')]['version'],_0x5a8ea8)===-0x1){_0x451ca2['push'](_0x5a8ea8);}}if(_0x451ca2[_0xfb44('0x26')]){var _0x19c431=_0x451ca2['sort'](compareVersions);var _0x2fa369=new Umzug({'storage':_0xfb44('0x27'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xfb44('0xa')},'migrations':{'params':[db['sequelize'][_0xfb44('0x28')](),db[_0xfb44('0x27')][_0xfb44('0x29')],function(){throw new Error(_0xfb44('0x2a'));}],'path':path['join'](config[_0xfb44('0x8')],_0xfb44('0x2b'),_0xfb44('0x21')),'pattern':/\.js$/}});_0x2fa369['up']({'migrations':_[_0xfb44('0x2c')](_0x19c431,function(_0x8428be){return _0x8428be+'.js';})})[_0xfb44('0x1e')](function(){return _0x3bb96c[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xfb44('0x9')][_0xfb44('0xa')]+_0xfb44('0x2d')+_[_0xfb44('0x2e')](_0x19c431),'migrations':_[_0xfb44('0x23')](_0x19c431)});})[_0xfb44('0x20')](function(_0x52fe38){if(_0x52fe38 instanceof db['sequelize'][_0xfb44('0x2f')]){return _0x3bb96c[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':_0xfb44('0x30')});}else{return _0x3bb96c['status'](0x1f4)['json'](_0x52fe38);}});}else{return _0x3bb96c[_0xfb44('0x10')](0xc8)[_0xfb44('0x14')]({'output':_0xfb44('0x30')});}}; \ No newline at end of file +var _0x5eb2=['sequelize','Migration','getQueryInterface','constructor','server','migrations','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','length','replace','.js','push','sort'];(function(_0x3859d8,_0x232f29){var _0x118582=function(_0x5c2591){while(--_0x5c2591){_0x3859d8['push'](_0x3859d8['shift']());}};_0x118582(++_0x232f29);}(_0x5eb2,0x1b3));var _0x25eb=function(_0x1c9fc4,_0x1654cb){_0x1c9fc4=_0x1c9fc4-0x0;var _0x5b9763=_0x5eb2[_0x1c9fc4];return _0x5b9763;};'use strict';var Umzug=require(_0x25eb('0x0'));var path=require(_0x25eb('0x1'));var fs=require('fs');var _=require(_0x25eb('0x2'));var pkginfo=require('pkginfo')(module,_0x25eb('0x3'));var compareVersions=require(_0x25eb('0x4'));var exec=require(_0x25eb('0x5'))[_0x25eb('0x6')];var db=require(_0x25eb('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x25eb('0x8'));var logger=require(_0x25eb('0x9'))('update');var git=require(_0x25eb('0xa'))(config[_0x25eb('0xb')]);exports[_0x25eb('0xc')]=function(_0x32fb43,_0x274432){var _0x594d4b={'current':module[_0x25eb('0xd')][_0x25eb('0x3')],'phonebar':0x2};if(_0x32fb43[_0x25eb('0xe')]&&_0x32fb43[_0x25eb('0xe')][_0x25eb('0xf')]){return git[_0x25eb('0x10')]()[_0x25eb('0x11')](function(_0x5c8e61,_0x289a78){_0x594d4b[_0x25eb('0xf')]=(_0x5c8e61?module[_0x25eb('0xd')][_0x25eb('0x3')]:_0x289a78[_0x25eb('0xf')])||_0x25eb('0x12');return _0x274432[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')](_0x594d4b);});}else{return _0x274432['status'](0xc8)[_0x25eb('0x14')](_0x594d4b);}};exports[_0x25eb('0x10')]=function(_0x2f2938,_0xe527b0){return git[_0x25eb('0x10')](['origin','master'],function(_0x309ddf){if(_0x309ddf){logger[_0x25eb('0x15')](_0x309ddf);return _0xe527b0[_0x25eb('0x13')](0x1f4)['json'](_0x309ddf);}logger[_0x25eb('0x16')]('git\x20fetch');return _0xe527b0[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')]({'output':_0x25eb('0x17')});});};exports[_0x25eb('0x18')]=function(_0x3d33fd,_0x2bebea){return git[_0x25eb('0x18')]([_0x25eb('0x19'),'FETCH_HEAD'],function(_0x51e0bd){if(_0x51e0bd){logger['error'](_0x51e0bd);return _0x2bebea[_0x25eb('0x13')](0x1f4)['json'](_0x51e0bd);}logger[_0x25eb('0x16')](_0x25eb('0x1a'));return _0x2bebea[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')]({'output':_0x25eb('0x1b')});});};exports[_0x25eb('0x1c')]=function(_0x441d79,_0x352769){exec(_0x25eb('0x1d'),function(_0x4b2c76,_0x35f968,_0xb44725){logger[_0x25eb('0x16')](_0x35f968);logger[_0x25eb('0x16')](_0xb44725);if(_0x4b2c76){logger['error'](_0x4b2c76);return _0x352769[_0x25eb('0x13')](0x1f4)[_0x25eb('0x14')](_0x4b2c76);}return _0x352769['status'](0xc8)['json']({'output':_0x35f968});});};exports['restart']=function(_0x2754f2,_0x41d21d){return pm2[_0x25eb('0x1e')](_0x25eb('0x1f'))[_0x25eb('0x20')](function(_0x1697cb){logger[_0x25eb('0x16')](_0x25eb('0x21'),_0x1697cb);return _0x41d21d[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')]({'output':_0x25eb('0x22')});})['catch'](function(_0x2770ec){logger[_0x25eb('0x15')](_0x2770ec);return _0x41d21d[_0x25eb('0x13')](0x1f4)[_0x25eb('0x14')](_0x2770ec);});};exports['migrations']=function(_0x318993,_0x1cc0b1){var _0x39b282=fs[_0x25eb('0x23')](path[_0x25eb('0x24')](config['root'],'server','migrations'));var _0x2d3557=[];for(var _0x3064ed=0x0;_0x3064ed<_0x39b282[_0x25eb('0x25')];_0x3064ed++){var _0x5e4c97=_0x39b282[_0x3064ed][_0x25eb('0x26')](_0x25eb('0x27'),'');if(compareVersions(module['exports']['version'],_0x5e4c97)===-0x1){_0x2d3557[_0x25eb('0x28')](_0x5e4c97);}}if(_0x2d3557[_0x25eb('0x25')]){var _0x193eda=_0x2d3557[_0x25eb('0x29')](compareVersions);var _0x492aca=new Umzug({'storage':_0x25eb('0x2a'),'storageOptions':{'model':db[_0x25eb('0x2b')],'modelName':_0x25eb('0x2b'),'columnName':_0x25eb('0x3')},'migrations':{'params':[db[_0x25eb('0x2a')][_0x25eb('0x2c')](),db['sequelize'][_0x25eb('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x25eb('0x24')](config[_0x25eb('0xb')],_0x25eb('0x2e'),_0x25eb('0x2f')),'pattern':/\.js$/}});_0x492aca['up']({'migrations':_['map'](_0x193eda,function(_0x3b1e89){return _0x3b1e89+_0x25eb('0x27');})})[_0x25eb('0x20')](function(){return _0x1cc0b1[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x25eb('0xd')][_0x25eb('0x3')]+_0x25eb('0x30')+_[_0x25eb('0x31')](_0x193eda),'migrations':_[_0x25eb('0x24')](_0x193eda)});})[_0x25eb('0x32')](function(_0x34c5c7){if(_0x34c5c7 instanceof db[_0x25eb('0x2a')][_0x25eb('0x33')]){return _0x1cc0b1[_0x25eb('0x13')](0xc8)['json']({'output':_0x25eb('0x34')});}else{return _0x1cc0b1[_0x25eb('0x13')](0x1f4)[_0x25eb('0x14')](_0x34c5c7);}});}else{return _0x1cc0b1[_0x25eb('0x13')](0xc8)[_0x25eb('0x14')]({'output':_0x25eb('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index c7ac798..fc55013 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 _0x2e0c=['delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x2d85de,_0xea22c2){var _0x2cd00a=function(_0x41d607){while(--_0x41d607){_0x2d85de['push'](_0x2d85de['shift']());}};_0x2cd00a(++_0xea22c2);}(_0x2e0c,0xa2));var _0xc2e0=function(_0x1a53b2,_0x22311e){_0x1a53b2=_0x1a53b2-0x0;var _0x10e500=_0x2e0c[_0x1a53b2];return _0x10e500;};'use strict';var multer=require(_0xc2e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc2e0('0x1'));var express=require(_0xc2e0('0x2'));var router=express['Router']();var fs_extra=require(_0xc2e0('0x3'));var auth=require(_0xc2e0('0x4'));var interaction=require(_0xc2e0('0x5'));var config=require(_0xc2e0('0x6'));var controller=require(_0xc2e0('0x7'));router[_0xc2e0('0x8')]('/',auth[_0xc2e0('0x9')](),controller[_0xc2e0('0xa')]);router[_0xc2e0('0x8')]('/describe',auth[_0xc2e0('0x9')](),controller[_0xc2e0('0xb')]);router[_0xc2e0('0x8')](_0xc2e0('0xc'),auth[_0xc2e0('0x9')](),controller[_0xc2e0('0xd')]);router[_0xc2e0('0xe')]('/',auth[_0xc2e0('0x9')](),controller[_0xc2e0('0xf')]);router[_0xc2e0('0x10')]('/:id',auth[_0xc2e0('0x9')](),controller[_0xc2e0('0x11')]);router[_0xc2e0('0x12')](_0xc2e0('0xc'),auth[_0xc2e0('0x9')](),controller[_0xc2e0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1888=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','create','/:id','update','delete'];(function(_0x1bcd44,_0x19c738){var _0x517db7=function(_0x1c62c8){while(--_0x1c62c8){_0x1bcd44['push'](_0x1bcd44['shift']());}};_0x517db7(++_0x19c738);}(_0x1888,0x1f0));var _0x8188=function(_0x22db31,_0x568f64){_0x22db31=_0x22db31-0x0;var _0x483061=_0x1888[_0x22db31];return _0x483061;};'use strict';var multer=require('multer');var util=require(_0x8188('0x0'));var path=require(_0x8188('0x1'));var timeout=require(_0x8188('0x2'));var express=require(_0x8188('0x3'));var router=express[_0x8188('0x4')]();var fs_extra=require(_0x8188('0x5'));var auth=require(_0x8188('0x6'));var interaction=require(_0x8188('0x7'));var config=require(_0x8188('0x8'));var controller=require(_0x8188('0x9'));router[_0x8188('0xa')]('/',auth[_0x8188('0xb')](),controller['index']);router[_0x8188('0xa')](_0x8188('0xc'),auth[_0x8188('0xb')](),controller['describe']);router['get']('/:id',auth[_0x8188('0xb')](),controller['show']);router['post']('/',auth[_0x8188('0xb')](),controller[_0x8188('0xd')]);router['put'](_0x8188('0xe'),auth['isAuthenticated'](),controller[_0x8188('0xf')]);router[_0x8188('0x10')](_0x8188('0xe'),auth['isAuthenticated'](),controller[_0x8188('0x11')]);module[_0x8188('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a82a2c2..5a07747 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 _0xcaef=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0xcaef,0x1c9));var _0xfcae=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xcaef[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module[_0xfcae('0x0')]={'type':{'type':Sequelize[_0xfcae('0x1')]},'uniqueid':{'type':Sequelize[_0xfcae('0x1')]},'calleridnum':{'type':Sequelize[_0xfcae('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfcae('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfcae('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfcae('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfcae('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xfcae('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfcae('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcae('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfcae('0x3')]},'agentacw':{'type':Sequelize[_0xfcae('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcae('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfcae('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfcae('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfcae('0x1')]},'connectedlinename':{'type':Sequelize[_0xfcae('0x1')]},'language':{'type':Sequelize[_0xfcae('0x1')]},'accountcode':{'type':Sequelize[_0xfcae('0x1')]},'context':{'type':Sequelize[_0xfcae('0x1')]},'exten':{'type':Sequelize[_0xfcae('0x1')]},'priority':{'type':Sequelize[_0xfcae('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfcae('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfcae('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfcae('0x1')]},'destcalleridname':{'type':Sequelize[_0xfcae('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xfcae('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfcae('0x1')]},'destlanguage':{'type':Sequelize[_0xfcae('0x1')]},'destaccountcode':{'type':Sequelize[_0xfcae('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfcae('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xfcae('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfcae('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xfcae('0x1')]},'transfer':{'type':Sequelize[_0xfcae('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfcae('0x1')],'comment':_0xfcae('0x5')},'transferexten':{'type':Sequelize[_0xfcae('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfcae('0x1')]},'agententerreason':{'type':Sequelize[_0xfcae('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcf66=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3e142d,_0x427d3b){var _0x18c02d=function(_0x262c08){while(--_0x262c08){_0x3e142d['push'](_0x3e142d['shift']());}};_0x18c02d(++_0x427d3b);}(_0xcf66,0x71));var _0x6cf6=function(_0x4c7975,_0x234aee){_0x4c7975=_0x4c7975-0x0;var _0x4428ac=_0xcf66[_0x4c7975];return _0x4428ac;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'type':{'type':Sequelize[_0x6cf6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6cf6('0x2')]},'calleridname':{'type':Sequelize[_0x6cf6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6cf6('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x6cf6('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6cf6('0x5')]},'agentacw':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6cf6('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6cf6('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6cf6('0x2')]},'connectedlinename':{'type':Sequelize[_0x6cf6('0x2')]},'language':{'type':Sequelize[_0x6cf6('0x2')]},'accountcode':{'type':Sequelize[_0x6cf6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6cf6('0x2')]},'destchannelstate':{'type':Sequelize[_0x6cf6('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x6cf6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6cf6('0x2')]},'destcalleridname':{'type':Sequelize[_0x6cf6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6cf6('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6cf6('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6cf6('0x2')]},'destexten':{'type':Sequelize[_0x6cf6('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6cf6('0x2')]},'transfer':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6cf6('0x2')],'comment':_0x6cf6('0x6')},'transferexten':{'type':Sequelize[_0x6cf6('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'agententerreason':{'type':Sequelize[_0x6cf6('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 5edae03..049c838 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(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_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 219b972..ae7598f 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 _0x3ca4=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0x3ca4,0x17d));var _0x43ca=function(_0x4a59a2,_0x24ebac){_0x4a59a2=_0x4a59a2-0x0;var _0x26c063=_0x3ca4[_0x4a59a2];return _0x26c063;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var logger=require(_0x43ca('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43ca('0x3'));var rp=require(_0x43ca('0x4'));var fs=require('fs');var path=require(_0x43ca('0x5'));var rimraf=require(_0x43ca('0x6'));var config=require(_0x43ca('0x7'));var attributes=require(_0x43ca('0x8'));module[_0x43ca('0x9')]=function(_0x4f017e,_0x14c38c){return _0x4f017e[_0x43ca('0xa')](_0x43ca('0xb'),attributes,{'tableName':_0x43ca('0xc'),'paranoid':![],'indexes':[{'fields':[_0x43ca('0xd'),_0x43ca('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['exports','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x57f70c,_0x73e15c){var _0x5b1ff7=function(_0x3a9141){while(--_0x3a9141){_0x57f70c['push'](_0x57f70c['shift']());}};_0x5b1ff7(++_0x73e15c);}(_0x84ab,0x12f));var _0xb84a=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x84ab[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xb84a('0xb'),_0xb84a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3622727..30bda3a 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 _0x52e1=['code','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceAgentReport','create','body','options','raw','then','stringify','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x9f303f,_0x130e64){var _0x1d64bd=function(_0x5b475f){while(--_0x5b475f){_0x9f303f['push'](_0x9f303f['shift']());}};_0x1d64bd(++_0x130e64);}(_0x52e1,0x12a));var _0x152e=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x52e1[_0x1667df];return _0x341abf;};'use strict';var _=require(_0x152e('0x0'));var util=require(_0x152e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x152e('0x2'));var fs=require('fs');var Redis=require(_0x152e('0x3'));var db=require(_0x152e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x152e('0x5'))(_0x152e('0x6'));var config=require(_0x152e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25dc76,_0x11d587,_0x235d68){return new BPromise(function(_0x37aa6c,_0x19f485){return client['request'](_0x25dc76,_0x235d68)['then'](function(_0x378beb){logger[_0x152e('0x8')]('VoiceAgentReport,\x20%s,\x20%s',_0x11d587,'request\x20sent');logger[_0x152e('0x9')](_0x152e('0xa'),_0x11d587,'request\x20sent',JSON['stringify'](_0x378beb));if(_0x378beb[_0x152e('0xb')]){if(_0x378beb[_0x152e('0xb')][_0x152e('0xc')]===0x1f4){logger['error'](_0x152e('0xd'),_0x11d587,_0x378beb[_0x152e('0xb')]['message']);return _0x19f485(_0x378beb['error'][_0x152e('0xe')]);}logger[_0x152e('0xb')](_0x152e('0xd'),_0x11d587,_0x378beb['error'][_0x152e('0xe')]);return _0x37aa6c(_0x378beb['error'][_0x152e('0xe')]);}else{logger[_0x152e('0x8')](_0x152e('0xd'),_0x11d587,_0x152e('0xf'));_0x37aa6c(_0x378beb[_0x152e('0x10')]['message']);}})[_0x152e('0x11')](function(_0x3949d0){logger['error'](_0x152e('0xd'),_0x11d587,_0x3949d0);_0x19f485(_0x3949d0);});});}exports[_0x152e('0x12')]=function(_0x2e37a7){var _0x4ec3f3=this;return new Promise(function(_0x66194c,_0xfbf7d5){return db['VoiceAgentReport'][_0x152e('0x13')](_0x2e37a7[_0x152e('0x14')],{'raw':_0x2e37a7[_0x152e('0x15')]?_0x2e37a7[_0x152e('0x15')][_0x152e('0x16')]===undefined?!![]:![]:!![]})[_0x152e('0x17')](function(_0x71c9c7){logger[_0x152e('0x8')](_0x152e('0x12'),_0x2e37a7);logger['debug'](_0x152e('0x12'),_0x2e37a7,JSON[_0x152e('0x18')](_0x71c9c7));_0x66194c(_0x71c9c7);})['catch'](function(_0x343b15){logger[_0x152e('0xb')](_0x152e('0x12'),_0x343b15[_0x152e('0xe')],_0x2e37a7);_0xfbf7d5(_0x4ec3f3[_0x152e('0xb')](0x1f4,_0x343b15[_0x152e('0xe')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3238c1){var _0x234081=this;return new Promise(function(_0x2b628e,_0x16ecd5){return db[_0x152e('0x19')][_0x152e('0x1a')](_0x3238c1[_0x152e('0x14')],{'raw':_0x3238c1[_0x152e('0x15')]?_0x3238c1[_0x152e('0x15')][_0x152e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3238c1[_0x152e('0x15')]?_0x3238c1[_0x152e('0x15')][_0x152e('0x1b')]||null:null,'attributes':_0x3238c1[_0x152e('0x15')]?_0x3238c1[_0x152e('0x15')][_0x152e('0x1c')]||null:null,'limit':_0x3238c1[_0x152e('0x15')]?_0x3238c1[_0x152e('0x15')][_0x152e('0x1d')]||null:null})[_0x152e('0x17')](function(_0x405445){logger['info'](_0x152e('0x1e'),_0x3238c1);logger[_0x152e('0x9')](_0x152e('0x1e'),_0x3238c1,JSON[_0x152e('0x18')](_0x405445));_0x2b628e(_0x405445);})['catch'](function(_0x435648){logger[_0x152e('0xb')](_0x152e('0x1e'),_0x435648['message'],_0x3238c1);_0x16ecd5(_0x234081[_0x152e('0xb')](0x1f4,_0x435648[_0x152e('0xe')]));});});}; \ No newline at end of file +var _0xc6e3=['catch','where','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6e3,0x1b7));var _0x3c6e=function(_0x4303a0,_0xb85b27){_0x4303a0=_0x4303a0-0x0;var _0x3ecb11=_0xc6e3[_0x4303a0];return _0x3ecb11;};'use strict';var _=require(_0x3c6e('0x0'));var util=require(_0x3c6e('0x1'));var moment=require(_0x3c6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c6e('0x3'));var fs=require('fs');var Redis=require(_0x3c6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c6e('0x5'))(_0x3c6e('0x6'));var config=require(_0x3c6e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c6e('0x8')][_0x3c6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x91e83b,_0x355e32,_0x1eca6c){return new BPromise(function(_0x410982,_0x2acab9){return client[_0x3c6e('0xa')](_0x91e83b,_0x1eca6c)[_0x3c6e('0xb')](function(_0x5d4b97){logger[_0x3c6e('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x355e32,_0x3c6e('0xd'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x355e32,'request\x20sent',JSON[_0x3c6e('0xe')](_0x5d4b97));if(_0x5d4b97[_0x3c6e('0xf')]){if(_0x5d4b97['error']['code']===0x1f4){logger[_0x3c6e('0xf')](_0x3c6e('0x10'),_0x355e32,_0x5d4b97['error']['message']);return _0x2acab9(_0x5d4b97[_0x3c6e('0xf')][_0x3c6e('0x11')]);}logger[_0x3c6e('0xf')](_0x3c6e('0x10'),_0x355e32,_0x5d4b97[_0x3c6e('0xf')][_0x3c6e('0x11')]);return _0x410982(_0x5d4b97['error'][_0x3c6e('0x11')]);}else{logger[_0x3c6e('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x355e32,_0x3c6e('0xd'));_0x410982(_0x5d4b97[_0x3c6e('0x12')][_0x3c6e('0x11')]);}})['catch'](function(_0x80e10d){logger[_0x3c6e('0xf')](_0x3c6e('0x10'),_0x355e32,_0x80e10d);_0x2acab9(_0x80e10d);});});}exports[_0x3c6e('0x13')]=function(_0x309373){var _0x37b3a8=this;return new Promise(function(_0x296d35,_0x5121d6){return db[_0x3c6e('0x14')][_0x3c6e('0x15')](_0x309373[_0x3c6e('0x16')],{'raw':_0x309373[_0x3c6e('0x17')]?_0x309373[_0x3c6e('0x17')][_0x3c6e('0x18')]===undefined?!![]:![]:!![]})[_0x3c6e('0xb')](function(_0x14a91c){logger['info']('CreateVoiceAgentReport',_0x309373);logger['debug'](_0x3c6e('0x13'),_0x309373,JSON[_0x3c6e('0xe')](_0x14a91c));_0x296d35(_0x14a91c);})[_0x3c6e('0x19')](function(_0x5411e8){logger[_0x3c6e('0xf')](_0x3c6e('0x13'),_0x5411e8[_0x3c6e('0x11')],_0x309373);_0x5121d6(_0x37b3a8[_0x3c6e('0xf')](0x1f4,_0x5411e8['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x408634){var _0x56c88a=this;return new Promise(function(_0x37f152,_0x1de166){return db[_0x3c6e('0x14')]['update'](_0x408634['body'],{'raw':_0x408634[_0x3c6e('0x17')]?_0x408634[_0x3c6e('0x17')][_0x3c6e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408634[_0x3c6e('0x17')]?_0x408634[_0x3c6e('0x17')][_0x3c6e('0x1a')]||null:null,'attributes':_0x408634[_0x3c6e('0x17')]?_0x408634[_0x3c6e('0x17')]['attributes']||null:null,'limit':_0x408634[_0x3c6e('0x17')]?_0x408634[_0x3c6e('0x17')][_0x3c6e('0x1b')]||null:null})[_0x3c6e('0xb')](function(_0xd5cba7){logger[_0x3c6e('0xc')](_0x3c6e('0x1c'),_0x408634);logger['debug'](_0x3c6e('0x1c'),_0x408634,JSON[_0x3c6e('0xe')](_0xd5cba7));_0x37f152(_0xd5cba7);})['catch'](function(_0x5b5293){logger['error']('UpdateVoiceAgentReport',_0x5b5293[_0x3c6e('0x11')],_0x408634);_0x1de166(_0x56c88a[_0x3c6e('0xf')](0x1f4,_0x5b5293[_0x3c6e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e018a4b..7a7131e 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 _0x1b20=['show','post','create','put','/:id','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x52c489,_0x44ed60){var _0x3d02b0=function(_0x353724){while(--_0x353724){_0x52c489['push'](_0x52c489['shift']());}};_0x3d02b0(++_0x44ed60);}(_0x1b20,0x66));var _0x01b2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b20[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['describe']);router[_0x01b2('0x8')]('/:id',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0xd')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0xf')](_0x01b2('0x10'),auth[_0x01b2('0x9')](),controller['update']);router[_0x01b2('0x11')]('/:id',auth[_0x01b2('0x9')](),controller['destroy']);module[_0x01b2('0x12')]=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','delete','destroy'];(function(_0x4df601,_0x186321){var _0x5d4f93=function(_0x36a3ca){while(--_0x36a3ca){_0x4df601['push'](_0x4df601['shift']());}};_0x5d4f93(++_0x186321);}(_0x2bd8,0x130));var _0x82bd=function(_0x49a206,_0x427d91){_0x49a206=_0x49a206-0x0;var _0x295a98=_0x2bd8[_0x49a206];return _0x295a98;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['put'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x82bd('0xe')](_0x82bd('0xd'),auth['isAuthenticated'](),controller[_0x82bd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 3e53f7a..2fcbe6f 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 _0xbd19=['STRING','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x44260e,_0x562865){var _0x244282=function(_0x4d5be6){while(--_0x4d5be6){_0x44260e['push'](_0x44260e['shift']());}};_0x244282(++_0x562865);}(_0xbd19,0x111));var _0x9bd1=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xbd19[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]={'uniqueid':{'type':Sequelize[_0x9bd1('0x2')]},'type':{'type':Sequelize['ENUM'](_0x9bd1('0x3'),_0x9bd1('0x4'),'outbound',_0x9bd1('0x5'),_0x9bd1('0x6'),_0x9bd1('0x7'))},'tag':{'type':Sequelize[_0x9bd1('0x2')]},'accountcode':{'type':Sequelize[_0x9bd1('0x2')]},'source':{'type':Sequelize[_0x9bd1('0x2')]},'destination':{'type':Sequelize[_0x9bd1('0x2')]},'destinationcontext':{'type':Sequelize[_0x9bd1('0x2')]},'callerid':{'type':Sequelize[_0x9bd1('0x2')]},'channel':{'type':Sequelize[_0x9bd1('0x2')]},'destinationchannel':{'type':Sequelize[_0x9bd1('0x2')]},'lastapplication':{'type':Sequelize[_0x9bd1('0x2')]},'lastdata':{'type':Sequelize[_0x9bd1('0x8')]},'starttime':{'type':Sequelize[_0x9bd1('0x9')]},'systemanswertime':{'type':Sequelize[_0x9bd1('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9bd1('0x9')]},'duration':{'type':Sequelize[_0x9bd1('0xa')]},'billableseconds':{'type':Sequelize[_0x9bd1('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9bd1('0x2')]},'userDisposition':{'type':Sequelize[_0x9bd1('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9bd1('0x2')]},'note':{'type':Sequelize[_0x9bd1('0x2')]},'prefix':{'type':Sequelize[_0x9bd1('0x2')]},'routeid':{'type':Sequelize[_0x9bd1('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3264=['STRING','ENUM','inbound','inbound-fax','TEXT','DATE','INTEGER','exports'];(function(_0x49a29e,_0x36be8a){var _0x499163=function(_0x4a9b13){while(--_0x4a9b13){_0x49a29e['push'](_0x49a29e['shift']());}};_0x499163(++_0x36be8a);}(_0x3264,0x7f));var _0x4326=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x3264[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'uniqueid':{'type':Sequelize[_0x4326('0x1')]},'type':{'type':Sequelize[_0x4326('0x2')](_0x4326('0x3'),'internal','outbound',_0x4326('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x4326('0x1')]},'accountcode':{'type':Sequelize[_0x4326('0x1')]},'source':{'type':Sequelize[_0x4326('0x1')]},'destination':{'type':Sequelize[_0x4326('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4326('0x1')]},'channel':{'type':Sequelize[_0x4326('0x1')]},'destinationchannel':{'type':Sequelize[_0x4326('0x1')]},'lastapplication':{'type':Sequelize[_0x4326('0x1')]},'lastdata':{'type':Sequelize[_0x4326('0x5')]},'starttime':{'type':Sequelize[_0x4326('0x6')]},'systemanswertime':{'type':Sequelize[_0x4326('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4326('0x7')]},'billableseconds':{'type':Sequelize[_0x4326('0x7')]},'mohtime':{'type':Sequelize[_0x4326('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4326('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4326('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x4326('0x1')]},'note':{'type':Sequelize[_0x4326('0x1')]},'prefix':{'type':Sequelize[_0x4326('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'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 e427100..714640a 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(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x2ef3,0xba));var _0x32ef=function(_0x3687bd,_0x2db602){_0x3687bd=_0x3687bd-0x0;var _0x3c6749=_0x2ef3[_0x3687bd];return _0x3c6749;};'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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x214ccf,_0x1cdd89){var _0x23d8a3=function(_0xefc223){while(--_0xefc223){_0x214ccf['push'](_0x214ccf['shift']());}};_0x23d8a3(++_0x1cdd89);}(_0xdb28,0x106));var _0x8db2=function(_0x2f74da,_0x4ed7e6){_0x2f74da=_0x2f74da-0x0;var _0x6cdd=_0xdb28[_0x2f74da];return _0x6cdd;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index fe12d27..8b875fc 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 _0xffdc=['moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','api'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xffdc,0x7f));var _0xcffd=function(_0x4fab1e,_0x34b507){_0x4fab1e=_0x4fab1e-0x0;var _0x59bf51=_0xffdc[_0x4fab1e];return _0x59bf51;};'use strict';var _=require(_0xcffd('0x0'));var util=require(_0xcffd('0x1'));var logger=require('../../config/logger')(_0xcffd('0x2'));var moment=require(_0xcffd('0x3'));var BPromise=require('bluebird');var rp=require(_0xcffd('0x4'));var fs=require('fs');var path=require(_0xcffd('0x5'));var rimraf=require(_0xcffd('0x6'));var config=require(_0xcffd('0x7'));var attributes=require(_0xcffd('0x8'));module['exports']=function(_0x1a1bce,_0x963fad){return _0x1a1bce[_0xcffd('0x9')](_0xcffd('0xa'),attributes,{'tableName':_0xcffd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcffd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x781f=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','api','bluebird','request-promise','path'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x781f,0x13f));var _0xf781=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x781f[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var logger=require('../../config/logger')(_0xf781('0x2'));var moment=require('moment');var BPromise=require(_0xf781('0x3'));var rp=require(_0xf781('0x4'));var fs=require('fs');var path=require(_0xf781('0x5'));var rimraf=require(_0xf781('0x6'));var config=require(_0xf781('0x7'));var attributes=require(_0xf781('0x8'));module[_0xf781('0x9')]=function(_0x1e9c0e,_0x41c82b){return _0x1e9c0e[_0xf781('0xa')](_0xf781('0xb'),attributes,{'tableName':_0xf781('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 51f21f8..6e6d5ce 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 _0xaff7=['debug','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','where','limit','include','map','model','attributes','GetVoiceCallReport'];(function(_0x568d30,_0x50fceb){var _0xabb817=function(_0x1167f3){while(--_0x1167f3){_0x568d30['push'](_0x568d30['shift']());}};_0xabb817(++_0x50fceb);}(_0xaff7,0x1db));var _0x7aff=function(_0x568039,_0x570f8e){_0x568039=_0x568039-0x0;var _0x1595fc=_0xaff7[_0x568039];return _0x1595fc;};'use strict';var _=require(_0x7aff('0x0'));var util=require(_0x7aff('0x1'));var moment=require(_0x7aff('0x2'));var BPromise=require('bluebird');var rs=require(_0x7aff('0x3'));var fs=require('fs');var Redis=require(_0x7aff('0x4'));var db=require(_0x7aff('0x5'))['db'];var utils=require(_0x7aff('0x6'));var logger=require(_0x7aff('0x7'))(_0x7aff('0x8'));var config=require(_0x7aff('0x9'));var jayson=require(_0x7aff('0xa'));var client=jayson[_0x7aff('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cbb1b,_0x18c306,_0x22b3bb){return new BPromise(function(_0x80010b,_0x28e28d){return client[_0x7aff('0xc')](_0x5cbb1b,_0x22b3bb)[_0x7aff('0xd')](function(_0x50f705){logger[_0x7aff('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x18c306,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x18c306,_0x7aff('0xf'),JSON[_0x7aff('0x10')](_0x50f705));if(_0x50f705[_0x7aff('0x11')]){if(_0x50f705[_0x7aff('0x11')]['code']===0x1f4){logger[_0x7aff('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x18c306,_0x50f705['error']['message']);return _0x28e28d(_0x50f705['error']['message']);}logger[_0x7aff('0x11')](_0x7aff('0x12'),_0x18c306,_0x50f705[_0x7aff('0x11')][_0x7aff('0x13')]);return _0x80010b(_0x50f705[_0x7aff('0x11')][_0x7aff('0x13')]);}else{logger[_0x7aff('0xe')](_0x7aff('0x12'),_0x18c306,_0x7aff('0xf'));_0x80010b(_0x50f705[_0x7aff('0x14')][_0x7aff('0x13')]);}})[_0x7aff('0x15')](function(_0x428613){logger[_0x7aff('0x11')](_0x7aff('0x12'),_0x18c306,_0x428613);_0x28e28d(_0x428613);});});}exports['GetVoiceCallReport']=function(_0x586cb5){var _0x4f3de9=this;return new Promise(function(_0x21d360,_0x3899ae){return db[_0x7aff('0x16')][_0x7aff('0x17')]({'raw':_0x586cb5[_0x7aff('0x18')]?_0x586cb5['options']['raw']===undefined?!![]:![]:!![],'where':_0x586cb5['options']?_0x586cb5[_0x7aff('0x18')][_0x7aff('0x19')]||null:null,'attributes':_0x586cb5[_0x7aff('0x18')]?_0x586cb5[_0x7aff('0x18')]['attributes']||null:null,'limit':_0x586cb5[_0x7aff('0x18')]?_0x586cb5[_0x7aff('0x18')][_0x7aff('0x1a')]||null:null,'include':_0x586cb5[_0x7aff('0x18')]?_0x586cb5[_0x7aff('0x18')][_0x7aff('0x1b')]?_[_0x7aff('0x1c')](_0x586cb5['options'][_0x7aff('0x1b')],function(_0xc5c8a2){return{'model':db[_0xc5c8a2[_0x7aff('0x1d')]],'as':_0xc5c8a2['as'],'attributes':_0xc5c8a2[_0x7aff('0x1e')],'include':_0xc5c8a2[_0x7aff('0x1b')]?_[_0x7aff('0x1c')](_0xc5c8a2[_0x7aff('0x1b')],function(_0x895a75){return{'model':db[_0x895a75['model']],'as':_0x895a75['as'],'attributes':_0x895a75[_0x7aff('0x1e')],'include':_0x895a75[_0x7aff('0x1b')]?_[_0x7aff('0x1c')](_0x895a75[_0x7aff('0x1b')],function(_0x4581a4){return{'model':db[_0x4581a4[_0x7aff('0x1d')]],'as':_0x4581a4['as'],'attributes':_0x4581a4[_0x7aff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7aff('0xd')](function(_0x500f3f){logger[_0x7aff('0xe')](_0x7aff('0x1f'),_0x586cb5);logger[_0x7aff('0x20')]('GetVoiceCallReport',_0x586cb5,JSON[_0x7aff('0x10')](_0x500f3f));_0x21d360(_0x500f3f);})['catch'](function(_0x9c33de){logger[_0x7aff('0x11')](_0x7aff('0x1f'),_0x9c33de['message'],_0x586cb5);_0x3899ae(_0x4f3de9[_0x7aff('0x11')](0x1f4,_0x9c33de[_0x7aff('0x13')]));});});};exports[_0x7aff('0x21')]=function(_0x3ee462){var _0x190b8a=this;return new Promise(function(_0x3a1e66,_0x18912b){return db[_0x7aff('0x16')][_0x7aff('0x22')](_0x3ee462[_0x7aff('0x23')],{'raw':_0x3ee462[_0x7aff('0x18')]?_0x3ee462[_0x7aff('0x18')][_0x7aff('0x24')]===undefined?!![]:![]:!![]})[_0x7aff('0xd')](function(_0x168717){logger[_0x7aff('0xe')](_0x7aff('0x21'),_0x3ee462);logger[_0x7aff('0x20')](_0x7aff('0x21'),_0x3ee462,JSON[_0x7aff('0x10')](_0x168717));_0x3a1e66(_0x168717);})['catch'](function(_0x214381){logger[_0x7aff('0x11')]('CreateVoiceCallReport',_0x214381[_0x7aff('0x13')],_0x3ee462);_0x18912b(_0x190b8a[_0x7aff('0x11')](0x1f4,_0x214381[_0x7aff('0x13')]));});});};exports[_0x7aff('0x25')]=function(_0x436f2f){var _0x3e14a0=this;return new Promise(function(_0x374967,_0x355c70){return db[_0x7aff('0x16')][_0x7aff('0x26')](_0x436f2f[_0x7aff('0x23')],{'raw':_0x436f2f[_0x7aff('0x18')]?_0x436f2f['options'][_0x7aff('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x436f2f[_0x7aff('0x18')]?_0x436f2f[_0x7aff('0x18')][_0x7aff('0x19')]||null:null,'attributes':_0x436f2f['options']?_0x436f2f['options']['attributes']||null:null,'limit':_0x436f2f[_0x7aff('0x18')]?_0x436f2f['options'][_0x7aff('0x1a')]||null:null})[_0x7aff('0xd')](function(_0x23cdf0){logger['info'](_0x7aff('0x25'),_0x436f2f);logger[_0x7aff('0x20')](_0x7aff('0x25'),_0x436f2f,JSON[_0x7aff('0x10')](_0x23cdf0));_0x374967(_0x23cdf0);})[_0x7aff('0x15')](function(_0xe8ce67){logger[_0x7aff('0x11')](_0x7aff('0x25'),_0xe8ce67[_0x7aff('0x13')],_0x436f2f);_0x355c70(_0x3e14a0[_0x7aff('0x11')](0x1f4,_0xe8ce67[_0x7aff('0x13')]));});});}; \ No newline at end of file +var _0x38d1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','map','include','model','CreateVoiceCallReport','body','raw','debug','UpdateVoiceCallReport','update','lodash'];(function(_0x625054,_0x478598){var _0x20b904=function(_0x24b110){while(--_0x24b110){_0x625054['push'](_0x625054['shift']());}};_0x20b904(++_0x478598);}(_0x38d1,0x71));var _0x138d=function(_0x32e13d,_0x2636da){_0x32e13d=_0x32e13d-0x0;var _0x4d5e9b=_0x38d1[_0x32e13d];return _0x4d5e9b;};'use strict';var _=require(_0x138d('0x0'));var util=require(_0x138d('0x1'));var moment=require(_0x138d('0x2'));var BPromise=require(_0x138d('0x3'));var rs=require(_0x138d('0x4'));var fs=require('fs');var Redis=require(_0x138d('0x5'));var db=require(_0x138d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x138d('0x7'));var config=require(_0x138d('0x8'));var jayson=require(_0x138d('0x9'));var client=jayson[_0x138d('0xa')][_0x138d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563745,_0xcad65f,_0x48cada){return new BPromise(function(_0x1d1c41,_0x23b151){return client['request'](_0x563745,_0x48cada)[_0x138d('0xc')](function(_0x4be88e){logger['info'](_0x138d('0xd'),_0xcad65f,'request\x20sent');logger['debug'](_0x138d('0xe'),_0xcad65f,_0x138d('0xf'),JSON[_0x138d('0x10')](_0x4be88e));if(_0x4be88e[_0x138d('0x11')]){if(_0x4be88e['error'][_0x138d('0x12')]===0x1f4){logger[_0x138d('0x11')](_0x138d('0xd'),_0xcad65f,_0x4be88e['error'][_0x138d('0x13')]);return _0x23b151(_0x4be88e['error'][_0x138d('0x13')]);}logger[_0x138d('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xcad65f,_0x4be88e[_0x138d('0x11')]['message']);return _0x1d1c41(_0x4be88e[_0x138d('0x11')]['message']);}else{logger[_0x138d('0x14')](_0x138d('0xd'),_0xcad65f,'request\x20sent');_0x1d1c41(_0x4be88e['result']['message']);}})[_0x138d('0x15')](function(_0x46cde2){logger[_0x138d('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xcad65f,_0x46cde2);_0x23b151(_0x46cde2);});});}exports[_0x138d('0x16')]=function(_0x3c8046){var _0xa7718e=this;return new Promise(function(_0x3137eb,_0x82154a){return db[_0x138d('0x17')][_0x138d('0x18')]({'raw':_0x3c8046[_0x138d('0x19')]?_0x3c8046[_0x138d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c8046[_0x138d('0x19')]?_0x3c8046['options'][_0x138d('0x1a')]||null:null,'attributes':_0x3c8046['options']?_0x3c8046[_0x138d('0x19')][_0x138d('0x1b')]||null:null,'limit':_0x3c8046[_0x138d('0x19')]?_0x3c8046[_0x138d('0x19')][_0x138d('0x1c')]||null:null,'include':_0x3c8046['options']?_0x3c8046[_0x138d('0x19')]['include']?_[_0x138d('0x1d')](_0x3c8046[_0x138d('0x19')]['include'],function(_0x1506b1){return{'model':db[_0x1506b1['model']],'as':_0x1506b1['as'],'attributes':_0x1506b1['attributes'],'include':_0x1506b1[_0x138d('0x1e')]?_[_0x138d('0x1d')](_0x1506b1[_0x138d('0x1e')],function(_0x5beaf8){return{'model':db[_0x5beaf8['model']],'as':_0x5beaf8['as'],'attributes':_0x5beaf8['attributes'],'include':_0x5beaf8[_0x138d('0x1e')]?_[_0x138d('0x1d')](_0x5beaf8[_0x138d('0x1e')],function(_0xbc6dcd){return{'model':db[_0xbc6dcd[_0x138d('0x1f')]],'as':_0xbc6dcd['as'],'attributes':_0xbc6dcd[_0x138d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x138d('0xc')](function(_0x16fce0){logger[_0x138d('0x14')]('GetVoiceCallReport',_0x3c8046);logger['debug'](_0x138d('0x16'),_0x3c8046,JSON['stringify'](_0x16fce0));_0x3137eb(_0x16fce0);})[_0x138d('0x15')](function(_0x107a30){logger[_0x138d('0x11')](_0x138d('0x16'),_0x107a30[_0x138d('0x13')],_0x3c8046);_0x82154a(_0xa7718e[_0x138d('0x11')](0x1f4,_0x107a30[_0x138d('0x13')]));});});};exports[_0x138d('0x20')]=function(_0x5bc79a){var _0x49ba36=this;return new Promise(function(_0x1ff1f7,_0x549162){return db[_0x138d('0x17')]['create'](_0x5bc79a[_0x138d('0x21')],{'raw':_0x5bc79a[_0x138d('0x19')]?_0x5bc79a['options'][_0x138d('0x22')]===undefined?!![]:![]:!![]})[_0x138d('0xc')](function(_0x3a0d82){logger[_0x138d('0x14')](_0x138d('0x20'),_0x5bc79a);logger[_0x138d('0x23')](_0x138d('0x20'),_0x5bc79a,JSON[_0x138d('0x10')](_0x3a0d82));_0x1ff1f7(_0x3a0d82);})[_0x138d('0x15')](function(_0x5a20c2){logger[_0x138d('0x11')](_0x138d('0x20'),_0x5a20c2[_0x138d('0x13')],_0x5bc79a);_0x549162(_0x49ba36[_0x138d('0x11')](0x1f4,_0x5a20c2['message']));});});};exports[_0x138d('0x24')]=function(_0x1c9817){var _0xb4808a=this;return new Promise(function(_0x15ea7b,_0x313bc6){return db[_0x138d('0x17')][_0x138d('0x25')](_0x1c9817[_0x138d('0x21')],{'raw':_0x1c9817[_0x138d('0x19')]?_0x1c9817[_0x138d('0x19')][_0x138d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9817[_0x138d('0x19')]?_0x1c9817['options'][_0x138d('0x1a')]||null:null,'attributes':_0x1c9817[_0x138d('0x19')]?_0x1c9817[_0x138d('0x19')][_0x138d('0x1b')]||null:null,'limit':_0x1c9817['options']?_0x1c9817[_0x138d('0x19')]['limit']||null:null})[_0x138d('0xc')](function(_0x4e1d03){logger[_0x138d('0x14')](_0x138d('0x24'),_0x1c9817);logger[_0x138d('0x23')](_0x138d('0x24'),_0x1c9817,JSON[_0x138d('0x10')](_0x4e1d03));_0x15ea7b(_0x4e1d03);})[_0x138d('0x15')](function(_0x294a87){logger[_0x138d('0x11')](_0x138d('0x24'),_0x294a87[_0x138d('0x13')],_0x1c9817);_0x313bc6(_0xb4808a[_0x138d('0x11')](0x1f4,_0x294a87[_0x138d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ebdf299..515cd36 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 _0xe99f=['path','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1f90ee,_0x2ece8e){var _0x20d35f=function(_0x221035){while(--_0x221035){_0x1f90ee['push'](_0x1f90ee['shift']());}};_0x20d35f(++_0x2ece8e);}(_0xe99f,0xaa));var _0xfe99=function(_0x5b0f2c,_0x3672ec){_0x5b0f2c=_0x5b0f2c-0x0;var _0x201ab9=_0xe99f[_0x5b0f2c];return _0x201ab9;};'use strict';var multer=require(_0xfe99('0x0'));var util=require('util');var path=require(_0xfe99('0x1'));var timeout=require(_0xfe99('0x2'));var express=require(_0xfe99('0x3'));var router=express[_0xfe99('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfe99('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfe99('0x6'));router[_0xfe99('0x7')]('/',auth[_0xfe99('0x8')](),controller[_0xfe99('0x9')]);router[_0xfe99('0x7')](_0xfe99('0xa'),auth[_0xfe99('0x8')](),controller[_0xfe99('0xb')]);router[_0xfe99('0xc')]('/',auth['isAuthenticated'](),controller[_0xfe99('0xd')]);router[_0xfe99('0xe')](_0xfe99('0xa'),auth[_0xfe99('0x8')](),controller[_0xfe99('0xf')]);router[_0xfe99('0x10')]('/:id',auth[_0xfe99('0x8')](),controller[_0xfe99('0x11')]);module[_0xfe99('0x12')]=router; \ No newline at end of file +var _0x6099=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','path','express','fs-extra','./voiceChanSpy.controller'];(function(_0x4319d5,_0x1cf9f7){var _0x332cff=function(_0x53c0e4){while(--_0x53c0e4){_0x4319d5['push'](_0x4319d5['shift']());}};_0x332cff(++_0x1cf9f7);}(_0x6099,0xbf));var _0x9609=function(_0x360e1b,_0x42f6be){_0x360e1b=_0x360e1b-0x0;var _0x4ab785=_0x6099[_0x360e1b];return _0x4ab785;};'use strict';var multer=require(_0x9609('0x0'));var util=require('util');var path=require(_0x9609('0x1'));var timeout=require('connect-timeout');var express=require(_0x9609('0x2'));var router=express['Router']();var fs_extra=require(_0x9609('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9609('0x4'));router[_0x9609('0x5')]('/',auth[_0x9609('0x6')](),controller[_0x9609('0x7')]);router['get'](_0x9609('0x8'),auth['isAuthenticated'](),controller[_0x9609('0x9')]);router[_0x9609('0xa')]('/',auth[_0x9609('0x6')](),controller['create']);router[_0x9609('0xb')](_0x9609('0x8'),auth[_0x9609('0x6')](),controller[_0x9609('0xc')]);router['delete'](_0x9609('0x8'),auth[_0x9609('0x6')](),controller[_0x9609('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 3d62530..ff95a44 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 _0xe48e=['BOOLEAN','sequelize','exports','STRING','name','options','getDataValue'];(function(_0xa8ccab,_0x4d7cae){var _0x570d5f=function(_0x12bb13){while(--_0x12bb13){_0xa8ccab['push'](_0xa8ccab['shift']());}};_0x570d5f(++_0x4d7cae);}(_0xe48e,0xb0));var _0xee48=function(_0x2a93ff,_0x1dd403){_0x2a93ff=_0x2a93ff-0x0;var _0x4cb9d1=_0xe48e[_0x2a93ff];return _0x4cb9d1;};'use strict';var Sequelize=require(_0xee48('0x0'));module[_0xee48('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xee48('0x2')],'unique':_0xee48('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xee48('0x2')],'set':function(_0x345630){this['setDataValue']('options',_0x345630?_0x345630['join'](''):[]);},'get':function(){return this['getDataValue'](_0xee48('0x4'))?this[_0xee48('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xee48('0x2')]},'record':{'type':Sequelize[_0xee48('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xee48('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfaa9=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x3ae333,_0x3050ac){var _0x597178=function(_0x58ab20){while(--_0x58ab20){_0x3ae333['push'](_0x3ae333['shift']());}};_0x597178(++_0x3050ac);}(_0xfaa9,0x1e8));var _0x9faa=function(_0x547ebe,_0x2c4e1a){_0x547ebe=_0x547ebe-0x0;var _0x385764=_0xfaa9[_0x547ebe];return _0x385764;};'use strict';var Sequelize=require('sequelize');module[_0x9faa('0x0')]={'name':{'type':Sequelize[_0x9faa('0x1')]},'prefix':{'type':Sequelize[_0x9faa('0x1')],'unique':_0x9faa('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9faa('0x1')],'set':function(_0x1709ed){this[_0x9faa('0x3')](_0x9faa('0x4'),_0x1709ed?_0x1709ed[_0x9faa('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x9faa('0x4'))?this[_0x9faa('0x6')](_0x9faa('0x4'))[_0x9faa('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9faa('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9faa('0x1')]},'record':{'type':Sequelize[_0x9faa('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9faa('0x1')]},'description':{'type':Sequelize[_0x9faa('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 573b609..1df9457 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 _0x9434=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x1e8d09,_0x290b78){var _0x145fcd=function(_0xcb521b){while(--_0xcb521b){_0x1e8d09['push'](_0x1e8d09['shift']());}};_0x145fcd(++_0x290b78);}(_0x9434,0x168));var _0x4943=function(_0x568c76,_0xc90593){_0x568c76=_0x568c76-0x0;var _0x4c79c5=_0x9434[_0x568c76];return _0x4c79c5;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){var _0x127a53=_0x5dd061[_0x4943('0x22')]({'plain':!![]});var _0x5d8cbe=_0x4943('0x23');return db[_0x4943('0x24')]['destroy']({'where':{'type':_0x5d8cbe,'resourceId':_0x127a53['id']}})[_0x4943('0x21')](function(){return _0x5dd061;});})[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x35f393,_0x16eba6){return function(_0x307478){if(!_0x307478){_0x35f393[_0x4943('0x15')](0x194);}return _0x307478;};}function handleError(_0x3c1c15,_0x3443ca){_0x3443ca=_0x3443ca||0x1f4;return function(_0x170e78){logger[_0x4943('0x25')](_0x170e78[_0x4943('0x26')]);if(_0x170e78[_0x4943('0x27')]){delete _0x170e78[_0x4943('0x27')];}_0x3c1c15[_0x4943('0x16')](_0x3443ca)[_0x4943('0x28')](_0x170e78);};}exports[_0x4943('0x29')]=function(_0x5d792c,_0x43b11f){var _0x5e2e4f={},_0x18b22a={},_0x36999c={'count':0x0,'rows':[]};var _0x2957d2=_[_0x4943('0x2a')](db[_0x4943('0x2b')][_0x4943('0x2c')],function(_0x3dd058){return{'name':_0x3dd058[_0x4943('0x2d')],'type':_0x3dd058['type'][_0x4943('0x2e')]};});_0x18b22a[_0x4943('0x2f')]=_['map'](_0x2957d2,_0x4943('0x27'));_0x18b22a[_0x4943('0x30')]=_['keys'](_0x5d792c[_0x4943('0x30')]);_0x18b22a[_0x4943('0x31')]=_[_0x4943('0x32')](_0x18b22a['model'],_0x18b22a[_0x4943('0x30')]);_0x5e2e4f[_0x4943('0x33')]=_[_0x4943('0x32')](_0x18b22a[_0x4943('0x2f')],qs[_0x4943('0x34')](_0x5d792c['query'][_0x4943('0x34')]));_0x5e2e4f[_0x4943('0x33')]=_0x5e2e4f[_0x4943('0x33')][_0x4943('0x35')]?_0x5e2e4f[_0x4943('0x33')]:_0x18b22a[_0x4943('0x2f')];if(!_0x5d792c[_0x4943('0x30')][_0x4943('0x36')](_0x4943('0x37'))){_0x5e2e4f[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x5d792c['query'][_0x4943('0x1b')]);_0x5e2e4f[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x5d792c[_0x4943('0x30')][_0x4943('0x19')]);}_0x5e2e4f['order']=qs['sort'](_0x5d792c['query'][_0x4943('0x38')]);_0x5e2e4f[_0x4943('0x39')]=qs['filters'](_[_0x4943('0x3a')](_0x5d792c['query'],_0x18b22a[_0x4943('0x31')]),_0x2957d2);if(_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]){_0x5e2e4f[_0x4943('0x39')]=_[_0x4943('0x3c')](_0x5e2e4f[_0x4943('0x39')],{'$or':_[_0x4943('0x2a')](_0x2957d2,function(_0x86a31c){if(_0x86a31c[_0x4943('0x3d')]!==_0x4943('0x3e')){var _0x25d36e={};_0x25d36e[_0x86a31c[_0x4943('0x27')]]={'$like':'%'+_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]+'%'};return _0x25d36e;}})});}_0x5e2e4f=_[_0x4943('0x3c')]({},_0x5e2e4f,_0x5d792c[_0x4943('0x3f')]);var _0xbe0e00={'where':_0x5e2e4f[_0x4943('0x39')]};return db[_0x4943('0x2b')][_0x4943('0x1c')](_0xbe0e00)[_0x4943('0x21')](function(_0x11ee4a){_0x36999c[_0x4943('0x1c')]=_0x11ee4a;if(_0x5d792c[_0x4943('0x30')][_0x4943('0x40')]){_0x5e2e4f[_0x4943('0x41')]=[{'all':!![]}];}return db[_0x4943('0x2b')]['findAll'](_0x5e2e4f);})[_0x4943('0x21')](function(_0x147179){_0x36999c['rows']=_0x147179;return _0x36999c;})['then'](respondWithFilteredResult(_0x43b11f,_0x5e2e4f))[_0x4943('0x42')](handleError(_0x43b11f,null));};exports['show']=function(_0x1479a7,_0x498a5e){var _0xe11bdf={'raw':![],'where':{'id':_0x1479a7[_0x4943('0x43')]['id']}},_0x54db13={};_0x54db13['model']=_[_0x4943('0x44')](db[_0x4943('0x2b')][_0x4943('0x2c')]);_0x54db13['query']=_['keys'](_0x1479a7[_0x4943('0x30')]);_0x54db13['filters']=_[_0x4943('0x32')](_0x54db13['model'],_0x54db13[_0x4943('0x30')]);_0xe11bdf[_0x4943('0x33')]=_[_0x4943('0x32')](_0x54db13[_0x4943('0x2f')],qs['fields'](_0x1479a7['query'][_0x4943('0x34')]));_0xe11bdf['attributes']=_0xe11bdf['attributes'][_0x4943('0x35')]?_0xe11bdf[_0x4943('0x33')]:_0x54db13[_0x4943('0x2f')];if(_0x1479a7[_0x4943('0x30')][_0x4943('0x40')]){_0xe11bdf[_0x4943('0x41')]=[{'all':!![]}];}_0xe11bdf=_[_0x4943('0x3c')]({},_0xe11bdf,_0x1479a7['options']);return db[_0x4943('0x2b')][_0x4943('0x45')](_0xe11bdf)['then'](handleEntityNotFound(_0x498a5e,null))[_0x4943('0x21')](respondWithResult(_0x498a5e,null))[_0x4943('0x42')](handleError(_0x498a5e,null));};exports[_0x4943('0x46')]=function(_0x4d1a31,_0x350f55){return db[_0x4943('0x2b')]['create'](_0x4d1a31[_0x4943('0x47')],{})[_0x4943('0x21')](function(_0x5d0b9b){var _0x445908=_0x4d1a31[_0x4943('0x48')][_0x4943('0x22')]({'plain':!![]});if(!_0x445908)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445908[_0x4943('0x49')]==='user'){var _0x51636a=_0x5d0b9b[_0x4943('0x22')]({'plain':!![]});var _0x33a332=_0x4943('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x33a332,'userProfileId':_0x445908['userProfileId']},'raw':!![]})[_0x4943('0x21')](function(_0x49fbfb){if(_0x49fbfb&&_0x49fbfb['autoAssociation']===0x0){return db[_0x4943('0x24')]['create']({'name':_0x51636a['name'],'resourceId':_0x51636a['id'],'type':_0x49fbfb['name'],'sectionId':_0x49fbfb['id']},{})[_0x4943('0x21')](function(){return _0x5d0b9b;});}else{return _0x5d0b9b;}})[_0x4943('0x42')](function(_0x24288a){logger['error'](_0x4943('0x4a'),_0x24288a);throw _0x24288a;});}return _0x5d0b9b;})[_0x4943('0x21')](respondWithResult(_0x350f55,0xc9))[_0x4943('0x42')](handleError(_0x350f55,null));};exports['update']=function(_0x17f132,_0x44bcae){if(_0x17f132['body']['id']){delete _0x17f132['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x17f132[_0x4943('0x43')]['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x44bcae,null))[_0x4943('0x21')](saveUpdates(_0x17f132[_0x4943('0x47')],null))['then'](respondWithResult(_0x44bcae,null))[_0x4943('0x42')](handleError(_0x44bcae,null));};exports['destroy']=function(_0x574e4b,_0x22cda5){return db[_0x4943('0x2b')][_0x4943('0x45')]({'where':{'id':_0x574e4b['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x22cda5,null))[_0x4943('0x21')](removeEntity(_0x22cda5,null))[_0x4943('0x42')](handleError(_0x22cda5,null));}; \ No newline at end of file +var _0x7846=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','send','index','map','VoiceChanSpy','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7846,0xf4));var _0x6784=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0x7846[_0x5c6ceb];return _0x28821b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6784('0x0'));var zipdir=require(_0x6784('0x1'));var jsonpatch=require(_0x6784('0x2'));var rp=require(_0x6784('0x3'));var moment=require(_0x6784('0x4'));var BPromise=require(_0x6784('0x5'));var Mustache=require('mustache');var util=require(_0x6784('0x6'));var path=require(_0x6784('0x7'));var sox=require(_0x6784('0x8'));var csv=require(_0x6784('0x9'));var ejs=require(_0x6784('0xa'));var fs=require('fs');var fs_extra=require(_0x6784('0xb'));var _=require(_0x6784('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6784('0xd'));var deskjs=require(_0x6784('0xe'));var toCsv=require(_0x6784('0x9'));var querystring=require(_0x6784('0xf'));var Papa=require(_0x6784('0x10'));var Redis=require(_0x6784('0x11'));var authService=require(_0x6784('0x12'));var qs=require(_0x6784('0x13'));var as=require(_0x6784('0x14'));var hardwareService=require(_0x6784('0x15'));var logger=require(_0x6784('0x16'))(_0x6784('0x17'));var utils=require(_0x6784('0x18'));var config=require(_0x6784('0x19'));var licenseUtil=require(_0x6784('0x1a'));var db=require(_0x6784('0x1b'))['db'];function respondWithStatusCode(_0x5a43c1,_0x221cb8){_0x221cb8=_0x221cb8||0xcc;return function(_0x42cd0f){if(_0x42cd0f){return _0x5a43c1[_0x6784('0x1c')](_0x221cb8);}return _0x5a43c1[_0x6784('0x1d')](_0x221cb8)['end']();};}function respondWithResult(_0x18b8a9,_0x681759){_0x681759=_0x681759||0xc8;return function(_0x62426d){if(_0x62426d){return _0x18b8a9[_0x6784('0x1d')](_0x681759)[_0x6784('0x1e')](_0x62426d);}};}function respondWithFilteredResult(_0x18929b,_0x474511){return function(_0x32eaf2){if(_0x32eaf2){var _0x1db6be=typeof _0x474511[_0x6784('0x1f')]===_0x6784('0x20')&&typeof _0x474511['limit']===_0x6784('0x20');var _0x575d8=_0x32eaf2[_0x6784('0x21')];var _0x2fd8a2=_0x1db6be?0x0:_0x474511['offset'];var _0x23f32e=_0x1db6be?_0x32eaf2[_0x6784('0x21')]:_0x474511[_0x6784('0x1f')]+_0x474511[_0x6784('0x22')];var _0x338067;if(_0x23f32e>=_0x575d8){_0x23f32e=_0x575d8;_0x338067=0xc8;}else{_0x338067=0xce;}_0x18929b['status'](_0x338067);return _0x18929b[_0x6784('0x23')](_0x6784('0x24'),_0x2fd8a2+'-'+_0x23f32e+'/'+_0x575d8)['json'](_0x32eaf2);}return null;};}function patchUpdates(_0x3f4178){return function(_0x2eeed8){try{jsonpatch[_0x6784('0x25')](_0x2eeed8,_0x3f4178,!![]);}catch(_0x461ced){return BPromise['reject'](_0x461ced);}return _0x2eeed8[_0x6784('0x26')]();};}function saveUpdates(_0x225a9e,_0x581690){return function(_0x37aea3){if(_0x37aea3){return _0x37aea3[_0x6784('0x27')](_0x225a9e)[_0x6784('0x28')](function(_0x305d64){return _0x305d64;});}return null;};}function removeEntity(_0x3cdfe2,_0x140a38){return function(_0x5452a8){if(_0x5452a8){return _0x5452a8[_0x6784('0x29')]()[_0x6784('0x28')](function(){var _0x37aa8f=_0x5452a8[_0x6784('0x2a')]({'plain':!![]});var _0x4ac355=_0x6784('0x2b');return db[_0x6784('0x2c')][_0x6784('0x29')]({'where':{'type':_0x4ac355,'resourceId':_0x37aa8f['id']}})['then'](function(){return _0x5452a8;});})[_0x6784('0x28')](function(){_0x3cdfe2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cbe4,_0x2dc02c){return function(_0x17346b){if(!_0x17346b){_0x51cbe4[_0x6784('0x1c')](0x194);}return _0x17346b;};}function handleError(_0x202a0e,_0x151340){_0x151340=_0x151340||0x1f4;return function(_0x280b56){logger['error'](_0x280b56[_0x6784('0x2d')]);if(_0x280b56['name']){delete _0x280b56['name'];}_0x202a0e['status'](_0x151340)[_0x6784('0x2e')](_0x280b56);};}exports[_0x6784('0x2f')]=function(_0x461057,_0x2036d6){var _0x204fba={},_0x5e465c={},_0x2e0b03={'count':0x0,'rows':[]};var _0x32e3cc=_[_0x6784('0x30')](db[_0x6784('0x31')][_0x6784('0x32')],function(_0xd9de69){return{'name':_0xd9de69['fieldName'],'type':_0xd9de69[_0x6784('0x33')]['key']};});_0x5e465c['model']=_[_0x6784('0x30')](_0x32e3cc,_0x6784('0x34'));_0x5e465c[_0x6784('0x35')]=_[_0x6784('0x36')](_0x461057['query']);_0x5e465c[_0x6784('0x37')]=_[_0x6784('0x38')](_0x5e465c[_0x6784('0x39')],_0x5e465c[_0x6784('0x35')]);_0x204fba[_0x6784('0x3a')]=_[_0x6784('0x38')](_0x5e465c[_0x6784('0x39')],qs[_0x6784('0x3b')](_0x461057['query']['fields']));_0x204fba[_0x6784('0x3a')]=_0x204fba['attributes'][_0x6784('0x3c')]?_0x204fba['attributes']:_0x5e465c[_0x6784('0x39')];if(!_0x461057['query'][_0x6784('0x3d')]('nolimit')){_0x204fba[_0x6784('0x22')]=qs[_0x6784('0x22')](_0x461057['query']['limit']);_0x204fba[_0x6784('0x1f')]=qs[_0x6784('0x1f')](_0x461057[_0x6784('0x35')]['offset']);}_0x204fba['order']=qs['sort'](_0x461057[_0x6784('0x35')][_0x6784('0x3e')]);_0x204fba[_0x6784('0x3f')]=qs[_0x6784('0x37')](_[_0x6784('0x40')](_0x461057['query'],_0x5e465c[_0x6784('0x37')]),_0x32e3cc);if(_0x461057[_0x6784('0x35')][_0x6784('0x41')]){_0x204fba[_0x6784('0x3f')]=_[_0x6784('0x42')](_0x204fba[_0x6784('0x3f')],{'$or':_['map'](_0x32e3cc,function(_0x2b1090){if(_0x2b1090[_0x6784('0x33')]!==_0x6784('0x43')){var _0x5f65a9={};_0x5f65a9[_0x2b1090[_0x6784('0x34')]]={'$like':'%'+_0x461057[_0x6784('0x35')][_0x6784('0x41')]+'%'};return _0x5f65a9;}})});}_0x204fba=_[_0x6784('0x42')]({},_0x204fba,_0x461057[_0x6784('0x44')]);var _0x373921={'where':_0x204fba[_0x6784('0x3f')]};return db[_0x6784('0x31')]['count'](_0x373921)['then'](function(_0x11e22d){_0x2e0b03[_0x6784('0x21')]=_0x11e22d;if(_0x461057['query'][_0x6784('0x45')]){_0x204fba[_0x6784('0x46')]=[{'all':!![]}];}return db[_0x6784('0x31')][_0x6784('0x47')](_0x204fba);})[_0x6784('0x28')](function(_0x2ccb02){_0x2e0b03['rows']=_0x2ccb02;return _0x2e0b03;})['then'](respondWithFilteredResult(_0x2036d6,_0x204fba))[_0x6784('0x48')](handleError(_0x2036d6,null));};exports['show']=function(_0x14cbd8,_0x2497ce){var _0x28e519={'raw':![],'where':{'id':_0x14cbd8[_0x6784('0x49')]['id']}},_0x549dfb={};_0x549dfb[_0x6784('0x39')]=_[_0x6784('0x36')](db[_0x6784('0x31')]['rawAttributes']);_0x549dfb[_0x6784('0x35')]=_['keys'](_0x14cbd8['query']);_0x549dfb[_0x6784('0x37')]=_[_0x6784('0x38')](_0x549dfb['model'],_0x549dfb['query']);_0x28e519[_0x6784('0x3a')]=_[_0x6784('0x38')](_0x549dfb[_0x6784('0x39')],qs['fields'](_0x14cbd8[_0x6784('0x35')][_0x6784('0x3b')]));_0x28e519['attributes']=_0x28e519[_0x6784('0x3a')][_0x6784('0x3c')]?_0x28e519[_0x6784('0x3a')]:_0x549dfb['model'];if(_0x14cbd8[_0x6784('0x35')][_0x6784('0x45')]){_0x28e519[_0x6784('0x46')]=[{'all':!![]}];}_0x28e519=_[_0x6784('0x42')]({},_0x28e519,_0x14cbd8[_0x6784('0x44')]);return db[_0x6784('0x31')][_0x6784('0x4a')](_0x28e519)[_0x6784('0x28')](handleEntityNotFound(_0x2497ce,null))[_0x6784('0x28')](respondWithResult(_0x2497ce,null))[_0x6784('0x48')](handleError(_0x2497ce,null));};exports['create']=function(_0x4c332e,_0x3955c7){return db[_0x6784('0x31')][_0x6784('0x4b')](_0x4c332e['body'],{})[_0x6784('0x28')](function(_0x5dcadf){var _0x2deb8d=_0x4c332e[_0x6784('0x4c')]['get']({'plain':!![]});if(!_0x2deb8d)throw new Error(_0x6784('0x4d'));if(_0x2deb8d['role']==='user'){var _0x3f3715=_0x5dcadf[_0x6784('0x2a')]({'plain':!![]});var _0x2603f1=_0x6784('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2603f1,'userProfileId':_0x2deb8d[_0x6784('0x4e')]},'raw':!![]})[_0x6784('0x28')](function(_0x5b4801){if(_0x5b4801&&_0x5b4801[_0x6784('0x4f')]===0x0){return db[_0x6784('0x2c')][_0x6784('0x4b')]({'name':_0x3f3715[_0x6784('0x34')],'resourceId':_0x3f3715['id'],'type':_0x5b4801[_0x6784('0x34')],'sectionId':_0x5b4801['id']},{})[_0x6784('0x28')](function(){return _0x5dcadf;});}else{return _0x5dcadf;}})[_0x6784('0x48')](function(_0x408763){logger[_0x6784('0x50')](_0x6784('0x51'),_0x408763);throw _0x408763;});}return _0x5dcadf;})[_0x6784('0x28')](respondWithResult(_0x3955c7,0xc9))['catch'](handleError(_0x3955c7,null));};exports[_0x6784('0x27')]=function(_0x2aaf8b,_0x37d00b){if(_0x2aaf8b[_0x6784('0x52')]['id']){delete _0x2aaf8b[_0x6784('0x52')]['id'];}return db[_0x6784('0x31')][_0x6784('0x4a')]({'where':{'id':_0x2aaf8b[_0x6784('0x49')]['id']}})['then'](handleEntityNotFound(_0x37d00b,null))[_0x6784('0x28')](saveUpdates(_0x2aaf8b[_0x6784('0x52')],null))[_0x6784('0x28')](respondWithResult(_0x37d00b,null))[_0x6784('0x48')](handleError(_0x37d00b,null));};exports[_0x6784('0x29')]=function(_0x176f33,_0xbed6df){return db[_0x6784('0x31')][_0x6784('0x4a')]({'where':{'id':_0x176f33[_0x6784('0x49')]['id']}})[_0x6784('0x28')](handleEntityNotFound(_0xbed6df,null))[_0x6784('0x28')](removeEntity(_0xbed6df,null))[_0x6784('0x48')](handleError(_0xbed6df,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2bb2645..6e28f6a 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 _0x6672=['context','from-sip','%s%s','prefix','system','merge','record','push','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','internal','name','concat','User','agent','then','exports','models','VoiceChanSpy','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes'];(function(_0x273bb2,_0x319264){var _0x22f932=function(_0x2124ba){while(--_0x2124ba){_0x273bb2['push'](_0x273bb2['shift']());}};_0x22f932(++_0x319264);}(_0x6672,0x89));var _0x2667=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x6672[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0x2667('0x0'));var util=require('util');var BPromise=require(_0x2667('0x1'));var attributes=require(_0x2667('0x2'));var getUserApplications=function(_0x3ed6ee,_0x86401a,_0x58ea0c){var _0x2f4f8b=0x1;var _0x1f51b5=[];var _0x47c4dc={'context':_0x86401a[_0x2667('0x3')]||_0x2667('0x4'),'exten':util['format'](_0x2667('0x5'),_0x3ed6ee[_0x2667('0x6')],_0x58ea0c),'type':_0x2667('0x7'),'isApp':![],'ChanSpyId':_0x3ed6ee['id'],'UserId':_0x86401a['id']};_0x1f51b5['push'](_[_0x2667('0x8')]({'app':'Set','appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x2f4f8b++},_0x47c4dc));if(_0x3ed6ee[_0x2667('0x9')]){_0x1f51b5[_0x2667('0xa')](_[_0x2667('0x8')]({'app':_0x2667('0xb'),'appdata':util[_0x2667('0xc')](_0x2667('0xd'),_0x3ed6ee[_0x2667('0xe')]),'priority':_0x2f4f8b++},_0x47c4dc));}if(_0x3ed6ee['auth']){_0x1f51b5[_0x2667('0xa')](_['merge']({'app':'Authenticate','appdata':_0x3ed6ee[_0x2667('0xf')],'priority':_0x2f4f8b++},_0x47c4dc));}_0x1f51b5['push'](_[_0x2667('0x8')]({'app':_0x2667('0x10'),'appdata':util[_0x2667('0xc')](_0x2667('0x11'),_0x86401a['name'],_0x3ed6ee[_0x2667('0x12')]?_0x3ed6ee[_0x2667('0x12')][_0x2667('0x13')](''):''),'priority':_0x2f4f8b++},_0x47c4dc));if(_0x3ed6ee[_0x2667('0x9')]){_0x1f51b5['push'](_[_0x2667('0x8')]({'app':_0x2667('0x14'),'priority':_0x2f4f8b++},_0x47c4dc));}return _0x1f51b5;};var getChanSpyApplications=function(_0x59644b,_0x24dcd1){var _0xd3af95=[];for(var _0x5e954d=0x0,_0x385fba=0x1;_0x5e954d<_0x24dcd1[_0x2667('0x15')];_0x5e954d++,_0x385fba=0x1){_0xd3af95=_0xd3af95['concat'](getUserApplications(_0x59644b,_0x24dcd1[_0x5e954d],_0x24dcd1[_0x5e954d][_0x2667('0x16')]));if(_0x24dcd1[_0x5e954d][_0x2667('0x16')]!=_0x24dcd1[_0x5e954d][_0x2667('0x17')]){_0xd3af95=_0xd3af95[_0x2667('0x18')](getUserApplications(_0x59644b,_0x24dcd1[_0x5e954d],_0x24dcd1[_0x5e954d][_0x2667('0x17')]));}}return _0xd3af95;};var getChanSpyPromise=function(_0x101f41,_0xebb86e){return new BPromise(function(_0x49d9f1,_0x185f20){return _0x101f41[_0x2667('0x19')]['findAll']({'attributes':['id',_0x2667('0x17'),_0x2667('0x16')],'where':{'role':_0x2667('0x1a'),'chanspy':!![]},'raw':!![]})[_0x2667('0x1b')](function(_0x1cf32d){if(_0x1cf32d){return _0x49d9f1(getChanSpyApplications(_0xebb86e,_0x1cf32d));}return _0x49d9f1([]);})['catch'](function(_0x3bfce9){_0x185f20(_0x3bfce9);});});};module[_0x2667('0x1c')]=function(_0x248818,_0x46e826){var _0x46157f=_0x248818[_0x2667('0x1d')];return _0x248818['define'](_0x2667('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x12ee65,_0x34c497,_0x101525){return getChanSpyPromise(_0x46157f,_0x12ee65)[_0x2667('0x1b')](function(_0xad7e63){if(_0xad7e63&&_0xad7e63[_0x2667('0x15')]){return _0x46157f[_0x2667('0x1f')][_0x2667('0x20')](_0xad7e63);}})[_0x2667('0x1b')](function(){_0x101525();})[_0x2667('0x21')](function(_0x2a4127){_0x101525(_0x2a4127);});},'afterUpdate':function(_0x164511,_0x42958b,_0x25eca3){return _0x46157f[_0x2667('0x1f')]['destroy']({'where':{'ChanSpyId':_0x164511['id']}})[_0x2667('0x1b')](function(){return getChanSpyPromise(_0x46157f,_0x164511);})['then'](function(_0x1eb723){if(_0x1eb723&&_0x1eb723[_0x2667('0x15')]){return _0x46157f[_0x2667('0x1f')]['bulkCreate'](_0x1eb723);}})[_0x2667('0x1b')](function(){_0x25eca3();})[_0x2667('0x21')](function(_0xc3c5ad){_0x25eca3(_0xc3c5ad);});},'afterDestroy':function(_0x1d58cb,_0x13b59c,_0x431b09){return _0x46157f[_0x2667('0x1f')][_0x2667('0x22')]({'where':{'ChanSpyId':_0x1d58cb['id']}})[_0x2667('0x1b')](function(){_0x431b09();})[_0x2667('0x21')](function(_0x125756){_0x431b09(_0x125756);});}}});}; \ No newline at end of file +var _0x6e01=['internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','merge','chanspy','record','MixMonitor','recordingFormat','push','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat'];(function(_0x447d73,_0x50f8c7){var _0x343b07=function(_0x467a77){while(--_0x467a77){_0x447d73['push'](_0x447d73['shift']());}};_0x343b07(++_0x50f8c7);}(_0x6e01,0x161));var _0x16e0=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x6e01[_0x1d211b];return _0x47c88b;};'use strict';var _=require('lodash');var util=require(_0x16e0('0x0'));var BPromise=require('bluebird');var attributes=require(_0x16e0('0x1'));var getUserApplications=function(_0x4c27c2,_0x958b4c,_0x1de726){var _0x284975=0x1;var _0x48ca79=[];var _0x5132a7={'context':_0x958b4c['context']||_0x16e0('0x2'),'exten':util[_0x16e0('0x3')](_0x16e0('0x4'),_0x4c27c2[_0x16e0('0x5')],_0x1de726),'type':'system','isApp':![],'ChanSpyId':_0x4c27c2['id'],'UserId':_0x958b4c['id']};_0x48ca79['push'](_[_0x16e0('0x6')]({'app':'Set','appdata':util[_0x16e0('0x3')]('CDR(type)=%s',_0x16e0('0x7')),'priority':_0x284975++},_0x5132a7));if(_0x4c27c2[_0x16e0('0x8')]){_0x48ca79['push'](_[_0x16e0('0x6')]({'app':_0x16e0('0x9'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x4c27c2[_0x16e0('0xa')]),'priority':_0x284975++},_0x5132a7));}if(_0x4c27c2['auth']){_0x48ca79[_0x16e0('0xb')](_[_0x16e0('0x6')]({'app':_0x16e0('0xc'),'appdata':_0x4c27c2[_0x16e0('0xd')],'priority':_0x284975++},_0x5132a7));}_0x48ca79[_0x16e0('0xb')](_['merge']({'app':_0x16e0('0xe'),'appdata':util['format'](_0x16e0('0xf'),_0x958b4c[_0x16e0('0x10')],_0x4c27c2[_0x16e0('0x11')]?_0x4c27c2[_0x16e0('0x11')][_0x16e0('0x12')](''):''),'priority':_0x284975++},_0x5132a7));if(_0x4c27c2[_0x16e0('0x8')]){_0x48ca79['push'](_['merge']({'app':'StopMixMonitor','priority':_0x284975++},_0x5132a7));}return _0x48ca79;};var getChanSpyApplications=function(_0x2480f0,_0x55cd51){var _0x3a2b35=[];for(var _0x43b428=0x0,_0x44cb54=0x1;_0x43b428<_0x55cd51[_0x16e0('0x13')];_0x43b428++,_0x44cb54=0x1){_0x3a2b35=_0x3a2b35[_0x16e0('0x14')](getUserApplications(_0x2480f0,_0x55cd51[_0x43b428],_0x55cd51[_0x43b428]['internal']));if(_0x55cd51[_0x43b428][_0x16e0('0x15')]!=_0x55cd51[_0x43b428]['name']){_0x3a2b35=_0x3a2b35[_0x16e0('0x14')](getUserApplications(_0x2480f0,_0x55cd51[_0x43b428],_0x55cd51[_0x43b428][_0x16e0('0x10')]));}}return _0x3a2b35;};var getChanSpyPromise=function(_0x460715,_0x26af56){return new BPromise(function(_0x3a3fc0,_0x5684c7){return _0x460715[_0x16e0('0x16')][_0x16e0('0x17')]({'attributes':['id',_0x16e0('0x10'),_0x16e0('0x15')],'where':{'role':_0x16e0('0x18'),'chanspy':!![]},'raw':!![]})[_0x16e0('0x19')](function(_0x1e9e0a){if(_0x1e9e0a){return _0x3a3fc0(getChanSpyApplications(_0x26af56,_0x1e9e0a));}return _0x3a3fc0([]);})[_0x16e0('0x1a')](function(_0x20696c){_0x5684c7(_0x20696c);});});};module[_0x16e0('0x1b')]=function(_0xdddba,_0x1dfd16){var _0x4e575f=_0xdddba[_0x16e0('0x1c')];return _0xdddba['define'](_0x16e0('0x1d'),attributes,{'tableName':_0x16e0('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc55ce2,_0x2eaf9a,_0x54133c){return getChanSpyPromise(_0x4e575f,_0xc55ce2)[_0x16e0('0x19')](function(_0x32669b){if(_0x32669b&&_0x32669b[_0x16e0('0x13')]){return _0x4e575f[_0x16e0('0x1f')][_0x16e0('0x20')](_0x32669b);}})['then'](function(){_0x54133c();})[_0x16e0('0x1a')](function(_0x13fffe){_0x54133c(_0x13fffe);});},'afterUpdate':function(_0x57bb72,_0x2ef0a4,_0x793463){return _0x4e575f['VoiceExtension'][_0x16e0('0x21')]({'where':{'ChanSpyId':_0x57bb72['id']}})[_0x16e0('0x19')](function(){return getChanSpyPromise(_0x4e575f,_0x57bb72);})[_0x16e0('0x19')](function(_0x5e2d2a){if(_0x5e2d2a&&_0x5e2d2a[_0x16e0('0x13')]){return _0x4e575f[_0x16e0('0x1f')]['bulkCreate'](_0x5e2d2a);}})[_0x16e0('0x19')](function(){_0x793463();})['catch'](function(_0x5b01b9){_0x793463(_0x5b01b9);});},'afterDestroy':function(_0x20e425,_0x1d2d5c,_0xd5f5b6){return _0x4e575f[_0x16e0('0x1f')][_0x16e0('0x21')]({'where':{'ChanSpyId':_0x20e425['id']}})['then'](function(){_0xd5f5b6();})[_0x16e0('0x1a')](function(_0x6cfc93){_0xd5f5b6(_0x6cfc93);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 99f3ac6..ac0b853 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 _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3d0888,_0xa332cf){var _0x18d0aa=function(_0x197c11){while(--_0x197c11){_0x3d0888['push'](_0x3d0888['shift']());}};_0x18d0aa(++_0xa332cf);}(_0xeb74,0xe3));var _0x4eb7=function(_0xd5f507,_0x589b2){_0xd5f507=_0xd5f507-0x0;var _0x1c2210=_0xeb74[_0xd5f507];return _0x1c2210;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file +var _0x049e=['then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x049e,0x16a));var _0xe049=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x049e[_0x5a8aa3];return _0x5d0458;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0ea2b30..02141a8 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 _0xf238=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','post','put','/:id'];(function(_0x4cbd4b,_0x1fb536){var _0x5d4e43=function(_0x25b8c5){while(--_0x25b8c5){_0x4cbd4b['push'](_0x4cbd4b['shift']());}};_0x5d4e43(++_0x1fb536);}(_0xf238,0x6a));var _0x8f23=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xf238[_0xb65e77];return _0x38134b;};'use strict';var multer=require(_0x8f23('0x0'));var util=require(_0x8f23('0x1'));var path=require('path');var timeout=require(_0x8f23('0x2'));var express=require(_0x8f23('0x3'));var router=express[_0x8f23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8f23('0x5'));var interaction=require(_0x8f23('0x6'));var config=require(_0x8f23('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x8f23('0x8')](),controller[_0x8f23('0x9')]);router['get']('/:id',auth[_0x8f23('0x8')](),controller['show']);router[_0x8f23('0xa')]('/',auth[_0x8f23('0x8')](),controller['create']);router[_0x8f23('0xb')](_0x8f23('0xc'),auth[_0x8f23('0x8')](),controller[_0x8f23('0xd')]);router[_0x8f23('0xe')](_0x8f23('0xc'),auth[_0x8f23('0x8')](),controller[_0x8f23('0xf')]);module[_0x8f23('0x10')]=router; \ No newline at end of file +var _0x7af4=['get','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller'];(function(_0x5cbb32,_0x233ace){var _0x49363c=function(_0x4649d1){while(--_0x4649d1){_0x5cbb32['push'](_0x5cbb32['shift']());}};_0x49363c(++_0x233ace);}(_0x7af4,0x1cb));var _0x47af=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0x7af4[_0x6c59fc];return _0x17c96f;};'use strict';var multer=require(_0x47af('0x0'));var util=require(_0x47af('0x1'));var path=require(_0x47af('0x2'));var timeout=require(_0x47af('0x3'));var express=require(_0x47af('0x4'));var router=express[_0x47af('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x47af('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47af('0x7'));var controller=require(_0x47af('0x8'));router[_0x47af('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x47af('0x9')](_0x47af('0xa'),auth[_0x47af('0xb')](),controller[_0x47af('0xc')]);router[_0x47af('0xd')]('/',auth[_0x47af('0xb')](),controller[_0x47af('0xe')]);router['put']('/:id',auth[_0x47af('0xb')](),controller[_0x47af('0xf')]);router['delete'](_0x47af('0xa'),auth['isAuthenticated'](),controller[_0x47af('0x10')]);module[_0x47af('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c609c77..ee95539 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 _0x7f65=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x2c4ddc,_0x588329){var _0x479593=function(_0x3d66be){while(--_0x3d66be){_0x2c4ddc['push'](_0x2c4ddc['shift']());}};_0x479593(++_0x588329);}(_0x7f65,0x166));var _0x57f6=function(_0x3f480b,_0x176962){_0x3f480b=_0x3f480b-0x0;var _0x40d04c=_0x7f65[_0x3f480b];return _0x40d04c;};'use strict';var Sequelize=require(_0x57f6('0x0'));module[_0x57f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x57f6('0x2')},'description':{'type':Sequelize[_0x57f6('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x57f6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ded=['name','BOOLEAN'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x0ded,0x156));var _0xd0de=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x0ded[_0x4e21ba];return _0x55b94b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd0de('0x0')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd0de('0x1')],'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 9c5218b..4d1cbef 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 _0x99c8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','get','Contexts','UserProfileResource','destroy','end','stack','name','index','map','VoiceContext','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','join'];(function(_0x1daac0,_0x4e6fde){var _0x46ee62=function(_0x10b588){while(--_0x10b588){_0x1daac0['push'](_0x1daac0['shift']());}};_0x46ee62(++_0x4e6fde);}(_0x99c8,0x13b));var _0x899c=function(_0x476ce7,_0x1cb22c){_0x476ce7=_0x476ce7-0x0;var _0x9ea355=_0x99c8[_0x476ce7];return _0x9ea355;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x899c('0x0'));var jsonpatch=require(_0x899c('0x1'));var rp=require(_0x899c('0x2'));var moment=require(_0x899c('0x3'));var BPromise=require(_0x899c('0x4'));var Mustache=require(_0x899c('0x5'));var util=require(_0x899c('0x6'));var path=require(_0x899c('0x7'));var sox=require(_0x899c('0x8'));var csv=require(_0x899c('0x9'));var ejs=require(_0x899c('0xa'));var fs=require('fs');var fs_extra=require(_0x899c('0xb'));var _=require(_0x899c('0xc'));var squel=require(_0x899c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x899c('0xe'));var toCsv=require(_0x899c('0x9'));var querystring=require(_0x899c('0xf'));var Papa=require(_0x899c('0x10'));var Redis=require(_0x899c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x899c('0x12'));var as=require(_0x899c('0x13'));var hardwareService=require(_0x899c('0x14'));var logger=require(_0x899c('0x15'))('api');var utils=require(_0x899c('0x16'));var config=require(_0x899c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x899c('0x18'))['db'];var jayson=require(_0x899c('0x19'));var client=jayson[_0x899c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4018d8,_0x2c1e71,_0x148e13,_0x13b50e){return new BPromise(function(_0x9c5e57,_0x27327a){var _0x1f035a=_0x13b50e||client;return _0x1f035a[_0x899c('0x1b')](_0x4018d8,_0x148e13)[_0x899c('0x1c')](function(_0x1f345d){logger[_0x899c('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x2c1e71,_0x899c('0x1e'));logger[_0x899c('0x1f')](_0x899c('0x20'),_0x2c1e71,_0x899c('0x1e'),JSON[_0x899c('0x21')](_0x1f345d));if(_0x1f345d[_0x899c('0x22')]){if(_0x1f345d[_0x899c('0x22')][_0x899c('0x23')]===0x1f4){logger[_0x899c('0x22')](_0x899c('0x24'),_0x2c1e71,_0x1f345d[_0x899c('0x22')][_0x899c('0x25')]);return _0x27327a(_0x1f345d[_0x899c('0x22')][_0x899c('0x25')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2c1e71,_0x1f345d[_0x899c('0x22')][_0x899c('0x25')]);return _0x9c5e57(_0x1f345d['error'][_0x899c('0x25')]);}else{logger[_0x899c('0x1d')](_0x899c('0x24'),_0x2c1e71,_0x899c('0x1e'));_0x9c5e57(_0x1f345d[_0x899c('0x26')][_0x899c('0x25')]);}})['catch'](function(_0x585be1){logger['error'](_0x899c('0x24'),_0x2c1e71,_0x585be1);_0x27327a(_0x585be1);});});}function respondWithStatusCode(_0xe516e0,_0xf23798){_0xf23798=_0xf23798||0xcc;return function(_0x152c2c){if(_0x152c2c){return _0xe516e0[_0x899c('0x27')](_0xf23798);}return _0xe516e0[_0x899c('0x28')](_0xf23798)['end']();};}function respondWithResult(_0x230327,_0x467742){_0x467742=_0x467742||0xc8;return function(_0x44a070){if(_0x44a070){return _0x230327['status'](_0x467742)[_0x899c('0x29')](_0x44a070);}};}function respondWithFilteredResult(_0x137a1c,_0xc6ca19){return function(_0x52cab9){if(_0x52cab9){var _0x51dae7=typeof _0xc6ca19[_0x899c('0x2a')]===_0x899c('0x2b')&&typeof _0xc6ca19[_0x899c('0x2c')]===_0x899c('0x2b');var _0x466148=_0x52cab9[_0x899c('0x2d')];var _0x494809=_0x51dae7?0x0:_0xc6ca19[_0x899c('0x2a')];var _0x3b1c95=_0x51dae7?_0x52cab9[_0x899c('0x2d')]:_0xc6ca19['offset']+_0xc6ca19['limit'];var _0x3ff0d1;if(_0x3b1c95>=_0x466148){_0x3b1c95=_0x466148;_0x3ff0d1=0xc8;}else{_0x3ff0d1=0xce;}_0x137a1c['status'](_0x3ff0d1);return _0x137a1c['set'](_0x899c('0x2e'),_0x494809+'-'+_0x3b1c95+'/'+_0x466148)[_0x899c('0x29')](_0x52cab9);}return null;};}function patchUpdates(_0x3980c6){return function(_0x2c478a){try{jsonpatch['apply'](_0x2c478a,_0x3980c6,!![]);}catch(_0x43f403){return BPromise[_0x899c('0x2f')](_0x43f403);}return _0x2c478a[_0x899c('0x30')]();};}function saveUpdates(_0x40d6bc,_0x55e903){return function(_0x202f3f){if(_0x202f3f){return _0x202f3f['update'](_0x40d6bc)[_0x899c('0x1c')](function(_0x27c874){return _0x27c874;});}return null;};}function removeEntity(_0x237e66,_0x12c3df){return function(_0x441d21){if(_0x441d21){return _0x441d21['destroy']()['then'](function(){var _0x1cd2af=_0x441d21[_0x899c('0x31')]({'plain':!![]});var _0x3a572c=_0x899c('0x32');return db[_0x899c('0x33')][_0x899c('0x34')]({'where':{'type':_0x3a572c,'resourceId':_0x1cd2af['id']}})[_0x899c('0x1c')](function(){return _0x441d21;});})['then'](function(){_0x237e66[_0x899c('0x28')](0xcc)[_0x899c('0x35')]();});}};}function handleEntityNotFound(_0x3c0091,_0x217b83){return function(_0x42e677){if(!_0x42e677){_0x3c0091[_0x899c('0x27')](0x194);}return _0x42e677;};}function handleError(_0x335284,_0x1add1a){_0x1add1a=_0x1add1a||0x1f4;return function(_0x244230){logger[_0x899c('0x22')](_0x244230[_0x899c('0x36')]);if(_0x244230[_0x899c('0x37')]){delete _0x244230['name'];}_0x335284[_0x899c('0x28')](_0x1add1a)['send'](_0x244230);};}exports[_0x899c('0x38')]=function(_0x4dbab7,_0x3b37a6){var _0x15099e={},_0x502380={},_0x563c4b={'count':0x0,'rows':[]};var _0x33b405=_[_0x899c('0x39')](db[_0x899c('0x3a')]['rawAttributes'],function(_0x2b76ce){return{'name':_0x2b76ce[_0x899c('0x3b')],'type':_0x2b76ce[_0x899c('0x3c')][_0x899c('0x3d')]};});_0x502380[_0x899c('0x3e')]=_[_0x899c('0x39')](_0x33b405,_0x899c('0x37'));_0x502380[_0x899c('0x3f')]=_[_0x899c('0x40')](_0x4dbab7[_0x899c('0x3f')]);_0x502380['filters']=_['intersection'](_0x502380['model'],_0x502380[_0x899c('0x3f')]);_0x15099e[_0x899c('0x41')]=_[_0x899c('0x42')](_0x502380[_0x899c('0x3e')],qs[_0x899c('0x43')](_0x4dbab7[_0x899c('0x3f')][_0x899c('0x43')]));_0x15099e[_0x899c('0x41')]=_0x15099e[_0x899c('0x41')][_0x899c('0x44')]?_0x15099e[_0x899c('0x41')]:_0x502380[_0x899c('0x3e')];if(!_0x4dbab7[_0x899c('0x3f')]['hasOwnProperty'](_0x899c('0x45'))){_0x15099e[_0x899c('0x2c')]=qs['limit'](_0x4dbab7[_0x899c('0x3f')][_0x899c('0x2c')]);_0x15099e[_0x899c('0x2a')]=qs[_0x899c('0x2a')](_0x4dbab7['query'][_0x899c('0x2a')]);}_0x15099e['order']=qs[_0x899c('0x46')](_0x4dbab7[_0x899c('0x3f')][_0x899c('0x46')]);_0x15099e[_0x899c('0x47')]=qs['filters'](_[_0x899c('0x48')](_0x4dbab7[_0x899c('0x3f')],_0x502380[_0x899c('0x49')]),_0x33b405);if(_0x4dbab7[_0x899c('0x3f')][_0x899c('0x4a')]){_0x15099e['where']=_[_0x899c('0x4b')](_0x15099e[_0x899c('0x47')],{'$or':_['map'](_0x33b405,function(_0x588c75){if(_0x588c75[_0x899c('0x3c')]!==_0x899c('0x4c')){var _0x587121={};_0x587121[_0x588c75[_0x899c('0x37')]]={'$like':'%'+_0x4dbab7[_0x899c('0x3f')]['filter']+'%'};return _0x587121;}})});}_0x15099e=_[_0x899c('0x4b')]({},_0x15099e,_0x4dbab7[_0x899c('0x4d')]);var _0x137b57={'where':_0x15099e[_0x899c('0x47')]};return db[_0x899c('0x3a')][_0x899c('0x2d')](_0x137b57)[_0x899c('0x1c')](function(_0x66f0e5){_0x563c4b['count']=_0x66f0e5;if(_0x4dbab7[_0x899c('0x3f')][_0x899c('0x4e')]){_0x15099e[_0x899c('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x899c('0x50')](_0x15099e);})[_0x899c('0x1c')](function(_0x24c40a){_0x563c4b[_0x899c('0x51')]=_0x24c40a;return _0x563c4b;})[_0x899c('0x1c')](respondWithFilteredResult(_0x3b37a6,_0x15099e))['catch'](handleError(_0x3b37a6,null));};exports[_0x899c('0x52')]=function(_0x2c72ed,_0x321fde){var _0x2fac55={'raw':![],'where':{'id':_0x2c72ed[_0x899c('0x53')]['id']}},_0x179531={};_0x179531[_0x899c('0x3e')]=_[_0x899c('0x40')](db[_0x899c('0x3a')]['rawAttributes']);_0x179531[_0x899c('0x3f')]=_[_0x899c('0x40')](_0x2c72ed[_0x899c('0x3f')]);_0x179531[_0x899c('0x49')]=_['intersection'](_0x179531[_0x899c('0x3e')],_0x179531[_0x899c('0x3f')]);_0x2fac55[_0x899c('0x41')]=_[_0x899c('0x42')](_0x179531[_0x899c('0x3e')],qs[_0x899c('0x43')](_0x2c72ed['query'][_0x899c('0x43')]));_0x2fac55[_0x899c('0x41')]=_0x2fac55['attributes'][_0x899c('0x44')]?_0x2fac55[_0x899c('0x41')]:_0x179531['model'];if(_0x2c72ed[_0x899c('0x3f')]['includeAll']){_0x2fac55[_0x899c('0x4f')]=[{'all':!![]}];}_0x2fac55=_[_0x899c('0x4b')]({},_0x2fac55,_0x2c72ed[_0x899c('0x4d')]);return db[_0x899c('0x3a')][_0x899c('0x54')](_0x2fac55)['then'](handleEntityNotFound(_0x321fde,null))[_0x899c('0x1c')](respondWithResult(_0x321fde,null))[_0x899c('0x55')](handleError(_0x321fde,null));};exports[_0x899c('0x56')]=function(_0x27c8cc,_0xdfabc,_0x1a12e4){var _0xb95eb1;return db[_0x899c('0x3a')][_0x899c('0x56')](_0x27c8cc[_0x899c('0x57')],{'raw':!![]})['then'](function(_0x2504d1){_0xb95eb1=_0x2504d1;return db['VoiceContext'][_0x899c('0x50')]({'raw':!![]});})['then'](function(_0x4b9574){var _0x3bdea7=fs['readFileSync'](path['join'](config[_0x899c('0x58')],_0x899c('0x59')),_0x899c('0x5a'));var _0x111974=ejs[_0x899c('0x5b')](_0x3bdea7,{'contexts':_0x4b9574||[]});fs[_0x899c('0x5c')](_0x899c('0x5d'),_0x111974);})[_0x899c('0x1c')](function(){return respondWithRpcPromise(_0x899c('0x5e'),_0x899c('0x56'),{'module':_0x899c('0x5f')});})[_0x899c('0x1c')](function(){var _0x5a0cbe=_0x27c8cc[_0x899c('0x60')][_0x899c('0x31')]({'plain':!![]});if(!_0x5a0cbe)throw new Error(_0x899c('0x61'));if(_0x5a0cbe[_0x899c('0x62')]===_0x899c('0x60')){var _0x4b48aa=_0xb95eb1[_0x899c('0x31')]({'plain':!![]});return db[_0x899c('0x63')][_0x899c('0x54')]({'where':{'name':_0x899c('0x32'),'userProfileId':_0x5a0cbe['userProfileId']},'raw':!![]})[_0x899c('0x1c')](function(_0x159abc){if(_0x159abc&&_0x159abc[_0x899c('0x64')]===0x0){return db['UserProfileResource'][_0x899c('0x56')]({'name':_0x4b48aa[_0x899c('0x37')],'resourceId':_0x4b48aa['id'],'type':_0x159abc[_0x899c('0x37')],'sectionId':_0x159abc['id']},{})[_0x899c('0x1c')](function(){return _0xb95eb1;});}else{return _0xb95eb1;}})[_0x899c('0x55')](function(_0x307790){logger[_0x899c('0x22')](_0x899c('0x65'),_0x307790);throw _0x307790;});}return _0xb95eb1;})[_0x899c('0x1c')](respondWithResult(_0xdfabc,0xc9))[_0x899c('0x55')](handleError(_0xdfabc,null));};exports[_0x899c('0x66')]=function(_0x363cdc,_0x1f80f2,_0x4dadd9){var _0x5a4a9f;return db[_0x899c('0x3a')][_0x899c('0x54')]({'where':{'id':_0x363cdc[_0x899c('0x53')]['id']}})[_0x899c('0x1c')](handleEntityNotFound(_0x1f80f2,null))['then'](saveUpdates(_0x363cdc[_0x899c('0x57')],null))['then'](function(_0x3a13f6){if(_0x3a13f6){_0x5a4a9f=_0x3a13f6;return db[_0x899c('0x3a')][_0x899c('0x50')]({'raw':!![]});}})[_0x899c('0x1c')](function(_0x181909){var _0x4906de=fs[_0x899c('0x67')](path[_0x899c('0x68')](config['root'],_0x899c('0x59')),_0x899c('0x5a'));var _0x271e20=ejs[_0x899c('0x5b')](_0x4906de,{'contexts':_0x181909||[]});fs['writeFileSync'](_0x899c('0x5d'),_0x271e20);})[_0x899c('0x1c')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x899c('0x5f')});})['then'](function(){return _0x5a4a9f;})[_0x899c('0x1c')](respondWithResult(_0x1f80f2,null))['catch'](handleError(_0x1f80f2,null));};exports[_0x899c('0x34')]=function(_0x323ac5,_0x301c78,_0x551e17){var _0x8c5248;return db[_0x899c('0x3a')][_0x899c('0x54')]({'where':{'id':_0x323ac5[_0x899c('0x53')]['id']}})['then'](handleEntityNotFound(_0x301c78,null))[_0x899c('0x1c')](removeEntity(_0x301c78,null))[_0x899c('0x1c')](function(){return db[_0x899c('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x5e7d31){var _0x175a7e=fs[_0x899c('0x67')](path[_0x899c('0x68')](config['root'],'server/files/templates/context.ejs'),_0x899c('0x5a'));var _0x88145d=ejs[_0x899c('0x5b')](_0x175a7e,{'contexts':_0x5e7d31});fs[_0x899c('0x5c')](_0x899c('0x5d'),_0x88145d);return respondWithRpcPromise(_0x899c('0x5e'),'destroy',{'module':_0x899c('0x5f')});})[_0x899c('0x55')](handleError(_0x301c78,null));}; \ No newline at end of file +var _0xc46e=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','autoAssociation','find','server/files/templates/context.ejs','utf8','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','get','Contexts','destroy','stack','name','map','VoiceContext','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x40f74e,_0x42d884){var _0x6cb5ff=function(_0x23695a){while(--_0x23695a){_0x40f74e['push'](_0x40f74e['shift']());}};_0x6cb5ff(++_0x42d884);}(_0xc46e,0x154));var _0xec46=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc46e[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0xec46('0x0'));var rimraf=require(_0xec46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec46('0x2'));var rp=require(_0xec46('0x3'));var moment=require(_0xec46('0x4'));var BPromise=require(_0xec46('0x5'));var Mustache=require(_0xec46('0x6'));var util=require(_0xec46('0x7'));var path=require(_0xec46('0x8'));var sox=require('sox');var csv=require(_0xec46('0x9'));var ejs=require(_0xec46('0xa'));var fs=require('fs');var fs_extra=require(_0xec46('0xb'));var _=require(_0xec46('0xc'));var squel=require(_0xec46('0xd'));var crypto=require(_0xec46('0xe'));var jsforce=require(_0xec46('0xf'));var deskjs=require(_0xec46('0x10'));var toCsv=require(_0xec46('0x9'));var querystring=require('querystring');var Papa=require(_0xec46('0x11'));var Redis=require(_0xec46('0x12'));var authService=require(_0xec46('0x13'));var qs=require(_0xec46('0x14'));var as=require(_0xec46('0x15'));var hardwareService=require(_0xec46('0x16'));var logger=require(_0xec46('0x17'))(_0xec46('0x18'));var utils=require(_0xec46('0x19'));var config=require(_0xec46('0x1a'));var licenseUtil=require(_0xec46('0x1b'));var db=require(_0xec46('0x1c'))['db'];var jayson=require(_0xec46('0x1d'));var client=jayson['client'][_0xec46('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1435bd,_0x273bde,_0x58c4f9,_0x3e047b){return new BPromise(function(_0x2673fc,_0x5cadd0){var _0x50fbcd=_0x3e047b||client;return _0x50fbcd[_0xec46('0x1f')](_0x1435bd,_0x58c4f9)[_0xec46('0x20')](function(_0x55ded0){logger[_0xec46('0x21')](_0xec46('0x22'),_0x273bde,_0xec46('0x23'));logger[_0xec46('0x24')](_0xec46('0x25'),_0x273bde,_0xec46('0x23'),JSON['stringify'](_0x55ded0));if(_0x55ded0[_0xec46('0x26')]){if(_0x55ded0[_0xec46('0x26')][_0xec46('0x27')]===0x1f4){logger[_0xec46('0x26')](_0xec46('0x22'),_0x273bde,_0x55ded0[_0xec46('0x26')][_0xec46('0x28')]);return _0x5cadd0(_0x55ded0['error'][_0xec46('0x28')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x273bde,_0x55ded0[_0xec46('0x26')]['message']);return _0x2673fc(_0x55ded0[_0xec46('0x26')][_0xec46('0x28')]);}else{logger['info'](_0xec46('0x22'),_0x273bde,_0xec46('0x23'));_0x2673fc(_0x55ded0[_0xec46('0x29')][_0xec46('0x28')]);}})['catch'](function(_0x52f0c7){logger[_0xec46('0x26')](_0xec46('0x22'),_0x273bde,_0x52f0c7);_0x5cadd0(_0x52f0c7);});});}function respondWithStatusCode(_0x2906d0,_0x41495b){_0x41495b=_0x41495b||0xcc;return function(_0x20a257){if(_0x20a257){return _0x2906d0[_0xec46('0x2a')](_0x41495b);}return _0x2906d0[_0xec46('0x2b')](_0x41495b)[_0xec46('0x2c')]();};}function respondWithResult(_0x57552b,_0x415100){_0x415100=_0x415100||0xc8;return function(_0x56cb0f){if(_0x56cb0f){return _0x57552b[_0xec46('0x2b')](_0x415100)[_0xec46('0x2d')](_0x56cb0f);}};}function respondWithFilteredResult(_0x533070,_0x77292b){return function(_0x36a54d){if(_0x36a54d){var _0x21a79e=typeof _0x77292b[_0xec46('0x2e')]==='undefined'&&typeof _0x77292b[_0xec46('0x2f')]==='undefined';var _0x5aa487=_0x36a54d[_0xec46('0x30')];var _0x58317b=_0x21a79e?0x0:_0x77292b[_0xec46('0x2e')];var _0x4f6a57=_0x21a79e?_0x36a54d[_0xec46('0x30')]:_0x77292b[_0xec46('0x2e')]+_0x77292b['limit'];var _0x5ed3e2;if(_0x4f6a57>=_0x5aa487){_0x4f6a57=_0x5aa487;_0x5ed3e2=0xc8;}else{_0x5ed3e2=0xce;}_0x533070[_0xec46('0x2b')](_0x5ed3e2);return _0x533070[_0xec46('0x31')](_0xec46('0x32'),_0x58317b+'-'+_0x4f6a57+'/'+_0x5aa487)['json'](_0x36a54d);}return null;};}function patchUpdates(_0x518f99){return function(_0x2bedff){try{jsonpatch[_0xec46('0x33')](_0x2bedff,_0x518f99,!![]);}catch(_0x56bfee){return BPromise[_0xec46('0x34')](_0x56bfee);}return _0x2bedff['save']();};}function saveUpdates(_0x47ddcf,_0x27fe6f){return function(_0x49997f){if(_0x49997f){return _0x49997f['update'](_0x47ddcf)[_0xec46('0x20')](function(_0xb93852){return _0xb93852;});}return null;};}function removeEntity(_0x36ebe8,_0x1ee5cf){return function(_0x184537){if(_0x184537){return _0x184537['destroy']()[_0xec46('0x20')](function(){var _0x4d0d4=_0x184537[_0xec46('0x35')]({'plain':!![]});var _0x28b94b=_0xec46('0x36');return db['UserProfileResource'][_0xec46('0x37')]({'where':{'type':_0x28b94b,'resourceId':_0x4d0d4['id']}})[_0xec46('0x20')](function(){return _0x184537;});})[_0xec46('0x20')](function(){_0x36ebe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x814014,_0x139ea7){return function(_0xf4e54d){if(!_0xf4e54d){_0x814014[_0xec46('0x2a')](0x194);}return _0xf4e54d;};}function handleError(_0x374123,_0x56e906){_0x56e906=_0x56e906||0x1f4;return function(_0x1d00d){logger['error'](_0x1d00d[_0xec46('0x38')]);if(_0x1d00d[_0xec46('0x39')]){delete _0x1d00d[_0xec46('0x39')];}_0x374123[_0xec46('0x2b')](_0x56e906)['send'](_0x1d00d);};}exports['index']=function(_0x1b7e5d,_0xf5c533){var _0x5b409e={},_0x541ecb={},_0x4923cb={'count':0x0,'rows':[]};var _0xa657c4=_[_0xec46('0x3a')](db[_0xec46('0x3b')][_0xec46('0x3c')],function(_0x46336b){return{'name':_0x46336b[_0xec46('0x3d')],'type':_0x46336b[_0xec46('0x3e')]['key']};});_0x541ecb[_0xec46('0x3f')]=_[_0xec46('0x3a')](_0xa657c4,_0xec46('0x39'));_0x541ecb[_0xec46('0x40')]=_['keys'](_0x1b7e5d['query']);_0x541ecb[_0xec46('0x41')]=_[_0xec46('0x42')](_0x541ecb[_0xec46('0x3f')],_0x541ecb[_0xec46('0x40')]);_0x5b409e[_0xec46('0x43')]=_[_0xec46('0x42')](_0x541ecb['model'],qs[_0xec46('0x44')](_0x1b7e5d['query']['fields']));_0x5b409e[_0xec46('0x43')]=_0x5b409e[_0xec46('0x43')][_0xec46('0x45')]?_0x5b409e[_0xec46('0x43')]:_0x541ecb[_0xec46('0x3f')];if(!_0x1b7e5d[_0xec46('0x40')]['hasOwnProperty'](_0xec46('0x46'))){_0x5b409e[_0xec46('0x2f')]=qs['limit'](_0x1b7e5d['query'][_0xec46('0x2f')]);_0x5b409e[_0xec46('0x2e')]=qs[_0xec46('0x2e')](_0x1b7e5d[_0xec46('0x40')]['offset']);}_0x5b409e['order']=qs[_0xec46('0x47')](_0x1b7e5d[_0xec46('0x40')][_0xec46('0x47')]);_0x5b409e[_0xec46('0x48')]=qs[_0xec46('0x41')](_[_0xec46('0x49')](_0x1b7e5d[_0xec46('0x40')],_0x541ecb[_0xec46('0x41')]),_0xa657c4);if(_0x1b7e5d[_0xec46('0x40')][_0xec46('0x4a')]){_0x5b409e[_0xec46('0x48')]=_[_0xec46('0x4b')](_0x5b409e[_0xec46('0x48')],{'$or':_[_0xec46('0x3a')](_0xa657c4,function(_0x2f5d08){if(_0x2f5d08['type']!==_0xec46('0x4c')){var _0xfd8ff0={};_0xfd8ff0[_0x2f5d08['name']]={'$like':'%'+_0x1b7e5d[_0xec46('0x40')][_0xec46('0x4a')]+'%'};return _0xfd8ff0;}})});}_0x5b409e=_[_0xec46('0x4b')]({},_0x5b409e,_0x1b7e5d[_0xec46('0x4d')]);var _0x18034c={'where':_0x5b409e[_0xec46('0x48')]};return db['VoiceContext'][_0xec46('0x30')](_0x18034c)[_0xec46('0x20')](function(_0x3e5441){_0x4923cb[_0xec46('0x30')]=_0x3e5441;if(_0x1b7e5d['query'][_0xec46('0x4e')]){_0x5b409e[_0xec46('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0xec46('0x50')](_0x5b409e);})[_0xec46('0x20')](function(_0x304f57){_0x4923cb[_0xec46('0x51')]=_0x304f57;return _0x4923cb;})['then'](respondWithFilteredResult(_0xf5c533,_0x5b409e))[_0xec46('0x52')](handleError(_0xf5c533,null));};exports['show']=function(_0x572f02,_0x26bccd){var _0x3763a4={'raw':![],'where':{'id':_0x572f02[_0xec46('0x53')]['id']}},_0xdc2c1c={};_0xdc2c1c[_0xec46('0x3f')]=_['keys'](db[_0xec46('0x3b')][_0xec46('0x3c')]);_0xdc2c1c[_0xec46('0x40')]=_[_0xec46('0x54')](_0x572f02['query']);_0xdc2c1c[_0xec46('0x41')]=_['intersection'](_0xdc2c1c[_0xec46('0x3f')],_0xdc2c1c[_0xec46('0x40')]);_0x3763a4[_0xec46('0x43')]=_[_0xec46('0x42')](_0xdc2c1c['model'],qs[_0xec46('0x44')](_0x572f02[_0xec46('0x40')][_0xec46('0x44')]));_0x3763a4['attributes']=_0x3763a4[_0xec46('0x43')][_0xec46('0x45')]?_0x3763a4[_0xec46('0x43')]:_0xdc2c1c[_0xec46('0x3f')];if(_0x572f02[_0xec46('0x40')][_0xec46('0x4e')]){_0x3763a4['include']=[{'all':!![]}];}_0x3763a4=_['merge']({},_0x3763a4,_0x572f02[_0xec46('0x4d')]);return db[_0xec46('0x3b')]['find'](_0x3763a4)[_0xec46('0x20')](handleEntityNotFound(_0x26bccd,null))[_0xec46('0x20')](respondWithResult(_0x26bccd,null))[_0xec46('0x52')](handleError(_0x26bccd,null));};exports[_0xec46('0x55')]=function(_0xcd7514,_0x4bf8fa,_0x4ed2a1){var _0x22e6b5;return db[_0xec46('0x3b')]['create'](_0xcd7514[_0xec46('0x56')],{'raw':!![]})[_0xec46('0x20')](function(_0x83d020){_0x22e6b5=_0x83d020;return db[_0xec46('0x3b')][_0xec46('0x50')]({'raw':!![]});})[_0xec46('0x20')](function(_0x17ac1d){var _0x15582b=fs[_0xec46('0x57')](path[_0xec46('0x58')](config[_0xec46('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x5ad923=ejs[_0xec46('0x5a')](_0x15582b,{'contexts':_0x17ac1d||[]});fs[_0xec46('0x5b')](_0xec46('0x5c'),_0x5ad923);})[_0xec46('0x20')](function(){return respondWithRpcPromise(_0xec46('0x5d'),_0xec46('0x55'),{'module':_0xec46('0x5e')});})[_0xec46('0x20')](function(){var _0x3680d9=_0xcd7514[_0xec46('0x5f')][_0xec46('0x35')]({'plain':!![]});if(!_0x3680d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3680d9[_0xec46('0x60')]==='user'){var _0x2db54f=_0x22e6b5[_0xec46('0x35')]({'plain':!![]});return db[_0xec46('0x61')]['find']({'where':{'name':_0xec46('0x36'),'userProfileId':_0x3680d9['userProfileId']},'raw':!![]})['then'](function(_0x49c29c){if(_0x49c29c&&_0x49c29c[_0xec46('0x62')]===0x0){return db['UserProfileResource'][_0xec46('0x55')]({'name':_0x2db54f['name'],'resourceId':_0x2db54f['id'],'type':_0x49c29c[_0xec46('0x39')],'sectionId':_0x49c29c['id']},{})[_0xec46('0x20')](function(){return _0x22e6b5;});}else{return _0x22e6b5;}})['catch'](function(_0x24b220){logger[_0xec46('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24b220);throw _0x24b220;});}return _0x22e6b5;})[_0xec46('0x20')](respondWithResult(_0x4bf8fa,0xc9))['catch'](handleError(_0x4bf8fa,null));};exports['update']=function(_0x26476a,_0x2db874,_0x1204ef){var _0x294426;return db[_0xec46('0x3b')][_0xec46('0x63')]({'where':{'id':_0x26476a[_0xec46('0x53')]['id']}})['then'](handleEntityNotFound(_0x2db874,null))[_0xec46('0x20')](saveUpdates(_0x26476a['body'],null))[_0xec46('0x20')](function(_0x1cc78b){if(_0x1cc78b){_0x294426=_0x1cc78b;return db[_0xec46('0x3b')][_0xec46('0x50')]({'raw':!![]});}})[_0xec46('0x20')](function(_0x8f8406){var _0x1a59dc=fs['readFileSync'](path[_0xec46('0x58')](config[_0xec46('0x59')],_0xec46('0x64')),_0xec46('0x65'));var _0x4a056b=ejs[_0xec46('0x5a')](_0x1a59dc,{'contexts':_0x8f8406||[]});fs['writeFileSync'](_0xec46('0x5c'),_0x4a056b);})['then'](function(){return respondWithRpcPromise(_0xec46('0x5d'),_0xec46('0x66'),{'module':_0xec46('0x5e')});})['then'](function(){return _0x294426;})['then'](respondWithResult(_0x2db874,null))['catch'](handleError(_0x2db874,null));};exports[_0xec46('0x37')]=function(_0x47dffe,_0x25531d,_0x5b5647){var _0x335c1b;return db[_0xec46('0x3b')][_0xec46('0x63')]({'where':{'id':_0x47dffe['params']['id']}})['then'](handleEntityNotFound(_0x25531d,null))['then'](removeEntity(_0x25531d,null))[_0xec46('0x20')](function(){return db[_0xec46('0x3b')][_0xec46('0x50')]({'raw':!![]});})[_0xec46('0x20')](function(_0x5bba65){var _0xdf936d=fs[_0xec46('0x57')](path[_0xec46('0x58')](config[_0xec46('0x59')],_0xec46('0x64')),'utf8');var _0x929a2d=ejs['render'](_0xdf936d,{'contexts':_0x5bba65});fs[_0xec46('0x5b')](_0xec46('0x5c'),_0x929a2d);return respondWithRpcPromise(_0xec46('0x5d'),'destroy',{'module':'chan_sip.so'});})[_0xec46('0x52')](handleError(_0x25531d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f44f47b..24f44b8 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 _0x0e68=['path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','../../config/logger','api','moment','request-promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0e68,0xf8));var _0x80e6=function(_0x372c11,_0x229087){_0x372c11=_0x372c11-0x0;var _0x1c41c2=_0x0e68[_0x372c11];return _0x1c41c2;};'use strict';var _=require(_0x80e6('0x0'));var util=require('util');var logger=require(_0x80e6('0x1'))(_0x80e6('0x2'));var moment=require(_0x80e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x80e6('0x4'));var fs=require('fs');var path=require(_0x80e6('0x5'));var rimraf=require('rimraf');var config=require(_0x80e6('0x6'));var attributes=require(_0x80e6('0x7'));module[_0x80e6('0x8')]=function(_0x4579b3,_0x3da49f){return _0x4579b3[_0x80e6('0x9')](_0x80e6('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5087=['request-promise','rimraf','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api'];(function(_0xe3c5ed,_0x28acea){var _0x5629d3=function(_0x2b689b){while(--_0x2b689b){_0xe3c5ed['push'](_0xe3c5ed['shift']());}};_0x5629d3(++_0x28acea);}(_0x5087,0xec));var _0x7508=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0x5087[_0x1b8d87];return _0x182b74;};'use strict';var _=require(_0x7508('0x0'));var util=require(_0x7508('0x1'));var logger=require(_0x7508('0x2'))(_0x7508('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7508('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7508('0x5'));var config=require('../../config/environment');var attributes=require(_0x7508('0x6'));module[_0x7508('0x7')]=function(_0x4db443,_0x21815f){return _0x4db443['define'](_0x7508('0x8'),attributes,{'tableName':_0x7508('0x9'),'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 08bf3ab..ef27777 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 _0x87a2=['../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','stringify','code','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x418cbb,_0x50d41e){var _0x2f13ae=function(_0x4124f4){while(--_0x4124f4){_0x418cbb['push'](_0x418cbb['shift']());}};_0x2f13ae(++_0x50d41e);}(_0x87a2,0x14a));var _0x287a=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x87a2[_0x148879];return _0x4f7027;};'use strict';var _=require(_0x287a('0x0'));var util=require(_0x287a('0x1'));var moment=require(_0x287a('0x2'));var BPromise=require('bluebird');var rs=require(_0x287a('0x3'));var fs=require('fs');var Redis=require(_0x287a('0x4'));var db=require(_0x287a('0x5'))['db'];var utils=require(_0x287a('0x6'));var logger=require(_0x287a('0x7'))(_0x287a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x287a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24d941,_0x268463,_0x1a7bc5){return new BPromise(function(_0x4e1235,_0x585723){return client['request'](_0x24d941,_0x1a7bc5)[_0x287a('0xa')](function(_0x225cc0){logger[_0x287a('0xb')]('VoiceContext,\x20%s,\x20%s',_0x268463,_0x287a('0xc'));logger[_0x287a('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x268463,_0x287a('0xc'),JSON[_0x287a('0xe')](_0x225cc0));if(_0x225cc0['error']){if(_0x225cc0['error'][_0x287a('0xf')]===0x1f4){logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x225cc0['error']['message']);return _0x585723(_0x225cc0['error'][_0x287a('0x12')]);}logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x225cc0[_0x287a('0x10')]['message']);return _0x4e1235(_0x225cc0[_0x287a('0x10')][_0x287a('0x12')]);}else{logger[_0x287a('0xb')](_0x287a('0x11'),_0x268463,_0x287a('0xc'));_0x4e1235(_0x225cc0[_0x287a('0x13')]['message']);}})[_0x287a('0x14')](function(_0x3aa35f){logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x3aa35f);_0x585723(_0x3aa35f);});});} \ No newline at end of file +var _0x90db=['request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x90db,0x1c0));var _0xb90d=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x90db[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0xb90d('0x0'));var moment=require(_0xb90d('0x1'));var BPromise=require(_0xb90d('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('../../config/logger')(_0xb90d('0x3'));var config=require(_0xb90d('0x4'));var jayson=require(_0xb90d('0x5'));var client=jayson[_0xb90d('0x6')][_0xb90d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d8398,_0x180781,_0x126e17){return new BPromise(function(_0x2ef5e6,_0x108b88){return client[_0xb90d('0x8')](_0x2d8398,_0x126e17)[_0xb90d('0x9')](function(_0x48c4f6){logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,_0xb90d('0xc'));logger['debug'](_0xb90d('0xd'),_0x180781,_0xb90d('0xc'),JSON[_0xb90d('0xe')](_0x48c4f6));if(_0x48c4f6[_0xb90d('0xf')]){if(_0x48c4f6[_0xb90d('0xf')]['code']===0x1f4){logger[_0xb90d('0xf')]('VoiceContext,\x20%s,\x20%s',_0x180781,_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);return _0x108b88(_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);}logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x48c4f6[_0xb90d('0xf')]['message']);return _0x2ef5e6(_0x48c4f6[_0xb90d('0xf')]['message']);}else{logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,'request\x20sent');_0x2ef5e6(_0x48c4f6[_0xb90d('0x11')]['message']);}})[_0xb90d('0x12')](function(_0x396f3f){logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x396f3f);_0x108b88(_0x396f3f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 33c6c75..ccb45ab 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 _0x3a61=['destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x3a61,0xd4));var _0x13a6=function(_0x27c156,_0x14ce9b){_0x27c156=_0x27c156-0x0;var _0x4a94af=_0x3a61[_0x27c156];return _0x4a94af;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x13a6('0x0'));var express=require(_0x13a6('0x1'));var router=express[_0x13a6('0x2')]();var fs_extra=require(_0x13a6('0x3'));var auth=require(_0x13a6('0x4'));var interaction=require(_0x13a6('0x5'));var config=require(_0x13a6('0x6'));var controller=require(_0x13a6('0x7'));router[_0x13a6('0x8')]('/',auth[_0x13a6('0x9')](),controller[_0x13a6('0xa')]);router[_0x13a6('0x8')](_0x13a6('0xb'),auth[_0x13a6('0x9')](),controller[_0x13a6('0xc')]);router['get'](_0x13a6('0xd'),auth[_0x13a6('0x9')](),controller[_0x13a6('0xe')]);router[_0x13a6('0xf')]('/',auth[_0x13a6('0x9')](),controller['create']);router[_0x13a6('0x10')](_0x13a6('0xd'),auth['isAuthenticated'](),controller[_0x13a6('0x11')]);router[_0x13a6('0x12')](_0x13a6('0xd'),auth[_0x13a6('0x9')](),controller[_0x13a6('0x13')]);module[_0x13a6('0x14')]=router; \ No newline at end of file +var _0x08cf=['/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x08cf,0x1ed));var _0xf08c=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x08cf[_0x3861f7];return _0x50879f;};'use strict';var multer=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var path=require('path');var timeout=require(_0xf08c('0x2'));var express=require(_0xf08c('0x3'));var router=express[_0xf08c('0x4')]();var fs_extra=require(_0xf08c('0x5'));var auth=require(_0xf08c('0x6'));var interaction=require(_0xf08c('0x7'));var config=require(_0xf08c('0x8'));var controller=require(_0xf08c('0x9'));router[_0xf08c('0xa')]('/',auth[_0xf08c('0xb')](),controller[_0xf08c('0xc')]);router[_0xf08c('0xa')](_0xf08c('0xd'),auth[_0xf08c('0xb')](),controller[_0xf08c('0xe')]);router[_0xf08c('0xa')](_0xf08c('0xf'),auth[_0xf08c('0xb')](),controller[_0xf08c('0x10')]);router[_0xf08c('0x11')]('/',auth[_0xf08c('0xb')](),controller[_0xf08c('0x12')]);router[_0xf08c('0x13')]('/:id',auth[_0xf08c('0xb')](),controller[_0xf08c('0x14')]);router[_0xf08c('0x15')](_0xf08c('0xf'),auth[_0xf08c('0xb')](),controller['destroy']);module[_0xf08c('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 65df39c..9a0a1ab 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x576b33,_0x2115ea){var _0x46834d=function(_0x38c45a){while(--_0x38c45a){_0x576b33['push'](_0x576b33['shift']());}};_0x46834d(++_0x2115ea);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31fb16,_0x3a4f55){_0x31fb16=_0x31fb16-0x0;var _0x50f4b7=_0xe5b3[_0x31fb16];return _0x50f4b7;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x1b384e,_0x67f923){var _0x44405a=function(_0x5672e7){while(--_0x5672e7){_0x1b384e['push'](_0x1b384e['shift']());}};_0x44405a(++_0x67f923);}(_0xa41a,0x6b));var _0xaa41=function(_0x1f0b79,_0x29a0b3){_0x1f0b79=_0x1f0b79-0x0;var _0xdfecc7=_0xa41a[_0x1f0b79];return _0xdfecc7;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5fe875b..cb414db 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 _0x7dc0=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','name','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create'];(function(_0x267484,_0x3eb131){var _0x14a356=function(_0x54703b){while(--_0x54703b){_0x267484['push'](_0x267484['shift']());}};_0x14a356(++_0x3eb131);}(_0x7dc0,0x126));var _0x07dc=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x7dc0[_0x183b97];return _0x629cf7;};'use strict';var emlformat=require(_0x07dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07dc('0x1'));var jsonpatch=require(_0x07dc('0x2'));var rp=require(_0x07dc('0x3'));var moment=require(_0x07dc('0x4'));var BPromise=require(_0x07dc('0x5'));var Mustache=require(_0x07dc('0x6'));var util=require(_0x07dc('0x7'));var path=require(_0x07dc('0x8'));var sox=require(_0x07dc('0x9'));var csv=require(_0x07dc('0xa'));var ejs=require(_0x07dc('0xb'));var fs=require('fs');var fs_extra=require(_0x07dc('0xc'));var _=require(_0x07dc('0xd'));var squel=require(_0x07dc('0xe'));var crypto=require('crypto');var jsforce=require(_0x07dc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07dc('0x10'));var Redis=require(_0x07dc('0x11'));var authService=require(_0x07dc('0x12'));var qs=require(_0x07dc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07dc('0x14'));var logger=require(_0x07dc('0x15'))('api');var utils=require(_0x07dc('0x16'));var config=require(_0x07dc('0x17'));var licenseUtil=require(_0x07dc('0x18'));var db=require(_0x07dc('0x19'))['db'];function respondWithStatusCode(_0x214e2c,_0x3e47bc){_0x3e47bc=_0x3e47bc||0xcc;return function(_0x5875de){if(_0x5875de){return _0x214e2c['sendStatus'](_0x3e47bc);}return _0x214e2c[_0x07dc('0x1a')](_0x3e47bc)[_0x07dc('0x1b')]();};}function respondWithResult(_0x4bc58d,_0x4c9612){_0x4c9612=_0x4c9612||0xc8;return function(_0x54744b){if(_0x54744b){return _0x4bc58d['status'](_0x4c9612)['json'](_0x54744b);}};}function respondWithFilteredResult(_0x3a252b,_0xec72dd){return function(_0x41c1a9){if(_0x41c1a9){var _0x213473=typeof _0xec72dd[_0x07dc('0x1c')]===_0x07dc('0x1d')&&typeof _0xec72dd['limit']===_0x07dc('0x1d');var _0x36bff9=_0x41c1a9[_0x07dc('0x1e')];var _0x320f2b=_0x213473?0x0:_0xec72dd[_0x07dc('0x1c')];var _0x534cad=_0x213473?_0x41c1a9[_0x07dc('0x1e')]:_0xec72dd[_0x07dc('0x1c')]+_0xec72dd[_0x07dc('0x1f')];var _0x5c9046;if(_0x534cad>=_0x36bff9){_0x534cad=_0x36bff9;_0x5c9046=0xc8;}else{_0x5c9046=0xce;}_0x3a252b[_0x07dc('0x1a')](_0x5c9046);return _0x3a252b[_0x07dc('0x20')]('Content-Range',_0x320f2b+'-'+_0x534cad+'/'+_0x36bff9)[_0x07dc('0x21')](_0x41c1a9);}return null;};}function patchUpdates(_0x3fd964){return function(_0x16ea68){try{jsonpatch[_0x07dc('0x22')](_0x16ea68,_0x3fd964,!![]);}catch(_0x2f6261){return BPromise[_0x07dc('0x23')](_0x2f6261);}return _0x16ea68['save']();};}function saveUpdates(_0x5d5e39,_0x3cde74){return function(_0x423205){if(_0x423205){return _0x423205['update'](_0x5d5e39)['then'](function(_0xb39153){return _0xb39153;});}return null;};}function removeEntity(_0x1d8f32,_0x362078){return function(_0x40632a){if(_0x40632a){return _0x40632a[_0x07dc('0x24')]()[_0x07dc('0x25')](function(){_0x1d8f32['status'](0xcc)[_0x07dc('0x1b')]();});}};}function handleEntityNotFound(_0x1c3063,_0x205c2f){return function(_0xd2e9b1){if(!_0xd2e9b1){_0x1c3063['sendStatus'](0x194);}return _0xd2e9b1;};}function handleError(_0x2991d5,_0x3f8be9){_0x3f8be9=_0x3f8be9||0x1f4;return function(_0x549897){logger['error'](_0x549897['stack']);if(_0x549897[_0x07dc('0x26')]){delete _0x549897[_0x07dc('0x26')];}_0x2991d5[_0x07dc('0x1a')](_0x3f8be9)['send'](_0x549897);};}exports['index']=function(_0x39e23e,_0x1cb5e6){var _0x1add3c={},_0x20c24f={},_0xbb8c02={'count':0x0,'rows':[]};var _0x3bc003=_[_0x07dc('0x27')](db[_0x07dc('0x28')][_0x07dc('0x29')],function(_0x577456){return{'name':_0x577456[_0x07dc('0x2a')],'type':_0x577456['type'][_0x07dc('0x2b')]};});_0x20c24f['model']=_[_0x07dc('0x27')](_0x3bc003,'name');_0x20c24f[_0x07dc('0x2c')]=_[_0x07dc('0x2d')](_0x39e23e[_0x07dc('0x2c')]);_0x20c24f['filters']=_[_0x07dc('0x2e')](_0x20c24f[_0x07dc('0x2f')],_0x20c24f['query']);_0x1add3c[_0x07dc('0x30')]=_[_0x07dc('0x2e')](_0x20c24f[_0x07dc('0x2f')],qs[_0x07dc('0x31')](_0x39e23e[_0x07dc('0x2c')]['fields']));_0x1add3c['attributes']=_0x1add3c[_0x07dc('0x30')][_0x07dc('0x32')]?_0x1add3c[_0x07dc('0x30')]:_0x20c24f[_0x07dc('0x2f')];if(!_0x39e23e[_0x07dc('0x2c')][_0x07dc('0x33')](_0x07dc('0x34'))){_0x1add3c['limit']=qs[_0x07dc('0x1f')](_0x39e23e[_0x07dc('0x2c')][_0x07dc('0x1f')]);_0x1add3c[_0x07dc('0x1c')]=qs[_0x07dc('0x1c')](_0x39e23e[_0x07dc('0x2c')]['offset']);}_0x1add3c[_0x07dc('0x35')]=qs[_0x07dc('0x36')](_0x39e23e['query'][_0x07dc('0x36')]);_0x1add3c[_0x07dc('0x37')]=qs[_0x07dc('0x38')](_[_0x07dc('0x39')](_0x39e23e[_0x07dc('0x2c')],_0x20c24f[_0x07dc('0x38')]),_0x3bc003);if(_0x39e23e['query'][_0x07dc('0x3a')]){_0x1add3c[_0x07dc('0x37')]=_[_0x07dc('0x3b')](_0x1add3c['where'],{'$or':_[_0x07dc('0x27')](_0x3bc003,function(_0x338491){if(_0x338491[_0x07dc('0x3c')]!==_0x07dc('0x3d')){var _0x146a07={};_0x146a07[_0x338491[_0x07dc('0x26')]]={'$like':'%'+_0x39e23e[_0x07dc('0x2c')][_0x07dc('0x3a')]+'%'};return _0x146a07;}})});}_0x1add3c=_['merge']({},_0x1add3c,_0x39e23e[_0x07dc('0x3e')]);var _0x27e6ce={'where':_0x1add3c['where']};return db[_0x07dc('0x28')]['count'](_0x27e6ce)['then'](function(_0x9c10b0){_0xbb8c02['count']=_0x9c10b0;if(_0x39e23e[_0x07dc('0x2c')][_0x07dc('0x3f')]){_0x1add3c['include']=[{'all':!![]}];}return db[_0x07dc('0x28')][_0x07dc('0x40')](_0x1add3c);})[_0x07dc('0x25')](function(_0x53481f){_0xbb8c02[_0x07dc('0x41')]=_0x53481f;return _0xbb8c02;})[_0x07dc('0x25')](respondWithFilteredResult(_0x1cb5e6,_0x1add3c))[_0x07dc('0x42')](handleError(_0x1cb5e6,null));};exports[_0x07dc('0x43')]=function(_0x1907b1,_0x37701c){var _0x33c52d={'raw':!![],'where':{'id':_0x1907b1[_0x07dc('0x44')]['id']}},_0x4f1b25={};_0x4f1b25[_0x07dc('0x2f')]=_[_0x07dc('0x2d')](db[_0x07dc('0x28')][_0x07dc('0x29')]);_0x4f1b25['query']=_[_0x07dc('0x2d')](_0x1907b1[_0x07dc('0x2c')]);_0x4f1b25[_0x07dc('0x38')]=_[_0x07dc('0x2e')](_0x4f1b25[_0x07dc('0x2f')],_0x4f1b25[_0x07dc('0x2c')]);_0x33c52d[_0x07dc('0x30')]=_[_0x07dc('0x2e')](_0x4f1b25[_0x07dc('0x2f')],qs[_0x07dc('0x31')](_0x1907b1[_0x07dc('0x2c')]['fields']));_0x33c52d[_0x07dc('0x30')]=_0x33c52d[_0x07dc('0x30')][_0x07dc('0x32')]?_0x33c52d[_0x07dc('0x30')]:_0x4f1b25[_0x07dc('0x2f')];if(_0x1907b1[_0x07dc('0x2c')][_0x07dc('0x3f')]){_0x33c52d['include']=[{'all':!![]}];}_0x33c52d=_[_0x07dc('0x3b')]({},_0x33c52d,_0x1907b1['options']);return db[_0x07dc('0x28')][_0x07dc('0x45')](_0x33c52d)[_0x07dc('0x25')](handleEntityNotFound(_0x37701c,null))[_0x07dc('0x25')](respondWithResult(_0x37701c,null))['catch'](handleError(_0x37701c,null));};exports[_0x07dc('0x46')]=function(_0x405f7e,_0x59f9b6){return db[_0x07dc('0x28')][_0x07dc('0x46')](_0x405f7e[_0x07dc('0x47')],{})[_0x07dc('0x25')](respondWithResult(_0x59f9b6,0xc9))['catch'](handleError(_0x59f9b6,null));};exports['update']=function(_0x4eda7f,_0x291e71){if(_0x4eda7f[_0x07dc('0x47')]['id']){delete _0x4eda7f[_0x07dc('0x47')]['id'];}return db['VoiceDialReport'][_0x07dc('0x45')]({'where':{'id':_0x4eda7f['params']['id']}})['then'](handleEntityNotFound(_0x291e71,null))[_0x07dc('0x25')](saveUpdates(_0x4eda7f[_0x07dc('0x47')],null))[_0x07dc('0x25')](respondWithResult(_0x291e71,null))[_0x07dc('0x42')](handleError(_0x291e71,null));};exports[_0x07dc('0x24')]=function(_0x557d57,_0x9f547c){return db[_0x07dc('0x28')][_0x07dc('0x45')]({'where':{'id':_0x557d57[_0x07dc('0x44')]['id']}})[_0x07dc('0x25')](handleEntityNotFound(_0x9f547c,null))[_0x07dc('0x25')](removeEntity(_0x9f547c,null))['catch'](handleError(_0x9f547c,null));};exports[_0x07dc('0x48')]=function(_0x3eec31,_0x306701){return db['VoiceDialReport'][_0x07dc('0x48')]()[_0x07dc('0x25')](respondWithResult(_0x306701,null))[_0x07dc('0x42')](handleError(_0x306701,null));}; \ No newline at end of file +var _0x5ddb=['includeAll','include','catch','show','params','intersection','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','options'];(function(_0xab4ad9,_0x1041f7){var _0x4febd4=function(_0x476543){while(--_0x476543){_0xab4ad9['push'](_0xab4ad9['shift']());}};_0x4febd4(++_0x1041f7);}(_0x5ddb,0x116));var _0xb5dd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5ddb[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb5dd('0x1'));var moment=require(_0xb5dd('0x2'));var BPromise=require(_0xb5dd('0x3'));var Mustache=require(_0xb5dd('0x4'));var util=require(_0xb5dd('0x5'));var path=require(_0xb5dd('0x6'));var sox=require(_0xb5dd('0x7'));var csv=require('to-csv');var ejs=require(_0xb5dd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5dd('0x9'));var squel=require(_0xb5dd('0xa'));var crypto=require(_0xb5dd('0xb'));var jsforce=require(_0xb5dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb5dd('0xd'));var querystring=require('querystring');var Papa=require(_0xb5dd('0xe'));var Redis=require(_0xb5dd('0xf'));var authService=require(_0xb5dd('0x10'));var qs=require(_0xb5dd('0x11'));var as=require(_0xb5dd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5dd('0x13'))(_0xb5dd('0x14'));var utils=require(_0xb5dd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb5dd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552385,_0x3aa10b){_0x3aa10b=_0x3aa10b||0xcc;return function(_0x39be3e){if(_0x39be3e){return _0x552385[_0xb5dd('0x17')](_0x3aa10b);}return _0x552385[_0xb5dd('0x18')](_0x3aa10b)['end']();};}function respondWithResult(_0x3ad346,_0x209ce3){_0x209ce3=_0x209ce3||0xc8;return function(_0x27413c){if(_0x27413c){return _0x3ad346[_0xb5dd('0x18')](_0x209ce3)[_0xb5dd('0x19')](_0x27413c);}};}function respondWithFilteredResult(_0x486d83,_0x3e2d7d){return function(_0x505f84){if(_0x505f84){var _0x5db084=typeof _0x3e2d7d[_0xb5dd('0x1a')]===_0xb5dd('0x1b')&&typeof _0x3e2d7d[_0xb5dd('0x1c')]===_0xb5dd('0x1b');var _0x410304=_0x505f84[_0xb5dd('0x1d')];var _0x10a62a=_0x5db084?0x0:_0x3e2d7d[_0xb5dd('0x1a')];var _0x1b6de7=_0x5db084?_0x505f84[_0xb5dd('0x1d')]:_0x3e2d7d[_0xb5dd('0x1a')]+_0x3e2d7d['limit'];var _0x3fe348;if(_0x1b6de7>=_0x410304){_0x1b6de7=_0x410304;_0x3fe348=0xc8;}else{_0x3fe348=0xce;}_0x486d83[_0xb5dd('0x18')](_0x3fe348);return _0x486d83['set'](_0xb5dd('0x1e'),_0x10a62a+'-'+_0x1b6de7+'/'+_0x410304)['json'](_0x505f84);}return null;};}function patchUpdates(_0x26a68e){return function(_0x2e916e){try{jsonpatch['apply'](_0x2e916e,_0x26a68e,!![]);}catch(_0x512aa5){return BPromise['reject'](_0x512aa5);}return _0x2e916e['save']();};}function saveUpdates(_0x49b65e,_0x11b9c8){return function(_0x43d1da){if(_0x43d1da){return _0x43d1da[_0xb5dd('0x1f')](_0x49b65e)[_0xb5dd('0x20')](function(_0x28eb4c){return _0x28eb4c;});}return null;};}function removeEntity(_0x16fc0e,_0x2c5570){return function(_0x2b247e){if(_0x2b247e){return _0x2b247e[_0xb5dd('0x21')]()['then'](function(){_0x16fc0e[_0xb5dd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab6da,_0x423985){return function(_0x27d5e9){if(!_0x27d5e9){_0x3ab6da['sendStatus'](0x194);}return _0x27d5e9;};}function handleError(_0xad4a2d,_0xf8b644){_0xf8b644=_0xf8b644||0x1f4;return function(_0xc7d608){logger[_0xb5dd('0x22')](_0xc7d608['stack']);if(_0xc7d608[_0xb5dd('0x23')]){delete _0xc7d608[_0xb5dd('0x23')];}_0xad4a2d[_0xb5dd('0x18')](_0xf8b644)[_0xb5dd('0x24')](_0xc7d608);};}exports['index']=function(_0x57c8da,_0x39957e){var _0x1c363e={},_0x43ecf8={},_0x194efb={'count':0x0,'rows':[]};var _0x191708=_['map'](db[_0xb5dd('0x25')][_0xb5dd('0x26')],function(_0x21f64e){return{'name':_0x21f64e[_0xb5dd('0x27')],'type':_0x21f64e[_0xb5dd('0x28')][_0xb5dd('0x29')]};});_0x43ecf8['model']=_[_0xb5dd('0x2a')](_0x191708,'name');_0x43ecf8[_0xb5dd('0x2b')]=_[_0xb5dd('0x2c')](_0x57c8da['query']);_0x43ecf8['filters']=_['intersection'](_0x43ecf8[_0xb5dd('0x2d')],_0x43ecf8[_0xb5dd('0x2b')]);_0x1c363e[_0xb5dd('0x2e')]=_['intersection'](_0x43ecf8[_0xb5dd('0x2d')],qs[_0xb5dd('0x2f')](_0x57c8da[_0xb5dd('0x2b')][_0xb5dd('0x2f')]));_0x1c363e['attributes']=_0x1c363e[_0xb5dd('0x2e')][_0xb5dd('0x30')]?_0x1c363e[_0xb5dd('0x2e')]:_0x43ecf8[_0xb5dd('0x2d')];if(!_0x57c8da[_0xb5dd('0x2b')]['hasOwnProperty'](_0xb5dd('0x31'))){_0x1c363e[_0xb5dd('0x1c')]=qs['limit'](_0x57c8da[_0xb5dd('0x2b')][_0xb5dd('0x1c')]);_0x1c363e[_0xb5dd('0x1a')]=qs[_0xb5dd('0x1a')](_0x57c8da[_0xb5dd('0x2b')][_0xb5dd('0x1a')]);}_0x1c363e[_0xb5dd('0x32')]=qs[_0xb5dd('0x33')](_0x57c8da[_0xb5dd('0x2b')][_0xb5dd('0x33')]);_0x1c363e[_0xb5dd('0x34')]=qs[_0xb5dd('0x35')](_[_0xb5dd('0x36')](_0x57c8da[_0xb5dd('0x2b')],_0x43ecf8[_0xb5dd('0x35')]),_0x191708);if(_0x57c8da['query']['filter']){_0x1c363e[_0xb5dd('0x34')]=_['merge'](_0x1c363e[_0xb5dd('0x34')],{'$or':_[_0xb5dd('0x2a')](_0x191708,function(_0x454157){if(_0x454157['type']!=='VIRTUAL'){var _0x5108fe={};_0x5108fe[_0x454157[_0xb5dd('0x23')]]={'$like':'%'+_0x57c8da[_0xb5dd('0x2b')]['filter']+'%'};return _0x5108fe;}})});}_0x1c363e=_[_0xb5dd('0x37')]({},_0x1c363e,_0x57c8da[_0xb5dd('0x38')]);var _0x5becc3={'where':_0x1c363e[_0xb5dd('0x34')]};return db[_0xb5dd('0x25')][_0xb5dd('0x1d')](_0x5becc3)['then'](function(_0x110bbb){_0x194efb[_0xb5dd('0x1d')]=_0x110bbb;if(_0x57c8da[_0xb5dd('0x2b')][_0xb5dd('0x39')]){_0x1c363e[_0xb5dd('0x3a')]=[{'all':!![]}];}return db[_0xb5dd('0x25')]['findAll'](_0x1c363e);})[_0xb5dd('0x20')](function(_0x3b2102){_0x194efb['rows']=_0x3b2102;return _0x194efb;})['then'](respondWithFilteredResult(_0x39957e,_0x1c363e))[_0xb5dd('0x3b')](handleError(_0x39957e,null));};exports[_0xb5dd('0x3c')]=function(_0x4aa641,_0x2379e2){var _0x5ddafc={'raw':!![],'where':{'id':_0x4aa641[_0xb5dd('0x3d')]['id']}},_0x5f03d1={};_0x5f03d1['model']=_[_0xb5dd('0x2c')](db[_0xb5dd('0x25')][_0xb5dd('0x26')]);_0x5f03d1[_0xb5dd('0x2b')]=_[_0xb5dd('0x2c')](_0x4aa641[_0xb5dd('0x2b')]);_0x5f03d1['filters']=_['intersection'](_0x5f03d1[_0xb5dd('0x2d')],_0x5f03d1[_0xb5dd('0x2b')]);_0x5ddafc[_0xb5dd('0x2e')]=_[_0xb5dd('0x3e')](_0x5f03d1['model'],qs[_0xb5dd('0x2f')](_0x4aa641['query'][_0xb5dd('0x2f')]));_0x5ddafc[_0xb5dd('0x2e')]=_0x5ddafc[_0xb5dd('0x2e')]['length']?_0x5ddafc[_0xb5dd('0x2e')]:_0x5f03d1['model'];if(_0x4aa641[_0xb5dd('0x2b')][_0xb5dd('0x39')]){_0x5ddafc[_0xb5dd('0x3a')]=[{'all':!![]}];}_0x5ddafc=_[_0xb5dd('0x37')]({},_0x5ddafc,_0x4aa641[_0xb5dd('0x38')]);return db['VoiceDialReport']['find'](_0x5ddafc)[_0xb5dd('0x20')](handleEntityNotFound(_0x2379e2,null))[_0xb5dd('0x20')](respondWithResult(_0x2379e2,null))[_0xb5dd('0x3b')](handleError(_0x2379e2,null));};exports[_0xb5dd('0x3f')]=function(_0x4fdc37,_0xe18925){return db[_0xb5dd('0x25')][_0xb5dd('0x3f')](_0x4fdc37[_0xb5dd('0x40')],{})[_0xb5dd('0x20')](respondWithResult(_0xe18925,0xc9))['catch'](handleError(_0xe18925,null));};exports[_0xb5dd('0x1f')]=function(_0x5cfbd8,_0x116f5b){if(_0x5cfbd8[_0xb5dd('0x40')]['id']){delete _0x5cfbd8[_0xb5dd('0x40')]['id'];}return db[_0xb5dd('0x25')][_0xb5dd('0x41')]({'where':{'id':_0x5cfbd8['params']['id']}})[_0xb5dd('0x20')](handleEntityNotFound(_0x116f5b,null))[_0xb5dd('0x20')](saveUpdates(_0x5cfbd8[_0xb5dd('0x40')],null))[_0xb5dd('0x20')](respondWithResult(_0x116f5b,null))[_0xb5dd('0x3b')](handleError(_0x116f5b,null));};exports['destroy']=function(_0x52c62a,_0x3e034e){return db[_0xb5dd('0x25')][_0xb5dd('0x41')]({'where':{'id':_0x52c62a['params']['id']}})[_0xb5dd('0x20')](handleEntityNotFound(_0x3e034e,null))[_0xb5dd('0x20')](removeEntity(_0x3e034e,null))[_0xb5dd('0x3b')](handleError(_0x3e034e,null));};exports[_0xb5dd('0x42')]=function(_0x4899cc,_0x9805cc){return db['VoiceDialReport'][_0xb5dd('0x42')]()[_0xb5dd('0x20')](respondWithResult(_0x9805cc,null))[_0xb5dd('0x3b')](handleError(_0x9805cc,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8ff0415..3759531 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 _0xbbaf=['define','report_dial','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x14da69,_0x24bd6b){var _0x3217b5=function(_0x13991e){while(--_0x13991e){_0x14da69['push'](_0x14da69['shift']());}};_0x3217b5(++_0x24bd6b);}(_0xbbaf,0x19c));var _0xfbba=function(_0x4dd7bb,_0x294ce5){_0x4dd7bb=_0x4dd7bb-0x0;var _0xb3bccf=_0xbbaf[_0x4dd7bb];return _0xb3bccf;};'use strict';var _=require(_0xfbba('0x0'));var util=require(_0xfbba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfbba('0x2'));var BPromise=require(_0xfbba('0x3'));var rp=require(_0xfbba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbba('0x5'));var config=require(_0xfbba('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xfbba('0x7')]=function(_0x2249fc,_0x5cd8b8){return _0x2249fc[_0xfbba('0x8')]('VoiceDialReport',attributes,{'tableName':_0xfbba('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5fd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','lodash','util'];(function(_0x5874a2,_0x29d9fe){var _0x58396f=function(_0x5f3bfb){while(--_0x5f3bfb){_0x5874a2['push'](_0x5874a2['shift']());}};_0x58396f(++_0x29d9fe);}(_0xc5fd,0xfa));var _0xdc5f=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xc5fd[_0x38537f];return _0x141e23;};'use strict';var _=require(_0xdc5f('0x0'));var util=require(_0xdc5f('0x1'));var logger=require(_0xdc5f('0x2'))(_0xdc5f('0x3'));var moment=require(_0xdc5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc5f('0x5'));var fs=require('fs');var path=require(_0xdc5f('0x6'));var rimraf=require(_0xdc5f('0x7'));var config=require(_0xdc5f('0x8'));var attributes=require(_0xdc5f('0x9'));module[_0xdc5f('0xa')]=function(_0x18730f,_0xaad25d){return _0x18730f['define'](_0xdc5f('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 677af2c..963a9ff 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 _0x7206=['error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','raw','UpdateVoiceDialReport','options','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6dbf51,_0x10a005){var _0x1544e4=function(_0x4cc6b6){while(--_0x4cc6b6){_0x6dbf51['push'](_0x6dbf51['shift']());}};_0x1544e4(++_0x10a005);}(_0x7206,0x1db));var _0x6720=function(_0x4d400c,_0x4952fb){_0x4d400c=_0x4d400c-0x0;var _0x1b9846=_0x7206[_0x4d400c];return _0x1b9846;};'use strict';var _=require(_0x6720('0x0'));var util=require(_0x6720('0x1'));var moment=require(_0x6720('0x2'));var BPromise=require(_0x6720('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6720('0x4'));var db=require(_0x6720('0x5'))['db'];var utils=require(_0x6720('0x6'));var logger=require(_0x6720('0x7'))('rpc');var config=require(_0x6720('0x8'));var jayson=require(_0x6720('0x9'));var client=jayson[_0x6720('0xa')][_0x6720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x499294,_0x59e561,_0x3a3cc4){return new BPromise(function(_0x1e831a,_0x2e6f88){return client[_0x6720('0xc')](_0x499294,_0x3a3cc4)[_0x6720('0xd')](function(_0x4d9217){logger[_0x6720('0xe')](_0x6720('0xf'),_0x59e561,_0x6720('0x10'));logger[_0x6720('0x11')](_0x6720('0x12'),_0x59e561,_0x6720('0x10'),JSON[_0x6720('0x13')](_0x4d9217));if(_0x4d9217[_0x6720('0x14')]){if(_0x4d9217[_0x6720('0x14')][_0x6720('0x15')]===0x1f4){logger[_0x6720('0x14')](_0x6720('0xf'),_0x59e561,_0x4d9217[_0x6720('0x14')][_0x6720('0x16')]);return _0x2e6f88(_0x4d9217[_0x6720('0x14')][_0x6720('0x16')]);}logger['error'](_0x6720('0xf'),_0x59e561,_0x4d9217[_0x6720('0x14')][_0x6720('0x16')]);return _0x1e831a(_0x4d9217[_0x6720('0x14')][_0x6720('0x16')]);}else{logger[_0x6720('0xe')](_0x6720('0xf'),_0x59e561,_0x6720('0x10'));_0x1e831a(_0x4d9217[_0x6720('0x17')]['message']);}})[_0x6720('0x18')](function(_0x39d528){logger[_0x6720('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x59e561,_0x39d528);_0x2e6f88(_0x39d528);});});}exports[_0x6720('0x19')]=function(_0x3ac888){var _0x2dfa8e=this;return new Promise(function(_0x49e12f,_0x36c6af){return db[_0x6720('0x1a')][_0x6720('0x1b')](_0x3ac888[_0x6720('0x1c')],{'raw':_0x3ac888['options']?_0x3ac888['options'][_0x6720('0x1d')]===undefined?!![]:![]:!![]})[_0x6720('0xd')](function(_0x1da178){logger['info'](_0x6720('0x19'),_0x3ac888);logger[_0x6720('0x11')](_0x6720('0x19'),_0x3ac888,JSON[_0x6720('0x13')](_0x1da178));_0x49e12f(_0x1da178);})[_0x6720('0x18')](function(_0x2dc680){logger[_0x6720('0x14')]('CreateVoiceDialReport',_0x2dc680[_0x6720('0x16')],_0x3ac888);_0x36c6af(_0x2dfa8e[_0x6720('0x14')](0x1f4,_0x2dc680['message']));});});};exports[_0x6720('0x1e')]=function(_0xc0caf1){var _0x12666f=this;return new Promise(function(_0x259e18,_0x524197){return db[_0x6720('0x1a')]['update'](_0xc0caf1['body'],{'raw':_0xc0caf1[_0x6720('0x1f')]?_0xc0caf1[_0x6720('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0caf1[_0x6720('0x1f')]?_0xc0caf1[_0x6720('0x1f')]['where']||null:null,'attributes':_0xc0caf1[_0x6720('0x1f')]?_0xc0caf1[_0x6720('0x1f')][_0x6720('0x20')]||null:null,'limit':_0xc0caf1['options']?_0xc0caf1[_0x6720('0x1f')]['limit']||null:null})[_0x6720('0xd')](function(_0x291222){logger[_0x6720('0xe')](_0x6720('0x1e'),_0xc0caf1);logger['debug'](_0x6720('0x1e'),_0xc0caf1,JSON[_0x6720('0x13')](_0x291222));_0x259e18(_0x291222);})[_0x6720('0x18')](function(_0x4867bc){logger[_0x6720('0x14')]('UpdateVoiceDialReport',_0x4867bc[_0x6720('0x16')],_0xc0caf1);_0x524197(_0x12666f[_0x6720('0x14')](0x1f4,_0x4867bc[_0x6720('0x16')]));});});}; \ No newline at end of file +var _0x1993=['create','body','options','raw','UpdateVoiceDialReport','where','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport'];(function(_0x1cad6c,_0x28ed12){var _0x4c4072=function(_0x4145d6){while(--_0x4145d6){_0x1cad6c['push'](_0x1cad6c['shift']());}};_0x4c4072(++_0x28ed12);}(_0x1993,0x1e7));var _0x3199=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1993[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3199('0x0'));var util=require(_0x3199('0x1'));var moment=require(_0x3199('0x2'));var BPromise=require('bluebird');var rs=require(_0x3199('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3199('0x4'))['db'];var utils=require(_0x3199('0x5'));var logger=require(_0x3199('0x6'))(_0x3199('0x7'));var config=require(_0x3199('0x8'));var jayson=require(_0x3199('0x9'));var client=jayson[_0x3199('0xa')][_0x3199('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29011c,_0x3d9da6,_0x392168){return new BPromise(function(_0x2d96b2,_0xc3995e){return client[_0x3199('0xc')](_0x29011c,_0x392168)[_0x3199('0xd')](function(_0x4ea907){logger[_0x3199('0xe')](_0x3199('0xf'),_0x3d9da6,_0x3199('0x10'));logger[_0x3199('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3d9da6,_0x3199('0x10'),JSON[_0x3199('0x12')](_0x4ea907));if(_0x4ea907['error']){if(_0x4ea907[_0x3199('0x13')][_0x3199('0x14')]===0x1f4){logger['error'](_0x3199('0xf'),_0x3d9da6,_0x4ea907[_0x3199('0x13')][_0x3199('0x15')]);return _0xc3995e(_0x4ea907[_0x3199('0x13')]['message']);}logger[_0x3199('0x13')](_0x3199('0xf'),_0x3d9da6,_0x4ea907[_0x3199('0x13')][_0x3199('0x15')]);return _0x2d96b2(_0x4ea907[_0x3199('0x13')][_0x3199('0x15')]);}else{logger['info'](_0x3199('0xf'),_0x3d9da6,_0x3199('0x10'));_0x2d96b2(_0x4ea907[_0x3199('0x16')][_0x3199('0x15')]);}})['catch'](function(_0x43b6ff){logger['error'](_0x3199('0xf'),_0x3d9da6,_0x43b6ff);_0xc3995e(_0x43b6ff);});});}exports[_0x3199('0x17')]=function(_0x47d3b0){var _0x42c863=this;return new Promise(function(_0x5e6867,_0x5ebba6){return db[_0x3199('0x18')][_0x3199('0x19')](_0x47d3b0[_0x3199('0x1a')],{'raw':_0x47d3b0['options']?_0x47d3b0[_0x3199('0x1b')][_0x3199('0x1c')]===undefined?!![]:![]:!![]})[_0x3199('0xd')](function(_0x5364e3){logger[_0x3199('0xe')]('CreateVoiceDialReport',_0x47d3b0);logger[_0x3199('0x11')]('CreateVoiceDialReport',_0x47d3b0,JSON[_0x3199('0x12')](_0x5364e3));_0x5e6867(_0x5364e3);})['catch'](function(_0x516412){logger[_0x3199('0x13')]('CreateVoiceDialReport',_0x516412[_0x3199('0x15')],_0x47d3b0);_0x5ebba6(_0x42c863[_0x3199('0x13')](0x1f4,_0x516412[_0x3199('0x15')]));});});};exports[_0x3199('0x1d')]=function(_0x46b114){var _0x597123=this;return new Promise(function(_0x1a5688,_0x30c574){return db[_0x3199('0x18')]['update'](_0x46b114['body'],{'raw':_0x46b114[_0x3199('0x1b')]?_0x46b114[_0x3199('0x1b')][_0x3199('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b114[_0x3199('0x1b')]?_0x46b114[_0x3199('0x1b')][_0x3199('0x1e')]||null:null,'attributes':_0x46b114[_0x3199('0x1b')]?_0x46b114[_0x3199('0x1b')]['attributes']||null:null,'limit':_0x46b114[_0x3199('0x1b')]?_0x46b114['options']['limit']||null:null})[_0x3199('0xd')](function(_0x368993){logger[_0x3199('0xe')](_0x3199('0x1d'),_0x46b114);logger[_0x3199('0x11')](_0x3199('0x1d'),_0x46b114,JSON[_0x3199('0x12')](_0x368993));_0x1a5688(_0x368993);})[_0x3199('0x1f')](function(_0x38f4f7){logger[_0x3199('0x13')](_0x3199('0x1d'),_0x38f4f7[_0x3199('0x15')],_0x46b114);_0x30c574(_0x597123[_0x3199('0x13')](0x1f4,_0x38f4f7[_0x3199('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c4a44ff..5ec3fbe 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 _0x6edf=['/:id/applications','addApplications','/:id','update','multer','util','connect-timeout','express','Router','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','show','post','create'];(function(_0x23bc85,_0x19addc){var _0x177dfd=function(_0x134ab5){while(--_0x134ab5){_0x23bc85['push'](_0x23bc85['shift']());}};_0x177dfd(++_0x19addc);}(_0x6edf,0x1a4));var _0xf6ed=function(_0x1fa41c,_0x1cfb55){_0x1fa41c=_0x1fa41c-0x0;var _0x56aff7=_0x6edf[_0x1fa41c];return _0x56aff7;};'use strict';var multer=require(_0xf6ed('0x0'));var util=require(_0xf6ed('0x1'));var path=require('path');var timeout=require(_0xf6ed('0x2'));var express=require(_0xf6ed('0x3'));var router=express[_0xf6ed('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf6ed('0x5'));var config=require('../../config/environment');var controller=require(_0xf6ed('0x6'));router['get']('/',auth[_0xf6ed('0x7')](),controller[_0xf6ed('0x8')]);router['get']('/:id',auth[_0xf6ed('0x7')](),controller[_0xf6ed('0x9')]);router[_0xf6ed('0xa')]('/',auth['isAuthenticated'](),controller[_0xf6ed('0xb')]);router['post'](_0xf6ed('0xc'),auth[_0xf6ed('0x7')](),controller[_0xf6ed('0xd')]);router['put'](_0xf6ed('0xe'),auth['isAuthenticated'](),controller[_0xf6ed('0xf')]);router['delete'](_0xf6ed('0xe'),auth[_0xf6ed('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe1f6=['get','/:id','post','create','/:id/applications','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xe1f6,0xdf));var _0x6e1f=function(_0x5c6acd,_0x475638){_0x5c6acd=_0x5c6acd-0x0;var _0x20bb67=_0xe1f6[_0x5c6acd];return _0x20bb67;};'use strict';var multer=require(_0x6e1f('0x0'));var util=require(_0x6e1f('0x1'));var path=require('path');var timeout=require(_0x6e1f('0x2'));var express=require(_0x6e1f('0x3'));var router=express[_0x6e1f('0x4')]();var fs_extra=require(_0x6e1f('0x5'));var auth=require(_0x6e1f('0x6'));var interaction=require(_0x6e1f('0x7'));var config=require('../../config/environment');var controller=require(_0x6e1f('0x8'));router['get']('/',auth[_0x6e1f('0x9')](),controller[_0x6e1f('0xa')]);router[_0x6e1f('0xb')](_0x6e1f('0xc'),auth[_0x6e1f('0x9')](),controller['show']);router[_0x6e1f('0xd')]('/',auth[_0x6e1f('0x9')](),controller[_0x6e1f('0xe')]);router['post'](_0x6e1f('0xf'),auth[_0x6e1f('0x9')](),controller['addApplications']);router[_0x6e1f('0x10')](_0x6e1f('0xc'),auth[_0x6e1f('0x9')](),controller['update']);router[_0x6e1f('0x11')](_0x6e1f('0xc'),auth[_0x6e1f('0x9')](),controller['destroy']);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 db9c120..9150c17 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 _0x3d25=['outbound-fax','system','any','*,*,*,*','BOOLEAN','wav','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','internal','inbound-fax'];(function(_0x32b474,_0x54667a){var _0x44dfe4=function(_0x45b8fc){while(--_0x45b8fc){_0x32b474['push'](_0x32b474['shift']());}};_0x44dfe4(++_0x54667a);}(_0x3d25,0x18c));var _0x53d2=function(_0x22241f,_0x48bd97){_0x22241f=_0x22241f-0x0;var _0x16c966=_0x3d25[_0x22241f];return _0x16c966;};'use strict';var Sequelize=require(_0x53d2('0x0'));module[_0x53d2('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x53d2('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x53d2('0x3')],'allowNull':![],'unique':_0x53d2('0x2')},'priority':{'type':Sequelize[_0x53d2('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x53d2('0x2')},'tag':{'type':Sequelize[_0x53d2('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x53d2('0x4')},'appdata':{'type':Sequelize[_0x53d2('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x53d2('0x5')](_0x53d2('0x6'),'outbound',_0x53d2('0x7'),_0x53d2('0x8'),_0x53d2('0x9'),_0x53d2('0xa'),_0x53d2('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x53d2('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x53d2('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x53d2('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x53d2('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x53d2('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x53d2('0x3')],'defaultValue':_0x53d2('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x28dac9){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x53d2('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x644c=['exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x644c,0x6d));var _0xc644=function(_0x2999d3,_0x34791d){_0x2999d3=_0x2999d3-0x0;var _0x5593e9=_0x644c[_0x2999d3];return _0x5593e9;};'use strict';var Sequelize=require(_0xc644('0x0'));module[_0xc644('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc644('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc644('0x2')},'priority':{'type':Sequelize[_0xc644('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc644('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc644('0x3')],'allowNull':![],'defaultValue':_0xc644('0x4')},'appdata':{'type':Sequelize[_0xc644('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc644('0x5')](_0xc644('0x6'),_0xc644('0x7'),'internal',_0xc644('0x8'),_0xc644('0x9'),_0xc644('0xa'),_0xc644('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xc644('0x3')]},'interval':{'type':Sequelize[_0xc644('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc644('0xc')]},'isApp':{'type':Sequelize[_0xc644('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc644('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc644('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xc644('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc644('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xc644('0xe')},'answer':{'type':Sequelize[_0xc644('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc644('0xf')],'get':function(_0x2bf210){return this[_0xc644('0x10')](_0xc644('0x11'));}},'alias':{'type':Sequelize[_0xc644('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ae40cc7..97de345 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 _0xebc2=['isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VoiceExtension','include','findAll','catch','show','params','keys','includeAll','create','body','startsWith','exten','concat','role','user','InboundRoutes','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xebc2,0x119));var _0x2ebc=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0xebc2[_0x2f8805];return _0xa16375;};'use strict';var _=require(_0x2ebc('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2ebc('0x1'))(_0x2ebc('0x2'));var config=require(_0x2ebc('0x3'));var db=require(_0x2ebc('0x4'))['db'];config[_0x2ebc('0x5')]=_[_0x2ebc('0x6')](config['redis'],{'host':_0x2ebc('0x7'),'port':0x18eb});var socket=require(_0x2ebc('0x8'))(new Redis(config[_0x2ebc('0x5')]));require(_0x2ebc('0x9'))['register'](socket);function respondWithStatusCode(_0x4761c1,_0x235cca){_0x235cca=_0x235cca||0xcc;return function(_0x48a1ce){if(_0x48a1ce){return _0x4761c1[_0x2ebc('0xa')](_0x235cca);}return _0x4761c1[_0x2ebc('0xb')](_0x235cca)[_0x2ebc('0xc')]();};}function respondWithResult(_0xbab55c,_0x23239e){_0x23239e=_0x23239e||0xc8;return function(_0x281d8f){if(_0x281d8f){return _0xbab55c['status'](_0x23239e)[_0x2ebc('0xd')](_0x281d8f);}};}function respondWithFilteredResult(_0x1f7ea1,_0x44871c){return function(_0x1c4db1){if(_0x1c4db1){var _0x56140a=typeof _0x44871c[_0x2ebc('0xe')]===_0x2ebc('0xf')&&typeof _0x44871c[_0x2ebc('0x10')]===_0x2ebc('0xf');var _0x5f03d1=_0x1c4db1['count'];var _0x21be1a=_0x56140a?0x0:_0x44871c[_0x2ebc('0xe')];var _0x47ef3d=_0x56140a?_0x1c4db1[_0x2ebc('0x11')]:_0x44871c[_0x2ebc('0xe')]+_0x44871c['limit'];var _0xfa5d28;if(_0x47ef3d>=_0x5f03d1){_0x47ef3d=_0x5f03d1;_0xfa5d28=0xc8;}else{_0xfa5d28=0xce;}_0x1f7ea1[_0x2ebc('0xb')](_0xfa5d28);return _0x1f7ea1[_0x2ebc('0x12')](_0x2ebc('0x13'),_0x21be1a+'-'+_0x47ef3d+'/'+_0x5f03d1)[_0x2ebc('0xd')](_0x1c4db1);}return null;};}function removeEntity(_0x53d6ee){return function(_0x5c8d17){if(_0x5c8d17){return _0x5c8d17[_0x2ebc('0x14')]()[_0x2ebc('0x15')](function(){var _0x2cddeb=_0x5c8d17[_0x2ebc('0x16')]({'plain':!![]});var _0xc2b330=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x2ebc('0x17'),'value':_0x2ebc('0x18'),'ignore':![]},{'name':_0x2ebc('0x19'),'value':_0x2ebc('0x1a'),'ignore':![]}];var _0x224a83=_(_0xc2b330)['filter'](_0x2ebc('0x1b'))[_0x2ebc('0x1c')](_0x2ebc('0x1d'))[_0x2ebc('0x1d')]();if(_['includes'](_0x224a83,_0x2cddeb[_0x2ebc('0x1e')])){return;}var _0x1261ab=_[_0x2ebc('0x1f')](_0xc2b330,[_0x2ebc('0x1d'),_0x2cddeb[_0x2ebc('0x1e')]])[_0x2ebc('0x20')];return db[_0x2ebc('0x21')]['destroy']({'where':{'type':_0x1261ab,'resourceId':_0x2cddeb['id']}})[_0x2ebc('0x15')](function(){return _0x5c8d17;});})[_0x2ebc('0x15')](function(){_0x53d6ee['status'](0xcc)[_0x2ebc('0xc')]();});}};}function handleEntityNotFound(_0x428096){return function(_0x1a5b2d){if(!_0x1a5b2d){_0x428096[_0x2ebc('0xa')](0x194);}return _0x1a5b2d;};}function handleError(_0x5ac5ed,_0x1f1a6b){_0x1f1a6b=_0x1f1a6b||0x1f4;return function(_0x1037d7){logger[_0x2ebc('0x22')](_0x1037d7[_0x2ebc('0x23')]);if(_0x1037d7[_0x2ebc('0x20')]){delete _0x1037d7[_0x2ebc('0x20')];}_0x5ac5ed['status'](_0x1f1a6b)[_0x2ebc('0x24')](_0x1037d7);};}exports['index']=function(_0x34dd0f,_0x3d2e4d){var _0x1ef8b6={},_0x1501cd={},_0x4d3f46={'count':0x0,'rows':[]};var _0x353ea5=_[_0x2ebc('0x1c')](db['VoiceExtension'][_0x2ebc('0x25')],function(_0x55a91a){return{'name':_0x55a91a[_0x2ebc('0x26')],'type':_0x55a91a['type'][_0x2ebc('0x27')]};});_0x1501cd[_0x2ebc('0x28')]=_[_0x2ebc('0x1c')](_0x353ea5,_0x2ebc('0x20'));_0x1501cd[_0x2ebc('0x29')]=_['keys'](_0x34dd0f[_0x2ebc('0x29')]);_0x1501cd['filters']=_[_0x2ebc('0x2a')](_0x1501cd[_0x2ebc('0x28')],_0x1501cd['query']);_0x1ef8b6[_0x2ebc('0x2b')]=_[_0x2ebc('0x2a')](_0x1501cd['model'],qs['fields'](_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0x2c')]));_0x1ef8b6['attributes']=_0x1ef8b6['attributes'][_0x2ebc('0x2d')]?_0x1ef8b6[_0x2ebc('0x2b')]:_0x1501cd[_0x2ebc('0x28')];if(!_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0x2e')](_0x2ebc('0x2f'))){_0x1ef8b6['limit']=qs[_0x2ebc('0x10')](_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0x10')]);_0x1ef8b6[_0x2ebc('0xe')]=qs[_0x2ebc('0xe')](_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0xe')]);}_0x1ef8b6[_0x2ebc('0x30')]=qs[_0x2ebc('0x31')](_0x34dd0f['query'][_0x2ebc('0x31')]);_0x1ef8b6[_0x2ebc('0x32')]=qs[_0x2ebc('0x33')](_[_0x2ebc('0x34')](_0x34dd0f[_0x2ebc('0x29')],_0x1501cd['filters']),_0x353ea5);if(_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0x35')]){_0x1ef8b6[_0x2ebc('0x32')]=_[_0x2ebc('0x36')](_0x1ef8b6[_0x2ebc('0x32')],{'$or':_[_0x2ebc('0x1c')](_0x353ea5,function(_0x586f7d){if(_0x586f7d['type']!=='VIRTUAL'){var _0xfd3b44={};_0xfd3b44[_0x586f7d[_0x2ebc('0x20')]]={'$like':'%'+_0x34dd0f[_0x2ebc('0x29')][_0x2ebc('0x35')]+'%'};return _0xfd3b44;}})});}_0x1ef8b6=_[_0x2ebc('0x36')]({},_0x1ef8b6,_0x34dd0f['options']);var _0x4f0392={'where':_0x1ef8b6[_0x2ebc('0x32')]};return db[_0x2ebc('0x37')][_0x2ebc('0x11')](_0x4f0392)[_0x2ebc('0x15')](function(_0x3ba1fc){_0x4d3f46[_0x2ebc('0x11')]=_0x3ba1fc;if(_0x34dd0f[_0x2ebc('0x29')]['includeAll']){_0x1ef8b6[_0x2ebc('0x38')]=[{'all':!![]}];}return db[_0x2ebc('0x37')][_0x2ebc('0x39')](_0x1ef8b6);})[_0x2ebc('0x15')](function(_0xd1612e){_0x4d3f46['rows']=_0xd1612e;return _0x4d3f46;})[_0x2ebc('0x15')](respondWithFilteredResult(_0x3d2e4d,_0x1ef8b6))[_0x2ebc('0x3a')](handleError(_0x3d2e4d,null));};exports[_0x2ebc('0x3b')]=function(_0x66253c,_0x10c6ed){var _0x2374fe={'raw':![],'where':{'id':_0x66253c[_0x2ebc('0x3c')]['id']}},_0xdb689e={};_0xdb689e[_0x2ebc('0x28')]=_[_0x2ebc('0x3d')](db[_0x2ebc('0x37')]['rawAttributes']);_0xdb689e[_0x2ebc('0x29')]=_[_0x2ebc('0x3d')](_0x66253c[_0x2ebc('0x29')]);_0xdb689e[_0x2ebc('0x33')]=_[_0x2ebc('0x2a')](_0xdb689e[_0x2ebc('0x28')],_0xdb689e[_0x2ebc('0x29')]);_0x2374fe[_0x2ebc('0x2b')]=_[_0x2ebc('0x2a')](_0xdb689e[_0x2ebc('0x28')],qs[_0x2ebc('0x2c')](_0x66253c[_0x2ebc('0x29')][_0x2ebc('0x2c')]));_0x2374fe[_0x2ebc('0x2b')]=_0x2374fe[_0x2ebc('0x2b')][_0x2ebc('0x2d')]?_0x2374fe[_0x2ebc('0x2b')]:_0xdb689e[_0x2ebc('0x28')];if(_0x66253c[_0x2ebc('0x29')][_0x2ebc('0x3e')]){_0x2374fe[_0x2ebc('0x38')]=[{'all':!![]}];}_0x2374fe=_[_0x2ebc('0x36')]({},_0x2374fe,_0x66253c['options']);return db[_0x2ebc('0x37')]['find'](_0x2374fe)[_0x2ebc('0x15')](handleEntityNotFound(_0x10c6ed,null))[_0x2ebc('0x15')](respondWithResult(_0x10c6ed,null))[_0x2ebc('0x3a')](handleError(_0x10c6ed,null));};exports[_0x2ebc('0x14')]=function(_0x25d3b3,_0x41aa24){return db[_0x2ebc('0x37')][_0x2ebc('0x1f')]({'where':{'id':_0x25d3b3[_0x2ebc('0x3c')]['id']}})[_0x2ebc('0x15')](handleEntityNotFound(_0x41aa24,null))[_0x2ebc('0x15')](removeEntity(_0x41aa24,null))['catch'](handleError(_0x41aa24,null));};exports[_0x2ebc('0x3f')]=function(_0x5a34a2,_0xaa59cc){if(_0x5a34a2[_0x2ebc('0x40')][_0x2ebc('0x1e')]===_0x2ebc('0x18')&&!_[_0x2ebc('0x41')](_0x5a34a2[_0x2ebc('0x40')][_0x2ebc('0x42')],'_')){_0x5a34a2['body']['exten']='_'[_0x2ebc('0x43')](_0x5a34a2[_0x2ebc('0x40')][_0x2ebc('0x42')]);}return db[_0x2ebc('0x37')]['create'](_0x5a34a2[_0x2ebc('0x40')],{'raw':![]})[_0x2ebc('0x15')](function(_0x13d3a9){var _0x1f23f1=_0x5a34a2['user'][_0x2ebc('0x16')]({'plain':!![]});if(!_0x1f23f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f23f1[_0x2ebc('0x44')]===_0x2ebc('0x45')){var _0xd1a981=_0x13d3a9[_0x2ebc('0x16')]({'plain':!![]});var _0x558dc1=[{'name':_0x2ebc('0x46'),'value':_0x2ebc('0x47')},{'name':_0x2ebc('0x17'),'value':_0x2ebc('0x18')},{'name':_0x2ebc('0x19'),'value':'internal'}];var _0x4ed8ff=_[_0x2ebc('0x1f')](_0x558dc1,[_0x2ebc('0x1d'),_0xd1a981[_0x2ebc('0x1e')]])[_0x2ebc('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0x4ed8ff,'userProfileId':_0x1f23f1[_0x2ebc('0x48')]},'raw':!![]})[_0x2ebc('0x15')](function(_0x3d653d){if(_0x3d653d&&_0x3d653d[_0x2ebc('0x49')]===0x0){return db[_0x2ebc('0x21')][_0x2ebc('0x3f')]({'name':_0xd1a981['name'],'resourceId':_0xd1a981['id'],'type':_0x3d653d[_0x2ebc('0x20')],'sectionId':_0x3d653d['id']},{})[_0x2ebc('0x15')](function(){return _0x13d3a9;});}else{return _0x13d3a9;}})['catch'](function(_0xc958d7){logger[_0x2ebc('0x22')](_0x2ebc('0x4a'),_0xc958d7);throw _0xc958d7;});}return _0x13d3a9;})['then'](respondWithResult(_0xaa59cc,0xc9))[_0x2ebc('0x3a')](handleError(_0xaa59cc,null));};exports[_0x2ebc('0x4b')]=function(_0x1061da,_0x1d89df){if(_0x1061da[_0x2ebc('0x40')]['id']){delete _0x1061da['body']['id'];}return db[_0x2ebc('0x37')][_0x2ebc('0x1f')]({'where':{'id':_0x1061da[_0x2ebc('0x3c')]['id']}})[_0x2ebc('0x15')](handleEntityNotFound(_0x1d89df,null))[_0x2ebc('0x15')](function(_0x576859){if(_0x576859){return db[_0x2ebc('0x37')][_0x2ebc('0x4b')](_[_0x2ebc('0x34')](_0x1061da['body'],[_0x2ebc('0x42'),_0x2ebc('0x4c'),'description',_0x2ebc('0x4d'),'cutdigits',_0x2ebc('0x4e'),_0x2ebc('0x4f')]),{'where':{'context':_0x576859[_0x2ebc('0x4c')],'exten':_0x576859[_0x2ebc('0x42')]},'individualHooks':!![]})[_0x2ebc('0x15')](function(_0x17fbbd){return _0x17fbbd;});}return null;})[_0x2ebc('0x15')](respondWithStatusCode(_0x1d89df,null))[_0x2ebc('0x3a')](handleError(_0x1d89df,null));};exports[_0x2ebc('0x50')]=function(_0x5796d3,_0x2cab2f){var _0x121308=_0x5796d3[_0x2ebc('0x3c')]['id'];var _0x2fba44=_0x5796d3[_0x2ebc('0x40')];var _0xacf96=0xc8;var _0x2ab5f9=null;return db['sequelize'][_0x2ebc('0x51')]({'isolationLevel':db[_0x2ebc('0x52')][_0x2ebc('0x53')][_0x2ebc('0x54')]['READ_COMMITTED']},function(_0x26d231){return db[_0x2ebc('0x37')][_0x2ebc('0x55')]({'where':{'id':_0x121308},'transaction':_0x26d231})['then'](function(_0x7aa6e5){if(_0x7aa6e5){return db[_0x2ebc('0x37')][_0x2ebc('0x14')]({'where':{'VoiceExtensionId':_0x121308},'transaction':_0x26d231})[_0x2ebc('0x15')](function(){var _0x3d0db9=_['map'](_0x2fba44,function(_0x1f7c53){_0x1f7c53[_0x2ebc('0x56')]=_0x121308;_0x1f7c53[_0x2ebc('0x57')]=!![];return _0x1f7c53;});return _0x7aa6e5[_0x2ebc('0x58')](_0x3d0db9);})[_0x2ebc('0x15')](function(_0x50604d){return db[_0x2ebc('0x37')][_0x2ebc('0x59')](_0x50604d,{'transaction':_0x26d231});});}else{_0xacf96=0x194;_0x2ab5f9=[];}});})[_0x2ebc('0x15')](function(){if(_0xacf96!==0x194){return db[_0x2ebc('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x121308},'order':_0x2ebc('0x5a')})[_0x2ebc('0x15')](function(_0x4462e1){_0x2ab5f9=_0x4462e1;});}})[_0x2ebc('0x3a')](function(_0x1f9c2c){_0xacf96=0x1f4;logger[_0x2ebc('0x22')](_0x1f9c2c[_0x2ebc('0x23')]);if(_0x1f9c2c['name']){delete _0x1f9c2c['name'];}_0x2ab5f9=_0x1f9c2c;})[_0x2ebc('0x5b')](function(){if(_0x2ab5f9===null){_0x2cab2f[_0x2ebc('0xa')](_0xacf96);}else{if(_0xacf96===0x1f4){_0x2cab2f[_0x2ebc('0xb')](_0xacf96)[_0x2ebc('0x24')](_0x2ab5f9);}else{_0x2cab2f['status'](_0xacf96)[_0x2ebc('0xd')](_0x2ab5f9);}}});}; \ No newline at end of file +var _0x793d=['./voiceExtension.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','VoiceExtension','include','findAll','rows','catch','show','params','length','includeAll','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','context','description','recordingFormat','cutdigits','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','error','stack','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x193d40,_0x1fd8b9){var _0x5b5c4f=function(_0x51c9c2){while(--_0x51c9c2){_0x193d40['push'](_0x193d40['shift']());}};_0x5b5c4f(++_0x1fd8b9);}(_0x793d,0xb6));var _0xd793=function(_0x4ab0c9,_0x4380fc){_0x4ab0c9=_0x4ab0c9-0x0;var _0x4a945b=_0x793d[_0x4ab0c9];return _0x4a945b;};'use strict';var _=require(_0xd793('0x0'));var Redis=require(_0xd793('0x1'));var qs=require(_0xd793('0x2'));var logger=require(_0xd793('0x3'))('api');var config=require(_0xd793('0x4'));var db=require(_0xd793('0x5'))['db'];config[_0xd793('0x6')]=_[_0xd793('0x7')](config[_0xd793('0x6')],{'host':_0xd793('0x8'),'port':0x18eb});var socket=require(_0xd793('0x9'))(new Redis(config['redis']));require(_0xd793('0xa'))['register'](socket);function respondWithStatusCode(_0xf05776,_0x1f1d61){_0x1f1d61=_0x1f1d61||0xcc;return function(_0x53eb0c){if(_0x53eb0c){return _0xf05776[_0xd793('0xb')](_0x1f1d61);}return _0xf05776['status'](_0x1f1d61)[_0xd793('0xc')]();};}function respondWithResult(_0x3546db,_0x478960){_0x478960=_0x478960||0xc8;return function(_0x25bb77){if(_0x25bb77){return _0x3546db[_0xd793('0xd')](_0x478960)[_0xd793('0xe')](_0x25bb77);}};}function respondWithFilteredResult(_0xbff6e8,_0x5e935e){return function(_0x46ff6a){if(_0x46ff6a){var _0x23dc97=typeof _0x5e935e[_0xd793('0xf')]===_0xd793('0x10')&&typeof _0x5e935e[_0xd793('0x11')]===_0xd793('0x10');var _0x196ae6=_0x46ff6a['count'];var _0x1aa7d8=_0x23dc97?0x0:_0x5e935e[_0xd793('0xf')];var _0x624b14=_0x23dc97?_0x46ff6a[_0xd793('0x12')]:_0x5e935e['offset']+_0x5e935e[_0xd793('0x11')];var _0x1c8c6d;if(_0x624b14>=_0x196ae6){_0x624b14=_0x196ae6;_0x1c8c6d=0xc8;}else{_0x1c8c6d=0xce;}_0xbff6e8[_0xd793('0xd')](_0x1c8c6d);return _0xbff6e8['set'](_0xd793('0x13'),_0x1aa7d8+'-'+_0x624b14+'/'+_0x196ae6)[_0xd793('0xe')](_0x46ff6a);}return null;};}function removeEntity(_0x3daa75){return function(_0x4f2ec2){if(_0x4f2ec2){return _0x4f2ec2[_0xd793('0x14')]()[_0xd793('0x15')](function(){var _0x108a37=_0x4f2ec2[_0xd793('0x16')]({'plain':!![]});var _0x3c79ea=[{'name':_0xd793('0x17'),'value':_0xd793('0x18'),'ignore':![]},{'name':_0xd793('0x19'),'value':_0xd793('0x1a'),'ignore':![]},{'name':_0xd793('0x1b'),'value':_0xd793('0x1c'),'ignore':![]}];var _0x2274cf=_(_0x3c79ea)['filter'](_0xd793('0x1d'))[_0xd793('0x1e')]('value')[_0xd793('0x1f')]();if(_[_0xd793('0x20')](_0x2274cf,_0x108a37[_0xd793('0x21')])){return;}var _0x3c77ab=_[_0xd793('0x22')](_0x3c79ea,[_0xd793('0x1f'),_0x108a37[_0xd793('0x21')]])[_0xd793('0x23')];return db[_0xd793('0x24')][_0xd793('0x14')]({'where':{'type':_0x3c77ab,'resourceId':_0x108a37['id']}})[_0xd793('0x15')](function(){return _0x4f2ec2;});})[_0xd793('0x15')](function(){_0x3daa75[_0xd793('0xd')](0xcc)[_0xd793('0xc')]();});}};}function handleEntityNotFound(_0x598376){return function(_0x51299d){if(!_0x51299d){_0x598376[_0xd793('0xb')](0x194);}return _0x51299d;};}function handleError(_0x2cece3,_0x4114e3){_0x4114e3=_0x4114e3||0x1f4;return function(_0x3ef23b){logger['error'](_0x3ef23b['stack']);if(_0x3ef23b['name']){delete _0x3ef23b[_0xd793('0x23')];}_0x2cece3[_0xd793('0xd')](_0x4114e3)['send'](_0x3ef23b);};}exports[_0xd793('0x25')]=function(_0x3f7017,_0x3a6f40){var _0x4fcc4a={},_0x51bbe5={},_0x24e502={'count':0x0,'rows':[]};var _0x3fd2ab=_['map'](db['VoiceExtension'][_0xd793('0x26')],function(_0x2a2915){return{'name':_0x2a2915[_0xd793('0x27')],'type':_0x2a2915[_0xd793('0x21')][_0xd793('0x28')]};});_0x51bbe5[_0xd793('0x29')]=_[_0xd793('0x1e')](_0x3fd2ab,_0xd793('0x23'));_0x51bbe5[_0xd793('0x2a')]=_[_0xd793('0x2b')](_0x3f7017[_0xd793('0x2a')]);_0x51bbe5[_0xd793('0x2c')]=_['intersection'](_0x51bbe5[_0xd793('0x29')],_0x51bbe5[_0xd793('0x2a')]);_0x4fcc4a[_0xd793('0x2d')]=_[_0xd793('0x2e')](_0x51bbe5[_0xd793('0x29')],qs[_0xd793('0x2f')](_0x3f7017['query']['fields']));_0x4fcc4a[_0xd793('0x2d')]=_0x4fcc4a[_0xd793('0x2d')]['length']?_0x4fcc4a[_0xd793('0x2d')]:_0x51bbe5[_0xd793('0x29')];if(!_0x3f7017[_0xd793('0x2a')][_0xd793('0x30')](_0xd793('0x31'))){_0x4fcc4a[_0xd793('0x11')]=qs['limit'](_0x3f7017[_0xd793('0x2a')][_0xd793('0x11')]);_0x4fcc4a[_0xd793('0xf')]=qs[_0xd793('0xf')](_0x3f7017[_0xd793('0x2a')][_0xd793('0xf')]);}_0x4fcc4a['order']=qs[_0xd793('0x32')](_0x3f7017['query'][_0xd793('0x32')]);_0x4fcc4a[_0xd793('0x33')]=qs[_0xd793('0x2c')](_[_0xd793('0x34')](_0x3f7017[_0xd793('0x2a')],_0x51bbe5[_0xd793('0x2c')]),_0x3fd2ab);if(_0x3f7017[_0xd793('0x2a')][_0xd793('0x35')]){_0x4fcc4a[_0xd793('0x33')]=_[_0xd793('0x36')](_0x4fcc4a['where'],{'$or':_[_0xd793('0x1e')](_0x3fd2ab,function(_0x214d1f){if(_0x214d1f['type']!==_0xd793('0x37')){var _0x2731c8={};_0x2731c8[_0x214d1f['name']]={'$like':'%'+_0x3f7017[_0xd793('0x2a')][_0xd793('0x35')]+'%'};return _0x2731c8;}})});}_0x4fcc4a=_[_0xd793('0x36')]({},_0x4fcc4a,_0x3f7017['options']);var _0x325cd6={'where':_0x4fcc4a[_0xd793('0x33')]};return db[_0xd793('0x38')][_0xd793('0x12')](_0x325cd6)['then'](function(_0x4873f1){_0x24e502[_0xd793('0x12')]=_0x4873f1;if(_0x3f7017[_0xd793('0x2a')]['includeAll']){_0x4fcc4a[_0xd793('0x39')]=[{'all':!![]}];}return db[_0xd793('0x38')][_0xd793('0x3a')](_0x4fcc4a);})[_0xd793('0x15')](function(_0x17f7ec){_0x24e502[_0xd793('0x3b')]=_0x17f7ec;return _0x24e502;})[_0xd793('0x15')](respondWithFilteredResult(_0x3a6f40,_0x4fcc4a))[_0xd793('0x3c')](handleError(_0x3a6f40,null));};exports[_0xd793('0x3d')]=function(_0x40fec5,_0x2b0a7f){var _0x1854ab={'raw':![],'where':{'id':_0x40fec5[_0xd793('0x3e')]['id']}},_0x3bc5f6={};_0x3bc5f6['model']=_['keys'](db[_0xd793('0x38')][_0xd793('0x26')]);_0x3bc5f6[_0xd793('0x2a')]=_[_0xd793('0x2b')](_0x40fec5[_0xd793('0x2a')]);_0x3bc5f6[_0xd793('0x2c')]=_[_0xd793('0x2e')](_0x3bc5f6[_0xd793('0x29')],_0x3bc5f6[_0xd793('0x2a')]);_0x1854ab['attributes']=_[_0xd793('0x2e')](_0x3bc5f6[_0xd793('0x29')],qs['fields'](_0x40fec5[_0xd793('0x2a')][_0xd793('0x2f')]));_0x1854ab[_0xd793('0x2d')]=_0x1854ab['attributes'][_0xd793('0x3f')]?_0x1854ab['attributes']:_0x3bc5f6['model'];if(_0x40fec5['query'][_0xd793('0x40')]){_0x1854ab[_0xd793('0x39')]=[{'all':!![]}];}_0x1854ab=_['merge']({},_0x1854ab,_0x40fec5['options']);return db[_0xd793('0x38')][_0xd793('0x22')](_0x1854ab)[_0xd793('0x15')](handleEntityNotFound(_0x2b0a7f,null))[_0xd793('0x15')](respondWithResult(_0x2b0a7f,null))[_0xd793('0x3c')](handleError(_0x2b0a7f,null));};exports[_0xd793('0x14')]=function(_0x229020,_0x131794){return db[_0xd793('0x38')][_0xd793('0x22')]({'where':{'id':_0x229020[_0xd793('0x3e')]['id']}})['then'](handleEntityNotFound(_0x131794,null))[_0xd793('0x15')](removeEntity(_0x131794,null))[_0xd793('0x3c')](handleError(_0x131794,null));};exports[_0xd793('0x41')]=function(_0x24a709,_0x1684d0){if(_0x24a709[_0xd793('0x42')][_0xd793('0x21')]===_0xd793('0x1a')&&!_[_0xd793('0x43')](_0x24a709[_0xd793('0x42')][_0xd793('0x44')],'_')){_0x24a709[_0xd793('0x42')][_0xd793('0x44')]='_'[_0xd793('0x45')](_0x24a709['body'][_0xd793('0x44')]);}return db['VoiceExtension'][_0xd793('0x41')](_0x24a709[_0xd793('0x42')],{'raw':![]})[_0xd793('0x15')](function(_0x477b4a){var _0x223815=_0x24a709[_0xd793('0x46')][_0xd793('0x16')]({'plain':!![]});if(!_0x223815)throw new Error(_0xd793('0x47'));if(_0x223815[_0xd793('0x48')]===_0xd793('0x46')){var _0x3cb68a=_0x477b4a[_0xd793('0x16')]({'plain':!![]});var _0x2a12a9=[{'name':_0xd793('0x17'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xd793('0x1a')},{'name':_0xd793('0x1b'),'value':_0xd793('0x1c')}];var _0x5b8ea8=_[_0xd793('0x22')](_0x2a12a9,[_0xd793('0x1f'),_0x3cb68a[_0xd793('0x21')]])[_0xd793('0x23')];return db[_0xd793('0x49')][_0xd793('0x22')]({'where':{'name':_0x5b8ea8,'userProfileId':_0x223815[_0xd793('0x4a')]},'raw':!![]})[_0xd793('0x15')](function(_0x2efda4){if(_0x2efda4&&_0x2efda4['autoAssociation']===0x0){return db[_0xd793('0x24')][_0xd793('0x41')]({'name':_0x3cb68a['name'],'resourceId':_0x3cb68a['id'],'type':_0x2efda4['name'],'sectionId':_0x2efda4['id']},{})['then'](function(){return _0x477b4a;});}else{return _0x477b4a;}})['catch'](function(_0x154d3d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x154d3d);throw _0x154d3d;});}return _0x477b4a;})[_0xd793('0x15')](respondWithResult(_0x1684d0,0xc9))[_0xd793('0x3c')](handleError(_0x1684d0,null));};exports[_0xd793('0x4b')]=function(_0x1c2130,_0x258e8e){if(_0x1c2130[_0xd793('0x42')]['id']){delete _0x1c2130['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x1c2130[_0xd793('0x3e')]['id']}})[_0xd793('0x15')](handleEntityNotFound(_0x258e8e,null))[_0xd793('0x15')](function(_0x3727b6){if(_0x3727b6){return db[_0xd793('0x38')]['update'](_['pick'](_0x1c2130['body'],[_0xd793('0x44'),_0xd793('0x4c'),_0xd793('0x4d'),_0xd793('0x4e'),_0xd793('0x4f'),'mandatoryDisposition',_0xd793('0x50')]),{'where':{'context':_0x3727b6[_0xd793('0x4c')],'exten':_0x3727b6[_0xd793('0x44')]},'individualHooks':!![]})['then'](function(_0xf58632){return _0xf58632;});}return null;})[_0xd793('0x15')](respondWithStatusCode(_0x258e8e,null))[_0xd793('0x3c')](handleError(_0x258e8e,null));};exports['addApplications']=function(_0x8d2a43,_0x249c6a){var _0x5260af=_0x8d2a43['params']['id'];var _0x57d8a0=_0x8d2a43[_0xd793('0x42')];var _0x4b293c=0xc8;var _0x1c84b4=null;return db[_0xd793('0x51')]['transaction']({'isolationLevel':db[_0xd793('0x51')][_0xd793('0x52')][_0xd793('0x53')][_0xd793('0x54')]},function(_0x183ba7){return db[_0xd793('0x38')][_0xd793('0x55')]({'where':{'id':_0x5260af},'transaction':_0x183ba7})['then'](function(_0x1f2578){if(_0x1f2578){return db[_0xd793('0x38')][_0xd793('0x14')]({'where':{'VoiceExtensionId':_0x5260af},'transaction':_0x183ba7})['then'](function(){var _0x31ada2=_[_0xd793('0x1e')](_0x57d8a0,function(_0x16d9b7){_0x16d9b7[_0xd793('0x56')]=_0x5260af;_0x16d9b7[_0xd793('0x57')]=!![];return _0x16d9b7;});return _0x1f2578[_0xd793('0x58')](_0x31ada2);})[_0xd793('0x15')](function(_0x3bfa35){return db['VoiceExtension'][_0xd793('0x59')](_0x3bfa35,{'transaction':_0x183ba7});});}else{_0x4b293c=0x194;_0x1c84b4=[];}});})[_0xd793('0x15')](function(){if(_0x4b293c!==0x194){return db['VoiceExtension'][_0xd793('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5260af},'order':_0xd793('0x5b')})[_0xd793('0x15')](function(_0x595315){_0x1c84b4=_0x595315;});}})['catch'](function(_0x1fe9e3){_0x4b293c=0x1f4;logger[_0xd793('0x5c')](_0x1fe9e3[_0xd793('0x5d')]);if(_0x1fe9e3['name']){delete _0x1fe9e3[_0xd793('0x23')];}_0x1c84b4=_0x1fe9e3;})[_0xd793('0x5e')](function(){if(_0x1c84b4===null){_0x249c6a[_0xd793('0xb')](_0x4b293c);}else{if(_0x4b293c===0x1f4){_0x249c6a[_0xd793('0xd')](_0x4b293c)[_0xd793('0x5f')](_0x1c84b4);}else{_0x249c6a[_0xd793('0xd')](_0x4b293c)[_0xd793('0xe')](_0x1c84b4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b2689bb..07e6401 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 _0x0b85=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x484ad6,_0x4efaee){var _0x4950d0=function(_0x11afec){while(--_0x11afec){_0x484ad6['push'](_0x484ad6['shift']());}};_0x4950d0(++_0x4efaee);}(_0x0b85,0x6f));var _0x50b8=function(_0x4ef4c2,_0x483c86){_0x4ef4c2=_0x4ef4c2-0x0;var _0x23a10f=_0x0b85[_0x4ef4c2];return _0x23a10f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x50b8('0x0'))['db'][_0x50b8('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x50b8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x50b8('0x3'),'afterDestroy':_0x50b8('0x4')};function emitEvent(_0x343bdc){return function(_0x406818,_0x3b578b,_0x121341){VoiceExtensionEvents['emit'](_0x343bdc+':'+_0x406818['id'],_0x406818);VoiceExtensionEvents[_0x50b8('0x5')](_0x343bdc,_0x406818);_0x121341(null);};}for(var e in events){if(events[_0x50b8('0x6')](e)){var event=events[e];VoiceExtension[_0x50b8('0x7')](e,emitEvent(event));}}module[_0x50b8('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x32c6=['remove','emit','exports','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x32c6,0x153));var _0x632c=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x32c6[_0x23be51];return _0x47a26d;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x632c('0x0'))['db'][_0x632c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x632c('0x2')](0x0);var events={'afterCreate':_0x632c('0x3'),'afterUpdate':'update','afterDestroy':_0x632c('0x4')};function emitEvent(_0x599c3c){return function(_0x24b3b7,_0x27a22e,_0x484c4c){VoiceExtensionEvents['emit'](_0x599c3c+':'+_0x24b3b7['id'],_0x24b3b7);VoiceExtensionEvents[_0x632c('0x5')](_0x599c3c,_0x24b3b7);_0x484c4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x632c('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 1be6bbf..795c7ec 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 _0x6b8f=['./voiceExtension.attributes','type','Set','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','push','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','${EXTEN:','${EXTEN}','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x1a5792,_0x2d9f40){_0x1a5792=_0x1a5792-0x0;var _0x1e4c75=_0x6b8f[_0x1a5792];return _0x1e4c75;};'use strict';var _=require('lodash');var attributes=require(_0xf6b8('0x0'));module['exports']=function(_0x311ae7){var _0x4e006e=_0x311ae7['models'];function _0x362c27(_0x15de3a){var _0x4d0ee5=0x2;var _0x2b5ca9=[{'type':_0x15de3a[_0xf6b8('0x1')],'app':_0xf6b8('0x2'),'appdata':'CDR(type)='+_0x15de3a[_0xf6b8('0x1')],'context':_0x15de3a[_0xf6b8('0x3')],'exten':_0x15de3a[_0xf6b8('0x4')],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']},{'type':_0x15de3a[_0xf6b8('0x1')],'app':_0x15de3a['alias']?'Set':_0xf6b8('0x5'),'appdata':_0x15de3a['alias']?_0xf6b8('0x6')+_0x15de3a[_0xf6b8('0x7')]:_0xf6b8('0x8'),'context':_0x15de3a[_0xf6b8('0x3')],'exten':_0x15de3a[_0xf6b8('0x4')],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']}];if(_0x15de3a[_0xf6b8('0x1')]==='inbound'){_0x2b5ca9['push']({'type':'inbound','app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x9')+_0x15de3a['id'],'context':_0x15de3a[_0xf6b8('0x3')],'exten':_0x15de3a[_0xf6b8('0x4')],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']});}_0x2b5ca9['push']({'type':_0x15de3a['type'],'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0xa'),'context':_0x15de3a['context'],'exten':_0x15de3a[_0xf6b8('0x4')],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']},{'type':_0x15de3a[_0xf6b8('0x1')],'app':_0xf6b8('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x15de3a[_0xf6b8('0x3')],'exten':_0x15de3a['exten'],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']},{'type':_0x15de3a[_0xf6b8('0x1')],'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0xb'),'context':_0x15de3a[_0xf6b8('0x3')],'exten':_0x15de3a[_0xf6b8('0x4')],'priority':_0x4d0ee5++,'VoiceExtensionId':_0x15de3a['id']});return _0x2b5ca9;}function _0x567b58(_0x48e375){var _0x3bb9ae=0x2;var _0x56508b=[{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':'CDR(type)=outbound','context':_0x48e375['context'],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0x48e375[_0xf6b8('0x7')]?_0xf6b8('0x2'):'NoOp','appdata':_0x48e375['alias']?'CDR(routeAlias)='+_0x48e375[_0xf6b8('0x7')]:_0xf6b8('0x8'),'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375['exten'],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0xd')+(_0x48e375[_0xf6b8('0xe')]?'${EXTEN:'+_0x48e375[_0xf6b8('0xe')]+'}':'${EXTEN}'),'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x9')+_0x48e375['id'],'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375['exten'],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0xf'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3bb9ae+0x2)+_0xf6b8('0x10')+(_0x3bb9ae+0x1)+')','context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':_0x48e375['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x48e375[_0xf6b8('0xe')]+'}':_0xf6b8('0x11'),'context':_0x48e375['context'],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':'outbound','app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x12'),'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':'outbound','app':_0xf6b8('0x2'),'appdata':_0xf6b8('0xb'),'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375['exten'],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x13')+_0x48e375['id'],'context':_0x48e375['context'],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']}];if(_0x48e375[_0xf6b8('0x14')](_0xf6b8('0x15'))&&_0x48e375[_0xf6b8('0x15')]!=='none'){_0x56508b[_0xf6b8('0x16')]({'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48e375['context'],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']},{'type':_0xf6b8('0xc'),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x17')+_0x48e375[_0xf6b8('0x15')]||_0xf6b8('0x18'),'context':_0x48e375[_0xf6b8('0x3')],'exten':_0x48e375[_0xf6b8('0x4')],'priority':_0x3bb9ae++,'VoiceExtensionId':_0x48e375['id']});}return _0x56508b;}function _0x4b80f7(_0x3b9493,_0x3a45e4){var _0x1894dc=[{'name':_0xf6b8('0x19'),'param':0x0},{'name':_0xf6b8('0x1a'),'param':0x1},{'name':_0xf6b8('0x1b'),'param':0x2},{'name':_0xf6b8('0x1c'),'param':0x3}];var _0x280015={};var _0x132f2b=_0x3a45e4['split'](',');var _0x54a675=[];for(var _0x2b1e36=0x0;_0x2b1e36<_0x1894dc[_0xf6b8('0x1d')];_0x2b1e36++){switch(_0x1894dc[_0x2b1e36][_0xf6b8('0x1e')]){case _0xf6b8('0x19'):_0x280015[_0xf6b8('0x19')]=_0x132f2b[_0x1894dc[_0x2b1e36][_0xf6b8('0x1f')]][_0xf6b8('0x20')]('/')[0x1];_0x280015[_0xf6b8('0x21')]=_0x132f2b[_0x1894dc[_0x2b1e36][_0xf6b8('0x1f')]][_0xf6b8('0x20')]('/')[0x2];_0x280015[_0xf6b8('0x22')]=_0x280015[_0xf6b8('0x21')]?_0x280015['phone'][_0xf6b8('0x20')]('$')[0x0]:undefined;_0x280015[_0xf6b8('0x21')]=_0x3b9493['cutdigits']?(_0x280015[_0xf6b8('0x22')]||'')+_0xf6b8('0x23')+_0x3b9493[_0xf6b8('0xe')]+'}':(_0x280015[_0xf6b8('0x22')]||'')+_0xf6b8('0x24');_0x54a675[_0x1894dc[_0x2b1e36][_0xf6b8('0x1f')]]=[_0xf6b8('0x25'),_0x280015[_0xf6b8('0x19')],_0x280015[_0xf6b8('0x21')]][_0xf6b8('0x26')]('/');break;case _0xf6b8('0x1b'):_0x280015[_0xf6b8('0x1b')]=_0x132f2b[_0x1894dc[_0x2b1e36][_0xf6b8('0x1f')]];if(_0x3b9493[_0xf6b8('0x15')]!=='none'){if(_0x280015['options']['indexOf'](_0xf6b8('0x27'))<0x0){_0x280015[_0xf6b8('0x1b')]+=_0xf6b8('0x27');}}else{_0x280015[_0xf6b8('0x1b')]=_0x280015[_0xf6b8('0x1b')][_0xf6b8('0x28')](_0xf6b8('0x27'),'');}_0x54a675[_0x1894dc[_0x2b1e36]['param']]=_0x280015[_0xf6b8('0x1b')];break;default:_0x54a675[_0x1894dc[_0x2b1e36]['param']]=_0x132f2b[_0x1894dc[_0x2b1e36][_0xf6b8('0x1f')]];}}return _0x54a675[_0xf6b8('0x26')](',');}function _0x2bd168(_0x32cb45,_0x153747,_0x498bca){return new Promise(function(_0x3621b1,_0x13b3aa){var _0x126850=[];if(_[_0xf6b8('0x29')](_0x153747))return _0x3621b1(_0x126850);_0x4e006e[_0xf6b8('0x2a')]['findAll']({'attributes':['id',_0xf6b8('0x2b'),_0xf6b8('0x2c')],'raw':!![]})[_0xf6b8('0x2d')](function(_0x5806dc){for(var _0x5cc01b=0x0,_0x1baea8=0x0;_0x5cc01b<_0x153747[_0xf6b8('0x1d')];_0x5cc01b++,_0x1baea8=0x0){var _0x251403=_0x153747[_0x5cc01b];var _0x28a80e=[];var _0x4ec962=[];delete _0x251403['id'];if(_0x251403['interval']!=='*,*,*,*'){_0x251403[_0xf6b8('0x2e')]=[_0x251403['interval']];}else{_0x251403[_0xf6b8('0x2e')]=_0x251403[_0xf6b8('0x2c')]?_[_0xf6b8('0x2f')](_[_0xf6b8('0x30')](_0x5806dc,{'IntervalId':_0x251403[_0xf6b8('0x2c')]}),_0xf6b8('0x2b')):[];}_0x251403[_0xf6b8('0x3')]=_0x32cb45[_0xf6b8('0x3')];_0x251403[_0xf6b8('0x4')]=_0x32cb45['exten'];if(_0x251403[_0xf6b8('0x1')])_0x251403['type']=_0x251403[_0xf6b8('0x1')][_0xf6b8('0x31')]();if(_0x32cb45[_0xf6b8('0x1')]===_0xf6b8('0xc')){if(_0x251403[_0xf6b8('0x14')](_0xf6b8('0x32'))&&_0x251403[_0xf6b8('0x32')]&&_0x251403['tag']!=='--'){_0x28a80e[_0xf6b8('0x16')]({'type':_0x251403[_0xf6b8('0x1')][_0xf6b8('0x31')](),'app':_0xf6b8('0x2'),'appdata':'CDR(tag)='+_0x251403[_0xf6b8('0x32')],'context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45['exten'],'priority':_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});}_0x28a80e[_0xf6b8('0x16')]({'type':_0x251403[_0xf6b8('0x1')][_0xf6b8('0x31')](),'app':'ExecIf','appdata':_0xf6b8('0x33')+(_0x251403[_0xf6b8('0x34')]?'Set(CALLERID(all)='+_0x251403['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45[_0xf6b8('0x4')],'priority':_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});}else{if(_0x251403['hasOwnProperty'](_0xf6b8('0x35'))){if([_0xf6b8('0x36'),_0xf6b8('0x37')][_0xf6b8('0x38')](_0x251403[_0xf6b8('0x39')][_0xf6b8('0x31')]())&&_0x251403[_0xf6b8('0x3a')]!=='custom'){if(_0x251403['answer']){_0x28a80e[_0xf6b8('0x16')]({'type':_0x251403[_0xf6b8('0x1')]['toLowerCase'](),'app':'ExecIf','appdata':_0xf6b8('0x3b'),'context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45[_0xf6b8('0x4')],'priority':_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});_0x28a80e[_0xf6b8('0x16')]({'type':_0x251403['type'][_0xf6b8('0x31')](),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x3c'),'context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45['exten'],'priority':_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});}else{_0x28a80e['push']({'type':_0x251403[_0xf6b8('0x1')][_0xf6b8('0x31')](),'app':_0xf6b8('0xf'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45[_0xf6b8('0x4')],'priority':_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});_0x28a80e[_0xf6b8('0x16')]({'type':_0x251403[_0xf6b8('0x1')][_0xf6b8('0x31')](),'app':_0xf6b8('0x2'),'appdata':_0xf6b8('0x3d'),'context':_0x32cb45[_0xf6b8('0x3')],'exten':_0x32cb45[_0xf6b8('0x4')],'priority':_0x251403[_0xf6b8('0x2e')]['length']+_0x498bca+_0x1baea8++,'VoiceExtensionId':_0x32cb45['id']});}}}}for(var _0x5b663c=0x0;_0x5b663c<_0x251403['intervals'][_0xf6b8('0x1d')];_0x5b663c++){var _0x2f8777=_0x498bca+_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')];var _0x5892e7=_0x5b663c===_0x251403[_0xf6b8('0x2e')][_0xf6b8('0x1d')]-0x1?_0x498bca+_0x28a80e[_0xf6b8('0x1d')]+_0x4ec962['length']+0x2:_0x498bca+_0x5b663c+0x1;_0x28a80e[_0xf6b8('0x3e')](_0x5b663c,0x0,{'type':_0x32cb45[_0xf6b8('0x1')],'app':_0xf6b8('0x3f'),'appdata':_0x251403['intervals'][_0x5b663c]+'?'+_0x32cb45['context']+_0xf6b8('0x40')+_0x2f8777+':'+_0x32cb45[_0xf6b8('0x3')]+_0xf6b8('0x40')+_0x5892e7,'exten':_0x32cb45[_0xf6b8('0x4')],'context':_0x32cb45['context'],'priority':_0x498bca+_0x5b663c,'VoiceExtensionId':_0x32cb45['id']});}if(_0x251403[_0xf6b8('0x3a')]==='outboundDial')_0x251403[_0xf6b8('0x41')]=_0x4b80f7(_0x32cb45,_0x251403[_0xf6b8('0x41')]);_0x251403[_0xf6b8('0x42')]=_0x28a80e[_0xf6b8('0x1d')]?_[_0xf6b8('0x43')](_0x28a80e)['priority']+0x1:_0x498bca;_0x126850=_[_0xf6b8('0x44')](_0x126850,_0x28a80e,[_0x251403],_0x4ec962);_0x498bca=_[_0xf6b8('0x43')](_0x126850)[_0xf6b8('0x42')]+0x1;}return _0x3621b1(_0x126850);})[_0xf6b8('0x45')](function(_0x1980de){_0x13b3aa(_0x1980de);});});}return _0x311ae7[_0xf6b8('0x46')](_0xf6b8('0x47'),attributes,{'tableName':_0xf6b8('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x37b4d9){var _0x1ed569=this['get']({'plain':!![]});var _0x447a0f=_0x1ed569[_0xf6b8('0x1')]===_0xf6b8('0xc')?_0x567b58(_0x1ed569):_0x362c27(_0x1ed569);return _0x2bd168(_0x1ed569,_0x37b4d9,_['last'](_0x447a0f)[_0xf6b8('0x42')]+0x1)['then'](function(_0x459268){var _0x5f0ed7=_['concat'](_0x447a0f,_0x459268);_0x5f0ed7[_0xf6b8('0x16')]({'type':_0x1ed569[_0xf6b8('0x1')],'app':_0xf6b8('0x49'),'exten':_0x1ed569[_0xf6b8('0x4')],'context':_0x1ed569[_0xf6b8('0x3')],'priority':_['last'](_0x5f0ed7)[_0xf6b8('0x42')]+0x1,'VoiceExtensionId':_0x1ed569['id']});return _0x5f0ed7;});}}});}; \ No newline at end of file +var _0x320e=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','phone','param','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','length','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto('];(function(_0x3c19fa,_0x21a8ba){var _0x2c3fab=function(_0xae0fef){while(--_0xae0fef){_0x3c19fa['push'](_0x3c19fa['shift']());}};_0x2c3fab(++_0x21a8ba);}(_0x320e,0x8c));var _0xe320=function(_0x62396d,_0x1ad1ba){_0x62396d=_0x62396d-0x0;var _0x49db3e=_0x320e[_0x62396d];return _0x49db3e;};'use strict';var _=require(_0xe320('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4ff8f5){var _0x429180=_0x4ff8f5[_0xe320('0x1')];function _0x3da6dd(_0x3684d6){var _0x4da752=0x2;var _0x320e09=[{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0x4')+_0x3684d6[_0xe320('0x2')],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0x3684d6[_0xe320('0x6')]?_0xe320('0x3'):_0xe320('0x7'),'appdata':_0x3684d6[_0xe320('0x6')]?_0xe320('0x8')+_0x3684d6[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']}];if(_0x3684d6[_0xe320('0x2')]===_0xe320('0xb')){_0x320e09[_0xe320('0xc')]({'type':'inbound','app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x3684d6['id'],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});}_0x320e09[_0xe320('0xc')]({'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xe'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x3684d6['context'],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6['type'],'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});return _0x320e09;}function _0x257467(_0x225428){var _0x2a726b=0x2;var _0xc9cfee=[{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x12'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0x225428[_0xe320('0x6')]?'Set':'NoOp','appdata':_0x225428[_0xe320('0x6')]?'CDR(routeAlias)='+_0x225428[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x13')+(_0x225428[_0xe320('0x14')]?_0xe320('0x15')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x16')),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x17'),'appdata':_0xe320('0x18')+(_0x2a726b+0x2)+_0xe320('0x19')+(_0x2a726b+0x1)+')','context':_0x225428['context'],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0x225428['cutdigits']?_0xe320('0x1a')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x1b'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x225428['context'],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x1c')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']}];if(_0x225428[_0xe320('0x1d')](_0xe320('0x1e'))&&_0x225428[_0xe320('0x1e')]!==_0xe320('0x1f')){_0xc9cfee[_0xe320('0xc')]({'type':'outbound','app':_0xe320('0x3'),'appdata':_0xe320('0x20'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0xe320('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x225428[_0xe320('0x1e')]||_0xe320('0x21'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']});}return _0xc9cfee;}function _0x2e1bd9(_0x3a39b5,_0x345933){var _0x27bc0a=[{'name':_0xe320('0x22'),'param':0x0},{'name':_0xe320('0x23'),'param':0x1},{'name':_0xe320('0x24'),'param':0x2},{'name':_0xe320('0x25'),'param':0x3}];var _0x316ba5={};var _0x5bc940=_0x345933[_0xe320('0x26')](',');var _0x410160=[];for(var _0x50c564=0x0;_0x50c564<_0x27bc0a['length'];_0x50c564++){switch(_0x27bc0a[_0x50c564]['name']){case _0xe320('0x22'):_0x316ba5[_0xe320('0x22')]=_0x5bc940[_0x27bc0a[_0x50c564]['param']][_0xe320('0x26')]('/')[0x1];_0x316ba5[_0xe320('0x27')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]][_0xe320('0x26')]('/')[0x2];_0x316ba5['prefix']=_0x316ba5['phone']?_0x316ba5[_0xe320('0x27')]['split']('$')[0x0]:undefined;_0x316ba5[_0xe320('0x27')]=_0x3a39b5['cutdigits']?(_0x316ba5[_0xe320('0x29')]||'')+'${EXTEN:'+_0x3a39b5[_0xe320('0x14')]+'}':(_0x316ba5[_0xe320('0x29')]||'')+_0xe320('0x16');_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=[_0xe320('0x2a'),_0x316ba5[_0xe320('0x22')],_0x316ba5[_0xe320('0x27')]][_0xe320('0x2b')]('/');break;case _0xe320('0x24'):_0x316ba5[_0xe320('0x24')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];if(_0x3a39b5[_0xe320('0x1e')]!==_0xe320('0x1f')){if(_0x316ba5[_0xe320('0x24')]['indexOf'](_0xe320('0x2c'))<0x0){_0x316ba5[_0xe320('0x24')]+=_0xe320('0x2c');}}else{_0x316ba5[_0xe320('0x24')]=_0x316ba5[_0xe320('0x24')][_0xe320('0x2d')](_0xe320('0x2c'),'');}_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=_0x316ba5[_0xe320('0x24')];break;default:_0x410160[_0x27bc0a[_0x50c564]['param']]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];}}return _0x410160['join'](',');}function _0x2aa61a(_0x46283f,_0x4abaa9,_0x125cf3){return new Promise(function(_0x53d126,_0xf80a57){var _0x24cfbb=[];if(_['isEmpty'](_0x4abaa9))return _0x53d126(_0x24cfbb);_0x429180[_0xe320('0x2e')][_0xe320('0x2f')]({'attributes':['id',_0xe320('0x30'),_0xe320('0x31')],'raw':!![]})['then'](function(_0x4acee9){for(var _0x4ae682=0x0,_0xdf1c06=0x0;_0x4ae682<_0x4abaa9[_0xe320('0x32')];_0x4ae682++,_0xdf1c06=0x0){var _0x1602d3=_0x4abaa9[_0x4ae682];var _0x344874=[];var _0x436a03=[];delete _0x1602d3['id'];if(_0x1602d3[_0xe320('0x30')]!=='*,*,*,*'){_0x1602d3['intervals']=[_0x1602d3[_0xe320('0x30')]];}else{_0x1602d3[_0xe320('0x33')]=_0x1602d3[_0xe320('0x31')]?_[_0xe320('0x34')](_[_0xe320('0x35')](_0x4acee9,{'IntervalId':_0x1602d3[_0xe320('0x31')]}),_0xe320('0x30')):[];}_0x1602d3['context']=_0x46283f[_0xe320('0x5')];_0x1602d3[_0xe320('0xa')]=_0x46283f['exten'];if(_0x1602d3[_0xe320('0x2')])_0x1602d3[_0xe320('0x2')]=_0x1602d3[_0xe320('0x2')][_0xe320('0x36')]();if(_0x46283f['type']===_0xe320('0x11')){if(_0x1602d3[_0xe320('0x1d')](_0xe320('0x37'))&&_0x1602d3[_0xe320('0x37')]&&_0x1602d3[_0xe320('0x37')]!=='--'){_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x38')+_0x1602d3[_0xe320('0x37')],'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}_0x344874['push']({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1602d3[_0xe320('0x39')]?_0xe320('0x3a')+_0x1602d3[_0xe320('0x39')]+')':_0xe320('0x3b')),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')]['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{if(_0x1602d3['hasOwnProperty'](_0xe320('0x3c'))){if(['queue',_0xe320('0x3d')][_0xe320('0x3e')](_0x1602d3[_0xe320('0x3f')][_0xe320('0x36')]())&&_0x1602d3[_0xe320('0x40')]!==_0xe320('0x41')){if(_0x1602d3[_0xe320('0x3c')]){_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x42'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x3'),'appdata':_0xe320('0x43'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f['exten'],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type'][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x44'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x45'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}}}}for(var _0x3a94ad=0x0;_0x3a94ad<_0x1602d3['intervals'][_0xe320('0x32')];_0x3a94ad++){var _0x456d75=_0x125cf3+_0x1602d3[_0xe320('0x33')][_0xe320('0x32')];var _0x100014=_0x3a94ad===_0x1602d3['intervals'][_0xe320('0x32')]-0x1?_0x125cf3+_0x344874['length']+_0x436a03[_0xe320('0x32')]+0x2:_0x125cf3+_0x3a94ad+0x1;_0x344874[_0xe320('0x46')](_0x3a94ad,0x0,{'type':_0x46283f[_0xe320('0x2')],'app':_0xe320('0x47'),'appdata':_0x1602d3[_0xe320('0x33')][_0x3a94ad]+'?'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x456d75+':'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x100014,'exten':_0x46283f[_0xe320('0xa')],'context':_0x46283f[_0xe320('0x5')],'priority':_0x125cf3+_0x3a94ad,'VoiceExtensionId':_0x46283f['id']});}if(_0x1602d3[_0xe320('0x40')]===_0xe320('0x48'))_0x1602d3['appdata']=_0x2e1bd9(_0x46283f,_0x1602d3[_0xe320('0x49')]);_0x1602d3[_0xe320('0x4a')]=_0x344874[_0xe320('0x32')]?_[_0xe320('0x4b')](_0x344874)[_0xe320('0x4a')]+0x1:_0x125cf3;_0x24cfbb=_[_0xe320('0x4c')](_0x24cfbb,_0x344874,[_0x1602d3],_0x436a03);_0x125cf3=_[_0xe320('0x4b')](_0x24cfbb)[_0xe320('0x4a')]+0x1;}return _0x53d126(_0x24cfbb);})[_0xe320('0x4d')](function(_0x3bf5ab){_0xf80a57(_0x3bf5ab);});});}return _0x4ff8f5[_0xe320('0x4e')](_0xe320('0x4f'),attributes,{'tableName':_0xe320('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x495282){var _0x3d70b5=this[_0xe320('0x51')]({'plain':!![]});var _0x163eff=_0x3d70b5['type']===_0xe320('0x11')?_0x257467(_0x3d70b5):_0x3da6dd(_0x3d70b5);return _0x2aa61a(_0x3d70b5,_0x495282,_['last'](_0x163eff)['priority']+0x1)['then'](function(_0x4bb203){var _0x4b987f=_[_0xe320('0x4c')](_0x163eff,_0x4bb203);_0x4b987f[_0xe320('0xc')]({'type':_0x3d70b5[_0xe320('0x2')],'app':_0xe320('0x52'),'exten':_0x3d70b5[_0xe320('0xa')],'context':_0x3d70b5[_0xe320('0x5')],'priority':_['last'](_0x4b987f)[_0xe320('0x4a')]+0x1,'VoiceExtensionId':_0x3d70b5['id']});return _0x4b987f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 97e4b50..c90f0f2 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 _0x5aaa=['request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0xeaa650,_0x25e306){var _0x21ecf6=function(_0x1dc1e1){while(--_0x1dc1e1){_0xeaa650['push'](_0xeaa650['shift']());}};_0x21ecf6(++_0x25e306);}(_0x5aaa,0xff));var _0xa5aa=function(_0x288eed,_0x4c32e2){_0x288eed=_0x288eed-0x0;var _0x2f1f5d=_0x5aaa[_0x288eed];return _0x2f1f5d;};'use strict';var _=require(_0xa5aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5aa('0x1'))['db'];var utils=require(_0xa5aa('0x2'));var logger=require(_0xa5aa('0x3'))('rpc');var config=require(_0xa5aa('0x4'));var jayson=require(_0xa5aa('0x5'));var client=jayson['client'][_0xa5aa('0x6')]({'port':0x232a});config[_0xa5aa('0x7')]=_[_0xa5aa('0x8')](config[_0xa5aa('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5aa('0x7')]));require(_0xa5aa('0x9'))[_0xa5aa('0xa')](socket);function respondWithRpcPromise(_0x5bb8cd,_0x51b854,_0x5769ca){return new BPromise(function(_0x119692,_0x5e23f2){return client[_0xa5aa('0xb')](_0x5bb8cd,_0x5769ca)[_0xa5aa('0xc')](function(_0x2b4b12){logger[_0xa5aa('0xd')](_0xa5aa('0xe'),_0x51b854,'request\x20sent');logger[_0xa5aa('0xf')](_0xa5aa('0x10'),_0x51b854,_0xa5aa('0x11'),JSON[_0xa5aa('0x12')](_0x2b4b12));if(_0x2b4b12['error']){if(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x14')]===0x1f4){logger[_0xa5aa('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x51b854,_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);return _0x5e23f2(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);}logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x2b4b12[_0xa5aa('0x13')]['message']);return _0x119692(_0x2b4b12[_0xa5aa('0x13')]['message']);}else{logger['info'](_0xa5aa('0xe'),_0x51b854,_0xa5aa('0x11'));_0x119692(_0x2b4b12[_0xa5aa('0x16')][_0xa5aa('0x15')]);}})[_0xa5aa('0x17')](function(_0x3977f2){logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x3977f2);_0x5e23f2(_0x3977f2);});});}exports['GetVoiceExtension']=function(_0x127eb7){var _0x1eede0=this;return new Promise(function(_0x554433,_0x1e0604){return db[_0xa5aa('0x18')]['findAll']({'raw':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1b')]||null:null,'attributes':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1c')]||null:null,'limit':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7['options'][_0xa5aa('0x1d')]||null:null,'include':_0x127eb7[_0xa5aa('0x19')]?_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x127eb7[_0xa5aa('0x19')][_0xa5aa('0x1e')],function(_0x28dc46){return{'model':db[_0x28dc46[_0xa5aa('0x20')]],'as':_0x28dc46['as'],'attributes':_0x28dc46[_0xa5aa('0x1c')],'include':_0x28dc46[_0xa5aa('0x1e')]?_[_0xa5aa('0x1f')](_0x28dc46[_0xa5aa('0x1e')],function(_0x247f69){return{'model':db[_0x247f69[_0xa5aa('0x20')]],'as':_0x247f69['as'],'attributes':_0x247f69[_0xa5aa('0x1c')],'include':_0x247f69[_0xa5aa('0x1e')]?_['map'](_0x247f69['include'],function(_0x565f64){return{'model':db[_0x565f64['model']],'as':_0x565f64['as'],'attributes':_0x565f64[_0xa5aa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb923){logger['info'](_0xa5aa('0x21'),_0x127eb7);logger[_0xa5aa('0xf')](_0xa5aa('0x21'),_0x127eb7,JSON[_0xa5aa('0x12')](_0x4bb923));_0x554433(_0x4bb923);})['catch'](function(_0x4ab988){logger[_0xa5aa('0x13')]('GetVoiceExtension',_0x4ab988[_0xa5aa('0x15')],_0x127eb7);_0x1e0604(_0x1eede0[_0xa5aa('0x13')](0x1f4,_0x4ab988['message']));});});}; \ No newline at end of file +var _0x16cc=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','info','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2f6a87,_0xdd5d25){var _0xc050d8=function(_0x2aa4ad){while(--_0x2aa4ad){_0x2f6a87['push'](_0x2f6a87['shift']());}};_0xc050d8(++_0xdd5d25);}(_0x16cc,0x120));var _0xc16c=function(_0x2d8df1,_0x3be730){_0x2d8df1=_0x2d8df1-0x0;var _0x3b0948=_0x16cc[_0x2d8df1];return _0x3b0948;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var moment=require(_0xc16c('0x1'));var BPromise=require(_0xc16c('0x2'));var rs=require(_0xc16c('0x3'));var fs=require('fs');var Redis=require(_0xc16c('0x4'));var db=require(_0xc16c('0x5'))['db'];var utils=require(_0xc16c('0x6'));var logger=require('../../config/logger')(_0xc16c('0x7'));var config=require(_0xc16c('0x8'));var jayson=require(_0xc16c('0x9'));var client=jayson[_0xc16c('0xa')]['http']({'port':0x232a});config[_0xc16c('0xb')]=_['defaults'](config[_0xc16c('0xb')],{'host':_0xc16c('0xc'),'port':0x18eb});var socket=require(_0xc16c('0xd'))(new Redis(config[_0xc16c('0xb')]));require('./voiceExtension.socket')[_0xc16c('0xe')](socket);function respondWithRpcPromise(_0x286c40,_0x3f3ff4,_0x462dcf){return new BPromise(function(_0x510afb,_0x2ccba4){return client[_0xc16c('0xf')](_0x286c40,_0x462dcf)[_0xc16c('0x10')](function(_0x4cb366){logger['info'](_0xc16c('0x11'),_0x3f3ff4,_0xc16c('0x12'));logger[_0xc16c('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3f3ff4,'request\x20sent',JSON['stringify'](_0x4cb366));if(_0x4cb366[_0xc16c('0x14')]){if(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x15')]===0x1f4){logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);return _0x2ccba4(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);}logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);return _0x510afb(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x3f3ff4,_0xc16c('0x12'));_0x510afb(_0x4cb366[_0xc16c('0x17')][_0xc16c('0x16')]);}})[_0xc16c('0x18')](function(_0x432a0a){logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x432a0a);_0x2ccba4(_0x432a0a);});});}exports[_0xc16c('0x19')]=function(_0x55dc03){var _0x4770d2=this;return new Promise(function(_0x37afc3,_0x121da2){return db[_0xc16c('0x1a')][_0xc16c('0x1b')]({'raw':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1d')]===undefined?!![]:![]:!![],'where':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1e')]||null:null,'attributes':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1f')]||null:null,'limit':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03['options']['limit']||null:null,'include':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03['options'][_0xc16c('0x20')]?_[_0xc16c('0x21')](_0x55dc03['options'][_0xc16c('0x20')],function(_0x4eb194){return{'model':db[_0x4eb194[_0xc16c('0x22')]],'as':_0x4eb194['as'],'attributes':_0x4eb194[_0xc16c('0x1f')],'include':_0x4eb194['include']?_[_0xc16c('0x21')](_0x4eb194[_0xc16c('0x20')],function(_0x323b60){return{'model':db[_0x323b60['model']],'as':_0x323b60['as'],'attributes':_0x323b60[_0xc16c('0x1f')],'include':_0x323b60[_0xc16c('0x20')]?_['map'](_0x323b60[_0xc16c('0x20')],function(_0x1457d4){return{'model':db[_0x1457d4['model']],'as':_0x1457d4['as'],'attributes':_0x1457d4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc16c('0x10')](function(_0x4dd804){logger[_0xc16c('0x23')](_0xc16c('0x19'),_0x55dc03);logger[_0xc16c('0x13')]('GetVoiceExtension',_0x55dc03,JSON[_0xc16c('0x24')](_0x4dd804));_0x37afc3(_0x4dd804);})[_0xc16c('0x18')](function(_0xbe9a46){logger[_0xc16c('0x14')](_0xc16c('0x19'),_0xbe9a46[_0xc16c('0x16')],_0x55dc03);_0x121da2(_0x4770d2[_0xc16c('0x14')](0x1f4,_0xbe9a46[_0xc16c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9413519..891e193 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x223540,_0x1af66a){var _0x221ae7=function(_0x4a975d){while(--_0x4a975d){_0x223540['push'](_0x223540['shift']());}};_0x221ae7(++_0x1af66a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x5fc3[_0x25fc41];return _0x1371d1;};'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 +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x4725ff,_0x55804b){var _0x5eccdf=function(_0x158a77){while(--_0x158a77){_0x4725ff['push'](_0x4725ff['shift']());}};_0x5eccdf(++_0x55804b);}(_0xe14b,0x93));var _0xbe14=function(_0x4183a8,_0x438f0c){_0x4183a8=_0x4183a8-0x0;var _0x4e1027=_0xe14b[_0x4183a8];return _0x4e1027;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index daad2c4..8e547a7 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 _0xe3da=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy'];(function(_0x5ec5cc,_0x3c1c31){var _0x2ed27c=function(_0x1ac59c){while(--_0x1ac59c){_0x5ec5cc['push'](_0x5ec5cc['shift']());}};_0x2ed27c(++_0x3c1c31);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router['delete'](_0xae3d('0xe'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);module[_0xae3d('0x16')]=router; \ No newline at end of file +var _0x2272=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var fs_extra=require(_0x2227('0x5'));var auth=require(_0x2227('0x6'));var interaction=require(_0x2227('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x2227('0x8')]('/',auth[_0x2227('0x9')](),controller[_0x2227('0xa')]);router[_0x2227('0x8')](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0xc')]);router[_0x2227('0x8')](_0x2227('0xd'),auth[_0x2227('0x9')](),controller['getMessages']);router[_0x2227('0xe')]('/',auth['isAuthenticated'](),controller[_0x2227('0xf')]);router[_0x2227('0x10')](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0x11')]);router['delete'](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0x12')]);module[_0x2227('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f01b7c4..e68bdb4 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 _0x86a3=['string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','setDataValue','email'];(function(_0x390e6c,_0x4d7d42){var _0x596b05=function(_0xe6d4aa){while(--_0xe6d4aa){_0x390e6c['push'](_0x390e6c['shift']());}};_0x596b05(++_0x4d7d42);}(_0x86a3,0x162));var _0x386a=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x86a3[_0x16ea87];return _0x6e7b1c;};'use strict';var Sequelize=require(_0x386a('0x0'));module[_0x386a('0x1')]={'customer_id':{'type':Sequelize[_0x386a('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x386a('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x386a('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x386a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4b978a){this[_0x386a('0x4')](_0x386a('0x5'),typeof _0x4b978a===_0x386a('0x6')&&_0x4b978a[_0x386a('0x7')]()?_0x4b978a['trim']():null);}},'pager':{'type':Sequelize[_0x386a('0x2')]},'tz':{'type':Sequelize[_0x386a('0x2')],'defaultValue':_0x386a('0x8')},'attach':{'type':Sequelize[_0x386a('0x9')](_0x386a('0xa'),'no'),'defaultValue':_0x386a('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x386a('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x386a('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x386a('0x9')](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x386a('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x386a('0x9')](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x386a('0xa'),'no'),'defaultValue':_0x386a('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x386a('0x9')](_0x386a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x386a('0x9')](_0x386a('0xa'),'no'),'defaultValue':_0x386a('0xa'),'allowNull':![]},'stamp':{'type':_0x386a('0xb')},'emailsubject':{'type':Sequelize[_0x386a('0x2')]},'emailbody':{'type':Sequelize[_0x386a('0x2')]},'maxsecs':{'type':Sequelize[_0x386a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x386a('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x386a('0xd')],'get':function(){return this[_0x386a('0xe')](_0x386a('0xf'))+_0x386a('0x10')+this[_0x386a('0xe')](_0x386a('0x11'));}}}; \ No newline at end of file +var _0x1c96=['from-voicemail','STRING','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','\x20-\x20','mailbox','sequelize'];(function(_0x46ea4f,_0xf9f1db){var _0x48e842=function(_0x905b0){while(--_0x905b0){_0x46ea4f['push'](_0x46ea4f['shift']());}};_0x48e842(++_0xf9f1db);}(_0x1c96,0x6f));var _0x61c9=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1c96[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x61c9('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x61c9('0x1'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x61c9('0x2')],'defaultValue':'','allowNull':![],'unique':_0x61c9('0x3')},'password':{'type':Sequelize[_0x61c9('0x2')]},'fullname':{'type':Sequelize[_0x61c9('0x2')]},'email':{'type':Sequelize[_0x61c9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5d0aeb){this['setDataValue'](_0x61c9('0x4'),typeof _0x5d0aeb===_0x61c9('0x5')&&_0x5d0aeb['trim']()?_0x5d0aeb[_0x61c9('0x6')]():null);}},'pager':{'type':Sequelize[_0x61c9('0x2')]},'tz':{'type':Sequelize[_0x61c9('0x2')],'defaultValue':_0x61c9('0x7')},'attach':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':_0x61c9('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x61c9('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x61c9('0x2')]},'review':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x61c9('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':_0x61c9('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x61c9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x61c9('0x8')](_0x61c9('0x9'),'no'),'defaultValue':_0x61c9('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x61c9('0x2')]},'emailbody':{'type':Sequelize[_0x61c9('0x2')]},'maxsecs':{'type':Sequelize[_0x61c9('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x61c9('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0x61c9('0xc')+this['getDataValue'](_0x61c9('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3a9b860..e3dad86 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 _0x750a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMail','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','getMessages','findOne','VoiceMailMessage','length','findAndCountAll','rimraf','request-promise','moment','bluebird'];(function(_0x214393,_0x243463){var _0x38be1a=function(_0x3e46b0){while(--_0x3e46b0){_0x214393['push'](_0x214393['shift']());}};_0x38be1a(++_0x243463);}(_0x750a,0x140));var _0xa750=function(_0x24f20d,_0xd6af65){_0x24f20d=_0x24f20d-0x0;var _0x12812c=_0x750a[_0x24f20d];return _0x12812c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['VoiceMail'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['VoiceMail'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['VoiceMail']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));};exports[_0xa750('0x4c')]=function(_0x13528a,_0x599e7e,_0x590b1c){return db[_0xa750('0x3e')][_0xa750('0x4d')]({'where':{'id':_0x13528a[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x599e7e,null))[_0xa750('0x1d')](function(_0x5a3cd5){var _0x4030b3;var _0xaa63be={},_0x2c7dd0={};_0x2c7dd0[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x4e')][_0xa750('0x28')]);_0x2c7dd0[_0xa750('0x30')]=_['keys'](_0x13528a[_0xa750('0x30')]);_0x2c7dd0[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],_0x2c7dd0[_0xa750('0x30')]);_0xaa63be['attributes']=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x13528a[_0xa750('0x30')][_0xa750('0x31')]));_0xaa63be[_0xa750('0x32')]=_0xaa63be[_0xa750('0x32')][_0xa750('0x4f')]?_0xaa63be[_0xa750('0x32')]:_0x2c7dd0[_0xa750('0x2c')];if(!_0x13528a[_0xa750('0x30')][_0xa750('0x33')](_0xa750('0x34'))){_0xaa63be[_0xa750('0x35')]=qs[_0xa750('0x35')](_0x13528a[_0xa750('0x30')]['limit']);_0xaa63be[_0xa750('0x17')]=qs['offset'](_0x13528a[_0xa750('0x30')][_0xa750('0x17')]);}_0xaa63be[_0xa750('0x36')]=qs['sort'](_0x13528a[_0xa750('0x30')][_0xa750('0x37')]);_0xaa63be[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x39')](_0x13528a[_0xa750('0x30')],_0x2c7dd0['filters']));if(_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]){_0xaa63be['where']=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'$or':_[_0xa750('0x27')](_0xaa63be[_0xa750('0x32')],function(_0x3255c7){var _0x1b7597={};_0x1b7597[_0x3255c7]={'$like':'%'+_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]+'%'};return _0x1b7597;})});}_0xaa63be[_0xa750('0x38')]=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'mailboxuser':_0x5a3cd5['mailbox']});_0xaa63be=_['merge']({},_0xaa63be,_0x13528a[_0xa750('0x3d')]);return db[_0xa750('0x4e')][_0xa750('0x50')](_0xaa63be)[_0xa750('0x1d')](respondWithFilteredResult(_0x599e7e,_0xaa63be));})['catch'](handleError(_0x599e7e,null));}; \ No newline at end of file +var _0x351d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','get','Voicemails','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis'];(function(_0x50b47f,_0x813df7){var _0x17b49a=function(_0x32a0fd){while(--_0x32a0fd){_0x50b47f['push'](_0x50b47f['shift']());}};_0x17b49a(++_0x813df7);}(_0x351d,0x90));var _0xd351=function(_0x467708,_0x4e9974){_0x467708=_0x467708-0x0;var _0x4d4149=_0x351d[_0x467708];return _0x4d4149;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){var _0x4626c4=_0x59fb6d[_0xd351('0x20')]({'plain':!![]});var _0x489c9a=_0xd351('0x21');return db['UserProfileResource'][_0xd351('0x1e')]({'where':{'type':_0x489c9a,'resourceId':_0x4626c4['id']}})[_0xd351('0x1f')](function(){return _0x59fb6d;});})['then'](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d67e,_0x1d0cb1){return function(_0x560be9){if(!_0x560be9){_0x50d67e['sendStatus'](0x194);}return _0x560be9;};}function handleError(_0x134580,_0x555a50){_0x555a50=_0x555a50||0x1f4;return function(_0x38471c){logger[_0xd351('0x22')](_0x38471c[_0xd351('0x23')]);if(_0x38471c['name']){delete _0x38471c[_0xd351('0x24')];}_0x134580['status'](_0x555a50)[_0xd351('0x25')](_0x38471c);};}exports['index']=function(_0x5f07b1,_0xeb4da9){var _0x38c82f={},_0x3f9ef3={},_0x33b43d={'count':0x0,'rows':[]};var _0x48aa96=_[_0xd351('0x26')](db[_0xd351('0x27')][_0xd351('0x28')],function(_0x41da60){return{'name':_0x41da60[_0xd351('0x29')],'type':_0x41da60[_0xd351('0x2a')][_0xd351('0x2b')]};});_0x3f9ef3[_0xd351('0x2c')]=_[_0xd351('0x26')](_0x48aa96,'name');_0x3f9ef3[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5f07b1[_0xd351('0x2d')]);_0x3f9ef3[_0xd351('0x2f')]=_['intersection'](_0x3f9ef3[_0xd351('0x2c')],_0x3f9ef3[_0xd351('0x2d')]);_0x38c82f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x3f9ef3[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x32')]));_0x38c82f[_0xd351('0x30')]=_0x38c82f['attributes']['length']?_0x38c82f[_0xd351('0x30')]:_0x3f9ef3[_0xd351('0x2c')];if(!_0x5f07b1[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x38c82f[_0xd351('0x17')]=qs['limit'](_0x5f07b1['query'][_0xd351('0x17')]);_0x38c82f['offset']=qs[_0xd351('0x19')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x38c82f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x36')]);_0x38c82f[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x5f07b1[_0xd351('0x2d')],_0x3f9ef3['filters']),_0x48aa96);if(_0x5f07b1[_0xd351('0x2d')]['filter']){_0x38c82f[_0xd351('0x37')]=_[_0xd351('0x39')](_0x38c82f[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x48aa96,function(_0x3b42e7){if(_0x3b42e7[_0xd351('0x2a')]!=='VIRTUAL'){var _0x3ad98e={};_0x3ad98e[_0x3b42e7[_0xd351('0x24')]]={'$like':'%'+_0x5f07b1['query'][_0xd351('0x3a')]+'%'};return _0x3ad98e;}})});}_0x38c82f=_[_0xd351('0x39')]({},_0x38c82f,_0x5f07b1[_0xd351('0x3b')]);var _0x1fc216={'where':_0x38c82f[_0xd351('0x37')]};return db['VoiceMail']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x38c82f);})[_0xd351('0x1f')](function(_0x18f9d1){_0x33b43d[_0xd351('0x3e')]=_0x18f9d1;return _0x33b43d;})[_0xd351('0x1f')](respondWithFilteredResult(_0xeb4da9,_0x38c82f))[_0xd351('0x3f')](handleError(_0xeb4da9,null));};exports[_0xd351('0x40')]=function(_0x6192c3,_0x110458){var _0x129605={'raw':!![],'where':{'id':_0x6192c3['params']['id']}},_0x553360={};_0x553360[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x553360[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x6192c3[_0xd351('0x2d')]);_0x553360[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],_0x553360[_0xd351('0x2d')]);_0x129605[_0xd351('0x30')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x6192c3[_0xd351('0x2d')]['fields']));_0x129605[_0xd351('0x30')]=_0x129605[_0xd351('0x30')][_0xd351('0x41')]?_0x129605['attributes']:_0x553360[_0xd351('0x2c')];if(_0x6192c3[_0xd351('0x2d')][_0xd351('0x3c')]){_0x129605[_0xd351('0x3d')]=[{'all':!![]}];}_0x129605=_[_0xd351('0x39')]({},_0x129605,_0x6192c3['options']);return db[_0xd351('0x27')]['find'](_0x129605)[_0xd351('0x1f')](handleEntityNotFound(_0x110458,null))[_0xd351('0x1f')](respondWithResult(_0x110458,null))['catch'](handleError(_0x110458,null));};exports['create']=function(_0x1bd727,_0x444206){return db[_0xd351('0x27')]['create'](_0x1bd727[_0xd351('0x42')],{})[_0xd351('0x1f')](function(_0x548d90){var _0xf3ce5=_0x1bd727['user'][_0xd351('0x20')]({'plain':!![]});if(!_0xf3ce5)throw new Error(_0xd351('0x43'));if(_0xf3ce5['role']==='user'){var _0x25ea1e=_0x548d90['get']({'plain':!![]});var _0xf9f375=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0xf9f375,'userProfileId':_0xf3ce5[_0xd351('0x45')]},'raw':!![]})['then'](function(_0x5527da){if(_0x5527da&&_0x5527da['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x25ea1e[_0xd351('0x24')],'resourceId':_0x25ea1e['id'],'type':_0x5527da['name'],'sectionId':_0x5527da['id']},{})['then'](function(){return _0x548d90;});}else{return _0x548d90;}})[_0xd351('0x3f')](function(_0x42f248){logger['error'](_0xd351('0x48'),_0x42f248);throw _0x42f248;});}return _0x548d90;})[_0xd351('0x1f')](respondWithResult(_0x444206,0xc9))['catch'](handleError(_0x444206,null));};exports[_0xd351('0x1d')]=function(_0x59ab0f,_0x22394e){if(_0x59ab0f['body']['id']){delete _0x59ab0f[_0xd351('0x42')]['id'];}return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](saveUpdates(_0x59ab0f[_0xd351('0x42')],null))['then'](respondWithResult(_0x22394e,null))['catch'](handleError(_0x22394e,null));};exports[_0xd351('0x1e')]=function(_0x624224,_0x53a9da){return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x624224[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a9da,null))[_0xd351('0x1f')](removeEntity(_0x53a9da,null))['catch'](handleError(_0x53a9da,null));};exports['getMessages']=function(_0x2c0cb1,_0x434465,_0x4d5a60){return db[_0xd351('0x27')][_0xd351('0x4b')]({'where':{'id':_0x2c0cb1[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x434465,null))[_0xd351('0x1f')](function(_0x2dc745){var _0x505622;var _0x1e1173={},_0x2a7390={};_0x2a7390[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x4c')][_0xd351('0x28')]);_0x2a7390[_0xd351('0x2d')]=_['keys'](_0x2c0cb1[_0xd351('0x2d')]);_0x2a7390['filters']=_[_0xd351('0x31')](_0x2a7390[_0xd351('0x2c')],_0x2a7390[_0xd351('0x2d')]);_0x1e1173[_0xd351('0x30')]=_[_0xd351('0x31')](_0x2a7390['model'],qs[_0xd351('0x32')](_0x2c0cb1['query'][_0xd351('0x32')]));_0x1e1173[_0xd351('0x30')]=_0x1e1173[_0xd351('0x30')][_0xd351('0x41')]?_0x1e1173[_0xd351('0x30')]:_0x2a7390['model'];if(!_0x2c0cb1['query'][_0xd351('0x33')](_0xd351('0x34'))){_0x1e1173['limit']=qs[_0xd351('0x17')](_0x2c0cb1[_0xd351('0x2d')][_0xd351('0x17')]);_0x1e1173['offset']=qs[_0xd351('0x19')](_0x2c0cb1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x1e1173[_0xd351('0x35')]=qs['sort'](_0x2c0cb1['query'][_0xd351('0x36')]);_0x1e1173[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x2c0cb1[_0xd351('0x2d')],_0x2a7390[_0xd351('0x2f')]));if(_0x2c0cb1[_0xd351('0x2d')]['filter']){_0x1e1173[_0xd351('0x37')]=_['merge'](_0x1e1173['where'],{'$or':_[_0xd351('0x26')](_0x1e1173[_0xd351('0x30')],function(_0x4799ae){var _0x182bdc={};_0x182bdc[_0x4799ae]={'$like':'%'+_0x2c0cb1['query']['filter']+'%'};return _0x182bdc;})});}_0x1e1173['where']=_[_0xd351('0x39')](_0x1e1173[_0xd351('0x37')],{'mailboxuser':_0x2dc745[_0xd351('0x4d')]});_0x1e1173=_['merge']({},_0x1e1173,_0x2c0cb1[_0xd351('0x3b')]);return db[_0xd351('0x4c')][_0xd351('0x4e')](_0x1e1173)[_0xd351('0x1f')](respondWithFilteredResult(_0x434465,_0x1e1173));})[_0xd351('0x3f')](handleError(_0x434465,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 82249ae..c0d7f45 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 _0x77d7=['exports','VoiceMail','voice_voicemail','mailbox','context','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x77d7,0x1a5));var _0x777d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x77d7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x777d('0x0'));var util=require('util');var logger=require(_0x777d('0x1'))(_0x777d('0x2'));var moment=require(_0x777d('0x3'));var BPromise=require(_0x777d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x777d('0x5'));var rimraf=require(_0x777d('0x6'));var config=require(_0x777d('0x7'));var attributes=require('./voiceMail.attributes');module[_0x777d('0x8')]=function(_0x2897cc,_0x310eef){return _0x2897cc['define'](_0x777d('0x9'),attributes,{'tableName':_0x777d('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x777d('0xb'),_0x777d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7272=['context','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox'];(function(_0x5b55a3,_0x44f318){var _0x246c1d=function(_0x2817f7){while(--_0x2817f7){_0x5b55a3['push'](_0x5b55a3['shift']());}};_0x246c1d(++_0x44f318);}(_0x7272,0x1d2));var _0x2727=function(_0x29f6fb,_0x2e7841){_0x29f6fb=_0x29f6fb-0x0;var _0x1ec4d8=_0x7272[_0x29f6fb];return _0x1ec4d8;};'use strict';var _=require(_0x2727('0x0'));var util=require('util');var logger=require(_0x2727('0x1'))(_0x2727('0x2'));var moment=require(_0x2727('0x3'));var BPromise=require(_0x2727('0x4'));var rp=require(_0x2727('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2727('0x6'));var config=require(_0x2727('0x7'));var attributes=require(_0x2727('0x8'));module[_0x2727('0x9')]=function(_0x1f6b13,_0x107913){return _0x1f6b13[_0x2727('0xa')](_0x2727('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x2727('0xc'),'fields':[_0x2727('0xd'),_0x2727('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 6abcb14..4c1e16e 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 _0x04ba=['request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x258932,_0x1b9d89){var _0x6c4c77=function(_0x3b147d){while(--_0x3b147d){_0x258932['push'](_0x258932['shift']());}};_0x6c4c77(++_0x1b9d89);}(_0x04ba,0xb5));var _0xa04b=function(_0x14cef4,_0x3c37dc){_0x14cef4=_0x14cef4-0x0;var _0x57079b=_0x04ba[_0x14cef4];return _0x57079b;};'use strict';var _=require(_0xa04b('0x0'));var util=require('util');var moment=require(_0xa04b('0x1'));var BPromise=require(_0xa04b('0x2'));var rs=require(_0xa04b('0x3'));var fs=require('fs');var Redis=require(_0xa04b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa04b('0x5'));var logger=require(_0xa04b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa04b('0x7'));var client=jayson[_0xa04b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eba82,_0x214602,_0x474a9b){return new BPromise(function(_0x3dd262,_0x49a788){return client[_0xa04b('0x9')](_0x1eba82,_0x474a9b)[_0xa04b('0xa')](function(_0x534220){logger[_0xa04b('0xb')](_0xa04b('0xc'),_0x214602,_0xa04b('0xd'));logger[_0xa04b('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x214602,_0xa04b('0xd'),JSON[_0xa04b('0xf')](_0x534220));if(_0x534220[_0xa04b('0x10')]){if(_0x534220['error']['code']===0x1f4){logger[_0xa04b('0x10')]('VoiceMail,\x20%s,\x20%s',_0x214602,_0x534220[_0xa04b('0x10')][_0xa04b('0x11')]);return _0x49a788(_0x534220['error'][_0xa04b('0x11')]);}logger['error'](_0xa04b('0xc'),_0x214602,_0x534220[_0xa04b('0x10')][_0xa04b('0x11')]);return _0x3dd262(_0x534220[_0xa04b('0x10')][_0xa04b('0x11')]);}else{logger['info'](_0xa04b('0xc'),_0x214602,'request\x20sent');_0x3dd262(_0x534220['result']['message']);}})[_0xa04b('0x12')](function(_0x40917c){logger[_0xa04b('0x10')]('VoiceMail,\x20%s,\x20%s',_0x214602,_0x40917c);_0x49a788(_0x40917c);});});} \ No newline at end of file +var _0x3ea3=['../../config/environment','jayson/promise','client','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x148bd2,_0x3338c6){var _0x38c56f=function(_0x237939){while(--_0x237939){_0x148bd2['push'](_0x148bd2['shift']());}};_0x38c56f(++_0x3338c6);}(_0x3ea3,0xf3));var _0x33ea=function(_0x31aa64,_0x1b6575){_0x31aa64=_0x31aa64-0x0;var _0x1cf1ec=_0x3ea3[_0x31aa64];return _0x1cf1ec;};'use strict';var _=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var moment=require(_0x33ea('0x2'));var BPromise=require(_0x33ea('0x3'));var rs=require(_0x33ea('0x4'));var fs=require('fs');var Redis=require(_0x33ea('0x5'));var db=require(_0x33ea('0x6'))['db'];var utils=require(_0x33ea('0x7'));var logger=require('../../config/logger')(_0x33ea('0x8'));var config=require(_0x33ea('0x9'));var jayson=require(_0x33ea('0xa'));var client=jayson[_0x33ea('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ca142,_0x518f0a,_0x40f0dd){return new BPromise(function(_0x35ba2a,_0x276426){return client[_0x33ea('0xc')](_0x3ca142,_0x40f0dd)['then'](function(_0x130da1){logger['info'](_0x33ea('0xd'),_0x518f0a,_0x33ea('0xe'));logger[_0x33ea('0xf')](_0x33ea('0x10'),_0x518f0a,_0x33ea('0xe'),JSON[_0x33ea('0x11')](_0x130da1));if(_0x130da1[_0x33ea('0x12')]){if(_0x130da1['error']['code']===0x1f4){logger['error'](_0x33ea('0xd'),_0x518f0a,_0x130da1['error'][_0x33ea('0x13')]);return _0x276426(_0x130da1[_0x33ea('0x12')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x518f0a,_0x130da1[_0x33ea('0x12')][_0x33ea('0x13')]);return _0x35ba2a(_0x130da1[_0x33ea('0x12')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x518f0a,_0x33ea('0xe'));_0x35ba2a(_0x130da1[_0x33ea('0x14')][_0x33ea('0x13')]);}})['catch'](function(_0x2fd2e4){logger['error'](_0x33ea('0xd'),_0x518f0a,_0x2fd2e4);_0x276426(_0x2fd2e4);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9483f27..9d4d043 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 _0x23cd=['../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57a0b5,_0x17d7a0){var _0x1c8f4a=function(_0x19964e){while(--_0x19964e){_0x57a0b5['push'](_0x57a0b5['shift']());}};_0x1c8f4a(++_0x17d7a0);}(_0x23cd,0x19c));var _0xd23c=function(_0x2b35e3,_0x5e2e1e){_0x2b35e3=_0x2b35e3-0x0;var _0x142d19=_0x23cd[_0x2b35e3];return _0x142d19;};'use strict';var multer=require(_0xd23c('0x0'));var util=require(_0xd23c('0x1'));var path=require(_0xd23c('0x2'));var timeout=require(_0xd23c('0x3'));var express=require(_0xd23c('0x4'));var router=express[_0xd23c('0x5')]();var fs_extra=require(_0xd23c('0x6'));var auth=require(_0xd23c('0x7'));var interaction=require(_0xd23c('0x8'));var config=require('../../config/environment');var controller=require(_0xd23c('0x9'));router[_0xd23c('0xa')]('/',auth[_0xd23c('0xb')](),controller['index']);router[_0xd23c('0xa')](_0xd23c('0xc'),auth[_0xd23c('0xb')](),controller[_0xd23c('0xd')]);router[_0xd23c('0xa')]('/:id/download',auth[_0xd23c('0xb')](),controller[_0xd23c('0xe')]);router[_0xd23c('0xf')]('/',auth[_0xd23c('0xb')](),controller[_0xd23c('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd23c('0x11')]);router[_0xd23c('0x12')](_0xd23c('0xc'),auth['isAuthenticated'](),controller[_0xd23c('0x13')]);module[_0xd23c('0x14')]=router; \ No newline at end of file +var _0x6681=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0x6681,0x1e8));var _0x1668=function(_0x1bcbb1,_0x3cdbc8){_0x1bcbb1=_0x1bcbb1-0x0;var _0x10e972=_0x6681[_0x1bcbb1];return _0x10e972;};'use strict';var multer=require(_0x1668('0x0'));var util=require(_0x1668('0x1'));var path=require(_0x1668('0x2'));var timeout=require(_0x1668('0x3'));var express=require(_0x1668('0x4'));var router=express[_0x1668('0x5')]();var fs_extra=require(_0x1668('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1668('0x7'));var config=require(_0x1668('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x1668('0x9')]('/',auth[_0x1668('0xa')](),controller[_0x1668('0xb')]);router[_0x1668('0x9')]('/:id',auth[_0x1668('0xa')](),controller['show']);router[_0x1668('0x9')](_0x1668('0xc'),auth[_0x1668('0xa')](),controller[_0x1668('0xd')]);router[_0x1668('0xe')]('/',auth[_0x1668('0xa')](),controller[_0x1668('0xf')]);router['put']('/:id',auth[_0x1668('0xa')](),controller[_0x1668('0x10')]);router[_0x1668('0x11')]('/:id',auth[_0x1668('0xa')](),controller['destroy']);module[_0x1668('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d209736..0150dc6 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 _0xb56b=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x520fa3,_0xe9c2bf){var _0x57238a=function(_0x208434){while(--_0x208434){_0x520fa3['push'](_0x520fa3['shift']());}};_0x57238a(++_0xe9c2bf);}(_0xb56b,0xea));var _0xbb56=function(_0x3a66fa,_0x399904){_0x3a66fa=_0x3a66fa-0x0;var _0x388cf9=_0xb56b[_0x3a66fa];return _0x388cf9;};'use strict';var Sequelize=require(_0xbb56('0x0'));module[_0xbb56('0x1')]={'name':{'type':Sequelize[_0xbb56('0x2')],'get':function(_0x34e77e){return this[_0xbb56('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xbb56('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xbb56('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbb56('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xbb56('0x7')](_0xbb56('0x8'))}}; \ No newline at end of file +var _0x3805=['BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','INTEGER','STRING'];(function(_0x5648d3,_0x1650f7){var _0xb2c49d=function(_0x39c84c){while(--_0x39c84c){_0x5648d3['push'](_0x5648d3['shift']());}};_0xb2c49d(++_0x1650f7);}(_0x3805,0xee));var _0x5380=function(_0x22d318,_0x22dc24){_0x22d318=_0x22d318-0x0;var _0x1c8e5c=_0x3805[_0x22d318];return _0x1c8e5c;};'use strict';var Sequelize=require(_0x5380('0x0'));module[_0x5380('0x1')]={'name':{'type':Sequelize[_0x5380('0x2')],'get':function(_0x18586f){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x5380('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5380('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5380('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x5380('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5380('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x5380('0x5')](_0x5380('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5380('0x4')],'defaultValue':''},'stamp':{'type':_0x5380('0x7'),'defaultValue':Sequelize[_0x5380('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a39b435..4182b94 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 _0xc7e0=['undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','VoiceMailMessage','rawAttributes','type','model','differenceBy','query','intersection','attributes','fields','length','sort','where','pick','filters','filter','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment;\x20filename=\x22','.wav\x22','send','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x18fdaf,_0x457de2){var _0x557a9b=function(_0x4a6b5a){while(--_0x4a6b5a){_0x18fdaf['push'](_0x18fdaf['shift']());}};_0x557a9b(++_0x457de2);}(_0xc7e0,0x105));var _0x0c7e=function(_0x2d317b,_0x12c663){_0x2d317b=_0x2d317b-0x0;var _0x482a05=_0xc7e0[_0x2d317b];return _0x482a05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0c7e('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c7e('0x1'));var Mustache=require('mustache');var util=require(_0x0c7e('0x2'));var path=require(_0x0c7e('0x3'));var sox=require(_0x0c7e('0x4'));var csv=require(_0x0c7e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c7e('0x6'));var _=require('lodash');var squel=require(_0x0c7e('0x7'));var crypto=require('crypto');var jsforce=require(_0x0c7e('0x8'));var deskjs=require(_0x0c7e('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0c7e('0xa'));var Papa=require(_0x0c7e('0xb'));var Redis=require(_0x0c7e('0xc'));var authService=require(_0x0c7e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0c7e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c7e('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x0c7e('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c7e('0x11'))['db'];function respondWithStatusCode(_0x37a166,_0x4a4c27){_0x4a4c27=_0x4a4c27||0xcc;return function(_0x266df0){if(_0x266df0){return _0x37a166[_0x0c7e('0x12')](_0x4a4c27);}return _0x37a166[_0x0c7e('0x13')](_0x4a4c27)[_0x0c7e('0x14')]();};}function respondWithResult(_0x2b0ba8,_0x42e5b7){_0x42e5b7=_0x42e5b7||0xc8;return function(_0x5ac09b){if(_0x5ac09b){return _0x2b0ba8[_0x0c7e('0x13')](_0x42e5b7)['json'](_0x5ac09b);}};}function respondWithFilteredResult(_0x3dd693,_0xa4c513){return function(_0x2193da){if(_0x2193da){var _0x267f7c=typeof _0xa4c513[_0x0c7e('0x15')]==='undefined'&&typeof _0xa4c513[_0x0c7e('0x16')]===_0x0c7e('0x17');var _0x27f79a=_0x2193da[_0x0c7e('0x18')];var _0x4d36bd=_0x267f7c?0x0:_0xa4c513['offset'];var _0x21c0b5=_0x267f7c?_0x2193da['count']:_0xa4c513[_0x0c7e('0x15')]+_0xa4c513[_0x0c7e('0x16')];var _0x356973;if(_0x21c0b5>=_0x27f79a){_0x21c0b5=_0x27f79a;_0x356973=0xc8;}else{_0x356973=0xce;}_0x3dd693[_0x0c7e('0x13')](_0x356973);return _0x3dd693[_0x0c7e('0x19')](_0x0c7e('0x1a'),_0x4d36bd+'-'+_0x21c0b5+'/'+_0x27f79a)['json'](_0x2193da);}return null;};}function patchUpdates(_0x751e28){return function(_0x4d00d3){try{jsonpatch[_0x0c7e('0x1b')](_0x4d00d3,_0x751e28,!![]);}catch(_0x3e025c){return BPromise[_0x0c7e('0x1c')](_0x3e025c);}return _0x4d00d3[_0x0c7e('0x1d')]();};}function saveUpdates(_0x3d7f85,_0x3246c6){return function(_0x1772ec){if(_0x1772ec){return _0x1772ec[_0x0c7e('0x1e')](_0x3d7f85)['then'](function(_0x40746c){return _0x40746c;});}return null;};}function removeEntity(_0x5b10d2,_0x22c1e6){return function(_0x331e15){if(_0x331e15){return _0x331e15[_0x0c7e('0x1f')]()[_0x0c7e('0x20')](function(){_0x5b10d2['status'](0xcc)[_0x0c7e('0x14')]();});}};}function handleEntityNotFound(_0x1d1f85,_0x54059f){return function(_0x4a4f29){if(!_0x4a4f29){_0x1d1f85[_0x0c7e('0x12')](0x194);}return _0x4a4f29;};}function handleError(_0x3815e3,_0x50c09a){_0x50c09a=_0x50c09a||0x1f4;return function(_0x283e50){logger['error'](_0x283e50[_0x0c7e('0x21')]);if(_0x283e50['name']){delete _0x283e50[_0x0c7e('0x22')];}_0x3815e3[_0x0c7e('0x13')](_0x50c09a)['send'](_0x283e50);};}exports['index']=function(_0x2683f9,_0x2bcc53){var _0x1405b8={},_0x2fef3b={},_0x5dc426={'count':0x0,'rows':[]};var _0x340616=_[_0x0c7e('0x23')](db[_0x0c7e('0x24')][_0x0c7e('0x25')],function(_0x29ee1f){return{'name':_0x29ee1f['fieldName'],'type':_0x29ee1f[_0x0c7e('0x26')]['key']};});_0x2fef3b[_0x0c7e('0x27')]=_[_0x0c7e('0x28')](_[_0x0c7e('0x23')](_0x340616,'name'),[_0x0c7e('0x22')]);_0x2fef3b['query']=_['keys'](_0x2683f9[_0x0c7e('0x29')]);_0x2fef3b['filters']=_[_0x0c7e('0x2a')](_0x2fef3b[_0x0c7e('0x27')],_0x2fef3b[_0x0c7e('0x29')]);_0x1405b8[_0x0c7e('0x2b')]=_['intersection'](_0x2fef3b[_0x0c7e('0x27')],qs[_0x0c7e('0x2c')](_0x2683f9[_0x0c7e('0x29')]['fields']));_0x1405b8[_0x0c7e('0x2b')]=_0x1405b8['attributes'][_0x0c7e('0x2d')]?_0x1405b8[_0x0c7e('0x2b')]:_0x2fef3b['model'];if(!_0x2683f9[_0x0c7e('0x29')]['hasOwnProperty']('nolimit')){_0x1405b8['limit']=qs['limit'](_0x2683f9['query'][_0x0c7e('0x16')]);_0x1405b8['offset']=qs[_0x0c7e('0x15')](_0x2683f9[_0x0c7e('0x29')][_0x0c7e('0x15')]);}_0x1405b8['order']=qs['sort'](_0x2683f9[_0x0c7e('0x29')][_0x0c7e('0x2e')]);_0x1405b8[_0x0c7e('0x2f')]=qs['filters'](_[_0x0c7e('0x30')](_0x2683f9[_0x0c7e('0x29')],_0x2fef3b[_0x0c7e('0x31')]),_0x340616);if(_0x2683f9['query'][_0x0c7e('0x32')]){_0x1405b8[_0x0c7e('0x2f')]=_[_0x0c7e('0x33')](_0x1405b8[_0x0c7e('0x2f')],{'$or':_[_0x0c7e('0x23')](_0x340616,function(_0x36b7fa){if(_0x36b7fa[_0x0c7e('0x26')]!=='VIRTUAL'){var _0x90fee4={};_0x90fee4[_0x36b7fa['name']]={'$like':'%'+_0x2683f9[_0x0c7e('0x29')][_0x0c7e('0x32')]+'%'};return _0x90fee4;}})});}_0x1405b8=_['merge']({},_0x1405b8,_0x2683f9[_0x0c7e('0x34')]);var _0xc0be9a={'where':_0x1405b8['where']};return db[_0x0c7e('0x24')][_0x0c7e('0x18')](_0xc0be9a)[_0x0c7e('0x20')](function(_0x5d1ead){_0x5dc426[_0x0c7e('0x18')]=_0x5d1ead;if(_0x2683f9[_0x0c7e('0x29')]['includeAll']){_0x1405b8[_0x0c7e('0x35')]=[{'all':!![]}];}return db[_0x0c7e('0x24')][_0x0c7e('0x36')](_0x1405b8);})['then'](function(_0x3160f9){_0x5dc426['rows']=_0x3160f9;return _0x5dc426;})['then'](respondWithFilteredResult(_0x2bcc53,_0x1405b8))[_0x0c7e('0x37')](handleError(_0x2bcc53,null));};exports[_0x0c7e('0x38')]=function(_0xfb9d25,_0xc27a2f){var _0x1e8c0f={'raw':!![],'where':{'id':_0xfb9d25[_0x0c7e('0x39')]['id']}},_0xb7de6d={};_0xb7de6d['model']=_[_0x0c7e('0x3a')](db['VoiceMailMessage'][_0x0c7e('0x25')]);_0xb7de6d[_0x0c7e('0x29')]=_[_0x0c7e('0x3a')](_0xfb9d25[_0x0c7e('0x29')]);_0xb7de6d[_0x0c7e('0x31')]=_[_0x0c7e('0x2a')](_0xb7de6d[_0x0c7e('0x27')],_0xb7de6d[_0x0c7e('0x29')]);_0x1e8c0f[_0x0c7e('0x2b')]=_[_0x0c7e('0x2a')](_0xb7de6d[_0x0c7e('0x27')],qs[_0x0c7e('0x2c')](_0xfb9d25['query'][_0x0c7e('0x2c')]));_0x1e8c0f[_0x0c7e('0x2b')]=_0x1e8c0f[_0x0c7e('0x2b')][_0x0c7e('0x2d')]?_0x1e8c0f['attributes']:_0xb7de6d['model'];if(_0xfb9d25[_0x0c7e('0x29')][_0x0c7e('0x3b')]){_0x1e8c0f[_0x0c7e('0x35')]=[{'all':!![]}];}_0x1e8c0f=_[_0x0c7e('0x33')]({},_0x1e8c0f,_0xfb9d25['options']);return db[_0x0c7e('0x24')][_0x0c7e('0x3c')](_0x1e8c0f)[_0x0c7e('0x20')](handleEntityNotFound(_0xc27a2f,null))[_0x0c7e('0x20')](respondWithResult(_0xc27a2f,null))['catch'](handleError(_0xc27a2f,null));};exports[_0x0c7e('0x3d')]=function(_0x5b38a3,_0x2c4274){return db[_0x0c7e('0x24')][_0x0c7e('0x3d')](_0x5b38a3['body'],{})[_0x0c7e('0x20')](respondWithResult(_0x2c4274,0xc9))['catch'](handleError(_0x2c4274,null));};exports[_0x0c7e('0x1e')]=function(_0xe14d27,_0x5f11d2){if(_0xe14d27[_0x0c7e('0x3e')]['id']){delete _0xe14d27[_0x0c7e('0x3e')]['id'];}return db['VoiceMailMessage'][_0x0c7e('0x3c')]({'where':{'id':_0xe14d27[_0x0c7e('0x39')]['id']}})['then'](handleEntityNotFound(_0x5f11d2,null))['then'](saveUpdates(_0xe14d27[_0x0c7e('0x3e')],null))[_0x0c7e('0x20')](respondWithResult(_0x5f11d2,null))['catch'](handleError(_0x5f11d2,null));};exports[_0x0c7e('0x1f')]=function(_0x32cfa4,_0x437fbd){return db[_0x0c7e('0x24')][_0x0c7e('0x3c')]({'where':{'id':_0x32cfa4['params']['id']}})[_0x0c7e('0x20')](handleEntityNotFound(_0x437fbd,null))[_0x0c7e('0x20')](removeEntity(_0x437fbd,null))[_0x0c7e('0x37')](handleError(_0x437fbd,null));};exports['download']=function(_0xb29cba,_0x10bc7c,_0x104646){return db[_0x0c7e('0x24')][_0x0c7e('0x3c')]({'where':{'id':_0xb29cba[_0x0c7e('0x39')]['id']},'attributes':['id','recording',_0x0c7e('0x3f')]})[_0x0c7e('0x20')](handleEntityNotFound(_0x10bc7c,null))[_0x0c7e('0x20')](function(_0x2a4af1){if(_0x2a4af1){if(!_0x2a4af1[_0x0c7e('0x40')]){throw new db[(_0x0c7e('0x41'))][(_0x0c7e('0x42'))](_0x0c7e('0x43'));}var _0x12ae20={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x2a4af1[_0x0c7e('0x3f')]){_0x12ae20['Content-Disposition']=_0x0c7e('0x44')+_0x2a4af1[_0x0c7e('0x3f')]+_0x0c7e('0x45');}_0x10bc7c['set'](_0x12ae20);return _0x10bc7c[_0x0c7e('0x46')](new Buffer(_0x2a4af1[_0x0c7e('0x40')]));}})['catch'](handleError(_0x10bc7c,null));}; \ No newline at end of file +var _0xcba7=['merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x427502,_0x4e6214){var _0x1baeff=function(_0x1491e6){while(--_0x1491e6){_0x427502['push'](_0x427502['shift']());}};_0x1baeff(++_0x4e6214);}(_0xcba7,0xb0));var _0x7cba=function(_0x30e0f5,_0x5e4826){_0x30e0f5=_0x30e0f5-0x0;var _0x3b5800=_0xcba7[_0x30e0f5];return _0x3b5800;};'use strict';var emlformat=require(_0x7cba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cba('0x1'));var rp=require('request-promise');var moment=require(_0x7cba('0x2'));var BPromise=require(_0x7cba('0x3'));var Mustache=require(_0x7cba('0x4'));var util=require(_0x7cba('0x5'));var path=require(_0x7cba('0x6'));var sox=require(_0x7cba('0x7'));var csv=require(_0x7cba('0x8'));var ejs=require(_0x7cba('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cba('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7cba('0xb'));var toCsv=require(_0x7cba('0x8'));var querystring=require(_0x7cba('0xc'));var Papa=require(_0x7cba('0xd'));var Redis=require(_0x7cba('0xe'));var authService=require(_0x7cba('0xf'));var qs=require(_0x7cba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cba('0x11'))('api');var utils=require(_0x7cba('0x12'));var config=require(_0x7cba('0x13'));var licenseUtil=require(_0x7cba('0x14'));var db=require(_0x7cba('0x15'))['db'];function respondWithStatusCode(_0x1af645,_0x18737f){_0x18737f=_0x18737f||0xcc;return function(_0x29c071){if(_0x29c071){return _0x1af645[_0x7cba('0x16')](_0x18737f);}return _0x1af645[_0x7cba('0x17')](_0x18737f)[_0x7cba('0x18')]();};}function respondWithResult(_0x505989,_0x4b4261){_0x4b4261=_0x4b4261||0xc8;return function(_0x28c4a0){if(_0x28c4a0){return _0x505989[_0x7cba('0x17')](_0x4b4261)[_0x7cba('0x19')](_0x28c4a0);}};}function respondWithFilteredResult(_0x3830d1,_0x377120){return function(_0x2fd785){if(_0x2fd785){var _0x359a3d=typeof _0x377120[_0x7cba('0x1a')]===_0x7cba('0x1b')&&typeof _0x377120['limit']===_0x7cba('0x1b');var _0x2567fe=_0x2fd785[_0x7cba('0x1c')];var _0x21229a=_0x359a3d?0x0:_0x377120[_0x7cba('0x1a')];var _0x594719=_0x359a3d?_0x2fd785[_0x7cba('0x1c')]:_0x377120[_0x7cba('0x1a')]+_0x377120[_0x7cba('0x1d')];var _0x4f19bf;if(_0x594719>=_0x2567fe){_0x594719=_0x2567fe;_0x4f19bf=0xc8;}else{_0x4f19bf=0xce;}_0x3830d1[_0x7cba('0x17')](_0x4f19bf);return _0x3830d1[_0x7cba('0x1e')]('Content-Range',_0x21229a+'-'+_0x594719+'/'+_0x2567fe)[_0x7cba('0x19')](_0x2fd785);}return null;};}function patchUpdates(_0x1b395f){return function(_0x4c7ea6){try{jsonpatch[_0x7cba('0x1f')](_0x4c7ea6,_0x1b395f,!![]);}catch(_0x8c71d3){return BPromise[_0x7cba('0x20')](_0x8c71d3);}return _0x4c7ea6[_0x7cba('0x21')]();};}function saveUpdates(_0x42f498,_0x369a86){return function(_0x54569c){if(_0x54569c){return _0x54569c[_0x7cba('0x22')](_0x42f498)[_0x7cba('0x23')](function(_0x1a9ecd){return _0x1a9ecd;});}return null;};}function removeEntity(_0x287fd0,_0x46c0b0){return function(_0x59d5ae){if(_0x59d5ae){return _0x59d5ae[_0x7cba('0x24')]()[_0x7cba('0x23')](function(){_0x287fd0[_0x7cba('0x17')](0xcc)[_0x7cba('0x18')]();});}};}function handleEntityNotFound(_0x467c58,_0x1300bb){return function(_0x304089){if(!_0x304089){_0x467c58[_0x7cba('0x16')](0x194);}return _0x304089;};}function handleError(_0x532c14,_0x43f4c9){_0x43f4c9=_0x43f4c9||0x1f4;return function(_0x4e5316){logger[_0x7cba('0x25')](_0x4e5316[_0x7cba('0x26')]);if(_0x4e5316['name']){delete _0x4e5316['name'];}_0x532c14['status'](_0x43f4c9)[_0x7cba('0x27')](_0x4e5316);};}exports[_0x7cba('0x28')]=function(_0x362f0a,_0x92fa8b){var _0x5810fe={},_0x5adf0c={},_0x1dee18={'count':0x0,'rows':[]};var _0x487467=_[_0x7cba('0x29')](db[_0x7cba('0x2a')][_0x7cba('0x2b')],function(_0x5bab71){return{'name':_0x5bab71[_0x7cba('0x2c')],'type':_0x5bab71[_0x7cba('0x2d')]['key']};});_0x5adf0c[_0x7cba('0x2e')]=_['differenceBy'](_[_0x7cba('0x29')](_0x487467,_0x7cba('0x2f')),[_0x7cba('0x2f')]);_0x5adf0c[_0x7cba('0x30')]=_[_0x7cba('0x31')](_0x362f0a[_0x7cba('0x30')]);_0x5adf0c[_0x7cba('0x32')]=_[_0x7cba('0x33')](_0x5adf0c['model'],_0x5adf0c[_0x7cba('0x30')]);_0x5810fe[_0x7cba('0x34')]=_[_0x7cba('0x33')](_0x5adf0c[_0x7cba('0x2e')],qs[_0x7cba('0x35')](_0x362f0a[_0x7cba('0x30')]['fields']));_0x5810fe[_0x7cba('0x34')]=_0x5810fe[_0x7cba('0x34')]['length']?_0x5810fe['attributes']:_0x5adf0c[_0x7cba('0x2e')];if(!_0x362f0a[_0x7cba('0x30')][_0x7cba('0x36')](_0x7cba('0x37'))){_0x5810fe[_0x7cba('0x1d')]=qs[_0x7cba('0x1d')](_0x362f0a[_0x7cba('0x30')][_0x7cba('0x1d')]);_0x5810fe[_0x7cba('0x1a')]=qs['offset'](_0x362f0a[_0x7cba('0x30')][_0x7cba('0x1a')]);}_0x5810fe[_0x7cba('0x38')]=qs[_0x7cba('0x39')](_0x362f0a[_0x7cba('0x30')]['sort']);_0x5810fe[_0x7cba('0x3a')]=qs[_0x7cba('0x32')](_[_0x7cba('0x3b')](_0x362f0a[_0x7cba('0x30')],_0x5adf0c[_0x7cba('0x32')]),_0x487467);if(_0x362f0a['query'][_0x7cba('0x3c')]){_0x5810fe[_0x7cba('0x3a')]=_[_0x7cba('0x3d')](_0x5810fe[_0x7cba('0x3a')],{'$or':_[_0x7cba('0x29')](_0x487467,function(_0x5618e5){if(_0x5618e5[_0x7cba('0x2d')]!==_0x7cba('0x3e')){var _0x1a5baa={};_0x1a5baa[_0x5618e5[_0x7cba('0x2f')]]={'$like':'%'+_0x362f0a[_0x7cba('0x30')][_0x7cba('0x3c')]+'%'};return _0x1a5baa;}})});}_0x5810fe=_['merge']({},_0x5810fe,_0x362f0a[_0x7cba('0x3f')]);var _0x83be9e={'where':_0x5810fe[_0x7cba('0x3a')]};return db['VoiceMailMessage']['count'](_0x83be9e)['then'](function(_0x2cb790){_0x1dee18['count']=_0x2cb790;if(_0x362f0a[_0x7cba('0x30')]['includeAll']){_0x5810fe[_0x7cba('0x40')]=[{'all':!![]}];}return db[_0x7cba('0x2a')][_0x7cba('0x41')](_0x5810fe);})[_0x7cba('0x23')](function(_0xbfe700){_0x1dee18['rows']=_0xbfe700;return _0x1dee18;})[_0x7cba('0x23')](respondWithFilteredResult(_0x92fa8b,_0x5810fe))[_0x7cba('0x42')](handleError(_0x92fa8b,null));};exports['show']=function(_0x38ef1f,_0x24ac8e){var _0x5c5258={'raw':!![],'where':{'id':_0x38ef1f[_0x7cba('0x43')]['id']}},_0x1446cc={};_0x1446cc[_0x7cba('0x2e')]=_[_0x7cba('0x31')](db[_0x7cba('0x2a')][_0x7cba('0x2b')]);_0x1446cc[_0x7cba('0x30')]=_['keys'](_0x38ef1f['query']);_0x1446cc[_0x7cba('0x32')]=_[_0x7cba('0x33')](_0x1446cc['model'],_0x1446cc['query']);_0x5c5258[_0x7cba('0x34')]=_[_0x7cba('0x33')](_0x1446cc['model'],qs[_0x7cba('0x35')](_0x38ef1f[_0x7cba('0x30')][_0x7cba('0x35')]));_0x5c5258[_0x7cba('0x34')]=_0x5c5258[_0x7cba('0x34')]['length']?_0x5c5258['attributes']:_0x1446cc[_0x7cba('0x2e')];if(_0x38ef1f[_0x7cba('0x30')][_0x7cba('0x44')]){_0x5c5258[_0x7cba('0x40')]=[{'all':!![]}];}_0x5c5258=_[_0x7cba('0x3d')]({},_0x5c5258,_0x38ef1f[_0x7cba('0x3f')]);return db['VoiceMailMessage'][_0x7cba('0x45')](_0x5c5258)[_0x7cba('0x23')](handleEntityNotFound(_0x24ac8e,null))[_0x7cba('0x23')](respondWithResult(_0x24ac8e,null))[_0x7cba('0x42')](handleError(_0x24ac8e,null));};exports[_0x7cba('0x46')]=function(_0x58399b,_0x2490e7){return db[_0x7cba('0x2a')][_0x7cba('0x46')](_0x58399b[_0x7cba('0x47')],{})['then'](respondWithResult(_0x2490e7,0xc9))[_0x7cba('0x42')](handleError(_0x2490e7,null));};exports['update']=function(_0x4d59c3,_0x4f0516){if(_0x4d59c3[_0x7cba('0x47')]['id']){delete _0x4d59c3['body']['id'];}return db['VoiceMailMessage'][_0x7cba('0x45')]({'where':{'id':_0x4d59c3[_0x7cba('0x43')]['id']}})[_0x7cba('0x23')](handleEntityNotFound(_0x4f0516,null))[_0x7cba('0x23')](saveUpdates(_0x4d59c3[_0x7cba('0x47')],null))['then'](respondWithResult(_0x4f0516,null))[_0x7cba('0x42')](handleError(_0x4f0516,null));};exports[_0x7cba('0x24')]=function(_0x5ab8b6,_0x2969f5){return db[_0x7cba('0x2a')][_0x7cba('0x45')]({'where':{'id':_0x5ab8b6[_0x7cba('0x43')]['id']}})[_0x7cba('0x23')](handleEntityNotFound(_0x2969f5,null))[_0x7cba('0x23')](removeEntity(_0x2969f5,null))[_0x7cba('0x42')](handleError(_0x2969f5,null));};exports['download']=function(_0x5c2155,_0x4c0461,_0x2826db){return db[_0x7cba('0x2a')][_0x7cba('0x45')]({'where':{'id':_0x5c2155[_0x7cba('0x43')]['id']},'attributes':['id',_0x7cba('0x48'),_0x7cba('0x49')]})[_0x7cba('0x23')](handleEntityNotFound(_0x4c0461,null))[_0x7cba('0x23')](function(_0x5b3096){if(_0x5b3096){if(!_0x5b3096[_0x7cba('0x48')]){throw new db[(_0x7cba('0x4a'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x368599={'Content-Type':_0x7cba('0x4b'),'Content-Disposition':_0x7cba('0x4c')};if(_0x5b3096['msg_id']){_0x368599[_0x7cba('0x4d')]='attachment;\x20filename=\x22'+_0x5b3096[_0x7cba('0x49')]+_0x7cba('0x4e');}_0x4c0461[_0x7cba('0x1e')](_0x368599);return _0x4c0461['send'](new Buffer(_0x5b3096[_0x7cba('0x48')]));}})[_0x7cba('0x42')](handleError(_0x4c0461,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9366ef9..13965bd 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 _0xf99e=['define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xfa6f06,_0x2bff7d){var _0x439e18=function(_0x1d6780){while(--_0x1d6780){_0xfa6f06['push'](_0xfa6f06['shift']());}};_0x439e18(++_0x2bff7d);}(_0xf99e,0xee));var _0xef99=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0xf99e[_0x4da690];return _0x263c53;};'use strict';var _=require('lodash');var util=require(_0xef99('0x0'));var logger=require(_0xef99('0x1'))(_0xef99('0x2'));var moment=require(_0xef99('0x3'));var BPromise=require(_0xef99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef99('0x5'));var rimraf=require(_0xef99('0x6'));var config=require(_0xef99('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xef99('0x8')]=function(_0x55ecab,_0x2d175b){return _0x55ecab[_0xef99('0x9')](_0xef99('0xa'),attributes,{'tableName':_0xef99('0xb'),'paranoid':![],'indexes':[{'name':_0xef99('0xc'),'fields':[_0xef99('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb5bd=['VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x5bf7ad,_0xc3cd0){var _0x486c4b=function(_0x3a270f){while(--_0x3a270f){_0x5bf7ad['push'](_0x5bf7ad['shift']());}};_0x486c4b(++_0xc3cd0);}(_0xb5bd,0x176));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5b('0x0'));var util=require(_0xdb5b('0x1'));var logger=require(_0xdb5b('0x2'))(_0xdb5b('0x3'));var moment=require(_0xdb5b('0x4'));var BPromise=require(_0xdb5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdb5b('0x6'));var config=require(_0xdb5b('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xdb5b('0x8')]=function(_0x5a37ae,_0x4d433e){return _0x5a37ae[_0xdb5b('0x9')](_0xdb5b('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xdb5b('0xb'),'fields':[_0xdb5b('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a2d9a57..ace4b51 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 _0xae03=['stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xae03,0x1b7));var _0x3ae0=function(_0x1400d1,_0x2d5839){_0x1400d1=_0x1400d1-0x0;var _0xd7abd8=_0xae03[_0x1400d1];return _0xd7abd8;};'use strict';var _=require(_0x3ae0('0x0'));var util=require(_0x3ae0('0x1'));var moment=require(_0x3ae0('0x2'));var BPromise=require(_0x3ae0('0x3'));var rs=require(_0x3ae0('0x4'));var fs=require('fs');var Redis=require(_0x3ae0('0x5'));var db=require(_0x3ae0('0x6'))['db'];var utils=require(_0x3ae0('0x7'));var logger=require('../../config/logger')(_0x3ae0('0x8'));var config=require(_0x3ae0('0x9'));var jayson=require(_0x3ae0('0xa'));var client=jayson['client'][_0x3ae0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d249,_0x2731be,_0x370d1a){return new BPromise(function(_0x4c73f0,_0x48544d){return client[_0x3ae0('0xc')](_0x51d249,_0x370d1a)['then'](function(_0x5d5a3c){logger[_0x3ae0('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x2731be,_0x3ae0('0xe'));logger[_0x3ae0('0xf')](_0x3ae0('0x10'),_0x2731be,'request\x20sent',JSON[_0x3ae0('0x11')](_0x5d5a3c));if(_0x5d5a3c[_0x3ae0('0x12')]){if(_0x5d5a3c[_0x3ae0('0x12')][_0x3ae0('0x13')]===0x1f4){logger[_0x3ae0('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2731be,_0x5d5a3c[_0x3ae0('0x12')][_0x3ae0('0x14')]);return _0x48544d(_0x5d5a3c[_0x3ae0('0x12')][_0x3ae0('0x14')]);}logger['error'](_0x3ae0('0x15'),_0x2731be,_0x5d5a3c[_0x3ae0('0x12')][_0x3ae0('0x14')]);return _0x4c73f0(_0x5d5a3c['error']['message']);}else{logger[_0x3ae0('0xd')](_0x3ae0('0x15'),_0x2731be,_0x3ae0('0xe'));_0x4c73f0(_0x5d5a3c[_0x3ae0('0x16')][_0x3ae0('0x14')]);}})[_0x3ae0('0x17')](function(_0x42e345){logger['error'](_0x3ae0('0x15'),_0x2731be,_0x42e345);_0x48544d(_0x42e345);});});} \ No newline at end of file +var _0x6c0d=['util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash'];(function(_0x1ee9c6,_0x4c7b1a){var _0x137af9=function(_0x5b69f5){while(--_0x5b69f5){_0x1ee9c6['push'](_0x1ee9c6['shift']());}};_0x137af9(++_0x4c7b1a);}(_0x6c0d,0x6b));var _0xd6c0=function(_0x4c2907,_0x4ad32f){_0x4c2907=_0x4c2907-0x0;var _0x547b98=_0x6c0d[_0x4c2907];return _0x547b98;};'use strict';var _=require(_0xd6c0('0x0'));var util=require(_0xd6c0('0x1'));var moment=require(_0xd6c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6c0('0x3'));var db=require(_0xd6c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6c0('0x5'))('rpc');var config=require(_0xd6c0('0x6'));var jayson=require(_0xd6c0('0x7'));var client=jayson[_0xd6c0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde8260,_0x567a95,_0x379e85){return new BPromise(function(_0x247d0f,_0x4e0633){return client['request'](_0xde8260,_0x379e85)[_0xd6c0('0x9')](function(_0x52bdc5){logger['info'](_0xd6c0('0xa'),_0x567a95,_0xd6c0('0xb'));logger[_0xd6c0('0xc')](_0xd6c0('0xd'),_0x567a95,_0xd6c0('0xb'),JSON[_0xd6c0('0xe')](_0x52bdc5));if(_0x52bdc5[_0xd6c0('0xf')]){if(_0x52bdc5[_0xd6c0('0xf')]['code']===0x1f4){logger[_0xd6c0('0xf')](_0xd6c0('0xa'),_0x567a95,_0x52bdc5[_0xd6c0('0xf')]['message']);return _0x4e0633(_0x52bdc5['error']['message']);}logger[_0xd6c0('0xf')](_0xd6c0('0xa'),_0x567a95,_0x52bdc5[_0xd6c0('0xf')][_0xd6c0('0x10')]);return _0x247d0f(_0x52bdc5['error']['message']);}else{logger[_0xd6c0('0x11')](_0xd6c0('0xa'),_0x567a95,_0xd6c0('0xb'));_0x247d0f(_0x52bdc5['result'][_0xd6c0('0x10')]);}})['catch'](function(_0x2b1bad){logger[_0xd6c0('0xf')](_0xd6c0('0xa'),_0x567a95,_0x2b1bad);_0x4e0633(_0x2b1bad);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0a69579..3940445 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 _0x9066=['put','/:id','update','delete','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9066,0x1e6));var _0x6906=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9066[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x6906('0x0'));var util=require(_0x6906('0x1'));var path=require(_0x6906('0x2'));var timeout=require(_0x6906('0x3'));var express=require(_0x6906('0x4'));var router=express['Router']();var fs_extra=require(_0x6906('0x5'));var auth=require(_0x6906('0x6'));var interaction=require(_0x6906('0x7'));var config=require(_0x6906('0x8'));var controller=require(_0x6906('0x9'));router[_0x6906('0xa')]('/',auth[_0x6906('0xb')](),controller[_0x6906('0xc')]);router[_0x6906('0xa')]('/:id',auth[_0x6906('0xb')](),controller['show']);router['get'](_0x6906('0xd'),auth[_0x6906('0xb')](),controller[_0x6906('0xe')]);router[_0x6906('0xf')]('/',auth[_0x6906('0xb')](),controller[_0x6906('0x10')]);router[_0x6906('0xf')]('/:id/sounds',auth[_0x6906('0xb')](),controller[_0x6906('0x11')]);router[_0x6906('0x12')](_0x6906('0x13'),auth[_0x6906('0xb')](),controller[_0x6906('0x14')]);router[_0x6906('0x15')](_0x6906('0x13'),auth[_0x6906('0xb')](),controller['destroy']);router[_0x6906('0x15')](_0x6906('0x16'),auth[_0x6906('0xb')](),controller[_0x6906('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8e3c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','exports','util'];(function(_0x318a3d,_0x43cd68){var _0x1be27a=function(_0x1cada8){while(--_0x1cada8){_0x318a3d['push'](_0x318a3d['shift']());}};_0x1be27a(++_0x43cd68);}(_0x8e3c,0x1cb));var _0xc8e3=function(_0xb40c4f,_0x5231f2){_0xb40c4f=_0xb40c4f-0x0;var _0x1d5f81=_0x8e3c[_0xb40c4f];return _0x1d5f81;};'use strict';var multer=require('multer');var util=require(_0xc8e3('0x0'));var path=require('path');var timeout=require(_0xc8e3('0x1'));var express=require(_0xc8e3('0x2'));var router=express['Router']();var fs_extra=require(_0xc8e3('0x3'));var auth=require(_0xc8e3('0x4'));var interaction=require(_0xc8e3('0x5'));var config=require(_0xc8e3('0x6'));var controller=require(_0xc8e3('0x7'));router['get']('/',auth[_0xc8e3('0x8')](),controller[_0xc8e3('0x9')]);router[_0xc8e3('0xa')](_0xc8e3('0xb'),auth['isAuthenticated'](),controller[_0xc8e3('0xc')]);router['get'](_0xc8e3('0xd'),auth['isAuthenticated'](),controller[_0xc8e3('0xe')]);router[_0xc8e3('0xf')]('/',auth['isAuthenticated'](),controller[_0xc8e3('0x10')]);router['post'](_0xc8e3('0xd'),auth[_0xc8e3('0x8')](),controller['addSound']);router[_0xc8e3('0x11')](_0xc8e3('0xb'),auth[_0xc8e3('0x8')](),controller[_0xc8e3('0x12')]);router[_0xc8e3('0x13')](_0xc8e3('0xb'),auth['isAuthenticated'](),controller[_0xc8e3('0x14')]);router['delete'](_0xc8e3('0x15'),auth[_0xc8e3('0x8')](),controller['removeSound']);module[_0xc8e3('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a355b92..8ccc48b 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 _0xa5de=['STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa5de,0x1d6));var _0xea5d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa5de[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea5d('0x0')],'allowNull':![],'unique':_0xea5d('0x1')},'mode':{'type':Sequelize[_0xea5d('0x2')]('custom',_0xea5d('0x3'),_0xea5d('0x4'),_0xea5d('0x5'),_0xea5d('0x6'),_0xea5d('0x7')),'allowNull':!![],'defaultValue':_0xea5d('0x3')},'directory':{'type':Sequelize[_0xea5d('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xea5d('0x0')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xea5d('0x8')},'format':{'type':Sequelize[_0xea5d('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xea5d('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b18=['STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','quietmp3nb','quietmp3','mp3','files'];(function(_0x31661f,_0x11d5a1){var _0xab6fec=function(_0x4cfa65){while(--_0x4cfa65){_0x31661f['push'](_0x31661f['shift']());}};_0xab6fec(++_0x11d5a1);}(_0x2b18,0x177));var _0x82b1=function(_0xc50554,_0x4f59ee){_0xc50554=_0xc50554-0x0;var _0x352cec=_0x2b18[_0xc50554];return _0x352cec;};'use strict';var Sequelize=require(_0x82b1('0x0'));module[_0x82b1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x82b1('0x2')},'mode':{'type':Sequelize[_0x82b1('0x3')](_0x82b1('0x4'),'files','mp3nb',_0x82b1('0x5'),_0x82b1('0x6'),_0x82b1('0x7')),'allowNull':!![],'defaultValue':_0x82b1('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x82b1('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x82b1('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x82b1('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x82b1('0x9')],'allowNull':!![]},'stamp':{'type':_0x82b1('0xa')},'defaultEntry':{'type':Sequelize[_0x82b1('0xb')],'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 f7f80a9..6bdf40d 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 _0xa21b=['count','limit','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','catch','body','create','sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','Sequelize','addSound','Sound','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','message','removeSound','findOne','id2','unlinkSync','ValidationError','rawAttributes','getSounds','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa21b,0x19d));var _0xba21=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xa21b[_0x946518];return _0x909b69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba21('0x0'));var zipdir=require(_0xba21('0x1'));var jsonpatch=require(_0xba21('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba21('0x3'));var Mustache=require(_0xba21('0x4'));var util=require(_0xba21('0x5'));var path=require('path');var sox=require(_0xba21('0x6'));var csv=require(_0xba21('0x7'));var ejs=require(_0xba21('0x8'));var fs=require('fs');var fs_extra=require(_0xba21('0x9'));var _=require('lodash');var squel=require(_0xba21('0xa'));var crypto=require(_0xba21('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xba21('0xc'));var toCsv=require(_0xba21('0x7'));var querystring=require(_0xba21('0xd'));var Papa=require(_0xba21('0xe'));var Redis=require(_0xba21('0xf'));var authService=require(_0xba21('0x10'));var qs=require(_0xba21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xba21('0x12'))('api');var utils=require(_0xba21('0x13'));var config=require(_0xba21('0x14'));var licenseUtil=require(_0xba21('0x15'));var db=require(_0xba21('0x16'))['db'];function respondWithStatusCode(_0x38a650,_0x9d8002){_0x9d8002=_0x9d8002||0xcc;return function(_0x5448ae){if(_0x5448ae){return _0x38a650['sendStatus'](_0x9d8002);}return _0x38a650[_0xba21('0x17')](_0x9d8002)[_0xba21('0x18')]();};}function respondWithResult(_0x4f1a1a,_0x307a81){_0x307a81=_0x307a81||0xc8;return function(_0xe5980f){if(_0xe5980f){return _0x4f1a1a[_0xba21('0x17')](_0x307a81)[_0xba21('0x19')](_0xe5980f);}};}function respondWithFilteredResult(_0x187770,_0x39d825){return function(_0x38e7e9){if(_0x38e7e9){var _0x3a0adc=typeof _0x39d825[_0xba21('0x1a')]==='undefined'&&typeof _0x39d825['limit']==='undefined';var _0x175b48=_0x38e7e9['count'];var _0x525f1b=_0x3a0adc?0x0:_0x39d825[_0xba21('0x1a')];var _0x30d1f4=_0x3a0adc?_0x38e7e9[_0xba21('0x1b')]:_0x39d825[_0xba21('0x1a')]+_0x39d825[_0xba21('0x1c')];var _0x4a384a;if(_0x30d1f4>=_0x175b48){_0x30d1f4=_0x175b48;_0x4a384a=0xc8;}else{_0x4a384a=0xce;}_0x187770[_0xba21('0x17')](_0x4a384a);return _0x187770['set']('Content-Range',_0x525f1b+'-'+_0x30d1f4+'/'+_0x175b48)[_0xba21('0x19')](_0x38e7e9);}return null;};}function patchUpdates(_0x346c0d){return function(_0x20d1d8){try{jsonpatch[_0xba21('0x1d')](_0x20d1d8,_0x346c0d,!![]);}catch(_0x3721a2){return BPromise[_0xba21('0x1e')](_0x3721a2);}return _0x20d1d8[_0xba21('0x1f')]();};}function saveUpdates(_0x5c25ea,_0x1b70f0){return function(_0x49b227){if(_0x49b227){return _0x49b227[_0xba21('0x20')](_0x5c25ea)['then'](function(_0x1a831b){return _0x1a831b;});}return null;};}function removeEntity(_0x4e1530,_0x2e5af0){return function(_0x158f9b){if(_0x158f9b){return _0x158f9b[_0xba21('0x21')]()[_0xba21('0x22')](function(){var _0x45747e=_0x158f9b['get']({'plain':!![]});var _0x18d517=_0xba21('0x23');return db[_0xba21('0x24')][_0xba21('0x21')]({'where':{'type':_0x18d517,'resourceId':_0x45747e['id']}})[_0xba21('0x22')](function(){return _0x158f9b;});})[_0xba21('0x22')](function(){_0x4e1530['status'](0xcc)[_0xba21('0x18')]();});}};}function handleEntityNotFound(_0x39e13b,_0x490e04){return function(_0x2ba4eb){if(!_0x2ba4eb){_0x39e13b[_0xba21('0x25')](0x194);}return _0x2ba4eb;};}function handleError(_0x360dcf,_0x2b64d8){_0x2b64d8=_0x2b64d8||0x1f4;return function(_0x215207){logger['error'](_0x215207[_0xba21('0x26')]);if(_0x215207[_0xba21('0x27')]){delete _0x215207['name'];}_0x360dcf[_0xba21('0x17')](_0x2b64d8)[_0xba21('0x28')](_0x215207);};}exports[_0xba21('0x29')]=function(_0x54993f,_0x4ce102){var _0x1a4601={},_0x19f111={},_0x545dff={'count':0x0,'rows':[]};var _0x168d5e=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x782c22){return{'name':_0x782c22[_0xba21('0x2a')],'type':_0x782c22[_0xba21('0x2b')]['key']};});_0x19f111[_0xba21('0x2c')]=_[_0xba21('0x2d')](_0x168d5e,_0xba21('0x27'));_0x19f111[_0xba21('0x2e')]=_[_0xba21('0x2f')](_0x54993f['query']);_0x19f111['filters']=_[_0xba21('0x30')](_0x19f111[_0xba21('0x2c')],_0x19f111[_0xba21('0x2e')]);_0x1a4601[_0xba21('0x31')]=_[_0xba21('0x30')](_0x19f111[_0xba21('0x2c')],qs[_0xba21('0x32')](_0x54993f[_0xba21('0x2e')]['fields']));_0x1a4601['attributes']=_0x1a4601[_0xba21('0x31')][_0xba21('0x33')]?_0x1a4601[_0xba21('0x31')]:_0x19f111['model'];if(!_0x54993f[_0xba21('0x2e')][_0xba21('0x34')](_0xba21('0x35'))){_0x1a4601['limit']=qs[_0xba21('0x1c')](_0x54993f[_0xba21('0x2e')]['limit']);_0x1a4601[_0xba21('0x1a')]=qs['offset'](_0x54993f[_0xba21('0x2e')][_0xba21('0x1a')]);}_0x1a4601['order']=qs[_0xba21('0x36')](_0x54993f[_0xba21('0x2e')][_0xba21('0x36')]);delete _0x54993f['query'][_0xba21('0x36')];_0x1a4601['where']=qs['filters'](_[_0xba21('0x37')](_0x54993f[_0xba21('0x2e')],_0x19f111[_0xba21('0x38')]),_0x168d5e);if(_0x54993f['query'][_0xba21('0x39')]){_0x1a4601[_0xba21('0x3a')]=_[_0xba21('0x3b')](_0x1a4601['where'],{'$or':_[_0xba21('0x2d')](_0x168d5e,function(_0x16b36f){if(_0x16b36f[_0xba21('0x2b')]!==_0xba21('0x3c')){var _0x4f71de={};_0x4f71de[_0x16b36f[_0xba21('0x27')]]={'$like':'%'+_0x54993f[_0xba21('0x2e')][_0xba21('0x39')]+'%'};return _0x4f71de;}})});}_0x1a4601=_['merge']({},_0x1a4601,_0x54993f[_0xba21('0x3d')]);var _0xb32e8f={'where':_0x1a4601['where']};return db[_0xba21('0x3e')][_0xba21('0x1b')](_0xb32e8f)[_0xba21('0x22')](function(_0x1c6036){_0x545dff[_0xba21('0x1b')]=_0x1c6036;if(_0x54993f['query'][_0xba21('0x3f')]){_0x1a4601[_0xba21('0x40')]=[{'all':!![]}];}return db[_0xba21('0x3e')][_0xba21('0x41')](_0x1a4601);})[_0xba21('0x22')](function(_0x5345ca){_0x545dff[_0xba21('0x42')]=_0x5345ca;return _0x545dff;})['then'](respondWithFilteredResult(_0x4ce102,_0x1a4601))['catch'](handleError(_0x4ce102,null));};exports[_0xba21('0x43')]=function(_0x4bc6e8,_0x1c57c2){var _0x47362e={'raw':![],'where':{'id':_0x4bc6e8[_0xba21('0x44')]['id']}},_0x203753={};_0x203753[_0xba21('0x2c')]=_[_0xba21('0x2f')](db[_0xba21('0x3e')]['rawAttributes']);_0x203753[_0xba21('0x2e')]=_[_0xba21('0x2f')](_0x4bc6e8['query']);_0x203753[_0xba21('0x38')]=_[_0xba21('0x30')](_0x203753[_0xba21('0x2c')],_0x203753[_0xba21('0x2e')]);_0x47362e[_0xba21('0x31')]=_['intersection'](_0x203753[_0xba21('0x2c')],qs['fields'](_0x4bc6e8[_0xba21('0x2e')][_0xba21('0x32')]));_0x47362e[_0xba21('0x31')]=_0x47362e[_0xba21('0x31')][_0xba21('0x33')]?_0x47362e[_0xba21('0x31')]:_0x203753['model'];if(_0x4bc6e8[_0xba21('0x2e')][_0xba21('0x3f')]){_0x47362e[_0xba21('0x40')]=[{'all':!![]}];}_0x47362e=_['merge']({},_0x47362e,_0x4bc6e8[_0xba21('0x3d')]);return db[_0xba21('0x3e')]['find'](_0x47362e)[_0xba21('0x22')](handleEntityNotFound(_0x1c57c2,null))[_0xba21('0x22')](respondWithResult(_0x1c57c2,null))[_0xba21('0x45')](handleError(_0x1c57c2,null));};exports['update']=function(_0x3ee713,_0x4a053a){if(_0x3ee713[_0xba21('0x46')]['id']){delete _0x3ee713[_0xba21('0x46')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3ee713[_0xba21('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a053a,null))[_0xba21('0x22')](saveUpdates(_0x3ee713[_0xba21('0x46')],null))['then'](respondWithResult(_0x4a053a,null))[_0xba21('0x45')](handleError(_0x4a053a,null));};exports[_0xba21('0x47')]=function(_0x413abc,_0x484faf,_0x26ebde){return db[_0xba21('0x48')][_0xba21('0x49')](function(_0xcd11a4){if(_0x413abc[_0xba21('0x46')][_0xba21('0x4a')]===_0xba21('0x4b')){_0x413abc['body']['directory']=path['join'](config[_0xba21('0x4c')],_0xba21('0x4d'),_0x413abc[_0xba21('0x46')][_0xba21('0x27')]);}return db[_0xba21('0x3e')]['create'](_0x413abc[_0xba21('0x46')],{'transaction':_0xcd11a4})[_0xba21('0x22')](function(_0x2d0be0){if(_0x413abc[_0xba21('0x46')][_0xba21('0x4a')]==='files'){fs[_0xba21('0x4e')](_0x2d0be0[_0xba21('0x4f')],parseInt(_0xba21('0x50'),0x8));}var _0xd3e822=_0x413abc[_0xba21('0x51')][_0xba21('0x52')]({'plain':!![]});if(!_0xd3e822)throw new Error(_0xba21('0x53'));if(_0xd3e822['role']===_0xba21('0x51')){var _0xb54369=_0x2d0be0[_0xba21('0x52')]({'plain':!![]});return db[_0xba21('0x54')][_0xba21('0x55')]({'where':{'name':_0xba21('0x23'),'userProfileId':_0xd3e822['userProfileId']},'raw':!![]})['then'](function(_0x108054){if(_0x108054&&_0x108054['autoAssociation']===0x0){return db[_0xba21('0x24')][_0xba21('0x47')]({'name':_0xb54369[_0xba21('0x27')],'resourceId':_0xb54369['id'],'type':_0x108054[_0xba21('0x27')],'sectionId':_0x108054['id']},{})[_0xba21('0x22')](function(){return _0x2d0be0;});}else{return _0x2d0be0;}})['catch'](function(_0x1d76d3){logger[_0xba21('0x56')](_0xba21('0x57'),_0x1d76d3);});}return _0x2d0be0;});})[_0xba21('0x22')](respondWithResult(_0x484faf,0xc9))[_0xba21('0x45')](handleError(_0x484faf,null));};exports[_0xba21('0x21')]=function(_0x1e1d37,_0x1bf19e,_0x1c0736){var _0x9331bc;return db[_0xba21('0x3e')][_0xba21('0x55')]({'where':{'id':_0x1e1d37[_0xba21('0x44')]['id']}})[_0xba21('0x22')](function(_0x4ed431){if(_0x4ed431){return db[_0xba21('0x48')]['transaction'](function(_0x553a29){return _0x4ed431[_0xba21('0x21')]({'transaction':_0x553a29,'raw':!![]})[_0xba21('0x22')](function(_0x363037){if(_0x363037[_0xba21('0x4f')]){fs[_0xba21('0x58')](_0x363037['directory'])[_0xba21('0x59')](function(_0x2cae96){fs['unlinkSync'](path[_0xba21('0x5a')](_0x363037[_0xba21('0x4f')],_0x2cae96));});fs['rmdirSync'](_0x363037[_0xba21('0x4f')]);}return _0x363037;});})[_0xba21('0x45')](function(_0x257014){throw new db[(_0xba21('0x5b'))]['ValidationError'](_0x257014['message']);});}})['then'](handleEntityNotFound(_0x1bf19e,null))[_0xba21('0x22')](removeEntity(_0x1bf19e,null))['catch'](handleError(_0x1bf19e,null));};exports[_0xba21('0x5c')]=function(_0x571874,_0x2178fd,_0x47fc1a){return db['sequelize'][_0xba21('0x49')](function(_0xa00095){var _0x310f77;return db[_0xba21('0x3e')][_0xba21('0x55')]({'where':{'id':_0x571874[_0xba21('0x44')]['id']}})[_0xba21('0x22')](function(_0x48f476){if(_0x48f476){_0x310f77=_0x48f476;return _0x48f476['addSound'](_0x571874['body']['id'],{'transaction':_0xa00095});}})['then'](function(_0x3b51a8){if(_0x3b51a8){return db[_0xba21('0x5d')]['findOne']({'where':{'id':_0x571874[_0xba21('0x46')]['id']},'attributes':['id',_0xba21('0x27'),'save_name',_0xba21('0x5e'),_0xba21('0x5f')],'raw':!![]});}})['then'](function(_0x522ebe){if(_0x522ebe){var _0x4ab791=path[_0xba21('0x5a')](config['root'],'server/files/sounds/converted',util[_0xba21('0x60')](_0xba21('0x61'),path[_0xba21('0x62')](_0x522ebe[_0xba21('0x63')],path[_0xba21('0x64')](_0x522ebe['save_name'])),_0x522ebe[_0xba21('0x5e')]));var _0x5dbc2e=path[_0xba21('0x5a')](config[_0xba21('0x4c')],'server/files/moh',_0x310f77[_0xba21('0x27')],util[_0xba21('0x60')](_0xba21('0x61'),_0x522ebe[_0xba21('0x27')],_0x522ebe[_0xba21('0x5e')]));fs[_0xba21('0x65')](_0x4ab791,_0x5dbc2e);return _0x522ebe;}})[_0xba21('0x45')](function(_0x3fd9dd){throw new db[(_0xba21('0x5b'))]['ValidationError'](_0x3fd9dd[_0xba21('0x66')]);});})['then'](handleEntityNotFound(_0x2178fd,null))[_0xba21('0x22')](respondWithResult(_0x2178fd,0xc9))[_0xba21('0x45')](handleError(_0x2178fd,null));};exports[_0xba21('0x67')]=function(_0x578e74,_0x4967a4,_0x393657){return db[_0xba21('0x48')][_0xba21('0x49')](function(_0x1e6fb7){var _0x4c51ae;return db[_0xba21('0x3e')][_0xba21('0x68')]({'where':{'id':_0x578e74[_0xba21('0x44')]['id']}})[_0xba21('0x22')](handleEntityNotFound(_0x4967a4,null))['then'](function(_0x54aa47){if(_0x54aa47){_0x4c51ae=_0x54aa47;return _0x54aa47[_0xba21('0x67')](_0x578e74[_0xba21('0x44')][_0xba21('0x69')]);}})[_0xba21('0x22')](function(_0x3eceba){if(_0x3eceba){return db[_0xba21('0x5d')][_0xba21('0x68')]({'where':{'id':_0x578e74[_0xba21('0x44')][_0xba21('0x69')]},'attributes':['id',_0xba21('0x27'),_0xba21('0x63'),_0xba21('0x5e'),_0xba21('0x5f')],'raw':!![]});}})[_0xba21('0x22')](function(_0x22bdc8){if(_0x22bdc8){fs[_0xba21('0x6a')](path[_0xba21('0x5a')](_0x4c51ae[_0xba21('0x4f')],util[_0xba21('0x60')]('%s.%s',_0x22bdc8[_0xba21('0x27')],_0x22bdc8[_0xba21('0x5e')])));return _0x22bdc8;}})[_0xba21('0x45')](function(_0xebb0a5){throw new db[(_0xba21('0x5b'))][(_0xba21('0x6b'))](_0xebb0a5['message']);});})[_0xba21('0x22')](handleEntityNotFound(_0x4967a4,null))[_0xba21('0x22')](respondWithStatusCode(_0x4967a4,0xcc))['catch'](handleError(_0x4967a4,null));};exports['getSounds']=function(_0x16d47e,_0x529ea8,_0x1c1767){var _0x22e2d0={};var _0x513519={};var _0x427096;var _0x315ea1;return db[_0xba21('0x3e')][_0xba21('0x68')]({'where':{'id':_0x16d47e['params']['id']}})[_0xba21('0x22')](handleEntityNotFound(_0x529ea8,null))['then'](function(_0x318077){if(_0x318077){_0x427096=_0x318077;_0x513519[_0xba21('0x2c')]=_[_0xba21('0x2f')](db[_0xba21('0x5d')][_0xba21('0x6c')]);_0x513519[_0xba21('0x2e')]=_[_0xba21('0x2f')](_0x16d47e[_0xba21('0x2e')]);_0x513519[_0xba21('0x38')]=_['intersection'](_0x513519[_0xba21('0x2c')],_0x513519['query']);_0x22e2d0[_0xba21('0x31')]=_['intersection'](_0x513519[_0xba21('0x2c')],qs[_0xba21('0x32')](_0x16d47e[_0xba21('0x2e')][_0xba21('0x32')]));_0x22e2d0[_0xba21('0x31')]=_0x22e2d0[_0xba21('0x31')][_0xba21('0x33')]?_0x22e2d0[_0xba21('0x31')]:_0x513519[_0xba21('0x2c')];_0x22e2d0['order']=qs[_0xba21('0x36')](_0x16d47e[_0xba21('0x2e')][_0xba21('0x36')]);_0x22e2d0[_0xba21('0x3a')]=qs['filters'](_[_0xba21('0x37')](_0x16d47e[_0xba21('0x2e')],_0x513519[_0xba21('0x38')]));if(_0x16d47e['query']['filter']){_0x22e2d0[_0xba21('0x3a')]=_[_0xba21('0x3b')](_0x22e2d0[_0xba21('0x3a')],{'$or':_[_0xba21('0x2d')](_0x22e2d0[_0xba21('0x31')],function(_0x3ff5b7){var _0x41e164={};_0x41e164[_0x3ff5b7]={'$like':'%'+_0x16d47e[_0xba21('0x2e')][_0xba21('0x39')]+'%'};return _0x41e164;})});}_0x22e2d0=_['merge']({},_0x22e2d0,_0x16d47e[_0xba21('0x3d')]);return _0x427096[_0xba21('0x6d')](_0x22e2d0);}})['then'](function(_0x3ea822){if(_0x3ea822){_0x315ea1=_0x3ea822[_0xba21('0x33')];if(!_0x16d47e[_0xba21('0x2e')][_0xba21('0x34')](_0xba21('0x35'))){_0x22e2d0[_0xba21('0x1c')]=qs[_0xba21('0x1c')](_0x16d47e[_0xba21('0x2e')][_0xba21('0x1c')]);_0x22e2d0[_0xba21('0x1a')]=qs['offset'](_0x16d47e[_0xba21('0x2e')][_0xba21('0x1a')]);}return _0x427096['getSounds'](_0x22e2d0);}})[_0xba21('0x22')](function(_0x1efe1e){if(_0x1efe1e){return _0x1efe1e?{'count':_0x315ea1,'rows':_0x1efe1e}:null;}})['then'](respondWithResult(_0x529ea8,null))[_0xba21('0x45')](handleError(_0x529ea8,null));}; \ No newline at end of file +var _0x4a1e=['apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','intersection','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','Sequelize','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../mysqldb','status','end','undefined','limit','count','offset','set','json'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x4a1e,0x1c0));var _0xe4a1=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x4a1e[_0x120bc2];return _0x454a41;};'use strict';var emlformat=require(_0xe4a1('0x0'));var rimraf=require(_0xe4a1('0x1'));var zipdir=require(_0xe4a1('0x2'));var jsonpatch=require(_0xe4a1('0x3'));var rp=require(_0xe4a1('0x4'));var moment=require(_0xe4a1('0x5'));var BPromise=require(_0xe4a1('0x6'));var Mustache=require(_0xe4a1('0x7'));var util=require(_0xe4a1('0x8'));var path=require(_0xe4a1('0x9'));var sox=require(_0xe4a1('0xa'));var csv=require('to-csv');var ejs=require(_0xe4a1('0xb'));var fs=require('fs');var fs_extra=require(_0xe4a1('0xc'));var _=require(_0xe4a1('0xd'));var squel=require(_0xe4a1('0xe'));var crypto=require(_0xe4a1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe4a1('0x10'));var toCsv=require(_0xe4a1('0x11'));var querystring=require(_0xe4a1('0x12'));var Papa=require('papaparse');var Redis=require(_0xe4a1('0x13'));var authService=require(_0xe4a1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe4a1('0x15'));var hardwareService=require(_0xe4a1('0x16'));var logger=require(_0xe4a1('0x17'))('api');var utils=require(_0xe4a1('0x18'));var config=require(_0xe4a1('0x19'));var licenseUtil=require(_0xe4a1('0x1a'));var db=require(_0xe4a1('0x1b'))['db'];function respondWithStatusCode(_0x2c3ae6,_0x1f770b){_0x1f770b=_0x1f770b||0xcc;return function(_0x2de9c2){if(_0x2de9c2){return _0x2c3ae6['sendStatus'](_0x1f770b);}return _0x2c3ae6[_0xe4a1('0x1c')](_0x1f770b)[_0xe4a1('0x1d')]();};}function respondWithResult(_0x280366,_0x4f8e50){_0x4f8e50=_0x4f8e50||0xc8;return function(_0x2fd604){if(_0x2fd604){return _0x280366[_0xe4a1('0x1c')](_0x4f8e50)['json'](_0x2fd604);}};}function respondWithFilteredResult(_0x23c194,_0x28eac4){return function(_0x2aea15){if(_0x2aea15){var _0x4aaa49=typeof _0x28eac4['offset']===_0xe4a1('0x1e')&&typeof _0x28eac4[_0xe4a1('0x1f')]==='undefined';var _0x56a157=_0x2aea15[_0xe4a1('0x20')];var _0x2bea1d=_0x4aaa49?0x0:_0x28eac4[_0xe4a1('0x21')];var _0x512ea4=_0x4aaa49?_0x2aea15[_0xe4a1('0x20')]:_0x28eac4[_0xe4a1('0x21')]+_0x28eac4[_0xe4a1('0x1f')];var _0x131070;if(_0x512ea4>=_0x56a157){_0x512ea4=_0x56a157;_0x131070=0xc8;}else{_0x131070=0xce;}_0x23c194[_0xe4a1('0x1c')](_0x131070);return _0x23c194[_0xe4a1('0x22')]('Content-Range',_0x2bea1d+'-'+_0x512ea4+'/'+_0x56a157)[_0xe4a1('0x23')](_0x2aea15);}return null;};}function patchUpdates(_0x51293e){return function(_0xcb9011){try{jsonpatch[_0xe4a1('0x24')](_0xcb9011,_0x51293e,!![]);}catch(_0xa3874e){return BPromise[_0xe4a1('0x25')](_0xa3874e);}return _0xcb9011[_0xe4a1('0x26')]();};}function saveUpdates(_0x499b03,_0x563a54){return function(_0x10dee1){if(_0x10dee1){return _0x10dee1[_0xe4a1('0x27')](_0x499b03)[_0xe4a1('0x28')](function(_0x17689d){return _0x17689d;});}return null;};}function removeEntity(_0x5f3755,_0x143faf){return function(_0x3a620e){if(_0x3a620e){return _0x3a620e[_0xe4a1('0x29')]()[_0xe4a1('0x28')](function(){var _0x3510a7=_0x3a620e[_0xe4a1('0x2a')]({'plain':!![]});var _0x28170c=_0xe4a1('0x2b');return db[_0xe4a1('0x2c')][_0xe4a1('0x29')]({'where':{'type':_0x28170c,'resourceId':_0x3510a7['id']}})[_0xe4a1('0x28')](function(){return _0x3a620e;});})[_0xe4a1('0x28')](function(){_0x5f3755[_0xe4a1('0x1c')](0xcc)[_0xe4a1('0x1d')]();});}};}function handleEntityNotFound(_0x9138ae,_0x449623){return function(_0x2376c4){if(!_0x2376c4){_0x9138ae[_0xe4a1('0x2d')](0x194);}return _0x2376c4;};}function handleError(_0x5cf6ec,_0x38682f){_0x38682f=_0x38682f||0x1f4;return function(_0x2d60ab){logger['error'](_0x2d60ab[_0xe4a1('0x2e')]);if(_0x2d60ab['name']){delete _0x2d60ab[_0xe4a1('0x2f')];}_0x5cf6ec['status'](_0x38682f)[_0xe4a1('0x30')](_0x2d60ab);};}exports[_0xe4a1('0x31')]=function(_0x416293,_0x282eda){var _0x287065={},_0x4a84e9={},_0x589788={'count':0x0,'rows':[]};var _0x1ccb9a=_[_0xe4a1('0x32')](db[_0xe4a1('0x33')][_0xe4a1('0x34')],function(_0x10559a){return{'name':_0x10559a[_0xe4a1('0x35')],'type':_0x10559a[_0xe4a1('0x36')][_0xe4a1('0x37')]};});_0x4a84e9[_0xe4a1('0x38')]=_[_0xe4a1('0x32')](_0x1ccb9a,_0xe4a1('0x2f'));_0x4a84e9[_0xe4a1('0x39')]=_[_0xe4a1('0x3a')](_0x416293[_0xe4a1('0x39')]);_0x4a84e9[_0xe4a1('0x3b')]=_['intersection'](_0x4a84e9['model'],_0x4a84e9[_0xe4a1('0x39')]);_0x287065[_0xe4a1('0x3c')]=_['intersection'](_0x4a84e9[_0xe4a1('0x38')],qs[_0xe4a1('0x3d')](_0x416293['query'][_0xe4a1('0x3d')]));_0x287065['attributes']=_0x287065[_0xe4a1('0x3c')][_0xe4a1('0x3e')]?_0x287065[_0xe4a1('0x3c')]:_0x4a84e9['model'];if(!_0x416293[_0xe4a1('0x39')]['hasOwnProperty'](_0xe4a1('0x3f'))){_0x287065[_0xe4a1('0x1f')]=qs['limit'](_0x416293[_0xe4a1('0x39')][_0xe4a1('0x1f')]);_0x287065['offset']=qs[_0xe4a1('0x21')](_0x416293[_0xe4a1('0x39')][_0xe4a1('0x21')]);}_0x287065[_0xe4a1('0x40')]=qs[_0xe4a1('0x41')](_0x416293[_0xe4a1('0x39')]['sort']);delete _0x416293[_0xe4a1('0x39')]['sort'];_0x287065[_0xe4a1('0x42')]=qs[_0xe4a1('0x3b')](_[_0xe4a1('0x43')](_0x416293[_0xe4a1('0x39')],_0x4a84e9[_0xe4a1('0x3b')]),_0x1ccb9a);if(_0x416293['query']['filter']){_0x287065[_0xe4a1('0x42')]=_[_0xe4a1('0x44')](_0x287065['where'],{'$or':_[_0xe4a1('0x32')](_0x1ccb9a,function(_0x51a536){if(_0x51a536[_0xe4a1('0x36')]!==_0xe4a1('0x45')){var _0x4bff7b={};_0x4bff7b[_0x51a536[_0xe4a1('0x2f')]]={'$like':'%'+_0x416293[_0xe4a1('0x39')][_0xe4a1('0x46')]+'%'};return _0x4bff7b;}})});}_0x287065=_[_0xe4a1('0x44')]({},_0x287065,_0x416293[_0xe4a1('0x47')]);var _0x41491c={'where':_0x287065[_0xe4a1('0x42')]};return db[_0xe4a1('0x33')][_0xe4a1('0x20')](_0x41491c)[_0xe4a1('0x28')](function(_0x30882d){_0x589788[_0xe4a1('0x20')]=_0x30882d;if(_0x416293[_0xe4a1('0x39')][_0xe4a1('0x48')]){_0x287065[_0xe4a1('0x49')]=[{'all':!![]}];}return db[_0xe4a1('0x33')][_0xe4a1('0x4a')](_0x287065);})['then'](function(_0x5257fe){_0x589788['rows']=_0x5257fe;return _0x589788;})[_0xe4a1('0x28')](respondWithFilteredResult(_0x282eda,_0x287065))[_0xe4a1('0x4b')](handleError(_0x282eda,null));};exports[_0xe4a1('0x4c')]=function(_0x427ff9,_0x440c16){var _0x20b2c0={'raw':![],'where':{'id':_0x427ff9['params']['id']}},_0x57a8ce={};_0x57a8ce[_0xe4a1('0x38')]=_[_0xe4a1('0x3a')](db[_0xe4a1('0x33')]['rawAttributes']);_0x57a8ce[_0xe4a1('0x39')]=_[_0xe4a1('0x3a')](_0x427ff9[_0xe4a1('0x39')]);_0x57a8ce[_0xe4a1('0x3b')]=_['intersection'](_0x57a8ce['model'],_0x57a8ce[_0xe4a1('0x39')]);_0x20b2c0[_0xe4a1('0x3c')]=_[_0xe4a1('0x4d')](_0x57a8ce[_0xe4a1('0x38')],qs[_0xe4a1('0x3d')](_0x427ff9[_0xe4a1('0x39')][_0xe4a1('0x3d')]));_0x20b2c0['attributes']=_0x20b2c0[_0xe4a1('0x3c')][_0xe4a1('0x3e')]?_0x20b2c0['attributes']:_0x57a8ce['model'];if(_0x427ff9[_0xe4a1('0x39')][_0xe4a1('0x48')]){_0x20b2c0[_0xe4a1('0x49')]=[{'all':!![]}];}_0x20b2c0=_[_0xe4a1('0x44')]({},_0x20b2c0,_0x427ff9[_0xe4a1('0x47')]);return db[_0xe4a1('0x33')][_0xe4a1('0x4e')](_0x20b2c0)[_0xe4a1('0x28')](handleEntityNotFound(_0x440c16,null))['then'](respondWithResult(_0x440c16,null))[_0xe4a1('0x4b')](handleError(_0x440c16,null));};exports['update']=function(_0x475b04,_0x2d8c5c){if(_0x475b04[_0xe4a1('0x4f')]['id']){delete _0x475b04[_0xe4a1('0x4f')]['id'];}return db[_0xe4a1('0x33')][_0xe4a1('0x4e')]({'where':{'id':_0x475b04[_0xe4a1('0x50')]['id']}})[_0xe4a1('0x28')](handleEntityNotFound(_0x2d8c5c,null))[_0xe4a1('0x28')](saveUpdates(_0x475b04['body'],null))[_0xe4a1('0x28')](respondWithResult(_0x2d8c5c,null))[_0xe4a1('0x4b')](handleError(_0x2d8c5c,null));};exports[_0xe4a1('0x51')]=function(_0x14244c,_0x5d02c7,_0x5a8708){return db[_0xe4a1('0x52')][_0xe4a1('0x53')](function(_0x1e4d06){if(_0x14244c[_0xe4a1('0x4f')][_0xe4a1('0x54')]===_0xe4a1('0x55')){_0x14244c['body'][_0xe4a1('0x56')]=path[_0xe4a1('0x57')](config[_0xe4a1('0x58')],_0xe4a1('0x59'),_0x14244c['body'][_0xe4a1('0x2f')]);}return db[_0xe4a1('0x33')][_0xe4a1('0x51')](_0x14244c[_0xe4a1('0x4f')],{'transaction':_0x1e4d06})['then'](function(_0x13c71a){if(_0x14244c['body'][_0xe4a1('0x54')]==='files'){fs[_0xe4a1('0x5a')](_0x13c71a['directory'],parseInt(_0xe4a1('0x5b'),0x8));}var _0x17230d=_0x14244c[_0xe4a1('0x5c')]['get']({'plain':!![]});if(!_0x17230d)throw new Error(_0xe4a1('0x5d'));if(_0x17230d['role']===_0xe4a1('0x5c')){var _0x15e59c=_0x13c71a['get']({'plain':!![]});return db[_0xe4a1('0x5e')][_0xe4a1('0x4e')]({'where':{'name':'MusicOnHolds','userProfileId':_0x17230d[_0xe4a1('0x5f')]},'raw':!![]})[_0xe4a1('0x28')](function(_0x350982){if(_0x350982&&_0x350982[_0xe4a1('0x60')]===0x0){return db[_0xe4a1('0x2c')][_0xe4a1('0x51')]({'name':_0x15e59c[_0xe4a1('0x2f')],'resourceId':_0x15e59c['id'],'type':_0x350982['name'],'sectionId':_0x350982['id']},{})[_0xe4a1('0x28')](function(){return _0x13c71a;});}else{return _0x13c71a;}})['catch'](function(_0x30d709){logger[_0xe4a1('0x61')](_0xe4a1('0x62'),_0x30d709);});}return _0x13c71a;});})['then'](respondWithResult(_0x5d02c7,0xc9))[_0xe4a1('0x4b')](handleError(_0x5d02c7,null));};exports['destroy']=function(_0x572db0,_0x30cd2d,_0x344279){var _0x420023;return db[_0xe4a1('0x33')]['find']({'where':{'id':_0x572db0[_0xe4a1('0x50')]['id']}})[_0xe4a1('0x28')](function(_0x495ec7){if(_0x495ec7){return db[_0xe4a1('0x52')]['transaction'](function(_0x11ec63){return _0x495ec7['destroy']({'transaction':_0x11ec63,'raw':!![]})[_0xe4a1('0x28')](function(_0x57286a){if(_0x57286a[_0xe4a1('0x56')]){fs[_0xe4a1('0x63')](_0x57286a[_0xe4a1('0x56')])[_0xe4a1('0x64')](function(_0x17d353){fs[_0xe4a1('0x65')](path[_0xe4a1('0x57')](_0x57286a['directory'],_0x17d353));});fs[_0xe4a1('0x66')](_0x57286a[_0xe4a1('0x56')]);}return _0x57286a;});})[_0xe4a1('0x4b')](function(_0x2b22c7){throw new db['Sequelize'][(_0xe4a1('0x67'))](_0x2b22c7['message']);});}})[_0xe4a1('0x28')](handleEntityNotFound(_0x30cd2d,null))[_0xe4a1('0x28')](removeEntity(_0x30cd2d,null))['catch'](handleError(_0x30cd2d,null));};exports['addSound']=function(_0x1caf82,_0x31f19f,_0x44748a){return db[_0xe4a1('0x52')][_0xe4a1('0x53')](function(_0x3b333f){var _0x1c479d;return db[_0xe4a1('0x33')]['find']({'where':{'id':_0x1caf82[_0xe4a1('0x50')]['id']}})[_0xe4a1('0x28')](function(_0x2da577){if(_0x2da577){_0x1c479d=_0x2da577;return _0x2da577[_0xe4a1('0x68')](_0x1caf82[_0xe4a1('0x4f')]['id'],{'transaction':_0x3b333f});}})['then'](function(_0x1119e7){if(_0x1119e7){return db[_0xe4a1('0x69')][_0xe4a1('0x6a')]({'where':{'id':_0x1caf82[_0xe4a1('0x4f')]['id']},'attributes':['id','name',_0xe4a1('0x6b'),_0xe4a1('0x6c'),_0xe4a1('0x6d')],'raw':!![]});}})[_0xe4a1('0x28')](function(_0xca25fd){if(_0xca25fd){var _0x2a74b6=path[_0xe4a1('0x57')](config[_0xe4a1('0x58')],'server/files/sounds/converted',util[_0xe4a1('0x6e')](_0xe4a1('0x6f'),path[_0xe4a1('0x70')](_0xca25fd[_0xe4a1('0x6b')],path[_0xe4a1('0x71')](_0xca25fd['save_name'])),_0xca25fd['converted_format']));var _0x4b7043=path[_0xe4a1('0x57')](config[_0xe4a1('0x58')],_0xe4a1('0x59'),_0x1c479d[_0xe4a1('0x2f')],util[_0xe4a1('0x6e')](_0xe4a1('0x6f'),_0xca25fd[_0xe4a1('0x2f')],_0xca25fd[_0xe4a1('0x6c')]));fs[_0xe4a1('0x72')](_0x2a74b6,_0x4b7043);return _0xca25fd;}})['catch'](function(_0x586860){throw new db['Sequelize'][(_0xe4a1('0x67'))](_0x586860[_0xe4a1('0x73')]);});})['then'](handleEntityNotFound(_0x31f19f,null))[_0xe4a1('0x28')](respondWithResult(_0x31f19f,0xc9))['catch'](handleError(_0x31f19f,null));};exports['removeSound']=function(_0x34d7a3,_0x283b3d,_0x2c8459){return db[_0xe4a1('0x52')]['transaction'](function(_0x3ae81d){var _0x1c811b;return db[_0xe4a1('0x33')][_0xe4a1('0x6a')]({'where':{'id':_0x34d7a3[_0xe4a1('0x50')]['id']}})[_0xe4a1('0x28')](handleEntityNotFound(_0x283b3d,null))[_0xe4a1('0x28')](function(_0x3fc210){if(_0x3fc210){_0x1c811b=_0x3fc210;return _0x3fc210[_0xe4a1('0x74')](_0x34d7a3['params']['id2']);}})['then'](function(_0x286820){if(_0x286820){return db[_0xe4a1('0x69')]['findOne']({'where':{'id':_0x34d7a3[_0xe4a1('0x50')][_0xe4a1('0x75')]},'attributes':['id','name',_0xe4a1('0x6b'),_0xe4a1('0x6c'),_0xe4a1('0x6d')],'raw':!![]});}})[_0xe4a1('0x28')](function(_0x541042){if(_0x541042){fs[_0xe4a1('0x65')](path[_0xe4a1('0x57')](_0x1c811b[_0xe4a1('0x56')],util['format'](_0xe4a1('0x6f'),_0x541042[_0xe4a1('0x2f')],_0x541042[_0xe4a1('0x6c')])));return _0x541042;}})[_0xe4a1('0x4b')](function(_0x35164e){throw new db[(_0xe4a1('0x76'))][(_0xe4a1('0x67'))](_0x35164e[_0xe4a1('0x73')]);});})[_0xe4a1('0x28')](handleEntityNotFound(_0x283b3d,null))['then'](respondWithStatusCode(_0x283b3d,0xcc))[_0xe4a1('0x4b')](handleError(_0x283b3d,null));};exports[_0xe4a1('0x77')]=function(_0x51496b,_0x41ed13,_0x1fd433){var _0x5fd428={};var _0x3af2dd={};var _0x1f8a41;var _0x23e13a;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x51496b['params']['id']}})[_0xe4a1('0x28')](handleEntityNotFound(_0x41ed13,null))[_0xe4a1('0x28')](function(_0x5a4999){if(_0x5a4999){_0x1f8a41=_0x5a4999;_0x3af2dd[_0xe4a1('0x38')]=_['keys'](db[_0xe4a1('0x69')][_0xe4a1('0x34')]);_0x3af2dd['query']=_[_0xe4a1('0x3a')](_0x51496b[_0xe4a1('0x39')]);_0x3af2dd[_0xe4a1('0x3b')]=_[_0xe4a1('0x4d')](_0x3af2dd[_0xe4a1('0x38')],_0x3af2dd[_0xe4a1('0x39')]);_0x5fd428[_0xe4a1('0x3c')]=_[_0xe4a1('0x4d')](_0x3af2dd[_0xe4a1('0x38')],qs['fields'](_0x51496b[_0xe4a1('0x39')][_0xe4a1('0x3d')]));_0x5fd428[_0xe4a1('0x3c')]=_0x5fd428[_0xe4a1('0x3c')]['length']?_0x5fd428['attributes']:_0x3af2dd[_0xe4a1('0x38')];_0x5fd428[_0xe4a1('0x40')]=qs[_0xe4a1('0x41')](_0x51496b['query']['sort']);_0x5fd428['where']=qs['filters'](_[_0xe4a1('0x43')](_0x51496b['query'],_0x3af2dd[_0xe4a1('0x3b')]));if(_0x51496b['query'][_0xe4a1('0x46')]){_0x5fd428[_0xe4a1('0x42')]=_[_0xe4a1('0x44')](_0x5fd428[_0xe4a1('0x42')],{'$or':_[_0xe4a1('0x32')](_0x5fd428[_0xe4a1('0x3c')],function(_0x28e53b){var _0x4e7630={};_0x4e7630[_0x28e53b]={'$like':'%'+_0x51496b[_0xe4a1('0x39')]['filter']+'%'};return _0x4e7630;})});}_0x5fd428=_[_0xe4a1('0x44')]({},_0x5fd428,_0x51496b['options']);return _0x1f8a41[_0xe4a1('0x77')](_0x5fd428);}})[_0xe4a1('0x28')](function(_0xb800a9){if(_0xb800a9){_0x23e13a=_0xb800a9[_0xe4a1('0x3e')];if(!_0x51496b[_0xe4a1('0x39')][_0xe4a1('0x78')]('nolimit')){_0x5fd428[_0xe4a1('0x1f')]=qs['limit'](_0x51496b[_0xe4a1('0x39')][_0xe4a1('0x1f')]);_0x5fd428[_0xe4a1('0x21')]=qs[_0xe4a1('0x21')](_0x51496b[_0xe4a1('0x39')][_0xe4a1('0x21')]);}return _0x1f8a41[_0xe4a1('0x77')](_0x5fd428);}})[_0xe4a1('0x28')](function(_0x3a29c2){if(_0x3a29c2){return _0x3a29c2?{'count':_0x23e13a,'rows':_0x3a29c2}:null;}})['then'](respondWithResult(_0x41ed13,null))[_0xe4a1('0x4b')](handleError(_0x41ed13,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bf250e1..c4cbbcb 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 _0x27ab=['voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold'];(function(_0x5923ab,_0x795b40){var _0x5f231c=function(_0x3a2874){while(--_0x3a2874){_0x5923ab['push'](_0x5923ab['shift']());}};_0x5f231c(++_0x795b40);}(_0x27ab,0x1d5));var _0xb27a=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x27ab[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb27a('0x0'));var util=require(_0xb27a('0x1'));var logger=require(_0xb27a('0x2'))('api');var moment=require(_0xb27a('0x3'));var BPromise=require(_0xb27a('0x4'));var rp=require(_0xb27a('0x5'));var fs=require('fs');var path=require(_0xb27a('0x6'));var rimraf=require(_0xb27a('0x7'));var config=require(_0xb27a('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xb27a('0x9')]=function(_0x52ad96,_0x125be6){return _0x52ad96[_0xb27a('0xa')](_0xb27a('0xb'),attributes,{'tableName':_0xb27a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7b9=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold'];(function(_0x3523a4,_0x187939){var _0x31ec20=function(_0x2da2b6){while(--_0x2da2b6){_0x3523a4['push'](_0x3523a4['shift']());}};_0x31ec20(++_0x187939);}(_0xb7b9,0xeb));var _0x9b7b=function(_0x16f017,_0x54bf7c){_0x16f017=_0x16f017-0x0;var _0x5cf815=_0xb7b9[_0x16f017];return _0x5cf815;};'use strict';var _=require(_0x9b7b('0x0'));var util=require(_0x9b7b('0x1'));var logger=require(_0x9b7b('0x2'))(_0x9b7b('0x3'));var moment=require(_0x9b7b('0x4'));var BPromise=require(_0x9b7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b7b('0x6'));var rimraf=require(_0x9b7b('0x7'));var config=require(_0x9b7b('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x9b7b('0x9')]=function(_0x358dc5,_0x404666){return _0x358dc5[_0x9b7b('0xa')](_0x9b7b('0xb'),attributes,{'tableName':_0x9b7b('0xc'),'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 0aab97b..568f19d 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x20e166,_0x1a9568){var _0x5a9370=function(_0x5b81c8){while(--_0x5b81c8){_0x20e166['push'](_0x20e166['shift']());}};_0x5a9370(++_0x1a9568);}(_0x34e8,0x12c));var _0x834e=function(_0xfc6027,_0x3cddde){_0xfc6027=_0xfc6027-0x0;var _0xda3a3=_0x34e8[_0xfc6027];return _0xda3a3;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ 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(_0x11ce8a,_0x4d99b2){var _0xf42675=function(_0x1e8978){while(--_0x1e8978){_0x11ce8a['push'](_0x11ce8a['shift']());}};_0xf42675(++_0x4d99b2);}(_0x70e0,0x17b));var _0x070e=function(_0xc7e852,_0xbc9773){_0xc7e852=_0xc7e852-0x0;var _0x5800f3=_0x70e0[_0xc7e852];return _0x5800f3;};'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 33dfb13..af975f4 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 _0x80d9=['getTeams','post','/:id/users','addAgents','addTeams','update','delete','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','isAuthenticated','describe','get','/:id','show','/:id/teams'];(function(_0x2cb27f,_0x51faa7){var _0x4afd77=function(_0x4ca949){while(--_0x4ca949){_0x2cb27f['push'](_0x2cb27f['shift']());}};_0x4afd77(++_0x51faa7);}(_0x80d9,0x15c));var _0x980d=function(_0xbb557b,_0x35bd81){_0xbb557b=_0xbb557b-0x0;var _0x175a68=_0x80d9[_0xbb557b];return _0x175a68;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xc')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x980d('0xc')](_0x980d('0xf'),auth['isAuthenticated'](),controller[_0x980d('0x10')]);router['post']('/',auth[_0x980d('0xa')](),controller['create']);router[_0x980d('0x11')](_0x980d('0x12'),auth[_0x980d('0xa')](),controller[_0x980d('0x13')]);router[_0x980d('0x11')](_0x980d('0xf'),auth[_0x980d('0xa')](),controller[_0x980d('0x14')]);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0x15')]);router[_0x980d('0x16')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['destroy']);router[_0x980d('0x16')](_0x980d('0x12'),auth['isAuthenticated'](),controller[_0x980d('0x17')]);router['delete'](_0x980d('0xf'),auth[_0x980d('0xa')](),controller[_0x980d('0x18')]);module[_0x980d('0x19')]=router; \ No newline at end of file +var _0x7dfd=['/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['get'](_0xd7df('0x11'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);router['get'](_0xd7df('0x13'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);router[_0xd7df('0x15')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x16')]);router[_0xd7df('0x15')](_0xd7df('0x11'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x17')]);router[_0xd7df('0x15')](_0xd7df('0x13'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x18')]);router[_0xd7df('0x19')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x1a')](_0xd7df('0xf'),auth['isAuthenticated'](),controller[_0xd7df('0x1b')]);router[_0xd7df('0x1a')]('/:id/users',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1c')]);router[_0xd7df('0x1a')]('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1d')]);module[_0xd7df('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index da55b5a..c5a8a38 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 _0x1d89=['STRING','name','getDataValue','INTEGER','sequelize'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0x1d89,0xfe));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x91d8('0x0'));module['exports']={'name':{'type':Sequelize[_0x91d8('0x1')],'allowNull':![],'unique':_0x91d8('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1be839){return'system-'+this[_0x91d8('0x3')](_0x91d8('0x2'))+'-';}},'description':{'type':Sequelize[_0x91d8('0x1')]},'callerIdAll':{'type':Sequelize[_0x91d8('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x91d8('0x4')]}}; \ No newline at end of file +var _0x59af=['getDataValue','INTEGER','STRING','name','VIRTUAL','system-'];(function(_0x20dac6,_0x38886c){var _0x278490=function(_0x33afd9){while(--_0x33afd9){_0x20dac6['push'](_0x20dac6['shift']());}};_0x278490(++_0x38886c);}(_0x59af,0x182));var _0xf59a=function(_0x12c561,_0x4ee076){_0x12c561=_0x12c561-0x0;var _0x322abb=_0x59af[_0x12c561];return _0x322abb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf59a('0x0')],'allowNull':![],'unique':_0xf59a('0x1')},'prefix':{'type':Sequelize[_0xf59a('0x2')],'get':function(_0x41d93b){return _0xf59a('0x3')+this[_0xf59a('0x4')](_0xf59a('0x1'))+'-';}},'description':{'type':Sequelize[_0xf59a('0x0')]},'callerIdAll':{'type':Sequelize[_0xf59a('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xf59a('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0bee0a0..a3aad6d 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 _0x5b12=['QueryTypes','SELECT','TeamId','includes','all','union','compact','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','from-sip','exten','app','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','merge','getTeams','Team','User','online','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b12,0xa3));var _0x25b1=function(_0x4b363e,_0x5a158a){_0x4b363e=_0x4b363e-0x0;var _0xca8eb4=_0x5b12[_0x4b363e];return _0xca8eb4;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];config[_0x25b1('0x19')]=_[_0x25b1('0x1a')](config[_0x25b1('0x19')],{'host':_0x25b1('0x1b'),'port':0x18eb});var socket=require(_0x25b1('0x1c'))(new Redis(config[_0x25b1('0x19')]));require(_0x25b1('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c337a,_0x2559a1){_0x2559a1=_0x2559a1||0xcc;return function(_0x4de13f){if(_0x4de13f){return _0x2c337a[_0x25b1('0x1e')](_0x2559a1);}return _0x2c337a[_0x25b1('0x1f')](_0x2559a1)[_0x25b1('0x20')]();};}function respondWithResult(_0x4a5a58,_0x593165){_0x593165=_0x593165||0xc8;return function(_0x7b50ab){if(_0x7b50ab){return _0x4a5a58['status'](_0x593165)[_0x25b1('0x21')](_0x7b50ab);}};}function respondWithFilteredResult(_0x2ca567,_0x1be2d8){return function(_0x27ccc9){if(_0x27ccc9){var _0x1f78c2=typeof _0x1be2d8[_0x25b1('0x22')]===_0x25b1('0x23')&&typeof _0x1be2d8[_0x25b1('0x24')]==='undefined';var _0x4ecff1=_0x27ccc9[_0x25b1('0x25')];var _0x501dc8=_0x1f78c2?0x0:_0x1be2d8[_0x25b1('0x22')];var _0x50ae0f=_0x1f78c2?_0x27ccc9[_0x25b1('0x25')]:_0x1be2d8['offset']+_0x1be2d8[_0x25b1('0x24')];var _0x529310;if(_0x50ae0f>=_0x4ecff1){_0x50ae0f=_0x4ecff1;_0x529310=0xc8;}else{_0x529310=0xce;}_0x2ca567[_0x25b1('0x1f')](_0x529310);return _0x2ca567['set']('Content-Range',_0x501dc8+'-'+_0x50ae0f+'/'+_0x4ecff1)['json'](_0x27ccc9);}return null;};}function patchUpdates(_0x3bca9f){return function(_0x150436){try{jsonpatch['apply'](_0x150436,_0x3bca9f,!![]);}catch(_0x19bab8){return BPromise[_0x25b1('0x26')](_0x19bab8);}return _0x150436[_0x25b1('0x27')]();};}function saveUpdates(_0x246acd,_0x1aabbb){return function(_0x5e6b6b){if(_0x5e6b6b){return _0x5e6b6b[_0x25b1('0x28')](_0x246acd)[_0x25b1('0x29')](function(_0xd22469){return _0xd22469;});}return null;};}function removeEntity(_0x282187,_0x1f37ed){return function(_0x1292bf){if(_0x1292bf){return _0x1292bf['destroy']()[_0x25b1('0x29')](function(){var _0x27dd68=_0x1292bf[_0x25b1('0x2a')]({'plain':!![]});var _0x5bc8fc=_0x25b1('0x2b');return db[_0x25b1('0x2c')][_0x25b1('0x2d')]({'where':{'type':_0x5bc8fc,'resourceId':_0x27dd68['id']}})['then'](function(){return _0x1292bf;});})[_0x25b1('0x29')](function(){_0x282187['status'](0xcc)[_0x25b1('0x20')]();});}};}function handleEntityNotFound(_0x3febb8,_0x3a4475){return function(_0x293413){if(!_0x293413){_0x3febb8[_0x25b1('0x1e')](0x194);}return _0x293413;};}function handleError(_0x300a14,_0x46e429){_0x46e429=_0x46e429||0x1f4;return function(_0x4cd825){logger[_0x25b1('0x2e')](_0x4cd825[_0x25b1('0x2f')]);if(_0x4cd825[_0x25b1('0x30')]){delete _0x4cd825[_0x25b1('0x30')];}_0x300a14[_0x25b1('0x1f')](_0x46e429)['send'](_0x4cd825);};}exports[_0x25b1('0x31')]=function(_0x548dd0,_0x42441d){var _0x1622e8={},_0x1e1796={},_0x5a4234={'count':0x0,'rows':[]};var _0x5cbde5=_[_0x25b1('0x32')](db['VoicePrefix'][_0x25b1('0x33')],function(_0x391713){return{'name':_0x391713[_0x25b1('0x34')],'type':_0x391713['type']['key']};});_0x1e1796[_0x25b1('0x35')]=_[_0x25b1('0x32')](_0x5cbde5,_0x25b1('0x30'));_0x1e1796['query']=_[_0x25b1('0x36')](_0x548dd0[_0x25b1('0x37')]);_0x1e1796[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x1e1796['model'],_0x1e1796[_0x25b1('0x37')]);_0x1622e8[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1e1796['model'],qs['fields'](_0x548dd0[_0x25b1('0x37')]['fields']));_0x1622e8[_0x25b1('0x3a')]=_0x1622e8[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x1622e8[_0x25b1('0x3a')]:_0x1e1796[_0x25b1('0x35')];if(!_0x548dd0[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x1622e8[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x548dd0[_0x25b1('0x37')][_0x25b1('0x24')]);_0x1622e8[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x548dd0[_0x25b1('0x37')]['offset']);}_0x1622e8[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x548dd0['query'][_0x25b1('0x3f')]);_0x1622e8[_0x25b1('0x40')]=qs[_0x25b1('0x38')](_[_0x25b1('0x41')](_0x548dd0[_0x25b1('0x37')],_0x1e1796['filters']),_0x5cbde5);if(_0x548dd0[_0x25b1('0x37')]['filter']){_0x1622e8[_0x25b1('0x40')]=_['merge'](_0x1622e8[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x5cbde5,function(_0x1b354e){if(_0x1b354e[_0x25b1('0x42')]!==_0x25b1('0x43')){var _0x45713f={};_0x45713f[_0x1b354e[_0x25b1('0x30')]]={'$like':'%'+_0x548dd0[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x45713f;}})});}_0x1622e8=_['merge']({},_0x1622e8,_0x548dd0[_0x25b1('0x45')]);var _0x585c37={'where':_0x1622e8[_0x25b1('0x40')]};return db[_0x25b1('0x46')]['count'](_0x585c37)[_0x25b1('0x29')](function(_0x39b4c7){_0x5a4234[_0x25b1('0x25')]=_0x39b4c7;if(_0x548dd0[_0x25b1('0x37')][_0x25b1('0x47')]){_0x1622e8[_0x25b1('0x48')]=[{'all':!![]}];}return db[_0x25b1('0x46')][_0x25b1('0x49')](_0x1622e8);})[_0x25b1('0x29')](function(_0x453352){_0x5a4234[_0x25b1('0x4a')]=_0x453352;return _0x5a4234;})[_0x25b1('0x29')](respondWithFilteredResult(_0x42441d,_0x1622e8))[_0x25b1('0x4b')](handleError(_0x42441d,null));};exports[_0x25b1('0x4c')]=function(_0x21242a,_0x210cef){var _0x103953={'raw':![],'where':{'id':_0x21242a['params']['id']}},_0x210a13={};_0x210a13['model']=_['keys'](db[_0x25b1('0x46')]['rawAttributes']);_0x210a13[_0x25b1('0x37')]=_['keys'](_0x21242a[_0x25b1('0x37')]);_0x210a13[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x210a13[_0x25b1('0x35')],_0x210a13[_0x25b1('0x37')]);_0x103953[_0x25b1('0x3a')]=_['intersection'](_0x210a13[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x21242a[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x103953['attributes']=_0x103953[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x103953[_0x25b1('0x3a')]:_0x210a13['model'];if(_0x21242a[_0x25b1('0x37')]['includeAll']){_0x103953[_0x25b1('0x48')]=[{'all':!![]}];}_0x103953=_['merge']({},_0x103953,_0x21242a['options']);return db[_0x25b1('0x46')][_0x25b1('0x4e')](_0x103953)[_0x25b1('0x29')](handleEntityNotFound(_0x210cef,null))[_0x25b1('0x29')](respondWithResult(_0x210cef,null))['catch'](handleError(_0x210cef,null));};exports[_0x25b1('0x2d')]=function(_0x58e612,_0x7c30da){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x58e612[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x7c30da,null))['then'](removeEntity(_0x7c30da,null))[_0x25b1('0x4b')](handleError(_0x7c30da,null));};exports[_0x25b1('0x50')]=function(_0x354294,_0xf38a9e){return db[_0x25b1('0x46')][_0x25b1('0x50')]()['then'](respondWithResult(_0xf38a9e,null))[_0x25b1('0x4b')](handleError(_0xf38a9e,null));};exports[_0x25b1('0x51')]=function(_0x168931,_0x2311da){var _0x5e367;return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x40d574){return db[_0x25b1('0x46')][_0x25b1('0x51')](_0x168931[_0x25b1('0x54')],{'transaction':_0x40d574})[_0x25b1('0x29')](function(_0x4190a1){_0x5e367=_0x4190a1[_0x25b1('0x2a')]({'plain':!![]});return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x5e367[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5732a1){return createVoicePrefixExtensions(_0x5e367,_0x5732a1,_0x40d574);});});})[_0x25b1('0x29')](function(){var _0x16e61e=_0x168931[_0x25b1('0x57')][_0x25b1('0x2a')]({'plain':!![]});if(!_0x16e61e)throw new Error(_0x25b1('0x58'));if(_0x16e61e[_0x25b1('0x59')]==='user'){var _0x105587=_0x5e367;return db[_0x25b1('0x5a')][_0x25b1('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x16e61e[_0x25b1('0x5b')]},'raw':!![]})['then'](function(_0x5bd36b){if(_0x5bd36b&&_0x5bd36b['autoAssociation']===0x0){return db['UserProfileResource'][_0x25b1('0x51')]({'name':_0x105587['name'],'resourceId':_0x105587['id'],'type':_0x5bd36b[_0x25b1('0x30')],'sectionId':_0x5bd36b['id']},{})[_0x25b1('0x29')](function(){return _0x5e367;});}else{return _0x5e367;}})[_0x25b1('0x4b')](function(_0x439bab){logger[_0x25b1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439bab);throw _0x439bab;});}return _0x5e367;})[_0x25b1('0x29')](respondWithResult(_0x2311da,null))[_0x25b1('0x4b')](handleError(_0x2311da,null));};function Extension(_0x37b58d,_0x400ec9,_0x5ecc36,_0xcca343){this[_0x25b1('0x5c')]=_0x25b1('0x5d');this[_0x25b1('0x5e')]=_0x37b58d;this[_0x25b1('0x5f')]=_0x5ecc36;this[_0x25b1('0x42')]='system';this[_0x25b1('0x60')]='Voice\x20Prefix\x20Extension';this[_0x25b1('0x61')]=_0x400ec9;this[_0x25b1('0x62')]=_0xcca343;}function createVoicePrefixExtensions(_0x49052b,_0x42a81f,_0x3d8d33){return new BPromise(function(_0x551bed,_0x1351ea){var _0x303049=new Extension(formatPrefixName(_0x49052b[_0x25b1('0x63')]),0x1,_0x25b1('0x64'),_0x25b1('0x65'));_0x303049[_0x25b1('0x66')]=_0x49052b['id'];return db[_0x25b1('0x55')][_0x25b1('0x51')](_0x303049,{'transaction':_0x3d8d33})['then'](function(_0x6f1b1f){var _0x1e2dcb=_0x6f1b1f[_0x25b1('0x2a')]({'plain':!![]});var _0x1da588=_[_0x25b1('0x32')](addVoicePrefixExtensions(_0x49052b,_0x42a81f),function(_0x2b9223){_0x2b9223[_0x25b1('0x56')]=_0x1e2dcb['id'];_0x2b9223[_0x25b1('0x66')]=_0x49052b['id'];return _0x2b9223;});return db['VoiceExtension'][_0x25b1('0x67')](_0x1da588,{'transaction':_0x3d8d33})[_0x25b1('0x29')](function(_0x51f922){if(!_0x51f922){return _0x1351ea(_0x25b1('0x68'));}else{return _0x551bed(_0x51f922);}})[_0x25b1('0x4b')](function(_0x5b71e5){return _0x1351ea(_0x5b71e5);});});;});};function addVoicePrefixExtensions(_0x26e90c,_0x498aca){var _0x44aa87=[];var _0x4e62b5=formatPrefixName(_0x26e90c[_0x25b1('0x63')]);_0x44aa87['push'](new Extension(_0x4e62b5,0x2,_0x25b1('0x69'),_0x25b1('0x6a')+_0x26e90c[_0x25b1('0x30')]));if(_0x26e90c['callerIdAll']){_0x44aa87['push'](new Extension(_0x4e62b5,0x3,_0x25b1('0x69'),_0x25b1('0x6b')+_0x26e90c[_0x25b1('0x6c')]));}else{_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x3,_0x25b1('0x64'),_0x25b1('0x6e')));}_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x4,_0x25b1('0x6f'),_0x498aca[_0x25b1('0x5c')]+','+_0x25b1('0x70')+(0x8+_0x26e90c[_0x25b1('0x30')][_0x25b1('0x3b')])+'}'+','+0x1));return _0x44aa87;}function formatPrefixName(_0x3d06ab){var _0x975b85='_';for(var _0x1c22c4=0x0;_0x1c22c4<_0x3d06ab[_0x25b1('0x3b')];_0x1c22c4++){if(_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)=='-'){_0x975b85+=_0x3d06ab[_0x25b1('0x71')](_0x1c22c4);}else{_0x975b85+='['+_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)+']';}}_0x975b85+='.';return _0x975b85;}exports[_0x25b1('0x28')]=function(_0x15272b,_0x2fe4a5,_0x584499){var _0x1a3368=_0x15272b['body'];_0x1a3368[_0x25b1('0x63')]=_0x25b1('0x72')+_0x1a3368[_0x25b1('0x30')]+'-';return db['sequelize']['transaction'](function(_0x3f9ca7){return db[_0x25b1('0x46')]['update'](_0x1a3368,{'where':{'id':_0x1a3368['id']},'transaction':_0x3f9ca7})[_0x25b1('0x29')](function(){return db[_0x25b1('0x55')][_0x25b1('0x2d')]({'where':{'VoicePrefixId':_0x1a3368['id']},'transaction':_0x3f9ca7})['then'](function(){return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x1a3368[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5f1fef){return createVoicePrefixExtensions(_0x1a3368,_0x5f1fef,_0x3f9ca7);});});});})[_0x25b1('0x29')](function(){return db[_0x25b1('0x46')][_0x25b1('0x73')](_0x1a3368['id']);})[_0x25b1('0x29')](respondWithResult(_0x2fe4a5,null))[_0x25b1('0x4b')](handleError(_0x2fe4a5,null));};exports[_0x25b1('0x74')]=function(_0x4a9fbf,_0x40400e,_0x3f77e0){return db['VoicePrefix']['find']({'where':{'id':_0x4a9fbf[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x40400e,null))[_0x25b1('0x29')](function(_0x3ff99d){if(_0x3ff99d){return _0x3ff99d[_0x25b1('0x74')](_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')],_['omit'](_0x4a9fbf[_0x25b1('0x54')],[_0x25b1('0x75'),'id'])||{})[_0x25b1('0x76')](function(_0x49fac2){for(var _0x1bbb9b=0x0;_0x1bbb9b<_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')]['length'];_0x1bbb9b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x78'),{'UserId':Number(_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')][_0x1bbb9b]),'VoicePrefixId':Number(_0x4a9fbf[_0x25b1('0x4f')]['id'])});}return _0x49fac2;});}})[_0x25b1('0x29')](respondWithResult(_0x40400e,null))[_0x25b1('0x4b')](handleError(_0x40400e,null));};exports[_0x25b1('0x79')]=function(_0x1a07cb,_0x18021f,_0x20b43f){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x1a07cb[_0x25b1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18021f,null))[_0x25b1('0x29')](function(_0x45804b){if(_0x45804b){return _0x45804b[_0x25b1('0x79')](_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')])['then'](function(){if(_['isArray'](_0x1a07cb[_0x25b1('0x37')]['ids'])){for(var _0x3e7f2b=0x0;_0x3e7f2b<_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')][_0x25b1('0x3b')];_0x3e7f2b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query'][_0x25b1('0x75')][_0x3e7f2b]),'VoicePrefixId':Number(_0x1a07cb[_0x25b1('0x4f')]['id'])});}}else{socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query']['ids']),'VoicePrefixId':Number(_0x1a07cb['params']['id'])});}});}})[_0x25b1('0x29')](respondWithStatusCode(_0x18021f,null))[_0x25b1('0x4b')](handleError(_0x18021f,null));};exports['getAgents']=function(_0x49c2d3,_0x271837,_0x102b85){var _0x6bbd44={};var _0x67a4b7={};var _0x54e1a6;var _0x10409f;return db[_0x25b1('0x46')][_0x25b1('0x7b')]({'where':{'id':_0x49c2d3[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x271837,null))[_0x25b1('0x29')](function(_0x175c72){if(_0x175c72){_0x54e1a6=_0x175c72;_0x67a4b7[_0x25b1('0x35')]=_['keys'](db['User'][_0x25b1('0x33')]);_0x67a4b7[_0x25b1('0x37')]=_['keys'](_0x49c2d3['query']);_0x67a4b7[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x67a4b7['model'],_0x67a4b7[_0x25b1('0x37')]);_0x6bbd44[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x67a4b7[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x6bbd44['attributes']=_0x6bbd44[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x6bbd44[_0x25b1('0x3a')]:_0x67a4b7['model'];_0x6bbd44['order']=qs['sort'](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x6bbd44[_0x25b1('0x40')]=qs['filters'](_['pick'](_0x49c2d3[_0x25b1('0x37')],_0x67a4b7[_0x25b1('0x38')]));if(_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x44')]){_0x6bbd44[_0x25b1('0x40')]=_[_0x25b1('0x7c')](_0x6bbd44[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x6bbd44[_0x25b1('0x3a')],function(_0x4c74f8){var _0xb7494b={};_0xb7494b[_0x4c74f8]={'$like':'%'+_0x49c2d3[_0x25b1('0x37')]['filter']+'%'};return _0xb7494b;})});}_0x6bbd44=_['merge']({},_0x6bbd44,_0x49c2d3[_0x25b1('0x45')]);return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x133a5d){if(_0x133a5d){_0x10409f=_0x133a5d[_0x25b1('0x3b')];if(!_0x49c2d3['query']['hasOwnProperty']('nolimit')){_0x6bbd44[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x49c2d3['query'][_0x25b1('0x24')]);_0x6bbd44[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x22')]);}return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x954de5){if(_0x954de5){return _0x954de5?{'count':_0x10409f,'rows':_0x954de5}:null;}})['then'](respondWithResult(_0x271837,null))[_0x25b1('0x4b')](handleError(_0x271837,null));};exports['getTeams']=function(_0x198561,_0x4c2b9f,_0x5c7849){var _0x92b5d6={};var _0x1958c0={};var _0x4428d2;var _0x12e63d;return db[_0x25b1('0x46')]['findOne']({'where':{'id':_0x198561['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x4c2b9f,null))['then'](function(_0x2890c1){if(_0x2890c1){_0x4428d2=_0x2890c1;_0x1958c0[_0x25b1('0x35')]=_[_0x25b1('0x36')](db['Team'][_0x25b1('0x33')]);_0x1958c0['query']=_['keys'](_0x198561['query']);_0x1958c0[_0x25b1('0x38')]=_['intersection'](_0x1958c0[_0x25b1('0x35')],_0x1958c0[_0x25b1('0x37')]);_0x92b5d6[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1958c0[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x198561[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x92b5d6[_0x25b1('0x3a')]=_0x92b5d6[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x92b5d6[_0x25b1('0x3a')]:_0x1958c0[_0x25b1('0x35')];_0x92b5d6[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x198561[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x92b5d6['where']=qs[_0x25b1('0x38')](_['pick'](_0x198561[_0x25b1('0x37')],_0x1958c0[_0x25b1('0x38')]));if(_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]){_0x92b5d6[_0x25b1('0x40')]=_['merge'](_0x92b5d6[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x92b5d6[_0x25b1('0x3a')],function(_0x5af2b6){var _0x339e82={};_0x339e82[_0x5af2b6]={'$like':'%'+_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x339e82;})});}_0x92b5d6=_[_0x25b1('0x7c')]({},_0x92b5d6,_0x198561['options']);return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x270f00){if(_0x270f00){_0x12e63d=_0x270f00['length'];if(!_0x198561[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x92b5d6['limit']=qs[_0x25b1('0x24')](_0x198561[_0x25b1('0x37')]['limit']);_0x92b5d6[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x198561['query'][_0x25b1('0x22')]);}return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x14b909){if(_0x14b909){return _0x14b909?{'count':_0x12e63d,'rows':_0x14b909}:null;}})[_0x25b1('0x29')](respondWithResult(_0x4c2b9f,null))[_0x25b1('0x4b')](handleError(_0x4c2b9f,null));};exports['addTeams']=function(_0x3496a9,_0x30f1e9,_0x18211a){var _0x3038be=_0x3496a9[_0x25b1('0x54')][_0x25b1('0x75')];var _0x310a32;return db[_0x25b1('0x7e')][_0x25b1('0x49')]({'where':{'id':_0x3038be},'attributes':['id'],'include':[{'model':db[_0x25b1('0x7f')],'as':'Agents','attributes':['id',_0x25b1('0x30'),_0x25b1('0x80'),'voicePause','interface'],'raw':!![]}]})[_0x25b1('0x29')](function(_0x96a1b0){if(_0x96a1b0){_0x310a32=_0x96a1b0;var _0x2db4a9=_[_0x25b1('0x81')](_0x96a1b0,function(_0x58e166){var _0x4c6181=_0x58e166['get']({'plain':!![]});return _0x4c6181[_0x25b1('0x82')];});return db[_0x25b1('0x46')][_0x25b1('0x4e')]({'where':{'id':_0x3496a9['params']['id']}})['then'](function(_0x16702d){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x55f740){return _0x16702d[_0x25b1('0x83')](_0x3038be,{'transaction':_0x55f740})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x310a32,function(_0x2da0d9){return db[_0x25b1('0x85')][_0x25b1('0x86')]({'TeamId':_0x2da0d9['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},{'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x2db4a9,function(_0x5c515b){return db[_0x25b1('0x87')][_0x25b1('0x88')]({'where':{'UserId':_0x5c515b['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){_0x2db4a9[_0x25b1('0x89')](function(_0x3c8c4e){socket[_0x25b1('0x77')]('userVoicePrefix:save',{'UserId':_0x3c8c4e['id'],'VoicePrefixId':_0x16702d['id']});});});});});}})[_0x25b1('0x29')](respondWithStatusCode(_0x30f1e9,null))['catch'](handleError(_0x30f1e9,null));};exports[_0x25b1('0x8a')]=function(_0x469405,_0x1010c4,_0x22d3e4){return db['Team']['findAll']({'where':{'id':_0x469405[_0x25b1('0x37')][_0x25b1('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1010c4,null))[_0x25b1('0x29')](function(_0xd05872){var _0x25c07f=_[_0x25b1('0x32')](_0xd05872,'id');var _0x1041d1=[];var _0x1f1160=[];var _0x29d8fe=squel[_0x25b1('0x8b')]();_0x29d8fe[_0x25b1('0x8c')](_0x25b1('0x8d'))[_0x25b1('0x8e')](_0x25b1('0x8f'),'tq')['join'](_0x25b1('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x25b1('0x40')](_0x25b1('0x91'),_0x469405[_0x25b1('0x4f')]['id']);for(var _0x1354c3=0x0;_0x1354c3<_0xd05872[_0x25b1('0x3b')];_0x1354c3+=0x1){let _0x3ccdab=_0xd05872[_0x1354c3];for(var _0x381a62=0x0;_0x381a62<_0x3ccdab[_0x25b1('0x82')]['length'];_0x381a62+=0x1){let _0x330ae7=_0x3ccdab[_0x25b1('0x82')][_0x381a62];var _0xbe6572=_0x29d8fe[_0x25b1('0x92')]();_0xbe6572[_0x25b1('0x40')](_0x25b1('0x93'),_0x330ae7['id']);_0x1f1160[_0x25b1('0x6d')](db['sequelize'][_0x25b1('0x37')](_0xbe6572[_0x25b1('0x94')](),{'type':db[_0x25b1('0x52')][_0x25b1('0x95')][_0x25b1('0x96')]})['then'](function(_0x4edb48){if(_0x4edb48[_0x25b1('0x3b')]===0x1){return _0x330ae7['id'];}else{var _0x2e924b=_['every'](_['map'](_0x4edb48,_0x25b1('0x97')),function(_0x16d969){return _[_0x25b1('0x98')](_0x25c07f,_0x16d969);});if(_0x2e924b){return _0x330ae7['id'];}}}));}}return BPromise[_0x25b1('0x99')](_0x1f1160)[_0x25b1('0x29')](function(_0x3128bd){_0x1041d1=_(_0x1041d1)[_0x25b1('0x9a')](_0x3128bd)[_0x25b1('0x9b')]()['value']();return db[_0x25b1('0x46')]['find']({'where':{'id':_0x469405['params']['id']}})[_0x25b1('0x29')](function(_0x4cf3e6){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x2c0147){return _0x4cf3e6[_0x25b1('0x8a')](_0x469405[_0x25b1('0x37')][_0x25b1('0x75')],{'transaction':_0x2c0147})[_0x25b1('0x29')](function(){if(!_['isEmpty'](_0x1041d1)){return _0x4cf3e6[_0x25b1('0x79')](_0x1041d1,{'transaction':_0x2c0147});}})[_0x25b1('0x29')](function(){_0x1041d1[_0x25b1('0x89')](function(_0x220f92){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':_0x220f92,'VoicePrefixId':_0x4cf3e6['id']});});});});});});})[_0x25b1('0x29')](respondWithStatusCode(_0x1010c4,null))[_0x25b1('0x4b')](handleError(_0x1010c4,null));}; \ No newline at end of file +var _0x32b6=['request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','type','merge','options','includeAll','include','rows','params','find','catch','describe','create','sequelize','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','exten','system','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','nolimit','getTeams','hasOwnProperty','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','from','team_has_voice_prefixes','join','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','eml-format','rimraf','fast-json-patch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32b6,0x1d1));var _0x632b=function(_0xf63e37,_0x52cd28){_0xf63e37=_0xf63e37-0x0;var _0x22c67c=_0x32b6[_0xf63e37];return _0x22c67c;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];config[_0x632b('0x18')]=_[_0x632b('0x19')](config[_0x632b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0x1a'))(new Redis(config[_0x632b('0x18')]));require(_0x632b('0x1b'))['register'](socket);function respondWithStatusCode(_0x721883,_0x1a3a60){_0x1a3a60=_0x1a3a60||0xcc;return function(_0x108249){if(_0x108249){return _0x721883[_0x632b('0x1c')](_0x1a3a60);}return _0x721883[_0x632b('0x1d')](_0x1a3a60)[_0x632b('0x1e')]();};}function respondWithResult(_0x4efe39,_0x17ddc5){_0x17ddc5=_0x17ddc5||0xc8;return function(_0x52f353){if(_0x52f353){return _0x4efe39['status'](_0x17ddc5)[_0x632b('0x1f')](_0x52f353);}};}function respondWithFilteredResult(_0x5afa1e,_0x2c8340){return function(_0x3bb27f){if(_0x3bb27f){var _0x28c472=typeof _0x2c8340['offset']===_0x632b('0x20')&&typeof _0x2c8340[_0x632b('0x21')]===_0x632b('0x20');var _0x3683e4=_0x3bb27f['count'];var _0x472e34=_0x28c472?0x0:_0x2c8340[_0x632b('0x22')];var _0x4f377f=_0x28c472?_0x3bb27f[_0x632b('0x23')]:_0x2c8340['offset']+_0x2c8340['limit'];var _0x1b1092;if(_0x4f377f>=_0x3683e4){_0x4f377f=_0x3683e4;_0x1b1092=0xc8;}else{_0x1b1092=0xce;}_0x5afa1e['status'](_0x1b1092);return _0x5afa1e[_0x632b('0x24')](_0x632b('0x25'),_0x472e34+'-'+_0x4f377f+'/'+_0x3683e4)[_0x632b('0x1f')](_0x3bb27f);}return null;};}function patchUpdates(_0x540bfb){return function(_0x10fc32){try{jsonpatch[_0x632b('0x26')](_0x10fc32,_0x540bfb,!![]);}catch(_0x59d83a){return BPromise[_0x632b('0x27')](_0x59d83a);}return _0x10fc32[_0x632b('0x28')]();};}function saveUpdates(_0x30ffb9,_0x1e448c){return function(_0x45d017){if(_0x45d017){return _0x45d017[_0x632b('0x29')](_0x30ffb9)['then'](function(_0x5e7b20){return _0x5e7b20;});}return null;};}function removeEntity(_0x11fe61,_0x4d3a70){return function(_0x4ebd26){if(_0x4ebd26){return _0x4ebd26[_0x632b('0x2a')]()['then'](function(){var _0x273e89=_0x4ebd26[_0x632b('0x2b')]({'plain':!![]});var _0x29d9aa=_0x632b('0x2c');return db[_0x632b('0x2d')][_0x632b('0x2a')]({'where':{'type':_0x29d9aa,'resourceId':_0x273e89['id']}})[_0x632b('0x2e')](function(){return _0x4ebd26;});})[_0x632b('0x2e')](function(){_0x11fe61[_0x632b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb484,_0x35348e){return function(_0x1819fa){if(!_0x1819fa){_0x1bb484[_0x632b('0x1c')](0x194);}return _0x1819fa;};}function handleError(_0x17a5ba,_0x2a34fa){_0x2a34fa=_0x2a34fa||0x1f4;return function(_0x3c5dc9){logger[_0x632b('0x2f')](_0x3c5dc9[_0x632b('0x30')]);if(_0x3c5dc9[_0x632b('0x31')]){delete _0x3c5dc9[_0x632b('0x31')];}_0x17a5ba[_0x632b('0x1d')](_0x2a34fa)[_0x632b('0x32')](_0x3c5dc9);};}exports[_0x632b('0x33')]=function(_0x227497,_0x3dff99){var _0x18efab={},_0x36936d={},_0x3f3dc4={'count':0x0,'rows':[]};var _0x12f00=_['map'](db[_0x632b('0x34')][_0x632b('0x35')],function(_0x397f36){return{'name':_0x397f36[_0x632b('0x36')],'type':_0x397f36['type'][_0x632b('0x37')]};});_0x36936d['model']=_[_0x632b('0x38')](_0x12f00,_0x632b('0x31'));_0x36936d['query']=_[_0x632b('0x39')](_0x227497[_0x632b('0x3a')]);_0x36936d[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x36936d[_0x632b('0x3d')],_0x36936d[_0x632b('0x3a')]);_0x18efab[_0x632b('0x3e')]=_[_0x632b('0x3c')](_0x36936d['model'],qs['fields'](_0x227497[_0x632b('0x3a')][_0x632b('0x3f')]));_0x18efab[_0x632b('0x3e')]=_0x18efab[_0x632b('0x3e')][_0x632b('0x40')]?_0x18efab[_0x632b('0x3e')]:_0x36936d[_0x632b('0x3d')];if(!_0x227497[_0x632b('0x3a')]['hasOwnProperty']('nolimit')){_0x18efab[_0x632b('0x21')]=qs['limit'](_0x227497[_0x632b('0x3a')][_0x632b('0x21')]);_0x18efab[_0x632b('0x22')]=qs[_0x632b('0x22')](_0x227497[_0x632b('0x3a')][_0x632b('0x22')]);}_0x18efab[_0x632b('0x41')]=qs[_0x632b('0x42')](_0x227497[_0x632b('0x3a')][_0x632b('0x42')]);_0x18efab[_0x632b('0x43')]=qs[_0x632b('0x3b')](_[_0x632b('0x44')](_0x227497[_0x632b('0x3a')],_0x36936d[_0x632b('0x3b')]),_0x12f00);if(_0x227497[_0x632b('0x3a')][_0x632b('0x45')]){_0x18efab['where']=_['merge'](_0x18efab['where'],{'$or':_['map'](_0x12f00,function(_0x57f099){if(_0x57f099[_0x632b('0x46')]!=='VIRTUAL'){var _0x5529cb={};_0x5529cb[_0x57f099['name']]={'$like':'%'+_0x227497[_0x632b('0x3a')][_0x632b('0x45')]+'%'};return _0x5529cb;}})});}_0x18efab=_[_0x632b('0x47')]({},_0x18efab,_0x227497[_0x632b('0x48')]);var _0x5a1017={'where':_0x18efab[_0x632b('0x43')]};return db[_0x632b('0x34')][_0x632b('0x23')](_0x5a1017)['then'](function(_0x15bb30){_0x3f3dc4[_0x632b('0x23')]=_0x15bb30;if(_0x227497[_0x632b('0x3a')][_0x632b('0x49')]){_0x18efab[_0x632b('0x4a')]=[{'all':!![]}];}return db[_0x632b('0x34')]['findAll'](_0x18efab);})[_0x632b('0x2e')](function(_0x2b90c8){_0x3f3dc4[_0x632b('0x4b')]=_0x2b90c8;return _0x3f3dc4;})[_0x632b('0x2e')](respondWithFilteredResult(_0x3dff99,_0x18efab))['catch'](handleError(_0x3dff99,null));};exports['show']=function(_0x39b17c,_0x26b35b){var _0x70ddc9={'raw':![],'where':{'id':_0x39b17c[_0x632b('0x4c')]['id']}},_0x3566e7={};_0x3566e7[_0x632b('0x3d')]=_['keys'](db[_0x632b('0x34')][_0x632b('0x35')]);_0x3566e7[_0x632b('0x3a')]=_[_0x632b('0x39')](_0x39b17c[_0x632b('0x3a')]);_0x3566e7[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x3566e7[_0x632b('0x3d')],_0x3566e7['query']);_0x70ddc9[_0x632b('0x3e')]=_['intersection'](_0x3566e7[_0x632b('0x3d')],qs['fields'](_0x39b17c[_0x632b('0x3a')][_0x632b('0x3f')]));_0x70ddc9[_0x632b('0x3e')]=_0x70ddc9[_0x632b('0x3e')][_0x632b('0x40')]?_0x70ddc9['attributes']:_0x3566e7[_0x632b('0x3d')];if(_0x39b17c[_0x632b('0x3a')][_0x632b('0x49')]){_0x70ddc9['include']=[{'all':!![]}];}_0x70ddc9=_[_0x632b('0x47')]({},_0x70ddc9,_0x39b17c[_0x632b('0x48')]);return db[_0x632b('0x34')][_0x632b('0x4d')](_0x70ddc9)[_0x632b('0x2e')](handleEntityNotFound(_0x26b35b,null))['then'](respondWithResult(_0x26b35b,null))[_0x632b('0x4e')](handleError(_0x26b35b,null));};exports['destroy']=function(_0x33da2b,_0x369cdc){return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x33da2b[_0x632b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x369cdc,null))['then'](removeEntity(_0x369cdc,null))[_0x632b('0x4e')](handleError(_0x369cdc,null));};exports[_0x632b('0x4f')]=function(_0x3ad524,_0xdc6242){return db[_0x632b('0x34')][_0x632b('0x4f')]()['then'](respondWithResult(_0xdc6242,null))[_0x632b('0x4e')](handleError(_0xdc6242,null));};exports[_0x632b('0x50')]=function(_0x3ff81c,_0x4dc021){var _0x33e428;return db[_0x632b('0x51')][_0x632b('0x52')](function(_0x1a79fa){return db['VoicePrefix'][_0x632b('0x50')](_0x3ff81c[_0x632b('0x53')],{'transaction':_0x1a79fa})[_0x632b('0x2e')](function(_0x92884f){_0x33e428=_0x92884f[_0x632b('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x632b('0x4d')]({'where':{'id':_0x33e428[_0x632b('0x54')]},'raw':!![]})[_0x632b('0x2e')](function(_0x36a7c5){return createVoicePrefixExtensions(_0x33e428,_0x36a7c5,_0x1a79fa);});});})[_0x632b('0x2e')](function(){var _0x5d1d05=_0x3ff81c[_0x632b('0x55')][_0x632b('0x2b')]({'plain':!![]});if(!_0x5d1d05)throw new Error(_0x632b('0x56'));if(_0x5d1d05[_0x632b('0x57')]===_0x632b('0x55')){var _0x9accea=_0x33e428;return db[_0x632b('0x58')][_0x632b('0x4d')]({'where':{'name':_0x632b('0x2c'),'userProfileId':_0x5d1d05[_0x632b('0x59')]},'raw':!![]})[_0x632b('0x2e')](function(_0x5ca000){if(_0x5ca000&&_0x5ca000[_0x632b('0x5a')]===0x0){return db[_0x632b('0x2d')][_0x632b('0x50')]({'name':_0x9accea[_0x632b('0x31')],'resourceId':_0x9accea['id'],'type':_0x5ca000[_0x632b('0x31')],'sectionId':_0x5ca000['id']},{})['then'](function(){return _0x33e428;});}else{return _0x33e428;}})[_0x632b('0x4e')](function(_0x2239ec){logger[_0x632b('0x2f')](_0x632b('0x5b'),_0x2239ec);throw _0x2239ec;});}return _0x33e428;})[_0x632b('0x2e')](respondWithResult(_0x4dc021,null))[_0x632b('0x4e')](handleError(_0x4dc021,null));};function Extension(_0x3e14d0,_0x4ffa35,_0x14ee44,_0x4b7307){this[_0x632b('0x5c')]='from-sip';this[_0x632b('0x5d')]=_0x3e14d0;this['app']=_0x14ee44;this[_0x632b('0x46')]=_0x632b('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0x632b('0x5f')]=_0x4ffa35;this[_0x632b('0x60')]=_0x4b7307;}function createVoicePrefixExtensions(_0x1618b3,_0xbbaf46,_0x52eed9){return new BPromise(function(_0x1420d9,_0x20672b){var _0x5abf95=new Extension(formatPrefixName(_0x1618b3[_0x632b('0x61')]),0x1,'NoOp',_0x632b('0x62'));_0x5abf95[_0x632b('0x63')]=_0x1618b3['id'];return db['VoiceExtension'][_0x632b('0x50')](_0x5abf95,{'transaction':_0x52eed9})[_0x632b('0x2e')](function(_0x32cc27){var _0x1bf6f4=_0x32cc27['get']({'plain':!![]});var _0x2711d5=_[_0x632b('0x38')](addVoicePrefixExtensions(_0x1618b3,_0xbbaf46),function(_0x3d1ac3){_0x3d1ac3[_0x632b('0x54')]=_0x1bf6f4['id'];_0x3d1ac3['VoicePrefixId']=_0x1618b3['id'];return _0x3d1ac3;});return db[_0x632b('0x64')][_0x632b('0x65')](_0x2711d5,{'transaction':_0x52eed9})[_0x632b('0x2e')](function(_0x3fd888){if(!_0x3fd888){return _0x20672b(_0x632b('0x66'));}else{return _0x1420d9(_0x3fd888);}})[_0x632b('0x4e')](function(_0x5c614e){return _0x20672b(_0x5c614e);});});;});};function addVoicePrefixExtensions(_0x132223,_0x83d8f9){var _0x307132=[];var _0x5b0c6d=formatPrefixName(_0x132223['prefix']);_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x2,_0x632b('0x68'),_0x632b('0x69')+_0x132223[_0x632b('0x31')]));if(_0x132223[_0x632b('0x6a')]){_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x3,_0x632b('0x68'),'PREFIX-CALLERIDALL='+_0x132223[_0x632b('0x6a')]));}else{_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x3,_0x632b('0x6b'),_0x632b('0x6c')));}_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x4,_0x632b('0x6d'),_0x83d8f9['context']+','+_0x632b('0x6e')+(0x8+_0x132223[_0x632b('0x31')][_0x632b('0x40')])+'}'+','+0x1));return _0x307132;}function formatPrefixName(_0x14b55f){var _0x51cb45='_';for(var _0x3a3f80=0x0;_0x3a3f80<_0x14b55f[_0x632b('0x40')];_0x3a3f80++){if(_0x14b55f[_0x632b('0x6f')](_0x3a3f80)=='-'){_0x51cb45+=_0x14b55f['charAt'](_0x3a3f80);}else{_0x51cb45+='['+_0x14b55f[_0x632b('0x6f')](_0x3a3f80)+']';}}_0x51cb45+='.';return _0x51cb45;}exports[_0x632b('0x29')]=function(_0x3aa6ca,_0x26f891,_0x225d81){var _0x4599fc=_0x3aa6ca['body'];_0x4599fc[_0x632b('0x61')]=_0x632b('0x70')+_0x4599fc['name']+'-';return db['sequelize']['transaction'](function(_0x3605b6){return db[_0x632b('0x34')][_0x632b('0x29')](_0x4599fc,{'where':{'id':_0x4599fc['id']},'transaction':_0x3605b6})[_0x632b('0x2e')](function(){return db[_0x632b('0x64')]['destroy']({'where':{'VoicePrefixId':_0x4599fc['id']},'transaction':_0x3605b6})['then'](function(){return db[_0x632b('0x64')][_0x632b('0x4d')]({'where':{'id':_0x4599fc['VoiceExtensionId']},'raw':!![]})['then'](function(_0x11cc11){return createVoicePrefixExtensions(_0x4599fc,_0x11cc11,_0x3605b6);});});});})[_0x632b('0x2e')](function(){return db['VoicePrefix'][_0x632b('0x71')](_0x4599fc['id']);})[_0x632b('0x2e')](respondWithResult(_0x26f891,null))[_0x632b('0x4e')](handleError(_0x26f891,null));};exports['addAgents']=function(_0x495a99,_0x563cfa,_0x2ff526){return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x495a99['params']['id']}})['then'](handleEntityNotFound(_0x563cfa,null))['then'](function(_0x38190c){if(_0x38190c){return _0x38190c['addAgents'](_0x495a99[_0x632b('0x53')][_0x632b('0x72')],_[_0x632b('0x73')](_0x495a99[_0x632b('0x53')],[_0x632b('0x72'),'id'])||{})[_0x632b('0x74')](function(_0xa87c08){for(var _0x360796=0x0;_0x360796<_0x495a99[_0x632b('0x53')][_0x632b('0x72')]['length'];_0x360796+=0x1){socket['emit'](_0x632b('0x75'),{'UserId':Number(_0x495a99['body'][_0x632b('0x72')][_0x360796]),'VoicePrefixId':Number(_0x495a99[_0x632b('0x4c')]['id'])});}return _0xa87c08;});}})[_0x632b('0x2e')](respondWithResult(_0x563cfa,null))[_0x632b('0x4e')](handleError(_0x563cfa,null));};exports['removeAgents']=function(_0x2a3d8f,_0x4febe2,_0x57edcb){return db['VoicePrefix'][_0x632b('0x4d')]({'where':{'id':_0x2a3d8f['params']['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x4febe2,null))[_0x632b('0x2e')](function(_0x48ccd3){if(_0x48ccd3){return _0x48ccd3[_0x632b('0x76')](_0x2a3d8f[_0x632b('0x3a')]['ids'])['then'](function(){if(_[_0x632b('0x77')](_0x2a3d8f[_0x632b('0x3a')][_0x632b('0x72')])){for(var _0xff7d0b=0x0;_0xff7d0b<_0x2a3d8f[_0x632b('0x3a')][_0x632b('0x72')][_0x632b('0x40')];_0xff7d0b+=0x1){socket['emit'](_0x632b('0x78'),{'UserId':Number(_0x2a3d8f[_0x632b('0x3a')]['ids'][_0xff7d0b]),'VoicePrefixId':Number(_0x2a3d8f['params']['id'])});}}else{socket[_0x632b('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x2a3d8f['query'][_0x632b('0x72')]),'VoicePrefixId':Number(_0x2a3d8f['params']['id'])});}});}})[_0x632b('0x2e')](respondWithStatusCode(_0x4febe2,null))['catch'](handleError(_0x4febe2,null));};exports[_0x632b('0x7a')]=function(_0x590e68,_0x4393e9,_0x3669d9){var _0x57a2a6={};var _0x10c901={};var _0x64f45a;var _0x1e07da;return db[_0x632b('0x34')][_0x632b('0x7b')]({'where':{'id':_0x590e68[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x4393e9,null))[_0x632b('0x2e')](function(_0x5a90f7){if(_0x5a90f7){_0x64f45a=_0x5a90f7;_0x10c901['model']=_[_0x632b('0x39')](db[_0x632b('0x7c')][_0x632b('0x35')]);_0x10c901[_0x632b('0x3a')]=_[_0x632b('0x39')](_0x590e68[_0x632b('0x3a')]);_0x10c901['filters']=_[_0x632b('0x3c')](_0x10c901['model'],_0x10c901[_0x632b('0x3a')]);_0x57a2a6['attributes']=_[_0x632b('0x3c')](_0x10c901[_0x632b('0x3d')],qs[_0x632b('0x3f')](_0x590e68[_0x632b('0x3a')]['fields']));_0x57a2a6[_0x632b('0x3e')]=_0x57a2a6[_0x632b('0x3e')]['length']?_0x57a2a6[_0x632b('0x3e')]:_0x10c901[_0x632b('0x3d')];_0x57a2a6[_0x632b('0x41')]=qs[_0x632b('0x42')](_0x590e68[_0x632b('0x3a')]['sort']);_0x57a2a6[_0x632b('0x43')]=qs[_0x632b('0x3b')](_['pick'](_0x590e68[_0x632b('0x3a')],_0x10c901['filters']));if(_0x590e68[_0x632b('0x3a')]['filter']){_0x57a2a6[_0x632b('0x43')]=_['merge'](_0x57a2a6[_0x632b('0x43')],{'$or':_[_0x632b('0x38')](_0x57a2a6[_0x632b('0x3e')],function(_0x1f5d21){var _0x405b3c={};_0x405b3c[_0x1f5d21]={'$like':'%'+_0x590e68['query'][_0x632b('0x45')]+'%'};return _0x405b3c;})});}_0x57a2a6=_[_0x632b('0x47')]({},_0x57a2a6,_0x590e68['options']);return _0x64f45a[_0x632b('0x7a')](_0x57a2a6);}})['then'](function(_0x1bbb23){if(_0x1bbb23){_0x1e07da=_0x1bbb23['length'];if(!_0x590e68[_0x632b('0x3a')]['hasOwnProperty'](_0x632b('0x7d'))){_0x57a2a6[_0x632b('0x21')]=qs[_0x632b('0x21')](_0x590e68['query'][_0x632b('0x21')]);_0x57a2a6[_0x632b('0x22')]=qs[_0x632b('0x22')](_0x590e68[_0x632b('0x3a')][_0x632b('0x22')]);}return _0x64f45a[_0x632b('0x7a')](_0x57a2a6);}})[_0x632b('0x2e')](function(_0x31eee9){if(_0x31eee9){return _0x31eee9?{'count':_0x1e07da,'rows':_0x31eee9}:null;}})[_0x632b('0x2e')](respondWithResult(_0x4393e9,null))[_0x632b('0x4e')](handleError(_0x4393e9,null));};exports[_0x632b('0x7e')]=function(_0xf1a293,_0x1fcb2a,_0x55c36d){var _0x23385d={};var _0x376112={};var _0x1e6905;var _0x3293be;return db[_0x632b('0x34')][_0x632b('0x7b')]({'where':{'id':_0xf1a293[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x1fcb2a,null))[_0x632b('0x2e')](function(_0x40fb13){if(_0x40fb13){_0x1e6905=_0x40fb13;_0x376112[_0x632b('0x3d')]=_[_0x632b('0x39')](db['Team'][_0x632b('0x35')]);_0x376112[_0x632b('0x3a')]=_[_0x632b('0x39')](_0xf1a293[_0x632b('0x3a')]);_0x376112[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x376112[_0x632b('0x3d')],_0x376112[_0x632b('0x3a')]);_0x23385d['attributes']=_[_0x632b('0x3c')](_0x376112[_0x632b('0x3d')],qs[_0x632b('0x3f')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x3f')]));_0x23385d[_0x632b('0x3e')]=_0x23385d[_0x632b('0x3e')][_0x632b('0x40')]?_0x23385d[_0x632b('0x3e')]:_0x376112['model'];_0x23385d[_0x632b('0x41')]=qs[_0x632b('0x42')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x42')]);_0x23385d[_0x632b('0x43')]=qs[_0x632b('0x3b')](_['pick'](_0xf1a293[_0x632b('0x3a')],_0x376112[_0x632b('0x3b')]));if(_0xf1a293[_0x632b('0x3a')]['filter']){_0x23385d['where']=_[_0x632b('0x47')](_0x23385d[_0x632b('0x43')],{'$or':_[_0x632b('0x38')](_0x23385d[_0x632b('0x3e')],function(_0x16c798){var _0x384439={};_0x384439[_0x16c798]={'$like':'%'+_0xf1a293[_0x632b('0x3a')]['filter']+'%'};return _0x384439;})});}_0x23385d=_[_0x632b('0x47')]({},_0x23385d,_0xf1a293['options']);return _0x1e6905[_0x632b('0x7e')](_0x23385d);}})['then'](function(_0x4d3bb7){if(_0x4d3bb7){_0x3293be=_0x4d3bb7[_0x632b('0x40')];if(!_0xf1a293[_0x632b('0x3a')][_0x632b('0x7f')]('nolimit')){_0x23385d['limit']=qs[_0x632b('0x21')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x21')]);_0x23385d['offset']=qs['offset'](_0xf1a293[_0x632b('0x3a')][_0x632b('0x22')]);}return _0x1e6905[_0x632b('0x7e')](_0x23385d);}})[_0x632b('0x2e')](function(_0x66cbf3){if(_0x66cbf3){return _0x66cbf3?{'count':_0x3293be,'rows':_0x66cbf3}:null;}})[_0x632b('0x2e')](respondWithResult(_0x1fcb2a,null))['catch'](handleError(_0x1fcb2a,null));};exports[_0x632b('0x80')]=function(_0x352ba8,_0x3b7be7,_0x32facd){var _0x366643=_0x352ba8[_0x632b('0x53')]['ids'];var _0x5db842;return db[_0x632b('0x81')][_0x632b('0x82')]({'where':{'id':_0x366643},'attributes':['id'],'include':[{'model':db['User'],'as':_0x632b('0x83'),'attributes':['id',_0x632b('0x31'),_0x632b('0x84'),_0x632b('0x85'),_0x632b('0x86')],'raw':!![]}]})[_0x632b('0x2e')](function(_0x17bfa2){if(_0x17bfa2){_0x5db842=_0x17bfa2;var _0x28b626=_['flatMap'](_0x17bfa2,function(_0x4ce406){var _0x1b274d=_0x4ce406[_0x632b('0x2b')]({'plain':!![]});return _0x1b274d['Agents'];});return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x352ba8[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](function(_0x36564e){return db['sequelize']['transaction'](function(_0x824140){return _0x36564e[_0x632b('0x80')](_0x366643,{'transaction':_0x824140})[_0x632b('0x2e')](function(){return BPromise[_0x632b('0x87')](_0x5db842,function(_0x214851){return db[_0x632b('0x88')]['upsert']({'TeamId':_0x214851['id'],'VoicePrefixId':_0x352ba8[_0x632b('0x4c')]['id']},{'transaction':_0x824140});});})['then'](function(){return BPromise[_0x632b('0x87')](_0x28b626,function(_0x26e1a9){return db[_0x632b('0x89')][_0x632b('0x8a')]({'where':{'UserId':_0x26e1a9['id'],'VoicePrefixId':_0x352ba8[_0x632b('0x4c')]['id']},'transaction':_0x824140});});})[_0x632b('0x2e')](function(){_0x28b626[_0x632b('0x8b')](function(_0x19d11e){socket[_0x632b('0x79')](_0x632b('0x75'),{'UserId':_0x19d11e['id'],'VoicePrefixId':_0x36564e['id']});});});});});}})['then'](respondWithStatusCode(_0x3b7be7,null))[_0x632b('0x4e')](handleError(_0x3b7be7,null));};exports[_0x632b('0x8c')]=function(_0x36244e,_0x1cc52f,_0x5cd2b7){return db[_0x632b('0x81')][_0x632b('0x82')]({'where':{'id':_0x36244e['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x632b('0x83'),'attributes':['id'],'raw':!![]}]})[_0x632b('0x2e')](handleEntityNotFound(_0x1cc52f,null))[_0x632b('0x2e')](function(_0x2a45f3){var _0x56d205=_[_0x632b('0x38')](_0x2a45f3,'id');var _0x392b6b=[];var _0x1cfc20=[];var _0x5bd1bb=squel[_0x632b('0x8d')]();_0x5bd1bb['field']('tq.TeamId')[_0x632b('0x8e')](_0x632b('0x8f'),'tq')[_0x632b('0x90')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x632b('0x91'),_0x36244e[_0x632b('0x4c')]['id']);for(var _0x2d0712=0x0;_0x2d0712<_0x2a45f3['length'];_0x2d0712+=0x1){let _0x1f9cb4=_0x2a45f3[_0x2d0712];for(var _0x90b25c=0x0;_0x90b25c<_0x1f9cb4[_0x632b('0x83')][_0x632b('0x40')];_0x90b25c+=0x1){let _0x163ad2=_0x1f9cb4['Agents'][_0x90b25c];var _0x21af7a=_0x5bd1bb['clone']();_0x21af7a['where'](_0x632b('0x92'),_0x163ad2['id']);_0x1cfc20[_0x632b('0x67')](db['sequelize']['query'](_0x21af7a[_0x632b('0x93')](),{'type':db[_0x632b('0x51')][_0x632b('0x94')]['SELECT']})[_0x632b('0x2e')](function(_0x53c0c4){if(_0x53c0c4['length']===0x1){return _0x163ad2['id'];}else{var _0x112ecc=_[_0x632b('0x95')](_[_0x632b('0x38')](_0x53c0c4,_0x632b('0x96')),function(_0x4e5523){return _[_0x632b('0x97')](_0x56d205,_0x4e5523);});if(_0x112ecc){return _0x163ad2['id'];}}}));}}return BPromise[_0x632b('0x98')](_0x1cfc20)[_0x632b('0x2e')](function(_0x350a1b){_0x392b6b=_(_0x392b6b)[_0x632b('0x99')](_0x350a1b)[_0x632b('0x9a')]()['value']();return db[_0x632b('0x34')]['find']({'where':{'id':_0x36244e[_0x632b('0x4c')]['id']}})['then'](function(_0x460dce){return db[_0x632b('0x51')][_0x632b('0x52')](function(_0x2c88a){return _0x460dce[_0x632b('0x8c')](_0x36244e[_0x632b('0x3a')][_0x632b('0x72')],{'transaction':_0x2c88a})[_0x632b('0x2e')](function(){if(!_[_0x632b('0x9b')](_0x392b6b)){return _0x460dce[_0x632b('0x76')](_0x392b6b,{'transaction':_0x2c88a});}})[_0x632b('0x2e')](function(){_0x392b6b[_0x632b('0x8b')](function(_0x3784d2){socket[_0x632b('0x79')](_0x632b('0x78'),{'UserId':_0x3784d2,'VoicePrefixId':_0x460dce['id']});});});});});});})['then'](respondWithStatusCode(_0x1cc52f,null))[_0x632b('0x4e')](handleError(_0x1cc52f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index daf1450..62b8be7 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 _0x17ff=['update','remove','emit','hasOwnProperty','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x17ff,0xdc));var _0xf17f=function(_0x20bd8c,_0x4c694b){_0x20bd8c=_0x20bd8c-0x0;var _0x3450cd=_0x17ff[_0x20bd8c];return _0x3450cd;};'use strict';var EventEmitter=require(_0xf17f('0x0'));var VoicePrefix=require(_0xf17f('0x1'))['db'][_0xf17f('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf17f('0x3')](0x0);var events={'afterCreate':_0xf17f('0x4'),'afterUpdate':_0xf17f('0x5'),'afterDestroy':_0xf17f('0x6')};function emitEvent(_0x274ed7){return function(_0x4992d9,_0x265a11,_0x503172){VoicePrefixEvents[_0xf17f('0x7')](_0x274ed7+':'+_0x4992d9['id'],_0x4992d9);VoicePrefixEvents[_0xf17f('0x7')](_0x274ed7,_0x4992d9);_0x503172(null);};}for(var e in events){if(events[_0xf17f('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x7049=['events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7049,0x105));var _0x9704=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x7049[_0x55abd9];return _0x3e5669;};'use strict';var EventEmitter=require(_0x9704('0x0'));var VoicePrefix=require(_0x9704('0x1'))['db'][_0x9704('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9704('0x3')](0x0);var events={'afterCreate':_0x9704('0x4'),'afterUpdate':_0x9704('0x5'),'afterDestroy':'remove'};function emitEvent(_0x23c4a0){return function(_0x38b854,_0x3920ab,_0xacae22){VoicePrefixEvents[_0x9704('0x6')](_0x23c4a0+':'+_0x38b854['id'],_0x38b854);VoicePrefixEvents[_0x9704('0x6')](_0x23c4a0,_0x38b854);_0xacae22(null);};}for(var e in events){if(events[_0x9704('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9704('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 994ab4d..845bf2b 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 _0x6055=['exports','define','VoicePrefix','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x477eb2,_0x55530f){var _0x16358c=function(_0x20fe77){while(--_0x20fe77){_0x477eb2['push'](_0x477eb2['shift']());}};_0x16358c(++_0x55530f);}(_0x6055,0x18f));var _0x5605=function(_0x1e9dfa,_0x57e00f){_0x1e9dfa=_0x1e9dfa-0x0;var _0x3362df=_0x6055[_0x1e9dfa];return _0x3362df;};'use strict';var _=require('lodash');var util=require(_0x5605('0x0'));var logger=require(_0x5605('0x1'))(_0x5605('0x2'));var moment=require('moment');var BPromise=require(_0x5605('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x4'));var rimraf=require(_0x5605('0x5'));var config=require(_0x5605('0x6'));var attributes=require(_0x5605('0x7'));module[_0x5605('0x8')]=function(_0x2bc36b,_0x13a19f){return _0x2bc36b[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa84=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xfa84,0x1bf));var _0x4fa8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfa84[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4fa8('0x0'));var util=require(_0x4fa8('0x1'));var logger=require(_0x4fa8('0x2'))(_0x4fa8('0x3'));var moment=require(_0x4fa8('0x4'));var BPromise=require(_0x4fa8('0x5'));var rp=require(_0x4fa8('0x6'));var fs=require('fs');var path=require(_0x4fa8('0x7'));var rimraf=require(_0x4fa8('0x8'));var config=require(_0x4fa8('0x9'));var attributes=require(_0x4fa8('0xa'));module[_0x4fa8('0xb')]=function(_0x28a5fc,_0x5ccbe6){return _0x28a5fc[_0x4fa8('0xc')](_0x4fa8('0xd'),attributes,{'tableName':_0x4fa8('0xe'),'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 5b4c045..c10ad35 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 _0x9bb8=['register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x4c3491,_0x15406b){var _0x19bb96=function(_0xa5ef11){while(--_0xa5ef11){_0x4c3491['push'](_0x4c3491['shift']());}};_0x19bb96(++_0x15406b);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var util=require(_0x89bb('0x1'));var moment=require(_0x89bb('0x2'));var BPromise=require(_0x89bb('0x3'));var rs=require(_0x89bb('0x4'));var fs=require('fs');var Redis=require(_0x89bb('0x5'));var db=require(_0x89bb('0x6'))['db'];var utils=require(_0x89bb('0x7'));var logger=require(_0x89bb('0x8'))(_0x89bb('0x9'));var config=require(_0x89bb('0xa'));var jayson=require(_0x89bb('0xb'));var client=jayson['client'][_0x89bb('0xc')]({'port':0x232a});config[_0x89bb('0xd')]=_[_0x89bb('0xe')](config[_0x89bb('0xd')],{'host':_0x89bb('0xf'),'port':0x18eb});var socket=require(_0x89bb('0x10'))(new Redis(config['redis']));require(_0x89bb('0x11'))[_0x89bb('0x12')](socket);function respondWithRpcPromise(_0x4e48a0,_0x9da489,_0x59ce21){return new BPromise(function(_0x31e9e7,_0x56c08e){return client[_0x89bb('0x13')](_0x4e48a0,_0x59ce21)['then'](function(_0x33b1d7){logger[_0x89bb('0x14')](_0x89bb('0x15'),_0x9da489,_0x89bb('0x16'));logger['debug'](_0x89bb('0x17'),_0x9da489,_0x89bb('0x16'),JSON[_0x89bb('0x18')](_0x33b1d7));if(_0x33b1d7[_0x89bb('0x19')]){if(_0x33b1d7['error']['code']===0x1f4){logger[_0x89bb('0x19')](_0x89bb('0x15'),_0x9da489,_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);return _0x56c08e(_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);}logger['error'](_0x89bb('0x15'),_0x9da489,_0x33b1d7[_0x89bb('0x19')]['message']);return _0x31e9e7(_0x33b1d7[_0x89bb('0x19')][_0x89bb('0x1a')]);}else{logger[_0x89bb('0x14')](_0x89bb('0x15'),_0x9da489,_0x89bb('0x16'));_0x31e9e7(_0x33b1d7['result'][_0x89bb('0x1a')]);}})[_0x89bb('0x1b')](function(_0x28c837){logger[_0x89bb('0x19')](_0x89bb('0x15'),_0x9da489,_0x28c837);_0x56c08e(_0x28c837);});});} \ No newline at end of file +var _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x48f38d,_0x19d7ae){var _0x412c0e=function(_0x187e9f){while(--_0x187e9f){_0x48f38d['push'](_0x48f38d['shift']());}};_0x412c0e(++_0x19d7ae);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5a44c7a..1c951d7 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 _0x8efc=['emit','removeListener','register','length','save','remove','update'];(function(_0x3a5a3d,_0x3dd68d){var _0x31ae0a=function(_0x2f23df){while(--_0x2f23df){_0x3a5a3d['push'](_0x3a5a3d['shift']());}};_0x31ae0a(++_0x3dd68d);}(_0x8efc,0xb3));var _0xc8ef=function(_0x2665a3,_0x3bac99){_0x2665a3=_0x2665a3-0x0;var _0x586de6=_0x8efc[_0x2665a3];return _0x586de6;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc8ef('0x0'),_0xc8ef('0x1'),_0xc8ef('0x2')];function createListener(_0x1753d9,_0x517faf){return function(_0x2e2c8f){_0x517faf[_0xc8ef('0x3')](_0x1753d9,_0x2e2c8f);};}function removeListener(_0x33b9c9,_0x50d1f6){return function(){VoicePrefixEvents[_0xc8ef('0x4')](_0x33b9c9,_0x50d1f6);};}exports[_0xc8ef('0x5')]=function(_0x1cd466){for(var _0x13b433=0x0,_0x576ff9=events[_0xc8ef('0x6')];_0x13b433<_0x576ff9;_0x13b433++){var _0x3d06cd=events[_0x13b433];var _0x1c8931=createListener('voicePrefix:'+_0x3d06cd,_0x1cd466);VoicePrefixEvents['on'](_0x3d06cd,_0x1c8931);}}; \ No newline at end of file +var _0x544a=['./voicePrefix.events','save','remove','emit','removeListener','register','voicePrefix:'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x544a,0xbd));var _0xa544=function(_0x305e18,_0x5adc08){_0x305e18=_0x305e18-0x0;var _0xb3fd41=_0x544a[_0x305e18];return _0xb3fd41;};'use strict';var VoicePrefixEvents=require(_0xa544('0x0'));var events=[_0xa544('0x1'),_0xa544('0x2'),'update'];function createListener(_0x544b38,_0x46d7b6){return function(_0x5026f6){_0x46d7b6[_0xa544('0x3')](_0x544b38,_0x5026f6);};}function removeListener(_0xdca212,_0x556528){return function(){VoicePrefixEvents[_0xa544('0x4')](_0xdca212,_0x556528);};}exports[_0xa544('0x5')]=function(_0x2f5992){for(var _0x15a604=0x0,_0x39caac=events['length'];_0x15a604<_0x39caac;_0x15a604++){var _0x407443=events[_0x15a604];var _0x495819=createListener(_0xa544('0x6')+_0x407443,_0x2f5992);VoicePrefixEvents['on'](_0x407443,_0x495819);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0df9a92..d40d1c2 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(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0xb10b,0x12a));var _0xbb10=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xb10b[_0x38841c];return _0x500610;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xb10b[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1315efd..0801c5c 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 _0xd60a=['#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','mandatoryDispositionPauseId','sequelize','exports','STRING','name','outbound','inbound','default','ENUM','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','wrapuptime','BOOLEAN','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x21cc3f,_0x4ac3e5){var _0x1a311c=function(_0x23a048){while(--_0x23a048){_0x21cc3f['push'](_0x21cc3f['shift']());}};_0x1a311c(++_0x4ac3e5);}(_0xd60a,0xa4));var _0xad60=function(_0x578d94,_0x1e0aa0){_0x578d94=_0x578d94-0x0;var _0x2877af=_0xd60a[_0x578d94];return _0x2877af;};'use strict';var Sequelize=require(_0xad60('0x0'));module[_0xad60('0x1')]={'name':{'type':Sequelize[_0xad60('0x2')],'allowNull':![],'unique':_0xad60('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xad60('0x4')),'allowNull':![],'defaultValue':_0xad60('0x5')},'musiconhold':{'type':Sequelize[_0xad60('0x2')],'defaultValue':_0xad60('0x6')},'announce':{'type':Sequelize[_0xad60('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xad60('0x7')]('rr','ringall',_0xad60('0x8'),_0xad60('0x9'),'random',_0xad60('0xa'),_0xad60('0xb'),_0xad60('0xc'),_0xad60('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x33abe6){this[_0xad60('0xe')]('strategy',_0x33abe6?_0x33abe6:'rrmemory');},'get':function(){var _0x270357=this[_0xad60('0xf')]('type');var _0x2afe2a=this[_0xad60('0xf')](_0xad60('0x10'));var _0x5b603a=this[_0xad60('0xf')]('strategy');if(_0x270357===_0xad60('0x4')){if(_0x2afe2a===_0xad60('0x11')){return null;}if(_0x2afe2a===_0xad60('0x12')&&![_0xad60('0xa'),_0xad60('0x13')][_0xad60('0x14')](_0x5b603a)){this[_0xad60('0xe')]('strategy',_0xad60('0xa'));}}return _0x5b603a;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xad60('0x15')](0xb)},'timeout':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xad60('0x2')]},'weight':{'type':Sequelize[_0xad60('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xad60('0x16')},'autopause':{'type':Sequelize['ENUM'](_0xad60('0x16'),'no',_0xad60('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xad60('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xad60('0x7')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xad60('0x7')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xad60('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xad60('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xad60('0x7')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xad60('0x16'),'no'),'defaultValue':_0xad60('0x16')},'announce_holdtime':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no',_0xad60('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xad60('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xad60('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xad60('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xad60('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xad60('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xad60('0x2')]},'queue_quantity1':{'type':Sequelize[_0xad60('0x2')]},'queue_quantity2':{'type':Sequelize[_0xad60('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xad60('0x2')]},'queue_less_than':{'type':Sequelize[_0xad60('0x2')]},'periodic_announce':{'type':Sequelize[_0xad60('0x19')],'set':function(_0x1a2c3c){this[_0xad60('0xe')](_0xad60('0x1a'),_0x1a2c3c?_0x1a2c3c[_0xad60('0x1b')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xad60('0xf')](_0xad60('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xad60('0x2')],'defaultValue':_0xad60('0x16'),'set':function(_0x1662dd){this[_0xad60('0xe')](_0xad60('0x1c'),_0x1662dd?_0x1662dd[_0xad60('0x1b')](','):undefined);},'get':function(){return this[_0xad60('0xf')](_0xad60('0x1c'))?this[_0xad60('0xf')](_0xad60('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x28cc91){this[_0xad60('0xe')]('leavewhenempty',_0x28cc91?_0x28cc91[_0xad60('0x1b')](','):undefined);},'get':function(){return this[_0xad60('0xf')](_0xad60('0x1d'))?this[_0xad60('0xf')](_0xad60('0x1d'))[_0xad60('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xad60('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xad60('0x7')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xad60('0x2')]},'description':{'type':Sequelize[_0xad60('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x124acb){this[_0xad60('0xe')]('acw',_0x124acb);if(_0x124acb){if(this['getDataValue'](_0xad60('0x1f'))<0x2){this[_0xad60('0xe')](_0xad60('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xad60('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xad60('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xad60('0x7')]('preview',_0xad60('0x21'),'power',_0xad60('0x22'),'booked'),'defaultValue':_0xad60('0x21'),'comment':_0xad60('0x23')},'dialLimitChannel':{'type':Sequelize[_0xad60('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xad60('0x15')](0x4)[_0xad60('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xad60('0x25')},'dialPowerLevel':{'type':Sequelize[_0xad60('0x26')](0x2)[_0xad60('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xad60('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x28'),_0xad60('0x29')),'defaultValue':_0xad60('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xad60('0x26')](0x2)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xad60('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xad60('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xad60('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xad60('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xad60('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x2c')},'dialQueueProject':{'type':Sequelize[_0xad60('0x2')],'comment':_0xad60('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xad60('0x33')},'dialTimezone':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xad60('0x2')],'defaultValue':_0xad60('0x34')},'dialPrefix':{'type':Sequelize[_0xad60('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xad60('0x7')](_0xad60('0x35'),'never','onlyIfOpen'),'defaultValue':_0xad60('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xad60('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xad60('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xad60('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xad60('0x15')](0x9)[_0xad60('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xad60('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xad60('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xad60('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad60('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0xad60('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xad60('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xad60('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xad60('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xad60('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xad60('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xad60('0x15')](0x9)[_0xad60('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad60('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xad60('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xad60('0x20')],'defaultValue':0x0,'comment':_0xad60('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xad60('0x3f'),_0xad60('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xad60('0x2')],'comment':_0xad60('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xad60('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xad60('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xad60('0x41')},'dialCutDigit':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)[_0xad60('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xad60('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad60('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xad60('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad60('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad60('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xad60('0x20')],'defaultValue':![],'comment':_0xad60('0x4c'),'set':function(_0x1cec7d){if(!_0x1cec7d)this[_0xad60('0xe')](_0xad60('0x4d'),null);this[_0xad60('0xe')]('mandatoryDisposition',_0x1cec7d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xad60('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xad60('0x15')](0x3)[_0xad60('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xad60('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x4e42=['split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join'];(function(_0xc316e6,_0x4c98f2){var _0x4655ad=function(_0x44b9f0){while(--_0x44b9f0){_0xc316e6['push'](_0xc316e6['shift']());}};_0x4655ad(++_0x4c98f2);}(_0x4e42,0x16f));var _0x24e4=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x4e42[_0x286726];return _0xcd4fe9;};'use strict';var Sequelize=require(_0x24e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x24e4('0x1')],'allowNull':![],'unique':_0x24e4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x4'),_0x24e4('0x5')),'allowNull':![],'defaultValue':_0x24e4('0x4')},'musiconhold':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':_0x24e4('0x6')},'announce':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x24e4('0x3')]('rr',_0x24e4('0x7'),_0x24e4('0x8'),_0x24e4('0x9'),'random',_0x24e4('0xa'),_0x24e4('0xb'),_0x24e4('0xc'),_0x24e4('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x47152b){this[_0x24e4('0xe')](_0x24e4('0xf'),_0x47152b?_0x47152b:_0x24e4('0xa'));},'get':function(){var _0x32e5ea=this[_0x24e4('0x10')](_0x24e4('0x11'));var _0x3eae3d=this[_0x24e4('0x10')]('dialMethod');var _0x19434c=this['getDataValue'](_0x24e4('0xf'));if(_0x32e5ea===_0x24e4('0x5')){if(_0x3eae3d===_0x24e4('0x12')){return null;}if(_0x3eae3d===_0x24e4('0x13')&&![_0x24e4('0xa'),_0x24e4('0x14')][_0x24e4('0x15')](_0x19434c)){this['setDataValue'](_0x24e4('0xf'),'rrmemory');}}return _0x19434c;}},'servicelevel':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x24e4('0x3')]('yes','no'),'defaultValue':_0x24e4('0x17')},'autopause':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x24e4('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x24e4('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x24e4('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x24e4('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x24e4('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x24e4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x24e4('0x3')]('yes','no'),'defaultValue':_0x24e4('0x17')},'announce_holdtime':{'type':Sequelize[_0x24e4('0x3')]('yes','no',_0x24e4('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x24e4('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x24e4('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x24e4('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x24e4('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x24e4('0x1')]},'queue_quantity1':{'type':Sequelize[_0x24e4('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x24e4('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x24e4('0x19')],'set':function(_0x5c131b){this[_0x24e4('0xe')](_0x24e4('0x1a'),_0x5c131b?_0x5c131b[_0x24e4('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0x24e4('0x1a'))?this[_0x24e4('0x10')](_0x24e4('0x1a'))[_0x24e4('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':_0x24e4('0x17'),'set':function(_0x41ffa9){this[_0x24e4('0xe')](_0x24e4('0x1d'),_0x41ffa9?_0x41ffa9[_0x24e4('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x24e4('0x1d'))?this[_0x24e4('0x10')](_0x24e4('0x1d'))[_0x24e4('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':'no','set':function(_0x231915){this['setDataValue'](_0x24e4('0x1e'),_0x231915?_0x231915[_0x24e4('0x1b')](','):undefined);},'get':function(){return this[_0x24e4('0x10')]('leavewhenempty')?this[_0x24e4('0x10')](_0x24e4('0x1e'))[_0x24e4('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x24e4('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x24e4('0x1')]},'description':{'type':Sequelize[_0x24e4('0x1')]},'acw':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':0x0,'set':function(_0x2e267b){this[_0x24e4('0xe')](_0x24e4('0x20'),_0x2e267b);if(_0x2e267b){if(this[_0x24e4('0x10')](_0x24e4('0x21'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x24e4('0x22')},'dialMethod':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x12'),_0x24e4('0x23'),'power','predictive',_0x24e4('0x13')),'defaultValue':_0x24e4('0x23'),'comment':_0x24e4('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x24e4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x24e4('0x16')](0x4)[_0x24e4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x24e4('0x26')},'dialPowerLevel':{'type':Sequelize[_0x24e4('0x27')](0x2)[_0x24e4('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x24e4('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x24e4('0x29'),_0x24e4('0x2a')),'defaultValue':_0x24e4('0x2a'),'comment':_0x24e4('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x24e4('0x27')](0x2)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x24e4('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x24e4('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x24e4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x24e4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':_0x24e4('0x2e'),'comment':_0x24e4('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x24e4('0x16')](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x24e4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x24e4('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x24e4('0x3')](_0x24e4('0x34'),'never',_0x24e4('0x35')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':0x0,'comment':_0x24e4('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x24e4('0x16')](0x9)[_0x24e4('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x24e4('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x24e4('0x16')](0x9)[_0x24e4('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x24e4('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x24e4('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x24e4('0x16')](0x9)[_0x24e4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x24e4('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x24e4('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x24e4('0x16')](0x9)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x24e4('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x24e4('0x16')](0x5)[_0x24e4('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x24e4('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x24e4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x24e4('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x24e4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x24e4('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':0x0,'comment':_0x24e4('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x24e4('0x3f'),'ASC'),'defaultValue':_0x24e4('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x24e4('0x1')],'comment':_0x24e4('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x24e4('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x24e4('0x16')](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x24e4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x24e4('0x16')](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x24e4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24e4('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24e4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24e4('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x24e4('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c1e9a){if(!_0x5c1e9a)this[_0x24e4('0xe')](_0x24e4('0x4d'),null);this[_0x24e4('0xe')](_0x24e4('0x4e'),_0x5c1e9a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x24e4('0x16')](0x3)[_0x24e4('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x24e4('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2943e04..99be3d4 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 _0x34f2=['destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','addTeams','TeamVoiceQueue','upsert','each','UserVoiceQueue','isNil','interface','format','userVoiceQueue:save','removeTeams','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','TeamId','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','SIP/%s','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','toString','createdAt','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then'];(function(_0x53fcd0,_0x294576){var _0x456acb=function(_0x3a28d2){while(--_0x3a28d2){_0x53fcd0['push'](_0x53fcd0['shift']());}};_0x456acb(++_0x294576);}(_0x34f2,0x15a));var _0x234f=function(_0x1b3520,_0x32fc91){_0x1b3520=_0x1b3520-0x0;var _0x29a030=_0x34f2[_0x1b3520];return _0x29a030;};'use strict';var emlformat=require(_0x234f('0x0'));var rimraf=require(_0x234f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x234f('0x2'));var rp=require(_0x234f('0x3'));var moment=require(_0x234f('0x4'));var BPromise=require(_0x234f('0x5'));var Mustache=require(_0x234f('0x6'));var util=require(_0x234f('0x7'));var path=require(_0x234f('0x8'));var sox=require(_0x234f('0x9'));var csv=require(_0x234f('0xa'));var ejs=require(_0x234f('0xb'));var fs=require('fs');var fs_extra=require(_0x234f('0xc'));var _=require(_0x234f('0xd'));var squel=require(_0x234f('0xe'));var crypto=require(_0x234f('0xf'));var jsforce=require(_0x234f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x234f('0xa'));var querystring=require(_0x234f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x234f('0x12'));var qs=require(_0x234f('0x13'));var as=require(_0x234f('0x14'));var hardwareService=require(_0x234f('0x15'));var logger=require(_0x234f('0x16'))('api');var utils=require(_0x234f('0x17'));var config=require(_0x234f('0x18'));var licenseUtil=require(_0x234f('0x19'));var db=require(_0x234f('0x1a'))['db'];config['redis']=_[_0x234f('0x1b')](config['redis'],{'host':_0x234f('0x1c'),'port':0x18eb});var socket=require(_0x234f('0x1d'))(new Redis(config[_0x234f('0x1e')]));require(_0x234f('0x1f'))[_0x234f('0x20')](socket);function respondWithStatusCode(_0x10ee30,_0x296c3a){_0x296c3a=_0x296c3a||0xcc;return function(_0x533bd4){if(_0x533bd4){return _0x10ee30['sendStatus'](_0x296c3a);}return _0x10ee30[_0x234f('0x21')](_0x296c3a)[_0x234f('0x22')]();};}function respondWithResult(_0x5f0e9c,_0x14f879){_0x14f879=_0x14f879||0xc8;return function(_0x15fd64){if(_0x15fd64){return _0x5f0e9c[_0x234f('0x21')](_0x14f879)[_0x234f('0x23')](_0x15fd64);}};}function respondWithFilteredResult(_0x304c08,_0x1de6f3){return function(_0x144ea0){if(_0x144ea0){var _0x2ce5e1=typeof _0x1de6f3[_0x234f('0x24')]==='undefined'&&typeof _0x1de6f3[_0x234f('0x25')]===_0x234f('0x26');var _0x357ecb=_0x144ea0[_0x234f('0x27')];var _0x410977=_0x2ce5e1?0x0:_0x1de6f3[_0x234f('0x24')];var _0x470363=_0x2ce5e1?_0x144ea0[_0x234f('0x27')]:_0x1de6f3[_0x234f('0x24')]+_0x1de6f3['limit'];var _0x5e7edd;if(_0x470363>=_0x357ecb){_0x470363=_0x357ecb;_0x5e7edd=0xc8;}else{_0x5e7edd=0xce;}_0x304c08[_0x234f('0x21')](_0x5e7edd);return _0x304c08[_0x234f('0x28')]('Content-Range',_0x410977+'-'+_0x470363+'/'+_0x357ecb)[_0x234f('0x23')](_0x144ea0);}return null;};}function patchUpdates(_0x4ca657){return function(_0x395d16){try{jsonpatch[_0x234f('0x29')](_0x395d16,_0x4ca657,!![]);}catch(_0x17a23c){return BPromise[_0x234f('0x2a')](_0x17a23c);}return _0x395d16[_0x234f('0x2b')]();};}function saveUpdates(_0x434e9f,_0x2b585b){return function(_0x327f99){if(_0x327f99){return _0x327f99[_0x234f('0x2c')](_0x434e9f)[_0x234f('0x2d')](function(_0x758e8d){return _0x758e8d;});}return null;};}function removeEntity(_0xd8ffbf,_0x15de29){return function(_0x31d244){if(_0x31d244){return _0x31d244[_0x234f('0x2e')]()[_0x234f('0x2d')](function(){var _0x2b6641=_0x31d244[_0x234f('0x2f')]({'plain':!![]});var _0x1521b1=[{'name':_0x234f('0x30'),'value':_0x234f('0x31'),'ignore':![]},{'name':_0x234f('0x32'),'value':_0x234f('0x33'),'ignore':![]}];var _0x5d3759=_(_0x1521b1)[_0x234f('0x34')](_0x234f('0x35'))[_0x234f('0x36')](_0x234f('0x37'))[_0x234f('0x37')]();if(_[_0x234f('0x38')](_0x5d3759,_0x2b6641[_0x234f('0x39')])){return;}var _0x335004=_[_0x234f('0x3a')](_0x1521b1,[_0x234f('0x37'),_0x2b6641['type']])[_0x234f('0x3b')];return db['UserProfileResource'][_0x234f('0x2e')]({'where':{'type':_0x335004,'resourceId':_0x2b6641['id']}})[_0x234f('0x2d')](function(){return _0x31d244;});})[_0x234f('0x2d')](function(){_0xd8ffbf[_0x234f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17dbb1,_0x1e04c0){return function(_0x460580){if(!_0x460580){_0x17dbb1['sendStatus'](0x194);}return _0x460580;};}function handleError(_0x4c7005,_0x1ac458){_0x1ac458=_0x1ac458||0x1f4;return function(_0xc8aa45){logger['error'](_0xc8aa45['stack']);if(_0xc8aa45[_0x234f('0x3b')]){delete _0xc8aa45['name'];}_0x4c7005['status'](_0x1ac458)[_0x234f('0x3c')](_0xc8aa45);};}exports['index']=function(_0x3a81de,_0x27bfdc){var _0x3d651e={},_0x1b1a56={},_0x266d62={'count':0x0,'rows':[]};var _0x36c893=_[_0x234f('0x36')](db[_0x234f('0x3d')][_0x234f('0x3e')],function(_0x4ec53e){return{'name':_0x4ec53e[_0x234f('0x3f')],'type':_0x4ec53e[_0x234f('0x39')][_0x234f('0x40')]};});_0x1b1a56[_0x234f('0x41')]=_[_0x234f('0x36')](_0x36c893,_0x234f('0x3b'));_0x1b1a56[_0x234f('0x42')]=_[_0x234f('0x43')](_0x3a81de['query']);_0x1b1a56[_0x234f('0x44')]=_[_0x234f('0x45')](_0x1b1a56[_0x234f('0x41')],_0x1b1a56[_0x234f('0x42')]);_0x3d651e['attributes']=_['intersection'](_0x1b1a56['model'],qs[_0x234f('0x46')](_0x3a81de['query'][_0x234f('0x46')]));_0x3d651e[_0x234f('0x47')]=_0x3d651e[_0x234f('0x47')][_0x234f('0x48')]?_0x3d651e[_0x234f('0x47')]:_0x1b1a56[_0x234f('0x41')];if(!_0x3a81de[_0x234f('0x42')][_0x234f('0x49')](_0x234f('0x4a'))){_0x3d651e[_0x234f('0x25')]=qs[_0x234f('0x25')](_0x3a81de[_0x234f('0x42')][_0x234f('0x25')]);_0x3d651e[_0x234f('0x24')]=qs[_0x234f('0x24')](_0x3a81de[_0x234f('0x42')][_0x234f('0x24')]);}_0x3d651e[_0x234f('0x4b')]=qs[_0x234f('0x4c')](_0x3a81de['query'][_0x234f('0x4c')]);_0x3d651e[_0x234f('0x4d')]=qs[_0x234f('0x44')](_[_0x234f('0x4e')](_0x3a81de[_0x234f('0x42')],_0x1b1a56[_0x234f('0x44')]),_0x36c893);if(_0x3a81de[_0x234f('0x42')]['filter']){_0x3d651e['where']=_[_0x234f('0x4f')](_0x3d651e['where'],{'$or':_[_0x234f('0x36')](_0x36c893,function(_0x36d87c){if(_0x36d87c[_0x234f('0x39')]!=='VIRTUAL'){var _0x4daefd={};_0x4daefd[_0x36d87c[_0x234f('0x3b')]]={'$like':'%'+_0x3a81de[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x4daefd;}})});}_0x3d651e=_[_0x234f('0x4f')]({},_0x3d651e,_0x3a81de[_0x234f('0x50')]);var _0x3f5bd0={'where':_0x3d651e[_0x234f('0x4d')]};return db['VoiceQueue'][_0x234f('0x27')](_0x3f5bd0)['then'](function(_0x175fe0){_0x266d62[_0x234f('0x27')]=_0x175fe0;if(_0x3a81de['query'][_0x234f('0x51')]){_0x3d651e[_0x234f('0x52')]=[{'all':!![]}];}return db['VoiceQueue'][_0x234f('0x53')](_0x3d651e);})[_0x234f('0x2d')](function(_0x2cf09f){_0x266d62['rows']=_0x2cf09f;return _0x266d62;})[_0x234f('0x2d')](respondWithFilteredResult(_0x27bfdc,_0x3d651e))[_0x234f('0x54')](handleError(_0x27bfdc,null));};exports[_0x234f('0x55')]=function(_0x5d039b,_0x4006d4){var _0x469c9e={'raw':![],'where':{'id':_0x5d039b[_0x234f('0x56')]['id']}},_0x5bc3e8={};_0x5bc3e8[_0x234f('0x41')]=_['keys'](db[_0x234f('0x3d')][_0x234f('0x3e')]);_0x5bc3e8[_0x234f('0x42')]=_[_0x234f('0x43')](_0x5d039b[_0x234f('0x42')]);_0x5bc3e8[_0x234f('0x44')]=_[_0x234f('0x45')](_0x5bc3e8['model'],_0x5bc3e8[_0x234f('0x42')]);_0x469c9e[_0x234f('0x47')]=_[_0x234f('0x45')](_0x5bc3e8[_0x234f('0x41')],qs[_0x234f('0x46')](_0x5d039b['query'][_0x234f('0x46')]));_0x469c9e[_0x234f('0x47')]=_0x469c9e[_0x234f('0x47')][_0x234f('0x48')]?_0x469c9e[_0x234f('0x47')]:_0x5bc3e8[_0x234f('0x41')];if(_0x5d039b[_0x234f('0x42')][_0x234f('0x51')]){_0x469c9e[_0x234f('0x52')]=[{'all':!![]}];}_0x469c9e=_[_0x234f('0x4f')]({},_0x469c9e,_0x5d039b[_0x234f('0x50')]);return db['VoiceQueue'][_0x234f('0x3a')](_0x469c9e)[_0x234f('0x2d')](handleEntityNotFound(_0x4006d4,null))['then'](respondWithResult(_0x4006d4,null))[_0x234f('0x54')](handleError(_0x4006d4,null));};exports['create']=function(_0x525cfc,_0x1ea9b9){return db[_0x234f('0x3d')][_0x234f('0x57')](_0x525cfc['body'],{})[_0x234f('0x2d')](function(_0xf5fa1a){var _0x39d0ff=_0x525cfc[_0x234f('0x58')]['get']({'plain':!![]});if(!_0x39d0ff)throw new Error(_0x234f('0x59'));if(_0x39d0ff[_0x234f('0x5a')]==='user'){var _0x50ab49=_0xf5fa1a['get']({'plain':!![]});var _0x51ae21=[{'name':'VoiceQueues','value':_0x234f('0x31')},{'name':'QueueCampaigns','value':_0x234f('0x33')}];var _0x1bd041=_[_0x234f('0x3a')](_0x51ae21,['value',_0x50ab49['type']])[_0x234f('0x3b')];return db[_0x234f('0x5b')][_0x234f('0x3a')]({'where':{'name':_0x1bd041,'userProfileId':_0x39d0ff['userProfileId']},'raw':!![]})['then'](function(_0x14ff9e){if(_0x14ff9e&&_0x14ff9e[_0x234f('0x5c')]===0x0){return db[_0x234f('0x5d')][_0x234f('0x57')]({'name':_0x50ab49[_0x234f('0x3b')],'resourceId':_0x50ab49['id'],'type':_0x14ff9e['name'],'sectionId':_0x14ff9e['id']},{})['then'](function(){return _0xf5fa1a;});}else{return _0xf5fa1a;}})[_0x234f('0x54')](function(_0x32e870){logger[_0x234f('0x5e')](_0x234f('0x5f'),_0x32e870);throw _0x32e870;});}return _0xf5fa1a;})[_0x234f('0x2d')](respondWithResult(_0x1ea9b9,0xc9))[_0x234f('0x54')](handleError(_0x1ea9b9,null));};exports[_0x234f('0x60')]=function(_0xa2b1ae,_0x393534){var _0x355115={'where':{'id':_0xa2b1ae[_0x234f('0x56')]['id']}},_0x537553={};_0x537553['model']=_[_0x234f('0x43')](db['VoiceQueue'][_0x234f('0x3e')]);_0x355115['attributes']=_[_0x234f('0x45')](_0x537553[_0x234f('0x41')],qs['fields'](_0xa2b1ae[_0x234f('0x42')][_0x234f('0x46')]));_0x355115[_0x234f('0x47')]=_0x355115[_0x234f('0x47')][_0x234f('0x48')]?_0x355115['attributes']:_0x537553['model'];if(_0xa2b1ae[_0x234f('0x42')][_0x234f('0x51')]){_0x355115[_0x234f('0x52')]=[{'all':!![]}];}_0x355115=_[_0x234f('0x4f')]({},_0x355115,_0xa2b1ae['options']);return db['VoiceQueue'][_0x234f('0x3a')](_0x355115)[_0x234f('0x2d')](handleEntityNotFound(_0x393534,null))['then'](function(_0x162bf0){if(_0x162bf0){var _0x208e3a=_0x162bf0[_0x234f('0x2f')]({'plain':!![]});_0x208e3a=qs[_0x234f('0x61')](_0x208e3a,['id','createdAt',_0x234f('0x62')]);_0xa2b1ae['body']=_[_0x234f('0x61')](_0xa2b1ae['body'],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0x234f('0x57')](_[_0x234f('0x4f')](_0x208e3a,_0xa2b1ae[_0x234f('0x63')]),{'include':_0xa2b1ae[_0x234f('0x42')][_0x234f('0x51')]?[{'all':!![]}]:undefined})[_0x234f('0x2d')](function(_0x36a037){var _0x53f2b5=_0xa2b1ae[_0x234f('0x58')]['get']({'plain':!![]});if(!_0x53f2b5)throw new Error(_0x234f('0x59'));if(_0x53f2b5[_0x234f('0x5a')]===_0x234f('0x58')){var _0x13c73e=_0x36a037[_0x234f('0x2f')]({'plain':!![]});var _0x3e450a=[{'name':'VoiceQueues','value':_0x234f('0x31')},{'name':_0x234f('0x32'),'value':_0x234f('0x33')}];var _0x1f1016=_['find'](_0x3e450a,[_0x234f('0x37'),_0x13c73e['type']])[_0x234f('0x3b')];return db[_0x234f('0x5b')][_0x234f('0x3a')]({'where':{'name':_0x1f1016,'userProfileId':_0x53f2b5[_0x234f('0x64')]},'raw':!![]})[_0x234f('0x2d')](function(_0x32dd69){if(_0x32dd69&&_0x32dd69['autoAssociation']===0x0){return db['UserProfileResource'][_0x234f('0x57')]({'name':_0x13c73e[_0x234f('0x3b')],'resourceId':_0x13c73e['id'],'type':_0x32dd69['name'],'sectionId':_0x32dd69['id']},{})[_0x234f('0x2d')](function(){return _0x36a037;});}else{return _0x36a037;}})[_0x234f('0x54')](function(_0x1cfc29){logger[_0x234f('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cfc29);throw _0x1cfc29;});}return _0x36a037;});}})[_0x234f('0x2d')](respondWithResult(_0x393534,0xc9))[_0x234f('0x54')](handleError(_0x393534,null));};exports[_0x234f('0x2c')]=function(_0x46ae5c,_0x4c8433){if(_0x46ae5c[_0x234f('0x63')]['id']){delete _0x46ae5c['body']['id'];}return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x46ae5c[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x4c8433,null))[_0x234f('0x2d')](saveUpdates(_0x46ae5c[_0x234f('0x63')],null))[_0x234f('0x2d')](respondWithResult(_0x4c8433,null))[_0x234f('0x54')](handleError(_0x4c8433,null));};exports[_0x234f('0x2e')]=function(_0x152b90,_0x2e56e3){return db[_0x234f('0x3d')][_0x234f('0x3a')]({'where':{'id':_0x152b90[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2e56e3,null))[_0x234f('0x2d')](removeEntity(_0x2e56e3,null))[_0x234f('0x54')](handleError(_0x2e56e3,null));};exports[_0x234f('0x65')]=function(_0x11806c,_0x4330b8,_0x1ba120){var _0x40eb9b={'raw':![],'where':{}};var _0x253a69={};var _0x3fd0ff={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x234f('0x66')]({'where':{'id':_0x11806c[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x4330b8,null))[_0x234f('0x2d')](function(_0x739e18){if(_0x739e18){_0x253a69['model']=_['keys'](db['CmHopper'][_0x234f('0x3e')]);_0x253a69[_0x234f('0x42')]=_[_0x234f('0x43')](_0x11806c[_0x234f('0x42')]);_0x253a69[_0x234f('0x44')]=_[_0x234f('0x45')](_0x253a69[_0x234f('0x41')],_0x253a69[_0x234f('0x42')]);_0x40eb9b['attributes']=_['intersection'](_0x253a69[_0x234f('0x41')],qs['fields'](_0x11806c[_0x234f('0x42')][_0x234f('0x46')]));_0x40eb9b['attributes']=_0x40eb9b[_0x234f('0x47')][_0x234f('0x48')]?_0x40eb9b[_0x234f('0x47')]:_0x253a69[_0x234f('0x41')];if(!_0x11806c[_0x234f('0x42')]['hasOwnProperty']('nolimit')){_0x40eb9b['limit']=qs[_0x234f('0x25')](_0x11806c[_0x234f('0x42')][_0x234f('0x25')]);_0x40eb9b[_0x234f('0x24')]=qs['offset'](_0x11806c[_0x234f('0x42')][_0x234f('0x24')]);}_0x40eb9b['order']=qs[_0x234f('0x4c')](_0x11806c[_0x234f('0x42')][_0x234f('0x4c')]);_0x40eb9b[_0x234f('0x4d')]=qs['filters'](_[_0x234f('0x4e')](_0x11806c[_0x234f('0x42')],_0x253a69[_0x234f('0x44')]));_0x40eb9b['where'][_0x234f('0x67')]=_0x739e18['id'];if(_0x11806c[_0x234f('0x42')][_0x234f('0x34')]){_0x40eb9b[_0x234f('0x4d')]=_['merge'](_0x40eb9b['where'],{'$or':_[_0x234f('0x36')](_0x40eb9b[_0x234f('0x47')],function(_0x55c690){var _0x4040f1={};_0x4040f1[_0x55c690]={'$like':'%'+_0x11806c[_0x234f('0x42')]['filter']+'%'};return _0x4040f1;})});}_0x40eb9b=_[_0x234f('0x4f')]({},_0x40eb9b,_0x11806c[_0x234f('0x50')]);return db[_0x234f('0x68')][_0x234f('0x27')]({'where':_0x40eb9b['where']})[_0x234f('0x2d')](function(_0x3783ad){_0x3fd0ff[_0x234f('0x27')]=_0x3783ad;if(_0x11806c[_0x234f('0x42')][_0x234f('0x51')]){_0x40eb9b[_0x234f('0x52')]=[{'all':!![]}];}return db[_0x234f('0x68')][_0x234f('0x53')](_0x40eb9b);})[_0x234f('0x2d')](function(_0x56bbca){_0x3fd0ff[_0x234f('0x69')]=_0x56bbca;return _0x3fd0ff;});}})[_0x234f('0x2d')](respondWithFilteredResult(_0x4330b8,_0x40eb9b))['catch'](handleError(_0x4330b8,null));};exports[_0x234f('0x6a')]=function(_0x183de0,_0x1b0396,_0x291f6f){var _0x415adb={'raw':!![],'where':{}};var _0x1f7239={};var _0x51ed8d={'count':0x0,'rows':[]};return db[_0x234f('0x3d')][_0x234f('0x66')]({'where':{'id':_0x183de0[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x1b0396,null))[_0x234f('0x2d')](function(_0x2263e0){if(_0x2263e0){_0x1f7239['model']=_[_0x234f('0x43')](db[_0x234f('0x6b')][_0x234f('0x3e')]);_0x1f7239[_0x234f('0x42')]=_['keys'](_0x183de0[_0x234f('0x42')]);_0x1f7239['filters']=_[_0x234f('0x45')](_0x1f7239['model'],_0x1f7239[_0x234f('0x42')]);_0x415adb[_0x234f('0x47')]=_[_0x234f('0x45')](_0x1f7239['model'],qs[_0x234f('0x46')](_0x183de0[_0x234f('0x42')]['fields']));_0x415adb['attributes']=_0x415adb[_0x234f('0x47')][_0x234f('0x48')]?_0x415adb[_0x234f('0x47')]:_0x1f7239[_0x234f('0x41')];if(!_0x183de0[_0x234f('0x42')][_0x234f('0x49')](_0x234f('0x4a'))){_0x415adb['limit']=qs[_0x234f('0x25')](_0x183de0[_0x234f('0x42')]['limit']);_0x415adb['offset']=qs['offset'](_0x183de0[_0x234f('0x42')][_0x234f('0x24')]);}_0x415adb[_0x234f('0x4b')]=qs[_0x234f('0x4c')](_0x183de0['query'][_0x234f('0x4c')]);_0x415adb[_0x234f('0x4d')]=qs[_0x234f('0x44')](_[_0x234f('0x4e')](_0x183de0[_0x234f('0x42')],_0x1f7239['filters']));_0x415adb[_0x234f('0x4d')]['VoiceQueueId']=_0x2263e0['id'];if(_0x183de0[_0x234f('0x42')]['filter']){_0x415adb['where']=_[_0x234f('0x4f')](_0x415adb[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x415adb[_0x234f('0x47')],function(_0x590503){var _0x4954a9={};_0x4954a9[_0x590503]={'$like':'%'+_0x183de0[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x4954a9;})});}_0x415adb=_[_0x234f('0x4f')]({},_0x415adb,_0x183de0['options']);return db[_0x234f('0x6b')][_0x234f('0x27')]({'where':_0x415adb[_0x234f('0x4d')]})[_0x234f('0x2d')](function(_0x1d7d16){_0x51ed8d[_0x234f('0x27')]=_0x1d7d16;if(_0x183de0['query'][_0x234f('0x51')]){_0x415adb[_0x234f('0x52')]=[{'all':!![]}];}return db[_0x234f('0x6b')][_0x234f('0x53')](_0x415adb);})['then'](function(_0x2136e8){_0x51ed8d[_0x234f('0x69')]=_0x2136e8;return _0x51ed8d;});}})[_0x234f('0x2d')](respondWithFilteredResult(_0x1b0396,_0x415adb))[_0x234f('0x54')](handleError(_0x1b0396,null));};exports['getHopperFinals']=function(_0xc34523,_0x2f4755,_0x1a41e8){var _0x1f3edc={'raw':!![],'where':{}};var _0x5ca0cd={};var _0x5b91e9={'count':0x0,'rows':[]};return db[_0x234f('0x3d')][_0x234f('0x66')]({'where':{'id':_0xc34523[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2f4755,null))[_0x234f('0x2d')](function(_0x1d811a){if(_0x1d811a){_0x5ca0cd[_0x234f('0x41')]=_[_0x234f('0x43')](db[_0x234f('0x6c')]['rawAttributes']);_0x5ca0cd[_0x234f('0x42')]=_[_0x234f('0x43')](_0xc34523[_0x234f('0x42')]);_0x5ca0cd[_0x234f('0x44')]=_[_0x234f('0x45')](_0x5ca0cd[_0x234f('0x41')],_0x5ca0cd[_0x234f('0x42')]);_0x1f3edc[_0x234f('0x47')]=_[_0x234f('0x45')](_0x5ca0cd[_0x234f('0x41')],qs[_0x234f('0x46')](_0xc34523[_0x234f('0x42')][_0x234f('0x46')]));_0x1f3edc['attributes']=_0x1f3edc[_0x234f('0x47')]['length']?_0x1f3edc[_0x234f('0x47')]:_0x5ca0cd[_0x234f('0x41')];if(!_0xc34523[_0x234f('0x42')][_0x234f('0x49')](_0x234f('0x4a'))){_0x1f3edc[_0x234f('0x25')]=qs[_0x234f('0x25')](_0xc34523[_0x234f('0x42')][_0x234f('0x25')]);_0x1f3edc['offset']=qs['offset'](_0xc34523[_0x234f('0x42')][_0x234f('0x24')]);}_0x1f3edc[_0x234f('0x4b')]=qs['sort'](_0xc34523[_0x234f('0x42')]['sort']);_0x1f3edc[_0x234f('0x4d')]=qs['filters'](_[_0x234f('0x4e')](_0xc34523['query'],_0x5ca0cd['filters']));_0x1f3edc[_0x234f('0x4d')][_0x234f('0x67')]=_0x1d811a['id'];if(_0xc34523[_0x234f('0x42')][_0x234f('0x34')]){_0x1f3edc['where']=_['merge'](_0x1f3edc[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x1f3edc[_0x234f('0x47')],function(_0x21f63a){var _0xdfa3da={};_0xdfa3da[_0x21f63a]={'$like':'%'+_0xc34523['query'][_0x234f('0x34')]+'%'};return _0xdfa3da;})});}_0x1f3edc=_[_0x234f('0x4f')]({},_0x1f3edc,_0xc34523['options']);return db[_0x234f('0x6c')][_0x234f('0x27')]({'where':_0x1f3edc[_0x234f('0x4d')]})['then'](function(_0x4d0e64){_0x5b91e9[_0x234f('0x27')]=_0x4d0e64;if(_0xc34523[_0x234f('0x42')][_0x234f('0x51')]){_0x1f3edc[_0x234f('0x52')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x234f('0x53')](_0x1f3edc);})[_0x234f('0x2d')](function(_0x40aa8b){_0x5b91e9[_0x234f('0x69')]=_0x40aa8b;return _0x5b91e9;});}})[_0x234f('0x2d')](respondWithFilteredResult(_0x2f4755,_0x1f3edc))[_0x234f('0x54')](handleError(_0x2f4755,null));};exports[_0x234f('0x6d')]=function(_0x5aa3df,_0x2818d6,_0x21dfbf){var _0x1f5195={'raw':!![],'where':{}};var _0x4e621e={};var _0x16ed8e={'count':0x0,'rows':[]};return db[_0x234f('0x3d')][_0x234f('0x66')]({'where':{'id':_0x5aa3df['params']['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2818d6,null))[_0x234f('0x2d')](function(_0x3285fd){if(_0x3285fd){_0x4e621e[_0x234f('0x41')]=_['keys'](db[_0x234f('0x6e')][_0x234f('0x3e')]);_0x4e621e[_0x234f('0x42')]=_['keys'](_0x5aa3df[_0x234f('0x42')]);_0x4e621e[_0x234f('0x44')]=_[_0x234f('0x45')](_0x4e621e[_0x234f('0x41')],_0x4e621e[_0x234f('0x42')]);_0x1f5195[_0x234f('0x47')]=_[_0x234f('0x45')](_0x4e621e['model'],qs['fields'](_0x5aa3df[_0x234f('0x42')][_0x234f('0x46')]));_0x1f5195[_0x234f('0x47')]=_0x1f5195[_0x234f('0x47')][_0x234f('0x48')]?_0x1f5195[_0x234f('0x47')]:_0x4e621e[_0x234f('0x41')];if(!_0x5aa3df['query']['hasOwnProperty'](_0x234f('0x4a'))){_0x1f5195[_0x234f('0x25')]=qs[_0x234f('0x25')](_0x5aa3df['query'][_0x234f('0x25')]);_0x1f5195[_0x234f('0x24')]=qs[_0x234f('0x24')](_0x5aa3df['query'][_0x234f('0x24')]);}_0x1f5195[_0x234f('0x4b')]=qs['sort'](_0x5aa3df[_0x234f('0x42')][_0x234f('0x4c')]);_0x1f5195[_0x234f('0x4d')]=qs[_0x234f('0x44')](_[_0x234f('0x4e')](_0x5aa3df[_0x234f('0x42')],_0x4e621e[_0x234f('0x44')]));_0x1f5195[_0x234f('0x4d')][_0x234f('0x67')]=_0x3285fd['id'];if(_0x5aa3df[_0x234f('0x42')][_0x234f('0x34')]){_0x1f5195['where']=_['merge'](_0x1f5195[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x1f5195['attributes'],function(_0x3017bc){var _0xc35f9f={};_0xc35f9f[_0x3017bc]={'$like':'%'+_0x5aa3df[_0x234f('0x42')]['filter']+'%'};return _0xc35f9f;})});}_0x1f5195=_[_0x234f('0x4f')]({},_0x1f5195,_0x5aa3df[_0x234f('0x50')]);return db[_0x234f('0x6e')][_0x234f('0x27')]({'where':_0x1f5195[_0x234f('0x4d')]})[_0x234f('0x2d')](function(_0x27d3e6){_0x16ed8e['count']=_0x27d3e6;if(_0x5aa3df[_0x234f('0x42')][_0x234f('0x51')]){_0x1f5195['include']=[{'all':!![]}];}return db[_0x234f('0x6e')][_0x234f('0x53')](_0x1f5195);})[_0x234f('0x2d')](function(_0x489bfd){_0x16ed8e[_0x234f('0x69')]=_0x489bfd;return _0x16ed8e;});}})['then'](respondWithFilteredResult(_0x2818d6,_0x1f5195))['catch'](handleError(_0x2818d6,null));};exports['getTeams']=function(_0x578432,_0x476a6d,_0x2bae99){var _0x27889d={};var _0x46b5bc={};var _0x25bd5e;var _0x433b44;return db[_0x234f('0x3d')]['findOne']({'where':{'id':_0x578432['params']['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x476a6d,null))[_0x234f('0x2d')](function(_0x4596eb){if(_0x4596eb){_0x25bd5e=_0x4596eb;_0x46b5bc['model']=_[_0x234f('0x43')](db['Team']['rawAttributes']);_0x46b5bc[_0x234f('0x42')]=_[_0x234f('0x43')](_0x578432[_0x234f('0x42')]);_0x46b5bc[_0x234f('0x44')]=_['intersection'](_0x46b5bc[_0x234f('0x41')],_0x46b5bc[_0x234f('0x42')]);_0x27889d[_0x234f('0x47')]=_['intersection'](_0x46b5bc[_0x234f('0x41')],qs[_0x234f('0x46')](_0x578432[_0x234f('0x42')][_0x234f('0x46')]));_0x27889d[_0x234f('0x47')]=_0x27889d[_0x234f('0x47')][_0x234f('0x48')]?_0x27889d[_0x234f('0x47')]:_0x46b5bc['model'];_0x27889d[_0x234f('0x4b')]=qs[_0x234f('0x4c')](_0x578432['query'][_0x234f('0x4c')]);_0x27889d[_0x234f('0x4d')]=qs[_0x234f('0x44')](_['pick'](_0x578432[_0x234f('0x42')],_0x46b5bc[_0x234f('0x44')]));if(_0x578432[_0x234f('0x42')][_0x234f('0x34')]){_0x27889d[_0x234f('0x4d')]=_[_0x234f('0x4f')](_0x27889d[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x27889d[_0x234f('0x47')],function(_0x4fa721){var _0x240852={};_0x240852[_0x4fa721]={'$like':'%'+_0x578432[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x240852;})});}_0x27889d=_[_0x234f('0x4f')]({},_0x27889d,_0x578432[_0x234f('0x50')]);return _0x25bd5e['getTeams'](_0x27889d);}})['then'](function(_0x4b6237){if(_0x4b6237){_0x433b44=_0x4b6237[_0x234f('0x48')];if(!_0x578432[_0x234f('0x42')]['hasOwnProperty'](_0x234f('0x4a'))){_0x27889d['limit']=qs[_0x234f('0x25')](_0x578432[_0x234f('0x42')][_0x234f('0x25')]);_0x27889d['offset']=qs['offset'](_0x578432[_0x234f('0x42')]['offset']);}return _0x25bd5e['getTeams'](_0x27889d);}})[_0x234f('0x2d')](function(_0x597cdc){if(_0x597cdc){return _0x597cdc?{'count':_0x433b44,'rows':_0x597cdc}:null;}})[_0x234f('0x2d')](respondWithResult(_0x476a6d,null))[_0x234f('0x54')](handleError(_0x476a6d,null));};exports['addTeams']=function(_0x3c2735,_0x4b692d,_0x124938){var _0x3d84f8=_0x3c2735[_0x234f('0x63')][_0x234f('0x6f')];var _0x385598=_[_0x234f('0x36')](_0x3d84f8,'id');return db[_0x234f('0x70')][_0x234f('0x53')]({'where':{'id':_0x385598},'attributes':['id'],'include':[{'model':db[_0x234f('0x71')],'as':_0x234f('0x72'),'attributes':['id',_0x234f('0x3b'),_0x234f('0x73'),_0x234f('0x74'),'interface'],'raw':!![]}]})[_0x234f('0x2d')](function(_0x2ebe81){if(_0x2ebe81){var _0x3ba372=_[_0x234f('0x75')](_0x2ebe81,function(_0x3788be){var _0x3efd38=_0x3788be[_0x234f('0x2f')]({'plain':!![]});_0x3efd38[_0x234f('0x72')][_0x234f('0x76')](function(_0x325405){_0x325405[_0x234f('0x77')]=_['find'](_0x3d84f8,{'id':_0x3efd38['id']})['penalty'];});return _0x3efd38[_0x234f('0x72')];});return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x3c2735[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](function(_0x110d95){return db['sequelize']['transaction'](function(_0x1d1231){return _0x110d95[_0x234f('0x78')](_0x385598,{'transaction':_0x1d1231})['then'](function(){return BPromise['each'](_0x3d84f8,function(_0x2d613f){return db[_0x234f('0x79')][_0x234f('0x7a')]({'TeamId':_0x2d613f['id'],'VoiceQueueId':_0x3c2735[_0x234f('0x56')]['id'],'penalty':_0x2d613f[_0x234f('0x77')]},{'transaction':_0x1d1231});});})[_0x234f('0x2d')](function(){return BPromise[_0x234f('0x7b')](_0x3ba372,function(_0x54cae1){return db[_0x234f('0x7c')]['findOrCreate']({'where':{'UserId':_0x54cae1['id'],'VoiceQueueId':_0x3c2735[_0x234f('0x56')]['id']},'defaults':{'penalty':_0x54cae1[_0x234f('0x77')]},'transaction':_0x1d1231});});})['then'](function(){return BPromise[_0x234f('0x7b')](_[_0x234f('0x34')](_0x3ba372,{'online':!![]}),function(_0x434176){return db['UserVoiceQueueRt'][_0x234f('0x7a')]({'membername':_0x434176['name'],'UserId':_0x434176['id'],'queue_name':_0x110d95[_0x234f('0x3b')],'VoiceQueueId':_0x110d95['id'],'interface':_[_0x234f('0x7d')](_0x434176[_0x234f('0x7e')])?util[_0x234f('0x7f')]('SIP/%s',_0x434176[_0x234f('0x3b')]):_0x434176['interface'],'paused':_0x434176[_0x234f('0x74')]||![],'penalty':_0x434176['penalty']},{'transaction':_0x1d1231});});})['then'](function(){_0x3ba372[_0x234f('0x76')](function(_0x2aa818){socket['emit'](_0x234f('0x80'),{'UserId':_0x2aa818['id'],'VoiceQueueId':_0x110d95['id']});});});});});}})[_0x234f('0x2d')](respondWithStatusCode(_0x4b692d,null))['catch'](handleError(_0x4b692d,null));};exports[_0x234f('0x81')]=function(_0x5757c4,_0x420b96,_0x5be21b){return db['Team'][_0x234f('0x53')]({'where':{'id':_0x5757c4[_0x234f('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0x234f('0x71')],'as':_0x234f('0x72'),'attributes':['id'],'raw':!![]}]})[_0x234f('0x2d')](handleEntityNotFound(_0x420b96,null))['then'](function(_0x4ff5a9){var _0x1eb583=_[_0x234f('0x36')](_0x4ff5a9,'id');var _0x4cc1ea=[];var _0x26eb1a=[];var _0xe2bc2a=squel[_0x234f('0x82')]();_0xe2bc2a[_0x234f('0x83')]('tq.TeamId')[_0x234f('0x84')](_0x234f('0x85'),'tq')[_0x234f('0x86')](_0x234f('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x234f('0x4d')](_0x234f('0x88'),_0x5757c4[_0x234f('0x56')]['id']);for(var _0x11ce64=0x0;_0x11ce64<_0x4ff5a9['length'];_0x11ce64+=0x1){let _0x411110=_0x4ff5a9[_0x11ce64];for(var _0x4bb59f=0x0;_0x4bb59f<_0x411110[_0x234f('0x72')][_0x234f('0x48')];_0x4bb59f+=0x1){let _0x340604=_0x411110[_0x234f('0x72')][_0x4bb59f];var _0xa49454=_0xe2bc2a['clone']();_0xa49454[_0x234f('0x4d')](_0x234f('0x89'),_0x340604['id']);_0x26eb1a[_0x234f('0x8a')](db['sequelize'][_0x234f('0x42')](_0xa49454['toString'](),{'type':db[_0x234f('0x8b')][_0x234f('0x8c')]['SELECT']})['then'](function(_0x3c3486){if(_0x3c3486[_0x234f('0x48')]===0x1){return _0x340604['id'];}else{var _0x22b1e8=_['every'](_[_0x234f('0x36')](_0x3c3486,_0x234f('0x8d')),function(_0x245304){return _[_0x234f('0x38')](_0x1eb583,_0x245304);});if(_0x22b1e8){return _0x340604['id'];}}}));}}return BPromise[_0x234f('0x8e')](_0x26eb1a)[_0x234f('0x2d')](function(_0x10c0bc){_0x4cc1ea=_(_0x4cc1ea)[_0x234f('0x8f')](_0x10c0bc)[_0x234f('0x90')]()[_0x234f('0x37')]();return db['VoiceQueue']['find']({'where':{'id':_0x5757c4[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](function(_0x4d9723){return db['sequelize']['transaction'](function(_0x2f8e00){return _0x4d9723[_0x234f('0x81')](_0x5757c4[_0x234f('0x42')][_0x234f('0x91')],{'transaction':_0x2f8e00})[_0x234f('0x2d')](function(){if(!_[_0x234f('0x92')](_0x4cc1ea)){return _0x4d9723[_0x234f('0x93')](_0x4cc1ea,{'transaction':_0x2f8e00})[_0x234f('0x2d')](function(){return db[_0x234f('0x94')][_0x234f('0x2e')]({'where':{'VoiceQueueId':_0x5757c4['params']['id'],'UserId':_0x4cc1ea},'transaction':_0x2f8e00});});}})['then'](function(){_0x4cc1ea[_0x234f('0x76')](function(_0x29dee4){socket[_0x234f('0x95')](_0x234f('0x96'),{'UserId':_0x29dee4,'VoiceQueueId':_0x4d9723['id']});});});});});});})['then'](respondWithStatusCode(_0x420b96,null))['catch'](handleError(_0x420b96,null));};exports[_0x234f('0x97')]=function(_0x4b20b7,_0x2eb251,_0x41bc95){var _0x122eff,_0x993420;return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x4b20b7['params']['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2eb251,null))[_0x234f('0x2d')](function(_0x297800){if(_0x297800){_0x993420=_0x297800;return _0x297800[_0x234f('0x97')](_0x4b20b7[_0x234f('0x63')][_0x234f('0x91')],_[_0x234f('0x61')](_0x4b20b7['body'],['ids','id'])||{})['spread'](function(_0x532ee6){for(var _0x3badff=0x0;_0x3badff<_0x4b20b7[_0x234f('0x63')]['ids'][_0x234f('0x48')];_0x3badff+=0x1){socket[_0x234f('0x95')](_0x234f('0x80'),{'UserId':Number(_0x4b20b7['body'][_0x234f('0x91')][_0x3badff]),'VoiceQueueId':Number(_0x4b20b7[_0x234f('0x56')]['id'])});}return _0x532ee6;});}})['then'](function(_0x246c71){_0x122eff=_0x246c71||[];if(_0x993420){return db[_0x234f('0x71')][_0x234f('0x53')]({'where':{'id':_0x4b20b7['body'][_0x234f('0x91')]},'attributes':['id','name',_0x234f('0x73'),_0x234f('0x74'),'interface'],'raw':!![]});}})['then'](function(_0x115670){if(!_['isEmpty'](_0x115670)){var _0x11cf46=[];for(var _0x277ee3=0x0;_0x277ee3<_0x115670[_0x234f('0x48')];_0x277ee3++){if(_0x115670[_0x277ee3][_0x234f('0x73')]){_0x11cf46[_0x234f('0x8a')](db['UserVoiceQueueRt'][_0x234f('0x7a')]({'membername':_0x115670[_0x277ee3]['name'],'UserId':_0x115670[_0x277ee3]['id'],'queue_name':_0x993420[_0x234f('0x3b')],'VoiceQueueId':_0x993420['id'],'interface':_[_0x234f('0x7d')](_0x115670[_0x277ee3][_0x234f('0x7e')])?util[_0x234f('0x7f')](_0x234f('0x98'),_0x115670[_0x277ee3][_0x234f('0x3b')]):_0x115670[_0x277ee3][_0x234f('0x7e')],'paused':_0x115670[_0x277ee3][_0x234f('0x74')]||![],'penalty':_0x4b20b7[_0x234f('0x63')][_0x234f('0x77')]||0x0}));}}return BPromise[_0x234f('0x8e')](_0x11cf46);}})[_0x234f('0x2d')](function(){return _0x122eff;})[_0x234f('0x2d')](respondWithResult(_0x2eb251,null))[_0x234f('0x54')](handleError(_0x2eb251,null));};exports[_0x234f('0x93')]=function(_0x2b2d8a,_0x26a26e,_0x67cc32){return db[_0x234f('0x3d')][_0x234f('0x3a')]({'where':{'id':_0x2b2d8a[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x26a26e,null))['then'](function(_0x4d220a){if(_0x4d220a){return _0x4d220a[_0x234f('0x93')](_0x2b2d8a['query']['ids'])[_0x234f('0x2d')](function(){if(_[_0x234f('0x99')](_0x2b2d8a[_0x234f('0x42')]['ids'])){for(var _0x178cf9=0x0;_0x178cf9<_0x2b2d8a[_0x234f('0x42')][_0x234f('0x91')]['length'];_0x178cf9+=0x1){socket[_0x234f('0x95')](_0x234f('0x96'),{'UserId':Number(_0x2b2d8a[_0x234f('0x42')][_0x234f('0x91')][_0x178cf9]),'VoiceQueueId':Number(_0x2b2d8a[_0x234f('0x56')]['id'])});}}else{socket[_0x234f('0x95')](_0x234f('0x96'),{'UserId':Number(_0x2b2d8a[_0x234f('0x42')]['ids']),'VoiceQueueId':Number(_0x2b2d8a[_0x234f('0x56')]['id'])});}});}})['then'](function(_0x4483f1){return db[_0x234f('0x94')][_0x234f('0x2e')]({'where':{'VoiceQueueId':_0x2b2d8a[_0x234f('0x56')]['id'],'UserId':_0x2b2d8a[_0x234f('0x42')][_0x234f('0x91')]}})[_0x234f('0x2d')](function(){return _0x4483f1;});})['then'](respondWithStatusCode(_0x26a26e,null))[_0x234f('0x54')](handleError(_0x26a26e,null));};exports[_0x234f('0x9a')]=function(_0x285834,_0x3808ed,_0x1af05e){var _0x35fe6e={};var _0x5891b7={};var _0xa5bce9;var _0x2efd98;return db[_0x234f('0x3d')][_0x234f('0x66')]({'where':{'id':_0x285834[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x3808ed,null))[_0x234f('0x2d')](function(_0x1eebc1){if(_0x1eebc1){_0xa5bce9=_0x1eebc1;_0x5891b7[_0x234f('0x41')]=_['keys'](db[_0x234f('0x71')]['rawAttributes']);_0x5891b7[_0x234f('0x42')]=_[_0x234f('0x43')](_0x285834[_0x234f('0x42')]);_0x5891b7[_0x234f('0x44')]=_[_0x234f('0x45')](_0x5891b7['model'],_0x5891b7[_0x234f('0x42')]);_0x35fe6e[_0x234f('0x47')]=_[_0x234f('0x45')](_0x5891b7['model'],qs[_0x234f('0x46')](_0x285834['query'][_0x234f('0x46')]));_0x35fe6e['attributes']=_0x35fe6e[_0x234f('0x47')][_0x234f('0x48')]?_0x35fe6e[_0x234f('0x47')]:_0x5891b7[_0x234f('0x41')];_0x35fe6e[_0x234f('0x4b')]=qs[_0x234f('0x4c')](_0x285834[_0x234f('0x42')][_0x234f('0x4c')]);_0x35fe6e['where']=qs['filters'](_['pick'](_0x285834[_0x234f('0x42')],_0x5891b7[_0x234f('0x44')]));if(_0x285834[_0x234f('0x42')]['filter']){_0x35fe6e[_0x234f('0x4d')]=_[_0x234f('0x4f')](_0x35fe6e[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x35fe6e['attributes'],function(_0x368c4f){var _0x112e12={};_0x112e12[_0x368c4f]={'$like':'%'+_0x285834['query'][_0x234f('0x34')]+'%'};return _0x112e12;})});}_0x35fe6e=_['merge']({},_0x35fe6e,_0x285834['options']);return _0xa5bce9[_0x234f('0x9a')](_0x35fe6e);}})[_0x234f('0x2d')](function(_0x3359f7){if(_0x3359f7){_0x2efd98=_0x3359f7[_0x234f('0x48')];if(!_0x285834[_0x234f('0x42')][_0x234f('0x49')](_0x234f('0x4a'))){_0x35fe6e[_0x234f('0x25')]=qs[_0x234f('0x25')](_0x285834[_0x234f('0x42')]['limit']);_0x35fe6e[_0x234f('0x24')]=qs[_0x234f('0x24')](_0x285834[_0x234f('0x42')]['offset']);}return _0xa5bce9[_0x234f('0x9a')](_0x35fe6e);}})[_0x234f('0x2d')](function(_0x31aae4){if(_0x31aae4){return _0x31aae4?{'count':_0x2efd98,'rows':_0x31aae4}:null;}})[_0x234f('0x2d')](respondWithResult(_0x3808ed,null))[_0x234f('0x54')](handleError(_0x3808ed,null));};exports['getMembers']=function(_0xc69cb6,_0x2781ff,_0x101a06){var _0x127d86={};var _0x46302b={};var _0x2e517d;var _0x19fc72;return db['VoiceQueue'][_0x234f('0x66')]({'where':{'id':_0xc69cb6['params']['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2781ff,null))['then'](function(_0x323640){if(_0x323640){_0x2e517d=_0x323640;_0x46302b['model']=_[_0x234f('0x43')](db[_0x234f('0x94')][_0x234f('0x3e')]);_0x46302b[_0x234f('0x42')]=_['keys'](_0xc69cb6[_0x234f('0x42')]);_0x46302b[_0x234f('0x44')]=_[_0x234f('0x45')](_0x46302b['model'],_0x46302b['query']);_0x127d86[_0x234f('0x47')]=_[_0x234f('0x45')](_0x46302b[_0x234f('0x41')],qs['fields'](_0xc69cb6[_0x234f('0x42')][_0x234f('0x46')]));_0x127d86['attributes']=_0x127d86['attributes'][_0x234f('0x48')]?_0x127d86[_0x234f('0x47')]:_0x46302b[_0x234f('0x41')];_0x127d86[_0x234f('0x4b')]=qs['sort'](_0xc69cb6[_0x234f('0x42')]['sort']);_0x127d86[_0x234f('0x4d')]=qs[_0x234f('0x44')](_[_0x234f('0x4e')](_0xc69cb6[_0x234f('0x42')],_0x46302b[_0x234f('0x44')]));if(_0xc69cb6[_0x234f('0x42')][_0x234f('0x34')]){_0x127d86['where']=_[_0x234f('0x4f')](_0x127d86[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x127d86[_0x234f('0x47')],function(_0xa18238){var _0x32b894={};_0x32b894[_0xa18238]={'$like':'%'+_0xc69cb6[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x32b894;})});}_0x127d86=_[_0x234f('0x4f')]({},_0x127d86,_0xc69cb6[_0x234f('0x50')]);return _0x2e517d[_0x234f('0x9b')](_0x127d86);}})[_0x234f('0x2d')](function(_0x3e78fb){if(_0x3e78fb){_0x19fc72=_0x3e78fb[_0x234f('0x48')];if(!_0xc69cb6[_0x234f('0x42')][_0x234f('0x49')](_0x234f('0x4a'))){_0x127d86[_0x234f('0x25')]=qs[_0x234f('0x25')](_0xc69cb6[_0x234f('0x42')][_0x234f('0x25')]);_0x127d86['offset']=qs['offset'](_0xc69cb6[_0x234f('0x42')][_0x234f('0x24')]);}return _0x2e517d['getMembers'](_0x127d86);}})['then'](function(_0x1e325a){return _0x1e325a?{'count':_0x19fc72,'rows':_0x1e325a}:null;})[_0x234f('0x2d')](respondWithResult(_0x2781ff,null))['catch'](handleError(_0x2781ff,null));};exports[_0x234f('0x9c')]=function(_0x17200b,_0x580ddd,_0x4fa285){var _0x11b105={};var _0x35a3f1={};var _0x2671dc;var _0x2f3a21;return db[_0x234f('0x3d')]['findOne']({'where':{'id':_0x17200b[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x580ddd,null))[_0x234f('0x2d')](function(_0x42563a){if(_0x42563a){_0x2671dc=_0x42563a;_0x35a3f1[_0x234f('0x41')]=_['keys'](db['CmList'][_0x234f('0x3e')]);_0x35a3f1['query']=_[_0x234f('0x43')](_0x17200b['query']);_0x35a3f1[_0x234f('0x44')]=_['intersection'](_0x35a3f1[_0x234f('0x41')],_0x35a3f1[_0x234f('0x42')]);_0x11b105['attributes']=_[_0x234f('0x45')](_0x35a3f1[_0x234f('0x41')],qs[_0x234f('0x46')](_0x17200b[_0x234f('0x42')]['fields']));_0x11b105[_0x234f('0x47')]=_0x11b105['attributes']['length']?_0x11b105[_0x234f('0x47')]:_0x35a3f1[_0x234f('0x41')];_0x11b105[_0x234f('0x4b')]=qs[_0x234f('0x4c')](_0x17200b[_0x234f('0x42')][_0x234f('0x4c')]);_0x11b105['where']=qs['filters'](_['pick'](_0x17200b[_0x234f('0x42')],_0x35a3f1['filters']));if(_0x17200b[_0x234f('0x42')]['filter']){_0x11b105['where']=_[_0x234f('0x4f')](_0x11b105[_0x234f('0x4d')],{'$or':_[_0x234f('0x36')](_0x11b105[_0x234f('0x47')],function(_0x329a5a){var _0x1cf338={};_0x1cf338[_0x329a5a]={'$like':'%'+_0x17200b[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x1cf338;})});}_0x11b105=_[_0x234f('0x4f')]({},_0x11b105,_0x17200b['options']);return _0x2671dc['getLists'](_0x11b105);}})['then'](function(_0x103c2e){if(_0x103c2e){_0x2f3a21=_0x103c2e[_0x234f('0x48')];if(!_0x17200b['query'][_0x234f('0x49')](_0x234f('0x4a'))){_0x11b105['limit']=qs[_0x234f('0x25')](_0x17200b[_0x234f('0x42')][_0x234f('0x25')]);_0x11b105[_0x234f('0x24')]=qs[_0x234f('0x24')](_0x17200b[_0x234f('0x42')][_0x234f('0x24')]);}return _0x2671dc['getLists'](_0x11b105);}})['then'](function(_0x4bf5d3){if(_0x4bf5d3){return _0x4bf5d3?{'count':_0x2f3a21,'rows':_0x4bf5d3}:null;}})[_0x234f('0x2d')](respondWithResult(_0x580ddd,null))[_0x234f('0x54')](handleError(_0x580ddd,null));};exports[_0x234f('0x9d')]=function(_0x2ebb5b,_0x5d3e60,_0x446332){var _0x4877fa=moment()[_0x234f('0x7f')](_0x234f('0x9e'));var _0x237454,_0x877e3;return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x2ebb5b['params']['id']}})['then'](handleEntityNotFound(_0x5d3e60,null))[_0x234f('0x2d')](function(_0x146d0c){if(_0x146d0c){_0x877e3=_0x146d0c;return _0x146d0c[_0x234f('0x9d')](_0x2ebb5b[_0x234f('0x63')][_0x234f('0x91')],_[_0x234f('0x61')](_0x2ebb5b[_0x234f('0x63')],[_0x234f('0x91'),'id'])||{});}return null;})['spread'](function(_0x5961bc){var _0x464185;_0x237454=_0x5961bc||[];var _0x3f8fbe=[];if(_0x5961bc){for(var _0x386c8c=0x0;_0x386c8c<_0x5961bc[_0x234f('0x48')];_0x386c8c+=0x1){var _0x36ac78=_0x5961bc[_0x386c8c][_0x234f('0x2f')]({'plain':!![]});_0x877e3['dialCheckDuplicateType']=_0x2ebb5b[_0x234f('0x63')][_0x234f('0x9f')]?_0x2ebb5b['body'][_0x234f('0x9f')]:_0x877e3[_0x234f('0x9f')];switch(_0x877e3[_0x234f('0x9f')]){case _0x234f('0xa0'):_0x464185=squel[_0x234f('0xa1')]()[_0x234f('0xa2')](_0x234f('0xa3'))[_0x234f('0xa4')]([_0x234f('0xa5'),_0x234f('0xa6'),_0x234f('0xa7'),_0x234f('0xa8'),_0x234f('0x67'),'createdAt',_0x234f('0x62')],squel['select']()[_0x234f('0x83')](_0x234f('0xa5'),_0x234f('0xa5'))['field']('\x27'+_0x4877fa+'\x27',_0x234f('0xa6'))[_0x234f('0x83')]('id',_0x234f('0xa7'))['field'](_0x36ac78[_0x234f('0xa9')][_0x234f('0xaa')](),'ListId')[_0x234f('0x83')](_0x2ebb5b['params']['id'][_0x234f('0xaa')](),_0x234f('0x67'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0xab'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0x62'))[_0x234f('0x84')](_0x234f('0xac'))[_0x234f('0x4d')]('deletedAt\x20IS\x20NULL')[_0x234f('0x4d')](_0x234f('0xad'),_0x36ac78[_0x234f('0xa9')][_0x234f('0xaa')]())[_0x234f('0x4d')](_0x234f('0xae'))[_0x234f('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x234f('0x82')]()[_0x234f('0x83')](_0x234f('0xaf'))[_0x234f('0x84')](_0x234f('0xb0'))[_0x234f('0x4d')](_0x234f('0x88'),_0x2ebb5b[_0x234f('0x56')]['id'][_0x234f('0xaa')]()))[_0x234f('0x4d')](_0x234f('0xb1'),squel[_0x234f('0x82')]()[_0x234f('0x83')](_0x234f('0xb2'))[_0x234f('0x84')](_0x234f('0xa3'))[_0x234f('0x4d')](_0x234f('0x88'),_0x2ebb5b[_0x234f('0x56')]['id'][_0x234f('0xaa')]())))[_0x234f('0xaa')]();break;case'onlyIfOpen':_0x464185=squel[_0x234f('0xa1')]()[_0x234f('0xa2')]('cm_hopper')[_0x234f('0xa4')]([_0x234f('0xa5'),_0x234f('0xa6'),_0x234f('0xa7'),_0x234f('0xa8'),_0x234f('0x67'),_0x234f('0xab'),_0x234f('0x62')],squel[_0x234f('0x82')]()[_0x234f('0x83')](_0x234f('0xa5'),_0x234f('0xa5'))['field']('\x27'+_0x4877fa+'\x27','scheduledAt')[_0x234f('0x83')]('id',_0x234f('0xa7'))[_0x234f('0x83')](_0x36ac78[_0x234f('0xa9')][_0x234f('0xaa')](),_0x234f('0xa8'))['field'](_0x2ebb5b[_0x234f('0x56')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x4877fa+'\x27','createdAt')[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0x62'))[_0x234f('0x84')]('cm_contacts')[_0x234f('0x4d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x36ac78[_0x234f('0xa9')]['toString']())[_0x234f('0x4d')]('phone\x20IS\x20NOT\x20NULL')[_0x234f('0x4d')](_0x234f('0xb1'),squel[_0x234f('0x82')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x234f('0xa3'))[_0x234f('0x4d')](_0x234f('0x88'),_0x2ebb5b[_0x234f('0x56')]['id'][_0x234f('0xaa')]())))[_0x234f('0xaa')]();break;default:_0x464185=squel[_0x234f('0xa1')]()[_0x234f('0xa2')](_0x234f('0xa3'))['fromQuery']([_0x234f('0xa5'),_0x234f('0xa6'),_0x234f('0xa7'),_0x234f('0xa8'),_0x234f('0x67'),'createdAt','updatedAt'],squel[_0x234f('0x82')]()[_0x234f('0x83')](_0x234f('0xa5'),_0x234f('0xa5'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0xa6'))[_0x234f('0x83')]('id',_0x234f('0xa7'))[_0x234f('0x83')](_0x36ac78[_0x234f('0xa9')][_0x234f('0xaa')](),'ListId')['field'](_0x2ebb5b['params']['id'][_0x234f('0xaa')](),_0x234f('0x67'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27','createdAt')['field']('\x27'+_0x4877fa+'\x27','updatedAt')[_0x234f('0x84')](_0x234f('0xac'))['where'](_0x234f('0xb3'))[_0x234f('0x4d')](_0x234f('0xad'),_0x36ac78[_0x234f('0xa9')][_0x234f('0xaa')]())[_0x234f('0x4d')](_0x234f('0xae')))['toString']();}_0x3f8fbe[_0x234f('0x8a')](db['sequelize'][_0x234f('0x42')](_0x464185));}return BPromise[_0x234f('0x8e')](_0x3f8fbe);}})[_0x234f('0x2d')](function(){var _0x12bf2a=[];var _0x288026=squel[_0x234f('0xa1')]()[_0x234f('0xa2')](_0x234f('0xb4'))[_0x234f('0xa4')]([_0x234f('0xb5'),'phone','OrderBy',_0x234f('0xab'),_0x234f('0x62')],squel[_0x234f('0x82')]()[_0x234f('0x83')](_0x234f('0xb6'))[_0x234f('0x83')](_0x234f('0xb7'))[_0x234f('0x83')](_0x234f('0xb8'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0xab'))[_0x234f('0x83')]('\x27'+_0x4877fa+'\x27',_0x234f('0x62'))[_0x234f('0x84')]('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x234f('0xb9'))[_0x234f('0x4d')](_0x234f('0xba'),_0x4877fa)[_0x234f('0x4d')](_0x234f('0xbb'),_0x234f('0xbc')))[_0x234f('0xaa')]();_0x12bf2a[_0x234f('0x8a')](db[_0x234f('0x8b')][_0x234f('0x42')](_0x288026));return BPromise[_0x234f('0x8e')](_0x12bf2a);})[_0x234f('0x2d')](function(){return _0x237454;})['then'](respondWithResult(_0x5d3e60,null))[_0x234f('0x54')](handleError(_0x5d3e60,null));};exports[_0x234f('0xbd')]=function(_0x459a06,_0x3ed9a8,_0xb4e3ed){return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x459a06[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x3ed9a8,null))['then'](function(_0x48ca2e){if(_0x48ca2e){return _0x48ca2e[_0x234f('0xbd')](_0x459a06[_0x234f('0x42')][_0x234f('0x91')]);}})[_0x234f('0x2d')](function(_0xb292c9){if(_0xb292c9){return db[_0x234f('0x68')][_0x234f('0x2e')]({'where':{'ListId':_0x459a06['query'][_0x234f('0x91')],'VoiceQueueId':_0x459a06[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](function(){return _0xb292c9;});}})[_0x234f('0x2d')](respondWithStatusCode(_0x3ed9a8,null))[_0x234f('0x54')](handleError(_0x3ed9a8,null));};exports[_0x234f('0xbe')]=function(_0x5981a5,_0x2ddf1a,_0x417a7c){var _0xbe83f1={};var _0x309dfb={};var _0x4784b2;var _0x46759e;return db[_0x234f('0x3d')]['findOne']({'where':{'id':_0x5981a5[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2ddf1a,null))[_0x234f('0x2d')](function(_0x117fbd){if(_0x117fbd){_0x4784b2=_0x117fbd;_0x309dfb['model']=_[_0x234f('0x43')](db[_0x234f('0xbf')]['rawAttributes']);_0x309dfb[_0x234f('0x42')]=_[_0x234f('0x43')](_0x5981a5[_0x234f('0x42')]);_0x309dfb[_0x234f('0x44')]=_[_0x234f('0x45')](_0x309dfb[_0x234f('0x41')],_0x309dfb['query']);_0xbe83f1[_0x234f('0x47')]=_[_0x234f('0x45')](_0x309dfb[_0x234f('0x41')],qs['fields'](_0x5981a5['query'][_0x234f('0x46')]));_0xbe83f1[_0x234f('0x47')]=_0xbe83f1[_0x234f('0x47')][_0x234f('0x48')]?_0xbe83f1[_0x234f('0x47')]:_0x309dfb[_0x234f('0x41')];_0xbe83f1['order']=qs[_0x234f('0x4c')](_0x5981a5[_0x234f('0x42')][_0x234f('0x4c')]);_0xbe83f1[_0x234f('0x4d')]=qs['filters'](_[_0x234f('0x4e')](_0x5981a5['query'],_0x309dfb[_0x234f('0x44')]));if(_0x5981a5[_0x234f('0x42')][_0x234f('0x34')]){_0xbe83f1[_0x234f('0x4d')]=_[_0x234f('0x4f')](_0xbe83f1[_0x234f('0x4d')],{'$or':_['map'](_0xbe83f1[_0x234f('0x47')],function(_0x513d94){var _0x4b93dd={};_0x4b93dd[_0x513d94]={'$like':'%'+_0x5981a5[_0x234f('0x42')][_0x234f('0x34')]+'%'};return _0x4b93dd;})});}_0xbe83f1=_[_0x234f('0x4f')]({},_0xbe83f1,_0x5981a5['options']);return _0x4784b2['getBlackLists'](_0xbe83f1);}})['then'](function(_0x598dcb){if(_0x598dcb){_0x46759e=_0x598dcb['length'];if(!_0x5981a5[_0x234f('0x42')]['hasOwnProperty'](_0x234f('0x4a'))){_0xbe83f1[_0x234f('0x25')]=qs[_0x234f('0x25')](_0x5981a5[_0x234f('0x42')][_0x234f('0x25')]);_0xbe83f1[_0x234f('0x24')]=qs[_0x234f('0x24')](_0x5981a5[_0x234f('0x42')]['offset']);}return _0x4784b2[_0x234f('0xbe')](_0xbe83f1);}})['then'](function(_0x186a9e){if(_0x186a9e){return _0x186a9e?{'count':_0x46759e,'rows':_0x186a9e}:null;}})[_0x234f('0x2d')](respondWithResult(_0x2ddf1a,null))['catch'](handleError(_0x2ddf1a,null));};exports[_0x234f('0xc0')]=function(_0x7da7ce,_0x35a8f5,_0x2f3aa5){var _0x261547,_0x15ecac;return db['VoiceQueue'][_0x234f('0x3a')]({'where':{'id':_0x7da7ce[_0x234f('0x56')]['id']}})['then'](handleEntityNotFound(_0x35a8f5,null))['then'](function(_0x3309b6){if(_0x3309b6){_0x15ecac=_0x3309b6;return _0x3309b6['addBlackLists'](_0x7da7ce[_0x234f('0x63')][_0x234f('0x91')],_['omit'](_0x7da7ce['body'],['ids','id'])||{});}return null;})['spread'](function(_0x12834e){var _0x5c44f8;_0x261547=_0x12834e||[];var _0x51676a=[];if(_0x12834e){for(var _0x1294ec=0x0;_0x1294ec<_0x12834e[_0x234f('0x48')];_0x1294ec+=0x1){var _0x3ca67a=_0x12834e[_0x1294ec]['get']({'plain':!![]});_0x5c44f8=squel['insert']()['into'](_0x234f('0xc1'))[_0x234f('0xa4')](['phone',_0x234f('0xa7'),_0x234f('0xa8'),'VoiceQueueId','createdAt',_0x234f('0x62')],squel[_0x234f('0x82')]()['field'](_0x234f('0xa5'),_0x234f('0xa5'))[_0x234f('0x83')]('id',_0x234f('0xa7'))[_0x234f('0x83')](_0x3ca67a['CmListId'][_0x234f('0xaa')](),_0x234f('0xa8'))[_0x234f('0x83')](_0x7da7ce['params']['id'][_0x234f('0xaa')](),_0x234f('0x67'))['field']('NOW()',_0x234f('0xab'))['field'](_0x234f('0xc2'),_0x234f('0x62'))[_0x234f('0x84')]('cm_contacts')[_0x234f('0x4d')]('deletedAt\x20IS\x20NULL')[_0x234f('0x4d')](_0x234f('0xad'),_0x3ca67a[_0x234f('0xa9')][_0x234f('0xaa')]())[_0x234f('0x4d')](_0x234f('0xae')))['toString']();_0x51676a[_0x234f('0x8a')](db[_0x234f('0x8b')][_0x234f('0x42')](_0x5c44f8));}return BPromise[_0x234f('0x8e')](_0x51676a);}})[_0x234f('0x2d')](function(){return _0x261547;})[_0x234f('0x2d')](respondWithResult(_0x35a8f5,null))['catch'](handleError(_0x35a8f5,null));};exports[_0x234f('0xc3')]=function(_0x218804,_0x2c8b3e,_0x2924e3){return db[_0x234f('0x3d')]['find']({'where':{'id':_0x218804[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](handleEntityNotFound(_0x2c8b3e,null))[_0x234f('0x2d')](function(_0x5ca227){if(_0x5ca227){return _0x5ca227[_0x234f('0xc3')](_0x218804[_0x234f('0x42')]['ids']);}})[_0x234f('0x2d')](function(_0x29cd18){if(_0x29cd18){return db[_0x234f('0x6e')][_0x234f('0x2e')]({'where':{'ListId':_0x218804['query'][_0x234f('0x91')],'VoiceQueueId':_0x218804[_0x234f('0x56')]['id']}})[_0x234f('0x2d')](function(){return _0x29cd18;});}})[_0x234f('0x2d')](respondWithStatusCode(_0x2c8b3e,null))[_0x234f('0x54')](handleError(_0x2c8b3e,null));}; \ No newline at end of file +var _0x8085=['Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','find','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt','updatedAt','body','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','isEmpty','removeAgents','addAgents','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','scheduledAt','ContactId','ListId','phone','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','includes','type','value','name','UserProfileResource','stack','send','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','VoiceQueue','includeAll','include','findAll','show','params','catch','create','user'];(function(_0x4222b5,_0x37422c){var _0x425d4c=function(_0x53e442){while(--_0x53e442){_0x4222b5['push'](_0x4222b5['shift']());}};_0x425d4c(++_0x37422c);}(_0x8085,0x71));var _0x5808=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x8085[_0x2a5099];return _0x2802f1;};'use strict';var emlformat=require(_0x5808('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5808('0x1'));var rp=require(_0x5808('0x2'));var moment=require(_0x5808('0x3'));var BPromise=require(_0x5808('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5808('0x5'));var sox=require(_0x5808('0x6'));var csv=require('to-csv');var ejs=require(_0x5808('0x7'));var fs=require('fs');var fs_extra=require(_0x5808('0x8'));var _=require(_0x5808('0x9'));var squel=require(_0x5808('0xa'));var crypto=require(_0x5808('0xb'));var jsforce=require(_0x5808('0xc'));var deskjs=require(_0x5808('0xd'));var toCsv=require(_0x5808('0xe'));var querystring=require(_0x5808('0xf'));var Papa=require(_0x5808('0x10'));var Redis=require(_0x5808('0x11'));var authService=require(_0x5808('0x12'));var qs=require(_0x5808('0x13'));var as=require(_0x5808('0x14'));var hardwareService=require(_0x5808('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5808('0x16'));var config=require(_0x5808('0x17'));var licenseUtil=require(_0x5808('0x18'));var db=require(_0x5808('0x19'))['db'];config[_0x5808('0x1a')]=_[_0x5808('0x1b')](config[_0x5808('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5808('0x1a')]));require(_0x5808('0x1c'))[_0x5808('0x1d')](socket);function respondWithStatusCode(_0x3e7c09,_0x89198e){_0x89198e=_0x89198e||0xcc;return function(_0x37d739){if(_0x37d739){return _0x3e7c09[_0x5808('0x1e')](_0x89198e);}return _0x3e7c09[_0x5808('0x1f')](_0x89198e)[_0x5808('0x20')]();};}function respondWithResult(_0x46dd8a,_0x29785d){_0x29785d=_0x29785d||0xc8;return function(_0x478e29){if(_0x478e29){return _0x46dd8a[_0x5808('0x1f')](_0x29785d)['json'](_0x478e29);}};}function respondWithFilteredResult(_0x406e65,_0x25dc4e){return function(_0x3bf0ee){if(_0x3bf0ee){var _0x529a0d=typeof _0x25dc4e[_0x5808('0x21')]===_0x5808('0x22')&&typeof _0x25dc4e['limit']==='undefined';var _0x3c7c02=_0x3bf0ee['count'];var _0x40cfbd=_0x529a0d?0x0:_0x25dc4e[_0x5808('0x21')];var _0x480165=_0x529a0d?_0x3bf0ee[_0x5808('0x23')]:_0x25dc4e['offset']+_0x25dc4e['limit'];var _0xe82ad0;if(_0x480165>=_0x3c7c02){_0x480165=_0x3c7c02;_0xe82ad0=0xc8;}else{_0xe82ad0=0xce;}_0x406e65[_0x5808('0x1f')](_0xe82ad0);return _0x406e65[_0x5808('0x24')](_0x5808('0x25'),_0x40cfbd+'-'+_0x480165+'/'+_0x3c7c02)[_0x5808('0x26')](_0x3bf0ee);}return null;};}function patchUpdates(_0x33b583){return function(_0x1027ba){try{jsonpatch[_0x5808('0x27')](_0x1027ba,_0x33b583,!![]);}catch(_0x3a575e){return BPromise['reject'](_0x3a575e);}return _0x1027ba['save']();};}function saveUpdates(_0x130590,_0x168a67){return function(_0x5048a1){if(_0x5048a1){return _0x5048a1['update'](_0x130590)[_0x5808('0x28')](function(_0x467500){return _0x467500;});}return null;};}function removeEntity(_0x1dddbd,_0x4a4d05){return function(_0x49fc46){if(_0x49fc46){return _0x49fc46[_0x5808('0x29')]()[_0x5808('0x28')](function(){var _0x27c991=_0x49fc46[_0x5808('0x2a')]({'plain':!![]});var _0x1da724=[{'name':'VoiceQueues','value':_0x5808('0x2b'),'ignore':![]},{'name':_0x5808('0x2c'),'value':_0x5808('0x2d'),'ignore':![]}];var _0x2f878f=_(_0x1da724)[_0x5808('0x2e')](_0x5808('0x2f'))[_0x5808('0x30')]('value')['value']();if(_[_0x5808('0x31')](_0x2f878f,_0x27c991[_0x5808('0x32')])){return;}var _0x5cfc6b=_['find'](_0x1da724,[_0x5808('0x33'),_0x27c991[_0x5808('0x32')]])[_0x5808('0x34')];return db[_0x5808('0x35')][_0x5808('0x29')]({'where':{'type':_0x5cfc6b,'resourceId':_0x27c991['id']}})[_0x5808('0x28')](function(){return _0x49fc46;});})['then'](function(){_0x1dddbd[_0x5808('0x1f')](0xcc)[_0x5808('0x20')]();});}};}function handleEntityNotFound(_0x43c847,_0x4f7a9d){return function(_0x5214c8){if(!_0x5214c8){_0x43c847[_0x5808('0x1e')](0x194);}return _0x5214c8;};}function handleError(_0x49eafd,_0x28bae4){_0x28bae4=_0x28bae4||0x1f4;return function(_0x459b48){logger['error'](_0x459b48[_0x5808('0x36')]);if(_0x459b48[_0x5808('0x34')]){delete _0x459b48['name'];}_0x49eafd['status'](_0x28bae4)[_0x5808('0x37')](_0x459b48);};}exports['index']=function(_0x103f72,_0x5a0f28){var _0x35f547={},_0x334cd5={},_0x2b6fc8={'count':0x0,'rows':[]};var _0x5e0696=_[_0x5808('0x30')](db['VoiceQueue'][_0x5808('0x38')],function(_0x5ad24f){return{'name':_0x5ad24f['fieldName'],'type':_0x5ad24f[_0x5808('0x32')][_0x5808('0x39')]};});_0x334cd5[_0x5808('0x3a')]=_['map'](_0x5e0696,'name');_0x334cd5[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x103f72['query']);_0x334cd5[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x334cd5[_0x5808('0x3a')],_0x334cd5['query']);_0x35f547[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x334cd5[_0x5808('0x3a')],qs['fields'](_0x103f72[_0x5808('0x3b')][_0x5808('0x40')]));_0x35f547['attributes']=_0x35f547['attributes'][_0x5808('0x41')]?_0x35f547['attributes']:_0x334cd5[_0x5808('0x3a')];if(!_0x103f72[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0x35f547[_0x5808('0x44')]=qs['limit'](_0x103f72['query'][_0x5808('0x44')]);_0x35f547[_0x5808('0x21')]=qs[_0x5808('0x21')](_0x103f72['query'][_0x5808('0x21')]);}_0x35f547[_0x5808('0x45')]=qs[_0x5808('0x46')](_0x103f72[_0x5808('0x3b')][_0x5808('0x46')]);_0x35f547['where']=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x103f72[_0x5808('0x3b')],_0x334cd5['filters']),_0x5e0696);if(_0x103f72[_0x5808('0x3b')][_0x5808('0x2e')]){_0x35f547[_0x5808('0x48')]=_['merge'](_0x35f547['where'],{'$or':_[_0x5808('0x30')](_0x5e0696,function(_0x37bc28){if(_0x37bc28[_0x5808('0x32')]!==_0x5808('0x49')){var _0x2fe11d={};_0x2fe11d[_0x37bc28[_0x5808('0x34')]]={'$like':'%'+_0x103f72[_0x5808('0x3b')][_0x5808('0x2e')]+'%'};return _0x2fe11d;}})});}_0x35f547=_[_0x5808('0x4a')]({},_0x35f547,_0x103f72[_0x5808('0x4b')]);var _0x2bd9cd={'where':_0x35f547[_0x5808('0x48')]};return db[_0x5808('0x4c')]['count'](_0x2bd9cd)['then'](function(_0x1adbef){_0x2b6fc8[_0x5808('0x23')]=_0x1adbef;if(_0x103f72[_0x5808('0x3b')][_0x5808('0x4d')]){_0x35f547[_0x5808('0x4e')]=[{'all':!![]}];}return db[_0x5808('0x4c')][_0x5808('0x4f')](_0x35f547);})['then'](function(_0x5cf743){_0x2b6fc8['rows']=_0x5cf743;return _0x2b6fc8;})[_0x5808('0x28')](respondWithFilteredResult(_0x5a0f28,_0x35f547))['catch'](handleError(_0x5a0f28,null));};exports[_0x5808('0x50')]=function(_0x507bb5,_0x5a8134){var _0x5006e3={'raw':![],'where':{'id':_0x507bb5[_0x5808('0x51')]['id']}},_0x15eeef={};_0x15eeef['model']=_[_0x5808('0x3c')](db[_0x5808('0x4c')][_0x5808('0x38')]);_0x15eeef['query']=_[_0x5808('0x3c')](_0x507bb5['query']);_0x15eeef[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x15eeef[_0x5808('0x3a')],_0x15eeef['query']);_0x5006e3[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x15eeef[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x507bb5['query'][_0x5808('0x40')]));_0x5006e3[_0x5808('0x3f')]=_0x5006e3[_0x5808('0x3f')][_0x5808('0x41')]?_0x5006e3[_0x5808('0x3f')]:_0x15eeef[_0x5808('0x3a')];if(_0x507bb5['query'][_0x5808('0x4d')]){_0x5006e3[_0x5808('0x4e')]=[{'all':!![]}];}_0x5006e3=_[_0x5808('0x4a')]({},_0x5006e3,_0x507bb5[_0x5808('0x4b')]);return db[_0x5808('0x4c')]['find'](_0x5006e3)[_0x5808('0x28')](handleEntityNotFound(_0x5a8134,null))[_0x5808('0x28')](respondWithResult(_0x5a8134,null))[_0x5808('0x52')](handleError(_0x5a8134,null));};exports[_0x5808('0x53')]=function(_0x1a45e9,_0x10551b){return db['VoiceQueue'][_0x5808('0x53')](_0x1a45e9['body'],{})[_0x5808('0x28')](function(_0x30b7d9){var _0x5a751d=_0x1a45e9[_0x5808('0x54')][_0x5808('0x2a')]({'plain':!![]});if(!_0x5a751d)throw new Error(_0x5808('0x55'));if(_0x5a751d['role']===_0x5808('0x54')){var _0x31ce12=_0x30b7d9['get']({'plain':!![]});var _0x2921b4=[{'name':_0x5808('0x56'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x5808('0x2d')}];var _0x58ecc0=_[_0x5808('0x57')](_0x2921b4,['value',_0x31ce12['type']])[_0x5808('0x34')];return db[_0x5808('0x58')][_0x5808('0x57')]({'where':{'name':_0x58ecc0,'userProfileId':_0x5a751d[_0x5808('0x59')]},'raw':!![]})[_0x5808('0x28')](function(_0x72ea89){if(_0x72ea89&&_0x72ea89[_0x5808('0x5a')]===0x0){return db[_0x5808('0x35')][_0x5808('0x53')]({'name':_0x31ce12[_0x5808('0x34')],'resourceId':_0x31ce12['id'],'type':_0x72ea89['name'],'sectionId':_0x72ea89['id']},{})['then'](function(){return _0x30b7d9;});}else{return _0x30b7d9;}})['catch'](function(_0x244b43){logger[_0x5808('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x244b43);throw _0x244b43;});}return _0x30b7d9;})[_0x5808('0x28')](respondWithResult(_0x10551b,0xc9))['catch'](handleError(_0x10551b,null));};exports[_0x5808('0x5c')]=function(_0xab1ed1,_0x2f72a8){var _0x243a14={'where':{'id':_0xab1ed1[_0x5808('0x51')]['id']}},_0x199644={};_0x199644[_0x5808('0x3a')]=_[_0x5808('0x3c')](db[_0x5808('0x4c')][_0x5808('0x38')]);_0x243a14['attributes']=_[_0x5808('0x3e')](_0x199644[_0x5808('0x3a')],qs[_0x5808('0x40')](_0xab1ed1[_0x5808('0x3b')][_0x5808('0x40')]));_0x243a14[_0x5808('0x3f')]=_0x243a14['attributes']['length']?_0x243a14['attributes']:_0x199644[_0x5808('0x3a')];if(_0xab1ed1[_0x5808('0x3b')]['includeAll']){_0x243a14[_0x5808('0x4e')]=[{'all':!![]}];}_0x243a14=_[_0x5808('0x4a')]({},_0x243a14,_0xab1ed1[_0x5808('0x4b')]);return db[_0x5808('0x4c')][_0x5808('0x57')](_0x243a14)[_0x5808('0x28')](handleEntityNotFound(_0x2f72a8,null))['then'](function(_0x5a5b8c){if(_0x5a5b8c){var _0x141131=_0x5a5b8c[_0x5808('0x2a')]({'plain':!![]});_0x141131=qs[_0x5808('0x5d')](_0x141131,['id',_0x5808('0x5e'),_0x5808('0x5f')]);_0xab1ed1['body']=_[_0x5808('0x5d')](_0xab1ed1[_0x5808('0x60')],['id',_0x5808('0x5e'),_0x5808('0x5f')]);return db[_0x5808('0x4c')]['create'](_[_0x5808('0x4a')](_0x141131,_0xab1ed1[_0x5808('0x60')]),{'include':_0xab1ed1[_0x5808('0x3b')][_0x5808('0x4d')]?[{'all':!![]}]:undefined})[_0x5808('0x28')](function(_0x15141e){var _0x46cfdb=_0xab1ed1[_0x5808('0x54')][_0x5808('0x2a')]({'plain':!![]});if(!_0x46cfdb)throw new Error(_0x5808('0x55'));if(_0x46cfdb[_0x5808('0x61')]==='user'){var _0x5aa671=_0x15141e[_0x5808('0x2a')]({'plain':!![]});var _0x2aff0c=[{'name':_0x5808('0x56'),'value':'inbound'},{'name':_0x5808('0x2c'),'value':_0x5808('0x2d')}];var _0x52752b=_[_0x5808('0x57')](_0x2aff0c,[_0x5808('0x33'),_0x5aa671['type']])[_0x5808('0x34')];return db[_0x5808('0x58')][_0x5808('0x57')]({'where':{'name':_0x52752b,'userProfileId':_0x46cfdb[_0x5808('0x59')]},'raw':!![]})['then'](function(_0x4f0445){if(_0x4f0445&&_0x4f0445[_0x5808('0x5a')]===0x0){return db[_0x5808('0x35')][_0x5808('0x53')]({'name':_0x5aa671[_0x5808('0x34')],'resourceId':_0x5aa671['id'],'type':_0x4f0445[_0x5808('0x34')],'sectionId':_0x4f0445['id']},{})['then'](function(){return _0x15141e;});}else{return _0x15141e;}})['catch'](function(_0x1373c0){logger['error'](_0x5808('0x62'),_0x1373c0);throw _0x1373c0;});}return _0x15141e;});}})['then'](respondWithResult(_0x2f72a8,0xc9))[_0x5808('0x52')](handleError(_0x2f72a8,null));};exports[_0x5808('0x63')]=function(_0x4fecf9,_0x1a1066){if(_0x4fecf9[_0x5808('0x60')]['id']){delete _0x4fecf9[_0x5808('0x60')]['id'];}return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0x4fecf9[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x1a1066,null))['then'](saveUpdates(_0x4fecf9['body'],null))[_0x5808('0x28')](respondWithResult(_0x1a1066,null))[_0x5808('0x52')](handleError(_0x1a1066,null));};exports[_0x5808('0x29')]=function(_0x48071f,_0x4036ed){return db['VoiceQueue']['find']({'where':{'id':_0x48071f['params']['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x4036ed,null))['then'](removeEntity(_0x4036ed,null))[_0x5808('0x52')](handleError(_0x4036ed,null));};exports[_0x5808('0x64')]=function(_0x22cbce,_0x5695b8,_0x191c70){var _0x41f8a5={'raw':![],'where':{}};var _0x5b33ad={};var _0xa00c53={'count':0x0,'rows':[]};return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x22cbce[_0x5808('0x51')]['id']}})['then'](handleEntityNotFound(_0x5695b8,null))[_0x5808('0x28')](function(_0x5e9e09){if(_0x5e9e09){_0x5b33ad[_0x5808('0x3a')]=_['keys'](db[_0x5808('0x66')][_0x5808('0x38')]);_0x5b33ad['query']=_[_0x5808('0x3c')](_0x22cbce[_0x5808('0x3b')]);_0x5b33ad[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x5b33ad[_0x5808('0x3a')],_0x5b33ad[_0x5808('0x3b')]);_0x41f8a5[_0x5808('0x3f')]=_['intersection'](_0x5b33ad[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x22cbce['query'][_0x5808('0x40')]));_0x41f8a5[_0x5808('0x3f')]=_0x41f8a5[_0x5808('0x3f')]['length']?_0x41f8a5[_0x5808('0x3f')]:_0x5b33ad[_0x5808('0x3a')];if(!_0x22cbce[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0x41f8a5[_0x5808('0x44')]=qs[_0x5808('0x44')](_0x22cbce[_0x5808('0x3b')][_0x5808('0x44')]);_0x41f8a5[_0x5808('0x21')]=qs['offset'](_0x22cbce[_0x5808('0x3b')][_0x5808('0x21')]);}_0x41f8a5[_0x5808('0x45')]=qs['sort'](_0x22cbce[_0x5808('0x3b')]['sort']);_0x41f8a5[_0x5808('0x48')]=qs['filters'](_[_0x5808('0x47')](_0x22cbce[_0x5808('0x3b')],_0x5b33ad[_0x5808('0x3d')]));_0x41f8a5['where']['VoiceQueueId']=_0x5e9e09['id'];if(_0x22cbce['query']['filter']){_0x41f8a5[_0x5808('0x48')]=_[_0x5808('0x4a')](_0x41f8a5['where'],{'$or':_[_0x5808('0x30')](_0x41f8a5[_0x5808('0x3f')],function(_0x411d20){var _0x3966e5={};_0x3966e5[_0x411d20]={'$like':'%'+_0x22cbce[_0x5808('0x3b')]['filter']+'%'};return _0x3966e5;})});}_0x41f8a5=_[_0x5808('0x4a')]({},_0x41f8a5,_0x22cbce[_0x5808('0x4b')]);return db[_0x5808('0x66')][_0x5808('0x23')]({'where':_0x41f8a5[_0x5808('0x48')]})['then'](function(_0x23a320){_0xa00c53[_0x5808('0x23')]=_0x23a320;if(_0x22cbce[_0x5808('0x3b')][_0x5808('0x4d')]){_0x41f8a5[_0x5808('0x4e')]=[{'all':!![]}];}return db[_0x5808('0x66')][_0x5808('0x4f')](_0x41f8a5);})[_0x5808('0x28')](function(_0xe6112f){_0xa00c53[_0x5808('0x67')]=_0xe6112f;return _0xa00c53;});}})[_0x5808('0x28')](respondWithFilteredResult(_0x5695b8,_0x41f8a5))[_0x5808('0x52')](handleError(_0x5695b8,null));};exports[_0x5808('0x68')]=function(_0x85de96,_0x5dbae7,_0x3a3019){var _0x2daf55={'raw':!![],'where':{}};var _0x359091={};var _0x8455bb={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x85de96[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x5dbae7,null))[_0x5808('0x28')](function(_0x223baa){if(_0x223baa){_0x359091[_0x5808('0x3a')]=_[_0x5808('0x3c')](db[_0x5808('0x69')][_0x5808('0x38')]);_0x359091[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x85de96[_0x5808('0x3b')]);_0x359091[_0x5808('0x3d')]=_['intersection'](_0x359091[_0x5808('0x3a')],_0x359091['query']);_0x2daf55[_0x5808('0x3f')]=_['intersection'](_0x359091['model'],qs['fields'](_0x85de96[_0x5808('0x3b')][_0x5808('0x40')]));_0x2daf55['attributes']=_0x2daf55['attributes'][_0x5808('0x41')]?_0x2daf55[_0x5808('0x3f')]:_0x359091[_0x5808('0x3a')];if(!_0x85de96[_0x5808('0x3b')]['hasOwnProperty'](_0x5808('0x43'))){_0x2daf55[_0x5808('0x44')]=qs['limit'](_0x85de96[_0x5808('0x3b')]['limit']);_0x2daf55[_0x5808('0x21')]=qs['offset'](_0x85de96['query']['offset']);}_0x2daf55['order']=qs[_0x5808('0x46')](_0x85de96[_0x5808('0x3b')][_0x5808('0x46')]);_0x2daf55['where']=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x85de96[_0x5808('0x3b')],_0x359091[_0x5808('0x3d')]));_0x2daf55[_0x5808('0x48')][_0x5808('0x6a')]=_0x223baa['id'];if(_0x85de96[_0x5808('0x3b')]['filter']){_0x2daf55[_0x5808('0x48')]=_['merge'](_0x2daf55[_0x5808('0x48')],{'$or':_[_0x5808('0x30')](_0x2daf55['attributes'],function(_0x555ef0){var _0x45fddc={};_0x45fddc[_0x555ef0]={'$like':'%'+_0x85de96[_0x5808('0x3b')][_0x5808('0x2e')]+'%'};return _0x45fddc;})});}_0x2daf55=_[_0x5808('0x4a')]({},_0x2daf55,_0x85de96[_0x5808('0x4b')]);return db[_0x5808('0x69')][_0x5808('0x23')]({'where':_0x2daf55[_0x5808('0x48')]})[_0x5808('0x28')](function(_0x1e464d){_0x8455bb[_0x5808('0x23')]=_0x1e464d;if(_0x85de96[_0x5808('0x3b')][_0x5808('0x4d')]){_0x2daf55[_0x5808('0x4e')]=[{'all':!![]}];}return db[_0x5808('0x69')][_0x5808('0x4f')](_0x2daf55);})['then'](function(_0x53086c){_0x8455bb['rows']=_0x53086c;return _0x8455bb;});}})['then'](respondWithFilteredResult(_0x5dbae7,_0x2daf55))['catch'](handleError(_0x5dbae7,null));};exports['getHopperFinals']=function(_0x57b9a9,_0x21accd,_0x21e0d6){var _0x1e90ac={'raw':!![],'where':{}};var _0x239c38={};var _0x3d6033={'count':0x0,'rows':[]};return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x57b9a9[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x21accd,null))['then'](function(_0x517791){if(_0x517791){_0x239c38[_0x5808('0x3a')]=_[_0x5808('0x3c')](db[_0x5808('0x6b')][_0x5808('0x38')]);_0x239c38[_0x5808('0x3b')]=_['keys'](_0x57b9a9[_0x5808('0x3b')]);_0x239c38[_0x5808('0x3d')]=_['intersection'](_0x239c38[_0x5808('0x3a')],_0x239c38[_0x5808('0x3b')]);_0x1e90ac['attributes']=_[_0x5808('0x3e')](_0x239c38[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x57b9a9['query'][_0x5808('0x40')]));_0x1e90ac[_0x5808('0x3f')]=_0x1e90ac[_0x5808('0x3f')][_0x5808('0x41')]?_0x1e90ac['attributes']:_0x239c38[_0x5808('0x3a')];if(!_0x57b9a9[_0x5808('0x3b')][_0x5808('0x42')]('nolimit')){_0x1e90ac[_0x5808('0x44')]=qs['limit'](_0x57b9a9[_0x5808('0x3b')]['limit']);_0x1e90ac[_0x5808('0x21')]=qs[_0x5808('0x21')](_0x57b9a9[_0x5808('0x3b')][_0x5808('0x21')]);}_0x1e90ac['order']=qs[_0x5808('0x46')](_0x57b9a9[_0x5808('0x3b')][_0x5808('0x46')]);_0x1e90ac[_0x5808('0x48')]=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x57b9a9[_0x5808('0x3b')],_0x239c38[_0x5808('0x3d')]));_0x1e90ac[_0x5808('0x48')]['VoiceQueueId']=_0x517791['id'];if(_0x57b9a9[_0x5808('0x3b')][_0x5808('0x2e')]){_0x1e90ac['where']=_[_0x5808('0x4a')](_0x1e90ac['where'],{'$or':_[_0x5808('0x30')](_0x1e90ac[_0x5808('0x3f')],function(_0x5480b5){var _0x360403={};_0x360403[_0x5480b5]={'$like':'%'+_0x57b9a9['query'][_0x5808('0x2e')]+'%'};return _0x360403;})});}_0x1e90ac=_[_0x5808('0x4a')]({},_0x1e90ac,_0x57b9a9['options']);return db[_0x5808('0x6b')][_0x5808('0x23')]({'where':_0x1e90ac[_0x5808('0x48')]})['then'](function(_0x1f5a18){_0x3d6033[_0x5808('0x23')]=_0x1f5a18;if(_0x57b9a9[_0x5808('0x3b')][_0x5808('0x4d')]){_0x1e90ac[_0x5808('0x4e')]=[{'all':!![]}];}return db[_0x5808('0x6b')][_0x5808('0x4f')](_0x1e90ac);})[_0x5808('0x28')](function(_0x17b8fa){_0x3d6033[_0x5808('0x67')]=_0x17b8fa;return _0x3d6033;});}})['then'](respondWithFilteredResult(_0x21accd,_0x1e90ac))['catch'](handleError(_0x21accd,null));};exports[_0x5808('0x6c')]=function(_0x331b75,_0x3fb4a1,_0x399aa6){var _0x123a7f={'raw':!![],'where':{}};var _0x3fc3cb={};var _0x5be4e2={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x331b75['params']['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x3fb4a1,null))[_0x5808('0x28')](function(_0x2f7841){if(_0x2f7841){_0x3fc3cb['model']=_[_0x5808('0x3c')](db[_0x5808('0x6d')][_0x5808('0x38')]);_0x3fc3cb[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x331b75[_0x5808('0x3b')]);_0x3fc3cb[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x3fc3cb[_0x5808('0x3a')],_0x3fc3cb[_0x5808('0x3b')]);_0x123a7f['attributes']=_['intersection'](_0x3fc3cb[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x331b75['query'][_0x5808('0x40')]));_0x123a7f[_0x5808('0x3f')]=_0x123a7f['attributes'][_0x5808('0x41')]?_0x123a7f[_0x5808('0x3f')]:_0x3fc3cb[_0x5808('0x3a')];if(!_0x331b75['query'][_0x5808('0x42')](_0x5808('0x43'))){_0x123a7f[_0x5808('0x44')]=qs[_0x5808('0x44')](_0x331b75[_0x5808('0x3b')]['limit']);_0x123a7f[_0x5808('0x21')]=qs[_0x5808('0x21')](_0x331b75[_0x5808('0x3b')][_0x5808('0x21')]);}_0x123a7f[_0x5808('0x45')]=qs[_0x5808('0x46')](_0x331b75['query'][_0x5808('0x46')]);_0x123a7f[_0x5808('0x48')]=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x331b75[_0x5808('0x3b')],_0x3fc3cb[_0x5808('0x3d')]));_0x123a7f[_0x5808('0x48')][_0x5808('0x6a')]=_0x2f7841['id'];if(_0x331b75['query'][_0x5808('0x2e')]){_0x123a7f['where']=_[_0x5808('0x4a')](_0x123a7f[_0x5808('0x48')],{'$or':_[_0x5808('0x30')](_0x123a7f[_0x5808('0x3f')],function(_0x106315){var _0x583a51={};_0x583a51[_0x106315]={'$like':'%'+_0x331b75[_0x5808('0x3b')]['filter']+'%'};return _0x583a51;})});}_0x123a7f=_['merge']({},_0x123a7f,_0x331b75[_0x5808('0x4b')]);return db[_0x5808('0x6d')][_0x5808('0x23')]({'where':_0x123a7f[_0x5808('0x48')]})[_0x5808('0x28')](function(_0x21df6e){_0x5be4e2[_0x5808('0x23')]=_0x21df6e;if(_0x331b75[_0x5808('0x3b')][_0x5808('0x4d')]){_0x123a7f['include']=[{'all':!![]}];}return db[_0x5808('0x6d')]['findAll'](_0x123a7f);})[_0x5808('0x28')](function(_0x2796bb){_0x5be4e2[_0x5808('0x67')]=_0x2796bb;return _0x5be4e2;});}})[_0x5808('0x28')](respondWithFilteredResult(_0x3fb4a1,_0x123a7f))[_0x5808('0x52')](handleError(_0x3fb4a1,null));};exports[_0x5808('0x6e')]=function(_0x45e609,_0x315a28,_0x3278bc){var _0x2499ae={};var _0xb927bb={};var _0x19e5af;var _0x3e6497;return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x45e609[_0x5808('0x51')]['id']}})['then'](handleEntityNotFound(_0x315a28,null))[_0x5808('0x28')](function(_0x1e1840){if(_0x1e1840){_0x19e5af=_0x1e1840;_0xb927bb[_0x5808('0x3a')]=_[_0x5808('0x3c')](db[_0x5808('0x6f')][_0x5808('0x38')]);_0xb927bb[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x45e609[_0x5808('0x3b')]);_0xb927bb[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0xb927bb[_0x5808('0x3a')],_0xb927bb[_0x5808('0x3b')]);_0x2499ae[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0xb927bb[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x45e609[_0x5808('0x3b')][_0x5808('0x40')]));_0x2499ae[_0x5808('0x3f')]=_0x2499ae['attributes'][_0x5808('0x41')]?_0x2499ae[_0x5808('0x3f')]:_0xb927bb[_0x5808('0x3a')];_0x2499ae[_0x5808('0x45')]=qs[_0x5808('0x46')](_0x45e609['query'][_0x5808('0x46')]);_0x2499ae['where']=qs[_0x5808('0x3d')](_['pick'](_0x45e609['query'],_0xb927bb['filters']));if(_0x45e609[_0x5808('0x3b')][_0x5808('0x2e')]){_0x2499ae[_0x5808('0x48')]=_[_0x5808('0x4a')](_0x2499ae['where'],{'$or':_['map'](_0x2499ae['attributes'],function(_0x4541ad){var _0x3d9683={};_0x3d9683[_0x4541ad]={'$like':'%'+_0x45e609[_0x5808('0x3b')][_0x5808('0x2e')]+'%'};return _0x3d9683;})});}_0x2499ae=_['merge']({},_0x2499ae,_0x45e609[_0x5808('0x4b')]);return _0x19e5af[_0x5808('0x6e')](_0x2499ae);}})[_0x5808('0x28')](function(_0x413d7d){if(_0x413d7d){_0x3e6497=_0x413d7d[_0x5808('0x41')];if(!_0x45e609[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0x2499ae['limit']=qs[_0x5808('0x44')](_0x45e609[_0x5808('0x3b')][_0x5808('0x44')]);_0x2499ae[_0x5808('0x21')]=qs[_0x5808('0x21')](_0x45e609['query']['offset']);}return _0x19e5af[_0x5808('0x6e')](_0x2499ae);}})[_0x5808('0x28')](function(_0x351272){if(_0x351272){return _0x351272?{'count':_0x3e6497,'rows':_0x351272}:null;}})[_0x5808('0x28')](respondWithResult(_0x315a28,null))[_0x5808('0x52')](handleError(_0x315a28,null));};exports[_0x5808('0x70')]=function(_0x2f502c,_0x79f917,_0x228f1d){var _0x2ff8ea=_0x2f502c[_0x5808('0x60')][_0x5808('0x71')];var _0x46919e=_[_0x5808('0x30')](_0x2ff8ea,'id');return db[_0x5808('0x6f')][_0x5808('0x4f')]({'where':{'id':_0x46919e},'attributes':['id'],'include':[{'model':db[_0x5808('0x72')],'as':_0x5808('0x73'),'attributes':['id',_0x5808('0x34'),_0x5808('0x74'),_0x5808('0x75'),'interface'],'raw':!![]}]})[_0x5808('0x28')](function(_0x5b4d7b){if(_0x5b4d7b){var _0x18ed96=_['flatMap'](_0x5b4d7b,function(_0x40206b){var _0x23e334=_0x40206b[_0x5808('0x2a')]({'plain':!![]});_0x23e334[_0x5808('0x73')][_0x5808('0x76')](function(_0x3a2525){_0x3a2525['penalty']=_[_0x5808('0x57')](_0x2ff8ea,{'id':_0x23e334['id']})[_0x5808('0x77')];});return _0x23e334['Agents'];});return db[_0x5808('0x4c')]['find']({'where':{'id':_0x2f502c['params']['id']}})[_0x5808('0x28')](function(_0x21968c){return db['sequelize']['transaction'](function(_0x35eb96){return _0x21968c[_0x5808('0x70')](_0x46919e,{'transaction':_0x35eb96})['then'](function(){return BPromise['each'](_0x2ff8ea,function(_0x333088){return db[_0x5808('0x78')][_0x5808('0x79')]({'TeamId':_0x333088['id'],'VoiceQueueId':_0x2f502c[_0x5808('0x51')]['id'],'penalty':_0x333088['penalty']},{'transaction':_0x35eb96});});})[_0x5808('0x28')](function(){return BPromise[_0x5808('0x7a')](_0x18ed96,function(_0x3afc04){return db[_0x5808('0x7b')][_0x5808('0x7c')]({'where':{'UserId':_0x3afc04['id'],'VoiceQueueId':_0x2f502c[_0x5808('0x51')]['id']},'defaults':{'penalty':_0x3afc04[_0x5808('0x77')]},'transaction':_0x35eb96});});})[_0x5808('0x28')](function(){return BPromise[_0x5808('0x7a')](_[_0x5808('0x2e')](_0x18ed96,{'online':!![]}),function(_0x11ca3d){return db[_0x5808('0x7d')][_0x5808('0x79')]({'membername':_0x11ca3d['name'],'UserId':_0x11ca3d['id'],'queue_name':_0x21968c['name'],'VoiceQueueId':_0x21968c['id'],'interface':_['isNil'](_0x11ca3d[_0x5808('0x7e')])?util[_0x5808('0x7f')](_0x5808('0x80'),_0x11ca3d[_0x5808('0x34')]):_0x11ca3d[_0x5808('0x7e')],'paused':_0x11ca3d['voicePause']||![],'penalty':_0x11ca3d['penalty']},{'transaction':_0x35eb96});});})[_0x5808('0x28')](function(){_0x18ed96[_0x5808('0x76')](function(_0x22283d){socket[_0x5808('0x81')](_0x5808('0x82'),{'UserId':_0x22283d['id'],'VoiceQueueId':_0x21968c['id']});});});});});}})[_0x5808('0x28')](respondWithStatusCode(_0x79f917,null))[_0x5808('0x52')](handleError(_0x79f917,null));};exports[_0x5808('0x83')]=function(_0x4f8cb5,_0x355677,_0x5a53ff){return db['Team']['findAll']({'where':{'id':_0x4f8cb5['query'][_0x5808('0x84')]},'attributes':['id'],'include':[{'model':db[_0x5808('0x72')],'as':_0x5808('0x73'),'attributes':['id'],'raw':!![]}]})[_0x5808('0x28')](handleEntityNotFound(_0x355677,null))['then'](function(_0x4b6d38){var _0x38522b=_[_0x5808('0x30')](_0x4b6d38,'id');var _0x2318ba=[];var _0x19d07e=[];var _0x194f35=squel['select']();_0x194f35[_0x5808('0x85')](_0x5808('0x86'))[_0x5808('0x87')](_0x5808('0x88'),'tq')[_0x5808('0x89')](_0x5808('0x8a'),'ut',_0x5808('0x8b'))[_0x5808('0x48')](_0x5808('0x8c'),_0x4f8cb5[_0x5808('0x51')]['id']);for(var _0x26f9ea=0x0;_0x26f9ea<_0x4b6d38['length'];_0x26f9ea+=0x1){let _0x294db6=_0x4b6d38[_0x26f9ea];for(var _0x4c9438=0x0;_0x4c9438<_0x294db6['Agents']['length'];_0x4c9438+=0x1){let _0x19b20c=_0x294db6[_0x5808('0x73')][_0x4c9438];var _0x3c2c02=_0x194f35['clone']();_0x3c2c02['where'](_0x5808('0x8d'),_0x19b20c['id']);_0x19d07e[_0x5808('0x8e')](db[_0x5808('0x8f')][_0x5808('0x3b')](_0x3c2c02[_0x5808('0x90')](),{'type':db[_0x5808('0x8f')][_0x5808('0x91')][_0x5808('0x92')]})[_0x5808('0x28')](function(_0x187079){if(_0x187079['length']===0x1){return _0x19b20c['id'];}else{var _0x10b671=_[_0x5808('0x93')](_[_0x5808('0x30')](_0x187079,_0x5808('0x94')),function(_0x5e2025){return _['includes'](_0x38522b,_0x5e2025);});if(_0x10b671){return _0x19b20c['id'];}}}));}}return BPromise[_0x5808('0x95')](_0x19d07e)[_0x5808('0x28')](function(_0x10c10a){_0x2318ba=_(_0x2318ba)['union'](_0x10c10a)[_0x5808('0x96')]()[_0x5808('0x33')]();return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0x4f8cb5[_0x5808('0x51')]['id']}})[_0x5808('0x28')](function(_0x2c701c){return db[_0x5808('0x8f')][_0x5808('0x97')](function(_0x2ded6f){return _0x2c701c[_0x5808('0x83')](_0x4f8cb5[_0x5808('0x3b')][_0x5808('0x84')],{'transaction':_0x2ded6f})[_0x5808('0x28')](function(){if(!_[_0x5808('0x98')](_0x2318ba)){return _0x2c701c[_0x5808('0x99')](_0x2318ba,{'transaction':_0x2ded6f})[_0x5808('0x28')](function(){return db[_0x5808('0x7d')][_0x5808('0x29')]({'where':{'VoiceQueueId':_0x4f8cb5['params']['id'],'UserId':_0x2318ba},'transaction':_0x2ded6f});});}})[_0x5808('0x28')](function(){_0x2318ba[_0x5808('0x76')](function(_0x1a60ca){socket['emit']('userVoiceQueue:remove',{'UserId':_0x1a60ca,'VoiceQueueId':_0x2c701c['id']});});});});});});})[_0x5808('0x28')](respondWithStatusCode(_0x355677,null))['catch'](handleError(_0x355677,null));};exports[_0x5808('0x9a')]=function(_0xea2d1f,_0x34f421,_0x341850){var _0x1d454b,_0x370cc5;return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0xea2d1f[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x34f421,null))[_0x5808('0x28')](function(_0x16bfed){if(_0x16bfed){_0x370cc5=_0x16bfed;return _0x16bfed['addAgents'](_0xea2d1f[_0x5808('0x60')][_0x5808('0x84')],_['omit'](_0xea2d1f[_0x5808('0x60')],[_0x5808('0x84'),'id'])||{})['spread'](function(_0x372b4b){for(var _0x1d3cf1=0x0;_0x1d3cf1<_0xea2d1f['body'][_0x5808('0x84')][_0x5808('0x41')];_0x1d3cf1+=0x1){socket[_0x5808('0x81')](_0x5808('0x82'),{'UserId':Number(_0xea2d1f[_0x5808('0x60')]['ids'][_0x1d3cf1]),'VoiceQueueId':Number(_0xea2d1f[_0x5808('0x51')]['id'])});}return _0x372b4b;});}})[_0x5808('0x28')](function(_0x28d480){_0x1d454b=_0x28d480||[];if(_0x370cc5){return db['User']['findAll']({'where':{'id':_0xea2d1f[_0x5808('0x60')][_0x5808('0x84')]},'attributes':['id',_0x5808('0x34'),_0x5808('0x74'),_0x5808('0x75'),'interface'],'raw':!![]});}})[_0x5808('0x28')](function(_0x2af1c0){if(!_[_0x5808('0x98')](_0x2af1c0)){var _0x45fc1a=[];for(var _0x140a30=0x0;_0x140a30<_0x2af1c0[_0x5808('0x41')];_0x140a30++){if(_0x2af1c0[_0x140a30][_0x5808('0x74')]){_0x45fc1a[_0x5808('0x8e')](db[_0x5808('0x7d')][_0x5808('0x79')]({'membername':_0x2af1c0[_0x140a30][_0x5808('0x34')],'UserId':_0x2af1c0[_0x140a30]['id'],'queue_name':_0x370cc5[_0x5808('0x34')],'VoiceQueueId':_0x370cc5['id'],'interface':_[_0x5808('0x9b')](_0x2af1c0[_0x140a30][_0x5808('0x7e')])?util[_0x5808('0x7f')](_0x5808('0x80'),_0x2af1c0[_0x140a30][_0x5808('0x34')]):_0x2af1c0[_0x140a30][_0x5808('0x7e')],'paused':_0x2af1c0[_0x140a30][_0x5808('0x75')]||![],'penalty':_0xea2d1f[_0x5808('0x60')]['penalty']||0x0}));}}return BPromise['all'](_0x45fc1a);}})[_0x5808('0x28')](function(){return _0x1d454b;})['then'](respondWithResult(_0x34f421,null))['catch'](handleError(_0x34f421,null));};exports[_0x5808('0x99')]=function(_0x30d2cf,_0x5bdca9,_0x5cda89){return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0x30d2cf['params']['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x5bdca9,null))[_0x5808('0x28')](function(_0x3a21b0){if(_0x3a21b0){return _0x3a21b0[_0x5808('0x99')](_0x30d2cf[_0x5808('0x3b')]['ids'])[_0x5808('0x28')](function(){if(_[_0x5808('0x9c')](_0x30d2cf[_0x5808('0x3b')][_0x5808('0x84')])){for(var _0x4446ab=0x0;_0x4446ab<_0x30d2cf['query'][_0x5808('0x84')]['length'];_0x4446ab+=0x1){socket[_0x5808('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x30d2cf['query'][_0x5808('0x84')][_0x4446ab]),'VoiceQueueId':Number(_0x30d2cf[_0x5808('0x51')]['id'])});}}else{socket[_0x5808('0x81')](_0x5808('0x9d'),{'UserId':Number(_0x30d2cf[_0x5808('0x3b')]['ids']),'VoiceQueueId':Number(_0x30d2cf['params']['id'])});}});}})['then'](function(_0xed93ec){return db[_0x5808('0x7d')][_0x5808('0x29')]({'where':{'VoiceQueueId':_0x30d2cf[_0x5808('0x51')]['id'],'UserId':_0x30d2cf[_0x5808('0x3b')][_0x5808('0x84')]}})[_0x5808('0x28')](function(){return _0xed93ec;});})[_0x5808('0x28')](respondWithStatusCode(_0x5bdca9,null))[_0x5808('0x52')](handleError(_0x5bdca9,null));};exports[_0x5808('0x9e')]=function(_0x466c19,_0x31d49c,_0x1af17c){var _0x5ab17b={};var _0x3939b9={};var _0x487cef;var _0x5c26a4;return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x466c19[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x31d49c,null))[_0x5808('0x28')](function(_0x52d34a){if(_0x52d34a){_0x487cef=_0x52d34a;_0x3939b9[_0x5808('0x3a')]=_[_0x5808('0x3c')](db['User'][_0x5808('0x38')]);_0x3939b9[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x466c19[_0x5808('0x3b')]);_0x3939b9['filters']=_[_0x5808('0x3e')](_0x3939b9[_0x5808('0x3a')],_0x3939b9[_0x5808('0x3b')]);_0x5ab17b[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x3939b9[_0x5808('0x3a')],qs[_0x5808('0x40')](_0x466c19[_0x5808('0x3b')]['fields']));_0x5ab17b[_0x5808('0x3f')]=_0x5ab17b[_0x5808('0x3f')][_0x5808('0x41')]?_0x5ab17b[_0x5808('0x3f')]:_0x3939b9['model'];_0x5ab17b[_0x5808('0x45')]=qs['sort'](_0x466c19[_0x5808('0x3b')]['sort']);_0x5ab17b[_0x5808('0x48')]=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x466c19[_0x5808('0x3b')],_0x3939b9[_0x5808('0x3d')]));if(_0x466c19[_0x5808('0x3b')][_0x5808('0x2e')]){_0x5ab17b[_0x5808('0x48')]=_[_0x5808('0x4a')](_0x5ab17b[_0x5808('0x48')],{'$or':_[_0x5808('0x30')](_0x5ab17b['attributes'],function(_0x5add8e){var _0x1836e9={};_0x1836e9[_0x5add8e]={'$like':'%'+_0x466c19[_0x5808('0x3b')][_0x5808('0x2e')]+'%'};return _0x1836e9;})});}_0x5ab17b=_[_0x5808('0x4a')]({},_0x5ab17b,_0x466c19[_0x5808('0x4b')]);return _0x487cef[_0x5808('0x9e')](_0x5ab17b);}})[_0x5808('0x28')](function(_0x30beca){if(_0x30beca){_0x5c26a4=_0x30beca[_0x5808('0x41')];if(!_0x466c19[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0x5ab17b[_0x5808('0x44')]=qs['limit'](_0x466c19[_0x5808('0x3b')]['limit']);_0x5ab17b['offset']=qs['offset'](_0x466c19[_0x5808('0x3b')]['offset']);}return _0x487cef[_0x5808('0x9e')](_0x5ab17b);}})[_0x5808('0x28')](function(_0x31e5b0){if(_0x31e5b0){return _0x31e5b0?{'count':_0x5c26a4,'rows':_0x31e5b0}:null;}})[_0x5808('0x28')](respondWithResult(_0x31d49c,null))['catch'](handleError(_0x31d49c,null));};exports[_0x5808('0x9f')]=function(_0x4642df,_0x530e20,_0x17e814){var _0xa48833={};var _0x168f48={};var _0xf63593;var _0x7a8895;return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x4642df[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x530e20,null))['then'](function(_0x3bc384){if(_0x3bc384){_0xf63593=_0x3bc384;_0x168f48[_0x5808('0x3a')]=_[_0x5808('0x3c')](db[_0x5808('0x7d')]['rawAttributes']);_0x168f48[_0x5808('0x3b')]=_[_0x5808('0x3c')](_0x4642df[_0x5808('0x3b')]);_0x168f48[_0x5808('0x3d')]=_['intersection'](_0x168f48[_0x5808('0x3a')],_0x168f48['query']);_0xa48833[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x168f48['model'],qs['fields'](_0x4642df[_0x5808('0x3b')][_0x5808('0x40')]));_0xa48833[_0x5808('0x3f')]=_0xa48833[_0x5808('0x3f')][_0x5808('0x41')]?_0xa48833[_0x5808('0x3f')]:_0x168f48[_0x5808('0x3a')];_0xa48833[_0x5808('0x45')]=qs['sort'](_0x4642df[_0x5808('0x3b')][_0x5808('0x46')]);_0xa48833[_0x5808('0x48')]=qs['filters'](_[_0x5808('0x47')](_0x4642df[_0x5808('0x3b')],_0x168f48['filters']));if(_0x4642df[_0x5808('0x3b')][_0x5808('0x2e')]){_0xa48833[_0x5808('0x48')]=_[_0x5808('0x4a')](_0xa48833[_0x5808('0x48')],{'$or':_['map'](_0xa48833[_0x5808('0x3f')],function(_0x1c9d05){var _0xf6179e={};_0xf6179e[_0x1c9d05]={'$like':'%'+_0x4642df[_0x5808('0x3b')][_0x5808('0x2e')]+'%'};return _0xf6179e;})});}_0xa48833=_[_0x5808('0x4a')]({},_0xa48833,_0x4642df[_0x5808('0x4b')]);return _0xf63593[_0x5808('0x9f')](_0xa48833);}})['then'](function(_0x2cc4bd){if(_0x2cc4bd){_0x7a8895=_0x2cc4bd[_0x5808('0x41')];if(!_0x4642df[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0xa48833[_0x5808('0x44')]=qs[_0x5808('0x44')](_0x4642df[_0x5808('0x3b')]['limit']);_0xa48833[_0x5808('0x21')]=qs[_0x5808('0x21')](_0x4642df[_0x5808('0x3b')][_0x5808('0x21')]);}return _0xf63593['getMembers'](_0xa48833);}})[_0x5808('0x28')](function(_0x2f6244){return _0x2f6244?{'count':_0x7a8895,'rows':_0x2f6244}:null;})['then'](respondWithResult(_0x530e20,null))[_0x5808('0x52')](handleError(_0x530e20,null));};exports[_0x5808('0xa0')]=function(_0x1a8199,_0x68743b,_0x2bd836){var _0x5d0c91={};var _0x1b02ca={};var _0x1962d7;var _0x19a985;return db[_0x5808('0x4c')]['findOne']({'where':{'id':_0x1a8199[_0x5808('0x51')]['id']}})['then'](handleEntityNotFound(_0x68743b,null))[_0x5808('0x28')](function(_0x572911){if(_0x572911){_0x1962d7=_0x572911;_0x1b02ca[_0x5808('0x3a')]=_['keys'](db[_0x5808('0xa1')]['rawAttributes']);_0x1b02ca['query']=_[_0x5808('0x3c')](_0x1a8199[_0x5808('0x3b')]);_0x1b02ca[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x1b02ca[_0x5808('0x3a')],_0x1b02ca[_0x5808('0x3b')]);_0x5d0c91[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x1b02ca[_0x5808('0x3a')],qs['fields'](_0x1a8199[_0x5808('0x3b')][_0x5808('0x40')]));_0x5d0c91['attributes']=_0x5d0c91['attributes'][_0x5808('0x41')]?_0x5d0c91[_0x5808('0x3f')]:_0x1b02ca[_0x5808('0x3a')];_0x5d0c91[_0x5808('0x45')]=qs['sort'](_0x1a8199[_0x5808('0x3b')][_0x5808('0x46')]);_0x5d0c91[_0x5808('0x48')]=qs['filters'](_[_0x5808('0x47')](_0x1a8199[_0x5808('0x3b')],_0x1b02ca[_0x5808('0x3d')]));if(_0x1a8199[_0x5808('0x3b')][_0x5808('0x2e')]){_0x5d0c91[_0x5808('0x48')]=_['merge'](_0x5d0c91[_0x5808('0x48')],{'$or':_[_0x5808('0x30')](_0x5d0c91[_0x5808('0x3f')],function(_0x522374){var _0x38e175={};_0x38e175[_0x522374]={'$like':'%'+_0x1a8199['query'][_0x5808('0x2e')]+'%'};return _0x38e175;})});}_0x5d0c91=_[_0x5808('0x4a')]({},_0x5d0c91,_0x1a8199[_0x5808('0x4b')]);return _0x1962d7['getLists'](_0x5d0c91);}})['then'](function(_0x26d5b9){if(_0x26d5b9){_0x19a985=_0x26d5b9[_0x5808('0x41')];if(!_0x1a8199['query']['hasOwnProperty'](_0x5808('0x43'))){_0x5d0c91[_0x5808('0x44')]=qs[_0x5808('0x44')](_0x1a8199['query'][_0x5808('0x44')]);_0x5d0c91['offset']=qs[_0x5808('0x21')](_0x1a8199[_0x5808('0x3b')][_0x5808('0x21')]);}return _0x1962d7[_0x5808('0xa0')](_0x5d0c91);}})[_0x5808('0x28')](function(_0x44c4ea){if(_0x44c4ea){return _0x44c4ea?{'count':_0x19a985,'rows':_0x44c4ea}:null;}})[_0x5808('0x28')](respondWithResult(_0x68743b,null))['catch'](handleError(_0x68743b,null));};exports['addLists']=function(_0x241519,_0x43da56,_0x1a9932){var _0x2e7bca=moment()['format'](_0x5808('0xa2'));var _0x26bac9,_0x13a2df;return db['VoiceQueue'][_0x5808('0x57')]({'where':{'id':_0x241519[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x43da56,null))[_0x5808('0x28')](function(_0x4bb27c){if(_0x4bb27c){_0x13a2df=_0x4bb27c;return _0x4bb27c['addLists'](_0x241519['body']['ids'],_[_0x5808('0x5d')](_0x241519[_0x5808('0x60')],[_0x5808('0x84'),'id'])||{});}return null;})[_0x5808('0xa3')](function(_0x269278){var _0x575bcd;_0x26bac9=_0x269278||[];var _0x368e31=[];if(_0x269278){for(var _0x50e436=0x0;_0x50e436<_0x269278['length'];_0x50e436+=0x1){var _0x10518e=_0x269278[_0x50e436][_0x5808('0x2a')]({'plain':!![]});_0x13a2df[_0x5808('0xa4')]=_0x241519[_0x5808('0x60')][_0x5808('0xa4')]?_0x241519[_0x5808('0x60')][_0x5808('0xa4')]:_0x13a2df['dialCheckDuplicateType'];switch(_0x13a2df[_0x5808('0xa4')]){case _0x5808('0xa5'):_0x575bcd=squel[_0x5808('0xa6')]()[_0x5808('0xa7')](_0x5808('0xa8'))['fromQuery'](['phone',_0x5808('0xa9'),_0x5808('0xaa'),_0x5808('0xab'),'VoiceQueueId',_0x5808('0x5e'),'updatedAt'],squel['select']()[_0x5808('0x85')](_0x5808('0xac'),'phone')[_0x5808('0x85')]('\x27'+_0x2e7bca+'\x27',_0x5808('0xa9'))[_0x5808('0x85')]('id','ContactId')[_0x5808('0x85')](_0x10518e['CmListId'][_0x5808('0x90')](),_0x5808('0xab'))['field'](_0x241519[_0x5808('0x51')]['id'][_0x5808('0x90')](),_0x5808('0x6a'))[_0x5808('0x85')]('\x27'+_0x2e7bca+'\x27',_0x5808('0x5e'))['field']('\x27'+_0x2e7bca+'\x27','updatedAt')[_0x5808('0x87')](_0x5808('0xad'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x5808('0xae'),_0x10518e[_0x5808('0xaf')]['toString']())[_0x5808('0x48')](_0x5808('0xb0'))[_0x5808('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5808('0xb1')]()['field'](_0x5808('0xb2'))['from']('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x241519['params']['id'][_0x5808('0x90')]()))[_0x5808('0x48')](_0x5808('0xb3'),squel[_0x5808('0xb1')]()[_0x5808('0x85')](_0x5808('0xb4'))[_0x5808('0x87')](_0x5808('0xa8'))[_0x5808('0x48')]('VoiceQueueId\x20=\x20?',_0x241519[_0x5808('0x51')]['id'][_0x5808('0x90')]())))[_0x5808('0x90')]();break;case _0x5808('0xb5'):_0x575bcd=squel[_0x5808('0xa6')]()[_0x5808('0xa7')]('cm_hopper')[_0x5808('0xb6')]([_0x5808('0xac'),_0x5808('0xa9'),_0x5808('0xaa'),_0x5808('0xab'),_0x5808('0x6a'),_0x5808('0x5e'),_0x5808('0x5f')],squel['select']()[_0x5808('0x85')](_0x5808('0xac'),_0x5808('0xac'))[_0x5808('0x85')]('\x27'+_0x2e7bca+'\x27',_0x5808('0xa9'))[_0x5808('0x85')]('id',_0x5808('0xaa'))[_0x5808('0x85')](_0x10518e[_0x5808('0xaf')][_0x5808('0x90')](),_0x5808('0xab'))[_0x5808('0x85')](_0x241519[_0x5808('0x51')]['id'][_0x5808('0x90')](),_0x5808('0x6a'))['field']('\x27'+_0x2e7bca+'\x27',_0x5808('0x5e'))['field']('\x27'+_0x2e7bca+'\x27',_0x5808('0x5f'))[_0x5808('0x87')](_0x5808('0xad'))[_0x5808('0x48')](_0x5808('0xb7'))[_0x5808('0x48')](_0x5808('0xae'),_0x10518e[_0x5808('0xaf')][_0x5808('0x90')]())[_0x5808('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x5808('0x48')](_0x5808('0xb3'),squel[_0x5808('0xb1')]()[_0x5808('0x85')](_0x5808('0xb4'))[_0x5808('0x87')]('cm_hopper')[_0x5808('0x48')](_0x5808('0x8c'),_0x241519[_0x5808('0x51')]['id'][_0x5808('0x90')]())))[_0x5808('0x90')]();break;default:_0x575bcd=squel[_0x5808('0xa6')]()[_0x5808('0xa7')](_0x5808('0xa8'))[_0x5808('0xb6')]([_0x5808('0xac'),_0x5808('0xa9'),_0x5808('0xaa'),_0x5808('0xab'),_0x5808('0x6a'),'createdAt',_0x5808('0x5f')],squel[_0x5808('0xb1')]()[_0x5808('0x85')](_0x5808('0xac'),_0x5808('0xac'))['field']('\x27'+_0x2e7bca+'\x27',_0x5808('0xa9'))[_0x5808('0x85')]('id',_0x5808('0xaa'))['field'](_0x10518e[_0x5808('0xaf')][_0x5808('0x90')](),_0x5808('0xab'))[_0x5808('0x85')](_0x241519[_0x5808('0x51')]['id'][_0x5808('0x90')](),_0x5808('0x6a'))['field']('\x27'+_0x2e7bca+'\x27',_0x5808('0x5e'))['field']('\x27'+_0x2e7bca+'\x27',_0x5808('0x5f'))['from']('cm_contacts')[_0x5808('0x48')]('deletedAt\x20IS\x20NULL')[_0x5808('0x48')](_0x5808('0xae'),_0x10518e['CmListId']['toString']())[_0x5808('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x368e31[_0x5808('0x8e')](db[_0x5808('0x8f')][_0x5808('0x3b')](_0x575bcd));}return BPromise[_0x5808('0x95')](_0x368e31);}})['then'](function(){var _0x1b692f=[];var _0x366d7f=squel[_0x5808('0xa6')]()['into'](_0x5808('0xb8'))[_0x5808('0xb6')]([_0x5808('0xb9'),'phone',_0x5808('0xba'),_0x5808('0x5e'),'updatedAt'],squel['select']()[_0x5808('0x85')](_0x5808('0xbb'))[_0x5808('0x85')](_0x5808('0xbc'))[_0x5808('0x85')](_0x5808('0xbd'))[_0x5808('0x85')]('\x27'+_0x2e7bca+'\x27',_0x5808('0x5e'))[_0x5808('0x85')]('\x27'+_0x2e7bca+'\x27',_0x5808('0x5f'))[_0x5808('0x87')]('cm_contact_has_items','ci')['join'](_0x5808('0xa8'),'h',_0x5808('0xbe'))[_0x5808('0x48')]('h.scheduledat=?',_0x2e7bca)['where']('ci.ItemClass=?',_0x5808('0xbf')))[_0x5808('0x90')]();_0x1b692f[_0x5808('0x8e')](db['sequelize'][_0x5808('0x3b')](_0x366d7f));return BPromise[_0x5808('0x95')](_0x1b692f);})[_0x5808('0x28')](function(){return _0x26bac9;})['then'](respondWithResult(_0x43da56,null))[_0x5808('0x52')](handleError(_0x43da56,null));};exports[_0x5808('0xc0')]=function(_0x2ba30b,_0x1bcea2,_0x49bf99){return db['VoiceQueue'][_0x5808('0x57')]({'where':{'id':_0x2ba30b[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x1bcea2,null))['then'](function(_0x24f19b){if(_0x24f19b){return _0x24f19b[_0x5808('0xc0')](_0x2ba30b['query'][_0x5808('0x84')]);}})[_0x5808('0x28')](function(_0x3dee23){if(_0x3dee23){return db[_0x5808('0x66')][_0x5808('0x29')]({'where':{'ListId':_0x2ba30b[_0x5808('0x3b')][_0x5808('0x84')],'VoiceQueueId':_0x2ba30b['params']['id']}})[_0x5808('0x28')](function(){return _0x3dee23;});}})[_0x5808('0x28')](respondWithStatusCode(_0x1bcea2,null))['catch'](handleError(_0x1bcea2,null));};exports[_0x5808('0xc1')]=function(_0x242d0c,_0x5b6275,_0x225804){var _0x403d01={};var _0x364e5d={};var _0xa795b1;var _0x387ce5;return db[_0x5808('0x4c')][_0x5808('0x65')]({'where':{'id':_0x242d0c[_0x5808('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b6275,null))['then'](function(_0x477acf){if(_0x477acf){_0xa795b1=_0x477acf;_0x364e5d[_0x5808('0x3a')]=_[_0x5808('0x3c')](db['CmList'][_0x5808('0x38')]);_0x364e5d['query']=_[_0x5808('0x3c')](_0x242d0c['query']);_0x364e5d[_0x5808('0x3d')]=_[_0x5808('0x3e')](_0x364e5d[_0x5808('0x3a')],_0x364e5d['query']);_0x403d01[_0x5808('0x3f')]=_[_0x5808('0x3e')](_0x364e5d['model'],qs[_0x5808('0x40')](_0x242d0c[_0x5808('0x3b')][_0x5808('0x40')]));_0x403d01[_0x5808('0x3f')]=_0x403d01[_0x5808('0x3f')][_0x5808('0x41')]?_0x403d01[_0x5808('0x3f')]:_0x364e5d[_0x5808('0x3a')];_0x403d01['order']=qs[_0x5808('0x46')](_0x242d0c[_0x5808('0x3b')]['sort']);_0x403d01[_0x5808('0x48')]=qs[_0x5808('0x3d')](_[_0x5808('0x47')](_0x242d0c[_0x5808('0x3b')],_0x364e5d[_0x5808('0x3d')]));if(_0x242d0c[_0x5808('0x3b')][_0x5808('0x2e')]){_0x403d01[_0x5808('0x48')]=_[_0x5808('0x4a')](_0x403d01[_0x5808('0x48')],{'$or':_[_0x5808('0x30')](_0x403d01[_0x5808('0x3f')],function(_0x3e317a){var _0x447d3f={};_0x447d3f[_0x3e317a]={'$like':'%'+_0x242d0c[_0x5808('0x3b')]['filter']+'%'};return _0x447d3f;})});}_0x403d01=_[_0x5808('0x4a')]({},_0x403d01,_0x242d0c[_0x5808('0x4b')]);return _0xa795b1[_0x5808('0xc1')](_0x403d01);}})[_0x5808('0x28')](function(_0xdce2f9){if(_0xdce2f9){_0x387ce5=_0xdce2f9['length'];if(!_0x242d0c[_0x5808('0x3b')][_0x5808('0x42')](_0x5808('0x43'))){_0x403d01['limit']=qs[_0x5808('0x44')](_0x242d0c['query'][_0x5808('0x44')]);_0x403d01['offset']=qs[_0x5808('0x21')](_0x242d0c[_0x5808('0x3b')][_0x5808('0x21')]);}return _0xa795b1[_0x5808('0xc1')](_0x403d01);}})[_0x5808('0x28')](function(_0x3ff856){if(_0x3ff856){return _0x3ff856?{'count':_0x387ce5,'rows':_0x3ff856}:null;}})[_0x5808('0x28')](respondWithResult(_0x5b6275,null))['catch'](handleError(_0x5b6275,null));};exports[_0x5808('0xc2')]=function(_0x500718,_0x2831d3,_0x22fc5a){var _0x45f04e,_0x56e8e2;return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0x500718[_0x5808('0x51')]['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x2831d3,null))[_0x5808('0x28')](function(_0x467397){if(_0x467397){_0x56e8e2=_0x467397;return _0x467397[_0x5808('0xc2')](_0x500718[_0x5808('0x60')][_0x5808('0x84')],_[_0x5808('0x5d')](_0x500718[_0x5808('0x60')],[_0x5808('0x84'),'id'])||{});}return null;})['spread'](function(_0x4085f6){var _0x57fbe5;_0x45f04e=_0x4085f6||[];var _0x584b89=[];if(_0x4085f6){for(var _0x13887e=0x0;_0x13887e<_0x4085f6[_0x5808('0x41')];_0x13887e+=0x1){var _0x581b52=_0x4085f6[_0x13887e][_0x5808('0x2a')]({'plain':!![]});_0x57fbe5=squel[_0x5808('0xa6')]()[_0x5808('0xa7')](_0x5808('0xc3'))['fromQuery']([_0x5808('0xac'),_0x5808('0xaa'),_0x5808('0xab'),_0x5808('0x6a'),_0x5808('0x5e'),'updatedAt'],squel[_0x5808('0xb1')]()[_0x5808('0x85')](_0x5808('0xac'),_0x5808('0xac'))['field']('id','ContactId')['field'](_0x581b52['CmListId'][_0x5808('0x90')](),_0x5808('0xab'))['field'](_0x500718['params']['id'][_0x5808('0x90')](),'VoiceQueueId')[_0x5808('0x85')](_0x5808('0xc4'),_0x5808('0x5e'))[_0x5808('0x85')](_0x5808('0xc4'),'updatedAt')[_0x5808('0x87')](_0x5808('0xad'))[_0x5808('0x48')](_0x5808('0xb7'))[_0x5808('0x48')](_0x5808('0xae'),_0x581b52[_0x5808('0xaf')][_0x5808('0x90')]())['where'](_0x5808('0xb0')))[_0x5808('0x90')]();_0x584b89[_0x5808('0x8e')](db[_0x5808('0x8f')][_0x5808('0x3b')](_0x57fbe5));}return BPromise[_0x5808('0x95')](_0x584b89);}})[_0x5808('0x28')](function(){return _0x45f04e;})[_0x5808('0x28')](respondWithResult(_0x2831d3,null))[_0x5808('0x52')](handleError(_0x2831d3,null));};exports[_0x5808('0xc5')]=function(_0x5e7e2d,_0x470779,_0x5b48b2){return db[_0x5808('0x4c')][_0x5808('0x57')]({'where':{'id':_0x5e7e2d['params']['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x470779,null))[_0x5808('0x28')](function(_0x2fdd99){if(_0x2fdd99){return _0x2fdd99[_0x5808('0xc5')](_0x5e7e2d[_0x5808('0x3b')]['ids']);}})['then'](function(_0x29a7ba){if(_0x29a7ba){return db[_0x5808('0x6d')][_0x5808('0x29')]({'where':{'ListId':_0x5e7e2d[_0x5808('0x3b')][_0x5808('0x84')],'VoiceQueueId':_0x5e7e2d[_0x5808('0x51')]['id']}})[_0x5808('0x28')](function(){return _0x29a7ba;});}})['then'](respondWithStatusCode(_0x470779,null))[_0x5808('0x52')](handleError(_0x470779,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7e986e9..eca97e8 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 _0x2d3e=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x27927d,_0x155af5){var _0x2d7954=function(_0x5bf8d4){while(--_0x5bf8d4){_0x27927d['push'](_0x27927d['shift']());}};_0x2d7954(++_0x155af5);}(_0x2d3e,0x196));var _0xe2d3=function(_0x200862,_0x1b72fd){_0x200862=_0x200862-0x0;var _0x21a9dc=_0x2d3e[_0x200862];return _0x21a9dc;};'use strict';var EventEmitter=require(_0xe2d3('0x0'));var VoiceQueue=require(_0xe2d3('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2d3('0x2'),'afterDestroy':_0xe2d3('0x3')};function emitEvent(_0x27ae20){return function(_0x41a4e2,_0x394a70,_0x2af346){VoiceQueueEvents[_0xe2d3('0x4')](_0x27ae20+':'+_0x41a4e2['id'],_0x41a4e2);VoiceQueueEvents[_0xe2d3('0x4')](_0x27ae20,_0x41a4e2);_0x2af346(null);};}for(var e in events){if(events[_0xe2d3('0x5')](e)){var event=events[e];VoiceQueue[_0xe2d3('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x123c=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','hook'];(function(_0x3b5303,_0x16889f){var _0x460c8b=function(_0x15f5cd){while(--_0x15f5cd){_0x3b5303['push'](_0x3b5303['shift']());}};_0x460c8b(++_0x16889f);}(_0x123c,0x1a9));var _0xc123=function(_0x3f9eb7,_0x173d6a){_0x3f9eb7=_0x3f9eb7-0x0;var _0x3c5a93=_0x123c[_0x3f9eb7];return _0x3c5a93;};'use strict';var EventEmitter=require(_0xc123('0x0'));var VoiceQueue=require(_0xc123('0x1'))['db'][_0xc123('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc123('0x3')](0x0);var events={'afterCreate':_0xc123('0x4'),'afterUpdate':'update','afterDestroy':_0xc123('0x5')};function emitEvent(_0x51a24d){return function(_0x5c0744,_0x5cf261,_0x25d4e7){VoiceQueueEvents['emit'](_0x51a24d+':'+_0x5c0744['id'],_0x5c0744);VoiceQueueEvents['emit'](_0x51a24d,_0x5c0744);_0x25d4e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc123('0x6')](e,emitEvent(event));}}module[_0xc123('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c3640e6..be34f53 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x30c450,_0x3cb8fb){var _0xb8e1a=function(_0x2fd51e){while(--_0x2fd51e){_0x30c450['push'](_0x30c450['shift']());}};_0xb8e1a(++_0x3cb8fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x88d624,_0x1dff2f){var _0x46737f=function(_0x3bc569){while(--_0x3bc569){_0x88d624['push'](_0x88d624['shift']());}};_0x46737f(++_0x1dff2f);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b1105ee..da4878d 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 _0xee2f=['client','localhost','redis','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','include','map','model','catch','ShowVoiceQueue','find','then','debug','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xee2f,0x1c1));var _0xfee2=function(_0x4c5a24,_0x5ef60c){_0x4c5a24=_0x4c5a24-0x0;var _0x4b067e=_0xee2f[_0x4c5a24];return _0x4b067e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfee2('0x0'));var rs=require(_0xfee2('0x1'));var fs=require('fs');var Redis=require(_0xfee2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfee2('0x3'))(_0xfee2('0x4'));var config=require('../../config/environment');var jayson=require(_0xfee2('0x5'));var client=jayson[_0xfee2('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xfee2('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfee2('0x8')]));require(_0xfee2('0x9'))[_0xfee2('0xa')](socket);function respondWithRpcPromise(_0x12a64f,_0x55a24d,_0xf82531){return new BPromise(function(_0x199d01,_0x5a311c){return client[_0xfee2('0xb')](_0x12a64f,_0xf82531)['then'](function(_0x28c0c3){logger[_0xfee2('0xc')](_0xfee2('0xd'),_0x55a24d,_0xfee2('0xe'));logger['debug'](_0xfee2('0xf'),_0x55a24d,'request\x20sent',JSON[_0xfee2('0x10')](_0x28c0c3));if(_0x28c0c3['error']){if(_0x28c0c3[_0xfee2('0x11')][_0xfee2('0x12')]===0x1f4){logger['error'](_0xfee2('0xd'),_0x55a24d,_0x28c0c3[_0xfee2('0x11')]['message']);return _0x5a311c(_0x28c0c3[_0xfee2('0x11')]['message']);}logger['error'](_0xfee2('0xd'),_0x55a24d,_0x28c0c3[_0xfee2('0x11')][_0xfee2('0x13')]);return _0x199d01(_0x28c0c3[_0xfee2('0x11')][_0xfee2('0x13')]);}else{logger[_0xfee2('0xc')]('VoiceQueue,\x20%s,\x20%s',_0x55a24d,_0xfee2('0xe'));_0x199d01(_0x28c0c3[_0xfee2('0x14')]['message']);}})['catch'](function(_0x1825d0){logger[_0xfee2('0x11')](_0xfee2('0xd'),_0x55a24d,_0x1825d0);_0x5a311c(_0x1825d0);});});}exports[_0xfee2('0x15')]=function(_0x476779){var _0x38d3a7=this;return new Promise(function(_0x5933f8,_0x1f8c79){return db[_0xfee2('0x16')][_0xfee2('0x17')]({'raw':_0x476779[_0xfee2('0x18')]?_0x476779['options']['raw']===undefined?!![]:![]:!![],'where':_0x476779['options']?_0x476779[_0xfee2('0x18')][_0xfee2('0x19')]||null:null,'attributes':_0x476779[_0xfee2('0x18')]?_0x476779[_0xfee2('0x18')][_0xfee2('0x1a')]||null:null,'limit':_0x476779[_0xfee2('0x18')]?_0x476779[_0xfee2('0x18')]['limit']||null:null,'include':_0x476779[_0xfee2('0x18')]?_0x476779['options'][_0xfee2('0x1b')]?_[_0xfee2('0x1c')](_0x476779[_0xfee2('0x18')][_0xfee2('0x1b')],function(_0xe3db9b){return{'model':db[_0xe3db9b['model']],'as':_0xe3db9b['as'],'attributes':_0xe3db9b[_0xfee2('0x1a')],'include':_0xe3db9b[_0xfee2('0x1b')]?_[_0xfee2('0x1c')](_0xe3db9b['include'],function(_0x468f74){return{'model':db[_0x468f74[_0xfee2('0x1d')]],'as':_0x468f74['as'],'attributes':_0x468f74[_0xfee2('0x1a')],'include':_0x468f74[_0xfee2('0x1b')]?_[_0xfee2('0x1c')](_0x468f74[_0xfee2('0x1b')],function(_0x219bb9){return{'model':db[_0x219bb9[_0xfee2('0x1d')]],'as':_0x219bb9['as'],'attributes':_0x219bb9[_0xfee2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdc50b5){logger['info'](_0xfee2('0x15'),_0x476779);logger['debug'](_0xfee2('0x15'),_0x476779,JSON['stringify'](_0xdc50b5));_0x5933f8(_0xdc50b5);})[_0xfee2('0x1e')](function(_0x10d714){logger[_0xfee2('0x11')](_0xfee2('0x15'),_0x10d714[_0xfee2('0x13')],_0x476779);_0x1f8c79(_0x38d3a7['error'](0x1f4,_0x10d714['message']));});});};exports[_0xfee2('0x1f')]=function(_0x196606){var _0x3e3c32=this;return new Promise(function(_0x87c6c6,_0x89724b){return db[_0xfee2('0x16')][_0xfee2('0x20')]({'raw':_0x196606[_0xfee2('0x18')]?_0x196606[_0xfee2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x196606['options']?_0x196606[_0xfee2('0x18')][_0xfee2('0x19')]||null:null,'attributes':_0x196606[_0xfee2('0x18')]?_0x196606[_0xfee2('0x18')]['attributes']||null:null,'include':_0x196606['options']?_0x196606[_0xfee2('0x18')]['include']?_[_0xfee2('0x1c')](_0x196606['options'][_0xfee2('0x1b')],function(_0x26e85d){return{'model':db[_0x26e85d[_0xfee2('0x1d')]],'as':_0x26e85d['as'],'attributes':_0x26e85d[_0xfee2('0x1a')],'include':_0x26e85d[_0xfee2('0x1b')]?_[_0xfee2('0x1c')](_0x26e85d['include'],function(_0x29ea68){return{'model':db[_0x29ea68[_0xfee2('0x1d')]],'as':_0x29ea68['as'],'attributes':_0x29ea68['attributes'],'include':_0x29ea68['include']?_[_0xfee2('0x1c')](_0x29ea68[_0xfee2('0x1b')],function(_0x2c134b){return{'model':db[_0x2c134b[_0xfee2('0x1d')]],'as':_0x2c134b['as'],'attributes':_0x2c134b[_0xfee2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfee2('0x21')](function(_0x30e428){logger[_0xfee2('0xc')](_0xfee2('0x1f'),_0x196606);logger[_0xfee2('0x22')](_0xfee2('0x1f'),_0x196606,JSON[_0xfee2('0x10')](_0x30e428));_0x87c6c6(_0x30e428);})['catch'](function(_0x27db2b){logger['error'](_0xfee2('0x1f'),_0x27db2b[_0xfee2('0x13')],_0x196606);_0x89724b(_0x3e3c32[_0xfee2('0x11')](0x1f4,_0x27db2b[_0xfee2('0x13')]));});});}; \ No newline at end of file +var _0x7f2d=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','limit','include','map','model','attributes','debug','ShowVoiceQueue','raw','where','then','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51c449,_0x11113a){var _0x513e3d=function(_0x596b9c){while(--_0x596b9c){_0x51c449['push'](_0x51c449['shift']());}};_0x513e3d(++_0x11113a);}(_0x7f2d,0x6e));var _0xd7f2=function(_0x8ec6d2,_0x1b4047){_0x8ec6d2=_0x8ec6d2-0x0;var _0x17933a=_0x7f2d[_0x8ec6d2];return _0x17933a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd7f2('0x0'));var fs=require('fs');var Redis=require(_0xd7f2('0x1'));var db=require(_0xd7f2('0x2'))['db'];var utils=require(_0xd7f2('0x3'));var logger=require('../../config/logger')(_0xd7f2('0x4'));var config=require(_0xd7f2('0x5'));var jayson=require(_0xd7f2('0x6'));var client=jayson[_0xd7f2('0x7')][_0xd7f2('0x8')]({'port':0x232a});config[_0xd7f2('0x9')]=_['defaults'](config[_0xd7f2('0x9')],{'host':_0xd7f2('0xa'),'port':0x18eb});var socket=require(_0xd7f2('0xb'))(new Redis(config[_0xd7f2('0x9')]));require('./voiceQueue.socket')[_0xd7f2('0xc')](socket);function respondWithRpcPromise(_0x149dd6,_0x5f4e3a,_0x38153f){return new BPromise(function(_0x55c85c,_0x4a3d63){return client[_0xd7f2('0xd')](_0x149dd6,_0x38153f)['then'](function(_0x4f97d7){logger[_0xd7f2('0xe')](_0xd7f2('0xf'),_0x5f4e3a,_0xd7f2('0x10'));logger['debug'](_0xd7f2('0x11'),_0x5f4e3a,_0xd7f2('0x10'),JSON[_0xd7f2('0x12')](_0x4f97d7));if(_0x4f97d7['error']){if(_0x4f97d7['error'][_0xd7f2('0x13')]===0x1f4){logger[_0xd7f2('0x14')](_0xd7f2('0xf'),_0x5f4e3a,_0x4f97d7[_0xd7f2('0x14')]['message']);return _0x4a3d63(_0x4f97d7[_0xd7f2('0x14')][_0xd7f2('0x15')]);}logger['error'](_0xd7f2('0xf'),_0x5f4e3a,_0x4f97d7[_0xd7f2('0x14')]['message']);return _0x55c85c(_0x4f97d7[_0xd7f2('0x14')][_0xd7f2('0x15')]);}else{logger[_0xd7f2('0xe')](_0xd7f2('0xf'),_0x5f4e3a,_0xd7f2('0x10'));_0x55c85c(_0x4f97d7[_0xd7f2('0x16')][_0xd7f2('0x15')]);}})[_0xd7f2('0x17')](function(_0x52b7b1){logger[_0xd7f2('0x14')](_0xd7f2('0xf'),_0x5f4e3a,_0x52b7b1);_0x4a3d63(_0x52b7b1);});});}exports[_0xd7f2('0x18')]=function(_0x19f932){var _0xf90e2c=this;return new Promise(function(_0x1043d0,_0x2e534e){return db[_0xd7f2('0x19')][_0xd7f2('0x1a')]({'raw':_0x19f932['options']?_0x19f932[_0xd7f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19f932[_0xd7f2('0x1b')]?_0x19f932[_0xd7f2('0x1b')]['where']||null:null,'attributes':_0x19f932['options']?_0x19f932[_0xd7f2('0x1b')]['attributes']||null:null,'limit':_0x19f932['options']?_0x19f932[_0xd7f2('0x1b')][_0xd7f2('0x1c')]||null:null,'include':_0x19f932[_0xd7f2('0x1b')]?_0x19f932[_0xd7f2('0x1b')][_0xd7f2('0x1d')]?_[_0xd7f2('0x1e')](_0x19f932[_0xd7f2('0x1b')][_0xd7f2('0x1d')],function(_0x47abce){return{'model':db[_0x47abce[_0xd7f2('0x1f')]],'as':_0x47abce['as'],'attributes':_0x47abce['attributes'],'include':_0x47abce[_0xd7f2('0x1d')]?_[_0xd7f2('0x1e')](_0x47abce['include'],function(_0x4b0a3e){return{'model':db[_0x4b0a3e['model']],'as':_0x4b0a3e['as'],'attributes':_0x4b0a3e['attributes'],'include':_0x4b0a3e['include']?_['map'](_0x4b0a3e['include'],function(_0x22e39d){return{'model':db[_0x22e39d[_0xd7f2('0x1f')]],'as':_0x22e39d['as'],'attributes':_0x22e39d[_0xd7f2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549dbd){logger[_0xd7f2('0xe')](_0xd7f2('0x18'),_0x19f932);logger[_0xd7f2('0x21')](_0xd7f2('0x18'),_0x19f932,JSON[_0xd7f2('0x12')](_0x549dbd));_0x1043d0(_0x549dbd);})['catch'](function(_0x535013){logger['error'](_0xd7f2('0x18'),_0x535013[_0xd7f2('0x15')],_0x19f932);_0x2e534e(_0xf90e2c[_0xd7f2('0x14')](0x1f4,_0x535013['message']));});});};exports[_0xd7f2('0x22')]=function(_0xef91fd){var _0x2b912b=this;return new Promise(function(_0x49a2fa,_0x25312e){return db['VoiceQueue']['find']({'raw':_0xef91fd[_0xd7f2('0x1b')]?_0xef91fd[_0xd7f2('0x1b')][_0xd7f2('0x23')]===undefined?!![]:![]:!![],'where':_0xef91fd['options']?_0xef91fd[_0xd7f2('0x1b')][_0xd7f2('0x24')]||null:null,'attributes':_0xef91fd[_0xd7f2('0x1b')]?_0xef91fd[_0xd7f2('0x1b')][_0xd7f2('0x20')]||null:null,'include':_0xef91fd[_0xd7f2('0x1b')]?_0xef91fd['options']['include']?_['map'](_0xef91fd[_0xd7f2('0x1b')][_0xd7f2('0x1d')],function(_0x1261d9){return{'model':db[_0x1261d9[_0xd7f2('0x1f')]],'as':_0x1261d9['as'],'attributes':_0x1261d9[_0xd7f2('0x20')],'include':_0x1261d9['include']?_[_0xd7f2('0x1e')](_0x1261d9[_0xd7f2('0x1d')],function(_0x398a0e){return{'model':db[_0x398a0e['model']],'as':_0x398a0e['as'],'attributes':_0x398a0e[_0xd7f2('0x20')],'include':_0x398a0e[_0xd7f2('0x1d')]?_[_0xd7f2('0x1e')](_0x398a0e[_0xd7f2('0x1d')],function(_0x2baf6b){return{'model':db[_0x2baf6b[_0xd7f2('0x1f')]],'as':_0x2baf6b['as'],'attributes':_0x2baf6b[_0xd7f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd7f2('0x25')](function(_0x3841fa){logger['info'](_0xd7f2('0x22'),_0xef91fd);logger[_0xd7f2('0x21')]('ShowVoiceQueue',_0xef91fd,JSON['stringify'](_0x3841fa));_0x49a2fa(_0x3841fa);})[_0xd7f2('0x17')](function(_0x426b32){logger[_0xd7f2('0x14')](_0xd7f2('0x22'),_0x426b32[_0xd7f2('0x15')],_0xef91fd);_0x25312e(_0x2b912b[_0xd7f2('0x14')](0x1f4,_0x426b32[_0xd7f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d6ead32..5256364 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 _0xe11e=['emit','removeListener','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0xe11e,0x69));var _0xee11=function(_0x132d0a,_0x49b5e6){_0x132d0a=_0x132d0a-0x0;var _0x3fc61b=_0xe11e[_0x132d0a];return _0x3fc61b;};'use strict';var VoiceQueueEvents=require(_0xee11('0x0'));var events=[_0xee11('0x1'),_0xee11('0x2'),'update'];function createListener(_0x405741,_0x4d1d58){return function(_0x82c6a3){_0x4d1d58[_0xee11('0x3')](_0x405741,_0x82c6a3);};}function removeListener(_0x17fb8d,_0x5acac7){return function(){VoiceQueueEvents[_0xee11('0x4')](_0x17fb8d,_0x5acac7);};}exports['register']=function(_0x23240f){for(var _0x1b376f=0x0,_0x3301a0=events['length'];_0x1b376f<_0x3301a0;_0x1b376f++){var _0x5d6e4c=events[_0x1b376f];var _0x22faf9=createListener(_0xee11('0x5')+_0x5d6e4c,_0x23240f);VoiceQueueEvents['on'](_0x5d6e4c,_0x22faf9);}}; \ No newline at end of file +var _0x6b81=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','update'];(function(_0x535aac,_0x588a6e){var _0x4e8fea=function(_0x328af6){while(--_0x328af6){_0x535aac['push'](_0x535aac['shift']());}};_0x4e8fea(++_0x588a6e);}(_0x6b81,0x1a2));var _0x16b8=function(_0x4ed9c9,_0x1b9648){_0x4ed9c9=_0x4ed9c9-0x0;var _0x591fc0=_0x6b81[_0x4ed9c9];return _0x591fc0;};'use strict';var VoiceQueueEvents=require(_0x16b8('0x0'));var events=['save','remove',_0x16b8('0x1')];function createListener(_0x2fc18a,_0x2bb0ef){return function(_0x190b24){_0x2bb0ef[_0x16b8('0x2')](_0x2fc18a,_0x190b24);};}function removeListener(_0x262672,_0x536b66){return function(){VoiceQueueEvents[_0x16b8('0x3')](_0x262672,_0x536b66);};}exports[_0x16b8('0x4')]=function(_0x365a93){for(var _0x2bd4d7=0x0,_0x21145f=events[_0x16b8('0x5')];_0x2bd4d7<_0x21145f;_0x2bd4d7++){var _0x134c0a=events[_0x2bd4d7];var _0x3aefd6=createListener(_0x16b8('0x6')+_0x134c0a,_0x365a93);VoiceQueueEvents['on'](_0x134c0a,_0x3aefd6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d8c1518..15bf4a5 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 _0x8f3c=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4568fc,_0xb8d820){var _0x2ab0e0=function(_0x39fa2e){while(--_0x39fa2e){_0x4568fc['push'](_0x4568fc['shift']());}};_0x2ab0e0(++_0xb8d820);}(_0x8f3c,0x95));var _0xc8f3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8f3c[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xc8f3('0x0'));var util=require('util');var path=require(_0xc8f3('0x1'));var timeout=require('connect-timeout');var express=require(_0xc8f3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc8f3('0x3'));var interaction=require(_0xc8f3('0x4'));var config=require(_0xc8f3('0x5'));var controller=require(_0xc8f3('0x6'));router[_0xc8f3('0x7')]('/',auth[_0xc8f3('0x8')](),controller[_0xc8f3('0x9')]);router[_0xc8f3('0x7')](_0xc8f3('0xa'),auth['isAuthenticated'](),controller[_0xc8f3('0xb')]);router[_0xc8f3('0x7')](_0xc8f3('0xc'),auth['isAuthenticated'](),controller[_0xc8f3('0xd')]);router['get'](_0xc8f3('0xe'),auth[_0xc8f3('0x8')](),controller[_0xc8f3('0xf')]);router[_0xc8f3('0x10')]('/',auth[_0xc8f3('0x8')](),controller[_0xc8f3('0x11')]);router[_0xc8f3('0x12')](_0xc8f3('0xe'),auth[_0xc8f3('0x8')](),controller[_0xc8f3('0x13')]);router[_0xc8f3('0x14')](_0xc8f3('0xe'),auth[_0xc8f3('0x8')](),controller[_0xc8f3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc900=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','destroy','exports','path'];(function(_0x392673,_0x3e33b2){var _0x39f0ab=function(_0x89fd6a){while(--_0x89fd6a){_0x392673['push'](_0x392673['shift']());}};_0x39f0ab(++_0x3e33b2);}(_0xc900,0xb3));var _0x0c90=function(_0x427a66,_0x5a1976){_0x427a66=_0x427a66-0x0;var _0x23d843=_0xc900[_0x427a66];return _0x23d843;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/describe',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['put'](_0x0c90('0xd'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['delete'](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x12')]);module[_0x0c90('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 40b0daa..25850b9 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 _0xa9d2=['queuecallerjoinAt','format','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0xa9d2,0x174));var _0x2a9d=function(_0x3e233b,_0x3cba37){_0x3e233b=_0x3e233b-0x0;var _0x598bb8=_0xa9d2[_0x3e233b];return _0x598bb8;};'use strict';var Sequelize=require(_0x2a9d('0x0'));var moment=require(_0x2a9d('0x1'));module[_0x2a9d('0x2')]={'type':{'type':Sequelize[_0x2a9d('0x3')]},'uniqueid':{'type':Sequelize[_0x2a9d('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a9d('0x3')]},'queue':{'type':Sequelize[_0x2a9d('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x2a9d('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x2a9d('0x4')],'set':function(_0x3422bc){var _0x4f48f4=moment(_0x3422bc);var _0x425e91=moment(this['getDataValue'](_0x2a9d('0x5')))[_0x2a9d('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2e5bd1=_0x4f48f4['diff'](_0x425e91,'seconds');this[_0x2a9d('0x7')](_0x2a9d('0x8'),_0x3422bc);this['setDataValue'](_0x2a9d('0x9'),_0x2e5bd1||null);}},'position':{'type':Sequelize[_0x2a9d('0xa')]},'count':{'type':Sequelize[_0x2a9d('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x2a9d('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a9d('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x2a9d('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2a9d('0x4')]},'queuecallerexit':{'type':Sequelize[_0x2a9d('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a9d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x2a9d('0x3')],'comment':_0x2a9d('0xc')},'originalposition':{'type':Sequelize[_0x2a9d('0xa')]},'channel':{'type':Sequelize[_0x2a9d('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2a9d('0x3')]},'context':{'type':Sequelize[_0x2a9d('0x3')]},'exten':{'type':Sequelize[_0x2a9d('0x3')]},'priority':{'type':Sequelize[_0x2a9d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2a9d('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2a9d('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2a9d('0x3')]},'transfer':{'type':Sequelize[_0x2a9d('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2a9d('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2a9d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2a9d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2a9d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2a9d('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x2a9d('0x3')]}}; \ No newline at end of file +var _0x1f80=['queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x516fc1,_0x974bd7){var _0x10f82f=function(_0x4c28ce){while(--_0x4c28ce){_0x516fc1['push'](_0x516fc1['shift']());}};_0x10f82f(++_0x974bd7);}(_0x1f80,0x191));var _0x01f8=function(_0x3e6f2a,_0x3817b3){_0x3e6f2a=_0x3e6f2a-0x0;var _0x14da2d=_0x1f80[_0x3e6f2a];return _0x14da2d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01f8('0x0'));module[_0x01f8('0x1')]={'type':{'type':Sequelize[_0x01f8('0x2')]},'uniqueid':{'type':Sequelize[_0x01f8('0x2')]},'calleridnum':{'type':Sequelize[_0x01f8('0x2')]},'calleridname':{'type':Sequelize[_0x01f8('0x2')]},'queue':{'type':Sequelize[_0x01f8('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x01f8('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x01f8('0x3')],'set':function(_0x2e7e75){var _0x1fe500=moment(_0x2e7e75);var _0x410bd8=moment(this[_0x01f8('0x4')](_0x01f8('0x5')))[_0x01f8('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31fa99=_0x1fe500['diff'](_0x410bd8,_0x01f8('0x7'));this[_0x01f8('0x8')](_0x01f8('0x9'),_0x2e7e75);this[_0x01f8('0x8')](_0x01f8('0xa'),_0x31fa99||null);}},'position':{'type':Sequelize[_0x01f8('0xb')]},'count':{'type':Sequelize[_0x01f8('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x01f8('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x01f8('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x01f8('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x01f8('0x3')]},'queuecallerexit':{'type':Sequelize[_0x01f8('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x01f8('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x01f8('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x01f8('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x01f8('0x2')]},'connectedlinename':{'type':Sequelize[_0x01f8('0x2')]},'accountcode':{'type':Sequelize[_0x01f8('0x2')]},'context':{'type':Sequelize[_0x01f8('0x2')]},'exten':{'type':Sequelize[_0x01f8('0x2')]},'priority':{'type':Sequelize[_0x01f8('0x2')]},'holdtime':{'type':Sequelize[_0x01f8('0xb')]},'mohtime':{'type':Sequelize[_0x01f8('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x01f8('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x01f8('0x2')],'comment':_0x01f8('0xd')},'transferexten':{'type':Sequelize[_0x01f8('0x2')]},'transferuniqueid':{'type':Sequelize[_0x01f8('0x2')]},'disposition':{'type':Sequelize[_0x01f8('0x2')]},'secondDisposition':{'type':Sequelize[_0x01f8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x01f8('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x01f8('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 50918a3..e2f2153 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 _0x65d0=['save','update','then','destroy','error','stack','name','send','VoiceQueueReport','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','find','describe','getVoiceQueuesReport','length','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x218ea1,_0x5e840a){var _0x52fc29=function(_0x373557){while(--_0x373557){_0x218ea1['push'](_0x218ea1['shift']());}};_0x52fc29(++_0x5e840a);}(_0x65d0,0x7c));var _0x065d=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x65d0[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x065d('0x0'));var rimraf=require(_0x065d('0x1'));var zipdir=require(_0x065d('0x2'));var jsonpatch=require(_0x065d('0x3'));var rp=require(_0x065d('0x4'));var moment=require(_0x065d('0x5'));var BPromise=require(_0x065d('0x6'));var Mustache=require(_0x065d('0x7'));var util=require(_0x065d('0x8'));var path=require(_0x065d('0x9'));var sox=require(_0x065d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x065d('0xb'));var _=require('lodash');var squel=require(_0x065d('0xc'));var crypto=require('crypto');var jsforce=require(_0x065d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x065d('0xe'));var querystring=require('querystring');var Papa=require(_0x065d('0xf'));var Redis=require('ioredis');var authService=require(_0x065d('0x10'));var qs=require(_0x065d('0x11'));var as=require(_0x065d('0x12'));var hardwareService=require(_0x065d('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x065d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x065d('0x15'))['db'];config[_0x065d('0x16')]=_[_0x065d('0x17')](config['redis'],{'host':_0x065d('0x18'),'port':0x18eb});var socket=require(_0x065d('0x19'))(new Redis(config[_0x065d('0x16')]));require(_0x065d('0x1a'))['register'](socket);function respondWithStatusCode(_0x324b2e,_0x15f9c8){_0x15f9c8=_0x15f9c8||0xcc;return function(_0x231bef){if(_0x231bef){return _0x324b2e[_0x065d('0x1b')](_0x15f9c8);}return _0x324b2e[_0x065d('0x1c')](_0x15f9c8)[_0x065d('0x1d')]();};}function respondWithResult(_0x560f8d,_0x2678ba){_0x2678ba=_0x2678ba||0xc8;return function(_0x437c91){if(_0x437c91){return _0x560f8d[_0x065d('0x1c')](_0x2678ba)[_0x065d('0x1e')](_0x437c91);}};}function respondWithFilteredResult(_0x469a56,_0xf6a3c8){return function(_0x44121f){if(_0x44121f){var _0x1e8a54=typeof _0xf6a3c8[_0x065d('0x1f')]===_0x065d('0x20')&&typeof _0xf6a3c8[_0x065d('0x21')]===_0x065d('0x20');var _0xf034c3=_0x44121f['count'];var _0x26daea=_0x1e8a54?0x0:_0xf6a3c8['offset'];var _0x43095b=_0x1e8a54?_0x44121f[_0x065d('0x22')]:_0xf6a3c8[_0x065d('0x1f')]+_0xf6a3c8[_0x065d('0x21')];var _0x57707f;if(_0x43095b>=_0xf034c3){_0x43095b=_0xf034c3;_0x57707f=0xc8;}else{_0x57707f=0xce;}_0x469a56[_0x065d('0x1c')](_0x57707f);return _0x469a56['set'](_0x065d('0x23'),_0x26daea+'-'+_0x43095b+'/'+_0xf034c3)[_0x065d('0x1e')](_0x44121f);}return null;};}function patchUpdates(_0xff8789){return function(_0x45ce89){try{jsonpatch[_0x065d('0x24')](_0x45ce89,_0xff8789,!![]);}catch(_0x2f2261){return BPromise[_0x065d('0x25')](_0x2f2261);}return _0x45ce89[_0x065d('0x26')]();};}function saveUpdates(_0xa786f,_0x333698){return function(_0x3c7418){if(_0x3c7418){return _0x3c7418[_0x065d('0x27')](_0xa786f)[_0x065d('0x28')](function(_0x4f83c8){return _0x4f83c8;});}return null;};}function removeEntity(_0x223203,_0x4712b9){return function(_0x3d5f96){if(_0x3d5f96){return _0x3d5f96[_0x065d('0x29')]()['then'](function(){_0x223203[_0x065d('0x1c')](0xcc)[_0x065d('0x1d')]();});}};}function handleEntityNotFound(_0x264445,_0x585865){return function(_0x15ec07){if(!_0x15ec07){_0x264445['sendStatus'](0x194);}return _0x15ec07;};}function handleError(_0x1f986c,_0x243f4d){_0x243f4d=_0x243f4d||0x1f4;return function(_0x2efaf3){logger[_0x065d('0x2a')](_0x2efaf3[_0x065d('0x2b')]);if(_0x2efaf3[_0x065d('0x2c')]){delete _0x2efaf3[_0x065d('0x2c')];}_0x1f986c[_0x065d('0x1c')](_0x243f4d)[_0x065d('0x2d')](_0x2efaf3);};}exports['index']=function(_0xe5c05f,_0x344a4e){var _0x217705={},_0x22d956={},_0x25db92={'count':0x0,'rows':[]};var _0x26de38=_['map'](db[_0x065d('0x2e')]['rawAttributes'],function(_0x38222b){return{'name':_0x38222b[_0x065d('0x2f')],'type':_0x38222b[_0x065d('0x30')][_0x065d('0x31')]};});_0x22d956[_0x065d('0x32')]=_[_0x065d('0x33')](_0x26de38,_0x065d('0x2c'));_0x22d956[_0x065d('0x34')]=_['keys'](_0xe5c05f['query']);_0x22d956['filters']=_[_0x065d('0x35')](_0x22d956[_0x065d('0x32')],_0x22d956[_0x065d('0x34')]);_0x217705[_0x065d('0x36')]=_[_0x065d('0x35')](_0x22d956['model'],qs['fields'](_0xe5c05f['query'][_0x065d('0x37')]));_0x217705['attributes']=_0x217705[_0x065d('0x36')]['length']?_0x217705['attributes']:_0x22d956[_0x065d('0x32')];if(!_0xe5c05f[_0x065d('0x34')][_0x065d('0x38')](_0x065d('0x39'))){_0x217705[_0x065d('0x21')]=qs[_0x065d('0x21')](_0xe5c05f[_0x065d('0x34')][_0x065d('0x21')]);_0x217705[_0x065d('0x1f')]=qs[_0x065d('0x1f')](_0xe5c05f[_0x065d('0x34')][_0x065d('0x1f')]);}_0x217705[_0x065d('0x3a')]=qs[_0x065d('0x3b')](_0xe5c05f[_0x065d('0x34')]['sort']);_0x217705['where']=qs[_0x065d('0x3c')](_[_0x065d('0x3d')](_0xe5c05f[_0x065d('0x34')],_0x22d956[_0x065d('0x3c')]),_0x26de38);if(_0xe5c05f[_0x065d('0x34')][_0x065d('0x3e')]){_0x217705[_0x065d('0x3f')]=_[_0x065d('0x40')](_0x217705['where'],{'$or':_[_0x065d('0x33')](_0x26de38,function(_0x419f9f){if(_0x419f9f[_0x065d('0x30')]!=='VIRTUAL'){var _0x4e4502={};_0x4e4502[_0x419f9f['name']]={'$like':'%'+_0xe5c05f[_0x065d('0x34')]['filter']+'%'};return _0x4e4502;}})});}_0x217705=_[_0x065d('0x40')]({},_0x217705,_0xe5c05f[_0x065d('0x41')]);var _0xf5487e={'where':_0x217705['where']};return db[_0x065d('0x2e')][_0x065d('0x22')](_0xf5487e)[_0x065d('0x28')](function(_0x243bb3){_0x25db92[_0x065d('0x22')]=_0x243bb3;if(_0xe5c05f[_0x065d('0x34')]['includeAll']){_0x217705[_0x065d('0x42')]=[{'all':!![]}];}return db[_0x065d('0x2e')]['findAll'](_0x217705);})['then'](function(_0x5bd8bf){_0x25db92[_0x065d('0x43')]=_0x5bd8bf;return _0x25db92;})['then'](respondWithFilteredResult(_0x344a4e,_0x217705))[_0x065d('0x44')](handleError(_0x344a4e,null));};exports[_0x065d('0x45')]=function(_0x1839bd,_0x1521b8){var _0x34e690={'raw':![],'where':{'id':_0x1839bd[_0x065d('0x46')]['id']}},_0x49d4fd={};_0x49d4fd[_0x065d('0x32')]=_[_0x065d('0x47')](db[_0x065d('0x2e')][_0x065d('0x48')]);_0x49d4fd[_0x065d('0x34')]=_[_0x065d('0x47')](_0x1839bd[_0x065d('0x34')]);_0x49d4fd[_0x065d('0x3c')]=_[_0x065d('0x35')](_0x49d4fd[_0x065d('0x32')],_0x49d4fd['query']);_0x34e690['attributes']=_['intersection'](_0x49d4fd['model'],qs[_0x065d('0x37')](_0x1839bd[_0x065d('0x34')][_0x065d('0x37')]));_0x34e690[_0x065d('0x36')]=_0x34e690[_0x065d('0x36')]['length']?_0x34e690[_0x065d('0x36')]:_0x49d4fd[_0x065d('0x32')];if(_0x1839bd[_0x065d('0x34')][_0x065d('0x49')]){_0x34e690[_0x065d('0x42')]=[{'all':!![]}];}_0x34e690=_[_0x065d('0x40')]({},_0x34e690,_0x1839bd[_0x065d('0x41')]);return db[_0x065d('0x2e')]['find'](_0x34e690)[_0x065d('0x28')](handleEntityNotFound(_0x1521b8,null))[_0x065d('0x28')](respondWithResult(_0x1521b8,null))[_0x065d('0x44')](handleError(_0x1521b8,null));};exports[_0x065d('0x4a')]=function(_0x4dfc37,_0x1d17e3){return db[_0x065d('0x2e')]['create'](_0x4dfc37[_0x065d('0x4b')],{})['then'](respondWithResult(_0x1d17e3,0xc9))[_0x065d('0x44')](handleError(_0x1d17e3,null));};exports['update']=function(_0x506b91,_0x54de90){if(_0x506b91[_0x065d('0x4b')]['id']){delete _0x506b91[_0x065d('0x4b')]['id'];}return db[_0x065d('0x2e')][_0x065d('0x4c')]({'where':{'id':_0x506b91[_0x065d('0x46')]['id']}})['then'](handleEntityNotFound(_0x54de90,null))['then'](saveUpdates(_0x506b91[_0x065d('0x4b')],null))['then'](respondWithResult(_0x54de90,null))[_0x065d('0x44')](handleError(_0x54de90,null));};exports[_0x065d('0x29')]=function(_0xa8f88e,_0x3776cc){return db[_0x065d('0x2e')]['find']({'where':{'id':_0xa8f88e[_0x065d('0x46')]['id']}})[_0x065d('0x28')](handleEntityNotFound(_0x3776cc,null))[_0x065d('0x28')](removeEntity(_0x3776cc,null))['catch'](handleError(_0x3776cc,null));};exports[_0x065d('0x4d')]=function(_0x4d6a14,_0x17b356){return db[_0x065d('0x2e')][_0x065d('0x4d')]()[_0x065d('0x28')](respondWithResult(_0x17b356,null))[_0x065d('0x44')](handleError(_0x17b356,null));};exports[_0x065d('0x4e')]=function(_0x3b1ddf,_0x3b0206){var _0x223257={},_0x59e551={},_0x7c8aec={'count':0x0,'rows':[]};_0x59e551[_0x065d('0x32')]=_[_0x065d('0x47')](db[_0x065d('0x2e')][_0x065d('0x48')]);_0x59e551['query']=_['keys'](_0x3b1ddf['query']);_0x59e551[_0x065d('0x3c')]=_[_0x065d('0x35')](_0x59e551[_0x065d('0x32')],_0x59e551[_0x065d('0x34')]);_0x223257[_0x065d('0x36')]=_[_0x065d('0x35')](_0x59e551['model'],qs[_0x065d('0x37')](_0x3b1ddf[_0x065d('0x34')][_0x065d('0x37')]));_0x223257[_0x065d('0x36')]=_0x223257[_0x065d('0x36')][_0x065d('0x4f')]?_0x223257[_0x065d('0x36')]:_0x59e551[_0x065d('0x32')];if(!_0x3b1ddf[_0x065d('0x34')]['hasOwnProperty'](_0x065d('0x39'))){_0x223257[_0x065d('0x21')]=qs[_0x065d('0x21')](_0x3b1ddf['query'][_0x065d('0x21')]);_0x223257[_0x065d('0x1f')]=qs[_0x065d('0x1f')](_0x3b1ddf['query'][_0x065d('0x1f')]);}_0x223257['order']=qs[_0x065d('0x3b')](_0x3b1ddf['query'][_0x065d('0x3b')]);_0x223257[_0x065d('0x3f')]=qs['filters'](_[_0x065d('0x3d')](_0x3b1ddf['query'],_0x59e551['filters']));if(_0x3b1ddf[_0x065d('0x34')][_0x065d('0x3e')]){_0x223257[_0x065d('0x3f')]=_[_0x065d('0x40')](_0x223257[_0x065d('0x3f')],{'$or':_[_0x065d('0x33')](_0x223257[_0x065d('0x36')],function(_0x4ee131){var _0x3467d9={};_0x3467d9[_0x4ee131]={'$like':'%'+_0x3b1ddf[_0x065d('0x34')][_0x065d('0x3e')]+'%'};return _0x3467d9;})});}_0x223257=_[_0x065d('0x40')]({},_0x223257,_0x3b1ddf[_0x065d('0x41')]);var _0x55a53c={'where':_0x223257[_0x065d('0x3f')]};return db[_0x065d('0x2e')][_0x065d('0x22')](_0x55a53c)[_0x065d('0x28')](function(_0x185588){_0x7c8aec[_0x065d('0x22')]=_0x185588;if(_0x3b1ddf[_0x065d('0x34')][_0x065d('0x49')]){_0x223257[_0x065d('0x42')]=[{'all':!![]}];}return db[_0x065d('0x2e')][_0x065d('0x50')](_0x223257);})[_0x065d('0x28')](function(_0x54b8a8){_0x7c8aec[_0x065d('0x43')]=_0x54b8a8;return _0x7c8aec;})[_0x065d('0x28')](respondWithFilteredResult(_0x3b0206,_0x223257,'getVoiceQueuesReport'))['catch'](handleError(_0x3b0206,null,_0x065d('0x4e')));}; \ No newline at end of file +var _0xb0ae=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','then','destroy','stack','name','send','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','find','create','body','update','describe','order','pick','rows','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3f993e,_0x2d5757){var _0x39c135=function(_0x39e00b){while(--_0x39e00b){_0x3f993e['push'](_0x3f993e['shift']());}};_0x39c135(++_0x2d5757);}(_0xb0ae,0xe0));var _0xeb0a=function(_0x5d72b0,_0x536f75){_0x5d72b0=_0x5d72b0-0x0;var _0x4eac19=_0xb0ae[_0x5d72b0];return _0x4eac19;};'use strict';var emlformat=require(_0xeb0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb0a('0x1'));var jsonpatch=require(_0xeb0a('0x2'));var rp=require('request-promise');var moment=require(_0xeb0a('0x3'));var BPromise=require(_0xeb0a('0x4'));var Mustache=require('mustache');var util=require(_0xeb0a('0x5'));var path=require(_0xeb0a('0x6'));var sox=require('sox');var csv=require(_0xeb0a('0x7'));var ejs=require(_0xeb0a('0x8'));var fs=require('fs');var fs_extra=require(_0xeb0a('0x9'));var _=require(_0xeb0a('0xa'));var squel=require(_0xeb0a('0xb'));var crypto=require(_0xeb0a('0xc'));var jsforce=require(_0xeb0a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb0a('0xe'));var Papa=require(_0xeb0a('0xf'));var Redis=require('ioredis');var authService=require(_0xeb0a('0x10'));var qs=require(_0xeb0a('0x11'));var as=require(_0xeb0a('0x12'));var hardwareService=require(_0xeb0a('0x13'));var logger=require(_0xeb0a('0x14'))(_0xeb0a('0x15'));var utils=require('../../config/utils');var config=require(_0xeb0a('0x16'));var licenseUtil=require(_0xeb0a('0x17'));var db=require(_0xeb0a('0x18'))['db'];config['redis']=_[_0xeb0a('0x19')](config[_0xeb0a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb0a('0x1b'))(new Redis(config[_0xeb0a('0x1a')]));require(_0xeb0a('0x1c'))[_0xeb0a('0x1d')](socket);function respondWithStatusCode(_0x3fd4da,_0x225aa3){_0x225aa3=_0x225aa3||0xcc;return function(_0xff2a3d){if(_0xff2a3d){return _0x3fd4da[_0xeb0a('0x1e')](_0x225aa3);}return _0x3fd4da[_0xeb0a('0x1f')](_0x225aa3)[_0xeb0a('0x20')]();};}function respondWithResult(_0x534965,_0x14371b){_0x14371b=_0x14371b||0xc8;return function(_0x5df7d8){if(_0x5df7d8){return _0x534965['status'](_0x14371b)[_0xeb0a('0x21')](_0x5df7d8);}};}function respondWithFilteredResult(_0x2bea56,_0x42e60b){return function(_0x4560d8){if(_0x4560d8){var _0x58f99=typeof _0x42e60b[_0xeb0a('0x22')]===_0xeb0a('0x23')&&typeof _0x42e60b['limit']===_0xeb0a('0x23');var _0x50db2d=_0x4560d8[_0xeb0a('0x24')];var _0x29ee1c=_0x58f99?0x0:_0x42e60b[_0xeb0a('0x22')];var _0x54c59d=_0x58f99?_0x4560d8[_0xeb0a('0x24')]:_0x42e60b['offset']+_0x42e60b['limit'];var _0x5a225b;if(_0x54c59d>=_0x50db2d){_0x54c59d=_0x50db2d;_0x5a225b=0xc8;}else{_0x5a225b=0xce;}_0x2bea56[_0xeb0a('0x1f')](_0x5a225b);return _0x2bea56['set']('Content-Range',_0x29ee1c+'-'+_0x54c59d+'/'+_0x50db2d)[_0xeb0a('0x21')](_0x4560d8);}return null;};}function patchUpdates(_0x513431){return function(_0x29cc41){try{jsonpatch[_0xeb0a('0x25')](_0x29cc41,_0x513431,!![]);}catch(_0x50bfab){return BPromise[_0xeb0a('0x26')](_0x50bfab);}return _0x29cc41[_0xeb0a('0x27')]();};}function saveUpdates(_0x194d85,_0x437849){return function(_0xf258e2){if(_0xf258e2){return _0xf258e2['update'](_0x194d85)[_0xeb0a('0x28')](function(_0x3fe12f){return _0x3fe12f;});}return null;};}function removeEntity(_0x335481,_0x2558f3){return function(_0x4f9ce7){if(_0x4f9ce7){return _0x4f9ce7[_0xeb0a('0x29')]()['then'](function(){_0x335481[_0xeb0a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51eb9a,_0xabdd31){return function(_0x37da79){if(!_0x37da79){_0x51eb9a[_0xeb0a('0x1e')](0x194);}return _0x37da79;};}function handleError(_0xf617e0,_0x4bb82c){_0x4bb82c=_0x4bb82c||0x1f4;return function(_0x393323){logger['error'](_0x393323[_0xeb0a('0x2a')]);if(_0x393323['name']){delete _0x393323[_0xeb0a('0x2b')];}_0xf617e0[_0xeb0a('0x1f')](_0x4bb82c)[_0xeb0a('0x2c')](_0x393323);};}exports['index']=function(_0x3935f5,_0x2699d5){var _0x56ae1a={},_0x30a6d7={},_0x262141={'count':0x0,'rows':[]};var _0x1b2d25=_[_0xeb0a('0x2d')](db[_0xeb0a('0x2e')][_0xeb0a('0x2f')],function(_0xcee2ac){return{'name':_0xcee2ac['fieldName'],'type':_0xcee2ac[_0xeb0a('0x30')][_0xeb0a('0x31')]};});_0x30a6d7[_0xeb0a('0x32')]=_['map'](_0x1b2d25,_0xeb0a('0x2b'));_0x30a6d7[_0xeb0a('0x33')]=_[_0xeb0a('0x34')](_0x3935f5[_0xeb0a('0x33')]);_0x30a6d7['filters']=_[_0xeb0a('0x35')](_0x30a6d7[_0xeb0a('0x32')],_0x30a6d7['query']);_0x56ae1a[_0xeb0a('0x36')]=_['intersection'](_0x30a6d7['model'],qs[_0xeb0a('0x37')](_0x3935f5[_0xeb0a('0x33')][_0xeb0a('0x37')]));_0x56ae1a[_0xeb0a('0x36')]=_0x56ae1a['attributes'][_0xeb0a('0x38')]?_0x56ae1a['attributes']:_0x30a6d7[_0xeb0a('0x32')];if(!_0x3935f5[_0xeb0a('0x33')][_0xeb0a('0x39')](_0xeb0a('0x3a'))){_0x56ae1a[_0xeb0a('0x3b')]=qs[_0xeb0a('0x3b')](_0x3935f5[_0xeb0a('0x33')]['limit']);_0x56ae1a[_0xeb0a('0x22')]=qs[_0xeb0a('0x22')](_0x3935f5[_0xeb0a('0x33')]['offset']);}_0x56ae1a['order']=qs[_0xeb0a('0x3c')](_0x3935f5[_0xeb0a('0x33')][_0xeb0a('0x3c')]);_0x56ae1a[_0xeb0a('0x3d')]=qs[_0xeb0a('0x3e')](_['pick'](_0x3935f5[_0xeb0a('0x33')],_0x30a6d7[_0xeb0a('0x3e')]),_0x1b2d25);if(_0x3935f5[_0xeb0a('0x33')]['filter']){_0x56ae1a[_0xeb0a('0x3d')]=_[_0xeb0a('0x3f')](_0x56ae1a[_0xeb0a('0x3d')],{'$or':_['map'](_0x1b2d25,function(_0x65e1ec){if(_0x65e1ec[_0xeb0a('0x30')]!==_0xeb0a('0x40')){var _0x221dde={};_0x221dde[_0x65e1ec['name']]={'$like':'%'+_0x3935f5[_0xeb0a('0x33')][_0xeb0a('0x41')]+'%'};return _0x221dde;}})});}_0x56ae1a=_['merge']({},_0x56ae1a,_0x3935f5[_0xeb0a('0x42')]);var _0x3eedfe={'where':_0x56ae1a['where']};return db[_0xeb0a('0x2e')][_0xeb0a('0x24')](_0x3eedfe)[_0xeb0a('0x28')](function(_0x3df67a){_0x262141[_0xeb0a('0x24')]=_0x3df67a;if(_0x3935f5[_0xeb0a('0x33')][_0xeb0a('0x43')]){_0x56ae1a['include']=[{'all':!![]}];}return db[_0xeb0a('0x2e')][_0xeb0a('0x44')](_0x56ae1a);})[_0xeb0a('0x28')](function(_0x412d45){_0x262141['rows']=_0x412d45;return _0x262141;})[_0xeb0a('0x28')](respondWithFilteredResult(_0x2699d5,_0x56ae1a))[_0xeb0a('0x45')](handleError(_0x2699d5,null));};exports['show']=function(_0x4dd6b5,_0x2dcc72){var _0xafea46={'raw':![],'where':{'id':_0x4dd6b5[_0xeb0a('0x46')]['id']}},_0x506608={};_0x506608['model']=_[_0xeb0a('0x34')](db[_0xeb0a('0x2e')]['rawAttributes']);_0x506608[_0xeb0a('0x33')]=_[_0xeb0a('0x34')](_0x4dd6b5[_0xeb0a('0x33')]);_0x506608[_0xeb0a('0x3e')]=_[_0xeb0a('0x35')](_0x506608[_0xeb0a('0x32')],_0x506608[_0xeb0a('0x33')]);_0xafea46[_0xeb0a('0x36')]=_[_0xeb0a('0x35')](_0x506608['model'],qs[_0xeb0a('0x37')](_0x4dd6b5[_0xeb0a('0x33')][_0xeb0a('0x37')]));_0xafea46['attributes']=_0xafea46[_0xeb0a('0x36')][_0xeb0a('0x38')]?_0xafea46['attributes']:_0x506608[_0xeb0a('0x32')];if(_0x4dd6b5['query'][_0xeb0a('0x43')]){_0xafea46[_0xeb0a('0x47')]=[{'all':!![]}];}_0xafea46=_[_0xeb0a('0x3f')]({},_0xafea46,_0x4dd6b5['options']);return db['VoiceQueueReport'][_0xeb0a('0x48')](_0xafea46)['then'](handleEntityNotFound(_0x2dcc72,null))[_0xeb0a('0x28')](respondWithResult(_0x2dcc72,null))[_0xeb0a('0x45')](handleError(_0x2dcc72,null));};exports[_0xeb0a('0x49')]=function(_0x40cd9d,_0x4e142b){return db[_0xeb0a('0x2e')][_0xeb0a('0x49')](_0x40cd9d[_0xeb0a('0x4a')],{})[_0xeb0a('0x28')](respondWithResult(_0x4e142b,0xc9))[_0xeb0a('0x45')](handleError(_0x4e142b,null));};exports[_0xeb0a('0x4b')]=function(_0x5d560d,_0x53ca5d){if(_0x5d560d[_0xeb0a('0x4a')]['id']){delete _0x5d560d[_0xeb0a('0x4a')]['id'];}return db[_0xeb0a('0x2e')][_0xeb0a('0x48')]({'where':{'id':_0x5d560d[_0xeb0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x53ca5d,null))[_0xeb0a('0x28')](saveUpdates(_0x5d560d[_0xeb0a('0x4a')],null))[_0xeb0a('0x28')](respondWithResult(_0x53ca5d,null))[_0xeb0a('0x45')](handleError(_0x53ca5d,null));};exports['destroy']=function(_0x117207,_0x5864c5){return db[_0xeb0a('0x2e')][_0xeb0a('0x48')]({'where':{'id':_0x117207['params']['id']}})[_0xeb0a('0x28')](handleEntityNotFound(_0x5864c5,null))[_0xeb0a('0x28')](removeEntity(_0x5864c5,null))[_0xeb0a('0x45')](handleError(_0x5864c5,null));};exports[_0xeb0a('0x4c')]=function(_0x54d19c,_0x27d1a4){return db[_0xeb0a('0x2e')]['describe']()[_0xeb0a('0x28')](respondWithResult(_0x27d1a4,null))[_0xeb0a('0x45')](handleError(_0x27d1a4,null));};exports['getVoiceQueuesReport']=function(_0x1dccc8,_0x5d7f90){var _0x32da31={},_0x2005c2={},_0x3c1626={'count':0x0,'rows':[]};_0x2005c2[_0xeb0a('0x32')]=_['keys'](db[_0xeb0a('0x2e')][_0xeb0a('0x2f')]);_0x2005c2['query']=_[_0xeb0a('0x34')](_0x1dccc8[_0xeb0a('0x33')]);_0x2005c2[_0xeb0a('0x3e')]=_[_0xeb0a('0x35')](_0x2005c2[_0xeb0a('0x32')],_0x2005c2['query']);_0x32da31[_0xeb0a('0x36')]=_[_0xeb0a('0x35')](_0x2005c2[_0xeb0a('0x32')],qs[_0xeb0a('0x37')](_0x1dccc8[_0xeb0a('0x33')][_0xeb0a('0x37')]));_0x32da31[_0xeb0a('0x36')]=_0x32da31[_0xeb0a('0x36')][_0xeb0a('0x38')]?_0x32da31['attributes']:_0x2005c2[_0xeb0a('0x32')];if(!_0x1dccc8[_0xeb0a('0x33')][_0xeb0a('0x39')]('nolimit')){_0x32da31[_0xeb0a('0x3b')]=qs[_0xeb0a('0x3b')](_0x1dccc8[_0xeb0a('0x33')][_0xeb0a('0x3b')]);_0x32da31[_0xeb0a('0x22')]=qs[_0xeb0a('0x22')](_0x1dccc8['query'][_0xeb0a('0x22')]);}_0x32da31[_0xeb0a('0x4d')]=qs['sort'](_0x1dccc8[_0xeb0a('0x33')][_0xeb0a('0x3c')]);_0x32da31[_0xeb0a('0x3d')]=qs[_0xeb0a('0x3e')](_[_0xeb0a('0x4e')](_0x1dccc8[_0xeb0a('0x33')],_0x2005c2[_0xeb0a('0x3e')]));if(_0x1dccc8['query'][_0xeb0a('0x41')]){_0x32da31[_0xeb0a('0x3d')]=_[_0xeb0a('0x3f')](_0x32da31['where'],{'$or':_[_0xeb0a('0x2d')](_0x32da31[_0xeb0a('0x36')],function(_0x4b91bd){var _0xd9bb02={};_0xd9bb02[_0x4b91bd]={'$like':'%'+_0x1dccc8[_0xeb0a('0x33')]['filter']+'%'};return _0xd9bb02;})});}_0x32da31=_[_0xeb0a('0x3f')]({},_0x32da31,_0x1dccc8[_0xeb0a('0x42')]);var _0x5d2cdc={'where':_0x32da31['where']};return db[_0xeb0a('0x2e')][_0xeb0a('0x24')](_0x5d2cdc)[_0xeb0a('0x28')](function(_0x36ae59){_0x3c1626[_0xeb0a('0x24')]=_0x36ae59;if(_0x1dccc8['query'][_0xeb0a('0x43')]){_0x32da31[_0xeb0a('0x47')]=[{'all':!![]}];}return db[_0xeb0a('0x2e')]['findAll'](_0x32da31);})[_0xeb0a('0x28')](function(_0x507353){_0x3c1626[_0xeb0a('0x4f')]=_0x507353;return _0x3c1626;})[_0xeb0a('0x28')](respondWithFilteredResult(_0x5d7f90,_0x32da31,_0xeb0a('0x50')))[_0xeb0a('0x45')](handleError(_0x5d7f90,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 1c8fb0c..ac998ff 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 _0x457c=['emit','hasOwnProperty','exports','events','VoiceQueueReport','setMaxListeners','update','remove'];(function(_0x284764,_0xba6718){var _0x63b855=function(_0x1a649b){while(--_0x1a649b){_0x284764['push'](_0x284764['shift']());}};_0x63b855(++_0xba6718);}(_0x457c,0x83));var _0xc457=function(_0x2eae1d,_0x77527f){_0x2eae1d=_0x2eae1d-0x0;var _0x5466b6=_0x457c[_0x2eae1d];return _0x5466b6;};'use strict';var EventEmitter=require(_0xc457('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xc457('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc457('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc457('0x3'),'afterDestroy':_0xc457('0x4')};function emitEvent(_0x6945a5){return function(_0x219996,_0x2f77d2,_0x4b14c2){VoiceQueueReportEvents[_0xc457('0x5')](_0x6945a5+':'+_0x219996['id'],_0x219996);VoiceQueueReportEvents[_0xc457('0x5')](_0x6945a5,_0x219996);_0x4b14c2(null);};}for(var e in events){if(events[_0xc457('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xc457('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x8f35=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook'];(function(_0x34158b,_0x6e54c0){var _0xf70991=function(_0x884d21){while(--_0x884d21){_0x34158b['push'](_0x34158b['shift']());}};_0xf70991(++_0x6e54c0);}(_0x8f35,0x1eb));var _0x58f3=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8f35[_0x51c819];return _0x15c5d2;};'use strict';var EventEmitter=require(_0x58f3('0x0'));var VoiceQueueReport=require(_0x58f3('0x1'))['db'][_0x58f3('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x58f3('0x3')](0x0);var events={'afterCreate':_0x58f3('0x4'),'afterUpdate':_0x58f3('0x5'),'afterDestroy':_0x58f3('0x6')};function emitEvent(_0x4b077d){return function(_0x4c2efe,_0x249035,_0x35b8f9){VoiceQueueReportEvents[_0x58f3('0x7')](_0x4b077d+':'+_0x4c2efe['id'],_0x4c2efe);VoiceQueueReportEvents[_0x58f3('0x7')](_0x4b077d,_0x4c2efe);_0x35b8f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x58f3('0x8')](e,emitEvent(event));}}module[_0x58f3('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9bd5278..4558d10 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 _0x06f4=['api','moment','path','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x11c1c6,_0x201db){var _0x24f5ee=function(_0x591594){while(--_0x591594){_0x11c1c6['push'](_0x11c1c6['shift']());}};_0x24f5ee(++_0x201db);}(_0x06f4,0x136));var _0x406f=function(_0x3b0009,_0x2df8f8){_0x3b0009=_0x3b0009-0x0;var _0xf866c1=_0x06f4[_0x3b0009];return _0xf866c1;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x406f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x406f('0xa')]},{'fields':[_0x406f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30fb=['calleridnum','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x4f8f46,_0x175355){var _0x3ee7e0=function(_0x4a8d7c){while(--_0x4a8d7c){_0x4f8f46['push'](_0x4f8f46['shift']());}};_0x3ee7e0(++_0x175355);}(_0x30fb,0x139));var _0xb30f=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0x30fb[_0x33c98e];return _0x39a756;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb30f('0x0'))('api');var moment=require(_0xb30f('0x1'));var BPromise=require('bluebird');var rp=require(_0xb30f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb30f('0x3'));var config=require(_0xb30f('0x4'));var attributes=require(_0xb30f('0x5'));module[_0xb30f('0x6')]=function(_0x11f6f9,_0x1bc29a){return _0x11f6f9[_0xb30f('0x7')](_0xb30f('0x8'),attributes,{'tableName':_0xb30f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xb30f('0xa')]},{'fields':[_0xb30f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bc3a662..2ea3f9c 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 _0x8c01=['CreateVoiceQueueReport','VoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','where','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','options','limit','include','map','attributes','model','GetVoiceQueueReport','catch'];(function(_0x4f750b,_0x4e3e43){var _0x918b39=function(_0x106d8f){while(--_0x106d8f){_0x4f750b['push'](_0x4f750b['shift']());}};_0x918b39(++_0x4e3e43);}(_0x8c01,0x118));var _0x18c0=function(_0xfafe19,_0x3da8f5){_0xfafe19=_0xfafe19-0x0;var _0x451060=_0x8c01[_0xfafe19];return _0x451060;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x18c0('0x0'));var rs=require(_0x18c0('0x1'));var fs=require('fs');var Redis=require(_0x18c0('0x2'));var db=require(_0x18c0('0x3'))['db'];var utils=require(_0x18c0('0x4'));var logger=require(_0x18c0('0x5'))(_0x18c0('0x6'));var config=require(_0x18c0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x18c0('0x8')][_0x18c0('0x9')]({'port':0x232a});config[_0x18c0('0xa')]=_['defaults'](config[_0x18c0('0xa')],{'host':_0x18c0('0xb'),'port':0x18eb});var socket=require(_0x18c0('0xc'))(new Redis(config[_0x18c0('0xa')]));require(_0x18c0('0xd'))['register'](socket);function respondWithRpcPromise(_0x8e85df,_0x24c079,_0x33b26b){return new BPromise(function(_0x32a9b1,_0x39f0cd){return client[_0x18c0('0xe')](_0x8e85df,_0x33b26b)[_0x18c0('0xf')](function(_0x42bcb5){logger[_0x18c0('0x10')](_0x18c0('0x11'),_0x24c079,_0x18c0('0x12'));logger[_0x18c0('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x24c079,'request\x20sent',JSON[_0x18c0('0x14')](_0x42bcb5));if(_0x42bcb5[_0x18c0('0x15')]){if(_0x42bcb5[_0x18c0('0x15')][_0x18c0('0x16')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x24c079,_0x42bcb5[_0x18c0('0x15')][_0x18c0('0x17')]);return _0x39f0cd(_0x42bcb5[_0x18c0('0x15')][_0x18c0('0x17')]);}logger['error'](_0x18c0('0x11'),_0x24c079,_0x42bcb5[_0x18c0('0x15')][_0x18c0('0x17')]);return _0x32a9b1(_0x42bcb5[_0x18c0('0x15')][_0x18c0('0x17')]);}else{logger[_0x18c0('0x10')](_0x18c0('0x11'),_0x24c079,_0x18c0('0x12'));_0x32a9b1(_0x42bcb5['result'][_0x18c0('0x17')]);}})['catch'](function(_0x30cb62){logger[_0x18c0('0x15')](_0x18c0('0x11'),_0x24c079,_0x30cb62);_0x39f0cd(_0x30cb62);});});}exports['GetVoiceQueueReport']=function(_0x4ec22c){var _0x13eaa4=this;return new Promise(function(_0x5a9872,_0x2e1ef9){return db['VoiceQueueReport']['findAll']({'raw':_0x4ec22c[_0x18c0('0x18')]?_0x4ec22c[_0x18c0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4ec22c[_0x18c0('0x18')]?_0x4ec22c['options']['where']||null:null,'attributes':_0x4ec22c[_0x18c0('0x18')]?_0x4ec22c[_0x18c0('0x18')]['attributes']||null:null,'limit':_0x4ec22c['options']?_0x4ec22c['options'][_0x18c0('0x19')]||null:null,'include':_0x4ec22c['options']?_0x4ec22c[_0x18c0('0x18')][_0x18c0('0x1a')]?_[_0x18c0('0x1b')](_0x4ec22c[_0x18c0('0x18')][_0x18c0('0x1a')],function(_0x50b90c){return{'model':db[_0x50b90c['model']],'as':_0x50b90c['as'],'attributes':_0x50b90c[_0x18c0('0x1c')],'include':_0x50b90c[_0x18c0('0x1a')]?_[_0x18c0('0x1b')](_0x50b90c['include'],function(_0x4536ae){return{'model':db[_0x4536ae[_0x18c0('0x1d')]],'as':_0x4536ae['as'],'attributes':_0x4536ae['attributes'],'include':_0x4536ae[_0x18c0('0x1a')]?_[_0x18c0('0x1b')](_0x4536ae[_0x18c0('0x1a')],function(_0x316ea0){return{'model':db[_0x316ea0['model']],'as':_0x316ea0['as'],'attributes':_0x316ea0['attributes']};}):[]};}):[]};}):[]:[]})[_0x18c0('0xf')](function(_0x372d53){logger[_0x18c0('0x10')](_0x18c0('0x1e'),_0x4ec22c);logger[_0x18c0('0x13')](_0x18c0('0x1e'),_0x4ec22c,JSON[_0x18c0('0x14')](_0x372d53));_0x5a9872(_0x372d53);})[_0x18c0('0x1f')](function(_0x859fb4){logger[_0x18c0('0x15')](_0x18c0('0x1e'),_0x859fb4['message'],_0x4ec22c);_0x2e1ef9(_0x13eaa4[_0x18c0('0x15')](0x1f4,_0x859fb4['message']));});});};exports[_0x18c0('0x20')]=function(_0x320b51){var _0x5f2b2c=this;return new Promise(function(_0x4d4a3f,_0x257747){return db[_0x18c0('0x21')]['create'](_0x320b51[_0x18c0('0x22')],{'raw':_0x320b51['options']?_0x320b51[_0x18c0('0x18')][_0x18c0('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x5efce0){logger[_0x18c0('0x10')](_0x18c0('0x20'),_0x320b51);logger[_0x18c0('0x13')](_0x18c0('0x20'),_0x320b51,JSON[_0x18c0('0x14')](_0x5efce0));_0x4d4a3f(_0x5efce0);})[_0x18c0('0x1f')](function(_0x43e727){logger[_0x18c0('0x15')](_0x18c0('0x20'),_0x43e727[_0x18c0('0x17')],_0x320b51);_0x257747(_0x5f2b2c[_0x18c0('0x15')](0x1f4,_0x43e727[_0x18c0('0x17')]));});});};exports[_0x18c0('0x24')]=function(_0x1f2b37){var _0x2e947c=this;return new Promise(function(_0x409eb5,_0x268dd6){return db[_0x18c0('0x21')][_0x18c0('0x25')](_0x1f2b37['body'],{'raw':_0x1f2b37[_0x18c0('0x18')]?_0x1f2b37['options'][_0x18c0('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2b37[_0x18c0('0x18')]?_0x1f2b37[_0x18c0('0x18')][_0x18c0('0x26')]||null:null,'attributes':_0x1f2b37[_0x18c0('0x18')]?_0x1f2b37[_0x18c0('0x18')][_0x18c0('0x1c')]||null:null,'limit':_0x1f2b37['options']?_0x1f2b37['options']['limit']||null:null})[_0x18c0('0xf')](function(_0x485c26){logger['info'](_0x18c0('0x24'),_0x1f2b37);logger[_0x18c0('0x13')]('UpdateVoiceQueueReport',_0x1f2b37,JSON[_0x18c0('0x14')](_0x485c26));_0x409eb5(_0x485c26);})[_0x18c0('0x1f')](function(_0xaf6bf9){logger[_0x18c0('0x15')](_0x18c0('0x24'),_0xaf6bf9[_0x18c0('0x17')],_0x1f2b37);_0x268dd6(_0x2e947c[_0x18c0('0x15')](0x1f4,_0xaf6bf9[_0x18c0('0x17')]));});});}; \ No newline at end of file +var _0x2282=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','include','attributes','map','model','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1742ae,_0x239428){var _0x3e03af=function(_0x4e1faa){while(--_0x4e1faa){_0x1742ae['push'](_0x1742ae['shift']());}};_0x3e03af(++_0x239428);}(_0x2282,0x125));var _0x2228=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x2282[_0x2f37e0];return _0x43ccce;};'use strict';var _=require(_0x2228('0x0'));var util=require(_0x2228('0x1'));var moment=require(_0x2228('0x2'));var BPromise=require(_0x2228('0x3'));var rs=require(_0x2228('0x4'));var fs=require('fs');var Redis=require(_0x2228('0x5'));var db=require(_0x2228('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2228('0x7'))(_0x2228('0x8'));var config=require(_0x2228('0x9'));var jayson=require(_0x2228('0xa'));var client=jayson[_0x2228('0xb')][_0x2228('0xc')]({'port':0x232a});config[_0x2228('0xd')]=_[_0x2228('0xe')](config[_0x2228('0xd')],{'host':_0x2228('0xf'),'port':0x18eb});var socket=require(_0x2228('0x10'))(new Redis(config[_0x2228('0xd')]));require(_0x2228('0x11'))[_0x2228('0x12')](socket);function respondWithRpcPromise(_0x1490ae,_0x526266,_0x597fa5){return new BPromise(function(_0x419ff6,_0x5746d4){return client[_0x2228('0x13')](_0x1490ae,_0x597fa5)[_0x2228('0x14')](function(_0x21de3e){logger[_0x2228('0x15')](_0x2228('0x16'),_0x526266,'request\x20sent');logger[_0x2228('0x17')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x526266,_0x2228('0x18'),JSON[_0x2228('0x19')](_0x21de3e));if(_0x21de3e[_0x2228('0x1a')]){if(_0x21de3e[_0x2228('0x1a')]['code']===0x1f4){logger[_0x2228('0x1a')](_0x2228('0x16'),_0x526266,_0x21de3e[_0x2228('0x1a')][_0x2228('0x1b')]);return _0x5746d4(_0x21de3e['error'][_0x2228('0x1b')]);}logger[_0x2228('0x1a')](_0x2228('0x16'),_0x526266,_0x21de3e['error']['message']);return _0x419ff6(_0x21de3e[_0x2228('0x1a')][_0x2228('0x1b')]);}else{logger[_0x2228('0x15')](_0x2228('0x16'),_0x526266,_0x2228('0x18'));_0x419ff6(_0x21de3e[_0x2228('0x1c')]['message']);}})[_0x2228('0x1d')](function(_0x3318b4){logger['error'](_0x2228('0x16'),_0x526266,_0x3318b4);_0x5746d4(_0x3318b4);});});}exports[_0x2228('0x1e')]=function(_0x36cb94){var _0xc4cc02=this;return new Promise(function(_0x395803,_0x4b5de0){return db[_0x2228('0x1f')][_0x2228('0x20')]({'raw':_0x36cb94[_0x2228('0x21')]?_0x36cb94['options'][_0x2228('0x22')]===undefined?!![]:![]:!![],'where':_0x36cb94[_0x2228('0x21')]?_0x36cb94[_0x2228('0x21')]['where']||null:null,'attributes':_0x36cb94[_0x2228('0x21')]?_0x36cb94[_0x2228('0x21')]['attributes']||null:null,'limit':_0x36cb94[_0x2228('0x21')]?_0x36cb94['options'][_0x2228('0x23')]||null:null,'include':_0x36cb94[_0x2228('0x21')]?_0x36cb94[_0x2228('0x21')][_0x2228('0x24')]?_['map'](_0x36cb94[_0x2228('0x21')][_0x2228('0x24')],function(_0x7c569e){return{'model':db[_0x7c569e['model']],'as':_0x7c569e['as'],'attributes':_0x7c569e[_0x2228('0x25')],'include':_0x7c569e['include']?_[_0x2228('0x26')](_0x7c569e['include'],function(_0x5e6bf4){return{'model':db[_0x5e6bf4[_0x2228('0x27')]],'as':_0x5e6bf4['as'],'attributes':_0x5e6bf4['attributes'],'include':_0x5e6bf4[_0x2228('0x24')]?_[_0x2228('0x26')](_0x5e6bf4[_0x2228('0x24')],function(_0x4c43b5){return{'model':db[_0x4c43b5[_0x2228('0x27')]],'as':_0x4c43b5['as'],'attributes':_0x4c43b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2228('0x14')](function(_0x4fa6d2){logger[_0x2228('0x15')]('GetVoiceQueueReport',_0x36cb94);logger[_0x2228('0x17')](_0x2228('0x1e'),_0x36cb94,JSON[_0x2228('0x19')](_0x4fa6d2));_0x395803(_0x4fa6d2);})['catch'](function(_0x5f277a){logger[_0x2228('0x1a')](_0x2228('0x1e'),_0x5f277a[_0x2228('0x1b')],_0x36cb94);_0x4b5de0(_0xc4cc02[_0x2228('0x1a')](0x1f4,_0x5f277a[_0x2228('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x205f8f){var _0x256904=this;return new Promise(function(_0x481958,_0x227fa5){return db[_0x2228('0x1f')]['create'](_0x205f8f['body'],{'raw':_0x205f8f[_0x2228('0x21')]?_0x205f8f[_0x2228('0x21')][_0x2228('0x22')]===undefined?!![]:![]:!![]})[_0x2228('0x14')](function(_0x112433){logger[_0x2228('0x15')](_0x2228('0x28'),_0x205f8f);logger[_0x2228('0x17')](_0x2228('0x28'),_0x205f8f,JSON[_0x2228('0x19')](_0x112433));_0x481958(_0x112433);})[_0x2228('0x1d')](function(_0x117db2){logger[_0x2228('0x1a')](_0x2228('0x28'),_0x117db2[_0x2228('0x1b')],_0x205f8f);_0x227fa5(_0x256904[_0x2228('0x1a')](0x1f4,_0x117db2[_0x2228('0x1b')]));});});};exports[_0x2228('0x29')]=function(_0x25d085){var _0x4b1088=this;return new Promise(function(_0x2edaf5,_0x27d5a0){return db['VoiceQueueReport']['update'](_0x25d085[_0x2228('0x2a')],{'raw':_0x25d085['options']?_0x25d085[_0x2228('0x21')][_0x2228('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d085['options']?_0x25d085[_0x2228('0x21')][_0x2228('0x2b')]||null:null,'attributes':_0x25d085[_0x2228('0x21')]?_0x25d085[_0x2228('0x21')][_0x2228('0x25')]||null:null,'limit':_0x25d085[_0x2228('0x21')]?_0x25d085['options'][_0x2228('0x23')]||null:null})[_0x2228('0x14')](function(_0x8bc994){logger[_0x2228('0x15')]('UpdateVoiceQueueReport',_0x25d085);logger[_0x2228('0x17')](_0x2228('0x29'),_0x25d085,JSON['stringify'](_0x8bc994));_0x2edaf5(_0x8bc994);})['catch'](function(_0x1ecd9d){logger['error']('UpdateVoiceQueueReport',_0x1ecd9d[_0x2228('0x1b')],_0x25d085);_0x27d5a0(_0x4b1088[_0x2228('0x1a')](0x1f4,_0x1ecd9d[_0x2228('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3c3fdec..c0be371 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 _0x4491=['remove','emit','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x4dfce8,_0x2a9880){var _0x488a8c=function(_0xcf49e5){while(--_0xcf49e5){_0x4dfce8['push'](_0x4dfce8['shift']());}};_0x488a8c(++_0x2a9880);}(_0x4491,0x1bb));var _0x1449=function(_0x431872,_0x19c94a){_0x431872=_0x431872-0x0;var _0x587391=_0x4491[_0x431872];return _0x587391;};'use strict';var VoiceQueueReportEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){VoiceQueueReportEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);VoiceQueueReportEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file +var _0x03d2=['save','remove','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x03d2,0xe3));var _0x203d=function(_0x3f53fc,_0x2c4f7f){_0x3f53fc=_0x3f53fc-0x0;var _0x3b6f27=_0x03d2[_0x3f53fc];return _0x3b6f27;};'use strict';var VoiceQueueReportEvents=require(_0x203d('0x0'));var events=[_0x203d('0x1'),_0x203d('0x2'),'update'];function createListener(_0x5a9370,_0x34a8da){return function(_0xabb8ba){_0x34a8da[_0x203d('0x3')](_0x5a9370,_0xabb8ba);};}function removeListener(_0x4a11bb,_0x47a184){return function(){VoiceQueueReportEvents[_0x203d('0x4')](_0x4a11bb,_0x47a184);};}exports['register']=function(_0x4ec6fc){for(var _0x369b8b=0x0,_0x211ce1=events['length'];_0x369b8b<_0x211ce1;_0x369b8b++){var _0x4fce71=events[_0x369b8b];var _0x4da3c8=createListener(_0x203d('0x5')+_0x4fce71,_0x4ec6fc);VoiceQueueReportEvents['on'](_0x4fce71,_0x4da3c8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 11ae6fd..ebfa980 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 _0x0c6d=['index','get','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x5ceba,_0x57761f){var _0x4f377d=function(_0x19a2a6){while(--_0x19a2a6){_0x5ceba['push'](_0x5ceba['shift']());}};_0x4f377d(++_0x57761f);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x488358,_0x242e15){_0x488358=_0x488358-0x0;var _0x9d71ff=_0x0c6d[_0x488358];return _0x9d71ff;};'use strict';var multer=require('multer');var util=require(_0xd0c6('0x0'));var path=require(_0xd0c6('0x1'));var timeout=require(_0xd0c6('0x2'));var express=require(_0xd0c6('0x3'));var router=express[_0xd0c6('0x4')]();var fs_extra=require(_0xd0c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0c6('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x8')]);router[_0xd0c6('0x9')]('/:id',auth[_0xd0c6('0x7')](),controller['show']);router[_0xd0c6('0xa')]('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xb')]);router[_0xd0c6('0xc')](_0xd0c6('0xd'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xe')]);router[_0xd0c6('0xf')](_0xd0c6('0xd'),auth['isAuthenticated'](),controller[_0xd0c6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfc9f=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','delete'];(function(_0x168ce0,_0xf90ddf){var _0x4e0a30=function(_0x4cbb26){while(--_0x4cbb26){_0x168ce0['push'](_0x168ce0['shift']());}};_0x4e0a30(++_0xf90ddf);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xffc9('0x0'));var util=require('util');var path=require(_0xffc9('0x1'));var timeout=require(_0xffc9('0x2'));var express=require(_0xffc9('0x3'));var router=express[_0xffc9('0x4')]();var fs_extra=require(_0xffc9('0x5'));var auth=require(_0xffc9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffc9('0x7'));router['get']('/',auth[_0xffc9('0x8')](),controller[_0xffc9('0x9')]);router['get'](_0xffc9('0xa'),auth[_0xffc9('0x8')](),controller[_0xffc9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xffc9('0xa'),auth[_0xffc9('0x8')](),controller['update']);router[_0xffc9('0xc')](_0xffc9('0xa'),auth[_0xffc9('0x8')](),controller[_0xffc9('0xd')]);module[_0xffc9('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7f32b47..2475682 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 _0xa03d=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x5f013e,_0x138a7b){var _0x247274=function(_0x47f489){while(--_0x47f489){_0x5f013e['push'](_0x5f013e['shift']());}};_0x247274(++_0x138a7b);}(_0xa03d,0x1b4));var _0xda03=function(_0x3d818f,_0x38631a){_0x3d818f=_0x3d818f-0x0;var _0x23c3f1=_0xa03d[_0x3d818f];return _0x23c3f1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xda03('0x0'));module[_0xda03('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xda03('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xda03('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xda03('0x4')](_0xda03('0x5'))}}; \ No newline at end of file +var _0xc31d=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0xaec0e2,_0x5d0509){var _0x48df08=function(_0x4399c0){while(--_0x4399c0){_0xaec0e2['push'](_0xaec0e2['shift']());}};_0x48df08(++_0x5d0509);}(_0xc31d,0xfb));var _0xdc31=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xc31d[_0x3b4b1d];return _0x488c36;};'use strict';var Sequelize=require(_0xdc31('0x0'));var moment=require(_0xdc31('0x1'));module[_0xdc31('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xdc31('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xdc31('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xdc31('0x5')](_0xdc31('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9805f60..cb8ee57 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 _0x1bc8=['order','sort','where','pick','type','VIRTUAL','filter','merge','options','VoiceQueuesLog','include','findAll','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x52a622,_0x273e38){var _0x24e3b8=function(_0x1f4acf){while(--_0x1f4acf){_0x52a622['push'](_0x52a622['shift']());}};_0x24e3b8(++_0x273e38);}(_0x1bc8,0xfa));var _0x81bc=function(_0x2e9e7a,_0x5b939a){_0x2e9e7a=_0x2e9e7a-0x0;var _0x1608b0=_0x1bc8[_0x2e9e7a];return _0x1608b0;};'use strict';var emlformat=require(_0x81bc('0x0'));var rimraf=require(_0x81bc('0x1'));var zipdir=require(_0x81bc('0x2'));var jsonpatch=require(_0x81bc('0x3'));var rp=require(_0x81bc('0x4'));var moment=require(_0x81bc('0x5'));var BPromise=require(_0x81bc('0x6'));var Mustache=require(_0x81bc('0x7'));var util=require(_0x81bc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x81bc('0x9'));var ejs=require(_0x81bc('0xa'));var fs=require('fs');var fs_extra=require(_0x81bc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x81bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x81bc('0xd'));var toCsv=require(_0x81bc('0x9'));var querystring=require(_0x81bc('0xe'));var Papa=require(_0x81bc('0xf'));var Redis=require(_0x81bc('0x10'));var authService=require(_0x81bc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x81bc('0x12'));var hardwareService=require(_0x81bc('0x13'));var logger=require(_0x81bc('0x14'))(_0x81bc('0x15'));var utils=require(_0x81bc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x81bc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40b442,_0x3b6943){_0x3b6943=_0x3b6943||0xcc;return function(_0x2179b4){if(_0x2179b4){return _0x40b442[_0x81bc('0x18')](_0x3b6943);}return _0x40b442[_0x81bc('0x19')](_0x3b6943)[_0x81bc('0x1a')]();};}function respondWithResult(_0x30cc97,_0xdf557e){_0xdf557e=_0xdf557e||0xc8;return function(_0x3a7136){if(_0x3a7136){return _0x30cc97['status'](_0xdf557e)['json'](_0x3a7136);}};}function respondWithFilteredResult(_0x14e5d5,_0x34e7b6){return function(_0x107bfd){if(_0x107bfd){var _0x43efeb=typeof _0x34e7b6[_0x81bc('0x1b')]==='undefined'&&typeof _0x34e7b6[_0x81bc('0x1c')]===_0x81bc('0x1d');var _0x156e10=_0x107bfd[_0x81bc('0x1e')];var _0x23753c=_0x43efeb?0x0:_0x34e7b6[_0x81bc('0x1b')];var _0x582084=_0x43efeb?_0x107bfd[_0x81bc('0x1e')]:_0x34e7b6[_0x81bc('0x1b')]+_0x34e7b6['limit'];var _0x1fc050;if(_0x582084>=_0x156e10){_0x582084=_0x156e10;_0x1fc050=0xc8;}else{_0x1fc050=0xce;}_0x14e5d5[_0x81bc('0x19')](_0x1fc050);return _0x14e5d5[_0x81bc('0x1f')](_0x81bc('0x20'),_0x23753c+'-'+_0x582084+'/'+_0x156e10)[_0x81bc('0x21')](_0x107bfd);}return null;};}function patchUpdates(_0x3b522d){return function(_0x5d9a8){try{jsonpatch[_0x81bc('0x22')](_0x5d9a8,_0x3b522d,!![]);}catch(_0x57f4fb){return BPromise[_0x81bc('0x23')](_0x57f4fb);}return _0x5d9a8[_0x81bc('0x24')]();};}function saveUpdates(_0x4b92c8,_0x47329a){return function(_0x3ae1bb){if(_0x3ae1bb){return _0x3ae1bb[_0x81bc('0x25')](_0x4b92c8)[_0x81bc('0x26')](function(_0x558601){return _0x558601;});}return null;};}function removeEntity(_0x967fc9,_0x5b5ca2){return function(_0x77c062){if(_0x77c062){return _0x77c062[_0x81bc('0x27')]()['then'](function(){_0x967fc9[_0x81bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573b12,_0x14c57e){return function(_0x183003){if(!_0x183003){_0x573b12[_0x81bc('0x18')](0x194);}return _0x183003;};}function handleError(_0x3fc61e,_0xec6dc7){_0xec6dc7=_0xec6dc7||0x1f4;return function(_0x185bd9){logger['error'](_0x185bd9[_0x81bc('0x28')]);if(_0x185bd9[_0x81bc('0x29')]){delete _0x185bd9[_0x81bc('0x29')];}_0x3fc61e[_0x81bc('0x19')](_0xec6dc7)[_0x81bc('0x2a')](_0x185bd9);};}exports[_0x81bc('0x2b')]=function(_0x8c2881,_0x55fcb8){var _0x5df66e={},_0x2e4070={},_0x1f9b7a={'count':0x0,'rows':[]};var _0x23eefe=_[_0x81bc('0x2c')](db['VoiceQueuesLog'][_0x81bc('0x2d')],function(_0xc9ce10){return{'name':_0xc9ce10[_0x81bc('0x2e')],'type':_0xc9ce10['type'][_0x81bc('0x2f')]};});_0x2e4070[_0x81bc('0x30')]=_[_0x81bc('0x2c')](_0x23eefe,'name');_0x2e4070[_0x81bc('0x31')]=_[_0x81bc('0x32')](_0x8c2881['query']);_0x2e4070[_0x81bc('0x33')]=_[_0x81bc('0x34')](_0x2e4070[_0x81bc('0x30')],_0x2e4070[_0x81bc('0x31')]);_0x5df66e['attributes']=_[_0x81bc('0x34')](_0x2e4070[_0x81bc('0x30')],qs['fields'](_0x8c2881[_0x81bc('0x31')][_0x81bc('0x35')]));_0x5df66e[_0x81bc('0x36')]=_0x5df66e[_0x81bc('0x36')][_0x81bc('0x37')]?_0x5df66e[_0x81bc('0x36')]:_0x2e4070[_0x81bc('0x30')];if(!_0x8c2881['query'][_0x81bc('0x38')](_0x81bc('0x39'))){_0x5df66e[_0x81bc('0x1c')]=qs[_0x81bc('0x1c')](_0x8c2881[_0x81bc('0x31')][_0x81bc('0x1c')]);_0x5df66e['offset']=qs[_0x81bc('0x1b')](_0x8c2881['query'][_0x81bc('0x1b')]);}_0x5df66e[_0x81bc('0x3a')]=qs['sort'](_0x8c2881['query'][_0x81bc('0x3b')]);_0x5df66e[_0x81bc('0x3c')]=qs[_0x81bc('0x33')](_[_0x81bc('0x3d')](_0x8c2881[_0x81bc('0x31')],_0x2e4070['filters']),_0x23eefe);if(_0x8c2881[_0x81bc('0x31')]['filter']){_0x5df66e['where']=_['merge'](_0x5df66e[_0x81bc('0x3c')],{'$or':_[_0x81bc('0x2c')](_0x23eefe,function(_0xbe9be9){if(_0xbe9be9[_0x81bc('0x3e')]!==_0x81bc('0x3f')){var _0x5d2875={};_0x5d2875[_0xbe9be9[_0x81bc('0x29')]]={'$like':'%'+_0x8c2881['query'][_0x81bc('0x40')]+'%'};return _0x5d2875;}})});}_0x5df66e=_[_0x81bc('0x41')]({},_0x5df66e,_0x8c2881[_0x81bc('0x42')]);var _0x77ee1d={'where':_0x5df66e[_0x81bc('0x3c')]};return db[_0x81bc('0x43')][_0x81bc('0x1e')](_0x77ee1d)[_0x81bc('0x26')](function(_0x58d6c1){_0x1f9b7a[_0x81bc('0x1e')]=_0x58d6c1;if(_0x8c2881['query']['includeAll']){_0x5df66e[_0x81bc('0x44')]=[{'all':!![]}];}return db[_0x81bc('0x43')][_0x81bc('0x45')](_0x5df66e);})['then'](function(_0x32b360){_0x1f9b7a['rows']=_0x32b360;return _0x1f9b7a;})[_0x81bc('0x26')](respondWithFilteredResult(_0x55fcb8,_0x5df66e))[_0x81bc('0x46')](handleError(_0x55fcb8,null));};exports[_0x81bc('0x47')]=function(_0x4fd0bf,_0xa3e588){var _0x23e432={'raw':!![],'where':{'id':_0x4fd0bf[_0x81bc('0x48')]['id']}},_0x3470e5={};_0x3470e5[_0x81bc('0x30')]=_[_0x81bc('0x32')](db['VoiceQueuesLog'][_0x81bc('0x2d')]);_0x3470e5[_0x81bc('0x31')]=_[_0x81bc('0x32')](_0x4fd0bf[_0x81bc('0x31')]);_0x3470e5[_0x81bc('0x33')]=_[_0x81bc('0x34')](_0x3470e5[_0x81bc('0x30')],_0x3470e5[_0x81bc('0x31')]);_0x23e432[_0x81bc('0x36')]=_['intersection'](_0x3470e5[_0x81bc('0x30')],qs[_0x81bc('0x35')](_0x4fd0bf[_0x81bc('0x31')][_0x81bc('0x35')]));_0x23e432['attributes']=_0x23e432['attributes']['length']?_0x23e432[_0x81bc('0x36')]:_0x3470e5[_0x81bc('0x30')];if(_0x4fd0bf[_0x81bc('0x31')][_0x81bc('0x49')]){_0x23e432[_0x81bc('0x44')]=[{'all':!![]}];}_0x23e432=_[_0x81bc('0x41')]({},_0x23e432,_0x4fd0bf[_0x81bc('0x42')]);return db[_0x81bc('0x43')]['find'](_0x23e432)[_0x81bc('0x26')](handleEntityNotFound(_0xa3e588,null))[_0x81bc('0x26')](respondWithResult(_0xa3e588,null))[_0x81bc('0x46')](handleError(_0xa3e588,null));};exports[_0x81bc('0x4a')]=function(_0x250783,_0x4776f9){return db['VoiceQueuesLog'][_0x81bc('0x4a')](_0x250783[_0x81bc('0x4b')],{})[_0x81bc('0x26')](respondWithResult(_0x4776f9,0xc9))[_0x81bc('0x46')](handleError(_0x4776f9,null));};exports[_0x81bc('0x25')]=function(_0x556099,_0xa5aa99){if(_0x556099[_0x81bc('0x4b')]['id']){delete _0x556099[_0x81bc('0x4b')]['id'];}return db['VoiceQueuesLog'][_0x81bc('0x4c')]({'where':{'id':_0x556099[_0x81bc('0x48')]['id']}})['then'](handleEntityNotFound(_0xa5aa99,null))['then'](saveUpdates(_0x556099[_0x81bc('0x4b')],null))[_0x81bc('0x26')](respondWithResult(_0xa5aa99,null))[_0x81bc('0x46')](handleError(_0xa5aa99,null));};exports[_0x81bc('0x27')]=function(_0x505448,_0xc997f7){return db[_0x81bc('0x43')][_0x81bc('0x4c')]({'where':{'id':_0x505448[_0x81bc('0x48')]['id']}})[_0x81bc('0x26')](handleEntityNotFound(_0xc997f7,null))['then'](removeEntity(_0xc997f7,null))[_0x81bc('0x46')](handleError(_0xc997f7,null));}; \ No newline at end of file +var _0x6892=['squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6892,0xaf));var _0x2689=function(_0x540f69,_0x184368){_0x540f69=_0x540f69-0x0;var _0x104c01=_0x6892[_0x540f69];return _0x104c01;};'use strict';var emlformat=require(_0x2689('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2689('0x1'));var jsonpatch=require(_0x2689('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2689('0x3'));var Mustache=require(_0x2689('0x4'));var util=require(_0x2689('0x5'));var path=require('path');var sox=require(_0x2689('0x6'));var csv=require(_0x2689('0x7'));var ejs=require(_0x2689('0x8'));var fs=require('fs');var fs_extra=require(_0x2689('0x9'));var _=require(_0x2689('0xa'));var squel=require(_0x2689('0xb'));var crypto=require('crypto');var jsforce=require(_0x2689('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2689('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2689('0xe'));var hardwareService=require(_0x2689('0xf'));var logger=require('../../config/logger')(_0x2689('0x10'));var utils=require(_0x2689('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2689('0x12'))['db'];function respondWithStatusCode(_0x57527c,_0x294de3){_0x294de3=_0x294de3||0xcc;return function(_0x283c57){if(_0x283c57){return _0x57527c[_0x2689('0x13')](_0x294de3);}return _0x57527c[_0x2689('0x14')](_0x294de3)['end']();};}function respondWithResult(_0x17b479,_0x158a89){_0x158a89=_0x158a89||0xc8;return function(_0x2404b5){if(_0x2404b5){return _0x17b479[_0x2689('0x14')](_0x158a89)['json'](_0x2404b5);}};}function respondWithFilteredResult(_0x33c771,_0x17158a){return function(_0x2de763){if(_0x2de763){var _0x40039e=typeof _0x17158a[_0x2689('0x15')]===_0x2689('0x16')&&typeof _0x17158a[_0x2689('0x17')]===_0x2689('0x16');var _0x449fcd=_0x2de763[_0x2689('0x18')];var _0x1fab37=_0x40039e?0x0:_0x17158a['offset'];var _0x262fc2=_0x40039e?_0x2de763['count']:_0x17158a[_0x2689('0x15')]+_0x17158a[_0x2689('0x17')];var _0x58b03e;if(_0x262fc2>=_0x449fcd){_0x262fc2=_0x449fcd;_0x58b03e=0xc8;}else{_0x58b03e=0xce;}_0x33c771['status'](_0x58b03e);return _0x33c771[_0x2689('0x19')](_0x2689('0x1a'),_0x1fab37+'-'+_0x262fc2+'/'+_0x449fcd)['json'](_0x2de763);}return null;};}function patchUpdates(_0x2456c8){return function(_0x1e5cba){try{jsonpatch[_0x2689('0x1b')](_0x1e5cba,_0x2456c8,!![]);}catch(_0x39a710){return BPromise['reject'](_0x39a710);}return _0x1e5cba['save']();};}function saveUpdates(_0x2677d4,_0x301394){return function(_0x11adb0){if(_0x11adb0){return _0x11adb0[_0x2689('0x1c')](_0x2677d4)[_0x2689('0x1d')](function(_0x4f8c07){return _0x4f8c07;});}return null;};}function removeEntity(_0x35c3ac,_0x511427){return function(_0x25b7ef){if(_0x25b7ef){return _0x25b7ef['destroy']()[_0x2689('0x1d')](function(){_0x35c3ac[_0x2689('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5417a7,_0x2e23fc){return function(_0x1bd217){if(!_0x1bd217){_0x5417a7[_0x2689('0x13')](0x194);}return _0x1bd217;};}function handleError(_0x4d6d6f,_0x1296b1){_0x1296b1=_0x1296b1||0x1f4;return function(_0x43e626){logger['error'](_0x43e626[_0x2689('0x1e')]);if(_0x43e626['name']){delete _0x43e626[_0x2689('0x1f')];}_0x4d6d6f[_0x2689('0x14')](_0x1296b1)['send'](_0x43e626);};}exports[_0x2689('0x20')]=function(_0x12f9ed,_0x17a6e8){var _0x195cce={},_0xae2537={},_0x587ed7={'count':0x0,'rows':[]};var _0x34f529=_[_0x2689('0x21')](db[_0x2689('0x22')][_0x2689('0x23')],function(_0x5ae49d){return{'name':_0x5ae49d['fieldName'],'type':_0x5ae49d[_0x2689('0x24')][_0x2689('0x25')]};});_0xae2537[_0x2689('0x26')]=_[_0x2689('0x21')](_0x34f529,_0x2689('0x1f'));_0xae2537[_0x2689('0x27')]=_[_0x2689('0x28')](_0x12f9ed['query']);_0xae2537[_0x2689('0x29')]=_[_0x2689('0x2a')](_0xae2537[_0x2689('0x26')],_0xae2537[_0x2689('0x27')]);_0x195cce['attributes']=_['intersection'](_0xae2537[_0x2689('0x26')],qs[_0x2689('0x2b')](_0x12f9ed[_0x2689('0x27')][_0x2689('0x2b')]));_0x195cce['attributes']=_0x195cce[_0x2689('0x2c')][_0x2689('0x2d')]?_0x195cce['attributes']:_0xae2537[_0x2689('0x26')];if(!_0x12f9ed[_0x2689('0x27')]['hasOwnProperty'](_0x2689('0x2e'))){_0x195cce[_0x2689('0x17')]=qs['limit'](_0x12f9ed[_0x2689('0x27')]['limit']);_0x195cce['offset']=qs[_0x2689('0x15')](_0x12f9ed['query'][_0x2689('0x15')]);}_0x195cce['order']=qs[_0x2689('0x2f')](_0x12f9ed[_0x2689('0x27')][_0x2689('0x2f')]);_0x195cce[_0x2689('0x30')]=qs[_0x2689('0x29')](_['pick'](_0x12f9ed['query'],_0xae2537[_0x2689('0x29')]),_0x34f529);if(_0x12f9ed[_0x2689('0x27')]['filter']){_0x195cce[_0x2689('0x30')]=_[_0x2689('0x31')](_0x195cce[_0x2689('0x30')],{'$or':_[_0x2689('0x21')](_0x34f529,function(_0x4bcb53){if(_0x4bcb53[_0x2689('0x24')]!==_0x2689('0x32')){var _0x155860={};_0x155860[_0x4bcb53[_0x2689('0x1f')]]={'$like':'%'+_0x12f9ed[_0x2689('0x27')][_0x2689('0x33')]+'%'};return _0x155860;}})});}_0x195cce=_[_0x2689('0x31')]({},_0x195cce,_0x12f9ed[_0x2689('0x34')]);var _0x7d041={'where':_0x195cce[_0x2689('0x30')]};return db[_0x2689('0x22')]['count'](_0x7d041)['then'](function(_0x4df47d){_0x587ed7[_0x2689('0x18')]=_0x4df47d;if(_0x12f9ed['query'][_0x2689('0x35')]){_0x195cce[_0x2689('0x36')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x2689('0x37')](_0x195cce);})[_0x2689('0x1d')](function(_0x1c024c){_0x587ed7['rows']=_0x1c024c;return _0x587ed7;})['then'](respondWithFilteredResult(_0x17a6e8,_0x195cce))[_0x2689('0x38')](handleError(_0x17a6e8,null));};exports[_0x2689('0x39')]=function(_0x458164,_0x3dc564){var _0x180e72={'raw':!![],'where':{'id':_0x458164[_0x2689('0x3a')]['id']}},_0x3dc962={};_0x3dc962['model']=_[_0x2689('0x28')](db[_0x2689('0x22')]['rawAttributes']);_0x3dc962[_0x2689('0x27')]=_[_0x2689('0x28')](_0x458164[_0x2689('0x27')]);_0x3dc962['filters']=_[_0x2689('0x2a')](_0x3dc962[_0x2689('0x26')],_0x3dc962[_0x2689('0x27')]);_0x180e72['attributes']=_[_0x2689('0x2a')](_0x3dc962[_0x2689('0x26')],qs[_0x2689('0x2b')](_0x458164[_0x2689('0x27')][_0x2689('0x2b')]));_0x180e72[_0x2689('0x2c')]=_0x180e72[_0x2689('0x2c')][_0x2689('0x2d')]?_0x180e72[_0x2689('0x2c')]:_0x3dc962['model'];if(_0x458164[_0x2689('0x27')][_0x2689('0x35')]){_0x180e72['include']=[{'all':!![]}];}_0x180e72=_[_0x2689('0x31')]({},_0x180e72,_0x458164[_0x2689('0x34')]);return db['VoiceQueuesLog'][_0x2689('0x3b')](_0x180e72)['then'](handleEntityNotFound(_0x3dc564,null))[_0x2689('0x1d')](respondWithResult(_0x3dc564,null))[_0x2689('0x38')](handleError(_0x3dc564,null));};exports[_0x2689('0x3c')]=function(_0x481227,_0x2dd51d){return db[_0x2689('0x22')][_0x2689('0x3c')](_0x481227[_0x2689('0x3d')],{})[_0x2689('0x1d')](respondWithResult(_0x2dd51d,0xc9))['catch'](handleError(_0x2dd51d,null));};exports[_0x2689('0x1c')]=function(_0x2cbd14,_0x16e766){if(_0x2cbd14[_0x2689('0x3d')]['id']){delete _0x2cbd14[_0x2689('0x3d')]['id'];}return db[_0x2689('0x22')][_0x2689('0x3b')]({'where':{'id':_0x2cbd14[_0x2689('0x3a')]['id']}})['then'](handleEntityNotFound(_0x16e766,null))['then'](saveUpdates(_0x2cbd14[_0x2689('0x3d')],null))[_0x2689('0x1d')](respondWithResult(_0x16e766,null))[_0x2689('0x38')](handleError(_0x16e766,null));};exports['destroy']=function(_0x3ef964,_0x47d3d8){return db[_0x2689('0x22')]['find']({'where':{'id':_0x3ef964[_0x2689('0x3a')]['id']}})[_0x2689('0x1d')](handleEntityNotFound(_0x47d3d8,null))[_0x2689('0x1d')](removeEntity(_0x47d3d8,null))['catch'](handleError(_0x47d3d8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3ee1b06..b5136fe 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 _0xd749=['lodash','../../config/logger','api','bluebird','path','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd749,0x11e));var _0x9d74=function(_0x57cc3e,_0x2c5238){_0x57cc3e=_0x57cc3e-0x0;var _0x1b8ad1=_0xd749[_0x57cc3e];return _0x1b8ad1;};'use strict';var _=require(_0x9d74('0x0'));var util=require('util');var logger=require(_0x9d74('0x1'))(_0x9d74('0x2'));var moment=require('moment');var BPromise=require(_0x9d74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d74('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x9d74('0x5')]=function(_0x4611fb,_0x20c5a9){return _0x4611fb[_0x9d74('0x6')](_0x9d74('0x7'),attributes,{'tableName':_0x9d74('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x9d74('0x9'),_0x9d74('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7f6d=['dtm','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x7f6d,0x100));var _0xd7f6=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7f6d[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xd7f6('0x0'));var util=require(_0xd7f6('0x1'));var logger=require('../../config/logger')(_0xd7f6('0x2'));var moment=require(_0xd7f6('0x3'));var BPromise=require(_0xd7f6('0x4'));var rp=require(_0xd7f6('0x5'));var fs=require('fs');var path=require(_0xd7f6('0x6'));var rimraf=require(_0xd7f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd7f6('0x8'));module[_0xd7f6('0x9')]=function(_0x1c1bdc,_0x7f118){return _0x1c1bdc[_0xd7f6('0xa')](_0xd7f6('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd7f6('0xc'),'fields':[_0xd7f6('0xd'),_0xd7f6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fce1a25..4683c88 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 _0x0c08=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x0c08,0x1e6));var _0x80c0=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x0c08[_0x32056c];return _0x317313;};'use strict';var _=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var moment=require('moment');var BPromise=require(_0x80c0('0x2'));var rs=require(_0x80c0('0x3'));var fs=require('fs');var Redis=require(_0x80c0('0x4'));var db=require(_0x80c0('0x5'))['db'];var utils=require(_0x80c0('0x6'));var logger=require('../../config/logger')(_0x80c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x80c0('0x8'));var client=jayson[_0x80c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289745,_0x39c069,_0x327af0){return new BPromise(function(_0x333a54,_0x7bed60){return client['request'](_0x289745,_0x327af0)['then'](function(_0xb7bb5d){logger[_0x80c0('0xa')](_0x80c0('0xb'),_0x39c069,_0x80c0('0xc'));logger[_0x80c0('0xd')](_0x80c0('0xe'),_0x39c069,'request\x20sent',JSON[_0x80c0('0xf')](_0xb7bb5d));if(_0xb7bb5d[_0x80c0('0x10')]){if(_0xb7bb5d['error']['code']===0x1f4){logger[_0x80c0('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x39c069,_0xb7bb5d['error']['message']);return _0x7bed60(_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);}logger[_0x80c0('0x10')](_0x80c0('0xb'),_0x39c069,_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);return _0x333a54(_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);}else{logger[_0x80c0('0xa')](_0x80c0('0xb'),_0x39c069,_0x80c0('0xc'));_0x333a54(_0xb7bb5d[_0x80c0('0x12')]['message']);}})[_0x80c0('0x13')](function(_0x14d835){logger[_0x80c0('0x10')](_0x80c0('0xb'),_0x39c069,_0x14d835);_0x7bed60(_0x14d835);});});} \ No newline at end of file +var _0xecb2=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xecb2,0x112));var _0x2ecb=function(_0x6c6897,_0x253b49){_0x6c6897=_0x6c6897-0x0;var _0x254a0f=_0xecb2[_0x6c6897];return _0x254a0f;};'use strict';var _=require(_0x2ecb('0x0'));var util=require(_0x2ecb('0x1'));var moment=require(_0x2ecb('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ecb('0x3'));var fs=require('fs');var Redis=require(_0x2ecb('0x4'));var db=require(_0x2ecb('0x5'))['db'];var utils=require(_0x2ecb('0x6'));var logger=require(_0x2ecb('0x7'))(_0x2ecb('0x8'));var config=require(_0x2ecb('0x9'));var jayson=require(_0x2ecb('0xa'));var client=jayson[_0x2ecb('0xb')][_0x2ecb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a581e,_0x2bf2c2,_0x4fd068){return new BPromise(function(_0x2bbcb3,_0x324bb){return client[_0x2ecb('0xd')](_0x4a581e,_0x4fd068)['then'](function(_0x395910){logger[_0x2ecb('0xe')](_0x2ecb('0xf'),_0x2bf2c2,_0x2ecb('0x10'));logger[_0x2ecb('0x11')](_0x2ecb('0x12'),_0x2bf2c2,'request\x20sent',JSON[_0x2ecb('0x13')](_0x395910));if(_0x395910['error']){if(_0x395910[_0x2ecb('0x14')]['code']===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2bf2c2,_0x395910['error']['message']);return _0x324bb(_0x395910[_0x2ecb('0x14')][_0x2ecb('0x15')]);}logger['error'](_0x2ecb('0xf'),_0x2bf2c2,_0x395910[_0x2ecb('0x14')]['message']);return _0x2bbcb3(_0x395910['error'][_0x2ecb('0x15')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x2bf2c2,_0x2ecb('0x10'));_0x2bbcb3(_0x395910['result'][_0x2ecb('0x15')]);}})[_0x2ecb('0x16')](function(_0x2d6d1c){logger['error'](_0x2ecb('0xf'),_0x2bf2c2,_0x2d6d1c);_0x324bb(_0x2d6d1c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index bbcca7d..fb7e6e9 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 _0xe962=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','put','update','delete','/:id','destroy','exports'];(function(_0x3926ba,_0x237901){var _0x18756e=function(_0x5ca849){while(--_0x5ca849){_0x3926ba['push'](_0x3926ba['shift']());}};_0x18756e(++_0x237901);}(_0xe962,0x19e));var _0x2e96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe962[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2e96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e96('0x1'));var express=require(_0x2e96('0x2'));var router=express['Router']();var fs_extra=require(_0x2e96('0x3'));var auth=require(_0x2e96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e96('0x5'));var controller=require('./voiceRecording.controller');router[_0x2e96('0x6')]('/',auth[_0x2e96('0x7')](),controller[_0x2e96('0x8')]);router[_0x2e96('0x6')](_0x2e96('0x9'),auth[_0x2e96('0x7')](),controller['describe']);router[_0x2e96('0x6')]('/:id',auth[_0x2e96('0x7')](),controller[_0x2e96('0xa')]);router[_0x2e96('0x6')](_0x2e96('0xb'),auth['isAuthenticated'](),controller['download']);router['get'](_0x2e96('0xc'),controller[_0x2e96('0xd')]);router[_0x2e96('0x6')](_0x2e96('0xe'),auth[_0x2e96('0x7')](),controller[_0x2e96('0xf')]);router[_0x2e96('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e96('0x10')](_0x2e96('0xe'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x2e96('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2e96('0x12')]);router[_0x2e96('0x13')](_0x2e96('0x14'),auth[_0x2e96('0x7')](),controller[_0x2e96('0x15')]);module[_0x2e96('0x16')]=router; \ No newline at end of file +var _0xf62c=['downloadTranscribe','post','create','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/download','download','downloads'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf62c,0x1a4));var _0xcf62=function(_0x1764fd,_0x256895){_0x1764fd=_0x1764fd-0x0;var _0x13189e=_0xf62c[_0x1764fd];return _0x13189e;};'use strict';var multer=require(_0xcf62('0x0'));var util=require(_0xcf62('0x1'));var path=require('path');var timeout=require(_0xcf62('0x2'));var express=require('express');var router=express[_0xcf62('0x3')]();var fs_extra=require(_0xcf62('0x4'));var auth=require(_0xcf62('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcf62('0x6'));var controller=require(_0xcf62('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf62('0x8')]);router[_0xcf62('0x9')](_0xcf62('0xa'),auth[_0xcf62('0xb')](),controller['describe']);router[_0xcf62('0x9')](_0xcf62('0xc'),auth['isAuthenticated'](),controller[_0xcf62('0xd')]);router['get'](_0xcf62('0xe'),auth[_0xcf62('0xb')](),controller[_0xcf62('0xf')]);router[_0xcf62('0x9')]('/:id/downloads',controller[_0xcf62('0x10')]);router[_0xcf62('0x9')]('/:id/transcribe',auth[_0xcf62('0xb')](),controller[_0xcf62('0x11')]);router[_0xcf62('0x12')]('/',auth['isAuthenticated'](),controller[_0xcf62('0x13')]);router[_0xcf62('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router['put'](_0xcf62('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcf62('0x14')](_0xcf62('0xc'),auth['isAuthenticated'](),controller[_0xcf62('0x15')]);module[_0xcf62('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c79beef..69690a0 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 9eca62f..02f5b38 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 _0x1f31=['[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','uuid/v4','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','then','error','stack','name','send','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','download','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','sequelize','MD5','col','token','$and','push','%s.cypher','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob'];(function(_0x100dbd,_0x30ee1d){var _0x48cf23=function(_0x456884){while(--_0x456884){_0x100dbd['push'](_0x100dbd['shift']());}};_0x48cf23(++_0x30ee1d);}(_0x1f31,0x14f));var _0x11f3=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x1f31[_0x2d982d];return _0x4f36b0;};'use strict';var emlformat=require(_0x11f3('0x0'));var rimraf=require(_0x11f3('0x1'));var zipdir=require(_0x11f3('0x2'));var jsonpatch=require(_0x11f3('0x3'));var rp=require(_0x11f3('0x4'));var moment=require('moment');var BPromise=require(_0x11f3('0x5'));var Mustache=require('mustache');var util=require(_0x11f3('0x6'));var path=require(_0x11f3('0x7'));var sox=require(_0x11f3('0x8'));var csv=require(_0x11f3('0x9'));var ejs=require(_0x11f3('0xa'));var fs=require('fs');var fs_extra=require(_0x11f3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x11f3('0xc'));var jsforce=require(_0x11f3('0xd'));var deskjs=require(_0x11f3('0xe'));var toCsv=require(_0x11f3('0x9'));var querystring=require(_0x11f3('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x11f3('0x10'));var Redis=require(_0x11f3('0x11'));var authService=require(_0x11f3('0x12'));var qs=require(_0x11f3('0x13'));var as=require(_0x11f3('0x14'));var hardwareService=require(_0x11f3('0x15'));var logger=require('../../config/logger')(_0x11f3('0x16'));var utils=require('../../config/utils');var config=require(_0x11f3('0x17'));var licenseUtil=require(_0x11f3('0x18'));var db=require(_0x11f3('0x19'))['db'];function respondWithStatusCode(_0x4fc760,_0x163be0){_0x163be0=_0x163be0||0xcc;return function(_0x292582){if(_0x292582){return _0x4fc760[_0x11f3('0x1a')](_0x163be0);}return _0x4fc760['status'](_0x163be0)[_0x11f3('0x1b')]();};}function respondWithResult(_0x25485c,_0x3996b0){_0x3996b0=_0x3996b0||0xc8;return function(_0x178d22){if(_0x178d22){return _0x25485c[_0x11f3('0x1c')](_0x3996b0)[_0x11f3('0x1d')](_0x178d22);}};}function respondWithFilteredResult(_0x565d8d,_0x46fed4){return function(_0x2aee7f){if(_0x2aee7f){var _0x196a71=typeof _0x46fed4[_0x11f3('0x1e')]===_0x11f3('0x1f')&&typeof _0x46fed4[_0x11f3('0x20')]===_0x11f3('0x1f');var _0x14c963=_0x2aee7f[_0x11f3('0x21')];var _0x4fd5ca=_0x196a71?0x0:_0x46fed4[_0x11f3('0x1e')];var _0x505035=_0x196a71?_0x2aee7f[_0x11f3('0x21')]:_0x46fed4[_0x11f3('0x1e')]+_0x46fed4[_0x11f3('0x20')];var _0x5aeb17;if(_0x505035>=_0x14c963){_0x505035=_0x14c963;_0x5aeb17=0xc8;}else{_0x5aeb17=0xce;}_0x565d8d[_0x11f3('0x1c')](_0x5aeb17);return _0x565d8d[_0x11f3('0x22')](_0x11f3('0x23'),_0x4fd5ca+'-'+_0x505035+'/'+_0x14c963)[_0x11f3('0x1d')](_0x2aee7f);}return null;};}function patchUpdates(_0x42b035){return function(_0xf4dfc6){try{jsonpatch[_0x11f3('0x24')](_0xf4dfc6,_0x42b035,!![]);}catch(_0x3a8537){return BPromise[_0x11f3('0x25')](_0x3a8537);}return _0xf4dfc6[_0x11f3('0x26')]();};}function saveUpdates(_0x38fae2,_0x27b71a){return function(_0x45995d){if(_0x45995d){return _0x45995d[_0x11f3('0x27')](_0x38fae2)[_0x11f3('0x28')](function(_0x2a96e0){return _0x2a96e0;});}return null;};}function removeEntity(_0x174577,_0x3d3c4d){return function(_0xd227f9){if(_0xd227f9){return _0xd227f9['destroy']()[_0x11f3('0x28')](function(){_0x174577[_0x11f3('0x1c')](0xcc)[_0x11f3('0x1b')]();});}};}function handleEntityNotFound(_0x50fd4a,_0x263d79){return function(_0xe5ef58){if(!_0xe5ef58){_0x50fd4a[_0x11f3('0x1a')](0x194);}return _0xe5ef58;};}function handleError(_0x58c0e7,_0x2ebb19){_0x2ebb19=_0x2ebb19||0x1f4;return function(_0x1decaf){logger[_0x11f3('0x29')](_0x1decaf[_0x11f3('0x2a')]);if(_0x1decaf['name']){delete _0x1decaf[_0x11f3('0x2b')];}_0x58c0e7[_0x11f3('0x1c')](_0x2ebb19)[_0x11f3('0x2c')](_0x1decaf);};}exports['index']=function(_0x3b1134,_0x560285){var _0x17f253={},_0x3bb2ee={},_0x1b2d69={'count':0x0,'rows':[]};var _0x4053f0=_['map'](db[_0x11f3('0x2d')][_0x11f3('0x2e')],function(_0x36e454){return{'name':_0x36e454[_0x11f3('0x2f')],'type':_0x36e454['type'][_0x11f3('0x30')]};});_0x3bb2ee[_0x11f3('0x31')]=_[_0x11f3('0x32')](_[_0x11f3('0x33')](_0x4053f0,_0x11f3('0x2b')),[_0x11f3('0x34')]);_0x3bb2ee[_0x11f3('0x35')]=_[_0x11f3('0x36')](_0x3b1134[_0x11f3('0x35')]);_0x3bb2ee[_0x11f3('0x37')]=_[_0x11f3('0x38')](_0x3bb2ee['model'],_0x3bb2ee[_0x11f3('0x35')]);_0x17f253[_0x11f3('0x39')]=_['intersection'](_0x3bb2ee['model'],qs['fields'](_0x3b1134[_0x11f3('0x35')]['fields']));_0x17f253[_0x11f3('0x39')]=_0x17f253['attributes'][_0x11f3('0x3a')]?_0x17f253[_0x11f3('0x39')]:_0x3bb2ee['model'];if(!_0x3b1134[_0x11f3('0x35')][_0x11f3('0x3b')](_0x11f3('0x3c'))){_0x17f253['limit']=qs[_0x11f3('0x20')](_0x3b1134[_0x11f3('0x35')][_0x11f3('0x20')]);_0x17f253[_0x11f3('0x1e')]=qs[_0x11f3('0x1e')](_0x3b1134[_0x11f3('0x35')][_0x11f3('0x1e')]);}_0x17f253[_0x11f3('0x3d')]=qs[_0x11f3('0x3e')](_0x3b1134[_0x11f3('0x35')]['sort']);_0x17f253[_0x11f3('0x3f')]=qs['filters'](_[_0x11f3('0x40')](_0x3b1134[_0x11f3('0x35')],_0x3bb2ee[_0x11f3('0x37')]),_0x4053f0);if(_0x3b1134[_0x11f3('0x35')]['filter']){_0x17f253['where']=_[_0x11f3('0x41')](_0x17f253[_0x11f3('0x3f')],{'$or':_['map'](_0x4053f0,function(_0xc58d6a){if(_0xc58d6a[_0x11f3('0x42')]!=='VIRTUAL'){var _0x30c43f={};_0x30c43f[_0xc58d6a[_0x11f3('0x2b')]]={'$like':'%'+_0x3b1134[_0x11f3('0x35')][_0x11f3('0x43')]+'%'};return _0x30c43f;}})});}_0x17f253=_[_0x11f3('0x41')]({},_0x17f253,_0x3b1134[_0x11f3('0x44')]);var _0x252ee4={'where':_0x17f253[_0x11f3('0x3f')]};return db['VoiceRecording'][_0x11f3('0x21')](_0x252ee4)[_0x11f3('0x28')](function(_0x4d060a){_0x1b2d69['count']=_0x4d060a;if(_0x3b1134['query'][_0x11f3('0x45')]){_0x17f253[_0x11f3('0x46')]=[{'all':!![]}];}return db[_0x11f3('0x2d')][_0x11f3('0x47')](_0x17f253);})[_0x11f3('0x28')](function(_0x2034b3){_0x1b2d69[_0x11f3('0x48')]=_0x2034b3;return _0x1b2d69;})[_0x11f3('0x28')](respondWithFilteredResult(_0x560285,_0x17f253))['catch'](handleError(_0x560285,null));};exports[_0x11f3('0x49')]=function(_0x27e3c6,_0x3cbc65){var _0x6d7824={'raw':![],'where':{'id':_0x27e3c6[_0x11f3('0x4a')]['id']}},_0xa45909={};_0xa45909['model']=_[_0x11f3('0x36')](db[_0x11f3('0x2d')][_0x11f3('0x2e')]);_0xa45909[_0x11f3('0x35')]=_['keys'](_0x27e3c6['query']);_0xa45909[_0x11f3('0x37')]=_[_0x11f3('0x38')](_0xa45909['model'],_0xa45909[_0x11f3('0x35')]);_0x6d7824[_0x11f3('0x39')]=_[_0x11f3('0x38')](_0xa45909[_0x11f3('0x31')],qs['fields'](_0x27e3c6['query']['fields']));_0x6d7824[_0x11f3('0x39')]=_0x6d7824['attributes']['length']?_0x6d7824[_0x11f3('0x39')]:_0xa45909['model'];if(_0x27e3c6[_0x11f3('0x35')][_0x11f3('0x45')]){_0x6d7824[_0x11f3('0x46')]=[{'all':!![]}];}_0x6d7824=_['merge']({},_0x6d7824,_0x27e3c6[_0x11f3('0x44')]);return db[_0x11f3('0x2d')]['find'](_0x6d7824)['then'](handleEntityNotFound(_0x3cbc65,null))['then'](respondWithResult(_0x3cbc65,null))[_0x11f3('0x4b')](handleError(_0x3cbc65,null));};exports[_0x11f3('0x4c')]=function(_0x5f482e,_0x16a821){return db[_0x11f3('0x2d')]['create'](_0x5f482e[_0x11f3('0x4d')],{})[_0x11f3('0x28')](respondWithResult(_0x16a821,0xc9))['catch'](handleError(_0x16a821,null));};exports[_0x11f3('0x27')]=function(_0x1d52aa,_0x2f1766){if(_0x1d52aa[_0x11f3('0x4d')]['id']){delete _0x1d52aa[_0x11f3('0x4d')]['id'];}return db[_0x11f3('0x2d')][_0x11f3('0x4e')]({'where':{'id':_0x1d52aa['params']['id']}})[_0x11f3('0x28')](handleEntityNotFound(_0x2f1766,null))[_0x11f3('0x28')](saveUpdates(_0x1d52aa['body'],null))[_0x11f3('0x28')](respondWithResult(_0x2f1766,null))[_0x11f3('0x4b')](handleError(_0x2f1766,null));};exports[_0x11f3('0x4f')]=function(_0x4ca21a,_0x330db8){return db[_0x11f3('0x2d')][_0x11f3('0x4f')]()['then'](respondWithResult(_0x330db8,null))[_0x11f3('0x4b')](handleError(_0x330db8,null));};exports[_0x11f3('0x50')]=function(_0x3a164a,_0x295c10,_0x44eb27){var _0x4dbdfe=require(_0x11f3('0x51'));var _0x1d8ae1=![];var _0x54d5bd={};if(_0x3a164a['query']['type']&&_0x3a164a[_0x11f3('0x35')][_0x11f3('0x42')]===_0x11f3('0x52')){_0x54d5bd[_0x11f3('0x52')]=_0x3a164a[_0x11f3('0x4a')]['id'];}else{_0x54d5bd['id']=_0x3a164a[_0x11f3('0x4a')]['id'];}return db[_0x11f3('0x2d')][_0x11f3('0x4e')]({'where':_0x54d5bd,'attributes':['id',_0x11f3('0x53')],'raw':!![]})[_0x11f3('0x28')](handleEntityNotFound(_0x295c10,null))[_0x11f3('0x28')](function(_0x2fb343){if(_0x2fb343){var _0x2a31fc=_0x2fb343['value'];var _0x3e2f3d=util[_0x11f3('0x34')]('%s.cypher',_0x2a31fc);if(fs['existsSync'](_0x3e2f3d)){_0x1d8ae1=!![];return _0x4dbdfe[_0x11f3('0x54')](_0x3e2f3d,_0x2a31fc,config[_0x11f3('0x55')][_0x11f3('0x56')])[_0x11f3('0x28')](function(){return _0x2fb343;});}return _0x2fb343;}})['then'](function(_0x4a9923){if(_0x4a9923){var _0x1e3d13=_0x4a9923[_0x11f3('0x53')];if(!fs[_0x11f3('0x57')](_0x1e3d13)){throw new db[(_0x11f3('0x58'))][(_0x11f3('0x59'))](_0x11f3('0x5a'));}if(_0x4a9923[_0x11f3('0x5b')]){return _0x295c10[_0x11f3('0x50')](_0x1e3d13,_0x4a9923[_0x11f3('0x5b')]+path['extname'](_0x1e3d13),function(){if(_0x1d8ae1){fs[_0x11f3('0x5c')](_0x1e3d13);}});}else{return _0x295c10[_0x11f3('0x50')](_0x1e3d13,function(_0x2b7e2c){if(_0x1d8ae1){fs[_0x11f3('0x5c')](_0x1e3d13);}});}}})[_0x11f3('0x4b')](function(_0xd681f3){if(_0xd681f3[_0x11f3('0x5d')]===_0x11f3('0x5a')){_0x295c10[_0x11f3('0x1c')](0x194)[_0x11f3('0x2c')]('Not\x20found');}else{return handleError(_0x295c10,null);}});};exports['downloads']=function(_0x45a317,_0x4e4710,_0x10b0b7){var _0x1e4c67=require(_0x11f3('0x51'));var _0xa64e37=![];var _0x165e82={'$and':[db['sequelize']['where'](db[_0x11f3('0x5e')]['fn'](_0x11f3('0x5f'),db[_0x11f3('0x5e')][_0x11f3('0x60')](_0x11f3('0x52'))),_0x45a317[_0x11f3('0x35')][_0x11f3('0x61')])]};if(_0x45a317['query'][_0x11f3('0x42')]&&_0x45a317[_0x11f3('0x35')]['type']==='uniqueid'){_0x165e82[_0x11f3('0x62')][_0x11f3('0x63')]({'uniqueid':_0x45a317[_0x11f3('0x4a')]['id']});}else{_0x165e82['$and'][_0x11f3('0x63')]({'id':_0x45a317[_0x11f3('0x4a')]['id']});}return db[_0x11f3('0x2d')]['find']({'where':_0x165e82,'attributes':['id','value'],'raw':!![]})[_0x11f3('0x28')](handleEntityNotFound(_0x4e4710,null))['then'](function(_0x1a5488){if(_0x1a5488){var _0x1bc013=util[_0x11f3('0x34')](_0x11f3('0x64'),_0x1a5488[_0x11f3('0x53')]);if(fs[_0x11f3('0x57')](_0x1bc013)){_0xa64e37=!![];return _0x1e4c67['decryptFile'](_0x1bc013,_0x1a5488[_0x11f3('0x53')],config['secrets'][_0x11f3('0x56')])[_0x11f3('0x28')](function(){return _0x1a5488;});}return _0x1a5488;}})['then'](function(_0x314f2d){if(_0x314f2d){if(!fs[_0x11f3('0x57')](_0x314f2d[_0x11f3('0x53')])){throw new db['Sequelize'][(_0x11f3('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x314f2d[_0x11f3('0x5b')]){return _0x4e4710['download'](_0x314f2d[_0x11f3('0x53')],_0x314f2d['filename']+path['extname'](_0x314f2d[_0x11f3('0x53')]),function(){if(_0xa64e37){fs[_0x11f3('0x5c')](_0x314f2d[_0x11f3('0x53')]);}});}else{return _0x4e4710[_0x11f3('0x50')](_0x314f2d[_0x11f3('0x53')],function(_0x55b726){if(_0xa64e37){fs['unlink'](_0x314f2d['value']);}});}}})[_0x11f3('0x4b')](handleError(_0x4e4710,null));};exports[_0x11f3('0x65')]=function(_0x43bfa2,_0x4b58ca){return db[_0x11f3('0x2d')][_0x11f3('0x4e')]({'where':{'id':_0x43bfa2[_0x11f3('0x4a')]['id']}})[_0x11f3('0x28')](function(_0x58e50e){if(_[_0x11f3('0x66')](_0x58e50e)){throw new ReferenceError(_0x11f3('0x67'));}return _0x58e50e;})[_0x11f3('0x28')](function(_0x36a2a3){var _0x2a40b7=_0x36a2a3[_0x11f3('0x53')];logger[_0x11f3('0x68')](_0x11f3('0x69'),_0x2a40b7);if(!_[_0x11f3('0x66')](_0x36a2a3[_0x11f3('0x53')])&&fs[_0x11f3('0x57')](_0x2a40b7)){logger['info'](_0x11f3('0x6a')+_0x2a40b7+_0x11f3('0x6b'));fs[_0x11f3('0x6c')](_0x2a40b7);}_0x2a40b7=_0x2a40b7+_0x11f3('0x6d');if(!_[_0x11f3('0x66')](_0x36a2a3[_0x11f3('0x53')])&&fs[_0x11f3('0x57')](_0x2a40b7)){logger[_0x11f3('0x68')](_0x11f3('0x6a')+_0x2a40b7+_0x11f3('0x6b'));fs['unlinkSync'](_0x2a40b7);}return _0x36a2a3;})[_0x11f3('0x28')](function(_0x1baf1e){if(!_0x1baf1e)throw new InternalError();return _0x1baf1e[_0x11f3('0x65')]();})[_0x11f3('0x28')](function(){_0x4b58ca[_0x11f3('0x1c')](0xcc)[_0x11f3('0x1b')]();})[_0x11f3('0x4b')](handleError(_0x4b58ca,null));};function getBucketslist(_0x4cc7f2,_0xc263e9,_0x2697f0){return new Promise(function(_0x107f1c,_0x327d38){var _0x51f082=new AWS['S3']({'accessKeyId':_0xc263e9,'secretAccessKey':_0x4cc7f2,'region':_0x2697f0});_0x51f082[_0x11f3('0x6e')]({},function(_0x3f1b2c,_0x32140d){if(_0x3f1b2c){return _0x327d38(_0x3f1b2c);}else{return _0x107f1c(_0x32140d);}});});}function createBucket(_0x44049b,_0x1cc7d6,_0x5a0a5d,_0xce34fd){return new Promise(function(_0x3a913b,_0x585799){var _0x25eea4=new AWS['S3']({'accessKeyId':_0x1cc7d6,'secretAccessKey':_0x44049b,'region':_0x5a0a5d});_0x25eea4[_0x11f3('0x6f')]({'Bucket':_0xce34fd},function(_0x346f4b,_0x49584f){if(_0x346f4b){return _0x585799(_0x346f4b);}else{return _0x3a913b(_0x49584f);}});});}function uploadFile(_0x54ed4a,_0x39660f,_0x220b23,_0x30cdcd,_0x76640a,_0xbd67fb){return new Promise(function(_0xec6007,_0x58d0b3){var _0x2466f0=new AWS['S3']({'accessKeyId':_0x39660f,'secretAccessKey':_0x54ed4a,'region':_0x220b23});_0x2466f0[_0x11f3('0x70')]({'Bucket':_0x30cdcd,'Key':_0x76640a,'Body':_0xbd67fb},function(_0x48d86e,_0x48eae6){if(_0x48d86e){return _0x58d0b3(_0x48d86e);}else{return _0xec6007(_0x48eae6);}});});}function startTranscribe(_0x127895,_0x5092b1,_0x4807a8,_0x1a6ab0,_0x28a1db,_0x2ba7b6){return new Promise(function(_0x2a54f1,_0x5b98f){var _0x2bf8cc=new AWS[(_0x11f3('0x71'))]({'accessKeyId':_0x5092b1,'secretAccessKey':_0x127895,'region':_0x4807a8});_0x2bf8cc[_0x11f3('0x72')]({'TranscriptionJobName':_0x1a6ab0,'LanguageCode':_0x28a1db,'Media':{'MediaFileUri':_0x2ba7b6}},function(_0x28a764,_0x13fbce){if(_0x28a764){return _0x5b98f(_0x28a764);}else{return _0x2a54f1(_0x13fbce);}});});}function transcribe(_0x459042,_0x577547,_0x176a7f,_0x38347e,_0x2535a3,_0x5c0755,_0x4bcf13){return new Promise(function(_0x57815b,_0x29c480){var _0x1279fb={};logger[_0x11f3('0x68')](util[_0x11f3('0x34')](_0x11f3('0x73'),_0x459042,_0x2535a3));return uploadFile(_0x577547,_0x176a7f,_0x38347e,_0x2535a3,path[_0x11f3('0x74')](_0x5c0755),fs['readFileSync'](_0x5c0755))[_0x11f3('0x28')](function(_0x3aafe3){logger[_0x11f3('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x459042,_0x2535a3,_0x3aafe3[_0x11f3('0x75')]));_0x1279fb['bucket']=_0x3aafe3[_0x11f3('0x76')];_0x1279fb[_0x11f3('0x77')]=_0x3aafe3[_0x11f3('0x75')];logger[_0x11f3('0x68')](util[_0x11f3('0x34')](_0x11f3('0x78'),_0x459042));return startTranscribe(_0x577547,_0x176a7f,_0x38347e,uuidv4(),_0x4bcf13,_0x3aafe3[_0x11f3('0x75')]);})[_0x11f3('0x28')](function(_0x196321){logger[_0x11f3('0x68')](util[_0x11f3('0x34')](_0x11f3('0x79'),_0x459042,_0x196321[_0x11f3('0x7a')]['TranscriptionJobName']));_0x1279fb[_0x11f3('0x7b')]=_0x196321['TranscriptionJob']['TranscriptionJobName'];_0x1279fb[_0x11f3('0x7c')]=_0x196321['TranscriptionJob'][_0x11f3('0x7d')];return _0x57815b(_0x1279fb);})[_0x11f3('0x4b')](function(_0x357259){return _0x29c480(_0x357259);});});}exports['runTranscribe']=function(_0x5dffb6,_0x36d19f,_0x47d5f9){var _0x40f56c;var _0xdde9c3;var _0x10d632;var _0x39eeef=require(_0x11f3('0x51'));return db[_0x11f3('0x2d')][_0x11f3('0x7e')]({'where':{'id':_0x5dffb6['params']['id']}})[_0x11f3('0x28')](function(_0x1d93ef){if(_0x1d93ef){var _0x39825a=util[_0x11f3('0x34')](_0x11f3('0x64'),_0x1d93ef[_0x11f3('0x53')]);if(fs[_0x11f3('0x57')](_0x39825a)){cypher=!![];return _0x39eeef['decryptFile'](_0x39825a,_0x1d93ef[_0x11f3('0x53')],config[_0x11f3('0x55')][_0x11f3('0x56')])['then'](function(){return _0x1d93ef;});}return _0x1d93ef;}})[_0x11f3('0x28')](function(_0x256978){if(!_0x256978){throw new db[(_0x11f3('0x58'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0xdde9c3=_0x256978;return db[_0x11f3('0x7f')][_0x11f3('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x36d19f,null))[_0x11f3('0x28')](function(_0x1e9eb5){if(_0x1e9eb5){_0x40f56c=_0x1e9eb5;if(!_0x40f56c[_0x11f3('0x80')]||!_0x40f56c[_0x11f3('0x81')]||!_0x40f56c[_0x11f3('0x82')]||!_0x40f56c[_0x11f3('0x83')]||!_0x40f56c[_0x11f3('0x84')]){throw new db[(_0x11f3('0x58'))]['ValidationError'](_0x11f3('0x85'));}if(_0x5dffb6['body']['runSentiment']&&(!_0x40f56c['sentiment']||!_0x40f56c['sentimentAccountId']||!_0x40f56c[_0x11f3('0x86')]||!_0x40f56c[_0x11f3('0x83')]||!_0x40f56c[_0x11f3('0x84')])){throw new db[(_0x11f3('0x58'))][(_0x11f3('0x59'))](_0x11f3('0x87'));}return db['CloudProvider'][_0x11f3('0x7e')]({'where':{'id':_0x40f56c[_0x11f3('0x81')]}});}})[_0x11f3('0x28')](function(_0x56adfb){if(!_0x56adfb){throw new db['Sequelize'][(_0x11f3('0x59'))](_0x11f3('0x88'));}if(!_0x56adfb[_0x11f3('0x89')]||!_0x56adfb[_0x11f3('0x8a')]){throw new db['Sequelize'][(_0x11f3('0x59'))]('Cloud\x20Provider\x20not\x20configured');}_0x10d632=_0x56adfb;return getBucketslist(_0x10d632['data1'],_0x10d632['data2'],_0x40f56c[_0x11f3('0x82')]);})['then'](function(_0x2f3c94){if(_0x2f3c94&&_0x2f3c94[_0x11f3('0x8b')]){var _0x353f65=_[_0x11f3('0x4e')](_0x2f3c94[_0x11f3('0x8b')],function(_0x1712ff){return _0x1712ff['Name']===_0x40f56c[_0x11f3('0x84')];});if(!_0x353f65){logger['info'](util[_0x11f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5dffb6[_0x11f3('0x4a')]['id'],_0x40f56c['bucket']));return createBucket(_0x10d632[_0x11f3('0x89')],_0x10d632[_0x11f3('0x8a')],_0x40f56c[_0x11f3('0x82')],_0x40f56c[_0x11f3('0x84')]);}logger['info'](util[_0x11f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5dffb6['params']['id'],_0x40f56c[_0x11f3('0x84')]));return;}})[_0x11f3('0x28')](function(_0x1ba42f){if(_0xdde9c3[_0x11f3('0x7c')]==='NEW'){return transcribe(_0x5dffb6[_0x11f3('0x4a')]['id'],_0x10d632[_0x11f3('0x89')],_0x10d632['data2'],_0x40f56c[_0x11f3('0x82')],_0x40f56c['bucket'],_0xdde9c3[_0x11f3('0x53')],_0x40f56c[_0x11f3('0x83')]);}else{logger['info'](util[_0x11f3('0x34')](_0x11f3('0x8c'),_0x5dffb6[_0x11f3('0x4a')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x11f3('0x28')](function(_0x462ed9){if(_0x462ed9){_0x462ed9[_0x11f3('0x8d')]=_0x5dffb6[_0x11f3('0x4d')]['runSentiment'];return _0xdde9c3[_0x11f3('0x8e')](_0x462ed9);}})[_0x11f3('0x28')](respondWithResult(_0x36d19f,null))[_0x11f3('0x4b')](handleError(_0x36d19f,null));};function writeFile(_0xc32a7f,_0x504f16){return new Promise(function(_0x309a22,_0x1a0421){fs[_0x11f3('0x8f')](_0x504f16,_0xc32a7f,function(_0x68af1f,_0x4c5376){if(_0x68af1f){return _0x1a0421(_0x68af1f);}else{return _0x309a22(_0x4c5376);}});});}exports[_0x11f3('0x90')]=function(_0x5bbf29,_0x4204a8,_0x237394){return db[_0x11f3('0x2d')]['findOne']({'where':{'id':_0x5bbf29[_0x11f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4204a8))['then'](function(_0x3b5fd0){if(_0x3b5fd0&&_0x3b5fd0[_0x11f3('0x91')]){var _0x141e89=_0x3b5fd0[_0x11f3('0x91')];var _0x31dd74=config[_0x11f3('0x92')]+_0x11f3('0x93')+_0x3b5fd0['id']+_0x11f3('0x94');if(fs[_0x11f3('0x57')](_0x31dd74)){return _0x31dd74;}return writeFile(_0x141e89,_0x31dd74)['then'](function(){return _0x31dd74;});}else{throw new db['Sequelize']['ValidationError'](_0x11f3('0x95'));}})[_0x11f3('0x28')](function(_0x5780c7){return _0x4204a8[_0x11f3('0x50')](_0x5780c7);})[_0x11f3('0x4b')](handleError(_0x4204a8));}; \ No newline at end of file +var _0x8163=['../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','downloads','sequelize','MD5','col','$and','push','secrets','extname','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','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'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x8163,0x1b4));var _0x3816=function(_0x5d5c7c,_0xd40d43){_0x5d5c7c=_0x5d5c7c-0x0;var _0x5924c8=_0x8163[_0x5d5c7c];return _0x5924c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3816('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3816('0x1'));var rp=require(_0x3816('0x2'));var moment=require('moment');var BPromise=require(_0x3816('0x3'));var Mustache=require(_0x3816('0x4'));var util=require(_0x3816('0x5'));var path=require(_0x3816('0x6'));var sox=require('sox');var csv=require(_0x3816('0x7'));var ejs=require(_0x3816('0x8'));var fs=require('fs');var fs_extra=require(_0x3816('0x9'));var _=require(_0x3816('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3816('0xb'));var deskjs=require(_0x3816('0xc'));var toCsv=require(_0x3816('0x7'));var querystring=require(_0x3816('0xd'));var Papa=require(_0x3816('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x3816('0xf'));var Redis=require(_0x3816('0x10'));var authService=require(_0x3816('0x11'));var qs=require(_0x3816('0x12'));var as=require(_0x3816('0x13'));var hardwareService=require(_0x3816('0x14'));var logger=require(_0x3816('0x15'))(_0x3816('0x16'));var utils=require(_0x3816('0x17'));var config=require(_0x3816('0x18'));var licenseUtil=require(_0x3816('0x19'));var db=require(_0x3816('0x1a'))['db'];function respondWithStatusCode(_0x3b5d96,_0x39f156){_0x39f156=_0x39f156||0xcc;return function(_0x5461a0){if(_0x5461a0){return _0x3b5d96[_0x3816('0x1b')](_0x39f156);}return _0x3b5d96[_0x3816('0x1c')](_0x39f156)[_0x3816('0x1d')]();};}function respondWithResult(_0x240962,_0x2f079e){_0x2f079e=_0x2f079e||0xc8;return function(_0x1b2d4c){if(_0x1b2d4c){return _0x240962['status'](_0x2f079e)[_0x3816('0x1e')](_0x1b2d4c);}};}function respondWithFilteredResult(_0x2f1a3a,_0x2c0714){return function(_0x806b3a){if(_0x806b3a){var _0x3ae0f9=typeof _0x2c0714['offset']===_0x3816('0x1f')&&typeof _0x2c0714[_0x3816('0x20')]===_0x3816('0x1f');var _0x4edfd8=_0x806b3a['count'];var _0x51a021=_0x3ae0f9?0x0:_0x2c0714[_0x3816('0x21')];var _0x2c20e7=_0x3ae0f9?_0x806b3a['count']:_0x2c0714[_0x3816('0x21')]+_0x2c0714['limit'];var _0x43694a;if(_0x2c20e7>=_0x4edfd8){_0x2c20e7=_0x4edfd8;_0x43694a=0xc8;}else{_0x43694a=0xce;}_0x2f1a3a['status'](_0x43694a);return _0x2f1a3a[_0x3816('0x22')](_0x3816('0x23'),_0x51a021+'-'+_0x2c20e7+'/'+_0x4edfd8)['json'](_0x806b3a);}return null;};}function patchUpdates(_0x32e315){return function(_0xef019e){try{jsonpatch['apply'](_0xef019e,_0x32e315,!![]);}catch(_0x1070f5){return BPromise[_0x3816('0x24')](_0x1070f5);}return _0xef019e[_0x3816('0x25')]();};}function saveUpdates(_0x3b1caa,_0x2c625c){return function(_0x111c16){if(_0x111c16){return _0x111c16[_0x3816('0x26')](_0x3b1caa)['then'](function(_0x53cc74){return _0x53cc74;});}return null;};}function removeEntity(_0x49ebaa,_0x2aebd6){return function(_0x25ed3e){if(_0x25ed3e){return _0x25ed3e[_0x3816('0x27')]()[_0x3816('0x28')](function(){_0x49ebaa[_0x3816('0x1c')](0xcc)[_0x3816('0x1d')]();});}};}function handleEntityNotFound(_0x365d1e,_0x2cd586){return function(_0x28dc23){if(!_0x28dc23){_0x365d1e['sendStatus'](0x194);}return _0x28dc23;};}function handleError(_0x58bf76,_0x3c0e2f){_0x3c0e2f=_0x3c0e2f||0x1f4;return function(_0x4078f8){logger[_0x3816('0x29')](_0x4078f8['stack']);if(_0x4078f8[_0x3816('0x2a')]){delete _0x4078f8['name'];}_0x58bf76[_0x3816('0x1c')](_0x3c0e2f)[_0x3816('0x2b')](_0x4078f8);};}exports[_0x3816('0x2c')]=function(_0x18d377,_0x3c2c2e){var _0x21ad76={},_0x4b3392={},_0x1c9144={'count':0x0,'rows':[]};var _0x1331ca=_[_0x3816('0x2d')](db[_0x3816('0x2e')][_0x3816('0x2f')],function(_0xc5e7c3){return{'name':_0xc5e7c3[_0x3816('0x30')],'type':_0xc5e7c3[_0x3816('0x31')][_0x3816('0x32')]};});_0x4b3392[_0x3816('0x33')]=_[_0x3816('0x34')](_['map'](_0x1331ca,'name'),[_0x3816('0x35')]);_0x4b3392['query']=_['keys'](_0x18d377[_0x3816('0x36')]);_0x4b3392[_0x3816('0x37')]=_[_0x3816('0x38')](_0x4b3392[_0x3816('0x33')],_0x4b3392[_0x3816('0x36')]);_0x21ad76[_0x3816('0x39')]=_['intersection'](_0x4b3392['model'],qs[_0x3816('0x3a')](_0x18d377[_0x3816('0x36')][_0x3816('0x3a')]));_0x21ad76['attributes']=_0x21ad76[_0x3816('0x39')][_0x3816('0x3b')]?_0x21ad76[_0x3816('0x39')]:_0x4b3392[_0x3816('0x33')];if(!_0x18d377[_0x3816('0x36')][_0x3816('0x3c')]('nolimit')){_0x21ad76['limit']=qs[_0x3816('0x20')](_0x18d377[_0x3816('0x36')][_0x3816('0x20')]);_0x21ad76['offset']=qs[_0x3816('0x21')](_0x18d377[_0x3816('0x36')][_0x3816('0x21')]);}_0x21ad76[_0x3816('0x3d')]=qs[_0x3816('0x3e')](_0x18d377[_0x3816('0x36')][_0x3816('0x3e')]);_0x21ad76[_0x3816('0x3f')]=qs[_0x3816('0x37')](_['pick'](_0x18d377[_0x3816('0x36')],_0x4b3392[_0x3816('0x37')]),_0x1331ca);if(_0x18d377[_0x3816('0x36')]['filter']){_0x21ad76[_0x3816('0x3f')]=_[_0x3816('0x40')](_0x21ad76['where'],{'$or':_['map'](_0x1331ca,function(_0x3b3452){if(_0x3b3452[_0x3816('0x31')]!==_0x3816('0x41')){var _0x104db1={};_0x104db1[_0x3b3452[_0x3816('0x2a')]]={'$like':'%'+_0x18d377[_0x3816('0x36')]['filter']+'%'};return _0x104db1;}})});}_0x21ad76=_[_0x3816('0x40')]({},_0x21ad76,_0x18d377[_0x3816('0x42')]);var _0xb81777={'where':_0x21ad76[_0x3816('0x3f')]};return db[_0x3816('0x2e')][_0x3816('0x43')](_0xb81777)['then'](function(_0x157dca){_0x1c9144[_0x3816('0x43')]=_0x157dca;if(_0x18d377['query'][_0x3816('0x44')]){_0x21ad76['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x3816('0x45')](_0x21ad76);})[_0x3816('0x28')](function(_0x51d687){_0x1c9144[_0x3816('0x46')]=_0x51d687;return _0x1c9144;})[_0x3816('0x28')](respondWithFilteredResult(_0x3c2c2e,_0x21ad76))['catch'](handleError(_0x3c2c2e,null));};exports[_0x3816('0x47')]=function(_0x3cddf8,_0x143a5d){var _0x44693a={'raw':![],'where':{'id':_0x3cddf8[_0x3816('0x48')]['id']}},_0x552db5={};_0x552db5[_0x3816('0x33')]=_[_0x3816('0x49')](db[_0x3816('0x2e')][_0x3816('0x2f')]);_0x552db5[_0x3816('0x36')]=_[_0x3816('0x49')](_0x3cddf8[_0x3816('0x36')]);_0x552db5[_0x3816('0x37')]=_[_0x3816('0x38')](_0x552db5[_0x3816('0x33')],_0x552db5[_0x3816('0x36')]);_0x44693a[_0x3816('0x39')]=_[_0x3816('0x38')](_0x552db5[_0x3816('0x33')],qs['fields'](_0x3cddf8[_0x3816('0x36')][_0x3816('0x3a')]));_0x44693a[_0x3816('0x39')]=_0x44693a[_0x3816('0x39')][_0x3816('0x3b')]?_0x44693a[_0x3816('0x39')]:_0x552db5[_0x3816('0x33')];if(_0x3cddf8[_0x3816('0x36')]['includeAll']){_0x44693a[_0x3816('0x4a')]=[{'all':!![]}];}_0x44693a=_[_0x3816('0x40')]({},_0x44693a,_0x3cddf8[_0x3816('0x42')]);return db[_0x3816('0x2e')][_0x3816('0x4b')](_0x44693a)['then'](handleEntityNotFound(_0x143a5d,null))['then'](respondWithResult(_0x143a5d,null))[_0x3816('0x4c')](handleError(_0x143a5d,null));};exports['create']=function(_0x1197b4,_0x5f46c4){return db[_0x3816('0x2e')][_0x3816('0x4d')](_0x1197b4[_0x3816('0x4e')],{})[_0x3816('0x28')](respondWithResult(_0x5f46c4,0xc9))['catch'](handleError(_0x5f46c4,null));};exports[_0x3816('0x26')]=function(_0x337d0e,_0x56bc9f){if(_0x337d0e[_0x3816('0x4e')]['id']){delete _0x337d0e[_0x3816('0x4e')]['id'];}return db[_0x3816('0x2e')][_0x3816('0x4b')]({'where':{'id':_0x337d0e[_0x3816('0x48')]['id']}})[_0x3816('0x28')](handleEntityNotFound(_0x56bc9f,null))[_0x3816('0x28')](saveUpdates(_0x337d0e[_0x3816('0x4e')],null))[_0x3816('0x28')](respondWithResult(_0x56bc9f,null))[_0x3816('0x4c')](handleError(_0x56bc9f,null));};exports[_0x3816('0x4f')]=function(_0x1f5163,_0xc4940b){return db[_0x3816('0x2e')][_0x3816('0x4f')]()['then'](respondWithResult(_0xc4940b,null))[_0x3816('0x4c')](handleError(_0xc4940b,null));};exports[_0x3816('0x50')]=function(_0x29dccb,_0x35e20d,_0x50a3d1){var _0x31bae4=require(_0x3816('0x51'));var _0x37155f=![];var _0x397914={};if(_0x29dccb[_0x3816('0x36')][_0x3816('0x31')]&&_0x29dccb[_0x3816('0x36')]['type']===_0x3816('0x52')){_0x397914['uniqueid']=_0x29dccb[_0x3816('0x48')]['id'];}else{_0x397914['id']=_0x29dccb[_0x3816('0x48')]['id'];}return db[_0x3816('0x2e')]['find']({'where':_0x397914,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x35e20d,null))[_0x3816('0x28')](function(_0x33065a){if(_0x33065a){var _0x5b630c=_0x33065a[_0x3816('0x53')];var _0xcbc155=util[_0x3816('0x35')](_0x3816('0x54'),_0x5b630c);if(fs[_0x3816('0x55')](_0xcbc155)){_0x37155f=!![];return _0x31bae4[_0x3816('0x56')](_0xcbc155,_0x5b630c,config['secrets'][_0x3816('0x57')])[_0x3816('0x28')](function(){return _0x33065a;});}return _0x33065a;}})['then'](function(_0x4929d5){if(_0x4929d5){var _0x123cb0=_0x4929d5[_0x3816('0x53')];if(!fs['existsSync'](_0x123cb0)){throw new db[(_0x3816('0x58'))][(_0x3816('0x59'))](_0x3816('0x5a'));}if(_0x4929d5[_0x3816('0x5b')]){return _0x35e20d[_0x3816('0x50')](_0x123cb0,_0x4929d5[_0x3816('0x5b')]+path['extname'](_0x123cb0),function(){if(_0x37155f){fs[_0x3816('0x5c')](_0x123cb0);}});}else{return _0x35e20d[_0x3816('0x50')](_0x123cb0,function(_0x35a3e9){if(_0x37155f){fs[_0x3816('0x5c')](_0x123cb0);}});}}})['catch'](function(_0x2e9701){if(_0x2e9701['message']==='VoiceRecording\x20not\x20found'){_0x35e20d['status'](0x194)[_0x3816('0x2b')]('Not\x20found');}else{return handleError(_0x35e20d,null);}});};exports[_0x3816('0x5d')]=function(_0x5dfb9a,_0x25cc33,_0xfdaea6){var _0x1da69d=require(_0x3816('0x51'));var _0x25458c=![];var _0x531f9b={'$and':[db[_0x3816('0x5e')][_0x3816('0x3f')](db['sequelize']['fn'](_0x3816('0x5f'),db[_0x3816('0x5e')][_0x3816('0x60')](_0x3816('0x52'))),_0x5dfb9a['query']['token'])]};if(_0x5dfb9a['query']['type']&&_0x5dfb9a[_0x3816('0x36')][_0x3816('0x31')]===_0x3816('0x52')){_0x531f9b[_0x3816('0x61')]['push']({'uniqueid':_0x5dfb9a[_0x3816('0x48')]['id']});}else{_0x531f9b[_0x3816('0x61')][_0x3816('0x62')]({'id':_0x5dfb9a[_0x3816('0x48')]['id']});}return db['VoiceRecording'][_0x3816('0x4b')]({'where':_0x531f9b,'attributes':['id',_0x3816('0x53')],'raw':!![]})[_0x3816('0x28')](handleEntityNotFound(_0x25cc33,null))[_0x3816('0x28')](function(_0x23456a){if(_0x23456a){var _0x136494=util[_0x3816('0x35')](_0x3816('0x54'),_0x23456a[_0x3816('0x53')]);if(fs['existsSync'](_0x136494)){_0x25458c=!![];return _0x1da69d[_0x3816('0x56')](_0x136494,_0x23456a['value'],config[_0x3816('0x63')][_0x3816('0x57')])[_0x3816('0x28')](function(){return _0x23456a;});}return _0x23456a;}})[_0x3816('0x28')](function(_0x295e13){if(_0x295e13){if(!fs[_0x3816('0x55')](_0x295e13['value'])){throw new db[(_0x3816('0x58'))][(_0x3816('0x59'))](_0x3816('0x5a'));}if(_0x295e13['filename']){return _0x25cc33[_0x3816('0x50')](_0x295e13[_0x3816('0x53')],_0x295e13[_0x3816('0x5b')]+path[_0x3816('0x64')](_0x295e13[_0x3816('0x53')]),function(){if(_0x25458c){fs[_0x3816('0x5c')](_0x295e13[_0x3816('0x53')]);}});}else{return _0x25cc33[_0x3816('0x50')](_0x295e13[_0x3816('0x53')],function(_0xe38e8){if(_0x25458c){fs['unlink'](_0x295e13['value']);}});}}})[_0x3816('0x4c')](handleError(_0x25cc33,null));};exports[_0x3816('0x27')]=function(_0x476433,_0x53c049){return db[_0x3816('0x2e')][_0x3816('0x4b')]({'where':{'id':_0x476433[_0x3816('0x48')]['id']}})[_0x3816('0x28')](function(_0x5e208c){if(_['isNil'](_0x5e208c)){throw new ReferenceError(_0x3816('0x65'));}return _0x5e208c;})[_0x3816('0x28')](function(_0x51983f){var _0x5b2770=_0x51983f[_0x3816('0x53')];logger[_0x3816('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x5b2770);if(!_['isNil'](_0x51983f['value'])&&fs[_0x3816('0x55')](_0x5b2770)){logger[_0x3816('0x66')](_0x3816('0x67')+_0x5b2770+_0x3816('0x68'));fs[_0x3816('0x69')](_0x5b2770);}_0x5b2770=_0x5b2770+_0x3816('0x6a');if(!_[_0x3816('0x6b')](_0x51983f[_0x3816('0x53')])&&fs['existsSync'](_0x5b2770)){logger['info'](_0x3816('0x67')+_0x5b2770+_0x3816('0x68'));fs[_0x3816('0x69')](_0x5b2770);}return _0x51983f;})[_0x3816('0x28')](function(_0x157fca){if(!_0x157fca)throw new InternalError();return _0x157fca['destroy']();})[_0x3816('0x28')](function(){_0x53c049[_0x3816('0x1c')](0xcc)[_0x3816('0x1d')]();})[_0x3816('0x4c')](handleError(_0x53c049,null));};function getBucketslist(_0x21c941,_0x2158a3,_0x2539be){return new Promise(function(_0x1d0a41,_0x236b27){var _0x173007=new AWS['S3']({'accessKeyId':_0x2158a3,'secretAccessKey':_0x21c941,'region':_0x2539be});_0x173007[_0x3816('0x6c')]({},function(_0x231e06,_0xec9494){if(_0x231e06){return _0x236b27(_0x231e06);}else{return _0x1d0a41(_0xec9494);}});});}function createBucket(_0x3fa8ea,_0x476df9,_0xc7ac0c,_0x168470){return new Promise(function(_0xdb34f1,_0x91279a){var _0x26ab13=new AWS['S3']({'accessKeyId':_0x476df9,'secretAccessKey':_0x3fa8ea,'region':_0xc7ac0c});_0x26ab13[_0x3816('0x6d')]({'Bucket':_0x168470},function(_0x168238,_0x35af66){if(_0x168238){return _0x91279a(_0x168238);}else{return _0xdb34f1(_0x35af66);}});});}function uploadFile(_0x4f4507,_0xbe5581,_0xfcdb1,_0x44c147,_0x39ee18,_0x8d9f0a){return new Promise(function(_0x1d8481,_0x11e329){var _0x1b8e1b=new AWS['S3']({'accessKeyId':_0xbe5581,'secretAccessKey':_0x4f4507,'region':_0xfcdb1});_0x1b8e1b[_0x3816('0x6e')]({'Bucket':_0x44c147,'Key':_0x39ee18,'Body':_0x8d9f0a},function(_0x377ce7,_0x43716a){if(_0x377ce7){return _0x11e329(_0x377ce7);}else{return _0x1d8481(_0x43716a);}});});}function startTranscribe(_0x4b4a3c,_0x15e596,_0x38abb0,_0x1db027,_0x434f6e,_0xefb0c0){return new Promise(function(_0x99284b,_0x173fc2){var _0x2e4e72=new AWS['TranscribeService']({'accessKeyId':_0x15e596,'secretAccessKey':_0x4b4a3c,'region':_0x38abb0});_0x2e4e72[_0x3816('0x6f')]({'TranscriptionJobName':_0x1db027,'LanguageCode':_0x434f6e,'Media':{'MediaFileUri':_0xefb0c0}},function(_0x3bd7a8,_0x3c6554){if(_0x3bd7a8){return _0x173fc2(_0x3bd7a8);}else{return _0x99284b(_0x3c6554);}});});}function transcribe(_0x635c5a,_0x840bfc,_0x3e5e8c,_0x419ea1,_0x5262e7,_0x1d8c0f,_0x104f8f){return new Promise(function(_0x4557d9,_0x13c7f0){var _0x40a787={};logger[_0x3816('0x66')](util[_0x3816('0x35')](_0x3816('0x70'),_0x635c5a,_0x5262e7));return uploadFile(_0x840bfc,_0x3e5e8c,_0x419ea1,_0x5262e7,path[_0x3816('0x71')](_0x1d8c0f),fs['readFileSync'](_0x1d8c0f))[_0x3816('0x28')](function(_0x25684b){logger[_0x3816('0x66')](util['format'](_0x3816('0x72'),_0x635c5a,_0x5262e7,_0x25684b[_0x3816('0x73')]));_0x40a787[_0x3816('0x74')]=_0x25684b['Bucket'];_0x40a787[_0x3816('0x75')]=_0x25684b[_0x3816('0x73')];logger[_0x3816('0x66')](util[_0x3816('0x35')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x635c5a));return startTranscribe(_0x840bfc,_0x3e5e8c,_0x419ea1,uuidv4(),_0x104f8f,_0x25684b[_0x3816('0x73')]);})[_0x3816('0x28')](function(_0x477acd){logger[_0x3816('0x66')](util[_0x3816('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x635c5a,_0x477acd[_0x3816('0x76')]['TranscriptionJobName']));_0x40a787['transcribeName']=_0x477acd[_0x3816('0x76')][_0x3816('0x77')];_0x40a787[_0x3816('0x78')]=_0x477acd[_0x3816('0x76')][_0x3816('0x79')];return _0x4557d9(_0x40a787);})[_0x3816('0x4c')](function(_0x405962){return _0x13c7f0(_0x405962);});});}exports[_0x3816('0x7a')]=function(_0x49fbd6,_0x599746,_0x3df6ab){var _0x584851;var _0x2f3f51;var _0x4c81ad;var _0x16bc5b=require('../../components/encryptor');return db['VoiceRecording'][_0x3816('0x7b')]({'where':{'id':_0x49fbd6[_0x3816('0x48')]['id']}})[_0x3816('0x28')](function(_0x490610){if(_0x490610){var _0x33f9d8=util[_0x3816('0x35')](_0x3816('0x54'),_0x490610[_0x3816('0x53')]);if(fs[_0x3816('0x55')](_0x33f9d8)){cypher=!![];return _0x16bc5b[_0x3816('0x56')](_0x33f9d8,_0x490610[_0x3816('0x53')],config['secrets'][_0x3816('0x57')])[_0x3816('0x28')](function(){return _0x490610;});}return _0x490610;}})[_0x3816('0x28')](function(_0x1c3e08){if(!_0x1c3e08){throw new db[(_0x3816('0x58'))][(_0x3816('0x59'))](_0x3816('0x7c'));}_0x2f3f51=_0x1c3e08;return db[_0x3816('0x7d')][_0x3816('0x7b')]({'where':{'id':0x1}});})[_0x3816('0x28')](handleEntityNotFound(_0x599746,null))['then'](function(_0x3cc4c2){if(_0x3cc4c2){_0x584851=_0x3cc4c2;if(!_0x584851[_0x3816('0x7e')]||!_0x584851[_0x3816('0x7f')]||!_0x584851[_0x3816('0x80')]||!_0x584851[_0x3816('0x81')]||!_0x584851[_0x3816('0x74')]){throw new db['Sequelize'][(_0x3816('0x59'))](_0x3816('0x82'));}if(_0x49fbd6[_0x3816('0x4e')][_0x3816('0x83')]&&(!_0x584851[_0x3816('0x84')]||!_0x584851[_0x3816('0x85')]||!_0x584851['sentimentRegion']||!_0x584851['language']||!_0x584851[_0x3816('0x74')])){throw new db[(_0x3816('0x58'))][(_0x3816('0x59'))](_0x3816('0x86'));}return db[_0x3816('0x87')][_0x3816('0x7b')]({'where':{'id':_0x584851['transcribeAccountId']}});}})['then'](function(_0x38d8bc){if(!_0x38d8bc){throw new db[(_0x3816('0x58'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x38d8bc[_0x3816('0x88')]||!_0x38d8bc[_0x3816('0x89')]){throw new db[(_0x3816('0x58'))][(_0x3816('0x59'))](_0x3816('0x8a'));}_0x4c81ad=_0x38d8bc;return getBucketslist(_0x4c81ad[_0x3816('0x88')],_0x4c81ad[_0x3816('0x89')],_0x584851[_0x3816('0x80')]);})['then'](function(_0x50baca){if(_0x50baca&&_0x50baca[_0x3816('0x8b')]){var _0x1d0ed9=_[_0x3816('0x4b')](_0x50baca['Buckets'],function(_0x55928b){return _0x55928b[_0x3816('0x8c')]===_0x584851[_0x3816('0x74')];});if(!_0x1d0ed9){logger['info'](util[_0x3816('0x35')](_0x3816('0x8d'),_0x49fbd6['params']['id'],_0x584851[_0x3816('0x74')]));return createBucket(_0x4c81ad[_0x3816('0x88')],_0x4c81ad[_0x3816('0x89')],_0x584851[_0x3816('0x80')],_0x584851[_0x3816('0x74')]);}logger[_0x3816('0x66')](util[_0x3816('0x35')](_0x3816('0x8e'),_0x49fbd6[_0x3816('0x48')]['id'],_0x584851[_0x3816('0x74')]));return;}})[_0x3816('0x28')](function(_0x3d69db){if(_0x2f3f51[_0x3816('0x78')]===_0x3816('0x8f')){return transcribe(_0x49fbd6[_0x3816('0x48')]['id'],_0x4c81ad[_0x3816('0x88')],_0x4c81ad[_0x3816('0x89')],_0x584851['transcribeRegion'],_0x584851[_0x3816('0x74')],_0x2f3f51[_0x3816('0x53')],_0x584851['language']);}else{logger[_0x3816('0x66')](util[_0x3816('0x35')](_0x3816('0x90'),_0x49fbd6[_0x3816('0x48')]['id']));return{'transcribeStatus':_0x3816('0x91')};}})[_0x3816('0x28')](function(_0x6e96cb){if(_0x6e96cb){_0x6e96cb[_0x3816('0x92')]=_0x49fbd6[_0x3816('0x4e')][_0x3816('0x83')];return _0x2f3f51[_0x3816('0x93')](_0x6e96cb);}})[_0x3816('0x28')](respondWithResult(_0x599746,null))[_0x3816('0x4c')](handleError(_0x599746,null));};function writeFile(_0x4f97e1,_0x37d30c){return new Promise(function(_0x3dab83,_0x265b04){fs[_0x3816('0x94')](_0x37d30c,_0x4f97e1,function(_0x2cfcb5,_0x29bbc3){if(_0x2cfcb5){return _0x265b04(_0x2cfcb5);}else{return _0x3dab83(_0x29bbc3);}});});}exports[_0x3816('0x95')]=function(_0x44dec9,_0x4968f0,_0x3267ea){return db[_0x3816('0x2e')]['findOne']({'where':{'id':_0x44dec9[_0x3816('0x48')]['id']}})['then'](handleEntityNotFound(_0x4968f0))[_0x3816('0x28')](function(_0x38ae7d){if(_0x38ae7d&&_0x38ae7d['fileText']){var _0xe5c466=_0x38ae7d[_0x3816('0x96')];var _0x3c9a3b=config[_0x3816('0x97')]+_0x3816('0x98')+_0x38ae7d['id']+_0x3816('0x99');if(fs[_0x3816('0x55')](_0x3c9a3b)){return _0x3c9a3b;}return writeFile(_0xe5c466,_0x3c9a3b)[_0x3816('0x28')](function(){return _0x3c9a3b;});}else{throw new db[(_0x3816('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x3816('0x28')](function(_0x1675df){return _0x4968f0[_0x3816('0x50')](_0x1675df);})['catch'](handleError(_0x4968f0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d9d9bd3..bd5efcb 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 _0xe9e8=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x427dd2,_0x3aab0d){var _0x21b5f5=function(_0x396714){while(--_0x396714){_0x427dd2['push'](_0x427dd2['shift']());}};_0x21b5f5(++_0x3aab0d);}(_0xe9e8,0x179));var _0x8e9e=function(_0x283d02,_0x5a5093){_0x283d02=_0x283d02-0x0;var _0x260dce=_0xe9e8[_0x283d02];return _0x260dce;};'use strict';var attributes=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]=function(_0x38ef03,_0x38b3cb){return _0x38ef03[_0x8e9e('0x2')](_0x8e9e('0x3'),attributes,{'tableName':_0x8e9e('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8e9e('0x5')]},{'name':'transcribeStatus','fields':[_0x8e9e('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb3f=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','voice_recordings'];(function(_0x38ea1c,_0x12da59){var _0x57380d=function(_0x5937d7){while(--_0x5937d7){_0x38ea1c['push'](_0x38ea1c['shift']());}};_0x57380d(++_0x12da59);}(_0xfb3f,0xd9));var _0xffb3=function(_0x269be1,_0xee64a7){_0x269be1=_0x269be1-0x0;var _0x35049e=_0xfb3f[_0x269be1];return _0x35049e;};'use strict';var attributes=require(_0xffb3('0x0'));module[_0xffb3('0x1')]=function(_0x555a2b,_0x3b2630){return _0x555a2b['define']('VoiceRecording',attributes,{'tableName':_0xffb3('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xffb3('0x3')]},{'name':_0xffb3('0x4'),'fields':[_0xffb3('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cb9bf2c..c0176de 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 _0x2ef3=['options','raw','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','existsSync','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','body'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x2ef3,0xba));var _0x32ef=function(_0x22ce8c,_0xa7be0){_0x22ce8c=_0x22ce8c-0x0;var _0x2d7db5=_0x2ef3[_0x22ce8c];return _0x2d7db5;};'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')]('VoiceRecording,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['update'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')]['where']||null:null,'attributes':_0x1a9476[_0x32ef('0x18')]?_0x1a9476['options'][_0x32ef('0x1a')]||null:null,'limit':_0x1a9476[_0x32ef('0x18')]?_0x1a9476['options'][_0x32ef('0x1b')]||null:null})[_0x32ef('0xb')](function(_0x5e8898){logger['info']('UpdateVoiceRecording',_0x1a9476);logger[_0x32ef('0x1c')](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x5e8898));_0x57863c(_0x5e8898);})['catch'](function(_0x59585f){logger[_0x32ef('0x11')]('UpdateVoiceRecording',_0x59585f['message'],_0x1a9476);_0xbe37f6(_0x286bfb[_0x32ef('0x11')](0x1f4,_0x59585f[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1d')]=function(_0x1dbe98){var _0x15ce54=this;return new Promise(function(_0x234175,_0x1874ea){var _0x38aed5=require(_0x32ef('0x1e'));var _0x2f52d7;return db[_0x32ef('0x1f')][_0x32ef('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x32ef('0xb')](function(_0x2f5d06){_0x2f52d7=_0x2f5d06;return db['VoiceRecording'][_0x32ef('0x21')](_0x1dbe98[_0x32ef('0x17')]);})[_0x32ef('0xb')](function(_0x26e207){if(_0x2f52d7['callRecordingEncryption']&&fs[_0x32ef('0x22')](_0x26e207[_0x32ef('0x23')])){var _0x31dbc3=util[_0x32ef('0x24')](_0x32ef('0x25'),_0x26e207[_0x32ef('0x23')]);return _0x38aed5[_0x32ef('0x26')](_0x26e207['value'],_0x31dbc3,config[_0x32ef('0x27')]['recording'])[_0x32ef('0xb')](function(){fs[_0x32ef('0x28')](_0x26e207['value']);logger[_0x32ef('0xc')](_0x32ef('0x29'));return _0x26e207;});}return _0x26e207;})[_0x32ef('0xb')](function(_0x20b467){logger[_0x32ef('0xc')]('CreateVoiceRecording',_0x1dbe98);logger['debug'](_0x32ef('0x1d'),_0x1dbe98,JSON['stringify'](_0x20b467));_0x234175(_0x20b467);})[_0x32ef('0x14')](function(_0x15b873){logger[_0x32ef('0x11')](_0x32ef('0x1d'),_0x15b873[_0x32ef('0x13')],_0x1dbe98);_0x1874ea(_0x15ce54[_0x32ef('0x11')](0x1f4,_0x15b873['message']));});});}; \ No newline at end of file +var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x727ad0,_0x42eed1){var _0x1e42d1=function(_0x9d0573){while(--_0x9d0573){_0x727ad0['push'](_0x727ad0['shift']());}};_0x1e42d1(++_0x42eed1);}(_0x66fa,0x117));var _0xa66f=function(_0x4b0011,_0x17af5b){_0x4b0011=_0x4b0011-0x0;var _0x1b5b5d=_0x66fa[_0x4b0011];return _0x1b5b5d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index aee7953..61cff40 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 _0xfddc=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfddc,0x18e));var _0xcfdd=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfddc[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xcfdd('0x0'));var util=require(_0xcfdd('0x1'));var path=require('path');var timeout=require(_0xcfdd('0x2'));var express=require(_0xcfdd('0x3'));var router=express['Router']();var fs_extra=require(_0xcfdd('0x4'));var auth=require(_0xcfdd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfdd('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xcfdd('0x7')]('/',auth[_0xcfdd('0x8')](),controller[_0xcfdd('0x9')]);router[_0xcfdd('0x7')]('/describe',auth[_0xcfdd('0x8')](),controller[_0xcfdd('0xa')]);router[_0xcfdd('0x7')]('/:id',auth[_0xcfdd('0x8')](),controller[_0xcfdd('0xb')]);router[_0xcfdd('0xc')]('/',auth[_0xcfdd('0x8')](),controller[_0xcfdd('0xd')]);router[_0xcfdd('0xe')](_0xcfdd('0xf'),auth['isAuthenticated'](),controller[_0xcfdd('0x10')]);router[_0xcfdd('0x11')]('/:id',auth[_0xcfdd('0x8')](),controller[_0xcfdd('0x12')]);module[_0xcfdd('0x13')]=router; \ No newline at end of file +var _0x9e37=['get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x5b8980,_0x2a9b81){var _0x5edc9a=function(_0x2861d3){while(--_0x2861d3){_0x5b8980['push'](_0x5b8980['shift']());}};_0x5edc9a(++_0x2a9b81);}(_0x9e37,0x12e));var _0x79e3=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x9e37[_0x510b98];return _0x45e775;};'use strict';var multer=require(_0x79e3('0x0'));var util=require(_0x79e3('0x1'));var path=require(_0x79e3('0x2'));var timeout=require(_0x79e3('0x3'));var express=require(_0x79e3('0x4'));var router=express['Router']();var fs_extra=require(_0x79e3('0x5'));var auth=require(_0x79e3('0x6'));var interaction=require(_0x79e3('0x7'));var config=require(_0x79e3('0x8'));var controller=require(_0x79e3('0x9'));router[_0x79e3('0xa')]('/',auth['isAuthenticated'](),controller[_0x79e3('0xb')]);router[_0x79e3('0xa')](_0x79e3('0xc'),auth[_0x79e3('0xd')](),controller[_0x79e3('0xe')]);router[_0x79e3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x79e3('0xf')]);router[_0x79e3('0x10')]('/',auth[_0x79e3('0xd')](),controller[_0x79e3('0x11')]);router[_0x79e3('0x12')](_0x79e3('0x13'),auth[_0x79e3('0xd')](),controller[_0x79e3('0x14')]);router[_0x79e3('0x15')]('/:id',auth[_0x79e3('0xd')](),controller[_0x79e3('0x16')]);module[_0x79e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 17f9b7b..b320234 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 _0xdc7f=['sequelize','ENUM','blind','STRING'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xdc7f,0xc0));var _0xfdc7=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0xdc7f[_0x2a276d];return _0x2914cd;};'use strict';var Sequelize=require(_0xfdc7('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xfdc7('0x1')](_0xfdc7('0x2'),'attended')},'result':{'type':Sequelize[_0xfdc7('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xfdc7('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfdc7('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xfdc7('0x3')]},'transferercontext':{'type':Sequelize[_0xfdc7('0x3')]},'transfererexten':{'type':Sequelize[_0xfdc7('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xfdc7('0x3')]},'transfereechannel':{'type':Sequelize[_0xfdc7('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xfdc7('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xfdc7('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfdc7('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfdc7('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xfdc7('0x3')]},'transfereecontext':{'type':Sequelize[_0xfdc7('0x3')]},'transfereeexten':{'type':Sequelize[_0xfdc7('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xfdc7('0x1')]('Yes','No')},'context':{'type':Sequelize[_0xfdc7('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a48=['STRING','Yes','moment','exports','ENUM','blind','attended'];(function(_0x3b6f49,_0x5cf18e){var _0x517923=function(_0x4b44e1){while(--_0x4b44e1){_0x3b6f49['push'](_0x3b6f49['shift']());}};_0x517923(++_0x5cf18e);}(_0x1a48,0x13d));var _0x81a4=function(_0x4a8aeb,_0x5e4452){_0x4a8aeb=_0x4a8aeb-0x0;var _0x301d3e=_0x1a48[_0x4a8aeb];return _0x301d3e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x81a4('0x0'));module[_0x81a4('0x1')]={'type':{'type':Sequelize[_0x81a4('0x2')](_0x81a4('0x3'),_0x81a4('0x4'))},'result':{'type':Sequelize[_0x81a4('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x81a4('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x81a4('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x81a4('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x81a4('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x81a4('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x81a4('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x81a4('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x81a4('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x81a4('0x5')]},'transfereecontext':{'type':Sequelize[_0x81a4('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x81a4('0x5')]},'isexternal':{'type':Sequelize[_0x81a4('0x2')](_0x81a4('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x81a4('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5dd87f2..5371319 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 _0x88a2=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','VoiceTransferReport','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','filters','merge','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x88a2,0x1a0));var _0x288a=function(_0x5eff69,_0x53808d){_0x5eff69=_0x5eff69-0x0;var _0x1307ea=_0x88a2[_0x5eff69];return _0x1307ea;};'use strict';var emlformat=require(_0x288a('0x0'));var rimraf=require(_0x288a('0x1'));var zipdir=require(_0x288a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x288a('0x3'));var moment=require(_0x288a('0x4'));var BPromise=require(_0x288a('0x5'));var Mustache=require(_0x288a('0x6'));var util=require(_0x288a('0x7'));var path=require(_0x288a('0x8'));var sox=require(_0x288a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x288a('0xa'));var _=require(_0x288a('0xb'));var squel=require(_0x288a('0xc'));var crypto=require(_0x288a('0xd'));var jsforce=require(_0x288a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x288a('0xf'));var querystring=require('querystring');var Papa=require(_0x288a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x288a('0x11'));var as=require(_0x288a('0x12'));var hardwareService=require(_0x288a('0x13'));var logger=require(_0x288a('0x14'))(_0x288a('0x15'));var utils=require(_0x288a('0x16'));var config=require(_0x288a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x288a('0x18'))['db'];function respondWithStatusCode(_0x37f17e,_0x8f806d){_0x8f806d=_0x8f806d||0xcc;return function(_0x31a693){if(_0x31a693){return _0x37f17e[_0x288a('0x19')](_0x8f806d);}return _0x37f17e[_0x288a('0x1a')](_0x8f806d)['end']();};}function respondWithResult(_0x3bfc77,_0x2965be){_0x2965be=_0x2965be||0xc8;return function(_0xc3f70c){if(_0xc3f70c){return _0x3bfc77['status'](_0x2965be)[_0x288a('0x1b')](_0xc3f70c);}};}function respondWithFilteredResult(_0x464adf,_0x34b8bf){return function(_0x49b9c2){if(_0x49b9c2){var _0x46ae86=typeof _0x34b8bf[_0x288a('0x1c')]===_0x288a('0x1d')&&typeof _0x34b8bf[_0x288a('0x1e')]===_0x288a('0x1d');var _0x37e992=_0x49b9c2[_0x288a('0x1f')];var _0x3a40ec=_0x46ae86?0x0:_0x34b8bf[_0x288a('0x1c')];var _0xe7ebd8=_0x46ae86?_0x49b9c2['count']:_0x34b8bf[_0x288a('0x1c')]+_0x34b8bf[_0x288a('0x1e')];var _0x1ad8d8;if(_0xe7ebd8>=_0x37e992){_0xe7ebd8=_0x37e992;_0x1ad8d8=0xc8;}else{_0x1ad8d8=0xce;}_0x464adf[_0x288a('0x1a')](_0x1ad8d8);return _0x464adf[_0x288a('0x20')](_0x288a('0x21'),_0x3a40ec+'-'+_0xe7ebd8+'/'+_0x37e992)['json'](_0x49b9c2);}return null;};}function patchUpdates(_0x10f2f5){return function(_0xfd63ce){try{jsonpatch[_0x288a('0x22')](_0xfd63ce,_0x10f2f5,!![]);}catch(_0x14dd87){return BPromise[_0x288a('0x23')](_0x14dd87);}return _0xfd63ce['save']();};}function saveUpdates(_0x1501fa,_0x4a5a9d){return function(_0x450206){if(_0x450206){return _0x450206[_0x288a('0x24')](_0x1501fa)[_0x288a('0x25')](function(_0xd2f959){return _0xd2f959;});}return null;};}function removeEntity(_0x5ab1e4,_0xd00093){return function(_0x279f87){if(_0x279f87){return _0x279f87[_0x288a('0x26')]()[_0x288a('0x25')](function(){_0x5ab1e4[_0x288a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c1f4,_0x5421b1){return function(_0x1381b7){if(!_0x1381b7){_0x47c1f4['sendStatus'](0x194);}return _0x1381b7;};}function handleError(_0x56093b,_0x177f9f){_0x177f9f=_0x177f9f||0x1f4;return function(_0x5dc23f){logger[_0x288a('0x27')](_0x5dc23f['stack']);if(_0x5dc23f[_0x288a('0x28')]){delete _0x5dc23f[_0x288a('0x28')];}_0x56093b[_0x288a('0x1a')](_0x177f9f)['send'](_0x5dc23f);};}exports[_0x288a('0x29')]=function(_0xfa65b5,_0x34ee4a){var _0x3acc9d={},_0x501ea1={},_0x258bbf={'count':0x0,'rows':[]};var _0x3d323f=_['map'](db[_0x288a('0x2a')][_0x288a('0x2b')],function(_0x3d91fd){return{'name':_0x3d91fd[_0x288a('0x2c')],'type':_0x3d91fd[_0x288a('0x2d')]['key']};});_0x501ea1['model']=_[_0x288a('0x2e')](_0x3d323f,_0x288a('0x28'));_0x501ea1[_0x288a('0x2f')]=_[_0x288a('0x30')](_0xfa65b5[_0x288a('0x2f')]);_0x501ea1['filters']=_[_0x288a('0x31')](_0x501ea1[_0x288a('0x32')],_0x501ea1[_0x288a('0x2f')]);_0x3acc9d[_0x288a('0x33')]=_[_0x288a('0x31')](_0x501ea1[_0x288a('0x32')],qs[_0x288a('0x34')](_0xfa65b5[_0x288a('0x2f')]['fields']));_0x3acc9d[_0x288a('0x33')]=_0x3acc9d[_0x288a('0x33')][_0x288a('0x35')]?_0x3acc9d[_0x288a('0x33')]:_0x501ea1[_0x288a('0x32')];if(!_0xfa65b5[_0x288a('0x2f')][_0x288a('0x36')]('nolimit')){_0x3acc9d[_0x288a('0x1e')]=qs[_0x288a('0x1e')](_0xfa65b5[_0x288a('0x2f')][_0x288a('0x1e')]);_0x3acc9d[_0x288a('0x1c')]=qs[_0x288a('0x1c')](_0xfa65b5[_0x288a('0x2f')][_0x288a('0x1c')]);}_0x3acc9d[_0x288a('0x37')]=qs[_0x288a('0x38')](_0xfa65b5[_0x288a('0x2f')][_0x288a('0x38')]);_0x3acc9d[_0x288a('0x39')]=qs['filters'](_[_0x288a('0x3a')](_0xfa65b5[_0x288a('0x2f')],_0x501ea1['filters']),_0x3d323f);if(_0xfa65b5[_0x288a('0x2f')][_0x288a('0x3b')]){_0x3acc9d[_0x288a('0x39')]=_['merge'](_0x3acc9d[_0x288a('0x39')],{'$or':_[_0x288a('0x2e')](_0x3d323f,function(_0x3b2889){if(_0x3b2889[_0x288a('0x2d')]!==_0x288a('0x3c')){var _0x3ca24c={};_0x3ca24c[_0x3b2889['name']]={'$like':'%'+_0xfa65b5[_0x288a('0x2f')][_0x288a('0x3b')]+'%'};return _0x3ca24c;}})});}_0x3acc9d=_['merge']({},_0x3acc9d,_0xfa65b5[_0x288a('0x3d')]);var _0x49042e={'where':_0x3acc9d[_0x288a('0x39')]};return db[_0x288a('0x2a')][_0x288a('0x1f')](_0x49042e)[_0x288a('0x25')](function(_0x29ec30){_0x258bbf[_0x288a('0x1f')]=_0x29ec30;if(_0xfa65b5[_0x288a('0x2f')][_0x288a('0x3e')]){_0x3acc9d[_0x288a('0x3f')]=[{'all':!![]}];}return db[_0x288a('0x2a')][_0x288a('0x40')](_0x3acc9d);})['then'](function(_0x396c2f){_0x258bbf['rows']=_0x396c2f;return _0x258bbf;})['then'](respondWithFilteredResult(_0x34ee4a,_0x3acc9d))[_0x288a('0x41')](handleError(_0x34ee4a,null));};exports[_0x288a('0x42')]=function(_0x46fb0a,_0x33e84f){var _0x3aefc8={'raw':!![],'where':{'id':_0x46fb0a['params']['id']}},_0x485d2e={};_0x485d2e['model']=_[_0x288a('0x30')](db['VoiceTransferReport'][_0x288a('0x2b')]);_0x485d2e[_0x288a('0x2f')]=_[_0x288a('0x30')](_0x46fb0a['query']);_0x485d2e[_0x288a('0x43')]=_[_0x288a('0x31')](_0x485d2e[_0x288a('0x32')],_0x485d2e[_0x288a('0x2f')]);_0x3aefc8['attributes']=_[_0x288a('0x31')](_0x485d2e[_0x288a('0x32')],qs[_0x288a('0x34')](_0x46fb0a[_0x288a('0x2f')][_0x288a('0x34')]));_0x3aefc8[_0x288a('0x33')]=_0x3aefc8[_0x288a('0x33')][_0x288a('0x35')]?_0x3aefc8[_0x288a('0x33')]:_0x485d2e[_0x288a('0x32')];if(_0x46fb0a[_0x288a('0x2f')][_0x288a('0x3e')]){_0x3aefc8['include']=[{'all':!![]}];}_0x3aefc8=_[_0x288a('0x44')]({},_0x3aefc8,_0x46fb0a[_0x288a('0x3d')]);return db[_0x288a('0x2a')]['find'](_0x3aefc8)[_0x288a('0x25')](handleEntityNotFound(_0x33e84f,null))[_0x288a('0x25')](respondWithResult(_0x33e84f,null))[_0x288a('0x41')](handleError(_0x33e84f,null));};exports['create']=function(_0x26e361,_0x399318){return db[_0x288a('0x2a')]['create'](_0x26e361[_0x288a('0x45')],{})[_0x288a('0x25')](respondWithResult(_0x399318,0xc9))['catch'](handleError(_0x399318,null));};exports['update']=function(_0x2f4557,_0x19dd04){if(_0x2f4557[_0x288a('0x45')]['id']){delete _0x2f4557['body']['id'];}return db[_0x288a('0x2a')][_0x288a('0x46')]({'where':{'id':_0x2f4557[_0x288a('0x47')]['id']}})[_0x288a('0x25')](handleEntityNotFound(_0x19dd04,null))[_0x288a('0x25')](saveUpdates(_0x2f4557[_0x288a('0x45')],null))[_0x288a('0x25')](respondWithResult(_0x19dd04,null))[_0x288a('0x41')](handleError(_0x19dd04,null));};exports[_0x288a('0x26')]=function(_0x3813a5,_0x357689){return db[_0x288a('0x2a')]['find']({'where':{'id':_0x3813a5[_0x288a('0x47')]['id']}})[_0x288a('0x25')](handleEntityNotFound(_0x357689,null))[_0x288a('0x25')](removeEntity(_0x357689,null))[_0x288a('0x41')](handleError(_0x357689,null));};exports['describe']=function(_0x1020ba,_0x2299d3){return db[_0x288a('0x2a')][_0x288a('0x48')]()[_0x288a('0x25')](respondWithResult(_0x2299d3,null))[_0x288a('0x41')](handleError(_0x2299d3,null));}; \ No newline at end of file +var _0xc700=['set','Content-Range','apply','reject','save','destroy','then','name','status','send','index','map','VoiceTransferReport','rawAttributes','fieldName','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','model','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count'];(function(_0x3f7e37,_0x32f790){var _0x2a3ec7=function(_0x32922c){while(--_0x32922c){_0x3f7e37['push'](_0x3f7e37['shift']());}};_0x2a3ec7(++_0x32f790);}(_0xc700,0x151));var _0x0c70=function(_0x9701de,_0x1924fe){_0x9701de=_0x9701de-0x0;var _0x103183=_0xc700[_0x9701de];return _0x103183;};'use strict';var emlformat=require(_0x0c70('0x0'));var rimraf=require(_0x0c70('0x1'));var zipdir=require(_0x0c70('0x2'));var jsonpatch=require(_0x0c70('0x3'));var rp=require('request-promise');var moment=require(_0x0c70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c70('0x5'));var util=require('util');var path=require(_0x0c70('0x6'));var sox=require(_0x0c70('0x7'));var csv=require(_0x0c70('0x8'));var ejs=require(_0x0c70('0x9'));var fs=require('fs');var fs_extra=require(_0x0c70('0xa'));var _=require(_0x0c70('0xb'));var squel=require(_0x0c70('0xc'));var crypto=require(_0x0c70('0xd'));var jsforce=require(_0x0c70('0xe'));var deskjs=require(_0x0c70('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0c70('0x10'));var Papa=require(_0x0c70('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c70('0x12'));var as=require(_0x0c70('0x13'));var hardwareService=require(_0x0c70('0x14'));var logger=require(_0x0c70('0x15'))(_0x0c70('0x16'));var utils=require(_0x0c70('0x17'));var config=require(_0x0c70('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c70('0x19'))['db'];function respondWithStatusCode(_0x96681c,_0x267c02){_0x267c02=_0x267c02||0xcc;return function(_0x242e7b){if(_0x242e7b){return _0x96681c[_0x0c70('0x1a')](_0x267c02);}return _0x96681c['status'](_0x267c02)[_0x0c70('0x1b')]();};}function respondWithResult(_0x583f25,_0x49e36b){_0x49e36b=_0x49e36b||0xc8;return function(_0x4852e2){if(_0x4852e2){return _0x583f25['status'](_0x49e36b)[_0x0c70('0x1c')](_0x4852e2);}};}function respondWithFilteredResult(_0x10b9a5,_0x53997b){return function(_0x356594){if(_0x356594){var _0x137e13=typeof _0x53997b[_0x0c70('0x1d')]===_0x0c70('0x1e')&&typeof _0x53997b[_0x0c70('0x1f')]===_0x0c70('0x1e');var _0x26e0c8=_0x356594['count'];var _0x34da4a=_0x137e13?0x0:_0x53997b[_0x0c70('0x1d')];var _0xfa6a72=_0x137e13?_0x356594[_0x0c70('0x20')]:_0x53997b['offset']+_0x53997b[_0x0c70('0x1f')];var _0x9b741a;if(_0xfa6a72>=_0x26e0c8){_0xfa6a72=_0x26e0c8;_0x9b741a=0xc8;}else{_0x9b741a=0xce;}_0x10b9a5['status'](_0x9b741a);return _0x10b9a5[_0x0c70('0x21')](_0x0c70('0x22'),_0x34da4a+'-'+_0xfa6a72+'/'+_0x26e0c8)[_0x0c70('0x1c')](_0x356594);}return null;};}function patchUpdates(_0x3f1b65){return function(_0x741ff9){try{jsonpatch[_0x0c70('0x23')](_0x741ff9,_0x3f1b65,!![]);}catch(_0x427ddd){return BPromise[_0x0c70('0x24')](_0x427ddd);}return _0x741ff9[_0x0c70('0x25')]();};}function saveUpdates(_0x5c6df9,_0x43dc42){return function(_0x35b64c){if(_0x35b64c){return _0x35b64c['update'](_0x5c6df9)['then'](function(_0x24c9e1){return _0x24c9e1;});}return null;};}function removeEntity(_0x56fdfe,_0xf844ea){return function(_0x5aa738){if(_0x5aa738){return _0x5aa738[_0x0c70('0x26')]()[_0x0c70('0x27')](function(){_0x56fdfe['status'](0xcc)[_0x0c70('0x1b')]();});}};}function handleEntityNotFound(_0x2f60ab,_0x98bd9){return function(_0xeb3ec6){if(!_0xeb3ec6){_0x2f60ab[_0x0c70('0x1a')](0x194);}return _0xeb3ec6;};}function handleError(_0x482d90,_0x23adc6){_0x23adc6=_0x23adc6||0x1f4;return function(_0x2f7f68){logger['error'](_0x2f7f68['stack']);if(_0x2f7f68[_0x0c70('0x28')]){delete _0x2f7f68[_0x0c70('0x28')];}_0x482d90[_0x0c70('0x29')](_0x23adc6)[_0x0c70('0x2a')](_0x2f7f68);};}exports[_0x0c70('0x2b')]=function(_0x5c4e77,_0x253716){var _0x228ec3={},_0x577588={},_0x3f69b4={'count':0x0,'rows':[]};var _0x4e3fd9=_[_0x0c70('0x2c')](db[_0x0c70('0x2d')][_0x0c70('0x2e')],function(_0x4416e0){return{'name':_0x4416e0[_0x0c70('0x2f')],'type':_0x4416e0['type']['key']};});_0x577588['model']=_[_0x0c70('0x2c')](_0x4e3fd9,_0x0c70('0x28'));_0x577588['query']=_[_0x0c70('0x30')](_0x5c4e77['query']);_0x577588[_0x0c70('0x31')]=_[_0x0c70('0x32')](_0x577588['model'],_0x577588[_0x0c70('0x33')]);_0x228ec3[_0x0c70('0x34')]=_[_0x0c70('0x32')](_0x577588['model'],qs[_0x0c70('0x35')](_0x5c4e77[_0x0c70('0x33')]['fields']));_0x228ec3[_0x0c70('0x34')]=_0x228ec3['attributes'][_0x0c70('0x36')]?_0x228ec3[_0x0c70('0x34')]:_0x577588['model'];if(!_0x5c4e77[_0x0c70('0x33')][_0x0c70('0x37')](_0x0c70('0x38'))){_0x228ec3[_0x0c70('0x1f')]=qs['limit'](_0x5c4e77[_0x0c70('0x33')][_0x0c70('0x1f')]);_0x228ec3[_0x0c70('0x1d')]=qs[_0x0c70('0x1d')](_0x5c4e77['query'][_0x0c70('0x1d')]);}_0x228ec3['order']=qs['sort'](_0x5c4e77[_0x0c70('0x33')][_0x0c70('0x39')]);_0x228ec3[_0x0c70('0x3a')]=qs[_0x0c70('0x31')](_['pick'](_0x5c4e77['query'],_0x577588[_0x0c70('0x31')]),_0x4e3fd9);if(_0x5c4e77[_0x0c70('0x33')]['filter']){_0x228ec3[_0x0c70('0x3a')]=_[_0x0c70('0x3b')](_0x228ec3[_0x0c70('0x3a')],{'$or':_[_0x0c70('0x2c')](_0x4e3fd9,function(_0x2bd28e){if(_0x2bd28e['type']!=='VIRTUAL'){var _0x4efebd={};_0x4efebd[_0x2bd28e[_0x0c70('0x28')]]={'$like':'%'+_0x5c4e77[_0x0c70('0x33')][_0x0c70('0x3c')]+'%'};return _0x4efebd;}})});}_0x228ec3=_[_0x0c70('0x3b')]({},_0x228ec3,_0x5c4e77[_0x0c70('0x3d')]);var _0x38809d={'where':_0x228ec3[_0x0c70('0x3a')]};return db['VoiceTransferReport'][_0x0c70('0x20')](_0x38809d)[_0x0c70('0x27')](function(_0x3e46b4){_0x3f69b4[_0x0c70('0x20')]=_0x3e46b4;if(_0x5c4e77['query'][_0x0c70('0x3e')]){_0x228ec3[_0x0c70('0x3f')]=[{'all':!![]}];}return db[_0x0c70('0x2d')][_0x0c70('0x40')](_0x228ec3);})['then'](function(_0x100777){_0x3f69b4['rows']=_0x100777;return _0x3f69b4;})[_0x0c70('0x27')](respondWithFilteredResult(_0x253716,_0x228ec3))[_0x0c70('0x41')](handleError(_0x253716,null));};exports[_0x0c70('0x42')]=function(_0x51bfe6,_0xf5b1ab){var _0x16e907={'raw':!![],'where':{'id':_0x51bfe6[_0x0c70('0x43')]['id']}},_0x1bc620={};_0x1bc620[_0x0c70('0x44')]=_[_0x0c70('0x30')](db[_0x0c70('0x2d')][_0x0c70('0x2e')]);_0x1bc620['query']=_['keys'](_0x51bfe6['query']);_0x1bc620[_0x0c70('0x31')]=_['intersection'](_0x1bc620[_0x0c70('0x44')],_0x1bc620[_0x0c70('0x33')]);_0x16e907[_0x0c70('0x34')]=_[_0x0c70('0x32')](_0x1bc620[_0x0c70('0x44')],qs[_0x0c70('0x35')](_0x51bfe6['query'][_0x0c70('0x35')]));_0x16e907[_0x0c70('0x34')]=_0x16e907['attributes']['length']?_0x16e907[_0x0c70('0x34')]:_0x1bc620[_0x0c70('0x44')];if(_0x51bfe6[_0x0c70('0x33')][_0x0c70('0x3e')]){_0x16e907[_0x0c70('0x3f')]=[{'all':!![]}];}_0x16e907=_[_0x0c70('0x3b')]({},_0x16e907,_0x51bfe6['options']);return db[_0x0c70('0x2d')][_0x0c70('0x45')](_0x16e907)[_0x0c70('0x27')](handleEntityNotFound(_0xf5b1ab,null))['then'](respondWithResult(_0xf5b1ab,null))[_0x0c70('0x41')](handleError(_0xf5b1ab,null));};exports[_0x0c70('0x46')]=function(_0x3963ce,_0x12b0ea){return db[_0x0c70('0x2d')][_0x0c70('0x46')](_0x3963ce[_0x0c70('0x47')],{})[_0x0c70('0x27')](respondWithResult(_0x12b0ea,0xc9))[_0x0c70('0x41')](handleError(_0x12b0ea,null));};exports[_0x0c70('0x48')]=function(_0x4f8619,_0x16026f){if(_0x4f8619[_0x0c70('0x47')]['id']){delete _0x4f8619[_0x0c70('0x47')]['id'];}return db[_0x0c70('0x2d')][_0x0c70('0x45')]({'where':{'id':_0x4f8619[_0x0c70('0x43')]['id']}})[_0x0c70('0x27')](handleEntityNotFound(_0x16026f,null))[_0x0c70('0x27')](saveUpdates(_0x4f8619['body'],null))[_0x0c70('0x27')](respondWithResult(_0x16026f,null))['catch'](handleError(_0x16026f,null));};exports[_0x0c70('0x26')]=function(_0x51b22c,_0x4f5773){return db['VoiceTransferReport']['find']({'where':{'id':_0x51b22c[_0x0c70('0x43')]['id']}})[_0x0c70('0x27')](handleEntityNotFound(_0x4f5773,null))[_0x0c70('0x27')](removeEntity(_0x4f5773,null))[_0x0c70('0x41')](handleError(_0x4f5773,null));};exports[_0x0c70('0x49')]=function(_0x1e3c61,_0x371b19){return db[_0x0c70('0x2d')][_0x0c70('0x49')]()[_0x0c70('0x27')](respondWithResult(_0x371b19,null))[_0x0c70('0x41')](handleError(_0x371b19,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2f9daf1..31d6634 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 _0x9e25=['./voiceTransferReport.attributes','report_call_transfer','api','bluebird','path','rimraf','../../config/environment'];(function(_0x29c63d,_0x268654){var _0x4c68df=function(_0x25b5c4){while(--_0x25b5c4){_0x29c63d['push'](_0x29c63d['shift']());}};_0x4c68df(++_0x268654);}(_0x9e25,0x1ad));var _0x59e2=function(_0x47d7bb,_0x42ba1d){_0x47d7bb=_0x47d7bb-0x0;var _0x73e56b=_0x9e25[_0x47d7bb];return _0x73e56b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x59e2('0x0'));var moment=require('moment');var BPromise=require(_0x59e2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59e2('0x2'));var rimraf=require(_0x59e2('0x3'));var config=require(_0x59e2('0x4'));var attributes=require(_0x59e2('0x5'));module['exports']=function(_0x7f105e,_0x1a3309){return _0x7f105e['define']('VoiceTransferReport',attributes,{'tableName':_0x59e2('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x781f=['./voiceTransferReport.attributes','exports','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x781f,0x6a));var _0xf781=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x781f[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf781('0x2'));var BPromise=require(_0xf781('0x3'));var rp=require(_0xf781('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf781('0x5'));var config=require('../../config/environment');var attributes=require(_0xf781('0x6'));module[_0xf781('0x7')]=function(_0x57521e,_0x446995){return _0x57521e['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 9d6c4ba..59ee9ee 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 _0x0b8e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','moment','bluebird','randomstring'];(function(_0xd41570,_0x3faf3c){var _0x5b7300=function(_0x201a11){while(--_0x201a11){_0xd41570['push'](_0xd41570['shift']());}};_0x5b7300(++_0x3faf3c);}(_0x0b8e,0x14d));var _0xe0b8=function(_0x18073a,_0x1f92c0){_0x18073a=_0x18073a-0x0;var _0x340fd8=_0x0b8e[_0x18073a];return _0x340fd8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0b8('0x0'));var BPromise=require(_0xe0b8('0x1'));var rs=require(_0xe0b8('0x2'));var fs=require('fs');var Redis=require(_0xe0b8('0x3'));var db=require(_0xe0b8('0x4'))['db'];var utils=require(_0xe0b8('0x5'));var logger=require(_0xe0b8('0x6'))('rpc');var config=require(_0xe0b8('0x7'));var jayson=require(_0xe0b8('0x8'));var client=jayson[_0xe0b8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c318,_0x441d9e,_0x9da37e){return new BPromise(function(_0x917269,_0x51b796){return client[_0xe0b8('0xa')](_0x54c318,_0x9da37e)[_0xe0b8('0xb')](function(_0x44f29c){logger['info'](_0xe0b8('0xc'),_0x441d9e,_0xe0b8('0xd'));logger[_0xe0b8('0xe')](_0xe0b8('0xf'),_0x441d9e,_0xe0b8('0xd'),JSON[_0xe0b8('0x10')](_0x44f29c));if(_0x44f29c['error']){if(_0x44f29c['error'][_0xe0b8('0x11')]===0x1f4){logger[_0xe0b8('0x12')](_0xe0b8('0xc'),_0x441d9e,_0x44f29c[_0xe0b8('0x12')][_0xe0b8('0x13')]);return _0x51b796(_0x44f29c[_0xe0b8('0x12')]['message']);}logger[_0xe0b8('0x12')](_0xe0b8('0xc'),_0x441d9e,_0x44f29c[_0xe0b8('0x12')]['message']);return _0x917269(_0x44f29c[_0xe0b8('0x12')]['message']);}else{logger['info'](_0xe0b8('0xc'),_0x441d9e,'request\x20sent');_0x917269(_0x44f29c[_0xe0b8('0x14')][_0xe0b8('0x13')]);}})[_0xe0b8('0x15')](function(_0x36a35a){logger[_0xe0b8('0x12')](_0xe0b8('0xc'),_0x441d9e,_0x36a35a);_0x51b796(_0x36a35a);});});}exports[_0xe0b8('0x16')]=function(_0x89c8a3){var _0x9ba75b=this;return new Promise(function(_0x439ea5,_0x11b2ae){return db[_0xe0b8('0x17')][_0xe0b8('0x18')](_0x89c8a3[_0xe0b8('0x19')],{'raw':_0x89c8a3[_0xe0b8('0x1a')]?_0x89c8a3[_0xe0b8('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x143887){logger[_0xe0b8('0x1b')]('CreateVoiceTransferReport',_0x89c8a3);logger[_0xe0b8('0xe')](_0xe0b8('0x16'),_0x89c8a3,JSON[_0xe0b8('0x10')](_0x143887));_0x439ea5(_0x143887);})[_0xe0b8('0x15')](function(_0x4396a6){logger['error'](_0xe0b8('0x16'),_0x4396a6['message'],_0x89c8a3);_0x11b2ae(_0x9ba75b[_0xe0b8('0x12')](0x1f4,_0x4396a6[_0xe0b8('0x13')]));});});}; \ No newline at end of file +var _0x466d=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','catch','lodash','moment','bluebird','randomstring'];(function(_0x524a25,_0x522d35){var _0x1ed046=function(_0xc6e06f){while(--_0xc6e06f){_0x524a25['push'](_0x524a25['shift']());}};_0x1ed046(++_0x522d35);}(_0x466d,0x191));var _0xd466=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x466d[_0xdd827a];return _0x2f46f1;};'use strict';var _=require(_0xd466('0x0'));var util=require('util');var moment=require(_0xd466('0x1'));var BPromise=require(_0xd466('0x2'));var rs=require(_0xd466('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd466('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd466('0x5'))(_0xd466('0x6'));var config=require(_0xd466('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd466('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53c6fa,_0x2dc142,_0x176ed7){return new BPromise(function(_0x50eb6d,_0x3180c0){return client[_0xd466('0x9')](_0x53c6fa,_0x176ed7)[_0xd466('0xa')](function(_0x2a7c21){logger['info'](_0xd466('0xb'),_0x2dc142,'request\x20sent');logger[_0xd466('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2dc142,_0xd466('0xd'),JSON['stringify'](_0x2a7c21));if(_0x2a7c21[_0xd466('0xe')]){if(_0x2a7c21[_0xd466('0xe')][_0xd466('0xf')]===0x1f4){logger[_0xd466('0xe')](_0xd466('0xb'),_0x2dc142,_0x2a7c21[_0xd466('0xe')]['message']);return _0x3180c0(_0x2a7c21[_0xd466('0xe')]['message']);}logger[_0xd466('0xe')](_0xd466('0xb'),_0x2dc142,_0x2a7c21[_0xd466('0xe')][_0xd466('0x10')]);return _0x50eb6d(_0x2a7c21['error'][_0xd466('0x10')]);}else{logger[_0xd466('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2dc142,_0xd466('0xd'));_0x50eb6d(_0x2a7c21[_0xd466('0x12')][_0xd466('0x10')]);}})['catch'](function(_0xc6b730){logger[_0xd466('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x2dc142,_0xc6b730);_0x3180c0(_0xc6b730);});});}exports[_0xd466('0x13')]=function(_0x272e5d){var _0x57e956=this;return new Promise(function(_0xa452dc,_0x3371a0){return db[_0xd466('0x14')][_0xd466('0x15')](_0x272e5d[_0xd466('0x16')],{'raw':_0x272e5d[_0xd466('0x17')]?_0x272e5d[_0xd466('0x17')][_0xd466('0x18')]===undefined?!![]:![]:!![]})[_0xd466('0xa')](function(_0x1d88d1){logger[_0xd466('0x11')]('CreateVoiceTransferReport',_0x272e5d);logger[_0xd466('0xc')]('CreateVoiceTransferReport',_0x272e5d,JSON[_0xd466('0x19')](_0x1d88d1));_0xa452dc(_0x1d88d1);})[_0xd466('0x1a')](function(_0x4e13f8){logger[_0xd466('0xe')](_0xd466('0x13'),_0x4e13f8[_0xd466('0x10')],_0x272e5d);_0x3371a0(_0x57e956[_0xd466('0xe')](0x1f4,_0x4e13f8['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 973d241..5536c2e 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 _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x13e74a,_0x4519f0){var _0x407a97=function(_0x2b5012){while(--_0x2b5012){_0x13e74a['push'](_0x13e74a['shift']());}};_0x407a97(++_0x4519f0);}(_0xaa88,0x137));var _0x8aa8=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xaa88[_0xac151d];return _0x111dba;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 02a774d..c847201 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 _0xf3cd=['webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','json'];(function(_0x3a7257,_0x30b139){var _0x467d25=function(_0x25f9d1){while(--_0x25f9d1){_0x3a7257['push'](_0x3a7257['shift']());}};_0x467d25(++_0x30b139);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xf3cd[_0x218994];return _0x3f350b;};'use strict';var path=require(_0xdf3c('0x0'));var fs=require('fs');var _=require(_0xdf3c('0x1'));var db=require(_0xdf3c('0x2'))['db'];var config=require(_0xdf3c('0x3'));var util=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdf3c('0x6')][_0xdf3c('0x7')]({'port':0x232a});var logger=require(_0xdf3c('0x8'))('webbarapi');var Redis=require(_0xdf3c('0x9'));config[_0xdf3c('0xa')]=_[_0xdf3c('0xb')](config[_0xdf3c('0xa')],{'host':_0xdf3c('0xc'),'port':0x18eb});var io=require(_0xdf3c('0xd'))(new Redis(config['redis']));var Schema=require(_0xdf3c('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdf3c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x13')]},'transferNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});function emit(_0x1a7a5a,_0x305ea5,_0x92008b){logger[_0xdf3c('0x15')](_0x1a7a5a,_0x305ea5,JSON[_0xdf3c('0x16')](_0x92008b));io['to'](_0x1a7a5a)['emit'](_0x305ea5,_0x92008b);}function handleError(_0x13b0e6){return function(_0x465e7d){console[_0xdf3c('0x17')](_0xdf3c('0x18'),_0x465e7d,_0x465e7d instanceof RangeError);logger[_0xdf3c('0x19')](_0x465e7d[_0xdf3c('0x1a')]);if(_0x465e7d instanceof RangeError){if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x194)[_0xdf3c('0x1d')](_0x465e7d);}else{if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x1f4)['send'](_0x465e7d);}};}function checkError(){return function(_0x4d620f){if(!_0x4d620f){throw new RangeError(_0xdf3c('0x1e'));}return _0x4d620f;};}function respondWithRpcPromise(_0x583ce4,_0x15776c){return new BPromise(function(_0x40e7ec,_0x36552e){var _0x38b319=amiClient;return _0x38b319[_0xdf3c('0x1f')](_0x583ce4,_0x15776c)[_0xdf3c('0x20')](function(_0x50d8ca){if(_0x50d8ca[_0xdf3c('0x19')]){if(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x21')]===0x1f4){return _0x36552e(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}return _0x40e7ec(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}else{_0x40e7ec(_0x50d8ca[_0xdf3c('0x23')]);}})[_0xdf3c('0x24')](function(_0x1adee4){_0x36552e(_0x1adee4);});});}function getAgent(_0x4c076c){return db[_0xdf3c('0x25')][_0xdf3c('0x26')]({'where':{'id':_0x4c076c,'role':'agent'}})[_0xdf3c('0x20')](checkError());}function getAgentCheckSession(_0x59659e,_0x4eaced){return new BPromise(function(_0x508be9,_0x14aac9){var _0x186bba=respondWithRpcPromise('VoiceChannels');var _0x5c3b5a=getAgent(_0x59659e);Promise[_0xdf3c('0x27')]([_0x186bba,_0x5c3b5a])[_0xdf3c('0x20')](function(_0xd3cfcb){var _0x1ccdd4=_0xd3cfcb[0x0];var _0x5c98a2=_0xd3cfcb[0x1];var _0x43ce06=_[_0xdf3c('0x28')](_0x1ccdd4['rows'],function(_0x51e0a4){return _0x51e0a4[_0xdf3c('0x29')]==_0x5c98a2['id']&&_0x51e0a4[_0xdf3c('0x2a')]==_0x4eaced;});if(_0x43ce06[_0xdf3c('0x2b')]==0x1){_0x508be9(_0x5c98a2);}else{_0x14aac9(new RangeError('sessionId\x20'+_0x4eaced+_0xdf3c('0x2c')));}});});}exports[_0xdf3c('0x2d')]=function(_0x21e7b8,_0x10099e){logger['info'](_0xdf3c('0x2e'),_0x21e7b8[_0xdf3c('0x2f')]);var _0x522e5f=originateValidation[_0xdf3c('0xe')](_0x21e7b8[_0xdf3c('0x2f')]);if(_0x522e5f[_0xdf3c('0x2b')]>0x0){return _0x10099e[_0xdf3c('0x1c')](0x190)['json'](_0x522e5f);}var _0x33632f=_0x21e7b8[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3b9ce8=_0x21e7b8['body'][_0xdf3c('0x31')];var _0x3e7a4b=_0x21e7b8['body']['callerId'];var _0x12cc19=_0x21e7b8['body'][_0xdf3c('0x32')];return getAgent(_0x33632f)['then'](function(_0x57faba){logger['info'](_0xdf3c('0x33'),_0x57faba[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x57faba['name']),'webbar:originate',{'callNumber':_0x3b9ce8,'callerId':_0x3e7a4b,'callbackUrl':_0x12cc19});return _0x10099e[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':_0xdf3c('0x36')});})[_0xdf3c('0x24')](handleError(_0x10099e));};exports[_0xdf3c('0x37')]=function(_0xcdd731,_0x1004e9){logger[_0xdf3c('0x15')](_0xdf3c('0x38'),_0xcdd731[_0xdf3c('0x2f')]);var _0x398c76=hangupValidation['validate'](_0xcdd731[_0xdf3c('0x2f')]);if(_0x398c76['length']>0x0){return _0x1004e9['status'](0x190)[_0xdf3c('0x39')](_0x398c76);}var _0x47f760=_0xcdd731[_0xdf3c('0x2f')]['userId'];var _0x2a94c3=_0xcdd731[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x47f760)[_0xdf3c('0x20')](function(_0x3098cb){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x3098cb[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x3098cb[_0xdf3c('0x1b')]),_0xdf3c('0x3a'),{'sessionId':_0x2a94c3});return _0x1004e9['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3b')});})['catch'](handleError(_0x1004e9));};exports[_0xdf3c('0x3c')]=function(_0x14d8e1,_0x46194d){logger[_0xdf3c('0x15')]('answer\x20fired:',_0x14d8e1['body']);var _0x335c1b=answerValidation[_0xdf3c('0xe')](_0x14d8e1[_0xdf3c('0x2f')]);if(_0x335c1b['length']>0x0){return _0x46194d[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x335c1b);}var _0x6fc3b6=_0x14d8e1[_0xdf3c('0x2f')]['userId'];var _0x127685=_0x14d8e1[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x6fc3b6)[_0xdf3c('0x20')](function(_0x2f52c5){logger['info'](_0xdf3c('0x33'),_0x2f52c5[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x2f52c5[_0xdf3c('0x1b')]),_0xdf3c('0x3d'),{'sessionId':_0x127685});return _0x46194d['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3e')});})[_0xdf3c('0x24')](handleError(_0x46194d));};exports['hold']=function(_0x5c9885,_0x269723){logger[_0xdf3c('0x15')](_0xdf3c('0x3f'),_0x5c9885[_0xdf3c('0x2f')]);var _0xaae4bc=holdValidation[_0xdf3c('0xe')](_0x5c9885[_0xdf3c('0x2f')]);if(_0xaae4bc[_0xdf3c('0x2b')]>0x0){return _0x269723[_0xdf3c('0x1c')](0x190)['json'](_0xaae4bc);}var _0x129c2a=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0xe760dd=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x129c2a)[_0xdf3c('0x20')](function(_0x553f70){logger[_0xdf3c('0x15')]('entityFound:',_0x553f70[_0xdf3c('0x1b')]);emit(util['format'](_0xdf3c('0x35'),_0x553f70[_0xdf3c('0x1b')]),_0xdf3c('0x40'),{'sessionId':_0xe760dd});return _0x269723[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x269723));};exports[_0xdf3c('0x41')]=function(_0x5f5726,_0x31c600){logger[_0xdf3c('0x15')](_0xdf3c('0x42'),_0x5f5726[_0xdf3c('0x2f')]);var _0x3b17d9=unholdValidation['validate'](_0x5f5726['body']);if(_0x3b17d9[_0xdf3c('0x2b')]>0x0){return _0x31c600[_0xdf3c('0x1c')](0x190)['json'](_0x3b17d9);}var _0x3b215d=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3fda0a=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x3b215d)[_0xdf3c('0x20')](function(_0x492396){logger['info'](_0xdf3c('0x33'),_0x492396[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x492396[_0xdf3c('0x1b')]),_0xdf3c('0x43'),{'sessionId':_0x3fda0a});return _0x31c600[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x44')});})[_0xdf3c('0x24')](handleError(_0x31c600));};exports[_0xdf3c('0x45')]=function(_0x4cb28f,_0x1eebcf){logger['info']('calls\x20fired:',_0x1eebcf['body']);var _0x58fcbf=callsValidation['validate'](_0x4cb28f[_0xdf3c('0x2f')]);if(_0x58fcbf[_0xdf3c('0x2b')]>0x0){return _0x1eebcf['status'](0x190)[_0xdf3c('0x39')](_0x58fcbf);}var _0x32427e=_0x4cb28f['body'][_0xdf3c('0x30')];var _0x28f935=respondWithRpcPromise(_0xdf3c('0x46'));var _0x1389e0=getAgent(_0x32427e);return Promise[_0xdf3c('0x27')]([_0x28f935,_0x1389e0])[_0xdf3c('0x20')](function(_0xb54629){var _0xdc859=_0xb54629[0x0];var _0x42efa2=_0xb54629[0x1];var _0xa05518=_[_0xdf3c('0x28')](_0xdc859['rows'],function(_0x1ed898){return _0x1ed898[_0xdf3c('0x29')]==_0x42efa2['id'];});return _0x1eebcf[_0xdf3c('0x1c')](0xc8)['json']({'count':_0xa05518[_0xdf3c('0x2b')],'rows':_0xa05518});})[_0xdf3c('0x24')](handleError(_0x1eebcf));};exports[_0xdf3c('0x47')]=function(_0x552264,_0x1effdb){logger[_0xdf3c('0x15')]('conference\x20fired:',_0x552264[_0xdf3c('0x2f')]);var _0x4f8fd6=conferenceValidation[_0xdf3c('0xe')](_0x552264[_0xdf3c('0x2f')]);if(_0x4f8fd6[_0xdf3c('0x2b')]>0x0){return _0x1effdb[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x4f8fd6);}var _0x30e6e1=_0x552264[_0xdf3c('0x2f')][_0xdf3c('0x30')];return getAgent(_0x30e6e1)[_0xdf3c('0x20')](function(_0x330730){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x330730[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x330730[_0xdf3c('0x1b')]),_0xdf3c('0x48'));return _0x1effdb['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x49')});})[_0xdf3c('0x24')](handleError(_0x1effdb));};exports[_0xdf3c('0x4a')]=function(_0x596282,_0x164e0a){logger['info']('transfer\x20fired:',_0x596282[_0xdf3c('0x2f')]);var _0x399db6=transferValidation[_0xdf3c('0xe')](_0x596282[_0xdf3c('0x2f')]);if(_0x399db6[_0xdf3c('0x2b')]>0x0){return _0x164e0a[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x399db6);}var _0x3ec03a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x1cce9a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x2a')];var _0x4be79a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x4b')];return getAgent(_0x3ec03a)[_0xdf3c('0x20')](function(_0x16d6ea){logger[_0xdf3c('0x15')]('entityFound:',_0x16d6ea[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x16d6ea[_0xdf3c('0x1b')]),_0xdf3c('0x4c'),{'sessionId':_0x1cce9a,'transferNumber':_0x4be79a});return _0x164e0a[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x4d')});})[_0xdf3c('0x24')](handleError(_0x164e0a));}; \ No newline at end of file +var _0x0c6d=['catch','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','then','error','message','result','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','sessionId\x20','originate','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x3e1643,_0x3ba01){_0x3e1643=_0x3e1643-0x0;var _0x4789e7=_0x0c6d[_0x3e1643];return _0x4789e7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xd0c6('0x0'));var db=require(_0xd0c6('0x1'))['db'];var config=require(_0xd0c6('0x2'));var util=require(_0xd0c6('0x3'));var BPromise=require(_0xd0c6('0x4'));var jayson=require(_0xd0c6('0x5'));var amiClient=jayson['client'][_0xd0c6('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0xd0c6('0x7')]=_[_0xd0c6('0x8')](config[_0xd0c6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd0c6('0x9'))(new Redis(config['redis']));var Schema=require(_0xd0c6('0xa'));var originateValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]},'callNumber':{'type':_0xd0c6('0xd'),'required':[!![],_0xd0c6('0xe')]},'callerId':{'type':_0xd0c6('0xd')},'callbackUrl':{'type':_0xd0c6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]},'sessionId':{'type':_0xd0c6('0xd'),'required':[!![],_0xd0c6('0xf')]},'transferNumber':{'type':_0xd0c6('0xd'),'required':[!![],_0xd0c6('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]},'sessionId':{'type':_0xd0c6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]},'sessionId':{'type':_0xd0c6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd0c6('0xb'),'required':[!![],_0xd0c6('0xc')]}});function emit(_0x1e45b3,_0x429727,_0x4e2fc7){logger[_0xd0c6('0x11')](_0x1e45b3,_0x429727,JSON[_0xd0c6('0x12')](_0x4e2fc7));io['to'](_0x1e45b3)[_0xd0c6('0x13')](_0x429727,_0x4e2fc7);}function handleError(_0x3d395a){return function(_0x941021){console[_0xd0c6('0x14')]('handleError:',_0x941021,_0x941021 instanceof RangeError);logger['error'](_0x941021[_0xd0c6('0x15')]);if(_0x941021 instanceof RangeError){if(_0x941021[_0xd0c6('0x16')]){delete _0x941021['name'];}_0x3d395a['status'](0x194)['send'](_0x941021);}else{if(_0x941021[_0xd0c6('0x16')]){delete _0x941021[_0xd0c6('0x16')];}_0x3d395a[_0xd0c6('0x17')](0x1f4)[_0xd0c6('0x18')](_0x941021);}};}function checkError(){return function(_0x1efae9){if(!_0x1efae9){throw new RangeError(_0xd0c6('0x19'));}return _0x1efae9;};}function respondWithRpcPromise(_0x2a8b29,_0x296347){return new BPromise(function(_0x5f191a,_0x2f7559){var _0x1e8384=amiClient;return _0x1e8384['request'](_0x2a8b29,_0x296347)[_0xd0c6('0x1a')](function(_0x2251e0){if(_0x2251e0[_0xd0c6('0x1b')]){if(_0x2251e0['error']['code']===0x1f4){return _0x2f7559(_0x2251e0[_0xd0c6('0x1b')][_0xd0c6('0x1c')]);}return _0x5f191a(_0x2251e0['error'][_0xd0c6('0x1c')]);}else{_0x5f191a(_0x2251e0[_0xd0c6('0x1d')]);}})['catch'](function(_0x6d77cb){_0x2f7559(_0x6d77cb);});});}function getAgent(_0x5c71b6){return db['User'][_0xd0c6('0x1e')]({'where':{'id':_0x5c71b6,'role':_0xd0c6('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x414124,_0x4368fa){return new BPromise(function(_0x3802af,_0x38d411){var _0x456fcb=respondWithRpcPromise(_0xd0c6('0x20'));var _0x1ed9a9=getAgent(_0x414124);Promise['all']([_0x456fcb,_0x1ed9a9])[_0xd0c6('0x1a')](function(_0xe5ae58){var _0x42587e=_0xe5ae58[0x0];var _0x231418=_0xe5ae58[0x1];var _0x18b747=_[_0xd0c6('0x21')](_0x42587e[_0xd0c6('0x22')],function(_0x14fcaa){return _0x14fcaa[_0xd0c6('0x23')]==_0x231418['id']&&_0x14fcaa[_0xd0c6('0x24')]==_0x4368fa;});if(_0x18b747['length']==0x1){_0x3802af(_0x231418);}else{_0x38d411(new RangeError(_0xd0c6('0x25')+_0x4368fa+'\x20not\x20found!'));}});});}exports[_0xd0c6('0x26')]=function(_0x9bfeea,_0x3779a7){logger[_0xd0c6('0x11')]('originate\x20fired:',_0x9bfeea['body']);var _0xc6a4b6=originateValidation['validate'](_0x9bfeea[_0xd0c6('0x27')]);if(_0xc6a4b6[_0xd0c6('0x28')]>0x0){return _0x3779a7[_0xd0c6('0x17')](0x190)[_0xd0c6('0x29')](_0xc6a4b6);}var _0x51d40a=_0x9bfeea[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0x1860c9=_0x9bfeea[_0xd0c6('0x27')][_0xd0c6('0x2b')];var _0x5a92f2=_0x9bfeea[_0xd0c6('0x27')][_0xd0c6('0x2c')];var _0x54ca4f=_0x9bfeea[_0xd0c6('0x27')][_0xd0c6('0x2d')];return getAgent(_0x51d40a)[_0xd0c6('0x1a')](function(_0x3840c3){logger['info'](_0xd0c6('0x2e'),_0x3840c3[_0xd0c6('0x16')]);emit(util['format']('user:%s',_0x3840c3['name']),_0xd0c6('0x2f'),{'callNumber':_0x1860c9,'callerId':_0x5a92f2,'callbackUrl':_0x54ca4f});return _0x3779a7['status'](0xc8)[_0xd0c6('0x29')]({'error':![],'message':_0xd0c6('0x30')});})[_0xd0c6('0x31')](handleError(_0x3779a7));};exports[_0xd0c6('0x32')]=function(_0x3d9907,_0x359233){logger[_0xd0c6('0x11')](_0xd0c6('0x33'),_0x3d9907[_0xd0c6('0x27')]);var _0x561b24=hangupValidation[_0xd0c6('0xa')](_0x3d9907[_0xd0c6('0x27')]);if(_0x561b24[_0xd0c6('0x28')]>0x0){return _0x359233[_0xd0c6('0x17')](0x190)['json'](_0x561b24);}var _0x1ea3f5=_0x3d9907['body'][_0xd0c6('0x2a')];var _0x29811f=_0x3d9907['body']['sessionId'];return getAgent(_0x1ea3f5)['then'](function(_0x410cce){logger[_0xd0c6('0x11')](_0xd0c6('0x2e'),_0x410cce[_0xd0c6('0x16')]);emit(util['format'](_0xd0c6('0x34'),_0x410cce[_0xd0c6('0x16')]),_0xd0c6('0x35'),{'sessionId':_0x29811f});return _0x359233[_0xd0c6('0x17')](0xc8)['json']({'error':![],'message':_0xd0c6('0x36')});})['catch'](handleError(_0x359233));};exports[_0xd0c6('0x37')]=function(_0x3b5966,_0x36fb44){logger[_0xd0c6('0x11')](_0xd0c6('0x38'),_0x3b5966[_0xd0c6('0x27')]);var _0x4a033a=answerValidation['validate'](_0x3b5966[_0xd0c6('0x27')]);if(_0x4a033a[_0xd0c6('0x28')]>0x0){return _0x36fb44[_0xd0c6('0x17')](0x190)['json'](_0x4a033a);}var _0x41b441=_0x3b5966[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0x49009a=_0x3b5966[_0xd0c6('0x27')][_0xd0c6('0x24')];return getAgent(_0x41b441)[_0xd0c6('0x1a')](function(_0x19f848){logger['info'](_0xd0c6('0x2e'),_0x19f848['name']);emit(util[_0xd0c6('0x39')]('user:%s',_0x19f848[_0xd0c6('0x16')]),_0xd0c6('0x3a'),{'sessionId':_0x49009a});return _0x36fb44['status'](0xc8)[_0xd0c6('0x29')]({'error':![],'message':_0xd0c6('0x3b')});})['catch'](handleError(_0x36fb44));};exports[_0xd0c6('0x3c')]=function(_0x3c3859,_0x304712){logger[_0xd0c6('0x11')]('hold\x20fired:',_0x3c3859[_0xd0c6('0x27')]);var _0x373fcb=holdValidation['validate'](_0x3c3859['body']);if(_0x373fcb[_0xd0c6('0x28')]>0x0){return _0x304712['status'](0x190)[_0xd0c6('0x29')](_0x373fcb);}var _0x218419=_0x3c3859[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0xe27f40=_0x3c3859[_0xd0c6('0x27')][_0xd0c6('0x24')];return getAgent(_0x218419)[_0xd0c6('0x1a')](function(_0x3b3cf4){logger['info'](_0xd0c6('0x2e'),_0x3b3cf4['name']);emit(util[_0xd0c6('0x39')](_0xd0c6('0x34'),_0x3b3cf4[_0xd0c6('0x16')]),_0xd0c6('0x3d'),{'sessionId':_0xe27f40});return _0x304712['status'](0xc8)[_0xd0c6('0x29')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x304712));};exports['unhold']=function(_0x1509b5,_0x4404dc){logger[_0xd0c6('0x11')](_0xd0c6('0x3e'),_0x1509b5[_0xd0c6('0x27')]);var _0x2da020=unholdValidation[_0xd0c6('0xa')](_0x1509b5[_0xd0c6('0x27')]);if(_0x2da020[_0xd0c6('0x28')]>0x0){return _0x4404dc[_0xd0c6('0x17')](0x190)['json'](_0x2da020);}var _0x37277a=_0x1509b5[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0x50a261=_0x1509b5[_0xd0c6('0x27')][_0xd0c6('0x24')];return getAgent(_0x37277a)[_0xd0c6('0x1a')](function(_0xcc0580){logger[_0xd0c6('0x11')](_0xd0c6('0x2e'),_0xcc0580['name']);emit(util[_0xd0c6('0x39')](_0xd0c6('0x34'),_0xcc0580[_0xd0c6('0x16')]),_0xd0c6('0x3f'),{'sessionId':_0x50a261});return _0x4404dc[_0xd0c6('0x17')](0xc8)['json']({'error':![],'message':_0xd0c6('0x40')});})[_0xd0c6('0x31')](handleError(_0x4404dc));};exports[_0xd0c6('0x41')]=function(_0x47f08c,_0x2231e3){logger[_0xd0c6('0x11')](_0xd0c6('0x42'),_0x2231e3[_0xd0c6('0x27')]);var _0x26e246=callsValidation['validate'](_0x47f08c[_0xd0c6('0x27')]);if(_0x26e246[_0xd0c6('0x28')]>0x0){return _0x2231e3['status'](0x190)[_0xd0c6('0x29')](_0x26e246);}var _0x3c1641=_0x47f08c[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0x2ff9f8=respondWithRpcPromise(_0xd0c6('0x20'));var _0x48d848=getAgent(_0x3c1641);return Promise[_0xd0c6('0x43')]([_0x2ff9f8,_0x48d848])[_0xd0c6('0x1a')](function(_0x389276){var _0x30b422=_0x389276[0x0];var _0x3ddfc5=_0x389276[0x1];var _0x2f86a2=_[_0xd0c6('0x21')](_0x30b422[_0xd0c6('0x22')],function(_0x33ed71){return _0x33ed71[_0xd0c6('0x23')]==_0x3ddfc5['id'];});return _0x2231e3['status'](0xc8)[_0xd0c6('0x29')]({'count':_0x2f86a2[_0xd0c6('0x28')],'rows':_0x2f86a2});})['catch'](handleError(_0x2231e3));};exports[_0xd0c6('0x44')]=function(_0x38a4de,_0xcae78a){logger[_0xd0c6('0x11')](_0xd0c6('0x45'),_0x38a4de[_0xd0c6('0x27')]);var _0x1c8209=conferenceValidation[_0xd0c6('0xa')](_0x38a4de[_0xd0c6('0x27')]);if(_0x1c8209[_0xd0c6('0x28')]>0x0){return _0xcae78a[_0xd0c6('0x17')](0x190)['json'](_0x1c8209);}var _0x1129a6=_0x38a4de['body']['userId'];return getAgent(_0x1129a6)[_0xd0c6('0x1a')](function(_0x416f14){logger['info'](_0xd0c6('0x2e'),_0x416f14[_0xd0c6('0x16')]);emit(util[_0xd0c6('0x39')](_0xd0c6('0x34'),_0x416f14[_0xd0c6('0x16')]),_0xd0c6('0x46'));return _0xcae78a[_0xd0c6('0x17')](0xc8)[_0xd0c6('0x29')]({'error':![],'message':'conference\x20executed!'});})[_0xd0c6('0x31')](handleError(_0xcae78a));};exports[_0xd0c6('0x47')]=function(_0x5cfe6e,_0x2a99a1){logger[_0xd0c6('0x11')](_0xd0c6('0x48'),_0x5cfe6e[_0xd0c6('0x27')]);var _0x53cbd4=transferValidation[_0xd0c6('0xa')](_0x5cfe6e['body']);if(_0x53cbd4['length']>0x0){return _0x2a99a1[_0xd0c6('0x17')](0x190)[_0xd0c6('0x29')](_0x53cbd4);}var _0x184bdd=_0x5cfe6e[_0xd0c6('0x27')][_0xd0c6('0x2a')];var _0x122fa2=_0x5cfe6e[_0xd0c6('0x27')]['sessionId'];var _0x4ac8c7=_0x5cfe6e[_0xd0c6('0x27')][_0xd0c6('0x49')];return getAgent(_0x184bdd)[_0xd0c6('0x1a')](function(_0x2efb17){logger['info'](_0xd0c6('0x2e'),_0x2efb17[_0xd0c6('0x16')]);emit(util['format'](_0xd0c6('0x34'),_0x2efb17[_0xd0c6('0x16')]),'webbar:transfer',{'sessionId':_0x122fa2,'transferNumber':_0x4ac8c7});return _0x2a99a1['status'](0xc8)[_0xd0c6('0x29')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x2a99a1));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b241aa4..5742dbe 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 _0xacf4=['./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1014d2,_0x460acb){var _0x2cb3d9=function(_0x107de4){while(--_0x107de4){_0x1014d2['push'](_0x1014d2['shift']());}};_0x2cb3d9(++_0x460acb);}(_0xacf4,0xe7));var _0x4acf=function(_0x587500,_0x44c75a){_0x587500=_0x587500-0x0;var _0x2e5b7d=_0xacf4[_0x587500];return _0x2e5b7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getDispositions']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x8')](_0x4acf('0x10'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x12')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x13')]);router[_0x4acf('0x12')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['addDisposition']);router[_0x4acf('0x12')]('/:id/canned_answers',auth[_0x4acf('0xb')](),controller[_0x4acf('0x14')]);router[_0x4acf('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0x15')]);router[_0x4acf('0x12')](_0x4acf('0x10'),auth['isAuthenticated'](),controller[_0x4acf('0x16')]);router[_0x4acf('0x12')](_0x4acf('0x17'),controller[_0x4acf('0x18')]);router[_0x4acf('0x12')](_0x4acf('0x19'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x1a')]);router[_0x4acf('0x1b')](_0x4acf('0x1c'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0x1d')](_0x4acf('0x1c'),auth['isAuthenticated'](),controller[_0x4acf('0x1e')]);router[_0x4acf('0x1d')]('/:id/dispositions',auth[_0x4acf('0xb')](),controller[_0x4acf('0x1f')]);router[_0x4acf('0x1d')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x20')]);router[_0x4acf('0x1d')]('/:id/users',auth[_0x4acf('0xb')](),controller[_0x4acf('0x21')]);module['exports']=router; \ No newline at end of file +var _0x2542=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x39390f,_0x15edd0){var _0x75d171=function(_0x1eef22){while(--_0x1eef22){_0x39390f['push'](_0x39390f['shift']());}};_0x75d171(++_0x15edd0);}(_0x2542,0x169));var _0x2254=function(_0x5d6b6c,_0x389bc){_0x5d6b6c=_0x5d6b6c-0x0;var _0x11e917=_0x2542[_0x5d6b6c];return _0x11e917;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getAnswers']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x9')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['getApplications']);router[_0x2254('0x16')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x16')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x16')](_0x2254('0x12'),auth['isAuthenticated'](),controller[_0x2254('0x18')]);router['post'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x19')]);router[_0x2254('0x16')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2254('0x1a')]);router[_0x2254('0x16')](_0x2254('0x1b'),auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);router[_0x2254('0x1d')]('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x1e')]);router[_0x2254('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2254('0x1f')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x20')]);module[_0x2254('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6517536..e0b90df 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 _0xc317=['sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xace1ac,_0x2d20a8){var _0x103c4c=function(_0x12ed69){while(--_0x12ed69){_0xace1ac['push'](_0xace1ac['shift']());}};_0x103c4c(++_0x2d20a8);}(_0xc317,0xe0));var _0x7c31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc317[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7c31('0x0'));var rs=require(_0x7c31('0x1'));module[_0x7c31('0x2')]={'name':{'type':Sequelize[_0x7c31('0x3')],'unique':_0x7c31('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7c31('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7c31('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7c31('0x6')]('twilio',_0x7c31('0x7'))},'accountSid':{'type':Sequelize[_0x7c31('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7c31('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7c31('0x8')],'defaultValue':function(){return _0x7c31('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7c31('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7c31('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c31('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c31('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c31('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c31('0xb')],'comment':_0x7c31('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x7c31('0xa')],'defaultValue':![],'comment':_0x7c31('0xd'),'set':function(_0x1fe49f){if(!_0x1fe49f){this[_0x7c31('0xe')](_0x7c31('0xf'),null);}this[_0x7c31('0xe')]('mandatoryDisposition',_0x1fe49f);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x118b=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xaf33a2,_0x3038e1){var _0x37d5a3=function(_0x52263c){while(--_0x52263c){_0xaf33a2['push'](_0xaf33a2['shift']());}};_0x37d5a3(++_0x3038e1);}(_0x118b,0x72));var _0xb118=function(_0x5391fb,_0x786bf0){_0x5391fb=_0x5391fb-0x0;var _0x1b3ef3=_0x118b[_0x5391fb];return _0x1b3ef3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb118('0x0'));module[_0xb118('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb118('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb118('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb118('0x3')],'defaultValue':function(){return rs[_0xb118('0x4')]();}},'phone':{'type':Sequelize[_0xb118('0x3')]},'type':{'type':Sequelize[_0xb118('0x5')](_0xb118('0x6'),_0xb118('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xb118('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb118('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb118('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb118('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb118('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb118('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb118('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb118('0xa')],'comment':_0xb118('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xb118('0x9')],'defaultValue':![],'comment':_0xb118('0xc'),'set':function(_0x1331d4){if(!_0x1331d4){this[_0xb118('0xd')](_0xb118('0xe'),null);}this[_0xb118('0xd')](_0xb118('0xf'),_0x1331d4);}},'description':{'type':Sequelize[_0xb118('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ec4c8c7..8b5a4c3 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 _0x885c=['From','Body','messageId','MessageSid','from','notifications','message_id','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','userWhatsappAccount:remove','emit','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','priority','finally','getApplications','notify','whatsapp','WhatsappApplication','Applications','account','sinch','statuses','state','read','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile'];(function(_0xec5674,_0x1d588e){var _0x3cda5b=function(_0x4cd041){while(--_0x4cd041){_0xec5674['push'](_0xec5674['shift']());}};_0x3cda5b(++_0x1d588e);}(_0x885c,0x1ba));var _0xc885=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x885c[_0x4f2c3a];return _0x17d91c;};'use strict';var emlformat=require(_0xc885('0x0'));var rimraf=require(_0xc885('0x1'));var zipdir=require(_0xc885('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc885('0x3'));var moment=require('moment');var BPromise=require(_0xc885('0x4'));var Mustache=require(_0xc885('0x5'));var util=require(_0xc885('0x6'));var path=require(_0xc885('0x7'));var sox=require(_0xc885('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc885('0x9'));var _=require('lodash');var squel=require(_0xc885('0xa'));var crypto=require(_0xc885('0xb'));var jsforce=require(_0xc885('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc885('0xd'));var querystring=require('querystring');var Papa=require(_0xc885('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc885('0xf'));var as=require(_0xc885('0x10'));var hardwareService=require(_0xc885('0x11'));var logger=require(_0xc885('0x12'))(_0xc885('0x13'));var utils=require(_0xc885('0x14'));var config=require(_0xc885('0x15'));var licenseUtil=require(_0xc885('0x16'));var db=require(_0xc885('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc885('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc885('0x19')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xc885('0x1a'));var client=jayson[_0xc885('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1e145c,_0x24d22a,_0x303736,_0x42aabd){return new BPromise(function(_0x2a3ac1,_0x3fcd2c){var _0x4f9a29=_0x42aabd||client;return _0x4f9a29[_0xc885('0x1c')](_0x1e145c,_0x303736)[_0xc885('0x1d')](function(_0x592ef8){logger[_0xc885('0x1e')](_0xc885('0x1f'),_0x24d22a,'request\x20sent');logger[_0xc885('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x24d22a,'request\x20sent',JSON[_0xc885('0x21')](_0x592ef8));if(_0x592ef8[_0xc885('0x22')]){if(_0x592ef8[_0xc885('0x22')][_0xc885('0x23')]===0x1f4){logger['error'](_0xc885('0x1f'),_0x24d22a,_0x592ef8[_0xc885('0x22')][_0xc885('0x24')]);return _0x3fcd2c(_0x592ef8[_0xc885('0x22')]['message']);}logger[_0xc885('0x22')](_0xc885('0x1f'),_0x24d22a,_0x592ef8['error'][_0xc885('0x24')]);return _0x2a3ac1(_0x592ef8[_0xc885('0x22')][_0xc885('0x24')]);}else{logger[_0xc885('0x1e')](_0xc885('0x1f'),_0x24d22a,_0xc885('0x25'));_0x2a3ac1(_0x592ef8[_0xc885('0x26')][_0xc885('0x24')]);}})[_0xc885('0x27')](function(_0x58b269){logger['error'](_0xc885('0x1f'),_0x24d22a,_0x58b269);_0x3fcd2c(_0x58b269);});});}function respondWithStatusCode(_0x3b8e42,_0x2e2c58){_0x2e2c58=_0x2e2c58||0xcc;return function(_0x4993df){if(_0x4993df){return _0x3b8e42[_0xc885('0x28')](_0x2e2c58);}return _0x3b8e42[_0xc885('0x29')](_0x2e2c58)[_0xc885('0x2a')]();};}function respondWithResult(_0x5ce6ce,_0x234f27){_0x234f27=_0x234f27||0xc8;return function(_0x5edf43){if(_0x5edf43){return _0x5ce6ce[_0xc885('0x29')](_0x234f27)[_0xc885('0x2b')](_0x5edf43);}};}function respondWithFilteredResult(_0x49f3d3,_0x297a9d){return function(_0x4e37e7){if(_0x4e37e7){var _0x34d3c4=typeof _0x297a9d[_0xc885('0x2c')]===_0xc885('0x2d')&&typeof _0x297a9d['limit']===_0xc885('0x2d');var _0x42bea1=_0x4e37e7['count'];var _0x324779=_0x34d3c4?0x0:_0x297a9d[_0xc885('0x2c')];var _0x13859e=_0x34d3c4?_0x4e37e7[_0xc885('0x2e')]:_0x297a9d['offset']+_0x297a9d['limit'];var _0x2b0f29;if(_0x13859e>=_0x42bea1){_0x13859e=_0x42bea1;_0x2b0f29=0xc8;}else{_0x2b0f29=0xce;}_0x49f3d3[_0xc885('0x29')](_0x2b0f29);return _0x49f3d3[_0xc885('0x2f')](_0xc885('0x30'),_0x324779+'-'+_0x13859e+'/'+_0x42bea1)[_0xc885('0x2b')](_0x4e37e7);}return null;};}function patchUpdates(_0x318309){return function(_0x2b33e0){try{jsonpatch[_0xc885('0x31')](_0x2b33e0,_0x318309,!![]);}catch(_0x2da74e){return BPromise[_0xc885('0x32')](_0x2da74e);}return _0x2b33e0[_0xc885('0x33')]();};}function saveUpdates(_0x1b4f95,_0xd6cffc){return function(_0x19e153){if(_0x19e153){return _0x19e153[_0xc885('0x34')](_0x1b4f95)[_0xc885('0x1d')](function(_0x470147){return _0x470147;});}return null;};}function removeEntity(_0xcfb2ec,_0x5981b2){return function(_0x2305fb){if(_0x2305fb){return _0x2305fb[_0xc885('0x35')]()['then'](function(){var _0x2ef1f2=_0x2305fb[_0xc885('0x36')]({'plain':!![]});var _0x1222c9=_0xc885('0x37');return db[_0xc885('0x38')]['destroy']({'where':{'type':_0x1222c9,'resourceId':_0x2ef1f2['id']}})[_0xc885('0x1d')](function(){return _0x2305fb;});})[_0xc885('0x1d')](function(){_0xcfb2ec['status'](0xcc)[_0xc885('0x2a')]();});}};}function handleEntityNotFound(_0xf477a5,_0x201872){return function(_0x4f3a29){if(!_0x4f3a29){_0xf477a5[_0xc885('0x28')](0x194);}return _0x4f3a29;};}function handleError(_0x2aab0d,_0x1aaebb){_0x1aaebb=_0x1aaebb||0x1f4;return function(_0x1b7d13){logger[_0xc885('0x22')](_0x1b7d13[_0xc885('0x39')]);if(_0x1b7d13[_0xc885('0x3a')]){delete _0x1b7d13[_0xc885('0x3a')];}_0x2aab0d['status'](_0x1aaebb)[_0xc885('0x3b')](_0x1b7d13);};}exports[_0xc885('0x3c')]=function(_0x136002,_0x4ba7be){var _0x2bec8c={'include':[{'model':db[_0xc885('0x3d')],'as':_0xc885('0x3e')}]},_0x441cd9={},_0x2b8eb3={'count':0x0,'rows':[]};var _0x66ed5=_[_0xc885('0x3f')](db[_0xc885('0x40')][_0xc885('0x41')],function(_0x2b13fd){return{'name':_0x2b13fd[_0xc885('0x42')],'type':_0x2b13fd[_0xc885('0x43')][_0xc885('0x44')]};});_0x441cd9[_0xc885('0x45')]=_['map'](_0x66ed5,_0xc885('0x3a'));_0x441cd9[_0xc885('0x46')]=_['keys'](_0x136002['query']);_0x441cd9[_0xc885('0x47')]=_[_0xc885('0x48')](_0x441cd9[_0xc885('0x45')],_0x441cd9[_0xc885('0x46')]);_0x2bec8c[_0xc885('0x49')]=_[_0xc885('0x48')](_0x441cd9[_0xc885('0x45')],qs[_0xc885('0x4a')](_0x136002['query'][_0xc885('0x4a')]));_0x2bec8c[_0xc885('0x49')]=_0x2bec8c[_0xc885('0x49')][_0xc885('0x4b')]?_0x2bec8c[_0xc885('0x49')]:_0x441cd9[_0xc885('0x45')];if(!_0x136002[_0xc885('0x46')][_0xc885('0x4c')](_0xc885('0x4d'))){_0x2bec8c[_0xc885('0x4e')]=qs['limit'](_0x136002[_0xc885('0x46')][_0xc885('0x4e')]);_0x2bec8c['offset']=qs[_0xc885('0x2c')](_0x136002[_0xc885('0x46')][_0xc885('0x2c')]);}_0x2bec8c[_0xc885('0x4f')]=qs[_0xc885('0x50')](_0x136002['query'][_0xc885('0x50')]);_0x2bec8c[_0xc885('0x51')]=qs[_0xc885('0x47')](_[_0xc885('0x52')](_0x136002['query'],_0x441cd9[_0xc885('0x47')]),_0x66ed5);if(_0x136002[_0xc885('0x46')][_0xc885('0x53')]){_0x2bec8c[_0xc885('0x51')]=_[_0xc885('0x54')](_0x2bec8c[_0xc885('0x51')],{'$or':_['map'](_0x66ed5,function(_0x4ea189){if(_0x4ea189[_0xc885('0x43')]!=='VIRTUAL'){var _0x329f13={};_0x329f13[_0x4ea189['name']]={'$like':'%'+_0x136002['query'][_0xc885('0x53')]+'%'};return _0x329f13;}})});}_0x2bec8c=_[_0xc885('0x54')]({},_0x2bec8c,_0x136002[_0xc885('0x55')]);var _0x5b1daf={'where':_0x2bec8c[_0xc885('0x51')]};return db['WhatsappAccount'][_0xc885('0x2e')](_0x5b1daf)[_0xc885('0x1d')](function(_0x419ba3){_0x2b8eb3[_0xc885('0x2e')]=_0x419ba3;if(_0x136002[_0xc885('0x46')]['includeAll']){_0x2bec8c[_0xc885('0x56')]=[{'all':!![]}];}return db[_0xc885('0x40')][_0xc885('0x57')](_0x2bec8c);})[_0xc885('0x1d')](function(_0x277399){_0x2b8eb3[_0xc885('0x58')]=_0x277399;return _0x2b8eb3;})['then'](respondWithFilteredResult(_0x4ba7be,_0x2bec8c))[_0xc885('0x27')](handleError(_0x4ba7be,null));};exports[_0xc885('0x59')]=function(_0x3d42d0,_0x34b9df){var _0x2430cd={'raw':![],'where':{'id':_0x3d42d0[_0xc885('0x5a')]['id']},'include':[{'model':db[_0xc885('0x3d')],'as':_0xc885('0x3e')}]},_0x531da7={};_0x531da7[_0xc885('0x45')]=_[_0xc885('0x5b')](db[_0xc885('0x40')]['rawAttributes']);_0x531da7['query']=_[_0xc885('0x5b')](_0x3d42d0[_0xc885('0x46')]);_0x531da7[_0xc885('0x47')]=_['intersection'](_0x531da7[_0xc885('0x45')],_0x531da7[_0xc885('0x46')]);_0x2430cd[_0xc885('0x49')]=_[_0xc885('0x48')](_0x531da7[_0xc885('0x45')],qs[_0xc885('0x4a')](_0x3d42d0[_0xc885('0x46')][_0xc885('0x4a')]));_0x2430cd['attributes']=_0x2430cd['attributes']['length']?_0x2430cd['attributes']:_0x531da7[_0xc885('0x45')];if(_0x3d42d0[_0xc885('0x46')][_0xc885('0x5c')]){_0x2430cd[_0xc885('0x56')]=[{'all':!![]}];}_0x2430cd=_['merge']({},_0x2430cd,_0x3d42d0[_0xc885('0x55')]);return db['WhatsappAccount'][_0xc885('0x5d')](_0x2430cd)[_0xc885('0x1d')](handleEntityNotFound(_0x34b9df,null))[_0xc885('0x1d')](respondWithResult(_0x34b9df,null))[_0xc885('0x27')](handleError(_0x34b9df,null));};exports[_0xc885('0x5e')]=function(_0x4b54f9,_0x470164){return db[_0xc885('0x40')][_0xc885('0x5e')](_0x4b54f9[_0xc885('0x5f')],{})[_0xc885('0x1d')](function(_0x58c770){var _0x19bd83=_0x4b54f9['user'][_0xc885('0x36')]({'plain':!![]});if(!_0x19bd83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19bd83[_0xc885('0x60')]==='user'){var _0x281ca8=_0x58c770[_0xc885('0x36')]({'plain':!![]});var _0x1e40ba=_0xc885('0x37');return db[_0xc885('0x61')]['find']({'where':{'name':_0x1e40ba,'userProfileId':_0x19bd83[_0xc885('0x62')]},'raw':!![]})[_0xc885('0x1d')](function(_0x43a64c){if(_0x43a64c&&_0x43a64c[_0xc885('0x63')]===0x0){return db['UserProfileResource'][_0xc885('0x5e')]({'name':_0x281ca8['name'],'resourceId':_0x281ca8['id'],'type':_0x43a64c['name'],'sectionId':_0x43a64c['id']},{})[_0xc885('0x1d')](function(){return _0x58c770;});}else{return _0x58c770;}})['catch'](function(_0x196f00){logger[_0xc885('0x22')](_0xc885('0x64'),_0x196f00);throw _0x196f00;});}return _0x58c770;})[_0xc885('0x1d')](respondWithResult(_0x470164,0xc9))[_0xc885('0x27')](handleError(_0x470164,null));};exports[_0xc885('0x34')]=function(_0x1c66cb,_0x29c08a){if(_0x1c66cb['body']['id']){delete _0x1c66cb[_0xc885('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1c66cb['params']['id']},'include':[{'model':db['Pause'],'as':_0xc885('0x3e')}]})[_0xc885('0x1d')](handleEntityNotFound(_0x29c08a,null))[_0xc885('0x1d')](saveUpdates(_0x1c66cb['body'],null))[_0xc885('0x1d')](respondWithResult(_0x29c08a,null))[_0xc885('0x27')](handleError(_0x29c08a,null));};exports[_0xc885('0x35')]=function(_0x4d3617,_0x5a01f4){return db['WhatsappAccount'][_0xc885('0x5d')]({'where':{'id':_0x4d3617[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x5a01f4,null))[_0xc885('0x1d')](removeEntity(_0x5a01f4,null))[_0xc885('0x27')](handleError(_0x5a01f4,null));};exports[_0xc885('0x65')]=function(_0x4dfd67,_0x33c672){return db['WhatsappAccount'][_0xc885('0x65')]()[_0xc885('0x1d')](respondWithResult(_0x33c672,null))[_0xc885('0x27')](handleError(_0x33c672,null));};exports[_0xc885('0x66')]=function(_0x187841,_0x365666,_0x5f0a8f){if(_0x187841['body']['id']){delete _0x187841[_0xc885('0x5f')]['id'];}return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x187841[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x365666,null))[_0xc885('0x1d')](function(_0x5ac451){if(_0x5ac451){_0x187841[_0xc885('0x5f')][_0xc885('0x67')]=_0x5ac451['id'];return db[_0xc885('0x68')][_0xc885('0x5e')](_0x187841['body']);}})[_0xc885('0x1d')](respondWithResult(_0x365666,null))[_0xc885('0x27')](handleError(_0x365666,null));};exports[_0xc885('0x69')]=function(_0x549ad5,_0x2954a3,_0x4d7058){var _0x178a7b={'raw':![],'where':{}};var _0x325038={};var _0x3f4e94={'count':0x0,'rows':[]};return db[_0xc885('0x40')][_0xc885('0x6a')]({'where':{'id':_0x549ad5[_0xc885('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2954a3,null))[_0xc885('0x1d')](function(_0x5a4e9a){if(_0x5a4e9a){_0x325038['model']=_[_0xc885('0x5b')](db['Disposition']['rawAttributes']);_0x325038[_0xc885('0x46')]=_['keys'](_0x549ad5[_0xc885('0x46')]);_0x325038[_0xc885('0x47')]=_[_0xc885('0x48')](_0x325038[_0xc885('0x45')],_0x325038[_0xc885('0x46')]);_0x178a7b[_0xc885('0x49')]=_['intersection'](_0x325038[_0xc885('0x45')],qs[_0xc885('0x4a')](_0x549ad5[_0xc885('0x46')][_0xc885('0x4a')]));_0x178a7b['attributes']=_0x178a7b[_0xc885('0x49')][_0xc885('0x4b')]?_0x178a7b[_0xc885('0x49')]:_0x325038['model'];if(!_0x549ad5[_0xc885('0x46')]['hasOwnProperty']('nolimit')){_0x178a7b[_0xc885('0x4e')]=qs['limit'](_0x549ad5[_0xc885('0x46')][_0xc885('0x4e')]);_0x178a7b['offset']=qs['offset'](_0x549ad5[_0xc885('0x46')][_0xc885('0x2c')]);}_0x178a7b['order']=qs['sort'](_0x549ad5[_0xc885('0x46')][_0xc885('0x50')]);_0x178a7b[_0xc885('0x51')]=qs[_0xc885('0x47')](_[_0xc885('0x52')](_0x549ad5[_0xc885('0x46')],_0x325038['filters']));_0x178a7b[_0xc885('0x51')]['WhatsappAccountId']=_0x5a4e9a['id'];if(_0x549ad5[_0xc885('0x46')][_0xc885('0x53')]){_0x178a7b[_0xc885('0x51')]=_['merge'](_0x178a7b[_0xc885('0x51')],{'$or':_[_0xc885('0x3f')](_0x178a7b['attributes'],function(_0x46795d){var _0x58a485={};_0x58a485[_0x46795d]={'$like':'%'+_0x549ad5['query'][_0xc885('0x53')]+'%'};return _0x58a485;})});}_0x178a7b=_[_0xc885('0x54')]({},_0x178a7b,_0x549ad5['options']);return db[_0xc885('0x68')][_0xc885('0x2e')]({'where':_0x178a7b[_0xc885('0x51')]})[_0xc885('0x1d')](function(_0x3c6c26){_0x3f4e94[_0xc885('0x2e')]=_0x3c6c26;if(_0x549ad5['query'][_0xc885('0x5c')]){_0x178a7b[_0xc885('0x56')]=[{'all':!![]}];}return db[_0xc885('0x68')]['findAll'](_0x178a7b);})[_0xc885('0x1d')](function(_0x5bc0ec){_0x3f4e94[_0xc885('0x58')]=_0x5bc0ec;return _0x3f4e94;});}})[_0xc885('0x1d')](respondWithFilteredResult(_0x2954a3,_0x178a7b))[_0xc885('0x27')](handleError(_0x2954a3,null));};exports[_0xc885('0x6b')]=function(_0x4f0e55,_0xed1974,_0x3f79c6){return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x4f0e55[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0xed1974,null))[_0xc885('0x1d')](function(_0x483d44){if(_0x483d44){return _0x483d44[_0xc885('0x6b')](_0x4f0e55['query'][_0xc885('0x6c')]);}})['then'](respondWithStatusCode(_0xed1974,null))[_0xc885('0x27')](handleError(_0xed1974,null));};exports[_0xc885('0x6d')]=function(_0x313e05,_0x101a43,_0xea5ee5){if(_0x313e05[_0xc885('0x5f')]['id']){delete _0x313e05['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x313e05[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x101a43,null))[_0xc885('0x1d')](function(_0x5aa1dd){if(_0x5aa1dd){_0x313e05['body'][_0xc885('0x67')]=_0x5aa1dd['id'];return db[_0xc885('0x6e')][_0xc885('0x5e')](_0x313e05[_0xc885('0x5f')]);}})[_0xc885('0x1d')](respondWithResult(_0x101a43,null))[_0xc885('0x27')](handleError(_0x101a43,null));};exports[_0xc885('0x6f')]=function(_0x16b46a,_0xe4bb29,_0x3362c8){var _0x474533={'raw':![],'where':{}};var _0x6d4c6a={};var _0x5e76b3={'count':0x0,'rows':[]};return db[_0xc885('0x40')][_0xc885('0x6a')]({'where':{'id':_0x16b46a[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0xe4bb29,null))[_0xc885('0x1d')](function(_0x44ba03){if(_0x44ba03){_0x6d4c6a[_0xc885('0x45')]=_[_0xc885('0x5b')](db[_0xc885('0x6e')]['rawAttributes']);_0x6d4c6a[_0xc885('0x46')]=_[_0xc885('0x5b')](_0x16b46a[_0xc885('0x46')]);_0x6d4c6a['filters']=_[_0xc885('0x48')](_0x6d4c6a[_0xc885('0x45')],_0x6d4c6a[_0xc885('0x46')]);_0x474533[_0xc885('0x49')]=_[_0xc885('0x48')](_0x6d4c6a[_0xc885('0x45')],qs[_0xc885('0x4a')](_0x16b46a[_0xc885('0x46')][_0xc885('0x4a')]));_0x474533[_0xc885('0x49')]=_0x474533[_0xc885('0x49')][_0xc885('0x4b')]?_0x474533[_0xc885('0x49')]:_0x6d4c6a[_0xc885('0x45')];if(!_0x16b46a['query']['hasOwnProperty'](_0xc885('0x4d'))){_0x474533[_0xc885('0x4e')]=qs['limit'](_0x16b46a[_0xc885('0x46')][_0xc885('0x4e')]);_0x474533[_0xc885('0x2c')]=qs['offset'](_0x16b46a[_0xc885('0x46')][_0xc885('0x2c')]);}_0x474533['order']=qs['sort'](_0x16b46a[_0xc885('0x46')]['sort']);_0x474533[_0xc885('0x51')]=qs[_0xc885('0x47')](_[_0xc885('0x52')](_0x16b46a[_0xc885('0x46')],_0x6d4c6a[_0xc885('0x47')]));_0x474533[_0xc885('0x51')][_0xc885('0x67')]=_0x44ba03['id'];if(_0x16b46a[_0xc885('0x46')][_0xc885('0x53')]){_0x474533['where']=_['merge'](_0x474533[_0xc885('0x51')],{'$or':_[_0xc885('0x3f')](_0x474533[_0xc885('0x49')],function(_0x1cdb38){var _0x3a6368={};_0x3a6368[_0x1cdb38]={'$like':'%'+_0x16b46a[_0xc885('0x46')][_0xc885('0x53')]+'%'};return _0x3a6368;})});}_0x474533=_[_0xc885('0x54')]({},_0x474533,_0x16b46a['options']);return db['CannedAnswer'][_0xc885('0x2e')]({'where':_0x474533[_0xc885('0x51')]})[_0xc885('0x1d')](function(_0x215237){_0x5e76b3[_0xc885('0x2e')]=_0x215237;if(_0x16b46a[_0xc885('0x46')][_0xc885('0x5c')]){_0x474533[_0xc885('0x56')]=[{'all':!![]}];}return db[_0xc885('0x6e')][_0xc885('0x57')](_0x474533);})[_0xc885('0x1d')](function(_0x5bb7ec){_0x5e76b3[_0xc885('0x58')]=_0x5bb7ec;return _0x5e76b3;});}})[_0xc885('0x1d')](respondWithFilteredResult(_0xe4bb29,_0x474533))['catch'](handleError(_0xe4bb29,null));};exports['removeAnswers']=function(_0x3f9bc6,_0xbb164f,_0x277edd){return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x3f9bc6['params']['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0xbb164f,null))[_0xc885('0x1d')](function(_0x44539e){if(_0x44539e){return _0x44539e[_0xc885('0x70')](_0x3f9bc6[_0xc885('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xbb164f,null))[_0xc885('0x27')](handleError(_0xbb164f,null));};exports[_0xc885('0x71')]=function(_0x152fb6,_0x13e498,_0x634b57){return db[_0xc885('0x40')]['find']({'where':{'id':_0x152fb6['params']['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x13e498,null))[_0xc885('0x1d')](function(_0x3d6aeb){if(_0x3d6aeb){return _0x3d6aeb[_0xc885('0x71')](_0x152fb6[_0xc885('0x5f')]['ids'],_[_0xc885('0x72')](_0x152fb6[_0xc885('0x5f')],[_0xc885('0x6c'),'id'])||{})[_0xc885('0x73')](function(_0x84bf41){for(var _0x28ca31=0x0;_0x28ca31<_0x152fb6[_0xc885('0x5f')][_0xc885('0x6c')][_0xc885('0x4b')];_0x28ca31+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x152fb6[_0xc885('0x5f')]['ids'][_0x28ca31]),'WhatsappAccountId':Number(_0x152fb6[_0xc885('0x5a')]['id'])});}return _0x84bf41;});}})['then'](respondWithResult(_0x13e498,null))['catch'](handleError(_0x13e498,null));};exports[_0xc885('0x74')]=function(_0x4efac9,_0x494be3,_0x55a655){return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x4efac9['params']['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x494be3,null))[_0xc885('0x1d')](function(_0x2a1d61){if(_0x2a1d61){return _0x2a1d61['removeAgents'](_0x4efac9[_0xc885('0x46')][_0xc885('0x6c')])[_0xc885('0x1d')](function(){if(_['isArray'](_0x4efac9[_0xc885('0x46')][_0xc885('0x6c')])){for(var _0xd477d9=0x0;_0xd477d9<_0x4efac9[_0xc885('0x46')]['ids'][_0xc885('0x4b')];_0xd477d9+=0x1){socket['emit'](_0xc885('0x75'),{'UserId':Number(_0x4efac9['query'][_0xc885('0x6c')][_0xd477d9]),'WhatsappAccountId':Number(_0x4efac9[_0xc885('0x5a')]['id'])});}}else{socket[_0xc885('0x76')](_0xc885('0x75'),{'UserId':Number(_0x4efac9['query'][_0xc885('0x6c')]),'WhatsappAccountId':Number(_0x4efac9[_0xc885('0x5a')]['id'])});}});}})[_0xc885('0x1d')](respondWithStatusCode(_0x494be3,null))[_0xc885('0x27')](handleError(_0x494be3,null));};exports[_0xc885('0x77')]=function(_0x384b51,_0x111f6c,_0x30eade){var _0x3319ee={};var _0x358d4f={};var _0x381592;var _0x2b7620;return db['WhatsappAccount'][_0xc885('0x6a')]({'where':{'id':_0x384b51[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x111f6c,null))[_0xc885('0x1d')](function(_0x4aafc6){if(_0x4aafc6){_0x381592=_0x4aafc6;_0x358d4f[_0xc885('0x45')]=_[_0xc885('0x5b')](db[_0xc885('0x78')][_0xc885('0x41')]);_0x358d4f['query']=_['keys'](_0x384b51[_0xc885('0x46')]);_0x358d4f[_0xc885('0x47')]=_[_0xc885('0x48')](_0x358d4f[_0xc885('0x45')],_0x358d4f[_0xc885('0x46')]);_0x3319ee[_0xc885('0x49')]=_['intersection'](_0x358d4f[_0xc885('0x45')],qs['fields'](_0x384b51[_0xc885('0x46')]['fields']));_0x3319ee[_0xc885('0x49')]=_0x3319ee['attributes'][_0xc885('0x4b')]?_0x3319ee[_0xc885('0x49')]:_0x358d4f[_0xc885('0x45')];_0x3319ee['order']=qs['sort'](_0x384b51[_0xc885('0x46')]['sort']);_0x3319ee[_0xc885('0x51')]=qs['filters'](_[_0xc885('0x52')](_0x384b51['query'],_0x358d4f[_0xc885('0x47')]));if(_0x384b51[_0xc885('0x46')][_0xc885('0x53')]){_0x3319ee[_0xc885('0x51')]=_[_0xc885('0x54')](_0x3319ee[_0xc885('0x51')],{'$or':_[_0xc885('0x3f')](_0x3319ee[_0xc885('0x49')],function(_0x334852){var _0x536c75={};_0x536c75[_0x334852]={'$like':'%'+_0x384b51[_0xc885('0x46')][_0xc885('0x53')]+'%'};return _0x536c75;})});}_0x3319ee=_[_0xc885('0x54')]({},_0x3319ee,_0x384b51[_0xc885('0x55')]);return _0x381592['getAgents'](_0x3319ee);}})['then'](function(_0x81c5a2){if(_0x81c5a2){_0x2b7620=_0x81c5a2['length'];if(!_0x384b51[_0xc885('0x46')][_0xc885('0x4c')](_0xc885('0x4d'))){_0x3319ee['limit']=qs[_0xc885('0x4e')](_0x384b51[_0xc885('0x46')][_0xc885('0x4e')]);_0x3319ee[_0xc885('0x2c')]=qs[_0xc885('0x2c')](_0x384b51[_0xc885('0x46')][_0xc885('0x2c')]);}return _0x381592[_0xc885('0x77')](_0x3319ee);}})[_0xc885('0x1d')](function(_0x51c87c){if(_0x51c87c){return _0x51c87c?{'count':_0x2b7620,'rows':_0x51c87c}:null;}})[_0xc885('0x1d')](respondWithResult(_0x111f6c,null))[_0xc885('0x27')](handleError(_0x111f6c,null));};exports['addApplications']=function(_0x254b50,_0xb3ca23){var _0x21b732=_0x254b50[_0xc885('0x5a')]['id'];var _0x6e2c4a=_0x254b50[_0xc885('0x5f')];var _0x50509e=0xc8;var _0x1758b8=null;return db[_0xc885('0x79')][_0xc885('0x7a')]({'isolationLevel':db['sequelize']['Transaction'][_0xc885('0x7b')][_0xc885('0x7c')]},function(_0x5d6ed2){return db[_0xc885('0x40')][_0xc885('0x6a')]({'where':{'id':_0x21b732},'transaction':_0x5d6ed2})[_0xc885('0x1d')](function(_0x34001f){if(_0x34001f){return db['WhatsappApplication'][_0xc885('0x35')]({'where':{'WhatsappAccountId':_0x21b732},'transaction':_0x5d6ed2})[_0xc885('0x1d')](function(){var _0x46f082=_[_0xc885('0x3f')](_0x6e2c4a,function(_0x1a3073){_0x1a3073[_0xc885('0x67')]=_0x21b732;return _0x1a3073;});return db['WhatsappApplication']['bulkCreate'](_0x46f082,{'transaction':_0x5d6ed2});});}else{_0x50509e=0x194;_0x1758b8=[];}});})[_0xc885('0x1d')](function(){if(_0x50509e!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x21b732},'order':_0xc885('0x7d')})[_0xc885('0x1d')](function(_0x4f978f){_0x1758b8=_0x4f978f;});}})[_0xc885('0x27')](function(_0x11de1b){_0x50509e=0x1f4;logger[_0xc885('0x22')](_0x11de1b[_0xc885('0x39')]);if(_0x11de1b[_0xc885('0x3a')]){delete _0x11de1b[_0xc885('0x3a')];}_0x1758b8=_0x11de1b;})[_0xc885('0x7e')](function(){if(_0x1758b8===null){_0xb3ca23[_0xc885('0x28')](_0x50509e);}else{if(_0x50509e===0x1f4){_0xb3ca23['status'](_0x50509e)['send'](_0x1758b8);}else{_0xb3ca23[_0xc885('0x29')](_0x50509e)['json'](_0x1758b8);}}});};exports[_0xc885('0x7f')]=function(_0x216342,_0x52938f,_0x1fafe1){var _0x2fc3e5={};var _0x312b20={};var _0x22d58f;var _0x46b289;return db[_0xc885('0x40')][_0xc885('0x6a')]({'where':{'id':_0x216342[_0xc885('0x5a')]['id']}})[_0xc885('0x1d')](handleEntityNotFound(_0x52938f,null))[_0xc885('0x1d')](function(_0x30058e){if(_0x30058e){_0x22d58f=_0x30058e;_0x312b20[_0xc885('0x45')]=_[_0xc885('0x5b')](db['WhatsappApplication']['rawAttributes']);_0x312b20[_0xc885('0x46')]=_[_0xc885('0x5b')](_0x216342[_0xc885('0x46')]);_0x312b20['filters']=_[_0xc885('0x48')](_0x312b20[_0xc885('0x45')],_0x312b20[_0xc885('0x46')]);_0x2fc3e5[_0xc885('0x49')]=_[_0xc885('0x48')](_0x312b20[_0xc885('0x45')],qs[_0xc885('0x4a')](_0x216342[_0xc885('0x46')][_0xc885('0x4a')]));_0x2fc3e5[_0xc885('0x49')]=_0x2fc3e5[_0xc885('0x49')][_0xc885('0x4b')]?_0x2fc3e5[_0xc885('0x49')]:_0x312b20[_0xc885('0x45')];_0x2fc3e5[_0xc885('0x4f')]=qs[_0xc885('0x50')](_0x216342[_0xc885('0x46')][_0xc885('0x50')]);_0x2fc3e5[_0xc885('0x51')]=qs[_0xc885('0x47')](_[_0xc885('0x52')](_0x216342['query'],_0x312b20[_0xc885('0x47')]));if(_0x216342['query']['filter']){_0x2fc3e5['where']=_[_0xc885('0x54')](_0x2fc3e5[_0xc885('0x51')],{'$or':_['map'](_0x2fc3e5[_0xc885('0x49')],function(_0x11eced){var _0x5d94ca={};_0x5d94ca[_0x11eced]={'$like':'%'+_0x216342[_0xc885('0x46')][_0xc885('0x53')]+'%'};return _0x5d94ca;})});}_0x2fc3e5=_[_0xc885('0x54')]({},_0x2fc3e5,_0x216342[_0xc885('0x55')]);return _0x22d58f[_0xc885('0x7f')](_0x2fc3e5);}})['then'](function(_0x567bd8){if(_0x567bd8){_0x46b289=_0x567bd8['length'];if(!_0x216342[_0xc885('0x46')][_0xc885('0x4c')]('nolimit')){_0x2fc3e5[_0xc885('0x4e')]=qs[_0xc885('0x4e')](_0x216342[_0xc885('0x46')]['limit']);_0x2fc3e5[_0xc885('0x2c')]=qs[_0xc885('0x2c')](_0x216342[_0xc885('0x46')][_0xc885('0x2c')]);}return _0x22d58f[_0xc885('0x7f')](_0x2fc3e5);}})[_0xc885('0x1d')](function(_0x480a89){if(_0x480a89){return _0x480a89?{'count':_0x46b289,'rows':_0x480a89}:null;}})['then'](respondWithResult(_0x52938f,null))[_0xc885('0x27')](handleError(_0x52938f,null));};exports[_0xc885('0x80')]=function(_0x1e8914,_0x4835d9,_0x37077d){var _0x404bb1={'channel':_0xc885('0x81')};var _0x38a19c=[];var _0x21bff7=[];var _0x3a4a3a={};return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x1e8914[_0xc885('0x5a')]['id']},'include':[{'model':db[_0xc885('0x82')],'as':_0xc885('0x83')}]})[_0xc885('0x1d')](handleEntityNotFound(_0x4835d9,null))[_0xc885('0x1d')](function(_0x2d35bc){_0x404bb1[_0xc885('0x84')]=_0x2d35bc;if(_0x404bb1[_0xc885('0x84')]&&_0x404bb1['account'][_0xc885('0x43')]===_0xc885('0x85')&&_0x1e8914[_0xc885('0x5f')][_0xc885('0x86')]){if(_0x1e8914[_0xc885('0x5f')]['statuses'][_0xc885('0x4b')]===0x0)return;if(_0x1e8914[_0xc885('0x5f')][_0xc885('0x86')][0x0][_0xc885('0x87')]!==_0xc885('0x88'))return;return db['WhatsappMessage'][_0xc885('0x34')]({'read':!![],'readAt':_0x1e8914[_0xc885('0x5f')][_0xc885('0x86')][0x0][_0xc885('0x89')]},{'where':{'messageId':_0x1e8914[_0xc885('0x5f')][_0xc885('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0xc885('0x1d')](function(_0x445e67){return _0x4835d9[_0xc885('0x29')](0xc8)['json'](_0x445e67);});}_0x404bb1[_0xc885('0x8a')]=_[_0xc885('0x8b')](_0x2d35bc['Applications'],[_0xc885('0x7d')],[_0xc885('0x8c')]);if(_0x404bb1[_0xc885('0x84')]['Applications']){delete _0x404bb1['account'][_0xc885('0x83')];}return db[_0xc885('0x8d')]['describe']()['then'](function(_0x3373fb){if(!_0x3373fb){throw new db[(_0xc885('0x8e'))][(_0xc885('0x8f'))](_0xc885('0x90'));}_0x38a19c=_[_0xc885('0x91')](_[_0xc885('0x5b')](_0x3373fb),[_0xc885('0x92'),_0xc885('0x93')]);_0x21bff7=_[_0xc885('0x91')](_[_0xc885('0x5b')](_0x3373fb),['createdAt',_0xc885('0x93'),'CompanyId','ListId']);_0x404bb1[_0xc885('0x5f')]={'mapKey':_0xc885('0x94')};if(_0x404bb1[_0xc885('0x84')]&&_0x404bb1[_0xc885('0x84')][_0xc885('0x43')]==='twilio'){_0x404bb1['body']['from']=_0x1e8914['body'][_0xc885('0x95')]['replace']('whatsapp:','');_0x404bb1[_0xc885('0x5f')][_0xc885('0x5f')]=_0x1e8914[_0xc885('0x5f')][_0xc885('0x96')];_0x404bb1[_0xc885('0x5f')][_0xc885('0x97')]=_0x1e8914[_0xc885('0x5f')][_0xc885('0x98')];}if(_0x404bb1[_0xc885('0x84')]&&_0x404bb1[_0xc885('0x84')][_0xc885('0x43')]==='sinch'){_0x404bb1['body'][_0xc885('0x99')]=_0x1e8914[_0xc885('0x5f')][_0xc885('0x9a')][0x0][_0xc885('0x99')];_0x404bb1[_0xc885('0x5f')][_0xc885('0x5f')]=_0x1e8914[_0xc885('0x5f')]['notifications'][0x0][_0xc885('0x24')]['body'];_0x404bb1[_0xc885('0x5f')][_0xc885('0x97')]=_0x1e8914[_0xc885('0x5f')]['notifications'][0x0][_0xc885('0x9b')];}if(_0x404bb1[_0xc885('0x5f')]['id']){delete _0x404bb1['body']['id'];}if(_['isNil'](_0x404bb1[_0xc885('0x5f')]['from'])){throw new db[(_0xc885('0x8e'))][(_0xc885('0x8f'))](_0xc885('0x9c'));}if(_[_0xc885('0x9d')](_0x404bb1[_0xc885('0x5f')][_0xc885('0x5f')])||_0x404bb1[_0xc885('0x5f')][_0xc885('0x5f')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x404bb1[_0xc885('0x5f')][_0xc885('0x9e')])){throw new db[(_0xc885('0x8e'))][(_0xc885('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21bff7);}if(!_[_0xc885('0x9f')](_0x21bff7,_0x404bb1[_0xc885('0x5f')][_0xc885('0x9e')])){throw new db['Sequelize'][(_0xc885('0x8f'))](_0xc885('0xa0')+_0x21bff7);}_0x3a4a3a[_0x404bb1[_0xc885('0x5f')][_0xc885('0x9e')]]=_0x404bb1[_0xc885('0x5f')][_0xc885('0x99')];return db['CmList'][_0xc885('0x5d')]({'where':{'id':_0x404bb1[_0xc885('0x84')][_0xc885('0xa1')]},'include':[{'model':db[_0xc885('0x8d')],'as':_0xc885('0xa2'),'where':_0x3a4a3a,'limit':0x1,'order':[[_0xc885('0x93'),_0xc885('0xa3')]]}]});})[_0xc885('0x1d')](handleEntityNotFound(_0x4835d9,null))['then'](function(_0xb2507e){if(_0xb2507e){_0x404bb1[_0xc885('0xa4')]=_[_0xc885('0x72')](_0xb2507e,[_0xc885('0xa2')]);if(_0xb2507e[_0xc885('0xa2')]['length']){return _0xb2507e[_0xc885('0xa2')][0x0];}var _0x2b62d0=_[_0xc885('0xa5')](_0x404bb1[_0xc885('0x5f')],{'firstName':_0x404bb1[_0xc885('0x5f')][_0xc885('0x99')],'ListId':_0xb2507e['id']});_0x2b62d0[_0x404bb1[_0xc885('0x5f')][_0xc885('0x9e')]]=_0x404bb1[_0xc885('0x5f')][_0xc885('0x99')];return db[_0xc885('0x8d')][_0xc885('0x5e')](_0x2b62d0,{'fields':_0x38a19c,'raw':!![]});}})[_0xc885('0x1d')](handleEntityNotFound(_0x4835d9,null))[_0xc885('0x1d')](function(_0x32c64d){if(_0x32c64d){_0x404bb1[_0xc885('0xa6')]=_0x32c64d;var _0x18f774={'ContactId':_0x32c64d['id'],'phone':_0x404bb1[_0xc885('0x5f')][_0xc885('0x99')],'WhatsappAccountId':_0x1e8914[_0xc885('0x5a')]['id']};var _0xf1070c={'ContactId':_0x32c64d['id'],'WhatsappAccountId':_0x1e8914[_0xc885('0x5a')]['id'],'closed':![]};return db[_0xc885('0xa7')][_0xc885('0x5d')]({'where':_0xf1070c})['then'](function(_0x180aaf){if(_0x180aaf){return[_0x180aaf,![]];}return db['WhatsappInteraction'][_0xc885('0x5e')](_0x18f774)[_0xc885('0x1d')](function(_0xe0473){return[_0xe0473,!![]];});});}})[_0xc885('0x73')](function(_0x3b2ead,_0x4b6948){_0x404bb1[_0xc885('0xa8')]=_0x3b2ead['get']({'plain':!![]});_0x404bb1[_0xc885('0xa8')][_0xc885('0xa9')]=![];if(_0x4b6948){if(_0x404bb1[_0xc885('0x84')][_0xc885('0xaa')]){_0x404bb1['applications'][_0xc885('0xab')]({'id':0x0,'priority':_0x404bb1[_0xc885('0x8a')]['length']+0x1,'app':_0xc885('0xac'),'appdata':_0xc885('0xad'),'interval':_0xc885('0xae')});}_0x404bb1[_0xc885('0xa8')][_0xc885('0xa9')]=!![];}return db['WhatsappMessage'][_0xc885('0x5e')]({'phone':_0x404bb1[_0xc885('0x5f')]['from'],'messageId':_0x404bb1[_0xc885('0x5f')][_0xc885('0x97')],'body':_0x404bb1[_0xc885('0x5f')]['body'],'WhatsappAccountId':_0x1e8914[_0xc885('0x5a')]['id'],'WhatsappInteractionId':_0x3b2ead['id'],'direction':'in','ContactId':_0x3b2ead[_0xc885('0xaf')],'AttachmentId':_0x404bb1[_0xc885('0x5f')][_0xc885('0xb0')]});})[_0xc885('0x1d')](function(_0x4742c2){_0x404bb1[_0xc885('0x24')]=_0x4742c2;if(_0x404bb1['interaction']['UserId']){return db[_0xc885('0x78')][_0xc885('0x5d')]({'attributes':['id',_0xc885('0x3a')],'where':{'id':_0x404bb1[_0xc885('0xa8')]['UserId']}})['then'](function(_0x469d27){if(_0x469d27){_0x404bb1['applications'][_0xc885('0xb1')]({'id':0x0,'priority':0x0,'app':_0xc885('0xb2'),'appdata':_0x469d27[_0xc885('0x3a')]+','+(_0x404bb1[_0xc885('0x84')][_0xc885('0xb3')]||0xa),'interval':_0xc885('0xae')});}return respondWithRpcPromise(_0xc885('0xb4'),_0xc885('0xb5'),_0x404bb1);});}return respondWithRpcPromise(_0xc885('0xb4'),_0xc885('0xb5'),_0x404bb1);})[_0xc885('0x1d')](function(_0x55534b){if(_0x55534b){var _0x2b9f1e=0xc8;var _0x39c368=_0xc885('0xb6');logger[_0xc885('0x1e')](_0xc885('0xb7'),_0x39c368,_0x2b9f1e,_0xc885('0xb8'));logger[_0xc885('0x20')](_0xc885('0xb9'),_0x39c368,_0x2b9f1e,_0xc885('0xb8'),JSON[_0xc885('0x21')](_0x55534b));if(_0x404bb1[_0xc885('0x84')]['type']==='twilio'){return _0x4835d9['status'](_0x2b9f1e)[_0xc885('0x2f')](_0xc885('0xba'),_0xc885('0xbb'))[_0xc885('0x3b')](_0xc885('0xbc'));}else{return _0x4835d9[_0xc885('0x29')](_0x2b9f1e)['json'](_0x55534b);}}});})[_0xc885('0x27')](handleError(_0x4835d9,null));};exports[_0xc885('0x3b')]=function(_0x598145,_0x420d03,_0x2b3d2c){var _0x40799e,_0x40dd97,_0x1bdc95;if(_[_0xc885('0x9d')](_0x598145['body'][_0xc885('0x5f')])||_0x598145[_0xc885('0x5f')][_0xc885('0x5f')]===''){throw new db[(_0xc885('0x8e'))]['ValidationError'](_0xc885('0xbd'));}if(_[_0xc885('0x9d')](_0x598145['body']['to'])){throw new db[(_0xc885('0x8e'))][(_0xc885('0x8f'))](_0xc885('0xbe'));}_0x40799e=_0x598145[_0xc885('0x5f')]['to'];return db[_0xc885('0x40')][_0xc885('0x5d')]({'where':{'id':_0x598145[_0xc885('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xc885('0xbf'),'include':[{'model':db['CmContact'],'as':_0xc885('0xa2'),'where':{'mobile':_0x40799e},'limit':0x1,'order':[[_0xc885('0x93'),_0xc885('0xa3')]]}]}]})[_0xc885('0x1d')](handleEntityNotFound(_0x420d03,null))[_0xc885('0x1d')](function(_0x360d12){if(_0x360d12&&_0x360d12[_0xc885('0xbf')]){_0x40dd97=_0x360d12[_0xc885('0x36')]({'plain':!![]});if(_0x40dd97[_0xc885('0xbf')]&&_0x40dd97['List'][_0xc885('0xa2')][_0xc885('0x4b')]){return _0x40dd97[_0xc885('0xbf')][_0xc885('0xa2')][0x0];}return db[_0xc885('0x8d')][_0xc885('0x5e')](_[_0xc885('0xa5')](_0x598145[_0xc885('0x5f')],{'firstName':_0x40799e,'mobile':_0x40799e,'phone':_0x40799e,'ListId':_0x40dd97[_0xc885('0xa1')]}));}})['then'](handleEntityNotFound(_0x420d03,null))['then'](function(_0x298647){if(_0x298647){_0x1bdc95=_0x298647;return db[_0xc885('0xa7')][_0xc885('0x5d')]({'where':{'ContactId':_0x1bdc95['id'],'closed':![],'WhatsappAccountId':_0x40dd97['id']}})[_0xc885('0x1d')](function(_0x2b57f9){if(_0x2b57f9){return[_0x2b57f9,![]];}return db[_0xc885('0xa7')][_0xc885('0x5e')]({'UserId':_0x598145[_0xc885('0xc0')]['id'],'ContactId':_0x1bdc95['id'],'WhatsappAccountId':_0x40dd97['id'],'phone':_0x40799e,'firstMsgDirection':_0xc885('0xc1'),'Messages':[_[_0xc885('0x54')](_0x598145['body'],{'read':![],'body':_0x598145['body'][_0xc885('0x5f')],'phone':_0x40799e,'WhatsappAccountId':_0x40dd97['id'],'UserId':_0x598145[_0xc885('0xc0')]['id'],'ContactId':_0x1bdc95['id']})]},{'include':[{'model':db[_0xc885('0xc2')],'as':'Messages'}]})['then'](function(_0x5a019d){return[_0x5a019d,!![]];});});}})[_0xc885('0x73')](function(_0x56c8c1,_0x2b2b38){if(_0x2b2b38){return _0x56c8c1;}return db[_0xc885('0xc2')][_0xc885('0x5e')](_[_0xc885('0x54')](_0x598145[_0xc885('0x5f')],{'read':![],'body':_0x598145[_0xc885('0x5f')][_0xc885('0x5f')],'phone':_0x40799e,'WhatsappAccountId':_0x40dd97['id'],'WhatsappInteractionId':_0x56c8c1['id'],'UserId':_0x598145[_0xc885('0xc0')]['id'],'ContactId':_0x1bdc95['id']}))['then'](function(_0x40d2d9){_0x56c8c1['dataValues'][_0xc885('0xc3')]=[];_0x56c8c1['dataValues'][_0xc885('0xc3')][_0xc885('0xab')](_0x40d2d9[_0xc885('0xc4')]);return _0x56c8c1;});})[_0xc885('0x1d')](respondWithResult(_0x420d03,null))['catch'](handleError(_0x420d03,null));}; \ No newline at end of file +var _0x8b48=['to\x20is\x20mandatory','List','CmContact','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','redis','./whatsappAccount.socket','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappAccount','include','findAll','rows','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','WhatsappAccounts','UserProfileSection','userProfileId','body','describe','addDisposition','WhatsappAccountId','hasOwnProperty','pick','Disposition','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','created','applications','push','close','unmanaged','*,*,*,*','ContactId','interaction','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x8b48,0x19c));var _0x88b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b48[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88b4('0x0'));var zipdir=require(_0x88b4('0x1'));var jsonpatch=require(_0x88b4('0x2'));var rp=require('request-promise');var moment=require(_0x88b4('0x3'));var BPromise=require(_0x88b4('0x4'));var Mustache=require(_0x88b4('0x5'));var util=require('util');var path=require(_0x88b4('0x6'));var sox=require(_0x88b4('0x7'));var csv=require(_0x88b4('0x8'));var ejs=require(_0x88b4('0x9'));var fs=require('fs');var fs_extra=require(_0x88b4('0xa'));var _=require(_0x88b4('0xb'));var squel=require(_0x88b4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x88b4('0x8'));var querystring=require(_0x88b4('0xd'));var Papa=require(_0x88b4('0xe'));var Redis=require(_0x88b4('0xf'));var authService=require(_0x88b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x88b4('0x11'));var hardwareService=require(_0x88b4('0x12'));var logger=require(_0x88b4('0x13'))(_0x88b4('0x14'));var utils=require('../../config/utils');var config=require(_0x88b4('0x15'));var licenseUtil=require(_0x88b4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x88b4('0x17')](config['redis'],{'host':_0x88b4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88b4('0x19')]));require(_0x88b4('0x1a'))['register'](socket);var jayson=require(_0x88b4('0x1b'));var client=jayson[_0x88b4('0x1c')][_0x88b4('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x13d8be,_0x39c445,_0x57a7ea,_0x4be1b2){return new BPromise(function(_0x2faaef,_0x39d949){var _0xabe47b=_0x4be1b2||client;return _0xabe47b[_0x88b4('0x1e')](_0x13d8be,_0x57a7ea)[_0x88b4('0x1f')](function(_0x37cd48){logger['info'](_0x88b4('0x20'),_0x39c445,_0x88b4('0x21'));logger[_0x88b4('0x22')](_0x88b4('0x23'),_0x39c445,'request\x20sent',JSON[_0x88b4('0x24')](_0x37cd48));if(_0x37cd48['error']){if(_0x37cd48['error'][_0x88b4('0x25')]===0x1f4){logger['error'](_0x88b4('0x20'),_0x39c445,_0x37cd48[_0x88b4('0x26')][_0x88b4('0x27')]);return _0x39d949(_0x37cd48['error'][_0x88b4('0x27')]);}logger[_0x88b4('0x26')](_0x88b4('0x20'),_0x39c445,_0x37cd48['error']['message']);return _0x2faaef(_0x37cd48[_0x88b4('0x26')][_0x88b4('0x27')]);}else{logger[_0x88b4('0x28')](_0x88b4('0x20'),_0x39c445,_0x88b4('0x21'));_0x2faaef(_0x37cd48[_0x88b4('0x29')][_0x88b4('0x27')]);}})['catch'](function(_0x595486){logger['error'](_0x88b4('0x20'),_0x39c445,_0x595486);_0x39d949(_0x595486);});});}function respondWithStatusCode(_0xbf155b,_0xbd561b){_0xbd561b=_0xbd561b||0xcc;return function(_0x107f98){if(_0x107f98){return _0xbf155b['sendStatus'](_0xbd561b);}return _0xbf155b[_0x88b4('0x2a')](_0xbd561b)['end']();};}function respondWithResult(_0x3efd8a,_0xf2caf5){_0xf2caf5=_0xf2caf5||0xc8;return function(_0x50c78c){if(_0x50c78c){return _0x3efd8a[_0x88b4('0x2a')](_0xf2caf5)[_0x88b4('0x2b')](_0x50c78c);}};}function respondWithFilteredResult(_0x51c533,_0x4cece5){return function(_0x486f97){if(_0x486f97){var _0x4e3b8b=typeof _0x4cece5[_0x88b4('0x2c')]===_0x88b4('0x2d')&&typeof _0x4cece5[_0x88b4('0x2e')]===_0x88b4('0x2d');var _0x4192ce=_0x486f97[_0x88b4('0x2f')];var _0x501e4e=_0x4e3b8b?0x0:_0x4cece5[_0x88b4('0x2c')];var _0x810754=_0x4e3b8b?_0x486f97[_0x88b4('0x2f')]:_0x4cece5[_0x88b4('0x2c')]+_0x4cece5[_0x88b4('0x2e')];var _0x2503ba;if(_0x810754>=_0x4192ce){_0x810754=_0x4192ce;_0x2503ba=0xc8;}else{_0x2503ba=0xce;}_0x51c533[_0x88b4('0x2a')](_0x2503ba);return _0x51c533[_0x88b4('0x30')](_0x88b4('0x31'),_0x501e4e+'-'+_0x810754+'/'+_0x4192ce)[_0x88b4('0x2b')](_0x486f97);}return null;};}function patchUpdates(_0x4bac12){return function(_0x50ff0a){try{jsonpatch[_0x88b4('0x32')](_0x50ff0a,_0x4bac12,!![]);}catch(_0x433a0b){return BPromise[_0x88b4('0x33')](_0x433a0b);}return _0x50ff0a[_0x88b4('0x34')]();};}function saveUpdates(_0x18ae06,_0x1a0766){return function(_0x17b24f){if(_0x17b24f){return _0x17b24f[_0x88b4('0x35')](_0x18ae06)[_0x88b4('0x1f')](function(_0x2e115d){return _0x2e115d;});}return null;};}function removeEntity(_0x298566,_0x390180){return function(_0x51dbf6){if(_0x51dbf6){return _0x51dbf6[_0x88b4('0x36')]()[_0x88b4('0x1f')](function(){var _0x13758a=_0x51dbf6['get']({'plain':!![]});var _0xd4037='WhatsappAccounts';return db[_0x88b4('0x37')][_0x88b4('0x36')]({'where':{'type':_0xd4037,'resourceId':_0x13758a['id']}})[_0x88b4('0x1f')](function(){return _0x51dbf6;});})[_0x88b4('0x1f')](function(){_0x298566['status'](0xcc)[_0x88b4('0x38')]();});}};}function handleEntityNotFound(_0x429f4a,_0x580725){return function(_0x9fb7ba){if(!_0x9fb7ba){_0x429f4a['sendStatus'](0x194);}return _0x9fb7ba;};}function handleError(_0x5b81a5,_0x5891d5){_0x5891d5=_0x5891d5||0x1f4;return function(_0x59d61a){logger[_0x88b4('0x26')](_0x59d61a[_0x88b4('0x39')]);if(_0x59d61a[_0x88b4('0x3a')]){delete _0x59d61a['name'];}_0x5b81a5[_0x88b4('0x2a')](_0x5891d5)[_0x88b4('0x3b')](_0x59d61a);};}exports[_0x88b4('0x3c')]=function(_0x33f1da,_0x423b28){var _0x200426={'include':[{'model':db[_0x88b4('0x3d')],'as':_0x88b4('0x3e')}]},_0x26de99={},_0xf623f0={'count':0x0,'rows':[]};var _0x21063a=_[_0x88b4('0x3f')](db['WhatsappAccount'][_0x88b4('0x40')],function(_0x575e22){return{'name':_0x575e22[_0x88b4('0x41')],'type':_0x575e22[_0x88b4('0x42')][_0x88b4('0x43')]};});_0x26de99['model']=_[_0x88b4('0x3f')](_0x21063a,_0x88b4('0x3a'));_0x26de99[_0x88b4('0x44')]=_[_0x88b4('0x45')](_0x33f1da[_0x88b4('0x44')]);_0x26de99['filters']=_[_0x88b4('0x46')](_0x26de99[_0x88b4('0x47')],_0x26de99[_0x88b4('0x44')]);_0x200426['attributes']=_[_0x88b4('0x46')](_0x26de99[_0x88b4('0x47')],qs['fields'](_0x33f1da['query']['fields']));_0x200426[_0x88b4('0x48')]=_0x200426['attributes'][_0x88b4('0x49')]?_0x200426[_0x88b4('0x48')]:_0x26de99['model'];if(!_0x33f1da['query']['hasOwnProperty'](_0x88b4('0x4a'))){_0x200426[_0x88b4('0x2e')]=qs['limit'](_0x33f1da['query'][_0x88b4('0x2e')]);_0x200426[_0x88b4('0x2c')]=qs['offset'](_0x33f1da[_0x88b4('0x44')][_0x88b4('0x2c')]);}_0x200426[_0x88b4('0x4b')]=qs[_0x88b4('0x4c')](_0x33f1da[_0x88b4('0x44')]['sort']);_0x200426[_0x88b4('0x4d')]=qs[_0x88b4('0x4e')](_['pick'](_0x33f1da['query'],_0x26de99[_0x88b4('0x4e')]),_0x21063a);if(_0x33f1da[_0x88b4('0x44')][_0x88b4('0x4f')]){_0x200426[_0x88b4('0x4d')]=_[_0x88b4('0x50')](_0x200426[_0x88b4('0x4d')],{'$or':_[_0x88b4('0x3f')](_0x21063a,function(_0xc37da8){if(_0xc37da8['type']!==_0x88b4('0x51')){var _0x16e833={};_0x16e833[_0xc37da8[_0x88b4('0x3a')]]={'$like':'%'+_0x33f1da[_0x88b4('0x44')]['filter']+'%'};return _0x16e833;}})});}_0x200426=_[_0x88b4('0x50')]({},_0x200426,_0x33f1da[_0x88b4('0x52')]);var _0x14d22b={'where':_0x200426[_0x88b4('0x4d')]};return db[_0x88b4('0x53')][_0x88b4('0x2f')](_0x14d22b)[_0x88b4('0x1f')](function(_0xea59c1){_0xf623f0['count']=_0xea59c1;if(_0x33f1da[_0x88b4('0x44')]['includeAll']){_0x200426[_0x88b4('0x54')]=[{'all':!![]}];}return db[_0x88b4('0x53')][_0x88b4('0x55')](_0x200426);})['then'](function(_0x5a6028){_0xf623f0[_0x88b4('0x56')]=_0x5a6028;return _0xf623f0;})[_0x88b4('0x1f')](respondWithFilteredResult(_0x423b28,_0x200426))[_0x88b4('0x57')](handleError(_0x423b28,null));};exports[_0x88b4('0x58')]=function(_0x3dce22,_0x3f0868){var _0x2598f7={'raw':![],'where':{'id':_0x3dce22[_0x88b4('0x59')]['id']},'include':[{'model':db[_0x88b4('0x3d')],'as':_0x88b4('0x3e')}]},_0x14ac19={};_0x14ac19['model']=_['keys'](db['WhatsappAccount'][_0x88b4('0x40')]);_0x14ac19['query']=_[_0x88b4('0x45')](_0x3dce22['query']);_0x14ac19[_0x88b4('0x4e')]=_[_0x88b4('0x46')](_0x14ac19['model'],_0x14ac19[_0x88b4('0x44')]);_0x2598f7[_0x88b4('0x48')]=_['intersection'](_0x14ac19[_0x88b4('0x47')],qs[_0x88b4('0x5a')](_0x3dce22[_0x88b4('0x44')]['fields']));_0x2598f7[_0x88b4('0x48')]=_0x2598f7[_0x88b4('0x48')][_0x88b4('0x49')]?_0x2598f7[_0x88b4('0x48')]:_0x14ac19[_0x88b4('0x47')];if(_0x3dce22[_0x88b4('0x44')]['includeAll']){_0x2598f7[_0x88b4('0x54')]=[{'all':!![]}];}_0x2598f7=_[_0x88b4('0x50')]({},_0x2598f7,_0x3dce22[_0x88b4('0x52')]);return db[_0x88b4('0x53')][_0x88b4('0x5b')](_0x2598f7)[_0x88b4('0x1f')](handleEntityNotFound(_0x3f0868,null))['then'](respondWithResult(_0x3f0868,null))[_0x88b4('0x57')](handleError(_0x3f0868,null));};exports[_0x88b4('0x5c')]=function(_0x12838b,_0x2d6d60){return db[_0x88b4('0x53')][_0x88b4('0x5c')](_0x12838b['body'],{})[_0x88b4('0x1f')](function(_0x2230a3){var _0x318f2a=_0x12838b[_0x88b4('0x5d')]['get']({'plain':!![]});if(!_0x318f2a)throw new Error(_0x88b4('0x5e'));if(_0x318f2a[_0x88b4('0x5f')]==='user'){var _0x95d277=_0x2230a3[_0x88b4('0x60')]({'plain':!![]});var _0x35e226=_0x88b4('0x61');return db[_0x88b4('0x62')][_0x88b4('0x5b')]({'where':{'name':_0x35e226,'userProfileId':_0x318f2a[_0x88b4('0x63')]},'raw':!![]})['then'](function(_0x3f6b90){if(_0x3f6b90&&_0x3f6b90['autoAssociation']===0x0){return db[_0x88b4('0x37')][_0x88b4('0x5c')]({'name':_0x95d277['name'],'resourceId':_0x95d277['id'],'type':_0x3f6b90[_0x88b4('0x3a')],'sectionId':_0x3f6b90['id']},{})[_0x88b4('0x1f')](function(){return _0x2230a3;});}else{return _0x2230a3;}})['catch'](function(_0x410083){logger[_0x88b4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x410083);throw _0x410083;});}return _0x2230a3;})[_0x88b4('0x1f')](respondWithResult(_0x2d6d60,0xc9))[_0x88b4('0x57')](handleError(_0x2d6d60,null));};exports[_0x88b4('0x35')]=function(_0x34864f,_0x5d213c){if(_0x34864f[_0x88b4('0x64')]['id']){delete _0x34864f[_0x88b4('0x64')]['id'];}return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x34864f['params']['id']},'include':[{'model':db[_0x88b4('0x3d')],'as':_0x88b4('0x3e')}]})['then'](handleEntityNotFound(_0x5d213c,null))[_0x88b4('0x1f')](saveUpdates(_0x34864f[_0x88b4('0x64')],null))[_0x88b4('0x1f')](respondWithResult(_0x5d213c,null))['catch'](handleError(_0x5d213c,null));};exports['destroy']=function(_0x2a2cad,_0x5b1aa8){return db[_0x88b4('0x53')]['find']({'where':{'id':_0x2a2cad[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x5b1aa8,null))[_0x88b4('0x1f')](removeEntity(_0x5b1aa8,null))[_0x88b4('0x57')](handleError(_0x5b1aa8,null));};exports[_0x88b4('0x65')]=function(_0x24e7f1,_0x156604){return db['WhatsappAccount'][_0x88b4('0x65')]()[_0x88b4('0x1f')](respondWithResult(_0x156604,null))[_0x88b4('0x57')](handleError(_0x156604,null));};exports[_0x88b4('0x66')]=function(_0x2d1ee8,_0x23f4d3,_0x4b04d3){if(_0x2d1ee8[_0x88b4('0x64')]['id']){delete _0x2d1ee8['body']['id'];}return db['WhatsappAccount'][_0x88b4('0x5b')]({'where':{'id':_0x2d1ee8[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x23f4d3,null))['then'](function(_0x630b12){if(_0x630b12){_0x2d1ee8[_0x88b4('0x64')][_0x88b4('0x67')]=_0x630b12['id'];return db['Disposition']['create'](_0x2d1ee8[_0x88b4('0x64')]);}})[_0x88b4('0x1f')](respondWithResult(_0x23f4d3,null))[_0x88b4('0x57')](handleError(_0x23f4d3,null));};exports['getDispositions']=function(_0x5b4432,_0x455dba,_0x4a910e){var _0x120df6={'raw':![],'where':{}};var _0x51f772={};var _0x3e58bd={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5b4432[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x455dba,null))[_0x88b4('0x1f')](function(_0x450356){if(_0x450356){_0x51f772[_0x88b4('0x47')]=_[_0x88b4('0x45')](db['Disposition'][_0x88b4('0x40')]);_0x51f772[_0x88b4('0x44')]=_['keys'](_0x5b4432[_0x88b4('0x44')]);_0x51f772[_0x88b4('0x4e')]=_[_0x88b4('0x46')](_0x51f772[_0x88b4('0x47')],_0x51f772['query']);_0x120df6[_0x88b4('0x48')]=_[_0x88b4('0x46')](_0x51f772[_0x88b4('0x47')],qs[_0x88b4('0x5a')](_0x5b4432[_0x88b4('0x44')][_0x88b4('0x5a')]));_0x120df6[_0x88b4('0x48')]=_0x120df6[_0x88b4('0x48')]['length']?_0x120df6[_0x88b4('0x48')]:_0x51f772[_0x88b4('0x47')];if(!_0x5b4432[_0x88b4('0x44')][_0x88b4('0x68')](_0x88b4('0x4a'))){_0x120df6[_0x88b4('0x2e')]=qs['limit'](_0x5b4432[_0x88b4('0x44')][_0x88b4('0x2e')]);_0x120df6[_0x88b4('0x2c')]=qs[_0x88b4('0x2c')](_0x5b4432[_0x88b4('0x44')][_0x88b4('0x2c')]);}_0x120df6[_0x88b4('0x4b')]=qs[_0x88b4('0x4c')](_0x5b4432[_0x88b4('0x44')]['sort']);_0x120df6['where']=qs[_0x88b4('0x4e')](_[_0x88b4('0x69')](_0x5b4432[_0x88b4('0x44')],_0x51f772[_0x88b4('0x4e')]));_0x120df6['where'][_0x88b4('0x67')]=_0x450356['id'];if(_0x5b4432[_0x88b4('0x44')][_0x88b4('0x4f')]){_0x120df6['where']=_[_0x88b4('0x50')](_0x120df6['where'],{'$or':_['map'](_0x120df6[_0x88b4('0x48')],function(_0x13d5d2){var _0x2b2eea={};_0x2b2eea[_0x13d5d2]={'$like':'%'+_0x5b4432['query'][_0x88b4('0x4f')]+'%'};return _0x2b2eea;})});}_0x120df6=_[_0x88b4('0x50')]({},_0x120df6,_0x5b4432['options']);return db[_0x88b4('0x6a')][_0x88b4('0x2f')]({'where':_0x120df6[_0x88b4('0x4d')]})[_0x88b4('0x1f')](function(_0x15fb7f){_0x3e58bd[_0x88b4('0x2f')]=_0x15fb7f;if(_0x5b4432[_0x88b4('0x44')][_0x88b4('0x6b')]){_0x120df6[_0x88b4('0x54')]=[{'all':!![]}];}return db[_0x88b4('0x6a')][_0x88b4('0x55')](_0x120df6);})[_0x88b4('0x1f')](function(_0x43a56b){_0x3e58bd[_0x88b4('0x56')]=_0x43a56b;return _0x3e58bd;});}})[_0x88b4('0x1f')](respondWithFilteredResult(_0x455dba,_0x120df6))[_0x88b4('0x57')](handleError(_0x455dba,null));};exports['removeDispositions']=function(_0x248be9,_0x3240cb,_0x529e60){return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x248be9[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x3240cb,null))[_0x88b4('0x1f')](function(_0x163b73){if(_0x163b73){return _0x163b73[_0x88b4('0x6c')](_0x248be9[_0x88b4('0x44')][_0x88b4('0x6d')]);}})[_0x88b4('0x1f')](respondWithStatusCode(_0x3240cb,null))[_0x88b4('0x57')](handleError(_0x3240cb,null));};exports[_0x88b4('0x6e')]=function(_0x5e65f8,_0x441231,_0x42fc38){if(_0x5e65f8['body']['id']){delete _0x5e65f8[_0x88b4('0x64')]['id'];}return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x5e65f8['params']['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x441231,null))[_0x88b4('0x1f')](function(_0x5bee26){if(_0x5bee26){_0x5e65f8[_0x88b4('0x64')]['WhatsappAccountId']=_0x5bee26['id'];return db[_0x88b4('0x6f')][_0x88b4('0x5c')](_0x5e65f8[_0x88b4('0x64')]);}})[_0x88b4('0x1f')](respondWithResult(_0x441231,null))['catch'](handleError(_0x441231,null));};exports[_0x88b4('0x70')]=function(_0x51e257,_0x475bf8,_0xc9145f){var _0x21beee={'raw':![],'where':{}};var _0x430973={};var _0x56f32f={'count':0x0,'rows':[]};return db[_0x88b4('0x53')][_0x88b4('0x71')]({'where':{'id':_0x51e257['params']['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x475bf8,null))[_0x88b4('0x1f')](function(_0x4c53bb){if(_0x4c53bb){_0x430973[_0x88b4('0x47')]=_[_0x88b4('0x45')](db['CannedAnswer'][_0x88b4('0x40')]);_0x430973[_0x88b4('0x44')]=_[_0x88b4('0x45')](_0x51e257[_0x88b4('0x44')]);_0x430973[_0x88b4('0x4e')]=_[_0x88b4('0x46')](_0x430973[_0x88b4('0x47')],_0x430973[_0x88b4('0x44')]);_0x21beee[_0x88b4('0x48')]=_[_0x88b4('0x46')](_0x430973['model'],qs[_0x88b4('0x5a')](_0x51e257[_0x88b4('0x44')][_0x88b4('0x5a')]));_0x21beee[_0x88b4('0x48')]=_0x21beee['attributes'][_0x88b4('0x49')]?_0x21beee[_0x88b4('0x48')]:_0x430973[_0x88b4('0x47')];if(!_0x51e257['query'][_0x88b4('0x68')]('nolimit')){_0x21beee[_0x88b4('0x2e')]=qs[_0x88b4('0x2e')](_0x51e257[_0x88b4('0x44')][_0x88b4('0x2e')]);_0x21beee[_0x88b4('0x2c')]=qs[_0x88b4('0x2c')](_0x51e257[_0x88b4('0x44')][_0x88b4('0x2c')]);}_0x21beee[_0x88b4('0x4b')]=qs[_0x88b4('0x4c')](_0x51e257[_0x88b4('0x44')][_0x88b4('0x4c')]);_0x21beee[_0x88b4('0x4d')]=qs[_0x88b4('0x4e')](_['pick'](_0x51e257[_0x88b4('0x44')],_0x430973['filters']));_0x21beee[_0x88b4('0x4d')]['WhatsappAccountId']=_0x4c53bb['id'];if(_0x51e257[_0x88b4('0x44')][_0x88b4('0x4f')]){_0x21beee[_0x88b4('0x4d')]=_['merge'](_0x21beee['where'],{'$or':_[_0x88b4('0x3f')](_0x21beee[_0x88b4('0x48')],function(_0xbee0ce){var _0x5a5fc7={};_0x5a5fc7[_0xbee0ce]={'$like':'%'+_0x51e257[_0x88b4('0x44')][_0x88b4('0x4f')]+'%'};return _0x5a5fc7;})});}_0x21beee=_[_0x88b4('0x50')]({},_0x21beee,_0x51e257[_0x88b4('0x52')]);return db[_0x88b4('0x6f')][_0x88b4('0x2f')]({'where':_0x21beee[_0x88b4('0x4d')]})[_0x88b4('0x1f')](function(_0x124ace){_0x56f32f[_0x88b4('0x2f')]=_0x124ace;if(_0x51e257['query'][_0x88b4('0x6b')]){_0x21beee[_0x88b4('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x21beee);})[_0x88b4('0x1f')](function(_0x466266){_0x56f32f[_0x88b4('0x56')]=_0x466266;return _0x56f32f;});}})[_0x88b4('0x1f')](respondWithFilteredResult(_0x475bf8,_0x21beee))[_0x88b4('0x57')](handleError(_0x475bf8,null));};exports['removeAnswers']=function(_0x273b7d,_0x25ea86,_0x4ca2be){return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x273b7d[_0x88b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x25ea86,null))[_0x88b4('0x1f')](function(_0x59df72){if(_0x59df72){return _0x59df72[_0x88b4('0x72')](_0x273b7d[_0x88b4('0x44')][_0x88b4('0x6d')]);}})['then'](respondWithStatusCode(_0x25ea86,null))[_0x88b4('0x57')](handleError(_0x25ea86,null));};exports['addAgents']=function(_0x324ae9,_0x417a6d,_0x46808b){return db[_0x88b4('0x53')]['find']({'where':{'id':_0x324ae9['params']['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x417a6d,null))[_0x88b4('0x1f')](function(_0x1eff36){if(_0x1eff36){return _0x1eff36[_0x88b4('0x73')](_0x324ae9[_0x88b4('0x64')]['ids'],_[_0x88b4('0x74')](_0x324ae9['body'],[_0x88b4('0x6d'),'id'])||{})['spread'](function(_0x59b709){for(var _0xf40add=0x0;_0xf40add<_0x324ae9['body'][_0x88b4('0x6d')][_0x88b4('0x49')];_0xf40add+=0x1){socket[_0x88b4('0x75')](_0x88b4('0x76'),{'UserId':Number(_0x324ae9['body'][_0x88b4('0x6d')][_0xf40add]),'WhatsappAccountId':Number(_0x324ae9[_0x88b4('0x59')]['id'])});}return _0x59b709;});}})['then'](respondWithResult(_0x417a6d,null))['catch'](handleError(_0x417a6d,null));};exports[_0x88b4('0x77')]=function(_0x2aabb1,_0x3e4246,_0x435a95){return db['WhatsappAccount']['find']({'where':{'id':_0x2aabb1[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x3e4246,null))['then'](function(_0x5f2481){if(_0x5f2481){return _0x5f2481[_0x88b4('0x77')](_0x2aabb1[_0x88b4('0x44')][_0x88b4('0x6d')])[_0x88b4('0x1f')](function(){if(_[_0x88b4('0x78')](_0x2aabb1['query']['ids'])){for(var _0x4f08ea=0x0;_0x4f08ea<_0x2aabb1[_0x88b4('0x44')][_0x88b4('0x6d')][_0x88b4('0x49')];_0x4f08ea+=0x1){socket[_0x88b4('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2aabb1['query'][_0x88b4('0x6d')][_0x4f08ea]),'WhatsappAccountId':Number(_0x2aabb1[_0x88b4('0x59')]['id'])});}}else{socket[_0x88b4('0x75')](_0x88b4('0x79'),{'UserId':Number(_0x2aabb1['query'][_0x88b4('0x6d')]),'WhatsappAccountId':Number(_0x2aabb1[_0x88b4('0x59')]['id'])});}});}})[_0x88b4('0x1f')](respondWithStatusCode(_0x3e4246,null))[_0x88b4('0x57')](handleError(_0x3e4246,null));};exports[_0x88b4('0x7a')]=function(_0x5e12e0,_0x584f0e,_0x11f478){var _0x23e85e={};var _0xab635e={};var _0x40e085;var _0xda515d;return db[_0x88b4('0x53')][_0x88b4('0x71')]({'where':{'id':_0x5e12e0[_0x88b4('0x59')]['id']}})[_0x88b4('0x1f')](handleEntityNotFound(_0x584f0e,null))[_0x88b4('0x1f')](function(_0x5d91cc){if(_0x5d91cc){_0x40e085=_0x5d91cc;_0xab635e[_0x88b4('0x47')]=_[_0x88b4('0x45')](db[_0x88b4('0x7b')][_0x88b4('0x40')]);_0xab635e[_0x88b4('0x44')]=_[_0x88b4('0x45')](_0x5e12e0[_0x88b4('0x44')]);_0xab635e[_0x88b4('0x4e')]=_['intersection'](_0xab635e[_0x88b4('0x47')],_0xab635e['query']);_0x23e85e[_0x88b4('0x48')]=_[_0x88b4('0x46')](_0xab635e['model'],qs['fields'](_0x5e12e0[_0x88b4('0x44')][_0x88b4('0x5a')]));_0x23e85e[_0x88b4('0x48')]=_0x23e85e[_0x88b4('0x48')][_0x88b4('0x49')]?_0x23e85e[_0x88b4('0x48')]:_0xab635e[_0x88b4('0x47')];_0x23e85e[_0x88b4('0x4b')]=qs['sort'](_0x5e12e0[_0x88b4('0x44')][_0x88b4('0x4c')]);_0x23e85e[_0x88b4('0x4d')]=qs[_0x88b4('0x4e')](_['pick'](_0x5e12e0[_0x88b4('0x44')],_0xab635e['filters']));if(_0x5e12e0[_0x88b4('0x44')][_0x88b4('0x4f')]){_0x23e85e[_0x88b4('0x4d')]=_[_0x88b4('0x50')](_0x23e85e[_0x88b4('0x4d')],{'$or':_[_0x88b4('0x3f')](_0x23e85e[_0x88b4('0x48')],function(_0x273d3a){var _0xb220b7={};_0xb220b7[_0x273d3a]={'$like':'%'+_0x5e12e0['query'][_0x88b4('0x4f')]+'%'};return _0xb220b7;})});}_0x23e85e=_['merge']({},_0x23e85e,_0x5e12e0[_0x88b4('0x52')]);return _0x40e085['getAgents'](_0x23e85e);}})['then'](function(_0x500100){if(_0x500100){_0xda515d=_0x500100[_0x88b4('0x49')];if(!_0x5e12e0[_0x88b4('0x44')]['hasOwnProperty'](_0x88b4('0x4a'))){_0x23e85e['limit']=qs[_0x88b4('0x2e')](_0x5e12e0[_0x88b4('0x44')][_0x88b4('0x2e')]);_0x23e85e[_0x88b4('0x2c')]=qs['offset'](_0x5e12e0[_0x88b4('0x44')][_0x88b4('0x2c')]);}return _0x40e085['getAgents'](_0x23e85e);}})[_0x88b4('0x1f')](function(_0x393ef6){if(_0x393ef6){return _0x393ef6?{'count':_0xda515d,'rows':_0x393ef6}:null;}})[_0x88b4('0x1f')](respondWithResult(_0x584f0e,null))[_0x88b4('0x57')](handleError(_0x584f0e,null));};exports[_0x88b4('0x7c')]=function(_0x9edb55,_0xaf9102){var _0x31b8d8=_0x9edb55[_0x88b4('0x59')]['id'];var _0x82bb6a=_0x9edb55[_0x88b4('0x64')];var _0x524bbb=0xc8;var _0x2ca28d=null;return db[_0x88b4('0x7d')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x88b4('0x7e')][_0x88b4('0x7f')]},function(_0x119f5f){return db[_0x88b4('0x53')][_0x88b4('0x71')]({'where':{'id':_0x31b8d8},'transaction':_0x119f5f})['then'](function(_0x5ca34c){if(_0x5ca34c){return db[_0x88b4('0x80')][_0x88b4('0x36')]({'where':{'WhatsappAccountId':_0x31b8d8},'transaction':_0x119f5f})['then'](function(){var _0x45b11b=_[_0x88b4('0x3f')](_0x82bb6a,function(_0x2240f3){_0x2240f3[_0x88b4('0x67')]=_0x31b8d8;return _0x2240f3;});return db['WhatsappApplication'][_0x88b4('0x81')](_0x45b11b,{'transaction':_0x119f5f});});}else{_0x524bbb=0x194;_0x2ca28d=[];}});})[_0x88b4('0x1f')](function(){if(_0x524bbb!==0x194){return db[_0x88b4('0x80')][_0x88b4('0x82')]({'where':{'WhatsappAccountId':_0x31b8d8},'order':_0x88b4('0x83')})['then'](function(_0x16f7f2){_0x2ca28d=_0x16f7f2;});}})[_0x88b4('0x57')](function(_0x42ee5f){_0x524bbb=0x1f4;logger[_0x88b4('0x26')](_0x42ee5f['stack']);if(_0x42ee5f['name']){delete _0x42ee5f[_0x88b4('0x3a')];}_0x2ca28d=_0x42ee5f;})[_0x88b4('0x84')](function(){if(_0x2ca28d===null){_0xaf9102['sendStatus'](_0x524bbb);}else{if(_0x524bbb===0x1f4){_0xaf9102[_0x88b4('0x2a')](_0x524bbb)[_0x88b4('0x3b')](_0x2ca28d);}else{_0xaf9102[_0x88b4('0x2a')](_0x524bbb)['json'](_0x2ca28d);}}});};exports[_0x88b4('0x85')]=function(_0x22ebc8,_0x3c30e4,_0x4cc350){var _0x500b50={};var _0x5182bf={};var _0x5f4ba4;var _0x2de6c6;return db['WhatsappAccount'][_0x88b4('0x71')]({'where':{'id':_0x22ebc8[_0x88b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x3c30e4,null))[_0x88b4('0x1f')](function(_0x4e8f14){if(_0x4e8f14){_0x5f4ba4=_0x4e8f14;_0x5182bf[_0x88b4('0x47')]=_[_0x88b4('0x45')](db[_0x88b4('0x80')][_0x88b4('0x40')]);_0x5182bf[_0x88b4('0x44')]=_['keys'](_0x22ebc8[_0x88b4('0x44')]);_0x5182bf[_0x88b4('0x4e')]=_[_0x88b4('0x46')](_0x5182bf['model'],_0x5182bf[_0x88b4('0x44')]);_0x500b50[_0x88b4('0x48')]=_[_0x88b4('0x46')](_0x5182bf[_0x88b4('0x47')],qs[_0x88b4('0x5a')](_0x22ebc8[_0x88b4('0x44')][_0x88b4('0x5a')]));_0x500b50[_0x88b4('0x48')]=_0x500b50['attributes']['length']?_0x500b50[_0x88b4('0x48')]:_0x5182bf['model'];_0x500b50[_0x88b4('0x4b')]=qs[_0x88b4('0x4c')](_0x22ebc8[_0x88b4('0x44')][_0x88b4('0x4c')]);_0x500b50[_0x88b4('0x4d')]=qs[_0x88b4('0x4e')](_['pick'](_0x22ebc8[_0x88b4('0x44')],_0x5182bf[_0x88b4('0x4e')]));if(_0x22ebc8[_0x88b4('0x44')][_0x88b4('0x4f')]){_0x500b50[_0x88b4('0x4d')]=_[_0x88b4('0x50')](_0x500b50['where'],{'$or':_[_0x88b4('0x3f')](_0x500b50[_0x88b4('0x48')],function(_0x3bb47f){var _0x9fc27e={};_0x9fc27e[_0x3bb47f]={'$like':'%'+_0x22ebc8[_0x88b4('0x44')][_0x88b4('0x4f')]+'%'};return _0x9fc27e;})});}_0x500b50=_[_0x88b4('0x50')]({},_0x500b50,_0x22ebc8['options']);return _0x5f4ba4[_0x88b4('0x85')](_0x500b50);}})[_0x88b4('0x1f')](function(_0x48df4a){if(_0x48df4a){_0x2de6c6=_0x48df4a[_0x88b4('0x49')];if(!_0x22ebc8[_0x88b4('0x44')][_0x88b4('0x68')](_0x88b4('0x4a'))){_0x500b50[_0x88b4('0x2e')]=qs[_0x88b4('0x2e')](_0x22ebc8[_0x88b4('0x44')]['limit']);_0x500b50[_0x88b4('0x2c')]=qs[_0x88b4('0x2c')](_0x22ebc8[_0x88b4('0x44')]['offset']);}return _0x5f4ba4[_0x88b4('0x85')](_0x500b50);}})[_0x88b4('0x1f')](function(_0x2a304a){if(_0x2a304a){return _0x2a304a?{'count':_0x2de6c6,'rows':_0x2a304a}:null;}})[_0x88b4('0x1f')](respondWithResult(_0x3c30e4,null))['catch'](handleError(_0x3c30e4,null));};exports[_0x88b4('0x86')]=function(_0x104ec0,_0x4d8b55,_0x1b7d76){var _0x122862={'channel':_0x88b4('0x87')};var _0x2d3e8a=[];var _0x5b5ab5=[];var _0x2444d0={};return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x104ec0[_0x88b4('0x59')]['id']},'include':[{'model':db[_0x88b4('0x80')],'as':_0x88b4('0x88')}]})[_0x88b4('0x1f')](handleEntityNotFound(_0x4d8b55,null))[_0x88b4('0x1f')](function(_0x182a08){_0x122862[_0x88b4('0x89')]=_0x182a08;if(_0x122862[_0x88b4('0x89')]&&_0x122862[_0x88b4('0x89')][_0x88b4('0x42')]==='sinch'&&_0x104ec0[_0x88b4('0x64')]['statuses']){if(_0x104ec0[_0x88b4('0x64')][_0x88b4('0x8a')][_0x88b4('0x49')]===0x0)return;if(_0x104ec0[_0x88b4('0x64')][_0x88b4('0x8a')][0x0][_0x88b4('0x8b')]!==_0x88b4('0x8c'))return;return db[_0x88b4('0x8d')][_0x88b4('0x35')]({'read':!![],'readAt':_0x104ec0[_0x88b4('0x64')][_0x88b4('0x8a')][0x0][_0x88b4('0x8e')]},{'where':{'messageId':_0x104ec0['body'][_0x88b4('0x8a')][0x0][_0x88b4('0x8f')]},'individualHooks':!![]})[_0x88b4('0x1f')](function(_0xea4cff){return _0x4d8b55[_0x88b4('0x2a')](0xc8)['json'](_0xea4cff);});}_0x122862['applications']=_[_0x88b4('0x90')](_0x182a08[_0x88b4('0x88')],[_0x88b4('0x83')],[_0x88b4('0x91')]);if(_0x122862[_0x88b4('0x89')][_0x88b4('0x88')]){delete _0x122862[_0x88b4('0x89')]['Applications'];}return db['CmContact']['describe']()['then'](function(_0x4511db){if(!_0x4511db){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))](_0x88b4('0x94'));}_0x2d3e8a=_[_0x88b4('0x95')](_[_0x88b4('0x45')](_0x4511db),[_0x88b4('0x96'),_0x88b4('0x97')]);_0x5b5ab5=_[_0x88b4('0x95')](_['keys'](_0x4511db),[_0x88b4('0x96'),_0x88b4('0x97'),_0x88b4('0x98'),_0x88b4('0x99')]);_0x122862[_0x88b4('0x64')]={'mapKey':_0x88b4('0x9a')};if(_0x122862[_0x88b4('0x89')]&&_0x122862[_0x88b4('0x89')][_0x88b4('0x42')]===_0x88b4('0x9b')){_0x122862[_0x88b4('0x64')][_0x88b4('0x9c')]=_0x104ec0[_0x88b4('0x64')][_0x88b4('0x9d')][_0x88b4('0x9e')](_0x88b4('0x9f'),'');_0x122862[_0x88b4('0x64')][_0x88b4('0x64')]=_0x104ec0[_0x88b4('0x64')][_0x88b4('0xa0')];_0x122862['body'][_0x88b4('0xa1')]=_0x104ec0['body'][_0x88b4('0xa2')];}if(_0x122862[_0x88b4('0x89')]&&_0x122862[_0x88b4('0x89')]['type']==='sinch'){_0x122862['body']['from']=_0x104ec0['body'][_0x88b4('0xa3')][0x0][_0x88b4('0x9c')];_0x122862[_0x88b4('0x64')][_0x88b4('0x64')]=_0x104ec0['body'][_0x88b4('0xa3')][0x0][_0x88b4('0x27')][_0x88b4('0x64')];_0x122862[_0x88b4('0x64')]['messageId']=_0x104ec0[_0x88b4('0x64')]['notifications'][0x0][_0x88b4('0x8f')];}if(_0x122862[_0x88b4('0x64')]['id']){delete _0x122862['body']['id'];}if(_[_0x88b4('0xa4')](_0x122862[_0x88b4('0x64')][_0x88b4('0x9c')])){throw new db[(_0x88b4('0x92'))]['ValidationError'](_0x88b4('0xa5'));}if(_[_0x88b4('0xa4')](_0x122862[_0x88b4('0x64')][_0x88b4('0x64')])||_0x122862['body'][_0x88b4('0x64')]===''){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))](_0x88b4('0xa6'));}if(_[_0x88b4('0xa4')](_0x122862[_0x88b4('0x64')][_0x88b4('0xa7')])){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))](_0x88b4('0xa8')+_0x5b5ab5);}if(!_[_0x88b4('0xa9')](_0x5b5ab5,_0x122862['body'][_0x88b4('0xa7')])){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b5ab5);}_0x2444d0[_0x122862['body'][_0x88b4('0xa7')]]=_0x122862['body'][_0x88b4('0x9c')];return db[_0x88b4('0xaa')]['find']({'where':{'id':_0x122862['account'][_0x88b4('0x99')]},'include':[{'model':db['CmContact'],'as':_0x88b4('0xab'),'where':_0x2444d0,'limit':0x1,'order':[[_0x88b4('0x97'),_0x88b4('0xac')]]}]});})['then'](handleEntityNotFound(_0x4d8b55,null))[_0x88b4('0x1f')](function(_0x54f3f8){if(_0x54f3f8){_0x122862[_0x88b4('0xad')]=_[_0x88b4('0x74')](_0x54f3f8,[_0x88b4('0xab')]);if(_0x54f3f8[_0x88b4('0xab')][_0x88b4('0x49')]){return _0x54f3f8[_0x88b4('0xab')][0x0];}var _0x5695c4=_[_0x88b4('0x17')](_0x122862['body'],{'firstName':_0x122862['body'][_0x88b4('0x9c')],'ListId':_0x54f3f8['id']});_0x5695c4[_0x122862[_0x88b4('0x64')][_0x88b4('0xa7')]]=_0x122862[_0x88b4('0x64')][_0x88b4('0x9c')];return db['CmContact'][_0x88b4('0x5c')](_0x5695c4,{'fields':_0x2d3e8a,'raw':!![]});}})['then'](handleEntityNotFound(_0x4d8b55,null))[_0x88b4('0x1f')](function(_0x49d437){if(_0x49d437){_0x122862[_0x88b4('0xae')]=_0x49d437;var _0x26795d={'ContactId':_0x49d437['id'],'phone':_0x122862['body'][_0x88b4('0x9c')],'WhatsappAccountId':_0x104ec0[_0x88b4('0x59')]['id']};var _0x44bb48={'ContactId':_0x49d437['id'],'WhatsappAccountId':_0x104ec0[_0x88b4('0x59')]['id'],'closed':![]};return db[_0x88b4('0xaf')]['find']({'where':_0x44bb48})[_0x88b4('0x1f')](function(_0x4c62fe){if(_0x4c62fe){return[_0x4c62fe,![]];}return db[_0x88b4('0xaf')][_0x88b4('0x5c')](_0x26795d)[_0x88b4('0x1f')](function(_0x3f9682){return[_0x3f9682,!![]];});});}})[_0x88b4('0xb0')](function(_0x43c337,_0x2254da){_0x122862['interaction']=_0x43c337[_0x88b4('0x60')]({'plain':!![]});_0x122862['interaction'][_0x88b4('0xb1')]=![];if(_0x2254da){if(_0x122862[_0x88b4('0x89')]['autoclose']){_0x122862[_0x88b4('0xb2')][_0x88b4('0xb3')]({'id':0x0,'priority':_0x122862[_0x88b4('0xb2')][_0x88b4('0x49')]+0x1,'app':_0x88b4('0xb4'),'appdata':_0x88b4('0xb5'),'interval':_0x88b4('0xb6')});}_0x122862['interaction']['created']=!![];}return db['WhatsappMessage'][_0x88b4('0x5c')]({'phone':_0x122862['body'][_0x88b4('0x9c')],'messageId':_0x122862[_0x88b4('0x64')][_0x88b4('0xa1')],'body':_0x122862[_0x88b4('0x64')][_0x88b4('0x64')],'WhatsappAccountId':_0x104ec0['params']['id'],'WhatsappInteractionId':_0x43c337['id'],'direction':'in','ContactId':_0x43c337[_0x88b4('0xb7')],'AttachmentId':_0x122862['body']['AttachmentId']});})[_0x88b4('0x1f')](function(_0x487c54){_0x122862[_0x88b4('0x27')]=_0x487c54;if(_0x122862[_0x88b4('0xb8')][_0x88b4('0xb9')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x122862[_0x88b4('0xb8')]['UserId']}})[_0x88b4('0x1f')](function(_0x93ac61){if(_0x93ac61){_0x122862['applications'][_0x88b4('0xba')]({'id':0x0,'priority':0x0,'app':_0x88b4('0xbb'),'appdata':_0x93ac61['name']+','+(_0x122862[_0x88b4('0x89')][_0x88b4('0xbc')]||0xa),'interval':_0x88b4('0xb6')});}return respondWithRpcPromise(_0x88b4('0xbd'),_0x88b4('0xbe'),_0x122862);});}return respondWithRpcPromise(_0x88b4('0xbd'),_0x88b4('0xbe'),_0x122862);})[_0x88b4('0x1f')](function(_0x2d5f68){if(_0x2d5f68){var _0x22ad2b=0xc8;var _0x544d60=_0x88b4('0xbf');logger[_0x88b4('0x28')](_0x88b4('0x23'),_0x544d60,_0x22ad2b,_0x88b4('0xc0'));logger['debug'](_0x88b4('0xc1'),_0x544d60,_0x22ad2b,_0x88b4('0xc0'),JSON['stringify'](_0x2d5f68));if(_0x122862[_0x88b4('0x89')]['type']==='twilio'){return _0x4d8b55[_0x88b4('0x2a')](_0x22ad2b)[_0x88b4('0x30')](_0x88b4('0xc2'),_0x88b4('0xc3'))[_0x88b4('0x3b')](_0x88b4('0xc4'));}else{return _0x4d8b55[_0x88b4('0x2a')](_0x22ad2b)[_0x88b4('0x2b')](_0x2d5f68);}}});})[_0x88b4('0x57')](handleError(_0x4d8b55,null));};exports[_0x88b4('0x3b')]=function(_0x246fda,_0x5e6c7f,_0x194e4e){var _0x1efd78,_0xcfece2,_0x2fd87e;if(_[_0x88b4('0xa4')](_0x246fda['body']['body'])||_0x246fda[_0x88b4('0x64')][_0x88b4('0x64')]===''){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))](_0x88b4('0xa6'));}if(_[_0x88b4('0xa4')](_0x246fda[_0x88b4('0x64')]['to'])){throw new db[(_0x88b4('0x92'))][(_0x88b4('0x93'))](_0x88b4('0xc5'));}_0x1efd78=_0x246fda[_0x88b4('0x64')]['to'];return db[_0x88b4('0x53')][_0x88b4('0x5b')]({'where':{'id':_0x246fda['params']['id']},'include':[{'model':db['CmList'],'as':_0x88b4('0xc6'),'include':[{'model':db['CmContact'],'as':_0x88b4('0xab'),'where':{'mobile':_0x1efd78},'limit':0x1,'order':[[_0x88b4('0x97'),'DESC']]}]}]})[_0x88b4('0x1f')](handleEntityNotFound(_0x5e6c7f,null))[_0x88b4('0x1f')](function(_0x5405ec){if(_0x5405ec&&_0x5405ec[_0x88b4('0xc6')]){_0xcfece2=_0x5405ec[_0x88b4('0x60')]({'plain':!![]});if(_0xcfece2['List']&&_0xcfece2[_0x88b4('0xc6')][_0x88b4('0xab')][_0x88b4('0x49')]){return _0xcfece2[_0x88b4('0xc6')][_0x88b4('0xab')][0x0];}return db[_0x88b4('0xc7')][_0x88b4('0x5c')](_['defaults'](_0x246fda['body'],{'firstName':_0x1efd78,'mobile':_0x1efd78,'phone':_0x1efd78,'ListId':_0xcfece2[_0x88b4('0x99')]}));}})[_0x88b4('0x1f')](handleEntityNotFound(_0x5e6c7f,null))[_0x88b4('0x1f')](function(_0x33009f){if(_0x33009f){_0x2fd87e=_0x33009f;return db[_0x88b4('0xaf')][_0x88b4('0x5b')]({'where':{'ContactId':_0x2fd87e['id'],'closed':![],'WhatsappAccountId':_0xcfece2['id']}})[_0x88b4('0x1f')](function(_0x52439c){if(_0x52439c){return[_0x52439c,![]];}return db['WhatsappInteraction'][_0x88b4('0x5c')]({'UserId':_0x246fda[_0x88b4('0x5d')]['id'],'ContactId':_0x2fd87e['id'],'WhatsappAccountId':_0xcfece2['id'],'phone':_0x1efd78,'firstMsgDirection':_0x88b4('0xc8'),'Messages':[_['merge'](_0x246fda['body'],{'read':![],'body':_0x246fda['body'][_0x88b4('0x64')],'phone':_0x1efd78,'WhatsappAccountId':_0xcfece2['id'],'UserId':_0x246fda[_0x88b4('0x5d')]['id'],'ContactId':_0x2fd87e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x5ec770){return[_0x5ec770,!![]];});});}})[_0x88b4('0xb0')](function(_0x660729,_0x9d27f0){if(_0x9d27f0){return _0x660729;}return db[_0x88b4('0x8d')][_0x88b4('0x5c')](_['merge'](_0x246fda[_0x88b4('0x64')],{'read':![],'body':_0x246fda[_0x88b4('0x64')][_0x88b4('0x64')],'phone':_0x1efd78,'WhatsappAccountId':_0xcfece2['id'],'WhatsappInteractionId':_0x660729['id'],'UserId':_0x246fda['user']['id'],'ContactId':_0x2fd87e['id']}))[_0x88b4('0x1f')](function(_0x84273f){_0x660729[_0x88b4('0xc9')][_0x88b4('0xca')]=[];_0x660729[_0x88b4('0xc9')][_0x88b4('0xca')][_0x88b4('0xb3')](_0x84273f[_0x88b4('0xc9')]);return _0x660729;});})[_0x88b4('0x1f')](respondWithResult(_0x5e6c7f,null))[_0x88b4('0x57')](handleError(_0x5e6c7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 40c1578..2625b90 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 _0x10ec=['save','update','emit','hook','events','../../mysqldb','WhatsappAccount'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0x10ec,0x1d2));var _0xc10e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x10ec[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0xc10e('0x0'));var WhatsappAccount=require(_0xc10e('0x1'))['db'][_0xc10e('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc10e('0x3'),'afterUpdate':_0xc10e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190870){return function(_0x563e14,_0x9bc474,_0x112a07){WhatsappAccountEvents[_0xc10e('0x5')](_0x190870+':'+_0x563e14['id'],_0x563e14);WhatsappAccountEvents[_0xc10e('0x5')](_0x190870,_0x563e14);_0x112a07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xc10e('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x9392=['hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9392,0x110));var _0x2939=function(_0x6a71e7,_0x12933d){_0x6a71e7=_0x6a71e7-0x0;var _0x37d86b=_0x9392[_0x6a71e7];return _0x37d86b;};'use strict';var EventEmitter=require(_0x2939('0x0'));var WhatsappAccount=require(_0x2939('0x1'))['db'][_0x2939('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2939('0x3'),'afterUpdate':_0x2939('0x4'),'afterDestroy':_0x2939('0x5')};function emitEvent(_0x1c46c5){return function(_0x20c899,_0x3251c0,_0x20ed9f){WhatsappAccountEvents[_0x2939('0x6')](_0x1c46c5+':'+_0x20c899['id'],_0x20c899);WhatsappAccountEvents[_0x2939('0x6')](_0x1c46c5,_0x20c899);_0x20ed9f(null);};}for(var e in events){if(events[_0x2939('0x7')](e)){var event=events[e];WhatsappAccount[_0x2939('0x8')](e,emitEvent(event));}}module[_0x2939('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 2c00256..748cc24 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 _0x41a6=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2c7926,_0x17a9d3){var _0x37b1ea=function(_0x3ec7e0){while(--_0x3ec7e0){_0x2c7926['push'](_0x2c7926['shift']());}};_0x37b1ea(++_0x17a9d3);}(_0x41a6,0xae));var _0x641a=function(_0x46bf89,_0x2139c6){_0x46bf89=_0x46bf89-0x0;var _0x36bfd0=_0x41a6[_0x46bf89];return _0x36bfd0;};'use strict';var _=require(_0x641a('0x0'));var util=require(_0x641a('0x1'));var logger=require(_0x641a('0x2'))(_0x641a('0x3'));var moment=require(_0x641a('0x4'));var BPromise=require(_0x641a('0x5'));var rp=require(_0x641a('0x6'));var fs=require('fs');var path=require(_0x641a('0x7'));var rimraf=require(_0x641a('0x8'));var config=require(_0x641a('0x9'));var attributes=require(_0x641a('0xa'));module[_0x641a('0xb')]=function(_0x2e3199,_0x599e0f){return _0x2e3199[_0x641a('0xc')]('WhatsappAccount',attributes,{'tableName':_0x641a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd2=['whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x36025c,_0x17cd49){var _0x690bf3=function(_0x2181bc){while(--_0x2181bc){_0x36025c['push'](_0x36025c['shift']());}};_0x690bf3(++_0x17cd49);}(_0x9fd2,0xeb));var _0x29fd=function(_0x27b119,_0x57ccf9){_0x27b119=_0x27b119-0x0;var _0x3c7d9c=_0x9fd2[_0x27b119];return _0x3c7d9c;};'use strict';var _=require(_0x29fd('0x0'));var util=require('util');var logger=require(_0x29fd('0x1'))(_0x29fd('0x2'));var moment=require(_0x29fd('0x3'));var BPromise=require(_0x29fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29fd('0x5'));var rimraf=require(_0x29fd('0x6'));var config=require(_0x29fd('0x7'));var attributes=require(_0x29fd('0x8'));module[_0x29fd('0x9')]=function(_0x160781,_0x933e91){return _0x160781[_0x29fd('0xa')](_0x29fd('0xb'),attributes,{'tableName':_0x29fd('0xc'),'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 e691e69..cb3102c 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 _0xa9ed=['moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model','lodash'];(function(_0xad11b4,_0x1c6e20){var _0x3567f3=function(_0x21e71e){while(--_0x21e71e){_0xad11b4['push'](_0xad11b4['shift']());}};_0x3567f3(++_0x1c6e20);}(_0xa9ed,0x128));var _0xda9e=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0xa9ed[_0x322bef];return _0x229e60;};'use strict';var _=require(_0xda9e('0x0'));var util=require('util');var moment=require(_0xda9e('0x1'));var BPromise=require(_0xda9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda9e('0x3'));var db=require(_0xda9e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda9e('0x5'));var config=require(_0xda9e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xda9e('0x7')]['http']({'port':0x232a});config[_0xda9e('0x8')]=_[_0xda9e('0x9')](config[_0xda9e('0x8')],{'host':_0xda9e('0xa'),'port':0x18eb});var socket=require(_0xda9e('0xb'))(new Redis(config[_0xda9e('0x8')]));require(_0xda9e('0xc'))[_0xda9e('0xd')](socket);function respondWithRpcPromise(_0x2e745a,_0x92007f,_0x2f01c3){return new BPromise(function(_0x237365,_0x11c4a7){return client[_0xda9e('0xe')](_0x2e745a,_0x2f01c3)[_0xda9e('0xf')](function(_0x546b62){logger['info'](_0xda9e('0x10'),_0x92007f,_0xda9e('0x11'));logger[_0xda9e('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x92007f,_0xda9e('0x11'),JSON[_0xda9e('0x13')](_0x546b62));if(_0x546b62[_0xda9e('0x14')]){if(_0x546b62[_0xda9e('0x14')]['code']===0x1f4){logger[_0xda9e('0x14')](_0xda9e('0x10'),_0x92007f,_0x546b62[_0xda9e('0x14')]['message']);return _0x11c4a7(_0x546b62[_0xda9e('0x14')]['message']);}logger[_0xda9e('0x14')](_0xda9e('0x10'),_0x92007f,_0x546b62['error'][_0xda9e('0x15')]);return _0x237365(_0x546b62[_0xda9e('0x14')][_0xda9e('0x15')]);}else{logger[_0xda9e('0x16')](_0xda9e('0x10'),_0x92007f,_0xda9e('0x11'));_0x237365(_0x546b62[_0xda9e('0x17')][_0xda9e('0x15')]);}})[_0xda9e('0x18')](function(_0xa175a3){logger[_0xda9e('0x14')](_0xda9e('0x10'),_0x92007f,_0xa175a3);_0x11c4a7(_0xa175a3);});});}exports[_0xda9e('0x19')]=function(_0x2f3265){var _0x325b8f=this;return new Promise(function(_0x535126,_0x29232b){return db['WhatsappAccount'][_0xda9e('0x1a')]({'raw':_0x2f3265[_0xda9e('0x1b')]?_0x2f3265['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f3265['options']?_0x2f3265[_0xda9e('0x1b')][_0xda9e('0x1c')]||null:null,'attributes':_0x2f3265[_0xda9e('0x1b')]?_0x2f3265[_0xda9e('0x1b')][_0xda9e('0x1d')]||null:null,'include':_0x2f3265[_0xda9e('0x1b')]?_0x2f3265[_0xda9e('0x1b')][_0xda9e('0x1e')]?_[_0xda9e('0x1f')](_0x2f3265[_0xda9e('0x1b')][_0xda9e('0x1e')],function(_0x1f6d7a){return{'model':db[_0x1f6d7a[_0xda9e('0x20')]],'as':_0x1f6d7a['as'],'attributes':_0x1f6d7a[_0xda9e('0x1d')],'include':_0x1f6d7a[_0xda9e('0x1e')]?_[_0xda9e('0x1f')](_0x1f6d7a['include'],function(_0x360e64){return{'model':db[_0x360e64[_0xda9e('0x20')]],'as':_0x360e64['as'],'attributes':_0x360e64[_0xda9e('0x1d')],'include':_0x360e64[_0xda9e('0x1e')]?_[_0xda9e('0x1f')](_0x360e64[_0xda9e('0x1e')],function(_0x499987){return{'model':db[_0x499987[_0xda9e('0x20')]],'as':_0x499987['as'],'attributes':_0x499987[_0xda9e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xda9e('0xf')](function(_0x2e08f1){logger['info']('ShowWhatsappAccount',_0x2f3265);logger[_0xda9e('0x12')]('ShowWhatsappAccount',_0x2f3265,JSON[_0xda9e('0x13')](_0x2e08f1));_0x535126(_0x2e08f1);})['catch'](function(_0x100e25){logger[_0xda9e('0x14')](_0xda9e('0x19'),_0x100e25[_0xda9e('0x15')],_0x2f3265);_0x29232b(_0x325b8f[_0xda9e('0x14')](0x1f4,_0x100e25[_0xda9e('0x15')]));});});}; \ No newline at end of file +var _0x9deb=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','catch','WhatsappAccount','options','raw','where','attributes','include','model','ShowWhatsappAccount','lodash'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9deb,0xdf));var _0xb9de=function(_0x441fac,_0x3b7fd5){_0x441fac=_0x441fac-0x0;var _0x14b12e=_0x9deb[_0x441fac];return _0x14b12e;};'use strict';var _=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var moment=require(_0xb9de('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9de('0x3'));var fs=require('fs');var Redis=require(_0xb9de('0x4'));var db=require(_0xb9de('0x5'))['db'];var utils=require(_0xb9de('0x6'));var logger=require(_0xb9de('0x7'))('rpc');var config=require(_0xb9de('0x8'));var jayson=require(_0xb9de('0x9'));var client=jayson['client'][_0xb9de('0xa')]({'port':0x232a});config[_0xb9de('0xb')]=_['defaults'](config[_0xb9de('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9de('0xc'))(new Redis(config[_0xb9de('0xb')]));require('./whatsappAccount.socket')[_0xb9de('0xd')](socket);function respondWithRpcPromise(_0x1c9029,_0x443c39,_0x3ce511){return new BPromise(function(_0x1f2015,_0x391548){return client[_0xb9de('0xe')](_0x1c9029,_0x3ce511)[_0xb9de('0xf')](function(_0x2ca65d){logger[_0xb9de('0x10')](_0xb9de('0x11'),_0x443c39,_0xb9de('0x12'));logger[_0xb9de('0x13')](_0xb9de('0x14'),_0x443c39,'request\x20sent',JSON['stringify'](_0x2ca65d));if(_0x2ca65d[_0xb9de('0x15')]){if(_0x2ca65d[_0xb9de('0x15')]['code']===0x1f4){logger[_0xb9de('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x443c39,_0x2ca65d['error'][_0xb9de('0x16')]);return _0x391548(_0x2ca65d['error'][_0xb9de('0x16')]);}logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x443c39,_0x2ca65d[_0xb9de('0x15')]['message']);return _0x1f2015(_0x2ca65d[_0xb9de('0x15')]['message']);}else{logger['info'](_0xb9de('0x11'),_0x443c39,_0xb9de('0x12'));_0x1f2015(_0x2ca65d['result'][_0xb9de('0x16')]);}})[_0xb9de('0x17')](function(_0xea22f){logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x443c39,_0xea22f);_0x391548(_0xea22f);});});}exports['ShowWhatsappAccount']=function(_0x596d74){var _0x23fa66=this;return new Promise(function(_0x4e8938,_0x5d8051){return db[_0xb9de('0x18')]['find']({'raw':_0x596d74[_0xb9de('0x19')]?_0x596d74[_0xb9de('0x19')][_0xb9de('0x1a')]===undefined?!![]:![]:!![],'where':_0x596d74['options']?_0x596d74[_0xb9de('0x19')][_0xb9de('0x1b')]||null:null,'attributes':_0x596d74[_0xb9de('0x19')]?_0x596d74[_0xb9de('0x19')][_0xb9de('0x1c')]||null:null,'include':_0x596d74['options']?_0x596d74[_0xb9de('0x19')][_0xb9de('0x1d')]?_['map'](_0x596d74['options'][_0xb9de('0x1d')],function(_0x5ec08){return{'model':db[_0x5ec08[_0xb9de('0x1e')]],'as':_0x5ec08['as'],'attributes':_0x5ec08[_0xb9de('0x1c')],'include':_0x5ec08[_0xb9de('0x1d')]?_['map'](_0x5ec08['include'],function(_0x59de8f){return{'model':db[_0x59de8f['model']],'as':_0x59de8f['as'],'attributes':_0x59de8f[_0xb9de('0x1c')],'include':_0x59de8f[_0xb9de('0x1d')]?_['map'](_0x59de8f['include'],function(_0x2ab0ae){return{'model':db[_0x2ab0ae[_0xb9de('0x1e')]],'as':_0x2ab0ae['as'],'attributes':_0x2ab0ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9de('0xf')](function(_0x3787d1){logger[_0xb9de('0x10')]('ShowWhatsappAccount',_0x596d74);logger[_0xb9de('0x13')](_0xb9de('0x1f'),_0x596d74,JSON['stringify'](_0x3787d1));_0x4e8938(_0x3787d1);})['catch'](function(_0xcce7c2){logger[_0xb9de('0x15')](_0xb9de('0x1f'),_0xcce7c2[_0xb9de('0x16')],_0x596d74);_0x5d8051(_0x23fa66['error'](0x1f4,_0xcce7c2[_0xb9de('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0a4908f..938570c 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 _0xb733=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','length'];(function(_0x4a38c4,_0x296796){var _0x104854=function(_0x5081c0){while(--_0x5081c0){_0x4a38c4['push'](_0x4a38c4['shift']());}};_0x104854(++_0x296796);}(_0xb733,0xda));var _0x3b73=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb733[_0x5b644e];return _0x49c6bf;};'use strict';var WhatsappAccountEvents=require(_0x3b73('0x0'));var events=[_0x3b73('0x1'),_0x3b73('0x2'),'update'];function createListener(_0x2afd83,_0x2d25af){return function(_0x338cb9){_0x2d25af[_0x3b73('0x3')](_0x2afd83,_0x338cb9);};}function removeListener(_0x1edd5d,_0x1e7fbd){return function(){WhatsappAccountEvents[_0x3b73('0x4')](_0x1edd5d,_0x1e7fbd);};}exports['register']=function(_0x3fd903){for(var _0x3b5ea6=0x0,_0x50ba01=events[_0x3b73('0x5')];_0x3b5ea6<_0x50ba01;_0x3b5ea6++){var _0x2b92d6=events[_0x3b5ea6];var _0x83c958=createListener(_0x3b73('0x6')+_0x2b92d6,_0x3fd903);WhatsappAccountEvents['on'](_0x2b92d6,_0x83c958);}}; \ No newline at end of file +var _0x1af9=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x53d22f,_0x1ff245){var _0x2a3497=function(_0x386a65){while(--_0x386a65){_0x53d22f['push'](_0x53d22f['shift']());}};_0x2a3497(++_0x1ff245);}(_0x1af9,0x161));var _0x91af=function(_0x19711d,_0x5b284f){_0x19711d=_0x19711d-0x0;var _0x343f0f=_0x1af9[_0x19711d];return _0x343f0f;};'use strict';var WhatsappAccountEvents=require(_0x91af('0x0'));var events=[_0x91af('0x1'),_0x91af('0x2'),'update'];function createListener(_0x1bc12b,_0x35cb0f){return function(_0x27ac4e){_0x35cb0f[_0x91af('0x3')](_0x1bc12b,_0x27ac4e);};}function removeListener(_0x66f5bc,_0x276e42){return function(){WhatsappAccountEvents[_0x91af('0x4')](_0x66f5bc,_0x276e42);};}exports[_0x91af('0x5')]=function(_0x182bd8){for(var _0x40998c=0x0,_0xfa739b=events[_0x91af('0x6')];_0x40998c<_0xfa739b;_0x40998c++){var _0x455272=events[_0x40998c];var _0xb56e2b=createListener(_0x91af('0x7')+_0x455272,_0x182bd8);WhatsappAccountEvents['on'](_0x455272,_0xb56e2b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9ec0c2a..b35d509 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 _0x81c4=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','util','path','express'];(function(_0x384fbc,_0x11696f){var _0x2b7827=function(_0x33ee67){while(--_0x33ee67){_0x384fbc['push'](_0x384fbc['shift']());}};_0x2b7827(++_0x11696f);}(_0x81c4,0xce));var _0x481c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81c4[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x481c('0x0'));var path=require(_0x481c('0x1'));var timeout=require('connect-timeout');var express=require(_0x481c('0x2'));var router=express[_0x481c('0x3')]();var fs_extra=require(_0x481c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x481c('0x5'));var config=require(_0x481c('0x6'));var controller=require(_0x481c('0x7'));router[_0x481c('0x8')]('/',auth[_0x481c('0x9')](),controller[_0x481c('0xa')]);router[_0x481c('0x8')]('/:id',auth[_0x481c('0x9')](),controller[_0x481c('0xb')]);router[_0x481c('0xc')]('/',auth[_0x481c('0x9')](),controller[_0x481c('0xd')]);router[_0x481c('0xe')](_0x481c('0xf'),auth[_0x481c('0x9')](),controller['update']);router[_0x481c('0x10')](_0x481c('0xf'),auth[_0x481c('0x9')](),controller[_0x481c('0x11')]);module[_0x481c('0x12')]=router; \ No newline at end of file +var _0xa070=['Router','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','connect-timeout'];(function(_0x5ead88,_0x304d8f){var _0x25c938=function(_0x3af305){while(--_0x3af305){_0x5ead88['push'](_0x5ead88['shift']());}};_0x25c938(++_0x304d8f);}(_0xa070,0x187));var _0x0a07=function(_0x4ccec0,_0x58031e){_0x4ccec0=_0x4ccec0-0x0;var _0x34403e=_0xa070[_0x4ccec0];return _0x34403e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0a07('0x0'));var express=require('express');var router=express[_0x0a07('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a07('0x2'));var controller=require(_0x0a07('0x3'));router[_0x0a07('0x4')]('/',auth[_0x0a07('0x5')](),controller[_0x0a07('0x6')]);router[_0x0a07('0x4')](_0x0a07('0x7'),auth[_0x0a07('0x5')](),controller[_0x0a07('0x8')]);router[_0x0a07('0x9')]('/',auth[_0x0a07('0x5')](),controller[_0x0a07('0xa')]);router[_0x0a07('0xb')](_0x0a07('0x7'),auth[_0x0a07('0x5')](),controller['update']);router[_0x0a07('0xc')]('/:id',auth[_0x0a07('0x5')](),controller['destroy']);module[_0x0a07('0xd')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ea0676a..526340b 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 _0x4637=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4637,0x163));var _0x7463=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x4637[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x7463('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7463('0x1')],'allowNull':![],'defaultValue':_0x7463('0x2')},'appdata':{'type':Sequelize[_0x7463('0x3')]()},'description':{'type':Sequelize[_0x7463('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7463('0x4')}}; \ No newline at end of file +var _0x0b22=['*,*,*,*','exports','INTEGER','noop','TEXT','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0b22,0x181));var _0x20b2=function(_0x582038,_0x52887c){_0x582038=_0x582038-0x0;var _0x554ea1=_0x0b22[_0x582038];return _0x554ea1;};'use strict';var Sequelize=require('sequelize');module[_0x20b2('0x0')]={'priority':{'type':Sequelize[_0x20b2('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20b2('0x2')},'appdata':{'type':Sequelize[_0x20b2('0x3')]()},'description':{'type':Sequelize[_0x20b2('0x4')]},'interval':{'type':Sequelize[_0x20b2('0x4')],'defaultValue':_0x20b2('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1973380..5756ce1 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 _0x753c=['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','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x753c,0x96));var _0xc753=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x753c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc753('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc753('0x1'));var rp=require(_0xc753('0x2'));var moment=require(_0xc753('0x3'));var BPromise=require(_0xc753('0x4'));var Mustache=require(_0xc753('0x5'));var util=require(_0xc753('0x6'));var path=require(_0xc753('0x7'));var sox=require(_0xc753('0x8'));var csv=require(_0xc753('0x9'));var ejs=require(_0xc753('0xa'));var fs=require('fs');var fs_extra=require(_0xc753('0xb'));var _=require(_0xc753('0xc'));var squel=require(_0xc753('0xd'));var crypto=require(_0xc753('0xe'));var jsforce=require(_0xc753('0xf'));var deskjs=require(_0xc753('0x10'));var toCsv=require(_0xc753('0x9'));var querystring=require(_0xc753('0x11'));var Papa=require(_0xc753('0x12'));var Redis=require(_0xc753('0x13'));var authService=require(_0xc753('0x14'));var qs=require(_0xc753('0x15'));var as=require(_0xc753('0x16'));var hardwareService=require(_0xc753('0x17'));var logger=require('../../config/logger')(_0xc753('0x18'));var utils=require(_0xc753('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc753('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d11b,_0x2da5d3){_0x2da5d3=_0x2da5d3||0xcc;return function(_0x2c166e){if(_0x2c166e){return _0x40d11b['sendStatus'](_0x2da5d3);}return _0x40d11b[_0xc753('0x1b')](_0x2da5d3)['end']();};}function respondWithResult(_0x75d1d1,_0x4ce76e){_0x4ce76e=_0x4ce76e||0xc8;return function(_0x3cdf79){if(_0x3cdf79){return _0x75d1d1[_0xc753('0x1b')](_0x4ce76e)[_0xc753('0x1c')](_0x3cdf79);}};}function respondWithFilteredResult(_0x15b777,_0x4650ed){return function(_0x4fae9f){if(_0x4fae9f){var _0x1d4558=typeof _0x4650ed[_0xc753('0x1d')]===_0xc753('0x1e')&&typeof _0x4650ed[_0xc753('0x1f')]===_0xc753('0x1e');var _0x2757cc=_0x4fae9f[_0xc753('0x20')];var _0x387fbf=_0x1d4558?0x0:_0x4650ed['offset'];var _0x941d22=_0x1d4558?_0x4fae9f[_0xc753('0x20')]:_0x4650ed[_0xc753('0x1d')]+_0x4650ed[_0xc753('0x1f')];var _0x23c46a;if(_0x941d22>=_0x2757cc){_0x941d22=_0x2757cc;_0x23c46a=0xc8;}else{_0x23c46a=0xce;}_0x15b777[_0xc753('0x1b')](_0x23c46a);return _0x15b777[_0xc753('0x21')](_0xc753('0x22'),_0x387fbf+'-'+_0x941d22+'/'+_0x2757cc)[_0xc753('0x1c')](_0x4fae9f);}return null;};}function patchUpdates(_0x3ae4e1){return function(_0xdd43a0){try{jsonpatch[_0xc753('0x23')](_0xdd43a0,_0x3ae4e1,!![]);}catch(_0x464e6a){return BPromise[_0xc753('0x24')](_0x464e6a);}return _0xdd43a0[_0xc753('0x25')]();};}function saveUpdates(_0x9899e6,_0x4f167b){return function(_0x2c04d4){if(_0x2c04d4){return _0x2c04d4[_0xc753('0x26')](_0x9899e6)['then'](function(_0x512d9c){return _0x512d9c;});}return null;};}function removeEntity(_0x2b8ed4,_0x3aeda8){return function(_0x44847a){if(_0x44847a){return _0x44847a[_0xc753('0x27')]()[_0xc753('0x28')](function(){_0x2b8ed4['status'](0xcc)[_0xc753('0x29')]();});}};}function handleEntityNotFound(_0x254687,_0xcadec1){return function(_0x77a2a0){if(!_0x77a2a0){_0x254687[_0xc753('0x2a')](0x194);}return _0x77a2a0;};}function handleError(_0x4d6cf4,_0xbacda1){_0xbacda1=_0xbacda1||0x1f4;return function(_0x50c907){logger[_0xc753('0x2b')](_0x50c907[_0xc753('0x2c')]);if(_0x50c907[_0xc753('0x2d')]){delete _0x50c907[_0xc753('0x2d')];}_0x4d6cf4['status'](_0xbacda1)[_0xc753('0x2e')](_0x50c907);};}exports[_0xc753('0x2f')]=function(_0x5d03bb,_0x20bf00){var _0x5b487e={},_0xed387e={},_0x5a39e2={'count':0x0,'rows':[]};var _0x5ec317=_[_0xc753('0x30')](db[_0xc753('0x31')]['rawAttributes'],function(_0x3ad96f){return{'name':_0x3ad96f[_0xc753('0x32')],'type':_0x3ad96f[_0xc753('0x33')][_0xc753('0x34')]};});_0xed387e[_0xc753('0x35')]=_['map'](_0x5ec317,_0xc753('0x2d'));_0xed387e['query']=_[_0xc753('0x36')](_0x5d03bb[_0xc753('0x37')]);_0xed387e[_0xc753('0x38')]=_['intersection'](_0xed387e[_0xc753('0x35')],_0xed387e[_0xc753('0x37')]);_0x5b487e[_0xc753('0x39')]=_[_0xc753('0x3a')](_0xed387e[_0xc753('0x35')],qs[_0xc753('0x3b')](_0x5d03bb[_0xc753('0x37')][_0xc753('0x3b')]));_0x5b487e['attributes']=_0x5b487e[_0xc753('0x39')][_0xc753('0x3c')]?_0x5b487e[_0xc753('0x39')]:_0xed387e['model'];if(!_0x5d03bb[_0xc753('0x37')]['hasOwnProperty'](_0xc753('0x3d'))){_0x5b487e[_0xc753('0x1f')]=qs[_0xc753('0x1f')](_0x5d03bb[_0xc753('0x37')][_0xc753('0x1f')]);_0x5b487e[_0xc753('0x1d')]=qs[_0xc753('0x1d')](_0x5d03bb[_0xc753('0x37')][_0xc753('0x1d')]);}_0x5b487e['order']=qs[_0xc753('0x3e')](_0x5d03bb['query']['sort']);_0x5b487e[_0xc753('0x3f')]=qs[_0xc753('0x38')](_['pick'](_0x5d03bb[_0xc753('0x37')],_0xed387e[_0xc753('0x38')]),_0x5ec317);if(_0x5d03bb[_0xc753('0x37')][_0xc753('0x40')]){_0x5b487e[_0xc753('0x3f')]=_[_0xc753('0x41')](_0x5b487e[_0xc753('0x3f')],{'$or':_['map'](_0x5ec317,function(_0x5aab6b){if(_0x5aab6b[_0xc753('0x33')]!==_0xc753('0x42')){var _0x13d3c4={};_0x13d3c4[_0x5aab6b['name']]={'$like':'%'+_0x5d03bb[_0xc753('0x37')]['filter']+'%'};return _0x13d3c4;}})});}_0x5b487e=_[_0xc753('0x41')]({},_0x5b487e,_0x5d03bb[_0xc753('0x43')]);var _0x4047e2={'where':_0x5b487e[_0xc753('0x3f')]};return db['WhatsappApplication'][_0xc753('0x20')](_0x4047e2)[_0xc753('0x28')](function(_0x4227ee){_0x5a39e2['count']=_0x4227ee;if(_0x5d03bb['query'][_0xc753('0x44')]){_0x5b487e[_0xc753('0x45')]=[{'all':!![]}];}return db[_0xc753('0x31')][_0xc753('0x46')](_0x5b487e);})['then'](function(_0x4daaef){_0x5a39e2[_0xc753('0x47')]=_0x4daaef;return _0x5a39e2;})['then'](respondWithFilteredResult(_0x20bf00,_0x5b487e))[_0xc753('0x48')](handleError(_0x20bf00,null));};exports[_0xc753('0x49')]=function(_0xb8f412,_0x2c5635){var _0x442a3f={'raw':!![],'where':{'id':_0xb8f412[_0xc753('0x4a')]['id']}},_0x594b04={};_0x594b04[_0xc753('0x35')]=_[_0xc753('0x36')](db[_0xc753('0x31')][_0xc753('0x4b')]);_0x594b04[_0xc753('0x37')]=_['keys'](_0xb8f412[_0xc753('0x37')]);_0x594b04[_0xc753('0x38')]=_[_0xc753('0x3a')](_0x594b04[_0xc753('0x35')],_0x594b04[_0xc753('0x37')]);_0x442a3f[_0xc753('0x39')]=_[_0xc753('0x3a')](_0x594b04[_0xc753('0x35')],qs['fields'](_0xb8f412[_0xc753('0x37')][_0xc753('0x3b')]));_0x442a3f[_0xc753('0x39')]=_0x442a3f[_0xc753('0x39')]['length']?_0x442a3f[_0xc753('0x39')]:_0x594b04[_0xc753('0x35')];if(_0xb8f412[_0xc753('0x37')][_0xc753('0x44')]){_0x442a3f['include']=[{'all':!![]}];}_0x442a3f=_[_0xc753('0x41')]({},_0x442a3f,_0xb8f412['options']);return db[_0xc753('0x31')]['find'](_0x442a3f)['then'](handleEntityNotFound(_0x2c5635,null))['then'](respondWithResult(_0x2c5635,null))[_0xc753('0x48')](handleError(_0x2c5635,null));};exports[_0xc753('0x4c')]=function(_0xeb38b7,_0x3a912a){return db[_0xc753('0x31')][_0xc753('0x4c')](_0xeb38b7[_0xc753('0x4d')],{})[_0xc753('0x28')](respondWithResult(_0x3a912a,0xc9))['catch'](handleError(_0x3a912a,null));};exports[_0xc753('0x26')]=function(_0x15eb1f,_0x30cb15){if(_0x15eb1f[_0xc753('0x4d')]['id']){delete _0x15eb1f[_0xc753('0x4d')]['id'];}return db[_0xc753('0x31')]['find']({'where':{'id':_0x15eb1f['params']['id']}})[_0xc753('0x28')](handleEntityNotFound(_0x30cb15,null))[_0xc753('0x28')](saveUpdates(_0x15eb1f[_0xc753('0x4d')],null))['then'](respondWithResult(_0x30cb15,null))[_0xc753('0x48')](handleError(_0x30cb15,null));};exports[_0xc753('0x27')]=function(_0x2e0786,_0x820d63){return db['WhatsappApplication'][_0xc753('0x4e')]({'where':{'id':_0x2e0786[_0xc753('0x4a')]['id']}})['then'](handleEntityNotFound(_0x820d63,null))[_0xc753('0x28')](removeEntity(_0x820d63,null))[_0xc753('0x48')](handleError(_0x820d63,null));}; \ No newline at end of file +var _0x2432=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','query','filters','intersection','attributes','fields','model','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x553f90,_0x1513ae){var _0x574956=function(_0xf10bd){while(--_0xf10bd){_0x553f90['push'](_0x553f90['shift']());}};_0x574956(++_0x1513ae);}(_0x2432,0x7a));var _0x2243=function(_0x5ef24e,_0x34ce29){_0x5ef24e=_0x5ef24e-0x0;var _0x200985=_0x2432[_0x5ef24e];return _0x200985;};'use strict';var emlformat=require(_0x2243('0x0'));var rimraf=require(_0x2243('0x1'));var zipdir=require(_0x2243('0x2'));var jsonpatch=require(_0x2243('0x3'));var rp=require('request-promise');var moment=require(_0x2243('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2243('0x5'));var util=require(_0x2243('0x6'));var path=require(_0x2243('0x7'));var sox=require(_0x2243('0x8'));var csv=require(_0x2243('0x9'));var ejs=require(_0x2243('0xa'));var fs=require('fs');var fs_extra=require(_0x2243('0xb'));var _=require(_0x2243('0xc'));var squel=require(_0x2243('0xd'));var crypto=require('crypto');var jsforce=require(_0x2243('0xe'));var deskjs=require(_0x2243('0xf'));var toCsv=require(_0x2243('0x9'));var querystring=require(_0x2243('0x10'));var Papa=require(_0x2243('0x11'));var Redis=require(_0x2243('0x12'));var authService=require(_0x2243('0x13'));var qs=require(_0x2243('0x14'));var as=require(_0x2243('0x15'));var hardwareService=require(_0x2243('0x16'));var logger=require(_0x2243('0x17'))(_0x2243('0x18'));var utils=require(_0x2243('0x19'));var config=require(_0x2243('0x1a'));var licenseUtil=require(_0x2243('0x1b'));var db=require(_0x2243('0x1c'))['db'];function respondWithStatusCode(_0x4b5ec5,_0x214433){_0x214433=_0x214433||0xcc;return function(_0x13c2a2){if(_0x13c2a2){return _0x4b5ec5[_0x2243('0x1d')](_0x214433);}return _0x4b5ec5[_0x2243('0x1e')](_0x214433)['end']();};}function respondWithResult(_0x436262,_0x496e30){_0x496e30=_0x496e30||0xc8;return function(_0x328104){if(_0x328104){return _0x436262['status'](_0x496e30)[_0x2243('0x1f')](_0x328104);}};}function respondWithFilteredResult(_0x6da2e2,_0x20e2cf){return function(_0x3388bc){if(_0x3388bc){var _0x4ebd4a=typeof _0x20e2cf['offset']===_0x2243('0x20')&&typeof _0x20e2cf[_0x2243('0x21')]===_0x2243('0x20');var _0xaac77c=_0x3388bc[_0x2243('0x22')];var _0x2595f0=_0x4ebd4a?0x0:_0x20e2cf[_0x2243('0x23')];var _0x3c8bb9=_0x4ebd4a?_0x3388bc[_0x2243('0x22')]:_0x20e2cf[_0x2243('0x23')]+_0x20e2cf[_0x2243('0x21')];var _0x4a1dc2;if(_0x3c8bb9>=_0xaac77c){_0x3c8bb9=_0xaac77c;_0x4a1dc2=0xc8;}else{_0x4a1dc2=0xce;}_0x6da2e2[_0x2243('0x1e')](_0x4a1dc2);return _0x6da2e2[_0x2243('0x24')](_0x2243('0x25'),_0x2595f0+'-'+_0x3c8bb9+'/'+_0xaac77c)['json'](_0x3388bc);}return null;};}function patchUpdates(_0x7818cf){return function(_0x14ed4f){try{jsonpatch[_0x2243('0x26')](_0x14ed4f,_0x7818cf,!![]);}catch(_0x17b976){return BPromise[_0x2243('0x27')](_0x17b976);}return _0x14ed4f[_0x2243('0x28')]();};}function saveUpdates(_0x518bfe,_0x45d4b7){return function(_0x36b1d4){if(_0x36b1d4){return _0x36b1d4[_0x2243('0x29')](_0x518bfe)[_0x2243('0x2a')](function(_0x28c6c4){return _0x28c6c4;});}return null;};}function removeEntity(_0x3424fc,_0x54d51d){return function(_0x3e64c9){if(_0x3e64c9){return _0x3e64c9[_0x2243('0x2b')]()[_0x2243('0x2a')](function(){_0x3424fc[_0x2243('0x1e')](0xcc)[_0x2243('0x2c')]();});}};}function handleEntityNotFound(_0x522d82,_0xedbc67){return function(_0x4d5935){if(!_0x4d5935){_0x522d82['sendStatus'](0x194);}return _0x4d5935;};}function handleError(_0xada872,_0x1153c4){_0x1153c4=_0x1153c4||0x1f4;return function(_0x4b0e0f){logger[_0x2243('0x2d')](_0x4b0e0f[_0x2243('0x2e')]);if(_0x4b0e0f['name']){delete _0x4b0e0f[_0x2243('0x2f')];}_0xada872[_0x2243('0x1e')](_0x1153c4)[_0x2243('0x30')](_0x4b0e0f);};}exports[_0x2243('0x31')]=function(_0x4e3acf,_0x21b3e0){var _0x2ad941={},_0x39d436={},_0x2d523a={'count':0x0,'rows':[]};var _0x8525d7=_[_0x2243('0x32')](db[_0x2243('0x33')][_0x2243('0x34')],function(_0x20f3a3){return{'name':_0x20f3a3['fieldName'],'type':_0x20f3a3[_0x2243('0x35')]['key']};});_0x39d436['model']=_[_0x2243('0x32')](_0x8525d7,_0x2243('0x2f'));_0x39d436[_0x2243('0x36')]=_['keys'](_0x4e3acf[_0x2243('0x36')]);_0x39d436[_0x2243('0x37')]=_[_0x2243('0x38')](_0x39d436['model'],_0x39d436[_0x2243('0x36')]);_0x2ad941[_0x2243('0x39')]=_[_0x2243('0x38')](_0x39d436['model'],qs['fields'](_0x4e3acf[_0x2243('0x36')][_0x2243('0x3a')]));_0x2ad941[_0x2243('0x39')]=_0x2ad941[_0x2243('0x39')]['length']?_0x2ad941[_0x2243('0x39')]:_0x39d436[_0x2243('0x3b')];if(!_0x4e3acf[_0x2243('0x36')]['hasOwnProperty'](_0x2243('0x3c'))){_0x2ad941[_0x2243('0x21')]=qs[_0x2243('0x21')](_0x4e3acf[_0x2243('0x36')]['limit']);_0x2ad941[_0x2243('0x23')]=qs[_0x2243('0x23')](_0x4e3acf[_0x2243('0x36')][_0x2243('0x23')]);}_0x2ad941[_0x2243('0x3d')]=qs['sort'](_0x4e3acf[_0x2243('0x36')][_0x2243('0x3e')]);_0x2ad941[_0x2243('0x3f')]=qs[_0x2243('0x37')](_[_0x2243('0x40')](_0x4e3acf[_0x2243('0x36')],_0x39d436[_0x2243('0x37')]),_0x8525d7);if(_0x4e3acf[_0x2243('0x36')][_0x2243('0x41')]){_0x2ad941[_0x2243('0x3f')]=_['merge'](_0x2ad941[_0x2243('0x3f')],{'$or':_['map'](_0x8525d7,function(_0x27ccba){if(_0x27ccba[_0x2243('0x35')]!==_0x2243('0x42')){var _0x49482a={};_0x49482a[_0x27ccba['name']]={'$like':'%'+_0x4e3acf[_0x2243('0x36')][_0x2243('0x41')]+'%'};return _0x49482a;}})});}_0x2ad941=_[_0x2243('0x43')]({},_0x2ad941,_0x4e3acf[_0x2243('0x44')]);var _0x21240b={'where':_0x2ad941[_0x2243('0x3f')]};return db[_0x2243('0x33')][_0x2243('0x22')](_0x21240b)[_0x2243('0x2a')](function(_0x34063f){_0x2d523a[_0x2243('0x22')]=_0x34063f;if(_0x4e3acf['query'][_0x2243('0x45')]){_0x2ad941[_0x2243('0x46')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2243('0x47')](_0x2ad941);})['then'](function(_0x4063ab){_0x2d523a[_0x2243('0x48')]=_0x4063ab;return _0x2d523a;})[_0x2243('0x2a')](respondWithFilteredResult(_0x21b3e0,_0x2ad941))[_0x2243('0x49')](handleError(_0x21b3e0,null));};exports[_0x2243('0x4a')]=function(_0xba54cc,_0x5a8b94){var _0x3d39ce={'raw':!![],'where':{'id':_0xba54cc[_0x2243('0x4b')]['id']}},_0xa2872c={};_0xa2872c[_0x2243('0x3b')]=_[_0x2243('0x4c')](db[_0x2243('0x33')]['rawAttributes']);_0xa2872c[_0x2243('0x36')]=_[_0x2243('0x4c')](_0xba54cc[_0x2243('0x36')]);_0xa2872c[_0x2243('0x37')]=_['intersection'](_0xa2872c[_0x2243('0x3b')],_0xa2872c['query']);_0x3d39ce[_0x2243('0x39')]=_[_0x2243('0x38')](_0xa2872c['model'],qs['fields'](_0xba54cc['query']['fields']));_0x3d39ce[_0x2243('0x39')]=_0x3d39ce['attributes'][_0x2243('0x4d')]?_0x3d39ce[_0x2243('0x39')]:_0xa2872c[_0x2243('0x3b')];if(_0xba54cc[_0x2243('0x36')][_0x2243('0x45')]){_0x3d39ce[_0x2243('0x46')]=[{'all':!![]}];}_0x3d39ce=_[_0x2243('0x43')]({},_0x3d39ce,_0xba54cc['options']);return db[_0x2243('0x33')][_0x2243('0x4e')](_0x3d39ce)[_0x2243('0x2a')](handleEntityNotFound(_0x5a8b94,null))['then'](respondWithResult(_0x5a8b94,null))[_0x2243('0x49')](handleError(_0x5a8b94,null));};exports[_0x2243('0x4f')]=function(_0x3f0b79,_0x409e44){return db[_0x2243('0x33')][_0x2243('0x4f')](_0x3f0b79[_0x2243('0x50')],{})[_0x2243('0x2a')](respondWithResult(_0x409e44,0xc9))[_0x2243('0x49')](handleError(_0x409e44,null));};exports[_0x2243('0x29')]=function(_0x4150a8,_0x490fb2){if(_0x4150a8[_0x2243('0x50')]['id']){delete _0x4150a8['body']['id'];}return db[_0x2243('0x33')]['find']({'where':{'id':_0x4150a8[_0x2243('0x4b')]['id']}})[_0x2243('0x2a')](handleEntityNotFound(_0x490fb2,null))['then'](saveUpdates(_0x4150a8['body'],null))[_0x2243('0x2a')](respondWithResult(_0x490fb2,null))[_0x2243('0x49')](handleError(_0x490fb2,null));};exports[_0x2243('0x2b')]=function(_0x5e06b2,_0x25a25a){return db[_0x2243('0x33')]['find']({'where':{'id':_0x5e06b2[_0x2243('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25a25a,null))[_0x2243('0x2a')](removeEntity(_0x25a25a,null))['catch'](handleError(_0x25a25a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 96e5e7f..f1b5e7c 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 _0x3e9d=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x46d0ac,_0x46e43e){var _0x6cfc12=function(_0x2fb4bd){while(--_0x2fb4bd){_0x46d0ac['push'](_0x46d0ac['shift']());}};_0x6cfc12(++_0x46e43e);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x16f594,_0x2322e4){_0x16f594=_0x16f594-0x0;var _0x1b017d=_0x3e9d[_0x16f594];return _0x1b017d;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var logger=require('../../config/logger')(_0xd3e9('0x2'));var moment=require(_0xd3e9('0x3'));var BPromise=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3e9('0x6'));var attributes=require(_0xd3e9('0x7'));module[_0xd3e9('0x8')]=function(_0x3dea0a,_0x568eea){return _0x3dea0a['define'](_0xd3e9('0x9'),attributes,{'tableName':_0xd3e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd3e9('0xb'),'collate':_0xd3e9('0xc')});}; \ No newline at end of file +var _0x5c37=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_applications','lodash','util'];(function(_0x1a032c,_0x2ce656){var _0xa50cca=function(_0x4012a8){while(--_0x4012a8){_0x1a032c['push'](_0x1a032c['shift']());}};_0xa50cca(++_0x2ce656);}(_0x5c37,0x11e));var _0x75c3=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x5c37[_0x264d4d];return _0xc917e2;};'use strict';var _=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var logger=require(_0x75c3('0x2'))(_0x75c3('0x3'));var moment=require(_0x75c3('0x4'));var BPromise=require(_0x75c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75c3('0x6'));var rimraf=require(_0x75c3('0x7'));var config=require(_0x75c3('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x75c3('0x9')]=function(_0xbbeb0d,_0x19dc3b){return _0xbbeb0d[_0x75c3('0xa')]('WhatsappApplication',attributes,{'tableName':_0x75c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 708d439..1dec95e 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x404d14,_0x57e3c3){var _0x134ef5=function(_0x5cedfb){while(--_0x5cedfb){_0x404d14['push'](_0x404d14['shift']());}};_0x134ef5(++_0x57e3c3);}(_0x81bd,0x7c));var _0xd81b=function(_0x514c5e,_0x8c0875){_0x514c5e=_0x514c5e-0x0;var _0x34c3e6=_0x81bd[_0x514c5e];return _0x34c3e6;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x29af9c,_0xe09414){var _0x57d077=function(_0x171770){while(--_0x171770){_0x29af9c['push'](_0x29af9c['shift']());}};_0x57d077(++_0xe09414);}(_0x4bc3,0x16e));var _0x34bc=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x4bc3[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a22d612..5ad66f2 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 _0xabce=['show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','update','/:id','whatsapp','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x364a3a,_0x5b4fe4){var _0x17fef8=function(_0x1e7ef9){while(--_0x1e7ef9){_0x364a3a['push'](_0x364a3a['shift']());}};_0x17fef8(++_0x5b4fe4);}(_0xabce,0x103));var _0xeabc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xabce[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x10')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x10')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addMessage']);router[_0xeabc('0x10')](_0xeabc('0x12'),auth[_0xeabc('0x8')](),interaction['tracked']('whatsapp',_0xeabc('0x13')),controller[_0xeabc('0x14')]);router[_0xeabc('0x15')]('/:id',auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xeabc('0x17')]);router['delete'](_0xeabc('0x18'),auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')](_0xeabc('0x19'),_0xeabc('0x1a')),controller[_0xeabc('0x1b')]);router[_0xeabc('0x1c')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x326f=['./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','whatsapp','put','/:id','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d1e26,_0x2bb21b){var _0x5ca67d=function(_0x20d5c3){while(--_0x20d5c3){_0x1d1e26['push'](_0x1d1e26['shift']());}};_0x5ca67d(++_0x2bb21b);}(_0x326f,0xd1));var _0xf326=function(_0x254bd2,_0x45ee3d){_0x254bd2=_0x254bd2-0x0;var _0x98d313=_0x326f[_0x254bd2];return _0x98d313;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['post']('/',auth[_0xf326('0xa')](),controller['create']);router[_0xf326('0x12')](_0xf326('0xe'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x12')](_0xf326('0x14'),auth[_0xf326('0xa')](),interaction['tracked'](_0xf326('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xf326('0x16')](_0xf326('0x17'),auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x19')),controller[_0xf326('0x1a')]);router[_0xf326('0x1b')]('/:id',auth[_0xf326('0xa')](),interaction[_0xf326('0x18')](_0xf326('0x15'),_0xf326('0x1c')),controller[_0xf326('0x1d')]);router[_0xf326('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xf326('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3e21e62..c9d0d60 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 _0x0bde=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x212ba2,_0x1c729d){var _0x13095b=function(_0x369d11){while(--_0x369d11){_0x212ba2['push'](_0x212ba2['shift']());}};_0x13095b(++_0x1c729d);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe0bd('0x0'));var moment=require('moment');module[_0xe0bd('0x1')]={'closed':{'type':Sequelize[_0xe0bd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe0bd('0x3')]},'secondDisposition':{'type':Sequelize[_0xe0bd('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe0bd('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe0bd('0x3')]},'read1stAt':{'type':Sequelize[_0xe0bd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe0bd('0x5')]('in',_0xe0bd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe0bd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe0bd('0x5')]('in',_0xe0bd('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe0bd('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6379=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x49da28,_0xb84cdd){var _0x298fca=function(_0x413093){while(--_0x413093){_0x49da28['push'](_0x49da28['shift']());}};_0x298fca(++_0xb84cdd);}(_0x6379,0x84));var _0x9637=function(_0x11da31,_0x5d576f){_0x11da31=_0x11da31-0x0;var _0x6bb4c8=_0x6379[_0x11da31];return _0x6bb4c8;};'use strict';var Sequelize=require(_0x9637('0x0'));var moment=require(_0x9637('0x1'));module[_0x9637('0x2')]={'closed':{'type':Sequelize[_0x9637('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9637('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9637('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9637('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9637('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9637('0x6')]('in',_0x9637('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9637('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9637('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 07aeec7..2c7269a 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 _0xe90f=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','findAll','whatsapp','query','user','catch','params','model','keys','rawAttributes','filters','attributes','fields','length','includeAll','merge','options','create','body','find','destroy','addMessage','WhatsappMessage','ids','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','download','unix','toString','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','mkdirSync','Whatsapp','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','value','views','createPdfFromHTML','log','err','unlinkSync','rimraf','bluebird','path','ejs'];(function(_0x2c2deb,_0x1f22e3){var _0x4ad087=function(_0x5f164c){while(--_0x5f164c){_0x2c2deb['push'](_0x2c2deb['shift']());}};_0x4ad087(++_0x1f22e3);}(_0xe90f,0x78));var _0xfe90=function(_0xf99903,_0x296cb4){_0xf99903=_0xf99903-0x0;var _0x231e5e=_0xe90f[_0xf99903];return _0x231e5e;};'use strict';var rimraf=require(_0xfe90('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xfe90('0x1'));var util=require('util');var path=require(_0xfe90('0x2'));var ejs=require(_0xfe90('0x3'));var fs=require('fs');var _=require(_0xfe90('0x4'));var Redis=require(_0xfe90('0x5'));var interaction=require(_0xfe90('0x6'));var qs=require(_0xfe90('0x7'));var pdf=require(_0xfe90('0x8'));var logger=require(_0xfe90('0x9'))(_0xfe90('0xa'));var config=require('../../config/environment');var db=require(_0xfe90('0xb'))['db'];config['redis']=_['defaults'](config[_0xfe90('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe90('0xd'))(new Redis(config[_0xfe90('0xc')]));require('./whatsappInteraction.socket')[_0xfe90('0xe')](socket);function respondWithStatusCode(_0x1eab11,_0x8aa349){_0x8aa349=_0x8aa349||0xcc;return function(_0x4a1060){if(_0x4a1060){return _0x1eab11[_0xfe90('0xf')](_0x8aa349);}return _0x1eab11[_0xfe90('0x10')](_0x8aa349)[_0xfe90('0x11')]();};}function respondWithResult(_0x3b58c3,_0x470812){_0x470812=_0x470812||0xc8;return function(_0x323d20){if(_0x323d20){return _0x3b58c3[_0xfe90('0x10')](_0x470812)[_0xfe90('0x12')](_0x323d20);}};}function respondWithFilteredResult(_0x24e6f1,_0x32aa24){return function(_0x3f9d3c){if(_0x3f9d3c){var _0x636adf=typeof _0x32aa24[_0xfe90('0x13')]===_0xfe90('0x14')&&typeof _0x32aa24[_0xfe90('0x15')]===_0xfe90('0x14');var _0xc2cd25=_0x3f9d3c[_0xfe90('0x16')];var _0x1057c9=_0x636adf?0x0:_0x32aa24[_0xfe90('0x13')];var _0x5cab89=_0x636adf?_0x3f9d3c[_0xfe90('0x16')]:_0x32aa24['offset']+_0x32aa24[_0xfe90('0x15')];var _0x394e2a;if(_0x5cab89>=_0xc2cd25){_0x5cab89=_0xc2cd25;_0x394e2a=0xc8;}else{_0x394e2a=0xce;}_0x24e6f1['status'](_0x394e2a);return _0x24e6f1['set'](_0xfe90('0x17'),_0x1057c9+'-'+_0x5cab89+'/'+_0xc2cd25)[_0xfe90('0x12')](_0x3f9d3c);}return null;};}function saveUpdates(_0x36e828){return function(_0x7c8854){if(_0x7c8854){return _0x7c8854[_0xfe90('0x18')](_0x36e828)[_0xfe90('0x19')](function(_0x5d2c5f){return _0x5d2c5f;});}return null;};}function removeEntity(_0x454131){return function(_0x245251){if(_0x245251){return _0x245251['destroy']()[_0xfe90('0x19')](function(){_0x454131[_0xfe90('0x10')](0xcc)[_0xfe90('0x11')]();});}};}function handleEntityNotFound(_0x4146b1){return function(_0x28d851){if(!_0x28d851){_0x4146b1[_0xfe90('0xf')](0x194);}return _0x28d851;};}function handleError(_0x141da9,_0x40b71c){_0x40b71c=_0x40b71c||0x1f4;return function(_0x555a67){logger[_0xfe90('0x1a')](_0x555a67[_0xfe90('0x1b')]);if(_0x555a67[_0xfe90('0x1c')]){delete _0x555a67[_0xfe90('0x1c')];}_0x141da9[_0xfe90('0x10')](_0x40b71c)[_0xfe90('0x1d')](_0x555a67);};}exports[_0xfe90('0x1e')]=function(_0x516646,_0x52ae8e){var _0x39d1e6={};var _0x56f18e=_[_0xfe90('0x1f')](db[_0xfe90('0x20')]['rawAttributes'],function(_0x1d5be2){return{'name':_0x1d5be2[_0xfe90('0x21')],'type':_0x1d5be2[_0xfe90('0x22')][_0xfe90('0x23')]};});_0x39d1e6=qs['getOptions'](_0x56f18e,_0x516646);return interaction[_0xfe90('0x24')](_0xfe90('0x25'),_0x516646[_0xfe90('0x26')],_0x516646[_0xfe90('0x27')],_0x39d1e6,_0x56f18e)['then'](respondWithFilteredResult(_0x52ae8e,_0x39d1e6))[_0xfe90('0x28')](handleError(_0x52ae8e,null));};exports['show']=function(_0x409e53,_0xb32eec){var _0x4d2653={'raw':![],'where':{'id':_0x409e53[_0xfe90('0x29')]['id']}},_0x51994b={};_0x51994b[_0xfe90('0x2a')]=_[_0xfe90('0x2b')](db['WhatsappInteraction'][_0xfe90('0x2c')]);_0x51994b[_0xfe90('0x26')]=_[_0xfe90('0x2b')](_0x409e53[_0xfe90('0x26')]);_0x51994b[_0xfe90('0x2d')]=_['intersection'](_0x51994b[_0xfe90('0x2a')],_0x51994b['query']);_0x4d2653[_0xfe90('0x2e')]=_['intersection'](_0x51994b[_0xfe90('0x2a')],qs[_0xfe90('0x2f')](_0x409e53[_0xfe90('0x26')][_0xfe90('0x2f')]));_0x4d2653[_0xfe90('0x2e')]=_0x4d2653[_0xfe90('0x2e')][_0xfe90('0x30')]?_0x4d2653['attributes']:_0x51994b[_0xfe90('0x2a')];if(_0x409e53[_0xfe90('0x26')][_0xfe90('0x31')]){_0x4d2653['include']=[{'all':!![]}];}_0x4d2653=_[_0xfe90('0x32')]({},_0x4d2653,_0x409e53[_0xfe90('0x33')]);return db[_0xfe90('0x20')]['find'](_0x4d2653)[_0xfe90('0x19')](handleEntityNotFound(_0xb32eec,null))[_0xfe90('0x19')](respondWithResult(_0xb32eec,null))[_0xfe90('0x28')](handleError(_0xb32eec,null));};exports[_0xfe90('0x34')]=function(_0x3397c4,_0x5b7427){return db[_0xfe90('0x20')][_0xfe90('0x34')](_0x3397c4['body'],{})['then'](respondWithResult(_0x5b7427,0xc9))[_0xfe90('0x28')](handleError(_0x5b7427,null));};exports['update']=function(_0x111d25,_0x5a36f1){if(_0x111d25[_0xfe90('0x35')]['id']){delete _0x111d25[_0xfe90('0x35')]['id'];}return db['WhatsappInteraction'][_0xfe90('0x36')]({'where':{'id':_0x111d25['params']['id']}})[_0xfe90('0x19')](handleEntityNotFound(_0x5a36f1,null))[_0xfe90('0x19')](saveUpdates(_0x111d25[_0xfe90('0x35')],null))[_0xfe90('0x19')](respondWithResult(_0x5a36f1,null))['catch'](handleError(_0x5a36f1,null));};exports[_0xfe90('0x37')]=function(_0x3fdc91,_0x5c5b72){return db[_0xfe90('0x20')]['find']({'where':{'id':_0x3fdc91[_0xfe90('0x29')]['id']}})[_0xfe90('0x19')](handleEntityNotFound(_0x5c5b72,null))['then'](removeEntity(_0x5c5b72,null))['catch'](handleError(_0x5c5b72,null));};exports['describe']=function(_0x25b914,_0x5cb1ef){return db[_0xfe90('0x20')]['describe']()[_0xfe90('0x19')](respondWithResult(_0x5cb1ef,null))[_0xfe90('0x28')](handleError(_0x5cb1ef,null));};exports[_0xfe90('0x38')]=function(_0x4ce650,_0x4c7e67){return db[_0xfe90('0x39')][_0xfe90('0x36')]({'where':{'id':_0x4ce650[_0xfe90('0x29')]['id']}})[_0xfe90('0x19')](handleEntityNotFound(_0x4c7e67,null))[_0xfe90('0x19')](function(_0x24d9ca){if(_0x24d9ca){return _0x24d9ca[_0xfe90('0x38')](_0x4ce650['body'][_0xfe90('0x3a')],_['omit'](_0x4ce650[_0xfe90('0x35')],[_0xfe90('0x3a'),'id'])||{});}})[_0xfe90('0x19')](respondWithResult(_0x4c7e67,null))[_0xfe90('0x28')](handleError(_0x4c7e67,null));};exports[_0xfe90('0x3b')]=function(_0x100eb2,_0x29af9c){var _0x30e15e={'raw':![],'where':{}};var _0x556867={};var _0x1c698b={'count':0x0,'rows':[]};return db[_0xfe90('0x20')]['findOne']({'where':{'id':_0x100eb2[_0xfe90('0x29')]['id']}})[_0xfe90('0x19')](handleEntityNotFound(_0x29af9c,null))[_0xfe90('0x19')](function(_0x5b8bac){if(_0x5b8bac){_0x556867[_0xfe90('0x2a')]=_[_0xfe90('0x2b')](db['WhatsappMessage'][_0xfe90('0x2c')]);_0x556867[_0xfe90('0x26')]=_[_0xfe90('0x2b')](_0x100eb2[_0xfe90('0x26')]);_0x556867['filters']=_[_0xfe90('0x3c')](_0x556867['model'],_0x556867[_0xfe90('0x26')]);_0x30e15e[_0xfe90('0x2e')]=_[_0xfe90('0x3c')](_0x556867['model'],qs[_0xfe90('0x2f')](_0x100eb2[_0xfe90('0x26')][_0xfe90('0x2f')]));_0x30e15e[_0xfe90('0x2e')]=_0x30e15e['attributes']['length']?_0x30e15e[_0xfe90('0x2e')]:_0x556867['model'];if(!_0x100eb2[_0xfe90('0x26')][_0xfe90('0x3d')](_0xfe90('0x3e'))){_0x30e15e[_0xfe90('0x15')]=qs[_0xfe90('0x15')](_0x100eb2['query']['limit']);_0x30e15e['offset']=qs[_0xfe90('0x13')](_0x100eb2[_0xfe90('0x26')][_0xfe90('0x13')]);}_0x30e15e[_0xfe90('0x3f')]=qs[_0xfe90('0x40')](_0x100eb2[_0xfe90('0x26')][_0xfe90('0x40')]);_0x30e15e[_0xfe90('0x41')]=qs[_0xfe90('0x2d')](_[_0xfe90('0x42')](_0x100eb2[_0xfe90('0x26')],_0x556867[_0xfe90('0x2d')]));_0x30e15e[_0xfe90('0x41')][_0xfe90('0x43')]=_0x5b8bac['id'];if(_0x100eb2['query'][_0xfe90('0x44')]){_0x30e15e[_0xfe90('0x41')]=_[_0xfe90('0x32')](_0x30e15e[_0xfe90('0x41')],{'$or':_['map'](_0x30e15e[_0xfe90('0x2e')],function(_0x47ce9a){var _0x35260f={};_0x35260f[_0x47ce9a]={'$like':'%'+_0x100eb2['query'][_0xfe90('0x44')]+'%'};return _0x35260f;})});}if(_0x100eb2[_0xfe90('0x26')][_0xfe90('0x45')]){var _0x4065e7=_0x100eb2[_0xfe90('0x26')]['$gte']['split'](',');var _0xc90419={};_0xc90419[_0x4065e7[0x0]]={'$gte':moment(_0x4065e7[0x1])['format'](_0xfe90('0x46'))};_0x30e15e[_0xfe90('0x41')]=_[_0xfe90('0x32')](_0x30e15e['where'],_0xc90419);}_0x30e15e=_[_0xfe90('0x32')]({},_0x30e15e,_0x100eb2[_0xfe90('0x33')]);return db[_0xfe90('0x39')][_0xfe90('0x16')]({'where':_0x30e15e['where']})['then'](function(_0x45a028){_0x1c698b[_0xfe90('0x16')]=_0x45a028;if(_0x100eb2[_0xfe90('0x26')][_0xfe90('0x31')]){_0x30e15e[_0xfe90('0x47')]=[{'all':!![]}];}return db[_0xfe90('0x39')][_0xfe90('0x24')](_0x30e15e);})[_0xfe90('0x19')](function(_0x1a87f9){_0x1c698b[_0xfe90('0x48')]=_0x1a87f9;return _0x1c698b;});}})[_0xfe90('0x19')](respondWithFilteredResult(_0x29af9c,_0x30e15e))[_0xfe90('0x28')](handleError(_0x29af9c,null));};exports[_0xfe90('0x49')]=function(_0x454f0d,_0x251497){return db[_0xfe90('0x20')][_0xfe90('0x36')]({'where':{'id':_0x454f0d[_0xfe90('0x29')]['id']}})[_0xfe90('0x19')](handleEntityNotFound(_0x251497,null))[_0xfe90('0x19')](function(_0x320d5f){if(_0x320d5f){return _0x320d5f[_0xfe90('0x4a')](_0x454f0d[_0xfe90('0x35')][_0xfe90('0x3a')],_[_0xfe90('0x4b')](_0x454f0d[_0xfe90('0x35')],['ids','id'])||{})[_0xfe90('0x4c')](function(){return db[_0xfe90('0x4d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x454f0d[_0xfe90('0x35')][_0xfe90('0x3a')]}});})[_0xfe90('0x19')](function(_0x519197){socket[_0xfe90('0x4e')](_0xfe90('0x4f'),{'id':Number(_0x454f0d['params']['id']),'tags':_0x519197||[]});return{'id':Number(_0x454f0d[_0xfe90('0x29')]['id']),'tags':_0x519197||[]};});}})[_0xfe90('0x19')](respondWithResult(_0x251497,null))[_0xfe90('0x28')](handleError(_0x251497,null));};exports['removeTags']=function(_0x5ef9b3,_0x233ff5){return db[_0xfe90('0x20')][_0xfe90('0x36')]({'where':{'id':_0x5ef9b3['params']['id']}})['then'](handleEntityNotFound(_0x233ff5,null))[_0xfe90('0x19')](function(_0x578a87){if(_0x578a87){return _0x578a87['removeTags'](_0x5ef9b3[_0xfe90('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x233ff5,null))[_0xfe90('0x28')](handleError(_0x233ff5,null));};exports[_0xfe90('0x50')]=function(_0x1c1fb8,_0x45c493){var _0xd675e4=moment()[_0xfe90('0x51')]()[_0xfe90('0x52')]();var _0x128489=path[_0xfe90('0x53')](config[_0xfe90('0x54')],_0xfe90('0x55'),'files',_0xfe90('0x56'));var _0x275c07=path[_0xfe90('0x53')](config[_0xfe90('0x54')],_0xfe90('0x55'),_0xfe90('0x57'),_0xfe90('0x58'));var _0x58a3a7=path[_0xfe90('0x53')](_0x128489,_0xd675e4);var _0x26491b=util[_0xfe90('0x59')](_0xfe90('0x5a'),_0x1c1fb8[_0xfe90('0x29')]['id'],_0xd675e4);var _0x4b990f=path[_0xfe90('0x53')](_0x128489,_0x26491b);var _0x40cfbe=[];_0x40cfbe['push']({'model':db[_0xfe90('0x5b')],'as':_0xfe90('0x5b'),'attributes':['id',_0xfe90('0x5c')],'raw':!![]});_0x40cfbe[_0xfe90('0x5d')]({'model':db[_0xfe90('0x5e')],'as':_0xfe90('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1c1fb8[_0xfe90('0x26')][_0xfe90('0x58')]){_0x40cfbe[_0xfe90('0x5d')]({'model':db[_0xfe90('0x60')],'as':'Attachment','raw':!![]});}var _0x115918=[{'model':db['WhatsappMessage'],'as':_0xfe90('0x61'),'attributes':['id',_0xfe90('0x35'),_0xfe90('0x62'),_0xfe90('0x63'),_0xfe90('0x64'),_0xfe90('0x65')],'include':_0x40cfbe}];_0x115918[_0xfe90('0x5d')]({'model':db[_0xfe90('0x66')],'as':_0xfe90('0x67'),'attributes':['id',_0xfe90('0x1c')]});_0x115918[_0xfe90('0x5d')]({'model':db[_0xfe90('0x5b')],'as':'Owner','attributes':['id','fullname']});return db[_0xfe90('0x20')]['find']({'where':{'id':_0x1c1fb8['params']['id']},'include':_0x115918})[_0xfe90('0x19')](handleEntityNotFound(_0x45c493,null))[_0xfe90('0x19')](function(_0x1fc9f4){if(_0x1fc9f4){var _0x3a2f78=_0x1fc9f4['get']({'plain':!![]});fs[_0xfe90('0x68')](_0x58a3a7);var _0x51f446={'channel':_0xfe90('0x69'),'account':_0x3a2f78[_0xfe90('0x67')][_0xfe90('0x1c')],'agent':_0x3a2f78['Owner']?_0x3a2f78['Owner']['fullname']:'N.A.','createdAt':moment(_0x3a2f78['createdAt'])[_0xfe90('0x59')](_0xfe90('0x46'))['toString'](),'closedAt':_0x3a2f78[_0xfe90('0x6a')]?moment(_0x3a2f78[_0xfe90('0x6b')])['format'](_0xfe90('0x46'))[_0xfe90('0x52')]():'','disposition':_0x3a2f78[_0xfe90('0x6c')],'messages':_(_0x3a2f78[_0xfe90('0x61')])[_0xfe90('0x44')]({'secret':![]})[_0xfe90('0x1f')](function(_0x4f8101){if(_0x4f8101[_0xfe90('0x60')]){var _0x2c1f0e=path[_0xfe90('0x53')](_0x275c07,_0x4f8101[_0xfe90('0x60')][_0xfe90('0x6d')]);if(fs[_0xfe90('0x6e')](_0x2c1f0e)){fs[_0xfe90('0x6f')](_0x2c1f0e)[_0xfe90('0x70')](fs[_0xfe90('0x71')](path[_0xfe90('0x53')](_0x58a3a7,_0x4f8101[_0xfe90('0x60')][_0xfe90('0x6d')])));}}return{'date':moment(_0x4f8101[_0xfe90('0x62')])[_0xfe90('0x59')](_0xfe90('0x46'))['toString'](),'sender':_0x4f8101['direction']===_0xfe90('0x72')?_0x4f8101[_0xfe90('0x5b')]?_0x4f8101['User'][_0xfe90('0x5c')]:_0xfe90('0x73'):_0x4f8101[_0xfe90('0x5f')][_0xfe90('0x74')]+(_0x4f8101[_0xfe90('0x5f')][_0xfe90('0x75')]?'\x20'+_0x4f8101['Contact'][_0xfe90('0x75')]:''),'body':_0x4f8101[_0xfe90('0x60')]?_0x4f8101[_0xfe90('0x60')][_0xfe90('0x6d')]:_0x4f8101[_0xfe90('0x35')],'direction':_0x4f8101[_0xfe90('0x63')]==='out'?'A':'C','secret':_0x4f8101[_0xfe90('0x64')],'read':_0x4f8101[_0xfe90('0x65')],'attachment':_0x4f8101[_0xfe90('0x60')]};})[_0xfe90('0x76')]()};return ejs['renderFile'](path['join'](config['root'],_0xfe90('0x55'),_0xfe90('0x77'),'downloadInteraction.ejs'),{'interaction':_0x51f446})[_0xfe90('0x19')](function(_0x3d6430){var _0xe6dc70=path[_0xfe90('0x53')](_0x58a3a7,'transcript-'+_0x3a2f78['id']+'-'+_0xd675e4+'.pdf');var _0x448a70={'path':_0xe6dc70,'channel':_0xfe90('0x69'),'interactionId':_0x3a2f78['id']};return pdf[_0xfe90('0x78')](_0x3d6430,_0x448a70);})[_0xfe90('0x19')](function(){return new BPromise(function(_0x15301d,_0x5c82ce){zipdir(_0x58a3a7,{'saveTo':_0x4b990f},function(_0x331ae5,_0x148fbf){if(_0x331ae5)return _0x5c82ce(_0x331ae5);return _0x15301d(_0x148fbf);});})[_0xfe90('0x19')](function(){return new BPromise(function(_0x18ac24,_0x51ad98){rimraf(_0x58a3a7,function(_0xba531d){if(_0xba531d)_0x51ad98(_0xba531d);return _0x18ac24();});});})[_0xfe90('0x19')](function(){return _0x45c493[_0xfe90('0x50')](_0x4b990f,_0x26491b,function(_0x7f9b64){if(_0x7f9b64){console[_0xfe90('0x79')](_0xfe90('0x7a'),_0x7f9b64);}else{fs[_0xfe90('0x7b')](_0x4b990f);}});});});}else{return _0x45c493['sendStatus'](0xc8);}})[_0xfe90('0x28')](handleError(_0x45c493,null));}; \ No newline at end of file +var _0xa533=['getMessages','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','findAll','name','color','emit','removeTags','download','unix','files','tmp','join','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','Owner','get','mkdirSync','Whatsapp','Account','N.A.','toString','closed','basename','createReadStream','pipe','createWriteStream','out','System','firstName','value','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','error','send','index','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','whatsapp','query','user','show','params','keys','intersection','attributes','fields','length','model','includeAll','include','options','find','catch','body','describe','WhatsappMessage','ids','omit'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa533,0x13e));var _0x3a53=function(_0x7642c,_0x2ec4b0){_0x7642c=_0x7642c-0x0;var _0x5412fd=_0xa533[_0x7642c];return _0x5412fd;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x3a53('0x0'));var BPromise=require(_0x3a53('0x1'));var util=require(_0x3a53('0x2'));var path=require('path');var ejs=require(_0x3a53('0x3'));var fs=require('fs');var _=require(_0x3a53('0x4'));var Redis=require(_0x3a53('0x5'));var interaction=require(_0x3a53('0x6'));var qs=require(_0x3a53('0x7'));var pdf=require(_0x3a53('0x8'));var logger=require(_0x3a53('0x9'))(_0x3a53('0xa'));var config=require(_0x3a53('0xb'));var db=require(_0x3a53('0xc'))['db'];config[_0x3a53('0xd')]=_['defaults'](config[_0x3a53('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a53('0xd')]));require(_0x3a53('0xe'))[_0x3a53('0xf')](socket);function respondWithStatusCode(_0x3e1231,_0xf7b8db){_0xf7b8db=_0xf7b8db||0xcc;return function(_0x355ee4){if(_0x355ee4){return _0x3e1231[_0x3a53('0x10')](_0xf7b8db);}return _0x3e1231[_0x3a53('0x11')](_0xf7b8db)[_0x3a53('0x12')]();};}function respondWithResult(_0x2f6a51,_0x112b88){_0x112b88=_0x112b88||0xc8;return function(_0x5cacdd){if(_0x5cacdd){return _0x2f6a51[_0x3a53('0x11')](_0x112b88)['json'](_0x5cacdd);}};}function respondWithFilteredResult(_0x13f863,_0xa35e2f){return function(_0x26a338){if(_0x26a338){var _0x1a0ec7=typeof _0xa35e2f[_0x3a53('0x13')]==='undefined'&&typeof _0xa35e2f[_0x3a53('0x14')]===_0x3a53('0x15');var _0x3c896e=_0x26a338[_0x3a53('0x16')];var _0x3d3486=_0x1a0ec7?0x0:_0xa35e2f['offset'];var _0xff58e1=_0x1a0ec7?_0x26a338[_0x3a53('0x16')]:_0xa35e2f[_0x3a53('0x13')]+_0xa35e2f['limit'];var _0x272873;if(_0xff58e1>=_0x3c896e){_0xff58e1=_0x3c896e;_0x272873=0xc8;}else{_0x272873=0xce;}_0x13f863['status'](_0x272873);return _0x13f863[_0x3a53('0x17')](_0x3a53('0x18'),_0x3d3486+'-'+_0xff58e1+'/'+_0x3c896e)[_0x3a53('0x19')](_0x26a338);}return null;};}function saveUpdates(_0x3acef8){return function(_0x1f251f){if(_0x1f251f){return _0x1f251f[_0x3a53('0x1a')](_0x3acef8)[_0x3a53('0x1b')](function(_0x5a4222){return _0x5a4222;});}return null;};}function removeEntity(_0x43c6b8){return function(_0x260c74){if(_0x260c74){return _0x260c74['destroy']()[_0x3a53('0x1b')](function(){_0x43c6b8[_0x3a53('0x11')](0xcc)[_0x3a53('0x12')]();});}};}function handleEntityNotFound(_0x521df6){return function(_0x35acb0){if(!_0x35acb0){_0x521df6[_0x3a53('0x10')](0x194);}return _0x35acb0;};}function handleError(_0x153cde,_0x477e1e){_0x477e1e=_0x477e1e||0x1f4;return function(_0x5dcf5f){logger[_0x3a53('0x1c')](_0x5dcf5f['stack']);if(_0x5dcf5f['name']){delete _0x5dcf5f['name'];}_0x153cde['status'](_0x477e1e)[_0x3a53('0x1d')](_0x5dcf5f);};}exports[_0x3a53('0x1e')]=function(_0x365593,_0x1f3c89){var _0x391047={};var _0x619ed3=_['map'](db[_0x3a53('0x1f')][_0x3a53('0x20')],function(_0x51d0c6){return{'name':_0x51d0c6[_0x3a53('0x21')],'type':_0x51d0c6[_0x3a53('0x22')]['key']};});_0x391047=qs[_0x3a53('0x23')](_0x619ed3,_0x365593);return interaction['findAll'](_0x3a53('0x24'),_0x365593[_0x3a53('0x25')],_0x365593[_0x3a53('0x26')],_0x391047,_0x619ed3)[_0x3a53('0x1b')](respondWithFilteredResult(_0x1f3c89,_0x391047))['catch'](handleError(_0x1f3c89,null));};exports[_0x3a53('0x27')]=function(_0x467892,_0x236947){var _0xf87b73={'raw':![],'where':{'id':_0x467892[_0x3a53('0x28')]['id']}},_0x5b7631={};_0x5b7631['model']=_[_0x3a53('0x29')](db[_0x3a53('0x1f')]['rawAttributes']);_0x5b7631[_0x3a53('0x25')]=_[_0x3a53('0x29')](_0x467892[_0x3a53('0x25')]);_0x5b7631['filters']=_[_0x3a53('0x2a')](_0x5b7631['model'],_0x5b7631['query']);_0xf87b73[_0x3a53('0x2b')]=_[_0x3a53('0x2a')](_0x5b7631['model'],qs['fields'](_0x467892[_0x3a53('0x25')][_0x3a53('0x2c')]));_0xf87b73['attributes']=_0xf87b73[_0x3a53('0x2b')][_0x3a53('0x2d')]?_0xf87b73[_0x3a53('0x2b')]:_0x5b7631[_0x3a53('0x2e')];if(_0x467892[_0x3a53('0x25')][_0x3a53('0x2f')]){_0xf87b73[_0x3a53('0x30')]=[{'all':!![]}];}_0xf87b73=_['merge']({},_0xf87b73,_0x467892[_0x3a53('0x31')]);return db['WhatsappInteraction'][_0x3a53('0x32')](_0xf87b73)['then'](handleEntityNotFound(_0x236947,null))[_0x3a53('0x1b')](respondWithResult(_0x236947,null))[_0x3a53('0x33')](handleError(_0x236947,null));};exports['create']=function(_0x3d156b,_0x50035e){return db[_0x3a53('0x1f')]['create'](_0x3d156b[_0x3a53('0x34')],{})[_0x3a53('0x1b')](respondWithResult(_0x50035e,0xc9))['catch'](handleError(_0x50035e,null));};exports[_0x3a53('0x1a')]=function(_0x531fe6,_0x26841f){if(_0x531fe6[_0x3a53('0x34')]['id']){delete _0x531fe6[_0x3a53('0x34')]['id'];}return db[_0x3a53('0x1f')][_0x3a53('0x32')]({'where':{'id':_0x531fe6[_0x3a53('0x28')]['id']}})['then'](handleEntityNotFound(_0x26841f,null))[_0x3a53('0x1b')](saveUpdates(_0x531fe6['body'],null))[_0x3a53('0x1b')](respondWithResult(_0x26841f,null))['catch'](handleError(_0x26841f,null));};exports['destroy']=function(_0x4066ec,_0x3c77c8){return db[_0x3a53('0x1f')]['find']({'where':{'id':_0x4066ec[_0x3a53('0x28')]['id']}})[_0x3a53('0x1b')](handleEntityNotFound(_0x3c77c8,null))[_0x3a53('0x1b')](removeEntity(_0x3c77c8,null))[_0x3a53('0x33')](handleError(_0x3c77c8,null));};exports[_0x3a53('0x35')]=function(_0xcacacb,_0x188612){return db[_0x3a53('0x1f')]['describe']()['then'](respondWithResult(_0x188612,null))[_0x3a53('0x33')](handleError(_0x188612,null));};exports['addMessage']=function(_0x8b1b91,_0x492ea2){return db[_0x3a53('0x36')][_0x3a53('0x32')]({'where':{'id':_0x8b1b91['params']['id']}})[_0x3a53('0x1b')](handleEntityNotFound(_0x492ea2,null))['then'](function(_0x32279a){if(_0x32279a){return _0x32279a['addMessage'](_0x8b1b91[_0x3a53('0x34')][_0x3a53('0x37')],_[_0x3a53('0x38')](_0x8b1b91[_0x3a53('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x492ea2,null))[_0x3a53('0x33')](handleError(_0x492ea2,null));};exports[_0x3a53('0x39')]=function(_0x40b85d,_0x5b3e59){var _0x2a4f75={'raw':![],'where':{}};var _0x52c065={};var _0x39f736={'count':0x0,'rows':[]};return db[_0x3a53('0x1f')]['findOne']({'where':{'id':_0x40b85d[_0x3a53('0x28')]['id']}})[_0x3a53('0x1b')](handleEntityNotFound(_0x5b3e59,null))[_0x3a53('0x1b')](function(_0x5d9677){if(_0x5d9677){_0x52c065[_0x3a53('0x2e')]=_[_0x3a53('0x29')](db['WhatsappMessage'][_0x3a53('0x20')]);_0x52c065[_0x3a53('0x25')]=_[_0x3a53('0x29')](_0x40b85d[_0x3a53('0x25')]);_0x52c065[_0x3a53('0x3a')]=_[_0x3a53('0x2a')](_0x52c065['model'],_0x52c065['query']);_0x2a4f75['attributes']=_[_0x3a53('0x2a')](_0x52c065[_0x3a53('0x2e')],qs[_0x3a53('0x2c')](_0x40b85d[_0x3a53('0x25')]['fields']));_0x2a4f75[_0x3a53('0x2b')]=_0x2a4f75[_0x3a53('0x2b')][_0x3a53('0x2d')]?_0x2a4f75[_0x3a53('0x2b')]:_0x52c065[_0x3a53('0x2e')];if(!_0x40b85d['query'][_0x3a53('0x3b')](_0x3a53('0x3c'))){_0x2a4f75[_0x3a53('0x14')]=qs[_0x3a53('0x14')](_0x40b85d[_0x3a53('0x25')][_0x3a53('0x14')]);_0x2a4f75[_0x3a53('0x13')]=qs[_0x3a53('0x13')](_0x40b85d[_0x3a53('0x25')]['offset']);}_0x2a4f75[_0x3a53('0x3d')]=qs[_0x3a53('0x3e')](_0x40b85d[_0x3a53('0x25')][_0x3a53('0x3e')]);_0x2a4f75['where']=qs[_0x3a53('0x3a')](_[_0x3a53('0x3f')](_0x40b85d[_0x3a53('0x25')],_0x52c065[_0x3a53('0x3a')]));_0x2a4f75[_0x3a53('0x40')][_0x3a53('0x41')]=_0x5d9677['id'];if(_0x40b85d[_0x3a53('0x25')][_0x3a53('0x42')]){_0x2a4f75[_0x3a53('0x40')]=_[_0x3a53('0x43')](_0x2a4f75[_0x3a53('0x40')],{'$or':_['map'](_0x2a4f75[_0x3a53('0x2b')],function(_0xd1208b){var _0xb01cca={};_0xb01cca[_0xd1208b]={'$like':'%'+_0x40b85d[_0x3a53('0x25')]['filter']+'%'};return _0xb01cca;})});}if(_0x40b85d['query'][_0x3a53('0x44')]){var _0x44c3a0=_0x40b85d[_0x3a53('0x25')]['$gte'][_0x3a53('0x45')](',');var _0x188c74={};_0x188c74[_0x44c3a0[0x0]]={'$gte':moment(_0x44c3a0[0x1])[_0x3a53('0x46')](_0x3a53('0x47'))};_0x2a4f75['where']=_[_0x3a53('0x43')](_0x2a4f75['where'],_0x188c74);}_0x2a4f75=_['merge']({},_0x2a4f75,_0x40b85d[_0x3a53('0x31')]);return db[_0x3a53('0x36')][_0x3a53('0x16')]({'where':_0x2a4f75['where']})[_0x3a53('0x1b')](function(_0x1a541c){_0x39f736[_0x3a53('0x16')]=_0x1a541c;if(_0x40b85d['query']['includeAll']){_0x2a4f75[_0x3a53('0x30')]=[{'all':!![]}];}return db[_0x3a53('0x36')]['findAll'](_0x2a4f75);})['then'](function(_0xb3b85){_0x39f736[_0x3a53('0x48')]=_0xb3b85;return _0x39f736;});}})[_0x3a53('0x1b')](respondWithFilteredResult(_0x5b3e59,_0x2a4f75))[_0x3a53('0x33')](handleError(_0x5b3e59,null));};exports[_0x3a53('0x49')]=function(_0x350e46,_0xb566ea){return db['WhatsappInteraction'][_0x3a53('0x32')]({'where':{'id':_0x350e46[_0x3a53('0x28')]['id']}})[_0x3a53('0x1b')](handleEntityNotFound(_0xb566ea,null))[_0x3a53('0x1b')](function(_0x392b93){if(_0x392b93){return _0x392b93[_0x3a53('0x4a')](_0x350e46['body'][_0x3a53('0x37')],_['omit'](_0x350e46[_0x3a53('0x34')],[_0x3a53('0x37'),'id'])||{})[_0x3a53('0x4b')](function(){return db[_0x3a53('0x4c')][_0x3a53('0x4d')]({'attributes':['id',_0x3a53('0x4e'),_0x3a53('0x4f')],'where':{'id':_0x350e46[_0x3a53('0x34')]['ids']}});})['then'](function(_0x3d211b){socket[_0x3a53('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x350e46[_0x3a53('0x28')]['id']),'tags':_0x3d211b||[]});return{'id':Number(_0x350e46[_0x3a53('0x28')]['id']),'tags':_0x3d211b||[]};});}})['then'](respondWithResult(_0xb566ea,null))[_0x3a53('0x33')](handleError(_0xb566ea,null));};exports[_0x3a53('0x51')]=function(_0x4da75e,_0x223076){return db[_0x3a53('0x1f')]['find']({'where':{'id':_0x4da75e['params']['id']}})[_0x3a53('0x1b')](handleEntityNotFound(_0x223076,null))[_0x3a53('0x1b')](function(_0x56e781){if(_0x56e781){return _0x56e781[_0x3a53('0x51')](_0x4da75e[_0x3a53('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x223076,null))[_0x3a53('0x33')](handleError(_0x223076,null));};exports[_0x3a53('0x52')]=function(_0x4a6dba,_0x1035c6){var _0x52e98b=moment()[_0x3a53('0x53')]()['toString']();var _0x3a51cb=path['join'](config['root'],'server',_0x3a53('0x54'),_0x3a53('0x55'));var _0x13838c=path[_0x3a53('0x56')](config[_0x3a53('0x57')],_0x3a53('0x58'),_0x3a53('0x54'),_0x3a53('0x59'));var _0x575c4d=path[_0x3a53('0x56')](_0x3a51cb,_0x52e98b);var _0x3e5f43=util[_0x3a53('0x46')](_0x3a53('0x5a'),_0x4a6dba[_0x3a53('0x28')]['id'],_0x52e98b);var _0x46d182=path['join'](_0x3a51cb,_0x3e5f43);var _0x460e14=[];_0x460e14[_0x3a53('0x5b')]({'model':db[_0x3a53('0x5c')],'as':_0x3a53('0x5c'),'attributes':['id',_0x3a53('0x5d')],'raw':!![]});_0x460e14['push']({'model':db[_0x3a53('0x5e')],'as':_0x3a53('0x5f'),'attributes':['id','firstName',_0x3a53('0x60')],'raw':!![]});if(_0x4a6dba[_0x3a53('0x25')][_0x3a53('0x59')]){_0x460e14[_0x3a53('0x5b')]({'model':db[_0x3a53('0x61')],'as':_0x3a53('0x61'),'raw':!![]});}var _0x28b293=[{'model':db[_0x3a53('0x36')],'as':_0x3a53('0x62'),'attributes':['id',_0x3a53('0x34'),_0x3a53('0x63'),_0x3a53('0x64'),_0x3a53('0x65'),_0x3a53('0x66')],'include':_0x460e14}];_0x28b293[_0x3a53('0x5b')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x3a53('0x4e')]});_0x28b293[_0x3a53('0x5b')]({'model':db[_0x3a53('0x5c')],'as':_0x3a53('0x67'),'attributes':['id',_0x3a53('0x5d')]});return db[_0x3a53('0x1f')][_0x3a53('0x32')]({'where':{'id':_0x4a6dba[_0x3a53('0x28')]['id']},'include':_0x28b293})[_0x3a53('0x1b')](handleEntityNotFound(_0x1035c6,null))[_0x3a53('0x1b')](function(_0x58f3f4){if(_0x58f3f4){var _0x6d54aa=_0x58f3f4[_0x3a53('0x68')]({'plain':!![]});fs[_0x3a53('0x69')](_0x575c4d);var _0x321a2e={'channel':_0x3a53('0x6a'),'account':_0x6d54aa[_0x3a53('0x6b')][_0x3a53('0x4e')],'agent':_0x6d54aa['Owner']?_0x6d54aa[_0x3a53('0x67')][_0x3a53('0x5d')]:_0x3a53('0x6c'),'createdAt':moment(_0x6d54aa[_0x3a53('0x63')])[_0x3a53('0x46')](_0x3a53('0x47'))[_0x3a53('0x6d')](),'closedAt':_0x6d54aa[_0x3a53('0x6e')]?moment(_0x6d54aa['closedAt'])[_0x3a53('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3a53('0x6d')]():'','disposition':_0x6d54aa['disposition'],'messages':_(_0x6d54aa[_0x3a53('0x62')])[_0x3a53('0x42')]({'secret':![]})['map'](function(_0x123834){if(_0x123834[_0x3a53('0x61')]){var _0x449af7=path[_0x3a53('0x56')](_0x13838c,_0x123834[_0x3a53('0x61')][_0x3a53('0x6f')]);if(fs['existsSync'](_0x449af7)){fs[_0x3a53('0x70')](_0x449af7)[_0x3a53('0x71')](fs[_0x3a53('0x72')](path['join'](_0x575c4d,_0x123834['Attachment'][_0x3a53('0x6f')])));}}return{'date':moment(_0x123834[_0x3a53('0x63')])[_0x3a53('0x46')](_0x3a53('0x47'))['toString'](),'sender':_0x123834['direction']===_0x3a53('0x73')?_0x123834[_0x3a53('0x5c')]?_0x123834[_0x3a53('0x5c')]['fullname']:_0x3a53('0x74'):_0x123834[_0x3a53('0x5f')][_0x3a53('0x75')]+(_0x123834[_0x3a53('0x5f')][_0x3a53('0x60')]?'\x20'+_0x123834['Contact'][_0x3a53('0x60')]:''),'body':_0x123834[_0x3a53('0x61')]?_0x123834[_0x3a53('0x61')][_0x3a53('0x6f')]:_0x123834[_0x3a53('0x34')],'direction':_0x123834['direction']===_0x3a53('0x73')?'A':'C','secret':_0x123834[_0x3a53('0x65')],'read':_0x123834['read'],'attachment':_0x123834[_0x3a53('0x61')]};})[_0x3a53('0x76')]()};return ejs['renderFile'](path[_0x3a53('0x56')](config[_0x3a53('0x57')],_0x3a53('0x58'),_0x3a53('0x77'),_0x3a53('0x78')),{'interaction':_0x321a2e})[_0x3a53('0x1b')](function(_0x5bb1ea){var _0x4f7c6a=path[_0x3a53('0x56')](_0x575c4d,'transcript-'+_0x6d54aa['id']+'-'+_0x52e98b+_0x3a53('0x79'));var _0x3183f2={'path':_0x4f7c6a,'channel':_0x3a53('0x6a'),'interactionId':_0x6d54aa['id']};return pdf['createPdfFromHTML'](_0x5bb1ea,_0x3183f2);})[_0x3a53('0x1b')](function(){return new BPromise(function(_0x2bdcce,_0x3ff7b1){zipdir(_0x575c4d,{'saveTo':_0x46d182},function(_0x250a31,_0x3c9802){if(_0x250a31)return _0x3ff7b1(_0x250a31);return _0x2bdcce(_0x3c9802);});})[_0x3a53('0x1b')](function(){return new BPromise(function(_0x5372ce,_0x3b319a){rimraf(_0x575c4d,function(_0x3c3700){if(_0x3c3700)_0x3b319a(_0x3c3700);return _0x5372ce();});});})[_0x3a53('0x1b')](function(){return _0x1035c6['download'](_0x46d182,_0x3e5f43,function(_0x159c82){if(_0x159c82){console[_0x3a53('0x7a')](_0x3a53('0x7b'),_0x159c82);}else{fs[_0x3a53('0x7c')](_0x46d182);}});});});}else{return _0x1035c6[_0x3a53('0x10')](0xc8);}})[_0x3a53('0x33')](handleError(_0x1035c6,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6d595fa..1f32918 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 _0x7b6b=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','save','remove','getUsers','then'];(function(_0x7740e4,_0x303da0){var _0x59b2f4=function(_0x325f25){while(--_0x325f25){_0x7740e4['push'](_0x7740e4['shift']());}};_0x59b2f4(++_0x303da0);}(_0x7b6b,0xac));var _0xb7b6=function(_0x1e795c,_0x880b93){_0x1e795c=_0x1e795c-0x0;var _0x1132f7=_0x7b6b[_0x1e795c];return _0x1132f7;};'use strict';var EventEmitter=require(_0xb7b6('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb7b6('0x1')];var WhatsappMessage=require(_0xb7b6('0x2'))['db'][_0xb7b6('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7b6('0x4'),'afterUpdate':'update','afterDestroy':_0xb7b6('0x5')};function emitEvent(_0x7193f5){return function(_0xfd10d6,_0x3fc279,_0xde6ac0){_0xfd10d6[_0xb7b6('0x6')]({'attributes':['id'],'raw':!![]})[_0xb7b6('0x7')](function(_0x318dfb){_0xfd10d6[_0xb7b6('0x8')](_0xb7b6('0x9'),_0x318dfb[_0xb7b6('0xa')](function(_0x4074d1){return{'id':_0x4074d1['id']};}));return WhatsappMessage[_0xb7b6('0xb')]({'where':{'WhatsappInteractionId':_0xfd10d6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb7b6('0x7')](function(_0x22ee5f){_0xfd10d6[_0xb7b6('0x8')](_0xb7b6('0xc'),_0x22ee5f[_0xb7b6('0xd')]);WhatsappInteractionEvents[_0xb7b6('0xe')](_0x7193f5+':'+_0xfd10d6['id'],_0xfd10d6);WhatsappInteractionEvents[_0xb7b6('0xe')](_0x7193f5,_0xfd10d6);_0xde6ac0(null);})['catch'](_0xde6ac0(null));};}for(var e in events){if(events[_0xb7b6('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb7b6('0x10')](e,emitEvent(event));}}module[_0xb7b6('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3e5c=['exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x42326e,_0x2cbf2a){var _0x4a4153=function(_0x347638){while(--_0x347638){_0x42326e['push'](_0x42326e['shift']());}};_0x4a4153(++_0x2cbf2a);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x40c0af,_0x477caa){_0x40c0af=_0x40c0af-0x0;var _0x35394a=_0x3e5c[_0x40c0af];return _0x35394a;};'use strict';var EventEmitter=require(_0xc3e5('0x0'));var WhatsappInteraction=require(_0xc3e5('0x1'))['db'][_0xc3e5('0x2')];var WhatsappMessage=require(_0xc3e5('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc3e5('0x3')](0x0);var events={'afterCreate':_0xc3e5('0x4'),'afterUpdate':_0xc3e5('0x5'),'afterDestroy':_0xc3e5('0x6')};function emitEvent(_0x46cf5c){return function(_0x2f0ab6,_0x4cb0db,_0xf61ec2){_0x2f0ab6[_0xc3e5('0x7')]({'attributes':['id'],'raw':!![]})[_0xc3e5('0x8')](function(_0xcbbec0){_0x2f0ab6[_0xc3e5('0x9')]('Users',_0xcbbec0[_0xc3e5('0xa')](function(_0x2728a2){return{'id':_0x2728a2['id']};}));return WhatsappMessage[_0xc3e5('0xb')]({'where':{'WhatsappInteractionId':_0x2f0ab6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc3e5('0x8')](function(_0x448454){_0x2f0ab6[_0xc3e5('0x9')](_0xc3e5('0xc'),_0x448454['length']);WhatsappInteractionEvents[_0xc3e5('0xd')](_0x46cf5c+':'+_0x2f0ab6['id'],_0x2f0ab6);WhatsappInteractionEvents[_0xc3e5('0xd')](_0x46cf5c,_0x2f0ab6);_0xf61ec2(null);})[_0xc3e5('0xe')](_0xf61ec2(null));};}for(var e in events){if(events[_0xc3e5('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc3e5('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2dc61ec..d6a877b 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 _0x6daf=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_interactions'];(function(_0x34b2dd,_0x5a29a7){var _0x193a27=function(_0x3c8500){while(--_0x3c8500){_0x34b2dd['push'](_0x34b2dd['shift']());}};_0x193a27(++_0x5a29a7);}(_0x6daf,0xd7));var _0xf6da=function(_0x3675f6,_0x4ba592){_0x3675f6=_0x3675f6-0x0;var _0x44ab5b=_0x6daf[_0x3675f6];return _0x44ab5b;};'use strict';var _=require('lodash');var util=require(_0xf6da('0x0'));var logger=require(_0xf6da('0x1'))('api');var moment=require(_0xf6da('0x2'));var BPromise=require(_0xf6da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6da('0x4'));var rimraf=require(_0xf6da('0x5'));var config=require(_0xf6da('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0xf6da('0x7')]=function(_0x3d548d,_0x4b57e9){return _0x3d548d[_0xf6da('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xf6da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18741c,_0x2b0d4b,_0x3a46f1){if(_0x18741c[_0xf6da('0xa')](_0xf6da('0xb'))){_0x18741c[_0xf6da('0xc')]=moment()[_0xf6da('0xd')](_0xf6da('0xe'));}_0x3a46f1(null,_0x18741c);}}});}; \ No newline at end of file +var _0xb180=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format'];(function(_0x4ca3c8,_0x5e0e01){var _0x2e6bec=function(_0x28191d){while(--_0x28191d){_0x4ca3c8['push'](_0x4ca3c8['shift']());}};_0x2e6bec(++_0x5e0e01);}(_0xb180,0x1aa));var _0x0b18=function(_0xd4e2c,_0x2a3b8b){_0xd4e2c=_0xd4e2c-0x0;var _0xbba98b=_0xb180[_0xd4e2c];return _0xbba98b;};'use strict';var _=require(_0x0b18('0x0'));var util=require(_0x0b18('0x1'));var logger=require('../../config/logger')(_0x0b18('0x2'));var moment=require(_0x0b18('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b18('0x4'));var fs=require('fs');var path=require(_0x0b18('0x5'));var rimraf=require(_0x0b18('0x6'));var config=require(_0x0b18('0x7'));var attributes=require(_0x0b18('0x8'));module[_0x0b18('0x9')]=function(_0x51f35a,_0x2bcae1){return _0x51f35a[_0x0b18('0xa')](_0x0b18('0xb'),attributes,{'tableName':_0x0b18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7ccca2,_0x3328a3,_0x566853){if(_0x7ccca2[_0x0b18('0xd')]('closed')){_0x7ccca2[_0x0b18('0xe')]=moment()[_0x0b18('0xf')](_0x0b18('0x10'));}_0x566853(null,_0x7ccca2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1d21732..77cf700 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 _0xe09a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','where','options','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0xe09a,0x1cc));var _0xae09=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xe09a[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0xae09('0x0'));var util=require(_0xae09('0x1'));var moment=require(_0xae09('0x2'));var BPromise=require('bluebird');var rs=require(_0xae09('0x3'));var fs=require('fs');var Redis=require(_0xae09('0x4'));var db=require(_0xae09('0x5'))['db'];var utils=require(_0xae09('0x6'));var logger=require(_0xae09('0x7'))(_0xae09('0x8'));var config=require(_0xae09('0x9'));var jayson=require(_0xae09('0xa'));var client=jayson['client'][_0xae09('0xb')]({'port':0x232a});config[_0xae09('0xc')]=_['defaults'](config[_0xae09('0xc')],{'host':_0xae09('0xd'),'port':0x18eb});var socket=require(_0xae09('0xe'))(new Redis(config[_0xae09('0xc')]));require('./whatsappInteraction.socket')[_0xae09('0xf')](socket);function respondWithRpcPromise(_0x53215e,_0x3cbed0,_0x2b42ae){return new BPromise(function(_0x5b68ca,_0x1bf19e){return client[_0xae09('0x10')](_0x53215e,_0x2b42ae)[_0xae09('0x11')](function(_0x1d64b8){logger[_0xae09('0x12')](_0xae09('0x13'),_0x3cbed0,_0xae09('0x14'));logger[_0xae09('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3cbed0,'request\x20sent',JSON[_0xae09('0x16')](_0x1d64b8));if(_0x1d64b8[_0xae09('0x17')]){if(_0x1d64b8[_0xae09('0x17')][_0xae09('0x18')]===0x1f4){logger['error'](_0xae09('0x13'),_0x3cbed0,_0x1d64b8['error']['message']);return _0x1bf19e(_0x1d64b8[_0xae09('0x17')]['message']);}logger[_0xae09('0x17')](_0xae09('0x13'),_0x3cbed0,_0x1d64b8[_0xae09('0x17')]['message']);return _0x5b68ca(_0x1d64b8[_0xae09('0x17')][_0xae09('0x19')]);}else{logger[_0xae09('0x12')](_0xae09('0x13'),_0x3cbed0,'request\x20sent');_0x5b68ca(_0x1d64b8[_0xae09('0x1a')][_0xae09('0x19')]);}})[_0xae09('0x1b')](function(_0x433fd4){logger[_0xae09('0x17')](_0xae09('0x13'),_0x3cbed0,_0x433fd4);_0x1bf19e(_0x433fd4);});});}exports[_0xae09('0x1c')]=function(_0x1f12f9){var _0x2446bd=this;return new Promise(function(_0x3a2451,_0x2752b5){return db['WhatsappInteraction'][_0xae09('0x1d')](_0x1f12f9['body'],{'raw':_0x1f12f9['options']?_0x1f12f9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f12f9['options']?_0x1f12f9['options'][_0xae09('0x1e')]||null:null,'attributes':_0x1f12f9[_0xae09('0x1f')]?_0x1f12f9['options']['attributes']||null:null,'limit':_0x1f12f9[_0xae09('0x1f')]?_0x1f12f9[_0xae09('0x1f')][_0xae09('0x20')]||null:null})[_0xae09('0x11')](function(_0x45d409){logger[_0xae09('0x12')]('UpdateWhatsappInteraction',_0x1f12f9);logger[_0xae09('0x15')]('UpdateWhatsappInteraction',_0x1f12f9,JSON[_0xae09('0x16')](_0x45d409));_0x3a2451(_0x45d409);})[_0xae09('0x1b')](function(_0x11eedd){logger[_0xae09('0x17')](_0xae09('0x1c'),_0x11eedd[_0xae09('0x19')],_0x1f12f9);_0x2752b5(_0x2446bd['error'](0x1f4,_0x11eedd[_0xae09('0x19')]));});});};exports[_0xae09('0x21')]=function(_0x48e5c9){return new Promise(function(_0x30a0fc,_0x13c05d){return db[_0xae09('0x22')][_0xae09('0x23')]({'where':_0x48e5c9['options']?_0x48e5c9[_0xae09('0x1f')][_0xae09('0x1e')]||null:null})['then'](function(_0x83dde8){if(_0x83dde8){return _0x83dde8[_0xae09('0x24')](_0x48e5c9[_0xae09('0x25')][_0xae09('0x26')],_[_0xae09('0x27')](_0x48e5c9[_0xae09('0x25')],['ids','id'])||{});}})[_0xae09('0x28')](function(_0x5a6e40){logger[_0xae09('0x12')]('AddTags',_0x48e5c9);logger[_0xae09('0x15')](_0xae09('0x29'),_0x48e5c9,JSON[_0xae09('0x16')](_0x5a6e40));_0x30a0fc(_0x5a6e40);})[_0xae09('0x1b')](function(_0x3903c7){logger[_0xae09('0x17')](_0xae09('0x29'),_0x3903c7['message'],_0x48e5c9);_0x13c05d(_this['error'](0x1f4,_0x3903c7[_0xae09('0x19')]));});});}; \ No newline at end of file +var _0xf8cc=['register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','then','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xf8cc,0x110));var _0xcf8c=function(_0x10f470,_0x286359){_0x10f470=_0x10f470-0x0;var _0x386884=_0xf8cc[_0x10f470];return _0x386884;};'use strict';var _=require('lodash');var util=require(_0xcf8c('0x0'));var moment=require(_0xcf8c('0x1'));var BPromise=require(_0xcf8c('0x2'));var rs=require(_0xcf8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf8c('0x4'))['db'];var utils=require(_0xcf8c('0x5'));var logger=require(_0xcf8c('0x6'))(_0xcf8c('0x7'));var config=require(_0xcf8c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcf8c('0x9')][_0xcf8c('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcf8c('0xb')],{'host':_0xcf8c('0xc'),'port':0x18eb});var socket=require(_0xcf8c('0xd'))(new Redis(config[_0xcf8c('0xb')]));require(_0xcf8c('0xe'))[_0xcf8c('0xf')](socket);function respondWithRpcPromise(_0x13af0f,_0x4f4c55,_0x52b05f){return new BPromise(function(_0x2f4bcf,_0x55e998){return client['request'](_0x13af0f,_0x52b05f)['then'](function(_0x1d0525){logger[_0xcf8c('0x10')](_0xcf8c('0x11'),_0x4f4c55,_0xcf8c('0x12'));logger[_0xcf8c('0x13')](_0xcf8c('0x14'),_0x4f4c55,_0xcf8c('0x12'),JSON[_0xcf8c('0x15')](_0x1d0525));if(_0x1d0525[_0xcf8c('0x16')]){if(_0x1d0525[_0xcf8c('0x16')][_0xcf8c('0x17')]===0x1f4){logger[_0xcf8c('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4f4c55,_0x1d0525[_0xcf8c('0x16')]['message']);return _0x55e998(_0x1d0525[_0xcf8c('0x16')][_0xcf8c('0x18')]);}logger[_0xcf8c('0x16')](_0xcf8c('0x11'),_0x4f4c55,_0x1d0525['error'][_0xcf8c('0x18')]);return _0x2f4bcf(_0x1d0525['error'][_0xcf8c('0x18')]);}else{logger[_0xcf8c('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4f4c55,_0xcf8c('0x12'));_0x2f4bcf(_0x1d0525[_0xcf8c('0x19')][_0xcf8c('0x18')]);}})[_0xcf8c('0x1a')](function(_0xfb173d){logger[_0xcf8c('0x16')](_0xcf8c('0x11'),_0x4f4c55,_0xfb173d);_0x55e998(_0xfb173d);});});}exports[_0xcf8c('0x1b')]=function(_0x5cda8d){var _0x3c2bd8=this;return new Promise(function(_0x2b18a4,_0x3253c5){return db[_0xcf8c('0x1c')][_0xcf8c('0x1d')](_0x5cda8d[_0xcf8c('0x1e')],{'raw':_0x5cda8d[_0xcf8c('0x1f')]?_0x5cda8d[_0xcf8c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cda8d[_0xcf8c('0x1f')]?_0x5cda8d[_0xcf8c('0x1f')][_0xcf8c('0x20')]||null:null,'attributes':_0x5cda8d['options']?_0x5cda8d[_0xcf8c('0x1f')]['attributes']||null:null,'limit':_0x5cda8d[_0xcf8c('0x1f')]?_0x5cda8d[_0xcf8c('0x1f')][_0xcf8c('0x21')]||null:null})[_0xcf8c('0x22')](function(_0xce3e53){logger[_0xcf8c('0x10')](_0xcf8c('0x1b'),_0x5cda8d);logger[_0xcf8c('0x13')](_0xcf8c('0x1b'),_0x5cda8d,JSON[_0xcf8c('0x15')](_0xce3e53));_0x2b18a4(_0xce3e53);})[_0xcf8c('0x1a')](function(_0x4a3f34){logger[_0xcf8c('0x16')](_0xcf8c('0x1b'),_0x4a3f34[_0xcf8c('0x18')],_0x5cda8d);_0x3253c5(_0x3c2bd8[_0xcf8c('0x16')](0x1f4,_0x4a3f34['message']));});});};exports[_0xcf8c('0x23')]=function(_0x4ae452){return new Promise(function(_0x5c3a14,_0x346b19){return db[_0xcf8c('0x1c')][_0xcf8c('0x24')]({'where':_0x4ae452[_0xcf8c('0x1f')]?_0x4ae452[_0xcf8c('0x1f')][_0xcf8c('0x20')]||null:null})[_0xcf8c('0x22')](function(_0x39ef20){if(_0x39ef20){return _0x39ef20['addTags'](_0x4ae452[_0xcf8c('0x1e')][_0xcf8c('0x25')],_[_0xcf8c('0x26')](_0x4ae452[_0xcf8c('0x1e')],[_0xcf8c('0x25'),'id'])||{});}})[_0xcf8c('0x27')](function(_0x2747b7){logger[_0xcf8c('0x10')](_0xcf8c('0x28'),_0x4ae452);logger[_0xcf8c('0x13')](_0xcf8c('0x28'),_0x4ae452,JSON[_0xcf8c('0x15')](_0x2747b7));_0x5c3a14(_0x2747b7);})[_0xcf8c('0x1a')](function(_0x2b72d5){logger[_0xcf8c('0x16')](_0xcf8c('0x28'),_0x2b72d5[_0xcf8c('0x18')],_0x4ae452);_0x346b19(_this[_0xcf8c('0x16')](0x1f4,_0x2b72d5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 50acac6..fc2db7b 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 _0xa17f=['emit','removeListener','register','length','whatsappInteraction:','save'];(function(_0xcf9709,_0x3130e8){var _0x119e2c=function(_0x2dbb60){while(--_0x2dbb60){_0xcf9709['push'](_0xcf9709['shift']());}};_0x119e2c(++_0x3130e8);}(_0xa17f,0x113));var _0xfa17=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xa17f[_0x1eda20];return _0x31b953;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xfa17('0x0'),'remove','update'];function createListener(_0x104381,_0x3b2753){return function(_0x5ea47b){_0x3b2753[_0xfa17('0x1')](_0x104381,_0x5ea47b);};}function removeListener(_0x375055,_0xe9cc7a){return function(){WhatsappInteractionEvents[_0xfa17('0x2')](_0x375055,_0xe9cc7a);};}exports[_0xfa17('0x3')]=function(_0x10ed4f){for(var _0x1af6df=0x0,_0x3587a1=events[_0xfa17('0x4')];_0x1af6df<_0x3587a1;_0x1af6df++){var _0x5760e9=events[_0x1af6df];var _0x1b1351=createListener(_0xfa17('0x5')+_0x5760e9,_0x10ed4f);WhatsappInteractionEvents['on'](_0x5760e9,_0x1b1351);}}; \ No newline at end of file +var _0xadbf=['register','length','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x402795,_0x259d5d){var _0x4da674=function(_0x3aaa9f){while(--_0x3aaa9f){_0x402795['push'](_0x402795['shift']());}};_0x4da674(++_0x259d5d);}(_0xadbf,0x105));var _0xfadb=function(_0x52c0e1,_0x22111a){_0x52c0e1=_0x52c0e1-0x0;var _0x2d7fd7=_0xadbf[_0x52c0e1];return _0x2d7fd7;};'use strict';var WhatsappInteractionEvents=require(_0xfadb('0x0'));var events=[_0xfadb('0x1'),_0xfadb('0x2'),_0xfadb('0x3')];function createListener(_0x1131b4,_0x177f42){return function(_0x3cb501){_0x177f42[_0xfadb('0x4')](_0x1131b4,_0x3cb501);};}function removeListener(_0x337767,_0x1e35b7){return function(){WhatsappInteractionEvents['removeListener'](_0x337767,_0x1e35b7);};}exports[_0xfadb('0x5')]=function(_0x432c8a){for(var _0x14c20e=0x0,_0x43715b=events[_0xfadb('0x6')];_0x14c20e<_0x43715b;_0x14c20e++){var _0x366ad5=events[_0x14c20e];var _0x4ca480=createListener('whatsappInteraction:'+_0x366ad5,_0x432c8a);WhatsappInteractionEvents['on'](_0x366ad5,_0x4ca480);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0ca5643..f074e44 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 _0xf334=['get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x5e92e3,_0x3bcf52){var _0x4abf32=function(_0x2a0a7c){while(--_0x2a0a7c){_0x5e92e3['push'](_0x5e92e3['shift']());}};_0x4abf32(++_0x3bcf52);}(_0xf334,0x12d));var _0x4f33=function(_0x572a06,_0x547117){_0x572a06=_0x572a06-0x0;var _0x1d0c5e=_0xf334[_0x572a06];return _0x1d0c5e;};'use strict';var multer=require(_0x4f33('0x0'));var util=require(_0x4f33('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f33('0x2'));var router=express[_0x4f33('0x3')]();var fs_extra=require(_0x4f33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4f33('0x5'));var config=require('../../config/environment');var controller=require(_0x4f33('0x6'));router[_0x4f33('0x7')]('/',auth[_0x4f33('0x8')](),controller[_0x4f33('0x9')]);router[_0x4f33('0x7')](_0x4f33('0xa'),auth[_0x4f33('0x8')](),controller[_0x4f33('0xb')]);router['get'](_0x4f33('0xc'),auth[_0x4f33('0x8')](),controller[_0x4f33('0xd')]);router[_0x4f33('0xe')]('/',auth[_0x4f33('0x8')](),interaction[_0x4f33('0xf')](_0x4f33('0x10'),_0x4f33('0x11')),controller[_0x4f33('0x12')]);router[_0x4f33('0xe')](_0x4f33('0x13'),controller[_0x4f33('0x14')]);router[_0x4f33('0x15')](_0x4f33('0xc'),auth[_0x4f33('0x8')](),controller[_0x4f33('0x16')]);router[_0x4f33('0x15')](_0x4f33('0x17'),auth[_0x4f33('0x8')](),controller[_0x4f33('0x18')]);router[_0x4f33('0x15')]('/:id/reject',auth[_0x4f33('0x8')](),controller[_0x4f33('0x19')]);router[_0x4f33('0x1a')](_0x4f33('0xc'),auth[_0x4f33('0x8')](),controller['destroy']);module[_0x4f33('0x1b')]=router; \ No newline at end of file +var _0x8e82=['/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe'];(function(_0x5b3970,_0xd0fb8e){var _0x52cc2c=function(_0x8e98c5){while(--_0x8e98c5){_0x5b3970['push'](_0x5b3970['shift']());}};_0x52cc2c(++_0xd0fb8e);}(_0x8e82,0x128));var _0x28e8=function(_0x37f14b,_0x4442ab){_0x37f14b=_0x37f14b-0x0;var _0x5b6752=_0x8e82[_0x37f14b];return _0x5b6752;};'use strict';var multer=require(_0x28e8('0x0'));var util=require(_0x28e8('0x1'));var path=require(_0x28e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x28e8('0x3'));var router=express[_0x28e8('0x4')]();var fs_extra=require(_0x28e8('0x5'));var auth=require(_0x28e8('0x6'));var interaction=require(_0x28e8('0x7'));var config=require(_0x28e8('0x8'));var controller=require(_0x28e8('0x9'));router['get']('/',auth[_0x28e8('0xa')](),controller['index']);router[_0x28e8('0xb')](_0x28e8('0xc'),auth['isAuthenticated'](),controller[_0x28e8('0xd')]);router[_0x28e8('0xb')](_0x28e8('0xe'),auth[_0x28e8('0xa')](),controller[_0x28e8('0xf')]);router[_0x28e8('0x10')]('/',auth['isAuthenticated'](),interaction[_0x28e8('0x11')](_0x28e8('0x12'),_0x28e8('0x13')),controller[_0x28e8('0x14')]);router[_0x28e8('0x10')](_0x28e8('0x15'),controller[_0x28e8('0x16')]);router[_0x28e8('0x17')](_0x28e8('0xe'),auth[_0x28e8('0xa')](),controller[_0x28e8('0x18')]);router[_0x28e8('0x17')](_0x28e8('0x19'),auth[_0x28e8('0xa')](),controller[_0x28e8('0x1a')]);router[_0x28e8('0x17')]('/:id/reject',auth['isAuthenticated'](),controller[_0x28e8('0x1b')]);router[_0x28e8('0x1c')](_0x28e8('0xe'),auth[_0x28e8('0xa')](),controller[_0x28e8('0x1d')]);module[_0x28e8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b6244fe..82ae572 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 _0x7c40=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0x7c40,0x12c));var _0x07c4=function(_0x4e7a5e,_0x162bc1){_0x4e7a5e=_0x4e7a5e-0x0;var _0x2f0e68=_0x7c40[_0x4e7a5e];return _0x2f0e68;};'use strict';var Sequelize=require(_0x07c4('0x0'));module[_0x07c4('0x1')]={'body':{'type':Sequelize[_0x07c4('0x2')](_0x07c4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x07c4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x07c4('0x5')]('in',_0x07c4('0x6')),'defaultValue':_0x07c4('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x07c4('0x7')]},'readAt':{'type':Sequelize[_0x07c4('0x8')]},'secret':{'type':Sequelize[_0x07c4('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x07c4('0x7')]},'providerResponse':{'type':Sequelize[_0x07c4('0x2')]}}; \ No newline at end of file +var _0x3f19=['TEXT','exports','medium','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f19,0x1f1));var _0x93f1=function(_0x38ecda,_0x3b551e){_0x38ecda=_0x38ecda-0x0;var _0x3fa8f3=_0x3f19[_0x38ecda];return _0x3fa8f3;};'use strict';var Sequelize=require('sequelize');module[_0x93f1('0x0')]={'body':{'type':Sequelize['TEXT'](_0x93f1('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x93f1('0x2')]('in',_0x93f1('0x3')),'defaultValue':_0x93f1('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x93f1('0x4')](0xbe)},'phone':{'type':Sequelize[_0x93f1('0x4')]},'readAt':{'type':Sequelize[_0x93f1('0x5')]},'secret':{'type':Sequelize[_0x93f1('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x93f1('0x4')]},'providerResponse':{'type':Sequelize[_0x93f1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5fc1de6..ec2a3a3 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 _0xaac5=['http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','stack','name','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','show','include','find','create','body','describe','../../config/logger','whatsapp-interactions','read','readAt','format','UserId','user','agent','params','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','channel','motionChannel','EventManager','acceptmessage','whatsapp','get','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','email','interface','event','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client'];(function(_0x33e7e0,_0x4cedf1){var _0xf07c19=function(_0x532ec7){while(--_0x532ec7){_0x33e7e0['push'](_0x33e7e0['shift']());}};_0xf07c19(++_0x4cedf1);}(_0xaac5,0x6c));var _0x5aac=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xaac5[_0x187ee1];return _0x388160;};'use strict';var emlformat=require(_0x5aac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5aac('0x1'));var jsonpatch=require(_0x5aac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5aac('0x3'));var Mustache=require('mustache');var util=require(_0x5aac('0x4'));var path=require('path');var sox=require(_0x5aac('0x5'));var csv=require(_0x5aac('0x6'));var ejs=require(_0x5aac('0x7'));var fs=require('fs');var fs_extra=require(_0x5aac('0x8'));var _=require(_0x5aac('0x9'));var squel=require(_0x5aac('0xa'));var crypto=require(_0x5aac('0xb'));var jsforce=require(_0x5aac('0xc'));var deskjs=require(_0x5aac('0xd'));var toCsv=require(_0x5aac('0x6'));var querystring=require(_0x5aac('0xe'));var Papa=require(_0x5aac('0xf'));var Redis=require(_0x5aac('0x10'));var authService=require(_0x5aac('0x11'));var qs=require(_0x5aac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5aac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5aac('0x14'));var db=require(_0x5aac('0x15'))['db'];config[_0x5aac('0x16')]=_[_0x5aac('0x17')](config[_0x5aac('0x16')],{'host':_0x5aac('0x18'),'port':0x18eb});var socket=require(_0x5aac('0x19'))(new Redis(config[_0x5aac('0x16')]));require(_0x5aac('0x1a'))['register'](socket);var jayson=require(_0x5aac('0x1b'));var client=jayson[_0x5aac('0x1c')][_0x5aac('0x1d')]({'port':0x232c});var client9002=jayson[_0x5aac('0x1c')][_0x5aac('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2370d2,_0x1fbbd9,_0x35b818,_0x4385fc){return new BPromise(function(_0x5271f0,_0x861f6c){var _0x52f4d8=_0x4385fc||client;return _0x52f4d8[_0x5aac('0x1e')](_0x2370d2,_0x35b818)[_0x5aac('0x1f')](function(_0x260108){logger[_0x5aac('0x20')](_0x5aac('0x21'),_0x1fbbd9,_0x5aac('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1fbbd9,_0x5aac('0x22'),JSON[_0x5aac('0x23')](_0x260108));if(_0x260108[_0x5aac('0x24')]){if(_0x260108[_0x5aac('0x24')][_0x5aac('0x25')]===0x1f4){logger['error'](_0x5aac('0x21'),_0x1fbbd9,_0x260108['error']['message']);return _0x861f6c(_0x260108[_0x5aac('0x24')]['message']);}logger[_0x5aac('0x24')](_0x5aac('0x21'),_0x1fbbd9,_0x260108[_0x5aac('0x24')]['message']);return _0x5271f0(_0x260108[_0x5aac('0x24')][_0x5aac('0x26')]);}else{logger[_0x5aac('0x20')](_0x5aac('0x21'),_0x1fbbd9,_0x5aac('0x22'));_0x5271f0(_0x260108[_0x5aac('0x27')][_0x5aac('0x26')]);}})[_0x5aac('0x28')](function(_0x53453b){logger[_0x5aac('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1fbbd9,_0x53453b);_0x861f6c(_0x53453b);});});}function respondWithStatusCode(_0x1c9e98,_0x5060e){_0x5060e=_0x5060e||0xcc;return function(_0x9da805){if(_0x9da805){return _0x1c9e98[_0x5aac('0x29')](_0x5060e);}return _0x1c9e98[_0x5aac('0x2a')](_0x5060e)['end']();};}function respondWithResult(_0x42a6ae,_0x22ae0c){_0x22ae0c=_0x22ae0c||0xc8;return function(_0x196186){if(_0x196186){return _0x42a6ae[_0x5aac('0x2a')](_0x22ae0c)['json'](_0x196186);}};}function respondWithFilteredResult(_0x311f2a,_0x2e15d4){return function(_0x45aefc){if(_0x45aefc){var _0x38ad61=typeof _0x2e15d4[_0x5aac('0x2b')]===_0x5aac('0x2c')&&typeof _0x2e15d4[_0x5aac('0x2d')]===_0x5aac('0x2c');var _0x64e271=_0x45aefc[_0x5aac('0x2e')];var _0x2ef814=_0x38ad61?0x0:_0x2e15d4[_0x5aac('0x2b')];var _0x1e6075=_0x38ad61?_0x45aefc[_0x5aac('0x2e')]:_0x2e15d4['offset']+_0x2e15d4[_0x5aac('0x2d')];var _0x3b6db1;if(_0x1e6075>=_0x64e271){_0x1e6075=_0x64e271;_0x3b6db1=0xc8;}else{_0x3b6db1=0xce;}_0x311f2a[_0x5aac('0x2a')](_0x3b6db1);return _0x311f2a[_0x5aac('0x2f')]('Content-Range',_0x2ef814+'-'+_0x1e6075+'/'+_0x64e271)['json'](_0x45aefc);}return null;};}function patchUpdates(_0x2eafde){return function(_0x463cf9){try{jsonpatch[_0x5aac('0x30')](_0x463cf9,_0x2eafde,!![]);}catch(_0xfe076f){return BPromise[_0x5aac('0x31')](_0xfe076f);}return _0x463cf9[_0x5aac('0x32')]();};}function saveUpdates(_0x4c93e9,_0xe1b586){return function(_0xf64021){if(_0xf64021){return _0xf64021[_0x5aac('0x33')](_0x4c93e9)[_0x5aac('0x1f')](function(_0x153dd1){return _0x153dd1;});}return null;};}function removeEntity(_0x4f85d5,_0x15f0fc){return function(_0x42eb15){if(_0x42eb15){return _0x42eb15[_0x5aac('0x34')]()[_0x5aac('0x1f')](function(){_0x4f85d5[_0x5aac('0x2a')](0xcc)[_0x5aac('0x35')]();});}};}function handleEntityNotFound(_0x577b1d,_0x5b5d8a){return function(_0x3c1278){if(!_0x3c1278){_0x577b1d[_0x5aac('0x29')](0x194);}return _0x3c1278;};}function handleError(_0x41b629,_0x5a7e3c){_0x5a7e3c=_0x5a7e3c||0x1f4;return function(_0x258d72){logger[_0x5aac('0x24')](_0x258d72[_0x5aac('0x36')]);if(_0x258d72[_0x5aac('0x37')]){delete _0x258d72['name'];}_0x41b629[_0x5aac('0x2a')](_0x5a7e3c)['send'](_0x258d72);};}exports[_0x5aac('0x38')]=function(_0xecccf0,_0x2f4933){var _0x5a2919={},_0xefde47={},_0x4dfe1f={'count':0x0,'rows':[]};var _0x556f99=_[_0x5aac('0x39')](db[_0x5aac('0x3a')][_0x5aac('0x3b')],function(_0x511a4e){return{'name':_0x511a4e['fieldName'],'type':_0x511a4e[_0x5aac('0x3c')][_0x5aac('0x3d')]};});_0xefde47[_0x5aac('0x3e')]=_['map'](_0x556f99,_0x5aac('0x37'));_0xefde47[_0x5aac('0x3f')]=_[_0x5aac('0x40')](_0xecccf0[_0x5aac('0x3f')]);_0xefde47['filters']=_['intersection'](_0xefde47[_0x5aac('0x3e')],_0xefde47[_0x5aac('0x3f')]);_0x5a2919[_0x5aac('0x41')]=_[_0x5aac('0x42')](_0xefde47[_0x5aac('0x3e')],qs[_0x5aac('0x43')](_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x43')]));_0x5a2919[_0x5aac('0x41')]=_0x5a2919[_0x5aac('0x41')][_0x5aac('0x44')]?_0x5a2919[_0x5aac('0x41')]:_0xefde47[_0x5aac('0x3e')];if(!_0xecccf0[_0x5aac('0x3f')]['hasOwnProperty'](_0x5aac('0x45'))){_0x5a2919[_0x5aac('0x2d')]=qs[_0x5aac('0x2d')](_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x2d')]);_0x5a2919['offset']=qs[_0x5aac('0x2b')](_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x2b')]);}_0x5a2919[_0x5aac('0x46')]=qs[_0x5aac('0x47')](_0xecccf0[_0x5aac('0x3f')]['sort']);_0x5a2919['where']=qs[_0x5aac('0x48')](_[_0x5aac('0x49')](_0xecccf0[_0x5aac('0x3f')],_0xefde47[_0x5aac('0x48')]),_0x556f99);if(_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x4a')]){_0x5a2919[_0x5aac('0x4b')]=_[_0x5aac('0x4c')](_0x5a2919[_0x5aac('0x4b')],{'$or':_[_0x5aac('0x39')](_0x556f99,function(_0x124f10){if(_0x124f10[_0x5aac('0x3c')]!=='VIRTUAL'){var _0x51f25c={};_0x51f25c[_0x124f10[_0x5aac('0x37')]]={'$like':'%'+_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x4a')]+'%'};return _0x51f25c;}})});}_0x5a2919=_['merge']({},_0x5a2919,_0xecccf0[_0x5aac('0x4d')]);var _0x4cac8e={'where':_0x5a2919[_0x5aac('0x4b')]};return db['WhatsappMessage']['count'](_0x4cac8e)[_0x5aac('0x1f')](function(_0x154862){_0x4dfe1f[_0x5aac('0x2e')]=_0x154862;if(_0xecccf0[_0x5aac('0x3f')][_0x5aac('0x4e')]){_0x5a2919['include']=[{'all':!![]}];}return db[_0x5aac('0x3a')][_0x5aac('0x4f')](_0x5a2919);})['then'](function(_0x249d23){_0x4dfe1f[_0x5aac('0x50')]=_0x249d23;return _0x4dfe1f;})[_0x5aac('0x1f')](respondWithFilteredResult(_0x2f4933,_0x5a2919))['catch'](handleError(_0x2f4933,null));};exports[_0x5aac('0x51')]=function(_0x49b254,_0x2ce6be){var _0x40ce04={'raw':!![],'where':{'id':_0x49b254['params']['id']}},_0x3b17c8={};_0x3b17c8[_0x5aac('0x3e')]=_['keys'](db[_0x5aac('0x3a')]['rawAttributes']);_0x3b17c8[_0x5aac('0x3f')]=_[_0x5aac('0x40')](_0x49b254[_0x5aac('0x3f')]);_0x3b17c8[_0x5aac('0x48')]=_[_0x5aac('0x42')](_0x3b17c8['model'],_0x3b17c8[_0x5aac('0x3f')]);_0x40ce04[_0x5aac('0x41')]=_[_0x5aac('0x42')](_0x3b17c8[_0x5aac('0x3e')],qs[_0x5aac('0x43')](_0x49b254[_0x5aac('0x3f')][_0x5aac('0x43')]));_0x40ce04['attributes']=_0x40ce04['attributes']['length']?_0x40ce04[_0x5aac('0x41')]:_0x3b17c8[_0x5aac('0x3e')];if(_0x49b254[_0x5aac('0x3f')][_0x5aac('0x4e')]){_0x40ce04[_0x5aac('0x52')]=[{'all':!![]}];}_0x40ce04=_[_0x5aac('0x4c')]({},_0x40ce04,_0x49b254[_0x5aac('0x4d')]);return db[_0x5aac('0x3a')][_0x5aac('0x53')](_0x40ce04)['then'](handleEntityNotFound(_0x2ce6be,null))['then'](respondWithResult(_0x2ce6be,null))[_0x5aac('0x28')](handleError(_0x2ce6be,null));};exports[_0x5aac('0x54')]=function(_0xb41134,_0x4f7395){return db[_0x5aac('0x3a')][_0x5aac('0x54')](_0xb41134[_0x5aac('0x55')],{})[_0x5aac('0x1f')](respondWithResult(_0x4f7395,0xc9))[_0x5aac('0x28')](handleError(_0x4f7395,null));};exports['update']=function(_0x23d7a1,_0x59b784){if(_0x23d7a1[_0x5aac('0x55')]['id']){delete _0x23d7a1[_0x5aac('0x55')]['id'];}return db[_0x5aac('0x3a')][_0x5aac('0x53')]({'where':{'id':_0x23d7a1['params']['id']}})[_0x5aac('0x1f')](handleEntityNotFound(_0x59b784,null))['then'](saveUpdates(_0x23d7a1[_0x5aac('0x55')],null))['then'](respondWithResult(_0x59b784,null))[_0x5aac('0x28')](handleError(_0x59b784,null));};exports['destroy']=function(_0x3d9f05,_0x323f25){return db[_0x5aac('0x3a')][_0x5aac('0x53')]({'where':{'id':_0x3d9f05['params']['id']}})[_0x5aac('0x1f')](handleEntityNotFound(_0x323f25,null))['then'](removeEntity(_0x323f25,null))[_0x5aac('0x28')](handleError(_0x323f25,null));};exports['describe']=function(_0x2ff716,_0x6eda36){return db[_0x5aac('0x3a')][_0x5aac('0x56')]()[_0x5aac('0x1f')](respondWithResult(_0x6eda36,null))[_0x5aac('0x28')](handleError(_0x6eda36,null));};var interaction_log=require(_0x5aac('0x57'))(_0x5aac('0x58'));exports['accept']=function(_0x74983c,_0x55a283,_0x4230b1){var _0x4ee1d2={'agent':{},'channel':'whatsapp'};if(_0x74983c['body']['id']){delete _0x74983c[_0x5aac('0x55')]['id'];}_0x74983c['body'][_0x5aac('0x59')]=!![];_0x74983c['body'][_0x5aac('0x5a')]=moment()[_0x5aac('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x74983c[_0x5aac('0x55')][_0x5aac('0x5c')]=_0x74983c[_0x5aac('0x55')][_0x5aac('0x5c')]||_0x74983c[_0x5aac('0x5d')]['id'];_0x4ee1d2[_0x5aac('0x5e')]['id']=_0x74983c[_0x5aac('0x55')][_0x5aac('0x5c')];return db[_0x5aac('0x3a')][_0x5aac('0x53')]({'where':{'id':_0x74983c[_0x5aac('0x5f')]['id'],'UserId':null}})[_0x5aac('0x1f')](handleEntityNotFound(_0x55a283,null))['then'](saveUpdates(_0x74983c[_0x5aac('0x55')],null))[_0x5aac('0x1f')](function(_0xf3caa){if(_0xf3caa){_0x4ee1d2[_0x5aac('0x26')]=_0xf3caa['get']({'plain':!![]});return db[_0x5aac('0x60')][_0x5aac('0x53')]({'where':{'id':_0xf3caa[_0x5aac('0x61')]}});}return null;})[_0x5aac('0x1f')](handleEntityNotFound(_0x55a283,null))[_0x5aac('0x1f')](function(_0x4cd96c){if(_0x4cd96c){return _0x4cd96c[_0x5aac('0x33')]({'UserId':_0x74983c['body'][_0x5aac('0x5c')],'read1stAt':_['isNil'](_0x4cd96c[_0x5aac('0x62')])?moment()[_0x5aac('0x5b')](_0x5aac('0x63')):undefined});}return null;})[_0x5aac('0x1f')](function(_0x2433bc){if(_0x2433bc){_0x4ee1d2['interaction']=_0x2433bc['get']({'plain':!![]});interaction_log['info'](_0x5aac('0x64'),_0x74983c['user']['id'],_0x74983c[_0x5aac('0x5d')]['name'],_0x74983c['user'][_0x5aac('0x65')],_0x4ee1d2['interaction']['id'],_0x74983c['body']?JSON['stringify'](_0x74983c[_0x5aac('0x55')]):_0x5aac('0x66'));return respondWithRpcPromise(_0x5aac('0x67'),_0x5aac('0x68'),_0x4ee1d2);}return null;})['then'](function(_0x4c4890){var _0x23cfda=_0x5aac('0x69')+_0x4c4890[_0x5aac('0x26')][_0x5aac('0x6a')];return db[_0x5aac('0x6b')][_0x5aac('0x3f')](_0x23cfda,{'type':db[_0x5aac('0x6c')][_0x5aac('0x6d')][_0x5aac('0x6e')],'raw':!![]})[_0x5aac('0x1f')](function(_0x301c8f){return _0x301c8f;});})[_0x5aac('0x1f')](function(_0x28e3fd){if(_0x28e3fd){_0x4ee1d2['message'][_0x5aac('0x6f')]=_0x28e3fd[0x0];if(!_0x74983c[_0x5aac('0x55')]['UserId'])return;return db['User'][_0x5aac('0x53')]({'where':{'id':_0x74983c[_0x5aac('0x55')][_0x5aac('0x5c')],'role':_0x5aac('0x5e')},'attributes':['id',_0x5aac('0x37'),_0x5aac('0x70'),'email','internal'],'raw':!![]});}return null;})[_0x5aac('0x1f')](function(_0x5e1728){if(!_0x5e1728)return null;_0x4ee1d2[_0x5aac('0x26')][_0x5aac('0x5e')]=_0x5e1728;return _0x4ee1d2;})[_0x5aac('0x1f')](function(_0x4d5bf1){if(_0x4d5bf1){if(_0x74983c[_0x5aac('0x55')]['manual']){_0x4ee1d2[_0x5aac('0x26')]['interface']=util[_0x5aac('0x5b')]('SIP/%s',_0x74983c[_0x5aac('0x5d')][_0x5aac('0x37')]);_0x4ee1d2[_0x5aac('0x26')][_0x5aac('0x71')]=_0x4ee1d2[_0x5aac('0x71')];_0x4ee1d2[_0x5aac('0x26')][_0x5aac('0x72')]=_0x4ee1d2[_0x5aac('0x71')];_0x4ee1d2[_0x5aac('0x26')]['event']='accept';return respondWithRpcPromise(_0x5aac('0x73'),_0x5aac('0x73'),{'event':_0x5aac('0x74'),'message':_0x4ee1d2[_0x5aac('0x26')]},client9002)['then'](function(){return _0x4ee1d2;});}return _0x4ee1d2;}return null;})['then'](respondWithResult(_0x55a283,null))['catch'](handleError(_0x55a283,null));};var interaction_log=require(_0x5aac('0x57'))(_0x5aac('0x58'));exports[_0x5aac('0x31')]=function(_0x332d09,_0x58df21,_0x2ec2bc){var _0xdfa41={'agent':{},'channel':_0x5aac('0x75')};if(_0x332d09[_0x5aac('0x55')]['id']){delete _0x332d09['body']['id'];}_0x332d09[_0x5aac('0x55')][_0x5aac('0x5c')]=_0x332d09[_0x5aac('0x55')][_0x5aac('0x5c')]||_0x332d09[_0x5aac('0x5d')]['id'];_0xdfa41[_0x5aac('0x5e')]['id']=_0x332d09['body']['UserId'];return db[_0x5aac('0x3a')]['find']({'where':{'id':_0x332d09[_0x5aac('0x5f')]['id'],'UserId':null}})[_0x5aac('0x1f')](handleEntityNotFound(_0x58df21,null))[_0x5aac('0x1f')](function(_0xa70ba3){if(_0xa70ba3){_0xdfa41[_0x5aac('0x26')]=_0xa70ba3[_0x5aac('0x76')]({'plain':!![]});return db[_0x5aac('0x60')][_0x5aac('0x53')]({'where':{'id':_0xa70ba3[_0x5aac('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x58df21,null))['then'](function(_0x55ef47){if(_0x55ef47){_0xdfa41[_0x5aac('0x77')]=_0x55ef47[_0x5aac('0x76')]({'plain':!![]});interaction_log[_0x5aac('0x20')](_0x5aac('0x78'),_0x332d09[_0x5aac('0x5d')]['id'],_0x332d09[_0x5aac('0x5d')]['name'],_0x332d09[_0x5aac('0x5d')]['role'],_0xdfa41['interaction']['id'],_0x332d09[_0x5aac('0x55')]?JSON[_0x5aac('0x23')](_0x332d09['body']):_0x5aac('0x66'));return respondWithRpcPromise('RejectMessage',_0x5aac('0x79'),_0xdfa41);}return null;})[_0x5aac('0x1f')](function(_0x2b8dd1){var _0xdf5a5b=_0x5aac('0x69')+_0x2b8dd1[_0x5aac('0x26')][_0x5aac('0x6a')];return db[_0x5aac('0x6b')][_0x5aac('0x3f')](_0xdf5a5b,{'type':db[_0x5aac('0x6c')][_0x5aac('0x6d')]['SELECT'],'raw':!![]})[_0x5aac('0x1f')](function(_0x37960a){return _0x37960a;});})['then'](function(_0x4e3c0c){if(_0x4e3c0c){_0xdfa41[_0x5aac('0x26')][_0x5aac('0x6f')]=_0x4e3c0c[0x0];if(!_0x332d09[_0x5aac('0x55')][_0x5aac('0x5c')])return;return db[_0x5aac('0x7a')][_0x5aac('0x53')]({'where':{'id':_0x332d09['body'][_0x5aac('0x5c')],'role':'agent'},'attributes':['id',_0x5aac('0x37'),_0x5aac('0x70'),_0x5aac('0x7b'),'internal'],'raw':!![]});}return null;})[_0x5aac('0x1f')](function(_0x1b84b6){if(!_0x1b84b6)return null;_0xdfa41[_0x5aac('0x26')]['agent']=_0x1b84b6;return _0xdfa41;})['then'](function(_0x127505){if(_0x127505){_0x127505['message'][_0x5aac('0x7c')]=util['format']('SIP/%s',_0x332d09[_0x5aac('0x5d')][_0x5aac('0x37')]);_0x127505[_0x5aac('0x26')][_0x5aac('0x71')]=_0xdfa41['channel'];_0x127505['message'][_0x5aac('0x72')]=_0xdfa41[_0x5aac('0x71')];_0x127505[_0x5aac('0x26')][_0x5aac('0x7d')]=_0x5aac('0x31');respondWithRpcPromise(_0x5aac('0x73'),_0x5aac('0x73'),{'event':'rejectmessage','message':_0x127505['message']},client9002);return _0xdfa41;}return null;})['then'](respondWithResult(_0x58df21,null))[_0x5aac('0x28')](handleError(_0x58df21,null));};exports['status']=function(_0x51f8ce,_0x29ba82,_0x313042){if(_0x51f8ce['body']['id']){delete _0x51f8ce['body']['id'];}var _0x48f0a0;return db[_0x5aac('0x3a')][_0x5aac('0x53')]({'where':{'id':_0x51f8ce['params']['id']}})[_0x5aac('0x1f')](handleEntityNotFound(_0x29ba82,null))[_0x5aac('0x1f')](function(_0x19a38a){if(_0x19a38a){_0x48f0a0=_0x19a38a;return db[_0x5aac('0x7e')][_0x5aac('0x53')]({'where':{'id':_0x19a38a[_0x5aac('0x7f')]}});}})['then'](handleEntityNotFound(_0x29ba82,null))['then'](function(_0x242bcd){if(_0x242bcd){logger[_0x5aac('0x80')](_0x5aac('0x81'),'status',_0x5aac('0x82'),_0x242bcd[_0x5aac('0x3c')],util[_0x5aac('0x83')](_0x51f8ce[_0x5aac('0x55')],{'showHidden':![],'depth':null}));switch(_0x242bcd['type']){case _0x5aac('0x84'):if(_0x51f8ce['body'][_0x5aac('0x85')]&&_0x51f8ce[_0x5aac('0x55')]['MessageSid']===_0x48f0a0[_0x5aac('0x86')]&&_0x51f8ce['body'][_0x5aac('0x87')]&&_0x51f8ce[_0x5aac('0x55')][_0x5aac('0x87')]==='read'){return _0x48f0a0[_0x5aac('0x33')]({'read':!![]});}else{logger['error'](_0x5aac('0x88'),_0x5aac('0x2a'),_0x5aac('0x84'),util[_0x5aac('0x83')](_0x51f8ce[_0x5aac('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x48f0a0;}})[_0x5aac('0x1f')](respondWithResult(_0x29ba82,null))[_0x5aac('0x28')](handleError(_0x29ba82,null));}; \ No newline at end of file +var _0x4d83=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','findAll','rows','show','params','keys','length','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','motionChannel','channel','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','SIP/%s','reject','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','json','offset','undefined','count','limit','set','apply','destroy','status','sendStatus','name','send','WhatsappMessage','rawAttributes','fieldName','type','key','query'];(function(_0x4278fc,_0x1a99cc){var _0x596744=function(_0x43eb5f){while(--_0x43eb5f){_0x4278fc['push'](_0x4278fc['shift']());}};_0x596744(++_0x1a99cc);}(_0x4d83,0x1de));var _0x34d8=function(_0x558099,_0x4be744){_0x558099=_0x558099-0x0;var _0x18ac2e=_0x4d83[_0x558099];return _0x18ac2e;};'use strict';var emlformat=require(_0x34d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34d8('0x1'));var rp=require(_0x34d8('0x2'));var moment=require('moment');var BPromise=require(_0x34d8('0x3'));var Mustache=require(_0x34d8('0x4'));var util=require(_0x34d8('0x5'));var path=require(_0x34d8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34d8('0x7'));var fs=require('fs');var fs_extra=require(_0x34d8('0x8'));var _=require('lodash');var squel=require(_0x34d8('0x9'));var crypto=require(_0x34d8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x34d8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x34d8('0xc'));var Papa=require('papaparse');var Redis=require(_0x34d8('0xd'));var authService=require(_0x34d8('0xe'));var qs=require(_0x34d8('0xf'));var as=require(_0x34d8('0x10'));var hardwareService=require(_0x34d8('0x11'));var logger=require(_0x34d8('0x12'))(_0x34d8('0x13'));var utils=require('../../config/utils');var config=require(_0x34d8('0x14'));var licenseUtil=require(_0x34d8('0x15'));var db=require(_0x34d8('0x16'))['db'];config[_0x34d8('0x17')]=_[_0x34d8('0x18')](config['redis'],{'host':_0x34d8('0x19'),'port':0x18eb});var socket=require(_0x34d8('0x1a'))(new Redis(config['redis']));require(_0x34d8('0x1b'))['register'](socket);var jayson=require(_0x34d8('0x1c'));var client=jayson[_0x34d8('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x34d8('0x1d')][_0x34d8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4d34a8,_0x3bbdf5,_0x5983ac,_0x27f017){return new BPromise(function(_0x292e37,_0x25ff9c){var _0x1a13af=_0x27f017||client;return _0x1a13af[_0x34d8('0x1f')](_0x4d34a8,_0x5983ac)[_0x34d8('0x20')](function(_0x54ad87){logger['info'](_0x34d8('0x21'),_0x3bbdf5,_0x34d8('0x22'));logger[_0x34d8('0x23')](_0x34d8('0x24'),_0x3bbdf5,'request\x20sent',JSON[_0x34d8('0x25')](_0x54ad87));if(_0x54ad87[_0x34d8('0x26')]){if(_0x54ad87['error'][_0x34d8('0x27')]===0x1f4){logger[_0x34d8('0x26')](_0x34d8('0x21'),_0x3bbdf5,_0x54ad87[_0x34d8('0x26')][_0x34d8('0x28')]);return _0x25ff9c(_0x54ad87[_0x34d8('0x26')]['message']);}logger[_0x34d8('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x3bbdf5,_0x54ad87[_0x34d8('0x26')][_0x34d8('0x28')]);return _0x292e37(_0x54ad87[_0x34d8('0x26')][_0x34d8('0x28')]);}else{logger[_0x34d8('0x29')](_0x34d8('0x21'),_0x3bbdf5,_0x34d8('0x22'));_0x292e37(_0x54ad87['result'][_0x34d8('0x28')]);}})[_0x34d8('0x2a')](function(_0x1c1a3f){logger[_0x34d8('0x26')](_0x34d8('0x21'),_0x3bbdf5,_0x1c1a3f);_0x25ff9c(_0x1c1a3f);});});}function respondWithStatusCode(_0x49d72e,_0x535ddc){_0x535ddc=_0x535ddc||0xcc;return function(_0x1bf8f4){if(_0x1bf8f4){return _0x49d72e['sendStatus'](_0x535ddc);}return _0x49d72e['status'](_0x535ddc)[_0x34d8('0x2b')]();};}function respondWithResult(_0x2fee7c,_0x52d81d){_0x52d81d=_0x52d81d||0xc8;return function(_0x2dc96f){if(_0x2dc96f){return _0x2fee7c['status'](_0x52d81d)[_0x34d8('0x2c')](_0x2dc96f);}};}function respondWithFilteredResult(_0x1c52a6,_0x329bfa){return function(_0x5f4de9){if(_0x5f4de9){var _0x4a565f=typeof _0x329bfa[_0x34d8('0x2d')]===_0x34d8('0x2e')&&typeof _0x329bfa['limit']===_0x34d8('0x2e');var _0x1a89fc=_0x5f4de9[_0x34d8('0x2f')];var _0x31c392=_0x4a565f?0x0:_0x329bfa['offset'];var _0x523de9=_0x4a565f?_0x5f4de9[_0x34d8('0x2f')]:_0x329bfa[_0x34d8('0x2d')]+_0x329bfa[_0x34d8('0x30')];var _0x305967;if(_0x523de9>=_0x1a89fc){_0x523de9=_0x1a89fc;_0x305967=0xc8;}else{_0x305967=0xce;}_0x1c52a6['status'](_0x305967);return _0x1c52a6[_0x34d8('0x31')]('Content-Range',_0x31c392+'-'+_0x523de9+'/'+_0x1a89fc)[_0x34d8('0x2c')](_0x5f4de9);}return null;};}function patchUpdates(_0xa306af){return function(_0x3a17c4){try{jsonpatch[_0x34d8('0x32')](_0x3a17c4,_0xa306af,!![]);}catch(_0x1f58f4){return BPromise['reject'](_0x1f58f4);}return _0x3a17c4['save']();};}function saveUpdates(_0x17f84f,_0x2bd24a){return function(_0x57a6bb){if(_0x57a6bb){return _0x57a6bb['update'](_0x17f84f)['then'](function(_0x461226){return _0x461226;});}return null;};}function removeEntity(_0x2a3990,_0x31b627){return function(_0x494659){if(_0x494659){return _0x494659[_0x34d8('0x33')]()[_0x34d8('0x20')](function(){_0x2a3990[_0x34d8('0x34')](0xcc)[_0x34d8('0x2b')]();});}};}function handleEntityNotFound(_0x453050,_0x23160b){return function(_0x25614d){if(!_0x25614d){_0x453050[_0x34d8('0x35')](0x194);}return _0x25614d;};}function handleError(_0x2791f5,_0x2dfa9e){_0x2dfa9e=_0x2dfa9e||0x1f4;return function(_0x344844){logger[_0x34d8('0x26')](_0x344844['stack']);if(_0x344844[_0x34d8('0x36')]){delete _0x344844[_0x34d8('0x36')];}_0x2791f5[_0x34d8('0x34')](_0x2dfa9e)[_0x34d8('0x37')](_0x344844);};}exports['index']=function(_0x76d848,_0xa450ec){var _0x55acde={},_0x2b6412={},_0x445969={'count':0x0,'rows':[]};var _0x199847=_['map'](db[_0x34d8('0x38')][_0x34d8('0x39')],function(_0x12708b){return{'name':_0x12708b[_0x34d8('0x3a')],'type':_0x12708b[_0x34d8('0x3b')][_0x34d8('0x3c')]};});_0x2b6412['model']=_['map'](_0x199847,'name');_0x2b6412[_0x34d8('0x3d')]=_['keys'](_0x76d848[_0x34d8('0x3d')]);_0x2b6412[_0x34d8('0x3e')]=_[_0x34d8('0x3f')](_0x2b6412[_0x34d8('0x40')],_0x2b6412[_0x34d8('0x3d')]);_0x55acde['attributes']=_[_0x34d8('0x3f')](_0x2b6412[_0x34d8('0x40')],qs['fields'](_0x76d848['query'][_0x34d8('0x41')]));_0x55acde[_0x34d8('0x42')]=_0x55acde[_0x34d8('0x42')]['length']?_0x55acde['attributes']:_0x2b6412[_0x34d8('0x40')];if(!_0x76d848[_0x34d8('0x3d')][_0x34d8('0x43')](_0x34d8('0x44'))){_0x55acde[_0x34d8('0x30')]=qs[_0x34d8('0x30')](_0x76d848[_0x34d8('0x3d')]['limit']);_0x55acde[_0x34d8('0x2d')]=qs[_0x34d8('0x2d')](_0x76d848['query'][_0x34d8('0x2d')]);}_0x55acde[_0x34d8('0x45')]=qs[_0x34d8('0x46')](_0x76d848['query'][_0x34d8('0x46')]);_0x55acde[_0x34d8('0x47')]=qs['filters'](_['pick'](_0x76d848[_0x34d8('0x3d')],_0x2b6412['filters']),_0x199847);if(_0x76d848[_0x34d8('0x3d')][_0x34d8('0x48')]){_0x55acde[_0x34d8('0x47')]=_[_0x34d8('0x49')](_0x55acde['where'],{'$or':_[_0x34d8('0x4a')](_0x199847,function(_0x5ca8a8){if(_0x5ca8a8['type']!=='VIRTUAL'){var _0x1fee5d={};_0x1fee5d[_0x5ca8a8[_0x34d8('0x36')]]={'$like':'%'+_0x76d848[_0x34d8('0x3d')]['filter']+'%'};return _0x1fee5d;}})});}_0x55acde=_[_0x34d8('0x49')]({},_0x55acde,_0x76d848[_0x34d8('0x4b')]);var _0x264dad={'where':_0x55acde[_0x34d8('0x47')]};return db[_0x34d8('0x38')][_0x34d8('0x2f')](_0x264dad)[_0x34d8('0x20')](function(_0x3fc779){_0x445969['count']=_0x3fc779;if(_0x76d848['query'][_0x34d8('0x4c')]){_0x55acde['include']=[{'all':!![]}];}return db[_0x34d8('0x38')][_0x34d8('0x4d')](_0x55acde);})[_0x34d8('0x20')](function(_0x4f66ae){_0x445969[_0x34d8('0x4e')]=_0x4f66ae;return _0x445969;})['then'](respondWithFilteredResult(_0xa450ec,_0x55acde))[_0x34d8('0x2a')](handleError(_0xa450ec,null));};exports[_0x34d8('0x4f')]=function(_0x48860d,_0x47cd4f){var _0xfda87a={'raw':!![],'where':{'id':_0x48860d[_0x34d8('0x50')]['id']}},_0x161068={};_0x161068['model']=_['keys'](db['WhatsappMessage'][_0x34d8('0x39')]);_0x161068[_0x34d8('0x3d')]=_[_0x34d8('0x51')](_0x48860d[_0x34d8('0x3d')]);_0x161068[_0x34d8('0x3e')]=_[_0x34d8('0x3f')](_0x161068[_0x34d8('0x40')],_0x161068[_0x34d8('0x3d')]);_0xfda87a[_0x34d8('0x42')]=_[_0x34d8('0x3f')](_0x161068[_0x34d8('0x40')],qs[_0x34d8('0x41')](_0x48860d[_0x34d8('0x3d')][_0x34d8('0x41')]));_0xfda87a['attributes']=_0xfda87a[_0x34d8('0x42')][_0x34d8('0x52')]?_0xfda87a['attributes']:_0x161068[_0x34d8('0x40')];if(_0x48860d[_0x34d8('0x3d')][_0x34d8('0x4c')]){_0xfda87a['include']=[{'all':!![]}];}_0xfda87a=_[_0x34d8('0x49')]({},_0xfda87a,_0x48860d[_0x34d8('0x4b')]);return db[_0x34d8('0x38')][_0x34d8('0x53')](_0xfda87a)['then'](handleEntityNotFound(_0x47cd4f,null))[_0x34d8('0x20')](respondWithResult(_0x47cd4f,null))['catch'](handleError(_0x47cd4f,null));};exports[_0x34d8('0x54')]=function(_0x2041eb,_0x553ac0){return db[_0x34d8('0x38')][_0x34d8('0x54')](_0x2041eb[_0x34d8('0x55')],{})[_0x34d8('0x20')](respondWithResult(_0x553ac0,0xc9))[_0x34d8('0x2a')](handleError(_0x553ac0,null));};exports[_0x34d8('0x56')]=function(_0x47686c,_0x2c55f0){if(_0x47686c[_0x34d8('0x55')]['id']){delete _0x47686c[_0x34d8('0x55')]['id'];}return db[_0x34d8('0x38')][_0x34d8('0x53')]({'where':{'id':_0x47686c[_0x34d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c55f0,null))[_0x34d8('0x20')](saveUpdates(_0x47686c['body'],null))[_0x34d8('0x20')](respondWithResult(_0x2c55f0,null))[_0x34d8('0x2a')](handleError(_0x2c55f0,null));};exports[_0x34d8('0x33')]=function(_0x2f02de,_0xf7d4e1){return db['WhatsappMessage']['find']({'where':{'id':_0x2f02de['params']['id']}})[_0x34d8('0x20')](handleEntityNotFound(_0xf7d4e1,null))[_0x34d8('0x20')](removeEntity(_0xf7d4e1,null))[_0x34d8('0x2a')](handleError(_0xf7d4e1,null));};exports[_0x34d8('0x57')]=function(_0x4ab16d,_0x2a931b){return db[_0x34d8('0x38')][_0x34d8('0x57')]()[_0x34d8('0x20')](respondWithResult(_0x2a931b,null))[_0x34d8('0x2a')](handleError(_0x2a931b,null));};var interaction_log=require(_0x34d8('0x12'))(_0x34d8('0x58'));exports[_0x34d8('0x59')]=function(_0x297541,_0x166c9b,_0x10aae7){var _0x3a90cb={'agent':{},'channel':_0x34d8('0x5a')};if(_0x297541[_0x34d8('0x55')]['id']){delete _0x297541[_0x34d8('0x55')]['id'];}_0x297541[_0x34d8('0x55')][_0x34d8('0x5b')]=!![];_0x297541['body'][_0x34d8('0x5c')]=moment()[_0x34d8('0x5d')](_0x34d8('0x5e'));_0x297541['body']['UserId']=_0x297541['body'][_0x34d8('0x5f')]||_0x297541[_0x34d8('0x60')]['id'];_0x3a90cb['agent']['id']=_0x297541[_0x34d8('0x55')][_0x34d8('0x5f')];return db[_0x34d8('0x38')][_0x34d8('0x53')]({'where':{'id':_0x297541['params']['id'],'UserId':null}})[_0x34d8('0x20')](handleEntityNotFound(_0x166c9b,null))['then'](saveUpdates(_0x297541[_0x34d8('0x55')],null))[_0x34d8('0x20')](function(_0x3ce853){if(_0x3ce853){_0x3a90cb['message']=_0x3ce853[_0x34d8('0x61')]({'plain':!![]});return db[_0x34d8('0x62')]['find']({'where':{'id':_0x3ce853[_0x34d8('0x63')]}});}return null;})[_0x34d8('0x20')](handleEntityNotFound(_0x166c9b,null))[_0x34d8('0x20')](function(_0x9627b9){if(_0x9627b9){return _0x9627b9[_0x34d8('0x56')]({'UserId':_0x297541['body'][_0x34d8('0x5f')],'read1stAt':_[_0x34d8('0x64')](_0x9627b9[_0x34d8('0x65')])?moment()[_0x34d8('0x5d')](_0x34d8('0x5e')):undefined});}return null;})[_0x34d8('0x20')](function(_0x31276f){if(_0x31276f){_0x3a90cb[_0x34d8('0x66')]=_0x31276f[_0x34d8('0x61')]({'plain':!![]});interaction_log[_0x34d8('0x29')](_0x34d8('0x67'),_0x297541['user']['id'],_0x297541['user'][_0x34d8('0x36')],_0x297541[_0x34d8('0x60')][_0x34d8('0x68')],_0x3a90cb[_0x34d8('0x66')]['id'],_0x297541[_0x34d8('0x55')]?JSON[_0x34d8('0x25')](_0x297541[_0x34d8('0x55')]):'null');return respondWithRpcPromise(_0x34d8('0x69'),_0x34d8('0x6a'),_0x3a90cb);}return null;})[_0x34d8('0x20')](function(_0x4af412){var _0x1508e6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4af412[_0x34d8('0x28')][_0x34d8('0x6b')];return db[_0x34d8('0x6c')]['query'](_0x1508e6,{'type':db[_0x34d8('0x6d')][_0x34d8('0x6e')][_0x34d8('0x6f')],'raw':!![]})[_0x34d8('0x20')](function(_0x4c2a42){return _0x4c2a42;});})['then'](function(_0xb27be8){if(_0xb27be8){_0x3a90cb[_0x34d8('0x28')][_0x34d8('0x70')]=_0xb27be8[0x0];if(!_0x297541[_0x34d8('0x55')][_0x34d8('0x5f')])return;return db[_0x34d8('0x71')][_0x34d8('0x53')]({'where':{'id':_0x297541[_0x34d8('0x55')][_0x34d8('0x5f')],'role':_0x34d8('0x72')},'attributes':['id','name',_0x34d8('0x73'),_0x34d8('0x74'),_0x34d8('0x75')],'raw':!![]});}return null;})[_0x34d8('0x20')](function(_0x4c8252){if(!_0x4c8252)return null;_0x3a90cb[_0x34d8('0x28')][_0x34d8('0x72')]=_0x4c8252;return _0x3a90cb;})[_0x34d8('0x20')](function(_0x1d1fc1){if(_0x1d1fc1){if(_0x297541[_0x34d8('0x55')]['manual']){_0x3a90cb[_0x34d8('0x28')]['interface']=util['format']('SIP/%s',_0x297541['user']['name']);_0x3a90cb[_0x34d8('0x28')]['channel']=_0x3a90cb['channel'];_0x3a90cb['message'][_0x34d8('0x76')]=_0x3a90cb[_0x34d8('0x77')];_0x3a90cb[_0x34d8('0x28')]['event']=_0x34d8('0x59');return respondWithRpcPromise(_0x34d8('0x78'),_0x34d8('0x78'),{'event':'acceptmessage','message':_0x3a90cb['message']},client9002)[_0x34d8('0x20')](function(){return _0x3a90cb;});}return _0x3a90cb;}return null;})[_0x34d8('0x20')](respondWithResult(_0x166c9b,null))['catch'](handleError(_0x166c9b,null));};var interaction_log=require(_0x34d8('0x12'))(_0x34d8('0x58'));exports['reject']=function(_0xa5bb56,_0x2df92e,_0x2b031e){var _0x11596e={'agent':{},'channel':'whatsapp'};if(_0xa5bb56[_0x34d8('0x55')]['id']){delete _0xa5bb56[_0x34d8('0x55')]['id'];}_0xa5bb56[_0x34d8('0x55')][_0x34d8('0x5f')]=_0xa5bb56[_0x34d8('0x55')][_0x34d8('0x5f')]||_0xa5bb56[_0x34d8('0x60')]['id'];_0x11596e[_0x34d8('0x72')]['id']=_0xa5bb56[_0x34d8('0x55')][_0x34d8('0x5f')];return db[_0x34d8('0x38')][_0x34d8('0x53')]({'where':{'id':_0xa5bb56[_0x34d8('0x50')]['id'],'UserId':null}})[_0x34d8('0x20')](handleEntityNotFound(_0x2df92e,null))['then'](function(_0x2b9d5d){if(_0x2b9d5d){_0x11596e[_0x34d8('0x28')]=_0x2b9d5d[_0x34d8('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x34d8('0x53')]({'where':{'id':_0x2b9d5d[_0x34d8('0x63')]}});}return null;})[_0x34d8('0x20')](handleEntityNotFound(_0x2df92e,null))[_0x34d8('0x20')](function(_0xa42fd4){if(_0xa42fd4){_0x11596e[_0x34d8('0x66')]=_0xa42fd4[_0x34d8('0x61')]({'plain':!![]});interaction_log[_0x34d8('0x29')](_0x34d8('0x79'),_0xa5bb56[_0x34d8('0x60')]['id'],_0xa5bb56[_0x34d8('0x60')][_0x34d8('0x36')],_0xa5bb56['user'][_0x34d8('0x68')],_0x11596e[_0x34d8('0x66')]['id'],_0xa5bb56[_0x34d8('0x55')]?JSON[_0x34d8('0x25')](_0xa5bb56[_0x34d8('0x55')]):_0x34d8('0x7a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x11596e);}return null;})[_0x34d8('0x20')](function(_0xc18d67){var _0x3a72f8=_0x34d8('0x7b')+_0xc18d67['message'][_0x34d8('0x6b')];return db[_0x34d8('0x6c')][_0x34d8('0x3d')](_0x3a72f8,{'type':db['Sequelize'][_0x34d8('0x6e')][_0x34d8('0x6f')],'raw':!![]})[_0x34d8('0x20')](function(_0xa48026){return _0xa48026;});})['then'](function(_0x4dba3d){if(_0x4dba3d){_0x11596e[_0x34d8('0x28')][_0x34d8('0x70')]=_0x4dba3d[0x0];if(!_0xa5bb56[_0x34d8('0x55')][_0x34d8('0x5f')])return;return db['User'][_0x34d8('0x53')]({'where':{'id':_0xa5bb56['body']['UserId'],'role':_0x34d8('0x72')},'attributes':['id','name','fullname','email',_0x34d8('0x75')],'raw':!![]});}return null;})[_0x34d8('0x20')](function(_0x4e0067){if(!_0x4e0067)return null;_0x11596e[_0x34d8('0x28')]['agent']=_0x4e0067;return _0x11596e;})[_0x34d8('0x20')](function(_0x50304f){if(_0x50304f){_0x50304f[_0x34d8('0x28')][_0x34d8('0x7c')]=util[_0x34d8('0x5d')](_0x34d8('0x7d'),_0xa5bb56[_0x34d8('0x60')][_0x34d8('0x36')]);_0x50304f[_0x34d8('0x28')][_0x34d8('0x77')]=_0x11596e['channel'];_0x50304f['message'][_0x34d8('0x76')]=_0x11596e['channel'];_0x50304f['message']['event']=_0x34d8('0x7e');respondWithRpcPromise(_0x34d8('0x78'),_0x34d8('0x78'),{'event':_0x34d8('0x7f'),'message':_0x50304f['message']},client9002);return _0x11596e;}return null;})[_0x34d8('0x20')](respondWithResult(_0x2df92e,null))[_0x34d8('0x2a')](handleError(_0x2df92e,null));};exports[_0x34d8('0x34')]=function(_0x57f598,_0x162748,_0x26edf2){if(_0x57f598[_0x34d8('0x55')]['id']){delete _0x57f598['body']['id'];}var _0x47f194;return db[_0x34d8('0x38')][_0x34d8('0x53')]({'where':{'id':_0x57f598[_0x34d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x162748,null))['then'](function(_0x20fd6a){if(_0x20fd6a){_0x47f194=_0x20fd6a;return db['WhatsappAccount'][_0x34d8('0x53')]({'where':{'id':_0x20fd6a['WhatsappAccountId']}});}})[_0x34d8('0x20')](handleEntityNotFound(_0x162748,null))[_0x34d8('0x20')](function(_0xce4d10){if(_0xce4d10){logger[_0x34d8('0x23')](_0x34d8('0x80'),_0x34d8('0x34'),_0x34d8('0x81'),_0xce4d10[_0x34d8('0x3b')],util[_0x34d8('0x82')](_0x57f598[_0x34d8('0x55')],{'showHidden':![],'depth':null}));switch(_0xce4d10[_0x34d8('0x3b')]){case'twilio':if(_0x57f598[_0x34d8('0x55')][_0x34d8('0x83')]&&_0x57f598['body']['MessageSid']===_0x47f194[_0x34d8('0x84')]&&_0x57f598['body'][_0x34d8('0x85')]&&_0x57f598[_0x34d8('0x55')]['MessageStatus']===_0x34d8('0x5b')){return _0x47f194['update']({'read':!![]});}else{logger[_0x34d8('0x26')](_0x34d8('0x86'),_0x34d8('0x34'),'twilio',util[_0x34d8('0x82')](_0x57f598[_0x34d8('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x47f194;}})[_0x34d8('0x20')](respondWithResult(_0x162748,null))[_0x34d8('0x2a')](handleError(_0x162748,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0d68305..e79082e 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 _0x407f=['hook','exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x407f,0xc2));var _0xf407=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x407f[_0x29e0eb];return _0x597d2d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf407('0x0')](0x0);var events={'afterCreate':_0xf407('0x1'),'afterUpdate':_0xf407('0x2'),'afterDestroy':_0xf407('0x3')};function emitEvent(_0x1441bd){return function(_0x886ba,_0x185726,_0x2bb1e4){WhatsappMessageEvents[_0xf407('0x4')](_0x1441bd+':'+_0x886ba['id'],_0x886ba);WhatsappMessageEvents[_0xf407('0x4')](_0x1441bd,_0x886ba);_0x2bb1e4(null);};}for(var e in events){if(events[_0xf407('0x5')](e)){var event=events[e];WhatsappMessage[_0xf407('0x6')](e,emitEvent(event));}}module[_0xf407('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x6599=['hasOwnProperty','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit'];(function(_0x2a9a97,_0x33def8){var _0x2ccabe=function(_0x512f35){while(--_0x512f35){_0x2a9a97['push'](_0x2a9a97['shift']());}};_0x2ccabe(++_0x33def8);}(_0x6599,0xb0));var _0x9659=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x6599[_0x15106b];return _0x521203;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x9659('0x0'))['db'][_0x9659('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9659('0x2')](0x0);var events={'afterCreate':_0x9659('0x3'),'afterUpdate':_0x9659('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb8bddb){return function(_0x5e2a8e,_0x2f5d38,_0x4fd132){WhatsappMessageEvents[_0x9659('0x5')](_0xb8bddb+':'+_0x5e2a8e['id'],_0x5e2a8e);WhatsappMessageEvents[_0x9659('0x5')](_0xb8bddb,_0x5e2a8e);_0x4fd132(null);};}for(var e in events){if(events[_0x9659('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 9e579e2..5263cc9 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 _0x4243=['request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x2f205d,_0x2dde52){var _0x3dbe78=function(_0x44e900){while(--_0x44e900){_0x2f205d['push'](_0x2f205d['shift']());}};_0x3dbe78(++_0x2dde52);}(_0x4243,0x170));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require(_0x3424('0x1'));var logger=require('../../config/logger')(_0x3424('0x2'));var moment=require(_0x3424('0x3'));var BPromise=require('bluebird');var rp=require(_0x3424('0x4'));var fetch=require(_0x3424('0x5'));var fs=require('fs');var path=require(_0x3424('0x6'));var rimraf=require(_0x3424('0x7'));var config=require(_0x3424('0x8'));var attributes=require(_0x3424('0x9'));module[_0x3424('0xa')]=function(_0x2993e6,_0x3a2a08){return _0x2993e6[_0x3424('0xb')](_0x3424('0xc'),attributes,{'tableName':_0x3424('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x3424('0xe')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x3424('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a1d16,_0x2301f4,_0x41619d){var _0x233f4a=_0x2993e6['models'];var _0x388a47=_0x2a1d16[_0x3424('0x10')]({'plain':!![]});if(_0x388a47['direction']['toLowerCase']()==='in'||_0x388a47[_0x3424('0x11')][_0x3424('0x12')]()===_0x3424('0x13')&&!_0x388a47[_0x3424('0x14')]&&!_['isNil'](_0x388a47[_0x3424('0x15')])){_0x233f4a[_0x3424('0x16')][_0x3424('0x17')]({'where':{'id':_0x388a47[_0x3424('0x18')]}})[_0x3424('0x19')](function(_0x12cf09){if(_0x12cf09){_0x12cf09[_0x3424('0x1a')]({'lastMsgAt':_0x388a47['createdAt'],'lastMsgDirection':_0x388a47[_0x3424('0x11')]['toLowerCase']()});}})[_0x3424('0x1b')](function(_0x392d4e){console['error'](_0x392d4e);});}if(_0x388a47[_0x3424('0x11')]===_0x3424('0x13')&&!_0x388a47['secret']){var _0x411a1b;_0x233f4a[_0x3424('0x1c')][_0x3424('0x1d')]({'where':{'id':_0x388a47[_0x3424('0x1e')]},'raw':!![]})['then'](function(_0x8e20c5){_0x411a1b=_0x8e20c5;if(_0x411a1b&&_0x411a1b[_0x3424('0x1f')]){switch(_0x411a1b['type']){case _0x3424('0x20'):var _0x53ddbf=require(_0x3424('0x20'));if(_0x411a1b[_0x3424('0x21')]&&_0x411a1b[_0x3424('0x22')]&&_0x411a1b['phone']){var _0x1b6d7f=new _0x53ddbf(_0x411a1b['accountSid'],_0x411a1b[_0x3424('0x22')]);_0x1b6d7f[_0x3424('0x23')][_0x3424('0x24')]({'body':_0x388a47[_0x3424('0x25')],'to':_0x3424('0x26')+_0x388a47['phone'],'from':'whatsapp:'+_0x411a1b['phone'],'statusCallback':_0x411a1b[_0x3424('0x27')]+_0x3424('0x28')+_0x388a47['id']+_0x3424('0x29')+_0x411a1b[_0x3424('0x2a')]})[_0x3424('0x19')](function(_0xbef128){if(_0xbef128['sid']){return _0x2a1d16[_0x3424('0x1a')]({'messageId':_0xbef128[_0x3424('0x2b')]});}})[_0x3424('0x1b')](function(_0x3a3f3b){logger[_0x3424('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3424('0x2d'),'twilio',util[_0x3424('0x2e')](_0x3a3f3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3424('0x2c')](_0x3424('0x2f'),'afterCreate',_0x3424('0x20'),_0x3424('0x30'));}break;case _0x3424('0x31'):var _0x8d393=_0x411a1b[_0x3424('0x21')];var _0xde1fb1=_0x411a1b[_0x3424('0x22')];var _0xba7b2c=_0x411a1b[_0x3424('0x32')]+_0x3424('0x33')+_0x8d393+_0x3424('0x34');var _0xa594bb={'to':[_0x388a47['phone']],'message':{'type':_0x3424('0x35'),'text':_0x388a47[_0x3424('0x25')]}};var _0x5ac0e6={'method':_0x3424('0x36'),'uri':_0xba7b2c,'headers':{'Authorization':_0x3424('0x37')+_0xde1fb1,'Content-Type':'application/json'},'body':_0xa594bb,'json':!![]};rp(_0x5ac0e6)[_0x3424('0x19')](function(_0x30b8f9){if(_0x30b8f9[_0x3424('0x38')][0x0]['message_id']){return _0x2a1d16['update']({'messageId':_0x30b8f9['statuses'][0x0][_0x3424('0x39')]});}})[_0x3424('0x1b')](function(_0x564f8b){logger[_0x3424('0x3a')](_0x3424('0x3b'),_0x564f8b);});break;}}})[_0x3424('0x3c')](function(){_0x41619d();});}else{_0x41619d();}}},'charset':'utf8mb4','collate':_0x3424('0x3d')});}; \ No newline at end of file +var _0x3f5c=['application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','baseUrl','text','POST','Bearer\x20'];(function(_0x46e574,_0x53d722){var _0x223f77=function(_0xd8df90){while(--_0xd8df90){_0x46e574['push'](_0x46e574['shift']());}};_0x223f77(++_0x53d722);}(_0x3f5c,0x129));var _0xc3f5=function(_0x38ea82,_0xb690b5){_0x38ea82=_0x38ea82-0x0;var _0x286605=_0x3f5c[_0x38ea82];return _0x286605;};'use strict';var _=require(_0xc3f5('0x0'));var util=require('util');var logger=require(_0xc3f5('0x1'))(_0xc3f5('0x2'));var moment=require(_0xc3f5('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3f5('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3f5('0x5'));var config=require('../../config/environment');var attributes=require(_0xc3f5('0x6'));module[_0xc3f5('0x7')]=function(_0x941da5,_0x2015e9){return _0x941da5[_0xc3f5('0x8')]('WhatsappMessage',attributes,{'tableName':_0xc3f5('0x9'),'paranoid':![],'indexes':[{'name':_0xc3f5('0xa'),'fields':[_0xc3f5('0xa')]},{'name':_0xc3f5('0xb'),'fields':[_0xc3f5('0xc')],'type':_0xc3f5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc187d2,_0x388142,_0x37a39e){var _0xcf431f=_0x941da5[_0xc3f5('0xe')];var _0x477644=_0xc187d2[_0xc3f5('0xf')]({'plain':!![]});if(_0x477644[_0xc3f5('0x10')][_0xc3f5('0x11')]()==='in'||_0x477644['direction'][_0xc3f5('0x11')]()===_0xc3f5('0x12')&&!_0x477644[_0xc3f5('0x13')]&&!_[_0xc3f5('0x14')](_0x477644['UserId'])){_0xcf431f[_0xc3f5('0x15')][_0xc3f5('0x16')]({'where':{'id':_0x477644[_0xc3f5('0x17')]}})[_0xc3f5('0x18')](function(_0x297e62){if(_0x297e62){_0x297e62[_0xc3f5('0x19')]({'lastMsgAt':_0x477644[_0xc3f5('0x1a')],'lastMsgDirection':_0x477644[_0xc3f5('0x10')][_0xc3f5('0x11')]()});}})[_0xc3f5('0x1b')](function(_0xe63a93){console[_0xc3f5('0x1c')](_0xe63a93);});}if(_0x477644[_0xc3f5('0x10')]===_0xc3f5('0x12')&&!_0x477644[_0xc3f5('0x13')]){var _0x4f60fd;_0xcf431f[_0xc3f5('0x1d')][_0xc3f5('0x1e')]({'where':{'id':_0x477644[_0xc3f5('0x1f')]},'raw':!![]})['then'](function(_0x5d052a){_0x4f60fd=_0x5d052a;if(_0x4f60fd&&_0x4f60fd['type']){switch(_0x4f60fd[_0xc3f5('0x20')]){case _0xc3f5('0x21'):var _0x3c363b=require('twilio');if(_0x4f60fd['accountSid']&&_0x4f60fd[_0xc3f5('0x22')]&&_0x4f60fd[_0xc3f5('0x23')]){var _0x4e4bce=new _0x3c363b(_0x4f60fd[_0xc3f5('0x24')],_0x4f60fd[_0xc3f5('0x22')]);_0x4e4bce[_0xc3f5('0x25')]['create']({'body':_0x477644[_0xc3f5('0xc')],'to':'whatsapp:'+_0x477644[_0xc3f5('0x23')],'from':_0xc3f5('0x26')+_0x4f60fd[_0xc3f5('0x23')],'statusCallback':_0x4f60fd[_0xc3f5('0x27')]+_0xc3f5('0x28')+_0x477644['id']+_0xc3f5('0x29')+_0x4f60fd[_0xc3f5('0x2a')]})['then'](function(_0x18fdbf){if(_0x18fdbf[_0xc3f5('0x2b')]){return _0xc187d2['update']({'messageId':_0x18fdbf[_0xc3f5('0x2b')]});}})[_0xc3f5('0x1b')](function(_0x3c8819){logger['error'](_0xc3f5('0x2c'),'afterCreate','twilio',util[_0xc3f5('0x2d')](_0x3c8819,{'showHidden':![],'depth':null}));});}else{logger[_0xc3f5('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc3f5('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc3f5('0x2e'):var _0x4be2fa=_0x4f60fd[_0xc3f5('0x24')];var _0x3ef6a4=_0x4f60fd[_0xc3f5('0x22')];var _0x578cb8=_0x4f60fd[_0xc3f5('0x2f')]+'/whatsapp/v1/'+_0x4be2fa+'/messages/';var _0x41ccd7={'to':[_0x477644['phone']],'message':{'type':_0xc3f5('0x30'),'text':_0x477644[_0xc3f5('0xc')]}};var _0x3d32ef={'method':_0xc3f5('0x31'),'uri':_0x578cb8,'headers':{'Authorization':_0xc3f5('0x32')+_0x3ef6a4,'Content-Type':_0xc3f5('0x33')},'body':_0x41ccd7,'json':!![]};rp(_0x3d32ef)[_0xc3f5('0x18')](function(_0x2280fd){if(_0x2280fd[_0xc3f5('0x34')][0x0]['message_id']){return _0xc187d2[_0xc3f5('0x19')]({'messageId':_0x2280fd[_0xc3f5('0x34')][0x0][_0xc3f5('0x35')]});}})[_0xc3f5('0x1b')](function(_0x1a7960){logger[_0xc3f5('0x36')]('WhatsappMessage,\x20%s',_0x1a7960);});break;}}})[_0xc3f5('0x37')](function(){_0x37a39e();});}else{_0x37a39e();}}},'charset':_0xc3f5('0x38'),'collate':_0xc3f5('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c841eef..5f776ce 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 _0xd6f2=['error','code','message','catch','WhatsappMessage','create','raw','then','CreateWhatsappMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd6f2,0x10e));var _0x2d6f=function(_0x2a1a10,_0x4a5931){_0x2a1a10=_0x2a1a10-0x0;var _0x3512f7=_0xd6f2[_0x2a1a10];return _0x3512f7;};'use strict';var _=require('lodash');var util=require(_0x2d6f('0x0'));var moment=require(_0x2d6f('0x1'));var BPromise=require(_0x2d6f('0x2'));var rs=require(_0x2d6f('0x3'));var fs=require('fs');var Redis=require(_0x2d6f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d6f('0x5'));var logger=require(_0x2d6f('0x6'))(_0x2d6f('0x7'));var config=require(_0x2d6f('0x8'));var jayson=require(_0x2d6f('0x9'));var client=jayson['client'][_0x2d6f('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2d6f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d6f('0xc'))(new Redis(config[_0x2d6f('0xb')]));require(_0x2d6f('0xd'))['register'](socket);function respondWithRpcPromise(_0x66e295,_0x415f2e,_0x1225d8){return new BPromise(function(_0x33ca3d,_0x28bcd2){return client[_0x2d6f('0xe')](_0x66e295,_0x1225d8)['then'](function(_0x29fbc2){logger[_0x2d6f('0xf')](_0x2d6f('0x10'),_0x415f2e,_0x2d6f('0x11'));logger[_0x2d6f('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x415f2e,_0x2d6f('0x11'),JSON[_0x2d6f('0x13')](_0x29fbc2));if(_0x29fbc2[_0x2d6f('0x14')]){if(_0x29fbc2[_0x2d6f('0x14')][_0x2d6f('0x15')]===0x1f4){logger[_0x2d6f('0x14')](_0x2d6f('0x10'),_0x415f2e,_0x29fbc2[_0x2d6f('0x14')][_0x2d6f('0x16')]);return _0x28bcd2(_0x29fbc2['error'][_0x2d6f('0x16')]);}logger[_0x2d6f('0x14')](_0x2d6f('0x10'),_0x415f2e,_0x29fbc2['error'][_0x2d6f('0x16')]);return _0x33ca3d(_0x29fbc2['error'][_0x2d6f('0x16')]);}else{logger['info'](_0x2d6f('0x10'),_0x415f2e,'request\x20sent');_0x33ca3d(_0x29fbc2['result'][_0x2d6f('0x16')]);}})[_0x2d6f('0x17')](function(_0x168afa){logger['error'](_0x2d6f('0x10'),_0x415f2e,_0x168afa);_0x28bcd2(_0x168afa);});});}exports['CreateWhatsappMessage']=function(_0x25d55a){var _0x3b9ada=this;return new Promise(function(_0x45e21c,_0xd78b37){return db[_0x2d6f('0x18')][_0x2d6f('0x19')](_0x25d55a['body'],{'raw':_0x25d55a['options']?_0x25d55a['options'][_0x2d6f('0x1a')]===undefined?!![]:![]:!![]})[_0x2d6f('0x1b')](function(_0x58f007){logger[_0x2d6f('0xf')](_0x2d6f('0x1c'),_0x25d55a);logger[_0x2d6f('0x12')](_0x2d6f('0x1c'),_0x25d55a,JSON[_0x2d6f('0x13')](_0x58f007));_0x45e21c(_0x58f007);})[_0x2d6f('0x17')](function(_0x49b81a){logger[_0x2d6f('0x14')](_0x2d6f('0x1c'),_0x49b81a[_0x2d6f('0x16')],_0x25d55a);_0xd78b37(_0x3b9ada[_0x2d6f('0x14')](0x1f4,_0x49b81a['message']));});});}; \ No newline at end of file +var _0x9278=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','create','body','options','raw','then','CreateWhatsappMessage','stringify','catch','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9278,0xf6));var _0x8927=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9278[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x8927('0x0'));var moment=require(_0x8927('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8927('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8927('0x3'));var logger=require('../../config/logger')(_0x8927('0x4'));var config=require(_0x8927('0x5'));var jayson=require(_0x8927('0x6'));var client=jayson[_0x8927('0x7')][_0x8927('0x8')]({'port':0x232a});config['redis']=_[_0x8927('0x9')](config[_0x8927('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8927('0xa')]));require(_0x8927('0xb'))[_0x8927('0xc')](socket);function respondWithRpcPromise(_0x274284,_0x548adb,_0x228ded){return new BPromise(function(_0x3bffa9,_0x15e4b4){return client[_0x8927('0xd')](_0x274284,_0x228ded)['then'](function(_0x3f47a7){logger[_0x8927('0xe')](_0x8927('0xf'),_0x548adb,'request\x20sent');logger[_0x8927('0x10')](_0x8927('0x11'),_0x548adb,_0x8927('0x12'),JSON['stringify'](_0x3f47a7));if(_0x3f47a7[_0x8927('0x13')]){if(_0x3f47a7[_0x8927('0x13')][_0x8927('0x14')]===0x1f4){logger[_0x8927('0x13')](_0x8927('0xf'),_0x548adb,_0x3f47a7[_0x8927('0x13')][_0x8927('0x15')]);return _0x15e4b4(_0x3f47a7[_0x8927('0x13')][_0x8927('0x15')]);}logger[_0x8927('0x13')](_0x8927('0xf'),_0x548adb,_0x3f47a7[_0x8927('0x13')][_0x8927('0x15')]);return _0x3bffa9(_0x3f47a7[_0x8927('0x13')][_0x8927('0x15')]);}else{logger[_0x8927('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x548adb,_0x8927('0x12'));_0x3bffa9(_0x3f47a7[_0x8927('0x16')][_0x8927('0x15')]);}})['catch'](function(_0xa906d2){logger[_0x8927('0x13')](_0x8927('0xf'),_0x548adb,_0xa906d2);_0x15e4b4(_0xa906d2);});});}exports['CreateWhatsappMessage']=function(_0x5e9a2c){var _0x1bb9f4=this;return new Promise(function(_0x3fc795,_0x505f75){return db['WhatsappMessage'][_0x8927('0x17')](_0x5e9a2c[_0x8927('0x18')],{'raw':_0x5e9a2c[_0x8927('0x19')]?_0x5e9a2c[_0x8927('0x19')][_0x8927('0x1a')]===undefined?!![]:![]:!![]})[_0x8927('0x1b')](function(_0x4a796d){logger['info']('CreateWhatsappMessage',_0x5e9a2c);logger[_0x8927('0x10')](_0x8927('0x1c'),_0x5e9a2c,JSON[_0x8927('0x1d')](_0x4a796d));_0x3fc795(_0x4a796d);})[_0x8927('0x1e')](function(_0x4f1a67){logger[_0x8927('0x13')](_0x8927('0x1c'),_0x4f1a67[_0x8927('0x15')],_0x5e9a2c);_0x505f75(_0x1bb9f4[_0x8927('0x13')](0x1f4,_0x4f1a67['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b50197e..9a5b5b2 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 _0x67ed=['./whatsappMessage.events','removeListener','length'];(function(_0x1373c9,_0x18106c){var _0x29260e=function(_0x141197){while(--_0x141197){_0x1373c9['push'](_0x1373c9['shift']());}};_0x29260e(++_0x18106c);}(_0x67ed,0x117));var _0xd67e=function(_0x419971,_0x176b97){_0x419971=_0x419971-0x0;var _0x3313b7=_0x67ed[_0x419971];return _0x3313b7;};'use strict';var WhatsappMessageEvents=require(_0xd67e('0x0'));var events=['save','remove','update'];function createListener(_0x5b73fc,_0x444632){return function(_0x3130a1){_0x444632['emit'](_0x5b73fc,_0x3130a1);};}function removeListener(_0x1872e6,_0x392707){return function(){WhatsappMessageEvents[_0xd67e('0x1')](_0x1872e6,_0x392707);};}exports['register']=function(_0x4e6f9a){for(var _0x225832=0x0,_0x30fbae=events[_0xd67e('0x2')];_0x225832<_0x30fbae;_0x225832++){var _0x4b1432=events[_0x225832];var _0x3977d2=createListener('whatsappMessage:'+_0x4b1432,_0x4e6f9a);WhatsappMessageEvents['on'](_0x4b1432,_0x3977d2);}}; \ No newline at end of file +var _0xc10a=['update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xc10a,0x14a));var _0xac10=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0xc10a[_0x4ca333];return _0x13b2e1;};'use strict';var WhatsappMessageEvents=require(_0xac10('0x0'));var events=[_0xac10('0x1'),_0xac10('0x2'),_0xac10('0x3')];function createListener(_0x474506,_0x73939e){return function(_0x131f5e){_0x73939e[_0xac10('0x4')](_0x474506,_0x131f5e);};}function removeListener(_0x9ac1d7,_0x540abc){return function(){WhatsappMessageEvents[_0xac10('0x5')](_0x9ac1d7,_0x540abc);};}exports[_0xac10('0x6')]=function(_0x173051){for(var _0x5eb210=0x0,_0x48dc0b=events[_0xac10('0x7')];_0x5eb210<_0x48dc0b;_0x5eb210++){var _0x21a952=events[_0x5eb210];var _0x57861f=createListener(_0xac10('0x8')+_0x21a952,_0x173051);WhatsappMessageEvents['on'](_0x21a952,_0x57861f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index cc2aff9..2f8862c 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 _0x76be=['describe','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','put','/:id','delete','destroy','removeTeams','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0x76be,0x8b));var _0xe76b=function(_0x379bdb,_0x45f164){_0x379bdb=_0x379bdb-0x0;var _0x206c15=_0x76be[_0x379bdb];return _0x206c15;};'use strict';var multer=require('multer');var util=require(_0xe76b('0x0'));var path=require('path');var timeout=require(_0xe76b('0x1'));var express=require('express');var router=express[_0xe76b('0x2')]();var fs_extra=require(_0xe76b('0x3'));var auth=require(_0xe76b('0x4'));var interaction=require(_0xe76b('0x5'));var config=require(_0xe76b('0x6'));var controller=require('./whatsappQueue.controller');router[_0xe76b('0x7')]('/',auth[_0xe76b('0x8')](),controller[_0xe76b('0x9')]);router['get'](_0xe76b('0xa'),auth[_0xe76b('0x8')](),controller[_0xe76b('0xb')]);router['get']('/:id',auth[_0xe76b('0x8')](),controller['show']);router['get'](_0xe76b('0xc'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0xe76b('0x8')](),controller[_0xe76b('0xd')]);router[_0xe76b('0x7')](_0xe76b('0xe'),auth[_0xe76b('0x8')](),controller[_0xe76b('0xf')]);router[_0xe76b('0x10')]('/',auth[_0xe76b('0x8')](),controller[_0xe76b('0x11')]);router[_0xe76b('0x10')](_0xe76b('0x12'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xe76b('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe76b('0x13')](_0xe76b('0x14'),auth[_0xe76b('0x8')](),controller['update']);router[_0xe76b('0x15')](_0xe76b('0x14'),auth['isAuthenticated'](),controller[_0xe76b('0x16')]);router['delete']('/:id/teams',auth[_0xe76b('0x8')](),controller[_0xe76b('0x17')]);router[_0xe76b('0x15')]('/:id/users',auth[_0xe76b('0x8')](),controller['removeAgents']);module[_0xe76b('0x18')]=router; \ No newline at end of file +var _0xebb7=['../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','/:id','update','destroy','delete','exports','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4d91d3,_0x53bc93){var _0x533990=function(_0x2401bb){while(--_0x2401bb){_0x4d91d3['push'](_0x4d91d3['shift']());}};_0x533990(++_0x53bc93);}(_0xebb7,0x8c));var _0x7ebb=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xebb7[_0x2a6809];return _0x11c371;};'use strict';var multer=require('multer');var util=require(_0x7ebb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ebb('0x1')]();var fs_extra=require(_0x7ebb('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7ebb('0x3'));var config=require(_0x7ebb('0x4'));var controller=require('./whatsappQueue.controller');router[_0x7ebb('0x5')]('/',auth[_0x7ebb('0x6')](),controller['index']);router[_0x7ebb('0x5')](_0x7ebb('0x7'),auth[_0x7ebb('0x6')](),controller[_0x7ebb('0x8')]);router[_0x7ebb('0x5')]('/:id',auth[_0x7ebb('0x6')](),controller[_0x7ebb('0x9')]);router['get'](_0x7ebb('0xa'),auth[_0x7ebb('0x6')](),controller[_0x7ebb('0xb')]);router['get'](_0x7ebb('0xc'),auth[_0x7ebb('0x6')](),controller[_0x7ebb('0xd')]);router[_0x7ebb('0x5')](_0x7ebb('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7ebb('0xf')]('/',auth[_0x7ebb('0x6')](),controller[_0x7ebb('0x10')]);router[_0x7ebb('0xf')](_0x7ebb('0xc'),auth['isAuthenticated'](),controller[_0x7ebb('0x11')]);router[_0x7ebb('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x7ebb('0x12')]);router['put'](_0x7ebb('0x13'),auth[_0x7ebb('0x6')](),controller[_0x7ebb('0x14')]);router['delete'](_0x7ebb('0x13'),auth[_0x7ebb('0x6')](),controller[_0x7ebb('0x15')]);router[_0x7ebb('0x16')]('/:id/teams',auth[_0x7ebb('0x6')](),controller['removeTeams']);router['delete'](_0x7ebb('0xe'),auth[_0x7ebb('0x6')](),controller['removeAgents']);module[_0x7ebb('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 59746fb..80b6343 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 _0xd691=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3af7b2,_0x5728ee){var _0x4bf040=function(_0x46486b){while(--_0x46486b){_0x3af7b2['push'](_0x3af7b2['shift']());}};_0x4bf040(++_0x5728ee);}(_0xd691,0xe6));var _0x1d69=function(_0x4d692a,_0x5c1506){_0x4d692a=_0x4d692a-0x0;var _0x9ef565=_0xd691[_0x4d692a];return _0x9ef565;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'name':{'type':Sequelize[_0x1d69('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1d69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d69('0x4')](_0x1d69('0x5'),_0x1d69('0x6'),_0x1d69('0x7'))},'description':{'type':Sequelize[_0x1d69('0x2')]}}; \ No newline at end of file +var _0xffdc=['exports','name','INTEGER','rrmemory','beepall','roundrobin','STRING','sequelize'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xffdc,0x7f));var _0xcffd=function(_0xfb534f,_0x1ea5e7){_0xfb534f=_0xfb534f-0x0;var _0x3c42eb=_0xffdc[_0xfb534f];return _0x3c42eb;};'use strict';var Sequelize=require(_0xcffd('0x0'));module[_0xcffd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcffd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcffd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcffd('0x4'),_0xcffd('0x5'),_0xcffd('0x6'))},'description':{'type':Sequelize[_0xcffd('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b5f6a75..ce56899 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 _0x0c40=['reject','save','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','includeAll','findAll','catch','show','params','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','find','describe','findOne','UserWhatsappQueue','sort','WhatsappQueueId','User','UserId','agent','createdAt','rows','%s/%s','SIP','getTeams','Team','ids','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','addAgents','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','end','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x14305a,_0x55304b){var _0x124349=function(_0x53ee85){while(--_0x53ee85){_0x14305a['push'](_0x14305a['shift']());}};_0x124349(++_0x55304b);}(_0x0c40,0x1f4));var _0x00c4=function(_0x4468d5,_0xdfe005){_0x4468d5=_0x4468d5-0x0;var _0x145808=_0x0c40[_0x4468d5];return _0x145808;};'use strict';var emlformat=require(_0x00c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00c4('0x1'));var jsonpatch=require(_0x00c4('0x2'));var rp=require(_0x00c4('0x3'));var moment=require('moment');var BPromise=require(_0x00c4('0x4'));var Mustache=require('mustache');var util=require(_0x00c4('0x5'));var path=require(_0x00c4('0x6'));var sox=require(_0x00c4('0x7'));var csv=require(_0x00c4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00c4('0x9'));var _=require(_0x00c4('0xa'));var squel=require(_0x00c4('0xb'));var crypto=require(_0x00c4('0xc'));var jsforce=require(_0x00c4('0xd'));var deskjs=require(_0x00c4('0xe'));var toCsv=require(_0x00c4('0x8'));var querystring=require(_0x00c4('0xf'));var Papa=require(_0x00c4('0x10'));var Redis=require(_0x00c4('0x11'));var authService=require(_0x00c4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x00c4('0x13'));var hardwareService=require(_0x00c4('0x14'));var logger=require(_0x00c4('0x15'))('api');var utils=require(_0x00c4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x00c4('0x17')]=_[_0x00c4('0x18')](config[_0x00c4('0x17')],{'host':_0x00c4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00c4('0x17')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3aef17,_0x510ac1){_0x510ac1=_0x510ac1||0xcc;return function(_0x402e3b){if(_0x402e3b){return _0x3aef17['sendStatus'](_0x510ac1);}return _0x3aef17['status'](_0x510ac1)[_0x00c4('0x1a')]();};}function respondWithResult(_0x411e92,_0x25467d){_0x25467d=_0x25467d||0xc8;return function(_0x2abd3f){if(_0x2abd3f){return _0x411e92['status'](_0x25467d)[_0x00c4('0x1b')](_0x2abd3f);}};}function respondWithFilteredResult(_0xe859e2,_0x43dd49){return function(_0x590908){if(_0x590908){var _0x522ff3=typeof _0x43dd49[_0x00c4('0x1c')]==='undefined'&&typeof _0x43dd49[_0x00c4('0x1d')]===_0x00c4('0x1e');var _0x4b3af0=_0x590908[_0x00c4('0x1f')];var _0x2d172c=_0x522ff3?0x0:_0x43dd49[_0x00c4('0x1c')];var _0x3238b7=_0x522ff3?_0x590908[_0x00c4('0x1f')]:_0x43dd49[_0x00c4('0x1c')]+_0x43dd49['limit'];var _0x8ed707;if(_0x3238b7>=_0x4b3af0){_0x3238b7=_0x4b3af0;_0x8ed707=0xc8;}else{_0x8ed707=0xce;}_0xe859e2[_0x00c4('0x20')](_0x8ed707);return _0xe859e2[_0x00c4('0x21')](_0x00c4('0x22'),_0x2d172c+'-'+_0x3238b7+'/'+_0x4b3af0)[_0x00c4('0x1b')](_0x590908);}return null;};}function patchUpdates(_0x27836f){return function(_0x3b193f){try{jsonpatch[_0x00c4('0x23')](_0x3b193f,_0x27836f,!![]);}catch(_0x32fb1d){return BPromise[_0x00c4('0x24')](_0x32fb1d);}return _0x3b193f[_0x00c4('0x25')]();};}function saveUpdates(_0x1d42d4,_0x6f75c5){return function(_0x161c76){if(_0x161c76){return _0x161c76[_0x00c4('0x26')](_0x1d42d4)[_0x00c4('0x27')](function(_0x1ab6be){return _0x1ab6be;});}return null;};}function removeEntity(_0x1b1d13,_0x21b8e4){return function(_0x5d7cf2){if(_0x5d7cf2){return _0x5d7cf2[_0x00c4('0x28')]()[_0x00c4('0x27')](function(){var _0x27effc=_0x5d7cf2[_0x00c4('0x29')]({'plain':!![]});var _0x5ba137=_0x00c4('0x2a');return db['UserProfileResource'][_0x00c4('0x28')]({'where':{'type':_0x5ba137,'resourceId':_0x27effc['id']}})[_0x00c4('0x27')](function(){return _0x5d7cf2;});})[_0x00c4('0x27')](function(){_0x1b1d13[_0x00c4('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3cd3,_0x491215){return function(_0x1cf252){if(!_0x1cf252){_0x1b3cd3['sendStatus'](0x194);}return _0x1cf252;};}function handleError(_0x449f6f,_0x949661){_0x949661=_0x949661||0x1f4;return function(_0x1f7d3a){logger[_0x00c4('0x2b')](_0x1f7d3a[_0x00c4('0x2c')]);if(_0x1f7d3a[_0x00c4('0x2d')]){delete _0x1f7d3a['name'];}_0x449f6f['status'](_0x949661)[_0x00c4('0x2e')](_0x1f7d3a);};}exports[_0x00c4('0x2f')]=function(_0x319751,_0x361d30){var _0xd57fcd={},_0x236136={},_0xfaba02={'count':0x0,'rows':[]};var _0x138bcf=_['map'](db[_0x00c4('0x30')][_0x00c4('0x31')],function(_0x536a8f){return{'name':_0x536a8f['fieldName'],'type':_0x536a8f[_0x00c4('0x32')][_0x00c4('0x33')]};});_0x236136[_0x00c4('0x34')]=_['map'](_0x138bcf,'name');_0x236136['query']=_[_0x00c4('0x35')](_0x319751['query']);_0x236136[_0x00c4('0x36')]=_[_0x00c4('0x37')](_0x236136[_0x00c4('0x34')],_0x236136[_0x00c4('0x38')]);_0xd57fcd[_0x00c4('0x39')]=_[_0x00c4('0x37')](_0x236136[_0x00c4('0x34')],qs[_0x00c4('0x3a')](_0x319751['query']['fields']));_0xd57fcd[_0x00c4('0x39')]=_0xd57fcd['attributes'][_0x00c4('0x3b')]?_0xd57fcd[_0x00c4('0x39')]:_0x236136[_0x00c4('0x34')];if(!_0x319751['query'][_0x00c4('0x3c')](_0x00c4('0x3d'))){_0xd57fcd[_0x00c4('0x1d')]=qs['limit'](_0x319751[_0x00c4('0x38')][_0x00c4('0x1d')]);_0xd57fcd[_0x00c4('0x1c')]=qs[_0x00c4('0x1c')](_0x319751[_0x00c4('0x38')][_0x00c4('0x1c')]);}_0xd57fcd[_0x00c4('0x3e')]=qs['sort'](_0x319751[_0x00c4('0x38')]['sort']);_0xd57fcd[_0x00c4('0x3f')]=qs[_0x00c4('0x36')](_[_0x00c4('0x40')](_0x319751[_0x00c4('0x38')],_0x236136[_0x00c4('0x36')]),_0x138bcf);if(_0x319751[_0x00c4('0x38')][_0x00c4('0x41')]){_0xd57fcd['where']=_[_0x00c4('0x42')](_0xd57fcd['where'],{'$or':_[_0x00c4('0x43')](_0x138bcf,function(_0x30240d){if(_0x30240d['type']!=='VIRTUAL'){var _0x3cfdac={};_0x3cfdac[_0x30240d[_0x00c4('0x2d')]]={'$like':'%'+_0x319751[_0x00c4('0x38')][_0x00c4('0x41')]+'%'};return _0x3cfdac;}})});}_0xd57fcd=_[_0x00c4('0x42')]({},_0xd57fcd,_0x319751['options']);var _0x904bfc={'where':_0xd57fcd[_0x00c4('0x3f')]};return db['WhatsappQueue']['count'](_0x904bfc)[_0x00c4('0x27')](function(_0x528ad4){_0xfaba02[_0x00c4('0x1f')]=_0x528ad4;if(_0x319751['query'][_0x00c4('0x44')]){_0xd57fcd['include']=[{'all':!![]}];}return db[_0x00c4('0x30')][_0x00c4('0x45')](_0xd57fcd);})['then'](function(_0x4f5077){_0xfaba02['rows']=_0x4f5077;return _0xfaba02;})[_0x00c4('0x27')](respondWithFilteredResult(_0x361d30,_0xd57fcd))[_0x00c4('0x46')](handleError(_0x361d30,null));};exports[_0x00c4('0x47')]=function(_0x357a7a,_0x640c8c){var _0x10b8b7={'raw':!![],'where':{'id':_0x357a7a[_0x00c4('0x48')]['id']}},_0x41b983={};_0x41b983[_0x00c4('0x34')]=_[_0x00c4('0x35')](db[_0x00c4('0x30')][_0x00c4('0x31')]);_0x41b983['query']=_['keys'](_0x357a7a[_0x00c4('0x38')]);_0x41b983[_0x00c4('0x36')]=_['intersection'](_0x41b983[_0x00c4('0x34')],_0x41b983[_0x00c4('0x38')]);_0x10b8b7[_0x00c4('0x39')]=_[_0x00c4('0x37')](_0x41b983[_0x00c4('0x34')],qs['fields'](_0x357a7a[_0x00c4('0x38')][_0x00c4('0x3a')]));_0x10b8b7[_0x00c4('0x39')]=_0x10b8b7[_0x00c4('0x39')][_0x00c4('0x3b')]?_0x10b8b7['attributes']:_0x41b983[_0x00c4('0x34')];if(_0x357a7a[_0x00c4('0x38')][_0x00c4('0x44')]){_0x10b8b7[_0x00c4('0x49')]=[{'all':!![]}];}_0x10b8b7=_[_0x00c4('0x42')]({},_0x10b8b7,_0x357a7a[_0x00c4('0x4a')]);return db[_0x00c4('0x30')]['find'](_0x10b8b7)[_0x00c4('0x27')](handleEntityNotFound(_0x640c8c,null))[_0x00c4('0x27')](respondWithResult(_0x640c8c,null))[_0x00c4('0x46')](handleError(_0x640c8c,null));};exports[_0x00c4('0x4b')]=function(_0x4b5ed9,_0x5ae58a){return db[_0x00c4('0x30')][_0x00c4('0x4b')](_0x4b5ed9['body'],{})[_0x00c4('0x27')](function(_0x54dbfb){var _0x176bda=_0x4b5ed9[_0x00c4('0x4c')]['get']({'plain':!![]});if(!_0x176bda)throw new Error(_0x00c4('0x4d'));if(_0x176bda[_0x00c4('0x4e')]===_0x00c4('0x4c')){var _0x165c26=_0x54dbfb[_0x00c4('0x29')]({'plain':!![]});var _0x157822=_0x00c4('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x157822,'userProfileId':_0x176bda[_0x00c4('0x4f')]},'raw':!![]})[_0x00c4('0x27')](function(_0x3784b9){if(_0x3784b9&&_0x3784b9[_0x00c4('0x50')]===0x0){return db[_0x00c4('0x51')][_0x00c4('0x4b')]({'name':_0x165c26[_0x00c4('0x2d')],'resourceId':_0x165c26['id'],'type':_0x3784b9['name'],'sectionId':_0x3784b9['id']},{})['then'](function(){return _0x54dbfb;});}else{return _0x54dbfb;}})[_0x00c4('0x46')](function(_0x322320){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x322320);throw _0x322320;});}return _0x54dbfb;})[_0x00c4('0x27')](respondWithResult(_0x5ae58a,0xc9))['catch'](handleError(_0x5ae58a,null));};exports[_0x00c4('0x26')]=function(_0x25fd79,_0x50ce88){if(_0x25fd79[_0x00c4('0x52')]['id']){delete _0x25fd79[_0x00c4('0x52')]['id'];}return db[_0x00c4('0x30')][_0x00c4('0x53')]({'where':{'id':_0x25fd79[_0x00c4('0x48')]['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x50ce88,null))[_0x00c4('0x27')](saveUpdates(_0x25fd79[_0x00c4('0x52')],null))[_0x00c4('0x27')](respondWithResult(_0x50ce88,null))['catch'](handleError(_0x50ce88,null));};exports[_0x00c4('0x28')]=function(_0x2b7e18,_0x280d88){return db[_0x00c4('0x30')][_0x00c4('0x53')]({'where':{'id':_0x2b7e18['params']['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x280d88,null))[_0x00c4('0x27')](removeEntity(_0x280d88,null))[_0x00c4('0x46')](handleError(_0x280d88,null));};exports[_0x00c4('0x54')]=function(_0x3b075f,_0x412be6){return db[_0x00c4('0x30')][_0x00c4('0x54')]()[_0x00c4('0x27')](respondWithResult(_0x412be6,null))['catch'](handleError(_0x412be6,null));};exports['getMembers']=function(_0x2f4bff,_0x20d8ed,_0x520a9e){var _0x597707={'raw':!![],'where':{}},_0x4bfe77={},_0x50f752;return db[_0x00c4('0x30')][_0x00c4('0x55')]({'where':{'id':_0x2f4bff[_0x00c4('0x48')]['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x20d8ed,null))[_0x00c4('0x27')](function(_0x1d4ce2){if(_0x1d4ce2){_0x50f752=_0x1d4ce2[_0x00c4('0x29')]({'plain':!![]});_0x4bfe77[_0x00c4('0x34')]=_['keys'](db[_0x00c4('0x56')]['rawAttributes']);_0x4bfe77['query']=_['keys'](_0x2f4bff[_0x00c4('0x38')]);_0x4bfe77[_0x00c4('0x36')]=_[_0x00c4('0x37')](_0x4bfe77['model'],_0x4bfe77['query']);_0x597707['attributes']=_[_0x00c4('0x37')](_0x4bfe77[_0x00c4('0x34')],qs['fields'](_0x2f4bff[_0x00c4('0x38')][_0x00c4('0x3a')]));_0x597707[_0x00c4('0x39')]=_0x597707[_0x00c4('0x39')]['length']?_0x597707[_0x00c4('0x39')]:_0x4bfe77['model'];if(!_0x2f4bff[_0x00c4('0x38')]['hasOwnProperty']('nolimit')){_0x597707[_0x00c4('0x1d')]=qs[_0x00c4('0x1d')](_0x2f4bff['query'][_0x00c4('0x1d')]);_0x597707[_0x00c4('0x1c')]=qs['offset'](_0x2f4bff[_0x00c4('0x38')][_0x00c4('0x1c')]);}_0x597707[_0x00c4('0x3e')]=qs[_0x00c4('0x57')](_0x2f4bff[_0x00c4('0x38')][_0x00c4('0x57')]);_0x597707[_0x00c4('0x3f')]=qs[_0x00c4('0x36')](_[_0x00c4('0x40')](_0x2f4bff[_0x00c4('0x38')],_0x4bfe77[_0x00c4('0x36')]));_0x597707['where'][_0x00c4('0x58')]=_0x1d4ce2['id'];if(_0x2f4bff[_0x00c4('0x38')]['filter']){_0x597707['where']=_[_0x00c4('0x42')](_0x597707[_0x00c4('0x3f')],{'$or':_[_0x00c4('0x43')](_0x597707['attributes'],function(_0x46a296){var _0x7f7221={};_0x7f7221[_0x46a296]={'$like':'%'+_0x2f4bff[_0x00c4('0x38')][_0x00c4('0x41')]+'%'};return _0x7f7221;})});}_0x597707=_[_0x00c4('0x42')]({},_0x597707,_0x2f4bff['options']);return db[_0x00c4('0x56')][_0x00c4('0x45')](_0x597707);}})['then'](function(_0x5a144c){if(_0x5a144c){return db[_0x00c4('0x59')]['findAndCountAll']({'where':{'id':_[_0x00c4('0x43')](_0x5a144c,_0x00c4('0x5a')),'role':_0x00c4('0x5b')},'attributes':['id',_0x00c4('0x2d'),'whatsappPause','updatedAt',_0x00c4('0x5c')]});}})['then'](function(_0x49bc83){if(_0x49bc83){return{'count':_0x49bc83[_0x00c4('0x1f')],'rows':_[_0x00c4('0x43')](_0x49bc83[_0x00c4('0x5d')],function(_0x1f4a82){return{'membername':_0x1f4a82[_0x00c4('0x2d')],'UserId':_0x1f4a82['id'],'queue_name':_0x50f752[_0x00c4('0x2d')],'WhatsappQueueId':_0x50f752['id'],'interface':util['format'](_0x00c4('0x5e'),_0x00c4('0x5f'),_0x1f4a82[_0x00c4('0x2d')]),'penalty':0x0,'paused':_0x1f4a82['whatsappPause'],'createdAt':_0x1f4a82['createdAt'],'updatedAt':_0x1f4a82['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x00c4('0x27')](respondWithFilteredResult(_0x20d8ed,_0x597707))['catch'](handleError(_0x20d8ed,null));};exports[_0x00c4('0x60')]=function(_0x445bda,_0x27797e,_0x459801){var _0xaec558={};var _0x542706={};var _0x5875a1;var _0x29ba70;return db[_0x00c4('0x30')]['findOne']({'where':{'id':_0x445bda[_0x00c4('0x48')]['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x27797e,null))[_0x00c4('0x27')](function(_0x360b3d){if(_0x360b3d){_0x5875a1=_0x360b3d;_0x542706['model']=_[_0x00c4('0x35')](db[_0x00c4('0x61')][_0x00c4('0x31')]);_0x542706[_0x00c4('0x38')]=_[_0x00c4('0x35')](_0x445bda[_0x00c4('0x38')]);_0x542706['filters']=_[_0x00c4('0x37')](_0x542706[_0x00c4('0x34')],_0x542706[_0x00c4('0x38')]);_0xaec558['attributes']=_[_0x00c4('0x37')](_0x542706[_0x00c4('0x34')],qs[_0x00c4('0x3a')](_0x445bda[_0x00c4('0x38')][_0x00c4('0x3a')]));_0xaec558[_0x00c4('0x39')]=_0xaec558['attributes']['length']?_0xaec558[_0x00c4('0x39')]:_0x542706[_0x00c4('0x34')];_0xaec558[_0x00c4('0x3e')]=qs[_0x00c4('0x57')](_0x445bda['query'][_0x00c4('0x57')]);_0xaec558['where']=qs['filters'](_[_0x00c4('0x40')](_0x445bda['query'],_0x542706[_0x00c4('0x36')]));if(_0x445bda['query']['filter']){_0xaec558['where']=_[_0x00c4('0x42')](_0xaec558[_0x00c4('0x3f')],{'$or':_['map'](_0xaec558[_0x00c4('0x39')],function(_0x50ea8c){var _0x373a6e={};_0x373a6e[_0x50ea8c]={'$like':'%'+_0x445bda[_0x00c4('0x38')][_0x00c4('0x41')]+'%'};return _0x373a6e;})});}_0xaec558=_[_0x00c4('0x42')]({},_0xaec558,_0x445bda[_0x00c4('0x4a')]);return _0x5875a1[_0x00c4('0x60')](_0xaec558);}})[_0x00c4('0x27')](function(_0x4d3a43){if(_0x4d3a43){_0x29ba70=_0x4d3a43[_0x00c4('0x3b')];if(!_0x445bda[_0x00c4('0x38')][_0x00c4('0x3c')](_0x00c4('0x3d'))){_0xaec558['limit']=qs[_0x00c4('0x1d')](_0x445bda[_0x00c4('0x38')]['limit']);_0xaec558['offset']=qs['offset'](_0x445bda[_0x00c4('0x38')][_0x00c4('0x1c')]);}return _0x5875a1[_0x00c4('0x60')](_0xaec558);}})[_0x00c4('0x27')](function(_0x2d910e){if(_0x2d910e){return _0x2d910e?{'count':_0x29ba70,'rows':_0x2d910e}:null;}})[_0x00c4('0x27')](respondWithResult(_0x27797e,null))[_0x00c4('0x46')](handleError(_0x27797e,null));};exports['addTeams']=function(_0x48e275,_0x503d07,_0x242578){var _0x2260d3=_0x48e275[_0x00c4('0x52')][_0x00c4('0x62')];return db[_0x00c4('0x61')][_0x00c4('0x45')]({'where':{'id':_0x2260d3},'attributes':['id'],'include':[{'model':db[_0x00c4('0x59')],'as':_0x00c4('0x63'),'attributes':['id',_0x00c4('0x2d'),'online','voicePause',_0x00c4('0x64')],'raw':!![]}]})['then'](function(_0x1ef88d){if(_0x1ef88d){var _0x541b87=_['flatMap'](_0x1ef88d,function(_0x4c800a){var _0x441e0b=_0x4c800a['get']({'plain':!![]});return _0x441e0b[_0x00c4('0x63')];});return db['WhatsappQueue'][_0x00c4('0x53')]({'where':{'id':_0x48e275[_0x00c4('0x48')]['id']}})['then'](function(_0x4f937a){return db[_0x00c4('0x65')][_0x00c4('0x66')](function(_0x1b09be){return _0x4f937a[_0x00c4('0x67')](_0x2260d3,{'transaction':_0x1b09be})['then'](function(){return BPromise[_0x00c4('0x68')](_0x541b87,function(_0x531e81){return db['UserWhatsappQueue'][_0x00c4('0x69')]({'where':{'UserId':_0x531e81['id'],'WhatsappQueueId':_0x48e275[_0x00c4('0x48')]['id']},'transaction':_0x1b09be});});})['then'](function(){_0x541b87[_0x00c4('0x6a')](function(_0x351709){socket[_0x00c4('0x6b')]('userWhatsappQueue:save',{'UserId':_0x351709['id'],'WhatsappQueueId':_0x4f937a['id']});});});});});}})[_0x00c4('0x27')](respondWithStatusCode(_0x503d07,null))[_0x00c4('0x46')](handleError(_0x503d07,null));};exports[_0x00c4('0x6c')]=function(_0x4b86de,_0x248024,_0x443eb0){return db[_0x00c4('0x61')]['findAll']({'where':{'id':_0x4b86de[_0x00c4('0x38')][_0x00c4('0x62')]},'attributes':['id'],'include':[{'model':db[_0x00c4('0x59')],'as':_0x00c4('0x63'),'attributes':['id'],'raw':!![]}]})[_0x00c4('0x27')](handleEntityNotFound(_0x248024,null))[_0x00c4('0x27')](function(_0x381934){var _0x585737=_[_0x00c4('0x43')](_0x381934,'id');var _0x11e75b=[];var _0x3e8d3d=[];var _0x37e449=squel[_0x00c4('0x6d')]();_0x37e449[_0x00c4('0x6e')](_0x00c4('0x6f'))[_0x00c4('0x70')](_0x00c4('0x71'),'tq')[_0x00c4('0x72')](_0x00c4('0x73'),'ut',_0x00c4('0x74'))[_0x00c4('0x3f')](_0x00c4('0x75'),_0x4b86de[_0x00c4('0x48')]['id']);for(var _0x82bbed=0x0;_0x82bbed<_0x381934['length'];_0x82bbed+=0x1){let _0x1edf4c=_0x381934[_0x82bbed];for(var _0x161c1e=0x0;_0x161c1e<_0x1edf4c[_0x00c4('0x63')]['length'];_0x161c1e+=0x1){let _0x179884=_0x1edf4c['Agents'][_0x161c1e];var _0x3b8250=_0x37e449[_0x00c4('0x76')]();_0x3b8250['where'](_0x00c4('0x77'),_0x179884['id']);_0x3e8d3d[_0x00c4('0x78')](db[_0x00c4('0x65')][_0x00c4('0x38')](_0x3b8250[_0x00c4('0x79')](),{'type':db[_0x00c4('0x65')][_0x00c4('0x7a')][_0x00c4('0x7b')]})['then'](function(_0xd523c4){if(_0xd523c4['length']===0x1){return _0x179884['id'];}else{var _0x403f46=_[_0x00c4('0x7c')](_['map'](_0xd523c4,_0x00c4('0x7d')),function(_0x525834){return _[_0x00c4('0x7e')](_0x585737,_0x525834);});if(_0x403f46){return _0x179884['id'];}}}));}}return BPromise[_0x00c4('0x7f')](_0x3e8d3d)[_0x00c4('0x27')](function(_0x5ce785){_0x11e75b=_(_0x11e75b)[_0x00c4('0x80')](_0x5ce785)['compact']()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x4b86de[_0x00c4('0x48')]['id']}})[_0x00c4('0x27')](function(_0x3642a7){return db['sequelize'][_0x00c4('0x66')](function(_0x17133e){return _0x3642a7[_0x00c4('0x6c')](_0x4b86de['query'][_0x00c4('0x62')],{'transaction':_0x17133e})[_0x00c4('0x27')](function(){if(!_['isEmpty'](_0x11e75b)){return _0x3642a7[_0x00c4('0x81')](_0x11e75b,{'transaction':_0x17133e});}})[_0x00c4('0x27')](function(){_0x11e75b['forEach'](function(_0x40dd51){socket[_0x00c4('0x6b')]('userWhatsappQueue:remove',{'UserId':_0x40dd51,'WhatsappQueueId':_0x3642a7['id']});});});});});});})['then'](respondWithStatusCode(_0x248024,null))[_0x00c4('0x46')](handleError(_0x248024,null));};exports[_0x00c4('0x82')]=function(_0x4ed50f,_0x432af2,_0x23e6b5){return db['WhatsappQueue'][_0x00c4('0x53')]({'where':{'id':_0x4ed50f[_0x00c4('0x48')]['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x432af2,null))[_0x00c4('0x27')](function(_0xceaa9d){if(_0xceaa9d){return _0xceaa9d[_0x00c4('0x82')](_0x4ed50f[_0x00c4('0x52')][_0x00c4('0x62')],_['omit'](_0x4ed50f['body'],[_0x00c4('0x62'),'id'])||{})['spread'](function(_0x8bdeb0){for(var _0xa6d933=0x0;_0xa6d933<_0x4ed50f[_0x00c4('0x52')][_0x00c4('0x62')][_0x00c4('0x3b')];_0xa6d933+=0x1){socket[_0x00c4('0x6b')](_0x00c4('0x83'),{'UserId':Number(_0x4ed50f[_0x00c4('0x52')]['ids'][_0xa6d933]),'WhatsappQueueId':Number(_0x4ed50f[_0x00c4('0x48')]['id'])});}return _0x8bdeb0;});}})[_0x00c4('0x27')](respondWithResult(_0x432af2,null))['catch'](handleError(_0x432af2,null));};exports['removeAgents']=function(_0x490260,_0x293da1,_0x5bb672){return db[_0x00c4('0x30')][_0x00c4('0x53')]({'where':{'id':_0x490260[_0x00c4('0x48')]['id']}})['then'](handleEntityNotFound(_0x293da1,null))['then'](function(_0x4bca1f){if(_0x4bca1f){return _0x4bca1f[_0x00c4('0x81')](_0x490260['query'][_0x00c4('0x62')])['then'](function(){if(_['isArray'](_0x490260[_0x00c4('0x38')]['ids'])){for(var _0x23045a=0x0;_0x23045a<_0x490260[_0x00c4('0x38')]['ids'][_0x00c4('0x3b')];_0x23045a+=0x1){socket[_0x00c4('0x6b')]('userWhatsappQueue:remove',{'UserId':Number(_0x490260[_0x00c4('0x38')][_0x00c4('0x62')][_0x23045a]),'WhatsappQueueId':Number(_0x490260['params']['id'])});}}else{socket['emit'](_0x00c4('0x84'),{'UserId':Number(_0x490260[_0x00c4('0x38')][_0x00c4('0x62')]),'WhatsappQueueId':Number(_0x490260[_0x00c4('0x48')]['id'])});}});}})[_0x00c4('0x27')](respondWithStatusCode(_0x293da1,null))[_0x00c4('0x46')](handleError(_0x293da1,null));};exports['getAgents']=function(_0x50bc5e,_0x1a95e1,_0x29936f){var _0xb051cd={};var _0x172f64={};var _0x5b1888;var _0x213947;return db[_0x00c4('0x30')][_0x00c4('0x55')]({'where':{'id':_0x50bc5e['params']['id']}})[_0x00c4('0x27')](handleEntityNotFound(_0x1a95e1,null))[_0x00c4('0x27')](function(_0x449f07){if(_0x449f07){_0x5b1888=_0x449f07;_0x172f64[_0x00c4('0x34')]=_[_0x00c4('0x35')](db[_0x00c4('0x59')]['rawAttributes']);_0x172f64[_0x00c4('0x38')]=_[_0x00c4('0x35')](_0x50bc5e[_0x00c4('0x38')]);_0x172f64[_0x00c4('0x36')]=_[_0x00c4('0x37')](_0x172f64[_0x00c4('0x34')],_0x172f64[_0x00c4('0x38')]);_0xb051cd[_0x00c4('0x39')]=_[_0x00c4('0x37')](_0x172f64[_0x00c4('0x34')],qs['fields'](_0x50bc5e['query'][_0x00c4('0x3a')]));_0xb051cd[_0x00c4('0x39')]=_0xb051cd[_0x00c4('0x39')][_0x00c4('0x3b')]?_0xb051cd[_0x00c4('0x39')]:_0x172f64[_0x00c4('0x34')];_0xb051cd[_0x00c4('0x3e')]=qs['sort'](_0x50bc5e['query'][_0x00c4('0x57')]);_0xb051cd[_0x00c4('0x3f')]=qs[_0x00c4('0x36')](_['pick'](_0x50bc5e['query'],_0x172f64[_0x00c4('0x36')]));if(_0x50bc5e[_0x00c4('0x38')][_0x00c4('0x41')]){_0xb051cd['where']=_[_0x00c4('0x42')](_0xb051cd[_0x00c4('0x3f')],{'$or':_[_0x00c4('0x43')](_0xb051cd[_0x00c4('0x39')],function(_0xd97860){var _0x322fc8={};_0x322fc8[_0xd97860]={'$like':'%'+_0x50bc5e[_0x00c4('0x38')][_0x00c4('0x41')]+'%'};return _0x322fc8;})});}_0xb051cd=_[_0x00c4('0x42')]({},_0xb051cd,_0x50bc5e[_0x00c4('0x4a')]);return _0x5b1888[_0x00c4('0x85')](_0xb051cd);}})[_0x00c4('0x27')](function(_0x1ecdaf){if(_0x1ecdaf){_0x213947=_0x1ecdaf['length'];if(!_0x50bc5e[_0x00c4('0x38')][_0x00c4('0x3c')](_0x00c4('0x3d'))){_0xb051cd[_0x00c4('0x1d')]=qs['limit'](_0x50bc5e[_0x00c4('0x38')][_0x00c4('0x1d')]);_0xb051cd[_0x00c4('0x1c')]=qs[_0x00c4('0x1c')](_0x50bc5e[_0x00c4('0x38')][_0x00c4('0x1c')]);}return _0x5b1888['getAgents'](_0xb051cd);}})[_0x00c4('0x27')](function(_0x1d3f27){if(_0x1d3f27){return _0x1d3f27?{'count':_0x213947,'rows':_0x1d3f27}:null;}})['then'](respondWithResult(_0x1a95e1,null))[_0x00c4('0x46')](handleError(_0x1a95e1,null));}; \ No newline at end of file +var _0x3101=['attributes','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','show','params','includeAll','include','options','find','catch','create','body','user','role','WhatsappQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','createdAt','rows','format','%s/%s','SIP','whatsappPause','updatedAt','getTeams','nolimit','addTeams','ids','online','voicePause','flatMap','Agents','forEach','emit','userWhatsappQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','limit','count','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','keys','query','intersection','fields'];(function(_0x5a8968,_0x4d328b){var _0x5cebff=function(_0x46c6b3){while(--_0x46c6b3){_0x5a8968['push'](_0x5a8968['shift']());}};_0x5cebff(++_0x4d328b);}(_0x3101,0x16b));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1310('0x0'));var rimraf=require(_0x1310('0x1'));var zipdir=require(_0x1310('0x2'));var jsonpatch=require(_0x1310('0x3'));var rp=require(_0x1310('0x4'));var moment=require(_0x1310('0x5'));var BPromise=require(_0x1310('0x6'));var Mustache=require(_0x1310('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1310('0x8'));var fs=require('fs');var fs_extra=require(_0x1310('0x9'));var _=require(_0x1310('0xa'));var squel=require(_0x1310('0xb'));var crypto=require(_0x1310('0xc'));var jsforce=require(_0x1310('0xd'));var deskjs=require(_0x1310('0xe'));var toCsv=require(_0x1310('0xf'));var querystring=require(_0x1310('0x10'));var Papa=require('papaparse');var Redis=require(_0x1310('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1310('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1310('0x13'));var logger=require('../../config/logger')(_0x1310('0x14'));var utils=require(_0x1310('0x15'));var config=require(_0x1310('0x16'));var licenseUtil=require(_0x1310('0x17'));var db=require(_0x1310('0x18'))['db'];config[_0x1310('0x19')]=_[_0x1310('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1310('0x1b'))(new Redis(config[_0x1310('0x19')]));require('./whatsappQueue.socket')[_0x1310('0x1c')](socket);function respondWithStatusCode(_0x5c3a96,_0xe525f1){_0xe525f1=_0xe525f1||0xcc;return function(_0x54bd43){if(_0x54bd43){return _0x5c3a96[_0x1310('0x1d')](_0xe525f1);}return _0x5c3a96[_0x1310('0x1e')](_0xe525f1)[_0x1310('0x1f')]();};}function respondWithResult(_0xcfb9c3,_0x3d6d3c){_0x3d6d3c=_0x3d6d3c||0xc8;return function(_0xb4f214){if(_0xb4f214){return _0xcfb9c3[_0x1310('0x1e')](_0x3d6d3c)['json'](_0xb4f214);}};}function respondWithFilteredResult(_0x25896b,_0xf50c7e){return function(_0x2d4ba7){if(_0x2d4ba7){var _0x55c479=typeof _0xf50c7e[_0x1310('0x20')]==='undefined'&&typeof _0xf50c7e[_0x1310('0x21')]==='undefined';var _0x39738f=_0x2d4ba7['count'];var _0x22ea6e=_0x55c479?0x0:_0xf50c7e[_0x1310('0x20')];var _0x3f7d8f=_0x55c479?_0x2d4ba7[_0x1310('0x22')]:_0xf50c7e[_0x1310('0x20')]+_0xf50c7e[_0x1310('0x21')];var _0x33419f;if(_0x3f7d8f>=_0x39738f){_0x3f7d8f=_0x39738f;_0x33419f=0xc8;}else{_0x33419f=0xce;}_0x25896b[_0x1310('0x1e')](_0x33419f);return _0x25896b[_0x1310('0x23')](_0x1310('0x24'),_0x22ea6e+'-'+_0x3f7d8f+'/'+_0x39738f)['json'](_0x2d4ba7);}return null;};}function patchUpdates(_0x9a9644){return function(_0x24b5b6){try{jsonpatch['apply'](_0x24b5b6,_0x9a9644,!![]);}catch(_0x3351e7){return BPromise[_0x1310('0x25')](_0x3351e7);}return _0x24b5b6[_0x1310('0x26')]();};}function saveUpdates(_0x4bab40,_0x5d02eb){return function(_0x376d73){if(_0x376d73){return _0x376d73['update'](_0x4bab40)[_0x1310('0x27')](function(_0x1b5544){return _0x1b5544;});}return null;};}function removeEntity(_0x52f6ee,_0x8b45df){return function(_0x262d71){if(_0x262d71){return _0x262d71[_0x1310('0x28')]()[_0x1310('0x27')](function(){var _0x50e1be=_0x262d71[_0x1310('0x29')]({'plain':!![]});var _0x22e13b='WhatsappQueues';return db[_0x1310('0x2a')][_0x1310('0x28')]({'where':{'type':_0x22e13b,'resourceId':_0x50e1be['id']}})[_0x1310('0x27')](function(){return _0x262d71;});})[_0x1310('0x27')](function(){_0x52f6ee['status'](0xcc)[_0x1310('0x1f')]();});}};}function handleEntityNotFound(_0x20ad43,_0x590632){return function(_0x5c62c1){if(!_0x5c62c1){_0x20ad43[_0x1310('0x1d')](0x194);}return _0x5c62c1;};}function handleError(_0x19f9fc,_0x3d5412){_0x3d5412=_0x3d5412||0x1f4;return function(_0x3fa7c0){logger['error'](_0x3fa7c0[_0x1310('0x2b')]);if(_0x3fa7c0['name']){delete _0x3fa7c0[_0x1310('0x2c')];}_0x19f9fc[_0x1310('0x1e')](_0x3d5412)[_0x1310('0x2d')](_0x3fa7c0);};}exports[_0x1310('0x2e')]=function(_0x563da1,_0x37b7f6){var _0x2a0507={},_0x5bde4e={},_0x255e9e={'count':0x0,'rows':[]};var _0x41bd7a=_[_0x1310('0x2f')](db[_0x1310('0x30')][_0x1310('0x31')],function(_0xefec87){return{'name':_0xefec87[_0x1310('0x32')],'type':_0xefec87['type'][_0x1310('0x33')]};});_0x5bde4e[_0x1310('0x34')]=_[_0x1310('0x2f')](_0x41bd7a,_0x1310('0x2c'));_0x5bde4e['query']=_[_0x1310('0x35')](_0x563da1[_0x1310('0x36')]);_0x5bde4e['filters']=_[_0x1310('0x37')](_0x5bde4e[_0x1310('0x34')],_0x5bde4e[_0x1310('0x36')]);_0x2a0507['attributes']=_[_0x1310('0x37')](_0x5bde4e['model'],qs[_0x1310('0x38')](_0x563da1[_0x1310('0x36')][_0x1310('0x38')]));_0x2a0507[_0x1310('0x39')]=_0x2a0507[_0x1310('0x39')][_0x1310('0x3a')]?_0x2a0507[_0x1310('0x39')]:_0x5bde4e['model'];if(!_0x563da1[_0x1310('0x36')]['hasOwnProperty']('nolimit')){_0x2a0507[_0x1310('0x21')]=qs[_0x1310('0x21')](_0x563da1[_0x1310('0x36')][_0x1310('0x21')]);_0x2a0507[_0x1310('0x20')]=qs['offset'](_0x563da1[_0x1310('0x36')]['offset']);}_0x2a0507[_0x1310('0x3b')]=qs[_0x1310('0x3c')](_0x563da1[_0x1310('0x36')][_0x1310('0x3c')]);_0x2a0507[_0x1310('0x3d')]=qs[_0x1310('0x3e')](_[_0x1310('0x3f')](_0x563da1[_0x1310('0x36')],_0x5bde4e[_0x1310('0x3e')]),_0x41bd7a);if(_0x563da1[_0x1310('0x36')]['filter']){_0x2a0507[_0x1310('0x3d')]=_[_0x1310('0x40')](_0x2a0507[_0x1310('0x3d')],{'$or':_[_0x1310('0x2f')](_0x41bd7a,function(_0x472e7a){if(_0x472e7a[_0x1310('0x41')]!==_0x1310('0x42')){var _0x915d6f={};_0x915d6f[_0x472e7a[_0x1310('0x2c')]]={'$like':'%'+_0x563da1[_0x1310('0x36')][_0x1310('0x43')]+'%'};return _0x915d6f;}})});}_0x2a0507=_[_0x1310('0x40')]({},_0x2a0507,_0x563da1['options']);var _0x4dd449={'where':_0x2a0507[_0x1310('0x3d')]};return db[_0x1310('0x30')][_0x1310('0x22')](_0x4dd449)[_0x1310('0x27')](function(_0x5d0096){_0x255e9e['count']=_0x5d0096;if(_0x563da1[_0x1310('0x36')]['includeAll']){_0x2a0507['include']=[{'all':!![]}];}return db[_0x1310('0x30')]['findAll'](_0x2a0507);})[_0x1310('0x27')](function(_0x861cb){_0x255e9e['rows']=_0x861cb;return _0x255e9e;})[_0x1310('0x27')](respondWithFilteredResult(_0x37b7f6,_0x2a0507))['catch'](handleError(_0x37b7f6,null));};exports[_0x1310('0x44')]=function(_0x592139,_0x595dc8){var _0x51ca35={'raw':!![],'where':{'id':_0x592139[_0x1310('0x45')]['id']}},_0x72dbcf={};_0x72dbcf[_0x1310('0x34')]=_['keys'](db[_0x1310('0x30')]['rawAttributes']);_0x72dbcf[_0x1310('0x36')]=_['keys'](_0x592139['query']);_0x72dbcf[_0x1310('0x3e')]=_[_0x1310('0x37')](_0x72dbcf[_0x1310('0x34')],_0x72dbcf[_0x1310('0x36')]);_0x51ca35[_0x1310('0x39')]=_[_0x1310('0x37')](_0x72dbcf[_0x1310('0x34')],qs[_0x1310('0x38')](_0x592139[_0x1310('0x36')]['fields']));_0x51ca35[_0x1310('0x39')]=_0x51ca35[_0x1310('0x39')]['length']?_0x51ca35['attributes']:_0x72dbcf['model'];if(_0x592139[_0x1310('0x36')][_0x1310('0x46')]){_0x51ca35[_0x1310('0x47')]=[{'all':!![]}];}_0x51ca35=_['merge']({},_0x51ca35,_0x592139[_0x1310('0x48')]);return db['WhatsappQueue'][_0x1310('0x49')](_0x51ca35)['then'](handleEntityNotFound(_0x595dc8,null))[_0x1310('0x27')](respondWithResult(_0x595dc8,null))[_0x1310('0x4a')](handleError(_0x595dc8,null));};exports[_0x1310('0x4b')]=function(_0x1e771a,_0x503e38){return db['WhatsappQueue'][_0x1310('0x4b')](_0x1e771a[_0x1310('0x4c')],{})[_0x1310('0x27')](function(_0x2afedf){var _0x440df3=_0x1e771a[_0x1310('0x4d')][_0x1310('0x29')]({'plain':!![]});if(!_0x440df3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x440df3[_0x1310('0x4e')]===_0x1310('0x4d')){var _0x3dfb01=_0x2afedf[_0x1310('0x29')]({'plain':!![]});var _0x1366fd=_0x1310('0x4f');return db[_0x1310('0x50')][_0x1310('0x49')]({'where':{'name':_0x1366fd,'userProfileId':_0x440df3['userProfileId']},'raw':!![]})[_0x1310('0x27')](function(_0x1127c9){if(_0x1127c9&&_0x1127c9[_0x1310('0x51')]===0x0){return db[_0x1310('0x2a')][_0x1310('0x4b')]({'name':_0x3dfb01[_0x1310('0x2c')],'resourceId':_0x3dfb01['id'],'type':_0x1127c9[_0x1310('0x2c')],'sectionId':_0x1127c9['id']},{})['then'](function(){return _0x2afedf;});}else{return _0x2afedf;}})[_0x1310('0x4a')](function(_0x2fbcd0){logger['error'](_0x1310('0x52'),_0x2fbcd0);throw _0x2fbcd0;});}return _0x2afedf;})[_0x1310('0x27')](respondWithResult(_0x503e38,0xc9))[_0x1310('0x4a')](handleError(_0x503e38,null));};exports['update']=function(_0x32dbd9,_0x3a6cfa){if(_0x32dbd9[_0x1310('0x4c')]['id']){delete _0x32dbd9['body']['id'];}return db[_0x1310('0x30')][_0x1310('0x49')]({'where':{'id':_0x32dbd9[_0x1310('0x45')]['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x3a6cfa,null))[_0x1310('0x27')](saveUpdates(_0x32dbd9['body'],null))[_0x1310('0x27')](respondWithResult(_0x3a6cfa,null))[_0x1310('0x4a')](handleError(_0x3a6cfa,null));};exports[_0x1310('0x28')]=function(_0x1ef9b5,_0x1d1936){return db[_0x1310('0x30')][_0x1310('0x49')]({'where':{'id':_0x1ef9b5[_0x1310('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d1936,null))[_0x1310('0x27')](removeEntity(_0x1d1936,null))[_0x1310('0x4a')](handleError(_0x1d1936,null));};exports[_0x1310('0x53')]=function(_0x416e38,_0x1af4f9){return db[_0x1310('0x30')][_0x1310('0x53')]()['then'](respondWithResult(_0x1af4f9,null))['catch'](handleError(_0x1af4f9,null));};exports[_0x1310('0x54')]=function(_0x33b176,_0x5034d4,_0x41c2e6){var _0x18529f={'raw':!![],'where':{}},_0x135942={},_0x2db075;return db[_0x1310('0x30')][_0x1310('0x55')]({'where':{'id':_0x33b176[_0x1310('0x45')]['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x5034d4,null))['then'](function(_0x5ee9ec){if(_0x5ee9ec){_0x2db075=_0x5ee9ec['get']({'plain':!![]});_0x135942[_0x1310('0x34')]=_[_0x1310('0x35')](db['UserWhatsappQueue'][_0x1310('0x31')]);_0x135942[_0x1310('0x36')]=_[_0x1310('0x35')](_0x33b176['query']);_0x135942['filters']=_[_0x1310('0x37')](_0x135942[_0x1310('0x34')],_0x135942[_0x1310('0x36')]);_0x18529f['attributes']=_['intersection'](_0x135942[_0x1310('0x34')],qs[_0x1310('0x38')](_0x33b176[_0x1310('0x36')][_0x1310('0x38')]));_0x18529f[_0x1310('0x39')]=_0x18529f[_0x1310('0x39')][_0x1310('0x3a')]?_0x18529f['attributes']:_0x135942[_0x1310('0x34')];if(!_0x33b176['query'][_0x1310('0x56')]('nolimit')){_0x18529f[_0x1310('0x21')]=qs[_0x1310('0x21')](_0x33b176[_0x1310('0x36')]['limit']);_0x18529f[_0x1310('0x20')]=qs[_0x1310('0x20')](_0x33b176[_0x1310('0x36')][_0x1310('0x20')]);}_0x18529f[_0x1310('0x3b')]=qs[_0x1310('0x3c')](_0x33b176['query'][_0x1310('0x3c')]);_0x18529f[_0x1310('0x3d')]=qs['filters'](_[_0x1310('0x3f')](_0x33b176['query'],_0x135942[_0x1310('0x3e')]));_0x18529f[_0x1310('0x3d')][_0x1310('0x57')]=_0x5ee9ec['id'];if(_0x33b176['query'][_0x1310('0x43')]){_0x18529f['where']=_[_0x1310('0x40')](_0x18529f[_0x1310('0x3d')],{'$or':_[_0x1310('0x2f')](_0x18529f['attributes'],function(_0x3bf3b8){var _0x880457={};_0x880457[_0x3bf3b8]={'$like':'%'+_0x33b176[_0x1310('0x36')][_0x1310('0x43')]+'%'};return _0x880457;})});}_0x18529f=_[_0x1310('0x40')]({},_0x18529f,_0x33b176['options']);return db[_0x1310('0x58')][_0x1310('0x59')](_0x18529f);}})['then'](function(_0x502771){if(_0x502771){return db[_0x1310('0x5a')][_0x1310('0x5b')]({'where':{'id':_[_0x1310('0x2f')](_0x502771,_0x1310('0x5c')),'role':_0x1310('0x5d')},'attributes':['id',_0x1310('0x2c'),'whatsappPause','updatedAt',_0x1310('0x5e')]});}})[_0x1310('0x27')](function(_0x45f23e){if(_0x45f23e){return{'count':_0x45f23e[_0x1310('0x22')],'rows':_[_0x1310('0x2f')](_0x45f23e[_0x1310('0x5f')],function(_0x47e836){return{'membername':_0x47e836[_0x1310('0x2c')],'UserId':_0x47e836['id'],'queue_name':_0x2db075[_0x1310('0x2c')],'WhatsappQueueId':_0x2db075['id'],'interface':util[_0x1310('0x60')](_0x1310('0x61'),_0x1310('0x62'),_0x47e836[_0x1310('0x2c')]),'penalty':0x0,'paused':_0x47e836[_0x1310('0x63')],'createdAt':_0x47e836[_0x1310('0x5e')],'updatedAt':_0x47e836[_0x1310('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5034d4,_0x18529f))[_0x1310('0x4a')](handleError(_0x5034d4,null));};exports[_0x1310('0x65')]=function(_0x1d39fc,_0x2ac44d,_0x33871d){var _0x466057={};var _0x2bd300={};var _0x2114fe;var _0x429253;return db[_0x1310('0x30')][_0x1310('0x55')]({'where':{'id':_0x1d39fc['params']['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x2ac44d,null))['then'](function(_0x248c09){if(_0x248c09){_0x2114fe=_0x248c09;_0x2bd300[_0x1310('0x34')]=_['keys'](db['Team']['rawAttributes']);_0x2bd300[_0x1310('0x36')]=_[_0x1310('0x35')](_0x1d39fc['query']);_0x2bd300[_0x1310('0x3e')]=_[_0x1310('0x37')](_0x2bd300[_0x1310('0x34')],_0x2bd300[_0x1310('0x36')]);_0x466057['attributes']=_['intersection'](_0x2bd300['model'],qs[_0x1310('0x38')](_0x1d39fc[_0x1310('0x36')][_0x1310('0x38')]));_0x466057['attributes']=_0x466057['attributes'][_0x1310('0x3a')]?_0x466057[_0x1310('0x39')]:_0x2bd300[_0x1310('0x34')];_0x466057[_0x1310('0x3b')]=qs[_0x1310('0x3c')](_0x1d39fc[_0x1310('0x36')][_0x1310('0x3c')]);_0x466057[_0x1310('0x3d')]=qs[_0x1310('0x3e')](_[_0x1310('0x3f')](_0x1d39fc[_0x1310('0x36')],_0x2bd300[_0x1310('0x3e')]));if(_0x1d39fc[_0x1310('0x36')][_0x1310('0x43')]){_0x466057['where']=_[_0x1310('0x40')](_0x466057[_0x1310('0x3d')],{'$or':_['map'](_0x466057[_0x1310('0x39')],function(_0xe3a566){var _0x567038={};_0x567038[_0xe3a566]={'$like':'%'+_0x1d39fc[_0x1310('0x36')][_0x1310('0x43')]+'%'};return _0x567038;})});}_0x466057=_[_0x1310('0x40')]({},_0x466057,_0x1d39fc[_0x1310('0x48')]);return _0x2114fe[_0x1310('0x65')](_0x466057);}})[_0x1310('0x27')](function(_0x186b27){if(_0x186b27){_0x429253=_0x186b27['length'];if(!_0x1d39fc[_0x1310('0x36')][_0x1310('0x56')](_0x1310('0x66'))){_0x466057[_0x1310('0x21')]=qs['limit'](_0x1d39fc[_0x1310('0x36')][_0x1310('0x21')]);_0x466057[_0x1310('0x20')]=qs[_0x1310('0x20')](_0x1d39fc[_0x1310('0x36')][_0x1310('0x20')]);}return _0x2114fe[_0x1310('0x65')](_0x466057);}})[_0x1310('0x27')](function(_0x1f877c){if(_0x1f877c){return _0x1f877c?{'count':_0x429253,'rows':_0x1f877c}:null;}})[_0x1310('0x27')](respondWithResult(_0x2ac44d,null))[_0x1310('0x4a')](handleError(_0x2ac44d,null));};exports[_0x1310('0x67')]=function(_0x508bed,_0x394d61,_0x1444a8){var _0x4df911=_0x508bed[_0x1310('0x4c')][_0x1310('0x68')];return db['Team']['findAll']({'where':{'id':_0x4df911},'attributes':['id'],'include':[{'model':db[_0x1310('0x5a')],'as':'Agents','attributes':['id',_0x1310('0x2c'),_0x1310('0x69'),_0x1310('0x6a'),'interface'],'raw':!![]}]})[_0x1310('0x27')](function(_0x35b9f6){if(_0x35b9f6){var _0x240837=_[_0x1310('0x6b')](_0x35b9f6,function(_0x1421e7){var _0xe629e9=_0x1421e7[_0x1310('0x29')]({'plain':!![]});return _0xe629e9[_0x1310('0x6c')];});return db['WhatsappQueue'][_0x1310('0x49')]({'where':{'id':_0x508bed[_0x1310('0x45')]['id']}})[_0x1310('0x27')](function(_0x55cb44){return db['sequelize']['transaction'](function(_0x23126f){return _0x55cb44[_0x1310('0x67')](_0x4df911,{'transaction':_0x23126f})[_0x1310('0x27')](function(){return BPromise['each'](_0x240837,function(_0x15a34a){return db[_0x1310('0x58')]['findOrCreate']({'where':{'UserId':_0x15a34a['id'],'WhatsappQueueId':_0x508bed[_0x1310('0x45')]['id']},'transaction':_0x23126f});});})[_0x1310('0x27')](function(){_0x240837[_0x1310('0x6d')](function(_0x1587b3){socket[_0x1310('0x6e')](_0x1310('0x6f'),{'UserId':_0x1587b3['id'],'WhatsappQueueId':_0x55cb44['id']});});});});});}})[_0x1310('0x27')](respondWithStatusCode(_0x394d61,null))[_0x1310('0x4a')](handleError(_0x394d61,null));};exports[_0x1310('0x70')]=function(_0x359e63,_0x58a8d2,_0x3a1b7f){return db[_0x1310('0x71')][_0x1310('0x59')]({'where':{'id':_0x359e63[_0x1310('0x36')][_0x1310('0x68')]},'attributes':['id'],'include':[{'model':db[_0x1310('0x5a')],'as':_0x1310('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58a8d2,null))['then'](function(_0x5d6fd4){var _0x4a2216=_['map'](_0x5d6fd4,'id');var _0x337823=[];var _0x4b62e3=[];var _0x287a86=squel[_0x1310('0x72')]();_0x287a86[_0x1310('0x73')](_0x1310('0x74'))[_0x1310('0x75')](_0x1310('0x76'),'tq')[_0x1310('0x77')]('user_has_teams','ut',_0x1310('0x78'))[_0x1310('0x3d')](_0x1310('0x79'),_0x359e63[_0x1310('0x45')]['id']);for(var _0x375e4f=0x0;_0x375e4f<_0x5d6fd4[_0x1310('0x3a')];_0x375e4f+=0x1){let _0x5e36fb=_0x5d6fd4[_0x375e4f];for(var _0x5f44be=0x0;_0x5f44be<_0x5e36fb[_0x1310('0x6c')][_0x1310('0x3a')];_0x5f44be+=0x1){let _0x35f56c=_0x5e36fb['Agents'][_0x5f44be];var _0x3614e6=_0x287a86[_0x1310('0x7a')]();_0x3614e6[_0x1310('0x3d')]('ut.UserId\x20=\x20?',_0x35f56c['id']);_0x4b62e3[_0x1310('0x7b')](db[_0x1310('0x7c')]['query'](_0x3614e6[_0x1310('0x7d')](),{'type':db[_0x1310('0x7c')]['QueryTypes']['SELECT']})['then'](function(_0x5313bf){if(_0x5313bf[_0x1310('0x3a')]===0x1){return _0x35f56c['id'];}else{var _0x39074e=_[_0x1310('0x7e')](_[_0x1310('0x2f')](_0x5313bf,_0x1310('0x7f')),function(_0x3adee5){return _[_0x1310('0x80')](_0x4a2216,_0x3adee5);});if(_0x39074e){return _0x35f56c['id'];}}}));}}return BPromise['all'](_0x4b62e3)['then'](function(_0x19cd83){_0x337823=_(_0x337823)[_0x1310('0x81')](_0x19cd83)[_0x1310('0x82')]()[_0x1310('0x83')]();return db[_0x1310('0x30')][_0x1310('0x49')]({'where':{'id':_0x359e63['params']['id']}})[_0x1310('0x27')](function(_0x53852e){return db[_0x1310('0x7c')][_0x1310('0x84')](function(_0x24fb38){return _0x53852e[_0x1310('0x70')](_0x359e63[_0x1310('0x36')][_0x1310('0x68')],{'transaction':_0x24fb38})[_0x1310('0x27')](function(){if(!_[_0x1310('0x85')](_0x337823)){return _0x53852e[_0x1310('0x86')](_0x337823,{'transaction':_0x24fb38});}})[_0x1310('0x27')](function(){_0x337823[_0x1310('0x6d')](function(_0x58d8d0){socket['emit'](_0x1310('0x87'),{'UserId':_0x58d8d0,'WhatsappQueueId':_0x53852e['id']});});});});});});})[_0x1310('0x27')](respondWithStatusCode(_0x58a8d2,null))[_0x1310('0x4a')](handleError(_0x58a8d2,null));};exports[_0x1310('0x88')]=function(_0x170324,_0x3e0f41,_0x317550){return db['WhatsappQueue'][_0x1310('0x49')]({'where':{'id':_0x170324[_0x1310('0x45')]['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x3e0f41,null))[_0x1310('0x27')](function(_0x46f129){if(_0x46f129){return _0x46f129[_0x1310('0x88')](_0x170324[_0x1310('0x4c')]['ids'],_[_0x1310('0x89')](_0x170324[_0x1310('0x4c')],[_0x1310('0x68'),'id'])||{})['spread'](function(_0x44fa09){for(var _0x11a683=0x0;_0x11a683<_0x170324[_0x1310('0x4c')][_0x1310('0x68')][_0x1310('0x3a')];_0x11a683+=0x1){socket['emit'](_0x1310('0x6f'),{'UserId':Number(_0x170324[_0x1310('0x4c')][_0x1310('0x68')][_0x11a683]),'WhatsappQueueId':Number(_0x170324[_0x1310('0x45')]['id'])});}return _0x44fa09;});}})[_0x1310('0x27')](respondWithResult(_0x3e0f41,null))['catch'](handleError(_0x3e0f41,null));};exports[_0x1310('0x86')]=function(_0x18f435,_0x12a39e,_0x247cf0){return db[_0x1310('0x30')]['find']({'where':{'id':_0x18f435[_0x1310('0x45')]['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x12a39e,null))[_0x1310('0x27')](function(_0x1a0838){if(_0x1a0838){return _0x1a0838[_0x1310('0x86')](_0x18f435[_0x1310('0x36')]['ids'])['then'](function(){if(_[_0x1310('0x8a')](_0x18f435[_0x1310('0x36')][_0x1310('0x68')])){for(var _0x9f79eb=0x0;_0x9f79eb<_0x18f435[_0x1310('0x36')][_0x1310('0x68')][_0x1310('0x3a')];_0x9f79eb+=0x1){socket['emit'](_0x1310('0x87'),{'UserId':Number(_0x18f435['query']['ids'][_0x9f79eb]),'WhatsappQueueId':Number(_0x18f435[_0x1310('0x45')]['id'])});}}else{socket[_0x1310('0x6e')](_0x1310('0x87'),{'UserId':Number(_0x18f435['query'][_0x1310('0x68')]),'WhatsappQueueId':Number(_0x18f435[_0x1310('0x45')]['id'])});}});}})[_0x1310('0x27')](respondWithStatusCode(_0x12a39e,null))['catch'](handleError(_0x12a39e,null));};exports[_0x1310('0x8b')]=function(_0x98ed8e,_0x4fc38e,_0x8fa91d){var _0x184cd2={};var _0x2c0fa7={};var _0x21dc3e;var _0x2b0963;return db[_0x1310('0x30')][_0x1310('0x55')]({'where':{'id':_0x98ed8e[_0x1310('0x45')]['id']}})[_0x1310('0x27')](handleEntityNotFound(_0x4fc38e,null))[_0x1310('0x27')](function(_0x488e64){if(_0x488e64){_0x21dc3e=_0x488e64;_0x2c0fa7[_0x1310('0x34')]=_[_0x1310('0x35')](db['User'][_0x1310('0x31')]);_0x2c0fa7[_0x1310('0x36')]=_[_0x1310('0x35')](_0x98ed8e[_0x1310('0x36')]);_0x2c0fa7[_0x1310('0x3e')]=_['intersection'](_0x2c0fa7[_0x1310('0x34')],_0x2c0fa7[_0x1310('0x36')]);_0x184cd2['attributes']=_[_0x1310('0x37')](_0x2c0fa7[_0x1310('0x34')],qs[_0x1310('0x38')](_0x98ed8e[_0x1310('0x36')]['fields']));_0x184cd2[_0x1310('0x39')]=_0x184cd2['attributes'][_0x1310('0x3a')]?_0x184cd2[_0x1310('0x39')]:_0x2c0fa7[_0x1310('0x34')];_0x184cd2[_0x1310('0x3b')]=qs['sort'](_0x98ed8e[_0x1310('0x36')][_0x1310('0x3c')]);_0x184cd2[_0x1310('0x3d')]=qs[_0x1310('0x3e')](_[_0x1310('0x3f')](_0x98ed8e[_0x1310('0x36')],_0x2c0fa7['filters']));if(_0x98ed8e[_0x1310('0x36')][_0x1310('0x43')]){_0x184cd2[_0x1310('0x3d')]=_[_0x1310('0x40')](_0x184cd2[_0x1310('0x3d')],{'$or':_[_0x1310('0x2f')](_0x184cd2[_0x1310('0x39')],function(_0x80354){var _0xd33344={};_0xd33344[_0x80354]={'$like':'%'+_0x98ed8e[_0x1310('0x36')][_0x1310('0x43')]+'%'};return _0xd33344;})});}_0x184cd2=_['merge']({},_0x184cd2,_0x98ed8e[_0x1310('0x48')]);return _0x21dc3e[_0x1310('0x8b')](_0x184cd2);}})[_0x1310('0x27')](function(_0x2fdbf0){if(_0x2fdbf0){_0x2b0963=_0x2fdbf0[_0x1310('0x3a')];if(!_0x98ed8e[_0x1310('0x36')]['hasOwnProperty']('nolimit')){_0x184cd2['limit']=qs['limit'](_0x98ed8e[_0x1310('0x36')][_0x1310('0x21')]);_0x184cd2['offset']=qs[_0x1310('0x20')](_0x98ed8e[_0x1310('0x36')]['offset']);}return _0x21dc3e[_0x1310('0x8b')](_0x184cd2);}})[_0x1310('0x27')](function(_0x43ad4e){if(_0x43ad4e){return _0x43ad4e?{'count':_0x2b0963,'rows':_0x43ad4e}:null;}})[_0x1310('0x27')](respondWithResult(_0x4fc38e,null))[_0x1310('0x4a')](handleError(_0x4fc38e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index deb9bc8..479cd54 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 _0x4ba1=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ba1,0x88));var _0x14ba=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4ba1[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x14ba('0x0'));var WhatsappQueue=require(_0x14ba('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x14ba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x14ba('0x3'),'afterDestroy':_0x14ba('0x4')};function emitEvent(_0x44f025){return function(_0x13bd20,_0x275a45,_0x1be780){WhatsappQueueEvents[_0x14ba('0x5')](_0x44f025+':'+_0x13bd20['id'],_0x13bd20);WhatsappQueueEvents[_0x14ba('0x5')](_0x44f025,_0x13bd20);_0x1be780(null);};}for(var e in events){if(events[_0x14ba('0x6')](e)){var event=events[e];WhatsappQueue[_0x14ba('0x7')](e,emitEvent(event));}}module[_0x14ba('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xc4db=['remove','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x8957d7,_0x236b11){var _0x3c256a=function(_0x199c2e){while(--_0x199c2e){_0x8957d7['push'](_0x8957d7['shift']());}};_0x3c256a(++_0x236b11);}(_0xc4db,0x1da));var _0xbc4d=function(_0x45c0f7,_0x3b1c07){_0x45c0f7=_0x45c0f7-0x0;var _0x56cb13=_0xc4db[_0x45c0f7];return _0x56cb13;};'use strict';var EventEmitter=require(_0xbc4d('0x0'));var WhatsappQueue=require(_0xbc4d('0x1'))['db'][_0xbc4d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbc4d('0x3')](0x0);var events={'afterCreate':_0xbc4d('0x4'),'afterUpdate':_0xbc4d('0x5'),'afterDestroy':_0xbc4d('0x6')};function emitEvent(_0x5db550){return function(_0x35465c,_0x7d7d38,_0x1edc0f){WhatsappQueueEvents[_0xbc4d('0x7')](_0x5db550+':'+_0x35465c['id'],_0x35465c);WhatsappQueueEvents[_0xbc4d('0x7')](_0x5db550,_0x35465c);_0x1edc0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xbc4d('0x8')](e,emitEvent(event));}}module[_0xbc4d('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e1de275..7446b5b 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 _0x75b7=['api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','define','util','../../config/logger'];(function(_0xed37b6,_0x4f0a93){var _0x2d41c3=function(_0x23554f){while(--_0x23554f){_0xed37b6['push'](_0xed37b6['shift']());}};_0x2d41c3(++_0x4f0a93);}(_0x75b7,0x97));var _0x775b=function(_0x608461,_0x276844){_0x608461=_0x608461-0x0;var _0x3ad81b=_0x75b7[_0x608461];return _0x3ad81b;};'use strict';var _=require('lodash');var util=require(_0x775b('0x0'));var logger=require(_0x775b('0x1'))(_0x775b('0x2'));var moment=require('moment');var BPromise=require(_0x775b('0x3'));var rp=require(_0x775b('0x4'));var fs=require('fs');var path=require(_0x775b('0x5'));var rimraf=require(_0x775b('0x6'));var config=require('../../config/environment');var attributes=require(_0x775b('0x7'));module['exports']=function(_0xdaa6c1,_0x58643b){return _0xdaa6c1[_0x775b('0x8')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd10=['../../config/logger','api','request-promise','rimraf','exports','define','WhatsappQueue','lodash','util'];(function(_0x533efc,_0xfd5f95){var _0x5749e0=function(_0x2f02d1){while(--_0x2f02d1){_0x533efc['push'](_0x533efc['shift']());}};_0x5749e0(++_0xfd5f95);}(_0xcd10,0x7c));var _0x0cd1=function(_0x135e8a,_0x12b286){_0x135e8a=_0x135e8a-0x0;var _0x3c6fd1=_0xcd10[_0x135e8a];return _0x3c6fd1;};'use strict';var _=require(_0x0cd1('0x0'));var util=require(_0x0cd1('0x1'));var logger=require(_0x0cd1('0x2'))(_0x0cd1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cd1('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x0cd1('0x6')]=function(_0x208048,_0x5473da){return _0x208048[_0x0cd1('0x7')](_0x0cd1('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 558f971..e6adc1c 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 _0xa600=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info'];(function(_0x338cf6,_0x5ac07d){var _0x2fb9dd=function(_0x24b75e){while(--_0x24b75e){_0x338cf6['push'](_0x338cf6['shift']());}};_0x2fb9dd(++_0x5ac07d);}(_0xa600,0x17d));var _0x0a60=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xa600[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a60('0x0'));var BPromise=require(_0x0a60('0x1'));var rs=require(_0x0a60('0x2'));var fs=require('fs');var Redis=require(_0x0a60('0x3'));var db=require(_0x0a60('0x4'))['db'];var utils=require(_0x0a60('0x5'));var logger=require(_0x0a60('0x6'))(_0x0a60('0x7'));var config=require('../../config/environment');var jayson=require(_0x0a60('0x8'));var client=jayson[_0x0a60('0x9')][_0x0a60('0xa')]({'port':0x232a});config[_0x0a60('0xb')]=_['defaults'](config[_0x0a60('0xb')],{'host':_0x0a60('0xc'),'port':0x18eb});var socket=require(_0x0a60('0xd'))(new Redis(config[_0x0a60('0xb')]));require(_0x0a60('0xe'))[_0x0a60('0xf')](socket);function respondWithRpcPromise(_0x367ab6,_0x72afe2,_0x367d84){return new BPromise(function(_0x15b2fa,_0x2c899b){return client[_0x0a60('0x10')](_0x367ab6,_0x367d84)[_0x0a60('0x11')](function(_0x1922ab){logger[_0x0a60('0x12')](_0x0a60('0x13'),_0x72afe2,_0x0a60('0x14'));logger[_0x0a60('0x15')](_0x0a60('0x16'),_0x72afe2,_0x0a60('0x14'),JSON['stringify'](_0x1922ab));if(_0x1922ab[_0x0a60('0x17')]){if(_0x1922ab['error'][_0x0a60('0x18')]===0x1f4){logger[_0x0a60('0x17')](_0x0a60('0x13'),_0x72afe2,_0x1922ab[_0x0a60('0x17')][_0x0a60('0x19')]);return _0x2c899b(_0x1922ab[_0x0a60('0x17')][_0x0a60('0x19')]);}logger[_0x0a60('0x17')](_0x0a60('0x13'),_0x72afe2,_0x1922ab[_0x0a60('0x17')][_0x0a60('0x19')]);return _0x15b2fa(_0x1922ab[_0x0a60('0x17')][_0x0a60('0x19')]);}else{logger[_0x0a60('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x72afe2,_0x0a60('0x14'));_0x15b2fa(_0x1922ab['result']['message']);}})[_0x0a60('0x1a')](function(_0x3ecdc0){logger[_0x0a60('0x17')](_0x0a60('0x13'),_0x72afe2,_0x3ecdc0);_0x2c899b(_0x3ecdc0);});});}exports['GetWhatsappQueue']=function(_0x22925d){var _0x23aab5=this;return new Promise(function(_0x38776a,_0x1c6116){return db[_0x0a60('0x1b')][_0x0a60('0x1c')]({'raw':_0x22925d[_0x0a60('0x1d')]?_0x22925d[_0x0a60('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22925d[_0x0a60('0x1d')]?_0x22925d[_0x0a60('0x1d')][_0x0a60('0x1e')]||null:null,'attributes':_0x22925d[_0x0a60('0x1d')]?_0x22925d[_0x0a60('0x1d')][_0x0a60('0x1f')]||null:null,'limit':_0x22925d[_0x0a60('0x1d')]?_0x22925d[_0x0a60('0x1d')][_0x0a60('0x20')]||null:null,'include':_0x22925d[_0x0a60('0x1d')]?_0x22925d[_0x0a60('0x1d')][_0x0a60('0x21')]?_[_0x0a60('0x22')](_0x22925d[_0x0a60('0x1d')][_0x0a60('0x21')],function(_0x20c707){return{'model':db[_0x20c707[_0x0a60('0x23')]],'as':_0x20c707['as'],'attributes':_0x20c707[_0x0a60('0x1f')],'include':_0x20c707[_0x0a60('0x21')]?_[_0x0a60('0x22')](_0x20c707[_0x0a60('0x21')],function(_0x574e95){return{'model':db[_0x574e95[_0x0a60('0x23')]],'as':_0x574e95['as'],'attributes':_0x574e95[_0x0a60('0x1f')],'include':_0x574e95[_0x0a60('0x21')]?_[_0x0a60('0x22')](_0x574e95[_0x0a60('0x21')],function(_0x3ab9e1){return{'model':db[_0x3ab9e1[_0x0a60('0x23')]],'as':_0x3ab9e1['as'],'attributes':_0x3ab9e1[_0x0a60('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a60('0x11')](function(_0x30e5c0){logger[_0x0a60('0x12')]('GetWhatsappQueue',_0x22925d);logger[_0x0a60('0x15')](_0x0a60('0x24'),_0x22925d,JSON[_0x0a60('0x25')](_0x30e5c0));_0x38776a(_0x30e5c0);})[_0x0a60('0x1a')](function(_0x196d2d){logger['error']('GetWhatsappQueue',_0x196d2d[_0x0a60('0x19')],_0x22925d);_0x1c6116(_0x23aab5[_0x0a60('0x17')](0x1f4,_0x196d2d[_0x0a60('0x19')]));});});};exports[_0x0a60('0x26')]=function(_0x19c90a){var _0x2bf79d=this;return new Promise(function(_0x5859ff,_0x262272){return db[_0x0a60('0x1b')]['find']({'raw':_0x19c90a[_0x0a60('0x1d')]?_0x19c90a[_0x0a60('0x1d')][_0x0a60('0x27')]===undefined?!![]:![]:!![],'where':_0x19c90a[_0x0a60('0x1d')]?_0x19c90a['options'][_0x0a60('0x1e')]||null:null,'attributes':_0x19c90a['options']?_0x19c90a[_0x0a60('0x1d')][_0x0a60('0x1f')]||null:null,'include':_0x19c90a[_0x0a60('0x1d')]?_0x19c90a['options'][_0x0a60('0x21')]?_[_0x0a60('0x22')](_0x19c90a[_0x0a60('0x1d')]['include'],function(_0x5a6e52){return{'model':db[_0x5a6e52['model']],'as':_0x5a6e52['as'],'attributes':_0x5a6e52[_0x0a60('0x1f')],'include':_0x5a6e52['include']?_[_0x0a60('0x22')](_0x5a6e52['include'],function(_0xafdd54){return{'model':db[_0xafdd54[_0x0a60('0x23')]],'as':_0xafdd54['as'],'attributes':_0xafdd54[_0x0a60('0x1f')],'include':_0xafdd54['include']?_['map'](_0xafdd54[_0x0a60('0x21')],function(_0x23b397){return{'model':db[_0x23b397[_0x0a60('0x23')]],'as':_0x23b397['as'],'attributes':_0x23b397[_0x0a60('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a60('0x11')](function(_0x1db6f8){logger[_0x0a60('0x12')](_0x0a60('0x26'),_0x19c90a);logger[_0x0a60('0x15')]('ShowWhatsappQueue',_0x19c90a,JSON[_0x0a60('0x25')](_0x1db6f8));_0x5859ff(_0x1db6f8);})[_0x0a60('0x1a')](function(_0x5814ae){logger[_0x0a60('0x17')](_0x0a60('0x26'),_0x5814ae[_0x0a60('0x19')],_0x19c90a);_0x262272(_0x2bf79d[_0x0a60('0x17')](0x1f4,_0x5814ae[_0x0a60('0x19')]));});});}; \ No newline at end of file +var _0x7386=['request\x20sent','debug','stringify','error','code','message','result','WhatsappQueue','findAll','options','where','attributes','limit','model','map','include','GetWhatsappQueue','ShowWhatsappQueue','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x7386,0x1b8));var _0x6738=function(_0x463524,_0x2a7845){_0x463524=_0x463524-0x0;var _0x61b881=_0x7386[_0x463524];return _0x61b881;};'use strict';var _=require(_0x6738('0x0'));var util=require(_0x6738('0x1'));var moment=require('moment');var BPromise=require(_0x6738('0x2'));var rs=require(_0x6738('0x3'));var fs=require('fs');var Redis=require(_0x6738('0x4'));var db=require(_0x6738('0x5'))['db'];var utils=require(_0x6738('0x6'));var logger=require(_0x6738('0x7'))(_0x6738('0x8'));var config=require(_0x6738('0x9'));var jayson=require(_0x6738('0xa'));var client=jayson[_0x6738('0xb')][_0x6738('0xc')]({'port':0x232a});config[_0x6738('0xd')]=_[_0x6738('0xe')](config['redis'],{'host':_0x6738('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6738('0xd')]));require(_0x6738('0x10'))[_0x6738('0x11')](socket);function respondWithRpcPromise(_0x2f1168,_0x333c8d,_0x27c485){return new BPromise(function(_0x255012,_0x220135){return client[_0x6738('0x12')](_0x2f1168,_0x27c485)[_0x6738('0x13')](function(_0x131217){logger[_0x6738('0x14')](_0x6738('0x15'),_0x333c8d,_0x6738('0x16'));logger[_0x6738('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x333c8d,_0x6738('0x16'),JSON[_0x6738('0x18')](_0x131217));if(_0x131217[_0x6738('0x19')]){if(_0x131217['error'][_0x6738('0x1a')]===0x1f4){logger[_0x6738('0x19')](_0x6738('0x15'),_0x333c8d,_0x131217[_0x6738('0x19')][_0x6738('0x1b')]);return _0x220135(_0x131217[_0x6738('0x19')]['message']);}logger[_0x6738('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x333c8d,_0x131217[_0x6738('0x19')][_0x6738('0x1b')]);return _0x255012(_0x131217[_0x6738('0x19')][_0x6738('0x1b')]);}else{logger['info'](_0x6738('0x15'),_0x333c8d,_0x6738('0x16'));_0x255012(_0x131217[_0x6738('0x1c')]['message']);}})['catch'](function(_0x57342f){logger[_0x6738('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x333c8d,_0x57342f);_0x220135(_0x57342f);});});}exports['GetWhatsappQueue']=function(_0x438ab5){var _0x13d231=this;return new Promise(function(_0x3ea5d6,_0xaeff4d){return db[_0x6738('0x1d')][_0x6738('0x1e')]({'raw':_0x438ab5[_0x6738('0x1f')]?_0x438ab5['options']['raw']===undefined?!![]:![]:!![],'where':_0x438ab5[_0x6738('0x1f')]?_0x438ab5['options'][_0x6738('0x20')]||null:null,'attributes':_0x438ab5[_0x6738('0x1f')]?_0x438ab5['options'][_0x6738('0x21')]||null:null,'limit':_0x438ab5['options']?_0x438ab5[_0x6738('0x1f')][_0x6738('0x22')]||null:null,'include':_0x438ab5[_0x6738('0x1f')]?_0x438ab5[_0x6738('0x1f')]['include']?_['map'](_0x438ab5[_0x6738('0x1f')]['include'],function(_0xe3109a){return{'model':db[_0xe3109a[_0x6738('0x23')]],'as':_0xe3109a['as'],'attributes':_0xe3109a[_0x6738('0x21')],'include':_0xe3109a['include']?_[_0x6738('0x24')](_0xe3109a[_0x6738('0x25')],function(_0x5d6e29){return{'model':db[_0x5d6e29[_0x6738('0x23')]],'as':_0x5d6e29['as'],'attributes':_0x5d6e29['attributes'],'include':_0x5d6e29[_0x6738('0x25')]?_[_0x6738('0x24')](_0x5d6e29['include'],function(_0x578543){return{'model':db[_0x578543[_0x6738('0x23')]],'as':_0x578543['as'],'attributes':_0x578543['attributes']};}):[]};}):[]};}):[]:[]})[_0x6738('0x13')](function(_0x51a4ce){logger['info'](_0x6738('0x26'),_0x438ab5);logger[_0x6738('0x17')]('GetWhatsappQueue',_0x438ab5,JSON['stringify'](_0x51a4ce));_0x3ea5d6(_0x51a4ce);})['catch'](function(_0x55aa95){logger[_0x6738('0x19')](_0x6738('0x26'),_0x55aa95['message'],_0x438ab5);_0xaeff4d(_0x13d231[_0x6738('0x19')](0x1f4,_0x55aa95[_0x6738('0x1b')]));});});};exports[_0x6738('0x27')]=function(_0x37593e){var _0x549ed5=this;return new Promise(function(_0xdc14eb,_0x531890){return db[_0x6738('0x1d')]['find']({'raw':_0x37593e['options']?_0x37593e['options'][_0x6738('0x28')]===undefined?!![]:![]:!![],'where':_0x37593e[_0x6738('0x1f')]?_0x37593e['options'][_0x6738('0x20')]||null:null,'attributes':_0x37593e[_0x6738('0x1f')]?_0x37593e['options'][_0x6738('0x21')]||null:null,'include':_0x37593e[_0x6738('0x1f')]?_0x37593e[_0x6738('0x1f')][_0x6738('0x25')]?_[_0x6738('0x24')](_0x37593e[_0x6738('0x1f')][_0x6738('0x25')],function(_0x2ea445){return{'model':db[_0x2ea445[_0x6738('0x23')]],'as':_0x2ea445['as'],'attributes':_0x2ea445[_0x6738('0x21')],'include':_0x2ea445[_0x6738('0x25')]?_[_0x6738('0x24')](_0x2ea445[_0x6738('0x25')],function(_0x1a9de0){return{'model':db[_0x1a9de0[_0x6738('0x23')]],'as':_0x1a9de0['as'],'attributes':_0x1a9de0[_0x6738('0x21')],'include':_0x1a9de0[_0x6738('0x25')]?_[_0x6738('0x24')](_0x1a9de0[_0x6738('0x25')],function(_0xb23df3){return{'model':db[_0xb23df3[_0x6738('0x23')]],'as':_0xb23df3['as'],'attributes':_0xb23df3[_0x6738('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5249a4){logger[_0x6738('0x14')](_0x6738('0x27'),_0x37593e);logger[_0x6738('0x17')](_0x6738('0x27'),_0x37593e,JSON['stringify'](_0x5249a4));_0xdc14eb(_0x5249a4);})[_0x6738('0x29')](function(_0x5a039d){logger[_0x6738('0x19')]('ShowWhatsappQueue',_0x5a039d['message'],_0x37593e);_0x531890(_0x549ed5[_0x6738('0x19')](0x1f4,_0x5a039d[_0x6738('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 32f1358..e5df0e9 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 _0x7cef=['register','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x7cef,0x105));var _0xf7ce=function(_0x3c8fa6,_0xc92329){_0x3c8fa6=_0x3c8fa6-0x0;var _0x106d5d=_0x7cef[_0x3c8fa6];return _0x106d5d;};'use strict';var WhatsappQueueEvents=require(_0xf7ce('0x0'));var events=[_0xf7ce('0x1'),_0xf7ce('0x2'),_0xf7ce('0x3')];function createListener(_0x219f8f,_0x8ce700){return function(_0x35d23a){_0x8ce700['emit'](_0x219f8f,_0x35d23a);};}function removeListener(_0x143d67,_0x4d2360){return function(){WhatsappQueueEvents[_0xf7ce('0x4')](_0x143d67,_0x4d2360);};}exports[_0xf7ce('0x5')]=function(_0x2caae7){for(var _0x2af493=0x0,_0x45e566=events['length'];_0x2af493<_0x45e566;_0x2af493++){var _0x3ac5bc=events[_0x2af493];var _0x76c77d=createListener(_0xf7ce('0x6')+_0x3ac5bc,_0x2caae7);WhatsappQueueEvents['on'](_0x3ac5bc,_0x76c77d);}}; \ No newline at end of file +var _0x3be7=['length','whatsappQueue:','./whatsappQueue.events','remove','register'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x3be7,0x98));var _0x73be=function(_0x4c6b97,_0x5a279d){_0x4c6b97=_0x4c6b97-0x0;var _0x15472f=_0x3be7[_0x4c6b97];return _0x15472f;};'use strict';var WhatsappQueueEvents=require(_0x73be('0x0'));var events=['save',_0x73be('0x1'),'update'];function createListener(_0x4112b2,_0x30b116){return function(_0xeb782c){_0x30b116['emit'](_0x4112b2,_0xeb782c);};}function removeListener(_0x481d68,_0x3976bb){return function(){WhatsappQueueEvents['removeListener'](_0x481d68,_0x3976bb);};}exports[_0x73be('0x2')]=function(_0x2f1578){for(var _0x54bffd=0x0,_0x520e95=events[_0x73be('0x3')];_0x54bffd<_0x520e95;_0x54bffd++){var _0x58a402=events[_0x54bffd];var _0x5332ae=createListener(_0x73be('0x4')+_0x58a402,_0x2f1578);WhatsappQueueEvents['on'](_0x58a402,_0x5332ae);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ea2a371..4e5ca82 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 _0xf6a4=['util','path','connect-timeout','express','fs-extra','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','destroy','exports'];(function(_0xf643ae,_0x192c46){var _0xfe7e80=function(_0x1d9055){while(--_0x1d9055){_0xf643ae['push'](_0xf643ae['shift']());}};_0xfe7e80(++_0x192c46);}(_0xf6a4,0xb4));var _0x4f6a=function(_0x374ac8,_0x12b9f8){_0x374ac8=_0x374ac8-0x0;var _0xae1c01=_0xf6a4[_0x374ac8];return _0xae1c01;};'use strict';var multer=require('multer');var util=require(_0x4f6a('0x0'));var path=require(_0x4f6a('0x1'));var timeout=require(_0x4f6a('0x2'));var express=require(_0x4f6a('0x3'));var router=express['Router']();var fs_extra=require(_0x4f6a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f6a('0x5'));var controller=require(_0x4f6a('0x6'));router[_0x4f6a('0x7')]('/',auth[_0x4f6a('0x8')](),controller[_0x4f6a('0x9')]);router[_0x4f6a('0x7')](_0x4f6a('0xa'),auth[_0x4f6a('0x8')](),controller['describe']);router['get'](_0x4f6a('0xb'),auth[_0x4f6a('0x8')](),controller[_0x4f6a('0xc')]);router[_0x4f6a('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f6a('0xe')]);router['put'](_0x4f6a('0xb'),auth['isAuthenticated'](),controller[_0x4f6a('0xf')]);router['delete'](_0x4f6a('0xb'),auth[_0x4f6a('0x8')](),controller[_0x4f6a('0x10')]);module[_0x4f6a('0x11')]=router; \ No newline at end of file +var _0x37ae=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2044bc,_0x1c301f){var _0x529839=function(_0x1d922f){while(--_0x1d922f){_0x2044bc['push'](_0x2044bc['shift']());}};_0x529839(++_0x1c301f);}(_0x37ae,0xcd));var _0xe37a=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x37ae[_0x255ac0];return _0x437bf1;};'use strict';var multer=require(_0xe37a('0x0'));var util=require(_0xe37a('0x1'));var path=require(_0xe37a('0x2'));var timeout=require(_0xe37a('0x3'));var express=require(_0xe37a('0x4'));var router=express[_0xe37a('0x5')]();var fs_extra=require(_0xe37a('0x6'));var auth=require(_0xe37a('0x7'));var interaction=require(_0xe37a('0x8'));var config=require(_0xe37a('0x9'));var controller=require(_0xe37a('0xa'));router[_0xe37a('0xb')]('/',auth[_0xe37a('0xc')](),controller['index']);router[_0xe37a('0xb')](_0xe37a('0xd'),auth[_0xe37a('0xc')](),controller[_0xe37a('0xe')]);router[_0xe37a('0xb')](_0xe37a('0xf'),auth['isAuthenticated'](),controller[_0xe37a('0x10')]);router['post']('/',auth[_0xe37a('0xc')](),controller[_0xe37a('0x11')]);router[_0xe37a('0x12')](_0xe37a('0xf'),auth['isAuthenticated'](),controller[_0xe37a('0x13')]);router[_0xe37a('0x14')](_0xe37a('0xf'),auth[_0xe37a('0xc')](),controller[_0xe37a('0x15')]);module[_0xe37a('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index dff52cb..cab8868 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x47070a,_0x4507c9){var _0x1416e9=function(_0x29a853){while(--_0x29a853){_0x47070a['push'](_0x47070a['shift']());}};_0x1416e9(++_0x4507c9);}(_0x7a54,0x106));var _0x47a5=function(_0x5ad40a,_0x53a49f){_0x5ad40a=_0x5ad40a-0x0;var _0x28c987=_0x7a54[_0x5ad40a];return _0x28c987;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x15cf6e,_0x474ab0){var _0x57e495=function(_0x526848){while(--_0x526848){_0x15cf6e['push'](_0x15cf6e['shift']());}};_0x57e495(++_0x474ab0);}(_0x7a54,0x106));var _0x47a5=function(_0x15e93e,_0x3db000){_0x15e93e=_0x15e93e-0x0;var _0xe256d5=_0x7a54[_0x15e93e];return _0xe256d5;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 76e2221..d4ecbb9 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 _0xc900=['filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query'];(function(_0x453d05,_0x60e2e9){var _0x2d8018=function(_0x20f7c7){while(--_0x20f7c7){_0x453d05['push'](_0x453d05['shift']());}};_0x2d8018(++_0x60e2e9);}(_0xc900,0xb3));var _0x0c90=function(_0x583ce9,_0x129760){_0x583ce9=_0x583ce9-0x0;var _0x11543a=_0xc900[_0x583ce9];return _0x11543a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){_0x212164['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d005,_0x3ea861){return function(_0x35c243){if(!_0x35c243){_0x28d005[_0x0c90('0x19')](0x194);}return _0x35c243;};}function handleError(_0x4dde67,_0x2dfa14){_0x2dfa14=_0x2dfa14||0x1f4;return function(_0x438652){logger[_0x0c90('0x27')](_0x438652[_0x0c90('0x28')]);if(_0x438652[_0x0c90('0x29')]){delete _0x438652[_0x0c90('0x29')];}_0x4dde67['status'](_0x2dfa14)[_0x0c90('0x2a')](_0x438652);};}exports[_0x0c90('0x2b')]=function(_0x39f1b2,_0x13b377){var _0x52d28d={},_0x4c8603={},_0x1f27f1={'count':0x0,'rows':[]};var _0x25da6e=_[_0x0c90('0x2c')](db[_0x0c90('0x2d')][_0x0c90('0x2e')],function(_0x562664){return{'name':_0x562664[_0x0c90('0x2f')],'type':_0x562664[_0x0c90('0x30')][_0x0c90('0x31')]};});_0x4c8603['model']=_[_0x0c90('0x2c')](_0x25da6e,'name');_0x4c8603['query']=_[_0x0c90('0x32')](_0x39f1b2[_0x0c90('0x33')]);_0x4c8603[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x4c8603['model'],_0x4c8603[_0x0c90('0x33')]);_0x52d28d['attributes']=_[_0x0c90('0x35')](_0x4c8603['model'],qs[_0x0c90('0x36')](_0x39f1b2[_0x0c90('0x33')]['fields']));_0x52d28d[_0x0c90('0x37')]=_0x52d28d[_0x0c90('0x37')][_0x0c90('0x38')]?_0x52d28d[_0x0c90('0x37')]:_0x4c8603[_0x0c90('0x39')];if(!_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3a')](_0x0c90('0x3b'))){_0x52d28d['limit']=qs[_0x0c90('0x1f')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1f')]);_0x52d28d[_0x0c90('0x1d')]=qs['offset'](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1d')]);}_0x52d28d[_0x0c90('0x3c')]=qs[_0x0c90('0x3d')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3d')]);_0x52d28d[_0x0c90('0x3e')]=qs[_0x0c90('0x34')](_['pick'](_0x39f1b2[_0x0c90('0x33')],_0x4c8603[_0x0c90('0x34')]),_0x25da6e);if(_0x39f1b2['query'][_0x0c90('0x3f')]){_0x52d28d[_0x0c90('0x3e')]=_[_0x0c90('0x40')](_0x52d28d[_0x0c90('0x3e')],{'$or':_[_0x0c90('0x2c')](_0x25da6e,function(_0x50c126){if(_0x50c126[_0x0c90('0x30')]!==_0x0c90('0x41')){var _0x11530f={};_0x11530f[_0x50c126[_0x0c90('0x29')]]={'$like':'%'+_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3f')]+'%'};return _0x11530f;}})});}_0x52d28d=_[_0x0c90('0x40')]({},_0x52d28d,_0x39f1b2[_0x0c90('0x42')]);var _0x11a8e3={'where':_0x52d28d['where']};return db[_0x0c90('0x2d')]['count'](_0x11a8e3)[_0x0c90('0x25')](function(_0x593cc0){_0x1f27f1[_0x0c90('0x20')]=_0x593cc0;if(_0x39f1b2[_0x0c90('0x33')]['includeAll']){_0x52d28d['include']=[{'all':!![]}];}return db[_0x0c90('0x2d')]['findAll'](_0x52d28d);})[_0x0c90('0x25')](function(_0x4545bb){_0x1f27f1[_0x0c90('0x43')]=_0x4545bb;return _0x1f27f1;})['then'](respondWithFilteredResult(_0x13b377,_0x52d28d))[_0x0c90('0x44')](handleError(_0x13b377,null));};exports[_0x0c90('0x45')]=function(_0x123b58,_0x3e5137){var _0x2139c3={'raw':!![],'where':{'id':_0x123b58['params']['id']}},_0x1184c4={};_0x1184c4[_0x0c90('0x39')]=_[_0x0c90('0x32')](db[_0x0c90('0x2d')][_0x0c90('0x2e')]);_0x1184c4[_0x0c90('0x33')]=_[_0x0c90('0x32')](_0x123b58[_0x0c90('0x33')]);_0x1184c4['filters']=_[_0x0c90('0x35')](_0x1184c4['model'],_0x1184c4[_0x0c90('0x33')]);_0x2139c3[_0x0c90('0x37')]=_[_0x0c90('0x35')](_0x1184c4[_0x0c90('0x39')],qs[_0x0c90('0x36')](_0x123b58[_0x0c90('0x33')][_0x0c90('0x36')]));_0x2139c3[_0x0c90('0x37')]=_0x2139c3[_0x0c90('0x37')][_0x0c90('0x38')]?_0x2139c3[_0x0c90('0x37')]:_0x1184c4[_0x0c90('0x39')];if(_0x123b58[_0x0c90('0x33')][_0x0c90('0x46')]){_0x2139c3[_0x0c90('0x47')]=[{'all':!![]}];}_0x2139c3=_['merge']({},_0x2139c3,_0x123b58[_0x0c90('0x42')]);return db[_0x0c90('0x2d')][_0x0c90('0x48')](_0x2139c3)[_0x0c90('0x25')](handleEntityNotFound(_0x3e5137,null))[_0x0c90('0x25')](respondWithResult(_0x3e5137,null))[_0x0c90('0x44')](handleError(_0x3e5137,null));};exports[_0x0c90('0x49')]=function(_0x302dc6,_0x3bb138){return db[_0x0c90('0x2d')][_0x0c90('0x49')](_0x302dc6[_0x0c90('0x4a')],{})[_0x0c90('0x25')](respondWithResult(_0x3bb138,0xc9))[_0x0c90('0x44')](handleError(_0x3bb138,null));};exports['update']=function(_0x1b4aac,_0x38f492){if(_0x1b4aac['body']['id']){delete _0x1b4aac['body']['id'];}return db['WhatsappQueueReport'][_0x0c90('0x48')]({'where':{'id':_0x1b4aac[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x38f492,null))[_0x0c90('0x25')](saveUpdates(_0x1b4aac[_0x0c90('0x4a')],null))['then'](respondWithResult(_0x38f492,null))[_0x0c90('0x44')](handleError(_0x38f492,null));};exports[_0x0c90('0x26')]=function(_0x2b756d,_0x549c78){return db[_0x0c90('0x2d')][_0x0c90('0x48')]({'where':{'id':_0x2b756d[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x549c78,null))[_0x0c90('0x25')](removeEntity(_0x549c78,null))[_0x0c90('0x44')](handleError(_0x549c78,null));};exports[_0x0c90('0x4c')]=function(_0x2a339d,_0x1daeed){return db[_0x0c90('0x2d')]['describe']()[_0x0c90('0x25')](respondWithResult(_0x1daeed,null))['catch'](handleError(_0x1daeed,null));}; \ No newline at end of file +var _0x4cf8=['limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','merge','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x3340c8,_0x3d67d7){var _0x30ca8a=function(_0x435fff){while(--_0x435fff){_0x3340c8['push'](_0x3340c8['shift']());}};_0x30ca8a(++_0x3d67d7);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x4cf8[_0x4e0eb6];return _0x46e432;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){_0x29e9e1[_0x84cf('0x19')](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x1d220a,_0x44d4bf){return function(_0x3c7eda){if(!_0x3c7eda){_0x1d220a[_0x84cf('0x18')](0x194);}return _0x3c7eda;};}function handleError(_0x401aa4,_0x6797c0){_0x6797c0=_0x6797c0||0x1f4;return function(_0x5179c1){logger[_0x84cf('0x27')](_0x5179c1[_0x84cf('0x28')]);if(_0x5179c1[_0x84cf('0x29')]){delete _0x5179c1[_0x84cf('0x29')];}_0x401aa4['status'](_0x6797c0)[_0x84cf('0x2a')](_0x5179c1);};}exports['index']=function(_0x29455e,_0x4092fd){var _0x43b41b={},_0xc15298={},_0x51adcf={'count':0x0,'rows':[]};var _0x20de4b=_[_0x84cf('0x2b')](db[_0x84cf('0x2c')][_0x84cf('0x2d')],function(_0xb4fc5a){return{'name':_0xb4fc5a[_0x84cf('0x2e')],'type':_0xb4fc5a[_0x84cf('0x2f')][_0x84cf('0x30')]};});_0xc15298[_0x84cf('0x31')]=_['map'](_0x20de4b,'name');_0xc15298[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x29455e[_0x84cf('0x32')]);_0xc15298[_0x84cf('0x34')]=_[_0x84cf('0x35')](_0xc15298[_0x84cf('0x31')],_0xc15298[_0x84cf('0x32')]);_0x43b41b[_0x84cf('0x36')]=_['intersection'](_0xc15298[_0x84cf('0x31')],qs[_0x84cf('0x37')](_0x29455e['query'][_0x84cf('0x37')]));_0x43b41b['attributes']=_0x43b41b[_0x84cf('0x36')][_0x84cf('0x38')]?_0x43b41b[_0x84cf('0x36')]:_0xc15298[_0x84cf('0x31')];if(!_0x29455e[_0x84cf('0x32')]['hasOwnProperty'](_0x84cf('0x39'))){_0x43b41b['limit']=qs['limit'](_0x29455e[_0x84cf('0x32')][_0x84cf('0x3a')]);_0x43b41b['offset']=qs[_0x84cf('0x1c')](_0x29455e[_0x84cf('0x32')][_0x84cf('0x1c')]);}_0x43b41b[_0x84cf('0x3b')]=qs[_0x84cf('0x3c')](_0x29455e[_0x84cf('0x32')]['sort']);_0x43b41b[_0x84cf('0x3d')]=qs[_0x84cf('0x34')](_[_0x84cf('0x3e')](_0x29455e[_0x84cf('0x32')],_0xc15298[_0x84cf('0x34')]),_0x20de4b);if(_0x29455e[_0x84cf('0x32')]['filter']){_0x43b41b[_0x84cf('0x3d')]=_['merge'](_0x43b41b[_0x84cf('0x3d')],{'$or':_[_0x84cf('0x2b')](_0x20de4b,function(_0x3fa39a){if(_0x3fa39a[_0x84cf('0x2f')]!==_0x84cf('0x3f')){var _0x3897b0={};_0x3897b0[_0x3fa39a[_0x84cf('0x29')]]={'$like':'%'+_0x29455e[_0x84cf('0x32')][_0x84cf('0x40')]+'%'};return _0x3897b0;}})});}_0x43b41b=_['merge']({},_0x43b41b,_0x29455e[_0x84cf('0x41')]);var _0x516928={'where':_0x43b41b[_0x84cf('0x3d')]};return db[_0x84cf('0x2c')]['count'](_0x516928)[_0x84cf('0x25')](function(_0x531410){_0x51adcf[_0x84cf('0x1e')]=_0x531410;if(_0x29455e['query'][_0x84cf('0x42')]){_0x43b41b['include']=[{'all':!![]}];}return db[_0x84cf('0x2c')][_0x84cf('0x43')](_0x43b41b);})['then'](function(_0x847ce9){_0x51adcf[_0x84cf('0x44')]=_0x847ce9;return _0x51adcf;})[_0x84cf('0x25')](respondWithFilteredResult(_0x4092fd,_0x43b41b))['catch'](handleError(_0x4092fd,null));};exports[_0x84cf('0x45')]=function(_0x5f1b8e,_0x1c84e0){var _0x58b539={'raw':!![],'where':{'id':_0x5f1b8e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x84cf('0x31')]=_[_0x84cf('0x33')](db['WhatsappQueueReport'][_0x84cf('0x2d')]);_0x56b0e5['query']=_[_0x84cf('0x33')](_0x5f1b8e[_0x84cf('0x32')]);_0x56b0e5['filters']=_[_0x84cf('0x35')](_0x56b0e5['model'],_0x56b0e5[_0x84cf('0x32')]);_0x58b539['attributes']=_['intersection'](_0x56b0e5['model'],qs['fields'](_0x5f1b8e['query']['fields']));_0x58b539['attributes']=_0x58b539[_0x84cf('0x36')][_0x84cf('0x38')]?_0x58b539[_0x84cf('0x36')]:_0x56b0e5[_0x84cf('0x31')];if(_0x5f1b8e['query'][_0x84cf('0x42')]){_0x58b539['include']=[{'all':!![]}];}_0x58b539=_[_0x84cf('0x46')]({},_0x58b539,_0x5f1b8e[_0x84cf('0x41')]);return db[_0x84cf('0x2c')][_0x84cf('0x47')](_0x58b539)[_0x84cf('0x25')](handleEntityNotFound(_0x1c84e0,null))[_0x84cf('0x25')](respondWithResult(_0x1c84e0,null))['catch'](handleError(_0x1c84e0,null));};exports[_0x84cf('0x48')]=function(_0x2732bf,_0x4a4cf7){return db[_0x84cf('0x2c')][_0x84cf('0x48')](_0x2732bf[_0x84cf('0x49')],{})['then'](respondWithResult(_0x4a4cf7,0xc9))['catch'](handleError(_0x4a4cf7,null));};exports['update']=function(_0x1cf3f6,_0x104421){if(_0x1cf3f6[_0x84cf('0x49')]['id']){delete _0x1cf3f6[_0x84cf('0x49')]['id'];}return db[_0x84cf('0x2c')][_0x84cf('0x47')]({'where':{'id':_0x1cf3f6['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x104421,null))['then'](saveUpdates(_0x1cf3f6[_0x84cf('0x49')],null))['then'](respondWithResult(_0x104421,null))['catch'](handleError(_0x104421,null));};exports[_0x84cf('0x26')]=function(_0xb1c3a8,_0x426df1){return db['WhatsappQueueReport']['find']({'where':{'id':_0xb1c3a8[_0x84cf('0x4a')]['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x426df1,null))[_0x84cf('0x25')](removeEntity(_0x426df1,null))[_0x84cf('0x4b')](handleError(_0x426df1,null));};exports[_0x84cf('0x4c')]=function(_0x4c2025,_0xcfe28f){return db[_0x84cf('0x2c')]['describe']()[_0x84cf('0x25')](respondWithResult(_0xcfe28f,null))['catch'](handleError(_0xcfe28f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 05a869f..50be995 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 _0x80c6=['api','moment','bluebird','path','rimraf','exports','define','uniqueid','lodash','util'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x80c6,0x76));var _0x680c=function(_0x126a29,_0x260c22){_0x126a29=_0x126a29-0x0;var _0x2e3ecd=_0x80c6[_0x126a29];return _0x2e3ecd;};'use strict';var _=require(_0x680c('0x0'));var util=require(_0x680c('0x1'));var logger=require('../../config/logger')(_0x680c('0x2'));var moment=require(_0x680c('0x3'));var BPromise=require(_0x680c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x680c('0x5'));var rimraf=require(_0x680c('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x680c('0x7')]=function(_0x16daa1,_0x1e6f94){return _0x16daa1[_0x680c('0x8')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x680c('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x994c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x5e2218,_0x4d4944){var _0x161267=function(_0x1b224a){while(--_0x1b224a){_0x5e2218['push'](_0x5e2218['shift']());}};_0x161267(++_0x4d4944);}(_0x994c,0xc3));var _0xc994=function(_0x34037f,_0x260d7f){_0x34037f=_0x34037f-0x0;var _0x363d0a=_0x994c[_0x34037f];return _0x363d0a;};'use strict';var _=require(_0xc994('0x0'));var util=require('util');var logger=require(_0xc994('0x1'))(_0xc994('0x2'));var moment=require(_0xc994('0x3'));var BPromise=require(_0xc994('0x4'));var rp=require(_0xc994('0x5'));var fs=require('fs');var path=require(_0xc994('0x6'));var rimraf=require(_0xc994('0x7'));var config=require(_0xc994('0x8'));var attributes=require(_0xc994('0x9'));module[_0xc994('0xa')]=function(_0x39a473,_0x4b8e1c){return _0x39a473[_0xc994('0xb')](_0xc994('0xc'),attributes,{'tableName':_0xc994('0xd'),'paranoid':![],'indexes':[{'name':_0xc994('0xe'),'fields':[_0xc994('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 8677590..fee6085 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 _0x4c8d=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','where','attributes','UpdateWhatsappQueueReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2c8904,_0x222507){var _0xac620f=function(_0x3d0ccb){while(--_0x3d0ccb){_0x2c8904['push'](_0x2c8904['shift']());}};_0xac620f(++_0x222507);}(_0x4c8d,0x1a6));var _0xd4c8=function(_0x4e3127,_0x470bc6){_0x4e3127=_0x4e3127-0x0;var _0x16196e=_0x4c8d[_0x4e3127];return _0x16196e;};'use strict';var _=require(_0xd4c8('0x0'));var util=require(_0xd4c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4c8('0x2'));var db=require(_0xd4c8('0x3'))['db'];var utils=require(_0xd4c8('0x4'));var logger=require(_0xd4c8('0x5'))(_0xd4c8('0x6'));var config=require(_0xd4c8('0x7'));var jayson=require(_0xd4c8('0x8'));var client=jayson[_0xd4c8('0x9')][_0xd4c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14ba1d,_0x381628,_0x465b34){return new BPromise(function(_0x471d3a,_0x20f52c){return client['request'](_0x14ba1d,_0x465b34)[_0xd4c8('0xb')](function(_0x3929c1){logger[_0xd4c8('0xc')](_0xd4c8('0xd'),_0x381628,_0xd4c8('0xe'));logger[_0xd4c8('0xf')](_0xd4c8('0x10'),_0x381628,_0xd4c8('0xe'),JSON['stringify'](_0x3929c1));if(_0x3929c1['error']){if(_0x3929c1['error'][_0xd4c8('0x11')]===0x1f4){logger[_0xd4c8('0x12')](_0xd4c8('0xd'),_0x381628,_0x3929c1[_0xd4c8('0x12')]['message']);return _0x20f52c(_0x3929c1[_0xd4c8('0x12')][_0xd4c8('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x381628,_0x3929c1[_0xd4c8('0x12')]['message']);return _0x471d3a(_0x3929c1['error'][_0xd4c8('0x13')]);}else{logger[_0xd4c8('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x381628,_0xd4c8('0xe'));_0x471d3a(_0x3929c1[_0xd4c8('0x14')][_0xd4c8('0x13')]);}})[_0xd4c8('0x15')](function(_0x66ec4a){logger[_0xd4c8('0x12')](_0xd4c8('0xd'),_0x381628,_0x66ec4a);_0x20f52c(_0x66ec4a);});});}exports[_0xd4c8('0x16')]=function(_0x4cbd65){var _0x445519=this;return new Promise(function(_0x108d97,_0x293254){return db[_0xd4c8('0x17')]['create'](_0x4cbd65[_0xd4c8('0x18')],{'raw':_0x4cbd65[_0xd4c8('0x19')]?_0x4cbd65[_0xd4c8('0x19')][_0xd4c8('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3256){logger['info'](_0xd4c8('0x16'),_0x4cbd65);logger[_0xd4c8('0xf')](_0xd4c8('0x16'),_0x4cbd65,JSON[_0xd4c8('0x1b')](_0x4e3256));_0x108d97(_0x4e3256);})[_0xd4c8('0x15')](function(_0x59f85b){logger[_0xd4c8('0x12')](_0xd4c8('0x16'),_0x59f85b['message'],_0x4cbd65);_0x293254(_0x445519[_0xd4c8('0x12')](0x1f4,_0x59f85b[_0xd4c8('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x19d1f9){var _0x23d1b4=this;return new Promise(function(_0x4c30e9,_0x888907){return db[_0xd4c8('0x17')]['update'](_0x19d1f9[_0xd4c8('0x18')],{'raw':_0x19d1f9[_0xd4c8('0x19')]?_0x19d1f9['options'][_0xd4c8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d1f9[_0xd4c8('0x19')]?_0x19d1f9[_0xd4c8('0x19')][_0xd4c8('0x1c')]||null:null,'attributes':_0x19d1f9['options']?_0x19d1f9[_0xd4c8('0x19')][_0xd4c8('0x1d')]||null:null,'limit':_0x19d1f9[_0xd4c8('0x19')]?_0x19d1f9['options']['limit']||null:null})[_0xd4c8('0xb')](function(_0x259868){logger[_0xd4c8('0xc')](_0xd4c8('0x1e'),_0x19d1f9);logger[_0xd4c8('0xf')]('UpdateWhatsappQueueReport',_0x19d1f9,JSON['stringify'](_0x259868));_0x4c30e9(_0x259868);})[_0xd4c8('0x15')](function(_0x292da9){logger[_0xd4c8('0x12')](_0xd4c8('0x1e'),_0x292da9[_0xd4c8('0x13')],_0x19d1f9);_0x888907(_0x23d1b4[_0xd4c8('0x12')](0x1f4,_0x292da9[_0xd4c8('0x13')]));});});}; \ No newline at end of file +var _0x0f21=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x35dc63,_0x9a15a3){var _0x130b9d=function(_0x458162){while(--_0x458162){_0x35dc63['push'](_0x35dc63['shift']());}};_0x130b9d(++_0x9a15a3);}(_0x0f21,0x1a7));var _0x10f2=function(_0x455f69,_0x2f7200){_0x455f69=_0x455f69-0x0;var _0x12b5ca=_0x0f21[_0x455f69];return _0x12b5ca;};'use strict';var _=require(_0x10f2('0x0'));var util=require(_0x10f2('0x1'));var moment=require('moment');var BPromise=require(_0x10f2('0x2'));var rs=require(_0x10f2('0x3'));var fs=require('fs');var Redis=require(_0x10f2('0x4'));var db=require(_0x10f2('0x5'))['db'];var utils=require(_0x10f2('0x6'));var logger=require(_0x10f2('0x7'))(_0x10f2('0x8'));var config=require(_0x10f2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x10f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x98ae1,_0x4f1f00,_0x3b1baf){return new BPromise(function(_0x56157c,_0x31a7fc){return client[_0x10f2('0xb')](_0x98ae1,_0x3b1baf)[_0x10f2('0xc')](function(_0x4dd455){logger[_0x10f2('0xd')](_0x10f2('0xe'),_0x4f1f00,_0x10f2('0xf'));logger[_0x10f2('0x10')](_0x10f2('0x11'),_0x4f1f00,_0x10f2('0xf'),JSON['stringify'](_0x4dd455));if(_0x4dd455[_0x10f2('0x12')]){if(_0x4dd455[_0x10f2('0x12')][_0x10f2('0x13')]===0x1f4){logger[_0x10f2('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4f1f00,_0x4dd455[_0x10f2('0x12')]['message']);return _0x31a7fc(_0x4dd455['error'][_0x10f2('0x14')]);}logger[_0x10f2('0x12')](_0x10f2('0xe'),_0x4f1f00,_0x4dd455[_0x10f2('0x12')][_0x10f2('0x14')]);return _0x56157c(_0x4dd455[_0x10f2('0x12')]['message']);}else{logger[_0x10f2('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4f1f00,_0x10f2('0xf'));_0x56157c(_0x4dd455[_0x10f2('0x15')][_0x10f2('0x14')]);}})[_0x10f2('0x16')](function(_0x5a1f95){logger[_0x10f2('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4f1f00,_0x5a1f95);_0x31a7fc(_0x5a1f95);});});}exports[_0x10f2('0x17')]=function(_0x3f2be3){var _0x46e73e=this;return new Promise(function(_0xba522c,_0x9affc9){return db[_0x10f2('0x18')]['create'](_0x3f2be3[_0x10f2('0x19')],{'raw':_0x3f2be3['options']?_0x3f2be3[_0x10f2('0x1a')][_0x10f2('0x1b')]===undefined?!![]:![]:!![]})[_0x10f2('0xc')](function(_0x30bad9){logger[_0x10f2('0xd')](_0x10f2('0x17'),_0x3f2be3);logger[_0x10f2('0x10')](_0x10f2('0x17'),_0x3f2be3,JSON[_0x10f2('0x1c')](_0x30bad9));_0xba522c(_0x30bad9);})[_0x10f2('0x16')](function(_0xfe3679){logger['error'](_0x10f2('0x17'),_0xfe3679['message'],_0x3f2be3);_0x9affc9(_0x46e73e[_0x10f2('0x12')](0x1f4,_0xfe3679[_0x10f2('0x14')]));});});};exports[_0x10f2('0x1d')]=function(_0x244ee9){var _0xf22860=this;return new Promise(function(_0x2d87b0,_0x136e20){return db[_0x10f2('0x18')][_0x10f2('0x1e')](_0x244ee9['body'],{'raw':_0x244ee9[_0x10f2('0x1a')]?_0x244ee9['options'][_0x10f2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244ee9['options']?_0x244ee9[_0x10f2('0x1a')][_0x10f2('0x1f')]||null:null,'attributes':_0x244ee9[_0x10f2('0x1a')]?_0x244ee9[_0x10f2('0x1a')][_0x10f2('0x20')]||null:null,'limit':_0x244ee9['options']?_0x244ee9[_0x10f2('0x1a')]['limit']||null:null})[_0x10f2('0xc')](function(_0x1e3880){logger[_0x10f2('0xd')](_0x10f2('0x1d'),_0x244ee9);logger[_0x10f2('0x10')](_0x10f2('0x1d'),_0x244ee9,JSON[_0x10f2('0x1c')](_0x1e3880));_0x2d87b0(_0x1e3880);})[_0x10f2('0x16')](function(_0x207b02){logger[_0x10f2('0x12')]('UpdateWhatsappQueueReport',_0x207b02['message'],_0x244ee9);_0x136e20(_0xf22860[_0x10f2('0x12')](0x1f4,_0x207b02[_0x10f2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 60d688a..ab3b66c 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 _0x5b09=['fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5b09,0x160));var _0x95b0=function(_0x2747e2,_0x48e8da){_0x2747e2=_0x2747e2-0x0;var _0x907366=_0x5b09[_0x2747e2];return _0x907366;};'use strict';var multer=require(_0x95b0('0x0'));var util=require(_0x95b0('0x1'));var path=require(_0x95b0('0x2'));var timeout=require(_0x95b0('0x3'));var express=require(_0x95b0('0x4'));var router=express['Router']();var fs_extra=require(_0x95b0('0x5'));var auth=require(_0x95b0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95b0('0x7'));var controller=require(_0x95b0('0x8'));router['get']('/',auth[_0x95b0('0x9')](),controller['index']);router[_0x95b0('0xa')](_0x95b0('0xb'),auth[_0x95b0('0x9')](),controller[_0x95b0('0xc')]);router[_0x95b0('0xa')](_0x95b0('0xd'),auth[_0x95b0('0x9')](),controller[_0x95b0('0xe')]);router['post']('/',auth[_0x95b0('0x9')](),controller[_0x95b0('0xf')]);router[_0x95b0('0x10')](_0x95b0('0xd'),auth['isAuthenticated'](),controller[_0x95b0('0x11')]);router[_0x95b0('0x12')]('/:id',auth[_0x95b0('0x9')](),controller[_0x95b0('0x13')]);module[_0x95b0('0x14')]=router; \ No newline at end of file +var _0xeaf5=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','describe','/:id','show','post','isAuthenticated','create','delete','exports'];(function(_0x38604d,_0x25602a){var _0x1b66b0=function(_0xe18e8f){while(--_0xe18e8f){_0x38604d['push'](_0x38604d['shift']());}};_0x1b66b0(++_0x25602a);}(_0xeaf5,0x143));var _0x5eaf=function(_0x4dfd10,_0x3169d5){_0x4dfd10=_0x4dfd10-0x0;var _0x267950=_0xeaf5[_0x4dfd10];return _0x267950;};'use strict';var multer=require(_0x5eaf('0x0'));var util=require(_0x5eaf('0x1'));var path=require(_0x5eaf('0x2'));var timeout=require(_0x5eaf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5eaf('0x4'));var auth=require(_0x5eaf('0x5'));var interaction=require(_0x5eaf('0x6'));var config=require(_0x5eaf('0x7'));var controller=require(_0x5eaf('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5eaf('0x9')](_0x5eaf('0xa'),auth['isAuthenticated'](),controller[_0x5eaf('0xb')]);router[_0x5eaf('0x9')](_0x5eaf('0xc'),auth['isAuthenticated'](),controller[_0x5eaf('0xd')]);router[_0x5eaf('0xe')]('/',auth[_0x5eaf('0xf')](),controller[_0x5eaf('0x10')]);router['put'](_0x5eaf('0xc'),auth[_0x5eaf('0xf')](),controller['update']);router[_0x5eaf('0x11')](_0x5eaf('0xc'),auth[_0x5eaf('0xf')](),controller['destroy']);module[_0x5eaf('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1a1be4a..a1b8ceb 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 _0x1775=['STRING','ENUM','account','agent','queue','DATE','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'uniqueid':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5177('0x2')](_0x5177('0x3'),_0x5177('0x4'),_0x5177('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5177('0x6')]}}; \ No newline at end of file +var _0x7a40=['DATE','sequelize','exports','STRING','account','agent','queue'];(function(_0x85e273,_0x59a3db){var _0x521580=function(_0x15821a){while(--_0x15821a){_0x85e273['push'](_0x85e273['shift']());}};_0x521580(++_0x59a3db);}(_0x7a40,0x197));var _0x07a4=function(_0x30ffea,_0x2c6b20){_0x30ffea=_0x30ffea-0x0;var _0x5e4f5d=_0x7a40[_0x30ffea];return _0x5e4f5d;};'use strict';var Sequelize=require(_0x07a4('0x0'));module[_0x07a4('0x1')]={'uniqueid':{'type':Sequelize[_0x07a4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x07a4('0x3'),_0x07a4('0x4'),_0x07a4('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x07a4('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9283589..ddd9a51 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 _0x9bbd=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query'];(function(_0x551be6,_0x12dadb){var _0x5f5819=function(_0x1f06f0){while(--_0x1f06f0){_0x551be6['push'](_0x551be6['shift']());}};_0x5f5819(++_0x12dadb);}(_0x9bbd,0x198));var _0xd9bb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9bbd[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9bb('0x0'));var jsonpatch=require(_0xd9bb('0x1'));var rp=require(_0xd9bb('0x2'));var moment=require(_0xd9bb('0x3'));var BPromise=require(_0xd9bb('0x4'));var Mustache=require(_0xd9bb('0x5'));var util=require(_0xd9bb('0x6'));var path=require(_0xd9bb('0x7'));var sox=require(_0xd9bb('0x8'));var csv=require(_0xd9bb('0x9'));var ejs=require(_0xd9bb('0xa'));var fs=require('fs');var fs_extra=require(_0xd9bb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9bb('0xc'));var jsforce=require(_0xd9bb('0xd'));var deskjs=require(_0xd9bb('0xe'));var toCsv=require(_0xd9bb('0x9'));var querystring=require(_0xd9bb('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9bb('0x10'));var authService=require(_0xd9bb('0x11'));var qs=require(_0xd9bb('0x12'));var as=require(_0xd9bb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd9bb('0x14'));var utils=require('../../config/utils');var config=require(_0xd9bb('0x15'));var licenseUtil=require(_0xd9bb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293956,_0x20828a){_0x20828a=_0x20828a||0xcc;return function(_0x4fb6c9){if(_0x4fb6c9){return _0x293956[_0xd9bb('0x17')](_0x20828a);}return _0x293956[_0xd9bb('0x18')](_0x20828a)[_0xd9bb('0x19')]();};}function respondWithResult(_0x1c1a78,_0x440b75){_0x440b75=_0x440b75||0xc8;return function(_0x2af665){if(_0x2af665){return _0x1c1a78[_0xd9bb('0x18')](_0x440b75)['json'](_0x2af665);}};}function respondWithFilteredResult(_0x48e6b7,_0x17b8ce){return function(_0x31703){if(_0x31703){var _0x4ecd9e=typeof _0x17b8ce[_0xd9bb('0x1a')]===_0xd9bb('0x1b')&&typeof _0x17b8ce[_0xd9bb('0x1c')]===_0xd9bb('0x1b');var _0x20e181=_0x31703[_0xd9bb('0x1d')];var _0x282811=_0x4ecd9e?0x0:_0x17b8ce[_0xd9bb('0x1a')];var _0x57ca8d=_0x4ecd9e?_0x31703[_0xd9bb('0x1d')]:_0x17b8ce[_0xd9bb('0x1a')]+_0x17b8ce['limit'];var _0x5cfa50;if(_0x57ca8d>=_0x20e181){_0x57ca8d=_0x20e181;_0x5cfa50=0xc8;}else{_0x5cfa50=0xce;}_0x48e6b7['status'](_0x5cfa50);return _0x48e6b7[_0xd9bb('0x1e')](_0xd9bb('0x1f'),_0x282811+'-'+_0x57ca8d+'/'+_0x20e181)['json'](_0x31703);}return null;};}function patchUpdates(_0x20da99){return function(_0x48e11f){try{jsonpatch[_0xd9bb('0x20')](_0x48e11f,_0x20da99,!![]);}catch(_0x2294e0){return BPromise['reject'](_0x2294e0);}return _0x48e11f[_0xd9bb('0x21')]();};}function saveUpdates(_0x57c5fc,_0x3ec651){return function(_0x5adaa5){if(_0x5adaa5){return _0x5adaa5[_0xd9bb('0x22')](_0x57c5fc)[_0xd9bb('0x23')](function(_0x3b5fa4){return _0x3b5fa4;});}return null;};}function removeEntity(_0x47c408,_0x571458){return function(_0x56de4c){if(_0x56de4c){return _0x56de4c['destroy']()['then'](function(){_0x47c408[_0xd9bb('0x18')](0xcc)[_0xd9bb('0x19')]();});}};}function handleEntityNotFound(_0x4483f1,_0x1821d0){return function(_0x448e67){if(!_0x448e67){_0x4483f1[_0xd9bb('0x17')](0x194);}return _0x448e67;};}function handleError(_0x13cc5f,_0x388075){_0x388075=_0x388075||0x1f4;return function(_0x4c05d5){logger[_0xd9bb('0x24')](_0x4c05d5[_0xd9bb('0x25')]);if(_0x4c05d5[_0xd9bb('0x26')]){delete _0x4c05d5[_0xd9bb('0x26')];}_0x13cc5f['status'](_0x388075)[_0xd9bb('0x27')](_0x4c05d5);};}exports[_0xd9bb('0x28')]=function(_0x506324,_0x440cc3){var _0x216ea2={},_0xd01e8a={},_0x3d401d={'count':0x0,'rows':[]};var _0x3c65f3=_[_0xd9bb('0x29')](db[_0xd9bb('0x2a')][_0xd9bb('0x2b')],function(_0x4053c7){return{'name':_0x4053c7[_0xd9bb('0x2c')],'type':_0x4053c7['type'][_0xd9bb('0x2d')]};});_0xd01e8a[_0xd9bb('0x2e')]=_[_0xd9bb('0x29')](_0x3c65f3,_0xd9bb('0x26'));_0xd01e8a[_0xd9bb('0x2f')]=_['keys'](_0x506324[_0xd9bb('0x2f')]);_0xd01e8a[_0xd9bb('0x30')]=_[_0xd9bb('0x31')](_0xd01e8a['model'],_0xd01e8a[_0xd9bb('0x2f')]);_0x216ea2[_0xd9bb('0x32')]=_[_0xd9bb('0x31')](_0xd01e8a[_0xd9bb('0x2e')],qs['fields'](_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x33')]));_0x216ea2[_0xd9bb('0x32')]=_0x216ea2[_0xd9bb('0x32')]['length']?_0x216ea2[_0xd9bb('0x32')]:_0xd01e8a[_0xd9bb('0x2e')];if(!_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x34')](_0xd9bb('0x35'))){_0x216ea2[_0xd9bb('0x1c')]=qs[_0xd9bb('0x1c')](_0x506324['query']['limit']);_0x216ea2['offset']=qs[_0xd9bb('0x1a')](_0x506324[_0xd9bb('0x2f')]['offset']);}_0x216ea2[_0xd9bb('0x36')]=qs[_0xd9bb('0x37')](_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x37')]);_0x216ea2[_0xd9bb('0x38')]=qs[_0xd9bb('0x30')](_[_0xd9bb('0x39')](_0x506324[_0xd9bb('0x2f')],_0xd01e8a[_0xd9bb('0x30')]),_0x3c65f3);if(_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x3a')]){_0x216ea2['where']=_[_0xd9bb('0x3b')](_0x216ea2[_0xd9bb('0x38')],{'$or':_[_0xd9bb('0x29')](_0x3c65f3,function(_0x4e9c41){if(_0x4e9c41[_0xd9bb('0x3c')]!==_0xd9bb('0x3d')){var _0x146bb3={};_0x146bb3[_0x4e9c41['name']]={'$like':'%'+_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x3a')]+'%'};return _0x146bb3;}})});}_0x216ea2=_['merge']({},_0x216ea2,_0x506324[_0xd9bb('0x3e')]);var _0x3b9375={'where':_0x216ea2[_0xd9bb('0x38')]};return db[_0xd9bb('0x2a')][_0xd9bb('0x1d')](_0x3b9375)[_0xd9bb('0x23')](function(_0x1a4229){_0x3d401d['count']=_0x1a4229;if(_0x506324[_0xd9bb('0x2f')][_0xd9bb('0x3f')]){_0x216ea2[_0xd9bb('0x40')]=[{'all':!![]}];}return db[_0xd9bb('0x2a')][_0xd9bb('0x41')](_0x216ea2);})[_0xd9bb('0x23')](function(_0x527a74){_0x3d401d[_0xd9bb('0x42')]=_0x527a74;return _0x3d401d;})[_0xd9bb('0x23')](respondWithFilteredResult(_0x440cc3,_0x216ea2))['catch'](handleError(_0x440cc3,null));};exports[_0xd9bb('0x43')]=function(_0x30aa16,_0x1be4a8){var _0x27403f={'raw':!![],'where':{'id':_0x30aa16[_0xd9bb('0x44')]['id']}},_0xed02d6={};_0xed02d6['model']=_[_0xd9bb('0x45')](db[_0xd9bb('0x2a')]['rawAttributes']);_0xed02d6[_0xd9bb('0x2f')]=_[_0xd9bb('0x45')](_0x30aa16[_0xd9bb('0x2f')]);_0xed02d6['filters']=_[_0xd9bb('0x31')](_0xed02d6[_0xd9bb('0x2e')],_0xed02d6[_0xd9bb('0x2f')]);_0x27403f[_0xd9bb('0x32')]=_[_0xd9bb('0x31')](_0xed02d6[_0xd9bb('0x2e')],qs[_0xd9bb('0x33')](_0x30aa16[_0xd9bb('0x2f')]['fields']));_0x27403f[_0xd9bb('0x32')]=_0x27403f[_0xd9bb('0x32')][_0xd9bb('0x46')]?_0x27403f[_0xd9bb('0x32')]:_0xed02d6[_0xd9bb('0x2e')];if(_0x30aa16[_0xd9bb('0x2f')]['includeAll']){_0x27403f[_0xd9bb('0x40')]=[{'all':!![]}];}_0x27403f=_[_0xd9bb('0x3b')]({},_0x27403f,_0x30aa16['options']);return db['WhatsappTransferReport']['find'](_0x27403f)[_0xd9bb('0x23')](handleEntityNotFound(_0x1be4a8,null))[_0xd9bb('0x23')](respondWithResult(_0x1be4a8,null))[_0xd9bb('0x47')](handleError(_0x1be4a8,null));};exports[_0xd9bb('0x48')]=function(_0x7528dd,_0x98ebb7){return db[_0xd9bb('0x2a')][_0xd9bb('0x48')](_0x7528dd[_0xd9bb('0x49')],{})[_0xd9bb('0x23')](respondWithResult(_0x98ebb7,0xc9))[_0xd9bb('0x47')](handleError(_0x98ebb7,null));};exports[_0xd9bb('0x22')]=function(_0xf4063a,_0x33c034){if(_0xf4063a[_0xd9bb('0x49')]['id']){delete _0xf4063a[_0xd9bb('0x49')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0xf4063a['params']['id']}})[_0xd9bb('0x23')](handleEntityNotFound(_0x33c034,null))['then'](saveUpdates(_0xf4063a[_0xd9bb('0x49')],null))['then'](respondWithResult(_0x33c034,null))[_0xd9bb('0x47')](handleError(_0x33c034,null));};exports[_0xd9bb('0x4a')]=function(_0xdfdcd9,_0x8084fc){return db['WhatsappTransferReport']['find']({'where':{'id':_0xdfdcd9[_0xd9bb('0x44')]['id']}})[_0xd9bb('0x23')](handleEntityNotFound(_0x8084fc,null))[_0xd9bb('0x23')](removeEntity(_0x8084fc,null))[_0xd9bb('0x47')](handleError(_0x8084fc,null));};exports[_0xd9bb('0x4b')]=function(_0x453d9b,_0x2894a5){return db[_0xd9bb('0x2a')][_0xd9bb('0x4b')]()[_0xd9bb('0x23')](respondWithResult(_0x2894a5,null))[_0xd9bb('0x47')](handleError(_0x2894a5,null));}; \ No newline at end of file +var _0x5669=['fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','filter','options','WhatsappTransferReport','then','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes'];(function(_0x1a210e,_0x18a85a){var _0x368a5d=function(_0x247e77){while(--_0x247e77){_0x1a210e['push'](_0x1a210e['shift']());}};_0x368a5d(++_0x18a85a);}(_0x5669,0x19e));var _0x9566=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x5669[_0x3bb5b4];return _0x586c60;};'use strict';var emlformat=require(_0x9566('0x0'));var rimraf=require(_0x9566('0x1'));var zipdir=require(_0x9566('0x2'));var jsonpatch=require(_0x9566('0x3'));var rp=require(_0x9566('0x4'));var moment=require(_0x9566('0x5'));var BPromise=require(_0x9566('0x6'));var Mustache=require(_0x9566('0x7'));var util=require(_0x9566('0x8'));var path=require(_0x9566('0x9'));var sox=require('sox');var csv=require(_0x9566('0xa'));var ejs=require(_0x9566('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9566('0xc'));var squel=require(_0x9566('0xd'));var crypto=require(_0x9566('0xe'));var jsforce=require(_0x9566('0xf'));var deskjs=require(_0x9566('0x10'));var toCsv=require(_0x9566('0xa'));var querystring=require(_0x9566('0x11'));var Papa=require(_0x9566('0x12'));var Redis=require(_0x9566('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9566('0x14'));var as=require(_0x9566('0x15'));var hardwareService=require(_0x9566('0x16'));var logger=require(_0x9566('0x17'))('api');var utils=require(_0x9566('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9566('0x19'));var db=require(_0x9566('0x1a'))['db'];function respondWithStatusCode(_0x12eed1,_0x5631b1){_0x5631b1=_0x5631b1||0xcc;return function(_0x37194f){if(_0x37194f){return _0x12eed1[_0x9566('0x1b')](_0x5631b1);}return _0x12eed1['status'](_0x5631b1)[_0x9566('0x1c')]();};}function respondWithResult(_0x4387e8,_0x1be7dc){_0x1be7dc=_0x1be7dc||0xc8;return function(_0x15e813){if(_0x15e813){return _0x4387e8[_0x9566('0x1d')](_0x1be7dc)[_0x9566('0x1e')](_0x15e813);}};}function respondWithFilteredResult(_0x333e1c,_0x2cf447){return function(_0x4db350){if(_0x4db350){var _0x484e94=typeof _0x2cf447[_0x9566('0x1f')]===_0x9566('0x20')&&typeof _0x2cf447[_0x9566('0x21')]===_0x9566('0x20');var _0x25b4a1=_0x4db350[_0x9566('0x22')];var _0x412bec=_0x484e94?0x0:_0x2cf447[_0x9566('0x1f')];var _0xa4f629=_0x484e94?_0x4db350[_0x9566('0x22')]:_0x2cf447[_0x9566('0x1f')]+_0x2cf447['limit'];var _0x352ef0;if(_0xa4f629>=_0x25b4a1){_0xa4f629=_0x25b4a1;_0x352ef0=0xc8;}else{_0x352ef0=0xce;}_0x333e1c[_0x9566('0x1d')](_0x352ef0);return _0x333e1c['set']('Content-Range',_0x412bec+'-'+_0xa4f629+'/'+_0x25b4a1)[_0x9566('0x1e')](_0x4db350);}return null;};}function patchUpdates(_0x420cfa){return function(_0x36e60e){try{jsonpatch[_0x9566('0x23')](_0x36e60e,_0x420cfa,!![]);}catch(_0x38d4a6){return BPromise[_0x9566('0x24')](_0x38d4a6);}return _0x36e60e['save']();};}function saveUpdates(_0x5a6b94,_0x3be188){return function(_0x271305){if(_0x271305){return _0x271305[_0x9566('0x25')](_0x5a6b94)['then'](function(_0x337abe){return _0x337abe;});}return null;};}function removeEntity(_0x5c7d2f,_0x2e86aa){return function(_0x496a8e){if(_0x496a8e){return _0x496a8e[_0x9566('0x26')]()['then'](function(){_0x5c7d2f['status'](0xcc)[_0x9566('0x1c')]();});}};}function handleEntityNotFound(_0x478363,_0x5c8699){return function(_0x18d88e){if(!_0x18d88e){_0x478363[_0x9566('0x1b')](0x194);}return _0x18d88e;};}function handleError(_0x8b9c6,_0x3d1505){_0x3d1505=_0x3d1505||0x1f4;return function(_0x2937a8){logger[_0x9566('0x27')](_0x2937a8[_0x9566('0x28')]);if(_0x2937a8['name']){delete _0x2937a8[_0x9566('0x29')];}_0x8b9c6['status'](_0x3d1505)[_0x9566('0x2a')](_0x2937a8);};}exports[_0x9566('0x2b')]=function(_0x32069e,_0x5c711d){var _0x412732={},_0x3dd6a8={},_0x5bcc60={'count':0x0,'rows':[]};var _0x2b19ed=_['map'](db['WhatsappTransferReport'][_0x9566('0x2c')],function(_0x2b0a59){return{'name':_0x2b0a59[_0x9566('0x2d')],'type':_0x2b0a59[_0x9566('0x2e')][_0x9566('0x2f')]};});_0x3dd6a8['model']=_[_0x9566('0x30')](_0x2b19ed,_0x9566('0x29'));_0x3dd6a8[_0x9566('0x31')]=_[_0x9566('0x32')](_0x32069e[_0x9566('0x31')]);_0x3dd6a8['filters']=_[_0x9566('0x33')](_0x3dd6a8[_0x9566('0x34')],_0x3dd6a8[_0x9566('0x31')]);_0x412732[_0x9566('0x35')]=_[_0x9566('0x33')](_0x3dd6a8['model'],qs[_0x9566('0x36')](_0x32069e['query'][_0x9566('0x36')]));_0x412732[_0x9566('0x35')]=_0x412732['attributes'][_0x9566('0x37')]?_0x412732['attributes']:_0x3dd6a8[_0x9566('0x34')];if(!_0x32069e[_0x9566('0x31')][_0x9566('0x38')](_0x9566('0x39'))){_0x412732[_0x9566('0x21')]=qs[_0x9566('0x21')](_0x32069e[_0x9566('0x31')][_0x9566('0x21')]);_0x412732[_0x9566('0x1f')]=qs[_0x9566('0x1f')](_0x32069e[_0x9566('0x31')][_0x9566('0x1f')]);}_0x412732['order']=qs['sort'](_0x32069e['query'][_0x9566('0x3a')]);_0x412732[_0x9566('0x3b')]=qs[_0x9566('0x3c')](_['pick'](_0x32069e[_0x9566('0x31')],_0x3dd6a8[_0x9566('0x3c')]),_0x2b19ed);if(_0x32069e[_0x9566('0x31')]['filter']){_0x412732[_0x9566('0x3b')]=_['merge'](_0x412732['where'],{'$or':_['map'](_0x2b19ed,function(_0x5a211e){if(_0x5a211e[_0x9566('0x2e')]!==_0x9566('0x3d')){var _0x17dab2={};_0x17dab2[_0x5a211e['name']]={'$like':'%'+_0x32069e[_0x9566('0x31')][_0x9566('0x3e')]+'%'};return _0x17dab2;}})});}_0x412732=_['merge']({},_0x412732,_0x32069e[_0x9566('0x3f')]);var _0x5885e9={'where':_0x412732[_0x9566('0x3b')]};return db[_0x9566('0x40')][_0x9566('0x22')](_0x5885e9)[_0x9566('0x41')](function(_0x3a3883){_0x5bcc60[_0x9566('0x22')]=_0x3a3883;if(_0x32069e[_0x9566('0x31')][_0x9566('0x42')]){_0x412732[_0x9566('0x43')]=[{'all':!![]}];}return db[_0x9566('0x40')][_0x9566('0x44')](_0x412732);})[_0x9566('0x41')](function(_0x3ed465){_0x5bcc60[_0x9566('0x45')]=_0x3ed465;return _0x5bcc60;})[_0x9566('0x41')](respondWithFilteredResult(_0x5c711d,_0x412732))[_0x9566('0x46')](handleError(_0x5c711d,null));};exports[_0x9566('0x47')]=function(_0x168e74,_0x242b65){var _0x1fdbae={'raw':!![],'where':{'id':_0x168e74[_0x9566('0x48')]['id']}},_0x58c4f6={};_0x58c4f6['model']=_['keys'](db[_0x9566('0x40')][_0x9566('0x2c')]);_0x58c4f6[_0x9566('0x31')]=_[_0x9566('0x32')](_0x168e74[_0x9566('0x31')]);_0x58c4f6[_0x9566('0x3c')]=_[_0x9566('0x33')](_0x58c4f6[_0x9566('0x34')],_0x58c4f6['query']);_0x1fdbae['attributes']=_['intersection'](_0x58c4f6[_0x9566('0x34')],qs['fields'](_0x168e74[_0x9566('0x31')][_0x9566('0x36')]));_0x1fdbae[_0x9566('0x35')]=_0x1fdbae[_0x9566('0x35')]['length']?_0x1fdbae[_0x9566('0x35')]:_0x58c4f6[_0x9566('0x34')];if(_0x168e74[_0x9566('0x31')][_0x9566('0x42')]){_0x1fdbae[_0x9566('0x43')]=[{'all':!![]}];}_0x1fdbae=_[_0x9566('0x49')]({},_0x1fdbae,_0x168e74[_0x9566('0x3f')]);return db['WhatsappTransferReport'][_0x9566('0x4a')](_0x1fdbae)[_0x9566('0x41')](handleEntityNotFound(_0x242b65,null))[_0x9566('0x41')](respondWithResult(_0x242b65,null))[_0x9566('0x46')](handleError(_0x242b65,null));};exports[_0x9566('0x4b')]=function(_0xad0a9c,_0x24df0c){return db[_0x9566('0x40')][_0x9566('0x4b')](_0xad0a9c['body'],{})[_0x9566('0x41')](respondWithResult(_0x24df0c,0xc9))['catch'](handleError(_0x24df0c,null));};exports[_0x9566('0x25')]=function(_0x2c3572,_0x2a7038){if(_0x2c3572['body']['id']){delete _0x2c3572[_0x9566('0x4c')]['id'];}return db[_0x9566('0x40')][_0x9566('0x4a')]({'where':{'id':_0x2c3572[_0x9566('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a7038,null))['then'](saveUpdates(_0x2c3572[_0x9566('0x4c')],null))[_0x9566('0x41')](respondWithResult(_0x2a7038,null))[_0x9566('0x46')](handleError(_0x2a7038,null));};exports[_0x9566('0x26')]=function(_0x4a299c,_0x9079b1){return db[_0x9566('0x40')][_0x9566('0x4a')]({'where':{'id':_0x4a299c[_0x9566('0x48')]['id']}})[_0x9566('0x41')](handleEntityNotFound(_0x9079b1,null))[_0x9566('0x41')](removeEntity(_0x9079b1,null))['catch'](handleError(_0x9079b1,null));};exports[_0x9566('0x4d')]=function(_0x3ee821,_0x3f0a83){return db[_0x9566('0x40')][_0x9566('0x4d')]()[_0x9566('0x41')](respondWithResult(_0x3f0a83,null))['catch'](handleError(_0x3f0a83,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f39c048..cea78ab 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 _0xaa41=['exports','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','./whatsappTransferReport.attributes'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xaa41,0x12b));var _0x1aa4=function(_0x4895e3,_0x536f0e){_0x4895e3=_0x4895e3-0x0;var _0x1192a1=_0xaa41[_0x4895e3];return _0x1192a1;};'use strict';var _=require(_0x1aa4('0x0'));var util=require(_0x1aa4('0x1'));var logger=require(_0x1aa4('0x2'))('api');var moment=require(_0x1aa4('0x3'));var BPromise=require('bluebird');var rp=require(_0x1aa4('0x4'));var fs=require('fs');var path=require(_0x1aa4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1aa4('0x6'));module[_0x1aa4('0x7')]=function(_0x20a4e4,_0x3e7f65){return _0x20a4e4['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1aa4('0x8'),'fields':[_0x1aa4('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a15=['uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8a15,0x1ed));var _0x58a1=function(_0x7ff50b,_0x399dc0){_0x7ff50b=_0x7ff50b-0x0;var _0x43e570=_0x8a15[_0x7ff50b];return _0x43e570;};'use strict';var _=require(_0x58a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x58a1('0x1'));var BPromise=require(_0x58a1('0x2'));var rp=require(_0x58a1('0x3'));var fs=require('fs');var path=require(_0x58a1('0x4'));var rimraf=require(_0x58a1('0x5'));var config=require(_0x58a1('0x6'));var attributes=require(_0x58a1('0x7'));module[_0x58a1('0x8')]=function(_0x1e83ea,_0x25a2e0){return _0x1e83ea[_0x58a1('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x58a1('0xa'),'paranoid':![],'indexes':[{'name':_0x58a1('0xb'),'fields':[_0x58a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 57e901b..bfa0d14 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 _0x5dd6=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x346bf9,_0x2a3c3e){var _0xf9773=function(_0x3599dc){while(--_0x3599dc){_0x346bf9['push'](_0x346bf9['shift']());}};_0xf9773(++_0x2a3c3e);}(_0x5dd6,0xc7));var _0x65dd=function(_0x2c170a,_0x5014fa){_0x2c170a=_0x2c170a-0x0;var _0x546098=_0x5dd6[_0x2c170a];return _0x546098;};'use strict';var _=require(_0x65dd('0x0'));var util=require(_0x65dd('0x1'));var moment=require(_0x65dd('0x2'));var BPromise=require(_0x65dd('0x3'));var rs=require(_0x65dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x65dd('0x5'));var logger=require(_0x65dd('0x6'))(_0x65dd('0x7'));var config=require(_0x65dd('0x8'));var jayson=require(_0x65dd('0x9'));var client=jayson[_0x65dd('0xa')][_0x65dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28d447,_0x343793,_0x5cf06d){return new BPromise(function(_0x281ff6,_0x247773){return client[_0x65dd('0xc')](_0x28d447,_0x5cf06d)[_0x65dd('0xd')](function(_0x4b4228){logger[_0x65dd('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x343793,'request\x20sent');logger['debug'](_0x65dd('0xf'),_0x343793,'request\x20sent',JSON[_0x65dd('0x10')](_0x4b4228));if(_0x4b4228['error']){if(_0x4b4228[_0x65dd('0x11')][_0x65dd('0x12')]===0x1f4){logger[_0x65dd('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x343793,_0x4b4228[_0x65dd('0x11')][_0x65dd('0x13')]);return _0x247773(_0x4b4228['error'][_0x65dd('0x13')]);}logger[_0x65dd('0x11')](_0x65dd('0x14'),_0x343793,_0x4b4228[_0x65dd('0x11')][_0x65dd('0x13')]);return _0x281ff6(_0x4b4228[_0x65dd('0x11')]['message']);}else{logger[_0x65dd('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x343793,'request\x20sent');_0x281ff6(_0x4b4228[_0x65dd('0x15')]['message']);}})[_0x65dd('0x16')](function(_0x128ed5){logger[_0x65dd('0x11')](_0x65dd('0x14'),_0x343793,_0x128ed5);_0x247773(_0x128ed5);});});} \ No newline at end of file +var _0xe34c=['http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe402ea,_0x594695){var _0xb3c0d4=function(_0x5192a5){while(--_0x5192a5){_0xe402ea['push'](_0xe402ea['shift']());}};_0xb3c0d4(++_0x594695);}(_0xe34c,0xe4));var _0xce34=function(_0x114775,_0x313bc3){_0x114775=_0x114775-0x0;var _0x143928=_0xe34c[_0x114775];return _0x143928;};'use strict';var _=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var moment=require('moment');var BPromise=require(_0xce34('0x2'));var rs=require(_0xce34('0x3'));var fs=require('fs');var Redis=require(_0xce34('0x4'));var db=require(_0xce34('0x5'))['db'];var utils=require(_0xce34('0x6'));var logger=require(_0xce34('0x7'))(_0xce34('0x8'));var config=require(_0xce34('0x9'));var jayson=require(_0xce34('0xa'));var client=jayson[_0xce34('0xb')][_0xce34('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5100ee,_0x59b1ed,_0x5eda1a){return new BPromise(function(_0x295dfd,_0x45a7a6){return client[_0xce34('0xd')](_0x5100ee,_0x5eda1a)[_0xce34('0xe')](function(_0x4dccfd){logger[_0xce34('0xf')](_0xce34('0x10'),_0x59b1ed,'request\x20sent');logger[_0xce34('0x11')](_0xce34('0x12'),_0x59b1ed,_0xce34('0x13'),JSON['stringify'](_0x4dccfd));if(_0x4dccfd[_0xce34('0x14')]){if(_0x4dccfd[_0xce34('0x14')]['code']===0x1f4){logger[_0xce34('0x14')](_0xce34('0x10'),_0x59b1ed,_0x4dccfd[_0xce34('0x14')][_0xce34('0x15')]);return _0x45a7a6(_0x4dccfd['error']['message']);}logger[_0xce34('0x14')](_0xce34('0x10'),_0x59b1ed,_0x4dccfd[_0xce34('0x14')][_0xce34('0x15')]);return _0x295dfd(_0x4dccfd['error'][_0xce34('0x15')]);}else{logger['info'](_0xce34('0x10'),_0x59b1ed,_0xce34('0x13'));_0x295dfd(_0x4dccfd[_0xce34('0x16')][_0xce34('0x15')]);}})[_0xce34('0x17')](function(_0x4b5311){logger[_0xce34('0x14')](_0xce34('0x10'),_0x59b1ed,_0x4b5311);_0x45a7a6(_0x4b5311);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 79b800f..ccab771 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44e8=['./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','online','join','Offline\x20apps:','map','status','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config'];(function(_0x271c7f,_0x5802fd){var _0x38a3d0=function(_0x32efa8){while(--_0x32efa8){_0x271c7f['push'](_0x271c7f['shift']());}};_0x38a3d0(++_0x5802fd);}(_0x44e8,0xd7));var _0x844e=function(_0x9f2971,_0x25bf92){_0x9f2971=_0x9f2971-0x0;var _0x11fd0f=_0x44e8[_0x9f2971];return _0x11fd0f;};'use strict';var _=require(_0x844e('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x844e('0x1'));var rpc=require(_0x844e('0x2'));var config=require(_0x844e('0x3'));var logger=require(_0x844e('0x4'))('app');var pm2=require(_0x844e('0x5'));var pm2Config=require(_0x844e('0x6'));var schedule=require(_0x844e('0x7'));var chat=require(_0x844e('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x844e('0x9'));var provider=require(_0x844e('0xa'));function main(){return db[_0x844e('0xb')][_0x844e('0xc')]()['then'](function(){if(config[_0x844e('0xd')]){return seedDb[_0x844e('0xe')]();}})[_0x844e('0xf')](function(){return checkLicense[_0x844e('0xe')]();})[_0x844e('0xf')](function(){return rpc[_0x844e('0x10')]();})['then'](function(_0x39ef28){logger[_0x844e('0x11')](_0x39ef28);return chat[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return whatsapp[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return schedule[_0x844e('0x12')]();})['then'](function(){return transcribe[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return provider['start']();})[_0x844e('0xf')](function(_0x1cd556){logger['info'](_0x1cd556);return pm2[_0x844e('0x12')](pm2Config);})[_0x844e('0xf')](function(_0x1c1689){var _0x4ed3a4=_0x1c1689[_0x844e('0x13')](function(_0x465e49){return typeof _0x465e49[_0x844e('0x14')]===_0x844e('0x15')&&_0x465e49[_0x844e('0x14')]>=0x0;});if(_0x4ed3a4[_0x844e('0x16')]>0x0){throw new Error(_0x4ed3a4[_0x844e('0x16')]+_0x844e('0x17')+_['map'](_0x4ed3a4,function(_0x36286c){return'\x22'+_0x36286c['pm2_env'][_0x844e('0x18')]+'\x22';}));}logger['info'](_0x844e('0x19'),_['map'](_[_0x844e('0x13')](_0x1c1689,{'status':_0x844e('0x1a')}),_0x844e('0x18'))[_0x844e('0x1b')]());logger[_0x844e('0x11')](_0x844e('0x1c'),_[_0x844e('0x1d')](_[_0x844e('0x13')](_0x1c1689,function(_0x4ffb86){return _0x4ffb86[_0x844e('0x1e')]!=='online';}),'name')[_0x844e('0x1b')]()||_0x844e('0x1f'));console[_0x844e('0x20')](_0x844e('0x21'));})['catch'](function(_0x1202dc){console[_0x844e('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x1202dc);logger[_0x844e('0x22')](_0x844e('0x23'),_0x1202dc);process[_0x844e('0x24')](0x1);});}main(); \ No newline at end of file +var _0x20d7=['./config/pm2/config','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','None','log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./config/seedDB','./config/license','./rpc','./config/pm2'];(function(_0x25fc4e,_0x43b107){var _0x35ac86=function(_0x206e96){while(--_0x206e96){_0x25fc4e['push'](_0x25fc4e['shift']());}};_0x35ac86(++_0x43b107);}(_0x20d7,0x146));var _0x720d=function(_0x8d8b6f,_0x2020aa){_0x8d8b6f=_0x8d8b6f-0x0;var _0x39ee84=_0x20d7[_0x8d8b6f];return _0x39ee84;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x720d('0x0'));var checkLicense=require(_0x720d('0x1'));var rpc=require(_0x720d('0x2'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x720d('0x3'));var pm2Config=require(_0x720d('0x4'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x720d('0x5'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x720d('0x6')][_0x720d('0x7')]()[_0x720d('0x8')](function(){if(config[_0x720d('0x9')]){return seedDb[_0x720d('0xa')]();}})[_0x720d('0x8')](function(){return checkLicense[_0x720d('0xa')]();})[_0x720d('0x8')](function(){return rpc[_0x720d('0xb')]();})[_0x720d('0x8')](function(_0x31eb31){logger[_0x720d('0xc')](_0x31eb31);return chat[_0x720d('0xd')]();})[_0x720d('0x8')](function(){return whatsapp[_0x720d('0xd')]();})[_0x720d('0x8')](function(){return schedule[_0x720d('0xd')]();})[_0x720d('0x8')](function(){return transcribe[_0x720d('0xd')]();})['then'](function(){return provider[_0x720d('0xd')]();})[_0x720d('0x8')](function(_0xf3c31b){logger[_0x720d('0xc')](_0xf3c31b);return pm2[_0x720d('0xd')](pm2Config);})[_0x720d('0x8')](function(_0x2e0ecd){var _0x255845=_0x2e0ecd['filter'](function(_0x408dff){return typeof _0x408dff['exitCode']==='number'&&_0x408dff['exitCode']>=0x0;});if(_0x255845[_0x720d('0xe')]>0x0){throw new Error(_0x255845['length']+_0x720d('0xf')+_[_0x720d('0x10')](_0x255845,function(_0x443443){return'\x22'+_0x443443[_0x720d('0x11')][_0x720d('0x12')]+'\x22';}));}logger[_0x720d('0xc')](_0x720d('0x13'),_['map'](_[_0x720d('0x14')](_0x2e0ecd,{'status':_0x720d('0x15')}),_0x720d('0x12'))[_0x720d('0x16')]());logger['info'](_0x720d('0x17'),_[_0x720d('0x10')](_[_0x720d('0x14')](_0x2e0ecd,function(_0x3237c2){return _0x3237c2['status']!==_0x720d('0x15');}),_0x720d('0x12'))['join']()||_0x720d('0x18'));console[_0x720d('0x19')](_0x720d('0x1a'));})[_0x720d('0x1b')](function(_0x47c332){console[_0x720d('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x47c332);logger[_0x720d('0x1c')](_0x720d('0x1d'),_0x47c332);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c76a6d0..9b630af 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 _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x2defa0,_0x4ddd55){var _0x15c59f=function(_0x313d8f){while(--_0x313d8f){_0x2defa0['push'](_0x2defa0['shift']());}};_0x15c59f(++_0x4ddd55);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e50bb,_0x29290d){_0x1e50bb=_0x1e50bb-0x0;var _0x18c472=_0xa41a[_0x1e50bb];return _0x18c472;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x18e914,_0x15fdbb){var _0xfcad1=function(_0x5a57ab){while(--_0x5a57ab){_0x18e914['push'](_0x18e914['shift']());}};_0xfcad1(++_0x15fdbb);}(_0xedd9,0xfc));var _0x9edd=function(_0x50337b,_0x35a8ee){_0x50337b=_0x50337b-0x0;var _0x53d607=_0xedd9[_0x50337b];return _0x53d607;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ae6a120..06712cc 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 _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x194a15,_0xa6312a){var _0x1fecfe=function(_0x1bff2b){while(--_0x1bff2b){_0x194a15['push'](_0x194a15['shift']());}};_0x1fecfe(++_0xa6312a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x29b641,_0x3a8820){var _0x461053=function(_0x182496){while(--_0x182496){_0x29b641['push'](_0x29b641['shift']());}};_0x461053(++_0x3a8820);}(_0x2032,0xd9));var _0x2203=function(_0x1626de,_0xe0c9b){_0x1626de=_0x1626de-0x0;var _0x4f3955=_0x2032[_0x1626de];return _0x4f3955;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 440feb9..5bf8cec 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 _0x6894=['true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','phone','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','dateOfBirth','fieldType','buildExpression','type','default','text','start','value','Tag','split','tags','clause','and','user','uc.UserId\x20=\x20?','map','some','compact','Contact','push','concat','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','c.id','limit','offset','subqry.id','having','order','DESC','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','toString','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete'];(function(_0x4122ad,_0x48af02){var _0x129d95=function(_0x1df015){while(--_0x1df015){_0x4122ad['push'](_0x4122ad['shift']());}};_0x129d95(++_0x48af02);}(_0x6894,0xca));var _0x4689=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x6894[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0x4689('0x0'));var squel=require(_0x4689('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x4689('0x2'));var utils=require(_0x4689('0x3'));var db=require(_0x4689('0x4'))['db'];function skipContactsQuery(_0x31ee3b,_0x22d46a){var _0x33b4a3=![];if(_0x31ee3b[_0x4689('0x5')]===_0x4689('0x6')&&!_0x22d46a[_0x4689('0x7')]&&!_0x22d46a[_0x4689('0x8')]&&_0x22d46a[_0x4689('0x9')]!==_0x4689('0xa')){_0x33b4a3=!![];}return _0x33b4a3;}function getContactsSubquery(){return squel[_0x4689('0xb')]()['from'](_0x4689('0xc'),'c')[_0x4689('0xd')](_0x4689('0xe'));}function applyJoinClauses(_0x1d7c32,_0x457906){var _0x27dba8=_0x457906?'c':'subqry';_0x1d7c32[_0x4689('0xf')]('cm_user_has_contacts','uc',_0x4689('0x10')+_0x27dba8+_0x4689('0x11'))[_0x4689('0xf')](_0x4689('0x12'),'ct',_0x4689('0x13')+_0x27dba8+_0x4689('0x11'))[_0x4689('0xf')](_0x4689('0x14'),'t',_0x4689('0x15'));return _0x1d7c32;}function addFieldsToQuery(_0x4054ea,_0x33458a,_0x497782,_0x245f0c,_0x1d0522){var _0x7f6629=_0x1d0522?'c':_0x4689('0x16');if(!_0x33458a){_0x33458a=['id',_0x4689('0x17'),'lastName',_0x4689('0x18'),'mobile','fax','email',_0x4689('0x8'),_0x4689('0x19'),_0x4689('0x1a'),_0x4689('0x1b'),_0x4689('0x1c'),_0x4689('0x1d')];}else if(!_0x33458a[_0x4689('0x1e')]('id')){_0x33458a['push']('id');}var _0x51f270=_0x497782&&_0x1d0522||!_0x497782&&!_0x1d0522;if(_0x245f0c){_0x51f270=_0x245f0c&&_0x1d0522||!_0x245f0c&&!_0x1d0522;}_0x33458a[_0x4689('0x1f')](function(_0x215166){if(_0x215166===_0x4689('0x1d')){if(_0x51f270){_0x4054ea[_0x4689('0x20')](_0x4689('0x21'),_0x215166);}else if(_0x497782||_0x245f0c){_0x4054ea[_0x4689('0x20')](_0x7f6629+'.'+_0x215166);}}else{_0x4054ea[_0x4689('0x20')](_0x7f6629+'.'+_0x215166);}});return _0x4054ea;}function getSqlClauses(){var _0x292743={'default':squel[_0x4689('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x4689('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x292743;}function parseTagParameter(_0x1e61ea){var _0x5be45b=squel[_0x4689('0x22')]();if(_0x1e61ea){var _0x168c42=utils[_0x4689('0x23')](_0x1e61ea);_0x168c42['forEach'](function(_0x516cd9){_0x5be45b['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x516cd9+',%');});}return _0x5be45b;}function parseSearchFilter(_0x401c23){var _0x27e3f9=squel[_0x4689('0x22')]();if(_0x401c23){var _0x1d7ac0=_0x401c23[_0x4689('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1d7ac0['split']('\x20')['length']>0x1){_0x27e3f9['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1d7ac0),null);}else{if(qs[_0x4689('0x25')](_0x1d7ac0)){_0x27e3f9['or'](_0x4689('0x26'),_0x1d7ac0+'%');_0x27e3f9['or']('c.phone\x20LIKE\x20?',_0x1d7ac0+'%');_0x27e3f9['or'](_0x4689('0x27'),_0x1d7ac0+'%');_0x27e3f9['or'](_0x4689('0x28'),_0x1d7ac0+'%');}else if(qs['isEmail'](_0x1d7ac0)){_0x27e3f9['or'](_0x4689('0x29'),_0x1d7ac0+'%');}else{_0x27e3f9['or'](_0x4689('0x2a'),'%'+_0x1d7ac0+'%');_0x27e3f9['or'](_0x4689('0x2b'),'%'+_0x1d7ac0+'%');_0x27e3f9['or'](_0x4689('0x29'),'%'+_0x1d7ac0+'%');}}}return _0x27e3f9;}function parseAdvancedSearchFilter(_0x3dc6dc,_0x434df9){var _0x2d6634=getSqlClauses();var _0x47246e=as[_0x4689('0x2c')](_0x3dc6dc);var _0x1ff70f=_0x47246e[_0x4689('0x2d')];for(var _0x229951=0x0;_0x229951<_0x47246e[_0x4689('0x2e')][_0x4689('0x2f')];_0x229951++){var _0x2461f4=_0x47246e[_0x4689('0x2e')][_0x229951];var _0x5dd8aa='c';var _0x54a9bd=_[_0x4689('0x30')](_0x434df9,[_0x4689('0x31'),_0x2461f4[_0x4689('0x20')]]);if(_0x54a9bd){if(_0x2461f4[_0x4689('0x20')]===_0x4689('0x32')||_0x54a9bd[_0x4689('0x33')]==='datetime'){_0x2461f4['castTo']='DATE';}var _0x5c55e1=as[_0x4689('0x34')](_0x5dd8aa,_0x54a9bd[_0x4689('0x35')],_0x2461f4);_0x2d6634[_0x4689('0x36')][_0x1ff70f](_0x5c55e1[_0x4689('0x37')],_0x5c55e1['value'][_0x4689('0x38')],_0x5c55e1[_0x4689('0x39')]['end']);}else{if(_0x2461f4['field']===_0x4689('0x3a')){var _0x2faa3e=_0x2461f4[_0x4689('0x39')][_0x4689('0x3b')](',')['map'](function(_0x268bfe){return Number(_0x268bfe);});var _0x6c5011=parseTagParameter(_0x2faa3e);_0x2d6634[_0x4689('0x3c')][_0x4689('0x3d')][_0x4689('0x3e')](_0x6c5011);_0x2d6634[_0x4689('0x3c')]['ids']=_0x2faa3e;}else if(_0x2461f4['field']==='User'){_0x2d6634[_0x4689('0x3f')][_0x4689('0x3d')][_0x4689('0x3e')](_0x4689('0x40'),_0x2461f4[_0x4689('0x39')]);_0x2d6634[_0x4689('0x3f')]['skip']=!![];}}}return _0x2d6634;}function parseModelFields(_0x137bec,_0xf57655){var _0x319f5e=squel[_0x4689('0x22')]();var _0x307555=_(_0x137bec)['keys']()[_0x4689('0x41')](function(_0x5a3503){return _[_0x4689('0x42')](_0xf57655,[_0x4689('0x31'),_0x5a3503])?_0x5a3503:undefined;})[_0x4689('0x43')]()['value']();if(_0x137bec[_0x4689('0x44')]){_0x307555[_0x4689('0x45')]('Contact');}if(_0x307555[_0x4689('0x2f')]>0x0){_0x307555[_0x4689('0x1f')](function(_0x573b94){if(_0x573b94===_0x4689('0x8')){_0x319f5e[_0x4689('0x3e')]('c.ListId\x20IN\x20?',[][_0x4689('0x46')](_0x137bec[_0x573b94]));}else if(_0x573b94===_0x4689('0x44')){var _0x482862='%'+_0x137bec[_0x573b94]+'%';_0x319f5e[_0x4689('0x3e')](_0x4689('0x47'),_0x482862);}else{_0x319f5e[_0x4689('0x3e')]('c.'+_0x573b94+_0x4689('0x48'),_0x137bec[_0x573b94]);}});}return _0x319f5e;}function parseQueryParameters(_0x3844d2,_0xf1bfb7){var _0x1bac00=getSqlClauses();return Promise[_0x4689('0x49')]()[_0x4689('0x4a')](function(){return parseModelFields(_0x3844d2,_0xf1bfb7);})[_0x4689('0x4a')](function(_0x1de5fd){_0x1bac00[_0x4689('0x4b')][_0x4689('0x3e')](_0x1de5fd);return parseTagParameter(_0x3844d2[_0x4689('0x4c')]);})[_0x4689('0x4a')](function(_0x6580c5){_0x1bac00[_0x4689('0x3c')]['clause'][_0x4689('0x3e')](_0x6580c5);return parseSearchFilter(_0x3844d2[_0x4689('0x4d')]);})[_0x4689('0x4a')](function(_0x582f70){_0x1bac00[_0x4689('0x4d')]=_0x582f70;return _0x1bac00;});}function checkListsRestrictions(_0x12c32f,_0x3eec82,_0xe84866){var _0x399480=squel[_0x4689('0x22')]();return Promise[_0x4689('0x49')]()[_0x4689('0x4a')](function(){if(_0x3eec82[_0x4689('0x7')]&&_0x12c32f[_0x4689('0x5')]===_0x4689('0x6')&&!_0xe84866){return _0x12c32f[_0x4689('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x4689('0x4a')](function(_0x3be818){if(_0x3be818){if(_0x3be818[_0x4689('0x2f')]===0x0){_0x399480['and'](_0x4689('0x4f'));}else{_0x399480[_0x4689('0x3e')]('c.ListId\x20IN\x20?',_[_0x4689('0x41')](_0x3be818,'id'));}}})[_0x4689('0x4a')](function(){return _0x399480;});}function buildContactsQuery(_0x8e8ebd,_0x5a5480,_0x9c2f82,_0x4c89c8,_0x2c0b81,_0x52fbb2){if(_0x5a5480){_0x5a5480=_0x9c2f82[_0x4689('0x50')];}_0x8e8ebd=addFieldsToQuery(_0x8e8ebd,_0x5a5480,_0x4c89c8,_0x52fbb2,!![]);var _0x5ba1ad=squel[_0x4689('0xb')]();_0x5ba1ad=addFieldsToQuery(_0x5ba1ad,_0x5a5480,_0x4c89c8,_0x52fbb2,![]);if(_0x4c89c8||_0x52fbb2){_0x8e8ebd=applyJoinClauses(_0x8e8ebd,!![]);_0x8e8ebd[_0x4689('0x51')](_0x4689('0x52'));if(_0x9c2f82['limit']){_0x5ba1ad[_0x4689('0x53')](_0x9c2f82['limit']);}if(_0x9c2f82[_0x4689('0x54')]){_0x5ba1ad[_0x4689('0x54')](_0x9c2f82[_0x4689('0x54')]);}}else{_0x5ba1ad=applyJoinClauses(_0x5ba1ad,![]);_0x5ba1ad[_0x4689('0x51')](_0x4689('0x55'));if(_0x9c2f82[_0x4689('0x53')]){_0x8e8ebd[_0x4689('0x53')](_0x9c2f82['limit']);}if(_0x9c2f82[_0x4689('0x54')]){_0x8e8ebd[_0x4689('0x54')](_0x9c2f82[_0x4689('0x54')]);}}_0x5ba1ad[_0x4689('0x56')](_0x2c0b81);if(_0x9c2f82[_0x4689('0x57')]){_0x9c2f82['order'][_0x4689('0x1f')](function(_0x4269f7){_0x8e8ebd[_0x4689('0x57')]('c.'+_0x4269f7[0x0],_0x4269f7[0x1]===_0x4689('0x58')?![]:!![]);_0x5ba1ad[_0x4689('0x57')]('subqry.'+_0x4269f7[0x0],_0x4269f7[0x1]===_0x4689('0x58')?![]:!![]);});}_0x5ba1ad[_0x4689('0x59')](_0x8e8ebd,_0x4689('0x16'));return _0x5ba1ad;}function getFilteredContacts(_0x5a17c5){var _0x827dc6=[];return db[_0x4689('0x3a')][_0x4689('0x5a')]({'attributes':['id',_0x4689('0x31'),_0x4689('0x5b')],'raw':!![]})[_0x4689('0x4a')](function(_0x3487ac){_0x827dc6=_[_0x4689('0x5c')](_0x3487ac,'id');var _0x2f94c6={'type':db[_0x4689('0x5d')][_0x4689('0x5e')][_0x4689('0x5f')],'model':db[_0x4689('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4689('0x61')][_0x4689('0x62')](_0x5a17c5['toString'](),_0x2f94c6);})[_0x4689('0x4a')](function(_0x253a23){_0x253a23['forEach'](function(_0x7dee6e){if(_0x7dee6e['TagIds']){_0x7dee6e['Tags']=[];_0x7dee6e[_0x4689('0x1d')][_0x4689('0x3b')](',')[_0x4689('0x1f')](function(_0xc3f011){_0x7dee6e[_0x4689('0x63')]['push'](_0x827dc6[_0xc3f011]);});}delete _0x7dee6e[_0x4689('0x1d')];});return _0x253a23;});}function countFilteredContacts(_0x1b8b7d,_0x20e04f){var _0x285c01=_0x1b8b7d[_0x4689('0x64')]();_0x285c01['field'](_0x4689('0x65'));_0x285c01=applyJoinClauses(_0x285c01,!![]);_0x1b8b7d[_0x4689('0x51')](_0x4689('0x52'));var _0x20092c=utils[_0x4689('0x23')](_0x20e04f);if(!_[_0x4689('0x66')](_0x20092c)){_0x285c01['where'](_0x4689('0x67'),_0x20092c);}var _0x1719e2={'type':db[_0x4689('0x5d')][_0x4689('0x5e')][_0x4689('0x5f')],'raw':!![]};return db[_0x4689('0x61')][_0x4689('0x62')](_0x285c01[_0x4689('0x68')](),_0x1719e2)[_0x4689('0x4a')](function(_0x3f33dd){return _0x3f33dd[0x0][_0x4689('0x65')];});}module[_0x4689('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x6f64=['tag','filter','getLists','c.ListId\x20IN\x20?','attributes','group','limit','offset','subqry.id','order','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?','COUNT(*)','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','buildExpression','default','text','value','start','end','map','and','tags','ids','User','user','clause','uc.UserId\x20=\x20?','skip','keys','compact','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x6f64,0x88));var _0x46f6=function(_0x5ccfa9,_0x415e4d){_0x5ccfa9=_0x5ccfa9-0x0;var _0x228ced=_0x6f64[_0x5ccfa9];return _0x228ced;};'use strict';var _=require(_0x46f6('0x0'));var squel=require('squel');var as=require(_0x46f6('0x1'));var qs=require(_0x46f6('0x2'));var utils=require(_0x46f6('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x38d8c5,_0x49b935){var _0x1f57de=![];if(_0x38d8c5[_0x46f6('0x4')]===_0x46f6('0x5')&&!_0x49b935[_0x46f6('0x6')]&&!_0x49b935[_0x46f6('0x7')]&&_0x49b935[_0x46f6('0x8')]!==_0x46f6('0x9')){_0x1f57de=!![];}return _0x1f57de;}function getContactsSubquery(){return squel[_0x46f6('0xa')]()[_0x46f6('0xb')](_0x46f6('0xc'),'c')[_0x46f6('0xd')](_0x46f6('0xe'));}function applyJoinClauses(_0x5715cd,_0x5e02f3){var _0x6a3ceb=_0x5e02f3?'c':_0x46f6('0xf');_0x5715cd[_0x46f6('0x10')](_0x46f6('0x11'),'uc',_0x46f6('0x12')+_0x6a3ceb+_0x46f6('0x13'))[_0x46f6('0x10')](_0x46f6('0x14'),'ct',_0x46f6('0x15')+_0x6a3ceb+_0x46f6('0x13'))[_0x46f6('0x10')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x5715cd;}function addFieldsToQuery(_0x2fa86e,_0x27f8e6,_0x19fb3d,_0x509c36,_0x4d6ae5){var _0x52d87f=_0x4d6ae5?'c':_0x46f6('0xf');if(!_0x27f8e6){_0x27f8e6=['id','firstName',_0x46f6('0x16'),_0x46f6('0x17'),_0x46f6('0x18'),_0x46f6('0x19'),'email',_0x46f6('0x7'),_0x46f6('0x1a'),_0x46f6('0x1b'),_0x46f6('0x1c'),'deletedAt',_0x46f6('0x1d')];}else if(!_0x27f8e6[_0x46f6('0x1e')]('id')){_0x27f8e6[_0x46f6('0x1f')]('id');}var _0x29f3d1=_0x19fb3d&&_0x4d6ae5||!_0x19fb3d&&!_0x4d6ae5;if(_0x509c36){_0x29f3d1=_0x509c36&&_0x4d6ae5||!_0x509c36&&!_0x4d6ae5;}_0x27f8e6[_0x46f6('0x20')](function(_0x22578d){if(_0x22578d===_0x46f6('0x1d')){if(_0x29f3d1){_0x2fa86e['field'](_0x46f6('0x21'),_0x22578d);}else if(_0x19fb3d||_0x509c36){_0x2fa86e['field'](_0x52d87f+'.'+_0x22578d);}}else{_0x2fa86e[_0x46f6('0x22')](_0x52d87f+'.'+_0x22578d);}});return _0x2fa86e;}function getSqlClauses(){var _0xcc8955={'default':squel[_0x46f6('0x23')](),'fields':squel['expr'](),'filter':squel[_0x46f6('0x23')](),'tags':{'clause':squel[_0x46f6('0x23')](),'ids':null},'user':{'clause':squel[_0x46f6('0x23')](),'skip':![]}};return _0xcc8955;}function parseTagParameter(_0x12b415){var _0x5022f2=squel[_0x46f6('0x23')]();if(_0x12b415){var _0x53baef=utils[_0x46f6('0x24')](_0x12b415);_0x53baef[_0x46f6('0x20')](function(_0x5c8c1e){_0x5022f2['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c8c1e+',%');});}return _0x5022f2;}function parseSearchFilter(_0x301469){var _0x53bbb9=squel[_0x46f6('0x23')]();if(_0x301469){var _0x472f29=_0x301469[_0x46f6('0x25')]('\x5c','\x5c\x5c')[_0x46f6('0x25')](/'/g,'\x27\x27');if(_0x472f29[_0x46f6('0x26')]('\x20')[_0x46f6('0x27')]>0x1){_0x53bbb9['or'](_0x46f6('0x28'),qs[_0x46f6('0x29')](_0x472f29),null);}else{if(qs[_0x46f6('0x2a')](_0x472f29)){_0x53bbb9['or'](_0x46f6('0x2b'),_0x472f29+'%');_0x53bbb9['or'](_0x46f6('0x2c'),_0x472f29+'%');_0x53bbb9['or'](_0x46f6('0x2d'),_0x472f29+'%');_0x53bbb9['or']('c.fax\x20LIKE\x20?',_0x472f29+'%');}else if(qs['isEmail'](_0x472f29)){_0x53bbb9['or'](_0x46f6('0x2e'),_0x472f29+'%');}else{_0x53bbb9['or'](_0x46f6('0x2f'),'%'+_0x472f29+'%');_0x53bbb9['or'](_0x46f6('0x30'),'%'+_0x472f29+'%');_0x53bbb9['or'](_0x46f6('0x2e'),'%'+_0x472f29+'%');}}}return _0x53bbb9;}function parseAdvancedSearchFilter(_0x499b3a,_0x4b6911){var _0x5cbb5c=getSqlClauses();var _0x2c4130=as[_0x46f6('0x31')](_0x499b3a);var _0x37925d=_0x2c4130[_0x46f6('0x32')];for(var _0x3158ed=0x0;_0x3158ed<_0x2c4130[_0x46f6('0x33')]['length'];_0x3158ed++){var _0x58e84c=_0x2c4130[_0x46f6('0x33')][_0x3158ed];var _0xd1639f='c';var _0x1ce49f=_[_0x46f6('0x34')](_0x4b6911,[_0x46f6('0x35'),_0x58e84c[_0x46f6('0x22')]]);if(_0x1ce49f){if(_0x58e84c[_0x46f6('0x22')]===_0x46f6('0x36')||_0x1ce49f[_0x46f6('0x37')]==='datetime'){_0x58e84c['castTo']='DATE';}var _0x8969d4=as[_0x46f6('0x38')](_0xd1639f,_0x1ce49f['type'],_0x58e84c);_0x5cbb5c[_0x46f6('0x39')][_0x37925d](_0x8969d4[_0x46f6('0x3a')],_0x8969d4[_0x46f6('0x3b')][_0x46f6('0x3c')],_0x8969d4[_0x46f6('0x3b')][_0x46f6('0x3d')]);}else{if(_0x58e84c[_0x46f6('0x22')]==='Tag'){var _0x1a8e33=_0x58e84c[_0x46f6('0x3b')][_0x46f6('0x26')](',')[_0x46f6('0x3e')](function(_0x104ddb){return Number(_0x104ddb);});var _0x20991d=parseTagParameter(_0x1a8e33);_0x5cbb5c['tags']['clause'][_0x46f6('0x3f')](_0x20991d);_0x5cbb5c[_0x46f6('0x40')][_0x46f6('0x41')]=_0x1a8e33;}else if(_0x58e84c[_0x46f6('0x22')]===_0x46f6('0x42')){_0x5cbb5c[_0x46f6('0x43')][_0x46f6('0x44')]['and'](_0x46f6('0x45'),_0x58e84c['value']);_0x5cbb5c[_0x46f6('0x43')][_0x46f6('0x46')]=!![];}}}return _0x5cbb5c;}function parseModelFields(_0x36686f,_0x1b0eed){var _0x103785=squel['expr']();var _0x3e5bad=_(_0x36686f)[_0x46f6('0x47')]()[_0x46f6('0x3e')](function(_0xdc446a){return _['some'](_0x1b0eed,[_0x46f6('0x35'),_0xdc446a])?_0xdc446a:undefined;})[_0x46f6('0x48')]()['value']();if(_0x36686f['Contact']){_0x3e5bad[_0x46f6('0x1f')]('Contact');}if(_0x3e5bad[_0x46f6('0x27')]>0x0){_0x3e5bad[_0x46f6('0x20')](function(_0x22d9b4){if(_0x22d9b4===_0x46f6('0x7')){_0x103785[_0x46f6('0x3f')]('c.ListId\x20IN\x20?',[][_0x46f6('0x49')](_0x36686f[_0x22d9b4]));}else if(_0x22d9b4===_0x46f6('0x4a')){var _0x26fa9b='%'+_0x36686f[_0x22d9b4]+'%';_0x103785['and'](_0x46f6('0x4b'),_0x26fa9b);}else{_0x103785[_0x46f6('0x3f')]('c.'+_0x22d9b4+_0x46f6('0x4c'),_0x36686f[_0x22d9b4]);}});}return _0x103785;}function parseQueryParameters(_0x29488d,_0x2b102a){var _0x16f994=getSqlClauses();return Promise[_0x46f6('0x4d')]()[_0x46f6('0x4e')](function(){return parseModelFields(_0x29488d,_0x2b102a);})[_0x46f6('0x4e')](function(_0x2c7ff5){_0x16f994[_0x46f6('0x4f')]['and'](_0x2c7ff5);return parseTagParameter(_0x29488d[_0x46f6('0x50')]);})['then'](function(_0x424bdc){_0x16f994[_0x46f6('0x40')]['clause'][_0x46f6('0x3f')](_0x424bdc);return parseSearchFilter(_0x29488d['filter']);})['then'](function(_0x5ca5e7){_0x16f994[_0x46f6('0x51')]=_0x5ca5e7;return _0x16f994;});}function checkListsRestrictions(_0x41939,_0x4b4b77,_0x10fafe){var _0x285fcd=squel[_0x46f6('0x23')]();return Promise['resolve']()[_0x46f6('0x4e')](function(){if(_0x4b4b77[_0x46f6('0x6')]&&_0x41939[_0x46f6('0x4')]===_0x46f6('0x5')&&!_0x10fafe){return _0x41939[_0x46f6('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x46f6('0x4e')](function(_0x493957){if(_0x493957){if(_0x493957[_0x46f6('0x27')]===0x0){_0x285fcd[_0x46f6('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x285fcd['and'](_0x46f6('0x53'),_[_0x46f6('0x3e')](_0x493957,'id'));}}})[_0x46f6('0x4e')](function(){return _0x285fcd;});}function buildContactsQuery(_0x5678a7,_0x56d368,_0x4c3add,_0x594e65,_0x3071fa,_0x3b1e25){if(_0x56d368){_0x56d368=_0x4c3add[_0x46f6('0x54')];}_0x5678a7=addFieldsToQuery(_0x5678a7,_0x56d368,_0x594e65,_0x3b1e25,!![]);var _0x21e559=squel[_0x46f6('0xa')]();_0x21e559=addFieldsToQuery(_0x21e559,_0x56d368,_0x594e65,_0x3b1e25,![]);if(_0x594e65||_0x3b1e25){_0x5678a7=applyJoinClauses(_0x5678a7,!![]);_0x5678a7[_0x46f6('0x55')]('c.id');if(_0x4c3add[_0x46f6('0x56')]){_0x21e559[_0x46f6('0x56')](_0x4c3add[_0x46f6('0x56')]);}if(_0x4c3add['offset']){_0x21e559[_0x46f6('0x57')](_0x4c3add[_0x46f6('0x57')]);}}else{_0x21e559=applyJoinClauses(_0x21e559,![]);_0x21e559['group'](_0x46f6('0x58'));if(_0x4c3add[_0x46f6('0x56')]){_0x5678a7[_0x46f6('0x56')](_0x4c3add['limit']);}if(_0x4c3add[_0x46f6('0x57')]){_0x5678a7[_0x46f6('0x57')](_0x4c3add[_0x46f6('0x57')]);}}_0x21e559['having'](_0x3071fa);if(_0x4c3add['order']){_0x4c3add[_0x46f6('0x59')]['forEach'](function(_0x5d0678){_0x5678a7[_0x46f6('0x59')]('c.'+_0x5d0678[0x0],_0x5d0678[0x1]===_0x46f6('0x5a')?![]:!![]);_0x21e559[_0x46f6('0x59')]('subqry.'+_0x5d0678[0x0],_0x5d0678[0x1]===_0x46f6('0x5a')?![]:!![]);});}_0x21e559[_0x46f6('0xb')](_0x5678a7,_0x46f6('0xf'));return _0x21e559;}function getFilteredContacts(_0x1e9407){var _0x13d85d=[];return db[_0x46f6('0x5b')][_0x46f6('0x5c')]({'attributes':['id','name',_0x46f6('0x5d')],'raw':!![]})['then'](function(_0xc277e5){_0x13d85d=_[_0x46f6('0x5e')](_0xc277e5,'id');var _0x4a6974={'type':db[_0x46f6('0x5f')]['QueryTypes'][_0x46f6('0x60')],'model':db[_0x46f6('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x46f6('0x62')][_0x46f6('0x63')](_0x1e9407[_0x46f6('0x64')](),_0x4a6974);})[_0x46f6('0x4e')](function(_0x423e1e){_0x423e1e[_0x46f6('0x20')](function(_0x37e7d7){if(_0x37e7d7[_0x46f6('0x1d')]){_0x37e7d7[_0x46f6('0x65')]=[];_0x37e7d7[_0x46f6('0x1d')][_0x46f6('0x26')](',')[_0x46f6('0x20')](function(_0x2c8afe){_0x37e7d7[_0x46f6('0x65')]['push'](_0x13d85d[_0x2c8afe]);});}delete _0x37e7d7[_0x46f6('0x1d')];});return _0x423e1e;});}function countFilteredContacts(_0x46a91f,_0x1b16ae){var _0x5e99ea=_0x46a91f[_0x46f6('0x66')]();_0x5e99ea[_0x46f6('0x22')]('COUNT(*)');_0x5e99ea=applyJoinClauses(_0x5e99ea,!![]);_0x46a91f[_0x46f6('0x55')](_0x46f6('0x67'));var _0x2ac517=utils[_0x46f6('0x24')](_0x1b16ae);if(!_[_0x46f6('0x68')](_0x2ac517)){_0x5e99ea[_0x46f6('0xd')](_0x46f6('0x69'),_0x2ac517);}var _0x1f7de2={'type':db[_0x46f6('0x5f')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0x46f6('0x63')](_0x5e99ea[_0x46f6('0x64')](),_0x1f7de2)['then'](function(_0x2d8ecc){return _0x2d8ecc[0x0][_0x46f6('0x6a')];});}module[_0x46f6('0x6b')]={'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 4521a70..8652be1 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 _0xa63a=['createReadStream','createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x33de83,_0x5cd14a){var _0x2dc227=function(_0x7a3560){while(--_0x7a3560){_0x33de83['push'](_0x33de83['shift']());}};_0x2dc227(++_0x5cd14a);}(_0xa63a,0x19e));var _0xaa63=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0xa63a[_0x3a607e];return _0x37b106;};'use strict';var crypto=require(_0xaa63('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xaa63('0x1'));var config=require(_0xaa63('0x2'));var logger=require(_0xaa63('0x3'))(_0xaa63('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xaa63('0x5')][_0xaa63('0x6')],'algorithm':_0xaa63('0x7')};const fileOptions={'algorithm':_0xaa63('0x8')};if(config[_0xaa63('0x9')]&&config[_0xaa63('0x9')][_0xaa63('0xa')]){var isSupported=isAlgorithmSupported(config[_0xaa63('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xaa63('0x9')][_0xaa63('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xaa63('0xb')](',\x20');logger[_0xaa63('0xc')](config[_0xaa63('0x9')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x213c44){return AES_SUPPORTED_RX[_0xaa63('0xd')](_0x213c44);}function getSupportedCiphers(){return crypto[_0xaa63('0xe')]()[_0xaa63('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x29602){return getSupportedCiphers()[_0xaa63('0x10')](_0x29602)>-0x1;}function combineOptions(_0x2a50b4){var _0x1c42c9={};for(var _0x2aa84a in fileOptions){if(fileOptions['hasOwnProperty'](_0x2aa84a)){_0x1c42c9[_0x2aa84a]=fileOptions[_0x2aa84a];}}if(_0x2a50b4){for(var _0x23c647 in _0x2a50b4){if(_0x2a50b4[_0xaa63('0x11')](_0x23c647)){_0x1c42c9[_0x23c647]=_0x2a50b4[_0x23c647];}}}return _0x1c42c9;}exports['encryptFile']=function(_0x22a60e,_0x269108,_0x5921ec,_0x321b1d){return new BPromise(function(_0x1ac857,_0x5effdb){_0x321b1d=combineOptions(_0x321b1d);var _0x1bf68c=new Buffer(_0x5921ec);var _0x150504=fs[_0xaa63('0x12')](_0x22a60e);var _0x2ec63c=fs[_0xaa63('0x13')](_0x269108);var _0x10328a=crypto[_0xaa63('0x14')](_0x321b1d['algorithm'],_0x1bf68c);_0x150504['on'](_0xaa63('0x15'),function(_0x53d696){var _0x4761cf=new Buffer(_0x10328a[_0xaa63('0x16')](_0x53d696),'binary');_0x2ec63c[_0xaa63('0x17')](_0x4761cf);});_0x150504['on'](_0xaa63('0x18'),function(){try{var _0x3478a1=new Buffer(_0x10328a[_0xaa63('0x19')]('binary'),_0xaa63('0x1a'));_0x2ec63c[_0xaa63('0x17')](_0x3478a1);_0x2ec63c[_0xaa63('0x18')]();_0x2ec63c['on'](_0xaa63('0x1b'),function(){return _0x1ac857(_0x269108);});}catch(_0x4b8c2e){fs[_0xaa63('0x1c')](_0x269108);return _0x5effdb(_0x4b8c2e);}});});};exports[_0xaa63('0x1d')]=function(_0x541ab3,_0x4750e6,_0x35ce18,_0x1ab3ae){return new BPromise(function(_0xe644fb,_0x14cece){_0x1ab3ae=combineOptions(_0x1ab3ae);var _0x388454=new Buffer(_0x35ce18);var _0xd85af4=fs[_0xaa63('0x12')](_0x541ab3);var _0x3dae47=fs[_0xaa63('0x13')](_0x4750e6);var _0x31c33a=crypto[_0xaa63('0x1e')](_0x1ab3ae[_0xaa63('0xa')],_0x388454);_0xd85af4['on'](_0xaa63('0x15'),function(_0x3248ab){var _0x26b62a=new Buffer(_0x31c33a[_0xaa63('0x16')](_0x3248ab),'binary');_0x3dae47[_0xaa63('0x17')](_0x26b62a);});_0xd85af4['on'](_0xaa63('0x18'),function(){try{var _0x2eb033=new Buffer(_0x31c33a[_0xaa63('0x19')](_0xaa63('0x1a')),_0xaa63('0x1a'));_0x3dae47[_0xaa63('0x17')](_0x2eb033);_0x3dae47[_0xaa63('0x18')]();_0x3dae47['on'](_0xaa63('0x1b'),function(){return _0xe644fb(_0x4750e6);});}catch(_0xbdb3dd){fs[_0xaa63('0x1c')](_0x4750e6);return _0x14cece(_0xbdb3dd);}});});};exports[_0xaa63('0x1f')]=function(_0x1ed0a5,_0x2c0b8e,_0x6df74){var _0x2cb145=_0x6df74||stringOptions[_0xaa63('0xa')];var _0x5db2c1=_0x2c0b8e||stringOptions[_0xaa63('0x20')];var _0x1afcf2=crypto[_0xaa63('0x14')](_0x2cb145,_0x5db2c1);var _0x2e8d35=_0x1afcf2[_0xaa63('0x16')](_0x1ed0a5,_0xaa63('0x21'),_0xaa63('0x22'));_0x2e8d35+=_0x1afcf2[_0xaa63('0x19')](_0xaa63('0x22'));return _0x2e8d35;};exports[_0xaa63('0x23')]=function(_0x4a8bc3,_0x48e13d,_0x1bd123){var _0x580f7a=_0x1bd123||stringOptions[_0xaa63('0xa')];var _0x5a1f2c=_0x48e13d||stringOptions['secret'];var _0x239e93=crypto[_0xaa63('0x1e')](_0x580f7a,_0x5a1f2c);var _0x2d7dc4=_0x239e93[_0xaa63('0x16')](_0x4a8bc3,'base64',_0xaa63('0x21'));_0x2d7dc4+=_0x239e93[_0xaa63('0x19')](_0xaa63('0x21'));return _0x2d7dc4;}; \ No newline at end of file +var _0xc790=['../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createCipher','data','binary','write','end','final','decryptFile','createWriteStream','update','close','unlink','encryptString','utf8','base64','secret','crypto','bluebird'];(function(_0x4c8ce8,_0x10aeee){var _0x1013d6=function(_0x61784a){while(--_0x61784a){_0x4c8ce8['push'](_0x4c8ce8['shift']());}};_0x1013d6(++_0x10aeee);}(_0xc790,0x148));var _0x0c79=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc790[_0x138adb];return _0x1b27f2;};'use strict';var crypto=require(_0x0c79('0x0'));var fs=require('fs');var BPromise=require(_0x0c79('0x1'));var _=require('lodash');var config=require(_0x0c79('0x2'));var logger=require('../../config/logger')(_0x0c79('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0c79('0x4')][_0x0c79('0x5')],'algorithm':_0x0c79('0x6')};const fileOptions={'algorithm':_0x0c79('0x7')};if(config[_0x0c79('0x8')]&&config[_0x0c79('0x8')][_0x0c79('0x9')]){var isSupported=isAlgorithmSupported(config[_0x0c79('0x8')][_0x0c79('0x9')]);if(isSupported){fileOptions[_0x0c79('0x9')]=config['encrypt'][_0x0c79('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0c79('0xa')](config['encrypt']['algorithm'],_0x0c79('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x512390){return AES_SUPPORTED_RX[_0x0c79('0xc')](_0x512390);}function getSupportedCiphers(){return crypto[_0x0c79('0xd')]()[_0x0c79('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x5ea4bd){return getSupportedCiphers()[_0x0c79('0xf')](_0x5ea4bd)>-0x1;}function combineOptions(_0x1b338f){var _0x600362={};for(var _0x24f71c in fileOptions){if(fileOptions[_0x0c79('0x10')](_0x24f71c)){_0x600362[_0x24f71c]=fileOptions[_0x24f71c];}}if(_0x1b338f){for(var _0x746aef in _0x1b338f){if(_0x1b338f[_0x0c79('0x10')](_0x746aef)){_0x600362[_0x746aef]=_0x1b338f[_0x746aef];}}}return _0x600362;}exports['encryptFile']=function(_0x459e68,_0x5b2bba,_0x395197,_0x25ed8d){return new BPromise(function(_0x174372,_0x4db743){_0x25ed8d=combineOptions(_0x25ed8d);var _0x2449d2=new Buffer(_0x395197);var _0x4d9349=fs[_0x0c79('0x11')](_0x459e68);var _0x5095b4=fs['createWriteStream'](_0x5b2bba);var _0x24b433=crypto[_0x0c79('0x12')](_0x25ed8d['algorithm'],_0x2449d2);_0x4d9349['on'](_0x0c79('0x13'),function(_0x112f61){var _0x12343e=new Buffer(_0x24b433['update'](_0x112f61),_0x0c79('0x14'));_0x5095b4[_0x0c79('0x15')](_0x12343e);});_0x4d9349['on'](_0x0c79('0x16'),function(){try{var _0x23a396=new Buffer(_0x24b433[_0x0c79('0x17')](_0x0c79('0x14')),'binary');_0x5095b4[_0x0c79('0x15')](_0x23a396);_0x5095b4[_0x0c79('0x16')]();_0x5095b4['on']('close',function(){return _0x174372(_0x5b2bba);});}catch(_0x174afc){fs['unlink'](_0x5b2bba);return _0x4db743(_0x174afc);}});});};exports[_0x0c79('0x18')]=function(_0x86cac2,_0x1eb369,_0xbed3b3,_0x2e42bb){return new BPromise(function(_0x13e74e,_0x5450f9){_0x2e42bb=combineOptions(_0x2e42bb);var _0x356140=new Buffer(_0xbed3b3);var _0x4aa356=fs[_0x0c79('0x11')](_0x86cac2);var _0x3a8c22=fs[_0x0c79('0x19')](_0x1eb369);var _0x57ce00=crypto['createDecipher'](_0x2e42bb[_0x0c79('0x9')],_0x356140);_0x4aa356['on'](_0x0c79('0x13'),function(_0x4cf727){var _0x325d16=new Buffer(_0x57ce00[_0x0c79('0x1a')](_0x4cf727),_0x0c79('0x14'));_0x3a8c22[_0x0c79('0x15')](_0x325d16);});_0x4aa356['on'](_0x0c79('0x16'),function(){try{var _0x1d1af=new Buffer(_0x57ce00['final'](_0x0c79('0x14')),_0x0c79('0x14'));_0x3a8c22[_0x0c79('0x15')](_0x1d1af);_0x3a8c22['end']();_0x3a8c22['on'](_0x0c79('0x1b'),function(){return _0x13e74e(_0x1eb369);});}catch(_0x28bde4){fs[_0x0c79('0x1c')](_0x1eb369);return _0x5450f9(_0x28bde4);}});});};exports[_0x0c79('0x1d')]=function(_0x25da14,_0x2d70cd,_0x744083){var _0x5ec4d0=_0x744083||stringOptions[_0x0c79('0x9')];var _0x5d2724=_0x2d70cd||stringOptions['secret'];var _0x5131bf=crypto['createCipher'](_0x5ec4d0,_0x5d2724);var _0x4873fb=_0x5131bf['update'](_0x25da14,_0x0c79('0x1e'),_0x0c79('0x1f'));_0x4873fb+=_0x5131bf['final'](_0x0c79('0x1f'));return _0x4873fb;};exports['decryptString']=function(_0x29417e,_0x2cc19a,_0x30055b){var _0x3a74dd=_0x30055b||stringOptions[_0x0c79('0x9')];var _0x20ea90=_0x2cc19a||stringOptions[_0x0c79('0x20')];var _0x542f0f=crypto['createDecipher'](_0x3a74dd,_0x20ea90);var _0x50a8ad=_0x542f0f[_0x0c79('0x1a')](_0x29417e,_0x0c79('0x1f'),'utf8');_0x50a8ad+=_0x542f0f[_0x0c79('0x17')](_0x0c79('0x1e'));return _0x50a8ad;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 66bb4dd..757b9c1 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 _0x033c=['zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.csv','length','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','info','Completed'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x033c,0x95));var _0xc033=function(_0x4272f5,_0x36ca0e){_0x4272f5=_0x4272f5-0x0;var _0x44c8f2=_0x033c[_0x4272f5];return _0x44c8f2;};'use strict';var util=require('util');var path=require(_0xc033('0x0'));var _=require('lodash');var csv=require(_0xc033('0x1'));var fs=require('fs');var BPromise=require(_0xc033('0x2'));var zipdir=require(_0xc033('0x3'));var rimraf=require(_0xc033('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc033('0x5'))[_0xc033('0x6')];var logger=require(_0xc033('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc033('0x8')][0x2]);var QUERY=process[_0xc033('0x8')][0x3];var PATH=process[_0xc033('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x14aa2a,_0x11b9bb){var _0x3d3cf={'status':_0x14aa2a};var _0x550c93={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11b9bb){_0x3d3cf[_0xc033('0x9')]=_0x11b9bb;}return db[_0xc033('0xa')][_0xc033('0xb')](_0x3d3cf,_0x550c93);}function main(){var _0x2f9b2f=0x1388;var _0x52bca9;logger['info'](util[_0xc033('0xc')](_0xc033('0xd'),EXTRACTED_REPORT_ID,_0xc033('0xe')));return db[_0xc033('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc033('0x10'),_0xc033('0x11')]})[_0xc033('0x12')](function(_0x54236f){if(_0x54236f){_0x52bca9=_0x54236f;_0x2f9b2f=_0x52bca9[_0xc033('0x11')]||0x1388;}})['then'](function(){return dbH[_0xc033('0x13')][_0xc033('0x14')](util[_0xc033('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc033('0x13')]['QueryTypes']['SELECT']});})[_0xc033('0x12')](function(_0x410b4c){if(!_0x410b4c[0x0][_0xc033('0x15')]){return analyticExtractedReport(_0xc033('0x16'));}var _0x326b5f=[];var _0x54a3f8=0x0;if(_0x52bca9[_0xc033('0x10')]){if(_0x410b4c&&_0x410b4c['length']){var _0x20378f=_['range'](_0x410b4c[0x0][_0xc033('0x15')]/_0x2f9b2f);var _0x9c707e=Number[_0xc033('0x17')](_0x410b4c[0x0]['num']/_0x2f9b2f)?_0x410b4c[0x0][_0xc033('0x15')]%_0x2f9b2f:0x0;_0x20378f[_0xc033('0x18')](function(_0x48b6e7){if(_0x48b6e7>0x0){_0x54a3f8+=_0x2f9b2f;}_0x326b5f[_0xc033('0x19')](dbH['sequelize'][_0xc033('0x14')](util[_0xc033('0xc')](_0xc033('0x1a'),QUERY,_0x2f9b2f,_0x54a3f8),{'type':dbH['sequelize'][_0xc033('0x1b')][_0xc033('0x1c')]}));});if(_0x9c707e>0x0){_0x54a3f8+=_0x2f9b2f;_0x326b5f[_0xc033('0x19')](dbH[_0xc033('0x13')][_0xc033('0x14')](util[_0xc033('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x9c707e,_0x54a3f8),{'type':dbH[_0xc033('0x13')]['QueryTypes'][_0xc033('0x1c')]}));}}}else{_0x326b5f['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xc033('0x13')][_0xc033('0x1b')][_0xc033('0x1c')]}));}var _0x340b51=path[_0xc033('0x1d')](PATH);var _0x33bad2=path[_0xc033('0x1e')](PATH,_0xc033('0x1f'));var _0x5aaad2=_0x52bca9['split']&&_0x326b5f[_0xc033('0x20')]>0x1;var _0x5d3420=[];if(!fs[_0xc033('0x21')](path[_0xc033('0x22')](_0x340b51,_0x33bad2))&&_0x5aaad2){fs['mkdirSync'](path['join'](_0x340b51,_0x33bad2));}return BPromise[_0xc033('0x23')](_0x326b5f,function(_0x5eb761){_0x5d3420[_0xc033('0x19')](_0x5eb761);})[_0xc033('0x12')](function(){for(var _0x357e40=0x0;_0x357e40<_0x5d3420[_0xc033('0x20')];_0x357e40+=0x1){var _0x255df4;var _0x382f14=_0x5d3420[_0x357e40];if(_0x5aaad2){_0x255df4=path[_0xc033('0x22')](_0x340b51,_0x33bad2,util[_0xc033('0xc')](_0xc033('0x24'),_0x33bad2,_0x357e40,_0xc033('0x25')));}else{_0x255df4=path[_0xc033('0x22')](_0x340b51,util[_0xc033('0xc')](_0xc033('0x26'),_0x33bad2,_0xc033('0x25')));}fs[_0xc033('0x27')](_0x255df4,csv(_0x382f14));}})['then'](function(){if(_0x5aaad2){return new Promise(function(_0x27ba36){zipdir(path[_0xc033('0x22')](_0x340b51,_0x33bad2),{'saveTo':path[_0xc033('0x22')](_0x340b51,util[_0xc033('0xc')](_0xc033('0x26'),_0x33bad2,'zip'))},function(_0x248e5a,_0x2e4e45){rimraf(path['join'](_0x340b51,_0x33bad2),function(){});_0x27ba36(_0xc033('0x28'));});});}})['then'](function(){logger[_0xc033('0x29')](util[_0xc033('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc033('0xe')));return analyticExtractedReport(_0xc033('0x2a'),_0x5aaad2?util[_0xc033('0xc')]('%s.%s',_0x33bad2,_0x5aaad2?_0xc033('0x2b'):'csv'):null);});})[_0xc033('0x2c')](function(_0x281545){logger[_0xc033('0x29')](util[_0xc033('0xc')](_0xc033('0x2d'),EXTRACTED_REPORT_ID,_0xc033('0xe')),util[_0xc033('0x2e')](_0x281545,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xc033('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x610d=['inspect','Failed','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT','num','length','range','forEach','query','push','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x3fdaf2,_0x436630){var _0xa9ea53=function(_0x38c08f){while(--_0x38c08f){_0x3fdaf2['push'](_0x3fdaf2['shift']());}};_0xa9ea53(++_0x436630);}(_0x610d,0xc7));var _0xd610=function(_0x58dd9f,_0x98c5de){_0x58dd9f=_0x58dd9f-0x0;var _0x1c43b3=_0x610d[_0x58dd9f];return _0x1c43b3;};'use strict';var util=require('util');var path=require(_0xd610('0x0'));var _=require(_0xd610('0x1'));var csv=require(_0xd610('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xd610('0x3'));var rimraf=require(_0xd610('0x4'));var db=require(_0xd610('0x5'))['db'];var dbH=require(_0xd610('0x5'))[_0xd610('0x6')];var logger=require(_0xd610('0x7'))(_0xd610('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd610('0x9')][0x2]);var QUERY=process[_0xd610('0x9')][0x3];var PATH=process[_0xd610('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xaccb85,_0x516808){var _0x90b102={'status':_0xaccb85};var _0x5efad4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x516808){_0x90b102[_0xd610('0xa')]=_0x516808;}return db[_0xd610('0xb')][_0xd610('0xc')](_0x90b102,_0x5efad4);}function main(){var _0x5827c2=0x1388;var _0x250d54;logger['info'](util[_0xd610('0xd')](_0xd610('0xe'),EXTRACTED_REPORT_ID,_0xd610('0xf')));return db[_0xd610('0x10')][_0xd610('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd610('0x12'),_0xd610('0x13')]})[_0xd610('0x14')](function(_0x548ef7){if(_0x548ef7){_0x250d54=_0x548ef7;_0x5827c2=_0x250d54['splitSizeCsv']||0x1388;}})[_0xd610('0x14')](function(){return dbH[_0xd610('0x15')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd610('0x15')]['QueryTypes'][_0xd610('0x16')]});})[_0xd610('0x14')](function(_0xcada14){if(!_0xcada14[0x0][_0xd610('0x17')]){return analyticExtractedReport('Empty');}var _0x19d62b=[];var _0x16c7b5=0x0;if(_0x250d54[_0xd610('0x12')]){if(_0xcada14&&_0xcada14[_0xd610('0x18')]){var _0x203d96=_[_0xd610('0x19')](_0xcada14[0x0][_0xd610('0x17')]/_0x5827c2);var _0xcbd5f8=Number['isInteger'](_0xcada14[0x0][_0xd610('0x17')]/_0x5827c2)?_0xcada14[0x0]['num']%_0x5827c2:0x0;_0x203d96[_0xd610('0x1a')](function(_0x4a6368){if(_0x4a6368>0x0){_0x16c7b5+=_0x5827c2;}_0x19d62b['push'](dbH[_0xd610('0x15')][_0xd610('0x1b')](util[_0xd610('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5827c2,_0x16c7b5),{'type':dbH['sequelize']['QueryTypes'][_0xd610('0x16')]}));});if(_0xcbd5f8>0x0){_0x16c7b5+=_0x5827c2;_0x19d62b[_0xd610('0x1c')](dbH[_0xd610('0x15')][_0xd610('0x1b')](util[_0xd610('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xcbd5f8,_0x16c7b5),{'type':dbH['sequelize'][_0xd610('0x1d')][_0xd610('0x16')]}));}}}else{_0x19d62b[_0xd610('0x1c')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x253be0=path[_0xd610('0x1e')](PATH);var _0x49a69b=path[_0xd610('0x1f')](PATH,'.csv');var _0x16bb45=_0x250d54[_0xd610('0x12')]&&_0x19d62b['length']>0x1;var _0x79032a=[];if(!fs[_0xd610('0x20')](path[_0xd610('0x21')](_0x253be0,_0x49a69b))&&_0x16bb45){fs[_0xd610('0x22')](path[_0xd610('0x21')](_0x253be0,_0x49a69b));}return BPromise[_0xd610('0x23')](_0x19d62b,function(_0x131456){_0x79032a['push'](_0x131456);})[_0xd610('0x14')](function(){for(var _0xe28d35=0x0;_0xe28d35<_0x79032a['length'];_0xe28d35+=0x1){var _0x23fdee;var _0x452905=_0x79032a[_0xe28d35];if(_0x16bb45){_0x23fdee=path[_0xd610('0x21')](_0x253be0,_0x49a69b,util[_0xd610('0xd')]('%s%d.%s',_0x49a69b,_0xe28d35,'csv'));}else{_0x23fdee=path['join'](_0x253be0,util[_0xd610('0xd')](_0xd610('0x24'),_0x49a69b,_0xd610('0x25')));}fs[_0xd610('0x26')](_0x23fdee,csv(_0x452905));}})['then'](function(){if(_0x16bb45){return new Promise(function(_0x40c69d){zipdir(path[_0xd610('0x21')](_0x253be0,_0x49a69b),{'saveTo':path[_0xd610('0x21')](_0x253be0,util['format'](_0xd610('0x24'),_0x49a69b,_0xd610('0x27')))},function(_0x297e91,_0x5e698c){rimraf(path[_0xd610('0x21')](_0x253be0,_0x49a69b),function(){});_0x40c69d(_0xd610('0x28'));});});}})[_0xd610('0x14')](function(){logger[_0xd610('0x29')](util[_0xd610('0xd')](_0xd610('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xd610('0x2b'),_0x16bb45?util[_0xd610('0xd')]('%s.%s',_0x49a69b,_0x16bb45?_0xd610('0x27'):'csv'):null);});})[_0xd610('0x2c')](function(_0x29599f){logger[_0xd610('0x29')](util[_0xd610('0xd')](_0xd610('0x2d'),EXTRACTED_REPORT_ID,_0xd610('0xf')),util[_0xd610('0x2e')](_0x29599f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd610('0x2f'));})[_0xd610('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d83d8e4..2d9c367 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 _0x9182=['existsSync','join','mkdirSync','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','length','auto','push','body','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','.pdf'];(function(_0x325e4b,_0x397d2b){var _0x37823a=function(_0x31dfe5){while(--_0x31dfe5){_0x325e4b['push'](_0x325e4b['shift']());}};_0x37823a(++_0x397d2b);}(_0x9182,0x197));var _0x2918=function(_0x527564,_0x2ef404){_0x527564=_0x527564-0x0;var _0x21e8fa=_0x9182[_0x527564];return _0x21e8fa;};'use strict';var _=require(_0x2918('0x0'));var fs=require('fs');var util=require(_0x2918('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x2918('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2918('0x3'));var JSDOM=require(_0x2918('0x4'))[_0x2918('0x5')];var window=new JSDOM('')[_0x2918('0x6')];var BPromise=require(_0x2918('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2918('0x8'))[_0x2918('0x9')];var logger=require(_0x2918('0xa'))(_0x2918('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x2918('0xc')][0x2]);var QUERY=process[_0x2918('0xc')][0x3];var PATH=process[_0x2918('0xc')][0x4];var NAME=process[_0x2918('0xc')][0x5];var FORMAT=_0x2918('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xae0ac,_0x2e0248){var _0x1a91d1={'status':_0xae0ac};var _0x5dd24f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e0248){_0x1a91d1['savename']=_0x2e0248;}return db[_0x2918('0xe')][_0x2918('0xf')](_0x1a91d1,_0x5dd24f);}function getHeaders(_0x5e0588){return _[_0x2918('0x10')](_0x5e0588,function(_0x2f55c6){return{'text':_0x2f55c6,'style':_0x2918('0x11')};});}function getRows(_0x2ed2b8,_0x1aa6ee){return _[_0x2918('0x10')](_0x1aa6ee,function(_0x5b9290){return _(_0x5b9290)[_0x2918('0x12')](_0x2ed2b8)[_0x2918('0x10')](function(_0xbe55f5){return _0xbe55f5?_[_0x2918('0x13')](_0xbe55f5):'';})['value']();});}function createTable(_0x98eb0b,_0x5dd582){var _0x35a3d4={'widths':_['fill'](Array(_0x98eb0b[_0x2918('0x14')]),0x91),'heights':function(_0x5f27ec){return _0x5f27ec===0x0?_0x2918('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x408ffa=getHeaders(_0x98eb0b);_0x35a3d4['body'][_0x2918('0x16')](_0x408ffa);var _0x3780f7=getRows(_0x98eb0b,_0x5dd582);_0x35a3d4[_0x2918('0x17')]=_0x35a3d4[_0x2918('0x17')]['concat'](_0x3780f7);return _0x35a3d4;}function createTables(_0xdd9508){var _0x37a3cc=[];var _0x4e61ce=_[_0x2918('0x18')](Object[_0x2918('0x19')](_0xdd9508[0x0]),0x5);_0x4e61ce[_0x2918('0x1a')](function(_0x309cd6){_0x37a3cc[_0x2918('0x16')](createTable(_0x309cd6,_0xdd9508));});return _0x37a3cc;}function getPDFDocDefinition(_0x40664f){var _0x34e8bb=util[_0x2918('0x1b')](_0x2918('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x2918('0x1d')])[_0x2918('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x1f0642=[];for(var _0x3ae11f=0x0;_0x3ae11f<_0x40664f[_0x2918('0x14')];_0x3ae11f++){var _0x4bb28d=[];if(_0x3ae11f===0x0){_0x4bb28d[_0x2918('0x16')]({'text':_0x34e8bb,'style':'header'});}var _0x223e2b={'table':_0x40664f[_0x3ae11f]};if(_0x3ae11f>0x0){_0x223e2b['pageBreak']=_0x2918('0x1e');_0x223e2b[_0x2918('0x1f')]=[0x0,0x46,0x0,0x0];}_0x4bb28d[_0x2918('0x16')](_0x223e2b);_0x1f0642[_0x2918('0x16')](_0x4bb28d);}return{'pageSize':'A4','pageOrientation':_0x2918('0x20'),'content':_0x1f0642,'footer':function(_0x295c3d,_0x8013b1){return{'text':_0x295c3d[_0x2918('0x13')]()+_0x2918('0x21')+_0x8013b1,'style':_0x2918('0x22')};},'defaultStyle':{'font':_0x2918('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2918('0x24')},'footer':{'alignment':_0x2918('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x140cdf){var _0x106723=0x1388;var _0x5782dd;if(!_0x140cdf[0x0][_0x2918('0x26')]){return analyticExtractedReport(_0x2918('0x27'));}return db[_0x2918('0x28')][_0x2918('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2918('0x2a'),'splitSizePdf']})[_0x2918('0x2b')](function(_0x3166fc){if(_0x3166fc){_0x5782dd=_0x3166fc;_0x106723=_0x5782dd[_0x2918('0x2c')]||0x3e8;}})['then'](function(){var _0x4a8fb9=[];var _0x25325c=0x0;if(_0x5782dd[_0x2918('0x2a')]){if(_0x140cdf&&_0x140cdf[_0x2918('0x14')]){var _0x18eaba=_[_0x2918('0x2d')](_0x140cdf[0x0][_0x2918('0x26')]/_0x106723);var _0xf0da52=Number[_0x2918('0x2e')](_0x140cdf[0x0][_0x2918('0x26')]/_0x106723)?_0x140cdf[0x0][_0x2918('0x26')]%_0x106723:0x0;_0x18eaba[_0x2918('0x1a')](function(_0x49ffdf){if(_0x49ffdf>0x0){_0x25325c+=_0x106723;}_0x4a8fb9[_0x2918('0x16')](dbH['sequelize'][_0x2918('0x2f')](util['format'](_0x2918('0x30'),QUERY,_0x106723,_0x25325c),{'type':dbH[_0x2918('0x31')][_0x2918('0x32')]['SELECT']}));});if(_0xf0da52>0x0){_0x25325c+=_0x106723;_0x4a8fb9['push'](dbH[_0x2918('0x31')][_0x2918('0x2f')](util[_0x2918('0x1b')](_0x2918('0x30'),QUERY,_0xf0da52,_0x25325c),{'type':dbH['sequelize']['QueryTypes'][_0x2918('0x33')]}));}}}else{_0x4a8fb9['push'](dbH[_0x2918('0x31')][_0x2918('0x2f')](QUERY,{'type':dbH[_0x2918('0x31')][_0x2918('0x32')][_0x2918('0x33')]}));}var _0x1c93d6=path['dirname'](PATH);var _0x22a500=path['basename'](PATH,_0x2918('0x34'));var _0x4acdb0=_0x5782dd[_0x2918('0x2a')]&&_0x4a8fb9[_0x2918('0x14')]>0x1;var _0x58c81b=[];if(!fs[_0x2918('0x35')](path[_0x2918('0x36')](_0x1c93d6,_0x22a500))&&_0x4acdb0){fs[_0x2918('0x37')](path[_0x2918('0x36')](_0x1c93d6,_0x22a500));}return BPromise['each'](_0x4a8fb9,function(_0x502a09){_0x58c81b[_0x2918('0x16')](_0x502a09);})[_0x2918('0x2b')](function(){var _0x37bcf1=[];for(var _0x1b5077=0x0;_0x1b5077<_0x58c81b[_0x2918('0x14')];_0x1b5077+=0x1){var _0x104919=_0x58c81b[_0x1b5077];var _0x37fd19=createTables(_['flatten'](_0x104919));var _0x1bd198;var _0x460012=getPDFDocDefinition(_0x37fd19);var _0x230205=getPDFPrinter();var _0x220179=_0x230205[_0x2918('0x38')](_0x460012);if(_0x4acdb0){_0x1bd198=path[_0x2918('0x36')](_0x1c93d6,_0x22a500,util[_0x2918('0x1b')](_0x2918('0x39'),_0x22a500,_0x1b5077,_0x2918('0x3a')));}else{_0x1bd198=path[_0x2918('0x36')](_0x1c93d6,util[_0x2918('0x1b')]('%s.%s',_0x22a500,'pdf'));}_0x37bcf1[_0x2918('0x16')](writePDFDocument(_0x220179,_0x1bd198));}return Promise[_0x2918('0x3b')](_0x37bcf1);})[_0x2918('0x2b')](function(){if(_0x4acdb0){return new Promise(function(_0x3c9fe3){zipdir(path[_0x2918('0x36')](_0x1c93d6,_0x22a500),{'saveTo':path['join'](_0x1c93d6,util['format'](_0x2918('0x3c'),_0x22a500,'zip'))},function(){rimraf(path['join'](_0x1c93d6,_0x22a500),function(){});_0x3c9fe3(_0x2918('0x3d'));});});}})['then'](function(){if(!_0x4acdb0)return;rimraf(path[_0x2918('0x36')](_0x1c93d6,_0x22a500),function(){});})[_0x2918('0x2b')](function(){logger[_0x2918('0x3e')](util[_0x2918('0x1b')](_0x2918('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x2918('0x40'),_0x4acdb0?util['format'](_0x2918('0x3c'),_0x22a500,_0x4acdb0?_0x2918('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2918('0x3e')](util[_0x2918('0x1b')](_0x2918('0x42'),EXTRACTED_REPORT_ID,_0x2918('0x43')));return db[_0x2918('0xe')][_0x2918('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2918('0x2b')](function(_0x47622a){EXTRACTED_REPORT=_0x47622a;return dbH[_0x2918('0x31')][_0x2918('0x2f')](util['format'](_0x2918('0x45'),QUERY),{'type':dbH[_0x2918('0x31')][_0x2918('0x32')][_0x2918('0x33')]});})['then'](extractReport)[_0x2918('0x46')](function(_0x46244e){logger[_0x2918('0x3e')](util[_0x2918('0x1b')](_0x2918('0x47'),EXTRACTED_REPORT_ID,_0x2918('0x43')),util[_0x2918('0x48')](_0x46244e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2918('0x49'));})[_0x2918('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0xe9c82a=new PdfPrinter({'Arial':{'normal':__dirname+_0x2918('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x2918('0x4c'),'bolditalics':__dirname+_0x2918('0x4d')}});return _0xe9c82a;}function getPDFDocDefinitionFromHTML(_0x4e9b5f,_0x2199b9){var _0x255b37=util[_0x2918('0x1b')](_0x2918('0x4e'),_0x2199b9[_0x2918('0x4f')],_0x2199b9[_0x2918('0x50')]);var _0x867f9a=moment()[_0x2918('0x1b')](_0x2918('0x51'))['toString']();var _0x30f364=htmlToPdfmake(_0x4e9b5f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x30f364],'defaultStyle':{'font':_0x2918('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2918('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2918('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2918('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x2918('0x53')}];},'footer':function(_0x4a7c58,_0x4f5696){return[{'text':util['format'](_0x2918('0x54'),_0x255b37,_0x4a7c58,_0x4f5696,_0x867f9a),'style':_0x2918('0x22')}];}};}function writePDFDocument(_0x1489cd,_0x4ba212){return new Promise(function(_0x288654,_0x354484){var _0x12afff=_0x1489cd[_0x2918('0x55')](fs[_0x2918('0x56')](_0x4ba212));_0x12afff['on'](_0x2918('0x57'),function(){_0x288654(_0x2918('0x57'));});_0x12afff['on'](_0x2918('0x58'),function(_0x3af69d){_0x354484(_0x3af69d);});_0x1489cd[_0x2918('0x59')]();});}exports[_0x2918('0x5a')]=function(_0x4fe136,_0x23a51f){var _0x448684=getPDFPrinter();var _0xec6f32=getPDFDocDefinitionFromHTML(_0x4fe136,_0x23a51f);var _0x7cd8e0=_0x448684[_0x2918('0x38')](_0xec6f32);return writePDFDocument(_0x7cd8e0,_0x23a51f[_0x2918('0x5b')])[_0x2918('0x46')](function(_0x57a74e){throw _0x57a74e;});}; \ No newline at end of file +var _0xb7dc=['html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','toString','\x20/\x20','Arial','black','right','num','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','zip','zip\x20finished','info','PDF','Completed','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment'];(function(_0x2409cd,_0x5724e4){var _0x4b2062=function(_0x5900a3){while(--_0x5900a3){_0x2409cd['push'](_0x2409cd['shift']());}};_0x4b2062(++_0x5724e4);}(_0xb7dc,0x171));var _0xcb7d=function(_0xba9e18,_0xaf8681){_0xba9e18=_0xba9e18-0x0;var _0x5c37b3=_0xb7dc[_0xba9e18];return _0x5c37b3;};'use strict';var _=require(_0xcb7d('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xcb7d('0x1'));var moment=require(_0xcb7d('0x2'));var htmlToPdfmake=require(_0xcb7d('0x3'));var PdfPrinter=require(_0xcb7d('0x4'));var zipdir=require(_0xcb7d('0x5'));var rimraf=require(_0xcb7d('0x6'));var JSDOM=require('jsdom')[_0xcb7d('0x7')];var window=new JSDOM('')[_0xcb7d('0x8')];var BPromise=require(_0xcb7d('0x9'));var db=require(_0xcb7d('0xa'))['db'];var dbH=require('../../mysqldb')[_0xcb7d('0xb')];var logger=require(_0xcb7d('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcb7d('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d172f,_0x59085c){var _0x13d101={'status':_0x3d172f};var _0x411afc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59085c){_0x13d101[_0xcb7d('0xe')]=_0x59085c;}return db[_0xcb7d('0xf')][_0xcb7d('0x10')](_0x13d101,_0x411afc);}function getHeaders(_0x4c45c0){return _['map'](_0x4c45c0,function(_0x22ba5f){return{'text':_0x22ba5f,'style':_0xcb7d('0x11')};});}function getRows(_0x187848,_0x3f3e53){return _[_0xcb7d('0x12')](_0x3f3e53,function(_0x3a3f0a){return _(_0x3a3f0a)[_0xcb7d('0x13')](_0x187848)['map'](function(_0x16e64b){return _0x16e64b?_['toString'](_0x16e64b):'';})['value']();});}function createTable(_0x5d1061,_0x801325){var _0x5a1a84={'widths':_[_0xcb7d('0x14')](Array(_0x5d1061[_0xcb7d('0x15')]),0x91),'heights':function(_0x3762b7){return _0x3762b7===0x0?_0xcb7d('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3b4819=getHeaders(_0x5d1061);_0x5a1a84['body'][_0xcb7d('0x17')](_0x3b4819);var _0xe62371=getRows(_0x5d1061,_0x801325);_0x5a1a84['body']=_0x5a1a84[_0xcb7d('0x18')][_0xcb7d('0x19')](_0xe62371);return _0x5a1a84;}function createTables(_0x321862){var _0x2ee04c=[];var _0x4cfc7a=_[_0xcb7d('0x1a')](Object[_0xcb7d('0x1b')](_0x321862[0x0]),0x5);_0x4cfc7a[_0xcb7d('0x1c')](function(_0x55c648){_0x2ee04c[_0xcb7d('0x17')](createTable(_0x55c648,_0x321862));});return _0x2ee04c;}function getPDFDocDefinition(_0x456b99){var _0x51d310=util[_0xcb7d('0x1d')](_0xcb7d('0x1e'),NAME,EXTRACTED_REPORT[_0xcb7d('0x1f')],moment(EXTRACTED_REPORT[_0xcb7d('0x20')])[_0xcb7d('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xcb7d('0x1d')](FORMAT));var _0x34e110=[];for(var _0x52ae92=0x0;_0x52ae92<_0x456b99['length'];_0x52ae92++){var _0x11dd0a=[];if(_0x52ae92===0x0){_0x11dd0a[_0xcb7d('0x17')]({'text':_0x51d310,'style':_0xcb7d('0x21')});}var _0x4967c9={'table':_0x456b99[_0x52ae92]};if(_0x52ae92>0x0){_0x4967c9[_0xcb7d('0x22')]=_0xcb7d('0x23');_0x4967c9[_0xcb7d('0x24')]=[0x0,0x46,0x0,0x0];}_0x11dd0a[_0xcb7d('0x17')](_0x4967c9);_0x34e110[_0xcb7d('0x17')](_0x11dd0a);}return{'pageSize':'A4','pageOrientation':_0xcb7d('0x25'),'content':_0x34e110,'footer':function(_0x79b6dd,_0x4aa394){return{'text':_0x79b6dd[_0xcb7d('0x26')]()+_0xcb7d('0x27')+_0x4aa394,'style':'footer'};},'defaultStyle':{'font':_0xcb7d('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xcb7d('0x29')},'footer':{'alignment':_0xcb7d('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4edad7){var _0x52b47c=0x1388;var _0x28b789;if(!_0x4edad7[0x0][_0xcb7d('0x2b')]){return analyticExtractedReport('Empty');}return db[_0xcb7d('0x2c')][_0xcb7d('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcb7d('0x2e'),_0xcb7d('0x2f')]})[_0xcb7d('0x30')](function(_0x106e6f){if(_0x106e6f){_0x28b789=_0x106e6f;_0x52b47c=_0x28b789[_0xcb7d('0x2f')]||0x3e8;}})['then'](function(){var _0x2d72c7=[];var _0x3f8ed2=0x0;if(_0x28b789[_0xcb7d('0x2e')]){if(_0x4edad7&&_0x4edad7[_0xcb7d('0x15')]){var _0x32672e=_['range'](_0x4edad7[0x0][_0xcb7d('0x2b')]/_0x52b47c);var _0x32f906=Number[_0xcb7d('0x31')](_0x4edad7[0x0]['num']/_0x52b47c)?_0x4edad7[0x0][_0xcb7d('0x2b')]%_0x52b47c:0x0;_0x32672e[_0xcb7d('0x1c')](function(_0x260505){if(_0x260505>0x0){_0x3f8ed2+=_0x52b47c;}_0x2d72c7['push'](dbH[_0xcb7d('0x32')][_0xcb7d('0x33')](util[_0xcb7d('0x1d')](_0xcb7d('0x34'),QUERY,_0x52b47c,_0x3f8ed2),{'type':dbH['sequelize']['QueryTypes'][_0xcb7d('0x35')]}));});if(_0x32f906>0x0){_0x3f8ed2+=_0x52b47c;_0x2d72c7[_0xcb7d('0x17')](dbH[_0xcb7d('0x32')][_0xcb7d('0x33')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x32f906,_0x3f8ed2),{'type':dbH[_0xcb7d('0x32')][_0xcb7d('0x36')][_0xcb7d('0x35')]}));}}}else{_0x2d72c7[_0xcb7d('0x17')](dbH[_0xcb7d('0x32')][_0xcb7d('0x33')](QUERY,{'type':dbH[_0xcb7d('0x32')][_0xcb7d('0x36')][_0xcb7d('0x35')]}));}var _0x2d37a7=path[_0xcb7d('0x37')](PATH);var _0x4fdc9f=path[_0xcb7d('0x38')](PATH,_0xcb7d('0x39'));var _0x18ba90=_0x28b789['split']&&_0x2d72c7[_0xcb7d('0x15')]>0x1;var _0x30b71a=[];if(!fs[_0xcb7d('0x3a')](path[_0xcb7d('0x3b')](_0x2d37a7,_0x4fdc9f))&&_0x18ba90){fs['mkdirSync'](path['join'](_0x2d37a7,_0x4fdc9f));}return BPromise[_0xcb7d('0x3c')](_0x2d72c7,function(_0x22bb67){_0x30b71a[_0xcb7d('0x17')](_0x22bb67);})[_0xcb7d('0x30')](function(){var _0x333920=[];for(var _0x453dc2=0x0;_0x453dc2<_0x30b71a[_0xcb7d('0x15')];_0x453dc2+=0x1){var _0xf76879=_0x30b71a[_0x453dc2];var _0x44f151=createTables(_[_0xcb7d('0x3d')](_0xf76879));var _0x364866;var _0x266c63=getPDFDocDefinition(_0x44f151);var _0x4837b4=getPDFPrinter();var _0x138cb4=_0x4837b4[_0xcb7d('0x3e')](_0x266c63);if(_0x18ba90){_0x364866=path[_0xcb7d('0x3b')](_0x2d37a7,_0x4fdc9f,util[_0xcb7d('0x1d')](_0xcb7d('0x3f'),_0x4fdc9f,_0x453dc2,_0xcb7d('0x40')));}else{_0x364866=path[_0xcb7d('0x3b')](_0x2d37a7,util['format']('%s.%s',_0x4fdc9f,_0xcb7d('0x40')));}_0x333920[_0xcb7d('0x17')](writePDFDocument(_0x138cb4,_0x364866));}return Promise[_0xcb7d('0x41')](_0x333920);})[_0xcb7d('0x30')](function(){if(_0x18ba90){return new Promise(function(_0x4e8337){zipdir(path[_0xcb7d('0x3b')](_0x2d37a7,_0x4fdc9f),{'saveTo':path[_0xcb7d('0x3b')](_0x2d37a7,util[_0xcb7d('0x1d')]('%s.%s',_0x4fdc9f,_0xcb7d('0x42')))},function(){rimraf(path[_0xcb7d('0x3b')](_0x2d37a7,_0x4fdc9f),function(){});_0x4e8337(_0xcb7d('0x43'));});});}})[_0xcb7d('0x30')](function(){if(!_0x18ba90)return;rimraf(path['join'](_0x2d37a7,_0x4fdc9f),function(){});})[_0xcb7d('0x30')](function(){logger[_0xcb7d('0x44')](util[_0xcb7d('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xcb7d('0x45')));return analyticExtractedReport(_0xcb7d('0x46'),_0x18ba90?util[_0xcb7d('0x1d')](_0xcb7d('0x47'),_0x4fdc9f,_0x18ba90?_0xcb7d('0x42'):_0xcb7d('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xcb7d('0x44')](util['format'](_0xcb7d('0x48'),EXTRACTED_REPORT_ID,_0xcb7d('0x45')));return db[_0xcb7d('0xf')][_0xcb7d('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xcb7d('0x30')](function(_0x30adae){EXTRACTED_REPORT=_0x30adae;return dbH[_0xcb7d('0x32')][_0xcb7d('0x33')](util[_0xcb7d('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcb7d('0x32')][_0xcb7d('0x36')][_0xcb7d('0x35')]});})[_0xcb7d('0x30')](extractReport)[_0xcb7d('0x4a')](function(_0x529d28){logger[_0xcb7d('0x44')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x529d28,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb7d('0x4b'));})[_0xcb7d('0x4c')](function(){process[_0xcb7d('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b397c=new PdfPrinter({'Arial':{'normal':__dirname+_0xcb7d('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xcb7d('0x4f'),'bolditalics':__dirname+_0xcb7d('0x50')}});return _0x3b397c;}function getPDFDocDefinitionFromHTML(_0x18dd20,_0x46c5ca){var _0x8f81dc=util[_0xcb7d('0x1d')]('%s\x20#%d',_0x46c5ca[_0xcb7d('0x51')],_0x46c5ca['interactionId']);var _0x300fe5=moment()[_0xcb7d('0x1d')](_0xcb7d('0x52'))['toString']();var _0x1e7f7e=htmlToPdfmake(_0x18dd20,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e7f7e],'defaultStyle':{'font':_0xcb7d('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xcb7d('0x53'),'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':_0xcb7d('0x54'),'style':_0xcb7d('0x21')}];},'footer':function(_0xedcc7d,_0x307820){return[{'text':util['format'](_0xcb7d('0x55'),_0x8f81dc,_0xedcc7d,_0x307820,_0x300fe5),'style':_0xcb7d('0x56')}];}};}function writePDFDocument(_0x5f43ec,_0x2e72a9){return new Promise(function(_0x5ccc8b,_0x1ae58d){var _0x329204=_0x5f43ec[_0xcb7d('0x57')](fs[_0xcb7d('0x58')](_0x2e72a9));_0x329204['on'](_0xcb7d('0x59'),function(){_0x5ccc8b(_0xcb7d('0x59'));});_0x329204['on'](_0xcb7d('0x5a'),function(_0x41f304){_0x1ae58d(_0x41f304);});_0x5f43ec[_0xcb7d('0x5b')]();});}exports[_0xcb7d('0x5c')]=function(_0x5e0b7f,_0x3c441f){var _0x4e72a7=getPDFPrinter();var _0x50c7a4=getPDFDocDefinitionFromHTML(_0x5e0b7f,_0x3c441f);var _0x33e02d=_0x4e72a7[_0xcb7d('0x3e')](_0x50c7a4);return writePDFDocument(_0x33e02d,_0x3c441f[_0xcb7d('0x1')])[_0xcb7d('0x4a')](function(_0x3ff717){throw _0x3ff717;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 95880bb..7b71a3c 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 _0xc357=['update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','sequelize','format','SELECT','Empty','length','isInteger','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xc357,0x8b));var _0x7c35=function(_0x432582,_0x5d8c3e){_0x432582=_0x432582-0x0;var _0x495ffa=_0xc357[_0x432582];return _0x495ffa;};'use strict';var util=require('util');var path=require(_0x7c35('0x0'));var _=require(_0x7c35('0x1'));var fs=require('fs');var json2xls=require(_0x7c35('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x7c35('0x3'));var rimraf=require(_0x7c35('0x4'));var db=require(_0x7c35('0x5'))['db'];var dbH=require(_0x7c35('0x5'))[_0x7c35('0x6')];var logger=require(_0x7c35('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7c35('0x8')][0x2]);var QUERY=process[_0x7c35('0x8')][0x3];var PATH=process[_0x7c35('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbb6ea2,_0x2829ad){var _0x2acfc9={'status':_0xbb6ea2};var _0x41f223={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2829ad){_0x2acfc9[_0x7c35('0x9')]=_0x2829ad;}return db[_0x7c35('0xa')][_0x7c35('0xb')](_0x2acfc9,_0x41f223);}function main(){var _0x396614=0x1388;var _0x3b40c5;logger['info'](util['format'](_0x7c35('0xc'),EXTRACTED_REPORT_ID,_0x7c35('0xd')));return db[_0x7c35('0xe')][_0x7c35('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7c35('0x10'),'splitSizeXlsx']})[_0x7c35('0x11')](function(_0x42c62b){if(_0x42c62b){_0x3b40c5=_0x42c62b;_0x396614=_0x3b40c5['splitSizeXlsx']||0x1388;}})[_0x7c35('0x11')](function(){return dbH[_0x7c35('0x12')]['query'](util[_0x7c35('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x7c35('0x12')]['QueryTypes'][_0x7c35('0x14')]});})[_0x7c35('0x11')](function(_0x145bab){if(!_0x145bab[0x0]['num']){return analyticExtractedReport(_0x7c35('0x15'));}var _0x2cd21c=[];var _0x181636=0x0;if(_0x3b40c5[_0x7c35('0x10')]){if(_0x145bab&&_0x145bab[_0x7c35('0x16')]){var _0x54df0=_['range'](_0x145bab[0x0]['num']/_0x396614);var _0x1f8976=Number[_0x7c35('0x17')](_0x145bab[0x0][_0x7c35('0x18')]/_0x396614)?_0x145bab[0x0][_0x7c35('0x18')]%_0x396614:0x0;_0x54df0[_0x7c35('0x19')](function(_0x3a3de9){if(_0x3a3de9>0x0){_0x181636+=_0x396614;}_0x2cd21c[_0x7c35('0x1a')](dbH[_0x7c35('0x12')][_0x7c35('0x1b')](util[_0x7c35('0x13')](_0x7c35('0x1c'),QUERY,_0x396614,_0x181636),{'type':dbH[_0x7c35('0x12')][_0x7c35('0x1d')][_0x7c35('0x14')]}));});if(_0x1f8976>0x0){_0x181636+=_0x396614;_0x2cd21c[_0x7c35('0x1a')](dbH[_0x7c35('0x12')][_0x7c35('0x1b')](util[_0x7c35('0x13')](_0x7c35('0x1c'),QUERY,_0x1f8976,_0x181636),{'type':dbH[_0x7c35('0x12')][_0x7c35('0x1d')][_0x7c35('0x14')]}));}}}else{_0x2cd21c[_0x7c35('0x1a')](dbH[_0x7c35('0x12')][_0x7c35('0x1b')](QUERY,{'type':dbH[_0x7c35('0x12')]['QueryTypes'][_0x7c35('0x14')]}));}var _0x5ee458=path['dirname'](PATH);var _0x49ce4b=path['basename'](PATH,_0x7c35('0x1e'));var _0x106dbd=_0x3b40c5[_0x7c35('0x10')]&&_0x2cd21c[_0x7c35('0x16')]>0x1;var _0x3135b0=[];if(!fs[_0x7c35('0x1f')](path[_0x7c35('0x20')](_0x5ee458,_0x49ce4b))&&_0x106dbd){fs[_0x7c35('0x21')](path[_0x7c35('0x20')](_0x5ee458,_0x49ce4b));}return BPromise[_0x7c35('0x22')](_0x2cd21c,function(_0x2ca7c3){_0x3135b0[_0x7c35('0x1a')](_0x2ca7c3);})[_0x7c35('0x11')](function(){for(var _0x184767=0x0;_0x184767<_0x3135b0[_0x7c35('0x16')];_0x184767+=0x1){var _0x2002b8;var _0x4b4829=_0x3135b0[_0x184767];if(_0x106dbd){_0x2002b8=path[_0x7c35('0x20')](_0x5ee458,_0x49ce4b,util['format'](_0x7c35('0x23'),_0x49ce4b,_0x184767,_0x7c35('0x24')));}else{_0x2002b8=path['join'](_0x5ee458,util[_0x7c35('0x13')](_0x7c35('0x25'),_0x49ce4b,_0x7c35('0x24')));}fs[_0x7c35('0x26')](_0x2002b8,json2xls(_0x4b4829),_0x7c35('0x27'));}})[_0x7c35('0x11')](function(){if(_0x106dbd){return new Promise(function(_0x352887){zipdir(path[_0x7c35('0x20')](_0x5ee458,_0x49ce4b),{'saveTo':path['join'](_0x5ee458,util[_0x7c35('0x13')](_0x7c35('0x25'),_0x49ce4b,_0x7c35('0x28')))},function(_0x4de152,_0x3d48f8){rimraf(path[_0x7c35('0x20')](_0x5ee458,_0x49ce4b),function(){});_0x352887(_0x7c35('0x29'));});});}})[_0x7c35('0x11')](function(){logger[_0x7c35('0x2a')](util[_0x7c35('0x13')](_0x7c35('0x2b'),EXTRACTED_REPORT_ID,_0x7c35('0xd')));return analyticExtractedReport(_0x7c35('0x2c'),_0x106dbd?util[_0x7c35('0x13')](_0x7c35('0x25'),_0x49ce4b,_0x106dbd?_0x7c35('0x28'):_0x7c35('0x24')):null);});})[_0x7c35('0x2d')](function(_0x46fc9e){logger[_0x7c35('0x2a')](util['format'](_0x7c35('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x7c35('0x2f')](_0x46fc9e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7c35('0x30')](function(){process[_0x7c35('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5e74=['finally','exit','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x48ce6f,_0xfc2d57){var _0x1ce871=function(_0x203f92){while(--_0x203f92){_0x48ce6f['push'](_0x48ce6f['shift']());}};_0x1ce871(++_0xfc2d57);}(_0x5e74,0xd2));var _0x45e7=function(_0x1d0aed,_0x4077dd){_0x1d0aed=_0x1d0aed-0x0;var _0xecf2bc=_0x5e74[_0x1d0aed];return _0xecf2bc;};'use strict';var util=require('util');var path=require(_0x45e7('0x0'));var _=require(_0x45e7('0x1'));var fs=require('fs');var json2xls=require(_0x45e7('0x2'));var BPromise=require(_0x45e7('0x3'));var zipdir=require(_0x45e7('0x4'));var rimraf=require('rimraf');var db=require(_0x45e7('0x5'))['db'];var dbH=require(_0x45e7('0x5'))[_0x45e7('0x6')];var logger=require(_0x45e7('0x7'))(_0x45e7('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x45e7('0x9')][0x3];var PATH=process[_0x45e7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a7393,_0x4f84f7){var _0x315ff1={'status':_0x1a7393};var _0xf45a66={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f84f7){_0x315ff1[_0x45e7('0xa')]=_0x4f84f7;}return db[_0x45e7('0xb')]['update'](_0x315ff1,_0xf45a66);}function main(){var _0x3477be=0x1388;var _0x547d9e;logger['info'](util[_0x45e7('0xc')](_0x45e7('0xd'),EXTRACTED_REPORT_ID,_0x45e7('0xe')));return db[_0x45e7('0xf')][_0x45e7('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x45e7('0x11'),'splitSizeXlsx']})['then'](function(_0x5b399d){if(_0x5b399d){_0x547d9e=_0x5b399d;_0x3477be=_0x547d9e[_0x45e7('0x12')]||0x1388;}})[_0x45e7('0x13')](function(){return dbH[_0x45e7('0x14')][_0x45e7('0x15')](util[_0x45e7('0xc')](_0x45e7('0x16'),QUERY),{'type':dbH[_0x45e7('0x14')][_0x45e7('0x17')]['SELECT']});})[_0x45e7('0x13')](function(_0x352725){if(!_0x352725[0x0][_0x45e7('0x18')]){return analyticExtractedReport(_0x45e7('0x19'));}var _0x27d0ed=[];var _0x1974d7=0x0;if(_0x547d9e[_0x45e7('0x11')]){if(_0x352725&&_0x352725[_0x45e7('0x1a')]){var _0x1bdd88=_[_0x45e7('0x1b')](_0x352725[0x0]['num']/_0x3477be);var _0x37d2e9=Number[_0x45e7('0x1c')](_0x352725[0x0][_0x45e7('0x18')]/_0x3477be)?_0x352725[0x0]['num']%_0x3477be:0x0;_0x1bdd88[_0x45e7('0x1d')](function(_0x26a6dd){if(_0x26a6dd>0x0){_0x1974d7+=_0x3477be;}_0x27d0ed['push'](dbH[_0x45e7('0x14')][_0x45e7('0x15')](util[_0x45e7('0xc')](_0x45e7('0x1e'),QUERY,_0x3477be,_0x1974d7),{'type':dbH[_0x45e7('0x14')][_0x45e7('0x17')][_0x45e7('0x1f')]}));});if(_0x37d2e9>0x0){_0x1974d7+=_0x3477be;_0x27d0ed[_0x45e7('0x20')](dbH['sequelize']['query'](util[_0x45e7('0xc')](_0x45e7('0x1e'),QUERY,_0x37d2e9,_0x1974d7),{'type':dbH[_0x45e7('0x14')]['QueryTypes'][_0x45e7('0x1f')]}));}}}else{_0x27d0ed[_0x45e7('0x20')](dbH[_0x45e7('0x14')]['query'](QUERY,{'type':dbH[_0x45e7('0x14')][_0x45e7('0x17')][_0x45e7('0x1f')]}));}var _0x862b8c=path[_0x45e7('0x21')](PATH);var _0x41b26e=path[_0x45e7('0x22')](PATH,'.xlsx');var _0x11b457=_0x547d9e[_0x45e7('0x11')]&&_0x27d0ed[_0x45e7('0x1a')]>0x1;var _0x1e0b1c=[];if(!fs['existsSync'](path[_0x45e7('0x23')](_0x862b8c,_0x41b26e))&&_0x11b457){fs[_0x45e7('0x24')](path[_0x45e7('0x23')](_0x862b8c,_0x41b26e));}return BPromise[_0x45e7('0x25')](_0x27d0ed,function(_0xb38672){_0x1e0b1c['push'](_0xb38672);})[_0x45e7('0x13')](function(){for(var _0x3af185=0x0;_0x3af185<_0x1e0b1c[_0x45e7('0x1a')];_0x3af185+=0x1){var _0x453d0e;var _0x3f34d6=_0x1e0b1c[_0x3af185];if(_0x11b457){_0x453d0e=path[_0x45e7('0x23')](_0x862b8c,_0x41b26e,util['format'](_0x45e7('0x26'),_0x41b26e,_0x3af185,_0x45e7('0x27')));}else{_0x453d0e=path['join'](_0x862b8c,util[_0x45e7('0xc')](_0x45e7('0x28'),_0x41b26e,_0x45e7('0x27')));}fs[_0x45e7('0x29')](_0x453d0e,json2xls(_0x3f34d6),_0x45e7('0x2a'));}})[_0x45e7('0x13')](function(){if(_0x11b457){return new Promise(function(_0x5caa51){zipdir(path[_0x45e7('0x23')](_0x862b8c,_0x41b26e),{'saveTo':path[_0x45e7('0x23')](_0x862b8c,util[_0x45e7('0xc')](_0x45e7('0x28'),_0x41b26e,_0x45e7('0x2b')))},function(_0x275e56,_0x1923e){rimraf(path[_0x45e7('0x23')](_0x862b8c,_0x41b26e),function(){});_0x5caa51(_0x45e7('0x2c'));});});}})[_0x45e7('0x13')](function(){logger[_0x45e7('0x2d')](util[_0x45e7('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x45e7('0x2e'),_0x11b457?util['format'](_0x45e7('0x28'),_0x41b26e,_0x11b457?_0x45e7('0x2b'):_0x45e7('0x27')):null);});})['catch'](function(_0x45ab5b){logger[_0x45e7('0x2d')](util[_0x45e7('0xc')](_0x45e7('0x2f'),EXTRACTED_REPORT_ID,_0x45e7('0xe')),util[_0x45e7('0x30')](_0x45ab5b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x45e7('0x31'));})[_0x45e7('0x32')](function(){process[_0x45e7('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 569f080..1ea2711 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 _0x922c=['custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','exten','filter','queue','playback','extensions','find','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','tag','CDR(tag)=','outbound','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app'];(function(_0x38bf6f,_0x498298){var _0x23b40f=function(_0x2e67c3){while(--_0x2e67c3){_0x38bf6f['push'](_0x38bf6f['shift']());}};_0x23b40f(++_0x498298);}(_0x922c,0x186));var _0xc922=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x922c[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xc922('0x0'));var util=require(_0xc922('0x1'));function rewrite(_0x334071,_0x32465b){var _0x176bfc=this;return _0x334071['models']['Interval'][_0xc922('0x2')]({'raw':!![]})[_0xc922('0x3')](function(_0x12f1c4){_0x176bfc[_0xc922('0x4')]=_0x12f1c4;return _0x334071[_0xc922('0x5')][_0xc922('0x6')]['findAll']({'where':{'IntervalId':_0x32465b[_0xc922('0x7')]},'raw':!![]});})['then'](function(_0x4b5968){return _0x334071['models'][_0xc922('0x6')][_0xc922('0x2')]({'where':{'exten':{'$in':_[_0xc922('0x8')](_['map'](_0x4b5968,_0xc922('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xc922('0x3')](function(_0x32dfdd){var _0x34f159=_[_0xc922('0xa')](_0x32dfdd,{'priority':'1'});var _0x3b3442=_[_0xc922('0xa')](_0x32dfdd,{'isApp':0x1});var _0x367927=_['groupBy'](_0x3b3442,_0xc922('0x9'));var _0x37e36d=[_0xc922('0xb'),_0xc922('0xc')];var _0x1ce0a3=[];var _0x28dc00=[];for(var _0x252724 in _0x367927){if(_0x367927['hasOwnProperty'](_0x252724)){_0x176bfc['priority']=0x2;_0x176bfc[_0xc922('0xd')]=[];_0x176bfc['extension']=_[_0xc922('0xe')](_0x34f159,{'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')]});_0x176bfc['extensions']['push']({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':'Set','appdata':util[_0xc922('0x10')](_0xc922('0x11'),_0x367927[_0x252724][0x0][_0xc922('0xf')]),'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});if(_0x367927[_0x252724][0x0][_0xc922('0xf')]===_0xc922('0x15')){_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0xc922('0x18')+_0x367927[_0x252724][0x0]['VoiceExtensionId'],'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0]['VoiceExtensionId']});}else if(_0x367927[_0x252724][0x0][_0xc922('0xf')]==='outbound'){if(_0x176bfc[_0xc922('0x19')]){_0x176bfc['extensions']['push']({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x17'),'appdata':_0xc922('0x1a')+(_0x176bfc['extension'][_0xc922('0x1b')]?_0xc922('0x1c')+_0x176bfc[_0xc922('0x19')]['cutdigits']+'}':'${EXTEN}'),'context':_0x367927[_0x252724][0x0]['context'],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});}_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x17'),'appdata':_0xc922('0x18')+_0x367927[_0x252724][0x0][_0xc922('0x14')],'context':_0x367927[_0x252724][0x0]['context'],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});var _0x38f803=_0x176bfc[_0xc922('0x13')]++;_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x1d'),'appdata':_0xc922('0x1e')+(_0x38f803+0x2)+_0xc922('0x1f')+(_0x38f803+0x1)+')','context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x38f803,'VoiceExtensionId':_0x367927[_0x252724][0x0]['VoiceExtensionId']});if(_0x176bfc['extension']){_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0x176bfc[_0xc922('0x19')]['cutdigits']?_0xc922('0x20')+_0x176bfc[_0xc922('0x19')]['cutdigits']+'}':_0xc922('0x21'),'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc['priority']++,'VoiceExtensionId':_0x367927[_0x252724][0x0]['VoiceExtensionId']});}_0x176bfc[_0xc922('0xd')]['push']({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0xc922('0x22')+_0x367927[_0x252724][0x0][_0xc922('0x14')],'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});if(_0x176bfc[_0xc922('0x19')]&&_0x176bfc[_0xc922('0x19')][_0xc922('0x23')](_0xc922('0x24'))&&_0x176bfc[_0xc922('0x19')][_0xc922('0x24')]!==_0xc922('0x25')){_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0xc922('0x26'),'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});_0x176bfc['extensions'][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x17'),'appdata':_0xc922('0x27')+_0x176bfc[_0xc922('0x19')][_0xc922('0x24')]||_0xc922('0x28'),'context':_0x367927[_0x252724][0x0]['context'],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc['priority']++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});}}_0x176bfc[_0xc922('0xd')][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0xc922('0x29'),'context':_0x367927[_0x252724][0x0]['context'],'exten':_0x367927[_0x252724][0x0]['exten'],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});_0x176bfc['extensions'][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0][_0xc922('0xf')],'app':'Set','appdata':_0xc922('0x2a'),'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0]['VoiceExtensionId']});_0x176bfc[_0xc922('0xd')]['push']({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x17'),'appdata':_0xc922('0x2b'),'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'priority':_0x176bfc[_0xc922('0x13')]++,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});for(var _0x56b4aa=0x0,_0x4eed63=0x0;_0x56b4aa<_0x367927[_0x252724][_0xc922('0x2c')];_0x56b4aa+=0x1,_0x4eed63=0x0){var _0x114ad5=_0x367927[_0x252724][_0x56b4aa];if(_0x114ad5[_0xc922('0xf')]){_0x114ad5[_0xc922('0xf')]=_0x114ad5[_0xc922('0xf')][_0xc922('0x2d')]();}var _0x586424=[];var _0x3d6f6f=[];delete _0x114ad5['id'];delete _0x114ad5[_0xc922('0x2e')];delete _0x114ad5[_0xc922('0x2f')];var _0x27ce02=_0x114ad5['interval']!==_0xc922('0x30')?[_0x114ad5[_0xc922('0x31')]]:_0x114ad5['IntervalId']?_[_0xc922('0x32')](_[_0xc922('0xa')](_0x176bfc['intervals'],{'IntervalId':_0x114ad5[_0xc922('0x7')]}),_0xc922('0x31')):[];if(_0x114ad5[_0xc922('0x23')]('tag')){if(_0x114ad5[_0xc922('0x33')]&&_0x114ad5[_0xc922('0x33')]!=='--'){_0x586424[_0xc922('0x16')]({'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':_0xc922('0x34')+_0x114ad5[_0xc922('0x33')],'context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02['length']+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});}}if(_0x114ad5[_0xc922('0xf')]===_0xc922('0x35')&&_0x114ad5[_0xc922('0x23')]('callerID')){if(_0x114ad5['callerID']){_0x586424[_0xc922('0x16')]({'type':_0x114ad5['type'],'app':_0xc922('0x1d'),'appdata':_0xc922('0x36')+_0x114ad5[_0xc922('0x37')]+')','context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02[_0xc922('0x2c')]+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});}else{_0x586424[_0xc922('0x16')]({'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x1d'),'appdata':_0xc922('0x38'),'context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02[_0xc922('0x2c')]+_0x176bfc['priority']+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});}}if(_0x114ad5[_0xc922('0x23')](_0xc922('0x39'))){if(_0x37e36d[_0xc922('0x3a')](_0x114ad5[_0xc922('0x3b')][_0xc922('0x2d')]())>=0x0&&_0x114ad5['appType']!==_0xc922('0x3c')){if(_0x114ad5[_0xc922('0x39')]){_0x586424[_0xc922('0x16')]({'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02[_0xc922('0x2c')]+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});_0x586424['push']({'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02[_0xc922('0x2c')]+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});}else{_0x586424[_0xc922('0x16')]({'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x1d'),'appdata':_0xc922('0x3d'),'context':_0x114ad5['context'],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02['length']+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5['VoiceExtensionId']});_0x586424[_0xc922('0x16')]({'type':_0x114ad5[_0xc922('0xf')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x114ad5[_0xc922('0x12')],'exten':_0x114ad5[_0xc922('0x9')],'priority':_0x27ce02[_0xc922('0x2c')]+_0x176bfc[_0xc922('0x13')]+_0x4eed63++,'VoiceExtensionId':_0x114ad5[_0xc922('0x14')]});}}}for(var _0x4a6b2f=0x0;_0x4a6b2f<_0x27ce02[_0xc922('0x2c')];_0x4a6b2f+=0x1){var _0x285c1d=_0x176bfc[_0xc922('0x13')]+_0x27ce02[_0xc922('0x2c')];var _0x12900e=_0x4a6b2f===_0x27ce02[_0xc922('0x2c')]-0x1?_0x176bfc[_0xc922('0x13')]+_0x586424[_0xc922('0x2c')]+_0x3d6f6f[_0xc922('0x2c')]+0x2:_0x176bfc[_0xc922('0x13')]+_0x4a6b2f+0x1;_0x586424[_0xc922('0x3e')](_0x4a6b2f,0x0,{'type':_0x114ad5[_0xc922('0xf')],'app':_0xc922('0x3f'),'appdata':_0x27ce02[_0x4a6b2f]+'?'+_0x114ad5['context']+',${EXTEN},'+_0x285c1d+':'+_0x114ad5[_0xc922('0x12')]+_0xc922('0x40')+_0x12900e,'exten':_0x114ad5[_0xc922('0x9')],'context':_0x114ad5[_0xc922('0x12')],'priority':_0x176bfc[_0xc922('0x13')]+_0x4a6b2f,'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});}_0x114ad5['priority']=_0x586424[_0xc922('0x2c')]?_['last'](_0x586424)[_0xc922('0x13')]+0x1:_0x176bfc[_0xc922('0x13')];_0x176bfc[_0xc922('0x13')]=(_0x3d6f6f[_0xc922('0x2c')]?_[_0xc922('0x41')](_0x3d6f6f)['priority']:_0x114ad5[_0xc922('0x13')])+0x1;_0x176bfc[_0xc922('0xd')]=_[_0xc922('0x42')](_0x176bfc[_0xc922('0xd')],_0x586424,[_0x114ad5],_0x3d6f6f);}_0x176bfc['extensions'][_0xc922('0x16')]({'type':_0x367927[_0x252724][0x0]['type'],'app':_0xc922('0x43'),'exten':_0x367927[_0x252724][0x0][_0xc922('0x9')],'context':_0x367927[_0x252724][0x0][_0xc922('0x12')],'priority':_0x176bfc['priority'],'VoiceExtensionId':_0x367927[_0x252724][0x0][_0xc922('0x14')]});_0x1ce0a3['push'](_0x367927[_0x252724][0x0][_0xc922('0x14')]);_0x28dc00=_[_0xc922('0x42')](_0x28dc00,_0x176bfc[_0xc922('0xd')]);}}return _0x334071[_0xc922('0x44')](function(_0x2c6e41){return _0x334071[_0xc922('0x5')][_0xc922('0x6')][_0xc922('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x1ce0a3}},'transaction':_0x2c6e41})[_0xc922('0x3')](function(_0x5c7b3d){return _0x334071[_0xc922('0x5')][_0xc922('0x6')][_0xc922('0x46')](_[_0xc922('0x47')](_0x28dc00,_0xc922('0x13')),{'transaction':_0x2c6e41});});});})[_0xc922('0x48')](function(_0x420e78){console[_0xc922('0x49')](_0x420e78);});}exports[_0xc922('0x4a')]=rewrite; \ No newline at end of file +var _0x2849=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','map','tag','CDR(tag)=','callerID','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','exten','filter','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x2849,0x1bd));var _0x9284=function(_0x38c1c4,_0x48128e){_0x38c1c4=_0x38c1c4-0x0;var _0x41f79d=_0x2849[_0x38c1c4];return _0x41f79d;};'use strict';var _=require(_0x9284('0x0'));var util=require('util');function rewrite(_0xd0685a,_0x120db6){var _0x2ce258=this;return _0xd0685a['models'][_0x9284('0x1')][_0x9284('0x2')]({'raw':!![]})[_0x9284('0x3')](function(_0x62d3b0){_0x2ce258[_0x9284('0x4')]=_0x62d3b0;return _0xd0685a[_0x9284('0x5')][_0x9284('0x6')][_0x9284('0x2')]({'where':{'IntervalId':_0x120db6[_0x9284('0x7')]},'raw':!![]});})[_0x9284('0x3')](function(_0x375882){return _0xd0685a[_0x9284('0x5')][_0x9284('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x9284('0x8')](_['map'](_0x375882,_0x9284('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x123b07){var _0x51b3ec=_[_0x9284('0xa')](_0x123b07,{'priority':'1'});var _0x197dfe=_['filter'](_0x123b07,{'isApp':0x1});var _0x23d98e=_['groupBy'](_0x197dfe,_0x9284('0x9'));var _0x39077d=[_0x9284('0xb'),_0x9284('0xc')];var _0x3b880b=[];var _0x1901b1=[];for(var _0x35f030 in _0x23d98e){if(_0x23d98e[_0x9284('0xd')](_0x35f030)){_0x2ce258[_0x9284('0xe')]=0x2;_0x2ce258[_0x9284('0xf')]=[];_0x2ce258[_0x9284('0x10')]=_['find'](_0x51b3ec,{'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')]});_0x2ce258['extensions'][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':util[_0x9284('0x14')](_0x9284('0x15'),_0x23d98e[_0x35f030][0x0][_0x9284('0x12')]),'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0]['exten'],'priority':_0x2ce258['priority']++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});if(_0x23d98e[_0x35f030][0x0][_0x9284('0x12')]===_0x9284('0x18')){_0x2ce258[_0x9284('0xf')]['push']({'type':_0x23d98e[_0x35f030][0x0]['type'],'app':_0x9284('0x13'),'appdata':_0x9284('0x19')+_0x23d98e[_0x35f030][0x0][_0x9284('0x17')],'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});}else if(_0x23d98e[_0x35f030][0x0][_0x9284('0x12')]===_0x9284('0x1a')){if(_0x2ce258[_0x9284('0x10')]){_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':_0x9284('0x1b')+(_0x2ce258[_0x9284('0x10')][_0x9284('0x1c')]?'${EXTEN:'+_0x2ce258['extension'][_0x9284('0x1c')]+'}':_0x9284('0x1d')),'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});}_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':_0x9284('0x19')+_0x23d98e[_0x35f030][0x0][_0x9284('0x17')],'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0]['exten'],'priority':_0x2ce258['priority']++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});var _0x4e5ccf=_0x2ce258[_0x9284('0xe')]++;_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x1e'),'appdata':_0x9284('0x1f')+(_0x4e5ccf+0x2)+'):Goto('+(_0x4e5ccf+0x1)+')','context':_0x23d98e[_0x35f030][0x0]['context'],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x4e5ccf,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});if(_0x2ce258[_0x9284('0x10')]){_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':'Set','appdata':_0x2ce258[_0x9284('0x10')][_0x9284('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x2ce258[_0x9284('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0]['exten'],'priority':_0x2ce258['priority']++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});}_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':'Set','appdata':_0x9284('0x20')+_0x23d98e[_0x35f030][0x0]['VoiceExtensionId'],'context':_0x23d98e[_0x35f030][0x0]['context'],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258['priority']++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});if(_0x2ce258[_0x9284('0x10')]&&_0x2ce258[_0x9284('0x10')]['hasOwnProperty'](_0x9284('0x21'))&&_0x2ce258[_0x9284('0x10')][_0x9284('0x21')]!==_0x9284('0x22')){_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':_0x9284('0x23'),'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':'Set','appdata':_0x9284('0x24')+_0x2ce258['extension']['recordingFormat']||_0x9284('0x25'),'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0]['exten'],'priority':_0x2ce258['priority']++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0]['VoiceExtensionId']});}}_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':_0x9284('0x26'),'context':_0x23d98e[_0x35f030][0x0]['context'],'exten':_0x23d98e[_0x35f030][0x0]['exten'],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});_0x2ce258[_0x9284('0xf')][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0]['type'],'app':'Set','appdata':_0x9284('0x27'),'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});_0x2ce258[_0x9284('0xf')]['push']({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x13'),'appdata':_0x9284('0x28'),'context':_0x23d98e[_0x35f030][0x0]['context'],'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'priority':_0x2ce258[_0x9284('0xe')]++,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});for(var _0x887f05=0x0,_0x3a5bf9=0x0;_0x887f05<_0x23d98e[_0x35f030][_0x9284('0x29')];_0x887f05+=0x1,_0x3a5bf9=0x0){var _0x15eb8b=_0x23d98e[_0x35f030][_0x887f05];if(_0x15eb8b[_0x9284('0x12')]){_0x15eb8b['type']=_0x15eb8b[_0x9284('0x12')][_0x9284('0x2a')]();}var _0x3e5567=[];var _0x55678=[];delete _0x15eb8b['id'];delete _0x15eb8b[_0x9284('0x2b')];delete _0x15eb8b[_0x9284('0x2c')];var _0x32eba1=_0x15eb8b[_0x9284('0x2d')]!=='*,*,*,*'?[_0x15eb8b[_0x9284('0x2d')]]:_0x15eb8b[_0x9284('0x7')]?_[_0x9284('0x2e')](_[_0x9284('0xa')](_0x2ce258['intervals'],{'IntervalId':_0x15eb8b['IntervalId']}),_0x9284('0x2d')):[];if(_0x15eb8b[_0x9284('0xd')]('tag')){if(_0x15eb8b[_0x9284('0x2f')]&&_0x15eb8b[_0x9284('0x2f')]!=='--'){_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b['type'],'app':'Set','appdata':_0x9284('0x30')+_0x15eb8b[_0x9284('0x2f')],'context':_0x15eb8b['context'],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b[_0x9284('0x17')]});}}if(_0x15eb8b[_0x9284('0x12')]===_0x9284('0x1a')&&_0x15eb8b['hasOwnProperty']('callerID')){if(_0x15eb8b[_0x9284('0x31')]){_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b[_0x9284('0x12')],'app':_0x9284('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x15eb8b['callerID']+')','context':_0x15eb8b[_0x9284('0x16')],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b[_0x9284('0x17')]});}else{_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b['type'],'app':_0x9284('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x15eb8b['context'],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b[_0x9284('0x17')]});}}if(_0x15eb8b[_0x9284('0xd')](_0x9284('0x32'))){if(_0x39077d['indexOf'](_0x15eb8b[_0x9284('0x33')][_0x9284('0x2a')]())>=0x0&&_0x15eb8b[_0x9284('0x34')]!==_0x9284('0x35')){if(_0x15eb8b[_0x9284('0x32')]){_0x3e5567['push']({'type':_0x15eb8b[_0x9284('0x12')],'app':_0x9284('0x1e'),'appdata':_0x9284('0x36'),'context':_0x15eb8b[_0x9284('0x16')],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1['length']+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b['VoiceExtensionId']});_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b[_0x9284('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x15eb8b[_0x9284('0x16')],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b['VoiceExtensionId']});}else{_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b[_0x9284('0x12')],'app':_0x9284('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x15eb8b[_0x9284('0x16')],'exten':_0x15eb8b['exten'],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b['VoiceExtensionId']});_0x3e5567[_0x9284('0x11')]({'type':_0x15eb8b[_0x9284('0x12')],'app':'Set','appdata':_0x9284('0x37'),'context':_0x15eb8b[_0x9284('0x16')],'exten':_0x15eb8b[_0x9284('0x9')],'priority':_0x32eba1[_0x9284('0x29')]+_0x2ce258[_0x9284('0xe')]+_0x3a5bf9++,'VoiceExtensionId':_0x15eb8b[_0x9284('0x17')]});}}}for(var _0x18abbd=0x0;_0x18abbd<_0x32eba1[_0x9284('0x29')];_0x18abbd+=0x1){var _0x31d102=_0x2ce258[_0x9284('0xe')]+_0x32eba1[_0x9284('0x29')];var _0x58994a=_0x18abbd===_0x32eba1[_0x9284('0x29')]-0x1?_0x2ce258[_0x9284('0xe')]+_0x3e5567['length']+_0x55678[_0x9284('0x29')]+0x2:_0x2ce258[_0x9284('0xe')]+_0x18abbd+0x1;_0x3e5567[_0x9284('0x38')](_0x18abbd,0x0,{'type':_0x15eb8b[_0x9284('0x12')],'app':_0x9284('0x39'),'appdata':_0x32eba1[_0x18abbd]+'?'+_0x15eb8b[_0x9284('0x16')]+',${EXTEN},'+_0x31d102+':'+_0x15eb8b[_0x9284('0x16')]+_0x9284('0x3a')+_0x58994a,'exten':_0x15eb8b[_0x9284('0x9')],'context':_0x15eb8b[_0x9284('0x16')],'priority':_0x2ce258[_0x9284('0xe')]+_0x18abbd,'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});}_0x15eb8b[_0x9284('0xe')]=_0x3e5567[_0x9284('0x29')]?_[_0x9284('0x3b')](_0x3e5567)['priority']+0x1:_0x2ce258[_0x9284('0xe')];_0x2ce258[_0x9284('0xe')]=(_0x55678[_0x9284('0x29')]?_['last'](_0x55678)[_0x9284('0xe')]:_0x15eb8b['priority'])+0x1;_0x2ce258[_0x9284('0xf')]=_[_0x9284('0x3c')](_0x2ce258[_0x9284('0xf')],_0x3e5567,[_0x15eb8b],_0x55678);}_0x2ce258['extensions'][_0x9284('0x11')]({'type':_0x23d98e[_0x35f030][0x0][_0x9284('0x12')],'app':_0x9284('0x3d'),'exten':_0x23d98e[_0x35f030][0x0][_0x9284('0x9')],'context':_0x23d98e[_0x35f030][0x0][_0x9284('0x16')],'priority':_0x2ce258[_0x9284('0xe')],'VoiceExtensionId':_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]});_0x3b880b['push'](_0x23d98e[_0x35f030][0x0][_0x9284('0x17')]);_0x1901b1=_[_0x9284('0x3c')](_0x1901b1,_0x2ce258[_0x9284('0xf')]);}}return _0xd0685a['transaction'](function(_0x1fc17b){return _0xd0685a[_0x9284('0x5')]['VoiceExtension'][_0x9284('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x3b880b}},'transaction':_0x1fc17b})['then'](function(_0x41eb7b){return _0xd0685a[_0x9284('0x5')][_0x9284('0x6')][_0x9284('0x3f')](_[_0x9284('0x40')](_0x1901b1,_0x9284('0xe')),{'transaction':_0x1fc17b});});});})[_0x9284('0x41')](function(_0x215b66){console[_0x9284('0x42')](_0x215b66);});}exports[_0x9284('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6f8c3ab..795522c 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 _0x5912=['duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','scheduledAt','ListId','createdAt','select','field','ContactId','toString','NOW()','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','from','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','outbound','CmList','BlackLists','dialCheckDuplicateType','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!'];(function(_0x22baff,_0x28939d){var _0x47910e=function(_0x36f7d7){while(--_0x36f7d7){_0x22baff['push'](_0x22baff['shift']());}};_0x47910e(++_0x28939d);}(_0x5912,0x1f3));var _0x2591=function(_0x3aa02a,_0x563eb2){_0x3aa02a=_0x3aa02a-0x0;var _0x318eca=_0x5912[_0x3aa02a];return _0x318eca;};'use strict';var BPromise=require(_0x2591('0x0'));var util=require(_0x2591('0x1'));var _=require(_0x2591('0x2'));var fs=require('fs');var squel=require(_0x2591('0x3'));var Papa=require(_0x2591('0x4'));var Redis=require(_0x2591('0x5'));var db=require(_0x2591('0x6'))['db'];var config=require(_0x2591('0x7'));var logger=require('../../../config/logger')(_0x2591('0x8'));config['redis']=_[_0x2591('0x9')](config[_0x2591('0xa')],{'host':_0x2591('0xb'),'port':0x18eb});var socket=require(_0x2591('0xc'))(new Redis(config[_0x2591('0xa')]));require(_0x2591('0xd'))[_0x2591('0xe')](socket);try{if(!process['argv'][0x2]||process[_0x2591('0xf')][0x2]===_0x2591('0x10')||process[_0x2591('0xf')][0x2]===_0x2591('0x11')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x2591('0xf')][0x2];if(!process[_0x2591('0xf')][0x3]||process[_0x2591('0xf')][0x3]===_0x2591('0x10')||process['argv'][0x3]===_0x2591('0x11')||!process['argv'][0x4]||process['argv'][0x4]===_0x2591('0x10')||process[_0x2591('0xf')][0x4]===_0x2591('0x11')){throw new Error(_0x2591('0x12'));}var FIELDS=_[_0x2591('0x13')](process[_0x2591('0xf')][0x3][_0x2591('0x14')](','),process[_0x2591('0xf')][0x4][_0x2591('0x14')](','));if(!process[_0x2591('0xf')][0x5]||process[_0x2591('0xf')][0x5]===_0x2591('0x10')||process[_0x2591('0xf')][0x5]===_0x2591('0x11')){throw new Error(_0x2591('0x15'));}var LISTID=process[_0x2591('0xf')][0x5];var COMPANYID=process[_0x2591('0xf')][0x6]&&process[_0x2591('0xf')][0x6]!==_0x2591('0x10')&&process['argv'][0x6]!==_0x2591('0x11')?process[_0x2591('0xf')][0x6]:null;var DUPLICATES=process[_0x2591('0xf')][0x7]&&process[_0x2591('0xf')][0x7]!==_0x2591('0x10')&&process[_0x2591('0xf')][0x7]!=='null'?process[_0x2591('0xf')][0x7]:null;if(!process[_0x2591('0xf')][0x8]||process[_0x2591('0xf')][0x8]===_0x2591('0x10')||process['argv'][0x8]===_0x2591('0x11')){throw new Error(_0x2591('0x16'));}var SOCKET_TIMESTAMP=process[_0x2591('0xf')][0x8];}catch(_0x328da2){logger[_0x2591('0x17')](_0x328da2);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(_0x4bf0a7,_0x29e983,_0x216021,_0xb87058){var _0x2369c1={'message':_0x29e983};_0x2369c1[_0x4bf0a7]=!![];if(_0x216021){_0x2369c1['contact']=_0x216021;}if(_0xb87058){_0x2369c1['index']=_0xb87058;}return _0x2369c1;}function isEmail(_0x1725bd){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))*$/[_0x2591('0x18')](_0x1725bd);}function checkRow(_0x5311e4,_0x2c3cb7,_0x5d010a){return new BPromise(function(_0x6f6c43,_0x51a68b){if(_[_0x2591('0x19')](_0x5311e4)){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x5d010a));}if(_0x5311e4[_0x2591('0x1a')]&&_0x5311e4[_0x2591('0x1a')][_0x2591('0x1b')]){var _0x9f5a3a=_[_0x2591('0x1c')](_0x5311e4[_0x2591('0x1a')],_0x2591('0x1d'))[_0x2591('0x1e')](';');return _0x51a68b(handleCheckRowError(_0x2591('0x17'),_0x9f5a3a,null,_0x5d010a));}var _0x1e4243={};for(var _0x3da1ad in FIELDS){if(FIELDS[_0x2591('0x1f')](_0x3da1ad)&&FIELDS[_0x3da1ad]){_0x1e4243[_0x3da1ad]=_0x5311e4[_0x2591('0x20')][0x0][FIELDS[_0x3da1ad]]||_0x5311e4[_0x2591('0x20')][0x0]['\ufeff'+FIELDS[_0x3da1ad]];}}if(!_0x1e4243[_0x2591('0x21')]){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),'firstName\x20not\x20specified!',null,_0x5d010a));}if(!_0x1e4243[_0x2591('0x22')]){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),_0x2591('0x23'),null,_0x5d010a));}if(_0x1e4243[_0x2591('0x24')]){var _0x1f31c3=moment(_0x1e4243[_0x2591('0x24')],_0x2591('0x25'));if(!_0x1f31c3[_0x2591('0x26')]()){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5d010a));}}if(_0x1e4243[_0x2591('0x27')]){if(!isEmail(_0x1e4243[_0x2591('0x27')])){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),_0x2591('0x28'),null,_0x5d010a));}}_0x1e4243['ListId']=LISTID;_0x1e4243['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2591('0x1b')]&&_0x2c3cb7){var _0x6ac934={};for(var _0x18617d=0x0,_0x510839=DUPLICATES['length'];_0x18617d<_0x510839;_0x18617d+=0x1){_0x6ac934[DUPLICATES[_0x18617d]]=_0x1e4243[DUPLICATES[_0x18617d]];}var _0x4bca1a=_['find'](_0x2c3cb7,_0x6ac934);if(_0x4bca1a){return _0x51a68b(handleCheckRowError(_0x2591('0x29'),_0x2591('0x2a'),_0x4bca1a,_0x5d010a));}}return db['CmContact']['create'](_0x1e4243,{'raw':!![],'hooks':![],'fields':_[_0x2591('0x2b')](_0x1e4243)})[_0x2591('0x2c')](function(_0x179f58){if(DUPLICATES&&DUPLICATES[_0x2591('0x1b')]&&_0x2c3cb7){_0x2c3cb7[_0x2591('0x2d')](_[_0x2591('0x2e')](_0x1e4243,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x179f58['id'];return _0x6f6c43();})[_0x2591('0x2f')](function(_0x162391){return _0x51a68b(handleCheckRowError(_0x2591('0x17'),_0x2591('0x30')+(_0x162391[_0x2591('0x1d')]||JSON[_0x2591('0x31')](_0x162391)),null,_0x5d010a));});});}function checkHopper(){function _0x4698a0(){return function(_0x178819){logger['error']('cmContact',_0x2591('0x32'),util[_0x2591('0x33')](_0x178819,{'showHidden':![],'depth':null}));};}var _0x18c617=function(_0x29e3e4,_0x3c5949){var _0x22b3d0=squel[_0x2591('0x34')]()[_0x2591('0x35')]('cm_hopper')['fromQuery']([_0x2591('0x22'),_0x2591('0x36'),'ContactId',_0x2591('0x37'),_0x3c5949,_0x2591('0x38'),'updatedAt'],squel[_0x2591('0x39')]()[_0x2591('0x3a')](_0x2591('0x22'),_0x2591('0x22'))[_0x2591('0x3a')]('NOW()','scheduledAt')[_0x2591('0x3a')]('id',_0x2591('0x3b'))[_0x2591('0x3a')](LISTID[_0x2591('0x3c')](),'ListId')[_0x2591('0x3a')](_0x29e3e4['id'][_0x2591('0x3c')](),_0x3c5949)['field'](_0x2591('0x3d'),_0x2591('0x38'))[_0x2591('0x3a')]('NOW()',_0x2591('0x3e'))['from'](_0x2591('0x3f'))[_0x2591('0x40')](_0x2591('0x41'))[_0x2591('0x40')](_0x2591('0x42'),LISTID[_0x2591('0x3c')]())[_0x2591('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x2591('0x40')](_0x2591('0x43'),squel['select']()[_0x2591('0x3a')](_0x2591('0x22'))['from'](_0x2591('0x44'))[_0x2591('0x40')](_0x3c5949+_0x2591('0x45'),_0x29e3e4['id'][_0x2591('0x3c')]())))['toString']();return _0x22b3d0;};var _0x168e9f=function(_0x1d187a,_0x474c28){var _0x5731cb=squel[_0x2591('0x34')]()['into'](_0x2591('0x44'))[_0x2591('0x46')]([_0x2591('0x22'),_0x2591('0x36'),_0x2591('0x3b'),'ListId',_0x474c28,_0x2591('0x38'),_0x2591('0x3e')],squel['select']()[_0x2591('0x3a')](_0x2591('0x22'),'phone')[_0x2591('0x3a')]('NOW()',_0x2591('0x36'))[_0x2591('0x3a')]('id',_0x2591('0x3b'))[_0x2591('0x3a')](LISTID[_0x2591('0x3c')](),_0x2591('0x37'))[_0x2591('0x3a')](_0x1d187a['id'][_0x2591('0x3c')](),_0x474c28)['field'](_0x2591('0x3d'),_0x2591('0x38'))[_0x2591('0x3a')](_0x2591('0x3d'),'updatedAt')[_0x2591('0x47')](_0x2591('0x3f'))['where']('deletedAt\x20IS\x20NULL')[_0x2591('0x40')](_0x2591('0x42'),LISTID[_0x2591('0x3c')]())[_0x2591('0x40')](_0x2591('0x48'),squel[_0x2591('0x49')](hopperContacts))['where'](_0x2591('0x4a'))[_0x2591('0x40')](_0x2591('0x43'),squel['select']()[_0x2591('0x3a')]('calleridnum')[_0x2591('0x47')](_0x2591('0x4b'))[_0x2591('0x40')](_0x474c28+_0x2591('0x45'),_0x1d187a['id'][_0x2591('0x3c')]()))[_0x2591('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2591('0x39')]()[_0x2591('0x3a')](_0x2591('0x22'))[_0x2591('0x47')]('cm_hopper')[_0x2591('0x40')](_0x474c28+'\x20=\x20?',_0x1d187a['id'][_0x2591('0x3c')]())))['toString']();return _0x5731cb;};function _0x2de80f(_0x54cfe6,_0x280817){var _0x2c54ac=squel[_0x2591('0x34')]()[_0x2591('0x35')]('cm_hopper')[_0x2591('0x46')]([_0x2591('0x22'),_0x2591('0x36'),_0x2591('0x3b'),_0x2591('0x37'),_0x280817,_0x2591('0x38'),_0x2591('0x3e')],squel[_0x2591('0x39')]()[_0x2591('0x3a')](_0x2591('0x22'),_0x2591('0x22'))[_0x2591('0x3a')](_0x2591('0x3d'),_0x2591('0x36'))[_0x2591('0x3a')]('id',_0x2591('0x3b'))[_0x2591('0x3a')](LISTID[_0x2591('0x3c')](),_0x2591('0x37'))[_0x2591('0x3a')](_0x54cfe6['id'][_0x2591('0x3c')](),_0x280817)[_0x2591('0x3a')](_0x2591('0x3d'),_0x2591('0x38'))['field'](_0x2591('0x3d'),_0x2591('0x3e'))[_0x2591('0x47')]('cm_contacts')[_0x2591('0x40')](_0x2591('0x41'))[_0x2591('0x40')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x2591('0x48'),squel[_0x2591('0x49')](hopperContacts))[_0x2591('0x40')](_0x2591('0x4a')))[_0x2591('0x3c')]();return _0x2c54ac;}function _0xf07204(_0x64cc59,_0x3c085b){var _0x2d427e=squel['insert']()[_0x2591('0x35')](_0x2591('0x4c'))['fromQuery']([_0x2591('0x22'),_0x2591('0x3b'),_0x2591('0x37'),_0x3c085b,_0x2591('0x38'),_0x2591('0x3e')],squel['select']()[_0x2591('0x3a')](_0x2591('0x22'),_0x2591('0x22'))[_0x2591('0x3a')]('id',_0x2591('0x3b'))[_0x2591('0x3a')](LISTID[_0x2591('0x3c')](),_0x2591('0x37'))[_0x2591('0x3a')](_0x64cc59['id'][_0x2591('0x3c')](),_0x3c085b)['field']('NOW()',_0x2591('0x38'))[_0x2591('0x3a')](_0x2591('0x3d'),'updatedAt')[_0x2591('0x47')]('cm_contacts')[_0x2591('0x40')](_0x2591('0x41'))[_0x2591('0x40')](_0x2591('0x42'),LISTID['toString']())[_0x2591('0x40')](_0x2591('0x48'),squel[_0x2591('0x49')](hopperContacts))[_0x2591('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x2d427e;}return db[_0x2591('0x4d')][_0x2591('0x4e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x2591('0x4f'),'where':{'id':LISTID}}]})[_0x2591('0x2c')](function(_0x3f5a68){var _0x4465c7=[];if(_0x3f5a68){var _0x41a703;for(var _0x395add=0x0,_0x213bfa;_0x395add<_0x3f5a68['length'];_0x395add+=0x1){_0x213bfa=_0x3f5a68[_0x395add][_0x2591('0x50')]({'plain':!![]});switch(_0x213bfa['dialCheckDuplicateType']){case _0x2591('0x51'):_0x4465c7[_0x2591('0x2d')](db['sequelize'][_0x2591('0x52')](_0x168e9f(_0x213bfa,_0x2591('0x53')))[_0x2591('0x2c')](function(){})[_0x2591('0x2f')](_0x4698a0()));break;case _0x2591('0x54'):_0x4465c7[_0x2591('0x2d')](db['sequelize'][_0x2591('0x52')](_0x18c617(_0x213bfa,_0x2591('0x53')))[_0x2591('0x2c')](function(){})['catch'](_0x4698a0()));break;default:_0x4465c7[_0x2591('0x2d')](db[_0x2591('0x55')]['query'](_0x2de80f(_0x213bfa,'VoiceQueueId'))[_0x2591('0x2c')](function(){})[_0x2591('0x2f')](_0x4698a0()));}}}return _0x4465c7;})[_0x2591('0x56')]()[_0x2591('0x2c')](function(){return db[_0x2591('0x4d')][_0x2591('0x4e')]({'where':{'type':_0x2591('0x57')},'attributes':['id'],'include':[{'model':db[_0x2591('0x58')],'as':_0x2591('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x4c6c49){var _0x1ed5a8=[];if(_0x4c6c49){var _0x2d86be;for(var _0xdc7056=0x0,_0x45ef25;_0xdc7056<_0x4c6c49[_0x2591('0x1b')];_0xdc7056+=0x1){_0x45ef25=_0x4c6c49[_0xdc7056]['get']({'plain':!![]});_0x1ed5a8[_0x2591('0x2d')](db[_0x2591('0x55')][_0x2591('0x52')](_0xf07204(_0x45ef25,_0x2591('0x53')))['then'](function(){})[_0x2591('0x2f')](_0x4698a0()));}}return _0x1ed5a8;})[_0x2591('0x56')]();})[_0x2591('0x2c')](function(){return db['Campaign'][_0x2591('0x4e')]({'attributes':['id',_0x2591('0x5a')],'include':[{'model':db[_0x2591('0x58')],'as':_0x2591('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x5bcbd8){var _0x45452d=[];if(_0x5bcbd8){for(var _0x21e732=0x0,_0x37c86f;_0x21e732<_0x5bcbd8[_0x2591('0x1b')];_0x21e732+=0x1){_0x37c86f=_0x5bcbd8[_0x21e732][_0x2591('0x50')]({'plain':!![]});switch(_0x37c86f[_0x2591('0x5a')]){case _0x2591('0x51'):_0x45452d[_0x2591('0x2d')](db['sequelize'][_0x2591('0x52')](_0x168e9f(_0x37c86f,'CampaignId'))[_0x2591('0x2c')](function(){})[_0x2591('0x2f')](_0x4698a0()));break;case _0x2591('0x54'):_0x45452d[_0x2591('0x2d')](db[_0x2591('0x55')][_0x2591('0x52')](_0x18c617(_0x37c86f,_0x2591('0x5b')))['then'](function(){})[_0x2591('0x2f')](_0x4698a0()));break;default:_0x45452d[_0x2591('0x2d')](db[_0x2591('0x55')][_0x2591('0x52')](_0x2de80f(_0x37c86f,_0x2591('0x5b')))[_0x2591('0x2c')](function(){})[_0x2591('0x2f')](_0x4698a0()));}}}return _0x45452d;})['all']();})[_0x2591('0x2c')](function(){return db[_0x2591('0x5c')][_0x2591('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x2591('0x58')],'as':_0x2591('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x5d3fd3){var _0x18aa04=[];if(_0x5d3fd3){for(var _0xe6466f=0x0,_0x26a2ca;_0xe6466f<_0x5d3fd3[_0x2591('0x1b')];_0xe6466f+=0x1){_0x26a2ca=_0x5d3fd3[_0xe6466f][_0x2591('0x50')]({'plain':!![]});_0x18aa04['push'](db[_0x2591('0x55')]['query'](_0xf07204(_0x26a2ca,_0x2591('0x5b')))[_0x2591('0x2c')](function(){})['catch'](_0x4698a0()));}}return _0x18aa04;})[_0x2591('0x56')]();})[_0x2591('0x2f')](function(_0x5507f2){logger[_0x2591('0x17')](_0x2591('0x5d'),_0x2591('0x5e'),_0x5507f2[_0x2591('0x1d')]);});}var processPromises=function(_0x1dadc8){return BPromise[_0x2591('0x56')](promises)['then'](function(_0x525bf8){})[_0x2591('0x2f')](function(_0x1ee6bf){logger[_0x2591('0x17')](_0x2591('0x5f'),JSON[_0x2591('0x31')](_0x1ee6bf));})[_0x2591('0x60')](function(){socket[_0x2591('0x61')](_0x2591('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1dadc8){return _0x1dadc8['resume']();}});};var endCsv=function(){return BPromise[_0x2591('0x63')]()[_0x2591('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x2591('0x2c')](function(){socket['emit'](_0x2591('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x224c24){logger[_0x2591('0x17')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x2591('0x31')](_0x224c24));}finally{process[_0x2591('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0x2591('0x65')](_0x2591('0x66'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2591('0x14')](',');return db[_0x2591('0x67')][_0x2591('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2591('0x2c')](function(_0x196436){var _0x4577e5=fs[_0x2591('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2591('0x69')](_0x4577e5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x459890,_0x7cae46){total+=0x1;var _0x3aff15=total;promises[_0x2591('0x2d')](checkRow(_0x459890,_0x196436,_0x3aff15)[_0x2591('0x2c')](function(){success+=0x1;})[_0x2591('0x2f')](function(_0x1c3574){if(_0x1c3574[_0x2591('0x17')]){errors+=0x1;delete _0x1c3574['error'];}else if(_0x1c3574[_0x2591('0x29')]){duplicates+=0x1;delete _0x1c3574['duplicate'];}rows[_0x2591('0x2d')](_0x1c3574);}));if(total%0xc8===0x0){_0x7cae46['pause']();return processPromises(_0x7cae46);}},'complete':function(){return processPromises()['then'](function(){logger[_0x2591('0x65')](_0x2591('0x6a'));endCsv();});},'error':function(_0x48c8a7,_0x2c7923){logger[_0x2591('0x65')](_0x2591('0x6b'),JSON[_0x2591('0x31')](_0x48c8a7));endCsv();}});})[_0x2591('0x2f')](function(_0x172dec){logger[_0x2591('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x2591('0x31')](_0x172dec));});}main(); \ No newline at end of file +var _0x67cb=['pause','CSV\x20parse\x20error','util','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','keys','then','pick','catch','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','NOW()','toString','createdAt','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','into','from','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','insert','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','get','push','sequelize','VoiceQueueId','onlyIfOpen','outbound','BlackLists','query','all','Campaign','dialCheckDuplicateType','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse'];(function(_0x1d7605,_0x14e4b2){var _0x199c18=function(_0x3080c7){while(--_0x3080c7){_0x1d7605['push'](_0x1d7605['shift']());}};_0x199c18(++_0x14e4b2);}(_0x67cb,0x149));var _0xb67c=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x67cb[_0x36ed3c];return _0x52a2e0;};'use strict';var BPromise=require('bluebird');var util=require(_0xb67c('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xb67c('0x1'));var db=require(_0xb67c('0x2'))['db'];var config=require('../../../config/environment');var logger=require(_0xb67c('0x3'))('api');config[_0xb67c('0x4')]=_[_0xb67c('0x5')](config[_0xb67c('0x4')],{'host':_0xb67c('0x6'),'port':0x18eb});var socket=require(_0xb67c('0x7'))(new Redis(config[_0xb67c('0x4')]));require(_0xb67c('0x8'))[_0xb67c('0x9')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xb67c('0xa')||process[_0xb67c('0xb')][0x2]==='null'){throw new Error(_0xb67c('0xc'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xb67c('0xb')][0x3]===_0xb67c('0xa')||process[_0xb67c('0xb')][0x3]==='null'||!process[_0xb67c('0xb')][0x4]||process[_0xb67c('0xb')][0x4]===_0xb67c('0xa')||process[_0xb67c('0xb')][0x4]===_0xb67c('0xd')){throw new Error(_0xb67c('0xe'));}var FIELDS=_[_0xb67c('0xf')](process[_0xb67c('0xb')][0x3][_0xb67c('0x10')](','),process[_0xb67c('0xb')][0x4][_0xb67c('0x10')](','));if(!process[_0xb67c('0xb')][0x5]||process[_0xb67c('0xb')][0x5]===_0xb67c('0xa')||process[_0xb67c('0xb')][0x5]==='null'){throw new Error(_0xb67c('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xb67c('0xb')][0x6]&&process[_0xb67c('0xb')][0x6]!==_0xb67c('0xa')&&process[_0xb67c('0xb')][0x6]!==_0xb67c('0xd')?process[_0xb67c('0xb')][0x6]:null;var DUPLICATES=process[_0xb67c('0xb')][0x7]&&process['argv'][0x7]!==_0xb67c('0xa')&&process[_0xb67c('0xb')][0x7]!==_0xb67c('0xd')?process[_0xb67c('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xb67c('0xa')||process[_0xb67c('0xb')][0x8]===_0xb67c('0xd')){throw new Error(_0xb67c('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x103f3f){logger[_0xb67c('0x13')](_0x103f3f);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(_0x5b8f59,_0x1bf904,_0x4dfc5d,_0x1ed92b){var _0x5e58ed={'message':_0x1bf904};_0x5e58ed[_0x5b8f59]=!![];if(_0x4dfc5d){_0x5e58ed[_0xb67c('0x14')]=_0x4dfc5d;}if(_0x1ed92b){_0x5e58ed[_0xb67c('0x15')]=_0x1ed92b;}return _0x5e58ed;}function isEmail(_0x26ab27){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))*$/[_0xb67c('0x16')](_0x26ab27);}function checkRow(_0x43c97a,_0x58b00c,_0x681e7e){return new BPromise(function(_0x21c39f,_0x2d7d7a){if(_[_0xb67c('0x17')](_0x43c97a)){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),_0xb67c('0x18'),null,_0x681e7e));}if(_0x43c97a[_0xb67c('0x19')]&&_0x43c97a[_0xb67c('0x19')][_0xb67c('0x1a')]){var _0x24bea8=_[_0xb67c('0x1b')](_0x43c97a['errors'],_0xb67c('0x1c'))[_0xb67c('0x1d')](';');return _0x2d7d7a(handleCheckRowError('error',_0x24bea8,null,_0x681e7e));}var _0x22156b={};for(var _0x306c93 in FIELDS){if(FIELDS[_0xb67c('0x1e')](_0x306c93)&&FIELDS[_0x306c93]){_0x22156b[_0x306c93]=_0x43c97a[_0xb67c('0x1f')][0x0][FIELDS[_0x306c93]]||_0x43c97a[_0xb67c('0x1f')][0x0]['\ufeff'+FIELDS[_0x306c93]];}}if(!_0x22156b[_0xb67c('0x20')]){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),_0xb67c('0x21'),null,_0x681e7e));}if(!_0x22156b[_0xb67c('0x22')]){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),'phone\x20not\x20specified!',null,_0x681e7e));}if(_0x22156b[_0xb67c('0x23')]){var _0x5d91bc=moment(_0x22156b['birthDate'],'YYYY-MM-DD');if(!_0x5d91bc['isValid']()){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x681e7e));}}if(_0x22156b[_0xb67c('0x24')]){if(!isEmail(_0x22156b['email'])){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),_0xb67c('0x25'),null,_0x681e7e));}}_0x22156b['ListId']=LISTID;_0x22156b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb67c('0x1a')]&&_0x58b00c){var _0x5b6d57={};for(var _0x2f6501=0x0,_0x5782b1=DUPLICATES[_0xb67c('0x1a')];_0x2f6501<_0x5782b1;_0x2f6501+=0x1){_0x5b6d57[DUPLICATES[_0x2f6501]]=_0x22156b[DUPLICATES[_0x2f6501]];}var _0x359e15=_[_0xb67c('0x26')](_0x58b00c,_0x5b6d57);if(_0x359e15){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x27'),_0xb67c('0x28'),_0x359e15,_0x681e7e));}}return db['CmContact']['create'](_0x22156b,{'raw':!![],'hooks':![],'fields':_[_0xb67c('0x29')](_0x22156b)})[_0xb67c('0x2a')](function(_0x51fb9c){if(DUPLICATES&&DUPLICATES[_0xb67c('0x1a')]&&_0x58b00c){_0x58b00c['push'](_[_0xb67c('0x2b')](_0x22156b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x51fb9c['id'];return _0x21c39f();})[_0xb67c('0x2c')](function(_0x318767){return _0x2d7d7a(handleCheckRowError(_0xb67c('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x318767[_0xb67c('0x1c')]||JSON[_0xb67c('0x2d')](_0x318767)),null,_0x681e7e));});});}function checkHopper(){function _0x5b4aae(){return function(_0x386e46){logger[_0xb67c('0x13')](_0xb67c('0x2e'),_0xb67c('0x2f'),util[_0xb67c('0x30')](_0x386e46,{'showHidden':![],'depth':null}));};}var _0x18ed7c=function(_0x1fa102,_0x2f1e15){var _0xed62df=squel['insert']()['into'](_0xb67c('0x31'))[_0xb67c('0x32')]([_0xb67c('0x22'),_0xb67c('0x33'),_0xb67c('0x34'),_0xb67c('0x35'),_0x2f1e15,'createdAt','updatedAt'],squel[_0xb67c('0x36')]()[_0xb67c('0x37')](_0xb67c('0x22'),_0xb67c('0x22'))['field'](_0xb67c('0x38'),'scheduledAt')['field']('id',_0xb67c('0x34'))[_0xb67c('0x37')](LISTID[_0xb67c('0x39')](),_0xb67c('0x35'))[_0xb67c('0x37')](_0x1fa102['id'][_0xb67c('0x39')](),_0x2f1e15)[_0xb67c('0x37')]('NOW()',_0xb67c('0x3a'))[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x3b'))['from'](_0xb67c('0x3c'))[_0xb67c('0x3d')](_0xb67c('0x3e'))[_0xb67c('0x3d')](_0xb67c('0x3f'),LISTID[_0xb67c('0x39')]())[_0xb67c('0x3d')](_0xb67c('0x40'))[_0xb67c('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xb67c('0x22'))['from']('cm_hopper')[_0xb67c('0x3d')](_0x2f1e15+'\x20=\x20?',_0x1fa102['id'][_0xb67c('0x39')]())))[_0xb67c('0x39')]();return _0xed62df;};var _0x527c07=function(_0x57c364,_0x3bf3da){var _0x38f3fa=squel['insert']()[_0xb67c('0x41')](_0xb67c('0x31'))[_0xb67c('0x32')]([_0xb67c('0x22'),'scheduledAt',_0xb67c('0x34'),'ListId',_0x3bf3da,_0xb67c('0x3a'),_0xb67c('0x3b')],squel['select']()[_0xb67c('0x37')]('phone',_0xb67c('0x22'))[_0xb67c('0x37')]('NOW()',_0xb67c('0x33'))[_0xb67c('0x37')]('id','ContactId')['field'](LISTID[_0xb67c('0x39')](),'ListId')[_0xb67c('0x37')](_0x57c364['id'][_0xb67c('0x39')](),_0x3bf3da)[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x3a'))[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x3b'))[_0xb67c('0x42')](_0xb67c('0x3c'))['where'](_0xb67c('0x3e'))[_0xb67c('0x3d')](_0xb67c('0x3f'),LISTID[_0xb67c('0x39')]())[_0xb67c('0x3d')](_0xb67c('0x43'),squel[_0xb67c('0x44')](hopperContacts))[_0xb67c('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xb67c('0x45'),squel[_0xb67c('0x36')]()[_0xb67c('0x37')](_0xb67c('0x46'))[_0xb67c('0x42')](_0xb67c('0x47'))[_0xb67c('0x3d')](_0x3bf3da+_0xb67c('0x48'),_0x57c364['id'][_0xb67c('0x39')]()))['where'](_0xb67c('0x45'),squel[_0xb67c('0x36')]()[_0xb67c('0x37')](_0xb67c('0x22'))['from']('cm_hopper')['where'](_0x3bf3da+'\x20=\x20?',_0x57c364['id']['toString']())))[_0xb67c('0x39')]();return _0x38f3fa;};function _0x1eedcd(_0x29478f,_0xd3c175){var _0x2448e7=squel['insert']()[_0xb67c('0x41')]('cm_hopper')[_0xb67c('0x32')]([_0xb67c('0x22'),'scheduledAt',_0xb67c('0x34'),_0xb67c('0x35'),_0xd3c175,_0xb67c('0x3a'),_0xb67c('0x3b')],squel['select']()[_0xb67c('0x37')]('phone',_0xb67c('0x22'))[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x33'))[_0xb67c('0x37')]('id',_0xb67c('0x34'))['field'](LISTID[_0xb67c('0x39')](),'ListId')[_0xb67c('0x37')](_0x29478f['id'][_0xb67c('0x39')](),_0xd3c175)[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x3a'))[_0xb67c('0x37')](_0xb67c('0x38'),_0xb67c('0x3b'))[_0xb67c('0x42')](_0xb67c('0x3c'))[_0xb67c('0x3d')]('deletedAt\x20IS\x20NULL')[_0xb67c('0x3d')](_0xb67c('0x3f'),LISTID[_0xb67c('0x39')]())['where'](_0xb67c('0x43'),squel[_0xb67c('0x44')](hopperContacts))['where'](_0xb67c('0x40')))[_0xb67c('0x39')]();return _0x2448e7;}function _0x5c78e8(_0x145cd4,_0x2573a6){var _0x19536a=squel[_0xb67c('0x49')]()[_0xb67c('0x41')](_0xb67c('0x4a'))[_0xb67c('0x32')]([_0xb67c('0x22'),_0xb67c('0x34'),_0xb67c('0x35'),_0x2573a6,_0xb67c('0x3a'),'updatedAt'],squel[_0xb67c('0x36')]()[_0xb67c('0x37')](_0xb67c('0x22'),_0xb67c('0x22'))['field']('id','ContactId')['field'](LISTID[_0xb67c('0x39')](),'ListId')[_0xb67c('0x37')](_0x145cd4['id'][_0xb67c('0x39')](),_0x2573a6)[_0xb67c('0x37')](_0xb67c('0x38'),'createdAt')[_0xb67c('0x37')](_0xb67c('0x38'),'updatedAt')[_0xb67c('0x42')](_0xb67c('0x3c'))[_0xb67c('0x3d')]('deletedAt\x20IS\x20NULL')[_0xb67c('0x3d')](_0xb67c('0x3f'),LISTID['toString']())[_0xb67c('0x3d')](_0xb67c('0x43'),squel[_0xb67c('0x44')](hopperContacts))[_0xb67c('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xb67c('0x39')]();return _0x19536a;}return db[_0xb67c('0x4b')][_0xb67c('0x4c')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb67c('0x4d')],'as':_0xb67c('0x4e'),'where':{'id':LISTID}}]})[_0xb67c('0x2a')](function(_0xb76ac4){var _0xb9fa3e=[];if(_0xb76ac4){var _0x792381;for(var _0x780527=0x0,_0x1f0ae4;_0x780527<_0xb76ac4[_0xb67c('0x1a')];_0x780527+=0x1){_0x1f0ae4=_0xb76ac4[_0x780527][_0xb67c('0x4f')]({'plain':!![]});switch(_0x1f0ae4['dialCheckDuplicateType']){case'always':_0xb9fa3e[_0xb67c('0x50')](db[_0xb67c('0x51')]['query'](_0x527c07(_0x1f0ae4,_0xb67c('0x52')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));break;case _0xb67c('0x53'):_0xb9fa3e[_0xb67c('0x50')](db[_0xb67c('0x51')]['query'](_0x18ed7c(_0x1f0ae4,_0xb67c('0x52')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));break;default:_0xb9fa3e['push'](db[_0xb67c('0x51')]['query'](_0x1eedcd(_0x1f0ae4,_0xb67c('0x52')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));}}}return _0xb9fa3e;})['all']()['then'](function(){return db[_0xb67c('0x4b')][_0xb67c('0x4c')]({'where':{'type':_0xb67c('0x54')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb67c('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x136da1){var _0x219188=[];if(_0x136da1){var _0x46f29b;for(var _0x528e4b=0x0,_0x52fbf7;_0x528e4b<_0x136da1[_0xb67c('0x1a')];_0x528e4b+=0x1){_0x52fbf7=_0x136da1[_0x528e4b][_0xb67c('0x4f')]({'plain':!![]});_0x219188[_0xb67c('0x50')](db[_0xb67c('0x51')][_0xb67c('0x56')](_0x5c78e8(_0x52fbf7,_0xb67c('0x52')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));}}return _0x219188;})[_0xb67c('0x57')]();})[_0xb67c('0x2a')](function(){return db[_0xb67c('0x58')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb67c('0x4d')],'as':_0xb67c('0x4e'),'where':{'id':LISTID}}]})[_0xb67c('0x2a')](function(_0x4a4827){var _0x1b1ceb=[];if(_0x4a4827){for(var _0x2c6261=0x0,_0x1c88e2;_0x2c6261<_0x4a4827[_0xb67c('0x1a')];_0x2c6261+=0x1){_0x1c88e2=_0x4a4827[_0x2c6261]['get']({'plain':!![]});switch(_0x1c88e2[_0xb67c('0x59')]){case'always':_0x1b1ceb[_0xb67c('0x50')](db['sequelize'][_0xb67c('0x56')](_0x527c07(_0x1c88e2,_0xb67c('0x5a')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));break;case _0xb67c('0x53'):_0x1b1ceb[_0xb67c('0x50')](db[_0xb67c('0x51')][_0xb67c('0x56')](_0x18ed7c(_0x1c88e2,'CampaignId'))[_0xb67c('0x2a')](function(){})['catch'](_0x5b4aae()));break;default:_0x1b1ceb[_0xb67c('0x50')](db[_0xb67c('0x51')]['query'](_0x1eedcd(_0x1c88e2,_0xb67c('0x5a')))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));}}}return _0x1b1ceb;})['all']();})[_0xb67c('0x2a')](function(){return db['Campaign'][_0xb67c('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xb67c('0x4d')],'as':_0xb67c('0x55'),'where':{'id':LISTID}}]})[_0xb67c('0x2a')](function(_0x5b5282){var _0x3d5a67=[];if(_0x5b5282){for(var _0xe448fc=0x0,_0x121517;_0xe448fc<_0x5b5282[_0xb67c('0x1a')];_0xe448fc+=0x1){_0x121517=_0x5b5282[_0xe448fc][_0xb67c('0x4f')]({'plain':!![]});_0x3d5a67[_0xb67c('0x50')](db[_0xb67c('0x51')]['query'](_0x5c78e8(_0x121517,'CampaignId'))[_0xb67c('0x2a')](function(){})[_0xb67c('0x2c')](_0x5b4aae()));}}return _0x3d5a67;})[_0xb67c('0x57')]();})[_0xb67c('0x2c')](function(_0x20db8a){logger[_0xb67c('0x13')](_0xb67c('0x5b'),_0xb67c('0x5c'),_0x20db8a[_0xb67c('0x1c')]);});}var processPromises=function(_0x2ce10d){return BPromise[_0xb67c('0x57')](promises)[_0xb67c('0x2a')](function(_0x2334da){})['catch'](function(_0x538fde){logger[_0xb67c('0x13')](_0xb67c('0x5d'),JSON[_0xb67c('0x2d')](_0x538fde));})[_0xb67c('0x5e')](function(){socket[_0xb67c('0x5f')](_0xb67c('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ce10d){return _0x2ce10d[_0xb67c('0x61')]();}});};var endCsv=function(){return BPromise[_0xb67c('0x62')]()[_0xb67c('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xb67c('0x2a')](function(){socket[_0xb67c('0x5f')](_0xb67c('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb67c('0x63')](FILEPATH);}catch(_0x36a469){logger[_0xb67c('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x36a469));}finally{process[_0xb67c('0x64')](0x0);}});};process['on'](_0xb67c('0x65'),function(){logger[_0xb67c('0x66')](_0xb67c('0x67'));endCsv();});function main(){return BPromise[_0xb67c('0x62')]()[_0xb67c('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xb67c('0x68')][_0xb67c('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x41e833){var _0x44a790=fs[_0xb67c('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb67c('0x6a')](_0x44a790,{'header':!![],'skipEmptyLines':!![],'step':function(_0x53b09a,_0x201801){total+=0x1;var _0xc04260=total;promises[_0xb67c('0x50')](checkRow(_0x53b09a,_0x41e833,_0xc04260)[_0xb67c('0x2a')](function(){success+=0x1;})['catch'](function(_0x3f6bab){if(_0x3f6bab[_0xb67c('0x13')]){errors+=0x1;delete _0x3f6bab[_0xb67c('0x13')];}else if(_0x3f6bab['duplicate']){duplicates+=0x1;delete _0x3f6bab[_0xb67c('0x27')];}rows['push'](_0x3f6bab);}));if(total%0xc8===0x0){_0x201801[_0xb67c('0x6b')]();return processPromises(_0x201801);}},'complete':function(){return processPromises()[_0xb67c('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4c6589,_0x407202){logger['info'](_0xb67c('0x6c'),JSON[_0xb67c('0x2d')](_0x4c6589));endCsv();}});})[_0xb67c('0x2c')](function(_0x360f85){logger[_0xb67c('0x13')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xb67c('0x2d')](_0x360f85));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5c3d4fa..9e39c25 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 _0x799a=['YYYY-MM-DD','isValid','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','uncaughtException','path','lodash','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','scheduledat','priority','recallme','cm_hopper.id','cm_contact_has_items.item','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','exit','errors','sequelize','query','spread','catch','error','message','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth'];(function(_0x3442fa,_0x491118){var _0x22baea=function(_0x5187b4){while(--_0x5187b4){_0x3442fa['push'](_0x3442fa['shift']());}};_0x22baea(++_0x491118);}(_0x799a,0x186));var _0xa799=function(_0x2f808b,_0x3c5e67){_0x2f808b=_0x2f808b-0x0;var _0xbeb18c=_0x799a[_0x2f808b];return _0xbeb18c;};'use strict';var fs=require('fs');var path=require(_0xa799('0x0'));var _=require(_0xa799('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xa799('0x2'));var moment=require(_0xa799('0x3'));var squel=require(_0xa799('0x4'));var Redis=require(_0xa799('0x5'));var db=require(_0xa799('0x6'))['db'];var config=require(_0xa799('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xa799('0x8'))(_0xa799('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xa799('0xa'),'port':0x18eb});var socket=require(_0xa799('0xb'))(new Redis(config[_0xa799('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa799('0xd')](_0xa799('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa799('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x312ae7){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))*$/[_0xa799('0xf')](_0x312ae7);}function selectNotIn(_0x3e9566,_0x2d8a76,_0x25b1ba,_0xbde215,_0x1d20d0){return squel[_0xa799('0x10')]()['field'](_0xa799('0x11'))[_0xa799('0x12')](_0xbde215)[_0xa799('0x13')](_0x2d8a76,null,_0x2d8a76+_0xa799('0x14')+_0xbde215+'.'+_0x25b1ba)[_0xa799('0x15')](_0xbde215+'.'+_0x25b1ba+_0xa799('0x16')+_0x3e9566+'.'+_0x25b1ba)[_0xa799('0x15')](_0x2d8a76+_0xa799('0x17')+_0x1d20d0[_0xa799('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x544036,_0x2772a7){promisesAdditionalPhones=[];return db['CmContact'][_0xa799('0x18')]({'raw':!![],'attributes':['id',_0xa799('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa799('0x1a')](function(_0x365bb6){if(_0x365bb6!==null){var _0x3d981a=[];for(var _0x5dcfcf=0x0;_0x5dcfcf<_0x365bb6['length'];_0x5dcfcf++){var _0x561b15=_0x365bb6[_0x5dcfcf];_0x3d981a[_0xa799('0x1b')](insertAdditionalPhones(_0x561b15));}}Promise[_0xa799('0x1c')](_0x3d981a)['then'](function(){_0x544036({'val':0x1});});});});}function insertAdditionalPhones(_0x48ae3a){return new Promise(function(_0x36c383,_0x40f699){var _0x24d406=_0x48ae3a[_0xa799('0x19')];var _0x3ebe0e=_0x24d406[_0xa799('0x1d')](';');var _0x32d3cc=[];orderBy=0x0;for(var _0x37c013=0x0;_0x37c013<_0x3ebe0e[_0xa799('0x1e')];_0x37c013++){_0x32d3cc[_0xa799('0x1b')](splitAdditionalPhone(_0x48ae3a['id'],_0x3ebe0e[_0x37c013]));}Promise['all'](_0x32d3cc)[_0xa799('0x1a')](function(){_0x36c383({'val':_0x3ebe0e['length']});});});}function splitAdditionalPhone(_0xcbcdfc,_0xd30794){return new Promise(function(_0x14b923,_0x14d58e){var _0x70d199=_0xd30794[_0xa799('0x1d')](':');var _0x27a438=_0x70d199[0x0];var _0x41ab3f=_0x70d199[0x1];if(!_[_0xa799('0x1f')](_0x41ab3f)){var _0x19f762=_0x41ab3f['split']('|');var _0x21f4bc=[];for(var _0xa6929d=0x0;_0xa6929d<_0x19f762[_0xa799('0x1e')];_0xa6929d++){if(_0x19f762[_0xa6929d]!==''){var _0x237382=_[_0xa799('0x20')](promisesAdditionalPhones,{'contactId':_0xcbcdfc,'phone':_0x19f762[_0xa6929d]});if(_0x237382[_0xa799('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xa799('0x1b')]({'contactId':_0xcbcdfc,'contactTypeId':_0x27a438,'phone':_0x19f762[_0xa6929d],'orderBy':orderBy});}}}_0x14b923({'ok':0x1});}else _0x14b923({'res':0x0});});}function createAdditionalPhone(_0x576d16,_0xb9f5b3,_0xae707f,_0x353de0){var _0x28ac85='';var _0x58bbcf='';var _0x43e322=_0xae707f['split']('§');_0x28ac85=_0x43e322[0x0];if(_0x43e322['length']==0x2)_0x58bbcf=_0x43e322[0x1];return new Promise(function(_0x48cc2a,_0x5c8e3c){return db[_0xa799('0x21')][_0xa799('0x22')]({'where':{'CmContactId':_0x576d16,'item':_0x28ac85}})['then'](function(_0x53db48){if(_0x53db48){return db[_0xa799('0x21')][_0xa799('0x23')]({'ItemTypeId':_0xb9f5b3,'description':_0x58bbcf,'OrderBy':_0x353de0},{'where':{'CmContactId':_0x576d16,'item':_0x28ac85}})[_0xa799('0x1a')](function(_0x35ec9c){_0x48cc2a({'res':'updated'});});}else{return db[_0xa799('0x21')][_0xa799('0x24')]({'CmContactId':_0x576d16,'item':_0x28ac85,'description':_0x58bbcf,'ItemTypeId':_0xb9f5b3,'OrderBy':_0x353de0,'ItemClass':_0xa799('0x25')})[_0xa799('0x1a')](function(_0x184993){_0x48cc2a({'res':_0xa799('0x26')});});}});});}function insertCmHopper(_0x54983d,_0x230261,_0x2fa9bd,_0x18eda9,_0x45e8a0){var _0x274d76=[_0xa799('0x27'),_0xa799('0x28'),_0xa799('0x29'),_0xa799('0x2a'),_0x230261+'.'+_0x18eda9,'cm_contacts.createdAt',_0xa799('0x2b'),_0xa799('0x2c'),'cm_contacts.UserId','\x22'+_0x45e8a0+'\x22'];return squel[_0xa799('0x2d')]()[_0xa799('0x2e')](_0xa799('0x2f'))[_0xa799('0x30')]([_0xa799('0x11'),'scheduledat',_0xa799('0x31'),_0xa799('0x32'),_0x18eda9,_0xa799('0x33'),_0xa799('0x34'),'priority',_0xa799('0x35'),'recallme'],squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x274d76)[_0xa799('0x12')](_0x230261)[_0xa799('0x13')](_0xa799('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x230261+_0xa799('0x38'))[_0xa799('0x13')](_0x2fa9bd,null,_0x2fa9bd+_0xa799('0x14')+_0x230261+'.'+_0x18eda9)[_0xa799('0x15')](_0x230261+_0xa799('0x39'),_0x54983d)['where'](_0xa799('0x3a'),NOW)[_0xa799('0x15')](_0xa799('0x3b'),selectNotIn(_0x230261,_0x2fa9bd,_0x18eda9,_0xa799('0x2f'),[_0xa799('0x3c'),_0xa799('0x3d')]))[_0xa799('0x15')](_0xa799('0x3b'),selectNotIn(_0x230261,_0x2fa9bd,_0x18eda9,_0xa799('0x2f'),[_0xa799('0x3c')])))[_0xa799('0x3e')]();}function insertCmHopperBlack(_0xc2c499,_0x213ba5,_0x4144af,_0xbdb2e0){var _0x4ee3dc=[_0xa799('0x27'),_0xa799('0x29'),_0xa799('0x2a'),_0x213ba5+'.'+_0xbdb2e0,_0xa799('0x3f'),_0xa799('0x2b')];return squel[_0xa799('0x2d')]()[_0xa799('0x2e')](_0xa799('0x40'))[_0xa799('0x30')]([_0xa799('0x11'),'ContactId',_0xa799('0x32'),_0xbdb2e0,_0xa799('0x33'),_0xa799('0x34')],squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x4ee3dc)['from'](_0x213ba5)['join']('cm_contacts',null,_0xa799('0x41')+_0x213ba5+_0xa799('0x38'))[_0xa799('0x13')](_0x4144af,null,_0x4144af+_0xa799('0x14')+_0x213ba5+'.'+_0xbdb2e0)[_0xa799('0x15')](_0x213ba5+_0xa799('0x39'),_0xc2c499)[_0xa799('0x15')](_0xa799('0x3a'),NOW)[_0xa799('0x15')](_0xa799('0x3b'),squel[_0xa799('0x10')]()[_0xa799('0x42')]('phone')[_0xa799('0x12')]('cm_hopper_black')[_0xa799('0x15')](_0xa799('0x43'),_0xc2c499)['where'](_0xbdb2e0+'\x20=\x20'+_0x213ba5+'.'+_0xbdb2e0)))[_0xa799('0x3e')]();}function insertTzCmHopper(_0x1e6afd,_0x182bec,_0x195c9b,_0xf73da4,_0x183256,_0x32e7e3){var _0x4906e2=[_0xa799('0x27'),_0xa799('0x44')+_0x32e7e3+'.offset-cm_contacts.utcOffset\x20minute)',_0xa799('0x29'),_0xa799('0x2a'),_0x182bec+'.'+_0xf73da4,_0xa799('0x3f'),_0xa799('0x2b'),_0xa799('0x2c'),'cm_contacts.UserId','\x22'+_0x183256+'\x22'];var _0x51aa79=squel[_0xa799('0x2d')]()[_0xa799('0x2e')]('cm_hopper')[_0xa799('0x30')](['phone',_0xa799('0x45'),'ContactId',_0xa799('0x32'),_0xf73da4,_0xa799('0x33'),'updatedAt',_0xa799('0x46'),'UserId',_0xa799('0x47')],squel[_0xa799('0x10')]()['fields'](_0x4906e2)[_0xa799('0x12')](_0x182bec)[_0xa799('0x13')](_0xa799('0x37'),null,_0xa799('0x41')+_0x182bec+_0xa799('0x38'))[_0xa799('0x13')](_0x195c9b,null,_0x195c9b+_0xa799('0x14')+_0x182bec+'.'+_0xf73da4)[_0xa799('0x13')](_0x32e7e3,null,_0x32e7e3+'.id\x20=\x20'+_0x182bec+'.'+_0xf73da4)['where'](_0x182bec+'.CmListId\x20=\x20?',_0x1e6afd)['where'](_0xa799('0x3a'),NOW)[_0xa799('0x15')](_0xa799('0x3b'),selectNotIn(_0x182bec,_0x195c9b,_0xf73da4,_0xa799('0x2f'),['\x22always\x22',_0xa799('0x3d')]))['where'](_0xa799('0x3b'),selectNotIn(_0x182bec,_0x195c9b,_0xf73da4,_0xa799('0x2f'),[_0xa799('0x3c')])))[_0xa799('0x3e')]();return _0x51aa79;}function insertTzCmHopperBlack(_0x5a182f,_0x241a0f,_0x1e2646,_0xf73859){var _0x23a63d=[_0xa799('0x27'),_0xa799('0x29'),'cm_contacts.ListId',_0x241a0f+'.'+_0xf73859,'cm_contacts.createdAt',_0xa799('0x2b')];return squel[_0xa799('0x2d')]()[_0xa799('0x2e')](_0xa799('0x40'))[_0xa799('0x30')]([_0xa799('0x11'),_0xa799('0x31'),'ListId',_0xf73859,_0xa799('0x33'),'updatedAt'],squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x23a63d)[_0xa799('0x12')](_0x241a0f)['join'](_0xa799('0x37'),null,_0xa799('0x41')+_0x241a0f+_0xa799('0x38'))['join'](_0x1e2646,null,_0x1e2646+_0xa799('0x14')+_0x241a0f+'.'+_0xf73859)[_0xa799('0x15')](_0x241a0f+_0xa799('0x39'),_0x5a182f)[_0xa799('0x15')](_0xa799('0x3a'),NOW)[_0xa799('0x15')](_0xa799('0x3b'),squel[_0xa799('0x10')]()['field'](_0xa799('0x11'))[_0xa799('0x12')](_0xa799('0x40'))[_0xa799('0x15')](_0xa799('0x43'),_0x5a182f)[_0xa799('0x15')](_0xf73859+_0xa799('0x16')+_0x241a0f+'.'+_0xf73859)))['toString']();}function insertCmHopperAdditionalPhones(_0x3881d6){var _0x29ecf1=[_0xa799('0x48'),_0xa799('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xa799('0x2d')]()[_0xa799('0x2e')]('cm_hopper_additional_phones')[_0xa799('0x30')]([_0xa799('0x4a'),_0xa799('0x11'),_0xa799('0x4b'),'createdAt',_0xa799('0x34')],squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x29ecf1)[_0xa799('0x12')]('cm_hopper')[_0xa799('0x13')](_0xa799('0x37'),null,_0xa799('0x4c'))['join']('cm_contact_has_items',null,_0xa799('0x4d'))[_0xa799('0x15')]('cm_hopper.ListId\x20=\x20?',_0x3881d6)[_0xa799('0x15')](_0xa799('0x3a'),NOW))[_0xa799('0x3e')]();}function insertCmContact(_0x3cac42,_0x31a2c8,_0x793663,_0x2788db){var _0x28a9f8=_[_0xa799('0x4e')](_[_0xa799('0x4f')](_0x2788db),[_0xa799('0x32'),_0xa799('0x50'),_0xa799('0x33'),_0xa799('0x34')]);return squel[_0xa799('0x2d')]()[_0xa799('0x2e')](_0xa799('0x37'))[_0xa799('0x30')](_0x28a9f8,squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x28a9f8)['from'](_0x31a2c8)['where']('('+_0x793663[_0xa799('0x13')](',')+_0xa799('0x51'),squel[_0xa799('0x10')]()[_0xa799('0x36')](_0x793663)[_0xa799('0x12')]('cm_contacts')[_0xa799('0x15')](_0xa799('0x43'),_0x3cac42)[_0xa799('0x15')]('deletedAt\x20IS\x20NULL'))[_0xa799('0x15')]('id\x20IN\x20?',squel['select']()[_0xa799('0x42')](_0xa799('0x52'),'min_id')[_0xa799('0x12')](_0x31a2c8)['group'](_0x793663['join'](','))))[_0xa799('0x3e')]();}function handleStop(){logger[_0xa799('0x53')](_0xa799('0x54'));stopped=!![];}function handleUncaughtException(_0xa30f1c){logger['error'](_0xa30f1c['message']);process[_0xa799('0x55')](0x1);}function handleError(_0x147573,_0x860ff9){stats[_0xa799('0x56')][_0xa799('0x1b')]({'name':_0x860ff9['code'],'message':_0x860ff9['message'],'row':_0x147573});}function handleQuery(_0x3aa151){logger[_0xa799('0x53')](_0x3aa151);return db[_0xa799('0x57')][_0xa799('0x58')](_0x3aa151)[_0xa799('0x59')](function(_0x2256ed){results[_0xa799('0x1b')](_0x2256ed);})[_0xa799('0x5a')](function(_0x2ea314){logger[_0xa799('0x5b')](_0x2ea314[_0xa799('0x5c')]);});}function updateTzCampaigns(_0x393b42){return new Promise(function(_0x5bb420,_0x311753){var _0x322d98=squel['select']()[_0xa799('0x36')]([_0xa799('0x5d'),'campaigns.dialTimezone'])[_0xa799('0x12')](_0xa799('0x5e'))[_0xa799('0x13')](_0xa799('0x5f'),null,_0xa799('0x60'))['where']('campaigns_has_cm_lists.CmListId='+_0x393b42);db[_0xa799('0x57')][_0xa799('0x58')](_0x322d98['toString']())[_0xa799('0x59')](function(_0x2adeb9){var _0x44c94b=[];for(var _0x3f2192=0x0;_0x3f2192<_0x2adeb9[_0xa799('0x1e')];_0x3f2192++){_0x44c94b[_0xa799('0x1b')](getTimezoneData(_0x2adeb9[_0x3f2192],tmp_campaigns));}BPromise[_0xa799('0x1c')](_0x44c94b)['then'](function(){_0x5bb420({'val':0x1});});})['catch'](function(_0xbec112){logger[_0xa799('0x5b')](_0xbec112[_0xa799('0x5c')]);_0x5bb420({'val':0x0});});});}function updateTzVoiceQueues(_0x947b03){return new Promise(function(_0x3ed5e7,_0x15c921){var _0x42bc83=squel[_0xa799('0x10')]()[_0xa799('0x36')]([_0xa799('0x61'),_0xa799('0x62')])[_0xa799('0x12')]('voice_queues')[_0xa799('0x13')]('voice_queues_has_cm_lists',null,_0xa799('0x63'))['where']('voice_queues_has_cm_lists.CmListId='+_0x947b03);db['sequelize'][_0xa799('0x58')](_0x42bc83[_0xa799('0x3e')]())[_0xa799('0x59')](function(_0x46fa01){var _0x283cd4=[];for(var _0x5f5a81=0x0;_0x5f5a81<_0x46fa01[_0xa799('0x1e')];_0x5f5a81++){_0x283cd4[_0xa799('0x1b')](getTimezoneData(_0x46fa01[_0x5f5a81],tmp_voice_queues));}BPromise[_0xa799('0x1c')](_0x283cd4)['then'](function(){_0x3ed5e7({'val':0x1});});})[_0xa799('0x5a')](function(_0x16d490){logger['error'](_0x16d490[_0xa799('0x5c')]);_0x3ed5e7({'val':0x0});});});}function getTimezoneData(_0x6e8061,_0x30f5d4){return new Promise(function(_0x5c77c0,_0xe2644c){var _0x19882f=shared[_0xa799('0x64')];var _0x32056c=_0x19882f[_0x6e8061[_0xa799('0x65')]];if(_[_0xa799('0x1f')](_0x32056c)){_0x5c77c0({'ret':0x1});}else{var _0x6066eb=_0x32056c[_0xa799('0x66')];var _0x53fe1a=squel['insert']()[_0xa799('0x2e')](_0x30f5d4)[_0xa799('0x67')]('id',_0x6e8061['id'])[_0xa799('0x67')](_0xa799('0x68'),_0x6066eb)[_0xa799('0x67')](_0xa799('0x65'),_0x6e8061[_0xa799('0x65')])['toString']();return db[_0xa799('0x57')][_0xa799('0x58')](_0x53fe1a)[_0xa799('0x59')](function(_0x10ba14){_0x5c77c0({'ret':0x1});})[_0xa799('0x5a')](function(_0x29e55e){logger[_0xa799('0x5b')](_0x29e55e[_0xa799('0x5c')]);_0xe2644c({'ret':0x1});});}});}function handleTZQuery(_0x561ba6){logger[_0xa799('0x53')](_0x561ba6);return db[_0xa799('0x57')][_0xa799('0x58')](_0x561ba6)[_0xa799('0x59')](function(_0xa493f1){})[_0xa799('0x5a')](function(_0x4fc970){logger[_0xa799('0x5b')](_0x4fc970[_0xa799('0x5c')]);});}function main(_0x513c77,_0x269f54,_0x1bc82a,_0x4cbe80){logger[_0xa799('0x53')](_0xa799('0x69'),_0x513c77,JSON[_0xa799('0x6a')](_0x269f54));process['send'](_0xa799('0x6b'));var _0x44862b=_0x269f54[_0xa799('0x6c')];var _0x1b9ee8=_[_0xa799('0x6d')](_0x44862b);var _0x3e10a2=_0x269f54[_0xa799('0x6e')];var _0x21f736=path[_0xa799('0x13')](config[_0xa799('0x6f')],_0xa799('0x70'),_0x3e10a2+'.csv');hasTZ=_[_0xa799('0x4f')](_0x44862b)['includes'](_0xa799('0x65'));var _0x3b43a3=_[_0xa799('0x4f')](_0x44862b)[_0xa799('0x13')]();logger[_0xa799('0x53')](_0xa799('0x71'),_0x3b43a3);db[_0xa799('0x72')][_0xa799('0x18')]({'raw':!![],'attributes':['id',_0xa799('0x73')]})[_0xa799('0x1a')](function(_0x5b1085){for(var _0xa1dcb7=0x0;_0xa1dcb7<_0x5b1085['length'];_0xa1dcb7++){if(_0x5b1085[_0xa1dcb7]['name']in _0x44862b){contactItemTypes['push'](_0x5b1085[_0xa1dcb7]);delete _0x1b9ee8[_0x5b1085[_0xa1dcb7][_0xa799('0x73')]];hasAdditionalPhones=!![];}for(var _0x4696c9 in _0x44862b){if(_0x5b1085[_0xa1dcb7]['name']+_0xa799('0x74')===_0x4696c9){phoneDescriptions[_0xa799('0x1b')]({'itemTypeId':_0x5b1085[_0xa1dcb7]['id'],'description':_0x4696c9});delete _0x1b9ee8[_0x4696c9];}}}if(hasAdditionalPhones)_0x1b9ee8[_0xa799('0x19')]='';var _0x5bdeae=_[_0xa799('0x4f')](_0x1b9ee8)[_0xa799('0x13')]();logger[_0xa799('0x53')](_0xa799('0x71'),_0x5bdeae);fs[_0xa799('0x75')](_0x21f736,_0x5bdeae+'\x0a');Papa[_0xa799('0x76')](fs[_0xa799('0x77')](_0x513c77),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ed4ef,_0x324d18){try{for(var _0x12c406=0x0,_0x1d7ae4=[];_0x12c406<_0x5ed4ef[_0xa799('0x78')][_0xa799('0x1e')];_0x12c406++){stats['rows']+=0x1;if(_0x5ed4ef[_0xa799('0x56')][_0x12c406]){handleError(_0x5ed4ef[_0xa799('0x78')][_0x12c406],_0x5ed4ef[_0xa799('0x56')][_0x12c406]);}else{var _0x6874c=[];var _0x1848a6=[];var _0x11d65b={};for(var _0x316243 in _0x44862b){let _0x17b55e=contactItemTypes['find'](_0x3b6d46=>_0x3b6d46['name']===_0x316243);let _0x47d7ae=contactItemTypes[_0xa799('0x79')](_0x23a20a=>_0x23a20a[_0xa799('0x73')]+_0xa799('0x74')===_0x316243);if(_[_0xa799('0x1f')](_0x17b55e)&&_[_0xa799('0x1f')](_0x47d7ae)){if(_0x44862b[_0xa799('0x7a')](_0x316243)){if(_0x5ed4ef[_0xa799('0x78')][_0x12c406][_0x44862b[_0x316243]]){var _0x1bf4dd=_[_0xa799('0x7b')](_0x5ed4ef[_0xa799('0x78')][_0x12c406][_0x44862b[_0x316243]][_0xa799('0x7c')](/"/g,'\x27'));switch(_0x316243){case _0xa799('0x45'):var _0xad4b44=moment(_0x1bf4dd,_0xa799('0xe'),!![]);if(_0xad4b44['isValid']()){_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1bf4dd+'\x22');}else{_0x6874c['push'](_0xa799('0x7d'));}break;case _0xa799('0x46'):var _0x14bfe3=parseInt(_0x1bf4dd);_0x1bf4dd=_[_0xa799('0x7e')](_0x14bfe3)||_0x14bfe3<0x0||_0x14bfe3>0x4?_0x4cbe80?0x3:0x2:_0x14bfe3;_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1bf4dd+'\x22');break;case _0xa799('0x35'):var _0x1c615b=parseInt(_0x1bf4dd);if(_[_0xa799('0x7f')](_0x1c615b)&&_['includes'](_0x1bc82a,_0x1c615b)){_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1c615b+'\x22');}else{_0x6874c[_0xa799('0x1b')](_0xa799('0x80'));}break;case _0xa799('0x81'):if(isEmail(_0x1bf4dd)){_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1bf4dd+'\x22');}else{_0x6874c[_0xa799('0x1b')](_0xa799('0x82'));}break;case _0xa799('0x83'):var _0x13418d=moment(_0x1bf4dd,_0xa799('0x84'),!![]);if(_0x13418d[_0xa799('0x85')]()){_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1bf4dd+'\x22');}else{_0x6874c[_0xa799('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x4d3b74=shared[_0xa799('0x64')];var _0xf6f34=_0x4d3b74[_0x1bf4dd];if(!_['isNil'](_0xf6f34)){var _0x4adef6=_0xf6f34[_0xa799('0x66')];_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1bf4dd+'\x22');_0x1d7ae4['push']('\x22'+_0x4adef6+'\x22');}break;default:_0x1d7ae4['push']('\x22'+_0x1bf4dd+'\x22');}}else{switch(_0x316243){case'firstName':case _0xa799('0x11'):_0x6874c[_0xa799('0x1b')](_0x316243+_0xa799('0x86'));break;default:_0x1d7ae4[_0xa799('0x1b')]('\x22\x22');}}}}else{var _0x38c115='';if(!_[_0xa799('0x1f')](_0x17b55e)){if(!_0x11d65b[_0xa799('0x7a')](_0x17b55e['id'])){if(!_[_0xa799('0x1f')](_0x5ed4ef[_0xa799('0x78')][_0x12c406][_0x44862b[_0x316243]])){var _0x1bf4dd=_[_0xa799('0x7b')](_0x5ed4ef[_0xa799('0x78')][_0x12c406][_0x44862b[_0x316243]][_0xa799('0x7c')](/"/g,'\x27'));var _0x1fe64e=phoneDescriptions[_0xa799('0x79')](_0xcdef65=>_0xcdef65['itemTypeId']===_0x17b55e['id']);if(!_[_0xa799('0x1f')](_0x1fe64e)){var _0x45f9b4=_[_0xa799('0x7b')](_0x5ed4ef[_0xa799('0x78')][_0x12c406][_0x44862b[_0x1fe64e['description']]][_0xa799('0x7c')](/"/g,'\x27'));if(!_['isNil'](_0x45f9b4))_0x1bf4dd=_0x1bf4dd+'§'+_0x45f9b4;}if(_0x38c115=='')_0x38c115=_0x1bf4dd;else _0x38c115+='|'+_0x1bf4dd;}_0x1848a6[_0xa799('0x1b')](_0x17b55e['id']+':'+_0x38c115);_0x11d65b[_0x17b55e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d7ae4[_0xa799('0x1b')]('\x22'+_0x1848a6[_0xa799('0x13')](';')+'\x22');}if(_0x6874c[_0xa799('0x1e')]){handleError(_0x5ed4ef[_0xa799('0x78')][_0x12c406],{'code':_0xa799('0x87'),'message':_0x6874c[_0xa799('0x13')]()});}else{fs[_0xa799('0x88')](_0x21f736,_0x1d7ae4[_0xa799('0x13')]()+'\x0a');}_0x1d7ae4=[];}if(!(stats[_0xa799('0x89')]%0xc8)){socket['emit'](_0xa799('0x8a')+_0x3e10a2,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xa799('0x8b'));_0x324d18[_0xa799('0x8c')]();}}catch(_0x1e5523){handleError(_0x5ed4ef['data'][_0x12c406],{'code':'SystemError','message':_0x1e5523['message']});logger[_0xa799('0x5b')](_0xa799('0x8d'),_0x1e5523['message']);}},'complete':function(){try{var _0x23a7b2=[];var _0x376ec2=[];var _0xc9c42f=_0xa799('0x37');if(_0x269f54[_0xa799('0x8e')]&&_0x269f54[_0xa799('0x8e')][_0xa799('0x1e')]){_0xc9c42f=_0xa799('0x8f')+_0x3e10a2;_0x23a7b2[_0xa799('0x1b')](_0xa799('0x90')+_0xc9c42f+_0xa799('0x91'));}tmp_campaigns='campaigns_'+_0x3e10a2;tmp_voice_queues=_0xa799('0x92')+_0x3e10a2;_0x376ec2[_0xa799('0x1b')](_0xa799('0x90')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x376ec2[_0xa799('0x1b')](_0xa799('0x90')+tmp_voice_queues+_0xa799('0x93'));BPromise[_0xa799('0x94')](_0x376ec2,handleTZQuery)['then'](function(_0x44244d){updateTzCampaigns(_0x269f54[_0xa799('0x32')])[_0xa799('0x1a')](function(_0x5aa29d){updateTzVoiceQueues(_0x269f54['ListId'])[_0xa799('0x1a')](function(_0x5b380b){if(hasTZ)_0x5bdeae=_0x5bdeae[_0xa799('0x7c')](_0xa799('0x65'),_0xa799('0x95'));var _0x1a3677=util[_0xa799('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x21f736,_0xc9c42f,_0x5bdeae,_0x269f54[_0xa799('0x32')],_0x269f54[_0xa799('0x50')]||null,NOW,NOW);if(_[_0xa799('0x1f')](_0x44862b[_0xa799('0x45')])){_0x1a3677+=_0xa799('0x96');}_0x23a7b2[_0xa799('0x1b')](_0x1a3677);if(_0x269f54[_0xa799('0x8e')]&&_0x269f54['duplicates'][_0xa799('0x1e')]){_0x23a7b2[_0xa799('0x1b')](insertCmContact(_0x269f54[_0xa799('0x32')],_0xc9c42f,_0x269f54[_0xa799('0x8e')],_0x44862b));_0x23a7b2[_0xa799('0x1b')](_0xa799('0x97')+_0xc9c42f+';');}BPromise[_0xa799('0x94')](_0x23a7b2,handleQuery)[_0xa799('0x1a')](function(_0x117ba7){BPromise[_0xa799('0x1c')]([handleAdditionalPhones()])[_0xa799('0x1a')](function(){_0x23a7b2=[];for(var _0x69b344=0x0;_0x69b344\x20\x20','existsSync'];(function(_0x1c15a4,_0x32948a){var _0x1ae3be=function(_0x459c93){while(--_0x459c93){_0x1c15a4['push'](_0x1c15a4['shift']());}};_0x1ae3be(++_0x32948a);}(_0xe590,0xca));var _0x0e59=function(_0x245277,_0x5b4c4b){_0x245277=_0x245277-0x0;var _0x486c41=_0xe590[_0x245277];return _0x486c41;};'use strict';var fs=require('fs');var path=require(_0x0e59('0x0'));var _=require(_0x0e59('0x1'));var Papa=require(_0x0e59('0x2'));var util=require(_0x0e59('0x3'));var BPromise=require(_0x0e59('0x4'));var moment=require(_0x0e59('0x5'));var squel=require(_0x0e59('0x6'));var Redis=require(_0x0e59('0x7'));var db=require(_0x0e59('0x8'))['db'];var config=require(_0x0e59('0x9'));var shared=require('../../../config/environment/shared');var logger=require(_0x0e59('0xa'))(_0x0e59('0xb'));config[_0x0e59('0xc')]=_['defaults'](config[_0x0e59('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e59('0xd'))(new Redis(config[_0x0e59('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0e59('0xe')](_0x0e59('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0e59('0xe')](_0x0e59('0xf'));function isEmail(_0x5ed5cc){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'](_0x5ed5cc);}function selectNotIn(_0x2747bf,_0xe12201,_0x414ab6,_0x3655f5,_0x179b76){return squel[_0x0e59('0x10')]()[_0x0e59('0x11')]('phone')[_0x0e59('0x12')](_0x3655f5)['join'](_0xe12201,null,_0xe12201+_0x0e59('0x13')+_0x3655f5+'.'+_0x414ab6)[_0x0e59('0x14')](_0x3655f5+'.'+_0x414ab6+_0x0e59('0x15')+_0x2747bf+'.'+_0x414ab6)[_0x0e59('0x14')](_0xe12201+_0x0e59('0x16')+_0x179b76[_0x0e59('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c72d4,_0x1a40ea){promisesAdditionalPhones=[];return db[_0x0e59('0x18')]['findAll']({'raw':!![],'attributes':['id',_0x0e59('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x43fd9a){if(_0x43fd9a!==null){var _0x398601=[];for(var _0x2ddfda=0x0;_0x2ddfda<_0x43fd9a['length'];_0x2ddfda++){var _0x53bf5a=_0x43fd9a[_0x2ddfda];_0x398601[_0x0e59('0x1a')](insertAdditionalPhones(_0x53bf5a));}}Promise[_0x0e59('0x1b')](_0x398601)[_0x0e59('0x1c')](function(){_0x1c72d4({'val':0x1});});});});}function insertAdditionalPhones(_0xf947cf){return new Promise(function(_0x3feea2,_0x202a27){var _0x48a239=_0xf947cf[_0x0e59('0x19')];var _0x348dd0=_0x48a239['split'](';');var _0x2962af=[];orderBy=0x0;for(var _0x28e017=0x0;_0x28e017<_0x348dd0['length'];_0x28e017++){_0x2962af[_0x0e59('0x1a')](splitAdditionalPhone(_0xf947cf['id'],_0x348dd0[_0x28e017]));}Promise['all'](_0x2962af)[_0x0e59('0x1c')](function(){_0x3feea2({'val':_0x348dd0[_0x0e59('0x1d')]});});});}function splitAdditionalPhone(_0x5c436f,_0x513068){return new Promise(function(_0x78aa9f,_0x46bb09){var _0x14fc2a=_0x513068[_0x0e59('0x1e')](':');var _0x465d59=_0x14fc2a[0x0];var _0x25e1c3=_0x14fc2a[0x1];if(!_[_0x0e59('0x1f')](_0x25e1c3)){var _0x541828=_0x25e1c3[_0x0e59('0x1e')]('|');var _0x3e0a9e=[];for(var _0xd6ebdd=0x0;_0xd6ebdd<_0x541828[_0x0e59('0x1d')];_0xd6ebdd++){if(_0x541828[_0xd6ebdd]!==''){var _0x2e60e0=_['filter'](promisesAdditionalPhones,{'contactId':_0x5c436f,'phone':_0x541828[_0xd6ebdd]});if(_0x2e60e0[_0x0e59('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x0e59('0x1a')]({'contactId':_0x5c436f,'contactTypeId':_0x465d59,'phone':_0x541828[_0xd6ebdd],'orderBy':orderBy});}}}_0x78aa9f({'ok':0x1});}else _0x78aa9f({'res':0x0});});}function createAdditionalPhone(_0xc2a851,_0x14bd54,_0x52a926,_0x48834e){var _0x42f438='';var _0x2c4897='';var _0x5ad38f=_0x52a926[_0x0e59('0x1e')]('§');_0x42f438=_0x5ad38f[0x0];if(_0x5ad38f[_0x0e59('0x1d')]==0x2)_0x2c4897=_0x5ad38f[0x1];return new Promise(function(_0x45b38d,_0x3d7df3){return db[_0x0e59('0x20')][_0x0e59('0x21')]({'where':{'CmContactId':_0xc2a851,'item':_0x42f438}})[_0x0e59('0x1c')](function(_0x5d2d51){if(_0x5d2d51){return db[_0x0e59('0x20')][_0x0e59('0x22')]({'ItemTypeId':_0x14bd54,'description':_0x2c4897,'OrderBy':_0x48834e},{'where':{'CmContactId':_0xc2a851,'item':_0x42f438}})[_0x0e59('0x1c')](function(_0x9114b7){_0x45b38d({'res':_0x0e59('0x23')});});}else{return db[_0x0e59('0x20')][_0x0e59('0x24')]({'CmContactId':_0xc2a851,'item':_0x42f438,'description':_0x2c4897,'ItemTypeId':_0x14bd54,'OrderBy':_0x48834e,'ItemClass':_0x0e59('0x25')})[_0x0e59('0x1c')](function(_0x38a235){_0x45b38d({'res':_0x0e59('0x26')});});}});});}function insertCmHopper(_0x317a41,_0x18edfb,_0x32c5da,_0x1fc56b,_0x4c87c0){var _0x462620=[_0x0e59('0x27'),'cm_contacts.scheduledat',_0x0e59('0x28'),_0x0e59('0x29'),_0x18edfb+'.'+_0x1fc56b,'cm_contacts.createdAt',_0x0e59('0x2a'),_0x0e59('0x2b'),_0x0e59('0x2c'),'\x22'+_0x4c87c0+'\x22'];return squel[_0x0e59('0x2d')]()[_0x0e59('0x2e')](_0x0e59('0x2f'))['fromQuery'](['phone',_0x0e59('0x30'),'ContactId',_0x0e59('0x31'),_0x1fc56b,_0x0e59('0x32'),'updatedAt',_0x0e59('0x33'),_0x0e59('0x34'),_0x0e59('0x35')],squel['select']()[_0x0e59('0x36')](_0x462620)['from'](_0x18edfb)[_0x0e59('0x17')](_0x0e59('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x18edfb+_0x0e59('0x38'))[_0x0e59('0x17')](_0x32c5da,null,_0x32c5da+_0x0e59('0x13')+_0x18edfb+'.'+_0x1fc56b)['where'](_0x18edfb+_0x0e59('0x39'),_0x317a41)['where'](_0x0e59('0x3a'),NOW)[_0x0e59('0x14')](_0x0e59('0x3b'),selectNotIn(_0x18edfb,_0x32c5da,_0x1fc56b,'cm_hopper',['\x22always\x22',_0x0e59('0x3c')]))[_0x0e59('0x14')](_0x0e59('0x3b'),selectNotIn(_0x18edfb,_0x32c5da,_0x1fc56b,_0x0e59('0x2f'),[_0x0e59('0x3d')])))[_0x0e59('0x3e')]();}function insertCmHopperBlack(_0x5c39c6,_0x421654,_0x42956c,_0x191b79){var _0x51c800=[_0x0e59('0x27'),'cm_contacts.id',_0x0e59('0x29'),_0x421654+'.'+_0x191b79,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0x0e59('0x2e')]('cm_hopper_black')[_0x0e59('0x3f')](['phone',_0x0e59('0x40'),_0x0e59('0x31'),_0x191b79,_0x0e59('0x32'),_0x0e59('0x41')],squel[_0x0e59('0x10')]()[_0x0e59('0x36')](_0x51c800)[_0x0e59('0x12')](_0x421654)[_0x0e59('0x17')](_0x0e59('0x37'),null,_0x0e59('0x42')+_0x421654+_0x0e59('0x38'))[_0x0e59('0x17')](_0x42956c,null,_0x42956c+_0x0e59('0x13')+_0x421654+'.'+_0x191b79)['where'](_0x421654+_0x0e59('0x39'),_0x5c39c6)[_0x0e59('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x0e59('0x3b'),squel['select']()['field'](_0x0e59('0x43'))[_0x0e59('0x12')](_0x0e59('0x44'))['where'](_0x0e59('0x45'),_0x5c39c6)[_0x0e59('0x14')](_0x191b79+_0x0e59('0x15')+_0x421654+'.'+_0x191b79)))[_0x0e59('0x3e')]();}function insertTzCmHopper(_0x503fc3,_0x288e1d,_0x31dd97,_0x18117a,_0x23accf,_0x373e66){var _0x4f72a1=[_0x0e59('0x27'),_0x0e59('0x46')+_0x373e66+_0x0e59('0x47'),_0x0e59('0x28'),_0x0e59('0x29'),_0x288e1d+'.'+_0x18117a,_0x0e59('0x48'),_0x0e59('0x2a'),_0x0e59('0x2b'),_0x0e59('0x2c'),'\x22'+_0x23accf+'\x22'];var _0x218407=squel[_0x0e59('0x2d')]()[_0x0e59('0x2e')](_0x0e59('0x2f'))['fromQuery'](['phone',_0x0e59('0x30'),_0x0e59('0x40'),_0x0e59('0x31'),_0x18117a,_0x0e59('0x32'),'updatedAt',_0x0e59('0x33'),_0x0e59('0x34'),_0x0e59('0x35')],squel[_0x0e59('0x10')]()['fields'](_0x4f72a1)['from'](_0x288e1d)[_0x0e59('0x17')](_0x0e59('0x37'),null,_0x0e59('0x42')+_0x288e1d+_0x0e59('0x38'))[_0x0e59('0x17')](_0x31dd97,null,_0x31dd97+'.id\x20=\x20'+_0x288e1d+'.'+_0x18117a)['join'](_0x373e66,null,_0x373e66+'.id\x20=\x20'+_0x288e1d+'.'+_0x18117a)[_0x0e59('0x14')](_0x288e1d+'.CmListId\x20=\x20?',_0x503fc3)[_0x0e59('0x14')](_0x0e59('0x3a'),NOW)[_0x0e59('0x14')](_0x0e59('0x3b'),selectNotIn(_0x288e1d,_0x31dd97,_0x18117a,_0x0e59('0x2f'),[_0x0e59('0x3d'),_0x0e59('0x3c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x288e1d,_0x31dd97,_0x18117a,_0x0e59('0x2f'),['\x22always\x22'])))['toString']();return _0x218407;}function insertTzCmHopperBlack(_0x3d547c,_0x43263d,_0x5cae16,_0x515f11){var _0x5e1157=[_0x0e59('0x27'),_0x0e59('0x28'),_0x0e59('0x29'),_0x43263d+'.'+_0x515f11,_0x0e59('0x48'),'cm_contacts.updatedAt'];return squel['insert']()[_0x0e59('0x2e')]('cm_hopper_black')[_0x0e59('0x3f')]([_0x0e59('0x43'),_0x0e59('0x40'),_0x0e59('0x31'),_0x515f11,_0x0e59('0x32'),_0x0e59('0x41')],squel[_0x0e59('0x10')]()['fields'](_0x5e1157)[_0x0e59('0x12')](_0x43263d)[_0x0e59('0x17')](_0x0e59('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x43263d+_0x0e59('0x38'))['join'](_0x5cae16,null,_0x5cae16+_0x0e59('0x13')+_0x43263d+'.'+_0x515f11)[_0x0e59('0x14')](_0x43263d+_0x0e59('0x39'),_0x3d547c)[_0x0e59('0x14')](_0x0e59('0x3a'),NOW)[_0x0e59('0x14')](_0x0e59('0x3b'),squel[_0x0e59('0x10')]()['field']('phone')[_0x0e59('0x12')](_0x0e59('0x44'))[_0x0e59('0x14')](_0x0e59('0x45'),_0x3d547c)[_0x0e59('0x14')](_0x515f11+_0x0e59('0x15')+_0x43263d+'.'+_0x515f11)))[_0x0e59('0x3e')]();}function insertCmHopperAdditionalPhones(_0x5adc15){var _0x1f5096=[_0x0e59('0x49'),_0x0e59('0x4a'),_0x0e59('0x4b'),_0x0e59('0x4c'),_0x0e59('0x4d')];return squel[_0x0e59('0x2d')]()[_0x0e59('0x2e')](_0x0e59('0x4e'))[_0x0e59('0x3f')](['CmHopperId','phone',_0x0e59('0x4f'),_0x0e59('0x32'),'updatedAt'],squel['select']()[_0x0e59('0x36')](_0x1f5096)[_0x0e59('0x12')](_0x0e59('0x2f'))[_0x0e59('0x17')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x0e59('0x50'),null,_0x0e59('0x51'))[_0x0e59('0x14')]('cm_hopper.ListId\x20=\x20?',_0x5adc15)[_0x0e59('0x14')](_0x0e59('0x3a'),NOW))[_0x0e59('0x3e')]();}function insertCmContact(_0x3011f3,_0x390ad9,_0x1f22e8,_0x5c98da){var _0x1db516=_[_0x0e59('0x52')](_[_0x0e59('0x53')](_0x5c98da),[_0x0e59('0x31'),_0x0e59('0x54'),_0x0e59('0x32'),_0x0e59('0x41')]);return squel[_0x0e59('0x2d')]()[_0x0e59('0x2e')](_0x0e59('0x37'))[_0x0e59('0x3f')](_0x1db516,squel[_0x0e59('0x10')]()['fields'](_0x1db516)[_0x0e59('0x12')](_0x390ad9)[_0x0e59('0x14')]('('+_0x1f22e8[_0x0e59('0x17')](',')+_0x0e59('0x55'),squel[_0x0e59('0x10')]()[_0x0e59('0x36')](_0x1f22e8)[_0x0e59('0x12')](_0x0e59('0x37'))[_0x0e59('0x14')](_0x0e59('0x45'),_0x3011f3)['where']('deletedAt\x20IS\x20NULL'))[_0x0e59('0x14')]('id\x20IN\x20?',squel[_0x0e59('0x10')]()[_0x0e59('0x11')](_0x0e59('0x56'),_0x0e59('0x57'))[_0x0e59('0x12')](_0x390ad9)[_0x0e59('0x58')](_0x1f22e8[_0x0e59('0x17')](','))))[_0x0e59('0x3e')]();}function handleStop(){logger['info'](_0x0e59('0x59'));stopped=!![];}function handleUncaughtException(_0x2ce88c){logger[_0x0e59('0x5a')](_0x2ce88c['message']);process['exit'](0x1);}function handleError(_0x4a11d5,_0x1f9ed1){stats[_0x0e59('0x5b')]['push']({'name':_0x1f9ed1[_0x0e59('0x5c')],'message':_0x1f9ed1[_0x0e59('0x5d')],'row':_0x4a11d5});}function handleQuery(_0x4b5491){logger[_0x0e59('0x5e')](_0x4b5491);return db[_0x0e59('0x5f')][_0x0e59('0x60')](_0x4b5491)[_0x0e59('0x61')](function(_0x4c4697){results[_0x0e59('0x1a')](_0x4c4697);})[_0x0e59('0x62')](function(_0x4fe998){logger[_0x0e59('0x5a')](_0x4fe998[_0x0e59('0x5d')]);});}function updateTzCampaigns(_0x4e6fd5){return new Promise(function(_0x2c2fc9,_0x10b0d3){var _0x2d5f54=squel['select']()[_0x0e59('0x36')]([_0x0e59('0x63'),_0x0e59('0x64')])[_0x0e59('0x12')]('campaigns')[_0x0e59('0x17')](_0x0e59('0x65'),null,_0x0e59('0x66'))[_0x0e59('0x14')]('campaigns_has_cm_lists.CmListId='+_0x4e6fd5);db[_0x0e59('0x5f')][_0x0e59('0x60')](_0x2d5f54['toString']())[_0x0e59('0x61')](function(_0x5a62a2){var _0x271654=[];for(var _0x1b52ef=0x0;_0x1b52ef<_0x5a62a2['length'];_0x1b52ef++){_0x271654[_0x0e59('0x1a')](getTimezoneData(_0x5a62a2[_0x1b52ef],tmp_campaigns));}BPromise[_0x0e59('0x1b')](_0x271654)[_0x0e59('0x1c')](function(){_0x2c2fc9({'val':0x1});});})[_0x0e59('0x62')](function(_0x4922a1){logger['error'](_0x4922a1[_0x0e59('0x5d')]);_0x2c2fc9({'val':0x0});});});}function updateTzVoiceQueues(_0x21b8c2){return new Promise(function(_0x520f84,_0x4c7aab){var _0x529ef9=squel[_0x0e59('0x10')]()[_0x0e59('0x36')]([_0x0e59('0x67'),'voice_queues.dialTimezone'])[_0x0e59('0x12')](_0x0e59('0x68'))[_0x0e59('0x17')](_0x0e59('0x69'),null,_0x0e59('0x6a'))['where'](_0x0e59('0x6b')+_0x21b8c2);db[_0x0e59('0x5f')][_0x0e59('0x60')](_0x529ef9[_0x0e59('0x3e')]())[_0x0e59('0x61')](function(_0x5ef700){var _0xd52394=[];for(var _0x42e1e4=0x0;_0x42e1e4<_0x5ef700['length'];_0x42e1e4++){_0xd52394[_0x0e59('0x1a')](getTimezoneData(_0x5ef700[_0x42e1e4],tmp_voice_queues));}BPromise[_0x0e59('0x1b')](_0xd52394)[_0x0e59('0x1c')](function(){_0x520f84({'val':0x1});});})[_0x0e59('0x62')](function(_0xc5bf0a){logger[_0x0e59('0x5a')](_0xc5bf0a['message']);_0x520f84({'val':0x0});});});}function getTimezoneData(_0x5cd1e7,_0x4207c5){return new Promise(function(_0x5082d1,_0x259116){var _0xdd9874=shared[_0x0e59('0x6c')];var _0x5e26f9=_0xdd9874[_0x5cd1e7[_0x0e59('0x6d')]];if(_[_0x0e59('0x1f')](_0x5e26f9)){_0x5082d1({'ret':0x1});}else{var _0x434807=_0x5e26f9[_0x0e59('0x6e')];var _0x2030bf=squel[_0x0e59('0x2d')]()['into'](_0x4207c5)['set']('id',_0x5cd1e7['id'])[_0x0e59('0x6f')](_0x0e59('0x70'),_0x434807)[_0x0e59('0x6f')](_0x0e59('0x6d'),_0x5cd1e7[_0x0e59('0x6d')])[_0x0e59('0x3e')]();return db['sequelize'][_0x0e59('0x60')](_0x2030bf)[_0x0e59('0x61')](function(_0x5c143d){_0x5082d1({'ret':0x1});})[_0x0e59('0x62')](function(_0x29d2f3){logger['error'](_0x29d2f3[_0x0e59('0x5d')]);_0x259116({'ret':0x1});});}});}function handleTZQuery(_0x48da26){logger['info'](_0x48da26);return db[_0x0e59('0x5f')]['query'](_0x48da26)['spread'](function(_0x100029){})['catch'](function(_0x4cd1f0){logger[_0x0e59('0x5a')](_0x4cd1f0['message']);});}function main(_0x9de9a4,_0x39f961,_0x351f80,_0x5e8ffd){logger['info'](_0x0e59('0x71'),_0x9de9a4,JSON[_0x0e59('0x72')](_0x39f961));process[_0x0e59('0x73')](_0x0e59('0x74'));var _0x1f702f=_0x39f961['binding'];var _0x37b94e=_[_0x0e59('0x75')](_0x1f702f);var _0x3ce8ec=_0x39f961[_0x0e59('0x76')];var _0x219075=path[_0x0e59('0x17')](config[_0x0e59('0x77')],_0x0e59('0x78'),_0x3ce8ec+_0x0e59('0x79'));hasTZ=_[_0x0e59('0x53')](_0x1f702f)[_0x0e59('0x7a')](_0x0e59('0x6d'));var _0x567c6b=_['keys'](_0x1f702f)[_0x0e59('0x17')]();logger[_0x0e59('0x5e')](_0x0e59('0x7b'),_0x567c6b);db[_0x0e59('0x7c')]['findAll']({'raw':!![],'attributes':['id',_0x0e59('0x7d')]})['then'](function(_0x1bbdc4){for(var _0x219379=0x0;_0x219379<_0x1bbdc4[_0x0e59('0x1d')];_0x219379++){if(_0x1bbdc4[_0x219379][_0x0e59('0x7d')]in _0x1f702f){contactItemTypes[_0x0e59('0x1a')](_0x1bbdc4[_0x219379]);delete _0x37b94e[_0x1bbdc4[_0x219379]['name']];hasAdditionalPhones=!![];}for(var _0x10ed48 in _0x1f702f){if(_0x1bbdc4[_0x219379]['name']+_0x0e59('0x7e')===_0x10ed48){phoneDescriptions[_0x0e59('0x1a')]({'itemTypeId':_0x1bbdc4[_0x219379]['id'],'description':_0x10ed48});delete _0x37b94e[_0x10ed48];}}}if(hasAdditionalPhones)_0x37b94e[_0x0e59('0x19')]='';var _0x17d9fe=_[_0x0e59('0x53')](_0x37b94e)[_0x0e59('0x17')]();logger[_0x0e59('0x5e')]('header',_0x17d9fe);fs[_0x0e59('0x7f')](_0x219075,_0x17d9fe+'\x0a');Papa[_0x0e59('0x80')](fs[_0x0e59('0x81')](_0x9de9a4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x25ec82,_0x12d03f){try{for(var _0x5519bb=0x0,_0x337b04=[];_0x5519bb<_0x25ec82[_0x0e59('0x82')][_0x0e59('0x1d')];_0x5519bb++){stats[_0x0e59('0x83')]+=0x1;if(_0x25ec82[_0x0e59('0x5b')][_0x5519bb]){handleError(_0x25ec82[_0x0e59('0x82')][_0x5519bb],_0x25ec82['errors'][_0x5519bb]);}else{var _0x16e2f9=[];var _0x1ae99c=[];var _0x273abc={};for(var _0x332ada in _0x1f702f){let _0x5613f2=contactItemTypes['find'](_0x47cf3e=>_0x47cf3e[_0x0e59('0x7d')]===_0x332ada);let _0x39f124=contactItemTypes[_0x0e59('0x84')](_0x1bf470=>_0x1bf470['name']+'_description'===_0x332ada);if(_[_0x0e59('0x1f')](_0x5613f2)&&_[_0x0e59('0x1f')](_0x39f124)){if(_0x1f702f[_0x0e59('0x85')](_0x332ada)){if(_0x25ec82[_0x0e59('0x82')][_0x5519bb][_0x1f702f[_0x332ada]]){var _0x439e74=_['trim'](_0x25ec82[_0x0e59('0x82')][_0x5519bb][_0x1f702f[_0x332ada]][_0x0e59('0x86')](/"/g,'\x27'));switch(_0x332ada){case'scheduledat':var _0x32a949=moment(_0x439e74,_0x0e59('0xf'),!![]);if(_0x32a949[_0x0e59('0x87')]()){_0x337b04['push']('\x22'+_0x439e74+'\x22');}else{_0x16e2f9['push'](_0x0e59('0x88'));}break;case _0x0e59('0x33'):var _0x4f97f0=parseInt(_0x439e74);_0x439e74=_['isNaN'](_0x4f97f0)||_0x4f97f0<0x0||_0x4f97f0>0x4?_0x5e8ffd?0x3:0x2:_0x4f97f0;_0x337b04[_0x0e59('0x1a')]('\x22'+_0x439e74+'\x22');break;case _0x0e59('0x34'):var _0x30f830=parseInt(_0x439e74);if(_[_0x0e59('0x89')](_0x30f830)&&_[_0x0e59('0x7a')](_0x351f80,_0x30f830)){_0x337b04[_0x0e59('0x1a')]('\x22'+_0x30f830+'\x22');}else{_0x16e2f9[_0x0e59('0x1a')](_0x0e59('0x8a'));}break;case _0x0e59('0x8b'):if(isEmail(_0x439e74)){_0x337b04['push']('\x22'+_0x439e74+'\x22');}else{_0x16e2f9[_0x0e59('0x1a')](_0x0e59('0x8c'));}break;case _0x0e59('0x8d'):var _0x390a4c=moment(_0x439e74,_0x0e59('0x8e'),!![]);if(_0x390a4c[_0x0e59('0x87')]()){_0x337b04['push']('\x22'+_0x439e74+'\x22');}else{_0x16e2f9[_0x0e59('0x1a')](_0x0e59('0x8f'));}break;case'dialTimezone':var _0x544749=shared[_0x0e59('0x6c')];var _0x3ce692=_0x544749[_0x439e74];if(!_[_0x0e59('0x1f')](_0x3ce692)){var _0x475ab3=_0x3ce692['utcOffset'];_0x337b04[_0x0e59('0x1a')]('\x22'+_0x439e74+'\x22');_0x337b04[_0x0e59('0x1a')]('\x22'+_0x475ab3+'\x22');}break;default:_0x337b04['push']('\x22'+_0x439e74+'\x22');}}else{switch(_0x332ada){case _0x0e59('0x90'):case _0x0e59('0x43'):_0x16e2f9[_0x0e59('0x1a')](_0x332ada+_0x0e59('0x91'));break;default:_0x337b04[_0x0e59('0x1a')]('\x22\x22');}}}}else{var _0x23f3d4='';if(!_[_0x0e59('0x1f')](_0x5613f2)){if(!_0x273abc[_0x0e59('0x85')](_0x5613f2['id'])){if(!_[_0x0e59('0x1f')](_0x25ec82[_0x0e59('0x82')][_0x5519bb][_0x1f702f[_0x332ada]])){var _0x439e74=_[_0x0e59('0x92')](_0x25ec82[_0x0e59('0x82')][_0x5519bb][_0x1f702f[_0x332ada]][_0x0e59('0x86')](/"/g,'\x27'));var _0x507cb1=phoneDescriptions[_0x0e59('0x84')](_0x4b2e58=>_0x4b2e58['itemTypeId']===_0x5613f2['id']);if(!_['isNil'](_0x507cb1)){var _0x4fa5ba=_[_0x0e59('0x92')](_0x25ec82[_0x0e59('0x82')][_0x5519bb][_0x1f702f[_0x507cb1['description']]][_0x0e59('0x86')](/"/g,'\x27'));if(!_[_0x0e59('0x1f')](_0x4fa5ba))_0x439e74=_0x439e74+'§'+_0x4fa5ba;}if(_0x23f3d4=='')_0x23f3d4=_0x439e74;else _0x23f3d4+='|'+_0x439e74;}_0x1ae99c['push'](_0x5613f2['id']+':'+_0x23f3d4);_0x273abc[_0x5613f2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x337b04[_0x0e59('0x1a')]('\x22'+_0x1ae99c[_0x0e59('0x17')](';')+'\x22');}if(_0x16e2f9[_0x0e59('0x1d')]){handleError(_0x25ec82[_0x0e59('0x82')][_0x5519bb],{'code':_0x0e59('0x93'),'message':_0x16e2f9['join']()});}else{fs[_0x0e59('0x94')](_0x219075,_0x337b04[_0x0e59('0x17')]()+'\x0a');}_0x337b04=[];}if(!(stats[_0x0e59('0x83')]%0xc8)){socket[_0x0e59('0x95')](_0x0e59('0x96')+_0x3ce8ec,stats);stats[_0x0e59('0x5b')]=[];}}if(stopped){logger[_0x0e59('0x5e')](_0x0e59('0x97'));_0x12d03f[_0x0e59('0x98')]();}}catch(_0x42e613){handleError(_0x25ec82[_0x0e59('0x82')][_0x5519bb],{'code':_0x0e59('0x99'),'message':_0x42e613[_0x0e59('0x5d')]});logger[_0x0e59('0x5a')]('step',_0x42e613[_0x0e59('0x5d')]);}},'complete':function(){try{var _0x4621c9=[];var _0x25255f=[];var _0x309148=_0x0e59('0x37');if(_0x39f961[_0x0e59('0x9a')]&&_0x39f961[_0x0e59('0x9a')]['length']){_0x309148=_0x0e59('0x9b')+_0x3ce8ec;_0x4621c9[_0x0e59('0x1a')]('CREATE\x20TABLE\x20'+_0x309148+_0x0e59('0x9c'));}tmp_campaigns=_0x0e59('0x9d')+_0x3ce8ec;tmp_voice_queues=_0x0e59('0x9e')+_0x3ce8ec;_0x25255f[_0x0e59('0x1a')](_0x0e59('0x9f')+tmp_campaigns+_0x0e59('0xa0'));_0x25255f[_0x0e59('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x0e59('0xa0'));BPromise['each'](_0x25255f,handleTZQuery)[_0x0e59('0x1c')](function(_0x4cab0d){updateTzCampaigns(_0x39f961['ListId'])[_0x0e59('0x1c')](function(_0x2e2269){updateTzVoiceQueues(_0x39f961[_0x0e59('0x31')])[_0x0e59('0x1c')](function(_0x19154a){if(hasTZ)_0x17d9fe=_0x17d9fe[_0x0e59('0x86')](_0x0e59('0x6d'),_0x0e59('0xa1'));var _0x2dc6bd=util[_0x0e59('0xe')](_0x0e59('0xa2'),_0x219075,_0x309148,_0x17d9fe,_0x39f961[_0x0e59('0x31')],_0x39f961[_0x0e59('0x54')]||null,NOW,NOW);if(_[_0x0e59('0x1f')](_0x1f702f[_0x0e59('0x30')])){_0x2dc6bd+=_0x0e59('0xa3');}_0x4621c9['push'](_0x2dc6bd);if(_0x39f961[_0x0e59('0x9a')]&&_0x39f961['duplicates'][_0x0e59('0x1d')]){_0x4621c9['push'](insertCmContact(_0x39f961[_0x0e59('0x31')],_0x309148,_0x39f961['duplicates'],_0x1f702f));_0x4621c9['push'](_0x0e59('0xa4')+_0x309148+';');}BPromise[_0x0e59('0xa5')](_0x4621c9,handleQuery)['then'](function(_0x225922){BPromise[_0x0e59('0x1b')]([handleAdditionalPhones()])['then'](function(){_0x4621c9=[];for(var _0xc90131=0x0;_0xc90131\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','length','split','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.id'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4760,0x1b4));var _0x0476=function(_0x1ebbac,_0x33fd6c){_0x1ebbac=_0x1ebbac-0x0;var _0x6a93fb=_0x4760[_0x1ebbac];return _0x6a93fb;};'use strict';var fs=require('fs');var path=require(_0x0476('0x0'));var _=require('lodash');var Papa=require(_0x0476('0x1'));var util=require(_0x0476('0x2'));var BPromise=require(_0x0476('0x3'));var moment=require(_0x0476('0x4'));var squel=require(_0x0476('0x5'));var Redis=require(_0x0476('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x0476('0x7'));var logger=require(_0x0476('0x8'))(_0x0476('0x9'));config[_0x0476('0xa')]=_[_0x0476('0xb')](config[_0x0476('0xa')],{'host':_0x0476('0xc'),'port':0x18eb});var socket=require(_0x0476('0xd'))(new Redis(config[_0x0476('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0476('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2818b4){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))*$/[_0x0476('0xf')](_0x2818b4);}function selectNotIn(_0x35db49,_0x572ec2,_0x670807,_0x26dec0,_0x5aee81){return squel[_0x0476('0x10')]()[_0x0476('0x11')](_0x0476('0x12'))[_0x0476('0x13')](_0x26dec0)[_0x0476('0x14')](_0x572ec2,null,_0x572ec2+_0x0476('0x15')+_0x26dec0+'.'+_0x670807)['where'](_0x26dec0+'.'+_0x670807+_0x0476('0x16')+_0x35db49+'.'+_0x670807)[_0x0476('0x17')](_0x572ec2+_0x0476('0x18')+_0x5aee81[_0x0476('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x334d11,_0x531175){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0476('0x19')][_0x0476('0x1a')](_0x0476('0x1b')+tempTableName)[_0x0476('0x1c')](function(_0x4646e6){if(_0x4646e6!==null){var _0x3c5dbe=[];for(var _0x1d860f=0x0;_0x1d860f<_0x4646e6['length'];_0x1d860f++){var _0x1dc86b=_0x4646e6[_0x1d860f];if(!_[_0x0476('0x1d')](_0x1dc86b[_0x0476('0x12')])){if(!_[_0x0476('0x1d')](_0x1dc86b[_0x0476('0x1e')]))_0x3c5dbe['push'](insertAdditionalPhones(_0x1dc86b));promisesContact[_0x0476('0x1f')]({'contact':_0x1dc86b});}}}Promise[_0x0476('0x20')](_0x3c5dbe)[_0x0476('0x21')](function(){_0x334d11({'val':0x1});});})[_0x0476('0x22')](function(_0x3a97dc){logger['error'](_0x3a97dc[_0x0476('0x23')]);});});}function insertAdditionalPhones(_0x328f00){return new Promise(function(_0x45f854,_0x39b5e2){var _0x19e4d6=_0x328f00[_0x0476('0x1e')];if(_[_0x0476('0x1d')](_0x19e4d6))_0x39b5e2({'val':0x0});else{var _0x40fe17=_0x19e4d6['split'](';');var _0x548178=[];orderBy=0x0;for(var _0x4b1faa=0x0;_0x4b1faa<_0x40fe17[_0x0476('0x24')];_0x4b1faa++){_0x548178[_0x0476('0x1f')](splitAdditionalPhone(_0x328f00['id'],_0x40fe17[_0x4b1faa]));}Promise['all'](_0x548178)[_0x0476('0x21')](function(){_0x45f854({'val':_0x40fe17[_0x0476('0x24')]});});}});}function splitAdditionalPhone(_0x5866b6,_0x5bd62f){return new Promise(function(_0x1e4dc7,_0x573b15){var _0x618991=_0x5bd62f[_0x0476('0x25')](':');var _0x21653e=_0x618991[0x0];var _0x192d27=_0x618991[0x1];if(_0x192d27!==''){var _0x46291c=_0x192d27['split']('|');var _0x4ef29e=[];for(var _0x43be2e=0x0;_0x43be2e<_0x46291c[_0x0476('0x24')];_0x43be2e++){if(_0x46291c[_0x43be2e]!==''){var _0x27ef0=_['filter'](promisesAdditionalPhones,{'contactId':_0x5866b6,'phone':_0x46291c[_0x43be2e]});if(_0x27ef0[_0x0476('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0x0476('0x1f')]({'contactId':_0x5866b6,'contactTypeId':_0x21653e,'phone':_0x46291c[_0x43be2e],'orderBy':orderBy});}}}_0x1e4dc7({'ok':0x1});}else _0x1e4dc7({'res':0x0});});}function createAdditionalPhone(_0x18e92c,_0x56519d,_0xf7d72f,_0x365531){var _0x5833d6='';var _0x3fb8e5='';var _0x56384a=_0xf7d72f[_0x0476('0x25')]('§');_0x5833d6=_0x56384a[0x0];if(_0x56384a[_0x0476('0x24')]==0x2)_0x3fb8e5=_0x56384a[0x1];return new Promise(function(_0x1fe4b7,_0x114c7b){return db[_0x0476('0x26')][_0x0476('0x27')]({'where':{'CmContactId':_0x18e92c,'item':_0x5833d6}})[_0x0476('0x21')](function(_0x27dbc8){if(_0x27dbc8){return db['CmContactHasItem'][_0x0476('0x28')]({'ItemTypeId':_0x56519d,'description':_0x3fb8e5,'OrderBy':_0x365531},{'where':{'CmContactId':_0x18e92c,'item':_0x5833d6}})[_0x0476('0x21')](function(_0x2b4813){_0x1fe4b7({'res':'updated'});});}else{return db[_0x0476('0x26')][_0x0476('0x29')]({'CmContactId':_0x18e92c,'item':_0x5833d6,'ItemTypeId':_0x56519d,'description':_0x3fb8e5,'OrderBy':_0x365531,'ItemClass':_0x0476('0x2a')})['then'](function(_0x3c0bc0){_0x1fe4b7({'res':_0x0476('0x2b')});});}});});}function updateContact(_0xfd9cc1){return new Promise(function(_0x476103,_0x52f33a){var _0x509cb9=_0xfd9cc1['id'];delete _0xfd9cc1['id'];return db[_0x0476('0x2c')]['update'](_0xfd9cc1,{'where':{'id':_0x509cb9}})[_0x0476('0x21')](function(_0x5ce731){updatedRows+=0x1;return db['CmHopper'][_0x0476('0x28')]({'phone':_0xfd9cc1[_0x0476('0x12')]},{'where':{'ContactId':_0x509cb9}})['then'](function(_0x3f4058){_0x476103({'ret':'OK'});});});});}function insertCmHopper(_0x5aad38,_0x46af59,_0x286b63,_0xed84ff,_0x32dcfe){var _0x5e2ab2=[_0x0476('0x2d'),'cm_contacts.scheduledat',_0x0476('0x2e'),_0x0476('0x2f'),_0x46af59+'.'+_0xed84ff,_0x0476('0x30'),_0x0476('0x31'),_0x0476('0x32'),_0x0476('0x33'),'\x22'+_0x32dcfe+'\x22'];return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x36'))[_0x0476('0x37')]([_0x0476('0x12'),'scheduledat',_0x0476('0x38'),'ListId',_0xed84ff,_0x0476('0x39'),_0x0476('0x3a'),_0x0476('0x3b'),_0x0476('0x3c'),_0x0476('0x3d')],squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x5e2ab2)[_0x0476('0x13')](_0x46af59)[_0x0476('0x14')](_0x0476('0x3f'),null,_0x0476('0x40')+_0x46af59+'.CmListId')[_0x0476('0x14')](_0x286b63,null,_0x286b63+_0x0476('0x15')+_0x46af59+'.'+_0xed84ff)[_0x0476('0x17')](_0x46af59+_0x0476('0x41'),_0x5aad38)[_0x0476('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0476('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46af59,_0x286b63,_0xed84ff,_0x0476('0x36'),[_0x0476('0x42'),'\x22onlyIfOpen\x22']))[_0x0476('0x17')](_0x0476('0x43'),selectNotIn(_0x46af59,_0x286b63,_0xed84ff,_0x0476('0x36'),[_0x0476('0x42')])))[_0x0476('0x44')]();}function insertCmHopperBlack(_0x5d57cc,_0x1458f0,_0x560dcb,_0x4afc6c){var _0x4872e7=[_0x0476('0x2d'),'cm_contacts.id','cm_contacts.ListId',_0x1458f0+'.'+_0x4afc6c,_0x0476('0x30'),_0x0476('0x31')];return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x45'))[_0x0476('0x37')](['phone',_0x0476('0x38'),_0x0476('0x46'),_0x4afc6c,_0x0476('0x39'),_0x0476('0x3a')],squel[_0x0476('0x10')]()['fields'](_0x4872e7)['from'](_0x1458f0)[_0x0476('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1458f0+_0x0476('0x47'))[_0x0476('0x14')](_0x560dcb,null,_0x560dcb+_0x0476('0x15')+_0x1458f0+'.'+_0x4afc6c)[_0x0476('0x17')](_0x1458f0+_0x0476('0x41'),_0x5d57cc)[_0x0476('0x17')](_0x0476('0x48'),NOW)['where'](_0x0476('0x43'),squel[_0x0476('0x10')]()[_0x0476('0x11')]('phone')[_0x0476('0x13')](_0x0476('0x45'))[_0x0476('0x17')]('ListId\x20=\x20?',_0x5d57cc)[_0x0476('0x17')](_0x4afc6c+'\x20=\x20?',_0x1458f0+'.'+_0x4afc6c)))[_0x0476('0x44')]();}function insertCmHopperAdditionalPhones(_0x268812){var _0xa53399=[_0x0476('0x49'),_0x0476('0x4a'),_0x0476('0x4b'),'cm_contact_has_items.createdAt',_0x0476('0x4c')];return squel['insert']()[_0x0476('0x35')](_0x0476('0x4d'))[_0x0476('0x37')]([_0x0476('0x4e'),_0x0476('0x12'),_0x0476('0x4f'),_0x0476('0x39'),_0x0476('0x3a')],squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0xa53399)[_0x0476('0x13')](_0x0476('0x36'))[_0x0476('0x14')](_0x0476('0x3f'),null,_0x0476('0x50'))[_0x0476('0x14')](_0x0476('0x51'),null,_0x0476('0x52'))['where'](_0x0476('0x53'),_0x268812)[_0x0476('0x17')](_0x0476('0x48'),NOW))['toString']();}function insertCmContact(_0x451e51,_0x78675a,_0x4f6685,_0x4d5152){var _0x1c40e0=_[_0x0476('0x54')](_['keys'](_0x4d5152),['ListId',_0x0476('0x55'),_0x0476('0x39'),_0x0476('0x3a')]);return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x3f'))[_0x0476('0x37')](_0x1c40e0,squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x1c40e0)[_0x0476('0x13')](_0x78675a)[_0x0476('0x17')]('('+_0x4f6685['join'](',')+_0x0476('0x56'),squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x4f6685)[_0x0476('0x13')](_0x0476('0x3f'))[_0x0476('0x17')]('ListId\x20=\x20?',_0x451e51))[_0x0476('0x17')](_0x0476('0x57'),squel['select']()[_0x0476('0x11')](_0x0476('0x58'),_0x0476('0x59'))['from'](_0x78675a)[_0x0476('0x5a')](_0x4f6685[_0x0476('0x14')](','))))[_0x0476('0x44')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2ade7a){logger['error'](_0x2ade7a[_0x0476('0x23')]);process['exit'](0x1);}function handleError(_0x29cdf8,_0x46d757){stats['errors'][_0x0476('0x1f')]({'name':_0x46d757[_0x0476('0x5b')],'message':_0x46d757[_0x0476('0x23')],'row':_0x29cdf8});}function handleQuery(_0x549a75){logger[_0x0476('0x5c')](_0x549a75);return db[_0x0476('0x19')][_0x0476('0x1a')](_0x549a75)[_0x0476('0x1c')](function(_0x1be7fd){results[_0x0476('0x1f')](_0x1be7fd);})['catch'](function(_0xdd6f9e){logger[_0x0476('0x5d')](_0xdd6f9e[_0x0476('0x23')]);});}function main(_0x39b924,_0x580650,_0x1d166a,_0x1a4124){logger[_0x0476('0x5c')](_0x0476('0x5e'),_0x39b924,JSON[_0x0476('0x5f')](_0x580650));process[_0x0476('0x60')]('start');var _0x127194=_0x580650[_0x0476('0x61')];var _0xd4af9a=_[_0x0476('0x62')](_0x127194);var _0xbace5=_0x580650[_0x0476('0x63')];var _0x108971=path[_0x0476('0x14')](config[_0x0476('0x64')],'server/files/tmp',_0xbace5+_0x0476('0x65'));logger['info'](_0x0476('0x66'),_0x580650);db[_0x0476('0x67')][_0x0476('0x68')]({'raw':!![],'attributes':['id',_0x0476('0x69')]})[_0x0476('0x21')](function(_0x1f02c4){for(var _0x230d0a=0x0;_0x230d0a<_0x1f02c4[_0x0476('0x24')];_0x230d0a++){if(_0x1f02c4[_0x230d0a][_0x0476('0x69')]in _0x127194){contactItemTypes[_0x0476('0x1f')](_0x1f02c4[_0x230d0a]);delete _0xd4af9a[_0x1f02c4[_0x230d0a][_0x0476('0x69')]];hasAdditionalPhones=!![];}for(var _0x39fe88 in _0x127194){if(_0x1f02c4[_0x230d0a][_0x0476('0x69')]+'_description'===_0x39fe88){phoneDescriptions[_0x0476('0x1f')]({'itemTypeId':_0x1f02c4[_0x230d0a]['id'],'description':_0x39fe88});delete _0xd4af9a[_0x39fe88];}}}if(hasAdditionalPhones)_0xd4af9a[_0x0476('0x1e')]='';var _0x431904=_[_0x0476('0x6a')](_0xd4af9a)['join']();logger[_0x0476('0x5c')](_0x0476('0x6b'),_0x431904);fs['writeFileSync'](_0x108971,_0x431904+'\x0a');Papa[_0x0476('0x6c')](fs['createReadStream'](_0x39b924),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e35fe,_0x15bc6a){try{for(var _0xedb345=0x0,_0x5bba30=[];_0xedb345<_0x2e35fe['data'][_0x0476('0x24')];_0xedb345++){stats[_0x0476('0x6d')]+=0x1;if(_0x2e35fe[_0x0476('0x6e')][_0xedb345]){handleError(_0x2e35fe[_0x0476('0x6f')][_0xedb345],_0x2e35fe['errors'][_0xedb345]);}else{var _0x3b0c3e=[];var _0x367ae3=[];var _0x59567b={};for(var _0x484ae6 in _0x127194){let _0x323d3c=contactItemTypes[_0x0476('0x70')](_0x25ce78=>_0x25ce78[_0x0476('0x69')]===_0x484ae6);let _0x3ac11b=contactItemTypes[_0x0476('0x70')](_0x5d19b5=>_0x5d19b5['name']+_0x0476('0x71')===_0x484ae6);if(_[_0x0476('0x1d')](_0x323d3c)&&_[_0x0476('0x1d')](_0x3ac11b)){if(_0x127194[_0x0476('0x72')](_0x484ae6)){if(_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x484ae6]]){var _0x1bbcaa=_[_0x0476('0x73')](_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x484ae6]][_0x0476('0x74')](/"/g,'\x27'));switch(_0x484ae6){case _0x0476('0x75'):var _0x153d3a=moment(_0x1bbcaa,_0x0476('0x76'),!![]);if(_0x153d3a[_0x0476('0x77')]()){_0x5bba30['push']('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0476('0x3b'):var _0x179d7d=parseInt(_0x1bbcaa);_0x1bbcaa=_[_0x0476('0x78')](_0x179d7d)||_0x179d7d<0x0||_0x179d7d>0x4?_0x1a4124?0x3:0x2:_0x179d7d;_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');break;case _0x0476('0x3c'):var _0x10e925=parseInt(_0x1bbcaa);if(_[_0x0476('0x79')](_0x10e925)&&_['includes'](_0x1d166a,_0x10e925)){_0x5bba30['push']('\x22'+_0x10e925+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7a'));}break;case _0x0476('0x7b'):if(isEmail(_0x1bbcaa)){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7c'));}break;case _0x0476('0x7d'):var _0x532109=moment(_0x1bbcaa,'YYYY-MM-DD',!![]);if(_0x532109['isValid']()){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7e'));}break;default:_0x5bba30['push']('\x22'+_0x1bbcaa+'\x22');}}else{switch(_0x484ae6){case _0x0476('0x7f'):case'phone':_0x3b0c3e[_0x0476('0x1f')](_0x484ae6+_0x0476('0x80'));break;default:_0x5bba30['push']('\x22\x22');}}}}else{var _0x42ea12='';if(!_[_0x0476('0x1d')](_0x323d3c)){if(!_0x59567b[_0x0476('0x72')](_0x323d3c['id'])){for(var _0x2cb310=0x0;_0x2cb310<_0x127194[_0x484ae6][_0x0476('0x24')];_0x2cb310++){var _0x1bbcaa=_[_0x0476('0x73')](_0x2e35fe['data'][_0xedb345][_0x127194[_0x484ae6][_0x2cb310]][_0x0476('0x74')](/"/g,'\x27'));var _0x1ad1dd=phoneDescriptions[_0x0476('0x70')](_0x1a628a=>_0x1a628a[_0x0476('0x81')]===_0x323d3c['id']);if(!_[_0x0476('0x1d')](_0x1ad1dd)){var _0x325108=_['trim'](_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x1ad1dd['description']][0x0]][_0x0476('0x74')](/"/g,'\x27'));if(!_[_0x0476('0x1d')](_0x325108))_0x1bbcaa=_0x1bbcaa+'§'+_0x325108;}if(_0x42ea12=='')_0x42ea12=_0x1bbcaa;else _0x42ea12+='|'+_0x1bbcaa;}_0x367ae3['push'](_0x323d3c['id']+':'+_0x42ea12);_0x59567b[_0x323d3c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x367ae3[_0x0476('0x14')](';')+'\x22');}if(_0x3b0c3e[_0x0476('0x24')]){handleError(_0x2e35fe['data'][_0xedb345],{'code':_0x0476('0x82'),'message':_0x3b0c3e['join']()});}else{fs[_0x0476('0x83')](_0x108971,_0x5bba30['join']()+'\x0a');}_0x5bba30=[];}if(!(stats[_0x0476('0x6d')]%0xc8)){socket[_0x0476('0x84')](_0x0476('0x85')+_0xbace5,stats);stats[_0x0476('0x6e')]=[];}}if(stopped){logger[_0x0476('0x5c')]('Abort\x20parser');_0x15bc6a['abort']();}}catch(_0x21024b){handleError(_0x2e35fe[_0x0476('0x6f')][_0xedb345],{'code':_0x0476('0x86'),'message':_0x21024b[_0x0476('0x23')]});logger[_0x0476('0x5d')](_0x0476('0x87'),_0x21024b[_0x0476('0x23')]);}},'complete':function(){try{var _0x587467=[];var _0x1adcfd=tempTableName;_0x587467[_0x0476('0x1f')](_0x0476('0x88')+_0x1adcfd+_0x0476('0x89'));logger[_0x0476('0x5c')]('CIS\x20len',contactItemTypes[_0x0476('0x24')]);var _0x127e4a=util[_0x0476('0xe')](_0x0476('0x8a'),_0x108971,_0x1adcfd,_0x431904,_0x580650[_0x0476('0x46')],_0x580650[_0x0476('0x55')]||null,NOW,NOW);if(_['isNil'](_0x127194[_0x0476('0x75')])){_0x127e4a+=',\x20scheduledAt\x20=\x20NOW()';}_0x587467[_0x0476('0x1f')](_0x127e4a);BPromise[_0x0476('0x8b')](_0x587467,handleQuery)[_0x0476('0x21')](function(_0x39f7a3){BPromise[_0x0476('0x20')]([handleAdditionalPhones()])[_0x0476('0x21')](function(){_0x587467=[];for(var _0x24df6d=0x0;_0x24df6d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','CmContactHasItem','then','update','updated','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','updatedAt','cm_contacts','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','info','Received\x20SIGINT','exit'];(function(_0x1afa27,_0x5797fb){var _0xc82207=function(_0x138720){while(--_0x138720){_0x1afa27['push'](_0x1afa27['shift']());}};_0xc82207(++_0x5797fb);}(_0x7461,0xdb));var _0x1746=function(_0x6a2228,_0x4a1d8b){_0x6a2228=_0x6a2228-0x0;var _0x2d7c81=_0x7461[_0x6a2228];return _0x2d7c81;};'use strict';var fs=require('fs');var path=require(_0x1746('0x0'));var _=require(_0x1746('0x1'));var Papa=require(_0x1746('0x2'));var util=require(_0x1746('0x3'));var BPromise=require(_0x1746('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x1746('0x5'));var logger=require(_0x1746('0x6'))(_0x1746('0x7'));config[_0x1746('0x8')]=_[_0x1746('0x9')](config[_0x1746('0x8')],{'host':_0x1746('0xa'),'port':0x18eb});var socket=require(_0x1746('0xb'))(new Redis(config[_0x1746('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()[_0x1746('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x1746('0xd')+moment()['format'](_0x1746('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x310338){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))*$/[_0x1746('0xf')](_0x310338);}function selectNotIn(_0x42494a,_0x31a21d,_0x25f943,_0x13afc1,_0x3c92a8){return squel[_0x1746('0x10')]()[_0x1746('0x11')](_0x1746('0x12'))[_0x1746('0x13')](_0x13afc1)[_0x1746('0x14')](_0x31a21d,null,_0x31a21d+_0x1746('0x15')+_0x13afc1+'.'+_0x25f943)[_0x1746('0x16')](_0x13afc1+'.'+_0x25f943+_0x1746('0x17')+_0x42494a+'.'+_0x25f943)[_0x1746('0x16')](_0x31a21d+_0x1746('0x18')+_0x3c92a8[_0x1746('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5654d7,_0x3b3ee8){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1746('0x19')][_0x1746('0x1a')](_0x1746('0x1b')+tempTableName)[_0x1746('0x1c')](function(_0x32e67f){if(_0x32e67f!==null){var _0x4a0343=[];for(var _0x25d32c=0x0;_0x25d32c<_0x32e67f[_0x1746('0x1d')];_0x25d32c++){var _0x132b69=_0x32e67f[_0x25d32c];if(!_[_0x1746('0x1e')](_0x132b69[_0x1746('0x12')])){if(!_['isNil'](_0x132b69[_0x1746('0x1f')]))_0x4a0343[_0x1746('0x20')](insertAdditionalPhones(_0x132b69));promisesContact[_0x1746('0x20')]({'contact':_0x132b69});}}}Promise[_0x1746('0x21')](_0x4a0343)['then'](function(){_0x5654d7({'val':0x1});});})[_0x1746('0x22')](function(_0x1726f3){logger[_0x1746('0x23')](_0x1726f3[_0x1746('0x24')]);});});}function insertAdditionalPhones(_0x1e6772){return new Promise(function(_0xab2a5a,_0x28ecc0){var _0xe02594=_0x1e6772[_0x1746('0x1f')];if(_[_0x1746('0x1e')](_0xe02594))_0x28ecc0({'val':0x0});else{var _0x3a2141=_0xe02594[_0x1746('0x25')](';');var _0xb87d6e=[];orderBy=0x0;for(var _0x4b737b=0x0;_0x4b737b<_0x3a2141[_0x1746('0x1d')];_0x4b737b++){_0xb87d6e['push'](splitAdditionalPhone(_0x1e6772['id'],_0x3a2141[_0x4b737b]));}Promise[_0x1746('0x21')](_0xb87d6e)['then'](function(){_0xab2a5a({'val':_0x3a2141[_0x1746('0x1d')]});});}});}function splitAdditionalPhone(_0x4b9ab2,_0x5b7977){return new Promise(function(_0x11df41,_0x188e64){var _0x8127cc=_0x5b7977['split'](':');var _0x4e8f88=_0x8127cc[0x0];var _0x2b67c3=_0x8127cc[0x1];if(_0x2b67c3!==''){var _0xfc5924=_0x2b67c3[_0x1746('0x25')]('|');var _0x4e43c6=[];for(var _0x53f993=0x0;_0x53f993<_0xfc5924[_0x1746('0x1d')];_0x53f993++){if(_0xfc5924[_0x53f993]!==''){var _0x513e31=_['filter'](promisesAdditionalPhones,{'contactId':_0x4b9ab2,'phone':_0xfc5924[_0x53f993]});if(_0x513e31[_0x1746('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x1746('0x20')]({'contactId':_0x4b9ab2,'contactTypeId':_0x4e8f88,'phone':_0xfc5924[_0x53f993],'orderBy':orderBy});}}}_0x11df41({'ok':0x1});}else _0x11df41({'res':0x0});});}function createAdditionalPhone(_0x20dc43,_0x1c4d47,_0x2124f3,_0x41ed0d){var _0xacdd8='';var _0x232fd9='';var _0x585e1c=_0x2124f3[_0x1746('0x25')]('§');_0xacdd8=_0x585e1c[0x0];if(_0x585e1c['length']==0x2)_0x232fd9=_0x585e1c[0x1];return new Promise(function(_0x191c96,_0xaea714){return db[_0x1746('0x26')]['findOne']({'where':{'CmContactId':_0x20dc43,'item':_0xacdd8}})[_0x1746('0x27')](function(_0x21a2d0){if(_0x21a2d0){return db[_0x1746('0x26')][_0x1746('0x28')]({'ItemTypeId':_0x1c4d47,'description':_0x232fd9,'OrderBy':_0x41ed0d},{'where':{'CmContactId':_0x20dc43,'item':_0xacdd8}})[_0x1746('0x27')](function(_0x382c28){_0x191c96({'res':_0x1746('0x29')});});}else{return db[_0x1746('0x26')][_0x1746('0x2a')]({'CmContactId':_0x20dc43,'item':_0xacdd8,'ItemTypeId':_0x1c4d47,'description':_0x232fd9,'OrderBy':_0x41ed0d,'ItemClass':_0x1746('0x2b')})[_0x1746('0x27')](function(_0x5455c9){_0x191c96({'res':_0x1746('0x2c')});});}});});}function updateContact(_0x848c82){return new Promise(function(_0x588fd8,_0x371562){var _0x4120fe=_0x848c82['id'];delete _0x848c82['id'];return db[_0x1746('0x2d')][_0x1746('0x28')](_0x848c82,{'where':{'id':_0x4120fe}})['then'](function(_0x4e590d){updatedRows+=0x1;return db['CmHopper'][_0x1746('0x28')]({'phone':_0x848c82['phone']},{'where':{'ContactId':_0x4120fe}})['then'](function(_0x5c6ee5){_0x588fd8({'ret':'OK'});});});});}function insertCmHopper(_0x3c309e,_0x59eeae,_0x5f3e67,_0x1fceed,_0x24fc19){var _0x5cba9b=[_0x1746('0x2e'),_0x1746('0x2f'),_0x1746('0x30'),_0x1746('0x31'),_0x59eeae+'.'+_0x1fceed,_0x1746('0x32'),_0x1746('0x33'),_0x1746('0x34'),'cm_contacts.UserId','\x22'+_0x24fc19+'\x22'];return squel[_0x1746('0x35')]()[_0x1746('0x36')](_0x1746('0x37'))[_0x1746('0x38')]([_0x1746('0x12'),_0x1746('0x39'),_0x1746('0x3a'),_0x1746('0x3b'),_0x1fceed,_0x1746('0x3c'),'updatedAt',_0x1746('0x3d'),_0x1746('0x3e'),_0x1746('0x3f')],squel['select']()[_0x1746('0x40')](_0x5cba9b)[_0x1746('0x13')](_0x59eeae)[_0x1746('0x14')]('cm_contacts',null,_0x1746('0x41')+_0x59eeae+_0x1746('0x42'))[_0x1746('0x14')](_0x5f3e67,null,_0x5f3e67+_0x1746('0x15')+_0x59eeae+'.'+_0x1fceed)['where'](_0x59eeae+_0x1746('0x43'),_0x3c309e)[_0x1746('0x16')](_0x1746('0x44'),NOW)[_0x1746('0x16')](_0x1746('0x45'),selectNotIn(_0x59eeae,_0x5f3e67,_0x1fceed,'cm_hopper',[_0x1746('0x46'),_0x1746('0x47')]))[_0x1746('0x16')](_0x1746('0x45'),selectNotIn(_0x59eeae,_0x5f3e67,_0x1fceed,_0x1746('0x37'),[_0x1746('0x46')])))[_0x1746('0x48')]();}function insertCmHopperBlack(_0x3f3eaf,_0xa9de16,_0x507ef6,_0x1589bd){var _0x197617=['cm_contacts.phone',_0x1746('0x30'),'cm_contacts.ListId',_0xa9de16+'.'+_0x1589bd,'cm_contacts.createdAt',_0x1746('0x33')];return squel[_0x1746('0x35')]()[_0x1746('0x36')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x1746('0x3b'),_0x1589bd,_0x1746('0x3c'),_0x1746('0x49')],squel[_0x1746('0x10')]()[_0x1746('0x40')](_0x197617)[_0x1746('0x13')](_0xa9de16)[_0x1746('0x14')](_0x1746('0x4a'),null,'cm_contacts.ListId\x20=\x20'+_0xa9de16+'.CmListId')[_0x1746('0x14')](_0x507ef6,null,_0x507ef6+_0x1746('0x15')+_0xa9de16+'.'+_0x1589bd)['where'](_0xa9de16+_0x1746('0x43'),_0x3f3eaf)['where'](_0x1746('0x44'),NOW)[_0x1746('0x16')](_0x1746('0x45'),squel[_0x1746('0x10')]()[_0x1746('0x11')](_0x1746('0x12'))[_0x1746('0x13')](_0x1746('0x4b'))['where'](_0x1746('0x4c'),_0x3f3eaf)['where'](_0x1589bd+_0x1746('0x4d'),_0xa9de16+'.'+_0x1589bd)))[_0x1746('0x48')]();}function insertCmHopperAdditionalPhones(_0x4e587e){var _0x54ce4e=[_0x1746('0x4e'),'cm_contact_has_items.item',_0x1746('0x4f'),'cm_contact_has_items.createdAt',_0x1746('0x50')];return squel[_0x1746('0x35')]()['into'](_0x1746('0x51'))[_0x1746('0x38')]([_0x1746('0x52'),'phone',_0x1746('0x53'),_0x1746('0x3c'),_0x1746('0x49')],squel[_0x1746('0x10')]()[_0x1746('0x40')](_0x54ce4e)['from'](_0x1746('0x37'))[_0x1746('0x14')](_0x1746('0x4a'),null,_0x1746('0x54'))['join']('cm_contact_has_items',null,_0x1746('0x55'))[_0x1746('0x16')](_0x1746('0x56'),_0x4e587e)[_0x1746('0x16')](_0x1746('0x44'),NOW))[_0x1746('0x48')]();}function insertCmContact(_0x4a3971,_0x3dd234,_0x12175a,_0x35546a){var _0x236c98=_[_0x1746('0x57')](_[_0x1746('0x58')](_0x35546a),[_0x1746('0x3b'),'CompanyId',_0x1746('0x3c'),_0x1746('0x49')]);return squel['insert']()[_0x1746('0x36')]('cm_contacts')[_0x1746('0x38')](_0x236c98,squel['select']()[_0x1746('0x40')](_0x236c98)[_0x1746('0x13')](_0x3dd234)[_0x1746('0x16')]('('+_0x12175a['join'](',')+_0x1746('0x59'),squel[_0x1746('0x10')]()[_0x1746('0x40')](_0x12175a)[_0x1746('0x13')](_0x1746('0x4a'))[_0x1746('0x16')](_0x1746('0x4c'),_0x4a3971))[_0x1746('0x16')](_0x1746('0x5a'),squel['select']()[_0x1746('0x11')]('MIN(id)',_0x1746('0x5b'))[_0x1746('0x13')](_0x3dd234)['group'](_0x12175a[_0x1746('0x14')](','))))[_0x1746('0x48')]();}function handleStop(){logger[_0x1746('0x5c')](_0x1746('0x5d'));stopped=!![];}function handleUncaughtException(_0x1bd5a3){logger[_0x1746('0x23')](_0x1bd5a3[_0x1746('0x24')]);process[_0x1746('0x5e')](0x1);}function handleError(_0x5de38b,_0x29da42){stats[_0x1746('0x5f')][_0x1746('0x20')]({'name':_0x29da42[_0x1746('0x60')],'message':_0x29da42['message'],'row':_0x5de38b});}function handleQuery(_0xb861){logger[_0x1746('0x5c')](_0xb861);return db[_0x1746('0x19')]['query'](_0xb861)['spread'](function(_0x248654){results[_0x1746('0x20')](_0x248654);})[_0x1746('0x22')](function(_0x5ac626){logger[_0x1746('0x23')](_0x5ac626[_0x1746('0x24')]);});}function main(_0x46b111,_0x38616d,_0x3b591a,_0x1d0de6){logger[_0x1746('0x5c')](_0x1746('0x61'),_0x46b111,JSON[_0x1746('0x62')](_0x38616d));process['send']('start');var _0x513e23=_0x38616d[_0x1746('0x63')];var _0x464031=_[_0x1746('0x64')](_0x513e23);var _0x1eb804=_0x38616d['socket_timestamp'];var _0x283ad4=path['join'](config[_0x1746('0x65')],_0x1746('0x66'),_0x1eb804+_0x1746('0x67'));logger['info'](_0x1746('0x68'),_0x38616d);db[_0x1746('0x69')][_0x1746('0x6a')]({'raw':!![],'attributes':['id','name']})[_0x1746('0x27')](function(_0x4d4461){for(var _0x11276a=0x0;_0x11276a<_0x4d4461['length'];_0x11276a++){if(_0x4d4461[_0x11276a][_0x1746('0x6b')]in _0x513e23){contactItemTypes[_0x1746('0x20')](_0x4d4461[_0x11276a]);delete _0x464031[_0x4d4461[_0x11276a][_0x1746('0x6b')]];hasAdditionalPhones=!![];}for(var _0x1e7ebd in _0x513e23){if(_0x4d4461[_0x11276a][_0x1746('0x6b')]+'_description'===_0x1e7ebd){phoneDescriptions[_0x1746('0x20')]({'itemTypeId':_0x4d4461[_0x11276a]['id'],'description':_0x1e7ebd});delete _0x464031[_0x1e7ebd];}}}if(hasAdditionalPhones)_0x464031['AdditionalPhones']='';var _0x3bd692=_[_0x1746('0x58')](_0x464031)[_0x1746('0x14')]();logger[_0x1746('0x5c')](_0x1746('0x6c'),_0x3bd692);fs[_0x1746('0x6d')](_0x283ad4,_0x3bd692+'\x0a');Papa[_0x1746('0x6e')](fs['createReadStream'](_0x46b111),{'header':!![],'skipEmptyLines':!![],'step':function(_0x376bf0,_0x353336){try{for(var _0x797f0f=0x0,_0x221782=[];_0x797f0f<_0x376bf0[_0x1746('0x6f')][_0x1746('0x1d')];_0x797f0f++){stats[_0x1746('0x70')]+=0x1;if(_0x376bf0[_0x1746('0x5f')][_0x797f0f]){handleError(_0x376bf0[_0x1746('0x6f')][_0x797f0f],_0x376bf0[_0x1746('0x5f')][_0x797f0f]);}else{var _0x145c23=[];var _0x5dcba9=[];var _0x3bf108={};for(var _0x380c35 in _0x513e23){let _0x30ae67=contactItemTypes[_0x1746('0x71')](_0x70ca60=>_0x70ca60[_0x1746('0x6b')]===_0x380c35);let _0x3a6916=contactItemTypes[_0x1746('0x71')](_0x2f3688=>_0x2f3688[_0x1746('0x6b')]+_0x1746('0x72')===_0x380c35);if(_['isNil'](_0x30ae67)&&_['isNil'](_0x3a6916)){if(_0x513e23['hasOwnProperty'](_0x380c35)){if(_0x376bf0[_0x1746('0x6f')][_0x797f0f][_0x513e23[_0x380c35]]){var _0x14f8bb=_[_0x1746('0x73')](_0x376bf0[_0x1746('0x6f')][_0x797f0f][_0x513e23[_0x380c35]][_0x1746('0x74')](/"/g,'\x27'));switch(_0x380c35){case _0x1746('0x39'):var _0x4ecc2c=moment(_0x14f8bb,_0x1746('0x75'),!![]);if(_0x4ecc2c['isValid']()){_0x221782[_0x1746('0x20')]('\x22'+_0x14f8bb+'\x22');}else{_0x145c23[_0x1746('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x520e2a=parseInt(_0x14f8bb);_0x14f8bb=_[_0x1746('0x76')](_0x520e2a)||_0x520e2a<0x0||_0x520e2a>0x4?_0x1d0de6?0x3:0x2:_0x520e2a;_0x221782[_0x1746('0x20')]('\x22'+_0x14f8bb+'\x22');break;case _0x1746('0x3e'):var _0x41bcb1=parseInt(_0x14f8bb);if(_[_0x1746('0x77')](_0x41bcb1)&&_['includes'](_0x3b591a,_0x41bcb1)){_0x221782[_0x1746('0x20')]('\x22'+_0x41bcb1+'\x22');}else{_0x145c23[_0x1746('0x20')](_0x1746('0x78'));}break;case _0x1746('0x79'):if(isEmail(_0x14f8bb)){_0x221782[_0x1746('0x20')]('\x22'+_0x14f8bb+'\x22');}else{_0x145c23['push'](_0x1746('0x7a'));}break;case _0x1746('0x7b'):var _0x219ac5=moment(_0x14f8bb,'YYYY-MM-DD',!![]);if(_0x219ac5[_0x1746('0x7c')]()){_0x221782[_0x1746('0x20')]('\x22'+_0x14f8bb+'\x22');}else{_0x145c23['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x221782[_0x1746('0x20')]('\x22'+_0x14f8bb+'\x22');}}else{switch(_0x380c35){case _0x1746('0x7d'):case _0x1746('0x12'):_0x145c23[_0x1746('0x20')](_0x380c35+_0x1746('0x7e'));break;default:_0x221782[_0x1746('0x20')]('\x22\x22');}}}}else{var _0x78dc='';if(!_[_0x1746('0x1e')](_0x30ae67)){if(!_0x3bf108[_0x1746('0x7f')](_0x30ae67['id'])){for(var _0x336b84=0x0;_0x336b84<_0x513e23[_0x380c35][_0x1746('0x1d')];_0x336b84++){var _0x14f8bb=_[_0x1746('0x73')](_0x376bf0[_0x1746('0x6f')][_0x797f0f][_0x513e23[_0x380c35][_0x336b84]][_0x1746('0x74')](/"/g,'\x27'));var _0x3a2720=phoneDescriptions['find'](_0x2ccc65=>_0x2ccc65['itemTypeId']===_0x30ae67['id']);if(!_[_0x1746('0x1e')](_0x3a2720)){var _0x16b3c6=_[_0x1746('0x73')](_0x376bf0['data'][_0x797f0f][_0x513e23[_0x3a2720[_0x1746('0x80')]][0x0]][_0x1746('0x74')](/"/g,'\x27'));if(!_[_0x1746('0x1e')](_0x16b3c6))_0x14f8bb=_0x14f8bb+'§'+_0x16b3c6;}if(_0x78dc=='')_0x78dc=_0x14f8bb;else _0x78dc+='|'+_0x14f8bb;}_0x5dcba9[_0x1746('0x20')](_0x30ae67['id']+':'+_0x78dc);_0x3bf108[_0x30ae67['id']]=0x1;}}}}if(hasAdditionalPhones){_0x221782['push']('\x22'+_0x5dcba9[_0x1746('0x14')](';')+'\x22');}if(_0x145c23[_0x1746('0x1d')]){handleError(_0x376bf0['data'][_0x797f0f],{'code':_0x1746('0x81'),'message':_0x145c23[_0x1746('0x14')]()});}else{fs[_0x1746('0x82')](_0x283ad4,_0x221782[_0x1746('0x14')]()+'\x0a');}_0x221782=[];}if(!(stats[_0x1746('0x70')]%0xc8)){socket['emit'](_0x1746('0x83')+_0x1eb804,stats);stats['errors']=[];}}if(stopped){logger[_0x1746('0x5c')](_0x1746('0x84'));_0x353336['abort']();}}catch(_0xed7bf9){handleError(_0x376bf0[_0x1746('0x6f')][_0x797f0f],{'code':_0x1746('0x85'),'message':_0xed7bf9[_0x1746('0x24')]});logger[_0x1746('0x23')](_0x1746('0x86'),_0xed7bf9['message']);}},'complete':function(){try{var _0x1f7b34=[];var _0x4b1c19=tempTableName;_0x1f7b34[_0x1746('0x20')](_0x1746('0x87')+_0x4b1c19+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes['length']);var _0x3f35e1=util[_0x1746('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',_0x283ad4,_0x4b1c19,_0x3bd692,_0x38616d[_0x1746('0x3b')],_0x38616d[_0x1746('0x88')]||null,NOW,NOW);if(_[_0x1746('0x1e')](_0x513e23[_0x1746('0x39')])){_0x3f35e1+=',\x20scheduledAt\x20=\x20NOW()';}_0x1f7b34[_0x1746('0x20')](_0x3f35e1);BPromise[_0x1746('0x89')](_0x1f7b34,handleQuery)[_0x1746('0x27')](function(_0x176225){BPromise['all']([handleAdditionalPhones()])[_0x1746('0x27')](function(){_0x1f7b34=[];for(var _0x43a1f9=0x0;_0x43a1f9\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x7980,0xab));var _0x0798=function(_0x1d443b,_0x2a97ca){_0x1d443b=_0x1d443b-0x0;var _0x587b9a=_0x7980[_0x1d443b];return _0x587b9a;};'use strict';var _=require(_0x0798('0x0'));var squel=require(_0x0798('0x1'));var as=require(_0x0798('0x2'));var qs=require(_0x0798('0x3'));var updateInteraction=require(_0x0798('0x4'))['updateInteraction'];var utils=require(_0x0798('0x5'));var db=require(_0x0798('0x6'))['db'];function skipInteractionsQuery(_0xecc24f,_0x1637db,_0x1a1fe7){var _0x581bf3=![];var _0x22a0f0=utils['getAccountFK'](_0xecc24f);if(_0x1637db[_0x0798('0x7')]===_0x0798('0x8')&&!_0x1a1fe7[_0x0798('0x9')]&&!_0x1a1fe7[_0x22a0f0]){_0x581bf3=!![];}return _0x581bf3;}function getTagsQuery(){return squel['select']()['field']('id')[_0x0798('0xa')](_0x0798('0xb'))[_0x0798('0xa')](_0x0798('0xc'))[_0x0798('0xd')](_0x0798('0xe'));}function getUsersQuery(_0x44e8df,_0xc9b741){var _0x35bfbe=utils[_0x0798('0xf')](_0x44e8df);var _0x597e45=_0x0798('0x10')+_0x44e8df+_0x0798('0x11');var _0x587d18=squel['select']()[_0x0798('0xa')](_0x0798('0x12'))[_0x0798('0xa')](_0x0798('0x13'))[_0x0798('0xa')](_0x0798('0x14')+_0x35bfbe)[_0x0798('0xd')](_0x597e45,'ui')['left_join']('users','u',_0x0798('0x15'));if(_0xc9b741[_0x0798('0x16')]>0x0){_0x587d18['where']('ui.'+_0x35bfbe+_0x0798('0x17'),_[_0x0798('0x18')](_0xc9b741,'id'));}return _0x587d18;}function getInteractionsQuery(_0x258081){var _0x5dc617=utils['getInteractionsTables'](_0x258081);var _0x1c6d6f=utils['getAccountFK'](_0x258081);var _0x41e217=utils[_0x0798('0xf')](_0x258081);return squel[_0x0798('0x19')]()[_0x0798('0xd')](_0x5dc617['interactions'],'i')[_0x0798('0x1a')](_0x0798('0x1b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0798('0x1a')](_0x0798('0x1c'),'o',_0x0798('0x1d'))[_0x0798('0x1a')](_0x5dc617[_0x0798('0x1e')],'a',_0x0798('0x1f')+_0x1c6d6f)[_0x0798('0x1a')](_0x5dc617[_0x0798('0x20')],'me',_0x0798('0x21')+_0x41e217+'\x20=\x20i.id')[_0x0798('0x1a')](_0x5dc617[_0x0798('0x22')],'it',_0x0798('0x23')+_0x41e217+_0x0798('0x24'))[_0x0798('0x1a')](_0x0798('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3f66e2={'body':squel[_0x0798('0x25')](),'contact':squel[_0x0798('0x25')](),'default':squel[_0x0798('0x25')](),'fields':squel[_0x0798('0x25')](),'filter':squel[_0x0798('0x25')](),'read':squel['expr'](),'tags':{'clause':squel[_0x0798('0x25')](),'ids':null},'user':squel[_0x0798('0x25')]()};return _0x3f66e2;}function parseTagParameter(_0x11e24d){var _0x4d4e0a=squel[_0x0798('0x25')]();if(_0x11e24d){var _0x5e7246=utils['getSelectedTags'](_0x11e24d);_0x5e7246[_0x0798('0x26')](function(_0x2dfbff){_0x4d4e0a['or'](_0x0798('0x27'),'%,'+_0x2dfbff+',%');});}return _0x4d4e0a;}function parseReadParameter(_0xaa949b){var _0x11b7f4='';if(_0xaa949b){_0x11b7f4=_0x0798('0x28');if(_0xaa949b==='1'){_0x11b7f4=_0x11b7f4[_0x0798('0x29')](_0x0798('0x2a'),'=');}else{_0x11b7f4=_0x11b7f4['replace'](_0x0798('0x2a'),'>');}}return _0x11b7f4;}function parseSearchFilter(_0x4f5d1d,_0x5f1780){var _0x1196c0=squel['expr']();if(_0x5f1780){var _0x1dabd5=_0x5f1780['replace']('\x5c','\x5c\x5c')[_0x0798('0x29')](/'/g,'\x27\x27');if(qs[_0x0798('0x2b')](_0x1dabd5)){_0x1196c0['or'](_0x0798('0x2c'),_0x1dabd5+'%');if([_0x0798('0x2d'),_0x0798('0x2e')][_0x0798('0x2f')](_0x4f5d1d)){_0x1196c0['or'](_0x0798('0x30'),_0x1dabd5+'%');}else if(_0x4f5d1d===_0x0798('0x31')){_0x1196c0['or'](_0x0798('0x32'),_0x1dabd5+'%');}else if(_0x4f5d1d===_0x0798('0x33')){_0x1196c0['or'](_0x0798('0x34'),_0x1dabd5+'%');}}else if(_0x4f5d1d===_0x0798('0x35')&&qs['isEmail'](_0x1dabd5)){_0x1196c0['or'](_0x0798('0x36'),_0x1dabd5+'%');}else{if(_0x4f5d1d==='mail'){_0x1196c0['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0798('0x37')](_0x1dabd5))['or'](_0x0798('0x38'),qs['getFullTextValue'](_0x1dabd5));}else{if(_0x4f5d1d!=='fax'){_0x1196c0['or'](_0x0798('0x39'),qs[_0x0798('0x37')](_0x1dabd5));}_0x1196c0['or'](_0x0798('0x3a'),_0x1dabd5+'%');}}}return _0x1196c0;}function parseAdvancedSearchFilter(_0xade271,_0xae5843){var _0x2ad922=getSqlClauses();var _0x5db6b3=as['parseSearch'](_0xade271);var _0x1db045=_0x5db6b3[_0x0798('0x3b')];for(var _0x27d9f7=0x0;_0x27d9f7<_0x5db6b3['conditions']['length'];_0x27d9f7++){var _0x533e99=_0x5db6b3[_0x0798('0x3c')][_0x27d9f7];var _0x154980='i';var _0x1194da=_[_0x0798('0x3d')](_0xae5843,[_0x0798('0xb'),_0x533e99[_0x0798('0xa')]]);if(_0x1194da){var _0x238c99=as[_0x0798('0x3e')](_0x154980,_0x1194da['type'],_0x533e99);_0x2ad922[_0x0798('0x3f')][_0x1db045](_0x238c99['text'],_0x238c99[_0x0798('0x40')][_0x0798('0x41')],_0x238c99[_0x0798('0x40')]['end']);}else{switch(_0x533e99[_0x0798('0xa')]){case'unreadMessages':var _0x3538f5=parseReadParameter(_0x533e99[_0x0798('0x40')]);_0x2ad922[_0x0798('0x42')]['and'](_0x3538f5);break;case _0x0798('0x43'):if(_0x533e99[_0x0798('0x44')]==='$substring'){if(_0x533e99[_0x0798('0x40')]['split']('\x20')['length']>0x1){_0x2ad922[_0x0798('0x45')][_0x1db045](_0x0798('0x46'),qs['getFullTextValue'](_0x533e99['value']),null);}else{var _0xa46124='%'+_0x533e99[_0x0798('0x40')]+'%';_0x2ad922[_0x0798('0x45')][_0x1db045](_0x0798('0x47'),_0xa46124,_0xa46124,_0xa46124);}}else{_0x1194da=_[_0x0798('0x3d')](_0xae5843,[_0x0798('0xb'),_0x0798('0x48')]);_0x533e99['field']=_0x0798('0x48');_0x238c99=as[_0x0798('0x3e')](_0x154980,_0x1194da[_0x0798('0x49')],_0x533e99);_0x2ad922[_0x0798('0x45')][_0x1db045](_0x238c99[_0x0798('0x4a')],_0x238c99[_0x0798('0x40')]['start'],_0x238c99[_0x0798('0x40')][_0x0798('0x4b')]);}break;case _0x0798('0x4c'):var _0x2eb3c1=_0x533e99[_0x0798('0x40')][_0x0798('0x4d')](',')[_0x0798('0x18')](function(_0x10a50a){return Number(_0x10a50a);});var _0x3f1beb=parseTagParameter(_0x2eb3c1);_0x2ad922[_0x0798('0x4e')][_0x0798('0x4f')][_0x0798('0x50')](_0x3f1beb);_0x2ad922['tags'][_0x0798('0x51')]=_0x2eb3c1;break;case _0x0798('0x52'):if(_0x533e99[_0x0798('0x44')]===_0x0798('0x53')){_0x2ad922['user'][_0x1db045]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x533e99[_0x0798('0x40')]+'%',null);}else{_0x1194da=_[_0x0798('0x3d')](_0xae5843,[_0x0798('0xb'),_0x0798('0x54')]);_0x533e99['field']=_0x0798('0x54');_0x238c99=as['buildExpression'](_0x154980,_0x1194da['type'],_0x533e99);_0x2ad922[_0x0798('0x55')][_0x1db045](_0x238c99[_0x0798('0x4a')],_0x238c99[_0x0798('0x40')][_0x0798('0x41')],_0x238c99[_0x0798('0x40')][_0x0798('0x4b')]);}break;case _0x0798('0x56'):case _0x0798('0x57'):_0x238c99=as[_0x0798('0x3e')]('me',null,_0x533e99);_0x2ad922['body'][_0x1db045](_0x238c99[_0x0798('0x4a')],_0x238c99['value'][_0x0798('0x41')],_0x238c99[_0x0798('0x40')][_0x0798('0x4b')]);break;}}}return _0x2ad922;}function parseModelFields(_0x54634d,_0x9dea1f,_0x275e6e){var _0x1a1145=utils[_0x0798('0x58')](_0x54634d);var _0x4864b9=squel[_0x0798('0x25')]();var _0x9e6db6=_(_0x9dea1f)[_0x0798('0x59')]()[_0x0798('0x18')](function(_0x374555){return _['some'](_0x275e6e,[_0x0798('0xb'),_0x374555])?_0x374555:undefined;})[_0x0798('0x5a')]()[_0x0798('0x40')]();if(_0x9e6db6[_0x0798('0x16')]>0x0){_0x9e6db6[_0x0798('0x26')](function(_0x2978d6){if(_0x2978d6===_0x1a1145){_0x4864b9[_0x0798('0x50')]('i.'+_0x1a1145+_0x0798('0x17'),[][_0x0798('0x5b')](_0x9dea1f[_0x2978d6]));}else if(_0x2978d6==='createdAt'){var _0x50aaea=JSON[_0x0798('0x5c')](_0x9dea1f[_0x2978d6])[_0x0798('0x5d')];var _0x375f11=JSON[_0x0798('0x5c')](_0x9dea1f[_0x2978d6])[_0x0798('0x5e')];_0x4864b9[_0x0798('0x50')](_0x0798('0x5f'),_0x50aaea,_0x375f11);}else{if(_0x9dea1f[_0x2978d6]==='null'){_0x4864b9[_0x0798('0x50')]('i.'+_0x2978d6+'\x20IS\x20NULL');}else{_0x4864b9[_0x0798('0x50')]('i.'+_0x2978d6+_0x0798('0x60'),_0x9dea1f[_0x2978d6]);}}});}return _0x4864b9;}function parseQueryParameters(_0x3a3cc7,_0x48a072,_0x4d16da){var _0x4fe41b=getSqlClauses();return Promise[_0x0798('0x61')]()['then'](function(){return parseModelFields(_0x3a3cc7,_0x48a072,_0x4d16da);})['then'](function(_0x35a576){_0x4fe41b[_0x0798('0x62')][_0x0798('0x50')](_0x35a576);return parseReadParameter(_0x48a072['read']);})[_0x0798('0x63')](function(_0x46532d){_0x4fe41b[_0x0798('0x42')][_0x0798('0x50')](_0x46532d);return parseTagParameter(_0x48a072['tag']);})['then'](function(_0x136a1f){_0x4fe41b[_0x0798('0x4e')][_0x0798('0x4f')]['and'](_0x136a1f);return parseSearchFilter(_0x3a3cc7,_0x48a072['filter']);})[_0x0798('0x63')](function(_0x82599){_0x4fe41b[_0x0798('0x64')]=_0x82599;return _0x4fe41b;});}function checkAccountsRestrictions(_0x190467,_0x218c56,_0xce8a72){var _0x18c0fa=utils[_0x0798('0x58')](_0x190467);var _0x4f35c7=_0x0798('0x65')+_[_0x0798('0x66')](_0x190467)+(_0x190467==='chat'?_0x0798('0x67'):_0x0798('0x68'));var _0x57ddec=squel[_0x0798('0x25')]();return Promise[_0x0798('0x61')]()[_0x0798('0x63')](function(){if(_0xce8a72[_0x0798('0x9')]&&_0x218c56[_0x0798('0x7')]==='agent'){return _0x218c56[_0x4f35c7]({'attributes':['id'],'raw':!![]});}})[_0x0798('0x63')](function(_0x3b36b5){if(_0x3b36b5){if(_0x3b36b5[_0x0798('0x16')]===0x0){_0x57ddec['and']('i.'+_0x18c0fa+_0x0798('0x69'));}else{_0x57ddec['and']('i.'+_0x18c0fa+_0x0798('0x17'),_[_0x0798('0x18')](_0x3b36b5,'id'));}}else if(!_0xce8a72[_0x18c0fa]){_0x57ddec[_0x0798('0x50')]('i.'+_0x18c0fa+_0x0798('0x6a'));}})[_0x0798('0x63')](function(){return _0x57ddec;});}function getClosedOrderClause(_0x3569e8,_0x5b90ca){var _0x3cc8bd='';var _0xae453a=[_0x0798('0x6b'),_0x0798('0x6c'),'i.disposition'];if(_0x3569e8===_0x0798('0x35')){_0xae453a[_0x0798('0x6d')](_0x0798('0x6e'));}if(_0x5b90ca[_0x0798('0x6f')]==='0'&&_0x3569e8===_0x0798('0x35')){_0x3cc8bd='i.substatus';}else{if(_0x5b90ca[_0x0798('0x6f')]==='1'){_0xae453a[_0x0798('0x70')]();}_0x3cc8bd='CONCAT_WS(\x27\x27,\x20'+_0xae453a[_0x0798('0x71')](',\x20')+')';}return _0x3cc8bd;}function getFilteredInteractions(_0x2d7c96,_0x437e1d,_0x4fcdb4,_0x2f336a){var _0x151565=utils[_0x0798('0xf')](_0x2d7c96);var _0x897ae4=_[_0x0798('0x66')](_0x2d7c96)+_0x0798('0x72');var _0x21c156=[];var _0x41b369=getTagsQuery();var _0x4a4853={'type':db[_0x0798('0x73')][_0x0798('0x74')][_0x0798('0x75')],'raw':!![]};var _0xf5100e=[];var _0x4ad8a1=[];return db[_0x0798('0x76')][_0x0798('0x77')](_0x41b369[_0x0798('0x78')](),_0x4a4853)[_0x0798('0x63')](function(_0x2e34e4){_0x21c156=_[_0x0798('0x79')](_0x2e34e4,'id');_0x4a4853=_[_0x0798('0x7a')](_0x4a4853,{'model':db[_0x897ae4],'mapToModel':!![],'nest':!![]});if(_0x4fcdb4[_0x0798('0x62')]){_0x2f336a['attributes'][_0x0798('0x26')](function(_0x4d594f){_0x437e1d[_0x0798('0xa')]('i.'+_0x4d594f);});}else{_0x437e1d[_0x0798('0xa')](_0x0798('0x7b'),'unreadMessages');_0x437e1d[_0x0798('0xa')](_0x0798('0x7c'),'Account.key');_0x437e1d[_0x0798('0xa')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x2d7c96===_0x0798('0x35')){_0x437e1d[_0x0798('0xa')](_0x0798('0x7d'),_0x0798('0x7e'));_0x437e1d['field'](_0x0798('0x7f'),_0x0798('0x80'));_0x437e1d[_0x0798('0xa')](_0x0798('0x81'));_0x437e1d[_0x0798('0xa')](_0x0798('0x82'));_0x437e1d[_0x0798('0xa')]('i.updatedAt');_0x437e1d['field']('i.closed');_0x437e1d[_0x0798('0xa')](_0x0798('0x83'));_0x437e1d[_0x0798('0xa')](_0x0798('0x84'));_0x437e1d['field'](_0x0798('0x85'));_0x437e1d[_0x0798('0xa')]('i.lastMsgDirection');_0x437e1d[_0x0798('0xa')]('i.subject');_0x437e1d[_0x0798('0xa')]('i.disposition');_0x437e1d[_0x0798('0xa')](_0x0798('0x6c'));_0x437e1d[_0x0798('0xa')](_0x0798('0x6b'));_0x437e1d[_0x0798('0xa')](_0x0798('0x6e'));_0x437e1d[_0x0798('0xa')](_0x0798('0x86'));_0x437e1d['field'](_0x0798('0x87'));_0x437e1d['field'](_0x0798('0x88'));_0x437e1d[_0x0798('0xa')]('i.UserId');}else if(_0x2d7c96===_0x0798('0x33')){_0x437e1d[_0x0798('0xa')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x0798('0x80'));}else{_0x437e1d['field'](_0x0798('0x89'),_0x0798('0x80'));}if(_0x2d7c96!==_0x0798('0x35')){_0x437e1d['field'](_0x0798('0x8a'));}_0x437e1d[_0x0798('0xa')](_0x0798('0x8b'),_0x0798('0x8c'));_0x437e1d['field'](_0x0798('0x8d'),_0x0798('0x8e'));_0x437e1d[_0x0798('0xa')](_0x0798('0x8f'),_0x0798('0x90'));_0x437e1d[_0x0798('0xa')]('c.phone','Contact.phone');_0x437e1d[_0x0798('0xa')](_0x0798('0x91'),_0x0798('0x92'));_0x437e1d[_0x0798('0xa')](_0x0798('0x93'),_0x0798('0x94'));_0x437e1d['field']('o.fullname',_0x0798('0x95'));_0x437e1d[_0x0798('0xa')]('o.internal',_0x0798('0x96'));_0x437e1d[_0x0798('0xa')](_0x0798('0x97'),_0x0798('0x98'));}if(_0x2f336a[_0x0798('0x99')]){_0x437e1d[_0x0798('0x99')](_0x2f336a['limit']);}if(_0x2f336a[_0x0798('0x9a')]){_0x437e1d[_0x0798('0x9a')](_0x2f336a[_0x0798('0x9a')]);}return db[_0x0798('0x76')][_0x0798('0x77')](_0x437e1d[_0x0798('0x78')](),_0x4a4853);})['then'](function(_0x2c68ba){_0xf5100e=_0x2c68ba;var _0x3ff179=getUsersQuery(_0x2d7c96,_0xf5100e);return db[_0x0798('0x76')][_0x0798('0x77')](_0x3ff179['toString'](),_0x4a4853);})[_0x0798('0x63')](function(_0x25f8d3){_0x4ad8a1=_['groupBy'](_0x25f8d3,_0x151565);if(_0x2d7c96===_0x0798('0x35')){return db[_0x0798('0x9b')][_0x0798('0x9c')]({'attributes':[_0x0798('0x9d')],'raw':!![]});}})[_0x0798('0x63')](function(_0x92abd7){var _0x573236=_0x92abd7?_0x92abd7[_0x0798('0x9d')]:undefined;var _0x174e5c=_0xf5100e['map'](function(_0x587b84){return updateInteraction(_0x587b84,_0x21c156,_0x4ad8a1,_0x573236);});return Promise[_0x0798('0x9e')](_0x174e5c);});}function countFilteredInteractions(_0x53394f,_0x4563b4){var _0x44b87d=_0x53394f['clone']();_0x44b87d['field'](_0x0798('0x9f'));_0x44b87d['field'](_0x0798('0x7b'),'unreadMessages');var _0x5533e6=utils['getSelectedTags'](_0x4563b4);if(!_[_0x0798('0xa0')](_0x5533e6)){_0x44b87d['where'](_0x0798('0xa1'),_0x5533e6);}var _0x2b0879={'type':db['Sequelize']['QueryTypes'][_0x0798('0x75')],'raw':!![]};return db[_0x0798('0x76')][_0x0798('0x77')](_0x44b87d[_0x0798('0x78')](),_0x2b0879);}module[_0x0798('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x80d9=['i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','TagIds','limit','offset','sequelize','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','_interactions','u.id','u.fullname','ui.','from','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionFK','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.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','text','value','end','read','and','Contact','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','start','Tag','split','tags','clause','ids','User','operator','$substring','UserId','buildExpression','body','plainBody','keys','map','compact','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','chat','Accounts','role','agent','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','query','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection'];(function(_0x55925e,_0x197d83){var _0x26c221=function(_0x1e9efe){while(--_0x1e9efe){_0x55925e['push'](_0x55925e['shift']());}};_0x26c221(++_0x197d83);}(_0x80d9,0x15c));var _0x980d=function(_0x489fbe,_0x25fd49){_0x489fbe=_0x489fbe-0x0;var _0x58568e=_0x80d9[_0x489fbe];return _0x58568e;};'use strict';var _=require(_0x980d('0x0'));var squel=require('squel');var as=require(_0x980d('0x1'));var qs=require(_0x980d('0x2'));var updateInteraction=require(_0x980d('0x3'))['updateInteraction'];var utils=require(_0x980d('0x4'));var db=require(_0x980d('0x5'))['db'];function skipInteractionsQuery(_0x38d1b9,_0x279d93,_0x290800){var _0x4a1d3f=![];var _0x4c3533=utils[_0x980d('0x6')](_0x38d1b9);if(_0x279d93['role']==='agent'&&!_0x290800[_0x980d('0x7')]&&!_0x290800[_0x4c3533]){_0x4a1d3f=!![];}return _0x4a1d3f;}function getTagsQuery(){return squel[_0x980d('0x8')]()[_0x980d('0x9')]('id')[_0x980d('0x9')](_0x980d('0xa'))[_0x980d('0x9')](_0x980d('0xb'))['from']('tools_tags');}function getUsersQuery(_0x533b8c,_0x43a0d8){var _0x10872c=utils['getInteractionFK'](_0x533b8c);var _0x1c8a14='user_has_'+_0x533b8c+_0x980d('0xc');var _0x52cd18=squel[_0x980d('0x8')]()[_0x980d('0x9')](_0x980d('0xd'))[_0x980d('0x9')](_0x980d('0xe'))[_0x980d('0x9')](_0x980d('0xf')+_0x10872c)[_0x980d('0x10')](_0x1c8a14,'ui')['left_join'](_0x980d('0x11'),'u',_0x980d('0x12'));if(_0x43a0d8[_0x980d('0x13')]>0x0){_0x52cd18[_0x980d('0x14')](_0x980d('0xf')+_0x10872c+_0x980d('0x15'),_['map'](_0x43a0d8,'id'));}return _0x52cd18;}function getInteractionsQuery(_0x27dd6a){var _0x393ae2=utils['getInteractionsTables'](_0x27dd6a);var _0x1633cf=utils['getAccountFK'](_0x27dd6a);var _0x23f64c=utils[_0x980d('0x16')](_0x27dd6a);return squel[_0x980d('0x8')]()[_0x980d('0x10')](_0x393ae2[_0x980d('0x17')],'i')[_0x980d('0x18')](_0x980d('0x19'),'c',_0x980d('0x1a'))[_0x980d('0x18')](_0x980d('0x11'),'o',_0x980d('0x1b'))['left_join'](_0x393ae2['accounts'],'a',_0x980d('0x1c')+_0x1633cf)['left_join'](_0x393ae2['messages'],'me',_0x980d('0x1d')+_0x23f64c+_0x980d('0x1e'))[_0x980d('0x18')](_0x393ae2[_0x980d('0x1f')],'it','it.'+_0x23f64c+'\x20=\x20i.id')[_0x980d('0x18')]('tools_tags','t',_0x980d('0x20'));}function getSqlClauses(){var _0x20cea1={'body':squel['expr'](),'contact':squel[_0x980d('0x21')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x980d('0x21')](),'tags':{'clause':squel[_0x980d('0x21')](),'ids':null},'user':squel[_0x980d('0x21')]()};return _0x20cea1;}function parseTagParameter(_0x28adb3){var _0x5342dd=squel['expr']();if(_0x28adb3){var _0x26d9c6=utils[_0x980d('0x22')](_0x28adb3);_0x26d9c6[_0x980d('0x23')](function(_0x1da8ea){_0x5342dd['or'](_0x980d('0x24'),'%,'+_0x1da8ea+',%');});}return _0x5342dd;}function parseReadParameter(_0x47b11d){var _0x4a51f9='';if(_0x47b11d){_0x4a51f9=_0x980d('0x25');if(_0x47b11d==='1'){_0x4a51f9=_0x4a51f9[_0x980d('0x26')](_0x980d('0x27'),'=');}else{_0x4a51f9=_0x4a51f9[_0x980d('0x26')](_0x980d('0x27'),'>');}}return _0x4a51f9;}function parseSearchFilter(_0x25542b,_0x513693){var _0x14c61b=squel[_0x980d('0x21')]();if(_0x513693){var _0xaa9cd6=_0x513693[_0x980d('0x26')]('\x5c','\x5c\x5c')[_0x980d('0x26')](/'/g,'\x27\x27');if(qs[_0x980d('0x28')](_0xaa9cd6)){_0x14c61b['or'](_0x980d('0x29'),_0xaa9cd6+'%');if([_0x980d('0x2a'),_0x980d('0x2b')]['includes'](_0x25542b)){_0x14c61b['or'](_0x980d('0x2c'),_0xaa9cd6+'%');}else if(_0x25542b===_0x980d('0x2d')){_0x14c61b['or'](_0x980d('0x2e'),_0xaa9cd6+'%');}else if(_0x25542b==='openchannel'){_0x14c61b['or']('i.from\x20LIKE\x20?',_0xaa9cd6+'%');}}else if(_0x25542b===_0x980d('0x2f')&&qs['isEmail'](_0xaa9cd6)){_0x14c61b['or'](_0x980d('0x30'),_0xaa9cd6+'%');}else{if(_0x25542b==='mail'){_0x14c61b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xaa9cd6))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xaa9cd6));}else{if(_0x25542b!=='fax'){_0x14c61b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x980d('0x31')](_0xaa9cd6));}_0x14c61b['or'](_0x980d('0x32'),_0xaa9cd6+'%');}}}return _0x14c61b;}function parseAdvancedSearchFilter(_0x12530d,_0x58dcc4){var _0x498081=getSqlClauses();var _0x21a66a=as[_0x980d('0x33')](_0x12530d);var _0x2623d8=_0x21a66a[_0x980d('0x34')];for(var _0x27890f=0x0;_0x27890f<_0x21a66a[_0x980d('0x35')]['length'];_0x27890f++){var _0x43c2e2=_0x21a66a[_0x980d('0x35')][_0x27890f];var _0x5f4502='i';var _0x92c9bd=_['find'](_0x58dcc4,[_0x980d('0xa'),_0x43c2e2[_0x980d('0x9')]]);if(_0x92c9bd){var _0x41159e=as['buildExpression'](_0x5f4502,_0x92c9bd['type'],_0x43c2e2);_0x498081['default'][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e['value']['start'],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}else{switch(_0x43c2e2[_0x980d('0x9')]){case'unreadMessages':var _0x41174b=parseReadParameter(_0x43c2e2[_0x980d('0x37')]);_0x498081[_0x980d('0x39')][_0x980d('0x3a')](_0x41174b);break;case _0x980d('0x3b'):if(_0x43c2e2['operator']==='$substring'){if(_0x43c2e2[_0x980d('0x37')]['split']('\x20')['length']>0x1){_0x498081['contact'][_0x2623d8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x980d('0x31')](_0x43c2e2[_0x980d('0x37')]),null);}else{var _0x8bcd98='%'+_0x43c2e2['value']+'%';_0x498081[_0x980d('0x3c')][_0x2623d8](_0x980d('0x3d'),_0x8bcd98,_0x8bcd98,_0x8bcd98);}}else{_0x92c9bd=_[_0x980d('0x3e')](_0x58dcc4,[_0x980d('0xa'),_0x980d('0x3f')]);_0x43c2e2[_0x980d('0x9')]=_0x980d('0x3f');_0x41159e=as['buildExpression'](_0x5f4502,_0x92c9bd[_0x980d('0x40')],_0x43c2e2);_0x498081[_0x980d('0x3c')][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e['value'][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}break;case _0x980d('0x42'):var _0x42486b=_0x43c2e2[_0x980d('0x37')][_0x980d('0x43')](',')['map'](function(_0x473c94){return Number(_0x473c94);});var _0x512503=parseTagParameter(_0x42486b);_0x498081[_0x980d('0x44')][_0x980d('0x45')][_0x980d('0x3a')](_0x512503);_0x498081[_0x980d('0x44')][_0x980d('0x46')]=_0x42486b;break;case _0x980d('0x47'):if(_0x43c2e2[_0x980d('0x48')]===_0x980d('0x49')){_0x498081['user'][_0x2623d8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x43c2e2[_0x980d('0x37')]+'%',null);}else{_0x92c9bd=_[_0x980d('0x3e')](_0x58dcc4,[_0x980d('0xa'),_0x980d('0x4a')]);_0x43c2e2[_0x980d('0x9')]='UserId';_0x41159e=as[_0x980d('0x4b')](_0x5f4502,_0x92c9bd[_0x980d('0x40')],_0x43c2e2);_0x498081['user'][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e[_0x980d('0x37')][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}break;case _0x980d('0x4c'):case _0x980d('0x4d'):_0x41159e=as[_0x980d('0x4b')]('me',null,_0x43c2e2);_0x498081[_0x980d('0x4c')][_0x2623d8](_0x41159e['text'],_0x41159e[_0x980d('0x37')][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);break;}}}return _0x498081;}function parseModelFields(_0x2e18c6,_0x7d0acf,_0x2e6cdf){var _0x4f0a6e=utils[_0x980d('0x6')](_0x2e18c6);var _0x50de9a=squel[_0x980d('0x21')]();var _0x6e16c1=_(_0x7d0acf)[_0x980d('0x4e')]()[_0x980d('0x4f')](function(_0xb1d509){return _['some'](_0x2e6cdf,[_0x980d('0xa'),_0xb1d509])?_0xb1d509:undefined;})[_0x980d('0x50')]()[_0x980d('0x37')]();if(_0x6e16c1[_0x980d('0x13')]>0x0){_0x6e16c1[_0x980d('0x23')](function(_0x2799a4){if(_0x2799a4===_0x4f0a6e){_0x50de9a[_0x980d('0x3a')]('i.'+_0x4f0a6e+'\x20IN\x20?',[]['concat'](_0x7d0acf[_0x2799a4]));}else if(_0x2799a4==='createdAt'){var _0x4e0f93=JSON[_0x980d('0x51')](_0x7d0acf[_0x2799a4])[_0x980d('0x52')];var _0x2850da=JSON[_0x980d('0x51')](_0x7d0acf[_0x2799a4])[_0x980d('0x53')];_0x50de9a[_0x980d('0x3a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e0f93,_0x2850da);}else{if(_0x7d0acf[_0x2799a4]===_0x980d('0x54')){_0x50de9a['and']('i.'+_0x2799a4+_0x980d('0x55'));}else{_0x50de9a[_0x980d('0x3a')]('i.'+_0x2799a4+_0x980d('0x56'),_0x7d0acf[_0x2799a4]);}}});}return _0x50de9a;}function parseQueryParameters(_0x4656f4,_0x522b28,_0x555080){var _0x36a241=getSqlClauses();return Promise[_0x980d('0x57')]()[_0x980d('0x58')](function(){return parseModelFields(_0x4656f4,_0x522b28,_0x555080);})['then'](function(_0x4c95b7){_0x36a241[_0x980d('0x59')]['and'](_0x4c95b7);return parseReadParameter(_0x522b28[_0x980d('0x39')]);})[_0x980d('0x58')](function(_0x409c0f){_0x36a241[_0x980d('0x39')][_0x980d('0x3a')](_0x409c0f);return parseTagParameter(_0x522b28[_0x980d('0x5a')]);})[_0x980d('0x58')](function(_0x4621eb){_0x36a241['tags']['clause'][_0x980d('0x3a')](_0x4621eb);return parseSearchFilter(_0x4656f4,_0x522b28['filter']);})[_0x980d('0x58')](function(_0x21cf36){_0x36a241['filter']=_0x21cf36;return _0x36a241;});}function checkAccountsRestrictions(_0x2b28e4,_0x338128,_0x3204e3){var _0x60969d=utils['getAccountFK'](_0x2b28e4);var _0x2ccfff='get'+_['capitalize'](_0x2b28e4)+(_0x2b28e4===_0x980d('0x5b')?'Websites':_0x980d('0x5c'));var _0x563bb9=squel[_0x980d('0x21')]();return Promise[_0x980d('0x57')]()['then'](function(){if(_0x3204e3[_0x980d('0x7')]&&_0x338128[_0x980d('0x5d')]===_0x980d('0x5e')){return _0x338128[_0x2ccfff]({'attributes':['id'],'raw':!![]});}})[_0x980d('0x58')](function(_0x26a600){if(_0x26a600){if(_0x26a600[_0x980d('0x13')]===0x0){_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+_0x980d('0x55'));}else{_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+_0x980d('0x15'),_[_0x980d('0x4f')](_0x26a600,'id'));}}else if(!_0x3204e3[_0x60969d]){_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x563bb9;});}function getClosedOrderClause(_0x4a5719,_0x438b7e){var _0x53a444='';var _0x153c02=[_0x980d('0x5f'),_0x980d('0x60'),_0x980d('0x61')];if(_0x4a5719==='mail'){_0x153c02[_0x980d('0x62')](_0x980d('0x63'));}if(_0x438b7e['closed']==='0'&&_0x4a5719===_0x980d('0x2f')){_0x53a444='i.substatus';}else{if(_0x438b7e[_0x980d('0x64')]==='1'){_0x153c02['shift']();}_0x53a444='CONCAT_WS(\x27\x27,\x20'+_0x153c02[_0x980d('0x65')](',\x20')+')';}return _0x53a444;}function getFilteredInteractions(_0x46e459,_0x3e6234,_0x16f427,_0x4dbcca){var _0x17d4ff=utils['getInteractionFK'](_0x46e459);var _0x5d0fc5=_[_0x980d('0x66')](_0x46e459)+_0x980d('0x67');var _0x3bd029=[];var _0x357f77=getTagsQuery();var _0x1d9e40={'type':db[_0x980d('0x68')][_0x980d('0x69')][_0x980d('0x6a')],'raw':!![]};var _0x392ec3=[];var _0x46ea46=[];return db['sequelize'][_0x980d('0x6b')](_0x357f77['toString'](),_0x1d9e40)[_0x980d('0x58')](function(_0x3020eb){_0x3bd029=_['keyBy'](_0x3020eb,'id');_0x1d9e40=_[_0x980d('0x6c')](_0x1d9e40,{'model':db[_0x5d0fc5],'mapToModel':!![],'nest':!![]});if(_0x16f427[_0x980d('0x59')]){_0x4dbcca[_0x980d('0x6d')][_0x980d('0x23')](function(_0x4debc0){_0x3e6234[_0x980d('0x9')]('i.'+_0x4debc0);});}else{_0x3e6234[_0x980d('0x9')](_0x980d('0x6e'),_0x980d('0x6f'));_0x3e6234[_0x980d('0x9')](_0x980d('0x70'),_0x980d('0x71'));_0x3e6234[_0x980d('0x9')](_0x980d('0x72'),_0x980d('0x73'));if(_0x46e459==='mail'){_0x3e6234[_0x980d('0x9')](_0x980d('0x74'),_0x980d('0x75'));_0x3e6234[_0x980d('0x9')](_0x980d('0x76'),_0x980d('0x77'));_0x3e6234['field']('i.id');_0x3e6234[_0x980d('0x9')](_0x980d('0x78'));_0x3e6234[_0x980d('0x9')](_0x980d('0x79'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7a'));_0x3e6234['field']('i.closedAt');_0x3e6234['field'](_0x980d('0x7b'));_0x3e6234['field'](_0x980d('0x7c'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7d'));_0x3e6234[_0x980d('0x9')]('i.subject');_0x3e6234['field'](_0x980d('0x61'));_0x3e6234['field'](_0x980d('0x60'));_0x3e6234[_0x980d('0x9')](_0x980d('0x5f'));_0x3e6234[_0x980d('0x9')]('i.substatus');_0x3e6234[_0x980d('0x9')]('i.to');_0x3e6234[_0x980d('0x9')](_0x980d('0x7e'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7f'));_0x3e6234['field'](_0x980d('0x80'));}else if(_0x46e459===_0x980d('0x81')){_0x3e6234[_0x980d('0x9')](_0x980d('0x82'),_0x980d('0x77'));}else{_0x3e6234[_0x980d('0x9')]('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',_0x980d('0x77'));}if(_0x46e459!==_0x980d('0x2f')){_0x3e6234['field'](_0x980d('0x83'));}_0x3e6234[_0x980d('0x9')]('c.firstName','Contact.firstName');_0x3e6234['field'](_0x980d('0x84'),_0x980d('0x85'));_0x3e6234[_0x980d('0x9')](_0x980d('0x86'),_0x980d('0x87'));_0x3e6234[_0x980d('0x9')](_0x980d('0x88'),_0x980d('0x89'));_0x3e6234[_0x980d('0x9')](_0x980d('0x8a'),'Contact.mobile');_0x3e6234[_0x980d('0x9')](_0x980d('0x8b'),_0x980d('0x8c'));_0x3e6234[_0x980d('0x9')](_0x980d('0x8d'),_0x980d('0x8e'));_0x3e6234['field']('o.internal',_0x980d('0x8f'));_0x3e6234[_0x980d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x980d('0x90'));}if(_0x4dbcca[_0x980d('0x91')]){_0x3e6234[_0x980d('0x91')](_0x4dbcca[_0x980d('0x91')]);}if(_0x4dbcca[_0x980d('0x92')]){_0x3e6234[_0x980d('0x92')](_0x4dbcca['offset']);}return db[_0x980d('0x93')][_0x980d('0x6b')](_0x3e6234[_0x980d('0x94')](),_0x1d9e40);})[_0x980d('0x58')](function(_0x4e4e32){_0x392ec3=_0x4e4e32;var _0x3ad100=getUsersQuery(_0x46e459,_0x392ec3);return db['sequelize']['query'](_0x3ad100['toString'](),_0x1d9e40);})[_0x980d('0x58')](function(_0x584d7d){_0x46ea46=_[_0x980d('0x95')](_0x584d7d,_0x17d4ff);if(_0x46e459===_0x980d('0x2f')){return db[_0x980d('0x96')][_0x980d('0x97')]({'attributes':[_0x980d('0x98')],'raw':!![]});}})[_0x980d('0x58')](function(_0x54eb5e){var _0x1cce28=_0x54eb5e?_0x54eb5e[_0x980d('0x98')]:undefined;var _0x5ea5e4=_0x392ec3[_0x980d('0x4f')](function(_0x573c58){return updateInteraction(_0x573c58,_0x3bd029,_0x46ea46,_0x1cce28);});return Promise['all'](_0x5ea5e4);});}function countFilteredInteractions(_0x336709,_0x172038){var _0x39fa3e=_0x336709[_0x980d('0x99')]();_0x39fa3e[_0x980d('0x9')](_0x980d('0x9a'));_0x39fa3e[_0x980d('0x9')](_0x980d('0x6e'),_0x980d('0x6f'));var _0x3517bd=utils[_0x980d('0x22')](_0x172038);if(!_[_0x980d('0x9b')](_0x3517bd)){_0x39fa3e[_0x980d('0x14')](_0x980d('0x9c'),_0x3517bd);}var _0x5d71f2={'type':db[_0x980d('0x68')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x980d('0x93')][_0x980d('0x6b')](_0x39fa3e[_0x980d('0x94')](),_0x5d71f2);}module[_0x980d('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index e16e917..cb8afc4 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 _0x2ace=['trimStart','Users','TagIds','../../mysqldb','map','split','forEach','push','waiting','unmanaged','abandoned','total','closed','disposition','answered','UserId','talking','out','plainBody','-id','then','lastMsgText'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2ace,0x1e7));var _0xe2ac=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x2ace[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require('lodash');var db=require(_0xe2ac('0x0'))['db'];function getInteractionUsers(_0x2ce8aa,_0x2ce71a){return new Promise(function(_0x4d1237,_0x7bb43f){try{var _0x377890=[];if(_0x2ce71a[_0x2ce8aa]){_0x377890=_0x2ce71a[_0x2ce8aa][_0xe2ac('0x1')](function(_0x107f11){return{'id':_0x107f11['id'],'fullname':_0x107f11['fullname']};});}return _0x4d1237(_0x377890);}catch(_0x1c702c){_0x7bb43f(_0x1c702c);}});}function getInteractionTags(_0x2964db,_0x4e25fa){var _0x25ada4=[];if(_0x2964db){_0x2964db[_0xe2ac('0x2')](',')[_0xe2ac('0x3')](function(_0x3dc0e9){_0x25ada4[_0xe2ac('0x4')](_0x4e25fa[_0x3dc0e9]);});}return _0x25ada4;}function updateWaitingCounter(_0x136139){if(_0x136139[_0xe2ac('0x5')]){_0x136139[_0xe2ac('0x5')]-=0x1;}}function updateInteractionCounters(_0x42ead0){_0x42ead0['waiting']=0x0;_0x42ead0['talking']=0x0;_0x42ead0['answered']=0x0;_0x42ead0[_0xe2ac('0x6')]=0x0;_0x42ead0[_0xe2ac('0x7')]=0x0;_0x42ead0[_0xe2ac('0x8')]=0x0;if(_0x42ead0[_0xe2ac('0x9')]){if(_0x42ead0[_0xe2ac('0xa')]==='abandoned'){_0x42ead0[_0xe2ac('0x7')]+=0x1;updateWaitingCounter(_0x42ead0);}if(_0x42ead0['UserId']){_0x42ead0[_0xe2ac('0xb')]+=0x1;if(_0x42ead0['talking']){_0x42ead0['talking']-=0x1;}}else{if(_0x42ead0[_0xe2ac('0xa')]){_0x42ead0[_0xe2ac('0x6')]+=0x1;updateWaitingCounter(_0x42ead0);}}}else{if(!_0x42ead0['UserId']){_0x42ead0[_0xe2ac('0x5')]+=0x1;}if(_0x42ead0[_0xe2ac('0xc')]){_0x42ead0[_0xe2ac('0xd')]+=0x1;updateWaitingCounter(_0x42ead0);}}_0x42ead0['total']+=0x1;return _0x42ead0;}function getLastMessageText(_0x1dec77){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x1dec77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe2ac('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe2ac('0xf')],'order':_0xe2ac('0x10'),'raw':!![]})[_0xe2ac('0x11')](function(_0x49a661){if(_0x49a661&&_0x49a661[_0xe2ac('0xf')]){_0x1dec77[_0xe2ac('0x12')]=_[_0xe2ac('0x13')](_0x49a661[_0xe2ac('0xf')]);}return _0x1dec77;})['catch'](function(_0x5139ec){throw _0x5139ec;});}exports['updateInteraction']=function(_0x4e61cc,_0xc391c7,_0x10efdf,_0xc1ffb1){return new Promise(function(_0x4a9652,_0x25e902){return getInteractionUsers(_0x4e61cc['id'],_0x10efdf)[_0xe2ac('0x11')](function(_0x53726d){_0x4e61cc[_0xe2ac('0x14')]=_0x53726d;return getInteractionTags(_0x4e61cc[_0xe2ac('0x15')],_0xc391c7);})['then'](function(_0x56e4c2){_0x4e61cc['Tags']=_0x56e4c2;delete _0x4e61cc['TagIds'];return updateInteractionCounters(_0x4e61cc);})[_0xe2ac('0x11')](function(_0x459f2f){if(_0xc1ffb1){return getLastMessageText(_0x459f2f);}else{return _0x459f2f;}})[_0xe2ac('0x11')](function(_0x1f6f88){_0x4a9652(_0x1f6f88);})['catch'](function(_0x45a9d4){_0x25e902(_0x45a9d4);});});}; \ No newline at end of file +var _0x728e=['unmanaged','total','closed','disposition','abandoned','talking','UserId','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Tags','TagIds','lodash','../../mysqldb','fullname','split','push','waiting'];(function(_0x5aa17c,_0x5892b1){var _0x1d886b=function(_0x2f5bf7){while(--_0x2f5bf7){_0x5aa17c['push'](_0x5aa17c['shift']());}};_0x1d886b(++_0x5892b1);}(_0x728e,0x102));var _0xe728=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x728e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe728('0x0'));var db=require(_0xe728('0x1'))['db'];function getInteractionUsers(_0x415985,_0x3f627b){return new Promise(function(_0x496a5f,_0x4e4917){try{var _0x31ad55=[];if(_0x3f627b[_0x415985]){_0x31ad55=_0x3f627b[_0x415985]['map'](function(_0x3bf28f){return{'id':_0x3bf28f['id'],'fullname':_0x3bf28f[_0xe728('0x2')]};});}return _0x496a5f(_0x31ad55);}catch(_0x2d7cd0){_0x4e4917(_0x2d7cd0);}});}function getInteractionTags(_0x12e77e,_0x555ec4){var _0xe6a80b=[];if(_0x12e77e){_0x12e77e[_0xe728('0x3')](',')['forEach'](function(_0x58ef5b){_0xe6a80b[_0xe728('0x4')](_0x555ec4[_0x58ef5b]);});}return _0xe6a80b;}function updateWaitingCounter(_0x25a68b){if(_0x25a68b[_0xe728('0x5')]){_0x25a68b[_0xe728('0x5')]-=0x1;}}function updateInteractionCounters(_0x5cf7bb){_0x5cf7bb[_0xe728('0x5')]=0x0;_0x5cf7bb['talking']=0x0;_0x5cf7bb['answered']=0x0;_0x5cf7bb[_0xe728('0x6')]=0x0;_0x5cf7bb['abandoned']=0x0;_0x5cf7bb[_0xe728('0x7')]=0x0;if(_0x5cf7bb[_0xe728('0x8')]){if(_0x5cf7bb[_0xe728('0x9')]===_0xe728('0xa')){_0x5cf7bb[_0xe728('0xa')]+=0x1;updateWaitingCounter(_0x5cf7bb);}if(_0x5cf7bb['UserId']){_0x5cf7bb['answered']+=0x1;if(_0x5cf7bb[_0xe728('0xb')]){_0x5cf7bb[_0xe728('0xb')]-=0x1;}}else{if(_0x5cf7bb['disposition']){_0x5cf7bb[_0xe728('0x6')]+=0x1;updateWaitingCounter(_0x5cf7bb);}}}else{if(!_0x5cf7bb['UserId']){_0x5cf7bb['waiting']+=0x1;}if(_0x5cf7bb[_0xe728('0xc')]){_0x5cf7bb[_0xe728('0xb')]+=0x1;updateWaitingCounter(_0x5cf7bb);}}_0x5cf7bb[_0xe728('0x7')]+=0x1;return _0x5cf7bb;}function getLastMessageText(_0x2450f0){return db[_0xe728('0xd')][_0xe728('0xe')]({'where':{'$and':[{'MailInteractionId':_0x2450f0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe728('0xf')],'order':_0xe728('0x10'),'raw':!![]})['then'](function(_0x4553be){if(_0x4553be&&_0x4553be[_0xe728('0xf')]){_0x2450f0[_0xe728('0x11')]=_[_0xe728('0x12')](_0x4553be['plainBody']);}return _0x2450f0;})[_0xe728('0x13')](function(_0x5c8847){throw _0x5c8847;});}exports[_0xe728('0x14')]=function(_0xe0c145,_0x22a230,_0x3295e0,_0x3f3e58){return new Promise(function(_0x1032cb,_0x2e728e){return getInteractionUsers(_0xe0c145['id'],_0x3295e0)[_0xe728('0x15')](function(_0x9ebedd){_0xe0c145['Users']=_0x9ebedd;return getInteractionTags(_0xe0c145['TagIds'],_0x22a230);})[_0xe728('0x15')](function(_0x528aa0){_0xe0c145[_0xe728('0x16')]=_0x528aa0;delete _0xe0c145[_0xe728('0x17')];return updateInteractionCounters(_0xe0c145);})[_0xe728('0x15')](function(_0x4be0de){if(_0x3f3e58){return getLastMessageText(_0x4be0de);}else{return _0x4be0de;}})[_0xe728('0x15')](function(_0x2d5d62){_0x1032cb(_0x2d5d62);})[_0xe728('0x13')](function(_0xc6044c){_0x2e728e(_0xc6044c);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7e31607..692bc38 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 _0x4272=['stringify','null','findOne','update','then','info','error','exports','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','InteractionId','upperFirst','chat','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x4272,0x9e));var _0x2427=function(_0x4f2aea,_0x12ff2b){_0x4f2aea=_0x4f2aea-0x0;var _0x23588b=_0x4272[_0x4f2aea];return _0x23588b;};'use strict';var _=require('lodash');var db=require(_0x2427('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2427('0x1')),'mail':require(_0x2427('0x2'))(_0x2427('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x2427('0x2'))(_0x2427('0x4')),'chat':require(_0x2427('0x2'))(_0x2427('0x5')),'whatsapp':require(_0x2427('0x2'))(_0x2427('0x6'))};function getAccountFK(_0x18f8c6){return _['capitalize'](_0x18f8c6)+(_0x18f8c6==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x5c3f49){return _[_0x2427('0x7')](_0x5c3f49)+_0x2427('0x8');}function getInteractionId(_0x194014,_0x4a7182,_0x4c3568){if(_0x194014&&_0x194014[_[_0x2427('0x9')](_0x4c3568)+'InteractionId']){return _0x194014[_[_0x2427('0x9')](_0x4c3568)+_0x2427('0x8')];}else if(_0x194014&&_0x194014['id']){return _0x194014['id'];}else if(_0x4a7182&&_0x4a7182['id']){return _0x4a7182['id'];}else{return'unknown';}}function getInteractionsTables(_0x79abcd){return{'accounts':_0x79abcd+'_'+(_0x79abcd===_0x2427('0xa')?_0x2427('0xb'):_0x2427('0xc')),'interactions':_0x79abcd+_0x2427('0xd'),'interactionsTags':_0x79abcd+_0x2427('0xe'),'messages':_0x79abcd+'_messages','userInteractions':_0x2427('0xf')+_0x79abcd+_0x2427('0xd')};}function getSelectedTags(_0x3e7865){var _0x5dbd52=[];if(_0x3e7865){_0x5dbd52=Array[_0x2427('0x10')](_0x3e7865)?_0x3e7865:[_0x3e7865];}return _0x5dbd52;}function log(_0x3dd5b1,_0x492e71,_0x4c5760,_0x27bb99,_0x35854f,_0x537ded){loggers[_0x35854f[_0x2427('0x11')]()][_0x3dd5b1](_0x2427('0x12'),_0x537ded[_0x2427('0x13')](),_0x492e71?_0x492e71['id']:null,_0x492e71?_0x492e71[_0x2427('0x14')]:null,_0x492e71?_0x492e71[_0x2427('0x15')]:null,getInteractionId(_0x4c5760,_0x27bb99,_0x35854f),_0x4c5760?JSON[_0x2427('0x16')](_0x4c5760):_0x2427('0x17'));}function updateUser(_0x333fbb,_0x3271d9,_0x3058d0,_0xccc34e,_0x52d8d0){db[_[_0x2427('0x9')](_0xccc34e)+'Interaction'][_0x2427('0x18')]({'where':{'id':getInteractionId(_0x3271d9,_0x3058d0,_0xccc34e)}})['then'](function(_0x10c74f){if(_0x10c74f){return _0x10c74f[_0x2427('0x19')]({'UserId':_0x333fbb?_0x333fbb['id']:null});}})[_0x2427('0x1a')](function(_0x5c90c6){if(_0x5c90c6){log(_0x2427('0x1b'),_0x333fbb,_0x3271d9,_0x3058d0,_0xccc34e,_0x52d8d0);}})['catch'](function(){log(_0x2427('0x1c'),_0x333fbb,_0x3271d9,_0x3058d0,_0xccc34e,_0x52d8d0);});}module[_0x2427('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x5970=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','upperFirst','InteractionId','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5970,0xe5));var _0x0597=function(_0x5d9549,_0x34cdd){_0x5d9549=_0x5d9549-0x0;var _0x465f1f=_0x5970[_0x5d9549];return _0x465f1f;};'use strict';var _=require(_0x0597('0x0'));var db=require(_0x0597('0x1'))['db'];var loggers={'openchannel':require(_0x0597('0x2'))(_0x0597('0x3')),'mail':require(_0x0597('0x2'))(_0x0597('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x0597('0x2'))(_0x0597('0x5')),'chat':require(_0x0597('0x2'))('chat-interactions'),'whatsapp':require(_0x0597('0x2'))(_0x0597('0x6'))};function getAccountFK(_0x1b24e6){return _[_0x0597('0x7')](_0x1b24e6)+(_0x1b24e6===_0x0597('0x8')?_0x0597('0x9'):'Account')+'Id';}function getInteractionFK(_0x24d478){return _[_0x0597('0x7')](_0x24d478)+'InteractionId';}function getInteractionId(_0x1f90b4,_0x59327b,_0xda0eff){if(_0x1f90b4&&_0x1f90b4[_[_0x0597('0xa')](_0xda0eff)+_0x0597('0xb')]){return _0x1f90b4[_[_0x0597('0xa')](_0xda0eff)+_0x0597('0xb')];}else if(_0x1f90b4&&_0x1f90b4['id']){return _0x1f90b4['id'];}else if(_0x59327b&&_0x59327b['id']){return _0x59327b['id'];}else{return'unknown';}}function getInteractionsTables(_0x235a3f){return{'accounts':_0x235a3f+'_'+(_0x235a3f==='chat'?'websites':_0x0597('0xc')),'interactions':_0x235a3f+'_interactions','interactionsTags':_0x235a3f+_0x0597('0xd'),'messages':_0x235a3f+_0x0597('0xe'),'userInteractions':_0x0597('0xf')+_0x235a3f+_0x0597('0x10')};}function getSelectedTags(_0xeb0bf3){var _0x2fa336=[];if(_0xeb0bf3){_0x2fa336=Array[_0x0597('0x11')](_0xeb0bf3)?_0xeb0bf3:[_0xeb0bf3];}return _0x2fa336;}function log(_0x3d1f7b,_0x274cb6,_0x37cfb0,_0x48e3ca,_0x459e31,_0x1ddab5){loggers[_0x459e31[_0x0597('0x12')]()][_0x3d1f7b](_0x0597('0x13'),_0x1ddab5['toUpperCase'](),_0x274cb6?_0x274cb6['id']:null,_0x274cb6?_0x274cb6[_0x0597('0x14')]:null,_0x274cb6?_0x274cb6['role']:null,getInteractionId(_0x37cfb0,_0x48e3ca,_0x459e31),_0x37cfb0?JSON[_0x0597('0x15')](_0x37cfb0):_0x0597('0x16'));}function updateUser(_0x446f12,_0x295c6b,_0x2a6409,_0xe90924,_0x173933){db[_[_0x0597('0xa')](_0xe90924)+_0x0597('0x17')][_0x0597('0x18')]({'where':{'id':getInteractionId(_0x295c6b,_0x2a6409,_0xe90924)}})[_0x0597('0x19')](function(_0x1b0226){if(_0x1b0226){return _0x1b0226[_0x0597('0x1a')]({'UserId':_0x446f12?_0x446f12['id']:null});}})[_0x0597('0x19')](function(_0x446ded){if(_0x446ded){log(_0x0597('0x1b'),_0x446f12,_0x295c6b,_0x2a6409,_0xe90924,_0x173933);}})[_0x0597('0x1c')](function(){log(_0x0597('0x1d'),_0x446f12,_0x295c6b,_0x2a6409,_0xe90924,_0x173933);});}module[_0x0597('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a4dd798..42fa134 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 _0x6124=['base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr','format','%s:%s:%s'];(function(_0x8703cf,_0x2433bf){var _0x7c685=function(_0x59ed59){while(--_0x59ed59){_0x8703cf['push'](_0x8703cf['shift']());}};_0x7c685(++_0x2433bf);}(_0x6124,0x10e));var _0x4612=function(_0x3cf1f7,_0x4b3693){_0x3cf1f7=_0x3cf1f7-0x0;var _0x463789=_0x6124[_0x3cf1f7];return _0x463789;};'use strict';var crypto=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var compose=require(_0x4612('0x2'));var db=require(_0x4612('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x53512f,_0x4d93e5){if(_0x53512f&&_0x4d93e5){if(_0x4d93e5[_0x4612('0x4')]&&_0x4d93e5[_0x4612('0x5')]){var _0x505e9e=_0x4d93e5[_0x4612('0x4')];var _0x173182=_0x4d93e5[_0x4612('0x5')];var _0x2c3168=_0x505e9e[_0x4612('0x6')]('-')[0x4];var _0xe7c5f7=_0x505e9e[_0x4612('0x6')]('-')[0x0];var _0x1a0c13=crypto['createDecipher'](_0x4612('0x7'),util[_0x4612('0x8')](_0x4612('0x9'),_0x2c3168,_0x505e9e,_0xe7c5f7));var _0x50c7dd=_0x1a0c13['update'](_0x173182,_0x4612('0xa'),_0x4612('0xb'));_0x50c7dd+=_0x1a0c13[_0x4612('0xc')]('utf8');var _0x787f4a=JSON[_0x4612('0xd')](_0x50c7dd);return _0x787f4a[_0x4612('0xe')](_0x53512f)?_0x787f4a[_0x53512f]:null;}}return null;}function isLimit(_0x4bd619,_0x72d63e,_0x35ea76,_0x497d43){var _0x5859f5=_0x72d63e;return compose()[_0x4612('0xf')](function(_0x148e74,_0x323403,_0x53d411){return db[_0x4612('0x10')][_0x4612('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x4612('0x12')](function(_0x18c853){var _0x2b45cb=getValueFromLicense(_0x4bd619,_0x18c853);return _0x2b45cb?_0x2b45cb:_0x5859f5;})['then'](function(_0x480847){_0x5859f5=_0x480847;return _0x35ea76[_0x4612('0x13')](_0x497d43);})[_0x4612('0x12')](function(_0x2fb87b){if(_0x2fb87b>=_0x5859f5){return _0x323403['status'](0x193)[_0x4612('0x14')]({'message':util[_0x4612('0x8')](_0x4612('0x15'),_0x4bd619)});}_0x53d411();})[_0x4612('0x16')](function(_0x248786){_0x53d411(_0x248786);});});}function isUserLimit(){return isLimit(_0x4612('0x17'),0x1,db[_0x4612('0x18')],{'where':{'$or':[{'role':_0x4612('0x19')},{'role':_0x4612('0x1a')}]}});}exports[_0x4612('0x1b')]=isUserLimit; \ No newline at end of file +var _0x4cf0=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','License','then','count'];(function(_0x5d72a1,_0x3d4fae){var _0xdd0d18=function(_0xef30f7){while(--_0xef30f7){_0x5d72a1['push'](_0x5d72a1['shift']());}};_0xdd0d18(++_0x3d4fae);}(_0x4cf0,0x190));var _0x04cf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4cf0[_0x167cc1];return _0x10bc4b;};'use strict';var crypto=require(_0x04cf('0x0'));var util=require(_0x04cf('0x1'));var compose=require('composable-middleware');var db=require(_0x04cf('0x2'))['db'];var config=require(_0x04cf('0x3'));function getValueFromLicense(_0x387e49,_0xafde1c){if(_0x387e49&&_0xafde1c){if(_0xafde1c[_0x04cf('0x4')]&&_0xafde1c[_0x04cf('0x5')]){var _0x5df402=_0xafde1c[_0x04cf('0x4')];var _0x58ebc7=_0xafde1c[_0x04cf('0x5')];var _0x35acc6=_0x5df402[_0x04cf('0x6')]('-')[0x4];var _0x36e767=_0x5df402[_0x04cf('0x6')]('-')[0x0];var _0x2b8460=crypto['createDecipher'](_0x04cf('0x7'),util[_0x04cf('0x8')]('%s:%s:%s',_0x35acc6,_0x5df402,_0x36e767));var _0x443bf9=_0x2b8460[_0x04cf('0x9')](_0x58ebc7,'base64',_0x04cf('0xa'));_0x443bf9+=_0x2b8460[_0x04cf('0xb')](_0x04cf('0xa'));var _0x41eaa7=JSON[_0x04cf('0xc')](_0x443bf9);return _0x41eaa7[_0x04cf('0xd')](_0x387e49)?_0x41eaa7[_0x387e49]:null;}}return null;}function isLimit(_0xd3a115,_0x465e58,_0x1d0144,_0x2231aa){var _0x140926=_0x465e58;return compose()[_0x04cf('0xe')](function(_0x430dc8,_0x3cedbc,_0x268035){return db[_0x04cf('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x04cf('0x10')](function(_0x407c22){var _0x19393c=getValueFromLicense(_0xd3a115,_0x407c22);return _0x19393c?_0x19393c:_0x140926;})['then'](function(_0x2fa144){_0x140926=_0x2fa144;return _0x1d0144[_0x04cf('0x11')](_0x2231aa);})[_0x04cf('0x10')](function(_0x4853c6){if(_0x4853c6>=_0x140926){return _0x3cedbc[_0x04cf('0x12')](0x193)[_0x04cf('0x13')]({'message':util[_0x04cf('0x8')](_0x04cf('0x14'),_0xd3a115)});}_0x268035();})['catch'](function(_0xf4026c){_0x268035(_0xf4026c);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x04cf('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f3dbbf7..6677b9a 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 _0xdec7=['<>\x20?','$substring','$startsWith','$endsWith','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','add','format','YYYY-MM-DD','castTo','text','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$eq'];(function(_0x26390e,_0x18a351){var _0x1df9df=function(_0x41c37f){while(--_0x41c37f){_0x26390e['push'](_0x26390e['shift']());}};_0x1df9df(++_0x18a351);}(_0xdec7,0x1e2));var _0x7dec=function(_0x2a4e92,_0x4c19d6){_0x2a4e92=_0x2a4e92-0x0;var _0x5964ab=_0xdec7[_0x2a4e92];return _0x5964ab;};'use strict';var _=require(_0x7dec('0x0'));var moment=require(_0x7dec('0x1'));exports[_0x7dec('0x2')]=function(_0x39767e){var _0x4bd0ea={'conditions':[]};_0x4bd0ea[_0x7dec('0x3')]=_[_0x7dec('0x4')](_0x39767e,_0x7dec('0x5'))?'or':_0x7dec('0x6');var _0x47478a=_0x39767e[_0x7dec('0x7')]('[$and]','')[_0x7dec('0x7')]('[$or]','')[_0x7dec('0x8')]('||');for(var _0x26e8cf=0x0;_0x26e8cf<_0x47478a[_0x7dec('0x9')];_0x26e8cf++){var _0x529942=_0x47478a[_0x26e8cf][_0x7dec('0x8')](':=');var _0x28a9e1=_0x529942[0x0];var _0x40e881=_0x529942[_0x7dec('0xa')](0x1);_0x40e881[_0x7dec('0xb')](function(_0x2a58b1){var _0x3e85ea=_0x2a58b1[_0x7dec('0x8')]('[')[_0x7dec('0xc')]();var _0x35b465=_0x2a58b1[_0x7dec('0xd')](/\[(.*?)\]/g);_0x35b465[_0x7dec('0xb')](function(_0x51cf9a){var _0xc9282c=_0x51cf9a[_0x7dec('0x8')]('[')[_0x7dec('0xe')](function(_0x41cd07){return _0x41cd07[_0x7dec('0xf')](']')>-0x1;})['map'](function(_0x48ac24){return _0x48ac24[_0x7dec('0x8')](']')[0x0];})[0x0];_0x4bd0ea[_0x7dec('0x10')][_0x7dec('0x11')]({'field':_0x28a9e1,'operator':_0x3e85ea,'value':_0xc9282c});});});}return _0x4bd0ea;};exports[_0x7dec('0x12')]=function(_0x3ed2a7,_0xcc0ccc,_0x250a00){var _0x284294={};if(_0xcc0ccc===_0x7dec('0x13')){if(_0x250a00[_0x7dec('0x14')]==='$eq'){_0x250a00[_0x7dec('0x14')]=_0x7dec('0x15');_0x250a00[_0x7dec('0x16')]+=','+_0x250a00['value'];}else if(_[_0x7dec('0x17')]([_0x7dec('0x18'),'$lte'],_0x250a00[_0x7dec('0x14')])){_0x250a00['value']=moment(_0x250a00['value'])[_0x7dec('0x19')](0x1,'days')[_0x7dec('0x1a')](_0x7dec('0x1b'));}}if(_0x250a00[_0x7dec('0x1c')]){_0xcc0ccc=_0x250a00[_0x7dec('0x1c')];_0x284294[_0x7dec('0x1d')]='CAST('+_0x3ed2a7+'.'+_0x250a00['field']+'\x20AS\x20'+_0x250a00[_0x7dec('0x1c')]+')\x20'+parseOperator(_0x250a00['operator']);}else{_0x284294[_0x7dec('0x1d')]=_0x3ed2a7+'.'+_0x250a00[_0x7dec('0x1e')]+'\x20'+parseOperator(_0x250a00[_0x7dec('0x14')]);}if(_[_0x7dec('0x17')]([_0x7dec('0x1f'),_0x7dec('0x20')],_0x250a00[_0x7dec('0x14')]))_0x284294[_0x7dec('0x1d')]='('+_0x284294[_0x7dec('0x1d')]+_0x7dec('0x21')+_0x3ed2a7+'.'+_0x250a00[_0x7dec('0x1e')]+'\x20IS\x20NULL)';_0x284294[_0x7dec('0x16')]=parseValue(_0xcc0ccc,_0x250a00[_0x7dec('0x14')],_0x250a00['value']);return _0x284294;};function parseOperator(_0x1f9391){var _0x1f45f8;switch(_0x1f9391){case _0x7dec('0x22'):_0x1f45f8=_0x7dec('0x23');break;case _0x7dec('0x20'):_0x1f45f8=_0x7dec('0x24');break;case _0x7dec('0x25'):_0x1f45f8='=\x20?';break;case _0x7dec('0x1f'):_0x1f45f8=_0x7dec('0x26');break;case _0x7dec('0x27'):case _0x7dec('0x28'):case _0x7dec('0x29'):_0x1f45f8='LIKE\x20?';break;case'$lt':_0x1f45f8='<\x20?';break;case _0x7dec('0x18'):_0x1f45f8='>\x20?';break;case'$lte':_0x1f45f8=_0x7dec('0x2a');break;case _0x7dec('0x2b'):_0x1f45f8=_0x7dec('0x2c');break;case'$between':_0x1f45f8=_0x7dec('0x2d');break;}return _0x1f45f8;}function parseValue(_0x4db9b4,_0x28e725,_0x12a959){var _0x36280f={'start':undefined,'end':undefined};switch(_0x28e725){case _0x7dec('0x22'):case'$notIn':_0x36280f[_0x7dec('0x2e')]=_0x12a959[_0x7dec('0x8')](',');break;case _0x7dec('0x27'):_0x36280f['start']='%'+_0x12a959+'%';break;case _0x7dec('0x28'):_0x36280f['start']=_0x12a959+'%';break;case _0x7dec('0x29'):_0x36280f[_0x7dec('0x2e')]='%'+_0x12a959;break;case _0x7dec('0x15'):var _0x4cc569=_0x12a959[_0x7dec('0x8')](',');var _0x12a959=_0x4cc569[_0x7dec('0xc')]();var _0x10e66b=_0x4cc569[_0x7dec('0x2f')]();if(_0x4db9b4===_0x7dec('0x13')){_0x12a959=moment(_0x12a959)[_0x7dec('0x30')](0x0,!![])[_0x7dec('0x1a')]();_0x10e66b=moment(_0x10e66b)['utcOffset'](0x0,!![])[_0x7dec('0x19')](0x17,_0x7dec('0x31'))[_0x7dec('0x19')](0x3b,_0x7dec('0x32'))['add'](0x3b,_0x7dec('0x33'))[_0x7dec('0x1a')]();}_0x36280f={'start':_0x12a959,'end':_0x10e66b};break;default:_0x36280f['start']=_0x12a959;break;}return _0x36280f;} \ No newline at end of file +var _0x6dc0=['NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?'];(function(_0x14c2d6,_0x199498){var _0x41e0ce=function(_0x1b7558){while(--_0x1b7558){_0x14c2d6['push'](_0x14c2d6['shift']());}};_0x41e0ce(++_0x199498);}(_0x6dc0,0x192));var _0x06dc=function(_0x56b1aa,_0x526389){_0x56b1aa=_0x56b1aa-0x0;var _0x9489ab=_0x6dc0[_0x56b1aa];return _0x9489ab;};'use strict';var _=require(_0x06dc('0x0'));var moment=require(_0x06dc('0x1'));exports[_0x06dc('0x2')]=function(_0x3c63e9){var _0x1ce642={'conditions':[]};_0x1ce642[_0x06dc('0x3')]=_['startsWith'](_0x3c63e9,_0x06dc('0x4'))?'or':_0x06dc('0x5');var _0x30ba97=_0x3c63e9[_0x06dc('0x6')](_0x06dc('0x7'),'')['replace'](_0x06dc('0x4'),'')[_0x06dc('0x8')]('||');for(var _0xc72a77=0x0;_0xc72a77<_0x30ba97[_0x06dc('0x9')];_0xc72a77++){var _0x1dd94a=_0x30ba97[_0xc72a77][_0x06dc('0x8')](':=');var _0x381288=_0x1dd94a[0x0];var _0x4d577a=_0x1dd94a[_0x06dc('0xa')](0x1);_0x4d577a[_0x06dc('0xb')](function(_0x6b54c6){var _0x12104a=_0x6b54c6[_0x06dc('0x8')]('[')[_0x06dc('0xc')]();var _0x14bd94=_0x6b54c6[_0x06dc('0xd')](/\[(.*?)\]/g);_0x14bd94['forEach'](function(_0x203e2e){var _0x19e9d6=_0x203e2e[_0x06dc('0x8')]('[')[_0x06dc('0xe')](function(_0x25eaba){return _0x25eaba['indexOf'](']')>-0x1;})[_0x06dc('0xf')](function(_0x38058e){return _0x38058e['split'](']')[0x0];})[0x0];_0x1ce642[_0x06dc('0x10')]['push']({'field':_0x381288,'operator':_0x12104a,'value':_0x19e9d6});});});}return _0x1ce642;};exports[_0x06dc('0x11')]=function(_0xf706d3,_0x413edb,_0x2e049f){var _0x6cf5c6={};if(_0x413edb===_0x06dc('0x12')){if(_0x2e049f[_0x06dc('0x13')]===_0x06dc('0x14')){_0x2e049f[_0x06dc('0x13')]=_0x06dc('0x15');_0x2e049f[_0x06dc('0x16')]+=','+_0x2e049f[_0x06dc('0x16')];}else if(_[_0x06dc('0x17')](['$gt',_0x06dc('0x18')],_0x2e049f[_0x06dc('0x13')])){_0x2e049f[_0x06dc('0x16')]=moment(_0x2e049f[_0x06dc('0x16')])[_0x06dc('0x19')](0x1,_0x06dc('0x1a'))[_0x06dc('0x1b')]('YYYY-MM-DD');}}if(_0x2e049f[_0x06dc('0x1c')]){_0x413edb=_0x2e049f['castTo'];_0x6cf5c6[_0x06dc('0x1d')]=_0x06dc('0x1e')+_0xf706d3+'.'+_0x2e049f[_0x06dc('0x1f')]+_0x06dc('0x20')+_0x2e049f[_0x06dc('0x1c')]+')\x20'+parseOperator(_0x2e049f[_0x06dc('0x13')]);}else{_0x6cf5c6[_0x06dc('0x1d')]=_0xf706d3+'.'+_0x2e049f['field']+'\x20'+parseOperator(_0x2e049f[_0x06dc('0x13')]);}if(_[_0x06dc('0x17')]([_0x06dc('0x21'),_0x06dc('0x22')],_0x2e049f['operator']))_0x6cf5c6[_0x06dc('0x1d')]='('+_0x6cf5c6[_0x06dc('0x1d')]+_0x06dc('0x23')+_0xf706d3+'.'+_0x2e049f[_0x06dc('0x1f')]+_0x06dc('0x24');_0x6cf5c6[_0x06dc('0x16')]=parseValue(_0x413edb,_0x2e049f['operator'],_0x2e049f[_0x06dc('0x16')]);return _0x6cf5c6;};function parseOperator(_0x4bf448){var _0x5a5f20;switch(_0x4bf448){case'$in':_0x5a5f20=_0x06dc('0x25');break;case'$notIn':_0x5a5f20=_0x06dc('0x26');break;case'$eq':_0x5a5f20='=\x20?';break;case _0x06dc('0x21'):_0x5a5f20='<>\x20?';break;case _0x06dc('0x27'):case _0x06dc('0x28'):case _0x06dc('0x29'):_0x5a5f20=_0x06dc('0x2a');break;case _0x06dc('0x2b'):_0x5a5f20=_0x06dc('0x2c');break;case _0x06dc('0x2d'):_0x5a5f20=_0x06dc('0x2e');break;case'$lte':_0x5a5f20=_0x06dc('0x2f');break;case'$gte':_0x5a5f20=_0x06dc('0x30');break;case _0x06dc('0x15'):_0x5a5f20=_0x06dc('0x31');break;}return _0x5a5f20;}function parseValue(_0x1e831d,_0x2e9dec,_0xc0a764){var _0xc199e7={'start':undefined,'end':undefined};switch(_0x2e9dec){case _0x06dc('0x32'):case _0x06dc('0x22'):_0xc199e7[_0x06dc('0x33')]=_0xc0a764['split'](',');break;case _0x06dc('0x27'):_0xc199e7[_0x06dc('0x33')]='%'+_0xc0a764+'%';break;case _0x06dc('0x28'):_0xc199e7[_0x06dc('0x33')]=_0xc0a764+'%';break;case _0x06dc('0x29'):_0xc199e7['start']='%'+_0xc0a764;break;case _0x06dc('0x15'):var _0x45feb3=_0xc0a764[_0x06dc('0x8')](',');var _0xc0a764=_0x45feb3[_0x06dc('0xc')]();var _0x5a0b04=_0x45feb3[_0x06dc('0x34')]();if(_0x1e831d===_0x06dc('0x12')){_0xc0a764=moment(_0xc0a764)[_0x06dc('0x35')](0x0,!![])['format']();_0x5a0b04=moment(_0x5a0b04)[_0x06dc('0x35')](0x0,!![])[_0x06dc('0x19')](0x17,'hours')['add'](0x3b,'minutes')[_0x06dc('0x19')](0x3b,_0x06dc('0x36'))['format']();}_0xc199e7={'start':_0xc0a764,'end':_0x5a0b04};break;default:_0xc199e7[_0x06dc('0x33')]=_0xc0a764;break;}return _0xc199e7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 055e7d7..772aeef 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 _0xabce=['length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','name','intersection','attributes','order','where','pick','filter','VIRTUAL','lower','merge','lodash','sequelize','moment','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','subtract','isArray','limit','offset','indexOf','priority','cast','col','unsigned','substr','DESC','omit'];(function(_0x456be2,_0x3aeefb){var _0x359783=function(_0x2ab4d1){while(--_0x2ab4d1){_0x456be2['push'](_0x456be2['shift']());}};_0x359783(++_0x3aeefb);}(_0xabce,0x103));var _0xeabc=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xabce[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xeabc('0x0'));var sequelize=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x572221){var _0x49dbcc=['ne'];try{var _0x5bd1a4=JSON['parse'](_0x572221);var _0x2e01eb=Object[_0xeabc('0x3')](_0x5bd1a4)[0x0];return _0x49dbcc[_0xeabc('0x4')](_0x2e01eb);}catch(_0x5e9e2d){return![];}}function getOperatorValue(_0x54e4a8){var _0x1b07a8=JSON['parse'](_0x54e4a8);var _0x229ba4=Object['keys'](_0x1b07a8)[0x0];var _0x3bdc29=_0x1b07a8[_0x229ba4];return{['$'+_0x229ba4]:_0x3bdc29};}exports[_0xeabc('0x5')]=function(_0x8434c5){var _0x5d59d5=null;if(_0x8434c5){_0x5d59d5=_0x8434c5[_0xeabc('0x6')](',');}return _0x5d59d5;};exports[_0xeabc('0x7')]=function(_0x2f73e9,_0x1b4d1b){var _0x4301e4={};if(!_[_0xeabc('0x8')](_0x2f73e9)){_[_0xeabc('0x9')](_0x2f73e9,function(_0x28292c,_0xdb5022){try{if(_0x1b4d1b){var _0xf0d9c0=_[_0xeabc('0xa')](_0x1b4d1b,{'name':_0xdb5022})||{};if(hasSequelizeOperator(_0x28292c)){_0x4301e4[_0xdb5022]=getOperatorValue(_0x28292c);}else if(_0xf0d9c0[_0xeabc('0xb')]===_0xeabc('0xc')&&_[_0xeabc('0xd')](_0x28292c)){var _0x36a92e=JSON[_0xeabc('0xe')](_0x28292c);var _0x53df9c={'$gte':moment(moment(_0x36a92e[_0xeabc('0xf')])[_0xeabc('0x10')](_0xeabc('0x11')))['utc']()['format'](),'$lte':moment(moment(_0x36a92e[_0xeabc('0x12')])[_0xeabc('0x10')](_0xeabc('0x11')))['utc']()[_0xeabc('0x13')](0x1,'s')[_0xeabc('0x10')]()};_0x4301e4[_0xdb5022]=_0x53df9c;}else if(_0xf0d9c0['name']==='uniqueid'){_0x4301e4[_0xdb5022]=_0x28292c;}else{_0x4301e4[_0xdb5022]=_[_0xeabc('0x14')](_0x28292c)?_0x28292c:JSON['parse'](_0x28292c);}}else{_0x4301e4[_0xdb5022]=_[_0xeabc('0x14')](_0x28292c)?_0x28292c:JSON[_0xeabc('0xe')](_0x28292c);}}catch(_0x58a3c0){_0x4301e4[_0xdb5022]=_0x28292c[_0xeabc('0x6')](',');}});}return _0x4301e4;};exports[_0xeabc('0x15')]=function(_0x31f52a){_0x31f52a=parseInt(_0x31f52a,0xa);if(!_0x31f52a||_0x31f52a<0x0){_0x31f52a=LIMIT_VALUE;}return _0x31f52a;};exports[_0xeabc('0x16')]=function(_0x5e30ee){_0x5e30ee=parseInt(_0x5e30ee,0xa);if(!_0x5e30ee||_0x5e30ee<0x0){_0x5e30ee=0x0;}return _0x5e30ee;};exports['sort']=function(_0x1253e4){var _0x4d68ea,_0x31201a=null;if(_0x1253e4){_0x4d68ea=_0x1253e4[_0xeabc('0x6')](',');_0x31201a=_['map'](_0x4d68ea,function(_0x28063a){if(_0x28063a[_0xeabc('0x17')]('-')===0x0){return[_0x28063a===_0xeabc('0x18')?sequelize[_0xeabc('0x19')](sequelize[_0xeabc('0x1a')]('priority'),_0xeabc('0x1b')):_0x28063a[_0xeabc('0x1c')](0x1),_0xeabc('0x1d')];}else{return[_0x28063a==='priority'?sequelize[_0xeabc('0x19')](sequelize[_0xeabc('0x1a')](_0xeabc('0x18')),_0xeabc('0x1b')):_0x28063a,'ASC'];}});}return _0x31201a;};exports[_0xeabc('0x1e')]=function(_0x480440,_0x27dbaf){if(_['isEmpty'](_0x480440)){return _0x480440;}if(_[_0xeabc('0x14')](_0x480440)){for(var _0x12acbd=0x0;_0x12acbd<_0x480440[_0xeabc('0x1f')];_0x12acbd+=0x1){_0x480440[_0x12acbd]=this[_0xeabc('0x1e')](_0x480440[_0x12acbd],_0x27dbaf);}return _0x480440;}if(!_[_0xeabc('0x20')](_0x480440)){return _0x480440;}if(_[_0xeabc('0x21')](_0x27dbaf)){_0x27dbaf=[_0x27dbaf];}if(!_[_0xeabc('0x14')](_0x27dbaf)){return _0x480440;}for(var _0x4c2693=0x0;_0x4c2693<_0x27dbaf['length'];_0x4c2693+=0x1){_[_0xeabc('0x22')](_0x480440,_0x27dbaf[_0x4c2693]);}for(var _0x5bf8f2 in _0x480440){if(_0x480440[_0xeabc('0x23')](_0x5bf8f2)){_0x480440[_0x5bf8f2]=this[_0xeabc('0x1e')](_0x480440[_0x5bf8f2],_0x27dbaf);}}return _0x480440;};exports['isNumeric']=function(_0x2163e6){return _0x2163e6[_0xeabc('0x24')](RegExp(_0xeabc('0x25')))?!![]:![];};exports[_0xeabc('0x26')]=function(_0x149170){return _0x149170[_0xeabc('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xeabc('0x27')]=function(_0x38dc0a){var _0x2915c1=[];_0x38dc0a['split'](/[ ,]+/)[_0xeabc('0x28')](function(_0x5bb1f1){_0x5bb1f1=_0x5bb1f1[_0xeabc('0x29')](/([^:]")"+/g,'$1');_0x5bb1f1='+'+_0x5bb1f1+'*';var _0x2d027e=/[ `!@#$%^&*()_\-?~]/;if(_0x5bb1f1[_0xeabc('0x24')](_0x2d027e))_0x5bb1f1='\x22'+_0x5bb1f1+'\x22';_0x2915c1[_0xeabc('0x2a')](_0x5bb1f1);});return _0x2915c1[_0xeabc('0x2b')]('\x20');};exports[_0xeabc('0x2c')]=function(_0x61c0af,_0x545d7f,_0x78510a){var _0x2df9e6={},_0x3bc45e={};if(_0x545d7f['query'][_0xeabc('0x2d')]){_0x545d7f[_0xeabc('0x2e')]['id']=_0x545d7f[_0xeabc('0x2e')]['$id'];delete _0x545d7f[_0xeabc('0x2e')][_0xeabc('0x2d')];}_0x2df9e6[_0xeabc('0x2f')]=_['map'](_0x61c0af,_0xeabc('0x30'));_0x2df9e6[_0xeabc('0x2e')]=_['keys'](_0x545d7f['query']);_0x2df9e6[_0xeabc('0x7')]=_[_0xeabc('0x31')](_0x2df9e6['model'],_0x2df9e6[_0xeabc('0x2e')]);_0x3bc45e[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x2df9e6[_0xeabc('0x2f')],this[_0xeabc('0x5')](_0x545d7f['query'][_0xeabc('0x5')]));_0x3bc45e['attributes']=_0x3bc45e[_0xeabc('0x32')][_0xeabc('0x1f')]?_0x3bc45e[_0xeabc('0x32')]:_0x2df9e6['model'];if(!_0x545d7f['query'][_0xeabc('0x23')]('nolimit')){_0x3bc45e[_0xeabc('0x15')]=this['limit'](_0x545d7f['query']['limit']);_0x3bc45e['offset']=this[_0xeabc('0x16')](_0x545d7f['query'][_0xeabc('0x16')]);}_0x3bc45e[_0xeabc('0x33')]=this['sort'](_0x545d7f[_0xeabc('0x2e')]['sort']);_0x3bc45e[_0xeabc('0x34')]=this['filters'](_[_0xeabc('0x35')](_0x545d7f[_0xeabc('0x2e')],_0x2df9e6[_0xeabc('0x7')]),_0x61c0af);if(_0x545d7f['query']['filter']){var _0x54a3ae=_0x61c0af;var _0x46056c=_0x545d7f[_0xeabc('0x2e')][_0xeabc('0x36')];if(typeof _0x46056c==='object'){_0x54a3ae=_['filter'](_0x61c0af,function(_0x5cd62e){return _[_0xeabc('0x4')](_0x46056c['columns'],_0x5cd62e[_0xeabc('0x30')]);});_0x46056c=_0x46056c['value'];}_0x3bc45e[_0xeabc('0x34')]=_['merge'](_0x3bc45e['where'],{'$or':_['map'](_0x54a3ae,function(_0x25958b){if(_0x25958b[_0xeabc('0xb')]!==_0xeabc('0x37')){if(_0x78510a){return sequelize[_0xeabc('0x34')](sequelize['fn']('lower',sequelize[_0xeabc('0x1a')](_0x25958b['name'])),{'$like':sequelize['fn'](_0xeabc('0x38'),'%'+_0x545d7f[_0xeabc('0x2e')][_0xeabc('0x36')]+'%')});}else{var _0x17a0df={};_0x17a0df[_0x25958b[_0xeabc('0x30')]]={'$like':'%'+_0x545d7f['query']['filter']+'%'};return _0x17a0df;}}})});}_0x3bc45e=_[_0xeabc('0x39')]({},_0x3bc45e,_0x545d7f['options']);return _0x3bc45e;}; \ No newline at end of file +var _0x3baf=['filter','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','format','$lte','utc','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','DESC','omit','isObject','length','isNumeric','^[+]?[0-9]*$','isEmail','forEach','match','push','join','getOptions','query','$id','model','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','where','pick'];(function(_0x6ec1fe,_0x3e820c){var _0x16d021=function(_0xbd09b5){while(--_0xbd09b5){_0x6ec1fe['push'](_0x6ec1fe['shift']());}};_0x16d021(++_0x3e820c);}(_0x3baf,0xf7));var _0xf3ba=function(_0x4d9443,_0xe0d01f){_0x4d9443=_0x4d9443-0x0;var _0x350586=_0x3baf[_0x4d9443];return _0x350586;};'use strict';var _=require(_0xf3ba('0x0'));var sequelize=require(_0xf3ba('0x1'));var moment=require(_0xf3ba('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3979b3){var _0x29bbc2=['ne'];try{var _0x22f9c0=JSON[_0xf3ba('0x3')](_0x3979b3);var _0x306bdd=Object[_0xf3ba('0x4')](_0x22f9c0)[0x0];return _0x29bbc2[_0xf3ba('0x5')](_0x306bdd);}catch(_0x57e17d){return![];}}function getOperatorValue(_0x1c7a62){var _0x475268=JSON[_0xf3ba('0x3')](_0x1c7a62);var _0x1284b7=Object['keys'](_0x475268)[0x0];var _0x579135=_0x475268[_0x1284b7];return{['$'+_0x1284b7]:_0x579135};}exports['fields']=function(_0x32f810){var _0x5affaf=null;if(_0x32f810){_0x5affaf=_0x32f810[_0xf3ba('0x6')](',');}return _0x5affaf;};exports[_0xf3ba('0x7')]=function(_0x3ae5fb,_0x40cff2){var _0x3a5714={};if(!_[_0xf3ba('0x8')](_0x3ae5fb)){_[_0xf3ba('0x9')](_0x3ae5fb,function(_0x318b41,_0x32ecd1){try{if(_0x40cff2){var _0x301ca1=_[_0xf3ba('0xa')](_0x40cff2,{'name':_0x32ecd1})||{};if(hasSequelizeOperator(_0x318b41)){_0x3a5714[_0x32ecd1]=getOperatorValue(_0x318b41);}else if(_0x301ca1[_0xf3ba('0xb')]===_0xf3ba('0xc')&&_[_0xf3ba('0xd')](_0x318b41)){var _0x26cefe=JSON[_0xf3ba('0x3')](_0x318b41);var _0x347cf4={'$gte':moment(moment(_0x26cefe[_0xf3ba('0xe')])['format'](_0xf3ba('0xf')))['utc']()[_0xf3ba('0x10')](),'$lte':moment(moment(_0x26cefe[_0xf3ba('0x11')])[_0xf3ba('0x10')](_0xf3ba('0xf')))[_0xf3ba('0x12')]()['subtract'](0x1,'s')[_0xf3ba('0x10')]()};_0x3a5714[_0x32ecd1]=_0x347cf4;}else if(_0x301ca1[_0xf3ba('0x13')]===_0xf3ba('0x14')){_0x3a5714[_0x32ecd1]=_0x318b41;}else{_0x3a5714[_0x32ecd1]=_['isArray'](_0x318b41)?_0x318b41:JSON[_0xf3ba('0x3')](_0x318b41);}}else{_0x3a5714[_0x32ecd1]=_[_0xf3ba('0x15')](_0x318b41)?_0x318b41:JSON[_0xf3ba('0x3')](_0x318b41);}}catch(_0x44de40){_0x3a5714[_0x32ecd1]=_0x318b41['split'](',');}});}return _0x3a5714;};exports[_0xf3ba('0x16')]=function(_0x3b0d9e){_0x3b0d9e=parseInt(_0x3b0d9e,0xa);if(!_0x3b0d9e||_0x3b0d9e<0x0){_0x3b0d9e=LIMIT_VALUE;}return _0x3b0d9e;};exports['offset']=function(_0x479d65){_0x479d65=parseInt(_0x479d65,0xa);if(!_0x479d65||_0x479d65<0x0){_0x479d65=0x0;}return _0x479d65;};exports[_0xf3ba('0x17')]=function(_0x2bd5b8){var _0x854fc4,_0x5d351f=null;if(_0x2bd5b8){_0x854fc4=_0x2bd5b8[_0xf3ba('0x6')](',');_0x5d351f=_[_0xf3ba('0x18')](_0x854fc4,function(_0x35d6d4){if(_0x35d6d4[_0xf3ba('0x19')]('-')===0x0){return[_0x35d6d4===_0xf3ba('0x1a')?sequelize[_0xf3ba('0x1b')](sequelize[_0xf3ba('0x1c')]('priority'),'unsigned'):_0x35d6d4['substr'](0x1),_0xf3ba('0x1d')];}else{return[_0x35d6d4===_0xf3ba('0x1a')?sequelize[_0xf3ba('0x1b')](sequelize[_0xf3ba('0x1c')](_0xf3ba('0x1a')),'unsigned'):_0x35d6d4,'ASC'];}});}return _0x5d351f;};exports[_0xf3ba('0x1e')]=function(_0xd6c2da,_0x5410a2){if(_[_0xf3ba('0x8')](_0xd6c2da)){return _0xd6c2da;}if(_[_0xf3ba('0x15')](_0xd6c2da)){for(var _0x59ce48=0x0;_0x59ce48<_0xd6c2da['length'];_0x59ce48+=0x1){_0xd6c2da[_0x59ce48]=this[_0xf3ba('0x1e')](_0xd6c2da[_0x59ce48],_0x5410a2);}return _0xd6c2da;}if(!_[_0xf3ba('0x1f')](_0xd6c2da)){return _0xd6c2da;}if(_['isString'](_0x5410a2)){_0x5410a2=[_0x5410a2];}if(!_[_0xf3ba('0x15')](_0x5410a2)){return _0xd6c2da;}for(var _0x318817=0x0;_0x318817<_0x5410a2[_0xf3ba('0x20')];_0x318817+=0x1){_['unset'](_0xd6c2da,_0x5410a2[_0x318817]);}for(var _0x29ed57 in _0xd6c2da){if(_0xd6c2da['hasOwnProperty'](_0x29ed57)){_0xd6c2da[_0x29ed57]=this['omit'](_0xd6c2da[_0x29ed57],_0x5410a2);}}return _0xd6c2da;};exports[_0xf3ba('0x21')]=function(_0x19ef2c){return _0x19ef2c['match'](RegExp(_0xf3ba('0x22')))?!![]:![];};exports[_0xf3ba('0x23')]=function(_0x5081aa){return _0x5081aa['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1c6062){var _0x6423f=[];_0x1c6062['split'](/[ ,]+/)[_0xf3ba('0x24')](function(_0x5b2f0d){_0x5b2f0d=_0x5b2f0d['replace'](/([^:]")"+/g,'$1');_0x5b2f0d='+'+_0x5b2f0d+'*';var _0x28dee0=/[ `!@#$%^&*()_\-?~]/;if(_0x5b2f0d[_0xf3ba('0x25')](_0x28dee0))_0x5b2f0d='\x22'+_0x5b2f0d+'\x22';_0x6423f[_0xf3ba('0x26')](_0x5b2f0d);});return _0x6423f[_0xf3ba('0x27')]('\x20');};exports[_0xf3ba('0x28')]=function(_0xf1b77a,_0x508d52,_0x21c300){var _0x487ed6={},_0x1b10b9={};if(_0x508d52[_0xf3ba('0x29')]['$id']){_0x508d52[_0xf3ba('0x29')]['id']=_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x2a')];delete _0x508d52[_0xf3ba('0x29')]['$id'];}_0x487ed6[_0xf3ba('0x2b')]=_['map'](_0xf1b77a,'name');_0x487ed6['query']=_[_0xf3ba('0x4')](_0x508d52[_0xf3ba('0x29')]);_0x487ed6[_0xf3ba('0x7')]=_[_0xf3ba('0x2c')](_0x487ed6[_0xf3ba('0x2b')],_0x487ed6['query']);_0x1b10b9[_0xf3ba('0x2d')]=_['intersection'](_0x487ed6[_0xf3ba('0x2b')],this['fields'](_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x2e')]));_0x1b10b9[_0xf3ba('0x2d')]=_0x1b10b9[_0xf3ba('0x2d')]['length']?_0x1b10b9[_0xf3ba('0x2d')]:_0x487ed6[_0xf3ba('0x2b')];if(!_0x508d52['query'][_0xf3ba('0x2f')](_0xf3ba('0x30'))){_0x1b10b9[_0xf3ba('0x16')]=this[_0xf3ba('0x16')](_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x16')]);_0x1b10b9[_0xf3ba('0x31')]=this['offset'](_0x508d52[_0xf3ba('0x29')]['offset']);}_0x1b10b9[_0xf3ba('0x32')]=this['sort'](_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x17')]);_0x1b10b9[_0xf3ba('0x33')]=this[_0xf3ba('0x7')](_[_0xf3ba('0x34')](_0x508d52['query'],_0x487ed6['filters']),_0xf1b77a);if(_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x35')]){var _0x417911=_0xf1b77a;var _0x433752=_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x35')];if(typeof _0x433752==='object'){_0x417911=_[_0xf3ba('0x35')](_0xf1b77a,function(_0x4b9c9e){return _[_0xf3ba('0x5')](_0x433752[_0xf3ba('0x36')],_0x4b9c9e[_0xf3ba('0x13')]);});_0x433752=_0x433752[_0xf3ba('0x37')];}_0x1b10b9[_0xf3ba('0x33')]=_[_0xf3ba('0x38')](_0x1b10b9[_0xf3ba('0x33')],{'$or':_[_0xf3ba('0x18')](_0x417911,function(_0x5b9a0c){if(_0x5b9a0c[_0xf3ba('0xb')]!==_0xf3ba('0x39')){if(_0x21c300){return sequelize[_0xf3ba('0x33')](sequelize['fn'](_0xf3ba('0x3a'),sequelize[_0xf3ba('0x1c')](_0x5b9a0c[_0xf3ba('0x13')])),{'$like':sequelize['fn'](_0xf3ba('0x3a'),'%'+_0x508d52['query'][_0xf3ba('0x35')]+'%')});}else{var _0x35481b={};_0x35481b[_0x5b9a0c['name']]={'$like':'%'+_0x508d52[_0xf3ba('0x29')][_0xf3ba('0x35')]+'%'};return _0x35481b;}}})});}_0x1b10b9=_[_0xf3ba('0x38')]({},_0x1b10b9,_0x508d52[_0xf3ba('0x3b')]);return _0x1b10b9;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7412fc2..8522230 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 _0xa236=['faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','pick','jayson/promise','../../mysqldb','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','Agents','then','result','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','User','findAll','name','mailPause','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','substring','indexOf','fullname','internal','sort','pauseType','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus'];(function(_0x6cb5ae,_0x43a8c8){var _0x19fdee=function(_0x2c5d15){while(--_0x2c5d15){_0x6cb5ae['push'](_0x6cb5ae['shift']());}};_0x19fdee(++_0x43a8c8);}(_0xa236,0x178));var _0x6a23=function(_0x1c01e4,_0x168c6d){_0x1c01e4=_0x1c01e4-0x0;var _0x110658=_0xa236[_0x1c01e4];return _0x110658;};'use strict';var _=require('lodash');var jayson=require(_0x6a23('0x0'));var db=require(_0x6a23('0x1'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function isAgentPaused(_0x34b865,_0x3f0bbc){var _0x5bd72f=[_0x34b865[_0x6a23('0x2')],_0x34b865[_0x6a23('0x3')],_0x34b865['mailPause'],_0x34b865[_0x6a23('0x4')],_0x34b865[_0x6a23('0x5')],_0x34b865[_0x6a23('0x6')],_0x34b865[_0x6a23('0x7')]];if(!_0x3f0bbc)return _['every'](_0x5bd72f);var _0x20f9da=_[_0x6a23('0x8')](_0x5bd72f);return _0x20f9da[_0x6a23('0x9')]>0x0&&_0x20f9da[_0x6a23('0x9')]<_0x5bd72f[_0x6a23('0x9')]?!![]:![];}function isIdle(_0x475000){return _0x475000===_0x6a23('0xa')||_0x475000===_0x6a23('0xb')||_0x475000===_0x6a23('0xc')||_0x475000===_0x6a23('0xd')||_[_0x6a23('0xe')](_0x475000);}function isAgentIdle(_0x496dd0){if(_0x496dd0[_0x6a23('0xf')]!==_0x6a23('0xa')&&_0x496dd0[_0x6a23('0x6')]){_0x496dd0[_0x6a23('0xf')]=_0x6a23('0x10');return![];}return _['every']([_0x496dd0[_0x6a23('0x11')],_0x496dd0['faxStatus'],_0x496dd0['mailStatus'],_0x496dd0[_0x6a23('0x12')],_0x496dd0[_0x6a23('0x13')],_0x496dd0['voiceStatus'],_0x496dd0['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x6a23('0x14'),{})[_0x6a23('0x15')](function(_0x4e0275){if(_0x4e0275['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x5f1b98=_0x4e0275[_0x6a23('0x16')];return routingClient[_0x6a23('0x17')](_0x6a23('0x14'),{})['then'](function(_0x4b96d9){if(_0x4b96d9[_0x6a23('0x18')]){throw new Error(_0x6a23('0x19'));}var _0x31d26e=_0x4b96d9['result'];return _['merge']({},_0x5f1b98,_0x31d26e);});})[_0x6a23('0x1a')](function(_0xa5ccb){throw _0xa5ccb;});}exports[_0x6a23('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x1bd073){var _0xa35b92='unknown';if(isAgentPaused(_0x1bd073))_0xa35b92='pause';else if(isAgentPaused(_0x1bd073,!![]))_0xa35b92=_0x6a23('0x1c');else if(isAgentIdle(_0x1bd073))_0xa35b92=_0x6a23('0xa');else _0xa35b92=_0x6a23('0x1d');return _0xa35b92;}exports[_0x6a23('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0xa3d361,_0x333152){var _0x3659a7=_['isArray'](_0xa3d361)?_0xa3d361:[_0xa3d361];var _0x29aacc=_[_0x6a23('0x1f')](_0x333152)+_0x6a23('0x20');var _0x140adc=_[_0x6a23('0x21')](_0x3659a7,function(_0x3e7127){return db[_0x29aacc][_0x6a23('0x22')]({'where':{'id':_0x3e7127}})[_0x6a23('0x15')](function(_0x203003){if(!_0x203003)return[];return _0x203003[_0x6a23('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x6a23('0x24')](_0x140adc)[_0x6a23('0x15')](function(_0x5374ce){var _0x587eae=_(_0x5374ce)[_0x6a23('0x25')]()[_0x6a23('0x21')]('id')[_0x6a23('0x26')]()[_0x6a23('0x27')]();return _0x587eae;});}exports[_0x6a23('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4d4ae2,_0x2df0de,_0x200e50){try{if(_0x2df0de[_0x6a23('0x9')]>0x0){_0x4d4ae2=_0x4d4ae2[_0x6a23('0x8')](function(_0x5b61cf){return _0x2df0de[_0x6a23('0x29')](_0x5b61cf['id']);});}var _0x14f6da=_0x4d4ae2['filter'](function(_0x40ab7d){var _0x47c468=_0x6a23('0x1d');if(isAgentIdle(_0x40ab7d)){_0x47c468=_0x6a23('0xa');}return _0x47c468===_0x200e50;});return _[_0x6a23('0x21')](_0x14f6da,'id');}catch(_0x273b5c){throw _0x273b5c;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5c7c0d,_0x3eb767,_0x3fb080){return Promise[_0x6a23('0x2a')]()[_0x6a23('0x15')](function(){if(_0x3eb767[_0x6a23('0x9')]>0x0){_0x5c7c0d=_0x5c7c0d['filter'](function(_0x1c8540){return _0x3eb767[_0x6a23('0x29')](_0x1c8540['id']);});}return _0x5c7c0d;})['then'](function(){return db[_0x6a23('0x2b')][_0x6a23('0x2c')]({'attributes':['id',_0x6a23('0x2d'),'fullname',_0x6a23('0x2'),'faxPause',_0x6a23('0x2e'),_0x6a23('0x4'),_0x6a23('0x5'),_0x6a23('0x6'),_0x6a23('0x7'),'pauseType'],'where':{'id':{'$in':_[_0x6a23('0x21')](_0x5c7c0d,'id')}},'raw':!![]});})[_0x6a23('0x15')](function(_0x34ba15){return _0x34ba15[_0x6a23('0x21')](function(_0x375736){var _0x3df028=_[_0x6a23('0x2f')](_0x5c7c0d,['id',_0x375736['id']]);var _0x4f8d6d=filterAgentAttributes(_0x3df028);_[_0x6a23('0x30')](_0x375736,_0x4f8d6d);_0x375736[_0x6a23('0x31')]=getAgentStatus(_0x375736);return _0x375736;});})['then'](function(_0x3cb46c){var _0x4f1fa6=sortAgentsByStatus(_0x3cb46c,_0x3fb080);return _[_0x6a23('0x21')](_0x4f1fa6,'id');})[_0x6a23('0x1a')](function(_0x4f8125){throw _0x4f8125;});}exports[_0x6a23('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x305a33){var _0x3d6d4e={'fields':[],'order':null};var _0x432d8a=_0x305a33[_0x6a23('0x33')](',');_0x3d6d4e[_0x6a23('0x34')]=_[_0x6a23('0x8')](_0x432d8a,function(_0x441b52){if(!_0x441b52['includes']('globalStatus')){return!![];}_0x3d6d4e[_0x6a23('0x35')]=_[_0x6a23('0x36')](_0x441b52,'-')?_0x6a23('0x37'):_0x6a23('0x38');return![];});return _0x3d6d4e;}exports[_0x6a23('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x468e5a){if(_0x468e5a[_0x6a23('0x29')]('fullname')&&!_0x468e5a[_0x6a23('0x29')]('internal')){var _0x1b8ecc=_0x468e5a[_0x6a23('0x3a')](0x0,_0x468e5a[_0x6a23('0x3b')](_0x6a23('0x3c')));_0x468e5a+=','+_0x1b8ecc+_0x6a23('0x3d');}return _0x468e5a;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xcff9e,_0x1b2c9d){var _0x5716ac=_0xcff9e[_0x6a23('0x3e')](function(_0x2caa6a,_0x2390e8){if(_0x2caa6a[_0x6a23('0x31')]===_0x2390e8['globalStatus']){if(_0x2caa6a[_0x6a23('0x31')]===_0x6a23('0x10')){if(_0x1b2c9d==='DESC'){return(_0x2caa6a[_0x6a23('0x3f')]||'')<(_0x2390e8[_0x6a23('0x3f')]||'')||_0x2caa6a[_0x6a23('0x3c')][_0x6a23('0x40')]()>_0x2390e8[_0x6a23('0x3c')][_0x6a23('0x40')]()?0x1:-0x1;}else{return(_0x2caa6a[_0x6a23('0x3f')]||'')<(_0x2390e8[_0x6a23('0x3f')]||'')||_0x2caa6a[_0x6a23('0x3c')][_0x6a23('0x40')]()>_0x2390e8[_0x6a23('0x3c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1b2c9d===_0x6a23('0x37')){return _0x2caa6a[_0x6a23('0x3c')][_0x6a23('0x40')]()<_0x2390e8[_0x6a23('0x3c')][_0x6a23('0x40')]()?0x1:-0x1;}else{return _0x2caa6a[_0x6a23('0x3c')][_0x6a23('0x40')]()<_0x2390e8[_0x6a23('0x3c')][_0x6a23('0x40')]()?-0x1:0x1;}}}else{if(_0x1b2c9d===_0x6a23('0x37')){return _0x2caa6a[_0x6a23('0x31')]<_0x2390e8['globalStatus']?0x1:-0x1;}else{return _0x2caa6a[_0x6a23('0x31')]<_0x2390e8[_0x6a23('0x31')]?-0x1:0x1;}}});return _0x5716ac;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0xa0c184){var _0x4e8604=[_0x6a23('0x41'),_0x6a23('0x42'),_0x6a23('0x43'),_0x6a23('0x44'),_0x6a23('0x3f'),_0x6a23('0x44'),_0x6a23('0x3d'),_0x6a23('0x45'),'chatPause','openchannelPause','mailPause',_0x6a23('0x5'),_0x6a23('0x7'),_0x6a23('0x3'),_0x6a23('0x6'),_0x6a23('0x46'),_0x6a23('0x47'),_0x6a23('0x48'),_0x6a23('0x49'),'whatsappCapacity',_0x6a23('0x4a'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity',_0x6a23('0x4b'),'whatsappCurrentCapacity',_0x6a23('0x4c'),'chatStatus',_0x6a23('0x12'),_0x6a23('0x4d'),_0x6a23('0x13'),_0x6a23('0x4e'),_0x6a23('0x4f'),'voiceStatus',_0x6a23('0x50'),_0x6a23('0x51'),_0x6a23('0x52'),_0x6a23('0x53'),_0x6a23('0x54'),'faxStatusTime',_0x6a23('0x55'),'queue',_0x6a23('0x56'),_0x6a23('0x57'),'phoneBarEnableScreenRecordingByAgent',_0x6a23('0x58'),_0x6a23('0x59')];var _0x41646a=[_0x6a23('0x2'),_0x6a23('0x4'),'mailPause','smsPause',_0x6a23('0x7'),_0x6a23('0x3'),_0x6a23('0x6'),_0x6a23('0x42')];var _0x17c607=_(_0xa0c184)['omit'](_0x41646a)[_0x6a23('0x5a')](_0x4e8604)[_0x6a23('0x27')]();return _0x17c607;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x7462=['smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','voicePause','pause','every','chatStatus','faxStatus','mailStatus','smsStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','User','fullname','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity'];(function(_0x4c0df4,_0x2d2d89){var _0x49d6dc=function(_0x5946d7){while(--_0x5946d7){_0x4c0df4['push'](_0x4c0df4['shift']());}};_0x49d6dc(++_0x2d2d89);}(_0x7462,0x128));var _0x2746=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x7462[_0x46ec32];return _0x338f60;};'use strict';var _=require(_0x2746('0x0'));var jayson=require(_0x2746('0x1'));var db=require(_0x2746('0x2'))['db'];var amiClient=jayson[_0x2746('0x3')][_0x2746('0x4')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function isAgentPaused(_0x1c1e21,_0x277593){var _0xfb53c3=[_0x1c1e21[_0x2746('0x5')],_0x1c1e21[_0x2746('0x6')],_0x1c1e21[_0x2746('0x7')],_0x1c1e21[_0x2746('0x8')],_0x1c1e21[_0x2746('0x9')],_0x1c1e21['voicePause'],_0x1c1e21[_0x2746('0xa')]];if(!_0x277593)return _['every'](_0xfb53c3);var _0x3a75e0=_['filter'](_0xfb53c3);return _0x3a75e0[_0x2746('0xb')]>0x0&&_0x3a75e0['length']<_0xfb53c3['length']?!![]:![];}function isIdle(_0x17ea01){return _0x17ea01===_0x2746('0xc')||_0x17ea01===_0x2746('0xd')||_0x17ea01===_0x2746('0xe')||_0x17ea01===_0x2746('0xf')||_[_0x2746('0x10')](_0x17ea01);}function isAgentIdle(_0x2e53d0){if(_0x2e53d0[_0x2746('0x11')]!==_0x2746('0xc')&&_0x2e53d0[_0x2746('0x12')]){_0x2e53d0[_0x2746('0x11')]=_0x2746('0x13');return![];}return _[_0x2746('0x14')]([_0x2e53d0[_0x2746('0x15')],_0x2e53d0[_0x2746('0x16')],_0x2e53d0[_0x2746('0x17')],_0x2e53d0['openchannelStatus'],_0x2e53d0[_0x2746('0x18')],_0x2e53d0['voiceStatus'],_0x2e53d0['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x2746('0x19')]('Agents',{})[_0x2746('0x1a')](function(_0x111d49){if(_0x111d49[_0x2746('0x1b')]){throw new Error(_0x2746('0x1c'));}var _0x45ab0d=_0x111d49[_0x2746('0x1d')];return routingClient[_0x2746('0x19')](_0x2746('0x1e'),{})[_0x2746('0x1a')](function(_0x2a1103){if(_0x2a1103['error']){throw new Error(_0x2746('0x1f'));}var _0xa40d1f=_0x2a1103[_0x2746('0x1d')];return _[_0x2746('0x20')]({},_0x45ab0d,_0xa40d1f);});})[_0x2746('0x21')](function(_0x7e7e4d){throw _0x7e7e4d;});}exports[_0x2746('0x22')]=getRealtimeAgents;function getAgentStatus(_0x1a0f6c){var _0x1d7281=_0x2746('0xd');if(isAgentPaused(_0x1a0f6c))_0x1d7281=_0x2746('0x13');else if(isAgentPaused(_0x1a0f6c,!![]))_0x1d7281=_0x2746('0x23');else if(isAgentIdle(_0x1a0f6c))_0x1d7281=_0x2746('0xc');else _0x1d7281='busy';return _0x1d7281;}exports[_0x2746('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x1aad98,_0x3e36de){var _0x2c66e5=_['isArray'](_0x1aad98)?_0x1aad98:[_0x1aad98];var _0x2ae21e=_[_0x2746('0x25')](_0x3e36de)+_0x2746('0x26');var _0x2cac6a=_[_0x2746('0x27')](_0x2c66e5,function(_0x539c19){return db[_0x2ae21e][_0x2746('0x28')]({'where':{'id':_0x539c19}})['then'](function(_0x5388c0){if(!_0x5388c0)return[];return _0x5388c0[_0x2746('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x2746('0x2a')](_0x2cac6a)[_0x2746('0x1a')](function(_0x1324d1){var _0x453c5d=_(_0x1324d1)[_0x2746('0x2b')]()['map']('id')[_0x2746('0x2c')]()[_0x2746('0x2d')]();return _0x453c5d;});}exports[_0x2746('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x29fe7f,_0x4688db,_0x3ce1ba){try{if(_0x4688db['length']>0x0){_0x29fe7f=_0x29fe7f[_0x2746('0x2f')](function(_0x21b4d2){return _0x4688db[_0x2746('0x30')](_0x21b4d2['id']);});}var _0x448a63=_0x29fe7f['filter'](function(_0x291bb5){var _0x4b89a8=_0x2746('0x31');if(isAgentIdle(_0x291bb5)){_0x4b89a8=_0x2746('0xc');}return _0x4b89a8===_0x3ce1ba;});return _[_0x2746('0x27')](_0x448a63,'id');}catch(_0x543cbb){throw _0x543cbb;}}exports[_0x2746('0x32')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3a1da4,_0x61fccc,_0xf41a8c){return Promise[_0x2746('0x33')]()[_0x2746('0x1a')](function(){if(_0x61fccc[_0x2746('0xb')]>0x0){_0x3a1da4=_0x3a1da4[_0x2746('0x2f')](function(_0x279d30){return _0x61fccc[_0x2746('0x30')](_0x279d30['id']);});}return _0x3a1da4;})[_0x2746('0x1a')](function(){return db[_0x2746('0x34')]['findAll']({'attributes':['id','name',_0x2746('0x35'),_0x2746('0x5'),'faxPause',_0x2746('0x7'),_0x2746('0x8'),_0x2746('0x9'),_0x2746('0x12'),_0x2746('0xa'),'pauseType'],'where':{'id':{'$in':_[_0x2746('0x27')](_0x3a1da4,'id')}},'raw':!![]});})['then'](function(_0x4b4f4d){return _0x4b4f4d[_0x2746('0x27')](function(_0x1c4acf){var _0x24f620=_[_0x2746('0x36')](_0x3a1da4,['id',_0x1c4acf['id']]);var _0x42d820=filterAgentAttributes(_0x24f620);_[_0x2746('0x20')](_0x1c4acf,_0x42d820);_0x1c4acf[_0x2746('0x37')]=getAgentStatus(_0x1c4acf);return _0x1c4acf;});})[_0x2746('0x1a')](function(_0x4514f1){var _0x56f4d5=sortAgentsByStatus(_0x4514f1,_0xf41a8c);return _['map'](_0x56f4d5,'id');})[_0x2746('0x21')](function(_0x49123e){throw _0x49123e;});}exports[_0x2746('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4f318a){var _0x546ac1={'fields':[],'order':null};var _0x3935d1=_0x4f318a[_0x2746('0x39')](',');_0x546ac1[_0x2746('0x3a')]=_['filter'](_0x3935d1,function(_0x2b73c2){if(!_0x2b73c2[_0x2746('0x30')](_0x2746('0x37'))){return!![];}_0x546ac1[_0x2746('0x3b')]=_[_0x2746('0x3c')](_0x2b73c2,'-')?_0x2746('0x3d'):'ASC';return![];});return _0x546ac1;}exports[_0x2746('0x3e')]=getUpdatedSortOptions;function validateSortParameter(_0x472851){if(_0x472851[_0x2746('0x30')](_0x2746('0x35'))&&!_0x472851['includes'](_0x2746('0x3f'))){var _0x316610=_0x472851[_0x2746('0x40')](0x0,_0x472851['indexOf']('fullname'));_0x472851+=','+_0x316610+'internal';}return _0x472851;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x197359,_0x33e50a){var _0x5907d3=_0x197359[_0x2746('0x41')](function(_0xdc09f7,_0x501cce){if(_0xdc09f7[_0x2746('0x37')]===_0x501cce['globalStatus']){if(_0xdc09f7['globalStatus']===_0x2746('0x13')){if(_0x33e50a===_0x2746('0x3d')){return(_0xdc09f7[_0x2746('0x42')]||'')<(_0x501cce[_0x2746('0x42')]||'')||_0xdc09f7['fullname'][_0x2746('0x43')]()>_0x501cce['fullname'][_0x2746('0x43')]()?0x1:-0x1;}else{return(_0xdc09f7[_0x2746('0x42')]||'')<(_0x501cce[_0x2746('0x42')]||'')||_0xdc09f7['fullname']['toLowerCase']()>_0x501cce[_0x2746('0x35')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x33e50a===_0x2746('0x3d')){return _0xdc09f7['fullname'][_0x2746('0x43')]()<_0x501cce['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0xdc09f7[_0x2746('0x35')][_0x2746('0x43')]()<_0x501cce['fullname'][_0x2746('0x43')]()?-0x1:0x1;}}}else{if(_0x33e50a===_0x2746('0x3d')){return _0xdc09f7[_0x2746('0x37')]<_0x501cce[_0x2746('0x37')]?0x1:-0x1;}else{return _0xdc09f7['globalStatus']<_0x501cce[_0x2746('0x37')]?-0x1:0x1;}}});return _0x5907d3;}exports[_0x2746('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x335790){var _0x396986=[_0x2746('0x45'),_0x2746('0x46'),_0x2746('0x47'),_0x2746('0x48'),_0x2746('0x42'),_0x2746('0x48'),_0x2746('0x3f'),_0x2746('0x49'),_0x2746('0x5'),'openchannelPause',_0x2746('0x7'),_0x2746('0x9'),_0x2746('0xa'),_0x2746('0x6'),_0x2746('0x12'),_0x2746('0x4a'),_0x2746('0x4b'),'mailCapacity',_0x2746('0x4c'),_0x2746('0x4d'),_0x2746('0x4e'),_0x2746('0x4f'),'openchannelCurrentCapacity',_0x2746('0x50'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x2746('0x51'),'chatStatus','openchannelStatus',_0x2746('0x17'),_0x2746('0x18'),_0x2746('0x52'),_0x2746('0x16'),_0x2746('0x11'),_0x2746('0x53'),_0x2746('0x54'),'mailStatusTime',_0x2746('0x55'),_0x2746('0x56'),_0x2746('0x57'),'voiceStatusTime',_0x2746('0x58'),'destconnectedlinenum','screenrecording',_0x2746('0x59'),'phoneBarEnableAutomaticScreenRecording','routealias'];var _0x2a36ab=[_0x2746('0x5'),_0x2746('0x8'),'mailPause',_0x2746('0x9'),_0x2746('0xa'),_0x2746('0x6'),_0x2746('0x12'),_0x2746('0x46')];var _0x5b9b93=_(_0x335790)[_0x2746('0x5a')](_0x2a36ab)[_0x2746('0x5b')](_0x396986)[_0x2746('0x2d')]();return _0x5b9b93;}exports[_0x2746('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 23920be..b6fb73d 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 _0x02d6=['request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','outbound','concat','map','get','loggedInDb','waiting','talking','find','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','busy','ringing','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice'];(function(_0x186ed1,_0x6918ec){var _0x441cc7=function(_0x492747){while(--_0x492747){_0x186ed1['push'](_0x186ed1['shift']());}};_0x441cc7(++_0x6918ec);}(_0x02d6,0x83));var _0x602d=function(_0x4bbd94,_0x29e165){_0x4bbd94=_0x4bbd94-0x0;var _0x5aab27=_0x02d6[_0x4bbd94];return _0x5aab27;};'use strict';var _=require('lodash');var jayson=require(_0x602d('0x0'));var util=require(_0x602d('0x1'));var amiClient=jayson[_0x602d('0x2')][_0x602d('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x602d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x602d('0x4'),_0x602d('0x5'),_0x602d('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x602d('0x7'),'inUse','invalid','loggedInDb','notInUse','onHold',_0x602d('0x8'),'ringInUse','talking',_0x602d('0x9'),_0x602d('0xa')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x602d('0xb'),_0x602d('0xc'),_0x602d('0xd'),'statusMessage',_0x602d('0xe'),_0x602d('0xf'),_0x602d('0x10'),_0x602d('0x11'),_0x602d('0x12'),_0x602d('0x13'),_0x602d('0x14'),_0x602d('0x15'),_0x602d('0x16'),_0x602d('0x17'),_0x602d('0x18'),_0x602d('0x19'),_0x602d('0x1a'),_0x602d('0x1b'),_0x602d('0x1c'),_0x602d('0x1d'),_0x602d('0x1e'),_0x602d('0x1f'),_0x602d('0x20')];function getRealtimeQueues(_0x1293d0,_0x310d8a){var _0x4bf8d0=_0x310d8a===_0x602d('0x21')?amiClient:routingClient;return _0x4bf8d0[_0x602d('0x22')](_[_0x602d('0x23')](_0x310d8a)+'Queues',_0x1293d0)[_0x602d('0x24')](function(_0x5c7442){if(_0x5c7442[_0x602d('0x25')])throw new Error(util[_0x602d('0x26')](_0x602d('0x27'),_0x310d8a));return _0x5c7442[_0x602d('0x28')];})[_0x602d('0x29')](function(_0x465f44){throw _0x465f44;});}exports[_0x602d('0x2a')]=getRealtimeQueues;function initializeQueues(_0xde957e,_0x45c5ab,_0x1fc6ee,_0x45aaf1){var _0x5770a2=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1fc6ee==='voice'){if(_0x45aaf1===_0x602d('0x2b')){_0x5770a2=_0x5770a2['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x45aaf1===_0x602d('0x2c')){_0x5770a2=_0x5770a2[_0x602d('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xde957e[_0x602d('0x2e')](function(_0x8021ed){var _0x4c222f=_0x8021ed[_0x602d('0x2f')]({'plain':!![]});_0x4c222f[_0x602d('0x6')]=0x0;_0x4c222f[_0x602d('0x30')]=0x0;_0x4c222f[_0x602d('0x5')]=0x0;_0x4c222f[_0x602d('0x4')]=0x0;_0x4c222f[_0x602d('0x31')]=0x0;if(_0x1fc6ee===_0x602d('0x21')){_0x4c222f[_0x602d('0x32')]=0x0;_0x4c222f[_0x602d('0x7')]=0x0;if(_0x45aaf1==='outbound'){_0x4c222f[_0x602d('0xb')]=0x0;_0x4c222f[_0x602d('0xc')]=0x0;}}var _0x2d87fd=_[_0x602d('0x33')](_0x45c5ab,['id',_0x4c222f['id']]);if(_0x2d87fd){_[_0x602d('0x34')](_0x4c222f,_[_0x602d('0x35')](_0x2d87fd,_0x5770a2));}return _0x4c222f;});}exports[_0x602d('0x36')]=initializeQueues; \ No newline at end of file +var _0xc0e0=['Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','map','get','loggedInDb','outbound','pTalking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','ringing','ringInUse','talking','unavailable','unknown','originated','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase'];(function(_0x46c2c1,_0x1d0df7){var _0x427a33=function(_0x498afa){while(--_0x498afa){_0x46c2c1['push'](_0x46c2c1['shift']());}};_0x427a33(++_0x1d0df7);}(_0xc0e0,0x19c));var _0x0c0e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xc0e0[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x0c0e('0x0'));var jayson=require(_0x0c0e('0x1'));var util=require(_0x0c0e('0x2'));var amiClient=jayson[_0x0c0e('0x3')][_0x0c0e('0x4')]({'port':0x232a});var routingClient=jayson[_0x0c0e('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x0c0e('0x5'),_0x0c0e('0x6'),_0x0c0e('0x7'),_0x0c0e('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x0c0e('0x9'),_0x0c0e('0xa'),_0x0c0e('0xb'),'loggedInDb',_0x0c0e('0xc'),'onHold',_0x0c0e('0xd'),_0x0c0e('0xe'),_0x0c0e('0xf'),_0x0c0e('0x10'),_0x0c0e('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x0c0e('0x12'),'message',_0x0c0e('0x13'),'dialActive',_0x0c0e('0x14'),_0x0c0e('0x15'),_0x0c0e('0x16'),_0x0c0e('0x17'),_0x0c0e('0x18'),'erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor',_0x0c0e('0x19'),'dialPredictiveIntervalMaxThreshold',_0x0c0e('0x1a'),_0x0c0e('0x1b'),_0x0c0e('0x1c'),_0x0c0e('0x1d'),_0x0c0e('0x1e'),_0x0c0e('0x1f'),_0x0c0e('0x20'),_0x0c0e('0x21')];function getRealtimeQueues(_0x39813b,_0x4df20a){var _0x449ccc=_0x4df20a==='voice'?amiClient:routingClient;return _0x449ccc[_0x0c0e('0x22')](_[_0x0c0e('0x23')](_0x4df20a)+_0x0c0e('0x24'),_0x39813b)[_0x0c0e('0x25')](function(_0x151bbd){if(_0x151bbd[_0x0c0e('0x26')])throw new Error(util[_0x0c0e('0x27')](_0x0c0e('0x28'),_0x4df20a));return _0x151bbd[_0x0c0e('0x29')];})[_0x0c0e('0x2a')](function(_0x4862ac){throw _0x4862ac;});}exports[_0x0c0e('0x2b')]=getRealtimeQueues;function initializeQueues(_0xa12a3e,_0x430bf3,_0x1f9e85,_0x57d54d){var _0x464f32=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1f9e85===_0x0c0e('0x2c')){if(_0x57d54d===_0x0c0e('0x2d')){_0x464f32=_0x464f32[_0x0c0e('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x57d54d==='outbound'){_0x464f32=_0x464f32['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xa12a3e[_0x0c0e('0x2f')](function(_0x2abfa3){var _0x165ceb=_0x2abfa3[_0x0c0e('0x30')]({'plain':!![]});_0x165ceb['paused']=0x0;_0x165ceb[_0x0c0e('0x31')]=0x0;_0x165ceb[_0x0c0e('0x6')]=0x0;_0x165ceb[_0x0c0e('0x5')]=0x0;_0x165ceb[_0x0c0e('0x8')]=0x0;if(_0x1f9e85===_0x0c0e('0x2c')){_0x165ceb[_0x0c0e('0xf')]=0x0;_0x165ceb[_0x0c0e('0x9')]=0x0;if(_0x57d54d===_0x0c0e('0x32')){_0x165ceb[_0x0c0e('0x33')]=0x0;_0x165ceb[_0x0c0e('0x12')]=0x0;}}var _0x451e56=_[_0x0c0e('0x34')](_0x430bf3,['id',_0x165ceb['id']]);if(_0x451e56){_[_0x0c0e('0x35')](_0x165ceb,_[_0x0c0e('0x36')](_0x451e56,_0x464f32));}return _0x165ceb;});}exports[_0x0c0e('0x37')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a26a2f1..60917a0 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0xa6d252,_0xf664a8){var _0x498d25=function(_0x2b83d8){while(--_0x2b83d8){_0xa6d252['push'](_0xa6d252['shift']());}};_0x498d25(++_0xf664a8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0xb198eb,_0x229557){var _0x5a63f7=function(_0x5940df){while(--_0x5940df){_0xb198eb['push'](_0xb198eb['shift']());}};_0x5a63f7(++_0x229557);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 71bf13b..1b23e28 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 _0xa6d3=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','digest','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','update','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','length','filter','internal','concat'];(function(_0x30e941,_0x24a9ef){var _0x45f43f=function(_0x22aba1){while(--_0x22aba1){_0x30e941['push'](_0x30e941['shift']());}};_0x45f43f(++_0x24a9ef);}(_0xa6d3,0x140));var _0x3a6d=function(_0x5eae6a,_0x2b886e){_0x5eae6a=_0x5eae6a-0x0;var _0x4fa9e8=_0xa6d3[_0x5eae6a];return _0x4fa9e8;};'use strict';var _=require(_0x3a6d('0x0'));var os=require('os');var crypto=require(_0x3a6d('0x1'));var machine=require(_0x3a6d('0x2'));var exec=require('child_process')[_0x3a6d('0x3')];var config=require(_0x3a6d('0x4'));function getInterfaces(){var _0x9e7625=[];var _0x106d1f=os[_0x3a6d('0x5')]();var _0x4778df=_['orderBy'](_['keys'](_0x106d1f));for(var _0x41d5b2=0x0;_0x41d5b2<_0x4778df[_0x3a6d('0x6')];_0x41d5b2++){var _0x3aca9b=_0x106d1f[_0x4778df[_0x41d5b2]][_0x3a6d('0x7')](function(_0x1ee9fb){return _0x1ee9fb['family']==='IPv4'&&_0x1ee9fb[_0x3a6d('0x8')]===![];});_0x9e7625=_0x9e7625[_0x3a6d('0x9')](_0x3aca9b);}return _0x9e7625;}function getFirstInterface(){var _0x429aa0=_[_0x3a6d('0xa')](getInterfaces());return{'macAddress':_0x429aa0&&_0x429aa0[_0x3a6d('0xb')]?_0x429aa0[_0x3a6d('0xb')]:_0x3a6d('0xc'),'ipAddress':_0x429aa0&&_0x429aa0[_0x3a6d('0xd')]?_0x429aa0[_0x3a6d('0xd')]:_0x3a6d('0xe')};}exports[_0x3a6d('0xf')]=getFirstInterface;function getCPUhash(){var _0x12a257=_[_0x3a6d('0x10')](os[_0x3a6d('0x11')]()[_0x3a6d('0x12')](function(_0x173f30){return _0x173f30[_0x3a6d('0x13')];}))[_0x3a6d('0x14')](':');return crypto[_0x3a6d('0x15')]('md5')['update'](_0x12a257)[_0x3a6d('0x16')]('hex');}exports[_0x3a6d('0x17')]=function(){var _0x4b989a=os[_0x3a6d('0x18')]();var _0x1ab594=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1ab594['test'](config[_0x3a6d('0x19')])){return config[_0x3a6d('0x19')];}else if(_0x4b989a==='win32'){return exec(_0x3a6d('0x1a'),{'encoding':'utf8'})[_0x3a6d('0x1b')]('\x0d\x0a','');}else{var _0x1b24bf=getFirstInterface();var _0x24922e=getCPUhash();var _0x1ecb0a=_0x24922e+'|'+os[_0x3a6d('0x1c')]()+'|'+_0x1b24bf['macAddress']+'|'+_0x1b24bf[_0x3a6d('0x1d')];var _0x1dee47=crypto[_0x3a6d('0x15')]('md5')[_0x3a6d('0x1e')](_0x1ecb0a)[_0x3a6d('0x16')](_0x3a6d('0x1f'));return _0x1dee47[_0x3a6d('0x20')](0x0,0x8)+'-'+_0x1dee47[_0x3a6d('0x20')](0x8,0xc)+'-'+_0x1dee47[_0x3a6d('0x20')](0xc,0x10)+'-'+_0x1dee47[_0x3a6d('0x20')](0x10,0x14)+'-'+_0x1dee47[_0x3a6d('0x20')](0x14);}}; \ No newline at end of file +var _0x42e9=['../environment','orderBy','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','md5','update','substring','crypto','bimedia-machine-uuid','execSync'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x42e9,0x10d));var _0x942e=function(_0x4ce610,_0x37681e){_0x4ce610=_0x4ce610-0x0;var _0x487bfb=_0x42e9[_0x4ce610];return _0x487bfb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x942e('0x0'));var machine=require(_0x942e('0x1'));var exec=require('child_process')[_0x942e('0x2')];var config=require(_0x942e('0x3'));function getInterfaces(){var _0x36963d=[];var _0x48e76e=os['networkInterfaces']();var _0x681c05=_[_0x942e('0x4')](_['keys'](_0x48e76e));for(var _0x147c7c=0x0;_0x147c7c<_0x681c05[_0x942e('0x5')];_0x147c7c++){var _0x74d8ae=_0x48e76e[_0x681c05[_0x147c7c]]['filter'](function(_0xd9c63e){return _0xd9c63e[_0x942e('0x6')]==='IPv4'&&_0xd9c63e[_0x942e('0x7')]===![];});_0x36963d=_0x36963d[_0x942e('0x8')](_0x74d8ae);}return _0x36963d;}function getFirstInterface(){var _0x13f231=_[_0x942e('0x9')](getInterfaces());return{'macAddress':_0x13f231&&_0x13f231[_0x942e('0xa')]?_0x13f231['mac']:_0x942e('0xb'),'ipAddress':_0x13f231&&_0x13f231[_0x942e('0xc')]?_0x13f231[_0x942e('0xc')]:_0x942e('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x532ad7=_[_0x942e('0x4')](os[_0x942e('0xe')]()[_0x942e('0xf')](function(_0x4ea886){return _0x4ea886[_0x942e('0x10')];}))[_0x942e('0x11')](':');return crypto[_0x942e('0x12')]('md5')['update'](_0x532ad7)[_0x942e('0x13')](_0x942e('0x14'));}exports[_0x942e('0x15')]=function(){var _0x5c7222=os[_0x942e('0x16')]();var _0x38a6a5=/[0-9a-f-]{36}/;if(config[_0x942e('0x17')]&&_0x38a6a5[_0x942e('0x18')](config[_0x942e('0x17')])){return config[_0x942e('0x17')];}else if(_0x5c7222===_0x942e('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x942e('0x1a')})[_0x942e('0x1b')]('\x0d\x0a','');}else{var _0x523843=getFirstInterface();var _0x8dc386=getCPUhash();var _0x490662=_0x8dc386+'|'+os[_0x942e('0x1c')]()+'|'+_0x523843[_0x942e('0x1d')]+'|'+_0x523843[_0x942e('0x1e')];var _0x1b01d2=crypto['createHash'](_0x942e('0x1f'))[_0x942e('0x20')](_0x490662)['digest'](_0x942e('0x14'));return _0x1b01d2['substring'](0x0,0x8)+'-'+_0x1b01d2['substring'](0x8,0xc)+'-'+_0x1b01d2['substring'](0xc,0x10)+'-'+_0x1b01d2['substring'](0x10,0x14)+'-'+_0x1b01d2[_0x942e('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1c985ab..dec4c98 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 _0x9bf3=['data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x9bf3,0x8b));var _0x39bf=function(_0x157111,_0x3a9771){_0x157111=_0x157111-0x0;var _0x5b00c4=_0x9bf3[_0x157111];return _0x5b00c4;};'use strict';var util=require('util');var moment=require(_0x39bf('0x0'));var rp=require(_0x39bf('0x1'));var BPromise=require(_0x39bf('0x2'));var pkginfo=require(_0x39bf('0x3'))(module,_0x39bf('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x39bf('0x5'));var hardware=require(_0x39bf('0x6'));var logger=require(_0x39bf('0x7'))(_0x39bf('0x8'));var HOST=_0x39bf('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5b9fbf){return new BPromise(function(_0x947c18,_0x509989){var _0x14fb7d=util[_0x39bf('0xa')](_0x39bf('0xb'),HOST,_0x5b9fbf,module[_0x39bf('0xc')][_0x39bf('0x4')]);if(oldToken){_0x14fb7d=util[_0x39bf('0xa')](_0x39bf('0xd'),HOST,_0x5b9fbf,module[_0x39bf('0xc')][_0x39bf('0x4')],oldToken);}var _0x3e541d={'uri':_0x14fb7d,'method':_0x39bf('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3e541d)[_0x39bf('0xf')](function(_0x4047c4){_0x947c18(_0x4047c4);})['catch'](function(_0x166ef2){_0x509989(_0x166ef2);});});}function manageLicense(_0x4986ac,_0x417371){var _0x474016=_0x417371[_0x39bf('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x474016[_0x39bf('0x11')]!==_0x4986ac&&!_0x474016[_0x39bf('0x12')]){oldToken=_0x474016[_0x39bf('0x11')];}httpRequest(_0x4986ac)[_0x39bf('0xf')](function(_0x505044){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x505044['active']){isOldTokenSent=![];if(!_0x474016[_0x39bf('0x8')]&&_0x474016[_0x39bf('0x8')]!=_0x505044[_0x39bf('0x8')]||_0x474016[_0x39bf('0x8')]&&_0x474016[_0x39bf('0x12')]){logger[_0x39bf('0x13')](_0x39bf('0x14'));}if(_0x474016[_0x39bf('0x8')]&&!_0x474016[_0x39bf('0x12')]&&_0x474016[_0x39bf('0x8')]!=_0x505044[_0x39bf('0x8')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x474016[_0x39bf('0x8')]&&!_0x474016[_0x39bf('0x12')]&&_0x474016[_0x39bf('0x8')]==_0x505044[_0x39bf('0x8')]){return _0x417371;}return _0x417371[_0x39bf('0x15')]({'data1':_0x4986ac,'data2':null,'license':_0x505044['license']});}else{if(_0x505044['license']||_0x474016['license']){if(!_0x474016[_0x39bf('0x12')]){if(_0x474016[_0x39bf('0x11')]==_0x4986ac){GRAY_PERIOD_REASON=_0x39bf('0x16');logger[_0x39bf('0x13')](_0x39bf('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x39bf('0x13')](_0x39bf('0x18'),_0x474016['data1'],_0x4986ac);}logger['info'](_0x39bf('0x19'),GRAY_PERIOD_REASON[_0x39bf('0x1a')](),moment()[_0x39bf('0xa')](_0x39bf('0x1b')));return _0x417371[_0x39bf('0x15')]({'data2':encryptor['encryptString'](moment()[_0x39bf('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x39bf('0x1c')](encryptor[_0x39bf('0x1d')](_0x474016[_0x39bf('0x12')]),_0x39bf('0x1e'))>DAYS){logger[_0x39bf('0x13')](_0x39bf('0x1f'),moment()[_0x39bf('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x417371[_0x39bf('0x15')]({'data1':_0x4986ac,'data2':null,'license':null});}}}else{if(_0x474016[_0x39bf('0x11')]!=_0x4986ac){logger[_0x39bf('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x474016[_0x39bf('0x11')],_0x4986ac);return _0x417371[_0x39bf('0x15')]({'data1':_0x4986ac,'data2':null,'license':null});}}}return _0x417371;})[_0x39bf('0xf')](function(_0x119916){_0x417371=_0x119916;})[_0x39bf('0x20')](function(_0x41f04b){logger['error'](_0x41f04b[_0x39bf('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x39bf('0x22')](),_0x417371);},TIME);});}function defaultLicense(){var _0x37e600=hardware[_0x39bf('0x22')]();if(_0x37e600){return db[_0x39bf('0x23')][_0x39bf('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x37e600}})['spread'](function(_0x26cb59,_0x1086c7){logger[_0x39bf('0x13')](_0x39bf('0x25'),_0x37e600);manageLicense(_0x37e600,_0x26cb59);})[_0x39bf('0x20')](function(_0x2a5ea2){logger[_0x39bf('0x26')](_0x2a5ea2[_0x39bf('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc591=['../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x39db5b,_0x3e50e){var _0x6034a3=function(_0x422287){while(--_0x422287){_0x39db5b['push'](_0x39db5b['shift']());}};_0x6034a3(++_0x3e50e);}(_0xc591,0x1a6));var _0x1c59=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc591[_0x55e08b];return _0xd1a7ff;};'use strict';var util=require(_0x1c59('0x0'));var moment=require('moment');var rp=require(_0x1c59('0x1'));var BPromise=require(_0x1c59('0x2'));var pkginfo=require(_0x1c59('0x3'))(module,_0x1c59('0x4'));var db=require(_0x1c59('0x5'))['db'];var encryptor=require(_0x1c59('0x6'));var hardware=require(_0x1c59('0x7'));var logger=require(_0x1c59('0x8'))(_0x1c59('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3d50b9){return new BPromise(function(_0x1e8ae3,_0x7cf2af){var _0x42736b=util[_0x1c59('0xa')](_0x1c59('0xb'),HOST,_0x3d50b9,module[_0x1c59('0xc')][_0x1c59('0x4')]);if(oldToken){_0x42736b=util[_0x1c59('0xa')](_0x1c59('0xd'),HOST,_0x3d50b9,module[_0x1c59('0xc')][_0x1c59('0x4')],oldToken);}var _0xbf9b2={'uri':_0x42736b,'method':_0x1c59('0xe'),'timeout':0xea60,'json':!![]};return rp(_0xbf9b2)[_0x1c59('0xf')](function(_0x27636b){_0x1e8ae3(_0x27636b);})[_0x1c59('0x10')](function(_0x3aa6ec){_0x7cf2af(_0x3aa6ec);});});}function manageLicense(_0x556087,_0x255342){var _0x3f62fb=_0x255342[_0x1c59('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x3f62fb[_0x1c59('0x12')]!==_0x556087&&!_0x3f62fb[_0x1c59('0x13')]){oldToken=_0x3f62fb[_0x1c59('0x12')];}httpRequest(_0x556087)[_0x1c59('0xf')](function(_0x5a9a27){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5a9a27[_0x1c59('0x14')]){isOldTokenSent=![];if(!_0x3f62fb[_0x1c59('0x9')]&&_0x3f62fb[_0x1c59('0x9')]!=_0x5a9a27[_0x1c59('0x9')]||_0x3f62fb[_0x1c59('0x9')]&&_0x3f62fb[_0x1c59('0x13')]){logger[_0x1c59('0x15')](_0x1c59('0x16'));}if(_0x3f62fb[_0x1c59('0x9')]&&!_0x3f62fb[_0x1c59('0x13')]&&_0x3f62fb['license']!=_0x5a9a27[_0x1c59('0x9')]){logger[_0x1c59('0x15')](_0x1c59('0x17'));}if(_0x3f62fb[_0x1c59('0x9')]&&!_0x3f62fb[_0x1c59('0x13')]&&_0x3f62fb['license']==_0x5a9a27[_0x1c59('0x9')]){return _0x255342;}return _0x255342[_0x1c59('0x18')]({'data1':_0x556087,'data2':null,'license':_0x5a9a27[_0x1c59('0x9')]});}else{if(_0x5a9a27[_0x1c59('0x9')]||_0x3f62fb[_0x1c59('0x9')]){if(!_0x3f62fb[_0x1c59('0x13')]){if(_0x3f62fb[_0x1c59('0x12')]==_0x556087){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x1c59('0x19'));}else{GRAY_PERIOD_REASON=_0x1c59('0x1a');logger[_0x1c59('0x15')](_0x1c59('0x1b'),_0x3f62fb[_0x1c59('0x12')],_0x556087);}logger['info'](_0x1c59('0x1c'),GRAY_PERIOD_REASON[_0x1c59('0x1d')](),moment()[_0x1c59('0xa')](_0x1c59('0x1e')));return _0x255342[_0x1c59('0x18')]({'data2':encryptor[_0x1c59('0x1f')](moment()[_0x1c59('0xa')](_0x1c59('0x1e')))});}else{if(moment()[_0x1c59('0x20')](encryptor[_0x1c59('0x21')](_0x3f62fb['data2']),'days')>DAYS){logger['info'](_0x1c59('0x22'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x255342[_0x1c59('0x18')]({'data1':_0x556087,'data2':null,'license':null});}}}else{if(_0x3f62fb[_0x1c59('0x12')]!=_0x556087){logger[_0x1c59('0x15')](_0x1c59('0x1b'),_0x3f62fb[_0x1c59('0x12')],_0x556087);return _0x255342['update']({'data1':_0x556087,'data2':null,'license':null});}}}return _0x255342;})[_0x1c59('0xf')](function(_0x42530a){_0x255342=_0x42530a;})[_0x1c59('0x10')](function(_0xd196d1){logger[_0x1c59('0x23')](_0xd196d1[_0x1c59('0x24')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x1c59('0x25')](),_0x255342);},TIME);});}function defaultLicense(){var _0x407668=hardware[_0x1c59('0x25')]();if(_0x407668){return db[_0x1c59('0x26')][_0x1c59('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x407668}})[_0x1c59('0x28')](function(_0xcd5eeb,_0x12c039){logger[_0x1c59('0x15')](_0x1c59('0x29'),_0x407668);manageLicense(_0x407668,_0xcd5eeb);})[_0x1c59('0x10')](function(_0x2aab60){logger['error'](_0x2aab60[_0x1c59('0x24')]);});}}exports[_0x1c59('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 801bc15..a014a73 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 _0x614e=['admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','count'];(function(_0xf65bf8,_0x494a66){var _0x2e4a66=function(_0x50d0de){while(--_0x50d0de){_0xf65bf8['push'](_0xf65bf8['shift']());}};_0x2e4a66(++_0x494a66);}(_0x614e,0x1ea));var _0xe614=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x614e[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0xe614('0x0'));var _=require(_0xe614('0x1'));var moment=require('moment');var BPromise=require(_0xe614('0x2'));var hardware=require(_0xe614('0x3'));var encryptor=require(_0xe614('0x4'));var db=require(_0xe614('0x5'))['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':_0xe614('0x6'),'machineUuid':hardware[_0xe614('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe614('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf985ae){return new BPromise(function(_0x3c35d8,_0x235f93){return db[_0xe614('0x9')][_0xe614('0xa')](_['defaults'](_0xf985ae,{'raw':!![],'where':{'id':0x1}}))[_0xe614('0xb')](function(_0x5e6978){return checkLicense(_0x5e6978,null);})['then'](function(_0x15d95b){_0x3c35d8(_0x15d95b);return;})[_0xe614('0xc')](function(_0x46f881){_0x235f93(_0x46f881);});});}function checkLicense(_0x279399,_0x39a7c9){if(!_0x279399){demoLicense[_0xe614('0xd')]=_0x279399[_0xe614('0xe')];return demoLicense;}try{var _0x1d47ca=_0x39a7c9||_0x279399[_0xe614('0xf')];if(_[_0xe614('0x10')](_0x1d47ca)){throw new Error(_0xe614('0x11'));}var _0x25d513=_0x279399[_0xe614('0xe')];var _0x40c1b9=_0x279399['data2'];var _0x11f509=_0x25d513['split']('-')[0x4];var _0x13e394=_0x25d513[_0xe614('0x12')]('-')[0x0];var _0x7a631=encryptor['decryptString'](_0x1d47ca,util[_0xe614('0x13')](_0xe614('0x14'),_0x11f509,_0x25d513,_0x13e394));var _0x2d1744=JSON[_0xe614('0x15')](_0x7a631);_0x2d1744[_0xe614('0x16')]=![];_0x2d1744['uuid']=_0x25d513;_0x2d1744[_0xe614('0x17')]=hardware[_0xe614('0x7')]();if(_0x40c1b9){var _0x28c47e=encryptor[_0xe614('0x18')](_0x40c1b9);_0x2d1744[_0xe614('0x19')]=_0x28c47e;_0x2d1744[_0xe614('0x1a')]=moment(_0x28c47e)[_0xe614('0x1b')](0x7,'days')['format']();_0x2d1744[_0xe614('0x1c')]=_0x2d1744[_0xe614('0xd')]!=_0x2d1744['machineUuid']?_0xe614('0x1d'):_0xe614('0x1e');}return _0x2d1744;}catch(_0x5523e0){breakingLicense[_0xe614('0xd')]=_0x279399[_0xe614('0xe')];breakingLicense[_0xe614('0x1f')]=_0x5523e0[_0xe614('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2920e2,_0x4db3cf){getLicense()[_0xe614('0xb')](function(_0x32d5e5){return db[_0xe614('0x20')][_0xe614('0x21')]({'attributes':[_0xe614('0x22'),[db[_0xe614('0x23')]['fn']('COUNT',db[_0xe614('0x23')][_0xe614('0x24')](_0xe614('0x22'))),_0xe614('0x25')]],'group':_0xe614('0x22'),'where':{'role':{'$or':[_0xe614('0x26'),_0xe614('0x27'),'telephone']}},'raw':!![]})[_0xe614('0xb')](function(_0x1ea6d2){var _0x389e91={'user':_0x32d5e5[_0xe614('0x28')]||0x0,'telephone':_0x32d5e5[_0xe614('0x29')]||0x0};_0x1ea6d2[_0xe614('0x2a')](function(_0x1df1e1){var _0x1ed6df=_0x1df1e1['role']===_0xe614('0x26')?'user':_0x1df1e1[_0xe614('0x22')];_0x389e91[_0x1ed6df]-=_0x1df1e1[_0xe614('0x25')];if(_0x389e91[_0x1ed6df]<0x0)_0x389e91[_0x1ed6df]=0x0;});_0x2920e2(_0x389e91);return;});})[_0xe614('0xc')](function(_0x41a9fa){_0x4db3cf(_0x41a9fa);});});}function checkUserLimits(_0x328423){return new BPromise(function(_0x1a0e6b,_0x55a209){getLimits()[_0xe614('0xb')](function(_0x4c10bb){var _0x58d07b=_[_0xe614('0x2b')](_[_0xe614('0x2c')](_0x328423,'role'),[_0xe614('0x26'),_0xe614('0x27'),_0xe614('0x2d')]);var _0x5d3836=(_0x58d07b[_0xe614('0x26')]||0x0)+(_0x58d07b['user']||0x0);var _0x3840a1=_0x58d07b[_0xe614('0x2d')]||0x0;if(_0x5d3836>_0x4c10bb[_0xe614('0x27')])return _0x55a209('License\x20limit\x20reached\x20for\x20users');if(_0x3840a1>_0x4c10bb['telephone'])return _0x55a209(_0xe614('0x2e'));return _0x1a0e6b();})[_0xe614('0xc')](function(_0x886395){_0x55a209(_0x886395);});});}module[_0xe614('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x95a8=['pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','days','format','grayReason','machineUuid','message','User','role','sequelize','COUNT','col','admin','telephone','telephones','forEach','user'];(function(_0x54e1ad,_0x410c73){var _0x466a43=function(_0x2d7f13){while(--_0x2d7f13){_0x54e1ad['push'](_0x54e1ad['shift']());}};_0x466a43(++_0x410c73);}(_0x95a8,0x8b));var _0x895a=function(_0x8b1642,_0x438b4c){_0x8b1642=_0x8b1642-0x0;var _0x163e28=_0x95a8[_0x8b1642];return _0x163e28;};'use strict';var util=require(_0x895a('0x0'));var _=require(_0x895a('0x1'));var moment=require(_0x895a('0x2'));var BPromise=require(_0x895a('0x3'));var hardware=require('./hardware');var encryptor=require(_0x895a('0x4'));var db=require(_0x895a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x895a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x895a('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x895a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x895a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2b333c){return new BPromise(function(_0x13a274,_0x1aede9){return db[_0x895a('0x9')][_0x895a('0xa')](_['defaults'](_0x2b333c,{'raw':!![],'where':{'id':0x1}}))[_0x895a('0xb')](function(_0x14d676){return checkLicense(_0x14d676,null);})[_0x895a('0xb')](function(_0xa97853){_0x13a274(_0xa97853);return;})[_0x895a('0xc')](function(_0xdc14c6){_0x1aede9(_0xdc14c6);});});}function checkLicense(_0x4879e5,_0x3ed55a){if(!_0x4879e5){demoLicense[_0x895a('0xd')]=_0x4879e5[_0x895a('0xe')];return demoLicense;}try{var _0x10396a=_0x3ed55a||_0x4879e5[_0x895a('0xf')];if(_['isEmpty'](_0x10396a)){throw new Error(_0x895a('0x10'));}var _0x5d25b2=_0x4879e5[_0x895a('0xe')];var _0x159025=_0x4879e5[_0x895a('0x11')];var _0x59e53b=_0x5d25b2[_0x895a('0x12')]('-')[0x4];var _0x2c1ba7=_0x5d25b2[_0x895a('0x12')]('-')[0x0];var _0x25e1cc=encryptor[_0x895a('0x13')](_0x10396a,util['format'](_0x895a('0x14'),_0x59e53b,_0x5d25b2,_0x2c1ba7));var _0x4ee7f0=JSON[_0x895a('0x15')](_0x25e1cc);_0x4ee7f0[_0x895a('0x16')]=![];_0x4ee7f0[_0x895a('0xd')]=_0x5d25b2;_0x4ee7f0['machineUuid']=hardware['getUuid']();if(_0x159025){var _0x3d2cc8=encryptor[_0x895a('0x13')](_0x159025);_0x4ee7f0[_0x895a('0x17')]=_0x3d2cc8;_0x4ee7f0[_0x895a('0x18')]=moment(_0x3d2cc8)[_0x895a('0x19')](0x7,_0x895a('0x1a'))[_0x895a('0x1b')]();_0x4ee7f0[_0x895a('0x1c')]=_0x4ee7f0['uuid']!=_0x4ee7f0[_0x895a('0x1d')]?'changed':'disabled';}return _0x4ee7f0;}catch(_0x3fc481){breakingLicense[_0x895a('0xd')]=_0x4879e5[_0x895a('0xe')];breakingLicense[_0x895a('0x1e')]=_0x3fc481[_0x895a('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x84cfde,_0x55e436){getLicense()[_0x895a('0xb')](function(_0x20e455){return db[_0x895a('0x1f')]['findAll']({'attributes':[_0x895a('0x20'),[db[_0x895a('0x21')]['fn'](_0x895a('0x22'),db['sequelize'][_0x895a('0x23')](_0x895a('0x20'))),'count']],'group':'role','where':{'role':{'$or':[_0x895a('0x24'),'user',_0x895a('0x25')]}},'raw':!![]})[_0x895a('0xb')](function(_0x149961){var _0x65a803={'user':_0x20e455['users']||0x0,'telephone':_0x20e455[_0x895a('0x26')]||0x0};_0x149961[_0x895a('0x27')](function(_0x62b529){var _0x3416e2=_0x62b529[_0x895a('0x20')]===_0x895a('0x24')?_0x895a('0x28'):_0x62b529[_0x895a('0x20')];_0x65a803[_0x3416e2]-=_0x62b529['count'];if(_0x65a803[_0x3416e2]<0x0)_0x65a803[_0x3416e2]=0x0;});_0x84cfde(_0x65a803);return;});})[_0x895a('0xc')](function(_0x171406){_0x55e436(_0x171406);});});}function checkUserLimits(_0x56d7ff){return new BPromise(function(_0x1b9b42,_0x2571c3){getLimits()['then'](function(_0x39b517){var _0x329d63=_[_0x895a('0x29')](_[_0x895a('0x2a')](_0x56d7ff,_0x895a('0x20')),[_0x895a('0x24'),_0x895a('0x28'),_0x895a('0x25')]);var _0x30692d=(_0x329d63[_0x895a('0x24')]||0x0)+(_0x329d63[_0x895a('0x28')]||0x0);var _0xfb26f1=_0x329d63['telephone']||0x0;if(_0x30692d>_0x39b517['user'])return _0x2571c3('License\x20limit\x20reached\x20for\x20users');if(_0xfb26f1>_0x39b517[_0x895a('0x25')])return _0x2571c3(_0x895a('0x2b'));return _0x1b9b42();})[_0x895a('0xc')](function(_0xe9408b){_0x2571c3(_0xe9408b);});});}module[_0x895a('0x2c')]={'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 e02f7e4..2c20531 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 _0x5f66=['app-id','secret','http://localhost:9000'];(function(_0x10e76b,_0x325f50){var _0x5a0554=function(_0x5ba488){while(--_0x5ba488){_0x10e76b['push'](_0x10e76b['shift']());}};_0x5a0554(++_0x325f50);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';module['exports']={'DOMAIN':_0x65f6('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x65f6('0x1'),'GOOGLE_SECRET':_0x65f6('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2f2f42,_0x368ced){var _0x3f9d52=function(_0x34d2dc){while(--_0x34d2dc){_0x2f2f42['push'](_0x2f2f42['shift']());}};_0x3f9d52(++_0x368ced);}(_0x0120,0x6f));var _0x0012=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0120[_0x1facfa];return _0x9ec701;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7065c68..3eead8c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaecb=['../utils/loggers','exports'];(function(_0x5e8aa8,_0x39a59b){var _0x1408f2=function(_0x3b39bb){while(--_0x3b39bb){_0x5e8aa8['push'](_0x5e8aa8['shift']());}};_0x1408f2(++_0x39a59b);}(_0xaecb,0x166));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var fileLogger=require(_0xbaec('0x0'))['fileLogger'];module[_0xbaec('0x1')]=fileLogger; \ No newline at end of file +var _0xdb4d=['../utils/loggers','fileLogger','exports'];(function(_0x34adb7,_0x4651d1){var _0xc4776a=function(_0x24db30){while(--_0x24db30){_0x34adb7['push'](_0x34adb7['shift']());}};_0xc4776a(++_0x4651d1);}(_0xdb4d,0x1d7));var _0xddb4=function(_0x276e3f,_0x3d1416){_0x276e3f=_0x276e3f-0x0;var _0x510d32=_0xdb4d[_0x276e3f];return _0x510d32;};'use strict';var fileLogger=require(_0xddb4('0x0'))[_0xddb4('0x1')];module[_0xddb4('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7018aaa..58979e3 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 _0x8bd1=['express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','../../config/environment','resolve','join'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8bd1,0x177));var _0x18bd=function(_0x47a07f,_0x4227c7){_0x47a07f=_0x47a07f-0x0;var _0x1e07d7=_0x8bd1[_0x47a07f];return _0x1e07d7;};'use strict';var path=require('path');var cfg=require(_0x18bd('0x0'));var env={'NODE_PATH':path[_0x18bd('0x1')](path[_0x18bd('0x2')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0x18bd('0x3'),'script':path[_0x18bd('0x2')](__dirname,_0x18bd('0x4')),'env':env},{'name':_0x18bd('0x5'),'script':path[_0x18bd('0x2')](__dirname,_0x18bd('0x6')),'env':env},{'name':_0x18bd('0x7'),'script':path[_0x18bd('0x2')](__dirname,_0x18bd('0x8')),'env':env},{'name':'email','script':path['join'](__dirname,_0x18bd('0x9')),'env':env},{'name':_0x18bd('0xa'),'script':path[_0x18bd('0x2')](__dirname,_0x18bd('0xb')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x18bd('0xc')),'env':env}]};module[_0x18bd('0xd')]=pm2config; \ No newline at end of file +var _0xd1ac=['ami','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path','join','express','../../services/express/index.js'];(function(_0x4081be,_0x505722){var _0x1ba6ee=function(_0x57e99a){while(--_0x57e99a){_0x4081be['push'](_0x4081be['shift']());}};_0x1ba6ee(++_0x505722);}(_0xd1ac,0xb7));var _0xcd1a=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0xd1ac[_0x423e15];return _0x184279;};'use strict';var path=require(_0xcd1a('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0xcd1a('0x1')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0xcd1a('0x2'),'script':path[_0xcd1a('0x1')](__dirname,_0xcd1a('0x3')),'env':env},{'name':_0xcd1a('0x4'),'script':path[_0xcd1a('0x1')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0xcd1a('0x1')](__dirname,_0xcd1a('0x5')),'env':env},{'name':_0xcd1a('0x6'),'script':path[_0xcd1a('0x1')](__dirname,_0xcd1a('0x7')),'env':env},{'name':_0xcd1a('0x8'),'script':path[_0xcd1a('0x1')](__dirname,_0xcd1a('0x9')),'env':env},{'name':'xdr','script':path[_0xcd1a('0x1')](__dirname,_0xcd1a('0xa')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b7ba55f..7834156 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 _0xaff3=['./config','start','disconnect','stop','then','restart','describe','delete','dump','saved','bluebird'];(function(_0x2f31b1,_0x17daa8){var _0x448988=function(_0x540f6b){while(--_0x540f6b){_0x2f31b1['push'](_0x2f31b1['shift']());}};_0x448988(++_0x17daa8);}(_0xaff3,0xdb));var _0x3aff=function(_0x16b906,_0x12b7d4){_0x16b906=_0x16b906-0x0;var _0x300a0b=_0xaff3[_0x16b906];return _0x300a0b;};'use strict';var pm2=require('pm2');var BPromise=require(_0x3aff('0x0'));var config=require(_0x3aff('0x1'));function connect(){return new BPromise(function(_0xf6be80,_0x22cc58){return pm2['connect'](function(_0x51d14f){if(_0x51d14f){return _0x22cc58(_0x51d14f);}return _0xf6be80('connected');});});};exports[_0x3aff('0x2')]=function(_0x10bf93){return connect()['then'](function(){return new BPromise(function(_0x1e3f3d,_0x5f08fc){return pm2[_0x3aff('0x2')](_0x10bf93,function(_0x25decc,_0x22af2a){if(_0x25decc){return _0x5f08fc(_0x25decc);}pm2[_0x3aff('0x3')]();return _0x1e3f3d(_0x22af2a);});});});};exports[_0x3aff('0x4')]=function(_0x58cacd){return connect()[_0x3aff('0x5')](function(){return new BPromise(function(_0x5b8ca6,_0x4070b7){return pm2[_0x3aff('0x4')](_0x58cacd,function(_0x5d178c,_0x435fd0){if(_0x5d178c){return _0x4070b7(_0x5d178c);}pm2['disconnect']();return _0x5b8ca6(_0x435fd0);});});});};exports[_0x3aff('0x6')]=function(_0x518836){return connect()[_0x3aff('0x5')](function(){return new BPromise(function(_0xe39f4a,_0x18ad26){return pm2['restart'](_0x518836,function(_0x5f27dd,_0x206818){if(_0x5f27dd){return _0x18ad26(_0x5f27dd);}pm2[_0x3aff('0x3')]();return _0xe39f4a(_0x206818);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x161e30,_0x2818d1){return pm2['list'](function(_0x40fb08,_0x2b10ea){if(_0x40fb08){return _0x2818d1(_0x40fb08);}pm2['disconnect']();return _0x161e30(_0x2b10ea);});});});};exports['describe']=function(_0xc729b2){return connect()[_0x3aff('0x5')](function(){return new BPromise(function(_0x2c3fde,_0x46826d){return pm2[_0x3aff('0x7')](_0xc729b2,function(_0x25227c,_0x13f000){if(_0x25227c){return _0x46826d(_0x25227c);}pm2[_0x3aff('0x3')]();return _0x2c3fde(_0x13f000);});});});};exports[_0x3aff('0x8')]=function(_0x4e28a7){return connect()[_0x3aff('0x5')](function(){return new BPromise(function(_0x5c96bf,_0x149fdb){return pm2['delete'](_0x4e28a7,function(_0x1bfa47,_0x4dbdbd){if(_0x1bfa47){return _0x149fdb(_0x1bfa47);}pm2[_0x3aff('0x3')]();return _0x5c96bf(_0x4dbdbd);});});});};exports[_0x3aff('0x9')]=function(){return connect()[_0x3aff('0x5')](function(){return new BPromise(function(_0x14d46d,_0xc3bd5a){return pm2[_0x3aff('0x9')](function(_0x300cef){if(_0x300cef){return _0xc3bd5a(_0x300cef);}return _0x14d46d(_0x3aff('0xa'));});});});}; \ No newline at end of file +var _0x7a4b=['connected','start','then','disconnect','stop','restart','describe','delete','dump','pm2'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a4b,0xb3));var _0xb7a4=function(_0x57df90,_0x5712ec){_0x57df90=_0x57df90-0x0;var _0x68bebc=_0x7a4b[_0x57df90];return _0x68bebc;};'use strict';var pm2=require(_0xb7a4('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x42f579,_0x1acaa6){return pm2['connect'](function(_0x4eecb0){if(_0x4eecb0){return _0x1acaa6(_0x4eecb0);}return _0x42f579(_0xb7a4('0x1'));});});};exports[_0xb7a4('0x2')]=function(_0x4d879d){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0x42de9b,_0x538ad9){return pm2[_0xb7a4('0x2')](_0x4d879d,function(_0x42c01b,_0x44ac00){if(_0x42c01b){return _0x538ad9(_0x42c01b);}pm2[_0xb7a4('0x4')]();return _0x42de9b(_0x44ac00);});});});};exports[_0xb7a4('0x5')]=function(_0x3c2410){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0x38b27d,_0x1c2f18){return pm2['stop'](_0x3c2410,function(_0x4bf76c,_0x56ab13){if(_0x4bf76c){return _0x1c2f18(_0x4bf76c);}pm2['disconnect']();return _0x38b27d(_0x56ab13);});});});};exports[_0xb7a4('0x6')]=function(_0x269f5a){return connect()['then'](function(){return new BPromise(function(_0x488471,_0x58083e){return pm2[_0xb7a4('0x6')](_0x269f5a,function(_0x196f02,_0x4f5c6d){if(_0x196f02){return _0x58083e(_0x196f02);}pm2[_0xb7a4('0x4')]();return _0x488471(_0x4f5c6d);});});});};exports['list']=function(){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0x11cf92,_0x9e06b4){return pm2['list'](function(_0x356e86,_0x4ec9bc){if(_0x356e86){return _0x9e06b4(_0x356e86);}pm2[_0xb7a4('0x4')]();return _0x11cf92(_0x4ec9bc);});});});};exports[_0xb7a4('0x7')]=function(_0x441169){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0x395eff,_0x5ec39b){return pm2['describe'](_0x441169,function(_0x2e688b,_0x294653){if(_0x2e688b){return _0x5ec39b(_0x2e688b);}pm2[_0xb7a4('0x4')]();return _0x395eff(_0x294653);});});});};exports[_0xb7a4('0x8')]=function(_0x2e74d7){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0xaa93cd,_0x48a42f){return pm2[_0xb7a4('0x8')](_0x2e74d7,function(_0x1a320a,_0x4898ae){if(_0x1a320a){return _0x48a42f(_0x1a320a);}pm2[_0xb7a4('0x4')]();return _0xaa93cd(_0x4898ae);});});});};exports[_0xb7a4('0x9')]=function(){return connect()[_0xb7a4('0x3')](function(){return new BPromise(function(_0xc980ac,_0x3b5959){return pm2[_0xb7a4('0x9')](function(_0x202dc3){if(_0x202dc3){return _0x3b5959(_0x202dc3);}return _0xc980ac('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 67787d8..d8c5909 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 _0x501c=['findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction'];(function(_0x1e8756,_0x431463){var _0x41a0f4=function(_0x1a82a3){while(--_0x1a82a3){_0x1e8756['push'](_0x1e8756['shift']());}};_0x41a0f4(++_0x431463);}(_0x501c,0x1da));var _0xc501=function(_0xc07ce7,_0x2425bb){_0xc07ce7=_0xc07ce7-0x0;var _0x1994c3=_0x501c[_0xc07ce7];return _0x1994c3;};'use strict';var _=require(_0xc501('0x0'));var moment=require(_0xc501('0x1'));var Redis=require(_0xc501('0x2'));var util=require(_0xc501('0x3'));var config=require(_0xc501('0x4'));var db=require(_0xc501('0x5'))['db'];var logger=require(_0xc501('0x6'))('schedule');config[_0xc501('0x7')]=_[_0xc501('0x8')](config[_0xc501('0x7')],{'host':_0xc501('0x9'),'port':0x18eb});var io=require(_0xc501('0xa'))(new Redis(config[_0xc501('0x7')]));function closeInteractions(){var _0x453c56=0x0;var _0x339291=[];return db[_0xc501('0xb')][_0xc501('0xc')]({'raw':!![],'attributes':['id',_0xc501('0xd')],'where':{'id':0x1}})[_0xc501('0xe')](function(_0x34a34c){_0x453c56=_0x34a34c['chatTimeout'];if(_0x453c56){return db[_0xc501('0xf')][_0xc501('0x10')]({'raw':!![],'attributes':['id',_0xc501('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc501('0x12')](_0x34a34c['chatTimeout'],_0xc501('0x13'))}}});}else{return[];}})[_0xc501('0xe')](function(_0x46444b){if(_0x46444b&&_0x46444b['length']){_0x339291=_[_0xc501('0x14')](_0x46444b||[],'id');logger[_0xc501('0x15')](_0xc501('0x16'),_0x339291['join']());return db[_0xc501('0xf')][_0xc501('0x17')]({'closeReason':_0xc501('0x18'),'disposition':_0xc501('0x19'),'closed':!![],'closedAt':moment()['format'](_0xc501('0x1a'))},{'where':{'id':_0x339291}});}})[_0xc501('0xe')](function(){if(_0x339291&&_0x339291[_0xc501('0x1b')]){logger['info'](_0xc501('0x1c'),_0x339291[_0xc501('0x1d')]());for(var _0x390405=0x0;_0x390405<_0x339291[_0xc501('0x1b')];_0x390405++){io[_0xc501('0x1e')]('chatInteraction:update',{'id':_0x339291[_0x390405],'closed':!![]});}}})[_0xc501('0x1f')](function(_0x35979b){logger[_0xc501('0x20')](_0xc501('0x21'),_0x35979b?util['inspect'](_0x35979b,{'showHidden':![],'depth':null}):'');});}exports[_0xc501('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8170=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes'];(function(_0x4bc154,_0x22de31){var _0x295d12=function(_0x420cc2){while(--_0x420cc2){_0x4bc154['push'](_0x4bc154['shift']());}};_0x295d12(++_0x22de31);}(_0x8170,0x10c));var _0x0817=function(_0xbe80fa,_0x2890c5){_0xbe80fa=_0xbe80fa-0x0;var _0x142492=_0x8170[_0xbe80fa];return _0x142492;};'use strict';var _=require(_0x0817('0x0'));var moment=require(_0x0817('0x1'));var Redis=require(_0x0817('0x2'));var util=require(_0x0817('0x3'));var config=require(_0x0817('0x4'));var db=require(_0x0817('0x5'))['db'];var logger=require(_0x0817('0x6'))(_0x0817('0x7'));config[_0x0817('0x8')]=_[_0x0817('0x9')](config[_0x0817('0x8')],{'host':_0x0817('0xa'),'port':0x18eb});var io=require(_0x0817('0xb'))(new Redis(config[_0x0817('0x8')]));function closeInteractions(){var _0x15e220=0x0;var _0x2848da=[];return db[_0x0817('0xc')][_0x0817('0xd')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x0817('0xe')](function(_0x3bdd58){_0x15e220=_0x3bdd58[_0x0817('0xf')];if(_0x15e220){return db[_0x0817('0x10')][_0x0817('0x11')]({'raw':!![],'attributes':['id',_0x0817('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3bdd58['chatTimeout'],_0x0817('0x13'))}}});}else{return[];}})[_0x0817('0xe')](function(_0x3788e7){if(_0x3788e7&&_0x3788e7['length']){_0x2848da=_[_0x0817('0x14')](_0x3788e7||[],'id');logger[_0x0817('0x15')](_0x0817('0x16'),_0x2848da[_0x0817('0x17')]());return db[_0x0817('0x10')][_0x0817('0x18')]({'closeReason':_0x0817('0x19'),'disposition':_0x0817('0x1a'),'closed':!![],'closedAt':moment()[_0x0817('0x1b')](_0x0817('0x1c'))},{'where':{'id':_0x2848da}});}})[_0x0817('0xe')](function(){if(_0x2848da&&_0x2848da[_0x0817('0x1d')]){logger[_0x0817('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2848da[_0x0817('0x17')]());for(var _0x124cc5=0x0;_0x124cc5<_0x2848da[_0x0817('0x1d')];_0x124cc5++){io[_0x0817('0x1e')](_0x0817('0x1f'),{'id':_0x2848da[_0x124cc5],'closed':!![]});}}})['catch'](function(_0x39a2f1){logger[_0x0817('0x20')](_0x0817('0x21'),_0x39a2f1?util[_0x0817('0x22')](_0x39a2f1,{'showHidden':![],'depth':null}):'');});}exports[_0x0817('0x23')]=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 c6399b0..d629e83 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 _0x1468=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x1468,0xee));var _0x8146=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x1468[_0x4dab14];return _0xf41aa;};'use strict';function start(){var _0x2638ef=require(_0x8146('0x0'));return _0x2638ef['startAllRefreshIntervals']();}module[_0x8146('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x5186=['startAllRefreshIntervals','exports'];(function(_0x4f6565,_0x278063){var _0x4a67c5=function(_0x16eb8f){while(--_0x16eb8f){_0x4f6565['push'](_0x4f6565['shift']());}};_0x4a67c5(++_0x278063);}(_0x5186,0x72));var _0x6518=function(_0x1bc5c2,_0x5e5a40){_0x1bc5c2=_0x1bc5c2-0x0;var _0x2dc8e8=_0x5186[_0x1bc5c2];return _0x2dc8e8;};'use strict';function start(){var _0x253701=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x253701[_0x6518('0x0')]();}module[_0x6518('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1913ea1..4f16a24 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 _0x490b=['../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','bcc','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','active','startAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule'];(function(_0x4aa1df,_0x215aad){var _0x58e374=function(_0x2a4cdb){while(--_0x2a4cdb){_0x4aa1df['push'](_0x4aa1df['shift']());}};_0x58e374(++_0x215aad);}(_0x490b,0xff));var _0xb490=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x490b[_0x5aef17];return _0x43f9d0;};'use strict';var fs=require('fs');var util=require(_0xb490('0x0'));var path=require(_0xb490('0x1'));var _=require(_0xb490('0x2'));var moment=require(_0xb490('0x3'));var CronJobManager=require(_0xb490('0x4'));var jayson=require(_0xb490('0x5'));var BPromise=require(_0xb490('0x6'));var logger=require(_0xb490('0x7'))(_0xb490('0x8'));var db=require(_0xb490('0x9'))['db'];var analyticCustomReportController=require(_0xb490('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb490('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x156d87,_0x54b9fd){return function(){logger[_0xb490('0xc')](_0xb490('0xd'),_0x156d87[_0xb490('0xe')]);var _0x34e8b4=!![];var _0x59babf=_0x156d87[_0xb490('0xf')][_0xb490('0x10')]();var _0x59015b={'account':_0x59babf,'message':{'from':util[_0xb490('0x11')](_0xb490('0x12'),_0x156d87[_0xb490('0xf')]['name'],_0x156d87[_0xb490('0xf')][_0xb490('0xe')]||_0x156d87[_0xb490('0xf')][_0xb490('0x13')]['user']),'to':_0x156d87[_0xb490('0xe')],'cc':_0x156d87['cc'],'bcc':_0x156d87[_0xb490('0x14')],'subject':util[_0xb490('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x54b9fd[_0xb490('0x15')],_0x156d87['subtractNumber'],_0x156d87[_0xb490('0x16')])}};var _0x18a53c=path[_0xb490('0x17')](__dirname,_0xb490('0x18'));var _0x3b1b0d=_0x54b9fd[_0xb490('0x19')];var _0x9f6a0e=util['format'](_0xb490('0x1a'),path[_0xb490('0x1b')](_0x54b9fd[_0xb490('0x19')],path[_0xb490('0x1c')](_0x54b9fd[_0xb490('0x19')])),_0xb490('0x1d'));var _0x1facda=path[_0xb490('0x17')](_0x18a53c,_0x3b1b0d);var _0x14c82e=path[_0xb490('0x17')](_0x18a53c,_0x9f6a0e);if(fs[_0xb490('0x1e')](_0x1facda)){_0x54b9fd[_0xb490('0x1f')]=_0xb490('0x20');_0x59015b[_0xb490('0x21')][_0xb490('0x22')]=[{'filename':_0x3b1b0d,'path':_0x1facda}];_0x59015b[_0xb490('0x21')][_0xb490('0x23')]=util[_0xb490('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xb490('0x24')](_0x54b9fd,null,0x2));}else if(fs['existsSync'](_0x14c82e)){_0x54b9fd[_0xb490('0x1f')]=_0xb490('0x20');_0x59015b[_0xb490('0x21')][_0xb490('0x22')]=[{'filename':_0x9f6a0e,'path':_0x14c82e}];}else{_0x59015b[_0xb490('0x21')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x156d87['sendIfEmpty']){_0x34e8b4=![];logger[_0xb490('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x34e8b4){return client['request'](_0xb490('0x25'),_0x59015b)[_0xb490('0x26')](function(_0x5848c0){if(_0x5848c0[_0xb490('0x27')]){return logger[_0xb490('0x27')](_0xb490('0x28'),JSON[_0xb490('0x24')](_0x5848c0));}return logger[_0xb490('0xc')](_0xb490('0x29'));})[_0xb490('0x2a')](function(_0x617f5c){return logger[_0xb490('0x27')](_0xb490('0x28'),JSON['stringify'](_0x617f5c));});}};}function handleError(){return function(_0x567f18){return logger[_0xb490('0x27')](JSON[_0xb490('0x24')](_0x567f18));};}function handleResult(_0x4855a2){return function(_0xd87acf){logger['info'](_0xb490('0x2b'),JSON[_0xb490('0x24')](_0xd87acf));if(_0x4855a2[_0xb490('0xf')]&&_0x4855a2['MailAccount']['Smtp']&&!_[_0xb490('0x2c')](_0x4855a2[_0xb490('0xe')])){setTimeout(handleSendEmail(_0x4855a2,_0xd87acf),0x3c*0x3e8);}};}function handleJob(_0x418a67){return function(){try{if(_[_0xb490('0x2c')](_0x418a67[_0xb490('0x2d')])){return logger[_0xb490('0xc')](_0xb490('0x2e'));}if(_['isNil'](_0x418a67['subtractUnit'])){return logger[_0xb490('0xc')](_0xb490('0x2f'));}var _0x158a0e={'startDate':moment()[_0xb490('0x30')](_0x418a67['subtractNumber'],_0x418a67[_0xb490('0x16')])[_0xb490('0x11')](_0xb490('0x31')),'endDate':moment()[_0xb490('0x11')](_0xb490('0x31')),'type':'scheduled','output':_0x418a67[_0xb490('0x32')],'name':_0x418a67['name']};if(!_[_0xb490('0x2c')](_0x418a67[_0xb490('0x33')])){logger['info'](_0xb490('0x34'),_0x418a67[_0xb490('0x33')]);return analyticDefaultReportController[_0xb490('0x35')]({'id':_0x418a67[_0xb490('0x33')]},_0x158a0e)[_0xb490('0x26')](handleResult(_0x418a67))['catch'](handleError());}if(!_[_0xb490('0x2c')](_0x418a67[_0xb490('0x36')])){logger[_0xb490('0xc')](_0xb490('0x37'),_0x418a67['CustomReportId']);return analyticCustomReportController[_0xb490('0x35')]({'id':_0x418a67[_0xb490('0x36')]},_0x158a0e)['then'](handleResult(_0x418a67))['catch'](handleError());}}catch(_0xd1174d){logger['error'](JSON['stringify'](_0xd1174d));}return logger[_0xb490('0xc')](_0xb490('0x38'));};}function getJobs(_0x1f55df){var _0x2be118={};if(_0x1f55df){_0x2be118['id']=_0x1f55df;}return db[_0xb490('0x39')][_0xb490('0x3a')]({'where':_0x2be118,'include':[{'model':db[_0xb490('0xf')],'attributes':['id',_0xb490('0x15'),_0xb490('0xe')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xb490('0x3b')],'as':'CloudProvider'}]}]}]})[_0xb490('0x26')](function(_0xe2352b){var _0x29c5a9=_[_0xb490('0x3c')](manager[_0xb490('0x3d')]);var _0x383ddc=_[_0xb490('0x3e')](_0xe2352b,function(_0x37884d){return _0x37884d['id'][_0xb490('0x3f')]();});var _0x191e54=_['keyBy'](_0xe2352b,function(_0x599846){return _0x599846['id'][_0xb490('0x3f')]();});var _0x5b0d81=_0x1f55df?_0x383ddc:_[_0xb490('0x40')](_0x383ddc,_0x29c5a9);var _0x40d2d1=_[_0xb490('0x41')](_0x383ddc,_0x29c5a9);var _0x161571=_[_0xb490('0x40')](_0x29c5a9,_0x383ddc);var _0x5ac5ce;var _0x511091;for(_0x5ac5ce=0x0;_0x5ac5ce<_0x161571[_0xb490('0x42')]&&!_0x1f55df;_0x5ac5ce+=0x1){_0x511091=_0x161571[_0x5ac5ce]['toString']();if(manager[_0xb490('0x43')](_0x511091)){manager[_0xb490('0x44')](_0x511091);manager['deleteJob'](_0x511091);logger[_0xb490('0xc')](_0xb490('0x45'),_0x511091);}}logger[_0xb490('0xc')](_0xb490('0x46'),JSON[_0xb490('0x24')](_0x5b0d81));for(_0x5ac5ce=0x0;_0x5ac5ce<_0x5b0d81[_0xb490('0x42')];_0x5ac5ce+=0x1){_0x511091=_0x5b0d81[_0x5ac5ce][_0xb490('0x3f')]();logger[_0xb490('0xc')](_0xb490('0x47'),_0x511091);if(_0x1f55df){logger[_0xb490('0xc')](_0xb490('0x48'),_0x1f55df);logger[_0xb490('0xc')](JSON[_0xb490('0x24')](_0x191e54[_0x511091]));BPromise[_0xb490('0x49')]()[_0xb490('0x26')](handleJob(_0x191e54[_0x511091]));logger[_0xb490('0xc')](_0xb490('0x4a'),_0x191e54[_0x511091][_0xb490('0x15')],_0x191e54[_0x511091][_0xb490('0x4b')]);}else if(_0x191e54[_0x511091]['cron']&&_0x191e54[_0x511091]['active']&&moment()[_0xb490('0x4c')](_0x191e54[_0x511091]['startAt'],_0x191e54[_0x511091][_0xb490('0x4d')])){manager[_0xb490('0x4e')](_0x511091,_0x191e54[_0x511091][_0xb490('0x4b')],handleJob(_0x191e54[_0x511091]));manager[_0xb490('0x4f')](_0x511091);logger[_0xb490('0xc')](_0xb490('0x50'),_0x191e54[_0x511091][_0xb490('0x15')],_0x191e54[_0x511091][_0xb490('0x4b')]);}else if(manager[_0xb490('0x43')](_0x511091)){manager[_0xb490('0x44')](_0x511091);manager[_0xb490('0x51')](_0x511091);logger[_0xb490('0xc')](_0xb490('0x52'),_0x191e54[_0x511091][_0xb490('0x15')],_0x191e54[_0x511091][_0xb490('0x4b')]);}}for(_0x5ac5ce=0x0,_0x511091;_0x5ac5ce<_0x40d2d1[_0xb490('0x42')]&&!_0x1f55df;_0x5ac5ce+=0x1){_0x511091=_0x40d2d1[_0x5ac5ce]['toString']();if(manager['exists'](_0x511091)){if(_0x191e54[_0x511091][_0xb490('0x4b')]&&_0x191e54[_0x511091][_0xb490('0x53')]&&moment()[_0xb490('0x4c')](_0x191e54[_0x511091][_0xb490('0x54')],_0x191e54[_0x511091][_0xb490('0x4d')])){manager[_0xb490('0x55')](_0x511091,_0x191e54[_0x511091][_0xb490('0x4b')],handleJob(_0x191e54[_0x511091]));logger[_0xb490('0xc')](_0xb490('0x56'),_0x191e54[_0x511091][_0xb490('0x15')],_0x191e54[_0x511091]['cron']);}else{manager[_0xb490('0x44')](_0x511091);manager[_0xb490('0x51')](_0x511091);logger[_0xb490('0xc')]('stop\x20cron',_0x191e54[_0x511091][_0xb490('0x15')],_0x191e54[_0x511091][_0xb490('0x4b')]);}}}})[_0xb490('0x2a')](function(_0x5cec07){logger[_0xb490('0x27')](JSON['stringify'](_0x5cec07));});}exports[_0xb490('0x57')]=function(_0x21154a){return getJobs(_0x21154a);};exports[_0xb490('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x17c5=['status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','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','catch','error\x20mail','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync'];(function(_0x2f92d8,_0x2ef7f4){var _0x200ef1=function(_0x24f52e){while(--_0x24f52e){_0x2f92d8['push'](_0x2f92d8['shift']());}};_0x200ef1(++_0x2ef7f4);}(_0x17c5,0x90));var _0x517c=function(_0x5257f4,_0x54558d){_0x5257f4=_0x5257f4-0x0;var _0x463559=_0x17c5[_0x5257f4];return _0x463559;};'use strict';var fs=require('fs');var util=require(_0x517c('0x0'));var path=require(_0x517c('0x1'));var _=require(_0x517c('0x2'));var moment=require(_0x517c('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x517c('0x4'));var BPromise=require(_0x517c('0x5'));var logger=require(_0x517c('0x6'))(_0x517c('0x7'));var db=require(_0x517c('0x8'))['db'];var analyticCustomReportController=require(_0x517c('0x9'));var analyticDefaultReportController=require(_0x517c('0xa'));var client=jayson[_0x517c('0xb')][_0x517c('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa31d12,_0x7cffbe){return function(){logger[_0x517c('0xd')](_0x517c('0xe'),_0xa31d12[_0x517c('0xf')]);var _0x5eb68a=!![];var _0x5ddeba=_0xa31d12[_0x517c('0x10')][_0x517c('0x11')]();var _0x59aaf2={'account':_0x5ddeba,'message':{'from':util[_0x517c('0x12')](_0x517c('0x13'),_0xa31d12[_0x517c('0x10')][_0x517c('0x14')],_0xa31d12[_0x517c('0x10')]['email']||_0xa31d12[_0x517c('0x10')][_0x517c('0x15')][_0x517c('0x16')]),'to':_0xa31d12['email'],'cc':_0xa31d12['cc'],'bcc':_0xa31d12['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x7cffbe[_0x517c('0x14')],_0xa31d12[_0x517c('0x17')],_0xa31d12[_0x517c('0x18')])}};var _0x1211dd=path['join'](__dirname,_0x517c('0x19'));var _0x26d22d=_0x7cffbe[_0x517c('0x1a')];var _0x164538=util['format'](_0x517c('0x1b'),path[_0x517c('0x1c')](_0x7cffbe[_0x517c('0x1a')],path[_0x517c('0x1d')](_0x7cffbe[_0x517c('0x1a')])),_0x517c('0x1e'));var _0x5459b9=path['join'](_0x1211dd,_0x26d22d);var _0x308e68=path['join'](_0x1211dd,_0x164538);if(fs[_0x517c('0x1f')](_0x5459b9)){_0x7cffbe[_0x517c('0x20')]=_0x517c('0x21');_0x59aaf2[_0x517c('0x22')]['attachments']=[{'filename':_0x26d22d,'path':_0x5459b9}];_0x59aaf2[_0x517c('0x22')][_0x517c('0x23')]=util[_0x517c('0x12')](_0x517c('0x24'),JSON['stringify'](_0x7cffbe,null,0x2));}else if(fs[_0x517c('0x1f')](_0x308e68)){_0x7cffbe[_0x517c('0x20')]='Sent';_0x59aaf2[_0x517c('0x22')][_0x517c('0x25')]=[{'filename':_0x164538,'path':_0x308e68}];}else{_0x59aaf2[_0x517c('0x22')]['text']=_0x517c('0x26');if(!_0xa31d12[_0x517c('0x27')]){_0x5eb68a=![];logger[_0x517c('0xd')](_0x517c('0x28'));}}if(_0x5eb68a){return client[_0x517c('0x29')](_0x517c('0x2a'),_0x59aaf2)[_0x517c('0x2b')](function(_0x258f90){if(_0x258f90['error']){return logger[_0x517c('0x2c')]('error\x20mail',JSON['stringify'](_0x258f90));}return logger[_0x517c('0xd')]('email\x20sent');})[_0x517c('0x2d')](function(_0x4f7cd0){return logger[_0x517c('0x2c')](_0x517c('0x2e'),JSON[_0x517c('0x2f')](_0x4f7cd0));});}};}function handleError(){return function(_0x58047e){return logger['error'](JSON[_0x517c('0x2f')](_0x58047e));};}function handleResult(_0x1c232d){return function(_0x168cdc){logger[_0x517c('0xd')](_0x517c('0x30'),JSON[_0x517c('0x2f')](_0x168cdc));if(_0x1c232d[_0x517c('0x10')]&&_0x1c232d[_0x517c('0x10')][_0x517c('0x15')]&&!_[_0x517c('0x31')](_0x1c232d[_0x517c('0xf')])){setTimeout(handleSendEmail(_0x1c232d,_0x168cdc),0x3c*0x3e8);}};}function handleJob(_0x10a5ce){return function(){try{if(_[_0x517c('0x31')](_0x10a5ce[_0x517c('0x17')])){return logger[_0x517c('0xd')](_0x517c('0x32'));}if(_[_0x517c('0x31')](_0x10a5ce['subtractUnit'])){return logger[_0x517c('0xd')](_0x517c('0x33'));}var _0x264b6c={'startDate':moment()[_0x517c('0x34')](_0x10a5ce[_0x517c('0x17')],_0x10a5ce['subtractUnit'])[_0x517c('0x12')](_0x517c('0x35')),'endDate':moment()[_0x517c('0x12')](_0x517c('0x35')),'type':_0x517c('0x36'),'output':_0x10a5ce[_0x517c('0x37')],'name':_0x10a5ce[_0x517c('0x14')]};if(!_['isNil'](_0x10a5ce[_0x517c('0x38')])){logger['info'](_0x517c('0x39'),_0x10a5ce['DefaultReportId']);return analyticDefaultReportController[_0x517c('0x3a')]({'id':_0x10a5ce[_0x517c('0x38')]},_0x264b6c)['then'](handleResult(_0x10a5ce))[_0x517c('0x2d')](handleError());}if(!_[_0x517c('0x31')](_0x10a5ce['CustomReportId'])){logger['info'](_0x517c('0x3b'),_0x10a5ce[_0x517c('0x3c')]);return analyticCustomReportController[_0x517c('0x3a')]({'id':_0x10a5ce[_0x517c('0x3c')]},_0x264b6c)[_0x517c('0x2b')](handleResult(_0x10a5ce))[_0x517c('0x2d')](handleError());}}catch(_0x8a1ba1){logger['error'](JSON['stringify'](_0x8a1ba1));}return logger[_0x517c('0xd')](_0x517c('0x3d'));};}function getJobs(_0x39338b){var _0x50bbc8={};if(_0x39338b){_0x50bbc8['id']=_0x39338b;}return db[_0x517c('0x3e')]['findAll']({'where':_0x50bbc8,'include':[{'model':db[_0x517c('0x10')],'attributes':['id',_0x517c('0x14'),_0x517c('0xf')],'include':[{'model':db[_0x517c('0x3f')],'as':_0x517c('0x15'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x1a1a40){var _0x164103=_['keys'](manager[_0x517c('0x40')]);var _0x1f1811=_[_0x517c('0x41')](_0x1a1a40,function(_0x31626a){return _0x31626a['id'][_0x517c('0x42')]();});var _0xa2ce11=_['keyBy'](_0x1a1a40,function(_0x5d4053){return _0x5d4053['id']['toString']();});var _0x55f5f5=_0x39338b?_0x1f1811:_[_0x517c('0x43')](_0x1f1811,_0x164103);var _0x14e99e=_[_0x517c('0x44')](_0x1f1811,_0x164103);var _0xee94c1=_['difference'](_0x164103,_0x1f1811);var _0xe83578;var _0x9cdf93;for(_0xe83578=0x0;_0xe83578<_0xee94c1[_0x517c('0x45')]&&!_0x39338b;_0xe83578+=0x1){_0x9cdf93=_0xee94c1[_0xe83578][_0x517c('0x42')]();if(manager[_0x517c('0x46')](_0x9cdf93)){manager[_0x517c('0x47')](_0x9cdf93);manager[_0x517c('0x48')](_0x9cdf93);logger[_0x517c('0xd')](_0x517c('0x49'),_0x9cdf93);}}logger[_0x517c('0xd')]('toRun',JSON[_0x517c('0x2f')](_0x55f5f5));for(_0xe83578=0x0;_0xe83578<_0x55f5f5['length'];_0xe83578+=0x1){_0x9cdf93=_0x55f5f5[_0xe83578][_0x517c('0x42')]();logger[_0x517c('0xd')]('index',_0x9cdf93);if(_0x39338b){logger[_0x517c('0xd')](_0x517c('0x4a'),_0x39338b);logger[_0x517c('0xd')](JSON[_0x517c('0x2f')](_0xa2ce11[_0x9cdf93]));BPromise[_0x517c('0x4b')]()['then'](handleJob(_0xa2ce11[_0x9cdf93]));logger['info'](_0x517c('0x4c'),_0xa2ce11[_0x9cdf93][_0x517c('0x14')],_0xa2ce11[_0x9cdf93][_0x517c('0x4d')]);}else if(_0xa2ce11[_0x9cdf93][_0x517c('0x4d')]&&_0xa2ce11[_0x9cdf93][_0x517c('0x4e')]&&moment()[_0x517c('0x4f')](_0xa2ce11[_0x9cdf93][_0x517c('0x50')],_0xa2ce11[_0x9cdf93][_0x517c('0x51')])){manager['add'](_0x9cdf93,_0xa2ce11[_0x9cdf93][_0x517c('0x4d')],handleJob(_0xa2ce11[_0x9cdf93]));manager[_0x517c('0x52')](_0x9cdf93);logger[_0x517c('0xd')](_0x517c('0x53'),_0xa2ce11[_0x9cdf93][_0x517c('0x14')],_0xa2ce11[_0x9cdf93][_0x517c('0x4d')]);}else if(manager['exists'](_0x9cdf93)){manager[_0x517c('0x47')](_0x9cdf93);manager[_0x517c('0x48')](_0x9cdf93);logger[_0x517c('0xd')](_0x517c('0x54'),_0xa2ce11[_0x9cdf93][_0x517c('0x14')],_0xa2ce11[_0x9cdf93][_0x517c('0x4d')]);}}for(_0xe83578=0x0,_0x9cdf93;_0xe83578<_0x14e99e[_0x517c('0x45')]&&!_0x39338b;_0xe83578+=0x1){_0x9cdf93=_0x14e99e[_0xe83578][_0x517c('0x42')]();if(manager[_0x517c('0x46')](_0x9cdf93)){if(_0xa2ce11[_0x9cdf93][_0x517c('0x4d')]&&_0xa2ce11[_0x9cdf93][_0x517c('0x4e')]&&moment()['isBetween'](_0xa2ce11[_0x9cdf93][_0x517c('0x50')],_0xa2ce11[_0x9cdf93]['endAt'])){manager[_0x517c('0x55')](_0x9cdf93,_0xa2ce11[_0x9cdf93][_0x517c('0x4d')],handleJob(_0xa2ce11[_0x9cdf93]));logger[_0x517c('0xd')](_0x517c('0x56'),_0xa2ce11[_0x9cdf93][_0x517c('0x14')],_0xa2ce11[_0x9cdf93]['cron']);}else{manager[_0x517c('0x47')](_0x9cdf93);manager[_0x517c('0x48')](_0x9cdf93);logger['info'](_0x517c('0x54'),_0xa2ce11[_0x9cdf93]['name'],_0xa2ce11[_0x9cdf93]['cron']);}}}})[_0x517c('0x2d')](function(_0x3a5588){logger['error'](JSON[_0x517c('0x2f')](_0x3a5588));});}exports[_0x517c('0x57')]=function(_0x3548b6){return getJobs(_0x3548b6);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 631793b..bf54b8a 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 _0xcd31=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','findOne','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','fileText','TranscriptionJob'];(function(_0xf76903,_0x266c90){var _0x5a0085=function(_0x19d395){while(--_0x19d395){_0xf76903['push'](_0xf76903['shift']());}};_0x5a0085(++_0x266c90);}(_0xcd31,0x15d));var _0x1cd3=function(_0x45fc52,_0x5d7015){_0x45fc52=_0x45fc52-0x0;var _0x4a2d8f=_0xcd31[_0x45fc52];return _0x4a2d8f;};var _=require('lodash');var AWS=require(_0x1cd3('0x0'));var rp=require(_0x1cd3('0x1'));var util=require(_0x1cd3('0x2'));var BPromise=require('bluebird');var db=require(_0x1cd3('0x3'))['db'];var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));function getTranscriptionJob(_0x28c67f,_0x295933,_0xf9f49b,_0x5bc77d){return new Promise(function(_0x26ffcb,_0x1ca151){var _0xedb6d1=new AWS['TranscribeService']({'accessKeyId':_0x295933,'secretAccessKey':_0x28c67f,'region':_0xf9f49b});_0xedb6d1[_0x1cd3('0x6')]({'TranscriptionJobName':_0x5bc77d},function(_0x11b139,_0x124659){if(_0x11b139){return _0x1ca151(_0x11b139);}else{return _0x26ffcb(_0x124659);}});});}function sentiment(_0x4a2204,_0x1af2c4,_0x3953d3,_0x17d5c8,_0xb3159f){return new Promise(function(_0x406bc8,_0x3eb8af){var _0x7e5c1a=new AWS['Comprehend']({'accessKeyId':_0x1af2c4,'secretAccessKey':_0x4a2204,'region':_0x3953d3});_0x7e5c1a[_0x1cd3('0x7')]({'Text':_0x17d5c8,'LanguageCode':_0xb3159f[_0x1cd3('0x8')](0x0,0x2)},function(_0x2e460d,_0x44010d){if(_0x2e460d){return _0x3eb8af(_0x2e460d);}else{return _0x406bc8(_0x44010d);}});});}function checkTranscribeJob(_0x5102af,_0xfe288e,_0x4c9c6d){var _0x41016f;return new BPromise(function(_0x35a9ae,_0x3fcc45){logger['info'](util['format'](_0x1cd3('0x9'),_0x5102af['id'],_0x5102af[_0x1cd3('0xa')]));return getTranscriptionJob(_0x4c9c6d[_0x1cd3('0xb')],_0x4c9c6d['data2'],_0xfe288e[_0x1cd3('0xc')],_0x5102af[_0x1cd3('0xa')])[_0x1cd3('0xd')](function(_0x418da3){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5102af['id'],_0x5102af['transcribeName'],_0x418da3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5102af[_0x1cd3('0xe')]){switch(_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')]){case _0x1cd3('0x11'):var _0x359899={'transcribeStatus':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')],'fileUri':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x12')][_0x1cd3('0x13')]};logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x15'),_0x5102af['id']));return rp({'uri':_0x418da3['TranscriptionJob'][_0x1cd3('0x12')][_0x1cd3('0x13')],'json':!![]})['then'](function(_0x20cda5){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x17'),_0x5102af['id']));if(_0x20cda5&&_0x20cda5['results']&&_0x20cda5['results'][_0x1cd3('0x18')]&&_0x20cda5[_0x1cd3('0x19')]['transcripts']['length']){_0x359899[_0x1cd3('0xe')]='';for(var _0x44b162=0x0;_0x44b162<_0x20cda5['results']['transcripts'][_0x1cd3('0x1a')];_0x44b162++){_0x359899[_0x1cd3('0xe')]+=_0x20cda5['results']['transcripts'][_0x44b162][_0x1cd3('0x1b')]+'';}}return _0x5102af[_0x1cd3('0x1c')](_0x359899);})[_0x1cd3('0xd')](function(){logger['info'](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));if(!_0x5102af['tempSentiment']){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x20'));}if(!_0xfe288e['sentiment']||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e['sentimentRegion']||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x24'));}if(!_0x359899[_0x1cd3('0xe')]){throw new Error(_0x1cd3('0x25'));}if(_0xfe288e[_0x1cd3('0x21')]===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_settings[_0x1cd3('0x21')]}});}})[_0x1cd3('0xd')](function(_0x1412cb){if(!_0x1412cb){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x1412cb['data1']||!_0x1412cb[_0x1cd3('0x28')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x1412cb;logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x29'),_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f[_0x1cd3('0x28')],_0xfe288e['sentimentRegion'],_0x359899[_0x1cd3('0xe')],_0xfe288e['language']);})['then'](function(_0x1633af){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x1633af[_0x1cd3('0x2b')],'sPositive':_0x1633af['SentimentScore'][_0x1cd3('0x2c')],'sNegative':_0x1633af[_0x1cd3('0x2d')][_0x1cd3('0x2e')],'sMixed':_0x1633af[_0x1cd3('0x2d')]['Mixed'],'sNeutral':_0x1633af['SentimentScore'][_0x1cd3('0x2f')]});})['then'](function(){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});case _0x1cd3('0x30'):return _0x5102af[_0x1cd3('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x418da3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});default:logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x31'),_0x5102af['id']));break;}}else{return BPromise['resolve']()[_0x1cd3('0xd')](function(){if(!_0x5102af[_0x1cd3('0x32')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xfe288e[_0x1cd3('0x33')]||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e[_0x1cd3('0x34')]||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x24'));}if(!_0x5102af[_0x1cd3('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0xfe288e['sentimentAccountId']===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db['CloudProvider'][_0x1cd3('0x35')]({'where':{'id':_settings[_0x1cd3('0x21')]}});}})['then'](function(_0x2eeea6){if(!_0x2eeea6){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x2eeea6[_0x1cd3('0xb')]||!_0x2eeea6[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x2eeea6;logger[_0x1cd3('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f['data2'],_0xfe288e[_0x1cd3('0x34')],_0x5102af[_0x1cd3('0xe')],_0xfe288e[_0x1cd3('0x22')]);})[_0x1cd3('0xd')](function(_0x326a80){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x326a80[_0x1cd3('0x2b')],'sPositive':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2c')],'sNegative':_0x326a80['SentimentScore']['Negative'],'sMixed':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x36')],'sNeutral':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2f')],'transcribeStatus':_0x1cd3('0x11')});})[_0x1cd3('0xd')](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});}})[_0x1cd3('0x37')](function(_0xbc7fbe){if(_0xbc7fbe){if(!_0xbc7fbe['name']||_0xbc7fbe['name']!==_0x1cd3('0x38')){logger[_0x1cd3('0x39')](util[_0x1cd3('0x14')](_0x1cd3('0x3a'),_0x5102af['id']),util[_0x1cd3('0x3b')](_0xbc7fbe,{'showHidden':![],'depth':null}));}}_0x35a9ae();});});}function checkTranscribe(){var _0x4e746b;var _0x5da126;var _0x500fcf;return db[_0x1cd3('0x3c')][_0x1cd3('0x3d')]({'where':{'transcribeStatus':_0x1cd3('0x3e')}})[_0x1cd3('0xd')](function(_0x1ae177){if(!_0x1ae177||!_0x1ae177['length']){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x3f'));}_0x4e746b=_0x1ae177;return db['Setting'][_0x1cd3('0x35')]({'where':{'id':0x1}});})[_0x1cd3('0xd')](function(_0x2542f6){if(!_0x2542f6){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x40'));}_0x5da126=_0x2542f6;if(!_0x5da126['transcribe']||!_0x5da126[_0x1cd3('0x41')]||!_0x5da126[_0x1cd3('0xc')]||!_0x5da126[_0x1cd3('0x22')]||!_0x5da126[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x42'));}return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_0x5da126[_0x1cd3('0x41')]}});})[_0x1cd3('0xd')](function(_0xbd4ea2){if(!_0xbd4ea2){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x27'));}if(!_0xbd4ea2[_0x1cd3('0xb')]||!_0xbd4ea2[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x43'));}_0x500fcf=_0xbd4ea2;var _0x5e31b2=[];_0x4e746b[_0x1cd3('0x44')](function(_0x233ef5){_0x5e31b2[_0x1cd3('0x45')](checkTranscribeJob(_0x233ef5,_0x5da126,_0x500fcf));});return BPromise[_0x1cd3('0x46')](_0x5e31b2);})['catch'](function(_0x12a2d0){if(_0x12a2d0){if(!_0x12a2d0[_0x1cd3('0x47')]||_0x12a2d0[_0x1cd3('0x47')]!==_0x1cd3('0x38')){logger['error'](util[_0x1cd3('0x3b')](_0x12a2d0,{'showHidden':![],'depth':null}));}}});}exports[_0x1cd3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xfe9d=['request-promise','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeName','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','then','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribe','Transcribe\x20not\x20configured','forEach','push','all','name','lodash','aws-sdk'];(function(_0x298295,_0x116b65){var _0x7510b=function(_0x2c0325){while(--_0x2c0325){_0x298295['push'](_0x298295['shift']());}};_0x7510b(++_0x116b65);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x543264,_0x373cce){_0x543264=_0x543264-0x0;var _0x2f2f90=_0xfe9d[_0x543264];return _0x2f2f90;};var _=require(_0xdfe9('0x0'));var AWS=require(_0xdfe9('0x1'));var rp=require(_0xdfe9('0x2'));var util=require(_0xdfe9('0x3'));var BPromise=require(_0xdfe9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xdfe9('0x5'))('transcribe');function getTranscriptionJob(_0x1144b0,_0x1256ab,_0x2e5fd8,_0x6dd8ce){return new Promise(function(_0xeb5238,_0x582904){var _0x523ecf=new AWS[(_0xdfe9('0x6'))]({'accessKeyId':_0x1256ab,'secretAccessKey':_0x1144b0,'region':_0x2e5fd8});_0x523ecf['getTranscriptionJob']({'TranscriptionJobName':_0x6dd8ce},function(_0x1bc0ea,_0x46d8eb){if(_0x1bc0ea){return _0x582904(_0x1bc0ea);}else{return _0xeb5238(_0x46d8eb);}});});}function sentiment(_0x49db82,_0x34e42f,_0x36f0c6,_0x13b1c5,_0x2580d7){return new Promise(function(_0x5e2c96,_0x2a07e1){var _0x1ab372=new AWS[(_0xdfe9('0x7'))]({'accessKeyId':_0x34e42f,'secretAccessKey':_0x49db82,'region':_0x36f0c6});_0x1ab372[_0xdfe9('0x8')]({'Text':_0x13b1c5,'LanguageCode':_0x2580d7[_0xdfe9('0x9')](0x0,0x2)},function(_0x13a5de,_0x139425){if(_0x13a5de){return _0x2a07e1(_0x13a5de);}else{return _0x5e2c96(_0x139425);}});});}function checkTranscribeJob(_0x13383b,_0x379f5d,_0x351cc8){var _0x5560ab;return new BPromise(function(_0xed269b,_0x4fffb1){logger['info'](util[_0xdfe9('0xa')](_0xdfe9('0xb'),_0x13383b['id'],_0x13383b['transcribeName']));return getTranscriptionJob(_0x351cc8[_0xdfe9('0xc')],_0x351cc8[_0xdfe9('0xd')],_0x379f5d['transcribeRegion'],_0x13383b[_0xdfe9('0xe')])['then'](function(_0x2d151b){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x10'),_0x13383b['id'],_0x13383b[_0xdfe9('0xe')],_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus']));if(!_0x13383b['fileText']){switch(_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus']){case _0xdfe9('0x12'):var _0x3d27d5={'transcribeStatus':_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus'],'fileUri':_0x2d151b['TranscriptionJob'][_0xdfe9('0x13')]['TranscriptFileUri']};logger['info'](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x13383b['id']));return rp({'uri':_0x2d151b[_0xdfe9('0x11')][_0xdfe9('0x13')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x412a25){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x14'),_0x13383b['id']));if(_0x412a25&&_0x412a25[_0xdfe9('0x15')]&&_0x412a25[_0xdfe9('0x15')][_0xdfe9('0x16')]&&_0x412a25[_0xdfe9('0x15')][_0xdfe9('0x16')][_0xdfe9('0x17')]){_0x3d27d5[_0xdfe9('0x18')]='';for(var _0x4ae939=0x0;_0x4ae939<_0x412a25['results'][_0xdfe9('0x16')][_0xdfe9('0x17')];_0x4ae939++){_0x3d27d5['fileText']+=_0x412a25[_0xdfe9('0x15')]['transcripts'][_0x4ae939]['transcript']+'';}}return _0x13383b[_0xdfe9('0x19')](_0x3d27d5);})[_0xdfe9('0x1a')](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13383b['id']));if(!_0x13383b['tempSentiment']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x1d'));}if(!_0x379f5d[_0xdfe9('0x1e')]||!_0x379f5d['sentimentAccountId']||!_0x379f5d[_0xdfe9('0x1f')]||!_0x379f5d[_0xdfe9('0x20')]||!_0x379f5d['bucket']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x21'));}if(!_0x3d27d5['fileText']){throw new Error(_0xdfe9('0x22'));}if(_0x379f5d[_0xdfe9('0x23')]===_0x351cc8['id']){return _0x351cc8;}else{return db[_0xdfe9('0x24')][_0xdfe9('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdfe9('0x1a')](function(_0x3d655f){if(!_0x3d655f){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3d655f[_0xdfe9('0xc')]||!_0x3d655f[_0xdfe9('0xd')]){throw new db['Sequelize'][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x5560ab=_0x3d655f;logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x27'),_0x13383b['id']));return sentiment(_0x5560ab[_0xdfe9('0xc')],_0x5560ab[_0xdfe9('0xd')],_0x379f5d[_0xdfe9('0x1f')],_0x3d27d5[_0xdfe9('0x18')],_0x379f5d[_0xdfe9('0x20')]);})[_0xdfe9('0x1a')](function(_0x3ce9d7){logger['info'](util['format'](_0xdfe9('0x28'),_0x13383b['id']));return _0x13383b[_0xdfe9('0x19')]({'sentiment':_0x3ce9d7[_0xdfe9('0x29')],'sPositive':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2b')],'sNegative':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2c')],'sMixed':_0x3ce9d7[_0xdfe9('0x2a')]['Mixed'],'sNeutral':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2d')]});})[_0xdfe9('0x1a')](function(){logger['info'](util['format'](_0xdfe9('0x2e'),_0x13383b['id']));_0xed269b();});case'FAILED':return _0x13383b[_0xdfe9('0x19')]({'transcribeStatus':_0xdfe9('0x2f'),'failureReason':_0x2d151b['TranscriptionJob'][_0xdfe9('0x30')]})[_0xdfe9('0x1a')](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x2e'),_0x13383b['id']));_0xed269b();});default:logger[_0xdfe9('0xf')](util['format'](_0xdfe9('0x31'),_0x13383b['id']));break;}}else{return BPromise[_0xdfe9('0x32')]()['then'](function(){if(!_0x13383b[_0xdfe9('0x33')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x1d'));}if(!_0x379f5d[_0xdfe9('0x1e')]||!_0x379f5d[_0xdfe9('0x23')]||!_0x379f5d[_0xdfe9('0x1f')]||!_0x379f5d[_0xdfe9('0x20')]||!_0x379f5d[_0xdfe9('0x34')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x21'));}if(!_0x13383b[_0xdfe9('0x18')]){throw new Error(_0xdfe9('0x22'));}if(_0x379f5d[_0xdfe9('0x23')]===_0x351cc8['id']){return _0x351cc8;}else{return db[_0xdfe9('0x24')]['findOne']({'where':{'id':_settings[_0xdfe9('0x23')]}});}})[_0xdfe9('0x1a')](function(_0x316961){if(!_0x316961){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x316961[_0xdfe9('0xc')]||!_0x316961['data2']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x5560ab=_0x316961;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x13383b['id']));return sentiment(_0x5560ab[_0xdfe9('0xc')],_0x5560ab[_0xdfe9('0xd')],_0x379f5d[_0xdfe9('0x1f')],_0x13383b[_0xdfe9('0x18')],_0x379f5d['language']);})[_0xdfe9('0x1a')](function(_0x1d02f2){logger[_0xdfe9('0xf')](util['format'](_0xdfe9('0x28'),_0x13383b['id']));return _0x13383b[_0xdfe9('0x19')]({'sentiment':_0x1d02f2[_0xdfe9('0x29')],'sPositive':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2b')],'sNegative':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2c')],'sMixed':_0x1d02f2['SentimentScore'][_0xdfe9('0x35')],'sNeutral':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2d')],'transcribeStatus':_0xdfe9('0x12')});})['then'](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13383b['id']));_0xed269b();});}})[_0xdfe9('0x36')](function(_0x537186){if(_0x537186){if(!_0x537186['name']||_0x537186['name']!==_0xdfe9('0x37')){logger[_0xdfe9('0x38')](util[_0xdfe9('0xa')](_0xdfe9('0x39'),_0x13383b['id']),util[_0xdfe9('0x3a')](_0x537186,{'showHidden':![],'depth':null}));}}_0xed269b();});});}function checkTranscribe(){var _0x3990ea;var _0x5c6147;var _0x1f7cfc;return db[_0xdfe9('0x3b')][_0xdfe9('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdfe9('0x1a')](function(_0x310c97){if(!_0x310c97||!_0x310c97[_0xdfe9('0x17')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x3d'));}_0x3990ea=_0x310c97;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xdfe9('0x1a')](function(_0x3d3eb7){if(!_0x3d3eb7){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Settings\x20not\x20available');}_0x5c6147=_0x3d3eb7;if(!_0x5c6147[_0xdfe9('0x3e')]||!_0x5c6147['transcribeAccountId']||!_0x5c6147['transcribeRegion']||!_0x5c6147[_0xdfe9('0x20')]||!_0x5c6147[_0xdfe9('0x34')]){throw new db['Sequelize']['ValidationError'](_0xdfe9('0x3f'));}return db[_0xdfe9('0x24')][_0xdfe9('0x25')]({'where':{'id':_0x5c6147['transcribeAccountId']}});})[_0xdfe9('0x1a')](function(_0x48c049){if(!_0x48c049){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x48c049[_0xdfe9('0xc')]||!_0x48c049['data2']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x1f7cfc=_0x48c049;var _0x4321e1=[];_0x3990ea[_0xdfe9('0x40')](function(_0x1398b4){_0x4321e1[_0xdfe9('0x41')](checkTranscribeJob(_0x1398b4,_0x5c6147,_0x1f7cfc));});return BPromise[_0xdfe9('0x42')](_0x4321e1);})[_0xdfe9('0x36')](function(_0x4c35a6){if(_0x4c35a6){if(!_0x4c35a6[_0xdfe9('0x43')]||_0x4c35a6[_0xdfe9('0x43')]!==_0xdfe9('0x37')){logger[_0xdfe9('0x38')](util[_0xdfe9('0x3a')](_0x4c35a6,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 0a6b732..13acf58 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 _0xbf5d=['localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x5ef2f3,_0x185057){var _0x458c7a=function(_0x88f85f){while(--_0x88f85f){_0x5ef2f3['push'](_0x5ef2f3['shift']());}};_0x458c7a(++_0x185057);}(_0xbf5d,0x149));var _0xdbf5=function(_0x22f579,_0x1016ce){_0x22f579=_0x22f579-0x0;var _0x5c4057=_0xbf5d[_0x22f579];return _0x5c4057;};'use strict';var _=require(_0xdbf5('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xdbf5('0x1'));var config=require('../../config/environment');var db=require(_0xdbf5('0x2'))['db'];var logger=require(_0xdbf5('0x3'))(_0xdbf5('0x4'));config[_0xdbf5('0x5')]=_[_0xdbf5('0x6')](config['redis'],{'host':_0xdbf5('0x7'),'port':0x18eb});var io=require(_0xdbf5('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x2d1064=[];return db[_0xdbf5('0x9')][_0xdbf5('0xa')]({'raw':!![],'attributes':['id',_0xdbf5('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdbf5('0xc')](0x18,'hours')}}})['then'](function(_0x2c0ee5){if(_0x2c0ee5&&_0x2c0ee5[_0xdbf5('0xd')]){_0x2d1064=_[_0xdbf5('0xe')](_0x2c0ee5||[],'id');logger[_0xdbf5('0xf')](_0xdbf5('0x10'),_0x2d1064[_0xdbf5('0x11')]());return db['WhatsappInteraction'][_0xdbf5('0x12')]({'closeReason':_0xdbf5('0x13'),'disposition':_0xdbf5('0x14'),'closed':!![],'closedAt':moment()[_0xdbf5('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2d1064}});}})['then'](function(){if(_0x2d1064&&_0x2d1064['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2d1064['join']());for(var _0x536aa0=0x0;_0x536aa0<_0x2d1064['length'];_0x536aa0++){io['emit'](_0xdbf5('0x16'),{'id':_0x2d1064[_0x536aa0],'closed':!![]});}}})[_0xdbf5('0x17')](function(_0x4088cb){logger[_0xdbf5('0x18')](_0xdbf5('0x19'),_0x4088cb?util[_0xdbf5('0x1a')](_0x4088cb,{'showHidden':![],'depth':null}):'');});}exports[_0xdbf5('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x253d=['schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x104b0e,_0x54f3a2){var _0x8080a=function(_0x2527f5){while(--_0x2527f5){_0x104b0e['push'](_0x104b0e['shift']());}};_0x8080a(++_0x54f3a2);}(_0x253d,0x1c7));var _0xd253=function(_0x4d48b4,_0x2a6202){_0x4d48b4=_0x4d48b4-0x0;var _0x372911=_0x253d[_0x4d48b4];return _0x372911;};'use strict';var _=require(_0xd253('0x0'));var moment=require(_0xd253('0x1'));var Redis=require(_0xd253('0x2'));var util=require(_0xd253('0x3'));var config=require(_0xd253('0x4'));var db=require(_0xd253('0x5'))['db'];var logger=require(_0xd253('0x6'))(_0xd253('0x7'));config[_0xd253('0x8')]=_[_0xd253('0x9')](config[_0xd253('0x8')],{'host':_0xd253('0xa'),'port':0x18eb});var io=require(_0xd253('0xb'))(new Redis(config[_0xd253('0x8')]));function closeInteractions(){var _0x6d5a81=[];return db[_0xd253('0xc')][_0xd253('0xd')]({'raw':!![],'attributes':['id',_0xd253('0xe')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd253('0xf')](0x18,_0xd253('0x10'))}}})['then'](function(_0x58e270){if(_0x58e270&&_0x58e270[_0xd253('0x11')]){_0x6d5a81=_[_0xd253('0x12')](_0x58e270||[],'id');logger[_0xd253('0x13')](_0xd253('0x14'),_0x6d5a81[_0xd253('0x15')]());return db[_0xd253('0xc')][_0xd253('0x16')]({'closeReason':'system','disposition':_0xd253('0x17'),'closed':!![],'closedAt':moment()[_0xd253('0x18')](_0xd253('0x19'))},{'where':{'id':_0x6d5a81}});}})[_0xd253('0x1a')](function(){if(_0x6d5a81&&_0x6d5a81['length']){logger['info'](_0xd253('0x1b'),_0x6d5a81[_0xd253('0x15')]());for(var _0x43d233=0x0;_0x43d233<_0x6d5a81['length'];_0x43d233++){io[_0xd253('0x1c')](_0xd253('0x1d'),{'id':_0x6d5a81[_0x43d233],'closed':!![]});}}})[_0xd253('0x1e')](function(_0x27ec8e){logger['error'](_0xd253('0x1f'),_0x27ec8e?util['inspect'](_0x27ec8e,{'showHidden':![],'depth':null}):'');});}exports[_0xd253('0x20')]=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 ff054ad..906b6d5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9cb=['../mysqldb','push','Biondo','innocenzo.biondo','now','Innocenzo','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch'];(function(_0x1d8b35,_0x1821a2){var _0x122224=function(_0x8d8c47){while(--_0x8d8c47){_0x1d8b35['push'](_0x1d8b35['shift']());}};_0x122224(++_0x1821a2);}(_0xa9cb,0x1b0));var _0xba9c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9cb[_0x501510];return _0x1e6ee5;};'use strict';var util=require('util');var db=require(_0xba9c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xba9c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xba9c('0x2')+i,'phone':0xf879fb460+i,'email':_0xba9c('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xba9c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xba9c('0x4')](),'updatedAt':Date[_0xba9c('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xba9c('0x5')+i,'lastName':_0xba9c('0x2')+i,'phone':0xf879fb460+i,'email':_0xba9c('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xba9c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xba9c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xba9c('0x4')](),'updatedAt':Date[_0xba9c('0x4')]()});}db['CmContact'][_0xba9c('0x6')]({'where':{}})[_0xba9c('0x7')](function(){return db[_0xba9c('0x8')][_0xba9c('0x9')](contacts);})[_0xba9c('0x7')](function(){console[_0xba9c('0xa')](_0xba9c('0xb'),_0xba9c('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0xba9c('0x7')](function(){return db[_0xba9c('0xd')]['bulkCreate'](hopper);})[_0xba9c('0x7')](function(){console[_0xba9c('0xa')]('finished\x20populating',_0xba9c('0xe'));return db[_0xba9c('0x8')][_0xba9c('0x9')](contacts2);})[_0xba9c('0x7')](function(){console[_0xba9c('0xa')](_0xba9c('0xb'),_0xba9c('0xf'));return db[_0xba9c('0xd')][_0xba9c('0x9')](hopper2);})['then'](function(){console[_0xba9c('0xa')](_0xba9c('0xb'),_0xba9c('0x10'));})[_0xba9c('0x11')](function(_0x194c41){console[_0xba9c('0xa')](_0x194c41);}); \ No newline at end of file +var _0xf051=['innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','bulkCreate','log','then','CmHopper','finished\x20populating','hopper1','contacts2','util','../mysqldb','Innocenzo','Biondo'];(function(_0x18c4bf,_0x56dfe5){var _0x5c9674=function(_0x46c6e9){while(--_0x46c6e9){_0x18c4bf['push'](_0x18c4bf['shift']());}};_0x5c9674(++_0x56dfe5);}(_0xf051,0x95));var _0x1f05=function(_0x389baa,_0x1dbf7c){_0x389baa=_0x389baa-0x0;var _0x39619d=_0xf051[_0x389baa];return _0x39619d;};'use strict';var util=require(_0x1f05('0x0'));var db=require(_0x1f05('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1f05('0x2')+i,'lastName':_0x1f05('0x3')+i,'phone':0xf879fb460+i,'email':_0x1f05('0x4')+i+_0x1f05('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x1f05('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1f05('0x6')](),'updatedAt':Date[_0x1f05('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1f05('0x7')]({'id':i,'firstName':_0x1f05('0x2')+i,'lastName':_0x1f05('0x3')+i,'phone':0xf879fb460+i,'email':_0x1f05('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1f05('0x7')]({'id':i,'active':![],'scheduledat':Date[_0x1f05('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1f05('0x6')](),'updatedAt':Date[_0x1f05('0x6')]()});}db[_0x1f05('0x8')][_0x1f05('0x9')]({'where':{}})['then'](function(){return db[_0x1f05('0x8')][_0x1f05('0xa')](contacts);})['then'](function(){console[_0x1f05('0xb')]('finished\x20populating','contacts1');return db['CmHopper'][_0x1f05('0x9')]({'where':{}});})[_0x1f05('0xc')](function(){return db[_0x1f05('0xd')][_0x1f05('0xa')](hopper);})[_0x1f05('0xc')](function(){console[_0x1f05('0xb')](_0x1f05('0xe'),_0x1f05('0xf'));return db[_0x1f05('0x8')]['bulkCreate'](contacts2);})[_0x1f05('0xc')](function(){console[_0x1f05('0xb')](_0x1f05('0xe'),_0x1f05('0x10'));return db[_0x1f05('0xd')][_0x1f05('0xa')](hopper2);})[_0x1f05('0xc')](function(){console['log'](_0x1f05('0xe'),'hopper2');})['catch'](function(_0x276dbe){console['log'](_0x276dbe);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 612cdb1..3b10bdf 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d4a=['ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x6d4a,0x1ca));var _0xa6d4=function(_0x3a1970,_0x2a844e){_0x3a1970=_0x3a1970-0x0;var _0x58c18d=_0x6d4a[_0x3a1970];return _0x58c18d;};'use strict';var util=require('util');var db=require(_0xa6d4('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa6d4('0x1')]({'name':util[_0xa6d4('0x2')](_0xa6d4('0x3'),_0xa6d4('0x4'),i),'fullname':util[_0xa6d4('0x2')]('%s%s',_0xa6d4('0x4'),i),'email':util[_0xa6d4('0x2')](_0xa6d4('0x5'),_0xa6d4('0x4'),i),'role':_0xa6d4('0x4'),'password':_0xa6d4('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xa6d4('0x7'),'ws',_0xa6d4('0x8')],'disallow':[_0xa6d4('0x9')],'allow':[_0xa6d4('0xa')],'defaultuser':util[_0xa6d4('0x2')](_0xa6d4('0x3'),_0xa6d4('0x4'),i),'encryption':_0xa6d4('0xb'),'avpf':_0xa6d4('0xb'),'force_avp':_0xa6d4('0xb'),'icesupport':_0xa6d4('0xb'),'dtlsenable':_0xa6d4('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xa6d4('0xc'),'dtlssetup':'actpass','callerid':util['format'](_0xa6d4('0xd'),util[_0xa6d4('0x2')](_0xa6d4('0x3'),'agent',i),0xfa0+i)});}db['User'][_0xa6d4('0xe')](users)['then'](function(){console[_0xa6d4('0xf')](_0xa6d4('0x10'));})[_0xa6d4('0x11')](function(_0x58025d){console[_0xa6d4('0xf')](_0x58025d);}); \ No newline at end of file +var _0xd7b9=['../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','bulkCreate','log','catch'];(function(_0x17d14b,_0x71effc){var _0x593288=function(_0x1d5c29){while(--_0x1d5c29){_0x17d14b['push'](_0x17d14b['shift']());}};_0x593288(++_0x71effc);}(_0xd7b9,0xdd));var _0x9d7b=function(_0x29b882,_0x3d7b7c){_0x29b882=_0x29b882-0x0;var _0x292361=_0xd7b9[_0x29b882];return _0x292361;};'use strict';var util=require('util');var db=require(_0x9d7b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x9d7b('0x1')](_0x9d7b('0x2'),'agent',i),'fullname':util[_0x9d7b('0x1')](_0x9d7b('0x2'),_0x9d7b('0x3'),i),'email':util[_0x9d7b('0x1')](_0x9d7b('0x4'),'agent',i),'role':_0x9d7b('0x3'),'password':_0x9d7b('0x5'),'internal':0xfa0+i,'type':_0x9d7b('0x6'),'transport':['udp','ws',_0x9d7b('0x7')],'disallow':[_0x9d7b('0x8')],'allow':[_0x9d7b('0x9')],'defaultuser':util['format']('%s%s',_0x9d7b('0x3'),i),'encryption':_0x9d7b('0xa'),'avpf':'yes','force_avp':_0x9d7b('0xa'),'icesupport':_0x9d7b('0xa'),'dtlsenable':_0x9d7b('0xa'),'dtlsverify':'no','dtlscertfile':_0x9d7b('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x9d7b('0xc'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x9d7b('0x1')](_0x9d7b('0x2'),_0x9d7b('0x3'),i),0xfa0+i)});}db[_0x9d7b('0xd')][_0x9d7b('0xe')](users)['then'](function(){console[_0x9d7b('0xf')]('add\x20user');})[_0x9d7b('0x10')](function(_0x23f337){console[_0x9d7b('0xf')](_0x23f337);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d8cd304..74c645e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9d6=['removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','where','format','%s:queue:%s','Agents','handshake','query','find','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueues','userProfileId','FaxQueue','MailQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','fax','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove'];(function(_0x75aaf9,_0x2e4c24){var _0x4ae35f=function(_0x483b8a){while(--_0x483b8a){_0x75aaf9['push'](_0x75aaf9['shift']());}};_0x4ae35f(++_0x2e4c24);}(_0xd9d6,0x19c));var _0x6d9d=function(_0xccd9b7,_0x2ea6bd){_0xccd9b7=_0xccd9b7-0x0;var _0x26301d=_0xd9d6[_0xccd9b7];return _0x26301d;};'use strict';var _=require(_0x6d9d('0x0'));var util=require(_0x6d9d('0x1'));var BPromise=require('bluebird');var db=require(_0x6d9d('0x2'))['db'];var config=require(_0x6d9d('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x6d9d('0x4'),_0x6d9d('0x5')],'raw':!![],'where':{'role':_0x6d9d('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6d9d('0x4')],'where':{'role':_0x6d9d('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6d9d('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6d9d('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6d9d('0x4'),_0x6d9d('0x8')],'where':{'type':_0x6d9d('0x9')}};function getAssociatedResources(_0x1d85ab,_0x5ea2d4,_0xabe12b){return db['UserProfileSection'][_0x6d9d('0xa')]({'where':{'name':_0x1d85ab,'userProfileId':_0x5ea2d4},'raw':!![]})[_0x6d9d('0xb')](function(_0x305e80){if(_0x305e80){if(_0x305e80[_0x6d9d('0xc')]){switch(_0x1d85ab){case'VoiceQueues':case _0x6d9d('0xd'):case _0x6d9d('0xe'):case _0x6d9d('0xf'):case'MailQueues':case'OpenchannelQueues':case _0x6d9d('0x10'):return db[_0xabe12b][_0x6d9d('0x11')](queryQueues);case'Telephones':return db[_0xabe12b][_0x6d9d('0x11')](queryTelephones);case _0x6d9d('0x12'):return db[_0xabe12b]['findAll'](queryTrunks);case _0x6d9d('0x13'):return db[_0xabe12b]['findAll'](queryCampaigns);}}else{return db[_0x6d9d('0x14')][_0x6d9d('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x305e80['id']},'raw':!![]})[_0x6d9d('0xb')](function(_0x1aa90f){if(_0x1aa90f){var _0x5d8761={'where':{'id':_[_0x6d9d('0x15')](_0x1aa90f,_0x6d9d('0x16'))},'raw':!![]};switch(_0xabe12b){case _0x6d9d('0x17'):_0x5d8761[_0x6d9d('0x18')][_0x6d9d('0x5')]=_0x6d9d('0x7');break;case'Campaign':_0x5d8761[_0x6d9d('0x18')][_0x6d9d('0x8')]=_0x6d9d('0x9');break;}return db[_0xabe12b][_0x6d9d('0x11')](_0x5d8761);}else{return[];}});}}else{return[];}})[_0x6d9d('0xb')](function(_0x2f6de7){return _0x2f6de7;});}function joinOrLeaveQueues(_0x2fd98b,_0x39f62c,_0x49f069,_0x43d517){_0x2fd98b[_0x39f62c](util[_0x6d9d('0x19')](_0x6d9d('0x1a'),_0x49f069,_0x43d517[_0x6d9d('0x4')]));if(_0x43d517[_0x6d9d('0x1b')]){for(var _0x2ae73a=0x0;_0x2ae73a<_0x43d517[_0x6d9d('0x1b')]['length'];_0x2ae73a+=0x1){_0x2fd98b[_0x39f62c](util[_0x6d9d('0x19')]('user:%s',_0x43d517[_0x6d9d('0x1b')][_0x2ae73a][_0x6d9d('0x4')]));}}}function joinOrLeave(_0x58e2e4,_0x166f4a,_0x41a47d){var _0xc41c58;if(_0x58e2e4[_0x6d9d('0x1c')][_0x6d9d('0x1d')]['id']){db[_0x6d9d('0x17')][_0x6d9d('0x1e')]({'attributes':['id',_0x6d9d('0x4'),_0x6d9d('0x5'),'userProfileId'],'where':{'id':_0x58e2e4['handshake'][_0x6d9d('0x1d')]['id']},'include':[{'model':db[_0x6d9d('0x1f')],'as':_0x6d9d('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6d9d('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6d9d('0x22')],'as':_0x6d9d('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6d9d('0x24')],'as':_0x6d9d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6d9d('0x26')],'as':_0x6d9d('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1fff03){if(_0x1fff03){_0xc41c58=_0x1fff03;_0x58e2e4[_0x166f4a](util[_0x6d9d('0x19')](_0x6d9d('0x28'),_0x1fff03['name']));var _0x46d572=[];switch(_0x1fff03['role']){case'admin':_0x58e2e4[_0x166f4a](_0x6d9d('0x29'));_0x58e2e4[_0x166f4a](_0x6d9d('0x2a'));if(queryQueues['hasOwnProperty'](_0x6d9d('0x2b'))){delete queryQueues[_0x6d9d('0x2b')];}_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x2d')][_0x6d9d('0x11')](queryQueues));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x2e')][_0x6d9d('0x11')](queryQueues));_0x46d572[_0x6d9d('0x2c')](db['FaxQueue'][_0x6d9d('0x11')](queryQueues));_0x46d572['push'](db[_0x6d9d('0x2f')]['findAll'](queryQueues));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x30')][_0x6d9d('0x11')](queryQueues));_0x46d572[_0x6d9d('0x2c')](db['OpenchannelQueue'][_0x6d9d('0x11')](queryQueues));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x31')][_0x6d9d('0x11')](queryQueues));_0x46d572[_0x6d9d('0x2c')](db['User'][_0x6d9d('0x11')](queryTelephones));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x32')][_0x6d9d('0x11')](queryTrunks));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x33')]['findAll'](queryCampaigns));_0x46d572[_0x6d9d('0x2c')](db[_0x6d9d('0x17')][_0x6d9d('0x11')](queryAgents));break;case _0x6d9d('0x34'):_0x58e2e4[_0x166f4a](_0x6d9d('0x29'));_0x58e2e4[_0x166f4a](_0x6d9d('0x2a'));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0x35'),_0x1fff03['userProfileId'],_0x6d9d('0x2d')));_0x46d572['push'](getAssociatedResources(_0x6d9d('0xd'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x2e')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources('FaxQueues',_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x37')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0xf'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x2f')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0x38'),_0x1fff03['userProfileId'],_0x6d9d('0x30')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources('OpenchannelQueues',_0x1fff03[_0x6d9d('0x36')],'OpenchannelQueue'));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0x10'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x31')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0x39'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x17')));_0x46d572[_0x6d9d('0x2c')](getAssociatedResources(_0x6d9d('0x12'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x32')));_0x46d572['push'](getAssociatedResources(_0x6d9d('0x13'),_0x1fff03[_0x6d9d('0x36')],_0x6d9d('0x33')));_0x46d572[_0x6d9d('0x2c')](db['User'][_0x6d9d('0x11')](queryAgents));break;case _0x6d9d('0x6'):_0x58e2e4[_0x166f4a]('voice:inbound');_0x58e2e4[_0x166f4a](_0x6d9d('0x2a'));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3a')]({'attributes':['id',_0x6d9d('0x4')]}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3b')]({'attributes':['id',_0x6d9d('0x4')]}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3c')]({'attributes':['id','name']}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3d')]({'attributes':['id',_0x6d9d('0x4')]}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3e')]({'attributes':['id',_0x6d9d('0x4')]}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x3f')]({'attributes':['id',_0x6d9d('0x4')]}));_0x46d572[_0x6d9d('0x2c')](_0x1fff03[_0x6d9d('0x40')]({'attributes':['id',_0x6d9d('0x4')]}));break;}return BPromise[_0x6d9d('0x41')](_0x46d572);}})['then'](function(_0x284a14){if(_0x284a14&&_0x284a14[_0x6d9d('0x42')]){for(var _0x1c85bf=0x0;_0x1c85bf<_0x284a14['length'];_0x1c85bf+=0x1){for(var _0x287105=0x0;_0x287105<_0x284a14[_0x1c85bf][_0x6d9d('0x42')];_0x287105+=0x1){switch(_0x1c85bf){case 0x0:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,'voice',_0x284a14[_0x1c85bf][_0x287105]);break;case 0x1:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,_0x6d9d('0x43'),_0x284a14[_0x1c85bf][_0x287105]);break;case 0x2:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,_0x6d9d('0x44'),_0x284a14[_0x1c85bf][_0x287105]);break;case 0x3:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,_0x6d9d('0x45'),_0x284a14[_0x1c85bf][_0x287105]);break;case 0x4:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,'mail',_0x284a14[_0x1c85bf][_0x287105]);break;case 0x5:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,'openchannel',_0x284a14[_0x1c85bf][_0x287105]);break;case 0x6:joinOrLeaveQueues(_0x58e2e4,_0x166f4a,_0x6d9d('0x46'),_0x284a14[_0x1c85bf][_0x287105]);break;case 0x7:if(_0xc41c58[_0x6d9d('0x5')]!==_0x6d9d('0x6'))_0x58e2e4[_0x166f4a](util['format'](_0x6d9d('0x47'),_0x284a14[_0x1c85bf][_0x287105][_0x6d9d('0x4')]));break;case 0x8:if(_0xc41c58[_0x6d9d('0x5')]!==_0x6d9d('0x6'))_0x58e2e4[_0x166f4a](util[_0x6d9d('0x19')](_0x6d9d('0x48'),_0x284a14[_0x1c85bf][_0x287105][_0x6d9d('0x4')]));break;case 0x9:if(_0xc41c58[_0x6d9d('0x5')]!==_0x6d9d('0x6'))_0x58e2e4[_0x166f4a](util[_0x6d9d('0x19')](_0x6d9d('0x49'),_0x284a14[_0x1c85bf][_0x287105]['type'],_0x284a14[_0x1c85bf][_0x287105][_0x6d9d('0x4')]));break;case 0xa:_0x58e2e4[_0x166f4a](util[_0x6d9d('0x19')](_0x6d9d('0x28'),_0x284a14[_0x1c85bf][_0x287105][_0x6d9d('0x4')]));break;}}}}})['then'](function(){if(_0x166f4a===_0x6d9d('0x4a')){var _0x5e3fc8=_[_0x6d9d('0x15')](_0xc41c58[_0x6d9d('0x20')],'id');return _0xc41c58['removeChatInteractions'](_0x5e3fc8)['then'](function(){for(var _0x2aad34=0x0;_0x2aad34<_0x5e3fc8[_0x6d9d('0x42')];_0x2aad34+=0x1){_0x41a47d[_0x6d9d('0x4b')](_0x6d9d('0x4c'),{'ChatInteractionId':Number(_0x5e3fc8[_0x2aad34]),'UserId':Number(_0xc41c58['id'])});}});}})['then'](function(){if(_0x166f4a==='leave'){var _0x1d69cc=_['map'](_0xc41c58[_0x6d9d('0x4d')],'id');return _0xc41c58[_0x6d9d('0x4e')](_0x1d69cc)['then'](function(){for(var _0x13c443=0x0;_0x13c443<_0x1d69cc[_0x6d9d('0x42')];_0x13c443+=0x1){_0x41a47d[_0x6d9d('0x4b')](_0x6d9d('0x4f'),{'MailInteractionId':Number(_0x1d69cc[_0x13c443]),'UserId':Number(_0xc41c58['id'])});}});}})[_0x6d9d('0xb')](function(){if(_0x166f4a===_0x6d9d('0x4a')){var _0x1cd4c7=_[_0x6d9d('0x15')](_0xc41c58[_0x6d9d('0x21')],'id');return _0xc41c58[_0x6d9d('0x50')](_0x1cd4c7)[_0x6d9d('0xb')](function(){for(var _0xb07ea0=0x0;_0xb07ea0<_0x1cd4c7[_0x6d9d('0x42')];_0xb07ea0+=0x1){_0x41a47d[_0x6d9d('0x4b')](_0x6d9d('0x51'),{'FaxInteractionId':Number(_0x1cd4c7[_0xb07ea0]),'UserId':Number(_0xc41c58['id'])});}});}})['then'](function(){if(_0x166f4a===_0x6d9d('0x4a')){var _0x2db031=_[_0x6d9d('0x15')](_0xc41c58[_0x6d9d('0x23')],'id');return _0xc41c58['removeSmsInteractions'](_0x2db031)['then'](function(){for(var _0x5d3297=0x0;_0x5d3297<_0x2db031['length'];_0x5d3297+=0x1){_0x41a47d['emit'](_0x6d9d('0x52'),{'SmsInteractionId':Number(_0x2db031[_0x5d3297]),'UserId':Number(_0xc41c58['id'])});}});}})[_0x6d9d('0xb')](function(){if(_0x166f4a==='leave'){var _0x34c72c=_[_0x6d9d('0x15')](_0xc41c58[_0x6d9d('0x25')],'id');return _0xc41c58[_0x6d9d('0x53')](_0x34c72c)[_0x6d9d('0xb')](function(){for(var _0x38c42a=0x0;_0x38c42a<_0x34c72c[_0x6d9d('0x42')];_0x38c42a+=0x1){_0x41a47d[_0x6d9d('0x4b')](_0x6d9d('0x54'),{'OpenchannelInteractionId':Number(_0x34c72c[_0x38c42a]),'UserId':Number(_0xc41c58['id'])});}});}})['then'](function(){if(_0x166f4a===_0x6d9d('0x4a')){var _0x211047=_['map'](_0xc41c58[_0x6d9d('0x27')],'id');return _0xc41c58[_0x6d9d('0x55')](_0x211047)[_0x6d9d('0xb')](function(){for(var _0x36c34d=0x0;_0x36c34d<_0x211047['length'];_0x36c34d+=0x1){_0x41a47d['emit'](_0x6d9d('0x56'),{'WhatsappInteractionId':Number(_0x211047[_0x36c34d]),'UserId':Number(_0xc41c58['id'])});}});}})[_0x6d9d('0x57')](function(_0x2bf2aa){_0x58e2e4[_0x6d9d('0x58')](_0x2bf2aa);});}}function onDisconnect(_0x1c5fdd,_0x185a8d){joinOrLeave(_0x1c5fdd,_0x6d9d('0x4a'),_0x185a8d);}function onConnect(_0x29ad09){joinOrLeave(_0x29ad09,'join');}exports['default']=function(_0x486504){_0x486504['on'](_0x6d9d('0x59'),function(_0x59e392){_0x59e392[_0x6d9d('0x5a')](0x0);_0x59e392[_0x6d9d('0x5b')]=_0x59e392[_0x6d9d('0x5c')][_0x6d9d('0x59')][_0x6d9d('0x5d')]+':'+_0x59e392[_0x6d9d('0x5c')][_0x6d9d('0x59')][_0x6d9d('0x5e')];_0x59e392['connectedAt']=new Date();_0x59e392[_0x6d9d('0x58')]=function(_0x9e4081){console[_0x6d9d('0x58')](_0x6d9d('0x5f')+_0x59e392[_0x6d9d('0x60')]['name']+'['+_0x59e392['address']+']',_0x9e4081);};_0x59e392['on'](_0x6d9d('0x61'),function(){onDisconnect(_0x59e392,_0x486504);_0x59e392[_0x6d9d('0x58')]('DISCONNECTED');});onConnect(_0x59e392);_0x59e392[_0x6d9d('0x58')](_0x6d9d('0x62'));});}; \ No newline at end of file +var _0x483f=['util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','type','ivr','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','where','role','Campaign','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','ChatQueues','SmsQueues','SmsQueue','WhatsappQueues','Trunks','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getWhatsappQueues','all','voice','fax','sms','mail','whatsapp','format','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_whatsapp_interactions:remove','log','default','setMaxListeners','address','request','connection','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash'];(function(_0x3d5683,_0x561a35){var _0x1aa22e=function(_0xe83203){while(--_0xe83203){_0x3d5683['push'](_0x3d5683['shift']());}};_0x1aa22e(++_0x561a35);}(_0x483f,0x11c));var _0xf483=function(_0x5925b2,_0x6314a8){_0x5925b2=_0x5925b2-0x0;var _0x5544de=_0x483f[_0x5925b2];return _0x5544de;};'use strict';var _=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var BPromise=require(_0xf483('0x2'));var db=require(_0xf483('0x3'))['db'];var config=require(_0xf483('0x4'));var queryQueues={'attributes':['id',_0xf483('0x5')],'include':[{'as':_0xf483('0x6'),'model':db[_0xf483('0x7')],'attributes':['id',_0xf483('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf483('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf483('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xf483('0x5')],'where':{'role':_0xf483('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf483('0x5'),_0xf483('0xa')],'where':{'type':_0xf483('0xb')}};function getAssociatedResources(_0x281b97,_0x5920d5,_0x42372a){return db['UserProfileSection']['findOne']({'where':{'name':_0x281b97,'userProfileId':_0x5920d5},'raw':!![]})[_0xf483('0xc')](function(_0x16c2b6){if(_0x16c2b6){if(_0x16c2b6[_0xf483('0xd')]){switch(_0x281b97){case _0xf483('0xe'):case'ChatQueues':case _0xf483('0xf'):case'SmsQueues':case _0xf483('0x10'):case _0xf483('0x11'):case'WhatsappQueues':return db[_0x42372a][_0xf483('0x12')](queryQueues);case _0xf483('0x13'):return db[_0x42372a]['findAll'](queryTelephones);case'Trunks':return db[_0x42372a][_0xf483('0x12')](queryTrunks);case _0xf483('0x14'):return db[_0x42372a][_0xf483('0x12')](queryCampaigns);}}else{return db[_0xf483('0x15')][_0xf483('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x16c2b6['id']},'raw':!![]})[_0xf483('0xc')](function(_0x2561b2){if(_0x2561b2){var _0x48ee49={'where':{'id':_[_0xf483('0x16')](_0x2561b2,_0xf483('0x17'))},'raw':!![]};switch(_0x42372a){case _0xf483('0x7'):_0x48ee49[_0xf483('0x18')][_0xf483('0x19')]=_0xf483('0x8');break;case _0xf483('0x1a'):_0x48ee49[_0xf483('0x18')]['type']=_0xf483('0xb');break;}return db[_0x42372a][_0xf483('0x12')](_0x48ee49);}else{return[];}});}}else{return[];}})[_0xf483('0xc')](function(_0x4cbbcc){return _0x4cbbcc;});}function joinOrLeaveQueues(_0x4c62fd,_0xae13aa,_0x2f2070,_0x2a6f64){_0x4c62fd[_0xae13aa](util['format'](_0xf483('0x1b'),_0x2f2070,_0x2a6f64[_0xf483('0x5')]));if(_0x2a6f64['Agents']){for(var _0x22923a=0x0;_0x22923a<_0x2a6f64['Agents'][_0xf483('0x1c')];_0x22923a+=0x1){_0x4c62fd[_0xae13aa](util['format'](_0xf483('0x1d'),_0x2a6f64['Agents'][_0x22923a][_0xf483('0x5')]));}}}function joinOrLeave(_0x194569,_0x2e3ae2,_0x25f833){var _0x5cee0c;if(_0x194569[_0xf483('0x1e')][_0xf483('0x1f')]['id']){db['User'][_0xf483('0x20')]({'attributes':['id',_0xf483('0x5'),_0xf483('0x19'),_0xf483('0x21')],'where':{'id':_0x194569[_0xf483('0x1e')]['query']['id']},'include':[{'model':db[_0xf483('0x22')],'as':_0xf483('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf483('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xf483('0x25')],'as':_0xf483('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xf483('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xf483('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xf483('0x29')],'as':_0xf483('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xf483('0xc')](function(_0x2afaf6){if(_0x2afaf6){_0x5cee0c=_0x2afaf6;_0x194569[_0x2e3ae2](util['format'](_0xf483('0x1d'),_0x2afaf6[_0xf483('0x5')]));var _0x1a9067=[];switch(_0x2afaf6[_0xf483('0x19')]){case _0xf483('0x2b'):_0x194569[_0x2e3ae2](_0xf483('0x2c'));_0x194569[_0x2e3ae2](_0xf483('0x2d'));if(queryQueues[_0xf483('0x2e')](_0xf483('0x2f'))){delete queryQueues[_0xf483('0x2f')];}_0x1a9067[_0xf483('0x30')](db[_0xf483('0x31')][_0xf483('0x12')](queryQueues));_0x1a9067['push'](db[_0xf483('0x32')][_0xf483('0x12')](queryQueues));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x33')][_0xf483('0x12')](queryQueues));_0x1a9067[_0xf483('0x30')](db['SmsQueue'][_0xf483('0x12')](queryQueues));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x34')][_0xf483('0x12')](queryQueues));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x35')][_0xf483('0x12')](queryQueues));_0x1a9067['push'](db[_0xf483('0x36')][_0xf483('0x12')](queryQueues));_0x1a9067['push'](db[_0xf483('0x7')][_0xf483('0x12')](queryTelephones));_0x1a9067['push'](db['Trunk']['findAll'](queryTrunks));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x1a')][_0xf483('0x12')](queryCampaigns));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x7')]['findAll'](queryAgents));break;case _0xf483('0x37'):_0x194569[_0x2e3ae2]('voice:inbound');_0x194569[_0x2e3ae2]('voice:outbound');_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0xe'),_0x2afaf6['userProfileId'],'VoiceQueue'));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x38'),_0x2afaf6[_0xf483('0x21')],'ChatQueue'));_0x1a9067['push'](getAssociatedResources(_0xf483('0xf'),_0x2afaf6[_0xf483('0x21')],_0xf483('0x33')));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x39'),_0x2afaf6['userProfileId'],_0xf483('0x3a')));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x10'),_0x2afaf6[_0xf483('0x21')],'MailQueue'));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x11'),_0x2afaf6[_0xf483('0x21')],_0xf483('0x35')));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x3b'),_0x2afaf6[_0xf483('0x21')],_0xf483('0x36')));_0x1a9067[_0xf483('0x30')](getAssociatedResources('Telephones',_0x2afaf6[_0xf483('0x21')],_0xf483('0x7')));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x3c'),_0x2afaf6[_0xf483('0x21')],_0xf483('0x3d')));_0x1a9067[_0xf483('0x30')](getAssociatedResources(_0xf483('0x14'),_0x2afaf6[_0xf483('0x21')],'Campaign'));_0x1a9067[_0xf483('0x30')](db[_0xf483('0x7')]['findAll'](queryAgents));break;case _0xf483('0x9'):_0x194569[_0x2e3ae2](_0xf483('0x2c'));_0x194569[_0x2e3ae2](_0xf483('0x2d'));_0x1a9067[_0xf483('0x30')](_0x2afaf6[_0xf483('0x3e')]({'attributes':['id','name']}));_0x1a9067[_0xf483('0x30')](_0x2afaf6[_0xf483('0x3f')]({'attributes':['id','name']}));_0x1a9067[_0xf483('0x30')](_0x2afaf6['getFaxQueues']({'attributes':['id',_0xf483('0x5')]}));_0x1a9067[_0xf483('0x30')](_0x2afaf6[_0xf483('0x40')]({'attributes':['id','name']}));_0x1a9067[_0xf483('0x30')](_0x2afaf6['getMailQueues']({'attributes':['id','name']}));_0x1a9067[_0xf483('0x30')](_0x2afaf6['getOpenchannelQueues']({'attributes':['id',_0xf483('0x5')]}));_0x1a9067[_0xf483('0x30')](_0x2afaf6[_0xf483('0x41')]({'attributes':['id',_0xf483('0x5')]}));break;}return BPromise[_0xf483('0x42')](_0x1a9067);}})[_0xf483('0xc')](function(_0x505830){if(_0x505830&&_0x505830['length']){for(var _0x5d5053=0x0;_0x5d5053<_0x505830[_0xf483('0x1c')];_0x5d5053+=0x1){for(var _0x447953=0x0;_0x447953<_0x505830[_0x5d5053][_0xf483('0x1c')];_0x447953+=0x1){switch(_0x5d5053){case 0x0:joinOrLeaveQueues(_0x194569,_0x2e3ae2,_0xf483('0x43'),_0x505830[_0x5d5053][_0x447953]);break;case 0x1:joinOrLeaveQueues(_0x194569,_0x2e3ae2,'chat',_0x505830[_0x5d5053][_0x447953]);break;case 0x2:joinOrLeaveQueues(_0x194569,_0x2e3ae2,_0xf483('0x44'),_0x505830[_0x5d5053][_0x447953]);break;case 0x3:joinOrLeaveQueues(_0x194569,_0x2e3ae2,_0xf483('0x45'),_0x505830[_0x5d5053][_0x447953]);break;case 0x4:joinOrLeaveQueues(_0x194569,_0x2e3ae2,_0xf483('0x46'),_0x505830[_0x5d5053][_0x447953]);break;case 0x5:joinOrLeaveQueues(_0x194569,_0x2e3ae2,'openchannel',_0x505830[_0x5d5053][_0x447953]);break;case 0x6:joinOrLeaveQueues(_0x194569,_0x2e3ae2,_0xf483('0x47'),_0x505830[_0x5d5053][_0x447953]);break;case 0x7:if(_0x5cee0c['role']!==_0xf483('0x9'))_0x194569[_0x2e3ae2](util[_0xf483('0x48')](_0xf483('0x49'),_0x505830[_0x5d5053][_0x447953][_0xf483('0x5')]));break;case 0x8:if(_0x5cee0c[_0xf483('0x19')]!==_0xf483('0x9'))_0x194569[_0x2e3ae2](util[_0xf483('0x48')](_0xf483('0x4a'),_0x505830[_0x5d5053][_0x447953]['name']));break;case 0x9:if(_0x5cee0c[_0xf483('0x19')]!==_0xf483('0x9'))_0x194569[_0x2e3ae2](util[_0xf483('0x48')](_0xf483('0x4b'),_0x505830[_0x5d5053][_0x447953][_0xf483('0xa')],_0x505830[_0x5d5053][_0x447953][_0xf483('0x5')]));break;case 0xa:_0x194569[_0x2e3ae2](util[_0xf483('0x48')]('user:%s',_0x505830[_0x5d5053][_0x447953][_0xf483('0x5')]));break;}}}}})['then'](function(){if(_0x2e3ae2===_0xf483('0x4c')){var _0x599c1d=_[_0xf483('0x16')](_0x5cee0c[_0xf483('0x23')],'id');return _0x5cee0c[_0xf483('0x4d')](_0x599c1d)[_0xf483('0xc')](function(){for(var _0x2943fe=0x0;_0x2943fe<_0x599c1d['length'];_0x2943fe+=0x1){_0x25f833[_0xf483('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x599c1d[_0x2943fe]),'UserId':Number(_0x5cee0c['id'])});}});}})[_0xf483('0xc')](function(){if(_0x2e3ae2==='leave'){var _0x497aa0=_['map'](_0x5cee0c[_0xf483('0x24')],'id');return _0x5cee0c[_0xf483('0x4f')](_0x497aa0)['then'](function(){for(var _0x53aef2=0x0;_0x53aef2<_0x497aa0[_0xf483('0x1c')];_0x53aef2+=0x1){_0x25f833[_0xf483('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x497aa0[_0x53aef2]),'UserId':Number(_0x5cee0c['id'])});}});}})[_0xf483('0xc')](function(){if(_0x2e3ae2===_0xf483('0x4c')){var _0x15480d=_['map'](_0x5cee0c[_0xf483('0x26')],'id');return _0x5cee0c[_0xf483('0x50')](_0x15480d)[_0xf483('0xc')](function(){for(var _0x5a9ef2=0x0;_0x5a9ef2<_0x15480d[_0xf483('0x1c')];_0x5a9ef2+=0x1){_0x25f833[_0xf483('0x4e')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x15480d[_0x5a9ef2]),'UserId':Number(_0x5cee0c['id'])});}});}})['then'](function(){if(_0x2e3ae2===_0xf483('0x4c')){var _0x56511b=_[_0xf483('0x16')](_0x5cee0c[_0xf483('0x27')],'id');return _0x5cee0c[_0xf483('0x51')](_0x56511b)['then'](function(){for(var _0x1265eb=0x0;_0x1265eb<_0x56511b[_0xf483('0x1c')];_0x1265eb+=0x1){_0x25f833[_0xf483('0x4e')](_0xf483('0x52'),{'SmsInteractionId':Number(_0x56511b[_0x1265eb]),'UserId':Number(_0x5cee0c['id'])});}});}})['then'](function(){if(_0x2e3ae2==='leave'){var _0x1bdea3=_[_0xf483('0x16')](_0x5cee0c[_0xf483('0x28')],'id');return _0x5cee0c['removeOpenchannelInteractions'](_0x1bdea3)[_0xf483('0xc')](function(){for(var _0x393560=0x0;_0x393560<_0x1bdea3['length'];_0x393560+=0x1){_0x25f833[_0xf483('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1bdea3[_0x393560]),'UserId':Number(_0x5cee0c['id'])});}});}})['then'](function(){if(_0x2e3ae2===_0xf483('0x4c')){var _0x3665b3=_[_0xf483('0x16')](_0x5cee0c[_0xf483('0x2a')],'id');return _0x5cee0c['removeWhatsappInteractions'](_0x3665b3)[_0xf483('0xc')](function(){for(var _0x32f439=0x0;_0x32f439<_0x3665b3[_0xf483('0x1c')];_0x32f439+=0x1){_0x25f833[_0xf483('0x4e')](_0xf483('0x53'),{'WhatsappInteractionId':Number(_0x3665b3[_0x32f439]),'UserId':Number(_0x5cee0c['id'])});}});}})['catch'](function(_0x25b45a){_0x194569[_0xf483('0x54')](_0x25b45a);});}}function onDisconnect(_0x1ed8c7,_0x5d62d6){joinOrLeave(_0x1ed8c7,'leave',_0x5d62d6);}function onConnect(_0xb198c4){joinOrLeave(_0xb198c4,'join');}exports[_0xf483('0x55')]=function(_0x4d0754){_0x4d0754['on']('connection',function(_0x1b5597){_0x1b5597[_0xf483('0x56')](0x0);_0x1b5597[_0xf483('0x57')]=_0x1b5597[_0xf483('0x58')]['connection']['remoteAddress']+':'+_0x1b5597[_0xf483('0x58')][_0xf483('0x59')]['remotePort'];_0x1b5597[_0xf483('0x5a')]=new Date();_0x1b5597['log']=function(_0x16b98f){console['log'](_0xf483('0x5b')+_0x1b5597[_0xf483('0x5c')][_0xf483('0x5')]+'['+_0x1b5597[_0xf483('0x57')]+']',_0x16b98f);};_0x1b5597['on'](_0xf483('0x5d'),function(){onDisconnect(_0x1b5597,_0x4d0754);_0x1b5597[_0xf483('0x54')](_0xf483('0x5e'));});onConnect(_0x1b5597);_0x1b5597[_0xf483('0x54')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d163080..e51e534 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 _0x730d=['motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','interface','format','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','event','offlineMessage','Sequelize','UserId','changed','closed','substatus','AfterUpdate','internal','default','hasOwnProperty','model','hook','callback','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0x730d,0x1be));var _0xd730=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x730d[_0x40bffc];return _0x3007e9;};'use strict';var util=require(_0xd730('0x0'));var db=require(_0xd730('0x1'))['db'];var jayson=require(_0xd730('0x2'));var logger=require(_0xd730('0x3'))(_0xd730('0x4'));var client=jayson[_0xd730('0x5')][_0xd730('0x6')]({'port':0x232a});var triggers=[{'channel':_0xd730('0x7'),'model':_0xd730('0x8'),'event':_0xd730('0x9'),'condition':_0xd730('0xa'),'callback':afterCreate},{'channel':_0xd730('0x7'),'model':_0xd730('0x8'),'event':_0xd730('0xb'),'condition':_0xd730('0xc'),'callback':afterUpdate},{'channel':_0xd730('0x7'),'model':_0xd730('0xd'),'event':_0xd730('0x9'),'condition':_0xd730('0xe'),'callback':afterCreateMessage},{'channel':_0xd730('0x7'),'model':_0xd730('0xf'),'event':'afterCreate','condition':_0xd730('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0xd730('0x10'),'model':_0xd730('0x11'),'event':_0xd730('0x9'),'condition':_0xd730('0xa'),'callback':afterCreate},{'channel':_0xd730('0x10'),'model':'SmsInteraction','event':_0xd730('0xb'),'condition':_0xd730('0xc'),'callback':afterUpdate},{'channel':'Sms','model':_0xd730('0x12'),'event':_0xd730('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd730('0x13'),'model':_0xd730('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xd730('0x13'),'model':_0xd730('0x14'),'event':_0xd730('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0xd730('0x9'),'condition':_0xd730('0xe'),'callback':afterCreateMessage},{'channel':_0xd730('0x15'),'model':_0xd730('0x16'),'event':'afterCreate','condition':_0xd730('0xa'),'callback':afterCreate},{'channel':_0xd730('0x15'),'model':_0xd730('0x16'),'event':'afterUpdate','condition':_0xd730('0xc'),'callback':afterUpdate},{'channel':_0xd730('0x15'),'model':_0xd730('0x17'),'event':_0xd730('0x9'),'condition':_0xd730('0xe'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xd730('0x18'),'event':_0xd730('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd730('0x19'),'model':_0xd730('0x18'),'event':_0xd730('0xb'),'condition':_0xd730('0xc'),'callback':afterUpdate},{'channel':_0xd730('0x19'),'model':'MailMessage','event':_0xd730('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd730('0x1a'),'model':_0xd730('0x1b'),'event':'afterCreate','condition':_0xd730('0xa'),'callback':afterCreate},{'channel':_0xd730('0x1a'),'model':_0xd730('0x1b'),'event':'afterUpdate','condition':_0xd730('0xc'),'callback':afterUpdate},{'channel':_0xd730('0x1a'),'model':'OpenchannelMessage','event':_0xd730('0x9'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x31a6c0){return client['request'](_0xd730('0x1c'),_0x31a6c0)[_0xd730('0x1d')](function(_0x417928){logger[_0xd730('0x1e')](_0xd730('0x1f'),_0xd730('0x1c'),_0x417928);if(_0x417928[_0xd730('0x20')]){if(_0x417928[_0xd730('0x20')][_0xd730('0x21')]===0x1f4){logger[_0xd730('0x20')]('Trigger,\x20%s',_0xd730('0x1c'),_0x417928[_0xd730('0x20')]);}}})[_0xd730('0x22')](function(_0x5b8392){logger['error'](_0xd730('0x1f'),_0xd730('0x1c'),_0x5b8392);});}function afterCreateMessage(_0x5240c4){return function(_0x3b034e){_0x3b034e=_0x3b034e[_0xd730('0x23')]({'plain':!![]});_0x3b034e[_0xd730('0x24')]=_0x5240c4;_0x3b034e[_0xd730('0x25')]=_0x5240c4;_0x3b034e['event']=_0x3b034e[_0xd730('0x26')];Promise[_0xd730('0x27')]()['then'](function(){if(typeof _0x3b034e[_0xd730('0x28')]===_0xd730('0x29'))return null;var _0x24dfd8=_0xd730('0x2a')+_0x3b034e[_0xd730('0x28')];return db[_0xd730('0x2b')][_0xd730('0x2c')](_0x24dfd8,{'type':db['Sequelize'][_0xd730('0x2d')][_0xd730('0x2e')],'raw':!![]});})[_0xd730('0x1d')](function(_0x485e73){if(_0x485e73){_0x3b034e[_0xd730('0x2f')]=_0x485e73[0x0];}if(typeof _0x3b034e['UserId']===_0xd730('0x29'))return;return getAgent(_0x3b034e['UserId']);})[_0xd730('0x1d')](function(_0x5b45c8){if(_0x5b45c8){_0x3b034e[_0xd730('0x30')]=util[_0xd730('0x31')](_0xd730('0x32'),_0x5b45c8[_0xd730('0x33')]);_0x3b034e[_0xd730('0x34')]=_0x5b45c8;_0x3b034e[_0xd730('0x24')]=_0x5240c4;return request({'event':_0xd730('0x35'),'message':_0x3b034e});}else{return request({'event':'outgoingmessage','message':_0x3b034e});}})[_0xd730('0x22')](function(_0x16b0d3){logger[_0xd730('0x20')](_0xd730('0x1f'),_0xd730('0x36'),_0x16b0d3);});};}function afterCreateOfflineMessage(_0x47477e){return function(_0x24809a){_0x24809a=_0x24809a[_0xd730('0x23')]({'plain':!![]});_0x24809a[_0xd730('0x24')]=_0x47477e;_0x24809a['motionChannel']=_0x47477e;_0x24809a[_0xd730('0x37')]=_0xd730('0x38');return request({'event':_0x24809a['event'],'message':_0x24809a});};}function afterCreate(_0x59a373,_0x27a30f){return function(_0xd1cdf2){_0xd1cdf2=_0xd1cdf2[_0xd730('0x23')]({'plain':!![]});_0xd1cdf2['channel']=_0x59a373;_0xd1cdf2['motionChannel']=_0x59a373;_0xd1cdf2[_0xd730('0x37')]='opened';Promise[_0xd730('0x27')]()['then'](function(){var _0x25724c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd1cdf2[_0xd730('0x28')];return db[_0xd730('0x2b')][_0xd730('0x2c')](_0x25724c,{'type':db[_0xd730('0x39')][_0xd730('0x2d')][_0xd730('0x2e')],'raw':!![]});})[_0xd730('0x1d')](function(_0x3bf317){if(_0x3bf317){_0xd1cdf2[_0xd730('0x2f')]=_0x3bf317[0x0];}if(typeof _0xd1cdf2[_0xd730('0x3a')]===_0xd730('0x29'))return;return getAgent(_0xd1cdf2['UserId']);})['then'](function(_0x243c6d){if(_0x243c6d){_0xd1cdf2[_0xd730('0x30')]=util[_0xd730('0x31')](_0xd730('0x32'),_0x243c6d[_0xd730('0x33')]);_0xd1cdf2[_0xd730('0x34')]=_0x243c6d;}return request({'event':_0x27a30f,'message':_0xd1cdf2});})[_0xd730('0x22')](function(_0x173007){logger[_0xd730('0x20')](_0xd730('0x1f'),'AfterCreate',_0x173007);});};}function afterUpdate(_0x523917){return function(_0x30a177){var _0x382476=_0x30a177[_0xd730('0x3b')]('closed')&&_0x30a177[_0xd730('0x3c')];var _0x573a3a=_0x30a177['changed'](_0xd730('0x3d'));if(_0x382476||_0x573a3a){var _0x8560a2=_0x382476?_0xd730('0xc'):'substatus';var _0x1d627c=_0x30a177[_0xd730('0x23')]({'plain':!![]});_0x1d627c[_0xd730('0x24')]=_0x523917;_0x1d627c[_0xd730('0x25')]=_0x523917;_0x1d627c[_0xd730('0x37')]=_0x382476?_0xd730('0x3c'):_0xd730('0x3d');var _0x115e8e=_0xd730('0x2a')+_0x1d627c[_0xd730('0x28')];return db[_0xd730('0x2b')][_0xd730('0x2c')](_0x115e8e,{'type':db[_0xd730('0x39')][_0xd730('0x2d')][_0xd730('0x2e')],'raw':!![]})[_0xd730('0x1d')](function(_0x123a7c){if(_0x123a7c){_0x1d627c[_0xd730('0x2f')]=_0x123a7c[0x0];}if(typeof _0x1d627c[_0xd730('0x3a')]===_0xd730('0x29'))return;return getAgent(_0x1d627c['UserId']);})['then'](function(_0x26382c){if(_0x26382c){_0x1d627c['interface']=util[_0xd730('0x31')](_0xd730('0x32'),_0x26382c['name']);_0x1d627c['agent']=_0x26382c;}return request({'event':_0x8560a2,'message':_0x1d627c});})[_0xd730('0x22')](function(_0x1d026a){logger['error'](_0xd730('0x1f'),_0xd730('0x3e'),_0x1d026a);});}};}function getAgent(_0x158341){return db['User']['find']({'where':{'id':_0x158341},'attributes':['id',_0xd730('0x33'),'fullname','email',_0xd730('0x3f')],'raw':!![]})[_0xd730('0x1d')](function(_0x163150){return _0x163150;});}exports[_0xd730('0x40')]=function(){for(var _0xcda2dd=0x0;_0xcda2dd=_0x4af0e0[_0xd63f('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x17fd43(_0x3e16e5);})[_0xd63f('0x13')](function(_0x2c635d){_0x2a6e5a(_0x2c635d);});});}; \ No newline at end of file +var _0xca62=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','blockedAt','updateAttributes','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','./license/util','voice'];(function(_0x272fd1,_0x481b56){var _0xac0fec=function(_0x10bb7a){while(--_0x10bb7a){_0x272fd1['push'](_0x272fd1['shift']());}};_0xac0fec(++_0x481b56);}(_0xca62,0x87));var _0x2ca6=function(_0x52dbeb,_0x5b6e20){_0x52dbeb=_0x52dbeb-0x0;var _0xc8f834=_0xca62[_0x52dbeb];return _0xc8f834;};'use strict';var _=require('lodash');var BPromise=require(_0x2ca6('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x2ca6('0x1'));var channels=[_0x2ca6('0x2'),'mail',_0x2ca6('0x3'),_0x2ca6('0x4'),_0x2ca6('0x5'),_0x2ca6('0x6'),_0x2ca6('0x7')];exports[_0x2ca6('0x8')]=function(){return channels;};exports[_0x2ca6('0x9')]=function(_0x2b613d){_0x2b613d=_0x2b613d[_0x2ca6('0xa')]();return _[_0x2ca6('0xb')](channels,_0x2b613d);};exports['clearBlockUser']=function(_0x45611a,_0xadac67,_0x1ce61f,_0x23e9f3){var _0x3b8cc0={'loginAttempts':_0xadac67,'blocked':_0x1ce61f};if(!_['isUndefined'](_0x23e9f3)){_0x3b8cc0[_0x2ca6('0xc')]=_0x23e9f3;}return _0x45611a[_0x2ca6('0xd')](_0x3b8cc0);};exports[_0x2ca6('0xe')]=function(_0x1507e8){return new BPromise(function(_0x451608,_0x56a763){var _0x40e3c9=0x0;if(_0x1507e8[_0x2ca6('0xf')]!=='agent'){_0x451608(_0x1507e8);}db[_0x2ca6('0x10')][_0x2ca6('0x11')]({'where':{'role':_0x2ca6('0x12'),'online':!![],'id':{'$ne':_0x1507e8['id']}}})['then'](function(_0x1948ec){_0x40e3c9=_0x1948ec;return util[_0x2ca6('0xe')]();})[_0x2ca6('0x13')](function(_0x230c37){if(_0x230c37&&_0x230c37[_0x2ca6('0x14')]&&_0x40e3c9>=_0x230c37[_0x2ca6('0x14')]){throw Error(_0x2ca6('0x15'));}_0x451608(_0x1507e8);})[_0x2ca6('0x16')](function(_0x4202d1){_0x56a763(_0x4202d1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e211ed9..a9f0c72 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['Error','Bad\x20Request','Entity\x20not\x20found','inherits','Forbidden','OutOfInterval','Not\x20Found','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x33bfc0,_0x384df6){var _0x2f4add=function(_0x27e7c6){while(--_0x27e7c6){_0x33bfc0['push'](_0x33bfc0['shift']());}};_0x2f4add(++_0x384df6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x264b79,_0xc62859){_0x264b79=_0x264b79-0x0;var _0x548c85=_0xbdb7[_0x264b79];return _0x548c85;};'use strict';var util=require(_0x7bdb('0x0'));var logger=require(_0x7bdb('0x1'))(_0x7bdb('0x2'));var APIError=function(_0x2a2c1c,_0x23c326){this[_0x7bdb('0x3')]=_0x2a2c1c||_0x7bdb('0x4');this[_0x7bdb('0x5')]=_0x23c326||_0x7bdb('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x28542c){this['message']=_0x28542c||'Bad\x20Request';this[_0x7bdb('0x5')]=_0x7bdb('0x7');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x513cba){this[_0x7bdb('0x3')]=_0x513cba||_0x7bdb('0x8');this['name']='Not\x20Found';util[_0x7bdb('0x9')](APINotFoundError,APIError);};function getStatusCode(_0x1a6b61){switch(_0x1a6b61){case _0x7bdb('0x7'):return 0x190;case _0x7bdb('0xa'),_0x7bdb('0xb'):return 0x193;case _0x7bdb('0xc'):return 0x194;default:return 0x1f4;}}function handleError(_0x297724){return function(_0x258cc6){logger['error'](_0x258cc6['stack']);var _0x52b9b9=getStatusCode(_0x258cc6[_0x7bdb('0x5')]);if(_0x258cc6[_0x7bdb('0x5')])delete _0x258cc6['name'];return _0x297724[_0x7bdb('0xd')](_0x52b9b9)['send'](_0x258cc6);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4cb4c3,_0xbaf548){_0x4cb4c3=_0x4cb4c3-0x0;var _0x28634c=_0xf4eb[_0x4cb4c3];return _0x28634c;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 74ed473..4d8476d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e5d=['404','render','status','json','exports'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0x6e5d,0x9a));var _0xd6e5=function(_0x734235,_0x43477a){_0x734235=_0x734235-0x0;var _0x3b5e64=_0x6e5d[_0x734235];return _0x3b5e64;};'use strict';module[_0xd6e5('0x0')][0x194]=function pageNotFound(_0x3a6b45,_0x5c24ee){var _0x50b8ad=_0xd6e5('0x1');var _0x95db89=0x194;var _0x7d333={'status':_0x95db89};_0x5c24ee['status'](_0x7d333['status']);_0x5c24ee[_0xd6e5('0x2')](_0x50b8ad,{},function(_0x2ea309,_0x23a2af){if(_0x2ea309){return _0x5c24ee[_0xd6e5('0x3')](_0x7d333[_0xd6e5('0x3')])[_0xd6e5('0x4')](_0x7d333);}_0x5c24ee['send'](_0x23a2af);});}; \ No newline at end of file +var _0x2f0c=['render','json','exports','404','status'];(function(_0x3cb465,_0x36d920){var _0x4e197b=function(_0x25fd7d){while(--_0x25fd7d){_0x3cb465['push'](_0x3cb465['shift']());}};_0x4e197b(++_0x36d920);}(_0x2f0c,0xe8));var _0xc2f0=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x2f0c[_0x4f9b18];return _0x29f20c;};'use strict';module[_0xc2f0('0x0')][0x194]=function pageNotFound(_0x3d4b54,_0x5532ff){var _0x9ed172=_0xc2f0('0x1');var _0xc33776=0x194;var _0x11e2d3={'status':_0xc33776};_0x5532ff[_0xc2f0('0x2')](_0x11e2d3[_0xc2f0('0x2')]);_0x5532ff[_0xc2f0('0x3')](_0x9ed172,{},function(_0x17dd18,_0x449133){if(_0x17dd18){return _0x5532ff[_0xc2f0('0x2')](_0x11e2d3[_0xc2f0('0x2')])[_0xc2f0('0x4')](_0x11e2d3);}_0x5532ff['send'](_0x449133);});}; \ No newline at end of file diff --git a/server/migrations/2.6.12.js b/server/migrations/2.6.12.js new file mode 100644 index 0000000..3530b8a --- /dev/null +++ b/server/migrations/2.6.12.js @@ -0,0 +1,169 @@ +'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(); + }); +}; + +module.exports = { + up: function(queryInterface /* , Sequelize */ ) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d71bf8e..adb8dd5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec26=['FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/tag/tag.model','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','User','UserSetting','userSetting','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Dispositions','Answers','Interactions','List','ListId','mandatoryDispositionPauseId','user_has_mail_accounts','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','MailInteractionId','Attachments','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','Items','FaxAccountId','fax_interaction_has_tags','FaxInteractionId','Interaction','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','AttachmentId','OpenchannelQueueId','Agent','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','ChatGroup','Members','CompanyId','CmContactHasItem','Phones','CmContactId','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','ParentId','MailApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','CmHopperId','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','Configurations','SugarcrmAccount','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_mail_queues','team_has_sms_queues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','WhatsappAccountId','WhatsappApplication','Applications','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','username','password','options','database','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model'];(function(_0x26601e,_0x139a4c){var _0x116282=function(_0x292edb){while(--_0x292edb){_0x26601e['push'](_0x26601e['shift']());}};_0x116282(++_0x139a4c);}(_0xec26,0x1ae));var _0x6ec2=function(_0x182222,_0x5f25f4){_0x182222=_0x182222-0x0;var _0x103c1b=_0xec26[_0x182222];return _0x103c1b;};'use strict';var config=require(_0x6ec2('0x0'));var Sequelize=require(_0x6ec2('0x1'));var _=require(_0x6ec2('0x2'));var jstz=require(_0x6ec2('0x3'));var timezone=jstz[_0x6ec2('0x4')]();config[_0x6ec2('0x1')]=_[_0x6ec2('0x5')](config[_0x6ec2('0x1')],{'database':_0x6ec2('0x6'),'username':_0x6ec2('0x7'),'password':_0x6ec2('0x8'),'options':{'host':_0x6ec2('0x9'),'port':0xcea,'dialect':_0x6ec2('0xa'),'dialectOptions':{'charset':_0x6ec2('0xb')},'logging':![],'timezone':timezone[_0x6ec2('0xc')](),'define':{'charset':_0x6ec2('0xd'),'collate':'utf8_general_ci'}}});config[_0x6ec2('0xe')]=_['defaultsDeep'](config[_0x6ec2('0xe')],{'database':'motion2','username':'xcall','password':_0x6ec2('0x8'),'options':{'host':_0x6ec2('0x9'),'port':0xcea,'dialect':_0x6ec2('0xa'),'dialectOptions':{'charset':_0x6ec2('0xb')},'logging':![],'timezone':timezone[_0x6ec2('0xc')](),'define':{'charset':_0x6ec2('0xd'),'collate':_0x6ec2('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6ec2('0x1')]['database'],config['sequelize'][_0x6ec2('0x10')],config[_0x6ec2('0x1')][_0x6ec2('0x11')],config[_0x6ec2('0x1')][_0x6ec2('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6ec2('0x13')],config[_0x6ec2('0xe')][_0x6ec2('0x10')],config[_0x6ec2('0xe')][_0x6ec2('0x11')],config[_0x6ec2('0xe')]['options'])};db['User']=db['sequelize']['import'](_0x6ec2('0x14'));db[_0x6ec2('0x15')]=db['sequelize']['import'](_0x6ec2('0x16'));db[_0x6ec2('0x17')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x19'));db[_0x6ec2('0x1a')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/voiceExtension/voiceExtension.model');db[_0x6ec2('0x1b')]=db[_0x6ec2('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6ec2('0x1c')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/voiceQueue/voiceQueue.model');db[_0x6ec2('0x1d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/voiceRecording/voiceRecording.model');db[_0x6ec2('0x1e')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x1f'));db[_0x6ec2('0x20')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x21'));db[_0x6ec2('0x22')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x6ec2('0x23')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x24'));db[_0x6ec2('0x25')]=db['sequelize'][_0x6ec2('0x18')]('../api/voiceDialReport/voiceDialReport.model');db[_0x6ec2('0x26')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x27'));db[_0x6ec2('0x28')]=db['sequelize']['import'](_0x6ec2('0x29'));db[_0x6ec2('0x2a')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x2b'));db[_0x6ec2('0x2c')]=db['sequelize'][_0x6ec2('0x18')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6ec2('0x2d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x2e'));db[_0x6ec2('0x2f')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x30'));db[_0x6ec2('0x31')]=db['sequelize'][_0x6ec2('0x18')]('../api/userChatQueue/userChatQueue.model');db[_0x6ec2('0x32')]=db['sequelize']['import'](_0x6ec2('0x33'));db['UserFaxQueue']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x34'));db[_0x6ec2('0x35')]=db['sequelize'][_0x6ec2('0x18')]('../api/userSmsQueue/userSmsQueue.model');db[_0x6ec2('0x36')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6ec2('0x37')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x38'));db[_0x6ec2('0x39')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x3a'));db[_0x6ec2('0x3b')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x3c'));db['MailAccount']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x3d'));db[_0x6ec2('0x3e')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x3f'));db[_0x6ec2('0x40')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/mailSubstatus/mailSubstatus.model');db[_0x6ec2('0x41')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x42'));db[_0x6ec2('0x43')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/mailMessage/mailMessage.model');db[_0x6ec2('0x44')]=db['sequelize']['import'](_0x6ec2('0x45'));db['MailQueueReport']=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x46'));db[_0x6ec2('0x47')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x48'));db[_0x6ec2('0x49')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x4a'));db[_0x6ec2('0x4b')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/faxAccount/faxAccount.model');db[_0x6ec2('0x4c')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x4d'));db['FaxInteraction']=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x4e'));db[_0x6ec2('0x4f')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x50'));db[_0x6ec2('0x51')]=db['sequelize'][_0x6ec2('0x18')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x52'));db[_0x6ec2('0x53')]=db['sequelize']['import'](_0x6ec2('0x54'));db['SmsApplication']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x55'));db['SmsInteraction']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x56'));db[_0x6ec2('0x57')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x58'));db[_0x6ec2('0x59')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x5a'));db[_0x6ec2('0x5b')]=db['sequelize']['import'](_0x6ec2('0x5c'));db[_0x6ec2('0x5d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x5e'));db[_0x6ec2('0x5f')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x60'));db['OpenchannelMessage']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x61'));db[_0x6ec2('0x62')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x63'));db[_0x6ec2('0x64')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x65'));db[_0x6ec2('0x66')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x6ec2('0x67')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/chatApplication/chatApplication.model');db[_0x6ec2('0x68')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x69'));db[_0x6ec2('0x6a')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x6b'));db[_0x6ec2('0x6c')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x6ec2('0x6d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x6e'));db['ChatGroup']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x6f'));db[_0x6ec2('0x70')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6ec2('0x71')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x72'));db[_0x6ec2('0x73')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x74'));db[_0x6ec2('0x75')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x76'));db['CmHopperBlack']=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6ec2('0x77')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x78'));db[_0x6ec2('0x79')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x7a'));db[_0x6ec2('0x7b')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x7c'));db[_0x6ec2('0x7d')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x7e'));db[_0x6ec2('0x7f')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x80'));db[_0x6ec2('0x81')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x82'));db[_0x6ec2('0x83')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x84'));db[_0x6ec2('0x85')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x86'));db[_0x6ec2('0x87')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/condition/condition.model');db['Interval']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x88'));db[_0x6ec2('0x89')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x8a'));db[_0x6ec2('0x8b')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x8c'));db[_0x6ec2('0x8d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x8e'));db['Schedule']=db['sequelize']['import'](_0x6ec2('0x8f'));db[_0x6ec2('0x90')]=db['sequelize'][_0x6ec2('0x18')]('../api/sound/sound.model');db['Tag']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x91'));db[_0x6ec2('0x92')]=db[_0x6ec2('0x1')]['import']('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x93'));db[_0x6ec2('0x94')]=db['sequelize']['import'](_0x6ec2('0x95'));db[_0x6ec2('0x96')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x97'));db[_0x6ec2('0x98')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0x99'));db[_0x6ec2('0x9a')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x9b'));db['Integration']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x9c'));db[_0x6ec2('0x9d')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x9e'));db[_0x6ec2('0x9f')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6ec2('0xa0')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xa1'));db[_0x6ec2('0xa2')]=db['sequelize'][_0x6ec2('0x18')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xa3'));db[_0x6ec2('0xa4')]=db['sequelize']['import'](_0x6ec2('0xa5'));db[_0x6ec2('0xa6')]=db['sequelize'][_0x6ec2('0x18')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6ec2('0xa7')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6ec2('0xa8')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xa9'));db['SugarcrmAccount']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xaa'));db[_0x6ec2('0xab')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6ec2('0xac')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xad'));db[_0x6ec2('0xae')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xaf'));db[_0x6ec2('0xb0')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xb1'));db[_0x6ec2('0xb2')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xb3'));db[_0x6ec2('0xb4')]=db[_0x6ec2('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x6ec2('0xb5')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xb6'));db['ZendeskAccount']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xb7'));db[_0x6ec2('0xb8')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xb9'));db['ZendeskField']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xba'));db['FreshdeskAccount']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xbb'));db[_0x6ec2('0xbc')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xbd'));db[_0x6ec2('0xbe')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xbf'));db[_0x6ec2('0xc0')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x6ec2('0xc1')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xc2'));db[_0x6ec2('0xc3')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intVtigerField/intVtigerField.model');db[_0x6ec2('0xc4')]=db['sequelize'][_0x6ec2('0x18')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x6ec2('0xc5')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xc6'));db[_0x6ec2('0xc7')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intServicenowField/intServicenowField.model');db[_0x6ec2('0xc8')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xc9'));db[_0x6ec2('0xca')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xcb'));db[_0x6ec2('0xcc')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xcd'));db[_0x6ec2('0xce')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xcf'));db[_0x6ec2('0xd0')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x6ec2('0xd1')]=db['sequelize'][_0x6ec2('0x18')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x6ec2('0x1')]['import']('../api/integration/integration.model');db['Network']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xd2'));db[_0x6ec2('0xd3')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xd4'));db[_0x6ec2('0xd5')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xd6'));db['JscriptyAnswerReport']=db[_0x6ec2('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xd7'));db[_0x6ec2('0xd8')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xd9'));db[_0x6ec2('0xda')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xdb'));db['SquareReport']=db[_0x6ec2('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x6ec2('0xdc')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xdd'));db[_0x6ec2('0xde')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xdf'));db[_0x6ec2('0xe0')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xe1'));db['SquareOdbc']=db['sequelize']['import']('../api/squareOdbc/squareOdbc.model');db[_0x6ec2('0xe2')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xe3'));db[_0x6ec2('0xe4')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xe5'));db[_0x6ec2('0xe6')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xe7'));db[_0x6ec2('0xe8')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xe9'));db[_0x6ec2('0xea')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xeb'));db[_0x6ec2('0xec')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/campaign/campaign.model');db[_0x6ec2('0xed')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xee'));db[_0x6ec2('0xef')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xf0'));db['Plugin']=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xf1'));db[_0x6ec2('0xf2')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xf3'));db[_0x6ec2('0xf4')]=db['sequelize'][_0x6ec2('0x18')](_0x6ec2('0xf5'));db[_0x6ec2('0xf6')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xf7'));db['OpenchannelTransferReport']=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x6ec2('0xf8')]=db['sequelize']['import'](_0x6ec2('0xf9'));db[_0x6ec2('0xfa')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0xfb'));db[_0x6ec2('0xfc')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0xfd'));db['UserProfile']=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/userProfile/userProfile.model');db[_0x6ec2('0xfe')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/userProfileSection/userProfileSection.model');db[_0x6ec2('0xff')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x100'));db[_0x6ec2('0x101')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x102'));db[_0x6ec2('0x103')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x104'));db['WhatsappApplication']=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x105'));db[_0x6ec2('0x106')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x107'));db[_0x6ec2('0x108')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x109'));db[_0x6ec2('0x10a')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x6ec2('0x10b')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x10c'));db[_0x6ec2('0x10d')]=db['sequelize'][_0x6ec2('0x18')]('../api/cloudProvider/cloudProvider.model');db[_0x6ec2('0x10e')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x10f'));db[_0x6ec2('0x110')]=db[_0x6ec2('0x1')][_0x6ec2('0x18')](_0x6ec2('0x111'));db[_0x6ec2('0x112')]=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x113'));db['UserSetting']=db[_0x6ec2('0x1')]['import'](_0x6ec2('0x114'));db['User'][_0x6ec2('0x115')](db['VoiceMail'],{'as':_0x6ec2('0x20'),'onDelete':_0x6ec2('0x116'),'foreignKey':'UserId'});db[_0x6ec2('0x117')][_0x6ec2('0x115')](db[_0x6ec2('0x118')],{'as':_0x6ec2('0x119'),'onDelete':'cascade','foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')]['hasMany'](db[_0x6ec2('0x1d')],{'as':_0x6ec2('0x11b'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x2d')],{'as':_0x6ec2('0x11d'),'foreignKey':_0x6ec2('0x11a')});db['User'][_0x6ec2('0x11c')](db[_0x6ec2('0x1a')],{'as':_0x6ec2('0x11e'),'onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x77')],{'as':_0x6ec2('0x11f'),'foreignKey':'UserId'});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x79')],{'as':_0x6ec2('0x120'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x7b')],{'as':_0x6ec2('0x7b'),'foreignKey':'UserId'});db[_0x6ec2('0x117')]['hasMany'](db[_0x6ec2('0x5f')],{'as':'OpenchannelInteractions','foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x68')],{'as':_0x6ec2('0x121'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x122')],{'as':_0x6ec2('0x123'),'foreignKey':'UserId'});db[_0x6ec2('0x117')]['hasMany'](db[_0x6ec2('0x124')],{'as':'FaxInteractions','foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x41')],{'as':_0x6ec2('0x125'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x117')][_0x6ec2('0x11c')](db[_0x6ec2('0x126')],{'as':_0x6ec2('0x127'),'foreignKey':_0x6ec2('0x11a')});db['User'][_0x6ec2('0x11c')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x6ec2('0x128')});db[_0x6ec2('0x117')][_0x6ec2('0x129')](db[_0x6ec2('0x12a')],{'as':_0x6ec2('0x12a'),'foreignKey':_0x6ec2('0x12b')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db['ChatGroup'],{'as':'Groups','through':_0x6ec2('0x12d')});db['User'][_0x6ec2('0x12c')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x12e'),'through':'cm_user_has_contacts'});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x12f'),'through':_0x6ec2('0x130')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0xe8')],{'through':'user_has_teams'});db['User'][_0x6ec2('0x12c')](db[_0x6ec2('0x41')],{'as':_0x6ec2('0x125'),'through':_0x6ec2('0x131')});db[_0x6ec2('0x117')]['belongsToMany'](db['ChatInteraction'],{'as':_0x6ec2('0x121'),'through':_0x6ec2('0x132')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x124')],{'as':_0x6ec2('0x133'),'through':_0x6ec2('0x134')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x122')],{'as':'SmsInteractions','through':_0x6ec2('0x135')});db['User'][_0x6ec2('0x12c')](db['OpenchannelInteraction'],{'as':_0x6ec2('0x136'),'through':_0x6ec2('0x137')});db['User'][_0x6ec2('0x12c')](db[_0x6ec2('0x126')],{'as':_0x6ec2('0x127'),'through':_0x6ec2('0x138')});db['User']['belongsToMany'](db[_0x6ec2('0x1c')],{'as':_0x6ec2('0x139'),'through':_0x6ec2('0x2f'),'required':![]});db['User'][_0x6ec2('0x12c')](db[_0x6ec2('0xfc')],{'as':'VoicePrefixes','through':_0x6ec2('0x112'),'required':![]});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db['MailQueue'],{'as':_0x6ec2('0x13a'),'through':'UserMailQueue','required':![]});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x6d')],{'as':_0x6ec2('0x13b'),'through':_0x6ec2('0x31'),'required':![],'hooks':!![]});db['User'][_0x6ec2('0x12c')](db[_0x6ec2('0x51')],{'as':_0x6ec2('0x13c'),'through':_0x6ec2('0x13d'),'required':![]});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db['SmsQueue'],{'as':'SmsQueues','through':_0x6ec2('0x35'),'required':![]});db[_0x6ec2('0x117')]['belongsToMany'](db[_0x6ec2('0x62')],{'as':_0x6ec2('0x13e'),'through':'UserOpenchannelQueue','required':![]});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x10b')],{'as':_0x6ec2('0x13f'),'through':_0x6ec2('0x37'),'required':![]});db['User'][_0x6ec2('0x12c')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x64')],{'as':_0x6ec2('0x140'),'through':_0x6ec2('0x141')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x4b')],{'as':'FaxAccounts','through':_0x6ec2('0x142')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x143')],{'as':_0x6ec2('0x144'),'through':'user_has_mail_accounts'});db[_0x6ec2('0x117')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x6ec2('0x145'),'through':'user_has_openchannel_accounts'});db[_0x6ec2('0x117')]['belongsToMany'](db['SmsAccount'],{'as':_0x6ec2('0x146'),'through':_0x6ec2('0x147')});db[_0x6ec2('0x117')][_0x6ec2('0x12c')](db[_0x6ec2('0x103')],{'as':_0x6ec2('0x148'),'through':_0x6ec2('0x149')});db[_0x6ec2('0x15')][_0x6ec2('0x11c')](db[_0x6ec2('0x1a')],{'as':'SpiedAgents','onDelete':_0x6ec2('0x116'),'foreignKey':'ChanSpyId'});db[_0x6ec2('0x17')][_0x6ec2('0x11c')](db[_0x6ec2('0x1a')],{'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x1a')][_0x6ec2('0x11c')](db[_0x6ec2('0x1a')],{'as':'Applications','onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x1b')][_0x6ec2('0x12c')](db[_0x6ec2('0x90')],{'as':_0x6ec2('0x14a'),'through':_0x6ec2('0x14b')});db[_0x6ec2('0x1c')]['hasMany'](db[_0x6ec2('0x2d')],{'as':'Members','foreignKey':_0x6ec2('0x14c')});db[_0x6ec2('0x1c')][_0x6ec2('0x11c')](db[_0x6ec2('0x75')],{'as':_0x6ec2('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x6ec2('0x1c')][_0x6ec2('0x11c')](db[_0x6ec2('0x77')],{'as':_0x6ec2('0x11f'),'foreignKey':_0x6ec2('0x14c')});db[_0x6ec2('0x1c')]['hasMany'](db[_0x6ec2('0x79')],{'as':_0x6ec2('0x14e'),'foreignKey':_0x6ec2('0x14c')});db['VoiceQueue'][_0x6ec2('0x11c')](db[_0x6ec2('0x7b')],{'as':_0x6ec2('0x7b'),'foreignKey':_0x6ec2('0x14c')});db['VoiceQueue'][_0x6ec2('0x11c')](db[_0x6ec2('0x14f')],{'as':_0x6ec2('0x150'),'foreignKey':'VoiceQueueId'});db[_0x6ec2('0x1c')][_0x6ec2('0x11c')](db[_0x6ec2('0xd8')],{'as':_0x6ec2('0x151'),'foreignKey':_0x6ec2('0x14c')});db[_0x6ec2('0x1c')][_0x6ec2('0x129')](db['Trunk'],{'as':_0x6ec2('0x152'),'foreignKey':_0x6ec2('0x153')});db[_0x6ec2('0x1c')][_0x6ec2('0x129')](db['Trunk'],{'as':_0x6ec2('0x154'),'foreignKey':_0x6ec2('0x155')});db[_0x6ec2('0x1c')][_0x6ec2('0x129')](db[_0x6ec2('0x156')],{'as':_0x6ec2('0x156'),'foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0x1c')][_0x6ec2('0x129')](db[_0x6ec2('0x89')],{'as':_0x6ec2('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6ec2('0x1c')][_0x6ec2('0x12c')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x12f'),'through':_0x6ec2('0x159')});db[_0x6ec2('0x1c')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x2f')});db[_0x6ec2('0x1c')][_0x6ec2('0x12c')](db['Team'],{'as':_0x6ec2('0x15b'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x15c'),'through':_0x6ec2('0x15d')});db[_0x6ec2('0x1d')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x117'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x1e')][_0x6ec2('0x129')](db['User'],{'as':_0x6ec2('0x117'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x20')][_0x6ec2('0x11c')](db['VoiceMailMessage'],{'as':_0x6ec2('0x15e'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x15f'),'sourceKey':'mailbox'});db[_0x6ec2('0x22')][_0x6ec2('0x129')](db[_0x6ec2('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x6ec2('0x160')});db[_0x6ec2('0x23')]['hasMany'](db[_0x6ec2('0x28')],{'as':_0x6ec2('0x161'),'foreignKey':_0x6ec2('0x162'),'constraints':![]});db['VoiceCallReport'][_0x6ec2('0x11c')](db['VoiceAgentReport'],{'as':_0x6ec2('0x163'),'foreignKey':_0x6ec2('0x162'),'constraints':![]});db[_0x6ec2('0x23')][_0x6ec2('0x129')](db['User'],{'as':_0x6ec2('0x117'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x39')][_0x6ec2('0x129')](db['MailAccount'],{'as':_0x6ec2('0x143'),'foreignKey':'MailAccountId'});db[_0x6ec2('0x39')][_0x6ec2('0x129')](db[_0x6ec2('0x10d')],{'as':_0x6ec2('0x10d'),'foreignKey':_0x6ec2('0x166'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x3b')]['belongsTo'](db[_0x6ec2('0x143')],{'as':_0x6ec2('0x143'),'foreignKey':_0x6ec2('0x168')});db[_0x6ec2('0x3b')][_0x6ec2('0x129')](db[_0x6ec2('0x10d')],{'as':_0x6ec2('0x10d'),'foreignKey':_0x6ec2('0x166'),'onDelete':_0x6ec2('0x167')});db['MailAccount'][_0x6ec2('0x115')](db[_0x6ec2('0x39')],{'as':'Imap','onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x143')][_0x6ec2('0x115')](db[_0x6ec2('0x3b')],{'as':'Smtp','onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x143')][_0x6ec2('0x11c')](db[_0x6ec2('0x85')],{'as':_0x6ec2('0x169'),'foreignKey':_0x6ec2('0x168'),'onDelete':'cascade'});db['MailAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x83')],{'as':_0x6ec2('0x16a'),'foreignKey':_0x6ec2('0x168')});db[_0x6ec2('0x143')][_0x6ec2('0x11c')](db[_0x6ec2('0x43')],{'as':_0x6ec2('0x15e'),'foreignKey':_0x6ec2('0x168')});db[_0x6ec2('0x143')][_0x6ec2('0x11c')](db['MailInteraction'],{'as':_0x6ec2('0x16b')});db[_0x6ec2('0x143')]['hasMany'](db['MailApplication'],{'as':'Applications'});db[_0x6ec2('0x143')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x143')][_0x6ec2('0x129')](db[_0x6ec2('0x96')],{'as':_0x6ec2('0x96'),'foreignKey':'TemplateId'});db[_0x6ec2('0x143')][_0x6ec2('0x129')](db[_0x6ec2('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x6ec2('0x16e')});db[_0x6ec2('0x143')]['belongsToMany'](db[_0x6ec2('0x117')],{'as':'Agents','through':_0x6ec2('0x16f')});db['MailQueue'][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x32')});db['MailQueue'][_0x6ec2('0x12c')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6ec2('0x41')][_0x6ec2('0x11c')](db[_0x6ec2('0x43')],{'as':_0x6ec2('0x15e'),'onDelete':_0x6ec2('0x116'),'foreignKey':'MailInteractionId'});db[_0x6ec2('0x41')][_0x6ec2('0x129')](db[_0x6ec2('0x143')],{'as':'Account','foreignKey':_0x6ec2('0x168')});db[_0x6ec2('0x41')]['belongsTo'](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x41')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x41')][_0x6ec2('0x12c')](db['Tag'],{'through':_0x6ec2('0x171'),'as':_0x6ec2('0x172')});db['MailInteraction'][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':'mail_interaction_has_tags','as':_0x6ec2('0x174')});db[_0x6ec2('0x41')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'through':_0x6ec2('0x131'),'foreignKey':_0x6ec2('0x176')});db[_0x6ec2('0x43')]['hasMany'](db['Attachment'],{'as':_0x6ec2('0x177'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x43')]['belongsTo'](db[_0x6ec2('0x117')],{'as':'User'});db[_0x6ec2('0x43')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x164')});db[_0x6ec2('0x43')]['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x6ec2('0x176')});db['MailMessage'][_0x6ec2('0x129')](db[_0x6ec2('0x143')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x168')});db['MailMessage'][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{'as':_0x6ec2('0x64'),'foreignKey':_0x6ec2('0x179')});db[_0x6ec2('0x43')][_0x6ec2('0x129')](db[_0x6ec2('0x6c')],{'as':_0x6ec2('0x6c'),'foreignKey':_0x6ec2('0x17a')});db['MailApplication'][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x44')][_0x6ec2('0x129')](db['MailQueue'],{'onDelete':_0x6ec2('0x167')});db['MailApplication'][_0x6ec2('0x129')](db['MailAccount'],{'onDelete':'restrict'});db[_0x6ec2('0x44')][_0x6ec2('0x129')](db[_0x6ec2('0x156')],{'onDelete':'restrict','foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0x44')]['belongsTo'](db[_0x6ec2('0x173')],{'onDelete':'restrict','foreignKey':_0x6ec2('0x17b')});db[_0x6ec2('0x17c')]['belongsTo'](db[_0x6ec2('0x143')],{});db[_0x6ec2('0x17c')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':'ListId'});db[_0x6ec2('0x17c')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport'][_0x6ec2('0x129')](db[_0x6ec2('0x41')],{});db[_0x6ec2('0x17c')][_0x6ec2('0x129')](db[_0x6ec2('0x43')],{});db[_0x6ec2('0x17c')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{});db[_0x6ec2('0x17c')][_0x6ec2('0x129')](db['MailQueue'],{});db['Dashboard'][_0x6ec2('0x11c')](db[_0x6ec2('0x49')],{'as':_0x6ec2('0x17d'),'onDelete':'cascade'});db[_0x6ec2('0x4b')]['hasMany'](db['Disposition'],{'as':_0x6ec2('0x169'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db['FaxAccount'][_0x6ec2('0x11c')](db['CannedAnswer'],{'as':_0x6ec2('0x16a'),'foreignKey':_0x6ec2('0x17e')});db[_0x6ec2('0x4b')][_0x6ec2('0x11c')](db[_0x6ec2('0x124')],{'as':'Interactions'});db[_0x6ec2('0x4b')]['hasMany'](db['FaxApplication'],{'as':'Applications'});db[_0x6ec2('0x4b')]['hasMany'](db[_0x6ec2('0x1a')],{'as':'Exntensions','onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x4b')][_0x6ec2('0x11c')](db[_0x6ec2('0x4f')],{'as':_0x6ec2('0x15e')});db[_0x6ec2('0x4b')][_0x6ec2('0x129')](db[_0x6ec2('0x152')],{'as':_0x6ec2('0x152')});db[_0x6ec2('0x4b')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x4b')][_0x6ec2('0x129')](db['Pause'],{'as':_0x6ec2('0x158'),'foreignKey':_0x6ec2('0x16e')});db[_0x6ec2('0x4b')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':'Agents','through':_0x6ec2('0x142')});db['FaxApplication']['belongsTo'](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x4c')][_0x6ec2('0x129')](db['FaxQueue'],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x4c')]['belongsTo'](db[_0x6ec2('0x4b')],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x4c')]['belongsTo'](db[_0x6ec2('0x173')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x17b')});db[_0x6ec2('0x124')][_0x6ec2('0x11c')](db[_0x6ec2('0x4f')],{'as':_0x6ec2('0x15e'),'onDelete':_0x6ec2('0x116'),'foreignKey':'FaxInteractionId'});db[_0x6ec2('0x124')][_0x6ec2('0x129')](db[_0x6ec2('0x4b')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x17e')});db[_0x6ec2('0x124')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':'UserId'});db[_0x6ec2('0x124')][_0x6ec2('0x12c')](db['Tag'],{'through':_0x6ec2('0x17f'),'as':'Tags'});db[_0x6ec2('0x124')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x17f'),'as':_0x6ec2('0x174')});db['FaxInteraction'][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':'Users','through':_0x6ec2('0x134'),'foreignKey':_0x6ec2('0x180')});db[_0x6ec2('0x4f')]['belongsTo'](db['User'],{'onDelete':_0x6ec2('0x116'),'as':'User'});db[_0x6ec2('0x4f')][_0x6ec2('0x129')](db['FaxInteraction'],{'as':_0x6ec2('0x181'),'foreignKey':_0x6ec2('0x180')});db['FaxMessage']['belongsTo'](db[_0x6ec2('0x73')],{'onDelete':'cascade','as':_0x6ec2('0x164')});db[_0x6ec2('0x4f')]['belongsTo'](db[_0x6ec2('0xef')],{'as':_0x6ec2('0xef'),'foreignKey':'AttachmentId'});db[_0x6ec2('0x4f')][_0x6ec2('0x129')](db[_0x6ec2('0x4b')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x17e')});db[_0x6ec2('0x51')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':'Agents','through':_0x6ec2('0x13d')});db['FaxQueue']['belongsToMany'](db[_0x6ec2('0xe8')],{'through':_0x6ec2('0x182'),'as':_0x6ec2('0x15b')});db[_0x6ec2('0x183')][_0x6ec2('0x129')](db['FaxAccount'],{});db[_0x6ec2('0x183')]['belongsTo'](db['CmList'],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x183')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db['FaxQueueReport'][_0x6ec2('0x129')](db[_0x6ec2('0x124')],{});db[_0x6ec2('0x183')][_0x6ec2('0x129')](db[_0x6ec2('0x4f')],{});db[_0x6ec2('0x183')]['belongsTo'](db[_0x6ec2('0x117')],{});db[_0x6ec2('0x183')]['belongsTo'](db[_0x6ec2('0x51')],{});db['SmsAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x85')],{'as':'Dispositions','foreignKey':_0x6ec2('0x184'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x53')][_0x6ec2('0x11c')](db['CannedAnswer'],{'as':_0x6ec2('0x16a'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x57')],{'as':'Messages','foreignKey':_0x6ec2('0x184')});db['SmsAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x122')],{'as':_0x6ec2('0x16b')});db[_0x6ec2('0x53')][_0x6ec2('0x11c')](db[_0x6ec2('0x185')],{'as':'Applications'});db[_0x6ec2('0x53')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x6ec2('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6ec2('0x53')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':'user_has_sms_accounts'});db[_0x6ec2('0x185')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x185')][_0x6ec2('0x129')](db[_0x6ec2('0x59')],{'onDelete':_0x6ec2('0x167')});db['SmsApplication'][_0x6ec2('0x129')](db[_0x6ec2('0x53')],{'onDelete':'restrict'});db['SmsApplication'][_0x6ec2('0x129')](db[_0x6ec2('0x156')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0x185')][_0x6ec2('0x129')](db[_0x6ec2('0x173')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x17b')});db[_0x6ec2('0x122')][_0x6ec2('0x11c')](db[_0x6ec2('0x57')],{'as':_0x6ec2('0x15e'),'onDelete':'cascade','foreignKey':_0x6ec2('0x186')});db[_0x6ec2('0x122')][_0x6ec2('0x129')](db['SmsAccount'],{'as':'Account','foreignKey':_0x6ec2('0x184')});db[_0x6ec2('0x122')][_0x6ec2('0x129')](db['CmContact'],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x122')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x11a')});db['SmsInteraction']['belongsToMany'](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x187'),'as':_0x6ec2('0x172')});db[_0x6ec2('0x122')]['belongsToMany'](db['Tag'],{'through':_0x6ec2('0x187'),'as':_0x6ec2('0x174')});db['SmsInteraction'][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'through':_0x6ec2('0x135'),'foreignKey':'SmsInteractionId'});db[_0x6ec2('0x57')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':'User'});db[_0x6ec2('0x57')][_0x6ec2('0x129')](db['CmContact'],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x164')});db['SmsMessage']['belongsTo'](db[_0x6ec2('0x122')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x6ec2('0x186')});db['SmsMessage']['belongsTo'](db[_0x6ec2('0x53')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x184')});db[_0x6ec2('0x59')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x35'),'foreignKey':_0x6ec2('0x188')});db['SmsQueue']['belongsToMany'](db[_0x6ec2('0xe8')],{'through':'team_has_sms_queues','as':_0x6ec2('0x15b')});db[_0x6ec2('0x5b')][_0x6ec2('0x11c')](db[_0x6ec2('0x85')],{'as':_0x6ec2('0x169'),'foreignKey':_0x6ec2('0x189'),'onDelete':'cascade'});db[_0x6ec2('0x5b')][_0x6ec2('0x11c')](db[_0x6ec2('0x83')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x6ec2('0x5b')][_0x6ec2('0x11c')](db[_0x6ec2('0x5f')],{'as':'Interactions','foreignKey':_0x6ec2('0x189')});db['OpenchannelAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x18a')],{'as':'Messages','foreignKey':_0x6ec2('0x189')});db[_0x6ec2('0x5b')]['hasMany'](db[_0x6ec2('0x5d')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0x6ec2('0x5b')]['belongsTo'](db['CmList'],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x5b')][_0x6ec2('0x129')](db[_0x6ec2('0x89')],{'as':_0x6ec2('0x158'),'foreignKey':_0x6ec2('0x16e')});db[_0x6ec2('0x5b')][_0x6ec2('0x12c')](db['User'],{'as':_0x6ec2('0x15a'),'through':'user_has_openchannel_accounts'});db[_0x6ec2('0x5d')][_0x6ec2('0x129')](db['User'],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x5d')][_0x6ec2('0x129')](db[_0x6ec2('0x62')],{'onDelete':_0x6ec2('0x167'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x6ec2('0x129')](db['OpenchannelAccount'],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x189')});db[_0x6ec2('0x5d')][_0x6ec2('0x129')](db[_0x6ec2('0x156')],{'onDelete':_0x6ec2('0x167'),'foreignKey':'IntervalId'});db[_0x6ec2('0x5d')][_0x6ec2('0x129')](db[_0x6ec2('0x173')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x17b')});db['OpenchannelInteraction'][_0x6ec2('0x11c')](db[_0x6ec2('0x18a')],{'as':_0x6ec2('0x15e'),'onDelete':'cascade','foreignKey':_0x6ec2('0x18b')});db[_0x6ec2('0x5f')]['belongsTo'](db[_0x6ec2('0x5b')],{'as':'Account','foreignKey':_0x6ec2('0x189')});db[_0x6ec2('0x5f')]['belongsTo'](db['CmContact'],{'as':_0x6ec2('0x164'),'foreignKey':'ContactId'});db[_0x6ec2('0x5f')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x5f')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction'][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction'][_0x6ec2('0x12c')](db['User'],{'as':_0x6ec2('0x175'),'through':_0x6ec2('0x137'),'foreignKey':_0x6ec2('0x18b')});db[_0x6ec2('0x18a')][_0x6ec2('0x129')](db['User'],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x117')});db[_0x6ec2('0x18a')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x164')});db[_0x6ec2('0x18a')][_0x6ec2('0x129')](db[_0x6ec2('0x5f')],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x181'),'foreignKey':_0x6ec2('0x18b')});db[_0x6ec2('0x18a')][_0x6ec2('0x129')](db[_0x6ec2('0xef')],{'as':_0x6ec2('0xef'),'foreignKey':_0x6ec2('0x18c')});db[_0x6ec2('0x18a')][_0x6ec2('0x129')](db[_0x6ec2('0x5b')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x189')});db[_0x6ec2('0x62')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x36'),'foreignKey':_0x6ec2('0x18d')});db['OpenchannelQueue'][_0x6ec2('0x12c')](db[_0x6ec2('0xe8')],{'through':'team_has_openchannel_queues','as':_0x6ec2('0x15b')});db[_0x6ec2('0x64')][_0x6ec2('0x11c')](db['Disposition'],{'as':_0x6ec2('0x169'),'foreignKey':_0x6ec2('0x179'),'onDelete':_0x6ec2('0x116')});db['ChatWebsite'][_0x6ec2('0x11c')](db[_0x6ec2('0x83')],{'as':_0x6ec2('0x16a'),'foreignKey':_0x6ec2('0x179')});db[_0x6ec2('0x64')][_0x6ec2('0x11c')](db[_0x6ec2('0x70')],{'as':'ProactiveActions'});db[_0x6ec2('0x64')][_0x6ec2('0x11c')](db[_0x6ec2('0x68')],{'as':_0x6ec2('0x16b')});db[_0x6ec2('0x64')][_0x6ec2('0x11c')](db[_0x6ec2('0x67')],{'as':'Applications'});db[_0x6ec2('0x64')]['hasMany'](db[_0x6ec2('0x6a')],{'as':_0x6ec2('0x15e')});db[_0x6ec2('0x64')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x64')][_0x6ec2('0x129')](db[_0x6ec2('0x156')],{'as':_0x6ec2('0x156'),'foreignKey':'IntervalId'});db[_0x6ec2('0x64')][_0x6ec2('0x129')](db[_0x6ec2('0x143')],{'as':_0x6ec2('0x143'),'foreignKey':_0x6ec2('0x168')});db[_0x6ec2('0x64')][_0x6ec2('0x129')](db[_0x6ec2('0x89')],{'as':_0x6ec2('0x158'),'foreignKey':_0x6ec2('0x16e')});db[_0x6ec2('0x64')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db[_0x6ec2('0x5b')],{});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':'Contact','foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db['OpenchannelInteraction'],{});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db[_0x6ec2('0x18a')],{});db[_0x6ec2('0x66')]['belongsTo'](db[_0x6ec2('0x117')],{});db[_0x6ec2('0x66')][_0x6ec2('0x129')](db[_0x6ec2('0x62')],{});db[_0x6ec2('0x67')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x18e'),'foreignKey':_0x6ec2('0x11a'),'onDelete':_0x6ec2('0x167')});db['ChatApplication'][_0x6ec2('0x129')](db[_0x6ec2('0x6d')],{'as':_0x6ec2('0x18f'),'foreignKey':_0x6ec2('0x190'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x67')][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{'as':_0x6ec2('0x191'),'foreignKey':_0x6ec2('0x179'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x67')]['belongsTo'](db[_0x6ec2('0x173')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x17b')});db[_0x6ec2('0x68')]['hasMany'](db['ChatMessage'],{'as':_0x6ec2('0x15e'),'onDelete':'cascade','foreignKey':_0x6ec2('0x192')});db[_0x6ec2('0x68')][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{'as':'Account','foreignKey':_0x6ec2('0x179')});db['ChatInteraction'][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':'Contact','foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x68')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x68')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x6ec2('0x172')});db[_0x6ec2('0x68')][_0x6ec2('0x12c')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x6ec2('0x174')});db[_0x6ec2('0x68')]['belongsToMany'](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'through':_0x6ec2('0x132'),'foreignKey':_0x6ec2('0x192')});db[_0x6ec2('0x6a')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'onDelete':'cascade','as':'User'});db[_0x6ec2('0x6a')][_0x6ec2('0x129')](db['CmContact'],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x6a')][_0x6ec2('0x129')](db[_0x6ec2('0x68')],{'onDelete':'cascade','as':_0x6ec2('0x181'),'foreignKey':'ChatInteractionId'});db[_0x6ec2('0x6a')][_0x6ec2('0x129')](db[_0x6ec2('0xef')],{'as':_0x6ec2('0xef'),'foreignKey':_0x6ec2('0x18c')});db[_0x6ec2('0x6a')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x6ec2('0x6c')][_0x6ec2('0x11c')](db[_0x6ec2('0xef')],{'as':_0x6ec2('0x177'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x6c')][_0x6ec2('0x129')](db['CmContact'],{'onDelete':'cascade','as':_0x6ec2('0x164'),'foreignKey':'ContactId'});db['ChatOfflineMessage']['belongsTo'](db[_0x6ec2('0x64')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x179')});db[_0x6ec2('0x6d')][_0x6ec2('0x12c')](db['User'],{'as':_0x6ec2('0x15a'),'through':'UserChatQueue','hooks':!![]});db[_0x6ec2('0x6d')][_0x6ec2('0x12c')](db[_0x6ec2('0xe8')],{'through':_0x6ec2('0x193'),'as':_0x6ec2('0x15b')});db['ChatGroup'][_0x6ec2('0x11c')](db[_0x6ec2('0xd5')],{'as':_0x6ec2('0x15e'),'foreignKey':_0x6ec2('0x194'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x195')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x196'),'through':_0x6ec2('0x12d')});db[_0x6ec2('0x70')]['belongsTo'](db['ChatWebsite'],{'as':_0x6ec2('0x191'),'foreignKey':_0x6ec2('0x179')});db[_0x6ec2('0x71')][_0x6ec2('0x11c')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x12e'),'foreignKey':_0x6ec2('0x197')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x198')],{'as':_0x6ec2('0x199'),'foreignKey':_0x6ec2('0x19a')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x75')],{'as':'Hoppers','foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x77')],{'as':_0x6ec2('0x11f'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x79')],{'as':'HopperHistories','foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x7b')],{'as':_0x6ec2('0x7b'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x73')]['hasMany'](db[_0x6ec2('0xd8')],{'as':_0x6ec2('0x151'),'foreignKey':'ContactId'});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x5f')],{'as':_0x6ec2('0x136'),'foreignKey':_0x6ec2('0x165'),'onDelete':'restrict'});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x68')],{'as':_0x6ec2('0x121'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x6ec2('0x122')],{'as':_0x6ec2('0x123'),'foreignKey':'ContactId','onDelete':_0x6ec2('0x167')});db['CmContact'][_0x6ec2('0x11c')](db[_0x6ec2('0x124')],{'as':_0x6ec2('0x133'),'foreignKey':_0x6ec2('0x165'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x73')][_0x6ec2('0x11c')](db[_0x6ec2('0x41')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6ec2('0x129')](db[_0x6ec2('0x71')],{'as':_0x6ec2('0x19b'),'foreignKey':_0x6ec2('0x197')});db[_0x6ec2('0x73')]['belongsTo'](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x73')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'through':'cm_user_has_contacts'});db[_0x6ec2('0x73')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'as':_0x6ec2('0x172'),'through':_0x6ec2('0x19c')});db['CmContact'][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x19c'),'as':_0x6ec2('0x174')});db[_0x6ec2('0x75')][_0x6ec2('0x11c')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0x6ec2('0x75')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':'ContactId','onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x75')][_0x6ec2('0x129')](db['CmList'],{'as':'List','foreignKey':_0x6ec2('0x16d'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x75')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x18e'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x75')][_0x6ec2('0x129')](db[_0x6ec2('0x1c')],{'as':_0x6ec2('0x18f'),'foreignKey':_0x6ec2('0x14c'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x75')]['belongsTo'](db[_0x6ec2('0xec')],{'as':_0x6ec2('0xec'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x6ec2('0x75')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x19d')});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x6ec2('0x165'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x14f')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x14f')][_0x6ec2('0x129')](db['VoiceQueue'],{'as':_0x6ec2('0x18f'),'foreignKey':_0x6ec2('0x14c'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x14f')][_0x6ec2('0x129')](db['Campaign'],{'as':_0x6ec2('0xec'),'foreignKey':_0x6ec2('0x19e'),'onDelete':'cascade'});db[_0x6ec2('0x81')][_0x6ec2('0x11c')](db[_0x6ec2('0x87')],{'as':{'plural':_0x6ec2('0x19f'),'singular':_0x6ec2('0x1a0')},'foreignKey':_0x6ec2('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x6ec2('0x81')][_0x6ec2('0x11c')](db[_0x6ec2('0x87')],{'as':{'plural':'Any','singular':_0x6ec2('0x1a2')},'foreignKey':_0x6ec2('0x1a3'),'onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x81')]['hasMany'](db[_0x6ec2('0x7f')],{'as':_0x6ec2('0x1a4'),'foreignKey':'AutomationId','onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x85')][_0x6ec2('0x11c')](db[_0x6ec2('0x85')],{'as':'Dispositions','foreignKey':_0x6ec2('0x1a5'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0x156')][_0x6ec2('0x11c')](db[_0x6ec2('0x156')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x6ec2('0x116'),'hooks':!![],'required':![]});db[_0x6ec2('0x156')][_0x6ec2('0x11c')](db[_0x6ec2('0x1a')],{'as':'Extensions','foreignKey':_0x6ec2('0x157'),'onDelete':'restrict'});db[_0x6ec2('0x156')][_0x6ec2('0x11c')](db[_0x6ec2('0x44')],{'as':_0x6ec2('0x1a6'),'foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0x156')][_0x6ec2('0x11c')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x6ec2('0x157')});db['Interval'][_0x6ec2('0x11c')](db[_0x6ec2('0x4c')],{'as':_0x6ec2('0x1a7'),'foreignKey':'IntervalId'});db[_0x6ec2('0x156')][_0x6ec2('0x11c')](db[_0x6ec2('0x185')],{'as':'SmsApplications','foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0x1a8')][_0x6ec2('0x129')](db['MailAccount'],{});db[_0x6ec2('0x1a8')][_0x6ec2('0x129')](db[_0x6ec2('0xa0')],{'foreignKey':_0x6ec2('0x1a9')});db[_0x6ec2('0x1a8')][_0x6ec2('0x129')](db[_0x6ec2('0x9f')],{'foreignKey':_0x6ec2('0x1aa')});db['Sound']['belongsToMany'](db[_0x6ec2('0x1b')],{'as':_0x6ec2('0x1ab'),'through':_0x6ec2('0x14b'),'onDelete':'restrict'});db[_0x6ec2('0x173')]['belongsToMany'](db[_0x6ec2('0x73')],{'through':_0x6ec2('0x19c')});db[_0x6ec2('0x173')][_0x6ec2('0x12c')](db[_0x6ec2('0x68')],{'through':'chat_interaction_has_tags'});db[_0x6ec2('0x173')]['belongsToMany'](db[_0x6ec2('0x41')],{'through':_0x6ec2('0x171')});db[_0x6ec2('0x173')][_0x6ec2('0x12c')](db[_0x6ec2('0x122')],{'through':_0x6ec2('0x187')});db[_0x6ec2('0x173')][_0x6ec2('0x12c')](db[_0x6ec2('0x124')],{'through':_0x6ec2('0x17f')});db[_0x6ec2('0x173')][_0x6ec2('0x12c')](db[_0x6ec2('0x5f')],{'through':_0x6ec2('0x1ac')});db[_0x6ec2('0x173')][_0x6ec2('0x12c')](db['WhatsappInteraction'],{'through':_0x6ec2('0x1ad')});db[_0x6ec2('0x198')][_0x6ec2('0x129')](db[_0x6ec2('0x92')],{'as':_0x6ec2('0x1ae'),'foreignKey':'ItemTypeId'});db[_0x6ec2('0x94')][_0x6ec2('0x129')](db['CmHopper'],{'as':'Hopper','foreignKey':_0x6ec2('0x1af')});db['CmContactHasItem'][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x19a')});db[_0x6ec2('0x98')][_0x6ec2('0x11c')](db[_0x6ec2('0x87')],{'as':{'plural':_0x6ec2('0x1b0'),'singular':'AllCondition'},'foreignKey':_0x6ec2('0x1b1'),'onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x98')][_0x6ec2('0x11c')](db['Condition'],{'as':{'plural':_0x6ec2('0x1b2'),'singular':'AnyCondition'},'foreignKey':_0x6ec2('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0x6ec2('0x98')][_0x6ec2('0x11c')](db['Action'],{'as':'Actions','foreignKey':_0x6ec2('0x1b4'),'onDelete':_0x6ec2('0x116'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x6ec2('0xa4')],{'as':_0x6ec2('0x1b5'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1aa'),'hooks':!![]});db[_0x6ec2('0xa0')][_0x6ec2('0x11c')](db[_0x6ec2('0xa4')],{'as':_0x6ec2('0x1b5'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1a9')});db[_0x6ec2('0x1b6')][_0x6ec2('0x11c')](db['AnalyticFieldReport'],{'as':_0x6ec2('0x1b5'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b7')});db[_0x6ec2('0xa4')][_0x6ec2('0x129')](db[_0x6ec2('0x1b6')],{'foreignKey':_0x6ec2('0x1b7')});db['SalesforceAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0xa8')],{'as':'Configurations','onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xa8')][_0x6ec2('0x11c')](db[_0x6ec2('0x1b9')],{'as':_0x6ec2('0x1ba'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0x6ec2('0x1bc'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xa8')][_0x6ec2('0x11c')](db[_0x6ec2('0x1b9')],{'as':'Fields','onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xa8')][_0x6ec2('0x129')](db[_0x6ec2('0xa7')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0x1b9')][_0x6ec2('0x11c')](db[_0x6ec2('0x1b9')],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0x1b9')]['hasMany'](db[_0x6ec2('0x1b9')],{'as':_0x6ec2('0x1c0'),'foreignKey':'DescriptionId'});db[_0x6ec2('0x1b9')][_0x6ec2('0x11c')](db[_0x6ec2('0x1b9')],{'as':_0x6ec2('0x1c1'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0x1b9')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':_0x6ec2('0x1c2')});db['SugarcrmAccount'][_0x6ec2('0x11c')](db['SugarcrmConfiguration'],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xab')][_0x6ec2('0x11c')](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1ba'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xab')][_0x6ec2('0x11c')](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1bc'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1bd')});db['SugarcrmConfiguration'][_0x6ec2('0x11c')](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6ec2('0xab')][_0x6ec2('0x129')](db[_0x6ec2('0x1c4')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xac')][_0x6ec2('0x11c')](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xac')]['hasMany'](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xac')][_0x6ec2('0x11c')](db[_0x6ec2('0xac')],{'as':_0x6ec2('0x1c1'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':'VariableId'});db[_0x6ec2('0xae')]['hasMany'](db[_0x6ec2('0xb0')],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':'AccountId'});db[_0x6ec2('0xb0')][_0x6ec2('0x11c')](db[_0x6ec2('0xb2')],{'as':'Subjects','onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xb0')][_0x6ec2('0x11c')](db[_0x6ec2('0xb2')],{'as':_0x6ec2('0x1bc'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xb0')]['hasMany'](db['DeskField'],{'as':_0x6ec2('0x1b5'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xb0')]['belongsTo'](db[_0x6ec2('0xae')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xb0')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x1c5')});db[_0x6ec2('0xb2')][_0x6ec2('0x11c')](db[_0x6ec2('0xb2')],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xb2')][_0x6ec2('0x11c')](db[_0x6ec2('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6ec2('0xb2')][_0x6ec2('0x11c')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x6ec2('0xb2')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':'VariableId'});db[_0x6ec2('0x1c6')][_0x6ec2('0x11c')](db[_0x6ec2('0xb4')],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xb4')][_0x6ec2('0x11c')](db[_0x6ec2('0xb5')],{'as':_0x6ec2('0x1ba'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1bb')});db['ZohoConfiguration'][_0x6ec2('0x11c')](db['ZohoField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xb4')][_0x6ec2('0x11c')](db[_0x6ec2('0xb5')],{'as':_0x6ec2('0x1b5'),'onDelete':_0x6ec2('0x116'),'foreignKey':'FieldId'});db[_0x6ec2('0xb4')][_0x6ec2('0x129')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xb5')][_0x6ec2('0x11c')](db['ZohoField'],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xb5')][_0x6ec2('0x11c')](db[_0x6ec2('0xb5')],{'as':'Description','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xb5')][_0x6ec2('0x11c')](db[_0x6ec2('0xb5')],{'as':_0x6ec2('0x1c1'),'foreignKey':_0x6ec2('0x1be')});db['ZohoField'][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':_0x6ec2('0x1c2')});db[_0x6ec2('0x1c7')]['hasMany'](db[_0x6ec2('0xb8')],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xb8')][_0x6ec2('0x11c')](db['ZendeskField'],{'as':_0x6ec2('0x1ba'),'foreignKey':'SubjectId'});db[_0x6ec2('0xb8')][_0x6ec2('0x11c')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xb8')]['hasMany'](db[_0x6ec2('0x1c8')],{'as':_0x6ec2('0x1b5'),'foreignKey':'FieldId'});db[_0x6ec2('0xb8')][_0x6ec2('0x129')](db[_0x6ec2('0x1c7')],{'as':_0x6ec2('0x178'),'foreignKey':'AccountId'});db[_0x6ec2('0xb8')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x1c9')});db['ZendeskField']['hasMany'](db[_0x6ec2('0x1c8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6ec2('0x1c8')][_0x6ec2('0x11c')](db['ZendeskField'],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db['ZendeskField'][_0x6ec2('0x11c')](db[_0x6ec2('0x1c8')],{'as':_0x6ec2('0x1c1'),'foreignKey':'FieldId'});db[_0x6ec2('0x1c8')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':'VariableId'});db[_0x6ec2('0x1ca')][_0x6ec2('0x11c')](db[_0x6ec2('0xbc')],{'as':'Configurations','onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xbc')]['hasMany'](db[_0x6ec2('0xbe')],{'as':_0x6ec2('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6ec2('0xbc')][_0x6ec2('0x11c')](db['FreshdeskField'],{'as':_0x6ec2('0x1bc'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xbc')]['hasMany'](db[_0x6ec2('0xbe')],{'as':_0x6ec2('0x1b5'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xbc')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x6ec2('0x173')],{'through':_0x6ec2('0x1cb')});db[_0x6ec2('0xbe')][_0x6ec2('0x11c')](db[_0x6ec2('0xbe')],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xbe')][_0x6ec2('0x11c')](db[_0x6ec2('0xbe')],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xbe')][_0x6ec2('0x11c')](db[_0x6ec2('0xbe')],{'as':_0x6ec2('0x1c1'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xbe')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':'Variable','foreignKey':_0x6ec2('0x1c2')});db['VtigerAccount'][_0x6ec2('0x11c')](db['VtigerConfiguration'],{'as':_0x6ec2('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x6ec2('0x11c')](db['VtigerField'],{'as':_0x6ec2('0x1ba'),'foreignKey':'SubjectId'});db[_0x6ec2('0xc1')][_0x6ec2('0x11c')](db[_0x6ec2('0xc3')],{'as':_0x6ec2('0x1bc'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xc1')][_0x6ec2('0x11c')](db[_0x6ec2('0xc3')],{'as':'Fields','foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xc1')]['belongsTo'](db['VtigerAccount'],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db['VtigerField'][_0x6ec2('0x11c')](db[_0x6ec2('0xc3')],{'as':'Subject','foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xc3')]['hasMany'](db[_0x6ec2('0xc3')],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xc3')][_0x6ec2('0x11c')](db[_0x6ec2('0xc3')],{'as':_0x6ec2('0x1c1'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xc3')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':'Variable','foreignKey':_0x6ec2('0x1c2')});db['ServicenowAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0xc5')],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xc5')][_0x6ec2('0x11c')](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1ba'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xc5')][_0x6ec2('0x11c')](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1bc'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xc5')][_0x6ec2('0x11c')](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1b5'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xc5')][_0x6ec2('0x129')](db[_0x6ec2('0xc4')],{'as':_0x6ec2('0x178'),'foreignKey':'AccountId'});db[_0x6ec2('0xc7')][_0x6ec2('0x11c')](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1bf'),'foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xc7')]['hasMany'](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db['ServicenowField'][_0x6ec2('0x11c')](db[_0x6ec2('0xc7')],{'as':_0x6ec2('0x1c1'),'foreignKey':_0x6ec2('0x1be')});db[_0x6ec2('0xc7')]['belongsTo'](db['Variable'],{'as':_0x6ec2('0x9a'),'foreignKey':_0x6ec2('0x1c2')});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db['Dynamics365Account'][_0x6ec2('0x129')](db[_0x6ec2('0x10d')],{'as':_0x6ec2('0x10d'),'foreignKey':_0x6ec2('0x166')});db[_0x6ec2('0xca')][_0x6ec2('0x11c')](db[_0x6ec2('0xcc')],{'as':_0x6ec2('0x1ba'),'onDelete':'cascade','foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xca')][_0x6ec2('0x11c')](db[_0x6ec2('0xcc')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xca')][_0x6ec2('0x11c')](db[_0x6ec2('0xcc')],{'as':_0x6ec2('0x1b5'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1be')});db['Dynamics365Configuration'][_0x6ec2('0x129')](db['Dynamics365Account'],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xcc')][_0x6ec2('0x11c')](db[_0x6ec2('0xcc')],{'as':'Subject','foreignKey':_0x6ec2('0x1bb')});db[_0x6ec2('0xcc')]['hasMany'](db[_0x6ec2('0xcc')],{'as':_0x6ec2('0x1c0'),'foreignKey':_0x6ec2('0x1bd')});db[_0x6ec2('0xcc')][_0x6ec2('0x11c')](db['Dynamics365Field'],{'as':_0x6ec2('0x1c1'),'foreignKey':'FieldId'});db[_0x6ec2('0xcc')][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':'Variable','foreignKey':_0x6ec2('0x1c2')});db[_0x6ec2('0xce')][_0x6ec2('0x11c')](db[_0x6ec2('0xd0')],{'as':_0x6ec2('0x1c3'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xd0')][_0x6ec2('0x11c')](db[_0x6ec2('0xd1')],{'as':_0x6ec2('0x1ba'),'foreignKey':'SubjectId'});db[_0x6ec2('0xd0')][_0x6ec2('0x11c')](db[_0x6ec2('0xd1')],{'as':_0x6ec2('0x1bc'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x6ec2('0xd1')],{'as':_0x6ec2('0x1b5'),'foreignKey':_0x6ec2('0x1be')});db['FreshsalesConfiguration'][_0x6ec2('0x129')](db[_0x6ec2('0xce')],{'as':'Account','foreignKey':_0x6ec2('0x1b8')});db[_0x6ec2('0xd1')][_0x6ec2('0x11c')](db[_0x6ec2('0xd1')],{'as':_0x6ec2('0x1bf'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x6ec2('0x11c')](db[_0x6ec2('0xd1')],{'as':'Description','foreignKey':_0x6ec2('0x1bd')});db['FreshsalesField']['hasMany'](db[_0x6ec2('0xd1')],{'as':'Field','foreignKey':_0x6ec2('0x1be')});db['FreshsalesField'][_0x6ec2('0x129')](db[_0x6ec2('0x9a')],{'as':_0x6ec2('0x9a'),'foreignKey':'VariableId'});db[_0x6ec2('0xd3')][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{});db[_0x6ec2('0xd3')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0xd3')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':'ContactId'});db[_0x6ec2('0xd3')][_0x6ec2('0x129')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x6ec2('0x129')](db[_0x6ec2('0x6a')],{});db[_0x6ec2('0xd3')]['belongsTo'](db[_0x6ec2('0x117')],{});db['ChatQueueReport'][_0x6ec2('0x129')](db['ChatQueue'],{});db[_0x6ec2('0xd5')]['belongsTo'](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1cc')});db[_0x6ec2('0xd5')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1cd')});db[_0x6ec2('0xd8')]['hasMany'](db[_0x6ec2('0x1ce')],{'foreignKey':_0x6ec2('0x1cf'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0xd8')][_0x6ec2('0x11c')](db['JscriptyAnswerReport'],{'foreignKey':_0x6ec2('0x1cf'),'onDelete':'cascade'});db[_0x6ec2('0xda')][_0x6ec2('0x129')](db[_0x6ec2('0x53')],{});db[_0x6ec2('0xda')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':'ContactId'});db[_0x6ec2('0xda')][_0x6ec2('0x129')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x6ec2('0x129')](db[_0x6ec2('0x57')],{});db[_0x6ec2('0xda')][_0x6ec2('0x129')](db['User'],{});db[_0x6ec2('0xda')][_0x6ec2('0x129')](db['SmsQueue'],{});db[_0x6ec2('0xde')][_0x6ec2('0x11c')](db['JscriptySessionReport'],{'foreignKey':_0x6ec2('0x1d0')});db[_0x6ec2('0xde')][_0x6ec2('0x11c')](db[_0x6ec2('0x1ce')],{'foreignKey':'ProjectId'});db[_0x6ec2('0xde')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x6ec2('0x1d0')});db['Team']['belongsToMany'](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':'user_has_teams'});db['Team']['belongsToMany'](db[_0x6ec2('0x1c')],{'through':_0x6ec2('0x10e'),'as':_0x6ec2('0x139')});db[_0x6ec2('0xe8')]['belongsToMany'](db[_0x6ec2('0x3e')],{'through':_0x6ec2('0x1d1'),'as':_0x6ec2('0x13a')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x6ec2('0x193'),'as':_0x6ec2('0x13b')});db[_0x6ec2('0xe8')][_0x6ec2('0x12c')](db[_0x6ec2('0x51')],{'through':_0x6ec2('0x182'),'as':_0x6ec2('0x13c')});db[_0x6ec2('0xe8')][_0x6ec2('0x12c')](db[_0x6ec2('0x59')],{'through':_0x6ec2('0x1d2'),'as':_0x6ec2('0x1d3')});db[_0x6ec2('0xe8')][_0x6ec2('0x12c')](db[_0x6ec2('0x62')],{'through':_0x6ec2('0x1d4'),'as':_0x6ec2('0x13e')});db['Team'][_0x6ec2('0x12c')](db['WhatsappQueue'],{'through':_0x6ec2('0x1d5'),'as':_0x6ec2('0x13f')});db[_0x6ec2('0xe8')]['belongsToMany'](db['VoicePrefix'],{'through':_0x6ec2('0x110'),'as':_0x6ec2('0x1d6')});db[_0x6ec2('0xec')][_0x6ec2('0x11c')](db[_0x6ec2('0x75')],{'as':_0x6ec2('0x14d'),'foreignKey':_0x6ec2('0x19e')});db[_0x6ec2('0xec')][_0x6ec2('0x11c')](db[_0x6ec2('0x77')],{'as':_0x6ec2('0x11f'),'foreignKey':_0x6ec2('0x19e')});db[_0x6ec2('0xec')]['hasMany'](db[_0x6ec2('0x79')],{'as':_0x6ec2('0x14e'),'foreignKey':_0x6ec2('0x19e')});db[_0x6ec2('0xec')]['hasMany'](db['CmHopperBlack'],{'as':_0x6ec2('0x150'),'foreignKey':_0x6ec2('0x19e')});db[_0x6ec2('0xec')][_0x6ec2('0x129')](db[_0x6ec2('0x152')],{'as':_0x6ec2('0x152'),'foreignKey':_0x6ec2('0x153')});db[_0x6ec2('0xec')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x6ec2('0x155')});db['Campaign'][_0x6ec2('0x129')](db['Interval'],{'as':_0x6ec2('0x156'),'foreignKey':_0x6ec2('0x157')});db[_0x6ec2('0xec')]['belongsTo'](db['SquareProject'],{'as':_0x6ec2('0xe2'),'foreignKey':_0x6ec2('0x1d7')});db['Campaign'][_0x6ec2('0x12c')](db['CmList'],{'as':_0x6ec2('0x12f'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x6ec2('0x12c')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x15c'),'through':_0x6ec2('0x1d8')});db['Attachment']['belongsTo'](db[_0x6ec2('0x6c')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x6ec2('0xf2')][_0x6ec2('0x129')](db['MailMessage'],{});db[_0x6ec2('0xf2')][_0x6ec2('0x129')](db[_0x6ec2('0x41')],{});db[_0x6ec2('0xf2')]['belongsTo'](db[_0x6ec2('0x143')],{'foreignKey':_0x6ec2('0x1d9'),'as':_0x6ec2('0x1da')});db[_0x6ec2('0xf2')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1db'),'as':_0x6ec2('0x1dc')});db['MailTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1dd'),'as':_0x6ec2('0x1de')});db['MailTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x3e')],{'foreignKey':_0x6ec2('0x1df'),'as':'ToQueue'});db['MailTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x143')],{'foreignKey':_0x6ec2('0x1e0'),'as':_0x6ec2('0x1e1')});db[_0x6ec2('0xf4')][_0x6ec2('0x129')](db[_0x6ec2('0x6a')],{});db['ChatTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x68')],{});db['ChatTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{'foreignKey':_0x6ec2('0x1e2'),'as':_0x6ec2('0x1da')});db[_0x6ec2('0xf4')]['belongsTo'](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1db'),'as':_0x6ec2('0x1dc')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x6ec2('0x1dd'),'as':_0x6ec2('0x1de')});db[_0x6ec2('0xf4')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x6ec2('0x1e3'),'as':_0x6ec2('0x1e4')});db[_0x6ec2('0xf4')][_0x6ec2('0x129')](db[_0x6ec2('0x64')],{'foreignKey':_0x6ec2('0x1e5'),'as':'ToAccount'});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db['FaxMessage'],{});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db[_0x6ec2('0x124')],{});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db['FaxAccount'],{'foreignKey':_0x6ec2('0x1e6'),'as':_0x6ec2('0x1da')});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1db'),'as':_0x6ec2('0x1dc')});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db['User'],{'foreignKey':_0x6ec2('0x1dd'),'as':_0x6ec2('0x1de')});db[_0x6ec2('0xf6')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x6ec2('0x1e7'),'as':_0x6ec2('0x1e4')});db[_0x6ec2('0xf6')][_0x6ec2('0x129')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x6ec2('0x1e1')});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db['OpenchannelMessage'],{});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db[_0x6ec2('0x5f')],{});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db[_0x6ec2('0x5b')],{'foreignKey':_0x6ec2('0x1e9'),'as':'FromAccount'});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db['User'],{'foreignKey':_0x6ec2('0x1db'),'as':_0x6ec2('0x1dc')});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1dd'),'as':_0x6ec2('0x1de')});db['OpenchannelTransferReport'][_0x6ec2('0x129')](db['OpenchannelQueue'],{'foreignKey':_0x6ec2('0x1ea'),'as':_0x6ec2('0x1e4')});db[_0x6ec2('0x1e8')][_0x6ec2('0x129')](db[_0x6ec2('0x5b')],{'foreignKey':_0x6ec2('0x1eb'),'as':'ToAccount'});db[_0x6ec2('0xf8')][_0x6ec2('0x129')](db['SmsMessage'],{});db[_0x6ec2('0xf8')][_0x6ec2('0x129')](db[_0x6ec2('0x122')],{});db[_0x6ec2('0xf8')][_0x6ec2('0x129')](db[_0x6ec2('0x53')],{'foreignKey':_0x6ec2('0x1ec'),'as':_0x6ec2('0x1da')});db['SmsTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1db'),'as':_0x6ec2('0x1dc')});db['SmsTransferReport'][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':_0x6ec2('0x1dd'),'as':'ToAgent'});db[_0x6ec2('0xf8')][_0x6ec2('0x129')](db[_0x6ec2('0x59')],{'foreignKey':_0x6ec2('0x1ed'),'as':'ToQueue'});db[_0x6ec2('0xf8')]['belongsTo'](db[_0x6ec2('0x53')],{'foreignKey':_0x6ec2('0x1ee'),'as':_0x6ec2('0x1e1')});db[_0x6ec2('0xfa')][_0x6ec2('0x11c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6ec2('0x16d'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0xfa')][_0x6ec2('0x11c')](db['CmCustomField'],{'as':_0x6ec2('0x1ef'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0xfa')][_0x6ec2('0x11c')](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x12e'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0xfa')]['hasMany'](db[_0x6ec2('0x77')],{'as':_0x6ec2('0x11f'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0xfa')][_0x6ec2('0x11c')](db[_0x6ec2('0x79')],{'as':_0x6ec2('0x120'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0x6ec2('0x7b'),'foreignKey':'ListId'});db[_0x6ec2('0xfa')][_0x6ec2('0x12c')](db[_0x6ec2('0x1c')],{'as':_0x6ec2('0x1f0'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x130')});db['VoicePrefix'][_0x6ec2('0x11c')](db['VoiceExtension'],{'as':_0x6ec2('0x11e'),'onDelete':_0x6ec2('0x116')});db[_0x6ec2('0xfc')]['belongsToMany'](db[_0x6ec2('0x117')],{'as':'Agents','through':_0x6ec2('0x112')});db[_0x6ec2('0xfc')]['belongsToMany'](db[_0x6ec2('0xe8')],{'through':_0x6ec2('0x110'),'as':_0x6ec2('0x15b')});db[_0x6ec2('0x12a')][_0x6ec2('0x11c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'foreignKey':'userProfileId'});db[_0x6ec2('0x12a')]['hasMany'](db[_0x6ec2('0xfe')],{'as':_0x6ec2('0x1f1'),'foreignKey':_0x6ec2('0x12b'),'onDelete':_0x6ec2('0x116')});db['UserProfileSection'][_0x6ec2('0x11c')](db[_0x6ec2('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x6ec2('0x116')});db['WhatsappAccount']['hasMany'](db[_0x6ec2('0x85')],{'as':_0x6ec2('0x169'),'foreignKey':_0x6ec2('0x1f2'),'onDelete':_0x6ec2('0x116')});db['WhatsappAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x83')],{'as':_0x6ec2('0x16a'),'foreignKey':_0x6ec2('0x1f2')});db[_0x6ec2('0x103')][_0x6ec2('0x11c')](db[_0x6ec2('0x106')],{'as':_0x6ec2('0x15e'),'foreignKey':_0x6ec2('0x1f2')});db[_0x6ec2('0x103')][_0x6ec2('0x11c')](db[_0x6ec2('0x126')],{'as':_0x6ec2('0x16b')});db['WhatsappAccount'][_0x6ec2('0x11c')](db[_0x6ec2('0x1f3')],{'as':_0x6ec2('0x1f4')});db[_0x6ec2('0x103')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':_0x6ec2('0x16d')});db[_0x6ec2('0x103')]['belongsTo'](db[_0x6ec2('0x89')],{'as':_0x6ec2('0x158'),'foreignKey':_0x6ec2('0x16e')});db['WhatsappAccount'][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x149')});db[_0x6ec2('0x1f3')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x1f3')][_0x6ec2('0x129')](db[_0x6ec2('0x10b')],{'onDelete':_0x6ec2('0x167')});db['WhatsappApplication'][_0x6ec2('0x129')](db[_0x6ec2('0x103')],{'onDelete':'restrict'});db[_0x6ec2('0x1f3')]['belongsTo'](db['Interval'],{'onDelete':_0x6ec2('0x167'),'foreignKey':'IntervalId'});db[_0x6ec2('0x1f3')][_0x6ec2('0x129')](db[_0x6ec2('0x173')],{'onDelete':_0x6ec2('0x167'),'foreignKey':_0x6ec2('0x17b')});db[_0x6ec2('0x126')][_0x6ec2('0x11c')](db[_0x6ec2('0x106')],{'as':_0x6ec2('0x15e'),'onDelete':_0x6ec2('0x116'),'foreignKey':_0x6ec2('0x1f5')});db[_0x6ec2('0x126')]['belongsTo'](db[_0x6ec2('0x103')],{'as':'Account','foreignKey':_0x6ec2('0x1f2')});db[_0x6ec2('0x126')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'as':'Contact','foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x126')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x170'),'foreignKey':_0x6ec2('0x11a')});db[_0x6ec2('0x126')]['belongsToMany'](db[_0x6ec2('0x173')],{'through':'whatsapp_interaction_has_tags','as':_0x6ec2('0x172')});db[_0x6ec2('0x126')][_0x6ec2('0x12c')](db[_0x6ec2('0x173')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x6ec2('0x126')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x175'),'through':_0x6ec2('0x138'),'foreignKey':_0x6ec2('0x1f5')});db['WhatsappMessage'][_0x6ec2('0x129')](db['User'],{'as':_0x6ec2('0x117')});db[_0x6ec2('0x106')][_0x6ec2('0x129')](db[_0x6ec2('0x73')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x6ec2('0x116'),'as':_0x6ec2('0x181'),'foreignKey':_0x6ec2('0x1f5')});db[_0x6ec2('0x106')][_0x6ec2('0x129')](db[_0x6ec2('0x103')],{'as':_0x6ec2('0x178'),'foreignKey':_0x6ec2('0x1f2')});db[_0x6ec2('0x108')][_0x6ec2('0x129')](db['WhatsappAccount'],{});db[_0x6ec2('0x108')][_0x6ec2('0x129')](db[_0x6ec2('0xfa')],{'as':_0x6ec2('0x16c'),'foreignKey':'ListId'});db[_0x6ec2('0x108')]['belongsTo'](db[_0x6ec2('0x73')],{'as':_0x6ec2('0x164'),'foreignKey':_0x6ec2('0x165')});db[_0x6ec2('0x108')][_0x6ec2('0x129')](db['WhatsappInteraction'],{});db[_0x6ec2('0x108')][_0x6ec2('0x129')](db['WhatsappQueue'],{});db[_0x6ec2('0x108')]['belongsTo'](db[_0x6ec2('0x106')],{});db[_0x6ec2('0x108')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{});db[_0x6ec2('0x10a')]['belongsTo'](db['WhatsappMessage'],{});db[_0x6ec2('0x10a')][_0x6ec2('0x129')](db[_0x6ec2('0x126')],{});db[_0x6ec2('0x10a')]['belongsTo'](db[_0x6ec2('0x103')],{'foreignKey':'FromWhatsappAccountId','as':_0x6ec2('0x1da')});db[_0x6ec2('0x10a')][_0x6ec2('0x129')](db['WhatsappAccount'],{'foreignKey':_0x6ec2('0x1f6'),'as':_0x6ec2('0x1e1')});db[_0x6ec2('0x10a')][_0x6ec2('0x129')](db[_0x6ec2('0x10b')],{'foreignKey':_0x6ec2('0x1f7'),'as':_0x6ec2('0x1e4')});db[_0x6ec2('0x10a')]['belongsTo'](db[_0x6ec2('0x117')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6ec2('0x10a')][_0x6ec2('0x129')](db[_0x6ec2('0x117')],{'foreignKey':'ToUserId','as':_0x6ec2('0x1de')});db[_0x6ec2('0x10b')][_0x6ec2('0x12c')](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x15a'),'through':_0x6ec2('0x37'),'foreignKey':_0x6ec2('0x1f8')});db[_0x6ec2('0x10b')][_0x6ec2('0x12c')](db['Team'],{'through':_0x6ec2('0x1d5'),'as':_0x6ec2('0x15b')});db[_0x6ec2('0x118')]['belongsTo'](db[_0x6ec2('0x117')],{'as':_0x6ec2('0x1f9'),'foreignKey':'UserId','onDelete':_0x6ec2('0x116'),'hooks':!![]});db[_0x6ec2('0x10d')][_0x6ec2('0x115')](db[_0x6ec2('0xc8')],{'as':_0x6ec2('0xc8'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x10d')][_0x6ec2('0x115')](db['MailServerIn'],{'as':_0x6ec2('0x1fa'),'onDelete':_0x6ec2('0x167')});db[_0x6ec2('0x10d')][_0x6ec2('0x115')](db['MailServerOut'],{'as':_0x6ec2('0x1fb'),'onDelete':_0x6ec2('0x167')});module[_0x6ec2('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd3c3=['../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/trigger/trigger.model','Variable','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../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','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueue','UserChatQueue','FaxQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','VoiceMailMessage','mailboxuser','mailbox','AgentReports','uniqueid','Contact','MailAccountId','CloudProviderId','Imap','Smtp','Dispositions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','MailQueueReport','Dashboard','FaxAccountId','Answers','Interactions','Applications','Exntensions','TagId','Messages','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','Teams','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','Users','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Extensions','MailApplications','FaxApplications','SmsApplications','Schedule','AnalyticCustomReport','CustomReportId','Mohs','ItemType','ItemTypeId','Trigger','AllConditions','AnyCondition','Fields','AnalyticDefaultReport','SalesforceConfiguration','Configurations','Subjects','SubjectId','DescriptionId','FieldId','AccountId','Description','Field','SugarcrmConfiguration','Descriptions','Subject','VariableId','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','ServicenowAccount','Dynamics365Account','ChatQueueReport','ToId','SessionId','JscriptyProject','ProjectId','user_has_teams','team_has_mail_queues','ChatQueues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xd3c3,0x1c7));var _0x3d3c=function(_0x33a1e7,_0x3c20fb){_0x33a1e7=_0x33a1e7-0x0;var _0x274816=_0xd3c3[_0x33a1e7];return _0x274816;};'use strict';var config=require(_0x3d3c('0x0'));var Sequelize=require(_0x3d3c('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0x3d3c('0x1')]=_[_0x3d3c('0x2')](config[_0x3d3c('0x1')],{'database':_0x3d3c('0x3'),'username':_0x3d3c('0x4'),'password':_0x3d3c('0x5'),'options':{'host':_0x3d3c('0x6'),'port':0xcea,'dialect':_0x3d3c('0x7'),'dialectOptions':{'charset':_0x3d3c('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x3d3c('0x9'),'collate':_0x3d3c('0xa')}}});config[_0x3d3c('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x3d3c('0x3'),'username':_0x3d3c('0x4'),'password':_0x3d3c('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3d3c('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x3d3c('0xc')](),'define':{'charset':_0x3d3c('0x9'),'collate':_0x3d3c('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x3d3c('0xd')],config[_0x3d3c('0x1')][_0x3d3c('0xe')],config[_0x3d3c('0x1')][_0x3d3c('0xf')],config['sequelize'][_0x3d3c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3d3c('0xb')]['database'],config['sequelizeHistory'][_0x3d3c('0xe')],config[_0x3d3c('0xb')][_0x3d3c('0xf')],config[_0x3d3c('0xb')][_0x3d3c('0x10')])};db[_0x3d3c('0x11')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x13'));db[_0x3d3c('0x14')]=db['sequelize'][_0x3d3c('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x3d3c('0x15')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x16'));db[_0x3d3c('0x17')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x18'));db[_0x3d3c('0x19')]=db['sequelize'][_0x3d3c('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x3d3c('0x1a')]=db[_0x3d3c('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0x3d3c('0x1b')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x1c'));db[_0x3d3c('0x1d')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x1e'));db['VoiceMailMessage']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x1f'));db[_0x3d3c('0x20')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x21'));db[_0x3d3c('0x22')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x23'));db[_0x3d3c('0x24')]=db['sequelize'][_0x3d3c('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x3d3c('0x25')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x26'));db[_0x3d3c('0x27')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x28'));db[_0x3d3c('0x29')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/trunk/trunk.model');db[_0x3d3c('0x2a')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x2b'));db[_0x3d3c('0x2c')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x2d'));db[_0x3d3c('0x2e')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x2f'));db['UserChatQueue']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x30'));db[_0x3d3c('0x31')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x32'));db[_0x3d3c('0x33')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x34'));db[_0x3d3c('0x35')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x36'));db[_0x3d3c('0x37')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x38'));db[_0x3d3c('0x39')]=db['sequelize'][_0x3d3c('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x3d3c('0x3a')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0x3d3c('0x3b')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x3c'));db[_0x3d3c('0x3d')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x3e'));db[_0x3d3c('0x3f')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x40'));db[_0x3d3c('0x41')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x42'));db[_0x3d3c('0x43')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x44'));db[_0x3d3c('0x45')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x46'));db[_0x3d3c('0x47')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x48'));db['MailQueueReport']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x49'));db['Dashboard']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x4a'));db[_0x3d3c('0x4b')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x4c'));db[_0x3d3c('0x4d')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x4e'));db[_0x3d3c('0x4f')]=db['sequelize'][_0x3d3c('0x12')]('../api/faxApplication/faxApplication.model');db[_0x3d3c('0x50')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x3d3c('0x51')]=db['sequelize']['import'](_0x3d3c('0x52'));db[_0x3d3c('0x53')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x54'));db['FaxQueueReport']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x55'));db['SmsAccount']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/smsAccount/smsAccount.model');db[_0x3d3c('0x56')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x57'));db[_0x3d3c('0x58')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x59'));db[_0x3d3c('0x5a')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x5b'));db[_0x3d3c('0x5c')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x5d'));db['OpenchannelAccount']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0x3d3c('0x5e')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x3d3c('0x5f')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x60'));db[_0x3d3c('0x61')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x62'));db[_0x3d3c('0x63')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x64'));db[_0x3d3c('0x65')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x66'));db[_0x3d3c('0x67')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x68'));db[_0x3d3c('0x69')]=db['sequelize']['import'](_0x3d3c('0x6a'));db['ChatMessage']=db[_0x3d3c('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x3d3c('0x6b')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x6c'));db['ChatQueue']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x6d'));db[_0x3d3c('0x6e')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x6f'));db['ChatProactiveAction']=db['sequelize']['import'](_0x3d3c('0x70'));db[_0x3d3c('0x71')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x72'));db[_0x3d3c('0x73')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/cmContact/cmContact.model');db[_0x3d3c('0x74')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x75'));db[_0x3d3c('0x76')]=db['sequelize'][_0x3d3c('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x3d3c('0x77')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x78'));db['CmHopperHistory']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x3d3c('0x79')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x7a'));db[_0x3d3c('0x7b')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x7c'));db[_0x3d3c('0x7d')]=db['sequelize']['import'](_0x3d3c('0x7e'));db[_0x3d3c('0x7f')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x3d3c('0x80')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x81'));db['Condition']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/condition/condition.model');db[_0x3d3c('0x82')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x83'));db[_0x3d3c('0x84')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x85'));db[_0x3d3c('0x86')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x87'));db[_0x3d3c('0x88')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x3d3c('0x1')]['import']('../api/schedule/schedule.model');db[_0x3d3c('0x89')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x8a'));db['Tag']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x8b'));db[_0x3d3c('0x8c')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x8d'));db[_0x3d3c('0x8e')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x8f'));db[_0x3d3c('0x90')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x91'));db[_0x3d3c('0x92')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/template/template.model');db['Trigger']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x93'));db[_0x3d3c('0x94')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/variable/variable.model');db['Integration']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x95'));db['IntegrationReport']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x96'));db['AnalyticCustomReport']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x97'));db['AnalyticDefaultReport']=db['sequelize'][_0x3d3c('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x3d3c('0x98')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x99'));db[_0x3d3c('0x9a')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x9b'));db[_0x3d3c('0x9c')]=db['sequelize'][_0x3d3c('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x3d3c('0x9d')]=db[_0x3d3c('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3d3c('0x9e')]=db[_0x3d3c('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x3d3c('0x9f')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xa0'));db[_0x3d3c('0xa1')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xa2'));db['SugarcrmConfiguration']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xa3'));db[_0x3d3c('0xa4')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x3d3c('0xa5')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xa6'));db[_0x3d3c('0xa7')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xa8'));db['DeskField']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xa9'));db['ZohoAccount']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xaa'));db[_0x3d3c('0xab')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xac'));db['ZohoField']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xad'));db[_0x3d3c('0xae')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xaf'));db[_0x3d3c('0xb0')]=db['sequelize']['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xb1'));db[_0x3d3c('0xb2')]=db['sequelize']['import'](_0x3d3c('0xb3'));db[_0x3d3c('0xb4')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xb5'));db[_0x3d3c('0xb6')]=db[_0x3d3c('0x1')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x3d3c('0xb7')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xb8'));db[_0x3d3c('0xb9')]=db['sequelize']['import'](_0x3d3c('0xba'));db['VtigerField']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xbb'));db['ServicenowAccount']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xbc'));db[_0x3d3c('0xbd')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xbe'));db['Dynamics365Account']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xbf'));db[_0x3d3c('0xc0')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xc1'));db[_0x3d3c('0xc2')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x3d3c('0xc3')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xc4'));db[_0x3d3c('0xc5')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xc6'));db[_0x3d3c('0xc7')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xc8'));db['Integration']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x95'));db[_0x3d3c('0xc9')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xca'));db['ChatQueueReport']=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0x3d3c('0xcb')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xcc'));db[_0x3d3c('0xcd')]=db[_0x3d3c('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3d3c('0xce')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x3d3c('0xcf')]=db[_0x3d3c('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x3d3c('0xd0')]=db['sequelize']['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x3d3c('0xd1')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xd2'));db['SquareDetailsReport']=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xd3'));db['JscriptyProject']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xd4'));db[_0x3d3c('0xd5')]=db['sequelize']['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xd6'));db[_0x3d3c('0xd7')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/squareProject/squareProject.model');db[_0x3d3c('0xd8')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xd9'));db[_0x3d3c('0xda')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xdb'));db[_0x3d3c('0xdc')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xdd'));db[_0x3d3c('0xde')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xdf'));db[_0x3d3c('0xe0')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xe1'));db[_0x3d3c('0xe2')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xe3'));db[_0x3d3c('0xe4')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xe5'));db[_0x3d3c('0xe6')]=db['sequelize']['import'](_0x3d3c('0xe7'));db[_0x3d3c('0xe8')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xe9'));db[_0x3d3c('0xea')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x3d3c('0xeb')]=db[_0x3d3c('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x3d3c('0xec')]=db[_0x3d3c('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x3d3c('0xed')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/smsTransferReport/smsTransferReport.model');db[_0x3d3c('0xee')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0xef'));db[_0x3d3c('0xf0')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xf1'));db[_0x3d3c('0xf2')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xf3'));db[_0x3d3c('0xf4')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xf5'));db[_0x3d3c('0xf6')]=db['sequelize']['import'](_0x3d3c('0xf7'));db[_0x3d3c('0xf8')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xf9'));db[_0x3d3c('0xfa')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0xfb'));db[_0x3d3c('0xfc')]=db['sequelize'][_0x3d3c('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x3d3c('0xfd')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xfe'));db['WhatsappQueueReport']=db[_0x3d3c('0x1')]['import'](_0x3d3c('0xff'));db[_0x3d3c('0x100')]=db['sequelize'][_0x3d3c('0x12')](_0x3d3c('0x101'));db[_0x3d3c('0x102')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x103'));db[_0x3d3c('0x104')]=db[_0x3d3c('0x1')]['import'](_0x3d3c('0x105'));db[_0x3d3c('0x106')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x107'));db[_0x3d3c('0x108')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x109'));db[_0x3d3c('0x10a')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x3d3c('0x10b')]=db[_0x3d3c('0x1')][_0x3d3c('0x12')](_0x3d3c('0x10c'));db[_0x3d3c('0x11')][_0x3d3c('0x10d')](db[_0x3d3c('0x1d')],{'as':_0x3d3c('0x1d'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')]['hasOne'](db[_0x3d3c('0x10b')],{'as':_0x3d3c('0x110'),'onDelete':'cascade','foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x112')],{'as':_0x3d3c('0x113'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x2c')],{'as':_0x3d3c('0x114'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x3d3c('0x10e'),'hooks':!![]});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x77')],{'as':_0x3d3c('0x115'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')]['hasMany'](db[_0x3d3c('0x116')],{'as':_0x3d3c('0x117'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db['ReportAgentPreview'],{'as':_0x3d3c('0x79'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x5f')],{'as':_0x3d3c('0x118'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x69')],{'as':_0x3d3c('0x119'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x58')],{'as':'SmsInteractions','foreignKey':_0x3d3c('0x10f')});db['User'][_0x3d3c('0x111')](db[_0x3d3c('0x50')],{'as':_0x3d3c('0x11a'),'foreignKey':'UserId'});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0x43')],{'as':_0x3d3c('0x11b'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')]['hasMany'](db[_0x3d3c('0xfc')],{'as':_0x3d3c('0x11c'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x11')][_0x3d3c('0x111')](db[_0x3d3c('0xf8')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x3d3c('0x11')][_0x3d3c('0x11d')](db['UserProfile'],{'as':_0x3d3c('0xf2'),'foreignKey':_0x3d3c('0x11e')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db['ChatGroup'],{'as':_0x3d3c('0x120'),'through':_0x3d3c('0x121')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x122'),'through':_0x3d3c('0x123')});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0xee')],{'as':'Lists','through':_0x3d3c('0x124')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db['Team'],{'through':'user_has_teams'});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db['MailInteraction'],{'as':_0x3d3c('0x11b'),'through':_0x3d3c('0x125')});db['User'][_0x3d3c('0x11f')](db[_0x3d3c('0x69')],{'as':_0x3d3c('0x119'),'through':_0x3d3c('0x126')});db[_0x3d3c('0x11')]['belongsToMany'](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x3d3c('0x127')});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x58')],{'as':_0x3d3c('0x128'),'through':'user_has_sms_interactions'});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x5f')],{'as':_0x3d3c('0x118'),'through':_0x3d3c('0x129')});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0xfc')],{'as':_0x3d3c('0x11c'),'through':_0x3d3c('0x12a')});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x1a')],{'as':_0x3d3c('0x12b'),'through':_0x3d3c('0x2e'),'required':![]});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0xf0')],{'as':'VoicePrefixes','through':_0x3d3c('0x10a'),'required':![]});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x3f')],{'as':_0x3d3c('0x12c'),'through':'UserMailQueue','required':![]});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x12d')],{'as':'ChatQueues','through':_0x3d3c('0x12e'),'required':![],'hooks':!![]});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x53')],{'as':_0x3d3c('0x12f'),'through':_0x3d3c('0x33'),'required':![]});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x5c')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x130')],{'as':_0x3d3c('0x131'),'through':_0x3d3c('0x37'),'required':![]});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db['WhatsappQueue'],{'as':_0x3d3c('0x132'),'through':_0x3d3c('0x39'),'required':![]});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0xee')],{'through':_0x3d3c('0x124')});db[_0x3d3c('0x11')]['belongsToMany'](db[_0x3d3c('0x63')],{'as':_0x3d3c('0x133'),'through':_0x3d3c('0x134')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x4d')],{'as':_0x3d3c('0x135'),'through':_0x3d3c('0x136')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x3d')],{'as':_0x3d3c('0x137'),'through':_0x3d3c('0x138')});db['User'][_0x3d3c('0x11f')](db[_0x3d3c('0x139')],{'as':_0x3d3c('0x13a'),'through':_0x3d3c('0x13b')});db[_0x3d3c('0x11')][_0x3d3c('0x11f')](db[_0x3d3c('0x13c')],{'as':_0x3d3c('0x13d'),'through':_0x3d3c('0x13e')});db['User'][_0x3d3c('0x11f')](db[_0x3d3c('0xfa')],{'as':_0x3d3c('0x13f'),'through':_0x3d3c('0x140')});db['VoiceChanSpy']['hasMany'](db[_0x3d3c('0x17')],{'as':_0x3d3c('0x141'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x3d3c('0x15')][_0x3d3c('0x111')](db[_0x3d3c('0x17')],{'onDelete':'cascade'});db[_0x3d3c('0x17')][_0x3d3c('0x111')](db[_0x3d3c('0x17')],{'as':'Applications','onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x19')][_0x3d3c('0x11f')](db[_0x3d3c('0x89')],{'as':'Sounds','through':_0x3d3c('0x142')});db[_0x3d3c('0x1a')]['hasMany'](db[_0x3d3c('0x2c')],{'as':_0x3d3c('0x143'),'foreignKey':_0x3d3c('0x144')});db[_0x3d3c('0x1a')][_0x3d3c('0x111')](db[_0x3d3c('0x74')],{'as':_0x3d3c('0x145'),'foreignKey':_0x3d3c('0x144')});db[_0x3d3c('0x1a')]['hasMany'](db[_0x3d3c('0x77')],{'as':_0x3d3c('0x115'),'foreignKey':'VoiceQueueId'});db[_0x3d3c('0x1a')][_0x3d3c('0x111')](db[_0x3d3c('0x116')],{'as':_0x3d3c('0x146'),'foreignKey':_0x3d3c('0x144')});db[_0x3d3c('0x1a')][_0x3d3c('0x111')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x3d3c('0x144')});db['VoiceQueue'][_0x3d3c('0x111')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x3d3c('0x1a')][_0x3d3c('0x111')](db[_0x3d3c('0xcf')],{'as':_0x3d3c('0x147'),'foreignKey':'VoiceQueueId'});db[_0x3d3c('0x1a')][_0x3d3c('0x11d')](db[_0x3d3c('0x29')],{'as':_0x3d3c('0x29'),'foreignKey':_0x3d3c('0x148')});db[_0x3d3c('0x1a')][_0x3d3c('0x11d')](db[_0x3d3c('0x29')],{'as':_0x3d3c('0x149'),'foreignKey':_0x3d3c('0x14a')});db[_0x3d3c('0x1a')]['belongsTo'](db['Interval'],{'as':_0x3d3c('0x82'),'foreignKey':_0x3d3c('0x14b')});db['VoiceQueue'][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3d3c('0x1a')]['belongsToMany'](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x14c'),'through':_0x3d3c('0x14d')});db['VoiceQueue']['belongsToMany'](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x2e')});db[_0x3d3c('0x1a')][_0x3d3c('0x11f')](db['Team'],{'as':'Teams','through':_0x3d3c('0x106')});db['VoiceQueue'][_0x3d3c('0x11f')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x14f'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':'User','foreignKey':'UserId'});db[_0x3d3c('0x1b')]['belongsTo'](db[_0x3d3c('0x11')],{'as':'User','foreignKey':_0x3d3c('0x10f')});db['VoiceMail']['hasMany'](db[_0x3d3c('0x150')],{'as':'Messages','onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x151'),'sourceKey':'mailbox'});db[_0x3d3c('0x150')][_0x3d3c('0x11d')](db['VoiceMail'],{'foreignKey':_0x3d3c('0x151'),'targetKey':_0x3d3c('0x152')});db[_0x3d3c('0x20')]['hasMany'](db[_0x3d3c('0x25')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x3d3c('0x20')][_0x3d3c('0x111')](db[_0x3d3c('0x24')],{'as':_0x3d3c('0x153'),'foreignKey':_0x3d3c('0x154'),'constraints':![]});db[_0x3d3c('0x20')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':'User','foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x20')]['belongsTo'](db['CmContact'],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x3a')][_0x3d3c('0x11d')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x3d3c('0x156')});db[_0x3d3c('0x3a')][_0x3d3c('0x11d')](db[_0x3d3c('0x104')],{'as':_0x3d3c('0x104'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x3d3c('0x3b')]['belongsTo'](db[_0x3d3c('0x3d')],{'as':_0x3d3c('0x3d'),'foreignKey':_0x3d3c('0x156')});db[_0x3d3c('0x3b')]['belongsTo'](db[_0x3d3c('0x104')],{'as':'CloudProvider','foreignKey':_0x3d3c('0x157'),'onDelete':'restrict'});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0x3d3c('0x158'),'onDelete':_0x3d3c('0x10e')});db['MailAccount']['hasOne'](db[_0x3d3c('0x3b')],{'as':_0x3d3c('0x159'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x3d')]['hasMany'](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x156'),'onDelete':'cascade'});db['MailAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x7f')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x3d3c('0x3d')][_0x3d3c('0x111')](db[_0x3d3c('0x45')],{'as':'Messages','foreignKey':_0x3d3c('0x156')});db['MailAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x43')],{'as':'Interactions'});db['MailAccount']['hasMany'](db[_0x3d3c('0x47')],{'as':'Applications'});db[_0x3d3c('0x3d')][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db['MailAccount'][_0x3d3c('0x11d')](db[_0x3d3c('0x92')],{'as':_0x3d3c('0x92'),'foreignKey':_0x3d3c('0x15d')});db[_0x3d3c('0x3d')][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':_0x3d3c('0x15e'),'foreignKey':_0x3d3c('0x15f')});db[_0x3d3c('0x3d')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x138')});db[_0x3d3c('0x3f')][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x31')});db[_0x3d3c('0x3f')]['belongsToMany'](db[_0x3d3c('0xdc')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x3d3c('0x111')](db[_0x3d3c('0x45')],{'as':'Messages','onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x160')});db[_0x3d3c('0x43')][_0x3d3c('0x11d')](db[_0x3d3c('0x3d')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x156')});db[_0x3d3c('0x43')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x43')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':'UserId'});db[_0x3d3c('0x43')][_0x3d3c('0x11f')](db['Tag'],{'through':_0x3d3c('0x164'),'as':_0x3d3c('0x165')});db['MailInteraction'][_0x3d3c('0x11f')](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x164'),'as':_0x3d3c('0x167')});db['MailInteraction'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':'Users','through':_0x3d3c('0x125'),'foreignKey':_0x3d3c('0x160')});db[_0x3d3c('0x45')]['hasMany'](db['Attachment'],{'as':_0x3d3c('0x168'),'onDelete':'cascade'});db[_0x3d3c('0x45')]['belongsTo'](db[_0x3d3c('0x11')],{'as':'User'});db[_0x3d3c('0x45')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'onDelete':'cascade','as':_0x3d3c('0x155')});db[_0x3d3c('0x45')]['belongsTo'](db[_0x3d3c('0x43')],{'as':_0x3d3c('0x169'),'foreignKey':_0x3d3c('0x160')});db[_0x3d3c('0x45')]['belongsTo'](db[_0x3d3c('0x3d')],{'as':'Account','foreignKey':_0x3d3c('0x156')});db[_0x3d3c('0x45')]['belongsTo'](db[_0x3d3c('0x63')],{'as':_0x3d3c('0x63'),'foreignKey':_0x3d3c('0x16a')});db[_0x3d3c('0x45')][_0x3d3c('0x11d')](db[_0x3d3c('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0x3d3c('0x16b')});db[_0x3d3c('0x47')]['belongsTo'](db[_0x3d3c('0x11')],{'onDelete':'restrict'});db[_0x3d3c('0x47')][_0x3d3c('0x11d')](db[_0x3d3c('0x3f')],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x47')][_0x3d3c('0x11d')](db[_0x3d3c('0x3d')],{'onDelete':_0x3d3c('0x16c')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x47')]['belongsTo'](db[_0x3d3c('0x166')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x3d3c('0x16d')]['belongsTo'](db[_0x3d3c('0x3d')],{});db[_0x3d3c('0x16d')][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':'ListId'});db[_0x3d3c('0x16d')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x43')],{});db['MailQueueReport']['belongsTo'](db[_0x3d3c('0x45')],{});db[_0x3d3c('0x16d')]['belongsTo'](db[_0x3d3c('0x11')],{});db[_0x3d3c('0x16d')]['belongsTo'](db[_0x3d3c('0x3f')],{});db[_0x3d3c('0x16e')][_0x3d3c('0x111')](db['DashboardItem'],{'as':'Items','onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x4d')][_0x3d3c('0x111')](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x16f'),'onDelete':'cascade'});db[_0x3d3c('0x4d')][_0x3d3c('0x111')](db[_0x3d3c('0x7f')],{'as':_0x3d3c('0x170'),'foreignKey':_0x3d3c('0x16f')});db['FaxAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x50')],{'as':_0x3d3c('0x171')});db[_0x3d3c('0x4d')][_0x3d3c('0x111')](db[_0x3d3c('0x4f')],{'as':_0x3d3c('0x172')});db[_0x3d3c('0x4d')][_0x3d3c('0x111')](db[_0x3d3c('0x17')],{'as':_0x3d3c('0x173'),'onDelete':'cascade'});db[_0x3d3c('0x4d')]['hasMany'](db[_0x3d3c('0x51')],{'as':'Messages'});db[_0x3d3c('0x4d')][_0x3d3c('0x11d')](db['Trunk'],{'as':_0x3d3c('0x29')});db[_0x3d3c('0x4d')][_0x3d3c('0x11d')](db['CmList'],{'as':'List','foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0x4d')][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x3d3c('0x15f')});db[_0x3d3c('0x4d')]['belongsToMany'](db[_0x3d3c('0x11')],{'as':'Agents','through':_0x3d3c('0x136')});db['FaxApplication'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x4f')][_0x3d3c('0x11d')](db['FaxQueue'],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x4f')][_0x3d3c('0x11d')](db[_0x3d3c('0x4d')],{'onDelete':_0x3d3c('0x16c')});db['FaxApplication']['belongsTo'](db[_0x3d3c('0x166')],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x174')});db[_0x3d3c('0x50')][_0x3d3c('0x111')](db[_0x3d3c('0x51')],{'as':_0x3d3c('0x175'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'FaxInteractionId'});db[_0x3d3c('0x50')][_0x3d3c('0x11d')](db['FaxAccount'],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x16f')});db['FaxInteraction'][_0x3d3c('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x50')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':'UserId'});db[_0x3d3c('0x50')][_0x3d3c('0x11f')](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x176'),'as':_0x3d3c('0x165')});db[_0x3d3c('0x50')]['belongsToMany'](db['Tag'],{'through':_0x3d3c('0x176'),'as':_0x3d3c('0x167')});db[_0x3d3c('0x50')][_0x3d3c('0x11f')](db['User'],{'as':'Users','through':_0x3d3c('0x127'),'foreignKey':_0x3d3c('0x177')});db[_0x3d3c('0x51')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x11')});db[_0x3d3c('0x51')][_0x3d3c('0x11d')](db[_0x3d3c('0x50')],{'as':_0x3d3c('0x169'),'foreignKey':'FaxInteractionId'});db[_0x3d3c('0x51')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'onDelete':'cascade','as':_0x3d3c('0x155')});db[_0x3d3c('0x51')][_0x3d3c('0x11d')](db[_0x3d3c('0xe4')],{'as':_0x3d3c('0xe4'),'foreignKey':_0x3d3c('0x178')});db[_0x3d3c('0x51')][_0x3d3c('0x11d')](db[_0x3d3c('0x4d')],{'as':'Account','foreignKey':_0x3d3c('0x16f')});db['FaxQueue'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x33')});db[_0x3d3c('0x53')][_0x3d3c('0x11f')](db[_0x3d3c('0xdc')],{'through':_0x3d3c('0x179'),'as':_0x3d3c('0x17a')});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0x4d')],{});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':'List','foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0x17b')]['belongsTo'](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0x50')],{});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0x51')],{});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{});db[_0x3d3c('0x17b')][_0x3d3c('0x11d')](db[_0x3d3c('0x53')],{});db[_0x3d3c('0x13c')]['hasMany'](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x17c'),'onDelete':_0x3d3c('0x10e')});db['SmsAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x7f')],{'as':'Answers','foreignKey':_0x3d3c('0x17c')});db[_0x3d3c('0x13c')][_0x3d3c('0x111')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x3d3c('0x17c')});db['SmsAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x58')],{'as':'Interactions'});db[_0x3d3c('0x13c')][_0x3d3c('0x111')](db[_0x3d3c('0x56')],{'as':_0x3d3c('0x172')});db['SmsAccount']['belongsTo'](db[_0x3d3c('0xee')],{'as':'List','foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0x13c')][_0x3d3c('0x11d')](db['Pause'],{'as':_0x3d3c('0x15e'),'foreignKey':_0x3d3c('0x15f')});db['SmsAccount'][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x14e'),'through':'user_has_sms_accounts'});db[_0x3d3c('0x56')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x56')][_0x3d3c('0x11d')](db[_0x3d3c('0x5c')],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x56')][_0x3d3c('0x11d')](db[_0x3d3c('0x13c')],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x56')][_0x3d3c('0x11d')](db[_0x3d3c('0x82')],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x56')][_0x3d3c('0x11d')](db['Tag'],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x174')});db[_0x3d3c('0x58')][_0x3d3c('0x111')](db['SmsMessage'],{'as':_0x3d3c('0x175'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x3d3c('0x11d')](db[_0x3d3c('0x13c')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x17c')});db[_0x3d3c('0x58')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x58')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x58')][_0x3d3c('0x11f')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x3d3c('0x165')});db[_0x3d3c('0x58')]['belongsToMany'](db['Tag'],{'through':_0x3d3c('0x17d'),'as':'ThroughTags'});db[_0x3d3c('0x58')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x17e'),'through':'user_has_sms_interactions','foreignKey':_0x3d3c('0x17f')});db[_0x3d3c('0x5a')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x11')});db[_0x3d3c('0x5a')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x155')});db['SmsMessage'][_0x3d3c('0x11d')](db[_0x3d3c('0x58')],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x169'),'foreignKey':'SmsInteractionId'});db[_0x3d3c('0x5a')][_0x3d3c('0x11d')](db[_0x3d3c('0x13c')],{'as':_0x3d3c('0x161'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x35'),'foreignKey':_0x3d3c('0x180')});db[_0x3d3c('0x5c')][_0x3d3c('0x11f')](db[_0x3d3c('0xdc')],{'through':_0x3d3c('0x181'),'as':'Teams'});db[_0x3d3c('0x139')][_0x3d3c('0x111')](db['Disposition'],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x182'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x139')][_0x3d3c('0x111')](db[_0x3d3c('0x7f')],{'as':_0x3d3c('0x170'),'foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x139')][_0x3d3c('0x111')](db[_0x3d3c('0x5f')],{'as':_0x3d3c('0x171'),'foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x139')][_0x3d3c('0x111')](db[_0x3d3c('0x61')],{'as':'Messages','foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x139')]['hasMany'](db[_0x3d3c('0x5e')],{'as':_0x3d3c('0x172'),'foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x139')][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db['OpenchannelAccount'][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x3d3c('0x15f')});db[_0x3d3c('0x139')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x3d3c('0x11d')](db['User'],{'onDelete':'restrict'});db[_0x3d3c('0x5e')][_0x3d3c('0x11d')](db[_0x3d3c('0x130')],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x183')});db['OpenchannelApplication'][_0x3d3c('0x11d')](db['OpenchannelAccount'],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x5e')][_0x3d3c('0x11d')](db[_0x3d3c('0x82')],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x5e')][_0x3d3c('0x11d')](db[_0x3d3c('0x166')],{'onDelete':_0x3d3c('0x16c'),'foreignKey':'TagId'});db[_0x3d3c('0x5f')]['hasMany'](db[_0x3d3c('0x61')],{'as':_0x3d3c('0x175'),'onDelete':'cascade','foreignKey':_0x3d3c('0x184')});db[_0x3d3c('0x5f')][_0x3d3c('0x11d')](db['OpenchannelAccount'],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x182')});db[_0x3d3c('0x5f')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x5f')]['belongsTo'](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x5f')][_0x3d3c('0x11f')](db['Tag'],{'through':_0x3d3c('0x185'),'as':_0x3d3c('0x165')});db[_0x3d3c('0x5f')][_0x3d3c('0x11f')](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x185'),'as':_0x3d3c('0x167')});db[_0x3d3c('0x5f')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x3d3c('0x61')]['belongsTo'](db[_0x3d3c('0x11')],{'onDelete':'cascade','as':_0x3d3c('0x11')});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x155')});db[_0x3d3c('0x61')][_0x3d3c('0x11d')](db[_0x3d3c('0x5f')],{'onDelete':'cascade','as':_0x3d3c('0x169'),'foreignKey':_0x3d3c('0x184')});db[_0x3d3c('0x61')][_0x3d3c('0x11d')](db['Attachment'],{'as':_0x3d3c('0xe4'),'foreignKey':_0x3d3c('0x178')});db['OpenchannelMessage'][_0x3d3c('0x11d')](db['OpenchannelAccount'],{'as':_0x3d3c('0x161'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x37'),'foreignKey':_0x3d3c('0x183')});db['OpenchannelQueue'][_0x3d3c('0x11f')](db[_0x3d3c('0xdc')],{'through':_0x3d3c('0x186'),'as':_0x3d3c('0x17a')});db[_0x3d3c('0x63')]['hasMany'](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':'ChatWebsiteId','onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x63')][_0x3d3c('0x111')](db['CannedAnswer'],{'as':_0x3d3c('0x170'),'foreignKey':_0x3d3c('0x16a')});db[_0x3d3c('0x63')][_0x3d3c('0x111')](db[_0x3d3c('0x187')],{'as':_0x3d3c('0x188')});db[_0x3d3c('0x63')][_0x3d3c('0x111')](db[_0x3d3c('0x69')],{'as':_0x3d3c('0x171')});db[_0x3d3c('0x63')]['hasMany'](db[_0x3d3c('0x67')],{'as':_0x3d3c('0x172')});db[_0x3d3c('0x63')][_0x3d3c('0x111')](db[_0x3d3c('0x189')],{'as':_0x3d3c('0x175')});db['ChatWebsite'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db['ChatWebsite']['belongsTo'](db[_0x3d3c('0x82')],{'as':_0x3d3c('0x82'),'foreignKey':'IntervalId'});db[_0x3d3c('0x63')][_0x3d3c('0x11d')](db[_0x3d3c('0x3d')],{'as':_0x3d3c('0x3d'),'foreignKey':_0x3d3c('0x156')});db[_0x3d3c('0x63')][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3d3c('0x63')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x134')});db[_0x3d3c('0x65')][_0x3d3c('0x11d')](db[_0x3d3c('0x139')],{});db[_0x3d3c('0x65')][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x65')]['belongsTo'](db[_0x3d3c('0x5f')],{});db[_0x3d3c('0x65')][_0x3d3c('0x11d')](db[_0x3d3c('0x61')],{});db[_0x3d3c('0x65')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{});db[_0x3d3c('0x65')]['belongsTo'](db[_0x3d3c('0x130')],{});db['ChatApplication'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x18a'),'foreignKey':_0x3d3c('0x10f'),'onDelete':'restrict'});db['ChatApplication'][_0x3d3c('0x11d')](db[_0x3d3c('0x12d')],{'as':_0x3d3c('0x18b'),'foreignKey':_0x3d3c('0x18c'),'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x67')]['belongsTo'](db[_0x3d3c('0x63')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x3d3c('0x166')],{'onDelete':'restrict','foreignKey':_0x3d3c('0x174')});db[_0x3d3c('0x69')][_0x3d3c('0x111')](db[_0x3d3c('0x189')],{'as':_0x3d3c('0x175'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x18d')});db[_0x3d3c('0x69')][_0x3d3c('0x11d')](db[_0x3d3c('0x63')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x16a')});db[_0x3d3c('0x69')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x69')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':'Owner','foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x69')]['belongsToMany'](db['Tag'],{'through':_0x3d3c('0x18e'),'as':_0x3d3c('0x165')});db[_0x3d3c('0x69')][_0x3d3c('0x11f')](db['Tag'],{'through':_0x3d3c('0x18e'),'as':_0x3d3c('0x167')});db[_0x3d3c('0x69')][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x17e'),'through':_0x3d3c('0x126'),'foreignKey':_0x3d3c('0x18d')});db['ChatMessage']['belongsTo'](db[_0x3d3c('0x11')],{'onDelete':'cascade','as':_0x3d3c('0x11')});db['ChatMessage'][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x189')][_0x3d3c('0x11d')](db[_0x3d3c('0x69')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x3d3c('0x18d')});db['ChatMessage'][_0x3d3c('0x11d')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x3d3c('0x189')][_0x3d3c('0x11d')](db[_0x3d3c('0x63')],{'as':_0x3d3c('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x3d3c('0x111')](db[_0x3d3c('0xe4')],{'as':_0x3d3c('0x168'),'foreignKey':_0x3d3c('0x16b'),'onDelete':_0x3d3c('0x10e'),'hooks':!![]});db[_0x3d3c('0x6b')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x16a')});db[_0x3d3c('0x12d')][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x12e'),'hooks':!![]});db[_0x3d3c('0x12d')]['belongsToMany'](db[_0x3d3c('0xdc')],{'through':_0x3d3c('0x18f'),'as':_0x3d3c('0x17a')});db[_0x3d3c('0x6e')]['hasMany'](db[_0x3d3c('0xcb')],{'as':'Messages','foreignKey':_0x3d3c('0x190'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x6e')][_0x3d3c('0x11f')](db['User'],{'as':_0x3d3c('0x143'),'through':_0x3d3c('0x121')});db[_0x3d3c('0x187')][_0x3d3c('0x11d')](db['ChatWebsite'],{'as':_0x3d3c('0x191'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x3d3c('0x111')](db['CmContact'],{'as':_0x3d3c('0x122'),'foreignKey':_0x3d3c('0x192')});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db[_0x3d3c('0x8e')],{'as':'Phones','foreignKey':_0x3d3c('0x193')});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db[_0x3d3c('0x74')],{'as':_0x3d3c('0x145'),'foreignKey':_0x3d3c('0x162')});db['CmContact'][_0x3d3c('0x111')](db[_0x3d3c('0x77')],{'as':_0x3d3c('0x115'),'foreignKey':_0x3d3c('0x162')});db['CmContact'][_0x3d3c('0x111')](db[_0x3d3c('0x116')],{'as':_0x3d3c('0x146'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db[_0x3d3c('0x79')],{'as':_0x3d3c('0x79'),'foreignKey':_0x3d3c('0x162')});db['CmContact'][_0x3d3c('0x111')](db['JscriptySessionReport'],{'as':_0x3d3c('0x147'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x73')]['hasMany'](db[_0x3d3c('0x5f')],{'as':_0x3d3c('0x118'),'foreignKey':_0x3d3c('0x162'),'onDelete':'restrict'});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db['ChatInteraction'],{'as':_0x3d3c('0x119'),'foreignKey':'ContactId','onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db[_0x3d3c('0x58')],{'as':_0x3d3c('0x128'),'foreignKey':'ContactId','onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x73')][_0x3d3c('0x111')](db[_0x3d3c('0x50')],{'as':'FaxInteractions','foreignKey':_0x3d3c('0x162'),'onDelete':_0x3d3c('0x16c')});db['CmContact'][_0x3d3c('0x111')](db[_0x3d3c('0x43')],{'as':'MailInteractions','foreignKey':_0x3d3c('0x162'),'onDelete':'restrict'});db['CmContact'][_0x3d3c('0x11d')](db['CmCompany'],{'as':_0x3d3c('0x194'),'foreignKey':'CompanyId'});db['CmContact'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x73')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':'Users','through':_0x3d3c('0x123')});db['CmContact']['belongsToMany'](db[_0x3d3c('0x166')],{'as':_0x3d3c('0x165'),'through':_0x3d3c('0x195')});db[_0x3d3c('0x73')][_0x3d3c('0x11f')](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x195'),'as':'ThroughTags'});db['CmHopper'][_0x3d3c('0x111')](db[_0x3d3c('0x90')],{'as':_0x3d3c('0x196'),'foreignKey':_0x3d3c('0x197')});db['CmHopper'][_0x3d3c('0x11d')](db['CmContact'],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x3d3c('0x74')]['belongsTo'](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c'),'onDelete':'cascade'});db['CmHopper'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x18a'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0x74')][_0x3d3c('0x11d')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x3d3c('0x144'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x3d3c('0xe0')],{'as':_0x3d3c('0xe0'),'foreignKey':_0x3d3c('0x198'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x74')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':_0x3d3c('0x199')});db[_0x3d3c('0x76')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162'),'onDelete':_0x3d3c('0x10e')});db['CmHopperBlack'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x76')][_0x3d3c('0x11d')](db['VoiceQueue'],{'as':_0x3d3c('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x76')][_0x3d3c('0x11d')](db[_0x3d3c('0xe0')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0x7d')][_0x3d3c('0x111')](db[_0x3d3c('0x19a')],{'as':{'plural':_0x3d3c('0x19b'),'singular':'OneAll'},'foreignKey':_0x3d3c('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x3d3c('0x7d')]['hasMany'](db[_0x3d3c('0x19a')],{'as':{'plural':_0x3d3c('0x19d'),'singular':_0x3d3c('0x19e')},'foreignKey':_0x3d3c('0x19f'),'onDelete':_0x3d3c('0x10e'),'hooks':!![]});db[_0x3d3c('0x7d')][_0x3d3c('0x111')](db['Action'],{'as':_0x3d3c('0x1a0'),'foreignKey':_0x3d3c('0x1a1'),'onDelete':_0x3d3c('0x10e'),'hooks':!![]});db['Disposition'][_0x3d3c('0x111')](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x1a2'),'onDelete':'cascade'});db['Interval'][_0x3d3c('0x111')](db[_0x3d3c('0x82')],{'as':'Intervals','foreignKey':_0x3d3c('0x14b'),'onDelete':_0x3d3c('0x10e'),'hooks':!![],'required':![]});db[_0x3d3c('0x82')][_0x3d3c('0x111')](db[_0x3d3c('0x17')],{'as':_0x3d3c('0x1a3'),'foreignKey':_0x3d3c('0x14b'),'onDelete':'restrict'});db['Interval'][_0x3d3c('0x111')](db[_0x3d3c('0x47')],{'as':_0x3d3c('0x1a4'),'foreignKey':'IntervalId'});db[_0x3d3c('0x82')][_0x3d3c('0x111')](db[_0x3d3c('0x67')],{'as':'ChatApplications','foreignKey':_0x3d3c('0x14b')});db['Interval'][_0x3d3c('0x111')](db['FaxApplication'],{'as':_0x3d3c('0x1a5'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x82')][_0x3d3c('0x111')](db[_0x3d3c('0x56')],{'as':_0x3d3c('0x1a6'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x1a7')][_0x3d3c('0x11d')](db['MailAccount'],{});db[_0x3d3c('0x1a7')][_0x3d3c('0x11d')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x3d3c('0x1a7')][_0x3d3c('0x11d')](db[_0x3d3c('0x1a8')],{'foreignKey':_0x3d3c('0x1a9')});db[_0x3d3c('0x89')][_0x3d3c('0x11f')](db[_0x3d3c('0x19')],{'as':_0x3d3c('0x1aa'),'through':_0x3d3c('0x142'),'onDelete':_0x3d3c('0x16c')});db['Tag'][_0x3d3c('0x11f')](db[_0x3d3c('0x73')],{'through':_0x3d3c('0x195')});db[_0x3d3c('0x166')]['belongsToMany'](db[_0x3d3c('0x69')],{'through':'chat_interaction_has_tags'});db[_0x3d3c('0x166')][_0x3d3c('0x11f')](db[_0x3d3c('0x43')],{'through':'mail_interaction_has_tags'});db[_0x3d3c('0x166')][_0x3d3c('0x11f')](db[_0x3d3c('0x58')],{'through':_0x3d3c('0x17d')});db[_0x3d3c('0x166')][_0x3d3c('0x11f')](db['FaxInteraction'],{'through':_0x3d3c('0x176')});db[_0x3d3c('0x166')][_0x3d3c('0x11f')](db[_0x3d3c('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x3d3c('0x166')]['belongsToMany'](db[_0x3d3c('0xfc')],{'through':'whatsapp_interaction_has_tags'});db[_0x3d3c('0x8e')][_0x3d3c('0x11d')](db[_0x3d3c('0x8c')],{'as':_0x3d3c('0x1ab'),'foreignKey':_0x3d3c('0x1ac')});db[_0x3d3c('0x90')][_0x3d3c('0x11d')](db['CmHopper'],{'as':'Hopper','foreignKey':_0x3d3c('0x197')});db['CmContactHasItem'][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x193')});db[_0x3d3c('0x1ad')][_0x3d3c('0x111')](db[_0x3d3c('0x19a')],{'as':{'plural':_0x3d3c('0x1ae'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x3d3c('0x1ad')][_0x3d3c('0x111')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x3d3c('0x1af')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x3d3c('0x1ad')][_0x3d3c('0x111')](db['Action'],{'as':_0x3d3c('0x1a0'),'foreignKey':'TriggerId','onDelete':_0x3d3c('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x3d3c('0x111')](db[_0x3d3c('0x9c')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x3d3c('0x1b1')][_0x3d3c('0x111')](db[_0x3d3c('0x9c')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'DefaultReportId'});db[_0x3d3c('0x9a')][_0x3d3c('0x111')](db[_0x3d3c('0x9c')],{'as':_0x3d3c('0x1b0'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x3d3c('0x9c')]['belongsTo'](db[_0x3d3c('0x9a')],{'foreignKey':'MetricId'});db[_0x3d3c('0x9e')]['hasMany'](db[_0x3d3c('0x1b2')],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'AccountId'});db[_0x3d3c('0x1b2')][_0x3d3c('0x111')](db['SalesforceField'],{'as':_0x3d3c('0x1b4'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0x1b2')][_0x3d3c('0x111')](db[_0x3d3c('0x9f')],{'as':'Descriptions','onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0x1b2')][_0x3d3c('0x111')](db[_0x3d3c('0x9f')],{'as':'Fields','onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0x1b2')][_0x3d3c('0x11d')](db[_0x3d3c('0x9e')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0x9f')]['hasMany'](db[_0x3d3c('0x9f')],{'as':'Subject','foreignKey':_0x3d3c('0x1b5')});db['SalesforceField'][_0x3d3c('0x111')](db[_0x3d3c('0x9f')],{'as':_0x3d3c('0x1b9'),'foreignKey':_0x3d3c('0x1b6')});db['SalesforceField'][_0x3d3c('0x111')](db['SalesforceField'],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0x9f')][_0x3d3c('0x11d')](db['Variable'],{'as':_0x3d3c('0x94'),'foreignKey':'VariableId'});db[_0x3d3c('0xa1')][_0x3d3c('0x111')](db[_0x3d3c('0x1bb')],{'as':_0x3d3c('0x1b3'),'onDelete':'cascade','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0x1bb')][_0x3d3c('0x111')](db[_0x3d3c('0xa4')],{'as':_0x3d3c('0x1b4'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db['SugarcrmConfiguration']['hasMany'](db[_0x3d3c('0xa4')],{'as':_0x3d3c('0x1bc'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0x1bb')][_0x3d3c('0x111')](db[_0x3d3c('0xa4')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b7')});db['SugarcrmConfiguration'][_0x3d3c('0x11d')](db[_0x3d3c('0xa1')],{'as':_0x3d3c('0x161'),'foreignKey':'AccountId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x3d3c('0x1bd'),'foreignKey':_0x3d3c('0x1b5')});db['SugarcrmField'][_0x3d3c('0x111')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0xa4')][_0x3d3c('0x111')](db[_0x3d3c('0xa4')],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xa4')][_0x3d3c('0x11d')](db['Variable'],{'as':'Variable','foreignKey':_0x3d3c('0x1be')});db[_0x3d3c('0xa5')]['hasMany'](db[_0x3d3c('0xa7')],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xa7')][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1b4'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xa7')][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1bc'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'DescriptionId'});db[_0x3d3c('0xa7')][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'FieldId'});db[_0x3d3c('0xa7')][_0x3d3c('0x11d')](db[_0x3d3c('0xa5')],{'as':_0x3d3c('0x161'),'foreignKey':'AccountId'});db[_0x3d3c('0xa7')]['belongsToMany'](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x1c0')});db[_0x3d3c('0x1bf')][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1bd'),'foreignKey':'SubjectId'});db[_0x3d3c('0x1bf')][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1b9'),'foreignKey':_0x3d3c('0x1b6')});db['DeskField'][_0x3d3c('0x111')](db[_0x3d3c('0x1bf')],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0x1bf')][_0x3d3c('0x11d')](db['Variable'],{'as':_0x3d3c('0x94'),'foreignKey':_0x3d3c('0x1be')});db[_0x3d3c('0x1c1')][_0x3d3c('0x111')](db[_0x3d3c('0xab')],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x3d3c('0x111')](db['ZohoField'],{'as':_0x3d3c('0x1b4'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db['ZohoConfiguration'][_0x3d3c('0x111')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x3d3c('0x10e'),'foreignKey':'DescriptionId'});db[_0x3d3c('0xab')][_0x3d3c('0x111')](db[_0x3d3c('0x1c2')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'FieldId'});db[_0x3d3c('0xab')][_0x3d3c('0x11d')](db[_0x3d3c('0x1c1')],{'as':'Account','foreignKey':'AccountId'});db[_0x3d3c('0x1c2')][_0x3d3c('0x111')](db[_0x3d3c('0x1c2')],{'as':_0x3d3c('0x1bd'),'foreignKey':'SubjectId'});db['ZohoField'][_0x3d3c('0x111')](db[_0x3d3c('0x1c2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3d3c('0x1c2')][_0x3d3c('0x111')](db[_0x3d3c('0x1c2')],{'as':_0x3d3c('0x1ba'),'foreignKey':'FieldId'});db[_0x3d3c('0x1c2')][_0x3d3c('0x11d')](db[_0x3d3c('0x94')],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount'][_0x3d3c('0x111')](db[_0x3d3c('0xb0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xb0')][_0x3d3c('0x111')](db[_0x3d3c('0x1c3')],{'as':'Subjects','foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xb0')][_0x3d3c('0x111')](db[_0x3d3c('0x1c3')],{'as':_0x3d3c('0x1bc'),'foreignKey':'DescriptionId'});db[_0x3d3c('0xb0')][_0x3d3c('0x111')](db[_0x3d3c('0x1c3')],{'as':'Fields','foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xb0')][_0x3d3c('0x11d')](db['ZendeskAccount'],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xb0')]['belongsToMany'](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x1c4')});db[_0x3d3c('0x1c3')][_0x3d3c('0x111')](db[_0x3d3c('0x1c3')],{'as':_0x3d3c('0x1bd'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0x1c3')]['hasMany'](db['ZendeskField'],{'as':_0x3d3c('0x1b9'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x3d3c('0x111')](db[_0x3d3c('0x1c3')],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db['ZendeskField'][_0x3d3c('0x11d')](db[_0x3d3c('0x94')],{'as':_0x3d3c('0x94'),'foreignKey':_0x3d3c('0x1be')});db['FreshdeskAccount']['hasMany'](db[_0x3d3c('0xb4')],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xb4')][_0x3d3c('0x111')](db[_0x3d3c('0xb6')],{'as':'Subjects','onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xb4')][_0x3d3c('0x111')](db['FreshdeskField'],{'as':_0x3d3c('0x1bc'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b6')});db['FreshdeskConfiguration'][_0x3d3c('0x111')](db[_0x3d3c('0xb6')],{'as':_0x3d3c('0x1b0'),'onDelete':'cascade','foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xb4')][_0x3d3c('0x11d')](db[_0x3d3c('0xb2')],{'as':_0x3d3c('0x161'),'foreignKey':'AccountId'});db['FreshdeskConfiguration']['belongsToMany'](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x1c5')});db['FreshdeskField']['hasMany'](db[_0x3d3c('0xb6')],{'as':_0x3d3c('0x1bd'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x3d3c('0x111')](db[_0x3d3c('0xb6')],{'as':_0x3d3c('0x1b9'),'foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0xb6')][_0x3d3c('0x111')](db[_0x3d3c('0xb6')],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db['FreshdeskField'][_0x3d3c('0x11d')](db['Variable'],{'as':_0x3d3c('0x94'),'foreignKey':'VariableId'});db[_0x3d3c('0xb7')][_0x3d3c('0x111')](db[_0x3d3c('0xb9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xb9')][_0x3d3c('0x111')](db[_0x3d3c('0x1c6')],{'as':_0x3d3c('0x1b4'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xb9')][_0x3d3c('0x111')](db[_0x3d3c('0x1c6')],{'as':_0x3d3c('0x1bc'),'foreignKey':'DescriptionId'});db[_0x3d3c('0xb9')]['hasMany'](db[_0x3d3c('0x1c6')],{'as':_0x3d3c('0x1b0'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xb9')][_0x3d3c('0x11d')](db[_0x3d3c('0xb7')],{'as':'Account','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0x1c6')][_0x3d3c('0x111')](db[_0x3d3c('0x1c6')],{'as':'Subject','foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0x1c6')][_0x3d3c('0x111')](db['VtigerField'],{'as':'Description','foreignKey':_0x3d3c('0x1b6')});db['VtigerField'][_0x3d3c('0x111')](db[_0x3d3c('0x1c6')],{'as':_0x3d3c('0x1ba'),'foreignKey':'FieldId'});db[_0x3d3c('0x1c6')][_0x3d3c('0x11d')](db['Variable'],{'as':_0x3d3c('0x94'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x1c7')],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0x1c7')][_0x3d3c('0x111')](db[_0x3d3c('0xbd')],{'as':'Subjects','foreignKey':_0x3d3c('0x1b5')});db['ServicenowConfiguration'][_0x3d3c('0x111')](db[_0x3d3c('0xbd')],{'as':_0x3d3c('0x1bc'),'foreignKey':_0x3d3c('0x1b6')});db['ServicenowConfiguration'][_0x3d3c('0x111')](db['ServicenowField'],{'as':_0x3d3c('0x1b0'),'foreignKey':'FieldId'});db[_0x3d3c('0x1c7')][_0x3d3c('0x11d')](db[_0x3d3c('0x1c8')],{'as':'Account','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xbd')][_0x3d3c('0x111')](db[_0x3d3c('0xbd')],{'as':'Subject','foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xbd')]['hasMany'](db[_0x3d3c('0xbd')],{'as':'Description','foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0xbd')][_0x3d3c('0x111')](db[_0x3d3c('0xbd')],{'as':_0x3d3c('0x1ba'),'foreignKey':'FieldId'});db[_0x3d3c('0xbd')][_0x3d3c('0x11d')](db[_0x3d3c('0x94')],{'as':_0x3d3c('0x94'),'foreignKey':_0x3d3c('0x1be')});db[_0x3d3c('0x1c9')][_0x3d3c('0x111')](db[_0x3d3c('0xc0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0x1c9')][_0x3d3c('0x11d')](db[_0x3d3c('0x104')],{'as':_0x3d3c('0x104'),'foreignKey':_0x3d3c('0x157')});db[_0x3d3c('0xc0')][_0x3d3c('0x111')](db['Dynamics365Field'],{'as':_0x3d3c('0x1b4'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xc0')][_0x3d3c('0x111')](db[_0x3d3c('0xc2')],{'as':_0x3d3c('0x1bc'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'DescriptionId'});db[_0x3d3c('0xc0')][_0x3d3c('0x111')](db[_0x3d3c('0xc2')],{'as':_0x3d3c('0x1b0'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x3d3c('0x11d')](db[_0x3d3c('0x1c9')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1b8')});db['Dynamics365Field'][_0x3d3c('0x111')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x3d3c('0x1b5')});db[_0x3d3c('0xc2')][_0x3d3c('0x111')](db[_0x3d3c('0xc2')],{'as':'Description','foreignKey':_0x3d3c('0x1b6')});db[_0x3d3c('0xc2')][_0x3d3c('0x111')](db[_0x3d3c('0xc2')],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xc2')]['belongsTo'](db[_0x3d3c('0x94')],{'as':_0x3d3c('0x94'),'foreignKey':_0x3d3c('0x1be')});db[_0x3d3c('0xc3')][_0x3d3c('0x111')](db['FreshsalesConfiguration'],{'as':_0x3d3c('0x1b3'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xc5')][_0x3d3c('0x111')](db[_0x3d3c('0xc7')],{'as':_0x3d3c('0x1b4'),'foreignKey':'SubjectId'});db[_0x3d3c('0xc5')][_0x3d3c('0x111')](db[_0x3d3c('0xc7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x3d3c('0xc5')][_0x3d3c('0x111')](db['FreshsalesField'],{'as':_0x3d3c('0x1b0'),'foreignKey':'FieldId'});db[_0x3d3c('0xc5')][_0x3d3c('0x11d')](db[_0x3d3c('0xc3')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1b8')});db[_0x3d3c('0xc7')][_0x3d3c('0x111')](db[_0x3d3c('0xc7')],{'as':_0x3d3c('0x1bd'),'foreignKey':'SubjectId'});db[_0x3d3c('0xc7')]['hasMany'](db[_0x3d3c('0xc7')],{'as':_0x3d3c('0x1b9'),'foreignKey':_0x3d3c('0x1b6')});db['FreshsalesField'][_0x3d3c('0x111')](db['FreshsalesField'],{'as':_0x3d3c('0x1ba'),'foreignKey':_0x3d3c('0x1b7')});db[_0x3d3c('0xc7')][_0x3d3c('0x11d')](db['Variable'],{'as':_0x3d3c('0x94'),'foreignKey':'VariableId'});db[_0x3d3c('0x1ca')][_0x3d3c('0x11d')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':'List','foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0x1ca')][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':'Contact','foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0x1ca')][_0x3d3c('0x11d')](db['ChatInteraction'],{});db[_0x3d3c('0x1ca')]['belongsTo'](db[_0x3d3c('0x189')],{});db['ChatQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{});db[_0x3d3c('0x1ca')][_0x3d3c('0x11d')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'onDelete':_0x3d3c('0x10e'),'foreignKey':'FromId'});db[_0x3d3c('0xcb')][_0x3d3c('0x11d')](db['User'],{'onDelete':'cascade','foreignKey':_0x3d3c('0x1cb')});db[_0x3d3c('0xcf')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x3d3c('0x1cc'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0xcf')][_0x3d3c('0x111')](db[_0x3d3c('0xcd')],{'foreignKey':_0x3d3c('0x1cc'),'onDelete':_0x3d3c('0x10e')});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db[_0x3d3c('0xd0')][_0x3d3c('0x11d')](db['CmList'],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0xd0')]['belongsTo'](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db[_0x3d3c('0xd0')][_0x3d3c('0x11d')](db[_0x3d3c('0x58')],{});db['SmsQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x5a')],{});db['SmsQueueReport']['belongsTo'](db[_0x3d3c('0x11')],{});db[_0x3d3c('0xd0')][_0x3d3c('0x11d')](db['SmsQueue'],{});db[_0x3d3c('0x1cd')][_0x3d3c('0x111')](db[_0x3d3c('0xcf')],{'foreignKey':_0x3d3c('0x1ce')});db[_0x3d3c('0x1cd')]['hasMany'](db[_0x3d3c('0xce')],{'foreignKey':_0x3d3c('0x1ce')});db[_0x3d3c('0x1cd')][_0x3d3c('0x111')](db[_0x3d3c('0xcd')],{'foreignKey':_0x3d3c('0x1ce')});db['Team'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':'Agents','through':_0x3d3c('0x1cf')});db['Team']['belongsToMany'](db[_0x3d3c('0x1a')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x3d3c('0xdc')][_0x3d3c('0x11f')](db[_0x3d3c('0x3f')],{'through':_0x3d3c('0x1d0'),'as':'MailQueues'});db[_0x3d3c('0xdc')][_0x3d3c('0x11f')](db[_0x3d3c('0x12d')],{'through':_0x3d3c('0x18f'),'as':_0x3d3c('0x1d1')});db[_0x3d3c('0xdc')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x3d3c('0x12f')});db['Team'][_0x3d3c('0x11f')](db['SmsQueue'],{'through':_0x3d3c('0x181'),'as':'SmsQueues'});db[_0x3d3c('0xdc')][_0x3d3c('0x11f')](db[_0x3d3c('0x130')],{'through':'team_has_openchannel_queues','as':_0x3d3c('0x131')});db[_0x3d3c('0xdc')][_0x3d3c('0x11f')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x3d3c('0x132')});db[_0x3d3c('0xdc')][_0x3d3c('0x11f')](db[_0x3d3c('0xf0')],{'through':_0x3d3c('0x108'),'as':_0x3d3c('0x1d2')});db['Campaign'][_0x3d3c('0x111')](db[_0x3d3c('0x74')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x3d3c('0xe0')][_0x3d3c('0x111')](db[_0x3d3c('0x77')],{'as':_0x3d3c('0x115'),'foreignKey':_0x3d3c('0x198')});db[_0x3d3c('0xe0')][_0x3d3c('0x111')](db['CmHopperHistory'],{'as':_0x3d3c('0x146'),'foreignKey':'CampaignId'});db[_0x3d3c('0xe0')][_0x3d3c('0x111')](db[_0x3d3c('0x76')],{'as':'HopperBlacks','foreignKey':_0x3d3c('0x198')});db[_0x3d3c('0xe0')][_0x3d3c('0x11d')](db[_0x3d3c('0x29')],{'as':'Trunk','foreignKey':_0x3d3c('0x148')});db[_0x3d3c('0xe0')][_0x3d3c('0x11d')](db[_0x3d3c('0x29')],{'as':'TrunkBackup','foreignKey':_0x3d3c('0x14a')});db['Campaign'][_0x3d3c('0x11d')](db[_0x3d3c('0x82')],{'as':_0x3d3c('0x82'),'foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0xe0')][_0x3d3c('0x11d')](db[_0x3d3c('0xd7')],{'as':_0x3d3c('0xd7'),'foreignKey':_0x3d3c('0x1d3')});db[_0x3d3c('0xe0')][_0x3d3c('0x11f')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x14c'),'through':_0x3d3c('0x1d4')});db[_0x3d3c('0xe0')][_0x3d3c('0x11f')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x14f'),'through':_0x3d3c('0x1d5')});db['Attachment'][_0x3d3c('0x11d')](db[_0x3d3c('0x6b')],{'as':_0x3d3c('0x6b'),'foreignKey':_0x3d3c('0x16b')});db[_0x3d3c('0xe8')][_0x3d3c('0x11d')](db[_0x3d3c('0x45')],{});db[_0x3d3c('0xe8')][_0x3d3c('0x11d')](db['MailInteraction'],{});db[_0x3d3c('0xe8')][_0x3d3c('0x11d')](db[_0x3d3c('0x3d')],{'foreignKey':_0x3d3c('0x1d6'),'as':_0x3d3c('0x1d7')});db[_0x3d3c('0xe8')][_0x3d3c('0x11d')](db['User'],{'foreignKey':_0x3d3c('0x1d8'),'as':_0x3d3c('0x1d9')});db['MailTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1da'),'as':_0x3d3c('0x1db')});db['MailTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x3f')],{'foreignKey':'ToMailQueueId','as':_0x3d3c('0x1dc')});db[_0x3d3c('0xe8')][_0x3d3c('0x11d')](db['MailAccount'],{'foreignKey':_0x3d3c('0x1dd'),'as':_0x3d3c('0x1de')});db[_0x3d3c('0xea')][_0x3d3c('0x11d')](db[_0x3d3c('0x189')],{});db['ChatTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x69')],{});db[_0x3d3c('0xea')][_0x3d3c('0x11d')](db['ChatWebsite'],{'foreignKey':_0x3d3c('0x1df'),'as':'FromAccount'});db['ChatTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1d8'),'as':_0x3d3c('0x1d9')});db[_0x3d3c('0xea')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1da'),'as':'ToAgent'});db['ChatTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x12d')],{'foreignKey':'ToChatQueueId','as':_0x3d3c('0x1dc')});db['ChatTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x3d3c('0x1de')});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db[_0x3d3c('0x51')],{});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db['FaxInteraction'],{});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db['FaxAccount'],{'foreignKey':_0x3d3c('0x1e0'),'as':_0x3d3c('0x1d7')});db[_0x3d3c('0xeb')]['belongsTo'](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1d8'),'as':_0x3d3c('0x1d9')});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db['User'],{'foreignKey':'ToUserId','as':_0x3d3c('0x1db')});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db[_0x3d3c('0x53')],{'foreignKey':_0x3d3c('0x1e1'),'as':_0x3d3c('0x1dc')});db[_0x3d3c('0xeb')][_0x3d3c('0x11d')](db[_0x3d3c('0x4d')],{'foreignKey':_0x3d3c('0x1e2'),'as':_0x3d3c('0x1de')});db[_0x3d3c('0xec')][_0x3d3c('0x11d')](db[_0x3d3c('0x61')],{});db[_0x3d3c('0xec')][_0x3d3c('0x11d')](db[_0x3d3c('0x5f')],{});db[_0x3d3c('0xec')][_0x3d3c('0x11d')](db[_0x3d3c('0x139')],{'foreignKey':_0x3d3c('0x1e3'),'as':_0x3d3c('0x1d7')});db['OpenchannelTransferReport'][_0x3d3c('0x11d')](db['User'],{'foreignKey':_0x3d3c('0x1d8'),'as':'FromAgent'});db[_0x3d3c('0xec')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1da'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x130')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x3d3c('0xec')][_0x3d3c('0x11d')](db[_0x3d3c('0x139')],{'foreignKey':_0x3d3c('0x1e4'),'as':_0x3d3c('0x1de')});db[_0x3d3c('0xed')]['belongsTo'](db[_0x3d3c('0x5a')],{});db[_0x3d3c('0xed')]['belongsTo'](db[_0x3d3c('0x58')],{});db[_0x3d3c('0xed')][_0x3d3c('0x11d')](db[_0x3d3c('0x13c')],{'foreignKey':'FromSmsAccountId','as':_0x3d3c('0x1d7')});db[_0x3d3c('0xed')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1d8'),'as':_0x3d3c('0x1d9')});db[_0x3d3c('0xed')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1da'),'as':_0x3d3c('0x1db')});db[_0x3d3c('0xed')][_0x3d3c('0x11d')](db[_0x3d3c('0x5c')],{'foreignKey':_0x3d3c('0x1e5'),'as':_0x3d3c('0x1dc')});db[_0x3d3c('0xed')][_0x3d3c('0x11d')](db[_0x3d3c('0x13c')],{'foreignKey':_0x3d3c('0x1e6'),'as':_0x3d3c('0x1de')});db[_0x3d3c('0xee')][_0x3d3c('0x111')](db[_0x3d3c('0x80')],{'as':_0x3d3c('0x15a'),'foreignKey':_0x3d3c('0x15c'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0xee')][_0x3d3c('0x111')](db[_0x3d3c('0x1e7')],{'as':'CustomFields','foreignKey':_0x3d3c('0x15c')});db['CmList']['hasMany'](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x122'),'onDelete':_0x3d3c('0x10e'),'foreignKey':'ListId'});db[_0x3d3c('0xee')][_0x3d3c('0x111')](db['CmHopperFinal'],{'as':_0x3d3c('0x115'),'foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0xee')][_0x3d3c('0x111')](db['CmHopperHistory'],{'as':_0x3d3c('0x117'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0x3d3c('0x79'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x3d3c('0x1e8'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x124')});db[_0x3d3c('0xf0')][_0x3d3c('0x111')](db[_0x3d3c('0x17')],{'as':'Extensions','onDelete':_0x3d3c('0x10e')});db['VoicePrefix'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x10a')});db[_0x3d3c('0xf0')]['belongsToMany'](db['Team'],{'through':'TeamVoicePrefix','as':_0x3d3c('0x17a')});db[_0x3d3c('0xf2')][_0x3d3c('0x111')](db['User'],{'as':_0x3d3c('0x17e'),'foreignKey':_0x3d3c('0x11e')});db[_0x3d3c('0xf2')][_0x3d3c('0x111')](db[_0x3d3c('0xf4')],{'as':_0x3d3c('0x1e9'),'foreignKey':_0x3d3c('0x11e'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0xf4')]['hasMany'](db[_0x3d3c('0xf6')],{'as':_0x3d3c('0x1ea'),'foreignKey':_0x3d3c('0x1eb'),'onDelete':_0x3d3c('0x10e')});db[_0x3d3c('0xfa')][_0x3d3c('0x111')](db[_0x3d3c('0x80')],{'as':'Dispositions','foreignKey':_0x3d3c('0x1ec'),'onDelete':'cascade'});db['WhatsappAccount'][_0x3d3c('0x111')](db[_0x3d3c('0x7f')],{'as':_0x3d3c('0x170'),'foreignKey':'WhatsappAccountId'});db[_0x3d3c('0xfa')][_0x3d3c('0x111')](db['WhatsappMessage'],{'as':_0x3d3c('0x175'),'foreignKey':'WhatsappAccountId'});db[_0x3d3c('0xfa')]['hasMany'](db['WhatsappInteraction'],{'as':_0x3d3c('0x171')});db[_0x3d3c('0xfa')][_0x3d3c('0x111')](db[_0x3d3c('0x1ed')],{'as':_0x3d3c('0x172')});db['WhatsappAccount'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0xfa')][_0x3d3c('0x11d')](db[_0x3d3c('0x84')],{'as':_0x3d3c('0x15e'),'foreignKey':_0x3d3c('0x15f')});db[_0x3d3c('0xfa')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x140')});db[_0x3d3c('0x1ed')][_0x3d3c('0x11d')](db['User'],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x1ed')][_0x3d3c('0x11d')](db[_0x3d3c('0x102')],{'onDelete':_0x3d3c('0x16c')});db['WhatsappApplication'][_0x3d3c('0x11d')](db['WhatsappAccount'],{'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x1ed')][_0x3d3c('0x11d')](db[_0x3d3c('0x82')],{'onDelete':'restrict','foreignKey':_0x3d3c('0x14b')});db[_0x3d3c('0x1ed')]['belongsTo'](db['Tag'],{'onDelete':_0x3d3c('0x16c'),'foreignKey':_0x3d3c('0x174')});db['WhatsappInteraction'][_0x3d3c('0x111')](db[_0x3d3c('0xfd')],{'as':_0x3d3c('0x175'),'onDelete':_0x3d3c('0x10e'),'foreignKey':_0x3d3c('0x1ee')});db[_0x3d3c('0xfc')][_0x3d3c('0x11d')](db['WhatsappAccount'],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1ec')});db['WhatsappInteraction'][_0x3d3c('0x11d')](db[_0x3d3c('0x73')],{'as':_0x3d3c('0x155'),'foreignKey':_0x3d3c('0x162')});db['WhatsappInteraction'][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x163'),'foreignKey':_0x3d3c('0x10f')});db[_0x3d3c('0xfc')]['belongsToMany'](db[_0x3d3c('0x166')],{'through':_0x3d3c('0x1ef'),'as':_0x3d3c('0x165')});db['WhatsappInteraction'][_0x3d3c('0x11f')](db[_0x3d3c('0x166')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db['WhatsappInteraction'][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x17e'),'through':_0x3d3c('0x12a'),'foreignKey':_0x3d3c('0x1ee')});db[_0x3d3c('0xfd')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'as':'User'});db[_0x3d3c('0xfd')][_0x3d3c('0x11d')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x3d3c('0x10e'),'as':_0x3d3c('0x169'),'foreignKey':_0x3d3c('0x1ee')});db['WhatsappMessage'][_0x3d3c('0x11d')](db[_0x3d3c('0xfa')],{'as':_0x3d3c('0x161'),'foreignKey':_0x3d3c('0x1ec')});db[_0x3d3c('0x1f0')][_0x3d3c('0x11d')](db[_0x3d3c('0xfa')],{});db['WhatsappQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xee')],{'as':_0x3d3c('0x15b'),'foreignKey':_0x3d3c('0x15c')});db[_0x3d3c('0x1f0')]['belongsTo'](db['CmContact'],{'as':_0x3d3c('0x155'),'foreignKey':'ContactId'});db[_0x3d3c('0x1f0')]['belongsTo'](db[_0x3d3c('0xfc')],{});db['WhatsappQueueReport'][_0x3d3c('0x11d')](db[_0x3d3c('0x102')],{});db[_0x3d3c('0x1f0')][_0x3d3c('0x11d')](db[_0x3d3c('0xfd')],{});db[_0x3d3c('0x1f0')]['belongsTo'](db[_0x3d3c('0x11')],{});db['WhatsappTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xfd')],{});db['WhatsappTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xfc')],{});db['WhatsappTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xfa')],{'foreignKey':_0x3d3c('0x1f1'),'as':_0x3d3c('0x1d7')});db['WhatsappTransferReport'][_0x3d3c('0x11d')](db[_0x3d3c('0xfa')],{'foreignKey':_0x3d3c('0x1f2'),'as':_0x3d3c('0x1de')});db['WhatsappTransferReport'][_0x3d3c('0x11d')](db['WhatsappQueue'],{'foreignKey':_0x3d3c('0x1f3'),'as':_0x3d3c('0x1dc')});db[_0x3d3c('0x100')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1d8'),'as':_0x3d3c('0x1d9')});db[_0x3d3c('0x100')][_0x3d3c('0x11d')](db[_0x3d3c('0x11')],{'foreignKey':_0x3d3c('0x1da'),'as':_0x3d3c('0x1db')});db[_0x3d3c('0x102')][_0x3d3c('0x11f')](db[_0x3d3c('0x11')],{'as':_0x3d3c('0x14e'),'through':_0x3d3c('0x39'),'foreignKey':'WhatsappQueueId'});db[_0x3d3c('0x102')][_0x3d3c('0x11f')](db[_0x3d3c('0xdc')],{'through':_0x3d3c('0x1f4'),'as':_0x3d3c('0x17a')});db[_0x3d3c('0x10b')]['belongsTo'](db['User'],{'as':_0x3d3c('0x1f5'),'foreignKey':'UserId','onDelete':_0x3d3c('0x10e'),'hooks':!![]});db[_0x3d3c('0x104')][_0x3d3c('0x10d')](db[_0x3d3c('0x1c9')],{'as':_0x3d3c('0x1c9'),'onDelete':_0x3d3c('0x16c')});db[_0x3d3c('0x104')]['hasOne'](db[_0x3d3c('0x3a')],{'as':'Imap','onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0x3d3c('0x3b')],{'as':_0x3d3c('0x159'),'onDelete':'restrict'});module[_0x3d3c('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 240d1c8..a864757 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34c0=['/api/sms/interactions','/api/sms/messages','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/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/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./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/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./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/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','/api/auth/local','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','default','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/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications'];(function(_0x2ef2b9,_0x467ef6){var _0x403caa=function(_0x372674){while(--_0x372674){_0x2ef2b9['push'](_0x2ef2b9['shift']());}};_0x403caa(++_0x467ef6);}(_0x34c0,0xdd));var _0x034c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34c0[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x034c('0x0'));var express=require(_0x034c('0x1'));var errors=require(_0x034c('0x2'));var config=require(_0x034c('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x034c('0x4')]=function(_0x17785d){return setupLoggers(_0x17785d)['then'](function(){_0x17785d[_0x034c('0x5')](_0x034c('0x6'),require(_0x034c('0x7')));_0x17785d[_0x034c('0x5')]('/api/voice/chanspy',require(_0x034c('0x8')));_0x17785d[_0x034c('0x5')](_0x034c('0x9'),require(_0x034c('0xa')));_0x17785d['use'](_0x034c('0xb'),require(_0x034c('0xc')));_0x17785d[_0x034c('0x5')](_0x034c('0xd'),require(_0x034c('0xe')));_0x17785d[_0x034c('0x5')](_0x034c('0xf'),require(_0x034c('0x10')));_0x17785d['use'](_0x034c('0x11'),require(_0x034c('0x12')));_0x17785d[_0x034c('0x5')](_0x034c('0x13'),require(_0x034c('0x14')));_0x17785d[_0x034c('0x5')](_0x034c('0x15'),require(_0x034c('0x16')));_0x17785d[_0x034c('0x5')](_0x034c('0x17'),require('./api/voiceMailMessage'));_0x17785d[_0x034c('0x5')](_0x034c('0x18'),require(_0x034c('0x19')));_0x17785d[_0x034c('0x5')](_0x034c('0x1a'),require(_0x034c('0x1b')));_0x17785d[_0x034c('0x5')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x17785d['use'](_0x034c('0x1c'),require(_0x034c('0x1d')));_0x17785d[_0x034c('0x5')](_0x034c('0x1e'),require('./api/memberReport'));_0x17785d['use'](_0x034c('0x1f'),require(_0x034c('0x20')));_0x17785d['use'](_0x034c('0x21'),require(_0x034c('0x22')));_0x17785d[_0x034c('0x5')](_0x034c('0x23'),require(_0x034c('0x24')));_0x17785d[_0x034c('0x5')]('/api/mail/accounts',require(_0x034c('0x25')));_0x17785d[_0x034c('0x5')](_0x034c('0x26'),require(_0x034c('0x27')));_0x17785d[_0x034c('0x5')](_0x034c('0x28'),require(_0x034c('0x29')));_0x17785d[_0x034c('0x5')](_0x034c('0x2a'),require(_0x034c('0x2b')));_0x17785d['use']('/api/mail/messages',require(_0x034c('0x2c')));_0x17785d['use']('/api/mail/applications',require('./api/mailApplication'));_0x17785d[_0x034c('0x5')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x17785d[_0x034c('0x5')]('/api/dashboards',require('./api/dashboard'));_0x17785d[_0x034c('0x5')](_0x034c('0x2d'),require(_0x034c('0x2e')));_0x17785d[_0x034c('0x5')]('/api/fax/accounts',require(_0x034c('0x2f')));_0x17785d[_0x034c('0x5')](_0x034c('0x30'),require(_0x034c('0x31')));_0x17785d[_0x034c('0x5')](_0x034c('0x32'),require(_0x034c('0x33')));_0x17785d['use'](_0x034c('0x34'),require(_0x034c('0x35')));_0x17785d['use'](_0x034c('0x36'),require('./api/faxQueue'));_0x17785d[_0x034c('0x5')](_0x034c('0x37'),require(_0x034c('0x38')));_0x17785d[_0x034c('0x5')]('/api/sms/accounts',require(_0x034c('0x39')));_0x17785d['use'](_0x034c('0x3a'),require('./api/smsApplication'));_0x17785d[_0x034c('0x5')](_0x034c('0x3b'),require('./api/smsInteraction'));_0x17785d[_0x034c('0x5')](_0x034c('0x3c'),require('./api/smsMessage'));_0x17785d[_0x034c('0x5')]('/api/sms/queues',require('./api/smsQueue'));_0x17785d[_0x034c('0x5')](_0x034c('0x3d'),require(_0x034c('0x3e')));_0x17785d[_0x034c('0x5')]('/api/openchannel/applications',require(_0x034c('0x3f')));_0x17785d[_0x034c('0x5')](_0x034c('0x40'),require(_0x034c('0x41')));_0x17785d[_0x034c('0x5')]('/api/openchannel/messages',require(_0x034c('0x42')));_0x17785d['use'](_0x034c('0x43'),require('./api/openchannelQueue'));_0x17785d['use'](_0x034c('0x44'),require('./api/chatWebsite'));_0x17785d[_0x034c('0x5')](_0x034c('0x45'),require(_0x034c('0x46')));_0x17785d[_0x034c('0x5')](_0x034c('0x47'),require(_0x034c('0x48')));_0x17785d['use'](_0x034c('0x49'),require(_0x034c('0x4a')));_0x17785d[_0x034c('0x5')](_0x034c('0x4b'),require(_0x034c('0x4c')));_0x17785d['use'](_0x034c('0x4d'),require(_0x034c('0x4e')));_0x17785d[_0x034c('0x5')](_0x034c('0x4f'),require('./api/chatQueue'));_0x17785d[_0x034c('0x5')](_0x034c('0x50'),require(_0x034c('0x51')));_0x17785d[_0x034c('0x5')](_0x034c('0x52'),require(_0x034c('0x53')));_0x17785d[_0x034c('0x5')](_0x034c('0x54'),require(_0x034c('0x55')));_0x17785d['use'](_0x034c('0x56'),require(_0x034c('0x57')));_0x17785d['use']('/api/cm/hopper',require('./api/cmHopper'));_0x17785d['use'](_0x034c('0x58'),require(_0x034c('0x59')));_0x17785d[_0x034c('0x5')](_0x034c('0x5a'),require('./api/cmHopperFinal'));_0x17785d['use'](_0x034c('0x5b'),require(_0x034c('0x5c')));_0x17785d['use'](_0x034c('0x5d'),require(_0x034c('0x5e')));_0x17785d[_0x034c('0x5')]('/api/actions',require('./api/action'));_0x17785d[_0x034c('0x5')](_0x034c('0x5f'),require(_0x034c('0x60')));_0x17785d['use'](_0x034c('0x61'),require(_0x034c('0x62')));_0x17785d[_0x034c('0x5')](_0x034c('0x63'),require(_0x034c('0x64')));_0x17785d[_0x034c('0x5')](_0x034c('0x65'),require(_0x034c('0x66')));_0x17785d[_0x034c('0x5')](_0x034c('0x67'),require(_0x034c('0x68')));_0x17785d[_0x034c('0x5')](_0x034c('0x69'),require(_0x034c('0x6a')));_0x17785d[_0x034c('0x5')](_0x034c('0x6b'),require(_0x034c('0x6c')));_0x17785d[_0x034c('0x5')]('/api/voiceQueuesLog',require(_0x034c('0x6d')));_0x17785d[_0x034c('0x5')](_0x034c('0x6e'),require(_0x034c('0x6f')));_0x17785d[_0x034c('0x5')](_0x034c('0x70'),require(_0x034c('0x71')));_0x17785d[_0x034c('0x5')](_0x034c('0x72'),require('./api/tag'));_0x17785d[_0x034c('0x5')](_0x034c('0x73'),require(_0x034c('0x74')));_0x17785d['use']('/api/cm_contact_has_items',require(_0x034c('0x75')));_0x17785d[_0x034c('0x5')](_0x034c('0x76'),require(_0x034c('0x77')));_0x17785d[_0x034c('0x5')]('/api/templates',require(_0x034c('0x78')));_0x17785d[_0x034c('0x5')]('/api/triggers',require(_0x034c('0x79')));_0x17785d[_0x034c('0x5')](_0x034c('0x7a'),require(_0x034c('0x7b')));_0x17785d[_0x034c('0x5')](_0x034c('0x7c'),require(_0x034c('0x7d')));_0x17785d[_0x034c('0x5')](_0x034c('0x7e'),require('./api/integrationReport'));_0x17785d[_0x034c('0x5')](_0x034c('0x7f'),require(_0x034c('0x80')));_0x17785d[_0x034c('0x5')]('/api/analytics/default_reports',require(_0x034c('0x81')));_0x17785d[_0x034c('0x5')](_0x034c('0x82'),require(_0x034c('0x83')));_0x17785d['use'](_0x034c('0x84'),require(_0x034c('0x85')));_0x17785d[_0x034c('0x5')](_0x034c('0x86'),require('./api/analyticFieldReport'));_0x17785d[_0x034c('0x5')](_0x034c('0x87'),require(_0x034c('0x88')));_0x17785d['use'](_0x034c('0x89'),require(_0x034c('0x8a')));_0x17785d[_0x034c('0x5')](_0x034c('0x8b'),require('./api/intSalesforceConfiguration'));_0x17785d[_0x034c('0x5')](_0x034c('0x8c'),require(_0x034c('0x8d')));_0x17785d[_0x034c('0x5')](_0x034c('0x8e'),require('./api/intSugarcrmAccount'));_0x17785d[_0x034c('0x5')](_0x034c('0x8f'),require(_0x034c('0x90')));_0x17785d[_0x034c('0x5')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x17785d['use'](_0x034c('0x91'),require('./api/intDeskAccount'));_0x17785d[_0x034c('0x5')](_0x034c('0x92'),require('./api/intDeskConfiguration'));_0x17785d[_0x034c('0x5')](_0x034c('0x93'),require(_0x034c('0x94')));_0x17785d[_0x034c('0x5')]('/api/integrations/zoho/accounts',require(_0x034c('0x95')));_0x17785d[_0x034c('0x5')](_0x034c('0x96'),require(_0x034c('0x97')));_0x17785d[_0x034c('0x5')]('/api/integrations/zoho/fields',require(_0x034c('0x98')));_0x17785d[_0x034c('0x5')](_0x034c('0x99'),require('./api/intZendeskAccount'));_0x17785d['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x17785d[_0x034c('0x5')](_0x034c('0x9a'),require(_0x034c('0x9b')));_0x17785d[_0x034c('0x5')]('/api/integrations/freshdesk/accounts',require(_0x034c('0x9c')));_0x17785d[_0x034c('0x5')](_0x034c('0x9d'),require(_0x034c('0x9e')));_0x17785d[_0x034c('0x5')](_0x034c('0x9f'),require(_0x034c('0xa0')));_0x17785d['use'](_0x034c('0xa1'),require('./api/intVtigerAccount'));_0x17785d[_0x034c('0x5')](_0x034c('0xa2'),require(_0x034c('0xa3')));_0x17785d[_0x034c('0x5')]('/api/integrations/vtiger/fields',require(_0x034c('0xa4')));_0x17785d['use'](_0x034c('0xa5'),require('./api/intServicenowAccount'));_0x17785d[_0x034c('0x5')](_0x034c('0xa6'),require(_0x034c('0xa7')));_0x17785d[_0x034c('0x5')](_0x034c('0xa8'),require('./api/intServicenowField'));_0x17785d[_0x034c('0x5')](_0x034c('0xa9'),require(_0x034c('0xaa')));_0x17785d[_0x034c('0x5')]('/api/integrations/dynamics365/configurations',require(_0x034c('0xab')));_0x17785d[_0x034c('0x5')](_0x034c('0xac'),require('./api/intDynamics365Field'));_0x17785d[_0x034c('0x5')](_0x034c('0xad'),require('./api/intFreshsalesAccount'));_0x17785d['use'](_0x034c('0xae'),require(_0x034c('0xaf')));_0x17785d['use'](_0x034c('0xb0'),require(_0x034c('0xb1')));_0x17785d[_0x034c('0x5')](_0x034c('0xb2'),require(_0x034c('0xb3')));_0x17785d[_0x034c('0x5')]('/api/chat/reports/queue',require(_0x034c('0xb4')));_0x17785d[_0x034c('0x5')](_0x034c('0xb5'),require(_0x034c('0xb6')));_0x17785d[_0x034c('0x5')](_0x034c('0xb7'),require(_0x034c('0xb8')));_0x17785d[_0x034c('0x5')](_0x034c('0xb9'),require('./api/jscriptyQuestionReport'));_0x17785d[_0x034c('0x5')](_0x034c('0xba'),require(_0x034c('0xbb')));_0x17785d[_0x034c('0x5')](_0x034c('0xbc'),require(_0x034c('0xbd')));_0x17785d[_0x034c('0x5')](_0x034c('0xbe'),require(_0x034c('0xbf')));_0x17785d[_0x034c('0x5')](_0x034c('0xc0'),require(_0x034c('0xc1')));_0x17785d['use'](_0x034c('0xc2'),require(_0x034c('0xc3')));_0x17785d['use'](_0x034c('0xc4'),require(_0x034c('0xc5')));_0x17785d[_0x034c('0x5')](_0x034c('0xc6'),require(_0x034c('0xc7')));_0x17785d[_0x034c('0x5')]('/api/square/projects',require(_0x034c('0xc8')));_0x17785d[_0x034c('0x5')](_0x034c('0xc9'),require('./api/squareRecording'));_0x17785d[_0x034c('0x5')](_0x034c('0xca'),require(_0x034c('0xcb')));_0x17785d['use'](_0x034c('0xcc'),require(_0x034c('0xcd')));_0x17785d[_0x034c('0x5')](_0x034c('0xce'),require(_0x034c('0xcf')));_0x17785d[_0x034c('0x5')](_0x034c('0xd0'),require(_0x034c('0xd1')));_0x17785d[_0x034c('0x5')](_0x034c('0xd2'),require('./api/migration'));_0x17785d[_0x034c('0x5')](_0x034c('0xd3'),require(_0x034c('0xd4')));_0x17785d[_0x034c('0x5')](_0x034c('0xd5'),require(_0x034c('0xd6')));_0x17785d[_0x034c('0x5')](_0x034c('0xd7'),require('./api/mailTransferReport'));_0x17785d[_0x034c('0x5')](_0x034c('0xd8'),require(_0x034c('0xd9')));_0x17785d[_0x034c('0x5')](_0x034c('0xda'),require('./api/faxTransferReport'));_0x17785d[_0x034c('0x5')](_0x034c('0xdb'),require(_0x034c('0xdc')));_0x17785d['use'](_0x034c('0xdd'),require(_0x034c('0xde')));_0x17785d[_0x034c('0x5')]('/api/cm/lists',require('./api/cmList'));_0x17785d[_0x034c('0x5')](_0x034c('0xdf'),require(_0x034c('0xe0')));_0x17785d[_0x034c('0x5')]('/api/userProfiles',require(_0x034c('0xe1')));_0x17785d['use']('/api/userProfile/sections',require(_0x034c('0xe2')));_0x17785d['use'](_0x034c('0xe3'),require(_0x034c('0xe4')));_0x17785d['use'](_0x034c('0xe5'),require(_0x034c('0xe6')));_0x17785d['use']('/api/whatsapp/accounts',require(_0x034c('0xe7')));_0x17785d[_0x034c('0x5')](_0x034c('0xe8'),require(_0x034c('0xe9')));_0x17785d['use'](_0x034c('0xea'),require(_0x034c('0xeb')));_0x17785d['use'](_0x034c('0xec'),require(_0x034c('0xed')));_0x17785d[_0x034c('0x5')](_0x034c('0xee'),require('./api/whatsappQueueReport'));_0x17785d[_0x034c('0x5')](_0x034c('0xef'),require(_0x034c('0xf0')));_0x17785d[_0x034c('0x5')](_0x034c('0xf1'),require(_0x034c('0xf2')));_0x17785d['use'](_0x034c('0xf3'),require(_0x034c('0xf4')));_0x17785d[_0x034c('0x5')](_0x034c('0xf5'),require('./api/realtime'));_0x17785d[_0x034c('0x5')](_0x034c('0xf6'),require('./api/user-setting'));_0x17785d[_0x034c('0x5')](_0x034c('0xf7'),require('./api/authLocal'));_0x17785d[_0x034c('0x5')](_0x034c('0xf8'),require('./api/authGoogle'));_0x17785d[_0x034c('0x5')](_0x034c('0xf9'),require(_0x034c('0xfa')));_0x17785d[_0x034c('0x5')](_0x034c('0xfb'),require(_0x034c('0xfc')));_0x17785d[_0x034c('0x5')](_0x034c('0xfd'),require(_0x034c('0xfe')));_0x17785d[_0x034c('0x5')]('/api/version',require(_0x034c('0xff')));_0x17785d[_0x034c('0x5')]('/api/system',require(_0x034c('0x100')));_0x17785d[_0x034c('0x5')](_0x034c('0x101'),require(_0x034c('0x102')));_0x17785d[_0x034c('0x5')](_0x034c('0x103'),require(_0x034c('0x104')));_0x17785d[_0x034c('0x5')](_0x034c('0x105'),clientSideLogs);_0x17785d['use'](_0x034c('0x106'),express['static'](path[_0x034c('0x107')](config[_0x034c('0x108')],_0x034c('0x106'))));_0x17785d[_0x034c('0x5')](_0x034c('0x109'),express[_0x034c('0x10a')](path['join'](config['root'],'/www')));_0x17785d['use'](_0x034c('0x10b'),express[_0x034c('0x10a')](path[_0x034c('0x107')](config['root'],'/demo')));_0x17785d[_0x034c('0x5')](_0x034c('0x10c'),express[_0x034c('0x10a')](path[_0x034c('0x107')](config['root'],_0x034c('0x10d'),_0x034c('0x10e'))));_0x17785d['use'](_0x034c('0x10f'),express[_0x034c('0x10a')](path['join'](config[_0x034c('0x108')],_0x034c('0x110'))));_0x17785d[_0x034c('0x111')](_0x034c('0x112'))['get'](errors[0x194]);_0x17785d[_0x034c('0x111')]('/*')[_0x034c('0x113')](function(_0x1bd9e8,_0x4a0788){_0x4a0788[_0x034c('0x114')](path[_0x034c('0x115')](_0x17785d[_0x034c('0x113')](_0x034c('0x116'))+_0x034c('0x117')));});return _0x17785d;});}; \ No newline at end of file +var _0xb380=['./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/license','./api/campaign','./api/migration','/api/plugins','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./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/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb380,0x180));var _0x0b38=function(_0x293eca,_0xb4bd41){_0x293eca=_0x293eca-0x0;var _0xe9ca14=_0xb380[_0x293eca];return _0xe9ca14;};'use strict';var path=require(_0x0b38('0x0'));var express=require(_0x0b38('0x1'));var errors=require(_0x0b38('0x2'));var config=require(_0x0b38('0x3'));var setupLoggers=require(_0x0b38('0x4'))[_0x0b38('0x5')];var clientSideLogs=require(_0x0b38('0x6'));exports[_0x0b38('0x7')]=function(_0x3d440a){return setupLoggers(_0x3d440a)['then'](function(){_0x3d440a['use'](_0x0b38('0x8'),require(_0x0b38('0x9')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xb'),require('./api/voiceChanSpy'));_0x3d440a[_0x0b38('0xa')]('/api/voice/contexts',require(_0x0b38('0xc')));_0x3d440a[_0x0b38('0xa')]('/api/voice/extensions',require(_0x0b38('0xd')));_0x3d440a[_0x0b38('0xa')]('/api/voice/mohs',require(_0x0b38('0xe')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf'),require('./api/voiceQueue'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x10'),require(_0x0b38('0x11')));_0x3d440a['use'](_0x0b38('0x12'),require('./api/screenRecording'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x13'),require(_0x0b38('0x14')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x15'),require(_0x0b38('0x16')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x17'),require(_0x0b38('0x18')));_0x3d440a[_0x0b38('0xa')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x19'),require(_0x0b38('0x1a')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x1b'),require('./api/voiceQueueReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x1c'),require(_0x0b38('0x1d')));_0x3d440a[_0x0b38('0xa')]('/api/trunks',require(_0x0b38('0x1e')));_0x3d440a[_0x0b38('0xa')]('/api/voice/transfers/reports',require(_0x0b38('0x1f')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x20'),require(_0x0b38('0x21')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x22'),require(_0x0b38('0x23')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x24'),require(_0x0b38('0x25')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x26'),require(_0x0b38('0x27')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x28'),require('./api/mailInteraction'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x29'),require(_0x0b38('0x2a')));_0x3d440a['use'](_0x0b38('0x2b'),require(_0x0b38('0x2c')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x2d'),require(_0x0b38('0x2e')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x2f'),require(_0x0b38('0x30')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x31'),require('./api/dashboardItem'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x32'),require(_0x0b38('0x33')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x34'),require(_0x0b38('0x35')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x36'),require(_0x0b38('0x37')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x38'),require(_0x0b38('0x39')));_0x3d440a['use']('/api/fax/queues',require('./api/faxQueue'));_0x3d440a['use'](_0x0b38('0x3a'),require(_0x0b38('0x3b')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x3c'),require(_0x0b38('0x3d')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x3e'),require(_0x0b38('0x3f')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x40'),require(_0x0b38('0x41')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x42'),require(_0x0b38('0x43')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x44'),require(_0x0b38('0x45')));_0x3d440a['use'](_0x0b38('0x46'),require(_0x0b38('0x47')));_0x3d440a['use']('/api/openchannel/applications',require(_0x0b38('0x48')));_0x3d440a['use'](_0x0b38('0x49'),require(_0x0b38('0x4a')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x4b'),require(_0x0b38('0x4c')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x4d'),require('./api/openchannelQueue'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x4e'),require(_0x0b38('0x4f')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x50'),require('./api/openchannelQueueReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x51'),require('./api/chatApplication'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x52'),require(_0x0b38('0x53')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x54'),require(_0x0b38('0x55')));_0x3d440a[_0x0b38('0xa')]('/api/chat/offline_messages',require(_0x0b38('0x56')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x57'),require('./api/chatQueue'));_0x3d440a['use'](_0x0b38('0x58'),require('./api/chatGroup'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x59'),require(_0x0b38('0x5a')));_0x3d440a['use'](_0x0b38('0x5b'),require('./api/cmCompany'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x5c'),require(_0x0b38('0x5d')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x5e'),require(_0x0b38('0x5f')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x60'),require('./api/cmHopperBlack'));_0x3d440a['use'](_0x0b38('0x61'),require(_0x0b38('0x62')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x63'),require('./api/cmHopperHistory'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x64'),require('./api/cmCustomField'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x65'),require('./api/action'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x66'),require(_0x0b38('0x67')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x68'),require(_0x0b38('0x69')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x6a'),require(_0x0b38('0x6b')));_0x3d440a['use'](_0x0b38('0x6c'),require(_0x0b38('0x6d')));_0x3d440a['use'](_0x0b38('0x6e'),require(_0x0b38('0x6f')));_0x3d440a[_0x0b38('0xa')]('/api/pauses',require(_0x0b38('0x70')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x71'),require(_0x0b38('0x72')));_0x3d440a[_0x0b38('0xa')]('/api/voiceQueuesLog',require(_0x0b38('0x73')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x74'),require('./api/schedule'));_0x3d440a['use'](_0x0b38('0x75'),require(_0x0b38('0x76')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x77'),require(_0x0b38('0x78')));_0x3d440a[_0x0b38('0xa')]('/api/contact_item_types',require(_0x0b38('0x79')));_0x3d440a[_0x0b38('0xa')]('/api/cm_contact_has_items',require(_0x0b38('0x7a')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x7b'),require('./api/cmHopperAdditionalPhone'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x7c'),require(_0x0b38('0x7d')));_0x3d440a[_0x0b38('0xa')]('/api/triggers',require(_0x0b38('0x7e')));_0x3d440a[_0x0b38('0xa')]('/api/variables',require(_0x0b38('0x7f')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x80'),require(_0x0b38('0x81')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/reports',require(_0x0b38('0x82')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x83'),require(_0x0b38('0x84')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x85'),require('./api/analyticDefaultReport'));_0x3d440a['use'](_0x0b38('0x86'),require(_0x0b38('0x87')));_0x3d440a[_0x0b38('0xa')]('/api/analytics/metrics',require(_0x0b38('0x88')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x89'),require(_0x0b38('0x8a')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x8b'),require('./api/analyticTreeReport'));_0x3d440a['use']('/api/integrations/salesforce/accounts',require(_0x0b38('0x8c')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x8d'),require(_0x0b38('0x8e')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x8f'),require(_0x0b38('0x90')));_0x3d440a['use'](_0x0b38('0x91'),require(_0x0b38('0x92')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x0b38('0x93')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x94'),require('./api/intSugarcrmField'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x95'),require(_0x0b38('0x96')));_0x3d440a['use'](_0x0b38('0x97'),require(_0x0b38('0x98')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x99'),require(_0x0b38('0x9a')));_0x3d440a['use'](_0x0b38('0x9b'),require(_0x0b38('0x9c')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/zoho/configurations',require(_0x0b38('0x9d')));_0x3d440a['use']('/api/integrations/zoho/fields',require(_0x0b38('0x9e')));_0x3d440a['use'](_0x0b38('0x9f'),require('./api/intZendeskAccount'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa0'),require(_0x0b38('0xa1')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa2'),require(_0x0b38('0xa3')));_0x3d440a['use'](_0x0b38('0xa4'),require('./api/intFreshdeskAccount'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa5'),require('./api/intFreshdeskConfiguration'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa6'),require('./api/intFreshdeskField'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa7'),require(_0x0b38('0xa8')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xa9'),require(_0x0b38('0xaa')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/vtiger/fields',require(_0x0b38('0xab')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xac'),require('./api/intServicenowAccount'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xad'),require(_0x0b38('0xae')));_0x3d440a['use']('/api/integrations/servicenow/fields',require(_0x0b38('0xaf')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/dynamics365/accounts',require(_0x0b38('0xb0')));_0x3d440a['use'](_0x0b38('0xb1'),require(_0x0b38('0xb2')));_0x3d440a[_0x0b38('0xa')]('/api/integrations/dynamics365/fields',require(_0x0b38('0xb3')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xb4'),require(_0x0b38('0xb5')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xb6'),require(_0x0b38('0xb7')));_0x3d440a['use'](_0x0b38('0xb8'),require(_0x0b38('0xb9')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xba'),require(_0x0b38('0xbb')));_0x3d440a['use'](_0x0b38('0xbc'),require('./api/chatQueueReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xbd'),require(_0x0b38('0xbe')));_0x3d440a[_0x0b38('0xa')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xbf'),require(_0x0b38('0xc0')));_0x3d440a[_0x0b38('0xa')]('/api/jscripty/sessions/reports',require(_0x0b38('0xc1')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xc2'),require(_0x0b38('0xc3')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xc4'),require(_0x0b38('0xc5')));_0x3d440a['use'](_0x0b38('0xc6'),require(_0x0b38('0xc7')));_0x3d440a['use'](_0x0b38('0xc8'),require('./api/jscriptyProject'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xc9'),require(_0x0b38('0xca')));_0x3d440a['use'](_0x0b38('0xcb'),require(_0x0b38('0xcc')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xcd'),require(_0x0b38('0xce')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xcf'),require(_0x0b38('0xd0')));_0x3d440a['use'](_0x0b38('0xd1'),require('./api/squareMessage'));_0x3d440a[_0x0b38('0xa')]('/api/teams',require('./api/team'));_0x3d440a['use']('/api/license',require(_0x0b38('0xd2')));_0x3d440a['use']('/api/campaigns',require(_0x0b38('0xd3')));_0x3d440a['use']('/api/migrations',require(_0x0b38('0xd4')));_0x3d440a['use']('/api/attachments',require('./api/attachment'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xd5'),require(_0x0b38('0xd6')));_0x3d440a[_0x0b38('0xa')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xd7'),require(_0x0b38('0xd8')));_0x3d440a[_0x0b38('0xa')]('/api/fax/reports/transfer',require(_0x0b38('0xd9')));_0x3d440a['use'](_0x0b38('0xda'),require(_0x0b38('0xdb')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xdc'),require('./api/smsTransferReport'));_0x3d440a['use'](_0x0b38('0xdd'),require(_0x0b38('0xde')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xdf'),require(_0x0b38('0xe0')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xe1'),require(_0x0b38('0xe2')));_0x3d440a['use']('/api/userProfile/sections',require('./api/userProfileSection'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xe3'),require(_0x0b38('0xe4')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xe5'),require(_0x0b38('0xe6')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xe7'),require(_0x0b38('0xe8')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xe9'),require(_0x0b38('0xea')));_0x3d440a['use'](_0x0b38('0xeb'),require(_0x0b38('0xec')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xed'),require(_0x0b38('0xee')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xef'),require(_0x0b38('0xf0')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf1'),require('./api/whatsappTransferReport'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf2'),require(_0x0b38('0xf3')));_0x3d440a[_0x0b38('0xa')]('/api/cloudProviders',require(_0x0b38('0xf4')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf5'),require(_0x0b38('0xf6')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf7'),require('./api/user-setting'));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xf8'),require(_0x0b38('0xf9')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xfa'),require('./api/authGoogle'));_0x3d440a[_0x0b38('0xa')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x3d440a['use'](_0x0b38('0xfb'),require(_0x0b38('0xfc')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xfd'),require(_0x0b38('0xfe')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0xff'),require(_0x0b38('0x100')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x101'),require(_0x0b38('0x102')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x103'),require(_0x0b38('0x104')));_0x3d440a[_0x0b38('0xa')]('/api/webbar',require(_0x0b38('0x105')));_0x3d440a['use']('/api/logs',clientSideLogs);_0x3d440a['use'](_0x0b38('0x106'),express['static'](path[_0x0b38('0x107')](config[_0x0b38('0x108')],'/apidoc')));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x109'),express[_0x0b38('0x10a')](path[_0x0b38('0x107')](config[_0x0b38('0x108')],_0x0b38('0x109'))));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x10b'),express[_0x0b38('0x10a')](path[_0x0b38('0x107')](config[_0x0b38('0x108')],_0x0b38('0x10b'))));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x10c'),express[_0x0b38('0x10a')](path[_0x0b38('0x107')](config['root'],_0x0b38('0x10d'),_0x0b38('0x10e'))));_0x3d440a[_0x0b38('0xa')](_0x0b38('0x10f'),express[_0x0b38('0x10a')](path[_0x0b38('0x107')](config[_0x0b38('0x108')],_0x0b38('0x110'))));_0x3d440a[_0x0b38('0x111')](_0x0b38('0x112'))[_0x0b38('0x113')](errors[0x194]);_0x3d440a[_0x0b38('0x111')]('/*')[_0x0b38('0x113')](function(_0x33d6a5,_0xed529a){_0xed529a[_0x0b38('0x114')](path[_0x0b38('0x115')](_0x3d440a['get'](_0x0b38('0x116'))+_0x0b38('0x117')));});return _0x3d440a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9a29774..a93047c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x280b=['error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','localhost'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x280b,0xce));var _0xb280=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x280b[_0x6131cd];return _0x47e916;};'use strict';var jayson=require(_0xb280('0x0'));var _=require(_0xb280('0x1'));var config=require('../config/environment');exports[_0xb280('0x2')]=function(){return new Promise(function(_0x3c4f59,_0x444d16){var _0x3a59e1={};_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x4')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x5')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/voiceQueue/voiceQueue.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x6')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x7')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x8')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x9')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/memberReport/memberReport.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0xa')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0xb')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0xc')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0xd')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0xe')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0xf')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x10')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x11')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x12')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/faxAccount/faxAccount.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/faxApplication/faxApplication.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x13')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x14')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x15')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x16')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x17')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x18')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x19')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x1a')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x1b')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x1c')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x1d')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x1e')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x1f')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/chatMessage/chatMessage.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x20')));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/cmContact/cmContact.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x21')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x22')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x23')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x24')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x25')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/interval/interval.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x26')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x27')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x28')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/template/template.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x29')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x2a')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x2b')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x2c')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x2d')));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x2e')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x2f')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x30')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x31')));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/squareReport/squareReport.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x32')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x33')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/squareProject/squareProject.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/squareRecording/squareRecording.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require('../api/squareMessage/squareMessage.rpc'));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x34')));_0x3a59e1=_['merge'](_0x3a59e1,require('../api/attachment/attachment.rpc'));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x35')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x36')));_0x3a59e1=_['merge'](_0x3a59e1,require(_0xb280('0x37')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x38')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x39')));_0x3a59e1=_[_0xb280('0x3')](_0x3a59e1,require(_0xb280('0x3a')));var _0x4ef209=jayson[_0xb280('0x3b')](_0x3a59e1)['http']();var _0x51ce95=config['rpc'][_0xb280('0x3c')]||config[_0xb280('0x3c')]+0x1;var _0xc06527=config['rpc']['ip']||_0xb280('0x3d');_0x4ef209['on'](_0xb280('0x3e'),function(_0x15e3b0){return _0x444d16(_0x15e3b0);});_0x4ef209[_0xb280('0x2')](_0x51ce95,_0xc06527,function(){console[_0xb280('0x3f')](_0xb280('0x40'),_0xc06527,_0x51ce95);require(_0xb280('0x41'))[_0xb280('0x42')]();return _0x3c4f59('RPC\x20listening\x20on\x20'+_0xc06527+':'+_0x51ce95);});});}; \ No newline at end of file +var _0x3a44=['../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc'];(function(_0x3fab04,_0x1cfb36){var _0x38b73f=function(_0x499b7f){while(--_0x499b7f){_0x3fab04['push'](_0x3fab04['shift']());}};_0x38b73f(++_0x1cfb36);}(_0x3a44,0x1e5));var _0x43a4=function(_0x5a778a,_0x1e09f8){_0x5a778a=_0x5a778a-0x0;var _0x2ff9f0=_0x3a44[_0x5a778a];return _0x2ff9f0;};'use strict';var jayson=require(_0x43a4('0x0'));var _=require(_0x43a4('0x1'));var config=require('../config/environment');exports[_0x43a4('0x2')]=function(){return new Promise(function(_0x3417db,_0x3471b1){var _0x4d14a8={};_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x3')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x5')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/voiceQueue/voiceQueue.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x6')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x7')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x8')));_0x4d14a8=_['merge'](_0x4d14a8,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x9')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0xa')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0xb')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0xc')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0xd')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0xe')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0xf')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x10')));_0x4d14a8=_['merge'](_0x4d14a8,require('../api/mailApplication/mailApplication.rpc'));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x11')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x12')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/faxApplication/faxApplication.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x13')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x14')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x15')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x16')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x17')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x18')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x19')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x1a')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x1b')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x1c')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x1d')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x1e')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x1f')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x20')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/chatMessage/chatMessage.rpc'));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x21')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x22')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x23')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x24')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x25')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x26')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x27')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x28')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/pause/pause.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x29')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x2a')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/trigger/trigger.rpc'));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x2b')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x2c')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x2d')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x2e')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x2f')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x30')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x31')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x32')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x33')));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x34')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x35')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x36')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x37')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x38')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x39')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x3a')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/squareProject/squareProject.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/squareRecording/squareRecording.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x3b')));_0x4d14a8=_['merge'](_0x4d14a8,require('../api/campaign/campaign.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x3c')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x3d')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4d14a8=_['merge'](_0x4d14a8,require(_0x43a4('0x3e')));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x3f')));_0x4d14a8=_['merge'](_0x4d14a8,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4d14a8=_[_0x43a4('0x4')](_0x4d14a8,require(_0x43a4('0x40')));var _0x2aae76=jayson[_0x43a4('0x41')](_0x4d14a8)['http']();var _0x36c95a=config[_0x43a4('0x42')][_0x43a4('0x43')]||config[_0x43a4('0x43')]+0x1;var _0xad7e8d=config[_0x43a4('0x42')]['ip']||_0x43a4('0x44');_0x2aae76['on'](_0x43a4('0x45'),function(_0x1fd0c9){return _0x3471b1(_0x1fd0c9);});_0x2aae76[_0x43a4('0x2')](_0x36c95a,_0xad7e8d,function(){console[_0x43a4('0x46')](_0x43a4('0x47'),_0xad7e8d,_0x36c95a);require(_0x43a4('0x48'))[_0x43a4('0x49')]();return _0x3417db(_0x43a4('0x4a')+_0xad7e8d+':'+_0x36c95a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8cfcdb0..152e079 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 _0x3ed6=['events','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','substr','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','prototype','sendRequest','ANSWER','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash'];(function(_0x3fa0dc,_0x2f89a8){var _0x1bdfd8=function(_0x3f971a){while(--_0x3f971a){_0x3fa0dc['push'](_0x3fa0dc['shift']());}};_0x1bdfd8(++_0x2f89a8);}(_0x3ed6,0x12f));var _0x63ed=function(_0x5a562d,_0x49cb8e){_0x5a562d=_0x5a562d-0x0;var _0x5824b9=_0x3ed6[_0x5a562d];return _0x5824b9;};'use strict';var util=require('util');var _=require(_0x63ed('0x0'));var EventEmitter=require(_0x63ed('0x1'))['EventEmitter'];var AGIReply=require(_0x63ed('0x2'));var AGIError=require(_0x63ed('0x3'));function AGIChannel(_0x42b1c1){var _0x39674f=this,_0x1c15d0=new AGIReply(),_0x4e7d19=![],_0x3efbe0={};EventEmitter[_0x63ed('0x4')](_0x39674f);_0x42b1c1[_0x63ed('0x5')]('utf8');_0x42b1c1[_0x63ed('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1c15d0['setEncoding'](_0x63ed('0x7'));_0x1c15d0['on'](_0x63ed('0x8'),function(_0x4230c4){for(var _0x534f25 in _0x4230c4){_0x39674f[_0x534f25]=_0x4230c4[_0x534f25];}_0x39674f[_0x63ed('0x9')](_0x63ed('0xa'));});_0x1c15d0['on'](_0x63ed('0xb'),function(_0x252541){if(_0x252541[_0x63ed('0xc')]()=='hangup'){_0x39674f[_0x63ed('0x9')](_0x63ed('0xd'));return;}if(_0x252541[_0x63ed('0xe')](0x0,0xb)==_0x63ed('0xf')){_0x4e7d19=!![];}if(_0x4e7d19){_0x3efbe0['rx']+=_0x252541+'\x0a';if(_0x252541['search']('520\x20End\x20of\x20proper')!=-0x1){_0x4e7d19=![];}}else{_0x3efbe0['rx']=_0x252541;}if(_0x4e7d19){return;}if(typeof _0x3efbe0['cb']==_0x63ed('0x10')){var _0x42c669=_0x3efbe0['rx']['substring'](0x0,0x3),_0x5e059b=null,_0x1dd2a7=null;_0x42c669=parseInt(_0x42c669);if(isNaN(_0x42c669)){_0x3efbe0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x63ed('0x11')});return;}if(_0x42c669!=0xc8){_0x3efbe0['cb'](null,{'code':_0x42c669,'result':-0x1,'extra':'KO'});return;}_0x5e059b=_0x3efbe0['rx']['substring'](0x4)['replace']('result=','');if(_0x5e059b['indexOf']('\x20')!=-0x1){_0x5e059b=_0x5e059b[_0x63ed('0x12')](0x0,_0x5e059b[_0x63ed('0x13')]('\x20'));}if(_[_0x63ed('0x14')](_0x5e059b,'-1')){_0x5e059b=parseInt(_0x5e059b);}_0x1dd2a7=_0x3efbe0['rx'][_0x63ed('0x15')]('\x20');if(_0x1dd2a7[_0x63ed('0x16')]==0x3){_0x1dd2a7=_0x1dd2a7[0x2]['substring'](0x1,_0x1dd2a7[0x2][_0x63ed('0x16')]-0x1);}else if(_0x1dd2a7[_0x63ed('0x16')]>0x3){var _0x43c07c=/\((.+)\)/;var _0x1ff7dc=_0x3efbe0['rx'][_0x63ed('0x17')](_0x43c07c);if(_0x1ff7dc){_0x1dd2a7=_0x1ff7dc[0x1];}else{_0x1dd2a7=null;}}else{_0x1dd2a7=null;}_0x3efbe0['cb'](null,{'code':_0x42c669,'result':_0x5e059b,'extra':_0x1dd2a7});}});_0x42b1c1['on'](_0x63ed('0x18'),function(_0x585ef1){_0x39674f['emit'](_0x63ed('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x585ef1[_0x63ed('0x19')]));});_0x42b1c1['on']('close',function(){_0x39674f[_0x63ed('0x9')](_0x63ed('0x1a'),new AGIError(_0x63ed('0x1b')));});_0x42b1c1['on'](_0x63ed('0x1c'),function(){_0x39674f['emit'](_0x63ed('0x1c'),new AGIError(_0x63ed('0x1d')));_0x42b1c1['destroy']();});_0x42b1c1[_0x63ed('0x1e')](_0x1c15d0);this[_0x63ed('0x1f')]=function(_0x5264c8,_0x5eddd8){var _0x5264c8=_0x5264c8||'',_0x5eddd8=typeof _0x5eddd8==_0x63ed('0x10')?_0x5eddd8:new Function();_0x3efbe0={'tx':_0x5264c8,'rx':'','cb':_0x5eddd8};_0x42b1c1[_0x63ed('0x20')](_0x5264c8+'\x0a');},this[_0x63ed('0x1a')]=function(){_0x42b1c1[_0x63ed('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x63ed('0x22')][_0x63ed('0x23')]=function(_0x3da387){return this['command']['sync'](this,_0x3da387);};AGIChannel[_0x63ed('0x22')]['answer']=function(){return this['sendRequest'](_0x63ed('0x24'));};AGIChannel[_0x63ed('0x22')]['getData']=function(_0x18d3d7,_0x19a0ec,_0x49ae6b){_0x18d3d7=_0x18d3d7===undefined?_0x63ed('0x25'):_0x18d3d7;_0x19a0ec=_0x19a0ec===undefined?'5':_0x19a0ec;_0x49ae6b=_0x49ae6b===undefined?'1':_0x49ae6b;return this[_0x63ed('0x23')](util[_0x63ed('0x26')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x18d3d7,_0x19a0ec*0x3e8,_0x49ae6b));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x27')]=function(_0x5b79bd){_0x5b79bd=_0x5b79bd||_0x63ed('0x28');return this['sendRequest'](util[_0x63ed('0x26')](_0x63ed('0x29'),_0x5b79bd));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x2a')]=function(_0x739613,_0x31ceee){if(_[_0x63ed('0x2b')](_0x31ceee)){return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x2c'),_0x739613,_0x31ceee['join'](',')));}return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x2c'),_0x739613,_0x31ceee));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x2d')]=function(_0x370888){return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x2e'),_0x370888));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x2f')]=function(_0x2ea986){return this['sendRequest'](util[_0x63ed('0x26')](_0x63ed('0x30'),_0x2ea986));};AGIChannel['prototype'][_0x63ed('0x31')]=function(_0x3fe021){return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x32'),_0x3fe021));};AGIChannel[_0x63ed('0x22')][_0x63ed('0xd')]=function(){return this[_0x63ed('0x23')]('HANGUP');};AGIChannel[_0x63ed('0x22')][_0x63ed('0x33')]=function(_0x5e642a,_0x5e7697){var _0x175e35=_['isBoolean'](_0x5e7697)||_[_0x63ed('0x34')](_0x5e7697)?_0x5e7697[_0x63ed('0x35')]():_0x5e7697;return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x36'),_0x5e642a,_0x175e35?_0x175e35[_0x63ed('0x35')]()[_0x63ed('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x38')]=function(_0xb6cecd,_0x171352){return this['sendRequest'](util[_0x63ed('0x26')](_0x63ed('0x39'),_0xb6cecd,_0x171352));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x3a')]=function(_0x344ad8,_0x12d62a){return this['sendRequest'](util[_0x63ed('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x344ad8,_0x12d62a));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x3b')]=function(_0x5780b7,_0x582a55){return this['sendRequest'](util[_0x63ed('0x26')](_0x63ed('0x3c'),_0x5780b7,_0x582a55));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x3d')]=function(_0x4489f9,_0x39ec0b,_0x49839d){_0x39ec0b=_0x39ec0b||this['extension'];_0x49839d=_0x49839d||0x1;this[_0x63ed('0x2d')](_0x4489f9);this[_0x63ed('0x2f')](_0x39ec0b);this[_0x63ed('0x31')](_0x49839d);return this['noop'](util[_0x63ed('0x26')](_0x63ed('0x3e'),_0x4489f9,_0x39ec0b,_0x49839d));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x3f')]=function(_0x1a6c97){return this[_0x63ed('0x23')](util[_0x63ed('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1a6c97));};AGIChannel['prototype'][_0x63ed('0x40')]=function(_0x2d6ff8,_0xe986b2,_0xfdd91f,_0x46f3ac,_0xde63f8,_0x5131d5){_0xe986b2=_0xe986b2||_0x63ed('0x41');_0xfdd91f=_0xfdd91f||'';_0x46f3ac=_0x46f3ac===undefined?-0x1:_0x46f3ac==='-1'?-0x1:_0x46f3ac*0x3e8;_0xde63f8=_0xde63f8===undefined?'':'s='+_0xde63f8;_0x5131d5=_0x5131d5?_0x63ed('0x42'):'';return this[_0x63ed('0x23')](util[_0x63ed('0x26')](_0x63ed('0x43'),_0x2d6ff8,_0xe986b2,_0xfdd91f,_0x46f3ac,_0x5131d5,_0xde63f8));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x44')]=function(_0x55a2f2,_0x84e689){_0x84e689=_0x84e689||'';return this['sendRequest'](util[_0x63ed('0x26')](_0x63ed('0x45'),_0x55a2f2,_0x84e689));};AGIChannel[_0x63ed('0x22')][_0x63ed('0x46')]=function(_0x1220ad){return this[_0x63ed('0x2a')](_0x63ed('0x47'),_0x1220ad);};AGIChannel[_0x63ed('0x22')][_0x63ed('0x48')]=function(_0x1c6d2a){return this[_0x63ed('0x2a')]('WAIT',_0x1c6d2a);};AGIChannel['prototype'][_0x63ed('0x18')]=function(_0x32c244,_0x574290){this['noop'](util[_0x63ed('0x26')](_0x63ed('0x49'),_0x32c244['id'],_0x32c244[_0x63ed('0x4a')],_0x574290));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x63ed('0x4b')]=AGIChannel; \ No newline at end of file +var _0x9fa3=['timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','hangup','substring','520-Invalid','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close'];(function(_0x20518b,_0x46a2f7){var _0x326afb=function(_0x581fd2){while(--_0x581fd2){_0x20518b['push'](_0x20518b['shift']());}};_0x326afb(++_0x46a2f7);}(_0x9fa3,0x112));var _0x39fa=function(_0x31ef81,_0x1e50d8){_0x31ef81=_0x31ef81-0x0;var _0x5e87ee=_0x9fa3[_0x31ef81];return _0x5e87ee;};'use strict';var util=require(_0x39fa('0x0'));var _=require(_0x39fa('0x1'));var EventEmitter=require(_0x39fa('0x2'))[_0x39fa('0x3')];var AGIReply=require(_0x39fa('0x4'));var AGIError=require(_0x39fa('0x5'));function AGIChannel(_0x48c620){var _0x19300a=this,_0x16014c=new AGIReply(),_0x2dc9a8=![],_0x3dbaad={};EventEmitter['call'](_0x19300a);_0x48c620[_0x39fa('0x6')](_0x39fa('0x7'));_0x48c620[_0x39fa('0x8')](0x8*0x3c*0x3c*0x3e8);_0x16014c[_0x39fa('0x6')]('utf8');_0x16014c['on'](_0x39fa('0x9'),function(_0x5814c8){for(var _0x2f01b3 in _0x5814c8){_0x19300a[_0x2f01b3]=_0x5814c8[_0x2f01b3];}_0x19300a[_0x39fa('0xa')]('ready');});_0x16014c['on']('line',function(_0x53b0b8){if(_0x53b0b8['toLowerCase']()==_0x39fa('0xb')){_0x19300a[_0x39fa('0xa')](_0x39fa('0xb'));return;}if(_0x53b0b8[_0x39fa('0xc')](0x0,0xb)==_0x39fa('0xd')){_0x2dc9a8=!![];}if(_0x2dc9a8){_0x3dbaad['rx']+=_0x53b0b8+'\x0a';if(_0x53b0b8['search']('520\x20End\x20of\x20proper')!=-0x1){_0x2dc9a8=![];}}else{_0x3dbaad['rx']=_0x53b0b8;}if(_0x2dc9a8){return;}if(typeof _0x3dbaad['cb']=='function'){var _0x4c1374=_0x3dbaad['rx'][_0x39fa('0xc')](0x0,0x3),_0x13ace8=null,_0x2ff369=null;_0x4c1374=parseInt(_0x4c1374);if(isNaN(_0x4c1374)){_0x3dbaad['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4c1374!=0xc8){_0x3dbaad['cb'](null,{'code':_0x4c1374,'result':-0x1,'extra':'KO'});return;}_0x13ace8=_0x3dbaad['rx'][_0x39fa('0xc')](0x4)['replace']('result=','');if(_0x13ace8[_0x39fa('0xe')]('\x20')!=-0x1){_0x13ace8=_0x13ace8[_0x39fa('0xf')](0x0,_0x13ace8[_0x39fa('0xe')]('\x20'));}if(_['startsWith'](_0x13ace8,'-1')){_0x13ace8=parseInt(_0x13ace8);}_0x2ff369=_0x3dbaad['rx'][_0x39fa('0x10')]('\x20');if(_0x2ff369['length']==0x3){_0x2ff369=_0x2ff369[0x2][_0x39fa('0xc')](0x1,_0x2ff369[0x2][_0x39fa('0x11')]-0x1);}else if(_0x2ff369[_0x39fa('0x11')]>0x3){var _0x160eb6=/\((.+)\)/;var _0x57ee5d=_0x3dbaad['rx']['match'](_0x160eb6);if(_0x57ee5d){_0x2ff369=_0x57ee5d[0x1];}else{_0x2ff369=null;}}else{_0x2ff369=null;}_0x3dbaad['cb'](null,{'code':_0x4c1374,'result':_0x13ace8,'extra':_0x2ff369});}});_0x48c620['on'](_0x39fa('0x12'),function(_0x27ca8e){_0x19300a[_0x39fa('0xa')](_0x39fa('0x12'),new AGIError(_0x39fa('0x13'),_0x27ca8e[_0x39fa('0x14')]));});_0x48c620['on'](_0x39fa('0x15'),function(){_0x19300a[_0x39fa('0xa')](_0x39fa('0x15'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x48c620['on'](_0x39fa('0x16'),function(){_0x19300a['emit'](_0x39fa('0x16'),new AGIError(_0x39fa('0x17')));_0x48c620[_0x39fa('0x18')]();});_0x48c620[_0x39fa('0x19')](_0x16014c);this[_0x39fa('0x1a')]=function(_0xb368a4,_0x22b388){var _0xb368a4=_0xb368a4||'',_0x22b388=typeof _0x22b388==_0x39fa('0x1b')?_0x22b388:new Function();_0x3dbaad={'tx':_0xb368a4,'rx':'','cb':_0x22b388};_0x48c620[_0x39fa('0x1c')](_0xb368a4+'\x0a');},this[_0x39fa('0x15')]=function(){_0x48c620[_0x39fa('0x18')]();};}util[_0x39fa('0x1d')](AGIChannel,EventEmitter);AGIChannel[_0x39fa('0x1e')]['sendRequest']=function(_0x21e4bb){return this[_0x39fa('0x1a')]['sync'](this,_0x21e4bb);};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x1f')]=function(){return this[_0x39fa('0x20')](_0x39fa('0x21'));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x22')]=function(_0x1cc904,_0x1a852d,_0x1378e0){_0x1cc904=_0x1cc904===undefined?_0x39fa('0x23'):_0x1cc904;_0x1a852d=_0x1a852d===undefined?'5':_0x1a852d;_0x1378e0=_0x1378e0===undefined?'1':_0x1378e0;return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x25'),_0x1cc904,_0x1a852d*0x3e8,_0x1378e0));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x26')]=function(_0x5d5d54){_0x5d5d54=_0x5d5d54||_0x39fa('0x27');return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x28'),_0x5d5d54));};AGIChannel[_0x39fa('0x1e')]['exec']=function(_0xf67672,_0x534f38){if(_[_0x39fa('0x29')](_0x534f38)){return this['sendRequest'](util[_0x39fa('0x24')](_0x39fa('0x2a'),_0xf67672,_0x534f38[_0x39fa('0x2b')](',')));}return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x2a'),_0xf67672,_0x534f38));};AGIChannel[_0x39fa('0x1e')]['setContext']=function(_0x5896d1){return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x2c'),_0x5896d1));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x2d')]=function(_0x53fb3b){return this[_0x39fa('0x20')](util[_0x39fa('0x24')]('SET\x20EXTENSION\x20%s',_0x53fb3b));};AGIChannel['prototype'][_0x39fa('0x2e')]=function(_0x3d9319){return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x2f'),_0x3d9319));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0xb')]=function(){return this['sendRequest'](_0x39fa('0x30'));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x31')]=function(_0x1b16aa,_0x1eba60){var _0x43bc07=_['isBoolean'](_0x1eba60)||_[_0x39fa('0x32')](_0x1eba60)?_0x1eba60[_0x39fa('0x33')]():_0x1eba60;return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x34'),_0x1b16aa,_0x43bc07?_0x43bc07[_0x39fa('0x33')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x35')]=function(_0x2c0eef,_0x5792ea){return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x36'),_0x2c0eef,_0x5792ea));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x37')]=function(_0x455a53,_0x47315a){return this[_0x39fa('0x20')](util[_0x39fa('0x24')]('SAY\x20DIGITS\x20%s\x20%s',_0x455a53,_0x47315a));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x38')]=function(_0x501109,_0x54d5f8){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x501109,_0x54d5f8));};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x39')]=function(_0x531a3c,_0x4c3555,_0x3aba1a){_0x4c3555=_0x4c3555||this[_0x39fa('0x3a')];_0x3aba1a=_0x3aba1a||0x1;this[_0x39fa('0x3b')](_0x531a3c);this[_0x39fa('0x2d')](_0x4c3555);this[_0x39fa('0x2e')](_0x3aba1a);return this[_0x39fa('0x26')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x531a3c,_0x4c3555,_0x3aba1a));};AGIChannel['prototype'][_0x39fa('0x3c')]=function(_0x20bd46){return this[_0x39fa('0x20')](util['format'](_0x39fa('0x3d'),_0x20bd46));};AGIChannel['prototype'][_0x39fa('0x3e')]=function(_0x2c59d1,_0x527ab3,_0x4a18c1,_0x2f46bf,_0x5ad727,_0x5eb66c){_0x527ab3=_0x527ab3||_0x39fa('0x3f');_0x4a18c1=_0x4a18c1||'';_0x2f46bf=_0x2f46bf===undefined?-0x1:_0x2f46bf==='-1'?-0x1:_0x2f46bf*0x3e8;_0x5ad727=_0x5ad727===undefined?'':'s='+_0x5ad727;_0x5eb66c=_0x5eb66c?_0x39fa('0x40'):'';return this['sendRequest'](util[_0x39fa('0x24')](_0x39fa('0x41'),_0x2c59d1,_0x527ab3,_0x4a18c1,_0x2f46bf,_0x5eb66c,_0x5ad727));};AGIChannel['prototype'][_0x39fa('0x42')]=function(_0x125c19,_0x5d47ec){_0x5d47ec=_0x5d47ec||'';return this[_0x39fa('0x20')](util[_0x39fa('0x24')](_0x39fa('0x43'),_0x125c19,_0x5d47ec));};AGIChannel[_0x39fa('0x1e')]['agi']=function(_0xdb45b9){return this[_0x39fa('0x44')]('AGI',_0xdb45b9);};AGIChannel[_0x39fa('0x1e')][_0x39fa('0x45')]=function(_0x302840){return this['exec'](_0x39fa('0x46'),_0x302840);};AGIChannel['prototype'][_0x39fa('0x12')]=function(_0x2498a9,_0x1167fc){this[_0x39fa('0x26')](util['format'](_0x39fa('0x47'),_0x2498a9['id'],_0x2498a9[_0x39fa('0x48')],_0x1167fc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x39fa('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d37c421..eab4664 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 _0x9947=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x340939,_0x4d0829){var _0x444427=function(_0x4ea20c){while(--_0x4ea20c){_0x340939['push'](_0x340939['shift']());}};_0x444427(++_0x4d0829);}(_0x9947,0x131));var _0x7994=function(_0x1bb49c,_0x510210){_0x1bb49c=_0x1bb49c-0x0;var _0x45db79=_0x9947[_0x1bb49c];return _0x45db79;};'use strict';var util=require(_0x7994('0x0'));var error={'E_AGI_UNDEFINED':_0x7994('0x1'),'E_AGI_ARGUMENT_PORT':_0x7994('0x2'),'E_AGI_SERVER_ERROR':_0x7994('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7994('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7994('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x7994('0x6'),'E_AGI_COMMAND_EMPTY':_0x7994('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7994('0x8'),'E_AGI_IVR_ENTRY':_0x7994('0x9')};function AGIError(_0x1d8d00){var _0x1d8d00=_0x1d8d00||null,_0x34f925=_0x34f925||[],_0xd21e86=0x1,_0x352140='';if(!error[_0x1d8d00]){_0x1d8d00=_0x7994('0xa');}_0x34f925[_0x7994('0xb')](error[_0x1d8d00]);while(arguments[_0xd21e86]){_0x34f925[_0x7994('0xb')](arguments[_0xd21e86]);_0xd21e86++;}_0x352140=util[_0x7994('0xc')][_0x7994('0xd')](util,_0x34f925);this[_0x7994('0xe')]=_0x352140;this[_0x7994('0xf')]=_0x1d8d00;}module[_0x7994('0x10')]=AGIError; \ No newline at end of file +var _0xc8a2=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x16f301,_0x373393){var _0x3c4257=function(_0x2a3769){while(--_0x2a3769){_0x16f301['push'](_0x16f301['shift']());}};_0x3c4257(++_0x373393);}(_0xc8a2,0x1cd));var _0x2c8a=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc8a2[_0x173441];return _0x2423a8;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2c8a('0x0'),'E_AGI_SERVER_ERROR':_0x2c8a('0x1'),'E_AGI_SERVER_CLOSE':_0x2c8a('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2c8a('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2c8a('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x2c8a('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2c8a('0x6'),'E_AGI_IVR_ENTRY':_0x2c8a('0x7')};function AGIError(_0x2a1f3b){var _0x2a1f3b=_0x2a1f3b||null,_0x4aee65=_0x4aee65||[],_0x395a21=0x1,_0xf21c49='';if(!error[_0x2a1f3b]){_0x2a1f3b=_0x2c8a('0x8');}_0x4aee65[_0x2c8a('0x9')](error[_0x2a1f3b]);while(arguments[_0x395a21]){_0x4aee65[_0x2c8a('0x9')](arguments[_0x395a21]);_0x395a21++;}_0xf21c49=util['format'][_0x2c8a('0xa')](util,_0x4aee65);this['message']=_0xf21c49;this[_0x2c8a('0xb')]=_0x2a1f3b;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index b276d5f..5f15af7 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 _0xbab3=['defaults','redis','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','ioredis','../../config/environment'];(function(_0x1da156,_0x54f960){var _0x21de36=function(_0x1b87a9){while(--_0x1b87a9){_0x1da156['push'](_0x1da156['shift']());}};_0x21de36(++_0x54f960);}(_0xbab3,0x65));var _0x3bab=function(_0x5c4d30,_0x2bc47a){_0x5c4d30=_0x5c4d30-0x0;var _0x120851=_0xbab3[_0x5c4d30];return _0x120851;};'use strict';var _=require(_0x3bab('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x3bab('0x1'));var AGIError=require('./error');var config=require(_0x3bab('0x2'));config['redis']=_[_0x3bab('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3bab('0x4')]);sub[_0x3bab('0x5')](_0x3bab('0x6'),function(_0x1319fc){if(_0x1319fc)return eventEmitter[_0x3bab('0x7')](_0x3bab('0x8'),new AGIError(_0x3bab('0x9'),_0x1319fc));});sub['on'](_0x3bab('0xa'),function(_0x59d2a4,_0x8f5d51){if(_0x59d2a4!==_0x3bab('0x6'))return;try{var _0x93d2e5=JSON[_0x3bab('0xb')](_0x8f5d51);eventEmitter[_0x3bab('0x7')](_0x3bab('0xc'),_0x93d2e5);}catch(_0x19838a){eventEmitter[_0x3bab('0x7')](_0x3bab('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x19838a));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x40ea=['defaults','redis','localhost','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','EventEmitter','../../config/environment'];(function(_0x27390d,_0x588020){var _0x40453d=function(_0x6e7c00){while(--_0x6e7c00){_0x27390d['push'](_0x27390d['shift']());}};_0x40453d(++_0x588020);}(_0x40ea,0x75));var _0xa40e=function(_0x3ef509,_0x115ed8){_0x3ef509=_0x3ef509-0x0;var _0x3975fb=_0x40ea[_0x3ef509];return _0x3975fb;};'use strict';var _=require(_0xa40e('0x0'));var EventEmitter=require('events')[_0xa40e('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0xa40e('0x2'));config['redis']=_[_0xa40e('0x3')](config[_0xa40e('0x4')],{'host':_0xa40e('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x45a873){if(_0x45a873)return eventEmitter[_0xa40e('0x6')](_0xa40e('0x7'),new AGIError(_0xa40e('0x8'),_0x45a873));});sub['on'](_0xa40e('0x9'),function(_0x1b9642,_0x4579cc){if(_0x1b9642!=='agi')return;try{var _0x2a113a=JSON[_0xa40e('0xa')](_0x4579cc);eventEmitter['emit'](_0xa40e('0xb'),_0x2a113a);}catch(_0x4c2aa5){eventEmitter[_0xa40e('0x6')](_0xa40e('0x7'),new AGIError(_0xa40e('0x8'),_0x4c2aa5));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 08f4e7c..337c545 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 _0x15a5=['addEdge','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x15a5,0x148));var _0x515a=function(_0x538dfe,_0x3ee6f4){_0x538dfe=_0x538dfe-0x0;var _0x61bd72=_0x15a5[_0x538dfe];return _0x61bd72;};'use strict';var _=require(_0x515a('0x0'));var logger=require(_0x515a('0x1'))('agi');var verticesWithRetry=[_0x515a('0x2'),_0x515a('0x3'),_0x515a('0x4')];var Graph=function(){this[_0x515a('0x5')]={};this[_0x515a('0x6')]={};this[_0x515a('0x7')]=0x0;};Graph[_0x515a('0x8')][_0x515a('0x9')]=function(_0x2caef5){this['vertices'][_0x2caef5['id']]=_0x2caef5;this[_0x515a('0x6')][_0x2caef5['id']]=[];};Graph[_0x515a('0x8')][_0x515a('0xa')]=function(_0xc67e74,_0x8b9dee,_0x4b6be2){this[_0x515a('0x6')][_0xc67e74]['push']({'target':_0x8b9dee,'condition':_0x4b6be2});this[_0x515a('0x7')]+=0x1;};Graph[_0x515a('0x8')]['size']=function(){return _['size'](this[_0x515a('0x5')]);};Graph[_0x515a('0x8')][_0x515a('0xb')]=function(){return this[_0x515a('0x7')];};Graph['prototype']['getVertex']=function(_0x4fc424){return this['vertices'][_0x4fc424];};Graph[_0x515a('0x8')][_0x515a('0xc')]=function(_0x8a905,_0x37810a){if(!this['vertices'][_0x8a905]){return logger[_0x515a('0xd')](_0x515a('0xe'));}var _0x13cea2=_0x37810a(this[_0x515a('0x5')][_0x8a905]);if(!_0x13cea2){return logger[_0x515a('0xd')]('stop\x20traverse');}if(this[_0x515a('0x6')][_0x8a905]['length']===0x0){return logger[_0x515a('0xd')](_0x515a('0xf'));}for(var _0x208588=0x0,_0x2f9863=[],_0x3e6676=![];_0x208588\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1','projectUpdate','error','stack','deleted','push','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','[%s]\x20%s','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then'];(function(_0x24d92a,_0x5dcc4d){var _0x2d5aed=function(_0x2df528){while(--_0x2df528){_0x24d92a['push'](_0x24d92a['shift']());}};_0x2d5aed(++_0x5dcc4d);}(_0xb9c5,0xc2));var _0x5b9c=function(_0x594bcb,_0x14f803){_0x594bcb=_0x594bcb-0x0;var _0x4fe47b=_0xb9c5[_0x594bcb];return _0x4fe47b;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require('util');var config=require('../../config/environment');var logger=require(_0x5b9c('0x0'))(_0x5b9c('0x1'));var utilLicense=require(_0x5b9c('0x2'));var rpc=require(_0x5b9c('0x3'));var Project=require('./project');var AGIEmitter=require(_0x5b9c('0x4'))[_0x5b9c('0x5')];var projects=[];config[_0x5b9c('0x1')]=_['defaults'](config[_0x5b9c('0x1')],{'ip':_0x5b9c('0x6'),'port':0x11dd});AGIEmitter['on'](_0x5b9c('0x7'),projectUpdateHandler);function connectionHandler(_0x13a8e8){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x13a8e8);agiHandler(_0x13a8e8);}catch(_0xbd4223){logger[_0x5b9c('0x8')](_0xbd4223[_0x5b9c('0x9')]);}});});}function projectUpdateHandler(_0x1471a1){try{var _0x4dfcc6=_['findIndex'](projects,['id',_0x1471a1['id']]);if(_0x4dfcc6>-0x1){if(_0x1471a1[_0x5b9c('0xa')]===!![]){projects['splice'](_0x4dfcc6,0x1);}else{projects[_0x4dfcc6]=_0x1471a1;}}else{projects[_0x5b9c('0xb')](_0x1471a1);}}catch(_0x24da6b){logger[_0x5b9c('0x8')](_0x24da6b[_0x5b9c('0x9')]);}}function listeningHandler(){console[_0x5b9c('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0x5b9c('0xd')](util[_0x5b9c('0xe')](_0x5b9c('0xf'),config[_0x5b9c('0x1')]['ip'],config[_0x5b9c('0x1')][_0x5b9c('0x10')]));}function errorHandler(_0x4cba23){if(_0x4cba23&&_0x4cba23['name']&&_0x4cba23['message']){logger[_0x5b9c('0x8')](util[_0x5b9c('0xe')](_0x5b9c('0x11'),_0x4cba23[_0x5b9c('0x12')],_0x4cba23[_0x5b9c('0x13')]));}else{logger['error'](util[_0x5b9c('0xe')](_0x5b9c('0x14'),_0x4cba23[_0x5b9c('0x9')]));}}function closeHandler(){logger[_0x5b9c('0xd')](util['format'](_0x5b9c('0x15'),this['arg_1'],this[_0x5b9c('0x16')],this[_0x5b9c('0x17')],this[_0x5b9c('0x18')],this[_0x5b9c('0x19')]));try{createSquareReport(this);}catch(_0x29effc){logger[_0x5b9c('0x8')](_0x29effc[_0x5b9c('0x9')]);}}function timeoutHandler(){logger[_0x5b9c('0xd')](util[_0x5b9c('0xe')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5b9c('0x1a')],this['calleridname'],this['callerid'],this[_0x5b9c('0x18')],this[_0x5b9c('0x19')]));}function hangupHandler(){logger[_0x5b9c('0xd')](util['format'](_0x5b9c('0x1b'),this[_0x5b9c('0x1a')],this['calleridname'],this[_0x5b9c('0x17')],this[_0x5b9c('0x18')],this[_0x5b9c('0x19')]));this[_0x5b9c('0x1c')]=!![];}function createSquareReport(_0x4441cd,_0xa6cd24){rpc['createSquareReport'](_0x4441cd)[_0x5b9c('0x1d')](function(_0x20f755){if(_0xa6cd24){_0xa6cd24(null,_0x20f755);}})[_0x5b9c('0x1e')](function(_0x282bab){if(_0xa6cd24){_0xa6cd24(null,_0x282bab);}});}function setChannelVariables(_0x80ef87){for(var _0x300f2c in _0x80ef87){if(_0x80ef87[_0x5b9c('0x1f')](_0x300f2c)){if(_0x300f2c[_0x5b9c('0x20')](_0x5b9c('0x21'))===0x0){_0x80ef87[_0x300f2c['substring'](0x4)]=_0x80ef87[_0x300f2c];delete _0x80ef87[_0x300f2c];}}}}function agiHandler(_0x20bde8){logger[_0x5b9c('0x22')](_0x5b9c('0x23'),JSON[_0x5b9c('0x24')](_0x20bde8,null,0x2));logger['info'](util['format'](_0x5b9c('0x25'),_0x20bde8[_0x5b9c('0x1a')],_0x20bde8['calleridname'],_0x20bde8[_0x5b9c('0x17')],_0x20bde8['dnid'],_0x20bde8[_0x5b9c('0x19')]));_0x20bde8['on']('error',errorHandler);_0x20bde8['on'](_0x5b9c('0x26'),closeHandler);_0x20bde8['on'](_0x5b9c('0x27'),timeoutHandler);_0x20bde8[_0x5b9c('0x1c')]=![];_0x20bde8['on'](_0x5b9c('0x28'),hangupHandler);var _0x39877f=_[_0x5b9c('0x29')](projects,[_0x5b9c('0x12'),_0x20bde8[_0x5b9c('0x1a')]]);if(!_0x39877f)return Project[_0x5b9c('0x2a')](_0x20bde8);if(!_0x39877f['production'])return Project[_0x5b9c('0x2b')](_0x20bde8);return Project[_0x5b9c('0x2c')](_0x39877f,_0x20bde8);}function main(){var _0x136784;return utilLicense[_0x5b9c('0x2d')]()[_0x5b9c('0x1d')](function(_0xd4a1b6){if(!_0xd4a1b6)return;if(_0xd4a1b6['voice']){if(_0xd4a1b6[_0x5b9c('0x2e')]&&_0xd4a1b6['callysquare']>0x0){logger[_0x5b9c('0xd')](util['format'](_0x5b9c('0x2f'),_0xd4a1b6[_0x5b9c('0x2e')]));_0x136784=_0xd4a1b6[_0x5b9c('0x2e')];}else{logger[_0x5b9c('0xd')](_0x5b9c('0x30'));}}else{logger[_0x5b9c('0xd')](_0x5b9c('0x31'));_0x136784=-0x1;}})['then'](function(){return Project[_0x5b9c('0x32')]();})[_0x5b9c('0x1d')](function(_0x197e8f){projects=_0x197e8f;return;})['catch'](function(_0x45e7c1){logger[_0x5b9c('0x8')](_0x5b9c('0x33'),_0x45e7c1[_0x5b9c('0x9')]);})[_0x5b9c('0x34')](function(){var _0x306d14=require(_0x5b9c('0x35'))(config[_0x5b9c('0x1')][_0x5b9c('0x10')],config[_0x5b9c('0x1')]['ip'],_0x136784);_0x306d14['on'](_0x5b9c('0x8'),errorHandler);_0x306d14['on'](_0x5b9c('0x36'),listeningHandler);_0x306d14['on'](_0x5b9c('0x37'),connectionHandler);_0x306d14['on'](_0x5b9c('0x26'),closeHandler);});}main(); \ No newline at end of file +var _0xbcef=['projectUpdate','nextTick','error','findIndex','deleted','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','close','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','defaults','127.0.0.1'];(function(_0x393941,_0x209a88){var _0x2ee539=function(_0xe7726a){while(--_0xe7726a){_0x393941['push'](_0x393941['shift']());}};_0x2ee539(++_0x209a88);}(_0xbcef,0xd6));var _0xfbce=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbcef[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var syncho=require(_0xfbce('0x0'));var util=require(_0xfbce('0x1'));var config=require(_0xfbce('0x2'));var logger=require(_0xfbce('0x3'))(_0xfbce('0x4'));var utilLicense=require(_0xfbce('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xfbce('0x6'))[_0xfbce('0x7')];var projects=[];config[_0xfbce('0x4')]=_[_0xfbce('0x8')](config[_0xfbce('0x4')],{'ip':_0xfbce('0x9'),'port':0x11dd});AGIEmitter['on'](_0xfbce('0xa'),projectUpdateHandler);function connectionHandler(_0x553706){process[_0xfbce('0xb')](function(){syncho(function(){try{setChannelVariables(_0x553706);agiHandler(_0x553706);}catch(_0x515071){logger[_0xfbce('0xc')](_0x515071['stack']);}});});}function projectUpdateHandler(_0x4d751a){try{var _0x96691=_[_0xfbce('0xd')](projects,['id',_0x4d751a['id']]);if(_0x96691>-0x1){if(_0x4d751a[_0xfbce('0xe')]===!![]){projects['splice'](_0x96691,0x1);}else{projects[_0x96691]=_0x4d751a;}}else{projects['push'](_0x4d751a);}}catch(_0x3b9c62){logger[_0xfbce('0xc')](_0x3b9c62[_0xfbce('0xf')]);}}function listeningHandler(){console[_0xfbce('0x10')](_0xfbce('0x11'),config['agi'][_0xfbce('0x12')]);logger['info'](util['format'](_0xfbce('0x13'),config[_0xfbce('0x4')]['ip'],config[_0xfbce('0x4')][_0xfbce('0x12')]));}function errorHandler(_0x2b36d3){if(_0x2b36d3&&_0x2b36d3[_0xfbce('0x14')]&&_0x2b36d3['message']){logger['error'](util[_0xfbce('0x15')]('[%s]\x20%s',_0x2b36d3[_0xfbce('0x14')],_0x2b36d3['message']));}else{logger[_0xfbce('0xc')](util[_0xfbce('0x15')](_0xfbce('0x16'),_0x2b36d3[_0xfbce('0xf')]));}}function closeHandler(){logger[_0xfbce('0x17')](util[_0xfbce('0x15')](_0xfbce('0x18'),this[_0xfbce('0x19')],this[_0xfbce('0x1a')],this[_0xfbce('0x1b')],this[_0xfbce('0x1c')],this[_0xfbce('0x1d')]));try{createSquareReport(this);}catch(_0x4ad408){logger[_0xfbce('0xc')](_0x4ad408[_0xfbce('0xf')]);}}function timeoutHandler(){logger[_0xfbce('0x17')](util[_0xfbce('0x15')](_0xfbce('0x1e'),this['arg_1'],this[_0xfbce('0x1a')],this[_0xfbce('0x1b')],this[_0xfbce('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xfbce('0x17')](util[_0xfbce('0x15')](_0xfbce('0x1f'),this[_0xfbce('0x19')],this[_0xfbce('0x1a')],this[_0xfbce('0x1b')],this[_0xfbce('0x1c')],this['uniqueid']));this[_0xfbce('0x20')]=!![];}function createSquareReport(_0xa7d8a6,_0x258a02){rpc[_0xfbce('0x21')](_0xa7d8a6)[_0xfbce('0x22')](function(_0x4b4005){if(_0x258a02){_0x258a02(null,_0x4b4005);}})[_0xfbce('0x23')](function(_0x85a38c){if(_0x258a02){_0x258a02(null,_0x85a38c);}});}function setChannelVariables(_0x2bd273){for(var _0x26fabf in _0x2bd273){if(_0x2bd273[_0xfbce('0x24')](_0x26fabf)){if(_0x26fabf[_0xfbce('0x25')](_0xfbce('0x26'))===0x0){_0x2bd273[_0x26fabf[_0xfbce('0x27')](0x4)]=_0x2bd273[_0x26fabf];delete _0x2bd273[_0x26fabf];}}}}function agiHandler(_0x27be0f){logger[_0xfbce('0x28')]('variables',JSON['stringify'](_0x27be0f,null,0x2));logger[_0xfbce('0x17')](util[_0xfbce('0x15')](_0xfbce('0x29'),_0x27be0f[_0xfbce('0x19')],_0x27be0f[_0xfbce('0x1a')],_0x27be0f['callerid'],_0x27be0f['dnid'],_0x27be0f['uniqueid']));_0x27be0f['on'](_0xfbce('0xc'),errorHandler);_0x27be0f['on']('close',closeHandler);_0x27be0f['on']('timeout',timeoutHandler);_0x27be0f[_0xfbce('0x20')]=![];_0x27be0f['on']('hangup',hangupHandler);var _0xa8544d=_['find'](projects,[_0xfbce('0x14'),_0x27be0f[_0xfbce('0x19')]]);if(!_0xa8544d)return Project[_0xfbce('0x2a')](_0x27be0f);if(!_0xa8544d[_0xfbce('0x2b')])return Project[_0xfbce('0x2c')](_0x27be0f);return Project[_0xfbce('0x2d')](_0xa8544d,_0x27be0f);}function main(){var _0x3d0a25;return utilLicense[_0xfbce('0x2e')]()[_0xfbce('0x22')](function(_0x5d7716){if(!_0x5d7716)return;if(_0x5d7716[_0xfbce('0x2f')]){if(_0x5d7716[_0xfbce('0x30')]&&_0x5d7716['callysquare']>0x0){logger[_0xfbce('0x17')](util[_0xfbce('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5d7716[_0xfbce('0x30')]));_0x3d0a25=_0x5d7716[_0xfbce('0x30')];}else{logger[_0xfbce('0x17')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xfbce('0x31'));_0x3d0a25=-0x1;}})['then'](function(){return Project[_0xfbce('0x32')]();})[_0xfbce('0x22')](function(_0xee2fba){projects=_0xee2fba;return;})['catch'](function(_0x3d9923){logger[_0xfbce('0xc')]('[LICENSE]',_0x3d9923[_0xfbce('0xf')]);})[_0xfbce('0x33')](function(){var _0x211cd6=require(_0xfbce('0x34'))(config['agi'][_0xfbce('0x12')],config['agi']['ip'],_0x3d0a25);_0x211cd6['on'](_0xfbce('0xc'),errorHandler);_0x211cd6['on'](_0xfbce('0x35'),listeningHandler);_0x211cd6['on'](_0xfbce('0x36'),connectionHandler);_0x211cd6['on'](_0xfbce('0x37'),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 b40b425..cb6b6c8 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 _0xb4d3=['error','message','catch','sendMailMessage','SendMail','client','http','request'];(function(_0x3178f2,_0x33c953){var _0x279e00=function(_0x4865ae){while(--_0x4865ae){_0x3178f2['push'](_0x3178f2['shift']());}};_0x279e00(++_0x33c953);}(_0xb4d3,0x135));var _0x3b4d=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xb4d3[_0x40927b];return _0x2635e8;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x3b4d('0x0')][_0x3b4d('0x1')]({'port':0x232b});function request(_0x5606cc,_0x110dcf){return new BPromise(function(_0xdb93a1,_0xf82423){return client[_0x3b4d('0x2')](_0x5606cc,_0x110dcf)['then'](function(_0x5cf935){if(_0x5cf935['error']){return _0xf82423(_0x5cf935[_0x3b4d('0x3')][_0x3b4d('0x4')]);}else{return _0xdb93a1(_0x5cf935['result']);}})[_0x3b4d('0x5')](function(_0x1474f3){return _0xf82423(_0x1474f3);});});}exports[_0x3b4d('0x6')]=function(_0x140ccd,_0xf0f77b){return request(_0x3b4d('0x7'),{'account':_0x140ccd,'message':_0xf0f77b});}; \ No newline at end of file +var _0x9f28=['message','catch','sendMailMessage','SendMail','bluebird','client','http','request','then','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9f28,0x1da));var _0x89f2=function(_0x45fae4,_0x276049){_0x45fae4=_0x45fae4-0x0;var _0x563d38=_0x9f28[_0x45fae4];return _0x563d38;};'use strict';var BPromise=require(_0x89f2('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x89f2('0x1')][_0x89f2('0x2')]({'port':0x232b});function request(_0x31af99,_0x511576){return new BPromise(function(_0x411eed,_0x34e143){return client[_0x89f2('0x3')](_0x31af99,_0x511576)[_0x89f2('0x4')](function(_0x588a36){if(_0x588a36[_0x89f2('0x5')]){return _0x34e143(_0x588a36[_0x89f2('0x5')][_0x89f2('0x6')]);}else{return _0x411eed(_0x588a36['result']);}})[_0x89f2('0x7')](function(_0x223fa5){return _0x34e143(_0x223fa5);});});}exports[_0x89f2('0x8')]=function(_0x243edc,_0x480c4d){return request(_0x89f2('0x9'),{'account':_0x243edc,'message':_0x480c4d});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 03b1ece..60733c1 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 _0x0939=['context','extension','priority','response','code','result','evtHangup','isUndefined','finally','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','exports','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','mxCell','isArray','length','source','target','value','toJson','root','production','debug','stringify','joinAt','omit','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','info','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0939,0x129));var _0x9093=function(_0x19f723,_0x70e9f2){_0x19f723=_0x19f723-0x0;var _0x432824=_0x0939[_0x19f723];return _0x432824;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x9093('0x0'));var util=require(_0x9093('0x1'));var logger=require(_0x9093('0x2'))(_0x9093('0x3'));var rpc=require(_0x9093('0x4'));var mailRpc=require(_0x9093('0x5'));var Graph=require('./graph');var Vertices=require(_0x9093('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9093('0x7')]()[_0x9093('0x8')](function(_0x369b5f){logger[_0x9093('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x369b5f[_0x9093('0xa')]);return[];});}function addVertex(_0x3c66aa,_0x4e004a,_0x14dd7e){_0x4e004a[_0x9093('0xb')]=_0x14dd7e;if(_0x4e004a[_0x9093('0xc')](_0x9093('0xd'))){_0x4e004a[_0x9093('0xe')]=parseInt(_0x4e004a['retry'],0xa);}_0x3c66aa['addVertex'](_['omit'](_0x4e004a,_0x9093('0xf')));}function initGraph(_0x2ec12a,_0x18dc13){var _0x26e94f=new Graph();for(var _0x189863 in _0x2ec12a){if(_0x2ec12a['hasOwnProperty'](_0x189863)){if(_[_0x9093('0x10')](_0x2ec12a[_0x189863])){for(var _0x2a31d3=0x0;_0x2a31d3<_0x2ec12a[_0x189863]['length'];_0x2a31d3+=0x1){addVertex(_0x26e94f,_0x2ec12a[_0x189863][_0x2a31d3],_0x189863);}}else{addVertex(_0x26e94f,_0x2ec12a[_0x189863],_0x189863);}}}for(var _0x7ad88d=0x0;_0x7ad88d<_0x18dc13[_0x9093('0x11')];_0x7ad88d+=0x1){if(_0x18dc13[_0x7ad88d][_0x9093('0x12')]&&_0x18dc13[_0x7ad88d][_0x9093('0x13')]){_0x26e94f['addEdge'](_0x18dc13[_0x7ad88d][_0x9093('0x12')],_0x18dc13[_0x7ad88d][_0x9093('0x13')],_0x18dc13[_0x7ad88d][_0x9093('0x14')]);}}return _0x26e94f;}function getRoot(_0x34ed54){return parser[_0x9093('0x15')](_0x34ed54,{'object':!![]})['mxGraphModel'][_0x9093('0x16')];}function inspect(_0x4bfd18){return util['inspect'](_0x4bfd18,{'showHidden':![],'depth':null});}function initialize(_0x3bd0b9,_0x36fd54){var _0x12bd92=getRoot(_0x3bd0b9[_0x9093('0x17')]);if(!_0x12bd92||!_0x12bd92['start'])return;var _0x3214e1,_0x268a9a,_0x576d4e;logger[_0x9093('0x18')]('root',JSON[_0x9093('0x19')](_0x12bd92,null,0x2));_0x36fd54[_0x9093('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3214e1=initGraph(_[_0x9093('0x1b')](_0x12bd92,_0x9093('0xf')),_0x12bd92['mxCell']);_0x268a9a=new Vertices(_0x36fd54,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36fd54[_0x9093('0x1c')],_0x36fd54[_0x9093('0x1d')],_0x36fd54[_0x9093('0x1e')],_0x36fd54[_0x9093('0x1f')],_0x36fd54[_0x9093('0x20')]));_0x3214e1[_0x9093('0x21')](_0x12bd92[_0x9093('0x22')]['id'],function(_0x442bf4){try{_0x442bf4=_0x268a9a[_0x9093('0x23')](_0x442bf4);logger['debug'](_0x9093('0x24'),JSON[_0x9093('0x19')](_0x442bf4,null,0x2));if(_0x442bf4['agicommand']==='gotoc'){logger[_0x9093('0x25')](_0x9093('0x26'));_0x36fd54[_0x9093('0x27')]=_0x442bf4['context']||_0x36fd54[_0x9093('0x27')];_0x36fd54[_0x9093('0x28')]=_0x442bf4[_0x9093('0x28')];_0x36fd54[_0x9093('0x29')]=_0x442bf4[_0x9093('0x29')]?_0x442bf4['priority']-0x1:0x1;return null;}else if(_0x442bf4&&_0x268a9a[_0x442bf4[_0x9093('0xb')]]){_0x576d4e=_0x268a9a[_0x442bf4[_0x9093('0xb')]](_0x442bf4);logger[_0x9093('0x25')](_0x9093('0x2a'),JSON[_0x9093('0x19')](_0x576d4e,null,0x2));if(_0x576d4e&&_0x576d4e[_0x9093('0x2b')]===AGI_CODE_SUCCESS&&_0x576d4e[_0x9093('0x2c')]!==AGI_RESULT_ERROR&&!_0x36fd54[_0x9093('0x2d')]){logger[_0x9093('0x18')](_0x9093('0x2a'),inspect(_0x576d4e));return _[_0x9093('0x2e')](_0x576d4e[_0x9093('0x2c')])?null:_0x576d4e[_0x9093('0x2c')]['toString']();}else{logger[_0x9093('0x9')](_0x9093('0x2a'),inspect(_0x576d4e));return null;}}else{logger[_0x9093('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x12e1d6){logger['error'](_0x12e1d6[_0x9093('0xa')]);return null;}});if(_0x12bd92[_0x9093('0x2f')]){logger[_0x9093('0x25')](util[_0x9093('0x30')](_0x9093('0x31'),_0x36fd54[_0x9093('0x1c')],_0x36fd54[_0x9093('0x1d')],_0x36fd54['callerid'],_0x36fd54[_0x9093('0x1f')],_0x36fd54[_0x9093('0x20')]));_0x3214e1['traverseBFS'](_0x12bd92[_0x9093('0x2f')]['id'],function(_0x1271d8){try{_0x1271d8=_0x268a9a[_0x9093('0x23')](_0x1271d8);logger['debug'](_0x9093('0x24'),JSON[_0x9093('0x19')](_0x1271d8,null,0x2));if(_0x1271d8&&_0x268a9a[_0x1271d8[_0x9093('0xb')]]){_0x576d4e=_0x268a9a[_0x1271d8['agicommand']](_0x1271d8);if(_0x576d4e){logger['debug'](_0x9093('0x2a'),inspect(_0x576d4e));return _[_0x9093('0x2e')](_0x576d4e[_0x9093('0x2c')])?null:_0x576d4e['result']['toString']();}else{logger[_0x9093('0x9')](_0x9093('0x2a'),inspect(_0x576d4e));return null;}}else{logger[_0x9093('0x9')](_0x9093('0x32'));return null;}}catch(_0x3a6d34){logger['error'](_0x3a6d34[_0x9093('0xa')]);return null;}});}logger['info'](util[_0x9093('0x30')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36fd54[_0x9093('0x1c')],_0x36fd54['calleridname'],_0x36fd54[_0x9093('0x1e')],_0x36fd54['dnid'],_0x36fd54[_0x9093('0x20')]));logger['info'](util[_0x9093('0x30')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x36fd54[_0x9093('0x27')],_0x36fd54[_0x9093('0x28')],parseInt(_0x36fd54[_0x9093('0x29')],0xa)+0x1));_0x36fd54['continueAt'](_0x36fd54[_0x9093('0x27')],_0x36fd54[_0x9093('0x28')],parseInt(_0x36fd54[_0x9093('0x29')],0xa)+0x1);_0x36fd54['close']();}function handleNotFound(_0x2afe8b){logger[_0x9093('0x9')](util[_0x9093('0x30')](_0x9093('0x33'),_0x2afe8b['arg_1']));_0x2afe8b[_0x9093('0x34')](_0x2afe8b[_0x9093('0x27')],_0x2afe8b['extension'],parseInt(_0x2afe8b[_0x9093('0x29')],0xa)+0x1);_0x2afe8b[_0x9093('0x35')]();}function handleUnpublished(_0xddcf43){logger[_0x9093('0x9')](util[_0x9093('0x30')](_0x9093('0x36'),_0xddcf43[_0x9093('0x1c')]));_0xddcf43[_0x9093('0x34')](_0xddcf43['context'],_0xddcf43['extension'],parseInt(_0xddcf43[_0x9093('0x29')],0xa)+0x1);_0xddcf43['close']();}module[_0x9093('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x98d4=['agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','finally','calleridname','isUndefined','toString','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger'];(function(_0x3045dd,_0x3de00d){var _0x39f13c=function(_0xe7a4fa){while(--_0xe7a4fa){_0x3045dd['push'](_0x3045dd['shift']());}};_0x39f13c(++_0x3de00d);}(_0x98d4,0x169));var _0x498d=function(_0x32f9c2,_0x195191){_0x32f9c2=_0x32f9c2-0x0;var _0x5c2949=_0x98d4[_0x32f9c2];return _0x5c2949;};'use strict';var _=require(_0x498d('0x0'));var moment=require(_0x498d('0x1'));var parser=require(_0x498d('0x2'));var util=require(_0x498d('0x3'));var logger=require(_0x498d('0x4'))(_0x498d('0x5'));var rpc=require(_0x498d('0x6'));var mailRpc=require(_0x498d('0x7'));var Graph=require(_0x498d('0x8'));var Vertices=require(_0x498d('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x498d('0xa')](function(_0x253f42){logger[_0x498d('0xb')](_0x498d('0xc'),_0x253f42[_0x498d('0xd')]);return[];});}function addVertex(_0x25f49b,_0x548c4b,_0x26f0db){_0x548c4b[_0x498d('0xe')]=_0x26f0db;if(_0x548c4b[_0x498d('0xf')](_0x498d('0x10'))){_0x548c4b['maxRetry']=parseInt(_0x548c4b[_0x498d('0x10')],0xa);}_0x25f49b[_0x498d('0x11')](_[_0x498d('0x12')](_0x548c4b,_0x498d('0x13')));}function initGraph(_0x524007,_0x377ce0){var _0x5f46dd=new Graph();for(var _0x42498d in _0x524007){if(_0x524007[_0x498d('0xf')](_0x42498d)){if(_['isArray'](_0x524007[_0x42498d])){for(var _0x129ee8=0x0;_0x129ee8<_0x524007[_0x42498d][_0x498d('0x14')];_0x129ee8+=0x1){addVertex(_0x5f46dd,_0x524007[_0x42498d][_0x129ee8],_0x42498d);}}else{addVertex(_0x5f46dd,_0x524007[_0x42498d],_0x42498d);}}}for(var _0x4ac9c1=0x0;_0x4ac9c1<_0x377ce0[_0x498d('0x14')];_0x4ac9c1+=0x1){if(_0x377ce0[_0x4ac9c1]['source']&&_0x377ce0[_0x4ac9c1][_0x498d('0x15')]){_0x5f46dd[_0x498d('0x16')](_0x377ce0[_0x4ac9c1]['source'],_0x377ce0[_0x4ac9c1][_0x498d('0x15')],_0x377ce0[_0x4ac9c1][_0x498d('0x17')]);}}return _0x5f46dd;}function getRoot(_0x1530b2){return parser[_0x498d('0x18')](_0x1530b2,{'object':!![]})[_0x498d('0x19')][_0x498d('0x1a')];}function inspect(_0xd04c63){return util[_0x498d('0x1b')](_0xd04c63,{'showHidden':![],'depth':null});}function initialize(_0x908de4,_0x45c416){var _0x57643e=getRoot(_0x908de4[_0x498d('0x1c')]);if(!_0x57643e||!_0x57643e[_0x498d('0x1d')])return;var _0x214fb9,_0xdedd34,_0x133689;logger[_0x498d('0x1e')](_0x498d('0x1a'),JSON[_0x498d('0x1f')](_0x57643e,null,0x2));_0x45c416['joinAt']=moment()[_0x498d('0x20')]('YYYY-MM-DD\x20HH:mm:ss');_0x214fb9=initGraph(_['omit'](_0x57643e,'mxCell'),_0x57643e['mxCell']);_0xdedd34=new Vertices(_0x45c416,rpc,mailRpc);logger['info'](util[_0x498d('0x20')](_0x498d('0x21'),_0x45c416[_0x498d('0x22')],_0x45c416['calleridname'],_0x45c416[_0x498d('0x23')],_0x45c416[_0x498d('0x24')],_0x45c416[_0x498d('0x25')]));_0x214fb9[_0x498d('0x26')](_0x57643e[_0x498d('0x1d')]['id'],function(_0x26cea9){try{_0x26cea9=_0xdedd34[_0x498d('0x27')](_0x26cea9);logger[_0x498d('0x1e')](_0x498d('0x28'),JSON[_0x498d('0x1f')](_0x26cea9,null,0x2));if(_0x26cea9['agicommand']===_0x498d('0x29')){logger[_0x498d('0x2a')](_0x498d('0x2b'));_0x45c416[_0x498d('0x2c')]=_0x26cea9['context']||_0x45c416[_0x498d('0x2c')];_0x45c416[_0x498d('0x2d')]=_0x26cea9[_0x498d('0x2d')];_0x45c416['priority']=_0x26cea9['priority']?_0x26cea9[_0x498d('0x2e')]-0x1:0x1;return null;}else if(_0x26cea9&&_0xdedd34[_0x26cea9[_0x498d('0xe')]]){_0x133689=_0xdedd34[_0x26cea9[_0x498d('0xe')]](_0x26cea9);logger[_0x498d('0x2a')](_0x498d('0x2f'),JSON[_0x498d('0x1f')](_0x133689,null,0x2));if(_0x133689&&_0x133689[_0x498d('0x30')]===AGI_CODE_SUCCESS&&_0x133689['result']!==AGI_RESULT_ERROR&&!_0x45c416['evtHangup']){logger[_0x498d('0x1e')](_0x498d('0x2f'),inspect(_0x133689));return _['isUndefined'](_0x133689[_0x498d('0x31')])?null:_0x133689[_0x498d('0x31')]['toString']();}else{logger['error']('response',inspect(_0x133689));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x37b2c7){logger[_0x498d('0xb')](_0x37b2c7[_0x498d('0xd')]);return null;}});if(_0x57643e[_0x498d('0x32')]){logger[_0x498d('0x2a')](util[_0x498d('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45c416[_0x498d('0x22')],_0x45c416[_0x498d('0x33')],_0x45c416[_0x498d('0x23')],_0x45c416[_0x498d('0x24')],_0x45c416[_0x498d('0x25')]));_0x214fb9[_0x498d('0x26')](_0x57643e[_0x498d('0x32')]['id'],function(_0xa5176d){try{_0xa5176d=_0xdedd34['clear'](_0xa5176d);logger[_0x498d('0x1e')]('vertex',JSON[_0x498d('0x1f')](_0xa5176d,null,0x2));if(_0xa5176d&&_0xdedd34[_0xa5176d[_0x498d('0xe')]]){_0x133689=_0xdedd34[_0xa5176d['agicommand']](_0xa5176d);if(_0x133689){logger[_0x498d('0x1e')](_0x498d('0x2f'),inspect(_0x133689));return _[_0x498d('0x34')](_0x133689['result'])?null:_0x133689[_0x498d('0x31')][_0x498d('0x35')]();}else{logger['error'](_0x498d('0x2f'),inspect(_0x133689));return null;}}else{logger[_0x498d('0xb')](_0x498d('0x36'));return null;}}catch(_0x4d76a3){logger[_0x498d('0xb')](_0x4d76a3[_0x498d('0xd')]);return null;}});}logger[_0x498d('0x2a')](util[_0x498d('0x20')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45c416[_0x498d('0x22')],_0x45c416[_0x498d('0x33')],_0x45c416[_0x498d('0x23')],_0x45c416[_0x498d('0x24')],_0x45c416[_0x498d('0x25')]));logger[_0x498d('0x2a')](util[_0x498d('0x20')](_0x498d('0x37'),_0x45c416['context'],_0x45c416['extension'],parseInt(_0x45c416[_0x498d('0x2e')],0xa)+0x1));_0x45c416[_0x498d('0x38')](_0x45c416[_0x498d('0x2c')],_0x45c416['extension'],parseInt(_0x45c416['priority'],0xa)+0x1);_0x45c416[_0x498d('0x39')]();}function handleNotFound(_0x56c81e){logger[_0x498d('0xb')](util[_0x498d('0x20')](_0x498d('0x3a'),_0x56c81e[_0x498d('0x22')]));_0x56c81e[_0x498d('0x38')](_0x56c81e['context'],_0x56c81e[_0x498d('0x2d')],parseInt(_0x56c81e['priority'],0xa)+0x1);_0x56c81e[_0x498d('0x39')]();}function handleUnpublished(_0x208437){logger['error'](util['format'](_0x498d('0x3b'),_0x208437[_0x498d('0x22')]));_0x208437['continueAt'](_0x208437['context'],_0x208437[_0x498d('0x2d')],parseInt(_0x208437['priority'],0xa)+0x1);_0x208437[_0x498d('0x39')]();}module[_0x498d('0x3c')]={'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 2c857dc..ce6d6b6 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 _0xd64b=['split','slice','trim','emit','headers','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf','substring','length'];(function(_0x17c008,_0x2c5d49){var _0x4891ad=function(_0x5c9425){while(--_0x5c9425){_0x17c008['push'](_0x17c008['shift']());}};_0x4891ad(++_0x2c5d49);}(_0xd64b,0xc1));var _0xbd64=function(_0x7404bb,_0x3249a1){_0x7404bb=_0x7404bb-0x0;var _0x2d9af1=_0xd64b[_0x7404bb];return _0x2d9af1;};'use strict';var util=require(_0xbd64('0x0'));var Transform=require('stream')[_0xbd64('0x1')];function AGIReply(_0x4bfb7c){Transform[_0xbd64('0x2')](this,_0x4bfb7c);this[_0xbd64('0x3')]='';this[_0xbd64('0x4')]=![];}util[_0xbd64('0x5')](AGIReply,Transform);AGIReply[_0xbd64('0x6')]['_transform']=function(_0x5446e4,_0x54f916,_0x51e87d){var _0x58e9e7='\x0a',_0x32995f=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3e700e=-0x1,_0x38204e=-0x1,_0x3f1f17='',_0x2b8543=0x0,_0x197a84='',_0x5d32b8='';this[_0xbd64('0x3')]+=_0x5446e4[_0xbd64('0x7')]();_0x197a84=this[_0xbd64('0x3')];if(!this['_inBody']){_0x2b8543=0x0;while(_0x32995f[_0x2b8543]){while((_0x38204e=_0x197a84[_0xbd64('0x8')](_0x32995f[_0x2b8543]))!=-0x1){_0x3f1f17=_0x32995f[_0x2b8543];_0x5d32b8=_0x197a84[_0xbd64('0x9')](0x0,_0x38204e);_0x197a84=_0x197a84[_0xbd64('0x9')](_0x38204e+_0x3f1f17[_0xbd64('0xa')]);var _0x593c79=_0x5d32b8[_0xbd64('0xb')](_0x58e9e7),_0x431b29=0x0,_0x5f2adf={},_0x136f60='',_0x2729d8='',_0x3a941c=-0x1;while(_0x593c79[_0x431b29]){_0x3a941c=_0x593c79[_0x431b29][_0xbd64('0x8')](':');if(_0x3a941c!=-0x1){_0x136f60=_0x593c79[_0x431b29][_0xbd64('0xc')](0x0,_0x3a941c)[_0xbd64('0xd')]();_0x2729d8=_0x593c79[_0x431b29][_0xbd64('0xc')](_0x3a941c+0x1)[_0xbd64('0xd')]();if(_0x136f60['length']>0x0){_0x5f2adf[_0x136f60]=_0x2729d8;}}else{}_0x431b29++;}this[_0xbd64('0xe')](_0xbd64('0xf'),_0x5f2adf);this[_0xbd64('0x4')]=!![];}_0x2b8543++;}this[_0xbd64('0x3')]=_0x197a84;}else{while((_0x3e700e=_0x197a84[_0xbd64('0x8')](_0x58e9e7))!=-0x1){_0x5d32b8=_0x197a84['substring'](0x0,_0x3e700e);this[_0xbd64('0xe')]('line',_0x5d32b8);_0x197a84=_0x197a84[_0xbd64('0x9')](_0x3e700e+_0x58e9e7[_0xbd64('0xa')]);}this[_0xbd64('0x3')]=_0x197a84;}_0x51e87d();};module[_0xbd64('0x10')]=AGIReply; \ No newline at end of file +var _0x8ff4=['emit','headers','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf','substring','length','split','trim'];(function(_0x1fd1f3,_0x411cee){var _0x2924de=function(_0x3bc07a){while(--_0x3bc07a){_0x1fd1f3['push'](_0x1fd1f3['shift']());}};_0x2924de(++_0x411cee);}(_0x8ff4,0x1b3));var _0x48ff=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0x8ff4[_0x12b830];return _0x261dc4;};'use strict';var util=require(_0x48ff('0x0'));var Transform=require(_0x48ff('0x1'))['Transform'];function AGIReply(_0x19bf6c){Transform[_0x48ff('0x2')](this,_0x19bf6c);this[_0x48ff('0x3')]='';this[_0x48ff('0x4')]=![];}util[_0x48ff('0x5')](AGIReply,Transform);AGIReply[_0x48ff('0x6')]['_transform']=function(_0x310ebc,_0x400c69,_0x3cf03a){var _0x1864dd='\x0a',_0x168580=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4001ff=-0x1,_0x4ea073=-0x1,_0x1b50b8='',_0x1bd2d8=0x0,_0x438f47='',_0x58a0c5='';this['_localBuffer']+=_0x310ebc[_0x48ff('0x7')]();_0x438f47=this[_0x48ff('0x3')];if(!this[_0x48ff('0x4')]){_0x1bd2d8=0x0;while(_0x168580[_0x1bd2d8]){while((_0x4ea073=_0x438f47[_0x48ff('0x8')](_0x168580[_0x1bd2d8]))!=-0x1){_0x1b50b8=_0x168580[_0x1bd2d8];_0x58a0c5=_0x438f47[_0x48ff('0x9')](0x0,_0x4ea073);_0x438f47=_0x438f47['substring'](_0x4ea073+_0x1b50b8[_0x48ff('0xa')]);var _0x4673a7=_0x58a0c5[_0x48ff('0xb')](_0x1864dd),_0x2c4792=0x0,_0x2b97bc={},_0x505e68='',_0x194268='',_0x1e707e=-0x1;while(_0x4673a7[_0x2c4792]){_0x1e707e=_0x4673a7[_0x2c4792][_0x48ff('0x8')](':');if(_0x1e707e!=-0x1){_0x505e68=_0x4673a7[_0x2c4792]['slice'](0x0,_0x1e707e)['trim']();_0x194268=_0x4673a7[_0x2c4792]['slice'](_0x1e707e+0x1)[_0x48ff('0xc')]();if(_0x505e68[_0x48ff('0xa')]>0x0){_0x2b97bc[_0x505e68]=_0x194268;}}else{}_0x2c4792++;}this[_0x48ff('0xd')](_0x48ff('0xe'),_0x2b97bc);this[_0x48ff('0x4')]=!![];}_0x1bd2d8++;}this['_localBuffer']=_0x438f47;}else{while((_0x4001ff=_0x438f47['indexOf'](_0x1864dd))!=-0x1){_0x58a0c5=_0x438f47['substring'](0x0,_0x4001ff);this[_0x48ff('0xd')]('line',_0x58a0c5);_0x438f47=_0x438f47[_0x48ff('0x9')](_0x4001ff+_0x1864dd[_0x48ff('0xa')]);}this['_localBuffer']=_0x438f47;}_0x3cf03a();};module[_0x48ff('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6471e3a..799c7b8 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 _0xed95=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0xed95,0xb9));var _0x5ed9=function(_0x51cfaf,_0x2d08d1){_0x51cfaf=_0x51cfaf-0x0;var _0x2773f0=_0xed95[_0x51cfaf];return _0x2773f0;};'use strict';var _=require(_0x5ed9('0x0'));var moment=require(_0x5ed9('0x1'));var jayson=require(_0x5ed9('0x2'));var client=jayson[_0x5ed9('0x3')][_0x5ed9('0x4')]({'port':0x2329});function request(_0x7b6960,_0x453f85){return new Promise(function(_0x3e2272,_0x2a28e9){return client[_0x5ed9('0x5')](_0x7b6960,_0x453f85)[_0x5ed9('0x6')](function(_0x15b734){if(_0x15b734['error']){return _0x2a28e9(_0x15b734['error'][_0x5ed9('0x7')]);}else{return _0x3e2272(_0x15b734[_0x5ed9('0x8')]);}})[_0x5ed9('0x9')](function(_0x34688d){return _0x2a28e9(_0x34688d);});});}exports[_0x5ed9('0xa')]=function(){return request(_0x5ed9('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x5ed9('0xc')]=function(_0xbe4c01){return request(_0x5ed9('0xd'),{'options':{'raw':![],'where':{'name':_0xbe4c01},'attributes':[_0x5ed9('0xe')]}});};exports['getMailAccountById']=function(_0x575782){return request(_0x5ed9('0xf'),{'options':{'raw':![],'where':{'id':_0x575782},'include':[{'model':_0x5ed9('0x10'),'as':_0x5ed9('0x11'),'include':[{'model':_0x5ed9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x5ed9('0x13'),_0x5ed9('0x14')],'smtp':!![]}});};exports[_0x5ed9('0x15')]=function(_0x5e463c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e463c},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x16')]=function(_0x5e952c){return request(_0x5ed9('0x17'),{'options':{'where':{'id':_0x5e952c},'attributes':[_0x5ed9('0x13')]}});};exports['getVariableById']=function(_0x57692b){return request(_0x5ed9('0x18'),{'options':{'where':{'id':_0x57692b},'attributes':[_0x5ed9('0x13')]}});};exports['getSquareOdbcById']=function(_0x3de09e){return request(_0x5ed9('0x19'),{'options':{'where':{'id':_0x3de09e},'attributes':['dsn']}});};exports[_0x5ed9('0x1a')]=function(_0xc6e591){return request('ShowUser',{'options':{'where':{'id':_0xc6e591},'attributes':['name']}});};exports['getContactByPhone']=function(_0x510ffe){return request(_0x5ed9('0x1b'),{'options':{'where':{'phone':_0x510ffe[_0x5ed9('0x1c')]},'attributes':['id']}});};exports[_0x5ed9('0x1d')]=function(_0x44b8ca){return request('ShowTrunk',{'options':{'where':{'id':_0x44b8ca},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x1e')]=function(_0x5cb2c1){return request('ShowSound',{'options':{'where':{'id':_0x5cb2c1},'attributes':['save_name']}});};exports[_0x5ed9('0x1f')]=function(_0x26a3c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26a3c8},'include':[{'model':_0x5ed9('0x20'),'as':_0x5ed9('0x21')}]}});};exports[_0x5ed9('0x22')]=function(_0x71e104){return request('ShowSmsAccount',{'options':{'where':{'id':_0x71e104},'attributes':['id',_0x5ed9('0x13')]}});};exports[_0x5ed9('0x23')]=function(_0x38b462){return request(_0x5ed9('0x24'),{'body':_0x38b462});};exports[_0x5ed9('0x25')]=function(_0x14ae7b){return request('CreateSquareDetailsReport',{'body':_0x14ae7b});};exports['createSquareReport']=function(_0x36d7d5){return request(_0x5ed9('0x26'),{'body':_[_0x5ed9('0x27')](_0x36d7d5,{'project_name':_0x36d7d5['arg_1'],'prev_project_name':_0x36d7d5['arg_2']||'','is_subproject':_0x36d7d5[_0x5ed9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ed9('0x29')](_0x5ed9('0x2a'))})});};exports['createSquareRecording']=function(_0x1bc137){return request(_0x5ed9('0x2b'),{'body':_0x1bc137});};exports[_0x5ed9('0x2c')]=function(_0x5a805b){return request(_0x5ed9('0x2d'),{'body':_0x5a805b});};exports[_0x5ed9('0x2e')]=function(_0x411729){return request(_0x5ed9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x411729['phone'],'ListId':_0x411729['ListId']}}})[_0x5ed9('0x6')](function(_0x5d6599){if(_0x5d6599){return _0x5d6599;}return request(_0x5ed9('0x30'),{'body':_0x411729});});};exports[_0x5ed9('0x31')]=function(_0x1585e3){return request(_0x5ed9('0x32'),{'options':{'where':{'id':_0x1585e3},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x33')]=function(_0xba5b97,_0x4a47f5){return request('LoginUser',{'body':{'interface':_0x4a47f5},'options':{'where':_0xba5b97}});};exports['agentPause']=function(_0x39771f,_0x36d050,_0x2cb3d2){return request('PauseUser',{'body':{'type':_0x36d050,'uniqueid':_0x2cb3d2},'options':{'where':_0x39771f}});};exports[_0x5ed9('0x34')]=function(_0x53575b){return request(_0x5ed9('0x35'),{'body':{},'options':{'where':_0x53575b}});};exports[_0x5ed9('0x36')]=function(_0x3061cd){return request(_0x5ed9('0x37'),{'body':{},'options':{'where':_0x3061cd}});}; \ No newline at end of file +var _0x093a=['getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser'];(function(_0x32c2d7,_0x507665){var _0x1d838b=function(_0x54cb0a){while(--_0x54cb0a){_0x32c2d7['push'](_0x32c2d7['shift']());}};_0x1d838b(++_0x507665);}(_0x093a,0x16a));var _0xa093=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x093a[_0x193e28];return _0x20ef59;};'use strict';var _=require('lodash');var moment=require(_0xa093('0x0'));var jayson=require(_0xa093('0x1'));var client=jayson[_0xa093('0x2')]['http']({'port':0x2329});function request(_0x48385e,_0x232f44){return new Promise(function(_0xfdf0ec,_0x28d105){return client[_0xa093('0x3')](_0x48385e,_0x232f44)[_0xa093('0x4')](function(_0x370121){if(_0x370121[_0xa093('0x5')]){return _0x28d105(_0x370121[_0xa093('0x5')][_0xa093('0x6')]);}else{return _0xfdf0ec(_0x370121[_0xa093('0x7')]);}})[_0xa093('0x8')](function(_0x25bad2){return _0x28d105(_0x25bad2);});});}exports[_0xa093('0x9')]=function(){return request(_0xa093('0xa'),{'options':{'raw':![],'attributes':['id',_0xa093('0xb'),_0xa093('0xc')]}});};exports[_0xa093('0xd')]=function(_0x28892a){return request(_0xa093('0xe'),{'options':{'raw':![],'where':{'name':_0x28892a},'attributes':[_0xa093('0xc')]}});};exports[_0xa093('0xf')]=function(_0x488dc9){return request(_0xa093('0x10'),{'options':{'raw':![],'where':{'id':_0x488dc9},'include':[{'model':_0xa093('0x11'),'as':_0xa093('0x12'),'include':[{'model':'CloudProvider','as':_0xa093('0x13')}]}],'attributes':['id',_0xa093('0xb'),_0xa093('0x14')],'smtp':!![]}});};exports[_0xa093('0x15')]=function(_0x1171cb){return request(_0xa093('0xe'),{'options':{'where':{'id':_0x1171cb},'attributes':[_0xa093('0xb')]}});};exports['getVoiceQueueById']=function(_0x108037){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x108037},'attributes':[_0xa093('0xb')]}});};exports[_0xa093('0x16')]=function(_0x45005f){return request(_0xa093('0x17'),{'options':{'where':{'id':_0x45005f},'attributes':[_0xa093('0xb')]}});};exports[_0xa093('0x18')]=function(_0x1f1889){return request(_0xa093('0x19'),{'options':{'where':{'id':_0x1f1889},'attributes':['dsn']}});};exports[_0xa093('0x1a')]=function(_0x226d1e){return request(_0xa093('0x1b'),{'options':{'where':{'id':_0x226d1e},'attributes':[_0xa093('0xb')]}});};exports[_0xa093('0x1c')]=function(_0x3b63db){return request(_0xa093('0x1d'),{'options':{'where':{'phone':_0x3b63db['phone']},'attributes':['id']}});};exports[_0xa093('0x1e')]=function(_0x4bcb2a){return request(_0xa093('0x1f'),{'options':{'where':{'id':_0x4bcb2a},'attributes':['name']}});};exports[_0xa093('0x20')]=function(_0xc08c8){return request('ShowSound',{'options':{'where':{'id':_0xc08c8},'attributes':[_0xa093('0x21')]}});};exports[_0xa093('0x22')]=function(_0x93f81a){return request(_0xa093('0x23'),{'options':{'raw':![],'where':{'id':_0x93f81a},'include':[{'model':_0xa093('0x24'),'as':'Intervals'}]}});};exports[_0xa093('0x25')]=function(_0x57125e){return request(_0xa093('0x26'),{'options':{'where':{'id':_0x57125e},'attributes':['id','name']}});};exports[_0xa093('0x27')]=function(_0x329847){return request(_0xa093('0x28'),{'body':_0x329847});};exports[_0xa093('0x29')]=function(_0x38c9f3){return request(_0xa093('0x2a'),{'body':_0x38c9f3});};exports[_0xa093('0x2b')]=function(_0x591b98){return request(_0xa093('0x2c'),{'body':_['merge'](_0x591b98,{'project_name':_0x591b98[_0xa093('0x2d')],'prev_project_name':_0x591b98[_0xa093('0x2e')]||'','is_subproject':_0x591b98[_0xa093('0x2e')]?!![]:![],'leaveAt':moment()[_0xa093('0x2f')](_0xa093('0x30'))})});};exports[_0xa093('0x31')]=function(_0x3e4962){return request(_0xa093('0x32'),{'body':_0x3e4962});};exports[_0xa093('0x33')]=function(_0x23381f){return request('CreateSquareMessage',{'body':_0x23381f});};exports[_0xa093('0x34')]=function(_0x1b9148){return request(_0xa093('0x35'),{'options':{'raw':![],'where':{'phone':_0x1b9148[_0xa093('0x36')],'ListId':_0x1b9148[_0xa093('0x37')]}}})['then'](function(_0x507f20){if(_0x507f20){return _0x507f20;}return request(_0xa093('0x38'),{'body':_0x1b9148});});};exports[_0xa093('0x39')]=function(_0x3d7823){return request(_0xa093('0x3a'),{'options':{'where':{'id':_0x3d7823},'attributes':['name']}});};exports['agentLogin']=function(_0x57a5f7,_0x2a52ea){return request('LoginUser',{'body':{'interface':_0x2a52ea},'options':{'where':_0x57a5f7}});};exports[_0xa093('0x3b')]=function(_0xf202dc,_0x23cb42,_0x4a7245){return request(_0xa093('0x3c'),{'body':{'type':_0x23cb42,'uniqueid':_0x4a7245},'options':{'where':_0xf202dc}});};exports[_0xa093('0x3d')]=function(_0x1d0359){return request(_0xa093('0x3e'),{'body':{},'options':{'where':_0x1d0359}});};exports[_0xa093('0x3f')]=function(_0x25120c){return request(_0xa093('0x40'),{'body':{},'options':{'where':_0x25120c}});}; \ 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 33918c9..17eb98f 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 _0x287e=['./polly','./lex','exports'];(function(_0x335f4b,_0x1a308f){var _0xe915e3=function(_0x16f6bf){while(--_0x16f6bf){_0x335f4b['push'](_0x335f4b['shift']());}};_0xe915e3(++_0x1a308f);}(_0x287e,0x1e3));var _0xe287=function(_0xb49b18,_0x4994b8){_0xb49b18=_0xb49b18-0x0;var _0x2475f8=_0x287e[_0xb49b18];return _0x2475f8;};var polly=require(_0xe287('0x0'));var lex=require(_0xe287('0x1'));module[_0xe287('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x90b5=['exports','./polly'];(function(_0x1c2cb8,_0x49bf6c){var _0x213e76=function(_0x51129f){while(--_0x51129f){_0x1c2cb8['push'](_0x1c2cb8['shift']());}};_0x213e76(++_0x49bf6c);}(_0x90b5,0x139));var _0x590b=function(_0x5216a5,_0x2f13fe){_0x5216a5=_0x5216a5-0x0;var _0x30a142=_0x90b5[_0x5216a5];return _0x30a142;};var polly=require(_0x590b('0x0'));var lex=require('./lex');module[_0x590b('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index af26173..660bda2 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(_0x54958e,_0x439c16){var _0x1d1c00=function(_0x33a22c){while(--_0x33a22c){_0x54958e['push'](_0x54958e['shift']());}};_0x1d1c00(++_0x439c16);}(_0x2dae,0xc3));var _0xe2da=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x2dae[_0x519756];return _0x37047e;};'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 _0x702d=['exports','./lib/api'];(function(_0x3df95e,_0x2b0418){var _0x25de3a=function(_0x5ce8aa){while(--_0x5ce8aa){_0x3df95e['push'](_0x3df95e['shift']());}};_0x25de3a(++_0x2b0418);}(_0x702d,0x147));var _0xd702=function(_0x4c5b99,_0x31af39){_0x4c5b99=_0x4c5b99-0x0;var _0x37f947=_0x702d[_0x4c5b99];return _0x37f947;};'use strict';var lex=require(_0xd702('0x0'));module[_0xd702('0x1')]=function(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c){return lex(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c);}; \ 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 e950f8c..17f21a4 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(_0x3b8790,_0x119f54){var _0x70406e=function(_0x41825b){while(--_0x41825b){_0x3b8790['push'](_0x3b8790['shift']());}};_0x70406e(++_0x119f54);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x44f4a2,_0x195d74){var _0x4682ef=function(_0x4149f7){while(--_0x4149f7){_0x44f4a2['push'](_0x44f4a2['shift']());}};_0x4682ef(++_0x195d74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 964e414..0f9521c 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x11d8bc,_0x28f383,_0x309659,_0x2ca721,_0x3de9b2,_0x24e455,_0xbfaea1){return polly(_0x11d8bc,_0x28f383,_0x309659,_0x2ca721,_0x3de9b2,_0x24e455,_0xbfaea1);}; \ No newline at end of file +var _0x5715=['exports','./lib/api'];(function(_0x188677,_0x2ab2b8){var _0x2f5261=function(_0x56b87c){while(--_0x56b87c){_0x188677['push'](_0x188677['shift']());}};_0x2f5261(++_0x2ab2b8);}(_0x5715,0x6b));var _0x5571=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x5715[_0x1f99a0];return _0x1e0849;};'use strict';var polly=require(_0x5571('0x0'));module[_0x5571('0x1')]=function(_0x2acc95,_0x44d31d,_0x21614d,_0x39c16b,_0x4b2e49,_0x425a80,_0x3b77c7){return polly(_0x2acc95,_0x44d31d,_0x21614d,_0x39c16b,_0x4b2e49,_0x425a80,_0x3b77c7);}; \ 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 affe120..4be7572 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 _0xb6bd=['path','bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3'];(function(_0x4ce885,_0x4a64c6){var _0x189899=function(_0x12ebb2){while(--_0x12ebb2){_0x4ce885['push'](_0x4ce885['shift']());}};_0x189899(++_0x4a64c6);}(_0xb6bd,0xab));var _0xdb6b=function(_0x5a702e,_0x728c2b){_0x5a702e=_0x5a702e-0x0;var _0x6116ad=_0xb6bd[_0x5a702e];return _0x6116ad;};'use strict';var fs=require('fs');var path=require(_0xdb6b('0x0'));var BPromise=require(_0xdb6b('0x1'));var rs=require(_0xdb6b('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5901b3,_0x4f2fe6,_0xbe7f3e){return new BPromise(function(_0x2b9e51,_0x442f54){_0x5901b3[_0xdb6b('0x3')](_0x4f2fe6,function(_0x241102,_0x20e5ad){if(_0x241102){_0x442f54(_0x241102);}else if(_0x20e5ad){if(_0x20e5ad[_0xdb6b('0x4')]instanceof Buffer){fs['writeFile'](_0xbe7f3e,_0x20e5ad[_0xdb6b('0x4')],function(_0xe6230){if(_0xe6230){_0x442f54(_0xe6230);}else{_0x2b9e51();}});}else{_0x442f54(new Error(_0xdb6b('0x5')));}}else{_0x442f54(new Error(_0xdb6b('0x6')));}});});}module[_0xdb6b('0x7')]=function(_0xeeca60,_0x43b89b,_0x1ed3f7,_0x4d76f6,_0x2769b7,_0x567b66,_0x30bdff){var _0x4bc7dc=new AWS['Polly']({'accessKeyId':_0xeeca60,'secretAccessKey':_0x43b89b,'region':_0x1ed3f7});var _0x4118c6={'Text':_0x2769b7,'TextType':_0x567b66||'text','OutputFormat':_0xdb6b('0x8'),'VoiceId':_0x4d76f6};return pollyResult(_0x4bc7dc,_0x4118c6,_0x30bdff);}; \ No newline at end of file +var _0xc5f0=['randomstring','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird'];(function(_0x25c881,_0x4d3740){var _0x38ee1e=function(_0x51ec7b){while(--_0x51ec7b){_0x25c881['push'](_0x25c881['shift']());}};_0x38ee1e(++_0x4d3740);}(_0xc5f0,0x13e));var _0x0c5f=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xc5f0[_0x58db4e];return _0x40139a;};'use strict';var fs=require('fs');var path=require(_0x0c5f('0x0'));var BPromise=require(_0x0c5f('0x1'));var rs=require(_0x0c5f('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x167236,_0x121fb3,_0x531827){return new BPromise(function(_0x527adc,_0x560496){_0x167236['synthesizeSpeech'](_0x121fb3,function(_0x33b6c0,_0x298beb){if(_0x33b6c0){_0x560496(_0x33b6c0);}else if(_0x298beb){if(_0x298beb[_0x0c5f('0x3')]instanceof Buffer){fs['writeFile'](_0x531827,_0x298beb[_0x0c5f('0x3')],function(_0x333795){if(_0x333795){_0x560496(_0x333795);}else{_0x527adc();}});}else{_0x560496(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x560496(new Error(_0x0c5f('0x4')));}});});}module[_0x0c5f('0x5')]=function(_0x8eb324,_0x4862d9,_0x4fe34e,_0x304965,_0x4c098e,_0x40ceaf,_0x4475ce){var _0x875135=new AWS['Polly']({'accessKeyId':_0x8eb324,'secretAccessKey':_0x4862d9,'region':_0x4fe34e});var _0xf24282={'Text':_0x4c098e,'TextType':_0x40ceaf||_0x0c5f('0x6'),'OutputFormat':_0x0c5f('0x7'),'VoiceId':_0x304965};return pollyResult(_0x875135,_0xf24282,_0x4475ce);}; \ 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 4f7aeb8..29f6ef1 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 _0x35be=['./lib/api','exports'];(function(_0x3cd126,_0x13ca50){var _0x5cbe32=function(_0x1a8d4e){while(--_0x1a8d4e){_0x3cd126['push'](_0x3cd126['shift']());}};_0x5cbe32(++_0x13ca50);}(_0x35be,0x11a));var _0xe35b=function(_0x1e97a5,_0x37a2e9){_0x1e97a5=_0x1e97a5-0x0;var _0x42915d=_0x35be[_0x1e97a5];return _0x42915d;};'use strict';var asr=require(_0xe35b('0x0'));module[_0xe35b('0x1')]=function(_0x25bc66,_0x452c24,_0x576298,_0x1fb12c){return asr(_0x25bc66,_0x452c24,_0x576298);}; \ No newline at end of file +var _0x2c1d=['exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2c1d,0x136));var _0xd2c1=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x2c1d[_0x1deb03];return _0x189fe7;};'use strict';var asr=require('./lib/api');module[_0xd2c1('0x0')]=function(_0x4c4f2c,_0x4f86d9,_0x7b8113,_0x17422b){return asr(_0x4c4f2c,_0x4f86d9,_0x7b8113);}; \ 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 6020e8e..c91b265 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 _0xf53f=['https://speech.googleapis.com','exports','string','length','undefined','toString','POST','LINEAR16','8000','url','bluebird'];(function(_0x41c09c,_0x1a42ec){var _0x2a3183=function(_0x13d6af){while(--_0x13d6af){_0x41c09c['push'](_0x41c09c['shift']());}};_0x2a3183(++_0x1a42ec);}(_0xf53f,0x8d));var _0xff53=function(_0x2d48c0,_0x5c141f){_0x2d48c0=_0x2d48c0-0x0;var _0x5c9c0a=_0xf53f[_0x2d48c0];return _0x5c9c0a;};'use strict';var url=require(_0xff53('0x0'));var BPromise=require(_0xff53('0x1'));var fs=require('fs');var host=_0xff53('0x2');module[_0xff53('0x3')]=function(_0x3b48fc,_0x4afcd,_0x492e12){return new BPromise(function(_0x32529d,_0x18b504){var _0x2077b9;if(typeof _0x3b48fc!==_0xff53('0x4')||_0x3b48fc[_0xff53('0x5')]===0x0){return _0x18b504('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4afcd!=='string'||_0x4afcd[_0xff53('0x5')]===0x0){return _0x18b504('key\x20should\x20be\x20a\x20string');}if(typeof _0x492e12!==_0xff53('0x6')&&(typeof _0x492e12!==_0xff53('0x4')||_0x492e12[_0xff53('0x5')]===0x0)){return _0x18b504('lang\x20should\x20be\x20a\x20string');}try{_0x2077b9=fs['readFileSync'](_0x3b48fc)[_0xff53('0x7')]('base64');}catch(_0x130576){return _0x18b504(_0x130576);}return _0x32529d({'method':_0xff53('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x4afcd,'body':{'config':{'encoding':_0xff53('0x9'),'sampleRateHertz':_0xff53('0xa'),'languageCode':_0x492e12},'audio':{'content':_0x2077b9}},'json':!![]});});}; \ No newline at end of file +var _0x49e9=['readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var url=require(_0x949e('0x0'));var BPromise=require(_0x949e('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x949e('0x2')]=function(_0x1db1b8,_0x259795,_0x5c303a){return new BPromise(function(_0x4f1295,_0x114f65){var _0x4c284b;if(typeof _0x1db1b8!==_0x949e('0x3')||_0x1db1b8[_0x949e('0x4')]===0x0){return _0x114f65(_0x949e('0x5'));}if(typeof _0x259795!=='string'||_0x259795[_0x949e('0x4')]===0x0){return _0x114f65(_0x949e('0x6'));}if(typeof _0x5c303a!==_0x949e('0x7')&&(typeof _0x5c303a!==_0x949e('0x3')||_0x5c303a[_0x949e('0x4')]===0x0)){return _0x114f65(_0x949e('0x8'));}try{_0x4c284b=fs[_0x949e('0x9')](_0x1db1b8)['toString'](_0x949e('0xa'));}catch(_0x50ca96){return _0x114f65(_0x50ca96);}return _0x4f1295({'method':_0x949e('0xb'),'uri':host+_0x949e('0xc')+_0x259795,'body':{'config':{'encoding':_0x949e('0xd'),'sampleRateHertz':'8000','languageCode':_0x5c303a},'audio':{'content':_0x4c284b}},'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 333b08d..aec9bb0 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 _0x830e=['./asr'];(function(_0x45a024,_0x158ba6){var _0x4e77c9=function(_0x2a98f3){while(--_0x2a98f3){_0x45a024['push'](_0x45a024['shift']());}};_0x4e77c9(++_0x158ba6);}(_0x830e,0xa2));var _0xe830=function(_0x30a26e,_0xb0545b){_0x30a26e=_0x30a26e-0x0;var _0x438c0a=_0x830e[_0x30a26e];return _0x438c0a;};var asr=require(_0xe830('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x603f=['exports','./asr'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x603f,0xcd));var _0xf603=function(_0x4fe0af,_0x27b87c){_0x4fe0af=_0x4fe0af-0x0;var _0x50ad3e=_0x603f[_0x4fe0af];return _0x50ad3e;};var asr=require(_0xf603('0x0'));module[_0xf603('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0d1ab31..c24bbf7 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 _0xa7e2=['https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','agi'];(function(_0x5524a1,_0x37c171){var _0x4ea5e3=function(_0x493ee1){while(--_0x493ee1){_0x5524a1['push'](_0x5524a1['shift']());}};_0x4ea5e3(++_0x37c171);}(_0xa7e2,0x78));var _0x2a7e=function(_0x27c22c,_0x11c2cd){_0x27c22c=_0x27c22c-0x0;var _0x621ddd=_0xa7e2[_0x27c22c];return _0x621ddd;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x2a7e('0x0'));var https=require(_0x2a7e('0x1'));var md5=require(_0x2a7e('0x2'));var path=require(_0x2a7e('0x3'));var querystring=require(_0x2a7e('0x4'));var rp=require(_0x2a7e('0x5'));var rs=require(_0x2a7e('0x6'));var sox=require(_0x2a7e('0x7'));var tts=require(_0x2a7e('0x8'));var urlParse=require(_0x2a7e('0x9'))[_0x2a7e('0xa')];var util=require(_0x2a7e('0xb'));var aws=require(_0x2a7e('0xc'));var google=require('./google');var sestek=require(_0x2a7e('0xd'));var tilde=require(_0x2a7e('0xe'));var logger=require('../../../config/logger')(_0x2a7e('0xf'));var ISPEECH_API=_0x2a7e('0x10');function downloadFile(_0x5ef0d6,_0x22ce74){return new BPromise(function(_0x137f84,_0xb8d8a5){var _0x374ccb=urlParse(_0x5ef0d6);var _0x56ab19=_0x374ccb[_0x2a7e('0x11')]===_0x2a7e('0x12')?https:http;var _0x2df872={'host':_0x374ccb[_0x2a7e('0x13')],'path':_0x374ccb['path'],'headers':{'user-agent':_0x2a7e('0x14')}};_0x56ab19[_0x2a7e('0x15')](_0x2df872,function(_0x4b73f4){if(_0x4b73f4[_0x2a7e('0x16')]!==0xc8){logger[_0x2a7e('0x17')](_0x2a7e('0x18')+_0x5ef0d6+'\x20failed,\x20status\x20code\x20=\x20'+_0x4b73f4[_0x2a7e('0x16')]+'\x20('+_0x4b73f4[_0x2a7e('0x19')]+')');_0xb8d8a5(new Error(_0x2a7e('0x18')+_0x5ef0d6+_0x2a7e('0x1a')+_0x4b73f4[_0x2a7e('0x16')]+'\x20('+_0x4b73f4[_0x2a7e('0x19')]+')'));return;}var _0x5c168c=fs[_0x2a7e('0x1b')](_0x22ce74);_0x5c168c['on'](_0x2a7e('0x1c'),function(){logger[_0x2a7e('0x1d')]('finish\x20download\x20file');_0x5c168c[_0x2a7e('0x1e')](_0x137f84);});_0x5c168c['on'](_0x2a7e('0x17'),function(_0x38e61d){fs[_0x2a7e('0x1f')](_0x22ce74);logger['error'](_0x2a7e('0x20'),_0x38e61d);_0xb8d8a5(_0x38e61d);});_0x4b73f4[_0x2a7e('0x21')](_0x5c168c);})['on'](_0x2a7e('0x17'),function(_0x395a97){logger[_0x2a7e('0x17')](_0x395a97);_0xb8d8a5(_0x395a97);})[_0x2a7e('0x22')]();});}function uploadFile(_0x12a469){return new BPromise(function(_0x10a1c1,_0x1adc1a){var _0x2efa96=urlParse(_0x12a469);var _0x2b996b=_0x2efa96['protocol']===_0x2a7e('0x12')?https:http;var _0x5c8fde={'host':_0x2efa96['host'],'path':_0x2efa96['path'],'headers':{'user-agent':_0x2a7e('0x14')}};_0x2b996b['get'](_0x5c8fde,function(_0x1ec8a3){if(_0x1ec8a3[_0x2a7e('0x16')]!==0xc8){_0x1adc1a(new Error('request\x20to\x20'+_0x12a469+'\x20failed,\x20status\x20code\x20=\x20'+_0x1ec8a3[_0x2a7e('0x16')]+'\x20('+_0x1ec8a3['statusMessage']+')'));return;}var _0xa5d566='';_0x1ec8a3['on'](_0x2a7e('0x23'),function(_0x3f9ff2){_0xa5d566+=_0x3f9ff2;});_0x1ec8a3['on'](_0x2a7e('0x22'),function(){_0x10a1c1(_0xa5d566);});})['on']('error',function(_0x2ae9cf){_0x1adc1a(_0x2ae9cf);})['end']();});}function convertFile(_0xa38ee7,_0x3ae692){return new BPromise(function(_0x5390f6,_0x3e14db){var _0x1b00bb=sox[_0x2a7e('0x24')](_0xa38ee7,_0x3ae692,{'sampleRate':0x1f40,'format':_0x2a7e('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b00bb['on'](_0x2a7e('0x17'),function(_0x3c9571){logger['error'](_0x2a7e('0x26'),_0x3c9571);_0x3e14db(_0x3c9571);});_0x1b00bb['on'](_0x2a7e('0x22'),function(){logger['info'](_0x2a7e('0x27'));_0x5390f6();});_0x1b00bb[_0x2a7e('0x28')]();});}function base64Decode(_0x1ac3ab,_0x56a8ee){var _0x647f1d=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs['generate'](0x4)+'.wav');fs[_0x2a7e('0x2b')](_0x647f1d,_0x1ac3ab,_0x2a7e('0x2c'));return convertFile(_0x647f1d,_0x56a8ee)[_0x2a7e('0x2d')](function(){try{fs[_0x2a7e('0x1f')](_0x647f1d);fs[_0x2a7e('0x2e')](_0x56a8ee,'777');}catch(_0x157c12){logger[_0x2a7e('0x17')](_0x157c12);}return _0x56a8ee[_0x2a7e('0x2f')]('.')[0x0];});}function base64Encode(_0x5c283e){var _0x37537e=fs[_0x2a7e('0x30')](_0x5c283e);return new Buffer(_0x37537e)[_0x2a7e('0x31')](_0x2a7e('0x2c'));}exports[_0x2a7e('0x32')]=function(_0x2ae3e2,_0x18b519,_0x4132a5,_0x5077f6,_0x320490,_0x1412d3){var _0x23fb8f,_0x4e4c6e;var _0x2e4d21=_0x2a7e('0x33');var _0xb48702='?key='+_0x2ae3e2;var _0x3da5cb={};if(_0x18b519===_0x2a7e('0x34')){_0x3da5cb[_0x2a7e('0x35')]={'ssml':_0x4132a5};}else{_0x3da5cb[_0x2a7e('0x35')]={'text':_0x4132a5};};_0x3da5cb[_0x2a7e('0x36')]={'languageCode':_0x5077f6,'ssmlGender':_0x320490};_0x3da5cb['audioConfig']={'audioEncoding':_0x2a7e('0x37'),'sampleRateHertz':0x1f40};var _0x5b5555={'url':_0x2e4d21+_0x2a7e('0x38')+_0xb48702,'method':_0x2a7e('0x39'),'json':!![],'body':_0x3da5cb};return rp(_0x5b5555)[_0x2a7e('0x2d')](function(_0x53c8b3){return new BPromise(function(_0x4d85a6,_0x2eb6bd){_0x23fb8f=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+_0x2a7e('0x3b'));var _0x30e8ce=Buffer[_0x2a7e('0x3c')](_0x53c8b3[_0x2a7e('0x3d')],_0x2a7e('0x2c'));return fs[_0x2a7e('0x3e')](_0x23fb8f,_0x30e8ce,function(_0x17d679){_0x2eb6bd(_0x17d679);},function(_0x209577){fs[_0x2a7e('0x2e')](_0x23fb8f,_0x2a7e('0x3f'));_0x4d85a6(_0x209577);});});})[_0x2a7e('0x2d')](function(_0x438968){_0x4e4c6e=path[_0x2a7e('0x29')](__dirname,'tmp',rs[_0x2a7e('0x3a')](0x4)+'.wav');return convertFile(_0x23fb8f,_0x4e4c6e);})[_0x2a7e('0x2d')](function(){try{fs[_0x2a7e('0x1f')](_0x23fb8f);fs[_0x2a7e('0x2e')](_0x4e4c6e,_0x2a7e('0x3f'));}catch(_0x7406fb){logger[_0x2a7e('0x17')](_0x7406fb);}logger[_0x2a7e('0x1d')](_0x2a7e('0x40'),_0x4e4c6e[_0x2a7e('0x2f')]('.')[0x0]);return _0x4e4c6e[_0x2a7e('0x2f')]('.')[0x0];});};exports[_0x2a7e('0x41')]=function(_0xd266f1,_0x1a45d4){var _0x576790='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x8afb55,_0x59360e;var _0x5484fc;var _0x50c918={'encoding':'utf8','method':_0x2a7e('0x39'),'timeout':0x2710,'url':_0x576790,'headers':{'Content-Type':_0x2a7e('0x42')},'body':_0x2a7e('0x43')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x2a7e('0x44')]([_0xd266f1,_0x1a45d4||'en',![],'null']),null,_0x2a7e('0x45')]]]))};return rp(_0x50c918)[_0x2a7e('0x2d')](function(_0x146950){try{_0x5484fc=eval(_0x146950[_0x2a7e('0x46')](0x5))[0x0][0x2];}catch(_0x381506){throw new Error(_0x2a7e('0x47')+_0x146950[_0x2a7e('0x23')]);}if(!_0x5484fc){if(_0xd266f1['length']>0xc8){throw new Error(_0x2a7e('0x48'));}else{throw new Error('lang\x20\x22'+_0x1a45d4+_0x2a7e('0x49'));}}try{_0x5484fc=eval(_0x5484fc)[0x0];}catch(_0x5ca095){throw new Error(_0x2a7e('0x47')+res['data']);}const _0x3ad570=_0x5484fc;_0x8afb55=path['resolve'](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+'.mp3');fs[_0x2a7e('0x2b')](_0x8afb55,_0x5484fc,{'encoding':_0x2a7e('0x2c')});_0x59360e=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+_0x2a7e('0x4a'));return convertFile(_0x8afb55,_0x59360e);})['then'](function(){try{fs[_0x2a7e('0x1f')](_0x8afb55);fs[_0x2a7e('0x2e')](_0x59360e,'777');}catch(_0x1ed2de){logger[_0x2a7e('0x17')](_0x1ed2de);}logger[_0x2a7e('0x1d')](_0x2a7e('0x4b'),_0x59360e[_0x2a7e('0x2f')]('.')[0x0]);return _0x59360e[_0x2a7e('0x2f')]('.')[0x0];});};exports[_0x2a7e('0x4c')]=function(_0x3fb4fd,_0x188faa,_0x2067d8){return google[_0x2a7e('0x4d')](_0x3fb4fd,_0x188faa,_0x2067d8)[_0x2a7e('0x2d')](function(_0x59a3f5){logger[_0x2a7e('0x1d')](_0x59a3f5[_0x2a7e('0x4e')]);return rp(_0x59a3f5);})['then'](function(_0xf8d9a7){var _0x799817='';var _0x26c0ac=0x0;try{fs['unlink'](_0x3fb4fd);}catch(_0x3fc4e2){logger[_0x2a7e('0x17')](_0x3fc4e2);}if(_0xf8d9a7&&_0xf8d9a7[_0x2a7e('0x4f')]){_0x799817=_0xf8d9a7[_0x2a7e('0x4f')][_0x2a7e('0x50')](function(_0x7319ba){return _0x7319ba&&_0x7319ba[_0x2a7e('0x51')][0x0]&&_0x7319ba['alternatives'][0x0][_0x2a7e('0x52')]?_0x7319ba[_0x2a7e('0x51')][0x0][_0x2a7e('0x52')]:'';})[_0x2a7e('0x53')]('\x0a');_0x26c0ac=_0xf8d9a7['results'][_0x2a7e('0x50')](function(_0x4565bd){return _0x4565bd&&_0x4565bd[_0x2a7e('0x51')][0x0]&&_0x4565bd[_0x2a7e('0x51')][0x0][_0x2a7e('0x54')]?_0x4565bd[_0x2a7e('0x51')][0x0][_0x2a7e('0x54')]:0x0;})[_0x2a7e('0x53')]('\x0a');}logger[_0x2a7e('0x1d')]('googleASR\x20transcription',_0x799817);logger[_0x2a7e('0x1d')](_0x2a7e('0x55'),_0x26c0ac);return{'transcript':_0x799817,'confidence':_0x26c0ac};})['catch'](function(_0x2a597c){logger[_0x2a7e('0x17')](_0x2a7e('0x56'),_0x2a597c['statusCode'],_0x2a597c[_0x2a7e('0x57')],_0x2a597c[_0x2a7e('0x58')]);});};exports[_0x2a7e('0x59')]=function(_0x3f783d,_0x4c990f,_0x2b7337,_0x165a34){var _0x239d26=apiai(_0x4c990f,{'language':_0x165a34||'en'});return _0x239d26[_0x2a7e('0x5a')](_0x2b7337,{'sessionId':md5(_0x3f783d)})['then'](function(_0xb312b){logger['info'](JSON['stringify'](_0xb312b));return{'source':_0xb312b[_0x2a7e('0x5b')][_0x2a7e('0x5c')],'resolvedQuery':_0xb312b[_0x2a7e('0x5b')][_0x2a7e('0x5d')],'action':_0xb312b[_0x2a7e('0x5b')][_0x2a7e('0x5e')],'actionIncomplete':_0xb312b['result'][_0x2a7e('0x5f')],'speech':_0xb312b[_0x2a7e('0x5b')][_0x2a7e('0x60')][_0x2a7e('0x61')],'score':_0xb312b['result'][_0x2a7e('0x62')],'statusCode':_0xb312b[_0x2a7e('0x63')][_0x2a7e('0x64')],'endConversation':_0xb312b['result'][_0x2a7e('0x65')]['endConversation']||![],'isFallbackIntent':_0xb312b[_0x2a7e('0x5b')][_0x2a7e('0x65')][_0x2a7e('0x66')]};});};exports[_0x2a7e('0x67')]=function(_0x502b09,_0x13f639,_0x322bd2,_0x1beaf6,_0x545463,_0x5f11ae){var _0x5f188e=_0x1beaf6['replace'](/\\n/g,'\x0a');var _0xe47b7e={'credentials':{'private_key':_0x5f188e,'client_email':_0x322bd2}};var _0x42c97f=new dialogflow[(_0x2a7e('0x68'))](_0xe47b7e);var _0x44107f=_0x42c97f[_0x2a7e('0x69')](_0x13f639,md5(_0x502b09));var _0x45c96f={'session':_0x44107f,'queryInput':{'text':{'text':_0x545463,'languageCode':_0x5f11ae}}};return _0x42c97f[_0x2a7e('0x6a')](_0x45c96f)['then'](function(_0x53e568){if(_0x53e568&&_0x53e568[_0x2a7e('0x6b')]){logger['info']('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x53e568));var _0x3a24d1=_0x53e568[0x0];if(_0x3a24d1){var _0x336b63={'action':_0x3a24d1[_0x2a7e('0x6c')]['action'],'allRequiredParamsPresent':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x6d')],'endConversation':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x6e')]&&_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x6e')][_0x2a7e('0x6f')]?_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x6e')]['fields']['end_conversation'][_0x2a7e('0x70')]:![],'fulfillmentText':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x71')],'intentName':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x72')][_0x2a7e('0x57')],'intentDisplayName':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x72')][_0x2a7e('0x73')],'isFallbackIntent':_0x3a24d1[_0x2a7e('0x6c')]['intent'][_0x2a7e('0x74')],'languageCode':_0x3a24d1['queryResult'][_0x2a7e('0x75')],'queryText':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x76')],'responseId':_0x3a24d1['responseId'],'score':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x77')],'speech':_0x3a24d1[_0x2a7e('0x6c')][_0x2a7e('0x71')],'providerResponse':JSON[_0x2a7e('0x44')](_0x53e568)};return _0x336b63;}}});};exports[_0x2a7e('0x78')]=function(_0x247ff9,_0x3b1ca5,_0x49dd84,_0x49160e){return tilde[_0x2a7e('0x4d')](_0x247ff9,_0x3b1ca5,_0x49dd84,_0x49160e)[_0x2a7e('0x2d')](function(_0x5eb2ee){try{fs[_0x2a7e('0x1f')](_0x247ff9);}catch(_0x502683){logger[_0x2a7e('0x17')](_0x502683);}logger['info'](_0x2a7e('0x79'),_0x5eb2ee[_0x2a7e('0x52')]);logger['info']('Tilde\x20ASR\x20confidence',_0x5eb2ee[_0x2a7e('0x54')]);return _0x5eb2ee;});};exports[_0x2a7e('0x7a')]=function(_0x26ccfc,_0x1444d6,_0x1977be,_0x20824a,_0x51ef7b,_0x5280dc){var _0x354ebe=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+_0x2a7e('0x3b'));var _0x5f0da0;return aws['polly'](_0x26ccfc,_0x1444d6,_0x1977be,_0x20824a,_0x51ef7b,_0x5280dc,_0x354ebe)[_0x2a7e('0x2d')](function(){_0x5f0da0=path['resolve'](__dirname,_0x2a7e('0x2a'),rs['generate'](0x4)+_0x2a7e('0x4a'));return convertFile(_0x354ebe,_0x5f0da0);})[_0x2a7e('0x2d')](function(){try{fs['unlink'](_0x354ebe);fs[_0x2a7e('0x2e')](_0x5f0da0,_0x2a7e('0x3f'));}catch(_0x481d9d){logger[_0x2a7e('0x17')](_0x481d9d);}return _0x5f0da0[_0x2a7e('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x4f9abf,_0x11fece,_0x1a7b24,_0x62d270,_0x26a894,_0x44178e){return aws[_0x2a7e('0x7b')](_0x4f9abf,_0x11fece,_0x1a7b24,_0x62d270,_0x26a894,_0x44178e)['then'](function(_0x40de32){logger[_0x2a7e('0x1d')](JSON[_0x2a7e('0x44')](_0x40de32));return _0x40de32;});};exports[_0x2a7e('0x7c')]=function(_0x4ce7a8,_0x385cb8,_0x5f117a,_0x51460f){var _0x3e3cec=util['format'](_0x2a7e('0x7d'),ISPEECH_API,_0x4ce7a8,encodeURIComponent(_0x385cb8),_0x5f117a,_0x51460f);var _0x201cd8=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+_0x2a7e('0x3b'));var _0x2fdc47;return downloadFile(_0x3e3cec,_0x201cd8)[_0x2a7e('0x2d')](function(){_0x2fdc47=path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs['generate'](0x4)+_0x2a7e('0x4a'));return convertFile(_0x201cd8,_0x2fdc47);})['then'](function(){try{fs[_0x2a7e('0x1f')](_0x201cd8);fs[_0x2a7e('0x2e')](_0x2fdc47,_0x2a7e('0x3f'));}catch(_0x5985b4){logger[_0x2a7e('0x17')](_0x5985b4);}return _0x2fdc47['split']('.')[0x0];});};exports[_0x2a7e('0x7e')]=function(_0x3f979c,_0x5bd18a,_0x50dea5,_0x51275f){var _0x4cd890=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5bd18a,_0x50dea5,base64Encode(_0x3f979c),_0x51275f?util['format']('model=%s',encodeURIComponent(_0x51275f)):_0x2a7e('0x7f'));return uploadFile(_0x4cd890)[_0x2a7e('0x2d')](function(_0x2221aa){return querystring[_0x2a7e('0xa')](_0x2221aa);});};exports['sestekNDA']=function(_0x5c0640,_0x2b421a){return sestek[_0x2a7e('0x80')](_0x5c0640,_0x2b421a)['then'](function(_0x6bb7ed){logger[_0x2a7e('0x1d')](JSON[_0x2a7e('0x44')](_0x6bb7ed));var _0x1d4cd1={'speech':_0x6bb7ed[_0x2a7e('0x81')],'action':_0x6bb7ed[_0x2a7e('0x82')]?_0x6bb7ed['channelData'][_0x2a7e('0x83')]:undefined,'actiondata':_0x6bb7ed['channelData']?_0x6bb7ed[_0x2a7e('0x82')]['CustomActionData']:undefined};if(_0x6bb7ed[_0x2a7e('0x82')]&&_0x6bb7ed[_0x2a7e('0x82')]['AudioFromTts']){return base64Decode(_0x6bb7ed[_0x2a7e('0x82')][_0x2a7e('0x84')][_0x2a7e('0x85')],path[_0x2a7e('0x29')](__dirname,_0x2a7e('0x2a'),rs[_0x2a7e('0x3a')](0x4)+_0x2a7e('0x4a')))[_0x2a7e('0x2d')](function(_0x4c1055){_0x1d4cd1[_0x2a7e('0x86')]=_0x4c1055;return _0x1d4cd1;});}return _0x1d4cd1;});};exports[_0x2a7e('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x6d78=['resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','generate','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','textRequest','result','action','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','displayName','intent','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish\x20download\x20file','close','unlink','pipe','end','request\x20to\x20','data','transcode','error\x20convert','info','start'];(function(_0x4d1cc5,_0x5cf765){var _0x5e3fe5=function(_0x1e96ef){while(--_0x1e96ef){_0x4d1cc5['push'](_0x4d1cc5['shift']());}};_0x5e3fe5(++_0x5cf765);}(_0x6d78,0xd8));var _0x86d7=function(_0x46e2f8,_0x29a04d){_0x46e2f8=_0x46e2f8-0x0;var _0x490f20=_0x6d78[_0x46e2f8];return _0x490f20;};'use strict';var apiai=require(_0x86d7('0x0'));var BPromise=require(_0x86d7('0x1'));var dialogflow=require(_0x86d7('0x2'));var fs=require('fs');var http=require(_0x86d7('0x3'));var https=require(_0x86d7('0x4'));var md5=require(_0x86d7('0x5'));var path=require(_0x86d7('0x6'));var querystring=require(_0x86d7('0x7'));var rp=require('request-promise');var rs=require(_0x86d7('0x8'));var sox=require('sox');var tts=require(_0x86d7('0x9'));var urlParse=require(_0x86d7('0xa'))['parse'];var util=require(_0x86d7('0xb'));var aws=require(_0x86d7('0xc'));var google=require(_0x86d7('0xd'));var sestek=require(_0x86d7('0xe'));var tilde=require(_0x86d7('0xf'));var logger=require(_0x86d7('0x10'))(_0x86d7('0x11'));var ISPEECH_API=_0x86d7('0x12');function downloadFile(_0x3607d5,_0xf153d8){return new BPromise(function(_0x5782ae,_0x8b88f4){var _0x3baf2e=urlParse(_0x3607d5);var _0x14e4d6=_0x3baf2e[_0x86d7('0x13')]===_0x86d7('0x14')?https:http;var _0x12ea70={'host':_0x3baf2e[_0x86d7('0x15')],'path':_0x3baf2e[_0x86d7('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x14e4d6[_0x86d7('0x16')](_0x12ea70,function(_0x3c3d93){if(_0x3c3d93[_0x86d7('0x17')]!==0xc8){logger[_0x86d7('0x18')]('request\x20to\x20'+_0x3607d5+_0x86d7('0x19')+_0x3c3d93['statusCode']+'\x20('+_0x3c3d93[_0x86d7('0x1a')]+')');_0x8b88f4(new Error('request\x20to\x20'+_0x3607d5+_0x86d7('0x19')+_0x3c3d93[_0x86d7('0x17')]+'\x20('+_0x3c3d93[_0x86d7('0x1a')]+')'));return;}var _0xebb028=fs['createWriteStream'](_0xf153d8);_0xebb028['on']('finish',function(){logger['info'](_0x86d7('0x1b'));_0xebb028[_0x86d7('0x1c')](_0x5782ae);});_0xebb028['on'](_0x86d7('0x18'),function(_0x2463bc){fs[_0x86d7('0x1d')](_0xf153d8);logger[_0x86d7('0x18')]('download\x20error',_0x2463bc);_0x8b88f4(_0x2463bc);});_0x3c3d93[_0x86d7('0x1e')](_0xebb028);})['on'](_0x86d7('0x18'),function(_0x2e8f2f){logger[_0x86d7('0x18')](_0x2e8f2f);_0x8b88f4(_0x2e8f2f);})[_0x86d7('0x1f')]();});}function uploadFile(_0x231ed7){return new BPromise(function(_0x19fa46,_0x1f2afd){var _0x49e174=urlParse(_0x231ed7);var _0x171653=_0x49e174[_0x86d7('0x13')]===_0x86d7('0x14')?https:http;var _0x1a6e6c={'host':_0x49e174['host'],'path':_0x49e174['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x171653[_0x86d7('0x16')](_0x1a6e6c,function(_0x1ee872){if(_0x1ee872['statusCode']!==0xc8){_0x1f2afd(new Error(_0x86d7('0x20')+_0x231ed7+_0x86d7('0x19')+_0x1ee872['statusCode']+'\x20('+_0x1ee872[_0x86d7('0x1a')]+')'));return;}var _0x3af374='';_0x1ee872['on'](_0x86d7('0x21'),function(_0x40d9ac){_0x3af374+=_0x40d9ac;});_0x1ee872['on'](_0x86d7('0x1f'),function(){_0x19fa46(_0x3af374);});})['on'](_0x86d7('0x18'),function(_0x4eb038){_0x1f2afd(_0x4eb038);})[_0x86d7('0x1f')]();});}function convertFile(_0x601f79,_0x2ee46d){return new BPromise(function(_0x1c160e,_0x2503e4){var _0x718930=sox[_0x86d7('0x22')](_0x601f79,_0x2ee46d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x718930['on']('error',function(_0x5e7922){logger[_0x86d7('0x18')](_0x86d7('0x23'),_0x5e7922);_0x2503e4(_0x5e7922);});_0x718930['on'](_0x86d7('0x1f'),function(){logger[_0x86d7('0x24')]('finish\x20to\x20convert');_0x1c160e();});_0x718930[_0x86d7('0x25')]();});}function base64Decode(_0x3275e9,_0x3886e1){var _0x27750e=path[_0x86d7('0x26')](__dirname,_0x86d7('0x27'),rs['generate'](0x4)+_0x86d7('0x28'));fs[_0x86d7('0x29')](_0x27750e,_0x3275e9,_0x86d7('0x2a'));return convertFile(_0x27750e,_0x3886e1)[_0x86d7('0x2b')](function(){try{fs['unlink'](_0x27750e);fs[_0x86d7('0x2c')](_0x3886e1,_0x86d7('0x2d'));}catch(_0x5d4de4){logger[_0x86d7('0x18')](_0x5d4de4);}return _0x3886e1[_0x86d7('0x2e')]('.')[0x0];});}function base64Encode(_0x4325ef){var _0x25e73e=fs['readFileSync'](_0x4325ef);return new Buffer(_0x25e73e)[_0x86d7('0x2f')](_0x86d7('0x2a'));}exports[_0x86d7('0x30')]=function(_0x5d98d7,_0x494bb6,_0x504428,_0x4031ca,_0x1ccf86,_0x1cf421){var _0x223905,_0x11b9bb;var _0x43cb41='https://texttospeech.googleapis.com/v1/';var _0x44a42d=_0x86d7('0x31')+_0x5d98d7;var _0x250c00={};if(_0x494bb6===_0x86d7('0x32')){_0x250c00[_0x86d7('0x33')]={'ssml':_0x504428};}else{_0x250c00['input']={'text':_0x504428};};_0x250c00[_0x86d7('0x34')]={'languageCode':_0x4031ca,'ssmlGender':_0x1ccf86};_0x250c00[_0x86d7('0x35')]={'audioEncoding':_0x86d7('0x36'),'sampleRateHertz':0x1f40};var _0x54710c={'url':_0x43cb41+_0x86d7('0x37')+_0x44a42d,'method':_0x86d7('0x38'),'json':!![],'body':_0x250c00};return rp(_0x54710c)[_0x86d7('0x2b')](function(_0x49a1a2){return new BPromise(function(_0x14961b,_0x3119a0){_0x223905=path['resolve'](__dirname,_0x86d7('0x27'),rs['generate'](0x4)+_0x86d7('0x39'));var _0x459512=Buffer['from'](_0x49a1a2[_0x86d7('0x3a')],_0x86d7('0x2a'));return fs[_0x86d7('0x3b')](_0x223905,_0x459512,function(_0x4aff68){_0x3119a0(_0x4aff68);},function(_0x41c46f){fs['chmodSync'](_0x223905,_0x86d7('0x2d'));_0x14961b(_0x41c46f);});});})[_0x86d7('0x2b')](function(_0x35ec76){_0x11b9bb=path[_0x86d7('0x26')](__dirname,_0x86d7('0x27'),rs[_0x86d7('0x3c')](0x4)+_0x86d7('0x28'));return convertFile(_0x223905,_0x11b9bb);})[_0x86d7('0x2b')](function(){try{fs[_0x86d7('0x1d')](_0x223905);fs[_0x86d7('0x2c')](_0x11b9bb,_0x86d7('0x2d'));}catch(_0xe334a2){logger[_0x86d7('0x18')](_0xe334a2);}logger[_0x86d7('0x24')]('googleCloudTTS\x20path',_0x11b9bb['split']('.')[0x0]);return _0x11b9bb[_0x86d7('0x2e')]('.')[0x0];});};exports[_0x86d7('0x3d')]=function(_0x13cf6f,_0x44c750){var _0x21fea4=_0x86d7('0x3e');var _0x329ef2,_0x220d0d;var _0xadce07;var _0x22796b={'encoding':_0x86d7('0x3f'),'method':_0x86d7('0x38'),'timeout':0x2710,'url':_0x21fea4,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x86d7('0x40')]([[['jQ1olc',JSON['stringify']([_0x13cf6f,_0x44c750||'en',![],_0x86d7('0x41')]),null,_0x86d7('0x42')]]]))};return rp(_0x22796b)[_0x86d7('0x2b')](function(_0x102aee){try{_0xadce07=eval(_0x102aee[_0x86d7('0x43')](0x5))[0x0][0x2];}catch(_0x10157c){throw new Error(_0x86d7('0x44')+_0x102aee['data']);}if(!_0xadce07){if(_0x13cf6f['length']>0xc8){throw new Error(_0x86d7('0x45'));}else{throw new Error(_0x86d7('0x46')+_0x44c750+_0x86d7('0x47'));}}try{_0xadce07=eval(_0xadce07)[0x0];}catch(_0x2ed407){throw new Error(_0x86d7('0x44')+res[_0x86d7('0x21')]);}const _0x393c29=_0xadce07;_0x329ef2=path[_0x86d7('0x26')](__dirname,_0x86d7('0x27'),rs['generate'](0x4)+_0x86d7('0x39'));fs[_0x86d7('0x29')](_0x329ef2,_0xadce07,{'encoding':'base64'});_0x220d0d=path[_0x86d7('0x26')](__dirname,_0x86d7('0x27'),rs['generate'](0x4)+_0x86d7('0x28'));return convertFile(_0x329ef2,_0x220d0d);})['then'](function(){try{fs['unlink'](_0x329ef2);fs[_0x86d7('0x2c')](_0x220d0d,_0x86d7('0x2d'));}catch(_0x342d6d){logger[_0x86d7('0x18')](_0x342d6d);}logger[_0x86d7('0x24')]('goggleTTS\x20path',_0x220d0d[_0x86d7('0x2e')]('.')[0x0]);return _0x220d0d[_0x86d7('0x2e')]('.')[0x0];});};exports[_0x86d7('0x48')]=function(_0x438f5d,_0x4314d2,_0x129d37){return google[_0x86d7('0x49')](_0x438f5d,_0x4314d2,_0x129d37)[_0x86d7('0x2b')](function(_0x1086bf){logger[_0x86d7('0x24')](_0x1086bf[_0x86d7('0x4a')]);return rp(_0x1086bf);})[_0x86d7('0x2b')](function(_0x2c0122){var _0x26af65='';var _0x477b38=0x0;try{fs[_0x86d7('0x1d')](_0x438f5d);}catch(_0x55f6b9){logger['error'](_0x55f6b9);}if(_0x2c0122&&_0x2c0122[_0x86d7('0x4b')]){_0x26af65=_0x2c0122[_0x86d7('0x4b')][_0x86d7('0x4c')](function(_0x18451e){return _0x18451e&&_0x18451e[_0x86d7('0x4d')][0x0]&&_0x18451e[_0x86d7('0x4d')][0x0][_0x86d7('0x4e')]?_0x18451e[_0x86d7('0x4d')][0x0]['transcript']:'';})[_0x86d7('0x4f')]('\x0a');_0x477b38=_0x2c0122['results']['map'](function(_0x3b5747){return _0x3b5747&&_0x3b5747[_0x86d7('0x4d')][0x0]&&_0x3b5747[_0x86d7('0x4d')][0x0]['confidence']?_0x3b5747[_0x86d7('0x4d')][0x0]['confidence']:0x0;})[_0x86d7('0x4f')]('\x0a');}logger[_0x86d7('0x24')](_0x86d7('0x50'),_0x26af65);logger[_0x86d7('0x24')](_0x86d7('0x51'),_0x477b38);return{'transcript':_0x26af65,'confidence':_0x477b38};})[_0x86d7('0x52')](function(_0x43ee89){logger['error']('[%s]\x20%s:%s',_0x43ee89[_0x86d7('0x17')],_0x43ee89[_0x86d7('0x53')],_0x43ee89['message']);});};exports['googleDialogflow']=function(_0x58501e,_0x3e2060,_0x46f850,_0xbaaae2){var _0x3c4e9e=apiai(_0x3e2060,{'language':_0xbaaae2||'en'});return _0x3c4e9e[_0x86d7('0x54')](_0x46f850,{'sessionId':md5(_0x58501e)})[_0x86d7('0x2b')](function(_0x2f7795){logger['info'](JSON[_0x86d7('0x40')](_0x2f7795));return{'source':_0x2f7795[_0x86d7('0x55')]['source'],'resolvedQuery':_0x2f7795['result']['resolvedQuery'],'action':_0x2f7795[_0x86d7('0x55')][_0x86d7('0x56')],'actionIncomplete':_0x2f7795[_0x86d7('0x55')]['actionIncomplete'],'speech':_0x2f7795['result'][_0x86d7('0x57')][_0x86d7('0x58')],'score':_0x2f7795[_0x86d7('0x55')][_0x86d7('0x59')],'statusCode':_0x2f7795[_0x86d7('0x5a')][_0x86d7('0x5b')],'endConversation':_0x2f7795[_0x86d7('0x55')]['metadata'][_0x86d7('0x5c')]||![],'isFallbackIntent':_0x2f7795[_0x86d7('0x55')][_0x86d7('0x5d')][_0x86d7('0x5e')]};});};exports[_0x86d7('0x5f')]=function(_0xcc0e17,_0x23888c,_0x14861d,_0xdf9b73,_0x5b8225,_0x30d9e9){var _0xed4125=_0xdf9b73[_0x86d7('0x60')](/\\n/g,'\x0a');var _0x5a4b6f={'credentials':{'private_key':_0xed4125,'client_email':_0x14861d}};var _0x1a01ea=new dialogflow['SessionsClient'](_0x5a4b6f);var _0x5977ae=_0x1a01ea[_0x86d7('0x61')](_0x23888c,md5(_0xcc0e17));var _0x58d3ca={'session':_0x5977ae,'queryInput':{'text':{'text':_0x5b8225,'languageCode':_0x30d9e9}}};return _0x1a01ea['detectIntent'](_0x58d3ca)[_0x86d7('0x2b')](function(_0x2e3375){if(_0x2e3375&&_0x2e3375[_0x86d7('0x62')]){logger[_0x86d7('0x24')](_0x86d7('0x63'),JSON[_0x86d7('0x40')](_0x2e3375));var _0x514c67=_0x2e3375[0x0];if(_0x514c67){var _0x2b3eb8={'action':_0x514c67[_0x86d7('0x64')]['action'],'allRequiredParamsPresent':_0x514c67['queryResult']['allRequiredParamsPresent'],'endConversation':_0x514c67[_0x86d7('0x64')]['diagnosticInfo']&&_0x514c67[_0x86d7('0x64')][_0x86d7('0x65')][_0x86d7('0x66')]?_0x514c67[_0x86d7('0x64')][_0x86d7('0x65')][_0x86d7('0x66')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x514c67[_0x86d7('0x64')]['fulfillmentText'],'intentName':_0x514c67[_0x86d7('0x64')]['intent'][_0x86d7('0x53')],'intentDisplayName':_0x514c67[_0x86d7('0x64')]['intent'][_0x86d7('0x67')],'isFallbackIntent':_0x514c67[_0x86d7('0x64')][_0x86d7('0x68')]['isFallback'],'languageCode':_0x514c67[_0x86d7('0x64')][_0x86d7('0x69')],'queryText':_0x514c67[_0x86d7('0x64')][_0x86d7('0x6a')],'responseId':_0x514c67[_0x86d7('0x6b')],'score':_0x514c67[_0x86d7('0x64')][_0x86d7('0x6c')],'speech':_0x514c67['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x86d7('0x40')](_0x2e3375)};return _0x2b3eb8;}}});};exports['tildeASR']=function(_0x4c4f65,_0x561f78,_0x23bb2a,_0x2d0d16){return tilde[_0x86d7('0x49')](_0x4c4f65,_0x561f78,_0x23bb2a,_0x2d0d16)[_0x86d7('0x2b')](function(_0x2a831b){try{fs[_0x86d7('0x1d')](_0x4c4f65);}catch(_0x3622ef){logger[_0x86d7('0x18')](_0x3622ef);}logger[_0x86d7('0x24')](_0x86d7('0x6d'),_0x2a831b['transcript']);logger[_0x86d7('0x24')](_0x86d7('0x6e'),_0x2a831b['confidence']);return _0x2a831b;});};exports['awsPolly']=function(_0x4d0ddb,_0x2ae260,_0x354eb4,_0x3efb47,_0x3a0c4c,_0x12f4b6){var _0x3a8477=path['resolve'](__dirname,_0x86d7('0x27'),rs[_0x86d7('0x3c')](0x4)+'.mp3');var _0x5babca;return aws[_0x86d7('0x6f')](_0x4d0ddb,_0x2ae260,_0x354eb4,_0x3efb47,_0x3a0c4c,_0x12f4b6,_0x3a8477)['then'](function(){_0x5babca=path['resolve'](__dirname,_0x86d7('0x27'),rs[_0x86d7('0x3c')](0x4)+_0x86d7('0x28'));return convertFile(_0x3a8477,_0x5babca);})[_0x86d7('0x2b')](function(){try{fs[_0x86d7('0x1d')](_0x3a8477);fs[_0x86d7('0x2c')](_0x5babca,_0x86d7('0x2d'));}catch(_0x31fd3d){logger[_0x86d7('0x18')](_0x31fd3d);}return _0x5babca[_0x86d7('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x156960,_0x431402,_0x44891f,_0x391e51,_0x42ffdc,_0x15651c){return aws[_0x86d7('0x70')](_0x156960,_0x431402,_0x44891f,_0x391e51,_0x42ffdc,_0x15651c)[_0x86d7('0x2b')](function(_0x58779a){logger['info'](JSON['stringify'](_0x58779a));return _0x58779a;});};exports[_0x86d7('0x71')]=function(_0x42c71a,_0xe96bdb,_0x1e034c,_0x261f9e){var _0xe73c35=util[_0x86d7('0x72')](_0x86d7('0x73'),ISPEECH_API,_0x42c71a,encodeURIComponent(_0xe96bdb),_0x1e034c,_0x261f9e);var _0x4c01f9=path['resolve'](__dirname,'tmp',rs[_0x86d7('0x3c')](0x4)+_0x86d7('0x39'));var _0x3ebc18;return downloadFile(_0xe73c35,_0x4c01f9)['then'](function(){_0x3ebc18=path[_0x86d7('0x26')](__dirname,_0x86d7('0x27'),rs[_0x86d7('0x3c')](0x4)+_0x86d7('0x28'));return convertFile(_0x4c01f9,_0x3ebc18);})[_0x86d7('0x2b')](function(){try{fs[_0x86d7('0x1d')](_0x4c01f9);fs[_0x86d7('0x2c')](_0x3ebc18,_0x86d7('0x2d'));}catch(_0x405212){logger[_0x86d7('0x18')](_0x405212);}return _0x3ebc18[_0x86d7('0x2e')]('.')[0x0];});};exports[_0x86d7('0x74')]=function(_0x37d2f9,_0x4fb057,_0xc139f4,_0x586105){var _0x53e1f3=util['format'](_0x86d7('0x75'),ISPEECH_API,_0x4fb057,_0xc139f4,base64Encode(_0x37d2f9),_0x586105?util['format']('model=%s',encodeURIComponent(_0x586105)):_0x86d7('0x76'));return uploadFile(_0x53e1f3)[_0x86d7('0x2b')](function(_0x580e96){return querystring[_0x86d7('0x77')](_0x580e96);});};exports[_0x86d7('0x78')]=function(_0x1c073a,_0xb249a0){return sestek[_0x86d7('0x79')](_0x1c073a,_0xb249a0)[_0x86d7('0x2b')](function(_0x5e7f36){logger['info'](JSON[_0x86d7('0x40')](_0x5e7f36));var _0x3d13fd={'speech':_0x5e7f36['text'],'action':_0x5e7f36[_0x86d7('0x7a')]?_0x5e7f36['channelData'][_0x86d7('0x7b')]:undefined,'actiondata':_0x5e7f36['channelData']?_0x5e7f36[_0x86d7('0x7a')]['CustomActionData']:undefined};if(_0x5e7f36[_0x86d7('0x7a')]&&_0x5e7f36[_0x86d7('0x7a')][_0x86d7('0x7c')]){return base64Decode(_0x5e7f36[_0x86d7('0x7a')][_0x86d7('0x7c')]['Data'],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x86d7('0x28')))[_0x86d7('0x2b')](function(_0x5e62d9){_0x3d13fd[_0x86d7('0x7d')]=_0x5e62d9;return _0x3d13fd;});}return _0x3d13fd;});};exports[_0x86d7('0x7e')]=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 b49b976..5ca6fcb 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 _0x32f3=['./nda'];(function(_0x16f374,_0x5bcef8){var _0x22cbd9=function(_0x5084cc){while(--_0x5084cc){_0x16f374['push'](_0x16f374['shift']());}};_0x22cbd9(++_0x5bcef8);}(_0x32f3,0x8f));var _0x332f=function(_0x1e9ce7,_0x22ba20){_0x1e9ce7=_0x1e9ce7-0x0;var _0x2afb5b=_0x32f3[_0x1e9ce7];return _0x2afb5b;};var nda=require(_0x332f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x3482=['exports'];(function(_0x16295e,_0x4a9b05){var _0x2d9e54=function(_0x396291){while(--_0x396291){_0x16295e['push'](_0x16295e['shift']());}};_0x2d9e54(++_0x4a9b05);}(_0x3482,0x1c8));var _0x2348=function(_0x41f007,_0x3f6dfb){_0x41f007=_0x41f007-0x0;var _0x2d458b=_0x3482[_0x41f007];return _0x2d458b;};var nda=require('./nda');module[_0x2348('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ac9f4f6..8270d97 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 _0xec56=['dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname'];(function(_0x27c0f8,_0xd1bd2f){var _0x426b4e=function(_0x1d3f4b){while(--_0x1d3f4b){_0x27c0f8['push'](_0x27c0f8['shift']());}};_0x426b4e(++_0xd1bd2f);}(_0xec56,0x1bd));var _0x6ec5=function(_0x5f2c03,_0x56969f){_0x5f2c03=_0x5f2c03-0x0;var _0x4daed3=_0xec56[_0x5f2c03];return _0x4daed3;};'use strict';var rp=require(_0x6ec5('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x6ec5('0x1'));module[_0x6ec5('0x2')]=function(_0x26a5af,_0x240ccf){var _0x43c2cd={'method':_0x6ec5('0x3'),'uri':url[_0x6ec5('0x4')](_0x240ccf[_0x6ec5('0x5')],_0x6ec5('0x6')),'form':{'grant_type':_0x6ec5('0x7'),'username':_0x240ccf[_0x6ec5('0x8')],'password':_0x240ccf[_0x6ec5('0x7')]},'json':!![]};return rp(_0x43c2cd)[_0x6ec5('0x9')](function(_0x1f59cd){var _0x3dd891={'method':_0x6ec5('0x3'),'uri':url[_0x6ec5('0x4')](_0x240ccf[_0x6ec5('0xa')],_0x6ec5('0xb')),'body':{'type':_0x240ccf['ndaactivity_type']||_0x6ec5('0xc'),'channelId':_0x6ec5('0xd'),'conversation':{'id':_0x26a5af[_0x6ec5('0xe')]},'from':{'id':_0x26a5af[_0x6ec5('0xf')],'name':_0x26a5af[_0x6ec5('0x10')]},'recipient':{'id':_0x26a5af[_0x6ec5('0x11')],'name':_0x26a5af[_0x6ec5('0x12')]},'text':_0x240ccf['text'],'channelData':{}},'headers':{'Authorization':_0x6ec5('0x13')+_0x1f59cd[_0x6ec5('0x14')]},'json':!![]};if(_0x240ccf[_0x6ec5('0x15')]){_0x3dd891[_0x6ec5('0x16')][_0x6ec5('0x17')][_0x6ec5('0x18')]=_0x240ccf[_0x6ec5('0x15')];}if(_0x240ccf[_0x6ec5('0x19')]=='1'){_0x3dd891['body'][_0x6ec5('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6ec5('0x1a')};}if(_0x240ccf[_0x6ec5('0x1b')]){_0x3dd891[_0x6ec5('0x16')][_0x6ec5('0x17')][_0x6ec5('0x1c')]=_0x240ccf['custom_action'];if(_0x240ccf[_0x6ec5('0x1d')]){_0x3dd891[_0x6ec5('0x16')][_0x6ec5('0x17')][_0x6ec5('0x1e')]=_0x240ccf[_0x6ec5('0x1d')];}}logger[_0x6ec5('0x1f')](JSON[_0x6ec5('0x20')](_0x3dd891));return rp(_0x3dd891);});}; \ No newline at end of file +var _0x9c5e=['exports','POST','resolve','/token','password','username','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','request-promise','url','../../../../../config/logger','agi'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x7656b1,_0x1ecbdf){_0x7656b1=_0x7656b1-0x0;var _0x40be22=_0x9c5e[_0x7656b1];return _0x40be22;};'use strict';var rp=require(_0xe9c5('0x0'));var url=require(_0xe9c5('0x1'));var logger=require(_0xe9c5('0x2'))(_0xe9c5('0x3'));module[_0xe9c5('0x4')]=function(_0x5a6ce5,_0x51e921){var _0x595373={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndauth_url'],_0xe9c5('0x7')),'form':{'grant_type':_0xe9c5('0x8'),'username':_0x51e921[_0xe9c5('0x9')],'password':_0x51e921[_0xe9c5('0x8')]},'json':!![]};return rp(_0x595373)['then'](function(_0x2fa290){var _0x34ee69={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51e921[_0xe9c5('0xa')]||_0xe9c5('0xb'),'channelId':_0xe9c5('0xc'),'conversation':{'id':_0x5a6ce5[_0xe9c5('0xd')]},'from':{'id':_0x5a6ce5[_0xe9c5('0xe')],'name':_0x5a6ce5[_0xe9c5('0xf')]},'recipient':{'id':_0x5a6ce5[_0xe9c5('0x10')],'name':_0x5a6ce5[_0xe9c5('0x11')]},'text':_0x51e921[_0xe9c5('0x12')],'channelData':{}},'headers':{'Authorization':_0xe9c5('0x13')+_0x2fa290[_0xe9c5('0x14')]},'json':!![]};if(_0x51e921[_0xe9c5('0x15')]){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x18')]=_0x51e921[_0xe9c5('0x15')];}if(_0x51e921['ndagenerate_audio']=='1'){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe9c5('0x1a')};}if(_0x51e921[_0xe9c5('0x1b')]){_0x34ee69[_0xe9c5('0x16')]['channelData'][_0xe9c5('0x1c')]=_0x51e921[_0xe9c5('0x1b')];if(_0x51e921['custom_action_data']){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x1d')]=_0x51e921[_0xe9c5('0x1e')];}}logger[_0xe9c5('0x1f')](JSON['stringify'](_0x34ee69));return rp(_0x34ee69);});}; \ 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 12d9044..420d53c 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 _0xfe9b=['./lib/api','exports'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0xfe9b,0x196));var _0xbfe9=function(_0x151fc7,_0x4ea7ad){_0x151fc7=_0x151fc7-0x0;var _0xa08788=_0xfe9b[_0x151fc7];return _0xa08788;};'use strict';var asr=require(_0xbfe9('0x0'));module[_0xbfe9('0x1')]=function(_0x2d69e3,_0x4f2af0,_0x4afa69,_0x5b2085){return asr(_0x2d69e3,_0x4f2af0,_0x4afa69,_0x5b2085);}; \ No newline at end of file +var _0x8e5b=['./lib/api'];(function(_0x36bc58,_0x27f03c){var _0x4a547e=function(_0x6326c6){while(--_0x6326c6){_0x36bc58['push'](_0x36bc58['shift']());}};_0x4a547e(++_0x27f03c);}(_0x8e5b,0x91));var _0xb8e5=function(_0x557f3a,_0x550e6e){_0x557f3a=_0x557f3a-0x0;var _0x3ca615=_0x8e5b[_0x557f3a];return _0x3ca615;};'use strict';var asr=require(_0xb8e5('0x0'));module['exports']=function(_0x265c9e,_0x4bcc8f,_0x467b5c,_0x41d8e3){return asr(_0x265c9e,_0x4bcc8f,_0x467b5c,_0x41d8e3);}; \ 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 95e4a26..4d95f6e 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 _0x1b36=['exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','agi'];(function(_0x464eb2,_0x29663c){var _0x523c2a=function(_0x1cda8a){while(--_0x1cda8a){_0x464eb2['push'](_0x464eb2['shift']());}};_0x523c2a(++_0x29663c);}(_0x1b36,0xba));var _0x61b3=function(_0x16fb75,_0x393ee4){_0x16fb75=_0x16fb75-0x0;var _0xebb85a=_0x1b36[_0x16fb75];return _0xebb85a;};'use strict';var BPromise=require(_0x61b3('0x0'));var _=require(_0x61b3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x61b3('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x61b3('0x3'));module[_0x61b3('0x4')]=function(_0xf4cff9,_0x5cee93,_0x256c57,_0x5acdb3){return new BPromise(function(_0xe7c6cd,_0x339f82){logger['info'](_0x61b3('0x5'),_0x5acdb3||_0x61b3('0x6'));var _0x3228db=new WebSocket(_0x5acdb3||_0x61b3('0x6'),{'perMessageDeflate':![]});var _0x35a1fc='';var _0x32958f='0';var _0x2adab3='1';var _0x1e75e7=_0x61b3('0x7');function _0x1e1baa(_0x11625b){var _0x39db90=crypto['createHash']('sha1');_0x39db90[_0x61b3('0x8')](_0x11625b);return _0x39db90[_0x61b3('0x9')](_0x61b3('0xa'));}function _0x4667fe(){try{logger[_0x61b3('0xb')](_0x61b3('0xc'));var _0x357660=moment()[_0x61b3('0xd')]();var _0x3eec1b=_0x1e1baa(_0x357660+_0x5cee93+_0x256c57);_0x3228db['send'](JSON[_0x61b3('0xe')]({'appID':_0x5cee93,'timestamp':_0x357660,'appKey':_0x3eec1b}));var _0x18ce72=fs['createReadStream'](_0xf4cff9);_0x18ce72['on'](_0x61b3('0xf'),function(_0x41b3cc){_0x3228db[_0x61b3('0x10')](_0x41b3cc);});_0x18ce72['on'](_0x61b3('0x11'),function(){_0x3228db['send'](_0x61b3('0x12'));});}catch(_0x2de424){logger['error'](_0x61b3('0x13'),JSON[_0x61b3('0xe')](_0x2de424));_0x3228db[_0x61b3('0x14')]();}}function _0x3b5b16(_0x501c01){try{if(_0x501c01){var _0x57bf8a=JSON[_0x61b3('0x15')](_0x501c01);switch(_0x57bf8a['status']){case 0x0:if(_0x57bf8a[_0x61b3('0x16')]){if(_0x57bf8a[_0x61b3('0x16')][_0x61b3('0x17')]){logger[_0x61b3('0xb')](_0x61b3('0x18'),JSON[_0x61b3('0xe')](_0x57bf8a[_0x61b3('0x16')][_0x61b3('0x19')]));_0x35a1fc=_0x57bf8a[_0x61b3('0x16')]['hypotheses'][0x0][_0x61b3('0x1a')];_0x32958f=_0x57bf8a[_0x61b3('0x16')][_0x61b3('0x19')][0x0]['likelihood'];_0x2adab3='0';_0x1e75e7=_0x61b3('0x1b');_0x3228db[_0x61b3('0x14')]();}}break;case 0x1:logger[_0x61b3('0xb')](_0x61b3('0x7'));_0x2adab3='1';_0x1e75e7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x61b3('0xb')](_0x61b3('0x1c'));_0x2adab3='2';_0x1e75e7=_0x61b3('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2adab3='9';_0x1e75e7=_0x61b3('0x1d');break;case 0xa:logger[_0x61b3('0xb')](_0x61b3('0x1e'));_0x2adab3='10';_0x1e75e7=_0x61b3('0x1e');break;case 0xb:logger['info'](_0x61b3('0x1f'));_0x2adab3='11';_0x1e75e7=_0x61b3('0x1f');}}}catch(_0x326268){logger[_0x61b3('0x20')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x326268));_0x3228db['terminate']();}}function _0x5ca212(){logger[_0x61b3('0xb')](_0x61b3('0x21'));_0xe7c6cd({'transcript':_0x35a1fc,'confidence':_0x32958f,'status':_0x2adab3,'status_message':_0x1e75e7});}function _0x116315(_0x4dbb33){logger[_0x61b3('0x20')](_0x61b3('0x22'));if(!_[_0x61b3('0x23')](_0x4dbb33)){logger[_0x61b3('0x20')](_[_0x61b3('0x24')](_0x4dbb33)?JSON[_0x61b3('0xe')](_0x4dbb33):_0x4dbb33);}}_0x3228db['on']('open',_0x4667fe);_0x3228db['on'](_0x61b3('0x25'),_0x3b5b16);_0x3228db['on'](_0x61b3('0x11'),_0x5ca212);_0x3228db['on']('error',_0x116315);});}; \ No newline at end of file +var _0x66d5=['crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Error\x20Tilde\x20ASR\x20socket','isNil','message','close','bluebird','moment'];(function(_0x23bbd7,_0x5e8f26){var _0x4619ba=function(_0x1a0265){while(--_0x1a0265){_0x23bbd7['push'](_0x23bbd7['shift']());}};_0x4619ba(++_0x5e8f26);}(_0x66d5,0x1c6));var _0x566d=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x66d5[_0x1e05c1];return _0x15f1ca;};'use strict';var BPromise=require(_0x566d('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x566d('0x1'));var crypto=require(_0x566d('0x2'));var logger=require(_0x566d('0x3'))(_0x566d('0x4'));module[_0x566d('0x5')]=function(_0x696bc8,_0x589d2c,_0x5b80b9,_0x7781b9){return new BPromise(function(_0x5f4541,_0x531a05){logger['info'](_0x566d('0x6'),_0x7781b9||_0x566d('0x7'));var _0xf9b259=new WebSocket(_0x7781b9||_0x566d('0x7'),{'perMessageDeflate':![]});var _0x175552='';var _0x3ae6bd='0';var _0x5bf36a='1';var _0x83d26b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x59ca33(_0x12c00b){var _0x3289d1=crypto['createHash'](_0x566d('0x8'));_0x3289d1[_0x566d('0x9')](_0x12c00b);return _0x3289d1[_0x566d('0xa')]('hex');}function _0x5a1728(){try{logger[_0x566d('0xb')](_0x566d('0xc'));var _0xa49b4b=moment()['unix']();var _0x11a202=_0x59ca33(_0xa49b4b+_0x589d2c+_0x5b80b9);_0xf9b259[_0x566d('0xd')](JSON[_0x566d('0xe')]({'appID':_0x589d2c,'timestamp':_0xa49b4b,'appKey':_0x11a202}));var _0x165cd4=fs[_0x566d('0xf')](_0x696bc8);_0x165cd4['on']('data',function(_0x1e33b0){_0xf9b259['send'](_0x1e33b0);});_0x165cd4['on']('close',function(){_0xf9b259[_0x566d('0xd')](_0x566d('0x10'));});}catch(_0x33fcf3){logger['error'](_0x566d('0x11'),JSON[_0x566d('0xe')](_0x33fcf3));_0xf9b259[_0x566d('0x12')]();}}function _0x5e6b7e(_0x2596a1){try{if(_0x2596a1){var _0x24d395=JSON[_0x566d('0x13')](_0x2596a1);switch(_0x24d395[_0x566d('0x14')]){case 0x0:if(_0x24d395[_0x566d('0x15')]){if(_0x24d395[_0x566d('0x15')][_0x566d('0x16')]){logger['info'](_0x566d('0x17'),JSON['stringify'](_0x24d395[_0x566d('0x15')][_0x566d('0x18')]));_0x175552=_0x24d395[_0x566d('0x15')]['hypotheses'][0x0][_0x566d('0x19')];_0x3ae6bd=_0x24d395[_0x566d('0x15')][_0x566d('0x18')][0x0][_0x566d('0x1a')];_0x5bf36a='0';_0x83d26b=_0x566d('0x1b');_0xf9b259[_0x566d('0x12')]();}}break;case 0x1:logger['info'](_0x566d('0x1c'));_0x5bf36a='1';_0x83d26b=_0x566d('0x1c');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5bf36a='2';_0x83d26b=_0x566d('0x1d');break;case 0x9:logger[_0x566d('0xb')](_0x566d('0x1e'));_0x5bf36a='9';_0x83d26b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x566d('0xb')](_0x566d('0x1f'));_0x5bf36a='10';_0x83d26b=_0x566d('0x1f');break;case 0xb:logger[_0x566d('0xb')](_0x566d('0x20'));_0x5bf36a='11';_0x83d26b=_0x566d('0x20');}}}catch(_0x584fc2){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x566d('0xe')](_0x584fc2));_0xf9b259[_0x566d('0x12')]();}}function _0x10ccb5(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x5f4541({'transcript':_0x175552,'confidence':_0x3ae6bd,'status':_0x5bf36a,'status_message':_0x83d26b});}function _0x40b88d(_0x6ba077){logger[_0x566d('0x21')](_0x566d('0x22'));if(!_[_0x566d('0x23')](_0x6ba077)){logger[_0x566d('0x21')](_['isObject'](_0x6ba077)?JSON[_0x566d('0xe')](_0x6ba077):_0x6ba077);}}_0xf9b259['on']('open',_0x5a1728);_0xf9b259['on'](_0x566d('0x24'),_0x5e6b7e);_0xf9b259['on'](_0x566d('0x25'),_0x10ccb5);_0xf9b259['on']('error',_0x40b88d);});}; \ 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 ebbd2a0..f3ae9a2 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 _0xe8d9=['./asr','exports'];(function(_0x2b2537,_0x128c3c){var _0x3a74c4=function(_0x591ffe){while(--_0x591ffe){_0x2b2537['push'](_0x2b2537['shift']());}};_0x3a74c4(++_0x128c3c);}(_0xe8d9,0xac));var _0x9e8d=function(_0x3e8ab6,_0x3c73f8){_0x3e8ab6=_0x3e8ab6-0x0;var _0xd31af1=_0xe8d9[_0x3e8ab6];return _0xd31af1;};var asr=require(_0x9e8d('0x0'));module[_0x9e8d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc085=['./asr','exports'];(function(_0x229522,_0x8ba349){var _0x27e326=function(_0x4b12af){while(--_0x4b12af){_0x229522['push'](_0x229522['shift']());}};_0x27e326(++_0x8ba349);}(_0xc085,0x142));var _0x5c08=function(_0x19dcd8,_0x37ec91){_0x19dcd8=_0x19dcd8-0x0;var _0x5967f9=_0xc085[_0x19dcd8];return _0x5967f9;};var asr=require(_0x5c08('0x0'));module[_0x5c08('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 04f47c1..d21b904 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 _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(_0x540e90,_0x31fa0f){var _0x1ab282=function(_0x2d4d7d){while(--_0x2d4d7d){_0x540e90['push'](_0x540e90['shift']());}};_0x1ab282(++_0x31fa0f);}(_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 +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(_0xb37185,_0x3ec508){var _0x575b45=function(_0x2d9b5a){while(--_0x2d9b5a){_0xb37185['push'](_0xb37185['shift']());}};_0x575b45(++_0x3ec508);}(_0xe706,0xa3));var _0x6e70=function(_0x26b4e8,_0x1c1a98){_0x26b4e8=_0x26b4e8-0x0;var _0x448057=_0xe706[_0x26b4e8];return _0x448057;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ab7ccd7..f80df9d 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 _0x65d2=['Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','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','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','prototype','getVoiceQueue','getVoiceQueueById','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','getSmsAccount','createSquareDetailsReport','channel','label','agicommand','arg_1','callerid','uniqueid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPauseById','agent','agentPause','isNil','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x65d2,0xb8));var _0x265d=function(_0x1661a6,_0x3269e2){_0x1661a6=_0x1661a6-0x0;var _0x47bdcd=_0x65d2[_0x1661a6];return _0x47bdcd;};'use strict';var fs=require('fs');var util=require(_0x265d('0x0'));var _=require(_0x265d('0x1'));var sh=require('shelljs');var odbc=require(_0x265d('0x2'))();var rs=require(_0x265d('0x3'));var moment=require(_0x265d('0x4'));var Mustache=require('mustache');var rp=require(_0x265d('0x5'));var logger=require(_0x265d('0x6'))(_0x265d('0x7'));var config=require('../../config/environment');var shared=require(_0x265d('0x8'));var scripts=require(_0x265d('0x9'));var FILES_PATH=_0x265d('0xa');var recursiveMapAttributes=[_0x265d('0xb'),_0x265d('0xc')];var verticesWithRetry=['menu',_0x265d('0xd'),_0x265d('0xe')];var AGIVertices=function(_0x258ae0,_0x1e6eec,_0x422a08){this['channel']=_0x258ae0;this[_0x265d('0xf')]=_0x1e6eec;this[_0x265d('0x10')]=_0x422a08;};AGIVertices['prototype'][_0x265d('0x11')]=function(_0x2a4abe,_0x3c53f8){this[_0x265d('0xf')][_0x265d('0x12')](_0x2a4abe)['then'](function(_0x3586eb){_0x3c53f8(null,_0x3586eb?_0x3586eb['name']:![]);})['catch'](function(_0x24cb9d){_0x3c53f8(_0x24cb9d);});};AGIVertices[_0x265d('0x13')][_0x265d('0x14')]=function(_0x2cdf6a,_0x181344){this['rpc'][_0x265d('0x15')](_0x2cdf6a)[_0x265d('0x16')](function(_0x40caed){_0x181344(null,_0x40caed?_0x40caed[_0x265d('0x17')]:![]);})[_0x265d('0x18')](function(_0x183f31){_0x181344(_0x183f31);});};AGIVertices[_0x265d('0x13')][_0x265d('0x19')]=function(_0x1a699,_0x1cac5a){this[_0x265d('0xf')][_0x265d('0x1a')](_0x1a699)[_0x265d('0x16')](function(_0x1ab38c){_0x1cac5a(null,_0x1ab38c?_0x1ab38c[_0x265d('0x17')]:![]);})[_0x265d('0x18')](function(_0x4b0637){_0x1cac5a(_0x4b0637);});};AGIVertices[_0x265d('0x13')][_0x265d('0x1b')]=function(_0x2f8932,_0x3ceee1){this[_0x265d('0xf')]['getSquareOdbcById'](_0x2f8932)['then'](function(_0x3dc44b){_0x3ceee1(null,_0x3dc44b?_0x3dc44b[_0x265d('0x1c')]:![]);})['catch'](function(_0x408840){_0x3ceee1(_0x408840);});};AGIVertices['prototype']['getUser']=function(_0x31be87,_0x24245b){this[_0x265d('0xf')][_0x265d('0x1d')](_0x31be87)['then'](function(_0x1da376){_0x24245b(null,_0x1da376?_0x1da376[_0x265d('0x17')]:![]);})[_0x265d('0x18')](function(_0xf807aa){_0x24245b(_0xf807aa);});};AGIVertices[_0x265d('0x13')][_0x265d('0x1e')]=function(_0x26e598,_0x61d39b){this['rpc'][_0x265d('0x1f')](_0x26e598)[_0x265d('0x16')](function(_0x248fa3){_0x61d39b(null,_0x248fa3?_0x248fa3[_0x265d('0x17')]:![]);})[_0x265d('0x18')](function(_0x3c163a){_0x61d39b(_0x3c163a);});};AGIVertices['prototype'][_0x265d('0x20')]=function(_0x1e6352,_0x5d0126){var _0x38c2dc=this;this[_0x265d('0xf')]['getSoundById'](_0x1e6352)[_0x265d('0x16')](function(_0x55e69f){_0x5d0126(null,_0x55e69f?_0x38c2dc[_0x265d('0x21')](_0x55e69f[_0x265d('0x22')]):![]);})[_0x265d('0x18')](function(_0x1a3eeb){_0x5d0126(_0x1a3eeb);});};AGIVertices[_0x265d('0x13')][_0x265d('0x23')]=function(_0xd09f13,_0x10cd43){this[_0x265d('0xf')]['getMailAccountById'](_0xd09f13)[_0x265d('0x16')](function(_0x593f50){_0x10cd43(null,_0x593f50?_0x593f50:![]);})[_0x265d('0x18')](function(_0x1a3205){_0x10cd43(_0x1a3205);});};AGIVertices[_0x265d('0x13')][_0x265d('0x24')]=function(_0x3580ab,_0x4e57ef,_0x8cd7a9){this['mailRpc'][_0x265d('0x24')](_0x3580ab,_0x4e57ef)[_0x265d('0x16')](function(){_0x8cd7a9(null);})['catch'](function(_0x43b533){_0x8cd7a9(_0x43b533);});};AGIVertices[_0x265d('0x13')]['getIntervals']=function(_0x1e093f,_0x252730){this[_0x265d('0xf')][_0x265d('0x25')](_0x1e093f)[_0x265d('0x16')](function(_0x5ab1c9){if(_0x5ab1c9){if(_0x5ab1c9['IntervalId']){_0x252730(null,[_0x5ab1c9[_0x265d('0x26')]]);}else{_0x252730(null,_['map'](_0x5ab1c9[_0x265d('0x27')],_0x265d('0x26')));}}else{_0x252730(null,![]);}})[_0x265d('0x18')](function(_0x2d271d){_0x252730(_0x2d271d);});};AGIVertices[_0x265d('0x13')]['getSoundPath']=function(_0xc51b96){return util['format'](_0x265d('0x28'),FILES_PATH,_0xc51b96);};AGIVertices[_0x265d('0x13')][_0x265d('0x29')]=function(_0x4d2165,_0xb759db,_0xdf9c42){odbc[_0x265d('0x2a')](_0x4d2165,function(_0x2d8d70){if(_0x2d8d70){logger[_0x265d('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x2d8d70);_0xdf9c42(_0x2d8d70);}else{logger['info'](_0x265d('0x2c'));odbc[_0x265d('0x2d')](_0xb759db,function(_0x290779,_0x51a1ad){if(_0x290779){logger['info'](_0x265d('0x2e'),_0xb759db);_0xdf9c42(_0x290779);}else{logger[_0x265d('0x2f')](_0x265d('0x30'),_0xb759db);odbc['close'](function(_0x4ecd75){if(_0x4ecd75){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4ecd75);}_0xdf9c42(null,_0x51a1ad);});}});}});};AGIVertices[_0x265d('0x13')][_0x265d('0x31')]=function(_0x4315e0,_0x312204){this['rpc']['getSmsAccountById'](_0x4315e0)[_0x265d('0x16')](function(_0x243878){_0x312204(null,_0x243878?_0x243878:![]);})[_0x265d('0x18')](function(_0xe927ee){_0x312204(_0xe927ee);});};AGIVertices['prototype']['createSmsMessage']=function(_0x13f2f7,_0x347c19){this[_0x265d('0xf')]['createSmsMessage'](_0x13f2f7)['then'](function(_0x526b7d){_0x347c19(null,_0x526b7d);})[_0x265d('0x18')](function(_0x5e509b){_0x347c19(_0x5e509b);});};AGIVertices['prototype'][_0x265d('0x32')]=function(_0x3329b9,_0x1275c3,_0x24b6e5){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x265d('0x33')]['uniqueid'],'node':_0x3329b9[_0x265d('0x34')],'application':_0x3329b9[_0x265d('0x35')],'data':_0x1275c3||null,'project_name':this['channel'][_0x265d('0x36')],'callerid':this[_0x265d('0x33')][_0x265d('0x37')]})['then'](function(_0x5bb882){if(_0x24b6e5){_0x24b6e5(null,_0x5bb882);}})[_0x265d('0x18')](function(_0x3203b4){if(_0x24b6e5){_0x24b6e5(_0x3203b4);}});};AGIVertices[_0x265d('0x13')]['createSquareRecording']=function(_0xa9845f,_0x3ec3f1,_0x5f1845,_0x320f78){this[_0x265d('0xf')]['createSquareRecording']({'uniqueid':this[_0x265d('0x33')][_0x265d('0x38')],'callerid':this[_0x265d('0x33')][_0x265d('0x37')],'calleridname':this[_0x265d('0x33')][_0x265d('0x39')],'context':this[_0x265d('0x33')][_0x265d('0x3a')],'extension':this['channel'][_0x265d('0x3b')],'priority':this[_0x265d('0x33')][_0x265d('0x3c')],'accountcode':this[_0x265d('0x33')][_0x265d('0x3d')],'dnid':this[_0x265d('0x33')][_0x265d('0x3e')],'projectName':this['channel'][_0x265d('0x36')],'saveName':_0x3ec3f1,'filename':_0xa9845f[_0x265d('0x3f')]||_0x3ec3f1,'savePath':_0x5f1845})[_0x265d('0x16')](function(_0xb0d26d){_0x320f78(null,_0xb0d26d);})[_0x265d('0x18')](function(_0xb10e36){_0x320f78(_0xb10e36);});};AGIVertices[_0x265d('0x13')]['createSquareMessage']=function(_0x20eec8,_0x2260ea,_0x127e5b,_0x2e06a6,_0x1690f8){this['rpc'][_0x265d('0x40')]({'uniqueid':this[_0x265d('0x33')][_0x265d('0x38')],'body':_0x20eec8,'direction':_0x2260ea,'providerName':_0x127e5b,'providerResponse':_0x2e06a6})[_0x265d('0x16')](function(_0xe729){if(_0x1690f8){_0x1690f8(null,_0xe729);}})[_0x265d('0x18')](function(_0x39b4fc){if(_0x1690f8){_0x1690f8(_0x39b4fc);}});};AGIVertices[_0x265d('0x13')][_0x265d('0x41')]=function(_0x50b7c9,_0x4cd2bc){this[_0x265d('0xf')][_0x265d('0x41')]({'firstName':_[_0x265d('0x42')](_0x50b7c9[_0x265d('0x17')])||_['isNil'](_0x50b7c9[_0x265d('0x17')])?_0x265d('0x43')+Math[_0x265d('0x44')]():_0x50b7c9['name'],'lastName':_[_0x265d('0x42')](_0x50b7c9[_0x265d('0x45')])||_['isNil'](_0x50b7c9[_0x265d('0x45')])?null:_0x50b7c9[_0x265d('0x45')],'phone':_0x50b7c9['phone'],'ListId':_0x50b7c9[_0x265d('0x46')],'scheduledat':_0x50b7c9[_0x265d('0x47')],'callbackUniqueid':this['channel'][_0x265d('0x38')],'tags':'callback','description':_0x265d('0x48')+_0x50b7c9[_0x265d('0x47')][_0x265d('0x49')](),'priority':_0x50b7c9['callback_priority']})['then'](function(_0x124e58){_0x4cd2bc(null,_0x124e58);})['catch'](function(_0x3f17b2){_0x4cd2bc(_0x3f17b2);});};AGIVertices[_0x265d('0x13')]['getPause']=function(_0x1b6e6e,_0x388471){this[_0x265d('0xf')][_0x265d('0x4a')](_0x1b6e6e)[_0x265d('0x16')](function(_0x201086){_0x388471(null,_0x201086?_0x201086['name']:![]);})['catch'](function(_0x23d634){_0x388471(_0x23d634);});};AGIVertices[_0x265d('0x13')]['agentPause']=function(_0x52ea1,_0x5013b1,_0x5cd41b){var _0x45786f={'role':_0x265d('0x4b')};_0x45786f[_0x52ea1]=this['channel'][_0x265d('0x37')];this[_0x265d('0xf')][_0x265d('0x4c')](_0x45786f,_0x5013b1,this[_0x265d('0x33')]['uniqueid'])['then'](function(_0x22af01){_0x5cd41b(null,_[_0x265d('0x4d')](_0x22af01)?![]:!![]);})[_0x265d('0x18')](function(_0x409c33){logger[_0x265d('0x2b')](_0x409c33);_0x5cd41b(null,![]);});};AGIVertices[_0x265d('0x13')][_0x265d('0x4e')]=function(_0x3fa3f0,_0x22b546){var _0x408b5d={'role':_0x265d('0x4b')};_0x408b5d[_0x3fa3f0]=this[_0x265d('0x33')][_0x265d('0x37')];this[_0x265d('0xf')][_0x265d('0x4e')](_0x408b5d)[_0x265d('0x16')](function(_0x268e42){_0x22b546(null,_[_0x265d('0x4d')](_0x268e42)?![]:!![]);})['catch'](function(_0x49ba48){logger['error'](_0x49ba48);_0x22b546(null,![]);});};AGIVertices[_0x265d('0x13')][_0x265d('0x4f')]=function(_0x1a67c5,_0x2db413){var _0x53fee8={'role':_0x265d('0x4b')};_0x53fee8[_0x1a67c5]=this[_0x265d('0x33')][_0x265d('0x37')];this[_0x265d('0xf')]['agentLogout'](_0x53fee8)[_0x265d('0x16')](function(_0x1ced3d){_0x2db413(null,_[_0x265d('0x4d')](_0x1ced3d)?![]:!![]);})[_0x265d('0x18')](function(_0x2f872f){logger[_0x265d('0x2b')](_0x2f872f);_0x2db413(null,![]);});};AGIVertices[_0x265d('0x13')][_0x265d('0x50')]=function(_0x13d8c6,_0x3c970a){var _0x97ffdf={'role':_0x265d('0x4b')};_0x97ffdf[_0x13d8c6]=this['channel'][_0x265d('0x37')];var _0x66426f=_0x13d8c6!=_0x265d('0x51')?util[_0x265d('0x52')](_0x265d('0x53'),_0x265d('0x54'),this[_0x265d('0x33')][_0x265d('0x37')]):undefined;this[_0x265d('0xf')][_0x265d('0x50')](_0x97ffdf,_0x66426f)[_0x265d('0x16')](function(_0x5c5109){_0x3c970a(null,_[_0x265d('0x4d')](_0x5c5109)?![]:!![]);})[_0x265d('0x18')](function(_0x322412){logger[_0x265d('0x2b')](_0x322412);_0x3c970a(null,![]);});};AGIVertices[_0x265d('0x13')]['shellCommand']=function(_0x1321a7,_0x5f0c5c){sh[_0x265d('0x55')](_[_0x265d('0x56')](_0x1321a7),function(_0x3f579c,_0x2f83ab){var _0x5a7de1=_0x2f83ab[_0x265d('0x57')](/(\r\n|\n|\r)/gm,'');_0x5f0c5c(null,_0x5a7de1);});};AGIVertices[_0x265d('0x13')]['googleCloudTTS']=function(_0x38fdce,_0x38affb){scripts[_0x265d('0x58')](_0x38fdce[_0x265d('0x59')],_0x38fdce[_0x265d('0x5a')]||'text',_0x38fdce[_0x265d('0x5b')],_0x38fdce[_0x265d('0x5c')]||_0x265d('0x5d'),_0x38fdce[_0x265d('0x5e')]||_0x265d('0x5f'),_0x38fdce[_0x265d('0x60')]||_0x265d('0x61'))[_0x265d('0x16')](function(_0x88177a){_0x38affb(null,_0x88177a);})[_0x265d('0x18')](function(_0x4e6be8){_0x38affb(_0x4e6be8);});};AGIVertices[_0x265d('0x13')][_0x265d('0x62')]=function(_0x403094,_0x1cb5a7){scripts[_0x265d('0x62')](_0x403094[_0x265d('0x5b')],_0x403094['google_tts_language']||'en',0x1)[_0x265d('0x16')](function(_0x270d91){_0x1cb5a7(null,_0x270d91);})[_0x265d('0x18')](function(_0x3dd3c3){_0x1cb5a7(_0x3dd3c3);});};AGIVertices[_0x265d('0x13')]['restAPI']=function(_0x26dbc8,_0x50cda8){var _0x5c2635={'uri':_0x26dbc8[_0x265d('0x63')],'method':_0x26dbc8[_0x265d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x26dbc8[_0x265d('0x65')])===_0x265d('0x66')&&parseInt(_0x26dbc8[_0x265d('0x65')])>=0x1?parseInt(_0x26dbc8[_0x265d('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x265d('0x67')]([_0x265d('0x68'),'PUT'],_0x5c2635[_0x265d('0x64')][_0x265d('0x69')]())){try{_0x5c2635[_0x265d('0x6a')]=_0x26dbc8[_0x265d('0xc')]?JSON['parse'](_0x26dbc8[_0x265d('0xc')]):{};}catch(_0x46d041){logger[_0x265d('0x2b')](_0x265d('0x6b'),_0x46d041);}}try{_0x5c2635[_0x265d('0x6c')]=_0x26dbc8[_0x265d('0xb')]?JSON[_0x265d('0x6d')](_0x26dbc8[_0x265d('0xb')]):{};}catch(_0x5e4435){logger['error'](_0x265d('0x6e'),_0x5e4435);}if(_0x26dbc8['computedVariables']){try{var _0x2d6557=require(_0x26dbc8[_0x265d('0x6f')])[_0x265d('0x70')](this,_0x5c2635);_0x5c2635[_0x265d('0x71')]=Mustache[_0x265d('0x72')](_0x26dbc8[_0x265d('0x63')],_0x2d6557,{},['$$','$$']);if(_0x5c2635[_0x265d('0x6c')]){_0x5c2635[_0x265d('0x6c')]=JSON[_0x265d('0x6d')](Mustache[_0x265d('0x72')](JSON[_0x265d('0x73')](_0x5c2635['headers']),_0x2d6557,{},['$$','$$']));}if(_0x5c2635[_0x265d('0x6a')]){_0x5c2635[_0x265d('0x6a')]=JSON[_0x265d('0x6d')](Mustache[_0x265d('0x72')](JSON[_0x265d('0x73')](_0x5c2635['body']),_0x2d6557,{},['$$','$$']));}}catch(_0x2be109){logger[_0x265d('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2be109);}}rp(_0x5c2635)['then'](function(_0x5dd7f8){var _0x298919={'statusCode':_0x5dd7f8[_0x265d('0x74')]||0xc8,'statusMessage':_0x5dd7f8[_0x265d('0x75')]||'OK','headers':_0x5dd7f8[_0x265d('0x6c')]||{},'body':_0x5dd7f8[_0x265d('0x6a')]||{}};_0x50cda8(null,_0x298919);})['catch'](function(_0x2bb5ef){var _0x331658={'statusCode':_0x2bb5ef[_0x265d('0x74')]||0x1f4,'statusMessage':_0x2bb5ef[_0x265d('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2bb5ef[_0x265d('0x77')]['headers']||{},'body':_0x2bb5ef[_0x265d('0x77')][_0x265d('0x6a')]||{}};_0x50cda8(null,_0x331658);});};AGIVertices[_0x265d('0x13')][_0x265d('0x78')]=function(_0x2a8a62,_0x3c17a3){scripts[_0x265d('0x78')](this[_0x265d('0x33')][_0x265d('0x38')],_0x2a8a62[_0x265d('0x79')],_0x2a8a62[_0x265d('0x5b')],_0x2a8a62[_0x265d('0x7a')]||'en')['then'](function(_0x30108b){_0x3c17a3(null,_0x30108b);})['catch'](function(_0x3f47ca){_0x3c17a3(_0x3f47ca);});};AGIVertices[_0x265d('0x13')][_0x265d('0x7b')]=function(_0x165e4c,_0x288022){scripts[_0x265d('0x7b')](this[_0x265d('0x33')][_0x265d('0x38')],_0x165e4c[_0x265d('0x7c')],_0x165e4c[_0x265d('0x7d')],_0x165e4c[_0x265d('0x7e')],_0x165e4c[_0x265d('0x5b')],_0x165e4c[_0x265d('0x7f')]||'en')[_0x265d('0x16')](function(_0xda92b7){_0x288022(null,_0xda92b7);})[_0x265d('0x18')](function(_0xbc6207){_0x288022(_0xbc6207);});};AGIVertices['prototype'][_0x265d('0x80')]=function(_0x425297,_0x3932aa){scripts[_0x265d('0x80')](this[_0x265d('0x33')],_0x425297)[_0x265d('0x16')](function(_0x513826){_0x3932aa(null,_0x513826);})[_0x265d('0x18')](function(_0x50e2e2){_0x3932aa(_0x50e2e2);});};AGIVertices['prototype'][_0x265d('0x81')]=function(_0x2ddeb7,_0x366c66){scripts[_0x265d('0x81')](_0x2ddeb7[_0x265d('0x79')],_0x2ddeb7[_0x265d('0x5b')],_0x2ddeb7[_0x265d('0x82')]||_0x265d('0x5d'),_0x2ddeb7[_0x265d('0x83')])[_0x265d('0x16')](function(_0x2e0ecb){_0x366c66(null,_0x2e0ecb);})[_0x265d('0x18')](function(_0x149727){_0x366c66(_0x149727);});};AGIVertices[_0x265d('0x13')][_0x265d('0x84')]=function(_0x1db914,_0x2740ac,_0x2c585c){scripts[_0x265d('0x84')](_0x2740ac,_0x1db914[_0x265d('0x79')],_0x1db914[_0x265d('0x85')]||_0x265d('0x5d'),this['isConfigured'](_0x1db914[_0x265d('0x86')])?_0x1db914['model']:undefined)[_0x265d('0x16')](function(_0x6db68e){_0x2c585c(null,_0x6db68e);})[_0x265d('0x18')](function(_0x2e050a){_0x2c585c(_0x2e050a);});};AGIVertices['prototype'][_0x265d('0x87')]=function(_0x4eb913,_0x16cbf0){scripts[_0x265d('0x87')](_0x4eb913[_0x265d('0x88')],_0x4eb913[_0x265d('0x89')],_0x4eb913['aws_polly_region'],_0x4eb913[_0x265d('0x8a')]||_0x265d('0x8b'),_0x4eb913[_0x265d('0x5b')],_0x4eb913[_0x265d('0x8c')]||_0x265d('0x5b'))['then'](function(_0x12c16f){_0x16cbf0(null,_0x12c16f);})['catch'](function(_0xd42156){_0x16cbf0(_0xd42156);});};AGIVertices[_0x265d('0x13')][_0x265d('0x8d')]=function(_0x302869,_0x1dc5e3){scripts['awsLex'](this[_0x265d('0x33')][_0x265d('0x38')],_0x302869['aws_access_key_id'],_0x302869[_0x265d('0x89')],_0x302869['aws_lex_region'],_0x302869[_0x265d('0x5b')],_0x302869['aws_bot_name'])['then'](function(_0x11b31f){_0x1dc5e3(null,_0x11b31f);})[_0x265d('0x18')](function(_0x4758cb){_0x1dc5e3(_0x4758cb);});};AGIVertices[_0x265d('0x13')][_0x265d('0x8e')]=function(_0x26e069,_0x433b53,_0x246027){scripts[_0x265d('0x8e')](_0x433b53,_0x26e069[_0x265d('0x79')],_0x26e069[_0x265d('0x8f')]||_0x265d('0x5d'))[_0x265d('0x16')](function(_0x5345f1){_0x246027(null,_0x5345f1);})[_0x265d('0x18')](function(_0x58454e){_0x246027(_0x58454e);});};AGIVertices[_0x265d('0x13')][_0x265d('0x90')]=function(_0x3cad8c,_0x120d19,_0x57512f){scripts[_0x265d('0x90')](_0x120d19,_0x3cad8c[_0x265d('0x91')],_0x3cad8c[_0x265d('0x92')],_0x3cad8c['uri'])['then'](function(_0x3b5acd){_0x57512f(null,_0x3b5acd);})[_0x265d('0x18')](function(_0x57dd48){_0x57512f(_0x57dd48);});};AGIVertices['prototype'][_0x265d('0x93')]=function(_0xced5bb){var _0x5a9799=_[_0x265d('0x67')](verticesWithRetry,_0xced5bb[_0x265d('0x35')])?_0xced5bb:_['clone'](_0xced5bb);for(var _0x1ad480 in _0x5a9799){if(_0x5a9799[_0x265d('0x94')](_0x1ad480)){if(_0x5a9799[_0x1ad480]&&_[_0x265d('0x95')](_0x5a9799[_0x1ad480])){if(_[_0x265d('0x67')](recursiveMapAttributes,_0x1ad480)){_0x5a9799[_0x1ad480]=this[_0x265d('0x96')](_0x5a9799[_0x1ad480]);}else{_0x5a9799[_0x1ad480]=this[_0x265d('0x97')](_0x5a9799[_0x1ad480]);}}}}return _0x5a9799;};AGIVertices['prototype'][_0x265d('0x98')]=function(_0x166897){for(var _0x1cd784 in _0x166897){if(_0x166897['hasOwnProperty'](_0x1cd784)){if(_[_0x265d('0x99')](_0x166897[_0x1cd784])){this[_0x265d('0x98')](_0x166897[_0x1cd784]);}else if(_[_0x265d('0x9a')](_0x166897[_0x1cd784])){for(var _0x3cefcb=0x0;_0x3cefcb<_0x166897[_0x1cd784][_0x265d('0x9b')];_0x3cefcb++){this[_0x265d('0x98')](_0x166897[_0x1cd784][_0x3cefcb]);}}else if(_[_0x265d('0x95')](_0x166897[_0x1cd784])){_0x166897[_0x1cd784]=this[_0x265d('0x97')](_0x166897[_0x1cd784]);}}}};AGIVertices[_0x265d('0x13')][_0x265d('0x9c')]=function(_0x2ad570,_0x4ff05c){for(var _0x6a5699 in _0x2ad570){if(_0x2ad570[_0x265d('0x94')](_0x6a5699)){if(_['isPlainObject'](_0x2ad570[_0x6a5699])){if(!_[_0x265d('0x42')](_0x2ad570[_0x6a5699])){this[_0x265d('0x9c')](_0x2ad570[_0x6a5699],util['format'](_0x265d('0x9d'),_0x4ff05c,_0x6a5699));}}else if(_['isArray'](_0x2ad570[_0x6a5699])){for(var _0x11d1ec=0x0;_0x11d1ec<_0x2ad570[_0x6a5699][_0x265d('0x9b')];_0x11d1ec++){this[_0x265d('0x9c')](_0x2ad570[_0x6a5699][_0x11d1ec],util['format'](_0x265d('0x9d'),_0x4ff05c,_0x6a5699+'['+_0x11d1ec+']'));}}else{if(!_['isNil'](_0x2ad570[_0x6a5699])){this['channel'][_0x265d('0x9e')](util[_0x265d('0x52')]('%s.%s',_0x4ff05c,_0x6a5699),_0x2ad570[_0x6a5699]);}}}}};AGIVertices[_0x265d('0x13')][_0x265d('0x96')]=function(_0x20cddd){try{var _0x4721d7=JSON[_0x265d('0x6d')](_0x20cddd);this['recursiveNodeIndex'](_0x4721d7);return JSON[_0x265d('0x73')](_0x4721d7);}catch(_0xa6195b){return this['replaceAllVariables'](_0x20cddd);}};AGIVertices['prototype'][_0x265d('0x97')]=function(_0x136a2f){var _0x5a1db4=_0x136a2f[_0x265d('0x9f')]('{');for(var _0x16a29d=0x1;_0x16a29d<_0x5a1db4[_0x265d('0x9b')];_0x16a29d+=0x1){var _0x3008a2=_0x5a1db4[_0x16a29d][_0x265d('0x9f')]('}');if(_0x3008a2[_0x265d('0x9b')]>0x1){_0x136a2f=_0x136a2f[_0x265d('0xa0')]('{'+_0x3008a2[0x0]+'}',this[_0x265d('0x33')][_0x265d('0x11')](_0x3008a2[0x0])[_0x265d('0xa1')]||_0x3008a2[0x0]);}}if(_0x5a1db4[_0x265d('0x9b')]===0x1){return _0x136a2f[_0x265d('0x49')]();}return this['replaceAllVariables'](_0x136a2f);};AGIVertices[_0x265d('0x13')][_0x265d('0xa2')]=function(_0x277c22,_0x1560ae){var _0x3122d1=this[_0x265d('0x33')]['getVariable'](_0x277c22);if(_0x3122d1[_0x265d('0xa3')]===-0x1){return _0x3122d1;}logger['info'](util[_0x265d('0x52')](_0x265d('0xa4'),_0x1560ae,_0x3122d1[_0x265d('0xa1')]));return this[_0x265d('0x33')][_0x265d('0x9e')](_0x1560ae,_0x3122d1[_0x265d('0xa1')]);};AGIVertices[_0x265d('0x13')][_0x265d('0xa5')]=function(_0x49992d){return _0x49992d&&_0x49992d!=='0'&&_0x49992d!=='-1'&&_0x49992d!=='';};AGIVertices['prototype'][_0x265d('0xa6')]=function(_0x36120e){this['createSquareDetailsReport'][_0x265d('0x70')](this,_0x36120e,'-');_0x36120e[_0x265d('0xa7')]=_0x36120e[_0x265d('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x265d('0xa8')]=function(_0x1747ed){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1747ed['label']));if(!this[_0x265d('0xa5')](_0x1747ed[_0x265d('0x5b')])){return this[_0x265d('0x33')][_0x265d('0xa9')]('no\x20text\x20configured');}var _0x42a3a6='\x22'+_0x1747ed[_0x265d('0x5b')]+'\x22';if(this[_0x265d('0xa5')](_0x1747ed[_0x265d('0x77')])){_0x42a3a6+=','+_0x1747ed[_0x265d('0x77')];}var _0x2e02db=this[_0x265d('0x33')]['exec'](_0x265d('0xaa'),_0x42a3a6);if(_0x2e02db[_0x265d('0xa3')]===-0x1){return _0x2e02db;}return this['channel']['noop'](util[_0x265d('0x52')](_0x265d('0xab'),_0x42a3a6));};AGIVertices['prototype'][_0x265d('0xac')]=function(_0x13b814){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0xad'),_0x13b814[_0x265d('0x34')]));if(!this['isConfigured'](_0x13b814[_0x265d('0xae')])){return this[_0x265d('0x33')]['noop'](_0x265d('0xaf'));}var _0x349427=_0x13b814[_0x265d('0xae')];if(this['isConfigured'](_0x13b814[_0x265d('0x77')])){_0x349427+=','+_0x13b814[_0x265d('0x77')];}var _0x554382=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0xb0'),_0x349427);if(_0x554382[_0x265d('0xa3')]===-0x1){return _0x554382;}var _0x474e25=this[_0x265d('0xa2')](_0x265d('0xb1'),_0x265d('0xb2'));if(_0x474e25[_0x265d('0xa3')]===-0x1){return _0x474e25;}var _0x24b882=this[_0x265d('0xa2')](_0x265d('0xb3'),_0x265d('0xb4'));if(_0x24b882[_0x265d('0xa3')]===-0x1){return _0x24b882;}var _0x120b36=this[_0x265d('0xa2')](_0x265d('0xb5'),_0x265d('0xb6'));if(_0x120b36[_0x265d('0xa3')]===-0x1){return _0x120b36;}return this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0xb7'),_0x349427));};AGIVertices['prototype']['agi']=function(_0x1697ed){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1697ed['label']));return this[_0x265d('0x33')][_0x265d('0x7')]([_0x1697ed[_0x265d('0xb8')],_0x1697ed[_0x265d('0xb9')]]);};AGIVertices[_0x265d('0x13')][_0x265d('0xba')]=function(_0x443abf){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x443abf['label']));if(this[_0x265d('0xa5')](_0x443abf['timeout'])){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x443abf[_0x265d('0x65')]));var _0x4b92f7=this[_0x265d('0x33')][_0x265d('0xbb')](_0x443abf[_0x265d('0x65')]);if(_0x4b92f7[_0x265d('0xa3')]===-0x1){return _0x4b92f7;}}return this['channel'][_0x265d('0xba')]();};AGIVertices['prototype'][_0x265d('0xbc')]=function(_0x5ccc0c){logger[_0x265d('0x2f')](util['format'](_0x265d('0xbd'),_0x5ccc0c[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x5ccc0c[_0x265d('0x46')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x5ccc0c,'no\x20list\x20selected');}_0x5ccc0c['scheduledAt']=moment();if(this[_0x265d('0xa5')](_0x5ccc0c['delay'])){_0x5ccc0c[_0x265d('0x47')]=moment()[_0x265d('0xbe')](_0x5ccc0c[_0x265d('0xbf')],'minutes');}if(!this[_0x265d('0xa5')](_0x5ccc0c[_0x265d('0xc0')])){_0x5ccc0c[_0x265d('0xc0')]=0x2;}this[_0x265d('0x41')][_0x265d('0x70')](this,_0x5ccc0c);return this['channel']['noop'](util[_0x265d('0x52')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5ccc0c['phone'],_0x5ccc0c[_0x265d('0x46')],_0x5ccc0c[_0x265d('0x47')]));};AGIVertices[_0x265d('0x13')][_0x265d('0xc1')]=function(_0xdb3e7){logger['info'](util[_0x265d('0x52')](_0x265d('0xc2'),_0xdb3e7[_0x265d('0x34')]));var _0x428ce6=this[_0x265d('0x33')][_0x265d('0x55')](_0xdb3e7[_0x265d('0xc3')],_0xdb3e7[_0x265d('0x77')]);if(_0x428ce6[_0x265d('0xa3')]===-0x1){return _0x428ce6;}return this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xc4'),_0xdb3e7[_0x265d('0xc3')],_0xdb3e7['options']));};AGIVertices[_0x265d('0x13')][_0x265d('0xc5')]=function(_0x41aee5){logger['info'](util[_0x265d('0x52')](_0x265d('0xc6'),_0x41aee5[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x41aee5['text'])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xc7'));}var _0x1bc93a='\x22'+_0x41aee5[_0x265d('0x5b')]+'\x22';if(this[_0x265d('0xa5')](_0x41aee5[_0x265d('0x77')])){_0x1bc93a+=','+_0x41aee5['options'];}var _0x3f643f=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0xaa'),_0x1bc93a);if(_0x3f643f[_0x265d('0xa3')]===-0x1){return _0x3f643f;}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xab'),_0x1bc93a));};AGIVertices[_0x265d('0x13')][_0x265d('0xc8')]=function(_0x389e54){logger['info'](util[_0x265d('0x52')](_0x265d('0xc9'),_0x389e54['label']));if(!this[_0x265d('0xa5')](_0x389e54[_0x265d('0x5b')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xc7'));}var _0x53bd4f='\x22'+_0x389e54['text']+'\x22';if(this[_0x265d('0xa5')](_0x389e54[_0x265d('0x77')])){_0x53bd4f+=','+_0x389e54[_0x265d('0x77')];}var _0xefeca6=this['channel'][_0x265d('0x55')](_0x265d('0xaa'),_0x53bd4f);if(_0xefeca6['result']===-0x1){return _0xefeca6;}return this['channel']['noop'](util[_0x265d('0x52')](_0x265d('0xab'),_0x53bd4f));};AGIVertices[_0x265d('0x13')]['lumenvoxasr']=function(_0x2b9f47){logger[_0x265d('0x2f')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2b9f47[_0x265d('0x34')]));if(!this['isConfigured'](_0x2b9f47['grammar'])){return this['channel'][_0x265d('0xa9')](_0x265d('0xaf'));}var _0x2c57b1=_0x2b9f47[_0x265d('0xae')];if(this[_0x265d('0xa5')](_0x2b9f47['options'])){_0x2c57b1+=','+_0x2b9f47[_0x265d('0x77')];}var _0x1b6c68=this[_0x265d('0x33')]['exec'](_0x265d('0xb0'),_0x2c57b1);if(_0x1b6c68[_0x265d('0xa3')]===-0x1){return _0x1b6c68;}var _0xdfe675=this[_0x265d('0xa2')]('RECOG_CONFIDENCE()',_0x265d('0xca'));if(_0xdfe675[_0x265d('0xa3')]===-0x1){return _0xdfe675;}var _0x14b369=this['getAndSetVariable'](_0x265d('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x14b369[_0x265d('0xa3')]===-0x1){return _0x14b369;}var _0x106b9b=this[_0x265d('0xa2')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x106b9b[_0x265d('0xa3')]===-0x1){return _0x106b9b;}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xb7'),_0x2c57b1));};AGIVertices['prototype'][_0x265d('0xcb')]=function(_0x2421d0){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0xcc'),_0x2421d0[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x2421d0[_0x265d('0xae')])){return this[_0x265d('0x33')]['noop'](_0x265d('0xaf'));}var _0x2d6544=_0x2421d0[_0x265d('0xae')];if(this[_0x265d('0xa5')](_0x2421d0['options'])){_0x2d6544+=','+_0x2421d0[_0x265d('0x77')];}var _0x49326b=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0xb0'),_0x2d6544);if(_0x49326b[_0x265d('0xa3')]===-0x1){return _0x49326b;}var _0x4b16fa=this[_0x265d('0xa2')](_0x265d('0xb1'),_0x265d('0xcd'));if(_0x4b16fa[_0x265d('0xa3')]===-0x1){return _0x4b16fa;}var _0x1700f5=this[_0x265d('0xa2')](_0x265d('0xb3'),_0x265d('0xce'));if(_0x1700f5[_0x265d('0xa3')]===-0x1){return _0x1700f5;}var _0x40e57b=this[_0x265d('0xa2')](_0x265d('0xb5'),_0x265d('0xcf'));if(_0x40e57b[_0x265d('0xa3')]===-0x1){return _0x40e57b;}return this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xb7'),_0x2d6544));};AGIVertices[_0x265d('0x13')]['database']=function(_0x281ccc){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0xd0'),_0x281ccc[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x281ccc[_0x265d('0xd1')])){return this[_0x265d('0x33')]['error'](_0x281ccc,_0x265d('0xd2'));}var _0x3f94df=this['getSquareOdbc'][_0x265d('0x70')](this,_0x281ccc['odbc_id']);if(!_0x3f94df){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x281ccc,'no\x20odbc\x20database\x20found');}if(!this[_0x265d('0xa5')](_0x281ccc[_0x265d('0x2d')])){return this[_0x265d('0x33')]['error'](_0x281ccc,'no\x20query\x20configured');}var _0xb03e83=_0x281ccc[_0x265d('0x2d')][_0x265d('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')]('query:\x20%s',_0xb03e83));var _0x2ca815=this['getQueryOdbc'][_0x265d('0x70')](this,_0x3f94df,_0xb03e83);this[_0x265d('0x32')][_0x265d('0x70')](this,_0x281ccc,_0xb03e83);if(!this['isConfigured'](_0x281ccc[_0x265d('0xd3')])){return this[_0x265d('0x33')]['noop'](_0x265d('0xd4'));}var _0x3ec356=this['getVariable'][_0x265d('0x70')](this,_0x281ccc[_0x265d('0xd3')]);if(!_0x3ec356){return this[_0x265d('0x33')]['error'](_0x281ccc,_0x265d('0xd5'));}var _0x507ff8=this;_0x2ca815[_0x265d('0xd6')](function(_0x2fce50,_0x1712b8){Object[_0x265d('0xd7')](_0x2fce50)[_0x265d('0xd6')](function(_0x12b13f){_0x507ff8['channel'][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0xd8'),_0x3ec356,_0x1712b8,_0x12b13f),_0x2fce50[_0x12b13f]);});});this[_0x265d('0x33')]['setVariable'](util[_0x265d('0x52')](_0x265d('0xd9'),_0x3ec356),_0x2ca815[_0x265d('0x9b')]);return this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')]('variable\x20%s\x20set',_0x3ec356));};AGIVertices[_0x265d('0x13')][_0x265d('0xda')]=function(_0x11f44b){logger[_0x265d('0xdb')](util['format'](_0x265d('0xdc'),_0x11f44b[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x11f44b[_0x265d('0xdd')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x11f44b,_0x265d('0xde'));}var _0x426043=this['getUser']['sync'](this,_0x11f44b[_0x265d('0xdd')]);if(!_0x426043){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x11f44b,_0x265d('0xdf'));}var _0x43b007=this[_0x265d('0x33')][_0x265d('0x55')]('DIAL',[util['format']('SIP/%s',_0x426043),_0x11f44b[_0x265d('0x65')],_0x11f44b[_0x265d('0xe0')],_0x11f44b[_0x265d('0x63')]]);if(_0x43b007[_0x265d('0xa3')]===-0x1){return _0x43b007;}return this['channel']['noop'](util[_0x265d('0x52')](_0x265d('0xe1'),_0x265d('0xe2')));};AGIVertices[_0x265d('0x13')][_0x265d('0xe3')]=function(_0x14f048){logger[_0x265d('0x2f')](util['format'](_0x265d('0xe4'),_0x14f048[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x14f048[_0x265d('0x79')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xe5'));}if(!this['isConfigured'](_0x14f048[_0x265d('0x5b')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xc7'));}this['channel'][_0x265d('0xe6')]=!![];this[_0x265d('0x32')](_0x14f048);this[_0x265d('0x40')](_0x14f048['text'],'in','','');this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')]('Trying\x20Dialogflow:\x20%s',_0x14f048[_0x265d('0x5b')]));var _0x358d4a=this['googleDialogflow'][_0x265d('0x70')](this,_0x14f048);if(_0x358d4a){for(var _0x41b142 in _0x358d4a){if(_0x358d4a[_0x265d('0x94')](_0x41b142)){this[_0x265d('0x33')]['setVariable'](util[_0x265d('0x52')](_0x265d('0xe7'),_0x41b142[_0x265d('0x69')]()),_0x358d4a[_0x41b142]);}}this[_0x265d('0x40')](_0x358d4a[_0x265d('0xe8')],_0x265d('0xe9'),_0x265d('0xe3'),'');return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xea'),_0x358d4a['speech']));}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x14f048,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x265d('0xeb')]=function(_0x53dc4f){logger[_0x265d('0x2f')](util['format'](_0x265d('0xec'),_0x53dc4f[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x53dc4f[_0x265d('0x7c')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xed'));}if(!this[_0x265d('0xa5')](_0x53dc4f[_0x265d('0x7d')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xee'));}if(!this['isConfigured'](_0x53dc4f['private_key'])){return this['channel'][_0x265d('0xa9')](_0x265d('0xef'));}if(!this[_0x265d('0xa5')](_0x53dc4f['dialogflowV2_language'])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xf0'));}if(!this[_0x265d('0xa5')](_0x53dc4f[_0x265d('0x5b')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xc7'));}this['channel'][_0x265d('0xe6')]=!![];this[_0x265d('0x32')](_0x53dc4f);this['createSquareMessage'](_0x53dc4f[_0x265d('0x5b')],'in','','');this[_0x265d('0x33')][_0x265d('0xa9')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x53dc4f[_0x265d('0x5b')]));var _0x5a5c5e=this[_0x265d('0x7b')][_0x265d('0x70')](this,_0x53dc4f);if(_0x5a5c5e){for(var _0x1a4abc in _0x5a5c5e){if(_0x5a5c5e[_0x265d('0x94')](_0x1a4abc)){if(_0x1a4abc!==_0x265d('0xf1')){this['channel'][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0xe7'),_0x1a4abc[_0x265d('0x69')]()),_0x5a5c5e[_0x1a4abc]);}}}this[_0x265d('0x40')](_0x5a5c5e[_0x265d('0xe8')],'out',_0x265d('0xeb'),_0x5a5c5e[_0x265d('0xf1')]);return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xf2'),_0x5a5c5e[_0x265d('0xe8')]));}return this[_0x265d('0x33')]['error'](_0x53dc4f,_0x265d('0xf3'));};AGIVertices[_0x265d('0x13')][_0x265d('0xf4')]=function(_0x5a4fc5){logger['info'](util[_0x265d('0x52')](_0x265d('0xf5'),_0x5a4fc5[_0x265d('0x34')]));if(!this['isConfigured'](_0x5a4fc5[_0x265d('0xf6')])){return this[_0x265d('0x33')]['noop'](_0x265d('0xf7'));}if(!this[_0x265d('0xa5')](_0x5a4fc5[_0x265d('0xf8')])){return this[_0x265d('0x33')][_0x265d('0xa9')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x5a4fc5['password'])){return this[_0x265d('0x33')][_0x265d('0xa9')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x5a4fc5['ndassistant_url'])){return this[_0x265d('0x33')]['noop'](_0x265d('0xc7'));}this[_0x265d('0x33')][_0x265d('0xe6')]=!![];this[_0x265d('0x32')](_0x5a4fc5);this['createSquareMessage'](_0x5a4fc5[_0x265d('0x5b')],'in','','');this[_0x265d('0x33')][_0x265d('0xa9')](util['format'](_0x265d('0xf9'),_0x5a4fc5[_0x265d('0x5b')]));var _0x116712=this['sestekNDA'][_0x265d('0x70')](this,_0x5a4fc5);if(_0x116712){for(var _0xec5d79 in _0x116712){if(_0x116712['hasOwnProperty'](_0xec5d79)){this[_0x265d('0x33')][_0x265d('0x9e')](util[_0x265d('0x52')]('SESTEK_NDA_%s',_0xec5d79['toUpperCase']()),_0x116712[_0xec5d79]);}}this[_0x265d('0x40')](_0x116712['speech'],_0x265d('0xe9'),_0x265d('0xf4'),'');if(_0x116712[_0x265d('0xfa')]){this[_0x265d('0x33')][_0x265d('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x116712[_0x265d('0xfa')]));var _0x27d455=this[_0x265d('0x33')][_0x265d('0xfb')](_0x116712[_0x265d('0xfa')]);try{fs[_0x265d('0xfc')](_0x116712['audiofile']+_0x265d('0xfd'));}catch(_0x20c8f9){logger[_0x265d('0x2b')](_0x20c8f9);}return _0x27d455;}else{return this[_0x265d('0x33')][_0x265d('0xa9')](util['format']('SestekNDA\x20Result\x20%s',_0x116712[_0x265d('0xe8')]));}}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x5a4fc5,_0x265d('0xfe'));};AGIVertices[_0x265d('0x13')][_0x265d('0xff')]=function(_0x2b46c0){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x100'),_0x2b46c0[_0x265d('0x34')]));return this['channel'][_0x265d('0xa9')]('end');};AGIVertices[_0x265d('0x13')][_0x265d('0x101')]=function(_0x4d7fd3){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x102'),_0x4d7fd3[_0x265d('0x34')]));var _0x3a0093='';if(_0x4d7fd3[_0x265d('0x103')]){if(!this[_0x265d('0xa5')](_0x4d7fd3[_0x265d('0x103')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x4d7fd3,_0x265d('0x104'));}else{var _0x493a8a=parseInt(_0x4d7fd3[_0x265d('0x103')],0xa);if(isNaN(_0x493a8a)){_0x3a0093=_0x4d7fd3[_0x265d('0x103')];}else{_0x3a0093=this[_0x265d('0x1e')]['sync'](this,_0x4d7fd3[_0x265d('0x103')]);if(!_0x3a0093){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x4d7fd3,_0x265d('0x105'));}}}}else if(_0x4d7fd3[_0x265d('0x106')]){_0x3a0093=_0x4d7fd3[_0x265d('0x106')];}else{return this[_0x265d('0x33')]['error'](_0x4d7fd3,_0x265d('0x104'));}var _0xeb45a5=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0xe2'),[util[_0x265d('0x52')](_0x265d('0x107'),_0x3a0093,_0x4d7fd3[_0x265d('0x108')]),_0x4d7fd3[_0x265d('0x65')],_0x4d7fd3['opts'],_0x4d7fd3[_0x265d('0x63')]]);if(_0xeb45a5[_0x265d('0xa3')]===-0x1){return _0xeb45a5;}return this[_0x265d('0x33')][_0x265d('0xa9')](util['format'](_0x265d('0xe1'),_0x265d('0xe2')));};AGIVertices['prototype'][_0x265d('0x109')]=function(_0x1f9d5f){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x10a'),_0x1f9d5f[_0x265d('0x34')]));return this[_0x265d('0x33')]['noop']('finally');};AGIVertices[_0x265d('0x13')]['getdigits']=function(_0x4e8e21){logger['info'](util[_0x265d('0x52')](_0x265d('0x10b'),_0x4e8e21[_0x265d('0x34')]));if(_0x4e8e21['retry']===0x0){return this[_0x265d('0xa6')](_0x4e8e21);}_0x4e8e21[_0x265d('0xa7')]-=0x1;if(!this[_0x265d('0xa5')](_0x4e8e21[_0x265d('0x10c')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x4e8e21,_0x265d('0x10d'));}var _0x11c1f2=this[_0x265d('0x20')][_0x265d('0x70')](this,_0x4e8e21['file_id']);if(!_0x11c1f2){return this['channel'][_0x265d('0x2b')](_0x4e8e21,_0x265d('0x10e'));}if(!this[_0x265d('0xa5')](_0x4e8e21[_0x265d('0xd3')])){return this[_0x265d('0x33')][_0x265d('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b73bb=this['channel'][_0x265d('0x10f')](_0x11c1f2,_0x4e8e21[_0x265d('0x110')],_0x4e8e21[_0x265d('0x111')]);var _0x47aa1e=_0x1b73bb[_0x265d('0xa3')]?_0x1b73bb['result'][_0x265d('0x49')]():'';logger[_0x265d('0x2f')](_0x265d('0x112'),JSON[_0x265d('0x73')](_0x1b73bb));if(_0x1b73bb[_0x265d('0xa3')]===-0x1){this[_0x265d('0x32')][_0x265d('0x70')](this,_0x4e8e21,_0x47aa1e);return _0x1b73bb;}else if(_0x1b73bb[_0x265d('0xa1')]===_0x265d('0x65')){_0x1b73bb[_0x265d('0xa3')]=_0x47aa1e[_0x265d('0x9b')]>=parseInt(_0x4e8e21[_0x265d('0x113')])?'x':'i';}else{_0x1b73bb[_0x265d('0xa3')]=_0x47aa1e['length']>=parseInt(_0x4e8e21[_0x265d('0x113')])&&_0x47aa1e['length']<=parseInt(_0x4e8e21[_0x265d('0x111')])?'x':'i';}var _0x1a80af=this[_0x265d('0x11')][_0x265d('0x70')](this,_0x4e8e21['variable_id']);if(!_0x1a80af){return this[_0x265d('0x33')]['error'](_0x4e8e21,'no\x20variable\x20found');}this[_0x265d('0x33')]['setVariable'](_0x1a80af,_0x47aa1e);if(this['isConfigured'](_0x4e8e21[_0x265d('0x114')])){var _0x54a983=parseInt(_0x4e8e21[_0x265d('0x114')],0xa);var _0x4b3129=rs[_0x265d('0x115')]({'charset':'*','length':_0x54a983});var _0x32ed22=_0x47aa1e['length'];if(_0x32ed22>0x0){if(_0x32ed22>_0x54a983){this[_0x265d('0x32')][_0x265d('0x70')](this,_0x4e8e21,_0x4e8e21['hiddendigitspos']===_0x265d('0x116')?_0x4b3129+_0x47aa1e[_0x265d('0x117')](_0x54a983):_0x47aa1e['substr'](0x0,_0x32ed22-_0x54a983)+_0x4b3129);}else{this[_0x265d('0x32')][_0x265d('0x70')](this,_0x4e8e21,rs[_0x265d('0x115')]({'charset':'*','length':_0x32ed22}));}}else{this[_0x265d('0x32')][_0x265d('0x70')](this,_0x4e8e21,'');}}else{this['createSquareDetailsReport'][_0x265d('0x70')](this,_0x4e8e21,_0x47aa1e);}return _0x1b73bb;};AGIVertices[_0x265d('0x13')][_0x265d('0xe')]=function(_0x5a8c1f){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x118'),_0x5a8c1f['label']));return this[_0x265d('0xd')](_0x5a8c1f);};AGIVertices[_0x265d('0x13')][_0x265d('0x119')]=function(_0x4c644d){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x11a'),_0x4c644d[_0x265d('0x34')]));this[_0x265d('0x32')]['sync'](this,_0x4c644d,_0x4c644d[_0x265d('0x11b')]);return this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0x11c'),_0x4c644d[_0x265d('0x11b')]));};AGIVertices['prototype'][_0x265d('0x11d')]=function(_0x581b01){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x11e'),_0x581b01[_0x265d('0x34')]));if(!this['isConfigured'](_0x581b01[_0x265d('0x88')])||!this[_0x265d('0xa5')](_0x581b01[_0x265d('0x89')])){return this['channel']['noop'](_0x265d('0x11f'));}if(!this[_0x265d('0xa5')](_0x581b01[_0x265d('0x5b')])){return this['channel'][_0x265d('0xa9')](_0x265d('0xc7'));}this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x120'),_0x581b01[_0x265d('0x5b')]));var _0x23fe37=this[_0x265d('0x87')]['sync'](this,_0x581b01);if(_0x23fe37){this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x121'),_0x23fe37));var _0x3c65ee=this[_0x265d('0x33')]['streamFile'](_0x23fe37);try{fs[_0x265d('0xfc')](_0x23fe37+'.wav');}catch(_0x4d52f9){logger[_0x265d('0x2b')](_0x4d52f9);}return _0x3c65ee;}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x581b01,_0x265d('0x122'));};AGIVertices[_0x265d('0x13')][_0x265d('0x123')]=function(_0x137d06){logger[_0x265d('0x2f')](util['format'](_0x265d('0x124'),_0x137d06[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x137d06[_0x265d('0x88')])||!this[_0x265d('0xa5')](_0x137d06[_0x265d('0x89')])){return this[_0x265d('0x33')]['noop'](_0x265d('0x11f'));}if(!this['isConfigured'](_0x137d06[_0x265d('0x125')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x126'));}if(!this['isConfigured'](_0x137d06[_0x265d('0x5b')])){return this['channel'][_0x265d('0xa9')](_0x265d('0xc7'));}this[_0x265d('0x33')][_0x265d('0xe6')]=!![];this[_0x265d('0x32')](_0x137d06);this['createSquareMessage'](_0x137d06[_0x265d('0x5b')],'in','','');this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')]('Trying\x20Amazon\x20Lex:\x20%s',_0x137d06[_0x265d('0x5b')]));var _0x45fd12=this[_0x265d('0x8d')][_0x265d('0x70')](this,_0x137d06);if(_0x45fd12){for(var _0x24738c in _0x45fd12){if(_0x45fd12[_0x265d('0x94')](_0x24738c)&&_['isString'](_0x45fd12[_0x24738c])){this['channel'][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0x127'),_0x24738c['toUpperCase']()),_0x45fd12[_0x24738c]);}}if(_['isNil'](_0x45fd12['message'])){return this[_0x265d('0x33')]['noop'](_0x265d('0x128'));}else{this[_0x265d('0x40')](_0x45fd12['message'],'out','amazonlex','');return this['channel']['noop'](util[_0x265d('0x52')]('Amazon\x20Lex\x20Result\x20%s',_0x45fd12['message']));}}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x137d06,_0x265d('0x129'));};AGIVertices[_0x265d('0x13')][_0x265d('0x12a')]=function(_0x5d4986){logger[_0x265d('0x2f')](util['format'](_0x265d('0x12b'),_0x5d4986['label'],_0x5d4986[_0x265d('0x65')]));if(!this['isConfigured'](_0x5d4986[_0x265d('0x79')])){return this[_0x265d('0x33')][_0x265d('0xa9')]('no\x20key\x20configured');}var _0x59d8a6=_0x265d('0x12c');var _0x1deb2a=util[_0x265d('0x52')](_0x265d('0x12d'),FILES_PATH,rs[_0x265d('0x115')](0x4));var _0x37f067=util[_0x265d('0x52')]('%s.%s',_0x1deb2a,_0x59d8a6);var _0x4e4263=!![];if(_0x5d4986['beep']===_0x265d('0x12e')){_0x4e4263=![];}var _0x578676=this['channel'][_0x265d('0x12f')](_0x1deb2a,_0x59d8a6,_0x5d4986[_0x265d('0x130')],_0x5d4986['timeout'],undefined,_0x4e4263);if(_0x578676[_0x265d('0xa3')]!==-0x1){this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x131'),_0x37f067));var _0x39f2a5=this[_0x265d('0x8e')]['sync'](this,_0x5d4986,_0x37f067);if(_0x39f2a5){for(var _0x3196ff in _0x39f2a5){if(_0x39f2a5[_0x265d('0x94')](_0x3196ff)){this['channel'][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0x132'),_0x3196ff[_0x265d('0x69')]()),_0x39f2a5[_0x3196ff]);}}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x133'),JSON[_0x265d('0x73')](_0x39f2a5)));}}return _0x578676;};AGIVertices[_0x265d('0x13')][_0x265d('0x134')]=function(_0x5d01bb){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5d01bb[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x5d01bb[_0x265d('0x91')])){return this['channel'][_0x265d('0xa9')](_0x265d('0x135'));}if(!this[_0x265d('0xa5')](_0x5d01bb[_0x265d('0x92')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x136'));}var _0x454071='wav';var _0x555474=util[_0x265d('0x52')](_0x265d('0x12d'),FILES_PATH,rs[_0x265d('0x115')](0x4));var _0x176156=util[_0x265d('0x52')](_0x265d('0x9d'),_0x555474,_0x454071);var _0x3c8ec2=!![];if(_0x5d01bb[_0x265d('0x137')]===_0x265d('0x12e')){_0x3c8ec2=![];}var _0x56a2f0=this[_0x265d('0x33')][_0x265d('0x12f')](_0x555474,_0x454071,_0x5d01bb[_0x265d('0x130')],_0x5d01bb['timeout'],undefined,_0x3c8ec2);if(_0x56a2f0[_0x265d('0xa3')]!==-0x1){this[_0x265d('0x33')][_0x265d('0xa9')](util['format'](_0x265d('0x138'),_0x176156));var _0x261b5e=this['tildeASR'][_0x265d('0x70')](this,_0x5d01bb,_0x176156);if(_0x261b5e){for(var _0x80695e in _0x261b5e){if(_0x261b5e[_0x265d('0x94')](_0x80695e)){this['channel']['setVariable'](util['format']('TILDE_ASR_%s',_0x80695e[_0x265d('0x69')]()),_0x261b5e[_0x80695e]);}}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x139'),JSON[_0x265d('0x73')](_0x261b5e)));}}return _0x56a2f0;};AGIVertices[_0x265d('0x13')][_0x265d('0x13a')]=function(_0x3055ce){logger['info'](util[_0x265d('0x52')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3055ce['label']));return this[_0x265d('0x33')]['continueAt'](_0x3055ce[_0x265d('0x3a')],_0x3055ce[_0x265d('0x3b')],_0x3055ce['priority']);};AGIVertices[_0x265d('0x13')][_0x265d('0x13b')]=function(_0x2251fd){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x13c'),_0x2251fd[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x2251fd[_0x265d('0x13d')])){return this['channel']['error'](_0x2251fd,_0x265d('0x13e'));}try{var _0x3d65d9=eval(_0x2251fd['condition'])?_0x265d('0x13f'):'false';this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x140'),_0x2251fd[_0x265d('0x13d')],_0x3d65d9));return{'code':0xc8,'result':_0x3d65d9};}catch(_0x2d624a){return{'code':0xc8,'result':_0x265d('0x141')};}};AGIVertices[_0x265d('0x13')]['gotoiftime']=function(_0x3866ef){logger['info'](util[_0x265d('0x52')](_0x265d('0x142'),_0x3866ef[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x3866ef[_0x265d('0x143')])){return this[_0x265d('0x33')]['error'](_0x3866ef,_0x265d('0x144'));}var _0x5e561d=this[_0x265d('0x145')][_0x265d('0x70')](this,_0x3866ef[_0x265d('0x143')]);if(!_0x5e561d){return this['channel']['error'](_0x3866ef,_0x265d('0x146'));}for(var _0x14291a=0x0;_0x14291a<_0x5e561d['length'];_0x14291a+=0x1){var _0x33ad61=this[_0x265d('0x33')][_0x265d('0x11')](util[_0x265d('0x52')](_0x265d('0x147'),_0x5e561d[_0x14291a]));if(_0x33ad61[_0x265d('0xa3')]===-0x1){return _0x33ad61;}logger['info'](util[_0x265d('0x52')]('IFTIME\x20%s\x20%s',_0x5e561d[_0x14291a],_0x33ad61[_0x265d('0xa1')]));if(_0x33ad61[_0x265d('0xa1')]===_0x265d('0x13f')){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x148'),_0x5e561d[_0x14291a],_0x265d('0x13f')));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x148'),_0x5e561d[_0x14291a],'true'));return{'code':0xc8,'result':_0x265d('0x13f')};}else{logger[_0x265d('0x2f')](util['format'](_0x265d('0x148'),_0x5e561d[_0x14291a],_0x265d('0x141')));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x148'),_0x5e561d[_0x14291a],'false'));}}return{'code':0xc8,'result':_0x265d('0x141')};};AGIVertices[_0x265d('0x13')][_0x265d('0x149')]=function(_0x3e12b1){logger['info'](util[_0x265d('0x52')](_0x265d('0x14a'),_0x3e12b1['label']));return this[_0x265d('0x33')][_0x265d('0x149')]();};AGIVertices['prototype'][_0x265d('0x14b')]=function(_0x5c516a){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x14c'),_0x5c516a[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x5c516a[_0x265d('0x79')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xe5'));}var _0x8057bb=_0x265d('0x12c');var _0x3c22f8=util[_0x265d('0x52')]('%s/recordings/%s',FILES_PATH,rs[_0x265d('0x115')](0x4));var _0x2cb5f0=util[_0x265d('0x52')](_0x265d('0x9d'),_0x3c22f8,_0x8057bb);var _0x155579=!![];if(_0x5c516a[_0x265d('0x137')]==='NOBEEP'){_0x155579=![];}var _0x21469d=this[_0x265d('0x33')][_0x265d('0x12f')](_0x3c22f8,_0x8057bb,_0x5c516a[_0x265d('0x130')],_0x5c516a['timeout'],undefined,_0x155579);if(_0x21469d[_0x265d('0xa3')]!==-0x1){this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x14d'),_0x2cb5f0));var _0x3953fb=this['ispeechASR'][_0x265d('0x70')](this,_0x5c516a,_0x2cb5f0);if(_0x3953fb){for(var _0x3baa0c in _0x3953fb){if(_0x3953fb['hasOwnProperty'](_0x3baa0c)){this[_0x265d('0x33')][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0x14e'),_0x3baa0c['toUpperCase']()),_0x3953fb[_0x3baa0c]);}}return this['channel']['noop'](util[_0x265d('0x52')]('IspeechASR\x20Result\x20%s',JSON[_0x265d('0x73')](_0x3953fb)));}}return _0x21469d;};AGIVertices['prototype'][_0x265d('0x14f')]=function(_0x1e8f3a){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1e8f3a[_0x265d('0x34')]));if(!this['isConfigured'](_0x1e8f3a[_0x265d('0x79')])){return this['channel'][_0x265d('0xa9')]('no\x20key\x20configured');}if(!this[_0x265d('0xa5')](_0x1e8f3a['text'])){return this[_0x265d('0x33')]['noop'](_0x265d('0xc7'));}this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x150'),_0x1e8f3a['text']));var _0x187c8a=this['ispeechTTS'][_0x265d('0x70')](this,_0x1e8f3a);if(_0x187c8a){this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x14d'),_0x187c8a));var _0x9cf10b=this[_0x265d('0x33')]['streamFile'](_0x187c8a,_0x1e8f3a['intKey']);try{fs['unlink'](_0x187c8a+_0x265d('0xfd'));}catch(_0x3783d4){logger[_0x265d('0x2b')](_0x3783d4);}return _0x9cf10b;}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x1e8f3a,_0x265d('0x151'));};AGIVertices[_0x265d('0x13')][_0x265d('0x152')]=function(_0x5e3df9){logger[_0x265d('0x2f')](util['format'](_0x265d('0x153'),_0x5e3df9['label']));if(!this[_0x265d('0xa5')](_0x5e3df9['findBy'])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x5e3df9,'no\x20find\x20by\x20configured');}logger[_0x265d('0x2f')](util['format'](_0x265d('0x154'),this[_0x265d('0x33')][_0x265d('0x37')],_0x5e3df9[_0x265d('0x155')]));var _0x55ea85=this[_0x265d('0x50')][_0x265d('0x70')](this,_0x5e3df9[_0x265d('0x155')]);if(_0x55ea85){logger[_0x265d('0x2f')](util['format'](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x5e3df9[_0x265d('0x155')]));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x5e3df9[_0x265d('0x155')]));return{'code':0xc8,'result':_0x265d('0x157')};}else{logger['info'](util[_0x265d('0x52')](_0x265d('0x158'),this[_0x265d('0x33')][_0x265d('0x37')],_0x5e3df9['findBy']));this[_0x265d('0x33')][_0x265d('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x265d('0x33')][_0x265d('0x37')],_0x5e3df9[_0x265d('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x265d('0x159')]=function(_0x277856){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x277856['label']));if(!this[_0x265d('0xa5')](_0x277856[_0x265d('0x155')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x277856,_0x265d('0x15a'));}logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x154'),this['channel'][_0x265d('0x37')],_0x277856[_0x265d('0x155')]));var _0x2ac853=this['agentLogout'][_0x265d('0x70')](this,_0x277856[_0x265d('0x155')]);if(_0x2ac853){logger['info'](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x277856['findBy']));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')]['callerid'],_0x277856['findBy']));return{'code':0xc8,'result':_0x265d('0x157')};}else{logger[_0x265d('0x2f')](util[_0x265d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x265d('0x33')][_0x265d('0x37')],_0x277856[_0x265d('0x155')]));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x158'),this[_0x265d('0x33')][_0x265d('0x37')],_0x277856['findBy']));return{'code':0xc8,'result':_0x265d('0x15b')};}};AGIVertices[_0x265d('0x13')]['math']=function(_0x2a93b1){logger[_0x265d('0x2f')](util['format'](_0x265d('0x15c'),_0x2a93b1[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x2a93b1[_0x265d('0x15d')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x2a93b1,_0x265d('0x15e'));}this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x15f'),_0x2a93b1[_0x265d('0x15d')]));var _0x2ebe6e=eval(_0x2a93b1['operation']);if(!this['isConfigured'](_0x2a93b1[_0x265d('0xd3')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xd4'));}var _0x5790c2=this[_0x265d('0x11')][_0x265d('0x70')](this,_0x2a93b1[_0x265d('0xd3')]);if(!_0x5790c2){return this['channel'][_0x265d('0x2b')](_0x2a93b1,_0x265d('0xd5'));}if(_['isArray'](_0x2ebe6e)){var _0x11b60b=this;_0x2ebe6e[_0x265d('0xd6')](function(_0x3b2379,_0x2243b3){_0x11b60b[_0x265d('0x33')][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0x160'),_0x5790c2,_0x2243b3),_0x3b2379);});return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x161'),_0x5790c2));}else{return this[_0x265d('0x33')]['setVariable'](_0x5790c2,_0x2ebe6e);}};AGIVertices[_0x265d('0x13')][_0x265d('0x162')]=function(_0x59cf1a){logger['info'](util[_0x265d('0x52')](_0x265d('0x163'),_0x59cf1a[_0x265d('0x34')]));if(_0x59cf1a[_0x265d('0xa7')]===0x0){return this[_0x265d('0xa6')](_0x59cf1a);}_0x59cf1a[_0x265d('0xa7')]-=0x1;if(!this[_0x265d('0xa5')](_0x59cf1a[_0x265d('0x10c')])){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x59cf1a,'no\x20file\x20audio\x20selected');}var _0x51b91b=this['getSound']['sync'](this,_0x59cf1a['file_id']);if(!_0x51b91b){return this['channel'][_0x265d('0x2b')](_0x59cf1a,_0x265d('0x10e'));}var _0x35dd80=this['channel'][_0x265d('0x10f')](_0x51b91b,_0x59cf1a['response'],_0x59cf1a['digit']);var _0x3c2d22=_0x35dd80[_0x265d('0xa3')];if(_0x35dd80['result']===-0x1){this[_0x265d('0x32')]['sync'](this,_0x59cf1a,'-1');return _0x35dd80;}else if(_0x35dd80[_0x265d('0xa1')]==='timeout'){_0x35dd80[_0x265d('0xa3')]=_0x35dd80[_0x265d('0xa3')][_0x265d('0x9b')]>0x0?_0x35dd80['result']:'t';}else if(_['isEmpty'](_0x35dd80[_0x265d('0xa3')])){_0x35dd80['result']='#';_0x3c2d22='#';}if(!this[_0x265d('0xa5')](_0x59cf1a['variable_id'])){this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xd4'));}else{var _0x4755f8=this['getVariable'][_0x265d('0x70')](this,_0x59cf1a[_0x265d('0xd3')]);if(!_0x4755f8){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x59cf1a,_0x265d('0xd5'));}this[_0x265d('0x33')][_0x265d('0x9e')](_0x4755f8,_0x3c2d22);}this['createSquareDetailsReport'][_0x265d('0x70')](this,_0x59cf1a,_0x3c2d22);return _0x35dd80;};AGIVertices[_0x265d('0x13')][_0x265d('0xa9')]=function(_0x47b9f9){logger[_0x265d('0x2f')](util['format'](_0x265d('0x164'),_0x47b9f9['label']));return this[_0x265d('0x33')][_0x265d('0xa9')](_0x47b9f9[_0x265d('0x165')]||_0x47b9f9[_0x265d('0x34')]);};AGIVertices['prototype'][_0x265d('0x166')]=function(_0x4c98c1){logger[_0x265d('0x2f')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4c98c1[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x4c98c1['findBy'])){return this['channel']['error'](_0x4c98c1,'no\x20find\x20by\x20configured');}logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x154'),this[_0x265d('0x33')][_0x265d('0x37')],_0x4c98c1[_0x265d('0x155')]));var _0x5719a6=this[_0x265d('0x167')][_0x265d('0x70')](this,_0x4c98c1['pause_id']);var _0x418f04=this['agentPause']['sync'](this,_0x4c98c1[_0x265d('0x155')],_0x5719a6);if(_0x418f04){logger['info'](util[_0x265d('0x52')](_0x265d('0x156'),this['channel'][_0x265d('0x37')],_0x4c98c1['findBy']));this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x4c98c1['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x158'),this[_0x265d('0x33')][_0x265d('0x37')],_0x4c98c1[_0x265d('0x155')]));this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x4c98c1[_0x265d('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x265d('0x13')][_0x265d('0x168')]=function(_0x26d512){logger[_0x265d('0x2f')](util['format'](_0x265d('0x169'),_0x26d512['label']));if(!this[_0x265d('0xa5')](_0x26d512[_0x265d('0x10c')])){return this['channel'][_0x265d('0x2b')](_0x26d512,_0x265d('0x10d'));}var _0x5e83ab=this[_0x265d('0x20')][_0x265d('0x70')](this,_0x26d512[_0x265d('0x10c')]);if(!_0x5e83ab){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x26d512,_0x265d('0x10e'));}var _0x2fafe0=this[_0x265d('0x33')]['exec'](_0x265d('0x16a'),[_0x5e83ab,_0x26d512[_0x265d('0xe0')]]);if(_0x2fafe0[_0x265d('0xa3')]===-0x1){return _0x2fafe0;}return this['channel']['noop'](util[_0x265d('0x52')](_0x265d('0xc4'),_0x265d('0x16a'),_0x5e83ab));};AGIVertices[_0x265d('0x13')][_0x265d('0x16b')]=function(_0x371ff2){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x16c'),_0x371ff2['label']));if(!this[_0x265d('0xa5')](_0x371ff2[_0x265d('0x16d')])){return this[_0x265d('0x33')]['error'](_0x371ff2,_0x265d('0x16e'));}var _0x92abf5='';var _0x4b1769=parseInt(_0x371ff2['queue_id'],0xa);if(isNaN(_0x4b1769)){_0x92abf5=_0x371ff2[_0x265d('0x16d')];}else{_0x92abf5=this[_0x265d('0x14')]['sync'](this,_0x371ff2[_0x265d('0x16d')]);if(!_0x92abf5){return this['channel']['error'](_0x371ff2,_0x265d('0x16f'));}}var _0x25f91d='';if(this[_0x265d('0xa5')](_0x371ff2['file_id'])){var _0x290cba=this[_0x265d('0x20')][_0x265d('0x70')](this,_0x371ff2[_0x265d('0x10c')]);if(_0x290cba){_0x25f91d=_0x290cba;}}this[_0x265d('0x32')][_0x265d('0x70')](this,_0x371ff2,_0x92abf5);if(_0x371ff2[_0x265d('0xe0')][_0x265d('0x170')]('x')<0x0){_0x371ff2['opts']+='x';}if(_0x371ff2[_0x265d('0xe0')][_0x265d('0x170')]('X')<0x0){_0x371ff2[_0x265d('0xe0')]+='X';}this[_0x265d('0x33')][_0x265d('0x9e')](_0x265d('0x171'),_0x92abf5?_0x92abf5[_0x265d('0x172')]():'');var _0x379572=this['channel']['exec']('QUEUE',[_0x92abf5,_0x371ff2[_0x265d('0xe0')],_0x371ff2[_0x265d('0x63')],_0x25f91d,_0x371ff2[_0x265d('0x65')],_0x371ff2[_0x265d('0x7')],_0x371ff2['macro'],_0x371ff2['gosub'],'',_0x371ff2[_0x265d('0x173')]]);if(_0x379572[_0x265d('0xa3')]===-0x1){return _0x379572;}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0xc4'),'QUEUE',_0x92abf5));};AGIVertices[_0x265d('0x13')][_0x265d('0x174')]=function(_0xf4b65b){logger['info'](util[_0x265d('0x52')](_0x265d('0x175'),_0xf4b65b[_0x265d('0x34')]));var _0x1d94f5=_0xf4b65b[_0x265d('0x176')]||_0x265d('0x12c');var _0x3c47b8=util[_0x265d('0x52')](_0x265d('0x177'),this[_0x265d('0x33')][_0x265d('0x38')],rs[_0x265d('0x115')](0x5));var _0x191168=util[_0x265d('0x52')]('%s/recordings/%s.%s',FILES_PATH,_0x3c47b8,_0x1d94f5);var _0x21b4b3=util[_0x265d('0x52')]('%s/recordings/%s',FILES_PATH,_0x3c47b8);this['createSquareRecording'][_0x265d('0x70')](this,_0xf4b65b,_0x3c47b8,_0x191168);this[_0x265d('0x33')]['setVariable'](_0x265d('0x178'),_0x3c47b8);logger[_0x265d('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x21b4b3,_0x1d94f5,_0xf4b65b[_0x265d('0x179')],_0xf4b65b[_0x265d('0x65')]);return this[_0x265d('0x33')][_0x265d('0x12f')](_0x21b4b3,_0x1d94f5,_0xf4b65b[_0x265d('0x179')],_0xf4b65b[_0x265d('0x65')],undefined,!![]);};AGIVertices[_0x265d('0x13')]['restapi']=function(_0x4a79d2){logger['info'](util['format'](_0x265d('0x17a'),_0x4a79d2[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x4a79d2['url'])){return this['channel']['noop'](_0x265d('0x17b'));}var _0x5b3cad=this['restAPI'][_0x265d('0x70')](this,_0x4a79d2);logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x17c'),util[_0x265d('0x17d')](_0x5b3cad,{'showHidden':![],'depth':null})));if(!this[_0x265d('0xa5')](_0x4a79d2[_0x265d('0xd3')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x17e'));}var _0x443e13=this[_0x265d('0x11')][_0x265d('0x70')](this,_0x4a79d2[_0x265d('0xd3')]);if(!_0x443e13){return this['channel'][_0x265d('0x2b')](_0x4a79d2,_0x265d('0xd5'));}this[_0x265d('0x33')][_0x265d('0x9e')](util[_0x265d('0x52')](_0x265d('0x17f'),_0x443e13),_0x5b3cad[_0x265d('0x74')]?_0x5b3cad[_0x265d('0x74')]:'200');this[_0x265d('0x33')][_0x265d('0x9e')](util[_0x265d('0x52')]('%s_STATUS_MESSAGE',_0x443e13),_0x5b3cad['statusMessage']?_0x5b3cad['statusMessage']:'OK');if(_0x5b3cad[_0x265d('0x6a')]){try{this['saveRestApiResult'](_0x5b3cad[_0x265d('0x6a')],_0x443e13);}catch(_0x3f4c31){logger[_0x265d('0x2b')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x443e13));}}return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x180'),_0x443e13));};AGIVertices[_0x265d('0x13')][_0x265d('0x181')]=function(_0x568fc1){logger['info'](util['format'](_0x265d('0x182'),_0x568fc1[_0x265d('0x34')]));return this[_0x265d('0x33')]['sayDigits'](_0x568fc1[_0x265d('0x183')]['replace'](/\s+/g,''),_0x568fc1['escape_digits']);};AGIVertices[_0x265d('0x13')][_0x265d('0x184')]=function(_0x1d4c22){logger['info'](util[_0x265d('0x52')](_0x265d('0x185'),_0x1d4c22[_0x265d('0x34')]));return this[_0x265d('0x33')]['sayNumber'](_0x1d4c22[_0x265d('0x66')][_0x265d('0x57')](/\s+/g,''),_0x1d4c22[_0x265d('0x179')]);};AGIVertices[_0x265d('0x13')][_0x265d('0x186')]=function(_0x7d88de){logger[_0x265d('0x2f')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x7d88de[_0x265d('0x34')]));return this[_0x265d('0x33')][_0x265d('0x187')](_0x7d88de[_0x265d('0x5b')],_0x7d88de[_0x265d('0x179')]);};AGIVertices['prototype'][_0x265d('0x188')]=function(_0x5bdd81){logger[_0x265d('0x2f')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5bdd81[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x5bdd81[_0x265d('0x189')])){return this[_0x265d('0x33')][_0x265d('0xa9')]('no\x20mail\x20account\x20configured');}var _0x2d1f86=this[_0x265d('0x23')][_0x265d('0x70')](this,_0x5bdd81[_0x265d('0x189')]);if(!_0x2d1f86||!_0x2d1f86[_0x265d('0x18a')]){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x5bdd81,_0x265d('0x18b'));}var _0x36aefe={'from':util['format'](_0x265d('0x18c'),_0x2d1f86[_0x265d('0x17')],_0x2d1f86[_0x265d('0x18d')]||_0x2d1f86[_0x265d('0x18a')][_0x265d('0x18e')]),'to':_0x5bdd81['to']||'','cc':_0x5bdd81['cc']||'','bcc':_0x5bdd81[_0x265d('0x18f')]||'','subject':_0x5bdd81[_0x265d('0x190')],'html':_0x5bdd81['text'],'text':_0x5bdd81['text']};if(this[_0x265d('0xa5')](_0x5bdd81[_0x265d('0x191')])){}logger['debug'](_0x265d('0x192'),JSON[_0x265d('0x73')](_0x36aefe));this[_0x265d('0x32')][_0x265d('0x70')](this,_0x5bdd81,_0x5bdd81[_0x265d('0x189')]);this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0x193'),_0x2d1f86[_0x265d('0x17')]));this['sendMailMessage']['sync'](this,_0x2d1f86[_0x265d('0x194')],_0x36aefe);return this['channel'][_0x265d('0xa9')](_0x265d('0x195'));};AGIVertices[_0x265d('0x13')]['sendFax']=function(_0x1a0c74){logger[_0x265d('0x2f')](util['format'](_0x265d('0x196'),_0x1a0c74[_0x265d('0x34')]));return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x197'));};AGIVertices[_0x265d('0x13')][_0x265d('0x198')]=function(_0x3c5c46){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3c5c46[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x3c5c46[_0x265d('0x199')])){return this['channel'][_0x265d('0xa9')]('no\x20sms\x20account\x20configured');}var _0x527b9f=this[_0x265d('0x31')][_0x265d('0x70')](this,_0x3c5c46[_0x265d('0x199')]);if(!_0x527b9f){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x3c5c46,_0x265d('0x19a'));}var _0x324526={'body':_0x3c5c46[_0x265d('0x19b')],'phone':_0x3c5c46['to']||'','SmsAccountId':_0x527b9f['id']};logger[_0x265d('0xdb')](_0x265d('0x19c'),JSON[_0x265d('0x73')](_0x324526));this['createSquareDetailsReport'][_0x265d('0x70')](this,_0x3c5c46,_0x3c5c46[_0x265d('0x199')]);this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0x19d'),_0x527b9f['name']));this['createSmsMessage']['sync'](this,_0x324526);return this[_0x265d('0x33')]['noop'](_0x265d('0x19e'));};AGIVertices[_0x265d('0x13')][_0x265d('0x19f')]=function(_0x51bfcf){logger['info'](util[_0x265d('0x52')](_0x265d('0x1a0'),_0x51bfcf[_0x265d('0x34')]));if(!this['isConfigured'](_0x51bfcf[_0x265d('0xd3')])){return this[_0x265d('0x33')]['error'](_0x51bfcf,_0x265d('0x1a1'));}var _0xaf1998=this['getVariable']['sync'](this,_0x51bfcf[_0x265d('0xd3')]);if(!_0xaf1998){return this[_0x265d('0x33')]['error'](_0x51bfcf,_0x265d('0xd5'));}return this[_0x265d('0x33')][_0x265d('0x9e')](_0xaf1998,_0x51bfcf[_0x265d('0x1a2')]);};AGIVertices[_0x265d('0x13')][_0x265d('0x1a3')]=function(_0xc239e6){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20START\x20(%s)\x20block',_0xc239e6['label']));this['channel']['noop'](_0x265d('0x1a4'));if(_0xc239e6[_0x265d('0xba')]===_0x265d('0x1a5')){this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x1a6'));return this[_0x265d('0x33')][_0x265d('0xba')]();}return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x1a7'));};AGIVertices[_0x265d('0x13')]['subproject']=function(_0x3546b7){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3546b7[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x3546b7[_0x265d('0x1a8')])){return this[_0x265d('0x33')]['error'](_0x3546b7,_0x265d('0x1a9'));}var _0x2dae99=this[_0x265d('0x19')][_0x265d('0x70')](this,_0x3546b7[_0x265d('0x1a8')]);if(!this['isConfigured'](_0x2dae99)){return this['channel']['error'](_0x3546b7,util[_0x265d('0x52')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3546b7[_0x265d('0x1a8')]));}if(_0x2dae99===this[_0x265d('0x33')][_0x265d('0x36')]){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x3546b7,_0x265d('0x1aa'));}this[_0x265d('0x32')][_0x265d('0x70')](this,_0x3546b7,_0x2dae99);var _0x291982=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0x1ab'),util['format'](_0x265d('0x1ac'),config[_0x265d('0x7')][_0x265d('0x1ad')]||_0x265d('0x1ae'),_0x2dae99,this['channel'][_0x265d('0x36')]));if(_0x291982[_0x265d('0xa3')]===-0x1){return _0x291982;}return this['channel'][_0x265d('0xa9')](util[_0x265d('0x52')]('Executed\x20command\x20%s\x20%s','AGI',_0x2dae99));};AGIVertices[_0x265d('0x13')][_0x265d('0x1af')]=function(_0x56ead8){logger['info'](util[_0x265d('0x52')](_0x265d('0x1b0'),_0x56ead8[_0x265d('0x34')]));var _0x2904bd=this[_0x265d('0x1b1')][_0x265d('0x70')](this,_0x56ead8[_0x265d('0xb8')]);this[_0x265d('0x32')][_0x265d('0x70')](this,_0x56ead8,_0x56ead8[_0x265d('0xb8')]);if(this[_0x265d('0xa5')](_0x56ead8[_0x265d('0xd3')])){var _0x316d88=this[_0x265d('0x11')][_0x265d('0x70')](this,_0x56ead8[_0x265d('0xd3')]);if(_0x316d88){this[_0x265d('0x33')][_0x265d('0x9e')](_0x316d88,_0x2904bd);return this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x1b2'),_0x56ead8['command'],_0x316d88));}}return this['channel'][_0x265d('0xa9')](util['format'](_0x265d('0x1b3'),_0x56ead8[_0x265d('0xb8')]));};AGIVertices[_0x265d('0x13')][_0x265d('0x1b4')]=function(_0x1d293e){logger[_0x265d('0x2f')](util[_0x265d('0x52')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d293e[_0x265d('0x34')]));_0x1d293e['text']=_0x1d293e[_0x265d('0x5b')][_0x265d('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x265d('0xa5')](_0x1d293e[_0x265d('0x59')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0x1b5'));}if(!this[_0x265d('0xa5')](_0x1d293e[_0x265d('0x5b')])){return this[_0x265d('0x33')][_0x265d('0xa9')](_0x265d('0xc7'));}this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1d293e[_0x265d('0x5b')]));var _0x4b5088=this[_0x265d('0x58')][_0x265d('0x70')](this,_0x1d293e);if(_0x4b5088){this['channel'][_0x265d('0xa9')](util['format'](_0x265d('0x1b6'),_0x4b5088));var _0x54ef3d=this['channel']['streamFile'](_0x4b5088);try{fs['unlink'](_0x4b5088+_0x265d('0xfd'));}catch(_0x257954){logger[_0x265d('0x2b')](_0x257954);}return _0x54ef3d;}return this[_0x265d('0x33')][_0x265d('0x2b')](_0x1d293e,_0x265d('0x1b7'));};AGIVertices[_0x265d('0x13')][_0x265d('0x1b8')]=function(_0x555fd4){logger['info'](util[_0x265d('0x52')](_0x265d('0x1b9'),_0x555fd4[_0x265d('0x34')]));_0x555fd4[_0x265d('0x5b')]=_0x555fd4[_0x265d('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x265d('0xa5')](_0x555fd4[_0x265d('0x5b')])){return this['channel'][_0x265d('0xa9')]('no\x20text\x20configured');}this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')]('Trying\x20Google\x20TTS\x20%s',_0x555fd4[_0x265d('0x5b')]));var _0x1bbb71=this['googleTTS'][_0x265d('0x70')](this,_0x555fd4);if(_0x1bbb71){this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')]('Google\x20TTS\x20%s\x20file\x20created',_0x1bbb71));var _0x200679=this[_0x265d('0x33')][_0x265d('0xfb')](_0x1bbb71);try{fs[_0x265d('0xfc')](_0x1bbb71+_0x265d('0xfd'));}catch(_0x2cebe1){logger[_0x265d('0x2b')](_0x2cebe1);}return _0x200679;}return this[_0x265d('0x33')]['error'](_0x555fd4,_0x265d('0x1ba'));};AGIVertices[_0x265d('0x13')][_0x265d('0x1bb')]=function(_0x4572c6){logger[_0x265d('0x2f')](util['format'](_0x265d('0x1bc'),_0x4572c6[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x4572c6[_0x265d('0x155')])){return this[_0x265d('0x33')]['error'](_0x4572c6,_0x265d('0x15a'));}logger[_0x265d('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x265d('0x33')]['callerid'],_0x4572c6['findBy']));var _0x1fc70e=this['agentUnpause'][_0x265d('0x70')](this,_0x4572c6[_0x265d('0x155')]);if(_0x1fc70e){logger[_0x265d('0x2f')](util[_0x265d('0x52')](_0x265d('0x156'),this[_0x265d('0x33')][_0x265d('0x37')],_0x4572c6[_0x265d('0x155')]));this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x265d('0x33')][_0x265d('0x37')],_0x4572c6[_0x265d('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x265d('0x2f')](util[_0x265d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x265d('0x33')][_0x265d('0x37')],_0x4572c6['findBy']));this[_0x265d('0x33')][_0x265d('0xa9')](util[_0x265d('0x52')](_0x265d('0x158'),this[_0x265d('0x33')]['callerid'],_0x4572c6[_0x265d('0x155')]));return{'code':0xc8,'result':_0x265d('0x15b')};}};AGIVertices[_0x265d('0x13')][_0x265d('0x1bd')]=function(_0x57b70e){logger[_0x265d('0x2f')](util['format'](_0x265d('0x1be'),_0x57b70e[_0x265d('0x34')]));var _0x2af6ad=this[_0x265d('0x33')][_0x265d('0x55')](_0x265d('0x1bf'),[_0x57b70e[_0x265d('0x1c0')],_0x57b70e[_0x265d('0x77')]]);if(_0x2af6ad[_0x265d('0xa3')]===-0x1){return _0x2af6ad;}return this[_0x265d('0x33')]['noop'](util[_0x265d('0x52')](_0x265d('0xc4'),'VOICEMAIL',_0x57b70e[_0x265d('0x1c0')]));};AGIVertices[_0x265d('0x13')]['vswitch']=function(_0x4723eb){logger[_0x265d('0x2f')](util['format'](_0x265d('0x1c1'),_0x4723eb[_0x265d('0x34')]));if(!this[_0x265d('0xa5')](_0x4723eb[_0x265d('0xd3')])){return this['channel'][_0x265d('0x2b')](_0x4723eb,'no\x20variable\x20selected');}var _0x4e4115=this[_0x265d('0x11')][_0x265d('0x70')](this,_0x4723eb[_0x265d('0xd3')]);if(!_0x4e4115){return this[_0x265d('0x33')][_0x265d('0x2b')](_0x4723eb,_0x265d('0xd5'));}var _0x466930=this[_0x265d('0x33')][_0x265d('0x11')](_0x4e4115);return{'code':0xc8,'result':_0x466930[_0x265d('0xa1')]?_0x466930[_0x265d('0xa1')]:'-'};};String['prototype'][_0x265d('0xa0')]=function(_0x5afdd4,_0x1d506a){return this[_0x265d('0x9f')](_0x5afdd4)[_0x265d('0x1c2')](_0x1d506a);};module['exports']=AGIVertices; \ No newline at end of file +var _0xee4f=['goalname','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','no\x20condition\x20configured','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','macro','QUEUE','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','debug','sendMail\x20message','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','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','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','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','util','odbc','randomstring','moment','request-promise','agi','./scripts','rawBody','menu','getdigits','channel','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','google_tts_language','restAPI','timeout','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','isString','saveRestApiResult','%s.%s','isArray','setVariable','split','extra','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','MRCPRecog','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','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','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block'];(function(_0x48c054,_0x234f60){var _0x132327=function(_0x10e7aa){while(--_0x10e7aa){_0x48c054['push'](_0x48c054['shift']());}};_0x132327(++_0x234f60);}(_0xee4f,0xad));var _0xfee4=function(_0x2e8322,_0x452d17){_0x2e8322=_0x2e8322-0x0;var _0x12779d=_0xee4f[_0x2e8322];return _0x12779d;};'use strict';var fs=require('fs');var util=require(_0xfee4('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xfee4('0x1'))();var rs=require(_0xfee4('0x2'));var moment=require(_0xfee4('0x3'));var Mustache=require('mustache');var rp=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0xfee4('0x6'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xfee4('0x7')];var verticesWithRetry=[_0xfee4('0x8'),_0xfee4('0x9'),'getsecretdigits'];var AGIVertices=function(_0x52fc6e,_0x3e3e3a,_0x11556d){this[_0xfee4('0xa')]=_0x52fc6e;this['rpc']=_0x3e3e3a;this['mailRpc']=_0x11556d;};AGIVertices[_0xfee4('0xb')][_0xfee4('0xc')]=function(_0xa2caa8,_0x4d9574){this[_0xfee4('0xd')][_0xfee4('0xe')](_0xa2caa8)[_0xfee4('0xf')](function(_0x166004){_0x4d9574(null,_0x166004?_0x166004[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0x297cee){_0x4d9574(_0x297cee);});};AGIVertices['prototype'][_0xfee4('0x12')]=function(_0x46926d,_0x4f0b6c){this[_0xfee4('0xd')][_0xfee4('0x13')](_0x46926d)[_0xfee4('0xf')](function(_0x26a75b){_0x4f0b6c(null,_0x26a75b?_0x26a75b[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0x24868c){_0x4f0b6c(_0x24868c);});};AGIVertices['prototype'][_0xfee4('0x14')]=function(_0x251403,_0x437979){this['rpc'][_0xfee4('0x15')](_0x251403)['then'](function(_0x54a606){_0x437979(null,_0x54a606?_0x54a606[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0x27b531){_0x437979(_0x27b531);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x16')]=function(_0xe7b74d,_0x9555c){this[_0xfee4('0xd')][_0xfee4('0x17')](_0xe7b74d)['then'](function(_0x194cd8){_0x9555c(null,_0x194cd8?_0x194cd8[_0xfee4('0x18')]:![]);})[_0xfee4('0x11')](function(_0x3c6c96){_0x9555c(_0x3c6c96);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x19')]=function(_0x57012c,_0x33154b){this[_0xfee4('0xd')][_0xfee4('0x1a')](_0x57012c)[_0xfee4('0xf')](function(_0x347990){_0x33154b(null,_0x347990?_0x347990[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0x4fa425){_0x33154b(_0x4fa425);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1b')]=function(_0x4eb11b,_0x58f9a7){this['rpc']['getTrunkById'](_0x4eb11b)['then'](function(_0xf2651f){_0x58f9a7(null,_0xf2651f?_0xf2651f[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0x256cff){_0x58f9a7(_0x256cff);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1c')]=function(_0x2f73f3,_0xa5eaa8){var _0x4c7375=this;this[_0xfee4('0xd')]['getSoundById'](_0x2f73f3)['then'](function(_0x428a90){_0xa5eaa8(null,_0x428a90?_0x4c7375[_0xfee4('0x1d')](_0x428a90['save_name']):![]);})['catch'](function(_0x2f0878){_0xa5eaa8(_0x2f0878);});};AGIVertices['prototype']['getMailAccount']=function(_0x99a519,_0x14d16b){this['rpc'][_0xfee4('0x1e')](_0x99a519)['then'](function(_0x273ffb){_0x14d16b(null,_0x273ffb?_0x273ffb:![]);})[_0xfee4('0x11')](function(_0x36d31f){_0x14d16b(_0x36d31f);});};AGIVertices['prototype'][_0xfee4('0x1f')]=function(_0x1701e1,_0x2d2312,_0x347f73){this['mailRpc'][_0xfee4('0x1f')](_0x1701e1,_0x2d2312)['then'](function(){_0x347f73(null);})[_0xfee4('0x11')](function(_0x2e5f21){_0x347f73(_0x2e5f21);});};AGIVertices['prototype'][_0xfee4('0x20')]=function(_0x9c0119,_0x524297){this[_0xfee4('0xd')]['getIntervalById'](_0x9c0119)[_0xfee4('0xf')](function(_0x2ad74d){if(_0x2ad74d){if(_0x2ad74d[_0xfee4('0x21')]){_0x524297(null,[_0x2ad74d[_0xfee4('0x22')]]);}else{_0x524297(null,_[_0xfee4('0x23')](_0x2ad74d[_0xfee4('0x24')],'interval'));}}else{_0x524297(null,![]);}})[_0xfee4('0x11')](function(_0x5efde5){_0x524297(_0x5efde5);});};AGIVertices[_0xfee4('0xb')]['getSoundPath']=function(_0x26f622){return util[_0xfee4('0x25')](_0xfee4('0x26'),FILES_PATH,_0x26f622);};AGIVertices[_0xfee4('0xb')][_0xfee4('0x27')]=function(_0x2ed185,_0x506dfb,_0x22a0ce){odbc[_0xfee4('0x28')](_0x2ed185,function(_0x2e1219){if(_0x2e1219){logger[_0xfee4('0x29')](_0xfee4('0x2a'),_0x2e1219);_0x22a0ce(_0x2e1219);}else{logger[_0xfee4('0x2b')](_0xfee4('0x2c'));odbc['query'](_0x506dfb,function(_0x3a2d1a,_0x2c452f){if(_0x3a2d1a){logger[_0xfee4('0x2b')]('Error\x20executing\x20query\x20%s',_0x506dfb);_0x22a0ce(_0x3a2d1a);}else{logger['info'](_0xfee4('0x2d'),_0x506dfb);odbc[_0xfee4('0x2e')](function(_0x11ca45){if(_0x11ca45){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x11ca45);}_0x22a0ce(null,_0x2c452f);});}});}});};AGIVertices['prototype'][_0xfee4('0x2f')]=function(_0x1609a1,_0xcbede8){this[_0xfee4('0xd')]['getSmsAccountById'](_0x1609a1)['then'](function(_0x6822f4){_0xcbede8(null,_0x6822f4?_0x6822f4:![]);})[_0xfee4('0x11')](function(_0x2d6eb4){_0xcbede8(_0x2d6eb4);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x30')]=function(_0x2e38a6,_0x28771b){this[_0xfee4('0xd')][_0xfee4('0x30')](_0x2e38a6)[_0xfee4('0xf')](function(_0x49c343){_0x28771b(null,_0x49c343);})[_0xfee4('0x11')](function(_0x1005ed){_0x28771b(_0x1005ed);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x31')]=function(_0x2ebcf3,_0xc5548b,_0x39a9c4){this[_0xfee4('0xd')][_0xfee4('0x31')]({'uniqueid':this[_0xfee4('0xa')][_0xfee4('0x32')],'node':_0x2ebcf3[_0xfee4('0x33')],'application':_0x2ebcf3[_0xfee4('0x34')],'data':_0xc5548b||null,'project_name':this['channel'][_0xfee4('0x35')],'callerid':this[_0xfee4('0xa')][_0xfee4('0x36')]})[_0xfee4('0xf')](function(_0x32f204){if(_0x39a9c4){_0x39a9c4(null,_0x32f204);}})[_0xfee4('0x11')](function(_0x1c664e){if(_0x39a9c4){_0x39a9c4(_0x1c664e);}});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x37')]=function(_0x4b9093,_0x29af02,_0x2ea8b9,_0x5a3953){this[_0xfee4('0xd')][_0xfee4('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xfee4('0xa')]['callerid'],'calleridname':this[_0xfee4('0xa')][_0xfee4('0x38')],'context':this[_0xfee4('0xa')][_0xfee4('0x39')],'extension':this[_0xfee4('0xa')][_0xfee4('0x3a')],'priority':this[_0xfee4('0xa')]['priority'],'accountcode':this[_0xfee4('0xa')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0xfee4('0xa')][_0xfee4('0x35')],'saveName':_0x29af02,'filename':_0x4b9093[_0xfee4('0x3b')]||_0x29af02,'savePath':_0x2ea8b9})['then'](function(_0x3d4665){_0x5a3953(null,_0x3d4665);})[_0xfee4('0x11')](function(_0x215110){_0x5a3953(_0x215110);});};AGIVertices['prototype'][_0xfee4('0x3c')]=function(_0x52289c,_0x27a4ad,_0x2b85b7,_0x379f96,_0x3f50e7){this['rpc'][_0xfee4('0x3c')]({'uniqueid':this[_0xfee4('0xa')]['uniqueid'],'body':_0x52289c,'direction':_0x27a4ad,'providerName':_0x2b85b7,'providerResponse':_0x379f96})[_0xfee4('0xf')](function(_0x309a9c){if(_0x3f50e7){_0x3f50e7(null,_0x309a9c);}})['catch'](function(_0x163223){if(_0x3f50e7){_0x3f50e7(_0x163223);}});};AGIVertices['prototype'][_0xfee4('0x3d')]=function(_0x584991,_0x2193b7){this[_0xfee4('0xd')]['createCmContact']({'firstName':_[_0xfee4('0x3e')](_0x584991[_0xfee4('0x10')])||_[_0xfee4('0x3f')](_0x584991['name'])?_0xfee4('0x40')+Math['random']():_0x584991[_0xfee4('0x10')],'lastName':_[_0xfee4('0x3e')](_0x584991[_0xfee4('0x41')])||_['isNil'](_0x584991[_0xfee4('0x41')])?null:_0x584991[_0xfee4('0x41')],'phone':_0x584991[_0xfee4('0x42')],'ListId':_0x584991['list_id'],'scheduledat':_0x584991[_0xfee4('0x43')],'callbackUniqueid':this[_0xfee4('0xa')][_0xfee4('0x32')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x584991[_0xfee4('0x43')][_0xfee4('0x44')](),'priority':_0x584991[_0xfee4('0x45')]})[_0xfee4('0xf')](function(_0x5d51d4){_0x2193b7(null,_0x5d51d4);})[_0xfee4('0x11')](function(_0x15b2f9){_0x2193b7(_0x15b2f9);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x46')]=function(_0x4cff23,_0x887e43){this[_0xfee4('0xd')][_0xfee4('0x47')](_0x4cff23)[_0xfee4('0xf')](function(_0x49399e){_0x887e43(null,_0x49399e?_0x49399e[_0xfee4('0x10')]:![]);})[_0xfee4('0x11')](function(_0xe7b3a1){_0x887e43(_0xe7b3a1);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x48')]=function(_0x35a75b,_0x3c237a,_0x289a76){var _0x2c2be6={'role':'agent'};_0x2c2be6[_0x35a75b]=this[_0xfee4('0xa')]['callerid'];this['rpc'][_0xfee4('0x48')](_0x2c2be6,_0x3c237a,this[_0xfee4('0xa')][_0xfee4('0x32')])[_0xfee4('0xf')](function(_0x680cd6){_0x289a76(null,_['isNil'](_0x680cd6)?![]:!![]);})[_0xfee4('0x11')](function(_0x5b43fe){logger[_0xfee4('0x29')](_0x5b43fe);_0x289a76(null,![]);});};AGIVertices['prototype'][_0xfee4('0x49')]=function(_0x823083,_0x394bc6){var _0x42de26={'role':_0xfee4('0x4a')};_0x42de26[_0x823083]=this[_0xfee4('0xa')][_0xfee4('0x36')];this[_0xfee4('0xd')][_0xfee4('0x49')](_0x42de26)[_0xfee4('0xf')](function(_0x3c6374){_0x394bc6(null,_[_0xfee4('0x3f')](_0x3c6374)?![]:!![]);})['catch'](function(_0x2e5a3c){logger['error'](_0x2e5a3c);_0x394bc6(null,![]);});};AGIVertices[_0xfee4('0xb')]['agentLogout']=function(_0x2b4226,_0x301089){var _0x5840c5={'role':_0xfee4('0x4a')};_0x5840c5[_0x2b4226]=this[_0xfee4('0xa')][_0xfee4('0x36')];this[_0xfee4('0xd')][_0xfee4('0x4b')](_0x5840c5)[_0xfee4('0xf')](function(_0x6d719d){_0x301089(null,_[_0xfee4('0x3f')](_0x6d719d)?![]:!![]);})[_0xfee4('0x11')](function(_0x5980bb){logger['error'](_0x5980bb);_0x301089(null,![]);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x4c')]=function(_0x1334ad,_0x49fee3){var _0xb5ffe2={'role':_0xfee4('0x4a')};_0xb5ffe2[_0x1334ad]=this[_0xfee4('0xa')][_0xfee4('0x36')];var _0x2f127a=_0x1334ad!='internal'?util[_0xfee4('0x25')]('%s/%s@from-sip/n','LOCAL',this['channel'][_0xfee4('0x36')]):undefined;this['rpc'][_0xfee4('0x4c')](_0xb5ffe2,_0x2f127a)[_0xfee4('0xf')](function(_0x35c791){_0x49fee3(null,_[_0xfee4('0x3f')](_0x35c791)?![]:!![]);})[_0xfee4('0x11')](function(_0x32acea){logger[_0xfee4('0x29')](_0x32acea);_0x49fee3(null,![]);});};AGIVertices['prototype'][_0xfee4('0x4d')]=function(_0x462553,_0x39cabf){sh[_0xfee4('0x4e')](_['trim'](_0x462553),function(_0x2a4563,_0x1c59ab){var _0x389fd3=_0x1c59ab[_0xfee4('0x4f')](/(\r\n|\n|\r)/gm,'');_0x39cabf(null,_0x389fd3);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x50')]=function(_0x491760,_0x17559a){scripts[_0xfee4('0x50')](_0x491760[_0xfee4('0x51')],_0x491760[_0xfee4('0x52')]||_0xfee4('0x53'),_0x491760['text'],_0x491760[_0xfee4('0x54')]||_0xfee4('0x55'),_0x491760[_0xfee4('0x56')]||_0xfee4('0x57'),_0x491760[_0xfee4('0x58')]||'MP3')[_0xfee4('0xf')](function(_0x142ab4){_0x17559a(null,_0x142ab4);})[_0xfee4('0x11')](function(_0xdf46bf){_0x17559a(_0xdf46bf);});};AGIVertices['prototype']['googleTTS']=function(_0x53048a,_0x442995){scripts['googleTTS'](_0x53048a[_0xfee4('0x53')],_0x53048a[_0xfee4('0x59')]||'en',0x1)[_0xfee4('0xf')](function(_0x544086){_0x442995(null,_0x544086);})[_0xfee4('0x11')](function(_0x46d367){_0x442995(_0x46d367);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x5a')]=function(_0x44a43e,_0x57b90e){var _0x530a48={'uri':_0x44a43e['url'],'method':_0x44a43e['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x44a43e[_0xfee4('0x5b')])==='number'&&parseInt(_0x44a43e[_0xfee4('0x5b')])>=0x1?parseInt(_0x44a43e['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xfee4('0x5c'),_0xfee4('0x5d')],_0x530a48[_0xfee4('0x5e')][_0xfee4('0x5f')]())){try{_0x530a48[_0xfee4('0x60')]=_0x44a43e[_0xfee4('0x7')]?JSON['parse'](_0x44a43e[_0xfee4('0x7')]):{};}catch(_0x124649){logger[_0xfee4('0x29')](_0xfee4('0x61'),_0x124649);}}try{_0x530a48[_0xfee4('0x62')]=_0x44a43e[_0xfee4('0x63')]?JSON[_0xfee4('0x64')](_0x44a43e[_0xfee4('0x63')]):{};}catch(_0x47b170){logger[_0xfee4('0x29')](_0xfee4('0x65'),_0x47b170);}if(_0x44a43e[_0xfee4('0x66')]){try{var _0x2a3eb7=require(_0x44a43e['computedVariables'])['sync'](this,_0x530a48);_0x530a48[_0xfee4('0x67')]=Mustache['render'](_0x44a43e[_0xfee4('0x68')],_0x2a3eb7,{},['$$','$$']);if(_0x530a48[_0xfee4('0x62')]){_0x530a48['headers']=JSON['parse'](Mustache[_0xfee4('0x69')](JSON[_0xfee4('0x6a')](_0x530a48[_0xfee4('0x62')]),_0x2a3eb7,{},['$$','$$']));}if(_0x530a48['body']){_0x530a48[_0xfee4('0x60')]=JSON['parse'](Mustache[_0xfee4('0x69')](JSON['stringify'](_0x530a48[_0xfee4('0x60')]),_0x2a3eb7,{},['$$','$$']));}}catch(_0x2f1fe6){logger[_0xfee4('0x29')](_0xfee4('0x6b'),_0x2f1fe6);}}rp(_0x530a48)['then'](function(_0x23924d){var _0x4c7a29={'statusCode':_0x23924d[_0xfee4('0x6c')]||0xc8,'statusMessage':_0x23924d[_0xfee4('0x6d')]||'OK','headers':_0x23924d['headers']||{},'body':_0x23924d[_0xfee4('0x60')]||{}};_0x57b90e(null,_0x4c7a29);})[_0xfee4('0x11')](function(_0x5b8994){var _0x28ffbd={'statusCode':_0x5b8994['statusCode']||0x1f4,'statusMessage':_0x5b8994['message']||_0xfee4('0x6e'),'headers':_0x5b8994[_0xfee4('0x6f')][_0xfee4('0x62')]||{},'body':_0x5b8994['options'][_0xfee4('0x60')]||{}};_0x57b90e(null,_0x28ffbd);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x70')]=function(_0x415918,_0x4a30bc){scripts['googleDialogflow'](this[_0xfee4('0xa')][_0xfee4('0x32')],_0x415918[_0xfee4('0x71')],_0x415918[_0xfee4('0x53')],_0x415918[_0xfee4('0x72')]||'en')[_0xfee4('0xf')](function(_0x3c5526){_0x4a30bc(null,_0x3c5526);})[_0xfee4('0x11')](function(_0x4d8998){_0x4a30bc(_0x4d8998);});};AGIVertices['prototype'][_0xfee4('0x73')]=function(_0x32c1cb,_0x5a6fab){scripts[_0xfee4('0x73')](this[_0xfee4('0xa')][_0xfee4('0x32')],_0x32c1cb[_0xfee4('0x74')],_0x32c1cb['client_email'],_0x32c1cb[_0xfee4('0x75')],_0x32c1cb[_0xfee4('0x53')],_0x32c1cb[_0xfee4('0x76')]||'en')['then'](function(_0xe532f2){_0x5a6fab(null,_0xe532f2);})[_0xfee4('0x11')](function(_0x234a3f){_0x5a6fab(_0x234a3f);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x77')]=function(_0x10cbb5,_0x266df6){scripts[_0xfee4('0x77')](this[_0xfee4('0xa')],_0x10cbb5)[_0xfee4('0xf')](function(_0x298d3b){_0x266df6(null,_0x298d3b);})[_0xfee4('0x11')](function(_0x120f0e){_0x266df6(_0x120f0e);});};AGIVertices['prototype'][_0xfee4('0x78')]=function(_0x54b701,_0x14810c){scripts[_0xfee4('0x78')](_0x54b701[_0xfee4('0x71')],_0x54b701['text'],_0x54b701['ispeech_tts_language']||_0xfee4('0x55'),_0x54b701['speed'])[_0xfee4('0xf')](function(_0x196f27){_0x14810c(null,_0x196f27);})['catch'](function(_0x2bb2f7){_0x14810c(_0x2bb2f7);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x79')]=function(_0x4ca7a2,_0x3ee0c1,_0x3f3df1){scripts[_0xfee4('0x79')](_0x3ee0c1,_0x4ca7a2[_0xfee4('0x71')],_0x4ca7a2[_0xfee4('0x7a')]||_0xfee4('0x55'),this['isConfigured'](_0x4ca7a2[_0xfee4('0x7b')])?_0x4ca7a2[_0xfee4('0x7b')]:undefined)['then'](function(_0xb2862a){_0x3f3df1(null,_0xb2862a);})[_0xfee4('0x11')](function(_0x15a383){_0x3f3df1(_0x15a383);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x7c')]=function(_0x24d6f9,_0x3a7773){scripts[_0xfee4('0x7c')](_0x24d6f9[_0xfee4('0x7d')],_0x24d6f9[_0xfee4('0x7e')],_0x24d6f9['aws_polly_region'],_0x24d6f9[_0xfee4('0x7f')]||'Amy',_0x24d6f9[_0xfee4('0x53')],_0x24d6f9[_0xfee4('0x80')]||'text')[_0xfee4('0xf')](function(_0x3a0662){_0x3a7773(null,_0x3a0662);})[_0xfee4('0x11')](function(_0x29d1e3){_0x3a7773(_0x29d1e3);});};AGIVertices['prototype']['awsLex']=function(_0x12142f,_0x231b14){scripts[_0xfee4('0x81')](this[_0xfee4('0xa')][_0xfee4('0x32')],_0x12142f[_0xfee4('0x7d')],_0x12142f[_0xfee4('0x7e')],_0x12142f[_0xfee4('0x82')],_0x12142f[_0xfee4('0x53')],_0x12142f[_0xfee4('0x83')])[_0xfee4('0xf')](function(_0x372146){_0x231b14(null,_0x372146);})[_0xfee4('0x11')](function(_0x5cb1ff){_0x231b14(_0x5cb1ff);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x84')]=function(_0x4f2031,_0x1bcdaf,_0x16f528){scripts[_0xfee4('0x84')](_0x1bcdaf,_0x4f2031[_0xfee4('0x71')],_0x4f2031[_0xfee4('0x85')]||_0xfee4('0x55'))[_0xfee4('0xf')](function(_0x2dc1be){_0x16f528(null,_0x2dc1be);})[_0xfee4('0x11')](function(_0x4880fc){_0x16f528(_0x4880fc);});};AGIVertices[_0xfee4('0xb')][_0xfee4('0x86')]=function(_0x51a83f,_0x16533b,_0x2488c7){scripts[_0xfee4('0x86')](_0x16533b,_0x51a83f[_0xfee4('0x87')],_0x51a83f[_0xfee4('0x88')],_0x51a83f[_0xfee4('0x67')])[_0xfee4('0xf')](function(_0x17321c){_0x2488c7(null,_0x17321c);})[_0xfee4('0x11')](function(_0x2686e7){_0x2488c7(_0x2686e7);});};AGIVertices['prototype'][_0xfee4('0x89')]=function(_0x1e5ef0){var _0x43428b=_[_0xfee4('0x8a')](verticesWithRetry,_0x1e5ef0[_0xfee4('0x34')])?_0x1e5ef0:_[_0xfee4('0x8b')](_0x1e5ef0);for(var _0x4e53f3 in _0x43428b){if(_0x43428b[_0xfee4('0x8c')](_0x4e53f3)){if(_0x43428b[_0x4e53f3]&&_['isString'](_0x43428b[_0x4e53f3])){if(_[_0xfee4('0x8a')](recursiveMapAttributes,_0x4e53f3)){_0x43428b[_0x4e53f3]=this[_0xfee4('0x8d')](_0x43428b[_0x4e53f3]);}else{_0x43428b[_0x4e53f3]=this[_0xfee4('0x8e')](_0x43428b[_0x4e53f3]);}}}}return _0x43428b;};AGIVertices[_0xfee4('0xb')][_0xfee4('0x8f')]=function(_0x5c908c){for(var _0x18862b in _0x5c908c){if(_0x5c908c[_0xfee4('0x8c')](_0x18862b)){if(_[_0xfee4('0x90')](_0x5c908c[_0x18862b])){this[_0xfee4('0x8f')](_0x5c908c[_0x18862b]);}else if(_['isArray'](_0x5c908c[_0x18862b])){for(var _0x363b1e=0x0;_0x363b1e<_0x5c908c[_0x18862b][_0xfee4('0x91')];_0x363b1e++){this[_0xfee4('0x8f')](_0x5c908c[_0x18862b][_0x363b1e]);}}else if(_[_0xfee4('0x92')](_0x5c908c[_0x18862b])){_0x5c908c[_0x18862b]=this['replaceAllVariables'](_0x5c908c[_0x18862b]);}}}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x93')]=function(_0x412f5b,_0x54c248){for(var _0x33987d in _0x412f5b){if(_0x412f5b[_0xfee4('0x8c')](_0x33987d)){if(_[_0xfee4('0x90')](_0x412f5b[_0x33987d])){if(!_[_0xfee4('0x3e')](_0x412f5b[_0x33987d])){this[_0xfee4('0x93')](_0x412f5b[_0x33987d],util[_0xfee4('0x25')](_0xfee4('0x94'),_0x54c248,_0x33987d));}}else if(_[_0xfee4('0x95')](_0x412f5b[_0x33987d])){for(var _0x1e3459=0x0;_0x1e3459<_0x412f5b[_0x33987d]['length'];_0x1e3459++){this['saveRestApiResult'](_0x412f5b[_0x33987d][_0x1e3459],util[_0xfee4('0x25')](_0xfee4('0x94'),_0x54c248,_0x33987d+'['+_0x1e3459+']'));}}else{if(!_['isNil'](_0x412f5b[_0x33987d])){this['channel'][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0x94'),_0x54c248,_0x33987d),_0x412f5b[_0x33987d]);}}}}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x8d')]=function(_0x5deacf){try{var _0xa43d5=JSON[_0xfee4('0x64')](_0x5deacf);this['recursiveNodeIndex'](_0xa43d5);return JSON[_0xfee4('0x6a')](_0xa43d5);}catch(_0x489efc){return this[_0xfee4('0x8e')](_0x5deacf);}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x8e')]=function(_0xff618){var _0x50bfd6=_0xff618[_0xfee4('0x97')]('{');for(var _0x5a5b46=0x1;_0x5a5b46<_0x50bfd6[_0xfee4('0x91')];_0x5a5b46+=0x1){var _0x3850fb=_0x50bfd6[_0x5a5b46][_0xfee4('0x97')]('}');if(_0x3850fb[_0xfee4('0x91')]>0x1){_0xff618=_0xff618['replaceAll']('{'+_0x3850fb[0x0]+'}',this[_0xfee4('0xa')][_0xfee4('0xc')](_0x3850fb[0x0])[_0xfee4('0x98')]||_0x3850fb[0x0]);}}if(_0x50bfd6[_0xfee4('0x91')]===0x1){return _0xff618[_0xfee4('0x44')]();}return this['replaceAllVariables'](_0xff618);};AGIVertices[_0xfee4('0xb')]['getAndSetVariable']=function(_0x7169ac,_0x3c87a2){var _0x4ab84a=this[_0xfee4('0xa')][_0xfee4('0xc')](_0x7169ac);if(_0x4ab84a['result']===-0x1){return _0x4ab84a;}logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3c87a2,_0x4ab84a[_0xfee4('0x98')]));return this[_0xfee4('0xa')]['setVariable'](_0x3c87a2,_0x4ab84a[_0xfee4('0x98')]);};AGIVertices[_0xfee4('0xb')]['isConfigured']=function(_0x3f0f79){return _0x3f0f79&&_0x3f0f79!=='0'&&_0x3f0f79!=='-1'&&_0x3f0f79!=='';};AGIVertices[_0xfee4('0xb')][_0xfee4('0x99')]=function(_0x59d9d2){this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x59d9d2,'-');_0x59d9d2[_0xfee4('0x9b')]=_0x59d9d2[_0xfee4('0x99')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfee4('0xb')][_0xfee4('0x9c')]=function(_0x3ed591){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x9d'),_0x3ed591['label']));if(!this[_0xfee4('0x9e')](_0x3ed591[_0xfee4('0x53')])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xa0'));}var _0x12dcd5='\x22'+_0x3ed591[_0xfee4('0x53')]+'\x22';if(this[_0xfee4('0x9e')](_0x3ed591[_0xfee4('0x6f')])){_0x12dcd5+=','+_0x3ed591[_0xfee4('0x6f')];}var _0x10b8bc=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0xfee4('0xa1'),_0x12dcd5);if(_0x10b8bc['result']===-0x1){return _0x10b8bc;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0xa2'),_0x12dcd5));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xa3')]=function(_0x33ffad){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x33ffad[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x33ffad['grammar'])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xa4'));}var _0x2471e7=_0x33ffad['grammar'];if(this[_0xfee4('0x9e')](_0x33ffad[_0xfee4('0x6f')])){_0x2471e7+=','+_0x33ffad[_0xfee4('0x6f')];}var _0x2dad3c=this['channel']['exec'](_0xfee4('0xa5'),_0x2471e7);if(_0x2dad3c[_0xfee4('0xa6')]===-0x1){return _0x2dad3c;}var _0x32119a=this[_0xfee4('0xa7')](_0xfee4('0xa8'),_0xfee4('0xa9'));if(_0x32119a[_0xfee4('0xa6')]===-0x1){return _0x32119a;}var _0x185fcf=this[_0xfee4('0xa7')](_0xfee4('0xaa'),_0xfee4('0xab'));if(_0x185fcf['result']===-0x1){return _0x185fcf;}var _0x294aed=this[_0xfee4('0xa7')]('RECOG_INSTANCE()',_0xfee4('0xac'));if(_0x294aed[_0xfee4('0xa6')]===-0x1){return _0x294aed;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xad'),_0x2471e7));};AGIVertices['prototype'][_0xfee4('0x5')]=function(_0x582946){logger['info'](util['format'](_0xfee4('0xae'),_0x582946[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x5')]([_0x582946[_0xfee4('0xaf')],_0x582946[_0xfee4('0xb0')]]);};AGIVertices[_0xfee4('0xb')][_0xfee4('0xb1')]=function(_0x41dc46){logger['info'](util[_0xfee4('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x41dc46[_0xfee4('0x33')]));if(this[_0xfee4('0x9e')](_0x41dc46[_0xfee4('0x5b')])){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0xb2'),_0x41dc46[_0xfee4('0x5b')]));var _0x4e1ee5=this[_0xfee4('0xa')]['wait'](_0x41dc46[_0xfee4('0x5b')]);if(_0x4e1ee5[_0xfee4('0xa6')]===-0x1){return _0x4e1ee5;}}return this[_0xfee4('0xa')][_0xfee4('0xb1')]();};AGIVertices[_0xfee4('0xb')][_0xfee4('0xb3')]=function(_0x7794e1){logger[_0xfee4('0x2b')](util['format'](_0xfee4('0xb4'),_0x7794e1[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x7794e1[_0xfee4('0xb5')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x7794e1,_0xfee4('0xb6'));}_0x7794e1['scheduledAt']=moment();if(this[_0xfee4('0x9e')](_0x7794e1[_0xfee4('0xb7')])){_0x7794e1[_0xfee4('0x43')]=moment()[_0xfee4('0xb8')](_0x7794e1[_0xfee4('0xb7')],_0xfee4('0xb9'));}if(!this['isConfigured'](_0x7794e1[_0xfee4('0x45')])){_0x7794e1[_0xfee4('0x45')]=0x2;}this[_0xfee4('0x3d')][_0xfee4('0x9a')](this,_0x7794e1);return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0xba'),_0x7794e1[_0xfee4('0x42')],_0x7794e1[_0xfee4('0xb5')],_0x7794e1[_0xfee4('0x43')]));};AGIVertices['prototype'][_0xfee4('0xbb')]=function(_0x1dc730){logger['info'](util[_0xfee4('0x25')](_0xfee4('0xbc'),_0x1dc730[_0xfee4('0x33')]));var _0x414e2f=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0x1dc730['application'],_0x1dc730[_0xfee4('0x6f')]);if(_0x414e2f[_0xfee4('0xa6')]===-0x1){return _0x414e2f;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0xbd'),_0x1dc730['application'],_0x1dc730[_0xfee4('0x6f')]));};AGIVertices['prototype'][_0xfee4('0xbe')]=function(_0xde7ad6){logger[_0xfee4('0x2b')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xde7ad6[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0xde7ad6[_0xfee4('0x53')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')]('no\x20text\x20configured');}var _0x30876b='\x22'+_0xde7ad6['text']+'\x22';if(this[_0xfee4('0x9e')](_0xde7ad6[_0xfee4('0x6f')])){_0x30876b+=','+_0xde7ad6[_0xfee4('0x6f')];}var _0x159d45=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0xfee4('0xa1'),_0x30876b);if(_0x159d45[_0xfee4('0xa6')]===-0x1){return _0x159d45;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x30876b));};AGIVertices['prototype']['sestektts']=function(_0x49faa5){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0xbf'),_0x49faa5['label']));if(!this[_0xfee4('0x9e')](_0x49faa5[_0xfee4('0x53')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')]('no\x20text\x20configured');}var _0x90fe56='\x22'+_0x49faa5[_0xfee4('0x53')]+'\x22';if(this[_0xfee4('0x9e')](_0x49faa5[_0xfee4('0x6f')])){_0x90fe56+=','+_0x49faa5[_0xfee4('0x6f')];}var _0x3c6fee=this['channel'][_0xfee4('0x4e')](_0xfee4('0xa1'),_0x90fe56);if(_0x3c6fee[_0xfee4('0xa6')]===-0x1){return _0x3c6fee;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xa2'),_0x90fe56));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xc0')]=function(_0x58501a){logger['info'](util[_0xfee4('0x25')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x58501a[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x58501a[_0xfee4('0xc1')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0xa4'));}var _0xfb8c80=_0x58501a[_0xfee4('0xc1')];if(this[_0xfee4('0x9e')](_0x58501a[_0xfee4('0x6f')])){_0xfb8c80+=','+_0x58501a[_0xfee4('0x6f')];}var _0x1165d6=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0xfee4('0xa5'),_0xfb8c80);if(_0x1165d6['result']===-0x1){return _0x1165d6;}var _0x4d9742=this[_0xfee4('0xa7')](_0xfee4('0xa8'),_0xfee4('0xc2'));if(_0x4d9742[_0xfee4('0xa6')]===-0x1){return _0x4d9742;}var _0x556818=this[_0xfee4('0xa7')](_0xfee4('0xaa'),_0xfee4('0xc3'));if(_0x556818[_0xfee4('0xa6')]===-0x1){return _0x556818;}var _0x4b9e90=this[_0xfee4('0xa7')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x4b9e90[_0xfee4('0xa6')]===-0x1){return _0x4b9e90;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0xad'),_0xfb8c80));};AGIVertices['prototype'][_0xfee4('0xc4')]=function(_0x45ba5b){logger['info'](util[_0xfee4('0x25')](_0xfee4('0xc5'),_0x45ba5b['label']));if(!this[_0xfee4('0x9e')](_0x45ba5b[_0xfee4('0xc1')])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xa4'));}var _0x481614=_0x45ba5b[_0xfee4('0xc1')];if(this[_0xfee4('0x9e')](_0x45ba5b['options'])){_0x481614+=','+_0x45ba5b['options'];}var _0x420230=this[_0xfee4('0xa')]['exec']('MRCPRecog',_0x481614);if(_0x420230[_0xfee4('0xa6')]===-0x1){return _0x420230;}var _0x2b8de7=this[_0xfee4('0xa7')](_0xfee4('0xa8'),_0xfee4('0xc6'));if(_0x2b8de7['result']===-0x1){return _0x2b8de7;}var _0x20b0b5=this[_0xfee4('0xa7')]('RECOG_INPUT()',_0xfee4('0xc7'));if(_0x20b0b5[_0xfee4('0xa6')]===-0x1){return _0x20b0b5;}var _0xb9701d=this[_0xfee4('0xa7')](_0xfee4('0xc8'),_0xfee4('0xc9'));if(_0xb9701d['result']===-0x1){return _0xb9701d;}return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0xad'),_0x481614));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xca')]=function(_0x36f277){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0xcb'),_0x36f277['label']));if(!this[_0xfee4('0x9e')](_0x36f277[_0xfee4('0xcc')])){return this['channel'][_0xfee4('0x29')](_0x36f277,_0xfee4('0xcd'));}var _0xcd6512=this[_0xfee4('0x16')][_0xfee4('0x9a')](this,_0x36f277[_0xfee4('0xcc')]);if(!_0xcd6512){return this[_0xfee4('0xa')]['error'](_0x36f277,_0xfee4('0xce'));}if(!this[_0xfee4('0x9e')](_0x36f277[_0xfee4('0xcf')])){return this['channel']['error'](_0x36f277,_0xfee4('0xd0'));}var _0x44cd10=_0x36f277[_0xfee4('0xcf')][_0xfee4('0x4f')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xd1'),_0x44cd10));var _0x290fab=this[_0xfee4('0x27')][_0xfee4('0x9a')](this,_0xcd6512,_0x44cd10);this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x36f277,_0x44cd10);if(!this[_0xfee4('0x9e')](_0x36f277[_0xfee4('0xd2')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xd3'));}var _0x33b604=this[_0xfee4('0xc')]['sync'](this,_0x36f277[_0xfee4('0xd2')]);if(!_0x33b604){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x36f277,'no\x20variable\x20found');}var _0x4d70b2=this;_0x290fab['forEach'](function(_0x3c6739,_0x528f07){Object['keys'](_0x3c6739)[_0xfee4('0xd4')](function(_0x2d12b5){_0x4d70b2[_0xfee4('0xa')]['setVariable'](util[_0xfee4('0x25')](_0xfee4('0xd5'),_0x33b604,_0x528f07,_0x2d12b5),_0x3c6739[_0x2d12b5]);});});this[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0xd6'),_0x33b604),_0x290fab[_0xfee4('0x91')]);return this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')]('variable\x20%s\x20set',_0x33b604));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xd7')]=function(_0x410982){logger['debug'](util[_0xfee4('0x25')](_0xfee4('0xd8'),_0x410982['label']));if(!this[_0xfee4('0x9e')](_0x410982[_0xfee4('0xd9')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x410982,_0xfee4('0xda'));}var _0x461012=this[_0xfee4('0x19')][_0xfee4('0x9a')](this,_0x410982[_0xfee4('0xd9')]);if(!_0x461012){return this['channel'][_0xfee4('0x29')](_0x410982,_0xfee4('0xdb'));}var _0x551eba=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0xfee4('0xdc'),[util[_0xfee4('0x25')](_0xfee4('0xdd'),_0x461012),_0x410982[_0xfee4('0x5b')],_0x410982[_0xfee4('0xde')],_0x410982[_0xfee4('0x68')]]);if(_0x551eba[_0xfee4('0xa6')]===-0x1){return _0x551eba;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xdf'),_0xfee4('0xdc')));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xe0')]=function(_0x2786c4){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0xe1'),_0x2786c4[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x2786c4[_0xfee4('0x71')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xe2'));}if(!this[_0xfee4('0x9e')](_0x2786c4[_0xfee4('0x53')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xa0'));}this[_0xfee4('0xa')][_0xfee4('0xe3')]=!![];this['createSquareDetailsReport'](_0x2786c4);this[_0xfee4('0x3c')](_0x2786c4[_0xfee4('0x53')],'in','','');this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')]('Trying\x20Dialogflow:\x20%s',_0x2786c4[_0xfee4('0x53')]));var _0x3604a1=this['googleDialogflow'][_0xfee4('0x9a')](this,_0x2786c4);if(_0x3604a1){for(var _0x26f02 in _0x3604a1){if(_0x3604a1[_0xfee4('0x8c')](_0x26f02)){this[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0xe4'),_0x26f02[_0xfee4('0x5f')]()),_0x3604a1[_0x26f02]);}}this[_0xfee4('0x3c')](_0x3604a1[_0xfee4('0xe5')],_0xfee4('0xe6'),_0xfee4('0xe0'),'');return this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xe7'),_0x3604a1[_0xfee4('0xe5')]));}return this[_0xfee4('0xa')]['error'](_0x2786c4,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xfee4('0xe8')]=function(_0x165751){logger['info'](util[_0xfee4('0x25')](_0xfee4('0xe9'),_0x165751[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x165751[_0xfee4('0x74')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xea'));}if(!this['isConfigured'](_0x165751[_0xfee4('0xeb')])){return this['channel'][_0xfee4('0x9f')]('no\x20client_email\x20configured');}if(!this[_0xfee4('0x9e')](_0x165751[_0xfee4('0x75')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xec'));}if(!this[_0xfee4('0x9e')](_0x165751[_0xfee4('0x76')])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xed'));}if(!this[_0xfee4('0x9e')](_0x165751[_0xfee4('0x53')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0xa0'));}this[_0xfee4('0xa')][_0xfee4('0xe3')]=!![];this[_0xfee4('0x31')](_0x165751);this[_0xfee4('0x3c')](_0x165751[_0xfee4('0x53')],'in','','');this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')]('Trying\x20DialogflowV2:\x20%s',_0x165751[_0xfee4('0x53')]));var _0x54f97e=this[_0xfee4('0x73')][_0xfee4('0x9a')](this,_0x165751);if(_0x54f97e){for(var _0x398e27 in _0x54f97e){if(_0x54f97e[_0xfee4('0x8c')](_0x398e27)){if(_0x398e27!==_0xfee4('0xee')){this[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0xe4'),_0x398e27['toUpperCase']()),_0x54f97e[_0x398e27]);}}}this['createSquareMessage'](_0x54f97e[_0xfee4('0xe5')],_0xfee4('0xe6'),_0xfee4('0xe8'),_0x54f97e[_0xfee4('0xee')]);return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xef'),_0x54f97e[_0xfee4('0xe5')]));}return this[_0xfee4('0xa')]['error'](_0x165751,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xfee4('0xb')][_0xfee4('0xf0')]=function(_0x3ed468){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3ed468[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x3ed468[_0xfee4('0xf1')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xf2'));}if(!this[_0xfee4('0x9e')](_0x3ed468[_0xfee4('0xf3')])){return this['channel'][_0xfee4('0x9f')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x3ed468[_0xfee4('0xf4')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xf5'));}if(!this['isConfigured'](_0x3ed468[_0xfee4('0xf6')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xa0'));}this[_0xfee4('0xa')][_0xfee4('0xe3')]=!![];this[_0xfee4('0x31')](_0x3ed468);this[_0xfee4('0x3c')](_0x3ed468[_0xfee4('0x53')],'in','','');this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xf7'),_0x3ed468[_0xfee4('0x53')]));var _0x30976d=this[_0xfee4('0x77')][_0xfee4('0x9a')](this,_0x3ed468);if(_0x30976d){for(var _0xf70d72 in _0x30976d){if(_0x30976d[_0xfee4('0x8c')](_0xf70d72)){this[_0xfee4('0xa')][_0xfee4('0x96')](util['format']('SESTEK_NDA_%s',_0xf70d72[_0xfee4('0x5f')]()),_0x30976d[_0xf70d72]);}}this[_0xfee4('0x3c')](_0x30976d[_0xfee4('0xe5')],_0xfee4('0xe6'),_0xfee4('0xf0'),'');if(_0x30976d[_0xfee4('0xf8')]){this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xf9'),_0x30976d[_0xfee4('0xf8')]));var _0xfb8bd8=this[_0xfee4('0xa')][_0xfee4('0xfa')](_0x30976d[_0xfee4('0xf8')]);try{fs[_0xfee4('0xfb')](_0x30976d['audiofile']+'.wav');}catch(_0x465790){logger['error'](_0x465790);}return _0xfb8bd8;}else{return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xfc'),_0x30976d[_0xfee4('0xe5')]));}}return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x3ed468,_0xfee4('0xfd'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0xfe')]=function(_0x3a5995){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0xff'),_0x3a5995[_0xfee4('0x33')]));return this['channel'][_0xfee4('0x9f')](_0xfee4('0xfe'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x100')]=function(_0x47ecb5){logger[_0xfee4('0x2b')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x47ecb5[_0xfee4('0x33')]));var _0x20f553='';if(_0x47ecb5[_0xfee4('0x101')]){if(!this[_0xfee4('0x9e')](_0x47ecb5['trunk_id'])){return this['channel']['error'](_0x47ecb5,'no\x20trunk\x20selected');}else{var _0xe228ac=parseInt(_0x47ecb5['trunk_id'],0xa);if(isNaN(_0xe228ac)){_0x20f553=_0x47ecb5[_0xfee4('0x101')];}else{_0x20f553=this['getTrunk'][_0xfee4('0x9a')](this,_0x47ecb5[_0xfee4('0x101')]);if(!_0x20f553){return this['channel'][_0xfee4('0x29')](_0x47ecb5,_0xfee4('0x102'));}}}}else if(_0x47ecb5[_0xfee4('0x103')]){_0x20f553=_0x47ecb5[_0xfee4('0x103')];}else{return this['channel']['error'](_0x47ecb5,_0xfee4('0x104'));}var _0x68f14a=this['channel'][_0xfee4('0x4e')](_0xfee4('0xdc'),[util['format']('SIP/%s/%s',_0x20f553,_0x47ecb5[_0xfee4('0x42')]),_0x47ecb5[_0xfee4('0x5b')],_0x47ecb5[_0xfee4('0xde')],_0x47ecb5[_0xfee4('0x68')]]);if(_0x68f14a[_0xfee4('0xa6')]===-0x1){return _0x68f14a;}return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0xdf'),_0xfee4('0xdc')));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x105')]=function(_0x3399ef){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x106'),_0x3399ef[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x105'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x9')]=function(_0x3c1a7e){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x107'),_0x3c1a7e[_0xfee4('0x33')]));if(_0x3c1a7e[_0xfee4('0x9b')]===0x0){return this[_0xfee4('0x99')](_0x3c1a7e);}_0x3c1a7e[_0xfee4('0x9b')]-=0x1;if(!this[_0xfee4('0x9e')](_0x3c1a7e[_0xfee4('0x108')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x3c1a7e,'no\x20file\x20audio\x20selected');}var _0x1ddace=this['getSound']['sync'](this,_0x3c1a7e['file_id']);if(!_0x1ddace){return this['channel'][_0xfee4('0x29')](_0x3c1a7e,'no\x20file\x20audio\x20found');}if(!this[_0xfee4('0x9e')](_0x3c1a7e[_0xfee4('0xd2')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0xfee4('0xd3'));}var _0x557655=this[_0xfee4('0xa')][_0xfee4('0x109')](_0x1ddace,_0x3c1a7e[_0xfee4('0x10a')],_0x3c1a7e[_0xfee4('0x10b')]);var _0x4108f0=_0x557655['result']?_0x557655[_0xfee4('0xa6')][_0xfee4('0x44')]():'';logger['info']('test',JSON[_0xfee4('0x6a')](_0x557655));if(_0x557655[_0xfee4('0xa6')]===-0x1){this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x3c1a7e,_0x4108f0);return _0x557655;}else if(_0x557655['extra']===_0xfee4('0x5b')){_0x557655['result']=_0x4108f0['length']>=parseInt(_0x3c1a7e[_0xfee4('0x10c')])?'x':'i';}else{_0x557655['result']=_0x4108f0[_0xfee4('0x91')]>=parseInt(_0x3c1a7e[_0xfee4('0x10c')])&&_0x4108f0[_0xfee4('0x91')]<=parseInt(_0x3c1a7e[_0xfee4('0x10b')])?'x':'i';}var _0x2ba192=this[_0xfee4('0xc')]['sync'](this,_0x3c1a7e['variable_id']);if(!_0x2ba192){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x3c1a7e,_0xfee4('0x10d'));}this['channel'][_0xfee4('0x96')](_0x2ba192,_0x4108f0);if(this[_0xfee4('0x9e')](_0x3c1a7e[_0xfee4('0x10e')])){var _0x2791c9=parseInt(_0x3c1a7e[_0xfee4('0x10e')],0xa);var _0x141919=rs[_0xfee4('0x10f')]({'charset':'*','length':_0x2791c9});var _0x2f9fd2=_0x4108f0[_0xfee4('0x91')];if(_0x2f9fd2>0x0){if(_0x2f9fd2>_0x2791c9){this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x3c1a7e,_0x3c1a7e['hiddendigitspos']===_0xfee4('0x110')?_0x141919+_0x4108f0[_0xfee4('0x111')](_0x2791c9):_0x4108f0[_0xfee4('0x111')](0x0,_0x2f9fd2-_0x2791c9)+_0x141919);}else{this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x3c1a7e,rs['generate']({'charset':'*','length':_0x2f9fd2}));}}else{this['createSquareDetailsReport']['sync'](this,_0x3c1a7e,'');}}else{this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x3c1a7e,_0x4108f0);}return _0x557655;};AGIVertices['prototype'][_0xfee4('0x112')]=function(_0x2216ad){logger[_0xfee4('0x2b')](util['format'](_0xfee4('0x113'),_0x2216ad['label']));return this[_0xfee4('0x9')](_0x2216ad);};AGIVertices['prototype'][_0xfee4('0x114')]=function(_0x4e7918){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x115'),_0x4e7918[_0xfee4('0x33')]));this['createSquareDetailsReport'][_0xfee4('0x9a')](this,_0x4e7918,_0x4e7918[_0xfee4('0x116')]);return this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')]('GOAL\x20%s',_0x4e7918[_0xfee4('0x116')]));};AGIVertices['prototype']['awspolly']=function(_0x10e113){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x10e113[_0xfee4('0x33')]));if(!this['isConfigured'](_0x10e113[_0xfee4('0x7d')])||!this['isConfigured'](_0x10e113['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xfee4('0x9e')](_0x10e113[_0xfee4('0x53')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0xa0'));}this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x10e113[_0xfee4('0x53')]));var _0x5d622d=this['awsPolly'][_0xfee4('0x9a')](this,_0x10e113);if(_0x5d622d){this['channel'][_0xfee4('0x9f')](util['format'](_0xfee4('0x117'),_0x5d622d));var _0x405715=this['channel'][_0xfee4('0xfa')](_0x5d622d);try{fs['unlink'](_0x5d622d+'.wav');}catch(_0x5a17d8){logger['error'](_0x5a17d8);}return _0x405715;}return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x10e113,_0xfee4('0x118'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x119')]=function(_0x29d1f3){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x29d1f3['label']));if(!this[_0xfee4('0x9e')](_0x29d1f3[_0xfee4('0x7d')])||!this[_0xfee4('0x9e')](_0x29d1f3[_0xfee4('0x7e')])){return this['channel'][_0xfee4('0x9f')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xfee4('0x9e')](_0x29d1f3[_0xfee4('0x83')])){return this['channel']['noop'](_0xfee4('0x11a'));}if(!this[_0xfee4('0x9e')](_0x29d1f3['text'])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xa0'));}this[_0xfee4('0xa')][_0xfee4('0xe3')]=!![];this[_0xfee4('0x31')](_0x29d1f3);this[_0xfee4('0x3c')](_0x29d1f3[_0xfee4('0x53')],'in','','');this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0x11b'),_0x29d1f3['text']));var _0xab128b=this['awsLex']['sync'](this,_0x29d1f3);if(_0xab128b){for(var _0x493efe in _0xab128b){if(_0xab128b['hasOwnProperty'](_0x493efe)&&_[_0xfee4('0x92')](_0xab128b[_0x493efe])){this[_0xfee4('0xa')]['setVariable'](util[_0xfee4('0x25')](_0xfee4('0x11c'),_0x493efe[_0xfee4('0x5f')]()),_0xab128b[_0x493efe]);}}if(_[_0xfee4('0x3f')](_0xab128b[_0xfee4('0x11d')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x11e'));}else{this[_0xfee4('0x3c')](_0xab128b['message'],_0xfee4('0xe6'),_0xfee4('0x11f'),'');return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0x120'),_0xab128b[_0xfee4('0x11d')]));}}return this[_0xfee4('0xa')]['error'](_0x29d1f3,_0xfee4('0x121'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x122')]=function(_0x55da56){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x123'),_0x55da56[_0xfee4('0x33')],_0x55da56['timeout']));if(!this[_0xfee4('0x9e')](_0x55da56['key'])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xe2'));}var _0x3ec832=_0xfee4('0x124');var _0x1d96a8=util[_0xfee4('0x25')](_0xfee4('0x125'),FILES_PATH,rs[_0xfee4('0x10f')](0x4));var _0x407685=util[_0xfee4('0x25')](_0xfee4('0x94'),_0x1d96a8,_0x3ec832);var _0x1e0644=!![];if(_0x55da56[_0xfee4('0x126')]===_0xfee4('0x127')){_0x1e0644=![];}var _0x2c9b4d=this[_0xfee4('0xa')][_0xfee4('0x128')](_0x1d96a8,_0x3ec832,_0x55da56[_0xfee4('0x129')],_0x55da56[_0xfee4('0x5b')],undefined,_0x1e0644);if(_0x2c9b4d['result']!==-0x1){this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')]('google\x20%s\x20file\x20created',_0x407685));var _0x1ab09a=this[_0xfee4('0x84')][_0xfee4('0x9a')](this,_0x55da56,_0x407685);if(_0x1ab09a){for(var _0x3f0945 in _0x1ab09a){if(_0x1ab09a['hasOwnProperty'](_0x3f0945)){this[_0xfee4('0xa')][_0xfee4('0x96')](util['format'](_0xfee4('0x12a'),_0x3f0945[_0xfee4('0x5f')]()),_0x1ab09a[_0x3f0945]);}}return this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x12b'),JSON[_0xfee4('0x6a')](_0x1ab09a)));}}return _0x2c9b4d;};AGIVertices[_0xfee4('0xb')][_0xfee4('0x12c')]=function(_0x497777){logger[_0xfee4('0x2b')](util['format'](_0xfee4('0x12d'),_0x497777[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x497777[_0xfee4('0x87')])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0x12e'));}if(!this[_0xfee4('0x9e')](_0x497777[_0xfee4('0x88')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x12f'));}var _0x532c50=_0xfee4('0x124');var _0x858016=util[_0xfee4('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xfee4('0x10f')](0x4));var _0x1aa9c9=util[_0xfee4('0x25')](_0xfee4('0x94'),_0x858016,_0x532c50);var _0x4ebf18=!![];if(_0x497777[_0xfee4('0x126')]==='NOBEEP'){_0x4ebf18=![];}var _0x1c651c=this[_0xfee4('0xa')][_0xfee4('0x128')](_0x858016,_0x532c50,_0x497777['intKey'],_0x497777['timeout'],undefined,_0x4ebf18);if(_0x1c651c[_0xfee4('0xa6')]!==-0x1){this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0x130'),_0x1aa9c9));var _0x577574=this[_0xfee4('0x86')][_0xfee4('0x9a')](this,_0x497777,_0x1aa9c9);if(_0x577574){for(var _0x5a9a62 in _0x577574){if(_0x577574[_0xfee4('0x8c')](_0x5a9a62)){this[_0xfee4('0xa')]['setVariable'](util[_0xfee4('0x25')]('TILDE_ASR_%s',_0x5a9a62['toUpperCase']()),_0x577574[_0x5a9a62]);}}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x131'),JSON['stringify'](_0x577574)));}}return _0x1c651c;};AGIVertices['prototype'][_0xfee4('0x132')]=function(_0x32537a){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x133'),_0x32537a[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x134')](_0x32537a[_0xfee4('0x39')],_0x32537a[_0xfee4('0x3a')],_0x32537a['priority']);};AGIVertices[_0xfee4('0xb')]['gotoif']=function(_0x591d9c){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x591d9c['label']));if(!this[_0xfee4('0x9e')](_0x591d9c['condition'])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x591d9c,_0xfee4('0x135'));}try{var _0x170942=eval(_0x591d9c[_0xfee4('0x136')])?_0xfee4('0x137'):_0xfee4('0x138');this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0x591d9c['condition'],_0x170942));return{'code':0xc8,'result':_0x170942};}catch(_0x30a980){return{'code':0xc8,'result':_0xfee4('0x138')};}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x139')]=function(_0x31f637){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x31f637['label']));if(!this[_0xfee4('0x9e')](_0x31f637[_0xfee4('0x13a')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x31f637,_0xfee4('0x13b'));}var _0x3e7f6a=this[_0xfee4('0x20')][_0xfee4('0x9a')](this,_0x31f637['interval_id']);if(!_0x3e7f6a){return this[_0xfee4('0xa')]['error'](_0x31f637,_0xfee4('0x13c'));}for(var _0x64926e=0x0;_0x64926e<_0x3e7f6a[_0xfee4('0x91')];_0x64926e+=0x1){var _0x2b01df=this[_0xfee4('0xa')][_0xfee4('0xc')](util[_0xfee4('0x25')](_0xfee4('0x13d'),_0x3e7f6a[_0x64926e]));if(_0x2b01df[_0xfee4('0xa6')]===-0x1){return _0x2b01df;}logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('IFTIME\x20%s\x20%s',_0x3e7f6a[_0x64926e],_0x2b01df[_0xfee4('0x98')]));if(_0x2b01df[_0xfee4('0x98')]===_0xfee4('0x137')){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x13e'),_0x3e7f6a[_0x64926e],_0xfee4('0x137')));this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x13e'),_0x3e7f6a[_0x64926e],'true'));return{'code':0xc8,'result':_0xfee4('0x137')};}else{logger['info'](util[_0xfee4('0x25')](_0xfee4('0x13e'),_0x3e7f6a[_0x64926e],'false'));this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x13e'),_0x3e7f6a[_0x64926e],_0xfee4('0x138')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xfee4('0xb')]['hangup']=function(_0x3ae7e6){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x13f'),_0x3ae7e6[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x140')]();};AGIVertices[_0xfee4('0xb')][_0xfee4('0x141')]=function(_0x375527){logger['info'](util['format'](_0xfee4('0x142'),_0x375527[_0xfee4('0x33')]));if(!this['isConfigured'](_0x375527[_0xfee4('0x71')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xe2'));}var _0x3ad68c='wav';var _0x2877b9=util[_0xfee4('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xfee4('0x10f')](0x4));var _0x499d6b=util[_0xfee4('0x25')](_0xfee4('0x94'),_0x2877b9,_0x3ad68c);var _0x111236=!![];if(_0x375527[_0xfee4('0x126')]===_0xfee4('0x127')){_0x111236=![];}var _0x5977a2=this[_0xfee4('0xa')][_0xfee4('0x128')](_0x2877b9,_0x3ad68c,_0x375527[_0xfee4('0x129')],_0x375527['timeout'],undefined,_0x111236);if(_0x5977a2[_0xfee4('0xa6')]!==-0x1){this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0x143'),_0x499d6b));var _0x531e22=this['ispeechASR']['sync'](this,_0x375527,_0x499d6b);if(_0x531e22){for(var _0x4b490f in _0x531e22){if(_0x531e22[_0xfee4('0x8c')](_0x4b490f)){this[_0xfee4('0xa')]['setVariable'](util[_0xfee4('0x25')]('ISPEECH_ASR_%s',_0x4b490f[_0xfee4('0x5f')]()),_0x531e22[_0x4b490f]);}}return this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x144'),JSON['stringify'](_0x531e22)));}}return _0x5977a2;};AGIVertices[_0xfee4('0xb')][_0xfee4('0x145')]=function(_0x4a4413){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x146'),_0x4a4413[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x4a4413['key'])){return this[_0xfee4('0xa')][_0xfee4('0x9f')]('no\x20key\x20configured');}if(!this[_0xfee4('0x9e')](_0x4a4413[_0xfee4('0x53')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xa0'));}this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0x147'),_0x4a4413['text']));var _0xcafdcd=this[_0xfee4('0x78')][_0xfee4('0x9a')](this,_0x4a4413);if(_0xcafdcd){this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format']('ispeech\x20%s\x20file\x20created',_0xcafdcd));var _0xf74435=this[_0xfee4('0xa')][_0xfee4('0xfa')](_0xcafdcd,_0x4a4413['intKey']);try{fs[_0xfee4('0xfb')](_0xcafdcd+_0xfee4('0x148'));}catch(_0x1fb3c6){logger['error'](_0x1fb3c6);}return _0xf74435;}return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x4a4413,_0xfee4('0x149'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x14a')]=function(_0x3063ee){logger['info'](util[_0xfee4('0x25')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3063ee[_0xfee4('0x33')]));if(!this['isConfigured'](_0x3063ee[_0xfee4('0x14b')])){return this[_0xfee4('0xa')]['error'](_0x3063ee,_0xfee4('0x14c'));}logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x14d'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x3063ee['findBy']));var _0x427de1=this[_0xfee4('0x4c')][_0xfee4('0x9a')](this,_0x3063ee['findBy']);if(_0x427de1){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x14e'),this['channel'][_0xfee4('0x36')],_0x3063ee[_0xfee4('0x14b')]));this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x3063ee[_0xfee4('0x14b')]));return{'code':0xc8,'result':_0xfee4('0x14f')};}else{logger[_0xfee4('0x2b')](util['format'](_0xfee4('0x150'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x3063ee[_0xfee4('0x14b')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0x150'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x3063ee[_0xfee4('0x14b')]));return{'code':0xc8,'result':_0xfee4('0x151')};}};AGIVertices[_0xfee4('0xb')]['logout']=function(_0x479b14){logger['info'](util['format'](_0xfee4('0x152'),_0x479b14[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x479b14['findBy'])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x479b14,'no\x20find\x20by\x20configured');}logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x14d'),this['channel'][_0xfee4('0x36')],_0x479b14['findBy']));var _0x1488be=this[_0xfee4('0x4b')][_0xfee4('0x9a')](this,_0x479b14[_0xfee4('0x14b')]);if(_0x1488be){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfee4('0xa')]['callerid'],_0x479b14['findBy']));this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x479b14['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xfee4('0x25')](_0xfee4('0x150'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x479b14[_0xfee4('0x14b')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfee4('0xa')][_0xfee4('0x36')],_0x479b14[_0xfee4('0x14b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfee4('0xb')]['math']=function(_0x46e866){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x153'),_0x46e866[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x46e866[_0xfee4('0x154')])){return this['channel']['error'](_0x46e866,_0xfee4('0x155'));}this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x156'),_0x46e866[_0xfee4('0x154')]));var _0x2c01c0=eval(_0x46e866[_0xfee4('0x154')]);if(!this[_0xfee4('0x9e')](_0x46e866[_0xfee4('0xd2')])){return this['channel'][_0xfee4('0x9f')](_0xfee4('0xd3'));}var _0x35e3db=this[_0xfee4('0xc')][_0xfee4('0x9a')](this,_0x46e866[_0xfee4('0xd2')]);if(!_0x35e3db){return this[_0xfee4('0xa')]['error'](_0x46e866,_0xfee4('0x10d'));}if(_[_0xfee4('0x95')](_0x2c01c0)){var _0x45127f=this;_0x2c01c0['forEach'](function(_0x50de77,_0x2edba1){_0x45127f[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0x157'),_0x35e3db,_0x2edba1),_0x50de77);});return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0x158'),_0x35e3db));}else{return this[_0xfee4('0xa')]['setVariable'](_0x35e3db,_0x2c01c0);}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x8')]=function(_0x12b21a){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x159'),_0x12b21a[_0xfee4('0x33')]));if(_0x12b21a[_0xfee4('0x9b')]===0x0){return this[_0xfee4('0x99')](_0x12b21a);}_0x12b21a[_0xfee4('0x9b')]-=0x1;if(!this['isConfigured'](_0x12b21a[_0xfee4('0x108')])){return this['channel']['error'](_0x12b21a,_0xfee4('0x15a'));}var _0x37317c=this[_0xfee4('0x1c')][_0xfee4('0x9a')](this,_0x12b21a['file_id']);if(!_0x37317c){return this[_0xfee4('0xa')]['error'](_0x12b21a,_0xfee4('0x15b'));}var _0x3a5da7=this[_0xfee4('0xa')]['getData'](_0x37317c,_0x12b21a[_0xfee4('0x10a')],_0x12b21a[_0xfee4('0x15c')]);var _0x143d2c=_0x3a5da7['result'];if(_0x3a5da7[_0xfee4('0xa6')]===-0x1){this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x12b21a,'-1');return _0x3a5da7;}else if(_0x3a5da7[_0xfee4('0x98')]==='timeout'){_0x3a5da7[_0xfee4('0xa6')]=_0x3a5da7[_0xfee4('0xa6')]['length']>0x0?_0x3a5da7['result']:'t';}else if(_[_0xfee4('0x3e')](_0x3a5da7[_0xfee4('0xa6')])){_0x3a5da7['result']='#';_0x143d2c='#';}if(!this[_0xfee4('0x9e')](_0x12b21a[_0xfee4('0xd2')])){this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xd3'));}else{var _0x432ea5=this[_0xfee4('0xc')]['sync'](this,_0x12b21a[_0xfee4('0xd2')]);if(!_0x432ea5){return this['channel']['error'](_0x12b21a,'no\x20variable\x20found');}this[_0xfee4('0xa')][_0xfee4('0x96')](_0x432ea5,_0x143d2c);}this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x12b21a,_0x143d2c);return _0x3a5da7;};AGIVertices[_0xfee4('0xb')][_0xfee4('0x9f')]=function(_0x57d46f){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x15d'),_0x57d46f[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0x57d46f[_0xfee4('0x15e')]||_0x57d46f[_0xfee4('0x33')]);};AGIVertices[_0xfee4('0xb')][_0xfee4('0x15f')]=function(_0x13e88a){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x160'),_0x13e88a[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x13e88a[_0xfee4('0x14b')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x13e88a,_0xfee4('0x14c'));}logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xfee4('0x36')],_0x13e88a['findBy']));var _0x5ba08d=this['getPause'][_0xfee4('0x9a')](this,_0x13e88a['pause_id']);var _0x7024=this[_0xfee4('0x48')][_0xfee4('0x9a')](this,_0x13e88a[_0xfee4('0x14b')],_0x5ba08d);if(_0x7024){logger[_0xfee4('0x2b')](util['format'](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x13e88a[_0xfee4('0x14b')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x13e88a[_0xfee4('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xfee4('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfee4('0xa')][_0xfee4('0x36')],_0x13e88a[_0xfee4('0x14b')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x14e'),this[_0xfee4('0xa')]['callerid'],_0x13e88a['findBy']));return{'code':0xc8,'result':_0xfee4('0x151')};}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x161')]=function(_0x16185b){logger['info'](util[_0xfee4('0x25')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x16185b[_0xfee4('0x33')]));if(!this['isConfigured'](_0x16185b[_0xfee4('0x108')])){return this[_0xfee4('0xa')]['error'](_0x16185b,_0xfee4('0x15a'));}var _0x498884=this[_0xfee4('0x1c')][_0xfee4('0x9a')](this,_0x16185b[_0xfee4('0x108')]);if(!_0x498884){return this['channel'][_0xfee4('0x29')](_0x16185b,'no\x20file\x20audio\x20found');}var _0x22cc5a=this[_0xfee4('0xa')][_0xfee4('0x4e')](_0xfee4('0x162'),[_0x498884,_0x16185b[_0xfee4('0xde')]]);if(_0x22cc5a[_0xfee4('0xa6')]===-0x1){return _0x22cc5a;}return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0xbd'),'PLAYBACK',_0x498884));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x163')]=function(_0x3ae68b){logger['info'](util[_0xfee4('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x3ae68b[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x3ae68b[_0xfee4('0x164')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x3ae68b,_0xfee4('0x165'));}var _0x57f100='';var _0x24114b=parseInt(_0x3ae68b[_0xfee4('0x164')],0xa);if(isNaN(_0x24114b)){_0x57f100=_0x3ae68b[_0xfee4('0x164')];}else{_0x57f100=this[_0xfee4('0x12')][_0xfee4('0x9a')](this,_0x3ae68b[_0xfee4('0x164')]);if(!_0x57f100){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x3ae68b,_0xfee4('0x166'));}}var _0x270c7e='';if(this[_0xfee4('0x9e')](_0x3ae68b['file_id'])){var _0x47d2b2=this['getSound'][_0xfee4('0x9a')](this,_0x3ae68b[_0xfee4('0x108')]);if(_0x47d2b2){_0x270c7e=_0x47d2b2;}}this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x3ae68b,_0x57f100);if(_0x3ae68b[_0xfee4('0xde')][_0xfee4('0x167')]('x')<0x0){_0x3ae68b[_0xfee4('0xde')]+='x';}if(_0x3ae68b[_0xfee4('0xde')][_0xfee4('0x167')]('X')<0x0){_0x3ae68b[_0xfee4('0xde')]+='X';}this['channel'][_0xfee4('0x96')]('XMCS-QUEUE',_0x57f100?_0x57f100[_0xfee4('0x168')]():'');var _0x5b07fa=this[_0xfee4('0xa')]['exec']('QUEUE',[_0x57f100,_0x3ae68b[_0xfee4('0xde')],_0x3ae68b[_0xfee4('0x68')],_0x270c7e,_0x3ae68b[_0xfee4('0x5b')],_0x3ae68b[_0xfee4('0x5')],_0x3ae68b[_0xfee4('0x169')],_0x3ae68b['gosub'],'',_0x3ae68b['position']]);if(_0x5b07fa[_0xfee4('0xa6')]===-0x1){return _0x5b07fa;}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0xbd'),_0xfee4('0x16a'),_0x57f100));};AGIVertices['prototype']['record']=function(_0x28fa88){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x28fa88['label']));var _0x1bacd7=_0x28fa88[_0xfee4('0x16b')]||'wav';var _0x2e282d=util['format'](_0xfee4('0x16c'),this[_0xfee4('0xa')][_0xfee4('0x32')],rs[_0xfee4('0x10f')](0x5));var _0x552932=util[_0xfee4('0x25')](_0xfee4('0x16d'),FILES_PATH,_0x2e282d,_0x1bacd7);var _0x30f723=util[_0xfee4('0x25')](_0xfee4('0x125'),FILES_PATH,_0x2e282d);this[_0xfee4('0x37')][_0xfee4('0x9a')](this,_0x28fa88,_0x2e282d,_0x552932);this[_0xfee4('0xa')]['setVariable'](_0xfee4('0x16e'),_0x2e282d);logger[_0xfee4('0x2b')](_0xfee4('0x16f'),_0x30f723,_0x1bacd7,_0x28fa88[_0xfee4('0x170')],_0x28fa88[_0xfee4('0x5b')]);return this[_0xfee4('0xa')][_0xfee4('0x128')](_0x30f723,_0x1bacd7,_0x28fa88['escape_digits'],_0x28fa88[_0xfee4('0x5b')],undefined,!![]);};AGIVertices[_0xfee4('0xb')][_0xfee4('0x171')]=function(_0x5f1693){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x172'),_0x5f1693[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x5f1693[_0xfee4('0x68')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0x173'));}var _0x1c6fa8=this[_0xfee4('0x5a')][_0xfee4('0x9a')](this,_0x5f1693);logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x174'),util[_0xfee4('0x175')](_0x1c6fa8,{'showHidden':![],'depth':null})));if(!this[_0xfee4('0x9e')](_0x5f1693[_0xfee4('0xd2')])){return this['channel'][_0xfee4('0x9f')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4f8a2b=this[_0xfee4('0xc')]['sync'](this,_0x5f1693['variable_id']);if(!_0x4f8a2b){return this['channel']['error'](_0x5f1693,_0xfee4('0x10d'));}this[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0x176'),_0x4f8a2b),_0x1c6fa8[_0xfee4('0x6c')]?_0x1c6fa8[_0xfee4('0x6c')]:_0xfee4('0x177'));this[_0xfee4('0xa')][_0xfee4('0x96')](util[_0xfee4('0x25')](_0xfee4('0x178'),_0x4f8a2b),_0x1c6fa8['statusMessage']?_0x1c6fa8[_0xfee4('0x6d')]:'OK');if(_0x1c6fa8['body']){try{this[_0xfee4('0x93')](_0x1c6fa8[_0xfee4('0x60')],_0x4f8a2b);}catch(_0x4b95d8){logger['error'](util[_0xfee4('0x25')](_0xfee4('0x179'),_0x4f8a2b));}}return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')]('variable\x20%s\x20set',_0x4f8a2b));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x17a')]=function(_0x3aeb2a){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x17b'),_0x3aeb2a['label']));return this[_0xfee4('0xa')][_0xfee4('0x17c')](_0x3aeb2a[_0xfee4('0x17d')][_0xfee4('0x4f')](/\s+/g,''),_0x3aeb2a[_0xfee4('0x170')]);};AGIVertices[_0xfee4('0xb')]['saynumber']=function(_0x1682ac){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x17e'),_0x1682ac[_0xfee4('0x33')]));return this['channel'][_0xfee4('0x17f')](_0x1682ac[_0xfee4('0x180')][_0xfee4('0x4f')](/\s+/g,''),_0x1682ac['escape_digits']);};AGIVertices[_0xfee4('0xb')][_0xfee4('0x181')]=function(_0x4a5c52){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x182'),_0x4a5c52[_0xfee4('0x33')]));return this[_0xfee4('0xa')]['sayPhonetic'](_0x4a5c52['text'],_0x4a5c52[_0xfee4('0x170')]);};AGIVertices['prototype'][_0xfee4('0x183')]=function(_0x2fd28e){logger[_0xfee4('0x2b')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2fd28e['label']));if(!this[_0xfee4('0x9e')](_0x2fd28e[_0xfee4('0x184')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x185'));}var _0x13c769=this[_0xfee4('0x186')][_0xfee4('0x9a')](this,_0x2fd28e['account_id']);if(!_0x13c769||!_0x13c769[_0xfee4('0x187')]){return this['channel'][_0xfee4('0x29')](_0x2fd28e,_0xfee4('0x188'));}var _0x41cf98={'from':util[_0xfee4('0x25')](_0xfee4('0x189'),_0x13c769[_0xfee4('0x10')],_0x13c769['email']||_0x13c769[_0xfee4('0x187')]['user']),'to':_0x2fd28e['to']||'','cc':_0x2fd28e['cc']||'','bcc':_0x2fd28e[_0xfee4('0x18a')]||'','subject':_0x2fd28e[_0xfee4('0x18b')],'html':_0x2fd28e[_0xfee4('0x53')],'text':_0x2fd28e[_0xfee4('0x53')]};if(this[_0xfee4('0x9e')](_0x2fd28e['template_id'])){}logger[_0xfee4('0x18c')](_0xfee4('0x18d'),JSON[_0xfee4('0x6a')](_0x41cf98));this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x2fd28e,_0x2fd28e[_0xfee4('0x184')]);this['channel']['noop'](util[_0xfee4('0x25')](_0xfee4('0x18e'),_0x13c769[_0xfee4('0x10')]));this[_0xfee4('0x1f')][_0xfee4('0x9a')](this,_0x13c769[_0xfee4('0x18f')],_0x41cf98);return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x190'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x191')]=function(_0x138587){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x192'),_0x138587[_0xfee4('0x33')]));return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x193'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x194')]=function(_0x41af5d){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x195'),_0x41af5d['label']));if(!this['isConfigured'](_0x41af5d[_0xfee4('0x196')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0x197'));}var _0x1bcc45=this[_0xfee4('0x2f')][_0xfee4('0x9a')](this,_0x41af5d['sms_account_id']);if(!_0x1bcc45){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x41af5d,_0xfee4('0x198'));}var _0x51641={'body':_0x41af5d['sms_text'],'phone':_0x41af5d['to']||'','SmsAccountId':_0x1bcc45['id']};logger['debug'](_0xfee4('0x199'),JSON[_0xfee4('0x6a')](_0x51641));this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x41af5d,_0x41af5d[_0xfee4('0x196')]);this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x19a'),_0x1bcc45['name']));this[_0xfee4('0x30')]['sync'](this,_0x51641);return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x19b'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x19c')]=function(_0x2f43de){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x19d'),_0x2f43de[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x2f43de[_0xfee4('0xd2')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x2f43de,_0xfee4('0x19e'));}var _0x5987e9=this[_0xfee4('0xc')][_0xfee4('0x9a')](this,_0x2f43de[_0xfee4('0xd2')]);if(!_0x5987e9){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x2f43de,_0xfee4('0x10d'));}return this['channel'][_0xfee4('0x96')](_0x5987e9,_0x2f43de[_0xfee4('0x19f')]);};AGIVertices[_0xfee4('0xb')]['start']=function(_0x4bb23f){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x1a0'),_0x4bb23f[_0xfee4('0x33')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x1a1'));if(_0x4bb23f[_0xfee4('0xb1')]===_0xfee4('0x1a2')){this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0x1a3'));return this[_0xfee4('0xa')]['answer']();}return this[_0xfee4('0xa')][_0xfee4('0x9f')]('Skipped\x20Answer');};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1a4')]=function(_0x4a2f86){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x1a5'),_0x4a2f86[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x4a2f86[_0xfee4('0x1a6')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x4a2f86,'no\x20subproject\x20selected');}var _0xfaef97=this[_0xfee4('0x14')][_0xfee4('0x9a')](this,_0x4a2f86[_0xfee4('0x1a6')]);if(!this[_0xfee4('0x9e')](_0xfaef97)){return this['channel']['error'](_0x4a2f86,util['format'](_0xfee4('0x1a7'),_0x4a2f86[_0xfee4('0x1a6')]));}if(_0xfaef97===this[_0xfee4('0xa')]['arg_1']){return this[_0xfee4('0xa')]['error'](_0x4a2f86,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xfee4('0x9a')](this,_0x4a2f86,_0xfaef97);var _0x57772f=this['channel'][_0xfee4('0x4e')](_0xfee4('0x1a8'),util[_0xfee4('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xfee4('0x5')][_0xfee4('0x1a9')]||'127.0.0.1',_0xfaef97,this[_0xfee4('0xa')]['arg_1']));if(_0x57772f[_0xfee4('0xa6')]===-0x1){return _0x57772f;}return this[_0xfee4('0xa')]['noop'](util[_0xfee4('0x25')](_0xfee4('0xbd'),_0xfee4('0x1a8'),_0xfaef97));};AGIVertices['prototype'][_0xfee4('0x1aa')]=function(_0x307c91){logger['info'](util['format'](_0xfee4('0x1ab'),_0x307c91['label']));var _0x371033=this[_0xfee4('0x4d')]['sync'](this,_0x307c91['command']);this[_0xfee4('0x31')][_0xfee4('0x9a')](this,_0x307c91,_0x307c91[_0xfee4('0xaf')]);if(this[_0xfee4('0x9e')](_0x307c91[_0xfee4('0xd2')])){var _0x2d1c2b=this['getVariable'][_0xfee4('0x9a')](this,_0x307c91[_0xfee4('0xd2')]);if(_0x2d1c2b){this['channel'][_0xfee4('0x96')](_0x2d1c2b,_0x371033);return this[_0xfee4('0xa')][_0xfee4('0x9f')](util['format'](_0xfee4('0x1ac'),_0x307c91['command'],_0x2d1c2b));}}return this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x1ad'),_0x307c91[_0xfee4('0xaf')]));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1ae')]=function(_0x26fe7d){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x1af'),_0x26fe7d['label']));_0x26fe7d['text']=_0x26fe7d['text'][_0xfee4('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfee4('0x9e')](_0x26fe7d[_0xfee4('0x51')])){return this[_0xfee4('0xa')]['noop'](_0xfee4('0x1b0'));}if(!this[_0xfee4('0x9e')](_0x26fe7d[_0xfee4('0x53')])){return this[_0xfee4('0xa')][_0xfee4('0x9f')](_0xfee4('0xa0'));}this['channel'][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x1b1'),_0x26fe7d['text']));var _0x38cc6b=this[_0xfee4('0x50')][_0xfee4('0x9a')](this,_0x26fe7d);if(_0x38cc6b){this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x1b2'),_0x38cc6b));var _0x35ab41=this[_0xfee4('0xa')][_0xfee4('0xfa')](_0x38cc6b);try{fs[_0xfee4('0xfb')](_0x38cc6b+'.wav');}catch(_0x256849){logger['error'](_0x256849);}return _0x35ab41;}return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x26fe7d,_0xfee4('0x1b3'));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1b4')]=function(_0x10e682){logger['info'](util[_0xfee4('0x25')](_0xfee4('0x1b5'),_0x10e682[_0xfee4('0x33')]));_0x10e682['text']=_0x10e682[_0xfee4('0x53')][_0xfee4('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x10e682[_0xfee4('0x53')])){return this['channel']['noop'](_0xfee4('0xa0'));}this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x1b6'),_0x10e682[_0xfee4('0x53')]));var _0x49c3a2=this[_0xfee4('0x1b7')][_0xfee4('0x9a')](this,_0x10e682);if(_0x49c3a2){this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x1b8'),_0x49c3a2));var _0x2bb438=this[_0xfee4('0xa')][_0xfee4('0xfa')](_0x49c3a2);try{fs[_0xfee4('0xfb')](_0x49c3a2+'.wav');}catch(_0x208a9b){logger['error'](_0x208a9b);}return _0x2bb438;}return this[_0xfee4('0xa')]['error'](_0x10e682,_0xfee4('0x1b9'));};AGIVertices[_0xfee4('0xb')]['unpause']=function(_0x37762f){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x1ba'),_0x37762f[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0x37762f[_0xfee4('0x14b')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0x37762f,'no\x20find\x20by\x20configured');}logger['info'](util[_0xfee4('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x37762f['findBy']));var _0x2ef4c6=this[_0xfee4('0x49')]['sync'](this,_0x37762f[_0xfee4('0x14b')]);if(_0x2ef4c6){logger[_0xfee4('0x2b')](util['format'](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x37762f[_0xfee4('0x14b')]));this[_0xfee4('0xa')][_0xfee4('0x9f')](util[_0xfee4('0x25')](_0xfee4('0x14e'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x37762f[_0xfee4('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xfee4('0x25')](_0xfee4('0x150'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x37762f['findBy']));this['channel'][_0xfee4('0x9f')](util['format'](_0xfee4('0x150'),this[_0xfee4('0xa')][_0xfee4('0x36')],_0x37762f[_0xfee4('0x14b')]));return{'code':0xc8,'result':_0xfee4('0x151')};}};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1bb')]=function(_0x577490){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x1bc'),_0x577490[_0xfee4('0x33')]));var _0x3c6af7=this['channel'][_0xfee4('0x4e')](_0xfee4('0x1bd'),[_0x577490[_0xfee4('0x1be')],_0x577490[_0xfee4('0x6f')]]);if(_0x3c6af7[_0xfee4('0xa6')]===-0x1){return _0x3c6af7;}return this['channel'][_0xfee4('0x9f')](util['format']('Executed\x20command\x20%s\x20%s',_0xfee4('0x1bd'),_0x577490[_0xfee4('0x1be')]));};AGIVertices[_0xfee4('0xb')][_0xfee4('0x1bf')]=function(_0xd86cae){logger[_0xfee4('0x2b')](util[_0xfee4('0x25')](_0xfee4('0x1c0'),_0xd86cae[_0xfee4('0x33')]));if(!this[_0xfee4('0x9e')](_0xd86cae[_0xfee4('0xd2')])){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0xd86cae,_0xfee4('0x19e'));}var _0x3b3d9d=this[_0xfee4('0xc')][_0xfee4('0x9a')](this,_0xd86cae[_0xfee4('0xd2')]);if(!_0x3b3d9d){return this[_0xfee4('0xa')][_0xfee4('0x29')](_0xd86cae,'no\x20variable\x20found');}var _0x12ba6f=this['channel']['getVariable'](_0x3b3d9d);return{'code':0xc8,'result':_0x12ba6f[_0xfee4('0x98')]?_0x12ba6f[_0xfee4('0x98')]:'-'};};String[_0xfee4('0xb')][_0xfee4('0x1c1')]=function(_0x4030ee,_0xf5f9bb){return this[_0xfee4('0x97')](_0x4030ee)['join'](_0xf5f9bb);};module[_0xfee4('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b570140..33c9df8 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 _0x9b0c=['../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami'];(function(_0x560534,_0x1a2815){var _0x3dec01=function(_0x2222dd){while(--_0x2222dd){_0x560534['push'](_0x560534['shift']());}};_0x3dec01(++_0x1a2815);}(_0x9b0c,0x15d));var _0xc9b0=function(_0x48e6fe,_0x580772){_0x48e6fe=_0x48e6fe-0x0;var _0x4ac0ec=_0x9b0c[_0x48e6fe];return _0x4ac0ec;};'use strict';var _=require(_0xc9b0('0x0'));var moment=require(_0xc9b0('0x1'));var ami=require(_0xc9b0('0x2'));var logger=require(_0xc9b0('0x3'))(_0xc9b0('0x4'));var RpcUser=require(_0xc9b0('0x5'));var RpcVoiceAgentReport=require(_0xc9b0('0x6'));function Acw(_0x1a01d2){this[_0xc9b0('0x7')]=_0x1a01d2[_0xc9b0('0x7')];this['agents']=_0x1a01d2[_0xc9b0('0x8')];this[_0xc9b0('0x9')]=_0x1a01d2[_0xc9b0('0x9')];this[_0xc9b0('0xa')]={};ami['on']('agentconnect',this[_0xc9b0('0xb')][_0xc9b0('0xc')](this));ami['on']('hanguprequest',this[_0xc9b0('0xd')][_0xc9b0('0xc')](this));ami['on'](_0xc9b0('0xe'),this[_0xc9b0('0xf')][_0xc9b0('0xc')](this));ami['on'](_0xc9b0('0x10'),this[_0xc9b0('0x11')][_0xc9b0('0xc')](this));ami['on'](_0xc9b0('0x12'),this[_0xc9b0('0x13')][_0xc9b0('0xc')](this));ami['on'](_0xc9b0('0x14'),this[_0xc9b0('0x15')][_0xc9b0('0xc')](this));ami['on'](_0xc9b0('0x16'),this['syncAgentConnectPreview'][_0xc9b0('0xc')](this));}function getDiff(_0xa5306d){var _0x3de1d1=moment()[_0xc9b0('0x17')](0x0);var _0xc5df2a=moment(_0xa5306d)['milliseconds'](0x0);return _0x3de1d1[_0xc9b0('0x18')](_0xc5df2a,_0xc9b0('0x19'));}Acw[_0xc9b0('0x1a')][_0xc9b0('0x1b')]=function(_0x47ac47){try{var _0x5e7ba0=this;var _0x73ae3d=this[_0xc9b0('0xa')][_0x47ac47]['interface'];var _0x1f0d3c=this[_0xc9b0('0xa')][_0x47ac47][_0xc9b0('0x1c')];var _0x490d7b=this[_0xc9b0('0x7')][_0x1f0d3c];var _0x4f76b9=![];var _0x29c654=_0xc9b0('0x1d');if(_0x490d7b[_0xc9b0('0x1e')]){if(_0x490d7b[_0xc9b0('0x1f')][_0xc9b0('0x20')]){_0x4f76b9=!![];_0x29c654=_0x490d7b[_0xc9b0('0x1f')][_0xc9b0('0x20')];}}return ami['Action']({'action':_0xc9b0('0x21'),'interface':_0x73ae3d,'paused':!![],'reason':_0x29c654})[_0xc9b0('0x22')](function(){if(_0x5e7ba0['agents'][_0x73ae3d]){return RpcUser[_0xc9b0('0x23')](_0x5e7ba0[_0xc9b0('0x8')][_0x73ae3d]['id'])[_0xc9b0('0x22')](function(_0x5591b5){if(_0x5591b5&&!_0x5591b5[_0xc9b0('0x24')]){logger[_0xc9b0('0x25')](_0xc9b0('0x26'),_0x47ac47,_0x73ae3d,_0x1f0d3c);var _0x55682a=_0x5e7ba0[_0xc9b0('0xa')][_0x47ac47][_0xc9b0('0x27')]&&_0x5e7ba0[_0xc9b0('0xa')][_0x47ac47]['destlinkedid']?_0x5e7ba0[_0xc9b0('0xa')][_0x47ac47]['destlinkedid']:_0x47ac47;return RpcUser[_0xc9b0('0x28')](_0x5e7ba0[_0xc9b0('0x8')][_0x73ae3d],_0x29c654,_0x55682a)[_0xc9b0('0x22')](function(){if(!_0x4f76b9){_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d]={};logger[_0xc9b0('0x25')](_0xc9b0('0x29'),_0x47ac47,_0x5e7ba0[_0xc9b0('0x7')][_0x1f0d3c][_0xc9b0('0x2a')],_0x73ae3d,_0x1f0d3c);_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d][_0xc9b0('0x2b')]=setTimeout(_0x5e7ba0[_0xc9b0('0x2c')]['bind'](_0x5e7ba0,_0x73ae3d),_0x5e7ba0[_0xc9b0('0x7')][_0x1f0d3c]['acwTimeout']*0x3e8);_0x5e7ba0['timers'][_0x73ae3d][_0xc9b0('0x2d')]=moment()[_0xc9b0('0x2e')](_0xc9b0('0x2f'));_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d][_0xc9b0('0x30')]=_0x47ac47;_0x5e7ba0['timers'][_0x73ae3d][_0xc9b0('0x1c')]=_0x1f0d3c;_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d]['updateAcw']=function(){var _0x71105=getDiff(_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d]['lastPauseAt']);clearTimeout(_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d][_0xc9b0('0x2b')]);_0x5e7ba0['timers'][_0x73ae3d]['timer']=![];RpcVoiceAgentReport[_0xc9b0('0x31')]({'acwtime':_0x71105},_0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d][_0xc9b0('0x30')],_0x73ae3d)[_0xc9b0('0x22')](function(_0x166085){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x47ac47,_0x71105,_0x166085);})[_0xc9b0('0x32')](function(_0xfdf94e){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x47ac47,_0xfdf94e);});delete _0x5e7ba0[_0xc9b0('0x9')][_0x73ae3d];};}});}else{logger[_0xc9b0('0x25')](_0xc9b0('0x33'),_0x47ac47,_0x73ae3d,_0x1f0d3c);}});}})['catch'](function(){logger[_0xc9b0('0x34')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x47ac47,_0x5e7ba0[_0xc9b0('0x7')][_0x1f0d3c][_0xc9b0('0x2a')],_0x73ae3d,_0x1f0d3c);})[_0xc9b0('0x35')](function(){delete _0x5e7ba0[_0xc9b0('0xa')][_0x47ac47];});}catch(_0x59adf2){logger[_0xc9b0('0x34')](_0xc9b0('0x36'),_0x59adf2[_0xc9b0('0x37')]);}};Acw['prototype']['stopAcw']=function(_0x3e3d97){try{var _0x4844d0=this;if(_0x4844d0[_0xc9b0('0x9')][_0x3e3d97]){_0x4844d0[_0xc9b0('0x9')][_0x3e3d97][_0xc9b0('0x2b')]=![];var _0x51c424=_0x4844d0['timers'][_0x3e3d97][_0xc9b0('0x30')];var _0x54aafd=_0x4844d0[_0xc9b0('0x9')][_0x3e3d97][_0xc9b0('0x1c')];var _0x3c4add=_0x4844d0['voiceQueues'][_0x54aafd][_0xc9b0('0x2a')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x51c424,_0x3e3d97);RpcUser[_0xc9b0('0x38')](this['agents'][_0x3e3d97]);RpcVoiceAgentReport['update']({'acwtime':_0x3c4add,'agentacw':!![]},_0x51c424,_0x3e3d97)[_0xc9b0('0x22')](function(_0x37d955){logger[_0xc9b0('0x25')](_0xc9b0('0x39'),_0x51c424,_0x3c4add,_0x37d955);})[_0xc9b0('0x32')](function(_0x4ff383){logger[_0xc9b0('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x51c424,_0x4ff383);});}else{logger[_0xc9b0('0x34')](_0xc9b0('0x3a'),_0x3e3d97);if(_0x4844d0[_0xc9b0('0x9')]){logger['info'](_0xc9b0('0x3b'),JSON[_0xc9b0('0x3c')](_0x4844d0['timers']));}}}catch(_0x2b922b){logger['error'](_0xc9b0('0x3d'),_0x2b922b[_0xc9b0('0x37')]);}};Acw['prototype']['syncAgentConnect']=function(_0x37e248){try{if(this[_0xc9b0('0x7')][_0x37e248['queue']]&&(this[_0xc9b0('0x7')][_0x37e248[_0xc9b0('0x1c')]][_0xc9b0('0x4')]||this[_0xc9b0('0x7')][_0x37e248['queue']]['mandatoryDisposition'])){if(this[_0xc9b0('0x8')][_0x37e248[_0xc9b0('0x3e')]]){this[_0xc9b0('0xa')][_0x37e248[_0xc9b0('0x30')]]={'queue':_0x37e248[_0xc9b0('0x1c')],'interface':_0x37e248[_0xc9b0('0x3e')],'destlinkedid':_0x37e248[_0xc9b0('0x3f')]};}}}catch(_0x2b30b6){logger[_0xc9b0('0x34')](_0xc9b0('0x40'),_0x2b30b6['message']);}};Acw[_0xc9b0('0x1a')]['syncAgentConnectPreview']=function(_0x49fc4f){try{if(this[_0xc9b0('0x7')][_0x49fc4f[_0xc9b0('0x1c')]]&&(this[_0xc9b0('0x7')][_0x49fc4f['queue']][_0xc9b0('0x4')]||this[_0xc9b0('0x7')][_0x49fc4f[_0xc9b0('0x1c')]]['mandatoryDisposition'])){if(this[_0xc9b0('0x8')][_0x49fc4f[_0xc9b0('0x3e')]]){this[_0xc9b0('0xa')][_0x49fc4f[_0xc9b0('0x30')]]={'queue':_0x49fc4f[_0xc9b0('0x1c')],'interface':_0x49fc4f[_0xc9b0('0x3e')]};}}}catch(_0x576dca){logger[_0xc9b0('0x34')](_0xc9b0('0x41'),_0x576dca[_0xc9b0('0x37')]);}};Acw[_0xc9b0('0x1a')][_0xc9b0('0xd')]=function(_0x58c7e9){try{if(this[_0xc9b0('0xa')][_0x58c7e9[_0xc9b0('0x30')]]&&_[_0xc9b0('0x42')](this['channels'][_0x58c7e9[_0xc9b0('0x30')]][_0xc9b0('0x27')])){logger[_0xc9b0('0x25')](_0xc9b0('0x43'),_0x58c7e9[_0xc9b0('0x30')]);this[_0xc9b0('0x1b')](_0x58c7e9[_0xc9b0('0x30')]);}else if(this[_0xc9b0('0xa')][_0x58c7e9[_0xc9b0('0x44')]]&&_[_0xc9b0('0x42')](this[_0xc9b0('0xa')][_0x58c7e9[_0xc9b0('0x44')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x58c7e9['linkedid']);this[_0xc9b0('0x1b')](_0x58c7e9[_0xc9b0('0x44')]);}}catch(_0x1feb41){logger['error'](_0xc9b0('0x45'),_0x1feb41[_0xc9b0('0x37')]);}};Acw[_0xc9b0('0x1a')][_0xc9b0('0xf')]=function(_0xe29f30){try{if(this['channels'][_0xe29f30[_0xc9b0('0x30')]]&&this[_0xc9b0('0xa')][_0xe29f30[_0xc9b0('0x30')]][_0xc9b0('0x27')]){logger[_0xc9b0('0x25')](_0xc9b0('0x46'),_0xe29f30['uniqueid']);this[_0xc9b0('0x1b')](_0xe29f30[_0xc9b0('0x30')]);}else if(this[_0xc9b0('0xa')][_0xe29f30[_0xc9b0('0x44')]]&&this[_0xc9b0('0xa')][_0xe29f30[_0xc9b0('0x44')]]['attended']){logger[_0xc9b0('0x25')](_0xc9b0('0x47'),_0xe29f30[_0xc9b0('0x44')]);this[_0xc9b0('0x1b')](_0xe29f30[_0xc9b0('0x44')]);}}catch(_0x49ab5f){logger[_0xc9b0('0x34')](_0xc9b0('0x48'),_0x49ab5f[_0xc9b0('0x37')]);}};Acw[_0xc9b0('0x1a')][_0xc9b0('0x13')]=function(_0xb779c2){try{if(!_[_0xc9b0('0x49')](this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4a')]])){this['startAcw'](_0xb779c2[_0xc9b0('0x4a')]);if(this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4b')]]){this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4b')]]['attended']=!![];this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4c')]]=this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4b')]];delete this[_0xc9b0('0xa')][_0xb779c2['secondtransfereruniqueid']];}}else if(!_[_0xc9b0('0x49')](this['channels'][_0xb779c2[_0xc9b0('0x4c')]])){this[_0xc9b0('0x1b')](_0xb779c2[_0xc9b0('0x4c')]);if(this[_0xc9b0('0xa')][_0xb779c2['origtransfereruniqueid']]){this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4d')]][_0xc9b0('0x27')]=!![];this[_0xc9b0('0xa')][_0xb779c2[_0xc9b0('0x4a')]]=this['channels'][_0xb779c2['origtransfereruniqueid']];delete this['channels'][_0xb779c2[_0xc9b0('0x4d')]];}}}catch(_0x48ba0a){logger[_0xc9b0('0x34')]('[ACW][syncAttendedTransfer]\x20%s',_0x48ba0a[_0xc9b0('0x37')]);}};Acw[_0xc9b0('0x1a')][_0xc9b0('0x15')]=function(_0x50548e){try{if(this[_0xc9b0('0xa')][_0x50548e['transfereruniqueid']]){logger[_0xc9b0('0x25')](_0xc9b0('0x4e'),JSON[_0xc9b0('0x3c')](_0x50548e[_0xc9b0('0x4f')]));this[_0xc9b0('0x1b')](_0x50548e['transfereruniqueid']);}else if(this[_0xc9b0('0xa')][_0x50548e['transfererlinkedid']]){logger[_0xc9b0('0x25')](_0xc9b0('0x50'),JSON['stringify'](_0x50548e[_0xc9b0('0x51')]));this[_0xc9b0('0x1b')](_0x50548e[_0xc9b0('0x51')]);}}catch(_0x49d8f3){logger[_0xc9b0('0x34')](_0xc9b0('0x52'),_0x49d8f3[_0xc9b0('0x37')]);}};Acw[_0xc9b0('0x1a')]['syncAgentRingNoAnswer']=function(_0x5db477){try{if(this[_0xc9b0('0x7')][_0x5db477[_0xc9b0('0x1c')]]&&this[_0xc9b0('0x7')][_0x5db477['queue']][_0xc9b0('0x53')]===_0xc9b0('0x54')){if(this[_0xc9b0('0x8')][_0x5db477[_0xc9b0('0x3e')]]){logger[_0xc9b0('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5db477[_0xc9b0('0x30')],_0x5db477[_0xc9b0('0x3e')],_0x5db477['queue']);return RpcUser['savePause'](this['agents'][_0x5db477[_0xc9b0('0x3e')]],_0xc9b0('0x55'),_0x5db477[_0xc9b0('0x30')]);}}}catch(_0x53274e){logger[_0xc9b0('0x34')](_0xc9b0('0x56'),_0x53274e[_0xc9b0('0x37')]);}};module[_0xc9b0('0x57')]=Acw; \ No newline at end of file +var _0xebbc=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','uniqueid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hangup','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause'];(function(_0x3ebece,_0x357836){var _0x4c05a3=function(_0x45985d){while(--_0x45985d){_0x3ebece['push'](_0x3ebece['shift']());}};_0x4c05a3(++_0x357836);}(_0xebbc,0x184));var _0xcebb=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xebbc[_0x343e44];return _0xa5130e;};'use strict';var _=require('lodash');var moment=require(_0xcebb('0x0'));var ami=require(_0xcebb('0x1'));var logger=require('../../../config/logger')(_0xcebb('0x2'));var RpcUser=require(_0xcebb('0x3'));var RpcVoiceAgentReport=require(_0xcebb('0x4'));function Acw(_0x320acc){this[_0xcebb('0x5')]=_0x320acc[_0xcebb('0x5')];this[_0xcebb('0x6')]=_0x320acc[_0xcebb('0x6')];this[_0xcebb('0x7')]=_0x320acc['timers'];this['channels']={};ami['on'](_0xcebb('0x8'),this[_0xcebb('0x9')][_0xcebb('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xcebb('0xa')](this));ami['on'](_0xcebb('0xb'),this[_0xcebb('0xc')][_0xcebb('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on']('attendedtransfer',this[_0xcebb('0xd')][_0xcebb('0xa')](this));ami['on'](_0xcebb('0xe'),this[_0xcebb('0xf')][_0xcebb('0xa')](this));ami['on'](_0xcebb('0x10'),this[_0xcebb('0x11')][_0xcebb('0xa')](this));}function getDiff(_0x48e52a){var _0x2b306a=moment()[_0xcebb('0x12')](0x0);var _0x43e79a=moment(_0x48e52a)[_0xcebb('0x12')](0x0);return _0x2b306a[_0xcebb('0x13')](_0x43e79a,'seconds');}Acw['prototype'][_0xcebb('0x14')]=function(_0x1e7d36){try{var _0x59ed03=this;var _0x544178=this[_0xcebb('0x15')][_0x1e7d36][_0xcebb('0x16')];var _0x1978d9=this[_0xcebb('0x15')][_0x1e7d36][_0xcebb('0x17')];var _0x845bcc=this['voiceQueues'][_0x1978d9];var _0x115a1d=![];var _0x1a9ef3=_0xcebb('0x18');if(_0x845bcc[_0xcebb('0x19')]){if(_0x845bcc[_0xcebb('0x1a')][_0xcebb('0x1b')]){_0x115a1d=!![];_0x1a9ef3=_0x845bcc['mandatoryDispositionPause']['name'];}}return ami[_0xcebb('0x1c')]({'action':_0xcebb('0x1d'),'interface':_0x544178,'paused':!![],'reason':_0x1a9ef3})[_0xcebb('0x1e')](function(){if(_0x59ed03['agents'][_0x544178]){return RpcUser[_0xcebb('0x1f')](_0x59ed03[_0xcebb('0x6')][_0x544178]['id'])[_0xcebb('0x1e')](function(_0x39c0bd){if(_0x39c0bd&&!_0x39c0bd[_0xcebb('0x20')]){logger['info'](_0xcebb('0x21'),_0x1e7d36,_0x544178,_0x1978d9);var _0x3bb62a=_0x59ed03[_0xcebb('0x15')][_0x1e7d36][_0xcebb('0x22')]&&_0x59ed03[_0xcebb('0x15')][_0x1e7d36][_0xcebb('0x23')]?_0x59ed03[_0xcebb('0x15')][_0x1e7d36][_0xcebb('0x23')]:_0x1e7d36;return RpcUser[_0xcebb('0x24')](_0x59ed03[_0xcebb('0x6')][_0x544178],_0x1a9ef3,_0x3bb62a)['then'](function(){if(!_0x115a1d){_0x59ed03['timers'][_0x544178]={};logger['info'](_0xcebb('0x25'),_0x1e7d36,_0x59ed03[_0xcebb('0x5')][_0x1978d9][_0xcebb('0x26')],_0x544178,_0x1978d9);_0x59ed03[_0xcebb('0x7')][_0x544178]['timer']=setTimeout(_0x59ed03[_0xcebb('0x27')][_0xcebb('0xa')](_0x59ed03,_0x544178),_0x59ed03['voiceQueues'][_0x1978d9][_0xcebb('0x26')]*0x3e8);_0x59ed03[_0xcebb('0x7')][_0x544178][_0xcebb('0x28')]=moment()[_0xcebb('0x29')](_0xcebb('0x2a'));_0x59ed03[_0xcebb('0x7')][_0x544178]['uniqueid']=_0x1e7d36;_0x59ed03[_0xcebb('0x7')][_0x544178][_0xcebb('0x17')]=_0x1978d9;_0x59ed03[_0xcebb('0x7')][_0x544178][_0xcebb('0x2b')]=function(){var _0x4dd215=getDiff(_0x59ed03[_0xcebb('0x7')][_0x544178][_0xcebb('0x28')]);clearTimeout(_0x59ed03[_0xcebb('0x7')][_0x544178][_0xcebb('0x2c')]);_0x59ed03['timers'][_0x544178][_0xcebb('0x2c')]=![];RpcVoiceAgentReport[_0xcebb('0x2d')]({'acwtime':_0x4dd215},_0x59ed03[_0xcebb('0x7')][_0x544178]['uniqueid'],_0x544178)[_0xcebb('0x1e')](function(_0x3c3236){logger[_0xcebb('0x2e')](_0xcebb('0x2f'),_0x1e7d36,_0x4dd215,_0x3c3236);})[_0xcebb('0x30')](function(_0x56ed1c){logger[_0xcebb('0x31')](_0xcebb('0x32'),_0x1e7d36,_0x56ed1c);});delete _0x59ed03[_0xcebb('0x7')][_0x544178];};}});}else{logger[_0xcebb('0x2e')](_0xcebb('0x33'),_0x1e7d36,_0x544178,_0x1978d9);}});}})['catch'](function(){logger[_0xcebb('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1e7d36,_0x59ed03['voiceQueues'][_0x1978d9]['acwTimeout'],_0x544178,_0x1978d9);})[_0xcebb('0x34')](function(){delete _0x59ed03['channels'][_0x1e7d36];});}catch(_0x223d80){logger[_0xcebb('0x31')](_0xcebb('0x35'),_0x223d80[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')][_0xcebb('0x27')]=function(_0xa26fa8){try{var _0x152531=this;if(_0x152531[_0xcebb('0x7')][_0xa26fa8]){_0x152531[_0xcebb('0x7')][_0xa26fa8][_0xcebb('0x2c')]=![];var _0x53f022=_0x152531[_0xcebb('0x7')][_0xa26fa8]['uniqueid'];var _0x102f42=_0x152531[_0xcebb('0x7')][_0xa26fa8][_0xcebb('0x17')];var _0x167a3d=_0x152531['voiceQueues'][_0x102f42][_0xcebb('0x26')];logger[_0xcebb('0x2e')](_0xcebb('0x38'),_0x53f022,_0xa26fa8);RpcUser['saveUnpause'](this[_0xcebb('0x6')][_0xa26fa8]);RpcVoiceAgentReport[_0xcebb('0x2d')]({'acwtime':_0x167a3d,'agentacw':!![]},_0x53f022,_0xa26fa8)[_0xcebb('0x1e')](function(_0x2964f4){logger['info'](_0xcebb('0x2f'),_0x53f022,_0x167a3d,_0x2964f4);})['catch'](function(_0x117d59){logger[_0xcebb('0x31')](_0xcebb('0x32'),_0x53f022,_0x117d59);});}else{logger[_0xcebb('0x31')](_0xcebb('0x39'),_0xa26fa8);if(_0x152531[_0xcebb('0x7')]){logger[_0xcebb('0x2e')]('[ACW][TIMERS]',JSON[_0xcebb('0x3a')](_0x152531[_0xcebb('0x7')]));}}}catch(_0x5badec){logger[_0xcebb('0x31')]('[ACW][STOP]\x20%s',_0x5badec[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')][_0xcebb('0x9')]=function(_0x52dfac){try{if(this['voiceQueues'][_0x52dfac['queue']]&&(this[_0xcebb('0x5')][_0x52dfac[_0xcebb('0x17')]][_0xcebb('0x2')]||this[_0xcebb('0x5')][_0x52dfac[_0xcebb('0x17')]][_0xcebb('0x19')])){if(this['agents'][_0x52dfac['interface']]){this[_0xcebb('0x15')][_0x52dfac[_0xcebb('0x3b')]]={'queue':_0x52dfac[_0xcebb('0x17')],'interface':_0x52dfac['interface'],'destlinkedid':_0x52dfac['destlinkedid']};}}}catch(_0x4e9751){logger[_0xcebb('0x31')](_0xcebb('0x3c'),_0x4e9751[_0xcebb('0x36')]);}};Acw['prototype'][_0xcebb('0x11')]=function(_0x25a3c8){try{if(this[_0xcebb('0x5')][_0x25a3c8['queue']]&&(this[_0xcebb('0x5')][_0x25a3c8[_0xcebb('0x17')]]['acw']||this[_0xcebb('0x5')][_0x25a3c8[_0xcebb('0x17')]][_0xcebb('0x19')])){if(this[_0xcebb('0x6')][_0x25a3c8[_0xcebb('0x16')]]){this[_0xcebb('0x15')][_0x25a3c8[_0xcebb('0x3b')]]={'queue':_0x25a3c8[_0xcebb('0x17')],'interface':_0x25a3c8[_0xcebb('0x16')]};}}}catch(_0x27e108){logger[_0xcebb('0x31')](_0xcebb('0x3d'),_0x27e108['message']);}};Acw[_0xcebb('0x37')][_0xcebb('0x3e')]=function(_0x4860be){try{if(this[_0xcebb('0x15')][_0x4860be[_0xcebb('0x3b')]]&&_[_0xcebb('0x3f')](this[_0xcebb('0x15')][_0x4860be[_0xcebb('0x3b')]][_0xcebb('0x22')])){logger[_0xcebb('0x2e')]('[%s][HANGUP:UNIQUEID]',_0x4860be[_0xcebb('0x3b')]);this['startAcw'](_0x4860be[_0xcebb('0x3b')]);}else if(this[_0xcebb('0x15')][_0x4860be['linkedid']]&&_['isUndefined'](this[_0xcebb('0x15')][_0x4860be[_0xcebb('0x40')]][_0xcebb('0x22')])){logger[_0xcebb('0x2e')](_0xcebb('0x41'),_0x4860be[_0xcebb('0x40')]);this[_0xcebb('0x14')](_0x4860be[_0xcebb('0x40')]);}}catch(_0x50b576){logger[_0xcebb('0x31')](_0xcebb('0x42'),_0x50b576[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')]['syncHangup']=function(_0x279482){try{if(this['channels'][_0x279482[_0xcebb('0x3b')]]&&this[_0xcebb('0x15')][_0x279482[_0xcebb('0x3b')]][_0xcebb('0x22')]){logger[_0xcebb('0x2e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x279482[_0xcebb('0x3b')]);this[_0xcebb('0x14')](_0x279482[_0xcebb('0x3b')]);}else if(this[_0xcebb('0x15')][_0x279482['linkedid']]&&this[_0xcebb('0x15')][_0x279482[_0xcebb('0x40')]][_0xcebb('0x22')]){logger[_0xcebb('0x2e')](_0xcebb('0x43'),_0x279482[_0xcebb('0x40')]);this[_0xcebb('0x14')](_0x279482[_0xcebb('0x40')]);}}catch(_0x320904){logger['error']('[ACW][syncHangup]\x20%s',_0x320904[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')]['syncAttendedTransfer']=function(_0x441ab0){try{if(!_[_0xcebb('0x44')](this['channels'][_0x441ab0[_0xcebb('0x45')]])){this[_0xcebb('0x14')](_0x441ab0[_0xcebb('0x45')]);if(this[_0xcebb('0x15')][_0x441ab0['secondtransfereruniqueid']]){this[_0xcebb('0x15')][_0x441ab0[_0xcebb('0x46')]]['attended']=!![];this['channels'][_0x441ab0[_0xcebb('0x47')]]=this[_0xcebb('0x15')][_0x441ab0['secondtransfereruniqueid']];delete this['channels'][_0x441ab0[_0xcebb('0x46')]];}}else if(!_[_0xcebb('0x44')](this[_0xcebb('0x15')][_0x441ab0[_0xcebb('0x47')]])){this[_0xcebb('0x14')](_0x441ab0[_0xcebb('0x47')]);if(this['channels'][_0x441ab0[_0xcebb('0x48')]]){this['channels'][_0x441ab0[_0xcebb('0x48')]][_0xcebb('0x22')]=!![];this[_0xcebb('0x15')][_0x441ab0[_0xcebb('0x45')]]=this[_0xcebb('0x15')][_0x441ab0['origtransfereruniqueid']];delete this[_0xcebb('0x15')][_0x441ab0['origtransfereruniqueid']];}}}catch(_0x13e6aa){logger['error'](_0xcebb('0x49'),_0x13e6aa[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')][_0xcebb('0xf')]=function(_0x30e327){try{if(this[_0xcebb('0x15')][_0x30e327[_0xcebb('0x4a')]]){logger[_0xcebb('0x2e')](_0xcebb('0x4b'),JSON[_0xcebb('0x3a')](_0x30e327['transfereruniqueid']));this[_0xcebb('0x14')](_0x30e327[_0xcebb('0x4a')]);}else if(this[_0xcebb('0x15')][_0x30e327[_0xcebb('0x4c')]]){logger[_0xcebb('0x2e')](_0xcebb('0x4d'),JSON[_0xcebb('0x3a')](_0x30e327[_0xcebb('0x4c')]));this[_0xcebb('0x14')](_0x30e327[_0xcebb('0x4c')]);}}catch(_0xad6340){logger[_0xcebb('0x31')](_0xcebb('0x4e'),_0xad6340[_0xcebb('0x36')]);}};Acw[_0xcebb('0x37')]['syncAgentRingNoAnswer']=function(_0x11d22c){try{if(this[_0xcebb('0x5')][_0x11d22c[_0xcebb('0x17')]]&&this[_0xcebb('0x5')][_0x11d22c['queue']][_0xcebb('0x4f')]===_0xcebb('0x50')){if(this[_0xcebb('0x6')][_0x11d22c['interface']]){logger['info'](_0xcebb('0x51'),_0x11d22c['uniqueid'],_0x11d22c[_0xcebb('0x16')],_0x11d22c[_0xcebb('0x17')]);return RpcUser[_0xcebb('0x24')](this[_0xcebb('0x6')][_0x11d22c['interface']],_0xcebb('0x52'),_0x11d22c[_0xcebb('0x3b')]);}}}catch(_0x490500){logger['error'](_0xcebb('0x53'),_0x490500[_0xcebb('0x36')]);}};module[_0xcebb('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9f72de3..938826d 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 _0xb250=['queuesummary','actionCoreShowChannels','once','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','../../config/logger','ami','asterisk','port','username','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary'];(function(_0x1703e2,_0x4f91b9){var _0x22e735=function(_0x279359){while(--_0x279359){_0x1703e2['push'](_0x1703e2['shift']());}};_0x22e735(++_0x4f91b9);}(_0xb250,0x1db));var _0x0b25=function(_0x2b6834,_0x1835e3){_0x2b6834=_0x2b6834-0x0;var _0x22504d=_0xb250[_0x2b6834];return _0x22504d;};'use strict';var Manager=require(_0x0b25('0x0'));var BPromise=require(_0x0b25('0x1'));var util=require('util');var logger=require(_0x0b25('0x2'))(_0x0b25('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x0b25('0x4')][_0x0b25('0x5')],config[_0x0b25('0x4')]['ip'],config[_0x0b25('0x4')][_0x0b25('0x6')],config[_0x0b25('0x4')]['password'],!![]);ami['keepConnected']();ami[_0x0b25('0x7')]=BPromise[_0x0b25('0x8')](ami[_0x0b25('0x9')]);function error(_0x369531){logger[_0x0b25('0xa')](util[_0x0b25('0xb')](_0x0b25('0xc'),config[_0x0b25('0x4')][_0x0b25('0x6')],config[_0x0b25('0x4')]['ip'],config['asterisk'][_0x0b25('0x5')],util[_0x0b25('0xd')](_0x369531,![],null)));}function close(){logger[_0x0b25('0xa')](util[_0x0b25('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x0b25('0x4')][_0x0b25('0x6')],config[_0x0b25('0x4')]['ip'],config[_0x0b25('0x4')][_0x0b25('0x5')]));}ami[_0x0b25('0xe')]=function(){return function(){return ami[_0x0b25('0x7')]({'action':_0x0b25('0xf')});};};ami[_0x0b25('0x10')]=function(){return function(){return ami[_0x0b25('0x7')]({'action':'devicestatelist'});};};ami[_0x0b25('0x11')]=function(){return function(){return ami[_0x0b25('0x7')]({'action':_0x0b25('0x12')});};};ami[_0x0b25('0x13')]=function(){return function(){return ami[_0x0b25('0x7')]({'action':_0x0b25('0x14')});};};ami[_0x0b25('0x15')]=function(){return function(){return ami[_0x0b25('0x7')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x0b25('0x4')][_0x0b25('0x6')],config[_0x0b25('0x4')]['ip'],config[_0x0b25('0x4')][_0x0b25('0x5')]));ami[_0x0b25('0x16')](_0x0b25('0xa'),error);ami['once']('close',close);}ami['on'](_0x0b25('0x17'),connect);ami['on']('shutdown',function(_0x125f51){logger[_0x0b25('0x18')](util['format'](_0x0b25('0x19'),config['asterisk'][_0x0b25('0x6')],config['asterisk']['ip'],config[_0x0b25('0x4')]['port'],util[_0x0b25('0xd')](_0x125f51,![],null)));});ami['on'](_0x0b25('0x1a'),function(){logger[_0x0b25('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0b25('0x4')][_0x0b25('0x6')],config[_0x0b25('0x4')]['ip'],config['asterisk'][_0x0b25('0x5')]));return Promise[_0x0b25('0x1b')]()['then'](ami['actionSipShowRegistry']())[_0x0b25('0x1c')](ami[_0x0b25('0x10')]())['then'](ami[_0x0b25('0x11')]())[_0x0b25('0x1c')](ami[_0x0b25('0x13')]())[_0x0b25('0x1c')](ami[_0x0b25('0x15')]())[_0x0b25('0x1d')](function(_0x95bb41){logger['error'](_0x0b25('0x1e'),util[_0x0b25('0xd')](_0x95bb41,{'showHidden':![],'depth':null}));});});ami[_0x0b25('0x16')](_0x0b25('0xa'),error);ami[_0x0b25('0x16')](_0x0b25('0x1f'),close);module[_0x0b25('0x20')]=ami; \ No newline at end of file +var _0xeec8=['info','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','ami','../../config/environment','port','asterisk','password','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xeec8,0x181));var _0x8eec=function(_0x1524cf,_0xa0c0a7){_0x1524cf=_0x1524cf-0x0;var _0xd8a91a=_0xeec8[_0x1524cf];return _0xd8a91a;};'use strict';var Manager=require(_0x8eec('0x0'));var BPromise=require(_0x8eec('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x8eec('0x2'));var config=require(_0x8eec('0x3'));var ami=new Manager(config['asterisk'][_0x8eec('0x4')],config[_0x8eec('0x5')]['ip'],config[_0x8eec('0x5')]['username'],config[_0x8eec('0x5')][_0x8eec('0x6')],!![]);ami[_0x8eec('0x7')]();ami[_0x8eec('0x8')]=BPromise['promisify'](ami['action']);function error(_0x48903a){logger[_0x8eec('0x9')](util[_0x8eec('0xa')](_0x8eec('0xb'),config[_0x8eec('0x5')][_0x8eec('0xc')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x8eec('0xd')](_0x48903a,![],null)));}function close(){logger[_0x8eec('0x9')](util[_0x8eec('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8eec('0x5')][_0x8eec('0xc')],config['asterisk']['ip'],config['asterisk'][_0x8eec('0x4')]));}ami[_0x8eec('0xe')]=function(){return function(){return ami[_0x8eec('0x8')]({'action':'sipshowregistry'});};};ami[_0x8eec('0xf')]=function(){return function(){return ami['Action']({'action':_0x8eec('0x10')});};};ami[_0x8eec('0x11')]=function(){return function(){return ami[_0x8eec('0x8')]({'action':_0x8eec('0x12')});};};ami[_0x8eec('0x13')]=function(){return function(){return ami[_0x8eec('0x8')]({'action':_0x8eec('0x14')});};};ami[_0x8eec('0x15')]=function(){return function(){return ami[_0x8eec('0x8')]({'action':_0x8eec('0x16')});};};function connect(){logger[_0x8eec('0x17')](util[_0x8eec('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x8eec('0x5')]['username'],config[_0x8eec('0x5')]['ip'],config[_0x8eec('0x5')]['port']));ami[_0x8eec('0x18')]('error',error);ami[_0x8eec('0x18')](_0x8eec('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x8eec('0x1a'),function(_0x173494){logger[_0x8eec('0x17')](util['format'](_0x8eec('0x1b'),config[_0x8eec('0x5')]['username'],config['asterisk']['ip'],config[_0x8eec('0x5')][_0x8eec('0x4')],util[_0x8eec('0xd')](_0x173494,![],null)));});ami['on']('fullybooted',function(){logger['info'](util['format'](_0x8eec('0x1c'),config[_0x8eec('0x5')][_0x8eec('0xc')],config['asterisk']['ip'],config[_0x8eec('0x5')][_0x8eec('0x4')]));return Promise[_0x8eec('0x1d')]()[_0x8eec('0x1e')](ami['actionSipShowRegistry']())[_0x8eec('0x1e')](ami[_0x8eec('0xf')]())[_0x8eec('0x1e')](ami[_0x8eec('0x11')]())['then'](ami[_0x8eec('0x13')]())[_0x8eec('0x1e')](ami['actionCoreShowChannels']())[_0x8eec('0x1f')](function(_0x3de55f){logger[_0x8eec('0x9')](_0x8eec('0x20'),util[_0x8eec('0xd')](_0x3de55f,{'showHidden':![],'depth':null}));});});ami[_0x8eec('0x18')](_0x8eec('0x9'),error);ami['once'](_0x8eec('0x19'),close);module[_0x8eec('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 441e16e..40ce423 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x25a45a,_0x156e4b){var _0x237f87=function(_0x17c9e5){while(--_0x17c9e5){_0x25a45a['push'](_0x25a45a['shift']());}};_0x237f87(++_0x156e4b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x38e581,_0x50e774){_0x38e581=_0x38e581-0x0;var _0x110486=_0xf4eb[_0x38e581];return _0x110486;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe706,0xa3));var _0x6e70=function(_0x312440,_0x10c4aa){_0x312440=_0x312440-0x0;var _0x145314=_0xe706[_0x312440];return _0x145314;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0b7923a..6ca8a17 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 _0x7c5e=['hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','syncQueueStatusComplete','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','NULL_INTERVAL','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','true','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','syncCampaigns','undefined','checkIfTime','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','dialGlobalInterval','silly','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','callAdditionalPhoneAfterMin','countabandonedretry','dialAbandonedMaxRetry','ContactId','ListId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','value','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD]','outboundAnswerAgiCallsDay','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','HANGUP','[syncHangupInAMDIvr]','stateGlobal','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','pTalking','ACTIVE','queueSummaryCountersUpdated','assign','[syncQueueSummary]','syncQueueSummaryComplete','dialPreviewRecallmeReminder','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','resolve','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','countnosuchnumberretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyRetryFrequency','reason\x205\x20busy','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','loggedIn','outboundQueuePauses','predictiveIntervalPauses','floor','milliseconds','[handlePredictive]','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','NO_AVAILABLE_CONTACTS','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','RUNNING','checkIsBlackList','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\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','Umin\x20=\x20','exports','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete'];(function(_0x2a036a,_0x2cbbdf){var _0xee0b06=function(_0x26c9a4){while(--_0x26c9a4){_0x2a036a['push'](_0x2a036a['shift']());}};_0xee0b06(++_0x2cbbdf);}(_0x7c5e,0x1dd));var _0xe7c5=function(_0x295c7d,_0x1104a4){_0x295c7d=_0x295c7d-0x0;var _0x4f44b7=_0x7c5e[_0x295c7d];return _0x4f44b7;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0xe7c5('0x0'));var moment=require(_0xe7c5('0x1'));var rr=require('rr');var Redis=require(_0xe7c5('0x2'));var utils=require(_0xe7c5('0x3'));var hopperUtils=require(_0xe7c5('0x4'));var ut=require(_0xe7c5('0x5'));var config=require(_0xe7c5('0x6'));var logger=require(_0xe7c5('0x7'))(_0xe7c5('0x8'));var loggerBooked=require(_0xe7c5('0x7'))(_0xe7c5('0x9'));var loggerPredictive=require(_0xe7c5('0x7'))(_0xe7c5('0xa'));var loggerPredictiveCalls=require(_0xe7c5('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe7c5('0x7'))('syncQueueSummary');var ami=require(_0xe7c5('0xb'));config['redis']=_[_0xe7c5('0xc')](config[_0xe7c5('0xd')],{'host':_0xe7c5('0xe'),'port':0x18eb});var io=require(_0xe7c5('0xf'))(new Redis(config[_0xe7c5('0xd')]));var cmHopper=require(_0xe7c5('0x10'));var voiceQueueRt=require(_0xe7c5('0x11'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0xe7c5('0x12'));var AgentComplete=require(_0xe7c5('0x13'));var QueueCallerAbandon=require(_0xe7c5('0x14'));var Hangup=require(_0xe7c5('0x15'));var ipAgi=process[_0xe7c5('0x16')]['XCALLY_IP_AGI']||_0xe7c5('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe7c5('0x18')][_0xe7c5('0x19')]=function(_0x1cce85){this[_0xe7c5('0x1a')]=this[_0xe7c5('0x1a')]?this[_0xe7c5('0x1a')][_0xe7c5('0x1b')](_0x1cce85):_0x1cce85();};function Dialer(_0x4f768f,_0x2be580){this[_0xe7c5('0x1c')]=new Sequence();this[_0xe7c5('0x1d')]=_0x2be580;this[_0xe7c5('0x1e')]=_0x4f768f[_0xe7c5('0x1e')];this['campaigns']=_0x4f768f[_0xe7c5('0x1f')];this[_0xe7c5('0x20')]=_0x4f768f['agents'];this[_0xe7c5('0x21')]=_0x4f768f[_0xe7c5('0x21')];this[_0xe7c5('0x22')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xe7c5('0x23')]={};this[_0xe7c5('0x24')]={};this[_0xe7c5('0x25')]={};this['optionPredictive']={};this[_0xe7c5('0x26')]={};this[_0xe7c5('0x27')]={};this['ivrOriginated']={};this[_0xe7c5('0x28')]={};this[_0xe7c5('0x29')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xe7c5('0x2a')]['bind'](this));ami['on'](_0xe7c5('0x2b'),this['syncQueueCallerAbandon'][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x2d'),this[_0xe7c5('0x2e')][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x2f'),this[_0xe7c5('0x30')]['bind'](this));ami['on'](_0xe7c5('0x31'),this['syncQueueSummary'][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x32'),this['syncQueueSummaryComplete'][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x33'),this[_0xe7c5('0x34')][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x35'),this[_0xe7c5('0x36')][_0xe7c5('0x2c')](this));ami['on'](_0xe7c5('0x37'),this['syncVarSet'][_0xe7c5('0x2c')](this));ami['on']('queuemember',this[_0xe7c5('0x38')][_0xe7c5('0x2c')](this));ami['on']('queuestatuscomplete',this[_0xe7c5('0x39')][_0xe7c5('0x2c')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0xe7c5('0x3a')](function(_0x18ca5e){previewRecallmeReminderInterval=_0x18ca5e[_0xe7c5('0x3b')];});}function isNotNull(_0x58d9eb){return _0x58d9eb!==null&&!_[_0xe7c5('0x3c')](_0x58d9eb);}function msgResponse(_0x3b0738,_0x1146bb,_0x28a45c){return{'action':_0x3b0738,'response':_0x1146bb,'message':_0x28a45c,'stack':_0x28a45c};}function emit(_0x51bb49,_0x24e892,_0x1f2db0){io['to'](_0x51bb49)[_0xe7c5('0x3d')](_0x24e892,_0x1f2db0);}function emitOutboundVoiceQueueSummary(_0x18dcb5){if(_0x18dcb5[_0xe7c5('0x3e')]==='outbound'){logger[_0xe7c5('0x3f')](_0xe7c5('0x40'),util[_0xe7c5('0x41')](_0x18dcb5,{'showHidden':![],'depth':null}));emit(util[_0xe7c5('0x42')](_0xe7c5('0x43'),_0x18dcb5[_0xe7c5('0x44')]),'voice_queue:save',_0x18dcb5);}}function checkGetDataPredictive(_0x1d2edb){if(isNotNull(_0x1d2edb)&&!_['isEmpty'](_0x1d2edb)){loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x46'));loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x47'),_0x1d2edb[_0xe7c5('0x48')]);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x49'),_0x1d2edb[_0xe7c5('0x4a')]);loggerPredictive[_0xe7c5('0x45')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d2edb[_0xe7c5('0x4b')]);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x4c'),_0x1d2edb[_0xe7c5('0x4d')]);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x4e'),_0x1d2edb['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x4f'),_0x1d2edb[_0xe7c5('0x50')]);loggerPredictive['info'](_0xe7c5('0x51'));if(_0x1d2edb['predictiveIntervalTotalCalls']>0x0){if(!_[_0xe7c5('0x3c')](_0x1d2edb[_0xe7c5('0x50')])&&_0x1d2edb['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xe7c5('0x52'));if(!_[_0xe7c5('0x3c')](_0x1d2edb[_0xe7c5('0x53')])&&_0x1d2edb[_0xe7c5('0x53')]>0x0){return!![];}loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x54'));}else{loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x55'));}}else{loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x56'));}return![];}function mergeDataErlangB(_0x2756ec){return function(_0x597b45){loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x57'));loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x58'),_0x597b45[_0xe7c5('0x59')]);loggerPredictive[_0xe7c5('0x45')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597b45[_0xe7c5('0x5a')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x597b45[_0xe7c5('0x5b')]);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x5c'),_0x597b45['erlangBusyFactor']);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x5d'),_0x597b45[_0xe7c5('0x5b')]);loggerPredictive[_0xe7c5('0x45')]('---------------------------');_[_0xe7c5('0x5e')](_0x2756ec,_0x597b45);};}function ifInterval(_0x3a4474,_0x4b25df){if(_[_0xe7c5('0x3c')](_0x4b25df)){return![];}return utils[_0xe7c5('0x5f')](undefined,_0x4b25df)<_0x3a4474*0x3c;}function clearPredictiveAttributes(_0x5ce5ae){if(_0x5ce5ae[_0xe7c5('0x27')]){_0x5ce5ae[_0xe7c5('0x27')]=undefined;loggerPredictive[_0xe7c5('0x3f')](_0x5ce5ae[_0xe7c5('0x44')],_0xe7c5('0x60'));}if(_0x5ce5ae[_0xe7c5('0x26')]){_0x5ce5ae[_0xe7c5('0x26')]=undefined;loggerPredictive['debug'](_0x5ce5ae[_0xe7c5('0x44')],_0xe7c5('0x61'));}if(_0x5ce5ae[_0xe7c5('0x62')]){clearInterval(_0x5ce5ae[_0xe7c5('0x62')]);_0x5ce5ae[_0xe7c5('0x62')]=undefined;loggerPredictive[_0xe7c5('0x3f')](_0x5ce5ae[_0xe7c5('0x44')],_0xe7c5('0x63'));}}function loggerCatchPredictive(_0x155b87,_0x43a4d1){return function(_0x39df22){loggerPredictive[_0xe7c5('0x64')](_0x43a4d1[_0xe7c5('0x44')],_0x155b87);loggerPredictive[_0xe7c5('0x64')](_0x39df22[_0xe7c5('0x65')]);clearPredictiveAttributes(_0x43a4d1);};}function loggerCatch(_0x5cd8b4){return function(_0x3905c6){logger[_0xe7c5('0x64')](_0x5cd8b4,util[_0xe7c5('0x41')](_0x3905c6,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x56cc2f,_0xf1cb8b,_0x52ec82){return function(_0x5a4dbb){utils[_0xe7c5('0x66')](_0xf1cb8b,_0x52ec82,0x0);logger[_0xe7c5('0x64')](_0x56cc2f,util[_0xe7c5('0x41')](_0x5a4dbb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2e02a6){return function(_0x1e604a){if(isNotNull(_0x1e604a)&&isNotNull(_0x1e604a[0x0])){if(_0x1e604a[0x0]['contactsRescheduled']>0x0){_0x2e02a6[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x69')];logger[_0xe7c5('0x45')](_0xe7c5('0x6a')+_0x2e02a6[_0xe7c5('0x44')],_0x1e604a[0x0][_0xe7c5('0x6b')],'contacts');}else{_0x2e02a6[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xe7c5('0x6c')+_0x2e02a6[_0xe7c5('0x44')]);}}};}function createObjHistory(_0x51d64a,_0x16f9ea,_0x95971d,_0x523a7c,_0x2b0981){_0x51d64a[_0xe7c5('0x67')]=_0x95971d;var _0x3aac8c=new Action(_0x51d64a,_0x16f9ea);var _0x3c20d2=new History(_0x3aac8c);_0x3c20d2[_0xe7c5('0x6d')]=_0x523a7c;_0x3c20d2[_0xe7c5('0x6e')]=_0x2b0981;_0x3c20d2[_0xe7c5('0x6f')]=_0x3aac8c[_0xe7c5('0x70')];return _0x3c20d2;}function unlockQueueStatus(_0x4a1e7e,_0x58d36d){setTimeout(function(){if(_[_0xe7c5('0x3c')](_0x4a1e7e['queueStatusComplete'])){loggerBooked[_0xe7c5('0x64')](_0xe7c5('0x71'),_0x58d36d);}_0x4a1e7e[_0xe7c5('0x72')]=!![];loggerBooked[_0xe7c5('0x45')](_0xe7c5('0x73'),_0x58d36d,JSON[_0xe7c5('0x74')](_[_0xe7c5('0x75')](_0x4a1e7e,[_0xe7c5('0x44'),_0xe7c5('0x72')])));},0x1f3);}function checkInterval(_0x11f945){return function(){if(!isNotNull(_0x11f945[_0xe7c5('0x76')])){_0x11f945['message']=utils[_0xe7c5('0x68')]['NULL_INTERVAL'];throw _0x11f945[_0xe7c5('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x11f945[_0xe7c5('0x76')][_0xe7c5('0x77')])){_0x11f945[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')]['NULL_INTERVAL'];throw _0x11f945[_0xe7c5('0x44')]+_0xe7c5('0x78');}if(!isNotNull(_[_0xe7c5('0x79')](_0x11f945['Interval'][_0xe7c5('0x77')]))){_0x11f945[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x7a')];throw _0x11f945[_0xe7c5('0x44')]+_0xe7c5('0x78');}};}function checkIsIVRCampaignActive(_0x6506aa){return function(){if(!utils[_0xe7c5('0x7b')](_0x6506aa)){_0x6506aa[_0xe7c5('0x67')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x6506aa['name']+_0xe7c5('0x7c');}};}function emitCampaignSummary(_0x22c8a8){if(utils[_0xe7c5('0x7d')](_0x22c8a8)){emit(util[_0xe7c5('0x42')](_0xe7c5('0x7e'),_0x22c8a8[_0xe7c5('0x44')]),_0xe7c5('0x7f'),_0x22c8a8);}}function loggerCatchQueueSummary(_0x3541a0,_0x4a1817){return function(_0x4171c1){clearPredictiveAttributes(_0x4a1817);emitCampaignSummary(_0x4a1817);loggerSyncQueueSummary[_0xe7c5('0x3f')](_0x3541a0,util[_0xe7c5('0x41')](_0x4171c1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x44eac7){if(_0x44eac7[_0xe7c5('0x80')]){if(_0x44eac7[_0xe7c5('0x81')]===0x0){_0x44eac7[_0xe7c5('0x80')]=![];_0x44eac7[_0xe7c5('0x67')]=utils['CAMPAIGN_STATUS'][_0xe7c5('0x82')];loggerSyncQueueSummary[_0xe7c5('0x3f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x44eac7[_0xe7c5('0x44')],_0xe7c5('0x83'));}else{_0x44eac7[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x84')];loggerSyncQueueSummary[_0xe7c5('0x3f')](_0xe7c5('0x85'),_0x44eac7['name'],_0xe7c5('0x86'));}emitCampaignSummary(_0x44eac7);}}function myreject(_0x558ff6){return function(_0x4b6b79){return _0x558ff6(msgResponse(_0xe7c5('0x87'),_0xe7c5('0x88'),JSON['stringify'](_0x4b6b79)));};}Dialer[_0xe7c5('0x18')]['isTrunkReachable']=function(_0x5b0556){return!_[_0xe7c5('0x3c')](_0x5b0556)&&_0x5b0556&&!_[_0xe7c5('0x3c')](_0x5b0556[_0xe7c5('0x44')])&&!_['isUndefined'](_0x5b0556['active'])&&_0x5b0556['active']&&(this[_0xe7c5('0x21')][util[_0xe7c5('0x42')](_0xe7c5('0x89'),_0x5b0556[_0xe7c5('0x44')])]['status']===_0xe7c5('0x8a')||this[_0xe7c5('0x21')][util[_0xe7c5('0x42')](_0xe7c5('0x89'),_0x5b0556['name'])][_0xe7c5('0x8b')]===_0xe7c5('0x8c'));};Dialer[_0xe7c5('0x18')][_0xe7c5('0x8d')]=function(_0x47e161){var _0x212fbb=this;return function(){if(!_0x212fbb['isTrunkReachable'](_0x47e161[_0xe7c5('0x8e')])){if(!_0x212fbb[_0xe7c5('0x8f')](_0x47e161[_0xe7c5('0x90')])){_0x47e161[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x91')];throw _0x47e161[_0xe7c5('0x44')]+_0xe7c5('0x92');}}};};Dialer[_0xe7c5('0x18')]['checkIfTime']=function(_0x2ac394,_0x59c541,_0x5bfc39,_0x3f0690){var _0x3400bf=this;return function(){var _0x3e307c=!![];return _0x3400bf['ifTimeIvr'](_0x2ac394,_0x59c541,_0x5bfc39,_0x3f0690,_0x3e307c);};};Dialer[_0xe7c5('0x18')][_0xe7c5('0x93')]=function(_0x5be2f2,_0x43e0ce,_0x418780,_0x516d20){var _0x373858=this;return function(){var _0x341e05=![];return _0x373858[_0xe7c5('0x94')](_0x5be2f2[_0xe7c5('0x77')],_0x43e0ce,_0x418780,_0x516d20,_0x341e05);};};Dialer[_0xe7c5('0x18')]['ifTimeIvr']=function(_0x333b68,_0x53823e,_0x22662d,_0x33acf2,_0x3488ea){var _0x2efb6c=[];return new Promise(function(_0x5a9a16,_0x563ab5){if(!isNotNull(_0x333b68)){_0x33acf2['message']=utils[_0xe7c5('0x68')][_0xe7c5('0x7a')];return _0x563ab5(msgResponse(_0xe7c5('0x95'),_0xe7c5('0x96'),_0x22662d+_0xe7c5('0x97')));}if(_[_0xe7c5('0x79')](_0x333b68)){_0x33acf2['message']=utils[_0xe7c5('0x68')]['EMPTY_INTERVAL'];return _0x563ab5(msgResponse(_0xe7c5('0x95'),'Failure',_0x22662d+_0xe7c5('0x98')));}if(_0x53823e&&_[_0xe7c5('0x3c')](config[_0xe7c5('0x99')][_0x53823e])){_0x33acf2[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x9a')];return _0x563ab5(msgResponse(_0xe7c5('0x95'),_0xe7c5('0x96'),_0x22662d+_0xe7c5('0x9b')+_0x53823e));}if(_[_0xe7c5('0x9c')](_0x333b68)){for(var _0x8399b=0x0;_0x8399b<_0x333b68[_0xe7c5('0x9d')];_0x8399b+=0x1){_0x2efb6c[_0xe7c5('0x9e')](ami[_0xe7c5('0x9f')]({'action':_0xe7c5('0xa0'),'command':util[_0xe7c5('0x42')](_0xe7c5('0xa1'),_0x333b68[_0x8399b][_0xe7c5('0xa2')],!_[_0xe7c5('0x3c')](config[_0xe7c5('0x99')][_0x53823e])?_0x53823e:'')})['then'](function(_0x23ba88){return _0x23ba88[_0xe7c5('0xa3')][_0xe7c5('0xa4')]('true')>=0x0;})[_0xe7c5('0xa5')](myreject(_0x563ab5)));}}else{_0x2efb6c['push'](ami['Action']({'action':'command','command':util[_0xe7c5('0x42')]('iftime\x20%s,%s',_0x333b68,!_[_0xe7c5('0x3c')](config[_0xe7c5('0x99')][_0x53823e])?_0x53823e:'')})[_0xe7c5('0x3a')](function(_0x40bd1c){return _0x40bd1c[_0xe7c5('0xa3')]['indexOf'](_0xe7c5('0xa6'))>=0x0;})[_0xe7c5('0xa5')](myreject(_0x563ab5)));}Promise[_0xe7c5('0xa7')](_0x2efb6c)['then'](function(_0x2db722){var _0x1df652=_[_0xe7c5('0xa8')](_0x2db722);if(_0x1df652){return _0x5a9a16(_0x1df652);}else{_0x33acf2['message']=_0x3488ea?utils[_0xe7c5('0x68')][_0xe7c5('0xa9')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x563ab5(msgResponse(_0xe7c5('0xaa'),_0xe7c5('0x96'),_0xe7c5('0xab')+_0x3488ea+'\x20'+_0x22662d+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe7c5('0x41')](_0x333b68,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x53823e));}})[_0xe7c5('0xa5')](function(_0x3779fb){return _0x563ab5(msgResponse(_0xe7c5('0x95'),_0xe7c5('0x96'),JSON['stringify'](_0x3779fb)));});});};Dialer[_0xe7c5('0x18')]['loopCampaigns']=function(){var _0x540a64=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xe7c5('0x3a')](function(){setInterval(function(){_0x540a64[_0xe7c5('0xac')]();},0x3e8);});};Dialer['prototype'][_0xe7c5('0xac')]=function(){var _0x2174a8=this;var _0x4961c3;for(var _0x1c3981 in this[_0xe7c5('0x1f')]){if(typeof this[_0xe7c5('0x1f')][_0x1c3981]!==_0xe7c5('0xad')){_0x4961c3=this[_0xe7c5('0x1f')][_0x1c3981];if(utils['isIVRCampaign'](_0x4961c3)&&utils[_0xe7c5('0x7b')](_0x4961c3)){_0x4961c3['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xe7c5('0x3a')](checkIsIVRCampaignActive(_0x4961c3))[_0xe7c5('0x3a')](checkInterval(_0x4961c3))[_0xe7c5('0x3a')](_0x2174a8['checkIsTrunkReachable'](_0x4961c3))[_0xe7c5('0x3a')](_0x2174a8[_0xe7c5('0xae')](_0x4961c3['dialGlobalInterval'],_0x4961c3[_0xe7c5('0xaf')],_0x4961c3[_0xe7c5('0x44')],_0x4961c3))[_0xe7c5('0x3a')](_0x2174a8[_0xe7c5('0x93')](_0x4961c3[_0xe7c5('0x76')],_0x4961c3[_0xe7c5('0xaf')],_0x4961c3['name'],_0x4961c3))[_0xe7c5('0x3a')](_0x2174a8[_0xe7c5('0xb0')](_0x4961c3))[_0xe7c5('0xa5')](loggerCatchQueueSummary(_0xe7c5('0xb1'),_0x4961c3));}else{notSendMessagesCampaign(_0x4961c3);}}}};Dialer['prototype'][_0xe7c5('0xb2')]=function(_0x4aa9ce){if(_0x4aa9ce[_0xe7c5('0xb3')]!==_0xe7c5('0xa')){clearPredictiveAttributes(_0x4aa9ce);}switch(_0x4aa9ce[_0xe7c5('0xb3')]){case'progressive':this[_0xe7c5('0xb4')](_0x4aa9ce,0x1);break;case _0xe7c5('0xb5'):this[_0xe7c5('0xb4')](_0x4aa9ce,_0x4aa9ce[_0xe7c5('0xb6')]);break;case'predictive':this['predictive'](_0x4aa9ce);break;case _0xe7c5('0x9'):this[_0xe7c5('0xb4')](_0x4aa9ce,0x1);break;default:logger['error']('Queue',_0x4aa9ce[_0xe7c5('0x44')],'method\x20not\x20recognized');}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x95')]=function(_0x3c4015,_0x7faea0){var _0x24e86c=_0x3c4015[_0xe7c5('0xaf')];var _0xf9e522=_0x7faea0?_0x3c4015[_0xe7c5('0xb7')]:_0x3c4015[_0xe7c5('0x76')]['Intervals'];logger[_0xe7c5('0xb8')]('Dialer::ifTime()',_0xf9e522,_0x24e86c,_0x3c4015[_0xe7c5('0x44')],util[_0xe7c5('0x42')]('Voice\x20Queue\x20%s\x20$s',_0x3c4015['name'],_0x3c4015['id']));var _0x5d3663=null;return Interval[_0xe7c5('0xb9')](_0xf9e522,_0x24e86c)['then'](function(_0x50c45b){if(_0x50c45b===!![]){return _0x50c45b;}else{_0x3c4015['message']=_0x7faea0?utils[_0xe7c5('0x68')][_0xe7c5('0xa9')]:utils[_0xe7c5('0x68')]['OVERTIME_INTERVAL'];_0x5d3663=msgResponse('[ifTime][promiseAll]',_0xe7c5('0x96'),_0xe7c5('0xab')+_0x7faea0+'\x20'+_0x3c4015[_0xe7c5('0x44')]+_0xe7c5('0xba')+util[_0xe7c5('0x41')](_0xf9e522,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x24e86c);}if(_0x5d3663!==null){logger[_0xe7c5('0xb8')](_0xe7c5('0xbb'),_0x5d3663);_0x5d3663[_0xe7c5('0xbc')]=_0x7faea0;throw _0x5d3663;}})[_0xe7c5('0xa5')](function(_0x5eed56){logger['error'](_0xe7c5('0xbd'),_0x5eed56);throw msgResponse('[ifTime][Action]',_0xe7c5('0x88'),util[_0xe7c5('0x41')](_0x5eed56,{'showHidden':![],'depth':null}));});};Dialer[_0xe7c5('0x18')][_0xe7c5('0x2a')]=function(_0x218435){if(this[_0xe7c5('0x1e')][_0x218435['queue']]){if(this[_0xe7c5('0x25')][_0x218435['uniqueid']]&&this['uniqueId'][_0x218435[_0xe7c5('0xbe')]]['type']!==_0xe7c5('0xbf')){this[_0xe7c5('0xc0')](this[_0xe7c5('0x1e')][_0x218435[_0xe7c5('0xc1')]]);this[_0xe7c5('0x25')][_0x218435[_0xe7c5('0xbe')]][_0xe7c5('0xc2')]=moment()['format'](_0xe7c5('0xc3'));}}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x30')]=function(_0x1bd2f6){var _0x1da4cd=this['uniqueId'][_0x1bd2f6['uniqueid']];if(this[_0xe7c5('0x1e')][_0x1bd2f6[_0xe7c5('0xc1')]]){if(_0x1da4cd&&_0x1da4cd[_0xe7c5('0x3e')]!==_0xe7c5('0xbf')){delete this[_0xe7c5('0x25')][_0x1bd2f6['uniqueid']];this[_0xe7c5('0x1e')][_0x1bd2f6[_0xe7c5('0xc1')]]['outboundAnswerCallsDay']+=0x1;var _0x59d29a=new AgentComplete(_0x1da4cd,_0x1bd2f6);if(_0x1bd2f6[_0xe7c5('0xc4')]===_0xe7c5('0xc5')){_0x59d29a[_0xe7c5('0xc6')]=this['voiceQueues'][_0x1bd2f6[_0xe7c5('0xc1')]][_0xe7c5('0xc7')]&&this[_0xe7c5('0x1e')][_0x1bd2f6['queue']][_0xe7c5('0xc8')]?moment()[_0xe7c5('0x42')](_0xe7c5('0xc3')):undefined;}hopperUtils['createHistory'](_0x59d29a)[_0xe7c5('0xa5')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xe7c5('0xc9')](_0x59d29a)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xca')));}}};Dialer[_0xe7c5('0x18')]['syncQueueCallerAbandon']=function(_0x18ffd6){var _0x3e7663=this[_0xe7c5('0x25')][_0x18ffd6[_0xe7c5('0xbe')]];var _0x19cb98=this;var _0x23b92e=![];var _0x575d1c;var _0xbad118;if(this[_0xe7c5('0x1e')][_0x18ffd6['queue']]){if(_0x3e7663&&_0x3e7663[_0xe7c5('0x3e')]!==_0xe7c5('0xbf')){delete this[_0xe7c5('0x25')][_0x18ffd6[_0xe7c5('0xbe')]];this[_0xe7c5('0xc0')](this['voiceQueues'][_0x18ffd6['queue']]);_0x3e7663[_0xe7c5('0xcb')]=moment()['format'](_0xe7c5('0xc3'));var _0x1eff7b=new QueueCallerAbandon(_0x3e7663,_0x18ffd6);if(utils['getSeconds'](_0x3e7663[_0xe7c5('0xcb')],_0x3e7663[_0xe7c5('0xcc')])>=_0x3e7663['dialQueueTimeout']){this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xcd')]+=0x1;this[_0xe7c5('0x1e')][_0x18ffd6['queue']][_0xe7c5('0xce')]+=0x1;_0x1eff7b[_0xe7c5('0x6d')]=0xa;_0x1eff7b['statedesc']=_0xe7c5('0xcf');_0x1eff7b[_0xe7c5('0xd0')]=_0xe7c5('0xd1');_0x1eff7b[_0xe7c5('0xc6')]=this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1eff7b[_0xe7c5('0xd2')]+=0x1;_0x1eff7b[_0xe7c5('0xd3')]+=0x1;_0x575d1c=this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xd4')];_0xbad118=this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xe7c5('0xd5')](_0x1eff7b,_0x1eff7b[_0xe7c5('0x6d')],_0x3e7663[_0xe7c5('0xd6')])[_0xe7c5('0x3a')](function(_0x3b550b){_0x23b92e=_0x3b550b[_0xe7c5('0xd7')]==0x1;if(_0x1eff7b[_0xe7c5('0xd2')]>=_0x19cb98[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xd8')]){_0x19cb98[_0xe7c5('0xd9')](_0x1eff7b,_0x3b550b['additional']);}else{hopperUtils[_0xe7c5('0xda')]({'active':![],'countdropretry':_0x1eff7b[_0xe7c5('0xd2')],'scheduledat':moment()[_0xe7c5('0xdb')](_0x19cb98[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xd4')],_0xe7c5('0xdc'))['format'](_0xe7c5('0xc3')),'ContactId':_0x3e7663['ContactId'],'ListId':_0x3e7663['ListId'],'VoiceQueueId':_0x3e7663[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x3e7663[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xdf')));var _0x54b6b9=new History(_0x1eff7b);_0x54b6b9[_0xe7c5('0x6d')]=0xa;_0x54b6b9[_0xe7c5('0x6e')]=_0xe7c5('0xcf');_0x54b6b9['starttime']=moment()['format'](_0xe7c5('0xc3'));_0x54b6b9[_0xe7c5('0x6f')]=_0x54b6b9[_0xe7c5('0x70')];_0x54b6b9[_0xe7c5('0xe0')]=_0x1eff7b['calleridname'];_0x54b6b9[_0xe7c5('0xe1')]=_0x1eff7b[_0xe7c5('0xe1')];hopperUtils[_0xe7c5('0xe2')](_0x54b6b9)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xe3')));}})[_0xe7c5('0x3a')](function(){if(_0x23b92e)hopperUtils[_0xe7c5('0xe4')](_0x1eff7b,_0x575d1c,_0xbad118)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x18ffd6['queue']][_0xe7c5('0x4d')]+=0x1;this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xe5')]+=0x1;_0x1eff7b[_0xe7c5('0x6d')]=0xb;_0x1eff7b[_0xe7c5('0x6e')]='Abandoned';_0x1eff7b['dropreason']='CALLEREXIT';_0x1eff7b['countabandonedretry']+=0x1;_0x1eff7b[_0xe7c5('0xd3')]+=0x1;_0x575d1c=this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]]['dialAbandonedRetryFrequency'];_0xbad118=this[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]][_0xe7c5('0xe6')];hopperUtils[_0xe7c5('0xd5')](_0x1eff7b,_0x1eff7b[_0xe7c5('0x6d')],_0x3e7663[_0xe7c5('0xd6')])['then'](function(_0x483645){if(_0x1eff7b[_0xe7c5('0xe7')]>=_0x19cb98[_0xe7c5('0x1e')][_0x18ffd6['queue']][_0xe7c5('0xe8')]){_0x19cb98[_0xe7c5('0xd9')](_0x1eff7b,_0x483645[_0xe7c5('0xd7')]);}else{hopperUtils[_0xe7c5('0xda')]({'active':![],'countabandonedretry':_0x1eff7b['countabandonedretry'],'scheduledat':moment()[_0xe7c5('0xdb')](_0x19cb98[_0xe7c5('0x1e')][_0x18ffd6[_0xe7c5('0xc1')]]['dialAbandonedRetryFrequency'],_0xe7c5('0xdc'))['format'](_0xe7c5('0xc3')),'ContactId':_0x3e7663[_0xe7c5('0xe9')],'ListId':_0x3e7663[_0xe7c5('0xea')],'VoiceQueueId':_0x3e7663[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x3e7663[_0xe7c5('0xde')]||undefined})['catch'](loggerCatch(_0xe7c5('0xeb')));var _0x3e7001=new History(_0x1eff7b);_0x3e7001[_0xe7c5('0x6d')]=0xb;_0x3e7001[_0xe7c5('0x6e')]=_0xe7c5('0xec');_0x3e7001[_0xe7c5('0x70')]=moment()['format'](_0xe7c5('0xc3'));_0x3e7001[_0xe7c5('0x6f')]=_0x3e7001['starttime'];_0x3e7001['calleridname']=_0x1eff7b[_0xe7c5('0xe0')];_0x3e7001['calleridnum']=_0x1eff7b[_0xe7c5('0xe1')];hopperUtils['createHistory'](_0x3e7001)['catch'](loggerCatch(_0xe7c5('0xed')));}})[_0xe7c5('0x3a')](function(){if(_0x23b92e)hopperUtils[_0xe7c5('0xe4')](_0x1eff7b,_0x575d1c,_0xbad118)['then'](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x3bb52d){if(this[_0xe7c5('0x23')][_0x3bb52d[_0xe7c5('0xbe')]]){this['actions'][_0x3bb52d['uniqueid']][_0xe7c5('0xee')]=_0x3bb52d[_0xe7c5('0xee')];}if(this[_0xe7c5('0x25')][_0x3bb52d['uniqueid']]){this[_0xe7c5('0x25')][_0x3bb52d['uniqueid']]['channel']=_0x3bb52d[_0xe7c5('0xee')];}};Dialer['prototype'][_0xe7c5('0x38')]=function(_0x18101a){if(!this['actions'][_0x18101a[_0xe7c5('0xef')]]){return;}var _0x46b3f7=this[_0xe7c5('0x1e')][this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xc1')]][_0xe7c5('0xf0')]||_0xe7c5('0xf1');if(_0x46b3f7===_0xe7c5('0xf2')){if(this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]]&&_[_0xe7c5('0xf3')](this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xf4')])&&_0x18101a[_0xe7c5('0x8b')]==='1'&&_0x18101a[_0xe7c5('0xf5')]==='0'){if(this[_0xe7c5('0x20')][_0x18101a[_0xe7c5('0xf6')]]){if(!this[_0xe7c5('0x20')][_0x18101a[_0xe7c5('0xf6')]][_0xe7c5('0xf4')]){this[_0xe7c5('0x20')][_0x18101a[_0xe7c5('0xf6')]]['locked']=!![];this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]]['locked']=!![];this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xf6')]=_0x18101a[_0xe7c5('0xf6')];}}}}else if(_0x46b3f7===_0xe7c5('0xf1')){if(this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]]){if(this['agents'][_0x18101a[_0xe7c5('0xf6')]]){this['actions'][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xf6')]=_0x18101a['stateinterface'];if(_['isNil'](this[_0xe7c5('0x28')][this['actions'][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xc1')]])){this[_0xe7c5('0x28')][this[_0xe7c5('0x23')][_0x18101a['actionid']]['queue']]=[];}this['queueBooked'][this[_0xe7c5('0x23')][_0x18101a[_0xe7c5('0xef')]][_0xe7c5('0xc1')]][_0xe7c5('0x9e')](_[_0xe7c5('0x5e')](_[_0xe7c5('0x75')](this['actions'][_0x18101a[_0xe7c5('0xef')]],['idHopper','stateinterface']),{'status':_0x18101a[_0xe7c5('0x8b')],'paused':_0x18101a['paused']}));}}}};Dialer[_0xe7c5('0x18')]['syncQueueStatusComplete']=function(_0x3a251b){if(!this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]){return;}var _0x100f8a=this;var _0x1a796c=this[_0xe7c5('0x1e')][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]['queue']];var _0x201154=_0x1a796c[_0xe7c5('0xf0')]||_0xe7c5('0xf1');if(_0x201154===_0xe7c5('0xf2')){if(this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]&&this['actions'][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xf6')]){this[_0xe7c5('0x1d')][_0xe7c5('0xf7')](this['actions'][_0x3a251b['actionid']][_0xe7c5('0xf8')],this[_0xe7c5('0x23')][_0x3a251b['actionid']][_0xe7c5('0xf6')])[_0xe7c5('0xa5')](function(_0x161ef0){logger[_0xe7c5('0x64')](_0xe7c5('0xf9'),util['inspect'](_0x161ef0,{'showHidden':![],'depth':null}));})[_0xe7c5('0x1b')](function(){_0x100f8a[_0xe7c5('0xc0')](_0x100f8a[_0xe7c5('0x1e')][_0x100f8a[_0xe7c5('0x23')][_0x3a251b['actionid']]['queue']]);_0x100f8a[_0xe7c5('0x20')][_0x100f8a[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xf6')]]['locked']=![];delete _0x100f8a[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]];unlockQueueStatus(_0x1a796c);});}else{this[_0xe7c5('0xc0')](this['voiceQueues'][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]['queue']]);hopperUtils[_0xe7c5('0xda')]({'active':![],'ContactId':this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]['ContactId'],'ListId':this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xea')],'VoiceQueueId':this['actions'][_0x3a251b['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xfa')));delete this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]];unlockQueueStatus(_0x1a796c);}}else if(_0x201154===_0xe7c5('0xf1')){var _0x5530e9;if(this['actions'][_0x3a251b[_0xe7c5('0xef')]]&&!_[_0xe7c5('0x79')](this[_0xe7c5('0x28')][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]])){if(this[_0xe7c5('0x29')][_0x100f8a[_0xe7c5('0x23')][_0x3a251b['actionid']][_0xe7c5('0xc1')]]){this['queueBookedRR'][_0x100f8a['actions'][_0x3a251b['actionid']][_0xe7c5('0xc1')]]=this[_0xe7c5('0x29')][this['actions'][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]]?this[_0xe7c5('0x29')][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]]:this[_0xe7c5('0x28')][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]]?this['queueBooked'][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]][_0xe7c5('0xc1')]][_0xe7c5('0xfb')]=this[_0xe7c5('0x29')][this[_0xe7c5('0x23')][_0x3a251b[_0xe7c5('0xef')]]['queue']];for(var _0x4d43f6=0x0;_0x4d43f6=_0x4dc3b1[_0xe7c5('0x11d')]){_0xa5dc0d['stateGlobal'](_0xcd28d8,_0x2f4a84,_0x7ff19d,_0xe7c5('0x11e'));}else{if(_0xcd28d8[_0xe7c5('0x11b')]>=_0x4dc3b1['dialMachineMaxRetry']){_0xa5dc0d[_0xe7c5('0x11f')](_0xcd28d8,_0x2f4a84,_0x7ff19d,'reason\x2019\x20machine....');}else{hopperUtils[_0xe7c5('0xda')]({'active':![],'countmachineretry':_0xcd28d8[_0xe7c5('0x11b')],'scheduledat':moment()[_0xe7c5('0xdb')](_0x4dc3b1[_0xe7c5('0x120')],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0xcd28d8[_0xe7c5('0xe9')],'ListId':_0xcd28d8[_0xe7c5('0xea')],'VoiceQueueId':_0xcd28d8[_0xe7c5('0xdd')]||undefined,'CampaignId':_0xcd28d8[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x121')));_0x2f4a84({'reschedule':0x1});}}});}if(_0xb3e1ec['type']===_0xe7c5('0xbf')&&this[_0xe7c5('0x1f')][_0xb3e1ec[_0xe7c5('0xc1')]][_0xe7c5('0x122')]&&_0x19efae['value']===_0xe7c5('0x123')){delete this[_0xe7c5('0x25')][_0x19efae[_0xe7c5('0xbe')]];this[_0xe7c5('0xc0')](this['campaigns'][_0xb3e1ec[_0xe7c5('0xc1')]]);_0x5260fd=new Hangup(_0xb3e1ec,_0x19efae);_0x5260fd[_0xe7c5('0x6d')]=0x12;_0x5260fd[_0xe7c5('0x6e')]='HangupInAMD';_0x5260fd[_0xe7c5('0x10f')]='AMD';ami[_0xe7c5('0x3d')](_0xe7c5('0x111'),ut[_0xe7c5('0x112')](_0x5260fd,_0xe7c5('0x116')));this[_0xe7c5('0x113')](_0x5260fd,'[syncHangupInAMDIvr][createHistory]',_0xe7c5('0x124'));}if(_0xb3e1ec[_0xe7c5('0x3e')]===_0xe7c5('0xbf')&&this[_0xe7c5('0x1f')][_0xb3e1ec[_0xe7c5('0xc1')]][_0xe7c5('0x122')]&&_0x19efae['value']==='MACHINE'){return new Promise(function(_0x392007,_0x336f38){delete _0xa5dc0d[_0xe7c5('0x25')][_0x19efae[_0xe7c5('0xbe')]];_0xa5dc0d[_0xe7c5('0xc0')](_0xa5dc0d[_0xe7c5('0x1f')][_0xb3e1ec[_0xe7c5('0xc1')]]);_0xa5dc0d['campaigns'][_0xb3e1ec['queue']]['outboundAnswerCallsDay']+=0x1;_0xa5dc0d['campaigns'][_0xb3e1ec[_0xe7c5('0xc1')]][_0xe7c5('0x115')]+=0x1;var _0x5e738c=_0xa5dc0d[_0xe7c5('0x1f')][_0xb3e1ec[_0xe7c5('0xc1')]];var _0x37bdff=new Hangup(_0xb3e1ec,_0x19efae);_0x37bdff[_0xe7c5('0x6d')]=0x13;_0x37bdff[_0xe7c5('0x6e')]='Machine';_0x37bdff[_0xe7c5('0x10f')]=_0xe7c5('0x110');_0x37bdff['countmachineretry']+=0x1;_0x37bdff[_0xe7c5('0xd3')]+=0x1;_0x37bdff[_0xe7c5('0x116')]=!![];ami['emit'](_0xe7c5('0x111'),ut[_0xe7c5('0x112')](_0x37bdff,_0xe7c5('0x116')));hopperUtils[_0xe7c5('0xe2')](_0x37bdff)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x37bdff[_0xe7c5('0x118')]+_0x37bdff[_0xe7c5('0x119')]+_0x37bdff[_0xe7c5('0x11a')]+_0x37bdff['countnosuchnumberretry']+_0x37bdff['countdropretry']+_0x37bdff[_0xe7c5('0xe7')]+_0x37bdff[_0xe7c5('0x11b')]+_0x37bdff[_0xe7c5('0x11c')]>=_0x5e738c[_0xe7c5('0x11d')]){_0xa5dc0d[_0xe7c5('0x125')](_0x37bdff,_0x392007,_0x336f38,_0xe7c5('0x11e'));}else{if(_0x37bdff[_0xe7c5('0x11b')]>=_0x5e738c['dialMachineMaxRetry']){_0xa5dc0d['createStateFinal'](_0x37bdff,_0x392007,_0x336f38,_0xe7c5('0x126'));}else{hopperUtils[_0xe7c5('0xda')]({'active':![],'countmachineretry':_0x37bdff[_0xe7c5('0x11b')],'scheduledat':moment()['add'](_0x5e738c[_0xe7c5('0x120')],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x37bdff[_0xe7c5('0xe9')],'ListId':_0x37bdff[_0xe7c5('0xea')],'VoiceQueueId':_0x37bdff[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x37bdff[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x121')));_0x392007({'reschedule':0x1});}}});}}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x34')]=function(_0x12ad2f){var _0xca68a5=this[_0xe7c5('0x25')][_0x12ad2f[_0xe7c5('0xbe')]];var _0x325f5e;if(_0xca68a5&&_0xca68a5[_0xe7c5('0x3e')]===_0xe7c5('0xbf')){delete this['uniqueId'][_0x12ad2f[_0xe7c5('0xbe')]];this['updateOriginated'](this[_0xe7c5('0x1f')][_0xca68a5[_0xe7c5('0xc1')]]);this['campaigns'][_0xca68a5[_0xe7c5('0xc1')]][_0xe7c5('0x127')]+=0x1;_0x325f5e=new Hangup(_0xca68a5,_0x12ad2f);hopperUtils[_0xe7c5('0xe2')](_0x325f5e)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x128')));hopperUtils[_0xe7c5('0xc9')](_0x325f5e)['catch'](loggerCatch(_0xe7c5('0x129')));}if(_0xca68a5&&_0xca68a5[_0xe7c5('0x3e')]!=='ivr'&&isNotNull(this['voiceQueues'][_0xca68a5[_0xe7c5('0xc1')]][_0xe7c5('0x12a')])){delete this[_0xe7c5('0x25')][_0x12ad2f[_0xe7c5('0xbe')]];this[_0xe7c5('0xc0')](this[_0xe7c5('0x1e')][_0xca68a5['queue']]);this[_0xe7c5('0x1e')][_0xca68a5['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xe7c5('0x1e')][_0xca68a5[_0xe7c5('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x325f5e=new Hangup(_0xca68a5,_0x12ad2f);_0x325f5e[_0xe7c5('0x6d')]=0x10;_0x325f5e[_0xe7c5('0x6e')]=_0xe7c5('0x12b');_0x325f5e[_0xe7c5('0x10f')]=_0xe7c5('0x12c');hopperUtils['createHistory'](_0x325f5e)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe7c5('0xc9')](_0x325f5e)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x129')));}if(_0xca68a5&&_0xca68a5[_0xe7c5('0x3e')]!==_0xe7c5('0xbf')&&!isNotNull(this[_0xe7c5('0x1e')][_0xca68a5[_0xe7c5('0xc1')]][_0xe7c5('0x12a')])){delete this[_0xe7c5('0x25')][_0x12ad2f[_0xe7c5('0xbe')]];this[_0xe7c5('0xc0')](this[_0xe7c5('0x1e')][_0xca68a5[_0xe7c5('0xc1')]]);this['voiceQueues'][_0xca68a5[_0xe7c5('0xc1')]][_0xe7c5('0x12d')]+=0x1;_0x325f5e=new Hangup(_0xca68a5,_0x12ad2f);_0x325f5e[_0xe7c5('0x6d')]=0xc;_0x325f5e['statedesc']=_0x12ad2f[_0xe7c5('0x12e')];_0x325f5e[_0xe7c5('0x10f')]='Unknow';hopperUtils[_0xe7c5('0xe2')](_0x325f5e)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x128')));hopperUtils['moveContactManagedDialer'](_0x325f5e)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x129')));}};Dialer[_0xe7c5('0x18')]['syncQueueSummary']=function(_0x46b7d5){var _0x9bbd14=this;if(!_0x9bbd14[_0xe7c5('0x12f')][_0x46b7d5[_0xe7c5('0x44')]]){_0x9bbd14['queuesSummary'][_0x46b7d5[_0xe7c5('0x44')]]={'running':![]};}else if(_0x9bbd14['queuesSummary'][_0x46b7d5[_0xe7c5('0x44')]]['running']===!![]){return;}else if(_0x9bbd14[_0xe7c5('0x12f')][_0x46b7d5[_0xe7c5('0x44')]][_0xe7c5('0x130')]===![]){_0x9bbd14[_0xe7c5('0x12f')][_0x46b7d5[_0xe7c5('0x44')]][_0xe7c5('0x130')]=!![];}var _0x534342=_0x9bbd14[_0xe7c5('0x1e')][_0x46b7d5[_0xe7c5('0x44')]];var _0x2ffbd9=_0x534342[_0xe7c5('0x67')]!==utils[_0xe7c5('0x68')][_0xe7c5('0x82')];var _0x11dace=utils[_0xe7c5('0x131')](_0x534342);_0x534342[_0xe7c5('0x132')]=utils[_0xe7c5('0x133')](_0x534342,_0x9bbd14['trunks']);Promise['resolve']()[_0xe7c5('0x3a')](function(){if(_0x534342[_0xe7c5('0x132')]===utils[_0xe7c5('0x68')]['INACTIVE']){if(_0x2ffbd9){clearPredictiveAttributes(_0x534342);_0x46b7d5[_0xe7c5('0x26')]=undefined;_0x46b7d5[_0xe7c5('0x27')]=undefined;}if(_0x534342[_0xe7c5('0x132')]===utils[_0xe7c5('0x68')][_0xe7c5('0x82')]){_0x46b7d5[_0xe7c5('0x134')]=0x0;_0x46b7d5['paused']=0x0;_0x46b7d5['inUse']=0x0;_0x46b7d5['talking']=0x0;_0x46b7d5[_0xe7c5('0x135')]=0x0;}}else if(_0x534342[_0xe7c5('0x132')]===utils[_0xe7c5('0x68')][_0xe7c5('0x136')]&&!_0x11dace){return _0x9bbd14[_0xe7c5('0x95')](_0x534342,!![])[_0xe7c5('0x3a')](function(){return _0x9bbd14[_0xe7c5('0x95')](_0x534342,![]);})[_0xe7c5('0x3a')](function(){return _0x9bbd14[_0xe7c5('0xb2')](_0x534342);})[_0xe7c5('0xa5')](function(_0x2ebbb9){loggerSyncQueueSummary[_0xe7c5('0x3f')]('[syncQueueSummary]',util[_0xe7c5('0x41')](_0x2ebbb9,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x534342);});}else{clearPredictiveAttributes(_0x534342);}})[_0xe7c5('0x3a')](function(){var _0x353902=_0x46b7d5['compareToOutboundQueue'](_0x534342);if(_0x353902||_0x534342[_0xe7c5('0x137')]){_0x534342['queueSummaryCountersUpdated']=![];_0x46b7d5['updateReportFromOutboundQueue'](_0x534342);Object[_0xe7c5('0x138')](_0x534342,_0x46b7d5);emitOutboundVoiceQueueSummary(_0x46b7d5);}_0x9bbd14[_0xe7c5('0x12f')][_0x534342[_0xe7c5('0x44')]][_0xe7c5('0x130')]=![];})[_0xe7c5('0xa5')](function(_0x5d7c19){logger[_0xe7c5('0x64')](_0xe7c5('0x139'),util[_0xe7c5('0x41')](_0x5d7c19,{'showHidden':![],'depth':null}));_0x9bbd14[_0xe7c5('0x12f')][_0x534342[_0xe7c5('0x44')]][_0xe7c5('0x130')]=![];});};Dialer[_0xe7c5('0x18')][_0xe7c5('0x13a')]=_['throttle'](function(){var _0x6c2280=_['filter'](this[_0xe7c5('0x1e')],function(_0x54605f){return _0x54605f[_0xe7c5('0x13b')];});var _0x35f725=_[_0xe7c5('0x13c')](this[_0xe7c5('0x20')],function(_0x2e3c9e){return _0x2e3c9e['online']&&_0x2e3c9e['status']===_0xe7c5('0x8a');});if(_0x6c2280[_0xe7c5('0x9d')]>0x0&&_0x35f725[_0xe7c5('0x9d')]>0x0){return Promise['resolve']()[_0xe7c5('0x3a')](cmHopper[_0xe7c5('0x13d')](_[_0xe7c5('0x13e')](_0x6c2280,'id'),previewRecallmeReminderInterval,_['map'](_0x35f725,'id')))[_0xe7c5('0x3a')](function(_0x536214){for(var _0x2e9856=0x0;_0x2e9856<_0x536214[_0xe7c5('0x9d')];_0x2e9856++){var _0x2e5734=_0x536214[_0x2e9856][_0xe7c5('0x13f')][_0xe7c5('0x44')];if(_0x2e5734)io['to'](util[_0xe7c5('0x42')](_0xe7c5('0x140'),_0x2e5734))[_0xe7c5('0x3d')](_0xe7c5('0x141'),{'hopper':_0x536214[_0x2e9856]});}})[_0xe7c5('0xa5')](function(_0xffc440){logger[_0xe7c5('0x64')](_0xe7c5('0x142'),_0xffc440);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x206dd5=this;setInterval(function(){_0x206dd5['clearZombieChannels'](_0x206dd5[_0xe7c5('0x25')],_0xe7c5('0x143'));_0x206dd5['clearZombieChannels'](_0x206dd5[_0xe7c5('0x23')],'[actions]');},0x32c8);};Dialer[_0xe7c5('0x18')][_0xe7c5('0x144')]=function(_0x4d7158,_0x524ab4){var _0x51a0a0=this;for(var _0xccd146 in _0x4d7158){if(typeof _0x4d7158[_0xccd146]!=='undefined'){this[_0xe7c5('0x1c')][_0xe7c5('0x19')](function(){if(!_[_0xe7c5('0xf3')](_0x4d7158[_0xccd146])){return ami[_0xe7c5('0x9f')]({'action':'status','channel':_0x4d7158[_0xccd146][_0xe7c5('0xee')]})[_0xe7c5('0xa5')](function(_0x38691f){if(_0x38691f[_0xe7c5('0x67')]===_0xe7c5('0x145')){setTimeout(function(){if(_0x4d7158[_0xccd146]&&_0x4d7158[_0xccd146][_0xe7c5('0x3e')]!==_0xe7c5('0xbf')){_0x51a0a0[_0xe7c5('0xc0')](_0x51a0a0[_0xe7c5('0x1e')][_0x4d7158[_0xccd146][_0xe7c5('0xc1')]]);logger[_0xe7c5('0x64')](_0xe7c5('0x146'),_0x524ab4,_0xccd146,_0x4d7158[_0xccd146]['queue']);delete _0x4d7158[_0xccd146];}if(_0x4d7158[_0xccd146]&&_0x4d7158[_0xccd146][_0xe7c5('0x3e')]==='ivr'){_0x51a0a0[_0xe7c5('0xc0')](_0x51a0a0[_0xe7c5('0x1f')][_0x4d7158[_0xccd146][_0xe7c5('0xc1')]]);logger[_0xe7c5('0x64')](_0xe7c5('0x147'),_0x524ab4,_0xccd146,_0x4d7158[_0xccd146]['queue']);delete _0x4d7158[_0xccd146];}},0x2328);}});}});}}};Dialer[_0xe7c5('0x18')]['getVoiceQueueRtPauses']=function(_0x5bb360){return Promise['resolve']()['then'](voiceQueueRt[_0xe7c5('0x148')](_0x5bb360))[_0xe7c5('0xa5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xe7c5('0x18')][_0xe7c5('0xc0')]=function(_0x5a510a){if(!_['isUndefined'](_0x5a510a)&&_0x5a510a!==null){if(typeof _0x5a510a[_0xe7c5('0x81')]!==_0xe7c5('0xad')){if(_0x5a510a['originated']>0x0){_0x5a510a[_0xe7c5('0x81')]-=0x1;}else{logger[_0xe7c5('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xe7c5('0x149'));}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x14a')]=function(_0x3bd434,_0x51a54c){var _0x2c9093=this;return function(_0x2792de){_0x2c9093[_0xe7c5('0xc0')](_0x51a54c);logger['error'](_0x3bd434,util['inspect'](_0x2792de,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x289b05,_0xdec684,_0x49f721){var _0x2dde22={'state':0x19,'statedesc':_0xe7c5('0x14b')};this['updateOriginated'](_0xdec684);this[_0xe7c5('0x113')](_[_0xe7c5('0x5e')](_0x2dde22,_[_0xe7c5('0x75')](_0x49f721,['ContactId',_0xe7c5('0xea'),'UserId',_0xe7c5('0xdd'),_0xe7c5('0xde')])),_0xe7c5('0x14c'),_0xe7c5('0x14d'));logger['error'](_0x289b05);};Dialer[_0xe7c5('0x18')][_0xe7c5('0x113')]=function(_0x270f04,_0xcf0b04,_0x12a72d){hopperUtils[_0xe7c5('0xe2')](_0x270f04)[_0xe7c5('0xa5')](loggerCatch(_0xcf0b04));hopperUtils[_0xe7c5('0xc9')](_0x270f04)[_0xe7c5('0xa5')](loggerCatch(_0x12a72d));};Dialer['prototype'][_0xe7c5('0xd9')]=function(_0x5cedd9,_0x355522){hopperUtils[_0xe7c5('0xe2')](_0x5cedd9)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x14e')));if(_0x355522==0x0){hopperUtils[_0xe7c5('0xc9')](_0x5cedd9)['catch'](loggerCatch(_0xe7c5('0x14f')));}};Dialer[_0xe7c5('0x18')]['checkPreviewRecallReminder']=function(_0x36f7b8){return Promise[_0xe7c5('0x150')]()['then'](cmHopper[_0xe7c5('0x13d')](_0x36f7b8['id'],previewRecallmeReminderInterval))[_0xe7c5('0x3a')](function(_0x14d5d5){for(var _0x484921=0x0;_0x484921<_0x14d5d5[_0xe7c5('0x9d')];_0x484921++){var _0x1b01c8=_0x14d5d5[_0x484921][_0xe7c5('0x13f')]['name'];if(_0x1b01c8)io['to'](util[_0xe7c5('0x42')](_0xe7c5('0x140'),_0x1b01c8))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x14d5d5[_0x484921]});}})[_0xe7c5('0xa5')](function(){});};Dialer['prototype'][_0xe7c5('0xb0')]=function(_0x18f689){var _0x68310e=this;return function(){_0x68310e[_0xe7c5('0x151')](_0x18f689);};};Dialer['prototype'][_0xe7c5('0x152')]=function(_0x1a0258,_0x4805c9){var _0x2fd33f=this;var _0x2345f0=uuid['v4']();this['actions'][_0x2345f0]=new Action(_0x1a0258,_0x4805c9,_0x2345f0);return new Promise(function(_0x50d56c,_0x2381a3){if(_[_0xe7c5('0x3c')](_0x1a0258)&&typeof _0x1a0258!=='object'){return _0x2381a3(msgResponse('originate',_0xe7c5('0x96'),_0xe7c5('0x153')));}if(_[_0xe7c5('0x3c')](_0x4805c9[_0xe7c5('0x154')])||_0x4805c9[_0xe7c5('0x154')]===null){return _0x2381a3(msgResponse(_0xe7c5('0x155'),'Failure','contact\x20is\x20undefine'));}var _0x36193b={'XMD-CALLERID':_0x2fd33f[_0xe7c5('0x23')][_0x2345f0][_0xe7c5('0x156')](),'XMD-AGI':_0x1a0258[_0xe7c5('0x12a')]?util[_0xe7c5('0x42')](_0xe7c5('0x157'),ipAgi,_0x1a0258['dialQueueProject']):_0xe7c5('0x158'),'XMD-AGIAFTER':_0x1a0258[_0xe7c5('0xc7')]?util[_0xe7c5('0x42')](_0xe7c5('0x157'),ipAgi,_0x1a0258[_0xe7c5('0xc7')]):_0xe7c5('0x158'),'XMD-QUEUE':utils[_0xe7c5('0x159')](_0x1a0258)?util[_0xe7c5('0x42')](_0xe7c5('0x15a'),_0x1a0258[_0xe7c5('0x44')],_0x1a0258[_0xe7c5('0x15b')]||'',_0x1a0258[_0xe7c5('0xc8')]?'c':'',_0x1a0258[_0xe7c5('0x15c')]||0x3):_0xe7c5('0x158'),'XMD-CONTACTID':_0x4805c9[_0xe7c5('0xe9')],'XMD-CDRTYPE':_0xe7c5('0x8'),'CALLERID(all)':_0x2fd33f[_0xe7c5('0x23')][_0x2345f0]['getCaller'](),'XMD-AMD':_0x1a0258['dialAMDActive']?_0xe7c5('0x136'):'NONE','XMD-DESTINATION':_0xe7c5('0x10b')};if(_0x1a0258['dialAMDActive']){_0x36193b['XMD-AMDINITIALSILENCE']=_0x1a0258[_0xe7c5('0x15d')]||0x9c4;_0x36193b[_0xe7c5('0x15e')]=_0x1a0258[_0xe7c5('0x15f')]||0x5dc;_0x36193b['XMD-AMDAFTERGREETINGSILENCE']=_0x1a0258[_0xe7c5('0x160')]||0x320;_0x36193b['XMD-AMDTOTALANALYSISTIME']=_0x1a0258[_0xe7c5('0x161')]||0x1388;_0x36193b[_0xe7c5('0x162')]=_0x1a0258[_0xe7c5('0x163')]||0x64;_0x36193b['XMD-AMDBETWEENWORDSSILENCE']=_0x1a0258[_0xe7c5('0x164')]||0x32;_0x36193b[_0xe7c5('0x165')]=_0x1a0258['dialAMDMaximumNumberOfWords']||0x3;_0x36193b[_0xe7c5('0x166')]=_0x1a0258[_0xe7c5('0x167')]||0x100;_0x36193b['XMD-AMDMAXIMUMWORDLENGTH']=_0x1a0258[_0xe7c5('0x168')]||0x1388;}if(utils['isOutboundQueue'](_0x1a0258)){_0x36193b[_0xe7c5('0x169')]=_0x4805c9['VoiceQueueId'];}else{_0x36193b[_0xe7c5('0x16a')]=_0x4805c9[_0xe7c5('0xde')];}for(var _0x4e4ef5 in _0x4805c9['Contact']){if(typeof _0x4805c9[_0xe7c5('0x16b')][_0x4e4ef5]!==_0xe7c5('0xad')){if(isNotNull(_0x4805c9[_0xe7c5('0x16b')][_0x4e4ef5])&&_0x4e4ef5!=='id'&&_0x4e4ef5!==_0xe7c5('0x16c')&&_0x4e4ef5!=='createdAt'&&_0x4e4ef5!==_0xe7c5('0x16d')){_0x36193b[util[_0xe7c5('0x42')](_0xe7c5('0x16e'),_0xe7c5('0x16f'),_[_0xe7c5('0x170')](_0x4e4ef5))]=_0x4805c9['Contact'][_0x4e4ef5];}}}var _0x296d15=_0x2fd33f[_0xe7c5('0x8f')](_0x1a0258[_0xe7c5('0x8e')])?utils['getCallerId'](_0x1a0258['Trunk'][_0xe7c5('0x171')],_0x1a0258['dialOriginateCallerIdName'],_0x1a0258[_0xe7c5('0x172')]>0x0?utils[_0xe7c5('0x173')](_0x1a0258['dialOriginateCallerIdNumber'],_0x1a0258['dialRandomLastDigitCallerIdNumber']):_0x1a0258['dialOriginateCallerIdNumber']):utils[_0xe7c5('0x174')](_[_0xe7c5('0xf3')](_0x1a0258[_0xe7c5('0x90')])?_0x1a0258[_0xe7c5('0x8e')]['callerid']:_0x1a0258[_0xe7c5('0x90')][_0xe7c5('0x171')],_0x1a0258['dialOriginateCallerIdName'],_0x1a0258[_0xe7c5('0x172')]>0x0?utils[_0xe7c5('0x173')](_0x1a0258[_0xe7c5('0x175')],_0x1a0258['dialRandomLastDigitCallerIdNumber']):_0x1a0258[_0xe7c5('0x175')]);if(_0x296d15){_0x36193b[_0xe7c5('0x176')]=_0x2fd33f[_0xe7c5('0x23')][_0x2345f0][_0xe7c5('0x177')]=utils[_0xe7c5('0x178')](_0x296d15);_0x36193b[_0xe7c5('0x179')]=_0x4805c9[_0xe7c5('0x154')];}_0x1a0258[_0xe7c5('0x17a')]=_0x36193b;return ami[_0xe7c5('0x9f')]({'actionid':_0x2345f0,'action':_0xe7c5('0x155'),'channel':_0x2fd33f[_0xe7c5('0x8f')](_0x1a0258['Trunk'])?util[_0xe7c5('0x42')](_0xe7c5('0x17b'),_0x1a0258[_0xe7c5('0x8e')][_0xe7c5('0x44')],isNotNull(_0x1a0258[_0xe7c5('0x17c')])?_0x1a0258['dialPrefix']['trim']()||'':'',_0x1a0258['dialCutDigit']>0x0?_0x4805c9[_0xe7c5('0x154')][_0xe7c5('0x17d')](_0x1a0258['dialCutDigit']):_0x4805c9[_0xe7c5('0x154')]):util[_0xe7c5('0x42')]('SIP/%s/%s%s',_['isNil'](_0x1a0258[_0xe7c5('0x90')])?_0x1a0258[_0xe7c5('0x8e')][_0xe7c5('0x44')]:_0x1a0258[_0xe7c5('0x90')][_0xe7c5('0x44')],isNotNull(_0x1a0258[_0xe7c5('0x17c')])?_0x1a0258[_0xe7c5('0x17c')][_0xe7c5('0x17e')]()||'':'',_0x1a0258[_0xe7c5('0x17f')]>0x0?_0x4805c9[_0xe7c5('0x154')][_0xe7c5('0x17d')](_0x1a0258[_0xe7c5('0x17f')]):_0x4805c9['phone']),'callerid':_0x296d15,'Exten':'xcally-motion-dialer','Context':_0xe7c5('0x180'),'Priority':'1','variable':_0x36193b,'timeout':(_0x1a0258['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2345f0})['then'](function(_0x579998){return _0x50d56c(_0x579998);})[_0xe7c5('0xa5')](function(_0xcf3dc3){_0x1a0258[_0xe7c5('0x181')]+=0x1;var _0x393827=new History(_0x2fd33f[_0xe7c5('0x23')][_0x2345f0]);logger['error'](util[_0xe7c5('0x42')](_0xe7c5('0x182'),JSON[_0xe7c5('0x74')](_0xcf3dc3)));_0x393827[_0xe7c5('0x6d')]=0xe;_0x393827[_0xe7c5('0x6e')]=_0xe7c5('0x183');_0x393827[_0xe7c5('0x70')]=moment()['format'](_0xe7c5('0xc3'));_0x393827[_0xe7c5('0x6f')]=_0x393827[_0xe7c5('0x70')];hopperUtils[_0xe7c5('0xe2')](_0x393827)[_0xe7c5('0xa5')](loggerCatch('[originate][error]'));_0x2fd33f[_0xe7c5('0xc9')](_0x393827)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x184')))[_0xe7c5('0x1b')](function(){delete _0x2fd33f[_0xe7c5('0x23')][_0x2345f0];return _0x2381a3(msgResponse(_0xe7c5('0x155'),_0xe7c5('0x88'),_0xe7c5('0x185')));});});});};Dialer[_0xe7c5('0x18')]['checkRetriveMax']=function(_0x3e5e31,_0x566150,_0x36d82b){var _0x4a5da7=new History(_0x566150);if(_0x4a5da7[_0xe7c5('0x118')]+_0x4a5da7[_0xe7c5('0x119')]+_0x4a5da7['countnoanswerretry']+_0x4a5da7[_0xe7c5('0x186')]+_0x4a5da7['countdropretry']+_0x4a5da7['countabandonedretry']+_0x4a5da7['countmachineretry']+_0x4a5da7['countagentrejectretry']>=_0x36d82b[_0xe7c5('0x11d')]-0x1){return!![];}switch(_0x3e5e31){case 0x3:if(_0x4a5da7[_0xe7c5('0x11a')]>=_0x36d82b['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countnoanswerretry':_0x4a5da7[_0xe7c5('0x11a')]+=0x1,'scheduledat':moment()[_0xe7c5('0xdb')](_0x36d82b[_0xe7c5('0x187')],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7['ContactId'],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x188')));break;case 0x5:if(_0x4a5da7[_0xe7c5('0x118')]>=_0x36d82b[_0xe7c5('0x189')]-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countbusyretry':_0x4a5da7[_0xe7c5('0x118')]+=0x1,'scheduledat':moment()[_0xe7c5('0xdb')](_0x36d82b['dialBusyRetryFrequency'],_0xe7c5('0xdc'))[_0xe7c5('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4a5da7[_0xe7c5('0x119')]>=_0x36d82b['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countcongestionretry':_0x4a5da7[_0xe7c5('0x119')]+=0x1,'scheduledat':moment()[_0xe7c5('0xdb')](_0x36d82b['dialCongestionRetryFrequency'],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7['ListId'],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x18a')));break;case 0x0:if(_0x4a5da7[_0xe7c5('0x186')]>=_0x36d82b[_0xe7c5('0x18b')]-0x1){return!![];}else{hopperUtils[_0xe7c5('0xda')]({'active':![],'countnosuchnumberretry':_0x4a5da7[_0xe7c5('0x186')]+=0x1,'scheduledat':moment()['add'](_0x36d82b[_0xe7c5('0x18c')],_0xe7c5('0xdc'))['format'](_0xe7c5('0xc3')),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7['CampaignId']||undefined})[_0xe7c5('0xa5')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4a5da7[_0xe7c5('0xd2')]>=_0x36d82b[_0xe7c5('0xd8')]-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countdropretry':_0x4a5da7[_0xe7c5('0xd2')]+=0x1,'scheduledat':moment()['add'](_0x36d82b[_0xe7c5('0xd4')],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xdf')));break;case 0xb:if(_0x4a5da7[_0xe7c5('0xe7')]>=_0x36d82b[_0xe7c5('0xe8')]-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countabandonedretry':_0x4a5da7[_0xe7c5('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x36d82b['dialAbandonedRetryFrequency'],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xeb')));break;case 0x13:if(_0x4a5da7[_0xe7c5('0x11b')]>=_0x36d82b[_0xe7c5('0x18d')]-0x1){return!![];}hopperUtils[_0xe7c5('0xda')]({'active':![],'countmachineretry':_0x4a5da7[_0xe7c5('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x36d82b[_0xe7c5('0x120')],_0xe7c5('0xdc'))[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7['ContactId'],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7['VoiceQueueId']||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x121')));break;case 0x14:if(_0x4a5da7[_0xe7c5('0x11c')]>=_0x36d82b['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x4a5da7['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe7c5('0xdb')](_0x36d82b['dialAgentRejectRetryFrequency'],'minutes')[_0xe7c5('0x42')](_0xe7c5('0xc3')),'ContactId':_0x4a5da7[_0xe7c5('0xe9')],'ListId':_0x4a5da7[_0xe7c5('0xea')],'VoiceQueueId':_0x4a5da7[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x4a5da7[_0xe7c5('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xe7c5('0x106')]=function(_0x4a0111,_0x25435f,_0xee48d8){var _0x386c49=this;var _0x4cd35f=new History(_0x4a0111);var _0x301ddb=![];var _0x13c198;var _0xc49ad4;return new Promise(function(_0x38f954,_0x3692eb){if(_[_0xe7c5('0x3c')](_0x25435f)&&typeof _0x25435f!=='object'){return _0x3692eb(msgResponse(_0xe7c5('0x18e'),_0xe7c5('0x96'),_0xe7c5('0x18f')));}if(_[_0xe7c5('0x3c')](_0xee48d8)&&typeof _0xee48d8!==_0xe7c5('0x190')){return _0x3692eb(msgResponse(_0xe7c5('0x18e'),'Failure',_0xe7c5('0x191')));}hopperUtils['verifyAdditionalPhones'](_0x4cd35f,_0xee48d8['reason'],_0x25435f)[_0xe7c5('0x3a')](function(_0x254f9a){if(_0x254f9a[_0xe7c5('0xd7')]==0x1)_0x301ddb=!![];switch(_0xee48d8['reason']){case'0':_0x25435f[_0xe7c5('0x192')]+=0x1;_0x4cd35f[_0xe7c5('0x6d')]=0x0;_0x4cd35f[_0xe7c5('0x6e')]='NoSuchNumber';_0x4cd35f[_0xe7c5('0x186')]+=0x1;_0x4cd35f[_0xe7c5('0xd3')]+=0x1;ami[_0xe7c5('0x3d')](_0xe7c5('0x193'),ut[_0xe7c5('0x112')](_0x4a0111,_0xe7c5('0x194')));_0x13c198=_0x25435f['dialNoSuchNumberRetryFrequency'];_0xc49ad4=_0x25435f[_0xe7c5('0xe6')];hopperUtils['createHistory'](_0x4cd35f)['catch'](loggerCatch(_0xe7c5('0x117')));if(_0x386c49[_0xe7c5('0x195')](0x0,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f['countnosuchnumberretry']>=_0x25435f[_0xe7c5('0x18b')]){_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x196'));}else{_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x25435f[_0xe7c5('0x197')]+=0x1;_0x4cd35f[_0xe7c5('0x6d')]=0x3;_0x4cd35f['statedesc']=_0xe7c5('0x198');_0x4cd35f['countnoanswerretry']+=0x1;_0x4cd35f['countglobal']+=0x1;var _0x4d3ec6=ut['buildNoAnswerEventPayload'](_0x4a0111,_0x25435f);ami[_0xe7c5('0x3d')](_0xe7c5('0x199'),_0x4d3ec6);_0x13c198=_0x25435f[_0xe7c5('0x187')];_0xc49ad4=_0x25435f['callAdditionalPhoneAfterMin'];hopperUtils[_0xe7c5('0xe2')](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x19a')));if(_0x386c49['checkRetriveMax'](0x3,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f['countnoanswerretry']>=_0x25435f[_0xe7c5('0x19b')]){_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x19c'));}else{_0x386c49['stateGlobal'](_0x4cd35f,_0x38f954,_0x3692eb,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x25435f[_0xe7c5('0x19d')]+=0x1;_0x4cd35f['state']=0x5;_0x4cd35f[_0xe7c5('0x6e')]=_0xe7c5('0x19e');_0x4cd35f['countbusyretry']+=0x1;_0x4cd35f[_0xe7c5('0xd3')]+=0x1;ami[_0xe7c5('0x3d')](_0xe7c5('0x19f'),ut['buildObj'](_0x4a0111,'busy'));_0x13c198=_0x25435f[_0xe7c5('0x1a0')];_0xc49ad4=_0x25435f['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x386c49[_0xe7c5('0x195')](0x5,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f[_0xe7c5('0x118')]>=_0x25435f['dialBusyMaxRetry']){_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a1'));}else{_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a1'));}}break;case'8':_0x25435f['outboundCongestionCallsDay']+=0x1;_0x4cd35f[_0xe7c5('0x6d')]=0x8;_0x4cd35f[_0xe7c5('0x6e')]='Congestion';_0x4cd35f[_0xe7c5('0x119')]+=0x1;_0x4cd35f[_0xe7c5('0xd3')]+=0x1;_0x13c198=_0x25435f[_0xe7c5('0x1a2')];_0xc49ad4=_0x25435f[_0xe7c5('0xe6')];ami[_0xe7c5('0x3d')](_0xe7c5('0x1a3'),ut[_0xe7c5('0x112')](_0x4a0111,_0xe7c5('0x1a4')));hopperUtils[_0xe7c5('0xe2')](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1a5')));if(_0x386c49[_0xe7c5('0x195')](0x8,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f['countcongestionretry']>=_0x25435f[_0xe7c5('0x1a6')]){_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a7'));}else{_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a7'));}}break;case'11':_0x25435f[_0xe7c5('0x1a8')]+=0x1;_0x4cd35f[_0xe7c5('0x6d')]=0xb;_0x4cd35f['statedesc']=_0xe7c5('0xec');_0x4cd35f[_0xe7c5('0xe7')]+=0x1;_0x4cd35f[_0xe7c5('0xd3')]+=0x1;_0x13c198=_0x25435f['dialAbandonedRetryFrequency'];_0xc49ad4=_0x25435f[_0xe7c5('0xe6')];hopperUtils[_0xe7c5('0xe2')](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0xed')));if(_0x386c49[_0xe7c5('0x195')](0xb,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f[_0xe7c5('0xe7')]>=_0x25435f[_0xe7c5('0xe8')]){_0x386c49['createStateFinal'](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a9'));}else{_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1a9'));}}break;case'20':_0x25435f[_0xe7c5('0x1aa')]+=0x1;_0x4cd35f[_0xe7c5('0x6d')]=0x14;_0x4cd35f[_0xe7c5('0x6e')]='AgentReject';_0x4cd35f[_0xe7c5('0x11c')]+=0x1;_0x4cd35f[_0xe7c5('0xd3')]+=0x1;_0x13c198=_0x25435f[_0xe7c5('0x1ab')];_0xc49ad4=_0x25435f[_0xe7c5('0xe6')];ami[_0xe7c5('0x3d')](_0xe7c5('0x1ac'),ut['buildObj'](_0x4a0111,_0xe7c5('0x1ad')));hopperUtils[_0xe7c5('0xe2')](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1ae')));if(_0x386c49[_0xe7c5('0x195')](0x14,_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f[_0xe7c5('0x11c')]>=_0x25435f[_0xe7c5('0x1af')]){_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xe7c5('0x1b0'));}else{_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,'reason\x2020\x20agentreject');}}break;default:_0x25435f[_0xe7c5('0x12d')]+=0x1;_0x4cd35f['state']=0xc;_0x4cd35f['statedesc']=_0xee48d8[_0xe7c5('0xc4')];_0x13c198=_0x25435f[_0xe7c5('0x1ab')];_0xc49ad4=_0x25435f['callAdditionalPhoneAfterMin'];hopperUtils[_0xe7c5('0xe2')](_0x4cd35f)[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1b1')));if(_0x386c49[_0xe7c5('0x195')](_0xee48d8[_0xe7c5('0xc4')],_0x4a0111,_0x25435f)&&!_0x301ddb){if(_0x4cd35f[_0xe7c5('0x118')]+_0x4cd35f[_0xe7c5('0x119')]+_0x4cd35f['countnoanswerretry']+_0x4cd35f[_0xe7c5('0x186')]+_0x4cd35f[_0xe7c5('0xd2')]+_0x4cd35f['countabandonedretry']+_0x4cd35f[_0xe7c5('0x11b')]+_0x4cd35f['countagentrejectretry']>=_0x25435f[_0xe7c5('0x11d')]){_0x386c49[_0xe7c5('0x125')](_0x4cd35f,_0x38f954,_0x3692eb,_0xee48d8[_0xe7c5('0xc4')]);}else{_0x386c49[_0xe7c5('0x11f')](_0x4cd35f,_0x38f954,_0x3692eb,_0xee48d8['reason']);}}}})[_0xe7c5('0x3a')](function(){if(_0x301ddb){hopperUtils[_0xe7c5('0xe4')](_0x4cd35f,_0x13c198,_0xc49ad4)[_0xe7c5('0x3a')](function(){return _0x38f954(0x1);});}});});};Dialer['prototype'][_0xe7c5('0x125')]=function(_0x48ceef,_0x3b670a,_0x4c24c5,_0xe38c26){var _0x1164aa=new Final(_0x48ceef);_0x1164aa[_0xe7c5('0x6d')]=0xf;_0x1164aa[_0xe7c5('0x6e')]=_0xe7c5('0x1b2');this[_0xe7c5('0x11f')](_0x1164aa,_0x3b670a,_0x4c24c5,_0xe38c26);};Dialer[_0xe7c5('0x18')][_0xe7c5('0x11f')]=function(_0x5b2377,_0x5d2407,_0xa1aa25,_0x5db68f){hopperUtils[_0xe7c5('0xc9')](_0x5b2377)[_0xe7c5('0x3a')](function(){return _0x5d2407(msgResponse(_0xe7c5('0x18e'),_0xe7c5('0x105'),_0x5db68f));})[_0xe7c5('0xa5')](function(){return _0xa1aa25(msgResponse(_0xe7c5('0x1b3'),_0xe7c5('0x96'),_0xe7c5('0x1b4')));});};Dialer[_0xe7c5('0x18')]['predictive']=function(_0xc7c103){var _0x5cba2b=_0xc7c103[_0xe7c5('0x1b5')]/0x64;var _0xed7d17=_0xc7c103[_0xe7c5('0xcd')]/(_0xc7c103[_0xe7c5('0xcd')]+_0xc7c103['outboundAnswerCallsDay']);var _0x50abae=Math[_0xe7c5('0x1b6')](_0xc7c103[_0xe7c5('0x1b7')]*(_0xc7c103[_0xe7c5('0x1b8')]/0x64));var _0x10519c=Math['round'](_0xc7c103[_0xe7c5('0x1b7')]*(_0xc7c103[_0xe7c5('0x1b9')]/0x64));var _0x4eef96=_0xc7c103[_0xe7c5('0x134')]+_0xc7c103[_0xe7c5('0x1ba')];var _0x22595e=Math['floor'](_0xc7c103[_0xe7c5('0x59')]*_0xc7c103[_0xe7c5('0x5b')]*_0xc7c103[_0xe7c5('0x1bb')]*_0xc7c103['predictiveIntervalMultiplicativeFactor']);if(_[_0xe7c5('0x3c')](_0xc7c103[_0xe7c5('0x27')])){if(!_[_0xe7c5('0x3c')](_0xc7c103[_0xe7c5('0x26')])){_0xc7c103[_0xe7c5('0x26')]=undefined;loggerPredictive[_0xe7c5('0x64')](_0xe7c5('0x1bc'),_0xe7c5('0x1bd'));}if(!_[_0xe7c5('0x3c')](_0xc7c103[_0xe7c5('0x62')])){loggerPredictive[_0xe7c5('0x64')](_0xe7c5('0x1bc'),_0xe7c5('0x1be'));clearInterval(_0xc7c103[_0xe7c5('0x62')]);_0xc7c103['handlePredictive']=undefined;}_0xc7c103['startProgressive']=moment()[_0xe7c5('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe7c5('0x45')](_0xc7c103[_0xe7c5('0x44')],_0xe7c5('0x1bf'),_0xc7c103[_0xe7c5('0x27')]);this[_0xe7c5('0xb4')](_0xc7c103,0x1);}else if(ifInterval(_0xc7c103[_0xe7c5('0x1c0')],_0xc7c103['startProgressive'])){this[_0xe7c5('0xb4')](_0xc7c103,0x1);loggerPredictiveCalls[_0xe7c5('0x45')]('[startMethodPredictive][StartProgressive][Loop]',_0xc7c103[_0xe7c5('0x27')],_0xc7c103[_0xe7c5('0x44')]);_0xc7c103['erlangCalls']=0x0;_0xc7c103['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5cba2b<_0xed7d17&&_0xc7c103[_0xe7c5('0x1c1')]==='dropRate'){clearPredictiveAttributes(_0xc7c103);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x1c2'),_0xe7c5('0x1c3'),_0xed7d17,_0xe7c5('0x27'),_0xc7c103[_0xe7c5('0x44')]);}else if(_0x22595e<_0xc7c103[_0xe7c5('0xce')]&&_0xc7c103[_0xe7c5('0x1c1')]==='dropRate'){clearPredictiveAttributes(_0xc7c103);loggerPredictive[_0xe7c5('0x45')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xe7c5('0x1c4'),_0x22595e,_0xe7c5('0x1c5'),_0xc7c103['predictiveIntervalErlangCallsDroppedCalls'],_0xe7c5('0x27'),_0xc7c103[_0xe7c5('0x44')]);}else if(!ifInterval(_0xc7c103['dialPredictiveInterval'],_0xc7c103[_0xe7c5('0x27')])&&_[_0xe7c5('0x3c')](_0xc7c103['startPredictive'])&&!_[_0xe7c5('0x3c')](_0xc7c103[_0xe7c5('0x27')])){_0xc7c103[_0xe7c5('0x26')]=moment()['format'](_0xe7c5('0xc3'));loggerPredictive[_0xe7c5('0x45')](_0xc7c103[_0xe7c5('0x44')],_0xe7c5('0x1c6'),_0xc7c103[_0xe7c5('0x26')]);hopperUtils[_0xe7c5('0x1c7')](_0xc7c103[_0xe7c5('0x1c0')])[_0xe7c5('0x3a')](this[_0xe7c5('0x1c8')](_0xc7c103))[_0xe7c5('0x3a')](mergeDataErlangB(_0xc7c103))[_0xe7c5('0x3a')](this[_0xe7c5('0x1c9')](_0xc7c103))[_0xe7c5('0xa5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xc7c103));}else if(!ifInterval(_0xc7c103[_0xe7c5('0x1c0')],_0xc7c103[_0xe7c5('0x26')])){_0xc7c103[_0xe7c5('0xce')]=0x0;_0xc7c103[_0xe7c5('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe7c5('0x45')](_0xc7c103['name'],_0xe7c5('0x1ca'),_0xc7c103['startPredictive']);clearInterval(_0xc7c103[_0xe7c5('0x62')]);_0xc7c103['handlePredictive']=undefined;hopperUtils[_0xe7c5('0x1c7')](_0xc7c103[_0xe7c5('0x1c0')])[_0xe7c5('0x3a')](this[_0xe7c5('0x1c8')](_0xc7c103))[_0xe7c5('0x3a')](mergeDataErlangB(_0xc7c103))['then'](this[_0xe7c5('0x1c9')](_0xc7c103))[_0xe7c5('0xa5')](loggerCatchPredictive(_0xe7c5('0x1cb'),_0xc7c103));}else if(_0xc7c103['predictiveIntervalAvailable']&&_0x4eef96<_0xc7c103[_0xe7c5('0x1b7')]-_0x10519c){clearPredictiveAttributes(_0xc7c103);loggerPredictive['info'](_0xc7c103[_0xe7c5('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4eef96,')\x20are\x20less\x20than\x20threshold\x20(',_0xc7c103[_0xe7c5('0x1b7')],'-',_0x10519c,'=',_0xc7c103['predictiveIntervalAvailable']-_0x10519c,')');}else if(_0xc7c103[_0xe7c5('0x1b7')]&&_0x4eef96>_0xc7c103[_0xe7c5('0x1b7')]+_0x50abae){clearPredictiveAttributes(_0xc7c103);loggerPredictive['info'](_0xc7c103[_0xe7c5('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4eef96,_0xe7c5('0x1cc'),_0xc7c103[_0xe7c5('0x1b7')],'+',_0x50abae,'=',_0xc7c103[_0xe7c5('0x1b7')]+_0x50abae,')');}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x1c8')]=function(_0x3a500c){var _0x243baf=this;return function(_0x5cfff2){return new Promise(function(_0x25be8a,_0x3705d8){_[_0xe7c5('0x5e')](_0x3a500c,_0x5cfff2[0x0]);if(checkGetDataPredictive(_0x5cfff2[0x0])){var _0x1e9e2a=_0x3a500c[_0xe7c5('0x1b7')]=_0x3a500c[_0xe7c5('0x1ba')]+_0x3a500c[_0xe7c5('0x134')];var _0x259935=_0x3a500c[_0xe7c5('0x1c0')]*0x3c;var _0xad9366=_0x5cfff2[0x0][_0xe7c5('0x50')]+_0x5cfff2[0x0][_0xe7c5('0x53')];var _0x20886c=(_0x5cfff2[0x0]['predictiveIntervalAnsweredCalls']+_0x5cfff2[0x0][_0xe7c5('0x4b')]+_0x5cfff2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5cfff2[0x0]['predictiveIntervalTotalCalls'];_0x3a500c[_0xe7c5('0x1bb')]=_0x20886c>0x0?_0x20886c:0x1;switch(_0x3a500c[_0xe7c5('0x1c1')]){case _0xe7c5('0x1cd'):var _0x34e093=_0x3a500c[_0xe7c5('0x1b5')]/0x64;return _0x243baf[_0xe7c5('0x1ce')](_0x1e9e2a,_0x259935,_0xad9366,_0x20886c,_0x34e093)[_0xe7c5('0x3a')](function(_0x3f18b8){return _0x25be8a(_0x3f18b8);});case _0xe7c5('0x1cf'):var _0x25897f=_0x3a500c[_0xe7c5('0x1b5')]/0x64;return _0x243baf[_0xe7c5('0x1d0')](_0x1e9e2a,_0x259935,_0xad9366,_0x20886c,_0x25897f)['then'](function(_0x10bb65){return _0x25be8a(_0x10bb65);});default:return _0x3705d8(msgResponse(_0xe7c5('0x1d1'),_0xe7c5('0x96'),'Unknown\x20Predictive'));}}else{return _0x3705d8(msgResponse(_0xe7c5('0x1d1'),'Failure','check\x20failure'));}});};};Dialer[_0xe7c5('0x18')]['getDataPredictiveOld']=function(_0x5ead20){var _0x4356ee=this;return function(_0x276535){return new Promise(function(_0x4b4eb1,_0x1381a5){_[_0xe7c5('0x5e')](_0x5ead20,_0x276535[0x0]);if(checkGetDataPredictive(_0x276535[0x0])){loggerPredictive[_0xe7c5('0x45')](JSON[_0xe7c5('0x74')](_0x276535[0x0]));if(_0x5ead20[_0xe7c5('0x1c1')]===_0xe7c5('0x1cd')){return _0x4356ee[_0xe7c5('0x148')](_0x5ead20['id'])[_0xe7c5('0x3a')](function(_0x142f40){var _0x8e585a=_0x5ead20[_0xe7c5('0x1d2')]-_0x142f40[0x0][_0xe7c5('0x1d3')];var _0x1584b5=_0x5ead20[_0xe7c5('0x1c0')]*0x3c;var _0x71a503=_0x276535[0x0][_0xe7c5('0x50')]+_0x276535[0x0]['predictiveIntervalAvgHoldtime'];var _0x55565b=(_0x276535[0x0][_0xe7c5('0x4a')]+_0x276535[0x0][_0xe7c5('0x4b')]+_0x276535[0x0][_0xe7c5('0x4d')])/_0x276535[0x0][_0xe7c5('0x48')];var _0x15a306=_0x5ead20['dialPredictiveOptimizationPercentage']/0x64;_0x5ead20[_0xe7c5('0x1d4')]=_0x142f40[0x0][_0xe7c5('0x1d3')]||0x0;_0x5ead20['predictiveIntervalHitRate']=_0x55565b>0x0?_0x55565b:0x1;return _0x4356ee[_0xe7c5('0x1ce')](_0x8e585a,_0x1584b5,_0x71a503,_0x55565b,_0x15a306);})[_0xe7c5('0x3a')](function(_0x29ffba){return _0x4b4eb1(_0x29ffba);})[_0xe7c5('0xa5')](function(_0x5c6d03){return _0x1381a5(msgResponse('[CatchErlangB]',_0xe7c5('0x96'),JSON['stringify'](_0x5c6d03)));});}if(_0x5ead20[_0xe7c5('0x1c1')]===_0xe7c5('0x1cf')){return _0x4356ee[_0xe7c5('0x148')](_0x5ead20['id'])[_0xe7c5('0x3a')](function(_0x75bde){var _0x1a291d=_0x5ead20[_0xe7c5('0x1d2')]-_0x75bde[0x0][_0xe7c5('0x1d3')];var _0x1fee92=_0x5ead20[_0xe7c5('0x1c0')]*0x3c;var _0x329893=_0x276535[0x0]['predictiveIntervalAvgTalktime']+_0x276535[0x0][_0xe7c5('0x53')];var _0xc4d1d4=(_0x276535[0x0][_0xe7c5('0x4a')]+_0x276535[0x0][_0xe7c5('0x4b')]+_0x276535[0x0][_0xe7c5('0x4d')])/_0x276535[0x0]['predictiveIntervalTotalCalls'];var _0x453645=_0x5ead20[_0xe7c5('0x1b5')]/0x64;_0x5ead20['predictiveIntervalPauses']=_0x75bde[0x0][_0xe7c5('0x1d3')]||0x0;_0x5ead20['predictiveIntervalHitRate']=_0xc4d1d4>0x0?_0xc4d1d4:0x1;return _0x4356ee[_0xe7c5('0x1d0')](_0x1a291d,_0x1fee92,_0x329893,_0xc4d1d4,_0x453645);})['then'](function(_0x3b77dc){return _0x4b4eb1(_0x3b77dc);})[_0xe7c5('0xa5')](function(_0x4d788a){return _0x1381a5(msgResponse('[CatchErlangB]',_0xe7c5('0x96'),JSON['stringify'](_0x4d788a)));});}}else{return _0x1381a5(msgResponse(_0xe7c5('0x1d1'),_0xe7c5('0x96'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x287ef7){var _0x7d736=this;return function(){var _0x1c575f=0x0;var _0x50cb28=Math[_0xe7c5('0x1d5')](_0x287ef7[_0xe7c5('0x5a')]*0x3e8);if(_0x50cb28>0x0){_0x50cb28=_0x50cb28<0x64?0x64:_0x50cb28;loggerPredictive[_0xe7c5('0x45')](_0x287ef7[_0xe7c5('0x44')],'one\x20call\x20every:',_0x50cb28,_0xe7c5('0x1d6'));_0x287ef7['handlePredictive']=setInterval(function(){_0x7d736['handlePredictive'](_0x287ef7);loggerPredictiveCalls[_0xe7c5('0x45')](_0xe7c5('0x1d7'),_0x1c575f+=0x1);},_0x50cb28);}else{loggerPredictive[_0xe7c5('0x45')](_0x287ef7[_0xe7c5('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe7c5('0x18')]['checkContactBlack']=function(_0xd6ca07,_0x57e206){var _0x47fb50=this;return function(_0x1c18be){if(_[_0xe7c5('0x79')](_0x1c18be)){if(_[_0xe7c5('0xf3')](_0x57e206[_0xe7c5('0x1d8')])||!_0x57e206[_0xe7c5('0x1d9')]){if(_0xd6ca07['dialMethod']===_0xe7c5('0x9')){_0xd6ca07[_0xe7c5('0x72')]=_['isUndefined'](_0xd6ca07['queueStatusComplete'])?!![]:_0xd6ca07['queueStatusComplete'];var _0x33da34=uuid['v4']();_0x47fb50[_0xe7c5('0x23')][_0x33da34]=new Action(_0xd6ca07,_0x57e206,_0x33da34);loggerBooked[_0xe7c5('0x45')](_0xe7c5('0x1da'),_0x33da34,'queueStatusComplete:\x20',JSON[_0xe7c5('0x74')](_0xd6ca07['queueStatusComplete']),_0xe7c5('0x1db'),_0xd6ca07[_0xe7c5('0x44')]);if(_0xd6ca07[_0xe7c5('0x72')]){_0xd6ca07[_0xe7c5('0x72')]=![];_0x47fb50[_0xe7c5('0x28')][_0x47fb50['actions'][_0x33da34]['queue']]=[];ami[_0xe7c5('0x9f')]({'actionid':_0x33da34,'action':_0xe7c5('0x1dc'),'queue':_0xd6ca07[_0xe7c5('0x44')]})['catch'](function(){_0x47fb50[_0xe7c5('0xc0')](_0xd6ca07);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x47fb50['actions'][_0x33da34][_0xe7c5('0xe9')],'ListId':_0x47fb50[_0xe7c5('0x23')][_0x33da34][_0xe7c5('0xea')],'VoiceQueueId':_0x47fb50[_0xe7c5('0x23')][_0x33da34][_0xe7c5('0xdd')]||undefined,'CampaignId':_0x47fb50['actions'][_0x33da34][_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1dd')));delete _0x47fb50[_0xe7c5('0x23')][_0x33da34];});}else{loggerBooked['info'](_0xe7c5('0x1de'),JSON[_0xe7c5('0x74')](_0xd6ca07['queueStatusComplete']),_0xe7c5('0x1db'),_0xd6ca07[_0xe7c5('0x44')]);_0x47fb50[_0xe7c5('0xc0')](_0xd6ca07);hopperUtils[_0xe7c5('0xda')]({'active':![],'ContactId':_0x47fb50[_0xe7c5('0x23')][_0x33da34][_0xe7c5('0xe9')],'ListId':_0x47fb50['actions'][_0x33da34][_0xe7c5('0xea')],'VoiceQueueId':_0x47fb50['actions'][_0x33da34][_0xe7c5('0xdd')]||undefined,'CampaignId':_0x47fb50[_0xe7c5('0x23')][_0x33da34][_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1dd')));delete _0x47fb50['actions'][_0x33da34];}}else{return _0x47fb50[_0xe7c5('0x152')](_0xd6ca07,_0x57e206);}}else{if(utils[_0xe7c5('0x5f')](undefined,_0x57e206[_0xe7c5('0x1df')])<_0xd6ca07['dialRecallMeTimeout']*0x3c){if(_0x57e206[_0xe7c5('0x13f')]&&!_0x57e206[_0xe7c5('0x13f')][_0xe7c5('0x1e0')]){_0x47fb50[_0xe7c5('0x1d')]['run'](_0x57e206['id'])[_0xe7c5('0x1b')](function(){_0x47fb50[_0xe7c5('0xc0')](_0xd6ca07);});}else{hopperUtils[_0xe7c5('0x1e1')]({'active':![]},_0x57e206['id'],0x1)[_0xe7c5('0x1b')](function(){_0x47fb50[_0xe7c5('0xc0')](_0xd6ca07);});}}else{_0xd6ca07[_0xe7c5('0x1e2')]+=0x1;_0x47fb50[_0xe7c5('0xc0')](_0xd6ca07);if(_0xd6ca07[_0xe7c5('0x1e3')]){hopperUtils[_0xe7c5('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x57e206[_0xe7c5('0xe9')],'ListId':_0x57e206[_0xe7c5('0xea')],'VoiceQueueId':_0x57e206[_0xe7c5('0xdd')]||undefined,'CampaignId':_0x57e206[_0xe7c5('0xde')]||undefined})[_0xe7c5('0xa5')](loggerCatch(_0xe7c5('0x1e4')));hopperUtils[_0xe7c5('0xe2')](createObjHistory(_0xd6ca07,_0x57e206,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0xe7c5('0xa5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x47fb50[_0xe7c5('0x113')](createObjHistory(_0xd6ca07,_0x57e206,utils['CAMPAIGN_STATUS'][_0xe7c5('0x1e5')],0x16,'RecallFailedTimeout'),_0xe7c5('0x1e6'),'[Originate][HistoryRecallClose]');}}}}else{_0xd6ca07[_0xe7c5('0x1e7')]+=0x1;_0x47fb50[_0xe7c5('0x113')](createObjHistory(_0xd6ca07,_0x57e206,utils['CAMPAIGN_STATUS'][_0xe7c5('0x1e8')],0xd,'Blacklist'),_0xe7c5('0x1e9'),_0xe7c5('0x1ea'));throw _0xe7c5('0x1eb');}};};Dialer[_0xe7c5('0x18')]['handleIvr']=function(_0x130820){var _0x5c639e=this;var _0x290aa9=_0x130820[_0xe7c5('0x1ec')]-_0x130820['originated']-_0x130820[_0xe7c5('0x1ed')];emitCampaignSummary(_0x130820);if(_0x290aa9>0x0){if(_0x290aa9>this[_0xe7c5('0x22')]){_0x290aa9=this[_0xe7c5('0x22')];}_0x130820[_0xe7c5('0x1ed')]+=_0x290aa9;hopperUtils[_0xe7c5('0x1ee')](_0x130820['id'],_0x290aa9,_0x130820[_0xe7c5('0x1ef')],_0x130820)[_0xe7c5('0x3a')](function(_0x17561f){_0x130820[_0xe7c5('0x1ed')]-=_0x290aa9;_0x130820[_0xe7c5('0x1ed')]=_0x130820[_0xe7c5('0x1ed')]>0x0?_0x130820['temp']:0x0;if(!utils[_0xe7c5('0x1f0')](_0x17561f)){_0x130820[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')][_0xe7c5('0x1f1')];logger[_0xe7c5('0x45')]('[getContactCampaign2][Empty]'+_0x130820[_0xe7c5('0x44')]);}else{_0x130820[_0xe7c5('0x81')]+=_0x17561f[_0xe7c5('0x9d')];_0x130820[_0xe7c5('0x67')]=utils[_0xe7c5('0x68')]['RUNNING'];for(var _0x2c567b=0x0;_0x2c567b<_0x17561f[_0xe7c5('0x9d')];_0x2c567b+=0x1){_0x130820[_0xe7c5('0x1f2')]+=0x1;if(_[_0xe7c5('0xf3')](_0x17561f[_0x2c567b])||_[_0xe7c5('0xf3')](_0x17561f[_0x2c567b][_0xe7c5('0x16b')])||_[_0xe7c5('0xf3')](_0x17561f[_0x2c567b][_0xe7c5('0x154')])){_0x5c639e[_0xe7c5('0x1f3')](_0xe7c5('0x1f4'),_0x130820,_0x17561f[_0x2c567b]);}else{hopperUtils[_0xe7c5('0x1f5')](_[_0xe7c5('0x75')](_0x17561f[_0x2c567b],[_0xe7c5('0xde'),_0xe7c5('0x154')]))['then'](_0x5c639e[_0xe7c5('0x1f6')](_0x130820,_0x17561f[_0x2c567b]))[_0xe7c5('0xa5')](_0x5c639e[_0xe7c5('0x14a')](_0xe7c5('0x1f7'),_0x130820));}}}})[_0xe7c5('0xa5')](loggerGetContactDialer(_0xe7c5('0x1f8'),_0x130820,_0x290aa9));}};Dialer[_0xe7c5('0x18')][_0xe7c5('0xb4')]=function(_0xd671c4,_0x2b5691){var _0x5b15dd=this;var _0x330e8a=[];if(_0x2b5691<0x1||_0xd671c4[_0xe7c5('0xb3')]===_0xe7c5('0x9')){_0x2b5691=0x1;}var _0x125eac=Math[_0xe7c5('0x1d5')](_0xd671c4[_0xe7c5('0x134')]*_0x2b5691)-_0xd671c4[_0xe7c5('0x81')]-_0xd671c4['temp'];if(_0xd671c4[_0xe7c5('0x1f9')]>0x0){var _0x371cdc=_0xd671c4[_0xe7c5('0x1f9')]-_0xd671c4[_0xe7c5('0x81')]-_0xd671c4[_0xe7c5('0x1ba')]-_0xd671c4[_0xe7c5('0x1ed')]-_0xd671c4[_0xe7c5('0x135')];if(_0x125eac>_0x371cdc){_0x125eac=_0x371cdc;}}if(_0x125eac>0x0){if(_0xd671c4[_0xe7c5('0xb3')]===_0xe7c5('0x9')){_0x125eac=0x1;}if(_0x125eac>this[_0xe7c5('0x22')]){_0x125eac=this[_0xe7c5('0x22')];}_0xd671c4[_0xe7c5('0x1ed')]+=_0x125eac;for(var _0x12452f in this[_0xe7c5('0x20')]){if(typeof this['agents'][_0x12452f]!==_0xe7c5('0xad')){if(this[_0xe7c5('0x20')][_0x12452f]['state']==='not_inuse'&&this[_0xe7c5('0x20')][_0x12452f]['status']===_0xe7c5('0x8a')){_0x330e8a[_0xe7c5('0x9e')](this['agents'][_0x12452f]['id']);}}}hopperUtils[_0xe7c5('0x1fa')](_0xd671c4,_0x330e8a,_0x125eac)[_0xe7c5('0x3a')](function(_0x559651){_0xd671c4[_0xe7c5('0x1ed')]-=_0x125eac;_0xd671c4[_0xe7c5('0x1ed')]=_0xd671c4[_0xe7c5('0x1ed')]>0x0?_0xd671c4[_0xe7c5('0x1ed')]:0x0;if(!utils[_0xe7c5('0x1f0')](_0x559651)){hopperUtils['countReScheduled'](_0xd671c4)[_0xe7c5('0x3a')](sendMessageReschedule(_0xd671c4))[_0xe7c5('0xa5')](loggerCatch('[countReScheduled]\x20'));}else{_0xd671c4['originated']+=_0x559651[_0xe7c5('0x9d')];_0xd671c4[_0xe7c5('0x67')]=_0xd671c4[_0xe7c5('0xb3')]==='booked'?utils['CAMPAIGN_STATUS'][_0xe7c5('0x136')]:utils[_0xe7c5('0x68')][_0xe7c5('0x1fb')];for(var _0x4fe652=0x0;_0x4fe652<_0x559651[_0xe7c5('0x9d')];_0x4fe652+=0x1){if(_[_0xe7c5('0xf3')](_0x559651[_0x4fe652])||_[_0xe7c5('0xf3')](_0x559651[_0x4fe652][_0xe7c5('0x16b')])||_[_0xe7c5('0xf3')](_0x559651[_0x4fe652][_0xe7c5('0x154')])){_0x5b15dd[_0xe7c5('0x1f3')](_0xe7c5('0x1f4'),_0xd671c4,_0x559651[_0x4fe652]);}else{hopperUtils[_0xe7c5('0x1fc')](_['pick'](_0x559651[_0x4fe652],[_0xe7c5('0xdd'),_0xe7c5('0x154')]))['then'](_0x5b15dd['checkContactBlack'](_0xd671c4,_0x559651[_0x4fe652]))[_0xe7c5('0xa5')](_0x5b15dd['loggerHandler'](_0xe7c5('0x1f4'),_0xd671c4));}}}})[_0xe7c5('0xa5')](loggerGetContactDialer('[getContactDialer2]',_0xd671c4,_0x125eac));}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x62')]=function(_0x55aa5a){if(_0x55aa5a[_0xe7c5('0x1f9')]>0x0){var _0x52ace4=_0x55aa5a[_0xe7c5('0x1f9')]-_0x55aa5a[_0xe7c5('0x81')]-_0x55aa5a['talking'];if(_0x52ace4>0x0){this[_0xe7c5('0x1fd')](_0x55aa5a);}else{loggerPredictiveCalls[_0xe7c5('0x45')]('[handlePredictive][limitChannel]');}}else{this[_0xe7c5('0x1fd')](_0x55aa5a);}};Dialer[_0xe7c5('0x18')][_0xe7c5('0x1fd')]=function(_0x3c33b0){var _0x21765d=this;var _0x221903=[];_0x3c33b0[_0xe7c5('0x81')]+=0x1;for(var _0x3e81e7 in this[_0xe7c5('0x20')]){if(typeof this[_0xe7c5('0x20')][_0x3e81e7]!==_0xe7c5('0xad')){if(this['agents'][_0x3e81e7][_0xe7c5('0x6d')]==='not_inuse'&&this['agents'][_0x3e81e7][_0xe7c5('0x8b')]===_0xe7c5('0x8a')){_0x221903[_0xe7c5('0x9e')](this[_0xe7c5('0x20')][_0x3e81e7]['id']);}}}return this[_0xe7c5('0x1fa')](_0x3c33b0['id'],_0x221903,0x1,_0x3c33b0[_0xe7c5('0x1ef')],_0x3c33b0)[_0xe7c5('0x3a')](function(_0x5116d6){if(!utils['checkContactEmpty'](_0x5116d6)){utils[_0xe7c5('0x66')](_0x3c33b0,0x1,0x0);return hopperUtils['countReScheduled'](_0x3c33b0)[_0xe7c5('0x3a')](sendMessageReschedule(_0x3c33b0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3c33b0['message']=utils['CAMPAIGN_STATUS'][_0xe7c5('0x1fb')];if(_[_0xe7c5('0xf3')](_0x5116d6[0x0])||_['isNil'](_0x5116d6[0x0][_0xe7c5('0x16b')])||_['isNil'](_0x5116d6[0x0][_0xe7c5('0x154')])){_0x21765d[_0xe7c5('0x1f3')]('[actionOriginate]\x20',_0x3c33b0,_0x5116d6[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xe7c5('0x75')](_0x5116d6[0x0],[_0xe7c5('0xdd'),_0xe7c5('0x154')]))[_0xe7c5('0x3a')](_0x21765d[_0xe7c5('0x1f6')](_0x3c33b0,_0x5116d6[0x0]))['catch'](_0x21765d[_0xe7c5('0x14a')](_0xe7c5('0x1fe'),_0x3c33b0));}}})['catch'](loggerGetContactDialer(_0xe7c5('0x1ff'),_0x3c33b0,0x1));};Dialer[_0xe7c5('0x18')][_0xe7c5('0x1ce')]=function(_0x6f3443,_0x452c2a,_0x282c99,_0x2151d5,_0x255285,_0x30df3d){loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x200'));loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x201'),_0x6f3443);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x202'),_0x452c2a);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x203'),_0x282c99);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x204'),_0x2151d5);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x205'),_0x255285);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x51'));return new Promise(function(_0x455c61,_0x55e4f3){if(_0x6f3443<=0x0||isNaN(_0x6f3443)){return _0x55e4f3(msgResponse(_0xe7c5('0x206'),_0xe7c5('0x88'),_0xe7c5('0x207')+_0x6f3443));}if(_0x282c99<=0x0||isNaN(_0x282c99)){return _0x55e4f3(msgResponse(_0xe7c5('0x206'),_0xe7c5('0x88'),'Ts\x20=\x20'+_0x282c99));}if(_0x2151d5<=0x0||isNaN(_0x2151d5)){return _0x55e4f3(msgResponse(_0xe7c5('0x206'),_0xe7c5('0x88'),'p\x20=\x20'+_0x2151d5));}if(_0x452c2a<=0x0||isNaN(_0x452c2a)){return _0x55e4f3(msgResponse(_0xe7c5('0x206'),_0xe7c5('0x88'),_0xe7c5('0x208')+_0x452c2a));}if(_0x255285<=0x0||isNaN(_0x255285)){return _0x55e4f3(msgResponse('[abandonmentRate]',_0xe7c5('0x88'),'Amax\x20=\x20'+_0x255285));}_0x30df3d=_0x30df3d||0x0;var _0x46a196=0x1/_0x282c99;var _0x549d7b=0x0;var _0x4a076f=0x0;var _0x29197f=0x0;var _0x1957d6=0x0;for(var _0x96a8fc=0x0;_0x29197f<_0x255285;_0x96a8fc+=0x1){_0x4a076f=_0x96a8fc/_0x452c2a;_0x549d7b=(_0x2151d5*_0x4a076f+_0x30df3d)/_0x46a196;_0x29197f=utils[_0xe7c5('0x209')](_0x549d7b,_0x6f3443);_0x1957d6=_0x549d7b/_0x6f3443*(0x1-utils[_0xe7c5('0x209')](_0x549d7b,_0x6f3443));}return _0x455c61({'erlangCalls':_0x96a8fc,'erlangCallToSecond':_0x452c2a/_0x96a8fc,'erlangAbandonmentRate':_0x29197f,'erlangBusyFactor':_0x1957d6});});};Dialer[_0xe7c5('0x18')][_0xe7c5('0x1d0')]=function(_0x42e519,_0x4bd8bc,_0x1b8dcc,_0x24193b,_0x3527bd,_0x534866){loggerPredictive['info'](_0xe7c5('0x20a'));loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x201'),_0x42e519);loggerPredictive['info'](_0xe7c5('0x202'),_0x4bd8bc);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x203'),_0x1b8dcc);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x204'),_0x24193b);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x20b'),_0x3527bd);loggerPredictive[_0xe7c5('0x45')](_0xe7c5('0x51'));return new Promise(function(_0x26bcab,_0x499190){if(_0x42e519<=0x0||isNaN(_0x42e519)){return _0x499190(msgResponse('[busyFactor]',_0xe7c5('0x88'),'m\x20=\x20'+_0x42e519));}if(_0x1b8dcc<=0x0||isNaN(_0x1b8dcc)){return _0x499190(msgResponse(_0xe7c5('0x20c'),_0xe7c5('0x88'),'Ts\x20=\x20'+_0x1b8dcc));}if(_0x24193b<=0x0||isNaN(_0x24193b)){return _0x499190(msgResponse(_0xe7c5('0x20c'),_0xe7c5('0x88'),_0xe7c5('0x20d')+_0x24193b));}if(_0x4bd8bc<=0x0||isNaN(_0x4bd8bc)){return _0x499190(msgResponse('[busyFactor]',_0xe7c5('0x88'),_0xe7c5('0x208')+_0x4bd8bc));}if(_0x3527bd<=0x0||isNaN(_0x3527bd)){return _0x499190(msgResponse(_0xe7c5('0x20c'),'Error',_0xe7c5('0x20e')+_0x3527bd));}_0x534866=_0x534866||0x0;var _0xedc2f5=0x1/_0x1b8dcc;var _0x1df98f=0x0;var _0x25b61b=0x0;var _0x4cae6b=0x0;var _0xa3bf11=0x0;for(var _0x2c1e38=0x0;_0xa3bf11<_0x3527bd;_0x2c1e38+=0x1){_0x25b61b=_0x2c1e38/_0x4bd8bc;_0x1df98f=(_0x24193b*_0x25b61b+_0x534866)/_0xedc2f5;_0x4cae6b=utils[_0xe7c5('0x209')](_0x1df98f,_0x42e519);_0xa3bf11=_0x1df98f/_0x42e519*(0x1-utils[_0xe7c5('0x209')](_0x1df98f,_0x42e519));}return _0x26bcab({'erlangCalls':_0x2c1e38,'erlangCallToSecond':_0x4bd8bc/_0x2c1e38,'erlangAbandonmentRate':_0x4cae6b,'erlangBusyFactor':_0xa3bf11});});};module[_0xe7c5('0x20f')]=Dialer; \ No newline at end of file +var _0x1186=['reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','predictiveIntervalAnsweredCalls','one\x20call\x20every:','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','[busyFactor]','Ts\x20=\x20','exports','util','lodash','moment','ioredis','./utils/hopper','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','./models/action','./models/history','./models/final','XCALLY_IP_AGI','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','originateresponse','agentcomplete','syncAgentComplete','syncQueueSummary','newexten','syncNewExten','varset','syncVarSet','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startProgressive\x20value\x20cleared','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','stringify','pick','Interval','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','iftime\x20%s,%s','interval','content','indexOf','true','catch','Action','command','all','some','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','dropreason','TIMEOUT','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Abandoned]','Abandoned','swapAdditionalPhones','channel','actionid','strategy','rrmemory','locked','paused','agents','stateinterface','isNil','idHopper','syncQueueStatusComplete','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','[callProgressDetecting]\x20','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','countagentrejectretry','createStateFinal','syncHangup','ivrAnswerCallsDay','moveContactManagedDialer','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','[emptyContact][createHistory]','[emptyContact]','checkPreviewRecallReminder','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1186,0x75));var _0x6118=function(_0x4fa76b,_0x3ab755){_0x4fa76b=_0x4fa76b-0x0;var _0x5d4237=_0x1186[_0x4fa76b];return _0x5d4237;};'use strict';var util=require(_0x6118('0x0'));var _=require(_0x6118('0x1'));var uuid=require('uuid');var moment=require(_0x6118('0x2'));var rr=require('rr');var Redis=require(_0x6118('0x3'));var utils=require('./utils');var hopperUtils=require(_0x6118('0x4'));var ut=require('../preview/util/util');var config=require(_0x6118('0x5'));var logger=require('../../../config/logger')(_0x6118('0x6'));var loggerBooked=require(_0x6118('0x7'))(_0x6118('0x8'));var loggerPredictive=require(_0x6118('0x7'))('predictive');var loggerPredictiveCalls=require(_0x6118('0x7'))(_0x6118('0x9'));var loggerSyncQueueSummary=require(_0x6118('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0x6118('0xa')]=_[_0x6118('0xb')](config[_0x6118('0xa')],{'host':_0x6118('0xc'),'port':0x18eb});var io=require(_0x6118('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x6118('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x6118('0xf'));var History=require(_0x6118('0x10'));var Final=require(_0x6118('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x6118('0x12')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6118('0x13')]['enqueue']=function(_0x413e4f){this['tail']=this[_0x6118('0x14')]?this[_0x6118('0x14')][_0x6118('0x15')](_0x413e4f):_0x413e4f();};function Dialer(_0x425a6b,_0x2761df){this[_0x6118('0x16')]=new Sequence();this[_0x6118('0x17')]=_0x2761df;this[_0x6118('0x18')]=_0x425a6b[_0x6118('0x18')];this[_0x6118('0x19')]=_0x425a6b[_0x6118('0x19')];this['agents']=_0x425a6b['agents'];this[_0x6118('0x1a')]=_0x425a6b['trunks'];this[_0x6118('0x1b')]=config['maxNumberOriginate']||0x2;this[_0x6118('0x1c')]={};this[_0x6118('0x1d')]={};this[_0x6118('0x1e')]={};this[_0x6118('0x1f')]={};this[_0x6118('0x20')]={};this[_0x6118('0x21')]={};this[_0x6118('0x22')]={};this[_0x6118('0x23')]={};this[_0x6118('0x24')]={};this[_0x6118('0x25')]={};this[_0x6118('0x26')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x6118('0x27')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x6118('0x28'),this['syncOriginateResponse'][_0x6118('0x27')](this));ami['on'](_0x6118('0x29'),this[_0x6118('0x2a')][_0x6118('0x27')](this));ami['on']('custom:queuesummary',this[_0x6118('0x2b')][_0x6118('0x27')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x6118('0x27')](this));ami['on']('hangup',this['syncHangup'][_0x6118('0x27')](this));ami['on'](_0x6118('0x2c'),this[_0x6118('0x2d')]['bind'](this));ami['on'](_0x6118('0x2e'),this[_0x6118('0x2f')][_0x6118('0x27')](this));ami['on']('queuemember',this['syncQueueMember'][_0x6118('0x27')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0x6118('0x30')]();this[_0x6118('0x31')]();RpcSetting[_0x6118('0x32')]()[_0x6118('0x33')](function(_0x544137){previewRecallmeReminderInterval=_0x544137[_0x6118('0x34')];});}function isNotNull(_0x59474){return _0x59474!==null&&!_[_0x6118('0x35')](_0x59474);}function msgResponse(_0x21212f,_0x50e2ac,_0x39fcca){return{'action':_0x21212f,'response':_0x50e2ac,'message':_0x39fcca,'stack':_0x39fcca};}function emit(_0x248d0b,_0x331832,_0x1fd19b){io['to'](_0x248d0b)[_0x6118('0x36')](_0x331832,_0x1fd19b);}function emitOutboundVoiceQueueSummary(_0x6ce7e1){if(_0x6ce7e1[_0x6118('0x37')]==='outbound'){logger['debug'](_0x6118('0x38'),util[_0x6118('0x39')](_0x6ce7e1,{'showHidden':![],'depth':null}));emit(util[_0x6118('0x3a')](_0x6118('0x3b'),_0x6ce7e1['name']),_0x6118('0x3c'),_0x6ce7e1);}}function checkGetDataPredictive(_0x37488d){if(isNotNull(_0x37488d)&&!_[_0x6118('0x3d')](_0x37488d)){loggerPredictive[_0x6118('0x3e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x6118('0x3e')](_0x6118('0x3f'),_0x37488d[_0x6118('0x40')]);loggerPredictive[_0x6118('0x3e')](_0x6118('0x41'),_0x37488d['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x6118('0x42'),_0x37488d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x6118('0x43'),_0x37488d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6118('0x3e')](_0x6118('0x44'),_0x37488d[_0x6118('0x45')]);loggerPredictive['info'](_0x6118('0x46'),_0x37488d['predictiveIntervalAvgTalktime']);loggerPredictive[_0x6118('0x3e')](_0x6118('0x47'));if(_0x37488d[_0x6118('0x40')]>0x0){if(!_['isUndefined'](_0x37488d[_0x6118('0x48')])&&_0x37488d['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x6118('0x49'));if(!_[_0x6118('0x35')](_0x37488d[_0x6118('0x45')])&&_0x37488d[_0x6118('0x45')]>0x0){return!![];}loggerPredictive[_0x6118('0x3e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6118('0x3e')](_0x6118('0x4a'));}}else{loggerPredictive[_0x6118('0x3e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x318f8a){return function(_0x17a52d){loggerPredictive['info'](_0x6118('0x4b'));loggerPredictive[_0x6118('0x3e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17a52d[_0x6118('0x4c')]);loggerPredictive[_0x6118('0x3e')](_0x6118('0x4d'),_0x17a52d[_0x6118('0x4e')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17a52d[_0x6118('0x4f')]);loggerPredictive[_0x6118('0x3e')](_0x6118('0x50'),_0x17a52d[_0x6118('0x51')]);loggerPredictive[_0x6118('0x3e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17a52d[_0x6118('0x4f')]);loggerPredictive[_0x6118('0x3e')]('---------------------------');_[_0x6118('0x52')](_0x318f8a,_0x17a52d);};}function ifInterval(_0x387e50,_0x365fd9){if(_[_0x6118('0x35')](_0x365fd9)){return![];}return utils[_0x6118('0x53')](undefined,_0x365fd9)<_0x387e50*0x3c;}function clearPredictiveAttributes(_0x15901){if(_0x15901['startProgressive']){_0x15901[_0x6118('0x22')]=undefined;loggerPredictive[_0x6118('0x54')](_0x15901['name'],_0x6118('0x55'));}if(_0x15901[_0x6118('0x21')]){_0x15901[_0x6118('0x21')]=undefined;loggerPredictive[_0x6118('0x54')](_0x15901[_0x6118('0x56')],_0x6118('0x57'));}if(_0x15901[_0x6118('0x58')]){clearInterval(_0x15901['handlePredictive']);_0x15901['handlePredictive']=undefined;loggerPredictive[_0x6118('0x54')](_0x15901[_0x6118('0x56')],_0x6118('0x59'));}}function loggerCatchPredictive(_0xa0f279,_0x3c0381){return function(_0x20a1a9){loggerPredictive[_0x6118('0x5a')](_0x3c0381[_0x6118('0x56')],_0xa0f279);loggerPredictive['error'](_0x20a1a9[_0x6118('0x5b')]);clearPredictiveAttributes(_0x3c0381);};}function loggerCatch(_0x1e2ee8){return function(_0x30912f){logger[_0x6118('0x5a')](_0x1e2ee8,util[_0x6118('0x39')](_0x30912f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x24d8d4,_0x578cf8,_0x189a33){return function(_0x926bca){utils[_0x6118('0x5c')](_0x578cf8,_0x189a33,0x0);logger[_0x6118('0x5a')](_0x24d8d4,util[_0x6118('0x39')](_0x926bca,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x607e8a){return function(_0x45e8ec){if(isNotNull(_0x45e8ec)&&isNotNull(_0x45e8ec[0x0])){if(_0x45e8ec[0x0][_0x6118('0x5d')]>0x0){_0x607e8a[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS'][_0x6118('0x5f')];logger['info'](_0x6118('0x60')+_0x607e8a['name'],_0x45e8ec[0x0][_0x6118('0x5d')],_0x6118('0x61'));}else{_0x607e8a[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS'][_0x6118('0x62')];logger[_0x6118('0x3e')](_0x6118('0x63')+_0x607e8a[_0x6118('0x56')]);}}};}function createObjHistory(_0x5331b6,_0x4e217d,_0x8302d7,_0x475138,_0x150047){_0x5331b6[_0x6118('0x5e')]=_0x8302d7;var _0x5aa2d3=new Action(_0x5331b6,_0x4e217d);var _0x2e6703=new History(_0x5aa2d3);_0x2e6703[_0x6118('0x64')]=_0x475138;_0x2e6703[_0x6118('0x65')]=_0x150047;_0x2e6703[_0x6118('0x66')]=_0x5aa2d3['starttime'];return _0x2e6703;}function unlockQueueStatus(_0x30031d,_0x43400d){setTimeout(function(){if(_[_0x6118('0x35')](_0x30031d['queueStatusComplete'])){loggerBooked[_0x6118('0x5a')]('[unlockQueueStatus][undefined]',_0x43400d);}_0x30031d[_0x6118('0x67')]=!![];loggerBooked[_0x6118('0x3e')]('[booked][unlockQueueStatus]',_0x43400d,JSON[_0x6118('0x68')](_[_0x6118('0x69')](_0x30031d,['name',_0x6118('0x67')])));},0x1f3);}function checkInterval(_0x7d4ece){return function(){if(!isNotNull(_0x7d4ece[_0x6118('0x6a')])){_0x7d4ece[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x6c')];throw _0x7d4ece['name']+_0x6118('0x6d');}if(!isNotNull(_0x7d4ece[_0x6118('0x6a')][_0x6118('0x6e')])){_0x7d4ece[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x6c')];throw _0x7d4ece[_0x6118('0x56')]+_0x6118('0x6d');}if(!isNotNull(_[_0x6118('0x3d')](_0x7d4ece[_0x6118('0x6a')]['Intervals']))){_0x7d4ece[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x7d4ece[_0x6118('0x56')]+_0x6118('0x6d');}};}function checkIsIVRCampaignActive(_0x5f2ac6){return function(){if(!utils[_0x6118('0x6f')](_0x5f2ac6)){_0x5f2ac6[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x70')];throw _0x5f2ac6[_0x6118('0x56')]+_0x6118('0x71');}};}function emitCampaignSummary(_0x37395e){if(utils[_0x6118('0x72')](_0x37395e)){emit(util[_0x6118('0x3a')](_0x6118('0x73'),_0x37395e[_0x6118('0x56')]),_0x6118('0x74'),_0x37395e);}}function loggerCatchQueueSummary(_0xb50900,_0x3449d9){return function(_0x32546f){clearPredictiveAttributes(_0x3449d9);emitCampaignSummary(_0x3449d9);loggerSyncQueueSummary[_0x6118('0x54')](_0xb50900,util['inspect'](_0x32546f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x30bde3){if(_0x30bde3[_0x6118('0x75')]){if(_0x30bde3[_0x6118('0x76')]===0x0){_0x30bde3['sendMessageOneNotActive']=![];_0x30bde3[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS'][_0x6118('0x70')];loggerSyncQueueSummary[_0x6118('0x54')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x30bde3['name'],'is\x20not\x20active');}else{_0x30bde3[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary['debug'](_0x6118('0x77'),_0x30bde3[_0x6118('0x56')],_0x6118('0x78'));}emitCampaignSummary(_0x30bde3);}}function myreject(_0x12efc0){return function(_0x1c67dc){return _0x12efc0(msgResponse(_0x6118('0x79'),_0x6118('0x7a'),JSON['stringify'](_0x1c67dc)));};}Dialer['prototype'][_0x6118('0x7b')]=function(_0x3ef924){return!_[_0x6118('0x35')](_0x3ef924)&&_0x3ef924&&!_['isUndefined'](_0x3ef924[_0x6118('0x56')])&&!_[_0x6118('0x35')](_0x3ef924['active'])&&_0x3ef924[_0x6118('0x7c')]&&(this[_0x6118('0x1a')][util[_0x6118('0x3a')](_0x6118('0x7d'),_0x3ef924['name'])][_0x6118('0x7e')]===_0x6118('0x7f')||this[_0x6118('0x1a')][util[_0x6118('0x3a')]('SIP/%s',_0x3ef924['name'])][_0x6118('0x7e')]==='unmonitored');};Dialer['prototype'][_0x6118('0x80')]=function(_0x43489e){var _0x3e0ba3=this;return function(){if(!_0x3e0ba3[_0x6118('0x7b')](_0x43489e['Trunk'])){if(!_0x3e0ba3[_0x6118('0x7b')](_0x43489e[_0x6118('0x81')])){_0x43489e['message']=utils['CAMPAIGN_STATUS'][_0x6118('0x82')];throw _0x43489e[_0x6118('0x56')]+_0x6118('0x83');}}};};Dialer['prototype'][_0x6118('0x84')]=function(_0x39dac9,_0x37e0c3,_0x28d801,_0x5e1bee){var _0x2a7535=this;return function(){var _0x13fd6d=!![];return _0x2a7535[_0x6118('0x85')](_0x39dac9,_0x37e0c3,_0x28d801,_0x5e1bee,_0x13fd6d);};};Dialer[_0x6118('0x13')][_0x6118('0x86')]=function(_0x5d1ae6,_0x258902,_0x555fc4,_0x1599f1){var _0x3d5128=this;return function(){var _0x29306d=![];return _0x3d5128['ifTimeIvr'](_0x5d1ae6[_0x6118('0x6e')],_0x258902,_0x555fc4,_0x1599f1,_0x29306d);};};Dialer['prototype']['ifTimeIvr']=function(_0x3f19d7,_0x58b6d7,_0x1b9333,_0xa56969,_0x2ce2b8){var _0x3dd990=[];return new Promise(function(_0x3369f1,_0x47e019){if(!isNotNull(_0x3f19d7)){_0xa56969[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x6c')];return _0x47e019(msgResponse(_0x6118('0x87'),_0x6118('0x88'),_0x1b9333+_0x6118('0x89')));}if(_[_0x6118('0x3d')](_0x3f19d7)){_0xa56969[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x8a')];return _0x47e019(msgResponse(_0x6118('0x87'),_0x6118('0x88'),_0x1b9333+_0x6118('0x8b')));}if(_0x58b6d7&&_[_0x6118('0x35')](config[_0x6118('0x8c')][_0x58b6d7])){_0xa56969[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x8d')];return _0x47e019(msgResponse(_0x6118('0x87'),_0x6118('0x88'),_0x1b9333+_0x6118('0x8e')+_0x58b6d7));}if(_['isArray'](_0x3f19d7)){for(var _0x4f7d40=0x0;_0x4f7d40<_0x3f19d7[_0x6118('0x8f')];_0x4f7d40+=0x1){_0x3dd990[_0x6118('0x90')](ami['Action']({'action':'command','command':util['format'](_0x6118('0x91'),_0x3f19d7[_0x4f7d40][_0x6118('0x92')],!_[_0x6118('0x35')](config[_0x6118('0x8c')][_0x58b6d7])?_0x58b6d7:'')})[_0x6118('0x33')](function(_0x4653b7){return _0x4653b7[_0x6118('0x93')][_0x6118('0x94')](_0x6118('0x95'))>=0x0;})[_0x6118('0x96')](myreject(_0x47e019)));}}else{_0x3dd990['push'](ami[_0x6118('0x97')]({'action':_0x6118('0x98'),'command':util['format']('iftime\x20%s,%s',_0x3f19d7,!_[_0x6118('0x35')](config[_0x6118('0x8c')][_0x58b6d7])?_0x58b6d7:'')})[_0x6118('0x33')](function(_0x33da45){return _0x33da45[_0x6118('0x93')][_0x6118('0x94')](_0x6118('0x95'))>=0x0;})['catch'](myreject(_0x47e019)));}Promise[_0x6118('0x99')](_0x3dd990)[_0x6118('0x33')](function(_0x45f7f9){var _0x5d6a7d=_[_0x6118('0x9a')](_0x45f7f9);if(_0x5d6a7d){return _0x3369f1(_0x5d6a7d);}else{_0xa56969[_0x6118('0x5e')]=_0x2ce2b8?utils[_0x6118('0x6b')][_0x6118('0x9b')]:utils[_0x6118('0x6b')]['OVERTIME_INTERVAL'];return _0x47e019(msgResponse('[ifTime][promiseAll]',_0x6118('0x88'),'Global:\x20'+_0x2ce2b8+'\x20'+_0x1b9333+_0x6118('0x9c')+util['inspect'](_0x3f19d7,{'showHidden':![],'depth':null})+_0x6118('0x9d')+_0x58b6d7));}})['catch'](function(_0x264431){return _0x47e019(msgResponse('ifTime','Failure',JSON['stringify'](_0x264431)));});});};Dialer[_0x6118('0x13')]['loopCampaigns']=function(){var _0x5226ff=this;return cmHopper[_0x6118('0x9e')]({'active':![]},{'where':{'active':!![]}})[_0x6118('0x33')](function(){setInterval(function(){_0x5226ff[_0x6118('0x9f')]();},0x3e8);});};Dialer['prototype'][_0x6118('0x9f')]=function(){var _0x1051b0=this;var _0x48bdb3;for(var _0x17141a in this[_0x6118('0x19')]){if(typeof this['campaigns'][_0x17141a]!=='undefined'){_0x48bdb3=this[_0x6118('0x19')][_0x17141a];if(utils['isIVRCampaign'](_0x48bdb3)&&utils[_0x6118('0x6f')](_0x48bdb3)){_0x48bdb3[_0x6118('0x75')]=!![];Promise[_0x6118('0xa0')]()['then'](checkIsIVRCampaignActive(_0x48bdb3))[_0x6118('0x33')](checkInterval(_0x48bdb3))[_0x6118('0x33')](_0x1051b0[_0x6118('0x80')](_0x48bdb3))['then'](_0x1051b0[_0x6118('0x84')](_0x48bdb3[_0x6118('0xa1')],_0x48bdb3['dialTimezone'],_0x48bdb3[_0x6118('0x56')],_0x48bdb3))[_0x6118('0x33')](_0x1051b0['checkIfTimeIntervals'](_0x48bdb3[_0x6118('0x6a')],_0x48bdb3[_0x6118('0xa2')],_0x48bdb3[_0x6118('0x56')],_0x48bdb3))[_0x6118('0x33')](_0x1051b0[_0x6118('0xa3')](_0x48bdb3))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x48bdb3));}else{notSendMessagesCampaign(_0x48bdb3);}}}};Dialer['prototype'][_0x6118('0xa4')]=function(_0x900ea){if(_0x900ea[_0x6118('0xa5')]!==_0x6118('0xa6')){clearPredictiveAttributes(_0x900ea);}switch(_0x900ea['dialMethod']){case _0x6118('0xa7'):this[_0x6118('0xa8')](_0x900ea,0x1);break;case _0x6118('0xa9'):this[_0x6118('0xa8')](_0x900ea,_0x900ea[_0x6118('0xaa')]);break;case _0x6118('0xa6'):this[_0x6118('0xa6')](_0x900ea);break;case _0x6118('0x8'):this[_0x6118('0xa8')](_0x900ea,0x1);break;default:logger[_0x6118('0x5a')](_0x6118('0xab'),_0x900ea[_0x6118('0x56')],_0x6118('0xac'));}};Dialer[_0x6118('0x13')][_0x6118('0x87')]=function(_0x1c3b0f,_0x39d198){var _0x16de8b=_0x1c3b0f[_0x6118('0xa2')];var _0x538ffb=_0x39d198?_0x1c3b0f[_0x6118('0xa1')]:_0x1c3b0f[_0x6118('0x6a')][_0x6118('0x6e')];logger[_0x6118('0xad')](_0x6118('0xae'),_0x538ffb,_0x16de8b,_0x1c3b0f['name'],util[_0x6118('0x3a')](_0x6118('0xaf'),_0x1c3b0f['name'],_0x1c3b0f['id']));var _0x209c73=null;return Interval[_0x6118('0xb0')](_0x538ffb,_0x16de8b)[_0x6118('0x33')](function(_0x167204){if(_0x167204===!![]){return _0x167204;}else{_0x1c3b0f['message']=_0x39d198?utils[_0x6118('0x6b')][_0x6118('0x9b')]:utils['CAMPAIGN_STATUS'][_0x6118('0xb1')];_0x209c73=msgResponse(_0x6118('0xb2'),_0x6118('0x88'),_0x6118('0xb3')+_0x39d198+'\x20'+_0x1c3b0f[_0x6118('0x56')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x6118('0x39')](_0x538ffb,{'showHidden':![],'depth':null})+_0x6118('0x9d')+_0x16de8b);}if(_0x209c73!==null){logger[_0x6118('0xad')](_0x6118('0xb4'),_0x209c73);_0x209c73[_0x6118('0xb5')]=_0x39d198;throw _0x209c73;}})[_0x6118('0x96')](function(_0x54c609){logger[_0x6118('0x5a')](_0x6118('0xb6'),_0x54c609);throw msgResponse(_0x6118('0x79'),_0x6118('0x7a'),util[_0x6118('0x39')](_0x54c609,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x6118('0xb7')]=function(_0x22e7d0){if(this['voiceQueues'][_0x22e7d0[_0x6118('0xb8')]]){if(this['uniqueId'][_0x22e7d0[_0x6118('0xb9')]]&&this[_0x6118('0x1f')][_0x22e7d0['uniqueid']]['type']!==_0x6118('0xba')){this['updateOriginated'](this[_0x6118('0x18')][_0x22e7d0[_0x6118('0xb8')]]);this['uniqueId'][_0x22e7d0[_0x6118('0xb9')]][_0x6118('0xbb')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));}}};Dialer['prototype'][_0x6118('0x2a')]=function(_0x49606a){var _0x4f8f01=this['uniqueId'][_0x49606a[_0x6118('0xb9')]];if(this[_0x6118('0x18')][_0x49606a[_0x6118('0xb8')]]){if(_0x4f8f01&&_0x4f8f01[_0x6118('0x37')]!=='ivr'){delete this['uniqueId'][_0x49606a[_0x6118('0xb9')]];this[_0x6118('0x18')][_0x49606a[_0x6118('0xb8')]][_0x6118('0xbd')]+=0x1;var _0x257fa1=new AgentComplete(_0x4f8f01,_0x49606a);if(_0x49606a['reason']===_0x6118('0xbe')){_0x257fa1[_0x6118('0xbf')]=this['voiceQueues'][_0x49606a[_0x6118('0xb8')]]['dialQueueProject2']&&this[_0x6118('0x18')][_0x49606a[_0x6118('0xb8')]][_0x6118('0xc0')]?moment()[_0x6118('0x3a')](_0x6118('0xbc')):undefined;}hopperUtils[_0x6118('0xc1')](_0x257fa1)['catch'](loggerCatch(_0x6118('0xc2')));hopperUtils['moveContactManagedDialer'](_0x257fa1)[_0x6118('0x96')](loggerCatch(_0x6118('0xc3')));}}};Dialer[_0x6118('0x13')][_0x6118('0xc4')]=function(_0x8668ec){var _0x50a61=this[_0x6118('0x1f')][_0x8668ec['uniqueid']];var _0x345e0b=this;var _0x1dd3d3=![];var _0x210f99;var _0x3a5f7a;if(this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]]){if(_0x50a61&&_0x50a61[_0x6118('0x37')]!==_0x6118('0xba')){delete this[_0x6118('0x1f')][_0x8668ec[_0x6118('0xb9')]];this[_0x6118('0xc5')](this[_0x6118('0x18')][_0x8668ec['queue']]);_0x50a61[_0x6118('0xc6')]=moment()['format'](_0x6118('0xbc'));var _0x2e3425=new QueueCallerAbandon(_0x50a61,_0x8668ec);if(utils[_0x6118('0x53')](_0x50a61[_0x6118('0xc6')],_0x50a61[_0x6118('0xc7')])>=_0x50a61[_0x6118('0xc8')]){this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xc9')]+=0x1;this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x6118('0x18')][_0x8668ec['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2e3425[_0x6118('0x64')]=0xa;_0x2e3425['statedesc']='Drop';_0x2e3425[_0x6118('0xca')]=_0x6118('0xcb');_0x2e3425[_0x6118('0xbf')]=this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xcc')]?moment()[_0x6118('0x3a')](_0x6118('0xbc')):undefined;_0x2e3425[_0x6118('0xcd')]+=0x1;_0x2e3425['countglobal']+=0x1;_0x210f99=this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xce')];_0x3a5f7a=this['voiceQueues'][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xcf')];hopperUtils[_0x6118('0xd0')](_0x2e3425,_0x2e3425['state'],_0x50a61['voiceQueue'])[_0x6118('0x33')](function(_0xdf4e0e){_0x1dd3d3=_0xdf4e0e[_0x6118('0xd1')]==0x1;if(_0x2e3425[_0x6118('0xcd')]>=_0x345e0b[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]]['dialDropMaxRetry']){_0x345e0b[_0x6118('0xd2')](_0x2e3425,_0xdf4e0e[_0x6118('0xd1')]);}else{hopperUtils[_0x6118('0xd3')]({'active':![],'countdropretry':_0x2e3425[_0x6118('0xcd')],'scheduledat':moment()[_0x6118('0xd4')](_0x345e0b[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xce')],'minutes')['format'](_0x6118('0xbc')),'ContactId':_0x50a61[_0x6118('0xd5')],'ListId':_0x50a61['ListId'],'VoiceQueueId':_0x50a61['VoiceQueueId']||undefined,'CampaignId':_0x50a61['CampaignId']||undefined})['catch'](loggerCatch(_0x6118('0xd6')));var _0x53f6a1=new History(_0x2e3425);_0x53f6a1[_0x6118('0x64')]=0xa;_0x53f6a1[_0x6118('0x65')]=_0x6118('0xd7');_0x53f6a1[_0x6118('0xd8')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));_0x53f6a1[_0x6118('0x66')]=_0x53f6a1[_0x6118('0xd8')];_0x53f6a1['calleridname']=_0x2e3425[_0x6118('0xd9')];_0x53f6a1[_0x6118('0xda')]=_0x2e3425['calleridnum'];hopperUtils[_0x6118('0xc1')](_0x53f6a1)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x6118('0x33')](function(){if(_0x1dd3d3)hopperUtils['swapAdditionalPhones'](_0x2e3425,_0x210f99,_0x3a5f7a)[_0x6118('0x33')](function(){return 0x1;});});}else{this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xdb')]+=0x1;_0x2e3425[_0x6118('0x64')]=0xb;_0x2e3425[_0x6118('0x65')]='Abandoned';_0x2e3425['dropreason']=_0x6118('0xdc');_0x2e3425[_0x6118('0xdd')]+=0x1;_0x2e3425[_0x6118('0xde')]+=0x1;_0x210f99=this[_0x6118('0x18')][_0x8668ec['queue']]['dialAbandonedRetryFrequency'];_0x3a5f7a=this[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xcf')];hopperUtils[_0x6118('0xd0')](_0x2e3425,_0x2e3425['state'],_0x50a61['voiceQueue'])['then'](function(_0x4b9749){if(_0x2e3425[_0x6118('0xdd')]>=_0x345e0b[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xdf')]){_0x345e0b['queueCallerAbandonCreateState'](_0x2e3425,_0x4b9749[_0x6118('0xd1')]);}else{hopperUtils[_0x6118('0xd3')]({'active':![],'countabandonedretry':_0x2e3425[_0x6118('0xdd')],'scheduledat':moment()[_0x6118('0xd4')](_0x345e0b[_0x6118('0x18')][_0x8668ec[_0x6118('0xb8')]][_0x6118('0xe0')],_0x6118('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50a61[_0x6118('0xd5')],'ListId':_0x50a61[_0x6118('0xe2')],'VoiceQueueId':_0x50a61[_0x6118('0xe3')]||undefined,'CampaignId':_0x50a61[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0xe5')));var _0x334b6e=new History(_0x2e3425);_0x334b6e[_0x6118('0x64')]=0xb;_0x334b6e[_0x6118('0x65')]=_0x6118('0xe6');_0x334b6e[_0x6118('0xd8')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));_0x334b6e[_0x6118('0x66')]=_0x334b6e[_0x6118('0xd8')];_0x334b6e[_0x6118('0xd9')]=_0x2e3425[_0x6118('0xd9')];_0x334b6e[_0x6118('0xda')]=_0x2e3425[_0x6118('0xda')];hopperUtils[_0x6118('0xc1')](_0x334b6e)[_0x6118('0x96')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x6118('0x33')](function(){if(_0x1dd3d3)hopperUtils[_0x6118('0xe7')](_0x2e3425,_0x210f99,_0x3a5f7a)['then'](function(){return 0x1;});});}}}};Dialer[_0x6118('0x13')][_0x6118('0x2d')]=function(_0x1539b3){if(this['actions'][_0x1539b3['uniqueid']]){this[_0x6118('0x1d')][_0x1539b3[_0x6118('0xb9')]]['channel']=_0x1539b3[_0x6118('0xe8')];}if(this[_0x6118('0x1f')][_0x1539b3['uniqueid']]){this[_0x6118('0x1f')][_0x1539b3[_0x6118('0xb9')]][_0x6118('0xe8')]=_0x1539b3[_0x6118('0xe8')];}};Dialer[_0x6118('0x13')]['syncQueueMember']=function(_0x4bbb23){if(!this['actions'][_0x4bbb23[_0x6118('0xe9')]]){return;}var _0x8d8071=this[_0x6118('0x18')][this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xb8')]][_0x6118('0xea')]||_0x6118('0xeb');if(_0x8d8071==='roundrobin'){if(this['actions'][_0x4bbb23['actionid']]&&_['isNil'](this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xec')])&&_0x4bbb23['status']==='1'&&_0x4bbb23[_0x6118('0xed')]==='0'){if(this[_0x6118('0xee')][_0x4bbb23[_0x6118('0xef')]]){if(!this[_0x6118('0xee')][_0x4bbb23[_0x6118('0xef')]][_0x6118('0xec')]){this[_0x6118('0xee')][_0x4bbb23[_0x6118('0xef')]][_0x6118('0xec')]=!![];this['actions'][_0x4bbb23['actionid']]['locked']=!![];this['actions'][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xef')]=_0x4bbb23['stateinterface'];}}}}else if(_0x8d8071===_0x6118('0xeb')){if(this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]]){if(this[_0x6118('0xee')][_0x4bbb23[_0x6118('0xef')]]){this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xef')]=_0x4bbb23[_0x6118('0xef')];if(_[_0x6118('0xf0')](this[_0x6118('0x24')][this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xb8')]])){this[_0x6118('0x24')][this[_0x6118('0x1d')][_0x4bbb23['actionid']][_0x6118('0xb8')]]=[];}this[_0x6118('0x24')][this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]][_0x6118('0xb8')]][_0x6118('0x90')](_[_0x6118('0x52')](_[_0x6118('0x69')](this[_0x6118('0x1d')][_0x4bbb23[_0x6118('0xe9')]],[_0x6118('0xf1'),_0x6118('0xef')]),{'status':_0x4bbb23[_0x6118('0x7e')],'paused':_0x4bbb23['paused']}));}}}};Dialer[_0x6118('0x13')][_0x6118('0xf2')]=function(_0x294316){if(!this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]]){return;}var _0x150a04=this;var _0x5d6879=this['voiceQueues'][this[_0x6118('0x1d')][_0x294316['actionid']][_0x6118('0xb8')]];var _0x39e7d4=_0x5d6879[_0x6118('0xea')]||_0x6118('0xeb');if(_0x39e7d4===_0x6118('0xf3')){if(this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]]&&this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]]['stateinterface']){this[_0x6118('0x17')][_0x6118('0xf4')](this[_0x6118('0x1d')][_0x294316['actionid']]['idHopper'],this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]]['stateinterface'])[_0x6118('0x96')](function(_0x2cf4ec){logger['error'](_0x6118('0xf5'),util[_0x6118('0x39')](_0x2cf4ec,{'showHidden':![],'depth':null}));})['finally'](function(){_0x150a04[_0x6118('0xc5')](_0x150a04[_0x6118('0x18')][_0x150a04[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]]);_0x150a04['agents'][_0x150a04['actions'][_0x294316[_0x6118('0xe9')]]['stateinterface']]['locked']=![];delete _0x150a04['actions'][_0x294316[_0x6118('0xe9')]];unlockQueueStatus(_0x5d6879);});}else{this['updateOriginated'](this[_0x6118('0x18')][this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]]['queue']]);hopperUtils[_0x6118('0xd3')]({'active':![],'ContactId':this['actions'][_0x294316['actionid']][_0x6118('0xd5')],'ListId':this['actions'][_0x294316['actionid']][_0x6118('0xe2')],'VoiceQueueId':this['actions'][_0x294316[_0x6118('0xe9')]][_0x6118('0xe3')]||undefined,'CampaignId':this[_0x6118('0x1d')][_0x294316['actionid']]['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0xf6')));delete this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]];unlockQueueStatus(_0x5d6879);}}else if(_0x39e7d4==='rrmemory'){var _0x5ce3d1;if(this['actions'][_0x294316[_0x6118('0xe9')]]&&!_['isEmpty'](this[_0x6118('0x24')][this['actions'][_0x294316['actionid']][_0x6118('0xb8')]])){if(this[_0x6118('0x25')][_0x150a04['actions'][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]]){this[_0x6118('0x25')][_0x150a04[_0x6118('0x1d')][_0x294316['actionid']][_0x6118('0xb8')]]=this[_0x6118('0x25')][this['actions'][_0x294316['actionid']][_0x6118('0xb8')]]?this[_0x6118('0x25')][this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]]:this[_0x6118('0x24')][this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]]?this['queueBooked'][this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]][_0x6118('0xf7')]||0x0:0x0;}this['queueBooked'][this[_0x6118('0x1d')][_0x294316[_0x6118('0xe9')]][_0x6118('0xb8')]][_0x6118('0xf7')]=this['queueBookedRR'][this[_0x6118('0x1d')][_0x294316['actionid']][_0x6118('0xb8')]];for(var _0xb0e56b=0x0;_0xb0e56b=_0x5b0a2f[_0x6118('0x11a')]){_0x3bcf3d[_0x6118('0x11b')](_0x1c9926,_0x1e95a5,_0x77dcaf,_0x6118('0x11c'));}else{if(_0x1c9926[_0x6118('0x114')]>=_0x5b0a2f[_0x6118('0x11d')]){_0x3bcf3d['createStateFinal'](_0x1c9926,_0x1e95a5,_0x77dcaf,_0x6118('0x11e'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1c9926[_0x6118('0x114')],'scheduledat':moment()[_0x6118('0xd4')](_0x5b0a2f[_0x6118('0x11f')],_0x6118('0xe1'))[_0x6118('0x3a')](_0x6118('0xbc')),'ContactId':_0x1c9926[_0x6118('0xd5')],'ListId':_0x1c9926['ListId'],'VoiceQueueId':_0x1c9926[_0x6118('0xe3')]||undefined,'CampaignId':_0x1c9926[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0x120')));_0x1e95a5({'reschedule':0x1});}}});}if(_0x24e32f['type']===_0x6118('0xba')&&this[_0x6118('0x19')][_0x24e32f['queue']][_0x6118('0x107')]&&_0x5c0f0a[_0x6118('0x108')]===_0x6118('0x109')){delete this[_0x6118('0x1f')][_0x5c0f0a[_0x6118('0xb9')]];this[_0x6118('0xc5')](this['campaigns'][_0x24e32f[_0x6118('0xb8')]]);_0x22e19f=new Hangup(_0x24e32f,_0x5c0f0a);_0x22e19f['state']=0x12;_0x22e19f[_0x6118('0x65')]=_0x6118('0x10b');_0x22e19f[_0x6118('0x10c')]='AMD';ami['emit'](_0x6118('0x10e'),ut['buildObj'](_0x22e19f,_0x6118('0x10f')));this[_0x6118('0x121')](_0x22e19f,_0x6118('0x122'),'[syncHangupInAMDIvr]');}if(_0x24e32f[_0x6118('0x37')]===_0x6118('0xba')&&this[_0x6118('0x19')][_0x24e32f[_0x6118('0xb8')]][_0x6118('0x107')]&&_0x5c0f0a[_0x6118('0x108')]===_0x6118('0x112')){return new Promise(function(_0x2b7f8e,_0x540ec0){delete _0x3bcf3d[_0x6118('0x1f')][_0x5c0f0a['uniqueid']];_0x3bcf3d[_0x6118('0xc5')](_0x3bcf3d[_0x6118('0x19')][_0x24e32f[_0x6118('0xb8')]]);_0x3bcf3d[_0x6118('0x19')][_0x24e32f[_0x6118('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x3bcf3d[_0x6118('0x19')][_0x24e32f[_0x6118('0xb8')]][_0x6118('0x10a')]+=0x1;var _0x27ca16=_0x3bcf3d[_0x6118('0x19')][_0x24e32f[_0x6118('0xb8')]];var _0x3739f4=new Hangup(_0x24e32f,_0x5c0f0a);_0x3739f4[_0x6118('0x64')]=0x13;_0x3739f4[_0x6118('0x65')]=_0x6118('0x113');_0x3739f4[_0x6118('0x10c')]='AMD';_0x3739f4[_0x6118('0x114')]+=0x1;_0x3739f4[_0x6118('0xde')]+=0x1;_0x3739f4[_0x6118('0x10f')]=!![];ami[_0x6118('0x36')](_0x6118('0x10e'),ut['buildObj'](_0x3739f4,_0x6118('0x10f')));hopperUtils[_0x6118('0xc1')](_0x3739f4)[_0x6118('0x96')](loggerCatch(_0x6118('0x116')));if(_0x3739f4[_0x6118('0x117')]+_0x3739f4['countcongestionretry']+_0x3739f4[_0x6118('0x123')]+_0x3739f4[_0x6118('0x119')]+_0x3739f4['countdropretry']+_0x3739f4[_0x6118('0xdd')]+_0x3739f4['countmachineretry']+_0x3739f4[_0x6118('0x124')]>=_0x27ca16[_0x6118('0x11a')]){_0x3bcf3d[_0x6118('0x11b')](_0x3739f4,_0x2b7f8e,_0x540ec0,'reason19\x20machine....');}else{if(_0x3739f4[_0x6118('0x114')]>=_0x27ca16[_0x6118('0x11d')]){_0x3bcf3d[_0x6118('0x125')](_0x3739f4,_0x2b7f8e,_0x540ec0,_0x6118('0x11e'));}else{hopperUtils[_0x6118('0xd3')]({'active':![],'countmachineretry':_0x3739f4[_0x6118('0x114')],'scheduledat':moment()[_0x6118('0xd4')](_0x27ca16['dialMachineRetryFrequency'],_0x6118('0xe1'))[_0x6118('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3739f4['ContactId'],'ListId':_0x3739f4[_0x6118('0xe2')],'VoiceQueueId':_0x3739f4[_0x6118('0xe3')]||undefined,'CampaignId':_0x3739f4['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch('[rescheduleContact][Machine]'));_0x2b7f8e({'reschedule':0x1});}}});}}};Dialer[_0x6118('0x13')][_0x6118('0x126')]=function(_0x16ba14){var _0x133c2e=this[_0x6118('0x1f')][_0x16ba14[_0x6118('0xb9')]];var _0x2ba41c;if(_0x133c2e&&_0x133c2e[_0x6118('0x37')]===_0x6118('0xba')){delete this[_0x6118('0x1f')][_0x16ba14['uniqueid']];this['updateOriginated'](this['campaigns'][_0x133c2e[_0x6118('0xb8')]]);this['campaigns'][_0x133c2e['queue']][_0x6118('0x127')]+=0x1;_0x2ba41c=new Hangup(_0x133c2e,_0x16ba14);hopperUtils[_0x6118('0xc1')](_0x2ba41c)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x6118('0x128')](_0x2ba41c)[_0x6118('0x96')](loggerCatch('[syncHangupIvr]'));}if(_0x133c2e&&_0x133c2e[_0x6118('0x37')]!==_0x6118('0xba')&&isNotNull(this[_0x6118('0x18')][_0x133c2e['queue']][_0x6118('0x129')])){delete this[_0x6118('0x1f')][_0x16ba14[_0x6118('0xb9')]];this[_0x6118('0xc5')](this['voiceQueues'][_0x133c2e[_0x6118('0xb8')]]);this[_0x6118('0x18')][_0x133c2e[_0x6118('0xb8')]][_0x6118('0xbd')]+=0x1;this['voiceQueues'][_0x133c2e[_0x6118('0xb8')]][_0x6118('0x10a')]+=0x1;_0x2ba41c=new Hangup(_0x133c2e,_0x16ba14);_0x2ba41c['state']=0x10;_0x2ba41c[_0x6118('0x65')]='AnswerAGI';_0x2ba41c['membername']=_0x6118('0x12a');hopperUtils['createHistory'](_0x2ba41c)['catch'](loggerCatch(_0x6118('0x12b')));hopperUtils['moveContactManagedDialer'](_0x2ba41c)[_0x6118('0x96')](loggerCatch('[syncHangupIvr]'));}if(_0x133c2e&&_0x133c2e['type']!==_0x6118('0xba')&&!isNotNull(this[_0x6118('0x18')][_0x133c2e[_0x6118('0xb8')]][_0x6118('0x129')])){delete this[_0x6118('0x1f')][_0x16ba14[_0x6118('0xb9')]];this[_0x6118('0xc5')](this[_0x6118('0x18')][_0x133c2e[_0x6118('0xb8')]]);this[_0x6118('0x18')][_0x133c2e[_0x6118('0xb8')]][_0x6118('0x12c')]+=0x1;_0x2ba41c=new Hangup(_0x133c2e,_0x16ba14);_0x2ba41c[_0x6118('0x64')]=0xc;_0x2ba41c['statedesc']=_0x16ba14[_0x6118('0x12d')];_0x2ba41c[_0x6118('0x10c')]=_0x6118('0x12e');hopperUtils['createHistory'](_0x2ba41c)['catch'](loggerCatch(_0x6118('0x12b')));hopperUtils[_0x6118('0x128')](_0x2ba41c)[_0x6118('0x96')](loggerCatch(_0x6118('0x12f')));}};Dialer[_0x6118('0x13')][_0x6118('0x2b')]=function(_0x37079b){var _0x5683b3=this;if(!_0x5683b3[_0x6118('0x26')][_0x37079b[_0x6118('0x56')]]){_0x5683b3['queuesSummary'][_0x37079b['name']]={'running':![]};}else if(_0x5683b3[_0x6118('0x26')][_0x37079b['name']][_0x6118('0x130')]===!![]){return;}else if(_0x5683b3[_0x6118('0x26')][_0x37079b[_0x6118('0x56')]][_0x6118('0x130')]===![]){_0x5683b3[_0x6118('0x26')][_0x37079b['name']][_0x6118('0x130')]=!![];}var _0xbcd557=_0x5683b3[_0x6118('0x18')][_0x37079b[_0x6118('0x56')]];var _0x226ad5=_0xbcd557[_0x6118('0x5e')]!==utils['CAMPAIGN_STATUS'][_0x6118('0x70')];var _0x477706=utils[_0x6118('0x131')](_0xbcd557);_0xbcd557[_0x6118('0x132')]=utils[_0x6118('0x133')](_0xbcd557,_0x5683b3[_0x6118('0x1a')]);Promise[_0x6118('0xa0')]()[_0x6118('0x33')](function(){if(_0xbcd557['statusMessage']===utils['CAMPAIGN_STATUS'][_0x6118('0x70')]){if(_0x226ad5){clearPredictiveAttributes(_0xbcd557);_0x37079b['startPredictive']=undefined;_0x37079b[_0x6118('0x22')]=undefined;}if(_0xbcd557['statusMessage']===utils[_0x6118('0x6b')][_0x6118('0x70')]){_0x37079b['available']=0x0;_0x37079b['paused']=0x0;_0x37079b[_0x6118('0x134')]=0x0;_0x37079b[_0x6118('0x135')]=0x0;_0x37079b[_0x6118('0x136')]=0x0;}}else if(_0xbcd557[_0x6118('0x132')]===utils[_0x6118('0x6b')][_0x6118('0x137')]&&!_0x477706){return _0x5683b3['ifTime'](_0xbcd557,!![])[_0x6118('0x33')](function(){return _0x5683b3[_0x6118('0x87')](_0xbcd557,![]);})[_0x6118('0x33')](function(){return _0x5683b3[_0x6118('0xa4')](_0xbcd557);})['catch'](function(_0x57a2db){loggerSyncQueueSummary[_0x6118('0x54')](_0x6118('0x138'),util['inspect'](_0x57a2db,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xbcd557);});}else{clearPredictiveAttributes(_0xbcd557);}})[_0x6118('0x33')](function(){var _0x997df8=_0x37079b[_0x6118('0x139')](_0xbcd557);if(_0x997df8||_0xbcd557[_0x6118('0x13a')]){_0xbcd557[_0x6118('0x13a')]=![];_0x37079b[_0x6118('0x13b')](_0xbcd557);Object[_0x6118('0x13c')](_0xbcd557,_0x37079b);emitOutboundVoiceQueueSummary(_0x37079b);}_0x5683b3[_0x6118('0x26')][_0xbcd557['name']][_0x6118('0x130')]=![];})[_0x6118('0x96')](function(_0x1e672d){logger[_0x6118('0x5a')](_0x6118('0x138'),util[_0x6118('0x39')](_0x1e672d,{'showHidden':![],'depth':null}));_0x5683b3[_0x6118('0x26')][_0xbcd557['name']][_0x6118('0x130')]=![];});};Dialer[_0x6118('0x13')][_0x6118('0x13d')]=_[_0x6118('0x13e')](function(){var _0x8d92af=_['filter'](this[_0x6118('0x18')],function(_0x1bcfd2){return _0x1bcfd2[_0x6118('0x13f')];});var _0x43d816=_[_0x6118('0x140')](this['agents'],function(_0x5ad399){return _0x5ad399[_0x6118('0x141')]&&_0x5ad399[_0x6118('0x7e')]===_0x6118('0x7f');});if(_0x8d92af[_0x6118('0x8f')]>0x0&&_0x43d816['length']>0x0){return Promise[_0x6118('0xa0')]()[_0x6118('0x33')](cmHopper[_0x6118('0x142')](_[_0x6118('0x143')](_0x8d92af,'id'),previewRecallmeReminderInterval,_[_0x6118('0x143')](_0x43d816,'id')))['then'](function(_0x14212e){for(var _0x25d43d=0x0;_0x25d43d<_0x14212e[_0x6118('0x8f')];_0x25d43d++){var _0x4f459f=_0x14212e[_0x25d43d][_0x6118('0x144')][_0x6118('0x56')];if(_0x4f459f)io['to'](util['format'](_0x6118('0x145'),_0x4f459f))[_0x6118('0x36')](_0x6118('0x146'),{'hopper':_0x14212e[_0x25d43d]});}})['catch'](function(_0x23cca5){logger['error']('checkPreviewRecallReminder',_0x23cca5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6118('0x13')][_0x6118('0x31')]=function(){var _0x1729af=this;setInterval(function(){_0x1729af['clearZombieChannels'](_0x1729af[_0x6118('0x1f')],_0x6118('0x147'));_0x1729af[_0x6118('0x148')](_0x1729af['actions'],_0x6118('0x149'));},0x32c8);};Dialer['prototype'][_0x6118('0x148')]=function(_0x47cc43,_0x5114ec){var _0x3664de=this;for(var _0x2b8983 in _0x47cc43){if(typeof _0x47cc43[_0x2b8983]!==_0x6118('0x14a')){this[_0x6118('0x16')]['enqueue'](function(){if(!_[_0x6118('0xf0')](_0x47cc43[_0x2b8983])){return ami[_0x6118('0x97')]({'action':_0x6118('0x7e'),'channel':_0x47cc43[_0x2b8983]['channel']})[_0x6118('0x96')](function(_0x42688e){if(_0x42688e[_0x6118('0x5e')]===_0x6118('0x14b')){setTimeout(function(){if(_0x47cc43[_0x2b8983]&&_0x47cc43[_0x2b8983][_0x6118('0x37')]!==_0x6118('0xba')){_0x3664de['updateOriginated'](_0x3664de[_0x6118('0x18')][_0x47cc43[_0x2b8983]['queue']]);logger[_0x6118('0x5a')]('[Dialer][checkChannel]',_0x5114ec,_0x2b8983,_0x47cc43[_0x2b8983][_0x6118('0xb8')]);delete _0x47cc43[_0x2b8983];}if(_0x47cc43[_0x2b8983]&&_0x47cc43[_0x2b8983][_0x6118('0x37')]===_0x6118('0xba')){_0x3664de[_0x6118('0xc5')](_0x3664de[_0x6118('0x19')][_0x47cc43[_0x2b8983][_0x6118('0xb8')]]);logger[_0x6118('0x5a')](_0x6118('0x14c'),_0x5114ec,_0x2b8983,_0x47cc43[_0x2b8983]['queue']);delete _0x47cc43[_0x2b8983];}},0x2328);}});}});}}};Dialer[_0x6118('0x13')][_0x6118('0x14d')]=function(_0xd6db15){return Promise['resolve']()[_0x6118('0x33')](voiceQueueRt[_0x6118('0x14d')](_0xd6db15))[_0x6118('0x96')](loggerCatch(_0x6118('0x14e')));};Dialer[_0x6118('0x13')][_0x6118('0xc5')]=function(_0x8b593a){if(!_[_0x6118('0x35')](_0x8b593a)&&_0x8b593a!==null){if(typeof _0x8b593a[_0x6118('0x76')]!==_0x6118('0x14a')){if(_0x8b593a[_0x6118('0x76')]>0x0){_0x8b593a['originated']-=0x1;}else{logger[_0x6118('0x5a')](_0x6118('0x14f'));}}}else{logger[_0x6118('0x5a')](_0x6118('0x150'));}};Dialer[_0x6118('0x13')][_0x6118('0x151')]=function(_0x410e77,_0x28703d){var _0x50d7d4=this;return function(_0x10693e){_0x50d7d4[_0x6118('0xc5')](_0x28703d);logger[_0x6118('0x5a')](_0x410e77,util['inspect'](_0x10693e,{'showHidden':![],'depth':null}));};};Dialer[_0x6118('0x13')][_0x6118('0x152')]=function(_0x3fc886,_0x177910,_0x21c58b){var _0x448bac={'state':0x19,'statedesc':'notFound'};this[_0x6118('0xc5')](_0x177910);this[_0x6118('0x121')](_[_0x6118('0x52')](_0x448bac,_[_0x6118('0x69')](_0x21c58b,[_0x6118('0xd5'),_0x6118('0xe2'),'UserId',_0x6118('0xe3'),_0x6118('0xe4')])),_0x6118('0x153'),_0x6118('0x154'));logger[_0x6118('0x5a')](_0x3fc886);};Dialer[_0x6118('0x13')]['saveInDb']=function(_0xc814db,_0x16741c,_0x29b745){hopperUtils['createHistory'](_0xc814db)[_0x6118('0x96')](loggerCatch(_0x16741c));hopperUtils['moveContactManagedDialer'](_0xc814db)[_0x6118('0x96')](loggerCatch(_0x29b745));};Dialer[_0x6118('0x13')][_0x6118('0xd2')]=function(_0x575f6b,_0x4ae4ba){hopperUtils['createHistory'](_0x575f6b)[_0x6118('0x96')](loggerCatch(_0x6118('0xc2')));if(_0x4ae4ba==0x0){hopperUtils[_0x6118('0x128')](_0x575f6b)[_0x6118('0x96')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x6118('0x13')][_0x6118('0x155')]=function(_0x4e6b10){return Promise[_0x6118('0xa0')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x4e6b10['id'],previewRecallmeReminderInterval))['then'](function(_0x5a9044){for(var _0x17ecb3=0x0;_0x17ecb3<_0x5a9044[_0x6118('0x8f')];_0x17ecb3++){var _0x542440=_0x5a9044[_0x17ecb3][_0x6118('0x144')][_0x6118('0x56')];if(_0x542440)io['to'](util[_0x6118('0x3a')](_0x6118('0x145'),_0x542440))[_0x6118('0x36')](_0x6118('0x146'),{'hopper':_0x5a9044[_0x17ecb3]});}})[_0x6118('0x96')](function(){});};Dialer[_0x6118('0x13')][_0x6118('0xa3')]=function(_0x2c46a8){var _0xf05def=this;return function(){_0xf05def[_0x6118('0x156')](_0x2c46a8);};};Dialer[_0x6118('0x13')][_0x6118('0x157')]=function(_0x3620d2,_0x4b4725){var _0x3b5df3=this;var _0xbeaf51=uuid['v4']();this['actions'][_0xbeaf51]=new Action(_0x3620d2,_0x4b4725,_0xbeaf51);return new Promise(function(_0x851a84,_0x53e850){if(_[_0x6118('0x35')](_0x3620d2)&&typeof _0x3620d2!==_0x6118('0x158')){return _0x53e850(msgResponse(_0x6118('0x159'),_0x6118('0x88'),'voiceQueue\x20is\x20undefine'));}if(_[_0x6118('0x35')](_0x4b4725[_0x6118('0x15a')])||_0x4b4725[_0x6118('0x15a')]===null){return _0x53e850(msgResponse(_0x6118('0x159'),_0x6118('0x88'),_0x6118('0x15b')));}var _0x2d4a4e={'XMD-CALLERID':_0x3b5df3[_0x6118('0x1d')][_0xbeaf51][_0x6118('0x15c')](),'XMD-AGI':_0x3620d2['dialQueueProject']?util['format'](_0x6118('0x15d'),ipAgi,_0x3620d2[_0x6118('0x129')]):_0x6118('0x15e'),'XMD-AGIAFTER':_0x3620d2[_0x6118('0xcc')]?util[_0x6118('0x3a')](_0x6118('0x15d'),ipAgi,_0x3620d2['dialQueueProject2']):_0x6118('0x15e'),'XMD-QUEUE':utils[_0x6118('0x15f')](_0x3620d2)?util[_0x6118('0x3a')]('\x22%s,%s%s,,,%s\x22',_0x3620d2[_0x6118('0x56')],_0x3620d2['dialQueueOptions']||'',_0x3620d2['dialAgiAfterHangupAgent']?'c':'',_0x3620d2[_0x6118('0xc8')]||0x3):_0x6118('0x15e'),'XMD-CONTACTID':_0x4b4725[_0x6118('0xd5')],'XMD-CDRTYPE':_0x6118('0x6'),'CALLERID(all)':_0x3b5df3[_0x6118('0x1d')][_0xbeaf51][_0x6118('0x15c')](),'XMD-AMD':_0x3620d2[_0x6118('0x107')]?'ACTIVE':_0x6118('0x15e'),'XMD-DESTINATION':_0x6118('0x106')};if(_0x3620d2[_0x6118('0x107')]){_0x2d4a4e['XMD-AMDINITIALSILENCE']=_0x3620d2['dialAMDInitialSilence']||0x9c4;_0x2d4a4e[_0x6118('0x160')]=_0x3620d2[_0x6118('0x161')]||0x5dc;_0x2d4a4e['XMD-AMDAFTERGREETINGSILENCE']=_0x3620d2['dialAMDAfterGreetingSilence']||0x320;_0x2d4a4e[_0x6118('0x162')]=_0x3620d2[_0x6118('0x163')]||0x1388;_0x2d4a4e[_0x6118('0x164')]=_0x3620d2[_0x6118('0x165')]||0x64;_0x2d4a4e[_0x6118('0x166')]=_0x3620d2[_0x6118('0x167')]||0x32;_0x2d4a4e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3620d2[_0x6118('0x168')]||0x3;_0x2d4a4e[_0x6118('0x169')]=_0x3620d2[_0x6118('0x16a')]||0x100;_0x2d4a4e['XMD-AMDMAXIMUMWORDLENGTH']=_0x3620d2[_0x6118('0x16b')]||0x1388;}if(utils[_0x6118('0x15f')](_0x3620d2)){_0x2d4a4e['XMD-VOICEQUEUEID']=_0x4b4725[_0x6118('0xe3')];}else{_0x2d4a4e[_0x6118('0x16c')]=_0x4b4725[_0x6118('0xe4')];}for(var _0xebd396 in _0x4b4725['Contact']){if(typeof _0x4b4725[_0x6118('0x16d')][_0xebd396]!==_0x6118('0x14a')){if(isNotNull(_0x4b4725['Contact'][_0xebd396])&&_0xebd396!=='id'&&_0xebd396!==_0x6118('0x16e')&&_0xebd396!=='createdAt'&&_0xebd396!==_0x6118('0x16f')){_0x2d4a4e[util['format'](_0x6118('0x170'),_0x6118('0x171'),_[_0x6118('0x172')](_0xebd396))]=_0x4b4725[_0x6118('0x16d')][_0xebd396];}}}var _0x13bd2b=_0x3b5df3[_0x6118('0x7b')](_0x3620d2[_0x6118('0x173')])?utils[_0x6118('0x174')](_0x3620d2[_0x6118('0x173')][_0x6118('0x175')],_0x3620d2[_0x6118('0x176')],_0x3620d2[_0x6118('0x177')]>0x0?utils[_0x6118('0x178')](_0x3620d2[_0x6118('0x179')],_0x3620d2[_0x6118('0x177')]):_0x3620d2[_0x6118('0x179')]):utils['getCallerId'](_[_0x6118('0xf0')](_0x3620d2[_0x6118('0x81')])?_0x3620d2[_0x6118('0x173')][_0x6118('0x175')]:_0x3620d2[_0x6118('0x81')][_0x6118('0x175')],_0x3620d2[_0x6118('0x176')],_0x3620d2[_0x6118('0x177')]>0x0?utils[_0x6118('0x178')](_0x3620d2[_0x6118('0x179')],_0x3620d2[_0x6118('0x177')]):_0x3620d2[_0x6118('0x179')]);if(_0x13bd2b){_0x2d4a4e[_0x6118('0x17a')]=_0x3b5df3[_0x6118('0x1d')][_0xbeaf51][_0x6118('0x17b')]=utils[_0x6118('0x17c')](_0x13bd2b);_0x2d4a4e[_0x6118('0x17d')]=_0x4b4725[_0x6118('0x15a')];}_0x3620d2[_0x6118('0x17e')]=_0x2d4a4e;return ami[_0x6118('0x97')]({'actionid':_0xbeaf51,'action':'originate','channel':_0x3b5df3[_0x6118('0x7b')](_0x3620d2[_0x6118('0x173')])?util['format'](_0x6118('0x17f'),_0x3620d2['Trunk']['name'],isNotNull(_0x3620d2[_0x6118('0x180')])?_0x3620d2[_0x6118('0x180')]['trim']()||'':'',_0x3620d2[_0x6118('0x181')]>0x0?_0x4b4725[_0x6118('0x15a')][_0x6118('0x182')](_0x3620d2[_0x6118('0x181')]):_0x4b4725[_0x6118('0x15a')]):util[_0x6118('0x3a')]('SIP/%s/%s%s',_[_0x6118('0xf0')](_0x3620d2[_0x6118('0x81')])?_0x3620d2[_0x6118('0x173')][_0x6118('0x56')]:_0x3620d2[_0x6118('0x81')][_0x6118('0x56')],isNotNull(_0x3620d2[_0x6118('0x180')])?_0x3620d2[_0x6118('0x180')][_0x6118('0x183')]()||'':'',_0x3620d2[_0x6118('0x181')]>0x0?_0x4b4725['phone']['substring'](_0x3620d2[_0x6118('0x181')]):_0x4b4725[_0x6118('0x15a')]),'callerid':_0x13bd2b,'Exten':_0x6118('0x106'),'Context':'from-sip','Priority':'1','variable':_0x2d4a4e,'timeout':(_0x3620d2[_0x6118('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0xbeaf51})[_0x6118('0x33')](function(_0x17e602){return _0x851a84(_0x17e602);})['catch'](function(_0x290d36){_0x3620d2[_0x6118('0x185')]+=0x1;var _0x179618=new History(_0x3b5df3[_0x6118('0x1d')][_0xbeaf51]);logger['error'](util[_0x6118('0x3a')](_0x6118('0x186'),JSON[_0x6118('0x68')](_0x290d36)));_0x179618['state']=0xe;_0x179618[_0x6118('0x65')]=_0x6118('0x187');_0x179618[_0x6118('0xd8')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));_0x179618[_0x6118('0x66')]=_0x179618['starttime'];hopperUtils[_0x6118('0xc1')](_0x179618)[_0x6118('0x96')](loggerCatch(_0x6118('0x188')));_0x3b5df3['moveContactManagedDialer'](_0x179618)[_0x6118('0x96')](loggerCatch(_0x6118('0x188')))[_0x6118('0x15')](function(){delete _0x3b5df3['actions'][_0xbeaf51];return _0x53e850(msgResponse(_0x6118('0x159'),_0x6118('0x7a'),_0x6118('0x189')));});});});};Dialer[_0x6118('0x13')][_0x6118('0x18a')]=function(_0x57fae,_0x2c6383,_0x2e6caf){var _0x13c3c1=new History(_0x2c6383);if(_0x13c3c1[_0x6118('0x117')]+_0x13c3c1[_0x6118('0x118')]+_0x13c3c1[_0x6118('0x123')]+_0x13c3c1[_0x6118('0x119')]+_0x13c3c1[_0x6118('0xcd')]+_0x13c3c1[_0x6118('0xdd')]+_0x13c3c1['countmachineretry']+_0x13c3c1[_0x6118('0x124')]>=_0x2e6caf[_0x6118('0x11a')]-0x1){return!![];}switch(_0x57fae){case 0x3:if(_0x13c3c1[_0x6118('0x123')]>=_0x2e6caf['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x13c3c1['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0x18b')],_0x6118('0xe1'))[_0x6118('0x3a')](_0x6118('0xbc')),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1['VoiceQueueId']||undefined,'CampaignId':_0x13c3c1['CampaignId']||undefined})['catch'](loggerCatch(_0x6118('0x18c')));break;case 0x5:if(_0x13c3c1[_0x6118('0x117')]>=_0x2e6caf[_0x6118('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x13c3c1['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x2e6caf[_0x6118('0x18e')],'minutes')[_0x6118('0x3a')](_0x6118('0xbc')),'ContactId':_0x13c3c1['ContactId'],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1[_0x6118('0xe3')]||undefined,'CampaignId':_0x13c3c1[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x13c3c1['countcongestionretry']>=_0x2e6caf['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x13c3c1['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x2e6caf[_0x6118('0x18f')],'minutes')[_0x6118('0x3a')](_0x6118('0xbc')),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1['ListId'],'VoiceQueueId':_0x13c3c1[_0x6118('0xe3')]||undefined,'CampaignId':_0x13c3c1[_0x6118('0xe4')]||undefined})['catch'](loggerCatch(_0x6118('0x190')));break;case 0x0:if(_0x13c3c1[_0x6118('0x119')]>=_0x2e6caf[_0x6118('0x191')]-0x1){return!![];}else{hopperUtils[_0x6118('0xd3')]({'active':![],'countnosuchnumberretry':_0x13c3c1[_0x6118('0x119')]+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0x192')],_0x6118('0xe1'))['format'](_0x6118('0xbc')),'ContactId':_0x13c3c1['ContactId'],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1[_0x6118('0xe3')]||undefined,'CampaignId':_0x13c3c1[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0x193')));}break;case 0xa:if(_0x13c3c1[_0x6118('0xcd')]>=_0x2e6caf[_0x6118('0x194')]-0x1){return!![];}hopperUtils[_0x6118('0xd3')]({'active':![],'countdropretry':_0x13c3c1['countdropretry']+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0xce')],'minutes')[_0x6118('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1['VoiceQueueId']||undefined,'CampaignId':_0x13c3c1[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0xd6')));break;case 0xb:if(_0x13c3c1[_0x6118('0xdd')]>=_0x2e6caf['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x6118('0xd3')]({'active':![],'countabandonedretry':_0x13c3c1[_0x6118('0xdd')]+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0xe0')],_0x6118('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1[_0x6118('0xe3')]||undefined,'CampaignId':_0x13c3c1['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0xe5')));break;case 0x13:if(_0x13c3c1[_0x6118('0x114')]>=_0x2e6caf[_0x6118('0x11d')]-0x1){return!![];}hopperUtils[_0x6118('0xd3')]({'active':![],'countmachineretry':_0x13c3c1[_0x6118('0x114')]+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0x11f')],_0x6118('0xe1'))[_0x6118('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1['VoiceQueueId']||undefined,'CampaignId':_0x13c3c1['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x13c3c1[_0x6118('0x124')]>=_0x2e6caf[_0x6118('0x195')]-0x1){return!![];}hopperUtils[_0x6118('0xd3')]({'active':![],'countagentrejectretry':_0x13c3c1[_0x6118('0x124')]+=0x1,'scheduledat':moment()[_0x6118('0xd4')](_0x2e6caf[_0x6118('0x196')],_0x6118('0xe1'))[_0x6118('0x3a')](_0x6118('0xbc')),'ContactId':_0x13c3c1[_0x6118('0xd5')],'ListId':_0x13c3c1[_0x6118('0xe2')],'VoiceQueueId':_0x13c3c1[_0x6118('0xe3')]||undefined,'CampaignId':_0x13c3c1['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x6118('0x13')]['callProgressDetecting']=function(_0xf89c0c,_0x2eb3e8,_0x3ed5fa){var _0x4035a2=this;var _0x39db90=new History(_0xf89c0c);var _0x52d732=![];var _0x599c6b;var _0x4e3933;return new Promise(function(_0x2d3f26,_0x1c74e8){if(_['isUndefined'](_0x2eb3e8)&&typeof _0x2eb3e8!==_0x6118('0x158')){return _0x1c74e8(msgResponse(_0x6118('0x197'),_0x6118('0x88'),'entity\x20is\x20undefine'));}if(_[_0x6118('0x35')](_0x3ed5fa)&&typeof _0x3ed5fa!==_0x6118('0x158')){return _0x1c74e8(msgResponse(_0x6118('0x197'),_0x6118('0x88'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x39db90,_0x3ed5fa[_0x6118('0x198')],_0x2eb3e8)[_0x6118('0x33')](function(_0x343a42){if(_0x343a42['additional']==0x1)_0x52d732=!![];switch(_0x3ed5fa[_0x6118('0x198')]){case'0':_0x2eb3e8[_0x6118('0x199')]+=0x1;_0x39db90[_0x6118('0x64')]=0x0;_0x39db90[_0x6118('0x65')]=_0x6118('0x19a');_0x39db90[_0x6118('0x119')]+=0x1;_0x39db90[_0x6118('0xde')]+=0x1;ami['emit'](_0x6118('0x19b'),ut[_0x6118('0x115')](_0xf89c0c,'nosuchnumber'));_0x599c6b=_0x2eb3e8[_0x6118('0x192')];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];hopperUtils[_0x6118('0xc1')](_0x39db90)[_0x6118('0x96')](loggerCatch(_0x6118('0x116')));if(_0x4035a2['checkRetriveMax'](0x0,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x119')]>=_0x2eb3e8[_0x6118('0x191')]){_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x19c'));}else{_0x4035a2[_0x6118('0x11b')](_0x39db90,_0x2d3f26,_0x1c74e8,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2eb3e8[_0x6118('0x19d')]+=0x1;_0x39db90['state']=0x3;_0x39db90['statedesc']=_0x6118('0x19e');_0x39db90['countnoanswerretry']+=0x1;_0x39db90[_0x6118('0xde')]+=0x1;var _0x3f70b4=ut[_0x6118('0x19f')](_0xf89c0c,_0x2eb3e8);ami['emit'](_0x6118('0x1a0'),_0x3f70b4);_0x599c6b=_0x2eb3e8[_0x6118('0x18b')];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];hopperUtils[_0x6118('0xc1')](_0x39db90)[_0x6118('0x96')](loggerCatch(_0x6118('0x1a1')));if(_0x4035a2['checkRetriveMax'](0x3,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x123')]>=_0x2eb3e8[_0x6118('0x1a2')]){_0x4035a2['createStateFinal'](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1a3'));}else{_0x4035a2['stateGlobal'](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1a3'));}}break;case'5':_0x2eb3e8[_0x6118('0x1a4')]+=0x1;_0x39db90[_0x6118('0x64')]=0x5;_0x39db90[_0x6118('0x65')]=_0x6118('0x1a5');_0x39db90[_0x6118('0x117')]+=0x1;_0x39db90[_0x6118('0xde')]+=0x1;ami[_0x6118('0x36')](_0x6118('0x1a6'),ut[_0x6118('0x115')](_0xf89c0c,_0x6118('0x1a7')));_0x599c6b=_0x2eb3e8['dialBusyRetryFrequency'];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];hopperUtils[_0x6118('0xc1')](_0x39db90)['catch'](loggerCatch(_0x6118('0x1a8')));if(_0x4035a2['checkRetriveMax'](0x5,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x117')]>=_0x2eb3e8[_0x6118('0x18d')]){_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,'reason\x205\x20busy');}else{_0x4035a2[_0x6118('0x11b')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1a9'));}}break;case'8':_0x2eb3e8[_0x6118('0x1aa')]+=0x1;_0x39db90[_0x6118('0x64')]=0x8;_0x39db90['statedesc']=_0x6118('0x1ab');_0x39db90[_0x6118('0x118')]+=0x1;_0x39db90['countglobal']+=0x1;_0x599c6b=_0x2eb3e8[_0x6118('0x18f')];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];ami[_0x6118('0x36')]('custom:agentcongestion',ut[_0x6118('0x115')](_0xf89c0c,_0x6118('0x1ac')));hopperUtils['createHistory'](_0x39db90)[_0x6118('0x96')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4035a2[_0x6118('0x18a')](0x8,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x118')]>=_0x2eb3e8[_0x6118('0x1ad')]){_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,'reason\x208\x20congestion');}else{_0x4035a2[_0x6118('0x11b')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1ae'));}}break;case'11':_0x2eb3e8[_0x6118('0x1af')]+=0x1;_0x39db90[_0x6118('0x64')]=0xb;_0x39db90[_0x6118('0x65')]=_0x6118('0xe6');_0x39db90[_0x6118('0xdd')]+=0x1;_0x39db90['countglobal']+=0x1;_0x599c6b=_0x2eb3e8[_0x6118('0xe0')];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];hopperUtils[_0x6118('0xc1')](_0x39db90)[_0x6118('0x96')](loggerCatch(_0x6118('0x1b0')));if(_0x4035a2[_0x6118('0x18a')](0xb,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0xdd')]>=_0x2eb3e8['dialAbandonedMaxRetry']){_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1b1'));}else{_0x4035a2[_0x6118('0x11b')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1b1'));}}break;case'20':_0x2eb3e8[_0x6118('0x1b2')]+=0x1;_0x39db90[_0x6118('0x64')]=0x14;_0x39db90[_0x6118('0x65')]=_0x6118('0x1b3');_0x39db90['countagentrejectretry']+=0x1;_0x39db90[_0x6118('0xde')]+=0x1;_0x599c6b=_0x2eb3e8['dialAgentRejectRetryFrequency'];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];ami[_0x6118('0x36')](_0x6118('0x1b4'),ut[_0x6118('0x115')](_0xf89c0c,_0x6118('0x1b5')));hopperUtils[_0x6118('0xc1')](_0x39db90)[_0x6118('0x96')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4035a2[_0x6118('0x18a')](0x14,_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x124')]>=_0x2eb3e8[_0x6118('0x195')]){_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1b6'));}else{_0x4035a2[_0x6118('0x11b')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x6118('0x1b6'));}}break;default:_0x2eb3e8['outboundUnknownCallsDay']+=0x1;_0x39db90[_0x6118('0x64')]=0xc;_0x39db90['statedesc']=_0x3ed5fa[_0x6118('0x198')];_0x599c6b=_0x2eb3e8[_0x6118('0x196')];_0x4e3933=_0x2eb3e8[_0x6118('0xcf')];hopperUtils[_0x6118('0xc1')](_0x39db90)[_0x6118('0x96')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4035a2[_0x6118('0x18a')](_0x3ed5fa[_0x6118('0x198')],_0xf89c0c,_0x2eb3e8)&&!_0x52d732){if(_0x39db90[_0x6118('0x117')]+_0x39db90[_0x6118('0x118')]+_0x39db90['countnoanswerretry']+_0x39db90[_0x6118('0x119')]+_0x39db90[_0x6118('0xcd')]+_0x39db90[_0x6118('0xdd')]+_0x39db90[_0x6118('0x114')]+_0x39db90[_0x6118('0x124')]>=_0x2eb3e8[_0x6118('0x11a')]){_0x4035a2['stateGlobal'](_0x39db90,_0x2d3f26,_0x1c74e8,_0x3ed5fa['reason']);}else{_0x4035a2[_0x6118('0x125')](_0x39db90,_0x2d3f26,_0x1c74e8,_0x3ed5fa['reason']);}}}})[_0x6118('0x33')](function(){if(_0x52d732){hopperUtils[_0x6118('0xe7')](_0x39db90,_0x599c6b,_0x4e3933)[_0x6118('0x33')](function(){return _0x2d3f26(0x1);});}});});};Dialer[_0x6118('0x13')][_0x6118('0x11b')]=function(_0x48e46b,_0x41cfa9,_0x259522,_0x2c8c92){var _0x1927ff=new Final(_0x48e46b);_0x1927ff[_0x6118('0x64')]=0xf;_0x1927ff[_0x6118('0x65')]='Global';this[_0x6118('0x125')](_0x1927ff,_0x41cfa9,_0x259522,_0x2c8c92);};Dialer[_0x6118('0x13')]['createStateFinal']=function(_0x5be0c3,_0x58ef2a,_0x298783,_0xe783bb){hopperUtils[_0x6118('0x128')](_0x5be0c3)['then'](function(){return _0x58ef2a(msgResponse('[callProgressDetecting]',_0x6118('0x1b7'),_0xe783bb));})[_0x6118('0x96')](function(){return _0x298783(msgResponse(_0x6118('0x1b8'),'Failure',_0x6118('0x1b9')));});};Dialer[_0x6118('0x13')]['predictive']=function(_0x37e6f7){var _0x4d2aea=_0x37e6f7[_0x6118('0x1ba')]/0x64;var _0x8b3084=_0x37e6f7[_0x6118('0x1bb')]/(_0x37e6f7[_0x6118('0x1bb')]+_0x37e6f7[_0x6118('0xbd')]);var _0x3c9862=Math[_0x6118('0x1bc')](_0x37e6f7[_0x6118('0x1bd')]*(_0x37e6f7['predictiveIntervalMaxThreshold']/0x64));var _0x46a56b=Math['round'](_0x37e6f7[_0x6118('0x1bd')]*(_0x37e6f7[_0x6118('0x1be')]/0x64));var _0x326122=_0x37e6f7[_0x6118('0x1bf')]+_0x37e6f7['talking'];var _0x517d83=Math[_0x6118('0x1c0')](_0x37e6f7[_0x6118('0x4c')]*_0x37e6f7[_0x6118('0x4f')]*_0x37e6f7[_0x6118('0x1c1')]*_0x37e6f7[_0x6118('0x1c2')]);if(_[_0x6118('0x35')](_0x37e6f7[_0x6118('0x22')])){if(!_[_0x6118('0x35')](_0x37e6f7['startPredictive'])){_0x37e6f7[_0x6118('0x21')]=undefined;loggerPredictive[_0x6118('0x5a')](_0x6118('0x1c3'),_0x6118('0x1c4'));}if(!_[_0x6118('0x35')](_0x37e6f7[_0x6118('0x58')])){loggerPredictive[_0x6118('0x5a')](_0x6118('0x1c3'),_0x6118('0x1c5'));clearInterval(_0x37e6f7[_0x6118('0x58')]);_0x37e6f7[_0x6118('0x58')]=undefined;}_0x37e6f7[_0x6118('0x22')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));loggerPredictive[_0x6118('0x3e')](_0x37e6f7['name'],_0x6118('0x1c6'),_0x37e6f7[_0x6118('0x22')]);this[_0x6118('0xa8')](_0x37e6f7,0x1);}else if(ifInterval(_0x37e6f7[_0x6118('0x1c7')],_0x37e6f7['startProgressive'])){this[_0x6118('0xa8')](_0x37e6f7,0x1);loggerPredictiveCalls[_0x6118('0x3e')](_0x6118('0x1c8'),_0x37e6f7[_0x6118('0x22')],_0x37e6f7['name']);_0x37e6f7[_0x6118('0x4c')]=0x0;_0x37e6f7[_0x6118('0x1c9')]=0x0;}else if(_0x4d2aea<_0x8b3084&&_0x37e6f7[_0x6118('0x1ca')]===_0x6118('0x1cb')){clearPredictiveAttributes(_0x37e6f7);loggerPredictive['info'](_0x6118('0x1cc'),_0x6118('0x1cd'),_0x8b3084,_0x6118('0x22'),_0x37e6f7[_0x6118('0x56')]);}else if(_0x517d83<_0x37e6f7[_0x6118('0x1c9')]&&_0x37e6f7[_0x6118('0x1ca')]===_0x6118('0x1cb')){clearPredictiveAttributes(_0x37e6f7);loggerPredictive['info'](_0x6118('0x1ce'),_0x6118('0x1cf'),_0x517d83,_0x6118('0x1d0'),_0x37e6f7[_0x6118('0x1c9')],_0x6118('0x22'),_0x37e6f7[_0x6118('0x56')]);}else if(!ifInterval(_0x37e6f7[_0x6118('0x1c7')],_0x37e6f7['startProgressive'])&&_[_0x6118('0x35')](_0x37e6f7[_0x6118('0x21')])&&!_[_0x6118('0x35')](_0x37e6f7[_0x6118('0x22')])){_0x37e6f7[_0x6118('0x21')]=moment()['format'](_0x6118('0xbc'));loggerPredictive[_0x6118('0x3e')](_0x37e6f7['name'],_0x6118('0x1d1'),_0x37e6f7['startPredictive']);hopperUtils[_0x6118('0x1d2')](_0x37e6f7[_0x6118('0x1c7')])['then'](this[_0x6118('0x1d3')](_0x37e6f7))[_0x6118('0x33')](mergeDataErlangB(_0x37e6f7))[_0x6118('0x33')](this[_0x6118('0x1d4')](_0x37e6f7))[_0x6118('0x96')](loggerCatchPredictive(_0x6118('0x1d5'),_0x37e6f7));}else if(!ifInterval(_0x37e6f7[_0x6118('0x1c7')],_0x37e6f7[_0x6118('0x21')])){_0x37e6f7[_0x6118('0x1c9')]=0x0;_0x37e6f7[_0x6118('0x21')]=moment()[_0x6118('0x3a')](_0x6118('0xbc'));loggerPredictive[_0x6118('0x3e')](_0x37e6f7[_0x6118('0x56')],_0x6118('0x1d6'),_0x37e6f7[_0x6118('0x21')]);clearInterval(_0x37e6f7['handlePredictive']);_0x37e6f7[_0x6118('0x58')]=undefined;hopperUtils['avgHandleTime'](_0x37e6f7[_0x6118('0x1c7')])['then'](this['getDataPredictive'](_0x37e6f7))[_0x6118('0x33')](mergeDataErlangB(_0x37e6f7))[_0x6118('0x33')](this[_0x6118('0x1d4')](_0x37e6f7))[_0x6118('0x96')](loggerCatchPredictive(_0x6118('0x1d7'),_0x37e6f7));}else if(_0x37e6f7[_0x6118('0x1bd')]&&_0x326122<_0x37e6f7['predictiveIntervalAvailable']-_0x46a56b){clearPredictiveAttributes(_0x37e6f7);loggerPredictive[_0x6118('0x3e')](_0x37e6f7['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x326122,_0x6118('0x1d8'),_0x37e6f7['predictiveIntervalAvailable'],'-',_0x46a56b,'=',_0x37e6f7[_0x6118('0x1bd')]-_0x46a56b,')');}else if(_0x37e6f7[_0x6118('0x1bd')]&&_0x326122>_0x37e6f7[_0x6118('0x1bd')]+_0x3c9862){clearPredictiveAttributes(_0x37e6f7);loggerPredictive[_0x6118('0x3e')](_0x37e6f7['name'],_0x6118('0x1d9'),_0x326122,_0x6118('0x1da'),_0x37e6f7['predictiveIntervalAvailable'],'+',_0x3c9862,'=',_0x37e6f7[_0x6118('0x1bd')]+_0x3c9862,')');}};Dialer[_0x6118('0x13')][_0x6118('0x1d3')]=function(_0x48870f){var _0x16321b=this;return function(_0x1ec0da){return new Promise(function(_0x42a364,_0x53e46e){_[_0x6118('0x52')](_0x48870f,_0x1ec0da[0x0]);if(checkGetDataPredictive(_0x1ec0da[0x0])){var _0x12f50b=_0x48870f[_0x6118('0x1bd')]=_0x48870f[_0x6118('0x135')]+_0x48870f[_0x6118('0x1bf')];var _0x544c00=_0x48870f[_0x6118('0x1c7')]*0x3c;var _0x51ef20=_0x1ec0da[0x0][_0x6118('0x48')]+_0x1ec0da[0x0][_0x6118('0x45')];var _0x3b61c2=(_0x1ec0da[0x0]['predictiveIntervalAnsweredCalls']+_0x1ec0da[0x0][_0x6118('0xc9')]+_0x1ec0da[0x0][_0x6118('0x1db')])/_0x1ec0da[0x0][_0x6118('0x40')];_0x48870f[_0x6118('0x1c1')]=_0x3b61c2>0x0?_0x3b61c2:0x1;switch(_0x48870f[_0x6118('0x1ca')]){case'dropRate':var _0x5e9d3d=_0x48870f[_0x6118('0x1ba')]/0x64;return _0x16321b[_0x6118('0x1dc')](_0x12f50b,_0x544c00,_0x51ef20,_0x3b61c2,_0x5e9d3d)[_0x6118('0x33')](function(_0x40e88a){return _0x42a364(_0x40e88a);});case'agentBusyFactor':var _0x2feacf=_0x48870f['dialPredictiveOptimizationPercentage']/0x64;return _0x16321b[_0x6118('0x1dd')](_0x12f50b,_0x544c00,_0x51ef20,_0x3b61c2,_0x2feacf)['then'](function(_0x24073d){return _0x42a364(_0x24073d);});default:return _0x53e46e(msgResponse(_0x6118('0x1de'),_0x6118('0x88'),'Unknown\x20Predictive'));}}else{return _0x53e46e(msgResponse(_0x6118('0x1de'),'Failure',_0x6118('0x1df')));}});};};Dialer[_0x6118('0x13')][_0x6118('0x1e0')]=function(_0x23ace5){var _0x524a03=this;return function(_0x3601ed){return new Promise(function(_0x3dba22,_0x7d7231){_['merge'](_0x23ace5,_0x3601ed[0x0]);if(checkGetDataPredictive(_0x3601ed[0x0])){loggerPredictive[_0x6118('0x3e')](JSON['stringify'](_0x3601ed[0x0]));if(_0x23ace5[_0x6118('0x1ca')]===_0x6118('0x1cb')){return _0x524a03[_0x6118('0x14d')](_0x23ace5['id'])['then'](function(_0x37927d){var _0x43706f=_0x23ace5[_0x6118('0x1e1')]-_0x37927d[0x0][_0x6118('0x1e2')];var _0x4f8220=_0x23ace5[_0x6118('0x1c7')]*0x3c;var _0x28f391=_0x3601ed[0x0][_0x6118('0x48')]+_0x3601ed[0x0][_0x6118('0x45')];var _0xc5e9de=(_0x3601ed[0x0]['predictiveIntervalAnsweredCalls']+_0x3601ed[0x0][_0x6118('0xc9')]+_0x3601ed[0x0][_0x6118('0x1db')])/_0x3601ed[0x0][_0x6118('0x40')];var _0x401a28=_0x23ace5['dialPredictiveOptimizationPercentage']/0x64;_0x23ace5[_0x6118('0x1e3')]=_0x37927d[0x0]['outboundQueuePauses']||0x0;_0x23ace5['predictiveIntervalHitRate']=_0xc5e9de>0x0?_0xc5e9de:0x1;return _0x524a03[_0x6118('0x1dc')](_0x43706f,_0x4f8220,_0x28f391,_0xc5e9de,_0x401a28);})['then'](function(_0xa83561){return _0x3dba22(_0xa83561);})[_0x6118('0x96')](function(_0x435405){return _0x7d7231(msgResponse(_0x6118('0x1e4'),_0x6118('0x88'),JSON[_0x6118('0x68')](_0x435405)));});}if(_0x23ace5[_0x6118('0x1ca')]===_0x6118('0x1e5')){return _0x524a03[_0x6118('0x14d')](_0x23ace5['id'])[_0x6118('0x33')](function(_0x92e9be){var _0x159bcd=_0x23ace5['loggedIn']-_0x92e9be[0x0][_0x6118('0x1e2')];var _0x55c8e5=_0x23ace5[_0x6118('0x1c7')]*0x3c;var _0x40f0fe=_0x3601ed[0x0][_0x6118('0x48')]+_0x3601ed[0x0]['predictiveIntervalAvgHoldtime'];var _0x288e43=(_0x3601ed[0x0][_0x6118('0x1e6')]+_0x3601ed[0x0][_0x6118('0xc9')]+_0x3601ed[0x0][_0x6118('0x1db')])/_0x3601ed[0x0]['predictiveIntervalTotalCalls'];var _0x1e6c1c=_0x23ace5[_0x6118('0x1ba')]/0x64;_0x23ace5[_0x6118('0x1e3')]=_0x92e9be[0x0]['outboundQueuePauses']||0x0;_0x23ace5[_0x6118('0x1c1')]=_0x288e43>0x0?_0x288e43:0x1;return _0x524a03[_0x6118('0x1dd')](_0x159bcd,_0x55c8e5,_0x40f0fe,_0x288e43,_0x1e6c1c);})['then'](function(_0xbaaf14){return _0x3dba22(_0xbaaf14);})[_0x6118('0x96')](function(_0x3cc1fb){return _0x7d7231(msgResponse('[CatchErlangB]',_0x6118('0x88'),JSON['stringify'](_0x3cc1fb)));});}}else{return _0x7d7231(msgResponse(_0x6118('0x1de'),'Failure',_0x6118('0x1df')));}});};};Dialer[_0x6118('0x13')][_0x6118('0x1d4')]=function(_0x52a19f){var _0x44ce31=this;return function(){var _0x1a60ab=0x0;var _0x4d8e50=Math[_0x6118('0x1c0')](_0x52a19f['erlangCallToSecond']*0x3e8);if(_0x4d8e50>0x0){_0x4d8e50=_0x4d8e50<0x64?0x64:_0x4d8e50;loggerPredictive[_0x6118('0x3e')](_0x52a19f[_0x6118('0x56')],_0x6118('0x1e7'),_0x4d8e50,'milliseconds');_0x52a19f[_0x6118('0x58')]=setInterval(function(){_0x44ce31[_0x6118('0x58')](_0x52a19f);loggerPredictiveCalls[_0x6118('0x3e')](_0x6118('0x1e8'),_0x1a60ab+=0x1);},_0x4d8e50);}else{loggerPredictive[_0x6118('0x3e')](_0x52a19f[_0x6118('0x56')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x6118('0x1e9')]=function(_0x35bff7,_0x193351){var _0x4f6119=this;return function(_0xe1e40d){if(_[_0x6118('0x3d')](_0xe1e40d)){if(_[_0x6118('0xf0')](_0x193351['UserId'])||!_0x193351['recallme']){if(_0x35bff7[_0x6118('0xa5')]==='booked'){_0x35bff7['queueStatusComplete']=_['isUndefined'](_0x35bff7[_0x6118('0x67')])?!![]:_0x35bff7['queueStatusComplete'];var _0x4a327b=uuid['v4']();_0x4f6119['actions'][_0x4a327b]=new Action(_0x35bff7,_0x193351,_0x4a327b);loggerBooked[_0x6118('0x3e')](_0x6118('0x1ea'),_0x4a327b,_0x6118('0x1eb'),JSON[_0x6118('0x68')](_0x35bff7['queueStatusComplete']),_0x6118('0x1ec'),_0x35bff7[_0x6118('0x56')]);if(_0x35bff7[_0x6118('0x67')]){_0x35bff7[_0x6118('0x67')]=![];_0x4f6119[_0x6118('0x24')][_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xb8')]]=[];ami['Action']({'actionid':_0x4a327b,'action':_0x6118('0x1ed'),'queue':_0x35bff7[_0x6118('0x56')]})['catch'](function(){_0x4f6119[_0x6118('0xc5')](_0x35bff7);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xd5')],'ListId':_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xe2')],'VoiceQueueId':_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xe3')]||undefined,'CampaignId':_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0x1ee')));delete _0x4f6119[_0x6118('0x1d')][_0x4a327b];});}else{loggerBooked[_0x6118('0x3e')](_0x6118('0x1ef'),JSON['stringify'](_0x35bff7[_0x6118('0x67')]),'Queue:\x20',_0x35bff7['name']);_0x4f6119[_0x6118('0xc5')](_0x35bff7);hopperUtils[_0x6118('0xd3')]({'active':![],'ContactId':_0x4f6119[_0x6118('0x1d')][_0x4a327b]['ContactId'],'ListId':_0x4f6119['actions'][_0x4a327b]['ListId'],'VoiceQueueId':_0x4f6119[_0x6118('0x1d')][_0x4a327b][_0x6118('0xe3')]||undefined,'CampaignId':_0x4f6119[_0x6118('0x1d')][_0x4a327b]['CampaignId']||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0x1ee')));delete _0x4f6119[_0x6118('0x1d')][_0x4a327b];}}else{return _0x4f6119[_0x6118('0x157')](_0x35bff7,_0x193351);}}else{if(utils[_0x6118('0x53')](undefined,_0x193351[_0x6118('0x1f0')])<_0x35bff7[_0x6118('0x1f1')]*0x3c){if(_0x193351[_0x6118('0x144')]&&!_0x193351['Agent'][_0x6118('0x1f2')]){_0x4f6119['preview'][_0x6118('0xf4')](_0x193351['id'])[_0x6118('0x15')](function(){_0x4f6119[_0x6118('0xc5')](_0x35bff7);});}else{hopperUtils[_0x6118('0x1f3')]({'active':![]},_0x193351['id'],0x1)['finally'](function(){_0x4f6119['updateOriginated'](_0x35bff7);});}}else{_0x35bff7[_0x6118('0x1f4')]+=0x1;_0x4f6119[_0x6118('0xc5')](_0x35bff7);if(_0x35bff7['dialRecallInQueue']){hopperUtils[_0x6118('0xd3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x193351[_0x6118('0xd5')],'ListId':_0x193351[_0x6118('0xe2')],'VoiceQueueId':_0x193351[_0x6118('0xe3')]||undefined,'CampaignId':_0x193351[_0x6118('0xe4')]||undefined})[_0x6118('0x96')](loggerCatch(_0x6118('0x1f5')));hopperUtils[_0x6118('0xc1')](createObjHistory(_0x35bff7,_0x193351,utils['CAMPAIGN_STATUS'][_0x6118('0x1f6')],0x17,_0x6118('0x1f7')))[_0x6118('0x96')](loggerCatch(_0x6118('0x1f8')));}else{_0x4f6119[_0x6118('0x121')](createObjHistory(_0x35bff7,_0x193351,utils[_0x6118('0x6b')][_0x6118('0x1f9')],0x16,_0x6118('0x1fa')),_0x6118('0x1fb'),_0x6118('0x1fc'));}}}}else{_0x35bff7['outboundBlacklistCallsDay']+=0x1;_0x4f6119[_0x6118('0x121')](createObjHistory(_0x35bff7,_0x193351,utils['CAMPAIGN_STATUS'][_0x6118('0x1fd')],0xd,_0x6118('0x1fe')),_0x6118('0x1ff'),_0x6118('0x200'));throw _0x6118('0x201');}};};Dialer[_0x6118('0x13')][_0x6118('0x156')]=function(_0x4f1a7a){var _0x380a8c=this;var _0x4c97ad=_0x4f1a7a[_0x6118('0x202')]-_0x4f1a7a['originated']-_0x4f1a7a[_0x6118('0x203')];emitCampaignSummary(_0x4f1a7a);if(_0x4c97ad>0x0){if(_0x4c97ad>this['maxNumberOriginate']){_0x4c97ad=this[_0x6118('0x1b')];}_0x4f1a7a[_0x6118('0x203')]+=_0x4c97ad;hopperUtils[_0x6118('0x204')](_0x4f1a7a,_0x4c97ad)[_0x6118('0x33')](function(_0x30008c){_0x4f1a7a[_0x6118('0x203')]-=_0x4c97ad;_0x4f1a7a[_0x6118('0x203')]=_0x4f1a7a[_0x6118('0x203')]>0x0?_0x4f1a7a[_0x6118('0x203')]:0x0;if(!utils[_0x6118('0x205')](_0x30008c)){_0x4f1a7a[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x62')];logger[_0x6118('0x3e')](_0x6118('0x206')+_0x4f1a7a[_0x6118('0x56')]);}else{_0x4f1a7a[_0x6118('0x76')]+=_0x30008c[_0x6118('0x8f')];_0x4f1a7a[_0x6118('0x5e')]=utils[_0x6118('0x6b')][_0x6118('0x207')];for(var _0x122764=0x0;_0x122764<_0x30008c['length'];_0x122764+=0x1){_0x4f1a7a[_0x6118('0x208')]+=0x1;if(_['isNil'](_0x30008c[_0x122764])||_[_0x6118('0xf0')](_0x30008c[_0x122764]['Contact'])||_[_0x6118('0xf0')](_0x30008c[_0x122764][_0x6118('0x15a')])){_0x380a8c[_0x6118('0x152')]('[actionOriginate]\x20',_0x4f1a7a,_0x30008c[_0x122764]);}else{hopperUtils[_0x6118('0x209')](_[_0x6118('0x69')](_0x30008c[_0x122764],[_0x6118('0xe4'),_0x6118('0x15a')]))[_0x6118('0x33')](_0x380a8c['checkContactBlack'](_0x4f1a7a,_0x30008c[_0x122764]))[_0x6118('0x96')](_0x380a8c['loggerHandler'](_0x6118('0x20a'),_0x4f1a7a));}}}})[_0x6118('0x96')](loggerGetContactDialer(_0x6118('0x20b'),_0x4f1a7a,_0x4c97ad));}};Dialer['prototype'][_0x6118('0xa8')]=function(_0x4e742d,_0x4e6c7d){var _0x202d4d=this;var _0x5872a9=[];if(_0x4e6c7d<0x1||_0x4e742d[_0x6118('0xa5')]===_0x6118('0x8')){_0x4e6c7d=0x1;}var _0x4d2043=Math['floor'](_0x4e742d['available']*_0x4e6c7d)-_0x4e742d['originated']-_0x4e742d[_0x6118('0x203')];if(_0x4e742d[_0x6118('0x20c')]>0x0){var _0x334695=_0x4e742d[_0x6118('0x20c')]-_0x4e742d[_0x6118('0x76')]-_0x4e742d[_0x6118('0x135')]-_0x4e742d['temp']-_0x4e742d['pTalking'];if(_0x4d2043>_0x334695){_0x4d2043=_0x334695;}}if(_0x4d2043>0x0){if(_0x4e742d[_0x6118('0xa5')]===_0x6118('0x8')){_0x4d2043=0x1;}if(_0x4d2043>this[_0x6118('0x1b')]){_0x4d2043=this[_0x6118('0x1b')];}_0x4e742d[_0x6118('0x203')]+=_0x4d2043;for(var _0x47cfea in this[_0x6118('0xee')]){if(typeof this[_0x6118('0xee')][_0x47cfea]!==_0x6118('0x14a')){if(this[_0x6118('0xee')][_0x47cfea]['state']===_0x6118('0x20d')&&this[_0x6118('0xee')][_0x47cfea]['status']===_0x6118('0x7f')){_0x5872a9[_0x6118('0x90')](this[_0x6118('0xee')][_0x47cfea]['id']);}}}hopperUtils[_0x6118('0x20e')](_0x4e742d,_0x5872a9,_0x4d2043)[_0x6118('0x33')](function(_0x1a1668){_0x4e742d[_0x6118('0x203')]-=_0x4d2043;_0x4e742d[_0x6118('0x203')]=_0x4e742d[_0x6118('0x203')]>0x0?_0x4e742d[_0x6118('0x203')]:0x0;if(!utils[_0x6118('0x205')](_0x1a1668)){hopperUtils[_0x6118('0x20f')](_0x4e742d)[_0x6118('0x33')](sendMessageReschedule(_0x4e742d))['catch'](loggerCatch(_0x6118('0x210')));}else{_0x4e742d[_0x6118('0x76')]+=_0x1a1668['length'];_0x4e742d[_0x6118('0x5e')]=_0x4e742d[_0x6118('0xa5')]===_0x6118('0x8')?utils['CAMPAIGN_STATUS'][_0x6118('0x137')]:utils[_0x6118('0x6b')][_0x6118('0x207')];for(var _0x222e2c=0x0;_0x222e2c<_0x1a1668[_0x6118('0x8f')];_0x222e2c+=0x1){if(_[_0x6118('0xf0')](_0x1a1668[_0x222e2c])||_[_0x6118('0xf0')](_0x1a1668[_0x222e2c]['Contact'])||_[_0x6118('0xf0')](_0x1a1668[_0x222e2c][_0x6118('0x15a')])){_0x202d4d['emptyContact']('[actionOriginate]\x20',_0x4e742d,_0x1a1668[_0x222e2c]);}else{hopperUtils[_0x6118('0x211')](_[_0x6118('0x69')](_0x1a1668[_0x222e2c],[_0x6118('0xe3'),_0x6118('0x15a')]))[_0x6118('0x33')](_0x202d4d[_0x6118('0x1e9')](_0x4e742d,_0x1a1668[_0x222e2c]))[_0x6118('0x96')](_0x202d4d[_0x6118('0x151')](_0x6118('0x212'),_0x4e742d));}}}})[_0x6118('0x96')](loggerGetContactDialer(_0x6118('0x213'),_0x4e742d,_0x4d2043));}};Dialer['prototype']['handlePredictive']=function(_0x18b2ea){if(_0x18b2ea[_0x6118('0x20c')]>0x0){var _0x541caa=_0x18b2ea[_0x6118('0x20c')]-_0x18b2ea[_0x6118('0x76')]-_0x18b2ea['talking'];if(_0x541caa>0x0){this['tryOriginatePredictive'](_0x18b2ea);}else{loggerPredictiveCalls['info'](_0x6118('0x214'));}}else{this[_0x6118('0x215')](_0x18b2ea);}};Dialer[_0x6118('0x13')]['tryOriginatePredictive']=function(_0x15d8b2){var _0x296320=this;var _0x5cd135=[];_0x15d8b2['originated']+=0x1;for(var _0x210526 in this['agents']){if(typeof this['agents'][_0x210526]!==_0x6118('0x14a')){if(this[_0x6118('0xee')][_0x210526][_0x6118('0x64')]===_0x6118('0x20d')&&this[_0x6118('0xee')][_0x210526][_0x6118('0x7e')]===_0x6118('0x7f')){_0x5cd135['push'](this[_0x6118('0xee')][_0x210526]['id']);}}}return this[_0x6118('0x20e')](_0x15d8b2['id'],_0x5cd135,0x1,_0x15d8b2[_0x6118('0x216')],_0x15d8b2)[_0x6118('0x33')](function(_0x11dc47){if(!utils[_0x6118('0x205')](_0x11dc47)){utils[_0x6118('0x5c')](_0x15d8b2,0x1,0x0);return hopperUtils[_0x6118('0x20f')](_0x15d8b2)[_0x6118('0x33')](sendMessageReschedule(_0x15d8b2))[_0x6118('0x96')](loggerCatch(_0x6118('0x210')));}else{_0x15d8b2[_0x6118('0x5e')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x6118('0xf0')](_0x11dc47[0x0])||_['isNil'](_0x11dc47[0x0][_0x6118('0x16d')])||_[_0x6118('0xf0')](_0x11dc47[0x0][_0x6118('0x15a')])){_0x296320[_0x6118('0x152')](_0x6118('0x212'),_0x15d8b2,_0x11dc47[0x0]);}else{return hopperUtils[_0x6118('0x211')](_[_0x6118('0x69')](_0x11dc47[0x0],['VoiceQueueId',_0x6118('0x15a')]))[_0x6118('0x33')](_0x296320[_0x6118('0x1e9')](_0x15d8b2,_0x11dc47[0x0]))[_0x6118('0x96')](_0x296320[_0x6118('0x151')](_0x6118('0x217'),_0x15d8b2));}}})[_0x6118('0x96')](loggerGetContactDialer('[getContactDialerPredictive]',_0x15d8b2,0x1));};Dialer[_0x6118('0x13')][_0x6118('0x1dc')]=function(_0x44573f,_0xfae32a,_0x7470ed,_0x1fbaf2,_0x518a23,_0x44d8e1){loggerPredictive[_0x6118('0x3e')](_0x6118('0x218'));loggerPredictive[_0x6118('0x3e')](_0x6118('0x219'),_0x44573f);loggerPredictive['info'](_0x6118('0x21a'),_0xfae32a);loggerPredictive[_0x6118('0x3e')](_0x6118('0x21b'),_0x7470ed);loggerPredictive['info'](_0x6118('0x21c'),_0x1fbaf2);loggerPredictive[_0x6118('0x3e')](_0x6118('0x21d'),_0x518a23);loggerPredictive[_0x6118('0x3e')](_0x6118('0x47'));return new Promise(function(_0x469e8c,_0x192529){if(_0x44573f<=0x0||isNaN(_0x44573f)){return _0x192529(msgResponse('[abandonmentRate]',_0x6118('0x7a'),_0x6118('0x21e')+_0x44573f));}if(_0x7470ed<=0x0||isNaN(_0x7470ed)){return _0x192529(msgResponse(_0x6118('0x21f'),_0x6118('0x7a'),'Ts\x20=\x20'+_0x7470ed));}if(_0x1fbaf2<=0x0||isNaN(_0x1fbaf2)){return _0x192529(msgResponse(_0x6118('0x21f'),_0x6118('0x7a'),_0x6118('0x220')+_0x1fbaf2));}if(_0xfae32a<=0x0||isNaN(_0xfae32a)){return _0x192529(msgResponse('[abandonmentRate]',_0x6118('0x7a'),'interval\x20=\x20'+_0xfae32a));}if(_0x518a23<=0x0||isNaN(_0x518a23)){return _0x192529(msgResponse(_0x6118('0x21f'),_0x6118('0x7a'),_0x6118('0x221')+_0x518a23));}_0x44d8e1=_0x44d8e1||0x0;var _0x4ac845=0x1/_0x7470ed;var _0x3a4417=0x0;var _0x1a16ba=0x0;var _0x2841eb=0x0;var _0x2b9d42=0x0;for(var _0x74bda2=0x0;_0x2841eb<_0x518a23;_0x74bda2+=0x1){_0x1a16ba=_0x74bda2/_0xfae32a;_0x3a4417=(_0x1fbaf2*_0x1a16ba+_0x44d8e1)/_0x4ac845;_0x2841eb=utils['erlangb'](_0x3a4417,_0x44573f);_0x2b9d42=_0x3a4417/_0x44573f*(0x1-utils[_0x6118('0x222')](_0x3a4417,_0x44573f));}return _0x469e8c({'erlangCalls':_0x74bda2,'erlangCallToSecond':_0xfae32a/_0x74bda2,'erlangAbandonmentRate':_0x2841eb,'erlangBusyFactor':_0x2b9d42});});};Dialer[_0x6118('0x13')][_0x6118('0x1dd')]=function(_0x22e376,_0x1b88ba,_0x193163,_0x1801b3,_0x8dc3b1,_0x1d362c){loggerPredictive[_0x6118('0x3e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6118('0x3e')](_0x6118('0x219'),_0x22e376);loggerPredictive[_0x6118('0x3e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b88ba);loggerPredictive['info'](_0x6118('0x21b'),_0x193163);loggerPredictive[_0x6118('0x3e')](_0x6118('0x21c'),_0x1801b3);loggerPredictive[_0x6118('0x3e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8dc3b1);loggerPredictive['info'](_0x6118('0x47'));return new Promise(function(_0x1881c7,_0x77cd7c){if(_0x22e376<=0x0||isNaN(_0x22e376)){return _0x77cd7c(msgResponse(_0x6118('0x223'),'Error',_0x6118('0x21e')+_0x22e376));}if(_0x193163<=0x0||isNaN(_0x193163)){return _0x77cd7c(msgResponse(_0x6118('0x223'),_0x6118('0x7a'),_0x6118('0x224')+_0x193163));}if(_0x1801b3<=0x0||isNaN(_0x1801b3)){return _0x77cd7c(msgResponse(_0x6118('0x223'),_0x6118('0x7a'),_0x6118('0x220')+_0x1801b3));}if(_0x1b88ba<=0x0||isNaN(_0x1b88ba)){return _0x77cd7c(msgResponse(_0x6118('0x223'),_0x6118('0x7a'),'interval\x20=\x20'+_0x1b88ba));}if(_0x8dc3b1<=0x0||isNaN(_0x8dc3b1)){return _0x77cd7c(msgResponse(_0x6118('0x223'),_0x6118('0x7a'),'Umin\x20=\x20'+_0x8dc3b1));}_0x1d362c=_0x1d362c||0x0;var _0x406ad1=0x1/_0x193163;var _0x4cab0c=0x0;var _0x369636=0x0;var _0x1fa81f=0x0;var _0x4da032=0x0;for(var _0x19b555=0x0;_0x4da032<_0x8dc3b1;_0x19b555+=0x1){_0x369636=_0x19b555/_0x1b88ba;_0x4cab0c=(_0x1801b3*_0x369636+_0x1d362c)/_0x406ad1;_0x1fa81f=utils[_0x6118('0x222')](_0x4cab0c,_0x22e376);_0x4da032=_0x4cab0c/_0x22e376*(0x1-utils[_0x6118('0x222')](_0x4cab0c,_0x22e376));}return _0x1881c7({'erlangCalls':_0x19b555,'erlangCallToSecond':_0x1b88ba/_0x19b555,'erlangAbandonmentRate':_0x1fa81f,'erlangBusyFactor':_0x4da032});});};module[_0x6118('0x225')]=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 8db2e4e..02b2570 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 _0x83c3=['queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','Contact','firstName','lastName','number'];(function(_0x463cfe,_0x39aefe){var _0x3cbd0d=function(_0x390e16){while(--_0x390e16){_0x463cfe['push'](_0x463cfe['shift']());}};_0x3cbd0d(++_0x39aefe);}(_0x83c3,0x7f));var _0x383c=function(_0x21b232,_0x1b9b77){_0x21b232=_0x21b232-0x0;var _0x54a541=_0x83c3[_0x21b232];return _0x54a541;};'use strict';var util=require('util');var _=require(_0x383c('0x0'));var moment=require(_0x383c('0x1'));function checkNameSurname(_0x1974d1,_0x132926,_0x90e9b9){var _0x55f677='';if(!_[_0x383c('0x2')](_0x132926)&&_0x383c('0x3')===typeof _0x132926){_0x55f677+=_0x132926;}if(!_[_0x383c('0x2')](_0x90e9b9)&&_0x383c('0x3')===typeof _0x90e9b9){_0x55f677+='\x20'+_0x90e9b9;}if(_0x55f677!==''){return _0x55f677;}return _0x1974d1;}function Action(_0x1b40fa,_0x6ed8ae,_0x4eacc0){this[_0x383c('0x4')]=_0x1b40fa;this[_0x383c('0x5')]=_0x4eacc0||undefined;this['name']=checkNameSurname(_0x6ed8ae['Contact'][_0x383c('0x6')],_0x6ed8ae[_0x383c('0x7')][_0x383c('0x8')],_0x6ed8ae['Contact'][_0x383c('0x9')]);this[_0x383c('0xa')]=_0x6ed8ae[_0x383c('0x6')];this[_0x383c('0xb')]=_0x1b40fa[_0x383c('0xc')];this[_0x383c('0xd')]=_0x6ed8ae['active']||![];this[_0x383c('0xe')]=_0x1b40fa['type'];this[_0x383c('0xf')]=_0x1b40fa[_0x383c('0xf')]||0x3;this[_0x383c('0x10')]=_0x6ed8ae[_0x383c('0x10')];this[_0x383c('0x11')]=_0x6ed8ae[_0x383c('0x11')];this[_0x383c('0x12')]=_0x6ed8ae[_0x383c('0x12')];this['countnoanswerretry']=_0x6ed8ae[_0x383c('0x13')];this[_0x383c('0x14')]=_0x6ed8ae[_0x383c('0x14')];this[_0x383c('0x15')]=_0x6ed8ae['countdropretry'];this[_0x383c('0x16')]=_0x6ed8ae[_0x383c('0x16')];this[_0x383c('0x17')]=_0x6ed8ae[_0x383c('0x17')];this[_0x383c('0x18')]=_0x6ed8ae[_0x383c('0x18')];this[_0x383c('0x19')]=_0x6ed8ae[_0x383c('0x19')];this[_0x383c('0x1a')]=_0x6ed8ae['ListId'];this[_0x383c('0x1b')]=_0x6ed8ae[_0x383c('0x1b')];this[_0x383c('0x1c')]=_0x6ed8ae[_0x383c('0x1c')];this[_0x383c('0x1d')]=_0x6ed8ae[_0x383c('0x1d')];this[_0x383c('0x1e')]=_0x6ed8ae['id'];this['ContactFirstName']=_0x6ed8ae[_0x383c('0x7')]['firstName']||'';this[_0x383c('0x1f')]=moment()['format'](_0x383c('0x20'));this[_0x383c('0x21')]=_0x6ed8ae[_0x383c('0x21')];this['callbackuniqueid']=_0x6ed8ae['callbackuniqueid'];this[_0x383c('0x22')]=_0x6ed8ae[_0x383c('0x22')];this[_0x383c('0x23')]=_0x6ed8ae['recallme'];this[_0x383c('0x24')]='';this[_0x383c('0x25')]='';}Action[_0x383c('0x26')][_0x383c('0x27')]=function(){return util[_0x383c('0x28')](_0x383c('0x29'),this[_0x383c('0xc')],this[_0x383c('0x4')][_0x383c('0x2a')]>0x0?this[_0x383c('0xa')][_0x383c('0x2b')](this[_0x383c('0x4')][_0x383c('0x2a')]):this[_0x383c('0xa')]);};Action[_0x383c('0x26')][_0x383c('0x2c')]=function(){return this[_0x383c('0xb')];};module[_0x383c('0x2d')]=Action; \ No newline at end of file +var _0x1307=['VoiceQueueId','CampaignId','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','uniqueid','Contact','phone','lastName','number','queue','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x1307,0x1c0));var _0x7130=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x1307[_0x1da527];return _0x40fc7c;};'use strict';var util=require(_0x7130('0x0'));var _=require(_0x7130('0x1'));var moment=require(_0x7130('0x2'));function checkNameSurname(_0x156cab,_0xbb2dbd,_0x2b52c4){var _0x32b7c6='';if(!_['isNil'](_0xbb2dbd)&&'string'===typeof _0xbb2dbd){_0x32b7c6+=_0xbb2dbd;}if(!_['isNil'](_0x2b52c4)&&_0x7130('0x3')===typeof _0x2b52c4){_0x32b7c6+='\x20'+_0x2b52c4;}if(_0x32b7c6!==''){return _0x32b7c6;}return _0x156cab;}function Action(_0x1a23c1,_0x169bd3,_0x2eab0f){this['voiceQueue']=_0x1a23c1;this[_0x7130('0x4')]=_0x2eab0f||undefined;this['name']=checkNameSurname(_0x169bd3[_0x7130('0x5')][_0x7130('0x6')],_0x169bd3['Contact']['firstName'],_0x169bd3[_0x7130('0x5')][_0x7130('0x7')]);this[_0x7130('0x8')]=_0x169bd3[_0x7130('0x6')];this[_0x7130('0x9')]=_0x1a23c1[_0x7130('0xa')];this[_0x7130('0xb')]=_0x169bd3[_0x7130('0xb')]||![];this[_0x7130('0xc')]=_0x1a23c1[_0x7130('0xc')];this['dialQueueTimeout']=_0x1a23c1['dialQueueTimeout']||0x3;this[_0x7130('0xd')]=_0x169bd3[_0x7130('0xd')];this[_0x7130('0xe')]=_0x169bd3[_0x7130('0xe')];this[_0x7130('0xf')]=_0x169bd3['countcongestionretry'];this[_0x7130('0x10')]=_0x169bd3[_0x7130('0x10')];this['countnosuchnumberretry']=_0x169bd3[_0x7130('0x11')];this[_0x7130('0x12')]=_0x169bd3[_0x7130('0x12')];this[_0x7130('0x13')]=_0x169bd3[_0x7130('0x13')];this[_0x7130('0x14')]=_0x169bd3['countmachineretry'];this[_0x7130('0x15')]=_0x169bd3[_0x7130('0x15')];this[_0x7130('0x16')]=_0x169bd3[_0x7130('0x16')];this['ListId']=_0x169bd3[_0x7130('0x17')];this[_0x7130('0x18')]=_0x169bd3[_0x7130('0x18')];this[_0x7130('0x19')]=_0x169bd3['VoiceQueueId'];this[_0x7130('0x1a')]=_0x169bd3[_0x7130('0x1a')];this['idHopper']=_0x169bd3['id'];this[_0x7130('0x1b')]=_0x169bd3[_0x7130('0x5')][_0x7130('0x1c')]||'';this['starttime']=moment()[_0x7130('0x1d')](_0x7130('0x1e'));this[_0x7130('0x1f')]=_0x169bd3[_0x7130('0x1f')];this['callbackuniqueid']=_0x169bd3['callbackuniqueid'];this[_0x7130('0x20')]=_0x169bd3[_0x7130('0x20')];this[_0x7130('0x21')]=_0x169bd3[_0x7130('0x21')];this[_0x7130('0x22')]='';this[_0x7130('0x23')]='';}Action['prototype'][_0x7130('0x24')]=function(){return util[_0x7130('0x1d')](_0x7130('0x25'),this[_0x7130('0xa')],this[_0x7130('0x26')][_0x7130('0x27')]>0x0?this[_0x7130('0x8')][_0x7130('0x28')](this['voiceQueue'][_0x7130('0x27')]):this[_0x7130('0x8')]);};Action['prototype'][_0x7130('0x29')]=function(){return this['queue'];};module[_0x7130('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index e15ad78..9bc046c 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 _0x03b1=['CampaignId','originatecalleridnum','originatecalleridname','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x03b1,0xbc));var _0x103b=function(_0x526c5a,_0x37fa23){_0x526c5a=_0x526c5a-0x0;var _0x39e718=_0x03b1[_0x526c5a];return _0x39e718;};'use strict';var moment=require(_0x103b('0x0'));var utils=require(_0x103b('0x1'));function AgentComplete(_0x388629,_0xc942c1){this[_0x103b('0x2')]=0x4;this[_0x103b('0x3')]=_0x103b('0x4');this['scheduledat']=_0x388629[_0x103b('0x5')];this[_0x103b('0x6')]=_0x388629[_0x103b('0x6')];this[_0x103b('0x7')]=_0x388629[_0x103b('0x6')]==='outbound'?_0x103b('0x8'):_0x388629['type'];this[_0x103b('0x9')]=_0x388629['countbusyretry'];this[_0x103b('0xa')]=_0x388629[_0x103b('0xa')];this[_0x103b('0xb')]=_0x388629['countnoanswerretry'];this[_0x103b('0xc')]=_0x388629[_0x103b('0x9')]+_0x388629['countcongestionretry']+_0x388629[_0x103b('0xb')]+_0x388629[_0x103b('0xd')]+_0x388629[_0x103b('0xe')]+_0x388629[_0x103b('0xf')]+_0x388629[_0x103b('0x10')]+_0x388629['countagentrejectretry'];this['countnosuchnumberretry']=_0x388629[_0x103b('0xd')];this[_0x103b('0xe')]=_0x388629[_0x103b('0xe')];this[_0x103b('0xf')]=_0x388629['countabandonedretry'];this['countmachineretry']=_0x388629[_0x103b('0x10')];this[_0x103b('0x11')]=_0x388629[_0x103b('0x11')];this[_0x103b('0x12')]=_0xc942c1[_0x103b('0x12')];this[_0x103b('0x13')]=_0x388629[_0x103b('0x14')];this[_0x103b('0x15')]=_0x388629[_0x103b('0x16')];this['starttime']=_0x388629[_0x103b('0x17')];this[_0x103b('0x18')]=_0x388629[_0x103b('0x18')];this[_0x103b('0x19')]=_0x388629[_0x103b('0x19')];this[_0x103b('0x1a')]=moment()[_0x103b('0x1b')](_0x103b('0x1c'));this[_0x103b('0x1d')]=utils[_0x103b('0x1e')](_0x388629['responsetime'],_0x388629[_0x103b('0x17')]);this['holdtime']=utils['getSeconds'](_0x388629[_0x103b('0x19')],_0x388629[_0x103b('0x18')]);this[_0x103b('0x1f')]=utils['getSeconds'](this[_0x103b('0x1a')],_0x388629[_0x103b('0x19')]);this[_0x103b('0x8')]=_0xc942c1[_0x103b('0x8')];this[_0x103b('0x20')]=_0xc942c1['membername'];this[_0x103b('0x21')]=_0xc942c1[_0x103b('0x21')];this[_0x103b('0x22')]=_0x388629[_0x103b('0x22')];this[_0x103b('0x23')]=_0x388629[_0x103b('0x23')];this[_0x103b('0x24')]=_0x388629['callbackat'];this[_0x103b('0x25')]=_0x388629[_0x103b('0x25')];this[_0x103b('0x26')]=_0x388629['ContactId'];this['ListId']=_0x388629[_0x103b('0x27')];this[_0x103b('0x28')]=_0x388629[_0x103b('0x28')];this[_0x103b('0x29')]=_0x388629[_0x103b('0x29')];this[_0x103b('0x2a')]=_0x388629[_0x103b('0x2a')];this[_0x103b('0x2b')]=_0x388629[_0x103b('0x2b')]||'';this[_0x103b('0x2c')]=_0x388629[_0x103b('0x2c')]||'';this['agiafterat']=_0x388629['agiafterat'];}module[_0x103b('0x2d')]=AgentComplete; \ No newline at end of file +var _0xbf07=['ringtime','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xbf07,0xef));var _0x7bf0=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xbf07[_0x5d6456];return _0x4d66c1;};'use strict';var moment=require(_0x7bf0('0x0'));var utils=require(_0x7bf0('0x1'));function AgentComplete(_0x5e1ff8,_0x47cf08){this[_0x7bf0('0x2')]=0x4;this[_0x7bf0('0x3')]='Answer';this[_0x7bf0('0x4')]=_0x5e1ff8[_0x7bf0('0x4')];this[_0x7bf0('0x5')]=_0x5e1ff8[_0x7bf0('0x5')];this[_0x7bf0('0x6')]=_0x5e1ff8[_0x7bf0('0x5')]==='outbound'?_0x7bf0('0x7'):_0x5e1ff8[_0x7bf0('0x5')];this[_0x7bf0('0x8')]=_0x5e1ff8[_0x7bf0('0x8')];this['countcongestionretry']=_0x5e1ff8[_0x7bf0('0x9')];this['countnoanswerretry']=_0x5e1ff8[_0x7bf0('0xa')];this['countglobal']=_0x5e1ff8[_0x7bf0('0x8')]+_0x5e1ff8[_0x7bf0('0x9')]+_0x5e1ff8['countnoanswerretry']+_0x5e1ff8['countnosuchnumberretry']+_0x5e1ff8[_0x7bf0('0xb')]+_0x5e1ff8[_0x7bf0('0xc')]+_0x5e1ff8[_0x7bf0('0xd')]+_0x5e1ff8[_0x7bf0('0xe')];this[_0x7bf0('0xf')]=_0x5e1ff8['countnosuchnumberretry'];this[_0x7bf0('0xb')]=_0x5e1ff8[_0x7bf0('0xb')];this[_0x7bf0('0xc')]=_0x5e1ff8[_0x7bf0('0xc')];this[_0x7bf0('0xd')]=_0x5e1ff8[_0x7bf0('0xd')];this['countagentrejectretry']=_0x5e1ff8['countagentrejectretry'];this['uniqueid']=_0x47cf08[_0x7bf0('0x10')];this[_0x7bf0('0x11')]=_0x5e1ff8[_0x7bf0('0x12')];this[_0x7bf0('0x13')]=_0x5e1ff8[_0x7bf0('0x14')];this[_0x7bf0('0x15')]=_0x5e1ff8[_0x7bf0('0x15')];this[_0x7bf0('0x16')]=_0x5e1ff8[_0x7bf0('0x16')];this['answertime']=_0x5e1ff8[_0x7bf0('0x17')];this['endtime']=moment()[_0x7bf0('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7bf0('0x19')]=utils[_0x7bf0('0x1a')](_0x5e1ff8[_0x7bf0('0x16')],_0x5e1ff8[_0x7bf0('0x15')]);this[_0x7bf0('0x1b')]=utils[_0x7bf0('0x1a')](_0x5e1ff8[_0x7bf0('0x17')],_0x5e1ff8[_0x7bf0('0x16')]);this[_0x7bf0('0x1c')]=utils[_0x7bf0('0x1a')](this[_0x7bf0('0x1d')],_0x5e1ff8[_0x7bf0('0x17')]);this['queue']=_0x47cf08[_0x7bf0('0x7')];this[_0x7bf0('0x1e')]=_0x47cf08[_0x7bf0('0x1e')];this[_0x7bf0('0x1f')]=_0x47cf08[_0x7bf0('0x1f')];this[_0x7bf0('0x20')]=_0x5e1ff8[_0x7bf0('0x20')];this[_0x7bf0('0x21')]=_0x5e1ff8[_0x7bf0('0x21')];this[_0x7bf0('0x22')]=_0x5e1ff8['callbackat'];this[_0x7bf0('0x23')]=_0x5e1ff8[_0x7bf0('0x23')];this[_0x7bf0('0x24')]=_0x5e1ff8[_0x7bf0('0x24')];this['ListId']=_0x5e1ff8[_0x7bf0('0x25')];this[_0x7bf0('0x26')]=_0x5e1ff8[_0x7bf0('0x26')];this['VoiceQueueId']=_0x5e1ff8[_0x7bf0('0x27')];this[_0x7bf0('0x28')]=_0x5e1ff8[_0x7bf0('0x28')];this[_0x7bf0('0x29')]=_0x5e1ff8[_0x7bf0('0x29')]||'';this[_0x7bf0('0x2a')]=_0x5e1ff8['originatecalleridname']||'';this[_0x7bf0('0x2b')]=_0x5e1ff8['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 3019693..0ec86d0 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 _0xc889=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x416eb1,_0x1ee019){var _0x41cbc1=function(_0x299e1c){while(--_0x299e1c){_0x416eb1['push'](_0x416eb1['shift']());}};_0x41cbc1(++_0x1ee019);}(_0xc889,0xd0));var _0x9c88=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xc889[_0x12f688];return _0x59c3de;};'use strict';function Final(_0x4bfaa0){this['uniqueid']=_0x4bfaa0[_0x9c88('0x0')];this[_0x9c88('0x1')]=_0x4bfaa0[_0x9c88('0x1')];this['type']=_0x4bfaa0[_0x9c88('0x2')];this[_0x9c88('0x3')]=_0x4bfaa0[_0x9c88('0x2')]===_0x9c88('0x4')?'queue':_0x4bfaa0['type'];this[_0x9c88('0x5')]=_0x4bfaa0[_0x9c88('0x5')];this['countcongestionretry']=_0x4bfaa0[_0x9c88('0x6')];this['countnoanswerretry']=_0x4bfaa0['countnoanswerretry'];this['countglobal']=_0x4bfaa0['countbusyretry']+_0x4bfaa0[_0x9c88('0x6')]+_0x4bfaa0[_0x9c88('0x7')]+_0x4bfaa0[_0x9c88('0x8')]+_0x4bfaa0[_0x9c88('0x9')]+_0x4bfaa0[_0x9c88('0xa')]+_0x4bfaa0['countmachineretry']+_0x4bfaa0[_0x9c88('0xb')];this['countnosuchnumberretry']=_0x4bfaa0[_0x9c88('0x8')];this['countdropretry']=_0x4bfaa0[_0x9c88('0x9')];this[_0x9c88('0xa')]=_0x4bfaa0[_0x9c88('0xa')];this[_0x9c88('0xc')]=_0x4bfaa0[_0x9c88('0xc')];this[_0x9c88('0xb')]=_0x4bfaa0[_0x9c88('0xb')];this[_0x9c88('0xd')]=_0x4bfaa0[_0x9c88('0xd')];this[_0x9c88('0xe')]=_0x4bfaa0[_0x9c88('0xe')];this['calleridnum']=_0x4bfaa0[_0x9c88('0xf')];this[_0x9c88('0x10')]=_0x4bfaa0[_0x9c88('0x10')];this[_0x9c88('0x11')]=_0x4bfaa0[_0x9c88('0x11')];this[_0x9c88('0x12')]=_0x4bfaa0[_0x9c88('0x11')];this[_0x9c88('0x13')]=_0x4bfaa0[_0x9c88('0x13')]||0x0;this[_0x9c88('0x14')]=_0x4bfaa0[_0x9c88('0x14')]||0x0;this['talktime']=_0x4bfaa0[_0x9c88('0x15')]||0x0;this['callback']=_0x4bfaa0[_0x9c88('0x16')];this[_0x9c88('0x17')]=_0x4bfaa0[_0x9c88('0x17')];this[_0x9c88('0x18')]=_0x4bfaa0['callbackat'];this['recallme']=_0x4bfaa0[_0x9c88('0x19')];this[_0x9c88('0x1a')]=_0x4bfaa0[_0x9c88('0x1a')];this[_0x9c88('0x1b')]=_0x4bfaa0['ListId'];this[_0x9c88('0x1c')]=_0x4bfaa0[_0x9c88('0x1c')];this[_0x9c88('0x1d')]=_0x4bfaa0[_0x9c88('0x1d')];this[_0x9c88('0x1e')]=_0x4bfaa0[_0x9c88('0x1e')];this[_0x9c88('0x1f')]=_0x4bfaa0[_0x9c88('0x1f')]||'';this[_0x9c88('0x20')]=_0x4bfaa0[_0x9c88('0x20')]||'';this['state']=_0x4bfaa0[_0x9c88('0x21')];this[_0x9c88('0x22')]=_0x4bfaa0[_0x9c88('0x22')];}module[_0x9c88('0x23')]=Final; \ No newline at end of file +var _0x9580=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x4f82ae,_0x18acca){var _0x7eb615=function(_0x3964ba){while(--_0x3964ba){_0x4f82ae['push'](_0x4f82ae['shift']());}};_0x7eb615(++_0x18acca);}(_0x9580,0x16f));var _0x0958=function(_0x2909e0,_0x29aa63){_0x2909e0=_0x2909e0-0x0;var _0x3f7f1e=_0x9580[_0x2909e0];return _0x3f7f1e;};'use strict';function Final(_0x5198f9){this['uniqueid']=_0x5198f9[_0x0958('0x0')];this[_0x0958('0x1')]=_0x5198f9[_0x0958('0x1')];this['type']=_0x5198f9[_0x0958('0x2')];this[_0x0958('0x3')]=_0x5198f9[_0x0958('0x2')]===_0x0958('0x4')?_0x0958('0x5'):_0x5198f9[_0x0958('0x2')];this[_0x0958('0x6')]=_0x5198f9[_0x0958('0x6')];this['countcongestionretry']=_0x5198f9[_0x0958('0x7')];this[_0x0958('0x8')]=_0x5198f9[_0x0958('0x8')];this[_0x0958('0x9')]=_0x5198f9[_0x0958('0x6')]+_0x5198f9[_0x0958('0x7')]+_0x5198f9['countnoanswerretry']+_0x5198f9['countnosuchnumberretry']+_0x5198f9[_0x0958('0xa')]+_0x5198f9[_0x0958('0xb')]+_0x5198f9['countmachineretry']+_0x5198f9['countagentrejectretry'];this[_0x0958('0xc')]=_0x5198f9[_0x0958('0xc')];this['countdropretry']=_0x5198f9['countdropretry'];this[_0x0958('0xb')]=_0x5198f9[_0x0958('0xb')];this[_0x0958('0xd')]=_0x5198f9['countmachineretry'];this[_0x0958('0xe')]=_0x5198f9[_0x0958('0xe')];this[_0x0958('0x5')]=_0x5198f9[_0x0958('0x5')];this[_0x0958('0xf')]=_0x5198f9['calleridname'];this[_0x0958('0x10')]=_0x5198f9[_0x0958('0x10')];this['starttime']=_0x5198f9[_0x0958('0x11')];this[_0x0958('0x12')]=_0x5198f9[_0x0958('0x12')];this['endtime']=_0x5198f9[_0x0958('0x12')];this['ringtime']=_0x5198f9[_0x0958('0x13')]||0x0;this[_0x0958('0x14')]=_0x5198f9[_0x0958('0x14')]||0x0;this[_0x0958('0x15')]=_0x5198f9[_0x0958('0x15')]||0x0;this[_0x0958('0x16')]=_0x5198f9[_0x0958('0x16')];this['callbackuniqueid']=_0x5198f9['callbackuniqueid'];this['callbackat']=_0x5198f9[_0x0958('0x17')];this['recallme']=_0x5198f9[_0x0958('0x18')];this[_0x0958('0x19')]=_0x5198f9[_0x0958('0x19')];this[_0x0958('0x1a')]=_0x5198f9[_0x0958('0x1a')];this[_0x0958('0x1b')]=_0x5198f9['UserId'];this[_0x0958('0x1c')]=_0x5198f9[_0x0958('0x1c')];this[_0x0958('0x1d')]=_0x5198f9[_0x0958('0x1d')];this['originatecalleridnum']=_0x5198f9['originatecalleridnum']||'';this[_0x0958('0x1e')]=_0x5198f9[_0x0958('0x1e')]||'';this[_0x0958('0x1f')]=_0x5198f9['state'];this[_0x0958('0x20')]=_0x5198f9[_0x0958('0x20')];}module[_0x0958('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index d8a7e61..7c8acc9 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 _0x9e61=['VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','IVR','cause-txt','callback','callbackat','ContactId','ListId','UserId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9e61,0xf3));var _0x19e6=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x9e61[_0x12f688];return _0x59c3de;};'use strict';var moment=require(_0x19e6('0x0'));var utils=require('../utils');function Hangup(_0x495021,_0x3c36a2){this['state']=0x4;this[_0x19e6('0x1')]=_0x19e6('0x2');this[_0x19e6('0x3')]=_0x495021[_0x19e6('0x3')];this['type']=_0x495021[_0x19e6('0x4')];this['campaigntype']=_0x495021[_0x19e6('0x4')]===_0x19e6('0x5')?'queue':_0x495021[_0x19e6('0x4')];this[_0x19e6('0x6')]=_0x495021[_0x19e6('0x6')]||![];this['countbusyretry']=_0x495021[_0x19e6('0x7')];this[_0x19e6('0x8')]=_0x495021[_0x19e6('0x8')];this[_0x19e6('0x9')]=_0x495021[_0x19e6('0x9')];this[_0x19e6('0xa')]=_0x495021[_0x19e6('0x7')]+_0x495021[_0x19e6('0x8')]+_0x495021['countnoanswerretry']+_0x495021[_0x19e6('0xb')]+_0x495021[_0x19e6('0xc')]+_0x495021[_0x19e6('0xd')]+_0x495021[_0x19e6('0xe')]+_0x495021[_0x19e6('0xf')];this[_0x19e6('0xb')]=_0x495021[_0x19e6('0xb')];this[_0x19e6('0xc')]=_0x495021[_0x19e6('0xc')];this['countabandonedretry']=_0x495021[_0x19e6('0xd')];this[_0x19e6('0xe')]=_0x495021[_0x19e6('0xe')];this[_0x19e6('0xf')]=_0x495021[_0x19e6('0xf')];this[_0x19e6('0x10')]=_0x3c36a2[_0x19e6('0x10')];this[_0x19e6('0x11')]=_0x495021[_0x19e6('0x12')];this['calleridnum']=_0x495021[_0x19e6('0x13')];this['starttime']=_0x495021[_0x19e6('0x14')];this[_0x19e6('0x15')]=_0x495021[_0x19e6('0x15')];this[_0x19e6('0x16')]=moment()[_0x19e6('0x17')](_0x19e6('0x18'));this[_0x19e6('0x19')]=utils[_0x19e6('0x1a')](_0x495021[_0x19e6('0x15')],_0x495021[_0x19e6('0x14')]);this[_0x19e6('0x1b')]=0x0;this['talktime']=utils[_0x19e6('0x1a')](this[_0x19e6('0x16')],_0x495021[_0x19e6('0x15')]);this[_0x19e6('0x1c')]=_0x495021[_0x19e6('0x1c')];this[_0x19e6('0x1d')]=_0x19e6('0x1e');this['reason']=_0x3c36a2[_0x19e6('0x1f')];this[_0x19e6('0x20')]=_0x495021[_0x19e6('0x20')];this['callbackuniqueid']=_0x495021['callbackuniqueid'];this[_0x19e6('0x21')]=_0x495021['callbackat'];this['recallme']=_0x495021['recallme'];this['ContactId']=_0x495021[_0x19e6('0x22')];this[_0x19e6('0x23')]=_0x495021[_0x19e6('0x23')];this[_0x19e6('0x24')]=_0x495021[_0x19e6('0x24')];this[_0x19e6('0x25')]=_0x495021[_0x19e6('0x25')];this[_0x19e6('0x26')]=_0x495021[_0x19e6('0x26')];}module[_0x19e6('0x27')]=Hangup; \ No newline at end of file +var _0xfafb=['CampaignId','exports','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','getSeconds','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2513ad,_0x3b9f2b){var _0x30fca5=function(_0x10f1f0){while(--_0x10f1f0){_0x2513ad['push'](_0x2513ad['shift']());}};_0x30fca5(++_0x3b9f2b);}(_0xfafb,0x17c));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var utils=require(_0xbfaf('0x0'));function Hangup(_0x378044,_0x48da03){this[_0xbfaf('0x1')]=0x4;this[_0xbfaf('0x2')]='Answer';this['scheduledat']=_0x378044[_0xbfaf('0x3')];this[_0xbfaf('0x4')]=_0x378044[_0xbfaf('0x4')];this[_0xbfaf('0x5')]=_0x378044[_0xbfaf('0x4')]===_0xbfaf('0x6')?'queue':_0x378044[_0xbfaf('0x4')];this[_0xbfaf('0x7')]=_0x378044[_0xbfaf('0x7')]||![];this[_0xbfaf('0x8')]=_0x378044[_0xbfaf('0x8')];this[_0xbfaf('0x9')]=_0x378044[_0xbfaf('0x9')];this[_0xbfaf('0xa')]=_0x378044[_0xbfaf('0xa')];this[_0xbfaf('0xb')]=_0x378044[_0xbfaf('0x8')]+_0x378044[_0xbfaf('0x9')]+_0x378044[_0xbfaf('0xa')]+_0x378044[_0xbfaf('0xc')]+_0x378044[_0xbfaf('0xd')]+_0x378044['countabandonedretry']+_0x378044['countmachineretry']+_0x378044['countagentrejectretry'];this['countnosuchnumberretry']=_0x378044[_0xbfaf('0xc')];this[_0xbfaf('0xd')]=_0x378044[_0xbfaf('0xd')];this[_0xbfaf('0xe')]=_0x378044[_0xbfaf('0xe')];this[_0xbfaf('0xf')]=_0x378044[_0xbfaf('0xf')];this[_0xbfaf('0x10')]=_0x378044[_0xbfaf('0x10')];this[_0xbfaf('0x11')]=_0x48da03[_0xbfaf('0x11')];this[_0xbfaf('0x12')]=_0x378044['name'];this[_0xbfaf('0x13')]=_0x378044['number'];this[_0xbfaf('0x14')]=_0x378044['starttime'];this[_0xbfaf('0x15')]=_0x378044[_0xbfaf('0x15')];this[_0xbfaf('0x16')]=moment()[_0xbfaf('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xbfaf('0x18')](_0x378044[_0xbfaf('0x15')],_0x378044[_0xbfaf('0x14')]);this[_0xbfaf('0x19')]=0x0;this[_0xbfaf('0x1a')]=utils[_0xbfaf('0x18')](this['endtime'],_0x378044[_0xbfaf('0x15')]);this['queue']=_0x378044[_0xbfaf('0x1b')];this[_0xbfaf('0x1c')]=_0xbfaf('0x1d');this[_0xbfaf('0x1e')]=_0x48da03[_0xbfaf('0x1f')];this[_0xbfaf('0x20')]=_0x378044[_0xbfaf('0x20')];this[_0xbfaf('0x21')]=_0x378044[_0xbfaf('0x21')];this['callbackat']=_0x378044[_0xbfaf('0x22')];this[_0xbfaf('0x23')]=_0x378044[_0xbfaf('0x23')];this[_0xbfaf('0x24')]=_0x378044[_0xbfaf('0x24')];this[_0xbfaf('0x25')]=_0x378044[_0xbfaf('0x25')];this[_0xbfaf('0x26')]=_0x378044['UserId'];this[_0xbfaf('0x27')]=_0x378044[_0xbfaf('0x27')];this[_0xbfaf('0x28')]=_0x378044[_0xbfaf('0x28')];}module[_0xbfaf('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 8150717..5bb5bc7 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 _0x9343=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','getSeconds','holdtime','talktime','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid'];(function(_0x2c2538,_0x5a3874){var _0x114a3b=function(_0x436b8b){while(--_0x436b8b){_0x2c2538['push'](_0x2c2538['shift']());}};_0x114a3b(++_0x5a3874);}(_0x9343,0x1e8));var _0x3934=function(_0x42c0fb,_0x22f114){_0x42c0fb=_0x42c0fb-0x0;var _0x29294d=_0x9343[_0x42c0fb];return _0x29294d;};'use strict';var utils=require(_0x3934('0x0'));function History(_0x4c9951){this[_0x3934('0x1')]=_0x4c9951[_0x3934('0x1')];this[_0x3934('0x2')]=_0x4c9951[_0x3934('0x2')]||undefined;this['type']=_0x4c9951[_0x3934('0x3')];this[_0x3934('0x4')]=_0x4c9951[_0x3934('0x3')]===_0x3934('0x5')?_0x3934('0x6'):_0x4c9951[_0x3934('0x3')];this[_0x3934('0x7')]=_0x4c9951['countbusyretry'];this[_0x3934('0x8')]=_0x4c9951[_0x3934('0x8')];this[_0x3934('0x9')]=_0x4c9951['countnoanswerretry'];this[_0x3934('0xa')]=_0x4c9951['countbusyretry']+_0x4c9951[_0x3934('0x8')]+_0x4c9951[_0x3934('0x9')]+_0x4c9951['countnosuchnumberretry']+_0x4c9951[_0x3934('0xb')]+_0x4c9951['countabandonedretry']+_0x4c9951[_0x3934('0xc')]+_0x4c9951[_0x3934('0xd')];this[_0x3934('0xe')]=_0x4c9951[_0x3934('0xe')];this[_0x3934('0xb')]=_0x4c9951[_0x3934('0xb')];this[_0x3934('0xf')]=_0x4c9951[_0x3934('0xf')];this['countmachineretry']=_0x4c9951[_0x3934('0xc')];this['countagentrejectretry']=_0x4c9951[_0x3934('0xd')];this['queue']=_0x4c9951['queue'];this[_0x3934('0x10')]=_0x4c9951[_0x3934('0x11')];this[_0x3934('0x12')]=_0x4c9951[_0x3934('0x13')];this[_0x3934('0x14')]=_0x4c9951[_0x3934('0x14')];this[_0x3934('0x15')]=_0x4c9951[_0x3934('0x15')];this['endtime']=_0x4c9951[_0x3934('0x15')];this['ringtime']=utils[_0x3934('0x16')](_0x4c9951[_0x3934('0x15')],_0x4c9951[_0x3934('0x14')]);this[_0x3934('0x17')]=0x0;this[_0x3934('0x18')]=0x0;this['callback']=_0x4c9951['callback'];this[_0x3934('0x19')]=_0x4c9951[_0x3934('0x19')];this['callbackat']=_0x4c9951['callbackat'];this['recallme']=_0x4c9951[_0x3934('0x1a')];this['ContactId']=_0x4c9951[_0x3934('0x1b')];this[_0x3934('0x1c')]=_0x4c9951[_0x3934('0x1c')];this[_0x3934('0x1d')]=_0x4c9951[_0x3934('0x1d')];this[_0x3934('0x1e')]=_0x4c9951[_0x3934('0x1e')];this['CampaignId']=_0x4c9951['CampaignId'];this[_0x3934('0x1f')]=_0x4c9951[_0x3934('0x1f')]||'';this['originatecalleridname']=_0x4c9951['originatecalleridname']||'';this[_0x3934('0x20')]=_0x4c9951['state'];this[_0x3934('0x21')]=_0x4c9951['statedesc'];}module[_0x3934('0x22')]=History; \ No newline at end of file +var _0xbaf8=['countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x53a965,_0x1af37a){var _0x4243bb=function(_0x2e03e9){while(--_0x2e03e9){_0x53a965['push'](_0x53a965['shift']());}};_0x4243bb(++_0x1af37a);}(_0xbaf8,0x19b));var _0x8baf=function(_0x504691,_0x2d34f4){_0x504691=_0x504691-0x0;var _0x24364c=_0xbaf8[_0x504691];return _0x24364c;};'use strict';var utils=require(_0x8baf('0x0'));function History(_0x70f950){this[_0x8baf('0x1')]=_0x70f950[_0x8baf('0x1')];this[_0x8baf('0x2')]=_0x70f950[_0x8baf('0x2')]||undefined;this[_0x8baf('0x3')]=_0x70f950[_0x8baf('0x3')];this[_0x8baf('0x4')]=_0x70f950[_0x8baf('0x3')]==='outbound'?_0x8baf('0x5'):_0x70f950['type'];this['countbusyretry']=_0x70f950[_0x8baf('0x6')];this[_0x8baf('0x7')]=_0x70f950[_0x8baf('0x7')];this[_0x8baf('0x8')]=_0x70f950[_0x8baf('0x8')];this['countglobal']=_0x70f950[_0x8baf('0x6')]+_0x70f950[_0x8baf('0x7')]+_0x70f950['countnoanswerretry']+_0x70f950['countnosuchnumberretry']+_0x70f950[_0x8baf('0x9')]+_0x70f950['countabandonedretry']+_0x70f950[_0x8baf('0xa')]+_0x70f950[_0x8baf('0xb')];this['countnosuchnumberretry']=_0x70f950[_0x8baf('0xc')];this['countdropretry']=_0x70f950['countdropretry'];this[_0x8baf('0xd')]=_0x70f950[_0x8baf('0xd')];this[_0x8baf('0xa')]=_0x70f950[_0x8baf('0xa')];this[_0x8baf('0xb')]=_0x70f950[_0x8baf('0xb')];this[_0x8baf('0x5')]=_0x70f950[_0x8baf('0x5')];this[_0x8baf('0xe')]=_0x70f950['name'];this[_0x8baf('0xf')]=_0x70f950[_0x8baf('0x10')];this[_0x8baf('0x11')]=_0x70f950[_0x8baf('0x11')];this[_0x8baf('0x12')]=_0x70f950['responsetime'];this['endtime']=_0x70f950[_0x8baf('0x12')];this['ringtime']=utils[_0x8baf('0x13')](_0x70f950[_0x8baf('0x12')],_0x70f950[_0x8baf('0x11')]);this['holdtime']=0x0;this[_0x8baf('0x14')]=0x0;this['callback']=_0x70f950[_0x8baf('0x15')];this['callbackuniqueid']=_0x70f950[_0x8baf('0x16')];this['callbackat']=_0x70f950[_0x8baf('0x17')];this[_0x8baf('0x18')]=_0x70f950[_0x8baf('0x18')];this[_0x8baf('0x19')]=_0x70f950[_0x8baf('0x19')];this[_0x8baf('0x1a')]=_0x70f950[_0x8baf('0x1a')];this[_0x8baf('0x1b')]=_0x70f950[_0x8baf('0x1b')];this['VoiceQueueId']=_0x70f950[_0x8baf('0x1c')];this[_0x8baf('0x1d')]=_0x70f950['CampaignId'];this[_0x8baf('0x1e')]=_0x70f950[_0x8baf('0x1e')]||'';this[_0x8baf('0x1f')]=_0x70f950['originatecalleridname']||'';this[_0x8baf('0x20')]=_0x70f950[_0x8baf('0x20')];this[_0x8baf('0x21')]=_0x70f950[_0x8baf('0x21')];}module[_0x8baf('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 9187e8c..d86a051 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 _0xdc7d=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','getSeconds','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xdc7d,0x79));var _0xddc7=function(_0x1fbcc6,_0xd52213){_0x1fbcc6=_0x1fbcc6-0x0;var _0x5bd885=_0xdc7d[_0x1fbcc6];return _0x5bd885;};'use strict';var utils=require(_0xddc7('0x0'));function QueueCallerAbandon(_0xd0293d,_0x2ade9e){this[_0xddc7('0x1')]=_0xd0293d['scheduledat'];this[_0xddc7('0x2')]=_0xd0293d['type'];this[_0xddc7('0x3')]=_0xd0293d[_0xddc7('0x2')]==='outbound'?_0xddc7('0x4'):_0xd0293d['type'];this[_0xddc7('0x5')]=_0xd0293d[_0xddc7('0x5')];this[_0xddc7('0x6')]=_0xd0293d[_0xddc7('0x6')];this[_0xddc7('0x7')]=_0xd0293d[_0xddc7('0x7')];this[_0xddc7('0x8')]=_0xd0293d[_0xddc7('0x5')]+_0xd0293d['countcongestionretry']+_0xd0293d[_0xddc7('0x7')]+_0xd0293d[_0xddc7('0x9')]+_0xd0293d['countdropretry']+_0xd0293d[_0xddc7('0xa')]+_0xd0293d[_0xddc7('0xb')]+_0xd0293d[_0xddc7('0xc')];this[_0xddc7('0x9')]=_0xd0293d[_0xddc7('0x9')];this[_0xddc7('0xd')]=_0xd0293d[_0xddc7('0xd')];this[_0xddc7('0xa')]=_0xd0293d[_0xddc7('0xa')];this[_0xddc7('0xb')]=_0xd0293d[_0xddc7('0xb')];this[_0xddc7('0xc')]=_0xd0293d[_0xddc7('0xc')];this[_0xddc7('0xe')]=_0x2ade9e[_0xddc7('0xe')];this['calleridname']=_0xd0293d['name'];this[_0xddc7('0xf')]=_0xd0293d[_0xddc7('0x10')];this[_0xddc7('0x11')]=_0xd0293d[_0xddc7('0x11')];this[_0xddc7('0x12')]=_0xd0293d['responsetime'];this['droptime']=_0xd0293d[_0xddc7('0x13')];this['dropreason']=_0xd0293d['dropreason'];this[_0xddc7('0x14')]=this[_0xddc7('0x13')];this[_0xddc7('0x15')]=utils[_0xddc7('0x16')](_0xd0293d[_0xddc7('0x12')],_0xd0293d['starttime']);this['holdtime']=utils[_0xddc7('0x16')](this['droptime'],_0xd0293d['responsetime']);this['talktime']=0x0;this['queue']=_0x2ade9e[_0xddc7('0x4')];this[_0xddc7('0x17')]=_0x2ade9e[_0xddc7('0x18')];this[_0xddc7('0x19')]=_0x2ade9e[_0xddc7('0x19')];this[_0xddc7('0x1a')]=_0xd0293d['callback'];this['callbackuniqueid']=_0xd0293d[_0xddc7('0x1b')];this[_0xddc7('0x1c')]=_0xd0293d['callbackat'];this[_0xddc7('0x1d')]=_0xd0293d[_0xddc7('0x1d')];this[_0xddc7('0x1e')]=_0xd0293d[_0xddc7('0x1e')];this[_0xddc7('0x1f')]=_0xd0293d[_0xddc7('0x1f')];this[_0xddc7('0x20')]=_0xd0293d[_0xddc7('0x20')];this[_0xddc7('0x21')]=_0xd0293d[_0xddc7('0x21')];this[_0xddc7('0x22')]=_0xd0293d[_0xddc7('0x22')];this[_0xddc7('0x23')]=_0xd0293d[_0xddc7('0x23')]||'';this[_0xddc7('0x24')]=_0xd0293d[_0xddc7('0x24')]||'';this['agiafterat']=_0xd0293d[_0xddc7('0x25')];this[_0xddc7('0x26')]=_0xd0293d[_0xddc7('0x26')];this[_0xddc7('0x27')]=_0xd0293d[_0xddc7('0x27')];}module[_0xddc7('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x1558=['countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','dropreason','droptime','holdtime','getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x304b22,_0x4f5339){var _0x245ac1=function(_0x27f0ea){while(--_0x27f0ea){_0x304b22['push'](_0x304b22['shift']());}};_0x245ac1(++_0x4f5339);}(_0x1558,0x6d));var _0x8155=function(_0x114c53,_0x2249c6){_0x114c53=_0x114c53-0x0;var _0x4e0c14=_0x1558[_0x114c53];return _0x4e0c14;};'use strict';var utils=require(_0x8155('0x0'));function QueueCallerAbandon(_0x365142,_0x23e2a2){this[_0x8155('0x1')]=_0x365142[_0x8155('0x1')];this[_0x8155('0x2')]=_0x365142[_0x8155('0x2')];this[_0x8155('0x3')]=_0x365142[_0x8155('0x2')]===_0x8155('0x4')?_0x8155('0x5'):_0x365142[_0x8155('0x2')];this[_0x8155('0x6')]=_0x365142[_0x8155('0x6')];this[_0x8155('0x7')]=_0x365142[_0x8155('0x7')];this[_0x8155('0x8')]=_0x365142['countnoanswerretry'];this[_0x8155('0x9')]=_0x365142[_0x8155('0x6')]+_0x365142[_0x8155('0x7')]+_0x365142[_0x8155('0x8')]+_0x365142['countnosuchnumberretry']+_0x365142[_0x8155('0xa')]+_0x365142['countabandonedretry']+_0x365142[_0x8155('0xb')]+_0x365142['countagentrejectretry'];this[_0x8155('0xc')]=_0x365142['countnosuchnumberretry'];this[_0x8155('0xa')]=_0x365142[_0x8155('0xa')];this[_0x8155('0xd')]=_0x365142['countabandonedretry'];this[_0x8155('0xb')]=_0x365142[_0x8155('0xb')];this[_0x8155('0xe')]=_0x365142[_0x8155('0xe')];this[_0x8155('0xf')]=_0x23e2a2[_0x8155('0xf')];this['calleridname']=_0x365142['name'];this[_0x8155('0x10')]=_0x365142['number'];this['starttime']=_0x365142[_0x8155('0x11')];this[_0x8155('0x12')]=_0x365142[_0x8155('0x12')];this['droptime']=_0x365142['droptime'];this[_0x8155('0x13')]=_0x365142[_0x8155('0x13')];this['endtime']=this[_0x8155('0x14')];this['ringtime']=utils['getSeconds'](_0x365142[_0x8155('0x12')],_0x365142[_0x8155('0x11')]);this[_0x8155('0x15')]=utils[_0x8155('0x16')](this[_0x8155('0x14')],_0x365142[_0x8155('0x12')]);this[_0x8155('0x17')]=0x0;this[_0x8155('0x5')]=_0x23e2a2[_0x8155('0x5')];this['membername']=_0x23e2a2[_0x8155('0x18')];this[_0x8155('0x19')]=_0x23e2a2[_0x8155('0x19')];this[_0x8155('0x1a')]=_0x365142[_0x8155('0x1a')];this[_0x8155('0x1b')]=_0x365142[_0x8155('0x1b')];this[_0x8155('0x1c')]=_0x365142[_0x8155('0x1c')];this[_0x8155('0x1d')]=_0x365142['recallme'];this[_0x8155('0x1e')]=_0x365142[_0x8155('0x1e')];this[_0x8155('0x1f')]=_0x365142['ListId'];this[_0x8155('0x20')]=_0x365142[_0x8155('0x20')];this[_0x8155('0x21')]=_0x365142[_0x8155('0x21')];this[_0x8155('0x22')]=_0x365142[_0x8155('0x22')];this['originatecalleridnum']=_0x365142['originatecalleridnum']||'';this['originatecalleridname']=_0x365142[_0x8155('0x23')]||'';this['agiafterat']=_0x365142[_0x8155('0x24')];this[_0x8155('0x25')]=_0x365142['state'];this[_0x8155('0x26')]=_0x365142[_0x8155('0x26')];}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 ecca357..08aaa5f 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 _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x44c062,_0x56b5f5){var _0x1a4bbd=function(_0x404c7b){while(--_0x404c7b){_0x44c062['push'](_0x44c062['shift']());}};_0x1a4bbd(++_0x56b5f5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cf150,_0x178cb5){_0x3cf150=_0x3cf150-0x0;var _0x931f8b=_0xb10b[_0x3cf150];return _0x931f8b;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0xd22dc7,_0x5a87c4){var _0xd4ffc0=function(_0x269a9c){while(--_0x269a9c){_0xd22dc7['push'](_0xd22dc7['shift']());}};_0xd4ffc0(++_0x5a87c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5df445,_0x3d96e2){_0x5df445=_0x5df445-0x0;var _0x4f76b5=_0xb10b[_0x5df445];return _0x4f76b5;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 48beee0..af1efcc 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 _0x20d4=['message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','name','dialTimezone','isNil','Interval','Intervals','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','waiting','DISACTIVED','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds'];(function(_0x4c7a00,_0x21936b){var _0x426c3b=function(_0x40f6a2){while(--_0x40f6a2){_0x4c7a00['push'](_0x4c7a00['shift']());}};_0x426c3b(++_0x21936b);}(_0x20d4,0x1b3));var _0x420d=function(_0x34a122,_0x40c3b2){_0x34a122=_0x34a122-0x0;var _0x4ac752=_0x20d4[_0x34a122];return _0x4ac752;};'use strict';var _=require(_0x420d('0x0'));var moment=require(_0x420d('0x1'));var util=require(_0x420d('0x2'));var logger=require('../../../../config/logger')(_0x420d('0x3'));var timezones=require(_0x420d('0x4'))[_0x420d('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x420d('0x6'),'BLACKLIST':_0x420d('0x7'),'CONTACTS_RESCHEDULED':_0x420d('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x420d('0x9'),'EMPTY_INTERVAL':_0x420d('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x420d('0xb'),'NO_AVAILABLE_CONTACTS':_0x420d('0xc'),'NULL_INTERVAL':_0x420d('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x420d('0xe'),'QUEUE_RECALL':_0x420d('0xf'),'RECALL_TIMEOUT':_0x420d('0x10'),'RUNNING':_0x420d('0x11'),'UNKNOWN_TIMEZONE':_0x420d('0x12'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x420d('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x39c8b2){return _0x39c8b2[_0x420d('0x14')]===_0x420d('0x15');}exports[_0x420d('0x16')]=isPreviewCampaign;function isIVRCampaign(_0xd27e8a){return _0xd27e8a[_0x420d('0x17')]==='ivr';}exports[_0x420d('0x18')]=isIVRCampaign;function isOutboundQueue(_0x9ccd32){return _0x9ccd32[_0x420d('0x17')]===_0x420d('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x55a9cf){return _0x55a9cf[_0x420d('0x1a')];}exports[_0x420d('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x389b38){return _0x389b38[_0x420d('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x481dbc,_0x3e1317){var _0xf426f6=moment(_0x481dbc)[_0x420d('0x1d')](0x0);var _0x2816c6=moment(_0x3e1317)[_0x420d('0x1d')](0x0);return _0xf426f6[_0x420d('0x1e')](_0x2816c6,_0x420d('0x1f'));}exports[_0x420d('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0xc5f02a,_0x467717){var _0x53376b=![];var _0x3c50de=_0xc5f02a[_0x420d('0x14')]!==_0x467717[_0x420d('0x14')]||_0xc5f02a['dialActive']!==_0x467717['dialActive']||_0xc5f02a[_0x420d('0x21')]!==_0x467717[_0x420d('0x21')];var _0x24ded1=_0xc5f02a[_0x420d('0x22')]!==_0x467717[_0x420d('0x22')]||_0xc5f02a[_0x420d('0x23')]!==_0x467717[_0x420d('0x23')]||_0xc5f02a['loggedInDb']!==_0x467717[_0x420d('0x24')]||_0xc5f02a[_0x420d('0x25')]!==_0x467717[_0x420d('0x25')]||_0xc5f02a[_0x420d('0x26')]!==_0x467717['talking']||_0xc5f02a[_0x420d('0x27')]!==_0x467717['pTalking']||_0xc5f02a['waiting']!==_0x467717['waiting']||_0xc5f02a[_0x420d('0x28')]!==_0x467717[_0x420d('0x28')]||_0xc5f02a[_0x420d('0x29')]!==_0x467717[_0x420d('0x29')];if(_0xc5f02a[_0x420d('0x2a')]&&_0x467717[_0x420d('0x2a')]){_0x53376b=_0xc5f02a['Trunk'][_0x420d('0x2b')]!==_0x467717[_0x420d('0x2a')][_0x420d('0x2b')]||_0xc5f02a['Trunk'][_0x420d('0x1c')]!==_0x467717['Trunk']['active'];}return _0x3c50de||_0x24ded1||_0x53376b;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3b2e6b){var _0x2034d7=null;var _0x417a27=_0x3b2e6b[_0x420d('0x2c')];if(_[_0x420d('0x2d')](_0x3b2e6b['dialGlobalInterval'])||_[_0x420d('0x2d')](_0x3b2e6b[_0x420d('0x2e')])||_['isNil'](_0x3b2e6b[_0x420d('0x2e')][_0x420d('0x2f')])){_0x2034d7=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x420d('0x30')](_0x3b2e6b[_0x420d('0x31')])||_[_0x420d('0x30')](_0x3b2e6b[_0x420d('0x2e')][_0x420d('0x2f')])){_0x2034d7=CAMPAIGN_STATUS[_0x420d('0x32')];}else if(_0x417a27&&!timezones[_0x417a27]){_0x2034d7=CAMPAIGN_STATUS[_0x420d('0x33')];}return _0x2034d7;}function checkAnyValidTrunk(_0x13c284,_0x2d2081){var _0xa0b673=null;var _0x59ae42=_0x420d('0x34');var _0x34ccc3=[_0x420d('0x35'),_0x420d('0x36')];var _0x3c0764=!![];if(_0x13c284[_0x420d('0x2a')]&&_0x13c284[_0x420d('0x2a')]['active']){_0x59ae42+=_0x13c284[_0x420d('0x2a')][_0x420d('0x2b')];_0xa0b673=_0x2d2081[_0x59ae42];_0x3c0764=_0x34ccc3[_0x420d('0x37')](_0xa0b673[_0x420d('0x38')]);}else if(_0x13c284[_0x420d('0x39')]&&_0x13c284[_0x420d('0x39')]['active']){_0x59ae42+=_0x13c284[_0x420d('0x39')][_0x420d('0x2b')];_0xa0b673=_0x2d2081[_0x59ae42];_0x3c0764=_0x34ccc3[_0x420d('0x37')](_0xa0b673['status']);}return _0x3c0764;}function getQueueCampaignStatusMessage(_0x4023d9,_0x5d1492){var _0x23919e=CAMPAIGN_STATUS[_0x420d('0x6')];var _0x4d7296=isPreviewCampaign(_0x4023d9);if(!isQueueCampaignActive(_0x4023d9)){if(_0x4d7296){_0x23919e=CAMPAIGN_STATUS[_0x420d('0x3a')];}else{if(_0x4023d9['originated']===0x0&&_0x4023d9['talking']===0x0&&_0x4023d9[_0x420d('0x3b')]===0x0&&(_0x4023d9['pTalking']||0x0)===0x0){_0x23919e=CAMPAIGN_STATUS['INACTIVE'];}else{_0x23919e=CAMPAIGN_STATUS[_0x420d('0x3c')];}}}else if(_0x4023d9[_0x420d('0x23')]===0x0){_0x23919e=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x4023d9,_0x5d1492)){_0x23919e=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x4023d9)){var _0x3da42f=checkAnyValidQueueCampaignInterval(_0x4023d9);if(_0x3da42f){_0x23919e=_0x3da42f;}}return _0x23919e;}exports[_0x420d('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x9bc973){var _0x511eb9=CAMPAIGN_STATUS[_0x420d('0x3c')];if(_0x9bc973['originated']===0x0&&_0x9bc973[_0x420d('0x26')]===0x0&&_0x9bc973['waiting']===0x0&&(_0x9bc973[_0x420d('0x27')]||0x0)===0x0){_0x511eb9=CAMPAIGN_STATUS[_0x420d('0x3a')];}return _0x511eb9;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x11de18){var _0x5bc2c9=_0x11de18[_0x420d('0x3e')](/"(.*?)"/);return _0x5bc2c9?_0x5bc2c9[0x1]:_0x11de18;}exports[_0x420d('0x3f')]=extractCalleridName;function getCallerId(_0x4bcb62,_0x463189,_0x2adf29){if(!_[_0x420d('0x40')](_0x2adf29)&&typeof _0x2adf29===_0x420d('0x41')&&!_[_0x420d('0x30')](_0x2adf29)){if(!_[_0x420d('0x40')](_0x463189)&&typeof _0x463189===_0x420d('0x41')&&!_['isEmpty'](_0x463189)){return util['format'](_0x420d('0x42'),_0x463189,_0x2adf29);}return util[_0x420d('0x43')](_0x420d('0x42'),_0x2adf29,_0x2adf29);}if(!_[_0x420d('0x40')](_0x4bcb62)&&typeof _0x4bcb62===_0x420d('0x41')&&!_[_0x420d('0x30')](_0x4bcb62)){return _0x4bcb62;}return _0x420d('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x44076d,_0x3888a0){var _0x4f6a34;var _0x4578ec;var _0xaf32ea;if(_0x3888a0<=0x0){_0x3888a0=0x1;}_0x4f6a34=new RegExp(_0x420d('0x45')+_0x3888a0+'}$');_0x4578ec=Math[_0x420d('0x46')](0xa,_0x3888a0-0x1);_0xaf32ea=Math[_0x420d('0x46')](0xa,_0x3888a0)-0x1;return util[_0x420d('0x43')]('%s',_[_0x420d('0x47')](_0x44076d,_0x4f6a34,_[_0x420d('0x48')](_0x4578ec,_0xaf32ea)['toString']()));}exports[_0x420d('0x49')]=getCallerIdRandom;function decrementOriginate(_0x168dc4){if(_0x168dc4[_0x420d('0x29')]&&_0x168dc4[_0x420d('0x29')]>0x0){_0x168dc4[_0x420d('0x29')]-=0x1;}else{logger['error'](_0x420d('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x3ad658){return _0x3ad658&&_0x3ad658[_0x420d('0x4b')]>0x0;}exports[_0x420d('0x4c')]=checkContactEmpty;function erlangb(_0xf6e933,_0x100f5e){if(_0x100f5e===0x0){return 0x0;}var _0x108228=0x1;for(var _0x139e38=0x1;_0x139e38<=_0x100f5e;_0x139e38+=0x1){_0x108228=0x1+_0x108228*_0x139e38/_0xf6e933;}return 0x1/_0x108228;}exports[_0x420d('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x84243f,_0x5b6a4e,_0x51dc07){if(_0x5b6a4e>_0x51dc07){for(var _0x7668b1=0x0;_0x7668b1<_0x5b6a4e-_0x51dc07;_0x7668b1+=0x1){decrementOriginate(_0x84243f);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x3643=['paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','ACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','INACTIVE','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x5cw{0,','pow','replace','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','checkContactLowerLimitOriginate','moment','util','dialer','timezones','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb'];(function(_0x21e654,_0x5e5ebc){var _0x4cef36=function(_0x326e76){while(--_0x326e76){_0x21e654['push'](_0x21e654['shift']());}};_0x4cef36(++_0x5e5ebc);}(_0x3643,0x1c6));var _0x3364=function(_0x5e905e,_0x16c65c){_0x5e905e=_0x5e905e-0x0;var _0x3e486b=_0x3643[_0x5e905e];return _0x3e486b;};'use strict';var _=require('lodash');var moment=require(_0x3364('0x0'));var util=require(_0x3364('0x1'));var logger=require('../../../../config/logger')(_0x3364('0x2'));var timezones=require('../../../../config/environment/shared')[_0x3364('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x3364('0x4'),'CONTACTS_RESCHEDULED':_0x3364('0x5'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x3364('0x6'),'EMPTY_INTERVAL':_0x3364('0x7'),'INACTIVE':_0x3364('0x8'),'NO_AGENTS_LOGGED':_0x3364('0x9'),'NO_AVAILABLE_CONTACTS':_0x3364('0xa'),'NULL_INTERVAL':_0x3364('0xb'),'OVERTIME_INTERVAL':_0x3364('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x3364('0xd'),'QUEUE_RECALL':_0x3364('0xe'),'RECALL_TIMEOUT':_0x3364('0xf'),'RUNNING':_0x3364('0x10'),'UNKNOWN_TIMEZONE':_0x3364('0x11'),'UNREACHABLE_TRUNK':_0x3364('0x12')};exports[_0x3364('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x147fee){return _0x147fee[_0x3364('0x14')]===_0x3364('0x15');}exports[_0x3364('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x2312cc){return _0x2312cc[_0x3364('0x17')]===_0x3364('0x18');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x37d7ed){return _0x37d7ed[_0x3364('0x17')]==='outbound';}exports[_0x3364('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x4cb488){return _0x4cb488[_0x3364('0x1a')];}exports[_0x3364('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x126acc){return _0x126acc[_0x3364('0x1c')];}exports[_0x3364('0x1d')]=isIVRCampaignActive;function getSeconds(_0x8ddbe1,_0x52f87b){var _0x29f4b4=moment(_0x8ddbe1)[_0x3364('0x1e')](0x0);var _0x104c44=moment(_0x52f87b)[_0x3364('0x1e')](0x0);return _0x29f4b4[_0x3364('0x1f')](_0x104c44,_0x3364('0x20'));}exports[_0x3364('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x4596ba,_0x2ac4ba){var _0x4a447f=![];var _0x134b41=_0x4596ba[_0x3364('0x14')]!==_0x2ac4ba[_0x3364('0x14')]||_0x4596ba[_0x3364('0x1a')]!==_0x2ac4ba[_0x3364('0x1a')]||_0x4596ba['message']!==_0x2ac4ba[_0x3364('0x22')];var _0x33a191=_0x4596ba[_0x3364('0x23')]!==_0x2ac4ba[_0x3364('0x23')]||_0x4596ba['loggedIn']!==_0x2ac4ba[_0x3364('0x24')]||_0x4596ba[_0x3364('0x25')]!==_0x2ac4ba[_0x3364('0x25')]||_0x4596ba[_0x3364('0x26')]!==_0x2ac4ba['paused']||_0x4596ba[_0x3364('0x27')]!==_0x2ac4ba[_0x3364('0x27')]||_0x4596ba['pTalking']!==_0x2ac4ba[_0x3364('0x28')]||_0x4596ba[_0x3364('0x29')]!==_0x2ac4ba[_0x3364('0x29')]||_0x4596ba[_0x3364('0x2a')]!==_0x2ac4ba[_0x3364('0x2a')]||_0x4596ba[_0x3364('0x2b')]!==_0x2ac4ba[_0x3364('0x2b')];if(_0x4596ba[_0x3364('0x2c')]&&_0x2ac4ba[_0x3364('0x2c')]){_0x4a447f=_0x4596ba[_0x3364('0x2c')][_0x3364('0x2d')]!==_0x2ac4ba[_0x3364('0x2c')][_0x3364('0x2d')]||_0x4596ba['Trunk']['active']!==_0x2ac4ba[_0x3364('0x2c')][_0x3364('0x1c')];}return _0x134b41||_0x33a191||_0x4a447f;}exports[_0x3364('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x486e9e){var _0x26c753=null;var _0x3a3ca3=_0x486e9e[_0x3364('0x2f')];if(_[_0x3364('0x30')](_0x486e9e['dialGlobalInterval'])||_['isNil'](_0x486e9e[_0x3364('0x31')])||_[_0x3364('0x30')](_0x486e9e[_0x3364('0x31')][_0x3364('0x32')])){_0x26c753=CAMPAIGN_STATUS[_0x3364('0x33')];}else if(_[_0x3364('0x34')](_0x486e9e['dialGlobalInterval'])||_[_0x3364('0x34')](_0x486e9e['Interval'][_0x3364('0x32')])){_0x26c753=CAMPAIGN_STATUS[_0x3364('0x35')];}else if(_0x3a3ca3&&!timezones[_0x3a3ca3]){_0x26c753=CAMPAIGN_STATUS[_0x3364('0x36')];}return _0x26c753;}function checkAnyValidTrunk(_0x35a2cc,_0x4f3f6a){var _0x3b9233=null;var _0x376287=_0x3364('0x37');var _0x489a66=[_0x3364('0x38'),_0x3364('0x39')];var _0x39da48=!![];if(_0x35a2cc[_0x3364('0x2c')]&&_0x35a2cc[_0x3364('0x2c')][_0x3364('0x1c')]){_0x376287+=_0x35a2cc['Trunk'][_0x3364('0x2d')];_0x3b9233=_0x4f3f6a[_0x376287];_0x39da48=_0x489a66['includes'](_0x3b9233[_0x3364('0x3a')]);}else if(_0x35a2cc['TrunkBackup']&&_0x35a2cc[_0x3364('0x3b')][_0x3364('0x1c')]){_0x376287+=_0x35a2cc[_0x3364('0x3b')][_0x3364('0x2d')];_0x3b9233=_0x4f3f6a[_0x376287];_0x39da48=_0x489a66[_0x3364('0x3c')](_0x3b9233['status']);}return _0x39da48;}function getQueueCampaignStatusMessage(_0x2e2d77,_0x22aed8){var _0x4cb537=CAMPAIGN_STATUS[_0x3364('0x3d')];var _0x201559=isPreviewCampaign(_0x2e2d77);if(!isQueueCampaignActive(_0x2e2d77)){if(_0x201559){_0x4cb537=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2e2d77[_0x3364('0x2b')]===0x0&&_0x2e2d77[_0x3364('0x27')]===0x0&&_0x2e2d77['waiting']===0x0&&(_0x2e2d77['pTalking']||0x0)===0x0){_0x4cb537=CAMPAIGN_STATUS['INACTIVE'];}else{_0x4cb537=CAMPAIGN_STATUS[_0x3364('0x3e')];}}}else if(_0x2e2d77[_0x3364('0x24')]===0x0){_0x4cb537=CAMPAIGN_STATUS[_0x3364('0x3f')];}else if(!checkAnyValidTrunk(_0x2e2d77,_0x22aed8)){_0x4cb537=CAMPAIGN_STATUS[_0x3364('0x40')];}else if(!isPreviewCampaign(_0x2e2d77)){var _0xed3d68=checkAnyValidQueueCampaignInterval(_0x2e2d77);if(_0xed3d68){_0x4cb537=_0xed3d68;}}return _0x4cb537;}exports[_0x3364('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4fa58b){var _0xa93b73=CAMPAIGN_STATUS['DISACTIVED'];if(_0x4fa58b[_0x3364('0x2b')]===0x0&&_0x4fa58b[_0x3364('0x27')]===0x0&&_0x4fa58b[_0x3364('0x29')]===0x0&&(_0x4fa58b[_0x3364('0x28')]||0x0)===0x0){_0xa93b73=CAMPAIGN_STATUS[_0x3364('0x42')];}return _0xa93b73;}exports[_0x3364('0x43')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x37ea78){var _0x283df0=_0x37ea78['match'](/"(.*?)"/);return _0x283df0?_0x283df0[0x1]:_0x37ea78;}exports[_0x3364('0x44')]=extractCalleridName;function getCallerId(_0x2d2a1f,_0x590c7d,_0x11b207){if(!_[_0x3364('0x45')](_0x11b207)&&typeof _0x11b207===_0x3364('0x46')&&!_[_0x3364('0x34')](_0x11b207)){if(!_[_0x3364('0x45')](_0x590c7d)&&typeof _0x590c7d===_0x3364('0x46')&&!_[_0x3364('0x34')](_0x590c7d)){return util['format'](_0x3364('0x47'),_0x590c7d,_0x11b207);}return util[_0x3364('0x48')](_0x3364('0x47'),_0x11b207,_0x11b207);}if(!_[_0x3364('0x45')](_0x2d2a1f)&&typeof _0x2d2a1f===_0x3364('0x46')&&!_[_0x3364('0x34')](_0x2d2a1f)){return _0x2d2a1f;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x50fa7f,_0x6a7c9b){var _0x1dc1e6;var _0x26b52c;var _0x36313f;if(_0x6a7c9b<=0x0){_0x6a7c9b=0x1;}_0x1dc1e6=new RegExp(_0x3364('0x49')+_0x6a7c9b+'}$');_0x26b52c=Math[_0x3364('0x4a')](0xa,_0x6a7c9b-0x1);_0x36313f=Math[_0x3364('0x4a')](0xa,_0x6a7c9b)-0x1;return util[_0x3364('0x48')]('%s',_[_0x3364('0x4b')](_0x50fa7f,_0x1dc1e6,_['random'](_0x26b52c,_0x36313f)[_0x3364('0x4c')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x31e891){if(_0x31e891[_0x3364('0x2b')]&&_0x31e891[_0x3364('0x2b')]>0x0){_0x31e891[_0x3364('0x2b')]-=0x1;}else{logger[_0x3364('0x4d')](_0x3364('0x4e'));}}exports[_0x3364('0x4f')]=decrementOriginate;function checkContactEmpty(_0x47e67e){return _0x47e67e&&_0x47e67e['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x2acaaa,_0x191f36){if(_0x191f36===0x0){return 0x0;}var _0x2fcb7e=0x1;for(var _0x5d467b=0x1;_0x5d467b<=_0x191f36;_0x5d467b+=0x1){_0x2fcb7e=0x1+_0x2fcb7e*_0x5d467b/_0x2acaaa;}return 0x1/_0x2fcb7e;}exports[_0x3364('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x2785ee,_0x1c0f27,_0x5ccd79){if(_0x1c0f27>_0x5ccd79){for(var _0x27bac8=0x0;_0x27bac8<_0x1c0f27-_0x5ccd79;_0x27bac8+=0x1){decrementOriginate(_0x2785ee);}}}exports[_0x3364('0x51')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4f317e1..56a1b67 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(_0x43412b,_0x53e4c6){var _0x4937f5=function(_0x2e65f4){while(--_0x2e65f4){_0x43412b['push'](_0x43412b['shift']());}};_0x4937f5(++_0x53e4c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x4a1e5f,_0xc13b47){var _0x1a7146=function(_0x2d91c2){while(--_0x2d91c2){_0x4a1e5f['push'](_0x4a1e5f['shift']());}};_0x1a7146(++_0xc13b47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 dea3839..07a81d2 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 _0x867d=['hasOwnProperty','channels','channel','uniqueid','info','\x20syncNewchannel\x20','actions','prototype','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','name','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','syncOriginateResponse','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','active','format','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','syncNewchannel','bind','varset','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','context'];(function(_0xfbebb4,_0x334905){var _0x3d461c=function(_0x5b432c){while(--_0x5b432c){_0xfbebb4['push'](_0xfbebb4['shift']());}};_0x3d461c(++_0x334905);}(_0x867d,0xca));var _0xd867=function(_0x203d83,_0x3b4da7){_0x203d83=_0x203d83-0x0;var _0x1a6a2a=_0x867d[_0x203d83];return _0x1a6a2a;};'use strict';var util=require(_0xd867('0x0'));var _=require(_0xd867('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd867('0x2'));var moment=require(_0xd867('0x3'));var path=require(_0xd867('0x4'));var tiff2pdf=require(_0xd867('0x5'));var gs=require(_0xd867('0x6'));var logger=require('../../../config/logger')(_0xd867('0x7'));var ami=require(_0xd867('0x8'));var rpcDb=require(_0xd867('0x9'));var Channel=require(_0xd867('0xa'));var ut=require(_0xd867('0xb'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd867('0xc'));var faxMessage=require(_0xd867('0xd'));function Fax(_0x3dfb14){this['channels']={};this[_0xd867('0xe')]=_0x3dfb14[_0xd867('0xe')];this[_0xd867('0xf')]=_0x3dfb14[_0xd867('0xf')];this['actions']={};ami['on']('newchannel',this[_0xd867('0x10')][_0xd867('0x11')](this));ami['on'](_0xd867('0x12'),this['syncVarSet'][_0xd867('0x11')](this));ami['on'](_0xd867('0x13'),this['syncNewState']['bind'](this));ami['on']('newexten',this[_0xd867('0x14')][_0xd867('0x11')](this));ami['on'](_0xd867('0x15'),this[_0xd867('0x16')]['bind'](this));ami['on'](_0xd867('0x17'),this[_0xd867('0x18')][_0xd867('0x11')](this));ami['on'](_0xd867('0x19'),this[_0xd867('0x1a')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xd867('0x11')](this));}Fax['prototype'][_0xd867('0x10')]=function(_0x4e95d1){if(_0x4e95d1[_0xd867('0x1b')]==='from-voip-provider'){for(var _0x10690e in this[_0xd867('0xe')]){if(this[_0xd867('0xe')][_0xd867('0x1c')](_0x10690e)){if(_0x4e95d1['exten']===this[_0xd867('0xe')][_0x10690e]['localstationid']){this[_0xd867('0x1d')][_0x4e95d1['uniqueid']]={};this[_0xd867('0x1d')][_0x4e95d1['uniqueid']]['channel']=_0x4e95d1[_0xd867('0x1e')];this['channels'][_0x4e95d1[_0xd867('0x1f')]]['id']=this[_0xd867('0xe')][_0x10690e]['id'];this[_0xd867('0x1d')][_0x4e95d1['uniqueid']]['name']=this[_0xd867('0xe')][_0x10690e]['name'];logger[_0xd867('0x20')](_0x4e95d1[_0xd867('0x1f')],_0xd867('0x21'));}}}}if(this[_0xd867('0x22')][_0x4e95d1[_0xd867('0x1f')]]){this[_0xd867('0x1d')][_0x4e95d1[_0xd867('0x1f')]]={};this[_0xd867('0x1d')][_0x4e95d1[_0xd867('0x1f')]]['channel']=_0x4e95d1[_0xd867('0x1e')];logger[_0xd867('0x20')](_0x4e95d1[_0xd867('0x1f')],_0xd867('0x21'));}};Fax[_0xd867('0x23')][_0xd867('0x24')]=function(_0x2b49cb){if(this['channels'][_0x2b49cb[_0xd867('0x1f')]]){for(var _0x1c6730 in _0x2b49cb[_0xd867('0x25')]){if(_0x2b49cb[_0xd867('0x25')]['hasOwnProperty'](_0x1c6730)){this[_0xd867('0x1d')][_0x2b49cb[_0xd867('0x1f')]][_0x1c6730]=_0x2b49cb[_0xd867('0x26')];}}}};Fax[_0xd867('0x23')][_0xd867('0x27')]=function(_0x49a407){if(this[_0xd867('0x1d')][_0x49a407[_0xd867('0x1f')]]){this[_0xd867('0x1d')][_0x49a407[_0xd867('0x1f')]][_0xd867('0x28')]=_0x49a407[_0xd867('0x28')];this['channels'][_0x49a407['uniqueid']][_0xd867('0x29')]=_0x49a407['channelstatedesc'];}};Fax[_0xd867('0x23')][_0xd867('0x14')]=function(_0x42044e){if(this[_0xd867('0x1d')][_0x42044e['uniqueid']]){for(var _0x1bf792 in _0x42044e[_0xd867('0x25')]){if(_0x42044e[_0xd867('0x25')]['hasOwnProperty'](_0x1bf792)){this[_0xd867('0x1d')][_0x42044e[_0xd867('0x1f')]][_0x1bf792]=_0x42044e[_0xd867('0x26')];}}}};Fax[_0xd867('0x23')][_0xd867('0x16')]=function(_0x1e8b70){if(this['channels'][_0x1e8b70[_0xd867('0x1f')]]){this['channels'][_0x1e8b70[_0xd867('0x1f')]][_0xd867('0x2a')]=_0x1e8b70[_0xd867('0x2a')];this[_0xd867('0x1d')][_0x1e8b70[_0xd867('0x1f')]][_0xd867('0x2b')]=_0x1e8b70['status'];this[_0xd867('0x1d')][_0x1e8b70[_0xd867('0x1f')]][_0xd867('0x2c')]=_0x1e8b70['localstationid'];this[_0xd867('0x1d')][_0x1e8b70[_0xd867('0x1f')]][_0xd867('0x2d')]=_0x1e8b70[_0xd867('0x2d')];logger[_0xd867('0x20')](_0x1e8b70[_0xd867('0x1f')],'\x20syncFaxStatus\x20');}};Fax[_0xd867('0x23')][_0xd867('0x18')]=function(_0xa9c287){var _0x5df1d9=this;if(this[_0xd867('0x1d')][_0xa9c287[_0xd867('0x1f')]]){var _0x5bcb00=this[_0xd867('0x1d')][_0xa9c287[_0xd867('0x1f')]]['id'];this[_0xd867('0x1d')][_0xa9c287['uniqueid']][_0xd867('0x2e')]=_0xa9c287[_0xd867('0x2e')];this[_0xd867('0x1d')][_0xa9c287[_0xd867('0x1f')]][_0xd867('0x2f')]=_0xa9c287[_0xd867('0x2f')];this['channels'][_0xa9c287['uniqueid']][_0xd867('0x2c')]=_0xa9c287[_0xd867('0x2c')];this[_0xd867('0x1d')][_0xa9c287[_0xd867('0x1f')]][_0xd867('0x30')]=_0xa9c287[_0xd867('0x30')];this['channels'][_0xa9c287[_0xd867('0x1f')]]['transferrate']=_0xa9c287['transferrate'];this['channels'][_0xa9c287[_0xd867('0x1f')]][_0xd867('0x2d')]=_0xa9c287['filename'];this[_0xd867('0x1d')][_0xa9c287[_0xd867('0x1f')]][_0xd867('0x31')]=_0xa9c287[_0xd867('0x31')];if(this[_0xd867('0x1d')][_0xa9c287['uniqueid']][_0xd867('0x2f')]>0x0){tiff2pdf(_0xa9c287[_0xd867('0x2d')],_0xd867('0x32'),function(_0x538c28){logger[_0xd867('0x20')](_0xa9c287[_0xd867('0x1f')],'\x20result\x20conversion\x20file\x20',_0x538c28[_0xd867('0x33')]);attachment[_0xd867('0x34')]({'name':path[_0xd867('0x35')](_0xa9c287[_0xd867('0x2d')])[_0xd867('0x36')],'basename':path[_0xd867('0x35')](_0xa9c287[_0xd867('0x2d')])[_0xd867('0x36')]+_0xd867('0x37'),'type':_0xd867('0x38')})[_0xd867('0x39')](function(_0x11d276){faxAccount[_0xd867('0x3a')](_0x5bcb00,{'from':_0xa9c287[_0xd867('0x31')],'mapKey':_0xd867('0x7'),'body':path[_0xd867('0x35')](_0xa9c287[_0xd867('0x2d')])[_0xd867('0x36')]+'.pdf','AttachmentId':_0x11d276['id']})[_0xd867('0x3b')](function(_0x44625e){logger[_0xd867('0x3c')](_0xa9c287['uniqueid'],_0xd867('0x3d'),JSON[_0xd867('0x3e')](_0x44625e));});})[_0xd867('0x3b')](function(_0x72b061){logger[_0xd867('0x3c')](_0xa9c287[_0xd867('0x1f')],'\x20receiveFax\x20',JSON['stringify'](_0x72b061));});});}logger['info'](_0xa9c287['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0xd867('0x3f')]=function(_0x22940a){if(this[_0xd867('0x22')][_0x22940a[_0xd867('0x1f')]]){_[_0xd867('0x40')](this[_0xd867('0x1d')][_0x22940a[_0xd867('0x1f')]],_[_0xd867('0x41')](_0x22940a,[_0xd867('0x42'),'reason']));}};function updateStatus(_0x3f9667){if(_0x3f9667[_0xd867('0x43')]){faxMessage[_0xd867('0x44')](_0x3f9667[_0xd867('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd867('0x39')](function(_0xe49c60){ut[_0xd867('0x45')](_0xd867('0x46'),_0xe49c60);})[_0xd867('0x3b')](function(_0x452277){ut[_0xd867('0x45')](_0xd867('0x47'),_0x452277);});}else{ut[_0xd867('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd867('0x23')]['updateStatus']=function(_0x31b945,_0x59b153,_0x13f77b){var _0x6b6a44=this;var _0x51c7b9={};if(_0x59b153){_0x51c7b9={'read':_0x59b153};}else{_0x51c7b9={'failMessage':_0x13f77b};}if(this[_0xd867('0x22')][_0x31b945]['AttachmentId']){faxMessage[_0xd867('0x44')](this['actions'][_0x31b945][_0xd867('0x43')],_0x51c7b9)[_0xd867('0x39')](function(_0x261cf3){ut['logger'](_0xd867('0x48'),_0x261cf3);})[_0xd867('0x3b')](function(_0x1cd8d5){ut[_0xd867('0x45')](_0xd867('0x49'),_0x1cd8d5);})[_0xd867('0x4a')](function(){delete _0x6b6a44[_0xd867('0x1d')][_0x31b945];delete _0x6b6a44[_0xd867('0x22')][_0x31b945];});}else{ut[_0xd867('0x45')](_0xd867('0x4b'));delete this[_0xd867('0x1d')][_0x31b945];delete this[_0xd867('0x22')][_0x31b945];}};Fax[_0xd867('0x23')][_0xd867('0x1a')]=function(_0x32fe7a){var _0x2a5fb1=this;if(this[_0xd867('0x1d')][_0x32fe7a[_0xd867('0x1f')]]){if(this[_0xd867('0x22')][_0x32fe7a[_0xd867('0x1f')]]){this[_0xd867('0x1d')][_0x32fe7a[_0xd867('0x1f')]]['id']=this[_0xd867('0x22')][_0x32fe7a[_0xd867('0x1f')]]['id'];this['channels'][_0x32fe7a[_0xd867('0x1f')]]['name']=this[_0xd867('0x22')][_0x32fe7a[_0xd867('0x1f')]][_0xd867('0x36')];}logger[_0xd867('0x20')](_0x32fe7a[_0xd867('0x1f')],this[_0xd867('0x22')][_0x32fe7a['uniqueid']]?_0xd867('0x4c'):_0xd867('0x4d'),JSON[_0xd867('0x3e')](this[_0xd867('0x1d')][_0x32fe7a[_0xd867('0x1f')]]));if(this[_0xd867('0x22')][_0x32fe7a[_0xd867('0x1f')]]){if(this['channels'][_0x32fe7a[_0xd867('0x1f')]]['faxpages']>0x0&&this[_0xd867('0x1d')][_0x32fe7a[_0xd867('0x1f')]]['faxstatus']===_0xd867('0x4e')){this[_0xd867('0x4f')](_0x32fe7a[_0xd867('0x1f')],!![]);}else{this[_0xd867('0x4f')](_0x32fe7a[_0xd867('0x1f')],![],this['channels'][_0x32fe7a[_0xd867('0x1f')]][_0xd867('0x50')]?'SENDING\x20FAILED:\x20'+this[_0xd867('0x1d')][_0x32fe7a[_0xd867('0x1f')]][_0xd867('0x50')]:_0xd867('0x51'));}}}};Fax[_0xd867('0x23')]['send']=function(_0xdefddb){var _0x5c145d=this;return new BPromise(function(_0x7c0c57,_0x5e6eed){_0x5c145d[_0xd867('0x52')](_0xdefddb,_0x5c145d['faxAccounts'][_0xdefddb['FaxAccountId']])[_0xd867('0x39')](function(_0x2bf202){ut['logger'](_0xd867('0x53'),_0x2bf202);_0x7c0c57(ut[_0xd867('0x33')](_0xd867('0x54')));})[_0xd867('0x3b')](function(_0x1aea7c){ut[_0xd867('0x45')](_0xd867('0x55'),_0x1aea7c);updateStatus(_0xdefddb);_0x5e6eed(ut[_0xd867('0x33')](_0xd867('0x56')));});});};Fax[_0xd867('0x23')][_0xd867('0x57')]=function(_0xcccdee){var _0x27f678=this;return new BPromise(function(_0x1d1067,_0x1bf56a){var _0x43938a=_0x27f678[_0xd867('0x58')](_0x27f678[_0xd867('0xe')][_0xcccdee[_0xd867('0x59')]][_0xd867('0x5a')],_0xcccdee);if(_0x43938a[_0xd867('0x5b')]){_0x1d1067(ut[_0xd867('0x33')](_0xd867('0x5c')));}else{_0x1bf56a(ut[_0xd867('0x33')](_0x43938a[_0xd867('0x33')]));}});};function originate(_0x5bada9,_0x1e44bc,_0x5dc196){return new BPromise(function(_0x1fc157,_0x5e3e55){if(_0x5dc196){var _0x487f58=util['format'](_0xd867('0x5d'),path['parse'](_0x5bada9['path'])[_0xd867('0x36')],_0x5bada9[_0xd867('0x4')]);gs['execute'](_0x487f58)[_0xd867('0x39')](function(){_0x5bada9[_0xd867('0x4')]=util['format'](_0xd867('0x5e'),path[_0xd867('0x35')](_0x5bada9[_0xd867('0x4')])['dir'],path[_0xd867('0x35')](_0x5bada9[_0xd867('0x4')])[_0xd867('0x36')]);_0x1e44bc[_0xd867('0x5f')]=_0x5bada9[_0xd867('0x4')];ut[_0xd867('0x45')](_0xd867('0x60'),'');ami['Action'](ut[_0xd867('0x61')](_0x5bada9,_0x1e44bc))[_0xd867('0x39')](function(_0x3b9523){_0x1fc157(_0x3b9523);})[_0xd867('0x3b')](function(_0x1221eb){_0x5e3e55(_0x1221eb);});})[_0xd867('0x3b')](function(_0x2dabc3){_0x5e3e55(_0x2dabc3);});}else{ami[_0xd867('0x62')](ut[_0xd867('0x61')](_0x5bada9,_0x1e44bc))['then'](function(_0x15c54f){_0x1fc157(_0x15c54f);})['catch'](function(_0x115196){_0x5e3e55(_0x115196);});}});}Fax[_0xd867('0x23')][_0xd867('0x52')]=function(_0x1af33f,_0x40d1fc){var _0x3fb38c=this;return new BPromise(function(_0x5de146,_0x22699e){var _0x1e358c=uuid['v4']();var _0x1cc712=ut[_0xd867('0x63')](_0x1af33f,_0x40d1fc);_0x3fb38c['actions'][_0x1e358c]=new Action(_0x1e358c,_0x40d1fc,_0x1af33f);var _0x56c85e=_0x3fb38c['actions'][_0x1e358c];if(path['parse'](_0x1af33f[_0xd867('0x4')])[_0xd867('0x64')]===_0xd867('0x37')){originate(_0x56c85e,_0x1cc712,!![])[_0xd867('0x39')](function(_0x166afa){_0x5de146(_0x166afa);})['catch'](function(_0x231176){_0x22699e(_0x231176);});}else{originate(_0x56c85e,_0x1cc712,![])['then'](function(_0x50c5dc){_0x5de146(_0x50c5dc);})[_0xd867('0x3b')](function(_0x598c2b){_0x22699e(_0x598c2b);});}});};Fax[_0xd867('0x23')]['isTrunkReachable']=function(_0x33d0cc){return!_['isNil'](_0x33d0cc)&&!_[_0xd867('0x65')](_0x33d0cc[_0xd867('0x36')])&&!_[_0xd867('0x65')](_0x33d0cc[_0xd867('0x66')])&&_0x33d0cc[_0xd867('0x66')]&&!_[_0xd867('0x65')](this[_0xd867('0xf')][util[_0xd867('0x67')](_0xd867('0x68'),_0x33d0cc['name'])])&&!_[_0xd867('0x65')](this['trunks'][util[_0xd867('0x67')](_0xd867('0x68'),_0x33d0cc[_0xd867('0x36')])][_0xd867('0x2b')])&&(this[_0xd867('0xf')][util[_0xd867('0x67')](_0xd867('0x68'),_0x33d0cc[_0xd867('0x36')])]['status']===_0xd867('0x69')||this[_0xd867('0xf')][util['format'](_0xd867('0x68'),_0x33d0cc[_0xd867('0x36')])][_0xd867('0x2b')]===_0xd867('0x6a'));};Fax[_0xd867('0x23')]['checkTrunk']=function(_0x2cc5db,_0x390175){if(!this[_0xd867('0x6b')](_0x2cc5db)){ut[_0xd867('0x45')](_0xd867('0x6c'),_[_0xd867('0x65')](_0x2cc5db)?'':_0x2cc5db[_0xd867('0x36')]+_0xd867('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xd867('0x65')](_0x390175[_0xd867('0x7')])){ut[_0xd867('0x45')](_0xd867('0x6e'),JSON['stringify'](_0x390175));return{'isValid':![],'message':_0xd867('0x6f')};}if(_[_0xd867('0x65')](_0x390175['path'])){ut[_0xd867('0x45')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x390175));return{'isValid':![],'message':_0xd867('0x70')};}return{'isValid':!![],'message':_0xd867('0x71')};};module[_0xd867('0x72')]=Fax; \ No newline at end of file +var _0xe0e8=['newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','bluebird','path','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','newstate','syncNewState'];(function(_0x3fa1e1,_0x4e39f0){var _0x1cc2ad=function(_0x3f6d4d){while(--_0x3f6d4d){_0x3fa1e1['push'](_0x3fa1e1['shift']());}};_0x1cc2ad(++_0x4e39f0);}(_0xe0e8,0xd6));var _0x8e0e=function(_0x429d91,_0x243b24){_0x429d91=_0x429d91-0x0;var _0x1743b3=_0xe0e8[_0x429d91];return _0x1743b3;};'use strict';var util=require(_0x8e0e('0x0'));var _=require(_0x8e0e('0x1'));var BPromise=require(_0x8e0e('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x8e0e('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x8e0e('0x4'));var logger=require(_0x8e0e('0x5'))('fax');var ami=require(_0x8e0e('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x8e0e('0x7'));var ut=require(_0x8e0e('0x8'));var Action=require(_0x8e0e('0x9'));var faxAccount=require(_0x8e0e('0xa'));var attachment=require(_0x8e0e('0xb'));var faxMessage=require(_0x8e0e('0xc'));function Fax(_0x1c5a01){this[_0x8e0e('0xd')]={};this[_0x8e0e('0xe')]=_0x1c5a01[_0x8e0e('0xe')];this[_0x8e0e('0xf')]=_0x1c5a01[_0x8e0e('0xf')];this['actions']={};ami['on'](_0x8e0e('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0x8e0e('0x11'),this[_0x8e0e('0x12')][_0x8e0e('0x13')](this));ami['on'](_0x8e0e('0x14'),this[_0x8e0e('0x15')][_0x8e0e('0x13')](this));ami['on'](_0x8e0e('0x16'),this[_0x8e0e('0x17')][_0x8e0e('0x13')](this));ami['on'](_0x8e0e('0x18'),this[_0x8e0e('0x19')]['bind'](this));ami['on']('receivefax',this[_0x8e0e('0x1a')][_0x8e0e('0x13')](this));ami['on']('hangup',this['syncHangup'][_0x8e0e('0x13')](this));ami['on'](_0x8e0e('0x1b'),this[_0x8e0e('0x1c')]['bind'](this));}Fax[_0x8e0e('0x1d')][_0x8e0e('0x1e')]=function(_0x4186d6){if(_0x4186d6[_0x8e0e('0x1f')]===_0x8e0e('0x20')){for(var _0x55263d in this['faxAccounts']){if(this[_0x8e0e('0xe')][_0x8e0e('0x21')](_0x55263d)){if(_0x4186d6[_0x8e0e('0x22')]===this[_0x8e0e('0xe')][_0x55263d][_0x8e0e('0x23')]){this[_0x8e0e('0xd')][_0x4186d6[_0x8e0e('0x24')]]={};this[_0x8e0e('0xd')][_0x4186d6['uniqueid']][_0x8e0e('0x25')]=_0x4186d6[_0x8e0e('0x25')];this[_0x8e0e('0xd')][_0x4186d6[_0x8e0e('0x24')]]['id']=this[_0x8e0e('0xe')][_0x55263d]['id'];this[_0x8e0e('0xd')][_0x4186d6[_0x8e0e('0x24')]][_0x8e0e('0x26')]=this[_0x8e0e('0xe')][_0x55263d]['name'];logger[_0x8e0e('0x27')](_0x4186d6[_0x8e0e('0x24')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x4186d6[_0x8e0e('0x24')]]){this[_0x8e0e('0xd')][_0x4186d6['uniqueid']]={};this[_0x8e0e('0xd')][_0x4186d6['uniqueid']]['channel']=_0x4186d6[_0x8e0e('0x25')];logger[_0x8e0e('0x27')](_0x4186d6[_0x8e0e('0x24')],_0x8e0e('0x28'));}};Fax[_0x8e0e('0x1d')][_0x8e0e('0x12')]=function(_0x2ff2a9){if(this['channels'][_0x2ff2a9[_0x8e0e('0x24')]]){for(var _0x58cdeb in _0x2ff2a9[_0x8e0e('0x29')]){if(_0x2ff2a9['variable'][_0x8e0e('0x21')](_0x58cdeb)){this['channels'][_0x2ff2a9[_0x8e0e('0x24')]][_0x58cdeb]=_0x2ff2a9['value'];}}}};Fax[_0x8e0e('0x1d')][_0x8e0e('0x15')]=function(_0x2180ce){if(this[_0x8e0e('0xd')][_0x2180ce['uniqueid']]){this[_0x8e0e('0xd')][_0x2180ce[_0x8e0e('0x24')]][_0x8e0e('0x2a')]=_0x2180ce[_0x8e0e('0x2a')];this['channels'][_0x2180ce[_0x8e0e('0x24')]][_0x8e0e('0x2b')]=_0x2180ce['channelstatedesc'];}};Fax[_0x8e0e('0x1d')][_0x8e0e('0x17')]=function(_0x1d92dc){if(this[_0x8e0e('0xd')][_0x1d92dc[_0x8e0e('0x24')]]){for(var _0x1d791f in _0x1d92dc['variable']){if(_0x1d92dc[_0x8e0e('0x29')]['hasOwnProperty'](_0x1d791f)){this[_0x8e0e('0xd')][_0x1d92dc[_0x8e0e('0x24')]][_0x1d791f]=_0x1d92dc['value'];}}}};Fax[_0x8e0e('0x1d')]['syncFaxStatus']=function(_0x2aa3f2){if(this['channels'][_0x2aa3f2[_0x8e0e('0x24')]]){this[_0x8e0e('0xd')][_0x2aa3f2['uniqueid']][_0x8e0e('0x2c')]=_0x2aa3f2['operation'];this[_0x8e0e('0xd')][_0x2aa3f2[_0x8e0e('0x24')]][_0x8e0e('0x2d')]=_0x2aa3f2[_0x8e0e('0x2d')];this['channels'][_0x2aa3f2[_0x8e0e('0x24')]][_0x8e0e('0x23')]=_0x2aa3f2['localstationid'];this[_0x8e0e('0xd')][_0x2aa3f2[_0x8e0e('0x24')]][_0x8e0e('0x2e')]=_0x2aa3f2['filename'];logger[_0x8e0e('0x27')](_0x2aa3f2[_0x8e0e('0x24')],_0x8e0e('0x2f'));}};Fax[_0x8e0e('0x1d')]['syncReceiveFax']=function(_0x5b3024){var _0x2fa1ce=this;if(this[_0x8e0e('0xd')][_0x5b3024[_0x8e0e('0x24')]]){var _0x3d71cd=this[_0x8e0e('0xd')][_0x5b3024[_0x8e0e('0x24')]]['id'];this['channels'][_0x5b3024['uniqueid']][_0x8e0e('0x30')]=_0x5b3024[_0x8e0e('0x30')];this['channels'][_0x5b3024[_0x8e0e('0x24')]][_0x8e0e('0x31')]=_0x5b3024[_0x8e0e('0x31')];this[_0x8e0e('0xd')][_0x5b3024[_0x8e0e('0x24')]][_0x8e0e('0x23')]=_0x5b3024[_0x8e0e('0x23')];this[_0x8e0e('0xd')][_0x5b3024[_0x8e0e('0x24')]]['resolution']=_0x5b3024[_0x8e0e('0x32')];this[_0x8e0e('0xd')][_0x5b3024['uniqueid']][_0x8e0e('0x33')]=_0x5b3024[_0x8e0e('0x33')];this[_0x8e0e('0xd')][_0x5b3024['uniqueid']][_0x8e0e('0x2e')]=_0x5b3024[_0x8e0e('0x2e')];this[_0x8e0e('0xd')][_0x5b3024[_0x8e0e('0x24')]]['calleridnum']=_0x5b3024[_0x8e0e('0x34')];if(this['channels'][_0x5b3024[_0x8e0e('0x24')]][_0x8e0e('0x31')]>0x0){tiff2pdf(_0x5b3024[_0x8e0e('0x2e')],_0x8e0e('0x35'),function(_0x1e82e6){logger['info'](_0x5b3024[_0x8e0e('0x24')],_0x8e0e('0x36'),_0x1e82e6[_0x8e0e('0x37')]);attachment[_0x8e0e('0x38')]({'name':path[_0x8e0e('0x39')](_0x5b3024[_0x8e0e('0x2e')])[_0x8e0e('0x26')],'basename':path[_0x8e0e('0x39')](_0x5b3024[_0x8e0e('0x2e')])[_0x8e0e('0x26')]+'.pdf','type':_0x8e0e('0x3a')})[_0x8e0e('0x3b')](function(_0x13fe04){faxAccount[_0x8e0e('0x3c')](_0x3d71cd,{'from':_0x5b3024[_0x8e0e('0x34')],'mapKey':'fax','body':path[_0x8e0e('0x39')](_0x5b3024[_0x8e0e('0x2e')])['name']+_0x8e0e('0x3d'),'AttachmentId':_0x13fe04['id']})[_0x8e0e('0x3e')](function(_0x1e9ea1){logger[_0x8e0e('0x3f')](_0x5b3024[_0x8e0e('0x24')],'\x20notify\x20',JSON[_0x8e0e('0x40')](_0x1e9ea1));});})['catch'](function(_0x1050e2){logger[_0x8e0e('0x3f')](_0x5b3024[_0x8e0e('0x24')],_0x8e0e('0x41'),JSON[_0x8e0e('0x40')](_0x1050e2));});});}logger[_0x8e0e('0x27')](_0x5b3024[_0x8e0e('0x24')],_0x8e0e('0x41'));}};Fax[_0x8e0e('0x1d')][_0x8e0e('0x1c')]=function(_0x29d00a){if(this[_0x8e0e('0x42')][_0x29d00a[_0x8e0e('0x24')]]){_[_0x8e0e('0x43')](this[_0x8e0e('0xd')][_0x29d00a['uniqueid']],_[_0x8e0e('0x44')](_0x29d00a,[_0x8e0e('0x45'),_0x8e0e('0x46')]));}};function updateStatus(_0x37b9ce){if(_0x37b9ce[_0x8e0e('0x47')]){faxMessage[_0x8e0e('0x48')](_0x37b9ce[_0x8e0e('0x47')],{'failMessage':_0x8e0e('0x49')})[_0x8e0e('0x3b')](function(_0x29c39e){ut[_0x8e0e('0x4a')](_0x8e0e('0x4b'),_0x29c39e);})[_0x8e0e('0x3e')](function(_0x13f98c){ut['logger'](_0x8e0e('0x4c'),_0x13f98c);});}else{ut[_0x8e0e('0x4a')](_0x8e0e('0x4d'));}}Fax[_0x8e0e('0x1d')][_0x8e0e('0x4e')]=function(_0x3c8534,_0x1eaf90,_0x44c7c8){var _0x64aa82=this;var _0x46fdd1={};if(_0x1eaf90){_0x46fdd1={'read':_0x1eaf90};}else{_0x46fdd1={'failMessage':_0x44c7c8};}if(this[_0x8e0e('0x42')][_0x3c8534][_0x8e0e('0x47')]){faxMessage['update'](this['actions'][_0x3c8534][_0x8e0e('0x47')],_0x46fdd1)[_0x8e0e('0x3b')](function(_0x5434bd){ut[_0x8e0e('0x4a')]('[Fax][Message][Updated]',_0x5434bd);})[_0x8e0e('0x3e')](function(_0x1ab7b2){ut['logger'](_0x8e0e('0x4f'),_0x1ab7b2);})['finally'](function(){delete _0x64aa82['channels'][_0x3c8534];delete _0x64aa82[_0x8e0e('0x42')][_0x3c8534];});}else{ut[_0x8e0e('0x4a')](_0x8e0e('0x50'));delete this[_0x8e0e('0xd')][_0x3c8534];delete this[_0x8e0e('0x42')][_0x3c8534];}};Fax[_0x8e0e('0x1d')][_0x8e0e('0x51')]=function(_0x21db6e){var _0x3d7b0c=this;if(this[_0x8e0e('0xd')][_0x21db6e[_0x8e0e('0x24')]]){if(this['actions'][_0x21db6e[_0x8e0e('0x24')]]){this['channels'][_0x21db6e[_0x8e0e('0x24')]]['id']=this[_0x8e0e('0x42')][_0x21db6e[_0x8e0e('0x24')]]['id'];this['channels'][_0x21db6e[_0x8e0e('0x24')]]['name']=this[_0x8e0e('0x42')][_0x21db6e['uniqueid']]['name'];}logger['info'](_0x21db6e[_0x8e0e('0x24')],this['actions'][_0x21db6e[_0x8e0e('0x24')]]?_0x8e0e('0x52'):_0x8e0e('0x53'),JSON[_0x8e0e('0x40')](this[_0x8e0e('0xd')][_0x21db6e[_0x8e0e('0x24')]]));if(this['actions'][_0x21db6e[_0x8e0e('0x24')]]){if(this[_0x8e0e('0xd')][_0x21db6e[_0x8e0e('0x24')]][_0x8e0e('0x54')]>0x0&&this['channels'][_0x21db6e['uniqueid']]['faxstatus']===_0x8e0e('0x55')){this[_0x8e0e('0x4e')](_0x21db6e[_0x8e0e('0x24')],!![]);}else{this[_0x8e0e('0x4e')](_0x21db6e[_0x8e0e('0x24')],![],this['channels'][_0x21db6e[_0x8e0e('0x24')]][_0x8e0e('0x56')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x21db6e[_0x8e0e('0x24')]][_0x8e0e('0x56')]:_0x8e0e('0x57'));}}}};Fax[_0x8e0e('0x1d')]['send']=function(_0x10627c){var _0x5a943f=this;return new BPromise(function(_0x3424ca,_0x26c969){_0x5a943f[_0x8e0e('0x58')](_0x10627c,_0x5a943f[_0x8e0e('0xe')][_0x10627c['FaxAccountId']])[_0x8e0e('0x3b')](function(_0x595031){ut['logger'](_0x8e0e('0x59'),_0x595031);_0x3424ca(ut[_0x8e0e('0x37')](_0x8e0e('0x5a')));})['catch'](function(_0x29cd5d){ut['logger']('[Fax][execOriginate][failure]',_0x29cd5d);updateStatus(_0x10627c);_0x26c969(ut[_0x8e0e('0x37')](_0x8e0e('0x5b')));});});};Fax[_0x8e0e('0x1d')][_0x8e0e('0x5c')]=function(_0x201175){var _0xf78c5a=this;return new BPromise(function(_0x595bda,_0x1c544e){var _0x52d666=_0xf78c5a['checkTrunk'](_0xf78c5a[_0x8e0e('0xe')][_0x201175[_0x8e0e('0x5d')]][_0x8e0e('0x5e')],_0x201175);if(_0x52d666[_0x8e0e('0x5f')]){_0x595bda(ut['message'](_0x8e0e('0x60')));}else{_0x1c544e(ut[_0x8e0e('0x37')](_0x52d666[_0x8e0e('0x37')]));}});};function originate(_0x3ab081,_0x3db683,_0x19317d){return new BPromise(function(_0x5f5754,_0x4bcd28){if(_0x19317d){var _0xbc5c99=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x8e0e('0x39')](_0x3ab081[_0x8e0e('0x3')])['name'],_0x3ab081[_0x8e0e('0x3')]);gs[_0x8e0e('0x61')](_0xbc5c99)[_0x8e0e('0x3b')](function(){_0x3ab081[_0x8e0e('0x3')]=util[_0x8e0e('0x62')](_0x8e0e('0x63'),path[_0x8e0e('0x39')](_0x3ab081[_0x8e0e('0x3')])[_0x8e0e('0x64')],path[_0x8e0e('0x39')](_0x3ab081['path'])[_0x8e0e('0x26')]);_0x3db683[_0x8e0e('0x65')]=_0x3ab081['path'];ut[_0x8e0e('0x4a')](_0x8e0e('0x66'),'');ami['Action'](ut['variablesAction'](_0x3ab081,_0x3db683))[_0x8e0e('0x3b')](function(_0x2c2c0a){_0x5f5754(_0x2c2c0a);})[_0x8e0e('0x3e')](function(_0x5ed4c6){_0x4bcd28(_0x5ed4c6);});})[_0x8e0e('0x3e')](function(_0x207fe8){_0x4bcd28(_0x207fe8);});}else{ami[_0x8e0e('0x67')](ut['variablesAction'](_0x3ab081,_0x3db683))[_0x8e0e('0x3b')](function(_0x51d56f){_0x5f5754(_0x51d56f);})[_0x8e0e('0x3e')](function(_0x4ceedf){_0x4bcd28(_0x4ceedf);});}});}Fax['prototype'][_0x8e0e('0x58')]=function(_0x4fcaad,_0x57f719){var _0x3a1bcf=this;return new BPromise(function(_0x159a1a,_0xf30180){var _0x2d4e92=uuid['v4']();var _0x4afe5f=ut[_0x8e0e('0x68')](_0x4fcaad,_0x57f719);_0x3a1bcf['actions'][_0x2d4e92]=new Action(_0x2d4e92,_0x57f719,_0x4fcaad);var _0x336e9b=_0x3a1bcf[_0x8e0e('0x42')][_0x2d4e92];if(path[_0x8e0e('0x39')](_0x4fcaad[_0x8e0e('0x3')])['ext']==='.pdf'){originate(_0x336e9b,_0x4afe5f,!![])['then'](function(_0x158b69){_0x159a1a(_0x158b69);})[_0x8e0e('0x3e')](function(_0x42ae0b){_0xf30180(_0x42ae0b);});}else{originate(_0x336e9b,_0x4afe5f,![])[_0x8e0e('0x3b')](function(_0x55718d){_0x159a1a(_0x55718d);})[_0x8e0e('0x3e')](function(_0x2934b2){_0xf30180(_0x2934b2);});}});};Fax[_0x8e0e('0x1d')]['isTrunkReachable']=function(_0x3f83d3){return!_[_0x8e0e('0x69')](_0x3f83d3)&&!_[_0x8e0e('0x69')](_0x3f83d3['name'])&&!_[_0x8e0e('0x69')](_0x3f83d3[_0x8e0e('0x6a')])&&_0x3f83d3[_0x8e0e('0x6a')]&&!_[_0x8e0e('0x69')](this[_0x8e0e('0xf')][util['format'](_0x8e0e('0x6b'),_0x3f83d3['name'])])&&!_['isNil'](this[_0x8e0e('0xf')][util[_0x8e0e('0x62')]('SIP/%s',_0x3f83d3[_0x8e0e('0x26')])][_0x8e0e('0x2d')])&&(this[_0x8e0e('0xf')][util[_0x8e0e('0x62')](_0x8e0e('0x6b'),_0x3f83d3[_0x8e0e('0x26')])]['status']===_0x8e0e('0x6c')||this['trunks'][util[_0x8e0e('0x62')](_0x8e0e('0x6b'),_0x3f83d3[_0x8e0e('0x26')])]['status']===_0x8e0e('0x6d'));};Fax[_0x8e0e('0x1d')][_0x8e0e('0x6e')]=function(_0x5c2b16,_0x405841){if(!this[_0x8e0e('0x6f')](_0x5c2b16)){ut[_0x8e0e('0x4a')](_0x8e0e('0x70'),_[_0x8e0e('0x69')](_0x5c2b16)?'':_0x5c2b16[_0x8e0e('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x8e0e('0x71')};}if(_[_0x8e0e('0x69')](_0x405841['fax'])){ut[_0x8e0e('0x4a')](_0x8e0e('0x72'),JSON['stringify'](_0x405841));return{'isValid':![],'message':_0x8e0e('0x73')};}if(_[_0x8e0e('0x69')](_0x405841[_0x8e0e('0x3')])){ut[_0x8e0e('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8e0e('0x40')](_0x405841));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x8e0e('0x74')};};module[_0x8e0e('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 655d26b..9534c4c 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 _0xf057=['inspect','resolve','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x4ba47d,_0x40fb6e){var _0x22c7ff=function(_0x466972){while(--_0x466972){_0x4ba47d['push'](_0x4ba47d['shift']());}};_0x22c7ff(++_0x40fb6e);}(_0xf057,0xf7));var _0x7f05=function(_0x14aaf3,_0x1222b0){_0x14aaf3=_0x14aaf3-0x0;var _0x1e99d4=_0xf057[_0x14aaf3];return _0x1e99d4;};'use strict';var util=require(_0x7f05('0x0'));var BPromise=require(_0x7f05('0x1'));var logger=require(_0x7f05('0x2'))(_0x7f05('0x3'));var _=require(_0x7f05('0x4'));var faxAccount=require(_0x7f05('0x5'));function loggerCatch(_0x53ca1a){return function(_0x51e93c){logger['error'](_0x53ca1a,util[_0x7f05('0x6')](_0x51e93c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3da908,_0x5b6189){return BPromise[_0x7f05('0x7')]()['then'](faxAccount[_0x7f05('0x8')](_0x3da908,_0x5b6189))[_0x7f05('0x9')](loggerCatch(_0x7f05('0xa')));}; \ No newline at end of file +var _0x82d1=['resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0x440c87,_0x37b425){var _0x2e76b3=function(_0x3f28f7){while(--_0x3f28f7){_0x440c87['push'](_0x440c87['shift']());}};_0x2e76b3(++_0x37b425);}(_0x82d1,0x16c));var _0x182d=function(_0x157ce0,_0x2a3cb1){_0x157ce0=_0x157ce0-0x0;var _0x3defab=_0x82d1[_0x157ce0];return _0x3defab;};'use strict';var util=require(_0x182d('0x0'));var BPromise=require(_0x182d('0x1'));var logger=require(_0x182d('0x2'))(_0x182d('0x3'));var _=require('lodash');var faxAccount=require(_0x182d('0x4'));function loggerCatch(_0x5b565e){return function(_0x36e565){logger['error'](_0x5b565e,util['inspect'](_0x36e565,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x323261,_0x382c57){return BPromise[_0x182d('0x5')]()[_0x182d('0x6')](faxAccount[_0x182d('0x7')](_0x323261,_0x382c57))['catch'](loggerCatch(_0x182d('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e89af22..98b68e1 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 _0x0417=['\x20Error\x20:','inspect','util','fax','bluebird','child_process','info','Exec\x20gs'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x0417,0x162));var _0x7041=function(_0x286103,_0x4786f7){_0x286103=_0x286103-0x0;var _0x397b3f=_0x0417[_0x286103];return _0x397b3f;};'use strict';var util=require(_0x7041('0x0'));var logger=require('../../../../config/logger')(_0x7041('0x1'));var BPromise=require(_0x7041('0x2'));var exec=require(_0x7041('0x3'))['exec'];exports['execute']=function(_0x118f39){return new BPromise(function(_0x534f84,_0x29875b){exec(_0x118f39,function(_0x424151,_0x510e4d,_0x576b25){logger[_0x7041('0x4')](_0x7041('0x5'),_0x510e4d);if(_0x424151){logger[_0x7041('0x4')]('Exec\x20gs',_0x7041('0x6'),util[_0x7041('0x7')](_0x424151,{'showHidden':![],'depth':null}),_0x510e4d,_0x576b25);_0x29875b(_0x424151);}_0x534f84(_0x510e4d);});});}; \ No newline at end of file +var _0x7a7f=['../../../../config/logger','fax','bluebird','child_process','info','\x20Error\x20:'];(function(_0x43e365,_0xbd61f){var _0x59d2e1=function(_0x468e5b){while(--_0x468e5b){_0x43e365['push'](_0x43e365['shift']());}};_0x59d2e1(++_0xbd61f);}(_0x7a7f,0x1ec));var _0xf7a7=function(_0x4b63f7,_0x244c92){_0x4b63f7=_0x4b63f7-0x0;var _0x3e7248=_0x7a7f[_0x4b63f7];return _0x3e7248;};'use strict';var util=require('util');var logger=require(_0xf7a7('0x0'))(_0xf7a7('0x1'));var BPromise=require(_0xf7a7('0x2'));var exec=require(_0xf7a7('0x3'))['exec'];exports['execute']=function(_0x18da17){return new BPromise(function(_0x4e6f58,_0x3ae732){exec(_0x18da17,function(_0x3d4b3a,_0x1b1a6b,_0x4413d7){logger[_0xf7a7('0x4')]('Exec\x20gs',_0x1b1a6b);if(_0x3d4b3a){logger[_0xf7a7('0x4')]('Exec\x20gs',_0xf7a7('0x5'),util['inspect'](_0x3d4b3a,{'showHidden':![],'depth':null}),_0x1b1a6b,_0x4413d7);_0x3ae732(_0x3d4b3a);}_0x4e6f58(_0x1b1a6b);});});}; \ 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 5f64c58..0289de7 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 _0xaa96=['logger','info','inspect','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','format','util','moment','../../../../config/logger','fax','message'];(function(_0x17cee4,_0x2313ff){var _0x24e12b=function(_0x259e13){while(--_0x259e13){_0x17cee4['push'](_0x17cee4['shift']());}};_0x24e12b(++_0x2313ff);}(_0xaa96,0x13d));var _0x6aa9=function(_0x4c0dd,_0x72eeba){_0x4c0dd=_0x4c0dd-0x0;var _0x1134a9=_0xaa96[_0x4c0dd];return _0x1134a9;};'use strict';var util=require(_0x6aa9('0x0'));var _=require('lodash');var moment=require(_0x6aa9('0x1'));var logger=require(_0x6aa9('0x2'))(_0x6aa9('0x3'));exports[_0x6aa9('0x4')]=function(_0x226e6c){return{'message':_0x226e6c};};exports[_0x6aa9('0x5')]=function(_0xec1452,_0x4d4bb0){logger[_0x6aa9('0x6')](_0xec1452,util[_0x6aa9('0x7')](_0x4d4bb0,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x237460,_0x188e6b){var _0x57fd17={'XMF-ECM':_0x188e6b[_0x6aa9('0x8')],'XMF-HEADERINFO':_0x188e6b[_0x6aa9('0x9')],'XMF-MINRATE':_0x188e6b[_0x6aa9('0xa')],'XMF-MAXRATE':_0x188e6b[_0x6aa9('0xb')],'XMF-MODEM':util['format'](_0x6aa9('0xc'),_0x188e6b[_0x6aa9('0xd')]),'XMF-GATEWAY':_0x188e6b[_0x6aa9('0xe')],'XMF-FAXDETECT':_0x188e6b[_0x6aa9('0xf')],'XMF-T38TIMEOUT':_0x188e6b[_0x6aa9('0x10')],'XMF-LOCALSTATIONID':_0x188e6b[_0x6aa9('0x11')],'XMF-PATH':_0x237460['path']};return _0x57fd17;};exports[_0x6aa9('0x12')]=function(_0xe2ee7b,_0x321fad){return{'actionid':_0xe2ee7b[_0x6aa9('0x13')],'action':_0x6aa9('0x14'),'channel':_0xe2ee7b[_0x6aa9('0x15')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x6aa9('0x16')]('\x22%s\x22\x20<%s>',_0xe2ee7b[_0x6aa9('0x9')]?_0xe2ee7b[_0x6aa9('0x9')]:'',_0xe2ee7b[_0x6aa9('0x11')]),'variable':_0x321fad,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xe2ee7b['uniqueid']};}; \ No newline at end of file +var _0x4797=['originate','channel','xcally-motion-fax','from-sip','format','localstationid','util','lodash','moment','../../../../config/logger','fax','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid'];(function(_0xd66896,_0xb25ffd){var _0xab198f=function(_0x258b38){while(--_0x258b38){_0xd66896['push'](_0xd66896['shift']());}};_0xab198f(++_0xb25ffd);}(_0x4797,0x1e6));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x7479('0x0'));var _=require(_0x7479('0x1'));var moment=require(_0x7479('0x2'));var logger=require(_0x7479('0x3'))(_0x7479('0x4'));exports['message']=function(_0x1ebc44){return{'message':_0x1ebc44};};exports['logger']=function(_0x372418,_0x1b3ea8){logger['info'](_0x372418,util[_0x7479('0x5')](_0x1b3ea8,{'showHidden':![],'depth':null}));};exports[_0x7479('0x6')]=function(_0x2fead4,_0x447ae6){var _0x258caa={'XMF-ECM':_0x447ae6['ecm'],'XMF-HEADERINFO':_0x447ae6[_0x7479('0x7')],'XMF-MINRATE':_0x447ae6[_0x7479('0x8')],'XMF-MAXRATE':_0x447ae6[_0x7479('0x9')],'XMF-MODEM':util['format'](_0x7479('0xa'),_0x447ae6[_0x7479('0xb')]),'XMF-GATEWAY':_0x447ae6[_0x7479('0xc')],'XMF-FAXDETECT':_0x447ae6[_0x7479('0xd')],'XMF-T38TIMEOUT':_0x447ae6[_0x7479('0xe')],'XMF-LOCALSTATIONID':_0x447ae6['localstationid'],'XMF-PATH':_0x2fead4[_0x7479('0xf')]};return _0x258caa;};exports[_0x7479('0x10')]=function(_0x3ce081,_0x31ed6d){return{'actionid':_0x3ce081[_0x7479('0x11')],'action':_0x7479('0x12'),'channel':_0x3ce081[_0x7479('0x13')],'Exten':_0x7479('0x14'),'Context':_0x7479('0x15'),'Priority':'1','callerid':util[_0x7479('0x16')]('\x22%s\x22\x20<%s>',_0x3ce081['headerinfo']?_0x3ce081[_0x7479('0x7')]:'',_0x3ce081[_0x7479('0x17')]),'variable':_0x31ed6d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3ce081[_0x7479('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 050817b..1e8d7ef 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 _0x0d08=['./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','error','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./preview','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0x0d08,0xf6));var _0x80d0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0d08[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x80d0('0x0'));var moment=require(_0x80d0('0x1'));var server=require(_0x80d0('0x2'));var Realtime=require(_0x80d0('0x3'));var Report=require('./report');var Acw=require(_0x80d0('0x4'));var Trigger=require(_0x80d0('0x5'));var Dialer=require('./dialer');var Preview=require(_0x80d0('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x80d0('0x7'));var voiceCallReport=require(_0x80d0('0x8'));var trunk=require(_0x80d0('0x9'));var trigger=require(_0x80d0('0xa'));var template=require(_0x80d0('0xb'));var cmHopperHistory=require(_0x80d0('0xc'));var campaign=require(_0x80d0('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x80d0('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x80d0('0xf'));var sugarcrm=require(_0x80d0('0x10'));var freshdesk=require(_0x80d0('0x11'));var desk=require(_0x80d0('0x12'));var zoho=require(_0x80d0('0x13'));var vtiger=require(_0x80d0('0x14'));var freshsales=require(_0x80d0('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x80d0('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x80d0('0x17'))(_0x80d0('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x80d0('0x19')](_0x80d0('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x80d0('0x19')](_0x80d0('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x80d0('0x1b')]()[_0x80d0('0x1c')](user[_0x80d0('0x1d')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x1e')]())[_0x80d0('0x1c')](user[_0x80d0('0x1f')]())['then'](realtime[_0x80d0('0x20')]())[_0x80d0('0x1c')](trunk[_0x80d0('0x21')]())[_0x80d0('0x1c')](realtime['initTrunks']())[_0x80d0('0x1c')](voiceQueue[_0x80d0('0x22')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x23')]())[_0x80d0('0x1c')](trigger[_0x80d0('0x24')]())[_0x80d0('0x1c')](realtime['initTriggers']())[_0x80d0('0x1c')](template[_0x80d0('0x25')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x26')]())['then'](zendesk[_0x80d0('0x27')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x28')]())[_0x80d0('0x1c')](salesforce[_0x80d0('0x29')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x80d0('0x2a')]())['then'](realtime['initSugarcrmAccounts']())[_0x80d0('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x80d0('0x1c')](realtime[_0x80d0('0x2b')]())[_0x80d0('0x1c')](desk[_0x80d0('0x2c')]())[_0x80d0('0x1c')](realtime['initDeskAccounts']())[_0x80d0('0x1c')](zoho['getZohoAccounts']())[_0x80d0('0x1c')](realtime[_0x80d0('0x2d')]())[_0x80d0('0x1c')](vtiger[_0x80d0('0x2e')]())['then'](realtime[_0x80d0('0x2f')]())[_0x80d0('0x1c')](freshsales[_0x80d0('0x30')]())['then'](realtime['initFreshsalesAccounts']())[_0x80d0('0x1c')](servicenow[_0x80d0('0x31')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x32')]())[_0x80d0('0x1c')](dynamics365[_0x80d0('0x33')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x34')]())[_0x80d0('0x1c')](campaign[_0x80d0('0x35')]())[_0x80d0('0x1c')](realtime['initCampaigns']())[_0x80d0('0x1c')](voiceExtension[_0x80d0('0x36')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x37')]())[_0x80d0('0x1c')](faxAccount[_0x80d0('0x38')]())[_0x80d0('0x1c')](realtime[_0x80d0('0x39')]())[_0x80d0('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x80d0('0x1b')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x80d0('0x1c')](realtime[_0x80d0('0x3a')]())[_0x80d0('0x1c')](cmHopperHistory[_0x80d0('0x3b')]())[_0x80d0('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x80d0('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x80d0('0x1c')](realtime['initCampaignHopperHistory']())[_0x80d0('0x1c')](voiceCallReport[_0x80d0('0x3c')]())['then'](realtime[_0x80d0('0x3d')]())[_0x80d0('0x3e')](function(_0x1b422d){logger['error']('[index.js][initParams]',util[_0x80d0('0x3f')](_0x1b422d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x80d0('0x40')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x80d0('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x80d0('0x3e')](function(_0x201311){logger[_0x80d0('0x41')](_0x80d0('0x42'),util[_0x80d0('0x3f')](_0x201311,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x10d4=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','catch','error','[index.js][initParams]','inspect','listen','sync','util','moment','./server','./realtime','./report','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x4bfc79,_0x590d7e){var _0x30817e=function(_0x33075a){while(--_0x33075a){_0x4bfc79['push'](_0x4bfc79['shift']());}};_0x30817e(++_0x590d7e);}(_0x10d4,0x16b));var _0x410d=function(_0x197a8a,_0x2f70dd){_0x197a8a=_0x197a8a-0x0;var _0x3624c0=_0x10d4[_0x197a8a];return _0x3624c0;};'use strict';var util=require(_0x410d('0x0'));var moment=require(_0x410d('0x1'));var server=require(_0x410d('0x2'));var Realtime=require(_0x410d('0x3'));var Report=require(_0x410d('0x4'));var Acw=require(_0x410d('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x410d('0x6'));var Preview=require('./preview');var Fax=require(_0x410d('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x410d('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x410d('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x410d('0xa'));var template=require(_0x410d('0xb'));var cmHopperHistory=require(_0x410d('0xc'));var campaign=require(_0x410d('0xd'));var voiceExtension=require(_0x410d('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x410d('0xf'));var sugarcrm=require(_0x410d('0x10'));var freshdesk=require(_0x410d('0x11'));var desk=require(_0x410d('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x410d('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x410d('0x14'));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(_0x410d('0x15'))(_0x410d('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x410d('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x410d('0x18')](_0x410d('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x410d('0x19')]()[_0x410d('0x1a')](user[_0x410d('0x1b')]())[_0x410d('0x1a')](realtime[_0x410d('0x1c')]())[_0x410d('0x1a')](user[_0x410d('0x1d')]())['then'](realtime[_0x410d('0x1e')]())[_0x410d('0x1a')](trunk[_0x410d('0x1f')]())['then'](realtime[_0x410d('0x20')]())[_0x410d('0x1a')](voiceQueue[_0x410d('0x21')]())[_0x410d('0x1a')](realtime['initVoiceQueues']())[_0x410d('0x1a')](trigger[_0x410d('0x22')]())[_0x410d('0x1a')](realtime[_0x410d('0x23')]())[_0x410d('0x1a')](template[_0x410d('0x24')]())['then'](realtime[_0x410d('0x25')]())[_0x410d('0x1a')](zendesk[_0x410d('0x26')]())[_0x410d('0x1a')](realtime[_0x410d('0x27')]())['then'](salesforce[_0x410d('0x28')]())[_0x410d('0x1a')](realtime['initSalesforceAccounts']())[_0x410d('0x1a')](sugarcrm[_0x410d('0x29')]())['then'](realtime[_0x410d('0x2a')]())[_0x410d('0x1a')](freshdesk[_0x410d('0x2b')]())[_0x410d('0x1a')](realtime[_0x410d('0x2c')]())[_0x410d('0x1a')](desk[_0x410d('0x2d')]())[_0x410d('0x1a')](realtime['initDeskAccounts']())['then'](zoho[_0x410d('0x2e')]())['then'](realtime['initZohoAccounts']())[_0x410d('0x1a')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x410d('0x1a')](freshsales[_0x410d('0x2f')]())['then'](realtime[_0x410d('0x30')]())['then'](servicenow[_0x410d('0x31')]())['then'](realtime[_0x410d('0x32')]())['then'](dynamics365[_0x410d('0x33')]())[_0x410d('0x1a')](realtime[_0x410d('0x34')]())['then'](campaign[_0x410d('0x35')]())[_0x410d('0x1a')](realtime[_0x410d('0x36')]())[_0x410d('0x1a')](voiceExtension[_0x410d('0x37')]())[_0x410d('0x1a')](realtime[_0x410d('0x38')]())[_0x410d('0x1a')](faxAccount[_0x410d('0x39')]())['then'](realtime[_0x410d('0x3a')]())[_0x410d('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x410d('0x19')]()[_0x410d('0x1a')](voiceQueueReport[_0x410d('0x3b')]())[_0x410d('0x1a')](realtime[_0x410d('0x3c')]())[_0x410d('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x410d('0x1a')](realtime[_0x410d('0x3d')]())[_0x410d('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x410d('0x1a')](realtime[_0x410d('0x3e')]())[_0x410d('0x1a')](voiceCallReport['getVoiceCallReports']())[_0x410d('0x1a')](realtime['initVoiceCallReports']())[_0x410d('0x3f')](function(_0x51f30c){logger[_0x410d('0x40')](_0x410d('0x41'),util[_0x410d('0x42')](_0x51f30c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x410d('0x43')](realtime,preview,fax)[_0x410d('0x1a')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x410d('0x1a')](function(){report[_0x410d('0x44')]();setInterval(initRealtime,0x1388);})[_0x410d('0x3f')](function(_0x1e8c50){logger[_0x410d('0x40')]('[index.js][main]',util[_0x410d('0x42')](_0x1e8c50,{'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 91d51f9..82688d4 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 _0xc9d5=['unknown','mobile','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','address','interface','stringify','user:%s','emit','user:save','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xc9d5,0xe2));var _0x5c9d=function(_0x433bf5,_0x50fbc8){_0x433bf5=_0x433bf5-0x0;var _0x342696=_0xc9d5[_0x433bf5];return _0x342696;};'use strict';var _=require(_0x5c9d('0x0'));var util=require(_0x5c9d('0x1'));var moment=require('moment');var md5=require(_0x5c9d('0x2'));var Redis=require(_0x5c9d('0x3'));var config=require(_0x5c9d('0x4'));config[_0x5c9d('0x5')]=_['defaults'](config[_0x5c9d('0x5')],{'host':_0x5c9d('0x6'),'port':0x18eb});var io=require(_0x5c9d('0x7'))(new Redis(config['redis']));function Agent(_0x53e855){this['id']=_0x53e855['id']||0x0;this['name']=_0x53e855[_0x5c9d('0x8')]||'';this[_0x5c9d('0x9')]=_0x53e855[_0x5c9d('0x9')]||'';this[_0x5c9d('0xa')]=_0x53e855[_0x5c9d('0xa')]||'';this[_0x5c9d('0xb')]=_0x53e855[_0x5c9d('0xb')]||'';this['state']='unknown';this[_0x5c9d('0xc')]=0x0;this[_0x5c9d('0xd')]=_0x5c9d('0xe');this['address']='';this['phone']='';this[_0x5c9d('0xf')]='';this['interface']='';this[_0x5c9d('0x10')]=_0x53e855['online']||![];this[_0x5c9d('0x11')]=_0x5c9d('0xe');this['voiceStatusTime']=0x0;this[_0x5c9d('0x12')]='';this[_0x5c9d('0x13')]='';this[_0x5c9d('0x14')]=![];this[_0x5c9d('0x15')]=![];this['md5']='';}Agent[_0x5c9d('0x16')][_0x5c9d('0x17')]=function(_0x414fdc){var _0x11b1a5;if(_0x414fdc&&_0x414fdc[_0x5c9d('0x18')]){_0x11b1a5=_0x414fdc['state'][_0x5c9d('0x19')]();switch(_0x11b1a5){case _0x5c9d('0x1a'):_0x11b1a5=_0x5c9d('0x1b');break;case _0x5c9d('0x1c'):_0x11b1a5=_0x5c9d('0x1d');break;}}if(_0x11b1a5&&this[_0x5c9d('0x11')]!==_0x11b1a5||_0x414fdc[_0x5c9d('0x1e')]){this[_0x5c9d('0x1f')]=_[_0x5c9d('0x20')](moment()['format']('x'));}if(_0x11b1a5){this[_0x5c9d('0x11')]=_0x11b1a5;}var _0x154ed3={'id':this['id'],'name':this[_0x5c9d('0x8')],'email':this[_0x5c9d('0x9')],'accountcode':this['accountcode'],'fullname':this[_0x5c9d('0xb')],'state':this[_0x5c9d('0x18')],'stateTime':this['stateTime'],'status':this[_0x5c9d('0xd')],'address':this[_0x5c9d('0x21')],'online':this['online'],'voiceStatus':this[_0x5c9d('0x11')],'voiceStatusTime':this[_0x5c9d('0x1f')],'voiceStatusCallerIdNumber':this[_0x5c9d('0x12')],'voiceStatusQueue':this[_0x5c9d('0x13')],'interface':this[_0x5c9d('0x22')],'onhold':this[_0x5c9d('0x14')]};var _0x5af8af=md5(JSON[_0x5c9d('0x23')](_0x154ed3));if(this[_0x5c9d('0x2')]!==_0x5af8af){this['md5']=_0x5af8af;io['to'](util['format'](_0x5c9d('0x24'),_0x154ed3[_0x5c9d('0x8')]))[_0x5c9d('0x25')](_0x5c9d('0x26'),_0x154ed3);io['emit']('user:presence',_0x154ed3);}};module[_0x5c9d('0x27')]=Agent; \ No newline at end of file +var _0x315f=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','idle','inuse','talking','statePause','format','voiceStatusCallerIdNumber','voiceStatusQueue','user:%s','emit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','defaults','redis'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x315f,0x1f4));var _0xf315=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x315f[_0x34b821];return _0x5e00a0;};'use strict';var _=require(_0xf315('0x0'));var util=require(_0xf315('0x1'));var moment=require(_0xf315('0x2'));var md5=require(_0xf315('0x3'));var Redis=require('ioredis');var config=require(_0xf315('0x4'));config['redis']=_[_0xf315('0x5')](config[_0xf315('0x6')],{'host':_0xf315('0x7'),'port':0x18eb});var io=require(_0xf315('0x8'))(new Redis(config[_0xf315('0x6')]));function Agent(_0x4d6893){this['id']=_0x4d6893['id']||0x0;this[_0xf315('0x9')]=_0x4d6893['name']||'';this[_0xf315('0xa')]=_0x4d6893[_0xf315('0xa')]||'';this[_0xf315('0xb')]=_0x4d6893[_0xf315('0xb')]||'';this[_0xf315('0xc')]=_0x4d6893[_0xf315('0xc')]||'';this[_0xf315('0xd')]=_0xf315('0xe');this[_0xf315('0xf')]=0x0;this[_0xf315('0x10')]=_0xf315('0xe');this[_0xf315('0x11')]='';this[_0xf315('0x12')]='';this[_0xf315('0x13')]='';this[_0xf315('0x14')]='';this[_0xf315('0x15')]=_0x4d6893[_0xf315('0x15')]||![];this[_0xf315('0x16')]=_0xf315('0xe');this[_0xf315('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0xf315('0x18')]=![];this[_0xf315('0x19')]=![];this[_0xf315('0x3')]='';}Agent[_0xf315('0x1a')][_0xf315('0x1b')]=function(_0x5ccb75){var _0x787eda;if(_0x5ccb75&&_0x5ccb75[_0xf315('0xd')]){_0x787eda=_0x5ccb75[_0xf315('0xd')]['toLowerCase']();switch(_0x787eda){case'not_inuse':_0x787eda=_0xf315('0x1c');break;case _0xf315('0x1d'):_0x787eda=_0xf315('0x1e');break;}}if(_0x787eda&&this[_0xf315('0x16')]!==_0x787eda||_0x5ccb75[_0xf315('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0xf315('0x20')]('x'));}if(_0x787eda){this[_0xf315('0x16')]=_0x787eda;}var _0x5c8f3b={'id':this['id'],'name':this[_0xf315('0x9')],'email':this[_0xf315('0xa')],'accountcode':this['accountcode'],'fullname':this[_0xf315('0xc')],'state':this[_0xf315('0xd')],'stateTime':this[_0xf315('0xf')],'status':this[_0xf315('0x10')],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xf315('0x17')],'voiceStatusCallerIdNumber':this[_0xf315('0x21')],'voiceStatusQueue':this[_0xf315('0x22')],'interface':this[_0xf315('0x14')],'onhold':this[_0xf315('0x18')]};var _0x4d4c46=md5(JSON['stringify'](_0x5c8f3b));if(this['md5']!==_0x4d4c46){this[_0xf315('0x3')]=_0x4d4c46;io['to'](util['format'](_0xf315('0x23'),_0x5c8f3b[_0xf315('0x9')]))[_0xf315('0x24')]('user:save',_0x5c8f3b);io['emit'](_0xf315('0x25'),_0x5c8f3b);}};module[_0xf315('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7bb6f67..c554335 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 _0xe480=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0xe480,0x1c0));var _0x0e48=function(_0xde6023,_0x1f94e9){_0xde6023=_0xde6023-0x0;var _0x3917e8=_0xe480[_0xde6023];return _0x3917e8;};'use strict';function Campaign(_0x25ece2){this['id']=_0x25ece2['id']||0x0;this[_0x0e48('0x0')]=_0x25ece2[_0x0e48('0x0')]||'';this[_0x0e48('0x1')]=_0x25ece2[_0x0e48('0x1')]||_0x0e48('0x2');this[_0x0e48('0x3')]=0x0;this[_0x0e48('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x0e48('0x5')]=0x0;this[_0x0e48('0x6')]='';this[_0x0e48('0x7')]=!![];this[_0x0e48('0x8')]=_0x25ece2[_0x0e48('0x8')];this['limitCalls']=_0x25ece2[_0x0e48('0x9')];this[_0x0e48('0xa')]=_0x25ece2[_0x0e48('0xa')]||null;this['dialGlobalInterval']=_0x25ece2['dialGlobalInterval']?_0x25ece2[_0x0e48('0xb')]:null;this['dialOriginateCallerIdName']=_0x25ece2[_0x0e48('0xc')];this[_0x0e48('0xd')]=_0x25ece2[_0x0e48('0xd')];this[_0x0e48('0xe')]=_0x25ece2[_0x0e48('0xe')]||0x1e;this[_0x0e48('0xf')]=_0x25ece2[_0x0e48('0xf')];this['dialCongestionRetryFrequency']=_0x25ece2['dialCongestionRetryFrequency'];this[_0x0e48('0x10')]=_0x25ece2[_0x0e48('0x10')];this[_0x0e48('0x11')]=_0x25ece2[_0x0e48('0x11')];this[_0x0e48('0x12')]=_0x25ece2[_0x0e48('0x12')];this[_0x0e48('0x13')]=_0x25ece2['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x25ece2[_0x0e48('0x14')];this['dialNoSuchNumberMaxRetry']=_0x25ece2[_0x0e48('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x25ece2[_0x0e48('0x16')]||0x96;this[_0x0e48('0x17')]=_0x25ece2[_0x0e48('0x17')]||0x3;this[_0x0e48('0x18')]=_0x25ece2['dialDropRetryFrequency']||0x96;this[_0x0e48('0x19')]=_0x25ece2[_0x0e48('0x19')]||0x3;this[_0x0e48('0x1a')]=_0x25ece2['dialAbandonedRetryFrequency']||0x96;this[_0x0e48('0x1b')]=_0x25ece2['dialMachineMaxRetry']||0x3;this[_0x0e48('0x1c')]=_0x25ece2[_0x0e48('0x1c')]||0x96;this[_0x0e48('0x1d')]=_0x25ece2[_0x0e48('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x25ece2[_0x0e48('0x1e')]||0x96;this[_0x0e48('0x1f')]=_0x25ece2[_0x0e48('0x1f')]||_0x0e48('0x20');this['dialPrefix']=_0x25ece2['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x25ece2[_0x0e48('0x21')]||undefined;this[_0x0e48('0x22')]=_0x25ece2[_0x0e48('0x22')]||undefined;this[_0x0e48('0x23')]=_0x25ece2[_0x0e48('0x23')]?_0x25ece2[_0x0e48('0x23')]:undefined;this[_0x0e48('0x24')]=_0x25ece2['Trunk']?_0x25ece2[_0x0e48('0x24')]:undefined;this[_0x0e48('0x25')]=_0x25ece2[_0x0e48('0x25')]?_0x25ece2['Interval']:undefined;this[_0x0e48('0x26')]=_0x25ece2[_0x0e48('0x26')]?_0x25ece2[_0x0e48('0x26')]:undefined;this[_0x0e48('0x27')]=_0x25ece2[_0x0e48('0x26')]?_0x25ece2[_0x0e48('0x26')][_0x0e48('0x0')]:undefined;this[_0x0e48('0x28')]=_0x25ece2[_0x0e48('0x28')]||![];this[_0x0e48('0x29')]=_0x25ece2[_0x0e48('0x29')];this[_0x0e48('0x2a')]=_0x25ece2[_0x0e48('0x2a')];this[_0x0e48('0x2b')]=_0x25ece2['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x25ece2[_0x0e48('0x2c')];this[_0x0e48('0x2d')]=_0x25ece2[_0x0e48('0x2d')];this['dialAMDBetweenWordsSilence']=_0x25ece2[_0x0e48('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x25ece2[_0x0e48('0x2f')];this[_0x0e48('0x30')]=_0x25ece2[_0x0e48('0x30')];this[_0x0e48('0x31')]=_0x25ece2[_0x0e48('0x31')];}module[_0x0e48('0x32')]=Campaign; \ No newline at end of file +var _0xaab7=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','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','message','sendMessageOneNotActive'];(function(_0x238830,_0x3c7f87){var _0x11fb15=function(_0x545e78){while(--_0x545e78){_0x238830['push'](_0x238830['shift']());}};_0x11fb15(++_0x3c7f87);}(_0xaab7,0x1ed));var _0x7aab=function(_0x116c0c,_0x1513ad){_0x116c0c=_0x116c0c-0x0;var _0x6dacc4=_0xaab7[_0x116c0c];return _0x6dacc4;};'use strict';function Campaign(_0x281dac){this['id']=_0x281dac['id']||0x0;this[_0x7aab('0x0')]=_0x281dac[_0x7aab('0x0')]||'';this['type']=_0x281dac[_0x7aab('0x1')]||_0x7aab('0x2');this['originated']=0x0;this[_0x7aab('0x3')]=0x0;this[_0x7aab('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7aab('0x5')]='';this[_0x7aab('0x6')]=!![];this[_0x7aab('0x7')]=_0x281dac[_0x7aab('0x7')];this[_0x7aab('0x8')]=_0x281dac[_0x7aab('0x8')];this['dialTimezone']=_0x281dac[_0x7aab('0x9')]||null;this[_0x7aab('0xa')]=_0x281dac[_0x7aab('0xa')]?_0x281dac[_0x7aab('0xa')]:null;this['dialOriginateCallerIdName']=_0x281dac[_0x7aab('0xb')];this['dialOriginateCallerIdNumber']=_0x281dac[_0x7aab('0xc')];this[_0x7aab('0xd')]=_0x281dac[_0x7aab('0xd')]||0x1e;this[_0x7aab('0xe')]=_0x281dac[_0x7aab('0xe')];this[_0x7aab('0xf')]=_0x281dac[_0x7aab('0xf')];this[_0x7aab('0x10')]=_0x281dac['dialBusyMaxRetry'];this[_0x7aab('0x11')]=_0x281dac['dialBusyRetryFrequency'];this[_0x7aab('0x12')]=_0x281dac['dialNoAnswerMaxRetry'];this[_0x7aab('0x13')]=_0x281dac[_0x7aab('0x13')];this[_0x7aab('0x14')]=_0x281dac[_0x7aab('0x14')];this['dialNoSuchNumberMaxRetry']=_0x281dac['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x281dac['dialNoSuchNumberRetryFrequency']||0x96;this[_0x7aab('0x15')]=_0x281dac['dialDropMaxRetry']||0x3;this[_0x7aab('0x16')]=_0x281dac[_0x7aab('0x16')]||0x96;this[_0x7aab('0x17')]=_0x281dac['dialAbandonedMaxRetry']||0x3;this[_0x7aab('0x18')]=_0x281dac[_0x7aab('0x18')]||0x96;this[_0x7aab('0x19')]=_0x281dac['dialMachineMaxRetry']||0x3;this[_0x7aab('0x1a')]=_0x281dac[_0x7aab('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x281dac[_0x7aab('0x1b')]||0x3;this[_0x7aab('0x1c')]=_0x281dac['dialAgentRejectRetryFrequency']||0x96;this[_0x7aab('0x1d')]=_0x281dac['dialOrderByScheduledAt']||_0x7aab('0x1e');this[_0x7aab('0x1f')]=_0x281dac[_0x7aab('0x1f')]||undefined;this[_0x7aab('0x20')]=_0x281dac[_0x7aab('0x20')]||undefined;this[_0x7aab('0x21')]=_0x281dac[_0x7aab('0x21')]||undefined;this[_0x7aab('0x22')]=_0x281dac[_0x7aab('0x22')]?_0x281dac[_0x7aab('0x22')]:undefined;this[_0x7aab('0x23')]=_0x281dac[_0x7aab('0x23')]?_0x281dac[_0x7aab('0x23')]:undefined;this[_0x7aab('0x24')]=_0x281dac[_0x7aab('0x24')]?_0x281dac[_0x7aab('0x24')]:undefined;this['SquareProject']=_0x281dac[_0x7aab('0x25')]?_0x281dac[_0x7aab('0x25')]:undefined;this[_0x7aab('0x26')]=_0x281dac[_0x7aab('0x25')]?_0x281dac[_0x7aab('0x25')][_0x7aab('0x0')]:undefined;this[_0x7aab('0x27')]=_0x281dac[_0x7aab('0x27')]||![];this[_0x7aab('0x28')]=_0x281dac[_0x7aab('0x28')];this[_0x7aab('0x29')]=_0x281dac[_0x7aab('0x29')];this[_0x7aab('0x2a')]=_0x281dac[_0x7aab('0x2a')];this[_0x7aab('0x2b')]=_0x281dac[_0x7aab('0x2b')];this[_0x7aab('0x2c')]=_0x281dac[_0x7aab('0x2c')];this[_0x7aab('0x2d')]=_0x281dac[_0x7aab('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x281dac[_0x7aab('0x2e')];this[_0x7aab('0x2f')]=_0x281dac[_0x7aab('0x2f')];this[_0x7aab('0x30')]=_0x281dac[_0x7aab('0x30')];}module[_0x7aab('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2db9d63..1c21d51 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 _0x6dc0=['destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','type','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','starttime','channel'];(function(_0x386515,_0x1a26d2){var _0x2ebd7f=function(_0x5a42b9){while(--_0x5a42b9){_0x386515['push'](_0x386515['shift']());}};_0x2ebd7f(++_0x1a26d2);}(_0x6dc0,0xb6));var _0x06dc=function(_0x309d92,_0x1aa059){_0x309d92=_0x309d92-0x0;var _0x1e578b=_0x6dc0[_0x309d92];return _0x1e578b;};'use strict';function Channel(){this[_0x06dc('0x0')]=null;this[_0x06dc('0x1')]='';this[_0x06dc('0x2')]='';this['calleridnum']=0x0;this[_0x06dc('0x3')]='';this[_0x06dc('0x4')]=undefined;this[_0x06dc('0x5')]=undefined;this[_0x06dc('0x6')]=0x0;this['context']='';this[_0x06dc('0x7')]=0x0;this[_0x06dc('0x8')]=0x0;this['exten']=0x0;this[_0x06dc('0x9')]=![];this['answertime']=null;this[_0x06dc('0xa')]=null;this[_0x06dc('0xb')]=![];this[_0x06dc('0xc')]=![];this[_0x06dc('0xd')]='';this[_0x06dc('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x06dc('0xf')]=null;this[_0x06dc('0x10')]=null;this['disposition']=null;this[_0x06dc('0x11')]=![];this[_0x06dc('0x12')]=null;this[_0x06dc('0x13')]=null;this[_0x06dc('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x06dc('0x15')]=undefined;this[_0x06dc('0x16')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xb2ed=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','lastapplication','lastdata','billableseconds','holdtime','disposition','monitor','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname'];(function(_0x34699d,_0x4f419f){var _0x15be99=function(_0x7767d2){while(--_0x7767d2){_0x34699d['push'](_0x34699d['shift']());}};_0x15be99(++_0x4f419f);}(_0xb2ed,0x86));var _0xdb2e=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0xb2ed[_0x5959c9];return _0x4ffcbc;};'use strict';function Channel(){this[_0xdb2e('0x0')]=null;this[_0xdb2e('0x1')]='';this['destinationchannel']='';this[_0xdb2e('0x2')]=0x0;this[_0xdb2e('0x3')]='';this[_0xdb2e('0x4')]=undefined;this[_0xdb2e('0x5')]=undefined;this[_0xdb2e('0x6')]=0x0;this[_0xdb2e('0x7')]='';this[_0xdb2e('0x8')]=0x0;this[_0xdb2e('0x9')]=0x0;this['exten']=0x0;this[_0xdb2e('0xa')]=![];this[_0xdb2e('0xb')]=null;this[_0xdb2e('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xdb2e('0xd')]='';this[_0xdb2e('0xe')]='';this['duration']=0x0;this[_0xdb2e('0xf')]=0x0;this[_0xdb2e('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0xdb2e('0x11')]=null;this[_0xdb2e('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0xdb2e('0x13')]=undefined;this[_0xdb2e('0x14')]=undefined;this['transferType']=undefined;this[_0xdb2e('0x15')]=0x0;}module[_0xdb2e('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 6a399c8..1f3f607 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 _0x7727=['authType','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','username','remoteUri'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x7727,0xb2));var _0x7772=function(_0x2afb08,_0x324211){_0x2afb08=_0x2afb08-0x0;var _0x38cc5a=_0x7727[_0x2afb08];return _0x38cc5a;};'use strict';function DeskAccount(_0x4d1632){this['id']=_0x4d1632['id']||0x0;this['name']=_0x4d1632['name']||'';this[_0x7772('0x0')]=_0x4d1632[_0x7772('0x0')]||'';this['remoteUri']=_0x4d1632[_0x7772('0x1')]||'';this[_0x7772('0x2')]=_0x4d1632[_0x7772('0x2')]||'';this['password']=_0x4d1632['password']||'';this[_0x7772('0x3')]=_0x4d1632[_0x7772('0x3')]||'';this[_0x7772('0x4')]=_0x4d1632[_0x7772('0x4')]||'';this[_0x7772('0x5')]=_0x4d1632['token']||'';this['tokenSecret']=_0x4d1632[_0x7772('0x6')]||'';this[_0x7772('0x7')]=_0x4d1632[_0x7772('0x7')]||'';this['serverUrl']=_0x4d1632['serverUrl']||'';this[_0x7772('0x8')]=_0x4d1632[_0x7772('0x8')]||{};}module[_0x7772('0x9')]=DeskAccount; \ No newline at end of file +var _0x3909=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','type','serverUrl','Configurations'];(function(_0x192075,_0x26bba8){var _0x83a160=function(_0x5d7274){while(--_0x5d7274){_0x192075['push'](_0x192075['shift']());}};_0x83a160(++_0x26bba8);}(_0x3909,0x176));var _0x9390=function(_0x3a1b90,_0x3c0158){_0x3a1b90=_0x3a1b90-0x0;var _0xf6de77=_0x3909[_0x3a1b90];return _0xf6de77;};'use strict';function DeskAccount(_0x48c9f2){this['id']=_0x48c9f2['id']||0x0;this[_0x9390('0x0')]=_0x48c9f2['name']||'';this[_0x9390('0x1')]=_0x48c9f2[_0x9390('0x1')]||'';this[_0x9390('0x2')]=_0x48c9f2[_0x9390('0x2')]||'';this[_0x9390('0x3')]=_0x48c9f2['authType']||'';this[_0x9390('0x4')]=_0x48c9f2['password']||'';this[_0x9390('0x5')]=_0x48c9f2['consumerKey']||'';this[_0x9390('0x6')]=_0x48c9f2[_0x9390('0x6')]||'';this['token']=_0x48c9f2['token']||'';this[_0x9390('0x7')]=_0x48c9f2[_0x9390('0x7')]||'';this[_0x9390('0x8')]=_0x48c9f2[_0x9390('0x8')]||'';this[_0x9390('0x9')]=_0x48c9f2[_0x9390('0x9')]||'';this['Configurations']=_0x48c9f2[_0x9390('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9e3064d..face2ac 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 _0x714b=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x44e843,_0x18e958){var _0x4f0a2d=function(_0xd7cb2){while(--_0xd7cb2){_0x44e843['push'](_0x44e843['shift']());}};_0x4f0a2d(++_0x18e958);}(_0x714b,0x1b7));var _0xb714=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x714b[_0x5b644e];return _0x49c6bf;};'use strict';function Dynamics365Account(_0x2f6781){this['id']=_0x2f6781['id']||0x0;this['name']=_0x2f6781[_0xb714('0x0')]||'';this[_0xb714('0x1')]=_0x2f6781['username']||'';this['password']=_0x2f6781[_0xb714('0x2')]||'';this[_0xb714('0x3')]=_0x2f6781[_0xb714('0x3')]||'';this[_0xb714('0x4')]=_0x2f6781['tenantId']||'';this[_0xb714('0x5')]=_0x2f6781[_0xb714('0x5')]||'';this[_0xb714('0x6')]=_0x2f6781['clientSecret']||{};this[_0xb714('0x7')]=_0x2f6781[_0xb714('0x7')]||'';this[_0xb714('0x8')]=_0x2f6781[_0xb714('0x8')]||![];this[_0xb714('0x9')]=_0x2f6781[_0xb714('0x9')]||{};this[_0xb714('0xa')]=_0x2f6781['CloudProvider']||{};}module[_0xb714('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xfd3e=['CloudProvider','exports','name','username','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x166bf6,_0x36f715){var _0x436d0e=function(_0x47b984){while(--_0x47b984){_0x166bf6['push'](_0x166bf6['shift']());}};_0x436d0e(++_0x36f715);}(_0xfd3e,0x178));var _0xefd3=function(_0x164f99,_0x37dd89){_0x164f99=_0x164f99-0x0;var _0x1d49ad=_0xfd3e[_0x164f99];return _0x1d49ad;};'use strict';function Dynamics365Account(_0x1d7a83){this['id']=_0x1d7a83['id']||0x0;this['name']=_0x1d7a83[_0xefd3('0x0')]||'';this['username']=_0x1d7a83[_0xefd3('0x1')]||'';this[_0xefd3('0x2')]=_0x1d7a83[_0xefd3('0x2')]||'';this[_0xefd3('0x3')]=_0x1d7a83['remoteUri']||'';this['tenantId']=_0x1d7a83['tenantId']||'';this[_0xefd3('0x4')]=_0x1d7a83[_0xefd3('0x4')]||'';this[_0xefd3('0x5')]=_0x1d7a83[_0xefd3('0x5')]||{};this['serverUrl']=_0x1d7a83[_0xefd3('0x6')]||'';this[_0xefd3('0x7')]=_0x1d7a83[_0xefd3('0x7')]||![];this['Configurations']=_0x1d7a83[_0xefd3('0x8')]||{};this[_0xefd3('0x9')]=_0x1d7a83[_0xefd3('0x9')]||{};}module[_0xefd3('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a77c330..e5a943b 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 _0x0d71=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo'];(function(_0x10526d,_0x361ca5){var _0x2ca5cf=function(_0x510554){while(--_0x510554){_0x10526d['push'](_0x10526d['shift']());}};_0x2ca5cf(++_0x361ca5);}(_0x0d71,0x1a1));var _0x10d7=function(_0x389e4c,_0x316962){_0x389e4c=_0x389e4c-0x0;var _0x136593=_0x0d71[_0x389e4c];return _0x136593;};'use strict';function FaxAccount(_0x53b775){this['id']=_0x53b775['id']||0x0;this[_0x10d7('0x0')]=_0x53b775['name']||'';this['description']=_0x53b775['description'];this['ecm']=_0x53b775[_0x10d7('0x1')];this['headerinfo']=_0x53b775[_0x10d7('0x2')];this[_0x10d7('0x3')]=_0x53b775[_0x10d7('0x3')];this[_0x10d7('0x4')]=_0x53b775[_0x10d7('0x4')]||0x960;this[_0x10d7('0x5')]=_0x53b775[_0x10d7('0x5')]||0x3840;this[_0x10d7('0x6')]=_0x53b775[_0x10d7('0x6')]||_0x10d7('0x7');this[_0x10d7('0x8')]=_0x53b775[_0x10d7('0x8')]||'no';this[_0x10d7('0x9')]=_0x53b775[_0x10d7('0x9')]||'no';this['t38timeout']=_0x53b775['t38timeout']||0x1388;this['tech']=_0x53b775['tech']||_0x10d7('0xa');this['Trunk']=_0x53b775['Trunk']?_0x53b775[_0x10d7('0xb')]:undefined;this['ListId']=_0x53b775[_0x10d7('0xc')];this[_0x10d7('0xd')]=_0x53b775[_0x10d7('0xd')];}module[_0x10d7('0xe')]=FaxAccount; \ No newline at end of file +var _0x616d=['maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','minrate'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x616d,0x173));var _0xd616=function(_0x50ddf9,_0x4f4cae){_0x50ddf9=_0x50ddf9-0x0;var _0x26394c=_0x616d[_0x50ddf9];return _0x26394c;};'use strict';function FaxAccount(_0x225de9){this['id']=_0x225de9['id']||0x0;this['name']=_0x225de9['name']||'';this[_0xd616('0x0')]=_0x225de9[_0xd616('0x0')];this['ecm']=_0x225de9[_0xd616('0x1')];this[_0xd616('0x2')]=_0x225de9[_0xd616('0x2')];this['localstationid']=_0x225de9['localstationid'];this[_0xd616('0x3')]=_0x225de9['minrate']||0x960;this['maxrate']=_0x225de9[_0xd616('0x4')]||0x3840;this[_0xd616('0x5')]=_0x225de9[_0xd616('0x5')]||'v17,v27,v29';this[_0xd616('0x6')]=_0x225de9[_0xd616('0x6')]||'no';this[_0xd616('0x7')]=_0x225de9[_0xd616('0x7')]||'no';this[_0xd616('0x8')]=_0x225de9['t38timeout']||0x1388;this[_0xd616('0x9')]=_0x225de9[_0xd616('0x9')]||_0xd616('0xa');this[_0xd616('0xb')]=_0x225de9['Trunk']?_0x225de9[_0xd616('0xb')]:undefined;this['ListId']=_0x225de9[_0xd616('0xc')];this[_0xd616('0xd')]=_0x225de9[_0xd616('0xd')];}module[_0xd616('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c9ca773..bbc782b 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 _0x74f5=['Configurations','exports','name','apiKey','token','remoteUri','serverUrl'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x74f5,0x136));var _0x574f=function(_0x554292,_0x82948a){_0x554292=_0x554292-0x0;var _0x3dd555=_0x74f5[_0x554292];return _0x3dd555;};'use strict';function FreshdeskAccount(_0x1606ba){this['id']=_0x1606ba['id']||0x0;this[_0x574f('0x0')]=_0x1606ba[_0x574f('0x0')]||'';this['username']=_0x1606ba['username']||'';this[_0x574f('0x1')]=_0x1606ba[_0x574f('0x2')]||'';this[_0x574f('0x3')]=_0x1606ba['remoteUri']||'';this[_0x574f('0x4')]=_0x1606ba['serverUrl']||'';this[_0x574f('0x5')]=_0x1606ba[_0x574f('0x5')]||{};}module[_0x574f('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x105e=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x5420ef,_0x4197c5){var _0x33d4f9=function(_0x5d1ed6){while(--_0x5d1ed6){_0x5420ef['push'](_0x5420ef['shift']());}};_0x33d4f9(++_0x4197c5);}(_0x105e,0x111));var _0xe105=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x105e[_0x14add3];return _0x4a174f;};'use strict';function FreshdeskAccount(_0x2bb173){this['id']=_0x2bb173['id']||0x0;this[_0xe105('0x0')]=_0x2bb173[_0xe105('0x0')]||'';this[_0xe105('0x1')]=_0x2bb173[_0xe105('0x1')]||'';this['apiKey']=_0x2bb173[_0xe105('0x2')]||'';this[_0xe105('0x3')]=_0x2bb173[_0xe105('0x3')]||'';this[_0xe105('0x4')]=_0x2bb173[_0xe105('0x4')]||'';this[_0xe105('0x5')]=_0x2bb173[_0xe105('0x5')]||{};}module[_0xe105('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4d486f4..0bba227 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 _0xfb15=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xfb15,0x12f));var _0x5fb1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfb15[_0x2b4411];return _0x8e41ef;};'use strict';function FreshsalesAccount(_0x4039b1){this['id']=_0x4039b1['id']||0x0;this[_0x5fb1('0x0')]=_0x4039b1[_0x5fb1('0x0')]||'';this[_0x5fb1('0x1')]=_0x4039b1[_0x5fb1('0x1')]||'';this[_0x5fb1('0x2')]=_0x4039b1['token']||'';this[_0x5fb1('0x3')]=_0x4039b1[_0x5fb1('0x3')]||'';this[_0x5fb1('0x4')]=_0x4039b1[_0x5fb1('0x4')]||'';this[_0x5fb1('0x5')]=_0x4039b1[_0x5fb1('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x0845=['apiKey','token','remoteUri','serverUrl','Configurations','username'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x0845,0x125));var _0x5084=function(_0x381d90,_0x4b99fc){_0x381d90=_0x381d90-0x0;var _0x4f96db=_0x0845[_0x381d90];return _0x4f96db;};'use strict';function FreshsalesAccount(_0x4b0786){this['id']=_0x4b0786['id']||0x0;this['name']=_0x4b0786['name']||'';this[_0x5084('0x0')]=_0x4b0786[_0x5084('0x0')]||'';this[_0x5084('0x1')]=_0x4b0786[_0x5084('0x2')]||'';this[_0x5084('0x3')]=_0x4b0786[_0x5084('0x3')]||'';this['serverUrl']=_0x4b0786[_0x5084('0x4')]||'';this[_0x5084('0x5')]=_0x4b0786[_0x5084('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 663ca39..ed7031d 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 _0xae44=['accountcode','context','exten','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xae44,0x6b));var _0x4ae4=function(_0x5ee71e,_0x28e6bf){_0x5ee71e=_0x5ee71e-0x0;var _0x1675b1=_0xae44[_0x5ee71e];return _0x1675b1;};'use strict';function QueueReport(){this[_0x4ae4('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this[_0x4ae4('0x1')]='';this[_0x4ae4('0x2')]=null;this[_0x4ae4('0x3')]=null;this[_0x4ae4('0x4')]=0x1;this[_0x4ae4('0x5')]=0x1;this['queuecallerabandon']=![];this[_0x4ae4('0x6')]=null;this[_0x4ae4('0x7')]=![];this['queuecallercompleteAt']=null;this[_0x4ae4('0x8')]=![];this[_0x4ae4('0x9')]=null;this[_0x4ae4('0xa')]=0x1;this[_0x4ae4('0xb')]='';this[_0x4ae4('0xc')]='';this['connectedlinename']='';this[_0x4ae4('0xd')]='';this[_0x4ae4('0xe')]='';this[_0x4ae4('0xf')]='';this['priority']='';this['holdtime']=0x0;this[_0x4ae4('0x10')]=![];this[_0x4ae4('0x11')]='';this[_0x4ae4('0x12')]=_0x4ae4('0x13');this[_0x4ae4('0x14')]=null;this[_0x4ae4('0x15')]=0x0;this[_0x4ae4('0x16')]={};}module[_0x4ae4('0x17')]=QueueReport; \ No newline at end of file +var _0xa14e=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','voice','routealias','mohtime','exports','type','inbound','uniqueid','queue','queuecallerleaveAt','position','count'];(function(_0x4f012f,_0x3fe164){var _0x4c0d32=function(_0x2859ba){while(--_0x2859ba){_0x4f012f['push'](_0x4f012f['shift']());}};_0x4c0d32(++_0x3fe164);}(_0xa14e,0x1c4));var _0xea14=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa14e[_0x465a0c];return _0x1e202e;};'use strict';function QueueReport(){this[_0xea14('0x0')]=_0xea14('0x1');this[_0xea14('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xea14('0x3')]='';this['queuecallerjoinAt']=null;this[_0xea14('0x4')]=null;this[_0xea14('0x5')]=0x1;this[_0xea14('0x6')]=0x1;this[_0xea14('0x7')]=![];this[_0xea14('0x8')]=null;this[_0xea14('0x9')]=![];this[_0xea14('0xa')]=null;this[_0xea14('0xb')]=![];this[_0xea14('0xc')]=null;this[_0xea14('0xd')]=0x1;this[_0xea14('0xe')]='';this[_0xea14('0xf')]='';this[_0xea14('0x10')]='';this[_0xea14('0x11')]='';this[_0xea14('0x12')]='';this[_0xea14('0x13')]='';this[_0xea14('0x14')]='';this[_0xea14('0x15')]=0x0;this['assigned']=![];this[_0xea14('0x16')]='';this['motionChannel']=_0xea14('0x17');this[_0xea14('0x18')]=null;this[_0xea14('0x19')]=0x0;this['variables']={};}module[_0xea14('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c74f3f6..0d827c0 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 _0x70e9=['clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','clientId'];(function(_0xe6caab,_0xfb174f){var _0x5e6857=function(_0x3d8903){while(--_0x3d8903){_0xe6caab['push'](_0xe6caab['shift']());}};_0x5e6857(++_0xfb174f);}(_0x70e9,0x1d2));var _0x970e=function(_0x513a31,_0x2f3925){_0x513a31=_0x513a31-0x0;var _0x141500=_0x70e9[_0x513a31];return _0x141500;};'use strict';function SalesforceAccount(_0x216368){this['id']=_0x216368['id']||0x0;this[_0x970e('0x0')]=_0x216368[_0x970e('0x0')]||'';this[_0x970e('0x1')]=_0x216368[_0x970e('0x1')]||'';this[_0x970e('0x2')]=_0x216368[_0x970e('0x2')]||'';this['password']=_0x216368['password']||'';this[_0x970e('0x3')]=_0x216368['clientId']||'';this['clientSecret']=_0x216368[_0x970e('0x4')]||'';this[_0x970e('0x5')]=_0x216368['securityToken']||'';this[_0x970e('0x6')]=_0x216368[_0x970e('0x6')]||'integrationTab';this['serverUrl']=_0x216368[_0x970e('0x7')]||'';this[_0x970e('0x8')]=_0x216368[_0x970e('0x8')]||{};}module[_0x970e('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x1555=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x3d5cbb,_0x42b211){var _0x8161c7=function(_0x21594e){while(--_0x21594e){_0x3d5cbb['push'](_0x3d5cbb['shift']());}};_0x8161c7(++_0x42b211);}(_0x1555,0x12d));var _0x5155=function(_0x10e128,_0x4bd83e){_0x10e128=_0x10e128-0x0;var _0x567da1=_0x1555[_0x10e128];return _0x567da1;};'use strict';function SalesforceAccount(_0xf2b77){this['id']=_0xf2b77['id']||0x0;this[_0x5155('0x0')]=_0xf2b77[_0x5155('0x0')]||'';this['username']=_0xf2b77[_0x5155('0x1')]||'';this[_0x5155('0x2')]=_0xf2b77[_0x5155('0x2')]||'';this[_0x5155('0x3')]=_0xf2b77[_0x5155('0x3')]||'';this['clientId']=_0xf2b77[_0x5155('0x4')]||'';this[_0x5155('0x5')]=_0xf2b77['clientSecret']||'';this[_0x5155('0x6')]=_0xf2b77[_0x5155('0x6')]||'';this[_0x5155('0x7')]=_0xf2b77[_0x5155('0x7')]||_0x5155('0x8');this[_0x5155('0x9')]=_0xf2b77['serverUrl']||'';this[_0x5155('0xa')]=_0xf2b77[_0x5155('0xa')]||{};}module[_0x5155('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 bc50350..b9e0b95 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 _0xee4e=['remoteUri','serverUrl','Configurations','username','password'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xee4e,0x99));var _0xeee4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xee4e[_0x49ca18];return _0x145d54;};'use strict';function ServicenowAccount(_0x475ecf){this['id']=_0x475ecf['id']||0x0;this['name']=_0x475ecf['name']||'';this[_0xeee4('0x0')]=_0x475ecf[_0xeee4('0x0')]||'';this[_0xeee4('0x1')]=_0x475ecf[_0xeee4('0x1')]||'';this[_0xeee4('0x2')]=_0x475ecf['remoteUri']||'';this[_0xeee4('0x3')]=_0x475ecf[_0xeee4('0x3')]||'';this[_0xeee4('0x4')]=_0x475ecf[_0xeee4('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xedc3=['name','username','password','remoteUri','Configurations','exports'];(function(_0x4a47a5,_0x50a519){var _0x223ec6=function(_0x394eeb){while(--_0x394eeb){_0x4a47a5['push'](_0x4a47a5['shift']());}};_0x223ec6(++_0x50a519);}(_0xedc3,0x132));var _0x3edc=function(_0x16d18b,_0x688757){_0x16d18b=_0x16d18b-0x0;var _0x497590=_0xedc3[_0x16d18b];return _0x497590;};'use strict';function ServicenowAccount(_0x3bca57){this['id']=_0x3bca57['id']||0x0;this[_0x3edc('0x0')]=_0x3bca57[_0x3edc('0x0')]||'';this[_0x3edc('0x1')]=_0x3bca57['username']||'';this[_0x3edc('0x2')]=_0x3bca57[_0x3edc('0x2')]||'';this[_0x3edc('0x3')]=_0x3bca57[_0x3edc('0x3')]||'';this['serverUrl']=_0x3bca57['serverUrl']||'';this[_0x3edc('0x4')]=_0x3bca57[_0x3edc('0x4')]||{};}module[_0x3edc('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index aad28d6..47d1f60 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 _0x660d=['name','password','remoteUri','serverUrl','Configurations'];(function(_0x50e757,_0x2c2a81){var _0x456f7a=function(_0x3ac690){while(--_0x3ac690){_0x50e757['push'](_0x50e757['shift']());}};_0x456f7a(++_0x2c2a81);}(_0x660d,0x69));var _0xd660=function(_0x45de51,_0x48c2f8){_0x45de51=_0x45de51-0x0;var _0x3eeb02=_0x660d[_0x45de51];return _0x3eeb02;};'use strict';function SugarcrmAccount(_0x56e658){this['id']=_0x56e658['id']||0x0;this[_0xd660('0x0')]=_0x56e658[_0xd660('0x0')]||'';this['username']=_0x56e658['username']||'';this['password']=_0x56e658[_0xd660('0x1')]||'';this[_0xd660('0x2')]=_0x56e658[_0xd660('0x2')]||'';this[_0xd660('0x3')]=_0x56e658[_0xd660('0x3')]||'';this['Configurations']=_0x56e658[_0xd660('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x0233=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2789d4,_0x55ba4c){var _0x21a2e1=function(_0x36d052){while(--_0x36d052){_0x2789d4['push'](_0x2789d4['shift']());}};_0x21a2e1(++_0x55ba4c);}(_0x0233,0x1b0));var _0x3023=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x0233[_0xfa634c];return _0x73e478;};'use strict';function SugarcrmAccount(_0x3b50c9){this['id']=_0x3b50c9['id']||0x0;this[_0x3023('0x0')]=_0x3b50c9[_0x3023('0x0')]||'';this[_0x3023('0x1')]=_0x3b50c9[_0x3023('0x1')]||'';this['password']=_0x3b50c9[_0x3023('0x2')]||'';this[_0x3023('0x3')]=_0x3b50c9[_0x3023('0x3')]||'';this[_0x3023('0x4')]=_0x3b50c9['serverUrl']||'';this[_0x3023('0x5')]=_0x3b50c9[_0x3023('0x5')]||{};}module[_0x3023('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 124a8c5..f5234d4 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 _0x5554=['accountcode','state','stateTime','status','exports','name'];(function(_0x1b7255,_0x3e9700){var _0x25ccc5=function(_0x2d3963){while(--_0x2d3963){_0x1b7255['push'](_0x1b7255['shift']());}};_0x25ccc5(++_0x3e9700);}(_0x5554,0x167));var _0x4555=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x5554[_0xf0bcac];return _0x4e4c65;};'use strict';function Telephone(_0x1e8ef3){this['id']=_0x1e8ef3['id']||0x0;this[_0x4555('0x0')]=_0x1e8ef3['name']||'';this['accountcode']=_0x1e8ef3[_0x4555('0x1')]||'';this[_0x4555('0x2')]='unknown';this[_0x4555('0x3')]=0x0;this[_0x4555('0x4')]='unknown';this['address']='';}module[_0x4555('0x5')]=Telephone; \ No newline at end of file +var _0x1123=['state','unknown','address','exports','name','accountcode'];(function(_0x4ba709,_0x21c294){var _0x534b43=function(_0x4d2583){while(--_0x4d2583){_0x4ba709['push'](_0x4ba709['shift']());}};_0x534b43(++_0x21c294);}(_0x1123,0x118));var _0x3112=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1123[_0x4565bf];return _0x5610ba;};'use strict';function Telephone(_0x266e5e){this['id']=_0x266e5e['id']||0x0;this['name']=_0x266e5e[_0x3112('0x0')]||'';this['accountcode']=_0x266e5e[_0x3112('0x1')]||'';this[_0x3112('0x2')]=_0x3112('0x3');this['stateTime']=0x0;this['status']=_0x3112('0x3');this[_0x3112('0x4')]='';}module[_0x3112('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 578d906..a155f1c 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(_0xcc0cc1,_0x442d1e){var _0x3e7680=function(_0xf69e3){while(--_0xf69e3){_0xcc0cc1['push'](_0xcc0cc1['shift']());}};_0x3e7680(++_0x442d1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x346389,_0x34fc3d){var _0x508618=function(_0x3c10ff){while(--_0x3c10ff){_0x346389['push'](_0x346389['shift']());}};_0x508618(++_0x34fc3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 2afec6a..edb2d9f 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x7fc571,_0x1ea439){var _0x1fd60c=function(_0x348716){while(--_0x348716){_0x7fc571['push'](_0x7fc571['shift']());}};_0x1fd60c(++_0x1ea439);}(_0xda2d,0x102));var _0xdda2=function(_0x26c704,_0x594b6b){_0x26c704=_0x26c704-0x0;var _0x5e70af=_0xda2d[_0x26c704];return _0x5e70af;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1a85,0x178));var _0x51a8=function(_0x3072e2,_0x648a09){_0x3072e2=_0x3072e2-0x0;var _0x42c45b=_0x1a85[_0x3072e2];return _0x42c45b;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index eb189aa..3543276 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 _0x0b1b=['domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x0b1b,0x1af));var _0xb0b1=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x0b1b[_0x22b68a];return _0x1ac67a;};'use strict';function Trunk(_0x4c7fff){this['id']=_0x4c7fff['id']||0x0;this[_0xb0b1('0x0')]=_0x4c7fff[_0xb0b1('0x0')]||![];this[_0xb0b1('0x1')]=_0x4c7fff[_0xb0b1('0x1')]||'';this[_0xb0b1('0x2')]=_0xb0b1('0x3');this[_0xb0b1('0x4')]=0x0;this[_0xb0b1('0x5')]=_0xb0b1('0x3');this[_0xb0b1('0x6')]=_0x4c7fff['registry']&&_0x4c7fff['registry'][_0xb0b1('0x7')](':')?_0x4c7fff[_0xb0b1('0x6')][_0xb0b1('0x8')](':')[0x0]:'';this[_0xb0b1('0x9')]='';this['port']='';this[_0xb0b1('0xa')]='';this[_0xb0b1('0xb')]='';this[_0xb0b1('0xc')]='';this['stateRegistry']=_0xb0b1('0x3');this[_0xb0b1('0xd')]='';this[_0xb0b1('0xe')]='';this[_0xb0b1('0xf')]=_0x4c7fff['defaultuser']||'';}module[_0xb0b1('0x10')]=Trunk; \ No newline at end of file +var _0x117e=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','unknown','registry','indexOf','host','port','domain'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x117e,0x16c));var _0xe117=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x117e[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x27190f){this['id']=_0x27190f['id']||0x0;this[_0xe117('0x0')]=_0x27190f[_0xe117('0x0')]||![];this[_0xe117('0x1')]=_0x27190f[_0xe117('0x1')]||'';this[_0xe117('0x2')]='unknown';this[_0xe117('0x3')]=0x0;this['status']=_0xe117('0x4');this[_0xe117('0x5')]=_0x27190f[_0xe117('0x5')]&&_0x27190f[_0xe117('0x5')][_0xe117('0x6')](':')?_0x27190f[_0xe117('0x5')]['split'](':')[0x0]:'';this[_0xe117('0x7')]='';this[_0xe117('0x8')]='';this[_0xe117('0x9')]='';this[_0xe117('0xa')]='';this[_0xe117('0xb')]='';this[_0xe117('0xc')]=_0xe117('0x4');this[_0xe117('0xd')]='';this[_0xe117('0xe')]='';this[_0xe117('0xf')]=_0x27190f[_0xe117('0xf')]||'';}module[_0xe117('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 6ae1c66..0f12643 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 _0x9a31=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x4945e0,_0x990c5c){var _0x511777=function(_0x37c7b7){while(--_0x37c7b7){_0x4945e0['push'](_0x4945e0['shift']());}};_0x511777(++_0x990c5c);}(_0x9a31,0x169));var _0x19a3=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x9a31[_0x101a17];return _0x3b76ee;};'use strict';function voiceExtension(_0x3ffba6){this['id']=_0x3ffba6['id']||0x0;this[_0x19a3('0x0')]=_0x3ffba6[_0x19a3('0x0')]||'';this[_0x19a3('0x1')]=_0x3ffba6['recordingFormat']||_0x19a3('0x2');this['mandatoryDisposition']=_0x3ffba6[_0x19a3('0x3')]||![];}module[_0x19a3('0x4')]=voiceExtension; \ No newline at end of file +var _0x702b=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x12bc24,_0x301e70){var _0x37f860=function(_0x51b756){while(--_0x51b756){_0x12bc24['push'](_0x12bc24['shift']());}};_0x37f860(++_0x301e70);}(_0x702b,0x98));var _0xb702=function(_0x4d49b1,_0x2c7985){_0x4d49b1=_0x4d49b1-0x0;var _0x165cc2=_0x702b[_0x4d49b1];return _0x165cc2;};'use strict';function voiceExtension(_0x9877bb){this['id']=_0x9877bb['id']||0x0;this['exten']=_0x9877bb[_0xb702('0x0')]||'';this[_0xb702('0x1')]=_0x9877bb[_0xb702('0x1')]||_0xb702('0x2');this['mandatoryDisposition']=_0x9877bb[_0xb702('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 01a0ab0..b259ce4 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 _0x4845=['dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','unmanaged','abandoned','busy','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4845,0x165));var _0x5484=function(_0x2cda96,_0x30e611){_0x2cda96=_0x2cda96-0x0;var _0x5e82fa=_0x4845[_0x2cda96];return _0x5e82fa;};'use strict';var monitorFormat={'wav':_0x5484('0x0'),'wav49':_0x5484('0x1'),'gsm':_0x5484('0x2')};var strategy={'fewestcalls':_0x5484('0x3'),'leastrecent':_0x5484('0x4'),'linear':_0x5484('0x5'),'random':_0x5484('0x6'),'ringall':'ringall','rr':_0x5484('0x7'),'rrmemory':_0x5484('0x8'),'rrordered':_0x5484('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x2f38e6){this['id']=_0x2f38e6['id']||0x0;this[_0x5484('0xa')]=_0x2f38e6[_0x5484('0xa')]||'';this[_0x5484('0xb')]=_0x2f38e6[_0x5484('0xb')]||'';this[_0x5484('0xc')]=_0x2f38e6[_0x5484('0xc')]||_0x5484('0xd');this[_0x5484('0xe')]=0x0;this[_0x5484('0xf')]=0x0;this['answered']=0x0;this[_0x5484('0x10')]=0x0;this[_0x5484('0x11')]=0x0;this['sumBillable']=0x0;this[_0x5484('0x12')]=0x0;this[_0x5484('0x13')]=0x0;this['available']=0x0;this[_0x5484('0x14')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0x5484('0x15')]=0x0;this[_0x5484('0x16')]=0x0;this['onHold']=0x0;this[_0x5484('0x17')]=0x0;this[_0x5484('0x18')]=0x0;this[_0x5484('0x19')]=0x0;this[_0x5484('0x1a')]=0x0;this[_0x5484('0x1b')]=0x0;this[_0x5484('0x1c')]=0x0;this[_0x5484('0x1d')]=_0x2f38e6[_0x5484('0x1d')]||![];this['acwTimeout']=_0x2f38e6[_0x5484('0x1e')]||0xa;this['autopause']=_0x2f38e6['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x5484('0x1f')]='';this[_0x5484('0x20')]=0x0;this[_0x5484('0x21')]=0x0;this[_0x5484('0x22')]=_0x2f38e6[_0x5484('0x22')]||null;this[_0x5484('0x23')]=_0x2f38e6['dialGlobalInterval']?_0x2f38e6[_0x5484('0x23')]:null;this[_0x5484('0x24')]=_0x2f38e6[_0x5484('0x24')];this[_0x5484('0x25')]=_0x2f38e6[_0x5484('0x25')]||_0x5484('0x26');this['dialLimitChannel']=_0x2f38e6['dialLimitChannel']||0x0;this[_0x5484('0x27')]=_0x2f38e6[_0x5484('0x27')]||0x0;this[_0x5484('0x28')]=_0x2f38e6[_0x5484('0x28')]||0x1;this[_0x5484('0x29')]=_0x2f38e6['dialPredictiveOptimization']||_0x5484('0x2a');this[_0x5484('0x2b')]=_0x2f38e6[_0x5484('0x2b')]||0.03;this['dialPredictiveInterval']=_0x2f38e6[_0x5484('0x2c')]||0x258;this[_0x5484('0x2d')]=_0x2f38e6[_0x5484('0x2d')]||_0x5484('0x2e');this['dialOriginateCallerIdNumber']=_0x2f38e6[_0x5484('0x2f')]||'anonymous';this[_0x5484('0x30')]=_0x2f38e6['dialOriginateTimeout']||0x1e;this[_0x5484('0x31')]=_0x2f38e6['dialQueueOptions']||_0x5484('0x32');this['dialQueueTimeout']=_0x2f38e6['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x2f38e6[_0x5484('0x33')]||undefined;this['dialCongestionMaxRetry']=_0x2f38e6[_0x5484('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x2f38e6[_0x5484('0x35')]||0x96;this['dialBusyMaxRetry']=_0x2f38e6[_0x5484('0x36')]||0x3;this[_0x5484('0x37')]=_0x2f38e6[_0x5484('0x37')]||0x96;this['dialNoAnswerMaxRetry']=_0x2f38e6[_0x5484('0x38')]||0x3;this[_0x5484('0x39')]=_0x2f38e6['dialNoAnswerRetryFrequency']||0x96;this[_0x5484('0x3a')]=_0x2f38e6['dialNoSuchNumberMaxRetry']||0x3;this[_0x5484('0x3b')]=_0x2f38e6[_0x5484('0x3b')]||0x96;this[_0x5484('0x3c')]=_0x2f38e6[_0x5484('0x3c')]||0x3;this[_0x5484('0x3d')]=_0x2f38e6['dialDropRetryFrequency']||0x96;this[_0x5484('0x3e')]=_0x2f38e6['dialAbandonedMaxRetry']||0x3;this[_0x5484('0x3f')]=_0x2f38e6[_0x5484('0x3f')]||0x96;this[_0x5484('0x40')]=_0x2f38e6[_0x5484('0x40')]||0x3;this[_0x5484('0x41')]=_0x2f38e6[_0x5484('0x41')]||0x96;this[_0x5484('0x42')]=_0x2f38e6[_0x5484('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2f38e6[_0x5484('0x43')]||0x96;this[_0x5484('0x44')]=_0x2f38e6[_0x5484('0x44')]||0x3;this[_0x5484('0x45')]=_0x2f38e6[_0x5484('0x45')]||0x4;this[_0x5484('0x46')]=_0x2f38e6['Trunk']?_0x2f38e6['Trunk']:undefined;this['TrunkBackup']=_0x2f38e6['TrunkBackup']?_0x2f38e6[_0x5484('0x47')]:undefined;this[_0x5484('0x48')]=_0x2f38e6[_0x5484('0x48')]||undefined;this[_0x5484('0x49')]=_0x2f38e6['Interval']?_0x2f38e6[_0x5484('0x49')]:undefined;this[_0x5484('0x4a')]=_0x2f38e6[_0x5484('0x4a')]||_0x5484('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x2f38e6[_0x5484('0x4c')]||undefined;this['dialCutDigit']=_0x2f38e6[_0x5484('0x4d')]||undefined;this[_0x5484('0x4e')]=strategy[_0x2f38e6[_0x5484('0x4e')]];this['queueStatusComplete']=!![];this[_0x5484('0x4f')]=_0x2f38e6[_0x5484('0x4f')]||![];this[_0x5484('0x50')]=_0x2f38e6['dialAMDInitialSilence'];this[_0x5484('0x51')]=_0x2f38e6[_0x5484('0x51')];this['dialAMDAfterGreetingSilence']=_0x2f38e6[_0x5484('0x52')];this[_0x5484('0x53')]=_0x2f38e6[_0x5484('0x53')];this[_0x5484('0x54')]=_0x2f38e6[_0x5484('0x54')];this[_0x5484('0x55')]=_0x2f38e6[_0x5484('0x55')];this[_0x5484('0x56')]=_0x2f38e6[_0x5484('0x56')];this[_0x5484('0x57')]=_0x2f38e6[_0x5484('0x57')];this['dialAMDMaximumWordLength']=_0x2f38e6[_0x5484('0x58')];this[_0x5484('0x59')]=0x0;this[_0x5484('0x5a')]=0x0;this[_0x5484('0x5b')]=_0x2f38e6['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x5484('0x5c')]=0x0;this[_0x5484('0x5d')]=0x0;this[_0x5484('0x5e')]=0x0;this[_0x5484('0x5f')]=0x0;this[_0x5484('0x60')]=0x0;this[_0x5484('0x61')]=0x0;this[_0x5484('0x62')]=0x0;this[_0x5484('0x63')]=0x0;this[_0x5484('0x64')]=0x0;this[_0x5484('0x65')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5484('0x66')]=0x0;this[_0x5484('0x67')]=0x0;this['startProgressive']=undefined;this[_0x5484('0x68')]=undefined;this[_0x5484('0x69')]=undefined;this[_0x5484('0x6a')]=1.05;this[_0x5484('0x6b')]=0x0;this[_0x5484('0x6c')]=0x0;this[_0x5484('0x6d')]=0x0;this[_0x5484('0x6e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x5484('0x6f')]=0x0;this[_0x5484('0x70')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x5484('0x71')]=_0x2f38e6[_0x5484('0x72')]||0x14;this[_0x5484('0x73')]=_0x2f38e6[_0x5484('0x72')]||0xa;this[_0x5484('0x74')]=0x0;this[_0x5484('0x75')]=0x0;this[_0x5484('0x76')]=0x1;this[_0x5484('0x77')]=0x0;this[_0x5484('0x78')]=0x0;this[_0x5484('0x79')]=0x0;this[_0x5484('0x7a')]=0x0;this[_0x5484('0x7b')]=_0x2f38e6[_0x5484('0x7b')]||0x1e;this[_0x5484('0x7c')]=_0x2f38e6[_0x5484('0x7c')]||![];this[_0x5484('0x7d')]=!!_0x2f38e6[_0x5484('0x7d')]||![];this[_0x5484('0x7e')]=!!_0x2f38e6['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x2f38e6[_0x5484('0x7f')]||undefined;this[_0x5484('0x80')]=_0x2f38e6[_0x5484('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x2f38e6[_0x5484('0x81')]||![];this[_0x5484('0xb')]=monitorFormat[_0x2f38e6[_0x5484('0xb')]]?monitorFormat[_0x2f38e6['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2f38e6[_0x5484('0x82')]||![];this[_0x5484('0x83')]=_0x2f38e6[_0x5484('0x83')]?_0x2f38e6[_0x5484('0x83')]:undefined;this[_0x5484('0x84')]=![];}module[_0x5484('0x85')]=VoiceQueue; \ No newline at end of file +var _0x2b5d=['sumBillable','unmanaged','available','busy','inUse','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','ringall','rrmemory','rrordered','wrandom','name','monitor_format','waiting','total','answered','sumDuration','sumHoldTime'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0x2b5d,0x76));var _0xd2b5=function(_0x51ca7c,_0xf3ea96){_0x51ca7c=_0x51ca7c-0x0;var _0x744328=_0x2b5d[_0x51ca7c];return _0x744328;};'use strict';var monitorFormat={'wav':_0xd2b5('0x0'),'wav49':_0xd2b5('0x1'),'gsm':_0xd2b5('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xd2b5('0x3'),'linear':'linear','random':'random','ringall':_0xd2b5('0x4'),'rr':'roundrobin','rrmemory':_0xd2b5('0x5'),'rrordered':_0xd2b5('0x6'),'wrandom':_0xd2b5('0x7')};function VoiceQueue(_0x1dcd28){this['id']=_0x1dcd28['id']||0x0;this[_0xd2b5('0x8')]=_0x1dcd28[_0xd2b5('0x8')]||'';this['monitor_format']=_0x1dcd28[_0xd2b5('0x9')]||'';this['type']=_0x1dcd28['type']||'inbound';this[_0xd2b5('0xa')]=0x0;this[_0xd2b5('0xb')]=0x0;this[_0xd2b5('0xc')]=0x0;this[_0xd2b5('0xd')]=0x0;this[_0xd2b5('0xe')]=0x0;this[_0xd2b5('0xf')]=0x0;this[_0xd2b5('0x10')]=0x0;this['abandoned']=0x0;this[_0xd2b5('0x11')]=0x0;this[_0xd2b5('0x12')]=0x0;this[_0xd2b5('0x13')]=0x0;this['invalid']=0x0;this[_0xd2b5('0x14')]=0x0;this[_0xd2b5('0x15')]=0x0;this[_0xd2b5('0x16')]=0x0;this['paused']=0x0;this[_0xd2b5('0x17')]=0x0;this[_0xd2b5('0x18')]=0x0;this[_0xd2b5('0x19')]=0x0;this[_0xd2b5('0x1a')]=0x0;this['unknown']=0x0;this[_0xd2b5('0x1b')]=_0x1dcd28[_0xd2b5('0x1b')]||![];this[_0xd2b5('0x1c')]=_0x1dcd28[_0xd2b5('0x1c')]||0xa;this[_0xd2b5('0x1d')]=_0x1dcd28[_0xd2b5('0x1d')]||'no';this[_0xd2b5('0x1e')]=!![];this[_0xd2b5('0x1f')]='';this[_0xd2b5('0x20')]='';this[_0xd2b5('0x21')]=0x0;this[_0xd2b5('0x22')]=0x0;this[_0xd2b5('0x23')]=_0x1dcd28[_0xd2b5('0x23')]||null;this[_0xd2b5('0x24')]=_0x1dcd28['dialGlobalInterval']?_0x1dcd28[_0xd2b5('0x24')]:null;this[_0xd2b5('0x25')]=_0x1dcd28[_0xd2b5('0x25')];this[_0xd2b5('0x26')]=_0x1dcd28[_0xd2b5('0x26')]||_0xd2b5('0x27');this[_0xd2b5('0x28')]=_0x1dcd28[_0xd2b5('0x28')]||0x0;this['dialLimitQueue']=_0x1dcd28[_0xd2b5('0x29')]||0x0;this[_0xd2b5('0x2a')]=_0x1dcd28[_0xd2b5('0x2a')]||0x1;this[_0xd2b5('0x2b')]=_0x1dcd28[_0xd2b5('0x2b')]||_0xd2b5('0x2c');this[_0xd2b5('0x2d')]=_0x1dcd28[_0xd2b5('0x2d')]||0.03;this[_0xd2b5('0x2e')]=_0x1dcd28[_0xd2b5('0x2e')]||0x258;this[_0xd2b5('0x2f')]=_0x1dcd28[_0xd2b5('0x2f')]||'anonymous';this[_0xd2b5('0x30')]=_0x1dcd28[_0xd2b5('0x30')]||'anonymous';this[_0xd2b5('0x31')]=_0x1dcd28[_0xd2b5('0x31')]||0x1e;this[_0xd2b5('0x32')]=_0x1dcd28[_0xd2b5('0x32')]||'tTxX';this[_0xd2b5('0x33')]=_0x1dcd28[_0xd2b5('0x33')]||0x3;this[_0xd2b5('0x34')]=_0x1dcd28['dialQueueProject']||undefined;this[_0xd2b5('0x35')]=_0x1dcd28['dialCongestionMaxRetry']||0x3;this[_0xd2b5('0x36')]=_0x1dcd28[_0xd2b5('0x36')]||0x96;this[_0xd2b5('0x37')]=_0x1dcd28[_0xd2b5('0x37')]||0x3;this[_0xd2b5('0x38')]=_0x1dcd28[_0xd2b5('0x38')]||0x96;this[_0xd2b5('0x39')]=_0x1dcd28['dialNoAnswerMaxRetry']||0x3;this[_0xd2b5('0x3a')]=_0x1dcd28[_0xd2b5('0x3a')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1dcd28[_0xd2b5('0x3b')]||0x3;this[_0xd2b5('0x3c')]=_0x1dcd28[_0xd2b5('0x3c')]||0x96;this[_0xd2b5('0x3d')]=_0x1dcd28[_0xd2b5('0x3d')]||0x3;this[_0xd2b5('0x3e')]=_0x1dcd28[_0xd2b5('0x3e')]||0x96;this['dialAbandonedMaxRetry']=_0x1dcd28[_0xd2b5('0x3f')]||0x3;this[_0xd2b5('0x40')]=_0x1dcd28[_0xd2b5('0x40')]||0x96;this[_0xd2b5('0x41')]=_0x1dcd28[_0xd2b5('0x41')]||0x3;this['dialMachineRetryFrequency']=_0x1dcd28[_0xd2b5('0x42')]||0x96;this[_0xd2b5('0x43')]=_0x1dcd28[_0xd2b5('0x43')]||0x3;this[_0xd2b5('0x44')]=_0x1dcd28['dialAgentRejectRetryFrequency']||0x96;this[_0xd2b5('0x45')]=_0x1dcd28[_0xd2b5('0x45')]||0x3;this[_0xd2b5('0x46')]=_0x1dcd28[_0xd2b5('0x46')]||0x4;this[_0xd2b5('0x47')]=_0x1dcd28['Trunk']?_0x1dcd28['Trunk']:undefined;this[_0xd2b5('0x48')]=_0x1dcd28[_0xd2b5('0x48')]?_0x1dcd28[_0xd2b5('0x48')]:undefined;this['dialPrefix']=_0x1dcd28[_0xd2b5('0x49')]||undefined;this[_0xd2b5('0x4a')]=_0x1dcd28[_0xd2b5('0x4a')]?_0x1dcd28[_0xd2b5('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x1dcd28[_0xd2b5('0x4b')]||_0xd2b5('0x4c');this[_0xd2b5('0x4d')]=_0x1dcd28[_0xd2b5('0x4d')]||undefined;this[_0xd2b5('0x4e')]=_0x1dcd28[_0xd2b5('0x4e')]||undefined;this['strategy']=strategy[_0x1dcd28[_0xd2b5('0x4f')]];this[_0xd2b5('0x50')]=!![];this['dialAMDActive']=_0x1dcd28[_0xd2b5('0x51')]||![];this[_0xd2b5('0x52')]=_0x1dcd28[_0xd2b5('0x52')];this[_0xd2b5('0x53')]=_0x1dcd28['dialAMDGreeting'];this[_0xd2b5('0x54')]=_0x1dcd28[_0xd2b5('0x54')];this[_0xd2b5('0x55')]=_0x1dcd28['dialAMDTotalAnalysisTime'];this[_0xd2b5('0x56')]=_0x1dcd28[_0xd2b5('0x56')];this[_0xd2b5('0x57')]=_0x1dcd28['dialAMDBetweenWordsSilence'];this[_0xd2b5('0x58')]=_0x1dcd28['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1dcd28[_0xd2b5('0x59')];this[_0xd2b5('0x5a')]=_0x1dcd28[_0xd2b5('0x5a')];this[_0xd2b5('0x5b')]=0x0;this[_0xd2b5('0x5c')]=0x0;this['timeout']=_0x1dcd28[_0xd2b5('0x5d')];this['outboundAnswerCallsDay']=0x0;this[_0xd2b5('0x5e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xd2b5('0x5f')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xd2b5('0x60')]=0x0;this[_0xd2b5('0x61')]=0x0;this[_0xd2b5('0x62')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xd2b5('0x63')]=0x0;this[_0xd2b5('0x64')]=0x0;this[_0xd2b5('0x65')]=0x0;this[_0xd2b5('0x66')]=0x0;this[_0xd2b5('0x67')]=0x0;this[_0xd2b5('0x68')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xd2b5('0x69')]=1.05;this[_0xd2b5('0x6a')]=0x0;this[_0xd2b5('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd2b5('0x6c')]=0x0;this[_0xd2b5('0x6d')]=0x0;this[_0xd2b5('0x6e')]=0x0;this[_0xd2b5('0x6f')]=0x0;this[_0xd2b5('0x70')]=0x0;this[_0xd2b5('0x71')]=_0x1dcd28['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xd2b5('0x72')]=_0x1dcd28[_0xd2b5('0x73')]||0xa;this[_0xd2b5('0x74')]=0x0;this[_0xd2b5('0x75')]=0x0;this[_0xd2b5('0x76')]=0x1;this[_0xd2b5('0x77')]=0x0;this[_0xd2b5('0x78')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd2b5('0x79')]=0x0;this['dialRecallMeTimeout']=_0x1dcd28[_0xd2b5('0x7a')]||0x1e;this['dialRecallInQueue']=_0x1dcd28[_0xd2b5('0x7b')]||![];this[_0xd2b5('0x7c')]=!!_0x1dcd28[_0xd2b5('0x7c')]||![];this[_0xd2b5('0x7d')]=!!_0x1dcd28[_0xd2b5('0x7d')]||![];this[_0xd2b5('0x7e')]=_0x1dcd28[_0xd2b5('0x7e')]||undefined;this['dialAgiAfterHangupClient']=_0x1dcd28[_0xd2b5('0x7f')]||![];this[_0xd2b5('0x80')]=_0x1dcd28['dialAgiAfterHangupAgent']||![];this[_0xd2b5('0x9')]=monitorFormat[_0x1dcd28['monitor_format']]?monitorFormat[_0x1dcd28['monitor_format']]:undefined;this['mandatoryDisposition']=_0x1dcd28[_0xd2b5('0x81')]||![];this[_0xd2b5('0x82')]=_0x1dcd28[_0xd2b5('0x82')]?_0x1dcd28['mandatoryDispositionPause']:undefined;this[_0xd2b5('0x83')]=![];}module[_0xd2b5('0x84')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 305d972..cfee989 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 _0xd6d2=['statusMessage','Trunk','callerid','prototype','createReport','loggedin','length','SIP/','online','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','loggedInDb','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x26415d,_0x2493a2){_0x26415d=_0x26415d-0x0;var _0x1f609a=_0xd6d2[_0x26415d];return _0x1f609a;};'use strict';var INBOUND_COUNTERS=[_0x2d6d('0x0'),_0x2d6d('0x1'),'loggedInDb',_0x2d6d('0x2'),_0x2d6d('0x3'),'talking',_0x2d6d('0x4')];var OUTBOUND_COUNTERS=['available',_0x2d6d('0x5'),_0x2d6d('0x6'),_0x2d6d('0x1'),'loggedInDb',_0x2d6d('0x7'),_0x2d6d('0x8'),_0x2d6d('0x9'),_0x2d6d('0xa'),_0x2d6d('0xb'),_0x2d6d('0xc'),_0x2d6d('0xd'),_0x2d6d('0xe'),_0x2d6d('0xf'),_0x2d6d('0x10'),_0x2d6d('0x11'),'paused',_0x2d6d('0x12'),_0x2d6d('0x13'),_0x2d6d('0x14'),_0x2d6d('0x15'),_0x2d6d('0x16'),'waiting'];function VoiceQueueSummary(_0x131751){this['id']=_0x131751['id'];this[_0x2d6d('0x17')]=_0x131751[_0x2d6d('0x17')];this[_0x2d6d('0x18')]=_0x131751[_0x2d6d('0x18')];this['abandoned']=_0x131751[_0x2d6d('0x19')]||0x0;this[_0x2d6d('0x5')]=_0x131751[_0x2d6d('0x5')]||0x0;this[_0x2d6d('0x0')]=_0x131751['available']||0x0;this[_0x2d6d('0x1a')]=_0x131751[_0x2d6d('0x1a')]||0x0;this['inUse']=_0x131751['inUse']||0x0;this[_0x2d6d('0x1b')]=_0x131751[_0x2d6d('0x1b')]||0x0;this[_0x2d6d('0x1')]=_0x131751['loggedIn']||0x0;this[_0x2d6d('0x1c')]=_0x131751['loggedInDb']||0x0;this['onHold']=_0x131751['onHold']||0x0;this[_0x2d6d('0x1d')]=_0x131751[_0x2d6d('0x1d')]||0x0;this[_0x2d6d('0x2')]=_0x131751[_0x2d6d('0x2')]||0x0;this[_0x2d6d('0x3')]=_0x131751[_0x2d6d('0x3')]||0x0;this[_0x2d6d('0x1e')]=_0x131751[_0x2d6d('0x1e')];this[_0x2d6d('0x14')]=_0x131751['sumBillable'];this[_0x2d6d('0x15')]=_0x131751[_0x2d6d('0x15')];this['sumHoldTime']=_0x131751[_0x2d6d('0x1f')]||0x0;this[_0x2d6d('0x13')]=_0x131751[_0x2d6d('0x13')]||0x0;this[_0x2d6d('0x16')]=_0x131751[_0x2d6d('0x16')]||0x0;this[_0x2d6d('0x20')]=_0x131751['type'];this[_0x2d6d('0x21')]=_0x131751[_0x2d6d('0x21')]||0x0;this[_0x2d6d('0x22')]=_0x131751['unknown']||0x0;this['unmanaged']=_0x131751[_0x2d6d('0x23')]||0x0;this['waiting']=_0x131751['waiting']||0x0;if(_0x131751['type']===_0x2d6d('0x24')){this[_0x2d6d('0x12')]=_0x131751[_0x2d6d('0x12')]||0x0;this[_0x2d6d('0x25')]=_0x131751[_0x2d6d('0x25')];this['dialMethod']=_0x131751[_0x2d6d('0x26')];this[_0x2d6d('0x27')]=_0x131751[_0x2d6d('0x27')];this[_0x2d6d('0x28')]=_0x131751[_0x2d6d('0x28')];this[_0x2d6d('0x29')]=_0x131751[_0x2d6d('0x29')];this[_0x2d6d('0x2a')]=_0x131751[_0x2d6d('0x2a')];this['temp']=_0x131751[_0x2d6d('0x2b')];this[_0x2d6d('0x2c')]=_0x131751[_0x2d6d('0x2c')];this[_0x2d6d('0x9')]=_0x131751['outboundAnswerCallsDay'];this[_0x2d6d('0xa')]=_0x131751['outboundBlacklistCallsDay'];this[_0x2d6d('0xb')]=_0x131751['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x131751[_0x2d6d('0xc')];this['outboundDropCallsDayACS']=_0x131751[_0x2d6d('0x2d')];this[_0x2d6d('0x2e')]=_0x131751['outboundDropCallsDayCallersExit'];this[_0x2d6d('0x2f')]=_0x131751['outboundDropCallsDayTimeout'];this[_0x2d6d('0xd')]=_0x131751[_0x2d6d('0xd')];this[_0x2d6d('0xe')]=_0x131751[_0x2d6d('0xe')];this[_0x2d6d('0x30')]=_0x131751[_0x2d6d('0x30')];this[_0x2d6d('0xf')]=_0x131751[_0x2d6d('0xf')];this['outboundRejectCallsDay']=_0x131751[_0x2d6d('0x10')];this[_0x2d6d('0x11')]=_0x131751['outboundUnknownCallsDay'];this[_0x2d6d('0x31')]=_0x131751[_0x2d6d('0x31')];this[_0x2d6d('0x32')]=_0x131751[_0x2d6d('0x32')];this[_0x2d6d('0x33')]=_0x131751['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x131751['predictiveIntervalDroppedCallsCallersExit'];this[_0x2d6d('0x34')]=_0x131751[_0x2d6d('0x34')];this[_0x2d6d('0x35')]=_0x131751['predictiveIntervalErlangCalls'];this[_0x2d6d('0x36')]=_0x131751[_0x2d6d('0x36')];this[_0x2d6d('0x37')]=_0x131751[_0x2d6d('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x131751[_0x2d6d('0x38')];this[_0x2d6d('0x39')]=_0x131751[_0x2d6d('0x39')];this[_0x2d6d('0x3a')]=_0x131751[_0x2d6d('0x3a')];this[_0x2d6d('0x3b')]=_0x131751[_0x2d6d('0x3b')];this['originated']=_0x131751[_0x2d6d('0x7')];this[_0x2d6d('0x3c')]=_0x131751[_0x2d6d('0x3c')];this[_0x2d6d('0x3d')]=_0x131751[_0x2d6d('0x3d')];this['erlangAbandonmentRate']=_0x131751[_0x2d6d('0x3e')];this[_0x2d6d('0x3f')]=_0x131751[_0x2d6d('0x3f')];this[_0x2d6d('0x40')]=_0x131751[_0x2d6d('0x40')];this[_0x2d6d('0x41')]=_0x131751[_0x2d6d('0x41')];this[_0x2d6d('0x42')]=_0x131751[_0x2d6d('0x42')];this[_0x2d6d('0x43')]=_0x131751[_0x2d6d('0x43')];}if(_0x131751[_0x2d6d('0x44')]){this[_0x2d6d('0x44')]={'id':_0x131751[_0x2d6d('0x44')]['id'],'name':_0x131751[_0x2d6d('0x44')][_0x2d6d('0x17')],'active':_0x131751[_0x2d6d('0x44')]['active'],'callerid':_0x131751[_0x2d6d('0x44')][_0x2d6d('0x45')]};}}VoiceQueueSummary[_0x2d6d('0x46')][_0x2d6d('0x47')]=function(_0x246d6e,_0x5c15d9,_0x402578,_0x1142a6){this[_0x2d6d('0x1c')]=0x0;this[_0x2d6d('0x13')]=0x0;this['paused']=0x0;this[_0x2d6d('0x22')]=0x0;this[_0x2d6d('0x1d')]=0x0;this[_0x2d6d('0x6')]=0x0;this[_0x2d6d('0x1a')]=0x0;this[_0x2d6d('0x1b')]=0x0;this['unavailable']=0x0;this[_0x2d6d('0x3')]=0x0;this[_0x2d6d('0x1e')]=0x0;this['onHold']=0x0;if(_0x402578){if(_0x402578[_0x2d6d('0x0')]){this[_0x2d6d('0x0')]=Number(_0x402578[_0x2d6d('0x0')]);}if(_0x402578['loggedin']){this[_0x2d6d('0x1')]=Number(_0x402578[_0x2d6d('0x48')]);}if(_0x402578['callers']){this['waiting']=Number(_0x402578['callers']);}}for(var _0x7d85d6=0x0;_0x7d85d6<_0x246d6e[_0x2d6d('0x49')];_0x7d85d6++){var _0x5017c9=_0x5c15d9[_0x2d6d('0x4a')+_0x246d6e[_0x7d85d6][_0x2d6d('0x17')]];if(_0x5017c9&&_0x5017c9[_0x2d6d('0x4b')]){this[_0x2d6d('0x1c')]+=0x1;}if(_0x246d6e[_0x7d85d6]['incall']==='1'){this[_0x2d6d('0x13')]+=0x1;}if(_0x246d6e[_0x7d85d6][_0x2d6d('0x2')]==='1'&&!['2','7','8']['includes'](_0x246d6e[_0x7d85d6][_0x2d6d('0x4c')])){this[_0x2d6d('0x2')]+=0x1;}switch(_0x246d6e[_0x7d85d6][_0x2d6d('0x4c')]){case'0':this[_0x2d6d('0x22')]+=0x1;break;case'1':this[_0x2d6d('0x1d')]+=0x1;break;case'2':this[_0x2d6d('0x6')]+=0x1;break;case'3':this[_0x2d6d('0x1a')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x2d6d('0x21')]+=0x1;break;case'6':this[_0x2d6d('0x3')]+=0x1;break;case'7':this[_0x2d6d('0x1e')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x2d6d('0x4d')){var _0x3f600b=Object[_0x2d6d('0x4e')](_0x1142a6);for(var _0x4e5203=0x0;_0x4e5203<_0x3f600b[_0x2d6d('0x49')];_0x4e5203++){var _0xff0b07=_0x3f600b[_0x4e5203];var _0x57bd26=_0x1142a6[_0xff0b07];if(_0x57bd26[_0x2d6d('0x4f')]===this[_0x2d6d('0x17')]&&_0x57bd26[_0x2d6d('0x20')]===_0x2d6d('0x50')&&_0x57bd26[_0x2d6d('0x51')]===_0x2d6d('0x52')){this[_0x2d6d('0x13')]+=0x1;}}if(this[_0x2d6d('0x13')]>this[_0x2d6d('0x6')]){this[_0x2d6d('0x13')]=this['inUse'];}this[_0x2d6d('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x2d6d('0x46')][_0x2d6d('0x53')]=function(_0x59bacf){var _0x4b843f=![];if(_0x59bacf){_0x4b843f=INBOUND_COUNTERS[_0x2d6d('0x54')](function(_0x3738b3){return this[_0x3738b3]!==_0x59bacf[_0x3738b3];},this);}return _0x4b843f;};VoiceQueueSummary[_0x2d6d('0x46')][_0x2d6d('0x55')]=function(_0x2313e8){var _0x3ad153=![];var _0x4eb1d7=![];var _0x3131c5=![];if(_0x2313e8){_0x3ad153=this[_0x2d6d('0x26')]!==_0x2313e8['dialMethod']||this[_0x2d6d('0x25')]!==_0x2313e8[_0x2d6d('0x25')]||this['message']!==_0x2313e8[_0x2d6d('0x42')]||this[_0x2d6d('0x43')]!==_0x2313e8['statusMessage'];_0x4eb1d7=OUTBOUND_COUNTERS[_0x2d6d('0x54')](function(_0x1af749){return this[_0x1af749]!==_0x2313e8[_0x1af749];},this);if(this[_0x2d6d('0x44')]&&_0x2313e8[_0x2d6d('0x44')]){_0x3131c5=this[_0x2d6d('0x44')][_0x2d6d('0x17')]!==_0x2313e8[_0x2d6d('0x44')]['name']||this['Trunk'][_0x2d6d('0x56')]!==_0x2313e8['Trunk'][_0x2d6d('0x56')];}}return _0x3ad153||_0x4eb1d7||_0x3131c5;};VoiceQueueSummary[_0x2d6d('0x46')][_0x2d6d('0x57')]=function(_0x5409f6){this[_0x2d6d('0x5')]=_0x5409f6['answered'];this[_0x2d6d('0x42')]=_0x5409f6[_0x2d6d('0x42')];this[_0x2d6d('0x43')]=_0x5409f6[_0x2d6d('0x43')];this[_0x2d6d('0x7')]=_0x5409f6[_0x2d6d('0x7')];this[_0x2d6d('0x8')]=_0x5409f6[_0x2d6d('0x8')];this['outboundAnswerCallsDay']=_0x5409f6[_0x2d6d('0x9')];this[_0x2d6d('0xa')]=_0x5409f6[_0x2d6d('0xa')];this['outboundBusyCallsDay']=_0x5409f6['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x5409f6[_0x2d6d('0xc')];this['outboundNoAnswerCallsDay']=_0x5409f6[_0x2d6d('0xd')];this[_0x2d6d('0xe')]=_0x5409f6[_0x2d6d('0xe')];this[_0x2d6d('0xf')]=_0x5409f6[_0x2d6d('0xf')];this[_0x2d6d('0x10')]=_0x5409f6['outboundRejectCallsDay'];this[_0x2d6d('0x11')]=_0x5409f6[_0x2d6d('0x11')];this[_0x2d6d('0x14')]=_0x5409f6[_0x2d6d('0x14')];this[_0x2d6d('0x15')]=_0x5409f6[_0x2d6d('0x15')];this['total']=_0x5409f6[_0x2d6d('0x16')];if(this[_0x2d6d('0x26')]===_0x2d6d('0x58')){this[_0x2d6d('0x12')]=_0x5409f6['pTalking'];}};module[_0x2d6d('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0x6a88=['some','compareToOutboundQueue','statusMessage','active','outboundAbandonedCallsDay','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','Trunk','prototype','createReport','busy','callers','length','SIP/','incall','includes','status','booked','keys','dialer','exten'];(function(_0x3673b1,_0xd1ffe4){var _0x14e2f1=function(_0x106e6a){while(--_0x106e6a){_0x3673b1['push'](_0x3673b1['shift']());}};_0x14e2f1(++_0xd1ffe4);}(_0x6a88,0xa9));var _0x86a8=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x6a88[_0x2605dc];return _0x4568c9;};'use strict';var INBOUND_COUNTERS=[_0x86a8('0x0'),_0x86a8('0x1'),_0x86a8('0x2'),_0x86a8('0x3'),_0x86a8('0x4'),_0x86a8('0x5'),_0x86a8('0x6')];var OUTBOUND_COUNTERS=['available',_0x86a8('0x7'),'inUse','loggedIn',_0x86a8('0x2'),_0x86a8('0x8'),'outboundAbandonedCallsDay',_0x86a8('0x9'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0x86a8('0xa'),_0x86a8('0xb'),'outboundNoSuchCallsDay',_0x86a8('0xc'),_0x86a8('0xd'),'outboundUnknownCallsDay','paused',_0x86a8('0xe'),_0x86a8('0x5'),_0x86a8('0xf'),_0x86a8('0x10'),_0x86a8('0x11'),_0x86a8('0x6')];function VoiceQueueSummary(_0x19fe6f){this['id']=_0x19fe6f['id'];this[_0x86a8('0x12')]=_0x19fe6f[_0x86a8('0x12')];this[_0x86a8('0x13')]=_0x19fe6f['strategy'];this[_0x86a8('0x14')]=_0x19fe6f['abandoned']||0x0;this['answered']=_0x19fe6f[_0x86a8('0x7')]||0x0;this[_0x86a8('0x0')]=_0x19fe6f['available']||0x0;this['busy']=_0x19fe6f['busy']||0x0;this[_0x86a8('0x15')]=_0x19fe6f[_0x86a8('0x15')]||0x0;this['invalid']=_0x19fe6f[_0x86a8('0x16')]||0x0;this[_0x86a8('0x1')]=_0x19fe6f[_0x86a8('0x1')]||0x0;this[_0x86a8('0x2')]=_0x19fe6f['loggedInDb']||0x0;this[_0x86a8('0x17')]=_0x19fe6f['onHold']||0x0;this[_0x86a8('0x18')]=_0x19fe6f[_0x86a8('0x18')]||0x0;this[_0x86a8('0x3')]=_0x19fe6f[_0x86a8('0x3')]||0x0;this[_0x86a8('0x4')]=_0x19fe6f[_0x86a8('0x4')]||0x0;this[_0x86a8('0x19')]=_0x19fe6f[_0x86a8('0x19')];this[_0x86a8('0xf')]=_0x19fe6f['sumBillable'];this[_0x86a8('0x10')]=_0x19fe6f[_0x86a8('0x10')];this[_0x86a8('0x1a')]=_0x19fe6f[_0x86a8('0x1a')]||0x0;this['talking']=_0x19fe6f['talking']||0x0;this[_0x86a8('0x11')]=_0x19fe6f[_0x86a8('0x11')]||0x0;this['type']=_0x19fe6f[_0x86a8('0x1b')];this[_0x86a8('0x1c')]=_0x19fe6f['unavailable']||0x0;this[_0x86a8('0x1d')]=_0x19fe6f[_0x86a8('0x1d')]||0x0;this['unmanaged']=_0x19fe6f[_0x86a8('0x1e')]||0x0;this[_0x86a8('0x6')]=_0x19fe6f[_0x86a8('0x6')]||0x0;if(_0x19fe6f[_0x86a8('0x1b')]==='outbound'){this[_0x86a8('0xe')]=_0x19fe6f[_0x86a8('0xe')]||0x0;this[_0x86a8('0x1f')]=_0x19fe6f[_0x86a8('0x1f')];this[_0x86a8('0x20')]=_0x19fe6f[_0x86a8('0x20')];this[_0x86a8('0x21')]=_0x19fe6f['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x19fe6f[_0x86a8('0x22')];this['dialOriginateTimeout']=_0x19fe6f['dialOriginateTimeout'];this[_0x86a8('0x23')]=_0x19fe6f[_0x86a8('0x23')];this[_0x86a8('0x24')]=_0x19fe6f[_0x86a8('0x24')];this[_0x86a8('0x25')]=_0x19fe6f[_0x86a8('0x25')];this[_0x86a8('0x9')]=_0x19fe6f['outboundAnswerCallsDay'];this[_0x86a8('0x26')]=_0x19fe6f[_0x86a8('0x26')];this[_0x86a8('0x27')]=_0x19fe6f['outboundBusyCallsDay'];this[_0x86a8('0xa')]=_0x19fe6f[_0x86a8('0xa')];this[_0x86a8('0x28')]=_0x19fe6f[_0x86a8('0x28')];this[_0x86a8('0x29')]=_0x19fe6f[_0x86a8('0x29')];this[_0x86a8('0x2a')]=_0x19fe6f[_0x86a8('0x2a')];this[_0x86a8('0xb')]=_0x19fe6f[_0x86a8('0xb')];this[_0x86a8('0x2b')]=_0x19fe6f['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x19fe6f['outboundOriginateFailureCallsDay'];this[_0x86a8('0xc')]=_0x19fe6f[_0x86a8('0xc')];this[_0x86a8('0xd')]=_0x19fe6f[_0x86a8('0xd')];this[_0x86a8('0x2c')]=_0x19fe6f[_0x86a8('0x2c')];this[_0x86a8('0x2d')]=_0x19fe6f[_0x86a8('0x2d')];this[_0x86a8('0x2e')]=_0x19fe6f['predictiveIntervalAvgHoldtime'];this[_0x86a8('0x2f')]=_0x19fe6f[_0x86a8('0x2f')];this['predictiveIntervalDroppedCallsCallersExit']=_0x19fe6f[_0x86a8('0x30')];this[_0x86a8('0x31')]=_0x19fe6f['predictiveIntervalDroppedCallsTimeout'];this[_0x86a8('0x32')]=_0x19fe6f[_0x86a8('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x19fe6f[_0x86a8('0x33')];this[_0x86a8('0x34')]=_0x19fe6f[_0x86a8('0x34')];this['predictiveIntervalMultiplicativeFactor']=_0x19fe6f[_0x86a8('0x35')];this[_0x86a8('0x36')]=_0x19fe6f[_0x86a8('0x36')];this['predictiveIntervalAvailable']=_0x19fe6f[_0x86a8('0x37')];this['predictiveIntervalTotalCalls']=_0x19fe6f['predictiveIntervalTotalCalls'];this[_0x86a8('0x8')]=_0x19fe6f[_0x86a8('0x8')];this[_0x86a8('0x38')]=_0x19fe6f[_0x86a8('0x38')];this[_0x86a8('0x39')]=_0x19fe6f['erlangCallToSecond'];this[_0x86a8('0x3a')]=_0x19fe6f[_0x86a8('0x3a')];this[_0x86a8('0x3b')]=_0x19fe6f['erlangBusyFactor'];this['startPredictive']=_0x19fe6f[_0x86a8('0x3c')];this['startProgressive']=_0x19fe6f[_0x86a8('0x3d')];this[_0x86a8('0x3e')]=_0x19fe6f['message'];this['statusMessage']=_0x19fe6f['statusMessage'];}if(_0x19fe6f[_0x86a8('0x3f')]){this['Trunk']={'id':_0x19fe6f['Trunk']['id'],'name':_0x19fe6f[_0x86a8('0x3f')][_0x86a8('0x12')],'active':_0x19fe6f[_0x86a8('0x3f')]['active'],'callerid':_0x19fe6f[_0x86a8('0x3f')]['callerid']};}}VoiceQueueSummary[_0x86a8('0x40')][_0x86a8('0x41')]=function(_0x173233,_0x315f37,_0x278a8a,_0x58342e){this[_0x86a8('0x2')]=0x0;this[_0x86a8('0x5')]=0x0;this[_0x86a8('0x3')]=0x0;this[_0x86a8('0x1d')]=0x0;this[_0x86a8('0x18')]=0x0;this[_0x86a8('0x15')]=0x0;this[_0x86a8('0x42')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this[_0x86a8('0x4')]=0x0;this[_0x86a8('0x19')]=0x0;this[_0x86a8('0x17')]=0x0;if(_0x278a8a){if(_0x278a8a[_0x86a8('0x0')]){this[_0x86a8('0x0')]=Number(_0x278a8a[_0x86a8('0x0')]);}if(_0x278a8a['loggedin']){this['loggedIn']=Number(_0x278a8a['loggedin']);}if(_0x278a8a[_0x86a8('0x43')]){this[_0x86a8('0x6')]=Number(_0x278a8a['callers']);}}for(var _0x4f1bce=0x0;_0x4f1bce<_0x173233[_0x86a8('0x44')];_0x4f1bce++){var _0x53114d=_0x315f37[_0x86a8('0x45')+_0x173233[_0x4f1bce]['name']];if(_0x53114d&&_0x53114d['online']){this[_0x86a8('0x2')]+=0x1;}if(_0x173233[_0x4f1bce][_0x86a8('0x46')]==='1'){this[_0x86a8('0x5')]+=0x1;}if(_0x173233[_0x4f1bce][_0x86a8('0x3')]==='1'&&!['2','7','8'][_0x86a8('0x47')](_0x173233[_0x4f1bce][_0x86a8('0x48')])){this['paused']+=0x1;}switch(_0x173233[_0x4f1bce][_0x86a8('0x48')]){case'0':this[_0x86a8('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x86a8('0x15')]+=0x1;break;case'3':this[_0x86a8('0x42')]+=0x1;break;case'4':this[_0x86a8('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x86a8('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x86a8('0x17')]+=0x1;break;}}if(this[_0x86a8('0x20')]===_0x86a8('0x49')){var _0x4964f0=Object[_0x86a8('0x4a')](_0x58342e);for(var _0x257f39=0x0;_0x257f39<_0x4964f0[_0x86a8('0x44')];_0x257f39++){var _0x5918e6=_0x4964f0[_0x257f39];var _0xfb705f=_0x58342e[_0x5918e6];if(_0xfb705f['queue']===this['name']&&_0xfb705f[_0x86a8('0x1b')]===_0x86a8('0x4b')&&_0xfb705f[_0x86a8('0x4c')]==='xcally-motion-preview'){this[_0x86a8('0x5')]+=0x1;}}if(this[_0x86a8('0x5')]>this[_0x86a8('0x15')]){this[_0x86a8('0x5')]=this[_0x86a8('0x15')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x86a8('0x40')]['compareToInboundQueue']=function(_0x9f1c27){var _0x49e4f4=![];if(_0x9f1c27){_0x49e4f4=INBOUND_COUNTERS[_0x86a8('0x4d')](function(_0x2543fa){return this[_0x2543fa]!==_0x9f1c27[_0x2543fa];},this);}return _0x49e4f4;};VoiceQueueSummary[_0x86a8('0x40')][_0x86a8('0x4e')]=function(_0x2a45fd){var _0x18d8c4=![];var _0x226df6=![];var _0x50e610=![];if(_0x2a45fd){_0x18d8c4=this['dialMethod']!==_0x2a45fd[_0x86a8('0x20')]||this[_0x86a8('0x1f')]!==_0x2a45fd['dialActive']||this[_0x86a8('0x3e')]!==_0x2a45fd[_0x86a8('0x3e')]||this[_0x86a8('0x4f')]!==_0x2a45fd[_0x86a8('0x4f')];_0x226df6=OUTBOUND_COUNTERS[_0x86a8('0x4d')](function(_0x41c6cd){return this[_0x41c6cd]!==_0x2a45fd[_0x41c6cd];},this);if(this[_0x86a8('0x3f')]&&_0x2a45fd[_0x86a8('0x3f')]){_0x50e610=this['Trunk'][_0x86a8('0x12')]!==_0x2a45fd[_0x86a8('0x3f')][_0x86a8('0x12')]||this[_0x86a8('0x3f')][_0x86a8('0x50')]!==_0x2a45fd[_0x86a8('0x3f')][_0x86a8('0x50')];}}return _0x18d8c4||_0x226df6||_0x50e610;};VoiceQueueSummary[_0x86a8('0x40')]['updateReportFromOutboundQueue']=function(_0x48656a){this[_0x86a8('0x7')]=_0x48656a[_0x86a8('0x7')];this['message']=_0x48656a[_0x86a8('0x3e')];this[_0x86a8('0x4f')]=_0x48656a[_0x86a8('0x4f')];this[_0x86a8('0x8')]=_0x48656a[_0x86a8('0x8')];this['outboundAbandonedCallsDay']=_0x48656a[_0x86a8('0x51')];this[_0x86a8('0x9')]=_0x48656a[_0x86a8('0x9')];this[_0x86a8('0x26')]=_0x48656a[_0x86a8('0x26')];this['outboundBusyCallsDay']=_0x48656a['outboundBusyCallsDay'];this[_0x86a8('0xa')]=_0x48656a[_0x86a8('0xa')];this[_0x86a8('0xb')]=_0x48656a[_0x86a8('0xb')];this[_0x86a8('0x2b')]=_0x48656a[_0x86a8('0x2b')];this[_0x86a8('0xc')]=_0x48656a[_0x86a8('0xc')];this[_0x86a8('0xd')]=_0x48656a[_0x86a8('0xd')];this[_0x86a8('0x2c')]=_0x48656a['outboundUnknownCallsDay'];this[_0x86a8('0xf')]=_0x48656a[_0x86a8('0xf')];this[_0x86a8('0x10')]=_0x48656a['sumDuration'];this[_0x86a8('0x11')]=_0x48656a['total'];if(this[_0x86a8('0x20')]==='preview'){this['pTalking']=_0x48656a[_0x86a8('0xe')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a2f9e3a..53ea16c 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 _0xbfba=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x17f006,_0x541f94){var _0x163591=function(_0x1a58f5){while(--_0x1a58f5){_0x17f006['push'](_0x17f006['shift']());}};_0x163591(++_0x541f94);}(_0xbfba,0x1db));var _0xabfb=function(_0x2eea90,_0xa19cd8){_0x2eea90=_0x2eea90-0x0;var _0x2a917d=_0xbfba[_0x2eea90];return _0x2a917d;};'use strict';function VtigerAccount(_0x58a0f5){this['id']=_0x58a0f5['id']||0x0;this[_0xabfb('0x0')]=_0x58a0f5[_0xabfb('0x0')]||'';this[_0xabfb('0x1')]=_0x58a0f5[_0xabfb('0x1')]||'';this[_0xabfb('0x2')]=_0x58a0f5[_0xabfb('0x2')]||'';this[_0xabfb('0x3')]=_0x58a0f5[_0xabfb('0x3')]||'';this[_0xabfb('0x4')]=_0x58a0f5[_0xabfb('0x4')]||'';this[_0xabfb('0x5')]=_0x58a0f5[_0xabfb('0x5')]||{};}module[_0xabfb('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe3e7=['serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x47484e,_0x4e3f7f){var _0x1ae4df=function(_0x59549c){while(--_0x59549c){_0x47484e['push'](_0x47484e['shift']());}};_0x1ae4df(++_0x4e3f7f);}(_0xe3e7,0x69));var _0x7e3e=function(_0x2daebd,_0x2d6f34){_0x2daebd=_0x2daebd-0x0;var _0x29bfec=_0xe3e7[_0x2daebd];return _0x29bfec;};'use strict';function VtigerAccount(_0x45e30e){this['id']=_0x45e30e['id']||0x0;this[_0x7e3e('0x0')]=_0x45e30e[_0x7e3e('0x0')]||'';this['username']=_0x45e30e[_0x7e3e('0x1')]||'';this[_0x7e3e('0x2')]=_0x45e30e['accessKey']||'';this['remoteUri']=_0x45e30e['remoteUri']||'';this['serverUrl']=_0x45e30e[_0x7e3e('0x3')]||'';this[_0x7e3e('0x4')]=_0x45e30e['Configurations']||{};}module[_0x7e3e('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 c8f01a3..cefa703 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 _0x9d03=['integrationTab','serverUrl','Configurations','name','username','token','remoteUri','authType','type'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9d03,0x1f2));var _0x39d0=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x9d03[_0x3de8a4];return _0x4635cf;};'use strict';function ZendeskAccount(_0x3cb29){this['id']=_0x3cb29['id']||0x0;this[_0x39d0('0x0')]=_0x3cb29[_0x39d0('0x0')]||'';this['username']=_0x3cb29[_0x39d0('0x1')]||'';this['password']=_0x3cb29['password']||'';this[_0x39d0('0x2')]=_0x3cb29[_0x39d0('0x2')]||'';this['remoteUri']=_0x3cb29[_0x39d0('0x3')]||'';this['authType']=_0x3cb29[_0x39d0('0x4')]||'';this[_0x39d0('0x5')]=_0x3cb29[_0x39d0('0x5')]||_0x39d0('0x6');this['serverUrl']=_0x3cb29[_0x39d0('0x7')]||'';this['Configurations']=_0x3cb29[_0x39d0('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x8f52=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x467ad6,_0x10892e){var _0x4052cc=function(_0x364206){while(--_0x364206){_0x467ad6['push'](_0x467ad6['shift']());}};_0x4052cc(++_0x10892e);}(_0x8f52,0x90));var _0x28f5=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x8f52[_0x32d457];return _0x338386;};'use strict';function ZendeskAccount(_0x33e3ba){this['id']=_0x33e3ba['id']||0x0;this[_0x28f5('0x0')]=_0x33e3ba[_0x28f5('0x0')]||'';this[_0x28f5('0x1')]=_0x33e3ba[_0x28f5('0x1')]||'';this[_0x28f5('0x2')]=_0x33e3ba[_0x28f5('0x2')]||'';this[_0x28f5('0x3')]=_0x33e3ba[_0x28f5('0x3')]||'';this[_0x28f5('0x4')]=_0x33e3ba['remoteUri']||'';this[_0x28f5('0x5')]=_0x33e3ba[_0x28f5('0x5')]||'';this['type']=_0x33e3ba['type']||_0x28f5('0x6');this[_0x28f5('0x7')]=_0x33e3ba[_0x28f5('0x7')]||'';this[_0x28f5('0x8')]=_0x33e3ba[_0x28f5('0x8')]||{};}module[_0x28f5('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7b73e5c..63bce3e 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 _0x03d6=['Configurations','exports','name','description','host','zone','clientId','clientSecret','code','refreshToken'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x03d6,0x1ba));var _0x603d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03d6[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x17fef4){this['id']=_0x17fef4['id']||0x0;this[_0x603d('0x0')]=_0x17fef4[_0x603d('0x0')]||'';this[_0x603d('0x1')]=_0x17fef4[_0x603d('0x1')]||'';this[_0x603d('0x2')]=_0x17fef4['host']||'';this[_0x603d('0x3')]=_0x17fef4['zone']||'';this[_0x603d('0x4')]=_0x17fef4[_0x603d('0x4')]||'';this[_0x603d('0x5')]=_0x17fef4[_0x603d('0x5')]||'';this['serverUrl']=_0x17fef4['serverUrl']||'';this[_0x603d('0x6')]=_0x17fef4[_0x603d('0x6')]||'';this['refreshToken']=_0x17fef4[_0x603d('0x7')]||'';this[_0x603d('0x8')]=_0x17fef4[_0x603d('0x8')]||{};}module[_0x603d('0x9')]=ZohoAccount; \ No newline at end of file +var _0x1418=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x24a43b,_0x19615c){var _0x2b3338=function(_0x5cc8bd){while(--_0x5cc8bd){_0x24a43b['push'](_0x24a43b['shift']());}};_0x2b3338(++_0x19615c);}(_0x1418,0x1b6));var _0x8141=function(_0xe73881,_0x1af999){_0xe73881=_0xe73881-0x0;var _0x4452e1=_0x1418[_0xe73881];return _0x4452e1;};'use strict';function ZohoAccount(_0x384f1a){this['id']=_0x384f1a['id']||0x0;this[_0x8141('0x0')]=_0x384f1a['name']||'';this[_0x8141('0x1')]=_0x384f1a[_0x8141('0x1')]||'';this[_0x8141('0x2')]=_0x384f1a['host']||'';this[_0x8141('0x3')]=_0x384f1a['zone']||'';this[_0x8141('0x4')]=_0x384f1a['clientId']||'';this[_0x8141('0x5')]=_0x384f1a[_0x8141('0x5')]||'';this[_0x8141('0x6')]=_0x384f1a['serverUrl']||'';this['code']=_0x384f1a[_0x8141('0x7')]||'';this['refreshToken']=_0x384f1a[_0x8141('0x8')]||'';this[_0x8141('0x9')]=_0x384f1a[_0x8141('0x9')]||{};}module[_0x8141('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 68e4bb2..8bbc129 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 _0x5f66=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','lodash','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var util=require('util');var _=require(_0x65f6('0x0'));var moment=require('moment');function checkNameSurname(_0x2d5fd9,_0x2f06ae,_0x3461cd){var _0xbce843='';if(!_[_0x65f6('0x1')](_0x2f06ae)&&'string'===typeof _0x2f06ae){_0xbce843+=_0x2f06ae;}if(!_[_0x65f6('0x1')](_0x3461cd)&&'string'===typeof _0x3461cd){_0xbce843+='\x20'+_0x3461cd;}if(_0xbce843!==''){return _0xbce843;}return _0x2d5fd9;}function Action(_0x1c9f5b,_0x22b017,_0x4ec221,_0x4ed98f,_0x1c0e12){this[_0x65f6('0x2')]=_0x4ec221||undefined;this[_0x65f6('0x3')]=_0x1c9f5b['id'];this[_0x65f6('0x4')]=_0x22b017[_0x65f6('0x5')];this[_0x65f6('0x6')]=_0x22b017['type'];this['campaigntype']=_0x65f6('0x4');this[_0x65f6('0x7')]=![];this[_0x65f6('0x8')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?undefined:_0x1c9f5b[_0x65f6('0x9')]['name'];this['channelAgent']=this[_0x65f6('0x8')]?util['format'](_0x65f6('0xa'),this['membername']):_0x4ed98f||undefined;this[_0x65f6('0xb')]=checkNameSurname(_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xd')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xe')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xf')]);this[_0x65f6('0x10')]=_0x1c9f5b[_0x65f6('0x10')]||![];this[_0x65f6('0x11')]=_0x1c9f5b['phone'];this[_0x65f6('0x12')]=_0x1c9f5b['scheduledat'];this['countbusyretry']=_0x1c9f5b[_0x65f6('0x13')]||0x0;this[_0x65f6('0x14')]=_0x1c9f5b[_0x65f6('0x14')]||0x0;this[_0x65f6('0x15')]=_0x1c9f5b[_0x65f6('0x15')]||0x0;this[_0x65f6('0x16')]=(_0x1c9f5b[_0x65f6('0x13')]||0x0)+(_0x1c9f5b[_0x65f6('0x14')]||0x0)+(_0x1c9f5b['countnoanswerretry']||0x0)+(_0x1c9f5b['countnosuchnumberretry']||0x0)+(_0x1c9f5b[_0x65f6('0x17')]||0x0)+(_0x1c9f5b['countabandonedretry']||0x0)+(_0x1c9f5b['countmachineretry']||0x0)+(_0x1c9f5b['countagentrejectretry']||0x0);this[_0x65f6('0x18')]=_0x1c9f5b[_0x65f6('0x18')]||0x0;this['countdropretry']=_0x1c9f5b[_0x65f6('0x17')]||0x0;this[_0x65f6('0x19')]=_0x1c9f5b[_0x65f6('0x19')]||0x0;this[_0x65f6('0x1a')]=_0x1c9f5b[_0x65f6('0x1a')]||0x0;this[_0x65f6('0x1b')]=_0x1c9f5b['countagentrejectretry']||0x0;this[_0x65f6('0x1c')]=_0x1c9f5b['callback'];this['callbackuniqueid']=_0x1c9f5b[_0x65f6('0x1d')];this[_0x65f6('0x1e')]=_0x1c9f5b['callbackat'];this[_0x65f6('0x1f')]=_0x1c9f5b[_0x65f6('0x1f')];this[_0x65f6('0x20')]=_0x1c9f5b[_0x65f6('0x20')];this['ListId']=_0x1c9f5b[_0x65f6('0x21')];this[_0x65f6('0x22')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?_0x1c9f5b['UserId']:_0x1c9f5b['Agent']['id'];this[_0x65f6('0x23')]=_0x1c9f5b[_0x65f6('0x23')];this['originatecalleridnum']='';this[_0x65f6('0x24')]='';}Action[_0x65f6('0x25')]['getCaller']=function(){return util[_0x65f6('0x26')](_0x65f6('0x27'),this[_0x65f6('0xb')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x0424=['dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','name','type','queue'];(function(_0x24aaa0,_0x523015){var _0x1d1562=function(_0x1c586c){while(--_0x1c586c){_0x24aaa0['push'](_0x24aaa0['shift']());}};_0x1d1562(++_0x523015);}(_0x0424,0x159));var _0x4042=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x0424[_0x589aee];return _0x2f5ed4;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4042('0x0'));function checkNameSurname(_0x28e024,_0x161add,_0x292a62){var _0x53f080='';if(!_[_0x4042('0x1')](_0x161add)&&'string'===typeof _0x161add){_0x53f080+=_0x161add;}if(!_['isNil'](_0x292a62)&&_0x4042('0x2')===typeof _0x292a62){_0x53f080+='\x20'+_0x292a62;}if(_0x53f080!==''){return _0x53f080;}return _0x28e024;}function Action(_0x24fdfd,_0x472795,_0xc0fba0,_0x3abaf1,_0xa5310f){this[_0x4042('0x3')]=_0xc0fba0||undefined;this['idContact']=_0x24fdfd['id'];this['queue']=_0x472795[_0x4042('0x4')];this[_0x4042('0x5')]=_0x472795[_0x4042('0x5')];this['campaigntype']=_0x4042('0x6');this[_0x4042('0x7')]=![];this[_0x4042('0x8')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?undefined:_0x24fdfd[_0x4042('0x9')][_0x4042('0x4')];this[_0x4042('0xa')]=this['membername']?util[_0x4042('0xb')](_0x4042('0xc'),this['membername']):_0x3abaf1||undefined;this[_0x4042('0xd')]=checkNameSurname(_0x24fdfd[_0x4042('0xe')][_0x4042('0xf')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x10')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x11')]);this['active']=_0x24fdfd[_0x4042('0x12')]||![];this[_0x4042('0x13')]=_0x24fdfd['phone'];this[_0x4042('0x14')]=_0x24fdfd[_0x4042('0x14')];this[_0x4042('0x15')]=_0x24fdfd[_0x4042('0x15')]||0x0;this[_0x4042('0x16')]=_0x24fdfd[_0x4042('0x16')]||0x0;this[_0x4042('0x17')]=_0x24fdfd[_0x4042('0x17')]||0x0;this[_0x4042('0x18')]=(_0x24fdfd['countbusyretry']||0x0)+(_0x24fdfd[_0x4042('0x16')]||0x0)+(_0x24fdfd['countnoanswerretry']||0x0)+(_0x24fdfd[_0x4042('0x19')]||0x0)+(_0x24fdfd['countdropretry']||0x0)+(_0x24fdfd[_0x4042('0x1a')]||0x0)+(_0x24fdfd[_0x4042('0x1b')]||0x0)+(_0x24fdfd[_0x4042('0x1c')]||0x0);this[_0x4042('0x19')]=_0x24fdfd['countnosuchnumberretry']||0x0;this[_0x4042('0x1d')]=_0x24fdfd[_0x4042('0x1d')]||0x0;this[_0x4042('0x1a')]=_0x24fdfd[_0x4042('0x1a')]||0x0;this['countmachineretry']=_0x24fdfd[_0x4042('0x1b')]||0x0;this[_0x4042('0x1c')]=_0x24fdfd[_0x4042('0x1c')]||0x0;this[_0x4042('0x1e')]=_0x24fdfd[_0x4042('0x1e')];this['callbackuniqueid']=_0x24fdfd[_0x4042('0x1f')];this[_0x4042('0x20')]=_0x24fdfd['callbackat'];this[_0x4042('0x21')]=_0x24fdfd['recallme'];this[_0x4042('0x22')]=_0x24fdfd[_0x4042('0x22')];this[_0x4042('0x23')]=_0x24fdfd['ListId'];this[_0x4042('0x24')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?_0x24fdfd[_0x4042('0x24')]:_0x24fdfd[_0x4042('0x9')]['id'];this['VoiceQueueId']=_0x24fdfd['VoiceQueueId'];this[_0x4042('0x25')]='';this[_0x4042('0x26')]='';}Action[_0x4042('0x27')][_0x4042('0x28')]=function(){return util[_0x4042('0xb')](_0x4042('0x29'),this['calleridname'],this[_0x4042('0x2a')]);};module[_0x4042('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 e96bc04..2895b8d 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 _0x00bb=['swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','syncVarSet','filterKey','keys','variable','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','INACTIVE','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','stringify','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x00bb[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var uuid=require(_0xb00b('0x2'));var moment=require('moment');var Redis=require(_0xb00b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var loggerAction=require('../../../config/logger')(_0xb00b('0x6'));var ami=require(_0xb00b('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xb00b('0x8'));var utils=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitVoiceQueueChannelRemove(_0x3501af){logger['info'](_0xb00b('0x24'),JSON['stringify'](_0x3501af));emit(util[_0xb00b('0x25')](_0xb00b('0x26'),_0x3501af['name']),_0xb00b('0x27'),_0x3501af);io[_0xb00b('0x23')]('voice_queue_presence:remove',_0x3501af);}function notSendMessagesQueue(_0x3ab3cc){if(_0x3ab3cc[_0xb00b('0x28')]){if(_0x3ab3cc['originated']===0x0&&_0x3ab3cc[_0xb00b('0x29')]===0x0){_0x3ab3cc[_0xb00b('0x28')]=![];_0x3ab3cc[_0xb00b('0x2a')]=0x0;_0x3ab3cc[_0xb00b('0x2b')]=0x0;_0x3ab3cc['message']=utils['CAMPAIGN_STATUS'][_0xb00b('0x2c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3ab3cc['name']+_0xb00b('0x2d'));}else{_0x3ab3cc[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x30')];ut[_0xb00b('0x31')](_0xb00b('0x32'),_0x3ab3cc[_0xb00b('0x33')]+'\x20is\x20deactivated');}}}Preview[_0xb00b('0xd')]['loopCampaigns']=function(){var _0x450129=this;setInterval(function(){_0x450129[_0xb00b('0x34')]();},0x7cf);};Preview[_0xb00b('0xd')]['syncCampaigns']=function(){var _0x2fc11a=this[_0xb00b('0x22')];this[_0xb00b('0x35')]+=0x1;for(var _0x183233 in _0x2fc11a){if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&(_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x5')||_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x38'))&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(this[_0xb00b('0x35')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb00b('0x3a')]();}}if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&_0x2fc11a[_0x183233]['dialMethod']===_0xb00b('0x5')&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(_0x2fc11a[_0x183233][_0xb00b('0x3b')]){this[_0xb00b('0x3c')](_0x2fc11a[_0x183233]);if(_0x2fc11a[_0x183233][_0xb00b('0x3d')])this[_0xb00b('0x3e')](_0x2fc11a[_0x183233]);}else{notSendMessagesQueue(_0x2fc11a[_0x183233]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x3f')]=function(_0x594840){var _0x57e8f9=this;this['sequence'][_0xb00b('0xe')](function(){if(!_[_0xb00b('0x40')](_0x57e8f9[_0xb00b('0x13')][_0x594840])){loggerAction[_0xb00b('0x41')]('[clearZombieChannels][talking]',_0x594840,_0xb00b('0x42'),_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')],_0xb00b('0x44'),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x45')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]][_0xb00b('0x29')]),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x46')]),JSON[_0xb00b('0x45')](_['pick'](_0x57e8f9[_0xb00b('0x13')][_0x594840],[_0xb00b('0x47'),_0xb00b('0x48'),_0xb00b('0x49'),_0xb00b('0x4a')])));return ami[_0xb00b('0x4b')]({'action':'status','channel':_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x4c')]})['catch'](function(_0x17ff34){if(_0x17ff34[_0xb00b('0x2e')]===_0xb00b('0x4d')){setTimeout(function(){if(_0x57e8f9[_0xb00b('0x13')][_0x594840]){ut[_0xb00b('0x4e')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));if(_0x57e8f9[_0xb00b('0x13')][_0x594840]['dialAnswer']===!![]){ut['decrementTalkink'](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));ut[_0xb00b('0x50')](_0xb00b('0x51')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840]['queue']);}ut[_0xb00b('0x50')](_0xb00b('0x52')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]);delete _0x57e8f9[_0xb00b('0x13')][_0x594840];}},0x2328);}});}});};Preview[_0xb00b('0xd')][_0xb00b('0x3a')]=function(){var _0x974a29=this;loggerAction[_0xb00b('0x41')](_0xb00b('0x53'),_[_0xb00b('0x54')](this[_0xb00b('0x13')]));for(var _0x577bad in this[_0xb00b('0x13')]){if(_0x974a29[_0xb00b('0x13')][_0xb00b('0x36')](_0x577bad)){_0x974a29[_0xb00b('0x3f')](_0x577bad);}}};Preview[_0xb00b('0xd')][_0xb00b('0x3e')]=function(_0xd97f49){var _0x1b4f09=this;rpcDb[_0xb00b('0x55')](_0xd97f49['id'],ut[_0xb00b('0x56')](this[_0xb00b('0x14')]))[_0xb00b('0x57')](function(_0x5dbe00){if(!_['isNil'](_0x5dbe00)){for(var _0x47c6c0=0x0;_0x47c6c0<_0x5dbe00[_0xb00b('0x58')];_0x47c6c0+=0x1){if(ut[_0xb00b('0x59')](_0x5dbe00[_0x47c6c0]['scheduledat'])<_0xd97f49[_0xb00b('0x5a')]*0x3c){if(_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')]&&!_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')][_0xb00b('0x5c')]){_0x1b4f09['run'](_0x5dbe00[_0x47c6c0]['id'])['then'](ut[_0xb00b('0x5d')](_0xb00b('0x5e')))['catch'](ut['logger2'](_0xb00b('0x5e')));}else{rpcDb[_0xb00b('0x5f')](_0x5dbe00[_0x47c6c0]['id']);}}else{var _0x4e0be4=new Action(_0x5dbe00[_0x47c6c0],_0xd97f49);_0x4e0be4[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd97f49['outboundReCallsDay']+=0x1;ut[_0xb00b('0x61')](_0x4e0be4,0x17,'RecallInQueue');if(_0xd97f49[_0xb00b('0x62')]){rpcDb[_0xb00b('0x63')](ut[_0xb00b('0x64')](_0x5dbe00[_0x47c6c0]));rpcDb[_0xb00b('0x65')](_0x4e0be4,_0xb00b('0x66'));}else{ut[_0xb00b('0x61')](_0x4e0be4,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e0be4,_0xb00b('0x67'));rpcDb[_0xb00b('0x68')](_0x4e0be4,'[HistoryRecallClose]');}}}}})[_0xb00b('0x69')](ut[_0xb00b('0x5d')]('[getContactRecallMe]'));};Preview[_0xb00b('0xd')][_0xb00b('0x3c')]=function(_0x3b5d82){_0x3b5d82['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3b5d82[_0xb00b('0x6a')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6b')];}else if(!ut['isActive'](_0x3b5d82[_0xb00b('0x3b')])){_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xb00b('0x6c')](_0x3b5d82['Trunk'])){if(!this[_0xb00b('0x6c')](_0x3b5d82[_0xb00b('0x6d')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6e')];}else{_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS'][_0xb00b('0x6f')];}}else{_0x3b5d82['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];}};Preview[_0xb00b('0xd')]['callProgressDetectingCustomer']=function(_0x248335,_0x25f1f6,_0x4ba53a){var _0x598a55=this;var _0x24e826=this[_0xb00b('0x13')][_0x25f1f6];var _0x219b74=this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]];var _0x279467;var _0x347949=![];var _0x3a0b90=0x2;var _0x4c3067=0x3;if(_0x219b74){switch(_0x4ba53a){case'1':_0x219b74[_0xb00b('0x70')]+=0x1;_0x24e826[_0xb00b('0x71')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x0,_0xb00b('0x73'));ami[_0xb00b('0x23')](_0xb00b('0x74'),ut[_0xb00b('0x75')](_0x24e826,'nosuchnumber'));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x76'));_0x598a55[_0xb00b('0x77')](_0x24e826,'0',_0x219b74)[_0xb00b('0x57')](function(_0x4b1e5f){_0x347949=_0x4b1e5f[_0xb00b('0x78')]==0x1;_0x3a0b90=_0x219b74[_0xb00b('0x79')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb['createCustomerFinal'](_0x279467,_0xb00b('0x7f'));}else{if(_0x24e826['countnosuchnumberretry']>=_0x219b74[_0xb00b('0x80')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0x81')](_0x24e826,'countnosuchnumberretry',_0x219b74[_0xb00b('0x79')]),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}delete this['actions'][_0x248335['linkedid']];}else{_0x24e826['countnosuchnumberretry']++;logger[_0xb00b('0x41')](_0xb00b('0x84'),_0x24e826[_0xb00b('0x71')]);logger['info']('id',_0x24e826[_0xb00b('0x85')]);_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnosuchnumberretry':_0x24e826[_0xb00b('0x71')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0x87'):var _0x5622a4=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x24e826[_0xb00b('0x89')]=_0x5622a4;_0x24e826['answertime']=_0x5622a4;_0x24e826['dialAnswer']=!![];_0x219b74[_0xb00b('0x29')]+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x8a'),_0x24e826['uniqueid'],'\x20Queue',_0x219b74['name'],'pTalking:\x20',_0x219b74[_0xb00b('0x29')]);ami['emit'](_0xb00b('0x8b'),ut[_0xb00b('0x75')](_0x24e826,'connect',this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));if(_0x219b74[_0xb00b('0x8c')]){ami[_0xb00b('0x23')](_0xb00b('0x8d'),ut['buildAcw'](_0x24e826));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0x8e'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0x8f'),this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x75')](_0x24e826,'complete'));_0x219b74[_0xb00b('0x90')]+=0x1;_0x219b74[_0xb00b('0x91')]+=0x1;_0x219b74[_0xb00b('0x92')]+=0x1;ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0x94'));_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x4,'Answer');rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x95'));rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0x96'));rpcDb[_0xb00b('0x97')](_0x24e826);_0x219b74[_0xb00b('0x98')]+=_0x24e826[_0xb00b('0x99')];_0x219b74[_0xb00b('0x9a')]+=_0x24e826['talktime'];logger[_0xb00b('0x41')](_0xb00b('0x9b'),_0x24e826[_0xb00b('0x9c')],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x9e'),_0x219b74[_0xb00b('0x29')]);delete this['actions'][_0x248335[_0xb00b('0x9f')]];break;case _0xb00b('0xa0'):_0x219b74[_0xb00b('0xa1')]+=0x1;_0x24e826[_0xb00b('0xa2')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x5,_0xb00b('0xa3'));_0x3a0b90=_0x219b74['dialBusyRetryFrequency'];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami['emit'](_0xb00b('0xa4'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xa5')));rpcDb['createCustomerHistory'](_0x24e826,'[callProgressDetectingCustomer][logBusy]');_0x598a55[_0xb00b('0x77')](_0x24e826,'5',_0x219b74)[_0xb00b('0x57')](function(_0x33a483){_0x347949=_0x33a483[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xa6'));}else{if(_0x24e826[_0xb00b('0xa2')]>=_0x219b74[_0xb00b('0xa7')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xa8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24e826,_0xb00b('0xa2'),_0x219b74[_0xb00b('0xa9')]),_0x24e826['unlockAgent'],_0x24e826['activeContact']);}}}else{_0x24e826[_0xb00b('0xa2')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countbusyretry':_0x24e826['countbusyretry']}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xab'):_0x219b74[_0xb00b('0xac')]+=0x1;_0x24e826[_0xb00b('0xad')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x3,'NoAnswer');_0x3a0b90=_0x219b74[_0xb00b('0xae')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];var _0x545dfd=ut[_0xb00b('0xaf')](_0x24e826,_0x219b74);ami[_0xb00b('0x23')](_0xb00b('0xb0'),_0x545dfd);rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xb1'));_0x598a55[_0xb00b('0x77')](_0x24e826,'3',_0x219b74)[_0xb00b('0x57')](function(_0x2423b2){_0x347949=_0x2423b2[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,'Global');rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xb2'));}else{if(_0x24e826[_0xb00b('0xad')]>=_0x219b74[_0xb00b('0xb3')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0xb1'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xad'),_0x219b74[_0xb00b('0xae')]),_0x24e826['unlockAgent'],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826['countnoanswerretry']}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xb5'):_0x219b74[_0xb00b('0xb6')]+=0x1;_0x24e826[_0xb00b('0xb7')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x8,_0xb00b('0xb8'));_0x3a0b90=_0x219b74[_0xb00b('0xb9')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami[_0xb00b('0x23')]('custom:agentcongestion',ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xba')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xbb'));_0x598a55['verifyAdditionalPhones'](_0x24e826,'8',_0x219b74)[_0xb00b('0x57')](function(_0xb27b8b){_0x347949=_0xb27b8b['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24e826[_0xb00b('0xb7')]>=_0x219b74[_0xb00b('0xbc')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xbb'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xb7'),_0x219b74[_0xb00b('0xa9')]),_0x24e826[_0xb00b('0x82')],_0x24e826['activeContact']);}}}else{_0x24e826['countcongestionretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countcongestionretry':_0x24e826[_0xb00b('0xb7')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xbd'):_0x219b74['outboundRejectCallsDay']+=0x1;_0x24e826[_0xb00b('0xbe')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x14,_0xb00b('0xbf'));_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74['callAdditionalPhoneAfterMin'];ami[_0xb00b('0x23')](_0xb00b('0xc1'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xc2')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xc3'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x55ea09){_0x347949=_0x55ea09[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x14,'AgentReject');rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24e826[_0xb00b('0xbe')]>=_0x219b74['dialAgentRejectMaxRetry']){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xbe'),_0x219b74['dialAgentRejectRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826['countnoanswerretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826['idContact'],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'ABANDONED':_0x219b74[_0xb00b('0xc5')]+=0x1;_0x24e826[_0xb00b('0xc6')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xc7'));_0x598a55[_0xb00b('0x77')](_0x24e826,'11',_0x219b74)[_0xb00b('0x57')](function(_0x2d5652){_0x347949=_0x2d5652[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut['totalGlobal'](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xc7'));}else{if(_0x24e826[_0xb00b('0xc8')]>=_0x219b74[_0xb00b('0xc9')]){rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb00b('0xb4')](ut['scheduledAt'](_0x24e826,_0xb00b('0xc6'),_0x219b74['dialAbandonedRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'18':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0xcb')]+=0x1;_0x24e826['countglobal']=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x12,_0x248335[_0xb00b('0xcc')]||_0x248335[_0xb00b('0xcd')]);ami['emit'](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,'amd'));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');_0x598a55[_0xb00b('0x77')](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x49fe3f){_0x347949=_0x49fe3f[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x12,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})['then'](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335['linkedid']];break;case'19':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x13,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);ami[_0xb00b('0x23')](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xcf')));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][machine]');_0x598a55['verifyAdditionalPhones'](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x23d306){_0x347949=_0x23d306[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut['cloneAction'](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd0'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd0'));}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55['incrementPreviewCounters']({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];break;default:if(_0x24e826[_0xb00b('0x46')]){ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0xd1'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x219b74[_0xb00b('0x33')],_0x248335);}_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut['logCustomer'](_0x24e826,0xc,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xd2'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x142674){_0x347949=_0x142674['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd3'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd3'));}delete this['actions'][_0x248335[_0xb00b('0x9f')]];}else{_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});}});}if(!(_0x24e826[_0xb00b('0x46')]&&_0x4ba53a==='16')){ut[_0xb00b('0x4e')](_0x219b74,_0xb00b('0xd4'));logger[_0xb00b('0x41')](_0xb00b('0xd5'),_0x24e826['uniqueid'],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x44'),_0x219b74[_0xb00b('0xd6')]);}if(_0x4ba53a!=='ANSWER'){delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0xd7')]];}_0x219b74[_0xb00b('0xd8')]=!![];}};Preview[_0xb00b('0xd')][_0xb00b('0xd9')]=function(_0x3184de,_0x48ac4b,_0x5f0fab){if(_[_0xb00b('0xda')](_0x48ac4b)&&_0xb00b('0xdb')!==typeof _0x48ac4b){return;}if(_[_0xb00b('0xda')](_0x5f0fab)&&'object'!==typeof _0x5f0fab){return;}switch(_0x5f0fab[_0xb00b('0xdc')]){case'0':ut[_0xb00b('0xdd')](_0x3184de,0x0,_0xb00b('0x73'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xde'));break;case'3':ut[_0xb00b('0xdd')](_0x3184de,0x3,_0xb00b('0xdf'));rpcDb['createAgentHistory'](_0x3184de,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xb00b('0xdd')](_0x3184de,0x5,'Busy');rpcDb[_0xb00b('0xe0')](_0x3184de,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3184de,0x8,_0xb00b('0xb8'));rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));break;case'22':ut[_0xb00b('0xdd')](_0x3184de,0x16,_0xb00b('0xe2'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xe3'));break;default:ut['logAgent'](_0x3184de,0xc,_0x5f0fab['reason']);rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));}ut[_0xb00b('0x4e')](_0x48ac4b,_0xb00b('0xe4'));logger[_0xb00b('0x41')](_0xb00b('0xe5'),_0x3184de['uniqueid'],_0xb00b('0x9d'),_0x48ac4b['name'],_0xb00b('0x44'),_0x48ac4b[_0xb00b('0xd6')]);delete this[_0xb00b('0x13')][_0x3184de['uniqueid']];};Preview[_0xb00b('0xd')][_0xb00b('0x77')]=function(_0x20790f,_0x3dc8d2,_0x5d224c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20790f,_0x3dc8d2,_0x5d224c)[_0xb00b('0x69')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')]['swapAdditionalPhones']=function(_0x505ae2,_0x2fecca,_0x330bc7){return cmHopperAdditionalPhone[_0xb00b('0xaa')](_0x505ae2,_0x2fecca,_0x330bc7)[_0xb00b('0x69')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')][_0xb00b('0x86')]=function(_0x9facaf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb00b('0x86')](_0x9facaf))['catch'](logger['info'](_0xb00b('0xe6')));};Preview['prototype'][_0xb00b('0xe7')]=function(_0x481671,_0x1b751e,_0x5712fd,_0x3de808,_0x3289aa){var _0x1ec560=this;return new Promise(function(_0x54498c,_0x442b28){if(_['isNil'](_0x1b751e)||_[_0xb00b('0x40')](_0x1b751e[_0xb00b('0xe8')])||_['isNil'](_0x1b751e['phone'])||_['isNil'](_0x1b751e['VoiceQueueId'])){_0x442b28(ut[_0xb00b('0x2e')]('Contact\x20is\x20undefined',_0x3de808,_0x3289aa));return;}var _0x134d17=uuid['v4']();var _0x5ad4d4=_0x1ec560[_0xb00b('0x22')][_0x1b751e[_0xb00b('0x42')][_0xb00b('0x33')]];var _0x44b2f1=_0x5712fd?_0x1ec560[_0xb00b('0x14')][_0x5712fd]['id']:undefined;_0x1ec560['actions'][_0x134d17]=new Action(_0x1b751e,_0x5ad4d4,_0x134d17,_0x5712fd,_0x44b2f1);var _0x8292fe=_0x1ec560[_0xb00b('0x13')][_0x134d17];_0x8292fe[_0xb00b('0x82')]=_0x3de808;_0x8292fe[_0xb00b('0x83')]=_0x3289aa;_0x8292fe['lookAgent']=_0x5712fd;if(_['isEmpty'](_0x481671)){_0x1ec560[_0xb00b('0xe9')](_0x8292fe,_0x5ad4d4,_0x1b751e,_0x5712fd)[_0xb00b('0x57')](function(_0x181393){logger[_0xb00b('0x41')](_0xb00b('0xea'),_0xb00b('0xeb')+_0x8292fe[_0xb00b('0x43')]+_0xb00b('0xec')+_0x8292fe[_0xb00b('0x85')],JSON['stringify'](_0x181393));ami[_0xb00b('0x23')](_0xb00b('0xed'),ut['buildObj'](_0x8292fe,_0xb00b('0xee'),_0x1ec560['campaignsPreview'][_0x8292fe[_0xb00b('0x43')]]));_0x54498c(ut[_0xb00b('0x2e')]('Calling'));})['catch'](function(_0x32264a){ut[_0xb00b('0x31')](_0xb00b('0xef'),_0x32264a);_0x442b28(ut['message'](_0xb00b('0xf0'),_0x3de808,_0x3289aa));});}else{_0x5ad4d4[_0xb00b('0xf1')]+=0x1;ut[_0xb00b('0xf2')](_0x8292fe);rpcDb['createHistory'](_0x8292fe,_0xb00b('0xf3'));delete _0x1ec560['actions'][_0x134d17];_0x442b28(ut['message']('Contact\x20in\x20black\x20List',_0x3de808,_0x3289aa));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x1b8d45){return!_[_0xb00b('0x40')](_0x1b8d45)&&!_['isNil'](_0x1b8d45['name'])&&!_[_0xb00b('0x40')](_0x1b8d45[_0xb00b('0xf4')])&&_0x1b8d45['active']&&!_[_0xb00b('0x40')](this[_0xb00b('0x12')][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45[_0xb00b('0x33')])])&&!_[_0xb00b('0x40')](this['trunks'][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')])&&(this['trunks'][util['format'](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf7')||this[_0xb00b('0x12')][util['format']('SIP/%s',_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf8'));};Preview['prototype'][_0xb00b('0xf9')]=function(_0x18e86f,_0x3aa8c0){return this[_0xb00b('0xfa')](_0x18e86f,_0x3aa8c0)[_0xb00b('0x57')](function(_0x166ff5){return _[_0xb00b('0xfb')](_0x166ff5,[_0xb00b('0x2e')]);})['catch'](function(_0x1b097a){if(_0x1b097a[_0xb00b('0xfc')]){rpcDb[_0xb00b('0xfd')](_0x18e86f);}if(_0x1b097a['active']){rpcDb['disableContact'](_0x18e86f);}throw _['pick'](_0x1b097a,[_0xb00b('0x2e')]);});};Preview[_0xb00b('0xd')][_0xb00b('0xfa')]=function(_0x4bc6df,_0x399902){var _0x34985d=this;var _0x2057d1,_0xdee547;return rpcDb[_0xb00b('0xfe')](_0x4bc6df)['then'](function(_0x1674ab){if(!_['isNil'](_0x1674ab[0x0])){_0xdee547=_0x1674ab[0x0][_0xb00b('0xff')]?![]:!![];_0x2057d1=_0x1674ab[0x0][_0xb00b('0xff')]?!![]:![];_0x2057d1=_0x399902?!![]:_0x2057d1;}var _0xde6b5=_0x34985d[_0xb00b('0x100')](_0x1674ab);if(_0xde6b5[_0xb00b('0x101')]){rpcDb[_0xb00b('0x102')](_['pick'](_0x1674ab[0x0],[_0xb00b('0x49'),_0xb00b('0x103')]))[_0xb00b('0x57')](function(_0x278d9e){_0x34985d[_0xb00b('0xe7')](_0x278d9e,_0x1674ab[0x0],_0x399902,_0xdee547,_0x2057d1)[_0xb00b('0x57')](function(_0x26cd15){return _0x26cd15;})[_0xb00b('0x69')](function(_0xd2f1ba){throw _0xd2f1ba;});})[_0xb00b('0x69')](function(_0x5f1258){ut[_0xb00b('0x31')](_0xb00b('0x104'),_0x5f1258);throw ut['message'](_0xb00b('0x105'),_0xdee547,_0x2057d1);});}else{throw ut['message'](_0xde6b5['message'],_0xdee547,_0x2057d1);}})['catch'](function(_0x384a16){ut['logger'](_0xb00b('0x106'),_0x384a16);throw ut[_0xb00b('0x2e')](_0xb00b('0x105'),![],!![]);});};Preview[_0xb00b('0xd')][_0xb00b('0x100')]=function(_0x116ced){if(_[_0xb00b('0x40')](_0x116ced)||_[_0xb00b('0x107')](_0x116ced)||!_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')])&&_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')][_0xb00b('0x33')])){ut[_0xb00b('0x31')]('[Preview][validateContact][Empty\x20Contact]',_0x116ced);return{'isValid':![],'message':_0xb00b('0x108')};}var _0x15f9cd=this[_0xb00b('0x22')][_0x116ced[0x0][_0xb00b('0x42')][_0xb00b('0x33')]];_0x15f9cd['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];if(_['isNil'](_0x15f9cd)){ut['logger'](_0xb00b('0x109'),_0x15f9cd);return{'isValid':![],'message':_0xb00b('0x10a')};}if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x10b')])){ut[_0xb00b('0x31')](_0xb00b('0x10c'),_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x10e'));if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x6d')])){ut['logger'](_0xb00b('0x10c'),_0x15f9cd['name']+_0xb00b('0x10f'));return{'isValid':![],'message':_0xb00b('0x110')};}}if(!ut[_0xb00b('0x111')](_0x15f9cd[_0xb00b('0x3b')])){ut[_0xb00b('0x31')](_0xb00b('0x112'),_0x15f9cd['name']+_0xb00b('0x113'));return{'isValid':![],'message':_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x113')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb00b('0xd')][_0xb00b('0xe9')]=function(_0x58dbf6,_0x199ba1,_0x16cca9,_0x3c57b2){var _0xca4a87=this;return new Promise(function(_0x456515,_0x26145a){var _0x31fa5b=_0x58dbf6[_0xb00b('0x9c')];var _0x1ba141=_0xca4a87['isTrunkReachable'](_0x199ba1[_0xb00b('0x10b')])?util[_0xb00b('0x25')]('SIP/%s/%s%s',_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x114')])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1[_0xb00b('0x116')]>0x0?_0x16cca9[_0xb00b('0x103')][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9[_0xb00b('0x103')]):util['format'](_0xb00b('0x118'),_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1['Trunk'][_0xb00b('0x33')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1['dialPrefix'])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1['dialCutDigit']>0x0?_0x16cca9['phone'][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9['phone']);var _0x1256a8=_0xca4a87['isTrunkReachable'](_0x199ba1['Trunk'])?ut[_0xb00b('0x119')](_0x199ba1['Trunk']['callerid'],_0x199ba1[_0xb00b('0x11a')],_0x199ba1[_0xb00b('0x11b')]>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1[_0xb00b('0x11b')]):_0x199ba1[_0xb00b('0x11d')]):ut[_0xb00b('0x119')](_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x11e')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x11e')],_0x199ba1[_0xb00b('0x11a')],_0x199ba1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1['dialRandomLastDigitCallerIdNumber']):_0x199ba1[_0xb00b('0x11d')]);if(_0x1256a8){_0x58dbf6['originatecalleridname']=ut[_0xb00b('0x11f')](_0x1256a8);_0x58dbf6[_0xb00b('0x120')]=ut[_0xb00b('0x121')](_0x1256a8);}var _0x5657ee=ut[_0xb00b('0x122')](_0x199ba1,_0x16cca9,_0x1ba141,_0x1256a8,_0x31fa5b,_0x58dbf6);_[_0xb00b('0x123')](_0x58dbf6,ut['toLowerVariables'](_0x5657ee));_0x58dbf6[_0xb00b('0x60')]=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x199ba1[_0xb00b('0x124')]=_0x5657ee;var _0x57bfab=ut[_0xb00b('0x125')](_0x58dbf6,_0x199ba1,_0x5657ee,_0x58dbf6[_0xb00b('0x83')],_0x3c57b2);return ami[_0xb00b('0x4b')](_0x57bfab)['then'](function(_0x571811){_0x199ba1['originated']+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x126'),_0x31fa5b,_0xb00b('0x9d'),_0x199ba1[_0xb00b('0x33')],_0xb00b('0x44'),_0x199ba1[_0xb00b('0xd6')]);_0x456515(_0x571811);})[_0xb00b('0x69')](function(_0x39b4c6){ut[_0xb00b('0xdd')](_0x58dbf6,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58dbf6,_0xb00b('0x127'));_0x26145a(_0x39b4c6);});});};Preview[_0xb00b('0xd')]['syncNewExten']=function(_0x42fdce){if(this['actions'][_0x42fdce[_0xb00b('0x9f')]]){this['actions'][_0x42fdce[_0xb00b('0x9f')]][_0xb00b('0x4c')]=_0x42fdce['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x5573c9){var _0x44767a=this;var _0x4d4dbe=this[_0xb00b('0x13')][_0x5573c9[_0xb00b('0x128')]];if(_0x4d4dbe){if(_0x4d4dbe[_0xb00b('0x129')]&&this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]]){ut[_0xb00b('0x12a')](_0x4d4dbe,this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]][_0xb00b('0x33')],this[_0xb00b('0x14')][_0x4d4dbe['lookAgent']]['id']);}var _0x4cff99=_[_0xb00b('0x12b')](_0x4d4dbe);_0x4cff99['responsetime']=moment()[_0xb00b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x198536=_0x44767a[_0xb00b('0x22')][_0x4d4dbe['queue']];if(ut[_0xb00b('0x12c')](_0x5573c9['response'])){if(_0x4d4dbe[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x4d4dbe['idContact']);}if(_0x4d4dbe[_0xb00b('0x83')]){rpcDb[_0xb00b('0x5f')](_0x4d4dbe[_0xb00b('0x85')]);}ami[_0xb00b('0x23')](_0xb00b('0x12d'),ut['buildObj'](_0x4d4dbe,_0xb00b('0x12e'),this[_0xb00b('0x22')][_0x4d4dbe['queue']]));this['callProgressDetectingAgent'](_0x4cff99,_0x198536,_0x5573c9);}else{_0x4d4dbe[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x4cff99,0x4,_0xb00b('0x12f'));rpcDb[_0xb00b('0xe0')](_0x4cff99,_0xb00b('0x130'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0xcaefbd){var _0x482fc4=this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]];var _0x22f2f6;if(_0x482fc4){_0x22f2f6=this[_0xb00b('0x22')][_0x482fc4['queue']];logger[_0xb00b('0x41')](_0xb00b('0x131'),_0xcaefbd['linkedid'],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6['pTalking']);}if(this['actions'][_0xcaefbd[_0xb00b('0x9f')]]&&_0xcaefbd[_0xb00b('0x9f')]!==_0xcaefbd[_0xb00b('0x9c')]){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){this['callProgressDetectingCustomer'](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this['actions'][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger[_0xb00b('0x41')]('[syncHangup][talking][cause]',_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6['name'],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}else if(_0x482fc4&&_[_0xb00b('0x40')](_0x482fc4[_0xb00b('0x134')])&&_0x22f2f6['dialQueueProject']&&_0xcaefbd[_0xb00b('0x9f')]===_0xcaefbd[_0xb00b('0x9c')]&&_['isNil'](_0xcaefbd['reason'])&&_0xcaefbd['cause']==='16'&&_0xcaefbd[_0xb00b('0x135')]==='6'&&_[_0xb00b('0xda')](_0x482fc4[_0xb00b('0x136')])){if(_0x482fc4[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x482fc4[_0xb00b('0x85')]);}if(_0x482fc4[_0xb00b('0x83')]){rpcDb['disableContact'](_0x482fc4['idContact']);}_0xcaefbd[_0xb00b('0xdc')]='22';this[_0xb00b('0xd9')](_0x482fc4,_0x22f2f6,_0xcaefbd);}else if(_0x482fc4&&_0x482fc4['transfer']){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger['info'](_0xb00b('0x137'),_0xcaefbd['linkedid'],_0xcaefbd['cause'],'\x20Queue',_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){logger[_0xb00b('0x41')](_0xb00b('0x138'),_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],'pTalking:\x20',_0x22f2f6['pTalking']);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x1e0206){if(this[_0xb00b('0x13')][_0x1e0206[_0xb00b('0xd7')]]&&_0x1e0206[_0xb00b('0xd7')]!==_0x1e0206['destuniqueid']){this[_0xb00b('0x133')](_0x1e0206,_0x1e0206[_0xb00b('0xd7')],_0x1e0206[_0xb00b('0xcd')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x45ad1f){if(this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]]&&_0x45ad1f[_0xb00b('0x9f')]!==_0x45ad1f[_0xb00b('0x9c')]&&!this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]][_0xb00b('0x46')]){if(_0x45ad1f[_0xb00b('0x132')]==='1'){this['callProgressDetectingCustomer'](_0x45ad1f,_0x45ad1f['linkedid'],_0x45ad1f[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x139')]=function(_0x121451,_0x2e9604,_0x19fce8){if(this[_0xb00b('0x13')][_0x121451]){if(_['isNil'](this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')])){this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')]={};}this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')][_0x2e9604]=_0x19fce8;}};Preview['prototype'][_0xb00b('0x13a')]=function(_0x1ec1c7){try{if(!_['isNil'](_0x1ec1c7)){if(ut[_0xb00b('0x13b')](_[_0xb00b('0x13c')](_0x1ec1c7[_0xb00b('0x13d')])[0x0])){this[_0xb00b('0x139')](_0x1ec1c7[_0xb00b('0x9c')],_[_0xb00b('0x13c')](_0x1ec1c7['variable'])[0x0],_0x1ec1c7['value']);}}}catch(_0x465238){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x465238,{'showHidden':![],'depth':null}));}};Preview[_0xb00b('0xd')][_0xb00b('0x1f')]=function(_0x5a400c){if(_0x5a400c){if(this['actions'][_0x5a400c[_0xb00b('0x13e')]]){this[_0xb00b('0x13')][_0x5a400c[_0xb00b('0x13e')]][_0xb00b('0x136')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x3fd141){if(_0x3fd141){if(this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]){this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]['transfer']=!![];}}};module[_0xb00b('0x140')]=Preview; \ No newline at end of file +var _0xb43b=['custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','isTrunkReachable','active','trunks','SIP/%s','reachable','execRun','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','substring','TrunkBackup','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','agents','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./action','../dialer/utils','redis','defaults','localhost','prototype','tail','finally','campaignsPreview','voiceQueues','actions','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncAttendedTransfer','loopCampaigns','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','name','\x20is\x20deactivated','syncCampaigns','dialMethod','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus'];(function(_0x2f1c20,_0x579774){var _0x3f606e=function(_0x498eda){while(--_0x498eda){_0x2f1c20['push'](_0x2f1c20['shift']());}};_0x3f606e(++_0x579774);}(_0xb43b,0x1b2));var _0xbb43=function(_0x55185c,_0xc1c55){_0x55185c=_0x55185c-0x0;var _0x1a8612=_0xb43b[_0x55185c];return _0x1a8612;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var uuid=require('uuid');var moment=require(_0xbb43('0x2'));var Redis=require(_0xbb43('0x3'));var config=require(_0xbb43('0x4'));var logger=require('../../../config/logger')(_0xbb43('0x5'));var loggerAction=require(_0xbb43('0x6'))(_0xbb43('0x7'));var ami=require(_0xbb43('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xbb43('0x9'));var ut=require('./util/util');var utils=require(_0xbb43('0xa'));config[_0xbb43('0xb')]=_[_0xbb43('0xc')](config[_0xbb43('0xb')],{'host':_0xbb43('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb43('0xb')]));var Sequence=function(){};Sequence[_0xbb43('0xe')]['enqueue']=function(_0x7e0fc2){this[_0xbb43('0xf')]=this[_0xbb43('0xf')]?this[_0xbb43('0xf')][_0xbb43('0x10')](_0x7e0fc2):_0x7e0fc2();};function Preview(_0x2bef86){this['sequence']=new Sequence();this[_0xbb43('0x11')]=_0x2bef86[_0xbb43('0x12')];this['trunks']=_0x2bef86['trunks'];this[_0xbb43('0x13')]={};this['agents']=_0x2bef86['agents'];this[_0xbb43('0x14')]=0x0;ami['on']('originateresponse',this[_0xbb43('0x15')][_0xbb43('0x16')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbb43('0x17'),this[_0xbb43('0x18')]['bind'](this));ami['on']('dialend',this[_0xbb43('0x19')]['bind'](this));ami['on']('newexten',this[_0xbb43('0x1a')][_0xbb43('0x16')](this));ami['on'](_0xbb43('0x1b'),this['syncVarSet'][_0xbb43('0x16')](this));ami['on']('attendedtransfer',this[_0xbb43('0x1c')][_0xbb43('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xbb43('0x16')](this));this[_0xbb43('0x1d')](this[_0xbb43('0x11')]);}function emit(_0x2bf2d4,_0x5bcce7,_0x40a650){io['to'](_0x2bf2d4)['emit'](_0x5bcce7,_0x40a650);}function emitVoiceQueueChannelRemove(_0x3a257d){logger['info'](_0xbb43('0x1e'),JSON['stringify'](_0x3a257d));emit(util[_0xbb43('0x1f')](_0xbb43('0x20'),_0x3a257d['name']),_0xbb43('0x21'),_0x3a257d);io['emit'](_0xbb43('0x22'),_0x3a257d);}function notSendMessagesQueue(_0x298ce2){if(_0x298ce2[_0xbb43('0x23')]){if(_0x298ce2['originated']===0x0&&_0x298ce2['pTalking']===0x0){_0x298ce2['sendMessageOneNotActive']=![];_0x298ce2[_0xbb43('0x24')]=0x0;_0x298ce2[_0xbb43('0x25')]=0x0;_0x298ce2['message']=utils[_0xbb43('0x26')][_0xbb43('0x27')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2['name']+'\x20is\x20not\x20active');}else{_0x298ce2[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x2b')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2[_0xbb43('0x2c')]+_0xbb43('0x2d'));}}}Preview[_0xbb43('0xe')]['loopCampaigns']=function(){var _0x2ad6da=this;setInterval(function(){_0x2ad6da['syncCampaigns']();},0x7cf);};Preview[_0xbb43('0xe')][_0xbb43('0x2e')]=function(){var _0x34f5b2=this[_0xbb43('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x157d62 in _0x34f5b2){if(_0x34f5b2['hasOwnProperty'](_0x157d62)&&(_0x34f5b2[_0x157d62]['dialMethod']==='preview'||_0x34f5b2[_0x157d62][_0xbb43('0x2f')]==='booked')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(this[_0xbb43('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xbb43('0x32')]();}}if(_0x34f5b2[_0xbb43('0x33')](_0x157d62)&&_0x34f5b2[_0x157d62][_0xbb43('0x2f')]===_0xbb43('0x5')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(_0x34f5b2[_0x157d62][_0xbb43('0x34')]){this[_0xbb43('0x35')](_0x34f5b2[_0x157d62]);if(_0x34f5b2[_0x157d62]['dialPreviewAutoRecallMe'])this[_0xbb43('0x36')](_0x34f5b2[_0x157d62]);}else{notSendMessagesQueue(_0x34f5b2[_0x157d62]);}}}};Preview[_0xbb43('0xe')][_0xbb43('0x37')]=function(_0x244d66){var _0x4015ec=this;this[_0xbb43('0x38')][_0xbb43('0x39')](function(){if(!_[_0xbb43('0x3a')](_0x4015ec[_0xbb43('0x13')][_0x244d66])){loggerAction[_0xbb43('0x3b')](_0xbb43('0x3c'),_0x244d66,_0xbb43('0x3d'),_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')],_0xbb43('0x3f'),JSON[_0xbb43('0x40')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]]['originated']),_0xbb43('0x41'),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x11')][_0x4015ec['actions'][_0x244d66]['queue']]['pTalking']),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x13')][_0x244d66]['dialAnswer']),JSON['stringify'](_[_0xbb43('0x42')](_0x4015ec[_0xbb43('0x13')][_0x244d66],[_0xbb43('0x43'),_0xbb43('0x44'),_0xbb43('0x45'),'ListId'])));return ami[_0xbb43('0x46')]({'action':_0xbb43('0x47'),'channel':_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x48')]})[_0xbb43('0x49')](function(_0x531d96){if(_0x531d96[_0xbb43('0x2a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4015ec[_0xbb43('0x13')][_0x244d66]){ut[_0xbb43('0x4a')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66]['queue']],_0xbb43('0x4b'));if(_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x4c')]===!![]){ut[_0xbb43('0x4d')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]],'[clearZombieChannel]');ut[_0xbb43('0x4e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);}ut[_0xbb43('0x4e')](_0xbb43('0x4f')+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);delete _0x4015ec['actions'][_0x244d66];}},0x2328);}});}});};Preview[_0xbb43('0xe')]['clearZombieChannels']=function(){var _0x307f1e=this;loggerAction[_0xbb43('0x3b')](_0xbb43('0x50'),_[_0xbb43('0x51')](this['actions']));for(var _0x4622ea in this[_0xbb43('0x13')]){if(_0x307f1e[_0xbb43('0x13')][_0xbb43('0x33')](_0x4622ea)){_0x307f1e[_0xbb43('0x37')](_0x4622ea);}}};Preview[_0xbb43('0xe')][_0xbb43('0x36')]=function(_0x3592fb){var _0x5a662b=this;rpcDb[_0xbb43('0x52')](_0x3592fb['id'],ut[_0xbb43('0x53')](this['agents']))[_0xbb43('0x54')](function(_0x5d4c19){if(!_['isNil'](_0x5d4c19)){for(var _0x4d7034=0x0;_0x4d7034<_0x5d4c19['length'];_0x4d7034+=0x1){if(ut[_0xbb43('0x55')](_0x5d4c19[_0x4d7034]['scheduledat'])<_0x3592fb[_0xbb43('0x56')]*0x3c){if(_0x5d4c19[_0x4d7034]['Agent']&&!_0x5d4c19[_0x4d7034][_0xbb43('0x57')][_0xbb43('0x58')]){_0x5a662b[_0xbb43('0x59')](_0x5d4c19[_0x4d7034]['id'])['then'](ut[_0xbb43('0x5a')]('[RecallMe]'))[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x5b')));}else{rpcDb[_0xbb43('0x5c')](_0x5d4c19[_0x4d7034]['id']);}}else{var _0x417ad9=new Action(_0x5d4c19[_0x4d7034],_0x3592fb);_0x417ad9[_0xbb43('0x5d')]=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3592fb[_0xbb43('0x5e')]+=0x1;ut[_0xbb43('0x5f')](_0x417ad9,0x17,_0xbb43('0x60'));if(_0x3592fb[_0xbb43('0x61')]){rpcDb['rescheduleContactInQueue'](ut[_0xbb43('0x62')](_0x5d4c19[_0x4d7034]));rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x64'));}else{ut[_0xbb43('0x5f')](_0x417ad9,0x16,'RecallFailedTimeout');rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x65'));rpcDb[_0xbb43('0x66')](_0x417ad9,'[HistoryRecallClose]');}}}}})[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x67')));};Preview[_0xbb43('0xe')][_0xbb43('0x35')]=function(_0x59c805){_0x59c805['sendMessageOneNotActive']=!![];if(ut[_0xbb43('0x68')](_0x59c805['loggedIn'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xbb43('0x69')](_0x59c805[_0xbb43('0x34')])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x27')];}else if(!this['isTrunkReachable'](_0x59c805[_0xbb43('0x6a')])){if(!this['isTrunkReachable'](_0x59c805['TrunkBackup'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6b')];}else{_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['ACTIVE'];}}else{_0x59c805['message']=utils[_0xbb43('0x26')][_0xbb43('0x6c')];}};Preview[_0xbb43('0xe')][_0xbb43('0x6d')]=function(_0x99cb09,_0x38d540,_0x44691b){var _0x14fce0=this;var _0x1a3f98=this['actions'][_0x38d540];var _0x1b6f96=this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]];var _0x3675d9;var _0x22bceb=![];var _0x1fae27=0x2;var _0x3f7262=0x3;if(_0x1b6f96){switch(_0x44691b){case'1':_0x1b6f96[_0xbb43('0x6e')]+=0x1;_0x1a3f98[_0xbb43('0x6f')]+=0x1;_0x1a3f98['countglobal']=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x0,_0xbb43('0x70'));ami[_0xbb43('0x71')](_0xbb43('0x72'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x74')));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoSuch]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'0',_0x1b6f96)['then'](function(_0x5a6ff0){_0x22bceb=_0x5a6ff0[_0xbb43('0x76')]==0x1;_0x1fae27=_0x1b6f96[_0xbb43('0x77')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1a3f98['countnosuchnumberretry']>=_0x1b6f96[_0xbb43('0x7d')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x7e'));}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0x6f'),_0x1b6f96[_0xbb43('0x77')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}delete this['actions'][_0x99cb09[_0xbb43('0x83')]];}else{_0x1a3f98[_0xbb43('0x6f')]++;logger[_0xbb43('0x3b')](_0xbb43('0x84'),_0x1a3f98[_0xbb43('0x6f')]);logger[_0xbb43('0x3b')]('id',_0x1a3f98['idContact']);_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnosuchnumberretry':_0x1a3f98[_0xbb43('0x6f')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0x88'):var _0x6f04b3=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));_0x1a3f98[_0xbb43('0x8a')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x8b')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x4c')]=!![];_0x1b6f96[_0xbb43('0x8c')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x8d'),_0x1a3f98['uniqueid'],_0xbb43('0x8e'),_0x1b6f96['name'],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);ami[_0xbb43('0x71')](_0xbb43('0x8f'),ut[_0xbb43('0x73')](_0x1a3f98,'connect',this['campaignsPreview'][_0x1a3f98[_0xbb43('0x3e')]]));if(_0x1b6f96[_0xbb43('0x90')]){ami['emit'](_0xbb43('0x91'),ut[_0xbb43('0x92')](_0x1a3f98));}break;case'16':ami[_0xbb43('0x71')](_0xbb43('0x93'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94'),this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]]));emitVoiceQueueChannelRemove(ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94')));_0x1b6f96[_0xbb43('0x95')]+=0x1;_0x1b6f96[_0xbb43('0x96')]+=0x1;_0x1b6f96[_0xbb43('0x97')]+=0x1;ut[_0xbb43('0x4d')](_0x1b6f96,'[16]');_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x4,_0xbb43('0x98'));rpcDb['createCustomerHistory'](_0x1a3f98,_0xbb43('0x99'));rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x9a'));rpcDb[_0xbb43('0x9b')](_0x1a3f98);_0x1b6f96[_0xbb43('0x9c')]+=_0x1a3f98['talktime'];_0x1b6f96[_0xbb43('0x9d')]+=_0x1a3f98[_0xbb43('0x9e')];logger[_0xbb43('0x3b')]('[syncHangup][talking][decrement]',_0x1a3f98[_0xbb43('0x9f')],_0xbb43('0x8e'),_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case _0xbb43('0xa0'):_0x1b6f96[_0xbb43('0xa1')]+=0x1;_0x1a3f98[_0xbb43('0xa2')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x5,_0xbb43('0xa4'));_0x1fae27=_0x1b6f96[_0xbb43('0xa5')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')]('custom:agentbusy',ut['buildObj'](_0x1a3f98,'busy'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xa6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'5',_0x1b6f96)[_0xbb43('0x54')](function(_0x8d5a8d){_0x22bceb=_0x8d5a8d[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x1a3f98[_0xbb43('0xa2')]>=_0x1b6f96['dialBusyMaxRetry']){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xa2'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xa2')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98['idContact'],'field':{'countbusyretry':_0x1a3f98[_0xbb43('0xa2')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xa7'):_0x1b6f96[_0xbb43('0xa8')]+=0x1;_0x1a3f98['countnoanswerretry']+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x3,_0xbb43('0xa9'));_0x1fae27=_0x1b6f96[_0xbb43('0xaa')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];var _0x4f356d=ut[_0xbb43('0xab')](_0x1a3f98,_0x1b6f96);ami['emit'](_0xbb43('0xac'),_0x4f356d);rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoAnswer]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'3',_0x1b6f96)[_0xbb43('0x54')](function(_0x4d9668){_0x22bceb=_0x4d9668['additional']==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xad'));}else{if(_0x1a3f98[_0xbb43('0xae')]>=_0x1b6f96[_0xbb43('0xaf')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xae'),_0x1b6f96[_0xbb43('0xaa')]),_0x1a3f98['unlockAgent'],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})['then'](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0xb1'):_0x1b6f96[_0xbb43('0xb2')]+=0x1;_0x1a3f98[_0xbb43('0xb3')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x8,'Congestion');_0x1fae27=_0x1b6f96['dialCongestionRetryFrequency'];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xb4'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xb5')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xb6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'8',_0x1b6f96)['then'](function(_0xaa42f9){_0x22bceb=_0xaa42f9[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1a3f98[_0xbb43('0xb3')]>=_0x1b6f96[_0xbb43('0xb7')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1a3f98,_0xbb43('0xb3'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xb3')]++;_0x14fce0['incrementPreviewCounters']({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countcongestionretry':_0x1a3f98['countcongestionretry']}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'CANCEL':_0x1b6f96[_0xbb43('0xb8')]+=0x1;_0x1a3f98[_0xbb43('0xb9')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x14,_0xbb43('0xba'));_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xbc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xbd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xbe'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x5bbbf4){_0x22bceb=_0x5bbbf4[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0x14,_0xbb43('0xba'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xbf'));}else{if(_0x1a3f98[_0xbb43('0xb9')]>=_0x1b6f96[_0xbb43('0xc0')]){rpcDb['createCustomerFinal'](_0x1a3f98,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,'countagentrejectretry',_0x1b6f96[_0xbb43('0xbb')]),_0x1a3f98['unlockAgent'],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xc1'):_0x1b6f96[_0xbb43('0xc2')]+=0x1;_0x1a3f98[_0xbb43('0xc3')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0xb,_0xbb43('0xc4'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xc5'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'11',_0x1b6f96)[_0xbb43('0x54')](function(_0x14cd97){_0x22bceb=_0x14cd97[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1a3f98[_0xbb43('0xc6')]>=_0x1b6f96['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xc3'),_0x1b6f96[_0xbb43('0xc7')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'18':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xc9')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x12,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xcd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xce'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'18',_0x1b6f96)['then'](function(_0x1f5a0a){_0x22bceb=_0x1f5a0a[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0x12,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xce'));}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xce'));}}else{_0x1a3f98['countnoanswerretry']++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case'19':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0x13,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,'amd'));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][machine]');_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'18',_0x1b6f96)[_0xbb43('0x54')](function(_0x54fd3b){_0x22bceb=_0x54fd3b[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,'Global');rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xcf'));}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09['linkedid']];break;default:if(_0x1a3f98[_0xbb43('0x4c')]){ut[_0xbb43('0x4d')](_0x1b6f96,_0xbb43('0xd0'));ut[_0xbb43('0x4e')](_0xbb43('0xd1')+_0x1b6f96[_0xbb43('0x2c')],_0x99cb09);}_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0xc,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xd2'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x2965ec){_0x22bceb=_0x2965ec[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xd3'));}else{rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xd3'));}delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];}else{_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});}});}if(!(_0x1a3f98['dialAnswer']&&_0x44691b==='16')){ut['updateOriginated'](_0x1b6f96,_0xbb43('0xd4'));logger[_0xbb43('0x3b')]('[originated][decrement][callProgressDetectingCustomer]',_0x1a3f98[_0xbb43('0x9f')],'\x20Queue',_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x1b6f96[_0xbb43('0xd5')]);}if(_0x44691b!=='ANSWER'){delete this['actions'][_0x99cb09['linkedid']];delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0xd6')]];}_0x1b6f96[_0xbb43('0xd7')]=!![];}};Preview[_0xbb43('0xe')][_0xbb43('0xd8')]=function(_0x53b9ee,_0xb54a91,_0x7271d0){if(_[_0xbb43('0xd9')](_0xb54a91)&&_0xbb43('0xda')!==typeof _0xb54a91){return;}if(_[_0xbb43('0xd9')](_0x7271d0)&&_0xbb43('0xda')!==typeof _0x7271d0){return;}switch(_0x7271d0['reason']){case'0':ut['logAgent'](_0x53b9ee,0x0,_0xbb43('0x70'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x53b9ee,0x3,_0xbb43('0xa9'));rpcDb['createAgentHistory'](_0x53b9ee,_0xbb43('0xdc'));break;case'5':ut[_0xbb43('0xdd')](_0x53b9ee,0x5,_0xbb43('0xa4'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xbb43('0xdd')](_0x53b9ee,0x8,_0xbb43('0xde'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));break;case'22':ut[_0xbb43('0xdd')](_0x53b9ee,0x16,_0xbb43('0xe0'));rpcDb['createAgentHistory'](_0x53b9ee,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbb43('0xdd')](_0x53b9ee,0xc,_0x7271d0[_0xbb43('0xe1')]);rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));}ut[_0xbb43('0x4a')](_0xb54a91,'[callProgressDetectingAgent]');logger['info'](_0xbb43('0xe2'),_0x53b9ee[_0xbb43('0x9f')],_0xbb43('0x8e'),_0xb54a91['name'],_0xbb43('0x3f'),_0xb54a91[_0xbb43('0xd5')]);delete this[_0xbb43('0x13')][_0x53b9ee['uniqueid']];};Preview[_0xbb43('0xe')]['verifyAdditionalPhones']=function(_0x2719ce,_0x235409,_0x3386bc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2719ce,_0x235409,_0x3386bc)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe3')));};Preview[_0xbb43('0xe')][_0xbb43('0x87')]=function(_0x34e8b8,_0x339b30,_0x4122e7){return cmHopperAdditionalPhone[_0xbb43('0x87')](_0x34e8b8,_0x339b30,_0x4122e7)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe4')));};Preview[_0xbb43('0xe')][_0xbb43('0x85')]=function(_0x5e2afe){return Promise[_0xbb43('0xe5')]()[_0xbb43('0x54')](cmHopperAdditionalPhone[_0xbb43('0x85')](_0x5e2afe))[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe6')));};Preview[_0xbb43('0xe')][_0xbb43('0xe7')]=function(_0x1f8f78,_0x3a05be,_0x2dd161,_0x2d2127,_0x3c537a){var _0x36af9a=this;return new Promise(function(_0x199b58,_0x357e45){if(_[_0xbb43('0x3a')](_0x3a05be)||_['isNil'](_0x3a05be[_0xbb43('0xe8')])||_['isNil'](_0x3a05be['phone'])||_[_0xbb43('0x3a')](_0x3a05be[_0xbb43('0x45')])){_0x357e45(ut['message']('Contact\x20is\x20undefined',_0x2d2127,_0x3c537a));return;}var _0x3fce74=uuid['v4']();var _0x5911fc=_0x36af9a['campaignsPreview'][_0x3a05be[_0xbb43('0x3d')]['name']];var _0x41f3fe=_0x2dd161?_0x36af9a['agents'][_0x2dd161]['id']:undefined;_0x36af9a[_0xbb43('0x13')][_0x3fce74]=new Action(_0x3a05be,_0x5911fc,_0x3fce74,_0x2dd161,_0x41f3fe);var _0x5fdbcd=_0x36af9a['actions'][_0x3fce74];_0x5fdbcd[_0xbb43('0x81')]=_0x2d2127;_0x5fdbcd[_0xbb43('0x82')]=_0x3c537a;_0x5fdbcd[_0xbb43('0xe9')]=_0x2dd161;if(_[_0xbb43('0xea')](_0x1f8f78)){_0x36af9a[_0xbb43('0xeb')](_0x5fdbcd,_0x5911fc,_0x3a05be,_0x2dd161)['then'](function(_0x6b0dd){logger[_0xbb43('0x3b')](_0xbb43('0xec'),_0xbb43('0xed')+_0x5fdbcd[_0xbb43('0x3e')]+'\x20IdHopper:\x20'+_0x5fdbcd[_0xbb43('0x86')],JSON[_0xbb43('0x40')](_0x6b0dd));ami[_0xbb43('0x71')]('custom:agentcalled',ut['buildObj'](_0x5fdbcd,_0xbb43('0xee'),_0x36af9a[_0xbb43('0x11')][_0x5fdbcd[_0xbb43('0x3e')]]));_0x199b58(ut['message']('Calling'));})[_0xbb43('0x49')](function(_0x1ab4c4){ut[_0xbb43('0x28')](_0xbb43('0xef'),_0x1ab4c4);_0x357e45(ut[_0xbb43('0x2a')]('Call\x20failed',_0x2d2127,_0x3c537a));});}else{_0x5911fc[_0xbb43('0xf0')]+=0x1;ut[_0xbb43('0xf1')](_0x5fdbcd);rpcDb[_0xbb43('0xf2')](_0x5fdbcd,_0xbb43('0xf3'));delete _0x36af9a[_0xbb43('0x13')][_0x3fce74];_0x357e45(ut[_0xbb43('0x2a')]('Contact\x20in\x20black\x20List',_0x2d2127,_0x3c537a));}});};Preview[_0xbb43('0xe')][_0xbb43('0xf4')]=function(_0x12f7a9){return!_['isNil'](_0x12f7a9)&&!_[_0xbb43('0x3a')](_0x12f7a9['name'])&&!_[_0xbb43('0x3a')](_0x12f7a9[_0xbb43('0xf5')])&&_0x12f7a9[_0xbb43('0xf5')]&&!_[_0xbb43('0x3a')](this['trunks'][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])])&&!_[_0xbb43('0x3a')](this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9['name'])][_0xbb43('0x47')])&&(this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9[_0xbb43('0x2c')])]['status']===_0xbb43('0xf8')||this[_0xbb43('0xf6')][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])]['status']==='unmonitored');};Preview['prototype']['run']=function(_0x44b3de,_0x5d7629){return this[_0xbb43('0xf9')](_0x44b3de,_0x5d7629)[_0xbb43('0x54')](function(_0x20be22){return _[_0xbb43('0x42')](_0x20be22,['message']);})[_0xbb43('0x49')](function(_0x12c97f){if(_0x12c97f['unlock']){rpcDb[_0xbb43('0xfa')](_0x44b3de);}if(_0x12c97f[_0xbb43('0xf5')]){rpcDb['disableContact'](_0x44b3de);}throw _['pick'](_0x12c97f,[_0xbb43('0x2a')]);});};Preview[_0xbb43('0xe')][_0xbb43('0xf9')]=function(_0x5d6ec2,_0x17065d){var _0x59fc4a=this;var _0x448d75,_0x33edab;return rpcDb[_0xbb43('0xfb')](_0x5d6ec2)[_0xbb43('0x54')](function(_0x55df31){if(!_[_0xbb43('0x3a')](_0x55df31[0x0])){_0x33edab=_0x55df31[0x0][_0xbb43('0xfc')]?![]:!![];_0x448d75=_0x55df31[0x0][_0xbb43('0xfc')]?!![]:![];_0x448d75=_0x17065d?!![]:_0x448d75;}var _0x7c7f55=_0x59fc4a[_0xbb43('0xfd')](_0x55df31);if(_0x7c7f55['isValid']){rpcDb[_0xbb43('0xfe')](_[_0xbb43('0x42')](_0x55df31[0x0],['VoiceQueueId','phone']))[_0xbb43('0x54')](function(_0x4d0023){_0x59fc4a[_0xbb43('0xe7')](_0x4d0023,_0x55df31[0x0],_0x17065d,_0x33edab,_0x448d75)[_0xbb43('0x54')](function(_0x36fddb){return _0x36fddb;})[_0xbb43('0x49')](function(_0x6bbd30){throw _0x6bbd30;});})[_0xbb43('0x49')](function(_0x21a044){ut[_0xbb43('0x28')](_0xbb43('0xff'),_0x21a044);throw ut[_0xbb43('0x2a')]('Call\x20unsuccessful',_0x33edab,_0x448d75);});}else{throw ut[_0xbb43('0x2a')](_0x7c7f55[_0xbb43('0x2a')],_0x33edab,_0x448d75);}})[_0xbb43('0x49')](function(_0x544418){ut[_0xbb43('0x28')](_0xbb43('0x100'),_0x544418);throw ut[_0xbb43('0x2a')](_0xbb43('0x101'),![],!![]);});};Preview[_0xbb43('0xe')]['validateContact']=function(_0x3f4ab7){if(_['isNil'](_0x3f4ab7)||_['isEmpty'](_0x3f4ab7)||!_['isNil'](_0x3f4ab7[0x0]['Agent'])&&_[_0xbb43('0x3a')](_0x3f4ab7[0x0][_0xbb43('0x57')][_0xbb43('0x2c')])){ut[_0xbb43('0x28')](_0xbb43('0x102'),_0x3f4ab7);return{'isValid':![],'message':_0xbb43('0x103')};}var _0x108e6d=this['campaignsPreview'][_0x3f4ab7[0x0][_0xbb43('0x3d')][_0xbb43('0x2c')]];_0x108e6d[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6c')];if(_[_0xbb43('0x3a')](_0x108e6d)){ut[_0xbb43('0x28')](_0xbb43('0x104'),_0x108e6d);return{'isValid':![],'message':_0xbb43('0x105')};}if(!this[_0xbb43('0xf4')](_0x108e6d[_0xbb43('0x6a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x107'));if(!this[_0xbb43('0xf4')](_0x108e6d['TrunkBackup'])){ut[_0xbb43('0x28')](_0xbb43('0x108'),_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x108e6d[_0xbb43('0x34')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x10a'));return{'isValid':![],'message':_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xbb43('0x10b')};};Preview[_0xbb43('0xe')][_0xbb43('0xeb')]=function(_0x581645,_0x4e7cdb,_0x3eaada,_0x1c9c7f){var _0x1d5376=this;return new Promise(function(_0x2ba34c,_0x30e984){var _0x5d7a43=_0x581645[_0xbb43('0x9f')];var _0x540b8d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb[_0xbb43('0x6a')])?util[_0xbb43('0x1f')](_0xbb43('0x10c'),_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')]['trim']()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]):util[_0xbb43('0x1f')](_0xbb43('0x10c'),_[_0xbb43('0x3a')](_0x4e7cdb['TrunkBackup'])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')][_0xbb43('0x112')]()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]);var _0x1f211d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb['Trunk'])?ut[_0xbb43('0x113')](_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]):ut['getCallerId'](_[_0xbb43('0x3a')](_0x4e7cdb[_0xbb43('0x111')])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]);if(_0x1f211d){_0x581645[_0xbb43('0x118')]=ut[_0xbb43('0x119')](_0x1f211d);_0x581645[_0xbb43('0x11a')]=ut[_0xbb43('0x11b')](_0x1f211d);}var _0x19260c=ut[_0xbb43('0x11c')](_0x4e7cdb,_0x3eaada,_0x540b8d,_0x1f211d,_0x5d7a43,_0x581645);_[_0xbb43('0x11d')](_0x581645,ut[_0xbb43('0x11e')](_0x19260c));_0x581645[_0xbb43('0x5d')]=moment()['format'](_0xbb43('0x89'));_0x4e7cdb[_0xbb43('0x11f')]=_0x19260c;var _0x1baf8c=ut[_0xbb43('0x120')](_0x581645,_0x4e7cdb,_0x19260c,_0x581645[_0xbb43('0x82')],_0x1c9c7f);return ami[_0xbb43('0x46')](_0x1baf8c)['then'](function(_0x4345e4){_0x4e7cdb[_0xbb43('0xd5')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x121'),_0x5d7a43,_0xbb43('0x8e'),_0x4e7cdb[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x4e7cdb[_0xbb43('0xd5')]);_0x2ba34c(_0x4345e4);})[_0xbb43('0x49')](function(_0x510584){ut[_0xbb43('0xdd')](_0x581645,0xe,_0xbb43('0x122'));rpcDb[_0xbb43('0xdb')](_0x581645,_0xbb43('0x123'));_0x30e984(_0x510584);});});};Preview[_0xbb43('0xe')]['syncNewExten']=function(_0x26825d){if(this['actions'][_0x26825d['linkedid']]){this['actions'][_0x26825d[_0xbb43('0x83')]][_0xbb43('0x48')]=_0x26825d['channel'];}};Preview['prototype'][_0xbb43('0x15')]=function(_0x59d31f){var _0x400c6e=this;var _0x26c450=this[_0xbb43('0x13')][_0x59d31f[_0xbb43('0x124')]];if(_0x26c450){if(_0x26c450[_0xbb43('0xe9')]&&this['agents'][_0x26c450[_0xbb43('0xe9')]]){ut[_0xbb43('0x125')](_0x26c450,this[_0xbb43('0x126')][_0x26c450[_0xbb43('0xe9')]][_0xbb43('0x2c')],this[_0xbb43('0x126')][_0x26c450['lookAgent']]['id']);}var _0x756278=_[_0xbb43('0x127')](_0x26c450);_0x756278[_0xbb43('0x8a')]=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));var _0x4cd83a=_0x400c6e[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]];if(ut[_0xbb43('0x128')](_0x59d31f[_0xbb43('0x129')])){if(_0x26c450[_0xbb43('0x81')]){rpcDb[_0xbb43('0xfa')](_0x26c450[_0xbb43('0x86')]);}if(_0x26c450[_0xbb43('0x82')]){rpcDb[_0xbb43('0x5c')](_0x26c450['idContact']);}ami[_0xbb43('0x71')](_0xbb43('0x12a'),ut[_0xbb43('0x73')](_0x26c450,_0xbb43('0x12b'),this[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]]));this[_0xbb43('0xd8')](_0x756278,_0x4cd83a,_0x59d31f);}else{_0x26c450['starttime']=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xbb43('0xdd')](_0x756278,0x4,'Answer');rpcDb[_0xbb43('0xdb')](_0x756278,_0xbb43('0x12c'));}}};Preview[_0xbb43('0xe')][_0xbb43('0x12d')]=function(_0x31d75c){var _0x570d24=this['actions'][_0x31d75c['linkedid']];var _0x1d4d0b;if(_0x570d24){_0x1d4d0b=this[_0xbb43('0x11')][_0x570d24['queue']];logger['info'](_0xbb43('0x12e'),_0x31d75c[_0xbb43('0x83')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);}if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]&&_0x31d75c['linkedid']!==_0x31d75c['uniqueid']){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c['cause']);}}else if(_0x570d24&&_['isNil'](_0x570d24[_0xbb43('0x130')])&&_0x1d4d0b[_0xbb43('0x131')]&&_0x31d75c['linkedid']===_0x31d75c['uniqueid']&&_[_0xbb43('0x3a')](_0x31d75c[_0xbb43('0xe1')])&&_0x31d75c[_0xbb43('0x12f')]==='16'&&_0x31d75c[_0xbb43('0x132')]==='6'&&_['isUndefined'](_0x570d24[_0xbb43('0x133')])){if(_0x570d24['unlockAgent']){rpcDb[_0xbb43('0xfa')](_0x570d24[_0xbb43('0x86')]);}if(_0x570d24[_0xbb43('0x82')]){rpcDb['disableContact'](_0x570d24[_0xbb43('0x86')]);}_0x31d75c[_0xbb43('0xe1')]='22';this[_0xbb43('0xd8')](_0x570d24,_0x1d4d0b,_0x31d75c);}else if(_0x570d24&&_0x570d24[_0xbb43('0x133')]){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){logger[_0xbb43('0x3b')]('[syncHangup][talking][transfer]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this['actions'][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')],'\x20Queue',_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')]);}}};Preview[_0xbb43('0xe')][_0xbb43('0x19')]=function(_0xa1e9ba){if(this[_0xbb43('0x13')][_0xa1e9ba['destlinkedid']]&&_0xa1e9ba[_0xbb43('0xd6')]!==_0xa1e9ba[_0xbb43('0x134')]){this[_0xbb43('0x6d')](_0xa1e9ba,_0xa1e9ba[_0xbb43('0xd6')],_0xa1e9ba['dialstatus']);}};Preview[_0xbb43('0xe')][_0xbb43('0x18')]=function(_0x3178f7){if(this[_0xbb43('0x13')][_0x3178f7[_0xbb43('0x83')]]&&_0x3178f7[_0xbb43('0x83')]!==_0x3178f7['uniqueid']&&!this['actions'][_0x3178f7['linkedid']][_0xbb43('0x4c')]){if(_0x3178f7['cause']==='1'){this[_0xbb43('0x6d')](_0x3178f7,_0x3178f7[_0xbb43('0x83')],_0x3178f7['cause']);}}};Preview[_0xbb43('0xe')][_0xbb43('0x135')]=function(_0xea8659,_0x157391,_0x2b60f0){if(this['actions'][_0xea8659]){if(_[_0xbb43('0x3a')](this[_0xbb43('0x13')][_0xea8659]['variables'])){this['actions'][_0xea8659][_0xbb43('0x11f')]={};}this['actions'][_0xea8659][_0xbb43('0x11f')][_0x157391]=_0x2b60f0;}};Preview[_0xbb43('0xe')]['syncVarSet']=function(_0x18a8d3){try{if(!_[_0xbb43('0x3a')](_0x18a8d3)){if(ut['filterKey'](_[_0xbb43('0x136')](_0x18a8d3['variable'])[0x0])){this['addVariable'](_0x18a8d3['uniqueid'],_['keys'](_0x18a8d3[_0xbb43('0x137')])[0x0],_0x18a8d3[_0xbb43('0x138')]);}}}catch(_0x21ba01){logger[_0xbb43('0x139')](_0xbb43('0x13a'),util[_0xbb43('0x13b')](_0x21ba01,{'showHidden':![],'depth':null}));}};Preview[_0xbb43('0xe')][_0xbb43('0x1c')]=function(_0x53b812){if(_0x53b812){if(this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]]){this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]][_0xbb43('0x133')]=!![];}}};Preview[_0xbb43('0xe')]['syncBlindTransfer']=function(_0x47c884){if(_0x47c884){if(this[_0xbb43('0x13')][_0x47c884[_0xbb43('0x13d')]]){this[_0xbb43('0x13')][_0x47c884['transfererlinkedid']][_0xbb43('0x133')]=!![];}}};module[_0xbb43('0x13e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ebe7a95..1280594 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 _0xafbd=['queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','assigned','lastAssignedTo','membername'];(function(_0x9d34d4,_0x46140c){var _0x5ecf2c=function(_0x1137ee){while(--_0x1137ee){_0x9d34d4['push'](_0x9d34d4['shift']());}};_0x5ecf2c(++_0x46140c);}(_0xafbd,0x1a7));var _0xdafb=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xafbd[_0x5627e1];return _0x2f013f;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xdafb('0x0'));var cmHopper=require(_0xdafb('0x1'));var cmHopperHistory=require(_0xdafb('0x2'));var cmHopperBlack=require(_0xdafb('0x3'));var agentReportPreview=require(_0xdafb('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3535a2){return function(_0xae5400){logger[_0xdafb('0x5')](_0x3535a2,util['inspect'](_0xae5400,{'showHidden':![],'depth':null}));};}function create(_0x7e2f2){return cmHopperHistory[_0xdafb('0x6')](_0x7e2f2)[_0xdafb('0x7')](loggerCatch(_0xdafb('0x8')));}function createAgent(_0x3826a7){return BPromise[_0xdafb('0x9')]()[_0xdafb('0xa')](agentReportPreview[_0xdafb('0x6')](_0x3826a7))[_0xdafb('0x7')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x17e2a0){return cmHopper[_0xdafb('0xb')](_0x17e2a0,!![])[_0xdafb('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xdafb('0xc')]=function(_0x250262){return cmHopperBlack[_0xdafb('0xc')](_0x250262)[_0xdafb('0x7')](loggerCatch(_0xdafb('0xd')));};exports[_0xdafb('0xe')]=function(_0x3e42f5){return BPromise[_0xdafb('0x9')]()[_0xdafb('0xa')](cmHopper[_0xdafb('0xe')](_0x3e42f5))[_0xdafb('0x7')](loggerCatch(_0xdafb('0xf')));};exports[_0xdafb('0x6')]=function(_0x5cfc31,_0x4070a9){create(_0x5cfc31)['catch'](loggerCatch(_0x4070a9));moveContact(_0x5cfc31)['catch'](loggerCatch(_0x4070a9));};exports[_0xdafb('0x10')]=function(_0x341a61,_0xe54195){createAgent(_0x341a61)[_0xdafb('0x7')](loggerCatch(_0xe54195));};exports[_0xdafb('0x11')]=function(_0x2547fd,_0xddc5c3){create(_0x2547fd)[_0xdafb('0x7')](loggerCatch(_0xddc5c3));};exports['createCustomerFinal']=function(_0xfd241b,_0x2be482){moveContact(_0xfd241b)[_0xdafb('0x7')](loggerCatch(_0x2be482));};exports[_0xdafb('0x12')]=function(_0xcc6225,_0x35e949,_0xcbc382){if(_0x35e949){_0xcc6225[_0xdafb('0x13')]=null;}if(_0xcbc382){_0xcc6225[_0xdafb('0x14')]=![];}return cmHopper[_0xdafb('0x12')](_0xcc6225)[_0xdafb('0x7')](loggerCatch(_0xdafb('0x15')));};exports['countReScheduled']=function(_0x353b68){return cmHopper[_0xdafb('0x16')](_0x353b68)[_0xdafb('0x7')](loggerCatch(_0xdafb('0x17')));};exports[_0xdafb('0x18')]=function(_0x1c131d){return cmHopper[_0xdafb('0x18')]({'UserId':null},_0x1c131d,0x1)[_0xdafb('0x7')](loggerCatch(_0xdafb('0x19')));};exports['disableContact']=function(_0x3194fd){return cmHopper[_0xdafb('0x18')]({'active':![]},_0x3194fd,0x1)[_0xdafb('0x7')](loggerCatch(_0xdafb('0x1a')));};exports[_0xdafb('0x1b')]=function(_0x2335fc){var _0x1f92a2={};_0x1f92a2[_0xdafb('0x1c')]=_0x2335fc[_0xdafb('0x1c')];_0x1f92a2['uniqueid']=_0x2335fc['uniqueid'];_0x1f92a2['calleridnum']=_0x2335fc[_0xdafb('0x1d')];_0x1f92a2[_0xdafb('0x1e')]=_0x2335fc[_0xdafb('0x1e')];_0x1f92a2[_0xdafb('0x1f')]=_0x2335fc[_0xdafb('0x1f')];_0x1f92a2[_0xdafb('0x20')]=_0x2335fc[_0xdafb('0x21')];_0x1f92a2[_0xdafb('0x22')]=_0x2335fc[_0xdafb('0x21')];_0x1f92a2[_0xdafb('0x23')]=0x1;_0x1f92a2[_0xdafb('0x24')]=_0x2335fc[_0xdafb('0x25')];_0x1f92a2[_0xdafb('0x26')]=_0x2335fc['membername'];_0x1f92a2[_0xdafb('0x27')]=_0xdafb('0x28');_0x1f92a2[_0xdafb('0x29')]='xcally-motion-preview';_0x1f92a2['holdtime']=0x0;_0x1f92a2[_0xdafb('0x2a')]=0x1;_0x1f92a2[_0xdafb('0x2b')]=_0x2335fc[_0xdafb('0x2c')];_0x1f92a2[_0xdafb('0x2d')]=_0xdafb('0x2e');return BPromise[_0xdafb('0x9')]()[_0xdafb('0xa')](voiceQueueReport[_0xdafb('0x2f')](_0x1f92a2))[_0xdafb('0x7')](loggerCatch(_0xdafb('0x30')));};exports[_0xdafb('0x31')]=function(_0x42e587,_0x200385){return BPromise[_0xdafb('0x9')]()[_0xdafb('0xa')](cmHopper[_0xdafb('0x31')](_0x42e587,_0x200385))[_0xdafb('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xdafb('0x32')]=function(_0x12b8f2){return cmHopper[_0xdafb('0x12')](_0x12b8f2,!![],!![])[_0xdafb('0x7')](loggerCatch(_0xdafb('0x33')));}; \ No newline at end of file +var _0x5635=['connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime'];(function(_0x52983c,_0x44a785){var _0x5e152b=function(_0x5031d5){while(--_0x5031d5){_0x52983c['push'](_0x52983c['shift']());}};_0x5e152b(++_0x44a785);}(_0x5635,0x15d));var _0x5563=function(_0x33cd06,_0x520254){_0x33cd06=_0x33cd06-0x0;var _0x511a66=_0x5635[_0x33cd06];return _0x511a66;};'use strict';var util=require(_0x5563('0x0'));var BPromise=require(_0x5563('0x1'));var logger=require(_0x5563('0x2'))(_0x5563('0x3'));var cmHopper=require(_0x5563('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5563('0x5'));var agentReportPreview=require(_0x5563('0x6'));var voiceQueueReport=require(_0x5563('0x7'));function loggerCatch(_0x2846e3){return function(_0x117f45){logger[_0x5563('0x8')](_0x2846e3,util['inspect'](_0x117f45,{'showHidden':![],'depth':null}));};}function create(_0x49d522){return cmHopperHistory['createHistory'](_0x49d522)[_0x5563('0x9')](loggerCatch(_0x5563('0xa')));}function createAgent(_0x25b622){return BPromise[_0x5563('0xb')]()[_0x5563('0xc')](agentReportPreview[_0x5563('0xd')](_0x25b622))[_0x5563('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x53dbc2){return cmHopper[_0x5563('0xe')](_0x53dbc2,!![])[_0x5563('0x9')](loggerCatch(_0x5563('0xf')));}exports[_0x5563('0x10')]=function(_0x41149d){return cmHopperBlack[_0x5563('0x10')](_0x41149d)[_0x5563('0x9')](loggerCatch(_0x5563('0x11')));};exports['getContactPreview']=function(_0x238e86){return BPromise[_0x5563('0xb')]()[_0x5563('0xc')](cmHopper[_0x5563('0x12')](_0x238e86))[_0x5563('0x9')](loggerCatch(_0x5563('0x13')));};exports[_0x5563('0xd')]=function(_0x3a4e3b,_0x320fcd){create(_0x3a4e3b)[_0x5563('0x9')](loggerCatch(_0x320fcd));moveContact(_0x3a4e3b)['catch'](loggerCatch(_0x320fcd));};exports[_0x5563('0x14')]=function(_0x3b098a,_0x2d20f3){createAgent(_0x3b098a)[_0x5563('0x9')](loggerCatch(_0x2d20f3));};exports[_0x5563('0x15')]=function(_0x36f27b,_0x3ad496){create(_0x36f27b)[_0x5563('0x9')](loggerCatch(_0x3ad496));};exports[_0x5563('0x16')]=function(_0x3fe73e,_0x4c0341){moveContact(_0x3fe73e)[_0x5563('0x9')](loggerCatch(_0x4c0341));};exports[_0x5563('0x17')]=function(_0x3435af,_0x3c9819,_0x4e8412){if(_0x3c9819){_0x3435af[_0x5563('0x18')]=null;}if(_0x4e8412){_0x3435af[_0x5563('0x19')]=![];}return cmHopper[_0x5563('0x17')](_0x3435af)[_0x5563('0x9')](loggerCatch(_0x5563('0x1a')));};exports['countReScheduled']=function(_0x51144){return cmHopper[_0x5563('0x1b')](_0x51144)[_0x5563('0x9')](loggerCatch(_0x5563('0x1c')));};exports[_0x5563('0x1d')]=function(_0x4bf671){return cmHopper[_0x5563('0x1d')]({'UserId':null},_0x4bf671,0x1)[_0x5563('0x9')](loggerCatch(_0x5563('0x1e')));};exports[_0x5563('0x1f')]=function(_0x157ab1){return cmHopper[_0x5563('0x1d')]({'active':![]},_0x157ab1,0x1)[_0x5563('0x9')](loggerCatch(_0x5563('0x20')));};exports[_0x5563('0x21')]=function(_0x2c10f3){var _0x42d7fb={};_0x42d7fb[_0x5563('0x22')]=_0x2c10f3[_0x5563('0x22')];_0x42d7fb[_0x5563('0x23')]=_0x2c10f3[_0x5563('0x23')];_0x42d7fb[_0x5563('0x24')]=_0x2c10f3[_0x5563('0x24')];_0x42d7fb['calleridname']=_0x2c10f3[_0x5563('0x25')];_0x42d7fb[_0x5563('0x26')]=_0x2c10f3[_0x5563('0x26')];_0x42d7fb['queuecallerjoinAt']=_0x2c10f3[_0x5563('0x27')];_0x42d7fb['queuecallerleaveAt']=_0x2c10f3[_0x5563('0x27')];_0x42d7fb[_0x5563('0x28')]=0x1;_0x42d7fb[_0x5563('0x29')]=_0x2c10f3[_0x5563('0x2a')];_0x42d7fb[_0x5563('0x2b')]=_0x2c10f3[_0x5563('0x2c')];_0x42d7fb['context']=_0x5563('0x2d');_0x42d7fb[_0x5563('0x2e')]=_0x5563('0x2f');_0x42d7fb[_0x5563('0x30')]=0x0;_0x42d7fb[_0x5563('0x31')]=0x1;_0x42d7fb[_0x5563('0x32')]=_0x2c10f3['membername'];_0x42d7fb['queuecallerexitreason']=_0x5563('0x33');return BPromise[_0x5563('0xb')]()['then'](voiceQueueReport['create'](_0x42d7fb))[_0x5563('0x9')](loggerCatch(_0x5563('0x34')));};exports[_0x5563('0x35')]=function(_0x223b62,_0x5c539b){return BPromise[_0x5563('0xb')]()['then'](cmHopper['getContactRecallMe'](_0x223b62,_0x5c539b))[_0x5563('0x9')](loggerCatch(_0x5563('0x36')));};exports[_0x5563('0x37')]=function(_0x4413e6){return cmHopper[_0x5563('0x17')](_0x4413e6,!![],!![])[_0x5563('0x9')](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 b06e28b..1bfe88a 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 _0x432d=['NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','%s%s','XMD-','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','talktime','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','type','dialAnswer','active','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22'];(function(_0x175d6d,_0xa08b7e){var _0x14da3d=function(_0x47d33d){while(--_0x47d33d){_0x175d6d['push'](_0x175d6d['shift']());}};_0x14da3d(++_0xa08b7e);}(_0x432d,0xf2));var _0xd432=function(_0xc2c89,_0x22c701){_0xc2c89=_0xc2c89-0x0;var _0x4f9032=_0x432d[_0xc2c89];return _0x4f9032;};'use strict';var util=require(_0xd432('0x0'));var _=require(_0xd432('0x1'));var moment=require(_0xd432('0x2'));var logger=require(_0xd432('0x3'))('preview');var ipAgi=process[_0xd432('0x4')][_0xd432('0x5')]||_0xd432('0x6');var utils=require(_0xd432('0x7'));exports[_0xd432('0x8')]=function(_0x515485){return function(_0x30cbd7){logger[_0xd432('0x9')](_0x515485,util[_0xd432('0xa')](_0x30cbd7,{'showHidden':![],'depth':null}));};};exports[_0xd432('0xb')]=function(_0x2a07ff,_0x4b1074){logger[_0xd432('0xc')](_0x2a07ff,util['inspect'](_0x4b1074,{'showHidden':![],'depth':null}));};exports[_0xd432('0xd')]=function(_0x55c8c0,_0x1ecb26){logger[_0xd432('0x9')](_0x55c8c0,util[_0xd432('0xa')](_0x1ecb26,{'showHidden':![],'depth':null}));};exports[_0xd432('0xe')]=function(_0x48cfbc){return function(_0x5d8934){logger[_0xd432('0xc')](_0x48cfbc,util[_0xd432('0xa')](_0x5d8934,{'showHidden':![],'depth':null}));};};exports[_0xd432('0xf')]=function(_0x17d507,_0x22f9f7,_0x1edfbd){return{'message':_0x17d507,'unlock':_0x22f9f7,'active':_0x1edfbd};};exports[_0xd432('0x10')]=function(_0x12135e,_0x4371dc,_0x1d9eaa){if(!_['isUndefined'](_0x1d9eaa)&&'string'===typeof _0x1d9eaa&&!_['isEmpty'](_0x1d9eaa)){if(!_[_0xd432('0x11')](_0x4371dc)&&'string'===typeof _0x4371dc&&!_[_0xd432('0x12')](_0x4371dc)){return util[_0xd432('0x13')](_0xd432('0x14'),_0x4371dc,_0x1d9eaa);}return util[_0xd432('0x13')](_0xd432('0x14'),_0x1d9eaa,_0x1d9eaa);}if(!_[_0xd432('0x11')](_0x12135e)&&_0xd432('0x15')===typeof _0x12135e&&!_['isEmpty'](_0x12135e)){return _0x12135e;}return _0xd432('0x16');};exports['isActive']=function(_0x48399a){if(_['isNil'](_0x48399a)){return![];}return _0x48399a;};exports['addVariables']=function(_0xed21eb,_0x1fcc52,_0x58b3ab,_0x5c81ac,_0x58fd60,_0x309d19){var _0x192d4a={'XMD-QUEUE':_0x1fcc52[_0xd432('0x17')]?_0x1fcc52['Queue'][_0xd432('0x18')]:'','XMD-CALLERID':_0x5c81ac,'XMD-CALLERID-PREVIEW':_0x309d19?util['format'](_0xd432('0x14'),_0x309d19[_0xd432('0x19')],_0x309d19[_0xd432('0x1a')]):_0x5c81ac,'XMD-DIALID':_0x58fd60,'XMD-CONTACTID':_0x1fcc52[_0xd432('0x1b')],'XMD-CDRTYPE':_0xd432('0x1c'),'CALLERID(all)':_0x5c81ac,'XMD-VOICEQUEUEID':_0x1fcc52[_0xd432('0x1d')],'XMD-DIALCHANNEL':_0x58b3ab,'XMD-DIALTIMEOUT':_0xed21eb[_0xd432('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd432('0x1f'),_0xed21eb[_0xd432('0x20')]?'g':'',_[_0xd432('0x12')](_0xed21eb[_0xd432('0x21')])?'':_0xd432('0x22')),'XMD-DIALURL':_0xed21eb[_0xd432('0x23')]||'','XMD-AGI':_0xed21eb[_0xd432('0x24')]?util[_0xd432('0x13')](_0xd432('0x25'),ipAgi,_0xed21eb[_0xd432('0x24')]):'NONE','XMD-AGIAFTER':_0xed21eb[_0xd432('0x20')]?util[_0xd432('0x13')](_0xd432('0x25'),ipAgi,_0xed21eb['dialQueueProject2']):_0xd432('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x309d19?_0x309d19[_0xd432('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x309d19?_0x309d19['originatecalleridname']:'','XMD-DESTINATION':_0xd432('0x28'),'SIPADDHEADER':_0xd432('0x29')};if(!_[_0xd432('0x12')](_0xed21eb[_0xd432('0x21')])){_0x192d4a[util[_0xd432('0x13')]('%s',_0xd432('0x2a'))]=_0xed21eb[_0xd432('0x21')];_0x192d4a[util[_0xd432('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x58fd60;}if(_0x1fcc52&&_0x1fcc52[_0xd432('0x2b')]){for(var _0x3bc949 in _0x1fcc52[_0xd432('0x2b')]){if(_0x1fcc52[_0xd432('0x2b')][_0xd432('0x2c')](_0x3bc949)){if(!_[_0xd432('0x2d')](_0x1fcc52[_0xd432('0x2b')][_0x3bc949])&&_0x3bc949!=='id'&&_0x3bc949!=='tags'&&_0x3bc949!=='createdAt'&&_0x3bc949!=='updatedAt'){_0x192d4a[util[_0xd432('0x13')](_0xd432('0x2e'),_0xd432('0x2f'),_['toUpper'](_0x3bc949))]=_0x1fcc52[_0xd432('0x2b')][_0x3bc949];}}}}return _0x192d4a;};exports[_0xd432('0x30')]=function(_0x5d7f9f){var _0x1b4690={};for(var _0xe491ba in _0x5d7f9f){if(_0x5d7f9f[_0xd432('0x2c')](_0xe491ba)){_0x1b4690[util[_0xd432('0x13')]('%s',_['toLower'](_0xe491ba))]=_0x5d7f9f[_0xe491ba];}}return{'variables':_0x1b4690};};exports['updateOriginated']=function(_0x44a14e,_0x895bb3){if(!_[_0xd432('0x2d')](_0x44a14e)){if(_0x44a14e['hasOwnProperty']('originated')){if(_0x44a14e[_0xd432('0x31')]>0x0){_0x44a14e[_0xd432('0x31')]-=0x1;}else{logger[_0xd432('0x9')](_0xd432('0x32'),_0x895bb3);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x895bb3);}};exports[_0xd432('0x33')]=function(_0xb95b2d){var _0x346f19=moment()[_0xd432('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0xb95b2d[_0xd432('0x34')]=0xd;_0xb95b2d[_0xd432('0x35')]='Blacklist';_0xb95b2d['starttime']=_0x346f19;_0xb95b2d['responsetime']=_0x346f19;_0xb95b2d[_0xd432('0x36')]=_0x346f19;};exports[_0xd432('0x37')]=function(_0x257deb,_0x51954d,_0x278fa1){var _0xc8307a=moment()['format'](_0xd432('0x38'));_0x257deb[_0xd432('0x34')]=_0x51954d;_0x257deb[_0xd432('0x35')]=_0x278fa1;_0x257deb[_0xd432('0x39')]=_0xc8307a;_0x257deb[_0xd432('0x3a')]=utils[_0xd432('0x3b')](_0x257deb[_0xd432('0x39')],_0x257deb[_0xd432('0x3c')]);};exports[_0xd432('0x3d')]=function(_0x6e2288,_0x367b2a,_0x55ef2f){_0x6e2288[_0xd432('0x3e')]=_0x367b2a;_0x6e2288[_0xd432('0x3f')]=_0x55ef2f;};exports[_0xd432('0x40')]=function(_0x28fff3,_0x3a2b73,_0x25c186){var _0x528c3b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28fff3[_0xd432('0x34')]=_0x3a2b73;_0x28fff3['statedesc']=_0x25c186;_0x28fff3[_0xd432('0x39')]=_0x28fff3[_0xd432('0x39')]?_0x28fff3[_0xd432('0x39')]:_0x528c3b;_0x28fff3['endtime']=_0x28fff3['endtime']?_0x28fff3[_0xd432('0x36')]:_0x528c3b;_0x28fff3[_0xd432('0x3a')]=utils[_0xd432('0x3b')](_0x28fff3[_0xd432('0x39')]||0x0,_0x28fff3[_0xd432('0x3c')]||0x0);_0x28fff3[_0xd432('0x41')]=_0x28fff3['answertime']?utils[_0xd432('0x3b')](_0x28fff3['endtime'],_0x28fff3['answertime']):0x0;};exports['isFailure']=function(_0x509cb9){return _0x509cb9===_0xd432('0x42');};exports[_0xd432('0x43')]=function(_0x3947b0,_0x582e2b,_0x21275d,_0x270e97,_0x2823e2){var _0x57e134=_0x270e97?_0xd432('0x44'):_0x3947b0[_0xd432('0x19')];_0x57e134=_0x2823e2?'BOOKED':_0x57e134;return{'actionid':_0x3947b0['uniqueid'],'action':_0xd432('0x45'),'channel':_0x3947b0[_0xd432('0x46')],'callerid':util[_0xd432('0x13')](_0xd432('0x14'),_0x57e134,_0x3947b0[_0xd432('0x1a')]),'Exten':_0xd432('0x28'),'Context':_0xd432('0x47'),'Priority':'1','variable':_0x21275d,'timeout':(_0x582e2b[_0xd432('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3947b0[_0xd432('0x49')]};};exports[_0xd432('0x4a')]=function(_0x41c47f){return _0x41c47f[_0xd432('0x4b')]+_0x41c47f['countcongestionretry']+_0x41c47f[_0xd432('0x4c')]+_0x41c47f[_0xd432('0x4d')]+_0x41c47f['countnosuchnumberretry'];};exports[_0xd432('0x4e')]=function(_0x5973d3){var _0x4b0397=_[_0xd432('0x4f')](_0x5973d3);_0x4b0397[_0xd432('0x34')]=0xf;_0x4b0397[_0xd432('0x35')]='Global';return _0x4b0397;};exports['scheduledAt']=function(_0x200fd2,_0x249ec1,_0x5075c1){var _0x638ba3={};_0x638ba3[_0x249ec1]=_0x200fd2[_0x249ec1];_0x638ba3['active']=![];_0x638ba3[_0xd432('0x50')]=moment()['add'](_0x5075c1,'minutes')[_0xd432('0x13')](_0xd432('0x38'));_0x638ba3[_0xd432('0x1b')]=_0x200fd2[_0xd432('0x1b')];_0x638ba3[_0xd432('0x51')]=_0x200fd2[_0xd432('0x51')];_0x638ba3[_0xd432('0x1d')]=_0x200fd2[_0xd432('0x1d')]||undefined;return _0x638ba3;};exports[_0xd432('0x52')]=function(_0x4ae3f1,_0x1f67a6){if(!_[_0xd432('0x2d')](_0x4ae3f1)){if(_0x4ae3f1[_0xd432('0x53')]>0x0){_0x4ae3f1[_0xd432('0x53')]-=0x1;}else{logger[_0xd432('0x9')](_0x1f67a6,_0xd432('0x54'));}}else{logger['error'](_0x1f67a6,_0xd432('0x55'));}};exports[_0xd432('0x56')]=function(_0x1b02eb){if(_0x1b02eb<=0x0){return!![];}return![];};function buildObj(_0x55458d,_0x103619,_0x40341e){_0x55458d['lastevent']=_0x103619;_0x55458d[_0xd432('0x18')]=_0x55458d[_0xd432('0x57')];_0x55458d['interface']=_0x55458d[_0xd432('0x46')];_0x55458d[_0xd432('0x58')]=_0xd432('0x59');if(_0x40341e){_0x55458d[_0xd432('0x5a')]=_0x40341e['mandatoryDisposition'];}return _0x55458d;}exports['buildObj']=buildObj;exports[_0xd432('0x5b')]=function(_0x35cb6e){var _0x366bf={};_0x366bf['queue']=_0x35cb6e[_0xd432('0x57')];_0x366bf[_0xd432('0x5c')]=_0x35cb6e[_0xd432('0x46')];_0x366bf[_0xd432('0x49')]=_0x35cb6e[_0xd432('0x49')];return _0x366bf;};exports[_0xd432('0x5d')]=function(_0x1f0053){var _0x4b2978=[];for(var _0x2267c5 in _0x1f0053){if(_0x1f0053[_0xd432('0x2c')](_0x2267c5)){if(!_[_0xd432('0x2d')](_0x1f0053[_0x2267c5])&&_0x1f0053[_0x2267c5][_0xd432('0x34')]===_0xd432('0x5e')&&_0x1f0053[_0x2267c5][_0xd432('0x5f')]===_0xd432('0x60')){_0x4b2978['push'](_0x1f0053[_0x2267c5]['id']);}}}return _0x4b2978;};exports[_0xd432('0x61')]=function(_0x2d01f7){var _0x3d038e=moment()[_0xd432('0x62')](0x0);var _0xcbb834=moment(_0x2d01f7)[_0xd432('0x62')](0x0);return _0x3d038e[_0xd432('0x63')](_0xcbb834,_0xd432('0x64'));};exports['createBody']=function(_0x178c06){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x178c06[_0xd432('0x1b')],'ListId':_0x178c06[_0xd432('0x51')],'VoiceQueueId':_0x178c06[_0xd432('0x1d')]||undefined,'CampaignId':_0x178c06[_0xd432('0x65')]||undefined};};exports[_0xd432('0x66')]=function(_0x4ae1c2){if(_0x4ae1c2==='uniqueid'||_0x4ae1c2==='idContact'||_0x4ae1c2===_0xd432('0x57')||_0x4ae1c2===_0xd432('0x67')||_0x4ae1c2==='campaigntype'||_0x4ae1c2===_0xd432('0x68')||_0x4ae1c2===_0xd432('0x3e')||_0x4ae1c2===_0xd432('0x46')||_0x4ae1c2===_0xd432('0x19')||_0x4ae1c2===_0xd432('0x69')||_0x4ae1c2==='calleridnum'||_0x4ae1c2===_0xd432('0x50')||_0x4ae1c2===_0xd432('0x4b')||_0x4ae1c2==='countcongestionretry'||_0x4ae1c2==='countnoanswerretry'||_0x4ae1c2==='countglobal'||_0x4ae1c2===_0xd432('0x6a')||_0x4ae1c2===_0xd432('0x6b')||_0x4ae1c2===_0xd432('0x6c')||_0x4ae1c2===_0xd432('0x6d')||_0x4ae1c2===_0xd432('0x1b')||_0x4ae1c2===_0xd432('0x51')||_0x4ae1c2==='UserId'||_0x4ae1c2===_0xd432('0x1d')||_0x4ae1c2===_0xd432('0x6e')||_0x4ae1c2===_0xd432('0x6f')||_0x4ae1c2===_0xd432('0x70')||_0x4ae1c2===_0xd432('0x71')||_0x4ae1c2===_0xd432('0x72')||_0x4ae1c2===_0xd432('0x73')||_0x4ae1c2===_0xd432('0x74')||_0x4ae1c2==='xmd-dialoptions'||_0x4ae1c2===_0xd432('0x75')||_0x4ae1c2==='xmd-dialchannel'||_0x4ae1c2===_0xd432('0x76')||_0x4ae1c2==='xmd-cdrtype'||_0x4ae1c2===_0xd432('0x77')||_0x4ae1c2==='xmd-agiafter'||_0x4ae1c2==='xmd-agi'||_0x4ae1c2===_0xd432('0x78')||_0x4ae1c2===_0xd432('0x79')||_0x4ae1c2===_0xd432('0x7a')||_0x4ae1c2===_0xd432('0x7b')||_0x4ae1c2===_0xd432('0x7c')||_0x4ae1c2===_0xd432('0x7d')||_0x4ae1c2===_0xd432('0x7e')||_0x4ae1c2==='rtpaudioqosrttbridged'||_0x4ae1c2===_0xd432('0x78')||_0x4ae1c2===_0xd432('0x79')||_0x4ae1c2===_0xd432('0x7a')||_0x4ae1c2===_0xd432('0x7b')||_0x4ae1c2===_0xd432('0x7c')||_0x4ae1c2===_0xd432('0x7d')||_0x4ae1c2==='rtpaudioqosrtt'||_0x4ae1c2==='rtpaudioqosrttbridged'||_0x4ae1c2===_0xd432('0x7f')||_0x4ae1c2===_0xd432('0x80')||_0x4ae1c2===_0xd432('0x34')||_0x4ae1c2===_0xd432('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x50e4cc,_0x4f92ed){var _0x4620f7,_0x4521e0,_0x479d9e;if(_0x4f92ed<=0x0){_0x4f92ed=0x1;}_0x4620f7=new RegExp(_0xd432('0x81')+_0x4f92ed+'}$');_0x4521e0=Math['pow'](0xa,_0x4f92ed-0x1);_0x479d9e=Math[_0xd432('0x82')](0xa,_0x4f92ed)-0x1;return util[_0xd432('0x13')]('%s',_[_0xd432('0x83')](_0x50e4cc,_0x4620f7,_[_0xd432('0x84')](_0x4521e0,_0x479d9e)));};exports['extractCalleridName']=function(_0x4db04d){var _0x2d3e9a=_0x4db04d['match'](/"(.*?)"/);return _0x2d3e9a?_0x2d3e9a[0x1]:_0x4db04d;};exports['extractCalleridNumber']=function(_0x3ccf95){var _0x26fb0d=_0x3ccf95[_0xd432('0x85')](/<(.*?)>/);return _0x26fb0d?_0x26fb0d[0x1]:_0x3ccf95;};function buildNoAnswerEventPayload(_0x246123,_0x3d4739){var _0x4e17a0=buildObj(_0x246123,_0xd432('0x86'));if(!_['isEmpty'](_0x3d4739['variables'])){Object[_0xd432('0x87')](_0x3d4739[_0xd432('0x88')])[_0xd432('0x89')](function(_0x4618d0){_0x4e17a0[_0x4618d0[_0xd432('0x8a')]()]=_0x3d4739['variables'][_0x4618d0];});}return _0x4e17a0;}exports[_0xd432('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x21cd=['\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','logger2','info','message','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','XMD-','updateOriginated','originated','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','getSeconds','logLookAgent','membername','UserId','ringtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','state','Global','active','ListId','VoiceQueueId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x21cd,0x98));var _0xd21c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21cd[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0xd21c('0x0'));var _=require(_0xd21c('0x1'));var moment=require(_0xd21c('0x2'));var logger=require(_0xd21c('0x3'))('preview');var ipAgi=process['env'][_0xd21c('0x4')]||_0xd21c('0x5');var utils=require(_0xd21c('0x6'));exports[_0xd21c('0x7')]=function(_0x3c5f0f){return function(_0x26b10c){logger[_0xd21c('0x8')](_0x3c5f0f,util[_0xd21c('0x9')](_0x26b10c,{'showHidden':![],'depth':null}));};};exports[_0xd21c('0xa')]=function(_0x3a8c84,_0x250668){logger['info'](_0x3a8c84,util[_0xd21c('0x9')](_0x250668,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4545af,_0x48083e){logger[_0xd21c('0x8')](_0x4545af,util['inspect'](_0x48083e,{'showHidden':![],'depth':null}));};exports[_0xd21c('0xb')]=function(_0x42d70a){return function(_0x371b12){logger[_0xd21c('0xc')](_0x42d70a,util['inspect'](_0x371b12,{'showHidden':![],'depth':null}));};};exports[_0xd21c('0xd')]=function(_0x5b84a9,_0x20ba12,_0x2104b7){return{'message':_0x5b84a9,'unlock':_0x20ba12,'active':_0x2104b7};};exports[_0xd21c('0xe')]=function(_0x1b026f,_0x125702,_0x285420){if(!_[_0xd21c('0xf')](_0x285420)&&'string'===typeof _0x285420&&!_[_0xd21c('0x10')](_0x285420)){if(!_[_0xd21c('0xf')](_0x125702)&&'string'===typeof _0x125702&&!_[_0xd21c('0x10')](_0x125702)){return util['format'](_0xd21c('0x11'),_0x125702,_0x285420);}return util[_0xd21c('0x12')](_0xd21c('0x11'),_0x285420,_0x285420);}if(!_[_0xd21c('0xf')](_0x1b026f)&&_0xd21c('0x13')===typeof _0x1b026f&&!_[_0xd21c('0x10')](_0x1b026f)){return _0x1b026f;}return _0xd21c('0x14');};exports[_0xd21c('0x15')]=function(_0x2b4496){if(_[_0xd21c('0x16')](_0x2b4496)){return![];}return _0x2b4496;};exports[_0xd21c('0x17')]=function(_0x109567,_0x4d8a3e,_0x28a31f,_0xac117d,_0x2bfb30,_0x3d5137){var _0x8051ff={'XMD-QUEUE':_0x4d8a3e[_0xd21c('0x18')]?_0x4d8a3e[_0xd21c('0x18')]['name']:'','XMD-CALLERID':_0xac117d,'XMD-CALLERID-PREVIEW':_0x3d5137?util[_0xd21c('0x12')](_0xd21c('0x11'),_0x3d5137[_0xd21c('0x19')],_0x3d5137[_0xd21c('0x1a')]):_0xac117d,'XMD-DIALID':_0x2bfb30,'XMD-CONTACTID':_0x4d8a3e[_0xd21c('0x1b')],'XMD-CDRTYPE':_0xd21c('0x1c'),'CALLERID(all)':_0xac117d,'XMD-VOICEQUEUEID':_0x4d8a3e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x28a31f,'XMD-DIALTIMEOUT':_0x109567[_0xd21c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xd21c('0x12')](_0xd21c('0x1e'),_0x109567[_0xd21c('0x1f')]?'g':'',_[_0xd21c('0x10')](_0x109567[_0xd21c('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x109567['dialPreviewUrl']||'','XMD-AGI':_0x109567['dialQueueProject']?util[_0xd21c('0x12')](_0xd21c('0x21'),ipAgi,_0x109567[_0xd21c('0x22')]):_0xd21c('0x23'),'XMD-AGIAFTER':_0x109567[_0xd21c('0x1f')]?util['format'](_0xd21c('0x21'),ipAgi,_0x109567['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3d5137?_0x3d5137['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3d5137?_0x3d5137[_0xd21c('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xd21c('0x10')](_0x109567[_0xd21c('0x20')])){_0x8051ff[util[_0xd21c('0x12')]('%s',_0xd21c('0x25'))]=_0x109567[_0xd21c('0x20')];_0x8051ff[util[_0xd21c('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2bfb30;}if(_0x4d8a3e&&_0x4d8a3e[_0xd21c('0x26')]){for(var _0x344a59 in _0x4d8a3e[_0xd21c('0x26')]){if(_0x4d8a3e[_0xd21c('0x26')][_0xd21c('0x27')](_0x344a59)){if(!_['isNil'](_0x4d8a3e[_0xd21c('0x26')][_0x344a59])&&_0x344a59!=='id'&&_0x344a59!==_0xd21c('0x28')&&_0x344a59!==_0xd21c('0x29')&&_0x344a59!=='updatedAt'){_0x8051ff[util[_0xd21c('0x12')]('%s%s',_0xd21c('0x2a'),_['toUpper'](_0x344a59))]=_0x4d8a3e[_0xd21c('0x26')][_0x344a59];}}}}return _0x8051ff;};exports['toLowerVariables']=function(_0x415f7a){var _0xefb168={};for(var _0x1e176b in _0x415f7a){if(_0x415f7a['hasOwnProperty'](_0x1e176b)){_0xefb168[util[_0xd21c('0x12')]('%s',_['toLower'](_0x1e176b))]=_0x415f7a[_0x1e176b];}}return{'variables':_0xefb168};};exports[_0xd21c('0x2b')]=function(_0x47b75b,_0x200c0f){if(!_[_0xd21c('0x16')](_0x47b75b)){if(_0x47b75b[_0xd21c('0x27')](_0xd21c('0x2c'))){if(_0x47b75b[_0xd21c('0x2c')]>0x0){_0x47b75b['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x200c0f);}}}else{logger[_0xd21c('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x200c0f);}};exports[_0xd21c('0x2d')]=function(_0x2c0d41){var _0x144764=moment()[_0xd21c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c0d41['state']=0xd;_0x2c0d41[_0xd21c('0x2e')]=_0xd21c('0x2f');_0x2c0d41[_0xd21c('0x30')]=_0x144764;_0x2c0d41[_0xd21c('0x31')]=_0x144764;_0x2c0d41[_0xd21c('0x32')]=_0x144764;};exports[_0xd21c('0x33')]=function(_0x4dae4d,_0x302636,_0x175750){var _0x2e007d=moment()[_0xd21c('0x12')](_0xd21c('0x34'));_0x4dae4d['state']=_0x302636;_0x4dae4d[_0xd21c('0x2e')]=_0x175750;_0x4dae4d[_0xd21c('0x31')]=_0x2e007d;_0x4dae4d['ringtime']=utils[_0xd21c('0x35')](_0x4dae4d[_0xd21c('0x31')],_0x4dae4d[_0xd21c('0x30')]);};exports[_0xd21c('0x36')]=function(_0x2893f8,_0x48f034,_0x327239){_0x2893f8[_0xd21c('0x37')]=_0x48f034;_0x2893f8[_0xd21c('0x38')]=_0x327239;};exports['logCustomer']=function(_0x59aa81,_0x4096d7,_0x4a346b){var _0x4e465a=moment()['format'](_0xd21c('0x34'));_0x59aa81['state']=_0x4096d7;_0x59aa81[_0xd21c('0x2e')]=_0x4a346b;_0x59aa81[_0xd21c('0x31')]=_0x59aa81[_0xd21c('0x31')]?_0x59aa81[_0xd21c('0x31')]:_0x4e465a;_0x59aa81[_0xd21c('0x32')]=_0x59aa81[_0xd21c('0x32')]?_0x59aa81[_0xd21c('0x32')]:_0x4e465a;_0x59aa81[_0xd21c('0x39')]=utils['getSeconds'](_0x59aa81[_0xd21c('0x31')]||0x0,_0x59aa81[_0xd21c('0x30')]||0x0);_0x59aa81[_0xd21c('0x3a')]=_0x59aa81[_0xd21c('0x3b')]?utils[_0xd21c('0x35')](_0x59aa81[_0xd21c('0x32')],_0x59aa81[_0xd21c('0x3b')]):0x0;};exports[_0xd21c('0x3c')]=function(_0x2cc7c2){return _0x2cc7c2==='Failure';};exports['variablesAction']=function(_0x42d23d,_0xe09b77,_0x30211d,_0x5b2737,_0x4dea9d){var _0x2ce332=_0x5b2737?_0xd21c('0x3d'):_0x42d23d['calleridname'];_0x2ce332=_0x4dea9d?_0xd21c('0x3e'):_0x2ce332;return{'actionid':_0x42d23d[_0xd21c('0x3f')],'action':_0xd21c('0x40'),'channel':_0x42d23d[_0xd21c('0x41')],'callerid':util[_0xd21c('0x12')](_0xd21c('0x11'),_0x2ce332,_0x42d23d[_0xd21c('0x1a')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x30211d,'timeout':(_0xe09b77['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x42d23d[_0xd21c('0x3f')]};};exports[_0xd21c('0x42')]=function(_0x158310){return _0x158310[_0xd21c('0x43')]+_0x158310[_0xd21c('0x44')]+_0x158310[_0xd21c('0x45')]+_0x158310[_0xd21c('0x46')]+_0x158310[_0xd21c('0x47')];};exports['cloneAction']=function(_0x1b1534){var _0x21d1cc=_[_0xd21c('0x48')](_0x1b1534);_0x21d1cc[_0xd21c('0x49')]=0xf;_0x21d1cc[_0xd21c('0x2e')]=_0xd21c('0x4a');return _0x21d1cc;};exports['scheduledAt']=function(_0x2e609f,_0x4dccf1,_0x1fab8e){var _0x5d1e90={};_0x5d1e90[_0x4dccf1]=_0x2e609f[_0x4dccf1];_0x5d1e90[_0xd21c('0x4b')]=![];_0x5d1e90['scheduledat']=moment()['add'](_0x1fab8e,'minutes')[_0xd21c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d1e90['ContactId']=_0x2e609f[_0xd21c('0x1b')];_0x5d1e90[_0xd21c('0x4c')]=_0x2e609f[_0xd21c('0x4c')];_0x5d1e90[_0xd21c('0x4d')]=_0x2e609f[_0xd21c('0x4d')]||undefined;return _0x5d1e90;};exports[_0xd21c('0x4e')]=function(_0x4745ee,_0x1b84e9){if(!_[_0xd21c('0x16')](_0x4745ee)){if(_0x4745ee['pTalking']>0x0){_0x4745ee['pTalking']-=0x1;}else{logger[_0xd21c('0x8')](_0x1b84e9,_0xd21c('0x4f'));}}else{logger['error'](_0x1b84e9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x399ade){if(_0x399ade<=0x0){return!![];}return![];};function buildObj(_0x4e3f7a,_0x1e9921,_0x41cca7){_0x4e3f7a[_0xd21c('0x50')]=_0x1e9921;_0x4e3f7a['name']=_0x4e3f7a['queue'];_0x4e3f7a[_0xd21c('0x51')]=_0x4e3f7a[_0xd21c('0x41')];_0x4e3f7a[_0xd21c('0x52')]=_0xd21c('0x53');if(_0x41cca7){_0x4e3f7a[_0xd21c('0x54')]=_0x41cca7[_0xd21c('0x54')];}return _0x4e3f7a;}exports[_0xd21c('0x55')]=buildObj;exports[_0xd21c('0x56')]=function(_0x991c0){var _0x20042a={};_0x20042a[_0xd21c('0x57')]=_0x991c0[_0xd21c('0x57')];_0x20042a[_0xd21c('0x51')]=_0x991c0[_0xd21c('0x41')];_0x20042a[_0xd21c('0x3f')]=_0x991c0[_0xd21c('0x3f')];return _0x20042a;};exports[_0xd21c('0x58')]=function(_0x520073){var _0x1304db=[];for(var _0x237dc5 in _0x520073){if(_0x520073['hasOwnProperty'](_0x237dc5)){if(!_[_0xd21c('0x16')](_0x520073[_0x237dc5])&&_0x520073[_0x237dc5][_0xd21c('0x49')]===_0xd21c('0x59')&&_0x520073[_0x237dc5]['status']===_0xd21c('0x5a')){_0x1304db[_0xd21c('0x5b')](_0x520073[_0x237dc5]['id']);}}}return _0x1304db;};exports[_0xd21c('0x5c')]=function(_0x2625e8){var _0x37a4a1=moment()['milliseconds'](0x0);var _0x20e035=moment(_0x2625e8)[_0xd21c('0x5d')](0x0);return _0x37a4a1[_0xd21c('0x5e')](_0x20e035,'seconds');};exports[_0xd21c('0x5f')]=function(_0x531b64){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x531b64[_0xd21c('0x1b')],'ListId':_0x531b64[_0xd21c('0x4c')],'VoiceQueueId':_0x531b64[_0xd21c('0x4d')]||undefined,'CampaignId':_0x531b64[_0xd21c('0x60')]||undefined};};exports[_0xd21c('0x61')]=function(_0x25ce79){if(_0x25ce79==='uniqueid'||_0x25ce79==='idContact'||_0x25ce79===_0xd21c('0x57')||_0x25ce79===_0xd21c('0x62')||_0x25ce79===_0xd21c('0x63')||_0x25ce79===_0xd21c('0x64')||_0x25ce79===_0xd21c('0x37')||_0x25ce79==='channelAgent'||_0x25ce79===_0xd21c('0x19')||_0x25ce79==='active'||_0x25ce79==='calleridnum'||_0x25ce79===_0xd21c('0x65')||_0x25ce79===_0xd21c('0x43')||_0x25ce79===_0xd21c('0x44')||_0x25ce79===_0xd21c('0x45')||_0x25ce79===_0xd21c('0x66')||_0x25ce79===_0xd21c('0x67')||_0x25ce79===_0xd21c('0x68')||_0x25ce79===_0xd21c('0x69')||_0x25ce79==='recallme'||_0x25ce79===_0xd21c('0x1b')||_0x25ce79===_0xd21c('0x4c')||_0x25ce79===_0xd21c('0x38')||_0x25ce79===_0xd21c('0x4d')||_0x25ce79===_0xd21c('0x6a')||_0x25ce79===_0xd21c('0x6b')||_0x25ce79===_0xd21c('0x6c')||_0x25ce79==='xmd-phone'||_0x25ce79===_0xd21c('0x6d')||_0x25ce79===_0xd21c('0x6e')||_0x25ce79===_0xd21c('0x6f')||_0x25ce79===_0xd21c('0x70')||_0x25ce79==='xmd-dialid'||_0x25ce79===_0xd21c('0x71')||_0x25ce79===_0xd21c('0x72')||_0x25ce79===_0xd21c('0x73')||_0x25ce79===_0xd21c('0x74')||_0x25ce79===_0xd21c('0x75')||_0x25ce79===_0xd21c('0x76')||_0x25ce79==='rtpaudioqos'||_0x25ce79===_0xd21c('0x77')||_0x25ce79===_0xd21c('0x78')||_0x25ce79===_0xd21c('0x79')||_0x25ce79===_0xd21c('0x7a')||_0x25ce79==='rtpaudioqoslossbridged'||_0x25ce79==='rtpaudioqosrtt'||_0x25ce79==='rtpaudioqosrttbridged'||_0x25ce79===_0xd21c('0x7b')||_0x25ce79===_0xd21c('0x77')||_0x25ce79===_0xd21c('0x78')||_0x25ce79===_0xd21c('0x79')||_0x25ce79==='rtpaudioqosloss'||_0x25ce79===_0xd21c('0x7c')||_0x25ce79===_0xd21c('0x7d')||_0x25ce79===_0xd21c('0x7e')||_0x25ce79==='bridgepeer'||_0x25ce79===_0xd21c('0x7f')||_0x25ce79==='state'||_0x25ce79===_0xd21c('0x2e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2446f4,_0x1d155f){var _0x2fa593,_0x20acf8,_0x19d0d0;if(_0x1d155f<=0x0){_0x1d155f=0x1;}_0x2fa593=new RegExp(_0xd21c('0x80')+_0x1d155f+'}$');_0x20acf8=Math['pow'](0xa,_0x1d155f-0x1);_0x19d0d0=Math[_0xd21c('0x81')](0xa,_0x1d155f)-0x1;return util[_0xd21c('0x12')]('%s',_[_0xd21c('0x82')](_0x2446f4,_0x2fa593,_[_0xd21c('0x83')](_0x20acf8,_0x19d0d0)));};exports[_0xd21c('0x84')]=function(_0x2deae1){var _0x42c95c=_0x2deae1[_0xd21c('0x85')](/"(.*?)"/);return _0x42c95c?_0x42c95c[0x1]:_0x2deae1;};exports[_0xd21c('0x86')]=function(_0x255eb4){var _0x2d8d96=_0x255eb4[_0xd21c('0x85')](/<(.*?)>/);return _0x2d8d96?_0x2d8d96[0x1]:_0x255eb4;};function buildNoAnswerEventPayload(_0x106df1,_0xf3dccc){var _0x8e3433=buildObj(_0x106df1,_0xd21c('0x87'));if(!_[_0xd21c('0x10')](_0xf3dccc[_0xd21c('0x88')])){Object[_0xd21c('0x89')](_0xf3dccc[_0xd21c('0x88')])[_0xd21c('0x8a')](function(_0x4bce9c){_0x8e3433[_0x4bce9c['toLowerCase']()]=_0xf3dccc['variables'][_0x4bce9c];});}return _0x8e3433;}exports[_0xd21c('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a1f36c1..f1b056b 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 _0x3dc8=['voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x264cea,_0x117814){var _0x4339ce=function(_0x2d64e4){while(--_0x2d64e4){_0x264cea['push'](_0x264cea['shift']());}};_0x4339ce(++_0x117814);}(_0x3dc8,0x1a6));var _0x83dc=function(_0x2c06bd,_0xbce837){_0x2c06bd=_0x2c06bd-0x0;var _0x51f60d=_0x3dc8[_0x2c06bd];return _0x51f60d;};'use strict';exports[_0x83dc('0x0')]={'queue':{'type':_0x83dc('0x1'),'required':!![]},'interface':{'type':_0x83dc('0x1'),'required':!![]},'membername':{'type':_0x83dc('0x1'),'required':!![]},'penalty':{'type':_0x83dc('0x2'),'required':![]},'paused':{'type':_0x83dc('0x3'),'required':![]}};exports[_0x83dc('0x4')]={'queue':{'type':_0x83dc('0x1'),'required':!![]},'interface':{'type':_0x83dc('0x1'),'required':!![]}};exports[_0x83dc('0x5')]={'interface':{'type':_0x83dc('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x83dc('0x1'),'required':![]}};exports[_0x83dc('0x6')]={'module':{'type':_0x83dc('0x1'),'required':![]}};exports[_0x83dc('0x7')]={'uniqueid':{'type':_0x83dc('0x1'),'required':!![]}};exports[_0x83dc('0x8')]={'uniqueid':{'type':_0x83dc('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x83dc('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x83dc('0x9')]={'uniqueid':{'type':_0x83dc('0x1'),'required':!![]},'exten':{'type':_0x83dc('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x567f=['boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x2e1ca8,_0xf6490f){var _0x224f48=function(_0x763d8a){while(--_0x763d8a){_0x2e1ca8['push'](_0x2e1ca8['shift']());}};_0x224f48(++_0xf6490f);}(_0x567f,0xc3));var _0xf567=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0x567f[_0xfe26da];return _0x2abe6e;};'use strict';exports[_0xf567('0x0')]={'queue':{'type':_0xf567('0x1'),'required':!![]},'interface':{'type':_0xf567('0x1'),'required':!![]},'membername':{'type':_0xf567('0x1'),'required':!![]},'penalty':{'type':_0xf567('0x2'),'required':![]},'paused':{'type':_0xf567('0x3'),'required':![]}};exports[_0xf567('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf567('0x1'),'required':!![]},'paused':{'type':_0xf567('0x3')},'reason':{'type':_0xf567('0x1'),'required':![]}};exports[_0xf567('0x5')]={'module':{'type':_0xf567('0x1'),'required':![]}};exports[_0xf567('0x6')]={'uniqueid':{'type':_0xf567('0x1'),'required':!![]}};exports[_0xf567('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xf567('0x1')},'format':{'type':_0xf567('0x1')},'mixmonitorid':{'type':_0xf567('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xf567('0x8')]={'uniqueid':{'type':_0xf567('0x1'),'required':!![]},'exten':{'type':_0xf567('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 06c5aa4..9b669db 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a5aca,_0x368fbb){_0x5a5aca=_0x5a5aca-0x0;var _0x1cb523=_0x0b0e[_0x5a5aca];return _0x1cb523;};'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(_0x402116,_0x39c0b4){_0x402116=_0x402116-0x0;var _0x3f48a2=_0x2032[_0x402116];return _0x3f48a2;};'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 74b63a5..1cb0711 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 _0x8b6e=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x35a148,_0x5d0e7d){var _0xf066e9=function(_0x9a608f){while(--_0x9a608f){_0x35a148['push'](_0x35a148['shift']());}};_0xf066e9(++_0x5d0e7d);}(_0x8b6e,0x90));var _0xe8b6=function(_0x4a5500,_0x73db7b){_0x4a5500=_0x4a5500-0x0;var _0x2d272c=_0x8b6e[_0x4a5500];return _0x2d272c;};'use strict';function mergeDBDataToRealtime(_0xc128ab,_0x47a03b){var _0x26354b=Object[_0xe8b6('0x0')]({},_0xc128ab);for(var _0xb8cff7 in _0x47a03b){if(_0x26354b[_0xe8b6('0x1')](_0xb8cff7)){_0x26354b[_0xb8cff7]=_0x47a03b[_0xb8cff7];}}return _0x26354b;}exports[_0xe8b6('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xa7ab=['assign'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xa7ab,0x159));var _0xba7a=function(_0x3668f7,_0x385682){_0x3668f7=_0x3668f7-0x0;var _0x4564ad=_0xa7ab[_0x3668f7];return _0x4564ad;};'use strict';function mergeDBDataToRealtime(_0x554e3f,_0x366839){var _0x1b45be=Object[_0xba7a('0x0')]({},_0x554e3f);for(var _0x457bf6 in _0x366839){if(_0x1b45be['hasOwnProperty'](_0x457bf6)){_0x1b45be[_0x457bf6]=_0x366839[_0x457bf6];}}return _0x1b45be;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 48d36c4..f52de46 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 _0xf142=['custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','format','SIP/%s','length','connectedlinenum','assigned','interface','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','keys','getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','getAgentByInternal','membername','monitor','monitors','filename','createdAt','connectedlinename','voiceAgentReport','isArray','forEach','substring','indexOf','mobile','phone','voiceDialReport','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport'];(function(_0x122938,_0x1223d0){var _0x1363cc=function(_0x683697){while(--_0x683697){_0x122938['push'](_0x122938['shift']());}};_0x1363cc(++_0x1223d0);}(_0xf142,0xe1));var _0x2f14=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xf142[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x2f14('0x0'));var moment=require(_0x2f14('0x1'));var util=require(_0x2f14('0x2'));var config=require(_0x2f14('0x3'));var ami=require(_0x2f14('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x2f14('0x5'));var RpcVoiceDialReport=require(_0x2f14('0x6'));var RpcMemberReport=require(_0x2f14('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2f14('0x8'));var RpcVoiceTransferReport=require(_0x2f14('0x9'));var VoiceQueueReport=require(_0x2f14('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2f14('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2f14('0xc'));function Report(_0x3c02e1){this[_0x2f14('0xd')]=_0x3c02e1;this[_0x2f14('0xe')]=_0x3c02e1[_0x2f14('0xe')];this[_0x2f14('0xf')]=_0x3c02e1[_0x2f14('0xf')];}Report[_0x2f14('0x10')][_0x2f14('0x11')]=function(_0x847fe1){var _0xd69417=new VoiceQueueReport(this[_0x2f14('0xd')]);var _0x4eb866=new VoiceAgentReport(this[_0x2f14('0xd')]);var _0x1f8311=new VoiceDialReport(this[_0x2f14('0xd')]);var _0xb098aa=new VoiceCallReport(this['realtime']);var _0x357179=new UserReport(this[_0x2f14('0xd')]);if(config[_0x2f14('0x12')]&&config[_0x2f14('0x12')][_0x2f14('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x2f14('0x14')]['bind'](this));ami['on'](_0x2f14('0x15'),this['voiceCallReport'][_0x2f14('0x16')](this));ami['on'](_0x2f14('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x2f14('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0x2f14('0x19'),this[_0x2f14('0x1a')]['bind'](this));ami['on'](_0x2f14('0x1b'),this['attendedTransfer'][_0x2f14('0x16')](this));}};Report[_0x2f14('0x10')][_0x2f14('0x1c')]=function(_0x55c5bc){var _0x2d7298;_0x2d7298=_['find'](this[_0x2f14('0xe')],function(_0x36ecb0){return _0x36ecb0[_0x2f14('0x1d')]==_0x55c5bc||_0x36ecb0[_0x2f14('0x1e')]==_0x55c5bc;});if(_[_0x2f14('0x1f')](_0x2d7298)){var _0x1182b0=_[_0x2f14('0x20')](this['telephones'],function(_0x4de2ce){return _0x4de2ce[_0x2f14('0x1d')]==_0x55c5bc||_0x4de2ce[_0x2f14('0x1e')]==_0x55c5bc;});if(_0x1182b0){_0x2d7298=_[_0x2f14('0x20')](this[_0x2f14('0xe')],function(_0xb13af4){return _0xb13af4['interface']==util[_0x2f14('0x21')](_0x2f14('0x22'),_0x1182b0[_0x2f14('0x1e')]);});}}return _0x2d7298;};Report[_0x2f14('0x10')]['voiceQueueReport']=function(_0x359858){for(var _0x499031=0x0;_0x499031<_0x359858[_0x2f14('0x23')];_0x499031+=0x1){var _0x9acfdb=this[_0x2f14('0x1c')](_0x359858[_0x499031][_0x2f14('0x24')]);if(_0x9acfdb){_0x359858[_0x499031][_0x2f14('0x1d')]=_0x9acfdb[_0x2f14('0x1d')];_0x359858[_0x499031][_0x2f14('0x25')]=!![];_0x359858[_0x499031]['lastAssignedTo']=_0x9acfdb[_0x2f14('0x1e')];_0x359858[_0x499031][_0x2f14('0x26')]=_['isNil'](_0x9acfdb[_0x2f14('0x26')])?util[_0x2f14('0x21')](_0x2f14('0x22'),_0x9acfdb['name']):_0x9acfdb[_0x2f14('0x26')];if(_0x359858[_0x499031]['queuecallercomplete']){_0x359858[_0x499031]['queuecallercompleteAt']=moment()[_0x2f14('0x21')](_0x2f14('0x27'));}if(_0x359858[_0x499031][_0x2f14('0x28')]){_0x359858[_0x499031]['queuecallerexitAt']=moment()[_0x2f14('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x2f14('0x14')](_0x359858[_0x499031]);}RpcVoiceQueueReport[_0x2f14('0x29')](_0x359858[_0x499031]);}};function extractCalleridNumber(_0x6c7248){var _0x321c45=_0x6c7248[_0x2f14('0x2a')](/<(.*?)>/);return _0x321c45?_0x321c45[0x1]:_0x6c7248;}Report['prototype']['getAgentByInternal']=function(_0xe098d5){for(var _0x4f4947=0x0;_0x4f4947',_0x4810c6[_0x2f14('0x3f')],_0x4810c6[_0x2f14('0x2e')]);}if(RpcVoiceTransferReport[_0x2f14('0x40')][_0x4810c6[_0x2f14('0x41')]]){var _0x1ffd80=RpcVoiceTransferReport[_0x2f14('0x40')][_0x4810c6[_0x2f14('0x41')]];_0x1ffd80[_0x2f14('0x42')]=_0x4810c6['uniqueid'];RpcVoiceTransferReport[_0x2f14('0x1a')](_0x1ffd80);delete RpcVoiceTransferReport[_0x2f14('0x40')][_0x4810c6[_0x2f14('0x41')]];}if(_[_0x2f14('0x1f')](_0x4810c6[_0x2f14('0x34')])){_0x4810c6[_0x2f14('0x34')]=this[_0x2f14('0x2c')](_0x4810c6);}if(_[_0x2f14('0x1f')](_0x4810c6['UserId'])){var _0x52e446=_0x4810c6['channel'][_0x2f14('0x2d')]('-')[0x0];var _0xa8ad46=this['agents'][_0x52e446];if(!_0xa8ad46)_0xa8ad46=this[_0x2f14('0x43')](_0x4810c6[_0x2f14('0x1d')]);if(_0xa8ad46){_0x4810c6['UserId']=_0xa8ad46['id'];_0x4810c6[_0x2f14('0x44')]=_0xa8ad46['name'];}}RpcVoiceCallReport[_0x2f14('0x29')](_0x4810c6);if(_0x4810c6[_0x2f14('0x45')]){for(var _0x187ecf=0x0;_0x187ecf<_0x4810c6[_0x2f14('0x46')][_0x2f14('0x23')];_0x187ecf+=0x1){_0x4810c6['monitorFilename']=_0x4810c6[_0x2f14('0x46')][_0x187ecf][_0x2f14('0x47')];_0x4810c6[_0x2f14('0x48')]=_0x4810c6[_0x2f14('0x46')][_0x187ecf]['createdAt'];if(_0x4810c6['exten']==_0x2f14('0x3b')){_0x4810c6['calleridnum']=_0x4810c6[_0x2f14('0x24')];_0x4810c6[_0x2f14('0x3f')]=_0x4810c6[_0x2f14('0x49')];_0x4810c6[_0x2f14('0x24')]=_0x4810c6[_0x2f14('0x1d')];_0x4810c6[_0x2f14('0x49')]=_0x4810c6[_0x2f14('0x44')];_0x4810c6[_0x2f14('0x33')]=_0x4810c6[_0x2f14('0x3d')];}else if(_0x4810c6['exten']=='xcally-motion-dialer'){_0x4810c6[_0x2f14('0x2e')]=_0x4810c6[_0x2f14('0x32')];_0x4810c6[_0x2f14('0x33')]=_0x4810c6[_0x2f14('0x3d')];}RpcVoiceRecording['create'](_0x4810c6);}}};Report[_0x2f14('0x10')][_0x2f14('0x4a')]=function(_0x30248e){if(_[_0x2f14('0x4b')](_0x30248e)){_0x30248e[_0x2f14('0x4c')](function(_0x2b6507){RpcVoiceAgentReport[_0x2f14('0x29')](_0x2b6507);});}else{RpcVoiceAgentReport['create'](_0x30248e);}};Report[_0x2f14('0x10')]['voiceDialReport']=function(_0x58049f){RpcVoiceDialReport['create'](_0x58049f);var _0x542b2e;var _0x178446;var _0x1cc093=_0x58049f['channel'];if(_['startsWith'](_0x1cc093,'Local')){_0x178446=_0x1cc093[_0x2f14('0x4d')](_0x1cc093[_0x2f14('0x4e')]('/')+0x1,_0x1cc093[_0x2f14('0x4e')]('@'));_0x542b2e=_[_0x2f14('0x20')](this['agents'],function(_0x58eca8){return _0x58eca8[_0x2f14('0x4f')]==_0x178446||_0x58eca8[_0x2f14('0x50')]==_0x178446||_0x58eca8[_0x2f14('0x1d')]==_0x178446;});}else{_0x178446=_0x1cc093[_0x2f14('0x4d')](_0x1cc093[_0x2f14('0x4e')]('/')+0x1,_0x1cc093['lastIndexOf']('-'));_0x542b2e=this[_0x2f14('0x1c')](_0x178446);}if(_0x542b2e){_0x58049f['interface']=_['isNil'](_0x542b2e['interface'])?util[_0x2f14('0x21')]('SIP/%s',_0x542b2e['name']):_0x542b2e['interface'];_0x58049f[_0x2f14('0x44')]=_0x542b2e[_0x2f14('0x1e')];_0x58049f[_0x2f14('0x1d')]=_0x542b2e[_0x2f14('0x1d')];RpcMemberReport[_0x2f14('0x51')](_0x58049f);}};Report[_0x2f14('0x10')][_0x2f14('0x1a')]=function(_0x9e359b){RpcVoiceTransferReport[_0x2f14('0x40')][_0x9e359b['transfererlinkedid']]=_0x9e359b;};Report['prototype'][_0x2f14('0x52')]=function(_0x47a3e8){RpcVoiceTransferReport['attendedTransfer'](_0x47a3e8);};module['exports']=Report; \ No newline at end of file +var _0x9a34=['isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','transfererlinkedid','attendedTransfer','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','connectedlinenum','assigned','isNil','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','length','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','callerid','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer'];(function(_0x1a7b8d,_0x516063){var _0xe571f7=function(_0x509066){while(--_0x509066){_0x1a7b8d['push'](_0x1a7b8d['shift']());}};_0xe571f7(++_0x516063);}(_0x9a34,0x1cd));var _0x49a3=function(_0x59674a,_0x787904){_0x59674a=_0x59674a-0x0;var _0x2f1381=_0x9a34[_0x59674a];return _0x2f1381;};'use strict';var _=require(_0x49a3('0x0'));var moment=require('moment');var util=require(_0x49a3('0x1'));var config=require(_0x49a3('0x2'));var ami=require(_0x49a3('0x3'));var RpcVoiceAgentReport=require(_0x49a3('0x4'));var RpcVoiceCallReport=require(_0x49a3('0x5'));var RpcVoiceDialReport=require(_0x49a3('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x49a3('0x7'));var RpcVoiceRecording=require(_0x49a3('0x8'));var RpcVoiceTransferReport=require(_0x49a3('0x9'));var VoiceQueueReport=require(_0x49a3('0xa'));var VoiceCallReport=require(_0x49a3('0xb'));var VoiceAgentReport=require(_0x49a3('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x49a3('0xd'));function Report(_0x189a6d){this['realtime']=_0x189a6d;this[_0x49a3('0xe')]=_0x189a6d[_0x49a3('0xe')];this[_0x49a3('0xf')]=_0x189a6d[_0x49a3('0xf')];}Report[_0x49a3('0x10')][_0x49a3('0x11')]=function(_0x4829fa){var _0x59df60=new VoiceQueueReport(this[_0x49a3('0x12')]);var _0x1e5ce8=new VoiceAgentReport(this[_0x49a3('0x12')]);var _0x27de91=new VoiceDialReport(this[_0x49a3('0x12')]);var _0x2a703d=new VoiceCallReport(this[_0x49a3('0x12')]);var _0x56ccec=new UserReport(this['realtime']);if(config['xdr']&&config[_0x49a3('0x13')][_0x49a3('0x14')]){ami['on'](_0x49a3('0x15'),this[_0x49a3('0x16')][_0x49a3('0x17')](this));ami['on'](_0x49a3('0x18'),this[_0x49a3('0x19')][_0x49a3('0x17')](this));ami['on'](_0x49a3('0x1a'),this[_0x49a3('0x1b')][_0x49a3('0x17')](this));ami['on'](_0x49a3('0x1c'),this['voiceDialReport'][_0x49a3('0x17')](this));ami['on'](_0x49a3('0x1d'),this[_0x49a3('0x1e')][_0x49a3('0x17')](this));ami['on'](_0x49a3('0x1f'),this['attendedTransfer']['bind'](this));}};Report[_0x49a3('0x10')][_0x49a3('0x20')]=function(_0x426cb1){var _0x259d85;_0x259d85=_[_0x49a3('0x21')](this[_0x49a3('0xe')],function(_0x5aa8c6){return _0x5aa8c6[_0x49a3('0x22')]==_0x426cb1||_0x5aa8c6[_0x49a3('0x23')]==_0x426cb1;});if(_['isNil'](_0x259d85)){var _0x253db4=_['find'](this['telephones'],function(_0xb5e4bf){return _0xb5e4bf[_0x49a3('0x22')]==_0x426cb1||_0xb5e4bf[_0x49a3('0x23')]==_0x426cb1;});if(_0x253db4){_0x259d85=_['find'](this[_0x49a3('0xe')],function(_0x177b63){return _0x177b63[_0x49a3('0x24')]==util[_0x49a3('0x25')]('SIP/%s',_0x253db4[_0x49a3('0x23')]);});}}return _0x259d85;};Report[_0x49a3('0x10')][_0x49a3('0x16')]=function(_0x5f49f3){for(var _0x2fd416=0x0;_0x2fd416<_0x5f49f3['length'];_0x2fd416+=0x1){var _0x51b363=this[_0x49a3('0x20')](_0x5f49f3[_0x2fd416][_0x49a3('0x26')]);if(_0x51b363){_0x5f49f3[_0x2fd416][_0x49a3('0x22')]=_0x51b363[_0x49a3('0x22')];_0x5f49f3[_0x2fd416][_0x49a3('0x27')]=!![];_0x5f49f3[_0x2fd416]['lastAssignedTo']=_0x51b363[_0x49a3('0x23')];_0x5f49f3[_0x2fd416][_0x49a3('0x24')]=_[_0x49a3('0x28')](_0x51b363[_0x49a3('0x24')])?util[_0x49a3('0x25')](_0x49a3('0x29'),_0x51b363[_0x49a3('0x23')]):_0x51b363[_0x49a3('0x24')];if(_0x5f49f3[_0x2fd416]['queuecallercomplete']){_0x5f49f3[_0x2fd416][_0x49a3('0x2a')]=moment()[_0x49a3('0x25')](_0x49a3('0x2b'));}if(_0x5f49f3[_0x2fd416]['queuecallerexit']){_0x5f49f3[_0x2fd416][_0x49a3('0x2c')]=moment()[_0x49a3('0x25')](_0x49a3('0x2b'));}RpcMemberReport[_0x49a3('0x16')](_0x5f49f3[_0x2fd416]);}RpcVoiceQueueReport[_0x49a3('0x2d')](_0x5f49f3[_0x2fd416]);}};function extractCalleridNumber(_0x131305){var _0x4e6489=_0x131305['match'](/<(.*?)>/);return _0x4e6489?_0x4e6489[0x1]:_0x131305;}Report[_0x49a3('0x10')]['getAgentByInternal']=function(_0x169198){for(var _0x36d2c4=0x0;_0x36d2c4',_0x429d13[_0x49a3('0x43')],_0x429d13[_0x49a3('0x32')]);}if(RpcVoiceTransferReport['transfers'][_0x429d13['linkedid']]){var _0x1a5abd=RpcVoiceTransferReport[_0x49a3('0x44')][_0x429d13[_0x49a3('0x45')]];_0x1a5abd[_0x49a3('0x46')]=_0x429d13[_0x49a3('0x47')];RpcVoiceTransferReport[_0x49a3('0x1e')](_0x1a5abd);delete RpcVoiceTransferReport['transfers'][_0x429d13[_0x49a3('0x45')]];}if(_[_0x49a3('0x28')](_0x429d13[_0x49a3('0x37')])){_0x429d13[_0x49a3('0x37')]=this['getCallType'](_0x429d13);}if(_[_0x49a3('0x28')](_0x429d13['UserId'])){var _0x4ad03a=_0x429d13['channel']['split']('-')[0x0];var _0x37f425=this[_0x49a3('0xe')][_0x4ad03a];if(!_0x37f425)_0x37f425=this[_0x49a3('0x31')](_0x429d13[_0x49a3('0x22')]);if(_0x37f425){_0x429d13['UserId']=_0x37f425['id'];_0x429d13[_0x49a3('0x48')]=_0x37f425[_0x49a3('0x23')];}}RpcVoiceCallReport[_0x49a3('0x2d')](_0x429d13);if(_0x429d13['monitor']){for(var _0x13bbf8=0x0;_0x13bbf8<_0x429d13[_0x49a3('0x49')]['length'];_0x13bbf8+=0x1){_0x429d13[_0x49a3('0x4a')]=_0x429d13[_0x49a3('0x49')][_0x13bbf8][_0x49a3('0x4b')];_0x429d13[_0x49a3('0x4c')]=_0x429d13[_0x49a3('0x49')][_0x13bbf8]['createdAt'];if(_0x429d13[_0x49a3('0x36')]==_0x49a3('0x3d')){_0x429d13[_0x49a3('0x32')]=_0x429d13[_0x49a3('0x26')];_0x429d13[_0x49a3('0x43')]=_0x429d13['connectedlinename'];_0x429d13['connectedlinenum']=_0x429d13['accountcode'];_0x429d13[_0x49a3('0x4d')]=_0x429d13['membername'];_0x429d13[_0x49a3('0x36')]=_0x429d13['originatecalleridnum'];}else if(_0x429d13['exten']==_0x49a3('0x4e')){_0x429d13['calleridnum']=_0x429d13[_0x49a3('0x35')];_0x429d13[_0x49a3('0x36')]=_0x429d13[_0x49a3('0x3f')];}RpcVoiceRecording[_0x49a3('0x2d')](_0x429d13);}}};Report[_0x49a3('0x10')][_0x49a3('0x1b')]=function(_0x25efe7){if(_[_0x49a3('0x4f')](_0x25efe7)){_0x25efe7[_0x49a3('0x50')](function(_0x16fe1f){RpcVoiceAgentReport[_0x49a3('0x2d')](_0x16fe1f);});}else{RpcVoiceAgentReport[_0x49a3('0x2d')](_0x25efe7);}};Report[_0x49a3('0x10')][_0x49a3('0x51')]=function(_0x40a512){RpcVoiceDialReport[_0x49a3('0x2d')](_0x40a512);var _0x349ded;var _0x1a4956;var _0x1fc91d=_0x40a512[_0x49a3('0x2f')];if(_[_0x49a3('0x52')](_0x1fc91d,_0x49a3('0x53'))){_0x1a4956=_0x1fc91d[_0x49a3('0x54')](_0x1fc91d[_0x49a3('0x55')]('/')+0x1,_0x1fc91d[_0x49a3('0x55')]('@'));_0x349ded=_[_0x49a3('0x21')](this['agents'],function(_0x20e3ef){return _0x20e3ef[_0x49a3('0x56')]==_0x1a4956||_0x20e3ef['phone']==_0x1a4956||_0x20e3ef[_0x49a3('0x22')]==_0x1a4956;});}else{_0x1a4956=_0x1fc91d[_0x49a3('0x54')](_0x1fc91d[_0x49a3('0x55')]('/')+0x1,_0x1fc91d['lastIndexOf']('-'));_0x349ded=this[_0x49a3('0x20')](_0x1a4956);}if(_0x349ded){_0x40a512[_0x49a3('0x24')]=_[_0x49a3('0x28')](_0x349ded[_0x49a3('0x24')])?util[_0x49a3('0x25')](_0x49a3('0x29'),_0x349ded[_0x49a3('0x23')]):_0x349ded['interface'];_0x40a512[_0x49a3('0x48')]=_0x349ded[_0x49a3('0x23')];_0x40a512[_0x49a3('0x22')]=_0x349ded['accountcode'];RpcMemberReport['voiceDialReport'](_0x40a512);}};Report['prototype'][_0x49a3('0x1e')]=function(_0x4eeb8a){RpcVoiceTransferReport['transfers'][_0x4eeb8a[_0x49a3('0x57')]]=_0x4eeb8a;};Report[_0x49a3('0x10')][_0x49a3('0x58')]=function(_0x3ec6e9){RpcVoiceTransferReport[_0x49a3('0x58')](_0x3ec6e9);};module[_0x49a3('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 7aaf918..4a7be58 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 _0xe088=['[userReport][registry]','find','username','stateRegistry','merge','omit','event','actionid','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','state','agents','toLowerCase','inuse','local','stateTime','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','toNumber','trunk:%s','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','peer','address','registered','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','status','[userReport][peerstatus]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','debug'];(function(_0x4f27f8,_0x3ce31f){var _0x2d469b=function(_0x463549){while(--_0x463549){_0x4f27f8['push'](_0x4f27f8['shift']());}};_0x2d469b(++_0x3ce31f);}(_0xe088,0xc1));var _0x8e08=function(_0x43c8de,_0x4ac946){_0x43c8de=_0x43c8de-0x0;var _0x17430a=_0xe088[_0x43c8de];return _0x17430a;};'use strict';var _=require(_0x8e08('0x0'));var moment=require(_0x8e08('0x1'));var util=require('util');var Redis=require(_0x8e08('0x2'));var BPromise=require('bluebird');var config=require(_0x8e08('0x3'));var logger=require(_0x8e08('0x4'))(_0x8e08('0x5'));var ami=require(_0x8e08('0x6'));config[_0x8e08('0x7')]=_[_0x8e08('0x8')](config[_0x8e08('0x7')],{'host':_0x8e08('0x9'),'port':0x18eb});var io=require(_0x8e08('0xa'))(new Redis(config[_0x8e08('0x7')]));function UserReport(_0x1bfe20){this[_0x8e08('0xb')]=_0x1bfe20[_0x8e08('0xb')];this['agents']=_0x1bfe20['agents'];this[_0x8e08('0xc')]=_0x1bfe20[_0x8e08('0xc')];ami['on'](_0x8e08('0xd'),this['syncRegistry']['bind'](this));ami['on'](_0x8e08('0xe'),this[_0x8e08('0xf')][_0x8e08('0x10')](this));ami['on'](_0x8e08('0x11'),this[_0x8e08('0x12')][_0x8e08('0x10')](this));ami['on'](_0x8e08('0x13'),this[_0x8e08('0x14')][_0x8e08('0x10')](this));return this[_0x8e08('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0x8e08('0x16')](ami[_0x8e08('0x17')]())[_0x8e08('0x18')](function(_0x816ec4){logger[_0x8e08('0x19')](_0x8e08('0x1a'),util[_0x8e08('0x1b')](_0x816ec4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8e08('0x1c')]()['then'](ami[_0x8e08('0x1d')]())[_0x8e08('0x18')](function(_0x258a53){logger[_0x8e08('0x19')](_0x8e08('0x1e'),util[_0x8e08('0x1b')](_0x258a53,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8e08('0x1c')]()['then'](ami['actionSipPeerStatus']())[_0x8e08('0x18')](function(_0x5b5596){logger[_0x8e08('0x19')](_0x8e08('0x1f'),util[_0x8e08('0x1b')](_0x5b5596,{'showHidden':![],'depth':null}));});}UserReport[_0x8e08('0x20')][_0x8e08('0x15')]=function(){setInterval(function(){BPromise[_0x8e08('0x1c')]()[_0x8e08('0x16')](showSipRegistrations())['then'](listDeviceStates())[_0x8e08('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x8e08('0x20')][_0x8e08('0x21')]=function(_0x1162ed){return _0x1162ed!==null&&!_[_0x8e08('0x22')](_0x1162ed);};UserReport[_0x8e08('0x20')][_0x8e08('0x23')]=function(_0x1b219a,_0x4f6450,_0x49deb3){io['to'](_0x1b219a)[_0x8e08('0x23')](_0x4f6450,_0x49deb3);};UserReport[_0x8e08('0x20')][_0x8e08('0xf')]=function(_0x55c1b1){try{if(this[_0x8e08('0x21')](_0x55c1b1)){logger['info'](_0x8e08('0x24'),_0x55c1b1['username'],_0x55c1b1['state']);logger[_0x8e08('0x25')](_0x8e08('0x26'),util[_0x8e08('0x1b')](_0x55c1b1,{'showHidden':![],'depth':null}));var _0x5f0361=_[_0x8e08('0x27')](this[_0x8e08('0xb')],{'defaultuser':_0x55c1b1[_0x8e08('0x28')]});if(_0x5f0361){_0x55c1b1[_0x8e08('0x29')]=_0x55c1b1['state'];_[_0x8e08('0x2a')](_0x5f0361,_[_0x8e08('0x2b')](_0x55c1b1,[_0x8e08('0x2c'),_0x8e08('0x2d'),_0x8e08('0x28'),'state']));logger[_0x8e08('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x8e08('0x1b')](_0x5f0361,{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',_0x5f0361[_0x8e08('0x2e')]),_0x8e08('0x2f'),_0x5f0361);}}}catch(_0x201c89){logger[_0x8e08('0x19')]('[userReport][registry]',util[_0x8e08('0x1b')](_0x201c89,{'showHidden':![],'depth':null}));}};UserReport[_0x8e08('0x20')]['syncDeviceState']=function(_0x4c169d){try{if(this['isNotNull'](_0x4c169d)){logger[_0x8e08('0x30')](_0x8e08('0x31'),_0x4c169d[_0x8e08('0x32')],_0x4c169d[_0x8e08('0x33')]);logger[_0x8e08('0x25')]('[userReport][devicestatechange]',util[_0x8e08('0x1b')](_0x4c169d,{'showHidden':![],'depth':null}));if(this[_0x8e08('0x34')][_0x4c169d['device']]){if(!this[_0x8e08('0x34')][_0x4c169d[_0x8e08('0x32')]]['local']||_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]()==_0x8e08('0x36')){this[_0x8e08('0x34')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x37')]=![];if(this[_0x8e08('0x34')][_0x4c169d[_0x8e08('0x32')]]['state']!==_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]()){this[_0x8e08('0x34')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x38')]=_['toNumber'](moment()[_0x8e08('0x39')]('x'));}this['agents'][_0x4c169d['device']][_0x8e08('0x33')]=_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]();this[_0x8e08('0x34')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x3a')](_0x4c169d);}}else if(this[_0x8e08('0xc')][_0x4c169d[_0x8e08('0x32')]]){if(this['telephones'][_0x4c169d['device']][_0x8e08('0x33')]!==_0x4c169d['state']['toLowerCase']()){this['telephones'][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x38')]=_['toNumber'](moment()['format']('x'));}this[_0x8e08('0xc')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x33')]=_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]();logger[_0x8e08('0x25')](_0x8e08('0x3b'),util['inspect'](this[_0x8e08('0xc')][_0x4c169d[_0x8e08('0x32')]],{'showHidden':![],'depth':null}));this[_0x8e08('0x23')](util[_0x8e08('0x39')](_0x8e08('0x3c'),this[_0x8e08('0xc')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x2e')]),_0x8e08('0x3d'),this[_0x8e08('0xc')][_0x4c169d[_0x8e08('0x32')]]);}else if(this[_0x8e08('0xb')][_0x4c169d[_0x8e08('0x32')]]){if(this[_0x8e08('0xb')][_0x4c169d['device']][_0x8e08('0x33')]!==_0x4c169d['state'][_0x8e08('0x35')]()){this[_0x8e08('0xb')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x38')]=_[_0x8e08('0x3e')](moment()['format']('x'));}this[_0x8e08('0xb')][_0x4c169d[_0x8e08('0x32')]][_0x8e08('0x33')]=_0x4c169d[_0x8e08('0x33')]['toLowerCase']();logger[_0x8e08('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0x8e08('0xb')][_0x4c169d[_0x8e08('0x32')]],{'showHidden':![],'depth':null}));this[_0x8e08('0x23')](util[_0x8e08('0x39')](_0x8e08('0x3f'),this[_0x8e08('0xb')][_0x4c169d['device']][_0x8e08('0x2e')]),_0x8e08('0x2f'),this[_0x8e08('0xb')][_0x4c169d['device']]);}else if(_['startsWith'](_0x4c169d['device'],'Local')){var _0x15f7c3=_0x4c169d[_0x8e08('0x32')];var _0x1d49e3=_0x15f7c3[_0x8e08('0x40')](_0x15f7c3[_0x8e08('0x41')]('/')+0x1,_0x15f7c3[_0x8e08('0x41')]('@'));var _0x21270d=_[_0x8e08('0x27')](this['agents'],function(_0xfa6c0b){return _0xfa6c0b[_0x8e08('0x42')]==_0x1d49e3||_0xfa6c0b[_0x8e08('0x43')]==_0x1d49e3||_0xfa6c0b[_0x8e08('0x44')]==_0x1d49e3;});if(_0x21270d){if(_0x21270d[_0x8e08('0x33')]!==_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]()){_0x21270d['stateTime']=_[_0x8e08('0x3e')](moment()[_0x8e08('0x39')]('x'));}_0x21270d[_0x8e08('0x33')]=_0x4c169d[_0x8e08('0x33')][_0x8e08('0x35')]();_0x21270d[_0x8e08('0x37')]=!![];_0x21270d[_0x8e08('0x3a')](_0x4c169d);}}}}catch(_0x37d6a0){logger[_0x8e08('0x19')](_0x8e08('0x45'),util['inspect'](_0x37d6a0,{'showHidden':![],'depth':null}));}};UserReport[_0x8e08('0x20')][_0x8e08('0x14')]=function(_0x43af9b){try{if(this[_0x8e08('0x21')](_0x43af9b)&&this[_0x8e08('0x21')](_0x43af9b[_0x8e08('0x13')])){logger[_0x8e08('0x30')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x43af9b[_0x8e08('0x46')],_0x43af9b[_0x8e08('0x47')],_0x43af9b['peerstatus']);logger[_0x8e08('0x25')]('[userReport][peerstatus]',util[_0x8e08('0x1b')](_0x43af9b,{'showHidden':![],'depth':null}));if(this[_0x8e08('0x34')][_0x43af9b[_0x8e08('0x46')]]){if(!this[_0x8e08('0x34')][_0x43af9b[_0x8e08('0x46')]]['local']||_0x43af9b['peerstatus'][_0x8e08('0x35')]()==_0x8e08('0x48')){this[_0x8e08('0x34')][_0x43af9b['peer']][_0x8e08('0x37')]=![];this[_0x8e08('0x34')][_0x43af9b[_0x8e08('0x46')]]['status']=_0x43af9b[_0x8e08('0x13')][_0x8e08('0x35')]();this[_0x8e08('0x34')][_0x43af9b[_0x8e08('0x46')]][_0x8e08('0x47')]=_0x43af9b[_0x8e08('0x47')];this[_0x8e08('0x34')][_0x43af9b[_0x8e08('0x46')]][_0x8e08('0x3a')](_0x43af9b);}}else if(this['telephones'][_0x43af9b[_0x8e08('0x46')]]){this[_0x8e08('0xc')][_0x43af9b['peer']]['status']=_0x43af9b[_0x8e08('0x13')][_0x8e08('0x35')]();this['telephones'][_0x43af9b['peer']][_0x8e08('0x47')]=_0x43af9b['address'];logger[_0x8e08('0x25')](_0x8e08('0x49'),util['inspect'](this['telephones'][_0x43af9b[_0x8e08('0x46')]],{'showHidden':![],'depth':null}));this[_0x8e08('0x23')](util[_0x8e08('0x39')]('telephone:%s',this[_0x8e08('0xc')][_0x43af9b['peer']][_0x8e08('0x2e')]),_0x8e08('0x3d'),this['telephones'][_0x43af9b[_0x8e08('0x46')]]);}else if(this[_0x8e08('0xb')][_0x43af9b[_0x8e08('0x46')]]){this[_0x8e08('0xb')][_0x43af9b['peer']][_0x8e08('0x4a')]=_0x43af9b[_0x8e08('0x13')][_0x8e08('0x35')]();this[_0x8e08('0xb')][_0x43af9b[_0x8e08('0x46')]][_0x8e08('0x47')]=_0x43af9b[_0x8e08('0x47')];logger[_0x8e08('0x25')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x43af9b[_0x8e08('0x46')]],{'showHidden':![],'depth':null}));this[_0x8e08('0x23')](util['format'](_0x8e08('0x3f'),this[_0x8e08('0xb')][_0x43af9b[_0x8e08('0x46')]][_0x8e08('0x2e')]),_0x8e08('0x2f'),this[_0x8e08('0xb')][_0x43af9b['peer']]);}}}catch(_0x9585c2){logger[_0x8e08('0x19')](_0x8e08('0x4b'),util[_0x8e08('0x1b')](_0x9585c2,{'showHidden':![],'depth':null}));}};module[_0x8e08('0x4c')]=UserReport; \ No newline at end of file +var _0x3837=['format','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','bluebird','../../../config/environment','../../../config/logger','ami','defaults','socket.io-emitter','redis','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','then','catch','error','inspect','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','syncDeviceState','info','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime'];(function(_0x5a1f9c,_0x13111b){var _0x1f5257=function(_0x409f78){while(--_0x409f78){_0x5a1f9c['push'](_0x5a1f9c['shift']());}};_0x1f5257(++_0x13111b);}(_0x3837,0x182));var _0x7383=function(_0x46cd8c,_0x46ac68){_0x46cd8c=_0x46cd8c-0x0;var _0x554b51=_0x3837[_0x46cd8c];return _0x554b51;};'use strict';var _=require(_0x7383('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x7383('0x1'));var config=require(_0x7383('0x2'));var logger=require(_0x7383('0x3'))(_0x7383('0x4'));var ami=require('../ami');config['redis']=_[_0x7383('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7383('0x6'))(new Redis(config[_0x7383('0x7')]));function UserReport(_0x4473ff){this[_0x7383('0x8')]=_0x4473ff['trunks'];this[_0x7383('0x9')]=_0x4473ff[_0x7383('0x9')];this[_0x7383('0xa')]=_0x4473ff[_0x7383('0xa')];ami['on'](_0x7383('0xb'),this[_0x7383('0xc')][_0x7383('0xd')](this));ami['on'](_0x7383('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0x7383('0xf'),this['syncDeviceState']['bind'](this));ami['on'](_0x7383('0x10'),this[_0x7383('0x11')][_0x7383('0xd')](this));return this[_0x7383('0x12')]();}function showSipRegistrations(){Promise['resolve']()[_0x7383('0x13')](ami['actionSipShowRegistry']())[_0x7383('0x14')](function(_0x4c227e){logger[_0x7383('0x15')]('[userReport][sipshowregistry]',util[_0x7383('0x16')](_0x4c227e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7383('0x17')]()['then'](ami['actionDeviceStateList']())[_0x7383('0x14')](function(_0x45a0dc){logger[_0x7383('0x15')]('[userReport][devicestatelist]',util[_0x7383('0x16')](_0x45a0dc,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x7383('0x17')]()[_0x7383('0x13')](ami[_0x7383('0x18')]())[_0x7383('0x14')](function(_0x5c1245){logger[_0x7383('0x15')](_0x7383('0x19'),util[_0x7383('0x16')](_0x5c1245,{'showHidden':![],'depth':null}));});}UserReport[_0x7383('0x1a')][_0x7383('0x12')]=function(){setInterval(function(){BPromise[_0x7383('0x17')]()['then'](showSipRegistrations())[_0x7383('0x13')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x7383('0x1a')][_0x7383('0x1b')]=function(_0x585382){return _0x585382!==null&&!_[_0x7383('0x1c')](_0x585382);};UserReport[_0x7383('0x1a')][_0x7383('0x1d')]=function(_0x3cd30f,_0x3c56b6,_0x48b6df){io['to'](_0x3cd30f)[_0x7383('0x1d')](_0x3c56b6,_0x48b6df);};UserReport[_0x7383('0x1a')][_0x7383('0xc')]=function(_0x381cfb){try{if(this[_0x7383('0x1b')](_0x381cfb)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x381cfb[_0x7383('0x1e')],_0x381cfb[_0x7383('0x1f')]);logger[_0x7383('0x20')](_0x7383('0x21'),util[_0x7383('0x16')](_0x381cfb,{'showHidden':![],'depth':null}));var _0x198fd2=_[_0x7383('0x22')](this[_0x7383('0x8')],{'defaultuser':_0x381cfb[_0x7383('0x1e')]});if(_0x198fd2){_0x381cfb[_0x7383('0x23')]=_0x381cfb[_0x7383('0x1f')];_[_0x7383('0x24')](_0x198fd2,_[_0x7383('0x25')](_0x381cfb,[_0x7383('0x26'),'actionid',_0x7383('0x1e'),_0x7383('0x1f')]));logger['debug'](_0x7383('0x27'),util[_0x7383('0x16')](_0x198fd2,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x7383('0x28'),_0x198fd2[_0x7383('0x29')]),_0x7383('0x2a'),_0x198fd2);}}}catch(_0x4a39d9){logger[_0x7383('0x15')](_0x7383('0x21'),util[_0x7383('0x16')](_0x4a39d9,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7383('0x2b')]=function(_0x5797e1){try{if(this[_0x7383('0x1b')](_0x5797e1)){logger[_0x7383('0x2c')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5797e1[_0x7383('0x2d')],_0x5797e1[_0x7383('0x1f')]);logger['debug']('[userReport][devicestatechange]',util[_0x7383('0x16')](_0x5797e1,{'showHidden':![],'depth':null}));if(this['agents'][_0x5797e1[_0x7383('0x2d')]]){if(!this['agents'][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x2e')]||_0x5797e1[_0x7383('0x1f')][_0x7383('0x2f')]()==_0x7383('0x30')){this[_0x7383('0x9')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x2e')]=![];if(this[_0x7383('0x9')][_0x5797e1['device']][_0x7383('0x1f')]!==_0x5797e1['state'][_0x7383('0x2f')]()){this[_0x7383('0x9')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x31')]=_[_0x7383('0x32')](moment()['format']('x'));}this['agents'][_0x5797e1['device']][_0x7383('0x1f')]=_0x5797e1['state'][_0x7383('0x2f')]();this['agents'][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x33')](_0x5797e1);}}else if(this[_0x7383('0xa')][_0x5797e1['device']]){if(this[_0x7383('0xa')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x1f')]!==_0x5797e1[_0x7383('0x1f')]['toLowerCase']()){this[_0x7383('0xa')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x31')]=_[_0x7383('0x32')](moment()[_0x7383('0x34')]('x'));}this['telephones'][_0x5797e1[_0x7383('0x2d')]]['state']=_0x5797e1[_0x7383('0x1f')]['toLowerCase']();logger[_0x7383('0x20')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x7383('0x16')](this[_0x7383('0xa')][_0x5797e1[_0x7383('0x2d')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7383('0x34')](_0x7383('0x35'),this['telephones'][_0x5797e1[_0x7383('0x2d')]]['name']),'telephone:save',this[_0x7383('0xa')][_0x5797e1[_0x7383('0x2d')]]);}else if(this[_0x7383('0x8')][_0x5797e1[_0x7383('0x2d')]]){if(this['trunks'][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x1f')]!==_0x5797e1[_0x7383('0x1f')][_0x7383('0x2f')]()){this['trunks'][_0x5797e1['device']][_0x7383('0x31')]=_[_0x7383('0x32')](moment()[_0x7383('0x34')]('x'));}this[_0x7383('0x8')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x1f')]=_0x5797e1['state']['toLowerCase']();logger[_0x7383('0x20')](_0x7383('0x36'),util['inspect'](this[_0x7383('0x8')][_0x5797e1[_0x7383('0x2d')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7383('0x34')]('trunk:%s',this[_0x7383('0x8')][_0x5797e1[_0x7383('0x2d')]][_0x7383('0x29')]),_0x7383('0x2a'),this[_0x7383('0x8')][_0x5797e1[_0x7383('0x2d')]]);}else if(_[_0x7383('0x37')](_0x5797e1['device'],_0x7383('0x38'))){var _0x4dbe04=_0x5797e1[_0x7383('0x2d')];var _0x8f76f=_0x4dbe04[_0x7383('0x39')](_0x4dbe04[_0x7383('0x3a')]('/')+0x1,_0x4dbe04[_0x7383('0x3a')]('@'));var _0xa8fd76=_[_0x7383('0x22')](this[_0x7383('0x9')],function(_0x30f49e){return _0x30f49e[_0x7383('0x3b')]==_0x8f76f||_0x30f49e[_0x7383('0x3c')]==_0x8f76f||_0x30f49e[_0x7383('0x3d')]==_0x8f76f;});if(_0xa8fd76){if(_0xa8fd76[_0x7383('0x1f')]!==_0x5797e1[_0x7383('0x1f')]['toLowerCase']()){_0xa8fd76[_0x7383('0x31')]=_[_0x7383('0x32')](moment()[_0x7383('0x34')]('x'));}_0xa8fd76[_0x7383('0x1f')]=_0x5797e1[_0x7383('0x1f')]['toLowerCase']();_0xa8fd76['local']=!![];_0xa8fd76[_0x7383('0x33')](_0x5797e1);}}}}catch(_0x4896ed){logger[_0x7383('0x15')](_0x7383('0x3e'),util[_0x7383('0x16')](_0x4896ed,{'showHidden':![],'depth':null}));}};UserReport[_0x7383('0x1a')][_0x7383('0x11')]=function(_0x56c4ab){try{if(this[_0x7383('0x1b')](_0x56c4ab)&&this[_0x7383('0x1b')](_0x56c4ab[_0x7383('0x10')])){logger[_0x7383('0x2c')](_0x7383('0x3f'),_0x56c4ab[_0x7383('0x40')],_0x56c4ab[_0x7383('0x41')],_0x56c4ab[_0x7383('0x10')]);logger[_0x7383('0x20')]('[userReport][peerstatus]',util[_0x7383('0x16')](_0x56c4ab,{'showHidden':![],'depth':null}));if(this[_0x7383('0x9')][_0x56c4ab[_0x7383('0x40')]]){if(!this['agents'][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x2e')]||_0x56c4ab['peerstatus'][_0x7383('0x2f')]()==_0x7383('0x42')){this['agents'][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x2e')]=![];this[_0x7383('0x9')][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x43')]=_0x56c4ab[_0x7383('0x10')][_0x7383('0x2f')]();this[_0x7383('0x9')][_0x56c4ab[_0x7383('0x40')]]['address']=_0x56c4ab['address'];this['agents'][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x33')](_0x56c4ab);}}else if(this[_0x7383('0xa')][_0x56c4ab[_0x7383('0x40')]]){this['telephones'][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x43')]=_0x56c4ab['peerstatus']['toLowerCase']();this['telephones'][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x41')]=_0x56c4ab['address'];logger[_0x7383('0x20')](_0x7383('0x44'),util[_0x7383('0x16')](this[_0x7383('0xa')][_0x56c4ab['peer']],{'showHidden':![],'depth':null}));this[_0x7383('0x1d')](util[_0x7383('0x34')]('telephone:%s',this[_0x7383('0xa')][_0x56c4ab['peer']][_0x7383('0x29')]),_0x7383('0x45'),this[_0x7383('0xa')][_0x56c4ab[_0x7383('0x40')]]);}else if(this['trunks'][_0x56c4ab[_0x7383('0x40')]]){this[_0x7383('0x8')][_0x56c4ab['peer']]['status']=_0x56c4ab['peerstatus']['toLowerCase']();this[_0x7383('0x8')][_0x56c4ab[_0x7383('0x40')]][_0x7383('0x41')]=_0x56c4ab[_0x7383('0x41')];logger['debug'](_0x7383('0x46'),util[_0x7383('0x16')](this['trunks'][_0x56c4ab[_0x7383('0x40')]],{'showHidden':![],'depth':null}));this[_0x7383('0x1d')](util[_0x7383('0x34')]('trunk:%s',this[_0x7383('0x8')][_0x56c4ab[_0x7383('0x40')]]['name']),_0x7383('0x2a'),this[_0x7383('0x8')][_0x56c4ab['peer']]);}}}catch(_0x374fc8){logger[_0x7383('0x15')](_0x7383('0x47'),util[_0x7383('0x16')](_0x374fc8,{'showHidden':![],'depth':null}));}};module[_0x7383('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index c23eb0e..f3a6440 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 _0xba54=['agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','syncAgentConnect','syncAgentRingNoAnswer','bind','queuecallerabandon','syncQueueCallerAbandon','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','type','voice','merge','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','inspect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','destconnectedlinenum','channel','split','name','accountcode','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout'];(function(_0x158b34,_0x2a8fb1){var _0x2f5449=function(_0x58de0a){while(--_0x58de0a){_0x158b34['push'](_0x158b34['shift']());}};_0x2f5449(++_0x2a8fb1);}(_0xba54,0x176));var _0x4ba5=function(_0x520d8f,_0x18a278){_0x520d8f=_0x520d8f-0x0;var _0x22b054=_0xba54[_0x520d8f];return _0x22b054;};'use strict';var _=require('lodash');var moment=require(_0x4ba5('0x0'));var util=require(_0x4ba5('0x1'));var Redis=require('ioredis');var config=require(_0x4ba5('0x2'));var logger=require(_0x4ba5('0x3'))(_0x4ba5('0x4'));var ami=require(_0x4ba5('0x5'));config[_0x4ba5('0x6')]=_[_0x4ba5('0x7')](config['redis'],{'host':_0x4ba5('0x8'),'port':0x18eb});var io=require(_0x4ba5('0x9'))(new Redis(config[_0x4ba5('0x6')]));function VoiceAgentReport(_0x4db699){this[_0x4ba5('0xa')]={};this[_0x4ba5('0xb')]=_0x4db699[_0x4ba5('0xa')];this[_0x4ba5('0xc')]=_0x4db699[_0x4ba5('0xc')];this[_0x4ba5('0xd')]=_0x4db699['agents'];this[_0x4ba5('0xe')]={};ami['on'](_0x4ba5('0xf'),this[_0x4ba5('0x10')]['bind'](this));ami['on']('agentconnect',this[_0x4ba5('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0x4ba5('0x12')][_0x4ba5('0x13')](this));ami['on'](_0x4ba5('0x14'),this[_0x4ba5('0x15')][_0x4ba5('0x13')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x4ba5('0x16'),this[_0x4ba5('0x17')]['bind'](this));ami['on'](_0x4ba5('0x18'),this[_0x4ba5('0x19')][_0x4ba5('0x13')](this));ami['on'](_0x4ba5('0x1a'),this[_0x4ba5('0x1b')][_0x4ba5('0x13')](this));ami['on']('musiconholdstop',this[_0x4ba5('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x4ba5('0x1d')][_0x4ba5('0x13')](this));ami['on']('blindtransfer',this[_0x4ba5('0x1e')]['bind'](this));}VoiceAgentReport['prototype'][_0x4ba5('0x1f')]=function(_0x3613fe,_0x4acd7f,_0x36cd0e){io['to'](_0x3613fe)[_0x4ba5('0x1f')](_0x4acd7f,_0x36cd0e);};VoiceAgentReport[_0x4ba5('0x20')][_0x4ba5('0x21')]=function(_0x284a20){return _0x284a20!==null&&!_[_0x4ba5('0x22')](_0x284a20);};VoiceAgentReport[_0x4ba5('0x20')][_0x4ba5('0x10')]=function(_0x557ffb){try{if(this[_0x4ba5('0x21')](_0x557ffb)){logger[_0x4ba5('0x23')](_0x4ba5('0x24'),_0x557ffb['uniqueid'],_0x557ffb[_0x4ba5('0x25')],_0x557ffb[_0x4ba5('0x26')]);logger[_0x4ba5('0x27')](_0x4ba5('0x28'),_0x557ffb[_0x4ba5('0x29')],util['inspect'](_0x557ffb,{'showHidden':![],'depth':null}));if(_[_0x4ba5('0x22')](this['channels'][_0x557ffb['uniqueid']])){this[_0x4ba5('0xa')][_0x557ffb['uniqueid']]={};}var _0x30620e=this['agents'][_0x557ffb[_0x4ba5('0x2a')]];var _0x37710d=this[_0x4ba5('0xa')][_0x557ffb[_0x4ba5('0x29')]][_0x557ffb[_0x4ba5('0x26')]];var _0x17282b=this[_0x4ba5('0xc')][_0x557ffb[_0x4ba5('0x2b')]];var _0x4c4939=this['variables'][_0x557ffb[_0x4ba5('0x29')]];if(_[_0x4ba5('0x22')](_0x37710d)){_0x37710d={'agentcalledAt':moment()[_0x4ba5('0x2c')](_0x4ba5('0x2d')),'lastevent':_0x4ba5('0x2e'),'mandatoryDisposition':_0x17282b&&_0x17282b['mandatoryDisposition']?_0x17282b['mandatoryDisposition']:![],'type':_0x17282b&&_0x17282b[_0x4ba5('0x2f')]?_0x17282b[_0x4ba5('0x2f')]:'inbound','variables':_0x4c4939,'motionChannel':_0x4ba5('0x30')};}_[_0x4ba5('0x31')](_0x37710d,_['omit'](_0x557ffb,[_0x4ba5('0x32'),_0x4ba5('0x33')]));logger[_0x4ba5('0x27')](_0x4ba5('0x34'),_0x557ffb['uniqueid'],util['inspect'](_0x37710d,{'showHidden':![],'depth':null}));ami[_0x4ba5('0x1f')](_0x4ba5('0x35'),_0x37710d);var _0x1a307f={'id':_0x30620e['id'],'calleridnum':_0x37710d[_0x4ba5('0x36')],'queue':_0x37710d[_0x4ba5('0x2b')],'variables':_0x37710d['variables'],'uniqueid':_0x557ffb[_0x4ba5('0x29')]};logger[_0x4ba5('0x27')](_0x4ba5('0x37'),_0x557ffb[_0x4ba5('0x29')],util['inspect'](_0x1a307f,{'showHidden':![],'depth':null}));this[_0x4ba5('0x1f')](util[_0x4ba5('0x2c')](_0x4ba5('0x38'),_0x557ffb['membername']),_0x4ba5('0x39'),_0x1a307f);}}catch(_0x5d6597){logger[_0x4ba5('0x3a')](_0x4ba5('0x3b'),_0x557ffb[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x5d6597,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')]['syncAgentConnect']=function(_0x158579){try{if(this['isNotNull'](_0x158579)){if(this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]]){logger[_0x4ba5('0x27')](_0x4ba5('0x3d'),_0x158579[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x158579,{'showHidden':![],'depth':null}));for(var _0xfeabc1 in this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]]){if(this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0x4ba5('0x3e')](_0xfeabc1)){if(_0x158579[_0x4ba5('0x26')]===_0xfeabc1){logger[_0x4ba5('0x23')](_0x4ba5('0x3f'),_0x158579['uniqueid'],_0x158579['membername'],_0x158579['destuniqueid']);this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x40')]=moment()[_0x4ba5('0x2c')](_0x4ba5('0x2d'));this[_0x4ba5('0xa')][_0x158579['uniqueid']][_0xfeabc1][_0x4ba5('0x41')]=_0x158579[_0x4ba5('0x41')];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]['connectedlinenum']=_0x158579[_0x4ba5('0x42')];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x43')]=_0x158579['destchannelstate'];this['channels'][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x44')]=_0x158579['destchannelstatedesc'];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x45')]=_0x158579[_0x4ba5('0x45')];this[_0x4ba5('0xa')][_0x158579['uniqueid']][_0xfeabc1][_0x4ba5('0x46')]=_0x4ba5('0x47');if(this[_0x4ba5('0xb')][this['channels'][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]['uniqueid']]){var _0x1a5b16=this['voiceChannels'][this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]['uniqueid']][_0x4ba5('0x48')];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x48')]=_0x1a5b16;_0x158579['routealias']=_0x1a5b16;}_[_0x4ba5('0x31')](this[_0x4ba5('0xd')][_0x158579[_0x4ba5('0x2a')]],_[_0x4ba5('0x49')](_0x158579,[_0x4ba5('0x2b'),_0x4ba5('0x4a'),_0x4ba5('0x48')]));var _0x14bb72=this['agents'][_0x158579[_0x4ba5('0x4b')][_0x4ba5('0x4c')]('-')[0x0]];var _0x41a453={'id':_0x14bb72['id'],'name':_0x14bb72[_0x4ba5('0x4d')],'agentconnected':!![],'destaccountcode':_0x14bb72[_0x4ba5('0x4e')],'destconnectedlinenum':this['channels'][_0x158579[_0x4ba5('0x29')]][_0x158579[_0x4ba5('0x26')]]['exten'],'queue':this['channels'][_0x158579[_0x4ba5('0x29')]][_0x158579[_0x4ba5('0x26')]]['queue'],'routealias':this[_0x4ba5('0xa')][_0x158579['uniqueid']][_0x158579[_0x4ba5('0x26')]][_0x4ba5('0x48')],'uniqueid':this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0x158579[_0x4ba5('0x26')]][_0x4ba5('0x29')]};logger[_0x4ba5('0x27')](_0x4ba5('0x4f'),_0x158579[_0x4ba5('0x29')],util['inspect'](_0x41a453,{'showHidden':![],'depth':null}));ami[_0x4ba5('0x1f')](_0x4ba5('0x50'),_0x41a453);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x158579[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x41a453,{'showHidden':![],'depth':null}));this[_0x4ba5('0x1f')](util[_0x4ba5('0x2c')](_0x4ba5('0x38'),_0x158579['membername']),_0x4ba5('0x51'),_0x41a453);}else if(!this[_0x4ba5('0xa')][_0x158579['uniqueid']][_0xfeabc1][_0x4ba5('0x52')]&&!this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x53')]){logger[_0x4ba5('0x23')](_0x4ba5('0x54'),_0x158579[_0x4ba5('0x29')],this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]['membername'],_0xfeabc1);this['channels'][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]['agentringnoanswer']=!![];this[_0x4ba5('0xa')][_0x158579['uniqueid']][_0xfeabc1][_0x4ba5('0x55')]=moment()[_0x4ba5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x56')]=_0x158579['destuniqueid'];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x57')]=_0x158579['membername'];this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x46')]='answered_elsewhere';this['channels'][_0x158579[_0x4ba5('0x29')]][_0xfeabc1][_0x4ba5('0x58')]='answered_elsewhere';logger[_0x4ba5('0x27')](_0x4ba5('0x59'),_0x158579['uniqueid'],util[_0x4ba5('0x3c')](this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0x4ba5('0xa')][_0x158579[_0x4ba5('0x29')]][_0xfeabc1]);}}}}}}catch(_0xbebb26){logger['error'](_0x4ba5('0x5a'),_0x158579[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0xbebb26,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')][_0x4ba5('0x12')]=function(_0x1d1f3f){try{if(this[_0x4ba5('0x21')](_0x1d1f3f)){logger[_0x4ba5('0x27')](_0x4ba5('0x5b'),_0x1d1f3f[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x1d1f3f,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x1d1f3f[_0x4ba5('0x29')]]&&this['channels'][_0x1d1f3f['uniqueid']][_0x1d1f3f['destuniqueid']]){logger[_0x4ba5('0x23')](_0x4ba5('0x5c'),_0x1d1f3f[_0x4ba5('0x29')],_0x1d1f3f[_0x4ba5('0x25')],_0x1d1f3f[_0x4ba5('0x26')]);var _0x478a84=this[_0x4ba5('0xd')][_0x1d1f3f[_0x4ba5('0x2a')]];var _0xd0818e=this[_0x4ba5('0xa')][_0x1d1f3f[_0x4ba5('0x29')]][_0x1d1f3f[_0x4ba5('0x26')]];_0xd0818e[_0x4ba5('0x52')]=!![];_0xd0818e[_0x4ba5('0x55')]=moment()['format'](_0x4ba5('0x2d'));_0xd0818e[_0x4ba5('0x46')]='rejected';_0xd0818e[_0x4ba5('0x58')]=_0x4ba5('0x5d');var _0x4fe17d={'id':_0x478a84['id'],'name':_0x478a84['name'],'queue':_0xd0818e[_0x4ba5('0x2b')],'uniqueid':_0xd0818e[_0x4ba5('0x29')]};logger['debug'](_0x4ba5('0x5e'),_0x1d1f3f['uniqueid'],util[_0x4ba5('0x3c')](_0x4fe17d,{'showHidden':![],'depth':null}));this[_0x4ba5('0x1f')](util[_0x4ba5('0x2c')]('user:%s',_0x478a84[_0x4ba5('0x4d')]),'user:agentringnoanswer',_0x4fe17d);ami[_0x4ba5('0x1f')]('custom:agentringnoanswer',_0xd0818e);}}}catch(_0x1ba135){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x1d1f3f[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x1ba135,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x535be4){try{if(this[_0x4ba5('0x21')](_0x535be4)){logger[_0x4ba5('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x535be4['uniqueid'],util[_0x4ba5('0x3c')](_0x535be4,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x535be4['uniqueid']]){for(var _0x17bab8 in this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]]){if(this[_0x4ba5('0xa')][_0x535be4['uniqueid']][_0x4ba5('0x3e')](_0x17bab8)&&!this['channels'][_0x535be4[_0x4ba5('0x29')]][_0x17bab8][_0x4ba5('0x52')]&&!this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8][_0x4ba5('0x53')]){logger[_0x4ba5('0x23')](_0x4ba5('0x5f'),_0x535be4[_0x4ba5('0x29')],this['channels'][_0x535be4[_0x4ba5('0x29')]][_0x17bab8][_0x4ba5('0x25')],_0x17bab8);this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8]['agentringnoanswer']=!![];this[_0x4ba5('0xa')][_0x535be4['uniqueid']][_0x17bab8][_0x4ba5('0x55')]=moment()[_0x4ba5('0x2c')](_0x4ba5('0x2d'));this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8][_0x4ba5('0x46')]='abandoned';this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8][_0x4ba5('0x58')]=_0x4ba5('0x60');logger[_0x4ba5('0x27')](_0x4ba5('0x61'),_0x535be4['uniqueid'],util[_0x4ba5('0x3c')](this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8],{'showHidden':![],'depth':null}));ami[_0x4ba5('0x1f')](_0x4ba5('0x62'),this[_0x4ba5('0xa')][_0x535be4[_0x4ba5('0x29')]][_0x17bab8]);}}}}}catch(_0x1db74d){logger[_0x4ba5('0x3a')](_0x4ba5('0x63'),_0x535be4['uniqueid'],util[_0x4ba5('0x3c')](_0x1db74d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4ba5('0x64')]=function(_0x3c4465){try{if(this[_0x4ba5('0x21')](_0x3c4465)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x3c4465['uniqueid'],util[_0x4ba5('0x3c')](_0x3c4465,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]]){for(var _0x56df52 in this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]]){if(this['channels'][_0x3c4465['uniqueid']][_0x4ba5('0x3e')](_0x56df52)){if(this[_0x4ba5('0xa')][_0x3c4465['uniqueid']][_0x56df52][_0x4ba5('0x40')]&&!this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x53')]){logger['info'](_0x4ba5('0x65'),_0x3c4465[_0x4ba5('0x29')],this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x25')],_0x56df52);this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x53')]=!![];this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x66')]=moment()[_0x4ba5('0x2c')](_0x4ba5('0x2d'));this['channels'][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x46')]=_0x4ba5('0x67');this['channels'][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x58')]=_0x3c4465[_0x4ba5('0x58')]==_0x4ba5('0x68')?'agent':_0x3c4465[_0x4ba5('0x58')];this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x69')]=_0x3c4465[_0x4ba5('0x69')];if(this[_0x4ba5('0xc')][_0x3c4465['queue']]&&this[_0x4ba5('0xc')][_0x3c4465[_0x4ba5('0x2b')]][_0x4ba5('0x6a')]){this['channels'][_0x3c4465['uniqueid']][_0x56df52][_0x4ba5('0x6b')]=this[_0x4ba5('0xc')][_0x3c4465[_0x4ba5('0x2b')]][_0x4ba5('0x6c')];this[_0x4ba5('0xa')][_0x3c4465[_0x4ba5('0x29')]][_0x56df52][_0x4ba5('0x6d')]=!![];}this[_0x4ba5('0xd')][_0x3c4465[_0x4ba5('0x2a')]]=_[_0x4ba5('0x6e')](this[_0x4ba5('0xd')][_0x3c4465['interface']],[_0x4ba5('0x2b'),_0x4ba5('0x4a')]);logger[_0x4ba5('0x27')](_0x4ba5('0x6f'),_0x3c4465[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](this[_0x4ba5('0xa')][_0x3c4465['uniqueid']][_0x56df52],{'showHidden':![],'depth':null}));ami[_0x4ba5('0x1f')](_0x4ba5('0x70'),this[_0x4ba5('0xa')][_0x3c4465['uniqueid']][_0x56df52]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3c4465[_0x4ba5('0x29')],util['inspect']({'id':this[_0x4ba5('0xd')][_0x3c4465[_0x4ba5('0x2a')]]['id'],'destaccountcode':_0x3c4465['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x4ba5('0x1f')](util[_0x4ba5('0x2c')](_0x4ba5('0x38'),_0x3c4465[_0x4ba5('0x25')]),'user:agentcomplete',{'id':this[_0x4ba5('0xd')][_0x3c4465[_0x4ba5('0x2a')]]['id'],'destaccountcode':Number(_0x3c4465[_0x4ba5('0x71')])});}}}}}}catch(_0x24c58d){logger[_0x4ba5('0x3a')](_0x4ba5('0x72'),_0x3c4465[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x24c58d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')]['syncVarSet']=function(_0x5dddab){try{if(this[_0x4ba5('0x21')](_0x5dddab)){logger[_0x4ba5('0x27')]('[%s][voiceAgentReport][varset]\x20event:',_0x5dddab[_0x4ba5('0x29')],util['inspect'](_0x5dddab,{'showHidden':![],'depth':null}));this[_0x4ba5('0x73')](_0x5dddab[_0x4ba5('0x29')],_[_0x4ba5('0x74')](_0x5dddab[_0x4ba5('0x75')])[0x0],_0x5dddab[_0x4ba5('0x76')]);if(this[_0x4ba5('0xa')][_0x5dddab[_0x4ba5('0x29')]]){for(var _0x392e09 in this[_0x4ba5('0xa')][_0x5dddab['uniqueid']]){if(this[_0x4ba5('0xa')][_0x5dddab[_0x4ba5('0x29')]][_0x4ba5('0x3e')](_0x392e09)){logger['info'](_0x4ba5('0x77'),_0x5dddab['uniqueid'],_0x392e09,_[_0x4ba5('0x74')](_0x5dddab[_0x4ba5('0x75')])[0x0],_0x5dddab[_0x4ba5('0x76')]);if(_[_0x4ba5('0x22')](this['channels'][_0x5dddab[_0x4ba5('0x29')]][_0x392e09][_0x4ba5('0xe')])){this[_0x4ba5('0xa')][_0x5dddab['uniqueid']][_0x392e09]['variables']={};}this[_0x4ba5('0xa')][_0x5dddab['uniqueid']][_0x392e09]['variables']=this[_0x4ba5('0xe')][_0x5dddab[_0x4ba5('0x29')]];}}}}}catch(_0x48bc48){logger[_0x4ba5('0x3a')](_0x4ba5('0x78'),_0x5dddab[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x48bc48,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')][_0x4ba5('0x73')]=function(_0x57ac3d,_0x2f33bc,_0x4c2b9a){var _0x474d61=[_0x4ba5('0x79'),_0x4ba5('0x7a'),_0x4ba5('0x7b'),_0x4ba5('0x7c'),_0x4ba5('0x7d'),_0x4ba5('0x7e'),_0x4ba5('0x7f'),_0x4ba5('0x80'),'sipcallid','sipuri',_0x4ba5('0x81'),_0x4ba5('0x82'),_0x4ba5('0x83'),_0x4ba5('0x84'),_0x4ba5('0x85'),'memberlastcall',_0x4ba5('0x25'),_0x4ba5('0x86'),'memberrealtime'];if(!_[_0x4ba5('0x87')](_0x2f33bc)&&!_[_0x4ba5('0x88')](_0x474d61,_0x2f33bc)){if(_['isUndefined'](this[_0x4ba5('0xe')][_0x57ac3d])){this['variables'][_0x57ac3d]={};}this[_0x4ba5('0xe')][_0x57ac3d][_0x2f33bc]=_0x4c2b9a;}};VoiceAgentReport['prototype'][_0x4ba5('0x19')]=function(_0x343ff5){try{if(this[_0x4ba5('0x21')](_0x343ff5)){logger[_0x4ba5('0x27')]('[%s][voiceAgentReport][hangup]\x20event:',_0x343ff5[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x343ff5,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]]){for(var _0x34a04a in this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]]){if(this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]][_0x4ba5('0x3e')](_0x34a04a)){if(this[_0x4ba5('0xa')][_0x343ff5['uniqueid']][_0x34a04a][_0x4ba5('0x58')]=='transfer'&&this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]][_0x34a04a][_0x4ba5('0x53')]){logger[_0x4ba5('0x23')](_0x4ba5('0x89'),_0x343ff5[_0x4ba5('0x29')],_0x34a04a);this[_0x4ba5('0xa')][_0x343ff5['uniqueid']][_0x34a04a][_0x4ba5('0x66')]=moment()['format'](_0x4ba5('0x2d'));}}}logger[_0x4ba5('0x27')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x343ff5[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_[_0x4ba5('0x8a')](this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x4ba5('0x1f')](_0x4ba5('0x8b'),_[_0x4ba5('0x8a')](this[_0x4ba5('0xa')][_0x343ff5['uniqueid']]));delete this[_0x4ba5('0xa')][_0x343ff5[_0x4ba5('0x29')]];}if(this[_0x4ba5('0xe')][_0x343ff5[_0x4ba5('0x29')]]){delete this[_0x4ba5('0xe')][_0x343ff5['uniqueid']];}}}catch(_0x195fbe){logger[_0x4ba5('0x3a')](_0x4ba5('0x8c'),_0x343ff5[_0x4ba5('0x29')],util['inspect'](_0x195fbe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')]['syncAttendedTransfer']=function(_0x10de98){try{if(this[_0x4ba5('0x21')](_0x10de98)){logger[_0x4ba5('0x27')](_0x4ba5('0x8d'),_0x10de98[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x10de98,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]]){for(var _0x4c9439 in this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]]){if(this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]][_0x4ba5('0x3e')](_0x4c9439)){if(_0x10de98[_0x4ba5('0x8f')]===_0x4c9439){logger[_0x4ba5('0x23')](_0x4ba5('0x90'),_0x10de98[_0x4ba5('0x29')],this[_0x4ba5('0xa')][_0x10de98['transfereeuniqueid']][_0x4c9439][_0x4ba5('0x25')],_0x4c9439);var _0x59d3a7=moment();this[_0x4ba5('0xa')][_0x10de98['transfereeuniqueid']][_0x4c9439]['agentcomplete']=!![];this[_0x4ba5('0xa')][_0x10de98['transfereeuniqueid']][_0x4c9439]['agentcompleteAt']=moment()[_0x4ba5('0x2c')](_0x4ba5('0x2d'));this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]][_0x4c9439][_0x4ba5('0x46')]=_0x4ba5('0x67');this['channels'][_0x10de98[_0x4ba5('0x8e')]][_0x4c9439]['reason']=_0x4ba5('0x68');this['channels'][_0x10de98[_0x4ba5('0x8e')]][_0x4c9439][_0x4ba5('0x69')]=_0x59d3a7[_0x4ba5('0x91')](this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]][_0x4c9439][_0x4ba5('0x40')],_0x4ba5('0x92'));}}}}if(this['channels'][_0x10de98[_0x4ba5('0x93')]]){var _0x220b72=this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x93')]];this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x93')]]=this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]];this[_0x4ba5('0xa')][_0x10de98[_0x4ba5('0x8e')]]=_0x220b72;}}}catch(_0x459d89){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x10de98[_0x4ba5('0x29')],util['inspect'](_0x459d89,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4ba5('0x1e')]=function(_0x304941){try{if(this[_0x4ba5('0x21')](_0x304941)){logger[_0x4ba5('0x27')](_0x4ba5('0x94'),_0x304941[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x304941,{'showHidden':![],'depth':null}));if(this[_0x4ba5('0xa')][_0x304941['transfereeuniqueid']]){for(var _0x14bb59 in this[_0x4ba5('0xa')][_0x304941[_0x4ba5('0x8e')]]){if(this[_0x4ba5('0xa')][_0x304941[_0x4ba5('0x8e')]]['hasOwnProperty'](_0x14bb59)){if(_0x304941[_0x4ba5('0x95')]===_0x14bb59){logger[_0x4ba5('0x23')](_0x4ba5('0x96'),_0x304941['uniqueid'],this[_0x4ba5('0xa')][_0x304941[_0x4ba5('0x8e')]][_0x14bb59]['membername'],_0x14bb59);var _0x9e4f8d=moment();this[_0x4ba5('0xa')][_0x304941[_0x4ba5('0x8e')]][_0x14bb59][_0x4ba5('0x53')]=!![];this[_0x4ba5('0xa')][_0x304941['transfereeuniqueid']][_0x14bb59][_0x4ba5('0x66')]=_0x9e4f8d;this[_0x4ba5('0xa')][_0x304941[_0x4ba5('0x8e')]][_0x14bb59][_0x4ba5('0x46')]=_0x4ba5('0x67');this['channels'][_0x304941[_0x4ba5('0x8e')]][_0x14bb59][_0x4ba5('0x58')]='transfer';this['channels'][_0x304941[_0x4ba5('0x8e')]][_0x14bb59]['talktime']=_0x9e4f8d[_0x4ba5('0x91')](this['channels'][_0x304941[_0x4ba5('0x8e')]][_0x14bb59][_0x4ba5('0x40')],_0x4ba5('0x92'));}}}}}}catch(_0x240f81){logger[_0x4ba5('0x3a')](_0x4ba5('0x97'),_0x304941[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x240f81,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4ba5('0x20')][_0x4ba5('0x1b')]=function(_0x33fd08){var _0x52788e='';try{if(this['isNotNull'](_0x33fd08)){logger[_0x4ba5('0x27')](_0x4ba5('0x98'),_0x33fd08[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x33fd08,{'showHidden':![],'depth':null}));if(_0x33fd08[_0x4ba5('0x4b')]){_0x52788e=_0x33fd08[_0x4ba5('0x4b')][_0x4ba5('0x99')](0x0,_0x33fd08[_0x4ba5('0x4b')][_0x4ba5('0x9a')]('-'));if(this[_0x4ba5('0xd')][_0x52788e]){logger[_0x4ba5('0x23')](_0x4ba5('0x9b'),_0x33fd08[_0x4ba5('0x29')],_0x52788e);this[_0x4ba5('0xd')][_0x52788e][_0x4ba5('0x9c')]=!![];}}}}catch(_0x20300b){logger[_0x4ba5('0x3a')](_0x4ba5('0x9d'),_0x33fd08['uniqueid'],util['inspect'](_0x20300b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4ba5('0x1c')]=function(_0x41ea07){var _0x24028f='';try{if(this['isNotNull'](_0x41ea07)){logger[_0x4ba5('0x27')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x41ea07['uniqueid'],util[_0x4ba5('0x3c')](_0x41ea07,{'showHidden':![],'depth':null}));if(_0x41ea07['channel']){_0x24028f=_0x41ea07[_0x4ba5('0x4b')][_0x4ba5('0x99')](0x0,_0x41ea07[_0x4ba5('0x4b')][_0x4ba5('0x9a')]('-'));if(this['agents'][_0x24028f]){logger[_0x4ba5('0x23')](_0x4ba5('0x9e'),_0x41ea07[_0x4ba5('0x29')],_0x24028f);this[_0x4ba5('0xd')][_0x24028f][_0x4ba5('0x9c')]=![];}}}}catch(_0x3f2d72){logger[_0x4ba5('0x3a')](_0x4ba5('0x9f'),_0x41ea07[_0x4ba5('0x29')],util[_0x4ba5('0x3c')](_0x3f2d72,{'showHidden':![],'depth':null}));}};module[_0x4ba5('0xa0')]=VoiceAgentReport; \ No newline at end of file +var _0x74eb=['rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','isNil','includes','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','syncAgentCalled','info','uniqueid','membername','inspect','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','type','inbound','omit','event','privilege','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','pick','destconnectedlinenum','name','exten','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x74eb,0x1eb));var _0xb74e=function(_0x5f38dd,_0x4625e4){_0x5f38dd=_0x5f38dd-0x0;var _0x2f4c44=_0x74eb[_0x5f38dd];return _0x2f4c44;};'use strict';var _=require(_0xb74e('0x0'));var moment=require(_0xb74e('0x1'));var util=require(_0xb74e('0x2'));var Redis=require(_0xb74e('0x3'));var config=require(_0xb74e('0x4'));var logger=require(_0xb74e('0x5'))(_0xb74e('0x6'));var ami=require(_0xb74e('0x7'));config['redis']=_[_0xb74e('0x8')](config['redis'],{'host':_0xb74e('0x9'),'port':0x18eb});var io=require(_0xb74e('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x4f0394){this['channels']={};this[_0xb74e('0xb')]=_0x4f0394[_0xb74e('0xc')];this[_0xb74e('0xd')]=_0x4f0394[_0xb74e('0xd')];this[_0xb74e('0xe')]=_0x4f0394[_0xb74e('0xe')];this[_0xb74e('0xf')]={};ami['on'](_0xb74e('0x10'),this['syncAgentCalled'][_0xb74e('0x11')](this));ami['on']('agentconnect',this[_0xb74e('0x12')]['bind'](this));ami['on'](_0xb74e('0x13'),this[_0xb74e('0x14')][_0xb74e('0x11')](this));ami['on'](_0xb74e('0x15'),this['syncQueueCallerAbandon'][_0xb74e('0x11')](this));ami['on'](_0xb74e('0x16'),this[_0xb74e('0x17')][_0xb74e('0x11')](this));ami['on'](_0xb74e('0x18'),this['syncVarSet'][_0xb74e('0x11')](this));ami['on'](_0xb74e('0x19'),this[_0xb74e('0x1a')]['bind'](this));ami['on']('musiconholdstart',this[_0xb74e('0x1b')][_0xb74e('0x11')](this));ami['on'](_0xb74e('0x1c'),this[_0xb74e('0x1d')][_0xb74e('0x11')](this));ami['on']('attendedtransfer',this[_0xb74e('0x1e')]['bind'](this));ami['on'](_0xb74e('0x1f'),this[_0xb74e('0x20')]['bind'](this));}VoiceAgentReport['prototype'][_0xb74e('0x21')]=function(_0x4af129,_0x578b79,_0x3fa601){io['to'](_0x4af129)[_0xb74e('0x21')](_0x578b79,_0x3fa601);};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x23')]=function(_0x19da9d){return _0x19da9d!==null&&!_['isUndefined'](_0x19da9d);};VoiceAgentReport['prototype'][_0xb74e('0x24')]=function(_0x9c85f3){try{if(this[_0xb74e('0x23')](_0x9c85f3)){logger[_0xb74e('0x25')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x9c85f3[_0xb74e('0x26')],_0x9c85f3[_0xb74e('0x27')],_0x9c85f3['destuniqueid']);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x9c85f3[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x9c85f3,{'showHidden':![],'depth':null}));if(_[_0xb74e('0x29')](this['channels'][_0x9c85f3[_0xb74e('0x26')]])){this[_0xb74e('0xc')][_0x9c85f3['uniqueid']]={};}var _0x27e778=this[_0xb74e('0xe')][_0x9c85f3[_0xb74e('0x2a')]];var _0x2b4b1e=this[_0xb74e('0xc')][_0x9c85f3[_0xb74e('0x26')]][_0x9c85f3['destuniqueid']];var _0x91abe9=this[_0xb74e('0xd')][_0x9c85f3[_0xb74e('0x2b')]];var _0x4a9d84=this[_0xb74e('0xf')][_0x9c85f3[_0xb74e('0x26')]];if(_[_0xb74e('0x29')](_0x2b4b1e)){_0x2b4b1e={'agentcalledAt':moment()[_0xb74e('0x2c')](_0xb74e('0x2d')),'lastevent':_0xb74e('0x2e'),'mandatoryDisposition':_0x91abe9&&_0x91abe9['mandatoryDisposition']?_0x91abe9['mandatoryDisposition']:![],'type':_0x91abe9&&_0x91abe9['type']?_0x91abe9[_0xb74e('0x2f')]:_0xb74e('0x30'),'variables':_0x4a9d84,'motionChannel':'voice'};}_['merge'](_0x2b4b1e,_[_0xb74e('0x31')](_0x9c85f3,[_0xb74e('0x32'),_0xb74e('0x33')]));this[_0xb74e('0xc')][_0x9c85f3[_0xb74e('0x26')]][_0x9c85f3[_0xb74e('0x34')]]=_0x2b4b1e;logger[_0xb74e('0x35')](_0xb74e('0x36'),_0x9c85f3['uniqueid'],util[_0xb74e('0x28')](_0x2b4b1e,{'showHidden':![],'depth':null}));ami[_0xb74e('0x21')](_0xb74e('0x37'),_0x2b4b1e);var _0x48cc4d={'id':_0x27e778['id'],'calleridnum':_0x2b4b1e[_0xb74e('0x38')],'queue':_0x2b4b1e[_0xb74e('0x2b')],'variables':_0x2b4b1e[_0xb74e('0xf')],'uniqueid':_0x9c85f3[_0xb74e('0x26')]};logger['debug'](_0xb74e('0x39'),_0x9c85f3[_0xb74e('0x26')],util['inspect'](_0x48cc4d,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb74e('0x3a'),_0x9c85f3['membername']),_0xb74e('0x3b'),_0x48cc4d);}}catch(_0x428d97){logger[_0xb74e('0x3c')](_0xb74e('0x3d'),_0x9c85f3['uniqueid'],util[_0xb74e('0x28')](_0x428d97,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x12')]=function(_0x4bf2ec){try{if(this['isNotNull'](_0x4bf2ec)){if(this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]]){for(var _0x3aac24 in this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]]){if(this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0xb74e('0x3e')](_0x3aac24)){if(_0x4bf2ec['destuniqueid']===_0x3aac24){logger[_0xb74e('0x25')](_0xb74e('0x3f'),_0x4bf2ec[_0xb74e('0x26')],_0x4bf2ec[_0xb74e('0x27')],_0x4bf2ec['destuniqueid']);this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0x3aac24][_0xb74e('0x40')]=moment()[_0xb74e('0x2c')](_0xb74e('0x2d'));this['channels'][_0x4bf2ec['uniqueid']][_0x3aac24][_0xb74e('0x41')]=_0x4bf2ec['connectedlinename'];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x42')]=_0x4bf2ec[_0xb74e('0x42')];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x43')]=_0x4bf2ec[_0xb74e('0x43')];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x44')]=_0x4bf2ec[_0xb74e('0x44')];this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0x3aac24][_0xb74e('0x45')]=_0x4bf2ec['holdtime'];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x46')]=_0xb74e('0x47');if(this[_0xb74e('0xb')][this['channels'][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x26')]]){var _0x3e022b=this[_0xb74e('0xb')][this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x26')]][_0xb74e('0x48')];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x48')]=_0x3e022b;_0x4bf2ec[_0xb74e('0x48')]=_0x3e022b;}_[_0xb74e('0x49')](this['agents'][_0x4bf2ec['interface']],_[_0xb74e('0x4a')](_0x4bf2ec,[_0xb74e('0x2b'),_0xb74e('0x4b'),'routealias']));var _0x366d13=this['agents'][_0x4bf2ec[_0xb74e('0x2a')]];var _0x579fc0={'id':_0x366d13['id'],'name':_0x366d13[_0xb74e('0x4c')],'agentconnected':!![],'destaccountcode':_0x366d13['accountcode'],'destconnectedlinenum':this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x4bf2ec[_0xb74e('0x34')]][_0xb74e('0x4d')],'queue':this['channels'][_0x4bf2ec[_0xb74e('0x26')]][_0x4bf2ec[_0xb74e('0x34')]][_0xb74e('0x2b')],'routealias':this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x4bf2ec[_0xb74e('0x34')]]['routealias'],'uniqueid':this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x4bf2ec[_0xb74e('0x34')]][_0xb74e('0x26')]};ami[_0xb74e('0x21')]('custom:agentconnect',this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x4bf2ec[_0xb74e('0x34')]]);this['emit'](util[_0xb74e('0x2c')](_0xb74e('0x3a'),_0x4bf2ec[_0xb74e('0x27')]),_0xb74e('0x4e'),_0x579fc0);}else if(!this['channels'][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24]['agentringnoanswer']&&!this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0x3aac24][_0xb74e('0x16')]){logger[_0xb74e('0x25')](_0xb74e('0x4f'),_0x4bf2ec[_0xb74e('0x26')],this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x27')],_0x3aac24);this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x13')]=!![];this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0x3aac24][_0xb74e('0x50')]=moment()[_0xb74e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x51')]=_0x4bf2ec[_0xb74e('0x34')];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x52')]=_0x4bf2ec[_0xb74e('0x27')];this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24]['lastevent']=_0xb74e('0x53');this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24][_0xb74e('0x54')]='answered_elsewhere';logger[_0xb74e('0x35')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x4bf2ec[_0xb74e('0x26')],util['inspect'](this[_0xb74e('0xc')][_0x4bf2ec[_0xb74e('0x26')]][_0x3aac24],{'showHidden':![],'depth':null}));ami['emit'](_0xb74e('0x55'),this[_0xb74e('0xc')][_0x4bf2ec['uniqueid']][_0x3aac24]);}else{logger[_0xb74e('0x35')](_0xb74e('0x56'),_0x4bf2ec[_0xb74e('0x26')]);}}}}}}catch(_0xd4755d){logger[_0xb74e('0x3c')]('[%s][voiceAgentReport][agentconnect]',_0x4bf2ec[_0xb74e('0x26')],util[_0xb74e('0x28')](_0xd4755d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')]['syncAgentRingNoAnswer']=function(_0x4a468b){try{if(this[_0xb74e('0x23')](_0x4a468b)){logger[_0xb74e('0x35')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x4a468b[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x4a468b,{'showHidden':![],'depth':null}));if(this['channels'][_0x4a468b[_0xb74e('0x26')]]&&this[_0xb74e('0xc')][_0x4a468b[_0xb74e('0x26')]][_0x4a468b['destuniqueid']]){logger[_0xb74e('0x25')](_0xb74e('0x57'),_0x4a468b[_0xb74e('0x26')],_0x4a468b[_0xb74e('0x27')],_0x4a468b[_0xb74e('0x34')]);var _0x268f1a=this[_0xb74e('0xe')][_0x4a468b['interface']];var _0x1893ff=this['channels'][_0x4a468b['uniqueid']][_0x4a468b['destuniqueid']];_0x1893ff['agentringnoanswer']=!![];_0x1893ff[_0xb74e('0x50')]=moment()[_0xb74e('0x2c')](_0xb74e('0x2d'));_0x1893ff['lastevent']=_0xb74e('0x58');_0x1893ff[_0xb74e('0x54')]=_0xb74e('0x58');var _0x2602dd={'id':_0x268f1a['id'],'name':_0x268f1a[_0xb74e('0x4c')],'queue':_0x1893ff[_0xb74e('0x2b')],'uniqueid':_0x1893ff[_0xb74e('0x26')]};logger[_0xb74e('0x35')](_0xb74e('0x59'),_0x4a468b[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x2602dd,{'showHidden':![],'depth':null}));this[_0xb74e('0x21')](util[_0xb74e('0x2c')](_0xb74e('0x3a'),_0x268f1a[_0xb74e('0x4c')]),_0xb74e('0x5a'),_0x2602dd);ami[_0xb74e('0x21')]('custom:agentringnoanswer',_0x1893ff);}}}catch(_0x3fabb5){logger['error'](_0xb74e('0x5b'),_0x4a468b[_0xb74e('0x26')],util['inspect'](_0x3fabb5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb74e('0x5c')]=function(_0x223e73){try{if(this[_0xb74e('0x23')](_0x223e73)){logger['debug'](_0xb74e('0x5d'),_0x223e73['uniqueid'],util[_0xb74e('0x28')](_0x223e73,{'showHidden':![],'depth':null}));if(this['channels'][_0x223e73[_0xb74e('0x26')]]){for(var _0x3f8475 in this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]]){if(this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0xb74e('0x3e')](_0x3f8475)&&!this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0x3f8475]['agentringnoanswer']&&!this['channels'][_0x223e73[_0xb74e('0x26')]][_0x3f8475][_0xb74e('0x16')]){logger[_0xb74e('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x223e73[_0xb74e('0x26')],this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0x3f8475]['membername'],_0x3f8475);this['channels'][_0x223e73[_0xb74e('0x26')]][_0x3f8475][_0xb74e('0x13')]=!![];this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0x3f8475][_0xb74e('0x50')]=moment()[_0xb74e('0x2c')](_0xb74e('0x2d'));this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0x3f8475]['lastevent']=_0xb74e('0x5e');this[_0xb74e('0xc')][_0x223e73['uniqueid']][_0x3f8475][_0xb74e('0x54')]=_0xb74e('0x5e');logger[_0xb74e('0x35')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x223e73['uniqueid'],util[_0xb74e('0x28')](this[_0xb74e('0xc')][_0x223e73[_0xb74e('0x26')]][_0x3f8475],{'showHidden':![],'depth':null}));ami[_0xb74e('0x21')](_0xb74e('0x5f'),this[_0xb74e('0xc')][_0x223e73['uniqueid']][_0x3f8475]);}}}}}catch(_0x16b7ee){logger[_0xb74e('0x3c')](_0xb74e('0x60'),_0x223e73[_0xb74e('0x26')],util['inspect'](_0x16b7ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x17')]=function(_0x507519){try{if(this[_0xb74e('0x23')](_0x507519)){logger[_0xb74e('0x35')](_0xb74e('0x61'),_0x507519['uniqueid'],util[_0xb74e('0x28')](_0x507519,{'showHidden':![],'depth':null}));if(this['channels'][_0x507519['uniqueid']]){for(var _0x3f6384 in this[_0xb74e('0xc')][_0x507519[_0xb74e('0x26')]]){if(this['channels'][_0x507519['uniqueid']]['hasOwnProperty'](_0x3f6384)){if(this[_0xb74e('0xc')][_0x507519['uniqueid']][_0x3f6384][_0xb74e('0x40')]&&!this['channels'][_0x507519['uniqueid']][_0x3f6384][_0xb74e('0x16')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x507519[_0xb74e('0x26')],this['channels'][_0x507519[_0xb74e('0x26')]][_0x3f6384]['membername'],_0x3f6384);this['channels'][_0x507519[_0xb74e('0x26')]][_0x3f6384][_0xb74e('0x16')]=!![];this[_0xb74e('0xc')][_0x507519['uniqueid']][_0x3f6384][_0xb74e('0x62')]=moment()[_0xb74e('0x2c')](_0xb74e('0x2d'));this['channels'][_0x507519[_0xb74e('0x26')]][_0x3f6384][_0xb74e('0x46')]='complete';this[_0xb74e('0xc')][_0x507519[_0xb74e('0x26')]][_0x3f6384][_0xb74e('0x54')]=_0x507519[_0xb74e('0x54')]==_0xb74e('0x63')?_0xb74e('0x64'):_0x507519['reason'];this[_0xb74e('0xc')][_0x507519['uniqueid']][_0x3f6384][_0xb74e('0x65')]=_0x507519[_0xb74e('0x65')];if(this[_0xb74e('0xd')][_0x507519['queue']]&&this[_0xb74e('0xd')][_0x507519[_0xb74e('0x2b')]][_0xb74e('0x66')]){this[_0xb74e('0xc')][_0x507519[_0xb74e('0x26')]][_0x3f6384][_0xb74e('0x67')]=this[_0xb74e('0xd')][_0x507519[_0xb74e('0x2b')]][_0xb74e('0x68')];this['channels'][_0x507519[_0xb74e('0x26')]][_0x3f6384][_0xb74e('0x69')]=!![];}this['agents'][_0x507519[_0xb74e('0x2a')]]=_[_0xb74e('0x31')](this['agents'][_0x507519['interface']],['queue',_0xb74e('0x4b')]);logger[_0xb74e('0x35')](_0xb74e('0x6a'),_0x507519[_0xb74e('0x26')],util['inspect'](this[_0xb74e('0xc')][_0x507519[_0xb74e('0x26')]][_0x3f6384],{'showHidden':![],'depth':null}));ami[_0xb74e('0x21')](_0xb74e('0x6b'),this['channels'][_0x507519['uniqueid']][_0x3f6384]);logger[_0xb74e('0x35')](_0xb74e('0x6c'),_0x507519[_0xb74e('0x26')],util[_0xb74e('0x28')]({'id':this['agents'][_0x507519['interface']]['id'],'destaccountcode':_0x507519[_0xb74e('0x6d')]},{'showHidden':![],'depth':null}));this[_0xb74e('0x21')](util['format'](_0xb74e('0x3a'),_0x507519[_0xb74e('0x27')]),_0xb74e('0x6e'),{'id':this['agents'][_0x507519[_0xb74e('0x2a')]]['id'],'destaccountcode':Number(_0x507519['destaccountcode'])});}}}}}}catch(_0x47cd31){logger[_0xb74e('0x3c')](_0xb74e('0x6f'),_0x507519[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x47cd31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x70')]=function(_0x386243){try{if(this[_0xb74e('0x23')](_0x386243)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x386243[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x386243,{'showHidden':![],'depth':null}));this[_0xb74e('0x71')](_0x386243['uniqueid'],_[_0xb74e('0x72')](_0x386243[_0xb74e('0x73')])[0x0],_0x386243[_0xb74e('0x74')]);if(this[_0xb74e('0xc')][_0x386243['uniqueid']]){for(var _0xb8c3e in this[_0xb74e('0xc')][_0x386243['uniqueid']]){if(this[_0xb74e('0xc')][_0x386243[_0xb74e('0x26')]]['hasOwnProperty'](_0xb8c3e)){logger[_0xb74e('0x25')](_0xb74e('0x75'),_0x386243['uniqueid'],_0xb8c3e,_[_0xb74e('0x72')](_0x386243[_0xb74e('0x73')])[0x0],_0x386243[_0xb74e('0x74')]);if(_[_0xb74e('0x29')](this[_0xb74e('0xc')][_0x386243['uniqueid']][_0xb8c3e][_0xb74e('0xf')])){this['channels'][_0x386243['uniqueid']][_0xb8c3e][_0xb74e('0xf')]={};}this[_0xb74e('0xc')][_0x386243[_0xb74e('0x26')]][_0xb8c3e]['variables']=this[_0xb74e('0xf')][_0x386243['uniqueid']];}}}}}catch(_0x1b4bc8){logger['error'](_0xb74e('0x76'),_0x386243[_0xb74e('0x26')],util['inspect'](_0x1b4bc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')]['addVariable']=function(_0x4a3a41,_0x4166c6,_0x3f0c6a){var _0x40bd80=[_0xb74e('0x77'),_0xb74e('0x78'),_0xb74e('0x79'),_0xb74e('0x7a'),_0xb74e('0x7b'),_0xb74e('0x7c'),'rtpaudioqosrtt',_0xb74e('0x7d'),'sipcallid',_0xb74e('0x7e'),_0xb74e('0x7f'),_0xb74e('0x80'),_0xb74e('0x81'),_0xb74e('0x82'),'memberinterface',_0xb74e('0x83'),_0xb74e('0x27'),'memberpenalty','memberrealtime'];if(!_[_0xb74e('0x84')](_0x4166c6)&&!_[_0xb74e('0x85')](_0x40bd80,_0x4166c6)){if(_[_0xb74e('0x29')](this[_0xb74e('0xf')][_0x4a3a41])){this['variables'][_0x4a3a41]={};}this[_0xb74e('0xf')][_0x4a3a41][_0x4166c6]=_0x3f0c6a;}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x1a')]=function(_0x263b1e){try{if(this[_0xb74e('0x23')](_0x263b1e)){logger[_0xb74e('0x35')]('[%s][voiceAgentReport][hangup]\x20event:',_0x263b1e[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x263b1e,{'showHidden':![],'depth':null}));if(this['channels'][_0x263b1e[_0xb74e('0x26')]]){for(var _0x27c73f in this['channels'][_0x263b1e['uniqueid']]){if(this[_0xb74e('0xc')][_0x263b1e[_0xb74e('0x26')]]['hasOwnProperty'](_0x27c73f)){if(this[_0xb74e('0xc')][_0x263b1e[_0xb74e('0x26')]][_0x27c73f][_0xb74e('0x54')]=='transfer'&&this['channels'][_0x263b1e[_0xb74e('0x26')]][_0x27c73f][_0xb74e('0x16')]){logger[_0xb74e('0x25')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x263b1e['uniqueid'],_0x27c73f);this[_0xb74e('0xc')][_0x263b1e['uniqueid']][_0x27c73f][_0xb74e('0x62')]=moment()[_0xb74e('0x2c')](_0xb74e('0x2d'));}}}logger[_0xb74e('0x35')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x263b1e[_0xb74e('0x26')],util[_0xb74e('0x28')](_[_0xb74e('0x86')](this[_0xb74e('0xc')][_0x263b1e['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xb74e('0x21')]('custom:voiceAgentReport',_[_0xb74e('0x86')](this[_0xb74e('0xc')][_0x263b1e[_0xb74e('0x26')]]));delete this[_0xb74e('0xc')][_0x263b1e[_0xb74e('0x26')]];}if(this[_0xb74e('0xf')][_0x263b1e[_0xb74e('0x26')]]){delete this['variables'][_0x263b1e['uniqueid']];}}}catch(_0x4b9e4e){logger[_0xb74e('0x3c')]('[%s][voiceAgentReport][hangup]',_0x263b1e[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x4b9e4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x1e')]=function(_0x35276d){try{if(this['isNotNull'](_0x35276d)){logger[_0xb74e('0x35')](_0xb74e('0x87'),_0x35276d['uniqueid'],util[_0xb74e('0x28')](_0x35276d,{'showHidden':![],'depth':null}));if(this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]]){for(var _0x542325 in this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]]){if(this['channels'][_0x35276d[_0xb74e('0x88')]]['hasOwnProperty'](_0x542325)){if(_0x35276d['origtransfereruniqueid']===_0x542325){logger[_0xb74e('0x25')](_0xb74e('0x89'),_0x35276d[_0xb74e('0x26')],this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]][_0x542325][_0xb74e('0x27')],_0x542325);var _0x2e194e=moment();this[_0xb74e('0xc')][_0x35276d['transfereeuniqueid']][_0x542325]['agentcomplete']=!![];this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]][_0x542325]['agentcompleteAt']=moment()[_0xb74e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]][_0x542325]['lastevent']=_0xb74e('0x8a');this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]][_0x542325][_0xb74e('0x54')]=_0xb74e('0x63');this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]][_0x542325][_0xb74e('0x65')]=_0x2e194e[_0xb74e('0x8b')](this['channels'][_0x35276d[_0xb74e('0x88')]][_0x542325][_0xb74e('0x40')],_0xb74e('0x8c'));}}}}if(this[_0xb74e('0xc')][_0x35276d['secondtransfereruniqueid']]){var _0x349295=this[_0xb74e('0xc')][_0x35276d['secondtransfereruniqueid']];this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x8d')]]=this[_0xb74e('0xc')][_0x35276d[_0xb74e('0x88')]];this['channels'][_0x35276d['transfereeuniqueid']]=_0x349295;}}}catch(_0x5d1c6a){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x35276d['uniqueid'],util['inspect'](_0x5d1c6a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x20')]=function(_0x2039c4){try{if(this['isNotNull'](_0x2039c4)){logger['debug'](_0xb74e('0x8e'),_0x2039c4['uniqueid'],util[_0xb74e('0x28')](_0x2039c4,{'showHidden':![],'depth':null}));if(this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]]){for(var _0x3e036c in this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]]){if(this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]]['hasOwnProperty'](_0x3e036c)){if(_0x2039c4['transfereruniqueid']===_0x3e036c){logger[_0xb74e('0x25')](_0xb74e('0x8f'),_0x2039c4[_0xb74e('0x26')],this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]][_0x3e036c][_0xb74e('0x27')],_0x3e036c);var _0x82445c=moment();this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]][_0x3e036c][_0xb74e('0x16')]=!![];this['channels'][_0x2039c4[_0xb74e('0x88')]][_0x3e036c]['agentcompleteAt']=_0x82445c;this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]][_0x3e036c][_0xb74e('0x46')]='complete';this['channels'][_0x2039c4[_0xb74e('0x88')]][_0x3e036c][_0xb74e('0x54')]=_0xb74e('0x63');this[_0xb74e('0xc')][_0x2039c4['transfereeuniqueid']][_0x3e036c][_0xb74e('0x65')]=_0x82445c[_0xb74e('0x8b')](this[_0xb74e('0xc')][_0x2039c4[_0xb74e('0x88')]][_0x3e036c][_0xb74e('0x40')],'seconds');}}}}}}catch(_0x2dfd3f){logger[_0xb74e('0x3c')](_0xb74e('0x90'),_0x2039c4[_0xb74e('0x26')],util[_0xb74e('0x28')](_0x2dfd3f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x1b')]=function(_0x4157bd){var _0x34ba8b='';try{if(this[_0xb74e('0x23')](_0x4157bd)){logger[_0xb74e('0x35')](_0xb74e('0x91'),_0x4157bd[_0xb74e('0x26')],util['inspect'](_0x4157bd,{'showHidden':![],'depth':null}));if(_0x4157bd[_0xb74e('0x92')]){_0x34ba8b=_0x4157bd['channel'][_0xb74e('0x93')](0x0,_0x4157bd[_0xb74e('0x92')]['lastIndexOf']('-'));if(this[_0xb74e('0xe')][_0x34ba8b]){logger[_0xb74e('0x25')](_0xb74e('0x94'),_0x4157bd[_0xb74e('0x26')],_0x34ba8b);this['agents'][_0x34ba8b]['onhold']=!![];}}}}catch(_0x749b20){logger[_0xb74e('0x3c')](_0xb74e('0x95'),_0x4157bd[_0xb74e('0x26')],util['inspect'](_0x749b20,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb74e('0x22')][_0xb74e('0x1d')]=function(_0xf90c9d){var _0x312a34='';try{if(this[_0xb74e('0x23')](_0xf90c9d)){logger[_0xb74e('0x35')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0xf90c9d[_0xb74e('0x26')],util[_0xb74e('0x28')](_0xf90c9d,{'showHidden':![],'depth':null}));if(_0xf90c9d[_0xb74e('0x92')]){_0x312a34=_0xf90c9d[_0xb74e('0x92')][_0xb74e('0x93')](0x0,_0xf90c9d[_0xb74e('0x92')][_0xb74e('0x96')]('-'));if(this[_0xb74e('0xe')][_0x312a34]){logger[_0xb74e('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0xf90c9d[_0xb74e('0x26')],_0x312a34);this[_0xb74e('0xe')][_0x312a34][_0xb74e('0x97')]=![];}}}}catch(_0x3a5a1b){logger[_0xb74e('0x3c')](_0xb74e('0x98'),_0xf90c9d[_0xb74e('0x26')],util['inspect'](_0x3a5a1b,{'showHidden':![],'depth':null}));}};module[_0xb74e('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 871cf75..cab59e2 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 _0x24a9=['info','exten','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','pick','context','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','match','type','isNil','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','starttime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newstate','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','from-sip','split','channel','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','debug','OutgoingSpoolFailed'];(function(_0xfce7f9,_0x974a8c){var _0x3da362=function(_0x598e9d){while(--_0x598e9d){_0xfce7f9['push'](_0xfce7f9['shift']());}};_0x3da362(++_0x974a8c);}(_0x24a9,0x85));var _0x924a=function(_0xc3cb3b,_0x43b9ad){_0xc3cb3b=_0xc3cb3b-0x0;var _0x33b4a1=_0x24a9[_0xc3cb3b];return _0x33b4a1;};'use strict';var _=require('lodash');var moment=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var path=require(_0x924a('0x2'));var Redis=require(_0x924a('0x3'));var config=require(_0x924a('0x4'));var logger=require(_0x924a('0x5'))('ami');var ami=require('../ami');var Channel=require(_0x924a('0x6'));var RpcSetting=require(_0x924a('0x7'));var applications=[_0x924a('0x8'),_0x924a('0x9'),'agi',_0x924a('0xa'),_0x924a('0xb'),_0x924a('0xc')];var dispositions=[_0x924a('0xd'),_0x924a('0xe'),_0x924a('0xe'),'NO\x20ANSWER',_0x924a('0xd'),_0x924a('0xd'),_0x924a('0xf'),_0x924a('0x10'),_0x924a('0xe'),_0x924a('0xe'),_0x924a('0xe')];config[_0x924a('0x11')]=_[_0x924a('0x12')](config[_0x924a('0x11')],{'host':_0x924a('0x13'),'port':0x18eb});var io=require(_0x924a('0x14'))(new Redis(config[_0x924a('0x11')]));function VoiceCallReport(_0x4ecdb7){this['channels']=_0x4ecdb7[_0x924a('0x15')];this[_0x924a('0x16')]=_0x4ecdb7[_0x924a('0x16')];this[_0x924a('0x17')]={};ami['on']('coreshowchannel',this[_0x924a('0x18')][_0x924a('0x19')](this));ami['on']('newexten',this[_0x924a('0x18')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0x924a('0x19')](this));ami['on'](_0x924a('0x1a'),this['syncNewState'][_0x924a('0x19')](this));ami['on'](_0x924a('0x1b'),this['syncVarSet']['bind'](this));ami['on'](_0x924a('0x1c'),this[_0x924a('0x1d')]['bind'](this));ami['on'](_0x924a('0x1e'),this[_0x924a('0x1f')]['bind'](this));ami['on'](_0x924a('0x20'),this[_0x924a('0x21')][_0x924a('0x19')](this));ami['on'](_0x924a('0x22'),this['syncBlindTransfer'][_0x924a('0x19')](this));ami['on']('musiconholdstart',this[_0x924a('0x23')][_0x924a('0x19')](this));ami['on'](_0x924a('0x24'),this[_0x924a('0x25')]['bind'](this));try{logger['info'](_0x924a('0x26'));ami['actionCoreShowChannels']();}catch(_0xf7404a){logger['error'](_0x924a('0x27'),util[_0x924a('0x28')](_0xf7404a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x924a('0x29')]['isNotNull']=function(_0x1cea5c){return _0x1cea5c!==null&&!_[_0x924a('0x2a')](_0x1cea5c);};VoiceCallReport[_0x924a('0x29')][_0x924a('0x2b')]=function(_0x32a79e,_0x3efe91,_0x4c106d){io['to'](_0x32a79e)[_0x924a('0x2b')](_0x3efe91,_0x4c106d);};VoiceCallReport[_0x924a('0x29')]['syncNewCallerId']=function(_0x13dfca){try{if(this[_0x924a('0x2c')](_0x13dfca)){logger['info'](_0x924a('0x2d'),_0x13dfca['uniqueid'],_0x13dfca[_0x924a('0x2e')],_0x13dfca['calleridnum']);logger['debug'](_0x924a('0x2f'),_0x13dfca[_0x924a('0x30')],util['inspect'](_0x13dfca,{'showHidden':![],'depth':null}));if(_0x13dfca[_0x924a('0x30')]===_0x13dfca[_0x924a('0x31')]){if(!_[_0x924a('0x2a')](this[_0x924a('0x15')][_0x13dfca['uniqueid']])){_[_0x924a('0x32')](this[_0x924a('0x15')][_0x13dfca['uniqueid']],_['pick'](_0x13dfca,_[_0x924a('0x33')](this[_0x924a('0x15')][_0x13dfca['uniqueid']])));}}if(_0x13dfca['context']===_0x924a('0x34')){if(this[_0x924a('0x16')][_0x13dfca['channel'][_0x924a('0x35')]('-')[0x0]]){if(_0x13dfca['exten']=='xcally-motion-preview'){this[_0x924a('0x16')][_0x13dfca[_0x924a('0x36')]['split']('-')[0x0]][_0x924a('0x37')]=_0x13dfca[_0x924a('0x38')];this['emit'](util[_0x924a('0x39')](_0x924a('0x3a'),this[_0x924a('0x16')][_0x13dfca['channel'][_0x924a('0x35')]('-')[0x0]]['name']),_0x924a('0x3b'),{'destaccountcode':this['agents'][_0x13dfca['channel'][_0x924a('0x35')]('-')[0x0]][_0x924a('0x3c')],'destconnectedlinenum':_0x13dfca['connectedlinenum']});}}}}}catch(_0x18cc3b){logger[_0x924a('0x3d')](_0x924a('0x3e'),_0x13dfca[_0x924a('0x30')],util[_0x924a('0x28')](_0x18cc3b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x1b1e3b){try{if(this[_0x924a('0x2c')](_0x1b1e3b)){logger[_0x924a('0x3f')]('[%s][voiceCallReport][newchannel]\x20event:',_0x1b1e3b[_0x924a('0x30')],util['inspect'](_0x1b1e3b,{'showHidden':![],'depth':null}));if(this[_0x924a('0x15')][_0x1b1e3b[_0x924a('0x30')]]){return;}if(_0x1b1e3b[_0x924a('0x36')]===_0x924a('0x40')){return;}if(_0x1b1e3b[_0x924a('0x30')]!==_0x1b1e3b[_0x924a('0x31')]&&!this[_0x924a('0x17')][_0x1b1e3b['linkedid']]){return;}logger[_0x924a('0x41')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1b1e3b['uniqueid'],_0x1b1e3b['context'],_0x1b1e3b[_0x924a('0x42')]);this[_0x924a('0x15')][_0x1b1e3b[_0x924a('0x30')]]=new Channel();this[_0x924a('0x15')][_0x1b1e3b[_0x924a('0x30')]]['starttime']=moment()[_0x924a('0x39')](_0x924a('0x43'));this['channels'][_0x1b1e3b[_0x924a('0x30')]][_0x924a('0x44')]=dispositions[_[_0x924a('0x45')](_0x1b1e3b['channelstate'])];_['merge'](this[_0x924a('0x15')][_0x1b1e3b[_0x924a('0x30')]],_[_0x924a('0x46')](_0x1b1e3b,_[_0x924a('0x33')](this[_0x924a('0x15')][_0x1b1e3b[_0x924a('0x30')]])));if(_0x1b1e3b[_0x924a('0x47')]===_0x924a('0x34')){var _0x4eeb7a=this[_0x924a('0x16')][_0x1b1e3b[_0x924a('0x36')]['split']('-')[0x0]];if(_0x4eeb7a&&typeof _0x4eeb7a[_0x924a('0x37')]==='undefined'){_0x4eeb7a[_0x924a('0x37')]=_0x1b1e3b[_0x924a('0x42')];logger[_0x924a('0x3f')](_0x924a('0x48'),_0x1b1e3b['uniqueid'],util['inspect']({'id':_0x4eeb7a['id'],'destaccountcode':_0x4eeb7a[_0x924a('0x3c')],'destconnectedlinenum':_0x1b1e3b[_0x924a('0x42')]},{'showHidden':![],'depth':null}));this[_0x924a('0x2b')](util['format'](_0x924a('0x3a'),_0x4eeb7a[_0x924a('0x49')]),_0x924a('0x3b'),{'id':_0x4eeb7a['id'],'destaccountcode':_0x4eeb7a['accountcode'],'destconnectedlinenum':_0x1b1e3b['exten']});}}}}catch(_0x253966){logger[_0x924a('0x3d')](_0x924a('0x4a'),_0x1b1e3b['uniqueid'],util[_0x924a('0x28')](_0x253966,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x924a('0x18')]=function(_0x4f4b3b){try{if(this[_0x924a('0x2c')](_0x4f4b3b)){logger[_0x924a('0x3f')](_0x924a('0x4b'),_0x4f4b3b[_0x924a('0x30')],util[_0x924a('0x28')](_0x4f4b3b,{'showHidden':![],'depth':null}));if(_0x4f4b3b[_0x924a('0x36')]===_0x924a('0x40')||_0x4f4b3b['exten']==='h')return;if(_0x4f4b3b[_0x924a('0x30')]===_0x4f4b3b[_0x924a('0x31')]||this['blindTransfers'][_0x4f4b3b[_0x924a('0x31')]]){_0x4f4b3b[_0x924a('0x4c')]=_0x4f4b3b[_0x924a('0x4c')]?_0x4f4b3b['application'][_0x924a('0x4d')]():undefined;_0x4f4b3b[_0x924a('0x4e')]=_0x4f4b3b[_0x924a('0x4f')]||_0x4f4b3b[_0x924a('0x4e')];if(_0x4f4b3b['appdata']&&!_0x4f4b3b[_0x924a('0x4f')]['startsWith'](_0x924a('0x50'))&&_0x4f4b3b['application']!=='queue'){_0x4f4b3b[_0x924a('0x4e')]=_0x4f4b3b[_0x924a('0x4e')]['toLowerCase']();}logger[_0x924a('0x41')](_0x924a('0x51'),_0x4f4b3b[_0x924a('0x30')],_0x4f4b3b[_0x924a('0x4c')],_0x4f4b3b[_0x924a('0x4e')]);if(_[_0x924a('0x2a')](this[_0x924a('0x15')][_0x4f4b3b['uniqueid']])){this['channels'][_0x4f4b3b[_0x924a('0x30')]]=new Channel();this[_0x924a('0x15')][_0x4f4b3b['uniqueid']]['starttime']=_0x4f4b3b[_0x924a('0x52')]?moment()['subtract'](moment[_0x924a('0x52')](_0x4f4b3b[_0x924a('0x52')])[_0x924a('0x53')](),_0x924a('0x53'))['format'](_0x924a('0x43')):moment()[_0x924a('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x924a('0x15')][_0x4f4b3b[_0x924a('0x30')]][_0x924a('0x44')]=_0x924a('0xd');}_['merge'](this['channels'][_0x4f4b3b['uniqueid']],_['pick'](_0x4f4b3b,_['keys'](this[_0x924a('0x15')][_0x4f4b3b['uniqueid']])));if(_[_0x924a('0x54')](applications,_0x4f4b3b['application'])){this[_0x924a('0x15')][_0x4f4b3b['uniqueid']][_0x924a('0x55')]=_0x4f4b3b[_0x924a('0x4c')];this[_0x924a('0x15')][_0x4f4b3b[_0x924a('0x30')]][_0x924a('0x56')]=_0x4f4b3b['applicationdata'];if(_0x4f4b3b[_0x924a('0x4c')]==='set'&&_[_0x924a('0x57')](_0x4f4b3b[_0x924a('0x4e')][_0x924a('0x4d')](),'cdr(')){var _0x2a552c=_0x4f4b3b[_0x924a('0x4e')]['split']('=');var _0x4efcfd=_0x2a552c[0x0]['toLowerCase']()[_0x924a('0x58')](/cdr\((.*)\)/);if(_0x4efcfd){if(_0x4efcfd[0x1]===_0x924a('0x59')&&!_[_0x924a('0x5a')](this[_0x924a('0x15')][_0x4f4b3b[_0x924a('0x30')]][_0x4efcfd[0x1]]))return;this[_0x924a('0x15')][_0x4f4b3b[_0x924a('0x30')]][_0x4efcfd[0x1]]=_0x2a552c[0x1];}}else if(_0x4f4b3b[_0x924a('0x4c')]===_0x924a('0x9')){this['channels'][_0x4f4b3b[_0x924a('0x30')]]['queue']=_0x4f4b3b['applicationdata']['split'](',')[0x0];}}}}}catch(_0x5d5ab0){logger[_0x924a('0x3d')]('[%s][voiceCallReport][newexten]',_0x4f4b3b[_0x924a('0x30')],util[_0x924a('0x28')](_0x5d5ab0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x924a('0x29')][_0x924a('0x5b')]=function(_0x557a1a){try{if(this['isNotNull'](_0x557a1a)){logger[_0x924a('0x41')](_0x924a('0x5c'),_0x557a1a['uniqueid'],_0x557a1a[_0x924a('0x31')],_0x557a1a[_0x924a('0x2e')],_0x557a1a[_0x924a('0x5d')]);logger[_0x924a('0x3f')](_0x924a('0x5e'),_0x557a1a[_0x924a('0x30')],util['inspect'](_0x557a1a,{'showHidden':![],'depth':null}));if(_0x557a1a[_0x924a('0x5f')]!=='6')return;var _0x534862=this[_0x924a('0x16')][_0x557a1a[_0x924a('0x36')][_0x924a('0x35')]('-')[0x0]];if(_0x557a1a[_0x924a('0x30')]!==_0x557a1a[_0x924a('0x31')]){var _0x451abb=moment();if(this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]]){if(!this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x60')]){this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x60')]=!![];this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x61')]=_0x451abb[_0x924a('0x39')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x924a('0x15')][_0x557a1a['linkedid']][_0x924a('0x62')]){this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x63')]=_0x451abb[_0x924a('0x64')](this['channels'][_0x557a1a[_0x924a('0x31')]][_0x924a('0x62')],_0x924a('0x53'));}}this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x31')]=_0x557a1a[_0x924a('0x30')];if(_0x557a1a[_0x924a('0x5d')]!==_0x924a('0x65')){this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x38')]=_0x557a1a['calleridnum'];}this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x66')]=_0x557a1a[_0x924a('0x2e')];this['channels'][_0x557a1a[_0x924a('0x31')]][_0x924a('0x67')]=_0x557a1a[_0x924a('0x36')];this[_0x924a('0x15')][_0x557a1a['linkedid']][_0x924a('0x44')]=dispositions[_[_0x924a('0x45')](_0x557a1a[_0x924a('0x5f')])];if(_0x534862){this['channels'][_0x557a1a[_0x924a('0x31')]][_0x924a('0x68')]=_0x534862['id'];this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x69')]=_0x534862[_0x924a('0x49')];}}if(this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]]){if(!this['channels'][_0x557a1a[_0x924a('0x30')]]['answered']){this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]][_0x924a('0x60')]=!![];this['channels'][_0x557a1a[_0x924a('0x30')]][_0x924a('0x61')]=_0x451abb[_0x924a('0x39')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]][_0x924a('0x62')]){this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]][_0x924a('0x63')]=_0x451abb[_0x924a('0x64')](this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]][_0x924a('0x62')],'seconds');}}if(_0x557a1a[_0x924a('0x5d')]!==_0x924a('0x65')){this['channels'][_0x557a1a[_0x924a('0x30')]][_0x924a('0x38')]=_0x557a1a[_0x924a('0x5d')];}this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]]['connectedlinename']=_0x557a1a['calleridname'];this[_0x924a('0x15')][_0x557a1a['uniqueid']]['destinationchannel']=_0x557a1a[_0x924a('0x36')];this[_0x924a('0x15')][_0x557a1a['uniqueid']]['disposition']=dispositions[_[_0x924a('0x45')](_0x557a1a['channelstate'])];}}else{if(this[_0x924a('0x15')][_0x557a1a['uniqueid']]){if(_0x534862){this[_0x924a('0x15')][_0x557a1a['uniqueid']]['UserId']=_0x534862['id'];this['channels'][_0x557a1a[_0x924a('0x30')]][_0x924a('0x69')]=_0x534862[_0x924a('0x49')];}}}if(_0x557a1a[_0x924a('0x47')]==='from-sip'){if(_0x534862){_0x534862[_0x924a('0x37')]=_0x557a1a[_0x924a('0x42')];var _0x20684f,_0x22e2fc;if(this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]]){_0x20684f=this[_0x924a('0x15')][_0x557a1a['uniqueid']][_0x924a('0x6a')];_0x22e2fc=this[_0x924a('0x15')][_0x557a1a[_0x924a('0x30')]]['queue'];}else if(this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]]){_0x20684f=this[_0x924a('0x15')][_0x557a1a[_0x924a('0x31')]][_0x924a('0x6a')];_0x22e2fc=this[_0x924a('0x15')][_0x557a1a['linkedid']]['queue'];}_0x534862[_0x924a('0x9')]=_0x22e2fc;_0x534862[_0x924a('0x6a')]=_0x20684f;var _0x492cac={'id':_0x534862['id'],'name':_0x534862['name'],'agentconnected':!![],'destaccountcode':_0x534862[_0x924a('0x3c')],'destconnectedlinenum':_0x557a1a[_0x924a('0x42')],'queue':_0x22e2fc||undefined,'routealias':_0x20684f,'uniqueid':_0x557a1a['linkedid']};logger[_0x924a('0x3f')](_0x924a('0x6b'),_0x557a1a[_0x924a('0x30')],util['inspect'](_0x492cac,{'showHidden':![],'depth':null}));this[_0x924a('0x2b')](util[_0x924a('0x39')](_0x924a('0x3a'),_0x534862[_0x924a('0x49')]),_0x924a('0x3b'),_0x492cac);}}}}catch(_0xa0adf9){logger[_0x924a('0x3d')](_0x924a('0x6c'),_0x557a1a[_0x924a('0x30')],util[_0x924a('0x28')](_0xa0adf9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x924a('0x29')][_0x924a('0x6d')]=function(_0x478a4c,_0x8f18c7){try{if(this[_0x924a('0x15')][_0x478a4c]){logger[_0x924a('0x41')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x478a4c,_0x8f18c7);this[_0x924a('0x15')][_0x478a4c][_0x924a('0x6e')]=!![];if(_[_0x924a('0x6f')](_0x8f18c7,'.wav49')){_0x8f18c7=_0x8f18c7[_0x924a('0x70')](_0x924a('0x71'),_0x924a('0x72'));}this[_0x924a('0x15')][_0x478a4c]['monitorFilename']=_0x8f18c7;var _0x2ba92e=_[_0x924a('0x73')](this[_0x924a('0x15')][_0x478a4c]['monitors'],{'filename':_0x8f18c7});if(_['isNil'](_0x2ba92e)){this[_0x924a('0x15')][_0x478a4c][_0x924a('0x74')]['push']({'filename':_0x8f18c7,'createdAt':moment()[_0x924a('0x39')](_0x924a('0x43')),'mixmonitorid':'','status':_0x924a('0x75')});}}}catch(_0x2e7fa7){logger[_0x924a('0x3d')](_0x924a('0x76'),_0x478a4c,util[_0x924a('0x28')](_0x2e7fa7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x924a('0x29')][_0x924a('0x77')]=function(_0x5dac09){try{if(this['isNotNull'](_0x5dac09)){logger[_0x924a('0x3f')](_0x924a('0x78'),_0x5dac09[_0x924a('0x30')],util[_0x924a('0x28')](_0x5dac09,{'showHidden':![],'depth':null}));if(this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]]&&_0x5dac09[_0x924a('0x36')]!=_0x924a('0x40')){if(this['isNotNull'](_0x5dac09[_0x924a('0x79')])){if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x7a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this[_0x924a('0x6d')](_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x7c')])){logger[_0x924a('0x41')](_0x924a('0x7d'),_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this['channels'][_0x5dac09[_0x924a('0x30')]][_0x924a('0x5d')]=_0x5dac09['value'];}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x7e')])){logger[_0x924a('0x41')](_0x924a('0x7f'),_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this['channels'][_0x5dac09[_0x924a('0x30')]][_0x924a('0x80')]=_0x5dac09[_0x924a('0x7b')];}else if(this['isNotNull'](_0x5dac09[_0x924a('0x79')][_0x924a('0x81')])){logger[_0x924a('0x41')](_0x924a('0x82'),_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]][_0x924a('0x59')]=_0x5dac09[_0x924a('0x7b')];}else if(this['isNotNull'](_0x5dac09[_0x924a('0x79')][_0x924a('0x83')])){logger['info'](_0x924a('0x84'),_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]['split'](',')[0x0]);this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]][_0x924a('0x9')]=_0x5dac09['value'][_0x924a('0x35')](',')[0x0];}else if(this['isNotNull'](_0x5dac09[_0x924a('0x79')][_0x924a('0x85')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]][_0x924a('0x86')]=_0x5dac09[_0x924a('0x7b')];}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')]['xmd-destination'])){logger[_0x924a('0x41')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this[_0x924a('0x15')][_0x5dac09['uniqueid']][_0x924a('0x87')]=_0x5dac09[_0x924a('0x7b')];}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x88')])){logger[_0x924a('0x41')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5dac09[_0x924a('0x30')],_0x5dac09['value']);this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]][_0x924a('0x89')]=_0x5dac09[_0x924a('0x7b')];}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x8a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5dac09[_0x924a('0x30')],_0x5dac09[_0x924a('0x7b')]);this['channels'][_0x5dac09[_0x924a('0x30')]][_0x924a('0x9')]=_0x5dac09[_0x924a('0x7b')];}else if(this[_0x924a('0x2c')](_0x5dac09['variable']['sipcallid'])){logger[_0x924a('0x41')](_0x924a('0x8b'),_0x5dac09[_0x924a('0x30')],_0x5dac09['value']);this[_0x924a('0x15')][_0x5dac09[_0x924a('0x30')]][_0x924a('0x8c')]=_0x5dac09['value'];}}}else if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')]['mixmonitor_filename'])){if(_0x5dac09['value']){var _0x5d8fbe=path['parse'](_0x5dac09[_0x924a('0x7b')])[_0x924a('0x49')];logger[_0x924a('0x41')](_0x924a('0x8d'),_0x5d8fbe,_0x5dac09[_0x924a('0x7b')]);this['syncMixMonitorFilename'](_0x5d8fbe,_0x5dac09['value']);}}else if(this[_0x924a('0x15')][_0x5dac09[_0x924a('0x31')]]){if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')])){if(this[_0x924a('0x2c')](_0x5dac09[_0x924a('0x79')][_0x924a('0x8e')])){logger['info'](_0x924a('0x8b'),_0x5dac09[_0x924a('0x31')],_0x5dac09['value']);this['channels'][_0x5dac09[_0x924a('0x31')]][_0x924a('0x8f')]=_0x5dac09[_0x924a('0x7b')];}}}}}catch(_0x207e0e){logger['error'](_0x924a('0x90'),_0x5dac09[_0x924a('0x30')],util['inspect'](_0x207e0e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x924a('0x29')]['syncHangup']=function(_0x45f4af){try{if(this[_0x924a('0x2c')](_0x45f4af)){logger[_0x924a('0x3f')](_0x924a('0x91'),_0x45f4af['uniqueid'],util['inspect'](_0x45f4af,{'showHidden':![],'depth':null}));if(this[_0x924a('0x17')][_0x45f4af['linkedid']]){if(this[_0x924a('0x15')][this['blindTransfers'][_0x45f4af['linkedid']][_0x924a('0x31')]]){this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]][_0x924a('0x30')]=_0x45f4af[_0x924a('0x30')];this[_0x924a('0x15')][this['blindTransfers'][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]][_0x924a('0x60')]=this['channels'][_0x45f4af[_0x924a('0x30')]][_0x924a('0x60')];this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]][_0x924a('0x61')]=this['channels'][_0x45f4af[_0x924a('0x30')]][_0x924a('0x61')];this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]]['destinationchannel']=this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]]['linkedid']]['channel'];this['channels'][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]][_0x924a('0x44')]=this[_0x924a('0x15')][_0x45f4af['uniqueid']][_0x924a('0x44')];this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]]=this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af['linkedid']][_0x924a('0x31')]];delete this[_0x924a('0x15')][this['blindTransfers'][_0x45f4af[_0x924a('0x31')]][_0x924a('0x31')]];}else if(this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]]){this[_0x924a('0x15')][this['blindTransfers'][_0x45f4af['linkedid']][_0x924a('0x30')]][_0x924a('0x30')]=[this[_0x924a('0x15')][this['blindTransfers'][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]]['linkedid'],this['channels'][this[_0x924a('0x17')][_0x45f4af['linkedid']][_0x924a('0x30')]]['linkedid']=this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]][_0x924a('0x30')]][0x0];this['channels'][this['blindTransfers'][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]][_0x924a('0x60')]=this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x60')];this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]][_0x924a('0x61')]=this['channels'][_0x45f4af['uniqueid']][_0x924a('0x61')];this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]]['uniqueid']][_0x924a('0x67')]=this['channels'][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]]['uniqueid']][_0x924a('0x36')];this['channels'][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]]['uniqueid']][_0x924a('0x44')]=this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x44')];this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]]=this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af[_0x924a('0x31')]][_0x924a('0x30')]];delete this[_0x924a('0x15')][this[_0x924a('0x17')][_0x45f4af['linkedid']]['uniqueid']];}}if(this[_0x924a('0x15')][_0x45f4af['uniqueid']]){logger[_0x924a('0x41')](_0x924a('0x92'),_0x45f4af[_0x924a('0x30')],_0x45f4af[_0x924a('0x93')]);var _0xf7c4b2=moment();this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x94')]=_0xf7c4b2['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x924a('0x15')][_0x45f4af['uniqueid']]['duration']=_0xf7c4b2[_0x924a('0x64')](this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]]['starttime'],_0x924a('0x53'));if(this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x60')]){this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x95')]=_0xf7c4b2[_0x924a('0x64')](this['channels'][_0x45f4af[_0x924a('0x30')]][_0x924a('0x61')],_0x924a('0x53'));this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x63')]=this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x52')]-this[_0x924a('0x15')][_0x45f4af[_0x924a('0x30')]][_0x924a('0x95')];}if(_0x45f4af[_0x924a('0x47')]===_0x924a('0x34')){if(this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')]['split']('-')[0x0]]){this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')]['split']('-')[0x0]]=_[_0x924a('0x96')](this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')]['split']('-')[0x0]],[_0x924a('0x37')]);logger[_0x924a('0x3f')](_0x924a('0x97'),_0x45f4af[_0x924a('0x30')],util[_0x924a('0x28')]({'id':this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')][_0x924a('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x45f4af[_0x924a('0x36')]['split']('-')[0x0]][_0x924a('0x3c')]},{'showHidden':![],'depth':null}));this[_0x924a('0x2b')](util[_0x924a('0x39')]('user:%s',this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')][_0x924a('0x35')]('-')[0x0]][_0x924a('0x49')]),_0x924a('0x98'),{'id':this[_0x924a('0x16')][_0x45f4af[_0x924a('0x36')][_0x924a('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x45f4af[_0x924a('0x36')][_0x924a('0x35')]('-')[0x0]]['accountcode']});for(var _0x5a804c=0x0;_0x5a804c0x0?!![]:![];if(!_0xc99d69){return this[_0xf003('0x17')](this[_0xf003('0x47')][_0xf003('0x6d')]);}};VoiceQueueReport['prototype'][_0xf003('0x1a')]=function(_0x3d7741){var _0x4beef7=this[_0xf003('0x47')]['id'];if(this[_0xf003('0x47')]['queuestatus'][_0x4beef7]&&this[_0xf003('0x47')][_0xf003('0x69')][_0x4beef7][_0x3d7741[_0xf003('0x62')]]){this[_0xf003('0x47')]['queuestatus'][_0x4beef7][_0x3d7741[_0xf003('0x62')]]['agents'][_0xf003('0x6e')](_0x3d7741);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x340bd2){var _0x4b070b=this;try{if(this[_0xf003('0x6f')](_0x340bd2)&&this[_0xf003('0x6f')](_0x340bd2[_0xf003('0x4e')])){logger[_0xf003('0x4a')](_0xf003('0x70'),util['inspect'](_0x340bd2,{'showHidden':![],'depth':null}));var _0x574386=this[_0xf003('0x12')][_0x340bd2[_0xf003('0x4e')]];if(_0x574386){logger[_0xf003('0x71')](_0xf003('0x72'),_0x574386['name']);this[_0xf003('0x47')][_0xf003('0x5e')][_0x574386[_0xf003('0x5b')]]={'summaryEvent':_0x340bd2};this[_0xf003('0x47')]['statusRequests']+=0x1;return ami[_0xf003('0x5d')]({'action':_0xf003('0x69'),'queue':_0x574386[_0xf003('0x5b')]})[_0xf003('0x61')](function(_0x59e89e){if(!_0x4b070b['summary'][_0xf003('0x69')][_0x340bd2[_0xf003('0x62')]]){_0x4b070b[_0xf003('0x47')][_0xf003('0x69')][_0x340bd2[_0xf003('0x62')]]={};}_0x4b070b['summary'][_0xf003('0x69')][_0x340bd2[_0xf003('0x62')]][_0x59e89e[_0xf003('0x62')]]={'queue':_0x574386[_0xf003('0x5b')],'agents':[]};})[_0xf003('0x3f')](function(_0xddd71){throw _0xddd71;});}}}catch(_0x338c98){logger[_0xf003('0x44')](_0xf003('0x63'),util[_0xf003('0x43')](_0x338c98,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf003('0x17')]=function(_0x21b6d4){if(this['summary']['statusRequests']>0x0){this[_0xf003('0x47')]['completeEvent']=_0x21b6d4;return;}logger['debug'](_0xf003('0x73'),util[_0xf003('0x43')](_0x21b6d4,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0xf003('0x74'),{});};VoiceQueueReport[_0xf003('0x39')][_0xf003('0x1d')]=function(_0x5c79bf){try{if(this[_0xf003('0x6f')](_0x5c79bf)){logger[_0xf003('0x4a')](_0xf003('0x75'),_0x5c79bf[_0xf003('0x53')],util[_0xf003('0x43')](_0x5c79bf,{'showHidden':![],'depth':null}));if(_[_0xf003('0x76')](this[_0xf003('0xd')][_0x5c79bf[_0xf003('0x53')]])){this[_0xf003('0xd')][_0x5c79bf[_0xf003('0x53')]]=[];}if(_[_0xf003('0x76')](this[_0xf003('0x10')][_0x5c79bf[_0xf003('0x53')]])){this[_0xf003('0x10')][_0x5c79bf['uniqueid']]={};}var _0x22b846=new QueueReport();_0x22b846[_0xf003('0x4e')]=_0x5c79bf[_0xf003('0x4e')];_0x22b846[_0xf003('0x57')]=this[_0xf003('0x12')][_0x22b846[_0xf003('0x4e')]]&&this['voiceQueues'][_0x22b846[_0xf003('0x4e')]][_0xf003('0x57')]?this[_0xf003('0x12')][_0x22b846['queue']][_0xf003('0x57')]||_0xf003('0x58'):_0xf003('0x58');_0x22b846[_0xf003('0x77')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));_0x22b846['position']=_0x5c79bf[_0xf003('0x79')];_0x22b846[_0xf003('0x7a')]=_0x5c79bf['count'];_0x22b846[_0xf003('0x53')]=_0x5c79bf[_0xf003('0x53')];_0x22b846['routealias']=this['channels'][_0x5c79bf[_0xf003('0x53')]][_0xf003('0x7b')];logger[_0xf003('0x71')](_0xf003('0x7c'),_0x22b846[_0xf003('0x4e')],_0x22b846['type']);_[_0xf003('0x7d')](_0x22b846,_[_0xf003('0x7e')](_0x5c79bf,_['keys'](_0x22b846)));this[_0xf003('0xd')][_0x5c79bf[_0xf003('0x53')]][_0xf003('0x6e')](_0x22b846);this[_0xf003('0x10')][_0x5c79bf[_0xf003('0x53')]]=_0x22b846;this[_0xf003('0x49')](_0x22b846,_0xf003('0x1c'));}}catch(_0x1d36e5){logger[_0xf003('0x44')](_0xf003('0x75'),_0x5c79bf[_0xf003('0x53')],util[_0xf003('0x43')](_0x1d36e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf003('0x39')]['syncQueueCallerAbandon']=function(_0x2dbf52){try{if(this[_0xf003('0x6f')](_0x2dbf52)){logger[_0xf003('0x4a')](_0xf003('0x7f'),_0x2dbf52[_0xf003('0x53')],util[_0xf003('0x43')](_0x2dbf52,{'showHidden':![],'depth':null}));if(this[_0xf003('0xd')][_0x2dbf52['uniqueid']]){var _0x54e2e3=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x2dbf52[_0xf003('0x53')]]);_0x54e2e3[_0xf003('0x81')]=![];_0x54e2e3[_0xf003('0x82')]=null;_0x54e2e3['holdtime']=_0x2dbf52[_0xf003('0x83')];_0x54e2e3[_0xf003('0x84')]=_0x2dbf52[_0xf003('0x84')];_0x54e2e3[_0xf003('0x1e')]=!![];_0x54e2e3[_0xf003('0x85')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));_0x54e2e3[_0xf003('0x54')]='ABANDONED';_0x54e2e3[_0xf003('0x86')]=null;logger[_0xf003('0x71')](_0xf003('0x87'),_0x54e2e3[_0xf003('0x4e')],_0x54e2e3['type']);this[_0xf003('0x10')][_0x2dbf52[_0xf003('0x53')]]=_0x54e2e3;this[_0xf003('0x51')](_0x54e2e3,_0xf003('0x1e'));}}}catch(_0x2051bf){logger['error'](_0xf003('0x7f'),_0x2dbf52['uniqueid'],util[_0xf003('0x43')](_0x2051bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf003('0x21')]=function(_0x1d7453){try{if(this[_0xf003('0x6f')](_0x1d7453)){logger[_0xf003('0x4a')](_0xf003('0x88'),_0x1d7453[_0xf003('0x53')],util[_0xf003('0x43')](_0x1d7453,{'showHidden':![],'depth':null}));if(this[_0xf003('0xd')][_0x1d7453['uniqueid']]){var _0x27aa5b=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x1d7453['uniqueid']]);_0x27aa5b[_0xf003('0x89')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));_0x27aa5b[_0xf003('0x8a')]=_0x1d7453['connectedlinenum'];_0x27aa5b['connectedlinename']=_0x1d7453[_0xf003('0x8b')];logger[_0xf003('0x71')](_0xf003('0x8c'),_0x27aa5b[_0xf003('0x4e')],_0x27aa5b[_0xf003('0x57')],_0x1d7453[_0xf003('0x8a')],_0x1d7453[_0xf003('0x8b')]);this['channels'][_0x1d7453[_0xf003('0x53')]]=_0x27aa5b;this['emitVoiceQueueChannelSave'](_0x27aa5b,_0xf003('0x20'));}}}catch(_0xf55831){logger[_0xf003('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x1d7453[_0xf003('0x53')],util[_0xf003('0x43')](_0xf55831,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf003('0x25')]=function(_0x1481a2){try{if(this['isNotNull'](_0x1481a2)){logger['debug'](_0xf003('0x8d'),_0x1481a2[_0xf003('0x53')],util[_0xf003('0x43')](_0x1481a2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1481a2[_0xf003('0x53')]]){var _0x2b44b5=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x1481a2[_0xf003('0x53')]]);_0x2b44b5[_0xf003('0x81')]=!![];_0x2b44b5[_0xf003('0x54')]='COMPLETEDBYAGENT';logger[_0xf003('0x71')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2b44b5[_0xf003('0x4e')],_0x2b44b5[_0xf003('0x57')]);}}}catch(_0x24fe8d){logger[_0xf003('0x44')](_0xf003('0x8d'),_0x1481a2[_0xf003('0x53')],util[_0xf003('0x43')](_0x24fe8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf003('0x39')]['syncAgentComplete']=function(_0x893425){try{if(this[_0xf003('0x6f')](_0x893425)){logger[_0xf003('0x4a')](_0xf003('0x8e'),_0x893425['uniqueid'],util[_0xf003('0x43')](_0x893425,{'showHidden':![],'depth':null}));if(this[_0xf003('0xd')][_0x893425[_0xf003('0x53')]]){var _0x197244=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x893425[_0xf003('0x53')]]);_0x197244['queuecallerabandon']=![];_0x197244['queuecallerabandonAt']=null;_0x197244['assigned']=!![];_0x197244[_0xf003('0x86')]=_0x893425['membername'];_0x197244[_0xf003('0x83')]=_0x893425[_0xf003('0x83')];_0x197244[_0xf003('0x81')]=!![];_0x197244[_0xf003('0x8f')]=![];_0x197244['queuecallerexitAt']=null;if(!_0x197244[_0xf003('0x90')]){if(_0x893425[_0xf003('0x91')]==_0xf003('0x90')){_0x197244[_0xf003('0x54')]='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x197244[_0xf003('0x4e')],_0x197244[_0xf003('0x57')]);}else{if(_[_0xf003('0x92')](_0x893425[_0xf003('0x3e')]['toLowerCase'](),_0xf003('0x93'))){if(this['queueReports'][_0x893425[_0xf003('0x94')]]){var _0x150147=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x893425[_0xf003('0x94')]]);_0x150147[_0xf003('0x81')]=![];_0x150147['queuecallerexit']=!![];_0x150147[_0xf003('0x95')]=moment(_0x197244[_0xf003('0x77')])['add'](_0x893425[_0xf003('0x83')],'seconds')[_0xf003('0x5a')](_0xf003('0x78'));_0x150147[_0xf003('0x54')]=_0xf003('0x96');_0x150147['transfer']=!![];_0x150147[_0xf003('0x97')]=_0xf003('0x98');_0x150147[_0xf003('0x99')]=_0x893425[_0xf003('0x9a')];_0x150147[_0xf003('0x9b')]=_0x893425[_0xf003('0x53')];logger[_0xf003('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x150147['queue'],_0x150147[_0xf003('0x57')]);var _0x93dde3=this[_0xf003('0xd')][_0x893425[_0xf003('0x94')]];this[_0xf003('0xd')][_0x893425[_0xf003('0x94')]]=this['queueReports'][_0x893425[_0xf003('0x53')]];this[_0xf003('0xd')][_0x893425[_0xf003('0x53')]]=_0x93dde3;}}else{_0x197244[_0xf003('0x54')]=_0xf003('0x9c')+_0x893425[_0xf003('0x91')]['toUpperCase']();logger[_0xf003('0x71')](_0xf003('0x9d'),_0x197244['queue'],_0x197244[_0xf003('0x57')],_0x197244[_0xf003('0x54')]);}}}this[_0xf003('0x10')][_0x893425[_0xf003('0x53')]]=_0x197244;this[_0xf003('0x51')](_0x197244,'agentcomplete');}}}catch(_0x2077ea){logger[_0xf003('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x893425[_0xf003('0x53')],util[_0xf003('0x43')](_0x2077ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf003('0x39')]['syncVarSet']=function(_0x1233b5){try{if(this['isNotNull'](_0x1233b5)){logger['debug']('[%s][voiceQueueReport][varset]',_0x1233b5[_0xf003('0x53')],util[_0xf003('0x43')](_0x1233b5,{'showHidden':![],'depth':null}));this['addVariable'](_0x1233b5[_0xf003('0x53')],_[_0xf003('0x9e')](_0x1233b5['variable'])[0x0],_0x1233b5['value']);if(this[_0xf003('0xd')][_0x1233b5['uniqueid']]){var _0x433914=_[_0xf003('0x80')](this[_0xf003('0xd')][_0x1233b5[_0xf003('0x53')]]);if(_0x433914){if(this[_0xf003('0x6f')](_0x1233b5[_0xf003('0x9f')])&&this['isNotNull'](_0x1233b5[_0xf003('0x9f')]['queuestatus'])){switch(_0x1233b5[_0xf003('0xa0')]){case'CONTINUE':_0x433914[_0xf003('0x8f')]=![];_0x433914[_0xf003('0x95')]=null;break;case _0xf003('0xa1'):_0x433914[_0xf003('0xa2')]='timeout';_0x433914[_0xf003('0x8f')]=!![];_0x433914[_0xf003('0x95')]=moment()['format'](_0xf003('0x78'));_0x433914[_0xf003('0x89')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));logger[_0xf003('0x4a')](_0xf003('0xa3'),_0x1233b5['uniqueid'],util[_0xf003('0x43')](_0x433914,{'showHidden':![],'depth':null}));ami[_0xf003('0x48')](_0xf003('0xa4'),_0x433914);break;default:_0x433914[_0xf003('0x8f')]=!![];_0x433914[_0xf003('0x95')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));_0x433914['queuecallerleaveAt']=moment()[_0xf003('0x5a')](_0xf003('0x78'));}_0x433914['queuecallerabandon']=![];_0x433914['queuecallerabandonAt']=null;_0x433914[_0xf003('0x54')]=_0x1233b5['value'];this[_0xf003('0x10')][_0x1233b5[_0xf003('0x53')]]=_0x433914;this[_0xf003('0x51')](_0x433914,'varset');}else if(this['isNotNull'](_0x1233b5[_0xf003('0x9f')])&&this[_0xf003('0x6f')](_0x1233b5[_0xf003('0x9f')][_0xf003('0xa5')])){if(!_0x433914[_0xf003('0x1e')]){_0x433914[_0xf003('0x8f')]=!![];_0x433914[_0xf003('0x95')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));_0x433914[_0xf003('0x54')]=_0xf003('0xa6');_0x433914[_0xf003('0x89')]=moment()[_0xf003('0x5a')](_0xf003('0x78'));this[_0xf003('0x10')][_0x1233b5[_0xf003('0x53')]]=_0x433914;}}logger[_0xf003('0x71')](_0xf003('0xa7'),_0x1233b5[_0xf003('0x53')],_0x433914[_0xf003('0x4e')],_0x433914[_0xf003('0x57')],_[_0xf003('0x9e')](_0x1233b5[_0xf003('0x9f')])[0x0],_0x1233b5[_0xf003('0xa0')]);_0x433914[_0xf003('0x14')]=this[_0xf003('0x14')][_0x1233b5[_0xf003('0x53')]];}}}}catch(_0x17be59){logger[_0xf003('0x44')](_0xf003('0xa8'),_0x1233b5[_0xf003('0x53')],util[_0xf003('0x43')](_0x17be59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf003('0x39')]['addVariable']=function(_0x1e9908,_0x2064da,_0x54c85f){var _0x48470a=[_0xf003('0xa9'),_0xf003('0xaa'),_0xf003('0xab'),_0xf003('0xac'),_0xf003('0xad'),_0xf003('0xae'),'rtpaudioqosrtt',_0xf003('0xaf'),_0xf003('0xb0'),_0xf003('0xb1'),_0xf003('0xb2'),'bridgepvtcallid',_0xf003('0xb3'),_0xf003('0xb4'),_0xf003('0xb5'),_0xf003('0xb6'),_0xf003('0xb7'),_0xf003('0xb8'),'memberrealtime'];if(!_['isNil'](_0x2064da)&&!_[_0xf003('0xb9')](_0x48470a,_0x2064da)){if(_['isUndefined'](this[_0xf003('0x14')][_0x1e9908])){this[_0xf003('0x14')][_0x1e9908]={};}this['variables'][_0x1e9908][_0x2064da]=_0x54c85f;}};VoiceQueueReport[_0xf003('0x39')][_0xf003('0xba')]=function(_0x121022,_0x5257d1,_0x4febcb){var _0x2afb68={};for(var _0x10837f=0x0;_0x10837f0x0?!![]:![];if(!_0x2158f4){return this[_0x28cc('0x17')](this[_0x28cc('0x12')][_0x28cc('0x68')]);}};VoiceQueueReport[_0x28cc('0x33')][_0x28cc('0x19')]=function(_0x348fed){var _0x55b94a=this[_0x28cc('0x12')]['id'];if(this['summary'][_0x28cc('0x69')][_0x55b94a]&&this[_0x28cc('0x12')][_0x28cc('0x69')][_0x55b94a][_0x348fed['actionid']]){this['summary']['queuestatus'][_0x55b94a][_0x348fed[_0x28cc('0x5d')]][_0x28cc('0xe')][_0x28cc('0x6a')](_0x348fed);}};VoiceQueueReport[_0x28cc('0x33')][_0x28cc('0x15')]=function(_0x1870eb){var _0x2c3974=this;try{if(this[_0x28cc('0x57')](_0x1870eb)&&this['isNotNull'](_0x1870eb[_0x28cc('0x49')])){logger[_0x28cc('0x45')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x28cc('0x3e')](_0x1870eb,{'showHidden':![],'depth':null}));var _0x2fe7f9=this['voiceQueues'][_0x1870eb[_0x28cc('0x49')]];if(_0x2fe7f9){logger[_0x28cc('0x6b')](_0x28cc('0x6c'),_0x2fe7f9[_0x28cc('0x55')]);this[_0x28cc('0x12')][_0x28cc('0x59')][_0x2fe7f9[_0x28cc('0x55')]]={'summaryEvent':_0x1870eb};this[_0x28cc('0x12')][_0x28cc('0x67')]+=0x1;return ami[_0x28cc('0x37')]({'action':_0x28cc('0x69'),'queue':_0x2fe7f9[_0x28cc('0x55')]})[_0x28cc('0x5c')](function(_0x4854ec){if(!_0x2c3974[_0x28cc('0x12')][_0x28cc('0x69')][_0x1870eb['actionid']]){_0x2c3974[_0x28cc('0x12')][_0x28cc('0x69')][_0x1870eb[_0x28cc('0x5d')]]={};}_0x2c3974[_0x28cc('0x12')][_0x28cc('0x69')][_0x1870eb[_0x28cc('0x5d')]][_0x4854ec[_0x28cc('0x5d')]]={'queue':_0x2fe7f9[_0x28cc('0x55')],'agents':[]};})['catch'](function(_0x3961a0){throw _0x3961a0;});}}}catch(_0x1e1685){logger[_0x28cc('0x3c')](_0x28cc('0x5e'),util[_0x28cc('0x3e')](_0x1e1685,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x28cc('0x17')]=function(_0x307d14){if(this[_0x28cc('0x12')]['statusRequests']>0x0){this[_0x28cc('0x12')][_0x28cc('0x68')]=_0x307d14;return;}logger[_0x28cc('0x45')](_0x28cc('0x6d'),util['inspect'](_0x307d14,{'showHidden':![],'depth':null}));this[_0x28cc('0x12')]=initializeSummary();ami['emit'](_0x28cc('0x6e'),{});};VoiceQueueReport[_0x28cc('0x33')]['syncQueueCallerJoin']=function(_0xf65331){try{if(this[_0x28cc('0x57')](_0xf65331)){logger['debug'](_0x28cc('0x6f'),_0xf65331[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0xf65331,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x28cc('0xd')][_0xf65331[_0x28cc('0x47')]])){this[_0x28cc('0xd')][_0xf65331['uniqueid']]=[];}if(_['isUndefined'](this[_0x28cc('0xf')][_0xf65331[_0x28cc('0x47')]])){this[_0x28cc('0xf')][_0xf65331[_0x28cc('0x47')]]={};}var _0xd1b2d4=new QueueReport();_0xd1b2d4['queue']=_0xf65331[_0x28cc('0x49')];_0xd1b2d4[_0x28cc('0x52')]=this[_0x28cc('0x10')][_0xd1b2d4['queue']]&&this['voiceQueues'][_0xd1b2d4['queue']]['type']?this['voiceQueues'][_0xd1b2d4[_0x28cc('0x49')]][_0x28cc('0x52')]||_0x28cc('0x53'):_0x28cc('0x53');_0xd1b2d4[_0x28cc('0x70')]=moment()['format'](_0x28cc('0x71'));_0xd1b2d4[_0x28cc('0x72')]=_0xf65331[_0x28cc('0x72')];_0xd1b2d4[_0x28cc('0x73')]=_0xf65331['count'];_0xd1b2d4['uniqueid']=_0xf65331[_0x28cc('0x47')];_0xd1b2d4[_0x28cc('0x74')]=this[_0x28cc('0xf')][_0xf65331['uniqueid']][_0x28cc('0x74')];logger[_0x28cc('0x6b')](_0x28cc('0x75'),_0xd1b2d4['queue'],_0xd1b2d4['type']);_[_0x28cc('0x76')](_0xd1b2d4,_['pick'](_0xf65331,_[_0x28cc('0x77')](_0xd1b2d4)));this['queueReports'][_0xf65331[_0x28cc('0x47')]]['push'](_0xd1b2d4);this['channels'][_0xf65331[_0x28cc('0x47')]]=_0xd1b2d4;this[_0x28cc('0x44')](_0xd1b2d4,_0x28cc('0x78'));}}catch(_0x12dfc5){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0xf65331[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x12dfc5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x28cc('0x33')][_0x28cc('0x1d')]=function(_0xe0f0df){try{if(this[_0x28cc('0x57')](_0xe0f0df)){logger[_0x28cc('0x45')](_0x28cc('0x79'),_0xe0f0df[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0xe0f0df,{'showHidden':![],'depth':null}));if(this[_0x28cc('0xd')][_0xe0f0df['uniqueid']]){var _0x11eceb=_['last'](this[_0x28cc('0xd')][_0xe0f0df[_0x28cc('0x47')]]);_0x11eceb[_0x28cc('0x7a')]=![];_0x11eceb[_0x28cc('0x7b')]=null;_0x11eceb['holdtime']=_0xe0f0df[_0x28cc('0x7c')];_0x11eceb[_0x28cc('0x7d')]=_0xe0f0df[_0x28cc('0x7d')];_0x11eceb[_0x28cc('0x7e')]=!![];_0x11eceb['queuecallerabandonAt']=moment()[_0x28cc('0x50')](_0x28cc('0x71'));_0x11eceb[_0x28cc('0x4e')]=_0x28cc('0x7f');_0x11eceb[_0x28cc('0x80')]=null;logger[_0x28cc('0x6b')](_0x28cc('0x81'),_0x11eceb[_0x28cc('0x49')],_0x11eceb[_0x28cc('0x52')]);this[_0x28cc('0xf')][_0xe0f0df[_0x28cc('0x47')]]=_0x11eceb;this[_0x28cc('0x4c')](_0x11eceb,'queuecallerabandon');}}}catch(_0x22e999){logger[_0x28cc('0x3c')](_0x28cc('0x79'),_0xe0f0df[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x22e999,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x28cc('0x33')]['syncQueueCallerLeave']=function(_0x29f8f7){try{if(this[_0x28cc('0x57')](_0x29f8f7)){logger['debug'](_0x28cc('0x82'),_0x29f8f7[_0x28cc('0x47')],util['inspect'](_0x29f8f7,{'showHidden':![],'depth':null}));if(this[_0x28cc('0xd')][_0x29f8f7[_0x28cc('0x47')]]){var _0x777058=_['last'](this[_0x28cc('0xd')][_0x29f8f7[_0x28cc('0x47')]]);_0x777058[_0x28cc('0x83')]=moment()[_0x28cc('0x50')](_0x28cc('0x71'));_0x777058['connectedlinenum']=_0x29f8f7['connectedlinenum'];_0x777058[_0x28cc('0x84')]=_0x29f8f7[_0x28cc('0x84')];logger[_0x28cc('0x6b')](_0x28cc('0x85'),_0x777058[_0x28cc('0x49')],_0x777058[_0x28cc('0x52')],_0x29f8f7[_0x28cc('0x86')],_0x29f8f7[_0x28cc('0x84')]);this[_0x28cc('0xf')][_0x29f8f7[_0x28cc('0x47')]]=_0x777058;this[_0x28cc('0x44')](_0x777058,_0x28cc('0x87'));}}}catch(_0x2c3f33){logger[_0x28cc('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x29f8f7[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x2c3f33,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x28cc('0x33')]['syncAgentConnect']=function(_0x39c4ad){try{if(this[_0x28cc('0x57')](_0x39c4ad)){logger['debug'](_0x28cc('0x88'),_0x39c4ad[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x39c4ad,{'showHidden':![],'depth':null}));if(this[_0x28cc('0xd')][_0x39c4ad[_0x28cc('0x47')]]){var _0x6f7022=_[_0x28cc('0x89')](this[_0x28cc('0xd')][_0x39c4ad['uniqueid']]);_0x6f7022[_0x28cc('0x7a')]=!![];_0x6f7022[_0x28cc('0x4e')]=_0x28cc('0x8a');logger[_0x28cc('0x6b')](_0x28cc('0x8b'),_0x6f7022['queue'],_0x6f7022[_0x28cc('0x52')]);}}}catch(_0x50b6ac){logger['error'](_0x28cc('0x88'),_0x39c4ad[_0x28cc('0x47')],util['inspect'](_0x50b6ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x28cc('0x33')][_0x28cc('0x8c')]=function(_0x339fd1){try{if(this[_0x28cc('0x57')](_0x339fd1)){logger[_0x28cc('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x339fd1[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x339fd1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x339fd1[_0x28cc('0x47')]]){var _0x22a6d0=_[_0x28cc('0x89')](this['queueReports'][_0x339fd1['uniqueid']]);_0x22a6d0[_0x28cc('0x7e')]=![];_0x22a6d0['queuecallerabandonAt']=null;_0x22a6d0[_0x28cc('0x8d')]=!![];_0x22a6d0[_0x28cc('0x80')]=_0x339fd1['membername'];_0x22a6d0['holdtime']=_0x339fd1[_0x28cc('0x7c')];_0x22a6d0[_0x28cc('0x7a')]=!![];_0x22a6d0[_0x28cc('0x8e')]=![];_0x22a6d0[_0x28cc('0x8f')]=null;if(!_0x22a6d0[_0x28cc('0x90')]){if(_0x339fd1[_0x28cc('0x91')]=='transfer'){_0x22a6d0[_0x28cc('0x4e')]=_0x28cc('0x92');logger[_0x28cc('0x6b')](_0x28cc('0x93'),_0x22a6d0[_0x28cc('0x49')],_0x22a6d0[_0x28cc('0x52')]);}else{if(_[_0x28cc('0x94')](_0x339fd1['channel'][_0x28cc('0x95')](),_0x28cc('0x96'))){if(this[_0x28cc('0xd')][_0x339fd1['linkedid']]){var _0x184586=_['last'](this[_0x28cc('0xd')][_0x339fd1[_0x28cc('0x97')]]);_0x184586[_0x28cc('0x7a')]=![];_0x184586[_0x28cc('0x8e')]=!![];_0x184586[_0x28cc('0x8f')]=moment(_0x22a6d0[_0x28cc('0x70')])[_0x28cc('0x98')](_0x339fd1[_0x28cc('0x7c')],_0x28cc('0x99'))[_0x28cc('0x50')](_0x28cc('0x71'));_0x184586['queuecallerexitreason']=_0x28cc('0x9a');_0x184586[_0x28cc('0x90')]=!![];_0x184586[_0x28cc('0x9b')]=_0x28cc('0x9c');_0x184586['transferexten']=_0x339fd1[_0x28cc('0x9d')];_0x184586[_0x28cc('0x9e')]=_0x339fd1[_0x28cc('0x47')];logger[_0x28cc('0x6b')](_0x28cc('0x9f'),_0x184586[_0x28cc('0x49')],_0x184586[_0x28cc('0x52')]);var _0x3804e7=this[_0x28cc('0xd')][_0x339fd1[_0x28cc('0x97')]];this[_0x28cc('0xd')][_0x339fd1[_0x28cc('0x97')]]=this['queueReports'][_0x339fd1[_0x28cc('0x47')]];this[_0x28cc('0xd')][_0x339fd1[_0x28cc('0x47')]]=_0x3804e7;}}else{_0x22a6d0[_0x28cc('0x4e')]=_0x28cc('0xa0')+_0x339fd1[_0x28cc('0x91')][_0x28cc('0xa1')]();logger['info'](_0x28cc('0xa2'),_0x22a6d0['queue'],_0x22a6d0['type'],_0x22a6d0[_0x28cc('0x4e')]);}}}this[_0x28cc('0xf')][_0x339fd1[_0x28cc('0x47')]]=_0x22a6d0;this[_0x28cc('0x4c')](_0x22a6d0,_0x28cc('0x1f'));}}}catch(_0x4e8575){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x339fd1['uniqueid'],util[_0x28cc('0x3e')](_0x4e8575,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x28cc('0x23')]=function(_0x13d911){try{if(this[_0x28cc('0x57')](_0x13d911)){logger[_0x28cc('0x45')]('[%s][voiceQueueReport][varset]',_0x13d911[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x13d911,{'showHidden':![],'depth':null}));this[_0x28cc('0xa3')](_0x13d911[_0x28cc('0x47')],_[_0x28cc('0x77')](_0x13d911['variable'])[0x0],_0x13d911['value']);if(this[_0x28cc('0xd')][_0x13d911['uniqueid']]){var _0x210bbe=_['last'](this[_0x28cc('0xd')][_0x13d911['uniqueid']]);if(_0x210bbe){if(this[_0x28cc('0x57')](_0x13d911[_0x28cc('0xa4')])&&this[_0x28cc('0x57')](_0x13d911[_0x28cc('0xa4')]['queuestatus'])){switch(_0x13d911['value']){case _0x28cc('0xa5'):_0x210bbe['queuecallerexit']=![];_0x210bbe['queuecallerexitAt']=null;break;case _0x28cc('0xa6'):_0x210bbe['lastevent']='timeout';_0x210bbe[_0x28cc('0x8e')]=!![];_0x210bbe[_0x28cc('0x8f')]=moment()['format'](_0x28cc('0x71'));_0x210bbe['queuecallerleaveAt']=moment()[_0x28cc('0x50')](_0x28cc('0x71'));logger[_0x28cc('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x13d911[_0x28cc('0x47')],util[_0x28cc('0x3e')](_0x210bbe,{'showHidden':![],'depth':null}));ami['emit'](_0x28cc('0xa7'),_0x210bbe);break;default:_0x210bbe[_0x28cc('0x8e')]=!![];_0x210bbe['queuecallerexitAt']=moment()['format'](_0x28cc('0x71'));_0x210bbe[_0x28cc('0x83')]=moment()[_0x28cc('0x50')](_0x28cc('0x71'));}_0x210bbe[_0x28cc('0x7e')]=![];_0x210bbe[_0x28cc('0xa8')]=null;_0x210bbe['queuecallerexitreason']=_0x13d911[_0x28cc('0xa9')];this[_0x28cc('0xf')][_0x13d911['uniqueid']]=_0x210bbe;this[_0x28cc('0x4c')](_0x210bbe,'varset');}else if(this[_0x28cc('0x57')](_0x13d911[_0x28cc('0xa4')])&&this[_0x28cc('0x57')](_0x13d911[_0x28cc('0xa4')]['queueposition'])){if(!_0x210bbe[_0x28cc('0x7e')]){_0x210bbe[_0x28cc('0x8e')]=!![];_0x210bbe[_0x28cc('0x8f')]=moment()[_0x28cc('0x50')](_0x28cc('0x71'));_0x210bbe['queuecallerexitreason']=_0x28cc('0xaa');_0x210bbe[_0x28cc('0x83')]=moment()[_0x28cc('0x50')](_0x28cc('0x71'));this['channels'][_0x13d911['uniqueid']]=_0x210bbe;}}logger[_0x28cc('0x6b')](_0x28cc('0xab'),_0x13d911[_0x28cc('0x47')],_0x210bbe[_0x28cc('0x49')],_0x210bbe[_0x28cc('0x52')],_[_0x28cc('0x77')](_0x13d911[_0x28cc('0xa4')])[0x0],_0x13d911[_0x28cc('0xa9')]);_0x210bbe[_0x28cc('0x13')]=this[_0x28cc('0x13')][_0x13d911[_0x28cc('0x47')]];}}}}catch(_0x44e9dc){logger['error'](_0x28cc('0xac'),_0x13d911[_0x28cc('0x47')],util['inspect'](_0x44e9dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x28cc('0x33')][_0x28cc('0xa3')]=function(_0x55a32b,_0x108e60,_0x24a20c){var _0x4337c5=['rtpaudioqos',_0x28cc('0xad'),_0x28cc('0xae'),_0x28cc('0xaf'),_0x28cc('0xb0'),'rtpaudioqoslossbridged',_0x28cc('0xb1'),_0x28cc('0xb2'),_0x28cc('0xb3'),_0x28cc('0xb4'),_0x28cc('0xb5'),_0x28cc('0xb6'),_0x28cc('0xb7'),'memberdynamic',_0x28cc('0xb8'),'memberlastcall',_0x28cc('0xb9'),_0x28cc('0xba'),_0x28cc('0xbb')];if(!_[_0x28cc('0x36')](_0x108e60)&&!_['includes'](_0x4337c5,_0x108e60)){if(_[_0x28cc('0x58')](this[_0x28cc('0x13')][_0x55a32b])){this[_0x28cc('0x13')][_0x55a32b]={};}this['variables'][_0x55a32b][_0x108e60]=_0x24a20c;}};VoiceQueueReport[_0x28cc('0x33')]['handleHangup']=function(_0x1ac4da,_0xc920bf,_0x2765f2){var _0x4a0cab={};for(var _0x161dcc=0x0;_0x161dcc=0x0?moment(_0x5ed425['endtime'])['diff'](_0x5ed425[_0xd000('0x19')],'seconds'):null,'data1':_0xd000('0x1c'),'data2':_0x5ed425[_0xd000('0x15')],'data3':_0x5ed425[_0xd000('0x1d')],'data4':_0x5ed425[_0xd000('0x1e')]||null,'role':_0xd000('0x14'),'internal':_0x5ed425['accountcode']?_['toNumber'](_0x5ed425[_0xd000('0x15')]):undefined,'uniqueid':_0x5ed425[_0xd000('0x17')]},'log':_0xd000('0x7')});}; \ No newline at end of file +var _0xc940=['CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING','queuecallerleaveAt','diff','calleridnum','queue','agent','accountcode','voiceDialReport','starttime','endtime','seconds','outbound','exten','toNumber','uniqueid','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request'];(function(_0x2d05f4,_0x98fc07){var _0x5a3c44=function(_0x24d3c9){while(--_0x24d3c9){_0x2d05f4['push'](_0x2d05f4['shift']());}};_0x5a3c44(++_0x98fc07);}(_0xc940,0x1df));var _0x0c94=function(_0x48380a,_0x9f790b){_0x48380a=_0x48380a-0x0;var _0x2a0673=_0xc940[_0x48380a];return _0x2a0673;};'use strict';var moment=require('moment');var _=require(_0x0c94('0x0'));var util=require(_0x0c94('0x1'));var client=require(_0x0c94('0x2'));exports[_0x0c94('0x3')]=function(_0xf8499d){var _0x3a57e4=_0xf8499d[_0x0c94('0x4')]||_0xf8499d[_0x0c94('0x5')];return client[_0x0c94('0x6')](_0x0c94('0x7'),{'body':{'channel':_0x0c94('0x8'),'membername':_0xf8499d[_0x0c94('0x9')],'interface':_['isNil'](_0xf8499d[_0x0c94('0xa')])?util[_0x0c94('0xb')]('SIP/%s',_0xf8499d[_0x0c94('0x9')]):_0xf8499d['interface'],'type':_0x0c94('0xc'),'enterAt':_0xf8499d[_0x0c94('0xd')],'exitAt':_0x3a57e4,'duration':moment(_0x3a57e4)[_0x0c94('0xe')](_0xf8499d['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0xf8499d[_0x0c94('0xf')],'data3':_0xf8499d['exten'],'data4':null,'data5':_0xf8499d[_0x0c94('0x10')],'role':_0x0c94('0x11'),'internal':_0xf8499d['accountcode']?_['toNumber'](_0xf8499d[_0x0c94('0x12')]):undefined,'uniqueid':_0xf8499d['uniqueid']},'log':_0x0c94('0x7')});};exports[_0x0c94('0x13')]=function(_0x132cf3){return client[_0x0c94('0x6')]('CreateMemberReport',{'body':{'channel':_0x0c94('0x8'),'membername':_0x132cf3['membername'],'interface':_0x132cf3[_0x0c94('0xa')],'type':_0x0c94('0xc'),'enterAt':_0x132cf3[_0x0c94('0x14')],'exitAt':_0x132cf3[_0x0c94('0x15')],'duration':moment(_0x132cf3[_0x0c94('0x15')])[_0x0c94('0xe')](_0x132cf3[_0x0c94('0x14')],_0x0c94('0x16'))>=0x0?moment(_0x132cf3[_0x0c94('0x15')])[_0x0c94('0xe')](_0x132cf3['starttime'],_0x0c94('0x16')):null,'data1':_0x0c94('0x17'),'data2':_0x132cf3[_0x0c94('0x12')],'data3':_0x132cf3[_0x0c94('0x18')],'data4':_0x132cf3['dialstring']||null,'role':'agent','internal':_0x132cf3['accountcode']?_[_0x0c94('0x19')](_0x132cf3[_0x0c94('0x12')]):undefined,'uniqueid':_0x132cf3[_0x0c94('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b7bf627..9157cca 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 _0x337f=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','stopRecordingOnTransfer'];(function(_0xf9419b,_0x32ca9b){var _0x40b519=function(_0x4ca472){while(--_0x4ca472){_0xf9419b['push'](_0xf9419b['shift']());}};_0x40b519(++_0x32ca9b);}(_0x337f,0x11c));var _0xf337=function(_0x1ba046,_0x51fe3d){_0x1ba046=_0x1ba046-0x0;var _0x4bb91b=_0x337f[_0x1ba046];return _0x4bb91b;};'use strict';var client=require(_0xf337('0x0'));exports[_0xf337('0x1')]=function(){return client[_0xf337('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf337('0x3'),_0xf337('0x4')]},'log':_0xf337('0x5')});}; \ No newline at end of file +var _0xae8e=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x3c5d90,_0x5f0c4a){var _0x2ed112=function(_0x137174){while(--_0x137174){_0x3c5d90['push'](_0x3c5d90['shift']());}};_0x2ed112(++_0x5f0c4a);}(_0xae8e,0xc3));var _0xeae8=function(_0x173f07,_0x209e84){_0x173f07=_0x173f07-0x0;var _0x3f809b=_0xae8e[_0x173f07];return _0x3f809b;};'use strict';var client=require(_0xeae8('0x0'));exports[_0xeae8('0x1')]=function(){return client[_0xeae8('0x2')](_0xeae8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xeae8('0x4'),_0xeae8('0x5')]},'log':_0xeae8('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5195974..7ca420f 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 _0x4937=['../client','getTemplates','GetTemplate','name'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x4937,0x1c8));var _0x7493=function(_0x1064e5,_0x5aeee6){_0x1064e5=_0x1064e5-0x0;var _0x2cb9f9=_0x4937[_0x1064e5];return _0x2cb9f9;};'use strict';var client=require(_0x7493('0x0'));exports[_0x7493('0x1')]=function(_0x28e282){return function(_0x6fcfeb){return client['Request'](_0x7493('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7493('0x3'),'html']},'log':_0x7493('0x2')});};}; \ No newline at end of file +var _0x4dfc=['name','html','Request','GetTemplate'];(function(_0x115554,_0x5b1782){var _0x395e85=function(_0x1a60eb){while(--_0x1a60eb){_0x115554['push'](_0x115554['shift']());}};_0x395e85(++_0x5b1782);}(_0x4dfc,0xda));var _0xc4df=function(_0x167b19,_0x56081a){_0x167b19=_0x167b19-0x0;var _0x1fcca2=_0x4dfc[_0x167b19];return _0x1fcca2;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4edcd3){return function(_0x4114c8){return client[_0xc4df('0x0')](_0xc4df('0x1'),{'options':{'raw':!![],'attributes':['id',_0xc4df('0x2'),_0xc4df('0x3')]},'log':_0xc4df('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fbcd8ac..b0c27d1 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 _0x9c7c=['Actions','action','data1','data2','data3','data4','getTriggers','Request','name','status','AllConditions','value','Condition','AnyConditions','operator'];(function(_0x5b5367,_0x1b22b9){var _0x471a7a=function(_0x32956b){while(--_0x32956b){_0x5b5367['push'](_0x5b5367['shift']());}};_0x471a7a(++_0x1b22b9);}(_0x9c7c,0x123));var _0xc9c7=function(_0x51633a,_0x2a20cc){_0x51633a=_0x51633a-0x0;var _0x144a05=_0x9c7c[_0x51633a];return _0x144a05;};'use strict';var client=require('../client');exports[_0xc9c7('0x0')]=function(_0x29a375){return function(_0x2f8d89){return client[_0xc9c7('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xc9c7('0x2'),'channel',_0xc9c7('0x3')],'include':[{'model':'Condition','as':_0xc9c7('0x4'),'attributes':['id','field','operator',_0xc9c7('0x5')]},{'model':_0xc9c7('0x6'),'as':_0xc9c7('0x7'),'attributes':['id','field',_0xc9c7('0x8'),_0xc9c7('0x5')]},{'model':'Action','as':_0xc9c7('0x9'),'attributes':['id',_0xc9c7('0xa'),_0xc9c7('0xb'),_0xc9c7('0xc'),_0xc9c7('0xd'),_0xc9c7('0xe'),'data5','data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x9cd4=['AllConditions','field','value','Condition','AnyConditions','operator','action','data1','data2','data3','data5','data7','Request','GetTrigger','name'];(function(_0x84f584,_0x1a562a){var _0x377d39=function(_0x19b6a8){while(--_0x19b6a8){_0x84f584['push'](_0x84f584['shift']());}};_0x377d39(++_0x1a562a);}(_0x9cd4,0xfc));var _0x49cd=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x9cd4[_0xb1b616];return _0x1259b0;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x101fcd){return function(_0x1c73a7){return client[_0x49cd('0x0')](_0x49cd('0x1'),{'options':{'raw':![],'attributes':['id',_0x49cd('0x2'),'channel','status'],'include':[{'model':'Condition','as':_0x49cd('0x3'),'attributes':['id',_0x49cd('0x4'),'operator',_0x49cd('0x5')]},{'model':_0x49cd('0x6'),'as':_0x49cd('0x7'),'attributes':['id',_0x49cd('0x4'),_0x49cd('0x8'),_0x49cd('0x5')]},{'model':'Action','as':'Actions','attributes':['id',_0x49cd('0x9'),_0x49cd('0xa'),_0x49cd('0xb'),_0x49cd('0xc'),'data4',_0x49cd('0xd'),'data6',_0x49cd('0xe')]}]},'log':_0x49cd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b8c0fd9..958188a 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 _0x500a=['name','registry','defaultuser','GetTrunk','getTrunks'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x500a,0xd6));var _0xa500=function(_0x907287,_0x274d2e){_0x907287=_0x907287-0x0;var _0x2cd6ea=_0x500a[_0x907287];return _0x2cd6ea;};'use strict';var client=require('../client');exports[_0xa500('0x0')]=function(_0x4dfa53){return function(_0x4090ee){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa500('0x1'),_0xa500('0x2'),_0xa500('0x3')]},'log':_0xa500('0x4')});};}; \ No newline at end of file +var _0x9589=['registry','defaultuser','../client','getTrunks','Request','name'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x9589,0xbc));var _0x9958=function(_0x1c0aa5,_0x20e91b){_0x1c0aa5=_0x1c0aa5-0x0;var _0x607876=_0x9589[_0x1c0aa5];return _0x607876;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175){return function(_0x454fcd){return client[_0x9958('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9958('0x3'),_0x9958('0x4'),_0x9958('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 912322b..0b2aad2 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x469bdc,_0x5221a0){var _0x5118ad=function(_0x11255f){while(--_0x11255f){_0x469bdc['push'](_0x469bdc['shift']());}};_0x5118ad(++_0x5221a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x16ed99,_0x40cd8f){_0x16ed99=_0x16ed99-0x0;var _0x3951be=_0xedd9[_0x16ed99];return _0x3951be;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c584562..2aabf60 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 _0x319f=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x3916e7,_0x38a87f){var _0x108901=function(_0x1388fa){while(--_0x1388fa){_0x3916e7['push'](_0x3916e7['shift']());}};_0x108901(++_0x38a87f);}(_0x319f,0x104));var _0xf319=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x319f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf319('0x0'));exports['create']=function(_0x2577a9){return client[_0xf319('0x1')](_0xf319('0x2'),{'body':_0x2577a9,'log':_0xf319('0x2')});};exports['update']=function(_0x4d3f10,_0x4609fe,_0x5aacdf){return client[_0xf319('0x1')](_0xf319('0x3'),{'body':_0x4d3f10,'options':{'where':{'uniqueid':_0x4609fe,'interface':_0x5aacdf,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xcd84=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x2f6224,_0x1f55c9){var _0x1df782=function(_0x5704b2){while(--_0x5704b2){_0x2f6224['push'](_0x2f6224['shift']());}};_0x1df782(++_0x1f55c9);}(_0xcd84,0x122));var _0x4cd8=function(_0x1a4a30,_0x106a2e){_0x1a4a30=_0x1a4a30-0x0;var _0x387267=_0xcd84[_0x1a4a30];return _0x387267;};'use strict';var client=require('../client');exports[_0x4cd8('0x0')]=function(_0x156b86){return client['Request']('CreateVoiceAgentReport',{'body':_0x156b86,'log':_0x4cd8('0x1')});};exports[_0x4cd8('0x2')]=function(_0x269273,_0x7b4474,_0x4eb02c){return client[_0x4cd8('0x3')](_0x4cd8('0x4'),{'body':_0x269273,'options':{'where':{'uniqueid':_0x7b4474,'interface':_0x4eb02c,'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 21e3b0f..7763615 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 _0x2037=['lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x1723dc,_0x8052fe){var _0x2ec884=function(_0x272dcc){while(--_0x272dcc){_0x1723dc['push'](_0x1723dc['shift']());}};_0x2ec884(++_0x8052fe);}(_0x2037,0x16e));var _0x7203=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x2037[_0x42c6f1];return _0x3c7398;};'use strict';var moment=require(_0x7203('0x0'));var util=require(_0x7203('0x1'));var _=require(_0x7203('0x2'));var client=require('../client');exports[_0x7203('0x3')]=function(_0x44809b){return client[_0x7203('0x4')](_0x7203('0x5'),{'body':_[_0x7203('0x6')](_0x44809b,{'source':_0x44809b[_0x7203('0x7')],'destinationcontext':_0x44809b[_0x7203('0x8')],'callerid':_0x44809b[_0x7203('0x9')],'amaflags':_0x7203('0xa')}),'log':_0x7203('0x5')});};exports[_0x7203('0xb')]=function(){return function(){return client[_0x7203('0x4')](_0x7203('0xc'),{'options':{'where':{'type':[_0x7203('0xd')],'createdAt':{'$between':[moment()[_0x7203('0xe')](_0x7203('0xf'))[_0x7203('0x10')](_0x7203('0x11')),moment()['endOf'](_0x7203('0xf'))[_0x7203('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x7203('0x12'),_0x7203('0x13'),_0x7203('0x14'),_0x7203('0x15')]},'log':_0x7203('0x16')});};}; \ No newline at end of file +var _0xc74e=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','merge','context','DOCUMENTATION','getVoiceCallReports','Request'];(function(_0x21f99c,_0x4ed282){var _0x5cd050=function(_0x3638a4){while(--_0x3638a4){_0x21f99c['push'](_0x21f99c['shift']());}};_0x5cd050(++_0x4ed282);}(_0xc74e,0xe7));var _0xec74=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc74e[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xec74('0x0'));var util=require(_0xec74('0x1'));var _=require('lodash');var client=require(_0xec74('0x2'));exports[_0xec74('0x3')]=function(_0x5cb9c7){return client['Request']('CreateVoiceCallReport',{'body':_[_0xec74('0x4')](_0x5cb9c7,{'source':_0x5cb9c7['calleridnum'],'destinationcontext':_0x5cb9c7[_0xec74('0x5')],'callerid':_0x5cb9c7['callerid'],'amaflags':_0xec74('0x6')}),'log':'CreateVoiceCallReport'});};exports[_0xec74('0x7')]=function(){return function(){return client[_0xec74('0x8')](_0xec74('0x9'),{'options':{'where':{'type':[_0xec74('0xa')],'createdAt':{'$between':[moment()[_0xec74('0xb')](_0xec74('0xc'))[_0xec74('0xd')](_0xec74('0xe')),moment()[_0xec74('0xf')](_0xec74('0xc'))[_0xec74('0xd')](_0xec74('0xe'))]}},'attributes':['type',_0xec74('0x10'),_0xec74('0x11'),_0xec74('0x12')]},'log':_0xec74('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4dd685f..d14d97b 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 _0x0b72=['CreateVoiceDialReport','../client','Request'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x0b72,0x130));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x20b7('0x0'));exports['create']=function(_0x537f3f){return client[_0x20b7('0x1')](_0x20b7('0x2'),{'body':_0x537f3f,'log':_0x20b7('0x2')});}; \ No newline at end of file +var _0x8796=['CreateVoiceDialReport','../client','create','Request'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x8796,0x99));var _0x6879=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x8796[_0x4a6156];return _0x12c1f6;};'use strict';var client=require(_0x6879('0x0'));exports[_0x6879('0x1')]=function(_0x1f701c){return client[_0x6879('0x2')](_0x6879('0x3'),{'body':_0x1f701c,'log':_0x6879('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ae28288..405b415 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 _0xe0c0=['exten','recordingFormat','../client','Request','GetVoiceExtension'];(function(_0x29eaf1,_0x14caa4){var _0x4fddcd=function(_0x557b6a){while(--_0x557b6a){_0x29eaf1['push'](_0x29eaf1['shift']());}};_0x4fddcd(++_0x14caa4);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x409865,_0x122eb4){_0x409865=_0x409865-0x0;var _0x44bf7a=_0xe0c0[_0x409865];return _0x44bf7a;};'use strict';var client=require(_0x0e0c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0e0c('0x1')](_0x0e0c('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0e0c('0x3'),_0x0e0c('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x5fc7=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x39edfa,_0x4ac759){var _0x3e7441=function(_0x2e315c){while(--_0x2e315c){_0x39edfa['push'](_0x39edfa['shift']());}};_0x3e7441(++_0x4ac759);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x5fc7[_0x53fe97];return _0x5c49a2;};'use strict';var client=require(_0x75fc('0x0'));exports[_0x75fc('0x1')]=function(){return function(){return client[_0x75fc('0x2')](_0x75fc('0x3'),{'options':{'raw':!![],'attributes':['id',_0x75fc('0x4'),_0x75fc('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x75fc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1b17965..9da34a5 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 _0x7ece=['dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ece,0xcc));var _0xe7ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7ece[_0x4b369d];return _0x571a98;};'use strict';var client=require('../client');exports[_0xe7ec('0x0')]=function(){return function(){return client[_0xe7ec('0x1')](_0xe7ec('0x2'),{'options':{'raw':![],'attributes':['id',_0xe7ec('0x3'),_0xe7ec('0x4'),_0xe7ec('0x5'),_0xe7ec('0x6'),'monitor_format',_0xe7ec('0x7'),'dialActive',_0xe7ec('0x8'),_0xe7ec('0x9'),_0xe7ec('0xa'),_0xe7ec('0xb'),'dialPredictiveOptimization',_0xe7ec('0xc'),_0xe7ec('0xd'),'dialOriginateCallerIdName',_0xe7ec('0xe'),_0xe7ec('0xf'),_0xe7ec('0x10'),_0xe7ec('0x11'),'dialQueueProject',_0xe7ec('0x12'),_0xe7ec('0x13'),_0xe7ec('0x14'),_0xe7ec('0x15'),_0xe7ec('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xe7ec('0x17'),_0xe7ec('0x18'),_0xe7ec('0x19'),_0xe7ec('0x1a'),'dialAMDActive',_0xe7ec('0x1b'),_0xe7ec('0x1c'),'dialAMDAfterGreetingSilence',_0xe7ec('0x1d'),_0xe7ec('0x1e'),'dialAMDBetweenWordsSilence',_0xe7ec('0x1f'),_0xe7ec('0x20'),_0xe7ec('0x21'),'timeout','dialRecallMeTimeout','dialRecallInQueue',_0xe7ec('0x22'),_0xe7ec('0x23'),_0xe7ec('0x24'),_0xe7ec('0x25'),_0xe7ec('0x26'),'strategy',_0xe7ec('0x27'),_0xe7ec('0x28'),'dialNoSuchNumberMaxRetry',_0xe7ec('0x29'),_0xe7ec('0x2a'),'dialDropRetryFrequency',_0xe7ec('0x2b'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xe7ec('0x2c'),_0xe7ec('0x2d'),_0xe7ec('0x2e'),_0xe7ec('0x2f'),'dialPredictiveIntervalMaxThreshold',_0xe7ec('0x30'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0xe7ec('0x31'),'as':_0xe7ec('0x31'),'attributes':['id',_0xe7ec('0x3'),_0xe7ec('0x32'),'active']},{'model':_0xe7ec('0x33'),'as':_0xe7ec('0x34'),'attributes':['id',_0xe7ec('0x3')]},{'model':_0xe7ec('0x31'),'as':_0xe7ec('0x35'),'attributes':['id',_0xe7ec('0x3'),_0xe7ec('0x32'),_0xe7ec('0x36')]},{'model':_0xe7ec('0x37'),'as':'Interval','attributes':['id',_0xe7ec('0x3')],'include':[{'model':_0xe7ec('0x37'),'as':_0xe7ec('0x38'),'attributes':['id',_0xe7ec('0x3'),_0xe7ec('0x39')]}]}]},'log':_0xe7ec('0x0')});};}; \ No newline at end of file +var _0x3100=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Pause','Trunk','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry'];(function(_0x389f96,_0x44b5d5){var _0x5636b0=function(_0x552bc9){while(--_0x552bc9){_0x389f96['push'](_0x389f96['shift']());}};_0x5636b0(++_0x44b5d5);}(_0x3100,0x90));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0310('0x0'));exports[_0x0310('0x1')]=function(){return function(){return client[_0x0310('0x2')](_0x0310('0x3'),{'options':{'raw':![],'attributes':['id',_0x0310('0x4'),_0x0310('0x5'),_0x0310('0x6'),'autopause',_0x0310('0x7'),_0x0310('0x8'),_0x0310('0x9'),_0x0310('0xa'),_0x0310('0xb'),'dialLimitQueue','dialPowerLevel',_0x0310('0xc'),_0x0310('0xd'),_0x0310('0xe'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x0310('0xf'),_0x0310('0x10'),_0x0310('0x11'),_0x0310('0x12'),_0x0310('0x13'),'dialCongestionRetryFrequency',_0x0310('0x14'),_0x0310('0x15'),_0x0310('0x16'),'dialNoAnswerRetryFrequency',_0x0310('0x17'),'dialTimezone','dialGlobalInterval',_0x0310('0x18'),_0x0310('0x19'),'dialAMDActive','dialAMDInitialSilence',_0x0310('0x1a'),_0x0310('0x1b'),_0x0310('0x1c'),_0x0310('0x1d'),_0x0310('0x1e'),_0x0310('0x1f'),'dialAMDSilenceThreshold',_0x0310('0x20'),_0x0310('0x21'),_0x0310('0x22'),'dialRecallInQueue',_0x0310('0x23'),_0x0310('0x24'),_0x0310('0x25'),_0x0310('0x26'),_0x0310('0x7'),'strategy',_0x0310('0x27'),_0x0310('0x28'),_0x0310('0x29'),_0x0310('0x2a'),_0x0310('0x2b'),_0x0310('0x2c'),_0x0310('0x2d'),_0x0310('0x2e'),'dialMachineMaxRetry',_0x0310('0x2f'),'dialAgentRejectMaxRetry',_0x0310('0x30'),_0x0310('0x31'),_0x0310('0x32'),_0x0310('0x33'),_0x0310('0x34'),_0x0310('0x35')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x0310('0x4'),_0x0310('0x36'),_0x0310('0x37')]},{'model':_0x0310('0x38'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x0310('0x39'),'as':_0x0310('0x3a'),'attributes':['id',_0x0310('0x4'),_0x0310('0x36'),'active']},{'model':_0x0310('0x3b'),'as':'Interval','attributes':['id',_0x0310('0x4')],'include':[{'model':_0x0310('0x3b'),'as':_0x0310('0x3c'),'attributes':['id','name',_0x0310('0x3d')]}]}]},'log':_0x0310('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 499f2b2..e94d01c 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(_0x49be63,_0x4d20ac){var _0x32747f=function(_0x15f188){while(--_0x15f188){_0x49be63['push'](_0x49be63['shift']());}};_0x32747f(++_0x4d20ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x3f7d36,_0x1b1474){var _0x1d5259=function(_0x29140c){while(--_0x29140c){_0x3f7d36['push'](_0x3f7d36['shift']());}};_0x1d5259(++_0x1b1474);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 decc55f..c9d881a 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 _0x95be=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x2d3ce8,_0x3524ba){var _0x579bc4=function(_0x1aeea7){while(--_0x1aeea7){_0x2d3ce8['push'](_0x2d3ce8['shift']());}};_0x579bc4(++_0x3524ba);}(_0x95be,0x10c));var _0xe95b=function(_0x520a0d,_0x56ee3c){_0x520a0d=_0x520a0d-0x0;var _0x36d904=_0x95be[_0x520a0d];return _0x36d904;};'use strict';var client=require(_0xe95b('0x0'));exports[_0xe95b('0x1')]=function(_0x713be7){return function(){return client[_0xe95b('0x2')](_0xe95b('0x3'),{'options':{'where':{'VoiceQueueId':_0x713be7,'paused':!![]},'raw':!![]},'log':_0xe95b('0x1')});};}; \ No newline at end of file +var _0x279f=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1b2827,_0x18fdba){var _0x5234f2=function(_0x568d4d){while(--_0x568d4d){_0x1b2827['push'](_0x1b2827['shift']());}};_0x5234f2(++_0x18fdba);}(_0x279f,0xcc));var _0xf279=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x279f[_0x3070dc];return _0x431489;};'use strict';var client=require('../client');exports[_0xf279('0x0')]=function(_0x2de685){return function(){return client[_0xf279('0x1')](_0xf279('0x2'),{'options':{'where':{'VoiceQueueId':_0x2de685,'paused':!![]},'raw':!![]},'log':_0xf279('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3494c54..998fb83 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(_0x5402d7,_0x238897){var _0x4f8a86=function(_0xdfd6b4){while(--_0xdfd6b4){_0x5402d7['push'](_0x5402d7['shift']());}};_0x4f8a86(++_0x238897);}(_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(_0x14d061,_0x210e66){var _0xaec53f=function(_0x146b3a){while(--_0x146b3a){_0x14d061['push'](_0x14d061['shift']());}};_0xaec53f(++_0x210e66);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 95c3135..8f14c70 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 _0x1bd9=['origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','Request'];(function(_0x109ecd,_0x18de72){var _0x1cea52=function(_0x2bc6bf){while(--_0x2bc6bf){_0x109ecd['push'](_0x109ecd['shift']());}};_0x1cea52(++_0x18de72);}(_0x1bd9,0x1ca));var _0x91bd=function(_0x197301,_0x3f7da4){_0x197301=_0x197301-0x0;var _0x30e39c=_0x1bd9[_0x197301];return _0x30e39c;};'use strict';var client=require(_0x91bd('0x0'));exports['transfers']={};exports[_0x91bd('0x1')]=function(_0x5889de){return client['Request'](_0x91bd('0x2'),{'body':{'result':_0x5889de[_0x91bd('0x3')],'transfererchannel':_0x5889de[_0x91bd('0x4')],'transferercalleridnum':_0x5889de[_0x91bd('0x5')],'transferercalleridname':_0x5889de[_0x91bd('0x6')],'transfererconnectedlinenum':_0x5889de[_0x91bd('0x7')],'transfererconnectedlinename':_0x5889de[_0x91bd('0x8')],'transfereraccountcode':_0x5889de[_0x91bd('0x9')],'transferercontext':_0x5889de['transferercontext'],'transfererexten':_0x5889de[_0x91bd('0xa')],'transfererlinkedid':_0x5889de['transfererlinkedid'],'transfereechannel':_0x5889de[_0x91bd('0xb')],'transfereecalleridnum':_0x5889de[_0x91bd('0xc')],'transfereecalleridname':_0x5889de[_0x91bd('0xd')],'transfereeconnectedlinenum':_0x5889de['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5889de[_0x91bd('0xe')],'transfereeaccountcode':_0x5889de[_0x91bd('0xf')],'transfereecontext':_0x5889de[_0x91bd('0x10')],'transfereeexten':_0x5889de[_0x91bd('0x11')],'transfereelinkedid':_0x5889de[_0x91bd('0x12')],'isexternal':_0x5889de[_0x91bd('0x13')],'context':_0x5889de[_0x91bd('0x14')],'extension':_0x5889de['extension'],'type':'blind'},'log':_0x91bd('0x2')});};exports[_0x91bd('0x15')]=function(_0x466c17){return client[_0x91bd('0x16')](_0x91bd('0x2'),{'body':{'result':_0x466c17[_0x91bd('0x3')],'transfererchannel':_0x466c17[_0x91bd('0x17')],'transferercalleridnum':_0x466c17['origtransferercalleridnum'],'transferercalleridname':_0x466c17[_0x91bd('0x18')],'transfererconnectedlinenum':_0x466c17[_0x91bd('0x19')],'transfererconnectedlinename':_0x466c17[_0x91bd('0x1a')],'transfereraccountcode':_0x466c17[_0x91bd('0x1b')],'transferercontext':_0x466c17['secondtransferercontext'],'transfererexten':_0x466c17[_0x91bd('0x1c')],'transfererlinkedid':_0x466c17[_0x91bd('0x1d')],'transfereechannel':_0x466c17['transfertargetchannel'],'transfereecalleridnum':_0x466c17[_0x91bd('0x1e')],'transfereecalleridname':_0x466c17[_0x91bd('0x1f')],'transfereeconnectedlinenum':_0x466c17['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x466c17['transfertargetconnectedlinename'],'transfereeaccountcode':_0x466c17['transfertargetaccountcode'],'transfereecontext':_0x466c17[_0x91bd('0x20')],'transfereeexten':_0x466c17[_0x91bd('0x21')],'transfereelinkedid':_0x466c17[_0x91bd('0x22')],'isexternal':_0x466c17[_0x91bd('0x13')],'context':_0x466c17['origtransferercontext'],'extension':_0x466c17[_0x91bd('0x23')],'type':_0x91bd('0x24')},'log':_0x91bd('0x2')});}; \ No newline at end of file +var _0xace7=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum'];(function(_0x55dbd0,_0x341a80){var _0xda1a93=function(_0x357b97){while(--_0x357b97){_0x55dbd0['push'](_0x55dbd0['shift']());}};_0xda1a93(++_0x341a80);}(_0xace7,0x6e));var _0x7ace=function(_0x173b35,_0x5830a){_0x173b35=_0x173b35-0x0;var _0x5d68fb=_0xace7[_0x173b35];return _0x5d68fb;};'use strict';var client=require(_0x7ace('0x0'));exports['transfers']={};exports[_0x7ace('0x1')]=function(_0x5edc94){return client[_0x7ace('0x2')](_0x7ace('0x3'),{'body':{'result':_0x5edc94['result'],'transfererchannel':_0x5edc94[_0x7ace('0x4')],'transferercalleridnum':_0x5edc94[_0x7ace('0x5')],'transferercalleridname':_0x5edc94['transferercalleridname'],'transfererconnectedlinenum':_0x5edc94[_0x7ace('0x6')],'transfererconnectedlinename':_0x5edc94[_0x7ace('0x7')],'transfereraccountcode':_0x5edc94[_0x7ace('0x8')],'transferercontext':_0x5edc94[_0x7ace('0x9')],'transfererexten':_0x5edc94[_0x7ace('0xa')],'transfererlinkedid':_0x5edc94[_0x7ace('0xb')],'transfereechannel':_0x5edc94['transfereechannel'],'transfereecalleridnum':_0x5edc94[_0x7ace('0xc')],'transfereecalleridname':_0x5edc94[_0x7ace('0xd')],'transfereeconnectedlinenum':_0x5edc94[_0x7ace('0xe')],'transfereeconnectedlinename':_0x5edc94[_0x7ace('0xf')],'transfereeaccountcode':_0x5edc94[_0x7ace('0x10')],'transfereecontext':_0x5edc94[_0x7ace('0x11')],'transfereeexten':_0x5edc94[_0x7ace('0x12')],'transfereelinkedid':_0x5edc94['transfereelinkedid'],'isexternal':_0x5edc94[_0x7ace('0x13')],'context':_0x5edc94[_0x7ace('0x14')],'extension':_0x5edc94[_0x7ace('0x15')],'type':_0x7ace('0x16')},'log':_0x7ace('0x3')});};exports[_0x7ace('0x17')]=function(_0x56b03c){return client[_0x7ace('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x56b03c[_0x7ace('0x18')],'transfererchannel':_0x56b03c[_0x7ace('0x19')],'transferercalleridnum':_0x56b03c[_0x7ace('0x1a')],'transferercalleridname':_0x56b03c[_0x7ace('0x1b')],'transfererconnectedlinenum':_0x56b03c[_0x7ace('0x1c')],'transfererconnectedlinename':_0x56b03c[_0x7ace('0x1d')],'transfereraccountcode':_0x56b03c['origtransfereraccountcode'],'transferercontext':_0x56b03c[_0x7ace('0x1e')],'transfererexten':_0x56b03c['secondtransfererexten'],'transfererlinkedid':_0x56b03c[_0x7ace('0x1f')],'transfereechannel':_0x56b03c[_0x7ace('0x20')],'transfereecalleridnum':_0x56b03c['transfertargetcalleridnum'],'transfereecalleridname':_0x56b03c[_0x7ace('0x21')],'transfereeconnectedlinenum':_0x56b03c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x56b03c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x56b03c[_0x7ace('0x22')],'transfereecontext':_0x56b03c['transfertargetcontext'],'transfereeexten':_0x56b03c[_0x7ace('0x23')],'transfereelinkedid':_0x56b03c[_0x7ace('0x24')],'isexternal':_0x56b03c[_0x7ace('0x13')],'context':_0x56b03c[_0x7ace('0x25')],'extension':_0x56b03c['origtransfererexten'],'type':_0x7ace('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c16c833..e13f9ca 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 _0x5075=['resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','exten','context','telephones','outbound','run','event','emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../model/voiceQueueSummary','listen','SIP','name','timers','timer','agents','pause','QueuePause','error','asterisk','username','join','pick','keys','reload','module','action','Reload','Action','then','message','catch','isConnected','ami\x20disconnected','command','Command','content','voiceQueues','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','format','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist'];(function(_0x4c189c,_0x5950b9){var _0x2b9101=function(_0x35749f){while(--_0x35749f){_0x4c189c['push'](_0x4c189c['shift']());}};_0x2b9101(++_0x5950b9);}(_0x5075,0x73));var _0x5507=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x5075[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var jayson=require(_0x5507('0x2'));var schema=require(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var config=require(_0x5507('0x5'));var properties=require(_0x5507('0x6'));var ami=require('../ami');var VoiceQueueSummary=require(_0x5507('0x7'));exports[_0x5507('0x8')]=function(_0x8fb8a3,_0x54267f,_0x5b6d7f){return new Promise(function(_0x2cd9ee,_0x773559){var _0x4c2d6d={'QueuePause':function(_0x42c232){return new Promise(function(_0x7cc84c){var _0xbf4b50=util['format']('%s/%s',_0x5507('0x9'),_0x42c232[_0x5507('0xa')]);if(_0x8fb8a3[_0x5507('0xb')]&&_0x8fb8a3[_0x5507('0xb')][_0xbf4b50]&&_0x8fb8a3['timers'][_0xbf4b50][_0x5507('0xc')]){_0x8fb8a3[_0x5507('0xb')][_0xbf4b50]['updateAcw']();}if(_0x8fb8a3[_0x5507('0xd')][_0xbf4b50]){_0x8fb8a3[_0x5507('0xd')][_0xbf4b50]['updateStatusRealtime']({'statePause':_0x42c232[_0x5507('0xe')]?!![]:![]});}_0x7cc84c({'code':0xc8,'message':_0x5507('0xf')});});},'Reload':function(_0x32c872){var _0x267f27=this;return new Promise(function(_0x13b60a,_0x1f3886){if(ami['isConnected']()==![]){return _0x1f3886(_0x267f27[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],'ami\x20disconnected'][_0x5507('0x13')]('\x20')));}_0x32c872=_[_0x5507('0x14')](_0x32c872,_[_0x5507('0x15')](properties[_0x5507('0x16')][_0x5507('0x17')]));_0x32c872[_0x5507('0x18')]=_0x5507('0x19');return ami[_0x5507('0x1a')](_0x32c872)[_0x5507('0x1b')](function(_0x2f0c7d){_0x13b60a({'code':0xc8,'message':_0x2f0c7d[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x3822dd){_0x1f3886(_0x267f27['error'](0x1f5,_0x3822dd[_0x5507('0x1c')]));});});},'Command':function(_0x276a81){var _0x4054c6=this;return new Promise(function(_0x193eda,_0x54f473){if(ami[_0x5507('0x1e')]()==![]){return _0x54f473(_0x4054c6[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')]['join']('\x20')));}_0x276a81=_[_0x5507('0x14')](_0x276a81,_0x5507('0x20'));_0x276a81[_0x5507('0x18')]=_0x5507('0x21');return ami[_0x5507('0x1a')](_0x276a81)[_0x5507('0x1b')](function(_0x1fcc8d){_0x193eda({'code':0xc8,'message':_0x1fcc8d[_0x5507('0x22')]});})[_0x5507('0x1d')](function(_0xa47641){_0x54f473(_0x4054c6[_0x5507('0x10')](0x1f5,_0xa47641[_0x5507('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x164ac7){var _0x2ee6ed=[];for(var _0x1a2203 in _0x8fb8a3['voiceQueues']){if(_0x8fb8a3[_0x5507('0x23')]['hasOwnProperty'](_0x1a2203)){var _0x26335e=_0x8fb8a3['voiceQueues'][_0x1a2203];var _0xa66a01=new VoiceQueueSummary(_0x26335e);_0x2ee6ed[_0x5507('0x24')](_0xa66a01);}}_0x164ac7({'count':_0x2ee6ed['length'],'rows':_0x2ee6ed});});},'UpdateVoiceQueue':function(_0x5cbb09){return new Promise(function(_0xbe8d32,_0x1a18d0){var _0x5912d4=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x23')],{'id':parseInt(_0x5cbb09['id'])});var _0x85d383=_[_0x5507('0x26')](_0x5cbb09,['id']);if(_0x5912d4){for(var _0x1e5ce6 in _0x85d383){if(typeof _0x85d383[_0x1e5ce6]!==_0x5507('0x27')&&typeof _0x5912d4[_0x1e5ce6]!=='undefined'){_0x5912d4[_0x1e5ce6]=_0x85d383[_0x1e5ce6];}}_0xbe8d32(_0x5912d4);}else{_0x1a18d0();}});},'VoiceChannels':function(){return new Promise(function(_0x4422ef){var _0x9c1468=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x29')]);_0x4422ef({'count':_0x9c1468[_0x5507('0x2a')],'rows':_0x9c1468});});},'VoiceChannelMixMonitor':function(_0x495bbe){var _0x51e692=this;return new Promise(function(_0x3b09be,_0x37c364){if(ami[_0x5507('0x1e')]()==![]){return _0x37c364(_0x51e692[_0x5507('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x3cf04d=schema(properties[_0x5507('0x2b')])[_0x5507('0x3')](_0x495bbe);if(_0x3cf04d[_0x5507('0x2a')]>0x0){return _0x37c364(_0x51e692['error'](0x1f4,_[_0x5507('0x2c')](_0x3cf04d,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x51ca35=_['find'](_0x8fb8a3[_0x5507('0x29')],{'uniqueid':_0x495bbe[_0x5507('0x2d')]});if(_0x51ca35&&_0x51ca35[_0x5507('0x2e')]){var _0x17d01c=util[_0x5507('0x2f')]('%s.%s',_0x495bbe['filename']||_0x495bbe[_0x5507('0x2d')],_0x495bbe[_0x5507('0x2f')]||_0x5507('0x30'));return ami[_0x5507('0x1a')]({'action':'MixMonitor','channel':_0x51ca35['channel'],'file':_0x17d01c,'options':_0x5507('0x31')})['then'](function(_0x304daf){var _0x1b32a7=_[_0x5507('0x25')](_0x51ca35[_0x5507('0x32')],{'filename':_0x5507('0x33')+_0x17d01c[_0x5507('0x34')]()});if(_[_0x5507('0x35')](_0x1b32a7)){_0x51ca35[_0x5507('0x32')][_0x5507('0x24')]({'filename':_0x5507('0x33')+_0x17d01c['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x304daf['mixmonitorid'],'status':_0x5507('0x36')});}else{_0x1b32a7[_0x5507('0x37')]=_0x304daf[_0x5507('0x37')];_0x1b32a7[_0x5507('0x38')]=_0x5507('0x36');}_0x3b09be({'code':0xc8,'message':[_0x495bbe[_0x5507('0x2d')],_0x5507('0x39'),_0x304daf[_0x5507('0x37')]][_0x5507('0x13')]('\x20'),'mixmonitorid':_0x304daf[_0x5507('0x37')]});})[_0x5507('0x1d')](function(_0x2e2307){_0x37c364(_0x51e692[_0x5507('0x10')](0x1f5,[_0x495bbe[_0x5507('0x2d')],_0x2e2307['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x37c364(_0x51e692[_0x5507('0x10')](0x1f5,_0x5507('0x3a')));}});},'VoiceChannelStopMixMonitor':function(_0x417022){var _0x245b0a=this;return new Promise(function(_0xcd4df5,_0x17d7db){if(ami[_0x5507('0x1e')]()==![]){return _0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x25496b=schema(properties[_0x5507('0x2b')])[_0x5507('0x3')](_0x417022);if(_0x25496b[_0x5507('0x2a')]>0x0){return _0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x25496b,'message')[_0x5507('0x13')](',\x20')));}var _0x113f74=_['find'](_0x8fb8a3['channels'],{'uniqueid':_0x417022[_0x5507('0x2d')]});if(_0x113f74){return Promise[_0x5507('0x3b')]()[_0x5507('0x1b')](function(){if(_0x113f74[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'StopMixMonitor','channel':_0x113f74[_0x5507('0x2e')],'mixmonitorid':_0x417022[_0x5507('0x37')]})[_0x5507('0x1d')](function(){});}})['then'](function(){if(_0x113f74[_0x5507('0x3c')]){return ami[_0x5507('0x1a')]({'action':_0x5507('0x3d'),'channel':_0x113f74[_0x5507('0x3c')],'mixmonitorid':_0x417022[_0x5507('0x37')]})['catch'](function(){});}})[_0x5507('0x1b')](function(){var _0x505918=_[_0x5507('0x25')](_0x113f74[_0x5507('0x32')],{'mixmonitorid':_0x417022[_0x5507('0x37')]});if(_0x505918){_0x505918[_0x5507('0x38')]=_0x5507('0x3e');}})[_0x5507('0x1b')](function(){var _0x418c2e=util[_0x5507('0x2f')]('%s.%s',_0x417022[_0x5507('0x3f')]||_0x417022[_0x5507('0x2d')],_0x417022['format']||'wav');var _0x4e5825=_[_0x5507('0x25')](_0x113f74['monitors'],{'filename':_0x5507('0x33')+_0x418c2e['toLowerCase']()});if(_0x4e5825){_0x4e5825[_0x5507('0x38')]='stop';}})['then'](function(){_0xcd4df5({'code':0xc8,'message':[_0x417022[_0x5507('0x2d')],_0x5507('0x40')][_0x5507('0x13')]('\x20')});})[_0x5507('0x1d')](function(_0x26d854){_0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f5,[_0x417022['uniqueid'],_0x26d854[_0x5507('0x1c')][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')));});}else{return _0x17d7db(_0x245b0a['error'](0x1f5,_0x5507('0x3a')));}});},'VoiceQueuesChannels':function(_0xe4b14c){var _0x505e71=this;return new Promise(function(_0x2e0cfc){var _0x300c9f=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x41')]);var _0x34f197={'count':_0x300c9f[_0x5507('0x2a')],'rows':_0x300c9f};if(_0xe4b14c&&_0xe4b14c[_0x5507('0x42')]){if(![_0x5507('0x43'),'outbound']['includes'](_0xe4b14c[_0x5507('0x42')])){return _0x773559(_0x505e71[_0x5507('0x10')](0x190,_0x5507('0x44')));}var _0x1b34c8=_[_0x5507('0x45')](_0x300c9f,function(_0x10de3c){return _0x10de3c[_0x5507('0x42')]===_0xe4b14c[_0x5507('0x42')];});_0x34f197[_0x5507('0x46')]=_0x1b34c8[_0x5507('0x2a')];_0x34f197[_0x5507('0x47')]=_0x1b34c8;}_0x2e0cfc(_0x34f197);});},'VoiceQueuesChannel':function(_0x13dc8b){var _0x3e044c=this;return new Promise(function(_0x12de2d,_0x23412f){var _0x15082b=schema(properties['voicequeuechannel'])[_0x5507('0x3')](_0x13dc8b);if(_0x15082b['length']>0x0){return _0x23412f(_0x3e044c['error'](0x1f4,_[_0x5507('0x2c')](_0x15082b,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x3ba05c=_['find'](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0x13dc8b[_0x5507('0x2d')]});if(_0x3ba05c){_0x12de2d(_0x3ba05c);}else{return _0x23412f(_0x3e044c[_0x5507('0x10')](0x1f5,_0x5507('0x3a')));}});},'VoiceQueuesChannelHangup':function(_0x2a8d18){var _0x3a272f=this;return new Promise(function(_0x5d2881,_0x36b485){if(ami[_0x5507('0x1e')]()==![]){return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x5507('0x12')],'ami\x20disconnected'][_0x5507('0x13')]('\x20')));}var _0x1e1a65=schema(properties['voicequeuechannelhangup'])[_0x5507('0x3')](_0x2a8d18);if(_0x1e1a65[_0x5507('0x2a')]>0x0){return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x1e1a65,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x28b3a2=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0x2a8d18[_0x5507('0x2d')]});if(_0x28b3a2&&_0x28b3a2[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'Hangup','channel':_0x28b3a2[_0x5507('0x2e')]})[_0x5507('0x1b')](function(_0x219e34){_0x5d2881({'code':0xc8,'message':[_0x2a8d18[_0x5507('0x2d')],_0x219e34[_0x5507('0x1c')]['toLowerCase']()][_0x5507('0x13')]('\x20')});})['catch'](function(_0x3bd7ce){_0x36b485(_0x3a272f[_0x5507('0x10')](0x1f5,[_0x2a8d18[_0x5507('0x2d')],_0x3bd7ce['message'][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')));});}else{return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xf540bd){var _0x5cfdb0=this;return new Promise(function(_0x3dca7d,_0x5545ad){if(ami['isConnected']()==![]){return _0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x4bf567=schema(properties['voicequeuechannelredirect'])[_0x5507('0x3')](_0xf540bd);if(_0x4bf567[_0x5507('0x2a')]>0x0){return _0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x4bf567,'message')[_0x5507('0x13')](',\x20')));}var _0x23a738=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0xf540bd[_0x5507('0x2d')]});if(_0x23a738&&_0x23a738[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'Redirect','channel':_0x23a738[_0x5507('0x2e')],'exten':_0xf540bd[_0x5507('0x48')],'context':_0xf540bd[_0x5507('0x49')]||_0x23a738['context'],'priority':0x1})[_0x5507('0x1b')](function(_0x4d3f1a){_0x3dca7d({'code':0xc8,'message':[_0xf540bd['uniqueid'],_0x4d3f1a['message'][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')});})[_0x5507('0x1d')](function(_0x10e409){_0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f5,[_0xf540bd[_0x5507('0x2d')],_0x10e409[_0x5507('0x1c')]['toLowerCase']()][_0x5507('0x13')]('\x20')));});}else{return _0x5545ad(_0x5cfdb0['error'](0x1f5,_0x5507('0x3a')));}});},'Agents':function(_0x1c16b8){return new Promise(function(_0x40f2d9){var _0x98768c=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0xd')]);if(_0x1c16b8&&_0x1c16b8['id']){var _0x4423a8=_[_0x5507('0x25')](_0x98768c,function(_0x2f8164){return _0x2f8164['id']===_0x1c16b8['id'];});_0x40f2d9(_0x4423a8);}else{_0x40f2d9({'count':_0x98768c[_0x5507('0x2a')],'rows':_0x98768c});}});},'Telephones':function(){return new Promise(function(_0x259a87){var _0x5776f4=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x4a')]);_0x259a87({'count':_0x5776f4[_0x5507('0x2a')],'rows':_0x5776f4});});},'Trunks':function(){return new Promise(function(_0x4d1aff){var _0x33f8b8=_[_0x5507('0x28')](_0x8fb8a3['trunks']);_0x4d1aff({'count':_0x33f8b8[_0x5507('0x2a')],'rows':_0x33f8b8});});},'OutboundChannels':function(){return new Promise(function(_0x5815fb){var _0x5c0c7a=_[_0x5507('0x28')](_0x8fb8a3['outboundChannels']);_0x5815fb({'count':_0x5c0c7a[_0x5507('0x2a')],'rows':_0x5c0c7a});});},'Outbound':function(){return new Promise(function(_0x43edf7){_0x43edf7(_0x8fb8a3[_0x5507('0x4b')]);});},'Campaigns':function(){return new Promise(function(_0xda51d5){var _0xbb4353=_[_0x5507('0x28')](_0x8fb8a3['campaigns']);_0xda51d5({'count':_0xbb4353[_0x5507('0x2a')],'rows':_0xbb4353});});},'VoiceQueuesPreview':function(_0x323dbf){var _0x3b212b=this;return new Promise(function(_0x75aa3c,_0x10427f){_0x54267f[_0x5507('0x4c')](_0x323dbf['id'])[_0x5507('0x1b')](function(_0x3f5a27){_0x75aa3c({'code':0xc8,'message':_0x3f5a27[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x130039){_0x10427f(_0x3b212b[_0x5507('0x10')](0x1f4,_0x130039['message']));});});},'EventManager':function(_0x255b14){var _0x3e8804=this;return new Promise(function(_0x10f066,_0x2afdac){if(!_0x255b14[_0x5507('0x4d')]){return _0x2afdac(_0x3e8804[_0x5507('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x5507('0x4e')]('custom:'+_0x255b14[_0x5507('0x4d')],_0x255b14['message']);_0x10f066({'code':0xc8,'message':_0x255b14});});},'FaxAccounts':function(){return new Promise(function(_0x561c21){var _0x15bb7b=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x4f')]);_0x561c21({'count':_0x15bb7b[_0x5507('0x2a')],'rows':_0x15bb7b});});},'SendFax':function(_0x447e8d){var _0x58bc65=this;return new Promise(function(_0x255226,_0x53fd44){_0x5b6d7f[_0x5507('0x50')](_0x447e8d)[_0x5507('0x1b')](function(_0x163de3){_0x255226({'code':0xc8,'message':_0x163de3[_0x5507('0x1c')]});})['catch'](function(_0x2470ed){_0x53fd44(_0x58bc65[_0x5507('0x10')](0x1f4,_0x2470ed[_0x5507('0x1c')]));});});},'CheckAfterSend':function(_0x5a8a1b){var _0x56500e=this;return new Promise(function(_0x1396fc,_0x10f905){_0x5b6d7f[_0x5507('0x51')](_0x5a8a1b)[_0x5507('0x1b')](function(_0x77a772){_0x1396fc({'code':0xc8,'message':_0x77a772[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x10b62e){_0x10f905(_0x56500e[_0x5507('0x10')](0x1f4,_0x10b62e[_0x5507('0x1c')]));});});}};var _0x205ebc=jayson[_0x5507('0x52')](_0x4c2d6d)['http']();_0x205ebc['on'](_0x5507('0x10'),function(_0x369531){return _0x773559(_0x369531);});_0x205ebc[_0x5507('0x8')](0x232a,_0x5507('0x53'),function(){console[_0x5507('0x54')](_0x5507('0x55'),0x232a);return _0x2cd9ee(_0x5507('0x56')+0x232a);});});}; \ No newline at end of file +var _0x6f47=['context','telephones','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','moment','../properties','../model/voiceQueueSummary','listen','format','%s/%s','SIP','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','ami\x20disconnected','join','pick','keys','reload','module','action','Reload','Action','then','message','catch','asterisk','content','voiceQueues','push','length','omit','undefined','channels','username','voicechannel','validate','map','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','values','type','outbound','includes','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6f47,0xc7));var _0x76f4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6f47[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var jayson=require(_0x76f4('0x1'));var schema=require('validate');var moment=require(_0x76f4('0x2'));var config=require('../../../config/environment');var properties=require(_0x76f4('0x3'));var ami=require('../ami');var VoiceQueueSummary=require(_0x76f4('0x4'));exports[_0x76f4('0x5')]=function(_0x2795ee,_0x2523ba,_0x5754ca){return new Promise(function(_0x35602f,_0xfc2405){var _0x2176a7={'QueuePause':function(_0x497f99){return new Promise(function(_0x1a3172){var _0x25656d=util[_0x76f4('0x6')](_0x76f4('0x7'),_0x76f4('0x8'),_0x497f99['name']);if(_0x2795ee['timers']&&_0x2795ee[_0x76f4('0x9')][_0x25656d]&&_0x2795ee[_0x76f4('0x9')][_0x25656d]['timer']){_0x2795ee['timers'][_0x25656d][_0x76f4('0xa')]();}if(_0x2795ee[_0x76f4('0xb')][_0x25656d]){_0x2795ee[_0x76f4('0xb')][_0x25656d][_0x76f4('0xc')]({'statePause':_0x497f99[_0x76f4('0xd')]?!![]:![]});}_0x1a3172({'code':0xc8,'message':_0x76f4('0xe')});});},'Reload':function(_0xf7e347){var _0x3ec740=this;return new Promise(function(_0x2157f9,_0x4b53ac){if(ami[_0x76f4('0xf')]()==![]){return _0x4b53ac(_0x3ec740[_0x76f4('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x76f4('0x11')][_0x76f4('0x12')]('\x20')));}_0xf7e347=_[_0x76f4('0x13')](_0xf7e347,_[_0x76f4('0x14')](properties[_0x76f4('0x15')][_0x76f4('0x16')]));_0xf7e347[_0x76f4('0x17')]=_0x76f4('0x18');return ami[_0x76f4('0x19')](_0xf7e347)[_0x76f4('0x1a')](function(_0x672960){_0x2157f9({'code':0xc8,'message':_0x672960[_0x76f4('0x1b')]});})[_0x76f4('0x1c')](function(_0x38450e){_0x4b53ac(_0x3ec740[_0x76f4('0x10')](0x1f5,_0x38450e[_0x76f4('0x1b')]));});});},'Command':function(_0xfedbe4){var _0x3e809f=this;return new Promise(function(_0x435534,_0x35b406){if(ami[_0x76f4('0xf')]()==![]){return _0x35b406(_0x3e809f[_0x76f4('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x76f4('0x1d')]['username'],_0x76f4('0x11')][_0x76f4('0x12')]('\x20')));}_0xfedbe4=_[_0x76f4('0x13')](_0xfedbe4,'command');_0xfedbe4['action']='Command';return ami[_0x76f4('0x19')](_0xfedbe4)[_0x76f4('0x1a')](function(_0x14bfe5){_0x435534({'code':0xc8,'message':_0x14bfe5[_0x76f4('0x1e')]});})[_0x76f4('0x1c')](function(_0x4786c9){_0x35b406(_0x3e809f[_0x76f4('0x10')](0x1f5,_0x4786c9['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x504aa8){var _0x3794fa=[];for(var _0x497913 in _0x2795ee[_0x76f4('0x1f')]){if(_0x2795ee['voiceQueues']['hasOwnProperty'](_0x497913)){var _0x4f6087=_0x2795ee[_0x76f4('0x1f')][_0x497913];var _0x38300d=new VoiceQueueSummary(_0x4f6087);_0x3794fa[_0x76f4('0x20')](_0x38300d);}}_0x504aa8({'count':_0x3794fa[_0x76f4('0x21')],'rows':_0x3794fa});});},'UpdateVoiceQueue':function(_0x13d219){return new Promise(function(_0x447dbc,_0x5ca31f){var _0x306cb4=_['find'](_0x2795ee['voiceQueues'],{'id':parseInt(_0x13d219['id'])});var _0x5b3f07=_[_0x76f4('0x22')](_0x13d219,['id']);if(_0x306cb4){for(var _0x30f02e in _0x5b3f07){if(typeof _0x5b3f07[_0x30f02e]!==_0x76f4('0x23')&&typeof _0x306cb4[_0x30f02e]!==_0x76f4('0x23')){_0x306cb4[_0x30f02e]=_0x5b3f07[_0x30f02e];}}_0x447dbc(_0x306cb4);}else{_0x5ca31f();}});},'VoiceChannels':function(){return new Promise(function(_0x54f854){var _0x431b33=_['values'](_0x2795ee[_0x76f4('0x24')]);_0x54f854({'count':_0x431b33[_0x76f4('0x21')],'rows':_0x431b33});});},'VoiceChannelMixMonitor':function(_0x43ac4a){var _0x1c2c5c=this;return new Promise(function(_0x4f41c7,_0x5a6fd4){if(ami['isConnected']()==![]){return _0x5a6fd4(_0x1c2c5c[_0x76f4('0x10')](0x1f4,[config[_0x76f4('0x1d')]['ip'],config[_0x76f4('0x1d')][_0x76f4('0x25')],_0x76f4('0x11')][_0x76f4('0x12')]('\x20')));}var _0x2a13ca=schema(properties[_0x76f4('0x26')])[_0x76f4('0x27')](_0x43ac4a);if(_0x2a13ca[_0x76f4('0x21')]>0x0){return _0x5a6fd4(_0x1c2c5c[_0x76f4('0x10')](0x1f4,_[_0x76f4('0x28')](_0x2a13ca,'message')['join'](',\x20')));}var _0x5c8ecc=_['find'](_0x2795ee[_0x76f4('0x24')],{'uniqueid':_0x43ac4a[_0x76f4('0x29')]});if(_0x5c8ecc&&_0x5c8ecc[_0x76f4('0x2a')]){var _0x456b1f=util[_0x76f4('0x6')]('%s.%s',_0x43ac4a[_0x76f4('0x2b')]||_0x43ac4a[_0x76f4('0x29')],_0x43ac4a[_0x76f4('0x6')]||_0x76f4('0x2c'));return ami[_0x76f4('0x19')]({'action':_0x76f4('0x2d'),'channel':_0x5c8ecc[_0x76f4('0x2a')],'file':_0x456b1f,'options':_0x76f4('0x2e')})[_0x76f4('0x1a')](function(_0xdce828){var _0x6953ca=_[_0x76f4('0x2f')](_0x5c8ecc[_0x76f4('0x30')],{'filename':_0x76f4('0x31')+_0x456b1f[_0x76f4('0x32')]()});if(_[_0x76f4('0x33')](_0x6953ca)){_0x5c8ecc[_0x76f4('0x30')][_0x76f4('0x20')]({'filename':'/var/spool/asterisk/monitor/'+_0x456b1f[_0x76f4('0x32')](),'createdAt':moment()[_0x76f4('0x6')](_0x76f4('0x34')),'mixmonitorid':_0xdce828['mixmonitorid'],'status':'rec'});}else{_0x6953ca[_0x76f4('0x35')]=_0xdce828['mixmonitorid'];_0x6953ca[_0x76f4('0x36')]='rec';}_0x4f41c7({'code':0xc8,'message':[_0x43ac4a[_0x76f4('0x29')],_0x76f4('0x37'),_0xdce828[_0x76f4('0x35')]][_0x76f4('0x12')]('\x20'),'mixmonitorid':_0xdce828[_0x76f4('0x35')]});})[_0x76f4('0x1c')](function(_0x21ae82){_0x5a6fd4(_0x1c2c5c[_0x76f4('0x10')](0x1f5,[_0x43ac4a[_0x76f4('0x29')],_0x21ae82[_0x76f4('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x5a6fd4(_0x1c2c5c[_0x76f4('0x10')](0x1f5,_0x76f4('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x364cf7){var _0x427c70=this;return new Promise(function(_0x2b7dc8,_0x2d6068){if(ami[_0x76f4('0xf')]()==![]){return _0x2d6068(_0x427c70[_0x76f4('0x10')](0x1f4,[config[_0x76f4('0x1d')]['ip'],config['asterisk'][_0x76f4('0x25')],_0x76f4('0x11')]['join']('\x20')));}var _0x5ad90a=schema(properties[_0x76f4('0x26')])[_0x76f4('0x27')](_0x364cf7);if(_0x5ad90a[_0x76f4('0x21')]>0x0){return _0x2d6068(_0x427c70[_0x76f4('0x10')](0x1f4,_[_0x76f4('0x28')](_0x5ad90a,'message')[_0x76f4('0x12')](',\x20')));}var _0x4126aa=_[_0x76f4('0x2f')](_0x2795ee[_0x76f4('0x24')],{'uniqueid':_0x364cf7[_0x76f4('0x29')]});if(_0x4126aa){return Promise[_0x76f4('0x39')]()['then'](function(){if(_0x4126aa[_0x76f4('0x2a')]){return ami[_0x76f4('0x19')]({'action':_0x76f4('0x3a'),'channel':_0x4126aa['channel'],'mixmonitorid':_0x364cf7['mixmonitorid']})[_0x76f4('0x1c')](function(){});}})[_0x76f4('0x1a')](function(){if(_0x4126aa[_0x76f4('0x3b')]){return ami[_0x76f4('0x19')]({'action':_0x76f4('0x3a'),'channel':_0x4126aa['destinationchannel'],'mixmonitorid':_0x364cf7['mixmonitorid']})[_0x76f4('0x1c')](function(){});}})['then'](function(){var _0x42b30d=_[_0x76f4('0x2f')](_0x4126aa['monitors'],{'mixmonitorid':_0x364cf7['mixmonitorid']});if(_0x42b30d){_0x42b30d[_0x76f4('0x36')]=_0x76f4('0x3c');}})[_0x76f4('0x1a')](function(){var _0x217d3a=util['format'](_0x76f4('0x3d'),_0x364cf7[_0x76f4('0x2b')]||_0x364cf7[_0x76f4('0x29')],_0x364cf7['format']||_0x76f4('0x2c'));var _0x6bbcf2=_['find'](_0x4126aa['monitors'],{'filename':_0x76f4('0x31')+_0x217d3a[_0x76f4('0x32')]()});if(_0x6bbcf2){_0x6bbcf2[_0x76f4('0x36')]=_0x76f4('0x3c');}})[_0x76f4('0x1a')](function(){_0x2b7dc8({'code':0xc8,'message':[_0x364cf7['uniqueid'],_0x76f4('0x3e')]['join']('\x20')});})[_0x76f4('0x1c')](function(_0x3ea748){_0x2d6068(_0x427c70[_0x76f4('0x10')](0x1f5,[_0x364cf7['uniqueid'],_0x3ea748[_0x76f4('0x1b')][_0x76f4('0x32')]()]['join']('\x20')));});}else{return _0x2d6068(_0x427c70[_0x76f4('0x10')](0x1f5,_0x76f4('0x38')));}});},'VoiceQueuesChannels':function(_0x30f687){var _0x1c658c=this;return new Promise(function(_0x40ff20){var _0x479c4b=_[_0x76f4('0x3f')](_0x2795ee['queueChannels']);var _0x45b246={'count':_0x479c4b[_0x76f4('0x21')],'rows':_0x479c4b};if(_0x30f687&&_0x30f687[_0x76f4('0x40')]){if(!['inbound',_0x76f4('0x41')][_0x76f4('0x42')](_0x30f687[_0x76f4('0x40')])){return _0xfc2405(_0x1c658c[_0x76f4('0x10')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x2028e9=_[_0x76f4('0x43')](_0x479c4b,function(_0xaad66b){return _0xaad66b[_0x76f4('0x40')]===_0x30f687['type'];});_0x45b246[_0x76f4('0x44')]=_0x2028e9['length'];_0x45b246[_0x76f4('0x45')]=_0x2028e9;}_0x40ff20(_0x45b246);});},'VoiceQueuesChannel':function(_0x190c8d){var _0x5ca332=this;return new Promise(function(_0x56dee8,_0x266783){var _0x39c9a9=schema(properties[_0x76f4('0x46')])['validate'](_0x190c8d);if(_0x39c9a9[_0x76f4('0x21')]>0x0){return _0x266783(_0x5ca332[_0x76f4('0x10')](0x1f4,_[_0x76f4('0x28')](_0x39c9a9,'message')['join'](',\x20')));}var _0x1b241c=_[_0x76f4('0x2f')](_0x2795ee['queueChannels'],{'uniqueid':_0x190c8d['uniqueid']});if(_0x1b241c){_0x56dee8(_0x1b241c);}else{return _0x266783(_0x5ca332[_0x76f4('0x10')](0x1f5,_0x76f4('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x2cad70){var _0x131861=this;return new Promise(function(_0x4008f9,_0xa8b590){if(ami[_0x76f4('0xf')]()==![]){return _0xa8b590(_0x131861[_0x76f4('0x10')](0x1f4,[config[_0x76f4('0x1d')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x76f4('0x12')]('\x20')));}var _0xc8ae67=schema(properties[_0x76f4('0x47')])[_0x76f4('0x27')](_0x2cad70);if(_0xc8ae67['length']>0x0){return _0xa8b590(_0x131861['error'](0x1f4,_[_0x76f4('0x28')](_0xc8ae67,'message')[_0x76f4('0x12')](',\x20')));}var _0x4d7c69=_[_0x76f4('0x2f')](_0x2795ee[_0x76f4('0x48')],{'uniqueid':_0x2cad70[_0x76f4('0x29')]});if(_0x4d7c69&&_0x4d7c69[_0x76f4('0x2a')]){return ami['Action']({'action':_0x76f4('0x49'),'channel':_0x4d7c69[_0x76f4('0x2a')]})[_0x76f4('0x1a')](function(_0x40c170){_0x4008f9({'code':0xc8,'message':[_0x2cad70[_0x76f4('0x29')],_0x40c170[_0x76f4('0x1b')][_0x76f4('0x32')]()]['join']('\x20')});})[_0x76f4('0x1c')](function(_0x1a9cf3){_0xa8b590(_0x131861[_0x76f4('0x10')](0x1f5,[_0x2cad70[_0x76f4('0x29')],_0x1a9cf3[_0x76f4('0x1b')][_0x76f4('0x32')]()][_0x76f4('0x12')]('\x20')));});}else{return _0xa8b590(_0x131861[_0x76f4('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x493dfb){var _0xa3091a=this;return new Promise(function(_0x617924,_0x3b10dd){if(ami['isConnected']()==![]){return _0x3b10dd(_0xa3091a[_0x76f4('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x76f4('0x1d')][_0x76f4('0x25')],'ami\x20disconnected'][_0x76f4('0x12')]('\x20')));}var _0x37b7f7=schema(properties[_0x76f4('0x4a')])[_0x76f4('0x27')](_0x493dfb);if(_0x37b7f7[_0x76f4('0x21')]>0x0){return _0x3b10dd(_0xa3091a[_0x76f4('0x10')](0x1f4,_[_0x76f4('0x28')](_0x37b7f7,_0x76f4('0x1b'))[_0x76f4('0x12')](',\x20')));}var _0x47a27f=_[_0x76f4('0x2f')](_0x2795ee['queueChannels'],{'uniqueid':_0x493dfb[_0x76f4('0x29')]});if(_0x47a27f&&_0x47a27f[_0x76f4('0x2a')]){return ami[_0x76f4('0x19')]({'action':_0x76f4('0x4b'),'channel':_0x47a27f[_0x76f4('0x2a')],'exten':_0x493dfb[_0x76f4('0x4c')],'context':_0x493dfb[_0x76f4('0x4d')]||_0x47a27f[_0x76f4('0x4d')],'priority':0x1})[_0x76f4('0x1a')](function(_0x373848){_0x617924({'code':0xc8,'message':[_0x493dfb['uniqueid'],_0x373848[_0x76f4('0x1b')][_0x76f4('0x32')]()]['join']('\x20')});})[_0x76f4('0x1c')](function(_0x2db3bc){_0x3b10dd(_0xa3091a[_0x76f4('0x10')](0x1f5,[_0x493dfb['uniqueid'],_0x2db3bc[_0x76f4('0x1b')][_0x76f4('0x32')]()][_0x76f4('0x12')]('\x20')));});}else{return _0x3b10dd(_0xa3091a['error'](0x1f5,_0x76f4('0x38')));}});},'Agents':function(_0x4733a8){return new Promise(function(_0x27cdf9){var _0x1ed3b0=_[_0x76f4('0x3f')](_0x2795ee[_0x76f4('0xb')]);if(_0x4733a8&&_0x4733a8['id']){var _0x19b99c=_[_0x76f4('0x2f')](_0x1ed3b0,function(_0x23fba0){return _0x23fba0['id']===_0x4733a8['id'];});_0x27cdf9(_0x19b99c);}else{_0x27cdf9({'count':_0x1ed3b0['length'],'rows':_0x1ed3b0});}});},'Telephones':function(){return new Promise(function(_0x1ef561){var _0x3137e9=_[_0x76f4('0x3f')](_0x2795ee[_0x76f4('0x4e')]);_0x1ef561({'count':_0x3137e9['length'],'rows':_0x3137e9});});},'Trunks':function(){return new Promise(function(_0x342da8){var _0x1d3882=_[_0x76f4('0x3f')](_0x2795ee['trunks']);_0x342da8({'count':_0x1d3882[_0x76f4('0x21')],'rows':_0x1d3882});});},'OutboundChannels':function(){return new Promise(function(_0x1375d5){var _0x31249b=_[_0x76f4('0x3f')](_0x2795ee[_0x76f4('0x4f')]);_0x1375d5({'count':_0x31249b['length'],'rows':_0x31249b});});},'Outbound':function(){return new Promise(function(_0x344406){_0x344406(_0x2795ee['outbound']);});},'Campaigns':function(){return new Promise(function(_0x2b8467){var _0x2f35d2=_['values'](_0x2795ee['campaigns']);_0x2b8467({'count':_0x2f35d2['length'],'rows':_0x2f35d2});});},'VoiceQueuesPreview':function(_0x3aa958){var _0x462f3e=this;return new Promise(function(_0x1e7b6,_0x3e2a07){_0x2523ba[_0x76f4('0x50')](_0x3aa958['id'])[_0x76f4('0x1a')](function(_0x4b34af){_0x1e7b6({'code':0xc8,'message':_0x4b34af[_0x76f4('0x1b')]});})[_0x76f4('0x1c')](function(_0x402025){_0x3e2a07(_0x462f3e[_0x76f4('0x10')](0x1f4,_0x402025[_0x76f4('0x1b')]));});});},'EventManager':function(_0x1c8973){var _0x307060=this;return new Promise(function(_0x202fc8,_0x59e43c){if(!_0x1c8973[_0x76f4('0x51')]){return _0x59e43c(_0x307060['error'](0x1f4,_0x76f4('0x52')));}ami[_0x76f4('0x53')](_0x76f4('0x54')+_0x1c8973[_0x76f4('0x51')],_0x1c8973[_0x76f4('0x1b')]);_0x202fc8({'code':0xc8,'message':_0x1c8973});});},'FaxAccounts':function(){return new Promise(function(_0x3cbcbd){var _0x36b601=_[_0x76f4('0x3f')](_0x2795ee['faxAccounts']);_0x3cbcbd({'count':_0x36b601[_0x76f4('0x21')],'rows':_0x36b601});});},'SendFax':function(_0x521f00){var _0x5ac2bd=this;return new Promise(function(_0x56621b,_0x15b8d7){_0x5754ca[_0x76f4('0x55')](_0x521f00)[_0x76f4('0x1a')](function(_0xde30b9){_0x56621b({'code':0xc8,'message':_0xde30b9['message']});})[_0x76f4('0x1c')](function(_0x263740){_0x15b8d7(_0x5ac2bd[_0x76f4('0x10')](0x1f4,_0x263740['message']));});});},'CheckAfterSend':function(_0x12f16e){var _0x21ce59=this;return new Promise(function(_0x45d11a,_0x26f331){_0x5754ca[_0x76f4('0x56')](_0x12f16e)[_0x76f4('0x1a')](function(_0x3b5e15){_0x45d11a({'code':0xc8,'message':_0x3b5e15['message']});})[_0x76f4('0x1c')](function(_0xa49e2a){_0x26f331(_0x21ce59['error'](0x1f4,_0xa49e2a[_0x76f4('0x1b')]));});});}};var _0x4478a8=jayson[_0x76f4('0x57')](_0x2176a7)[_0x76f4('0x58')]();_0x4478a8['on'](_0x76f4('0x10'),function(_0x1f62a9){return _0xfc2405(_0x1f62a9);});_0x4478a8[_0x76f4('0x5')](0x232a,_0x76f4('0x59'),function(){console[_0x76f4('0x5a')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x35602f(_0x76f4('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 0bfc95a..c199a7c 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 _0xfc77=['isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','format','trigger:%s','toLowerCase','merge','bluebird','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','info','emit','data1','data2','data5','xmd-contactid','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','updatedAt','union','resolve','then'];(function(_0x1531a9,_0x30bd51){var _0x11b216=function(_0x3cc88f){while(--_0x3cc88f){_0x1531a9['push'](_0x1531a9['shift']());}};_0x11b216(++_0x30bd51);}(_0xfc77,0xe1));var _0x7fc7=function(_0x1aaa57,_0x3b0b60){_0x1aaa57=_0x1aaa57-0x0;var _0x1e33ec=_0xfc77[_0x1aaa57];return _0x1e33ec;};'use strict';var _=require('lodash');var BPromise=require(_0x7fc7('0x0'));var Redis=require('ioredis');var util=require(_0x7fc7('0x1'));var config=require(_0x7fc7('0x2'));var logger=require('../../../../config/logger')(_0x7fc7('0x3'));var cmContactRpc=require(_0x7fc7('0x4'));config[_0x7fc7('0x5')]=_['defaults'](config[_0x7fc7('0x5')],{'host':_0x7fc7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7fc7('0x5')]));function emit(_0x26e48d,_0x4b9627,_0x5bd7a4,_0x650c79,_0x3144c2){logger[_0x7fc7('0x7')]('[CM][%s][%s]',_0x26e48d,_0x4b9627['id'],_0x5bd7a4,_0x650c79,JSON['stringify'](_0x3144c2));io['to'](_0x5bd7a4)[_0x7fc7('0x8')](_0x650c79,_0x3144c2);}exports['exec']=function(_0x2589bb,_0x1ceec4,_0x496000,_0x58885d){var _0x45762e,_0x5903fd;var _0x4fbd56={};var _0x1ac7f4;var _0x4de1e0=Number(_0x496000[_0x7fc7('0x9')]);var _0x28ceb2=_0x496000['data2']?Boolean(Number(_0x496000[_0x7fc7('0xa')])):![];var _0x3aff66;var _0x485619=![];if(!_['isNil'](_0x496000['data5'])){if(_0x496000[_0x7fc7('0xb')]=='1')_0x485619=!![];}if(!_0x485619){if(_0x58885d[_0x7fc7('0xc')]){_0x4fbd56['id']=_0x58885d[_0x7fc7('0xc')];}}if(!_0x4fbd56['id']){_0x4fbd56['ListId']=_0x4de1e0;_0x3aff66=_0x496000[_0x7fc7('0xd')]&&_0x496000[_0x7fc7('0xd')]!=='0'?_0x496000[_0x7fc7('0xd')]['split'](','):[_0x7fc7('0xe')];_0x4fbd56[_0x7fc7('0xf')]=_[_0x7fc7('0x10')](_0x3aff66,function(_0x29bf27){var _0x429028={};_0x429028[_0x29bf27]=_0x58885d[_0x7fc7('0x11')]?_0x58885d[_0x7fc7('0x12')]:_0x58885d['calleridnum'];return _0x429028;});_0x1ac7f4=_0x58885d['routeId']?_0x58885d['destcalleridnum']:_0x58885d[_0x7fc7('0x13')];}var _0x2f17d9=['id',_0x7fc7('0x14'),_0x7fc7('0x15'),_0x7fc7('0xe'),_0x7fc7('0x16'),_0x7fc7('0x17'),_0x7fc7('0x18'),_0x7fc7('0x19'),'scheduledAt',_0x7fc7('0x1a')];var _0x3332d1=_[_0x7fc7('0x1b')](_0x2f17d9,_0x3aff66);BPromise[_0x7fc7('0x1c')]()[_0x7fc7('0x1d')](cmContactRpc['getContacts']({'attributes':_0x3332d1,'where':_0x4fbd56,'phone':_0x1ac7f4}))[_0x7fc7('0x1d')](function(_0x31c136){_0x5903fd=_0x31c136;if(!_[_0x7fc7('0x1e')](_0x5903fd)){if(_0x5903fd['length']===0x1){_0x45762e=_0x5903fd[0x0];logger[_0x7fc7('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id'],_0x45762e['id']);}else{logger[_0x7fc7('0x7')](_0x7fc7('0x20'),_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id'],_[_0x7fc7('0x10')](_0x5903fd,'id')[_0x7fc7('0x21')](','));}return;}else{logger['info'](_0x7fc7('0x22'),_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id']);var _0x3f5a48={'ListId':_0x4de1e0};var _0x5042e0=_0x496000[_0x7fc7('0x23')]&&_0x496000[_0x7fc7('0x23')]!=='0'?_0x496000[_0x7fc7('0x23')]:_0x7fc7('0xe');if(_0x28ceb2){logger['info'](_0x7fc7('0x24'),_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id']);_0x3f5a48[_0x5042e0]=_[_0x7fc7('0x25')](_0x58885d[_0x7fc7('0x11')])?_0x58885d['calleridnum']:_0x58885d[_0x7fc7('0x12')];if(_[_0x7fc7('0x25')](_0x58885d[_0x7fc7('0x11')])){_0x3f5a48[_0x7fc7('0x14')]=_0x58885d['calleridname']&&_0x58885d['calleridname']!==''?_0x58885d[_0x7fc7('0x26')]:_0x7fc7('0x27');}else{_0x3f5a48[_0x7fc7('0x14')]=_0x58885d[_0x7fc7('0x28')]&&_0x58885d[_0x7fc7('0x28')]!==_0x7fc7('0x29')?_0x58885d[_0x7fc7('0x28')]:_0x7fc7('0x27');}return BPromise['resolve']()[_0x7fc7('0x1d')](cmContactRpc[_0x7fc7('0x2a')](_0x3f5a48))[_0x7fc7('0x1d')](function(_0x4c221c){_0x45762e=_0x4c221c;_0x5903fd[_0x7fc7('0x2b')](_0x4c221c);if(_0x45762e){logger[_0x7fc7('0x7')](_0x7fc7('0x2c'),_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id'],_0x45762e['id']);}return;});}else{logger[_0x7fc7('0x7')](_0x7fc7('0x2d'),_0x58885d[_0x7fc7('0x1f')],_0x1ceec4['id']);_0x3f5a48[_0x5042e0]=_[_0x7fc7('0x25')](_0x58885d[_0x7fc7('0x11')])?_0x58885d[_0x7fc7('0x13')]:_0x58885d[_0x7fc7('0x12')];if(_[_0x7fc7('0x25')](_0x58885d[_0x7fc7('0x11')])){_0x3f5a48[_0x7fc7('0x14')]=_0x58885d[_0x7fc7('0x26')]&&_0x58885d['calleridname']!==_0x7fc7('0x29')?_0x58885d[_0x7fc7('0x26')]:_0x7fc7('0x27');}else{_0x3f5a48[_0x7fc7('0x14')]=_0x58885d[_0x7fc7('0x28')]&&_0x58885d['destcalleridname']!==_0x7fc7('0x29')?_0x58885d[_0x7fc7('0x28')]:_0x7fc7('0x27');}_0x45762e=_0x3f5a48;_0x5903fd['push'](_0x3f5a48);return;}}})[_0x7fc7('0x1d')](function(){if(_0x2589bb){emit(_0x58885d[_0x7fc7('0x1f')],_0x1ceec4,util['format'](_0x7fc7('0x2e'),_0x2589bb['name']),util[_0x7fc7('0x2f')](_0x7fc7('0x30'),_0x496000['action'][_0x7fc7('0x31')]()),{'evt':_[_0x7fc7('0x32')](_0x58885d,{'autoCreate':_0x28ceb2}),'contact':_0x45762e===undefined?{}:_0x45762e,'contacts':_0x5903fd['length']===0x0?undefined:_0x5903fd});}});}; \ No newline at end of file +var _0x4131=['user:%s','trigger:%s','action','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','format'];(function(_0xfb0801,_0x1ae851){var _0x1699c3=function(_0x2d47fb){while(--_0x2d47fb){_0xfb0801['push'](_0xfb0801['shift']());}};_0x1699c3(++_0x1ae851);}(_0x4131,0x10e));var _0x1413=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x4131[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require(_0x1413('0x0'));var BPromise=require(_0x1413('0x1'));var Redis=require(_0x1413('0x2'));var util=require(_0x1413('0x3'));var config=require(_0x1413('0x4'));var logger=require(_0x1413('0x5'))('trigger');var cmContactRpc=require(_0x1413('0x6'));config[_0x1413('0x7')]=_[_0x1413('0x8')](config[_0x1413('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1413('0x9'))(new Redis(config[_0x1413('0x7')]));function emit(_0x2abf76,_0x5cc94b,_0xbb0287,_0x382e2b,_0x335a86){logger[_0x1413('0xa')](_0x1413('0xb'),_0x2abf76,_0x5cc94b['id'],_0xbb0287,_0x382e2b,JSON['stringify'](_0x335a86));io['to'](_0xbb0287)['emit'](_0x382e2b,_0x335a86);}exports['exec']=function(_0x288edf,_0x3ce80a,_0xc22418,_0x4af61c){var _0x235004,_0x412342;var _0x1950ef={};var _0x248aa6;var _0x45cad8=Number(_0xc22418[_0x1413('0xc')]);var _0x7d633d=_0xc22418['data2']?Boolean(Number(_0xc22418[_0x1413('0xd')])):![];var _0x3d75fe;var _0x3b9409=![];if(!_[_0x1413('0xe')](_0xc22418[_0x1413('0xf')])){if(_0xc22418['data5']=='1')_0x3b9409=!![];}if(!_0x3b9409){if(_0x4af61c[_0x1413('0x10')]){_0x1950ef['id']=_0x4af61c['xmd-contactid'];}}if(!_0x1950ef['id']){_0x1950ef[_0x1413('0x11')]=_0x45cad8;_0x3d75fe=_0xc22418[_0x1413('0x12')]&&_0xc22418['data3']!=='0'?_0xc22418[_0x1413('0x12')][_0x1413('0x13')](','):[_0x1413('0x14')];_0x1950ef[_0x1413('0x15')]=_[_0x1413('0x16')](_0x3d75fe,function(_0x28fd67){var _0xe1627c={};_0xe1627c[_0x28fd67]=_0x4af61c[_0x1413('0x17')]?_0x4af61c[_0x1413('0x18')]:_0x4af61c[_0x1413('0x19')];return _0xe1627c;});_0x248aa6=_0x4af61c[_0x1413('0x17')]?_0x4af61c[_0x1413('0x18')]:_0x4af61c['calleridnum'];}var _0x140918=['id',_0x1413('0x1a'),'lastName',_0x1413('0x14'),_0x1413('0x1b'),'fax',_0x1413('0x11'),_0x1413('0x1c'),'scheduledAt',_0x1413('0x1d')];var _0x319dcb=_[_0x1413('0x1e')](_0x140918,_0x3d75fe);BPromise[_0x1413('0x1f')]()[_0x1413('0x20')](cmContactRpc[_0x1413('0x21')]({'attributes':_0x319dcb,'where':_0x1950ef,'phone':_0x248aa6}))[_0x1413('0x20')](function(_0xc5ef4f){_0x412342=_0xc5ef4f;if(!_[_0x1413('0x22')](_0x412342)){if(_0x412342['length']===0x1){_0x235004=_0x412342[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x4af61c[_0x1413('0x23')],_0x3ce80a['id'],_0x235004['id']);}else{logger['info'](_0x1413('0x24'),_0x4af61c[_0x1413('0x23')],_0x3ce80a['id'],_['map'](_0x412342,'id')[_0x1413('0x25')](','));}return;}else{logger[_0x1413('0xa')](_0x1413('0x26'),_0x4af61c['uniqueid'],_0x3ce80a['id']);var _0xa9ac0f={'ListId':_0x45cad8};var _0x1cd248=_0xc22418[_0x1413('0x27')]&&_0xc22418[_0x1413('0x27')]!=='0'?_0xc22418[_0x1413('0x27')]:'phone';if(_0x7d633d){logger[_0x1413('0xa')](_0x1413('0x28'),_0x4af61c[_0x1413('0x23')],_0x3ce80a['id']);_0xa9ac0f[_0x1cd248]=_['isNil'](_0x4af61c[_0x1413('0x17')])?_0x4af61c[_0x1413('0x19')]:_0x4af61c[_0x1413('0x18')];if(_[_0x1413('0xe')](_0x4af61c[_0x1413('0x17')])){_0xa9ac0f['firstName']=_0x4af61c[_0x1413('0x29')]&&_0x4af61c[_0x1413('0x29')]!==_0x1413('0x2a')?_0x4af61c['calleridname']:_0x1413('0x2b');}else{_0xa9ac0f[_0x1413('0x1a')]=_0x4af61c[_0x1413('0x2c')]&&_0x4af61c[_0x1413('0x2c')]!==''?_0x4af61c[_0x1413('0x2c')]:_0x1413('0x2b');}return BPromise['resolve']()[_0x1413('0x20')](cmContactRpc['createContact'](_0xa9ac0f))['then'](function(_0x3ab94d){_0x235004=_0x3ab94d;_0x412342[_0x1413('0x2d')](_0x3ab94d);if(_0x235004){logger[_0x1413('0xa')](_0x1413('0x2e'),_0x4af61c[_0x1413('0x23')],_0x3ce80a['id'],_0x235004['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4af61c['uniqueid'],_0x3ce80a['id']);_0xa9ac0f[_0x1cd248]=_[_0x1413('0xe')](_0x4af61c[_0x1413('0x17')])?_0x4af61c['calleridnum']:_0x4af61c['destcalleridnum'];if(_[_0x1413('0xe')](_0x4af61c['routeId'])){_0xa9ac0f['firstName']=_0x4af61c[_0x1413('0x29')]&&_0x4af61c[_0x1413('0x29')]!==_0x1413('0x2a')?_0x4af61c['calleridname']:_0x1413('0x2b');}else{_0xa9ac0f[_0x1413('0x1a')]=_0x4af61c['destcalleridname']&&_0x4af61c['destcalleridname']!==_0x1413('0x2a')?_0x4af61c[_0x1413('0x2c')]:_0x1413('0x2b');}_0x235004=_0xa9ac0f;_0x412342['push'](_0xa9ac0f);return;}}})[_0x1413('0x20')](function(){if(_0x288edf){emit(_0x4af61c[_0x1413('0x23')],_0x3ce80a,util[_0x1413('0x2f')](_0x1413('0x30'),_0x288edf['name']),util[_0x1413('0x2f')](_0x1413('0x31'),_0xc22418[_0x1413('0x32')][_0x1413('0x33')]()),{'evt':_['merge'](_0x4af61c,{'autoCreate':_0x7d633d}),'contact':_0x235004===undefined?{}:_0x235004,'contacts':_0x412342[_0x1413('0x34')]===0x0?undefined:_0x412342});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7a151c8..25d1b76 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 _0x8ff3=['voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','vtigerAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialend','syncAgentDial','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','clone','motionChannel','voice','checkTriggers','interface','prototype','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','contactmanager','motionbar','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','windowHeight','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s:%s','action','toLowerCase','jscripty','trigger:%s','exec','integration','accounts','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','AnyConditions','some','checkConditions','field','account','chat','ChatWebsiteId','AccountId','value','upperFirst','interaction','message','event','operator','agent','membername','lastevent','mailSubstatus','null','undefined','substatus','created','equals','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0x8ff3,0x72));var _0x38ff=function(_0x4cd9c6,_0x766862){_0x4cd9c6=_0x4cd9c6-0x0;var _0x53a566=_0x8ff3[_0x4cd9c6];return _0x53a566;};'use strict';var util=require(_0x38ff('0x0'));var _=require(_0x38ff('0x1'));var url=require('url');var Mustache=require(_0x38ff('0x2'));var Redis=require(_0x38ff('0x3'));var urlforward=require(_0x38ff('0x4'));var integration=require(_0x38ff('0x5'));var cmContact=require(_0x38ff('0x6'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x38ff('0x7'))('trigger');var ami=require(_0x38ff('0x8'));config['redis']=_[_0x38ff('0x9')](config[_0x38ff('0xa')],{'host':_0x38ff('0xb'),'port':0x18eb});var io=require(_0x38ff('0xc'))(new Redis(config[_0x38ff('0xa')]));var operators={'equals':function(_0x2e49cb,_0x364ed2){return _0x2e49cb==_0x364ed2;},'not_equals':function(_0x4349da,_0x17820a){return _0x4349da!=_0x17820a;}};var barAndWebActions=[_0x38ff('0xd'),_0x38ff('0xe'),_0x38ff('0xf')];function Trigger(_0x11058d){this['triggers']=_0x11058d[_0x38ff('0x10')];this[_0x38ff('0x11')]=_0x11058d[_0x38ff('0x11')];this['voiceQueues']=_0x11058d[_0x38ff('0x12')];this[_0x38ff('0x13')]=_0x11058d[_0x38ff('0x13')];this[_0x38ff('0x14')]=_0x11058d['voiceExtensions'];this[_0x38ff('0x15')]=_0x11058d[_0x38ff('0x15')];this['freshdeskAccounts']=_0x11058d[_0x38ff('0x16')];this[_0x38ff('0x17')]=_0x11058d[_0x38ff('0x17')];this['sugarcrmAccounts']=_0x11058d[_0x38ff('0x18')];this['zohoAccounts']=_0x11058d[_0x38ff('0x19')];this['deskAccounts']=_0x11058d[_0x38ff('0x1a')];this['vtigerAccounts']=_0x11058d['vtigerAccounts'];this[_0x38ff('0x1b')]=_0x11058d[_0x38ff('0x1b')];this[_0x38ff('0x1c')]=_0x11058d[_0x38ff('0x1c')];this[_0x38ff('0x1d')]=_0x11058d[_0x38ff('0x1d')];this['accounts']={'zendesk':this[_0x38ff('0x15')],'salesforce':this[_0x38ff('0x17')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x38ff('0x18')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0x38ff('0x1e')],'dynamics365':this[_0x38ff('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x38ff('0x1b')]};ami['on']('custom:agentcalled',this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x21'),this[_0x38ff('0x1f')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x22'),this[_0x38ff('0x1f')]['bind'](this));ami['on'](_0x38ff('0x23'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x24'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on']('custom:agentbusy',this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on']('custom:agentcongestion',this[_0x38ff('0x1f')]['bind'](this));ami['on'](_0x38ff('0x25'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x26'),this['syncCustomEvent'][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x27'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x28'),this[_0x38ff('0x1f')]['bind'](this));ami['on'](_0x38ff('0x29'),this['syncAgentDial'][_0x38ff('0x20')](this));ami['on']('custom:dialconnect',this['syncAgentDial']['bind'](this));ami['on'](_0x38ff('0x2a'),this[_0x38ff('0x2b')]['bind'](this));ami['on'](_0x38ff('0x2c'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on']('custom:closedinteraction',this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x2d'),this['syncCustomEvent'][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x2e'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x2f'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x30'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x31'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));ami['on'](_0x38ff('0x32'),this[_0x38ff('0x1f')][_0x38ff('0x20')](this));}Trigger['prototype'][_0x38ff('0x33')]=function(_0x5c568b,_0x4bd619,_0x8a25ff){logger[_0x38ff('0x34')](_0x5c568b,_0x4bd619,JSON[_0x38ff('0x35')](_0x8a25ff));io['to'](_0x5c568b)[_0x38ff('0x33')](_0x4bd619,_0x8a25ff);};Trigger['prototype'][_0x38ff('0x1f')]=function(_0x44025b){var _0x17a7ce=_[_0x38ff('0x36')](_0x44025b);if(typeof _0x17a7ce[_0x38ff('0x37')]==='undefined'){_0x17a7ce['motionChannel']=_0x38ff('0x38');}this[_0x38ff('0x39')](_0x17a7ce);};Trigger['prototype'][_0x38ff('0x2b')]=function(_0x2aeff3){if(this['agents'][_0x2aeff3[_0x38ff('0x3a')]]){this[_0x38ff('0x1f')](_0x2aeff3);}};Trigger[_0x38ff('0x3b')][_0x38ff('0x39')]=function(_0x83437e){var _0x404a0d;for(var _0x3f7a8b in this['triggers']){if(this[_0x38ff('0x10')][_0x38ff('0x3c')](_0x3f7a8b)){if(this['triggers'][_0x3f7a8b][_0x38ff('0x3d')]){_0x404a0d=this[_0x38ff('0x3e')](this[_0x38ff('0x10')][_0x3f7a8b],_0x83437e);if(_0x404a0d){_[_0x38ff('0x3f')](_0x83437e,_0x83437e[_0x38ff('0x40')]);for(var _0x463872=0x0,_0x316842,_0x596d64,_0x557498;_0x4638720x0){_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 +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x3c1238,_0x52ad33){var _0x455145=function(_0x33ac62){while(--_0x33ac62){_0x3c1238['push'](_0x3c1238['shift']());}};_0x455145(++_0x52ad33);}(_0x3e74,0x175));var _0x43e7=function(_0x4c77f1,_0x153def){_0x4c77f1=_0x4c77f1-0x0;var _0x514e7c=_0x3e74[_0x4c77f1];return _0x514e7c;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index bb05de5..9efd860 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 _0x07db=['callDirection','phonecalls','Subjects','Descriptions','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','assign','getString','/contacts(','Fields','Bearer\x20'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x07db,0x16b));var _0xb07d=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0x07db[_0x114d1f];return _0x5b91d4;};'use strict';var _=require('lodash');var rp=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xb07d('0x2'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xb07d('0x3'));config[_0xb07d('0x4')]=_[_0xb07d('0x5')](config[_0xb07d('0x4')],{'host':_0xb07d('0x6'),'port':0x18eb});var io=require(_0xb07d('0x7'))(new Redis(config['redis']));function getAuthToken(_0x54a2b1,_0x45b63b,_0x18f763){if(_0x54a2b1['modernAuthentication']){_0x54a2b1[_0xb07d('0x8')]=_0x54a2b1[_0xb07d('0x9')][_0xb07d('0xa')];_0x54a2b1[_0xb07d('0xb')]=_0x54a2b1[_0xb07d('0x9')][_0xb07d('0xc')];return Promise[_0xb07d('0xd')](_0x54a2b1[_0xb07d('0x9')][_0xb07d('0xe')]);}var _0x118568={'method':_0xb07d('0xf'),'uri':_0x45b63b,'form':{'client_id':_0x54a2b1[_0xb07d('0x10')],'resource':_0x54a2b1['remoteUri'],'username':_0x54a2b1[_0xb07d('0x11')],'password':_0x54a2b1[_0xb07d('0x12')],'grant_type':_0xb07d('0x12'),'client_secret':_0x54a2b1[_0xb07d('0x13')]},'json':!![]};return rp(_0x118568)[_0xb07d('0x14')](function(_0x2f06c1){return _0x2f06c1[_0xb07d('0x15')];})['catch'](function(_0xf39abe){logger['error']('['+[_0x18f763[_0xb07d('0x16')]()]+_0xb07d('0x17'));return _0xf39abe[_0xb07d('0x18')];});}function getUser(_0x3e5c9f,_0x428e4d,_0x9f9059,_0x54effb,_0x1a3f0f,_0x14f7d2){return new Promise(function(_0x15456e,_0x3d66da){return getAuthToken(_0x428e4d,_0x54effb,_0x14f7d2)[_0xb07d('0x14')](function(_0x19aa28){var _0x1564ac={'method':_0xb07d('0x19'),'uri':_0x1a3f0f+_0xb07d('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x19aa28,'OData-Version':_0xb07d('0x1b')},'json':!![]};return rp(_0x1564ac);})[_0xb07d('0x14')](function(_0x3c46eb){var _0x54ee1f=_0x3c46eb[_0xb07d('0x1c')];var _0x435b03=![];var _0x39376d=null;if(!_[_0xb07d('0x1d')](_0x9f9059)){if(intUtil[_0xb07d('0x1e')](_0x9f9059[_0xb07d('0x1f')])){_0x3e5c9f['userEmail']=_0x9f9059['email'];for(_0x39376d=0x0;_0x39376d<_0x54ee1f[_0xb07d('0x20')];_0x39376d++){if(_0x54ee1f[_0x39376d]['internalemailaddress']===_0x9f9059['email']&&!_0x54ee1f[_0x39376d][_0xb07d('0x21')]){_0x435b03=!![];logger[_0xb07d('0x22')]('['+[_0x14f7d2[_0xb07d('0x16')]()]+']\x20Agent\x20found\x20'+_0x54ee1f[_0x39376d][_0xb07d('0x23')]+'!');_0x3e5c9f[_0xb07d('0x24')]=_0x54ee1f[_0x39376d]['systemuserid'];}}}}if(!_0x435b03){logger[_0xb07d('0x22')]('['+[_0x14f7d2[_0xb07d('0x16')]()]+_0xb07d('0x25'));_0x3e5c9f[_0xb07d('0x26')]=_0x428e4d[_0xb07d('0x11')];for(_0x39376d=0x0;_0x39376d<_0x54ee1f[_0xb07d('0x20')];_0x39376d++){if(_0x54ee1f[_0x39376d][_0xb07d('0x27')]===_0x428e4d[_0xb07d('0x11')]){_0x3e5c9f[_0xb07d('0x24')]=_0x54ee1f[_0x39376d][_0xb07d('0x23')];}}}_0x15456e(_0x3e5c9f);})[_0xb07d('0x28')](function(_0xf9f445){_0x3d66da(_0xf9f445[_0xb07d('0x18')]);});});}function createEndUser(_0x3b22ed,_0x483471,_0x257ba5,_0x1bd878,_0x4d7808,_0x6fce79,_0x18e35c){return new Promise(function(_0x29509b,_0x329099){return getAuthToken(_0x483471,_0x257ba5,_0x6fce79)[_0xb07d('0x14')](function(_0x58558e){var _0x21659d=_0x6fce79[_0xb07d('0x29')]()===_0xb07d('0x2a')?_0x4d7808[_0xb07d('0x2b')]:_0x4d7808[_0xb07d('0x2c')];var _0x1cfde5={'method':_0xb07d('0xf'),'uri':_0x1bd878+_0xb07d('0x2d'),'body':{'fullname':_0x21659d,'firstname':_0x21659d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb07d('0x2e')+_0x3b22ed[_0xb07d('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x58558e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1cfde5[_0xb07d('0x2f')][_0x18e35c]=_0x21659d;return rp(_0x1cfde5);})[_0xb07d('0x14')](function(_0x3ae75c){var _0x39f0bd=_0x3ae75c['headers'][_0xb07d('0x30')];var _0x4ad071=_0x39f0bd[_0xb07d('0x31')](_0x39f0bd[_0xb07d('0x32')]('(')+0x1,_0x39f0bd[_0xb07d('0x32')](')'));_0x3b22ed[_0xb07d('0x33')]=_0x4ad071;_0x29509b(_0x3b22ed);})[_0xb07d('0x28')](function(_0x370f1f){_0x329099(_0x370f1f[_0xb07d('0x18')]);});});}function getEndUser(_0x504f4a,_0x4b601a,_0x41a09a,_0x57ca62,_0x52187e,_0xa583c6,_0x39d6c7,_0x3b5d1a){var _0x329498=_0xa583c6[_0xb07d('0x29')]()===_0xb07d('0x2a')?_0x52187e[_0xb07d('0x2b')]:_0x52187e[_0xb07d('0x2c')];return getAuthToken(_0x4b601a,_0x41a09a,_0xa583c6)[_0xb07d('0x14')](function(_0x5ef8f6){_0x3b5d1a=_0x3b5d1a?_0x3b5d1a:_0xb07d('0x34');var _0x1bbc2e={'method':_0xb07d('0x19'),'uri':_0x57ca62+_0xb07d('0x35')+_0x3b5d1a+_0xb07d('0x36')+_0x3b5d1a+_0xb07d('0x37')+_0x329498[_0xb07d('0x38')]('+',_0xb07d('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5ef8f6,'If-None-Match':null,'OData-Version':_0xb07d('0x1b')},'json':!![]};return rp(_0x1bbc2e);})[_0xb07d('0x14')](function(_0x4d5126){var _0xc34c20=![];if(!_0x4d5126)return _0xc34c20;var _0xace7c5=_0x4d5126['value'];for(var _0x445703=0x0;_0x445703<_0xace7c5['length'];_0x445703++){if(_0xace7c5[_0x445703][_0x3b5d1a]===_0x329498){_0xc34c20=!![];_0x504f4a[_0xb07d('0x33')]=_0xace7c5[_0x445703]['contactid'];}}return _0xc34c20;})[_0xb07d('0x14')](function(_0x247370){if(_0x247370)return _0x504f4a;if(_0x39d6c7===_0xb07d('0x3a')){logger[_0xb07d('0x22')]('['+[_0xa583c6[_0xb07d('0x16')]()]+_0xb07d('0x3b'));return _0x504f4a;}return createEndUser(_0x504f4a,_0x4b601a,_0x41a09a,_0x57ca62,_0x52187e,_0xa583c6,_0x3b5d1a)[_0xb07d('0x14')](function(_0x3e1450){logger[_0xb07d('0x22')]('['+[_0xa583c6[_0xb07d('0x16')]()]+_0xb07d('0x3c'),_0x3e1450[_0xb07d('0x33')]);return _0x3e1450;});});}function getCustomFields(_0x1416f1,_0x14ad73,_0x25db3b){var _0x2187f9={};if(_0x1416f1[_0xb07d('0x20')]>0x0){_[_0xb07d('0x3d')](_0x1416f1,function(_0x2d7e6d){if(_[_0xb07d('0x3e')]([_0xb07d('0x3f'),_0xb07d('0x40')],_0x2d7e6d[_0xb07d('0x41')])&&_0x2d7e6d[_0xb07d('0x42')]&&!_0x2d7e6d[_0xb07d('0x43')]){var _0x26d25d=_0x2d7e6d[_0xb07d('0x44')][_0xb07d('0x29')]();var _0x19b244=_0x26d25d[_0xb07d('0x31')](0x0,_0x26d25d[_0xb07d('0x45')]('_'));var _0x48aa04=_0x26d25d[_0xb07d('0x31')](_0x26d25d[_0xb07d('0x45')]('_')+0x1);if(_0x19b244===_0x25db3b){_0x2187f9[_0x48aa04]=_0x2d7e6d[_0xb07d('0x46')];}}});}return _0x2187f9;}function getTicket(_0x462f8a,_0x3a51af,_0x4ae458,_0x3e086e,_0x458e20,_0x13e333,_0x4b8f1a){return new Promise(function(_0x1a9dbf,_0x321287){var _0x13a4d4;return getAuthToken(_0x3a51af,_0x4ae458,_0x4b8f1a)['then'](function(_0x176019){if(_0x13e333[_0xb07d('0x47')]==='incident'){_0x13a4d4={'method':_0xb07d('0xf'),'uri':_0x3e086e+'incidents','body':Object[_0xb07d('0x48')]({},{'title':intUtil[_0xb07d('0x49')](_0x13e333['Subjects'],_0x458e20,'\x20'),'description':intUtil[_0xb07d('0x49')](_0x13e333['Descriptions'],_0x458e20,'\x0a'),'customerid_contact@odata.bind':_0x462f8a[_0xb07d('0x33')]?_0xb07d('0x4a')+_0x462f8a[_0xb07d('0x33')]+')':undefined,'ownerid@odata.bind':_0xb07d('0x2e')+_0x462f8a['userId']+')','caseorigincode':'1'},getCustomFields(_0x13e333[_0xb07d('0x4b')],_0x458e20,_0x13e333[_0xb07d('0x47')])),'headers':{'Authorization':_0xb07d('0x4c')+_0x176019,'OData-Version':_0xb07d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x13e333[_0xb07d('0x47')]==='phonecall'){var _0x5c0689=_0x462f8a[_0xb07d('0x33')]?[{'partyid_systemuser@odata.bind':_0xb07d('0x2e')+_0x462f8a[_0xb07d('0x24')]+')','participationtypemask':_0x462f8a['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xb07d('0x4a')+_0x462f8a[_0xb07d('0x33')]+')','participationtypemask':_0x462f8a[_0xb07d('0x4d')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb07d('0x2e')+_0x462f8a[_0xb07d('0x24')]+')','participationtypemask':_0x462f8a['callDirection']==='queue'?0x2:0x1}];_0x13a4d4={'method':'POST','uri':_0x3e086e+_0xb07d('0x4e'),'body':Object['assign']({},{'subject':intUtil[_0xb07d('0x49')](_0x13e333[_0xb07d('0x4f')],_0x458e20,'\x20'),'phonenumber':String(_0x458e20[_0xb07d('0x2c')]),'description':intUtil[_0xb07d('0x49')](_0x13e333[_0xb07d('0x50')],_0x458e20,'\x0a'),'regardingobjectid_contact@odata.bind':_0x462f8a['enduserId']?_0xb07d('0x4a')+_0x462f8a[_0xb07d('0x33')]+')':undefined,'ownerid@odata.bind':_0xb07d('0x2e')+_0x462f8a[_0xb07d('0x24')]+')','directioncode':_0x462f8a['callDirection']===_0xb07d('0x51')?![]:!![],'phonecall_activity_parties':_0x5c0689},getCustomFields(_0x13e333[_0xb07d('0x4b')],_0x458e20,_0x13e333[_0xb07d('0x47')])),'headers':{'Authorization':_0xb07d('0x4c')+_0x176019,'OData-Version':_0xb07d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x13a4d4);})[_0xb07d('0x14')](function(_0x5a0d20){var _0x53fcf0=_0x5a0d20[_0xb07d('0x52')][_0xb07d('0x30')];var _0x51bb9d=_0x53fcf0['substring'](_0x53fcf0['lastIndexOf']('(')+0x1,_0x53fcf0[_0xb07d('0x32')](')'));_0x462f8a[_0xb07d('0x53')]=_0x51bb9d;_0x1a9dbf(_0x462f8a);})['catch'](function(_0x21de2b){_0x321287(_0x21de2b[_0xb07d('0x18')]);});});}function emit(_0x472e82,_0x2e44a9,_0x43f2dd,_0x26c201){var _0x2f75ec={'uri':util[_0xb07d('0x54')](_0xb07d('0x55'),_0x472e82,_0x43f2dd,_0x26c201)};io['to'](util[_0xb07d('0x54')](_0xb07d('0x56'),_0x2e44a9))[_0xb07d('0x57')]('trigger:browser:url',_0x2f75ec);}exports['cs']=function(_0x1db2bd,_0x3cde37,_0x52c9af,_0x27a8a5,_0x646969,_0x19fed6,_0x28532e,_0x50e638){var _0x21534={};_0x19fed6['remoteUri']=_0x19fed6[_0xb07d('0x58')]?intUtil[_0xb07d('0x59')](_0x19fed6['CloudProvider'][_0xb07d('0xa')]):intUtil[_0xb07d('0x59')](_0x19fed6[_0xb07d('0x8')]);_0x19fed6[_0xb07d('0x5a')]=intUtil['stripTrailingSlash'](_0x19fed6[_0xb07d('0x5a')]);_0x21534[_0xb07d('0x4d')]=_0x50e638===_0xb07d('0x51')||_0x50e638===_0xb07d('0x5b')?_0xb07d('0x51'):'outbound';var _0x228e8a=_0x19fed6['modernAuthentication']?util['format'](_0xb07d('0x5c'),_0x19fed6[_0xb07d('0x9')][_0xb07d('0xa')]):util[_0xb07d('0x54')](_0xb07d('0x5c'),_0x19fed6[_0xb07d('0x8')]);var _0x593db5=util[_0xb07d('0x54')](_0xb07d('0x5d'),_0x19fed6[_0xb07d('0xb')]);var _0x134bd3=util[_0xb07d('0x54')](_0xb07d('0x5e'),_0x19fed6[_0xb07d('0x5a')],_0x3cde37[_0xb07d('0x5f')],md5(_0x3cde37['uniqueid']));if(_0x646969&&_0x646969[_0xb07d('0x60')]){logger['info']('[QUEUE]',_0xb07d('0x61'));_0x3cde37[_0xb07d('0x62')]=_0x134bd3;}else if(_0x28532e&&_0x28532e[_0xb07d('0x63')]&&_0x28532e['recordingFormat']!==_0xb07d('0x64')){logger[_0xb07d('0x22')]('[OUTBOUND]',_0xb07d('0x61'));_0x3cde37['recordingURL']=_0x134bd3;}else{_0x3cde37[_0xb07d('0x62')]='';}return getUser(_0x21534,_0x19fed6,_0x27a8a5,_0x593db5,_0x228e8a,_0x50e638)[_0xb07d('0x14')](function(_0x1bc8aa){logger[_0xb07d('0x22')]('['+_0x50e638['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x1bc8aa[_0xb07d('0x24')]);logger[_0xb07d('0x22')]('['+_0x50e638[_0xb07d('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x1bc8aa[_0xb07d('0x26')]);return getEndUser(_0x1bc8aa,_0x19fed6,_0x593db5,_0x228e8a,_0x3cde37,_0x50e638,_0x52c9af[_0xb07d('0x65')],_0x52c9af[_0xb07d('0x66')]);})[_0xb07d('0x14')](function(_0x4b0674){logger[_0xb07d('0x22')]('['+_0x50e638[_0xb07d('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4b0674[_0xb07d('0x33')]);logger['info']('['+_0x50e638[_0xb07d('0x16')]()+_0xb07d('0x67'),_0x3cde37['calleridnum']);return getTicket(_0x4b0674,_0x19fed6,_0x593db5,_0x228e8a,_0x3cde37,_0x52c9af,_0x50e638);})['then'](function(_0x17498f){logger[_0xb07d('0x22')](util[_0xb07d('0x54')]('['+_0x50e638[_0xb07d('0x16')]()+_0xb07d('0x68'),_0x52c9af[_0xb07d('0x47')],_0x17498f[_0xb07d('0x53')]));logger[_0xb07d('0x22')](util[_0xb07d('0x54')]('['+_0x50e638[_0xb07d('0x16')]()+_0xb07d('0x69'),_0x50e638));if(_0x50e638!==_0xb07d('0x5b')&&_0x52c9af[_0xb07d('0x6a')]){logger[_0xb07d('0x22')]('['+_0x50e638[_0xb07d('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x19fed6[_0xb07d('0x8')],_0x27a8a5[_0xb07d('0x6b')],_0x52c9af[_0xb07d('0x47')],_0x17498f['ticketId']);}})[_0xb07d('0x28')](function(_0x3280e7){logger[_0xb07d('0x6c')]('['+_0x50e638[_0xb07d('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3280e7[_0xb07d('0x18')]);console[_0xb07d('0x6c')](_0xb07d('0x6d'),_0x3280e7);});}; \ No newline at end of file +var _0x7fb2=['lastIndexOf','outbound','contacts?$select=','&$filter=','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','nameField','customField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','enduserId','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7fb2,0x113));var _0x27fb=function(_0x594faf,_0x1a2209){_0x594faf=_0x594faf-0x0;var _0x5dfa74=_0x7fb2[_0x594faf];return _0x5dfa74;};'use strict';var _=require(_0x27fb('0x0'));var rp=require(_0x27fb('0x1'));var util=require(_0x27fb('0x2'));var intUtil=require(_0x27fb('0x3'));var md5=require(_0x27fb('0x4'));var Redis=require(_0x27fb('0x5'));var logger=require('../../../../config/logger')(_0x27fb('0x6'));var config=require(_0x27fb('0x7'));config['redis']=_[_0x27fb('0x8')](config[_0x27fb('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x27fb('0xa'))(new Redis(config[_0x27fb('0x9')]));function getAuthToken(_0x34547d,_0x55563e,_0x313957){if(_0x34547d['modernAuthentication']){_0x34547d[_0x27fb('0xb')]=_0x34547d[_0x27fb('0xc')][_0x27fb('0xd')];_0x34547d[_0x27fb('0xe')]=_0x34547d['CloudProvider'][_0x27fb('0xf')];return Promise['resolve'](_0x34547d['CloudProvider']['data5']);}var _0x3b53b0={'method':_0x27fb('0x10'),'uri':_0x55563e,'form':{'client_id':_0x34547d[_0x27fb('0x11')],'resource':_0x34547d[_0x27fb('0xb')],'username':_0x34547d[_0x27fb('0x12')],'password':_0x34547d[_0x27fb('0x13')],'grant_type':_0x27fb('0x13'),'client_secret':_0x34547d[_0x27fb('0x14')]},'json':!![]};return rp(_0x3b53b0)[_0x27fb('0x15')](function(_0x537106){return _0x537106[_0x27fb('0x16')];})[_0x27fb('0x17')](function(_0x2cb85e){logger[_0x27fb('0x18')]('['+[_0x313957[_0x27fb('0x19')]()]+_0x27fb('0x1a'));return _0x2cb85e[_0x27fb('0x1b')];});}function getUser(_0xca5c82,_0x382ad5,_0x2ed678,_0x3e4489,_0x5a3fe2,_0x379d0f){return new Promise(function(_0x337691,_0x2de28f){return getAuthToken(_0x382ad5,_0x3e4489,_0x379d0f)['then'](function(_0x44e8f3){var _0x240027={'method':_0x27fb('0x1c'),'uri':_0x5a3fe2+_0x27fb('0x1d'),'headers':{'Authorization':_0x27fb('0x1e')+_0x44e8f3,'OData-Version':_0x27fb('0x1f')},'json':!![]};return rp(_0x240027);})[_0x27fb('0x15')](function(_0x2acd3c){var _0x329f8d=_0x2acd3c[_0x27fb('0x20')];var _0x5f263d=![];var _0x53a265=null;if(!_[_0x27fb('0x21')](_0x2ed678)){if(intUtil[_0x27fb('0x22')](_0x2ed678['email'])){_0xca5c82[_0x27fb('0x23')]=_0x2ed678[_0x27fb('0x24')];for(_0x53a265=0x0;_0x53a265<_0x329f8d[_0x27fb('0x25')];_0x53a265++){if(_0x329f8d[_0x53a265][_0x27fb('0x26')]===_0x2ed678[_0x27fb('0x24')]&&!_0x329f8d[_0x53a265]['isdisabled']){_0x5f263d=!![];logger[_0x27fb('0x27')]('['+[_0x379d0f['toUpperCase']()]+_0x27fb('0x28')+_0x329f8d[_0x53a265]['systemuserid']+'!');_0xca5c82[_0x27fb('0x29')]=_0x329f8d[_0x53a265][_0x27fb('0x2a')];}}}}if(!_0x5f263d){logger[_0x27fb('0x27')]('['+[_0x379d0f[_0x27fb('0x19')]()]+_0x27fb('0x2b'));_0xca5c82[_0x27fb('0x23')]=_0x382ad5[_0x27fb('0x12')];for(_0x53a265=0x0;_0x53a265<_0x329f8d[_0x27fb('0x25')];_0x53a265++){if(_0x329f8d[_0x53a265][_0x27fb('0x26')]===_0x382ad5['username']){_0xca5c82[_0x27fb('0x29')]=_0x329f8d[_0x53a265]['systemuserid'];}}}_0x337691(_0xca5c82);})['catch'](function(_0x44f4bb){_0x2de28f(_0x44f4bb[_0x27fb('0x1b')]);});});}function createEndUser(_0x1f30a1,_0x5e8278,_0x10032e,_0x1267b3,_0x48c23f,_0x333122,_0x42b7b7){return new Promise(function(_0x58873d,_0x21aded){return getAuthToken(_0x5e8278,_0x10032e,_0x333122)[_0x27fb('0x15')](function(_0x2cf6c1){var _0x1336e6=_0x333122[_0x27fb('0x2c')]()==='outbound'?_0x48c23f[_0x27fb('0x2d')]:_0x48c23f[_0x27fb('0x2e')];var _0xbb5559={'method':_0x27fb('0x10'),'uri':_0x1267b3+_0x27fb('0x2f'),'body':{'fullname':_0x1336e6,'firstname':_0x1336e6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x27fb('0x30')+_0x1f30a1['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x2cf6c1,'OData-Version':_0x27fb('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0xbb5559[_0x27fb('0x31')][_0x42b7b7]=_0x1336e6;return rp(_0xbb5559);})[_0x27fb('0x15')](function(_0x25aab7){var _0x35e5dd=_0x25aab7['headers'][_0x27fb('0x32')];var _0x1caa5d=_0x35e5dd[_0x27fb('0x33')](_0x35e5dd[_0x27fb('0x34')]('(')+0x1,_0x35e5dd[_0x27fb('0x34')](')'));_0x1f30a1['enduserId']=_0x1caa5d;_0x58873d(_0x1f30a1);})[_0x27fb('0x17')](function(_0x3ed639){_0x21aded(_0x3ed639[_0x27fb('0x1b')]);});});}function getEndUser(_0x135246,_0xd6361a,_0x2940ea,_0x5ea6e6,_0x33afc4,_0x3e0fb4,_0x28d07f,_0x19aa3a){var _0x507d87=_0x3e0fb4['toLowerCase']()===_0x27fb('0x35')?_0x33afc4['destcalleridnum']:_0x33afc4[_0x27fb('0x2e')];return getAuthToken(_0xd6361a,_0x2940ea,_0x3e0fb4)['then'](function(_0x30872c){_0x19aa3a=_0x19aa3a?_0x19aa3a:'telephone1';var _0x51678f={'method':_0x27fb('0x1c'),'uri':_0x5ea6e6+_0x27fb('0x36')+_0x19aa3a+_0x27fb('0x37')+_0x19aa3a+'\x20eq\x20\x27'+_0x507d87['replace']('+',_0x27fb('0x38'))+'\x27','headers':{'Authorization':_0x27fb('0x1e')+_0x30872c,'If-None-Match':null,'OData-Version':_0x27fb('0x1f')},'json':!![]};return rp(_0x51678f);})[_0x27fb('0x15')](function(_0x45a06e){var _0x43b642=![];if(!_0x45a06e)return _0x43b642;var _0x226075=_0x45a06e[_0x27fb('0x20')];for(var _0x4f07ba=0x0;_0x4f07ba<_0x226075[_0x27fb('0x25')];_0x4f07ba++){if(_0x226075[_0x4f07ba][_0x19aa3a]===_0x507d87){_0x43b642=!![];_0x135246['enduserId']=_0x226075[_0x4f07ba][_0x27fb('0x39')];}}return _0x43b642;})['then'](function(_0x322d83){if(_0x322d83)return _0x135246;if(_0x28d07f===_0x27fb('0x3a')){logger[_0x27fb('0x27')]('['+[_0x3e0fb4[_0x27fb('0x19')]()]+_0x27fb('0x3b'));return _0x135246;}return createEndUser(_0x135246,_0xd6361a,_0x2940ea,_0x5ea6e6,_0x33afc4,_0x3e0fb4,_0x19aa3a)[_0x27fb('0x15')](function(_0x2a4596){logger['info']('['+[_0x3e0fb4[_0x27fb('0x19')]()]+_0x27fb('0x3c'),_0x2a4596['enduserId']);return _0x2a4596;});});}function getCustomFields(_0xa06340,_0x2bc971,_0x32b7de){var _0xe1b42b={};if(_0xa06340[_0x27fb('0x25')]>0x0){_['forEach'](_0xa06340,function(_0x2b156f){if(_[_0x27fb('0x3d')]([_0x27fb('0x3e'),'picklist'],_0x2b156f['type'])&&_0x2b156f[_0x27fb('0x3f')]&&!_0x2b156f[_0x27fb('0x40')]){var _0x44912=_0x2b156f[_0x27fb('0x41')][_0x27fb('0x2c')]();var _0x3d22d9=_0x44912[_0x27fb('0x33')](0x0,_0x44912['indexOf']('_'));var _0x289477=_0x44912[_0x27fb('0x33')](_0x44912[_0x27fb('0x42')]('_')+0x1);if(_0x3d22d9===_0x32b7de){_0xe1b42b[_0x289477]=_0x2b156f['content'];}}});}return _0xe1b42b;}function getTicket(_0x1e86c8,_0x317bba,_0x36e51c,_0x31f50f,_0x2fcc48,_0x2f11ec,_0x2d73ac){return new Promise(function(_0x316752,_0x3b0518){var _0xd5e3b8;return getAuthToken(_0x317bba,_0x36e51c,_0x2d73ac)[_0x27fb('0x15')](function(_0x4a340e){if(_0x2f11ec[_0x27fb('0x43')]===_0x27fb('0x44')){_0xd5e3b8={'method':_0x27fb('0x10'),'uri':_0x31f50f+_0x27fb('0x45'),'body':Object['assign']({},{'title':intUtil[_0x27fb('0x46')](_0x2f11ec[_0x27fb('0x47')],_0x2fcc48,'\x20'),'description':intUtil['getString'](_0x2f11ec[_0x27fb('0x48')],_0x2fcc48,'\x0a'),'customerid_contact@odata.bind':_0x1e86c8[_0x27fb('0x49')]?_0x27fb('0x4a')+_0x1e86c8[_0x27fb('0x49')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1e86c8[_0x27fb('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x2f11ec[_0x27fb('0x4b')],_0x2fcc48,_0x2f11ec[_0x27fb('0x43')])),'headers':{'Authorization':_0x27fb('0x1e')+_0x4a340e,'OData-Version':_0x27fb('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f11ec['ticketType']===_0x27fb('0x4c')){var _0x26e1e4=_0x1e86c8[_0x27fb('0x49')]?[{'partyid_systemuser@odata.bind':_0x27fb('0x30')+_0x1e86c8[_0x27fb('0x29')]+')','participationtypemask':_0x1e86c8[_0x27fb('0x4d')]===_0x27fb('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x27fb('0x4a')+_0x1e86c8[_0x27fb('0x49')]+')','participationtypemask':_0x1e86c8[_0x27fb('0x4d')]===_0x27fb('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1e86c8[_0x27fb('0x29')]+')','participationtypemask':_0x1e86c8[_0x27fb('0x4d')]==='queue'?0x2:0x1}];_0xd5e3b8={'method':_0x27fb('0x10'),'uri':_0x31f50f+_0x27fb('0x4f'),'body':Object[_0x27fb('0x50')]({},{'subject':intUtil[_0x27fb('0x46')](_0x2f11ec['Subjects'],_0x2fcc48,'\x20'),'phonenumber':String(_0x2fcc48[_0x27fb('0x2e')]),'description':intUtil[_0x27fb('0x46')](_0x2f11ec[_0x27fb('0x48')],_0x2fcc48,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1e86c8[_0x27fb('0x49')]?_0x27fb('0x4a')+_0x1e86c8['enduserId']+')':undefined,'ownerid@odata.bind':_0x27fb('0x30')+_0x1e86c8['userId']+')','directioncode':_0x1e86c8[_0x27fb('0x4d')]===_0x27fb('0x4e')?![]:!![],'phonecall_activity_parties':_0x26e1e4},getCustomFields(_0x2f11ec[_0x27fb('0x4b')],_0x2fcc48,_0x2f11ec[_0x27fb('0x43')])),'headers':{'Authorization':_0x27fb('0x1e')+_0x4a340e,'OData-Version':_0x27fb('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd5e3b8);})[_0x27fb('0x15')](function(_0x1333c5){var _0x25749f=_0x1333c5[_0x27fb('0x51')][_0x27fb('0x32')];var _0x44c7cb=_0x25749f[_0x27fb('0x33')](_0x25749f[_0x27fb('0x34')]('(')+0x1,_0x25749f['lastIndexOf'](')'));_0x1e86c8[_0x27fb('0x52')]=_0x44c7cb;_0x316752(_0x1e86c8);})[_0x27fb('0x17')](function(_0x214528){_0x3b0518(_0x214528['message']);});});}function emit(_0x5a80e4,_0x44c8a9,_0x436141,_0x34bce7){var _0x28b947={'uri':util[_0x27fb('0x53')](_0x27fb('0x54'),_0x5a80e4,_0x436141,_0x34bce7)};io['to'](util[_0x27fb('0x53')](_0x27fb('0x55'),_0x44c8a9))[_0x27fb('0x56')](_0x27fb('0x57'),_0x28b947);}exports['cs']=function(_0xbae9af,_0x1a1d4f,_0xd27891,_0x3bc1e4,_0x41ad53,_0x498c61,_0x592a58,_0x23281b){var _0x52f6df={};_0x498c61[_0x27fb('0xb')]=_0x498c61['modernAuthentication']?intUtil[_0x27fb('0x58')](_0x498c61['CloudProvider'][_0x27fb('0xd')]):intUtil[_0x27fb('0x58')](_0x498c61[_0x27fb('0xb')]);_0x498c61[_0x27fb('0x59')]=intUtil[_0x27fb('0x58')](_0x498c61[_0x27fb('0x59')]);_0x52f6df['callDirection']=_0x23281b===_0x27fb('0x4e')||_0x23281b===_0x27fb('0x5a')?_0x27fb('0x4e'):_0x27fb('0x35');var _0x133da1=_0x498c61[_0x27fb('0x5b')]?util['format'](_0x27fb('0x5c'),_0x498c61[_0x27fb('0xc')][_0x27fb('0xd')]):util[_0x27fb('0x53')](_0x27fb('0x5c'),_0x498c61[_0x27fb('0xb')]);var _0x3a4423=util[_0x27fb('0x53')](_0x27fb('0x5d'),_0x498c61[_0x27fb('0xe')]);var _0x3014c8=util[_0x27fb('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x498c61['serverUrl'],_0x1a1d4f[_0x27fb('0x5e')],md5(_0x1a1d4f[_0x27fb('0x5e')]));if(_0x41ad53&&_0x41ad53['monitor_format']){logger['info'](_0x27fb('0x5f'),'Recording\x20is\x20enabled!');_0x1a1d4f['recordingURL']=_0x3014c8;}else if(_0x592a58&&_0x592a58[_0x27fb('0x60')]&&_0x592a58['recordingFormat']!=='none'){logger[_0x27fb('0x27')](_0x27fb('0x61'),_0x27fb('0x62'));_0x1a1d4f[_0x27fb('0x63')]=_0x3014c8;}else{_0x1a1d4f[_0x27fb('0x63')]='';}return getUser(_0x52f6df,_0x498c61,_0x3bc1e4,_0x3a4423,_0x133da1,_0x23281b)[_0x27fb('0x15')](function(_0x17d32b){logger['info']('['+_0x23281b[_0x27fb('0x19')]()+_0x27fb('0x64'),_0x17d32b[_0x27fb('0x29')]);logger['info']('['+_0x23281b[_0x27fb('0x19')]()+_0x27fb('0x65'),_0x17d32b['userEmail']);return getEndUser(_0x17d32b,_0x498c61,_0x3a4423,_0x133da1,_0x1a1d4f,_0x23281b,_0xd27891[_0x27fb('0x66')],_0xd27891['additionalSearchContact']);})[_0x27fb('0x15')](function(_0x10d1fa){logger[_0x27fb('0x27')]('['+_0x23281b['toUpperCase']()+_0x27fb('0x67'),_0x10d1fa[_0x27fb('0x49')]);logger[_0x27fb('0x27')]('['+_0x23281b[_0x27fb('0x19')]()+_0x27fb('0x68'),_0x1a1d4f['calleridnum']);return getTicket(_0x10d1fa,_0x498c61,_0x3a4423,_0x133da1,_0x1a1d4f,_0xd27891,_0x23281b);})[_0x27fb('0x15')](function(_0x1f9c5a){logger[_0x27fb('0x27')](util['format']('['+_0x23281b['toUpperCase']()+_0x27fb('0x69'),_0xd27891[_0x27fb('0x43')],_0x1f9c5a[_0x27fb('0x52')]));logger['info'](util[_0x27fb('0x53')]('['+_0x23281b['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x23281b));if(_0x23281b!==_0x27fb('0x5a')&&_0xd27891[_0x27fb('0x6a')]){logger[_0x27fb('0x27')]('['+_0x23281b[_0x27fb('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x498c61[_0x27fb('0xb')],_0x3bc1e4[_0x27fb('0x6b')],_0xd27891['ticketType'],_0x1f9c5a[_0x27fb('0x52')]);}})[_0x27fb('0x17')](function(_0x3819fd){logger[_0x27fb('0x18')]('['+_0x23281b[_0x27fb('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3819fd[_0x27fb('0x1b')]);console[_0x27fb('0x18')](_0x27fb('0x6c'),_0x3819fd);});}; \ 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 220f6c4..32ff097 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 _0xb0ea=['then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','toLowerCase','content','string','customField','push','variableName','idField','customVariable','Variable','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','stringify','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST'];(function(_0x35247f,_0x57f101){var _0x51172c=function(_0x307b35){while(--_0x307b35){_0x35247f['push'](_0x35247f['shift']());}};_0x51172c(++_0x57f101);}(_0xb0ea,0x152));var _0xab0e=function(_0x2fe85a,_0x28c346){_0x2fe85a=_0x2fe85a-0x0;var _0x468e0f=_0xb0ea[_0x2fe85a];return _0x468e0f;};'use strict';var _=require(_0xab0e('0x0'));var rp=require(_0xab0e('0x1'));var md5=require('md5');var util=require(_0xab0e('0x2'));var Redis=require(_0xab0e('0x3'));var intUtil=require(_0xab0e('0x4'));var config=require(_0xab0e('0x5'));var logger=require(_0xab0e('0x6'))(_0xab0e('0x7'));config[_0xab0e('0x8')]=_[_0xab0e('0x9')](config[_0xab0e('0x8')],{'host':_0xab0e('0xa'),'port':0x18eb});var io=require(_0xab0e('0xb'))(new Redis(config[_0xab0e('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xab0e('0xc')};function emit(_0x2503e2,_0xdd92dc,_0x24f2b1){io['to'](_0x2503e2)[_0xab0e('0xd')](_0xdd92dc,_0x24f2b1);}function getTicket(_0x3ba803,_0x14a4e2,_0x260194,_0x1e91d8,_0x1d86d2){logger[_0xab0e('0xe')](_0xab0e('0xf'));var _0x10f7fe=_[_0xab0e('0x10')]({'responder_id':_0x14a4e2['id'],'requester_id':_0x260194['id'],'name':util[_0xab0e('0x11')]('Caller\x20-\x20%s',_0x1d86d2['calleridname']),'phone':_0x1d86d2[_0xab0e('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xab0e('0x13')](_0x1e91d8[_0xab0e('0x14')],_0x1d86d2,'\x20'),'description':intUtil[_0xab0e('0x13')](_0x1e91d8[_0xab0e('0x15')],_0x1d86d2,'
'),'tags':getTags(_0x1e91d8[_0xab0e('0x16')],_0xab0e('0x17'))},getCustomFields(_0x1e91d8['Fields'],_0x1d86d2));_0x10f7fe[_0xab0e('0x18')]=_['mapValues'](_[_0xab0e('0x19')](_0x10f7fe[_0xab0e('0x18')],'id'),_0xab0e('0x1a'));return request({'uri':util[_0xab0e('0x11')](_0xab0e('0x1b'),_0x3ba803[_0xab0e('0x1c')]),'method':_0xab0e('0x1d'),'body':_0x10f7fe})[_0xab0e('0x1e')](function(_0x16f5d6){logger[_0xab0e('0xe')](_0xab0e('0x1f'));return _0x16f5d6;});}function getUser(_0x5031db,_0x306dab){if(intUtil['validateEmail'](_0x306dab)){return request({'uri':util[_0xab0e('0x11')](_0xab0e('0x20'),_0x5031db['remoteUri']),'qs':{'email':_0x306dab}})[_0xab0e('0x1e')](function(_0x19beb3){if(_0x19beb3[_0xab0e('0x21')]){logger[_0xab0e('0xe')](_0xab0e('0x22'));return _[_0xab0e('0x23')](_0x19beb3,function(_0x13acc2){return _0x13acc2[_0xab0e('0x24')][_0xab0e('0x25')]===_0x306dab;});}else{logger[_0xab0e('0xe')](_0xab0e('0x26'));return request({'uri':util[_0xab0e('0x11')]('%s/api/v2/agents/me',_0x5031db[_0xab0e('0x1c')])})['then'](function(_0x1561a2){logger['info'](_0xab0e('0x27'));return _0x1561a2;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xab0e('0x28'),_0x5031db[_0xab0e('0x1c')])})[_0xab0e('0x1e')](function(_0x13b410){logger['info'](_0xab0e('0x27'));return _0x13b410;});}}function getEndUser(_0x2e09b7,_0x4d331d,_0x52aa6e){logger[_0xab0e('0xe')](_0xab0e('0x29'),_0x52aa6e);return request({'uri':util['format'](_0xab0e('0x2a'),_0x2e09b7[_0xab0e('0x1c')]),'qs':{'phone':_0x52aa6e}})[_0xab0e('0x1e')](function(_0x3bec55){if(_0x3bec55[_0xab0e('0x21')]){logger[_0xab0e('0xe')]('Enduser\x20found!');return _[_0xab0e('0x23')](_0x3bec55,{'phone':_0x52aa6e});}else{logger['info'](_0xab0e('0x2b'));return request({'uri':util[_0xab0e('0x11')](_0xab0e('0x2a'),_0x2e09b7[_0xab0e('0x1c')]),'method':_0xab0e('0x1d'),'body':{'name':_0x4d331d,'phone':_0x52aa6e}})[_0xab0e('0x1e')](function(_0x1a576d){logger[_0xab0e('0xe')](_0xab0e('0x2c'));return _0x1a576d;});}});}function getAuth(_0x5f2378){return util[_0xab0e('0x11')](_0xab0e('0x2d'),new Buffer(_0x5f2378['apiKey']+':X')[_0xab0e('0x2e')](_0xab0e('0x2f')));}function request(_0x519763){logger[_0xab0e('0x30')](_0xab0e('0x31'),JSON['stringify'](_0x519763));return rp(_['defaults'](_0x519763,{'method':_0xab0e('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x326742,_0x1a32d7){var _0x5d4600=[];if(_0x326742&&_0x326742[_0xab0e('0x21')]>0x0){_0x5d4600=_[_0xab0e('0x33')](_0x326742,_0x1a32d7);}return _0x5d4600;}function getCustomFields(_0x250e5f,_0x1fcc7a){var _0x10c275=[];var _0x4e61bf={'custom_fields':[]};if(_0x250e5f[_0xab0e('0x21')]>0x0){_[_0xab0e('0x34')](_0x250e5f,function(_0x4d468e){if(_[_0xab0e('0x35')](['string',_0xab0e('0x36')],_0x4d468e[_0xab0e('0x37')])&&_0x4d468e[_0xab0e('0x38')]&&!_0x4d468e['customField']){_0x4e61bf[_0x4d468e['nameField'][_0xab0e('0x39')]()]=_0x4d468e[_0xab0e('0x3a')][_0xab0e('0x2e')]();}else if(_['includes']([_0xab0e('0x3b'),_0xab0e('0x36')],_0x4d468e[_0xab0e('0x37')])&&_0x4d468e['idField']&&_0x4d468e[_0xab0e('0x3c')]){_0x4e61bf['custom_fields'][_0xab0e('0x3d')]({'id':_0x4d468e['idField'],'value':_0x4d468e[_0xab0e('0x3a')]['toString']()});}else if(_0x4d468e[_0xab0e('0x37')]==='variable'&&_0x4d468e[_0xab0e('0x3e')]&&_0x4d468e['idField']&&_0x4d468e[_0xab0e('0x3c')]){_0x1fcc7a[_0x4d468e[_0xab0e('0x3e')]]&&_0x4e61bf[_0xab0e('0x18')][_0xab0e('0x3d')]({'id':_0x4d468e[_0xab0e('0x3f')],'value':_0x1fcc7a[_0x4d468e['variableName']][_0xab0e('0x2e')]()});}else if(_0x4d468e[_0xab0e('0x37')]===_0xab0e('0x40')&&_0x4d468e['Variable']&&_0x4d468e[_0xab0e('0x41')][_0xab0e('0x17')]&&_0x4d468e[_0xab0e('0x3f')]&&_0x4d468e[_0xab0e('0x3c')]){_0x1fcc7a[_0x4d468e[_0xab0e('0x41')][_0xab0e('0x17')][_0xab0e('0x39')]()]&&_0x4e61bf['custom_fields'][_0xab0e('0x3d')]({'id':_0x4d468e[_0xab0e('0x3f')],'value':_0x1fcc7a[_0x4d468e[_0xab0e('0x41')][_0xab0e('0x17')]['toLowerCase']()][_0xab0e('0x2e')]()});}});}return _0x4e61bf;}exports[_0xab0e('0x42')]=function(_0x5d3731,_0x1c44f1,_0x389a8c,_0x4bef84,_0x36143f,_0x5ec3e7){var _0x27e127,_0x2d6b1d;_0x5ec3e7['remoteUri']=intUtil['stripTrailingSlash'](_0x5ec3e7[_0xab0e('0x1c')]);_0x5ec3e7[_0xab0e('0x43')]=intUtil['stripTrailingSlash'](_0x5ec3e7[_0xab0e('0x43')]);if(_0x36143f&&_0x36143f['monitor_format']){logger[_0xab0e('0xe')](_0xab0e('0x44'),_0xab0e('0x45'));_0x1c44f1[_0xab0e('0x46')]=util[_0xab0e('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ec3e7[_0xab0e('0x43')],_0x1c44f1[_0xab0e('0x47')],md5(_0x1c44f1[_0xab0e('0x47')]));}else{_0x1c44f1[_0xab0e('0x46')]='';}headers[_0xab0e('0x48')]=getAuth(_0x5ec3e7);return getUser(_0x5ec3e7,_0x4bef84[_0xab0e('0x25')])[_0xab0e('0x1e')](function(_0x49980a){_0x27e127=_0x49980a;logger[_0xab0e('0xe')](_0xab0e('0x49'),_0x27e127['id']);return getEndUser(_0x5ec3e7,_0x1c44f1[_0xab0e('0x4a')],_0x1c44f1['calleridnum']);})[_0xab0e('0x1e')](function(_0x50bd80){_0x2d6b1d=_0x50bd80;logger[_0xab0e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2d6b1d['id']);return getTicket(_0x5ec3e7,_0x27e127,_0x2d6b1d,_0x389a8c,_0x1c44f1);})['then'](function(_0x242f7b){if(_0x242f7b&&_0x242f7b['id']){logger[_0xab0e('0xe')]('Ticket\x20created!');logger[_0xab0e('0xe')](_0xab0e('0x4b'),_0x242f7b['id']);logger['info']('[QUEUE]',_0xab0e('0x4c'));emit(util['format'](_0xab0e('0x4d'),_0x4bef84[_0xab0e('0x17')]),'trigger:browser:url',{'uri':util[_0xab0e('0x11')]('%s/helpdesk/tickets/%d',_0x5ec3e7[_0xab0e('0x1c')],_0x242f7b['id'])});}})[_0xab0e('0x4e')](function(_0xd57959){logger['error']('[QUEUE]',JSON[_0xab0e('0x4f')](_0xd57959));});};exports['outbound']=function(_0x174141,_0x15347f,_0x2f0690,_0x6553bf,_0xde7092,_0x20086e,_0x5c46d2){var _0x3622af,_0x191ca1;_0x20086e[_0xab0e('0x1c')]=intUtil[_0xab0e('0x50')](_0x20086e[_0xab0e('0x1c')]);_0x20086e['serverUrl']=intUtil[_0xab0e('0x50')](_0x20086e[_0xab0e('0x43')]);if(_0x5c46d2&&_0x5c46d2[_0xab0e('0x51')]&&_0x5c46d2['recordingFormat']!==_0xab0e('0x52')){logger[_0xab0e('0xe')](_0xab0e('0x53'),_0xab0e('0x45'));_0x15347f['recordingURL']=util[_0xab0e('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20086e[_0xab0e('0x43')],_0x15347f[_0xab0e('0x47')],md5(_0x15347f[_0xab0e('0x47')]));}headers[_0xab0e('0x48')]=getAuth(_0x20086e);return getUser(_0x20086e,_0x6553bf[_0xab0e('0x25')])[_0xab0e('0x1e')](function(_0x575f1b){_0x3622af=_0x575f1b;logger[_0xab0e('0xe')](_0xab0e('0x49'),_0x3622af['id']);return getEndUser(_0x20086e,_0x15347f[_0xab0e('0x54')],_0x15347f['destcalleridnum']);})[_0xab0e('0x1e')](function(_0x2e60b2){_0x191ca1=_0x2e60b2;logger[_0xab0e('0xe')](_0xab0e('0x55'),_0x191ca1['id']);return getTicket(_0x20086e,_0x3622af,_0x191ca1,_0x2f0690,_0x15347f);})[_0xab0e('0x1e')](function(_0x30fb97){if(_0x30fb97&&_0x30fb97['id']){logger['info'](_0xab0e('0x1f'));logger[_0xab0e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x30fb97['id']);logger[_0xab0e('0xe')](_0xab0e('0x53'),_0xab0e('0x4c'));emit(util[_0xab0e('0x11')](_0xab0e('0x4d'),_0x6553bf['name']),_0xab0e('0x56'),{'uri':util[_0xab0e('0x11')]('%s/helpdesk/tickets/%d',_0x20086e[_0xab0e('0x1c')],_0x30fb97['id'])});}})['catch'](function(_0x3a1793){logger[_0xab0e('0x57')](_0xab0e('0x53'),JSON[_0xab0e('0x4f')](_0x3a1793));});};exports[_0xab0e('0x58')]=function(_0x5dc114,_0x58cf12,_0xf81343,_0x281dbb,_0x7016a7,_0x52b33e){var _0x2a4dfb,_0x28611e;_0x52b33e[_0xab0e('0x1c')]=intUtil[_0xab0e('0x50')](_0x52b33e['remoteUri']);_0x52b33e[_0xab0e('0x43')]=intUtil[_0xab0e('0x50')](_0x52b33e[_0xab0e('0x43')]);if(_0x7016a7&&_0x7016a7['monitor_format']){logger[_0xab0e('0xe')]('['+_0x58cf12[_0xab0e('0x59')][_0xab0e('0x5a')]()+']',_0xab0e('0x45'));_0x58cf12[_0xab0e('0x46')]=util[_0xab0e('0x11')](_0xab0e('0x5b'),_0x52b33e[_0xab0e('0x43')],_0x58cf12['uniqueid'],md5(_0x58cf12[_0xab0e('0x47')]));}else{_0x58cf12[_0xab0e('0x46')]='';}headers['Authorization']=getAuth(_0x52b33e);return getUser(_0x52b33e,'')[_0xab0e('0x1e')](function(_0x25f59c){_0x2a4dfb=_0x25f59c;logger[_0xab0e('0xe')](_0xab0e('0x49'),_0x2a4dfb['id']);return getEndUser(_0x52b33e,_0x58cf12[_0xab0e('0x4a')],_0x58cf12[_0xab0e('0x12')]);})['then'](function(_0x376ec9){_0x28611e=_0x376ec9;logger['info'](_0xab0e('0x55'),_0x28611e['id']);return getTicket(_0x52b33e,_0x2a4dfb,_0x28611e,_0xf81343,_0x58cf12);})[_0xab0e('0x1e')](function(_0x180669){if(_0x180669){logger[_0xab0e('0xe')](_0xab0e('0x1f'));logger[_0xab0e('0xe')](_0xab0e('0x4b'),_0x180669['id']);}})['catch'](function(_0xa9617b){logger['error']('['+_0x58cf12[_0xab0e('0x59')][_0xab0e('0x5a')]()+']',JSON[_0xab0e('0x4f')](_0xa9617b));});}; \ No newline at end of file +var _0x6852=['Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','info','validateEmail','%s/api/v2/agents','remoteUri','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','base64','stringify','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','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','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Authorization','destcalleridnum','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','lodash','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit'];(function(_0x3d7692,_0x1af929){var _0x3424e9=function(_0x3ff37c){while(--_0x3ff37c){_0x3d7692['push'](_0x3d7692['shift']());}};_0x3424e9(++_0x1af929);}(_0x6852,0x165));var _0x2685=function(_0x469a09,_0x57fae9){_0x469a09=_0x469a09-0x0;var _0x5e93b1=_0x6852[_0x469a09];return _0x5e93b1;};'use strict';var _=require(_0x2685('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x2685('0x1'));var intUtil=require(_0x2685('0x2'));var config=require(_0x2685('0x3'));var logger=require('../../../../config/logger')(_0x2685('0x4'));config[_0x2685('0x5')]=_[_0x2685('0x6')](config[_0x2685('0x5')],{'host':_0x2685('0x7'),'port':0x18eb});var io=require(_0x2685('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x2685('0x9'),'Accept':_0x2685('0x9')};function emit(_0x1c17d3,_0x41d1eb,_0x6bfb6b){io['to'](_0x1c17d3)[_0x2685('0xa')](_0x41d1eb,_0x6bfb6b);}function getTicket(_0x3aef14,_0x567a20,_0x1a1687,_0x23d14c,_0x144b37){logger['info'](_0x2685('0xb'));var _0x561b01=_[_0x2685('0xc')]({'responder_id':_0x567a20['id'],'requester_id':_0x1a1687['id'],'name':util[_0x2685('0xd')](_0x2685('0xe'),_0x144b37['calleridname']),'phone':_0x144b37[_0x2685('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2685('0x10')](_0x23d14c[_0x2685('0x11')],_0x144b37,'\x20'),'description':intUtil[_0x2685('0x10')](_0x23d14c[_0x2685('0x12')],_0x144b37,_0x2685('0x13')),'tags':getTags(_0x23d14c['Tags'],_0x2685('0x14'))},getCustomFields(_0x23d14c[_0x2685('0x15')],_0x144b37));_0x561b01['custom_fields']=_[_0x2685('0x16')](_[_0x2685('0x17')](_0x561b01[_0x2685('0x18')],'id'),_0x2685('0x19'));return request({'uri':util[_0x2685('0xd')](_0x2685('0x1a'),_0x3aef14['remoteUri']),'method':_0x2685('0x1b'),'body':_0x561b01})[_0x2685('0x1c')](function(_0x48448a){logger[_0x2685('0x1d')]('Ticket\x20created!');return _0x48448a;});}function getUser(_0x52a19a,_0x4fa751){if(intUtil[_0x2685('0x1e')](_0x4fa751)){return request({'uri':util[_0x2685('0xd')](_0x2685('0x1f'),_0x52a19a[_0x2685('0x20')]),'qs':{'email':_0x4fa751}})[_0x2685('0x1c')](function(_0x4479c6){if(_0x4479c6['length']){logger[_0x2685('0x1d')]('Agent\x20found!');return _[_0x2685('0x21')](_0x4479c6,function(_0x193aac){return _0x193aac[_0x2685('0x22')][_0x2685('0x23')]===_0x4fa751;});}else{logger[_0x2685('0x1d')](_0x2685('0x24'));return request({'uri':util[_0x2685('0xd')](_0x2685('0x25'),_0x52a19a['remoteUri'])})['then'](function(_0x470b9f){logger['info'](_0x2685('0x26'));return _0x470b9f;});}});}else{logger[_0x2685('0x1d')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2685('0xd')](_0x2685('0x25'),_0x52a19a[_0x2685('0x20')])})[_0x2685('0x1c')](function(_0x34e383){logger[_0x2685('0x1d')](_0x2685('0x26'));return _0x34e383;});}}function getEndUser(_0x3c1570,_0x275c53,_0x265f14){logger[_0x2685('0x1d')](_0x2685('0x27'),_0x265f14);return request({'uri':util[_0x2685('0xd')](_0x2685('0x28'),_0x3c1570['remoteUri']),'qs':{'phone':_0x265f14}})['then'](function(_0x24c606){if(_0x24c606[_0x2685('0x29')]){logger[_0x2685('0x1d')](_0x2685('0x2a'));return _[_0x2685('0x21')](_0x24c606,{'phone':_0x265f14});}else{logger['info'](_0x2685('0x2b'));return request({'uri':util['format'](_0x2685('0x28'),_0x3c1570[_0x2685('0x20')]),'method':'POST','body':{'name':_0x275c53,'phone':_0x265f14}})[_0x2685('0x1c')](function(_0x4537ab){logger[_0x2685('0x1d')]('Enduser\x20created.');return _0x4537ab;});}});}function getAuth(_0x50fd84){return util['format'](_0x2685('0x2c'),new Buffer(_0x50fd84['apiKey']+':X')[_0x2685('0x2d')](_0x2685('0x2e')));}function request(_0x15fac8){logger['debug']('[HTTP]',JSON[_0x2685('0x2f')](_0x15fac8));return rp(_[_0x2685('0x6')](_0x15fac8,{'method':_0x2685('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x490f0e,_0xfa383c){var _0x55ab39=[];if(_0x490f0e&&_0x490f0e[_0x2685('0x29')]>0x0){_0x55ab39=_[_0x2685('0x31')](_0x490f0e,_0xfa383c);}return _0x55ab39;}function getCustomFields(_0x1550ca,_0x4f1b46){var _0x468d17=[];var _0x32f05={'custom_fields':[]};if(_0x1550ca[_0x2685('0x29')]>0x0){_['forEach'](_0x1550ca,function(_0x16028c){if(_[_0x2685('0x32')]([_0x2685('0x33'),_0x2685('0x34')],_0x16028c[_0x2685('0x35')])&&_0x16028c[_0x2685('0x36')]&&!_0x16028c['customField']){_0x32f05[_0x16028c['nameField'][_0x2685('0x37')]()]=_0x16028c[_0x2685('0x38')][_0x2685('0x2d')]();}else if(_[_0x2685('0x32')]([_0x2685('0x33'),_0x2685('0x34')],_0x16028c[_0x2685('0x35')])&&_0x16028c[_0x2685('0x39')]&&_0x16028c[_0x2685('0x3a')]){_0x32f05[_0x2685('0x18')][_0x2685('0x3b')]({'id':_0x16028c['idField'],'value':_0x16028c[_0x2685('0x38')][_0x2685('0x2d')]()});}else if(_0x16028c[_0x2685('0x35')]===_0x2685('0x3c')&&_0x16028c[_0x2685('0x3d')]&&_0x16028c[_0x2685('0x39')]&&_0x16028c['customField']){_0x4f1b46[_0x16028c[_0x2685('0x3d')]]&&_0x32f05[_0x2685('0x18')][_0x2685('0x3b')]({'id':_0x16028c[_0x2685('0x39')],'value':_0x4f1b46[_0x16028c['variableName']][_0x2685('0x2d')]()});}else if(_0x16028c['type']===_0x2685('0x3e')&&_0x16028c[_0x2685('0x3f')]&&_0x16028c['Variable']['name']&&_0x16028c[_0x2685('0x39')]&&_0x16028c['customField']){_0x4f1b46[_0x16028c[_0x2685('0x3f')][_0x2685('0x14')][_0x2685('0x37')]()]&&_0x32f05['custom_fields'][_0x2685('0x3b')]({'id':_0x16028c[_0x2685('0x39')],'value':_0x4f1b46[_0x16028c[_0x2685('0x3f')][_0x2685('0x14')]['toLowerCase']()][_0x2685('0x2d')]()});}});}return _0x32f05;}exports[_0x2685('0x40')]=function(_0x35dfd8,_0x205825,_0x154a29,_0xd5d9de,_0x2d9fac,_0x3c6811){var _0x363656,_0x4b5990;_0x3c6811['remoteUri']=intUtil[_0x2685('0x41')](_0x3c6811[_0x2685('0x20')]);_0x3c6811['serverUrl']=intUtil[_0x2685('0x41')](_0x3c6811[_0x2685('0x42')]);if(_0x2d9fac&&_0x2d9fac[_0x2685('0x43')]){logger[_0x2685('0x1d')](_0x2685('0x44'),_0x2685('0x45'));_0x205825[_0x2685('0x46')]=util[_0x2685('0xd')](_0x2685('0x47'),_0x3c6811[_0x2685('0x42')],_0x205825[_0x2685('0x48')],md5(_0x205825[_0x2685('0x48')]));}else{_0x205825[_0x2685('0x46')]='';}headers['Authorization']=getAuth(_0x3c6811);return getUser(_0x3c6811,_0xd5d9de[_0x2685('0x23')])['then'](function(_0x4be872){_0x363656=_0x4be872;logger[_0x2685('0x1d')](_0x2685('0x49'),_0x363656['id']);return getEndUser(_0x3c6811,_0x205825[_0x2685('0x4a')],_0x205825[_0x2685('0xf')]);})[_0x2685('0x1c')](function(_0x1dcbea){_0x4b5990=_0x1dcbea;logger[_0x2685('0x1d')](_0x2685('0x4b'),_0x4b5990['id']);return getTicket(_0x3c6811,_0x363656,_0x4b5990,_0x154a29,_0x205825);})[_0x2685('0x1c')](function(_0x3a7ec1){if(_0x3a7ec1&&_0x3a7ec1['id']){logger[_0x2685('0x1d')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3a7ec1['id']);logger[_0x2685('0x1d')]('[QUEUE]',_0x2685('0x4c'));emit(util[_0x2685('0xd')](_0x2685('0x4d'),_0xd5d9de[_0x2685('0x14')]),'trigger:browser:url',{'uri':util[_0x2685('0xd')](_0x2685('0x4e'),_0x3c6811['remoteUri'],_0x3a7ec1['id'])});}})[_0x2685('0x4f')](function(_0x33c61d){logger[_0x2685('0x50')](_0x2685('0x44'),JSON[_0x2685('0x2f')](_0x33c61d));});};exports[_0x2685('0x51')]=function(_0x308fd5,_0x1c1794,_0x4b2bb3,_0x462d42,_0x43536d,_0x32576f,_0x3dfa62){var _0x3d63bd,_0x48c8de;_0x32576f['remoteUri']=intUtil[_0x2685('0x41')](_0x32576f[_0x2685('0x20')]);_0x32576f['serverUrl']=intUtil[_0x2685('0x41')](_0x32576f[_0x2685('0x42')]);if(_0x3dfa62&&_0x3dfa62[_0x2685('0x52')]&&_0x3dfa62['recordingFormat']!==_0x2685('0x53')){logger[_0x2685('0x1d')]('[OUTBOUND]',_0x2685('0x45'));_0x1c1794[_0x2685('0x46')]=util[_0x2685('0xd')](_0x2685('0x47'),_0x32576f[_0x2685('0x42')],_0x1c1794[_0x2685('0x48')],md5(_0x1c1794['uniqueid']));}headers[_0x2685('0x54')]=getAuth(_0x32576f);return getUser(_0x32576f,_0x462d42['email'])['then'](function(_0x5eebd7){_0x3d63bd=_0x5eebd7;logger[_0x2685('0x1d')](_0x2685('0x49'),_0x3d63bd['id']);return getEndUser(_0x32576f,_0x1c1794['destcalleridname'],_0x1c1794[_0x2685('0x55')]);})[_0x2685('0x1c')](function(_0x1a0b71){_0x48c8de=_0x1a0b71;logger[_0x2685('0x1d')](_0x2685('0x4b'),_0x48c8de['id']);return getTicket(_0x32576f,_0x3d63bd,_0x48c8de,_0x4b2bb3,_0x1c1794);})[_0x2685('0x1c')](function(_0x39c3e9){if(_0x39c3e9&&_0x39c3e9['id']){logger[_0x2685('0x1d')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x39c3e9['id']);logger[_0x2685('0x1d')](_0x2685('0x56'),_0x2685('0x4c'));emit(util[_0x2685('0xd')](_0x2685('0x4d'),_0x462d42[_0x2685('0x14')]),_0x2685('0x57'),{'uri':util[_0x2685('0xd')]('%s/helpdesk/tickets/%d',_0x32576f[_0x2685('0x20')],_0x39c3e9['id'])});}})['catch'](function(_0x57e3d5){logger['error'](_0x2685('0x56'),JSON[_0x2685('0x2f')](_0x57e3d5));});};exports['unmanaged']=function(_0x1ce853,_0x343707,_0x27cea5,_0x3e3158,_0x58fd3a,_0x158c7d){var _0x41bace,_0x59d27f;_0x158c7d[_0x2685('0x20')]=intUtil[_0x2685('0x41')](_0x158c7d[_0x2685('0x20')]);_0x158c7d[_0x2685('0x42')]=intUtil[_0x2685('0x41')](_0x158c7d[_0x2685('0x42')]);if(_0x58fd3a&&_0x58fd3a['monitor_format']){logger[_0x2685('0x1d')]('['+_0x343707[_0x2685('0x58')][_0x2685('0x59')]()+']',_0x2685('0x45'));_0x343707[_0x2685('0x46')]=util[_0x2685('0xd')](_0x2685('0x47'),_0x158c7d[_0x2685('0x42')],_0x343707[_0x2685('0x48')],md5(_0x343707['uniqueid']));}else{_0x343707[_0x2685('0x46')]='';}headers['Authorization']=getAuth(_0x158c7d);return getUser(_0x158c7d,'')['then'](function(_0xf5e115){_0x41bace=_0xf5e115;logger['info'](_0x2685('0x49'),_0x41bace['id']);return getEndUser(_0x158c7d,_0x343707['calleridname'],_0x343707[_0x2685('0xf')]);})[_0x2685('0x1c')](function(_0x411a77){_0x59d27f=_0x411a77;logger['info'](_0x2685('0x4b'),_0x59d27f['id']);return getTicket(_0x158c7d,_0x41bace,_0x59d27f,_0x27cea5,_0x343707);})[_0x2685('0x1c')](function(_0xb0bb2a){if(_0xb0bb2a){logger[_0x2685('0x1d')](_0x2685('0x5a'));logger[_0x2685('0x1d')](_0x2685('0x5b'),_0xb0bb2a['id']);}})[_0x2685('0x4f')](function(_0x4f711f){logger[_0x2685('0x50')]('['+_0x343707[_0x2685('0x58')][_0x2685('0x59')]()+']',JSON[_0x2685('0x2f')](_0x4f711f));});}; \ 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 1405670..fa9c89a 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 _0x4060=['Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','then','users','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','message','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','work_number','contactNumber','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','headers','ticketId','Task\x20created:','emit','trigger:browser:url','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','./util','../../../../config/environment','redis','defaults','socket.io-emitter','GET','Getting\x20admin\x20information','length','email','adminEmail','adminId','info'];(function(_0xf95644,_0x5d7710){var _0x2ad937=function(_0x333512){while(--_0x333512){_0xf95644['push'](_0xf95644['shift']());}};_0x2ad937(++_0x5d7710);}(_0x4060,0x18a));var _0x0406=function(_0x19909d,_0x26eae9){_0x19909d=_0x19909d-0x0;var _0x53f42d=_0x4060[_0x19909d];return _0x53f42d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x0406('0x0'));var util=require(_0x0406('0x1'));var moment=require(_0x0406('0x2'));var Promise=require(_0x0406('0x3'));var Redis=require('ioredis');var intUtil=require(_0x0406('0x4'));var config=require(_0x0406('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0x0406('0x6')]=_[_0x0406('0x7')](config[_0x0406('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0406('0x8'))(new Redis(config[_0x0406('0x6')]));function getAdminId(_0x491c80,_0x327691,_0x478d6c,_0x21b2ea){return new Promise(function(_0x948739,_0x2eb73d){var _0x555223=![];var _0x5c6bf8={'method':_0x0406('0x9'),'uri':_0x21b2ea+'/api/selector/owners','json':!![]};_0x5c6bf8['headers']=_0x478d6c;logger['info'](_0x0406('0xa'));return rp(_0x5c6bf8)['then'](function(_0x5aced5){if(_0x5aced5){var _0x287a0b=_0x5aced5['users'];var _0x2a2e01=null;for(_0x2a2e01=0x0;_0x2a2e01<_0x287a0b[_0x0406('0xb')];_0x2a2e01++){if(_0x287a0b[_0x2a2e01][_0x0406('0xc')]===_0x491c80[_0x0406('0xd')]){_0x491c80[_0x0406('0xe')]=_0x287a0b[_0x2a2e01]['id'];_0x555223=!![];}}if(_0x555223){logger[_0x0406('0xf')](_0x0406('0x10'),_0x491c80['adminId']);_0x948739(_0x491c80);}else{_0x2eb73d({'statusCode':0x194,'message':_0x0406('0x11')});}}else{_0x2eb73d({'statusCode':0x194,'message':_0x0406('0x11')});}})[_0x0406('0x12')](function(_0x108ccf){logger[_0x0406('0x13')]('['+[_0x327691[_0x0406('0x14')]()]+']',_0x108ccf['message']);_0x2eb73d(_0x108ccf);});});}function getUser(_0x41d472,_0x517e8a,_0x12321e){return function(_0x5e79f3){return new Promise(function(_0x46030a,_0xf8c9ed){var _0x3c5f49={'method':_0x0406('0x9'),'uri':_0x12321e+_0x0406('0x15'),'json':!![]};_0x3c5f49['headers']=_0x517e8a;logger[_0x0406('0xf')](_0x0406('0x16'));return rp(_0x3c5f49)[_0x0406('0x17')](function(_0x23b9ef){if(_0x23b9ef){var _0x2cb13d=_0x23b9ef[_0x0406('0x18')];var _0x3640ba=![];var _0x4e2690=null;if(_0x5e79f3[_0x0406('0x19')]!==null){logger['info'](_0x0406('0x1a'),_0x5e79f3['agentEmail']);_0x5e79f3['userEmail']=_0x5e79f3[_0x0406('0x19')];for(_0x4e2690=0x0;_0x4e2690<_0x2cb13d[_0x0406('0xb')];_0x4e2690++){if(_0x2cb13d[_0x4e2690]['email']===_0x5e79f3[_0x0406('0x19')]){_0x3640ba=!![];_0x5e79f3['userId']=_0x2cb13d[_0x4e2690]['id'];logger[_0x0406('0xf')](_0x0406('0x1b'),_0x5e79f3[_0x0406('0x1c')]);}}}if(!_0x3640ba){logger['info'](_0x0406('0x1d'));_0x5e79f3[_0x0406('0x1e')]=_0x5e79f3[_0x0406('0xd')];_0x5e79f3[_0x0406('0x1c')]=_0x5e79f3[_0x0406('0xe')];_0x3640ba=!![];}if(_0x3640ba){_0x46030a(_0x5e79f3);}else{_0xf8c9ed({'statusCode':0x194,'message':_0x0406('0x11')});}}else{_0xf8c9ed({'statusCode':0x194,'message':_0x0406('0x11')});}})[_0x0406('0x12')](function(_0x2b1715){logger['error']('['+[_0x41d472[_0x0406('0x14')]()]+']',_0x2b1715[_0x0406('0x1f')]);_0xf8c9ed(_0x2b1715);});});};}function searchContact(_0x581420,_0x40af9a,_0x7035a6,_0xdb5f48){return new Promise(function(_0x321dfc,_0x3c2351){var _0x486324={'method':_0x0406('0x9'),'headers':_0x40af9a,'uri':_0x581420+_0x0406('0x20')+_0xdb5f48+'&f='+_0x7035a6+_0x0406('0x21'),'json':!![]};rp(_0x486324)[_0x0406('0x17')](function(_0x5025e6){var _0x265e75=_[_0x0406('0x22')](_0x5025e6[_0x0406('0x23')]['contacts'],[_0x7035a6,_0xdb5f48]);_0x321dfc(_0x265e75);})[_0x0406('0x12')](function(_0x3c0c4c){_0x3c2351(_0x3c0c4c);});});}function getEndUser(_0x4493b2,_0x3dc509,_0x106c73){return function(_0x1a1ec9){return new Promise(function(_0x51fdf6,_0x4d68dc){logger[_0x0406('0xf')](util[_0x0406('0x24')](_0x0406('0x25'),_0x1a1ec9['contactNumber']));searchContact(_0x106c73,_0x3dc509,_0x0406('0x26'),_0x1a1ec9['contactNumber'])[_0x0406('0x17')](function(_0xf71ca8){if(_0xf71ca8){_0x1a1ec9[_0x0406('0x27')]=_0xf71ca8['id'];logger[_0x0406('0xf')]('Contact\x20found\x20mobile_number:',_0x1a1ec9[_0x0406('0x27')]);return _0x51fdf6(_0x1a1ec9);}searchContact(_0x106c73,_0x3dc509,_0x0406('0x28'),_0x1a1ec9[_0x0406('0x29')])['then'](function(_0x225623){if(_0x225623){_0x1a1ec9[_0x0406('0x27')]=_0x225623['id'];logger[_0x0406('0xf')]('Contact\x20found\x20work_number:',_0x1a1ec9[_0x0406('0x27')]);return _0x51fdf6(_0x1a1ec9);}createEndUser(_0x1a1ec9,_0x4493b2,_0x3dc509,_0x106c73)[_0x0406('0x17')](function(_0x98cebe){logger[_0x0406('0xf')]('Contact\x20created:',_0x98cebe[_0x0406('0x27')]);return _0x51fdf6(_0x98cebe);});});})['catch'](function(_0x5ae214){_0x4d68dc(_0x5ae214);});});};}function createEndUser(_0x4545ea,_0x346333,_0x5b7df8,_0x254a40){return new Promise(function(_0x4aee22,_0x4a38a2){var _0x599ce0=moment();var _0x375842={'method':'POST','uri':_0x254a40+_0x0406('0x2a'),'body':{'contact':{'last_name':_0x4545ea[_0x0406('0x29')],'work_number':_0x4545ea[_0x0406('0x29')],'mobile_number':_0x4545ea[_0x0406('0x29')],'owner_id':_0x4545ea[_0x0406('0x1c')],'created_at':_0x599ce0[_0x0406('0x24')](_0x0406('0x2b'))}},'json':!![]};_0x375842['headers']=_0x5b7df8;logger[_0x0406('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x375842)[_0x0406('0x17')](function(_0x429c8e){_0x4545ea[_0x0406('0x27')]=_0x429c8e[_0x0406('0x2c')]['id'];_0x4aee22(_0x4545ea);})['catch'](function(_0x332396){logger[_0x0406('0x13')]('['+[_0x346333[_0x0406('0x14')]()]+']',_0x332396[_0x0406('0x1f')]);_0x4a38a2(_0x332396[_0x0406('0x1f')]);});});}function getTicket(_0x2a4620,_0x46ed9c,_0x586bcc,_0x3ecc25,_0x522113){return function(_0x36a3bd){logger[_0x0406('0xf')](_0x0406('0x2d'));return new Promise(function(_0x47a2af,_0x551666){var _0x147169=moment();var _0x3c41ab={'method':_0x0406('0x2e'),'uri':_0x586bcc+_0x0406('0x2f'),'body':{'title':intUtil[_0x0406('0x30')](_0x3ecc25[_0x0406('0x31')],_0x522113,'\x20'),'description':intUtil['getString'](_0x3ecc25[_0x0406('0x32')],_0x522113,'\x0a'),'owner_id':_0x36a3bd[_0x0406('0x1c')],'creater_id':_0x36a3bd[_0x0406('0xe')],'targetable_id':_0x36a3bd['endUserId'],'targetable_type':_0x0406('0x33'),'created_at':_0x147169[_0x0406('0x24')](_0x0406('0x2b')),'due_date':_0x147169[_0x0406('0x34')](0x1e,'m')['format'](_0x0406('0x2b'))},'json':!![]};_0x3c41ab[_0x0406('0x35')]=_0x46ed9c;return rp(_0x3c41ab)[_0x0406('0x17')](function(_0x25ab99){_0x36a3bd[_0x0406('0x36')]=_0x25ab99['task']['id'];logger['info'](_0x0406('0x37'),_0x36a3bd[_0x0406('0x36')]);_0x47a2af(_0x36a3bd);})[_0x0406('0x12')](function(_0x1acea8){logger[_0x0406('0x13')]('['+[_0x2a4620[_0x0406('0x14')]()]+']',_0x1acea8[_0x0406('0x1f')]);_0x551666(_0x1acea8[_0x0406('0x1f')]);});});};}function emit(_0x249583,_0x330784,_0x3c6444){var _0x3bf059={'uri':_0x249583+'/contacts/'+_0x3c6444};io['to'](util[_0x0406('0x24')]('user:%s',_0x330784))[_0x0406('0x38')](_0x0406('0x39'),_0x3bf059);}exports['cs']=function(_0x4e175c,_0x46d978,_0x1cd75a,_0xf10cd6,_0x516cce,_0x30150b,_0x597d53,_0x55863d){var _0x4047bf={};var _0x4f8ae7={'Authorization':'Token\x20token='+_0x30150b[_0x0406('0x3a')]};_0x30150b['remoteUri']=intUtil['stripTrailingSlash'](_0x30150b[_0x0406('0x3b')]);_0x30150b[_0x0406('0x3c')]=intUtil[_0x0406('0x3d')](_0x30150b[_0x0406('0x3c')]);var _0x1be67a=_0x30150b[_0x0406('0x3b')];_0x4047bf['adminEmail']=_0x30150b[_0x0406('0x3e')];_0x4047bf[_0x0406('0x29')]=_0x55863d[_0x0406('0x3f')]()===_0x0406('0x40')?_0x46d978[_0x0406('0x41')]:_0x46d978[_0x0406('0x42')];_0x4047bf[_0x0406('0x43')]=_0x55863d===_0x0406('0x44')||_0x55863d===_0x0406('0x45')?'queue':_0x0406('0x40');if(_0xf10cd6){_0x4047bf[_0x0406('0x19')]=_0xf10cd6[_0x0406('0xc')];}var _0x11ba40=util[_0x0406('0x24')](_0x0406('0x46'),_0x30150b['serverUrl'],_0x46d978[_0x0406('0x47')],md5(_0x46d978[_0x0406('0x47')]));if(_0x516cce&&_0x516cce[_0x0406('0x48')]){logger['info'](_0x0406('0x49'),'Recording\x20is\x20enabled!');_0x46d978[_0x0406('0x4a')]=_0x11ba40;}else if(_0x597d53&&_0x597d53[_0x0406('0x4b')]&&_0x597d53[_0x0406('0x4b')]!==_0x0406('0x4c')){logger[_0x0406('0xf')]('[OUTBOUND]',_0x0406('0x4d'));_0x46d978['recordingURL']=_0x11ba40;}else{_0x46d978[_0x0406('0x4a')]='';}return getAdminId(_0x4047bf,_0x55863d,_0x4f8ae7,_0x1be67a)[_0x0406('0x17')](getUser(_0x55863d,_0x4f8ae7,_0x1be67a))[_0x0406('0x17')](getEndUser(_0x55863d,_0x4f8ae7,_0x1be67a))['then'](getTicket(_0x55863d,_0x4f8ae7,_0x1be67a,_0x1cd75a,_0x46d978))[_0x0406('0x17')](function(_0x3f7b21){logger[_0x0406('0xf')](util[_0x0406('0x24')](_0x0406('0x4e'),_0x3f7b21['ticketId']));if(_0x55863d!==_0x0406('0x45')){logger[_0x0406('0xf')]('['+[_0x55863d[_0x0406('0x14')]()]+']',_0x0406('0x4f'));emit(_0x1be67a,_0xf10cd6['name'],_0x3f7b21[_0x0406('0x27')]);}})[_0x0406('0x12')](function(_0x15bd1c){logger[_0x0406('0x13')]('['+[_0x55863d[_0x0406('0x14')]()]+_0x0406('0x50'),util[_0x0406('0x51')](_0x15bd1c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2f9e=['Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId'];(function(_0x2d7170,_0x55fc31){var _0xb0df87=function(_0x590aca){while(--_0x590aca){_0x2d7170['push'](_0x2d7170['shift']());}};_0xb0df87(++_0x55fc31);}(_0x2f9e,0x8b));var _0xe2f9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2f9e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe2f9('0x0'));var rp=require(_0xe2f9('0x1'));var md5=require(_0xe2f9('0x2'));var util=require(_0xe2f9('0x3'));var moment=require(_0xe2f9('0x4'));var Promise=require(_0xe2f9('0x5'));var Redis=require('ioredis');var intUtil=require(_0xe2f9('0x6'));var config=require(_0xe2f9('0x7'));var logger=require('../../../../config/logger')(_0xe2f9('0x8'));config[_0xe2f9('0x9')]=_['defaults'](config['redis'],{'host':_0xe2f9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe2f9('0x9')]));function getAdminId(_0x234229,_0x1cfdd4,_0xbb37fb,_0x4eb00a){return new Promise(function(_0x19276f,_0x4b5513){var _0x4e5509=![];var _0x1b4d55={'method':_0xe2f9('0xb'),'uri':_0x4eb00a+_0xe2f9('0xc'),'json':!![]};_0x1b4d55[_0xe2f9('0xd')]=_0xbb37fb;logger[_0xe2f9('0xe')](_0xe2f9('0xf'));return rp(_0x1b4d55)['then'](function(_0x2efcdd){if(_0x2efcdd){var _0x15c60b=_0x2efcdd[_0xe2f9('0x10')];var _0x56930c=null;for(_0x56930c=0x0;_0x56930c<_0x15c60b[_0xe2f9('0x11')];_0x56930c++){if(_0x15c60b[_0x56930c][_0xe2f9('0x12')]===_0x234229[_0xe2f9('0x13')]){_0x234229[_0xe2f9('0x14')]=_0x15c60b[_0x56930c]['id'];_0x4e5509=!![];}}if(_0x4e5509){logger[_0xe2f9('0xe')](_0xe2f9('0x15'),_0x234229[_0xe2f9('0x14')]);_0x19276f(_0x234229);}else{_0x4b5513({'statusCode':0x194,'message':_0xe2f9('0x16')});}}else{_0x4b5513({'statusCode':0x194,'message':_0xe2f9('0x16')});}})[_0xe2f9('0x17')](function(_0x5c3cd0){logger[_0xe2f9('0x18')]('['+[_0x1cfdd4[_0xe2f9('0x19')]()]+']',_0x5c3cd0[_0xe2f9('0x1a')]);_0x4b5513(_0x5c3cd0);});});}function getUser(_0x5355e4,_0x2beb9e,_0x54fef0){return function(_0x32ddd1){return new Promise(function(_0x52fd18,_0x2e61a5){var _0x642419={'method':'GET','uri':_0x54fef0+'/api/selector/owners','json':!![]};_0x642419['headers']=_0x2beb9e;logger['info'](_0xe2f9('0x1b'));return rp(_0x642419)[_0xe2f9('0x1c')](function(_0x777e35){if(_0x777e35){var _0x1974d1=_0x777e35['users'];var _0x557bf6=![];var _0x1455d4=null;if(_0x32ddd1['agentEmail']!==null){logger[_0xe2f9('0xe')](_0xe2f9('0x1d'),_0x32ddd1[_0xe2f9('0x1e')]);_0x32ddd1[_0xe2f9('0x1f')]=_0x32ddd1['agentEmail'];for(_0x1455d4=0x0;_0x1455d4<_0x1974d1[_0xe2f9('0x11')];_0x1455d4++){if(_0x1974d1[_0x1455d4][_0xe2f9('0x12')]===_0x32ddd1['agentEmail']){_0x557bf6=!![];_0x32ddd1['userId']=_0x1974d1[_0x1455d4]['id'];logger['info']('User\x20found:',_0x32ddd1[_0xe2f9('0x20')]);}}}if(!_0x557bf6){logger[_0xe2f9('0xe')](_0xe2f9('0x21'));_0x32ddd1[_0xe2f9('0x1f')]=_0x32ddd1[_0xe2f9('0x13')];_0x32ddd1[_0xe2f9('0x20')]=_0x32ddd1[_0xe2f9('0x14')];_0x557bf6=!![];}if(_0x557bf6){_0x52fd18(_0x32ddd1);}else{_0x2e61a5({'statusCode':0x194,'message':_0xe2f9('0x16')});}}else{_0x2e61a5({'statusCode':0x194,'message':_0xe2f9('0x16')});}})[_0xe2f9('0x17')](function(_0x58e41b){logger[_0xe2f9('0x18')]('['+[_0x5355e4[_0xe2f9('0x19')]()]+']',_0x58e41b[_0xe2f9('0x1a')]);_0x2e61a5(_0x58e41b);});});};}function searchContact(_0x57fe8f,_0x372619,_0x3768f8,_0x9da846){return new Promise(function(_0x4b4a92,_0x40dbb0){var _0x3b9028={'method':'GET','headers':_0x372619,'uri':_0x57fe8f+_0xe2f9('0x22')+_0x9da846+_0xe2f9('0x23')+_0x3768f8+_0xe2f9('0x24'),'json':!![]};rp(_0x3b9028)[_0xe2f9('0x1c')](function(_0x6fa584){var _0x4ffdd2=_[_0xe2f9('0x25')](_0x6fa584[_0xe2f9('0x26')]['contacts'],[_0x3768f8,_0x9da846]);_0x4b4a92(_0x4ffdd2);})['catch'](function(_0x51f83b){_0x40dbb0(_0x51f83b);});});}function getEndUser(_0x16220e,_0x22b4ff,_0x1811f0){return function(_0x83ce98){return new Promise(function(_0x3069dc,_0x4efc24){logger[_0xe2f9('0xe')](util[_0xe2f9('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x83ce98[_0xe2f9('0x28')]));searchContact(_0x1811f0,_0x22b4ff,_0xe2f9('0x29'),_0x83ce98[_0xe2f9('0x28')])[_0xe2f9('0x1c')](function(_0x514cbf){if(_0x514cbf){_0x83ce98[_0xe2f9('0x2a')]=_0x514cbf['id'];logger[_0xe2f9('0xe')](_0xe2f9('0x2b'),_0x83ce98[_0xe2f9('0x2a')]);return _0x3069dc(_0x83ce98);}searchContact(_0x1811f0,_0x22b4ff,_0xe2f9('0x2c'),_0x83ce98['contactNumber'])['then'](function(_0x49bf83){if(_0x49bf83){_0x83ce98[_0xe2f9('0x2a')]=_0x49bf83['id'];logger[_0xe2f9('0xe')](_0xe2f9('0x2d'),_0x83ce98[_0xe2f9('0x2a')]);return _0x3069dc(_0x83ce98);}createEndUser(_0x83ce98,_0x16220e,_0x22b4ff,_0x1811f0)['then'](function(_0x117b15){logger['info'](_0xe2f9('0x2e'),_0x117b15[_0xe2f9('0x2a')]);return _0x3069dc(_0x117b15);});});})[_0xe2f9('0x17')](function(_0x27b6fd){_0x4efc24(_0x27b6fd);});});};}function createEndUser(_0xb51c19,_0x175420,_0x1b8109,_0x333bbd){return new Promise(function(_0x4acabd,_0x4e678d){var _0x1d2b6c=moment();var _0x5a65ff={'method':_0xe2f9('0x2f'),'uri':_0x333bbd+_0xe2f9('0x30'),'body':{'contact':{'last_name':_0xb51c19[_0xe2f9('0x28')],'work_number':_0xb51c19['contactNumber'],'mobile_number':_0xb51c19[_0xe2f9('0x28')],'owner_id':_0xb51c19[_0xe2f9('0x20')],'created_at':_0x1d2b6c['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5a65ff['headers']=_0x1b8109;logger[_0xe2f9('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5a65ff)['then'](function(_0x359c1a){_0xb51c19[_0xe2f9('0x2a')]=_0x359c1a[_0xe2f9('0x31')]['id'];_0x4acabd(_0xb51c19);})[_0xe2f9('0x17')](function(_0x3d3813){logger[_0xe2f9('0x18')]('['+[_0x175420['toUpperCase']()]+']',_0x3d3813[_0xe2f9('0x1a')]);_0x4e678d(_0x3d3813[_0xe2f9('0x1a')]);});});}function getTicket(_0x359efb,_0x1db33c,_0x19d71a,_0x2102e7,_0xe3928c){return function(_0x4c8165){logger['info'](_0xe2f9('0x32'));return new Promise(function(_0x2f229a,_0x1221c8){var _0x5cc04d=moment();var _0x5be96c={'method':_0xe2f9('0x2f'),'uri':_0x19d71a+'/api/tasks','body':{'title':intUtil[_0xe2f9('0x33')](_0x2102e7[_0xe2f9('0x34')],_0xe3928c,'\x20'),'description':intUtil[_0xe2f9('0x33')](_0x2102e7[_0xe2f9('0x35')],_0xe3928c,'\x0a'),'owner_id':_0x4c8165['userId'],'creater_id':_0x4c8165['adminId'],'targetable_id':_0x4c8165[_0xe2f9('0x2a')],'targetable_type':_0xe2f9('0x36'),'created_at':_0x5cc04d[_0xe2f9('0x27')](_0xe2f9('0x37')),'due_date':_0x5cc04d[_0xe2f9('0x38')](0x1e,'m')[_0xe2f9('0x27')](_0xe2f9('0x37'))},'json':!![]};_0x5be96c['headers']=_0x1db33c;return rp(_0x5be96c)[_0xe2f9('0x1c')](function(_0x5c1f72){_0x4c8165[_0xe2f9('0x39')]=_0x5c1f72[_0xe2f9('0x3a')]['id'];logger[_0xe2f9('0xe')](_0xe2f9('0x3b'),_0x4c8165[_0xe2f9('0x39')]);_0x2f229a(_0x4c8165);})[_0xe2f9('0x17')](function(_0x401704){logger['error']('['+[_0x359efb[_0xe2f9('0x19')]()]+']',_0x401704['message']);_0x1221c8(_0x401704[_0xe2f9('0x1a')]);});});};}function emit(_0x287c7f,_0x4a0f5a,_0x4b2f0b){var _0x1927e8={'uri':_0x287c7f+_0xe2f9('0x3c')+_0x4b2f0b};io['to'](util[_0xe2f9('0x27')]('user:%s',_0x4a0f5a))[_0xe2f9('0x3d')](_0xe2f9('0x3e'),_0x1927e8);}exports['cs']=function(_0x3c5076,_0x1ee112,_0x3d3ac7,_0x2fc713,_0x1aa4ec,_0x3263df,_0x3dd1b8,_0x443a4b){var _0xd09f64={};var _0x450469={'Authorization':_0xe2f9('0x3f')+_0x3263df[_0xe2f9('0x40')]};_0x3263df[_0xe2f9('0x41')]=intUtil[_0xe2f9('0x42')](_0x3263df[_0xe2f9('0x41')]);_0x3263df[_0xe2f9('0x43')]=intUtil[_0xe2f9('0x42')](_0x3263df[_0xe2f9('0x43')]);var _0x4cf43f=_0x3263df[_0xe2f9('0x41')];_0xd09f64[_0xe2f9('0x13')]=_0x3263df[_0xe2f9('0x44')];_0xd09f64['contactNumber']=_0x443a4b[_0xe2f9('0x45')]()==='outbound'?_0x1ee112[_0xe2f9('0x46')]:_0x1ee112[_0xe2f9('0x47')];_0xd09f64[_0xe2f9('0x48')]=_0x443a4b===_0xe2f9('0x49')||_0x443a4b==='unmanaged'?'queue':_0xe2f9('0x4a');if(_0x2fc713){_0xd09f64['agentEmail']=_0x2fc713['email'];}var _0x4026eb=util[_0xe2f9('0x27')](_0xe2f9('0x4b'),_0x3263df[_0xe2f9('0x43')],_0x1ee112[_0xe2f9('0x4c')],md5(_0x1ee112[_0xe2f9('0x4c')]));if(_0x1aa4ec&&_0x1aa4ec[_0xe2f9('0x4d')]){logger[_0xe2f9('0xe')]('[QUEUE]',_0xe2f9('0x4e'));_0x1ee112['recordingURL']=_0x4026eb;}else if(_0x3dd1b8&&_0x3dd1b8[_0xe2f9('0x4f')]&&_0x3dd1b8['recordingFormat']!=='none'){logger['info'](_0xe2f9('0x50'),_0xe2f9('0x4e'));_0x1ee112['recordingURL']=_0x4026eb;}else{_0x1ee112['recordingURL']='';}return getAdminId(_0xd09f64,_0x443a4b,_0x450469,_0x4cf43f)[_0xe2f9('0x1c')](getUser(_0x443a4b,_0x450469,_0x4cf43f))[_0xe2f9('0x1c')](getEndUser(_0x443a4b,_0x450469,_0x4cf43f))[_0xe2f9('0x1c')](getTicket(_0x443a4b,_0x450469,_0x4cf43f,_0x3d3ac7,_0x1ee112))[_0xe2f9('0x1c')](function(_0x2d9524){logger[_0xe2f9('0xe')](util[_0xe2f9('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2d9524[_0xe2f9('0x39')]));if(_0x443a4b!==_0xe2f9('0x51')){logger[_0xe2f9('0xe')]('['+[_0x443a4b[_0xe2f9('0x19')]()]+']',_0xe2f9('0x52'));emit(_0x4cf43f,_0x2fc713[_0xe2f9('0x53')],_0x2d9524[_0xe2f9('0x2a')]);}})['catch'](function(_0x269c88){logger['error']('['+[_0x443a4b['toUpperCase']()]+_0xe2f9('0x54'),util[_0xe2f9('0x55')](_0x269c88,{'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 50da853..45676c2 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 _0x3926=['data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','data1','toLowerCase','find','Configurations','queue','routeId','EVENT\x20UNKNOWN','unmanaged','zoho','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3926,0xb1));var _0x6392=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3926[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x6392('0x0'));var zendesk=require(_0x6392('0x1'));var salesforce=require(_0x6392('0x2'));var sugarcrm=require(_0x6392('0x3'));var freshdesk=require(_0x6392('0x4'));var zoho=require(_0x6392('0x5'));var desk=require(_0x6392('0x6'));var vtiger=require(_0x6392('0x7'));var servicenow=require(_0x6392('0x8'));var dynamics365=require(_0x6392('0x9'));var freshsales=require(_0x6392('0xa'));var integrations=[_0x6392('0xb'),_0x6392('0xc'),_0x6392('0xd'),_0x6392('0xe'),'zoho',_0x6392('0xf'),_0x6392('0x10'),_0x6392('0x11'),_0x6392('0x12'),_0x6392('0x13')];exports['exec']=function(_0x4c4b8f,_0x12f0fc,_0x45a112,_0x2a38f6,_0x1eceaf,_0x149521){if(_0x45a112){if(_['includes'](integrations,_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')]())){try{var _0x287b2a=null;var _0x17d65='';var _0x5eba8a=_0x45a112[_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')]()];if(_0x5eba8a){var _0x3f681c=_0x5eba8a[_0x4c4b8f['data2']];if(_0x3f681c){var _0x4ae4b9=_[_0x6392('0x16')](_0x3f681c[_0x6392('0x17')],{'id':parseInt(_0x4c4b8f['data3'],0xa)});if(_0x4ae4b9){if(_0x2a38f6){if(_0x1eceaf&&_0x12f0fc['queue']){_0x17d65=_0x6392('0x18');}else if(_0x12f0fc[_0x6392('0x19')]){_0x17d65='outbound';}else{console['log'](_0x6392('0x1a'),_0x12f0fc);}}else{_0x17d65=_0x6392('0x1b');}switch(_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')]()){case'zendesk':zendesk[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case _0x6392('0xc'):salesforce[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case _0x6392('0xd'):sugarcrm[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case _0x6392('0xe'):freshdesk[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case _0x6392('0x1c'):zoho[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case _0x6392('0xf'):desk[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case'vtiger':vtiger[_0x17d65](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521);break;case'freshsales':freshsales['cs'](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521,_0x17d65);break;case _0x6392('0x13'):servicenow['cs'](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521,_0x17d65);break;case _0x6392('0x11'):dynamics365['cs'](_0x4c4b8f,_0x12f0fc,_0x4ae4b9,_0x2a38f6,_0x1eceaf,_0x3f681c,_0x149521,_0x17d65);break;default:console['log']('unknown\x20integration');}}else{_0x287b2a=require(_0x6392('0x1d'))(_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')]());_0x287b2a[_0x6392('0x1e')](_0x6392('0x1f'),util['format'](_0x6392('0x20'),_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')](),_0x4c4b8f[_0x6392('0x21')]));}}else{_0x287b2a=require(_0x6392('0x1d'))(_0x4c4b8f[_0x6392('0x14')][_0x6392('0x15')]());_0x287b2a['error'](_0x6392('0x1f'),util['format'](_0x6392('0x22'),_0x4c4b8f[_0x6392('0x14')]['toLowerCase'](),_0x4c4b8f['data2']));}}else{}}catch(_0x968350){console[_0x6392('0x1e')](_0x968350);}}}}; \ No newline at end of file +var _0xb69e=['./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','freshsales','servicenow','exec','data1','toLowerCase','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util'];(function(_0x38a9a2,_0x16c849){var _0x1492cd=function(_0x38b8fe){while(--_0x38b8fe){_0x38a9a2['push'](_0x38a9a2['shift']());}};_0x1492cd(++_0x16c849);}(_0xb69e,0xe8));var _0xeb69=function(_0x14977f,_0x5f4e25){_0x14977f=_0x14977f-0x0;var _0x33e870=_0xb69e[_0x14977f];return _0x33e870;};'use strict';var _=require(_0xeb69('0x0'));var util=require(_0xeb69('0x1'));var zendesk=require(_0xeb69('0x2'));var salesforce=require(_0xeb69('0x3'));var sugarcrm=require(_0xeb69('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xeb69('0x5'));var desk=require('./desk');var vtiger=require(_0xeb69('0x6'));var servicenow=require(_0xeb69('0x7'));var dynamics365=require(_0xeb69('0x8'));var freshsales=require(_0xeb69('0x9'));var integrations=[_0xeb69('0xa'),_0xeb69('0xb'),'sugarcrm',_0xeb69('0xc'),_0xeb69('0xd'),_0xeb69('0xe'),'vtiger','dynamics365',_0xeb69('0xf'),_0xeb69('0x10')];exports[_0xeb69('0x11')]=function(_0x437fcc,_0x339811,_0x4b8cec,_0x391721,_0x3b93be,_0x5a9bd7){if(_0x4b8cec){if(_['includes'](integrations,_0x437fcc[_0xeb69('0x12')][_0xeb69('0x13')]())){try{var _0x1797b5=null;var _0x582318='';var _0x5e9fa7=_0x4b8cec[_0x437fcc['data1']['toLowerCase']()];if(_0x5e9fa7){var _0x31e794=_0x5e9fa7[_0x437fcc['data2']];if(_0x31e794){var _0x3600a2=_[_0xeb69('0x14')](_0x31e794['Configurations'],{'id':parseInt(_0x437fcc[_0xeb69('0x15')],0xa)});if(_0x3600a2){if(_0x391721){if(_0x3b93be&&_0x339811[_0xeb69('0x16')]){_0x582318=_0xeb69('0x16');}else if(_0x339811[_0xeb69('0x17')]){_0x582318=_0xeb69('0x18');}else{console[_0xeb69('0x19')](_0xeb69('0x1a'),_0x339811);}}else{_0x582318=_0xeb69('0x1b');}switch(_0x437fcc[_0xeb69('0x12')][_0xeb69('0x13')]()){case _0xeb69('0xa'):zendesk[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0xb'):salesforce[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0x1c'):sugarcrm[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0xc'):freshdesk[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case'zoho':zoho[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0xe'):desk[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0x1d'):vtiger[_0x582318](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7);break;case _0xeb69('0xf'):freshsales['cs'](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7,_0x582318);break;case _0xeb69('0x10'):servicenow['cs'](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7,_0x582318);break;case _0xeb69('0x1e'):dynamics365['cs'](_0x437fcc,_0x339811,_0x3600a2,_0x391721,_0x3b93be,_0x31e794,_0x5a9bd7,_0x582318);break;default:console[_0xeb69('0x19')](_0xeb69('0x1f'));}}else{_0x1797b5=require(_0xeb69('0x20'))(_0x437fcc[_0xeb69('0x12')][_0xeb69('0x13')]());_0x1797b5['error']('[EXEC]',util[_0xeb69('0x21')](_0xeb69('0x22'),_0x437fcc['data1'][_0xeb69('0x13')](),_0x437fcc['data3']));}}else{_0x1797b5=require(_0xeb69('0x20'))(_0x437fcc[_0xeb69('0x12')][_0xeb69('0x13')]());_0x1797b5['error'](_0xeb69('0x23'),util[_0xeb69('0x21')](_0xeb69('0x24'),_0x437fcc[_0xeb69('0x12')]['toLowerCase'](),_0x437fcc[_0xeb69('0x25')]));}}else{}}catch(_0xeb96e9){console[_0xeb69('0x26')](_0xeb96e9);}}}}; \ 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 dbc2bd8..c090f62 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 _0x9e79=['No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','includes','string','picklist','idField','toString','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','utc','IsReminderSet','endUserType','contact','WhoId','account','ticketType','Case','ContactId','AccountId','lead','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Email','Name','identity','resolve','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','additionalSearchAccount','Account','Contact','Lead','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','format','Company'];(function(_0x3faebb,_0xeac4eb){var _0x5b289c=function(_0x15780e){while(--_0x15780e){_0x3faebb['push'](_0x3faebb['shift']());}};_0x5b289c(++_0xeac4eb);}(_0x9e79,0x13a));var _0x99e7=function(_0x1bcb52,_0x4d389f){_0x1bcb52=_0x1bcb52-0x0;var _0x1b7865=_0x9e79[_0x1bcb52];return _0x1b7865;};'use strict';var _=require(_0x99e7('0x0'));var rp=require(_0x99e7('0x1'));var moment=require(_0x99e7('0x2'));var BPromise=require(_0x99e7('0x3'));var md5=require(_0x99e7('0x4'));var jsforce=require(_0x99e7('0x5'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x99e7('0x6'));var logger=require('../../../../config/logger')(_0x99e7('0x7'));config['redis']=_[_0x99e7('0x8')](config[_0x99e7('0x9')],{'host':_0x99e7('0xa'),'port':0x18eb});var io=require(_0x99e7('0xb'))(new Redis(config['redis']));function emit(_0x15f02a,_0x1c3dfa,_0x459880){io['to'](_0x15f02a)[_0x99e7('0xc')](_0x1c3dfa,_0x459880);}function getTicket(_0x46304c,_0x2b973e,_0x555458,_0x60fc45,_0xa150cf,_0x16616e,_0x280c0b,_0x129241){var _0x383beb=Object[_0x99e7('0xd')]({},{'OwnerId':_0x2b973e['id'],'Subject':intUtil[_0x99e7('0xe')](_0x60fc45[_0x99e7('0xf')],_0xa150cf,'\x20'),'Description':intUtil[_0x99e7('0xe')](_0x60fc45[_0x99e7('0x10')],_0xa150cf,'\x0a')},getCustomFields(_0x16616e,_0xa150cf));if(_0x555458){if(_0x60fc45['ticketType']===_0x99e7('0x11')){_0x383beb['ActivityDate']=moment[_0x99e7('0x12')]();_0x383beb[_0x99e7('0x13')]=![];_0x383beb['IsRecurrence']=![];if(_0x555458[_0x99e7('0x14')]===_0x99e7('0x15')||_0x555458[_0x99e7('0x14')]==='lead'){_0x383beb[_0x99e7('0x16')]=_0x555458['id'];}else if(_0x555458['endUserType']===_0x99e7('0x17')){_0x383beb['WhatId']=_0x555458['id'];}}else if(_0x60fc45[_0x99e7('0x18')]===_0x99e7('0x19')){if(_0x555458['endUserType']===_0x99e7('0x15')){_0x383beb[_0x99e7('0x1a')]=_0x555458['id'];}else if(_0x555458[_0x99e7('0x14')]===_0x99e7('0x17')){_0x383beb[_0x99e7('0x1b')]=_0x555458['id'];}else if(_0x555458[_0x99e7('0x14')]===_0x99e7('0x1c')&&_0x60fc45['leadId']){_0x383beb[_0x60fc45['leadId']]=_0x555458['id'];}else{logger[_0x99e7('0x1d')](_0x99e7('0x1e'));}}}return _0x280c0b[_0x99e7('0x1f')](_0x60fc45[_0x99e7('0x18')])[_0x99e7('0x20')](_0x383beb);}function getUser(_0x43cc3b,_0x46e7b3,_0x24f206){if(!_[_0x99e7('0x21')](_0x46e7b3)&&intUtil[_0x99e7('0x22')](_0x46e7b3)){var _0x1a10f3={'Email':_0x46e7b3};var _0x40764e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x24f206[_0x99e7('0x1f')]('User')[_0x99e7('0x23')](_0x1a10f3,_0x40764e)[_0x99e7('0x24')]()[_0x99e7('0x25')](function(_0x1681fa){if(_0x1681fa[_0x99e7('0x26')]){var _0x4816f6=_[_0x99e7('0x23')](_0x1681fa,function(_0x2980f2){return _0x2980f2[_0x99e7('0x27')]===_0x46e7b3;});if(_0x4816f6){logger[_0x99e7('0x1d')]('Agent\x20%s\x20found.',_0x46e7b3);return BPromise['resolve']({'id':_0x4816f6['Id'],'name':_0x4816f6[_0x99e7('0x28')]});}}else{logger[_0x99e7('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x46e7b3);return _0x24f206[_0x99e7('0x29')]()[_0x99e7('0x25')](function(_0x10db11){return BPromise[_0x99e7('0x2a')]({'id':_0x10db11['user_id'],'name':_0x10db11[_0x99e7('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x46e7b3);return _0x24f206[_0x99e7('0x29')]()['then'](function(_0x4381e5){return BPromise[_0x99e7('0x2a')]({'id':_0x4381e5['user_id'],'name':_0x4381e5['display_name']});});}}function getEndUser(_0x275a2d,_0x53a6f8,_0x1dcd5d,_0x3da0c1,_0x400039){var _0x589b8b={'$or':{'Phone':_0x3da0c1}};var _0x499828={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x99e7('0x2a')]()[_0x99e7('0x25')](function(){logger['info'](_0x99e7('0x2c'),_0x3da0c1,_0x53a6f8[_0x99e7('0x2d')]);switch(_0x53a6f8[_0x99e7('0x2d')]){case _0x99e7('0x2e'):var _0xdff9f9=_[_0x99e7('0x2f')](_0x589b8b);if(_0x53a6f8[_0x99e7('0x30')]){var _0x442e34={};_0x442e34[_0x53a6f8['additionalSearchContact']]=_0x3da0c1;_[_0x99e7('0x31')](_0xdff9f9[_0x99e7('0x32')],_0x442e34);}return _0x400039['sobject']('Contact')['find'](_0xdff9f9,_0x499828)[_0x99e7('0x24')]()['then'](function(_0x47b1ee){if(_0x47b1ee&&_0x47b1ee['length']){return _0x47b1ee;}else{var _0x4539cb=_['cloneDeep'](_0x589b8b);if(_0x53a6f8[_0x99e7('0x33')]){var _0x23810e={};_0x23810e[_0x53a6f8[_0x99e7('0x33')]]=_0x3da0c1;_[_0x99e7('0x31')](_0x4539cb[_0x99e7('0x32')],_0x23810e);}return _0x400039[_0x99e7('0x1f')]('Lead')[_0x99e7('0x23')](_0x4539cb,_0x499828);}});case'account_contact_lead':var _0x5564b3=_[_0x99e7('0x2f')](_0x589b8b);if(_0x53a6f8[_0x99e7('0x34')]){var _0x442e34={};_0x442e34[_0x53a6f8[_0x99e7('0x34')]]=_0x3da0c1;_[_0x99e7('0x31')](_0x5564b3['$or'],_0x442e34);}return _0x400039[_0x99e7('0x1f')](_0x99e7('0x35'))[_0x99e7('0x23')](_0x5564b3,_0x499828)['execute']()['then'](function(_0x4144fb){if(_0x4144fb&&_0x4144fb[_0x99e7('0x26')]){return _0x4144fb;}else{var _0xe18007=_['cloneDeep'](_0x589b8b);if(_0x53a6f8[_0x99e7('0x30')]){var _0x5c485f={};_0x5c485f[_0x53a6f8['additionalSearchContact']]=_0x3da0c1;_['merge'](_0xe18007['$or'],_0x5c485f);}return _0x400039['sobject'](_0x99e7('0x36'))['find'](_0xe18007,_0x499828)['then'](function(_0x211ac3){if(_0x211ac3&&_0x211ac3[_0x99e7('0x26')]){return _0x211ac3;}else{var _0x2d61f0=_[_0x99e7('0x2f')](_0x589b8b);if(_0x53a6f8['additionalSearchLead']){var _0x47ace3={};_0x47ace3[_0x53a6f8[_0x99e7('0x33')]]=_0x3da0c1;_[_0x99e7('0x31')](_0x2d61f0[_0x99e7('0x32')],_0x47ace3);}return _0x400039[_0x99e7('0x1f')](_0x99e7('0x37'))[_0x99e7('0x23')](_0x2d61f0,_0x499828);}});}});case _0x99e7('0x15'):var _0xdff9f9=_['cloneDeep'](_0x589b8b);if(_0x53a6f8[_0x99e7('0x30')]){var _0x442e34={};_0x442e34[_0x53a6f8[_0x99e7('0x30')]]=_0x3da0c1;_[_0x99e7('0x31')](_0xdff9f9[_0x99e7('0x32')],_0x442e34);}return _0x400039[_0x99e7('0x1f')](_0x99e7('0x36'))[_0x99e7('0x23')](_0xdff9f9,_0x499828)[_0x99e7('0x24')]();case _0x99e7('0x1c'):var _0x487903=_[_0x99e7('0x2f')](_0x589b8b);if(_0x53a6f8[_0x99e7('0x33')]){var _0x442e34={};_0x442e34[_0x53a6f8[_0x99e7('0x33')]]=_0x3da0c1;_[_0x99e7('0x31')](_0x487903[_0x99e7('0x32')],_0x442e34);}return _0x400039[_0x99e7('0x1f')](_0x99e7('0x37'))[_0x99e7('0x23')](_0x487903,_0x499828);case _0x99e7('0x17'):var _0x5564b3=_[_0x99e7('0x2f')](_0x589b8b);if(_0x53a6f8[_0x99e7('0x34')]){var _0x442e34={};_0x442e34[_0x53a6f8['additionalSearchAccount']]=_0x3da0c1;_[_0x99e7('0x31')](_0x5564b3[_0x99e7('0x32')],_0x442e34);}return _0x400039['sobject'](_0x99e7('0x35'))[_0x99e7('0x23')](_0x5564b3,_0x499828);default:return null;}})[_0x99e7('0x25')](function(_0x2358b8){if(_0x2358b8&&_0x2358b8[_0x99e7('0x26')]){var _0x4dbdcf=_['first'](_0x2358b8);if(_0x4dbdcf){return BPromise[_0x99e7('0x2a')]({'id':_0x4dbdcf['Id'],'name':_0x4dbdcf[_0x99e7('0x28')],'phone':_0x4dbdcf[_0x99e7('0x38')],'endUserType':_0x4dbdcf['attributes'][_0x99e7('0x39')][_0x99e7('0x3a')]()});}}})[_0x99e7('0x25')](function(_0x56fbe6){if(_0x56fbe6){logger[_0x99e7('0x1d')](_0x99e7('0x3b'),_0x56fbe6['endUserType'],_0x3da0c1);return BPromise[_0x99e7('0x2a')](_0x56fbe6);}else{logger['info'](_0x99e7('0x3c'),_0x3da0c1);var _0x3b78e1={'Phone':_0x3da0c1};if(_0x53a6f8[_0x99e7('0x3d')]){if(_0x53a6f8[_0x99e7('0x3d')]==='contact'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3da0c1,_0x53a6f8[_0x99e7('0x3d')]);_0x3b78e1[_0x99e7('0x3e')]=_0x1dcd5d!==_0x99e7('0x3f')?_0x1dcd5d:util['format'](_0x99e7('0x40'),_0x3da0c1);}else if(_0x53a6f8[_0x99e7('0x3d')]===_0x99e7('0x1c')){logger[_0x99e7('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3da0c1,_0x53a6f8['moduleCreate']);_0x3b78e1[_0x99e7('0x3e')]=_0x1dcd5d!==''?_0x1dcd5d:util[_0x99e7('0x41')](_0x99e7('0x40'),_0x3da0c1);_0x3b78e1[_0x99e7('0x42')]=_0x99e7('0x43');}else if(_0x53a6f8[_0x99e7('0x3d')]===_0x99e7('0x17')){logger['info'](_0x99e7('0x44'),_0x3da0c1,_0x53a6f8[_0x99e7('0x3d')]);_0x3b78e1['Name']=_0x1dcd5d!==_0x99e7('0x3f')?_0x1dcd5d:util[_0x99e7('0x41')](_0x99e7('0x40'),_0x3da0c1);}else{return null;}}return _0x400039[_0x99e7('0x1f')](_[_0x99e7('0x45')](_0x53a6f8[_0x99e7('0x3d')]))[_0x99e7('0x20')](_0x3b78e1)[_0x99e7('0x25')](function(_0xe84ee9){return BPromise[_0x99e7('0x2a')]({'id':_0xe84ee9['id'],'endUserType':_0x53a6f8['moduleCreate']});});}});}function getCustomFields(_0x132c42,_0x3fbc1f){var _0x2ac2b3={};if(_0x132c42[_0x99e7('0x26')]>0x0){_[_0x99e7('0x46')](_0x132c42,function(_0x5944c2){if(_[_0x99e7('0x47')]([_0x99e7('0x48'),_0x99e7('0x49')],_0x5944c2[_0x99e7('0x39')])&&_0x5944c2[_0x99e7('0x4a')]){_0x2ac2b3[_0x5944c2[_0x99e7('0x4a')]]=_0x5944c2['content'][_0x99e7('0x4b')]();}else if(_0x5944c2[_0x99e7('0x39')]==='variable'&&_0x5944c2[_0x99e7('0x4c')]&&_0x5944c2[_0x99e7('0x4a')]){_0x3fbc1f[_0x5944c2[_0x99e7('0x4c')]]&&(_0x2ac2b3[_0x5944c2[_0x99e7('0x4a')]]=_0x3fbc1f[_0x5944c2[_0x99e7('0x4c')]][_0x99e7('0x4b')]());}else if(_0x5944c2[_0x99e7('0x39')]===_0x99e7('0x4d')&&_0x5944c2[_0x99e7('0x4e')]&&_0x5944c2[_0x99e7('0x4e')]['name']&&_0x5944c2['idField']){_0x3fbc1f[_0x5944c2[_0x99e7('0x4e')][_0x99e7('0x4f')][_0x99e7('0x3a')]()]&&(_0x2ac2b3[_0x5944c2[_0x99e7('0x4a')]]=_0x3fbc1f[_0x5944c2[_0x99e7('0x4e')]['name'][_0x99e7('0x3a')]()][_0x99e7('0x4b')]());}});}return _0x2ac2b3;}function getConnection(_0x2c3b57){var _0x54fe57=_0x2c3b57[_0x99e7('0x50')]['concat'](_0x2c3b57[_0x99e7('0x51')]);var _0x205102=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2c3b57[_0x99e7('0x52')]||_0x99e7('0x53'),'clientId':_0x2c3b57[_0x99e7('0x54')],'clientSecret':_0x2c3b57[_0x99e7('0x55')]}});return _0x205102[_0x99e7('0x56')](_0x2c3b57[_0x99e7('0x57')],_0x54fe57)[_0x99e7('0x25')](function(){logger[_0x99e7('0x1d')](_0x99e7('0x58'));return _0x205102;});}exports[_0x99e7('0x59')]=function(_0x25ca98,_0x51c215,_0x144373,_0x41c14a,_0x1f18f5,_0x5f1cd3){var _0xb6be5,_0x5b9e84,_0x237d36,_0x479fbc;_0x5f1cd3['serverUrl']=intUtil['stripTrailingSlash'](_0x5f1cd3[_0x99e7('0x5a')]);_0x5f1cd3['remoteUri']=intUtil['stripTrailingSlash'](_0x5f1cd3[_0x99e7('0x52')]);if(_0x1f18f5&&_0x1f18f5['monitor_format']){logger['info'](_0x99e7('0x5b'),_0x99e7('0x5c'));_0x51c215[_0x99e7('0x5d')]=util['format'](_0x99e7('0x5e'),_0x5f1cd3[_0x99e7('0x5a')],_0x51c215['uniqueid'],md5(_0x51c215[_0x99e7('0x5f')]));}else{_0x51c215[_0x99e7('0x5d')]='';}return getConnection(_0x5f1cd3)['then'](function(_0x9ea7d){_0x479fbc=_0x9ea7d;return getUser(_0x5f1cd3,_0x41c14a[_0x99e7('0x60')],_0x479fbc);})[_0x99e7('0x25')](function(_0x42c997){_0xb6be5=_0x42c997;return getEndUser(_0x5f1cd3,_0x144373,_0x51c215['calleridname'],_0x51c215[_0x99e7('0x61')],_0x479fbc);})[_0x99e7('0x25')](function(_0x34733e){_0x5b9e84=_0x34733e;return getTicket(_0x5f1cd3,_0xb6be5,_0x5b9e84,_0x144373,_0x51c215,_0x144373['Fields'],_0x479fbc,_0x99e7('0x59'));})[_0x99e7('0x25')](function(_0x28a873){_0x237d36=_0x28a873;logger[_0x99e7('0x1d')](_0x99e7('0x62'),_0x237d36['id']);logger[_0x99e7('0x1d')](_0x99e7('0x63'),_0x237d36['id'],_0x41c14a[_0x99e7('0x4f')],_0x5f1cd3[_0x99e7('0x39')]);switch(_0x5f1cd3[_0x99e7('0x39')]){case'integrationTab':emit(util['format']('user:%s',_0x41c14a[_0x99e7('0x4f')]),_0x99e7('0x64'),{'recordId':_0x237d36['id']});break;case _0x99e7('0x65'):emit(util[_0x99e7('0x41')](_0x99e7('0x66'),_0x41c14a[_0x99e7('0x4f')]),'trigger:browser:url',{'uri':util[_0x99e7('0x41')]('%s/%s/e',_0x479fbc[_0x99e7('0x67')],_0x237d36['id'])});break;default:logger[_0x99e7('0x68')](_0x99e7('0x69'));}})[_0x99e7('0x6a')](function(_0x431c9c){logger[_0x99e7('0x68')](_0x99e7('0x5b'),_0x431c9c);});};exports[_0x99e7('0x6b')]=function(_0x285829,_0x56135c,_0x2430ee,_0x13a456,_0x3c0d39,_0x525c19,_0x44dc13){var _0x26357f,_0x1f2b33,_0x424279,_0x435727;_0x525c19['serverUrl']=intUtil[_0x99e7('0x6c')](_0x525c19[_0x99e7('0x5a')]);_0x525c19[_0x99e7('0x52')]=intUtil['stripTrailingSlash'](_0x525c19[_0x99e7('0x52')]);if(_0x44dc13&&_0x44dc13[_0x99e7('0x6d')]&&_0x44dc13[_0x99e7('0x6d')]!==_0x99e7('0x6e')){logger[_0x99e7('0x1d')](_0x99e7('0x6f'),_0x99e7('0x5c'));_0x56135c[_0x99e7('0x5d')]=util[_0x99e7('0x41')](_0x99e7('0x5e'),_0x525c19[_0x99e7('0x5a')],_0x56135c[_0x99e7('0x5f')],md5(_0x56135c[_0x99e7('0x5f')]));}return getConnection(_0x525c19)[_0x99e7('0x25')](function(_0x444736){_0x435727=_0x444736;return getUser(_0x525c19,_0x13a456[_0x99e7('0x60')],_0x435727);})[_0x99e7('0x25')](function(_0x30eb21){_0x26357f=_0x30eb21;return getEndUser(_0x525c19,_0x2430ee,_0x56135c[_0x99e7('0x70')],_0x56135c['destcalleridnum'],_0x435727);})[_0x99e7('0x25')](function(_0x3bf35b){_0x1f2b33=_0x3bf35b;return getTicket(_0x525c19,_0x26357f,_0x1f2b33,_0x2430ee,_0x56135c,_0x2430ee[_0x99e7('0x71')],_0x435727,_0x99e7('0x6b'));})[_0x99e7('0x25')](function(_0x5c0cd6){_0x424279=_0x5c0cd6;logger[_0x99e7('0x1d')](_0x99e7('0x72'),_0x424279['id']);logger[_0x99e7('0x1d')](_0x99e7('0x73'),_0x424279['id'],_0x13a456[_0x99e7('0x4f')],_0x525c19[_0x99e7('0x39')]);switch(_0x525c19[_0x99e7('0x39')]){case _0x99e7('0x74'):emit(util[_0x99e7('0x41')](_0x99e7('0x66'),_0x13a456['name']),'trigger:salesforce:display',{'recordId':_0x424279['id']});break;case _0x99e7('0x65'):emit(util[_0x99e7('0x41')](_0x99e7('0x66'),_0x13a456[_0x99e7('0x4f')]),_0x99e7('0x75'),{'uri':util[_0x99e7('0x41')](_0x99e7('0x76'),_0x435727[_0x99e7('0x67')],_0x424279['id'])});break;default:logger[_0x99e7('0x68')]('[OUTBOUND]',_0x99e7('0x77'));}})['catch'](function(_0x35ed73){logger[_0x99e7('0x68')](_0x99e7('0x6f'),_0x35ed73);});};exports[_0x99e7('0x78')]=function(_0x5e954,_0x1d62f0,_0x5bfde7,_0x4eba1e,_0x4de782,_0x1f337a){var _0x2fcb12,_0xd1635b,_0xb11201,_0x57ab82;_0x1f337a[_0x99e7('0x5a')]=intUtil[_0x99e7('0x6c')](_0x1f337a[_0x99e7('0x5a')]);_0x1f337a[_0x99e7('0x52')]=intUtil[_0x99e7('0x6c')](_0x1f337a[_0x99e7('0x52')]);if(_0x4de782&&_0x4de782[_0x99e7('0x79')]){logger[_0x99e7('0x1d')]('['+_0x1d62f0['lastevent'][_0x99e7('0x7a')]()+']',_0x99e7('0x5c'));_0x1d62f0[_0x99e7('0x5d')]=util[_0x99e7('0x41')](_0x99e7('0x5e'),_0x1f337a[_0x99e7('0x5a')],_0x1d62f0[_0x99e7('0x5f')],md5(_0x1d62f0[_0x99e7('0x5f')]));}else{_0x1d62f0[_0x99e7('0x5d')]='';}return getConnection(_0x1f337a)[_0x99e7('0x25')](function(_0x58176d){_0x57ab82=_0x58176d;if(!_[_0x99e7('0x21')](_0x4eba1e)){return getUser(_0x1f337a,_0x4eba1e[_0x99e7('0x4f')],_0x57ab82);}else{return getUser(_0x1f337a,null,_0x57ab82);}})[_0x99e7('0x25')](function(_0x4ec05f){_0x2fcb12=_0x4ec05f;return getEndUser(_0x1f337a,_0x5bfde7,_0x1d62f0[_0x99e7('0x7b')],_0x1d62f0[_0x99e7('0x61')],_0x57ab82);})[_0x99e7('0x25')](function(_0x3b506c){_0xd1635b=_0x3b506c;return getTicket(_0x1f337a,_0x2fcb12,_0xd1635b,_0x5bfde7,_0x1d62f0,_0x5bfde7[_0x99e7('0x71')],_0x57ab82);})[_0x99e7('0x25')](function(_0x86ccf2){_0xb11201=_0x86ccf2;logger[_0x99e7('0x1d')]('['+_0x1d62f0[_0x99e7('0x7c')][_0x99e7('0x7a')]()+_0x99e7('0x7d'),_0xb11201['id']);logger['info']('['+_0x1d62f0[_0x99e7('0x7c')][_0x99e7('0x7a')]()+_0x99e7('0x7e'),_0x1f337a[_0x99e7('0x39')]);})[_0x99e7('0x6a')](function(_0x473b5e){logger[_0x99e7('0x68')]('['+_0x1d62f0[_0x99e7('0x7c')][_0x99e7('0x7a')]()+']',_0x473b5e);});}; \ No newline at end of file +var _0x3de0=['idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','WhoId','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','lead','first','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','create','includes','string','picklist'];(function(_0x202f28,_0x1bef75){var _0x2248da=function(_0xce7bc8){while(--_0xce7bc8){_0x202f28['push'](_0x202f28['shift']());}};_0x2248da(++_0x1bef75);}(_0x3de0,0x13c));var _0x03de=function(_0x2f01dc,_0x1214e0){_0x2f01dc=_0x2f01dc-0x0;var _0x449451=_0x3de0[_0x2f01dc];return _0x449451;};'use strict';var _=require(_0x03de('0x0'));var rp=require(_0x03de('0x1'));var moment=require('moment');var BPromise=require(_0x03de('0x2'));var md5=require(_0x03de('0x3'));var jsforce=require(_0x03de('0x4'));var util=require(_0x03de('0x5'));var Redis=require(_0x03de('0x6'));var intUtil=require(_0x03de('0x7'));var config=require(_0x03de('0x8'));var logger=require(_0x03de('0x9'))(_0x03de('0xa'));config[_0x03de('0xb')]=_['defaults'](config[_0x03de('0xb')],{'host':_0x03de('0xc'),'port':0x18eb});var io=require(_0x03de('0xd'))(new Redis(config[_0x03de('0xb')]));function emit(_0x593e26,_0x5e2155,_0x5bfb7d){io['to'](_0x593e26)['emit'](_0x5e2155,_0x5bfb7d);}function getTicket(_0x6314a8,_0x2c214b,_0x591330,_0x510756,_0x29c520,_0x32a59d,_0x1aa04e,_0x49487a){var _0x34ac5d=Object[_0x03de('0xe')]({},{'OwnerId':_0x2c214b['id'],'Subject':intUtil[_0x03de('0xf')](_0x510756[_0x03de('0x10')],_0x29c520,'\x20'),'Description':intUtil[_0x03de('0xf')](_0x510756[_0x03de('0x11')],_0x29c520,'\x0a')},getCustomFields(_0x32a59d,_0x29c520));if(_0x591330){if(_0x510756[_0x03de('0x12')]===_0x03de('0x13')){_0x34ac5d[_0x03de('0x14')]=moment[_0x03de('0x15')]();_0x34ac5d[_0x03de('0x16')]=![];_0x34ac5d['IsRecurrence']=![];if(_0x591330[_0x03de('0x17')]===_0x03de('0x18')||_0x591330[_0x03de('0x17')]==='lead'){_0x34ac5d[_0x03de('0x19')]=_0x591330['id'];}else if(_0x591330[_0x03de('0x17')]===_0x03de('0x1a')){_0x34ac5d[_0x03de('0x1b')]=_0x591330['id'];}}else if(_0x510756['ticketType']===_0x03de('0x1c')){if(_0x591330[_0x03de('0x17')]==='contact'){_0x34ac5d['ContactId']=_0x591330['id'];}else if(_0x591330[_0x03de('0x17')]===_0x03de('0x1a')){_0x34ac5d[_0x03de('0x1d')]=_0x591330['id'];}else if(_0x591330['endUserType']==='lead'&&_0x510756[_0x03de('0x1e')]){_0x34ac5d[_0x510756[_0x03de('0x1e')]]=_0x591330['id'];}else{logger[_0x03de('0x1f')](_0x03de('0x20'));}}}return _0x1aa04e[_0x03de('0x21')](_0x510756[_0x03de('0x12')])['create'](_0x34ac5d);}function getUser(_0x5e864c,_0x132f0d,_0x244291){if(!_['isNil'](_0x132f0d)&&intUtil[_0x03de('0x22')](_0x132f0d)){var _0x5a16cc={'Email':_0x132f0d};var _0x1b58b6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x244291['sobject'](_0x03de('0x23'))[_0x03de('0x24')](_0x5a16cc,_0x1b58b6)[_0x03de('0x25')]()['then'](function(_0x513bc1){if(_0x513bc1[_0x03de('0x26')]){var _0x414fd7=_[_0x03de('0x24')](_0x513bc1,function(_0x301664){return _0x301664[_0x03de('0x27')]===_0x132f0d;});if(_0x414fd7){logger['info'](_0x03de('0x28'),_0x132f0d);return BPromise[_0x03de('0x29')]({'id':_0x414fd7['Id'],'name':_0x414fd7[_0x03de('0x2a')]});}}else{logger['info'](_0x03de('0x2b'),_0x132f0d);return _0x244291['identity']()[_0x03de('0x2c')](function(_0x25502a){return BPromise[_0x03de('0x29')]({'id':_0x25502a[_0x03de('0x2d')],'name':_0x25502a[_0x03de('0x2e')]});});}});}else{logger[_0x03de('0x1f')](_0x03de('0x2b'),_0x132f0d);return _0x244291[_0x03de('0x2f')]()['then'](function(_0x1e00a5){return BPromise[_0x03de('0x29')]({'id':_0x1e00a5[_0x03de('0x2d')],'name':_0x1e00a5[_0x03de('0x2e')]});});}}function getEndUser(_0x5b5b35,_0x490faa,_0x2ca890,_0x4a4070,_0x22a08a){var _0x3cfce0={'$or':{'Phone':_0x4a4070}};var _0xa10310={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x03de('0x29')]()['then'](function(){logger['info'](_0x03de('0x30'),_0x4a4070,_0x490faa[_0x03de('0x31')]);switch(_0x490faa[_0x03de('0x31')]){case _0x03de('0x32'):var _0xbb5483=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa[_0x03de('0x34')]){var _0x103f46={};_0x103f46[_0x490faa[_0x03de('0x34')]]=_0x4a4070;_[_0x03de('0x35')](_0xbb5483[_0x03de('0x36')],_0x103f46);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x37'))[_0x03de('0x24')](_0xbb5483,_0xa10310)['execute']()[_0x03de('0x2c')](function(_0xc46d38){if(_0xc46d38&&_0xc46d38['length']){return _0xc46d38;}else{var _0x4fd886=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa['additionalSearchLead']){var _0x5b7077={};_0x5b7077[_0x490faa[_0x03de('0x38')]]=_0x4a4070;_[_0x03de('0x35')](_0x4fd886[_0x03de('0x36')],_0x5b7077);}return _0x22a08a[_0x03de('0x21')]('Lead')[_0x03de('0x24')](_0x4fd886,_0xa10310);}});case _0x03de('0x39'):var _0x547b69=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa[_0x03de('0x3a')]){var _0x103f46={};_0x103f46[_0x490faa[_0x03de('0x3a')]]=_0x4a4070;_['merge'](_0x547b69[_0x03de('0x36')],_0x103f46);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x3b'))[_0x03de('0x24')](_0x547b69,_0xa10310)[_0x03de('0x25')]()[_0x03de('0x2c')](function(_0x1f2478){if(_0x1f2478&&_0x1f2478[_0x03de('0x26')]){return _0x1f2478;}else{var _0x29470c=_['cloneDeep'](_0x3cfce0);if(_0x490faa[_0x03de('0x34')]){var _0x30da2f={};_0x30da2f[_0x490faa[_0x03de('0x34')]]=_0x4a4070;_['merge'](_0x29470c[_0x03de('0x36')],_0x30da2f);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x37'))[_0x03de('0x24')](_0x29470c,_0xa10310)['then'](function(_0x26edb1){if(_0x26edb1&&_0x26edb1['length']){return _0x26edb1;}else{var _0xca778d=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa[_0x03de('0x38')]){var _0xdcc298={};_0xdcc298[_0x490faa[_0x03de('0x38')]]=_0x4a4070;_[_0x03de('0x35')](_0xca778d[_0x03de('0x36')],_0xdcc298);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x3c'))[_0x03de('0x24')](_0xca778d,_0xa10310);}});}});case _0x03de('0x18'):var _0xbb5483=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa[_0x03de('0x34')]){var _0x103f46={};_0x103f46[_0x490faa[_0x03de('0x34')]]=_0x4a4070;_[_0x03de('0x35')](_0xbb5483[_0x03de('0x36')],_0x103f46);}return _0x22a08a[_0x03de('0x21')]('Contact')[_0x03de('0x24')](_0xbb5483,_0xa10310)['execute']();case _0x03de('0x3d'):var _0x429747=_['cloneDeep'](_0x3cfce0);if(_0x490faa[_0x03de('0x38')]){var _0x103f46={};_0x103f46[_0x490faa[_0x03de('0x38')]]=_0x4a4070;_[_0x03de('0x35')](_0x429747['$or'],_0x103f46);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x3c'))[_0x03de('0x24')](_0x429747,_0xa10310);case _0x03de('0x1a'):var _0x547b69=_[_0x03de('0x33')](_0x3cfce0);if(_0x490faa['additionalSearchAccount']){var _0x103f46={};_0x103f46[_0x490faa[_0x03de('0x3a')]]=_0x4a4070;_['merge'](_0x547b69['$or'],_0x103f46);}return _0x22a08a[_0x03de('0x21')](_0x03de('0x3b'))[_0x03de('0x24')](_0x547b69,_0xa10310);default:return null;}})[_0x03de('0x2c')](function(_0x18af6d){if(_0x18af6d&&_0x18af6d[_0x03de('0x26')]){var _0x2b6463=_[_0x03de('0x3e')](_0x18af6d);if(_0x2b6463){return BPromise[_0x03de('0x29')]({'id':_0x2b6463['Id'],'name':_0x2b6463[_0x03de('0x2a')],'phone':_0x2b6463['Phone'],'endUserType':_0x2b6463[_0x03de('0x3f')][_0x03de('0x40')]['toLowerCase']()});}}})[_0x03de('0x2c')](function(_0x1f2d94){if(_0x1f2d94){logger[_0x03de('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1f2d94['endUserType'],_0x4a4070);return BPromise[_0x03de('0x29')](_0x1f2d94);}else{logger[_0x03de('0x1f')](_0x03de('0x41'),_0x4a4070);var _0x3ce4ab={'Phone':_0x4a4070};if(_0x490faa['moduleCreate']){if(_0x490faa[_0x03de('0x42')]===_0x03de('0x18')){logger[_0x03de('0x1f')](_0x03de('0x43'),_0x4a4070,_0x490faa[_0x03de('0x42')]);_0x3ce4ab[_0x03de('0x44')]=_0x2ca890!==''?_0x2ca890:util['format'](_0x03de('0x45'),_0x4a4070);}else if(_0x490faa['moduleCreate']===_0x03de('0x3d')){logger[_0x03de('0x1f')](_0x03de('0x43'),_0x4a4070,_0x490faa[_0x03de('0x42')]);_0x3ce4ab[_0x03de('0x44')]=_0x2ca890!==_0x03de('0x46')?_0x2ca890:util[_0x03de('0x47')]('Caller\x20-\x20%s',_0x4a4070);_0x3ce4ab[_0x03de('0x48')]='No\x20Company';}else if(_0x490faa[_0x03de('0x42')]===_0x03de('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4a4070,_0x490faa['moduleCreate']);_0x3ce4ab[_0x03de('0x2a')]=_0x2ca890!==_0x03de('0x46')?_0x2ca890:util[_0x03de('0x47')]('Caller\x20-\x20%s',_0x4a4070);}else{return null;}}return _0x22a08a['sobject'](_['upperFirst'](_0x490faa[_0x03de('0x42')]))[_0x03de('0x49')](_0x3ce4ab)['then'](function(_0x5d82e4){return BPromise[_0x03de('0x29')]({'id':_0x5d82e4['id'],'endUserType':_0x490faa[_0x03de('0x42')]});});}});}function getCustomFields(_0x503452,_0x39d88a){var _0x56ad51={};if(_0x503452[_0x03de('0x26')]>0x0){_['forEach'](_0x503452,function(_0x12e3e7){if(_[_0x03de('0x4a')]([_0x03de('0x4b'),_0x03de('0x4c')],_0x12e3e7[_0x03de('0x40')])&&_0x12e3e7[_0x03de('0x4d')]){_0x56ad51[_0x12e3e7[_0x03de('0x4d')]]=_0x12e3e7[_0x03de('0x4e')][_0x03de('0x4f')]();}else if(_0x12e3e7[_0x03de('0x40')]==='variable'&&_0x12e3e7[_0x03de('0x50')]&&_0x12e3e7['idField']){_0x39d88a[_0x12e3e7[_0x03de('0x50')]]&&(_0x56ad51[_0x12e3e7[_0x03de('0x4d')]]=_0x39d88a[_0x12e3e7[_0x03de('0x50')]][_0x03de('0x4f')]());}else if(_0x12e3e7[_0x03de('0x40')]===_0x03de('0x51')&&_0x12e3e7[_0x03de('0x52')]&&_0x12e3e7[_0x03de('0x52')][_0x03de('0x53')]&&_0x12e3e7[_0x03de('0x4d')]){_0x39d88a[_0x12e3e7[_0x03de('0x52')][_0x03de('0x53')][_0x03de('0x54')]()]&&(_0x56ad51[_0x12e3e7[_0x03de('0x4d')]]=_0x39d88a[_0x12e3e7[_0x03de('0x52')]['name'][_0x03de('0x54')]()][_0x03de('0x4f')]());}});}return _0x56ad51;}function getConnection(_0xbb10ec){var _0x2bab6c=_0xbb10ec[_0x03de('0x55')][_0x03de('0x56')](_0xbb10ec[_0x03de('0x57')]);var _0x1cc2d5=new jsforce[(_0x03de('0x58'))]({'oauth2':{'loginUrl':_0xbb10ec[_0x03de('0x59')]||_0x03de('0x5a'),'clientId':_0xbb10ec[_0x03de('0x5b')],'clientSecret':_0xbb10ec[_0x03de('0x5c')]}});return _0x1cc2d5['login'](_0xbb10ec['username'],_0x2bab6c)[_0x03de('0x2c')](function(){logger[_0x03de('0x1f')](_0x03de('0x5d'));return _0x1cc2d5;});}exports[_0x03de('0x5e')]=function(_0x4a943b,_0x2e20f6,_0x2dcca7,_0x5bbaa0,_0x3f6b3e,_0x154d6b){var _0x3cef19,_0x3f944a,_0x369cb4,_0x4b16ad;_0x154d6b['serverUrl']=intUtil['stripTrailingSlash'](_0x154d6b['serverUrl']);_0x154d6b['remoteUri']=intUtil[_0x03de('0x5f')](_0x154d6b[_0x03de('0x59')]);if(_0x3f6b3e&&_0x3f6b3e[_0x03de('0x60')]){logger['info'](_0x03de('0x61'),_0x03de('0x62'));_0x2e20f6[_0x03de('0x63')]=util[_0x03de('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x154d6b[_0x03de('0x64')],_0x2e20f6[_0x03de('0x65')],md5(_0x2e20f6[_0x03de('0x65')]));}else{_0x2e20f6[_0x03de('0x63')]='';}return getConnection(_0x154d6b)[_0x03de('0x2c')](function(_0x4625d1){_0x4b16ad=_0x4625d1;return getUser(_0x154d6b,_0x5bbaa0[_0x03de('0x66')],_0x4b16ad);})['then'](function(_0x18b74c){_0x3cef19=_0x18b74c;return getEndUser(_0x154d6b,_0x2dcca7,_0x2e20f6[_0x03de('0x67')],_0x2e20f6[_0x03de('0x68')],_0x4b16ad);})[_0x03de('0x2c')](function(_0xd53823){_0x3f944a=_0xd53823;return getTicket(_0x154d6b,_0x3cef19,_0x3f944a,_0x2dcca7,_0x2e20f6,_0x2dcca7[_0x03de('0x69')],_0x4b16ad,'queue');})[_0x03de('0x2c')](function(_0x4d8552){_0x369cb4=_0x4d8552;logger[_0x03de('0x1f')](_0x03de('0x6a'),_0x369cb4['id']);logger[_0x03de('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x369cb4['id'],_0x5bbaa0[_0x03de('0x53')],_0x154d6b[_0x03de('0x40')]);switch(_0x154d6b['type']){case _0x03de('0x6b'):emit(util[_0x03de('0x47')](_0x03de('0x6c'),_0x5bbaa0[_0x03de('0x53')]),_0x03de('0x6d'),{'recordId':_0x369cb4['id']});break;case'newTab':emit(util[_0x03de('0x47')]('user:%s',_0x5bbaa0['name']),_0x03de('0x6e'),{'uri':util[_0x03de('0x47')](_0x03de('0x6f'),_0x4b16ad[_0x03de('0x70')],_0x369cb4['id'])});break;default:logger[_0x03de('0x71')](_0x03de('0x72'));}})[_0x03de('0x73')](function(_0x1a78cd){logger[_0x03de('0x71')](_0x03de('0x61'),_0x1a78cd);});};exports[_0x03de('0x74')]=function(_0xc3654a,_0x1c8c07,_0x51ab4e,_0x11c4be,_0x3bceb1,_0x27eabb,_0x4de928){var _0x403da9,_0x16fa22,_0x5de44c,_0x1db9d3;_0x27eabb[_0x03de('0x64')]=intUtil[_0x03de('0x5f')](_0x27eabb['serverUrl']);_0x27eabb[_0x03de('0x59')]=intUtil[_0x03de('0x5f')](_0x27eabb['remoteUri']);if(_0x4de928&&_0x4de928['recordingFormat']&&_0x4de928['recordingFormat']!==_0x03de('0x75')){logger['info'](_0x03de('0x76'),_0x03de('0x62'));_0x1c8c07[_0x03de('0x63')]=util[_0x03de('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27eabb[_0x03de('0x64')],_0x1c8c07['uniqueid'],md5(_0x1c8c07[_0x03de('0x65')]));}return getConnection(_0x27eabb)['then'](function(_0x5a2d28){_0x1db9d3=_0x5a2d28;return getUser(_0x27eabb,_0x11c4be['email'],_0x1db9d3);})[_0x03de('0x2c')](function(_0x57eb0e){_0x403da9=_0x57eb0e;return getEndUser(_0x27eabb,_0x51ab4e,_0x1c8c07[_0x03de('0x77')],_0x1c8c07[_0x03de('0x78')],_0x1db9d3);})['then'](function(_0x4cf209){_0x16fa22=_0x4cf209;return getTicket(_0x27eabb,_0x403da9,_0x16fa22,_0x51ab4e,_0x1c8c07,_0x51ab4e[_0x03de('0x69')],_0x1db9d3,_0x03de('0x74'));})[_0x03de('0x2c')](function(_0x207c60){_0x5de44c=_0x207c60;logger[_0x03de('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5de44c['id']);logger[_0x03de('0x1f')](_0x03de('0x79'),_0x5de44c['id'],_0x11c4be[_0x03de('0x53')],_0x27eabb[_0x03de('0x40')]);switch(_0x27eabb[_0x03de('0x40')]){case'integrationTab':emit(util[_0x03de('0x47')](_0x03de('0x6c'),_0x11c4be[_0x03de('0x53')]),_0x03de('0x6d'),{'recordId':_0x5de44c['id']});break;case _0x03de('0x7a'):emit(util[_0x03de('0x47')](_0x03de('0x6c'),_0x11c4be[_0x03de('0x53')]),_0x03de('0x6e'),{'uri':util['format'](_0x03de('0x6f'),_0x1db9d3['instanceUrl'],_0x5de44c['id'])});break;default:logger[_0x03de('0x71')](_0x03de('0x76'),_0x03de('0x7b'));}})['catch'](function(_0x870e1a){logger['error'](_0x03de('0x76'),_0x870e1a);});};exports[_0x03de('0x7c')]=function(_0x2ec628,_0x382327,_0x587e1a,_0x21b572,_0x3931b0,_0x48817e){var _0x5868a1,_0x31b6dc,_0x172f92,_0x335a0e;_0x48817e[_0x03de('0x64')]=intUtil[_0x03de('0x5f')](_0x48817e['serverUrl']);_0x48817e[_0x03de('0x59')]=intUtil[_0x03de('0x5f')](_0x48817e[_0x03de('0x59')]);if(_0x3931b0&&_0x3931b0[_0x03de('0x60')]){logger[_0x03de('0x1f')]('['+_0x382327[_0x03de('0x7d')]['toUpperCase']()+']',_0x03de('0x62'));_0x382327[_0x03de('0x63')]=util[_0x03de('0x47')](_0x03de('0x7e'),_0x48817e[_0x03de('0x64')],_0x382327[_0x03de('0x65')],md5(_0x382327['uniqueid']));}else{_0x382327['recordingURL']='';}return getConnection(_0x48817e)['then'](function(_0x2c28dd){_0x335a0e=_0x2c28dd;if(!_[_0x03de('0x7f')](_0x21b572)){return getUser(_0x48817e,_0x21b572[_0x03de('0x53')],_0x335a0e);}else{return getUser(_0x48817e,null,_0x335a0e);}})[_0x03de('0x2c')](function(_0x1d18d5){_0x5868a1=_0x1d18d5;return getEndUser(_0x48817e,_0x587e1a,_0x382327[_0x03de('0x67')],_0x382327['calleridnum'],_0x335a0e);})['then'](function(_0x13954c){_0x31b6dc=_0x13954c;return getTicket(_0x48817e,_0x5868a1,_0x31b6dc,_0x587e1a,_0x382327,_0x587e1a[_0x03de('0x69')],_0x335a0e);})[_0x03de('0x2c')](function(_0x170e0d){_0x172f92=_0x170e0d;logger['info']('['+_0x382327[_0x03de('0x7d')][_0x03de('0x80')]()+_0x03de('0x81'),_0x172f92['id']);logger[_0x03de('0x1f')]('['+_0x382327[_0x03de('0x7d')][_0x03de('0x80')]()+_0x03de('0x82'),_0x48817e[_0x03de('0x40')]);})[_0x03de('0x73')](function(_0x55f609){logger[_0x03de('0x71')]('['+_0x382327[_0x03de('0x7d')][_0x03de('0x80')]()+']',_0x55f609);});}; \ 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 61eba3b..8682e5e 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 _0xdd6f=['sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','picklist','type','nameField','toLowerCase','content','string','idField','customField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','md5','../../../../config/environment','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST'];(function(_0x26f2a3,_0x324e2d){var _0x2a9969=function(_0x3cc464){while(--_0x3cc464){_0x26f2a3['push'](_0x26f2a3['shift']());}};_0x2a9969(++_0x324e2d);}(_0xdd6f,0x1ea));var _0xfdd6=function(_0x1762fd,_0x3774d1){_0x1762fd=_0x1762fd-0x0;var _0x1a1329=_0xdd6f[_0x1762fd];return _0x1a1329;};'use strict';var _=require(_0xfdd6('0x0'));var Promise=require('bluebird');var rp=require(_0xfdd6('0x1'));var util=require('util');var md5=require(_0xfdd6('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfdd6('0x3'));var logger=require('../../../../config/logger')(_0xfdd6('0x4'));config['redis']=_['defaults'](config[_0xfdd6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xfdd6('0x6'))(new Redis(config[_0xfdd6('0x5')]));function getAdminUser(_0x3e0bd1,_0x51ce98,_0x4a65e7,_0x2710f4,_0x3a899e,_0x38eec0){return new Promise(function(_0x8c4df9,_0x5981db){var _0x30e1eb={'method':_0xfdd6('0x7'),'uri':_0x2710f4+_0xfdd6('0x8')+'&'+_0x3a899e+'&'+_0x38eec0,'auth':_0x51ce98,'json':!![]};return rp(_0x30e1eb)[_0xfdd6('0x9')](function(_0x209f16){if(_0x209f16['result'][_0xfdd6('0xa')]>0x0){_0x4a65e7[_0xfdd6('0xb')]=_0x209f16['result'][0x0][_0xfdd6('0xc')];}logger[_0xfdd6('0xd')]('['+[_0x3e0bd1[_0xfdd6('0xe')]()]+_0xfdd6('0xf'),_0x4a65e7);_0x8c4df9(_0x4a65e7);})[_0xfdd6('0x10')](function(_0x4ae677){logger[_0xfdd6('0x11')]('['+[_0x3e0bd1[_0xfdd6('0xe')]()]+']',_0x4ae677[_0xfdd6('0x12')]);_0x5981db(_0x4ae677[_0xfdd6('0x12')]);});});}function getUser(_0x445edf,_0x1f2584,_0x2f567c,_0x55b446,_0x5e1c50){return function(_0x58998a){logger[_0xfdd6('0xd')]('['+[_0x445edf[_0xfdd6('0xe')]()]+'],\x20getUser\x20input\x20crm',_0x58998a);return new Promise(function(_0x515d47,_0x306279){if(intUtil[_0xfdd6('0x13')](_0x58998a[_0xfdd6('0x14')])){var _0x45acad={'method':'GET','uri':_0x2f567c+'sys_user?sysparm_query=email%3D'+_0x58998a[_0xfdd6('0x14')]+'&'+_0x55b446+'&'+_0x5e1c50,'auth':_0x1f2584,'json':!![]};logger[_0xfdd6('0xd')]('['+[_0x445edf['toUpperCase']()]+_0xfdd6('0x15'),_0x45acad);return rp(_0x45acad)[_0xfdd6('0x9')](function(_0x115908){logger['info']('['+[_0x445edf['toUpperCase']()]+_0xfdd6('0x16'),_0x115908);if(_0x115908[_0xfdd6('0x17')][_0xfdd6('0xa')]>0x0&&String(_0x115908['result'][0x0][_0xfdd6('0x18')])==='true'){_0x58998a[_0xfdd6('0x19')]=_0x115908[_0xfdd6('0x17')][0x0]['sys_id'];}else{_0x58998a[_0xfdd6('0x19')]=_0x58998a['adminId'];_0x58998a[_0xfdd6('0x14')]=_0x58998a['adminEmail'];}logger[_0xfdd6('0xd')]('['+[_0x445edf[_0xfdd6('0xe')]()]+_0xfdd6('0x1a'),_0x58998a);_0x515d47(_0x58998a);})[_0xfdd6('0x10')](function(_0x33a1ce){logger[_0xfdd6('0x11')]('['+[_0x445edf[_0xfdd6('0xe')]()]+']',_0x33a1ce[_0xfdd6('0x12')]);_0x306279(_0x33a1ce[_0xfdd6('0x12')]);});}else{logger['info']('['+[_0x445edf[_0xfdd6('0xe')]()]+_0xfdd6('0x1b'));_0x58998a[_0xfdd6('0x19')]=_0x58998a[_0xfdd6('0xb')];_0x58998a['userEmail']=_0x58998a[_0xfdd6('0x1c')];_0x515d47(_0x58998a);}});};}function createEndUser(_0x4160dd,_0x10768e,_0x520f0b,_0x15535e,_0x22fe0e){logger[_0xfdd6('0xd')]('['+[_0x4160dd[_0xfdd6('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x520f0b);return new Promise(function(_0x8627a,_0xf0ad7a){var _0x3bdf86={'method':_0xfdd6('0x1d'),'uri':_0x15535e+_0xfdd6('0x1e')+_0x22fe0e,'body':{'user_name':_0x520f0b[_0xfdd6('0x1f')],'roles':'user','first_name':_0x520f0b['endUserNumber'],'active':_0xfdd6('0x20'),'date_format':_0xfdd6('0x21'),'phone':_0x520f0b[_0xfdd6('0x1f')]},'auth':_0x10768e,'json':!![]};return rp(_0x3bdf86)['then'](function(_0x55980b){logger[_0xfdd6('0xd')]('['+[_0x4160dd[_0xfdd6('0xe')]()]+_0xfdd6('0x22'),_0x55980b[_0xfdd6('0x17')]);_0x520f0b['endUserId']=_0x55980b[_0xfdd6('0x17')]['sys_id'];_0x8627a(_0x520f0b);})[_0xfdd6('0x10')](function(_0x2d1370){logger[_0xfdd6('0x11')]('['+[_0x4160dd[_0xfdd6('0xe')]()]+']',_0x2d1370[_0xfdd6('0x12')]);_0xf0ad7a(_0x2d1370['message']);});});}function getEndUser(_0x527178,_0x40087b,_0x2a0f4f,_0x505c08,_0x293fd3){return function(_0x57675e){logger[_0xfdd6('0xd')]('['+[_0x527178[_0xfdd6('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x57675e);return new Promise(function(_0x6c81b,_0x269275){var _0x21ce42={'method':_0xfdd6('0x7'),'uri':_0x2a0f4f+'sys_user?sysparm_query=phone%3D'+_0x57675e[_0xfdd6('0x1f')]+'&'+_0x505c08+'&'+_0x293fd3,'auth':_0x40087b,'json':!![]};return rp(_0x21ce42)[_0xfdd6('0x9')](function(_0x8abf6c){if(_0x8abf6c[_0xfdd6('0x17')]['length']>0x0){_0x57675e[_0xfdd6('0x23')]=_0x8abf6c[_0xfdd6('0x17')][0x0]['sys_id'];logger['info']('['+[_0x527178['toUpperCase']()]+_0xfdd6('0x24'),_0x57675e);_0x6c81b(_0x57675e);}else{return createEndUser(_0x527178,_0x40087b,_0x57675e,_0x2a0f4f,_0x505c08)[_0xfdd6('0x9')](function(_0x5a3909){logger['info']('['+[_0x527178[_0xfdd6('0xe')]()]+_0xfdd6('0x25'),_0x5a3909);_0x6c81b(_0x5a3909);});}})[_0xfdd6('0x10')](function(_0x50988d){logger['error']('['+[_0x527178[_0xfdd6('0xe')]()]+']',_0x50988d[_0xfdd6('0x12')]);_0x269275(_0x50988d[_0xfdd6('0x12')]);});});};}function getCustomFields(_0x2a29a5,_0x1a57d4){var _0x4e6949={};if(_0x2a29a5[_0xfdd6('0xa')]>0x0){_['forEach'](_0x2a29a5,function(_0x5c7a8f){if(_[_0xfdd6('0x26')](['string',_0xfdd6('0x27')],_0x5c7a8f[_0xfdd6('0x28')])&&_0x5c7a8f[_0xfdd6('0x29')]&&!_0x5c7a8f['customField']){_0x4e6949[_0x5c7a8f[_0xfdd6('0x29')][_0xfdd6('0x2a')]()]=_0x5c7a8f[_0xfdd6('0x2b')]['toString']();}else if(_['includes']([_0xfdd6('0x2c'),_0xfdd6('0x27')],_0x5c7a8f[_0xfdd6('0x28')])&&_0x5c7a8f[_0xfdd6('0x2d')]&&_0x5c7a8f[_0xfdd6('0x2e')]){_0x4e6949[_0x5c7a8f[_0xfdd6('0x2d')][_0xfdd6('0x2a')]()]=_0x5c7a8f[_0xfdd6('0x2b')][_0xfdd6('0x2f')]();}else if(_0x5c7a8f[_0xfdd6('0x28')]==='variable'&&_0x5c7a8f[_0xfdd6('0x30')]&&_0x5c7a8f[_0xfdd6('0x2d')]&&_0x5c7a8f[_0xfdd6('0x2e')]){_0x4e6949[_0x5c7a8f['idField'][_0xfdd6('0x2a')]()]=_0x1a57d4[_0x5c7a8f[_0xfdd6('0x30')]][_0xfdd6('0x2f')]();}else if(_0x5c7a8f[_0xfdd6('0x28')]===_0xfdd6('0x31')&&_0x5c7a8f[_0xfdd6('0x32')]&&_0x5c7a8f[_0xfdd6('0x32')][_0xfdd6('0x33')]&&_0x5c7a8f[_0xfdd6('0x2d')]&&_0x5c7a8f[_0xfdd6('0x2e')]){_0x4e6949[_0x5c7a8f['idField'][_0xfdd6('0x2a')]()]=_0x1a57d4[_0x5c7a8f[_0xfdd6('0x32')][_0xfdd6('0x33')][_0xfdd6('0x2a')]()][_0xfdd6('0x2f')]();}});}return _0x4e6949;}function getTicket(_0x5cd6f8,_0x450659,_0xbb491c,_0x39dd78,_0xf270a7,_0x5de451){return function(_0x5d8179){logger[_0xfdd6('0xd')]('['+[_0x5cd6f8[_0xfdd6('0xe')]()]+_0xfdd6('0x34'),_0x5d8179);return new Promise(function(_0x20ddff,_0x11469a){var _0xd51ab7=_0x5cd6f8['toLowerCase']()===_0xfdd6('0x35')?_0x5d8179[_0xfdd6('0x19')]:_0x5d8179['endUserId'];var _0x48af3b={'method':_0xfdd6('0x1d'),'uri':_0xbb491c+_0xfdd6('0x36')+'?'+_0x5de451,'body':Object[_0xfdd6('0x37')]({},{'active':_0xfdd6('0x20'),'caller_id':_0xd51ab7,'assigned_to':_0x5d8179[_0xfdd6('0x19')],'short_description':intUtil[_0xfdd6('0x38')](_0x39dd78['Subjects'],_0xf270a7,'\x20'),'description':intUtil['getString'](_0x39dd78[_0xfdd6('0x39')],_0xf270a7,'\x0a')},getCustomFields(_0x39dd78[_0xfdd6('0x3a')],_0xf270a7)),'auth':_0x450659,'json':!![]};return rp(_0x48af3b)['then'](function(_0x1a5689){logger[_0xfdd6('0xd')]('['+[_0x5cd6f8[_0xfdd6('0xe')]()]+_0xfdd6('0x3b'),_0x1a5689[_0xfdd6('0x17')]);_0x5d8179[_0xfdd6('0x3c')]=_0x1a5689['result'][_0xfdd6('0xc')];_0x5d8179['ticketNumber']=_0x1a5689['result'][_0xfdd6('0x3d')];logger[_0xfdd6('0xd')]('['+[_0x5cd6f8[_0xfdd6('0xe')]()]+_0xfdd6('0x3e'),_0x5d8179);_0x20ddff(_0x5d8179);})[_0xfdd6('0x10')](function(_0x4bcd72){logger[_0xfdd6('0x11')]('['+[_0x5cd6f8[_0xfdd6('0xe')]()]+']',_0x4bcd72[_0xfdd6('0x12')]);_0x11469a(_0x4bcd72[_0xfdd6('0x12')]);});});};}function createRemoteTag(_0x93e54d,_0x5152d5,_0x53b392,_0xe80cdc){return new Promise(function(_0x5318d8,_0x34894d){var _0x544d4e={'method':'POST','uri':_0x53b392+'label'+'?'+_0xe80cdc,'body':{'short_description':_0x93e54d,'global':!![],'active':!![],'name':_0x93e54d},'auth':_0x5152d5,'json':!![]};return rp(_0x544d4e)[_0xfdd6('0x9')](function(_0x774876){var _0x1ec9d4=_0x774876[_0xfdd6('0x17')][_0xfdd6('0xc')];_0x5318d8(_0x1ec9d4);});});}function getRemoteTag(_0x1bc130,_0x1531a7,_0x5343fa,_0x17de27,_0x626fcb){return new Promise(function(_0x7e8997,_0xce135d){var _0x31f4a9={'method':'GET','uri':_0x5343fa+'label'+_0xfdd6('0x3f')+_0x1bc130+'&'+_0x17de27,'auth':_0x1531a7,'json':!![]};return rp(_0x31f4a9)['then'](function(_0x2d86d1){if(_0x2d86d1[_0xfdd6('0x17')][_0xfdd6('0xa')]>0x0){var _0x3cc100=_0x2d86d1[_0xfdd6('0x17')][0x0][_0xfdd6('0xc')];_0x7e8997(_0x3cc100);}else{return createRemoteTag(_0x1bc130,_0x1531a7,_0x5343fa,_0x17de27)[_0xfdd6('0x9')](function(_0xef2650){_0x7e8997(_0xef2650);});}});});}function assignTagToIncident(_0x2295b2,_0x422bf3,_0x5c589d,_0x2ed19f,_0x1c78bf){return new Promise(function(_0x56f843,_0x202883){var _0x4ae051={'method':_0xfdd6('0x1d'),'uri':_0x5c589d+_0xfdd6('0x40')+'?'+_0x1c78bf,'body':{'label':_0x2295b2,'table':'incident','id_type':'Incident','table_key':_0x2ed19f[_0xfdd6('0x3c')],'title':_0xfdd6('0x41')+_0x2ed19f[_0xfdd6('0x42')],'id_display':_0x2ed19f['ticketNumber']},'auth':_0x422bf3,'json':!![]};return rp(_0x4ae051)['then'](function(_0x4ba10b){_0x56f843();})[_0xfdd6('0x10')](function(){_0x56f843();});});}function manageTags(_0xd91106,_0x12f8e1,_0x388c82,_0x54e51b,_0x271209,_0x384b4d,_0x4818dd){return new Promise(function(_0x583e2d,_0x2beb60){var _0x556032=[];_0x12f8e1[_0xfdd6('0x43')](function(_0x4fc279){_0x556032[_0xfdd6('0x44')](getRemoteTag(_0x4fc279,_0x388c82,_0x54e51b,_0x384b4d,_0x4818dd));});return Promise['all'](_0x556032)[_0xfdd6('0x9')](function(_0x4680c2){if(_0x4680c2[_0xfdd6('0xa')]){logger[_0xfdd6('0xd')]('['+[_0xd91106['toUpperCase']()]+_0xfdd6('0x45'),_0x4680c2);var _0x46a3be=[];_0x4680c2['forEach'](function(_0x4e3708){_0x46a3be['push'](assignTagToIncident(_0x4e3708,_0x388c82,_0x54e51b,_0x271209,_0x384b4d));});return Promise['all'](_0x46a3be)[_0xfdd6('0x9')](function(){_0x583e2d();})['catch'](function(){_0x583e2d();});}else{_0x583e2d();}});});}function getTags(_0x562ade,_0xcad9c3,_0x4d26d2,_0x448458,_0x18ee0a,_0x331e4a){return function(_0x25e786){return new Promise(function(_0x4fe904,_0x3cdfb6){var _0x30f30e=[];var _0x4fcac8=_0x448458[_0xfdd6('0x46')];if(_0x4fcac8&&_0x4fcac8[_0xfdd6('0xa')]>0x0){_0x30f30e=_[_0xfdd6('0x47')](_0x4fcac8,'name');}if(_0x30f30e['length']>0x0){return manageTags(_0x562ade,_0x30f30e,_0xcad9c3,_0x4d26d2,_0x25e786,_0x18ee0a,_0x331e4a)['then'](function(){_0x4fe904(_0x25e786);});}else{_0x4fe904(_0x25e786);}});};}function emit(_0xad93eb,_0x41c6ac,_0x349e37){var _0x3a5afc=_0xfdd6('0x48')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xfdd6('0x49')+'%255EORDERBYDESCnumber';var _0x3f5aaf={'uri':_0xad93eb+_0xfdd6('0x4a')+_0x349e37+_0x3a5afc};io['to'](util['format'](_0xfdd6('0x4b'),_0x41c6ac))[_0xfdd6('0x4c')](_0xfdd6('0x4d'),_0x3f5aaf);}exports['cs']=function(_0x2620b4,_0x49fd41,_0x3daec5,_0x55e917,_0x49e579,_0x5702a8,_0x45d9f7,_0x293496){var _0x6f9b33={};var _0x4e5c6d={'user':_0x5702a8['username'],'pass':_0x5702a8[_0xfdd6('0x4e')]};var _0x216bf1='sysparm_limit=1';var _0x1af1f0=_0xfdd6('0x4f');_0x5702a8['remoteUri']=intUtil[_0xfdd6('0x50')](_0x5702a8[_0xfdd6('0x51')]);_0x5702a8[_0xfdd6('0x52')]=intUtil['stripTrailingSlash'](_0x5702a8[_0xfdd6('0x52')]);var _0x28c81c=util[_0xfdd6('0x53')]('%s/api/now/table/',_0x5702a8['remoteUri']);_0x6f9b33[_0xfdd6('0x14')]=!_[_0xfdd6('0x54')](_0x55e917)?_0x55e917[_0xfdd6('0x55')]:null;_0x6f9b33['adminEmail']=_0x5702a8['email'];_0x6f9b33[_0xfdd6('0x1f')]=_0x293496[_0xfdd6('0x2a')]()===_0xfdd6('0x35')?_0x49fd41[_0xfdd6('0x56')]:_0x49fd41[_0xfdd6('0x57')];_0x6f9b33[_0xfdd6('0x58')]=_0x293496===_0xfdd6('0x59')||_0x293496===_0xfdd6('0x5a')?'queue':_0xfdd6('0x35');var _0xda6f30=util[_0xfdd6('0x53')](_0xfdd6('0x5b'),_0x5702a8[_0xfdd6('0x52')],_0x49fd41['uniqueid'],md5(_0x49fd41[_0xfdd6('0x5c')]));if(_0x49e579&&_0x49e579[_0xfdd6('0x5d')]){logger[_0xfdd6('0xd')](_0xfdd6('0x5e'),_0xfdd6('0x5f'));_0x49fd41[_0xfdd6('0x60')]=_0xda6f30;}else if(_0x45d9f7&&_0x45d9f7['recordingFormat']&&_0x45d9f7[_0xfdd6('0x61')]!==_0xfdd6('0x62')){logger[_0xfdd6('0xd')](_0xfdd6('0x63'),_0xfdd6('0x5f'));_0x49fd41['recordingURL']=_0xda6f30;}else{_0x49fd41['recordingURL']='';}return getAdminUser(_0x293496,_0x4e5c6d,_0x6f9b33,_0x28c81c,_0x1af1f0,_0x216bf1)[_0xfdd6('0x9')](getUser(_0x293496,_0x4e5c6d,_0x28c81c,_0x1af1f0,_0x216bf1))[_0xfdd6('0x9')](getEndUser(_0x293496,_0x4e5c6d,_0x28c81c,_0x1af1f0,_0x216bf1))[_0xfdd6('0x9')](getTicket(_0x293496,_0x4e5c6d,_0x28c81c,_0x3daec5,_0x49fd41,_0x1af1f0))['then'](function(_0xa7bc34){logger['info'](util[_0xfdd6('0x53')](_0xfdd6('0x64'),_0xa7bc34[_0xfdd6('0x3c')]));logger[_0xfdd6('0xd')](util[_0xfdd6('0x53')](_0xfdd6('0x65'),_0x293496));if(_0x293496!=='unmanaged'){logger[_0xfdd6('0xd')]('['+[_0x293496[_0xfdd6('0xe')]()]+']',_0xfdd6('0x66'));emit(_0x5702a8[_0xfdd6('0x51')],_0x55e917['name'],_0xa7bc34['ticketId']);}})['catch'](function(_0x103a3b){logger[_0xfdd6('0x11')]('['+[_0x293496['toUpperCase']()]+_0xfdd6('0x67'),util['inspect'](_0x103a3b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7fe7=['user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','type','nameField','customField','toLowerCase','toString','picklist','idField','content','variable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Descriptions','Fields','ticketId',']\x20getTicket\x20crm','error','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%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','trigger:browser:url','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','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','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber'];(function(_0x25995c,_0x3dc84b){var _0x4ac48d=function(_0x27579f){while(--_0x27579f){_0x25995c['push'](_0x25995c['shift']());}};_0x4ac48d(++_0x3dc84b);}(_0x7fe7,0x116));var _0x77fe=function(_0x242152,_0x2f7b09){_0x242152=_0x242152-0x0;var _0x167a0d=_0x7fe7[_0x242152];return _0x167a0d;};'use strict';var _=require(_0x77fe('0x0'));var Promise=require(_0x77fe('0x1'));var rp=require(_0x77fe('0x2'));var util=require(_0x77fe('0x3'));var md5=require(_0x77fe('0x4'));var Redis=require(_0x77fe('0x5'));var intUtil=require(_0x77fe('0x6'));var config=require(_0x77fe('0x7'));var logger=require(_0x77fe('0x8'))(_0x77fe('0x9'));config[_0x77fe('0xa')]=_[_0x77fe('0xb')](config[_0x77fe('0xa')],{'host':_0x77fe('0xc'),'port':0x18eb});var io=require(_0x77fe('0xd'))(new Redis(config[_0x77fe('0xa')]));function getAdminUser(_0x2b6265,_0x573422,_0x8f8f7b,_0x39ec62,_0x1831f6,_0x1d41dd){return new Promise(function(_0x362986,_0x479191){var _0x7e9889={'method':_0x77fe('0xe'),'uri':_0x39ec62+_0x77fe('0xf')+'&'+_0x1831f6+'&'+_0x1d41dd,'auth':_0x573422,'json':!![]};return rp(_0x7e9889)[_0x77fe('0x10')](function(_0x54f8ff){if(_0x54f8ff[_0x77fe('0x11')]['length']>0x0){_0x8f8f7b[_0x77fe('0x12')]=_0x54f8ff[_0x77fe('0x11')][0x0][_0x77fe('0x13')];}logger[_0x77fe('0x14')]('['+[_0x2b6265[_0x77fe('0x15')]()]+'],\x20getAdminUser\x20crm',_0x8f8f7b);_0x362986(_0x8f8f7b);})[_0x77fe('0x16')](function(_0x223f2a){logger['error']('['+[_0x2b6265['toUpperCase']()]+']',_0x223f2a[_0x77fe('0x17')]);_0x479191(_0x223f2a[_0x77fe('0x17')]);});});}function getUser(_0x5d96d8,_0x1c9d95,_0xa1535f,_0x5d80c0,_0x5982c1){return function(_0x164cea){logger[_0x77fe('0x14')]('['+[_0x5d96d8[_0x77fe('0x15')]()]+_0x77fe('0x18'),_0x164cea);return new Promise(function(_0x3dce8d,_0x53d14c){if(intUtil['validateEmail'](_0x164cea['userEmail'])){var _0x26dc01={'method':_0x77fe('0xe'),'uri':_0xa1535f+_0x77fe('0x19')+_0x164cea[_0x77fe('0x1a')]+'&'+_0x5d80c0+'&'+_0x5982c1,'auth':_0x1c9d95,'json':!![]};logger['info']('['+[_0x5d96d8[_0x77fe('0x15')]()]+_0x77fe('0x1b'),_0x26dc01);return rp(_0x26dc01)[_0x77fe('0x10')](function(_0x2656f2){logger[_0x77fe('0x14')]('['+[_0x5d96d8[_0x77fe('0x15')]()]+'],\x20getUser\x20entity',_0x2656f2);if(_0x2656f2[_0x77fe('0x11')]['length']>0x0&&String(_0x2656f2[_0x77fe('0x11')][0x0][_0x77fe('0x1c')])==='true'){_0x164cea[_0x77fe('0x1d')]=_0x2656f2[_0x77fe('0x11')][0x0][_0x77fe('0x13')];}else{_0x164cea[_0x77fe('0x1d')]=_0x164cea[_0x77fe('0x12')];_0x164cea['userEmail']=_0x164cea[_0x77fe('0x1e')];}logger[_0x77fe('0x14')]('['+[_0x5d96d8[_0x77fe('0x15')]()]+_0x77fe('0x1f'),_0x164cea);_0x3dce8d(_0x164cea);})[_0x77fe('0x16')](function(_0x3cef52){logger['error']('['+[_0x5d96d8[_0x77fe('0x15')]()]+']',_0x3cef52[_0x77fe('0x17')]);_0x53d14c(_0x3cef52[_0x77fe('0x17')]);});}else{logger['info']('['+[_0x5d96d8[_0x77fe('0x15')]()]+_0x77fe('0x20'));_0x164cea[_0x77fe('0x1d')]=_0x164cea[_0x77fe('0x12')];_0x164cea[_0x77fe('0x1a')]=_0x164cea[_0x77fe('0x1e')];_0x3dce8d(_0x164cea);}});};}function createEndUser(_0x3842b8,_0x155869,_0xc5302,_0x397c64,_0x2a66a9){logger[_0x77fe('0x14')]('['+[_0x3842b8[_0x77fe('0x15')]()]+_0x77fe('0x21'),_0xc5302);return new Promise(function(_0x2eac3a,_0x487323){var _0x6b66cf={'method':_0x77fe('0x22'),'uri':_0x397c64+_0x77fe('0x23')+_0x2a66a9,'body':{'user_name':_0xc5302[_0x77fe('0x24')],'roles':_0x77fe('0x25'),'first_name':_0xc5302[_0x77fe('0x24')],'active':'true','date_format':'System','phone':_0xc5302[_0x77fe('0x24')]},'auth':_0x155869,'json':!![]};return rp(_0x6b66cf)['then'](function(_0x1b1818){logger[_0x77fe('0x14')]('['+[_0x3842b8['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1b1818[_0x77fe('0x11')]);_0xc5302[_0x77fe('0x26')]=_0x1b1818['result'][_0x77fe('0x13')];_0x2eac3a(_0xc5302);})[_0x77fe('0x16')](function(_0x142a92){logger['error']('['+[_0x3842b8[_0x77fe('0x15')]()]+']',_0x142a92['message']);_0x487323(_0x142a92[_0x77fe('0x17')]);});});}function getEndUser(_0x2e2b83,_0x1e002f,_0x474092,_0x1246c5,_0x1caaf1){return function(_0x2c6cc0){logger['info']('['+[_0x2e2b83['toUpperCase']()]+_0x77fe('0x27'),_0x2c6cc0);return new Promise(function(_0x4696a5,_0x35816e){var _0x9a0016={'method':_0x77fe('0xe'),'uri':_0x474092+_0x77fe('0x28')+_0x2c6cc0['endUserNumber']+'&'+_0x1246c5+'&'+_0x1caaf1,'auth':_0x1e002f,'json':!![]};return rp(_0x9a0016)[_0x77fe('0x10')](function(_0x4f7571){if(_0x4f7571[_0x77fe('0x11')][_0x77fe('0x29')]>0x0){_0x2c6cc0[_0x77fe('0x26')]=_0x4f7571['result'][0x0][_0x77fe('0x13')];logger[_0x77fe('0x14')]('['+[_0x2e2b83['toUpperCase']()]+_0x77fe('0x2a'),_0x2c6cc0);_0x4696a5(_0x2c6cc0);}else{return createEndUser(_0x2e2b83,_0x1e002f,_0x2c6cc0,_0x474092,_0x1246c5)['then'](function(_0x28a41c){logger[_0x77fe('0x14')]('['+[_0x2e2b83[_0x77fe('0x15')]()]+_0x77fe('0x2b'),_0x28a41c);_0x4696a5(_0x28a41c);});}})['catch'](function(_0x170a16){logger['error']('['+[_0x2e2b83[_0x77fe('0x15')]()]+']',_0x170a16[_0x77fe('0x17')]);_0x35816e(_0x170a16[_0x77fe('0x17')]);});});};}function getCustomFields(_0x350b63,_0x567e41){var _0x2d4605={};if(_0x350b63[_0x77fe('0x29')]>0x0){_['forEach'](_0x350b63,function(_0x4c67f4){if(_[_0x77fe('0x2c')]([_0x77fe('0x2d'),'picklist'],_0x4c67f4[_0x77fe('0x2e')])&&_0x4c67f4[_0x77fe('0x2f')]&&!_0x4c67f4[_0x77fe('0x30')]){_0x2d4605[_0x4c67f4['nameField'][_0x77fe('0x31')]()]=_0x4c67f4['content'][_0x77fe('0x32')]();}else if(_[_0x77fe('0x2c')]([_0x77fe('0x2d'),_0x77fe('0x33')],_0x4c67f4['type'])&&_0x4c67f4[_0x77fe('0x34')]&&_0x4c67f4[_0x77fe('0x30')]){_0x2d4605[_0x4c67f4[_0x77fe('0x34')][_0x77fe('0x31')]()]=_0x4c67f4[_0x77fe('0x35')][_0x77fe('0x32')]();}else if(_0x4c67f4[_0x77fe('0x2e')]===_0x77fe('0x36')&&_0x4c67f4['variableName']&&_0x4c67f4[_0x77fe('0x34')]&&_0x4c67f4[_0x77fe('0x30')]){_0x2d4605[_0x4c67f4['idField'][_0x77fe('0x31')]()]=_0x567e41[_0x4c67f4['variableName']][_0x77fe('0x32')]();}else if(_0x4c67f4[_0x77fe('0x2e')]==='customVariable'&&_0x4c67f4[_0x77fe('0x37')]&&_0x4c67f4[_0x77fe('0x37')][_0x77fe('0x38')]&&_0x4c67f4['idField']&&_0x4c67f4['customField']){_0x2d4605[_0x4c67f4[_0x77fe('0x34')]['toLowerCase']()]=_0x567e41[_0x4c67f4['Variable']['name']['toLowerCase']()]['toString']();}});}return _0x2d4605;}function getTicket(_0xe1f375,_0xc97e05,_0xed4bac,_0x3280af,_0x59b956,_0x5c8c12){return function(_0x563195){logger[_0x77fe('0x14')]('['+[_0xe1f375['toUpperCase']()]+_0x77fe('0x39'),_0x563195);return new Promise(function(_0x3f9c66,_0x2a136e){var _0x2434cd=_0xe1f375[_0x77fe('0x31')]()===_0x77fe('0x3a')?_0x563195['userId']:_0x563195[_0x77fe('0x26')];var _0x2eefe5={'method':'POST','uri':_0xed4bac+_0x77fe('0x3b')+'?'+_0x5c8c12,'body':Object[_0x77fe('0x3c')]({},{'active':_0x77fe('0x3d'),'caller_id':_0x2434cd,'assigned_to':_0x563195[_0x77fe('0x1d')],'short_description':intUtil[_0x77fe('0x3e')](_0x3280af[_0x77fe('0x3f')],_0x59b956,'\x20'),'description':intUtil[_0x77fe('0x3e')](_0x3280af[_0x77fe('0x40')],_0x59b956,'\x0a')},getCustomFields(_0x3280af[_0x77fe('0x41')],_0x59b956)),'auth':_0xc97e05,'json':!![]};return rp(_0x2eefe5)['then'](function(_0x48bb27){logger[_0x77fe('0x14')]('['+[_0xe1f375[_0x77fe('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x48bb27['result']);_0x563195[_0x77fe('0x42')]=_0x48bb27[_0x77fe('0x11')][_0x77fe('0x13')];_0x563195['ticketNumber']=_0x48bb27[_0x77fe('0x11')]['number'];logger[_0x77fe('0x14')]('['+[_0xe1f375[_0x77fe('0x15')]()]+_0x77fe('0x43'),_0x563195);_0x3f9c66(_0x563195);})['catch'](function(_0x52d3cd){logger[_0x77fe('0x44')]('['+[_0xe1f375['toUpperCase']()]+']',_0x52d3cd[_0x77fe('0x17')]);_0x2a136e(_0x52d3cd[_0x77fe('0x17')]);});});};}function createRemoteTag(_0x3e33d7,_0x1f0c26,_0x4edd54,_0x3f98fb){return new Promise(function(_0x34956e,_0x35a0d9){var _0x315991={'method':_0x77fe('0x22'),'uri':_0x4edd54+_0x77fe('0x45')+'?'+_0x3f98fb,'body':{'short_description':_0x3e33d7,'global':!![],'active':!![],'name':_0x3e33d7},'auth':_0x1f0c26,'json':!![]};return rp(_0x315991)[_0x77fe('0x10')](function(_0x33eb33){var _0x119ad0=_0x33eb33[_0x77fe('0x11')][_0x77fe('0x13')];_0x34956e(_0x119ad0);});});}function getRemoteTag(_0x25058a,_0x2f4189,_0x18ce2e,_0x2da42f,_0x19a3b2){return new Promise(function(_0x310c7f,_0x496d1f){var _0x2021c8={'method':_0x77fe('0xe'),'uri':_0x18ce2e+_0x77fe('0x45')+_0x77fe('0x46')+_0x25058a+'&'+_0x2da42f,'auth':_0x2f4189,'json':!![]};return rp(_0x2021c8)[_0x77fe('0x10')](function(_0x3c0ffa){if(_0x3c0ffa[_0x77fe('0x11')][_0x77fe('0x29')]>0x0){var _0x331c04=_0x3c0ffa[_0x77fe('0x11')][0x0][_0x77fe('0x13')];_0x310c7f(_0x331c04);}else{return createRemoteTag(_0x25058a,_0x2f4189,_0x18ce2e,_0x2da42f)[_0x77fe('0x10')](function(_0x3fda4a){_0x310c7f(_0x3fda4a);});}});});}function assignTagToIncident(_0x4c14a8,_0x141551,_0x2f6a3e,_0x570414,_0x435a29){return new Promise(function(_0x5ac459,_0x1f7136){var _0x45ed9d={'method':_0x77fe('0x22'),'uri':_0x2f6a3e+'label_entry'+'?'+_0x435a29,'body':{'label':_0x4c14a8,'table':_0x77fe('0x3b'),'id_type':'Incident','table_key':_0x570414[_0x77fe('0x42')],'title':_0x77fe('0x47')+_0x570414['ticketNumber'],'id_display':_0x570414['ticketNumber']},'auth':_0x141551,'json':!![]};return rp(_0x45ed9d)['then'](function(_0x35f067){_0x5ac459();})[_0x77fe('0x16')](function(){_0x5ac459();});});}function manageTags(_0x188f2f,_0x322c64,_0x23127e,_0x59e7b0,_0x41c349,_0x3dc1a2,_0x39e274){return new Promise(function(_0x39cc27,_0x2f4a4b){var _0x35fbea=[];_0x322c64[_0x77fe('0x48')](function(_0x1de360){_0x35fbea[_0x77fe('0x49')](getRemoteTag(_0x1de360,_0x23127e,_0x59e7b0,_0x3dc1a2,_0x39e274));});return Promise['all'](_0x35fbea)[_0x77fe('0x10')](function(_0x4f0c27){if(_0x4f0c27['length']){logger[_0x77fe('0x14')]('['+[_0x188f2f[_0x77fe('0x15')]()]+_0x77fe('0x4a'),_0x4f0c27);var _0x1d2028=[];_0x4f0c27[_0x77fe('0x48')](function(_0x498082){_0x1d2028['push'](assignTagToIncident(_0x498082,_0x23127e,_0x59e7b0,_0x41c349,_0x3dc1a2));});return Promise[_0x77fe('0x4b')](_0x1d2028)[_0x77fe('0x10')](function(){_0x39cc27();})['catch'](function(){_0x39cc27();});}else{_0x39cc27();}});});}function getTags(_0x46aa37,_0x35a5a0,_0x5236b8,_0x209ae5,_0x4a2714,_0xf9d4d2){return function(_0x4432e8){return new Promise(function(_0x69a1f2,_0x63ccdf){var _0x229a5a=[];var _0x4dfc9c=_0x209ae5[_0x77fe('0x4c')];if(_0x4dfc9c&&_0x4dfc9c['length']>0x0){_0x229a5a=_[_0x77fe('0x4d')](_0x4dfc9c,_0x77fe('0x38'));}if(_0x229a5a[_0x77fe('0x29')]>0x0){return manageTags(_0x46aa37,_0x229a5a,_0x35a5a0,_0x5236b8,_0x4432e8,_0x4a2714,_0xf9d4d2)['then'](function(){_0x69a1f2(_0x4432e8);});}else{_0x69a1f2(_0x4432e8);}});};}function emit(_0x511fa0,_0x4278a2,_0x4e26d0){var _0x3a9962='%26sysparm_record_target%3Dincident'+_0x77fe('0x4e')+_0x77fe('0x4f')+'%255EORDERBYDESCnumber';var _0x197470={'uri':_0x511fa0+_0x77fe('0x50')+_0x4e26d0+_0x3a9962};io['to'](util[_0x77fe('0x51')](_0x77fe('0x52'),_0x4278a2))[_0x77fe('0x53')](_0x77fe('0x54'),_0x197470);}exports['cs']=function(_0x12cc1d,_0x371738,_0xa76fb3,_0x4395b9,_0x3b0d26,_0x507449,_0x170dad,_0x453db8){var _0x4dcc44={};var _0x1b3e47={'user':_0x507449['username'],'pass':_0x507449[_0x77fe('0x55')]};var _0x11aa7d=_0x77fe('0x56');var _0x183486='sysparm_display_value=true';_0x507449[_0x77fe('0x57')]=intUtil['stripTrailingSlash'](_0x507449[_0x77fe('0x57')]);_0x507449[_0x77fe('0x58')]=intUtil[_0x77fe('0x59')](_0x507449['serverUrl']);var _0x34d713=util[_0x77fe('0x51')](_0x77fe('0x5a'),_0x507449[_0x77fe('0x57')]);_0x4dcc44[_0x77fe('0x1a')]=!_['isNil'](_0x4395b9)?_0x4395b9['email']:null;_0x4dcc44['adminEmail']=_0x507449[_0x77fe('0x5b')];_0x4dcc44[_0x77fe('0x24')]=_0x453db8[_0x77fe('0x31')]()===_0x77fe('0x3a')?_0x371738[_0x77fe('0x5c')]:_0x371738[_0x77fe('0x5d')];_0x4dcc44[_0x77fe('0x5e')]=_0x453db8==='queue'||_0x453db8==='unmanaged'?'queue':_0x77fe('0x3a');var _0x80d45d=util[_0x77fe('0x51')](_0x77fe('0x5f'),_0x507449[_0x77fe('0x58')],_0x371738[_0x77fe('0x60')],md5(_0x371738[_0x77fe('0x60')]));if(_0x3b0d26&&_0x3b0d26['monitor_format']){logger[_0x77fe('0x14')](_0x77fe('0x61'),'Recording\x20is\x20enabled!');_0x371738['recordingURL']=_0x80d45d;}else if(_0x170dad&&_0x170dad['recordingFormat']&&_0x170dad[_0x77fe('0x62')]!=='none'){logger[_0x77fe('0x14')](_0x77fe('0x63'),_0x77fe('0x64'));_0x371738[_0x77fe('0x65')]=_0x80d45d;}else{_0x371738[_0x77fe('0x65')]='';}return getAdminUser(_0x453db8,_0x1b3e47,_0x4dcc44,_0x34d713,_0x183486,_0x11aa7d)[_0x77fe('0x10')](getUser(_0x453db8,_0x1b3e47,_0x34d713,_0x183486,_0x11aa7d))[_0x77fe('0x10')](getEndUser(_0x453db8,_0x1b3e47,_0x34d713,_0x183486,_0x11aa7d))[_0x77fe('0x10')](getTicket(_0x453db8,_0x1b3e47,_0x34d713,_0xa76fb3,_0x371738,_0x183486))[_0x77fe('0x10')](function(_0x4a31dc){logger[_0x77fe('0x14')](util['format'](_0x77fe('0x66'),_0x4a31dc[_0x77fe('0x42')]));logger[_0x77fe('0x14')](util['format']('call\x20direction:\x20%s',_0x453db8));if(_0x453db8!=='unmanaged'){logger[_0x77fe('0x14')]('['+[_0x453db8['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x507449[_0x77fe('0x57')],_0x4395b9[_0x77fe('0x38')],_0x4a31dc[_0x77fe('0x42')]);}})[_0x77fe('0x16')](function(_0x57aa69){logger[_0x77fe('0x44')]('['+[_0x453db8[_0x77fe('0x15')]()]+_0x77fe('0x67'),util[_0x77fe('0x68')](_0x57aa69,{'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 6e4a9c0..6f8c27c 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 _0x99fc=['get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','content','variable','custom_fields','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','isNil','users','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Basic\x20%s','toString','base64'];(function(_0x5253b9,_0x5cc342){var _0x18c365=function(_0xb13706){while(--_0xb13706){_0x5253b9['push'](_0x5253b9['shift']());}};_0x18c365(++_0x5cc342);}(_0x99fc,0xc9));var _0xc99f=function(_0x4bac16,_0x428e2c){_0x4bac16=_0x4bac16-0x0;var _0x5885dc=_0x99fc[_0x4bac16];return _0x5885dc;};'use strict';var _=require('lodash');var rp=require(_0xc99f('0x0'));var BPromise=require('bluebird');var md5=require(_0xc99f('0x1'));var util=require('util');var Redis=require(_0xc99f('0x2'));var intUtil=require(_0xc99f('0x3'));var config=require(_0xc99f('0x4'));var logger=require(_0xc99f('0x5'))('sugarcrm');config[_0xc99f('0x6')]=_['defaults'](config['redis'],{'host':_0xc99f('0x7'),'port':0x18eb});var io=require(_0xc99f('0x8'))(new Redis(config[_0xc99f('0x6')]));var def={'method':_0xc99f('0x9'),'json':!![]};function emit(_0x57b7ab,_0x28b5dc,_0x1639c9){io['to'](_0x57b7ab)[_0xc99f('0xa')](_0x28b5dc,_0x1639c9);}function getTicket(_0x417c9f,_0x2c1996,_0xe8b0a4,_0x38666a,_0x47a4d3,_0x4e5ead,_0x3965e2,_0x3c96ce){logger['info'](_0xc99f('0xb'));var _0x18c123=new Date();var _0x36b548=[{'name':_0xc99f('0xc'),'value':intUtil[_0xc99f('0xd')](_0x38666a[_0xc99f('0xe')],_0x47a4d3,'\x20')},{'name':'assigned_user_id','value':_0x2c1996['id']},{'name':_0xc99f('0xf'),'value':_0x2c1996['id']},{'name':_0xc99f('0x10'),'value':intUtil[_0xc99f('0xd')](_0x38666a[_0xc99f('0x11')],_0x47a4d3,'\x0a')},{'name':'date_start','value':_0x18c123[_0xc99f('0x12')]()[_0xc99f('0x13')](0x0,0x13)[_0xc99f('0x14')]('T','\x20')},{'name':_0xc99f('0x15'),'value':'0'},{'name':_0xc99f('0x16'),'value':'15'},{'name':'parent_id','value':_0xe8b0a4['id']},{'name':'parent_type','value':_0xc99f('0x17')},{'name':_0xc99f('0x18'),'value':_0xe8b0a4[_0xc99f('0xc')]},{'name':_0xc99f('0x19'),'value':_0x3c96ce}];if(_0x4e5ead[_0xc99f('0x1a')]){_[_0xc99f('0x1b')](_0x4e5ead,function(_0x42f022){if(_0x47a4d3[_0x42f022[_0xc99f('0x1c')]]){_0x36b548[_0xc99f('0x1d')]({'name':_0x42f022[_0xc99f('0x1e')],'value':_0x47a4d3[_0x42f022[_0xc99f('0x1c')]]});}});}return request({'form':{'method':_0xc99f('0x1f'),'input_type':_0xc99f('0x20'),'response_type':'JSON','rest_data':JSON[_0xc99f('0x21')]({'session':_0x3965e2['id'],'module_name':'Calls','name_value_list':_0x36b548})}});}function getAuth(_0x3cb9ca){return util['format'](_0xc99f('0x22'),new Buffer(_0x3cb9ca['apiKey']+':X')[_0xc99f('0x23')](_0xc99f('0x24')));}function getServerInfo(_0x439386){return request({'form':{'method':_0xc99f('0x25'),'input_type':_0xc99f('0x20'),'response_type':_0xc99f('0x20'),'rest_data':JSON['stringify']({'session':_0x439386['id']})}});}function getUser(_0x121051,_0x48ff54,_0x3c7868){if(!_['isNil'](_0x48ff54)){logger[_0xc99f('0x26')](_0xc99f('0x27'),_0x48ff54);return request({'form':{'method':_0xc99f('0x28'),'input_type':_0xc99f('0x20'),'response_type':_0xc99f('0x20'),'rest_data':JSON['stringify']({'session':_0x3c7868['id'],'module_name':_0xc99f('0x29'),'query':util[_0xc99f('0x2a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x48ff54),'order_by':'','offset':'0','select_fields':['id',_0xc99f('0xc'),_0xc99f('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc99f('0x2c')](function(_0x441d4b){if(_0x441d4b[_0xc99f('0x2d')][_0xc99f('0x1a')]){var _0x45ff72=_['find'](_0x441d4b[_0xc99f('0x2d')],function(_0x3a9c68){return _0x3a9c68['name_value_list'][_0xc99f('0x2b')][_0xc99f('0x2e')]===_0x48ff54;});if(_0x45ff72){logger[_0xc99f('0x26')](_0xc99f('0x2f'));return BPromise[_0xc99f('0x30')]({'id':_0x45ff72[_0xc99f('0x31')]['id'][_0xc99f('0x2e')],'name':_0x45ff72[_0xc99f('0x31')][_0xc99f('0xc')][_0xc99f('0x2e')]});}}logger[_0xc99f('0x26')](_0xc99f('0x32'));return BPromise[_0xc99f('0x30')]({'id':_0x3c7868[_0xc99f('0x31')]['user_id']['value'],'name':_0x3c7868[_0xc99f('0x31')][_0xc99f('0x2b')][_0xc99f('0x2e')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc99f('0x30')]({'id':_0x3c7868[_0xc99f('0x31')][_0xc99f('0x33')]['value'],'name':_0x3c7868[_0xc99f('0x31')][_0xc99f('0x2b')][_0xc99f('0x2e')]});}}function getEndUser(_0x6eaa42,_0x3580e3,_0x15b562,_0x3f93af){logger[_0xc99f('0x26')](_0xc99f('0x34'),_0x15b562);return request({'form':{'method':'get_entry_list','input_type':_0xc99f('0x20'),'response_type':_0xc99f('0x20'),'rest_data':JSON[_0xc99f('0x21')]({'session':_0x3f93af['id'],'module_name':'Contacts','query':util[_0xc99f('0x2a')](_0xc99f('0x35'),_0x15b562),'order_by':'','offset':'0','select_fields':['id','name',_0xc99f('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc99f('0x2c')](function(_0x49dafc){if(_0x49dafc[_0xc99f('0x2d')][_0xc99f('0x1a')]){var _0x41ae27=_[_0xc99f('0x37')](_0x49dafc[_0xc99f('0x2d')],function(_0xbda694){return _0xbda694[_0xc99f('0x31')]['phone_home'][_0xc99f('0x2e')]===_0x15b562;});if(_0x41ae27){logger[_0xc99f('0x26')]('Enduser\x20found!');return BPromise[_0xc99f('0x30')]({'id':_0x41ae27[_0xc99f('0x31')]['id'][_0xc99f('0x2e')],'name':_0x41ae27[_0xc99f('0x31')][_0xc99f('0xc')][_0xc99f('0x2e')],'phone':_0x41ae27[_0xc99f('0x31')][_0xc99f('0x36')][_0xc99f('0x2e')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xc99f('0x20'),'response_type':_0xc99f('0x20'),'rest_data':JSON[_0xc99f('0x21')]({'session':_0x3f93af['id'],'module_name':_0xc99f('0x17'),'name_value_list':[{'name':_0xc99f('0x38'),'value':_0x3580e3!==''?_0x3580e3:util[_0xc99f('0x2a')](_0xc99f('0x39'),_0x15b562)},{'name':_0xc99f('0x36'),'value':_0x15b562}]})}})['then'](function(_0x5a6878){logger[_0xc99f('0x26')](_0xc99f('0x3a'));return BPromise[_0xc99f('0x30')]({'id':_0x5a6878['id'],'name':_0x5a6878[_0xc99f('0x2d')][_0xc99f('0x38')][_0xc99f('0x2e')],'phone':_0x5a6878[_0xc99f('0x2d')][_0xc99f('0x36')][_0xc99f('0x2e')]});});}});}function request(_0x3e23ee){logger['debug'](_0xc99f('0x3b'),JSON[_0xc99f('0x21')](_0x3e23ee));return rp(_[_0xc99f('0x3c')](def,_0x3e23ee));}function getTags(_0x116f64,_0x3b892f){var _0x30dab4=[];if(_0x116f64&&_0x116f64[_0xc99f('0x1a')]>0x0){_0x30dab4=_[_0xc99f('0x3d')](_0x116f64,_0x3b892f);}return _0x30dab4;}function getCustomFields(_0x1168ee,_0x2f99d8){var _0x2d173e=[];var _0x2313f0={'custom_fields':[]};if(_0x1168ee[_0xc99f('0x1a')]>0x0){_[_0xc99f('0x1b')](_0x1168ee,function(_0x193d9c){if(_0x193d9c[_0xc99f('0x3e')]===_0xc99f('0x3f')&&_0x193d9c[_0xc99f('0x40')]&&!_0x193d9c[_0xc99f('0x41')]){_0x2313f0[_0x193d9c['nameField']['toLowerCase']()]=_0x193d9c[_0xc99f('0x42')][_0xc99f('0x23')]();}else if(_0x193d9c['type']===_0xc99f('0x3f')&&_0x193d9c['idField']&&_0x193d9c[_0xc99f('0x41')]){_0x2313f0['custom_fields']['push']({'id':_0x193d9c[_0xc99f('0x1e')],'value':_0x193d9c[_0xc99f('0x42')][_0xc99f('0x23')]()});}else if(_0x193d9c[_0xc99f('0x3e')]===_0xc99f('0x43')&&_0x193d9c[_0xc99f('0x1c')]&&_0x193d9c['idField']&&_0x193d9c['customField']){_0x2f99d8[_0x193d9c[_0xc99f('0x1c')]]&&_0x2313f0[_0xc99f('0x44')]['push']({'id':_0x193d9c[_0xc99f('0x1e')],'value':_0x2f99d8[_0x193d9c['variableName']][_0xc99f('0x23')]()});}else if(_0x193d9c[_0xc99f('0x3e')]===_0xc99f('0x45')&&_0x193d9c[_0xc99f('0x46')]&&_0x193d9c['Variable'][_0xc99f('0xc')]&&_0x193d9c[_0xc99f('0x1e')]&&_0x193d9c[_0xc99f('0x41')]){_0x2f99d8[_0x193d9c['Variable'][_0xc99f('0xc')]['toLowerCase']()]&&_0x2313f0[_0xc99f('0x44')]['push']({'id':_0x193d9c['idField'],'value':_0x2f99d8[_0x193d9c['Variable'][_0xc99f('0xc')]['toLowerCase']()][_0xc99f('0x23')]()});}});}return _0x2313f0;}function getConnection(_0x373071){return request({'method':_0xc99f('0x9'),'form':{'method':_0xc99f('0x47'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc99f('0x21')]({'user_auth':{'user_name':_0x373071[_0xc99f('0x48')],'password':_0x373071[_0xc99f('0x49')],'encryption':'PLAIN'},'application':_0xc99f('0x4a')})}})[_0xc99f('0x2c')](function(_0x5b475b){var _0x4f44aa=_0x5b475b;if(_0x4f44aa['id']){def['sessionID']=_0x4f44aa['id'];return BPromise['resolve'](_0x4f44aa);}else{throw new Error(util[_0xc99f('0x2a')](_0xc99f('0x4b'),_0x373071['id']));}});}function setRelationship(_0x512fe7,_0xc09a17,_0x38ec39,_0x562473){return request({'form':{'method':_0xc99f('0x4c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc99f('0x21')]({'session':_0x512fe7['id'],'module_name':_0xc99f('0x4d'),'module_id':_0x38ec39['id'],'link_field_name':_0x562473,'related_ids':[_0xc09a17['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc99f('0x4e')]=function(_0x3aa850,_0x3a7f19,_0x7b4317,_0x22c43e,_0x53ca3a,_0x39d221){var _0x2c040c,_0x2612fb,_0x321bfa,_0x53fd55;_0x39d221[_0xc99f('0x4f')]=intUtil['stripTrailingSlash'](_0x39d221[_0xc99f('0x4f')]);_0x39d221[_0xc99f('0x50')]=intUtil[_0xc99f('0x51')](_0x39d221[_0xc99f('0x50')]);def[_0xc99f('0x52')]=util[_0xc99f('0x2a')](_0xc99f('0x53'),_0x39d221[_0xc99f('0x4f')]);if(_0x53ca3a&&_0x53ca3a['monitor_format']){logger[_0xc99f('0x26')](_0xc99f('0x54'),'Recording\x20is\x20enabled!');_0x3a7f19['recordingURL']=util[_0xc99f('0x2a')](_0xc99f('0x55'),_0x39d221[_0xc99f('0x50')],_0x3a7f19[_0xc99f('0x56')],md5(_0x3a7f19[_0xc99f('0x56')]));}else{_0x3a7f19['recordingURL']='';}return getConnection(_0x39d221)[_0xc99f('0x2c')](function(_0xd7936d){_0x53fd55=_0xd7936d;return getUser(_0x39d221,_0x22c43e[_0xc99f('0xc')],_0x53fd55);})['then'](function(_0xaeac2a){_0x2c040c=_0xaeac2a;logger[_0xc99f('0x26')](_0xc99f('0x57'),_0x2c040c['id']);return getEndUser(_0x39d221,_0x3a7f19[_0xc99f('0x58')],_0x3a7f19[_0xc99f('0x59')],_0x53fd55);})['then'](function(_0x4e275a){_0x2612fb=_0x4e275a;logger[_0xc99f('0x26')](_0xc99f('0x5a'),_0x2612fb['id']);return getTicket(_0x39d221,_0x2c040c,_0x2612fb,_0x7b4317,_0x3a7f19,_0x7b4317[_0xc99f('0x5b')],_0x53fd55,_0xc99f('0x5c'));})['then'](function(_0x8729a5){_0x321bfa=_0x8729a5;logger['info'](_0xc99f('0x5d'));logger['info'](_0xc99f('0x5e'),_0x321bfa['id']);return setRelationship(_0x53fd55,_0x2c040c,_0x321bfa,'users');})[_0xc99f('0x2c')](function(){return setRelationship(_0x53fd55,_0x2612fb,_0x321bfa,_0xc99f('0x5f'));})[_0xc99f('0x2c')](function(){return getServerInfo(_0x53fd55);})['then'](function(_0x686181){var _0x37a61d=parseInt(_0x686181[_0xc99f('0x60')][_0xc99f('0x61')](0x0));var _0x1c6037=util[_0xc99f('0x2a')](_0xc99f('0x62'),_0x39d221[_0xc99f('0x4f')],_0x321bfa['id']);if(_0x37a61d>0x6){_0x1c6037=util[_0xc99f('0x2a')](_0xc99f('0x63'),_0x39d221[_0xc99f('0x4f')],_0x321bfa['id']);}logger[_0xc99f('0x26')](_0xc99f('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc99f('0x2a')](_0xc99f('0x64'),_0x22c43e[_0xc99f('0xc')]),_0xc99f('0x65'),{'uri':_0x1c6037});})[_0xc99f('0x66')](function(_0x2e2e10){logger[_0xc99f('0x67')](_0xc99f('0x54'),JSON[_0xc99f('0x21')](_0x2e2e10));});};exports[_0xc99f('0x68')]=function(_0x2c8da4,_0x76a899,_0x75057a,_0x3c66f0,_0x1c092a,_0x116c60,_0x3eeca2){var _0x5ef5e6,_0x271260,_0x259fdf,_0x11a392;_0x116c60[_0xc99f('0x4f')]=intUtil[_0xc99f('0x51')](_0x116c60[_0xc99f('0x4f')]);_0x116c60['serverUrl']=intUtil[_0xc99f('0x51')](_0x116c60['serverUrl']);def[_0xc99f('0x52')]=util[_0xc99f('0x2a')](_0xc99f('0x53'),_0x116c60[_0xc99f('0x4f')]);if(_0x3eeca2&&_0x3eeca2[_0xc99f('0x69')]&&_0x3eeca2[_0xc99f('0x69')]!=='none'){logger[_0xc99f('0x26')](_0xc99f('0x6a'),_0xc99f('0x6b'));_0x76a899[_0xc99f('0x6c')]=util[_0xc99f('0x2a')](_0xc99f('0x55'),_0x116c60[_0xc99f('0x50')],_0x76a899['uniqueid'],md5(_0x76a899[_0xc99f('0x56')]));}return getConnection(_0x116c60)[_0xc99f('0x2c')](function(_0x395e8e){_0x11a392=_0x395e8e;return getUser(_0x116c60,_0x3c66f0[_0xc99f('0xc')],_0x11a392);})[_0xc99f('0x2c')](function(_0x4c319d){_0x5ef5e6=_0x4c319d;logger['info'](_0xc99f('0x57'),_0x5ef5e6['id']);return getEndUser(_0x116c60,_0x76a899[_0xc99f('0x6d')],_0x76a899[_0xc99f('0x6e')],_0x11a392);})[_0xc99f('0x2c')](function(_0x52ed41){_0x271260=_0x52ed41;logger[_0xc99f('0x26')](_0xc99f('0x5a'),_0x271260['id']);return getTicket(_0x116c60,_0x5ef5e6,_0x271260,_0x75057a,_0x76a899,_0x75057a['Fields'],_0x11a392,_0xc99f('0x6f'));})['then'](function(_0x2ca990){_0x259fdf=_0x2ca990;logger[_0xc99f('0x26')]('Ticket\x20created!');logger[_0xc99f('0x26')]('The\x20Ticket\x20ID\x20is:',_0x259fdf['id']);return setRelationship(_0x11a392,_0x5ef5e6,_0x259fdf,'users');})['then'](function(){return setRelationship(_0x11a392,_0x271260,_0x259fdf,_0xc99f('0x5f'));})[_0xc99f('0x2c')](function(){return getServerInfo(_0x11a392);})['then'](function(_0x1d6a51){var _0x3b6111=parseInt(_0x1d6a51['version'][_0xc99f('0x61')](0x0));var _0x1b6a08=util[_0xc99f('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x116c60[_0xc99f('0x4f')],_0x259fdf['id']);if(_0x3b6111>0x6){_0x1b6a08=util['format'](_0xc99f('0x63'),_0x116c60['remoteUri'],_0x259fdf['id']);}logger[_0xc99f('0x26')](_0xc99f('0x6a'),_0xc99f('0x70'));emit(util['format'](_0xc99f('0x64'),_0x3c66f0['name']),_0xc99f('0x65'),{'uri':_0x1b6a08});})[_0xc99f('0x66')](function(_0x33c0a4){logger[_0xc99f('0x67')](_0xc99f('0x6a'),JSON['stringify'](_0x33c0a4));});};exports[_0xc99f('0x71')]=function(_0x1eb8a6,_0x4411f9,_0x2f0a55,_0x2b3a5a,_0x2f1c07,_0x5c6ecd){var _0x3530bc,_0x3ec5f7,_0x344a88,_0x457f6e;_0x5c6ecd[_0xc99f('0x4f')]=intUtil['stripTrailingSlash'](_0x5c6ecd[_0xc99f('0x4f')]);_0x5c6ecd[_0xc99f('0x50')]=intUtil[_0xc99f('0x51')](_0x5c6ecd[_0xc99f('0x50')]);def[_0xc99f('0x52')]=util['format'](_0xc99f('0x53'),_0x5c6ecd[_0xc99f('0x4f')]);if(_0x2f1c07&&_0x2f1c07[_0xc99f('0x72')]){logger[_0xc99f('0x26')]('['+_0x4411f9[_0xc99f('0x73')][_0xc99f('0x74')]()+']','Recording\x20is\x20enabled!');_0x4411f9[_0xc99f('0x6c')]=util[_0xc99f('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c6ecd[_0xc99f('0x50')],_0x4411f9[_0xc99f('0x56')],md5(_0x4411f9['uniqueid']));}else{_0x4411f9[_0xc99f('0x6c')]='';}return getConnection(_0x5c6ecd)['then'](function(_0x440bb3){_0x457f6e=_0x440bb3;if(!_[_0xc99f('0x75')](_0x2b3a5a)){return getUser(_0x5c6ecd,_0x2b3a5a['name'],_0x457f6e);}else{return getUser(_0x5c6ecd,null,_0x457f6e);}})['then'](function(_0x5aa446){_0x3530bc=_0x5aa446;logger['info']('The\x20User\x20ID\x20is:',_0x3530bc['id']);return getEndUser(_0x5c6ecd,_0x4411f9[_0xc99f('0x58')],_0x4411f9[_0xc99f('0x59')],_0x457f6e);})[_0xc99f('0x2c')](function(_0x38edcd){_0x3ec5f7=_0x38edcd;logger['info'](_0xc99f('0x5a'),_0x3ec5f7['id']);return getTicket(_0x5c6ecd,_0x3530bc,_0x3ec5f7,_0x2f0a55,_0x4411f9,_0x2f0a55[_0xc99f('0x5b')],_0x457f6e,_0xc99f('0x5c'));})[_0xc99f('0x2c')](function(_0x4cf628){_0x344a88=_0x4cf628;logger[_0xc99f('0x26')](_0xc99f('0x5d'));logger['info'](_0xc99f('0x5e'),_0x344a88['id']);return setRelationship(_0x457f6e,_0x3530bc,_0x344a88,_0xc99f('0x76'));})[_0xc99f('0x2c')](function(){return setRelationship(_0x457f6e,_0x3ec5f7,_0x344a88,'contacts');})[_0xc99f('0x2c')](function(){return getServerInfo(_0x457f6e);})['catch'](function(_0x38e744){logger['error']('['+_0x4411f9[_0xc99f('0x73')][_0xc99f('0x74')]()+']',JSON[_0xc99f('0x21')](_0x38e744));});}; \ No newline at end of file +var _0x4697=['replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','nameField','toLowerCase','content','string','customField','custom_fields','variable','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','lastevent','isNil','Inbound','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice'];(function(_0x8fa745,_0x1fec4a){var _0x219ad9=function(_0x50ee53){while(--_0x50ee53){_0x8fa745['push'](_0x8fa745['shift']());}};_0x219ad9(++_0x1fec4a);}(_0x4697,0x67));var _0x7469=function(_0x596d35,_0x4e207c){_0x596d35=_0x596d35-0x0;var _0x7e0c92=_0x4697[_0x596d35];return _0x7e0c92;};'use strict';var _=require(_0x7469('0x0'));var rp=require(_0x7469('0x1'));var BPromise=require(_0x7469('0x2'));var md5=require(_0x7469('0x3'));var util=require('util');var Redis=require(_0x7469('0x4'));var intUtil=require(_0x7469('0x5'));var config=require(_0x7469('0x6'));var logger=require('../../../../config/logger')(_0x7469('0x7'));config[_0x7469('0x8')]=_[_0x7469('0x9')](config[_0x7469('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7469('0xa'))(new Redis(config[_0x7469('0x8')]));var def={'method':_0x7469('0xb'),'json':!![]};function emit(_0x256bb8,_0xe5877,_0x247ee1){io['to'](_0x256bb8)[_0x7469('0xc')](_0xe5877,_0x247ee1);}function getTicket(_0x244cf8,_0x583344,_0x33905d,_0x560544,_0x20e6aa,_0x277c37,_0x266243,_0x25a2a4){logger['info'](_0x7469('0xd'));var _0x40c612=new Date();var _0x3fa145=[{'name':_0x7469('0xe'),'value':intUtil[_0x7469('0xf')](_0x560544[_0x7469('0x10')],_0x20e6aa,'\x20')},{'name':_0x7469('0x11'),'value':_0x583344['id']},{'name':_0x7469('0x12'),'value':_0x583344['id']},{'name':_0x7469('0x13'),'value':intUtil[_0x7469('0xf')](_0x560544[_0x7469('0x14')],_0x20e6aa,'\x0a')},{'name':_0x7469('0x15'),'value':_0x40c612['toISOString']()[_0x7469('0x16')](0x0,0x13)[_0x7469('0x17')]('T','\x20')},{'name':_0x7469('0x18'),'value':'0'},{'name':_0x7469('0x19'),'value':'15'},{'name':_0x7469('0x1a'),'value':_0x33905d['id']},{'name':_0x7469('0x1b'),'value':'Contacts'},{'name':_0x7469('0x1c'),'value':_0x33905d[_0x7469('0xe')]},{'name':_0x7469('0x1d'),'value':_0x25a2a4}];if(_0x277c37[_0x7469('0x1e')]){_[_0x7469('0x1f')](_0x277c37,function(_0x11053d){if(_0x20e6aa[_0x11053d[_0x7469('0x20')]]){_0x3fa145[_0x7469('0x21')]({'name':_0x11053d[_0x7469('0x22')],'value':_0x20e6aa[_0x11053d['variableName']]});}});}return request({'form':{'method':_0x7469('0x23'),'input_type':_0x7469('0x24'),'response_type':_0x7469('0x24'),'rest_data':JSON[_0x7469('0x25')]({'session':_0x266243['id'],'module_name':_0x7469('0x26'),'name_value_list':_0x3fa145})}});}function getAuth(_0x2b4e46){return util[_0x7469('0x27')](_0x7469('0x28'),new Buffer(_0x2b4e46[_0x7469('0x29')]+':X')[_0x7469('0x2a')](_0x7469('0x2b')));}function getServerInfo(_0x5b713c){return request({'form':{'method':_0x7469('0x2c'),'input_type':_0x7469('0x24'),'response_type':_0x7469('0x24'),'rest_data':JSON['stringify']({'session':_0x5b713c['id']})}});}function getUser(_0x1287b0,_0x4237e8,_0x3da882){if(!_['isNil'](_0x4237e8)){logger[_0x7469('0x2d')](_0x7469('0x2e'),_0x4237e8);return request({'form':{'method':_0x7469('0x2f'),'input_type':_0x7469('0x24'),'response_type':'JSON','rest_data':JSON[_0x7469('0x25')]({'session':_0x3da882['id'],'module_name':'Employees','query':util['format'](_0x7469('0x30'),_0x4237e8),'order_by':'','offset':'0','select_fields':['id',_0x7469('0xe'),_0x7469('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4e559b){if(_0x4e559b['entry_list']['length']){var _0x32a0db=_[_0x7469('0x32')](_0x4e559b[_0x7469('0x33')],function(_0x1983bf){return _0x1983bf[_0x7469('0x34')][_0x7469('0x31')][_0x7469('0x35')]===_0x4237e8;});if(_0x32a0db){logger[_0x7469('0x2d')](_0x7469('0x36'));return BPromise[_0x7469('0x37')]({'id':_0x32a0db['name_value_list']['id'][_0x7469('0x35')],'name':_0x32a0db[_0x7469('0x34')][_0x7469('0xe')]['value']});}}logger[_0x7469('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7469('0x37')]({'id':_0x3da882['name_value_list'][_0x7469('0x38')]['value'],'name':_0x3da882[_0x7469('0x34')][_0x7469('0x31')]['value']});});}else{logger[_0x7469('0x2d')](_0x7469('0x39'));return BPromise['resolve']({'id':_0x3da882['name_value_list'][_0x7469('0x38')][_0x7469('0x35')],'name':_0x3da882[_0x7469('0x34')][_0x7469('0x31')][_0x7469('0x35')]});}}function getEndUser(_0x470f09,_0x20f79f,_0x244dac,_0x47e32e){logger[_0x7469('0x2d')](_0x7469('0x3a'),_0x244dac);return request({'form':{'method':'get_entry_list','input_type':_0x7469('0x24'),'response_type':'JSON','rest_data':JSON[_0x7469('0x25')]({'session':_0x47e32e['id'],'module_name':_0x7469('0x3b'),'query':util[_0x7469('0x27')](_0x7469('0x3c'),_0x244dac),'order_by':'','offset':'0','select_fields':['id',_0x7469('0xe'),_0x7469('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7469('0x3e')](function(_0x1d1a50){if(_0x1d1a50[_0x7469('0x33')]['length']){var _0x2c3fe4=_[_0x7469('0x32')](_0x1d1a50['entry_list'],function(_0x2fa415){return _0x2fa415[_0x7469('0x34')][_0x7469('0x3d')][_0x7469('0x35')]===_0x244dac;});if(_0x2c3fe4){logger[_0x7469('0x2d')](_0x7469('0x3f'));return BPromise[_0x7469('0x37')]({'id':_0x2c3fe4[_0x7469('0x34')]['id']['value'],'name':_0x2c3fe4[_0x7469('0x34')][_0x7469('0xe')][_0x7469('0x35')],'phone':_0x2c3fe4[_0x7469('0x34')][_0x7469('0x3d')][_0x7469('0x35')]});}}else{logger[_0x7469('0x2d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x7469('0x23'),'input_type':_0x7469('0x24'),'response_type':_0x7469('0x24'),'rest_data':JSON[_0x7469('0x25')]({'session':_0x47e32e['id'],'module_name':_0x7469('0x3b'),'name_value_list':[{'name':_0x7469('0x40'),'value':_0x20f79f!==_0x7469('0x41')?_0x20f79f:util['format'](_0x7469('0x42'),_0x244dac)},{'name':_0x7469('0x3d'),'value':_0x244dac}]})}})[_0x7469('0x3e')](function(_0x46dac0){logger[_0x7469('0x2d')](_0x7469('0x43'));return BPromise['resolve']({'id':_0x46dac0['id'],'name':_0x46dac0[_0x7469('0x33')][_0x7469('0x40')][_0x7469('0x35')],'phone':_0x46dac0['entry_list'][_0x7469('0x3d')][_0x7469('0x35')]});});}});}function request(_0x2de206){logger[_0x7469('0x44')]('[HTTP]',JSON[_0x7469('0x25')](_0x2de206));return rp(_[_0x7469('0x45')](def,_0x2de206));}function getTags(_0x3529c9,_0x5a7858){var _0x19f044=[];if(_0x3529c9&&_0x3529c9['length']>0x0){_0x19f044=_[_0x7469('0x46')](_0x3529c9,_0x5a7858);}return _0x19f044;}function getCustomFields(_0x2c500f,_0x520f71){var _0x2dcdb7=[];var _0x232860={'custom_fields':[]};if(_0x2c500f['length']>0x0){_[_0x7469('0x1f')](_0x2c500f,function(_0x1ecc22){if(_0x1ecc22[_0x7469('0x47')]==='string'&&_0x1ecc22['nameField']&&!_0x1ecc22['customField']){_0x232860[_0x1ecc22[_0x7469('0x48')][_0x7469('0x49')]()]=_0x1ecc22[_0x7469('0x4a')][_0x7469('0x2a')]();}else if(_0x1ecc22[_0x7469('0x47')]===_0x7469('0x4b')&&_0x1ecc22[_0x7469('0x22')]&&_0x1ecc22[_0x7469('0x4c')]){_0x232860[_0x7469('0x4d')]['push']({'id':_0x1ecc22[_0x7469('0x22')],'value':_0x1ecc22[_0x7469('0x4a')]['toString']()});}else if(_0x1ecc22[_0x7469('0x47')]===_0x7469('0x4e')&&_0x1ecc22['variableName']&&_0x1ecc22[_0x7469('0x22')]&&_0x1ecc22[_0x7469('0x4c')]){_0x520f71[_0x1ecc22[_0x7469('0x20')]]&&_0x232860[_0x7469('0x4d')]['push']({'id':_0x1ecc22[_0x7469('0x22')],'value':_0x520f71[_0x1ecc22[_0x7469('0x20')]][_0x7469('0x2a')]()});}else if(_0x1ecc22[_0x7469('0x47')]===_0x7469('0x4f')&&_0x1ecc22[_0x7469('0x50')]&&_0x1ecc22['Variable'][_0x7469('0xe')]&&_0x1ecc22['idField']&&_0x1ecc22[_0x7469('0x4c')]){_0x520f71[_0x1ecc22[_0x7469('0x50')][_0x7469('0xe')]['toLowerCase']()]&&_0x232860[_0x7469('0x4d')][_0x7469('0x21')]({'id':_0x1ecc22[_0x7469('0x22')],'value':_0x520f71[_0x1ecc22['Variable'][_0x7469('0xe')][_0x7469('0x49')]()][_0x7469('0x2a')]()});}});}return _0x232860;}function getConnection(_0x187ece){return request({'method':_0x7469('0xb'),'form':{'method':_0x7469('0x51'),'input_type':'JSON','response_type':_0x7469('0x24'),'rest_data':JSON[_0x7469('0x25')]({'user_auth':{'user_name':_0x187ece['username'],'password':_0x187ece['password'],'encryption':_0x7469('0x52')},'application':_0x7469('0x53')})}})[_0x7469('0x3e')](function(_0x1482ef){var _0x27c621=_0x1482ef;if(_0x27c621['id']){def[_0x7469('0x54')]=_0x27c621['id'];return BPromise[_0x7469('0x37')](_0x27c621);}else{throw new Error(util[_0x7469('0x27')](_0x7469('0x55'),_0x187ece['id']));}});}function setRelationship(_0x49b318,_0x52d979,_0x5e5423,_0x41b2ef){return request({'form':{'method':_0x7469('0x56'),'input_type':_0x7469('0x24'),'response_type':_0x7469('0x24'),'rest_data':JSON[_0x7469('0x25')]({'session':_0x49b318['id'],'module_name':_0x7469('0x26'),'module_id':_0x5e5423['id'],'link_field_name':_0x41b2ef,'related_ids':[_0x52d979['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7469('0x57')]=function(_0x2923ab,_0x2f492a,_0x376137,_0x413f51,_0x2cdd9b,_0x38a2fe){var _0xac33dd,_0x54c558,_0x22eba9,_0x4fdfb5;_0x38a2fe[_0x7469('0x58')]=intUtil['stripTrailingSlash'](_0x38a2fe[_0x7469('0x58')]);_0x38a2fe['serverUrl']=intUtil[_0x7469('0x59')](_0x38a2fe['serverUrl']);def[_0x7469('0x5a')]=util[_0x7469('0x27')](_0x7469('0x5b'),_0x38a2fe[_0x7469('0x58')]);if(_0x2cdd9b&&_0x2cdd9b[_0x7469('0x5c')]){logger[_0x7469('0x2d')]('[QUEUE]',_0x7469('0x5d'));_0x2f492a[_0x7469('0x5e')]=util['format'](_0x7469('0x5f'),_0x38a2fe[_0x7469('0x60')],_0x2f492a[_0x7469('0x61')],md5(_0x2f492a[_0x7469('0x61')]));}else{_0x2f492a['recordingURL']='';}return getConnection(_0x38a2fe)[_0x7469('0x3e')](function(_0x17afe3){_0x4fdfb5=_0x17afe3;return getUser(_0x38a2fe,_0x413f51[_0x7469('0xe')],_0x4fdfb5);})['then'](function(_0x2c4112){_0xac33dd=_0x2c4112;logger['info'](_0x7469('0x62'),_0xac33dd['id']);return getEndUser(_0x38a2fe,_0x2f492a[_0x7469('0x63')],_0x2f492a[_0x7469('0x64')],_0x4fdfb5);})[_0x7469('0x3e')](function(_0x20751a){_0x54c558=_0x20751a;logger[_0x7469('0x2d')](_0x7469('0x65'),_0x54c558['id']);return getTicket(_0x38a2fe,_0xac33dd,_0x54c558,_0x376137,_0x2f492a,_0x376137[_0x7469('0x66')],_0x4fdfb5,'Inbound');})[_0x7469('0x3e')](function(_0x6680f){_0x22eba9=_0x6680f;logger['info'](_0x7469('0x67'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x22eba9['id']);return setRelationship(_0x4fdfb5,_0xac33dd,_0x22eba9,_0x7469('0x68'));})[_0x7469('0x3e')](function(){return setRelationship(_0x4fdfb5,_0x54c558,_0x22eba9,_0x7469('0x69'));})[_0x7469('0x3e')](function(){return getServerInfo(_0x4fdfb5);})[_0x7469('0x3e')](function(_0x3528c4){var _0x44d848=parseInt(_0x3528c4[_0x7469('0x6a')][_0x7469('0x6b')](0x0));var _0x66507=util[_0x7469('0x27')](_0x7469('0x6c'),_0x38a2fe['remoteUri'],_0x22eba9['id']);if(_0x44d848>0x6){_0x66507=util['format'](_0x7469('0x6d'),_0x38a2fe[_0x7469('0x58')],_0x22eba9['id']);}logger[_0x7469('0x2d')]('[QUEUE]',_0x7469('0x6e'));emit(util[_0x7469('0x27')](_0x7469('0x6f'),_0x413f51[_0x7469('0xe')]),_0x7469('0x70'),{'uri':_0x66507});})[_0x7469('0x71')](function(_0x55fa72){logger[_0x7469('0x72')](_0x7469('0x73'),JSON[_0x7469('0x25')](_0x55fa72));});};exports[_0x7469('0x74')]=function(_0x292b2b,_0x296496,_0x10816c,_0x9a0f0f,_0x526433,_0x237f01,_0x5071ca){var _0x47c97b,_0x3bbdf3,_0x5d0c45,_0x5172b4;_0x237f01['remoteUri']=intUtil[_0x7469('0x59')](_0x237f01['remoteUri']);_0x237f01[_0x7469('0x60')]=intUtil[_0x7469('0x59')](_0x237f01[_0x7469('0x60')]);def['uri']=util[_0x7469('0x27')]('%s/service/v4_1/rest.php',_0x237f01[_0x7469('0x58')]);if(_0x5071ca&&_0x5071ca[_0x7469('0x75')]&&_0x5071ca[_0x7469('0x75')]!==_0x7469('0x76')){logger[_0x7469('0x2d')](_0x7469('0x77'),_0x7469('0x5d'));_0x296496['recordingURL']=util[_0x7469('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x237f01[_0x7469('0x60')],_0x296496[_0x7469('0x61')],md5(_0x296496[_0x7469('0x61')]));}return getConnection(_0x237f01)[_0x7469('0x3e')](function(_0x43def1){_0x5172b4=_0x43def1;return getUser(_0x237f01,_0x9a0f0f[_0x7469('0xe')],_0x5172b4);})[_0x7469('0x3e')](function(_0x53959c){_0x47c97b=_0x53959c;logger[_0x7469('0x2d')](_0x7469('0x62'),_0x47c97b['id']);return getEndUser(_0x237f01,_0x296496[_0x7469('0x78')],_0x296496['destcalleridnum'],_0x5172b4);})[_0x7469('0x3e')](function(_0x1824ac){_0x3bbdf3=_0x1824ac;logger[_0x7469('0x2d')](_0x7469('0x65'),_0x3bbdf3['id']);return getTicket(_0x237f01,_0x47c97b,_0x3bbdf3,_0x10816c,_0x296496,_0x10816c[_0x7469('0x66')],_0x5172b4,_0x7469('0x79'));})[_0x7469('0x3e')](function(_0x403610){_0x5d0c45=_0x403610;logger[_0x7469('0x2d')](_0x7469('0x67'));logger[_0x7469('0x2d')](_0x7469('0x7a'),_0x5d0c45['id']);return setRelationship(_0x5172b4,_0x47c97b,_0x5d0c45,_0x7469('0x68'));})[_0x7469('0x3e')](function(){return setRelationship(_0x5172b4,_0x3bbdf3,_0x5d0c45,'contacts');})[_0x7469('0x3e')](function(){return getServerInfo(_0x5172b4);})[_0x7469('0x3e')](function(_0x43aa82){var _0x159299=parseInt(_0x43aa82['version'][_0x7469('0x6b')](0x0));var _0x476034=util['format'](_0x7469('0x6c'),_0x237f01[_0x7469('0x58')],_0x5d0c45['id']);if(_0x159299>0x6){_0x476034=util[_0x7469('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x237f01[_0x7469('0x58')],_0x5d0c45['id']);}logger[_0x7469('0x2d')](_0x7469('0x77'),_0x7469('0x6e'));emit(util[_0x7469('0x27')](_0x7469('0x6f'),_0x9a0f0f[_0x7469('0xe')]),_0x7469('0x70'),{'uri':_0x476034});})[_0x7469('0x71')](function(_0x139926){logger['error'](_0x7469('0x77'),JSON[_0x7469('0x25')](_0x139926));});};exports['unmanaged']=function(_0x37877e,_0x8a8549,_0x3f4963,_0x2ff735,_0x2a2958,_0x1b5738){var _0x1f9ad0,_0x43c98d,_0xe395fd,_0x5c8928;_0x1b5738[_0x7469('0x58')]=intUtil[_0x7469('0x59')](_0x1b5738[_0x7469('0x58')]);_0x1b5738['serverUrl']=intUtil[_0x7469('0x59')](_0x1b5738['serverUrl']);def[_0x7469('0x5a')]=util[_0x7469('0x27')]('%s/service/v4_1/rest.php',_0x1b5738[_0x7469('0x58')]);if(_0x2a2958&&_0x2a2958[_0x7469('0x5c')]){logger[_0x7469('0x2d')]('['+_0x8a8549[_0x7469('0x7b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x8a8549[_0x7469('0x5e')]=util[_0x7469('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b5738[_0x7469('0x60')],_0x8a8549[_0x7469('0x61')],md5(_0x8a8549[_0x7469('0x61')]));}else{_0x8a8549[_0x7469('0x5e')]='';}return getConnection(_0x1b5738)['then'](function(_0x480120){_0x5c8928=_0x480120;if(!_[_0x7469('0x7c')](_0x2ff735)){return getUser(_0x1b5738,_0x2ff735[_0x7469('0xe')],_0x5c8928);}else{return getUser(_0x1b5738,null,_0x5c8928);}})[_0x7469('0x3e')](function(_0x296a4b){_0x1f9ad0=_0x296a4b;logger[_0x7469('0x2d')]('The\x20User\x20ID\x20is:',_0x1f9ad0['id']);return getEndUser(_0x1b5738,_0x8a8549[_0x7469('0x63')],_0x8a8549['calleridnum'],_0x5c8928);})[_0x7469('0x3e')](function(_0x47a517){_0x43c98d=_0x47a517;logger['info'](_0x7469('0x65'),_0x43c98d['id']);return getTicket(_0x1b5738,_0x1f9ad0,_0x43c98d,_0x3f4963,_0x8a8549,_0x3f4963[_0x7469('0x66')],_0x5c8928,_0x7469('0x7d'));})[_0x7469('0x3e')](function(_0x440184){_0xe395fd=_0x440184;logger[_0x7469('0x2d')](_0x7469('0x67'));logger[_0x7469('0x2d')]('The\x20Ticket\x20ID\x20is:',_0xe395fd['id']);return setRelationship(_0x5c8928,_0x1f9ad0,_0xe395fd,_0x7469('0x68'));})[_0x7469('0x3e')](function(){return setRelationship(_0x5c8928,_0x43c98d,_0xe395fd,'contacts');})[_0x7469('0x3e')](function(){return getServerInfo(_0x5c8928);})[_0x7469('0x71')](function(_0x17bc7c){logger[_0x7469('0x72')]('['+_0x8a8549[_0x7469('0x7b')]['toUpperCase']()+']',JSON[_0x7469('0x25')](_0x17bc7c));});}; \ 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 227701d..8dc240b 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 _0x4e52=['type','string','content','variableName','toString','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','key','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','length'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x4e52,0xa5));var _0x24e5=function(_0x332978,_0x41b16b){_0x332978=_0x332978-0x0;var _0x3a0bfa=_0x4e52[_0x332978];return _0x3a0bfa;};'use strict';var _=require(_0x24e5('0x0'));var util=require(_0x24e5('0x1'));exports['getString']=function(_0x5d95b1,_0xc53b14,_0x39e9ec){var _0x382c1e=[];if(_0x5d95b1[_0x24e5('0x2')]>0x0){var _0x567ff0=_['sortBy'](_0x5d95b1,['id']);for(var _0x3968d7=0x0;_0x3968d7<_0x567ff0[_0x24e5('0x2')];_0x3968d7++){var _0x32185d=_0x567ff0[_0x3968d7];if(_0x32185d[_0x24e5('0x3')]===_0x24e5('0x4')){_0x382c1e['push'](_0x32185d[_0x24e5('0x5')]);}else if(_0x32185d[_0x24e5('0x3')]==='variable'&&_0x32185d[_0x24e5('0x6')]){_0xc53b14[_0x32185d['variableName']]&&_0x382c1e['push'](_0xc53b14[_0x32185d[_0x24e5('0x6')]][_0x24e5('0x7')]());}else if(_0x32185d[_0x24e5('0x3')]===_0x24e5('0x8')&&_0x32185d[_0x24e5('0x9')]&&_0x32185d[_0x24e5('0x9')][_0x24e5('0xa')]){_0xc53b14[_0x32185d[_0x24e5('0x9')]['name'][_0x24e5('0xb')]()]&&_0x382c1e[_0x24e5('0xc')](_0xc53b14[_0x32185d[_0x24e5('0x9')]['name'][_0x24e5('0xb')]()][_0x24e5('0x7')]());}else if(_0x32185d[_0x24e5('0x3')]===_0x24e5('0xd')){if(_0x32185d[_0x24e5('0xe')]==='string'&&_0x32185d[_0x24e5('0xf')]){_0x382c1e[_0x24e5('0xc')](util['format']('%s:\x20%s',_0x32185d[_0x24e5('0xf')],_0x32185d[_0x24e5('0x10')]));}else if(_0x32185d[_0x24e5('0xe')]==='variable'&&_0x32185d[_0x24e5('0x6')]&&_0x32185d[_0x24e5('0xf')]){_0xc53b14[_0x32185d[_0x24e5('0x6')]]&&_0x382c1e[_0x24e5('0xc')](util['format']('%s:\x20%s',_0x32185d[_0x24e5('0xf')],_0xc53b14[_0x32185d[_0x24e5('0x6')]]));}else if(_0x32185d[_0x24e5('0xe')]==='customVariable'&&_0x32185d[_0x24e5('0x9')]&&_0x32185d['Variable'][_0x24e5('0xa')]&&_0x32185d[_0x24e5('0xf')]){_0xc53b14[_0x32185d[_0x24e5('0x9')][_0x24e5('0xa')]['toLowerCase']()]&&_0x382c1e['push'](util['format'](_0x24e5('0x11'),_0x32185d['key'],_0xc53b14[_0x32185d['Variable'][_0x24e5('0xa')][_0x24e5('0xb')]()]));}}}}return _0x382c1e[_0x24e5('0x12')](_0x39e9ec);};exports[_0x24e5('0x13')]=function(_0x1f7632){var _0x4d65db=_0x1f7632[_0x24e5('0x14')](-0x1);if(_0x4d65db==='/'){_0x1f7632=_0x1f7632['substring'](0x0,_0x1f7632[_0x24e5('0x15')](_0x4d65db));}return _0x1f7632;};exports['validateEmail']=function(_0x2003c2){if(!_[_0x24e5('0x16')](_0x2003c2)&&_0x2003c2!==''){var _0x3ce1e1=/^(([^<>()\[\]\\.,;:\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 _0x3ce1e1[_0x24e5('0x17')](String(_0x2003c2)[_0x24e5('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xc4e7=['validateEmail','util','getString','length','sortBy','type','string','push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x5f3762,_0x40542a){var _0x522c40=function(_0x4e711f){while(--_0x4e711f){_0x5f3762['push'](_0x5f3762['shift']());}};_0x522c40(++_0x40542a);}(_0xc4e7,0x1bb));var _0x7c4e=function(_0x422b48,_0xf131fb){_0x422b48=_0x422b48-0x0;var _0x4a6f67=_0xc4e7[_0x422b48];return _0x4a6f67;};'use strict';var _=require('lodash');var util=require(_0x7c4e('0x0'));exports[_0x7c4e('0x1')]=function(_0x28b10d,_0x53d024,_0x12fa40){var _0x358252=[];if(_0x28b10d[_0x7c4e('0x2')]>0x0){var _0x2b3c1e=_[_0x7c4e('0x3')](_0x28b10d,['id']);for(var _0x4b5292=0x0;_0x4b5292<_0x2b3c1e[_0x7c4e('0x2')];_0x4b5292++){var _0x589ade=_0x2b3c1e[_0x4b5292];if(_0x589ade[_0x7c4e('0x4')]===_0x7c4e('0x5')){_0x358252[_0x7c4e('0x6')](_0x589ade[_0x7c4e('0x7')]);}else if(_0x589ade[_0x7c4e('0x4')]===_0x7c4e('0x8')&&_0x589ade[_0x7c4e('0x9')]){_0x53d024[_0x589ade[_0x7c4e('0x9')]]&&_0x358252['push'](_0x53d024[_0x589ade['variableName']]['toString']());}else if(_0x589ade[_0x7c4e('0x4')]==='customVariable'&&_0x589ade['Variable']&&_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')]){_0x53d024[_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')][_0x7c4e('0xc')]()]&&_0x358252[_0x7c4e('0x6')](_0x53d024[_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')][_0x7c4e('0xc')]()][_0x7c4e('0xd')]());}else if(_0x589ade[_0x7c4e('0x4')]===_0x7c4e('0xe')){if(_0x589ade[_0x7c4e('0xf')]===_0x7c4e('0x5')&&_0x589ade[_0x7c4e('0x10')]){_0x358252['push'](util[_0x7c4e('0x11')](_0x7c4e('0x12'),_0x589ade[_0x7c4e('0x10')],_0x589ade['keyContent']));}else if(_0x589ade[_0x7c4e('0xf')]===_0x7c4e('0x8')&&_0x589ade['variableName']&&_0x589ade[_0x7c4e('0x10')]){_0x53d024[_0x589ade[_0x7c4e('0x9')]]&&_0x358252[_0x7c4e('0x6')](util[_0x7c4e('0x11')](_0x7c4e('0x12'),_0x589ade[_0x7c4e('0x10')],_0x53d024[_0x589ade[_0x7c4e('0x9')]]));}else if(_0x589ade[_0x7c4e('0xf')]===_0x7c4e('0x13')&&_0x589ade[_0x7c4e('0xa')]&&_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')]&&_0x589ade[_0x7c4e('0x10')]){_0x53d024[_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')]['toLowerCase']()]&&_0x358252[_0x7c4e('0x6')](util[_0x7c4e('0x11')](_0x7c4e('0x12'),_0x589ade['key'],_0x53d024[_0x589ade[_0x7c4e('0xa')][_0x7c4e('0xb')][_0x7c4e('0xc')]()]));}}}}return _0x358252[_0x7c4e('0x14')](_0x12fa40);};exports[_0x7c4e('0x15')]=function(_0x16fc7f){var _0x31a706=_0x16fc7f[_0x7c4e('0x16')](-0x1);if(_0x31a706==='/'){_0x16fc7f=_0x16fc7f[_0x7c4e('0x17')](0x0,_0x16fc7f[_0x7c4e('0x18')](_0x31a706));}return _0x16fc7f;};exports[_0x7c4e('0x19')]=function(_0x168178){if(!_['isNil'](_0x168178)&&_0x168178!==''){var _0x16b5c1=/^(([^<>()\[\]\\.,;:\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 _0x16b5c1['test'](String(_0x168178)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 44724d0..7fbeea8 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x5377e3,_0xe8b507){var _0x4d0f10=function(_0x115a5a){while(--_0x115a5a){_0x5377e3['push'](_0x5377e3['shift']());}};_0x4d0f10(++_0xe8b507);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x43211f,_0x46b4f2){var _0x469109=function(_0x3bbcb1){while(--_0x3bbcb1){_0x43211f['push'](_0x43211f['shift']());}};_0x469109(++_0x46b4f2);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index ae03995..04f11a7 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 _0x5795=['content','toString','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','newTab','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','remoteUri','type:user\x20role:agent\x20email:%s','results','agent','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','base64','debug','[HTTP]','stringify','map','forEach','includes','picklist','type','nameField','customField','toLowerCase'];(function(_0x1db697,_0x17e0e5){var _0xc22600=function(_0x52b8fb){while(--_0x52b8fb){_0x1db697['push'](_0x1db697['shift']());}};_0xc22600(++_0x17e0e5);}(_0x5795,0x171));var _0x5579=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x5795[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x5579('0x0'));var rp=require(_0x5579('0x1'));var md5=require(_0x5579('0x2'));var util=require('util');var Redis=require(_0x5579('0x3'));var intUtil=require(_0x5579('0x4'));var config=require(_0x5579('0x5'));var logger=require(_0x5579('0x6'))('zendesk');config['redis']=_[_0x5579('0x7')](config[_0x5579('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5579('0x9'))(new Redis(config['redis']));function emit(_0x29a9c0,_0x42bc04,_0xdc26bb){io['to'](_0x29a9c0)['emit'](_0x42bc04,_0xdc26bb);}var headers={'Content-Type':_0x5579('0xa'),'Accept':_0x5579('0xa')};function getTicket(_0x406215,_0x33a7d7,_0x1d6154,_0x51ead5,_0x116c81){logger[_0x5579('0xb')](_0x5579('0xc'));return request({'uri':util[_0x5579('0xd')](_0x5579('0xe'),_0x406215['remoteUri']),'method':'POST','body':{'ticket':_[_0x5579('0xf')]({'requester_id':_0x1d6154['id'],'submitter_id':_0x33a7d7?_0x33a7d7['id']:undefined,'assignee_id':_0x33a7d7?_0x33a7d7['id']:undefined,'tags':getTags(_0x51ead5[_0x5579('0x10')],_0x5579('0x11')),'subject':intUtil[_0x5579('0x12')](_0x51ead5[_0x5579('0x13')],_0x116c81,'\x20'),'description':intUtil[_0x5579('0x12')](_0x51ead5[_0x5579('0x14')],_0x116c81,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5579('0x12')](_0x51ead5[_0x5579('0x14')],_0x116c81,'\x0a')}},getCustomFields(_0x51ead5[_0x5579('0x15')],_0x116c81))}})[_0x5579('0x16')](function(_0x31e6dc){logger[_0x5579('0xb')](_0x5579('0x17'));return _0x31e6dc[_0x5579('0x18')];});}function getUser(_0x971c40,_0x107b2c){if(intUtil[_0x5579('0x19')](_0x107b2c)){logger[_0x5579('0xb')]('Getting\x20agent\x20with\x20email',_0x107b2c);return request({'uri':util['format']('%s/search.json',_0x971c40[_0x5579('0x1a')]),'qs':{'query':util[_0x5579('0xd')](_0x5579('0x1b'),_0x107b2c)}})[_0x5579('0x16')](function(_0x4adf8b){if(_0x4adf8b['count']){logger['info']('Agent\x20found!');return _['find'](_0x4adf8b[_0x5579('0x1c')],{'email':_0x107b2c,'role':_0x5579('0x1d')});}else{logger[_0x5579('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5579('0xd')](_0x5579('0x1e'),_0x971c40[_0x5579('0x1a')])})[_0x5579('0x16')](function(_0x5ce321){logger[_0x5579('0xb')]('Admin\x20account\x20selected.');return _0x5ce321[_0x5579('0x1f')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5579('0xd')](_0x5579('0x1e'),_0x971c40[_0x5579('0x1a')])})[_0x5579('0x16')](function(_0xc077a5){logger['info'](_0x5579('0x20'));return _0xc077a5[_0x5579('0x1f')];});}}function getEndUser(_0x428d21,_0x45beb1,_0x2e1623){logger[_0x5579('0xb')](_0x5579('0x21'),_0x2e1623);return request({'uri':util[_0x5579('0xd')](_0x5579('0x22'),_0x428d21[_0x5579('0x1a')]),'qs':{'query':util['format'](_0x5579('0x23'),_0x2e1623)}})[_0x5579('0x16')](function(_0x4b5d74){var _0x119d1d;if(_0x4b5d74[_0x5579('0x1c')][_0x5579('0x24')]){_0x4b5d74['results']=_[_0x5579('0x25')](_0x4b5d74[_0x5579('0x1c')],{'suspended':![],'role':_0x5579('0x26')});if(_0x4b5d74['results'][_0x5579('0x24')]){_0x119d1d=_[_0x5579('0x27')](_0x4b5d74[_0x5579('0x1c')]);}}if(_0x119d1d){logger[_0x5579('0xb')]('Enduser\x20found!');return _0x119d1d;}else{logger[_0x5579('0xb')](_0x5579('0x28'));return request({'uri':util['format'](_0x5579('0x29'),_0x428d21[_0x5579('0x1a')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x5579('0xd')]('Caller\x20-\x20%s',_0x45beb1||_0x2e1623),'phone':_0x2e1623}}})[_0x5579('0x16')](function(_0x3e12b6){logger[_0x5579('0xb')](_0x5579('0x2a'));return _0x3e12b6[_0x5579('0x1f')];});}});}function getAuth(_0x54a2b9){var _0x4d0a67;if(_0x54a2b9[_0x5579('0x2b')]===_0x5579('0x2c')){_0x4d0a67=util['format'](_0x5579('0x2d'),_0x54a2b9[_0x5579('0x2e')],_0x54a2b9['password']);}else if(_0x54a2b9[_0x5579('0x2b')]==='token'){_0x4d0a67=util[_0x5579('0xd')]('%s/token:%s',_0x54a2b9[_0x5579('0x2e')],_0x54a2b9['token']);}return util[_0x5579('0xd')]('Basic\x20%s',new Buffer(_0x4d0a67)['toString'](_0x5579('0x2f')));}function request(_0x3d3dea){logger[_0x5579('0x30')](_0x5579('0x31'),JSON[_0x5579('0x32')](_0x3d3dea));return rp(_[_0x5579('0x7')](_0x3d3dea,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x40c451,_0x218050){var _0x53eb88=[];if(_0x40c451&&_0x40c451[_0x5579('0x24')]>0x0){_0x53eb88=_[_0x5579('0x33')](_0x40c451,_0x218050);}return _0x53eb88;}function getCustomFields(_0xb58600,_0x35d680){var _0x4a83f5=[];var _0x25cb97={'custom_fields':[]};if(_0xb58600[_0x5579('0x24')]>0x0){_[_0x5579('0x34')](_0xb58600,function(_0x2ebd41){if(_[_0x5579('0x35')](['string',_0x5579('0x36')],_0x2ebd41[_0x5579('0x37')])&&_0x2ebd41[_0x5579('0x38')]&&!_0x2ebd41[_0x5579('0x39')]){_0x25cb97[_0x2ebd41['nameField'][_0x5579('0x3a')]()]=_0x2ebd41[_0x5579('0x3b')][_0x5579('0x3c')]();}else if(_[_0x5579('0x35')](['string',_0x5579('0x36')],_0x2ebd41[_0x5579('0x37')])&&_0x2ebd41[_0x5579('0x3d')]&&_0x2ebd41[_0x5579('0x39')]){_0x25cb97['custom_fields'][_0x5579('0x3e')]({'id':_0x2ebd41[_0x5579('0x3d')],'value':_0x2ebd41['content']['toString']()});}else if(_0x2ebd41[_0x5579('0x37')]===_0x5579('0x3f')&&_0x2ebd41[_0x5579('0x40')]&&_0x2ebd41[_0x5579('0x3d')]&&_0x2ebd41[_0x5579('0x39')]){_0x35d680[_0x2ebd41[_0x5579('0x40')]]&&_0x25cb97['custom_fields']['push']({'id':_0x2ebd41[_0x5579('0x3d')],'value':_0x35d680[_0x2ebd41[_0x5579('0x40')]][_0x5579('0x3c')]()});}else if(_0x2ebd41[_0x5579('0x37')]===_0x5579('0x41')&&_0x2ebd41[_0x5579('0x42')]&&_0x2ebd41[_0x5579('0x42')][_0x5579('0x11')]&&_0x2ebd41[_0x5579('0x3d')]&&_0x2ebd41[_0x5579('0x39')]){_0x35d680[_0x2ebd41['Variable'][_0x5579('0x11')][_0x5579('0x3a')]()]&&_0x25cb97['custom_fields']['push']({'id':_0x2ebd41[_0x5579('0x3d')],'value':_0x35d680[_0x2ebd41[_0x5579('0x42')]['name']['toLowerCase']()][_0x5579('0x3c')]()});}});}return _0x25cb97;}exports[_0x5579('0x43')]=function(_0x1d767f,_0x3fc908,_0x5203d3,_0x397148,_0xc1cad6,_0x1d8545){var _0x4a807f,_0x42ff07;_0x1d8545['remoteUri']=intUtil[_0x5579('0x44')](_0x1d8545[_0x5579('0x1a')]);_0x1d8545[_0x5579('0x45')]=intUtil[_0x5579('0x44')](_0x1d8545[_0x5579('0x45')]);if(_0xc1cad6&&_0xc1cad6[_0x5579('0x46')]){logger[_0x5579('0xb')](_0x5579('0x47'),_0x5579('0x48'));_0x3fc908[_0x5579('0x49')]=util[_0x5579('0xd')](_0x5579('0x4a'),_0x1d8545[_0x5579('0x45')],_0x3fc908['uniqueid'],md5(_0x3fc908[_0x5579('0x4b')]));}else{_0x3fc908['recordingURL']='';}headers['Authorization']=getAuth(_0x1d8545);return getUser(_0x1d8545,_0x397148['email'])['then'](function(_0x16754f){_0x4a807f=_0x16754f;logger['info']('The\x20User\x20ID\x20is:',_0x4a807f['id']);return getEndUser(_0x1d8545,_0x3fc908['calleridname'],_0x3fc908[_0x5579('0x4c')]);})[_0x5579('0x16')](function(_0x1e7aed){_0x42ff07=_0x1e7aed;logger[_0x5579('0xb')](_0x5579('0x4d'),_0x42ff07['id']);return getTicket(_0x1d8545,_0x4a807f,_0x42ff07,_0x5203d3,_0x3fc908);})[_0x5579('0x16')](function(_0x5e3d57){if(_0x5e3d57){logger[_0x5579('0xb')](_0x5579('0x4e'),_0x5e3d57['id']);switch(_0x1d8545[_0x5579('0x37')]){case _0x5579('0x4f'):logger[_0x5579('0xb')](_0x5579('0x47'),_0x5579('0x50'));return request({'uri':util[_0x5579('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1d8545[_0x5579('0x1a')],_0x4a807f['id'],_0x5e3d57['id']),'method':_0x5579('0x51')});case'newTab':logger[_0x5579('0xb')](_0x5579('0x47'),_0x5579('0x52'));emit(util[_0x5579('0xd')](_0x5579('0x53'),_0x397148['name']),_0x5579('0x54'),{'uri':util['format'](_0x5579('0x55'),_0x1d8545[_0x5579('0x1a')]['replace'](_0x5579('0x56'),''),_0x5e3d57['id'])});break;default:logger[_0x5579('0x57')](_0x5579('0x47'),_0x5579('0x58'));}}})[_0x5579('0x59')](function(_0x5bd2d3){logger[_0x5579('0x57')](_0x5579('0x5a'),util[_0x5579('0x5b')](_0x5bd2d3,{'showHidden':!![],'depth':null}));});};exports[_0x5579('0x5c')]=function(_0xc4421c,_0x22fc8d,_0x2a3d5a,_0x156494,_0x22d479,_0x214d9e,_0x13452b){var _0x41fd7e,_0x1a880f;_0x214d9e['remoteUri']=intUtil[_0x5579('0x44')](_0x214d9e[_0x5579('0x1a')]);_0x214d9e[_0x5579('0x45')]=intUtil['stripTrailingSlash'](_0x214d9e[_0x5579('0x45')]);if(_0x13452b&&_0x13452b[_0x5579('0x5d')]&&_0x13452b[_0x5579('0x5d')]!=='none'){logger['info'](_0x5579('0x5e'),_0x5579('0x48'));_0x22fc8d[_0x5579('0x49')]=util[_0x5579('0xd')](_0x5579('0x4a'),_0x214d9e[_0x5579('0x45')],_0x22fc8d['uniqueid'],md5(_0x22fc8d[_0x5579('0x4b')]));}headers[_0x5579('0x5f')]=getAuth(_0x214d9e);return getUser(_0x214d9e,_0x156494[_0x5579('0x60')])['then'](function(_0x20b85e){_0x41fd7e=_0x20b85e;logger[_0x5579('0xb')]('The\x20User\x20ID\x20is:',_0x41fd7e['id']);return getEndUser(_0x214d9e,_0x22fc8d[_0x5579('0x61')],_0x22fc8d[_0x5579('0x62')]);})['then'](function(_0x44dd1b){_0x1a880f=_0x44dd1b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1a880f['id']);return getTicket(_0x214d9e,_0x41fd7e,_0x1a880f,_0x2a3d5a,_0x22fc8d);})['then'](function(_0x15dc4c){if(_0x15dc4c){logger[_0x5579('0xb')](_0x5579('0x4e'),_0x15dc4c['id']);switch(_0x214d9e[_0x5579('0x37')]){case _0x5579('0x4f'):logger[_0x5579('0xb')](_0x5579('0x5e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5579('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x214d9e[_0x5579('0x1a')],_0x41fd7e['id'],_0x15dc4c['id']),'method':_0x5579('0x51')});case _0x5579('0x63'):logger['info'](_0x5579('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5579('0xd')](_0x5579('0x53'),_0x156494[_0x5579('0x11')]),_0x5579('0x54'),{'uri':util[_0x5579('0xd')](_0x5579('0x55'),_0x214d9e[_0x5579('0x1a')][_0x5579('0x64')]('/api/v2',''),_0x15dc4c['id'])});break;default:logger[_0x5579('0x57')](_0x5579('0x5e'),_0x5579('0x58'));}}})[_0x5579('0x59')](function(_0x768179){logger[_0x5579('0x57')](_0x5579('0x65'),util['inspect'](_0x768179,{'showHidden':!![],'depth':null}));});};exports[_0x5579('0x66')]=function(_0x8a14b8,_0x31eff4,_0x2f0743,_0x325a6e,_0x583f5d,_0x3135e8){var _0x5db916,_0x435984;_0x3135e8[_0x5579('0x1a')]=intUtil[_0x5579('0x44')](_0x3135e8[_0x5579('0x1a')]);_0x3135e8[_0x5579('0x45')]=intUtil[_0x5579('0x44')](_0x3135e8[_0x5579('0x45')]);if(_0x583f5d&&_0x583f5d[_0x5579('0x46')]){logger[_0x5579('0xb')]('['+_0x31eff4[_0x5579('0x67')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x31eff4[_0x5579('0x49')]=util['format'](_0x5579('0x4a'),_0x3135e8[_0x5579('0x45')],_0x31eff4[_0x5579('0x4b')],md5(_0x31eff4[_0x5579('0x4b')]));}else{_0x31eff4[_0x5579('0x49')]='';}headers[_0x5579('0x5f')]=getAuth(_0x3135e8);return getUser(_0x3135e8)[_0x5579('0x16')](function(_0x450c9c){_0x5db916=_0x450c9c;logger[_0x5579('0xb')](_0x5579('0x68'),_0x5db916['id']);return getEndUser(_0x3135e8,_0x31eff4[_0x5579('0x69')],_0x31eff4[_0x5579('0x4c')]);})[_0x5579('0x16')](function(_0x53cf2e){_0x435984=_0x53cf2e;logger[_0x5579('0xb')](_0x5579('0x4d'),_0x435984['id']);return getTicket(_0x3135e8,_0x5db916,_0x435984,_0x2f0743,_0x31eff4);})[_0x5579('0x16')](function(_0x405b0d){if(_0x405b0d){logger[_0x5579('0xb')]('The\x20Ticket\x20ID\x20is:',_0x405b0d['id']);}})[_0x5579('0x59')](function(_0x54f816){logger[_0x5579('0x57')]('['+_0x31eff4['lastevent']['toUpperCase']()+']'+_0x5579('0x6a'),util[_0x5579('0x5b')](_0x54f816,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x652d=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lodash','request-promise','md5','util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','Subjects','getString','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','content','idField','custom_fields','push','customVariable','Variable','name','toLowerCase','serverUrl','stripTrailingSlash'];(function(_0x4edbc0,_0x537731){var _0x48f3b0=function(_0xe83e37){while(--_0xe83e37){_0x4edbc0['push'](_0x4edbc0['shift']());}};_0x48f3b0(++_0x537731);}(_0x652d,0x1c2));var _0xd652=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x652d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd652('0x0'));var rp=require(_0xd652('0x1'));var md5=require(_0xd652('0x2'));var util=require(_0xd652('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd652('0x4'))(_0xd652('0x5'));config[_0xd652('0x6')]=_[_0xd652('0x7')](config[_0xd652('0x6')],{'host':_0xd652('0x8'),'port':0x18eb});var io=require(_0xd652('0x9'))(new Redis(config['redis']));function emit(_0x414981,_0x46959f,_0x453df6){io['to'](_0x414981)['emit'](_0x46959f,_0x453df6);}var headers={'Content-Type':_0xd652('0xa'),'Accept':_0xd652('0xa')};function getTicket(_0x54d3a6,_0x9adf72,_0x1e65a5,_0x239436,_0x2ead20){logger[_0xd652('0xb')](_0xd652('0xc'));return request({'uri':util[_0xd652('0xd')](_0xd652('0xe'),_0x54d3a6[_0xd652('0xf')]),'method':'POST','body':{'ticket':_[_0xd652('0x10')]({'requester_id':_0x1e65a5['id'],'submitter_id':_0x9adf72?_0x9adf72['id']:undefined,'assignee_id':_0x9adf72?_0x9adf72['id']:undefined,'tags':getTags(_0x239436[_0xd652('0x11')],'name'),'subject':intUtil['getString'](_0x239436[_0xd652('0x12')],_0x2ead20,'\x20'),'description':intUtil[_0xd652('0x13')](_0x239436['Descriptions'],_0x2ead20,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd652('0x13')](_0x239436['Descriptions'],_0x2ead20,'\x0a')}},getCustomFields(_0x239436[_0xd652('0x14')],_0x2ead20))}})[_0xd652('0x15')](function(_0x69d208){logger['info']('Ticket\x20created!');return _0x69d208[_0xd652('0x16')];});}function getUser(_0x1f193a,_0x54d00f){if(intUtil['validateEmail'](_0x54d00f)){logger[_0xd652('0xb')](_0xd652('0x17'),_0x54d00f);return request({'uri':util[_0xd652('0xd')](_0xd652('0x18'),_0x1f193a[_0xd652('0xf')]),'qs':{'query':util[_0xd652('0xd')]('type:user\x20role:agent\x20email:%s',_0x54d00f)}})[_0xd652('0x15')](function(_0x44e695){if(_0x44e695[_0xd652('0x19')]){logger[_0xd652('0xb')](_0xd652('0x1a'));return _['find'](_0x44e695[_0xd652('0x1b')],{'email':_0x54d00f,'role':'agent'});}else{logger[_0xd652('0xb')](_0xd652('0x1c'));return request({'uri':util[_0xd652('0xd')](_0xd652('0x1d'),_0x1f193a['remoteUri'])})[_0xd652('0x15')](function(_0x38ed58){logger[_0xd652('0xb')](_0xd652('0x1e'));return _0x38ed58[_0xd652('0x1f')];});}});}else{logger[_0xd652('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd652('0x1d'),_0x1f193a[_0xd652('0xf')])})[_0xd652('0x15')](function(_0x4d43c4){logger[_0xd652('0xb')]('Admin\x20account\x20selected.');return _0x4d43c4[_0xd652('0x1f')];});}}function getEndUser(_0x234926,_0x26ce78,_0x482756){logger[_0xd652('0xb')](_0xd652('0x20'),_0x482756);return request({'uri':util[_0xd652('0xd')]('%s/search.json',_0x234926[_0xd652('0xf')]),'qs':{'query':util[_0xd652('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x482756)}})[_0xd652('0x15')](function(_0x268b4a){var _0x2dec85;if(_0x268b4a[_0xd652('0x1b')][_0xd652('0x21')]){_0x268b4a[_0xd652('0x1b')]=_[_0xd652('0x22')](_0x268b4a[_0xd652('0x1b')],{'suspended':![],'role':_0xd652('0x23')});if(_0x268b4a[_0xd652('0x1b')][_0xd652('0x21')]){_0x2dec85=_[_0xd652('0x24')](_0x268b4a[_0xd652('0x1b')]);}}if(_0x2dec85){logger[_0xd652('0xb')](_0xd652('0x25'));return _0x2dec85;}else{logger['info'](_0xd652('0x26'));return request({'uri':util['format']('%s/users.json',_0x234926[_0xd652('0xf')]),'method':_0xd652('0x27'),'body':{'user':{'role':'end-user','name':util[_0xd652('0xd')](_0xd652('0x28'),_0x26ce78||_0x482756),'phone':_0x482756}}})[_0xd652('0x15')](function(_0x3fb75f){logger[_0xd652('0xb')](_0xd652('0x29'));return _0x3fb75f[_0xd652('0x1f')];});}});}function getAuth(_0x2141ad){var _0x53ed42;if(_0x2141ad[_0xd652('0x2a')]===_0xd652('0x2b')){_0x53ed42=util['format']('%s:%s',_0x2141ad[_0xd652('0x2c')],_0x2141ad[_0xd652('0x2b')]);}else if(_0x2141ad['authType']===_0xd652('0x2d')){_0x53ed42=util[_0xd652('0xd')](_0xd652('0x2e'),_0x2141ad[_0xd652('0x2c')],_0x2141ad[_0xd652('0x2d')]);}return util[_0xd652('0xd')](_0xd652('0x2f'),new Buffer(_0x53ed42)[_0xd652('0x30')](_0xd652('0x31')));}function request(_0x49dcce){logger[_0xd652('0x32')](_0xd652('0x33'),JSON[_0xd652('0x34')](_0x49dcce));return rp(_['defaults'](_0x49dcce,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x580fc9,_0x306ba8){var _0x4c48a6=[];if(_0x580fc9&&_0x580fc9[_0xd652('0x21')]>0x0){_0x4c48a6=_[_0xd652('0x35')](_0x580fc9,_0x306ba8);}return _0x4c48a6;}function getCustomFields(_0x79065e,_0xde1d36){var _0x5ca540=[];var _0x2fa8ab={'custom_fields':[]};if(_0x79065e[_0xd652('0x21')]>0x0){_[_0xd652('0x36')](_0x79065e,function(_0x1923b5){if(_['includes']([_0xd652('0x37'),_0xd652('0x38')],_0x1923b5[_0xd652('0x39')])&&_0x1923b5[_0xd652('0x3a')]&&!_0x1923b5[_0xd652('0x3b')]){_0x2fa8ab[_0x1923b5[_0xd652('0x3a')]['toLowerCase']()]=_0x1923b5[_0xd652('0x3c')][_0xd652('0x30')]();}else if(_['includes'](['string',_0xd652('0x38')],_0x1923b5['type'])&&_0x1923b5[_0xd652('0x3d')]&&_0x1923b5[_0xd652('0x3b')]){_0x2fa8ab[_0xd652('0x3e')][_0xd652('0x3f')]({'id':_0x1923b5['idField'],'value':_0x1923b5[_0xd652('0x3c')]['toString']()});}else if(_0x1923b5[_0xd652('0x39')]==='variable'&&_0x1923b5['variableName']&&_0x1923b5[_0xd652('0x3d')]&&_0x1923b5[_0xd652('0x3b')]){_0xde1d36[_0x1923b5['variableName']]&&_0x2fa8ab[_0xd652('0x3e')][_0xd652('0x3f')]({'id':_0x1923b5[_0xd652('0x3d')],'value':_0xde1d36[_0x1923b5['variableName']][_0xd652('0x30')]()});}else if(_0x1923b5[_0xd652('0x39')]===_0xd652('0x40')&&_0x1923b5['Variable']&&_0x1923b5[_0xd652('0x41')][_0xd652('0x42')]&&_0x1923b5[_0xd652('0x3d')]&&_0x1923b5[_0xd652('0x3b')]){_0xde1d36[_0x1923b5[_0xd652('0x41')][_0xd652('0x42')][_0xd652('0x43')]()]&&_0x2fa8ab[_0xd652('0x3e')][_0xd652('0x3f')]({'id':_0x1923b5[_0xd652('0x3d')],'value':_0xde1d36[_0x1923b5['Variable'][_0xd652('0x42')][_0xd652('0x43')]()][_0xd652('0x30')]()});}});}return _0x2fa8ab;}exports['queue']=function(_0x4c5f55,_0x3af8ea,_0x4dafe7,_0x110abe,_0x5e27f0,_0x524ca2){var _0x5c4a93,_0x4cec43;_0x524ca2[_0xd652('0xf')]=intUtil['stripTrailingSlash'](_0x524ca2['remoteUri']);_0x524ca2[_0xd652('0x44')]=intUtil[_0xd652('0x45')](_0x524ca2[_0xd652('0x44')]);if(_0x5e27f0&&_0x5e27f0['monitor_format']){logger[_0xd652('0xb')](_0xd652('0x46'),_0xd652('0x47'));_0x3af8ea[_0xd652('0x48')]=util[_0xd652('0xd')](_0xd652('0x49'),_0x524ca2[_0xd652('0x44')],_0x3af8ea[_0xd652('0x4a')],md5(_0x3af8ea['uniqueid']));}else{_0x3af8ea['recordingURL']='';}headers['Authorization']=getAuth(_0x524ca2);return getUser(_0x524ca2,_0x110abe[_0xd652('0x4b')])[_0xd652('0x15')](function(_0x22125a){_0x5c4a93=_0x22125a;logger[_0xd652('0xb')](_0xd652('0x4c'),_0x5c4a93['id']);return getEndUser(_0x524ca2,_0x3af8ea[_0xd652('0x4d')],_0x3af8ea['calleridnum']);})[_0xd652('0x15')](function(_0x502b72){_0x4cec43=_0x502b72;logger[_0xd652('0xb')](_0xd652('0x4e'),_0x4cec43['id']);return getTicket(_0x524ca2,_0x5c4a93,_0x4cec43,_0x4dafe7,_0x3af8ea);})[_0xd652('0x15')](function(_0x2f242f){if(_0x2f242f){logger[_0xd652('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2f242f['id']);switch(_0x524ca2['type']){case'integrationTab':logger[_0xd652('0xb')](_0xd652('0x46'),_0xd652('0x4f'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x524ca2[_0xd652('0xf')],_0x5c4a93['id'],_0x2f242f['id']),'method':_0xd652('0x27')});case _0xd652('0x50'):logger[_0xd652('0xb')]('[QUEUE]',_0xd652('0x51'));emit(util[_0xd652('0xd')](_0xd652('0x52'),_0x110abe[_0xd652('0x42')]),_0xd652('0x53'),{'uri':util[_0xd652('0xd')](_0xd652('0x54'),_0x524ca2[_0xd652('0xf')]['replace'](_0xd652('0x55'),''),_0x2f242f['id'])});break;default:logger[_0xd652('0x56')](_0xd652('0x46'),_0xd652('0x57'));}}})[_0xd652('0x58')](function(_0x3d69d7){logger[_0xd652('0x56')](_0xd652('0x59'),util['inspect'](_0x3d69d7,{'showHidden':!![],'depth':null}));});};exports[_0xd652('0x5a')]=function(_0x1d7ecb,_0x140cdd,_0x3c4b74,_0xc71f6f,_0x4284a5,_0x3b5ab6,_0x2ce88b){var _0x561477,_0xb84f7a;_0x3b5ab6[_0xd652('0xf')]=intUtil[_0xd652('0x45')](_0x3b5ab6[_0xd652('0xf')]);_0x3b5ab6['serverUrl']=intUtil[_0xd652('0x45')](_0x3b5ab6[_0xd652('0x44')]);if(_0x2ce88b&&_0x2ce88b[_0xd652('0x5b')]&&_0x2ce88b[_0xd652('0x5b')]!==_0xd652('0x5c')){logger['info']('[OUTBOUND]',_0xd652('0x47'));_0x140cdd[_0xd652('0x48')]=util[_0xd652('0xd')](_0xd652('0x49'),_0x3b5ab6[_0xd652('0x44')],_0x140cdd[_0xd652('0x4a')],md5(_0x140cdd[_0xd652('0x4a')]));}headers[_0xd652('0x5d')]=getAuth(_0x3b5ab6);return getUser(_0x3b5ab6,_0xc71f6f[_0xd652('0x4b')])[_0xd652('0x15')](function(_0x477b0f){_0x561477=_0x477b0f;logger[_0xd652('0xb')](_0xd652('0x4c'),_0x561477['id']);return getEndUser(_0x3b5ab6,_0x140cdd['destcalleridname'],_0x140cdd[_0xd652('0x5e')]);})[_0xd652('0x15')](function(_0x2a2550){_0xb84f7a=_0x2a2550;logger['info']('The\x20Enduser\x20ID\x20is:',_0xb84f7a['id']);return getTicket(_0x3b5ab6,_0x561477,_0xb84f7a,_0x3c4b74,_0x140cdd);})[_0xd652('0x15')](function(_0x6d23c2){if(_0x6d23c2){logger[_0xd652('0xb')](_0xd652('0x5f'),_0x6d23c2['id']);switch(_0x3b5ab6[_0xd652('0x39')]){case _0xd652('0x60'):logger[_0xd652('0xb')](_0xd652('0x61'),_0xd652('0x4f'));return request({'uri':util['format'](_0xd652('0x62'),_0x3b5ab6[_0xd652('0xf')],_0x561477['id'],_0x6d23c2['id']),'method':_0xd652('0x27')});case _0xd652('0x50'):logger[_0xd652('0xb')](_0xd652('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd652('0xd')]('user:%s',_0xc71f6f[_0xd652('0x42')]),'trigger:browser:url',{'uri':util[_0xd652('0xd')]('%s/agent/tickets/%s',_0x3b5ab6['remoteUri'][_0xd652('0x63')]('/api/v2',''),_0x6d23c2['id'])});break;default:logger['error'](_0xd652('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd652('0x58')](function(_0xb780e2){logger[_0xd652('0x56')](_0xd652('0x64'),util[_0xd652('0x65')](_0xb780e2,{'showHidden':!![],'depth':null}));});};exports[_0xd652('0x66')]=function(_0x22b8dd,_0x462d3a,_0x1d37e1,_0x41c0e2,_0x23b276,_0x2fb7ad){var _0x6afc30,_0xc7b6d4;_0x2fb7ad[_0xd652('0xf')]=intUtil['stripTrailingSlash'](_0x2fb7ad['remoteUri']);_0x2fb7ad['serverUrl']=intUtil[_0xd652('0x45')](_0x2fb7ad[_0xd652('0x44')]);if(_0x23b276&&_0x23b276['monitor_format']){logger[_0xd652('0xb')]('['+_0x462d3a['lastevent'][_0xd652('0x67')]()+']',_0xd652('0x47'));_0x462d3a[_0xd652('0x48')]=util['format'](_0xd652('0x49'),_0x2fb7ad['serverUrl'],_0x462d3a[_0xd652('0x4a')],md5(_0x462d3a[_0xd652('0x4a')]));}else{_0x462d3a[_0xd652('0x48')]='';}headers['Authorization']=getAuth(_0x2fb7ad);return getUser(_0x2fb7ad)[_0xd652('0x15')](function(_0xbe64b4){_0x6afc30=_0xbe64b4;logger[_0xd652('0xb')](_0xd652('0x4c'),_0x6afc30['id']);return getEndUser(_0x2fb7ad,_0x462d3a[_0xd652('0x4d')],_0x462d3a['calleridnum']);})['then'](function(_0x21e934){_0xc7b6d4=_0x21e934;logger[_0xd652('0xb')](_0xd652('0x4e'),_0xc7b6d4['id']);return getTicket(_0x2fb7ad,_0x6afc30,_0xc7b6d4,_0x1d37e1,_0x462d3a);})['then'](function(_0x141eea){if(_0x141eea){logger['info'](_0xd652('0x5f'),_0x141eea['id']);}})[_0xd652('0x58')](function(_0x59b715){logger[_0xd652('0x56')]('['+_0x462d3a['lastevent'][_0xd652('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x59b715,{'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 17e1792..29dc52b 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 _0xe563=['[HTTP]','length','forEach','includes','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','catch','https://www.zohoapis.','moduleCreate','first_name','last_name','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','role','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Call\x20ID\x20is:','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug'];(function(_0x1ac512,_0x56db90){var _0x51fcca=function(_0x50c3b0){while(--_0x50c3b0){_0x1ac512['push'](_0x1ac512['shift']());}};_0x51fcca(++_0x56db90);}(_0xe563,0x125));var _0x3e56=function(_0x374704,_0x3d1eb9){_0x374704=_0x374704-0x0;var _0x2b2d20=_0xe563[_0x374704];return _0x2b2d20;};'use strict';var _=require(_0x3e56('0x0'));var rp=require(_0x3e56('0x1'));var md5=require(_0x3e56('0x2'));var util=require(_0x3e56('0x3'));var intUtil=require(_0x3e56('0x4'));var moment=require(_0x3e56('0x5'));var Redis=require(_0x3e56('0x6'));var BPromise=require(_0x3e56('0x7'));var config=require(_0x3e56('0x8'));var logger=require(_0x3e56('0x9'))('zoho');config[_0x3e56('0xa')]=_['defaults'](config[_0x3e56('0xa')],{'host':_0x3e56('0xb'),'port':0x18eb});var io=require(_0x3e56('0xc'))(new Redis(config[_0x3e56('0xa')]));function emit(_0x38c87c,_0x125210,_0x48a4af){io['to'](_0x38c87c)[_0x3e56('0xd')](_0x125210,_0x48a4af);}function request(_0x1569e2){logger[_0x3e56('0xe')](_0x3e56('0xf'),JSON['stringify'](_0x1569e2));return rp(_0x1569e2);}function getCustomFields(_0x3d5dfc,_0x43d0c1){var _0x3f3c0c={};if(_0x3d5dfc[_0x3e56('0x10')]>0x0){_[_0x3e56('0x11')](_0x3d5dfc,function(_0x3b7792){if(_[_0x3e56('0x12')]([_0x3e56('0x13'),_0x3e56('0x14')],_0x3b7792[_0x3e56('0x15')])&&_0x3b7792[_0x3e56('0x16')]){_0x3f3c0c[_0x3b7792[_0x3e56('0x16')]]=_0x3b7792['content'][_0x3e56('0x17')]();}else if(_0x3b7792[_0x3e56('0x15')]==='variable'&&_0x3b7792[_0x3e56('0x18')]&&_0x3b7792[_0x3e56('0x16')]&&_0x43d0c1[_0x3b7792[_0x3e56('0x18')]]){_0x3f3c0c[_0x3b7792[_0x3e56('0x16')]]=_0x43d0c1[_0x3b7792[_0x3e56('0x18')]][_0x3e56('0x17')]();}else if(_0x3b7792[_0x3e56('0x15')]===_0x3e56('0x19')&&_0x3b7792['Variable']&&_0x3b7792[_0x3e56('0x1a')][_0x3e56('0x1b')]&&_0x3b7792['idField']&&_0x43d0c1[_0x3b7792[_0x3e56('0x1a')][_0x3e56('0x1b')]['toLowerCase']()]){_0x3f3c0c[_0x3b7792[_0x3e56('0x16')]]=_0x43d0c1[_0x3b7792[_0x3e56('0x1a')]['name'][_0x3e56('0x1c')]()][_0x3e56('0x17')]();}});}return _0x3f3c0c;}function getName(_0x3fefe7){if(_0x3fefe7[_0x3e56('0x1d')]('\x20')>0x0){var _0x15fe0c=_0x3fefe7[_0x3e56('0x1e')](/ (.+)/);if(_0x15fe0c[0x1]){return _0x15fe0c;}}return[_0x3fefe7,_0x3fefe7];}var accountsTokens={};function getAccessToken(_0x1d2ec7){return new Promise(function(_0x5cdf29,_0x59f9f1){if(!_[_0x3e56('0x1f')](accountsTokens[_0x1d2ec7['id']])&&!_[_0x3e56('0x1f')](accountsTokens[_0x1d2ec7['id']][_0x3e56('0x20')])){if(moment()['isBefore'](accountsTokens[_0x1d2ec7['id']][_0x3e56('0x21')])){_0x5cdf29(accountsTokens[_0x1d2ec7['id']]['access_token']);}}var _0x6022ff;switch(_0x1d2ec7[_0x3e56('0x22')]){case'US':_0x6022ff=_0x3e56('0x23');break;case'AU':_0x6022ff=_0x3e56('0x24');break;case'EU':_0x6022ff=_0x3e56('0x25');break;case'IN':_0x6022ff='https://accounts.zoho.in';break;case'CN':_0x6022ff=_0x3e56('0x26');break;default:_0x6022ff=_0x3e56('0x25');break;}var _0x1f99a3={'method':_0x3e56('0x27'),'uri':_0x6022ff+_0x3e56('0x28'),'qs':{'refresh_token':_0x1d2ec7[_0x3e56('0x29')],'client_id':_0x1d2ec7[_0x3e56('0x2a')],'client_secret':_0x1d2ec7[_0x3e56('0x2b')],'grant_type':_0x3e56('0x2c')},'json':!![]};return rp(_0x1f99a3)[_0x3e56('0x2d')](function(_0x51ff4d){accountsTokens[_0x1d2ec7['id']]={'access_token':_0x51ff4d['access_token'],'expires_in':moment()[_0x3e56('0x2e')](_0x51ff4d[_0x3e56('0x21')],'seconds')};_0x5cdf29(_0x51ff4d[_0x3e56('0x20')]);})['catch'](function(_0x1185e1){logger[_0x3e56('0x2f')](_0x3e56('0x30'),_0x1185e1[_0x3e56('0x31')]);_0x59f9f1(_0x1185e1);});});}function getUser(_0xe7781a,_0x1dd9f1,_0x47ec0d,_0x2c7d08){logger[_0x3e56('0x32')](_0x3e56('0x33'));return request({'method':'GET','uri':util[_0x3e56('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x1dd9f1),'qs':{'type':_0x3e56('0x35')},'headers':{'Authorization':_0x3e56('0x36')+_0xe7781a},'json':!![]})[_0x3e56('0x2d')](function(_0x193787){if(_0x193787[_0x3e56('0x37')]){var _0xc349f1=-0x1;if(_['isArrayLikeObject'](_0x193787['users'])){if(!_['isNil'](_0x2c7d08)){_0xc349f1=_[_0x3e56('0x38')](_0x193787[_0x3e56('0x37')],function(_0x22b1ef){return _0x22b1ef[_0x3e56('0x39')]===_0x2c7d08;});}if(_0xc349f1>=0x0){logger['info'](_0x3e56('0x3a'));}else{logger[_0x3e56('0x32')](_0x3e56('0x3b'));_0xc349f1=_[_0x3e56('0x38')](_0x193787['users'],function(_0x1b25c7){return _0x1b25c7[_0x3e56('0x3c')][_0x3e56('0x1b')]===_0x3e56('0x3d');});}return _0x193787['users'][_0xc349f1];}else{if(_0x193787[_0x3e56('0x3e')][_0x3e56('0x3c')][_0x3e56('0x1b')]===_0x3e56('0x3d')){logger[_0x3e56('0x32')](_0x3e56('0x3b'));user=_0x193787['user'];return user;}else{logger[_0x3e56('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x3e56('0x3f')](_0x193787));throw new Error(_0x3e56('0x40')+JSON[_0x3e56('0x3f')](_0x193787));}}}else{logger[_0x3e56('0x2f')](_0x3e56('0x41'),JSON[_0x3e56('0x3f')](_0x193787));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3e56('0x3f')](_0x193787));}})['catch'](function(_0x394905){console[_0x3e56('0x2f')](_0x394905);});}function getZohoUser(_0xed259,_0x1e28b7){return new BPromise(function(_0x2b19e2,_0x22af94){request(_0xed259)[_0x3e56('0x2d')](function(_0x19e7d2){var _0x51d207=null;if(_0x19e7d2){_0x51d207=_0x19e7d2[_0x3e56('0x42')][0x0];_0x51d207[_0x3e56('0x43')]=_0x1e28b7;}_0x2b19e2(_0x51d207);})[_0x3e56('0x44')](function(_0x55ee4e){_0x22af94(_0x55ee4e);});});}function createEndUser(_0x47beff,_0x14ead9,_0x567eb2,_0x470b73,_0x3a7516,_0x21f3dc){var _0x567eb2=getName(_0x567eb2);return request({'method':_0x3e56('0x27'),'uri':_0x3e56('0x45')+_0x14ead9+'/crm/v2/'+_['startCase'](_0x21f3dc[_0x3e56('0x46')])+'s','body':{'data':[{'Last_Name':_0x567eb2[0x1],'First_Name':_0x567eb2[0x0],'Phone':_0x470b73,'Owner':{'name':!_[_0x3e56('0x1f')](_0x3a7516['role'][_0x3e56('0x1b')])?_0x3a7516['role']['name']:!_[_0x3e56('0x1f')](_0x3a7516[_0x3e56('0x47')])?_0x3a7516[_0x3e56('0x47')]+'\x20'+_0x3a7516[_0x3e56('0x48')]:_0x3a7516['last_name'],'id':_0x3a7516['id']}}]},'headers':{'Authorization':_0x3e56('0x36')+_0x47beff},'json':!![]})[_0x3e56('0x2d')](function(_0x50cef1){if(_0x50cef1&&_0x50cef1[_0x3e56('0x42')][0x0]['code']===_0x3e56('0x49')){var _0x3e777b=_0x50cef1['data'][0x0][_0x3e56('0x4a')];_0x3e777b['enduserType']=_[_0x3e56('0x4b')](_0x21f3dc[_0x3e56('0x46')])+'s';return _0x3e777b;}logger['error'](_0x3e56('0x41'),JSON[_0x3e56('0x3f')](data));throw new Error(_0x3e56('0x4c')+JSON[_0x3e56('0x3f')](data));})[_0x3e56('0x44')](function(_0x320711){console[_0x3e56('0x4d')](_0x3e56('0x4e'),_0x320711);});}function getEndUser(_0x5539e1,_0x465bf4,_0x287e00,_0x88e8e6,_0x3d5b3e,_0x3682ca,_0x1b7182){var _0x55e5ae={'method':_0x3e56('0x4f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5539e1},'json':!![]};switch(_0x1b7182[_0x3e56('0x50')]){case'contact_lead':_0x55e5ae[_0x3e56('0x51')]=_0x3e56('0x45')+_0x465bf4+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3d5b3e+'))';return getZohoUser(_0x55e5ae,_0x3e56('0x52'))['then'](function(_0x383358){if(_0x383358)return _0x383358;_0x55e5ae[_0x3e56('0x51')]='https://www.zohoapis.'+_0x465bf4+_0x3e56('0x53')+_0x3d5b3e+'))';return getZohoUser(_0x55e5ae,'Leads')[_0x3e56('0x2d')](function(_0x5dafc1){if(_0x5dafc1)return _0x5dafc1;if(_0x1b7182[_0x3e56('0x46')]!='nothing'){return createEndUser(_0x5539e1,_0x465bf4,_0x88e8e6,_0x3d5b3e,_0x3682ca,_0x1b7182);}else{return{};}});});break;case'contact':_0x55e5ae['uri']='https://www.zohoapis.'+_0x465bf4+_0x3e56('0x54')+_0x3d5b3e+'))';return getZohoUser(_0x55e5ae,'Contacts')[_0x3e56('0x2d')](function(_0x4f833b){if(_0x4f833b)return _0x4f833b;if(_0x1b7182[_0x3e56('0x46')]!=_0x3e56('0x55')){return createEndUser(_0x5539e1,_0x465bf4,_0x88e8e6,_0x3d5b3e,_0x3682ca,_0x1b7182);}else{return{};}});break;case'lead':_0x55e5ae[_0x3e56('0x51')]=_0x3e56('0x45')+_0x465bf4+_0x3e56('0x53')+_0x3d5b3e+'))';return getZohoUser(_0x55e5ae,'Leads')[_0x3e56('0x2d')](function(_0x391194){if(_0x391194)return _0x391194;if(_0x1b7182['moduleCreate']!='nothing'){return createEndUser(_0x5539e1,_0x465bf4,_0x88e8e6,_0x3d5b3e,_0x3682ca,_0x1b7182);}else{return{};}});break;}}function getCall(_0x221c79,_0x76a39e,_0xeaa4e8,_0x31e3a1,_0x504fb8,_0x457761,_0x2eb7df,_0x378260){logger[_0x3e56('0x32')](_0x3e56('0x56'));var _0x59fd81={};_0x59fd81[_0x3e56('0x57')]={'name':!_[_0x3e56('0x1f')](_0x31e3a1[_0x3e56('0x58')][_0x3e56('0x1b')])&&!_['isNil'](_0x31e3a1['profile'][_0x3e56('0x1b')])&&_0x31e3a1['profile']['name']==='administrator'?_0x31e3a1['role'][_0x3e56('0x1b')]:!_[_0x3e56('0x1f')](_0x31e3a1[_0x3e56('0x47')])?_0x31e3a1[_0x3e56('0x47')]+'\x20'+_0x31e3a1[_0x3e56('0x48')]:_0x31e3a1[_0x3e56('0x48')],'id':_0x31e3a1['id']};_0x59fd81[_0x3e56('0x59')]=intUtil[_0x3e56('0x5a')](_0x457761[_0x3e56('0x5b')],_0x2eb7df,'\x20');_0x59fd81[_0x3e56('0x5c')]=intUtil[_0x3e56('0x5a')](_0x457761[_0x3e56('0x5d')],_0x2eb7df,'\x0a');if(_0x504fb8['enduserType']===_0x3e56('0x52')){_0x59fd81[_0x3e56('0x5e')]={'name':!_[_0x3e56('0x1f')](_0x504fb8[_0x3e56('0x5f')])?_0x504fb8[_0x3e56('0x5f')]:!_['isNil'](_0x504fb8[_0x3e56('0x60')])?_0x504fb8['First_Name']+'\x20'+_0x504fb8['Last_Name']:_0x504fb8[_0x3e56('0x61')],'id':_0x504fb8['id']};}if(_0x504fb8[_0x3e56('0x43')]==='Leads'){_0x59fd81[_0x3e56('0x62')]={'name':!_[_0x3e56('0x1f')](_0x504fb8[_0x3e56('0x5f')])?_0x504fb8[_0x3e56('0x5f')]:!_['isNil'](_0x504fb8[_0x3e56('0x60')])?_0x504fb8[_0x3e56('0x60')]+'\x20'+_0x504fb8[_0x3e56('0x61')]:_0x504fb8[_0x3e56('0x61')],'id':_0x504fb8['id']};_0x59fd81[_0x3e56('0x63')]=_['startCase'](_0x504fb8[_0x3e56('0x43')]);}if(_0x2eb7df[_0x3e56('0x64')]){_0x59fd81['Call_Duration']=moment[_0x3e56('0x65')](parseInt(_0x2eb7df['talktime'])*0x3e8)[_0x3e56('0x34')](_0x3e56('0x66'));}else if(_0x2eb7df[_0x3e56('0x67')]&&_0x2eb7df[_0x3e56('0x68')]){_0x59fd81[_0x3e56('0x69')]=moment['utc'](moment(_0x2eb7df[_0x3e56('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x3e56('0x6a')](moment(_0x2eb7df[_0x3e56('0x6b')],_0x3e56('0x6c'))))[_0x3e56('0x34')](_0x3e56('0x66'));}switch(_0x2eb7df[_0x3e56('0x6d')]){case _0x3e56('0x6e'):_0x59fd81[_0x3e56('0x6f')]=_0x3e56('0x70');break;case _0x3e56('0x71'):case'connect':_0x59fd81['Call_Result']=_0x3e56('0x72');break;case _0x3e56('0x73'):_0x59fd81[_0x3e56('0x6f')]=_0x3e56('0x74');break;case'abandoned':_0x59fd81[_0x3e56('0x6f')]=_0x3e56('0x75');break;case _0x3e56('0x76'):_0x59fd81[_0x3e56('0x6f')]='Timeout';default:}_0x59fd81['Call_Start_Time']=(_0x378260===_0x3e56('0x77')?moment(_0x2eb7df[_0x3e56('0x6b')])[_0x3e56('0x34')](_0x3e56('0x6c')):moment(_0x2eb7df[_0x3e56('0x78')])[_0x3e56('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3e56('0x34')](_0x3e56('0x6c'));_0x59fd81[_0x3e56('0x79')]=_0x378260||_0x3e56('0x7a');_0x59fd81=_[_0x3e56('0x7b')](_0x59fd81,getCustomFields(_0x457761['Fields'],_0x2eb7df));return request({'method':_0x3e56('0x27'),'uri':_0x3e56('0x45')+_0x76a39e+_0x3e56('0x7c'),'headers':{'Authorization':_0x3e56('0x36')+_0x221c79},'body':{'data':[_0x59fd81]},'json':!![]})[_0x3e56('0x2d')](function(_0x2a9755){if(_0x2a9755&&_0x2a9755[_0x3e56('0x42')][0x0][_0x3e56('0x7d')]==='SUCCESS'){logger['info'](_0x3e56('0x7e'));return{'id':_0x2a9755[_0x3e56('0x42')][0x0][_0x3e56('0x4a')]['id']};}})[_0x3e56('0x44')](function(_0x1ed09c){logger[_0x3e56('0x32')]('err',_0x1ed09c['stack']);console[_0x3e56('0x4d')]('err',_0x1ed09c);});}exports[_0x3e56('0x7f')]=function(_0xc6101,_0x43b11a,_0x30d96f,_0x549105,_0x1ab8c7,_0x2e32df){var _0x107727,_0x38426c,_0x425c26;_0x2e32df[_0x3e56('0x80')]=intUtil[_0x3e56('0x81')](_0x2e32df[_0x3e56('0x80')]);_0x2e32df['serverUrl']=intUtil[_0x3e56('0x81')](_0x2e32df[_0x3e56('0x82')]);if(_0x1ab8c7&&_0x1ab8c7[_0x3e56('0x83')]){logger['info'](_0x3e56('0x84'),_0x3e56('0x85'));_0x43b11a[_0x3e56('0x86')]=_0x2e32df['serverUrl']+_0x3e56('0x87')+_0x43b11a[_0x3e56('0x88')]+_0x3e56('0x89')+md5(_0x43b11a[_0x3e56('0x88')]);}else{_0x43b11a[_0x3e56('0x86')]='';}var _0x31d8ee=_0x2e32df[_0x3e56('0x80')]===_0x3e56('0x8a')?'eu':_0x3e56('0x8b');return getAccessToken(_0x2e32df)[_0x3e56('0x2d')](function(_0x478040){_0x425c26=_0x478040;return getUser(_0x425c26,_0x31d8ee,_0x2e32df,_0x549105['email']);})[_0x3e56('0x2d')](function(_0x7657d5){_0x107727=_0x7657d5;logger[_0x3e56('0x32')](_0x3e56('0x8c'),_0x107727['id']);return getEndUser(_0x425c26,_0x31d8ee,_0x2e32df,_0x43b11a['calleridname'],_0x43b11a[_0x3e56('0x8d')],_0x107727,_0x30d96f);})[_0x3e56('0x2d')](function(_0x315135){_0x38426c=_0x315135;return getCall(_0x425c26,_0x31d8ee,_0x2e32df,_0x107727,_0x38426c,_0x30d96f,_0x43b11a,_0x3e56('0x7a'));})['then'](function(_0xd695a7){if(_0xd695a7){logger[_0x3e56('0x32')]('The\x20Call\x20ID\x20is:',_0xd695a7['id']);logger['info'](_0x3e56('0x84'),_0x3e56('0x8e'));emit(util[_0x3e56('0x34')](_0x3e56('0x8f'),_0x549105['name']),_0x3e56('0x90'),{'uri':'https://crm.'+_0x2e32df[_0x3e56('0x80')]+_0x3e56('0x91')+_0xd695a7['id']});}})['catch'](function(_0xc02bdc){logger['error'](_0x3e56('0x84'),JSON[_0x3e56('0x3f')](_0xc02bdc));});};exports[_0x3e56('0x77')]=function(_0x5425a3,_0x2a08c,_0x8008f0,_0x2536ba,_0x95cfe,_0x546f1f,_0x3e0edc){var _0x4ca396,_0x18fdb0,_0x1879a8;_0x546f1f['host']=intUtil['stripTrailingSlash'](_0x546f1f[_0x3e56('0x80')]);_0x546f1f[_0x3e56('0x82')]=intUtil[_0x3e56('0x81')](_0x546f1f[_0x3e56('0x82')]);if(_0x3e0edc&&_0x3e0edc[_0x3e56('0x92')]&&_0x3e0edc['recordingFormat']!==_0x3e56('0x93')){logger['info'](_0x3e56('0x94'),_0x3e56('0x85'));_0x2a08c[_0x3e56('0x86')]=_0x546f1f[_0x3e56('0x82')]+_0x3e56('0x87')+_0x2a08c[_0x3e56('0x88')]+_0x3e56('0x89')+md5(_0x2a08c[_0x3e56('0x88')]);}var _0x348ae2=_0x546f1f[_0x3e56('0x80')]===_0x3e56('0x8a')?'eu':_0x3e56('0x8b');return getAccessToken(_0x546f1f)[_0x3e56('0x2d')](function(_0x4846a9){_0x1879a8=_0x4846a9;return getUser(_0x1879a8,_0x348ae2,_0x546f1f,_0x2536ba[_0x3e56('0x39')]);})[_0x3e56('0x2d')](function(_0x17e920){_0x4ca396=_0x17e920;logger[_0x3e56('0x32')](_0x3e56('0x8c'),_0x4ca396['id']);return getEndUser(_0x1879a8,_0x348ae2,_0x546f1f,_0x2a08c[_0x3e56('0x95')],_0x2a08c['destcalleridnum'],_0x4ca396,_0x8008f0);})['then'](function(_0x3beab4){_0x18fdb0=_0x3beab4;return getCall(_0x1879a8,_0x348ae2,_0x546f1f,_0x4ca396,_0x18fdb0,_0x8008f0,_0x2a08c,'Outbound');})[_0x3e56('0x2d')](function(_0x40c35b){if(_0x40c35b){logger[_0x3e56('0x32')](_0x3e56('0x96'),_0x40c35b['id']);logger[_0x3e56('0x32')](_0x3e56('0x94'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3e56('0x34')]('user:%s',_0x2536ba[_0x3e56('0x1b')]),_0x3e56('0x90'),{'uri':_0x3e56('0x97')+_0x546f1f[_0x3e56('0x80')]+_0x3e56('0x91')+_0x40c35b['id']});}})[_0x3e56('0x44')](function(_0x29bfb3){logger[_0x3e56('0x2f')]('[OUTBOUND]',JSON[_0x3e56('0x3f')](_0x29bfb3));});};exports[_0x3e56('0x98')]=function(_0x4d05ea,_0x5834db,_0x87d58d,_0xfc6048,_0x144fdc,_0x5f3817){var _0x1b9c3e,_0x374d71,_0x251b29;_0x5f3817['host']=intUtil[_0x3e56('0x81')](_0x5f3817[_0x3e56('0x80')]);_0x5f3817[_0x3e56('0x82')]=intUtil['stripTrailingSlash'](_0x5f3817[_0x3e56('0x82')]);if(_0x144fdc&&_0x144fdc[_0x3e56('0x83')]){logger[_0x3e56('0x32')]('['+_0x5834db['lastevent'][_0x3e56('0x99')]()+']',_0x3e56('0x85'));_0x5834db[_0x3e56('0x86')]=_0x5f3817[_0x3e56('0x82')]+'/api/voice/recordings/'+_0x5834db['uniqueid']+_0x3e56('0x89')+md5(_0x5834db[_0x3e56('0x88')]);}else{_0x5834db[_0x3e56('0x86')]='';}var _0x45144e=_0x5f3817[_0x3e56('0x80')]==='zoho.eu'?'eu':_0x3e56('0x8b');return getAccessToken(_0x5f3817)[_0x3e56('0x2d')](function(_0x545140){_0x251b29=_0x545140;return getUser(_0x251b29,_0x45144e,_0x5f3817);})[_0x3e56('0x2d')](function(_0x356946){_0x1b9c3e=_0x356946;logger[_0x3e56('0x32')](_0x3e56('0x8c'),_0x1b9c3e['id']);return getEndUser(_0x251b29,_0x45144e,_0x5f3817,_0x5834db['calleridname'],_0x5834db[_0x3e56('0x8d')],_0x1b9c3e,_0x87d58d);})['then'](function(_0x3cdd81){_0x374d71=_0x3cdd81;return getCall(_0x251b29,_0x45144e,_0x5f3817,_0x1b9c3e,_0x374d71,_0x87d58d,_0x5834db,_0x3e56('0x7a'));})['then'](function(_0x4d656e){if(_0x4d656e){logger[_0x3e56('0x32')]('The\x20Call\x20ID\x20is:',_0x4d656e['id']);}})[_0x3e56('0x44')](function(_0x21f301){logger[_0x3e56('0x2f')]('['+_0x5834db['lastevent'][_0x3e56('0x99')]()+']',JSON[_0x3e56('0x3f')](_0x21f301));});}; \ No newline at end of file +var _0x0751=['Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','mm:ss','Call_Duration','endtime','diff','starttime','Called','connect','Call_Result','Answered','rejected','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','com','calleridname','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','length','forEach','includes','string','picklist','idField','type','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','email','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','role','first_name','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','last_name','getString','Subjects','Description','Descriptions'];(function(_0x385a7c,_0x33d1ca){var _0x498819=function(_0x503b69){while(--_0x503b69){_0x385a7c['push'](_0x385a7c['shift']());}};_0x498819(++_0x33d1ca);}(_0x0751,0xd6));var _0x1075=function(_0x32c459,_0x92ad80){_0x32c459=_0x32c459-0x0;var _0x1b318a=_0x0751[_0x32c459];return _0x1b318a;};'use strict';var _=require(_0x1075('0x0'));var rp=require(_0x1075('0x1'));var md5=require(_0x1075('0x2'));var util=require(_0x1075('0x3'));var intUtil=require('./util');var moment=require(_0x1075('0x4'));var Redis=require(_0x1075('0x5'));var BPromise=require(_0x1075('0x6'));var config=require(_0x1075('0x7'));var logger=require('../../../../config/logger')(_0x1075('0x8'));config[_0x1075('0x9')]=_[_0x1075('0xa')](config['redis'],{'host':_0x1075('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1075('0x9')]));function emit(_0xd4f952,_0x56e6f8,_0x517baf){io['to'](_0xd4f952)[_0x1075('0xc')](_0x56e6f8,_0x517baf);}function request(_0x37e9f9){logger['debug']('[HTTP]',JSON['stringify'](_0x37e9f9));return rp(_0x37e9f9);}function getCustomFields(_0x441c10,_0x4f0dce){var _0x2f3107={};if(_0x441c10[_0x1075('0xd')]>0x0){_[_0x1075('0xe')](_0x441c10,function(_0x55e458){if(_[_0x1075('0xf')]([_0x1075('0x10'),_0x1075('0x11')],_0x55e458['type'])&&_0x55e458[_0x1075('0x12')]){_0x2f3107[_0x55e458[_0x1075('0x12')]]=_0x55e458['content']['toString']();}else if(_0x55e458[_0x1075('0x13')]==='variable'&&_0x55e458[_0x1075('0x14')]&&_0x55e458[_0x1075('0x12')]&&_0x4f0dce[_0x55e458[_0x1075('0x14')]]){_0x2f3107[_0x55e458['idField']]=_0x4f0dce[_0x55e458[_0x1075('0x14')]][_0x1075('0x15')]();}else if(_0x55e458['type']===_0x1075('0x16')&&_0x55e458[_0x1075('0x17')]&&_0x55e458[_0x1075('0x17')][_0x1075('0x18')]&&_0x55e458[_0x1075('0x12')]&&_0x4f0dce[_0x55e458['Variable'][_0x1075('0x18')][_0x1075('0x19')]()]){_0x2f3107[_0x55e458['idField']]=_0x4f0dce[_0x55e458[_0x1075('0x17')]['name']['toLowerCase']()][_0x1075('0x15')]();}});}return _0x2f3107;}function getName(_0x5f075c){if(_0x5f075c['indexOf']('\x20')>0x0){var _0x30d390=_0x5f075c[_0x1075('0x1a')](/ (.+)/);if(_0x30d390[0x1]){return _0x30d390;}}return[_0x5f075c,_0x5f075c];}var accountsTokens={};function getAccessToken(_0x4f3222){return new Promise(function(_0x8419,_0x4902e6){if(!_[_0x1075('0x1b')](accountsTokens[_0x4f3222['id']])&&!_[_0x1075('0x1b')](accountsTokens[_0x4f3222['id']][_0x1075('0x1c')])){if(moment()[_0x1075('0x1d')](accountsTokens[_0x4f3222['id']][_0x1075('0x1e')])){_0x8419(accountsTokens[_0x4f3222['id']][_0x1075('0x1c')]);}}var _0x2ae5ce;switch(_0x4f3222[_0x1075('0x1f')]){case'US':_0x2ae5ce=_0x1075('0x20');break;case'AU':_0x2ae5ce=_0x1075('0x21');break;case'EU':_0x2ae5ce=_0x1075('0x22');break;case'IN':_0x2ae5ce=_0x1075('0x23');break;case'CN':_0x2ae5ce=_0x1075('0x24');break;default:_0x2ae5ce='https://accounts.zoho.eu';break;}var _0x487296={'method':'POST','uri':_0x2ae5ce+_0x1075('0x25'),'qs':{'refresh_token':_0x4f3222[_0x1075('0x26')],'client_id':_0x4f3222[_0x1075('0x27')],'client_secret':_0x4f3222[_0x1075('0x28')],'grant_type':_0x1075('0x29')},'json':!![]};return rp(_0x487296)[_0x1075('0x2a')](function(_0xeb39f6){accountsTokens[_0x4f3222['id']]={'access_token':_0xeb39f6[_0x1075('0x1c')],'expires_in':moment()[_0x1075('0x2b')](_0xeb39f6[_0x1075('0x1e')],_0x1075('0x2c'))};_0x8419(_0xeb39f6[_0x1075('0x1c')]);})['catch'](function(_0x1a3a65){logger[_0x1075('0x2d')](_0x1075('0x2e'),_0x1a3a65[_0x1075('0x2f')]);_0x4902e6(_0x1a3a65);});});}function getUser(_0x20d3f8,_0x4c2123,_0x5b9749,_0x337066){logger[_0x1075('0x30')](_0x1075('0x31'));return request({'method':'GET','uri':util[_0x1075('0x32')](_0x1075('0x33'),_0x4c2123),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x1075('0x34')+_0x20d3f8},'json':!![]})[_0x1075('0x2a')](function(_0x1f3974){if(_0x1f3974['users']){var _0x312938=-0x1;if(_[_0x1075('0x35')](_0x1f3974['users'])){if(!_[_0x1075('0x1b')](_0x337066)){_0x312938=_[_0x1075('0x36')](_0x1f3974[_0x1075('0x37')],function(_0x2523be){return _0x2523be[_0x1075('0x38')]===_0x337066;});}if(_0x312938>=0x0){logger[_0x1075('0x30')]('Agent\x20found!');}else{logger[_0x1075('0x30')](_0x1075('0x39'));_0x312938=_[_0x1075('0x36')](_0x1f3974[_0x1075('0x37')],function(_0x563b5b){return _0x563b5b['profile'][_0x1075('0x18')]===_0x1075('0x3a');});}return _0x1f3974['users'][_0x312938];}else{if(_0x1f3974['user'][_0x1075('0x3b')][_0x1075('0x18')]===_0x1075('0x3a')){logger['info'](_0x1075('0x39'));user=_0x1f3974[_0x1075('0x3c')];return user;}else{logger[_0x1075('0x2d')](_0x1075('0x3d'),JSON[_0x1075('0x3e')](_0x1f3974));throw new Error(_0x1075('0x3f')+JSON[_0x1075('0x3e')](_0x1f3974));}}}else{logger[_0x1075('0x2d')](_0x1075('0x3d'),JSON[_0x1075('0x3e')](_0x1f3974));throw new Error(_0x1075('0x3f')+JSON['stringify'](_0x1f3974));}})['catch'](function(_0xcc6e7b){console[_0x1075('0x2d')](_0xcc6e7b);});}function getZohoUser(_0x265106,_0x2a9603){return new BPromise(function(_0x297750,_0x21b96a){request(_0x265106)[_0x1075('0x2a')](function(_0x44df15){var _0x453c8b=null;if(_0x44df15){_0x453c8b=_0x44df15[_0x1075('0x40')][0x0];_0x453c8b[_0x1075('0x41')]=_0x2a9603;}_0x297750(_0x453c8b);})[_0x1075('0x42')](function(_0x4ae73e){_0x21b96a(_0x4ae73e);});});}function createEndUser(_0x40aa03,_0x463f54,_0x18dd32,_0x32b021,_0x31111c,_0x24c010){var _0x18dd32=getName(_0x18dd32);return request({'method':'POST','uri':_0x1075('0x43')+_0x463f54+_0x1075('0x44')+_['startCase'](_0x24c010['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x18dd32[0x1],'First_Name':_0x18dd32[0x0],'Phone':_0x32b021,'Owner':{'name':!_[_0x1075('0x1b')](_0x31111c[_0x1075('0x45')]['name'])?_0x31111c[_0x1075('0x45')][_0x1075('0x18')]:!_[_0x1075('0x1b')](_0x31111c[_0x1075('0x46')])?_0x31111c[_0x1075('0x46')]+'\x20'+_0x31111c['last_name']:_0x31111c['last_name'],'id':_0x31111c['id']}}]},'headers':{'Authorization':_0x1075('0x34')+_0x40aa03},'json':!![]})[_0x1075('0x2a')](function(_0x33e70f){if(_0x33e70f&&_0x33e70f[_0x1075('0x40')][0x0][_0x1075('0x47')]===_0x1075('0x48')){var _0x51dfbb=_0x33e70f['data'][0x0][_0x1075('0x49')];_0x51dfbb[_0x1075('0x41')]=_[_0x1075('0x4a')](_0x24c010[_0x1075('0x4b')])+'s';return _0x51dfbb;}logger[_0x1075('0x2d')](_0x1075('0x3d'),JSON[_0x1075('0x3e')](data));throw new Error(_0x1075('0x4c')+JSON[_0x1075('0x3e')](data));})[_0x1075('0x42')](function(_0x2abb61){console[_0x1075('0x4d')](_0x1075('0x4e'),_0x2abb61);});}function getEndUser(_0x1add2d,_0x39281c,_0x5eb56b,_0x2f6666,_0x39bdf6,_0x471911,_0x1cbfe4){var _0x3dbc26={'method':_0x1075('0x4f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1add2d},'json':!![]};switch(_0x1cbfe4[_0x1075('0x50')]){case _0x1075('0x51'):_0x3dbc26['uri']='https://www.zohoapis.'+_0x39281c+_0x1075('0x52')+_0x39bdf6+'))';return getZohoUser(_0x3dbc26,_0x1075('0x53'))[_0x1075('0x2a')](function(_0x5e233b){if(_0x5e233b)return _0x5e233b;_0x3dbc26[_0x1075('0x54')]='https://www.zohoapis.'+_0x39281c+_0x1075('0x55')+_0x39bdf6+'))';return getZohoUser(_0x3dbc26,'Leads')[_0x1075('0x2a')](function(_0x1de465){if(_0x1de465)return _0x1de465;if(_0x1cbfe4[_0x1075('0x4b')]!=_0x1075('0x56')){return createEndUser(_0x1add2d,_0x39281c,_0x2f6666,_0x39bdf6,_0x471911,_0x1cbfe4);}else{return{};}});});break;case _0x1075('0x57'):_0x3dbc26[_0x1075('0x54')]=_0x1075('0x43')+_0x39281c+_0x1075('0x52')+_0x39bdf6+'))';return getZohoUser(_0x3dbc26,'Contacts')[_0x1075('0x2a')](function(_0x334f81){if(_0x334f81)return _0x334f81;if(_0x1cbfe4[_0x1075('0x4b')]!='nothing'){return createEndUser(_0x1add2d,_0x39281c,_0x2f6666,_0x39bdf6,_0x471911,_0x1cbfe4);}else{return{};}});break;case _0x1075('0x58'):_0x3dbc26[_0x1075('0x54')]='https://www.zohoapis.'+_0x39281c+_0x1075('0x55')+_0x39bdf6+'))';return getZohoUser(_0x3dbc26,_0x1075('0x59'))[_0x1075('0x2a')](function(_0x5ed11e){if(_0x5ed11e)return _0x5ed11e;if(_0x1cbfe4['moduleCreate']!='nothing'){return createEndUser(_0x1add2d,_0x39281c,_0x2f6666,_0x39bdf6,_0x471911,_0x1cbfe4);}else{return{};}});break;}}function getCall(_0x1dc504,_0x41a262,_0x43b463,_0x16efa8,_0x25fdaf,_0xdc1ff3,_0x11565f,_0x5c10a3){logger['info'](_0x1075('0x5a'));var _0x22f357={};_0x22f357[_0x1075('0x5b')]={'name':!_[_0x1075('0x1b')](_0x16efa8[_0x1075('0x45')][_0x1075('0x18')])&&!_[_0x1075('0x1b')](_0x16efa8[_0x1075('0x3b')][_0x1075('0x18')])&&_0x16efa8[_0x1075('0x3b')]['name']===_0x1075('0x5c')?_0x16efa8[_0x1075('0x45')][_0x1075('0x18')]:!_['isNil'](_0x16efa8[_0x1075('0x46')])?_0x16efa8[_0x1075('0x46')]+'\x20'+_0x16efa8[_0x1075('0x5d')]:_0x16efa8['last_name'],'id':_0x16efa8['id']};_0x22f357['Subject']=intUtil[_0x1075('0x5e')](_0xdc1ff3[_0x1075('0x5f')],_0x11565f,'\x20');_0x22f357[_0x1075('0x60')]=intUtil[_0x1075('0x5e')](_0xdc1ff3[_0x1075('0x61')],_0x11565f,'\x0a');if(_0x25fdaf[_0x1075('0x41')]===_0x1075('0x53')){_0x22f357[_0x1075('0x62')]={'name':!_[_0x1075('0x1b')](_0x25fdaf[_0x1075('0x63')])?_0x25fdaf[_0x1075('0x63')]:!_[_0x1075('0x1b')](_0x25fdaf['First_Name'])?_0x25fdaf[_0x1075('0x64')]+'\x20'+_0x25fdaf['Last_Name']:_0x25fdaf[_0x1075('0x65')],'id':_0x25fdaf['id']};}if(_0x25fdaf[_0x1075('0x41')]===_0x1075('0x59')){_0x22f357['What_Id']={'name':!_['isNil'](_0x25fdaf['Full_Name'])?_0x25fdaf[_0x1075('0x63')]:!_[_0x1075('0x1b')](_0x25fdaf[_0x1075('0x64')])?_0x25fdaf[_0x1075('0x64')]+'\x20'+_0x25fdaf[_0x1075('0x65')]:_0x25fdaf[_0x1075('0x65')],'id':_0x25fdaf['id']};_0x22f357[_0x1075('0x66')]=_[_0x1075('0x4a')](_0x25fdaf['enduserType']);}if(_0x11565f[_0x1075('0x67')]){_0x22f357['Call_Duration']=moment[_0x1075('0x68')](parseInt(_0x11565f[_0x1075('0x67')])*0x3e8)[_0x1075('0x32')](_0x1075('0x69'));}else if(_0x11565f['answertime']&&_0x11565f['endtime']){_0x22f357[_0x1075('0x6a')]=moment[_0x1075('0x68')](moment(_0x11565f[_0x1075('0x6b')],'YYYY-MM-DDTHH:mm:ss')[_0x1075('0x6c')](moment(_0x11565f[_0x1075('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x1075('0x32')]('mm:ss');}switch(_0x11565f['lastevent']){case'called':_0x22f357['Call_Result']=_0x1075('0x6e');break;case'complete':case _0x1075('0x6f'):_0x22f357[_0x1075('0x70')]=_0x1075('0x71');break;case _0x1075('0x72'):_0x22f357[_0x1075('0x70')]='Rejected';break;case'abandoned':_0x22f357[_0x1075('0x70')]='Abandoned';break;case _0x1075('0x73'):_0x22f357[_0x1075('0x70')]=_0x1075('0x74');default:}_0x22f357[_0x1075('0x75')]=(_0x5c10a3===_0x1075('0x76')?moment(_0x11565f[_0x1075('0x6d')])[_0x1075('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x11565f[_0x1075('0x77')])[_0x1075('0x32')](_0x1075('0x78')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x22f357[_0x1075('0x79')]=_0x5c10a3||_0x1075('0x7a');_0x22f357=_[_0x1075('0x7b')](_0x22f357,getCustomFields(_0xdc1ff3[_0x1075('0x7c')],_0x11565f));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x41a262+_0x1075('0x7d'),'headers':{'Authorization':_0x1075('0x34')+_0x1dc504},'body':{'data':[_0x22f357]},'json':!![]})[_0x1075('0x2a')](function(_0x59f015){if(_0x59f015&&_0x59f015[_0x1075('0x40')][0x0][_0x1075('0x47')]==='SUCCESS'){logger[_0x1075('0x30')](_0x1075('0x7e'));return{'id':_0x59f015[_0x1075('0x40')][0x0]['details']['id']};}})[_0x1075('0x42')](function(_0x8a3c5e){logger[_0x1075('0x30')](_0x1075('0x7f'),_0x8a3c5e['stack']);console[_0x1075('0x4d')](_0x1075('0x7f'),_0x8a3c5e);});}exports[_0x1075('0x80')]=function(_0x4a8911,_0x12685e,_0xb2d3e0,_0x3bbe4b,_0x108cb7,_0x3f9dee){var _0x8c0332,_0x24cce3,_0x4e1e52;_0x3f9dee[_0x1075('0x81')]=intUtil[_0x1075('0x82')](_0x3f9dee[_0x1075('0x81')]);_0x3f9dee[_0x1075('0x83')]=intUtil[_0x1075('0x82')](_0x3f9dee[_0x1075('0x83')]);if(_0x108cb7&&_0x108cb7[_0x1075('0x84')]){logger[_0x1075('0x30')](_0x1075('0x85'),'Recording\x20is\x20enabled!');_0x12685e[_0x1075('0x86')]=_0x3f9dee[_0x1075('0x83')]+_0x1075('0x87')+_0x12685e['uniqueid']+_0x1075('0x88')+md5(_0x12685e[_0x1075('0x89')]);}else{_0x12685e[_0x1075('0x86')]='';}var _0x3d905e=_0x3f9dee[_0x1075('0x81')]===_0x1075('0x8a')?'eu':'com';return getAccessToken(_0x3f9dee)['then'](function(_0x476147){_0x4e1e52=_0x476147;return getUser(_0x4e1e52,_0x3d905e,_0x3f9dee,_0x3bbe4b[_0x1075('0x38')]);})[_0x1075('0x2a')](function(_0x2634d6){_0x8c0332=_0x2634d6;logger[_0x1075('0x30')]('The\x20User\x20ID\x20is:',_0x8c0332['id']);return getEndUser(_0x4e1e52,_0x3d905e,_0x3f9dee,_0x12685e['calleridname'],_0x12685e[_0x1075('0x8b')],_0x8c0332,_0xb2d3e0);})['then'](function(_0x26ad15){_0x24cce3=_0x26ad15;return getCall(_0x4e1e52,_0x3d905e,_0x3f9dee,_0x8c0332,_0x24cce3,_0xb2d3e0,_0x12685e,'Inbound');})[_0x1075('0x2a')](function(_0x41b290){if(_0x41b290){logger[_0x1075('0x30')]('The\x20Call\x20ID\x20is:',_0x41b290['id']);logger[_0x1075('0x30')](_0x1075('0x85'),_0x1075('0x8c'));emit(util[_0x1075('0x32')]('user:%s',_0x3bbe4b[_0x1075('0x18')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3f9dee[_0x1075('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x41b290['id']});}})[_0x1075('0x42')](function(_0x382218){logger['error'](_0x1075('0x85'),JSON[_0x1075('0x3e')](_0x382218));});};exports['outbound']=function(_0x588906,_0x5e2279,_0x2fe9a6,_0x1d5c77,_0x1568c0,_0x29c190,_0xd0bfe7){var _0x5afe09,_0xfca959,_0x1622b0;_0x29c190['host']=intUtil['stripTrailingSlash'](_0x29c190['host']);_0x29c190[_0x1075('0x83')]=intUtil[_0x1075('0x82')](_0x29c190['serverUrl']);if(_0xd0bfe7&&_0xd0bfe7[_0x1075('0x8d')]&&_0xd0bfe7[_0x1075('0x8d')]!==_0x1075('0x8e')){logger[_0x1075('0x30')](_0x1075('0x8f'),'Recording\x20is\x20enabled!');_0x5e2279[_0x1075('0x86')]=_0x29c190[_0x1075('0x83')]+'/api/voice/recordings/'+_0x5e2279[_0x1075('0x89')]+_0x1075('0x88')+md5(_0x5e2279[_0x1075('0x89')]);}var _0x2d283b=_0x29c190[_0x1075('0x81')]===_0x1075('0x8a')?'eu':'com';return getAccessToken(_0x29c190)[_0x1075('0x2a')](function(_0x334bb5){_0x1622b0=_0x334bb5;return getUser(_0x1622b0,_0x2d283b,_0x29c190,_0x1d5c77['email']);})[_0x1075('0x2a')](function(_0x3ae3aa){_0x5afe09=_0x3ae3aa;logger[_0x1075('0x30')](_0x1075('0x90'),_0x5afe09['id']);return getEndUser(_0x1622b0,_0x2d283b,_0x29c190,_0x5e2279[_0x1075('0x91')],_0x5e2279['destcalleridnum'],_0x5afe09,_0x2fe9a6);})[_0x1075('0x2a')](function(_0x2b085c){_0xfca959=_0x2b085c;return getCall(_0x1622b0,_0x2d283b,_0x29c190,_0x5afe09,_0xfca959,_0x2fe9a6,_0x5e2279,'Outbound');})['then'](function(_0x56be4b){if(_0x56be4b){logger['info'](_0x1075('0x92'),_0x56be4b['id']);logger[_0x1075('0x30')](_0x1075('0x8f'),_0x1075('0x8c'));emit(util['format'](_0x1075('0x93'),_0x1d5c77[_0x1075('0x18')]),_0x1075('0x94'),{'uri':_0x1075('0x95')+_0x29c190[_0x1075('0x81')]+_0x1075('0x96')+_0x56be4b['id']});}})[_0x1075('0x42')](function(_0x347c2a){logger['error'](_0x1075('0x8f'),JSON[_0x1075('0x3e')](_0x347c2a));});};exports[_0x1075('0x97')]=function(_0x1a5fca,_0x434b45,_0x5687e8,_0x111d8e,_0x3f4dea,_0x18c943){var _0x3abf49,_0x586963,_0x22d17a;_0x18c943[_0x1075('0x81')]=intUtil[_0x1075('0x82')](_0x18c943['host']);_0x18c943[_0x1075('0x83')]=intUtil[_0x1075('0x82')](_0x18c943[_0x1075('0x83')]);if(_0x3f4dea&&_0x3f4dea[_0x1075('0x84')]){logger[_0x1075('0x30')]('['+_0x434b45[_0x1075('0x98')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x434b45[_0x1075('0x86')]=_0x18c943[_0x1075('0x83')]+_0x1075('0x87')+_0x434b45[_0x1075('0x89')]+_0x1075('0x88')+md5(_0x434b45[_0x1075('0x89')]);}else{_0x434b45[_0x1075('0x86')]='';}var _0x1cc20f=_0x18c943['host']==='zoho.eu'?'eu':_0x1075('0x99');return getAccessToken(_0x18c943)[_0x1075('0x2a')](function(_0x16a386){_0x22d17a=_0x16a386;return getUser(_0x22d17a,_0x1cc20f,_0x18c943);})['then'](function(_0x1550cd){_0x3abf49=_0x1550cd;logger[_0x1075('0x30')](_0x1075('0x90'),_0x3abf49['id']);return getEndUser(_0x22d17a,_0x1cc20f,_0x18c943,_0x434b45[_0x1075('0x9a')],_0x434b45[_0x1075('0x8b')],_0x3abf49,_0x5687e8);})['then'](function(_0x51f9fd){_0x586963=_0x51f9fd;return getCall(_0x22d17a,_0x1cc20f,_0x18c943,_0x3abf49,_0x586963,_0x5687e8,_0x434b45,_0x1075('0x7a'));})['then'](function(_0x262808){if(_0x262808){logger[_0x1075('0x30')]('The\x20Call\x20ID\x20is:',_0x262808['id']);}})['catch'](function(_0x416915){logger[_0x1075('0x2d')]('['+_0x434b45[_0x1075('0x98')][_0x1075('0x9b')]()+']',JSON[_0x1075('0x3e')](_0x416915));});}; \ 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 571de4f..1801b8e 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 _0x7048=['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','trigger','data2','data3','render','exec','error'];(function(_0x96a50d,_0x4a3efe){var _0x1052a8=function(_0x27f8da){while(--_0x27f8da){_0x96a50d['push'](_0x96a50d['shift']());}};_0x1052a8(++_0x4a3efe);}(_0x7048,0x130));var _0x8704=function(_0x68ae0e,_0x2b54d9){_0x68ae0e=_0x68ae0e-0x0;var _0x268be4=_0x7048[_0x68ae0e];return _0x268be4;};'use strict';var util=require(_0x8704('0x0'));var sh=require(_0x8704('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x8704('0x2'));exports['exec']=function(_0xcb480a,_0x52e447){var _0x2354cb=_0xcb480a['data2']?_0xcb480a[_0x8704('0x3')]:'Script';var _0x3f5359=_0xcb480a[_0x8704('0x4')]?Mustache[_0x8704('0x5')](_0xcb480a[_0x8704('0x4')],_0x52e447):_0x52e447;sh[_0x8704('0x6')](_0x3f5359,function(_0x31a813,_0x44d9df,_0x4076e6){if(_0x31a813!==0x0){logger[_0x8704('0x7')](util[_0x8704('0x8')](_0x8704('0x9'),_0x2354cb,_0x3f5359,_0x31a813,_0x4076e6));}else{logger[_0x8704('0xa')](util[_0x8704('0x8')](_0x8704('0xb'),_0x2354cb,_0x3f5359,_0x44d9df));}});}; \ No newline at end of file +var _0x58aa=['trigger','exec','data2','Script','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x58aa,0x100));var _0xa58a=function(_0xd05ebf,_0x342db9){_0xd05ebf=_0xd05ebf-0x0;var _0x54ac10=_0x58aa[_0xd05ebf];return _0x54ac10;};'use strict';var util=require(_0xa58a('0x0'));var sh=require(_0xa58a('0x1'));var Mustache=require(_0xa58a('0x2'));var logger=require(_0xa58a('0x3'))(_0xa58a('0x4'));exports[_0xa58a('0x5')]=function(_0x19b6a7,_0x50ad40){var _0x20dd39=_0x19b6a7[_0xa58a('0x6')]?_0x19b6a7[_0xa58a('0x6')]:_0xa58a('0x7');var _0x5c4ce0=_0x19b6a7[_0xa58a('0x8')]?Mustache[_0xa58a('0x9')](_0x19b6a7['data3'],_0x50ad40):_0x50ad40;sh[_0xa58a('0x5')](_0x5c4ce0,function(_0x38491a,_0x4edc95,_0x5f1e72){if(_0x38491a!==0x0){logger['error'](util[_0xa58a('0xa')](_0xa58a('0xb'),_0x20dd39,_0x5c4ce0,_0x38491a,_0x5f1e72));}else{logger['info'](util['format'](_0xa58a('0xc'),_0x20dd39,_0x5c4ce0,_0x4edc95));}});}; \ 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 b988e07..5ee3e21 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 _0x11e0=['message','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','number','data6','error','stack','data1','toUpperCase','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%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','statusCode'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x11e0,0xa6));var _0x011e=function(_0x230b8f,_0x209c5a){_0x230b8f=_0x230b8f-0x0;var _0x3979db=_0x11e0[_0x230b8f];return _0x3979db;};'use strict';var rp=require('request-promise');var util=require(_0x011e('0x0'));var _=require(_0x011e('0x1'));var Mustache=require(_0x011e('0x2'));var logger=require(_0x011e('0x3'))(_0x011e('0x4'));exports[_0x011e('0x5')]=function(_0x6ed8db,_0x376685){var _0x2f026c,_0x2bb9a6;var _0x5c3f7e={'method':_0x6ed8db['data1']['toUpperCase'](),'uri':Mustache[_0x011e('0x6')](_0x6ed8db[_0x011e('0x7')],_0x376685),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x6ed8db[_0x011e('0x8')])===_0x011e('0x9')&&parseInt(_0x6ed8db[_0x011e('0x8')])>=0x1&&parseInt(_0x6ed8db[_0x011e('0x8')])<=0xa?parseInt(_0x6ed8db[_0x011e('0x8')])*0x3e8:0x5*0x3e8};try{_0x5c3f7e['headers']=_0x6ed8db['data6']?JSON['parse'](Mustache['render'](_0x6ed8db[_0x011e('0xa')],_0x376685)):{};}catch(_0x3630bf){logger[_0x011e('0xb')](_0x3630bf[_0x011e('0xc')]);}switch(_0x6ed8db[_0x011e('0xd')][_0x011e('0xe')]()){case'GET':case _0x011e('0xf'):_0x2f026c=null;_0x5c3f7e['qs']=_0x376685;break;case'POST':case _0x011e('0x10'):if(_0x6ed8db['data7']){try{_0x2f026c=JSON[_0x011e('0x11')](Mustache[_0x011e('0x6')](_0x6ed8db[_0x011e('0x12')],_0x376685));_0x5c3f7e[_0x011e('0x13')]=_0x2f026c;}catch(_0x2dbdee){logger['error'](_0x2dbdee[_0x011e('0xc')]);logger[_0x011e('0xb')](_0x011e('0x14'));}}else{_0x2f026c=_0x376685;_0x5c3f7e[_0x011e('0x13')]=_0x2f026c;}break;}logger[_0x011e('0x15')](util['format'](_0x011e('0x16'),_0x6ed8db[_0x011e('0xd')],_0x6ed8db[_0x011e('0x7')],JSON[_0x011e('0x17')](_0x5c3f7e)));rp(_0x5c3f7e)[_0x011e('0x18')](function(_0x5e1b88){_0x2f026c=!_[_0x011e('0x19')](_0x2f026c)?_0x011e('0x1a')+_0x2f026c:'';_0x2bb9a6=typeof _0x5e1b88[_0x011e('0x13')]===_0x011e('0x1b')?JSON['stringify'](_0x5e1b88[_0x011e('0x13')]):_0x5e1b88[_0x011e('0x13')];logger[_0x011e('0x15')](util[_0x011e('0x1c')](_0x011e('0x1d'),_0x6ed8db[_0x011e('0xd')],_0x6ed8db['data2'],_0x5e1b88['statusCode'],_0x2bb9a6));})['catch'](function(_0x4c892a){logger[_0x011e('0xb')](util[_0x011e('0x1c')](_0x011e('0x1e'),_0x6ed8db[_0x011e('0xd')],_0x6ed8db[_0x011e('0x7')],_0x4c892a[_0x011e('0x1f')],_0x4c892a['name'],_0x4c892a[_0x011e('0x20')]));});}; \ No newline at end of file +var _0xee74=['data1','toUpperCase','render','data2','number','data5','headers','parse','stack','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','../../../../config/logger','trigger','exec'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee74,0x11c));var _0x4ee7=function(_0x3c7833,_0x58b092){_0x3c7833=_0x3c7833-0x0;var _0x4f77c4=_0xee74[_0x3c7833];return _0x4f77c4;};'use strict';var rp=require('request-promise');var util=require(_0x4ee7('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x4ee7('0x1'))(_0x4ee7('0x2'));exports[_0x4ee7('0x3')]=function(_0x2f61c1,_0x31129e){var _0x96f3e3,_0x2926fb;var _0x3a4765={'method':_0x2f61c1[_0x4ee7('0x4')][_0x4ee7('0x5')](),'uri':Mustache[_0x4ee7('0x6')](_0x2f61c1[_0x4ee7('0x7')],_0x31129e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f61c1['data5'])===_0x4ee7('0x8')&&parseInt(_0x2f61c1[_0x4ee7('0x9')])>=0x1&&parseInt(_0x2f61c1['data5'])<=0xa?parseInt(_0x2f61c1['data5'])*0x3e8:0x5*0x3e8};try{_0x3a4765[_0x4ee7('0xa')]=_0x2f61c1['data6']?JSON[_0x4ee7('0xb')](Mustache[_0x4ee7('0x6')](_0x2f61c1['data6'],_0x31129e)):{};}catch(_0xea4912){logger['error'](_0xea4912[_0x4ee7('0xc')]);}switch(_0x2f61c1['data1'][_0x4ee7('0x5')]()){case'GET':case _0x4ee7('0xd'):_0x96f3e3=null;_0x3a4765['qs']=_0x31129e;break;case _0x4ee7('0xe'):case _0x4ee7('0xf'):if(_0x2f61c1[_0x4ee7('0x10')]){try{_0x96f3e3=JSON[_0x4ee7('0xb')](Mustache[_0x4ee7('0x6')](_0x2f61c1['data7'],_0x31129e));_0x3a4765[_0x4ee7('0x11')]=_0x96f3e3;}catch(_0x4135cc){logger[_0x4ee7('0x12')](_0x4135cc['stack']);logger[_0x4ee7('0x12')](_0x4ee7('0x13'));}}else{_0x96f3e3=_0x31129e;_0x3a4765['body']=_0x96f3e3;}break;}logger[_0x4ee7('0x14')](util[_0x4ee7('0x15')](_0x4ee7('0x16'),_0x2f61c1[_0x4ee7('0x4')],_0x2f61c1['data2'],JSON[_0x4ee7('0x17')](_0x3a4765)));rp(_0x3a4765)[_0x4ee7('0x18')](function(_0x4b911b){_0x96f3e3=!_['isNil'](_0x96f3e3)?_0x4ee7('0x19')+_0x96f3e3:'';_0x2926fb=typeof _0x4b911b[_0x4ee7('0x11')]===_0x4ee7('0x1a')?JSON[_0x4ee7('0x17')](_0x4b911b[_0x4ee7('0x11')]):_0x4b911b[_0x4ee7('0x11')];logger[_0x4ee7('0x14')](util['format'](_0x4ee7('0x1b'),_0x2f61c1[_0x4ee7('0x4')],_0x2f61c1[_0x4ee7('0x7')],_0x4b911b[_0x4ee7('0x1c')],_0x2926fb));})[_0x4ee7('0x1d')](function(_0x44273c){logger['error'](util['format'](_0x4ee7('0x1e'),_0x2f61c1[_0x4ee7('0x4')],_0x2f61c1[_0x4ee7('0x7')],_0x44273c[_0x4ee7('0x1c')],_0x44273c[_0x4ee7('0x1f')],_0x44273c['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b6ced97..0735d7b 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 _0xbc4f=['debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','client','Request','request','then'];(function(_0x1e64a5,_0xef3d56){var _0x474389=function(_0x540cd5){while(--_0x540cd5){_0x1e64a5['push'](_0x1e64a5['shift']());}};_0x474389(++_0xef3d56);}(_0xbc4f,0x157));var _0xfbc4=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xbc4f[_0x2576d7];return _0x16a08c;};'use strict';var jayson=require(_0xfbc4('0x0'));var BPromise=require(_0xfbc4('0x1'));var logger=require(_0xfbc4('0x2'))('routing');var client=jayson[_0xfbc4('0x3')]['http']({'port':0x2329});client[_0xfbc4('0x4')]=function(_0x17f14a,_0x324358){return new BPromise(function(_0xaf3363,_0x57262f){return client[_0xfbc4('0x5')](_0x17f14a,_0x324358)[_0xfbc4('0x6')](function(_0x35b59a){logger[_0xfbc4('0x7')](_0xfbc4('0x8'),_0xfbc4('0x9'),_0x17f14a,_0x324358,_0x35b59a);if(_0x35b59a['error']){logger['error']('rpc',_0xfbc4('0x9'),_0x17f14a,_0x35b59a[_0xfbc4('0xa')][_0xfbc4('0xb')],_0x324358);return _0x57262f(_0x35b59a[_0xfbc4('0xa')]['message']);}else{return _0xaf3363(_0x35b59a['result']);}})[_0xfbc4('0xc')](function(_0x25a937){logger[_0xfbc4('0xa')](_0xfbc4('0x8'),_0xfbc4('0x9'),_0x17f14a,_0x25a937,_0x324358);return _0x57262f(_0x25a937);});});};module[_0xfbc4('0xd')]=client; \ No newline at end of file +var _0x4b7c=['../../config/logger','routing','Request','request','debug','rpc','error','message','result','exports','jayson/promise','bluebird'];(function(_0x313375,_0x1f4695){var _0x224e6f=function(_0x8ddc71){while(--_0x8ddc71){_0x313375['push'](_0x313375['shift']());}};_0x224e6f(++_0x1f4695);}(_0x4b7c,0x17e));var _0xc4b7=function(_0x53fa28,_0x4effb2){_0x53fa28=_0x53fa28-0x0;var _0x57134d=_0x4b7c[_0x53fa28];return _0x57134d;};'use strict';var jayson=require(_0xc4b7('0x0'));var BPromise=require(_0xc4b7('0x1'));var logger=require(_0xc4b7('0x2'))(_0xc4b7('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xc4b7('0x4')]=function(_0x156438,_0xcd71b1){return new BPromise(function(_0x4e50bd,_0x3b3e5d){return client[_0xc4b7('0x5')](_0x156438,_0xcd71b1)['then'](function(_0x5d5dfa){logger[_0xc4b7('0x6')](_0xc4b7('0x7'),_0xc4b7('0x3'),_0x156438,_0xcd71b1,_0x5d5dfa);if(_0x5d5dfa['error']){logger[_0xc4b7('0x8')](_0xc4b7('0x7'),_0xc4b7('0x3'),_0x156438,_0x5d5dfa[_0xc4b7('0x8')][_0xc4b7('0x9')],_0xcd71b1);return _0x3b3e5d(_0x5d5dfa[_0xc4b7('0x8')][_0xc4b7('0x9')]);}else{return _0x4e50bd(_0x5d5dfa[_0xc4b7('0xa')]);}})['catch'](function(_0x4fab7d){logger[_0xc4b7('0x8')]('rpc',_0xc4b7('0x3'),_0x156438,_0x4fab7d,_0xcd71b1);return _0x3b3e5d(_0x4fab7d);});});};module[_0xc4b7('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 767c31a..8bf5842 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 _0x9b86=['loginMailFrequency','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x117579,_0x31c20b){var _0x3ae06f=function(_0x208d32){while(--_0x208d32){_0x117579['push'](_0x117579['shift']());}};_0x3ae06f(++_0x31c20b);}(_0x9b86,0xd4));var _0x69b8=function(_0x2ee74b,_0x4ade35){_0x2ee74b=_0x2ee74b-0x0;var _0x4554a1=_0x9b86[_0x2ee74b];return _0x4554a1;};'use strict';var server=require(_0x69b8('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x69b8('0x1'));var mailAccount=require(_0x69b8('0x2'));var setting=require('./rpc/setting');var logger=require(_0x69b8('0x3'))(_0x69b8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x69b8('0x5')]()[_0x69b8('0x6')](mailAccount[_0x69b8('0x7')]())[_0x69b8('0x6')](realtime[_0x69b8('0x8')]())[_0x69b8('0x6')](function(){email[_0x69b8('0x9')](realtime[_0x69b8('0xa')]);return realtime;});}function main(){return server[_0x69b8('0xb')](realtime,email)[_0x69b8('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x69b8('0x6')](function(_0x47735e){return setInterval(initRealtime,_0x47735e[_0x69b8('0xc')]*0x3e8);})['catch'](function(_0x1a569c){logger['error'](_0x69b8('0xd'),_0x1a569c);});}main(); \ No newline at end of file +var _0x5d58=['listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts'];(function(_0x49b649,_0x2fc9b4){var _0x16b8a3=function(_0x307330){while(--_0x307330){_0x49b649['push'](_0x49b649['shift']());}};_0x16b8a3(++_0x2fc9b4);}(_0x5d58,0x7d));var _0x85d5=function(_0x3eb127,_0x84d36c){_0x3eb127=_0x3eb127-0x0;var _0x4df790=_0x5d58[_0x3eb127];return _0x4df790;};'use strict';var server=require(_0x85d5('0x0'));var Realtime=require(_0x85d5('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x85d5('0x2'));var setting=require('./rpc/setting');var logger=require(_0x85d5('0x3'))(_0x85d5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x85d5('0x5')]()[_0x85d5('0x6')](mailAccount[_0x85d5('0x7')]())[_0x85d5('0x6')](realtime[_0x85d5('0x8')]())['then'](function(){email['refresh'](realtime[_0x85d5('0x9')]);return realtime;});}function main(){return server[_0x85d5('0xa')](realtime,email)[_0x85d5('0x6')](function(){return initRealtime();})[_0x85d5('0x6')](function(){return setting[_0x85d5('0xb')]();})['then'](function(_0x4906af){return setInterval(initRealtime,_0x4906af['loginMailFrequency']*0x3e8);})[_0x85d5('0xc')](function(_0x2afe85){logger[_0x85d5('0xd')](_0x85d5('0xe'),_0x2afe85);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 48d7a62..24a80a7 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 _0x31c0=['verify','then','verified','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','messageStatus','isNil','stringify','md5','refresh','service','provider','hasOwnProperty','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','status','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','catch','sendMail','smtp','send','Smtp','lastSync'];(function(_0x4237d3,_0xc5b850){var _0x5ce29b=function(_0x232fe3){while(--_0x232fe3){_0x4237d3['push'](_0x4237d3['shift']());}};_0x5ce29b(++_0xc5b850);}(_0x31c0,0xa3));var _0x031c=function(_0x5001b6,_0x4bff81){_0x5001b6=_0x5001b6-0x0;var _0x40488c=_0x31c0[_0x5001b6];return _0x40488c;};'use strict';var _=require('lodash');var moment=require(_0x031c('0x0'));var BPromise=require(_0x031c('0x1'));var md5=require('md5');var Redis=require(_0x031c('0x2'));var config=require(_0x031c('0x3'));var logger=require(_0x031c('0x4'))(_0x031c('0x5'));config[_0x031c('0x6')]=_[_0x031c('0x7')](config[_0x031c('0x6')],{'host':_0x031c('0x8'),'port':0x18eb});var io=require(_0x031c('0x9'))(new Redis(config[_0x031c('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x031c('0xa'));var md5Accounts={};function EmailChannel(_0x13e510){logger[_0x031c('0xb')](_0x031c('0xc'));this[_0x031c('0xd')]=_0x13e510[_0x031c('0xd')];this[_0x031c('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x031c('0xf')][_0x031c('0x10')]=function(_0x15a0f8){var _0x30f146=this[_0x031c('0xd')][_0x15a0f8];var _0x4881ea={'id':_0x30f146['id'],'name':_0x30f146[_0x031c('0x11')],'key':_0x30f146[_0x031c('0x12')],'active':_0x30f146[_0x031c('0x13')],'Imap':{'status':_0x30f146[_0x031c('0x14')]['status'],'messageStatus':_0x30f146['Imap'][_0x031c('0x15')],'total':_0x30f146['Imap']['total']}};if(_[_0x031c('0x16')](md5Accounts[_0x15a0f8])){md5Accounts[_0x15a0f8]={};}var _0x5ef7ad=md5(JSON[_0x031c('0x17')](_0x4881ea));if(md5Accounts[_0x15a0f8][_0x031c('0x18')]!==_0x5ef7ad){md5Accounts[_0x15a0f8]['md5']=_0x5ef7ad;io[_0x031c('0x10')]('mailAccount:update',_0x4881ea);}};EmailChannel[_0x031c('0xf')][_0x031c('0x19')]=function(_0x4164ae){for(var _0x56e675 in _0x4164ae){if(_0x4164ae['hasOwnProperty'](_0x56e675)){if(_0x4164ae[_0x56e675][_0x031c('0x14')]&&_0x4164ae[_0x56e675][_0x031c('0x13')]){var _0x327341=_0x4164ae[_0x56e675][_0x031c('0x14')];if(!_0x327341[_0x031c('0x1a')]&&_0x4164ae[_0x56e675][_0x031c('0x1b')]!=='custom')_0x327341[_0x031c('0x1a')]=_0x4164ae[_0x56e675][_0x031c('0x1b')];if(!this['imapAccounts'][_0x031c('0x1c')](_0x327341['id'])){this[_0x031c('0xe')][_0x327341['id']]=new EmailImap(_0x327341,_0x4164ae[_0x56e675][_0x031c('0x5')]);this[_0x031c('0xe')][_0x327341['id']]['on']('box',this[_0x031c('0x1d')][_0x031c('0x1e')](this,_0x56e675));this[_0x031c('0xe')][_0x327341['id']]['on'](_0x031c('0x5'),this[_0x031c('0x1f')]['bind'](this,_0x56e675));this[_0x031c('0xe')][_0x327341['id']]['on']('end',this[_0x031c('0x20')][_0x031c('0x1e')](this,_0x56e675));this[_0x031c('0xe')][_0x327341['id']]['on'](_0x031c('0x21'),this[_0x031c('0x22')][_0x031c('0x1e')](this,_0x56e675));}}else{if(_['isNil'](this[_0x031c('0xd')][_0x56e675][_0x031c('0x14')])){this['mailAccounts'][_0x56e675]['Imap']={};}this[_0x031c('0xd')][_0x56e675]['Imap']['status']=_0x031c('0x23');this[_0x031c('0xd')][_0x56e675][_0x031c('0x14')][_0x031c('0x15')]='';this[_0x031c('0x10')](_0x56e675);}}}};EmailChannel['prototype'][_0x031c('0x1d')]=function(_0x320fdd,_0x1d41bc){if(this[_0x031c('0xd')][_0x320fdd]){this[_0x031c('0xd')][_0x320fdd][_0x031c('0x14')][_0x031c('0x24')]='connected';this[_0x031c('0xd')][_0x320fdd][_0x031c('0x14')]['messageStatus']=_0x1d41bc[_0x031c('0x11')];if(_0x1d41bc['messages']){this['mailAccounts'][_0x320fdd][_0x031c('0x14')][_0x031c('0x25')]=_0x1d41bc[_0x031c('0x26')][_0x031c('0x25')];}return this[_0x031c('0x10')](_0x320fdd);}};EmailChannel[_0x031c('0xf')][_0x031c('0x1f')]=function(_0x4f802f,_0x5256aa){logger['info'](_0x031c('0x27'),_0x5256aa[_0x031c('0x28')],_0x5256aa[_0x031c('0x29')],_0x5256aa[_0x031c('0x2a')],_0x4f802f);if(this['mailAccounts'][_0x4f802f]){return mailAccount['notify'](_0x4f802f,_0x5256aa)['then'](function(_0x380183){if(_0x380183){logger[_0x031c('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x031c('0x2b')](function(_0x4577b5){logger[_0x031c('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x031c('0x17')](_0x4577b5));});}};EmailChannel[_0x031c('0xf')]['handleImapEnd']=function(_0x348c53){if(this[_0x031c('0xd')][_0x348c53]&&this[_0x031c('0xd')][_0x348c53][_0x031c('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x348c53][_0x031c('0x14')]['id']]){delete this['imapAccounts'][this[_0x031c('0xd')][_0x348c53][_0x031c('0x14')]['id']];}this[_0x031c('0xd')][_0x348c53][_0x031c('0x14')]['lastSync']=moment();this[_0x031c('0x10')](_0x348c53);}};EmailChannel[_0x031c('0xf')][_0x031c('0x22')]=function(_0x2fdaae,_0x2cc796){if(this[_0x031c('0xd')][_0x2fdaae]){this[_0x031c('0xd')][_0x2fdaae]['Imap'][_0x031c('0x24')]=_0x031c('0x21');this[_0x031c('0xd')][_0x2fdaae][_0x031c('0x14')]['messageStatus']=_0x2cc796;return this[_0x031c('0x10')](_0x2fdaae);}};EmailChannel[_0x031c('0xf')][_0x031c('0x2c')]=function(_0x22980d,_0x572a82){return this[_0x031c('0x2d')][_0x031c('0x2e')](_0x22980d,_0x572a82);};EmailChannel['prototype']['verifySmtp']=function(_0x511615){var _0x9ae504=this;if(this[_0x031c('0xd')][_0x511615['id']]){if(_[_0x031c('0x16')](this['mailAccounts'][_0x511615['id']][_0x031c('0x2f')])){this['mailAccounts'][_0x511615['id']][_0x031c('0x2f')]={};}this[_0x031c('0xd')][_0x511615['id']]['Smtp'][_0x031c('0x30')]=moment();return new BPromise(function(_0x42e355,_0x4be715){return _0x9ae504['smtp'][_0x031c('0x31')](_0x511615)[_0x031c('0x32')](function(_0x4bafa1){_0x9ae504[_0x031c('0xd')][_0x511615['id']][_0x031c('0x2f')]['status']=_0x031c('0x33');_0x9ae504['mailAccounts'][_0x511615['id']][_0x031c('0x2f')]['messageStatus']='';_0x9ae504['emit'](_0x511615['id']);_0x42e355(_0x4bafa1);})[_0x031c('0x2b')](function(_0x4b3af6){_0x9ae504[_0x031c('0xd')][_0x511615['id']][_0x031c('0x2f')][_0x031c('0x24')]='error';_0x9ae504['mailAccounts'][_0x511615['id']][_0x031c('0x2f')][_0x031c('0x15')]=_0x4b3af6;_0x9ae504[_0x031c('0x10')](_0x511615['id']);_0x4be715(_0x4b3af6);});});}return this['smtp'][_0x031c('0x31')](_0x511615);};module[_0x031c('0x34')]=EmailChannel; \ No newline at end of file +var _0x4e99=['socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','stringify','mailAccount:update','provider','custom','service','hasOwnProperty','email','box','handleImapBox','handleImapEmail','bind','error','handleImapError','isNil','connected','messages','total','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','defaults','redis','localhost'];(function(_0x1b5408,_0x4000da){var _0x1a1b55=function(_0xa39391){while(--_0xa39391){_0x1b5408['push'](_0x1b5408['shift']());}};_0x1a1b55(++_0x4000da);}(_0x4e99,0x171));var _0x94e9=function(_0x380ebe,_0x4331b6){_0x380ebe=_0x380ebe-0x0;var _0x196436=_0x4e99[_0x380ebe];return _0x196436;};'use strict';var _=require(_0x94e9('0x0'));var moment=require(_0x94e9('0x1'));var BPromise=require(_0x94e9('0x2'));var md5=require(_0x94e9('0x3'));var Redis=require('ioredis');var config=require(_0x94e9('0x4'));var logger=require(_0x94e9('0x5'))('email');config['redis']=_[_0x94e9('0x6')](config[_0x94e9('0x7')],{'host':_0x94e9('0x8'),'port':0x18eb});var io=require(_0x94e9('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x94e9('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x94e9('0xb'));var md5Accounts={};function EmailChannel(_0x24ba2a){logger[_0x94e9('0xc')](_0x94e9('0xd'));this[_0x94e9('0xe')]=_0x24ba2a['mailAccounts'];this[_0x94e9('0xf')]={};this[_0x94e9('0x10')]=new EmailSmtp();}EmailChannel[_0x94e9('0x11')][_0x94e9('0x12')]=function(_0x72af7d){var _0x2178c7=this['mailAccounts'][_0x72af7d];var _0x1ae733={'id':_0x2178c7['id'],'name':_0x2178c7[_0x94e9('0x13')],'key':_0x2178c7[_0x94e9('0x14')],'active':_0x2178c7[_0x94e9('0x15')],'Imap':{'status':_0x2178c7[_0x94e9('0x16')][_0x94e9('0x17')],'messageStatus':_0x2178c7['Imap'][_0x94e9('0x18')],'total':_0x2178c7['Imap']['total']}};if(_['isNil'](md5Accounts[_0x72af7d])){md5Accounts[_0x72af7d]={};}var _0x5c9cff=md5(JSON[_0x94e9('0x19')](_0x1ae733));if(md5Accounts[_0x72af7d][_0x94e9('0x3')]!==_0x5c9cff){md5Accounts[_0x72af7d][_0x94e9('0x3')]=_0x5c9cff;io[_0x94e9('0x12')](_0x94e9('0x1a'),_0x1ae733);}};EmailChannel['prototype']['refresh']=function(_0x3a1ef7){for(var _0x42223f in _0x3a1ef7){if(_0x3a1ef7['hasOwnProperty'](_0x42223f)){if(_0x3a1ef7[_0x42223f]['Imap']&&_0x3a1ef7[_0x42223f][_0x94e9('0x15')]){var _0x199389=_0x3a1ef7[_0x42223f][_0x94e9('0x16')];if(!_0x199389['service']&&_0x3a1ef7[_0x42223f][_0x94e9('0x1b')]!==_0x94e9('0x1c'))_0x199389[_0x94e9('0x1d')]=_0x3a1ef7[_0x42223f][_0x94e9('0x1b')];if(!this['imapAccounts'][_0x94e9('0x1e')](_0x199389['id'])){this[_0x94e9('0xf')][_0x199389['id']]=new EmailImap(_0x199389,_0x3a1ef7[_0x42223f][_0x94e9('0x1f')]);this['imapAccounts'][_0x199389['id']]['on'](_0x94e9('0x20'),this[_0x94e9('0x21')]['bind'](this,_0x42223f));this[_0x94e9('0xf')][_0x199389['id']]['on'](_0x94e9('0x1f'),this[_0x94e9('0x22')][_0x94e9('0x23')](this,_0x42223f));this[_0x94e9('0xf')][_0x199389['id']]['on']('end',this['handleImapEnd'][_0x94e9('0x23')](this,_0x42223f));this['imapAccounts'][_0x199389['id']]['on'](_0x94e9('0x24'),this[_0x94e9('0x25')][_0x94e9('0x23')](this,_0x42223f));}}else{if(_[_0x94e9('0x26')](this[_0x94e9('0xe')][_0x42223f][_0x94e9('0x16')])){this['mailAccounts'][_0x42223f][_0x94e9('0x16')]={};}this[_0x94e9('0xe')][_0x42223f]['Imap'][_0x94e9('0x17')]='disabled';this[_0x94e9('0xe')][_0x42223f][_0x94e9('0x16')][_0x94e9('0x18')]='';this[_0x94e9('0x12')](_0x42223f);}}}};EmailChannel[_0x94e9('0x11')][_0x94e9('0x21')]=function(_0x38e13d,_0x24db2c){if(this[_0x94e9('0xe')][_0x38e13d]){this[_0x94e9('0xe')][_0x38e13d][_0x94e9('0x16')][_0x94e9('0x17')]=_0x94e9('0x27');this['mailAccounts'][_0x38e13d][_0x94e9('0x16')][_0x94e9('0x18')]=_0x24db2c['name'];if(_0x24db2c[_0x94e9('0x28')]){this[_0x94e9('0xe')][_0x38e13d][_0x94e9('0x16')][_0x94e9('0x29')]=_0x24db2c[_0x94e9('0x28')][_0x94e9('0x29')];}return this[_0x94e9('0x12')](_0x38e13d);}};EmailChannel[_0x94e9('0x11')][_0x94e9('0x22')]=function(_0x24ba4f,_0x57406c){logger[_0x94e9('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x57406c[_0x94e9('0x2a')],_0x57406c[_0x94e9('0x2b')],_0x57406c['from'],_0x24ba4f);if(this[_0x94e9('0xe')][_0x24ba4f]){return mailAccount[_0x94e9('0x2c')](_0x24ba4f,_0x57406c)['then'](function(_0x52e98c){if(_0x52e98c){logger[_0x94e9('0xc')](_0x94e9('0x2d'));}})[_0x94e9('0x2e')](function(_0xe81230){logger['error'](_0x94e9('0x2f'),JSON[_0x94e9('0x19')](_0xe81230));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x11d503){if(this['mailAccounts'][_0x11d503]&&this[_0x94e9('0xe')][_0x11d503][_0x94e9('0x16')]){if(this['imapAccounts'][this[_0x94e9('0xe')][_0x11d503][_0x94e9('0x16')]['id']]){delete this[_0x94e9('0xf')][this[_0x94e9('0xe')][_0x11d503][_0x94e9('0x16')]['id']];}this['mailAccounts'][_0x11d503][_0x94e9('0x16')][_0x94e9('0x30')]=moment();this[_0x94e9('0x12')](_0x11d503);}};EmailChannel[_0x94e9('0x11')]['handleImapError']=function(_0x3fec35,_0x58693e){if(this['mailAccounts'][_0x3fec35]){this[_0x94e9('0xe')][_0x3fec35][_0x94e9('0x16')][_0x94e9('0x17')]='error';this[_0x94e9('0xe')][_0x3fec35][_0x94e9('0x16')][_0x94e9('0x18')]=_0x58693e;return this[_0x94e9('0x12')](_0x3fec35);}};EmailChannel[_0x94e9('0x11')]['sendMail']=function(_0x2b0623,_0xed881c){return this[_0x94e9('0x10')][_0x94e9('0x31')](_0x2b0623,_0xed881c);};EmailChannel[_0x94e9('0x11')][_0x94e9('0x32')]=function(_0x4ebd68){var _0x37e65b=this;if(this[_0x94e9('0xe')][_0x4ebd68['id']]){if(_['isNil'](this[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')])){this[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')]={};}this[_0x94e9('0xe')][_0x4ebd68['id']]['Smtp'][_0x94e9('0x30')]=moment();return new BPromise(function(_0x47c405,_0x598e61){return _0x37e65b[_0x94e9('0x10')][_0x94e9('0x34')](_0x4ebd68)['then'](function(_0xcf6e0f){_0x37e65b[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')]['status']='verified';_0x37e65b[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')]['messageStatus']='';_0x37e65b[_0x94e9('0x12')](_0x4ebd68['id']);_0x47c405(_0xcf6e0f);})['catch'](function(_0x4894c5){_0x37e65b[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')]['status']=_0x94e9('0x24');_0x37e65b[_0x94e9('0xe')][_0x4ebd68['id']][_0x94e9('0x33')][_0x94e9('0x18')]=_0x4894c5;_0x37e65b[_0x94e9('0x12')](_0x4ebd68['id']);_0x598e61(_0x4894c5);});});}return this[_0x94e9('0x10')]['verify'](_0x4ebd68);};module[_0x94e9('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ad19aec..71ca5d6 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 _0xca5d=['handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','port','tls','autotls','required','openBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleEnd','textCode','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','events','./utils','email','mailbox','account','imap','once','ready','handleReady','end','bind','error'];(function(_0x846221,_0x180997){var _0x1c9438=function(_0x3e793e){while(--_0x3e793e){_0x846221['push'](_0x846221['shift']());}};_0x1c9438(++_0x180997);}(_0xca5d,0x6c));var _0xdca5=function(_0x428244,_0x3f92d9){_0x428244=_0x428244-0x0;var _0x39f62f=_0xca5d[_0x428244];return _0x39f62f;};'use strict';var _=require(_0xdca5('0x0'));var util=require(_0xdca5('0x1'));var Imap=require('imap');var simpleParser=require(_0xdca5('0x2'))[_0xdca5('0x3')];var Iconv=require(_0xdca5('0x4'))[_0xdca5('0x5')];var EventEmitter=require(_0xdca5('0x6'))['EventEmitter'];var utils=require(_0xdca5('0x7'));var logger=require('../../../config/logger')(_0xdca5('0x8'));function EmailImap(_0x47c945,_0x53df56){this[_0xdca5('0x9')]=_0x47c945[_0xdca5('0x9')];this[_0xdca5('0xa')]=this['getAccount'](_0x47c945,_0x53df56);this[_0xdca5('0xb')]=new Imap(this['account']);this['imap'][_0xdca5('0xc')](_0xdca5('0xd'),this[_0xdca5('0xe')]['bind'](this));this[_0xdca5('0xb')]['once'](_0xdca5('0xf'),this['handleEnd'][_0xdca5('0x10')](this));this[_0xdca5('0xb')]['on'](_0xdca5('0x11'),this[_0xdca5('0x12')][_0xdca5('0x10')](this));this[_0xdca5('0xb')][_0xdca5('0x13')]();}util[_0xdca5('0x14')](EmailImap,EventEmitter);EmailImap[_0xdca5('0x15')][_0xdca5('0x16')]=function(_0x51dd97,_0x29558d){var _0x7c906c={'connTimeout':_0x51dd97[_0xdca5('0x17')]?_0x51dd97['connTimeout']*0x3e8:0x2710,'authTimeout':_0x51dd97[_0xdca5('0x18')]?_0x51dd97['authTimeout']*0x3e8:0x1388};if(_0x51dd97['service']){_0x7c906c[_0xdca5('0x19')]=_0x51dd97[_0xdca5('0x19')];if(_0x51dd97[_0xdca5('0x1a')]){_0x7c906c[_0xdca5('0x1b')]=utils[_0xdca5('0x1c')](_0x51dd97[_0xdca5('0x1d')][_0xdca5('0x1e')],_0x51dd97[_0xdca5('0x19')]);}else{_0x7c906c[_0xdca5('0x1f')]=_0x51dd97[_0xdca5('0x1f')];}}else{if(_0x51dd97[_0xdca5('0x20')]){_0x7c906c[_0xdca5('0x19')]=_0x51dd97['user'];_0x7c906c[_0xdca5('0x1f')]=_0x51dd97[_0xdca5('0x1f')];}}_0x7c906c[_0xdca5('0x8')]=_0x29558d||_0x51dd97['user']||_0xdca5('0x21');_0x7c906c['host']=_0x51dd97['host'];_0x7c906c['port']=_0x51dd97[_0xdca5('0x22')]||0x3e1;if(_0x51dd97[_0xdca5('0x23')]){_0x7c906c[_0xdca5('0x23')]=!![];}else{_0x7c906c[_0xdca5('0x23')]=![];_0x7c906c[_0xdca5('0x24')]=_0xdca5('0x25');}return _0x7c906c;};EmailImap[_0xdca5('0x15')]['handleReady']=function(){this[_0xdca5('0xb')][_0xdca5('0x26')](this[_0xdca5('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xdca5('0x15')]['handleOpenBox']=function(_0xeb8525,_0x1b4864){if(_0xeb8525){this[_0xdca5('0x12')](_0xeb8525,!![]);}else{this[_0xdca5('0x27')](_0xdca5('0x28'),_0x1b4864);this[_0xdca5('0x29')]();}};EmailImap['prototype'][_0xdca5('0x2a')]=function(_0x541f15){if(_0x541f15){this[_0xdca5('0x12')](_0x541f15,!![]);}else{this[_0xdca5('0xb')][_0xdca5('0xf')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xdca5('0xb')][_0xdca5('0x2b')]([_0xdca5('0x2c')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0xdca5('0x2d')]=function(_0x1dae04,_0x14e3a9){if(_0x1dae04){this[_0xdca5('0x12')](_0x1dae04,!![]);}else{if(_0x14e3a9[_0xdca5('0x2e')]){try{var _0x363327=this[_0xdca5('0xb')][_0xdca5('0x2f')](_0x14e3a9,{'bodies':'','markSeen':!![]});_0x363327['on']('message',this[_0xdca5('0x30')]['bind'](this));_0x363327['once']('error',this[_0xdca5('0x31')][_0xdca5('0x10')](this));_0x363327['once'](_0xdca5('0xf'),this[_0xdca5('0x32')]['bind'](this));}catch(_0x1ceed1){logger['error'](_0x1ceed1);}}else{this['imap'][_0xdca5('0x33')](!![],this[_0xdca5('0x2a')][_0xdca5('0x10')](this));}}};EmailImap[_0xdca5('0x15')][_0xdca5('0x30')]=function(_0x53d390){_0x53d390['on'](_0xdca5('0x34'),this[_0xdca5('0x35')][_0xdca5('0x10')](this));_0x53d390[_0xdca5('0xc')](_0xdca5('0x36'),this['handleMessageAttributes'][_0xdca5('0x10')](this));_0x53d390[_0xdca5('0xc')](_0xdca5('0xf'),this[_0xdca5('0x37')]['bind'](this));};EmailImap[_0xdca5('0x15')][_0xdca5('0x35')]=function(_0x35e892){simpleParser(_0x35e892,{'Iconv':Iconv},this[_0xdca5('0x38')][_0xdca5('0x10')](this));};EmailImap[_0xdca5('0x15')][_0xdca5('0x39')]=function(){};EmailImap[_0xdca5('0x15')][_0xdca5('0x37')]=function(){};EmailImap[_0xdca5('0x15')][_0xdca5('0x38')]=function(_0x2527c5,_0x155f03){if(_0x2527c5){logger['error'](_0x2527c5);}else{var _0x5bf3dc=this;utils[_0xdca5('0x3a')](this['account'],_0x155f03,function(_0x251921){_0x5bf3dc[_0xdca5('0x27')](_0xdca5('0x8'),_0x251921);});}};EmailImap[_0xdca5('0x15')][_0xdca5('0x32')]=function(){this[_0xdca5('0xb')][_0xdca5('0x33')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x3496db){this[_0xdca5('0x12')](_0x3496db);this[_0xdca5('0xb')][_0xdca5('0x33')](!![],this[_0xdca5('0x2a')][_0xdca5('0x10')](this));};EmailImap[_0xdca5('0x15')][_0xdca5('0x3b')]=function(){this['emit'](_0xdca5('0xf'));};EmailImap[_0xdca5('0x15')][_0xdca5('0x12')]=function(_0x4dd512,_0x1bc50c){logger[_0xdca5('0x11')](_0xdca5('0x12'),this['account'][_0xdca5('0x8')],JSON['stringify'](_0x4dd512));var _0x1c3e94='';if(_0x4dd512){if(_0x4dd512[_0xdca5('0x3c')]){_0x1c3e94=_0x4dd512[_0xdca5('0x3c')];}else{for(var _0x39ec0d in _0x4dd512){if(_0x4dd512['hasOwnProperty'](_0x39ec0d)){_0x1c3e94+=_[_0xdca5('0x3d')](_0x39ec0d)+':\x20'+_0x4dd512[_0x39ec0d]+'\x0a';}}}}if(_0x1bc50c){this[_0xdca5('0xb')][_0xdca5('0xf')]();}else{this[_0xdca5('0x27')](_0xdca5('0x11'),_0x1c3e94);this[_0xdca5('0x27')](_0xdca5('0xf'));}};module[_0xdca5('0x3e')]=EmailImap; \ No newline at end of file +var _0x7300=['events','EventEmitter','./utils','getAccount','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','mailbox','handleOpenBox','emit','box','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','email','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x7300,0x1ac));var _0x0730=function(_0x502528,_0x289128){_0x502528=_0x502528-0x0;var _0x570e59=_0x7300[_0x502528];return _0x570e59;};'use strict';var _=require(_0x0730('0x0'));var util=require(_0x0730('0x1'));var Imap=require(_0x0730('0x2'));var simpleParser=require(_0x0730('0x3'))['simpleParser'];var Iconv=require(_0x0730('0x4'))[_0x0730('0x5')];var EventEmitter=require(_0x0730('0x6'))[_0x0730('0x7')];var utils=require(_0x0730('0x8'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1cfe61,_0x4a2d8f){this['mailbox']=_0x1cfe61['mailbox'];this['account']=this[_0x0730('0x9')](_0x1cfe61,_0x4a2d8f);this[_0x0730('0x2')]=new Imap(this[_0x0730('0xa')]);this[_0x0730('0x2')]['once']('ready',this[_0x0730('0xb')][_0x0730('0xc')](this));this[_0x0730('0x2')][_0x0730('0xd')](_0x0730('0xe'),this[_0x0730('0xf')][_0x0730('0xc')](this));this[_0x0730('0x2')]['on'](_0x0730('0x10'),this[_0x0730('0x11')][_0x0730('0xc')](this));this['imap'][_0x0730('0x12')]();}util[_0x0730('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0730('0x9')]=function(_0x4909ba,_0x23b6ad){var _0x57e95={'connTimeout':_0x4909ba['connTimeout']?_0x4909ba[_0x0730('0x14')]*0x3e8:0x2710,'authTimeout':_0x4909ba[_0x0730('0x15')]?_0x4909ba[_0x0730('0x15')]*0x3e8:0x1388};if(_0x4909ba['service']){_0x57e95[_0x0730('0x16')]=_0x4909ba[_0x0730('0x16')];if(_0x4909ba[_0x0730('0x17')]){_0x57e95['xoauth2']=utils[_0x0730('0x18')](_0x4909ba[_0x0730('0x19')][_0x0730('0x1a')],_0x4909ba['user']);}else{_0x57e95[_0x0730('0x1b')]=_0x4909ba['password'];}}else{if(_0x4909ba['authentication']){_0x57e95['user']=_0x4909ba[_0x0730('0x16')];_0x57e95[_0x0730('0x1b')]=_0x4909ba[_0x0730('0x1b')];}}_0x57e95['email']=_0x23b6ad||_0x4909ba[_0x0730('0x16')]||_0x0730('0x1c');_0x57e95[_0x0730('0x1d')]=_0x4909ba['host'];_0x57e95[_0x0730('0x1e')]=_0x4909ba[_0x0730('0x1e')]||0x3e1;if(_0x4909ba['tls']){_0x57e95['tls']=!![];}else{_0x57e95[_0x0730('0x1f')]=![];_0x57e95[_0x0730('0x20')]=_0x0730('0x21');}return _0x57e95;};EmailImap[_0x0730('0x22')][_0x0730('0xb')]=function(){this[_0x0730('0x2')][_0x0730('0x23')](this[_0x0730('0x24')],![],this[_0x0730('0x25')][_0x0730('0xc')](this));};EmailImap[_0x0730('0x22')][_0x0730('0x25')]=function(_0x55f64e,_0x5a9018){if(_0x55f64e){this[_0x0730('0x11')](_0x55f64e,!![]);}else{this[_0x0730('0x26')](_0x0730('0x27'),_0x5a9018);this['readUnseen']();}};EmailImap[_0x0730('0x22')][_0x0730('0x28')]=function(_0xef4c09){if(_0xef4c09){this['handleError'](_0xef4c09,!![]);}else{this[_0x0730('0x2')]['end']();}};EmailImap[_0x0730('0x22')][_0x0730('0x29')]=function(){this['imap']['search']([_0x0730('0x2a')],this[_0x0730('0x2b')][_0x0730('0xc')](this));};EmailImap[_0x0730('0x22')][_0x0730('0x2b')]=function(_0x9b7826,_0x4f2bb6){if(_0x9b7826){this[_0x0730('0x11')](_0x9b7826,!![]);}else{if(_0x4f2bb6[_0x0730('0x2c')]){try{var _0x153e65=this[_0x0730('0x2')]['fetch'](_0x4f2bb6,{'bodies':'','markSeen':!![]});_0x153e65['on'](_0x0730('0x2d'),this[_0x0730('0x2e')]['bind'](this));_0x153e65['once'](_0x0730('0x10'),this[_0x0730('0x2f')][_0x0730('0xc')](this));_0x153e65[_0x0730('0xd')](_0x0730('0xe'),this[_0x0730('0x30')][_0x0730('0xc')](this));}catch(_0x498384){logger[_0x0730('0x10')](_0x498384);}}else{this[_0x0730('0x2')][_0x0730('0x31')](!![],this[_0x0730('0x28')][_0x0730('0xc')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4b669d){_0x4b669d['on'](_0x0730('0x32'),this['handleMessageBody'][_0x0730('0xc')](this));_0x4b669d[_0x0730('0xd')](_0x0730('0x33'),this[_0x0730('0x34')][_0x0730('0xc')](this));_0x4b669d[_0x0730('0xd')]('end',this['handleMessageEnd'][_0x0730('0xc')](this));};EmailImap[_0x0730('0x22')]['handleMessageBody']=function(_0x6107ad){simpleParser(_0x6107ad,{'Iconv':Iconv},this[_0x0730('0x35')][_0x0730('0xc')](this));};EmailImap['prototype'][_0x0730('0x34')]=function(){};EmailImap[_0x0730('0x22')][_0x0730('0x36')]=function(){};EmailImap[_0x0730('0x22')][_0x0730('0x35')]=function(_0x2445bc,_0x453531){if(_0x2445bc){logger[_0x0730('0x10')](_0x2445bc);}else{var _0x1e75e2=this;utils[_0x0730('0x37')](this[_0x0730('0xa')],_0x453531,function(_0x152377){_0x1e75e2[_0x0730('0x26')](_0x0730('0x38'),_0x152377);});}};EmailImap['prototype'][_0x0730('0x30')]=function(){this[_0x0730('0x2')][_0x0730('0x31')](!![],this['handleCloseBox'][_0x0730('0xc')](this));};EmailImap[_0x0730('0x22')][_0x0730('0x2f')]=function(_0x1e9620){this[_0x0730('0x11')](_0x1e9620);this[_0x0730('0x2')]['closeBox'](!![],this[_0x0730('0x28')]['bind'](this));};EmailImap[_0x0730('0x22')]['handleEnd']=function(){this[_0x0730('0x26')](_0x0730('0xe'));};EmailImap[_0x0730('0x22')][_0x0730('0x11')]=function(_0xfa197f,_0x3ce7c6){logger['error'](_0x0730('0x11'),this[_0x0730('0xa')]['email'],JSON[_0x0730('0x39')](_0xfa197f));var _0x2a5b42='';if(_0xfa197f){if(_0xfa197f[_0x0730('0x3a')]){_0x2a5b42=_0xfa197f[_0x0730('0x3a')];}else{for(var _0x5e6648 in _0xfa197f){if(_0xfa197f[_0x0730('0x3b')](_0x5e6648)){_0x2a5b42+=_[_0x0730('0x3c')](_0x5e6648)+':\x20'+_0xfa197f[_0x5e6648]+'\x0a';}}}}if(_0x3ce7c6){this[_0x0730('0x2')][_0x0730('0xe')]();}else{this[_0x0730('0x26')]('error',_0x2a5b42);this[_0x0730('0x26')](_0x0730('0xe'));}};module[_0x0730('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index de7a002..0343d45 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 _0x8450=['prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8450,0x18a));var _0x0845=function(_0x38f4dc,_0x5e9e90){_0x38f4dc=_0x38f4dc-0x0;var _0x2be708=_0x8450[_0x38f4dc];return _0x2be708;};'use strict';var nodemailer=require(_0x0845('0x0'));var inlineBase64=require(_0x0845('0x1'));function EmailSmtp(){}EmailSmtp[_0x0845('0x2')][_0x0845('0x3')]=function(_0x584ea2,_0x358ce2){return new Promise(function(_0x25e277,_0xbb0b51){var _0x14c1a3=nodemailer[_0x0845('0x4')](_0x584ea2);_0x14c1a3[_0x0845('0x5')](_0x0845('0x6'),inlineBase64());_0x14c1a3['sendMail'](_0x358ce2,function(_0xfa87d6,_0x5ecfe1){if(_0xfa87d6){_0xbb0b51(_0xfa87d6[_0x0845('0x7')]());}else{_0x25e277(_0x5ecfe1);}});});};EmailSmtp[_0x0845('0x2')][_0x0845('0x8')]=function(_0xb587ba){return new Promise(function(_0x13333a,_0x392b70){var _0x26566a=nodemailer[_0x0845('0x4')](_0xb587ba);_0x26566a[_0x0845('0x8')](function(_0x5cb67d,_0x3a70bf){if(_0x5cb67d){_0x392b70(_0x5cb67d['toString']());}else{if(_0x3a70bf){_0x13333a(_0x3a70bf);}else{_0x392b70(_0x0845('0x9'));}}});});};module[_0x0845('0xa')]=EmailSmtp; \ No newline at end of file +var _0x66a4=['Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','toString','verify'];(function(_0xa4f2e2,_0x279c18){var _0x1df808=function(_0x38e554){while(--_0x38e554){_0xa4f2e2['push'](_0xa4f2e2['shift']());}};_0x1df808(++_0x279c18);}(_0x66a4,0x1cd));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x466a('0x0'));function EmailSmtp(){}EmailSmtp[_0x466a('0x1')]['send']=function(_0x35f8c9,_0x3f660d){return new Promise(function(_0x2377bd,_0x4c89e9){var _0x1ee87e=nodemailer[_0x466a('0x2')](_0x35f8c9);_0x1ee87e[_0x466a('0x3')](_0x466a('0x4'),inlineBase64());_0x1ee87e['sendMail'](_0x3f660d,function(_0x2aff2e,_0x4cd586){if(_0x2aff2e){_0x4c89e9(_0x2aff2e[_0x466a('0x5')]());}else{_0x2377bd(_0x4cd586);}});});};EmailSmtp['prototype']['verify']=function(_0x4a9b1f){return new Promise(function(_0x2d3df1,_0x5dbb9c){var _0x79bdda=nodemailer['createTransport'](_0x4a9b1f);_0x79bdda[_0x466a('0x6')](function(_0x52d4b9,_0x5ea255){if(_0x52d4b9){_0x5dbb9c(_0x52d4b9[_0x466a('0x5')]());}else{if(_0x5ea255){_0x2d3df1(_0x5ea255);}else{_0x5dbb9c(_0x466a('0x7'));}}});});};module[_0x466a('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index ddec753..d01c787 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 _0x8c94=['X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','date','format','filter','application/ms-tnef','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','@xcally.com','value','name','substring','indexOf','split','length','pop','isEmpty','generate','html','attachments','forEach','push','filename','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3a0b72['slice'](0x0,-0x1)['join']('\x20'):_0x6a865e['name'];}return'Anonymous';}function getLastName(_0x3911d2){var _0x3f36c2=_[_0x48c9('0x7')](_0x3911d2['value']);if(_0x3f36c2&&_0x3f36c2[_0x48c9('0xb')]){var _0x5cc1b5=_0x3f36c2[_0x48c9('0xb')][_0x48c9('0xe')](/\s+/);return _0x5cc1b5[_0x48c9('0xf')]>0x1?_0x5cc1b5[_0x48c9('0x10')]():'';}return'';}function getMails(_0x9ec01d,_0x54624d){var _0x5e8df9='';for(var _0x2946b2=0x0;_0x2946b2<_0x54624d['value'][_0x48c9('0xf')];_0x2946b2+=0x1){if(_0x54624d['value'][_0x2946b2]['address']!==_0x9ec01d){if(!_[_0x48c9('0x11')](_0x5e8df9)){_0x5e8df9+=',';}_0x5e8df9+=_0x54624d[_0x48c9('0xa')][_0x2946b2]['name']||_0x54624d[_0x48c9('0xa')][_0x2946b2]['address']||'';_0x5e8df9+='\x20<';_0x5e8df9+=_0x54624d[_0x48c9('0xa')][_0x2946b2][_0x48c9('0x8')]?_0x54624d[_0x48c9('0xa')][_0x2946b2]['address']:'anonymous'+random[_0x48c9('0x12')](0x6)+_0x48c9('0x9');_0x5e8df9+='>';}}return _0x5e8df9;}function parseEmail(_0x34ab6a,_0x16eaa8,_0x3084b3){if(_0x16eaa8[_0x48c9('0x13')]){var _0x6161ae=/)<[^<]*)*<\/script>/gi;while(_0x6161ae['test'](_0x16eaa8[_0x48c9('0x13')])){_0x16eaa8[_0x48c9('0x13')]=_0x16eaa8[_0x48c9('0x13')]['replace'](_0x6161ae,'');}if(_0x16eaa8[_0x48c9('0x13')]['includes']('{_0x293abf[_0x48c9('0x16')](_0xe2e681[_0x48c9('0x17')]);});var _0x51e6af=/]+>/g;var _0x2a939c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48619f=_0x16eaa8[_0x48c9('0x13')][_0x48c9('0x18')](_0x2a939c,_0x48c9('0x19'));var _0x4f320f=_0x48619f['replace'](_0x51e6af,'_IMG');for(let _0x19e20b=0x0;_0x19e20b<_0x293abf[_0x48c9('0xf')];_0x19e20b++){var _0x5bf9e1=_0x4f320f['replace'](_0x48c9('0x1a'),_0x48c9('0x1b')+_0x293abf[_0x19e20b]+_0x48c9('0x1c'));_0x4f320f=_0x5bf9e1;}_0x16eaa8['html']=_0x4f320f;}_0x3084b3[_0x48c9('0x1d')]=_0x16eaa8[_0x48c9('0x13')];}else{_0x3084b3[_0x48c9('0x1d')]=_0x16eaa8[_0x48c9('0x1e')];}if(_0x3084b3[_0x48c9('0x1d')]){_0x3084b3[_0x48c9('0x1d')]=_0x3084b3[_0x48c9('0x1d')][_0x48c9('0x18')](/0x0){var _0x5cdcc4=[_0x48c9('0x2f'),_0x48c9('0x30'),_0x48c9('0x31')];for(var _0x70de20=0x0;_0x70de20<_0x16eaa8[_0x48c9('0x2e')][_0x48c9('0xf')];_0x70de20++){var _0x33b5b4=_[_0x48c9('0xd')](_0x5cdcc4,_0x16eaa8['headerLines'][_0x70de20][_0x48c9('0x32')]);if(_0x33b5b4>=0x0){_0x3084b3['isAutoreply']=!![];}}}return _0x3084b3;}exports[_0x48c9('0x33')]=function(_0x639eee,_0x5e65f7,_0x1e3de5){var _0x193da0={'from':getAddress(_0x5e65f7[_0x48c9('0x34')]),'firstName':getFirstName(_0x5e65f7[_0x48c9('0x34')]),'lastName':getLastName(_0x5e65f7[_0x48c9('0x34')]),'mapKey':'email','message':{'from':getMails(_0x639eee[_0x48c9('0x21')],_0x5e65f7[_0x48c9('0x34')]),'to':_0x639eee[_0x48c9('0x21')],'cc':'','subject':_0x5e65f7[_0x48c9('0x35')]||'','messageId':_0x5e65f7[_0x48c9('0x36')],'inReplyTo':_0x5e65f7[_0x48c9('0x37')],'sentAt':moment(_0x5e65f7[_0x48c9('0x38')])[_0x48c9('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x5e65f7[_0x48c9('0x13')]&&!_0x5e65f7['textAsHtml']){var _0x5d74f9=_[_0x48c9('0x3a')](_0x5e65f7[_0x48c9('0x14')],{'contentType':_0x48c9('0x3b')});if(_0x5d74f9['length']){logger['info'](util[_0x48c9('0x39')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5e65f7['messageId']));tnef[_0x48c9('0x3c')](_[_0x48c9('0x3d')](_0x5d74f9)[_0x48c9('0x3e')],function(_0x3fc6f0,_0x54f6c0){if(_0x54f6c0){_0x5e65f7['html']=_0x54f6c0[_0x48c9('0x3f')]||_0x48c9('0x40');if(_0x54f6c0[_0x48c9('0x41')]){for(var _0x258e77=0x0;_0x258e77<_0x54f6c0[_0x48c9('0x41')][_0x48c9('0xf')];_0x258e77++){var _0x2aabbf=_0x54f6c0[_0x48c9('0x41')][_0x258e77];_0x193da0['message'][_0x48c9('0x14')][_0x48c9('0x16')]({'filename':_0x2aabbf[_0x48c9('0x42')],'content':Buffer['from'](_0x2aabbf['Data'])});}}}_0x1e3de5(parseEmail(_0x639eee,_0x5e65f7,_0x193da0));});}else{_0x5e65f7[_0x48c9('0x13')]='

Empty\x20message

';_0x1e3de5(parseEmail(_0x639eee,_0x5e65f7,_0x193da0));}}else{_0x1e3de5(parseEmail(_0x639eee,_0x5e65f7,_0x193da0));}};exports[_0x48c9('0x43')]=function(_0x28126c,_0x1e90b8){var _0x5da2c7=[_0x48c9('0x44')+(_0x1e90b8||''),_0x48c9('0x45')+_0x28126c,'',''];return Buffer['from'](_0x5da2c7[_0x48c9('0x46')](''),_0x48c9('0x47'))[_0x48c9('0x48')](_0x48c9('0x49'));}; \ No newline at end of file +var _0x580a=['anonymous','generate','name','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','test','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address'];(function(_0x37633b,_0x2fce3e){var _0x5cdfd9=function(_0x2aafe6){while(--_0x2aafe6){_0x37633b['push'](_0x37633b['shift']());}};_0x5cdfd9(++_0x2fce3e);}(_0x580a,0x129));var _0xa580=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x580a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa580('0x0'));var moment=require(_0xa580('0x1'));var random=require(_0xa580('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xa580('0x3'));var tnef=require(_0xa580('0x4'));var logger=require(_0xa580('0x5'))(_0xa580('0x6'));var config=require(_0xa580('0x7'));function getAddress(_0x408ed8){var _0x53155f=_[_0xa580('0x8')](_0x408ed8[_0xa580('0x9')]);return _0x53155f&&_0x53155f[_0xa580('0xa')]?_0x53155f[_0xa580('0xa')]:_0xa580('0xb')+random[_0xa580('0xc')](0x6)+'@xcally.com';}function getFirstName(_0x5e0f6a){var _0x53d4ed=_[_0xa580('0x8')](_0x5e0f6a['value']);if(_0x53d4ed&&_0x53d4ed[_0xa580('0xd')]){if(_0x53d4ed['name']==_0x53d4ed[_0xa580('0xa')]){return _0x53d4ed[_0xa580('0xd')]['substring'](0x0,_0x53d4ed[_0xa580('0xd')][_0xa580('0xe')]('@'));}var _0x1ab14c=_0x53d4ed['name'][_0xa580('0xf')](/\s+/);return _0x1ab14c['length']>0x1?_0x1ab14c[_0xa580('0x10')](0x0,-0x1)[_0xa580('0x11')]('\x20'):_0x53d4ed[_0xa580('0xd')];}return _0xa580('0x12');}function getLastName(_0x3ee05a){var _0x5dc3de=_[_0xa580('0x8')](_0x3ee05a['value']);if(_0x5dc3de&&_0x5dc3de[_0xa580('0xd')]){var _0x161151=_0x5dc3de[_0xa580('0xd')][_0xa580('0xf')](/\s+/);return _0x161151[_0xa580('0x13')]>0x1?_0x161151[_0xa580('0x14')]():'';}return'';}function getMails(_0x5a02fa,_0x27aea4){var _0x3c43b1='';for(var _0x4da31a=0x0;_0x4da31a<_0x27aea4['value'][_0xa580('0x13')];_0x4da31a+=0x1){if(_0x27aea4[_0xa580('0x9')][_0x4da31a][_0xa580('0xa')]!==_0x5a02fa){if(!_[_0xa580('0x15')](_0x3c43b1)){_0x3c43b1+=',';}_0x3c43b1+=_0x27aea4[_0xa580('0x9')][_0x4da31a][_0xa580('0xd')]||_0x27aea4['value'][_0x4da31a][_0xa580('0xa')]||'';_0x3c43b1+='\x20<';_0x3c43b1+=_0x27aea4[_0xa580('0x9')][_0x4da31a][_0xa580('0xa')]?_0x27aea4['value'][_0x4da31a]['address']:_0xa580('0xb')+random[_0xa580('0xc')](0x6)+_0xa580('0x16');_0x3c43b1+='>';}}return _0x3c43b1;}function parseEmail(_0x58c977,_0x36d4a8,_0x8b0cb1){if(_0x36d4a8[_0xa580('0x17')]){var _0x490ada=/)<[^<]*)*<\/script>/gi;while(_0x490ada[_0xa580('0x18')](_0x36d4a8[_0xa580('0x17')])){_0x36d4a8[_0xa580('0x17')]=_0x36d4a8[_0xa580('0x17')][_0xa580('0x19')](_0x490ada,'');}if(_0x36d4a8['html']['includes'](_0xa580('0x1a'))){var _0x53c8a2=[];_0x36d4a8['attachments'][_0xa580('0x1b')](_0x2a9895=>{_0x53c8a2[_0xa580('0x1c')](_0x2a9895[_0xa580('0x1d')]);});var _0x4ddb66=/]+>/g;var _0x4db436=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5aa48d=_0x36d4a8[_0xa580('0x17')][_0xa580('0x19')](_0x4db436,_0xa580('0x1e'));var _0x2a09d2=_0x5aa48d[_0xa580('0x19')](_0x4ddb66,_0xa580('0x1f'));for(let _0x3ee4ec=0x0;_0x3ee4ec<_0x53c8a2[_0xa580('0x13')];_0x3ee4ec++){var _0x3f6c37=_0x2a09d2[_0xa580('0x19')](_0xa580('0x1f'),_0xa580('0x20')+_0x53c8a2[_0x3ee4ec]+_0xa580('0x21'));_0x2a09d2=_0x3f6c37;}_0x36d4a8['html']=_0x2a09d2;}_0x8b0cb1[_0xa580('0x22')]=_0x36d4a8[_0xa580('0x17')];}else{_0x8b0cb1[_0xa580('0x22')]=_0x36d4a8['textAsHtml'];}if(_0x8b0cb1[_0xa580('0x22')]){_0x8b0cb1[_0xa580('0x22')]=_0x8b0cb1[_0xa580('0x22')][_0xa580('0x19')](/0x0){var _0x5759cb=['Auto-Submitted:\x20auto-replied',_0xa580('0x33'),_0xa580('0x34')];for(var _0x1ffcea=0x0;_0x1ffcea<_0x36d4a8[_0xa580('0x32')][_0xa580('0x13')];_0x1ffcea++){var _0x35a1b2=_['indexOf'](_0x5759cb,_0x36d4a8[_0xa580('0x32')][_0x1ffcea][_0xa580('0x35')]);if(_0x35a1b2>=0x0){_0x8b0cb1[_0xa580('0x36')]=!![];}}}return _0x8b0cb1;}exports[_0xa580('0x37')]=function(_0x5c3739,_0x3df8ff,_0x52503c){var _0x2813d6={'from':getAddress(_0x3df8ff[_0xa580('0x38')]),'firstName':getFirstName(_0x3df8ff[_0xa580('0x38')]),'lastName':getLastName(_0x3df8ff[_0xa580('0x38')]),'mapKey':_0xa580('0x6'),'message':{'from':getMails(_0x5c3739[_0xa580('0x6')],_0x3df8ff[_0xa580('0x38')]),'to':_0x5c3739[_0xa580('0x6')],'cc':'','subject':_0x3df8ff[_0xa580('0x39')]||'','messageId':_0x3df8ff[_0xa580('0x3a')],'inReplyTo':_0x3df8ff['inReplyTo'],'sentAt':moment(_0x3df8ff[_0xa580('0x3b')])[_0xa580('0x2d')](_0xa580('0x3c')),'attach':![],'attachments':[]}};if(!_0x3df8ff[_0xa580('0x17')]&&!_0x3df8ff[_0xa580('0x3d')]){var _0x3b5833=_[_0xa580('0x3e')](_0x3df8ff['attachments'],{'contentType':_0xa580('0x3f')});if(_0x3b5833['length']){logger[_0xa580('0x40')](util['format'](_0xa580('0x41'),_0x3df8ff[_0xa580('0x3a')]));tnef[_0xa580('0x42')](_[_0xa580('0x43')](_0x3b5833)['content'],function(_0x289898,_0x22bd63){if(_0x22bd63){_0x3df8ff[_0xa580('0x17')]=_0x22bd63[_0xa580('0x44')]||_0xa580('0x45');if(_0x22bd63[_0xa580('0x46')]){for(var _0xed9e0c=0x0;_0xed9e0c<_0x22bd63[_0xa580('0x46')]['length'];_0xed9e0c++){var _0x30ab05=_0x22bd63[_0xa580('0x46')][_0xed9e0c];_0x2813d6[_0xa580('0x24')][_0xa580('0x29')][_0xa580('0x1c')]({'filename':_0x30ab05[_0xa580('0x47')],'content':Buffer[_0xa580('0x38')](_0x30ab05['Data'])});}}}_0x52503c(parseEmail(_0x5c3739,_0x3df8ff,_0x2813d6));});}else{_0x3df8ff[_0xa580('0x17')]='

Empty\x20message

';_0x52503c(parseEmail(_0x5c3739,_0x3df8ff,_0x2813d6));}}else{_0x52503c(parseEmail(_0x5c3739,_0x3df8ff,_0x2813d6));}};exports[_0xa580('0x48')]=function(_0x579170,_0x22ad2d){var _0x261651=[_0xa580('0x49')+(_0x22ad2d||''),_0xa580('0x4a')+_0x579170,'',''];return Buffer[_0xa580('0x38')](_0x261651['join'](''),'utf-8')[_0xa580('0x4b')](_0xa580('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f057478..7e21338 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 _0xad3b=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3760d9,_0x53a753){var _0x3ac841=function(_0x2c57d6){while(--_0x2c57d6){_0x3760d9['push'](_0x3760d9['shift']());}};_0x3ac841(++_0x53a753);}(_0xad3b,0x1b5));var _0xbad3=function(_0x381dbb,_0x4a1419){_0x381dbb=_0x381dbb-0x0;var _0x301378=_0xad3b[_0x381dbb];return _0x301378;};'use strict';var _=require(_0xbad3('0x0'));function MailAccount(_0x5b40e8){this['id']=_0x5b40e8['id']||0x0;this[_0xbad3('0x1')]=_0x5b40e8['name']||_0xbad3('0x2');this[_0xbad3('0x3')]=_0x5b40e8[_0xbad3('0x3')]||_0xbad3('0x4');this[_0xbad3('0x5')]=_0x5b40e8[_0xbad3('0x5')]||![];this[_0xbad3('0x6')]=_0x5b40e8[_0xbad3('0x6')]||[];this[_0xbad3('0x7')]=_0x5b40e8['Smtp']||[];}module[_0xbad3('0x8')]=MailAccount; \ No newline at end of file +var _0x2e0d=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0xf6d245,_0x48d766){var _0xfa7129=function(_0x5d540f){while(--_0x5d540f){_0xf6d245['push'](_0xf6d245['shift']());}};_0xfa7129(++_0x48d766);}(_0x2e0d,0xee));var _0xd2e0=function(_0x595a92,_0x2342d0){_0x595a92=_0x595a92-0x0;var _0x184bf2=_0x2e0d[_0x595a92];return _0x184bf2;};'use strict';var _=require(_0xd2e0('0x0'));function MailAccount(_0x39c21e){this['id']=_0x39c21e['id']||0x0;this[_0xd2e0('0x1')]=_0x39c21e[_0xd2e0('0x1')]||_0xd2e0('0x2');this[_0xd2e0('0x3')]=_0x39c21e['key']||_0xd2e0('0x4');this[_0xd2e0('0x5')]=_0x39c21e[_0xd2e0('0x5')]||![];this[_0xd2e0('0x6')]=_0x39c21e[_0xd2e0('0x6')]||[];this[_0xd2e0('0x7')]=_0x39c21e[_0xd2e0('0x7')]||[];}module[_0xd2e0('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0c13216..1138d7f 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 _0x4d25=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','exports'];(function(_0x2170e3,_0x39d8c4){var _0x4b1363=function(_0x1dd4c1){while(--_0x1dd4c1){_0x2170e3['push'](_0x2170e3['shift']());}};_0x4b1363(++_0x39d8c4);}(_0x4d25,0x1d4));var _0x54d2=function(_0x11a4a6,_0x598633){_0x11a4a6=_0x11a4a6-0x0;var _0x275c9b=_0x4d25[_0x11a4a6];return _0x275c9b;};'use strict';var _=require('lodash');var MailAccount=require(_0x54d2('0x0'));var Realtime=function(){this[_0x54d2('0x1')]={};};function freeIsNotKey(_0x3ebd5f,_0x5d55e4,_0xa1cde4){var _0x400b86=_[_0x54d2('0x2')](_0x3ebd5f,function(_0x542610,_0x31a283){return _0x542610[_0xa1cde4];});for(var _0x419c06 in _0x5d55e4){if(_0x5d55e4[_0x54d2('0x3')](_0x419c06)){if(!_0x400b86[_0x419c06]){delete _0x5d55e4[_0x419c06];}}}}Realtime['prototype'][_0x54d2('0x4')]=function(_0xd230ee,_0x2443c2){for(var _0x45c656 in _0x2443c2){if(_0xd230ee[_0x54d2('0x3')](_0x45c656)){_0xd230ee[_0x45c656]=_0x2443c2[_0x45c656];}}};Realtime[_0x54d2('0x5')][_0x54d2('0x6')]=function(){var _0x1e17d6=this;return function(_0x30929f){if(_0x30929f){freeIsNotKey(_0x30929f,_0x1e17d6[_0x54d2('0x1')],'id');for(var _0x42c68b=0x0,_0x3e7a82={},_0x374a80={};_0x42c68b<_0x30929f[_0x54d2('0x7')];_0x42c68b+=0x1){_0x3e7a82=_0x30929f[_0x42c68b];if(_['isUndefined'](_0x1e17d6[_0x54d2('0x1')][_0x3e7a82['id']])){_0x1e17d6[_0x54d2('0x1')][_0x3e7a82['id']]=new MailAccount(_0x3e7a82);}else{_['merge'](_0x1e17d6[_0x54d2('0x1')][_0x3e7a82['id']],_0x3e7a82);}}}return _0x1e17d6['mailAccounts'];};};module[_0x54d2('0x8')]=Realtime; \ No newline at end of file +var _0xda56=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','exports','lodash','../model/mailAccount'];(function(_0x1bd206,_0xebe1d0){var _0x218d8a=function(_0x3d3fc9){while(--_0x3d3fc9){_0x1bd206['push'](_0x1bd206['shift']());}};_0x218d8a(++_0xebe1d0);}(_0xda56,0x19c));var _0x6da5=function(_0x24c9d0,_0x4967b6){_0x24c9d0=_0x24c9d0-0x0;var _0x58c87f=_0xda56[_0x24c9d0];return _0x58c87f;};'use strict';var _=require(_0x6da5('0x0'));var MailAccount=require(_0x6da5('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3b35f3,_0x137873,_0x3ea246){var _0x5aba43=_['mapKeys'](_0x3b35f3,function(_0x446004,_0x444333){return _0x446004[_0x3ea246];});for(var _0x1dfe3f in _0x137873){if(_0x137873[_0x6da5('0x2')](_0x1dfe3f)){if(!_0x5aba43[_0x1dfe3f]){delete _0x137873[_0x1dfe3f];}}}}Realtime[_0x6da5('0x3')][_0x6da5('0x4')]=function(_0x40efeb,_0x43e462){for(var _0x96b7e3 in _0x43e462){if(_0x40efeb[_0x6da5('0x2')](_0x96b7e3)){_0x40efeb[_0x96b7e3]=_0x43e462[_0x96b7e3];}}};Realtime[_0x6da5('0x3')][_0x6da5('0x5')]=function(){var _0x41599b=this;return function(_0x5185a7){if(_0x5185a7){freeIsNotKey(_0x5185a7,_0x41599b[_0x6da5('0x6')],'id');for(var _0x5c997d=0x0,_0x2154e5={},_0x494365={};_0x5c997d<_0x5185a7[_0x6da5('0x7')];_0x5c997d+=0x1){_0x2154e5=_0x5185a7[_0x5c997d];if(_['isUndefined'](_0x41599b['mailAccounts'][_0x2154e5['id']])){_0x41599b[_0x6da5('0x6')][_0x2154e5['id']]=new MailAccount(_0x2154e5);}else{_['merge'](_0x41599b[_0x6da5('0x6')][_0x2154e5['id']],_0x2154e5);}}}return _0x41599b[_0x6da5('0x6')];};};module[_0x6da5('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 255ec95..2618165 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 _0xfcf0=['ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service','active','key'];(function(_0x87114f,_0x455465){var _0x2f38d2=function(_0xaf67a4){while(--_0xaf67a4){_0x87114f['push'](_0x87114f['shift']());}};_0x2f38d2(++_0x455465);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xfcf0[_0x2aec52];return _0x3b8835;};'use strict';var client=require(_0x0fcf('0x0'));exports[_0x0fcf('0x1')]=function(){return function(){return client['Request'](_0x0fcf('0x2'),{'options':{'attributes':['id',_0x0fcf('0x3'),_0x0fcf('0x4'),_0x0fcf('0x5'),'email',_0x0fcf('0x6'),_0x0fcf('0x7'),_0x0fcf('0x8'),_0x0fcf('0x9')],'raw':![],'include':[{'model':_0x0fcf('0xa'),'as':_0x0fcf('0xb'),'include':[{'model':_0x0fcf('0xc'),'attributes':['id',_0x0fcf('0x3'),'service',_0x0fcf('0xd'),_0x0fcf('0xe')],'as':_0x0fcf('0xc')}]},{'model':'MailServerOut','as':_0x0fcf('0xf'),'include':[{'model':_0x0fcf('0xc'),'attributes':['id',_0x0fcf('0x3'),'service',_0x0fcf('0xd'),'data5'],'as':_0x0fcf('0xc')}]}]},'log':_0x0fcf('0x10')});};};exports[_0x0fcf('0x11')]=function(_0x48619c,_0x5f40fb){return client[_0x0fcf('0x12')](_0x0fcf('0x13'),{'account':{'id':_0x48619c},'body':_0x5f40fb,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x9541=['getMailAccounts','Request','GetMailAccount','name','provider','service','email','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','../client'];(function(_0x32d7f6,_0x3c3ca6){var _0x353fbd=function(_0x92caee){while(--_0x92caee){_0x32d7f6['push'](_0x32d7f6['shift']());}};_0x353fbd(++_0x3c3ca6);}(_0x9541,0xb3));var _0x1954=function(_0x4da7aa,_0x309249){_0x4da7aa=_0x4da7aa-0x0;var _0x470a3f=_0x9541[_0x4da7aa];return _0x470a3f;};'use strict';var client=require(_0x1954('0x0'));exports[_0x1954('0x1')]=function(){return function(){return client[_0x1954('0x2')](_0x1954('0x3'),{'options':{'attributes':['id',_0x1954('0x4'),_0x1954('0x5'),_0x1954('0x6'),_0x1954('0x7'),'active','key',_0x1954('0x8'),_0x1954('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x1954('0xa'),'include':[{'model':_0x1954('0xb'),'attributes':['id',_0x1954('0x4'),_0x1954('0x6'),_0x1954('0xc'),_0x1954('0xd')],'as':'CloudProvider'}]},{'model':_0x1954('0xe'),'as':_0x1954('0xf'),'include':[{'model':_0x1954('0xb'),'attributes':['id',_0x1954('0x4'),_0x1954('0x6'),_0x1954('0xc'),_0x1954('0xd')],'as':_0x1954('0xb')}]}]},'log':'getMailAccount'});};};exports[_0x1954('0x10')]=function(_0x2e1fb4,_0x51a041){return client[_0x1954('0x2')]('NotifyMailAccount',{'account':{'id':_0x2e1fb4},'body':_0x51a041,'log':_0x1954('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f5f1544..cb68172 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 _0xd4b2=['ShowSetting','loginMailFrequency','getSettings','Request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd4b2,0x1a2));var _0x2d4b=function(_0x3ee6bc,_0x4025bb){_0x3ee6bc=_0x3ee6bc-0x0;var _0x5bda78=_0xd4b2[_0x3ee6bc];return _0x5bda78;};'use strict';var client=require('../client');exports[_0x2d4b('0x0')]=function(){return client[_0x2d4b('0x1')](_0x2d4b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2d4b('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xa2cf=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xa2cf,0x9d));var _0xfa2c=function(_0x4265f2,_0x36e7ac){_0x4265f2=_0x4265f2-0x0;var _0x5b5c01=_0xa2cf[_0x4265f2];return _0x5b5c01;};'use strict';var client=require(_0xfa2c('0x0'));exports[_0xfa2c('0x1')]=function(){return client[_0xfa2c('0x2')](_0xfa2c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfa2c('0x4')]},'log':_0xfa2c('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a2dee4e..ecffd50 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 088384b..5b4c0a8 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 _0x74b5=['port','socket.io','websocket','redis','defaults','localhost','../../config/socketio','default','../../config/express','../../routes','once','listening','log','exports','http','express','ioredis','../../config/environment','createServer','timeout','listen'];(function(_0x3c7861,_0xf16da4){var _0xd5d723=function(_0xc5886c){while(--_0xc5886c){_0x3c7861['push'](_0x3c7861['shift']());}};_0xd5d723(++_0xf16da4);}(_0x74b5,0x188));var _0x574b=function(_0x2e082b,_0x5c7359){_0x2e082b=_0x2e082b-0x0;var _0x390c2c=_0x74b5[_0x2e082b];return _0x390c2c;};'use strict';var _=require('lodash');var http=require(_0x574b('0x0'));var express=require(_0x574b('0x1'));var sticky=require('sticky-session');var Redis=require(_0x574b('0x2'));var config=require(_0x574b('0x3'));var app=express();var server=http[_0x574b('0x4')](app);server[_0x574b('0x5')]=0xdbba0;if(sticky[_0x574b('0x6')](server,config[_0x574b('0x7')])){var socketio=require(_0x574b('0x8'))(server,{'transports':[_0x574b('0x9'),'polling']});config[_0x574b('0xa')]=_[_0x574b('0xb')](config[_0x574b('0xa')],{'host':_0x574b('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x574b('0xa')])}));require('../../config/triggers')['default']();require(_0x574b('0xd'))[_0x574b('0xe')](socketio);require(_0x574b('0xf'))[_0x574b('0xe')](app);require(_0x574b('0x10'))[_0x574b('0xe')](app);}else{server[_0x574b('0x11')](_0x574b('0x12'),function(){console[_0x574b('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x574b('0x7')]);});}exports=module[_0x574b('0x14')]=app; \ No newline at end of file +var _0xa7c7=['../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','sticky-session','ioredis'];(function(_0x2d2a1c,_0x29b5eb){var _0x491d7d=function(_0x567441){while(--_0x567441){_0x2d2a1c['push'](_0x2d2a1c['shift']());}};_0x491d7d(++_0x29b5eb);}(_0xa7c7,0x1a6));var _0x7a7c=function(_0x4e1eae,_0x37b3d0){_0x4e1eae=_0x4e1eae-0x0;var _0x2f89d8=_0xa7c7[_0x4e1eae];return _0x2f89d8;};'use strict';var _=require(_0x7a7c('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x7a7c('0x1'));var Redis=require(_0x7a7c('0x2'));var config=require(_0x7a7c('0x3'));var app=express();var server=http[_0x7a7c('0x4')](app);server[_0x7a7c('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x7a7c('0x6'))(server,{'transports':[_0x7a7c('0x7'),_0x7a7c('0x8')]});config[_0x7a7c('0x9')]=_[_0x7a7c('0xa')](config[_0x7a7c('0x9')],{'host':_0x7a7c('0xb'),'port':0x18eb});socketio[_0x7a7c('0xc')](require(_0x7a7c('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x7a7c('0x9')])}));require(_0x7a7c('0xe'))['default']();require(_0x7a7c('0xf'))[_0x7a7c('0x10')](socketio);require(_0x7a7c('0x11'))['default'](app);require(_0x7a7c('0x12'))[_0x7a7c('0x10')](app);}else{server[_0x7a7c('0x13')](_0x7a7c('0x14'),function(){console[_0x7a7c('0x15')](_0x7a7c('0x16'),config[_0x7a7c('0x17')]);});}exports=module[_0x7a7c('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5022b5e..8e19fe4 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 _0x1d75=['catch','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x1d75,0x17b));var _0x51d7=function(_0x48e773,_0x453de7){_0x48e773=_0x48e773-0x0;var _0x1845a4=_0x1d75[_0x48e773];return _0x1845a4;};'use strict';var jayson=require(_0x51d7('0x0'));var BPromise=require(_0x51d7('0x1'));var logger=require(_0x51d7('0x2'))(_0x51d7('0x3'));var client=jayson[_0x51d7('0x4')][_0x51d7('0x5')]({'port':0x2329});client['Request']=function(_0x28fbae,_0x2bdb32){return new BPromise(function(_0x21d330,_0x15753e){return client[_0x51d7('0x6')](_0x28fbae,_0x2bdb32)[_0x51d7('0x7')](function(_0x2c1973){logger[_0x51d7('0x8')](_0x51d7('0x9'),_0x51d7('0x3'),_0x28fbae,_0x2bdb32,_0x2c1973);if(_0x2c1973[_0x51d7('0xa')]){logger[_0x51d7('0xa')]('rpc',_0x51d7('0x3'),_0x28fbae,_0x2c1973[_0x51d7('0xa')][_0x51d7('0xb')],_0x2bdb32);return _0x15753e(_0x2c1973[_0x51d7('0xa')][_0x51d7('0xb')]);}else{return _0x21d330(_0x2c1973[_0x51d7('0xc')]);}})[_0x51d7('0xd')](function(_0x19a765){logger[_0x51d7('0xa')]('rpc','routing',_0x28fbae,_0x19a765,_0x2bdb32);return _0x15753e(_0x19a765);});});};module['exports']=client; \ No newline at end of file +var _0x93dd=['exports','jayson/promise','../../config/logger','routing','client','http','then','debug','rpc','error','message','result'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x93dd,0xd9));var _0xd93d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x93dd[_0x53ccf2];return _0x5a2964;};'use strict';var jayson=require(_0xd93d('0x0'));var BPromise=require('bluebird');var logger=require(_0xd93d('0x1'))(_0xd93d('0x2'));var client=jayson[_0xd93d('0x3')][_0xd93d('0x4')]({'port':0x2329});client['Request']=function(_0x2422d3,_0x5a4138){return new BPromise(function(_0x3f9985,_0x4030d2){return client['request'](_0x2422d3,_0x5a4138)[_0xd93d('0x5')](function(_0x340db2){logger[_0xd93d('0x6')](_0xd93d('0x7'),_0xd93d('0x2'),_0x2422d3,_0x5a4138,_0x340db2);if(_0x340db2['error']){logger[_0xd93d('0x8')](_0xd93d('0x7'),_0xd93d('0x2'),_0x2422d3,_0x340db2['error'][_0xd93d('0x9')],_0x5a4138);return _0x4030d2(_0x340db2[_0xd93d('0x8')][_0xd93d('0x9')]);}else{return _0x3f9985(_0x340db2[_0xd93d('0xa')]);}})['catch'](function(_0x551c1b){logger[_0xd93d('0x8')](_0xd93d('0x7'),_0xd93d('0x2'),_0x2422d3,_0x551c1b,_0x5a4138);return _0x4030d2(_0x551c1b);});});};module[_0xd93d('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index af77514..d9430ed 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 _0xeaf5=['getWhatsappQueues','initWhatsappQueues','catch','log','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initFaxQueues'];(function(_0xb5e37f,_0xc624f1){var _0x23f431=function(_0x3ec670){while(--_0x3ec670){_0xb5e37f['push'](_0xb5e37f['shift']());}};_0x23f431(++_0xc624f1);}(_0xeaf5,0x100));var _0x5eaf=function(_0x53f707,_0x51a2f7){_0x53f707=_0x53f707-0x0;var _0x10a9f5=_0xeaf5[_0x53f707];return _0x10a9f5;};'use strict';var BPromise=require('bluebird');var server=require(_0x5eaf('0x0'));var Realtime=require('./realtime');var user=require(_0x5eaf('0x1'));var interval=require(_0x5eaf('0x2'));var openchannelQueue=require(_0x5eaf('0x3'));var chatQueue=require(_0x5eaf('0x4'));var smsQueue=require(_0x5eaf('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x5eaf('0x6'));var whatsappQueue=require(_0x5eaf('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x5eaf('0x8')]())[_0x5eaf('0x9')](realtime['initAgents']())[_0x5eaf('0x9')](interval[_0x5eaf('0xa')]())[_0x5eaf('0x9')](realtime['initIntervals']())[_0x5eaf('0x9')](openchannelQueue[_0x5eaf('0xb')]())['then'](realtime[_0x5eaf('0xc')]())[_0x5eaf('0x9')](chatQueue[_0x5eaf('0xd')]())[_0x5eaf('0x9')](realtime[_0x5eaf('0xe')]())[_0x5eaf('0x9')](smsQueue['getSmsQueues']())[_0x5eaf('0x9')](realtime[_0x5eaf('0xf')]())[_0x5eaf('0x9')](mailQueue['getMailQueues']())[_0x5eaf('0x9')](realtime['initMailQueues']())[_0x5eaf('0x9')](faxQueue['getFaxQueues']())[_0x5eaf('0x9')](realtime[_0x5eaf('0x10')]())[_0x5eaf('0x9')](whatsappQueue[_0x5eaf('0x11')]())[_0x5eaf('0x9')](realtime[_0x5eaf('0x12')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x5eaf('0x9')](function(_0x101177){return initRealtime();})[_0x5eaf('0x9')](function(_0x340c7a){return setInterval(initRealtime,0x1388);})[_0x5eaf('0x13')](function(_0x4c246d){console[_0x5eaf('0x14')](_0x4c246d);});}main(); \ No newline at end of file +var _0x415a=['getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then'];(function(_0x5ebec4,_0x474731){var _0x3b9d3b=function(_0x3aa9da){while(--_0x3aa9da){_0x5ebec4['push'](_0x5ebec4['shift']());}};_0x3b9d3b(++_0x474731);}(_0x415a,0x122));var _0xa415=function(_0x2b16b2,_0xb4a0d4){_0x2b16b2=_0x2b16b2-0x0;var _0x5533bf=_0x415a[_0x2b16b2];return _0x5533bf;};'use strict';var BPromise=require(_0xa415('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0xa415('0x1'));var interval=require(_0xa415('0x2'));var openchannelQueue=require(_0xa415('0x3'));var chatQueue=require(_0xa415('0x4'));var smsQueue=require(_0xa415('0x5'));var mailQueue=require(_0xa415('0x6'));var faxQueue=require(_0xa415('0x7'));var whatsappQueue=require(_0xa415('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xa415('0x9')](user[_0xa415('0xa')]())[_0xa415('0x9')](realtime[_0xa415('0xb')]())[_0xa415('0x9')](interval[_0xa415('0xc')]())[_0xa415('0x9')](realtime[_0xa415('0xd')]())[_0xa415('0x9')](openchannelQueue[_0xa415('0xe')]())[_0xa415('0x9')](realtime['initOpenchannelQueues']())[_0xa415('0x9')](chatQueue['getChatQueues']())[_0xa415('0x9')](realtime[_0xa415('0xf')]())[_0xa415('0x9')](smsQueue[_0xa415('0x10')]())['then'](realtime[_0xa415('0x11')]())[_0xa415('0x9')](mailQueue[_0xa415('0x12')]())[_0xa415('0x9')](realtime[_0xa415('0x13')]())[_0xa415('0x9')](faxQueue[_0xa415('0x14')]())['then'](realtime[_0xa415('0x15')]())[_0xa415('0x9')](whatsappQueue[_0xa415('0x16')]())[_0xa415('0x9')](realtime['initWhatsappQueues']())[_0xa415('0x9')](function(){return realtime;});}function main(){return server[_0xa415('0x17')](realtime)['then'](function(_0x1d6130){return initRealtime();})[_0xa415('0x9')](function(_0x42c9f1){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4123e8){console[_0xa415('0x18')](_0x4123e8);});}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 6172465..a9f0711 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x3986a5,_0x5bb49){var _0x2b0690=function(_0x28c4c8){while(--_0x28c4c8){_0x3986a5['push'](_0x3986a5['shift']());}};_0x2b0690(++_0x5bb49);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _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(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x326f,0xd1));var _0xf326=function(_0x2842e6,_0x476302){_0x2842e6=_0x2842e6-0x0;var _0x12be7=_0x326f[_0x2842e6];return _0x12be7;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 9d5a029..6c26ae5 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 _0x1d31=['error','result','catch','SendMail','bluebird','client','http','request','then'];(function(_0x87d634,_0x47a1a5){var _0x17a509=function(_0x29b018){while(--_0x29b018){_0x87d634['push'](_0x87d634['shift']());}};_0x17a509(++_0x47a1a5);}(_0x1d31,0x1bd));var _0x11d3=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x1d31[_0x580647];return _0x5f0792;};'use strict';var BPromise=require(_0x11d3('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x11d3('0x1')][_0x11d3('0x2')]({'port':0x232b});function request(_0x5155c0,_0x3bc9f0){return new BPromise(function(_0x4c61e4,_0x50c622){return client[_0x11d3('0x3')](_0x5155c0,_0x3bc9f0)[_0x11d3('0x4')](function(_0x4824c5){if(_0x4824c5[_0x11d3('0x5')]){return _0x50c622(_0x4824c5[_0x11d3('0x5')]['message']);}else{return _0x4c61e4(_0x4824c5[_0x11d3('0x6')]);}})[_0x11d3('0x7')](function(_0x412931){return _0x50c622(_0x412931);});});}exports['sendMailMessage']=function(_0xb64db0,_0x170bd7){return request(_0x11d3('0x8'),{'account':_0xb64db0,'message':_0x170bd7});}; \ No newline at end of file +var _0x6640=['SendMail','bluebird','jayson/promise','client','request','error','message','result','catch','sendMailMessage'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6640,0x137));var _0x0664=function(_0x466f51,_0x1393ed){_0x466f51=_0x466f51-0x0;var _0x2db305=_0x6640[_0x466f51];return _0x2db305;};'use strict';var BPromise=require(_0x0664('0x0'));var jayson=require(_0x0664('0x1'));var client=jayson[_0x0664('0x2')]['http']({'port':0x232b});function request(_0x7c0714,_0x51136e){return new BPromise(function(_0x27a165,_0x4df759){return client[_0x0664('0x3')](_0x7c0714,_0x51136e)['then'](function(_0x3e55b9){if(_0x3e55b9[_0x0664('0x4')]){return _0x4df759(_0x3e55b9[_0x0664('0x4')][_0x0664('0x5')]);}else{return _0x27a165(_0x3e55b9[_0x0664('0x6')]);}})[_0x0664('0x7')](function(_0x29b145){return _0x4df759(_0x29b145);});});}exports[_0x0664('0x8')]=function(_0x6f070e,_0x3c4a80){return request(_0x0664('0x9'),{'account':_0x6f070e,'message':_0x3c4a80});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index dd298dc..af62915 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 _0xd049=['openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','faxStatus','faxCurrentCapacity','smsStatus','smsStatusTime','openchannelCurrentCapacity','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xd049,0x138));var _0x9d04=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd049[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x9d04('0x0'));var moment=require(_0x9d04('0x1'));var md5=require(_0x9d04('0x2'));var Redis=require(_0x9d04('0x3'));var config=require('../../../config/environment');config[_0x9d04('0x4')]=_[_0x9d04('0x5')](config[_0x9d04('0x4')],{'host':_0x9d04('0x6'),'port':0x18eb});var io=require(_0x9d04('0x7'))(new Redis(config[_0x9d04('0x4')]));function Agent(_0x2473cd){this['id']=_0x2473cd['id']||0x0;this[_0x9d04('0x8')]=_0x2473cd['name']||'';this[_0x9d04('0x9')]=_0x2473cd[_0x9d04('0x9')]||!![];this[_0x9d04('0xa')]=_0x2473cd[_0x9d04('0xa')]||![];this[_0x9d04('0xb')]=_0x2473cd[_0x9d04('0xb')]||![];this[_0x9d04('0xc')]=_0x2473cd[_0x9d04('0xc')]||![];this[_0x9d04('0xd')]=_0x2473cd['faxPause']||![];this[_0x9d04('0xe')]=_0x2473cd[_0x9d04('0xe')]||![];this['openchannelPause']=_0x2473cd[_0x9d04('0xf')]||![];this[_0x9d04('0x10')]=_0x9d04('0x11');this[_0x9d04('0x12')]=0x0;this[_0x9d04('0x13')]=_0x2473cd[_0x9d04('0x13')]||0x0;this[_0x9d04('0x14')]=0x0;this[_0x9d04('0x15')]='unknown';this[_0x9d04('0x16')]=0x0;this[_0x9d04('0x17')]=_0x2473cd[_0x9d04('0x17')]||0x0;this[_0x9d04('0x18')]=0x0;this['faxStatus']=_0x9d04('0x11');this[_0x9d04('0x19')]=0x0;this['faxCapacity']=_0x2473cd[_0x9d04('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x9d04('0x11');this['smsStatusTime']=0x0;this[_0x9d04('0x1b')]=_0x2473cd[_0x9d04('0x1b')]||0x0;this[_0x9d04('0x1c')]=0x0;this[_0x9d04('0x1d')]='unknown';this[_0x9d04('0x1e')]=0x0;this[_0x9d04('0x1f')]=_0x2473cd['whatsappCapacity']||0x0;this[_0x9d04('0x20')]=0x0;this[_0x9d04('0x21')]=_0x9d04('0x11');this[_0x9d04('0x22')]=0x0;this[_0x9d04('0x23')]=_0x2473cd[_0x9d04('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x9d04('0x24')]=![];this[_0x9d04('0x25')]=undefined;this[_0x9d04('0x2')]='';this[_0x9d04('0x26')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this[_0x9d04('0x27')]={};this['smsWaitingInteractions']={};this[_0x9d04('0x28')]={};this['updateRealtime']();}Agent[_0x9d04('0x29')][_0x9d04('0x2a')]=function(_0x578f7d){if(this[_0x578f7d+_0x9d04('0x2b')]>0x0){if(this[_0x578f7d+_0x9d04('0x2c')]>0x0&&this[_0x578f7d+'CurrentCapacity']>=this[_0x578f7d+_0x9d04('0x2c')]){return _0x9d04('0x2d');}else{return _0x9d04('0x2e');}}else{return _0x9d04('0x2f');}};Agent[_0x9d04('0x29')][_0x9d04('0x30')]=function(){var _0x1b95ab=[_0x9d04('0x31'),_0x9d04('0x32'),_0x9d04('0x33'),_0x9d04('0x34'),_0x9d04('0x35'),_0x9d04('0x36')];for(var _0x23fcc7=0x0;_0x23fcc7<_0x1b95ab[_0x9d04('0x37')];_0x23fcc7+=0x1){var _0x515d40=this[_0x9d04('0x2a')](_0x1b95ab[_0x23fcc7]);if(this[_0x1b95ab[_0x23fcc7]+_0x9d04('0x38')]!==_0x515d40){this[_0x1b95ab[_0x23fcc7]+_0x9d04('0x39')]=_[_0x9d04('0x3a')](moment()['format']('x'));}this[_0x1b95ab[_0x23fcc7]+_0x9d04('0x38')]=_0x515d40;}var _0x12304b={'id':this['id'],'name':this[_0x9d04('0x8')],'online':this[_0x9d04('0x9')],'voicePause':this[_0x9d04('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x9d04('0xc')],'smsPause':this[_0x9d04('0xe')],'faxPause':this[_0x9d04('0xd')],'openchannelPause':this[_0x9d04('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x9d04('0x12')],'chatCapacity':this[_0x9d04('0x13')],'chatCurrentCapacity':this[_0x9d04('0x14')],'mailStatus':this[_0x9d04('0x15')],'mailStatusTime':this[_0x9d04('0x16')],'mailCapacity':this[_0x9d04('0x17')],'mailCurrentCapacity':this[_0x9d04('0x18')],'faxStatus':this[_0x9d04('0x3b')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x9d04('0x1a')],'faxCurrentCapacity':this[_0x9d04('0x3c')],'smsStatus':this[_0x9d04('0x3d')],'smsStatusTime':this[_0x9d04('0x3e')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x9d04('0x1c')],'whatsappStatus':this[_0x9d04('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x9d04('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x9d04('0x21')],'openchannelStatusTime':this[_0x9d04('0x22')],'openchannelCapacity':this[_0x9d04('0x23')],'openchannelCurrentCapacity':this[_0x9d04('0x3f')],'busy':this[_0x9d04('0x24')],'busyQueue':this[_0x9d04('0x25')],'chatWaitingInteractions':this[_0x9d04('0x26')],'faxWaitingInteractions':this[_0x9d04('0x40')],'mailWaitingInteractions':this[_0x9d04('0x41')],'openchannelWaitingInteractions':this[_0x9d04('0x27')],'smsWaitingInteractions':this[_0x9d04('0x42')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3de2b6=md5(JSON['stringify'](_0x12304b));if(this[_0x9d04('0x2')]!==_0x3de2b6){this[_0x9d04('0x2')]=_0x3de2b6;io['emit'](_0x9d04('0x43'),_0x12304b);}};module[_0x9d04('0x44')]=Agent; \ No newline at end of file +var _0x5da5=['openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','getChannelStatus','StatusTime','toNumber','format','Status','mailStatusTime','whatsappStatus','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity'];(function(_0xd13285,_0x37f4de){var _0x20dd32=function(_0x4afef3){while(--_0x4afef3){_0xd13285['push'](_0xd13285['shift']());}};_0x20dd32(++_0x37f4de);}(_0x5da5,0xaa));var _0x55da=function(_0x52cf53,_0x379bd3){_0x52cf53=_0x52cf53-0x0;var _0x1a3049=_0x5da5[_0x52cf53];return _0x1a3049;};'use strict';var _=require(_0x55da('0x0'));var moment=require(_0x55da('0x1'));var md5=require(_0x55da('0x2'));var Redis=require(_0x55da('0x3'));var config=require(_0x55da('0x4'));config[_0x55da('0x5')]=_[_0x55da('0x6')](config[_0x55da('0x5')],{'host':_0x55da('0x7'),'port':0x18eb});var io=require(_0x55da('0x8'))(new Redis(config[_0x55da('0x5')]));function Agent(_0x171234){this['id']=_0x171234['id']||0x0;this[_0x55da('0x9')]=_0x171234['name']||'';this[_0x55da('0xa')]=_0x171234['online']||!![];this[_0x55da('0xb')]=_0x171234['voicePause']||![];this['chatPause']=_0x171234['chatPause']||![];this[_0x55da('0xc')]=_0x171234['mailPause']||![];this[_0x55da('0xd')]=_0x171234['faxPause']||![];this[_0x55da('0xe')]=_0x171234[_0x55da('0xe')]||![];this['openchannelPause']=_0x171234[_0x55da('0xf')]||![];this[_0x55da('0x10')]=_0x55da('0x11');this[_0x55da('0x12')]=0x0;this[_0x55da('0x13')]=_0x171234[_0x55da('0x13')]||0x0;this[_0x55da('0x14')]=0x0;this[_0x55da('0x15')]=_0x55da('0x11');this['mailStatusTime']=0x0;this[_0x55da('0x16')]=_0x171234[_0x55da('0x16')]||0x0;this[_0x55da('0x17')]=0x0;this[_0x55da('0x18')]='unknown';this[_0x55da('0x19')]=0x0;this[_0x55da('0x1a')]=_0x171234[_0x55da('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x55da('0x1b')]=_0x55da('0x11');this[_0x55da('0x1c')]=0x0;this[_0x55da('0x1d')]=_0x171234['smsCapacity']||0x0;this[_0x55da('0x1e')]=0x0;this['whatsappStatus']=_0x55da('0x11');this[_0x55da('0x1f')]=0x0;this[_0x55da('0x20')]=_0x171234[_0x55da('0x20')]||0x0;this[_0x55da('0x21')]=0x0;this[_0x55da('0x22')]=_0x55da('0x11');this['openchannelStatusTime']=0x0;this[_0x55da('0x23')]=_0x171234['openchannelCapacity']||0x0;this[_0x55da('0x24')]=0x0;this[_0x55da('0x25')]=![];this[_0x55da('0x26')]=undefined;this[_0x55da('0x2')]='';this[_0x55da('0x27')]={};this[_0x55da('0x28')]={};this[_0x55da('0x29')]={};this[_0x55da('0x2a')]={};this[_0x55da('0x2b')]={};this[_0x55da('0x2c')]={};this['updateRealtime']();}Agent[_0x55da('0x2d')]['getChannelStatus']=function(_0x53ecbe){if(this[_0x53ecbe+_0x55da('0x2e')]>0x0){if(this[_0x53ecbe+_0x55da('0x2f')]>0x0&&this[_0x53ecbe+_0x55da('0x2e')]>=this[_0x53ecbe+_0x55da('0x2f')]){return'maxcapacity';}else{return _0x55da('0x30');}}else{return _0x55da('0x31');}};Agent['prototype'][_0x55da('0x32')]=function(){var _0x1a58d9=[_0x55da('0x33'),_0x55da('0x34'),_0x55da('0x35'),_0x55da('0x36'),_0x55da('0x37'),_0x55da('0x38')];for(var _0x406ab7=0x0;_0x406ab7<_0x1a58d9['length'];_0x406ab7+=0x1){var _0x3c23e2=this[_0x55da('0x39')](_0x1a58d9[_0x406ab7]);if(this[_0x1a58d9[_0x406ab7]+'Status']!==_0x3c23e2){this[_0x1a58d9[_0x406ab7]+_0x55da('0x3a')]=_[_0x55da('0x3b')](moment()[_0x55da('0x3c')]('x'));}this[_0x1a58d9[_0x406ab7]+_0x55da('0x3d')]=_0x3c23e2;}var _0x54d3d4={'id':this['id'],'name':this[_0x55da('0x9')],'online':this[_0x55da('0xa')],'voicePause':this[_0x55da('0xb')],'chatPause':this['chatPause'],'mailPause':this[_0x55da('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x55da('0xd')],'openchannelPause':this[_0x55da('0xf')],'chatStatus':this[_0x55da('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x55da('0x13')],'chatCurrentCapacity':this[_0x55da('0x14')],'mailStatus':this[_0x55da('0x15')],'mailStatusTime':this[_0x55da('0x3e')],'mailCapacity':this[_0x55da('0x16')],'mailCurrentCapacity':this[_0x55da('0x17')],'faxStatus':this[_0x55da('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x55da('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x55da('0x1b')],'smsStatusTime':this[_0x55da('0x1c')],'smsCapacity':this[_0x55da('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x55da('0x3f')],'whatsappStatusTime':this[_0x55da('0x1f')],'whatsappCapacity':this[_0x55da('0x20')],'whatsappCurrentCapacity':this[_0x55da('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x55da('0x23')],'openchannelCurrentCapacity':this[_0x55da('0x24')],'busy':this[_0x55da('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x55da('0x27')],'faxWaitingInteractions':this[_0x55da('0x28')],'mailWaitingInteractions':this[_0x55da('0x29')],'openchannelWaitingInteractions':this[_0x55da('0x2a')],'smsWaitingInteractions':this[_0x55da('0x2b')],'whatsappWaitingInteractions':this[_0x55da('0x2c')]};var _0x57e172=md5(JSON[_0x55da('0x40')](_0x54d3d4));if(this[_0x55da('0x2')]!==_0x57e172){this[_0x55da('0x2')]=_0x57e172;io[_0x55da('0x41')](_0x55da('0x42'),_0x54d3d4);}};module[_0x55da('0x43')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 8e61716..26c1f24 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 _0xd302=['md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','online','chatPause','available','waiting','chat:queue:%s','emit','exports','lodash'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xd302,0x1e5));var _0x2d30=function(_0x5947b8,_0x5c8064){_0x5947b8=_0x5947b8-0x0;var _0x4ee2ea=_0xd302[_0x5947b8];return _0x4ee2ea;};'use strict';var _=require(_0x2d30('0x0'));var md5=require(_0x2d30('0x1'));var util=require(_0x2d30('0x2'));var Redis=require(_0x2d30('0x3'));var config=require(_0x2d30('0x4'));config[_0x2d30('0x5')]=_[_0x2d30('0x6')](config[_0x2d30('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2d30('0x7'))(new Redis(config[_0x2d30('0x5')]));function ChatQueue(_0x565031){this['id']=_0x565031['id']||0x0;this['name']=_0x565031[_0x2d30('0x8')]||'';this['timeout']=_0x565031[_0x2d30('0x9')]||0xa;this[_0x2d30('0xa')]=_0x565031['strategy']||'beepall';this['Agents']=_0x565031[_0x2d30('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x2d30('0xc')]();this['updateRealtime']();}ChatQueue[_0x2d30('0xd')][_0x2d30('0xc')]=function(){var _0x35660f=this[_0x2d30('0xe')][_0x2d30('0xf')];this[_0x2d30('0xe')]=_[_0x2d30('0x10')](this[_0x2d30('0xb')],'id');this[_0x2d30('0xe')]['_rr']=_0x35660f;};ChatQueue[_0x2d30('0xd')][_0x2d30('0x11')]=function(){this[_0x2d30('0x12')]=0x0;this[_0x2d30('0x13')]=0x0;for(var _0x3d9de4=0x0;_0x3d9de4=0x0?this[_0x2d30('0x16')]:0x0;var _0xc68682={'id':this['id'],'available':this[_0x2d30('0x16')],'loggedIn':this[_0x2d30('0x12')],'name':this[_0x2d30('0x8')],'paused':this['paused'],'waiting':this[_0x2d30('0x17')]};var _0x3ad125=md5(JSON['stringify'](_0xc68682));if(this[_0x2d30('0x1')]!==_0x3ad125){this[_0x2d30('0x1')]=_0x3ad125;io['to'](util['format'](_0x2d30('0x18'),_0xc68682[_0x2d30('0x8')]))[_0x2d30('0x19')]('chat_queue:save',_0xc68682);}};module[_0x2d30('0x1a')]=ChatQueue; \ No newline at end of file +var _0x0aff=['emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','chatPause','paused','available','waiting','stringify','format'];(function(_0x32672a,_0x470808){var _0x34231f=function(_0x44c50a){while(--_0x44c50a){_0x32672a['push'](_0x32672a['shift']());}};_0x34231f(++_0x470808);}(_0x0aff,0x12f));var _0xf0af=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0x0aff[_0x232e7a];return _0x445ddd;};'use strict';var _=require(_0xf0af('0x0'));var md5=require(_0xf0af('0x1'));var util=require(_0xf0af('0x2'));var Redis=require('ioredis');var config=require(_0xf0af('0x3'));config['redis']=_[_0xf0af('0x4')](config['redis'],{'host':_0xf0af('0x5'),'port':0x18eb});var io=require(_0xf0af('0x6'))(new Redis(config['redis']));function ChatQueue(_0x3c3b86){this['id']=_0x3c3b86['id']||0x0;this[_0xf0af('0x7')]=_0x3c3b86[_0xf0af('0x7')]||'';this[_0xf0af('0x8')]=_0x3c3b86[_0xf0af('0x8')]||0xa;this['strategy']=_0x3c3b86[_0xf0af('0x9')]||_0xf0af('0xa');this[_0xf0af('0xb')]=_0x3c3b86[_0xf0af('0xb')];this[_0xf0af('0xc')]={};this['waiting']=0x0;this[_0xf0af('0x1')]='';this[_0xf0af('0xd')]();this[_0xf0af('0xe')]();}ChatQueue[_0xf0af('0xf')][_0xf0af('0xd')]=function(){var _0x54e457=this[_0xf0af('0xc')][_0xf0af('0x10')];this[_0xf0af('0xc')]=_[_0xf0af('0x11')](this[_0xf0af('0xb')],'id');this[_0xf0af('0xc')][_0xf0af('0x10')]=_0x54e457;};ChatQueue[_0xf0af('0xf')][_0xf0af('0xe')]=function(){this[_0xf0af('0x12')]=0x0;this['paused']=0x0;for(var _0x19339d=0x0;_0x19339d=0x0?this['available']:0x0;var _0x290ad3={'id':this['id'],'available':this[_0xf0af('0x17')],'loggedIn':this[_0xf0af('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xf0af('0x18')]};var _0x3ead38=md5(JSON[_0xf0af('0x19')](_0x290ad3));if(this[_0xf0af('0x1')]!==_0x3ead38){this[_0xf0af('0x1')]=_0x3ead38;io['to'](util[_0xf0af('0x1a')]('chat:queue:%s',_0x290ad3[_0xf0af('0x7')]))[_0xf0af('0x1b')](_0xf0af('0x1c'),_0x290ad3);}};module[_0xf0af('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index dd0dc37..c923f04 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 _0x881f=['strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','map','updateRealtime','paused','faxPause','available','loggedIn','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0x881f,0x12a));var _0xf881=function(_0x1d0aae,_0x187042){_0x1d0aae=_0x1d0aae-0x0;var _0x41884a=_0x881f[_0x1d0aae];return _0x41884a;};'use strict';var _=require(_0xf881('0x0'));var md5=require(_0xf881('0x1'));var util=require(_0xf881('0x2'));var Redis=require(_0xf881('0x3'));var config=require('../../../config/environment');config[_0xf881('0x4')]=_[_0xf881('0x5')](config[_0xf881('0x4')],{'host':_0xf881('0x6'),'port':0x18eb});var io=require(_0xf881('0x7'))(new Redis(config[_0xf881('0x4')]));function FaxQueue(_0x1064a9){this['id']=_0x1064a9['id']||0x0;this[_0xf881('0x8')]=_0x1064a9[_0xf881('0x8')]||'';this[_0xf881('0x9')]=_0x1064a9['timeout']||0xa;this[_0xf881('0xa')]=_0x1064a9['strategy']||'beepall';this[_0xf881('0xb')]=_0x1064a9[_0xf881('0xb')];this[_0xf881('0xc')]={};this[_0xf881('0xd')]=0x0;this[_0xf881('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xf881('0xe')][_0xf881('0xf')]=function(){var _0x246e5e=this[_0xf881('0xc')]['_rr'];this[_0xf881('0xc')]=_[_0xf881('0x10')](this[_0xf881('0xb')],'id');this[_0xf881('0xc')]['_rr']=_0x246e5e;};FaxQueue['prototype'][_0xf881('0x11')]=function(){this['loggedIn']=0x0;this[_0xf881('0x12')]=0x0;for(var _0x24fb92=0x0;_0x24fb92=0x0?this[_0xf881('0x14')]:0x0;var _0x46c1aa={'id':this['id'],'available':this[_0xf881('0x14')],'loggedIn':this[_0xf881('0x15')],'name':this[_0xf881('0x8')],'paused':this['paused'],'waiting':this[_0xf881('0xd')]};var _0x2806df=md5(JSON[_0xf881('0x16')](_0x46c1aa));if(this[_0xf881('0x1')]!==_0x2806df){this[_0xf881('0x1')]=_0x2806df;io['to'](util[_0xf881('0x17')](_0xf881('0x18'),_0x46c1aa[_0xf881('0x8')]))[_0xf881('0x19')](_0xf881('0x1a'),_0x46c1aa);}};module[_0xf881('0x1b')]=FaxQueue; \ No newline at end of file +var _0xc3db=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','lodash','md5','util','ioredis'];(function(_0x30fe16,_0x325e58){var _0x21f7f8=function(_0x41aaab){while(--_0x41aaab){_0x30fe16['push'](_0x30fe16['shift']());}};_0x21f7f8(++_0x325e58);}(_0xc3db,0x191));var _0xbc3d=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xc3db[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0xbc3d('0x0'));var md5=require(_0xbc3d('0x1'));var util=require(_0xbc3d('0x2'));var Redis=require(_0xbc3d('0x3'));var config=require('../../../config/environment');config[_0xbc3d('0x4')]=_['defaults'](config[_0xbc3d('0x4')],{'host':_0xbc3d('0x5'),'port':0x18eb});var io=require(_0xbc3d('0x6'))(new Redis(config[_0xbc3d('0x4')]));function FaxQueue(_0x56ce53){this['id']=_0x56ce53['id']||0x0;this['name']=_0x56ce53[_0xbc3d('0x7')]||'';this[_0xbc3d('0x8')]=_0x56ce53[_0xbc3d('0x8')]||0xa;this[_0xbc3d('0x9')]=_0x56ce53[_0xbc3d('0x9')]||'beepall';this[_0xbc3d('0xa')]=_0x56ce53[_0xbc3d('0xa')];this[_0xbc3d('0xb')]={};this[_0xbc3d('0xc')]=0x0;this[_0xbc3d('0x1')]='';this[_0xbc3d('0xd')]();this[_0xbc3d('0xe')]();}FaxQueue[_0xbc3d('0xf')][_0xbc3d('0xd')]=function(){var _0x460445=this[_0xbc3d('0xb')][_0xbc3d('0x10')];this[_0xbc3d('0xb')]=_[_0xbc3d('0x11')](this[_0xbc3d('0xa')],'id');this[_0xbc3d('0xb')][_0xbc3d('0x10')]=_0x460445;};FaxQueue[_0xbc3d('0xf')][_0xbc3d('0xe')]=function(){this[_0xbc3d('0x12')]=0x0;this[_0xbc3d('0x13')]=0x0;for(var _0x42efd6=0x0;_0x42efd6=0x0?this[_0xbc3d('0x17')]:0x0;var _0xa2bdf7={'id':this['id'],'available':this[_0xbc3d('0x17')],'loggedIn':this[_0xbc3d('0x12')],'name':this[_0xbc3d('0x7')],'paused':this['paused'],'waiting':this[_0xbc3d('0xc')]};var _0x705a32=md5(JSON[_0xbc3d('0x18')](_0xa2bdf7));if(this[_0xbc3d('0x1')]!==_0x705a32){this[_0xbc3d('0x1')]=_0x705a32;io['to'](util[_0xbc3d('0x19')](_0xbc3d('0x1a'),_0xa2bdf7['name']))['emit']('fax_queue:save',_0xa2bdf7);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b7cb7f8..5596bd0 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 _0xe429=['Intervals','name'];(function(_0x3357b8,_0xeb406){var _0x50737a=function(_0x43a94b){while(--_0x43a94b){_0x3357b8['push'](_0x3357b8['shift']());}};_0x50737a(++_0xeb406);}(_0xe429,0xdd));var _0x9e42=function(_0x446c70,_0x1b8c9f){_0x446c70=_0x446c70-0x0;var _0x34473b=_0xe429[_0x446c70];return _0x34473b;};'use strict';function Interval(_0x7c1ece){this['id']=_0x7c1ece['id']||0x0;this[_0x9e42('0x0')]=_0x7c1ece[_0x9e42('0x0')]||'';this[_0x9e42('0x1')]=_0x7c1ece[_0x9e42('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x84e6=['name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e6,0x13e));var _0x684e=function(_0x52c775,_0x5a1496){_0x52c775=_0x52c775-0x0;var _0x33dfb7=_0x84e6[_0x52c775];return _0x33dfb7;};'use strict';function Interval(_0x38f7d8){this['id']=_0x38f7d8['id']||0x0;this['name']=_0x38f7d8[_0x684e('0x0')]||'';this['Intervals']=_0x38f7d8[_0x684e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 41daaff..96924a0 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 _0x45f0=['updateRouting','updateRealtime','_rr','loggedIn','paused','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x45f0,0x7d));var _0x045f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x045f('0x0'));var md5=require(_0x045f('0x1'));var util=require(_0x045f('0x2'));var Redis=require(_0x045f('0x3'));var config=require(_0x045f('0x4'));config['redis']=_[_0x045f('0x5')](config[_0x045f('0x6')],{'host':_0x045f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x4594b3){this['id']=_0x4594b3['id']||0x0;this[_0x045f('0x8')]=_0x4594b3[_0x045f('0x8')]||'';this[_0x045f('0x9')]=_0x4594b3[_0x045f('0x9')]||0xa;this[_0x045f('0xa')]=_0x4594b3[_0x045f('0xa')]||_0x045f('0xb');this[_0x045f('0xc')]=_0x4594b3[_0x045f('0xc')];this[_0x045f('0xd')]={};this[_0x045f('0xe')]=0x0;this[_0x045f('0x1')]='';this[_0x045f('0xf')]();this[_0x045f('0x10')]();}MailQueue['prototype'][_0x045f('0xf')]=function(){var _0x4c8d99=this[_0x045f('0xd')][_0x045f('0x11')];this[_0x045f('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x045f('0x11')]=_0x4c8d99;};MailQueue['prototype'][_0x045f('0x10')]=function(){this[_0x045f('0x12')]=0x0;this[_0x045f('0x13')]=0x0;for(var _0x14d277=0x0;_0x14d277=0x0?this[_0x045f('0x15')]:0x0;var _0x45a090={'id':this['id'],'available':this[_0x045f('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x045f('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0xdc3101=md5(JSON[_0x045f('0x16')](_0x45a090));if(this[_0x045f('0x1')]!==_0xdc3101){this[_0x045f('0x1')]=_0xdc3101;io['to'](util[_0x045f('0x17')](_0x045f('0x18'),_0x45a090['name']))[_0x045f('0x19')](_0x045f('0x1a'),_0x45a090);}};module[_0x045f('0x1b')]=MailQueue; \ No newline at end of file +var _0x44cf=['util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','emit','exports','lodash','md5'];(function(_0x64b57d,_0x2a79d8){var _0x2f55bd=function(_0x2923){while(--_0x2923){_0x64b57d['push'](_0x64b57d['shift']());}};_0x2f55bd(++_0x2a79d8);}(_0x44cf,0x94));var _0xf44c=function(_0x602380,_0x603b6){_0x602380=_0x602380-0x0;var _0x14f0ad=_0x44cf[_0x602380];return _0x14f0ad;};'use strict';var _=require(_0xf44c('0x0'));var md5=require(_0xf44c('0x1'));var util=require(_0xf44c('0x2'));var Redis=require('ioredis');var config=require(_0xf44c('0x3'));config[_0xf44c('0x4')]=_[_0xf44c('0x5')](config['redis'],{'host':_0xf44c('0x6'),'port':0x18eb});var io=require(_0xf44c('0x7'))(new Redis(config['redis']));function MailQueue(_0x15c252){this['id']=_0x15c252['id']||0x0;this[_0xf44c('0x8')]=_0x15c252[_0xf44c('0x8')]||'';this[_0xf44c('0x9')]=_0x15c252['timeout']||0xa;this['strategy']=_0x15c252[_0xf44c('0xa')]||_0xf44c('0xb');this[_0xf44c('0xc')]=_0x15c252[_0xf44c('0xc')];this[_0xf44c('0xd')]={};this['waiting']=0x0;this[_0xf44c('0x1')]='';this[_0xf44c('0xe')]();this[_0xf44c('0xf')]();}MailQueue[_0xf44c('0x10')][_0xf44c('0xe')]=function(){var _0x12f4ae=this[_0xf44c('0xd')][_0xf44c('0x11')];this[_0xf44c('0xd')]=_[_0xf44c('0x12')](this[_0xf44c('0xc')],'id');this[_0xf44c('0xd')][_0xf44c('0x11')]=_0x12f4ae;};MailQueue[_0xf44c('0x10')]['updateRealtime']=function(){this[_0xf44c('0x13')]=0x0;this['paused']=0x0;for(var _0x81d51d=0x0;_0x81d51d=0x0?this[_0xf44c('0x17')]:0x0;var _0x4e1cb5={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf44c('0x8')],'paused':this[_0xf44c('0x16')],'waiting':this[_0xf44c('0x18')]};var _0x292303=md5(JSON[_0xf44c('0x19')](_0x4e1cb5));if(this['md5']!==_0x292303){this[_0xf44c('0x1')]=_0x292303;io['to'](util[_0xf44c('0x1a')](_0xf44c('0x1b'),_0x4e1cb5[_0xf44c('0x8')]))[_0xf44c('0x1c')]('mail_queue:save',_0x4e1cb5);}};module[_0xf44c('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a9993d5..778b151 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x2ef3,0xba));var _0x32ef=function(_0x121642,_0xc88e8){_0x121642=_0x121642-0x0;var _0x33bcdc=_0x2ef3[_0x121642];return _0x33bcdc;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ad1c6a6..502af4e 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 _0x7d86=['Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x10ee18,_0x16a291){var _0xd8c465=function(_0x4a593a){while(--_0x4a593a){_0x10ee18['push'](_0x10ee18['shift']());}};_0xd8c465(++_0x16a291);}(_0x7d86,0x86));var _0x67d8=function(_0xefe416,_0x5ac1bc){_0xefe416=_0xefe416-0x0;var _0x43163f=_0x7d86[_0xefe416];return _0x43163f;};'use strict';var _=require(_0x67d8('0x0'));var md5=require('md5');var util=require(_0x67d8('0x1'));var Redis=require(_0x67d8('0x2'));var config=require(_0x67d8('0x3'));config[_0x67d8('0x4')]=_[_0x67d8('0x5')](config[_0x67d8('0x4')],{'host':_0x67d8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x67d8('0x4')]));function SmsQueue(_0x33de53){this['id']=_0x33de53['id']||0x0;this[_0x67d8('0x7')]=_0x33de53[_0x67d8('0x7')]||'';this[_0x67d8('0x8')]=_0x33de53[_0x67d8('0x8')]||0xa;this[_0x67d8('0x9')]=_0x33de53[_0x67d8('0x9')]||_0x67d8('0xa');this[_0x67d8('0xb')]=_0x33de53[_0x67d8('0xb')];this[_0x67d8('0xc')]={};this[_0x67d8('0xd')]=0x0;this[_0x67d8('0xe')]='';this[_0x67d8('0xf')]();this[_0x67d8('0x10')]();}SmsQueue[_0x67d8('0x11')][_0x67d8('0xf')]=function(){var _0x38107b=this[_0x67d8('0xc')][_0x67d8('0x12')];this['mapAgentsId']=_[_0x67d8('0x13')](this[_0x67d8('0xb')],'id');this[_0x67d8('0xc')]['_rr']=_0x38107b;};SmsQueue[_0x67d8('0x11')][_0x67d8('0x10')]=function(){this[_0x67d8('0x14')]=0x0;this[_0x67d8('0x15')]=0x0;for(var _0x2d54e6=0x0;_0x2d54e6=0x0?this[_0x67d8('0x18')]:0x0;var _0x23328d={'id':this['id'],'available':this[_0x67d8('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x67d8('0x7')],'paused':this[_0x67d8('0x15')],'waiting':this[_0x67d8('0xd')]};var _0x14a81f=md5(JSON[_0x67d8('0x19')](_0x23328d));if(this['md5']!==_0x14a81f){this[_0x67d8('0xe')]=_0x14a81f;io['to'](util[_0x67d8('0x1a')]('sms:queue:%s',_0x23328d['name']))[_0x67d8('0x1b')]('sms_queue:save',_0x23328d);}};module[_0x67d8('0x1c')]=SmsQueue; \ No newline at end of file +var _0x5ad3=['sms_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','prototype','_rr','mapAgentsId','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit'];(function(_0x5596e6,_0x306b47){var _0xd5292d=function(_0x362635){while(--_0x362635){_0x5596e6['push'](_0x5596e6['shift']());}};_0xd5292d(++_0x306b47);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0x5ad3[_0x154cb5];return _0x3f574f;};'use strict';var _=require(_0x35ad('0x0'));var md5=require(_0x35ad('0x1'));var util=require(_0x35ad('0x2'));var Redis=require(_0x35ad('0x3'));var config=require('../../../config/environment');config[_0x35ad('0x4')]=_[_0x35ad('0x5')](config[_0x35ad('0x4')],{'host':_0x35ad('0x6'),'port':0x18eb});var io=require(_0x35ad('0x7'))(new Redis(config[_0x35ad('0x4')]));function SmsQueue(_0x729a01){this['id']=_0x729a01['id']||0x0;this[_0x35ad('0x8')]=_0x729a01[_0x35ad('0x8')]||'';this[_0x35ad('0x9')]=_0x729a01['timeout']||0xa;this[_0x35ad('0xa')]=_0x729a01[_0x35ad('0xa')]||_0x35ad('0xb');this['Agents']=_0x729a01[_0x35ad('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x35ad('0x1')]='';this[_0x35ad('0xd')]();this['updateRealtime']();}SmsQueue[_0x35ad('0xe')][_0x35ad('0xd')]=function(){var _0x4ad760=this['mapAgentsId'][_0x35ad('0xf')];this[_0x35ad('0x10')]=_['map'](this[_0x35ad('0xc')],'id');this[_0x35ad('0x10')]['_rr']=_0x4ad760;};SmsQueue['prototype'][_0x35ad('0x11')]=function(){this[_0x35ad('0x12')]=0x0;this[_0x35ad('0x13')]=0x0;for(var _0x4b7ad9=0x0;_0x4b7ad9=0x0?this[_0x35ad('0x17')]:0x0;var _0x3a73c8={'id':this['id'],'available':this[_0x35ad('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x35ad('0x8')],'paused':this[_0x35ad('0x13')],'waiting':this['waiting']};var _0x53b8e3=md5(JSON[_0x35ad('0x18')](_0x3a73c8));if(this[_0x35ad('0x1')]!==_0x53b8e3){this['md5']=_0x53b8e3;io['to'](util[_0x35ad('0x19')](_0x35ad('0x1a'),_0x3a73c8['name']))[_0x35ad('0x1b')](_0x35ad('0x1c'),_0x3a73c8);}};module[_0x35ad('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index d3f55a3..4876198 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 _0xd9e0=['Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','loggedIn','paused','length','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy'];(function(_0x4b3533,_0x280b72){var _0x5ef6c0=function(_0xfc16a4){while(--_0xfc16a4){_0x4b3533['push'](_0x4b3533['shift']());}};_0x5ef6c0(++_0x280b72);}(_0xd9e0,0x155));var _0x0d9e=function(_0x5719fb,_0xffc8f8){_0x5719fb=_0x5719fb-0x0;var _0x48928e=_0xd9e0[_0x5719fb];return _0x48928e;};'use strict';var _=require(_0x0d9e('0x0'));var md5=require(_0x0d9e('0x1'));var util=require(_0x0d9e('0x2'));var Redis=require(_0x0d9e('0x3'));var config=require(_0x0d9e('0x4'));config[_0x0d9e('0x5')]=_['defaults'](config[_0x0d9e('0x5')],{'host':_0x0d9e('0x6'),'port':0x18eb});var io=require(_0x0d9e('0x7'))(new Redis(config[_0x0d9e('0x5')]));function WhatsappQueue(_0x31b8ef){this['id']=_0x31b8ef['id']||0x0;this[_0x0d9e('0x8')]=_0x31b8ef['name']||'';this['timeout']=_0x31b8ef['timeout']||0xa;this[_0x0d9e('0x9')]=_0x31b8ef[_0x0d9e('0x9')]||'beepall';this[_0x0d9e('0xa')]=_0x31b8ef[_0x0d9e('0xa')];this['mapAgentsId']={};this[_0x0d9e('0xb')]=0x0;this[_0x0d9e('0x1')]='';this['updateRouting']();this[_0x0d9e('0xc')]();}WhatsappQueue[_0x0d9e('0xd')][_0x0d9e('0xe')]=function(){var _0x34a004=this[_0x0d9e('0xf')]['_rr'];this[_0x0d9e('0xf')]=_[_0x0d9e('0x10')](this[_0x0d9e('0xa')],'id');this[_0x0d9e('0xf')]['_rr']=_0x34a004;};WhatsappQueue[_0x0d9e('0xd')][_0x0d9e('0xc')]=function(){this[_0x0d9e('0x11')]=0x0;this[_0x0d9e('0x12')]=0x0;for(var _0x2f605e=0x0;_0x2f605e=0x0?this[_0x0d9e('0x15')]:0x0;var _0x25955a={'id':this['id'],'available':this[_0x0d9e('0x15')],'loggedIn':this[_0x0d9e('0x11')],'name':this[_0x0d9e('0x8')],'paused':this[_0x0d9e('0x12')],'waiting':this[_0x0d9e('0xb')]};var _0x163821=md5(JSON[_0x0d9e('0x16')](_0x25955a));if(this[_0x0d9e('0x1')]!==_0x163821){this['md5']=_0x163821;io['to'](util[_0x0d9e('0x17')]('whatsapp:queue:%s',_0x25955a[_0x0d9e('0x8')]))[_0x0d9e('0x18')](_0x0d9e('0x19'),_0x25955a);}};module[_0x0d9e('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xa4b2=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','online','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall'];(function(_0x875324,_0x3947f4){var _0x1fec27=function(_0x548100){while(--_0x548100){_0x875324['push'](_0x875324['shift']());}};_0x1fec27(++_0x3947f4);}(_0xa4b2,0x148));var _0x2a4b=function(_0x2e909c,_0x57fd3d){_0x2e909c=_0x2e909c-0x0;var _0x2a0beb=_0xa4b2[_0x2e909c];return _0x2a0beb;};'use strict';var _=require('lodash');var md5=require(_0x2a4b('0x0'));var util=require('util');var Redis=require(_0x2a4b('0x1'));var config=require(_0x2a4b('0x2'));config['redis']=_[_0x2a4b('0x3')](config[_0x2a4b('0x4')],{'host':_0x2a4b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a4b('0x4')]));function WhatsappQueue(_0x1dfe4f){this['id']=_0x1dfe4f['id']||0x0;this[_0x2a4b('0x6')]=_0x1dfe4f[_0x2a4b('0x6')]||'';this[_0x2a4b('0x7')]=_0x1dfe4f[_0x2a4b('0x7')]||0xa;this[_0x2a4b('0x8')]=_0x1dfe4f[_0x2a4b('0x8')]||_0x2a4b('0x9');this[_0x2a4b('0xa')]=_0x1dfe4f['Agents'];this[_0x2a4b('0xb')]={};this[_0x2a4b('0xc')]=0x0;this[_0x2a4b('0x0')]='';this[_0x2a4b('0xd')]();this[_0x2a4b('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x2c188e=this[_0x2a4b('0xb')][_0x2a4b('0xf')];this[_0x2a4b('0xb')]=_[_0x2a4b('0x10')](this[_0x2a4b('0xa')],'id');this['mapAgentsId'][_0x2a4b('0xf')]=_0x2c188e;};WhatsappQueue[_0x2a4b('0x11')][_0x2a4b('0xe')]=function(){this[_0x2a4b('0x12')]=0x0;this[_0x2a4b('0x13')]=0x0;for(var _0x4c875d=0x0;_0x4c875d=0x0?this[_0x2a4b('0x16')]:0x0;var _0xa802ef={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2a4b('0x12')],'name':this[_0x2a4b('0x6')],'paused':this['paused'],'waiting':this[_0x2a4b('0xc')]};var _0x53d79a=md5(JSON[_0x2a4b('0x17')](_0xa802ef));if(this[_0x2a4b('0x0')]!==_0x53d79a){this['md5']=_0x53d79a;io['to'](util['format'](_0x2a4b('0x18'),_0xa802ef[_0x2a4b('0x6')]))['emit'](_0x2a4b('0x19'),_0xa802ef);}};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 d21a5a2..c30c361 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x388f86,_0x47b9c6){var _0x1f1515=function(_0x9c9f02){while(--_0x9c9f02){_0x388f86['push'](_0x388f86['shift']());}};_0x1f1515(++_0x47b9c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xb10b[_0x504df1];return _0x1063b5;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b83ceaf..9a72f9b 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 _0x9809=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xf1adeb,_0x3432bb){var _0x8db757=function(_0x1c7727){while(--_0x1c7727){_0xf1adeb['push'](_0xf1adeb['shift']());}};_0x8db757(++_0x3432bb);}(_0x9809,0x11d));var _0x9980=function(_0x329f09,_0x2d5c3f){_0x329f09=_0x329f09-0x0;var _0x556f64=_0x9809[_0x329f09];return _0x556f64;};'use strict';var client=require(_0x9980('0x0'));exports[_0x9980('0x1')]=function(_0x118ad0,_0x1b1673){return client[_0x9980('0x2')](_0x9980('0x3'),{'body':_0x1b1673,'options':{'where':{'id':_0x118ad0}},'log':_0x9980('0x4')});};exports[_0x9980('0x5')]=function(_0xc88277,_0x234080){return client[_0x9980('0x2')](_0x9980('0x6'),{'body':_0x234080,'options':{'where':{'id':_0xc88277}},'log':_0x9980('0x7')});}; \ No newline at end of file +var _0x754d=['UpdateChatInteraction','updateChatInteraction','addTags','../client','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x754d,0x8d));var _0xd754=function(_0x4b9ecb,_0x1de36b){_0x4b9ecb=_0x4b9ecb-0x0;var _0x9ce6b8=_0x754d[_0x4b9ecb];return _0x9ce6b8;};'use strict';var client=require(_0xd754('0x0'));exports[_0xd754('0x1')]=function(_0x269251,_0xcdf48){return client[_0xd754('0x2')](_0xd754('0x3'),{'body':_0xcdf48,'options':{'where':{'id':_0x269251}},'log':_0xd754('0x4')});};exports[_0xd754('0x5')]=function(_0x27fbe9,_0x269105){return client['Request']('AddTagsToChatInteraction',{'body':_0x269105,'options':{'where':{'id':_0x27fbe9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index fda6acb..bb252c4 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 _0xbaea=['CreateChatMessage','../client','Request'];(function(_0x4c5bc6,_0x1b100e){var _0x2336e4=function(_0x2b1b99){while(--_0x2b1b99){_0x4c5bc6['push'](_0x4c5bc6['shift']());}};_0x2336e4(++_0x1b100e);}(_0xbaea,0x154));var _0xabae=function(_0x12f8c6,_0x54d2d8){_0x12f8c6=_0x12f8c6-0x0;var _0xe9ae4a=_0xbaea[_0x12f8c6];return _0xe9ae4a;};'use strict';var client=require(_0xabae('0x0'));exports['create']=function(_0x53f682){return client[_0xabae('0x1')](_0xabae('0x2'),{'body':_0x53f682,'log':'createChatMessage'});}; \ No newline at end of file +var _0x4a51=['create','Request','CreateChatMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a51,0x113));var _0x14a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a51[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x14a5('0x0'));exports[_0x14a5('0x1')]=function(_0x6a52a4){return client[_0x14a5('0x2')](_0x14a5('0x3'),{'body':_0x6a52a4,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 33b9fee..e3bed4a 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 _0x5c1f=['User','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout','strategy'];(function(_0x1adc51,_0x290bdd){var _0x46c3a9=function(_0x15d347){while(--_0x15d347){_0x1adc51['push'](_0x1adc51['shift']());}};_0x46c3a9(++_0x290bdd);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x5c1f[_0x356e8d];return _0x39e65a;};'use strict';var client=require(_0xf5c1('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf5c1('0x1')](_0xf5c1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf5c1('0x3'),_0xf5c1('0x4')],'include':[{'model':_0xf5c1('0x5'),'as':'Agents','attributes':['id','name','online',_0xf5c1('0x6')]}]},'log':_0xf5c1('0x7')});};}; \ No newline at end of file +var _0xf611=['User','name','online','getChatQueues','Request','GetChatQueue'];(function(_0x100ee4,_0x7d5b13){var _0x28da41=function(_0x490ffc){while(--_0x490ffc){_0x100ee4['push'](_0x100ee4['shift']());}};_0x28da41(++_0x7d5b13);}(_0xf611,0x7b));var _0x1f61=function(_0x1a42bc,_0x34a88c){_0x1a42bc=_0x1a42bc-0x0;var _0x33fd2b=_0xf611[_0x1a42bc];return _0x33fd2b;};'use strict';var client=require('../client');exports[_0x1f61('0x0')]=function(){return function(){return client[_0x1f61('0x1')](_0x1f61('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x1f61('0x3'),'as':'Agents','attributes':['id',_0x1f61('0x4'),_0x1f61('0x5'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f717855..6f14069 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 _0x630e=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x1e24f8,_0x52070f){var _0x5c4446=function(_0x40bf51){while(--_0x40bf51){_0x1e24f8['push'](_0x1e24f8['shift']());}};_0x5c4446(++_0x52070f);}(_0x630e,0x1af));var _0xe630=function(_0x25744d,_0x343d32){_0x25744d=_0x25744d-0x0;var _0x6375=_0x630e[_0x25744d];return _0x6375;};'use strict';var client=require(_0xe630('0x0'));exports['create']=function(_0x15c6db){return client['Request']('CreateChatQueueReport',{'body':_0x15c6db,'log':_0xe630('0x1')});};exports[_0xe630('0x2')]=function(_0x12449c,_0x5c5606){return client[_0xe630('0x3')](_0xe630('0x4'),{'body':_0x5c5606,'options':{'where':{'uniqueid':_0x12449c},'order':[['id',_0xe630('0x5')]],'limit':0x1},'log':_0xe630('0x4')});}; \ No newline at end of file +var _0xe41f=['Request','UpdateChatQueueReport','../client','create'];(function(_0x35c0a3,_0x1955c1){var _0x53fd66=function(_0x5b99ef){while(--_0x5b99ef){_0x35c0a3['push'](_0x35c0a3['shift']());}};_0x53fd66(++_0x1955c1);}(_0xe41f,0x13e));var _0xfe41=function(_0x23d422,_0x2a7911){_0x23d422=_0x23d422-0x0;var _0x388492=_0xe41f[_0x23d422];return _0x388492;};'use strict';var client=require(_0xfe41('0x0'));exports[_0xfe41('0x1')]=function(_0x286c6e){return client[_0xfe41('0x2')]('CreateChatQueueReport',{'body':_0x286c6e,'log':'CreateChatQueueReport'});};exports['update']=function(_0x196b31,_0x67a2d3){return client[_0xfe41('0x2')](_0xfe41('0x3'),{'body':_0x67a2d3,'options':{'where':{'uniqueid':_0x196b31},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 715af51..c71e9bc 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(_0xe7de9f,_0xf1bc6d){var _0x173524=function(_0x3749b7){while(--_0x3749b7){_0xe7de9f['push'](_0xe7de9f['shift']());}};_0x173524(++_0xf1bc6d);}(_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(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x7a54,0x106));var _0x47a5=function(_0x8e42e0,_0x19ec87){_0x8e42e0=_0x8e42e0-0x0;var _0x4b8efa=_0x7a54[_0x8e42e0];return _0x4b8efa;};'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 a1ca09a..dc73aad 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 _0x64c0=['createFaxMessage','../client','create','Request'];(function(_0x4fd84d,_0x320744){var _0x909966=function(_0x472512){while(--_0x472512){_0x4fd84d['push'](_0x4fd84d['shift']());}};_0x909966(++_0x320744);}(_0x64c0,0x1a1));var _0x064c=function(_0x5870c1,_0x173ba3){_0x5870c1=_0x5870c1-0x0;var _0x344685=_0x64c0[_0x5870c1];return _0x344685;};'use strict';var client=require(_0x064c('0x0'));exports[_0x064c('0x1')]=function(_0xabdc0d){return client[_0x064c('0x2')]('CreateFaxMessage',{'body':_0xabdc0d,'log':_0x064c('0x3')});}; \ No newline at end of file +var _0xf84c=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x5d2daa,_0xb97f95){var _0x17c51e=function(_0xeb2c93){while(--_0xeb2c93){_0x5d2daa['push'](_0x5d2daa['shift']());}};_0x17c51e(++_0xb97f95);}(_0xf84c,0x73));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xcf84('0x0')]=function(_0x39924c){return client[_0xcf84('0x1')](_0xcf84('0x2'),{'body':_0x39924c,'log':_0xcf84('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 84b3aa7..c15ee24 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 _0x0b96=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0x128768,_0x387d89){var _0x40bf08=function(_0x2612ae){while(--_0x2612ae){_0x128768['push'](_0x128768['shift']());}};_0x40bf08(++_0x387d89);}(_0x0b96,0xc4));var _0x60b9=function(_0x2feffe,_0x104382){_0x2feffe=_0x2feffe-0x0;var _0x190bb3=_0x0b96[_0x2feffe];return _0x190bb3;};'use strict';var client=require(_0x60b9('0x0'));exports[_0x60b9('0x1')]=function(){return function(){return client[_0x60b9('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x60b9('0x3'),_0x60b9('0x4'),_0x60b9('0x5')],'include':[{'model':_0x60b9('0x6'),'as':_0x60b9('0x7'),'attributes':['id','name',_0x60b9('0x8'),_0x60b9('0x9')]}]},'log':_0x60b9('0x1')});};}; \ No newline at end of file +var _0x1824=['Request','GetFaxQueue','timeout','strategy','Agents','online','faxPause','getFaxQueues','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1824,0x10d));var _0x4182=function(_0x29e773,_0x59b97d){_0x29e773=_0x29e773-0x0;var _0x3a0182=_0x1824[_0x29e773];return _0x3a0182;};'use strict';var client=require(_0x4182('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x4182('0x1')](_0x4182('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4182('0x3'),_0x4182('0x4')],'include':[{'model':'User','as':_0x4182('0x5'),'attributes':['id','name',_0x4182('0x6'),_0x4182('0x7')]}]},'log':_0x4182('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8950b7a..a870f79 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 _0x11b2=['UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update','Request','DESC'];(function(_0x43a4c2,_0x4e400f){var _0x3cd4fb=function(_0x28ec58){while(--_0x28ec58){_0x43a4c2['push'](_0x43a4c2['shift']());}};_0x3cd4fb(++_0x4e400f);}(_0x11b2,0x151));var _0x211b=function(_0x1713d0,_0x1dbb87){_0x1713d0=_0x1713d0-0x0;var _0x298780=_0x11b2[_0x1713d0];return _0x298780;};'use strict';var client=require(_0x211b('0x0'));exports[_0x211b('0x1')]=function(_0x520c61){return client['Request'](_0x211b('0x2'),{'body':_0x520c61,'log':_0x211b('0x2')});};exports[_0x211b('0x3')]=function(_0x5ecd6a,_0x48816c){return client[_0x211b('0x4')]('UpdateFaxQueueReport',{'body':_0x48816c,'options':{'where':{'uniqueid':_0x5ecd6a},'order':[['id',_0x211b('0x5')]],'limit':0x1},'log':_0x211b('0x6')});}; \ No newline at end of file +var _0x256a=['create','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x2ebdfd,_0x228c72){var _0x39f043=function(_0x3eaa5d){while(--_0x3eaa5d){_0x2ebdfd['push'](_0x2ebdfd['shift']());}};_0x39f043(++_0x228c72);}(_0x256a,0x110));var _0xa256=function(_0x8e8d41,_0x3682e4){_0x8e8d41=_0x8e8d41-0x0;var _0x1fffaa=_0x256a[_0x8e8d41];return _0x1fffaa;};'use strict';var client=require('../client');exports[_0xa256('0x0')]=function(_0x10abc7){return client['Request'](_0xa256('0x1'),{'body':_0x10abc7,'log':_0xa256('0x1')});};exports[_0xa256('0x2')]=function(_0xf45eda,_0x2a1a06){return client['Request']('UpdateFaxQueueReport',{'body':_0x2a1a06,'options':{'where':{'uniqueid':_0xf45eda},'order':[['id','DESC']],'limit':0x1},'log':_0xa256('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index db71c64..7a123bb 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 _0xd180=['interval','getIntervals','../client','Request','GetInterval','name','Interval'];(function(_0x4defc2,_0x57e011){var _0x217760=function(_0x149aa3){while(--_0x149aa3){_0x4defc2['push'](_0x4defc2['shift']());}};_0x217760(++_0x57e011);}(_0xd180,0x13d));var _0x0d18=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0xd180[_0x478e2f];return _0x4b088d;};'use strict';var client=require(_0x0d18('0x0'));exports['getIntervals']=function(){return function(){return client[_0x0d18('0x1')](_0x0d18('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0d18('0x3')],'include':[{'model':_0x0d18('0x4'),'as':'Intervals','attributes':['id',_0x0d18('0x3'),_0x0d18('0x5')]}]},'log':_0x0d18('0x6')});};}; \ No newline at end of file +var _0x7a79=['Intervals','name','interval','getIntervals','../client','Request','GetInterval','Interval'];(function(_0x2fc0bc,_0x430585){var _0x49f4fb=function(_0x496a66){while(--_0x496a66){_0x2fc0bc['push'](_0x2fc0bc['shift']());}};_0x49f4fb(++_0x430585);}(_0x7a79,0x144));var _0x97a7=function(_0x598152,_0x4230ac){_0x598152=_0x598152-0x0;var _0x71af95=_0x7a79[_0x598152];return _0x71af95;};'use strict';var client=require(_0x97a7('0x0'));exports['getIntervals']=function(){return function(){return client[_0x97a7('0x1')](_0x97a7('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x97a7('0x3'),'as':_0x97a7('0x4'),'attributes':['id',_0x97a7('0x5'),_0x97a7('0x6')]}]},'log':_0x97a7('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 31cfc56..e0e6eeb 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 _0xb10b=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','Request'];(function(_0x389ca2,_0x97dbeb){var _0x399d87=function(_0x4a7d2a){while(--_0x4a7d2a){_0x389ca2['push'](_0x389ca2['shift']());}};_0x399d87(++_0x97dbeb);}(_0xb10b,0x12a));var _0xbb10=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xb10b[_0x40911a];return _0x27e8e3;};'use strict';var client=require(_0xbb10('0x0'));exports['update']=function(_0x390ae2,_0x35bc5f){return client[_0xbb10('0x1')]('UpdateMailInteraction',{'body':_0x35bc5f,'options':{'where':{'id':_0x390ae2}},'log':_0xbb10('0x2')});};exports[_0xbb10('0x3')]=function(_0x460981,_0x22320e){return client[_0xbb10('0x1')](_0xbb10('0x4'),{'body':_0x22320e,'options':{'where':{'id':_0x460981}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x36ee=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction'];(function(_0x2f9dcb,_0x306ba8){var _0x1e1a21=function(_0x12ca33){while(--_0x12ca33){_0x2f9dcb['push'](_0x2f9dcb['shift']());}};_0x1e1a21(++_0x306ba8);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports['update']=function(_0x34e33c,_0x521ff3){return client[_0xe36e('0x0')](_0xe36e('0x1'),{'body':_0x521ff3,'options':{'where':{'id':_0x34e33c}},'log':_0xe36e('0x2')});};exports[_0xe36e('0x3')]=function(_0x567a84,_0x1118af){return client[_0xe36e('0x0')](_0xe36e('0x4'),{'body':_0x1118af,'options':{'where':{'id':_0x567a84}},'log':_0xe36e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3881442..7134321 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 _0x4dfe=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x3d2c4c,_0x2945d5){var _0x26e350=function(_0x19fc37){while(--_0x19fc37){_0x3d2c4c['push'](_0x3d2c4c['shift']());}};_0x26e350(++_0x2945d5);}(_0x4dfe,0x184));var _0xe4df=function(_0x6478ea,_0x430fcb){_0x6478ea=_0x6478ea-0x0;var _0x2dfcb3=_0x4dfe[_0x6478ea];return _0x2dfcb3;};'use strict';var client=require(_0xe4df('0x0'));exports[_0xe4df('0x1')]=function(_0x3c76e8){return client['Request'](_0xe4df('0x2'),{'body':_0x3c76e8,'log':_0xe4df('0x3')});}; \ No newline at end of file +var _0xda45=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0xda45,0x65));var _0x5da4=function(_0x2ae695,_0xb26107){_0x2ae695=_0x2ae695-0x0;var _0x14b0c5=_0xda45[_0x2ae695];return _0x14b0c5;};'use strict';var client=require(_0x5da4('0x0'));exports[_0x5da4('0x1')]=function(_0x2d5ad3){return client[_0x5da4('0x2')](_0x5da4('0x3'),{'body':_0x2d5ad3,'log':_0x5da4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 33289b6..e1dd409 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 _0xf96d=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','online'];(function(_0x28f4e3,_0x1ec556){var _0x57113a=function(_0x4f987b){while(--_0x4f987b){_0x28f4e3['push'](_0x28f4e3['shift']());}};_0x57113a(++_0x1ec556);}(_0xf96d,0x1f0));var _0xdf96=function(_0x28efb9,_0x39acce){_0x28efb9=_0x28efb9-0x0;var _0x16c970=_0xf96d[_0x28efb9];return _0x16c970;};'use strict';var client=require(_0xdf96('0x0'));exports[_0xdf96('0x1')]=function(){return function(){return client[_0xdf96('0x2')](_0xdf96('0x3'),{'options':{'raw':![],'attributes':['id',_0xdf96('0x4'),_0xdf96('0x5'),_0xdf96('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xdf96('0x4'),_0xdf96('0x7'),_0xdf96('0x8')]}]},'log':_0xdf96('0x1')});};}; \ No newline at end of file +var _0x6641=['Request','name','timeout','strategy','User','online','mailPause','../client','getMailQueues'];(function(_0xa2f958,_0x2b9b1e){var _0x3fb930=function(_0x427988){while(--_0x427988){_0xa2f958['push'](_0xa2f958['shift']());}};_0x3fb930(++_0x2b9b1e);}(_0x6641,0x8e));var _0x1664=function(_0x9ea3f1,_0xcb7aef){_0x9ea3f1=_0x9ea3f1-0x0;var _0x1952f2=_0x6641[_0x9ea3f1];return _0x1952f2;};'use strict';var client=require(_0x1664('0x0'));exports[_0x1664('0x1')]=function(){return function(){return client[_0x1664('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1664('0x3'),_0x1664('0x4'),_0x1664('0x5')],'include':[{'model':_0x1664('0x6'),'as':'Agents','attributes':['id',_0x1664('0x3'),_0x1664('0x7'),_0x1664('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ed571c1..04062f6 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 _0xe564=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x4bb731,_0x46bb6c){var _0x580c64=function(_0x44ed34){while(--_0x44ed34){_0x4bb731['push'](_0x4bb731['shift']());}};_0x580c64(++_0x46bb6c);}(_0xe564,0x86));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x4e56('0x0')]=function(_0x53066e){return client[_0x4e56('0x1')](_0x4e56('0x2'),{'body':_0x53066e,'log':_0x4e56('0x2')});};exports[_0x4e56('0x3')]=function(_0x97a01d,_0x554542){return client[_0x4e56('0x1')](_0x4e56('0x4'),{'body':_0x554542,'options':{'where':{'uniqueid':_0x97a01d},'order':[['id',_0x4e56('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xb4f3=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x4e63ed,_0x4206f1){var _0x49065e=function(_0x4738fb){while(--_0x4738fb){_0x4e63ed['push'](_0x4e63ed['shift']());}};_0x49065e(++_0x4206f1);}(_0xb4f3,0x1d5));var _0x3b4f=function(_0x11de27,_0x483d1c){_0x11de27=_0x11de27-0x0;var _0x3e4bd5=_0xb4f3[_0x11de27];return _0x3e4bd5;};'use strict';var client=require(_0x3b4f('0x0'));exports['create']=function(_0x1db344){return client[_0x3b4f('0x1')](_0x3b4f('0x2'),{'body':_0x1db344,'log':_0x3b4f('0x2')});};exports[_0x3b4f('0x3')]=function(_0x541e59,_0x584214){return client[_0x3b4f('0x1')](_0x3b4f('0x4'),{'body':_0x584214,'options':{'where':{'uniqueid':_0x541e59},'order':[['id','DESC']],'limit':0x1},'log':_0x3b4f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d4acd05..27261fc 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 _0x0c66=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x44f267,_0x4c9f7f){var _0x2b9037=function(_0x3370cc){while(--_0x3370cc){_0x44f267['push'](_0x44f267['shift']());}};_0x2b9037(++_0x4c9f7f);}(_0x0c66,0xd7));var _0x60c6=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0c66[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x60c6('0x0'));exports[_0x60c6('0x1')]=function(_0x386718,_0x3835a4){return client[_0x60c6('0x2')](_0x60c6('0x3'),{'body':_0x3835a4,'options':{'where':{'id':_0x386718}},'log':_0x60c6('0x4')});};exports[_0x60c6('0x5')]=function(_0x445985,_0x36dbe8){return client[_0x60c6('0x2')](_0x60c6('0x6'),{'body':_0x36dbe8,'options':{'where':{'id':_0x445985}},'log':_0x60c6('0x7')});}; \ No newline at end of file +var _0x04a8=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x04a8,0x166));var _0x804a=function(_0x5c804e,_0x34f5e5){_0x5c804e=_0x5c804e-0x0;var _0x20d8fc=_0x04a8[_0x5c804e];return _0x20d8fc;};'use strict';var client=require(_0x804a('0x0'));exports[_0x804a('0x1')]=function(_0x3b7c95,_0x367147){return client[_0x804a('0x2')](_0x804a('0x3'),{'body':_0x367147,'options':{'where':{'id':_0x3b7c95}},'log':_0x804a('0x4')});};exports[_0x804a('0x5')]=function(_0xc6ed68,_0x2b4d88){return client[_0x804a('0x2')](_0x804a('0x6'),{'body':_0x2b4d88,'options':{'where':{'id':_0xc6ed68}},'log':_0x804a('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 902b35d..d50ea57 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 _0x2668=['create','Request','createOpenchannelMessage','../client'];(function(_0x1776e0,_0x274ed7){var _0x36a32a=function(_0x425996){while(--_0x425996){_0x1776e0['push'](_0x1776e0['shift']());}};_0x36a32a(++_0x274ed7);}(_0x2668,0x103));var _0x8266=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2668[_0x29b609];return _0x54c952;};'use strict';var client=require(_0x8266('0x0'));exports[_0x8266('0x1')]=function(_0x51eb6e){return client[_0x8266('0x2')]('CreateOpenchannelMessage',{'body':_0x51eb6e,'log':_0x8266('0x3')});}; \ No newline at end of file +var _0xe5e0=['create','Request','CreateOpenchannelMessage','../client'];(function(_0x2cb0c3,_0x3b06c6){var _0x41baf1=function(_0x56f39c){while(--_0x56f39c){_0x2cb0c3['push'](_0x2cb0c3['shift']());}};_0x41baf1(++_0x3b06c6);}(_0xe5e0,0x73));var _0x0e5e=function(_0x3ef76a,_0x15e9a5){_0x3ef76a=_0x3ef76a-0x0;var _0x54257f=_0xe5e0[_0x3ef76a];return _0x54257f;};'use strict';var client=require(_0x0e5e('0x0'));exports[_0x0e5e('0x1')]=function(_0x297f5e){return client[_0x0e5e('0x2')](_0x0e5e('0x3'),{'body':_0x297f5e,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2f33064..eea3d91 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 _0xcaef=['name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x1716e5,_0x55b565){var _0x282173=function(_0x441fb7){while(--_0x441fb7){_0x1716e5['push'](_0x1716e5['shift']());}};_0x282173(++_0x55b565);}(_0xcaef,0x141));var _0xfcae=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcaef[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports[_0xfcae('0x0')]=function(){return function(){return client[_0xfcae('0x1')](_0xfcae('0x2'),{'options':{'raw':![],'attributes':['id',_0xfcae('0x3'),'timeout',_0xfcae('0x4')],'include':[{'model':_0xfcae('0x5'),'as':_0xfcae('0x6'),'attributes':['id',_0xfcae('0x3'),_0xfcae('0x7'),_0xfcae('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x1a10=['timeout','User','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x24c6e0,_0x2387c1){var _0x277a4f=function(_0x52c46b){while(--_0x52c46b){_0x24c6e0['push'](_0x24c6e0['shift']());}};_0x277a4f(++_0x2387c1);}(_0x1a10,0xc1));var _0x01a1=function(_0x59056b,_0x4f5327){_0x59056b=_0x59056b-0x0;var _0x582465=_0x1a10[_0x59056b];return _0x582465;};'use strict';var client=require(_0x01a1('0x0'));exports[_0x01a1('0x1')]=function(){return function(){return client[_0x01a1('0x2')](_0x01a1('0x3'),{'options':{'raw':![],'attributes':['id',_0x01a1('0x4'),_0x01a1('0x5'),'strategy'],'include':[{'model':_0x01a1('0x6'),'as':_0x01a1('0x7'),'attributes':['id','name',_0x01a1('0x8'),'openchannelPause']}]},'log':_0x01a1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 39d1c71..51af8f4 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 _0xbeb5=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x3982f5,_0x1f367d){var _0x2df43d=function(_0x3577f6){while(--_0x3577f6){_0x3982f5['push'](_0x3982f5['shift']());}};_0x2df43d(++_0x1f367d);}(_0xbeb5,0x14c));var _0x5beb=function(_0x240d59,_0x367f3a){_0x240d59=_0x240d59-0x0;var _0x42a01d=_0xbeb5[_0x240d59];return _0x42a01d;};'use strict';var client=require('../client');exports[_0x5beb('0x0')]=function(_0x42b9d0){return client[_0x5beb('0x1')](_0x5beb('0x2'),{'body':_0x42b9d0,'log':_0x5beb('0x2')});};exports[_0x5beb('0x3')]=function(_0x5c2dbf,_0x54e588){return client['Request'](_0x5beb('0x4'),{'body':_0x54e588,'options':{'where':{'uniqueid':_0x5c2dbf},'order':[['id',_0x5beb('0x5')]],'limit':0x1},'log':_0x5beb('0x4')});}; \ No newline at end of file +var _0xcf7e=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','Request'];(function(_0x337c1,_0x2c15f1){var _0x433e5a=function(_0x46ed98){while(--_0x46ed98){_0x337c1['push'](_0x337c1['shift']());}};_0x433e5a(++_0x2c15f1);}(_0xcf7e,0xaf));var _0xecf7=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xcf7e[_0x13b02f];return _0x12e9a6;};'use strict';var client=require('../client');exports['create']=function(_0x247501){return client[_0xecf7('0x0')](_0xecf7('0x1'),{'body':_0x247501,'log':'CreateOpenchannelQueueReport'});};exports[_0xecf7('0x2')]=function(_0x3f96c4,_0x47983a){return client[_0xecf7('0x0')](_0xecf7('0x3'),{'body':_0x47983a,'options':{'where':{'uniqueid':_0x3f96c4},'order':[['id','DESC']],'limit':0x1},'log':_0xecf7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 4186662..5c9abc8 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 _0x0845=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x2a04fc,_0x464619){var _0x1af242=function(_0x212bd8){while(--_0x212bd8){_0x2a04fc['push'](_0x2a04fc['shift']());}};_0x1af242(++_0x464619);}(_0x0845,0x125));var _0x5084=function(_0x264624,_0x53f83b){_0x264624=_0x264624-0x0;var _0x2a3ef8=_0x0845[_0x264624];return _0x2a3ef8;};'use strict';var client=require(_0x5084('0x0'));exports['update']=function(_0x587345,_0x29719a){return client[_0x5084('0x1')](_0x5084('0x2'),{'body':_0x29719a,'options':{'where':{'id':_0x587345}},'log':_0x5084('0x3')});};exports[_0x5084('0x4')]=function(_0x26a738,_0x4ec3e3){return client[_0x5084('0x1')](_0x5084('0x5'),{'body':_0x4ec3e3,'options':{'where':{'id':_0x26a738}},'log':_0x5084('0x6')});}; \ No newline at end of file +var _0x425d=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x56f29c,_0x4bb59a){var _0x301b51=function(_0x42cc74){while(--_0x42cc74){_0x56f29c['push'](_0x56f29c['shift']());}};_0x301b51(++_0x4bb59a);}(_0x425d,0x1e0));var _0xd425=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x425d[_0x1bb80c];return _0x368f16;};'use strict';var client=require(_0xd425('0x0'));exports['update']=function(_0x322866,_0x2d1eb3){return client[_0xd425('0x1')](_0xd425('0x2'),{'body':_0x2d1eb3,'options':{'where':{'id':_0x322866}},'log':_0xd425('0x3')});};exports[_0xd425('0x4')]=function(_0x47043f,_0x596be7){return client[_0xd425('0x1')](_0xd425('0x5'),{'body':_0x596be7,'options':{'where':{'id':_0x47043f}},'log':_0xd425('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 54f92b9..7895cc8 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 _0x614e=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x51cd34,_0x1486f7){var _0x345c33=function(_0x28e222){while(--_0x28e222){_0x51cd34['push'](_0x51cd34['shift']());}};_0x345c33(++_0x1486f7);}(_0x614e,0x169));var _0xe614=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x614e[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xe614('0x0'));exports[_0xe614('0x1')]=function(_0x1d6e0c){return client[_0xe614('0x2')](_0xe614('0x3'),{'body':_0x1d6e0c,'log':_0xe614('0x4')});}; \ No newline at end of file +var _0x5afe=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x223709,_0x1f408d){var _0x4fd927=function(_0x585333){while(--_0x585333){_0x223709['push'](_0x223709['shift']());}};_0x4fd927(++_0x1f408d);}(_0x5afe,0xb5));var _0xe5af=function(_0x1e1f17,_0x4bd574){_0x1e1f17=_0x1e1f17-0x0;var _0x465b52=_0x5afe[_0x1e1f17];return _0x465b52;};'use strict';var client=require(_0xe5af('0x0'));exports[_0xe5af('0x1')]=function(_0x2a3148){return client[_0xe5af('0x2')](_0xe5af('0x3'),{'body':_0x2a3148,'log':_0xe5af('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5a9c21e..e0d7dd8 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x253f3c,_0x370a6f){var _0xb1abd2=function(_0xa6a658){while(--_0xa6a658){_0x253f3c['push'](_0x253f3c['shift']());}};_0xb1abd2(++_0x370a6f);}(_0x70e0,0x17b));var _0x070e=function(_0x9bfc6b,_0x335748){_0x9bfc6b=_0x9bfc6b-0x0;var _0x3a14ee=_0x70e0[_0x9bfc6b];return _0x3a14ee;};'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 f949dee..cee3c04 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x38a75b,_0x13c503){var _0x484037=function(_0x59e13f){while(--_0x59e13f){_0x38a75b['push'](_0x38a75b['shift']());}};_0x484037(++_0x13c503);}(_0x3e74,0x175));var _0x43e7=function(_0x3cc635,_0x43b7b3){_0x3cc635=_0x3cc635-0x0;var _0x4acb1e=_0x3e74[_0x3cc635];return _0x4acb1e;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x3cb934,_0x42d3f1){var _0x310072=function(_0x449d5c){while(--_0x449d5c){_0x3cb934['push'](_0x3cb934['shift']());}};_0x310072(++_0x42d3f1);}(_0x55ca,0x126));var _0xa55c=function(_0x5712cc,_0x5db7dd){_0x5712cc=_0x5712cc-0x0;var _0x15561a=_0x55ca[_0x5712cc];return _0x15561a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 97e640f..e97be95 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(_0x2106bc,_0x2411f2){var _0x3da9ec=function(_0x7fde75){while(--_0x7fde75){_0x2106bc['push'](_0x2106bc['shift']());}};_0x3da9ec(++_0x2411f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x214b0b,_0x371b45){var _0x176b1f=function(_0x2908ee){while(--_0x2908ee){_0x214b0b['push'](_0x214b0b['shift']());}};_0x176b1f(++_0x371b45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 b94562a..10aeeac 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 _0xb7f0=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x2eaa6b,_0x5f3658){_0x2eaa6b=_0x2eaa6b-0x0;var _0x4770c9=_0xb7f0[_0x2eaa6b];return _0x4770c9;};'use strict';var client=require(_0x0b7f('0x0'));exports[_0x0b7f('0x1')]=function(_0x6640b,_0x405325){return client['Request']('UpdateWhatsappInteraction',{'body':_0x405325,'options':{'where':{'id':_0x6640b}},'log':_0x0b7f('0x2')});};exports[_0x0b7f('0x3')]=function(_0x228377,_0x188ea8){return client[_0x0b7f('0x4')](_0x0b7f('0x5'),{'body':_0x188ea8,'options':{'where':{'id':_0x228377}},'log':_0x0b7f('0x6')});}; \ No newline at end of file +var _0x16a6=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update'];(function(_0xfa758f,_0x3d8e26){var _0x5d7c35=function(_0x405598){while(--_0x405598){_0xfa758f['push'](_0xfa758f['shift']());}};_0x5d7c35(++_0x3d8e26);}(_0x16a6,0x15c));var _0x616a=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x16a6[_0x10dfdf];return _0x4d857d;};'use strict';var client=require(_0x616a('0x0'));exports[_0x616a('0x1')]=function(_0x4c2db3,_0x46df35){return client[_0x616a('0x2')](_0x616a('0x3'),{'body':_0x46df35,'options':{'where':{'id':_0x4c2db3}},'log':_0x616a('0x4')});};exports[_0x616a('0x5')]=function(_0x13cbc6,_0x59fc7e){return client[_0x616a('0x2')](_0x616a('0x6'),{'body':_0x59fc7e,'options':{'where':{'id':_0x13cbc6}},'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 ab5bcfe..6cfdc21 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 _0xf27c=['../client','Request','CreateWhatsappMessage'];(function(_0x5ba513,_0x459c3b){var _0x1132a0=function(_0x2fe943){while(--_0x2fe943){_0x5ba513['push'](_0x5ba513['shift']());}};_0x1132a0(++_0x459c3b);}(_0xf27c,0xf3));var _0xcf27=function(_0x5ef00d,_0x990fa2){_0x5ef00d=_0x5ef00d-0x0;var _0x26017e=_0xf27c[_0x5ef00d];return _0x26017e;};'use strict';var client=require(_0xcf27('0x0'));exports['create']=function(_0x173e44){return client[_0xcf27('0x1')](_0xcf27('0x2'),{'body':_0x173e44,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xce40=['../client','Request'];(function(_0xdadc76,_0xb2711){var _0xdecec5=function(_0x3c96b6){while(--_0x3c96b6){_0xdadc76['push'](_0xdadc76['shift']());}};_0xdecec5(++_0xb2711);}(_0xce40,0x7a));var _0x0ce4=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0xce40[_0x1d6a82];return _0x5834ac;};'use strict';var client=require(_0x0ce4('0x0'));exports['create']=function(_0x111abd){return client[_0x0ce4('0x1')]('CreateWhatsappMessage',{'body':_0x111abd,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0e65b76..a270251 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 _0x7c30=['User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x3fa29a,_0x218173){var _0x4486d8=function(_0x4670e2){while(--_0x4670e2){_0x3fa29a['push'](_0x3fa29a['shift']());}};_0x4486d8(++_0x218173);}(_0x7c30,0x19b));var _0x07c3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7c30[_0x21a9d9];return _0x46adce;};'use strict';var client=require('../client');exports[_0x07c3('0x0')]=function(){return function(){return client[_0x07c3('0x1')](_0x07c3('0x2'),{'options':{'raw':![],'attributes':['id',_0x07c3('0x3'),_0x07c3('0x4'),'strategy'],'include':[{'model':_0x07c3('0x5'),'as':_0x07c3('0x6'),'attributes':['id',_0x07c3('0x3'),'online',_0x07c3('0x7')]}]},'log':_0x07c3('0x0')});};}; \ No newline at end of file +var _0x57a7=['User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x1a52d1,_0x14271e){var _0xad2a2=function(_0x160b18){while(--_0x160b18){_0x1a52d1['push'](_0x1a52d1['shift']());}};_0xad2a2(++_0x14271e);}(_0x57a7,0x11b));var _0x757a=function(_0x26a615,_0x1074ef){_0x26a615=_0x26a615-0x0;var _0x251d7f=_0x57a7[_0x26a615];return _0x251d7f;};'use strict';var client=require(_0x757a('0x0'));exports[_0x757a('0x1')]=function(){return function(){return client[_0x757a('0x2')](_0x757a('0x3'),{'options':{'raw':![],'attributes':['id',_0x757a('0x4'),'timeout','strategy'],'include':[{'model':_0x757a('0x5'),'as':_0x757a('0x6'),'attributes':['id',_0x757a('0x4'),_0x757a('0x7'),'whatsappPause']}]},'log':_0x757a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b073ec9..012e969 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 _0x5868=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x2e9207,_0x515651){var _0x266105=function(_0x551785){while(--_0x551785){_0x2e9207['push'](_0x2e9207['shift']());}};_0x266105(++_0x515651);}(_0x5868,0x95));var _0x8586=function(_0x352423,_0x42017c){_0x352423=_0x352423-0x0;var _0x28df97=_0x5868[_0x352423];return _0x28df97;};'use strict';var client=require(_0x8586('0x0'));exports[_0x8586('0x1')]=function(_0x4867ea){return client[_0x8586('0x2')](_0x8586('0x3'),{'body':_0x4867ea,'log':'CreateWhatsappQueueReport'});};exports[_0x8586('0x4')]=function(_0x32af59,_0x37fee0){return client[_0x8586('0x2')](_0x8586('0x5'),{'body':_0x37fee0,'options':{'where':{'uniqueid':_0x32af59},'order':[['id','DESC']],'limit':0x1},'log':_0x8586('0x5')});}; \ No newline at end of file +var _0x7dfa=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','DESC'];(function(_0x3a8c41,_0x1c4d7e){var _0x3f29a0=function(_0x3a7efb){while(--_0x3a7efb){_0x3a8c41['push'](_0x3a8c41['shift']());}};_0x3f29a0(++_0x1c4d7e);}(_0x7dfa,0x8b));var _0xa7df=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0x7dfa[_0x143565];return _0x4dc1d9;};'use strict';var client=require(_0xa7df('0x0'));exports[_0xa7df('0x1')]=function(_0x5df69a){return client[_0xa7df('0x2')](_0xa7df('0x3'),{'body':_0x5df69a,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0xe2147d,_0x3eefbc){return client[_0xa7df('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3eefbc,'options':{'where':{'uniqueid':_0xe2147d},'order':[['id',_0xa7df('0x4')]],'limit':0x1},'log':_0xa7df('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7b0b5ef..38450f4 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 _0xe953=['error','[%s][AGENT]\x20%s','message','join','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length'];(function(_0x5c221b,_0xee6019){var _0x516f60=function(_0x5a7c43){while(--_0x5a7c43){_0x5c221b['push'](_0x5c221b['shift']());}};_0x516f60(++_0xee6019);}(_0xe953,0x1d0));var _0x3e95=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xe953[_0x35da42];return _0x370035;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x3e95('0x0'));var strategy=require(_0x3e95('0x1'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x3e95('0x2')},'timeout':{'type':'number','message':_0x3e95('0x3')}});function writeLog(_0x4eb4a5,_0x30637c,_0x3faa2b){return logger[_0x3e95('0x4')](util[_0x3e95('0x5')](_0x3e95('0x6'),_0x4eb4a5,_0x30637c['name'],_0x3faa2b));}function handleFindAgent(_0x38c27b){return function(_0x21ac04){return _0x21ac04[_0x3e95('0x7')]['toLowerCase']()===_0x38c27b[_0x3e95('0x8')]();};}exports[_0x3e95('0x9')]=function(_0x35ed18,_0x459b58,_0x57c602,_0x10b851){return function(_0x58a9e2){try{var _0x4719dc={'name':_0x459b58[0x0],'timeout':_0x459b58[0x1]};var _0xa69db=queue[_0x3e95('0xa')](_0x4719dc,{'typecast':!![]});if(_0xa69db[_0x3e95('0xb')]){logger[_0x3e95('0xc')](_0x3e95('0xd'),_0x35ed18,_['map'](_0xa69db,_0x3e95('0xe'))[_0x3e95('0xf')](',\x20'));_0x58a9e2['stop']();}else{var _0x1fb8f1=_[_0x3e95('0x10')](_0x57c602[_0x3e95('0x11')],handleFindAgent(_0x4719dc[_0x3e95('0x7')]));if(_0x1fb8f1){var _0x48055e=(_0x4719dc[_0x3e95('0x12')]||0xa)*0x3e8;var _0xd1d345,_0x5afe28;var _0x21b3b3=seqqueue[_0x3e95('0x13')](_0x48055e);_0x21b3b3['id']=_0x35ed18;_0x21b3b3[_0x3e95('0x14')]=_0x48055e;_0x21b3b3[_0x3e95('0x15')]=_0x10b851['channel'];writeLog(_0x35ed18,_0x1fb8f1,util[_0x3e95('0x5')]('START:%s',_0x48055e));_0x57c602[_0x3e95('0x16')][_0x35ed18]['on'](_0x3e95('0x17'),function(){logger['info'](_0x3e95('0x18'),_0x35ed18);clearTimeout(_0x5afe28);_0x5afe28=undefined;_0x21b3b3[_0x3e95('0x19')]();if(_0x57c602[_0x3e95('0x16')][_0x35ed18]){delete _0x57c602[_0x3e95('0x16')][_0x35ed18];}_0x58a9e2[_0x3e95('0x1a')]();});_0x57c602[_0x3e95('0x16')][_0x35ed18]['on'](_0x3e95('0x1b'),function(){if(_0x57c602[_0x3e95('0x16')][_0x35ed18]){delete _0x57c602['rules'][_0x35ed18];}});_0x5afe28=setTimeout(function(){logger[_0x3e95('0x4')]('[%s][AGENT]\x20ROUTING\x20END',_0x35ed18);clearTimeout(_0x5afe28);_0x21b3b3[_0x3e95('0x19')]();_0x58a9e2[_0x3e95('0x1c')]();},_0x48055e);strategy[_0x3e95('0x1d')](_0x21b3b3,_0x1fb8f1,_0x57c602,_0x10b851);}else{logger['error'](_0x3e95('0x1e'),_0x35ed18,_0x4719dc[_0x3e95('0x7')]);_0x58a9e2[_0x3e95('0x1a')]();}}}catch(_0xf01792){console[_0x3e95('0x1f')](_0xf01792);logger[_0x3e95('0xc')](_0x3e95('0x20'),_0x35ed18,_0xf01792[_0x3e95('0x21')]);_0x58a9e2[_0x3e95('0x1a')]();}};}; \ No newline at end of file +var _0x0bd2=['agents','timeout','createQueue','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','name','log','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','stop','find'];(function(_0x1e9300,_0x1cd496){var _0x39573d=function(_0x327de2){while(--_0x327de2){_0x1e9300['push'](_0x1e9300['shift']());}};_0x39573d(++_0x1cd496);}(_0x0bd2,0x1a9));var _0x20bd=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x0bd2[_0x2dea24];return _0x309d58;};'use strict';var schema=require(_0x20bd('0x0'));var _=require('lodash');var util=require(_0x20bd('0x1'));var seqqueue=require(_0x20bd('0x2'));var logger=require(_0x20bd('0x3'))(_0x20bd('0x4'));var strategy=require(_0x20bd('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x20bd('0x6')},'timeout':{'type':_0x20bd('0x7'),'message':_0x20bd('0x8')}});function writeLog(_0x593f70,_0x4c6169,_0x34b74b){return logger[_0x20bd('0x9')](util['format'](_0x20bd('0xa'),_0x593f70,_0x4c6169['name'],_0x34b74b));}function handleFindAgent(_0x27a9bf){return function(_0xad996d){return _0xad996d['name'][_0x20bd('0xb')]()===_0x27a9bf[_0x20bd('0xb')]();};}exports['consequence']=function(_0x495aae,_0x45bc15,_0x1fcc60,_0x4d4feb){return function(_0x30a29d){try{var _0x19bfc3={'name':_0x45bc15[0x0],'timeout':_0x45bc15[0x1]};var _0x4fa9b0=queue[_0x20bd('0x0')](_0x19bfc3,{'typecast':!![]});if(_0x4fa9b0[_0x20bd('0xc')]){logger[_0x20bd('0xd')](_0x20bd('0xe'),_0x495aae,_['map'](_0x4fa9b0,_0x20bd('0xf'))[_0x20bd('0x10')](',\x20'));_0x30a29d[_0x20bd('0x11')]();}else{var _0x196250=_[_0x20bd('0x12')](_0x1fcc60[_0x20bd('0x13')],handleFindAgent(_0x19bfc3['name']));if(_0x196250){var _0x4fa67c=(_0x19bfc3[_0x20bd('0x14')]||0xa)*0x3e8;var _0x125155,_0x506983;var _0x23425b=seqqueue[_0x20bd('0x15')](_0x4fa67c);_0x23425b['id']=_0x495aae;_0x23425b['atimeout']=_0x4fa67c;_0x23425b[_0x20bd('0x16')]=_0x4d4feb[_0x20bd('0x16')];writeLog(_0x495aae,_0x196250,util[_0x20bd('0x17')](_0x20bd('0x18'),_0x4fa67c));_0x1fcc60[_0x20bd('0x19')][_0x495aae]['on'](_0x20bd('0x1a'),function(){logger[_0x20bd('0x9')](_0x20bd('0x1b'),_0x495aae);clearTimeout(_0x506983);_0x506983=undefined;_0x23425b[_0x20bd('0x1c')]();if(_0x1fcc60[_0x20bd('0x19')][_0x495aae]){delete _0x1fcc60[_0x20bd('0x19')][_0x495aae];}_0x30a29d[_0x20bd('0x11')]();});_0x1fcc60[_0x20bd('0x19')][_0x495aae]['on'](_0x20bd('0x1d'),function(){if(_0x1fcc60[_0x20bd('0x19')][_0x495aae]){delete _0x1fcc60[_0x20bd('0x19')][_0x495aae];}});_0x506983=setTimeout(function(){logger[_0x20bd('0x9')](_0x20bd('0x1e'),_0x495aae);clearTimeout(_0x506983);_0x23425b[_0x20bd('0x1c')]();_0x30a29d[_0x20bd('0x1f')]();},_0x4fa67c);strategy[_0x20bd('0x20')](_0x23425b,_0x196250,_0x1fcc60,_0x4d4feb);}else{logger[_0x20bd('0xd')](_0x20bd('0x21'),_0x495aae,_0x19bfc3[_0x20bd('0x22')]);_0x30a29d['stop']();}}}catch(_0x93e26){console[_0x20bd('0x23')](_0x93e26);logger[_0x20bd('0xd')]('[%s][QUEUE]\x20%s',_0x495aae,_0x93e26[_0x20bd('0x24')]);_0x30a29d[_0x20bd('0x11')]();}};}; \ 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 4042b2b..c73f81b 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 _0xf607=['message','toString','next','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','info','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'];(function(_0x33ceeb,_0x58b863){var _0x5b6556=function(_0x23a6b1){while(--_0x23a6b1){_0x33ceeb['push'](_0x33ceeb['shift']());}};_0x5b6556(++_0x58b863);}(_0xf607,0x175));var _0x7f60=function(_0x5df464,_0x50469c){_0x5df464=_0x5df464-0x0;var _0x4481e2=_0xf607[_0x5df464];return _0x4481e2;};'use strict';var _=require(_0x7f60('0x0'));var moment=require(_0x7f60('0x1'));var AWS=require(_0x7f60('0x2'));var utils=require(_0x7f60('0x3'));var logger=require(_0x7f60('0x4'))(_0x7f60('0x5'));var rpc={'chatMessage':require(_0x7f60('0x6')),'openchannelMessage':require(_0x7f60('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7f60('0x8')),'whatsappMessage':require(_0x7f60('0x9'))};exports[_0x7f60('0xa')]=function(_0x1f5d92,_0x5d83d5){return function(_0x4f381b){try{if(!_[_0x7f60('0xb')](this[_0x7f60('0xc')][_0x7f60('0xd')])){logger['info'](_0x7f60('0xe'),_0x1f5d92,_0x7f60('0xf'));return _0x4f381b['next']();}var _0x488d72={'ContactId':this[_0x7f60('0x10')]['id'],'sentAt':moment()[_0x7f60('0x11')](_0x7f60('0x12')),'direction':_0x7f60('0x13')};if(this[_0x7f60('0x14')]===_0x7f60('0x15')||this[_0x7f60('0x14')]===_0x7f60('0x16')){_0x488d72[_0x7f60('0x17')]=this['interaction'][_0x7f60('0x17')];}var _0x24876f=this[_0x7f60('0x14')];if(_0x24876f===_0x7f60('0x18')){_0x488d72['ChatWebsiteId']=this[_0x7f60('0x19')]['id'];}else{_0x488d72[_[_0x7f60('0x1a')](_0x24876f)+'AccountId']=this[_0x7f60('0x19')]['id'];}_0x488d72[_[_0x7f60('0x1a')](_0x24876f)+'InteractionId']=this[_0x7f60('0xc')]['id'];if(this[_0x7f60('0xc')][_0x7f60('0x1b')]){var _0x2df744=_0x5d83d5[0x4];if(!_[_0x7f60('0x1c')](_0x2df744)){_0x488d72[_0x7f60('0x1d')]=utils[_0x7f60('0x1e')](_0x2df744,this);return rpc[_0x24876f+_0x7f60('0x1f')][_0x7f60('0x20')](_0x488d72)['then'](function(_0x4ba50b){logger[_0x7f60('0x21')](_0x7f60('0xe'),_0x1f5d92,_0x488d72[_0x7f60('0x1d')]);})[_0x7f60('0x22')](function(_0x24c341){logger[_0x7f60('0x23')](_0x7f60('0xe'),_0x1f5d92,JSON[_0x7f60('0x24')](_0x24c341));})[_0x7f60('0x25')](function(){logger[_0x7f60('0x21')](_0x7f60('0x26'),_0x1f5d92);_0x4f381b[_0x7f60('0x27')]();});}else{logger[_0x7f60('0x21')](_0x7f60('0x28'),_0x1f5d92);_0x4f381b[_0x7f60('0x27')]();}}else{var _0x5765da=this;var _0x40eb33=new AWS[(_0x7f60('0x29'))]({'accessKeyId':_0x5d83d5[0x0],'secretAccessKey':_0x5d83d5[0x1],'region':_0x5d83d5[0x2]});var _0x332dd6={'botAlias':_0x7f60('0x2a'),'botName':_0x5d83d5[0x3],'inputText':this[_0x7f60('0x2b')][_0x7f60('0x1d')],'userId':this['channel']+':'+this[_0x7f60('0xc')]['id'][_0x7f60('0x2c')]()};_0x40eb33['postText'](_0x332dd6,function(_0x34107e,_0x127a30){if(_0x34107e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1f5d92,_0x34107e[_0x7f60('0x2b')]);_0x4f381b[_0x7f60('0x2d')]();}else if(_0x127a30&&_0x127a30[_0x7f60('0x2b')]){_0x5765da[_0x7f60('0x1d')][_0x7f60('0x2e')]=_0x127a30;_0x488d72[_0x7f60('0x1d')]=_0x127a30[_0x7f60('0x2b')];_0x488d72[_0x7f60('0x2f')]='amazonlex';_0x488d72[_0x7f60('0x30')]=JSON[_0x7f60('0x24')](_0x127a30);return rpc[_0x24876f+_0x7f60('0x1f')]['create'](_0x488d72)[_0x7f60('0x31')](function(_0x346688){logger[_0x7f60('0x21')]('[%s][AMAZONLEX]\x20%s',_0x1f5d92,_0x488d72[_0x7f60('0x1d')]);if(_0x127a30[_0x7f60('0x32')]==_0x7f60('0x33')){_0x4f381b[_0x7f60('0x2d')]();}else{_0x4f381b[_0x7f60('0x27')]();}})[_0x7f60('0x22')](function(_0x368c80){logger[_0x7f60('0x23')](_0x7f60('0xe'),_0x1f5d92,JSON[_0x7f60('0x24')](_0x368c80));_0x4f381b[_0x7f60('0x2d')]();});}else{_0x4f381b['next']();}});}}catch(_0x3b9f0c){logger['error'](_0x7f60('0xe'),_0x1f5d92,JSON['stringify'](_0x3b9f0c));_0x4f381b[_0x7f60('0x27')]();}};}; \ No newline at end of file +var _0x24fd=['then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','postText','amazonlex','providerName','dialogState','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','body','getMustacheRender'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x24fd,0xb2));var _0xd24f=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x24fd[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xd24f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xd24f('0x1'));var logger=require(_0xd24f('0x2'))(_0xd24f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd24f('0x4')),'mailMessage':require(_0xd24f('0x5')),'smsMessage':require(_0xd24f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd24f('0x7'))};exports[_0xd24f('0x8')]=function(_0x1f1356,_0x3dc2eb){return function(_0xf89bae){try{if(!_['isNil'](this[_0xd24f('0x9')]['UserId'])){logger['info'](_0xd24f('0xa'),_0x1f1356,_0xd24f('0xb'));return _0xf89bae[_0xd24f('0xc')]();}var _0x531af1={'ContactId':this[_0xd24f('0xd')]['id'],'sentAt':moment()[_0xd24f('0xe')](_0xd24f('0xf')),'direction':_0xd24f('0x10')};if(this[_0xd24f('0x11')]===_0xd24f('0x12')||this[_0xd24f('0x11')]==='whatsapp'){_0x531af1['phone']=this['interaction']['phone'];}var _0x1b1ef7=this[_0xd24f('0x11')];if(_0x1b1ef7===_0xd24f('0x13')){_0x531af1[_0xd24f('0x14')]=this['account']['id'];}else{_0x531af1[_[_0xd24f('0x15')](_0x1b1ef7)+'AccountId']=this[_0xd24f('0x16')]['id'];}_0x531af1[_[_0xd24f('0x15')](_0x1b1ef7)+_0xd24f('0x17')]=this[_0xd24f('0x9')]['id'];if(this[_0xd24f('0x9')][_0xd24f('0x18')]){var _0x3a7991=_0x3dc2eb[0x4];if(!_['isEmpty'](_0x3a7991)){_0x531af1[_0xd24f('0x19')]=utils[_0xd24f('0x1a')](_0x3a7991,this);return rpc[_0x1b1ef7+'Message']['create'](_0x531af1)[_0xd24f('0x1b')](function(_0x4f0efb){logger[_0xd24f('0x1c')](_0xd24f('0xa'),_0x1f1356,_0x531af1[_0xd24f('0x19')]);})[_0xd24f('0x1d')](function(_0x4f3bd7){logger[_0xd24f('0x1e')](_0xd24f('0xa'),_0x1f1356,JSON[_0xd24f('0x1f')](_0x4f3bd7));})[_0xd24f('0x20')](function(){logger['info'](_0xd24f('0x21'),_0x1f1356);_0xf89bae['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1f1356);_0xf89bae[_0xd24f('0x22')]();}}else{var _0x58988a=this;var _0x2b2560=new AWS['LexRuntime']({'accessKeyId':_0x3dc2eb[0x0],'secretAccessKey':_0x3dc2eb[0x1],'region':_0x3dc2eb[0x2]});var _0x255eec={'botAlias':_0xd24f('0x23'),'botName':_0x3dc2eb[0x3],'inputText':this[_0xd24f('0x24')]['body'],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x2b2560[_0xd24f('0x25')](_0x255eec,function(_0x589076,_0x358dcd){if(_0x589076){logger[_0xd24f('0x1e')](_0xd24f('0xa'),_0x1f1356,_0x589076[_0xd24f('0x24')]);_0xf89bae[_0xd24f('0xc')]();}else if(_0x358dcd&&_0x358dcd[_0xd24f('0x24')]){_0x58988a[_0xd24f('0x19')][_0xd24f('0x26')]=_0x358dcd;_0x531af1['body']=_0x358dcd['message'];_0x531af1[_0xd24f('0x27')]=_0xd24f('0x26');_0x531af1['providerResponse']=JSON[_0xd24f('0x1f')](_0x358dcd);return rpc[_0x1b1ef7+'Message']['create'](_0x531af1)['then'](function(_0x1d5f6d){logger[_0xd24f('0x1c')](_0xd24f('0xa'),_0x1f1356,_0x531af1[_0xd24f('0x19')]);if(_0x358dcd[_0xd24f('0x28')]=='Failed'){_0xf89bae[_0xd24f('0xc')]();}else{_0xf89bae['stop']();}})['catch'](function(_0x454d58){logger[_0xd24f('0x1e')](_0xd24f('0xa'),_0x1f1356,JSON[_0xd24f('0x1f')](_0x454d58));_0xf89bae['next']();});}else{_0xf89bae[_0xd24f('0xc')]();}});}}catch(_0x305f9f){logger[_0xd24f('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x1f1356,JSON[_0xd24f('0x1f')](_0x305f9f));_0xf89bae['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 0922294..f339582 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 _0x8aea=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','channel','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','finally','resolve','Interaction','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8aea,0x199));var _0xa8ae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8aea[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var moment=require(_0xa8ae('0x0'));var utils=require(_0xa8ae('0x1'));var logger=require(_0xa8ae('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa8ae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa8ae('0x4')),'faxMessage':require(_0xa8ae('0x5')),'whatsappMessage':require(_0xa8ae('0x6')),'chatInteraction':require(_0xa8ae('0x7')),'openchannelInteraction':require(_0xa8ae('0x8')),'mailInteraction':require(_0xa8ae('0x9')),'smsInteraction':require(_0xa8ae('0xa')),'faxInteraction':require(_0xa8ae('0xb')),'whatsappInteraction':require(_0xa8ae('0xc'))};var mailRpc=require(_0xa8ae('0xd'));exports[_0xa8ae('0xe')]=function(_0x465554,_0x28a4a9,_0x48a029,_0x4296a8){return function(_0x31ce88){try{var _0x497190=this['channel'];if(_0x497190==='mail'&&_0x4296a8['body'][_0xa8ae('0xf')]){logger[_0xa8ae('0x10')](_0xa8ae('0x11'),_0x465554,_0xa8ae('0x12'));return _0x31ce88[_0xa8ae('0x13')]();}if(_0x28a4a9[0x0]==='1'&&(_['isNil'](this[_0xa8ae('0x14')][_0xa8ae('0x15')])||!this[_0xa8ae('0x14')][_0xa8ae('0x15')])){logger[_0xa8ae('0x10')](_0xa8ae('0x11'),_0x465554,'Autoreply\x20already\x20sent');return _0x31ce88['next']();}if(_0x28a4a9[0x0]==='2'&&this[_0xa8ae('0x14')][_0xa8ae('0x16')]){logger[_0xa8ae('0x10')](_0xa8ae('0x17'),_0x465554,_0xa8ae('0x18'));return _0x31ce88['next']();}var _0x5b7a0d={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa8ae('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa8ae('0x1a')};if(this[_0xa8ae('0x1b')]===_0xa8ae('0x1c')){_0x5b7a0d[_0xa8ae('0x1d')]=utils[_0xa8ae('0x1e')](_0x28a4a9[0x2],this);}else{_0x5b7a0d[_0xa8ae('0x1d')]=utils['getMustacheRender'](_0x28a4a9[0x1],this);}if(this[_0xa8ae('0x1f')]){_0x5b7a0d['to']=this[_0xa8ae('0x1f')]['from']||'';if(this[_0xa8ae('0x1b')]===_0xa8ae('0x1c')&&_0x28a4a9[0x1]==='1'){_0x5b7a0d['cc']=this['message']['cc']||'';}_0x5b7a0d[_0xa8ae('0x20')]=this[_0xa8ae('0x1f')]['to']||'';_0x5b7a0d[_0xa8ae('0x21')]=this[_0xa8ae('0x1f')][_0xa8ae('0x21')]||'';_0x5b7a0d[_0xa8ae('0x22')]=!![];if(this[_0xa8ae('0x1f')]['subject']){_0x5b7a0d[_0xa8ae('0x23')]='';_0x5b7a0d[_0xa8ae('0x23')]+=_[_0xa8ae('0x24')](this[_0xa8ae('0x1f')][_0xa8ae('0x23')],_0xa8ae('0x25'))?'':_0xa8ae('0x26');_0x5b7a0d[_0xa8ae('0x23')]+=this[_0xa8ae('0x1f')]['subject'];}}if(this[_0xa8ae('0x1b')]===_0xa8ae('0x27')){_0x5b7a0d['ChatWebsiteId']=this[_0xa8ae('0x28')]['id'];}else{_0x5b7a0d[_[_0xa8ae('0x29')](this[_0xa8ae('0x1b')])+'AccountId']=this[_0xa8ae('0x28')]['id'];}_0x5b7a0d[_['upperFirst'](this[_0xa8ae('0x1b')])+_0xa8ae('0x2a')]=this['interaction']['id'];var _0x92b3b1=this['interaction'];if(rpc[this[_0xa8ae('0x1b')]+_0xa8ae('0x2b')]){if(this[_0xa8ae('0x1b')]===_0xa8ae('0x1c')){_0x5b7a0d[_0xa8ae('0x2c')]=this['message'][_0xa8ae('0x2d')];_0x5b7a0d[_0xa8ae('0x2e')]=_0xa8ae('0x2f')+_[_0xa8ae('0x30')](_0x5b7a0d['body'],_0xa8ae('0x31'),_0xa8ae('0x32'))+_0xa8ae('0x33');_0x5b7a0d[_0xa8ae('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xa8ae('0x35'),'Precedence':_0xa8ae('0x36')};return mailRpc[_0xa8ae('0x37')](this[_0xa8ae('0x28')][_0xa8ae('0x38')],_0x5b7a0d)[_0xa8ae('0x39')](function(_0x7d1421){logger['info'](_0xa8ae('0x3a'),_0x465554);_0x5b7a0d[_0xa8ae('0x2d')]=_0x7d1421[_0xa8ae('0x1f')][_0xa8ae('0x2d')];return rpc[_0x497190+_0xa8ae('0x2b')][_0xa8ae('0x3b')](_0x5b7a0d);})[_0xa8ae('0x39')](function(_0x1d9e21){logger[_0xa8ae('0x10')](_0xa8ae('0x11'),_0x465554,JSON[_0xa8ae('0x3c')](_0x1d9e21));})[_0xa8ae('0x3d')](function(_0xfdb2d3){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x465554,JSON[_0xa8ae('0x3c')](_0xfdb2d3));})[_0xa8ae('0x3e')](function(){Promise[_0xa8ae('0x3f')]()[_0xa8ae('0x39')](function(){if(_0x28a4a9[0x0]!=='2'||_0x92b3b1[_0xa8ae('0x16')])return;return rpc[_0x497190+_0xa8ae('0x40')]['update'](_0x92b3b1['id'],{'autoreplyExecuted':!![]})[_0xa8ae('0x39')](function(_0x4807b8){logger[_0xa8ae('0x10')](_0xa8ae('0x17'),_0x465554,JSON[_0xa8ae('0x3c')](_0x4807b8));})[_0xa8ae('0x3d')](function(_0x5c7c4a){logger[_0xa8ae('0x41')](_0xa8ae('0x42'),_0x465554,JSON[_0xa8ae('0x3c')](_0x5c7c4a));});})[_0xa8ae('0x39')](function(){_0x31ce88[_0xa8ae('0x13')]();});});}else{return rpc[this[_0xa8ae('0x1b')]+_0xa8ae('0x2b')]['create'](_0x5b7a0d)[_0xa8ae('0x39')](function(){logger['info'](_0xa8ae('0x11'),_0x465554,_0x5b7a0d[_0xa8ae('0x1d')]);})[_0xa8ae('0x3d')](function(_0x2d830d){logger[_0xa8ae('0x41')](_0xa8ae('0x11'),_0x465554,JSON[_0xa8ae('0x3c')](_0x2d830d));})[_0xa8ae('0x3e')](function(){Promise[_0xa8ae('0x3f')]()[_0xa8ae('0x39')](function(){if(_0x28a4a9[0x0]!=='2'||_0x92b3b1['autoreplyExecuted'])return;return rpc[_0x497190+_0xa8ae('0x40')][_0xa8ae('0x43')](_0x92b3b1['id'],{'autoreplyExecuted':!![]})[_0xa8ae('0x39')](function(_0x449f7d){logger[_0xa8ae('0x10')](_0xa8ae('0x17'),_0x465554,JSON['stringify'](_0x449f7d));})[_0xa8ae('0x3d')](function(_0x1487ec){logger[_0xa8ae('0x41')](_0xa8ae('0x42'),_0x465554,JSON['stringify'](_0x1487ec));});})['then'](function(){_0x31ce88['next']();});});}}}catch(_0x16bc8e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x465554,JSON[_0xa8ae('0x3c')](_0x16bc8e));_0x31ce88[_0xa8ae('0x44')]();}};}; \ No newline at end of file +var _0xaeb1=['../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','channel','mail','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','html','','replace','','headers','auto-replied','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','finally','Interaction','error','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0xaeb1,0x1e0));var _0x1aeb=function(_0x2ec9cb,_0x240305){_0x2ec9cb=_0x2ec9cb-0x0;var _0x1cd34b=_0xaeb1[_0x2ec9cb];return _0x1cd34b;};'use strict';var _=require(_0x1aeb('0x0'));var moment=require(_0x1aeb('0x1'));var utils=require('./utils');var logger=require(_0x1aeb('0x2'))('routing');var rpc={'chatMessage':require(_0x1aeb('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1aeb('0x4')),'smsMessage':require(_0x1aeb('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1aeb('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1aeb('0x7')),'mailInteraction':require(_0x1aeb('0x8')),'smsInteraction':require(_0x1aeb('0x9')),'faxInteraction':require(_0x1aeb('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x224e0c,_0xa09fcc,_0x551abf,_0xc444e){return function(_0x29e81c){try{var _0x3077b4=this[_0x1aeb('0xb')];if(_0x3077b4===_0x1aeb('0xc')&&_0xc444e[_0x1aeb('0xd')]['isAutoreply']){logger['info'](_0x1aeb('0xe'),_0x224e0c,_0x1aeb('0xf'));return _0x29e81c[_0x1aeb('0x10')]();}if(_0xa09fcc[0x0]==='1'&&(_[_0x1aeb('0x11')](this[_0x1aeb('0x12')][_0x1aeb('0x13')])||!this[_0x1aeb('0x12')][_0x1aeb('0x13')])){logger[_0x1aeb('0x14')](_0x1aeb('0xe'),_0x224e0c,_0x1aeb('0x15'));return _0x29e81c[_0x1aeb('0x10')]();}if(_0xa09fcc[0x0]==='2'&&this[_0x1aeb('0x12')]['autoreplyExecuted']){logger[_0x1aeb('0x14')](_0x1aeb('0x16'),_0x224e0c,_0x1aeb('0x17'));return _0x29e81c[_0x1aeb('0x10')]();}var _0x17d701={'ContactId':this[_0x1aeb('0x18')]['id'],'sentAt':moment()[_0x1aeb('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x1aeb('0xb')]==='mail'){_0x17d701['body']=utils[_0x1aeb('0x1a')](_0xa09fcc[0x2],this);}else{_0x17d701['body']=utils[_0x1aeb('0x1a')](_0xa09fcc[0x1],this);}if(this[_0x1aeb('0x1b')]){_0x17d701['to']=this['message']['from']||'';if(this['channel']===_0x1aeb('0xc')&&_0xa09fcc[0x1]==='1'){_0x17d701['cc']=this['message']['cc']||'';}_0x17d701['from']=this['message']['to']||'';_0x17d701['phone']=this[_0x1aeb('0x1b')]['phone']||'';_0x17d701[_0x1aeb('0x1c')]=!![];if(this['message']['subject']){_0x17d701[_0x1aeb('0x1d')]='';_0x17d701['subject']+=_['startsWith'](this[_0x1aeb('0x1b')]['subject'],_0x1aeb('0x1e'))?'':_0x1aeb('0x1f');_0x17d701[_0x1aeb('0x1d')]+=this[_0x1aeb('0x1b')][_0x1aeb('0x1d')];}}if(this[_0x1aeb('0xb')]==='chat'){_0x17d701[_0x1aeb('0x20')]=this[_0x1aeb('0x21')]['id'];}else{_0x17d701[_[_0x1aeb('0x22')](this['channel'])+_0x1aeb('0x23')]=this['account']['id'];}_0x17d701[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x1aeb('0x12')]['id'];var _0x24a2e7=this[_0x1aeb('0x12')];if(rpc[this[_0x1aeb('0xb')]+_0x1aeb('0x24')]){if(this[_0x1aeb('0xb')]===_0x1aeb('0xc')){_0x17d701['inReplyTo']=this[_0x1aeb('0x1b')]['messageId'];_0x17d701[_0x1aeb('0x25')]=_0x1aeb('0x26')+_[_0x1aeb('0x27')](_0x17d701['body'],_0x1aeb('0x28'),_0x1aeb('0x29'))+_0x1aeb('0x2a');_0x17d701[_0x1aeb('0x2b')]={'Auto-Submitted':_0x1aeb('0x2c'),'X-Auto-Response-Suppress':'All','Precedence':_0x1aeb('0x2d')};return mailRpc['sendMailMessage'](this[_0x1aeb('0x21')][_0x1aeb('0x2e')],_0x17d701)[_0x1aeb('0x2f')](function(_0x42cd7a){logger[_0x1aeb('0x14')](_0x1aeb('0x30'),_0x224e0c);_0x17d701['messageId']=_0x42cd7a[_0x1aeb('0x1b')]['messageId'];return rpc[_0x3077b4+'Message'][_0x1aeb('0x31')](_0x17d701);})[_0x1aeb('0x2f')](function(_0x39a8d3){logger[_0x1aeb('0x14')](_0x1aeb('0xe'),_0x224e0c,JSON[_0x1aeb('0x32')](_0x39a8d3));})['catch'](function(_0x5a9653){logger['error'](_0x1aeb('0x33'),_0x224e0c,JSON['stringify'](_0x5a9653));})['finally'](function(){Promise[_0x1aeb('0x34')]()[_0x1aeb('0x2f')](function(){if(_0xa09fcc[0x0]!=='2'||_0x24a2e7[_0x1aeb('0x35')])return;return rpc[_0x3077b4+'Interaction'][_0x1aeb('0x36')](_0x24a2e7['id'],{'autoreplyExecuted':!![]})[_0x1aeb('0x2f')](function(_0x3bb205){logger[_0x1aeb('0x14')](_0x1aeb('0x16'),_0x224e0c,JSON[_0x1aeb('0x32')](_0x3bb205));})['catch'](function(_0x4c0b3b){logger['error'](_0x1aeb('0x37'),_0x224e0c,JSON['stringify'](_0x4c0b3b));});})['then'](function(){_0x29e81c[_0x1aeb('0x10')]();});});}else{return rpc[this['channel']+_0x1aeb('0x24')][_0x1aeb('0x31')](_0x17d701)[_0x1aeb('0x2f')](function(){logger[_0x1aeb('0x14')]('[%s][AUTOREPLY]\x20%s',_0x224e0c,_0x17d701[_0x1aeb('0xd')]);})[_0x1aeb('0x38')](function(_0x140720){logger['error'](_0x1aeb('0xe'),_0x224e0c,JSON[_0x1aeb('0x32')](_0x140720));})[_0x1aeb('0x39')](function(){Promise[_0x1aeb('0x34')]()['then'](function(){if(_0xa09fcc[0x0]!=='2'||_0x24a2e7[_0x1aeb('0x35')])return;return rpc[_0x3077b4+_0x1aeb('0x3a')][_0x1aeb('0x36')](_0x24a2e7['id'],{'autoreplyExecuted':!![]})['then'](function(_0x40239e){logger[_0x1aeb('0x14')](_0x1aeb('0x16'),_0x224e0c,JSON['stringify'](_0x40239e));})['catch'](function(_0x5bb2d2){logger[_0x1aeb('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x224e0c,JSON[_0x1aeb('0x32')](_0x5bb2d2));});})[_0x1aeb('0x2f')](function(){_0x29e81c[_0x1aeb('0x10')]();});});}}}catch(_0x3d159d){logger[_0x1aeb('0x3b')](_0x1aeb('0xe'),_0x224e0c,JSON[_0x1aeb('0x32')](_0x3d159d));_0x29e81c[_0x1aeb('0x3c')]();}};}; \ 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 b797748..b7d79a8 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 _0x5586=['stop','moment','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x1261f5,_0x3dc4cd){var _0xf05364=function(_0x50d56d){while(--_0x50d56d){_0x1261f5['push'](_0x1261f5['shift']());}};_0xf05364(++_0x3dc4cd);}(_0x5586,0x12d));var _0x6558=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5586[_0x27af45];return _0x18df21;};'use strict';var moment=require(_0x6558('0x0'));var logger=require(_0x6558('0x1'))(_0x6558('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6558('0x3')),'mailInteraction':require(_0x6558('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6558('0x5'))};exports[_0x6558('0x6')]=function(_0x38df96,_0x597382,_0x5910e4,_0xd48f6d){return function(_0x40b8af){try{logger[_0x6558('0x7')](_0x6558('0x8'),_0x38df96,_0x597382[0x0]);var _0x26c313={'closed':0x1,'closedAt':moment()['format'](_0x6558('0x9')),'closeReason':'system','disposition':_0x597382[0x0]};if(rpc[_0xd48f6d[_0x6558('0xa')]+'Interaction']){rpc[_0xd48f6d[_0x6558('0xa')]+_0x6558('0xb')][_0x6558('0xc')](_0xd48f6d[_0x6558('0xd')]['id'],_0x26c313)[_0x6558('0xe')](function(_0x17578a){logger[_0x6558('0x7')](_0x6558('0xf'),_0x38df96,_0xd48f6d['interaction']['id']);})['catch'](function(_0xf864ff){logger['error'](_0x6558('0x10'),_0x38df96,JSON[_0x6558('0x11')](_0xf864ff));})[_0x6558('0x12')](function(){_0x40b8af[_0x6558('0x13')]();});}}catch(_0x5429cc){logger['error'](_0x6558('0x10'),_0x38df96,JSON[_0x6558('0x11')](_0x5429cc));_0x40b8af[_0x6558('0x13')]();}};}; \ No newline at end of file +var _0x2645=['[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','stop','error','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x57c3ae,_0x39ac3f){var _0x56e12c=function(_0x514b7c){while(--_0x514b7c){_0x57c3ae['push'](_0x57c3ae['shift']());}};_0x56e12c(++_0x39ac3f);}(_0x2645,0x72));var _0x5264=function(_0xef078c,_0x577042){_0xef078c=_0xef078c-0x0;var _0x446e67=_0x2645[_0xef078c];return _0x446e67;};'use strict';var moment=require('moment');var logger=require(_0x5264('0x0'))('routing');var rpc={'chatInteraction':require(_0x5264('0x1')),'openchannelInteraction':require(_0x5264('0x2')),'smsInteraction':require(_0x5264('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5264('0x4')),'whatsappInteraction':require(_0x5264('0x5'))};exports['consequence']=function(_0x11ca41,_0x515f4a,_0x44ae8c,_0x51649a){return function(_0x2744d1){try{logger['info'](_0x5264('0x6'),_0x11ca41,_0x515f4a[0x0]);var _0x433556={'closed':0x1,'closedAt':moment()['format'](_0x5264('0x7')),'closeReason':'system','disposition':_0x515f4a[0x0]};if(rpc[_0x51649a[_0x5264('0x8')]+_0x5264('0x9')]){rpc[_0x51649a[_0x5264('0x8')]+'Interaction'][_0x5264('0xa')](_0x51649a[_0x5264('0xb')]['id'],_0x433556)[_0x5264('0xc')](function(_0x3702ef){logger[_0x5264('0xd')](_0x5264('0xe'),_0x11ca41,_0x51649a[_0x5264('0xb')]['id']);})[_0x5264('0xf')](function(_0x37f1f2){logger['error'](_0x5264('0x10'),_0x11ca41,JSON['stringify'](_0x37f1f2));})[_0x5264('0x11')](function(){_0x2744d1[_0x5264('0x12')]();});}}catch(_0x5222e9){logger[_0x5264('0x13')](_0x5264('0x10'),_0x11ca41,JSON['stringify'](_0x5222e9));_0x2744d1[_0x5264('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 8a5fd94..cf3d9ce 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 _0xfdb3=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','channel','sms','whatsapp','phone','chat','account','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','result','fulfillment','providerName','metadata','endConversation','lodash','moment','md5','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x2de038,_0xe8bcb1){var _0x27b962=function(_0x9435a){while(--_0x9435a){_0x2de038['push'](_0x2de038['shift']());}};_0x27b962(++_0xe8bcb1);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x2bab2a,_0x3312f4){_0x2bab2a=_0x2bab2a-0x0;var _0x44b001=_0xfdb3[_0x2bab2a];return _0x44b001;};'use strict';var _=require(_0x3fdb('0x0'));var moment=require(_0x3fdb('0x1'));var apiai=require('apiai-promise');var md5=require(_0x3fdb('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3fdb('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3fdb('0x4')),'mailMessage':require(_0x3fdb('0x5')),'smsMessage':require(_0x3fdb('0x6')),'faxMessage':require(_0x3fdb('0x7')),'whatsappMessage':require(_0x3fdb('0x8'))};exports['consequence']=function(_0x3433d8,_0x4fe9c){return function(_0x102a21){try{if(!_['isNil'](this[_0x3fdb('0x9')]['UserId'])){logger[_0x3fdb('0xa')](_0x3fdb('0xb'),_0x3433d8,_0x3fdb('0xc'));return _0x102a21[_0x3fdb('0xd')]();}var _0x2042b7={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x3fdb('0xe')]===_0x3fdb('0xf')||this[_0x3fdb('0xe')]===_0x3fdb('0x10')){_0x2042b7[_0x3fdb('0x11')]=this[_0x3fdb('0x9')][_0x3fdb('0x11')];}var _0xe6d945=this[_0x3fdb('0xe')];if(_0xe6d945===_0x3fdb('0x12')){_0x2042b7['ChatWebsiteId']=this[_0x3fdb('0x13')]['id'];}else{_0x2042b7[_[_0x3fdb('0x14')](_0xe6d945)+'AccountId']=this[_0x3fdb('0x13')]['id'];}_0x2042b7[_[_0x3fdb('0x14')](_0xe6d945)+_0x3fdb('0x15')]=this[_0x3fdb('0x9')]['id'];if(this['interaction']['created']){var _0x52132a=_0x4fe9c[0x2];if(!_[_0x3fdb('0x16')](_0x52132a)){_0x2042b7[_0x3fdb('0x17')]=utils[_0x3fdb('0x18')](_0x52132a,this);return rpc[_0xe6d945+_0x3fdb('0x19')][_0x3fdb('0x1a')](_0x2042b7)['then'](function(_0x224035){logger[_0x3fdb('0xa')](_0x3fdb('0xb'),_0x3433d8,_0x2042b7[_0x3fdb('0x17')]);})[_0x3fdb('0x1b')](function(_0x4d9a94){logger[_0x3fdb('0x1c')](_0x3fdb('0xb'),_0x3433d8,JSON[_0x3fdb('0x1d')](_0x4d9a94));})[_0x3fdb('0x1e')](function(){logger[_0x3fdb('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3433d8);_0x102a21[_0x3fdb('0x1f')]();});}else{logger['info'](_0x3fdb('0x20'),_0x3433d8);_0x102a21['stop']();}}else{var _0x516440=this;var _0x48b674=apiai(_0x4fe9c[0x0],{'language':_0x4fe9c[0x1]||'en'});return _0x48b674['textRequest'](this[_0x3fdb('0x21')][_0x3fdb('0x17')],{'sessionId':md5(this[_0x3fdb('0x9')]['id'])})[_0x3fdb('0x22')](function(_0x111cb8){_0x516440[_0x3fdb('0x17')]['dialogflow']=_0x111cb8;_0x2042b7['body']=_0x111cb8[_0x3fdb('0x23')][_0x3fdb('0x24')]['speech'];_0x2042b7[_0x3fdb('0x25')]='dialogflow';_0x2042b7['providerResponse']=JSON[_0x3fdb('0x1d')](_0x111cb8);return rpc[_0xe6d945+_0x3fdb('0x19')]['create'](_0x2042b7)[_0x3fdb('0x22')](function(_0x4d9c14){logger[_0x3fdb('0xa')](_0x3fdb('0xb'),_0x3433d8,_0x2042b7[_0x3fdb('0x17')]);if(_0x111cb8[_0x3fdb('0x23')][_0x3fdb('0x26')][_0x3fdb('0x27')]){_0x102a21[_0x3fdb('0xd')]();}else{_0x102a21[_0x3fdb('0x1f')]();}})['catch'](function(_0x5ee789){logger[_0x3fdb('0x1c')](_0x3fdb('0xb'),_0x3433d8,JSON[_0x3fdb('0x1d')](_0x5ee789));_0x102a21[_0x3fdb('0xd')]();});})[_0x3fdb('0x1b')](function(_0xa87d82){logger[_0x3fdb('0x1c')](_0x3fdb('0xb'),_0x3433d8,_0xa87d82['message']);_0x102a21[_0x3fdb('0xd')]();});}}catch(_0x28e097){logger[_0x3fdb('0x1c')](_0x3fdb('0xb'),_0x3433d8,JSON[_0x3fdb('0x1d')](_0x28e097));_0x102a21[_0x3fdb('0x1f')]();}};}; \ No newline at end of file +var _0x672a=['out','sms','channel','whatsapp','phone','chat','account','upperFirst','created','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3985fa,_0x324f42){var _0x4ec997=function(_0x3baab7){while(--_0x3baab7){_0x3985fa['push'](_0x3985fa['shift']());}};_0x4ec997(++_0x324f42);}(_0x672a,0x122));var _0xa672=function(_0x5456e3,_0x218a5a){_0x5456e3=_0x5456e3-0x0;var _0x6815cb=_0x672a[_0x5456e3];return _0x6815cb;};'use strict';var _=require(_0xa672('0x0'));var moment=require(_0xa672('0x1'));var apiai=require(_0xa672('0x2'));var md5=require(_0xa672('0x3'));var utils=require(_0xa672('0x4'));var logger=require(_0xa672('0x5'))(_0xa672('0x6'));var rpc={'chatMessage':require(_0xa672('0x7')),'openchannelMessage':require(_0xa672('0x8')),'mailMessage':require(_0xa672('0x9')),'smsMessage':require(_0xa672('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa672('0xb'))};exports[_0xa672('0xc')]=function(_0x3a4797,_0x33dd0c){return function(_0x13402c){try{if(!_[_0xa672('0xd')](this[_0xa672('0xe')][_0xa672('0xf')])){logger[_0xa672('0x10')](_0xa672('0x11'),_0x3a4797,_0xa672('0x12'));return _0x13402c[_0xa672('0x13')]();}var _0x2c1de6={'ContactId':this[_0xa672('0x14')]['id'],'sentAt':moment()['format'](_0xa672('0x15')),'direction':_0xa672('0x16')};if(this['channel']===_0xa672('0x17')||this[_0xa672('0x18')]===_0xa672('0x19')){_0x2c1de6[_0xa672('0x1a')]=this[_0xa672('0xe')][_0xa672('0x1a')];}var _0x26deb7=this[_0xa672('0x18')];if(_0x26deb7===_0xa672('0x1b')){_0x2c1de6['ChatWebsiteId']=this[_0xa672('0x1c')]['id'];}else{_0x2c1de6[_[_0xa672('0x1d')](_0x26deb7)+'AccountId']=this['account']['id'];}_0x2c1de6[_[_0xa672('0x1d')](_0x26deb7)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xa672('0x1e')]){var _0x582a75=_0x33dd0c[0x2];if(!_['isEmpty'](_0x582a75)){_0x2c1de6[_0xa672('0x1f')]=utils[_0xa672('0x20')](_0x582a75,this);return rpc[_0x26deb7+_0xa672('0x21')][_0xa672('0x22')](_0x2c1de6)[_0xa672('0x23')](function(_0x10dc1c){logger[_0xa672('0x10')](_0xa672('0x11'),_0x3a4797,_0x2c1de6[_0xa672('0x1f')]);})[_0xa672('0x24')](function(_0x580858){logger[_0xa672('0x25')](_0xa672('0x11'),_0x3a4797,JSON[_0xa672('0x26')](_0x580858));})[_0xa672('0x27')](function(){logger[_0xa672('0x10')](_0xa672('0x28'),_0x3a4797);_0x13402c['stop']();});}else{logger[_0xa672('0x10')](_0xa672('0x29'),_0x3a4797);_0x13402c[_0xa672('0x2a')]();}}else{var _0x894eef=this;var _0x394e54=apiai(_0x33dd0c[0x0],{'language':_0x33dd0c[0x1]||'en'});return _0x394e54['textRequest'](this[_0xa672('0x2b')][_0xa672('0x1f')],{'sessionId':md5(this[_0xa672('0xe')]['id'])})[_0xa672('0x23')](function(_0x4a9d19){_0x894eef['body'][_0xa672('0x2c')]=_0x4a9d19;_0x2c1de6['body']=_0x4a9d19[_0xa672('0x2d')][_0xa672('0x2e')][_0xa672('0x2f')];_0x2c1de6[_0xa672('0x30')]=_0xa672('0x2c');_0x2c1de6[_0xa672('0x31')]=JSON['stringify'](_0x4a9d19);return rpc[_0x26deb7+'Message'][_0xa672('0x22')](_0x2c1de6)[_0xa672('0x23')](function(_0x229f7f){logger['info'](_0xa672('0x11'),_0x3a4797,_0x2c1de6[_0xa672('0x1f')]);if(_0x4a9d19['result'][_0xa672('0x32')][_0xa672('0x33')]){_0x13402c['next']();}else{_0x13402c[_0xa672('0x2a')]();}})[_0xa672('0x24')](function(_0x47daa1){logger[_0xa672('0x25')](_0xa672('0x11'),_0x3a4797,JSON[_0xa672('0x26')](_0x47daa1));_0x13402c[_0xa672('0x13')]();});})[_0xa672('0x24')](function(_0x48ccf3){logger[_0xa672('0x25')](_0xa672('0x11'),_0x3a4797,_0x48ccf3[_0xa672('0x2b')]);_0x13402c[_0xa672('0x13')]();});}}catch(_0x45cdb5){logger[_0xa672('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x3a4797,JSON[_0xa672('0x26')](_0x45cdb5));_0x13402c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 5e8a395..9fdebf6 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 _0x2a55=['channel','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','then','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','error','stack','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms'];(function(_0x14b2db,_0x35b75a){var _0x4d4c23=function(_0x99d6f1){while(--_0x99d6f1){_0x14b2db['push'](_0x14b2db['shift']());}};_0x4d4c23(++_0x35b75a);}(_0x2a55,0x17a));var _0x52a5=function(_0x3219e9,_0x31aa4e){_0x3219e9=_0x3219e9-0x0;var _0x1fbe22=_0x2a55[_0x3219e9];return _0x1fbe22;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x52a5('0x0'));var moment=require(_0x52a5('0x1'));var Promise=require(_0x52a5('0x2'));var logger=require(_0x52a5('0x3'))(_0x52a5('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x52a5('0x5')),'openchannelMessage':require(_0x52a5('0x6')),'mailMessage':require(_0x52a5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x52a5('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5caa5f,_0x5d7a06,_0x3ae3ee,_0x399cf7){return new Promise(function(_0x5d0bca,_0x1d57fa){var _0x32926b=_[_0x52a5('0x9')](_0x3ae3ee);_0x32926b['body']=_0x399cf7;return rpc[_0x5d7a06+'Message'][_0x52a5('0xa')](_0x32926b)['then'](function(){logger[_0x52a5('0xb')](_0x52a5('0xc'),_0x5caa5f,_0x32926b['body']);_0x5d0bca();})[_0x52a5('0xd')](function(_0x2d48e3){logger['error'](_0x52a5('0xc'),_0x5caa5f,JSON[_0x52a5('0xe')](_0x2d48e3));_0x1d57fa(_0x2d48e3);});});}exports[_0x52a5('0xf')]=function(_0x362889,_0x297a9f){return function(_0x50e479){try{if(!_[_0x52a5('0x10')](this['interaction'][_0x52a5('0x11')])){logger[_0x52a5('0xb')](_0x52a5('0xc'),_0x362889,_0x52a5('0x12'));return _0x50e479[_0x52a5('0x13')]();}var _0x193fd3={'ContactId':this[_0x52a5('0x14')]['id'],'sentAt':moment()[_0x52a5('0x15')](_0x52a5('0x16')),'direction':'out'};if(this['channel']===_0x52a5('0x17')||this[_0x52a5('0x18')]===_0x52a5('0x19')){_0x193fd3[_0x52a5('0x1a')]=this[_0x52a5('0x1b')][_0x52a5('0x1a')];}var _0x5b8e7e=this['channel'];if(_0x5b8e7e==='chat'){_0x193fd3[_0x52a5('0x1c')]=this[_0x52a5('0x1d')]['id'];}else{_0x193fd3[_[_0x52a5('0x1e')](_0x5b8e7e)+_0x52a5('0x1f')]=this['account']['id'];}_0x193fd3[_['upperFirst'](_0x5b8e7e)+_0x52a5('0x20')]=this[_0x52a5('0x1b')]['id'];if(this[_0x52a5('0x1b')][_0x52a5('0x21')]){var _0x2d143b=_0x297a9f[0x4];if(!_[_0x52a5('0x22')](_0x2d143b)){_0x193fd3[_0x52a5('0x23')]=utils[_0x52a5('0x24')](_0x2d143b,this);return rpc[_0x5b8e7e+'Message'][_0x52a5('0xa')](_0x193fd3)[_0x52a5('0x25')](function(_0x4fc20c){logger[_0x52a5('0xb')](_0x52a5('0xc'),_0x362889,_0x193fd3[_0x52a5('0x23')]);})['catch'](function(_0x38be13){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x362889,JSON['stringify'](_0x38be13));})['finally'](function(){logger[_0x52a5('0xb')](_0x52a5('0x26'),_0x362889);_0x50e479['stop']();});}else{logger[_0x52a5('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x362889);_0x50e479[_0x52a5('0x27')]();}}else{var _0x738a33=this;var _0x1688ae=_0x297a9f[0x2]['replace'](/\\n/g,'\x0a');var _0x37ed3b={'credentials':{'private_key':_0x1688ae,'client_email':_0x297a9f[0x1]}};var _0x5c8d7b=new dialogflow['SessionsClient'](_0x37ed3b);var _0x545321=_0x5c8d7b[_0x52a5('0x28')](_0x297a9f[0x0],md5(_0x738a33['interaction']['id']));var _0x48644d={'session':_0x545321,'queryInput':{'text':{'text':_0x738a33[_0x52a5('0x29')][_0x52a5('0x23')],'languageCode':_0x297a9f[0x3]||'en'}}};return _0x5c8d7b[_0x52a5('0x2a')](_0x48644d)['then'](function(_0x3b1777){if(_0x3b1777&&_0x3b1777[_0x52a5('0x2b')]){_0x738a33[_0x52a5('0x23')]['dialogflowV2']=_0x3b1777;var _0x469d60=_0x3b1777[0x0];var _0x205f1a=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x2d')]&&_0x469d60[_0x52a5('0x2c')][_0x52a5('0x2d')][_0x52a5('0x2e')]?_0x469d60['queryResult'][_0x52a5('0x2d')][_0x52a5('0x2e')]['end_conversation']['boolValue']:![];_0x738a33[_0x52a5('0x23')]['DIALOGFLOWV2_ACTION']=_0x469d60[_0x52a5('0x2c')]['action'];_0x738a33['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x469d60['queryResult']['allRequiredParamsPresent'];_0x738a33[_0x52a5('0x23')][_0x52a5('0x2f')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x2d')]&&_0x469d60['queryResult'][_0x52a5('0x2d')][_0x52a5('0x2e')]?_0x469d60[_0x52a5('0x2c')]['diagnosticInfo'][_0x52a5('0x2e')][_0x52a5('0x30')][_0x52a5('0x31')]:![];_0x738a33[_0x52a5('0x23')][_0x52a5('0x32')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x33')]['name'];_0x738a33[_0x52a5('0x23')][_0x52a5('0x34')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x33')][_0x52a5('0x35')];_0x738a33['body'][_0x52a5('0x36')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x33')][_0x52a5('0x37')];_0x738a33[_0x52a5('0x23')][_0x52a5('0x38')]=_0x469d60['queryResult']['languageCode'];_0x738a33[_0x52a5('0x23')][_0x52a5('0x39')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x3a')];_0x738a33['body'][_0x52a5('0x3b')]=_0x469d60[_0x52a5('0x2c')][_0x52a5('0x3c')];_0x193fd3[_0x52a5('0x3d')]='dialogflowV2';_0x193fd3[_0x52a5('0x3e')]=JSON['stringify'](_0x3b1777);var _0x20fc49=[];for(var _0x12f709=0x0;_0x12f709<_0x3b1777[_0x52a5('0x2b')];_0x12f709++){var _0x3ea448=_0x3b1777[_0x12f709];if(_0x3ea448&&_0x3ea448['queryResult']&&_0x3ea448[_0x52a5('0x2c')]['fulfillmentText']){_0x20fc49[_0x52a5('0x3f')](createMessage(_0x362889,_0x5b8e7e,_0x193fd3,_0x3ea448['queryResult'][_0x52a5('0x40')]));}}return Promise['all'](_0x20fc49)['then'](function(){if(_0x205f1a){_0x50e479[_0x52a5('0x13')]();}else{_0x50e479[_0x52a5('0x27')]();}})['catch'](function(_0x48ae43){logger['error'](_0x52a5('0xc'),_0x362889,JSON[_0x52a5('0xe')](_0x48ae43));_0x50e479[_0x52a5('0x13')]();});}})[_0x52a5('0xd')](function(_0x29cc29){logger[_0x52a5('0x41')]('[%s][DIALOGFLOWV2]\x20%s',_0x362889,_0x29cc29[_0x52a5('0x29')],_0x29cc29[_0x52a5('0x42')]);_0x50e479[_0x52a5('0x13')]();});}}catch(_0x53b4a1){logger['error'](_0x52a5('0xc'),_0x362889,JSON['stringify'](_0x53b4a1));_0x50e479[_0x52a5('0x27')]();}};}; \ No newline at end of file +var _0xed96=['stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','diagnosticInfo','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','stringify','fulfillmentText','push','all','stack','lodash','dialogflow','moment','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','body','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','upperFirst','AccountId','account','InteractionId','isEmpty','getMustacheRender','Message','create','then','info','finally'];(function(_0x14cd6f,_0x44c0b8){var _0x2be624=function(_0x547c1a){while(--_0x547c1a){_0x14cd6f['push'](_0x14cd6f['shift']());}};_0x2be624(++_0x44c0b8);}(_0xed96,0x6b));var _0x6ed9=function(_0x2ce9c3,_0x20a165){_0x2ce9c3=_0x2ce9c3-0x0;var _0x109b3a=_0xed96[_0x2ce9c3];return _0x109b3a;};'use strict';var _=require(_0x6ed9('0x0'));var dialogflow=require(_0x6ed9('0x1'));var md5=require('md5');var moment=require(_0x6ed9('0x2'));var Promise=require('bluebird');var logger=require(_0x6ed9('0x3'))('routing');var utils=require(_0x6ed9('0x4'));var rpc={'chatMessage':require(_0x6ed9('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6ed9('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6ed9('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x111f5a,_0x4f3814,_0x2a0491,_0x1619a8){return new Promise(function(_0x4d2489,_0x444abe){var _0x1a28b1=_['clone'](_0x2a0491);_0x1a28b1[_0x6ed9('0x8')]=_0x1619a8;return rpc[_0x4f3814+'Message']['create'](_0x1a28b1)['then'](function(){logger['info'](_0x6ed9('0x9'),_0x111f5a,_0x1a28b1[_0x6ed9('0x8')]);_0x4d2489();})[_0x6ed9('0xa')](function(_0x501878){logger[_0x6ed9('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x111f5a,JSON['stringify'](_0x501878));_0x444abe(_0x501878);});});}exports[_0x6ed9('0xc')]=function(_0x2f1815,_0x2058bd){return function(_0x271a76){try{if(!_[_0x6ed9('0xd')](this[_0x6ed9('0xe')][_0x6ed9('0xf')])){logger['info'](_0x6ed9('0x9'),_0x2f1815,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x271a76[_0x6ed9('0x10')]();}var _0x5c3823={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6ed9('0x11')](_0x6ed9('0x12')),'direction':_0x6ed9('0x13')};if(this['channel']===_0x6ed9('0x14')||this['channel']===_0x6ed9('0x15')){_0x5c3823[_0x6ed9('0x16')]=this[_0x6ed9('0xe')][_0x6ed9('0x16')];}var _0x2827d2=this[_0x6ed9('0x17')];if(_0x2827d2==='chat'){_0x5c3823['ChatWebsiteId']=this['account']['id'];}else{_0x5c3823[_[_0x6ed9('0x18')](_0x2827d2)+_0x6ed9('0x19')]=this[_0x6ed9('0x1a')]['id'];}_0x5c3823[_[_0x6ed9('0x18')](_0x2827d2)+_0x6ed9('0x1b')]=this[_0x6ed9('0xe')]['id'];if(this[_0x6ed9('0xe')]['created']){var _0x3d65b3=_0x2058bd[0x4];if(!_[_0x6ed9('0x1c')](_0x3d65b3)){_0x5c3823[_0x6ed9('0x8')]=utils[_0x6ed9('0x1d')](_0x3d65b3,this);return rpc[_0x2827d2+_0x6ed9('0x1e')][_0x6ed9('0x1f')](_0x5c3823)[_0x6ed9('0x20')](function(_0x2bbe02){logger[_0x6ed9('0x21')](_0x6ed9('0x9'),_0x2f1815,_0x5c3823[_0x6ed9('0x8')]);})['catch'](function(_0x57a3d8){logger[_0x6ed9('0xb')](_0x6ed9('0x9'),_0x2f1815,JSON['stringify'](_0x57a3d8));})[_0x6ed9('0x22')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2f1815);_0x271a76[_0x6ed9('0x23')]();});}else{logger['info'](_0x6ed9('0x24'),_0x2f1815);_0x271a76[_0x6ed9('0x23')]();}}else{var _0x59f2d1=this;var _0x272825=_0x2058bd[0x2][_0x6ed9('0x25')](/\\n/g,'\x0a');var _0x3edd5e={'credentials':{'private_key':_0x272825,'client_email':_0x2058bd[0x1]}};var _0x482088=new dialogflow[(_0x6ed9('0x26'))](_0x3edd5e);var _0x13ae3a=_0x482088[_0x6ed9('0x27')](_0x2058bd[0x0],md5(_0x59f2d1[_0x6ed9('0xe')]['id']));var _0x4c2dde={'session':_0x13ae3a,'queryInput':{'text':{'text':_0x59f2d1[_0x6ed9('0x28')][_0x6ed9('0x8')],'languageCode':_0x2058bd[0x3]||'en'}}};return _0x482088[_0x6ed9('0x29')](_0x4c2dde)[_0x6ed9('0x20')](function(_0x54233f){if(_0x54233f&&_0x54233f[_0x6ed9('0x2a')]){_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x2b')]=_0x54233f;var _0x2d4b56=_0x54233f[0x0];var _0x2e1f1e=_0x2d4b56[_0x6ed9('0x2c')]['diagnosticInfo']&&_0x2d4b56[_0x6ed9('0x2c')]['diagnosticInfo'][_0x6ed9('0x2d')]?_0x2d4b56['queryResult']['diagnosticInfo']['fields'][_0x6ed9('0x2e')][_0x6ed9('0x2f')]:![];_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x30')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x31')];_0x59f2d1[_0x6ed9('0x8')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x32')];_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x33')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x34')]&&_0x2d4b56[_0x6ed9('0x2c')]['diagnosticInfo'][_0x6ed9('0x2d')]?_0x2d4b56[_0x6ed9('0x2c')]['diagnosticInfo']['fields'][_0x6ed9('0x2e')][_0x6ed9('0x2f')]:![];_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x35')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x36')][_0x6ed9('0x37')];_0x59f2d1['body'][_0x6ed9('0x38')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x36')][_0x6ed9('0x39')];_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x3a')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x36')]['isFallback'];_0x59f2d1['body'][_0x6ed9('0x3b')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x3c')];_0x59f2d1['body'][_0x6ed9('0x3d')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x3e')];_0x59f2d1[_0x6ed9('0x8')][_0x6ed9('0x3f')]=_0x2d4b56[_0x6ed9('0x2c')][_0x6ed9('0x40')];_0x5c3823['providerName']=_0x6ed9('0x2b');_0x5c3823[_0x6ed9('0x41')]=JSON[_0x6ed9('0x42')](_0x54233f);var _0x64b2ff=[];for(var _0x1c1b23=0x0;_0x1c1b23<_0x54233f['length'];_0x1c1b23++){var _0x44ff6b=_0x54233f[_0x1c1b23];if(_0x44ff6b&&_0x44ff6b[_0x6ed9('0x2c')]&&_0x44ff6b['queryResult'][_0x6ed9('0x43')]){_0x64b2ff[_0x6ed9('0x44')](createMessage(_0x2f1815,_0x2827d2,_0x5c3823,_0x44ff6b[_0x6ed9('0x2c')][_0x6ed9('0x43')]));}}return Promise[_0x6ed9('0x45')](_0x64b2ff)[_0x6ed9('0x20')](function(){if(_0x2e1f1e){_0x271a76[_0x6ed9('0x10')]();}else{_0x271a76[_0x6ed9('0x23')]();}})[_0x6ed9('0xa')](function(_0x378d51){logger['error'](_0x6ed9('0x9'),_0x2f1815,JSON['stringify'](_0x378d51));_0x271a76['next']();});}})[_0x6ed9('0xa')](function(_0x3873b2){logger[_0x6ed9('0xb')](_0x6ed9('0x9'),_0x2f1815,_0x3873b2[_0x6ed9('0x28')],_0x3873b2[_0x6ed9('0x46')]);_0x271a76[_0x6ed9('0x10')]();});}}catch(_0xa55580){logger['error'](_0x6ed9('0x9'),_0x2f1815,JSON[_0x6ed9('0x42')](_0xa55580));_0x271a76[_0x6ed9('0x23')]();}};}; \ 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 b5ed603..4833db8 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 _0xcec3=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','map','stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','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','error','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils'];(function(_0x5d232c,_0x54463a){var _0x2292a4=function(_0x7be28c){while(--_0x7be28c){_0x5d232c['push'](_0x5d232c['shift']());}};_0x2292a4(++_0x54463a);}(_0xcec3,0x114));var _0x3cec=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcec3[_0x122ef9];return _0x42fba0;};'use strict';var schema=require(_0x3cec('0x0'));var _=require(_0x3cec('0x1'));var htmlToText=require(_0x3cec('0x2'));var utils=require(_0x3cec('0x3'));var logger=require('../../../../config/logger')(_0x3cec('0x4'));var gotoif=schema({'condition':{'type':_0x3cec('0x5'),'required':!![],'message':_0x3cec('0x6')},'priorityTrue':{'type':_0x3cec('0x7'),'message':_0x3cec('0x8')},'priorityFalse':{'type':_0x3cec('0x7'),'message':_0x3cec('0x9')}});exports[_0x3cec('0xa')]=function(_0x369ab7,_0x8948b7){return function(_0x3f1fbf){try{var _0x296e46={'condition':htmlToText['fromString'](utils[_0x3cec('0xb')](_0x8948b7[0x0],this),{'wordwrap':![]})[_0x3cec('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x8948b7[0x1],'priorityFalse':_0x8948b7[0x2]};var _0x2ab0b7=gotoif['validate'](_0x296e46,{'typecast':!![]});if(_0x2ab0b7[_0x3cec('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0x369ab7,_[_0x3cec('0xe')](_0x2ab0b7,'message')['join'](',\x20'));_0x3f1fbf[_0x3cec('0xf')]();}else{try{var _0x1847d4=eval('('+_0x296e46['condition']+')');var _0x2614bc=_0x1847d4?_0x296e46[_0x3cec('0x10')]:_0x296e46['priorityFalse'];logger[_0x3cec('0x11')](_0x3cec('0x12'),_0x369ab7,_0x296e46[_0x3cec('0x13')],_0x1847d4,_0x2614bc||_0x3cec('0x14'));if(_0x2614bc){var _0x453264=_['findIndex'](_0x3f1fbf[_0x3cec('0x15')](),{'p':_0x2614bc});if(_0x453264>=0x0){logger[_0x3cec('0x11')](_0x3cec('0x16'),_0x369ab7,_0x2614bc||_0x3cec('0x14'),_0x453264);_0x3f1fbf[_0x3cec('0x14')](_0x453264);}else{logger[_0x3cec('0x11')](_0x3cec('0x17'),_0x369ab7,_0x2614bc||_0x3cec('0x14'));_0x3f1fbf['stop']();}}else{_0x3f1fbf['next']();}}catch(_0x2473d9){logger['error'](_0x3cec('0x18'),_0x369ab7,_0x2473d9['message']);_0x3f1fbf[_0x3cec('0xf')]();}}}catch(_0x441d0a){logger[_0x3cec('0x19')](_0x3cec('0x1a'),_0x369ab7,JSON[_0x3cec('0x1b')](_0x441d0a));_0x3f1fbf[_0x3cec('0xf')]();}};}; \ No newline at end of file +var _0x96cd=['length','[%s][GOTOIF]\x20%s','map','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','error','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','fromString','getMustacheRender','replace'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x96cd,0x1a5));var _0xd96c=function(_0x33953b,_0x1963a2){_0x33953b=_0x33953b-0x0;var _0x4f4591=_0x96cd[_0x33953b];return _0x4f4591;};'use strict';var schema=require(_0xd96c('0x0'));var _=require(_0xd96c('0x1'));var htmlToText=require(_0xd96c('0x2'));var utils=require('./utils');var logger=require(_0xd96c('0x3'))(_0xd96c('0x4'));var gotoif=schema({'condition':{'type':_0xd96c('0x5'),'required':!![],'message':_0xd96c('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xd96c('0x7')]=function(_0x57988a,_0x146452){return function(_0x62715f){try{var _0x52f9f0={'condition':htmlToText[_0xd96c('0x8')](utils[_0xd96c('0x9')](_0x146452[0x0],this),{'wordwrap':![]})[_0xd96c('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x146452[0x1],'priorityFalse':_0x146452[0x2]};var _0x23aa75=gotoif[_0xd96c('0x0')](_0x52f9f0,{'typecast':!![]});if(_0x23aa75[_0xd96c('0xb')]){logger['error'](_0xd96c('0xc'),_0x57988a,_[_0xd96c('0xd')](_0x23aa75,'message')['join'](',\x20'));_0x62715f['stop']();}else{try{var _0x372f54=eval('('+_0x52f9f0[_0xd96c('0xe')]+')');var _0x38add7=_0x372f54?_0x52f9f0[_0xd96c('0xf')]:_0x52f9f0[_0xd96c('0x10')];logger[_0xd96c('0x11')](_0xd96c('0x12'),_0x57988a,_0x52f9f0['condition'],_0x372f54,_0x38add7||'next');if(_0x38add7){var _0x51a8c7=_[_0xd96c('0x13')](_0x62715f['rules'](),{'p':_0x38add7});if(_0x51a8c7>=0x0){logger[_0xd96c('0x11')](_0xd96c('0x14'),_0x57988a,_0x38add7||'next',_0x51a8c7);_0x62715f[_0xd96c('0x15')](_0x51a8c7);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x57988a,_0x38add7||'next');_0x62715f[_0xd96c('0x16')]();}}else{_0x62715f[_0xd96c('0x15')]();}}catch(_0x370769){logger['error'](_0xd96c('0x17'),_0x57988a,_0x370769[_0xd96c('0x18')]);_0x62715f[_0xd96c('0x16')]();}}}catch(_0x2cd6d0){logger[_0xd96c('0x19')](_0xd96c('0xc'),_0x57988a,JSON[_0xd96c('0x1a')](_0x2cd6d0));_0x62715f['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 122dcfa..843d73d 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 _0x6e50=['join','stop','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','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message'];(function(_0x3ad72f,_0x52ff85){var _0x5fcd7f=function(_0x5ddc18){while(--_0x5ddc18){_0x3ad72f['push'](_0x3ad72f['shift']());}};_0x5fcd7f(++_0x52ff85);}(_0x6e50,0xc8));var _0x06e5=function(_0x5c0194,_0x478e68){_0x5c0194=_0x5c0194-0x0;var _0x4e94ba=_0x6e50[_0x5c0194];return _0x4e94ba;};'use strict';var schema=require('validate');var _=require(_0x06e5('0x0'));var logger=require('../../../../config/logger')(_0x06e5('0x1'));var gotop=schema({'priority':{'type':_0x06e5('0x2'),'required':!![],'message':_0x06e5('0x3')}});exports[_0x06e5('0x4')]=function(_0x33c90c,_0x14f2b2){return function(_0x11fdc6){try{var _0xe013a8={'priority':_0x14f2b2[0x0]};var _0x47d2df=gotop[_0x06e5('0x5')](_0xe013a8,{'typecast':!![]});if(_0x47d2df[_0x06e5('0x6')]){logger[_0x06e5('0x7')](_0x06e5('0x8'),_0x33c90c,_['map'](_0x47d2df,_0x06e5('0x9'))[_0x06e5('0xa')](',\x20'));_0x11fdc6[_0x06e5('0xb')]();}else{logger[_0x06e5('0xc')](_0x06e5('0xd'),_0x33c90c,_0xe013a8[_0x06e5('0xe')]);if(_0xe013a8[_0x06e5('0xe')]){var _0x204486=_[_0x06e5('0xf')](_0x11fdc6[_0x06e5('0x10')](),{'p':_0xe013a8['priority']});if(_0x204486>=0x0){logger[_0x06e5('0xc')](_0x06e5('0x11'),_0x33c90c,_0xe013a8[_0x06e5('0xe')]||'next',_0x204486);_0x11fdc6[_0x06e5('0x12')](_0x204486);}else{logger[_0x06e5('0xc')](_0x06e5('0x13'),_0x33c90c,_0xe013a8[_0x06e5('0xe')]||_0x06e5('0x12'));_0x11fdc6[_0x06e5('0xb')]();}}else{_0x11fdc6[_0x06e5('0x12')]();}}}catch(_0x25ed5f){logger['error'](_0x06e5('0x8'),_0x33c90c,JSON[_0x06e5('0x14')](_0x25ed5f));_0x11fdc6[_0x06e5('0xb')]();}};}; \ No newline at end of file +var _0xaaf3=['[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','routing','number','consequence','validate','length','error'];(function(_0x2f9ff2,_0x3192b7){var _0x511f78=function(_0x5f3724){while(--_0x5f3724){_0x2f9ff2['push'](_0x2f9ff2['shift']());}};_0x511f78(++_0x3192b7);}(_0xaaf3,0x19c));var _0x3aaf=function(_0x3507d1,_0x185b35){_0x3507d1=_0x3507d1-0x0;var _0x42f157=_0xaaf3[_0x3507d1];return _0x42f157;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x3aaf('0x0'));var gotop=schema({'priority':{'type':_0x3aaf('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x3aaf('0x2')]=function(_0x3ecb00,_0x38da83){return function(_0x10e6b6){try{var _0x630dc={'priority':_0x38da83[0x0]};var _0x38aed7=gotop[_0x3aaf('0x3')](_0x630dc,{'typecast':!![]});if(_0x38aed7[_0x3aaf('0x4')]){logger[_0x3aaf('0x5')](_0x3aaf('0x6'),_0x3ecb00,_[_0x3aaf('0x7')](_0x38aed7,_0x3aaf('0x8'))[_0x3aaf('0x9')](',\x20'));_0x10e6b6[_0x3aaf('0xa')]();}else{logger['info'](_0x3aaf('0xb'),_0x3ecb00,_0x630dc[_0x3aaf('0xc')]);if(_0x630dc['priority']){var _0x51baa9=_[_0x3aaf('0xd')](_0x10e6b6[_0x3aaf('0xe')](),{'p':_0x630dc[_0x3aaf('0xc')]});if(_0x51baa9>=0x0){logger[_0x3aaf('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3ecb00,_0x630dc[_0x3aaf('0xc')]||_0x3aaf('0x10'),_0x51baa9);_0x10e6b6[_0x3aaf('0x10')](_0x51baa9);}else{logger['info'](_0x3aaf('0x11'),_0x3ecb00,_0x630dc[_0x3aaf('0xc')]||_0x3aaf('0x10'));_0x10e6b6[_0x3aaf('0xa')]();}}else{_0x10e6b6[_0x3aaf('0x10')]();}}}catch(_0x394140){logger[_0x3aaf('0x5')](_0x3aaf('0x6'),_0x3ecb00,JSON[_0x3aaf('0x12')](_0x394140));_0x10e6b6[_0x3aaf('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 86e1a12..6ebfd30 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 _0xe517=['channel','AccountId','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','./utils','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','chat','ChatWebsiteId','upperFirst'];(function(_0x462b29,_0x11e1d9){var _0x1247d0=function(_0x3d6876){while(--_0x3d6876){_0x462b29['push'](_0x462b29['shift']());}};_0x1247d0(++_0x11e1d9);}(_0xe517,0xe6));var _0x7e51=function(_0x1b6d98,_0x577e36){_0x1b6d98=_0x1b6d98-0x0;var _0x297853=_0xe517[_0x1b6d98];return _0x297853;};'use strict';var _=require('lodash');var utils=require(_0x7e51('0x0'));var logger=require(_0x7e51('0x1'))(_0x7e51('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7e51('0x3')),'faxMessage':require(_0x7e51('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7e51('0x5')]=function(_0x216dc8,_0x304e76){return function(_0x1fc2c6){try{var _0x53654f={'body':utils[_0x7e51('0x6')](_0x304e76[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x7e51('0x7')){_0x53654f[_0x7e51('0x8')]=this['account']['id'];}else{_0x53654f[_[_0x7e51('0x9')](this[_0x7e51('0xa')])+_0x7e51('0xb')]=this[_0x7e51('0xc')]['id'];}_0x53654f[_[_0x7e51('0x9')](this[_0x7e51('0xa')])+_0x7e51('0xd')]=this[_0x7e51('0xe')]['id'];if(rpc[this[_0x7e51('0xa')]+_0x7e51('0xf')]){return rpc[this[_0x7e51('0xa')]+'Message'][_0x7e51('0x10')](_0x53654f)[_0x7e51('0x11')](function(_0x15cc6a){logger[_0x7e51('0x12')](_0x7e51('0x13'),_0x216dc8,_0x53654f[_0x7e51('0x14')]);_0x1fc2c6[_0x7e51('0x15')]();})['catch'](function(_0x5cac82){logger[_0x7e51('0x16')](_0x7e51('0x13'),_0x216dc8,JSON[_0x7e51('0x17')](_0x5cac82));_0x1fc2c6['stop']();});}}catch(_0x2f0bb9){logger[_0x7e51('0x16')](_0x7e51('0x13'),_0x216dc8,JSON[_0x7e51('0x17')](_0x2f0bb9));_0x1fc2c6['stop']();}};}; \ No newline at end of file +var _0xed91=['channel','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next','stringify','error','stop','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xed91,0x185));var _0x1ed9=function(_0x1fc0ea,_0x127e68){_0x1fc0ea=_0x1fc0ea-0x0;var _0x769744=_0xed91[_0x1fc0ea];return _0x769744;};'use strict';var _=require('lodash');var utils=require(_0x1ed9('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x1ed9('0x1')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1ed9('0x2')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1ed9('0x3'))};exports[_0x1ed9('0x4')]=function(_0x16b8dc,_0x3c77ff){return function(_0x3206de){try{var _0x1b880f={'body':utils[_0x1ed9('0x5')](_0x3c77ff[0x0],this),'ContactId':this[_0x1ed9('0x6')]['id']};if(this[_0x1ed9('0x7')]===_0x1ed9('0x8')){_0x1b880f[_0x1ed9('0x9')]=this[_0x1ed9('0xa')]['id'];}else{_0x1b880f[_['upperFirst'](this[_0x1ed9('0x7')])+_0x1ed9('0xb')]=this[_0x1ed9('0xa')]['id'];}_0x1b880f[_['upperFirst'](this[_0x1ed9('0x7')])+_0x1ed9('0xc')]=this[_0x1ed9('0xd')]['id'];if(rpc[this['channel']+_0x1ed9('0xe')]){return rpc[this[_0x1ed9('0x7')]+'Message']['create'](_0x1b880f)[_0x1ed9('0xf')](function(_0x4f3a01){logger['info'](_0x1ed9('0x10'),_0x16b8dc,_0x1b880f[_0x1ed9('0x11')]);_0x3206de[_0x1ed9('0x12')]();})['catch'](function(_0x1cca30){logger['error']('[%s][MESSAGE]\x20%s',_0x16b8dc,JSON[_0x1ed9('0x13')](_0x1cca30));_0x3206de['stop']();});}}catch(_0x1ec706){logger[_0x1ed9('0x14')]('[%s][MESSAGE]\x20%s',_0x16b8dc,JSON['stringify'](_0x1ec706));_0x3206de[_0x1ed9('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 9e9295b..2f86289 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 _0x6e93=['info','[%s][NOOP]\x20%s','getMustacheRender','error','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6e93,0x11c));var _0x36e9=function(_0x4dd3d5,_0x4ba672){_0x4dd3d5=_0x4dd3d5-0x0;var _0x52addd=_0x6e93[_0x4dd3d5];return _0x52addd;};'use strict';var utils=require(_0x36e9('0x0'));var logger=require(_0x36e9('0x1'))(_0x36e9('0x2'));exports[_0x36e9('0x3')]=function(_0x110b19,_0x1adf58){return function(_0x167c63){try{logger[_0x36e9('0x4')](_0x36e9('0x5'),_0x110b19,utils[_0x36e9('0x6')](_0x1adf58[0x0],this));_0x167c63['next']();}catch(_0x3fb84d){logger[_0x36e9('0x7')](_0x36e9('0x5'),_0x110b19,JSON['stringify'](_0x3fb84d));_0x167c63[_0x36e9('0x8')]();}};}; \ No newline at end of file +var _0x45c0=['stringify','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x45c0,0x19f));var _0x045c=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x45c0[_0x54d4fe];return _0x1ab5bb;};'use strict';var utils=require(_0x045c('0x0'));var logger=require(_0x045c('0x1'))('routing');exports[_0x045c('0x2')]=function(_0xde06b1,_0xd9385d){return function(_0x10e770){try{logger[_0x045c('0x3')](_0x045c('0x4'),_0xde06b1,utils[_0x045c('0x5')](_0xd9385d[0x0],this));_0x10e770[_0x045c('0x6')]();}catch(_0x7fc492){logger[_0x045c('0x7')]('[%s][NOOP]\x20%s',_0xde06b1,JSON[_0x045c('0x8')](_0x7fc492));_0x10e770['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2595907..fc9328c 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 _0x9a88=['validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','from','joinAt','emit','account','push','InteractionId','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','timeout','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','consequence'];(function(_0x24f66c,_0x33b672){var _0xef6edd=function(_0x3baff0){while(--_0x3baff0){_0x24f66c['push'](_0x24f66c['shift']());}};_0xef6edd(++_0x33b672);}(_0x9a88,0x1ef));var _0x89a8=function(_0x1278b6,_0x24252e){_0x1278b6=_0x1278b6-0x0;var _0x2cff42=_0x9a88[_0x1278b6];return _0x2cff42;};'use strict';var schema=require('validate');var _=require(_0x89a8('0x0'));var util=require(_0x89a8('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x89a8('0x2'));var Redis=require(_0x89a8('0x3'));var config=require(_0x89a8('0x4'));var logger=require(_0x89a8('0x5'))(_0x89a8('0x6'));var strategy=require(_0x89a8('0x7'));config[_0x89a8('0x8')]=_[_0x89a8('0x9')](config[_0x89a8('0x8')],{'host':_0x89a8('0xa'),'port':0x18eb});var io=require(_0x89a8('0xb'))(new Redis(config[_0x89a8('0x8')]));var attributes=['id','queue_id','account','queue',_0x89a8('0xc'),_0x89a8('0xd')];function emit(_0xa0521e,_0x29b849,_0x5a60c6){io['to'](_0xa0521e)[_0x89a8('0xe')](_0x29b849,_0x5a60c6);}function emitChannelQueueInteraction(_0x101dc9,_0x3ffaea,_0x4bfe75,_0x21d70f,_0x39c165,_0x59e640,_0x4e05ff,_0x53a464){var _0xd875c2=_['clone'](_0x4bfe75);_0xd875c2['queue_id']=_0x53a464;_0xd875c2['queue']=_0x3ffaea;_0xd875c2[_0x89a8('0xf')]=_0x21d70f;_0xd875c2['id']=_0x39c165;if(_0x59e640){attributes[_0x89a8('0x10')](_['capitalize'](_0x101dc9)+_0x89a8('0x11'));_0x4e05ff[util[_0x89a8('0x12')]('%sQueuesWaitingInteractions',_0x101dc9)][_0x39c165]=_[_0x89a8('0x13')](_0xd875c2,attributes);}else{delete _0x4e05ff[util[_0x89a8('0x12')](_0x89a8('0x14'),_0x101dc9)][_0x39c165];}emit(util[_0x89a8('0x12')]('%s:queue:%s',_0x101dc9,_0x3ffaea),util[_0x89a8('0x12')]('%s_queue_waiting_interaction:%s',_0x101dc9,_0x59e640?_0x89a8('0x15'):_0x89a8('0x16')),_[_0x89a8('0x13')](_0xd875c2,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x89a8('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x89a8('0x18')),'faxQueueReport':require(_0x89a8('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x89a8('0x1a'),'required':!![],'message':_0x89a8('0x1b')},'timeout':{'type':_0x89a8('0x1c'),'message':_0x89a8('0x1d')}});function startRouting(_0x3cde4d,_0x5ec2a3,_0x41dd56,_0x5a3a7e){if(_0x3cde4d&&_0x5ec2a3&&_0x41dd56){_0x5ec2a3[_0x89a8('0x1e')]+=0x1;var _0x2e24dc={'uniqueid':_0x3cde4d,'from':_0x41dd56[_0x89a8('0x1f')]?_0x41dd56[_0x89a8('0x1f')][_0x89a8('0xc')]:'','joinAt':moment()['format'](_0x89a8('0x20')),'ContactId':_0x41dd56['contact']?_0x41dd56[_0x89a8('0x21')]['id']:null,'ListId':_0x41dd56[_0x89a8('0x22')]?_0x41dd56[_0x89a8('0x22')]['id']:null};_0x2e24dc[_[_0x89a8('0x23')](_0x41dd56[_0x89a8('0x24')])+_0x89a8('0x25')]=_0x5ec2a3['id']||null;_0x2e24dc[_['upperFirst'](_0x41dd56[_0x89a8('0x24')])+_0x89a8('0x11')]=_0x41dd56[_0x89a8('0x26')]?_0x41dd56[_0x89a8('0x26')]['id']:null;_0x2e24dc[_[_0x89a8('0x23')](_0x41dd56[_0x89a8('0x24')])+_0x89a8('0x27')]=_0x41dd56[_0x89a8('0x28')]?_0x41dd56[_0x89a8('0x28')]['id']:null;_0x2e24dc[_[_0x89a8('0x23')](_0x41dd56[_0x89a8('0x24')])+(_0x41dd56['channel']!=='chat'?_0x89a8('0x29'):_0x89a8('0x2a'))]=_0x41dd56[_0x89a8('0xf')]?_0x41dd56[_0x89a8('0xf')]['id']:null;logger[_0x89a8('0x2b')](util['format'](_0x89a8('0x2c'),_0x3cde4d,_0x5ec2a3['name']));emitChannelQueueInteraction(_0x41dd56[_0x89a8('0x24')],_0x5ec2a3[_0x89a8('0x2d')],_0x2e24dc,_0x41dd56[_0x89a8('0xf')]['name'],_0x41dd56[_0x89a8('0x28')]['id'],!![],_0x5a3a7e,_0x5ec2a3['id']);if(rpc[_0x41dd56[_0x89a8('0x24')]+'QueueReport']){return rpc[_0x41dd56['channel']+'QueueReport'][_0x89a8('0x2e')](_0x2e24dc)[_0x89a8('0x2f')](function(_0x25f985){logger[_0x89a8('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0x2e5264,_0x3b7737,_0x447220,_0x4b457b){if(_0x2e5264&&_0x3b7737){_0x3b7737[_0x89a8('0x1e')]-=0x1;var _0x303bbf={'leaveAt':moment()['format'](_0x89a8('0x20')),'acceptAt':moment()[_0x89a8('0x12')](_0x89a8('0x20')),'reason':_0x89a8('0x31')};logger[_0x89a8('0x2b')](util[_0x89a8('0x12')](_0x89a8('0x32'),_0x2e5264,_0x3b7737[_0x89a8('0x2d')]));emitChannelQueueInteraction(_0x447220['channel'],_0x3b7737[_0x89a8('0x2d')],_0x447220[_0x89a8('0x1f')],_0x447220['account']['name'],_0x447220[_0x89a8('0x28')]['id'],![],_0x4b457b,_0x3b7737['id']);if(rpc[_0x447220[_0x89a8('0x24')]+_0x89a8('0x33')]){return rpc[_0x447220[_0x89a8('0x24')]+_0x89a8('0x33')]['update'](_0x2e5264,_0x303bbf)[_0x89a8('0x2f')](function(_0x3f3104){logger[_0x89a8('0x30')]('update\x20queue\x20report');});}}}function endRouting(_0x133c41,_0x5c0afe,_0x39b330,_0x59eed3){if(_0x133c41&&_0x5c0afe){_0x5c0afe['waiting']-=0x1;var _0x1fd030={'leaveAt':moment()['format'](_0x89a8('0x20')),'exitAt':moment()[_0x89a8('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x89a8('0x34')};logger[_0x89a8('0x2b')](util[_0x89a8('0x12')](_0x89a8('0x35'),_0x133c41,_0x5c0afe['name']));emitChannelQueueInteraction(_0x39b330[_0x89a8('0x24')],_0x5c0afe[_0x89a8('0x2d')],_0x39b330[_0x89a8('0x1f')],_0x39b330['account'][_0x89a8('0x2d')],_0x39b330['message']['id'],![],_0x59eed3);if(rpc[_0x39b330[_0x89a8('0x24')]+'QueueReport']){return rpc[_0x39b330[_0x89a8('0x24')]+_0x89a8('0x33')][_0x89a8('0x36')](_0x133c41,_0x1fd030)['catch'](function(_0xc184ee){logger[_0x89a8('0x30')](_0x89a8('0x37'));});}}}function handleFindQueue(_0x2cb6d8){return function(_0x3e327e){return _0x3e327e[_0x89a8('0x2d')][_0x89a8('0x38')]()===_0x2cb6d8[_0x89a8('0x38')]();};}exports[_0x89a8('0x39')]=function(_0x3f736e,_0xee8c36,_0x126109,_0x58716b){return function(_0x51836c){try{var _0x47afe0={'name':_0xee8c36[0x0],'timeout':_0xee8c36[0x1]};var _0x342733=queue[_0x89a8('0x3a')](_0x47afe0,{'typecast':!![]});if(_0x342733[_0x89a8('0x3b')]){logger[_0x89a8('0x30')](_0x89a8('0x3c'),_0x3f736e,_[_0x89a8('0x3d')](_0x342733,_0x89a8('0x28'))[_0x89a8('0x3e')](',\x20'));_0x51836c[_0x89a8('0x3f')]();}else{var _0x5f021f=_[_0x89a8('0x40')](_0x126109[_0x58716b[_0x89a8('0x24')]+_0x89a8('0x41')],handleFindQueue(_0x47afe0['name']));if(_0x5f021f){startRouting(_0x3f736e,_0x5f021f,_0x58716b,_0x126109);var _0x1f7a77=(_0x5f021f['timeout']||0xa)*0x3e8;var _0x32681b=(_0x47afe0[_0x89a8('0x34')]||0x14)*0x3e8;var _0x1db899;if(_0x1f7a77>_0x32681b){_0x32681b=_0x1f7a77;}var _0x18f4cc=seqqueue[_0x89a8('0x42')](_0x1f7a77);_0x18f4cc['id']=_0x3f736e;_0x18f4cc[_0x89a8('0x43')]=_0x1f7a77;_0x18f4cc[_0x89a8('0x44')]=_0x32681b;_0x18f4cc[_0x89a8('0x24')]=_0x58716b[_0x89a8('0x24')];_0x126109[_0x89a8('0x45')][_0x3f736e]['on'](_0x89a8('0x46'),function(){logger[_0x89a8('0x2b')](_0x89a8('0x47'),_0x3f736e);stopRouting(_0x3f736e,_0x5f021f,_0x58716b,_0x126109);clearTimeout(_0x1db899);_0x1db899=undefined;_0x18f4cc[_0x89a8('0x48')](!![]);if(_0x126109[_0x89a8('0x45')][_0x3f736e]){delete _0x126109[_0x89a8('0x45')][_0x3f736e];}_0x51836c[_0x89a8('0x3f')]();});_0x126109[_0x89a8('0x45')][_0x3f736e]['on'](_0x89a8('0x49'),function(){if(_0x126109[_0x89a8('0x45')][_0x3f736e]){delete _0x126109[_0x89a8('0x45')][_0x3f736e];}});_0x1db899=setTimeout(function(){logger[_0x89a8('0x2b')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3f736e);endRouting(_0x3f736e,_0x5f021f,_0x58716b,_0x126109);clearTimeout(_0x1db899);_0x18f4cc[_0x89a8('0x48')](!![]);_0x51836c[_0x89a8('0x4a')]();},_0x32681b);switch(_0x5f021f[_0x89a8('0x4b')]){case _0x89a8('0x4c'):strategy[_0x89a8('0x4c')](_0x18f4cc,_0x5f021f,_0x126109,_0x58716b);break;default:strategy['beepall'](_0x18f4cc,_0x5f021f,_0x126109,_0x58716b);}}else{logger['error'](_0x89a8('0x4d'),_0x3f736e,_0x47afe0['name']);_0x51836c[_0x89a8('0x3f')]();}}}catch(_0x239138){console['log'](_0x239138);logger[_0x89a8('0x30')]('[%s][QUEUE]\x20%s',_0x3f736e,_0x239138[_0x89a8('0x4e')]);_0x51836c[_0x89a8('0x3f')]();}};}; \ No newline at end of file +var _0x8def=['../../../../config/logger','defaults','socket.io-emitter','redis','queue_id','queue','joinAt','emit','clone','account','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','length','map','stop','find','Queues','timeout','createQueue','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment'];(function(_0x5f2545,_0x25df1d){var _0x164433=function(_0x2577a6){while(--_0x2577a6){_0x5f2545['push'](_0x5f2545['shift']());}};_0x164433(++_0x25df1d);}(_0x8def,0xe8));var _0xf8de=function(_0x28c04f,_0x40ad27){_0x28c04f=_0x28c04f-0x0;var _0x1ddf55=_0x8def[_0x28c04f];return _0x1ddf55;};'use strict';var schema=require('validate');var _=require(_0xf8de('0x0'));var util=require('util');var seqqueue=require(_0xf8de('0x1'));var moment=require(_0xf8de('0x2'));var Redis=require(_0xf8de('0x3'));var config=require(_0xf8de('0x4'));var logger=require(_0xf8de('0x5'))('routing');var strategy=require('./strategy');config['redis']=_[_0xf8de('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf8de('0x7'))(new Redis(config[_0xf8de('0x8')]));var attributes=['id',_0xf8de('0x9'),'account',_0xf8de('0xa'),'from',_0xf8de('0xb')];function emit(_0x1da94a,_0x3e263a,_0x324c92){io['to'](_0x1da94a)[_0xf8de('0xc')](_0x3e263a,_0x324c92);}function emitChannelQueueInteraction(_0x2e4d8e,_0x30fb9f,_0x1949fa,_0x7a0f83,_0x465ccc,_0x4f6b97,_0x12af56,_0x465494){var _0x2da93d=_[_0xf8de('0xd')](_0x1949fa);_0x2da93d[_0xf8de('0x9')]=_0x465494;_0x2da93d['queue']=_0x30fb9f;_0x2da93d[_0xf8de('0xe')]=_0x7a0f83;_0x2da93d['id']=_0x465ccc;if(_0x4f6b97){attributes[_0xf8de('0xf')](_['capitalize'](_0x2e4d8e)+_0xf8de('0x10'));_0x12af56[util[_0xf8de('0x11')](_0xf8de('0x12'),_0x2e4d8e)][_0x465ccc]=_[_0xf8de('0x13')](_0x2da93d,attributes);}else{delete _0x12af56[util[_0xf8de('0x11')]('%sQueuesWaitingInteractions',_0x2e4d8e)][_0x465ccc];}emit(util[_0xf8de('0x11')](_0xf8de('0x14'),_0x2e4d8e,_0x30fb9f),util[_0xf8de('0x11')](_0xf8de('0x15'),_0x2e4d8e,_0x4f6b97?_0xf8de('0x16'):_0xf8de('0x17')),_['pick'](_0x2da93d,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf8de('0x18')),'chatQueueReport':require(_0xf8de('0x19')),'smsQueueReport':require(_0xf8de('0x1a')),'faxQueueReport':require(_0xf8de('0x1b')),'whatsappQueueReport':require(_0xf8de('0x1c'))};var queue=schema({'name':{'type':_0xf8de('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf8de('0x1e'),'message':_0xf8de('0x1f')}});function startRouting(_0x4e1842,_0x238b90,_0xeedb60,_0x2335a3){if(_0x4e1842&&_0x238b90&&_0xeedb60){_0x238b90['waiting']+=0x1;var _0x5aad11={'uniqueid':_0x4e1842,'from':_0xeedb60['body']?_0xeedb60[_0xf8de('0x20')][_0xf8de('0x21')]:'','joinAt':moment()[_0xf8de('0x11')](_0xf8de('0x22')),'ContactId':_0xeedb60[_0xf8de('0x23')]?_0xeedb60['contact']['id']:null,'ListId':_0xeedb60['list']?_0xeedb60[_0xf8de('0x24')]['id']:null};_0x5aad11[_['upperFirst'](_0xeedb60[_0xf8de('0x25')])+'QueueId']=_0x238b90['id']||null;_0x5aad11[_[_0xf8de('0x26')](_0xeedb60[_0xf8de('0x25')])+_0xf8de('0x10')]=_0xeedb60[_0xf8de('0x27')]?_0xeedb60[_0xf8de('0x27')]['id']:null;_0x5aad11[_['upperFirst'](_0xeedb60[_0xf8de('0x25')])+'MessageId']=_0xeedb60['message']?_0xeedb60[_0xf8de('0x28')]['id']:null;_0x5aad11[_[_0xf8de('0x26')](_0xeedb60['channel'])+(_0xeedb60[_0xf8de('0x25')]!==_0xf8de('0x29')?_0xf8de('0x2a'):_0xf8de('0x2b'))]=_0xeedb60[_0xf8de('0xe')]?_0xeedb60['account']['id']:null;logger[_0xf8de('0x2c')](util[_0xf8de('0x11')](_0xf8de('0x2d'),_0x4e1842,_0x238b90[_0xf8de('0x2e')]));emitChannelQueueInteraction(_0xeedb60[_0xf8de('0x25')],_0x238b90[_0xf8de('0x2e')],_0x5aad11,_0xeedb60[_0xf8de('0xe')][_0xf8de('0x2e')],_0xeedb60['message']['id'],!![],_0x2335a3,_0x238b90['id']);if(rpc[_0xeedb60['channel']+_0xf8de('0x2f')]){return rpc[_0xeedb60[_0xf8de('0x25')]+_0xf8de('0x2f')][_0xf8de('0x30')](_0x5aad11)[_0xf8de('0x31')](function(_0x36cddd){logger[_0xf8de('0x32')](_0xf8de('0x33'));});}}}function stopRouting(_0x396ca4,_0x6ae6a0,_0x51e7fe,_0x29d8ea){if(_0x396ca4&&_0x6ae6a0){_0x6ae6a0[_0xf8de('0x34')]-=0x1;var _0x1a1526={'leaveAt':moment()[_0xf8de('0x11')](_0xf8de('0x22')),'acceptAt':moment()[_0xf8de('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf8de('0x35')};logger[_0xf8de('0x2c')](util[_0xf8de('0x11')](_0xf8de('0x36'),_0x396ca4,_0x6ae6a0[_0xf8de('0x2e')]));emitChannelQueueInteraction(_0x51e7fe[_0xf8de('0x25')],_0x6ae6a0[_0xf8de('0x2e')],_0x51e7fe[_0xf8de('0x20')],_0x51e7fe[_0xf8de('0xe')][_0xf8de('0x2e')],_0x51e7fe['message']['id'],![],_0x29d8ea,_0x6ae6a0['id']);if(rpc[_0x51e7fe[_0xf8de('0x25')]+_0xf8de('0x2f')]){return rpc[_0x51e7fe[_0xf8de('0x25')]+_0xf8de('0x2f')]['update'](_0x396ca4,_0x1a1526)['catch'](function(_0x1ecfd5){logger[_0xf8de('0x32')](_0xf8de('0x37'));});}}}function endRouting(_0x4ddde8,_0x2fc394,_0x2c32dc,_0x26cff7){if(_0x4ddde8&&_0x2fc394){_0x2fc394['waiting']-=0x1;var _0x5f258e={'leaveAt':moment()[_0xf8de('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xf8de('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xf8de('0x2c')](util[_0xf8de('0x11')](_0xf8de('0x38'),_0x4ddde8,_0x2fc394[_0xf8de('0x2e')]));emitChannelQueueInteraction(_0x2c32dc[_0xf8de('0x25')],_0x2fc394[_0xf8de('0x2e')],_0x2c32dc[_0xf8de('0x20')],_0x2c32dc[_0xf8de('0xe')][_0xf8de('0x2e')],_0x2c32dc[_0xf8de('0x28')]['id'],![],_0x26cff7);if(rpc[_0x2c32dc[_0xf8de('0x25')]+'QueueReport']){return rpc[_0x2c32dc[_0xf8de('0x25')]+_0xf8de('0x2f')][_0xf8de('0x39')](_0x4ddde8,_0x5f258e)[_0xf8de('0x31')](function(_0x25ed64){logger[_0xf8de('0x32')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x17dcf5){return function(_0x3ba662){return _0x3ba662[_0xf8de('0x2e')][_0xf8de('0x3a')]()===_0x17dcf5[_0xf8de('0x3a')]();};}exports[_0xf8de('0x3b')]=function(_0x685800,_0x3ed156,_0x15e4c0,_0x1481cf){return function(_0x18e401){try{var _0x1834aa={'name':_0x3ed156[0x0],'timeout':_0x3ed156[0x1]};var _0x5132d8=queue[_0xf8de('0x3c')](_0x1834aa,{'typecast':!![]});if(_0x5132d8[_0xf8de('0x3d')]){logger[_0xf8de('0x32')]('[%s][QUEUE]\x20%s',_0x685800,_[_0xf8de('0x3e')](_0x5132d8,_0xf8de('0x28'))['join'](',\x20'));_0x18e401[_0xf8de('0x3f')]();}else{var _0x42311d=_[_0xf8de('0x40')](_0x15e4c0[_0x1481cf[_0xf8de('0x25')]+_0xf8de('0x41')],handleFindQueue(_0x1834aa[_0xf8de('0x2e')]));if(_0x42311d){startRouting(_0x685800,_0x42311d,_0x1481cf,_0x15e4c0);var _0xe9e40d=(_0x42311d[_0xf8de('0x42')]||0xa)*0x3e8;var _0x27fe02=(_0x1834aa[_0xf8de('0x42')]||0x14)*0x3e8;var _0xfdf7f1;if(_0xe9e40d>_0x27fe02){_0x27fe02=_0xe9e40d;}var _0x3ee0a6=seqqueue[_0xf8de('0x43')](_0xe9e40d);_0x3ee0a6['id']=_0x685800;_0x3ee0a6['atimeout']=_0xe9e40d;_0x3ee0a6[_0xf8de('0x44')]=_0x27fe02;_0x3ee0a6[_0xf8de('0x25')]=_0x1481cf[_0xf8de('0x25')];_0x15e4c0['rules'][_0x685800]['on']('end',function(){logger[_0xf8de('0x2c')](_0xf8de('0x45'),_0x685800);stopRouting(_0x685800,_0x42311d,_0x1481cf,_0x15e4c0);clearTimeout(_0xfdf7f1);_0xfdf7f1=undefined;_0x3ee0a6[_0xf8de('0x46')](!![]);if(_0x15e4c0[_0xf8de('0x47')][_0x685800]){delete _0x15e4c0[_0xf8de('0x47')][_0x685800];}_0x18e401[_0xf8de('0x3f')]();});_0x15e4c0[_0xf8de('0x47')][_0x685800]['on'](_0xf8de('0x48'),function(){if(_0x15e4c0[_0xf8de('0x47')][_0x685800]){delete _0x15e4c0[_0xf8de('0x47')][_0x685800];}});_0xfdf7f1=setTimeout(function(){logger[_0xf8de('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x685800);endRouting(_0x685800,_0x42311d,_0x1481cf,_0x15e4c0);clearTimeout(_0xfdf7f1);_0x3ee0a6[_0xf8de('0x46')](!![]);_0x18e401[_0xf8de('0x49')]();},_0x27fe02);switch(_0x42311d['strategy']){case'rrmemory':strategy[_0xf8de('0x4a')](_0x3ee0a6,_0x42311d,_0x15e4c0,_0x1481cf);break;default:strategy['beepall'](_0x3ee0a6,_0x42311d,_0x15e4c0,_0x1481cf);}}else{logger[_0xf8de('0x32')](_0xf8de('0x4b'),_0x685800,_0x1834aa['name']);_0x18e401['stop']();}}}catch(_0x8b1611){console[_0xf8de('0x4c')](_0x8b1611);logger[_0xf8de('0x32')](_0xf8de('0x4d'),_0x685800,_0x8b1611[_0xf8de('0x4e')]);_0x18e401['stop']();}};}; \ 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 4538d4d..585fca2 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 _0x950a=['TIMEOUT','lodash','uuid','./util','../../../../../config/logger','squeue','agent','routing','bind','handleTimeout','timeout','handleDrained','prototype','push','handleRun','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','notificationId','writeLog',':FORCED','debug','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','busyQueue','removeWaitingNotification','STOP'];(function(_0x37464d,_0x29bf11){var _0x4e7573=function(_0x4de5e3){while(--_0x4de5e3){_0x37464d['push'](_0x37464d['shift']());}};_0x4e7573(++_0x29bf11);}(_0x950a,0x111));var _0xa950=function(_0x2c416a,_0x732630){_0x2c416a=_0x2c416a-0x0;var _0x4218d5=_0x950a[_0x2c416a];return _0x4218d5;};'use strict';var _=require(_0xa950('0x0'));var uuid=require(_0xa950('0x1'));var util=require(_0xa950('0x2'));var logger=require(_0xa950('0x3'))('routing');var Agent=function(_0x305b26,_0xa583df,_0x4c027f,_0x2c80ed){this['notificationId']=uuid['v4']();this[_0xa950('0x4')]=_0x305b26;this[_0xa950('0x5')]=_0xa583df;this['realtime']=_0x4c027f;this[_0xa950('0x6')]=_0x2c80ed;this[_0xa950('0x4')]['push'](this['handleRun'][_0xa950('0x7')](this),this[_0xa950('0x8')][_0xa950('0x7')](this));this[_0xa950('0x4')]['on'](_0xa950('0x9'),this[_0xa950('0x8')]['bind'](this));this['squeue']['on']('drained',this[_0xa950('0xa')]['bind'](this));};Agent[_0xa950('0xb')][_0xa950('0xc')]=function(){this[_0xa950('0x4')]['push'](this[_0xa950('0xd')]['bind'](this),this[_0xa950('0x8')][_0xa950('0x7')](this));};Agent[_0xa950('0xb')]['handleDrained']=function(){this[_0xa950('0x8')](!![]);};Agent[_0xa950('0xb')][_0xa950('0xd')]=function(){logger['debug'](_0xa950('0xe'),this[_0xa950('0x4')]['id'],this[_0xa950('0x5')]['id']);if(_['isNil'](this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']])){logger['debug'](_0xa950('0x11'),this[_0xa950('0x4')]['id'],this[_0xa950('0x5')]['id']);setTimeout(this[_0xa950('0xc')][_0xa950('0x7')](this),0x3e8);}else{if(this[_0xa950('0x6')][_0xa950('0x12')]||util[_0xa950('0x13')](this[_0xa950('0x4')]['id'],this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']],this[_0xa950('0x4')]['channel'],![])){this[_0xa950('0xf')][_0xa950('0x10')][this['agent']['id']][_0xa950('0x14')]=!![];this[_0xa950('0xf')]['agents'][this[_0xa950('0x5')]['id']]['busyQueue']=undefined;util[_0xa950('0x15')](this[_0xa950('0xf')],this[_0xa950('0x6')],this[_0xa950('0x5')],this['squeue'][_0xa950('0x16')]);util[_0xa950('0x17')](this[_0xa950('0x18')],this[_0xa950('0x4')]['id'],this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']],null,this[_0xa950('0x6')]);util[_0xa950('0x19')](this[_0xa950('0x4')]['id'],this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']],'RINGING'+(this[_0xa950('0x6')][_0xa950('0x12')]?_0xa950('0x1a'):''));}else{logger[_0xa950('0x1b')](_0xa950('0x1c'),this[_0xa950('0x4')]['id'],this[_0xa950('0x5')]['id']);setTimeout(this['push'][_0xa950('0x7')](this),0x3e8);}}};Agent[_0xa950('0xb')]['handleTimeout']=function(_0x44ee6e){if(_[_0xa950('0x1d')](this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']])){return logger[_0xa950('0x1b')](_0xa950('0x11'),this[_0xa950('0x4')]['id'],this[_0xa950('0x5')]['id']);}else{logger[_0xa950('0x1b')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xa950('0x4')]['id'],this['agent']['id']);util['hideNotification'](this[_0xa950('0x18')],this['squeue']['id'],this[_0xa950('0xf')][_0xa950('0x10')][this[_0xa950('0x5')]['id']],null,this[_0xa950('0x6')]);this['realtime'][_0xa950('0x10')][this['agent']['id']][_0xa950('0x14')]=![];this[_0xa950('0xf')]['agents'][this['agent']['id']][_0xa950('0x1e')]=undefined;util[_0xa950('0x1f')](this[_0xa950('0xf')],this[_0xa950('0x6')],this[_0xa950('0x5')],this[_0xa950('0x4')]['channel']);util['writeLog'](this[_0xa950('0x4')]['id'],this['realtime'][_0xa950('0x10')][this[_0xa950('0x5')]['id']],_0x44ee6e?_0xa950('0x20'):_0xa950('0x21'));}if(!_0x44ee6e){setTimeout(this[_0xa950('0xc')][_0xa950('0x7')](this),0x3e8);}};function agent(_0xd7f55d,_0x3cc798,_0x1ba2fd,_0x3781c6){return new Agent(_0xd7f55d,_0x3cc798,_0x1ba2fd,_0x3781c6);}module['exports']=agent; \ No newline at end of file +var _0x5292=['handleTimeout','bind','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','saveWaitingNotification','routing','showNotification','notificationId','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','squeue','push'];(function(_0xed3039,_0x56aa70){var _0x332f57=function(_0x1e3de7){while(--_0x1e3de7){_0xed3039['push'](_0xed3039['shift']());}};_0x332f57(++_0x56aa70);}(_0x5292,0xf7));var _0x2529=function(_0x5d4600,_0x2c572f){_0x5d4600=_0x5d4600-0x0;var _0x5e71ef=_0x5292[_0x5d4600];return _0x5e71ef;};'use strict';var _=require(_0x2529('0x0'));var uuid=require(_0x2529('0x1'));var util=require('./util');var logger=require(_0x2529('0x2'))('routing');var Agent=function(_0x1540a9,_0x2b088,_0x29576c,_0x228165){this['notificationId']=uuid['v4']();this[_0x2529('0x3')]=_0x1540a9;this['agent']=_0x2b088;this['realtime']=_0x29576c;this['routing']=_0x228165;this[_0x2529('0x3')][_0x2529('0x4')](this['handleRun']['bind'](this),this[_0x2529('0x5')][_0x2529('0x6')](this));this['squeue']['on'](_0x2529('0x7'),this[_0x2529('0x5')][_0x2529('0x6')](this));this[_0x2529('0x3')]['on'](_0x2529('0x8'),this[_0x2529('0x9')][_0x2529('0x6')](this));};Agent[_0x2529('0xa')]['push']=function(){this[_0x2529('0x3')][_0x2529('0x4')](this['handleRun'][_0x2529('0x6')](this),this[_0x2529('0x5')][_0x2529('0x6')](this));};Agent[_0x2529('0xa')][_0x2529('0x9')]=function(){this[_0x2529('0x5')](!![]);};Agent[_0x2529('0xa')]['handleRun']=function(){logger[_0x2529('0xb')](_0x2529('0xc'),this[_0x2529('0x3')]['id'],this[_0x2529('0xd')]['id']);if(_[_0x2529('0xe')](this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']])){logger['debug'](_0x2529('0x11'),this['squeue']['id'],this[_0x2529('0xd')]['id']);setTimeout(this[_0x2529('0x4')][_0x2529('0x6')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x2529('0x12')](this[_0x2529('0x3')]['id'],this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']],this['squeue'][_0x2529('0x13')],![])){this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']]['busy']=!![];this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']]['busyQueue']=undefined;util[_0x2529('0x14')](this[_0x2529('0xf')],this[_0x2529('0x15')],this[_0x2529('0xd')],this['squeue'][_0x2529('0x13')]);util[_0x2529('0x16')](this[_0x2529('0x17')],this[_0x2529('0x3')]['id'],this[_0x2529('0xf')][_0x2529('0x10')][this['agent']['id']],null,this['routing']);util[_0x2529('0x18')](this[_0x2529('0x3')]['id'],this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']],_0x2529('0x19')+(this[_0x2529('0x15')][_0x2529('0x1a')]?_0x2529('0x1b'):''));}else{logger[_0x2529('0xb')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x2529('0x3')]['id'],this[_0x2529('0xd')]['id']);setTimeout(this['push'][_0x2529('0x6')](this),0x3e8);}}};Agent[_0x2529('0xa')]['handleTimeout']=function(_0x17bcbd){if(_[_0x2529('0xe')](this['realtime'][_0x2529('0x10')][this[_0x2529('0xd')]['id']])){return logger['debug'](_0x2529('0x11'),this[_0x2529('0x3')]['id'],this[_0x2529('0xd')]['id']);}else{logger[_0x2529('0xb')](_0x2529('0x1c'),this['squeue']['id'],this[_0x2529('0xd')]['id']);util[_0x2529('0x1d')](this[_0x2529('0x17')],this[_0x2529('0x3')]['id'],this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']],null,this['routing']);this['realtime'][_0x2529('0x10')][this['agent']['id']][_0x2529('0x1e')]=![];this['realtime']['agents'][this['agent']['id']][_0x2529('0x1f')]=undefined;util[_0x2529('0x20')](this[_0x2529('0xf')],this['routing'],this[_0x2529('0xd')],this['squeue']['channel']);util['writeLog'](this[_0x2529('0x3')]['id'],this[_0x2529('0xf')][_0x2529('0x10')][this[_0x2529('0xd')]['id']],_0x17bcbd?_0x2529('0x21'):_0x2529('0x22'));}if(!_0x17bcbd){setTimeout(this[_0x2529('0x4')][_0x2529('0x6')](this),0x3e8);}};function agent(_0xd6e419,_0x298603,_0x3cb99c,_0x2ac868){return new Agent(_0xd6e419,_0x298603,_0x3cb99c,_0x2ac868);}module[_0x2529('0x23')]=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 5d49896..17b56c9 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 _0xc344=['TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','queue','Agents','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc344,0x6a));var _0x4c34=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xc344[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x4c34('0x0'));var uuid=require(_0x4c34('0x1'));var util=require('./util');var logger=require(_0x4c34('0x2'))(_0x4c34('0x3'));var Beepall=function(_0x3964cb,_0x443eb8,_0x160483,_0x3f7a70){this[_0x4c34('0x4')]=uuid['v4']();this[_0x4c34('0x5')]=_0x3964cb;this['queue']=_0x443eb8;this['realtime']=_0x160483;this[_0x4c34('0x3')]=_0x3f7a70;this[_0x4c34('0x5')][_0x4c34('0x6')](this[_0x4c34('0x7')]['bind'](this),this[_0x4c34('0x8')][_0x4c34('0x9')](this));this['squeue']['on'](_0x4c34('0xa'),this[_0x4c34('0x8')][_0x4c34('0x9')](this));this['squeue']['on'](_0x4c34('0xb'),this[_0x4c34('0xc')][_0x4c34('0x9')](this));};Beepall[_0x4c34('0xd')][_0x4c34('0x6')]=function(){this[_0x4c34('0x5')][_0x4c34('0x6')](this[_0x4c34('0x7')][_0x4c34('0x9')](this),this[_0x4c34('0x8')][_0x4c34('0x9')](this));};Beepall[_0x4c34('0xd')][_0x4c34('0xc')]=function(){this[_0x4c34('0x8')](!![]);};Beepall[_0x4c34('0xd')][_0x4c34('0x7')]=function(){var _0x9182df=!![];if(!_[_0x4c34('0xe')](this[_0x4c34('0xf')])&&!_['isNil'](this[_0x4c34('0xf')][_0x4c34('0x10')])&&this['queue'][_0x4c34('0x10')]['length']>0x0){for(var _0x4c8ec5=0x0,_0x7812e1;_0x4c8ec50x0){for(var _0x42b44c=0x0,_0x26b498;_0x42b44c0x0&&_0x1dc28b[_0x14b8d2+_0xc144('0x26')]>=_0x1dc28b[_0x14b8d2+_0xc144('0x27')]){writeLog(_0x25a2de,_0x1dc28b,_0x14b8d2[_0xc144('0x28')]()+_0xc144('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x4fbae9,_0x4e8de5,_0x77842f,_0x256877,_0xc546b){return sendNotification(!![],_0x4fbae9,_0x4e8de5,_0x77842f,_0x256877,_0xc546b);};exports[_0xc144('0x2a')]=function(_0x3a0164,_0x99f6c7,_0x5388cf,_0x253a56,_0x3b3820){return sendNotification(![],_0x3a0164,_0x99f6c7,_0x5388cf,_0x253a56,_0x3b3820);};exports[_0xc144('0x2b')]=function(_0x39537d,_0x3bba2d,_0x232f77){var _0xe49fe5=_0x3bba2d['interaction'][_0xc144('0x2c')];if(!_0xe49fe5&&_0x232f77){_0xe49fe5=_0x232f77['id'];}var _0x54bac3=_['some'](_0x39537d[_0x3bba2d[_0xc144('0x2d')]+_0xc144('0x2e')],function(_0x45dc71){var _0x43de2d=_[_0xc144('0x2f')](_0x3bba2d['channel'])+_0xc144('0x30');return _0x45dc71[_0x43de2d]===_0x3bba2d['interaction']['id'];});if(!_0x54bac3&&_0xe49fe5){_0x54bac3=_['some'](_0x39537d['agents'][_0xe49fe5][_0x3bba2d[_0xc144('0x2d')]+_0xc144('0x31')],function(_0x333758){return _0x333758['id']===_0x3bba2d['interaction']['id'];});}return _0x54bac3;};exports[_0xc144('0x32')]=function(_0x25f06e,_0x32a21e,_0x32b5fc,_0x10dbe6){_0x25f06e[_0xc144('0x33')][_0x32b5fc['id']][_0x10dbe6+_0xc144('0x31')][_0x32a21e[_0xc144('0x19')]['id']]={'id':_0x32a21e[_0xc144('0x34')]['id']};};exports[_0xc144('0x35')]=function(_0x15dee4,_0xf1a87c,_0x2e9f80,_0x2095b3){delete _0x15dee4['agents'][_0x2e9f80['id']][_0x2095b3+_0xc144('0x31')][_0xf1a87c['message']['id']];};exports[_0xc144('0x36')]=writeLog; \ No newline at end of file +var _0xeadb=['message','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','notificationTemplate','error','[%s][QUEUE]\x20%s'];(function(_0x2ad4fa,_0x51c9c9){var _0x30b68a=function(_0xeef468){while(--_0xeef468){_0x2ad4fa['push'](_0x2ad4fa['shift']());}};_0x30b68a(++_0x51c9c9);}(_0xeadb,0xb8));var _0xbead=function(_0x1096da,_0x11f9b0){_0x1096da=_0x1096da-0x0;var _0x53ea32=_0xeadb[_0x1096da];return _0x53ea32;};'use strict';var _=require(_0xbead('0x0'));var util=require('util');var utils=require(_0xbead('0x1'));var Redis=require(_0xbead('0x2'));var config=require(_0xbead('0x3'));var logger=require(_0xbead('0x4'))(_0xbead('0x5'));config['redis']=_[_0xbead('0x6')](config[_0xbead('0x7')],{'host':_0xbead('0x8'),'port':0x18eb});var io=require(_0xbead('0x9'))(new Redis(config[_0xbead('0x7')]));function sendNotification(_0x5bc2e4,_0x46f84a,_0x2b1c4f,_0x27c465,_0x4b5db5,_0x26958c){io['to'](util[_0xbead('0xa')](_0xbead('0xb'),_0x27c465[_0xbead('0xc')]))['emit'](_0xbead('0xd'),_0x27c465);var _0x2968ba=_0x26958c||{};var _0x39c918=_0x2b1c4f[_0xbead('0xe')]('.');var _0xd30d51={'uniqueid':_0x46f84a,'channel':_0x39c918[0x0],'id':_0x39c918[0x1],'title':_0x39c918[0x0]+_0xbead('0xf'),'interactionId':_0x39c918[0x2],'queue':_0x4b5db5?_0x4b5db5['name']:null,'sound':_0x2968ba[_0xbead('0x10')]['notificationSound'],'shake':_0x2968ba[_0xbead('0x10')][_0xbead('0x11')]};try{if(!_0x2968ba[_0xbead('0x12')]){_0x2968ba[_0xbead('0x12')]={};}if(_0x4b5db5){_0x2968ba[_0xbead('0x12')][_0xbead('0x13')]=_0x4b5db5;}else if(_0x2968ba[_0xbead('0x12')][_0xbead('0x13')]){delete _0x2968ba['body'][_0xbead('0x13')];}_0xd30d51[_0xbead('0x14')]=utils['getMustacheRender'](_0x2968ba[_0xbead('0x10')][_0xbead('0x15')],_0x2968ba);}catch(_0xfec9){_0xd30d51[_0xbead('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xbead('0x16')](util[_0xbead('0xa')](_0xbead('0x17'),_0x46f84a,_0xfec9[_0xbead('0x18')]));}io['to'](util[_0xbead('0xa')](_0xbead('0xb'),_0x27c465[_0xbead('0xc')]))[_0xbead('0x19')](util[_0xbead('0xa')](_0xbead('0x1a'),_0x5bc2e4?_0xbead('0x1b'):'remove'),_0xd30d51);}function writeLog(_0x371126,_0x314ed3,_0x29023a){return logger[_0xbead('0x1c')](util[_0xbead('0xa')](_0xbead('0x1d'),_0x371126,_0x314ed3['name'],_0x29023a));}exports[_0xbead('0x1e')]=function(_0x3b426f,_0x5bd957,_0x349aa4,_0x582cef){if(_0x5bd957[_0xbead('0x1f')]){writeLog(_0x3b426f,_0x5bd957,_0xbead('0x20'));return![];}if(!_0x5bd957['online']){writeLog(_0x3b426f,_0x5bd957,_0xbead('0x21'));return![];}if(_0x5bd957[_0x349aa4+_0xbead('0x22')]){writeLog(_0x3b426f,_0x5bd957,_0xbead('0x23'));return![];}if(_0x582cef&&_0x5bd957[_0xbead('0x24')](_0x349aa4+_0xbead('0x25'))&&_0x5bd957['hasOwnProperty'](_0x349aa4+_0xbead('0x26'))){if(_0x5bd957[_0x349aa4+'Capacity']>0x0&&_0x5bd957[_0x349aa4+_0xbead('0x26')]>=_0x5bd957[_0x349aa4+'Capacity']){writeLog(_0x3b426f,_0x5bd957,_0x349aa4[_0xbead('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xbead('0x28')]=function(_0x1fbd1e,_0x5beab7,_0x18fda9,_0x584869,_0x2d959f){return sendNotification(!![],_0x1fbd1e,_0x5beab7,_0x18fda9,_0x584869,_0x2d959f);};exports['hideNotification']=function(_0x427ed3,_0x46602c,_0x13bc14,_0x1531a8,_0x3ca5ed){return sendNotification(![],_0x427ed3,_0x46602c,_0x13bc14,_0x1531a8,_0x3ca5ed);};exports['checkWaitingNotifications']=function(_0x5bfa60,_0x38c4bb,_0x136616){var _0x365b09=_0x38c4bb[_0xbead('0x29')][_0xbead('0x2a')];if(!_0x365b09&&_0x136616){_0x365b09=_0x136616['id'];}var _0x4fbd78=_[_0xbead('0x2b')](_0x5bfa60[_0x38c4bb[_0xbead('0x2c')]+_0xbead('0x2d')],function(_0x500867){var _0xcdb5fa=_[_0xbead('0x2e')](_0x38c4bb[_0xbead('0x2c')])+_0xbead('0x2f');return _0x500867[_0xcdb5fa]===_0x38c4bb[_0xbead('0x29')]['id'];});if(!_0x4fbd78&&_0x365b09){_0x4fbd78=_[_0xbead('0x2b')](_0x5bfa60[_0xbead('0x30')][_0x365b09][_0x38c4bb['channel']+_0xbead('0x31')],function(_0x16f48c){return _0x16f48c['id']===_0x38c4bb[_0xbead('0x29')]['id'];});}return _0x4fbd78;};exports[_0xbead('0x32')]=function(_0x1a4851,_0x46bf33,_0x3b48ef,_0x872875){_0x1a4851[_0xbead('0x30')][_0x3b48ef['id']][_0x872875+_0xbead('0x31')][_0x46bf33[_0xbead('0x18')]['id']]={'id':_0x46bf33['interaction']['id']};};exports['removeWaitingNotification']=function(_0xbe11bf,_0xf5190,_0x44b1ad,_0xa75123){delete _0xbe11bf[_0xbead('0x30')][_0x44b1ad['id']][_0xa75123+_0xbead('0x31')][_0xf5190[_0xbead('0x18')]['id']];};exports[_0xbead('0x33')]=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 d9c4e4c..8531815 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 _0x15b7=['message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','stringify','next','lodash','../../../../config/logger','routing','string','consequence','validate','length','error'];(function(_0xece432,_0x2b5fe8){var _0x2864d3=function(_0x1c0214){while(--_0x1c0214){_0xece432['push'](_0xece432['shift']());}};_0x2864d3(++_0x2b5fe8);}(_0x15b7,0x13a));var _0x715b=function(_0x188309,_0x1c0c44){_0x188309=_0x188309-0x0;var _0x2a8008=_0x15b7[_0x188309];return _0x2a8008;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x715b('0x0'));var utils=require('./utils');var logger=require(_0x715b('0x1'))(_0x715b('0x2'));var system=schema({'command':{'type':_0x715b('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x715b('0x4')]=function(_0x1b0133,_0x1e6a08){return function(_0x5ddad0){try{var _0x4fefd8={'command':_0x1e6a08[0x0]};var _0xe44159=system[_0x715b('0x5')](_0x4fefd8,{'typecast':!![]});if(_0xe44159[_0x715b('0x6')]){logger[_0x715b('0x7')]('[%s][SYSTEM]\x20%s',_0x1b0133,_['map'](_0xe44159,_0x715b('0x8'))['join'](',\x20'));logger[_0x715b('0x9')](_0x715b('0xa'),_0x1b0133);_0x5ddad0['next']();}else{var _0x1c14d9=this;var _0xf2a11=utils[_0x715b('0xb')](_0x1e6a08[0x0],this);logger[_0x715b('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1b0133,_0xf2a11);sh[_0x715b('0xc')](_[_0x715b('0xd')](_0xf2a11),function(_0x4ffe1c,_0x14f17b){logger[_0x715b('0x9')](_0x715b('0xe'),_0x1b0133,_0x4ffe1c);if(_0x4ffe1c==0x0){var _0x429c05=_0x14f17b[_0x715b('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1e6a08[0x1])||_[_0x715b('0x10')](_0x1e6a08[0x1])){logger['info'](_0x715b('0x11'),_0x1b0133);_0x1c14d9[_0x715b('0x12')][_0x1e6a08[0x1]]=_0x429c05;}else{logger['info'](_0x715b('0x13'),_0x1b0133,_0x1e6a08[0x1],_0x429c05);_0x1c14d9[_0x715b('0x12')][_0x1e6a08[0x1]]=_0x429c05;}}_0x5ddad0['next']();});}}catch(_0x18d021){logger[_0x715b('0x7')](_0x715b('0x14'),_0x1b0133,_['isObject'](_0x18d021)?JSON[_0x715b('0x15')](_0x18d021):_0x18d021);logger[_0x715b('0x9')](_0x715b('0xa'),_0x1b0133);_0x5ddad0[_0x715b('0x16')]();}};}; \ No newline at end of file +var _0xb4e6=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','validate','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x433139,_0x249d4f){var _0x4ba411=function(_0x152b44){while(--_0x152b44){_0x433139['push'](_0x433139['shift']());}};_0x4ba411(++_0x249d4f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xb4e6[_0x318410];return _0x2898a3;};'use strict';var schema=require(_0x6b4e('0x0'));var sh=require('shelljs');var _=require(_0x6b4e('0x1'));var utils=require(_0x6b4e('0x2'));var logger=require(_0x6b4e('0x3'))(_0x6b4e('0x4'));var system=schema({'command':{'type':_0x6b4e('0x5'),'required':!![],'message':_0x6b4e('0x6')}});exports[_0x6b4e('0x7')]=function(_0x52313b,_0x40da90){return function(_0x1edf06){try{var _0x1f67a2={'command':_0x40da90[0x0]};var _0x49de51=system[_0x6b4e('0x0')](_0x1f67a2,{'typecast':!![]});if(_0x49de51['length']){logger['error'](_0x6b4e('0x8'),_0x52313b,_['map'](_0x49de51,'message')[_0x6b4e('0x9')](',\x20'));logger[_0x6b4e('0xa')](_0x6b4e('0xb'),_0x52313b);_0x1edf06[_0x6b4e('0xc')]();}else{var _0x14cf84=this;var _0x46cbe1=utils[_0x6b4e('0xd')](_0x40da90[0x0],this);logger['info'](_0x6b4e('0xe'),_0x52313b,_0x46cbe1);sh[_0x6b4e('0xf')](_['trim'](_0x46cbe1),function(_0x2a4d0f,_0x9cd7da){logger[_0x6b4e('0xa')](_0x6b4e('0x10'),_0x52313b,_0x2a4d0f);if(_0x2a4d0f==0x0){var _0x9f8f6c=_0x9cd7da[_0x6b4e('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x6b4e('0x12')](_0x40da90[0x1])||_['isEmpty'](_0x40da90[0x1])){logger[_0x6b4e('0xa')](_0x6b4e('0x13'),_0x52313b);_0x14cf84['body'][_0x40da90[0x1]]=_0x9f8f6c;}else{logger[_0x6b4e('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x52313b,_0x40da90[0x1],_0x9f8f6c);_0x14cf84[_0x6b4e('0x14')][_0x40da90[0x1]]=_0x9f8f6c;}}_0x1edf06[_0x6b4e('0xc')]();});}}catch(_0x3ba513){logger[_0x6b4e('0x15')](_0x6b4e('0x8'),_0x52313b,_[_0x6b4e('0x16')](_0x3ba513)?JSON['stringify'](_0x3ba513):_0x3ba513);logger['info'](_0x6b4e('0xb'),_0x52313b);_0x1edf06[_0x6b4e('0xc')]();}};}; \ 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 473dd43..c7fa874 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 _0x5288=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','next','channel','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','isObject','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5288,0x14e));var _0x8528=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5288[_0x5f0089];return _0x193892;};'use strict';var schema=require(_0x8528('0x0'));var _=require(_0x8528('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8528('0x2')),'smsInteraction':require(_0x8528('0x3')),'mailInteraction':require(_0x8528('0x4')),'faxInteraction':require(_0x8528('0x5')),'whatsappInteraction':require(_0x8528('0x6'))};var logger=require('../../../../config/logger')(_0x8528('0x7'));var tag=schema({'tag':{'type':_0x8528('0x8'),'required':!![],'message':_0x8528('0x9')}});exports[_0x8528('0xa')]=function(_0x480dc1,_0x286132,_0x3eb4ea,_0x2d3932){return function(_0x4b78ef){try{var _0x39af63={'tag':_0x286132[0x0]};var _0x1c39d4=tag['validate'](_0x39af63,{'typecast':!![]});if(_0x1c39d4[_0x8528('0xb')]){logger[_0x8528('0xc')](_0x8528('0xd'),_0x480dc1,_['map'](_0x1c39d4,_0x8528('0xe'))[_0x8528('0xf')](',\x20'));logger[_0x8528('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x480dc1);_0x4b78ef[_0x8528('0x11')]();}else{var _0x17eb3e={'ids':[_0x286132[0x0]]};if(rpc[_0x2d3932['channel']+'Interaction']){rpc[_0x2d3932[_0x8528('0x12')]+'Interaction']['addTags'](_0x2d3932['interaction']['id'],_0x17eb3e)[_0x8528('0x13')](function(_0x50409e){logger[_0x8528('0x10')](_0x8528('0x14'),_0x480dc1,_0x286132[0x1],_0x2d3932[_0x8528('0x12')],_0x2d3932[_0x8528('0x15')]['id']);})[_0x8528('0x16')](function(_0x3a2c30){logger[_0x8528('0xc')]('[%s][TAG]\x20%s',_0x480dc1,JSON['stringify'](_0x3a2c30));logger[_0x8528('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x480dc1);})['finally'](function(){_0x4b78ef['next']();});}}}catch(_0x14d6a2){logger[_0x8528('0xc')]('[%s][TAG]\x20%s',_0x480dc1,_[_0x8528('0x17')](_0x14d6a2)?JSON[_0x8528('0x18')](_0x14d6a2):_0x14d6a2);logger[_0x8528('0x10')](_0x8528('0x19'),_0x480dc1);_0x4b78ef[_0x8528('0x11')]();}};}; \ No newline at end of file +var _0x2ea2=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','error','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','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'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x2ea2,0xc7));var _0x22ea=function(_0x3b6a29,_0xedb1ed){_0x3b6a29=_0x3b6a29-0x0;var _0x1f14b8=_0x2ea2[_0x3b6a29];return _0x1f14b8;};'use strict';var schema=require(_0x22ea('0x0'));var _=require(_0x22ea('0x1'));var rpc={'chatInteraction':require(_0x22ea('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x22ea('0x3')),'mailInteraction':require(_0x22ea('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x22ea('0x5'));var tag=schema({'tag':{'type':_0x22ea('0x6'),'required':!![],'message':_0x22ea('0x7')}});exports[_0x22ea('0x8')]=function(_0x5f59d3,_0x3da6f2,_0x32e8ab,_0x242a55){return function(_0xfae8c5){try{var _0x24069c={'tag':_0x3da6f2[0x0]};var _0x2c6027=tag[_0x22ea('0x0')](_0x24069c,{'typecast':!![]});if(_0x2c6027[_0x22ea('0x9')]){logger['error'](_0x22ea('0xa'),_0x5f59d3,_[_0x22ea('0xb')](_0x2c6027,_0x22ea('0xc'))[_0x22ea('0xd')](',\x20'));logger[_0x22ea('0xe')](_0x22ea('0xf'),_0x5f59d3);_0xfae8c5[_0x22ea('0x10')]();}else{var _0x3a0059={'ids':[_0x3da6f2[0x0]]};if(rpc[_0x242a55[_0x22ea('0x11')]+_0x22ea('0x12')]){rpc[_0x242a55[_0x22ea('0x11')]+'Interaction'][_0x22ea('0x13')](_0x242a55['interaction']['id'],_0x3a0059)[_0x22ea('0x14')](function(_0x5ace49){logger['info'](_0x22ea('0x15'),_0x5f59d3,_0x3da6f2[0x1],_0x242a55[_0x22ea('0x11')],_0x242a55['interaction']['id']);})[_0x22ea('0x16')](function(_0x798e0a){logger['error'](_0x22ea('0xa'),_0x5f59d3,JSON[_0x22ea('0x17')](_0x798e0a));logger[_0x22ea('0xe')](_0x22ea('0xf'),_0x5f59d3);})[_0x22ea('0x18')](function(){_0xfae8c5['next']();});}}}catch(_0x238495){logger[_0x22ea('0x19')](_0x22ea('0xa'),_0x5f59d3,_[_0x22ea('0x1a')](_0x238495)?JSON[_0x22ea('0x17')](_0x238495):_0x238495);logger[_0x22ea('0xe')](_0x22ea('0xf'),_0x5f59d3);_0xfae8c5[_0x22ea('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index d976565..6f0c7da 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 _0x7b97=['Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','stringify','info','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','utf8','POST','then','parse','result'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0x7b97,0x13f));var _0x77b9=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7b97[_0x521929];return _0x632436;};'use strict';var rp=require(_0x77b9('0x0'));var logger=require(_0x77b9('0x1'))(_0x77b9('0x2'));var _=require(_0x77b9('0x3'));var arr=[];exports[_0x77b9('0x4')]=function(_0x13584a,_0x4d349b){return function(_0x33156d){var _0x1faba6=_0x4d349b[0xa];var _0x3513ec=_0x4d349b[0xb];var _0x3a532d=_0x4d349b[0xc];var _0x1065c8=_0x4d349b[0xd];var _0xd2059b=_0x4d349b[0xe];var _0x1dd750=_0x4d349b[0xf][_0x77b9('0x5')](/\n/g,_0x77b9('0x6'));var _0x4eaff7=_0x4d349b[0x10][_0x77b9('0x5')](/\n/g,'\x20');if(!arr[_0x77b9('0x7')](_0x3513ec)){arr['push'](_0x3513ec);var _0x541943=_0x4d349b[0x3];var _0x276483=_0x4d349b[0x4];var _0x1d4602=_0x4d349b[0x1];var _0x1027d4=_0x4d349b[0x0];var _0x193b63={};_0x193b63[_0x77b9('0x8')]=_0x4d349b[0x8]+_0x77b9('0x9')+_0x3a532d+'|'+_0x1faba6+'|'+_0x1065c8+'|'+_0x3513ec+'|'+_0xd2059b;_0x193b63[_0x77b9('0xa')]=_0x4d349b[0x7]+_0x77b9('0x9')+_0x3a532d+'|'+_0x1faba6+'|'+_0x1065c8+'|'+_0x3513ec+'|'+_0xd2059b+'|'+_0x1dd750+'|'+_0x4eaff7;_0x193b63[_0x77b9('0xb')]=_0x4d349b[0x9];var _0x2159a4={};_0x2159a4[_0x77b9('0xc')]=_0x77b9('0xd');_0x2159a4[_0x77b9('0xe')]=_0x77b9('0xf');var _0x56348c=[];_0x56348c['push'](_0x4d349b[0x2]);_0x56348c[_0x77b9('0x10')](_0x4d349b[0x5]);_0x56348c['push'](_0x4d349b[0x6]);_0x2159a4['params']=_0x56348c;_0x2159a4['id']=0x1;var _0x24758a=JSON['stringify'](_0x2159a4);var _0x34800d={'encoding':_0x77b9('0x11'),'method':_0x77b9('0x12'),'timeout':0x2710,'url':_0x541943,'headers':{'Content-Type':'application/json-rpc'},'body':_0x24758a};return rp(_0x34800d)[_0x77b9('0x13')](function(_0x377d24){const _0x370bcb=JSON[_0x77b9('0x14')](_0x377d24);if(!_0x370bcb[_0x77b9('0x15')]['logged']){throw new Error(_0x77b9('0x16'));}var _0x293b57=_0x3513ec;var _0x4a9af0='channelId='+_0x1d4602+'&serviceId='+_0x1027d4+'&sessionId='+_0x293b57+_0x77b9('0x17')+JSON[_0x77b9('0x18')](_0x193b63);var _0xb7cf=_0x276483+'?'+_0x4a9af0;return rp(_0xb7cf);})[_0x77b9('0x13')](function(_0xd9cbc2){logger[_0x77b9('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x13584a,_0xd9cbc2);_0x33156d[_0x77b9('0x1a')]();})['catch'](function(_0x224a14){logger[_0x77b9('0x1b')]('[%s][TVOX]\x20%s',_0x13584a,_[_0x77b9('0x1c')](_0x224a14)?JSON['stringify'](_0x224a14):_0x224a14);_0x33156d['stop']();});}else{logger['info'](_0x77b9('0x1d'),_0x13584a);_0x33156d[_0x77b9('0x1e')]();}};}; \ No newline at end of file +var _0x6371=['jsonrpc','2.0','method','login','params','utf8','POST','application/json-rpc','then','parse','logged','&serviceId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title'];(function(_0x3b80fb,_0x4eba19){var _0xcae818=function(_0x435316){while(--_0x435316){_0x3b80fb['push'](_0x3b80fb['shift']());}};_0xcae818(++_0x4eba19);}(_0x6371,0x114));var _0x1637=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x6371[_0x4b91c4];return _0x25cb80;};'use strict';var rp=require(_0x1637('0x0'));var logger=require('../../../../config/logger')(_0x1637('0x1'));var _=require(_0x1637('0x2'));var arr=[];exports[_0x1637('0x3')]=function(_0x4d3dc8,_0x318ffe){return function(_0x362d20){var _0x1502ee=_0x318ffe[0xa];var _0x3a9f2c=_0x318ffe[0xb];var _0x48e9cf=_0x318ffe[0xc];var _0x1251cf=_0x318ffe[0xd];var _0x1c2a74=_0x318ffe[0xe];var _0x184e2e=_0x318ffe[0xf]['replace'](/\n/g,_0x1637('0x4'));var _0x32e18=_0x318ffe[0x10][_0x1637('0x5')](/\n/g,'\x20');if(!arr[_0x1637('0x6')](_0x3a9f2c)){arr[_0x1637('0x7')](_0x3a9f2c);var _0x1e7b2d=_0x318ffe[0x3];var _0x5f0398=_0x318ffe[0x4];var _0x9eafda=_0x318ffe[0x1];var _0x5d7014=_0x318ffe[0x0];var _0x2af0cd={};_0x2af0cd[_0x1637('0x8')]=_0x318ffe[0x8]+_0x1637('0x9')+_0x48e9cf+'|'+_0x1502ee+'|'+_0x1251cf+'|'+_0x3a9f2c+'|'+_0x1c2a74;_0x2af0cd[_0x1637('0xa')]=_0x318ffe[0x7]+_0x1637('0x9')+_0x48e9cf+'|'+_0x1502ee+'|'+_0x1251cf+'|'+_0x3a9f2c+'|'+_0x1c2a74+'|'+_0x184e2e+'|'+_0x32e18;_0x2af0cd[_0x1637('0xb')]=_0x318ffe[0x9];var _0x7b7536={};_0x7b7536[_0x1637('0xc')]=_0x1637('0xd');_0x7b7536[_0x1637('0xe')]=_0x1637('0xf');var _0xfb322b=[];_0xfb322b['push'](_0x318ffe[0x2]);_0xfb322b['push'](_0x318ffe[0x5]);_0xfb322b[_0x1637('0x7')](_0x318ffe[0x6]);_0x7b7536[_0x1637('0x10')]=_0xfb322b;_0x7b7536['id']=0x1;var _0x614f5d=JSON['stringify'](_0x7b7536);var _0x477676={'encoding':_0x1637('0x11'),'method':_0x1637('0x12'),'timeout':0x2710,'url':_0x1e7b2d,'headers':{'Content-Type':_0x1637('0x13')},'body':_0x614f5d};return rp(_0x477676)[_0x1637('0x14')](function(_0x288e20){const _0x7d9b2c=JSON[_0x1637('0x15')](_0x288e20);if(!_0x7d9b2c['result'][_0x1637('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x544da2=_0x3a9f2c;var _0x10edac='channelId='+_0x9eafda+_0x1637('0x17')+_0x5d7014+'&sessionId='+_0x544da2+_0x1637('0x18')+JSON[_0x1637('0x19')](_0x2af0cd);var _0x3bfbd6=_0x5f0398+'?'+_0x10edac;return rp(_0x3bfbd6);})['then'](function(_0x5dc774){logger[_0x1637('0x1a')](_0x1637('0x1b'),_0x4d3dc8,_0x5dc774);_0x362d20['stop']();})['catch'](function(_0x1f51ca){logger[_0x1637('0x1c')]('[%s][TVOX]\x20%s',_0x4d3dc8,_['isObject'](_0x1f51ca)?JSON[_0x1637('0x19')](_0x1f51ca):_0x1f51ca);_0x362d20[_0x1637('0x1d')]();});}else{logger[_0x1637('0x1a')](_0x1637('0x1e'),_0x4d3dc8);_0x362d20[_0x1637('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 d8dcc5a..862ea78 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1e662f,_0x2e8135){var _0x28be5c=function(_0x5c2b92){while(--_0x5c2b92){_0x1e662f['push'](_0x1e662f['shift']());}};_0x28be5c(++_0x2e8135);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x563559,_0x57a53c){var _0x5b4d7c=function(_0x396887){while(--_0x396887){_0x563559['push'](_0x563559['shift']());}};_0x5b4d7c(++_0x57a53c);}(_0xe706,0xa3));var _0x6e70=function(_0x4d66fb,_0x98e5a6){_0x4d66fb=_0x4d66fb-0x0;var _0x2460ff=_0xe706[_0x4d66fb];return _0x2460ff;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b25d2d5..19e2620 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 _0x3218=['emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/strategy/util','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','account','notificationTemplate','split','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','\x20|\x20','execute','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','busy','agents','busyQueue'];(function(_0x212b03,_0x1f1b50){var _0x423115=function(_0x35ab9d){while(--_0x35ab9d){_0x212b03['push'](_0x212b03['shift']());}};_0x423115(++_0x1f1b50);}(_0x3218,0xee));var _0x8321=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x3218[_0x5d6e30];return _0x3d3f3b;};'use strict';var _=require(_0x8321('0x0'));var util=require(_0x8321('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x8321('0x2'));var BPromise=require(_0x8321('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x8321('0x4'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x8321('0x5')),'mailQueueReport':require(_0x8321('0x6')),'chatQueueReport':require(_0x8321('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8321('0x8')),'whatsappQueueReport':require(_0x8321('0x9'))};var RuleEngine=require(_0x8321('0xa'));function getId(_0x76b397,_0x1393f5,_0x59b036){return util[_0x8321('0xb')](_0x8321('0xc'),_0x76b397,_0x1393f5||0x0,_0x59b036||0x0);}function getIntervals(_0x554830,_0x5c3078){var _0x4d5058=[];if(!_['isNil'](_0x5c3078[_0x8321('0xd')])&&!_[_0x8321('0xe')](_0x554830[_0x5c3078['IntervalId']])&&!_[_0x8321('0xe')](_0x554830[_0x5c3078[_0x8321('0xd')]][_0x8321('0xf')])){_0x4d5058=_[_0x8321('0x10')](_0x554830[_0x5c3078['IntervalId']][_0x8321('0xf')],_0x8321('0x11'));}else if(!_[_0x8321('0xe')](_0x5c3078[_0x8321('0x11')])){_0x4d5058=[_0x5c3078[_0x8321('0x11')]];}return _0x4d5058;}exports['listen']=function(_0xa8744e){_0xa8744e[_0x8321('0x12')]={};return new BPromise(function(_0x22f01c,_0x517aff){var _0x9cca41={'Start':function(_0x40d4ae){var _0x445584=this;return new Promise(function(_0x224de9,_0x2eaa54){if(_0x40d4ae){try{var _0x44b072=[];var _0x5ebc62=getId(_0x40d4ae['channel'],_0x40d4ae[_0x8321('0x13')]?_0x40d4ae[_0x8321('0x13')]['id']:0x0,_0x40d4ae['interaction']?_0x40d4ae[_0x8321('0x14')]['id']:0x0);var _0x5d9824=sUtils['checkWaitingNotifications'](_0xa8744e,_0x40d4ae);if(!_0x5d9824&&_0x40d4ae[_0x8321('0x15')]&&_[_0x8321('0x16')](_0x40d4ae[_0x8321('0x15')])&&_0x40d4ae['applications']['length']){for(var _0x5ce7e7=0x0;_0x5ce7e7<_0x40d4ae['applications'][_0x8321('0x17')];_0x5ce7e7+=0x1){var _0x4da34c=_0x40d4ae[_0x8321('0x15')][_0x5ce7e7];if(fs[_0x8321('0x18')](path[_0x8321('0x19')](__dirname,_0x8321('0x15'),_0x4da34c[_0x8321('0x1a')]+_0x8321('0x1b')))){var _0x82e717=[];switch(_0x4da34c[_0x8321('0x1a')][_0x8321('0x1c')]()){case'autoreply':var _0x5dc6b4=_0x4da34c[_0x8321('0x1d')]['split'](',');if(_0x40d4ae[_0x8321('0x1e')]===_0x8321('0x1f')){_0x82e717['push'](_0x5dc6b4[0x0]);_0x82e717[_0x8321('0x20')](_0x5dc6b4[0x1]);_0x82e717[_0x8321('0x20')](_0x5dc6b4[_0x8321('0x21')](0x2,_0x5dc6b4['length'])[_0x8321('0x19')](','));}else{_0x82e717[_0x8321('0x20')](_0x5dc6b4[0x0]);_0x82e717['push'](_0x5dc6b4[_0x8321('0x21')](0x1,_0x5dc6b4['length'])[_0x8321('0x19')](','));}break;case _0x8321('0x22'):var _0xfa6ad3=_0x4da34c[_0x8321('0x1d')]['split'](',');_0x82e717['push'](_0xfa6ad3[0x0]);_0x82e717['push'](_0xfa6ad3[0x1]);_0x82e717[_0x8321('0x20')](_0xfa6ad3['slice'](0x2,_0xfa6ad3['length'])['join'](','));break;case _0x8321('0x23'):var _0x107a30=_0x4da34c[_0x8321('0x1d')]['split'](',');_0x82e717[_0x8321('0x20')](_0x107a30[0x0]);_0x82e717['push'](_0x107a30[0x1]);_0x82e717[_0x8321('0x20')](_0x107a30[0x2]);_0x82e717[_0x8321('0x20')](_0x107a30[0x3]);_0x82e717['push'](_0x107a30[_0x8321('0x21')](0x4,_0x107a30['length'])[_0x8321('0x19')](','));break;case _0x8321('0x24'):var _0xe6e9e4=_0x4da34c[_0x8321('0x1d')]['split'](',');_0x82e717[_0x8321('0x20')](_0xe6e9e4[0x0]);_0x82e717[_0x8321('0x20')](_0xe6e9e4[0x1]);_0x82e717['push'](_0xe6e9e4[0x2]);_0x82e717[_0x8321('0x20')](_0xe6e9e4[0x3]);_0x82e717[_0x8321('0x20')](_0xe6e9e4[_0x8321('0x21')](0x4,_0xe6e9e4[_0x8321('0x17')])[_0x8321('0x19')](','));break;case'message':_0x82e717[_0x8321('0x20')](_0x4da34c[_0x8321('0x1d')]);break;case'tag':_0x82e717[_0x8321('0x20')](_0x4da34c[_0x8321('0x25')]);_0x82e717['push'](_0x4da34c[_0x8321('0x1d')]);break;case'tvox':var _0x3ba70e=utils['getMustacheRender'](_0x40d4ae[_0x8321('0x26')][_0x8321('0x27')],_0x40d4ae);var _0x19d322=_0x4da34c[_0x8321('0x1d')][_0x8321('0x28')](',');_0x82e717['push'](_0x19d322[0x0]);_0x82e717[_0x8321('0x20')](_0x19d322[0x1]);_0x82e717[_0x8321('0x20')](_0x19d322[0x2]);_0x82e717[_0x8321('0x20')](_0x19d322[0x3]);_0x82e717[_0x8321('0x20')](_0x19d322[0x4]);_0x82e717[_0x8321('0x20')](_0x19d322[0x5]);_0x82e717[_0x8321('0x20')](_0x19d322[0x6]);_0x82e717[_0x8321('0x20')](_0x19d322[0x7]);_0x82e717[_0x8321('0x20')](_0x19d322[0x8]);_0x82e717['push'](_0x19d322[0x9]);_0x82e717[_0x8321('0x20')](_0x19d322[0xa]);_0x82e717[_0x8321('0x20')](_0x40d4ae['interaction']['id']);_0x82e717['push'](_0x40d4ae[_0x8321('0x13')]['id']);_0x82e717[_0x8321('0x20')](_0x4da34c[_0x8321('0x29')]);_0x82e717[_0x8321('0x20')](_0x40d4ae[_0x8321('0x14')][_0x8321('0x2a')]);_0x82e717[_0x8321('0x20')](_0x40d4ae['body'][_0x8321('0x2b')]);_0x82e717['push'](_0x3ba70e);break;default:_0x82e717=_[_0x8321('0xe')](_0x4da34c[_0x8321('0x1d')])?[]:_0x4da34c[_0x8321('0x1d')][_0x8321('0x28')](',');}var _0x174809={'id':util[_0x8321('0xb')](_0x8321('0x2c'),_0x5ebc62,_0x4da34c['id'],_0x4da34c[_0x8321('0x1a')]),'condition':require('./interval')[_0x8321('0x2d')](_0x5ebc62,getIntervals(_0xa8744e[_0x8321('0x2e')],_0x4da34c),_0xa8744e),'consequence':require(_0x8321('0x2f')+_0x4da34c[_0x8321('0x1a')])[_0x8321('0x30')](_0x5ebc62,_0x82e717,_0xa8744e,_0x40d4ae),'p':_0x4da34c['priority']||0x0};logger[_0x8321('0x31')](_0x8321('0x32'),_0x174809['id'],'on\x20interval',getIntervals(_0xa8744e['intervals'],_0x4da34c)[_0x8321('0x19')](_0x8321('0x33')));_0x44b072[_0x8321('0x20')](_0x174809);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8321('0x19')](__dirname,_0x8321('0x15'),_0x4da34c['app']+_0x8321('0x1b')));}}_0xa8744e[_0x8321('0x12')][_0x5ebc62]=new RuleEngine(_0x44b072);_0xa8744e['rules'][_0x5ebc62][_0x8321('0x34')](_0x40d4ae,function(_0x83941a){logger[_0x8321('0x31')](_0x8321('0x35'),JSON[_0x8321('0x36')](_0x83941a[_0x8321('0x37')]));if(_0xa8744e['rules'][_0x5ebc62]){_0xa8744e[_0x8321('0x12')][_0x5ebc62]['emit'](_0x8321('0x38'));}});return _0x224de9({'code':0xc8,'message':_0x40d4ae});}else{if(_0x5d9824){logger[_0x8321('0x31')](util[_0x8321('0xb')](_0x8321('0x39'),_0x5ebc62));}else{logger[_0x8321('0x31')](_0x8321('0x3a'));}return _0x224de9({'code':0xc8,'message':_0x40d4ae});}}catch(_0xd8b578){logger[_0x8321('0x3b')](_0xd8b578['stack']);return _0x2eaa54(_0x445584[_0x8321('0x3b')](0x1f4,_0xd8b578));}}return _0x2eaa54(_0x8321('0x3c'));});},'AcceptMessage':function(_0x51ae92){var _0x122ffa=this;return new Promise(function(_0x3ef8e5,_0x2c3b32){if(_0x51ae92[_0x8321('0x3d')]&&_0x51ae92[_0x8321('0x3d')]['id']){if(_0xa8744e['agents'][_0x51ae92[_0x8321('0x3d')]['id']]){_0xa8744e['agents'][_0x51ae92[_0x8321('0x3d')]['id']][_0x8321('0x3e')]=![];_0xa8744e[_0x8321('0x3f')][_0x51ae92[_0x8321('0x3d')]['id']][_0x8321('0x40')]=undefined;}}if(_0x51ae92['message']&&_0x51ae92[_0x8321('0x13')]['id']){try{var _0x2018d4=getId(_0x51ae92[_0x8321('0x1e')],_0x51ae92[_0x8321('0x13')]?_0x51ae92['message']['id']:0x0,_0x51ae92[_0x8321('0x14')]?_0x51ae92['interaction']['id']:0x0);if(_0xa8744e[_0x8321('0x12')][_0x2018d4]){_0xa8744e[_0x8321('0x12')][_0x2018d4][_0x8321('0x41')](_0x8321('0x42'));if(rpc[_0x51ae92[_0x8321('0x1e')]+_0x8321('0x43')]){rpc[_0x51ae92[_0x8321('0x1e')]+_0x8321('0x43')][_0x8321('0x44')](_0x2018d4,{'UserId':_0x51ae92[_0x8321('0x13')][_0x8321('0x45')]})[_0x8321('0x46')](function(){logger[_0x8321('0x3b')](_0x8321('0x47'));});}}return _0x3ef8e5({'code':0xc8,'message':_0x51ae92});}catch(_0x254942){logger[_0x8321('0x3b')](_0x254942[_0x8321('0x48')]);return _0x2c3b32(_0x122ffa['error'](0x1f4,_0x254942));}}logger[_0x8321('0x3b')]('message\x20is\x20empty');return _0x2c3b32(_0x122ffa[_0x8321('0x3b')](0x1f4,_0x8321('0x49')));});},'RejectMessage':function(_0x592e31){var _0x5081cf=this;return new Promise(function(_0xfb1cd2,_0x2b3a09){if(_0x592e31[_0x8321('0x3d')]&&_0x592e31[_0x8321('0x3d')]['id']){try{if(_0xa8744e[_0x8321('0x3f')][_0x592e31[_0x8321('0x3d')]['id']]){_0xa8744e['agents'][_0x592e31[_0x8321('0x3d')]['id']][_0x8321('0x3e')]=![];_0xa8744e[_0x8321('0x3f')][_0x592e31['agent']['id']][_0x8321('0x40')]=undefined;}return _0xfb1cd2({'code':0xc8,'message':_0x592e31});}catch(_0x38ab6d){logger[_0x8321('0x3b')](_0x38ab6d[_0x8321('0x48')]);return _0x2b3a09(_0x5081cf['error'](0x1f4,_0x38ab6d));}}logger[_0x8321('0x3b')]('message\x20is\x20empty');return _0x2b3a09(_0x5081cf['error'](0x1f4,_0x8321('0x49')));});},'AbandonInteraction':function(_0x1b4244){var _0x53ac96=this;return new Promise(function(_0x4e7efa,_0x297e46){if(_0x1b4244['channel']&&_0x1b4244[_0x8321('0x14')]&&_0x1b4244[_0x8321('0x14')]['id']){try{var _0x135e91=getId(_0x1b4244['channel'],_0x1b4244[_0x8321('0x13')]?_0x1b4244['message']['id']:0x0,_0x1b4244[_0x8321('0x14')]?_0x1b4244['interaction']['id']:0x0);if(_0xa8744e[_0x8321('0x12')][_0x135e91]){_0xa8744e[_0x8321('0x12')][_0x135e91][_0x8321('0x41')]('end');}return _0x4e7efa({'code':0xc8,'message':_0x1b4244});}catch(_0x32c1b6){logger[_0x8321('0x3b')](_0x32c1b6['stack']);return _0x297e46(_0x53ac96[_0x8321('0x3b')](0x1f4,_0x32c1b6));}}logger[_0x8321('0x3b')](_0x8321('0x49'));return _0x297e46(_0x53ac96[_0x8321('0x3b')](0x1f4,_0x8321('0x49')));});},'AgentCapacity':function(_0x1c369a){var _0x3c1675=this;return new Promise(function(_0x5733dc,_0x283aab){if(_0xa8744e[_0x8321('0x3f')]['hasOwnProperty'](_0x1c369a['id'])){for(var _0x3916d7 in _0x1c369a[_0x8321('0x4a')]){if(_0x1c369a['capacity'][_0x8321('0x4b')](_0x3916d7)){if(_0xa8744e[_0x8321('0x3f')][_0x1c369a['id']][_0x8321('0x4b')](_0x3916d7+_0x8321('0x4c'))){_0xa8744e[_0x8321('0x3f')][_0x1c369a['id']][_0x3916d7+'CurrentCapacity']=parseInt(_0x1c369a['capacity'][_0x3916d7],0xa);}}}_0xa8744e[_0x8321('0x3f')][_0x1c369a['id']][_0x8321('0x4d')]();return _0x5733dc({'code':0xc8,'message':_0xa8744e['agents'][_0x1c369a['id']]});}else{return _0x283aab(_0x3c1675[_0x8321('0x3b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5896c9){return new Promise(function(_0x4e4e9b){var _0x59b44a=_['values'](_0xa8744e['agents']);if(_0x5896c9&&_0x5896c9['id']){var _0x555d57=_[_0x8321('0x4e')](_0x59b44a,function(_0x37d364){return _0x37d364['id']===_0x5896c9['id'];});_0x4e4e9b(_0x555d57);}else{_0x4e4e9b({'count':_0x59b44a['length'],'rows':_0x59b44a});}});},'ChatQueues':function(){return new Promise(function(_0x316620){var _0x51d25c=[];for(var _0x305ff1 in _0xa8744e['chatQueues']){if(_0xa8744e[_0x8321('0x4f')]['hasOwnProperty'](_0x305ff1)){var _0x1496aa=_0xa8744e[_0x8321('0x4f')][_0x305ff1];var _0x1e84ec={'id':_0x1496aa['id'],'available':_0x1496aa[_0x8321('0x50')],'loggedIn':_0x1496aa[_0x8321('0x51')],'name':_0x1496aa[_0x8321('0x52')],'paused':_0x1496aa[_0x8321('0x53')],'waiting':_0x1496aa['waiting']};_0x51d25c[_0x8321('0x20')](_0x1e84ec);}}_0x316620({'count':_0x51d25c[_0x8321('0x17')],'rows':_0x51d25c});});},'MailQueues':function(){return new Promise(function(_0x363990){var _0x484e02=[];for(var _0x87692a in _0xa8744e['mailQueues']){if(_0xa8744e[_0x8321('0x54')][_0x8321('0x4b')](_0x87692a)){var _0x320dde=_0xa8744e[_0x8321('0x54')][_0x87692a];var _0x35c910={'id':_0x320dde['id'],'available':_0x320dde[_0x8321('0x50')],'loggedIn':_0x320dde[_0x8321('0x51')],'name':_0x320dde['name'],'paused':_0x320dde['paused'],'waiting':_0x320dde[_0x8321('0x55')]};_0x484e02[_0x8321('0x20')](_0x35c910);}}_0x363990({'count':_0x484e02['length'],'rows':_0x484e02});});},'OpenchannelQueues':function(){return new Promise(function(_0x60f84c){var _0x27830d=[];for(var _0x5c901f in _0xa8744e[_0x8321('0x56')]){if(_0xa8744e[_0x8321('0x56')][_0x8321('0x4b')](_0x5c901f)){var _0x5d1259=_0xa8744e[_0x8321('0x56')][_0x5c901f];var _0x3588b7={'id':_0x5d1259['id'],'available':_0x5d1259[_0x8321('0x50')],'loggedIn':_0x5d1259[_0x8321('0x51')],'name':_0x5d1259[_0x8321('0x52')],'paused':_0x5d1259[_0x8321('0x53')],'waiting':_0x5d1259[_0x8321('0x55')]};_0x27830d['push'](_0x3588b7);}}_0x60f84c({'count':_0x27830d['length'],'rows':_0x27830d});});},'SmsQueues':function(){return new Promise(function(_0x1720e6){var _0x409c53=[];for(var _0x1fc410 in _0xa8744e[_0x8321('0x57')]){if(_0xa8744e[_0x8321('0x57')][_0x8321('0x4b')](_0x1fc410)){var _0x3658b3=_0xa8744e[_0x8321('0x57')][_0x1fc410];var _0x4cff71={'id':_0x3658b3['id'],'available':_0x3658b3[_0x8321('0x50')],'loggedIn':_0x3658b3[_0x8321('0x51')],'name':_0x3658b3[_0x8321('0x52')],'paused':_0x3658b3[_0x8321('0x53')],'waiting':_0x3658b3[_0x8321('0x55')]};_0x409c53[_0x8321('0x20')](_0x4cff71);}}_0x1720e6({'count':_0x409c53[_0x8321('0x17')],'rows':_0x409c53});});},'FaxQueues':function(){return new Promise(function(_0x406d17){var _0x1d55ee=[];for(var _0x348f30 in _0xa8744e['faxQueues']){if(_0xa8744e[_0x8321('0x58')][_0x8321('0x4b')](_0x348f30)){var _0x1bc48d=_0xa8744e[_0x8321('0x58')][_0x348f30];var _0x24d71d={'id':_0x1bc48d['id'],'available':_0x1bc48d[_0x8321('0x50')],'loggedIn':_0x1bc48d[_0x8321('0x51')],'name':_0x1bc48d[_0x8321('0x52')],'paused':_0x1bc48d['paused'],'waiting':_0x1bc48d['waiting']};_0x1d55ee[_0x8321('0x20')](_0x24d71d);}}_0x406d17({'count':_0x1d55ee[_0x8321('0x17')],'rows':_0x1d55ee});});},'WhatsappQueues':function(){return new Promise(function(_0x333d9d){var _0x2267a0=[];for(var _0x2fee0c in _0xa8744e[_0x8321('0x59')]){if(_0xa8744e[_0x8321('0x59')][_0x8321('0x4b')](_0x2fee0c)){var _0x11295a=_0xa8744e['whatsappQueues'][_0x2fee0c];var _0x206414={'id':_0x11295a['id'],'available':_0x11295a[_0x8321('0x50')],'loggedIn':_0x11295a[_0x8321('0x51')],'name':_0x11295a[_0x8321('0x52')],'paused':_0x11295a[_0x8321('0x53')],'waiting':_0x11295a['waiting']};_0x2267a0[_0x8321('0x20')](_0x206414);}}_0x333d9d({'count':_0x2267a0[_0x8321('0x17')],'rows':_0x2267a0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1e53a7){var _0x4f8681=_[_0x8321('0x5a')](_0xa8744e[_0x8321('0x5b')]);_0x1e53a7({'count':_0x4f8681[_0x8321('0x17')],'rows':_0x4f8681});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4da4d6){var _0x24fbdb=_['values'](_0xa8744e['mailQueuesWaitingInteractions']);_0x4da4d6({'count':_0x24fbdb[_0x8321('0x17')],'rows':_0x24fbdb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4b9c8c){var _0x3cd71e=_[_0x8321('0x5a')](_0xa8744e[_0x8321('0x5c')]);_0x4b9c8c({'count':_0x3cd71e[_0x8321('0x17')],'rows':_0x3cd71e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x28ee27){var _0x299809=_[_0x8321('0x5a')](_0xa8744e['smsQueuesWaitingInteractions']);_0x28ee27({'count':_0x299809[_0x8321('0x17')],'rows':_0x299809});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x48ed75){var _0x5c9af8=_[_0x8321('0x5a')](_0xa8744e[_0x8321('0x5d')]);_0x48ed75({'count':_0x5c9af8['length'],'rows':_0x5c9af8});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xac7ab){var _0xcd49c2=_['values'](_0xa8744e[_0x8321('0x5e')]);_0xac7ab({'count':_0xcd49c2[_0x8321('0x17')],'rows':_0xcd49c2});});}};var _0x26a561=jayson[_0x8321('0x5f')](_0x9cca41)['http']();_0x26a561['on'](_0x8321('0x3b'),function(_0x32fc9b){logger[_0x8321('0x3b')](JSON[_0x8321('0x36')](_0x32fc9b));return _0x517aff(_0x32fc9b);});_0x26a561[_0x8321('0x60')](0x232c,_0x8321('0x61'),function(){console[_0x8321('0x62')](_0x8321('0x63'),0x232c);return _0x22f01c(_0x8321('0x64')+0x232c);});});}; \ No newline at end of file +var _0x7752=['../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','map','interval','rules','message','interaction','applications','existsSync','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','length','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','stringify','matchPath','emit','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','available','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport'];(function(_0x4334f4,_0x8c0c09){var _0x5c058f=function(_0xf61252){while(--_0xf61252){_0x4334f4['push'](_0x4334f4['shift']());}};_0x5c058f(++_0x8c0c09);}(_0x7752,0x123));var _0x2775=function(_0x24c952,_0x3eb8e1){_0x24c952=_0x24c952-0x0;var _0xbfba17=_0x7752[_0x24c952];return _0xbfba17;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x2775('0x0'));var BPromise=require('bluebird');var utils=require(_0x2775('0x1'));var sUtils=require(_0x2775('0x2'));var logger=require(_0x2775('0x3'))(_0x2775('0x4'));var rpc={'openchannelQueueReport':require(_0x2775('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x2775('0x6')),'smsQueueReport':require(_0x2775('0x7')),'faxQueueReport':require(_0x2775('0x8')),'whatsappQueueReport':require(_0x2775('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x120e1f,_0x464039,_0x18d0aa){return util[_0x2775('0xa')](_0x2775('0xb'),_0x120e1f,_0x464039||0x0,_0x18d0aa||0x0);}function getIntervals(_0x7c84b2,_0x1bae5a){var _0x58243c=[];if(!_['isNil'](_0x1bae5a['IntervalId'])&&!_['isNil'](_0x7c84b2[_0x1bae5a[_0x2775('0xc')]])&&!_[_0x2775('0xd')](_0x7c84b2[_0x1bae5a[_0x2775('0xc')]]['Intervals'])){_0x58243c=_[_0x2775('0xe')](_0x7c84b2[_0x1bae5a[_0x2775('0xc')]]['Intervals'],_0x2775('0xf'));}else if(!_[_0x2775('0xd')](_0x1bae5a[_0x2775('0xf')])){_0x58243c=[_0x1bae5a[_0x2775('0xf')]];}return _0x58243c;}exports['listen']=function(_0x584eec){_0x584eec[_0x2775('0x10')]={};return new BPromise(function(_0x241596,_0x4c5486){var _0x2bdee0={'Start':function(_0x427d7d){var _0x1e4c83=this;return new Promise(function(_0x11feb1,_0x5a7aad){if(_0x427d7d){try{var _0x3711b3=[];var _0x2e774a=getId(_0x427d7d['channel'],_0x427d7d['message']?_0x427d7d[_0x2775('0x11')]['id']:0x0,_0x427d7d[_0x2775('0x12')]?_0x427d7d[_0x2775('0x12')]['id']:0x0);var _0x1c8f47=sUtils['checkWaitingNotifications'](_0x584eec,_0x427d7d);if(!_0x1c8f47&&_0x427d7d['applications']&&_['isArray'](_0x427d7d[_0x2775('0x13')])&&_0x427d7d[_0x2775('0x13')]['length']){for(var _0x3abda6=0x0;_0x3abda6<_0x427d7d[_0x2775('0x13')]['length'];_0x3abda6+=0x1){var _0x4fc820=_0x427d7d[_0x2775('0x13')][_0x3abda6];if(fs[_0x2775('0x14')](path['join'](__dirname,_0x2775('0x13'),_0x4fc820[_0x2775('0x15')]+_0x2775('0x16')))){var _0x1ebf38=[];switch(_0x4fc820['app'][_0x2775('0x17')]()){case _0x2775('0x18'):var _0x5ecf30=_0x4fc820[_0x2775('0x19')][_0x2775('0x1a')](',');if(_0x427d7d[_0x2775('0x1b')]===_0x2775('0x1c')){_0x1ebf38[_0x2775('0x1d')](_0x5ecf30[0x0]);_0x1ebf38[_0x2775('0x1d')](_0x5ecf30[0x1]);_0x1ebf38[_0x2775('0x1d')](_0x5ecf30[_0x2775('0x1e')](0x2,_0x5ecf30[_0x2775('0x1f')])[_0x2775('0x20')](','));}else{_0x1ebf38[_0x2775('0x1d')](_0x5ecf30[0x0]);_0x1ebf38[_0x2775('0x1d')](_0x5ecf30['slice'](0x1,_0x5ecf30['length'])[_0x2775('0x20')](','));}break;case _0x2775('0x21'):var _0x253dfa=_0x4fc820[_0x2775('0x19')][_0x2775('0x1a')](',');_0x1ebf38[_0x2775('0x1d')](_0x253dfa[0x0]);_0x1ebf38[_0x2775('0x1d')](_0x253dfa[0x1]);_0x1ebf38[_0x2775('0x1d')](_0x253dfa[_0x2775('0x1e')](0x2,_0x253dfa[_0x2775('0x1f')])[_0x2775('0x20')](','));break;case _0x2775('0x22'):var _0x43dc04=_0x4fc820[_0x2775('0x19')]['split'](',');_0x1ebf38[_0x2775('0x1d')](_0x43dc04[0x0]);_0x1ebf38[_0x2775('0x1d')](_0x43dc04[0x1]);_0x1ebf38[_0x2775('0x1d')](_0x43dc04[0x2]);_0x1ebf38[_0x2775('0x1d')](_0x43dc04[0x3]);_0x1ebf38[_0x2775('0x1d')](_0x43dc04[_0x2775('0x1e')](0x4,_0x43dc04[_0x2775('0x1f')])[_0x2775('0x20')](','));break;case _0x2775('0x23'):var _0x15c37e=_0x4fc820['appdata'][_0x2775('0x1a')](',');_0x1ebf38['push'](_0x15c37e[0x0]);_0x1ebf38[_0x2775('0x1d')](_0x15c37e[0x1]);_0x1ebf38[_0x2775('0x1d')](_0x15c37e[0x2]);_0x1ebf38[_0x2775('0x1d')](_0x15c37e[0x3]);_0x1ebf38[_0x2775('0x1d')](_0x15c37e[_0x2775('0x1e')](0x4,_0x15c37e[_0x2775('0x1f')])['join'](','));break;case _0x2775('0x11'):_0x1ebf38[_0x2775('0x1d')](_0x4fc820['appdata']);break;case _0x2775('0x24'):_0x1ebf38[_0x2775('0x1d')](_0x4fc820[_0x2775('0x25')]);_0x1ebf38['push'](_0x4fc820['appdata']);break;case _0x2775('0x26'):var _0x422715=utils[_0x2775('0x27')](_0x427d7d[_0x2775('0x28')][_0x2775('0x29')],_0x427d7d);var _0x165709=_0x4fc820[_0x2775('0x19')][_0x2775('0x1a')](',');_0x1ebf38['push'](_0x165709[0x0]);_0x1ebf38['push'](_0x165709[0x1]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x2]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x3]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x4]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x5]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x6]);_0x1ebf38['push'](_0x165709[0x7]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x8]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0x9]);_0x1ebf38[_0x2775('0x1d')](_0x165709[0xa]);_0x1ebf38[_0x2775('0x1d')](_0x427d7d[_0x2775('0x12')]['id']);_0x1ebf38[_0x2775('0x1d')](_0x427d7d['message']['id']);_0x1ebf38['push'](_0x4fc820['ChatWebsiteId']);_0x1ebf38[_0x2775('0x1d')](_0x427d7d[_0x2775('0x12')][_0x2775('0x2a')]);_0x1ebf38[_0x2775('0x1d')](_0x427d7d[_0x2775('0x2b')]['body']);_0x1ebf38['push'](_0x422715);break;default:_0x1ebf38=_[_0x2775('0xd')](_0x4fc820['appdata'])?[]:_0x4fc820['appdata'][_0x2775('0x1a')](',');}var _0xe3c292={'id':util[_0x2775('0xa')](_0x2775('0x2c'),_0x2e774a,_0x4fc820['id'],_0x4fc820[_0x2775('0x15')]),'condition':require(_0x2775('0x2d'))[_0x2775('0x2e')](_0x2e774a,getIntervals(_0x584eec['intervals'],_0x4fc820),_0x584eec),'consequence':require(_0x2775('0x2f')+_0x4fc820[_0x2775('0x15')])[_0x2775('0x30')](_0x2e774a,_0x1ebf38,_0x584eec,_0x427d7d),'p':_0x4fc820[_0x2775('0x31')]||0x0};logger[_0x2775('0x32')](_0x2775('0x33'),_0xe3c292['id'],_0x2775('0x34'),getIntervals(_0x584eec[_0x2775('0x35')],_0x4fc820)[_0x2775('0x20')](_0x2775('0x36')));_0x3711b3[_0x2775('0x1d')](_0xe3c292);}else{logger[_0x2775('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x2775('0x20')](__dirname,'applications',_0x4fc820[_0x2775('0x15')]+_0x2775('0x16')));}}_0x584eec[_0x2775('0x10')][_0x2e774a]=new RuleEngine(_0x3711b3);_0x584eec[_0x2775('0x10')][_0x2e774a]['execute'](_0x427d7d,function(_0x2aad83){logger[_0x2775('0x32')]('Applications\x20executed',JSON[_0x2775('0x38')](_0x2aad83[_0x2775('0x39')]));if(_0x584eec[_0x2775('0x10')][_0x2e774a]){_0x584eec[_0x2775('0x10')][_0x2e774a][_0x2775('0x3a')]('complete');}});return _0x11feb1({'code':0xc8,'message':_0x427d7d});}else{if(_0x1c8f47){logger['info'](util[_0x2775('0xa')]('Skipped\x20routing\x20for\x20%s',_0x2e774a));}else{logger[_0x2775('0x32')]('No\x20applications\x20to\x20execute');}return _0x11feb1({'code':0xc8,'message':_0x427d7d});}}catch(_0x5dc42f){logger[_0x2775('0x37')](_0x5dc42f[_0x2775('0x3b')]);return _0x5a7aad(_0x1e4c83[_0x2775('0x37')](0x1f4,_0x5dc42f));}}return _0x5a7aad(_0x2775('0x3c'));});},'AcceptMessage':function(_0x43b107){var _0x2b9b16=this;return new Promise(function(_0x375ce1,_0x260315){if(_0x43b107[_0x2775('0x3d')]&&_0x43b107['agent']['id']){if(_0x584eec[_0x2775('0x3e')][_0x43b107[_0x2775('0x3d')]['id']]){_0x584eec[_0x2775('0x3e')][_0x43b107[_0x2775('0x3d')]['id']][_0x2775('0x3f')]=![];_0x584eec[_0x2775('0x3e')][_0x43b107[_0x2775('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x43b107[_0x2775('0x11')]&&_0x43b107['message']['id']){try{var _0x4b961b=getId(_0x43b107[_0x2775('0x1b')],_0x43b107[_0x2775('0x11')]?_0x43b107[_0x2775('0x11')]['id']:0x0,_0x43b107[_0x2775('0x12')]?_0x43b107[_0x2775('0x12')]['id']:0x0);if(_0x584eec['rules'][_0x4b961b]){_0x584eec[_0x2775('0x10')][_0x4b961b][_0x2775('0x3a')]('end');if(rpc[_0x43b107['channel']+'QueueReport']){rpc[_0x43b107['channel']+_0x2775('0x40')][_0x2775('0x41')](_0x4b961b,{'UserId':_0x43b107[_0x2775('0x11')][_0x2775('0x42')]})['catch'](function(){logger[_0x2775('0x37')](_0x2775('0x43'));});}}return _0x375ce1({'code':0xc8,'message':_0x43b107});}catch(_0x23aaac){logger[_0x2775('0x37')](_0x23aaac['stack']);return _0x260315(_0x2b9b16[_0x2775('0x37')](0x1f4,_0x23aaac));}}logger[_0x2775('0x37')](_0x2775('0x44'));return _0x260315(_0x2b9b16['error'](0x1f4,_0x2775('0x44')));});},'RejectMessage':function(_0x385e31){var _0x3be6d8=this;return new Promise(function(_0x4bd7e5,_0x5cb8ce){if(_0x385e31[_0x2775('0x3d')]&&_0x385e31[_0x2775('0x3d')]['id']){try{if(_0x584eec['agents'][_0x385e31[_0x2775('0x3d')]['id']]){_0x584eec['agents'][_0x385e31['agent']['id']][_0x2775('0x3f')]=![];_0x584eec[_0x2775('0x3e')][_0x385e31[_0x2775('0x3d')]['id']][_0x2775('0x45')]=undefined;}return _0x4bd7e5({'code':0xc8,'message':_0x385e31});}catch(_0x20a649){logger[_0x2775('0x37')](_0x20a649[_0x2775('0x3b')]);return _0x5cb8ce(_0x3be6d8['error'](0x1f4,_0x20a649));}}logger[_0x2775('0x37')]('message\x20is\x20empty');return _0x5cb8ce(_0x3be6d8['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x134553){var _0x1510e1=this;return new Promise(function(_0x8b3cfd,_0x340243){if(_0x134553['channel']&&_0x134553[_0x2775('0x12')]&&_0x134553[_0x2775('0x12')]['id']){try{var _0x52acb1=getId(_0x134553[_0x2775('0x1b')],_0x134553[_0x2775('0x11')]?_0x134553[_0x2775('0x11')]['id']:0x0,_0x134553[_0x2775('0x12')]?_0x134553[_0x2775('0x12')]['id']:0x0);if(_0x584eec[_0x2775('0x10')][_0x52acb1]){_0x584eec[_0x2775('0x10')][_0x52acb1][_0x2775('0x3a')](_0x2775('0x46'));}return _0x8b3cfd({'code':0xc8,'message':_0x134553});}catch(_0xf71e4c){logger['error'](_0xf71e4c['stack']);return _0x340243(_0x1510e1[_0x2775('0x37')](0x1f4,_0xf71e4c));}}logger[_0x2775('0x37')]('message\x20is\x20empty');return _0x340243(_0x1510e1[_0x2775('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x7543ef){var _0xa954fc=this;return new Promise(function(_0x4939f3,_0x2a613e){if(_0x584eec[_0x2775('0x3e')][_0x2775('0x47')](_0x7543ef['id'])){for(var _0x23ac61 in _0x7543ef[_0x2775('0x48')]){if(_0x7543ef[_0x2775('0x48')][_0x2775('0x47')](_0x23ac61)){if(_0x584eec['agents'][_0x7543ef['id']][_0x2775('0x47')](_0x23ac61+'CurrentCapacity')){_0x584eec[_0x2775('0x3e')][_0x7543ef['id']][_0x23ac61+_0x2775('0x49')]=parseInt(_0x7543ef['capacity'][_0x23ac61],0xa);}}}_0x584eec[_0x2775('0x3e')][_0x7543ef['id']][_0x2775('0x4a')]();return _0x4939f3({'code':0xc8,'message':_0x584eec[_0x2775('0x3e')][_0x7543ef['id']]});}else{return _0x2a613e(_0xa954fc[_0x2775('0x37')](0x1f4,_0x2775('0x4b')));}});},'Agents':function(_0x3a0bc2){return new Promise(function(_0x29d011){var _0x1633a0=_[_0x2775('0x4c')](_0x584eec['agents']);if(_0x3a0bc2&&_0x3a0bc2['id']){var _0x5ee320=_[_0x2775('0x4d')](_0x1633a0,function(_0x144a2c){return _0x144a2c['id']===_0x3a0bc2['id'];});_0x29d011(_0x5ee320);}else{_0x29d011({'count':_0x1633a0['length'],'rows':_0x1633a0});}});},'ChatQueues':function(){return new Promise(function(_0x58a997){var _0x35282f=[];for(var _0x492a53 in _0x584eec['chatQueues']){if(_0x584eec[_0x2775('0x4e')][_0x2775('0x47')](_0x492a53)){var _0x4e4b88=_0x584eec['chatQueues'][_0x492a53];var _0x37af1c={'id':_0x4e4b88['id'],'available':_0x4e4b88['available'],'loggedIn':_0x4e4b88[_0x2775('0x4f')],'name':_0x4e4b88[_0x2775('0x50')],'paused':_0x4e4b88[_0x2775('0x51')],'waiting':_0x4e4b88[_0x2775('0x52')]};_0x35282f[_0x2775('0x1d')](_0x37af1c);}}_0x58a997({'count':_0x35282f['length'],'rows':_0x35282f});});},'MailQueues':function(){return new Promise(function(_0x2103a1){var _0x374973=[];for(var _0x64c4a6 in _0x584eec[_0x2775('0x53')]){if(_0x584eec[_0x2775('0x53')][_0x2775('0x47')](_0x64c4a6)){var _0x200c7b=_0x584eec[_0x2775('0x53')][_0x64c4a6];var _0x291b06={'id':_0x200c7b['id'],'available':_0x200c7b['available'],'loggedIn':_0x200c7b[_0x2775('0x4f')],'name':_0x200c7b[_0x2775('0x50')],'paused':_0x200c7b[_0x2775('0x51')],'waiting':_0x200c7b['waiting']};_0x374973['push'](_0x291b06);}}_0x2103a1({'count':_0x374973[_0x2775('0x1f')],'rows':_0x374973});});},'OpenchannelQueues':function(){return new Promise(function(_0x55b463){var _0x2cb3fc=[];for(var _0x57f802 in _0x584eec[_0x2775('0x54')]){if(_0x584eec[_0x2775('0x54')]['hasOwnProperty'](_0x57f802)){var _0x5d0b85=_0x584eec['openchannelQueues'][_0x57f802];var _0x27e4bf={'id':_0x5d0b85['id'],'available':_0x5d0b85['available'],'loggedIn':_0x5d0b85['loggedIn'],'name':_0x5d0b85[_0x2775('0x50')],'paused':_0x5d0b85['paused'],'waiting':_0x5d0b85[_0x2775('0x52')]};_0x2cb3fc[_0x2775('0x1d')](_0x27e4bf);}}_0x55b463({'count':_0x2cb3fc[_0x2775('0x1f')],'rows':_0x2cb3fc});});},'SmsQueues':function(){return new Promise(function(_0x321975){var _0x2815f7=[];for(var _0x155a49 in _0x584eec['smsQueues']){if(_0x584eec[_0x2775('0x55')][_0x2775('0x47')](_0x155a49)){var _0x5ae1a2=_0x584eec[_0x2775('0x55')][_0x155a49];var _0x3cc2a0={'id':_0x5ae1a2['id'],'available':_0x5ae1a2[_0x2775('0x56')],'loggedIn':_0x5ae1a2['loggedIn'],'name':_0x5ae1a2[_0x2775('0x50')],'paused':_0x5ae1a2[_0x2775('0x51')],'waiting':_0x5ae1a2[_0x2775('0x52')]};_0x2815f7[_0x2775('0x1d')](_0x3cc2a0);}}_0x321975({'count':_0x2815f7['length'],'rows':_0x2815f7});});},'FaxQueues':function(){return new Promise(function(_0x1eb9a){var _0x43d166=[];for(var _0x4ebcab in _0x584eec[_0x2775('0x57')]){if(_0x584eec[_0x2775('0x57')][_0x2775('0x47')](_0x4ebcab)){var _0xc9cb3c=_0x584eec[_0x2775('0x57')][_0x4ebcab];var _0x4226a5={'id':_0xc9cb3c['id'],'available':_0xc9cb3c[_0x2775('0x56')],'loggedIn':_0xc9cb3c[_0x2775('0x4f')],'name':_0xc9cb3c[_0x2775('0x50')],'paused':_0xc9cb3c[_0x2775('0x51')],'waiting':_0xc9cb3c[_0x2775('0x52')]};_0x43d166[_0x2775('0x1d')](_0x4226a5);}}_0x1eb9a({'count':_0x43d166[_0x2775('0x1f')],'rows':_0x43d166});});},'WhatsappQueues':function(){return new Promise(function(_0x4089c2){var _0x34891b=[];for(var _0x56f21f in _0x584eec[_0x2775('0x58')]){if(_0x584eec[_0x2775('0x58')][_0x2775('0x47')](_0x56f21f)){var _0x384dc9=_0x584eec[_0x2775('0x58')][_0x56f21f];var _0x578601={'id':_0x384dc9['id'],'available':_0x384dc9[_0x2775('0x56')],'loggedIn':_0x384dc9[_0x2775('0x4f')],'name':_0x384dc9[_0x2775('0x50')],'paused':_0x384dc9[_0x2775('0x51')],'waiting':_0x384dc9['waiting']};_0x34891b[_0x2775('0x1d')](_0x578601);}}_0x4089c2({'count':_0x34891b['length'],'rows':_0x34891b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x483876){var _0x4e7a68=_[_0x2775('0x4c')](_0x584eec[_0x2775('0x59')]);_0x483876({'count':_0x4e7a68[_0x2775('0x1f')],'rows':_0x4e7a68});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x18c791){var _0x170c41=_[_0x2775('0x4c')](_0x584eec[_0x2775('0x5a')]);_0x18c791({'count':_0x170c41['length'],'rows':_0x170c41});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x570be8){var _0x2893c7=_['values'](_0x584eec[_0x2775('0x5b')]);_0x570be8({'count':_0x2893c7[_0x2775('0x1f')],'rows':_0x2893c7});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x97466a){var _0x8f2f81=_[_0x2775('0x4c')](_0x584eec['smsQueuesWaitingInteractions']);_0x97466a({'count':_0x8f2f81[_0x2775('0x1f')],'rows':_0x8f2f81});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x408e1c){var _0xd87366=_[_0x2775('0x4c')](_0x584eec['faxQueuesWaitingInteractions']);_0x408e1c({'count':_0xd87366[_0x2775('0x1f')],'rows':_0xd87366});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4f577c){var _0x34ad4f=_[_0x2775('0x4c')](_0x584eec[_0x2775('0x5c')]);_0x4f577c({'count':_0x34ad4f[_0x2775('0x1f')],'rows':_0x34ad4f});});}};var _0x5ad457=jayson[_0x2775('0x5d')](_0x2bdee0)['http']();_0x5ad457['on'](_0x2775('0x37'),function(_0x1f88af){logger[_0x2775('0x37')](JSON[_0x2775('0x38')](_0x1f88af));return _0x4c5486(_0x1f88af);});_0x5ad457[_0x2775('0x5e')](0x232c,_0x2775('0x5f'),function(){console[_0x2775('0x60')](_0x2775('0x61'),0x232c);return _0x241596(_0x2775('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a041e78..a969c39 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 _0x7ceb=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','catch','condition'];(function(_0x145581,_0x56c003){var _0x291d92=function(_0xcdb6e6){while(--_0xcdb6e6){_0x145581['push'](_0x145581['shift']());}};_0x291d92(++_0x56c003);}(_0x7ceb,0x1d4));var _0xb7ce=function(_0x217c48,_0x91ad8c){_0x217c48=_0x217c48-0x0;var _0x20c7eb=_0x7ceb[_0x217c48];return _0x20c7eb;};'use strict';var util=require(_0xb7ce('0x0'));var BPromise=require(_0xb7ce('0x1'));var jayson=require(_0xb7ce('0x2'));var _=require(_0xb7ce('0x3'));var logger=require(_0xb7ce('0x4'))(_0xb7ce('0x5'));var client=jayson[_0xb7ce('0x6')][_0xb7ce('0x7')]({'port':0x232a});function request(_0x3da7a3,_0x1fcb0b){return new BPromise(function(_0x2b5651,_0x3d574a){return client['request'](_0x3da7a3,_0x1fcb0b)[_0xb7ce('0x8')](function(_0x1222de){if(_0x1222de[_0xb7ce('0x9')]){return _0x3d574a(_0x1222de[_0xb7ce('0x9')]['message']);}else{return _0x2b5651(_0x1222de['result']);}})[_0xb7ce('0xa')](function(_0x4bf311){return _0x3d574a(_0x4bf311);});});}exports[_0xb7ce('0xb')]=function(_0x4e28da,_0x3c7bec,_0x4c9546){return function(_0x24444d){if(_0x4c9546['rules']&&!_0x4c9546[_0xb7ce('0xc')][_0x4e28da]){logger[_0xb7ce('0xd')](_0xb7ce('0xe'),_0x4e28da);return _0x24444d[_0xb7ce('0xf')]();}var _0x28163a=[];for(var _0xdb57fc=0x0;_0xdb57fc<_0x3c7bec[_0xb7ce('0x10')];_0xdb57fc+=0x1){_0x28163a['push'](request(_0xb7ce('0x11'),{'command':util[_0xb7ce('0x12')](_0xb7ce('0x13'),_0x3c7bec[_0xdb57fc])})['then'](function(_0x50cab7){return _0x50cab7&&_0x50cab7[_0xb7ce('0x14')]&&_0x50cab7[_0xb7ce('0x14')][_0xb7ce('0x15')](_0xb7ce('0x16'))>=0x0?!![]:![];})['catch'](function(_0x318a5e){logger[_0xb7ce('0x9')](_0xb7ce('0x17'),_0x4e28da,_0x3c7bec[_0xdb57fc]);}));}BPromise[_0xb7ce('0x18')](_0x28163a)[_0xb7ce('0x8')](function(_0x4edbfe){var _0x56750b=_[_0xb7ce('0x19')](_0x4edbfe);logger['info'](_0xb7ce('0x1a'),_0x4e28da,_0x3c7bec['join'](_0xb7ce('0x1b')),_0x56750b);_0x24444d[_0xb7ce('0x1c')](_0x56750b);})[_0xb7ce('0xa')](function(_0x28bc52){console[_0xb7ce('0x1d')](_0x28bc52);logger[_0xb7ce('0x9')](_0xb7ce('0x1a'),_0x4e28da,_0x3c7bec[_0xb7ce('0x1e')](_0xb7ce('0x1b')),_0x28bc52[_0xb7ce('0x1f')]);_0x24444d['stop']();});};}; \ No newline at end of file +var _0x3219=['client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger'];(function(_0x51bac9,_0x1675a7){var _0x2c6371=function(_0x49a68d){while(--_0x49a68d){_0x51bac9['push'](_0x51bac9['shift']());}};_0x2c6371(++_0x1675a7);}(_0x3219,0x7b));var _0x9321=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x3219[_0x478414];return _0x5eb6b9;};'use strict';var util=require(_0x9321('0x0'));var BPromise=require(_0x9321('0x1'));var jayson=require(_0x9321('0x2'));var _=require(_0x9321('0x3'));var logger=require(_0x9321('0x4'))('routing');var client=jayson[_0x9321('0x5')][_0x9321('0x6')]({'port':0x232a});function request(_0x417d8d,_0x1956f0){return new BPromise(function(_0x5de7b5,_0x2a0647){return client[_0x9321('0x7')](_0x417d8d,_0x1956f0)[_0x9321('0x8')](function(_0x148518){if(_0x148518[_0x9321('0x9')]){return _0x2a0647(_0x148518[_0x9321('0x9')][_0x9321('0xa')]);}else{return _0x5de7b5(_0x148518[_0x9321('0xb')]);}})[_0x9321('0xc')](function(_0x3f2a88){return _0x2a0647(_0x3f2a88);});});}exports[_0x9321('0xd')]=function(_0x11ceae,_0x3e42f5,_0x3a09da){return function(_0x2c0a5b){if(_0x3a09da['rules']&&!_0x3a09da[_0x9321('0xe')][_0x11ceae]){logger[_0x9321('0xf')](_0x9321('0x10'),_0x11ceae);return _0x2c0a5b[_0x9321('0x11')]();}var _0x2d3f6d=[];for(var _0x243ff4=0x0;_0x243ff4<_0x3e42f5[_0x9321('0x12')];_0x243ff4+=0x1){_0x2d3f6d['push'](request(_0x9321('0x13'),{'command':util[_0x9321('0x14')](_0x9321('0x15'),_0x3e42f5[_0x243ff4])})[_0x9321('0x8')](function(_0x40ab37){return _0x40ab37&&_0x40ab37[_0x9321('0xa')]&&_0x40ab37['message'][_0x9321('0x16')](_0x9321('0x17'))>=0x0?!![]:![];})[_0x9321('0xc')](function(_0x562792){logger[_0x9321('0x9')](_0x9321('0x18'),_0x11ceae,_0x3e42f5[_0x243ff4]);}));}BPromise['all'](_0x2d3f6d)[_0x9321('0x8')](function(_0x1fa13b){var _0x49adf3=_[_0x9321('0x19')](_0x1fa13b);logger[_0x9321('0xf')](_0x9321('0x1a'),_0x11ceae,_0x3e42f5[_0x9321('0x1b')]('\x20|\x20'),_0x49adf3);_0x2c0a5b[_0x9321('0x1c')](_0x49adf3);})['catch'](function(_0x2209d9){console[_0x9321('0x1d')](_0x2209d9);logger[_0x9321('0x9')](_0x9321('0x1a'),_0x11ceae,_0x3e42f5[_0x9321('0x1b')](_0x9321('0x1e')),_0x2209d9[_0x9321('0x1f')]);_0x2c0a5b[_0x9321('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b4aac9c..6728d61 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 _0x41bb=['transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','error','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind'];(function(_0x4427fc,_0x2c1914){var _0x418aa8=function(_0x3e8e7d){while(--_0x3e8e7d){_0x4427fc['push'](_0x4427fc['shift']());}};_0x418aa8(++_0x2c1914);}(_0x41bb,0xc5));var _0xb41b=function(_0x3757f1,_0x390d7d){_0x3757f1=_0x3757f1-0x0;var _0x12010d=_0x41bb[_0x3757f1];return _0x12010d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x428431,_0x4d5578){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x4'),_0x428431[_0xb41b('0x5')],_0x428431['channel'],_0x428431[_0xb41b('0x6')],_0x428431[_0xb41b('0x7')],_0x428431[_0xb41b('0x8')],_0x428431['calleridnum'],_0x428431['connectedlinenum'],_0x428431['lastevent']));if(_0x428431[_0xb41b('0x6')]){utils[_0xb41b('0x9')](_0x428431['queue'])[_0xb41b('0xa')](function(_0x2c1a53){if(_0x2c1a53){_0x428431[_0xb41b('0xb')]=_0x2c1a53[_0xb41b('0xb')];_0x428431[_0xb41b('0xc')]=_0x428431[_0xb41b('0xd')]?_0x2c1a53[_0xb41b('0xe')]:![];_0x428431['acwtime']=_0x428431[_0xb41b('0xc')]?_0x2c1a53['acwTimeout']:0x0;}utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);});}else{utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);}if(_0x4d5578){delete transfers[_0x428431[_0xb41b('0x5')]];}else{delete agents[_0x428431['destuniqueid']];}}exports[_0xb41b('0x11')]=function(_0x2d947a){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a['uniqueid']),_0x2d947a);agents[_0x2d947a['destuniqueid']]=_0x2d947a;agents[_0x2d947a['destuniqueid']][_0xb41b('0x14')]=utils[_0xb41b('0x15')]();agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x18');agents[_0x2d947a['destuniqueid']][_0xb41b('0x19')]=null;agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x1a')]=null;utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x1b'),_0x2d947a[_0xb41b('0x5')],agents[_0x2d947a['destuniqueid']]['membername'],_0x2d947a['destuniqueid']));}catch(_0xf109f8){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a[_0xb41b('0x5')]),_0xf109f8);}};exports['agentringnoanswer']=function(_0x53bc44){try{if(!_[_0xb41b('0x1c')](agents[_0x53bc44[_0xb41b('0x16')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x53bc44);utils['info'](util['format'](_0xb41b('0x1e'),_0x53bc44[_0xb41b('0x5')],agents[_0x53bc44[_0xb41b('0x16')]]['membername'],_0x53bc44[_0xb41b('0x16')]));agents[_0x53bc44[_0xb41b('0x16')]]['agentringnoanswer']=!![];agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x1f')]=utils['now']();agents[_0x53bc44[_0xb41b('0x16')]]['lastevent']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['reason']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['holdtime']=_0x53bc44['ringtime']?parseInt(_0x53bc44[_0xb41b('0x21')])/0x3e8:0x0;agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x22')]=0x0;unanswered[_0xb41b('0x23')](_0x53bc44[_0xb41b('0x16')]);}}catch(_0x181cbd){utils[_0xb41b('0x24')](util['format'](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x181cbd);}};exports['queuecallerabandon']=function(_0xe64568){try{_['forIn'](agents,function(_0x38277f,_0x31d4cd){if(_0x38277f['uniqueid']==_0xe64568[_0xb41b('0x5')]&&!_['includes'](unanswered,_0x38277f[_0xb41b('0x16')])){utils[_0xb41b('0x12')](util['format'](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0xe64568);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x26'),_0xe64568[_0xb41b('0x5')],_0x38277f[_0xb41b('0x7')],_0x38277f[_0xb41b('0x16')]));_0x38277f[_0xb41b('0x27')]=!![];_0x38277f[_0xb41b('0x1f')]=utils['now']();_0x38277f[_0xb41b('0x17')]='abandoned';_0x38277f['reason']=_0xb41b('0x28');_0x38277f[_0xb41b('0x29')]=_0xe64568[_0xb41b('0x29')];_0x38277f[_0xb41b('0x22')]=0x0;writeDB(_0x38277f);}});}catch(_0x1b8681){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0x1b8681);}};exports[_0xb41b('0x2a')]=function(_0x3a06a0){try{if(agents[_0x3a06a0['destuniqueid']]){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x2b'),_0x3a06a0[_0xb41b('0x5')]),_0x3a06a0);utils[_0xb41b('0x2')](util[_0xb41b('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a06a0['uniqueid'],agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x7')],_0x3a06a0['destuniqueid']));agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x2c')]=utils[_0xb41b('0x15')]();agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x19')]=_0x3a06a0['connectedlinenum'];agents[_0x3a06a0[_0xb41b('0x16')]]['connectedlinename']=_0x3a06a0[_0xb41b('0x1a')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x29')]=_0x3a06a0[_0xb41b('0x21')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x2d');_[_0xb41b('0x2e')](agents,function(_0x2b0721,_0x578b67){if(_0x2b0721['destuniqueid']!=_0x3a06a0['destuniqueid']&&_0x2b0721[_0xb41b('0x5')]==_0x3a06a0['uniqueid']){_0x2b0721['talktime']=0x0;_0x2b0721[_0xb41b('0x29')]=_0x3a06a0['ringtime'];_0x2b0721[_0xb41b('0x27')]=!![];_0x2b0721[_0xb41b('0x1f')]=utils[_0xb41b('0x15')]();_0x2b0721[_0xb41b('0x17')]=_0xb41b('0x2f');_0x2b0721[_0xb41b('0x30')]=_0xb41b('0x2f');_0x2b0721['answeredelsewheredestinationuniqueid']=_0x3a06a0[_0xb41b('0x16')];_0x2b0721[_0xb41b('0x31')]=_0x3a06a0[_0xb41b('0x7')];writeDB(_0x2b0721);}});}}catch(_0x174d6c){utils['error'](util[_0xb41b('0x3')]('[%s][agents][agentconnect]',_0x3a06a0[_0xb41b('0x5')]),_0x174d6c);}};exports[_0xb41b('0xd')]=function(_0x46dbbf){try{if(!_['isNil'](agents[_0x46dbbf['destuniqueid']])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x46dbbf);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x33'),_0x46dbbf['uniqueid'],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x7')],_0x46dbbf['destuniqueid']));agents[_0x46dbbf[_0xb41b('0x16')]]['agentcomplete']=!![];agents[_0x46dbbf[_0xb41b('0x16')]]['agentcompleteAt']=utils[_0xb41b('0x15')]();agents[_0x46dbbf['destuniqueid']][_0xb41b('0x22')]=utils[_0xb41b('0x34')](agents[_0x46dbbf[_0xb41b('0x16')]][_0xb41b('0x35')],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x2c')]);agents[_0x46dbbf[_0xb41b('0x16')]]['reason']=_0x46dbbf[_0xb41b('0x30')];agents[_0x46dbbf['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x46dbbf['destuniqueid']]);}}catch(_0x263d8d){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x263d8d);}};exports[_0xb41b('0x36')]=function(_0x34d076){try{if(!_[_0xb41b('0x1c')](agents[_0x34d076[_0xb41b('0x37')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x34d076);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x39'),_0x34d076['uniqueid'],agents[_0x34d076[_0xb41b('0x37')]]['membername'],agents[_0x34d076['transfereruniqueid']][_0xb41b('0x5')]));agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3a')]=!![];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3b')]=_0xb41b('0x3c');agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3d')]=_0x34d076[_0xb41b('0x3e')];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3f')]=agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x5')];}}catch(_0x3ce89e){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x3ce89e);}};exports[_0xb41b('0x40')]=function(_0x247ca0){try{utils[_0xb41b('0x12')](util['format'](_0xb41b('0x41'),_0x247ca0['origtransfereruniqueid']),_0x247ca0);if(_0x247ca0[_0xb41b('0x42')]==_0x247ca0[_0xb41b('0x43')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x44')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0['origtransfereruniqueid'],agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x7')]));agents[_0x247ca0[_0xb41b('0x44')]]['transfer']=!![];agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3b')]=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3d')]=_0x247ca0[_0xb41b('0x47')];agents[_0x247ca0[_0xb41b('0x44')]]['transferuniqueid']=_0x247ca0['origtransfereruniqueid'];}if(_0x247ca0[_0xb41b('0x48')]&&agents[_0x247ca0[_0xb41b('0x48')]]){agents[_0x247ca0['transfereeuniqueid']][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x48')]]=_['clone'](agents[_0x247ca0[_0xb41b('0x48')]]);transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4a')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4a')];transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x48')]]['agentcalledAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0[_0xb41b('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x29')]=0x0;transfers[_0x247ca0[_0xb41b('0x48')]]['agententerreason']=0x2;}}else if(_0x247ca0[_0xb41b('0x44')]==_0x247ca0[_0xb41b('0x4c')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x42')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0[_0xb41b('0x42')],agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x7')]));agents[_0x247ca0['origtransfereruniqueid']][_0xb41b('0x3a')]=!![];agents[_0x247ca0[_0xb41b('0x42')]]['transfertype']=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3d')]=_0x247ca0['secondtransfererexten'];agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3f')]=_0x247ca0[_0xb41b('0x44')];}if(_0x247ca0[_0xb41b('0x4d')]&&agents[_0x247ca0[_0xb41b('0x4d')]]){agents[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x4d')]]=_[_0xb41b('0x4e')](agents[_0x247ca0[_0xb41b('0x4d')]]);transfers[_0x247ca0['transfertargetuniqueid']]['calleridnum']=agents[_0x247ca0['origtransfereruniqueid']]['calleridnum'];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x14')]=utils['now']();transfers[_0x247ca0[_0xb41b('0x4d')]]['agentconnectAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x29')]=0x0;transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x49')]=0x2;}}}catch(_0xc2afd1){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x41'),_0x247ca0[_0xb41b('0x42')]),_0xc2afd1);}};exports[_0xb41b('0x4f')]=function(_0x39f6ad){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')]('[%s][agents][hangup]',_0x39f6ad[_0xb41b('0x5')]),_0x39f6ad);if(agents[_0x39f6ad['uniqueid']]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]===_0xb41b('0x20')){if(_0x39f6ad['cause']==='21'){agents[_0x39f6ad['uniqueid']]['reason']='rejected';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x50');}utils['info'](util['format'](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]]['lastevent']));writeDB(agents[_0x39f6ad['uniqueid']]);var _0x303ca3=unanswered[_0xb41b('0x52')](_0x39f6ad['uniqueid']);if(_0x303ca3>-0x1){unanswered[_0xb41b('0x53')](_0x303ca3,0x1);}}if(transfers[_0x39f6ad['uniqueid']]){transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];transfers[_0x39f6ad['uniqueid']][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();transfers[_0x39f6ad['uniqueid']]['talktime']=utils[_0xb41b('0x34')](transfers[_0x39f6ad[_0xb41b('0x5')]]['agentcompleteAt'],transfers[_0x39f6ad[_0xb41b('0x5')]]['agentconnectAt']);transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]='agent';transfers[_0x39f6ad['uniqueid']][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],transfers[_0x39f6ad['uniqueid']][_0xb41b('0x7')],transfers[_0x39f6ad['uniqueid']]['reason'],transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(transfers[_0x39f6ad[_0xb41b('0x5')]],!![]);}if(agents[_0x39f6ad[_0xb41b('0x5')]]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]){agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x22')]=utils['diffTime'](agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]);agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]=agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x3a')]?'transfer':'agent';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad['uniqueid'],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad['uniqueid']][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(agents[_0x39f6ad[_0xb41b('0x5')]]);}}catch(_0x31c5c1){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x55'),_0x39f6ad[_0xb41b('0x5')]),_0x31c5c1);}}; \ No newline at end of file +var _0x5c00=['queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','info','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push'];(function(_0x1d2f68,_0x280a21){var _0x3cbf0a=function(_0x304f91){while(--_0x304f91){_0x1d2f68['push'](_0x1d2f68['shift']());}};_0x3cbf0a(++_0x280a21);}(_0x5c00,0x17e));var _0x05c0=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0x5c00[_0x57d500];return _0x142c14;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var utils=require(_0x05c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e54ec,_0x1e76da){utils['info'](util[_0x05c0('0x3')](_0x05c0('0x4'),_0x4e54ec[_0x05c0('0x5')],_0x4e54ec[_0x05c0('0x6')],_0x4e54ec['queue'],_0x4e54ec[_0x05c0('0x7')],_0x4e54ec[_0x05c0('0x8')],_0x4e54ec[_0x05c0('0x9')],_0x4e54ec[_0x05c0('0xa')],_0x4e54ec['lastevent']));if(_0x4e54ec[_0x05c0('0xb')]){utils[_0x05c0('0xc')](_0x4e54ec[_0x05c0('0xb')])['then'](function(_0x32a795){if(_0x32a795){_0x4e54ec[_0x05c0('0xd')]=_0x32a795[_0x05c0('0xd')];_0x4e54ec[_0x05c0('0xe')]=_0x4e54ec[_0x05c0('0xf')]?_0x32a795[_0x05c0('0x10')]:![];_0x4e54ec['acwtime']=_0x4e54ec['agentacw']?_0x32a795[_0x05c0('0x11')]:0x0;}utils['request'](_0x05c0('0x12'),_0x4e54ec);});}else{utils[_0x05c0('0x13')](_0x05c0('0x12'),_0x4e54ec);}if(_0x1e76da){delete transfers[_0x4e54ec['uniqueid']];}else{delete agents[_0x4e54ec[_0x05c0('0x14')]];}}exports['agentcalled']=function(_0x16a290){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x16a290);agents[_0x16a290[_0x05c0('0x14')]]=_0x16a290;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x17')]=utils['now']();agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x18')]=_0x05c0('0x19');agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0xa')]=null;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x1a')]=null;utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x16a290[_0x05c0('0x5')],agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x7')],_0x16a290['destuniqueid']));}catch(_0x40d905){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x40d905);}};exports['agentringnoanswer']=function(_0x407c1f){try{if(!_[_0x05c0('0x1d')](agents[_0x407c1f['destuniqueid']])){utils['debug'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x407c1f);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x1f'),_0x407c1f[_0x05c0('0x5')],agents[_0x407c1f[_0x05c0('0x14')]]['membername'],_0x407c1f[_0x05c0('0x14')]));agents[_0x407c1f[_0x05c0('0x14')]]['agentringnoanswer']=!![];agents[_0x407c1f['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x407c1f['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x20');agents[_0x407c1f['destuniqueid']][_0x05c0('0x21')]=_0x05c0('0x20');agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x407c1f['ringtime']?parseInt(_0x407c1f[_0x05c0('0x23')])/0x3e8:0x0;agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x24')]=0x0;unanswered[_0x05c0('0x25')](_0x407c1f[_0x05c0('0x14')]);}}catch(_0x5d12e0){utils['error'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x5d12e0);}};exports[_0x05c0('0x26')]=function(_0xd6574e){try{_[_0x05c0('0x27')](agents,function(_0x1e00c5,_0x1c4c8f){if(_0x1e00c5[_0x05c0('0x5')]==_0xd6574e[_0x05c0('0x5')]&&!_[_0x05c0('0x28')](unanswered,_0x1e00c5[_0x05c0('0x14')])){utils[_0x05c0('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0xd6574e[_0x05c0('0x5')]),_0xd6574e);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd6574e[_0x05c0('0x5')],_0x1e00c5[_0x05c0('0x7')],_0x1e00c5['destuniqueid']));_0x1e00c5[_0x05c0('0x29')]=!![];_0x1e00c5['agentringnoanswerAt']=utils[_0x05c0('0x2a')]();_0x1e00c5[_0x05c0('0x18')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x21')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x22')]=_0xd6574e[_0x05c0('0x22')];_0x1e00c5[_0x05c0('0x24')]=0x0;writeDB(_0x1e00c5);}});}catch(_0x3d8d76){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x2c'),_0xd6574e[_0x05c0('0x5')]),_0x3d8d76);}};exports[_0x05c0('0x2d')]=function(_0x185d05){try{if(agents[_0x185d05[_0x05c0('0x14')]]){utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x2e'),_0x185d05[_0x05c0('0x5')]),_0x185d05);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x2f'),_0x185d05[_0x05c0('0x5')],agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x7')],_0x185d05[_0x05c0('0x14')]));agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x30')]=utils[_0x05c0('0x2a')]();agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0xa')]=_0x185d05[_0x05c0('0xa')];agents[_0x185d05['destuniqueid']][_0x05c0('0x1a')]=_0x185d05[_0x05c0('0x1a')];agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x185d05['ringtime'];agents[_0x185d05['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x31');_[_0x05c0('0x27')](agents,function(_0x4ced8e,_0x29dc87){if(_0x4ced8e[_0x05c0('0x14')]!=_0x185d05[_0x05c0('0x14')]&&_0x4ced8e[_0x05c0('0x5')]==_0x185d05['uniqueid']){_0x4ced8e[_0x05c0('0x24')]=0x0;_0x4ced8e[_0x05c0('0x22')]=_0x185d05['ringtime'];_0x4ced8e[_0x05c0('0x29')]=!![];_0x4ced8e[_0x05c0('0x32')]=utils[_0x05c0('0x2a')]();_0x4ced8e[_0x05c0('0x18')]=_0x05c0('0x33');_0x4ced8e[_0x05c0('0x21')]=_0x05c0('0x33');_0x4ced8e['answeredelsewheredestinationuniqueid']=_0x185d05['destuniqueid'];_0x4ced8e[_0x05c0('0x34')]=_0x185d05[_0x05c0('0x7')];writeDB(_0x4ced8e);}});}}catch(_0xaa5d53){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')]('[%s][agents][agentconnect]',_0x185d05[_0x05c0('0x5')]),_0xaa5d53);}};exports[_0x05c0('0xf')]=function(_0x2fdfe8){try{if(!_[_0x05c0('0x1d')](agents[_0x2fdfe8[_0x05c0('0x14')]])){utils[_0x05c0('0x15')](util[_0x05c0('0x3')]('[%s][agents][agentcomplete]',_0x2fdfe8[_0x05c0('0x5')]),_0x2fdfe8);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x35'),_0x2fdfe8[_0x05c0('0x5')],agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x7')],_0x2fdfe8[_0x05c0('0x14')]));agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0xf')]=!![];agents[_0x2fdfe8[_0x05c0('0x14')]]['agentcompleteAt']=utils['now']();agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x37')],agents[_0x2fdfe8[_0x05c0('0x14')]]['agentconnectAt']);agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x21')]=_0x2fdfe8[_0x05c0('0x21')];agents[_0x2fdfe8[_0x05c0('0x14')]]['lastevent']=_0x05c0('0x38');writeDB(agents[_0x2fdfe8[_0x05c0('0x14')]]);}}catch(_0x3ec0bf){utils[_0x05c0('0x1c')](util['format'](_0x05c0('0x39'),_0x2fdfe8[_0x05c0('0x5')]),_0x3ec0bf);}};exports[_0x05c0('0x3a')]=function(_0x9b521b){try{if(!_['isNil'](agents[_0x9b521b[_0x05c0('0x3b')]])){utils[_0x05c0('0x15')](util['format'](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x9b521b);utils['info'](util[_0x05c0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x9b521b[_0x05c0('0x5')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x7')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x5')]));agents[_0x9b521b[_0x05c0('0x3b')]]['transfer']=!![];agents[_0x9b521b[_0x05c0('0x3b')]]['transfertype']=_0x05c0('0x3d');agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x3e')]=_0x9b521b[_0x05c0('0x3f')];agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x40')]=agents[_0x9b521b[_0x05c0('0x3b')]]['uniqueid'];}}catch(_0x5215b4){utils['error'](util[_0x05c0('0x3')](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x5215b4);}};exports['attendedtransfer']=function(_0xbfb9cb){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x41'),_0xbfb9cb[_0x05c0('0x42')]),_0xbfb9cb);if(_0xbfb9cb[_0x05c0('0x42')]==_0xbfb9cb[_0x05c0('0x43')]){if(!_['isNil'](agents[_0xbfb9cb[_0x05c0('0x44')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb['origtransfereruniqueid'],agents[_0xbfb9cb[_0x05c0('0x44')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb['secondtransfereruniqueid']][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x3e')]=_0xbfb9cb[_0x05c0('0x48')];agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x42')];}if(_0xbfb9cb['transfereeuniqueid']&&agents[_0xbfb9cb[_0x05c0('0x49')]]){agents[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x1;transfers[_0xbfb9cb[_0x05c0('0x49')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x49')]]);transfers[_0xbfb9cb['transfereeuniqueid']][_0x05c0('0x9')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x9')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4c')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x4c')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x17')]=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x2;}}else if(_0xbfb9cb[_0x05c0('0x44')]==_0xbfb9cb['secondtransfererlinkedid']){if(!_[_0x05c0('0x1d')](agents[_0xbfb9cb[_0x05c0('0x42')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb[_0x05c0('0x42')],agents[_0xbfb9cb[_0x05c0('0x42')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb['origtransfereruniqueid']]['transferexten']=_0xbfb9cb[_0x05c0('0x4d')];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x44')];}if(_0xbfb9cb[_0x05c0('0x4e')]&&agents[_0xbfb9cb[_0x05c0('0x4e')]]){agents[_0xbfb9cb[_0x05c0('0x4e')]]['agententerreason']=0x1;transfers[_0xbfb9cb[_0x05c0('0x4e')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x4e')]]);transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x9')]=agents[_0xbfb9cb['origtransfereruniqueid']]['calleridnum'];transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4c')]=agents[_0xbfb9cb['origtransfereruniqueid']][_0x05c0('0x4c')];transfers[_0xbfb9cb['transfertargetuniqueid']]['agentcalledAt']=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfertargetuniqueid']][_0x05c0('0x22')]=0x0;transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4a')]=0x2;}}}catch(_0x5b39cb){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0xbfb9cb['origtransfereruniqueid']),_0x5b39cb);}};exports[_0x05c0('0x4f')]=function(_0x4f43ae){try{utils['debug'](util['format'](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x4f43ae);if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae['uniqueid']][_0x05c0('0x21')]===_0x05c0('0x20')){if(_0x4f43ae['cause']==='21'){agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x21')]=_0x05c0('0x51');agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']=_0x05c0('0x51');}utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae['uniqueid']]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(agents[_0x4f43ae['uniqueid']]);var _0x3135bd=unanswered['indexOf'](_0x4f43ae['uniqueid']);if(_0x3135bd>-0x1){unanswered['splice'](_0x3135bd,0x1);}}if(transfers[_0x4f43ae['uniqueid']]){transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0xf')]=!![];transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')]=utils['now']();transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],transfers[_0x4f43ae['uniqueid']][_0x05c0('0x30')]);transfers[_0x4f43ae['uniqueid']]['reason']=_0x05c0('0x53');transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4f43ae['uniqueid'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x7')],transfers[_0x4f43ae[_0x05c0('0x5')]]['reason'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(transfers[_0x4f43ae[_0x05c0('0x5')]],!![]);}if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]){agents[_0x4f43ae['uniqueid']][_0x05c0('0xf')]=!![];agents[_0x4f43ae[_0x05c0('0x5')]]['agentcompleteAt']=utils[_0x05c0('0x2a')]();agents[_0x4f43ae[_0x05c0('0x5')]]['talktime']=utils[_0x05c0('0x36')](agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]);agents[_0x4f43ae[_0x05c0('0x5')]]['reason']=agents[_0x4f43ae[_0x05c0('0x5')]]['transfer']?_0x05c0('0x46'):_0x05c0('0x53');agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae[_0x05c0('0x5')]]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']));writeDB(agents[_0x4f43ae[_0x05c0('0x5')]]);}}catch(_0x36f82a){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x36f82a);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 02c241b..eeab9c8 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 _0xe626=['xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','queue','[%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','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','blinds','uniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','format','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','answertime','disposition','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xe626,0x9d));var _0x6e62=function(_0x39a88c,_0x30952b){_0x39a88c=_0x39a88c-0x0;var _0x54e328=_0xe626[_0x39a88c];return _0x54e328;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var utils=require(_0x6e62('0x2'));var transfers=require(_0x6e62('0x3'));var dispositions=['NO\x20ANSWER',_0x6e62('0x4'),_0x6e62('0x4'),_0x6e62('0x5'),_0x6e62('0x5'),_0x6e62('0x5'),'ANSWERED','BUSY','FAILED',_0x6e62('0x4'),_0x6e62('0x4')];var channels={};function writeDB(_0x55165e){var _0x32fd89;if(transfers[_0x6e62('0x6')][_0x55165e[_0x6e62('0x7')]]){_0x32fd89=_0x55165e[_0x6e62('0x7')];_0x55165e['uniqueid']=transfers[_0x6e62('0x6')][_0x55165e[_0x6e62('0x7')]]['transfereeuniqueid'];}utils[_0x6e62('0x8')](util['format'](_0x6e62('0x9'),_0x55165e['uniqueid'],_0x55165e[_0x6e62('0xa')],_0x55165e['queue'],_0x55165e[_0x6e62('0xb')],_0x55165e[_0x6e62('0xc')],_0x55165e[_0x6e62('0xd')],_0x55165e[_0x6e62('0xe')],_0x55165e[_0x6e62('0xf')]));if(_0x55165e[_0x6e62('0x10')]){utils[_0x6e62('0x11')](_0x55165e['accountcode'])['then'](function(_0x44b131){if(_0x44b131){_0x55165e[_0x6e62('0x12')]=_0x44b131['id'];}utils['request'](_0x6e62('0x13'),_0x55165e);});}else{utils[_0x6e62('0x14')](_0x6e62('0x13'),_0x55165e);}if(channels[_0x55165e[_0x6e62('0x7')]]){delete channels[_0x55165e['uniqueid']];}else if(_0x32fd89&&channels[_0x32fd89]){if(!transfers[_0x6e62('0x6')][_0x32fd89][_0x6e62('0x15')])delete transfers[_0x6e62('0x6')][_0x32fd89];delete channels[_0x32fd89];}}exports[_0x6e62('0x16')]=function(_0x2aef7b){try{utils[_0x6e62('0x17')](util[_0x6e62('0x18')](_0x6e62('0x19'),_0x2aef7b[_0x6e62('0x7')]),_0x2aef7b);if(_0x2aef7b[_0x6e62('0x7')]==_0x2aef7b['linkedid']&&_0x2aef7b[_0x6e62('0xa')]!=_0x6e62('0x1a')){utils['info'](util[_0x6e62('0x18')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2aef7b[_0x6e62('0x7')],_0x2aef7b[_0x6e62('0x1b')],_0x2aef7b[_0x6e62('0x1c')]));channels[_0x2aef7b[_0x6e62('0x7')]]={'uniqueid':_0x2aef7b[_0x6e62('0x7')],'accountcode':_0x2aef7b[_0x6e62('0x10')],'source':_0x2aef7b[_0x6e62('0xd')],'destination':_0x2aef7b[_0x6e62('0x1c')],'destinationcontext':_0x2aef7b[_0x6e62('0x1b')],'channel':_0x2aef7b[_0x6e62('0xa')],'starttime':utils[_0x6e62('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x6e62('0x1e')};}}catch(_0x52d5e7){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')](_0x6e62('0x19'),_0x2aef7b[_0x6e62('0x7')]),_0x52d5e7);}};exports[_0x6e62('0x20')]=function(_0x425d1c){try{utils[_0x6e62('0x17')](util[_0x6e62('0x18')](_0x6e62('0x21'),_0x425d1c[_0x6e62('0x7')]),_0x425d1c);if(!_['isNil'](channels[_0x425d1c[_0x6e62('0x7')]])&&_0x425d1c['channelstate']==0x6){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x22'),_0x425d1c[_0x6e62('0x7')],_0x425d1c[_0x6e62('0x1b')],_0x425d1c[_0x6e62('0xa')]));if(_['isNil'](channels[_0x425d1c[_0x6e62('0x7')]][_0x6e62('0x23')])){channels[_0x425d1c[_0x6e62('0x7')]]['systemanswertime']=utils['now']();}}else if(!_[_0x6e62('0x24')](channels[_0x425d1c['linkedid']])&&_0x425d1c['channelstate']==0x6&&_0x425d1c['context']!='transfer'){utils[_0x6e62('0x8')](util['format'](_0x6e62('0x25'),_0x425d1c['uniqueid'],_0x425d1c[_0x6e62('0x26')],_0x425d1c[_0x6e62('0x1b')],_0x425d1c[_0x6e62('0xa')]));channels[_0x425d1c['linkedid']]['accountcode']=_0x425d1c[_0x6e62('0x10')];channels[_0x425d1c[_0x6e62('0x26')]]['destinationchannel']=_0x425d1c['channel'];if(_['isNil'](channels[_0x425d1c[_0x6e62('0x26')]]['answertime'])){channels[_0x425d1c[_0x6e62('0x26')]][_0x6e62('0x27')]=utils[_0x6e62('0x1d')]();}channels[_0x425d1c[_0x6e62('0x26')]][_0x6e62('0x28')]=dispositions[_['toNumber'](_0x425d1c['channelstate'])]||_0x6e62('0x29');}}catch(_0x3e33e5){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')](_0x6e62('0x21'),_0x425d1c[_0x6e62('0x7')]),_0x3e33e5);}};exports[_0x6e62('0x2a')]=function(_0x310789){try{if(!_[_0x6e62('0x24')](channels[_0x310789['uniqueid']])){utils[_0x6e62('0x17')](util[_0x6e62('0x18')](_0x6e62('0x2b'),_0x310789['uniqueid']),_0x310789);if(_[_0x6e62('0x24')](channels[_0x310789[_0x6e62('0x7')]]['callerid'])){channels[_0x310789[_0x6e62('0x7')]][_0x6e62('0x2c')]=_0x310789[_0x6e62('0x2d')]+'\x20<'+_0x310789[_0x6e62('0xd')]+'>';}utils[_0x6e62('0x8')](util['format'](_0x6e62('0x2e'),_0x310789[_0x6e62('0x7')],channels[_0x310789[_0x6e62('0x7')]][_0x6e62('0x2c')],_0x310789[_0x6e62('0x2f')]));channels[_0x310789['uniqueid']][_0x6e62('0x30')]=utils[_0x6e62('0x1d')]();channels[_0x310789[_0x6e62('0x7')]]['duration']=utils[_0x6e62('0x31')](channels[_0x310789[_0x6e62('0x7')]]['endtime'],channels[_0x310789['uniqueid']][_0x6e62('0x32')]);channels[_0x310789[_0x6e62('0x7')]][_0x6e62('0x33')]=channels[_0x310789['uniqueid']]['answertime']?utils[_0x6e62('0x31')](channels[_0x310789['uniqueid']]['endtime'],channels[_0x310789[_0x6e62('0x7')]][_0x6e62('0x27')]):0x0;writeDB(channels[_0x310789[_0x6e62('0x7')]]);}}catch(_0x3f08e3){utils[_0x6e62('0x1f')](util['format'](_0x6e62('0x2b'),_0x310789['uniqueid']),_0x3f08e3);}};exports['attendedtransfer']=function(_0x1ad1ec){try{if(!_[_0x6e62('0x24')](channels[_0x1ad1ec[_0x6e62('0x34')]])){utils['debug'](util[_0x6e62('0x18')]('[%s][calls][attendedtransfer]',_0x1ad1ec[_0x6e62('0x35')]),_0x1ad1ec);if(channels[_0x1ad1ec[_0x6e62('0x34')]][_0x6e62('0xa')]==_0x1ad1ec[_0x6e62('0x36')]){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x37'),_0x1ad1ec[_0x6e62('0x35')],_0x1ad1ec[_0x6e62('0x34')],_0x1ad1ec[_0x6e62('0x38')]));channels[_0x1ad1ec['localtwolinkedid']]['destinationchannel']=_0x1ad1ec['secondtransfererchannel'];channels[_0x1ad1ec[_0x6e62('0x34')]]['userfield']=_0x6e62('0x39');}else if(channels[_0x1ad1ec[_0x6e62('0x34')]]['channel']=_0x1ad1ec[_0x6e62('0x3a')]){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x37'),_0x1ad1ec[_0x6e62('0x35')],_0x1ad1ec[_0x6e62('0x34')],_0x1ad1ec[_0x6e62('0x3b')]));channels[_0x1ad1ec[_0x6e62('0x34')]][_0x6e62('0x3c')]=_0x1ad1ec[_0x6e62('0x3b')];channels[_0x1ad1ec[_0x6e62('0x34')]][_0x6e62('0x3d')]=_0x6e62('0x39');}}}catch(_0x5efc0c){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')]('[%s][calls][attendedtransfer]',_0x1ad1ec[_0x6e62('0x35')]),_0x5efc0c);}};exports['musiconholdstart']=function(_0x45da05){try{if(!_[_0x6e62('0x24')](channels[_0x45da05[_0x6e62('0x7')]])){utils['debug'](util[_0x6e62('0x18')](_0x6e62('0x3e'),_0x45da05[_0x6e62('0x7')]),_0x45da05);channels[_0x45da05[_0x6e62('0x7')]][_0x6e62('0x3f')]=utils[_0x6e62('0x1d')]();utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x40'),_0x45da05[_0x6e62('0x7')],channels[_0x45da05[_0x6e62('0x7')]]['musiconholdstartAt']));}}catch(_0x4a009d){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')](_0x6e62('0x3e'),_0x45da05[_0x6e62('0x7')]),_0x4a009d);}};exports[_0x6e62('0x41')]=function(_0x34108f){try{if(!_['isNil'](channels[_0x34108f[_0x6e62('0x7')]])){utils['debug'](util[_0x6e62('0x18')](_0x6e62('0x42'),_0x34108f[_0x6e62('0x7')]),_0x34108f);if(!_[_0x6e62('0x24')](channels[_0x34108f[_0x6e62('0x7')]]['musiconholdstartAt'])){channels[_0x34108f[_0x6e62('0x7')]][_0x6e62('0x43')]+=utils[_0x6e62('0x31')](utils[_0x6e62('0x1d')](),channels[_0x34108f['uniqueid']][_0x6e62('0x3f')]);utils['info'](util[_0x6e62('0x18')](_0x6e62('0x44'),_0x34108f[_0x6e62('0x7')],channels[_0x34108f[_0x6e62('0x7')]][_0x6e62('0x43')]));delete channels[_0x34108f[_0x6e62('0x7')]][_0x6e62('0x3f')];}}}catch(_0x520ca5){utils[_0x6e62('0x1f')](util['format'](_0x6e62('0x42'),_0x34108f[_0x6e62('0x7')]),_0x520ca5);}};exports[_0x6e62('0x45')]=function(_0x3d5b60){try{if(!_[_0x6e62('0x24')](channels[_0x3d5b60['uniqueid']])){utils[_0x6e62('0x17')](util['format'](_0x6e62('0x46'),_0x3d5b60[_0x6e62('0x7')]),_0x3d5b60);if(!_[_0x6e62('0x24')](_0x3d5b60['variable'][_0x6e62('0x47')])){utils[_0x6e62('0x8')](util['format'](_0x6e62('0x48'),_0x3d5b60['uniqueid'],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60['uniqueid']][_0x6e62('0x4a')]=_0x3d5b60[_0x6e62('0x49')];}if(!_['isNil'](_0x3d5b60[_0x6e62('0x4b')][_0x6e62('0x4c')])){utils['info'](util['format'](_0x6e62('0x4d'),_0x3d5b60[_0x6e62('0x7')],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x4e')]=_0x3d5b60[_0x6e62('0x49')];channels[_0x3d5b60[_0x6e62('0x7')]]['callerid']='\x22'+_0x3d5b60[_0x6e62('0x49')]+_0x6e62('0x4f')+_0x3d5b60[_0x6e62('0x49')]+'>';}if(!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')]['xmd-callerid-preview'])||!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')]['xmd-callerid'])){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x50'),_0x3d5b60[_0x6e62('0x7')],!_[_0x6e62('0x24')](_0x3d5b60['variable'][_0x6e62('0x51')])?_0x6e62('0x51'):_0x6e62('0x52'),_0x3d5b60['value']));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x2c')]=_0x3d5b60['value'];}if(!_[_0x6e62('0x24')](_0x3d5b60['variable'][_0x6e62('0x53')])||!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')]['xmcs-queue'])){utils['info'](util[_0x6e62('0x18')](_0x6e62('0x50'),_0x3d5b60[_0x6e62('0x7')],!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')][_0x6e62('0x53')])?_0x6e62('0x53'):_0x6e62('0x54'),_0x3d5b60['value']));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x55')]='Queue';channels[_0x3d5b60[_0x6e62('0x7')]]['lastdata']=_0x3d5b60[_0x6e62('0x49')];channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x56')]=!![];}if(!_[_0x6e62('0x24')](_0x3d5b60['variable']['xmd-contactid'])){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x57'),_0x3d5b60[_0x6e62('0x7')],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x58')]=_0x3d5b60[_0x6e62('0x49')];}if(!_['isNil'](_0x3d5b60[_0x6e62('0x4b')][_0x6e62('0x59')])){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x5a'),_0x3d5b60[_0x6e62('0x7')],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x5b')]=_0x3d5b60['value'];}if(!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')][_0x6e62('0x5c')])){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x5d'),_0x3d5b60[_0x6e62('0x7')],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x5e')]=_0x3d5b60[_0x6e62('0x49')];}if(!_[_0x6e62('0x24')](_0x3d5b60[_0x6e62('0x4b')][_0x6e62('0x5f')])){utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x60'),_0x3d5b60['uniqueid'],_0x3d5b60[_0x6e62('0x49')]));channels[_0x3d5b60[_0x6e62('0x7')]][_0x6e62('0x5f')]=_0x3d5b60[_0x6e62('0x49')];}}}catch(_0x53684f){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')](_0x6e62('0x46'),_0x3d5b60['uniqueid']),_0x53684f);}};exports[_0x6e62('0x61')]=function(_0xeaaf4d){try{if(!_[_0x6e62('0x24')](channels[_0xeaaf4d[_0x6e62('0x7')]])){utils['debug'](util[_0x6e62('0x18')](_0x6e62('0x62'),_0xeaaf4d[_0x6e62('0x7')]),_0xeaaf4d);utils[_0x6e62('0x8')](util[_0x6e62('0x18')](_0x6e62('0x63'),_0xeaaf4d[_0x6e62('0x7')],_0xeaaf4d[_0x6e62('0x64')],_0xeaaf4d[_0x6e62('0x65')]));if(_0xeaaf4d[_0x6e62('0x64')][_0x6e62('0x66')]()==_0x6e62('0x67')&&_[_0x6e62('0x68')](_0xeaaf4d[_0x6e62('0x65')]['toLowerCase'](),_0x6e62('0x69'))){var _0x49509f=_0xeaaf4d[_0x6e62('0x65')][_0x6e62('0x6a')]('=');var _0xd5bba5=_0x49509f[0x0][_0x6e62('0x6b')](_0x49509f[0x0][_0x6e62('0x6c')]('(')+0x1,_0x49509f[0x0][_0x6e62('0x6c')](')'));var _0x4e5b1e=_0x49509f[0x1];channels[_0xeaaf4d[_0x6e62('0x7')]][_0xd5bba5]=_0x4e5b1e;}if(!_[_0x6e62('0x6d')]([_0x6e62('0x2a'),_0x6e62('0x6e'),_0x6e62('0x6f'),_0x6e62('0x67'),_0x6e62('0x70')],_0xeaaf4d['application'][_0x6e62('0x66')]())){channels[_0xeaaf4d[_0x6e62('0x7')]][_0x6e62('0x55')]=_0xeaaf4d[_0x6e62('0x64')];channels[_0xeaaf4d[_0x6e62('0x7')]][_0x6e62('0x71')]=_0xeaaf4d[_0x6e62('0x65')];}}}catch(_0x266ed9){utils[_0x6e62('0x1f')](util[_0x6e62('0x18')](_0x6e62('0x62'),_0xeaaf4d[_0x6e62('0x7')]),_0x266ed9);}}; \ No newline at end of file +var _0xb89c=['hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','diffTime','endtime','billableseconds','answertime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','execif','gotoif','application','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber'];(function(_0x2e3a69,_0x257a01){var _0x1dc343=function(_0xee2cd3){while(--_0xee2cd3){_0x2e3a69['push'](_0x2e3a69['shift']());}};_0x1dc343(++_0x257a01);}(_0xb89c,0x198));var _0xcb89=function(_0x1f56f0,_0x41eba5){_0x1f56f0=_0x1f56f0-0x0;var _0x1ed250=_0xb89c[_0x1f56f0];return _0x1ed250;};'use strict';var _=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var utils=require(_0xcb89('0x2'));var transfers=require(_0xcb89('0x3'));var dispositions=['NO\x20ANSWER',_0xcb89('0x4'),_0xcb89('0x4'),'NO\x20ANSWER',_0xcb89('0x5'),_0xcb89('0x5'),_0xcb89('0x6'),'BUSY','FAILED',_0xcb89('0x4'),_0xcb89('0x4')];var channels={};function writeDB(_0x32bbb7){var _0x54e3cf;if(transfers[_0xcb89('0x7')][_0x32bbb7[_0xcb89('0x8')]]){_0x54e3cf=_0x32bbb7['uniqueid'];_0x32bbb7['uniqueid']=transfers[_0xcb89('0x7')][_0x32bbb7['uniqueid']][_0xcb89('0x9')];}utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0xc'),_0x32bbb7[_0xcb89('0x8')],_0x32bbb7[_0xcb89('0xd')],_0x32bbb7['queue'],_0x32bbb7[_0xcb89('0xe')],_0x32bbb7['interface'],_0x32bbb7[_0xcb89('0xf')],_0x32bbb7[_0xcb89('0x10')],_0x32bbb7[_0xcb89('0x11')]));if(_0x32bbb7[_0xcb89('0x12')]){utils[_0xcb89('0x13')](_0x32bbb7[_0xcb89('0x12')])[_0xcb89('0x14')](function(_0x53774a){if(_0x53774a){_0x32bbb7[_0xcb89('0x15')]=_0x53774a['id'];}utils[_0xcb89('0x16')]('CreateVoiceCallReport',_0x32bbb7);});}else{utils[_0xcb89('0x16')](_0xcb89('0x17'),_0x32bbb7);}if(channels[_0x32bbb7[_0xcb89('0x8')]]){delete channels[_0x32bbb7['uniqueid']];}else if(_0x54e3cf&&channels[_0x54e3cf]){if(!transfers[_0xcb89('0x7')][_0x54e3cf]['recording'])delete transfers['blinds'][_0x54e3cf];delete channels[_0x54e3cf];}}exports[_0xcb89('0x18')]=function(_0x21ca3f){try{utils[_0xcb89('0x19')](util[_0xcb89('0xb')](_0xcb89('0x1a'),_0x21ca3f[_0xcb89('0x8')]),_0x21ca3f);if(_0x21ca3f[_0xcb89('0x8')]==_0x21ca3f[_0xcb89('0x1b')]&&_0x21ca3f['channel']!=_0xcb89('0x1c')){utils[_0xcb89('0xa')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x21ca3f[_0xcb89('0x8')],_0x21ca3f[_0xcb89('0x1d')],_0x21ca3f[_0xcb89('0x1e')]));channels[_0x21ca3f[_0xcb89('0x8')]]={'uniqueid':_0x21ca3f[_0xcb89('0x8')],'accountcode':_0x21ca3f[_0xcb89('0x12')],'source':_0x21ca3f[_0xcb89('0xf')],'destination':_0x21ca3f[_0xcb89('0x1e')],'destinationcontext':_0x21ca3f['context'],'channel':_0x21ca3f[_0xcb89('0xd')],'starttime':utils[_0xcb89('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcb89('0x5'),'amaflags':_0xcb89('0x20')};}}catch(_0x5d164c){utils[_0xcb89('0x21')](util['format'](_0xcb89('0x1a'),_0x21ca3f['uniqueid']),_0x5d164c);}};exports[_0xcb89('0x22')]=function(_0x1299bd){try{utils[_0xcb89('0x19')](util['format'](_0xcb89('0x23'),_0x1299bd[_0xcb89('0x8')]),_0x1299bd);if(!_[_0xcb89('0x24')](channels[_0x1299bd[_0xcb89('0x8')]])&&_0x1299bd[_0xcb89('0x25')]==0x6){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x26'),_0x1299bd[_0xcb89('0x8')],_0x1299bd['context'],_0x1299bd[_0xcb89('0xd')]));if(_['isNil'](channels[_0x1299bd[_0xcb89('0x8')]]['systemanswertime'])){channels[_0x1299bd['uniqueid']][_0xcb89('0x27')]=utils[_0xcb89('0x1f')]();}}else if(!_[_0xcb89('0x24')](channels[_0x1299bd[_0xcb89('0x1b')]])&&_0x1299bd[_0xcb89('0x25')]==0x6&&_0x1299bd[_0xcb89('0x1d')]!=_0xcb89('0x28')){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x29'),_0x1299bd[_0xcb89('0x8')],_0x1299bd['linkedid'],_0x1299bd['context'],_0x1299bd[_0xcb89('0xd')]));channels[_0x1299bd[_0xcb89('0x1b')]]['accountcode']=_0x1299bd[_0xcb89('0x12')];channels[_0x1299bd[_0xcb89('0x1b')]]['destinationchannel']=_0x1299bd[_0xcb89('0xd')];if(_[_0xcb89('0x24')](channels[_0x1299bd[_0xcb89('0x1b')]]['answertime'])){channels[_0x1299bd[_0xcb89('0x1b')]]['answertime']=utils['now']();}channels[_0x1299bd[_0xcb89('0x1b')]][_0xcb89('0x2a')]=dispositions[_[_0xcb89('0x2b')](_0x1299bd['channelstate'])]||_0xcb89('0x6');}}catch(_0x38f131){utils[_0xcb89('0x21')](util['format'](_0xcb89('0x23'),_0x1299bd[_0xcb89('0x8')]),_0x38f131);}};exports[_0xcb89('0x2c')]=function(_0x2b94a8){try{if(!_[_0xcb89('0x24')](channels[_0x2b94a8[_0xcb89('0x8')]])){utils['debug'](util[_0xcb89('0xb')](_0xcb89('0x2d'),_0x2b94a8['uniqueid']),_0x2b94a8);if(_[_0xcb89('0x24')](channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x2e')])){channels[_0x2b94a8['uniqueid']][_0xcb89('0x2e')]=_0x2b94a8[_0xcb89('0x2f')]+'\x20<'+_0x2b94a8[_0xcb89('0xf')]+'>';}utils[_0xcb89('0xa')](util[_0xcb89('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2b94a8['uniqueid'],channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x2e')],_0x2b94a8[_0xcb89('0x30')]));channels[_0x2b94a8[_0xcb89('0x8')]]['endtime']=utils['now']();channels[_0x2b94a8[_0xcb89('0x8')]]['duration']=utils[_0xcb89('0x31')](channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x32')],channels[_0x2b94a8[_0xcb89('0x8')]]['starttime']);channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x33')]=channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x34')]?utils[_0xcb89('0x31')](channels[_0x2b94a8[_0xcb89('0x8')]][_0xcb89('0x32')],channels[_0x2b94a8['uniqueid']][_0xcb89('0x34')]):0x0;writeDB(channels[_0x2b94a8[_0xcb89('0x8')]]);}}catch(_0x5bf5cc){utils[_0xcb89('0x21')](util['format'](_0xcb89('0x2d'),_0x2b94a8[_0xcb89('0x8')]),_0x5bf5cc);}};exports[_0xcb89('0x35')]=function(_0x3d9af9){try{if(!_[_0xcb89('0x24')](channels[_0x3d9af9[_0xcb89('0x36')]])){utils['debug'](util['format']('[%s][calls][attendedtransfer]',_0x3d9af9[_0xcb89('0x37')]),_0x3d9af9);if(channels[_0x3d9af9[_0xcb89('0x36')]][_0xcb89('0xd')]==_0x3d9af9[_0xcb89('0x38')]){utils['info'](util[_0xcb89('0xb')](_0xcb89('0x39'),_0x3d9af9['origtransfereruniqueid'],_0x3d9af9['localtwolinkedid'],_0x3d9af9[_0xcb89('0x3a')]));channels[_0x3d9af9[_0xcb89('0x36')]][_0xcb89('0x3b')]=_0x3d9af9[_0xcb89('0x3a')];channels[_0x3d9af9['localtwolinkedid']][_0xcb89('0x3c')]=_0xcb89('0x3d');}else if(channels[_0x3d9af9[_0xcb89('0x36')]][_0xcb89('0xd')]=_0x3d9af9['transfertargetchannel']){utils[_0xcb89('0xa')](util['format'](_0xcb89('0x39'),_0x3d9af9[_0xcb89('0x37')],_0x3d9af9[_0xcb89('0x36')],_0x3d9af9[_0xcb89('0x3e')]));channels[_0x3d9af9[_0xcb89('0x36')]]['destinationchannel']=_0x3d9af9[_0xcb89('0x3e')];channels[_0x3d9af9[_0xcb89('0x36')]]['userfield']=_0xcb89('0x3d');}}}catch(_0x39fc1b){utils['error'](util['format'](_0xcb89('0x3f'),_0x3d9af9[_0xcb89('0x37')]),_0x39fc1b);}};exports[_0xcb89('0x40')]=function(_0x3792e4){try{if(!_[_0xcb89('0x24')](channels[_0x3792e4[_0xcb89('0x8')]])){utils[_0xcb89('0x19')](util[_0xcb89('0xb')]('[%s][calls][musiconholdstart]',_0x3792e4[_0xcb89('0x8')]),_0x3792e4);channels[_0x3792e4[_0xcb89('0x8')]]['musiconholdstartAt']=utils[_0xcb89('0x1f')]();utils['info'](util[_0xcb89('0xb')](_0xcb89('0x41'),_0x3792e4[_0xcb89('0x8')],channels[_0x3792e4[_0xcb89('0x8')]]['musiconholdstartAt']));}}catch(_0x4830f3){utils[_0xcb89('0x21')](util[_0xcb89('0xb')](_0xcb89('0x42'),_0x3792e4[_0xcb89('0x8')]),_0x4830f3);}};exports[_0xcb89('0x43')]=function(_0x32bbb8){try{if(!_[_0xcb89('0x24')](channels[_0x32bbb8[_0xcb89('0x8')]])){utils[_0xcb89('0x19')](util['format'](_0xcb89('0x44'),_0x32bbb8[_0xcb89('0x8')]),_0x32bbb8);if(!_[_0xcb89('0x24')](channels[_0x32bbb8['uniqueid']][_0xcb89('0x45')])){channels[_0x32bbb8['uniqueid']][_0xcb89('0x46')]+=utils[_0xcb89('0x31')](utils[_0xcb89('0x1f')](),channels[_0x32bbb8[_0xcb89('0x8')]][_0xcb89('0x45')]);utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x47'),_0x32bbb8[_0xcb89('0x8')],channels[_0x32bbb8[_0xcb89('0x8')]][_0xcb89('0x46')]));delete channels[_0x32bbb8[_0xcb89('0x8')]][_0xcb89('0x45')];}}}catch(_0x35ce09){utils[_0xcb89('0x21')](util['format']('[%s][calls][musiconholdstop]',_0x32bbb8[_0xcb89('0x8')]),_0x35ce09);}};exports[_0xcb89('0x48')]=function(_0x50c87e){try{if(!_['isNil'](channels[_0x50c87e[_0xcb89('0x8')]])){utils[_0xcb89('0x19')](util[_0xcb89('0xb')](_0xcb89('0x49'),_0x50c87e[_0xcb89('0x8')]),_0x50c87e);if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x4b')])){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x4c'),_0x50c87e[_0xcb89('0x8')],_0x50c87e['value']));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x4d')]=_0x50c87e['value'];}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')]['xmd-phone'])){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x4e'),_0x50c87e['uniqueid'],_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x50')]=_0x50c87e[_0xcb89('0x4f')];channels[_0x50c87e[_0xcb89('0x8')]]['callerid']='\x22'+_0x50c87e['value']+_0xcb89('0x51')+_0x50c87e[_0xcb89('0x4f')]+'>';}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')]['xmd-callerid-preview'])||!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x52')])){utils[_0xcb89('0xa')](util['format'](_0xcb89('0x53'),_0x50c87e[_0xcb89('0x8')],!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x54')])?_0xcb89('0x54'):'xmd-callerid',_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e['uniqueid']][_0xcb89('0x2e')]=_0x50c87e[_0xcb89('0x4f')];}if(!_[_0xcb89('0x24')](_0x50c87e['variable'][_0xcb89('0x55')])||!_['isNil'](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x56')])){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x53'),_0x50c87e[_0xcb89('0x8')],!_['isNil'](_0x50c87e['variable'][_0xcb89('0x55')])?'xmd-queue':_0xcb89('0x56'),_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x57')]='Queue';channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x58')]=_0x50c87e[_0xcb89('0x4f')];channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x59')]=!![];}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x5a')])){utils[_0xcb89('0xa')](util['format'](_0xcb89('0x5b'),_0x50c87e[_0xcb89('0x8')],_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x5c')]=_0x50c87e[_0xcb89('0x4f')];}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x5d')])){utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x5e'),_0x50c87e[_0xcb89('0x8')],_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]]['type']=_0x50c87e['value'];}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')]['outboundrouteid'])){utils['info'](util[_0xcb89('0xb')](_0xcb89('0x5f'),_0x50c87e[_0xcb89('0x8')],_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x60')]=_0x50c87e[_0xcb89('0x4f')];}if(!_[_0xcb89('0x24')](_0x50c87e[_0xcb89('0x4a')][_0xcb89('0x61')])){utils[_0xcb89('0xa')](util['format'](_0xcb89('0x62'),_0x50c87e['uniqueid'],_0x50c87e[_0xcb89('0x4f')]));channels[_0x50c87e[_0xcb89('0x8')]][_0xcb89('0x61')]=_0x50c87e[_0xcb89('0x4f')];}}}catch(_0x23f47a){utils[_0xcb89('0x21')](util['format'](_0xcb89('0x49'),_0x50c87e[_0xcb89('0x8')]),_0x23f47a);}};exports[_0xcb89('0x63')]=function(_0x41e332){try{if(!_[_0xcb89('0x24')](channels[_0x41e332[_0xcb89('0x8')]])){utils['debug'](util[_0xcb89('0xb')]('[%s][calls][newexten]',_0x41e332[_0xcb89('0x8')]),_0x41e332);utils[_0xcb89('0xa')](util[_0xcb89('0xb')](_0xcb89('0x64'),_0x41e332[_0xcb89('0x8')],_0x41e332['application'],_0x41e332['appdata']));if(_0x41e332['application'][_0xcb89('0x65')]()==_0xcb89('0x66')&&_[_0xcb89('0x67')](_0x41e332[_0xcb89('0x68')][_0xcb89('0x65')](),'cdr')){var _0x48d5df=_0x41e332[_0xcb89('0x68')][_0xcb89('0x69')]('=');var _0xa296bb=_0x48d5df[0x0][_0xcb89('0x6a')](_0x48d5df[0x0][_0xcb89('0x6b')]('(')+0x1,_0x48d5df[0x0][_0xcb89('0x6b')](')'));var _0xe08669=_0x48d5df[0x1];channels[_0x41e332[_0xcb89('0x8')]][_0xa296bb]=_0xe08669;}if(!_[_0xcb89('0x6c')](['hangup','noop',_0xcb89('0x6d'),_0xcb89('0x66'),_0xcb89('0x6e')],_0x41e332[_0xcb89('0x6f')]['toLowerCase']())){channels[_0x41e332[_0xcb89('0x8')]][_0xcb89('0x57')]=_0x41e332[_0xcb89('0x6f')];channels[_0x41e332[_0xcb89('0x8')]][_0xcb89('0x58')]=_0x41e332[_0xcb89('0x68')];}}}catch(_0x225b72){utils[_0xcb89('0x21')](util['format'](_0xcb89('0x70'),_0x41e332['uniqueid']),_0x225b72);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5fe50e8..bb51ec3 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 _0xdcd2=['[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0xf86e81,_0x3089d3){var _0x477be7=function(_0x4db67d){while(--_0x4db67d){_0xf86e81['push'](_0xf86e81['shift']());}};_0x477be7(++_0x3089d3);}(_0xdcd2,0x10a));var _0x2dcd=function(_0x1dfaf2,_0x152df6){_0x1dfaf2=_0x1dfaf2-0x0;var _0x510899=_0xdcd2[_0x1dfaf2];return _0x510899;};'use strict';var utils=require(_0x2dcd('0x0'));exports[_0x2dcd('0x1')]=function(){utils['info'](_0x2dcd('0x2'));};exports[_0x2dcd('0x3')]=function(){utils[_0x2dcd('0x4')](_0x2dcd('0x5'));};exports[_0x2dcd('0x6')]=function(){utils['info'](_0x2dcd('0x7'));};exports[_0x2dcd('0x8')]=function(_0x221f58){utils['error'](_0x2dcd('0x9'),_0x221f58);};exports[_0x2dcd('0xa')]=function(){utils[_0x2dcd('0x4')](_0x2dcd('0xb'));};exports[_0x2dcd('0xc')]=function(_0x1f332){}; \ No newline at end of file +var _0xa3be=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','./utils','connect','info','shutdown'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0xa3be,0x114));var _0xea3b=function(_0x2f21db,_0x287054){_0x2f21db=_0x2f21db-0x0;var _0x18227=_0xa3be[_0x2f21db];return _0x18227;};'use strict';var utils=require(_0xea3b('0x0'));exports[_0xea3b('0x1')]=function(){utils[_0xea3b('0x2')]('[core]\x20connected');};exports[_0xea3b('0x3')]=function(){utils[_0xea3b('0x2')](_0xea3b('0x4'));};exports[_0xea3b('0x5')]=function(){utils[_0xea3b('0x2')](_0xea3b('0x6'));};exports[_0xea3b('0x7')]=function(_0x2b51f1){utils[_0xea3b('0x7')]('[core]\x20error',_0x2b51f1);};exports[_0xea3b('0x8')]=function(){utils[_0xea3b('0x2')](_0xea3b('0x9'));};exports['managerevent']=function(_0x2984f7){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e0c6e33..e9d756c 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 _0x89a3=['CreateVoiceDialReport','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','split','error','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request'];(function(_0x157098,_0x4d5d33){var _0x91ea75=function(_0x3606b7){while(--_0x3606b7){_0x157098['push'](_0x157098['shift']());}};_0x91ea75(++_0x4d5d33);}(_0x89a3,0x152));var _0x389a=function(_0x31d1b9,_0xcb2cc5){_0x31d1b9=_0x31d1b9-0x0;var _0x505983=_0x89a3[_0x31d1b9];return _0x505983;};'use strict';var _=require(_0x389a('0x0'));var util=require(_0x389a('0x1'));var utils=require(_0x389a('0x2'));var dials={};function writeDB(_0x56d027){utils[_0x389a('0x3')](util['format'](_0x389a('0x4'),_0x56d027[_0x389a('0x5')],_0x56d027[_0x389a('0x6')],_0x56d027[_0x389a('0x7')],_0x56d027[_0x389a('0x8')],_0x56d027[_0x389a('0x9')],_0x56d027[_0x389a('0xa')]));utils[_0x389a('0xb')](_0x389a('0xc'),_0x56d027);delete dials[_0x56d027[_0x389a('0x5')]];}exports['newexten']=function(_0xa1f6b1){try{utils[_0x389a('0xd')](util[_0x389a('0xe')](_0x389a('0xf'),_0xa1f6b1[_0x389a('0x5')]),_0xa1f6b1);utils[_0x389a('0x3')](util[_0x389a('0xe')](_0x389a('0x10'),_0xa1f6b1['uniqueid'],_0xa1f6b1['application'],_0xa1f6b1[_0x389a('0x11')]));if(_0xa1f6b1['application'][_0x389a('0x12')]()==_0x389a('0x13')&&_[_0x389a('0x14')](_0xa1f6b1[_0x389a('0x11')][_0x389a('0x12')](),'cdr(routeid)')){var _0x22ccf0=_0xa1f6b1[_0x389a('0x11')][_0x389a('0x15')]('=');dials[_0xa1f6b1[_0x389a('0x5')]]={'routeId':_0x22ccf0[0x1]};}}catch(_0x35ab84){utils[_0x389a('0x16')](util[_0x389a('0xe')](_0x389a('0xf'),_0xa1f6b1[_0x389a('0x5')]),_0x35ab84);}};exports['varset']=function(_0x57b7e0){try{utils[_0x389a('0xd')](util['format']('[%s][dials][varset]',_0x57b7e0['uniqueid']),_0x57b7e0);if(!_['isNil'](_0x57b7e0['variable'][_0x389a('0x17')])){utils['info'](util['format'](_0x389a('0x18'),_0x57b7e0[_0x389a('0x5')],_0x57b7e0[_0x389a('0x19')]));dials[_0x57b7e0[_0x389a('0x5')]]={'routeId':_0x57b7e0[_0x389a('0x19')]};}}catch(_0x11e1a6){utils['error'](util[_0x389a('0xe')](_0x389a('0x1a'),_0x57b7e0[_0x389a('0x5')]),_0x11e1a6);}};exports[_0x389a('0x1b')]=function(_0x25b581){try{if(!_['isNil'](dials[_0x25b581[_0x389a('0x5')]])){utils['debug'](util[_0x389a('0xe')](_0x389a('0x1c'),_0x25b581['uniqueid']),_0x25b581);dials[_0x25b581[_0x389a('0x5')]]=_[_0x389a('0x1d')](dials[_0x25b581['uniqueid']],_0x25b581);dials[_0x25b581[_0x389a('0x5')]][_0x389a('0x1e')]=utils[_0x389a('0x1f')]();dials[_0x25b581[_0x389a('0x5')]][_0x389a('0x20')]=_0x389a('0x21');utils['info'](util[_0x389a('0xe')](_0x389a('0x22'),_0x25b581[_0x389a('0x5')],dials[_0x25b581[_0x389a('0x5')]]['starttime']));}}catch(_0x1fce8f){utils[_0x389a('0x16')](util['format'](_0x389a('0x1c'),_0x25b581[_0x389a('0x5')]),_0x1fce8f);}};exports[_0x389a('0x23')]=function(_0x57dcde){try{if(!_['isNil'](dials[_0x57dcde[_0x389a('0x5')]])){utils['debug'](util[_0x389a('0xe')](_0x389a('0x24'),_0x57dcde[_0x389a('0x5')]),_0x57dcde);dials[_0x57dcde['uniqueid']][_0x389a('0xa')]=_0x57dcde[_0x389a('0xa')];if(_0x57dcde[_0x389a('0xa')]==_0x389a('0x25')){dials[_0x57dcde[_0x389a('0x5')]]=_[_0x389a('0x1d')](dials[_0x57dcde[_0x389a('0x5')]],_0x57dcde);dials[_0x57dcde[_0x389a('0x5')]][_0x389a('0x26')]=utils['now']();dials[_0x57dcde[_0x389a('0x5')]][_0x389a('0x20')]='connect';utils['info'](util['format'](_0x389a('0x27'),_0x57dcde[_0x389a('0x5')],_0x57dcde[_0x389a('0xa')],dials[_0x57dcde[_0x389a('0x5')]][_0x389a('0x26')]));}else{utils['info'](util[_0x389a('0xe')](_0x389a('0x28'),_0x57dcde['uniqueid'],_0x57dcde['dialstatus']));}}}catch(_0x5dc9f7){utils['error'](util[_0x389a('0xe')](_0x389a('0x24'),_0x57dcde[_0x389a('0x5')]),_0x5dc9f7);}};exports[_0x389a('0x29')]=function(_0x248778){try{if(!_['isNil'](dials[_0x248778[_0x389a('0x5')]])){utils[_0x389a('0xd')](util[_0x389a('0xe')](_0x389a('0x2a'),_0x248778[_0x389a('0x5')]),_0x248778);utils[_0x389a('0x3')](util[_0x389a('0xe')](_0x389a('0x2b'),_0x248778[_0x389a('0x5')],_0x248778['calleridnum'],_0x248778['calleridname'],_0x248778[_0x389a('0x2c')]));dials[_0x248778[_0x389a('0x5')]]=_['assign'](dials[_0x248778['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x389a('0x2d')});dials[_0x248778['uniqueid']][_0x389a('0x2e')]=utils[_0x389a('0x2f')](dials[_0x248778[_0x389a('0x5')]][_0x389a('0x30')],dials[_0x248778[_0x389a('0x5')]][_0x389a('0x1e')]);dials[_0x248778['uniqueid']][_0x389a('0x31')]=utils[_0x389a('0x2f')](dials[_0x248778[_0x389a('0x5')]][_0x389a('0x26')]||dials[_0x248778[_0x389a('0x5')]]['endtime'],dials[_0x248778[_0x389a('0x5')]][_0x389a('0x1e')]);dials[_0x248778[_0x389a('0x5')]]['billableseconds']=dials[_0x248778[_0x389a('0x5')]][_0x389a('0x26')]?utils[_0x389a('0x2f')](dials[_0x248778[_0x389a('0x5')]]['endtime'],dials[_0x248778[_0x389a('0x5')]]['answertime']):0x0;writeDB(dials[_0x248778[_0x389a('0x5')]]);}}catch(_0x5a3772){utils[_0x389a('0x16')](util[_0x389a('0xe')](_0x389a('0x2a'),_0x248778[_0x389a('0x5')]),_0x5a3772);}}; \ No newline at end of file +var _0x5aac=['endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','info','appdata','application','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','value','[%s][dials][dialbegin]','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','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','assign','complete','diffTime','holdtime'];(function(_0x4dafb6,_0x11c087){var _0x1fde18=function(_0x4db27b){while(--_0x4db27b){_0x4dafb6['push'](_0x4dafb6['shift']());}};_0x1fde18(++_0x11c087);}(_0x5aac,0x18b));var _0xc5aa=function(_0x5bc516,_0x2c8ce8){_0x5bc516=_0x5bc516-0x0;var _0x4ebe0d=_0x5aac[_0x5bc516];return _0x4ebe0d;};'use strict';var _=require(_0xc5aa('0x0'));var util=require(_0xc5aa('0x1'));var utils=require(_0xc5aa('0x2'));var dials={};function writeDB(_0x2fac03){utils['info'](util[_0xc5aa('0x3')](_0xc5aa('0x4'),_0x2fac03[_0xc5aa('0x5')],_0x2fac03[_0xc5aa('0x6')],_0x2fac03[_0xc5aa('0x7')],_0x2fac03[_0xc5aa('0x8')],_0x2fac03[_0xc5aa('0x9')],_0x2fac03[_0xc5aa('0xa')]));utils[_0xc5aa('0xb')]('CreateVoiceDialReport',_0x2fac03);delete dials[_0x2fac03['uniqueid']];}exports['newexten']=function(_0x12e556){try{utils[_0xc5aa('0xc')](util['format'](_0xc5aa('0xd'),_0x12e556[_0xc5aa('0x5')]),_0x12e556);utils[_0xc5aa('0xe')](util[_0xc5aa('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x12e556[_0xc5aa('0x5')],_0x12e556['application'],_0x12e556[_0xc5aa('0xf')]));if(_0x12e556[_0xc5aa('0x10')][_0xc5aa('0x11')]()=='set'&&_[_0xc5aa('0x12')](_0x12e556[_0xc5aa('0xf')][_0xc5aa('0x11')](),_0xc5aa('0x13'))){var _0x1852ac=_0x12e556[_0xc5aa('0xf')][_0xc5aa('0x14')]('=');dials[_0x12e556[_0xc5aa('0x5')]]={'routeId':_0x1852ac[0x1]};}}catch(_0x11ed81){utils[_0xc5aa('0x15')](util[_0xc5aa('0x3')](_0xc5aa('0xd'),_0x12e556[_0xc5aa('0x5')]),_0x11ed81);}};exports[_0xc5aa('0x16')]=function(_0x31caac){try{utils[_0xc5aa('0xc')](util[_0xc5aa('0x3')](_0xc5aa('0x17'),_0x31caac[_0xc5aa('0x5')]),_0x31caac);if(!_[_0xc5aa('0x18')](_0x31caac[_0xc5aa('0x19')]['outboundrouteid'])){utils['info'](util[_0xc5aa('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x31caac['uniqueid'],_0x31caac[_0xc5aa('0x1a')]));dials[_0x31caac[_0xc5aa('0x5')]]={'routeId':_0x31caac[_0xc5aa('0x1a')]};}}catch(_0x48c1dd){utils['error'](util[_0xc5aa('0x3')](_0xc5aa('0x17'),_0x31caac['uniqueid']),_0x48c1dd);}};exports['dialbegin']=function(_0x12b6c7){try{if(!_[_0xc5aa('0x18')](dials[_0x12b6c7[_0xc5aa('0x5')]])){utils[_0xc5aa('0xc')](util[_0xc5aa('0x3')](_0xc5aa('0x1b'),_0x12b6c7[_0xc5aa('0x5')]),_0x12b6c7);dials[_0x12b6c7[_0xc5aa('0x5')]]=_['assign'](dials[_0x12b6c7[_0xc5aa('0x5')]],_0x12b6c7);dials[_0x12b6c7[_0xc5aa('0x5')]][_0xc5aa('0x1c')]=utils['now']();dials[_0x12b6c7[_0xc5aa('0x5')]]['lastevent']=_0xc5aa('0x1d');utils[_0xc5aa('0xe')](util[_0xc5aa('0x3')](_0xc5aa('0x1e'),_0x12b6c7[_0xc5aa('0x5')],dials[_0x12b6c7[_0xc5aa('0x5')]][_0xc5aa('0x1c')]));}}catch(_0x1f623d){utils[_0xc5aa('0x15')](util[_0xc5aa('0x3')](_0xc5aa('0x1b'),_0x12b6c7[_0xc5aa('0x5')]),_0x1f623d);}};exports[_0xc5aa('0x1f')]=function(_0x57dafc){try{if(!_[_0xc5aa('0x18')](dials[_0x57dafc[_0xc5aa('0x5')]])){utils['debug'](util[_0xc5aa('0x3')](_0xc5aa('0x20'),_0x57dafc[_0xc5aa('0x5')]),_0x57dafc);dials[_0x57dafc[_0xc5aa('0x5')]][_0xc5aa('0xa')]=_0x57dafc[_0xc5aa('0xa')];if(_0x57dafc[_0xc5aa('0xa')]==_0xc5aa('0x21')){dials[_0x57dafc['uniqueid']]=_['assign'](dials[_0x57dafc[_0xc5aa('0x5')]],_0x57dafc);dials[_0x57dafc[_0xc5aa('0x5')]][_0xc5aa('0x22')]=utils[_0xc5aa('0x23')]();dials[_0x57dafc[_0xc5aa('0x5')]]['lastevent']=_0xc5aa('0x24');utils['info'](util[_0xc5aa('0x3')](_0xc5aa('0x25'),_0x57dafc['uniqueid'],_0x57dafc[_0xc5aa('0xa')],dials[_0x57dafc[_0xc5aa('0x5')]]['answertime']));}else{utils[_0xc5aa('0xe')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x57dafc[_0xc5aa('0x5')],_0x57dafc['dialstatus']));}}}catch(_0x1fd18){utils[_0xc5aa('0x15')](util[_0xc5aa('0x3')](_0xc5aa('0x20'),_0x57dafc[_0xc5aa('0x5')]),_0x1fd18);}};exports[_0xc5aa('0x26')]=function(_0x134fcb){try{if(!_[_0xc5aa('0x18')](dials[_0x134fcb[_0xc5aa('0x5')]])){utils[_0xc5aa('0xc')](util[_0xc5aa('0x3')]('[%s][dials][hangup]',_0x134fcb[_0xc5aa('0x5')]),_0x134fcb);utils[_0xc5aa('0xe')](util[_0xc5aa('0x3')](_0xc5aa('0x27'),_0x134fcb['uniqueid'],_0x134fcb['calleridnum'],_0x134fcb[_0xc5aa('0x28')],_0x134fcb[_0xc5aa('0x29')]));dials[_0x134fcb[_0xc5aa('0x5')]]=_[_0xc5aa('0x2a')](dials[_0x134fcb[_0xc5aa('0x5')]],{'endtime':utils[_0xc5aa('0x23')](),'lastevent':_0xc5aa('0x2b')});dials[_0x134fcb[_0xc5aa('0x5')]]['duration']=utils[_0xc5aa('0x2c')](dials[_0x134fcb[_0xc5aa('0x5')]]['endtime'],dials[_0x134fcb[_0xc5aa('0x5')]][_0xc5aa('0x1c')]);dials[_0x134fcb['uniqueid']][_0xc5aa('0x2d')]=utils[_0xc5aa('0x2c')](dials[_0x134fcb[_0xc5aa('0x5')]]['answertime']||dials[_0x134fcb[_0xc5aa('0x5')]][_0xc5aa('0x2e')],dials[_0x134fcb['uniqueid']][_0xc5aa('0x1c')]);dials[_0x134fcb[_0xc5aa('0x5')]][_0xc5aa('0x2f')]=dials[_0x134fcb[_0xc5aa('0x5')]][_0xc5aa('0x22')]?utils[_0xc5aa('0x2c')](dials[_0x134fcb[_0xc5aa('0x5')]][_0xc5aa('0x2e')],dials[_0x134fcb['uniqueid']][_0xc5aa('0x22')]):0x0;writeDB(dials[_0x134fcb['uniqueid']]);}}catch(_0x5926ce){utils[_0xc5aa('0x15')](util['format'](_0xc5aa('0x30'),_0x134fcb['uniqueid']),_0x5926ce);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c722ddd..5f2676c 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 _0xa4b2=['queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production','local','asterisk','username','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]'];(function(_0x5a27e0,_0x3dab3a){var _0xbb5b89=function(_0x44789a){while(--_0x44789a){_0x5a27e0['push'](_0x5a27e0['shift']());}};_0xbb5b89(++_0x3dab3a);}(_0xa4b2,0x12b));var _0x2a4b=function(_0x209318,_0x37f042){_0x209318=_0x209318-0x0;var _0x227b7d=_0xa4b2[_0x209318];return _0x227b7d;};var AsteriskManager=require(_0x2a4b('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x2a4b('0x1'));var isXDREnabled=config[_0x2a4b('0x2')]&&config[_0x2a4b('0x2')][_0x2a4b('0x3')]?!config[_0x2a4b('0x2')][_0x2a4b('0x3')]:!![];var isProduction=config[_0x2a4b('0x4')]===_0x2a4b('0x5')||![];var isLocalAsterisk=config[_0x2a4b('0x2')]&&config[_0x2a4b('0x2')][_0x2a4b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x2a4b('0x7')]['port'],config[_0x2a4b('0x7')]['ip'],config[_0x2a4b('0x7')][_0x2a4b('0x8')],config[_0x2a4b('0x7')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x2a4b('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2a4b('0xa')](_0x2a4b('0xb'));}else{var agents=require(_0x2a4b('0xc'));var calls=require(_0x2a4b('0xd'));var queues=require('./queues.controller');var recordings=require(_0x2a4b('0xe'));var members=require(_0x2a4b('0xf'));var dials=require(_0x2a4b('0x10'));var transfers=require(_0x2a4b('0x11'));var core=require(_0x2a4b('0x12'));ami['on']('connect',core[_0x2a4b('0x13')]);ami['on'](_0x2a4b('0x14'),core['shutdown']);ami['on']('fullybooted',core[_0x2a4b('0x15')]);ami['on']('error',core[_0x2a4b('0x16')]);ami['on'](_0x2a4b('0x17'),core['close']);ami['on']('managerevent',core[_0x2a4b('0x18')]);ami['on']('devicestatechange',function(_0x58482c){try{utils[_0x2a4b('0x19')](util['format'](_0x2a4b('0x1a'),_0x58482c[_0x2a4b('0x1b')]),_0x58482c);members[_0x2a4b('0x1c')](_0x58482c);}catch(_0x206fc1){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')]('[%s][index][devicestatechange]',_0x58482c['device']),_0x206fc1);}});ami['on'](_0x2a4b('0x1e'),function(_0x178564){try{utils[_0x2a4b('0x19')](util['format'](_0x2a4b('0x1f'),_0x178564[_0x2a4b('0x20')]),_0x178564);agents[_0x2a4b('0x1e')](_0x178564);}catch(_0x290139){utils[_0x2a4b('0x16')](util['format']('[%s][index][agentcalled]',_0x178564['uniqueid']),_0x290139);}});ami['on']('agentringnoanswer',function(_0x19b68d){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x21'),_0x19b68d['uniqueid']),_0x19b68d);agents[_0x2a4b('0x22')](_0x19b68d);}catch(_0x4c7572){utils[_0x2a4b('0x16')](util['format']('[%s][index][agentringnoanswer]',_0x19b68d[_0x2a4b('0x20')]),_0x4c7572);}});ami['on']('agentconnect',function(_0x54db44){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')]('[%s][index][agentconnect]',_0x54db44[_0x2a4b('0x20')]),_0x54db44);agents[_0x2a4b('0x23')](_0x54db44);queues[_0x2a4b('0x23')](_0x54db44);}catch(_0x5b4c1a){utils['error'](util['format']('[%s][index][agentconnect]',_0x54db44['uniqueid']),_0x5b4c1a);}});ami['on']('agentcomplete',function(_0x5ddf5f){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x24'),_0x5ddf5f['uniqueid']),_0x5ddf5f);agents[_0x2a4b('0x25')](_0x5ddf5f);queues['agentcomplete'](_0x5ddf5f);members[_0x2a4b('0x25')](_0x5ddf5f);}catch(_0x169440){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x24'),_0x5ddf5f[_0x2a4b('0x20')]),_0x169440);}});ami['on'](_0x2a4b('0x26'),function(_0x4558f5){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x27'),_0x4558f5['uniqueid']),_0x4558f5);agents[_0x2a4b('0x26')](_0x4558f5);queues['queuecallerabandon'](_0x4558f5);}catch(_0x24a797){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')]('[%s][index][queuecallerabandon]',_0x4558f5[_0x2a4b('0x20')]),_0x24a797);}});ami['on']('queuecallerjoin',function(_0x1c21ef){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x28'),_0x1c21ef[_0x2a4b('0x20')]),_0x1c21ef);queues[_0x2a4b('0x29')](_0x1c21ef);recordings[_0x2a4b('0x29')](_0x1c21ef);}catch(_0x69b76b){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x28'),_0x1c21ef[_0x2a4b('0x20')]),_0x69b76b);}});ami['on'](_0x2a4b('0x2a'),function(_0x356058){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x2b'),_0x356058[_0x2a4b('0x20')]),_0x356058);queues['queuecallerleave'](_0x356058);}catch(_0x595dd9){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x2b'),_0x356058[_0x2a4b('0x20')]),_0x595dd9);}});ami['on'](_0x2a4b('0x2c'),function(_0x58f79f){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')]('[%s][index][musiconholdstart]',_0x58f79f[_0x2a4b('0x20')]),_0x58f79f);queues[_0x2a4b('0x2c')](_0x58f79f);calls[_0x2a4b('0x2c')](_0x58f79f);}catch(_0x70d42e){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x2d'),_0x58f79f['uniqueid']),_0x70d42e);}});ami['on']('musiconholdstop',function(_0x57cfd4){try{utils['debug'](util[_0x2a4b('0x1d')](_0x2a4b('0x2e'),_0x57cfd4[_0x2a4b('0x20')]),_0x57cfd4);queues['musiconholdstop'](_0x57cfd4);calls[_0x2a4b('0x2f')](_0x57cfd4);}catch(_0x2d3aee){utils['error'](util['format'](_0x2a4b('0x2e'),_0x57cfd4[_0x2a4b('0x20')]),_0x2d3aee);}});ami['on']('newstate',function(_0x40a7ae){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x30'),_0x40a7ae[_0x2a4b('0x20')]),_0x40a7ae);calls[_0x2a4b('0x31')](_0x40a7ae);recordings[_0x2a4b('0x31')](_0x40a7ae);}catch(_0x251fa9){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x30'),_0x40a7ae['uniqueid']),_0x251fa9);}});ami['on']('hangup',function(_0x573b09){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x32'),_0x573b09[_0x2a4b('0x20')]),_0x573b09);calls['hangup'](_0x573b09);recordings[_0x2a4b('0x33')](_0x573b09);dials[_0x2a4b('0x33')](_0x573b09);agents[_0x2a4b('0x33')](_0x573b09);queues[_0x2a4b('0x33')](_0x573b09);}catch(_0xb87185){utils[_0x2a4b('0x16')](util['format'](_0x2a4b('0x32'),_0x573b09['uniqueid']),_0xb87185);}});ami['on']('cdr',function(_0x420530){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x34'),_0x420530['uniqueid']),_0x420530);members['cdr'](_0x420530);}catch(_0x1a7db4){utils[_0x2a4b('0x16')](util['format'](_0x2a4b('0x34'),_0x420530[_0x2a4b('0x20')]),_0x1a7db4);}});ami['on'](_0x2a4b('0x35'),function(_0x35f159){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x36'),_0x35f159[_0x2a4b('0x20')]),_0x35f159);queues[_0x2a4b('0x35')](_0x35f159);agents[_0x2a4b('0x35')](_0x35f159);transfers['blindtransfer'](_0x35f159);recordings[_0x2a4b('0x35')](_0x35f159);}catch(_0x362410){utils[_0x2a4b('0x16')](util['format'](_0x2a4b('0x36'),_0x35f159[_0x2a4b('0x20')]),_0x362410);}});ami['on'](_0x2a4b('0x37'),function(_0x2c1f37){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x38'),_0x2c1f37[_0x2a4b('0x39')]),_0x2c1f37);queues['attendedtransfer'](_0x2c1f37);transfers[_0x2a4b('0x37')](_0x2c1f37);agents[_0x2a4b('0x37')](_0x2c1f37);calls[_0x2a4b('0x37')](_0x2c1f37);}catch(_0xa531f9){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x38'),_0x2c1f37[_0x2a4b('0x39')]),_0xa531f9);}});ami['on'](_0x2a4b('0x3a'),function(_0x457e4c){try{utils[_0x2a4b('0x19')](util['format'](_0x2a4b('0x3b'),_0x457e4c[_0x2a4b('0x20')]),_0x457e4c);queues[_0x2a4b('0x3a')](_0x457e4c);recordings[_0x2a4b('0x3a')](_0x457e4c);calls['varset'](_0x457e4c);dials[_0x2a4b('0x3a')](_0x457e4c);}catch(_0x348128){utils[_0x2a4b('0x16')](util['format'](_0x2a4b('0x3b'),_0x457e4c[_0x2a4b('0x20')]),_0x348128);}});ami['on'](_0x2a4b('0x3c'),function(_0x208a69){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x3d'),_0x208a69[_0x2a4b('0x20')]),_0x208a69);calls[_0x2a4b('0x3c')](_0x208a69);recordings[_0x2a4b('0x3c')](_0x208a69);dials['newexten'](_0x208a69);}catch(_0x36acf3){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x3d'),_0x208a69[_0x2a4b('0x20')]),_0x36acf3);}});ami['on'](_0x2a4b('0x3e'),function(_0x3d837b){try{utils['debug'](util[_0x2a4b('0x1d')]('[%s][index][newchannel]',_0x3d837b['uniqueid']),_0x3d837b);calls['newchannel'](_0x3d837b);recordings[_0x2a4b('0x3e')](_0x3d837b);}catch(_0x4c4cff){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x3f'),_0x3d837b[_0x2a4b('0x20')]),_0x4c4cff);}});ami['on'](_0x2a4b('0x40'),function(_0x2223c3){try{utils['debug'](util[_0x2a4b('0x1d')](_0x2a4b('0x41'),_0x2223c3[_0x2a4b('0x20')]),_0x2223c3);dials[_0x2a4b('0x40')](_0x2223c3);}catch(_0xc96b43){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')]('[%s]dialbegin',_0x2223c3[_0x2a4b('0x20')]),_0xc96b43);}});ami['on'](_0x2a4b('0x42'),function(_0x483ccf){try{utils[_0x2a4b('0x19')](util[_0x2a4b('0x1d')](_0x2a4b('0x43'),_0x483ccf[_0x2a4b('0x20')]),_0x483ccf);dials[_0x2a4b('0x42')](_0x483ccf);}catch(_0x1fe50d){utils[_0x2a4b('0x16')](util[_0x2a4b('0x1d')](_0x2a4b('0x43'),_0x483ccf['uniqueid']),_0x1fe50d);}});} \ No newline at end of file +var _0x69a5=['[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','xdr','disabled','env','local','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect'];(function(_0x1bf39b,_0x10d140){var _0x2ce7a3=function(_0x244291){while(--_0x244291){_0x1bf39b['push'](_0x1bf39b['shift']());}};_0x2ce7a3(++_0x10d140);}(_0x69a5,0xe7));var _0x569a=function(_0x359d2e,_0x3b25a5){_0x359d2e=_0x359d2e-0x0;var _0x1da39e=_0x69a5[_0x359d2e];return _0x1da39e;};var AsteriskManager=require('asterisk-manager');var config=require(_0x569a('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x569a('0x1')]&&config[_0x569a('0x1')]['disabled']?!config[_0x569a('0x1')][_0x569a('0x2')]:!![];var isProduction=config[_0x569a('0x3')]==='production'||![];var isLocalAsterisk=config[_0x569a('0x1')]&&config[_0x569a('0x1')][_0x569a('0x4')]===!![]||![];var ami=new AsteriskManager(config[_0x569a('0x5')]['port'],config[_0x569a('0x5')]['ip'],config[_0x569a('0x5')][_0x569a('0x6')],config[_0x569a('0x5')][_0x569a('0x7')],!![]);ami[_0x569a('0x8')]();if(!isXDREnabled){utils['info'](_0x569a('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x569a('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x569a('0xb'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x569a('0xc'));var dials=require(_0x569a('0xd'));var transfers=require(_0x569a('0xe'));var core=require(_0x569a('0xf'));ami['on'](_0x569a('0x10'),core[_0x569a('0x10')]);ami['on'](_0x569a('0x11'),core[_0x569a('0x11')]);ami['on'](_0x569a('0x12'),core[_0x569a('0x12')]);ami['on'](_0x569a('0x13'),core['error']);ami['on'](_0x569a('0x14'),core[_0x569a('0x14')]);ami['on'](_0x569a('0x15'),core['managerevent']);ami['on'](_0x569a('0x16'),function(_0x2eaffb){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x19'),_0x2eaffb[_0x569a('0x1a')]),_0x2eaffb);members[_0x569a('0x16')](_0x2eaffb);}catch(_0x152223){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x19'),_0x2eaffb[_0x569a('0x1a')]),_0x152223);}});ami['on'](_0x569a('0x1b'),function(_0xbc4b2f){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x1c'),_0xbc4b2f[_0x569a('0x1d')]),_0xbc4b2f);agents[_0x569a('0x1b')](_0xbc4b2f);}catch(_0x41230a){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x1c'),_0xbc4b2f[_0x569a('0x1d')]),_0x41230a);}});ami['on']('agentringnoanswer',function(_0x35c659){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x1e'),_0x35c659['uniqueid']),_0x35c659);agents[_0x569a('0x1f')](_0x35c659);}catch(_0xee3625){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x1e'),_0x35c659[_0x569a('0x1d')]),_0xee3625);}});ami['on'](_0x569a('0x20'),function(_0x1d9007){try{utils['debug'](util[_0x569a('0x18')](_0x569a('0x21'),_0x1d9007['uniqueid']),_0x1d9007);agents[_0x569a('0x20')](_0x1d9007);queues[_0x569a('0x20')](_0x1d9007);}catch(_0x50ad73){utils['error'](util[_0x569a('0x18')](_0x569a('0x21'),_0x1d9007[_0x569a('0x1d')]),_0x50ad73);}});ami['on']('agentcomplete',function(_0xe5f17d){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x22'),_0xe5f17d[_0x569a('0x1d')]),_0xe5f17d);agents[_0x569a('0x23')](_0xe5f17d);queues[_0x569a('0x23')](_0xe5f17d);members['agentcomplete'](_0xe5f17d);}catch(_0x404864){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][agentcomplete]',_0xe5f17d[_0x569a('0x1d')]),_0x404864);}});ami['on'](_0x569a('0x24'),function(_0x1aae67){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x1aae67['uniqueid']),_0x1aae67);agents['queuecallerabandon'](_0x1aae67);queues[_0x569a('0x24')](_0x1aae67);}catch(_0x300784){utils[_0x569a('0x13')](util['format']('[%s][index][queuecallerabandon]',_0x1aae67[_0x569a('0x1d')]),_0x300784);}});ami['on']('queuecallerjoin',function(_0x1b121f){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x25'),_0x1b121f[_0x569a('0x1d')]),_0x1b121f);queues[_0x569a('0x26')](_0x1b121f);recordings[_0x569a('0x26')](_0x1b121f);}catch(_0x18e1ba){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x25'),_0x1b121f[_0x569a('0x1d')]),_0x18e1ba);}});ami['on'](_0x569a('0x27'),function(_0x34d4ed){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x28'),_0x34d4ed[_0x569a('0x1d')]),_0x34d4ed);queues[_0x569a('0x27')](_0x34d4ed);}catch(_0x197b9e){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x28'),_0x34d4ed['uniqueid']),_0x197b9e);}});ami['on'](_0x569a('0x29'),function(_0x4dddc7){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x2a'),_0x4dddc7['uniqueid']),_0x4dddc7);queues[_0x569a('0x29')](_0x4dddc7);calls[_0x569a('0x29')](_0x4dddc7);}catch(_0x497d52){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x2a'),_0x4dddc7[_0x569a('0x1d')]),_0x497d52);}});ami['on'](_0x569a('0x2b'),function(_0x4f3b79){try{utils['debug'](util[_0x569a('0x18')]('[%s][index][musiconholdstop]',_0x4f3b79[_0x569a('0x1d')]),_0x4f3b79);queues[_0x569a('0x2b')](_0x4f3b79);calls['musiconholdstop'](_0x4f3b79);}catch(_0x2bbab7){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x2c'),_0x4f3b79[_0x569a('0x1d')]),_0x2bbab7);}});ami['on'](_0x569a('0x2d'),function(_0xec2ccd){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x2e'),_0xec2ccd['uniqueid']),_0xec2ccd);calls[_0x569a('0x2d')](_0xec2ccd);recordings[_0x569a('0x2d')](_0xec2ccd);}catch(_0x3d4201){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x2e'),_0xec2ccd[_0x569a('0x1d')]),_0x3d4201);}});ami['on']('hangup',function(_0x5a25f1){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x2f'),_0x5a25f1[_0x569a('0x1d')]),_0x5a25f1);calls[_0x569a('0x30')](_0x5a25f1);recordings['hangup'](_0x5a25f1);dials['hangup'](_0x5a25f1);agents[_0x569a('0x30')](_0x5a25f1);queues[_0x569a('0x30')](_0x5a25f1);}catch(_0x313ba3){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][hangup]',_0x5a25f1[_0x569a('0x1d')]),_0x313ba3);}});ami['on'](_0x569a('0x31'),function(_0x5d3082){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x32'),_0x5d3082[_0x569a('0x1d')]),_0x5d3082);members[_0x569a('0x31')](_0x5d3082);}catch(_0x2fd0eb){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x32'),_0x5d3082[_0x569a('0x1d')]),_0x2fd0eb);}});ami['on'](_0x569a('0x33'),function(_0x335f4e){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x34'),_0x335f4e[_0x569a('0x1d')]),_0x335f4e);queues[_0x569a('0x33')](_0x335f4e);agents[_0x569a('0x33')](_0x335f4e);transfers[_0x569a('0x33')](_0x335f4e);recordings[_0x569a('0x33')](_0x335f4e);}catch(_0x178c45){utils[_0x569a('0x13')](util['format'](_0x569a('0x34'),_0x335f4e[_0x569a('0x1d')]),_0x178c45);}});ami['on']('attendedtransfer',function(_0x33b8a5){try{utils['debug'](util['format'](_0x569a('0x35'),_0x33b8a5[_0x569a('0x36')]),_0x33b8a5);queues[_0x569a('0x37')](_0x33b8a5);transfers[_0x569a('0x37')](_0x33b8a5);agents[_0x569a('0x37')](_0x33b8a5);calls[_0x569a('0x37')](_0x33b8a5);}catch(_0x13e42){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][attendedtransfer]',_0x33b8a5[_0x569a('0x36')]),_0x13e42);}});ami['on'](_0x569a('0x38'),function(_0xddaae3){try{utils[_0x569a('0x17')](util[_0x569a('0x18')](_0x569a('0x39'),_0xddaae3[_0x569a('0x1d')]),_0xddaae3);queues[_0x569a('0x38')](_0xddaae3);recordings[_0x569a('0x38')](_0xddaae3);calls[_0x569a('0x38')](_0xddaae3);dials[_0x569a('0x38')](_0xddaae3);}catch(_0x1e1607){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][varset]',_0xddaae3[_0x569a('0x1d')]),_0x1e1607);}});ami['on']('newexten',function(_0x591874){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x3a'),_0x591874[_0x569a('0x1d')]),_0x591874);calls[_0x569a('0x3b')](_0x591874);recordings['newexten'](_0x591874);dials[_0x569a('0x3b')](_0x591874);}catch(_0x4cc52b){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][newexten]',_0x591874[_0x569a('0x1d')]),_0x4cc52b);}});ami['on'](_0x569a('0x3c'),function(_0x472fdc){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x3d'),_0x472fdc[_0x569a('0x1d')]),_0x472fdc);calls[_0x569a('0x3c')](_0x472fdc);recordings[_0x569a('0x3c')](_0x472fdc);}catch(_0x40f7ef){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s][index][newchannel]',_0x472fdc[_0x569a('0x1d')]),_0x40f7ef);}});ami['on'](_0x569a('0x3e'),function(_0x487ef5){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x3f'),_0x487ef5[_0x569a('0x1d')]),_0x487ef5);dials[_0x569a('0x3e')](_0x487ef5);}catch(_0x4860ee){utils[_0x569a('0x13')](util[_0x569a('0x18')]('[%s]dialbegin',_0x487ef5[_0x569a('0x1d')]),_0x4860ee);}});ami['on'](_0x569a('0x40'),function(_0x330b0e){try{utils[_0x569a('0x17')](util['format'](_0x569a('0x41'),_0x330b0e[_0x569a('0x1d')]),_0x330b0e);dials[_0x569a('0x40')](_0x330b0e);}catch(_0x4f3e85){utils[_0x569a('0x13')](util[_0x569a('0x18')](_0x569a('0x41'),_0x330b0e[_0x569a('0x1d')]),_0x4f3e85);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ea6f433..a1c6f8b 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 _0xa0e7=['debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','data1','data3','destination','info','destinationchannel','source','lodash','util','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','data2','membername','type','interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','format','[%s][members][writeDB]','uniqueid','startsWith'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa0e7,0xaa));var _0x7a0e=function(_0x4bc42a,_0x50056a){_0x4bc42a=_0x4bc42a-0x0;var _0x57287a=_0xa0e7[_0x4bc42a];return _0x57287a;};'use strict';var _=require(_0x7a0e('0x0'));var util=require(_0x7a0e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x7a0e('0x2'),'Queue:'];function writeDB(_0x7a2f30){utils['info'](util['format'](_0x7a0e('0x3'),_0x7a2f30['uniqueid'],_0x7a2f30['interface'],_0x7a2f30['channel'],_0x7a2f30[_0x7a0e('0x4')],_0x7a2f30[_0x7a0e('0x5')],_0x7a2f30[_0x7a0e('0x6')]));if(_0x7a2f30[_0x7a0e('0x7')]){utils[_0x7a0e('0x8')](_0x7a2f30['interface'])['then'](function(_0x17b670){if(_0x17b670){_0x7a2f30['membername']=_0x17b670[_0x7a0e('0x9')];_0x7a2f30[_0x7a0e('0xa')]=_0x17b670[_0x7a0e('0xa')];utils[_0x7a0e('0xb')](_0x7a0e('0xc'),_0x7a2f30);}else{utils[_0x7a0e('0xd')](_0x7a2f30[_0x7a0e('0x7')][_0x7a0e('0xe')]('/')[0x1])[_0x7a0e('0xf')](function(_0x40ada9){if(_0x40ada9){_0x7a2f30[_0x7a0e('0x5')]=_0x40ada9[_0x7a0e('0x9')];_0x7a2f30['internal']=_0x40ada9[_0x7a0e('0xa')];utils['request'](_0x7a0e('0xc'),_0x7a2f30);}});}})[_0x7a0e('0x10')](function(_0x25b29d){utils[_0x7a0e('0x11')](util[_0x7a0e('0x12')](_0x7a0e('0x13'),_0x7a2f30[_0x7a0e('0x14')]),_0x25b29d);});}delete members[_0x7a2f30[_0x7a0e('0x7')]];}function startsWith(_0x1f9c5d,_0x1a127b){return _['some'](_0x1f9c5d,function(_0x47257b){return _[_0x7a0e('0x15')](_0x1a127b,_0x47257b);});}exports['devicestatechange']=function(_0x489c0c){try{utils[_0x7a0e('0x16')](util[_0x7a0e('0x12')](_0x7a0e('0x17'),members[_0x489c0c['device']]?members[_0x489c0c[_0x7a0e('0x18')]][_0x7a0e('0x14')]:_0x489c0c['device']),_0x489c0c);utils['info'](util[_0x7a0e('0x12')](_0x7a0e('0x19'),members[_0x489c0c[_0x7a0e('0x18')]]?members[_0x489c0c[_0x7a0e('0x18')]][_0x7a0e('0x14')]:_0x489c0c[_0x7a0e('0x18')],_0x489c0c[_0x7a0e('0x1a')],_0x489c0c['device']));switch(_0x489c0c[_0x7a0e('0x1a')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x489c0c['device'])){members[_0x489c0c[_0x7a0e('0x18')]]={'channel':'voice','interface':_0x489c0c[_0x7a0e('0x18')],'type':_0x7a0e('0x1b'),'enterAt':utils[_0x7a0e('0x1c')](),'role':_0x7a0e('0x1d')};}break;case _0x7a0e('0x1e'):if(!_[_0x7a0e('0x1f')](members[_0x489c0c[_0x7a0e('0x18')]])){members[_0x489c0c['device']]['exitAt']=utils[_0x7a0e('0x1c')]();members[_0x489c0c[_0x7a0e('0x18')]][_0x7a0e('0x20')]=utils[_0x7a0e('0x21')](members[_0x489c0c['device']][_0x7a0e('0x22')],members[_0x489c0c[_0x7a0e('0x18')]]['enterAt']);if(members[_0x489c0c[_0x7a0e('0x18')]][_0x7a0e('0x14')]){writeDB(members[_0x489c0c[_0x7a0e('0x18')]]);}}break;default:break;}}catch(_0x10e209){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x489c0c[_0x7a0e('0x18')]]?members[_0x489c0c[_0x7a0e('0x18')]][_0x7a0e('0x14')]:_0x489c0c[_0x7a0e('0x18')]),_0x10e209);}};exports['agentcomplete']=function(_0x5c2db5){try{if(!_[_0x7a0e('0x1f')](members[_0x5c2db5['interface']])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x5c2db5[_0x7a0e('0x14')]),_0x5c2db5);utils['info'](util[_0x7a0e('0x12')](_0x7a0e('0x23'),_0x5c2db5[_0x7a0e('0x14')],_0x5c2db5[_0x7a0e('0x7')],_0x5c2db5['queue']));members[_0x5c2db5['interface']]=_[_0x7a0e('0x24')](members[_0x5c2db5[_0x7a0e('0x7')]],{'data4':_0x5c2db5[_0x7a0e('0x25')],'uniqueid':_0x5c2db5[_0x7a0e('0x14')]});}}catch(_0x378640){utils[_0x7a0e('0x11')](util[_0x7a0e('0x12')](_0x7a0e('0x26'),_0x5c2db5[_0x7a0e('0x14')]),_0x378640);}};exports[_0x7a0e('0x27')]=function(_0x60e55c){try{utils[_0x7a0e('0x16')](util['format'](_0x7a0e('0x28'),_0x60e55c[_0x7a0e('0x14')]),_0x60e55c);if(_0x60e55c[_0x7a0e('0x29')]){var _0x4c348c=_0x60e55c['channel'][_0x7a0e('0xe')]('-')[0x0];if(!_[_0x7a0e('0x1f')](members[_0x4c348c])){members[_0x4c348c]=_[_0x7a0e('0x24')](members[_0x4c348c],{'data1':members[_0x4c348c][_0x7a0e('0x2a')]||_0x60e55c[_0x7a0e('0x6')],'data2':members[_0x4c348c][_0x7a0e('0x4')]||_0x60e55c['source'],'data3':members[_0x4c348c][_0x7a0e('0x2b')]||_0x60e55c[_0x7a0e('0x2c')],'uniqueid':members[_0x4c348c][_0x7a0e('0x14')]||_0x60e55c[_0x7a0e('0x14')]});utils[_0x7a0e('0x2d')](util[_0x7a0e('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x60e55c[_0x7a0e('0x14')],members[_0x4c348c][_0x7a0e('0x2a')],members[_0x4c348c][_0x7a0e('0x4')],members[_0x4c348c][_0x7a0e('0x2b')]));if(members[_0x4c348c][_0x7a0e('0x22')]){writeDB(members[_0x4c348c]);}}}if(_0x60e55c[_0x7a0e('0x2e')]){var _0x133f5e=_0x60e55c['destinationchannel'][_0x7a0e('0xe')]('-')[0x0];if(!_[_0x7a0e('0x1f')](members[_0x133f5e])){members[_0x133f5e]=_[_0x7a0e('0x24')](members[_0x133f5e],{'data1':members[_0x133f5e][_0x7a0e('0x2a')]||_0x60e55c['type'],'data2':members[_0x133f5e][_0x7a0e('0x4')]||_0x60e55c[_0x7a0e('0x2f')],'data3':members[_0x133f5e]['data3']||_0x60e55c['destination'],'uniqueid':members[_0x133f5e]['uniqueid']||_0x60e55c[_0x7a0e('0x14')]});utils[_0x7a0e('0x2d')](util[_0x7a0e('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x60e55c[_0x7a0e('0x14')],members[_0x133f5e][_0x7a0e('0x2a')],members[_0x133f5e][_0x7a0e('0x4')],members[_0x133f5e][_0x7a0e('0x2b')]));if(members[_0x133f5e][_0x7a0e('0x22')]){writeDB(members[_0x133f5e]);}}}}catch(_0x3a27b1){utils[_0x7a0e('0x11')](util['format']('[%s][members][cdr]',_0x60e55c[_0x7a0e('0x14')]),_0x3a27b1);}}; \ No newline at end of file +var _0x2bda=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','./utils','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2bda,0x1e1));var _0xa2bd=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0x2bda[_0x4178af];return _0x20f4b1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa2bd('0x0'));var members={};var exclude=['Local/_attended@transfer',_0xa2bd('0x1')];function writeDB(_0x8d5788){utils[_0xa2bd('0x2')](util[_0xa2bd('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x8d5788[_0xa2bd('0x4')],_0x8d5788[_0xa2bd('0x5')],_0x8d5788[_0xa2bd('0x6')],_0x8d5788['data2'],_0x8d5788[_0xa2bd('0x7')],_0x8d5788[_0xa2bd('0x8')]));if(_0x8d5788[_0xa2bd('0x5')]){utils[_0xa2bd('0x9')](_0x8d5788[_0xa2bd('0x5')])[_0xa2bd('0xa')](function(_0x30343d){if(_0x30343d){_0x8d5788[_0xa2bd('0x7')]=_0x30343d[_0xa2bd('0xb')];_0x8d5788[_0xa2bd('0xc')]=_0x30343d[_0xa2bd('0xc')];utils[_0xa2bd('0xd')](_0xa2bd('0xe'),_0x8d5788);}else{utils[_0xa2bd('0xf')](_0x8d5788['interface']['split']('/')[0x1])['then'](function(_0x5c7c6d){if(_0x5c7c6d){_0x8d5788[_0xa2bd('0x7')]=_0x5c7c6d[_0xa2bd('0xb')];_0x8d5788[_0xa2bd('0xc')]=_0x5c7c6d[_0xa2bd('0xc')];utils['request'](_0xa2bd('0xe'),_0x8d5788);}});}})[_0xa2bd('0x10')](function(_0x1f7923){utils[_0xa2bd('0x11')](util[_0xa2bd('0x3')]('[%s][members][writeDB]',_0x8d5788['uniqueid']),_0x1f7923);});}delete members[_0x8d5788['interface']];}function startsWith(_0x42885f,_0x1cf8c5){return _[_0xa2bd('0x12')](_0x42885f,function(_0x2d2aca){return _['startsWith'](_0x1cf8c5,_0x2d2aca);});}exports[_0xa2bd('0x13')]=function(_0x313612){try{utils[_0xa2bd('0x14')](util[_0xa2bd('0x3')](_0xa2bd('0x15'),members[_0x313612[_0xa2bd('0x16')]]?members[_0x313612[_0xa2bd('0x16')]]['uniqueid']:_0x313612['device']),_0x313612);utils['info'](util['format'](_0xa2bd('0x17'),members[_0x313612['device']]?members[_0x313612[_0xa2bd('0x16')]][_0xa2bd('0x4')]:_0x313612[_0xa2bd('0x16')],_0x313612[_0xa2bd('0x18')],_0x313612[_0xa2bd('0x16')]));switch(_0x313612[_0xa2bd('0x18')]){case _0xa2bd('0x19'):case _0xa2bd('0x1a'):if(!startsWith(exclude,_0x313612['device'])){members[_0x313612[_0xa2bd('0x16')]]={'channel':_0xa2bd('0x1b'),'interface':_0x313612['device'],'type':_0xa2bd('0x1c'),'enterAt':utils[_0xa2bd('0x1d')](),'role':_0xa2bd('0x1e')};}break;case _0xa2bd('0x1f'):if(!_['isNil'](members[_0x313612[_0xa2bd('0x16')]])){members[_0x313612['device']][_0xa2bd('0x20')]=utils[_0xa2bd('0x1d')]();members[_0x313612['device']][_0xa2bd('0x21')]=utils[_0xa2bd('0x22')](members[_0x313612['device']][_0xa2bd('0x20')],members[_0x313612[_0xa2bd('0x16')]][_0xa2bd('0x23')]);if(members[_0x313612[_0xa2bd('0x16')]]['uniqueid']){writeDB(members[_0x313612[_0xa2bd('0x16')]]);}}break;default:break;}}catch(_0x1ebb6a){utils[_0xa2bd('0x11')](util[_0xa2bd('0x3')](_0xa2bd('0x15'),members[_0x313612[_0xa2bd('0x16')]]?members[_0x313612[_0xa2bd('0x16')]][_0xa2bd('0x4')]:_0x313612[_0xa2bd('0x16')]),_0x1ebb6a);}};exports[_0xa2bd('0x24')]=function(_0x2ac442){try{if(!_[_0xa2bd('0x25')](members[_0x2ac442[_0xa2bd('0x5')]])){utils[_0xa2bd('0x14')](util['format'](_0xa2bd('0x26'),_0x2ac442['uniqueid']),_0x2ac442);utils[_0xa2bd('0x2')](util['format'](_0xa2bd('0x27'),_0x2ac442['uniqueid'],_0x2ac442[_0xa2bd('0x5')],_0x2ac442['queue']));members[_0x2ac442['interface']]=_[_0xa2bd('0x28')](members[_0x2ac442[_0xa2bd('0x5')]],{'data4':_0x2ac442[_0xa2bd('0x29')],'uniqueid':_0x2ac442[_0xa2bd('0x4')]});}}catch(_0x32a289){utils[_0xa2bd('0x11')](util['format'](_0xa2bd('0x26'),_0x2ac442[_0xa2bd('0x4')]),_0x32a289);}};exports[_0xa2bd('0x2a')]=function(_0x1c641b){try{utils[_0xa2bd('0x14')](util[_0xa2bd('0x3')](_0xa2bd('0x2b'),_0x1c641b[_0xa2bd('0x4')]),_0x1c641b);if(_0x1c641b['channel']){var _0x26c9e0=_0x1c641b[_0xa2bd('0x6')]['split']('-')[0x0];if(!_[_0xa2bd('0x25')](members[_0x26c9e0])){members[_0x26c9e0]=_[_0xa2bd('0x28')](members[_0x26c9e0],{'data1':members[_0x26c9e0][_0xa2bd('0x2c')]||_0x1c641b[_0xa2bd('0x8')],'data2':members[_0x26c9e0][_0xa2bd('0x2d')]||_0x1c641b[_0xa2bd('0x2e')],'data3':members[_0x26c9e0][_0xa2bd('0x2f')]||_0x1c641b[_0xa2bd('0x30')],'uniqueid':members[_0x26c9e0]['uniqueid']||_0x1c641b[_0xa2bd('0x4')]});utils[_0xa2bd('0x2')](util[_0xa2bd('0x3')](_0xa2bd('0x31'),_0x1c641b[_0xa2bd('0x4')],members[_0x26c9e0][_0xa2bd('0x2c')],members[_0x26c9e0]['data2'],members[_0x26c9e0][_0xa2bd('0x2f')]));if(members[_0x26c9e0][_0xa2bd('0x20')]){writeDB(members[_0x26c9e0]);}}}if(_0x1c641b['destinationchannel']){var _0x40bfe4=_0x1c641b[_0xa2bd('0x32')][_0xa2bd('0x33')]('-')[0x0];if(!_[_0xa2bd('0x25')](members[_0x40bfe4])){members[_0x40bfe4]=_[_0xa2bd('0x28')](members[_0x40bfe4],{'data1':members[_0x40bfe4][_0xa2bd('0x2c')]||_0x1c641b[_0xa2bd('0x8')],'data2':members[_0x40bfe4][_0xa2bd('0x2d')]||_0x1c641b['source'],'data3':members[_0x40bfe4][_0xa2bd('0x2f')]||_0x1c641b[_0xa2bd('0x30')],'uniqueid':members[_0x40bfe4][_0xa2bd('0x4')]||_0x1c641b[_0xa2bd('0x4')]});utils[_0xa2bd('0x2')](util[_0xa2bd('0x3')](_0xa2bd('0x31'),_0x1c641b[_0xa2bd('0x4')],members[_0x40bfe4][_0xa2bd('0x2c')],members[_0x40bfe4][_0xa2bd('0x2d')],members[_0x40bfe4][_0xa2bd('0x2f')]));if(members[_0x40bfe4][_0xa2bd('0x20')]){writeDB(members[_0x40bfe4]);}}}}catch(_0x2a66e6){utils['error'](util['format'](_0xa2bd('0x2b'),_0x1c641b[_0xa2bd('0x4')]),_0x2a66e6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ca1fc59..c279d45 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 _0x3e40=['BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','diffTime','lodash','./utils','info','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]'];(function(_0x59c461,_0x2e270f){var _0x14dd86=function(_0x250866){while(--_0x250866){_0x59c461['push'](_0x59c461['shift']());}};_0x14dd86(++_0x2e270f);}(_0x3e40,0x15f));var _0x03e4=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x3e40[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x03e4('0x0'));var util=require('util');var utils=require(_0x03e4('0x1'));var queues={};function writeDB(_0x4cb8e1){utils[_0x03e4('0x2')](util[_0x03e4('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4cb8e1[_0x03e4('0x4')],_0x4cb8e1[_0x03e4('0x5')],_0x4cb8e1['queue'],_0x4cb8e1[_0x03e4('0x6')],_0x4cb8e1['calleridnum'],_0x4cb8e1[_0x03e4('0x7')],_0x4cb8e1[_0x03e4('0x8')]));if(_0x4cb8e1[_0x03e4('0x9')]){utils['getVoiceQueueByName'](_0x4cb8e1[_0x03e4('0x9')])[_0x03e4('0xa')](function(_0x4ce2f6){if(_0x4ce2f6){_0x4cb8e1[_0x03e4('0xb')]=_0x4ce2f6[_0x03e4('0xb')];}utils['request'](_0x03e4('0xc'),_0x4cb8e1);});}else{utils[_0x03e4('0xd')](_0x03e4('0xc'),_0x4cb8e1);}if(_0x4cb8e1[_0x03e4('0xe')]){delete queues[_0x4cb8e1[_0x03e4('0xe')]];}else{delete queues[_0x4cb8e1[_0x03e4('0x4')]];}}exports[_0x03e4('0xf')]=function(_0x10ac91){try{utils['debug'](util[_0x03e4('0x3')](_0x03e4('0x10'),_0x10ac91['uniqueid']),_0x10ac91);utils['info'](util[_0x03e4('0x3')](_0x03e4('0x11'),_0x10ac91[_0x03e4('0x4')],_0x10ac91[_0x03e4('0x9')],_0x10ac91[_0x03e4('0x12')]));queues[_0x10ac91[_0x03e4('0x4')]]=_[_0x03e4('0x13')](_0x10ac91,{'originalposition':_0x10ac91['position'],'queuecallerjoinAt':utils[_0x03e4('0x14')](),'mohtime':0x0});}catch(_0x47f708){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x10'),_0x10ac91[_0x03e4('0x4')]),_0x47f708);}};exports[_0x03e4('0x16')]=function(_0x20ae2c){try{if(!_[_0x03e4('0x17')](queues[_0x20ae2c['uniqueid']])){utils[_0x03e4('0x18')](util[_0x03e4('0x3')]('[%s][queues][hangup]',_0x20ae2c[_0x03e4('0x4')]),_0x20ae2c);if(queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0x19')]){if(!queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0x1a')]&&!queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0x1b')]){queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0x1c')]=!![];queues[_0x20ae2c['uniqueid']][_0x03e4('0x1d')]=utils[_0x03e4('0x14')]();queues[_0x20ae2c[_0x03e4('0x4')]]['queuecallerexitreason']=_0x03e4('0x1e');}utils['info'](util[_0x03e4('0x3')](_0x03e4('0x1f'),_0x20ae2c[_0x03e4('0x4')],queues[_0x20ae2c[_0x03e4('0x4')]]['name'],queues[_0x20ae2c['uniqueid']][_0x03e4('0x8')]));writeDB(queues[_0x20ae2c[_0x03e4('0x4')]]);}else if(queues[_0x20ae2c[_0x03e4('0x4')]]['transfereduniqueid']){utils[_0x03e4('0x2')](util['format'](_0x03e4('0x20'),_0x20ae2c[_0x03e4('0x4')],queues[_0x20ae2c['uniqueid']][_0x03e4('0x21')],queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0xe')]));queues[queues[_0x20ae2c['uniqueid']][_0x03e4('0xe')]]=queues[_0x20ae2c[_0x03e4('0x4')]];queues[queues[_0x20ae2c[_0x03e4('0x4')]][_0x03e4('0xe')]][_0x03e4('0x22')]=0x2;delete queues[_0x20ae2c[_0x03e4('0x4')]];}}}catch(_0x1545cb){utils[_0x03e4('0x15')](util[_0x03e4('0x3')]('[%s][queues][hangup]',_0x20ae2c[_0x03e4('0x4')]),_0x1545cb);}};exports[_0x03e4('0x23')]=function(_0x11de12){try{utils[_0x03e4('0x18')](util[_0x03e4('0x3')](_0x03e4('0x24'),_0x11de12[_0x03e4('0x4')]),_0x11de12);if(!_[_0x03e4('0x17')](_0x11de12[_0x03e4('0x25')]['queuestatus'])&&_0x11de12[_0x03e4('0x26')][_0x03e4('0x27')]()!==_0x03e4('0x28')){if(!_['isNil'](queues[_0x11de12[_0x03e4('0x4')]])){queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x1a')]=![];queues[_0x11de12['uniqueid']][_0x03e4('0x29')]=null;queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x1b')]=!![];queues[_0x11de12[_0x03e4('0x4')]]['queuecallerexitAt']=utils[_0x03e4('0x14')]();queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x8')]=_0x11de12[_0x03e4('0x26')][_0x03e4('0x27')]();utils[_0x03e4('0x2')](util[_0x03e4('0x3')](_0x03e4('0x2a'),_0x11de12['uniqueid'],queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x21')],_0x11de12[_0x03e4('0x26')],queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x8')]));writeDB(queues[_0x11de12['uniqueid']]);}}else if(!_['isNil'](_0x11de12[_0x03e4('0x25')][_0x03e4('0x2b')])){if(!_[_0x03e4('0x17')](queues[_0x11de12[_0x03e4('0x4')]])&&!queues[_0x11de12[_0x03e4('0x4')]]['queuecallerabandon']){queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x1a')]=![];queues[_0x11de12[_0x03e4('0x4')]]['queuecallerabandonAt']=null;queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x1b')]=!![];queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x2c')]=utils['now']();queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x8')]=_0x03e4('0x2d');utils['info'](util[_0x03e4('0x3')](_0x03e4('0x2e'),_0x11de12[_0x03e4('0x4')],queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x21')],_0x11de12[_0x03e4('0x26')],queues[_0x11de12[_0x03e4('0x4')]][_0x03e4('0x8')]));}}}catch(_0x461faf){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x24'),_0x11de12[_0x03e4('0x4')]),_0x461faf);}};exports[_0x03e4('0x1a')]=function(_0x33acfd){try{if(!_[_0x03e4('0x17')](queues[_0x33acfd[_0x03e4('0x4')]])){utils[_0x03e4('0x18')](util['format'](_0x03e4('0x2f'),_0x33acfd['uniqueid']),_0x33acfd);queues[_0x33acfd['uniqueid']]['queuecallerexit']=![];queues[_0x33acfd[_0x03e4('0x4')]][_0x03e4('0x2c')]=null;queues[_0x33acfd[_0x03e4('0x4')]]['queuecallerabandon']=!![];queues[_0x33acfd[_0x03e4('0x4')]]['queuecallerabandonAt']=utils[_0x03e4('0x14')]();queues[_0x33acfd[_0x03e4('0x4')]]['queuecallerexitreason']=_0x03e4('0x30');utils[_0x03e4('0x2')](util[_0x03e4('0x3')](_0x03e4('0x31'),_0x33acfd[_0x03e4('0x4')],queues[_0x33acfd[_0x03e4('0x4')]][_0x03e4('0x21')],queues[_0x33acfd[_0x03e4('0x4')]][_0x03e4('0x8')]));}}catch(_0x29cc40){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x2f'),_0x33acfd[_0x03e4('0x4')]),_0x29cc40);}};exports[_0x03e4('0x32')]=function(_0x1f2b7d){try{if(!_[_0x03e4('0x17')](queues[_0x1f2b7d['uniqueid']])){utils['debug'](util['format'](_0x03e4('0x33'),_0x1f2b7d[_0x03e4('0x4')]),_0x1f2b7d);utils[_0x03e4('0x2')](util['format'](_0x03e4('0x34'),_0x1f2b7d[_0x03e4('0x4')],queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x21')],_0x1f2b7d[_0x03e4('0x35')],_0x1f2b7d[_0x03e4('0x36')]));queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x32')]=!![];queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x19')]=utils['now']();queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x37')]=utils['diffTime'](queues[_0x1f2b7d[_0x03e4('0x4')]]['queuecallerleaveAt'],queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x38')]);queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x12')]=_0x1f2b7d[_0x03e4('0x12')];queues[_0x1f2b7d[_0x03e4('0x4')]][_0x03e4('0x39')]=_0x1f2b7d[_0x03e4('0x39')];queues[_0x1f2b7d['uniqueid']]['connectedlinenum']=_0x1f2b7d[_0x03e4('0x35')];queues[_0x1f2b7d['uniqueid']][_0x03e4('0x36')]=_0x1f2b7d[_0x03e4('0x36')];}}catch(_0x5d93af){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x33'),_0x1f2b7d[_0x03e4('0x4')]),_0x5d93af);}};exports[_0x03e4('0x3a')]=function(_0x2ac134){try{if(!_[_0x03e4('0x17')](queues[_0x2ac134[_0x03e4('0x4')]])){utils['debug'](util['format'](_0x03e4('0x3b'),_0x2ac134[_0x03e4('0x4')]),_0x2ac134);utils[_0x03e4('0x2')](util[_0x03e4('0x3')](_0x03e4('0x3c'),_0x2ac134[_0x03e4('0x4')],queues[_0x2ac134[_0x03e4('0x4')]]['name'],_0x2ac134[_0x03e4('0x3d')],_0x2ac134['destaccountcode']));queues[_0x2ac134['uniqueid']][_0x03e4('0x1a')]=![];queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x1a')]=![];queues[_0x2ac134[_0x03e4('0x4')]]['queuecallerabandonAt']=null;queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x1b')]=![];queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x8')]=null;queues[_0x2ac134[_0x03e4('0x4')]]['queuecallerexitAt']=null;queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x3e')]=!![];queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x7')]=_0x2ac134[_0x03e4('0x3f')];queues[_0x2ac134[_0x03e4('0x4')]][_0x03e4('0x6')]=_0x2ac134['membername'];}}catch(_0x298268){utils[_0x03e4('0x15')](util[_0x03e4('0x3')]('[%s][queues][agentconnect]',_0x2ac134[_0x03e4('0x4')]),_0x298268);}};exports[_0x03e4('0x40')]=function(_0x2a32b3){try{if(!_['isNil'](queues[_0x2a32b3['uniqueid']])){if(queues[_0x2a32b3[_0x03e4('0x4')]]['queuecallerleaveAt']){utils[_0x03e4('0x18')](util[_0x03e4('0x3')]('[%s][queues][agentcomplete]',_0x2a32b3[_0x03e4('0x4')]),_0x2a32b3);queues[_0x2a32b3['uniqueid']][_0x03e4('0x1a')]=![];queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x1a')]=![];queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x29')]=null;queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x1b')]=![];queues[_0x2a32b3['uniqueid']][_0x03e4('0x2c')]=null;queues[_0x2a32b3[_0x03e4('0x4')]]['assigned']=!![];queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x6')]=_0x2a32b3[_0x03e4('0x3d')];queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x1c')]=!![];queues[_0x2a32b3[_0x03e4('0x4')]]['queuecallercompleteAt']=utils[_0x03e4('0x14')]();if(_0x2a32b3[_0x03e4('0x41')]=='transfer'){if(!queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x42')]){queues[_0x2a32b3['uniqueid']]['queuecallerexitreason']=_0x03e4('0x43');}}else{queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x8')]=_0x03e4('0x44')+_0x2a32b3[_0x03e4('0x41')][_0x03e4('0x27')]();}utils[_0x03e4('0x2')](util[_0x03e4('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2a32b3[_0x03e4('0x4')],queues[_0x2a32b3[_0x03e4('0x4')]]['name'],_0x2a32b3['membername'],queues[_0x2a32b3[_0x03e4('0x4')]][_0x03e4('0x8')]));writeDB(queues[_0x2a32b3['uniqueid']]);}}}catch(_0x58178c){utils['error'](util[_0x03e4('0x3')](_0x03e4('0x45'),_0x2a32b3[_0x03e4('0x4')]),_0x58178c);}};exports[_0x03e4('0x46')]=function(_0x4db7db){try{if(!_['isNil'](queues[_0x4db7db[_0x03e4('0x47')]])){utils[_0x03e4('0x18')](util[_0x03e4('0x3')](_0x03e4('0x48'),_0x4db7db['uniqueid']),_0x4db7db);queues[_0x4db7db['transfereeuniqueid']]['transfer']=!![];queues[_0x4db7db['transfereeuniqueid']]['transfertype']=_0x03e4('0x49');queues[_0x4db7db[_0x03e4('0x47')]]['transferexten']=_0x4db7db[_0x03e4('0x4a')];queues[_0x4db7db[_0x03e4('0x47')]]['transferuniqueid']=_0x4db7db[_0x03e4('0x47')];queues[_0x4db7db[_0x03e4('0x47')]][_0x03e4('0x8')]=_0x03e4('0x4b');utils[_0x03e4('0x2')](util['format'](_0x03e4('0x4c'),_0x4db7db[_0x03e4('0x4')],queues[_0x4db7db[_0x03e4('0x47')]]['name'],_0x4db7db[_0x03e4('0x47')],_0x4db7db[_0x03e4('0x4a')]));}}catch(_0x5bd70d){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x48'),_0x4db7db['uniqueid']),_0x5bd70d);}};exports['attendedtransfer']=function(_0x5b6d13){try{utils[_0x03e4('0x18')](util[_0x03e4('0x3')]('[%s][queues][attendedtransfer]',_0x5b6d13[_0x03e4('0x4d')]),_0x5b6d13);if(_0x5b6d13[_0x03e4('0x4d')]==_0x5b6d13[_0x03e4('0x4e')]){if(!_[_0x03e4('0x17')](queues[_0x5b6d13[_0x03e4('0x4f')]])){utils[_0x03e4('0x2')](util['format'](_0x03e4('0x50'),_0x5b6d13['origtransfereruniqueid'],queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x21')],_0x5b6d13['origtransfererexten']));queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x42')]=!![];queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x51')]=_0x03e4('0x52');queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x53')]=_0x5b6d13['origtransfererexten'];queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x54')]=_0x5b6d13[_0x03e4('0x4d')];queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x8')]=_0x03e4('0x55');}if(!_[_0x03e4('0x17')](queues[_0x5b6d13[_0x03e4('0x4e')]])){if(_0x5b6d13[_0x03e4('0x56')]&&queues[_0x5b6d13[_0x03e4('0x56')]]){queues[_0x5b6d13[_0x03e4('0x56')]][_0x03e4('0x22')]=0x1;queues[_0x5b6d13[_0x03e4('0x47')]]=_[_0x03e4('0x57')](queues[_0x5b6d13['transfereelinkedid']]);queues[_0x5b6d13[_0x03e4('0x47')]][_0x03e4('0xe')]=_0x5b6d13[_0x03e4('0x58')];queues[_0x5b6d13[_0x03e4('0x47')]][_0x03e4('0x22')]=0x2;queues[_0x5b6d13['transfereeuniqueid']][_0x03e4('0x59')]=queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x59')];queues[_0x5b6d13['transfereeuniqueid']]['calleridname']=queues[_0x5b6d13[_0x03e4('0x4f')]][_0x03e4('0x5a')];queues[_0x5b6d13['transfereeuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x5b6d13['transfereeuniqueid']][_0x03e4('0x19')]=utils['now']();queues[_0x5b6d13[_0x03e4('0x47')]][_0x03e4('0x37')]=0x0;queues[_0x5b6d13['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0x03e4('0x3')](_0x03e4('0x5b'),_0x5b6d13[_0x03e4('0x4d')],queues[_0x5b6d13[_0x03e4('0x47')]]['name'],queues[_0x5b6d13[_0x03e4('0x47')]][_0x03e4('0x59')],queues[_0x5b6d13[_0x03e4('0x47')]][_0x03e4('0x5a')]));}else{utils[_0x03e4('0x2')](util[_0x03e4('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5b6d13[_0x03e4('0x4d')],queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0x21')],_0x5b6d13[_0x03e4('0x4f')]));queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0xe')]=_0x5b6d13['secondtransfererlinkedid'];}}}else if(_0x5b6d13[_0x03e4('0x5c')]==_0x5b6d13[_0x03e4('0x4f')]){if(!_[_0x03e4('0x17')](queues[_0x5b6d13[_0x03e4('0x4e')]])){utils[_0x03e4('0x2')](util['format'](_0x03e4('0x5d'),_0x5b6d13[_0x03e4('0x4d')],queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0x21')],_0x5b6d13[_0x03e4('0x5c')],_0x5b6d13['secondtransfererexten']));queues[_0x5b6d13[_0x03e4('0x4e')]]['transfer']=!![];queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0x51')]=_0x03e4('0x52');queues[_0x5b6d13['origtransfererlinkedid']][_0x03e4('0x53')]=_0x5b6d13[_0x03e4('0x5e')];queues[_0x5b6d13[_0x03e4('0x4e')]]['transferuniqueid']=_0x5b6d13[_0x03e4('0x5c')];queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0x8')]=_0x03e4('0x55');}if(!_['isNil'](queues[_0x5b6d13[_0x03e4('0x4f')]])){if(_0x5b6d13[_0x03e4('0x5f')]&&queues[_0x5b6d13['transfertargetlinkedid']]){queues[_0x5b6d13[_0x03e4('0x5f')]][_0x03e4('0x22')]=0x1;queues[_0x5b6d13[_0x03e4('0x58')]]=_['clone'](queues[_0x5b6d13[_0x03e4('0x5f')]]);queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0xe')]=_0x5b6d13[_0x03e4('0x58')];queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0x22')]=0x2;queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0x59')]=queues[_0x5b6d13[_0x03e4('0x4e')]][_0x03e4('0x59')];queues[_0x5b6d13['transfertargetuniqueid']][_0x03e4('0x5a')]=queues[_0x5b6d13['origtransfererlinkedid']]['calleridname'];queues[_0x5b6d13[_0x03e4('0x58')]]['queuecallerjoinAt']=utils[_0x03e4('0x14')]();queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0x19')]=utils['now']();queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0x37')]=0x0;queues[_0x5b6d13['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x03e4('0x2')](util[_0x03e4('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5b6d13[_0x03e4('0x4d')],queues[_0x5b6d13[_0x03e4('0x58')]][_0x03e4('0x21')],queues[_0x5b6d13[_0x03e4('0x58')]]['transfereduniqueid'],queues[_0x5b6d13[_0x03e4('0x58')]]['calleridnum'],queues[_0x5b6d13['transfertargetuniqueid']][_0x03e4('0x5a')]));}else{utils[_0x03e4('0x2')](util[_0x03e4('0x3')](_0x03e4('0x60'),_0x5b6d13[_0x03e4('0x4d')],queues[_0x5b6d13[_0x03e4('0x4f')]]['name'],_0x5b6d13[_0x03e4('0x4e')]));queues[_0x5b6d13['secondtransfererlinkedid']]['transfereduniqueid']=_0x5b6d13[_0x03e4('0x4e')];}}}}catch(_0x38feab){utils[_0x03e4('0x15')](util[_0x03e4('0x3')](_0x03e4('0x61'),_0x5b6d13[_0x03e4('0x4d')]),_0x38feab);}};exports[_0x03e4('0x62')]=function(_0x357428){try{if(!_[_0x03e4('0x17')](queues[_0x357428[_0x03e4('0x4')]])){utils[_0x03e4('0x18')](util[_0x03e4('0x3')](_0x03e4('0x63'),_0x357428['uniqueid']),_0x357428);queues[_0x357428[_0x03e4('0x4')]][_0x03e4('0x64')]=utils[_0x03e4('0x14')]();utils[_0x03e4('0x2')](util['format'](_0x03e4('0x65'),_0x357428['uniqueid'],queues[_0x357428[_0x03e4('0x4')]][_0x03e4('0x21')],queues[_0x357428[_0x03e4('0x4')]][_0x03e4('0x64')]));}}catch(_0x4786e3){utils[_0x03e4('0x15')](util['format'](_0x03e4('0x63'),_0x357428[_0x03e4('0x4')]),_0x4786e3);}};exports[_0x03e4('0x66')]=function(_0x1f2ee9){try{if(!_[_0x03e4('0x17')](queues[_0x1f2ee9['uniqueid']])){if(!_[_0x03e4('0x17')](queues[_0x1f2ee9[_0x03e4('0x4')]][_0x03e4('0x64')])){utils[_0x03e4('0x18')](util[_0x03e4('0x3')](_0x03e4('0x67'),_0x1f2ee9[_0x03e4('0x4')]),_0x1f2ee9);queues[_0x1f2ee9['uniqueid']][_0x03e4('0x68')]+=utils[_0x03e4('0x69')](utils[_0x03e4('0x14')](),queues[_0x1f2ee9[_0x03e4('0x4')]][_0x03e4('0x64')]);utils[_0x03e4('0x2')](util[_0x03e4('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1f2ee9[_0x03e4('0x4')],queues[_0x1f2ee9['uniqueid']][_0x03e4('0x21')],queues[_0x1f2ee9[_0x03e4('0x4')]][_0x03e4('0x68')]));delete queues[_0x1f2ee9['uniqueid']][_0x03e4('0x64')];}}}catch(_0x5aeda5){utils[_0x03e4('0x15')](util['format']('[%s][queues][musiconholdstop]',_0x1f2ee9['uniqueid']),_0x5aeda5);}}; \ No newline at end of file +var _0x207e=['TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','destaccountcode','assigned','membername','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer'];(function(_0x5b564b,_0x11407d){var _0x2e35df=function(_0x14d85f){while(--_0x14d85f){_0x5b564b['push'](_0x5b564b['shift']());}};_0x2e35df(++_0x11407d);}(_0x207e,0x157));var _0xe207=function(_0x6bc99f,_0x4c7d23){_0x6bc99f=_0x6bc99f-0x0;var _0x559d18=_0x207e[_0x6bc99f];return _0x559d18;};'use strict';var _=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var utils=require(_0xe207('0x2'));var queues={};function writeDB(_0x7cdb73){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x7cdb73['uniqueid'],_0x7cdb73[_0xe207('0x3')],_0x7cdb73[_0xe207('0x4')],_0x7cdb73[_0xe207('0x5')],_0x7cdb73['calleridnum'],_0x7cdb73[_0xe207('0x6')],_0x7cdb73[_0xe207('0x7')]));if(_0x7cdb73[_0xe207('0x4')]){utils[_0xe207('0x8')](_0x7cdb73[_0xe207('0x4')])[_0xe207('0x9')](function(_0x32292d){if(_0x32292d){_0x7cdb73[_0xe207('0xa')]=_0x32292d[_0xe207('0xa')];}utils[_0xe207('0xb')](_0xe207('0xc'),_0x7cdb73);});}else{utils[_0xe207('0xb')](_0xe207('0xc'),_0x7cdb73);}if(_0x7cdb73['transfereduniqueid']){delete queues[_0x7cdb73[_0xe207('0xd')]];}else{delete queues[_0x7cdb73[_0xe207('0xe')]];}}exports[_0xe207('0xf')]=function(_0x37681d){try{utils[_0xe207('0x10')](util[_0xe207('0x11')](_0xe207('0x12'),_0x37681d['uniqueid']),_0x37681d);utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x14'),_0x37681d['uniqueid'],_0x37681d[_0xe207('0x4')],_0x37681d[_0xe207('0x15')]));queues[_0x37681d['uniqueid']]=_[_0xe207('0x16')](_0x37681d,{'originalposition':_0x37681d[_0xe207('0x15')],'queuecallerjoinAt':utils[_0xe207('0x17')](),'mohtime':0x0});}catch(_0x2d718b){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x12'),_0x37681d['uniqueid']),_0x2d718b);}};exports[_0xe207('0x19')]=function(_0x4fb00c){try{if(!_['isNil'](queues[_0x4fb00c[_0xe207('0xe')]])){utils[_0xe207('0x10')](util[_0xe207('0x11')]('[%s][queues][hangup]',_0x4fb00c['uniqueid']),_0x4fb00c);if(queues[_0x4fb00c['uniqueid']][_0xe207('0x1a')]){if(!queues[_0x4fb00c[_0xe207('0xe')]][_0xe207('0x1b')]&&!queues[_0x4fb00c['uniqueid']][_0xe207('0x1c')]){queues[_0x4fb00c['uniqueid']][_0xe207('0x1d')]=!![];queues[_0x4fb00c[_0xe207('0xe')]][_0xe207('0x1e')]=utils[_0xe207('0x17')]();queues[_0x4fb00c[_0xe207('0xe')]]['queuecallerexitreason']=_0xe207('0x1f');}utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x20'),_0x4fb00c[_0xe207('0xe')],queues[_0x4fb00c['uniqueid']][_0xe207('0x21')],queues[_0x4fb00c['uniqueid']][_0xe207('0x7')]));writeDB(queues[_0x4fb00c[_0xe207('0xe')]]);}else if(queues[_0x4fb00c['uniqueid']][_0xe207('0xd')]){utils[_0xe207('0x13')](util[_0xe207('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4fb00c[_0xe207('0xe')],queues[_0x4fb00c[_0xe207('0xe')]][_0xe207('0x21')],queues[_0x4fb00c['uniqueid']][_0xe207('0xd')]));queues[queues[_0x4fb00c[_0xe207('0xe')]]['transfereduniqueid']]=queues[_0x4fb00c['uniqueid']];queues[queues[_0x4fb00c[_0xe207('0xe')]][_0xe207('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x4fb00c[_0xe207('0xe')]];}}}catch(_0x331a5f){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x22'),_0x4fb00c[_0xe207('0xe')]),_0x331a5f);}};exports['varset']=function(_0x9940b2){try{utils[_0xe207('0x10')](util[_0xe207('0x11')](_0xe207('0x23'),_0x9940b2[_0xe207('0xe')]),_0x9940b2);if(!_[_0xe207('0x24')](_0x9940b2[_0xe207('0x25')][_0xe207('0x26')])&&_0x9940b2['value'][_0xe207('0x27')]()!=='CONTINUE'){if(!_[_0xe207('0x24')](queues[_0x9940b2[_0xe207('0xe')]])){queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x1b')]=![];queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x28')]=null;queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x1c')]=!![];queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x29')]=utils[_0xe207('0x17')]();queues[_0x9940b2[_0xe207('0xe')]]['queuecallerexitreason']=_0x9940b2['value']['toUpperCase']();utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x2a'),_0x9940b2[_0xe207('0xe')],queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x21')],_0x9940b2[_0xe207('0x2b')],queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x7')]));writeDB(queues[_0x9940b2[_0xe207('0xe')]]);}}else if(!_['isNil'](_0x9940b2[_0xe207('0x25')]['queueposition'])){if(!_['isNil'](queues[_0x9940b2[_0xe207('0xe')]])&&!queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x1b')]){queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x1b')]=![];queues[_0x9940b2['uniqueid']][_0xe207('0x28')]=null;queues[_0x9940b2[_0xe207('0xe')]]['queuecallerexit']=!![];queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x29')]=utils[_0xe207('0x17')]();queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x7')]=_0xe207('0x2c');utils['info'](util[_0xe207('0x11')](_0xe207('0x2d'),_0x9940b2[_0xe207('0xe')],queues[_0x9940b2['uniqueid']]['name'],_0x9940b2['value'],queues[_0x9940b2[_0xe207('0xe')]][_0xe207('0x7')]));}}}catch(_0x329daa){utils['error'](util[_0xe207('0x11')](_0xe207('0x23'),_0x9940b2['uniqueid']),_0x329daa);}};exports[_0xe207('0x1b')]=function(_0x47bfb4){try{if(!_['isNil'](queues[_0x47bfb4[_0xe207('0xe')]])){utils[_0xe207('0x10')](util[_0xe207('0x11')](_0xe207('0x2e'),_0x47bfb4['uniqueid']),_0x47bfb4);queues[_0x47bfb4[_0xe207('0xe')]][_0xe207('0x1c')]=![];queues[_0x47bfb4[_0xe207('0xe')]]['queuecallerexitAt']=null;queues[_0x47bfb4[_0xe207('0xe')]]['queuecallerabandon']=!![];queues[_0x47bfb4[_0xe207('0xe')]][_0xe207('0x28')]=utils[_0xe207('0x17')]();queues[_0x47bfb4[_0xe207('0xe')]][_0xe207('0x7')]='ABANDONED';utils[_0xe207('0x13')](util[_0xe207('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x47bfb4[_0xe207('0xe')],queues[_0x47bfb4[_0xe207('0xe')]]['name'],queues[_0x47bfb4[_0xe207('0xe')]][_0xe207('0x7')]));}}catch(_0x204eb5){utils['error'](util[_0xe207('0x11')](_0xe207('0x2e'),_0x47bfb4[_0xe207('0xe')]),_0x204eb5);}};exports['queuecallerleave']=function(_0x56bb54){try{if(!_[_0xe207('0x24')](queues[_0x56bb54[_0xe207('0xe')]])){utils[_0xe207('0x10')](util[_0xe207('0x11')](_0xe207('0x2f'),_0x56bb54[_0xe207('0xe')]),_0x56bb54);utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x30'),_0x56bb54[_0xe207('0xe')],queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x21')],_0x56bb54[_0xe207('0x31')],_0x56bb54['connectedlinename']));queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x32')]=!![];queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x1a')]=utils[_0xe207('0x17')]();queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x33')]=utils[_0xe207('0x34')](queues[_0x56bb54['uniqueid']][_0xe207('0x1a')],queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x35')]);queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x15')]=_0x56bb54['position'];queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x36')]=_0x56bb54[_0xe207('0x36')];queues[_0x56bb54['uniqueid']][_0xe207('0x31')]=_0x56bb54[_0xe207('0x31')];queues[_0x56bb54[_0xe207('0xe')]][_0xe207('0x37')]=_0x56bb54[_0xe207('0x37')];}}catch(_0x110bfc){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x2f'),_0x56bb54[_0xe207('0xe')]),_0x110bfc);}};exports[_0xe207('0x38')]=function(_0xaee1fe){try{if(!_[_0xe207('0x24')](queues[_0xaee1fe[_0xe207('0xe')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0xaee1fe[_0xe207('0xe')]),_0xaee1fe);utils[_0xe207('0x13')](util[_0xe207('0x11')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xaee1fe[_0xe207('0xe')],queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x21')],_0xaee1fe['membername'],_0xaee1fe[_0xe207('0x39')]));queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x1b')]=![];queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x1b')]=![];queues[_0xaee1fe['uniqueid']]['queuecallerabandonAt']=null;queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x1c')]=![];queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x7')]=null;queues[_0xaee1fe['uniqueid']][_0xe207('0x29')]=null;queues[_0xaee1fe[_0xe207('0xe')]][_0xe207('0x3a')]=!![];queues[_0xaee1fe['uniqueid']]['accountcode']=_0xaee1fe[_0xe207('0x39')];queues[_0xaee1fe[_0xe207('0xe')]]['lastAssignedTo']=_0xaee1fe[_0xe207('0x3b')];}}catch(_0x3f9c2f){utils[_0xe207('0x18')](util['format'](_0xe207('0x3c'),_0xaee1fe[_0xe207('0xe')]),_0x3f9c2f);}};exports[_0xe207('0x3d')]=function(_0x1da5e5){try{if(!_['isNil'](queues[_0x1da5e5[_0xe207('0xe')]])){if(queues[_0x1da5e5['uniqueid']][_0xe207('0x1a')]){utils['debug'](util[_0xe207('0x11')](_0xe207('0x3e'),_0x1da5e5[_0xe207('0xe')]),_0x1da5e5);queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x1b')]=![];queues[_0x1da5e5['uniqueid']][_0xe207('0x1b')]=![];queues[_0x1da5e5['uniqueid']][_0xe207('0x28')]=null;queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x1c')]=![];queues[_0x1da5e5['uniqueid']][_0xe207('0x29')]=null;queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x3a')]=!![];queues[_0x1da5e5['uniqueid']][_0xe207('0x5')]=_0x1da5e5[_0xe207('0x3b')];queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x1d')]=!![];queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x1e')]=utils[_0xe207('0x17')]();if(_0x1da5e5[_0xe207('0x3f')]==_0xe207('0x40')){if(!queues[_0x1da5e5['uniqueid']]['transfer']){queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x7')]=_0xe207('0x41');}}else{queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x7')]=_0xe207('0x42')+_0x1da5e5[_0xe207('0x3f')][_0xe207('0x27')]();}utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x43'),_0x1da5e5[_0xe207('0xe')],queues[_0x1da5e5['uniqueid']][_0xe207('0x21')],_0x1da5e5[_0xe207('0x3b')],queues[_0x1da5e5[_0xe207('0xe')]][_0xe207('0x7')]));writeDB(queues[_0x1da5e5[_0xe207('0xe')]]);}}}catch(_0x4b6775){utils[_0xe207('0x18')](util['format'](_0xe207('0x3e'),_0x1da5e5[_0xe207('0xe')]),_0x4b6775);}};exports[_0xe207('0x44')]=function(_0x5ddcbd){try{if(!_[_0xe207('0x24')](queues[_0x5ddcbd[_0xe207('0x45')]])){utils['debug'](util['format'](_0xe207('0x46'),_0x5ddcbd[_0xe207('0xe')]),_0x5ddcbd);queues[_0x5ddcbd['transfereeuniqueid']]['transfer']=!![];queues[_0x5ddcbd[_0xe207('0x45')]][_0xe207('0x47')]='BLIND';queues[_0x5ddcbd['transfereeuniqueid']][_0xe207('0x48')]=_0x5ddcbd[_0xe207('0x49')];queues[_0x5ddcbd['transfereeuniqueid']]['transferuniqueid']=_0x5ddcbd[_0xe207('0x45')];queues[_0x5ddcbd['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x4a'),_0x5ddcbd[_0xe207('0xe')],queues[_0x5ddcbd['transfereeuniqueid']][_0xe207('0x21')],_0x5ddcbd['transfereeuniqueid'],_0x5ddcbd[_0xe207('0x49')]));}}catch(_0x2a5aeb){utils['error'](util[_0xe207('0x11')]('[%s][queues][blindtransfer]',_0x5ddcbd[_0xe207('0xe')]),_0x2a5aeb);}};exports[_0xe207('0x4b')]=function(_0x4de4de){try{utils[_0xe207('0x10')](util[_0xe207('0x11')](_0xe207('0x4c'),_0x4de4de['origtransfereruniqueid']),_0x4de4de);if(_0x4de4de[_0xe207('0x4d')]==_0x4de4de[_0xe207('0x4e')]){if(!_[_0xe207('0x24')](queues[_0x4de4de['secondtransfererlinkedid']])){utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x4f'),_0x4de4de[_0xe207('0x4d')],queues[_0x4de4de[_0xe207('0x50')]][_0xe207('0x21')],_0x4de4de[_0xe207('0x51')]));queues[_0x4de4de[_0xe207('0x50')]][_0xe207('0x40')]=!![];queues[_0x4de4de['secondtransfererlinkedid']][_0xe207('0x47')]='ATTENDED';queues[_0x4de4de['secondtransfererlinkedid']]['transferexten']=_0x4de4de['origtransfererexten'];queues[_0x4de4de['secondtransfererlinkedid']][_0xe207('0x52')]=_0x4de4de[_0xe207('0x4d')];queues[_0x4de4de[_0xe207('0x50')]][_0xe207('0x7')]=_0xe207('0x53');}if(!_[_0xe207('0x24')](queues[_0x4de4de[_0xe207('0x4e')]])){if(_0x4de4de[_0xe207('0x54')]&&queues[_0x4de4de[_0xe207('0x54')]]){queues[_0x4de4de[_0xe207('0x54')]][_0xe207('0x55')]=0x1;queues[_0x4de4de['transfereeuniqueid']]=_[_0xe207('0x56')](queues[_0x4de4de[_0xe207('0x54')]]);queues[_0x4de4de['transfereeuniqueid']]['transfereduniqueid']=_0x4de4de[_0xe207('0x57')];queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x55')]=0x2;queues[_0x4de4de[_0xe207('0x45')]]['calleridnum']=queues[_0x4de4de[_0xe207('0x50')]][_0xe207('0x58')];queues[_0x4de4de[_0xe207('0x45')]]['calleridname']=queues[_0x4de4de[_0xe207('0x50')]]['calleridname'];queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x35')]=utils[_0xe207('0x17')]();queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x1a')]=utils[_0xe207('0x17')]();queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x33')]=0x0;queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x59')]=0x0;utils[_0xe207('0x13')](util['format'](_0xe207('0x5a'),_0x4de4de['origtransfereruniqueid'],queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x21')],queues[_0x4de4de[_0xe207('0x45')]]['calleridnum'],queues[_0x4de4de[_0xe207('0x45')]][_0xe207('0x5b')]));}else{utils['info'](util['format'](_0xe207('0x5c'),_0x4de4de['origtransfereruniqueid'],queues[_0x4de4de['origtransfererlinkedid']][_0xe207('0x21')],_0x4de4de[_0xe207('0x50')]));queues[_0x4de4de['origtransfererlinkedid']][_0xe207('0xd')]=_0x4de4de[_0xe207('0x50')];}}}else if(_0x4de4de[_0xe207('0x5d')]==_0x4de4de[_0xe207('0x50')]){if(!_[_0xe207('0x24')](queues[_0x4de4de[_0xe207('0x4e')]])){utils['info'](util[_0xe207('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4de4de[_0xe207('0x4d')],queues[_0x4de4de[_0xe207('0x4e')]]['name'],_0x4de4de[_0xe207('0x5d')],_0x4de4de[_0xe207('0x5e')]));queues[_0x4de4de['origtransfererlinkedid']][_0xe207('0x40')]=!![];queues[_0x4de4de[_0xe207('0x4e')]]['transfertype']=_0xe207('0x5f');queues[_0x4de4de[_0xe207('0x4e')]][_0xe207('0x48')]=_0x4de4de['secondtransfererexten'];queues[_0x4de4de[_0xe207('0x4e')]][_0xe207('0x52')]=_0x4de4de['secondtransfereruniqueid'];queues[_0x4de4de[_0xe207('0x4e')]][_0xe207('0x7')]=_0xe207('0x53');}if(!_[_0xe207('0x24')](queues[_0x4de4de[_0xe207('0x50')]])){if(_0x4de4de[_0xe207('0x60')]&&queues[_0x4de4de[_0xe207('0x60')]]){queues[_0x4de4de[_0xe207('0x60')]][_0xe207('0x55')]=0x1;queues[_0x4de4de[_0xe207('0x57')]]=_['clone'](queues[_0x4de4de[_0xe207('0x60')]]);queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0xd')]=_0x4de4de['transfertargetuniqueid'];queues[_0x4de4de['transfertargetuniqueid']][_0xe207('0x55')]=0x2;queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x58')]=queues[_0x4de4de['origtransfererlinkedid']][_0xe207('0x58')];queues[_0x4de4de['transfertargetuniqueid']][_0xe207('0x5b')]=queues[_0x4de4de['origtransfererlinkedid']][_0xe207('0x5b')];queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x35')]=utils['now']();queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x1a')]=utils[_0xe207('0x17')]();queues[_0x4de4de[_0xe207('0x57')]]['holdtime']=0x0;queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x59')]=0x0;utils[_0xe207('0x13')](util[_0xe207('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4de4de[_0xe207('0x4d')],queues[_0x4de4de['transfertargetuniqueid']]['name'],queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0xd')],queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x58')],queues[_0x4de4de[_0xe207('0x57')]][_0xe207('0x5b')]));}else{utils[_0xe207('0x13')](util[_0xe207('0x11')](_0xe207('0x5c'),_0x4de4de[_0xe207('0x4d')],queues[_0x4de4de['secondtransfererlinkedid']][_0xe207('0x21')],_0x4de4de['origtransfererlinkedid']));queues[_0x4de4de[_0xe207('0x50')]][_0xe207('0xd')]=_0x4de4de['origtransfererlinkedid'];}}}}catch(_0x5b968c){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x4c'),_0x4de4de[_0xe207('0x4d')]),_0x5b968c);}};exports['musiconholdstart']=function(_0x5488af){try{if(!_[_0xe207('0x24')](queues[_0x5488af[_0xe207('0xe')]])){utils[_0xe207('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x5488af[_0xe207('0xe')]),_0x5488af);queues[_0x5488af['uniqueid']]['musiconholdstartAt']=utils[_0xe207('0x17')]();utils['info'](util['format'](_0xe207('0x61'),_0x5488af[_0xe207('0xe')],queues[_0x5488af[_0xe207('0xe')]][_0xe207('0x21')],queues[_0x5488af[_0xe207('0xe')]][_0xe207('0x62')]));}}catch(_0x459402){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x63'),_0x5488af[_0xe207('0xe')]),_0x459402);}};exports[_0xe207('0x64')]=function(_0x750fdc){try{if(!_[_0xe207('0x24')](queues[_0x750fdc[_0xe207('0xe')]])){if(!_['isNil'](queues[_0x750fdc[_0xe207('0xe')]][_0xe207('0x62')])){utils['debug'](util[_0xe207('0x11')]('[%s][queues][musiconholdstop]',_0x750fdc['uniqueid']),_0x750fdc);queues[_0x750fdc[_0xe207('0xe')]][_0xe207('0x59')]+=utils[_0xe207('0x34')](utils[_0xe207('0x17')](),queues[_0x750fdc['uniqueid']][_0xe207('0x62')]);utils[_0xe207('0x13')](util[_0xe207('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x750fdc[_0xe207('0xe')],queues[_0x750fdc[_0xe207('0xe')]][_0xe207('0x21')],queues[_0x750fdc['uniqueid']]['mohtime']));delete queues[_0x750fdc[_0xe207('0xe')]][_0xe207('0x62')];}}}catch(_0x5f3c0e){utils[_0xe207('0x18')](util[_0xe207('0x11')](_0xe207('0x65'),_0x750fdc[_0xe207('0xe')]),_0x5f3c0e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 87296f1..8b25734 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 _0xe1ae=['mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]','application','appdata','cdr','split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable'];(function(_0x5d57c7,_0x3547be){var _0x2ee0ee=function(_0x4da696){while(--_0x4da696){_0x5d57c7['push'](_0x5d57c7['shift']());}};_0x2ee0ee(++_0x3547be);}(_0xe1ae,0xef));var _0xee1a=function(_0x2fbb8e,_0x39edeb){_0x2fbb8e=_0x2fbb8e-0x0;var _0x556d49=_0xe1ae[_0x2fbb8e];return _0x556d49;};'use strict';var _=require(_0xee1a('0x0'));var util=require(_0xee1a('0x1'));var utils=require(_0xee1a('0x2'));var transfers=require(_0xee1a('0x3'));var recordings={};function writeDB(_0x2220fb){var _0x385f08;utils[_0xee1a('0x4')](util[_0xee1a('0x5')](_0xee1a('0x6'),_0x2220fb[_0xee1a('0x7')]));if(transfers[_0xee1a('0x8')][_0x2220fb[_0xee1a('0x7')]]){_0x385f08=_0x2220fb[_0xee1a('0x7')];_0x2220fb['uniqueid']=transfers['blinds'][_0x2220fb['uniqueid']]['transfereeuniqueid'];}if(_0x2220fb[_0xee1a('0x9')]){utils[_0xee1a('0xa')](_0x2220fb['accountcode'])[_0xee1a('0xb')](function(_0x4438b4){if(_0x4438b4){_0x2220fb[_0xee1a('0xc')]=_0x4438b4[_0xee1a('0xd')];_0x2220fb[_0xee1a('0xe')]=_0x4438b4['id'];}utils[_0xee1a('0xf')](_0xee1a('0x10'),_0x2220fb);});}else{utils[_0xee1a('0xf')]('CreateVoiceRecording',_0x2220fb);}if(_0x385f08)delete transfers[_0xee1a('0x8')][_0x385f08];}exports[_0xee1a('0x11')]=function(_0x509014){try{utils[_0xee1a('0x12')](util[_0xee1a('0x5')](_0xee1a('0x13'),_0x509014[_0xee1a('0x7')]),_0x509014);if(_0x509014[_0xee1a('0x7')]==_0x509014['linkedid']){utils['info'](util[_0xee1a('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x509014[_0xee1a('0x7')],_0x509014[_0xee1a('0x14')],_0x509014['exten']));recordings[_0x509014[_0xee1a('0x7')]]={'uniqueid':_0x509014[_0xee1a('0x7')],'accountcode':_0x509014[_0xee1a('0x9')],'exten':_0x509014[_0xee1a('0x15')],'context':_0x509014[_0xee1a('0x14')],'channel':_0x509014['channel'],'monitors':[]};}}catch(_0x3e6f6a){utils[_0xee1a('0x16')](util[_0xee1a('0x5')]('[%s][recordings][newchannel]',_0x509014[_0xee1a('0x7')]),_0x3e6f6a);}};exports[_0xee1a('0x17')]=function(_0x4547aa){try{utils['debug'](util[_0xee1a('0x5')](_0xee1a('0x18'),_0x4547aa[_0xee1a('0x7')]),_0x4547aa);if(!_[_0xee1a('0x19')](recordings[_0x4547aa[_0xee1a('0x7')]])&&_0x4547aa['channelstate']==0x6){utils[_0xee1a('0x4')](util[_0xee1a('0x5')](_0xee1a('0x1a'),_0x4547aa[_0xee1a('0x7')],_0x4547aa[_0xee1a('0x14')],_0x4547aa[_0xee1a('0x1b')]));}else if(!_[_0xee1a('0x19')](recordings[_0x4547aa[_0xee1a('0x1c')]])&&_0x4547aa['channelstate']==0x6&&_0x4547aa[_0xee1a('0x14')]!=_0xee1a('0x1d')){utils[_0xee1a('0x4')](util[_0xee1a('0x5')](_0xee1a('0x1e'),_0x4547aa[_0xee1a('0x7')],_0x4547aa[_0xee1a('0x1c')],_0x4547aa[_0xee1a('0x14')],_0x4547aa['channel']));recordings[_0x4547aa[_0xee1a('0x1c')]][_0xee1a('0x9')]=_0x4547aa[_0xee1a('0x9')];}}catch(_0x1ff78a){utils[_0xee1a('0x16')](util['format'](_0xee1a('0x18'),_0x4547aa[_0xee1a('0x7')]),_0x1ff78a);}};exports[_0xee1a('0x1f')]=function(_0x1cccae){try{if(!_[_0xee1a('0x19')](_0x1cccae[_0xee1a('0x20')])&&!_[_0xee1a('0x19')](_0x1cccae[_0xee1a('0x20')][_0xee1a('0x21')])){utils[_0xee1a('0x12')](util[_0xee1a('0x5')](_0xee1a('0x22'),_0x1cccae[_0xee1a('0x7')]),_0x1cccae);utils[_0xee1a('0x4')](util['format'](_0xee1a('0x23'),_0x1cccae[_0xee1a('0x7')],_0x1cccae[_0xee1a('0x20')],_0x1cccae[_0xee1a('0x24')]));if(_[_0xee1a('0x25')](_0x1cccae['value'],_0xee1a('0x26'))){_0x1cccae['value']=_0x1cccae[_0xee1a('0x24')]['replace']('.wav49','.WAV');}if(recordings[_0x1cccae['linkedid']]){var _0x206dbc=_[_0xee1a('0x27')](recordings[_0x1cccae[_0xee1a('0x1c')]][_0xee1a('0x28')],{'value':_0x1cccae[_0xee1a('0x24')]});if(_['isNil'](_0x206dbc)){recordings[_0x1cccae['linkedid']][_0xee1a('0x28')][_0xee1a('0x29')]({'value':_0x1cccae[_0xee1a('0x24')]});}}}}catch(_0xb436b0){utils[_0xee1a('0x16')](util[_0xee1a('0x5')]('[%s][recordings][varset]',_0x1cccae[_0xee1a('0x7')]),_0xb436b0);}};exports[_0xee1a('0x2a')]=function(_0x1cdbf3){try{if(!_[_0xee1a('0x19')](recordings[_0x1cdbf3[_0xee1a('0x7')]])){utils[_0xee1a('0x12')](util[_0xee1a('0x5')](_0xee1a('0x2b'),_0x1cdbf3['uniqueid']),_0x1cdbf3);utils['info'](util[_0xee1a('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1cdbf3[_0xee1a('0x7')],_0x1cdbf3['calleridnum'],_0x1cdbf3['calleridname'],_0x1cdbf3[_0xee1a('0x2c')]));recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x2d')]=_0x1cdbf3[_0xee1a('0x2d')];recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x2e')]=_0x1cdbf3[_0xee1a('0x2e')];recordings[_0x1cdbf3['uniqueid']][_0xee1a('0x2f')]=_0x1cdbf3[_0xee1a('0x2f')];recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x30')]=_0x1cdbf3['connectedlinename'];if(recordings[_0x1cdbf3[_0xee1a('0x7')]]['type']==_0xee1a('0x31')&&recordings[_0x1cdbf3['uniqueid']][_0xee1a('0x9')]){recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x2f')]=recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x9')];recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x30')]='';}recordings[_0x1cdbf3[_0xee1a('0x7')]][_0xee1a('0x28')]['forEach'](function(_0x5892c6){var _0x1c5e56=_[_0xee1a('0x32')](recordings[_0x1cdbf3[_0xee1a('0x7')]]);_0x1c5e56[_0xee1a('0x24')]=_0x5892c6[_0xee1a('0x24')];writeDB(_0x1c5e56);});delete recordings[_0x1cdbf3[_0xee1a('0x7')]];}}catch(_0x3344c8){utils['error'](util[_0xee1a('0x5')]('[%s][recordings][hangup]',_0x1cdbf3[_0xee1a('0x7')]),_0x3344c8);}};exports[_0xee1a('0x33')]=function(_0x3b4e7c){try{if(!_[_0xee1a('0x19')](recordings[_0x3b4e7c[_0xee1a('0x7')]])){utils['debug'](util[_0xee1a('0x5')](_0xee1a('0x34'),_0x3b4e7c[_0xee1a('0x7')]),_0x3b4e7c);utils[_0xee1a('0x4')](util[_0xee1a('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3b4e7c[_0xee1a('0x7')],_0x3b4e7c[_0xee1a('0x35')],_0x3b4e7c[_0xee1a('0x36')]));if(_0x3b4e7c[_0xee1a('0x35')]['toLowerCase']()=='set'&&_['startsWith'](_0x3b4e7c[_0xee1a('0x36')]['toLowerCase'](),_0xee1a('0x37'))){var _0x76c282=_0x3b4e7c['appdata'][_0xee1a('0x38')]('=');var _0x3caca8=_0x76c282[0x0][_0xee1a('0x39')](_0x76c282[0x0]['lastIndexOf']('(')+0x1,_0x76c282[0x0]['lastIndexOf'](')'));var _0x8d70dc=_0x76c282[0x1];recordings[_0x3b4e7c[_0xee1a('0x7')]][_0x3caca8]=_0x8d70dc;}}}catch(_0x49f4c5){utils['error'](util['format'](_0xee1a('0x34'),_0x3b4e7c[_0xee1a('0x7')]),_0x49f4c5);}};exports['queuecallerjoin']=function(_0x357a51){try{if(!_[_0xee1a('0x19')](recordings[_0x357a51[_0xee1a('0x7')]])){utils[_0xee1a('0x12')](util['format'](_0xee1a('0x3a'),_0x357a51['uniqueid']),_0x357a51);utils['info'](util[_0xee1a('0x5')](_0xee1a('0x3b'),_0x357a51[_0xee1a('0x7')],_0x357a51['queue']));recordings[_0x357a51[_0xee1a('0x7')]]['queue']=_0x357a51['queue'];}}catch(_0x5a2e26){utils[_0xee1a('0x16')](util['format'](_0xee1a('0x3a'),_0x357a51['uniqueid']),_0x5a2e26);}};exports[_0xee1a('0x3c')]=function(_0x47eb7e){try{utils[_0xee1a('0x12')](util[_0xee1a('0x5')](_0xee1a('0x3d'),_0x47eb7e['uniqueid']),_0x47eb7e);utils['info'](util[_0xee1a('0x5')](_0xee1a('0x3e'),_0x47eb7e[_0xee1a('0x7')],_0x47eb7e[_0xee1a('0x3f')],_0x47eb7e['transferercalleridname'],_0x47eb7e[_0xee1a('0x40')],_0x47eb7e[_0xee1a('0x41')]));if(recordings[_0x47eb7e[_0xee1a('0x42')]]&&transfers['blinds'][_0x47eb7e[_0xee1a('0x42')]]){transfers[_0xee1a('0x8')][_0x47eb7e[_0xee1a('0x42')]][_0xee1a('0x43')]=!![];}}catch(_0x4b2079){utils[_0xee1a('0x16')](util['format'](_0xee1a('0x3d'),_0x47eb7e['uniqueid']),_0x4b2079);}}; \ No newline at end of file +var _0x3de2=['membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then'];(function(_0x3124d5,_0x145060){var _0x1147b8=function(_0x350a4c){while(--_0x350a4c){_0x3124d5['push'](_0x3124d5['shift']());}};_0x1147b8(++_0x145060);}(_0x3de2,0x194));var _0x23de=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3de2[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x23de('0x0'));var transfers=require(_0x23de('0x1'));var recordings={};function writeDB(_0x3e5ceb){var _0x3d6409;utils[_0x23de('0x2')](util[_0x23de('0x3')]('[%s][recordings][writeDB]',_0x3e5ceb[_0x23de('0x4')]));if(transfers['blinds'][_0x3e5ceb[_0x23de('0x4')]]){_0x3d6409=_0x3e5ceb[_0x23de('0x4')];_0x3e5ceb[_0x23de('0x4')]=transfers[_0x23de('0x5')][_0x3e5ceb['uniqueid']][_0x23de('0x6')];}if(_0x3e5ceb[_0x23de('0x7')]){utils[_0x23de('0x8')](_0x3e5ceb[_0x23de('0x7')])[_0x23de('0x9')](function(_0x2fcb2c){if(_0x2fcb2c){_0x3e5ceb[_0x23de('0xa')]=_0x2fcb2c[_0x23de('0xb')];_0x3e5ceb[_0x23de('0xc')]=_0x2fcb2c['id'];}utils[_0x23de('0xd')]('CreateVoiceRecording',_0x3e5ceb);});}else{utils[_0x23de('0xd')](_0x23de('0xe'),_0x3e5ceb);}if(_0x3d6409)delete transfers[_0x23de('0x5')][_0x3d6409];}exports['newchannel']=function(_0x1dc49d){try{utils[_0x23de('0xf')](util[_0x23de('0x3')](_0x23de('0x10'),_0x1dc49d[_0x23de('0x4')]),_0x1dc49d);if(_0x1dc49d[_0x23de('0x4')]==_0x1dc49d[_0x23de('0x11')]){utils[_0x23de('0x2')](util[_0x23de('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1dc49d[_0x23de('0x4')],_0x1dc49d[_0x23de('0x12')],_0x1dc49d['exten']));recordings[_0x1dc49d[_0x23de('0x4')]]={'uniqueid':_0x1dc49d[_0x23de('0x4')],'accountcode':_0x1dc49d[_0x23de('0x7')],'exten':_0x1dc49d[_0x23de('0x13')],'context':_0x1dc49d[_0x23de('0x12')],'channel':_0x1dc49d[_0x23de('0x14')],'monitors':[]};}}catch(_0x3360ab){utils[_0x23de('0x15')](util[_0x23de('0x3')]('[%s][recordings][newchannel]',_0x1dc49d[_0x23de('0x4')]),_0x3360ab);}};exports[_0x23de('0x16')]=function(_0xdf2a88){try{utils['debug'](util[_0x23de('0x3')](_0x23de('0x17'),_0xdf2a88[_0x23de('0x4')]),_0xdf2a88);if(!_[_0x23de('0x18')](recordings[_0xdf2a88['uniqueid']])&&_0xdf2a88[_0x23de('0x19')]==0x6){utils[_0x23de('0x2')](util[_0x23de('0x3')](_0x23de('0x1a'),_0xdf2a88[_0x23de('0x4')],_0xdf2a88[_0x23de('0x12')],_0xdf2a88[_0x23de('0x14')]));}else if(!_[_0x23de('0x18')](recordings[_0xdf2a88[_0x23de('0x11')]])&&_0xdf2a88[_0x23de('0x19')]==0x6&&_0xdf2a88[_0x23de('0x12')]!='transfer'){utils[_0x23de('0x2')](util[_0x23de('0x3')](_0x23de('0x1b'),_0xdf2a88[_0x23de('0x4')],_0xdf2a88['linkedid'],_0xdf2a88[_0x23de('0x12')],_0xdf2a88[_0x23de('0x14')]));recordings[_0xdf2a88[_0x23de('0x11')]][_0x23de('0x7')]=_0xdf2a88['accountcode'];}}catch(_0x24e31c){utils[_0x23de('0x15')](util[_0x23de('0x3')]('[%s][recordings][newstate]',_0xdf2a88[_0x23de('0x4')]),_0x24e31c);}};exports[_0x23de('0x1c')]=function(_0x3a7604){try{if(!_[_0x23de('0x18')](_0x3a7604[_0x23de('0x1d')])&&!_['isNil'](_0x3a7604[_0x23de('0x1d')]['mixmonitor_filename'])){utils[_0x23de('0xf')](util[_0x23de('0x3')](_0x23de('0x1e'),_0x3a7604['uniqueid']),_0x3a7604);utils[_0x23de('0x2')](util['format'](_0x23de('0x1f'),_0x3a7604[_0x23de('0x4')],_0x3a7604[_0x23de('0x1d')],_0x3a7604[_0x23de('0x20')]));if(_['endsWith'](_0x3a7604[_0x23de('0x20')],_0x23de('0x21'))){_0x3a7604['value']=_0x3a7604[_0x23de('0x20')][_0x23de('0x22')](_0x23de('0x21'),_0x23de('0x23'));}if(recordings[_0x3a7604[_0x23de('0x11')]]){var _0x18fbfd=_[_0x23de('0x24')](recordings[_0x3a7604['linkedid']][_0x23de('0x25')],{'value':_0x3a7604[_0x23de('0x20')]});if(_[_0x23de('0x18')](_0x18fbfd)){recordings[_0x3a7604[_0x23de('0x11')]][_0x23de('0x25')][_0x23de('0x26')]({'value':_0x3a7604[_0x23de('0x20')]});}}}}catch(_0x31c299){utils[_0x23de('0x15')](util['format'](_0x23de('0x1e'),_0x3a7604['uniqueid']),_0x31c299);}};exports[_0x23de('0x27')]=function(_0x510a76){try{if(!_[_0x23de('0x18')](recordings[_0x510a76['uniqueid']])){utils['debug'](util[_0x23de('0x3')](_0x23de('0x28'),_0x510a76[_0x23de('0x4')]),_0x510a76);utils[_0x23de('0x2')](util[_0x23de('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x510a76['uniqueid'],_0x510a76['calleridnum'],_0x510a76[_0x23de('0x29')],_0x510a76[_0x23de('0x2a')]));recordings[_0x510a76['uniqueid']][_0x23de('0x2b')]=_0x510a76[_0x23de('0x2b')];recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x29')]=_0x510a76['calleridname'];recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x2c')]=_0x510a76['connectedlinenum'];recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x2d')]=_0x510a76['connectedlinename'];if(recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x2e')]=='outbound'&&recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x7')]){recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x2c')]=recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x7')];recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x2d')]='';}recordings[_0x510a76[_0x23de('0x4')]][_0x23de('0x25')][_0x23de('0x2f')](function(_0x3e994e){var _0x335a09=_['clone'](recordings[_0x510a76['uniqueid']]);_0x335a09['value']=_0x3e994e[_0x23de('0x20')];writeDB(_0x335a09);});delete recordings[_0x510a76[_0x23de('0x4')]];}}catch(_0x3a5c96){utils[_0x23de('0x15')](util[_0x23de('0x3')](_0x23de('0x28'),_0x510a76[_0x23de('0x4')]),_0x3a5c96);}};exports['newexten']=function(_0x57fdc5){try{if(!_[_0x23de('0x18')](recordings[_0x57fdc5[_0x23de('0x4')]])){utils[_0x23de('0xf')](util[_0x23de('0x3')]('[%s][recordings][newexten]',_0x57fdc5[_0x23de('0x4')]),_0x57fdc5);utils[_0x23de('0x2')](util['format'](_0x23de('0x30'),_0x57fdc5[_0x23de('0x4')],_0x57fdc5['application'],_0x57fdc5['appdata']));if(_0x57fdc5[_0x23de('0x31')][_0x23de('0x32')]()=='set'&&_[_0x23de('0x33')](_0x57fdc5[_0x23de('0x34')][_0x23de('0x32')](),_0x23de('0x35'))){var _0x4bee0a=_0x57fdc5[_0x23de('0x34')][_0x23de('0x36')]('=');var _0x503382=_0x4bee0a[0x0][_0x23de('0x37')](_0x4bee0a[0x0][_0x23de('0x38')]('(')+0x1,_0x4bee0a[0x0][_0x23de('0x38')](')'));var _0x521ed6=_0x4bee0a[0x1];recordings[_0x57fdc5['uniqueid']][_0x503382]=_0x521ed6;}}}catch(_0x15682e){utils[_0x23de('0x15')](util[_0x23de('0x3')](_0x23de('0x39'),_0x57fdc5[_0x23de('0x4')]),_0x15682e);}};exports[_0x23de('0x3a')]=function(_0x4e20a6){try{if(!_[_0x23de('0x18')](recordings[_0x4e20a6[_0x23de('0x4')]])){utils['debug'](util[_0x23de('0x3')]('[%s][recordings][queuecallerjoin]',_0x4e20a6[_0x23de('0x4')]),_0x4e20a6);utils[_0x23de('0x2')](util['format'](_0x23de('0x3b'),_0x4e20a6[_0x23de('0x4')],_0x4e20a6[_0x23de('0x3c')]));recordings[_0x4e20a6[_0x23de('0x4')]][_0x23de('0x3c')]=_0x4e20a6[_0x23de('0x3c')];}}catch(_0x463607){utils[_0x23de('0x15')](util[_0x23de('0x3')](_0x23de('0x3d'),_0x4e20a6[_0x23de('0x4')]),_0x463607);}};exports[_0x23de('0x3e')]=function(_0x49ca4e){try{utils['debug'](util[_0x23de('0x3')]('[%s][recordings][blindtransfer]',_0x49ca4e[_0x23de('0x4')]),_0x49ca4e);utils[_0x23de('0x2')](util[_0x23de('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x49ca4e['uniqueid'],_0x49ca4e[_0x23de('0x3f')],_0x49ca4e[_0x23de('0x40')],_0x49ca4e['transfereecalleridnum'],_0x49ca4e[_0x23de('0x41')]));if(recordings[_0x49ca4e[_0x23de('0x42')]]&&transfers['blinds'][_0x49ca4e[_0x23de('0x42')]]){transfers[_0x23de('0x5')][_0x49ca4e[_0x23de('0x42')]][_0x23de('0x43')]=!![];}}catch(_0x1e51f1){utils[_0x23de('0x15')](util['format'](_0x23de('0x44'),_0x49ca4e[_0x23de('0x4')]),_0x1e51f1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e559ea2..ef64042 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 _0xa7f0=['[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','attendedtransfer'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa7f0,0x6c));var _0x0a7f=function(_0x194605,_0x3da766){_0x194605=_0x194605-0x0;var _0x50bf9a=_0xa7f0[_0x194605];return _0x50bf9a;};'use strict';var _=require(_0x0a7f('0x0'));var util=require(_0x0a7f('0x1'));var utils=require(_0x0a7f('0x2'));function writeDB(_0x46838d){utils['info'](util[_0x0a7f('0x3')](_0x0a7f('0x4'),_0x46838d[_0x0a7f('0x5')]===_0x0a7f('0x6')?_0x46838d['origtransfereruniqueid']:_0x46838d['uniqueid'],_0x46838d[_0x0a7f('0x5')]));utils['request'](_0x0a7f('0x7'),_0x46838d);}exports['blinds']={};exports['blindtransfer']=function(_0x423e1d){try{utils[_0x0a7f('0x8')](util[_0x0a7f('0x3')](_0x0a7f('0x9'),_0x423e1d[_0x0a7f('0xa')]),_0x423e1d);utils[_0x0a7f('0xb')](util[_0x0a7f('0x3')](_0x0a7f('0xc'),_0x423e1d[_0x0a7f('0xa')],_0x423e1d[_0x0a7f('0xd')],_0x423e1d[_0x0a7f('0xe')],_0x423e1d[_0x0a7f('0xf')],_0x423e1d['transfereecalleridname']));_0x423e1d[_0x0a7f('0x5')]=_0x0a7f('0x10');exports[_0x0a7f('0x11')][_0x423e1d[_0x0a7f('0x12')]]=_0x423e1d;writeDB(_0x423e1d);}catch(_0xa1390c){utils[_0x0a7f('0x13')](util[_0x0a7f('0x3')](_0x0a7f('0x9'),_0x423e1d[_0x0a7f('0xa')]),_0xa1390c);}};exports[_0x0a7f('0x14')]=function(_0x1e0ed0){try{utils[_0x0a7f('0x8')](util[_0x0a7f('0x3')](_0x0a7f('0x15'),_0x1e0ed0[_0x0a7f('0x16')]),_0x1e0ed0);utils[_0x0a7f('0xb')](util[_0x0a7f('0x3')](_0x0a7f('0x17'),_0x1e0ed0[_0x0a7f('0x16')],_0x1e0ed0['origtransferercalleridnum'],_0x1e0ed0[_0x0a7f('0x18')],_0x1e0ed0['transfertargetcalleridnum'],_0x1e0ed0[_0x0a7f('0x19')]));_0x1e0ed0=_[_0x0a7f('0x1a')](_0x1e0ed0,{'transfererchannel':_0x1e0ed0[_0x0a7f('0x1b')],'transferercalleridnum':_0x1e0ed0[_0x0a7f('0x1c')],'transferercalleridname':_0x1e0ed0[_0x0a7f('0x18')],'transfererconnectedlinenum':_0x1e0ed0[_0x0a7f('0x1d')],'transfererconnectedlinename':_0x1e0ed0[_0x0a7f('0x1e')],'transfereraccountcode':_0x1e0ed0['origtransfereraccountcode'],'transferercontext':_0x1e0ed0['secondtransferercontext'],'transfererexten':_0x1e0ed0[_0x0a7f('0x1f')],'transfererlinkedid':_0x1e0ed0[_0x0a7f('0x20')],'context':_0x1e0ed0[_0x0a7f('0x21')],'extension':_0x1e0ed0[_0x0a7f('0x22')],'type':_0x0a7f('0x6')});if(_[_0x0a7f('0x23')](_0x1e0ed0['transfereechannel'])){_0x1e0ed0=_[_0x0a7f('0x1a')](_0x1e0ed0,{'transfereechannel':_0x1e0ed0[_0x0a7f('0x24')],'transfereecalleridnum':_0x1e0ed0[_0x0a7f('0x25')],'transfereecalleridname':_0x1e0ed0[_0x0a7f('0x19')],'transfereeconnectedlinenum':_0x1e0ed0[_0x0a7f('0x26')],'transfereeconnectedlinename':_0x1e0ed0[_0x0a7f('0x27')],'transfereeaccountcode':_0x1e0ed0['transfertargetaccountcode'],'transfereecontext':_0x1e0ed0[_0x0a7f('0x28')],'transfereeexten':_0x1e0ed0[_0x0a7f('0x29')],'transfereelinkedid':_0x1e0ed0[_0x0a7f('0x2a')]});}writeDB(_0x1e0ed0);}catch(_0x52d858){utils[_0x0a7f('0x13')](util[_0x0a7f('0x3')](_0x0a7f('0x15'),_0x1e0ed0['origtransfereruniqueid']),_0x52d858);}}; \ No newline at end of file +var _0x6fb2=['origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext'];(function(_0x33264e,_0x544596){var _0x5369cc=function(_0x146cf8){while(--_0x146cf8){_0x33264e['push'](_0x33264e['shift']());}};_0x5369cc(++_0x544596);}(_0x6fb2,0xcc));var _0x26fb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6fb2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x26fb('0x0'));var utils=require('./utils');function writeDB(_0x130229){utils[_0x26fb('0x1')](util[_0x26fb('0x2')](_0x26fb('0x3'),_0x130229[_0x26fb('0x4')]===_0x26fb('0x5')?_0x130229['origtransfereruniqueid']:_0x130229[_0x26fb('0x6')],_0x130229['type']));utils[_0x26fb('0x7')](_0x26fb('0x8'),_0x130229);}exports[_0x26fb('0x9')]={};exports['blindtransfer']=function(_0x948d9c){try{utils[_0x26fb('0xa')](util[_0x26fb('0x2')](_0x26fb('0xb'),_0x948d9c[_0x26fb('0x6')]),_0x948d9c);utils[_0x26fb('0x1')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x948d9c[_0x26fb('0x6')],_0x948d9c[_0x26fb('0xc')],_0x948d9c[_0x26fb('0xd')],_0x948d9c['transfereecalleridnum'],_0x948d9c[_0x26fb('0xe')]));_0x948d9c[_0x26fb('0x4')]=_0x26fb('0xf');exports[_0x26fb('0x9')][_0x948d9c[_0x26fb('0x10')]]=_0x948d9c;writeDB(_0x948d9c);}catch(_0x5298af){utils['error'](util[_0x26fb('0x2')](_0x26fb('0xb'),_0x948d9c[_0x26fb('0x6')]),_0x5298af);}};exports[_0x26fb('0x11')]=function(_0x15dfa8){try{utils[_0x26fb('0xa')](util['format'](_0x26fb('0x12'),_0x15dfa8[_0x26fb('0x13')]),_0x15dfa8);utils[_0x26fb('0x1')](util[_0x26fb('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x15dfa8['origtransfereruniqueid'],_0x15dfa8[_0x26fb('0x14')],_0x15dfa8[_0x26fb('0x15')],_0x15dfa8['transfertargetcalleridnum'],_0x15dfa8[_0x26fb('0x16')]));_0x15dfa8=_[_0x26fb('0x17')](_0x15dfa8,{'transfererchannel':_0x15dfa8['origtransfererchannel'],'transferercalleridnum':_0x15dfa8[_0x26fb('0x14')],'transferercalleridname':_0x15dfa8[_0x26fb('0x15')],'transfererconnectedlinenum':_0x15dfa8[_0x26fb('0x18')],'transfererconnectedlinename':_0x15dfa8[_0x26fb('0x19')],'transfereraccountcode':_0x15dfa8[_0x26fb('0x1a')],'transferercontext':_0x15dfa8[_0x26fb('0x1b')],'transfererexten':_0x15dfa8['secondtransfererexten'],'transfererlinkedid':_0x15dfa8[_0x26fb('0x1c')],'context':_0x15dfa8[_0x26fb('0x1d')],'extension':_0x15dfa8[_0x26fb('0x1e')],'type':_0x26fb('0x5')});if(_['isNil'](_0x15dfa8[_0x26fb('0x1f')])){_0x15dfa8=_[_0x26fb('0x17')](_0x15dfa8,{'transfereechannel':_0x15dfa8[_0x26fb('0x20')],'transfereecalleridnum':_0x15dfa8['transfertargetcalleridnum'],'transfereecalleridname':_0x15dfa8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x15dfa8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x15dfa8[_0x26fb('0x21')],'transfereeaccountcode':_0x15dfa8[_0x26fb('0x22')],'transfereecontext':_0x15dfa8[_0x26fb('0x23')],'transfereeexten':_0x15dfa8[_0x26fb('0x24')],'transfereelinkedid':_0x15dfa8[_0x26fb('0x25')]});}writeDB(_0x15dfa8);}catch(_0x35906b){utils[_0x26fb('0x26')](util[_0x26fb('0x2')]('[%s][transfers][attendedtransfer]',_0x15dfa8[_0x26fb('0x13')]),_0x35906b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 237f652..ed6298d 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 _0x6df4=['length','result','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x3e8de2,_0x468431){var _0x56b736=function(_0x32da9b){while(--_0x32da9b){_0x3e8de2['push'](_0x3e8de2['shift']());}};_0x56b736(++_0x468431);}(_0x6df4,0xa6));var _0x46df=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6df4[_0x2b9b7f];return _0x4ed19a;};'use strict';var BPromise=require(_0x46df('0x0'));var jayson=require(_0x46df('0x1'));var moment=require(_0x46df('0x2'));var util=require('util');var client=jayson[_0x46df('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x46df('0x4'));exports['info']=function(_0x4d4355,_0x5671c4){logger[_0x46df('0x5')](_0x4d4355,_0x5671c4?util[_0x46df('0x6')](_0x5671c4,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x7')]=function(_0x444494,_0x25f8a4){logger[_0x46df('0x7')](_0x444494,_0x25f8a4?util[_0x46df('0x6')](_0x25f8a4,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x8')]=function(_0x52adc5,_0x22e809){logger[_0x46df('0x8')](_0x52adc5,_0x22e809?util['inspect'](_0x22e809,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x9')]=function(_0x6dc567,_0x1bba36){return client['request'](_0x6dc567,{'body':_0x1bba36})['then'](function(_0x463124){logger[_0x46df('0x7')](_0x46df('0xa'),_0x6dc567,_0x463124?util[_0x46df('0x6')](_0x463124,{'showHidden':![],'depth':null}):'');})[_0x46df('0xb')](function(_0xcce625){logger['error'](_0x46df('0xa'),_0x6dc567,_0xcce625?util[_0x46df('0x6')](_0xcce625,{'showHidden':![],'depth':null}):'');});};function getUser(_0x29e931){return client[_0x46df('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x46df('0xc'),_0x46df('0xd'),_0x46df('0xe')],'where':_0x29e931,'limit':0x1}})[_0x46df('0xf')](function(_0x3948df){logger[_0x46df('0x7')](_0x46df('0x10'),JSON[_0x46df('0x11')](_0x29e931),_0x3948df?util[_0x46df('0x6')](_0x3948df,{'showHidden':![],'depth':null}):'');return _0x3948df['result'][_0x46df('0x12')]?_0x3948df[_0x46df('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x2d5ed3){return new BPromise(function(_0x3b0636,_0x3ceb0f){if(_0x2d5ed3){return getUser({'internal':_0x2d5ed3})[_0x46df('0xf')](function(_0x4a5a17){logger[_0x46df('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2d5ed3,_0x4a5a17?_0x46df('0x14'):_0x46df('0x15'));return _0x3b0636(_0x4a5a17);})[_0x46df('0xb')](function(_0x10f2eb){logger[_0x46df('0x8')]('[utils][getUserByInternal]',_0x10f2eb?util[_0x46df('0x6')](_0x10f2eb,{'showHidden':![],'depth':null}):'');return _0x3b0636(null);});}return _0x3b0636(null);});};exports[_0x46df('0x16')]=function(_0x37c43a){return new BPromise(function(_0x1fcc39,_0x4c67cd){if(_0x37c43a){return getUser({'interface':_0x37c43a})[_0x46df('0xf')](function(_0x4eead3){logger['info'](_0x46df('0x17'),_0x37c43a,_0x4eead3?_0x46df('0x14'):_0x46df('0x15'));return _0x1fcc39(_0x4eead3);})[_0x46df('0xb')](function(_0x6c7b1){logger[_0x46df('0x8')](_0x46df('0x18'),_0x6c7b1?util[_0x46df('0x6')](_0x6c7b1,{'showHidden':![],'depth':null}):'');return _0x1fcc39(null);});}return _0x1fcc39(null);});};exports[_0x46df('0x19')]=function(_0x58a09d){return new BPromise(function(_0x4bf7df,_0x371bae){if(_0x58a09d){return getUser({'name':_0x58a09d})['then'](function(_0x8a8c37){logger['info'](_0x46df('0x1a'),_0x58a09d,_0x8a8c37?_0x46df('0x14'):'notfound');return _0x4bf7df(_0x8a8c37);})[_0x46df('0xb')](function(_0x1ecf11){logger['error'](_0x46df('0x1b'),_0x1ecf11?util[_0x46df('0x6')](_0x1ecf11,{'showHidden':![],'depth':null}):'');return _0x4bf7df(null);});}return _0x4bf7df(null);});};exports[_0x46df('0x1c')]=function(_0x124cbf){return new BPromise(function(_0x195062,_0x431927){if(_0x124cbf){return client[_0x46df('0x9')](_0x46df('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x46df('0xd'),'type',_0x46df('0x1e'),_0x46df('0x1f')],'where':{'name':_0x124cbf},'limit':0x1}})['then'](function(_0x1e8375){logger[_0x46df('0x7')](_0x46df('0x20'),_0x124cbf,_0x1e8375?util[_0x46df('0x6')](_0x1e8375,{'showHidden':![],'depth':null}):'');logger['info'](_0x46df('0x21'),_0x124cbf,_0x1e8375?_0x46df('0x14'):_0x46df('0x15'));return _0x195062(_0x1e8375[_0x46df('0x13')][_0x46df('0x12')]?_0x1e8375[_0x46df('0x13')][0x0]:null);})['catch'](function(_0x474793){logger['error'](_0x46df('0x22'),_0x474793?util['inspect'](_0x474793,{'showHidden':![],'depth':null}):'');return _0x195062(null);});}return _0x195062(null);});};exports[_0x46df('0x23')]=function(_0x257fea,_0x4c6d46){return moment(_0x257fea)[_0x46df('0x24')](_0x4c6d46,_0x46df('0x25'))[_0x46df('0x26')](_0x46df('0x27'));};exports[_0x46df('0x28')]=function(_0x2702d0,_0xa52376){return moment(_0x2702d0)[_0x46df('0x29')](_0xa52376,_0x46df('0x25'))[_0x46df('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2e3766,_0xd053c3){return moment(_0x2e3766)[_0x46df('0x2a')](moment(_0xd053c3),_0x46df('0x25'));};exports['sumTime']=function(_0x2ce046,_0x55a8f4){return parseInt(_0x2ce046,0xa)+parseInt(_0x55a8f4,0xa);};exports[_0x46df('0x2b')]=function(){return moment()[_0x46df('0x26')](_0x46df('0x27'));};exports['isAfter']=function(_0x5bd9ce,_0x48ad3b){if(_0x48ad3b){return moment(_0x5bd9ce)[_0x46df('0x2c')](_0x48ad3b);}return!![];};exports['isBefore']=function(_0x1f60e8,_0x1ec516){if(_0x1ec516){return moment(_0x1f60e8)[_0x46df('0x2d')](_0x1ec516);}else if(_0x1f60e8){return!![];}return![];}; \ No newline at end of file +var _0x6b21=['interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','catch','GetUser','internal','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b21,0x75));var _0x16b2=function(_0x3540fd,_0x45c298){_0x3540fd=_0x3540fd-0x0;var _0x53aa81=_0x6b21[_0x3540fd];return _0x53aa81;};'use strict';var BPromise=require(_0x16b2('0x0'));var jayson=require(_0x16b2('0x1'));var moment=require(_0x16b2('0x2'));var util=require(_0x16b2('0x3'));var client=jayson['client'][_0x16b2('0x4')]({'port':0x2329});var logger=require(_0x16b2('0x5'))(_0x16b2('0x6'));exports['info']=function(_0x43edbe,_0x11ebee){logger[_0x16b2('0x7')](_0x43edbe,_0x11ebee?util['inspect'](_0x11ebee,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x54512e,_0x1039b7){logger['debug'](_0x54512e,_0x1039b7?util[_0x16b2('0x8')](_0x1039b7,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4b4a72,_0x3ecfdf){logger[_0x16b2('0x9')](_0x4b4a72,_0x3ecfdf?util[_0x16b2('0x8')](_0x3ecfdf,{'showHidden':![],'depth':null}):'');};exports[_0x16b2('0xa')]=function(_0x13a0b2,_0xff009a){return client[_0x16b2('0xa')](_0x13a0b2,{'body':_0xff009a})[_0x16b2('0xb')](function(_0x5a09a3){logger[_0x16b2('0xc')](_0x16b2('0xd'),_0x13a0b2,_0x5a09a3?util[_0x16b2('0x8')](_0x5a09a3,{'showHidden':![],'depth':null}):'');})[_0x16b2('0xe')](function(_0x31ca52){logger['error']('[utils][request]\x20name:%s',_0x13a0b2,_0x31ca52?util[_0x16b2('0x8')](_0x31ca52,{'showHidden':![],'depth':null}):'');});};function getUser(_0x310a23){return client[_0x16b2('0xa')](_0x16b2('0xf'),{'options':{'raw':!![],'attributes':['id',_0x16b2('0x10'),_0x16b2('0x11'),_0x16b2('0x12')],'where':_0x310a23,'limit':0x1}})['then'](function(_0x624cb3){logger['debug'](_0x16b2('0x13'),JSON['stringify'](_0x310a23),_0x624cb3?util[_0x16b2('0x8')](_0x624cb3,{'showHidden':![],'depth':null}):'');return _0x624cb3[_0x16b2('0x14')][_0x16b2('0x15')]?_0x624cb3['result'][0x0]:null;});}exports[_0x16b2('0x16')]=function(_0x48d4e9){return new BPromise(function(_0x3eb663,_0x4bf4cf){if(_0x48d4e9){return getUser({'internal':_0x48d4e9})[_0x16b2('0xb')](function(_0x188398){logger[_0x16b2('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x48d4e9,_0x188398?_0x16b2('0x17'):_0x16b2('0x18'));return _0x3eb663(_0x188398);})[_0x16b2('0xe')](function(_0x3b3362){logger[_0x16b2('0x9')]('[utils][getUserByInternal]',_0x3b3362?util[_0x16b2('0x8')](_0x3b3362,{'showHidden':![],'depth':null}):'');return _0x3eb663(null);});}return _0x3eb663(null);});};exports[_0x16b2('0x19')]=function(_0x1c6cfa){return new BPromise(function(_0x4ae9df,_0xe2910d){if(_0x1c6cfa){return getUser({'interface':_0x1c6cfa})[_0x16b2('0xb')](function(_0x2a9b1b){logger[_0x16b2('0x7')](_0x16b2('0x1a'),_0x1c6cfa,_0x2a9b1b?_0x16b2('0x17'):'notfound');return _0x4ae9df(_0x2a9b1b);})['catch'](function(_0x3e17e1){logger[_0x16b2('0x9')](_0x16b2('0x1b'),_0x3e17e1?util[_0x16b2('0x8')](_0x3e17e1,{'showHidden':![],'depth':null}):'');return _0x4ae9df(null);});}return _0x4ae9df(null);});};exports[_0x16b2('0x1c')]=function(_0x429bc5){return new BPromise(function(_0x3a4001,_0x67f973){if(_0x429bc5){return getUser({'name':_0x429bc5})[_0x16b2('0xb')](function(_0x3a962f){logger[_0x16b2('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x429bc5,_0x3a962f?_0x16b2('0x17'):_0x16b2('0x18'));return _0x3a4001(_0x3a962f);})[_0x16b2('0xe')](function(_0x4e2b41){logger[_0x16b2('0x9')](_0x16b2('0x1d'),_0x4e2b41?util[_0x16b2('0x8')](_0x4e2b41,{'showHidden':![],'depth':null}):'');return _0x3a4001(null);});}return _0x3a4001(null);});};exports['getVoiceQueueByName']=function(_0x2b4520){return new BPromise(function(_0x397196,_0x41a772){if(_0x2b4520){return client['request'](_0x16b2('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x16b2('0x11'),_0x16b2('0x1f'),_0x16b2('0x20'),_0x16b2('0x21')],'where':{'name':_0x2b4520},'limit':0x1}})[_0x16b2('0xb')](function(_0xae9320){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x2b4520,_0xae9320?util[_0x16b2('0x8')](_0xae9320,{'showHidden':![],'depth':null}):'');logger[_0x16b2('0x7')](_0x16b2('0x22'),_0x2b4520,_0xae9320?'found':_0x16b2('0x18'));return _0x397196(_0xae9320[_0x16b2('0x14')][_0x16b2('0x15')]?_0xae9320[_0x16b2('0x14')][0x0]:null);})[_0x16b2('0xe')](function(_0x496b4d){logger['error'](_0x16b2('0x23'),_0x496b4d?util[_0x16b2('0x8')](_0x496b4d,{'showHidden':![],'depth':null}):'');return _0x397196(null);});}return _0x397196(null);});};exports['addTime']=function(_0x58e170,_0x2daf71){return moment(_0x58e170)[_0x16b2('0x24')](_0x2daf71,_0x16b2('0x25'))[_0x16b2('0x26')](_0x16b2('0x27'));};exports['subtractTime']=function(_0xe54e9f,_0x1a9fbd){return moment(_0xe54e9f)[_0x16b2('0x28')](_0x1a9fbd,_0x16b2('0x25'))[_0x16b2('0x26')](_0x16b2('0x27'));};exports[_0x16b2('0x29')]=function(_0x477e4c,_0x3e0b79){return moment(_0x477e4c)[_0x16b2('0x2a')](moment(_0x3e0b79),_0x16b2('0x25'));};exports['sumTime']=function(_0x16fb00,_0x2f3b39){return parseInt(_0x16fb00,0xa)+parseInt(_0x2f3b39,0xa);};exports['now']=function(){return moment()[_0x16b2('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x16b2('0x2b')]=function(_0x598d05,_0x48b091){if(_0x48b091){return moment(_0x598d05)[_0x16b2('0x2b')](_0x48b091);}return!![];};exports['isBefore']=function(_0x2a938c,_0x47d683){if(_0x47d683){return moment(_0x2a938c)[_0x16b2('0x2c')](_0x47d683);}else if(_0x2a938c){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 c82b0e5..136913e 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 _0xd77c=['setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','role','name','ensureDir','then','user','no-user','data','timestamp','catch','client','error','api','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','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','device','other','test'];(function(_0x398f40,_0x2649b9){var _0x30789a=function(_0x45e88b){while(--_0x45e88b){_0x398f40['push'](_0x398f40['shift']());}};_0x30789a(++_0x2649b9);}(_0xd77c,0x1a8));var _0xcd77=function(_0x55b563,_0x33b636){_0x55b563=_0x55b563-0x0;var _0xa5b118=_0xd77c[_0x55b563];return _0xa5b118;};var fs=require(_0xcd77('0x0'));var _=require(_0xcd77('0x1'));var ewinston=require(_0xcd77('0x2'));var path=require(_0xcd77('0x3'));var util=require('util');var fileLogger=require(_0xcd77('0x4'))[_0xcd77('0x5')];var safeTemplate=require(_0xcd77('0x6'))[_0xcd77('0x7')];var maskSensitiveData=require(_0xcd77('0x8'))[_0xcd77('0x9')];function ClientSideLogger(){function _0x39eaef(_0x5cef09){var _0x50776f=path[_0xcd77('0xa')](_0xcd77('0xb'),_0xcd77('0xc'),'xcally');var _0x9ed76a=path[_0xcd77('0xa')]('client',_0x5cef09[_0xcd77('0xd')]+'-'+_0x5cef09[_0xcd77('0xe')]);return fs[_0xcd77('0xf')](path[_0xcd77('0xa')](_0x50776f,_0x9ed76a))[_0xcd77('0x10')](function(){var _0x6f279e=fileLogger('client',path['join'](_0x50776f,_0x9ed76a));return _0x6f279e;})['catch'](function(_0x5236a1){throw _0x5236a1;});}this['log']=function(_0x429930,_0x110ef2,_0xe50b35,_0x27f4cf){return _0x39eaef(_0x429930[_0xcd77('0x11')])[_0xcd77('0x10')](function(_0x24edcf){var _0x13eae9=_0x24edcf[_0x110ef2];return _0x13eae9;})[_0xcd77('0x10')](function(_0x406b9c){var _0xdcb939=_0x429930['user']?_0x429930[_0xcd77('0x11')]['id']:_0xcd77('0x12');var _0x16070e=_0x27f4cf[_0xcd77('0x13')];var _0x25fdb4=_0x27f4cf[_0xcd77('0x14')];var _0x12a17c=new Date(Number(_0x25fdb4));return _0x406b9c(_0xdcb939,_0x12a17c,_0xe50b35,_0x16070e);})[_0xcd77('0x15')](function(_0x3313d7){fileLogger(_0xcd77('0x16'))[_0xcd77('0x17')](_0x3313d7);});};}function setupLoggers(_0x67668b){return new Promise(function(_0x42ad62){var _0x184563=new ClientSideLogger();var _0xcc51a0=fileLogger(_0xcd77('0x18'));var _0x4646b7=fileLogger('auth');_0x67668b['set']('client-side-logger',_0x184563);_0x67668b[_0xcd77('0x19')](ewinston[_0xcd77('0x1a')]({'winstonInstance':_0xcc51a0,'meta':![],'statusLevels':!![],'msg':function(_0x37f29b,_0x3f6d30){var _0xa3aa6c=_0xcd77('0x1b');if(!_['isEmpty'](_0x37f29b[_0xcd77('0x1c')])){_0xa3aa6c+=_0xcd77('0x1d');var _0x36dfce=_0x37f29b['body'];maskSensitiveData(_0x36dfce);}return safeTemplate(util['format'](_0xa3aa6c,_0x37f29b[_0xcd77('0x1e')],_0x37f29b[_0xcd77('0x1f')][_0xcd77('0x20')]?_0x37f29b[_0xcd77('0x1f')][_0xcd77('0x20')]:_0x37f29b[_0xcd77('0x21')]['remoteAddress']||_0x37f29b['ip'],_0x37f29b[_0xcd77('0x22')],_0x3f6d30[_0xcd77('0x23')],_0x3f6d30[_0xcd77('0x24')],_0x37f29b['user']?_0x37f29b[_0xcd77('0x11')]['id']:null,_0x37f29b['user']?_0x37f29b[_0xcd77('0x11')]['name']:null,_0x37f29b[_0xcd77('0x11')]?_0x37f29b[_0xcd77('0x11')]['role']:null,_0x36dfce?util[_0xcd77('0x25')](_0x36dfce,![],null):''));}}));_0x67668b[_0xcd77('0x19')](ewinston[_0xcd77('0x1a')]({'winstonInstance':_0x4646b7,'meta':![],'statusLevels':!![],'msg':function(_0x4166da,_0x5d65bc){var _0x556ead=_0xcd77('0x26');if(_0x4166da[_0xcd77('0x1c')]&&_0x4166da[_0xcd77('0x1c')]['device']&&_0x4166da[_0xcd77('0x1c')][_0xcd77('0x27')]){_0x556ead=_0xcd77('0x28');}return util[_0xcd77('0x29')](_0x556ead,_0x4166da['method'],_0x4166da[_0xcd77('0x1f')][_0xcd77('0x20')]?_0x4166da[_0xcd77('0x1f')][_0xcd77('0x20')]:_0x4166da[_0xcd77('0x21')][_0xcd77('0x2a')]||_0x4166da['ip'],_0x4166da['url'],_0x5d65bc[_0xcd77('0x23')],_0x5d65bc[_0xcd77('0x24')],_0x4166da['user']?_0x4166da[_0xcd77('0x11')]['id']:null,_0x4166da[_0xcd77('0x11')]?_0x4166da[_0xcd77('0x11')]['name']:null,_0x4166da[_0xcd77('0x11')]?_0x4166da[_0xcd77('0x11')]['role']:null,_0x4166da[_0xcd77('0x1c')]&&_0x4166da[_0xcd77('0x1c')][_0xcd77('0x2b')]?_0x4166da[_0xcd77('0x1c')][_0xcd77('0x2b')]:_0xcd77('0x2c'),_0x4166da['body']&&_0x4166da[_0xcd77('0x1c')][_0xcd77('0x27')]?_0x4166da[_0xcd77('0x1c')][_0xcd77('0x27')]:'',_0x4166da[_0xcd77('0x1c')]&&_0x4166da['body']['agent_name']?_0x4166da['body']['agent_name']:'');},'ignoreRoute':function(_0x19961d){var _0x16b0d4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x16b0d4[_0xcd77('0x2d')](_0x19961d[_0xcd77('0x22')]);}}));return _0x42ad62();});}exports[_0xcd77('0x2e')]=setupLoggers; \ No newline at end of file +var _0xc447=['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','remoteAddress','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','then','user','no-user','data','timestamp','catch','error','api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0xc447,0xef));var _0x7c44=function(_0x502686,_0x397b91){_0x502686=_0x502686-0x0;var _0x2d6a56=_0xc447[_0x502686];return _0x2d6a56;};var fs=require(_0x7c44('0x0'));var _=require(_0x7c44('0x1'));var ewinston=require(_0x7c44('0x2'));var path=require(_0x7c44('0x3'));var util=require('util');var fileLogger=require(_0x7c44('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x7c44('0x5')];var maskSensitiveData=require(_0x7c44('0x6'))[_0x7c44('0x7')];function ClientSideLogger(){function _0x482587(_0x2d757b){var _0x11f84f=path[_0x7c44('0x8')](_0x7c44('0x9'),_0x7c44('0xa'),'xcally');var _0x10d7df=path[_0x7c44('0x8')](_0x7c44('0xb'),_0x2d757b['role']+'-'+_0x2d757b['name']);return fs['ensureDir'](path[_0x7c44('0x8')](_0x11f84f,_0x10d7df))[_0x7c44('0xc')](function(){var _0x209078=fileLogger(_0x7c44('0xb'),path['join'](_0x11f84f,_0x10d7df));return _0x209078;})['catch'](function(_0x507d65){throw _0x507d65;});}this[_0x7c44('0xa')]=function(_0x2411ea,_0x2d9ca1,_0xa4eda9,_0x5f3a66){return _0x482587(_0x2411ea[_0x7c44('0xd')])[_0x7c44('0xc')](function(_0x2281c8){var _0x2c5918=_0x2281c8[_0x2d9ca1];return _0x2c5918;})[_0x7c44('0xc')](function(_0x2954e9){var _0x55c299=_0x2411ea['user']?_0x2411ea['user']['id']:_0x7c44('0xe');var _0x26cd31=_0x5f3a66[_0x7c44('0xf')];var _0x5efa3d=_0x5f3a66[_0x7c44('0x10')];var _0x54d598=new Date(Number(_0x5efa3d));return _0x2954e9(_0x55c299,_0x54d598,_0xa4eda9,_0x26cd31);})[_0x7c44('0x11')](function(_0x49ea1d){fileLogger('client')[_0x7c44('0x12')](_0x49ea1d);});};}function setupLoggers(_0x1852f6){return new Promise(function(_0x521379){var _0xe57fad=new ClientSideLogger();var _0x5ba0c8=fileLogger(_0x7c44('0x13'));var _0x339780=fileLogger('auth');_0x1852f6[_0x7c44('0x14')](_0x7c44('0x15'),_0xe57fad);_0x1852f6['use'](ewinston[_0x7c44('0x16')]({'winstonInstance':_0x5ba0c8,'meta':![],'statusLevels':!![],'msg':function(_0xfec0c0,_0x427816){var _0x2c0019=_0x7c44('0x17');if(!_[_0x7c44('0x18')](_0xfec0c0['body'])){_0x2c0019+='\x20body=%s';var _0x56c7b0=_0xfec0c0[_0x7c44('0x19')];maskSensitiveData(_0x56c7b0);}return safeTemplate(util['format'](_0x2c0019,_0xfec0c0[_0x7c44('0x1a')],_0xfec0c0[_0x7c44('0x1b')][_0x7c44('0x1c')]?_0xfec0c0['headers'][_0x7c44('0x1c')]:_0xfec0c0[_0x7c44('0x1d')]['remoteAddress']||_0xfec0c0['ip'],_0xfec0c0[_0x7c44('0x1e')],_0x427816[_0x7c44('0x1f')],_0x427816[_0x7c44('0x20')],_0xfec0c0['user']?_0xfec0c0[_0x7c44('0xd')]['id']:null,_0xfec0c0[_0x7c44('0xd')]?_0xfec0c0['user'][_0x7c44('0x21')]:null,_0xfec0c0[_0x7c44('0xd')]?_0xfec0c0[_0x7c44('0xd')][_0x7c44('0x22')]:null,_0x56c7b0?util[_0x7c44('0x23')](_0x56c7b0,![],null):''));}}));_0x1852f6['use'](ewinston['logger']({'winstonInstance':_0x339780,'meta':![],'statusLevels':!![],'msg':function(_0x2b1504,_0x2c92d8){var _0x4e1a89=_0x7c44('0x24');if(_0x2b1504[_0x7c44('0x19')]&&_0x2b1504[_0x7c44('0x19')][_0x7c44('0x25')]&&_0x2b1504[_0x7c44('0x19')][_0x7c44('0x26')]){_0x4e1a89=_0x7c44('0x27');}return util[_0x7c44('0x28')](_0x4e1a89,_0x2b1504['method'],_0x2b1504['headers'][_0x7c44('0x1c')]?_0x2b1504[_0x7c44('0x1b')][_0x7c44('0x1c')]:_0x2b1504['connection'][_0x7c44('0x29')]||_0x2b1504['ip'],_0x2b1504[_0x7c44('0x1e')],_0x2c92d8['statusCode'],_0x2c92d8[_0x7c44('0x20')],_0x2b1504['user']?_0x2b1504[_0x7c44('0xd')]['id']:null,_0x2b1504['user']?_0x2b1504[_0x7c44('0xd')][_0x7c44('0x21')]:null,_0x2b1504[_0x7c44('0xd')]?_0x2b1504[_0x7c44('0xd')][_0x7c44('0x22')]:null,_0x2b1504[_0x7c44('0x19')]&&_0x2b1504[_0x7c44('0x19')][_0x7c44('0x25')]?_0x2b1504[_0x7c44('0x19')][_0x7c44('0x25')]:_0x7c44('0x2a'),_0x2b1504[_0x7c44('0x19')]&&_0x2b1504[_0x7c44('0x19')][_0x7c44('0x26')]?_0x2b1504['body'][_0x7c44('0x26')]:'',_0x2b1504[_0x7c44('0x19')]&&_0x2b1504[_0x7c44('0x19')][_0x7c44('0x2b')]?_0x2b1504[_0x7c44('0x19')][_0x7c44('0x2b')]:'');},'ignoreRoute':function(_0x3f4ff2){var _0x36b329=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x36b329[_0x7c44('0x2c')](_0x3f4ff2[_0x7c44('0x1e')]);}}));return _0x521379();});}exports[_0x7c44('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 804cd58..1d0b90f 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68aa=['weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','padStart','length','iftime','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale'];(function(_0x19cee7,_0x562ecb){var _0x45657b=function(_0x4173fd){while(--_0x4173fd){_0x19cee7['push'](_0x19cee7['shift']());}};_0x45657b(++_0x562ecb);}(_0x68aa,0x1c6));var _0xa68a=function(_0x4c9d4a,_0x5d8c0b){_0x4c9d4a=_0x4c9d4a-0x0;var _0x56ba39=_0x68aa[_0x4c9d4a];return _0x56ba39;};var _=require('lodash');var moment=require(_0xa68a('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa68a('0x1')](function(_0x1c20f3){return _0x1c20f3[_0xa68a('0x2')];})[_0xa68a('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa68a('0x4');var EINVALID_DATE=_0xa68a('0x5');function throwIfDateNotValid(_0x11e867){if(!_0x11e867['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xe86172){var _0x5683f=_0xe86172[_0xa68a('0x6')](':')[_0xa68a('0x1')](function(_0x4fb021){return parseInt(_0x4fb021,0xa);});var _0x51b1d0=_0x5683f[0x0];var _0x243649=_0x5683f[0x1];if(_0x51b1d0<0x0||_0x51b1d0>0x17||_0x243649<0x0||_0x243649>0x3b){throw new Error(EINVALID_DATE);}return[_0x51b1d0,_0x243649];}function circularDoWInterval(_0x3c2d4d,_0xf0f758){if(_0x3c2d4d===_0xf0f758){return[_0x3c2d4d];}else{var _0x2cdc37=moment['locale']();moment[_0xa68a('0x7')]('en');var _0x992606=moment[_0xa68a('0x8')]()[_0xa68a('0x1')](function(_0x55f78a){return _0x55f78a[_0xa68a('0x9')]();});moment[_0xa68a('0x7')](_0x2cdc37);var _0x2bd4ff=_0x992606[_0xa68a('0xa')](_0x3c2d4d);var _0x2aa4a1=_0x992606['indexOf'](_0xf0f758);if(_0x2aa4a1>_0x2bd4ff){return _0x992606['slice'](_0x2bd4ff,_0x2aa4a1+0x1);}else{var _0x4e52a1=_0x992606[_0xa68a('0xb')](0x0,_0x2aa4a1+0x1);var _0x5a0d08=_0x992606[_0xa68a('0xb')](_0x2bd4ff);return _0x5a0d08[_0xa68a('0xc')](_0x4e52a1);}}}module[_0xa68a('0xd')][_0xa68a('0xe')]=circularDoWInterval;function circularMonthInterval(_0x4d2914,_0x341b1b){if(_0x4d2914===_0x341b1b){return[_0x4d2914];}else{var _0x3bf36a=moment['locale']();moment['locale']('en');var _0x5900=moment['monthsShort']()[_0xa68a('0x1')](function(_0x42d6ec){return _0x42d6ec[_0xa68a('0x9')]();});moment[_0xa68a('0x7')](_0x3bf36a);var _0x57c3ae=_0x5900['indexOf'](_0x4d2914);var _0x24e7d2=_0x5900['indexOf'](_0x341b1b);if(_0x24e7d2>_0x57c3ae){return _0x5900[_0xa68a('0xb')](_0x57c3ae,_0x24e7d2+0x1);}else{var _0xf2485=_0x5900[_0xa68a('0xb')](0x0,_0x24e7d2+0x1);var _0x164e47=_0x5900[_0xa68a('0xb')](_0x57c3ae);return _0x164e47[_0xa68a('0xc')](_0xf2485);}}}module['exports'][_0xa68a('0xf')]=circularMonthInterval;function parseDom(_0x2fcd9e){var _0x1fb300=parseInt(_0x2fcd9e,0xa);if(_0x1fb300<0x1||_0x1fb300>0x1f){throw new Error(EINVALID_DATE);}return _0x1fb300;}function timeCompare(_0x1b5038,_0x2e2675,_0x26b670){var _0x58b5b8=_0x1b5038[_0xa68a('0x10')]();var _0x478d3a=extractTime(_0x2e2675);var _0x4d8ba=_0x478d3a[0x0];var _0x4d3f02=_0x478d3a[0x1];var _0x3dbf62=_0x1b5038[_0xa68a('0x10')]()[_0xa68a('0x11')](_0x4d8ba)['minutes'](_0x4d3f02);throwIfDateNotValid(_0x3dbf62);var _0x4bd33a=extractTime(_0x26b670);var _0x580460=_0x4bd33a[0x0];var _0x573c69=_0x4bd33a[0x1];var _0x3b65d2=_0x1b5038[_0xa68a('0x10')]()[_0xa68a('0x11')](_0x580460)[_0xa68a('0x12')](_0x573c69);throwIfDateNotValid(_0x3b65d2);if(_0x3b65d2[_0xa68a('0x13')](_0x3dbf62)){var _0x5ac0b0=_0x58b5b8[_0xa68a('0x10')]()[_0xa68a('0x14')](_0xa68a('0x15'));var _0x40dacb=_0x58b5b8[_0xa68a('0x10')]()[_0xa68a('0x16')]('day');return _0x58b5b8[_0xa68a('0x17')](_0x3dbf62,_0x40dacb,undefined,'[]')||_0x58b5b8[_0xa68a('0x17')](_0x5ac0b0,_0x3b65d2,undefined,'[]');}else{return _0x58b5b8[_0xa68a('0x17')](_0x3dbf62,_0x3b65d2,undefined,'[]');}}module[_0xa68a('0xd')][_0xa68a('0x18')]=timeCompare;function dowCompare(_0x58fa08,_0x456433,_0x13de96){var _0x75449f=_0x58fa08[_0xa68a('0x7')]('en')[_0xa68a('0x19')](_0xa68a('0x1a'))[_0xa68a('0x9')]();return circularDoWInterval(_0x456433,_0x13de96)['includes'](_0x75449f);}module['exports'][_0xa68a('0x1b')]=dowCompare;function domCompare(_0x378a8a,_0x4f4c12,_0x2a5771){var _0x59ea5c=_0x378a8a[_0xa68a('0x1c')]();if(_0x4f4c12===_0x2a5771){return _0x59ea5c===_0x4f4c12;}else{var _0x28018e=_0x378a8a[_0xa68a('0x1d')]();var _0x1bd2e4=_0x4f4c12<_0x2a5771;let _0x5a53d6=![];var _0x344d5c=0x0;var _0x1c73db=0x0;if(_0x1bd2e4){_0x344d5c=Math[_0xa68a('0x1e')](0x1,_0x4f4c12);_0x1c73db=Math[_0xa68a('0x1f')](_0x2a5771,_0x28018e);_0x5a53d6=_0x59ea5c>=_0x344d5c&&_0x59ea5c<=_0x1c73db;}else{_0x344d5c=Math[_0xa68a('0x1f')](_0x4f4c12,_0x28018e);_0x1c73db=Math['max'](0x1,_0x2a5771);_0x5a53d6=_0x59ea5c>=_0x344d5c||_0x59ea5c<=_0x1c73db;}return _0x5a53d6;}}module[_0xa68a('0xd')][_0xa68a('0x20')]=domCompare;function monthCompare(_0x4b7369,_0x1fcca3,_0x2ffabd){var _0x17e7f3=_0x4b7369[_0xa68a('0x7')]('en')[_0xa68a('0x19')](_0xa68a('0x21'))['toLowerCase']();return circularMonthInterval(_0x1fcca3,_0x2ffabd)[_0xa68a('0x22')](_0x17e7f3);}module[_0xa68a('0xd')][_0xa68a('0x23')]=monthCompare;function iftime(_0x1297b0,_0x12e958=moment['tz'][_0xa68a('0x24')](),_0x4a08cf=moment()){if(!validateRx[_0xa68a('0x25')](_0x1297b0)){throw new Error(EINVALID_STRING);}else{var _0x1470a0=(moment[_0xa68a('0x26')](_0x4a08cf)?_0x4a08cf[_0xa68a('0x10')]():moment(_0x4a08cf))['tz'](_0x12e958)['locale']('en');throwIfDateNotValid(_0x1470a0);var _0x1f019d=_0x1297b0['split'](',');var _0x149c01=_0x1f019d[0x0];var _0x4f0bc3=_0x1f019d[0x1];var _0x397fd5=_0x1f019d[0x2];var _0x3c36be=_0x1f019d[0x3];let _0x3c6cb3=!![];if(_0x149c01!=='*'){var _0x1bcb4f=_0x149c01['split']('-');var _0x12c653=_[_0xa68a('0x27')](_0x1bcb4f[0x0],0x5,'0');var _0xe7f853=_0x1bcb4f[_0xa68a('0x28')]===0x2?_[_0xa68a('0x27')](_0x1bcb4f[0x1],0x5,'0'):_0x12c653;_0x3c6cb3=timeCompare(_0x1470a0,_0x12c653,_0xe7f853);}let _0x3da413=!![];if(_0x4f0bc3!=='*'){var _0x5759e3=_0x4f0bc3[_0xa68a('0x6')]('-');var _0xef1ff0=_0x5759e3[0x0];var _0x2df123=_0x5759e3['length']===0x2?_0x5759e3[0x1]:_0xef1ff0;_0x3da413=dowCompare(_0x1470a0,_0xef1ff0,_0x2df123);}let _0x416cf7=!![];if(_0x397fd5!=='*'){var _0x5ace11=_0x397fd5[_0xa68a('0x6')]('-');var _0x1f37b2=parseDom(_0x5ace11[0x0]);var _0x3ca1f1=_0x5ace11[_0xa68a('0x28')]===0x2?parseDom(_0x5ace11[0x1]):_0x1f37b2;_0x416cf7=domCompare(_0x1470a0,_0x1f37b2,_0x3ca1f1);}let _0x4aad2f=!![];if(_0x3c36be!=='*'){var _0x3486cb=_0x3c36be[_0xa68a('0x6')]('-');var _0x4f8547=_0x3486cb[0x0];var _0x4fa72b=_0x3486cb[_0xa68a('0x28')]===0x2?_0x3486cb[0x1]:_0x3486cb[0x0];_0x4aad2f=monthCompare(_0x1470a0,_0x4f8547,_0x4fa72b);}return _0x3c6cb3&&_0x3da413&&_0x416cf7&&_0x4aad2f;}}module[_0xa68a('0xd')][_0xa68a('0x29')]=iftime; \ No newline at end of file +var _0x294a=['guess','test','isMoment','padStart','length','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','toLowerCase','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','min','domCompare','MMM'];(function(_0x45d64c,_0x804a43){var _0x571130=function(_0x2e26a7){while(--_0x2e26a7){_0x45d64c['push'](_0x45d64c['shift']());}};_0x571130(++_0x804a43);}(_0x294a,0x182));var _0xa294=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x294a[_0x269ee8];return _0x4d98bd;};var _=require('lodash');var moment=require(_0xa294('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x174b43){return _0x174b43[_0xa294('0x1')];})[_0xa294('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa294('0x3');var EINVALID_DATE=_0xa294('0x4');function throwIfDateNotValid(_0x22d827){if(!_0x22d827[_0xa294('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4622ad){var _0x139cd7=_0x4622ad[_0xa294('0x6')](':')[_0xa294('0x7')](function(_0x546feb){return parseInt(_0x546feb,0xa);});var _0x2cb021=_0x139cd7[0x0];var _0x2e7267=_0x139cd7[0x1];if(_0x2cb021<0x0||_0x2cb021>0x17||_0x2e7267<0x0||_0x2e7267>0x3b){throw new Error(EINVALID_DATE);}return[_0x2cb021,_0x2e7267];}function circularDoWInterval(_0x2e3121,_0x538c8a){if(_0x2e3121===_0x538c8a){return[_0x2e3121];}else{var _0x4f9faf=moment[_0xa294('0x8')]();moment['locale']('en');var _0x4d2f0d=moment[_0xa294('0x9')]()[_0xa294('0x7')](function(_0x5dafac){return _0x5dafac['toLowerCase']();});moment[_0xa294('0x8')](_0x4f9faf);var _0x31743d=_0x4d2f0d[_0xa294('0xa')](_0x2e3121);var _0x40331b=_0x4d2f0d['indexOf'](_0x538c8a);if(_0x40331b>_0x31743d){return _0x4d2f0d[_0xa294('0xb')](_0x31743d,_0x40331b+0x1);}else{var _0x10755f=_0x4d2f0d[_0xa294('0xb')](0x0,_0x40331b+0x1);var _0x490d0c=_0x4d2f0d['slice'](_0x31743d);return _0x490d0c[_0xa294('0xc')](_0x10755f);}}}module[_0xa294('0xd')][_0xa294('0xe')]=circularDoWInterval;function circularMonthInterval(_0x120d23,_0x55f486){if(_0x120d23===_0x55f486){return[_0x120d23];}else{var _0x3d7ddc=moment[_0xa294('0x8')]();moment[_0xa294('0x8')]('en');var _0x528d0a=moment['monthsShort']()[_0xa294('0x7')](function(_0x41dfa6){return _0x41dfa6[_0xa294('0xf')]();});moment[_0xa294('0x8')](_0x3d7ddc);var _0x1b3428=_0x528d0a['indexOf'](_0x120d23);var _0x33099d=_0x528d0a[_0xa294('0xa')](_0x55f486);if(_0x33099d>_0x1b3428){return _0x528d0a[_0xa294('0xb')](_0x1b3428,_0x33099d+0x1);}else{var _0x5869fc=_0x528d0a[_0xa294('0xb')](0x0,_0x33099d+0x1);var _0x338ea0=_0x528d0a[_0xa294('0xb')](_0x1b3428);return _0x338ea0[_0xa294('0xc')](_0x5869fc);}}}module[_0xa294('0xd')][_0xa294('0x10')]=circularMonthInterval;function parseDom(_0x4e4f38){var _0x1db7fb=parseInt(_0x4e4f38,0xa);if(_0x1db7fb<0x1||_0x1db7fb>0x1f){throw new Error(EINVALID_DATE);}return _0x1db7fb;}function timeCompare(_0x58a24b,_0x1da9da,_0x2baa95){var _0x16bcf7=_0x58a24b[_0xa294('0x11')]();var _0x33e7e0=extractTime(_0x1da9da);var _0x25cc98=_0x33e7e0[0x0];var _0x32bcdc=_0x33e7e0[0x1];var _0x53f019=_0x58a24b[_0xa294('0x11')]()[_0xa294('0x12')](_0x25cc98)[_0xa294('0x13')](_0x32bcdc);throwIfDateNotValid(_0x53f019);var _0x2cfde5=extractTime(_0x2baa95);var _0x1774cd=_0x2cfde5[0x0];var _0x12a5cd=_0x2cfde5[0x1];var _0x113c55=_0x58a24b[_0xa294('0x11')]()[_0xa294('0x12')](_0x1774cd)['minutes'](_0x12a5cd);throwIfDateNotValid(_0x113c55);if(_0x113c55['isBefore'](_0x53f019)){var _0x348704=_0x16bcf7[_0xa294('0x11')]()[_0xa294('0x14')](_0xa294('0x15'));var _0x4ddab4=_0x16bcf7[_0xa294('0x11')]()[_0xa294('0x16')]('day');return _0x16bcf7['isBetween'](_0x53f019,_0x4ddab4,undefined,'[]')||_0x16bcf7[_0xa294('0x17')](_0x348704,_0x113c55,undefined,'[]');}else{return _0x16bcf7[_0xa294('0x17')](_0x53f019,_0x113c55,undefined,'[]');}}module[_0xa294('0xd')][_0xa294('0x18')]=timeCompare;function dowCompare(_0x155f13,_0x57399d,_0x235195){var _0x1b3d44=_0x155f13[_0xa294('0x8')]('en')[_0xa294('0x19')](_0xa294('0x1a'))[_0xa294('0xf')]();return circularDoWInterval(_0x57399d,_0x235195)[_0xa294('0x1b')](_0x1b3d44);}module[_0xa294('0xd')][_0xa294('0x1c')]=dowCompare;function domCompare(_0x579829,_0x5d8101,_0x363bf5){var _0x22e8a1=_0x579829['date']();if(_0x5d8101===_0x363bf5){return _0x22e8a1===_0x5d8101;}else{var _0x46f0d4=_0x579829['daysInMonth']();var _0x44f2d8=_0x5d8101<_0x363bf5;let _0x1f70ee=![];var _0x1217ca=0x0;var _0x335aa1=0x0;if(_0x44f2d8){_0x1217ca=Math['max'](0x1,_0x5d8101);_0x335aa1=Math[_0xa294('0x1d')](_0x363bf5,_0x46f0d4);_0x1f70ee=_0x22e8a1>=_0x1217ca&&_0x22e8a1<=_0x335aa1;}else{_0x1217ca=Math[_0xa294('0x1d')](_0x5d8101,_0x46f0d4);_0x335aa1=Math['max'](0x1,_0x363bf5);_0x1f70ee=_0x22e8a1>=_0x1217ca||_0x22e8a1<=_0x335aa1;}return _0x1f70ee;}}module['exports'][_0xa294('0x1e')]=domCompare;function monthCompare(_0x27e798,_0x916b32,_0x5ec82f){var _0x4b6d6c=_0x27e798['locale']('en')['format'](_0xa294('0x1f'))[_0xa294('0xf')]();return circularMonthInterval(_0x916b32,_0x5ec82f)[_0xa294('0x1b')](_0x4b6d6c);}module[_0xa294('0xd')]['monthCompare']=monthCompare;function iftime(_0x4c403a,_0x3b2654=moment['tz'][_0xa294('0x20')](),_0x6a4813=moment()){if(!validateRx[_0xa294('0x21')](_0x4c403a)){throw new Error(EINVALID_STRING);}else{var _0x4a9ec0=(moment[_0xa294('0x22')](_0x6a4813)?_0x6a4813[_0xa294('0x11')]():moment(_0x6a4813))['tz'](_0x3b2654)[_0xa294('0x8')]('en');throwIfDateNotValid(_0x4a9ec0);var _0x186d27=_0x4c403a[_0xa294('0x6')](',');var _0x31a182=_0x186d27[0x0];var _0x4f5d84=_0x186d27[0x1];var _0x527485=_0x186d27[0x2];var _0x32a6e8=_0x186d27[0x3];let _0x2fd7fd=!![];if(_0x31a182!=='*'){var _0x13a0e8=_0x31a182[_0xa294('0x6')]('-');var _0x3c35bf=_[_0xa294('0x23')](_0x13a0e8[0x0],0x5,'0');var _0x13b268=_0x13a0e8[_0xa294('0x24')]===0x2?_[_0xa294('0x23')](_0x13a0e8[0x1],0x5,'0'):_0x3c35bf;_0x2fd7fd=timeCompare(_0x4a9ec0,_0x3c35bf,_0x13b268);}let _0x3acf1b=!![];if(_0x4f5d84!=='*'){var _0x3d6f7d=_0x4f5d84[_0xa294('0x6')]('-');var _0x464d9c=_0x3d6f7d[0x0];var _0x910342=_0x3d6f7d[_0xa294('0x24')]===0x2?_0x3d6f7d[0x1]:_0x464d9c;_0x3acf1b=dowCompare(_0x4a9ec0,_0x464d9c,_0x910342);}let _0x1fab63=!![];if(_0x527485!=='*'){var _0x30ccd0=_0x527485[_0xa294('0x6')]('-');var _0x45538b=parseDom(_0x30ccd0[0x0]);var _0x23c8fc=_0x30ccd0[_0xa294('0x24')]===0x2?parseDom(_0x30ccd0[0x1]):_0x45538b;_0x1fab63=domCompare(_0x4a9ec0,_0x45538b,_0x23c8fc);}let _0x406eea=!![];if(_0x32a6e8!=='*'){var _0x4a18b2=_0x32a6e8[_0xa294('0x6')]('-');var _0x27d96a=_0x4a18b2[0x0];var _0x27c2ad=_0x4a18b2[_0xa294('0x24')]===0x2?_0x4a18b2[0x1]:_0x4a18b2[0x0];_0x406eea=monthCompare(_0x4a9ec0,_0x27d96a,_0x27c2ad);}return _0x2fd7fd&&_0x3acf1b&&_0x1fab63&&_0x406eea;}}module[_0xa294('0xd')][_0xa294('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index db90225..8e08f7f 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0c9=['debugLevel','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','Console','warn','File','error','transports','%s-%s','consoleLogger','path','util','moment','../config/environment'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xe0c9,0x1c4));var _0x9e0c=function(_0x3c89c8,_0x5a73c7){_0x3c89c8=_0x3c89c8-0x0;var _0x20de3b=_0xe0c9[_0x3c89c8];return _0x20de3b;};'use strict';var path=require(_0x9e0c('0x0'));var util=require(_0x9e0c('0x1'));var moment=require(_0x9e0c('0x2'));var winston=require('winston');var config=require(_0x9e0c('0x3'));var debugLevel=config[_0x9e0c('0x4')]?config[_0x9e0c('0x4')]['toLowerCase']():_0x9e0c('0x5');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':_0x9e0c('0x6'),'error':_0x9e0c('0x7'),'warn':_0x9e0c('0x8'),'info':'white','print':_0x9e0c('0x9'),'success':_0x9e0c('0xa'),'http':_0x9e0c('0xb'),'verbose':_0x9e0c('0xc'),'debug':_0x9e0c('0xd'),'silly':'bold\x20cyan'};winston[_0x9e0c('0xe')](XC_LOG_COLORS);function getLogFileName(_0x44acdb,_0x36d7b2,_0x1b2dec){var _0xb37f06=_0x44acdb||_0x9e0c('0xf');return path['join'](_0xb37f06,util[_0x9e0c('0x10')](_0x9e0c('0x11'),_0x36d7b2,_0x1b2dec));}function formatter(_0x4310d2,_0x5c7253){_0x5c7253[_0x9e0c('0x12')]=_0x5c7253['message'][_0x9e0c('0x13')](/@@{/g,_0x9e0c('0x14'))[_0x9e0c('0x13')](/}@@/g,_0x9e0c('0x15'))[_0x9e0c('0x13')](/@{/g,'{{')[_0x9e0c('0x13')](/}@/g,'}}');return util[_0x9e0c('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x9e0c('0x10')](_0x9e0c('0x16')),_0x5c7253[_0x9e0c('0x17')]['toUpperCase'](),_0x4310d2,_0x5c7253['message']);}function fileFormat(_0x19ee31,_0x4cc70c){_0x4cc70c[_0x9e0c('0x12')]=_0x4cc70c[_0x9e0c('0x12')][_0x9e0c('0x13')](/@@{/g,_0x9e0c('0x14'))[_0x9e0c('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x9e0c('0x13')](/}@/g,'}}');var _0x1c174c=_0x4cc70c[_0x9e0c('0x18')]&&Object[_0x9e0c('0x19')](_0x4cc70c['meta'])[_0x9e0c('0x1a')]?'\x0a\x09'+JSON[_0x9e0c('0x1b')](_0x4cc70c[_0x9e0c('0x18')]):'';return util['format'](_0x9e0c('0x1c'),moment()[_0x9e0c('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4cc70c[_0x9e0c('0x17')][_0x9e0c('0x1d')](),_0x19ee31,_0x4cc70c[_0x9e0c('0x12')],_0x1c174c);}function consoleLogger(){var _0x1bd97a=new winston[(_0x9e0c('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x9e0c('0x1f'))]({'level':_0x9e0c('0x20'),'json':![],'formatter':function(_0x3df114){return formatter('',_0x3df114);}})]});return _0x1bd97a;}function fileLogger(_0xc5f57c,_0x5a57a0){var _0x150fa7=new winston[(_0x9e0c('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x9e0c('0x21'))]({'name':util[_0x9e0c('0x10')]('%s-%s',_0xc5f57c,'error'),'filename':getLogFileName(_0x5a57a0,_0xc5f57c,_0x9e0c('0x22')),'level':_0x9e0c('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51ee2c){return fileFormat(_0xc5f57c,_0x51ee2c);}}),new winston[(_0x9e0c('0x23'))]['File']({'name':util[_0x9e0c('0x10')](_0x9e0c('0x24'),_0xc5f57c,debugLevel),'filename':getLogFileName(_0x5a57a0,_0xc5f57c,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2167d8){return fileFormat(_0xc5f57c,_0x2167d8);}}),new winston[(_0x9e0c('0x23'))][(_0x9e0c('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x4f3b01){return fileFormat(_0xc5f57c,_0x4f3b01);}})]});return _0x150fa7;}exports[_0x9e0c('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x4805=['Console','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','warn','Logger','transports','File','%s-%s','error'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x4805,0xc6));var _0x5480=function(_0x29d7e2,_0x43d9b2){_0x29d7e2=_0x29d7e2-0x0;var _0x3e4a09=_0x4805[_0x29d7e2];return _0x3e4a09;};'use strict';var path=require(_0x5480('0x0'));var util=require('util');var moment=require(_0x5480('0x1'));var winston=require(_0x5480('0x2'));var config=require(_0x5480('0x3'));var debugLevel=config[_0x5480('0x4')]?config[_0x5480('0x4')][_0x5480('0x5')]():_0x5480('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':_0x5480('0x7'),'error':_0x5480('0x8'),'warn':_0x5480('0x9'),'info':'white','print':'bold\x20white','success':_0x5480('0xa'),'http':_0x5480('0xb'),'verbose':_0x5480('0xc'),'debug':_0x5480('0xd'),'silly':_0x5480('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x279024,_0x2d2794,_0x9d49e0){var _0x230c58=_0x279024||_0x5480('0xf');return path[_0x5480('0x10')](_0x230c58,util[_0x5480('0x11')]('%s-%s.log',_0x2d2794,_0x9d49e0));}function formatter(_0x2b5acd,_0xf387c1){_0xf387c1['message']=_0xf387c1[_0x5480('0x12')]['replace'](/@@{/g,_0x5480('0x13'))[_0x5480('0x14')](/}@@/g,_0x5480('0x15'))[_0x5480('0x14')](/@{/g,'{{')[_0x5480('0x14')](/}@/g,'}}');return util['format'](_0x5480('0x16'),moment()[_0x5480('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0xf387c1['level']['toUpperCase'](),_0x2b5acd,_0xf387c1[_0x5480('0x12')]);}function fileFormat(_0x20c22b,_0x141ff9){_0x141ff9[_0x5480('0x12')]=_0x141ff9[_0x5480('0x12')][_0x5480('0x14')](/@@{/g,'{{{')[_0x5480('0x14')](/}@@/g,_0x5480('0x15'))[_0x5480('0x14')](/@{/g,'{{')[_0x5480('0x14')](/}@/g,'}}');var _0x1e2299=_0x141ff9[_0x5480('0x17')]&&Object[_0x5480('0x18')](_0x141ff9[_0x5480('0x17')])[_0x5480('0x19')]?'\x0a\x09'+JSON[_0x5480('0x1a')](_0x141ff9[_0x5480('0x17')]):'';return util[_0x5480('0x11')](_0x5480('0x1b'),moment()['format'](_0x5480('0x1c')),_0x141ff9[_0x5480('0x1d')]['toUpperCase'](),_0x20c22b,_0x141ff9['message'],_0x1e2299);}function consoleLogger(){var _0x2ab3d9=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x5480('0x1e'),'json':![],'formatter':function(_0x56705d){return formatter('',_0x56705d);}})]});return _0x2ab3d9;}function fileLogger(_0x3920b8,_0x44b6c4){var _0x81c38d=new winston[(_0x5480('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5480('0x20'))][(_0x5480('0x21'))]({'name':util[_0x5480('0x11')](_0x5480('0x22'),_0x3920b8,_0x5480('0x23')),'filename':getLogFileName(_0x44b6c4,_0x3920b8,'error'),'level':_0x5480('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x211af6){return fileFormat(_0x3920b8,_0x211af6);}}),new winston['transports'][(_0x5480('0x21'))]({'name':util[_0x5480('0x11')]('%s-%s',_0x3920b8,debugLevel),'filename':getLogFileName(_0x44b6c4,_0x3920b8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ef18c){return fileFormat(_0x3920b8,_0x3ef18c);}}),new winston[(_0x5480('0x20'))][(_0x5480('0x24'))]({'level':_0x5480('0x1e'),'json':![],'formatter':function(_0x443644){return fileFormat(_0x3920b8,_0x443644);}})]});return _0x81c38d;}exports[_0x5480('0x25')]=consoleLogger;exports[_0x5480('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9d942a3..a43152a 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(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0x0295,0x1f0));var _0x5029=function(_0x18e3e7,_0x39886c){_0x18e3e7=_0x18e3e7-0x0;var _0x211dee=_0x0295[_0x18e3e7];return _0x211dee;};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 _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(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x0295,0x1f0));var _0x5029=function(_0x51eb91,_0x4799d5){_0x51eb91=_0x51eb91-0x0;var _0x1c4fc4=_0x0295[_0x51eb91];return _0x1c4fc4;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index b2d0118..ec62aac 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['safeTemplate','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x101133,_0x17d6d5){var _0x126f24=function(_0x5911f8){while(--_0x5911f8){_0x101133['push'](_0x101133['shift']());}};_0x126f24(++_0x17d6d5);}(_0x0972,0x64));var _0x2097=function(_0x12ad4f,_0x3ce946){_0x12ad4f=_0x12ad4f-0x0;var _0x2956bd=_0x0972[_0x12ad4f];return _0x2956bd;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1591ae){return _0x1591ae==='{{'?'{\x20{\x20':_0x2097('0x0');}function safeTemplate(_0x4ec7aa){var _0x36912c=_0x4ec7aa;if(typeof _0x4ec7aa===_0x2097('0x1')){_0x36912c=_0x4ec7aa['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2097('0x2')](_0x4ec7aa)){_0x36912c=_0x4ec7aa[_0x2097('0x3')](function(_0xe6fbae){return safeTemplate(_0xe6fbae);});}else if(_[_0x2097('0x4')](_0x4ec7aa)){_0x36912c=Object[_0x2097('0x5')](_0x4ec7aa)[_0x2097('0x6')](function(_0x2b4f21,_0x59739f){_0x2b4f21[_0x59739f]=safeTemplate(_0x4ec7aa[_0x59739f]);return _0x2b4f21;},{});}return _0x36912c;}module[_0x2097('0x7')][_0x2097('0x8')]=safeTemplate; \ No newline at end of file +var _0x0598=['exports','safeTemplate','lodash','\x20}\x20}','string','replace','isPlainObject','keys'];(function(_0x4e0c19,_0x55bbc7){var _0x503cb4=function(_0x527737){while(--_0x527737){_0x4e0c19['push'](_0x4e0c19['shift']());}};_0x503cb4(++_0x55bbc7);}(_0x0598,0x92));var _0x8059=function(_0x497552,_0x2c81a4){_0x497552=_0x497552-0x0;var _0x55fa7e=_0x0598[_0x497552];return _0x55fa7e;};var _=require(_0x8059('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x8f4b1){return _0x8f4b1==='{{'?'{\x20{\x20':_0x8059('0x1');}function safeTemplate(_0x52c9bf){var _0x4dad54=_0x52c9bf;if(typeof _0x52c9bf===_0x8059('0x2')){_0x4dad54=_0x52c9bf[_0x8059('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x52c9bf)){_0x4dad54=_0x52c9bf['map'](function(_0x555fb5){return safeTemplate(_0x555fb5);});}else if(_[_0x8059('0x4')](_0x52c9bf)){_0x4dad54=Object[_0x8059('0x5')](_0x52c9bf)['reduce'](function(_0x5996d7,_0x248273){_0x5996d7[_0x248273]=safeTemplate(_0x52c9bf[_0x248273]);return _0x5996d7;},{});}return _0x4dad54;}module[_0x8059('0x6')][_0x8059('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index c018c53..6696ad7 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 _0x8e4d=['server/app.json','findIndex','motion2','apps','env','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','path','../config/environment','root','resolve'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e4d,0x1be));var _0xd8e4=function(_0x242f30,_0x373614){_0x242f30=_0x242f30-0x0;var _0x19cc0a=_0x8e4d[_0x242f30];return _0x19cc0a;};var fs=require('fs-extra');var path=require(_0xd8e4('0x0'));var config=require(_0xd8e4('0x1'));var root=config[_0xd8e4('0x2')];var APP_JSON_PATH=path[_0xd8e4('0x3')](root,_0xd8e4('0x4'));var NODEPATH=path[_0xd8e4('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x19bcb6){let _0x231d17=![];if(Array['isArray'](_0x19bcb6['apps'])){var _0x1e5a68=_0x19bcb6['apps'][_0xd8e4('0x5')](function(_0x485a88){return _0x485a88['name']===_0xd8e4('0x6');});if(_0x1e5a68>-0x1){var _0x4add25=_0x19bcb6[_0xd8e4('0x7')][_0x1e5a68];if(typeof _0x4add25[_0xd8e4('0x8')]['NODE_PATH']!=='string'){_0x4add25[_0xd8e4('0x8')][_0xd8e4('0x9')]=NODEPATH;_0x231d17=!![];}}return{'appConfig':_0x19bcb6,'updated':_0x231d17};}}function updateAppConfig(_0x509464){return fs[_0xd8e4('0xa')](APP_JSON_PATH)[_0xd8e4('0xb')](function(_0x1d46e1){if(_0x1d46e1){return fs[_0xd8e4('0xc')](APP_JSON_PATH)[_0xd8e4('0xb')](function(_0x8f1244){var _0x58a682=setLegacyLibsNodeEnvPath(_0x8f1244);if(_0x58a682[_0xd8e4('0xd')]){_0x509464[_0xd8e4('0xe')](_0xd8e4('0xf'));return fs[_0xd8e4('0x10')](APP_JSON_PATH,_0x8f1244,{'spaces':0x2});}else{return Promise[_0xd8e4('0x3')]();}});}else{return Promise[_0xd8e4('0x3')]();}});}module[_0xd8e4('0x11')]=updateAppConfig; \ No newline at end of file +var _0x57f6=['../config/environment','resolve','server/app.json','legacy-libs','apps','findIndex','motion2','NODE_PATH','string','then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra'];(function(_0x3ed85f,_0x3d6a36){var _0xb937f=function(_0x125bbd){while(--_0x125bbd){_0x3ed85f['push'](_0x3ed85f['shift']());}};_0xb937f(++_0x3d6a36);}(_0x57f6,0xcf));var _0x657f=function(_0x31c3d5,_0x40a38c){_0x31c3d5=_0x31c3d5-0x0;var _0x5424ba=_0x57f6[_0x31c3d5];return _0x5424ba;};var fs=require(_0x657f('0x0'));var path=require('path');var config=require(_0x657f('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0x657f('0x2')](root,_0x657f('0x3'));var NODEPATH=path[_0x657f('0x2')](root,_0x657f('0x4'));function setLegacyLibsNodeEnvPath(_0x16751e){let _0x85f1c8=![];if(Array['isArray'](_0x16751e[_0x657f('0x5')])){var _0x41c2aa=_0x16751e[_0x657f('0x5')][_0x657f('0x6')](function(_0x323eba){return _0x323eba['name']===_0x657f('0x7');});if(_0x41c2aa>-0x1){var _0x3c7383=_0x16751e[_0x657f('0x5')][_0x41c2aa];if(typeof _0x3c7383['env'][_0x657f('0x8')]!==_0x657f('0x9')){_0x3c7383['env'][_0x657f('0x8')]=NODEPATH;_0x85f1c8=!![];}}return{'appConfig':_0x16751e,'updated':_0x85f1c8};}}function updateAppConfig(_0x5ee8d5){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x32222b){if(_0x32222b){return fs['readJSON'](APP_JSON_PATH)[_0x657f('0xa')](function(_0x519860){var _0x58b486=setLegacyLibsNodeEnvPath(_0x519860);if(_0x58b486[_0x657f('0xb')]){_0x5ee8d5[_0x657f('0xc')](_0x657f('0xd'));return fs[_0x657f('0xe')](APP_JSON_PATH,_0x519860,{'spaces':0x2});}else{return Promise[_0x657f('0x2')]();}});}else{return Promise[_0x657f('0x2')]();}});}module[_0x657f('0xf')]=updateAppConfig; \ No newline at end of file